local-operator-ui 0.32.3 → 0.32.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/out/main/index.js +34 -2
  2. package/out/renderer/assets/{_basePickBy-B8Qlf7Er.js → _basePickBy-CjK8J1ko.js} +1 -1
  3. package/out/renderer/assets/{_baseUniq-Dsdryz8Q.js → _baseUniq-iXcRyKXm.js} +1 -1
  4. package/out/renderer/assets/{agent-details-page-D3M6i4Zf.js → agent-details-page-BzANbiHv.js} +1 -1
  5. package/out/renderer/assets/{agent-hub-page-4mSQ6ykI.js → agent-hub-page-CO896V5d.js} +3 -3
  6. package/out/renderer/assets/{agents-page-_DauTxks.js → agents-page-C1YYkATW.js} +3 -3
  7. package/out/renderer/assets/{arc-DIKk33c1.js → arc-DSzdvb-p.js} +1 -1
  8. package/out/renderer/assets/{architectureDiagram-IEHRJDOE-D_iXTZhU.js → architectureDiagram-IEHRJDOE-Btaox3jN.js} +1 -1
  9. package/out/renderer/assets/{blockDiagram-JOT3LUYC-CFQBvLl2.js → blockDiagram-JOT3LUYC-C-fhdoup.js} +1 -1
  10. package/out/renderer/assets/{browser-page-COd60oBu.js → browser-page-CXnz4yK0.js} +1 -1
  11. package/out/renderer/assets/{browser-webauthn-prompt-CCnbkKBw.js → browser-webauthn-prompt-D60RMWTt.js} +1 -1
  12. package/out/renderer/assets/{c4Diagram-VJAJSXHY-hSZ61XP8.js → c4Diagram-VJAJSXHY-BV8WjI_N.js} +1 -1
  13. package/out/renderer/assets/channel-YjlaLMSb.js +1 -0
  14. package/out/renderer/assets/{chunk-4BMEZGHF-ByvUxlwL.js → chunk-4BMEZGHF-DLe3c9GX.js} +1 -1
  15. package/out/renderer/assets/{chunk-A2AXSNBT-C7I3LSLt.js → chunk-A2AXSNBT-2USPa4Dy.js} +1 -1
  16. package/out/renderer/assets/{chunk-AEK57VVT-DlcbhveB.js → chunk-AEK57VVT-dVGtqA7z.js} +1 -1
  17. package/out/renderer/assets/{chunk-D6G4REZN-Vr6-1rCd.js → chunk-D6G4REZN-B4_EX1rg.js} +1 -1
  18. package/out/renderer/assets/{chunk-RZ5BOZE2-Ce1S3X33.js → chunk-RZ5BOZE2-Bta5D-vX.js} +1 -1
  19. package/out/renderer/assets/{chunk-XZIHB7SX-CpwBuqyP.js → chunk-XZIHB7SX-i4ArBNLI.js} +1 -1
  20. package/out/renderer/assets/classDiagram-GIVACNV2-BHFyS6ei.js +1 -0
  21. package/out/renderer/assets/classDiagram-v2-COTLJTTW-BHFyS6ei.js +1 -0
  22. package/out/renderer/assets/clone-DBH_QsN1.js +1 -0
  23. package/out/renderer/assets/{conversation-input-sync-ztF2uENp.js → conversation-input-sync-CyctUEWr.js} +239 -239
  24. package/out/renderer/assets/{dagre-OKDRZEBW-CFuwTnbl.js → dagre-OKDRZEBW-EyHSAPT7.js} +1 -1
  25. package/out/renderer/assets/{diagram-SSKATNLV-eW1-TMoM.js → diagram-SSKATNLV-D_Ci5F6Q.js} +1 -1
  26. package/out/renderer/assets/{diagram-VNBRO52H-COtG874c.js → diagram-VNBRO52H-C8dvE9sI.js} +1 -1
  27. package/out/renderer/assets/{erDiagram-Q7BY3M3F-DCpuAzid.js → erDiagram-Q7BY3M3F-DxjXnfZw.js} +1 -1
  28. package/out/renderer/assets/{flowDiagram-4HSFHLVR-D0OpPVjR.js → flowDiagram-4HSFHLVR-BkJ35sqU.js} +1 -1
  29. package/out/renderer/assets/{ganttDiagram-APWFNJXF-uZoJ5M51.js → ganttDiagram-APWFNJXF-BgeRhVdz.js} +1 -1
  30. package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-dEbJyobF.js → gitGraphDiagram-7IBYFJ6S-CsNXwJ1Z.js} +1 -1
  31. package/out/renderer/assets/{graph-Bf2xoA4c.js → graph-vn67EOK3.js} +1 -1
  32. package/out/renderer/assets/{index-2LU4Cd3s.js → index-Bu7e3rSb.js} +187 -187
  33. package/out/renderer/assets/{index-CNArcL7T.js → index-Cx-WVD9G.js} +1 -1
  34. package/out/renderer/assets/{index-DtU-En7k.js → index-DS9vxVaQ.js} +1 -1
  35. package/out/renderer/assets/{infoDiagram-PH2N3AL5-BhEM5meY.js → infoDiagram-PH2N3AL5-CV-g-mjS.js} +1 -1
  36. package/out/renderer/assets/{journeyDiagram-U35MCT3I-HXNpm8Jj.js → journeyDiagram-U35MCT3I-I57ox-dW.js} +1 -1
  37. package/out/renderer/assets/{kanban-definition-NDS4AKOZ-BAtAUqHM.js → kanban-definition-NDS4AKOZ-km2hq1fY.js} +1 -1
  38. package/out/renderer/assets/{layout-CpstO-oE.js → layout-CJ42RoVR.js} +1 -1
  39. package/out/renderer/assets/{legacy-agents-page-DCOC8Tle.js → legacy-agents-page-r2Xc2fks.js} +1 -1
  40. package/out/renderer/assets/{mermaid.core-DmRnOx5f.js → mermaid.core-DQsftHid.js} +5 -5
  41. package/out/renderer/assets/mesh-page-DejMbpGY.js +1 -0
  42. package/out/renderer/assets/{mindmap-definition-ALO5MXBD-BoIsKamK.js → mindmap-definition-ALO5MXBD-B_Hx68jr.js} +1 -1
  43. package/out/renderer/assets/{mini-Jvr5I_Rk.js → mini-BzGdxFI_.js} +1 -1
  44. package/out/renderer/assets/{org-surface-gate-CVVzZd9o.js → org-surface-gate-CNy4oo3A.js} +1 -1
  45. package/out/renderer/assets/{pieDiagram-IB7DONF6-CfH05_IM.js → pieDiagram-IB7DONF6-CM8q0hlY.js} +1 -1
  46. package/out/renderer/assets/{projects-page-BGGVrY3C.js → projects-page-bHdWZ0Kx.js} +1 -1
  47. package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-CAYKVWdZ.js → quadrantDiagram-7GDLP6J5-DqoQ8lz2.js} +1 -1
  48. package/out/renderer/assets/{radar-MK3ICKWK-CiWFQ2gN.js → radar-MK3ICKWK-C-OrPLEs.js} +1 -1
  49. package/out/renderer/assets/{radient-auth-buttons-DDa7dmwu.js → radient-auth-buttons-Cju8RhKQ.js} +1 -1
  50. package/out/renderer/assets/{requirementDiagram-KVF5MWMF-DiB5rNkI.js → requirementDiagram-KVF5MWMF-DtpTdYbV.js} +1 -1
  51. package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-ZBkoa531.js → sankeyDiagram-QLVOVGJD-BFX_LBnO.js} +1 -1
  52. package/out/renderer/assets/{schedules-page-D29ivDk1.js → schedules-page-D9mb_-BC.js} +1 -1
  53. package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-BIfJ5ZAM.js → sequenceDiagram-X6HHIX6F-lUYP-LDw.js} +1 -1
  54. package/out/renderer/assets/{settings-page-DFBspqht.js → settings-page-DUIyql2W.js} +7 -7
  55. package/out/renderer/assets/{stateDiagram-DGXRK772-DPnXecEL.js → stateDiagram-DGXRK772-BPJsQn4b.js} +1 -1
  56. package/out/renderer/assets/{stateDiagram-v2-YXO3MK2T-w326tl_e.js → stateDiagram-v2-YXO3MK2T-DFNM7_ku.js} +1 -1
  57. package/out/renderer/assets/{timeline-definition-BDJGKUSR-B-Kq_ROU.js → timeline-definition-BDJGKUSR-jwbIRZBB.js} +1 -1
  58. package/out/renderer/assets/{use-download-agent-mutation-CDNzydiw.js → use-download-agent-mutation-B9PktiM4.js} +1 -1
  59. package/out/renderer/assets/{use-memberships-query-CX0l7_F8.js → use-memberships-query-DjBVKN3g.js} +1 -1
  60. package/out/renderer/assets/{xychartDiagram-VJFVF3MP-CEzW9qk7.js → xychartDiagram-VJFVF3MP-C7CoMzZa.js} +1 -1
  61. package/out/renderer/index.html +2 -2
  62. package/out/renderer/mini.html +2 -2
  63. package/package.json +2 -2
  64. package/out/renderer/assets/channel-CEa21TjA.js +0 -1
  65. package/out/renderer/assets/classDiagram-GIVACNV2-BclaHtGg.js +0 -1
  66. package/out/renderer/assets/classDiagram-v2-COTLJTTW-BclaHtGg.js +0 -1
  67. package/out/renderer/assets/clone-CEOncWhu.js +0 -1
  68. package/out/renderer/assets/mesh-page-Xh_-o655.js +0 -1
@@ -1 +1 @@
1
- import{s as W,a as P,S as N}from"./chunk-AEK57VVT-DlcbhveB.js";import{_ as u,c as t,d as H,l as S,e as C,k as z,u as U}from"./mermaid.core-DmRnOx5f.js";import{G as F}from"./graph-Bf2xoA4c.js";import{l as O}from"./layout-CpstO-oE.js";import{v as J,x as X}from"./conversation-input-sync-ztF2uENp.js";import"./chunk-RZ5BOZE2-Ce1S3X33.js";import"./index-DkZDDEqx.js";import"./_baseUniq-Dsdryz8Q.js";import"./_basePickBy-B8Qlf7Er.js";import"./ui-preferences-store-BcI6fr9b.js";import"./error-boundary-Chq_L-1d.js";var L={},D=u((e,i)=>{L[e]=i},"set"),Y=u(e=>L[e],"get"),G=u(()=>Object.keys(L),"keys"),I=u(()=>G().length,"size"),$={get:Y,set:D,keys:G,size:I},j=u(e=>e.append("circle").attr("class","start-state").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit).attr("cy",t().state.padding+t().state.sizeUnit),"drawStartState"),q=u(e=>e.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",t().state.textHeight).attr("class","divider").attr("x2",t().state.textHeight*2).attr("y1",0).attr("y2",0),"drawDivider"),Z=u((e,i)=>{const d=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+2*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),o=d.node().getBBox();return e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",o.width+2*t().state.padding).attr("height",o.height+2*t().state.padding).attr("rx",t().state.radius),d},"drawSimpleState"),K=u((e,i)=>{const d=u(function(l,B,m){const k=l.append("tspan").attr("x",2*t().state.padding).text(B);m||k.attr("dy",t().state.textHeight)},"addTspan"),n=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+1.3*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.descriptions[0]).node().getBBox(),g=n.height,x=e.append("text").attr("x",t().state.padding).attr("y",g+t().state.padding*.4+t().state.dividerMargin+t().state.textHeight).attr("class","state-description");let a=!0,s=!0;i.descriptions.forEach(function(l){a||(d(x,l,s),s=!1),a=!1});const y=e.append("line").attr("x1",t().state.padding).attr("y1",t().state.padding+g+t().state.dividerMargin/2).attr("y2",t().state.padding+g+t().state.dividerMargin/2).attr("class","descr-divider"),p=x.node().getBBox(),c=Math.max(p.width,n.width);return y.attr("x2",c+3*t().state.padding),e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",c+2*t().state.padding).attr("height",p.height+g+2*t().state.padding).attr("rx",t().state.radius),e},"drawDescrState"),Q=u((e,i,d)=>{const o=t().state.padding,n=2*t().state.padding,g=e.node().getBBox(),x=g.width,a=g.x,s=e.append("text").attr("x",0).attr("y",t().state.titleShift).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),p=s.node().getBBox().width+n;let c=Math.max(p,x);c===x&&(c=c+n);let l;const B=e.node().getBBox();i.doc,l=a-o,p>x&&(l=(x-c)/2+o),Math.abs(a-B.x)<o&&p>x&&(l=a-(p-x)/2);const m=1-t().state.textHeight;return e.insert("rect",":first-child").attr("x",l).attr("y",m).attr("class",d?"alt-composit":"composit").attr("width",c).attr("height",B.height+t().state.textHeight+t().state.titleShift+1).attr("rx","0"),s.attr("x",l+o),p<=x&&s.attr("x",a+(c-n)/2-p/2+o),e.insert("rect",":first-child").attr("x",l).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",c).attr("height",t().state.textHeight*3).attr("rx",t().state.radius),e.insert("rect",":first-child").attr("x",l).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",c).attr("height",B.height+3+2*t().state.textHeight).attr("rx",t().state.radius),e},"addTitleAndBox"),V=u(e=>(e.append("circle").attr("class","end-state-outer").attr("r",t().state.sizeUnit+t().state.miniPadding).attr("cx",t().state.padding+t().state.sizeUnit+t().state.miniPadding).attr("cy",t().state.padding+t().state.sizeUnit+t().state.miniPadding),e.append("circle").attr("class","end-state-inner").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit+2).attr("cy",t().state.padding+t().state.sizeUnit+2)),"drawEndState"),tt=u((e,i)=>{let d=t().state.forkWidth,o=t().state.forkHeight;if(i.parentId){let n=d;d=o,o=n}return e.append("rect").style("stroke","black").style("fill","black").attr("width",d).attr("height",o).attr("x",t().state.padding).attr("y",t().state.padding)},"drawForkJoinState"),et=u((e,i,d,o)=>{let n=0;const g=o.append("text");g.style("text-anchor","start"),g.attr("class","noteText");let x=e.replace(/\r\n/g,"<br/>");x=x.replace(/\n/g,"<br/>");const a=x.split(z.lineBreakRegex);let s=1.25*t().state.noteMargin;for(const y of a){const p=y.trim();if(p.length>0){const c=g.append("tspan");if(c.text(p),s===0){const l=c.node().getBBox();s+=l.height}n+=s,c.attr("x",i+t().state.noteMargin),c.attr("y",d+n+1.25*t().state.noteMargin)}}return{textWidth:g.node().getBBox().width,textHeight:n}},"_drawLongText"),at=u((e,i)=>{i.attr("class","state-note");const d=i.append("rect").attr("x",0).attr("y",t().state.padding),o=i.append("g"),{textWidth:n,textHeight:g}=et(e,0,0,o);return d.attr("height",g+2*t().state.noteMargin),d.attr("width",n+t().state.noteMargin*2),d},"drawNote"),_=u(function(e,i){const d=i.id,o={id:d,label:i.id,width:0,height:0},n=e.append("g").attr("id",d).attr("class","stateGroup");i.type==="start"&&j(n),i.type==="end"&&V(n),(i.type==="fork"||i.type==="join")&&tt(n,i),i.type==="note"&&at(i.note.text,n),i.type==="divider"&&q(n),i.type==="default"&&i.descriptions.length===0&&Z(n,i),i.type==="default"&&i.descriptions.length>0&&K(n,i);const g=n.node().getBBox();return o.width=g.width+2*t().state.padding,o.height=g.height+2*t().state.padding,$.set(d,o),o},"drawState"),A=0,it=u(function(e,i,d){const o=u(function(s){switch(s){case N.relationType.AGGREGATION:return"aggregation";case N.relationType.EXTENSION:return"extension";case N.relationType.COMPOSITION:return"composition";case N.relationType.DEPENDENCY:return"dependency"}},"getRelationType");i.points=i.points.filter(s=>!Number.isNaN(s.y));const n=i.points,g=J().x(function(s){return s.x}).y(function(s){return s.y}).curve(X),x=e.append("path").attr("d",g(n)).attr("id","edge"+A).attr("class","transition");let a="";if(t().state.arrowMarkerAbsolute&&(a=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,a=a.replace(/\(/g,"\\("),a=a.replace(/\)/g,"\\)")),x.attr("marker-end","url("+a+"#"+o(N.relationType.DEPENDENCY)+"End)"),d.title!==void 0){const s=e.append("g").attr("class","stateLabel"),{x:y,y:p}=U.calcLabelPosition(i.points),c=z.getRows(d.title);let l=0;const B=[];let m=0,k=0;for(let f=0;f<=c.length;f++){const h=s.append("text").attr("text-anchor","middle").text(c[f]).attr("x",y).attr("y",p+l),w=h.node().getBBox();m=Math.max(m,w.width),k=Math.min(k,w.x),S.info(w.x,y,p+l),l===0&&(l=h.node().getBBox().height,S.info("Title height",l,p)),B.push(h)}let E=l*c.length;if(c.length>1){const f=(c.length-1)*l*.5;B.forEach((h,w)=>h.attr("y",p+w*l-f)),E=l*c.length}const r=s.node().getBBox();s.insert("rect",":first-child").attr("class","box").attr("x",y-m/2-t().state.padding/2).attr("y",p-E/2-t().state.padding/2-3.5).attr("width",m+t().state.padding).attr("height",E+t().state.padding),S.info(r)}A++},"drawEdge"),b,T={},rt=u(function(){},"setConf"),nt=u(function(e){e.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"insertMarkers"),st=u(function(e,i,d,o){b=t().state;const n=t().securityLevel;let g;n==="sandbox"&&(g=H("#i"+i));const x=n==="sandbox"?H(g.nodes()[0].contentDocument.body):H("body"),a=n==="sandbox"?g.nodes()[0].contentDocument:document;S.debug("Rendering diagram "+e);const s=x.select(`[id='${i}']`);nt(s);const y=o.db.getRootDoc();R(y,s,void 0,!1,x,a,o);const p=b.padding,c=s.node().getBBox(),l=c.width+p*2,B=c.height+p*2,m=l*1.75;C(s,B,m,b.useMaxWidth),s.attr("viewBox",`${c.x-b.padding} ${c.y-b.padding} `+l+" "+B)},"draw"),dt=u(e=>e?e.length*b.fontSizeFactor:1,"getLabelWidth"),R=u((e,i,d,o,n,g,x)=>{const a=new F({compound:!0,multigraph:!0});let s,y=!0;for(s=0;s<e.length;s++)if(e[s].stmt==="relation"){y=!1;break}d?a.setGraph({rankdir:"LR",multigraph:!0,compound:!0,ranker:"tight-tree",ranksep:y?1:b.edgeLengthFactor,nodeSep:y?1:50,isMultiGraph:!0}):a.setGraph({rankdir:"TB",multigraph:!0,compound:!0,ranksep:y?1:b.edgeLengthFactor,nodeSep:y?1:50,ranker:"tight-tree",isMultiGraph:!0}),a.setDefaultEdgeLabel(function(){return{}});const p=x.db.getStates(),c=x.db.getRelations(),l=Object.keys(p);for(const r of l){const f=p[r];d&&(f.parentId=d);let h;if(f.doc){let w=i.append("g").attr("id",f.id).attr("class","stateGroup");h=R(f.doc,w,f.id,!o,n,g,x);{w=Q(w,f,o);let v=w.node().getBBox();h.width=v.width,h.height=v.height+b.padding/2,T[f.id]={y:b.compositTitleSize}}}else h=_(i,f,a);if(f.note){const w={descriptions:[],id:f.id+"-note",note:f.note,type:"note"},v=_(i,w,a);f.note.position==="left of"?(a.setNode(h.id+"-note",v),a.setNode(h.id,h)):(a.setNode(h.id,h),a.setNode(h.id+"-note",v)),a.setParent(h.id,h.id+"-group"),a.setParent(h.id+"-note",h.id+"-group")}else a.setNode(h.id,h)}S.debug("Count=",a.nodeCount(),a);let B=0;c.forEach(function(r){B++,S.debug("Setting edge",r),a.setEdge(r.id1,r.id2,{relation:r,width:dt(r.title),height:b.labelHeight*z.getRows(r.title).length,labelpos:"c"},"id"+B)}),O(a),S.debug("Graph after layout",a.nodes());const m=i.node();a.nodes().forEach(function(r){r!==void 0&&a.node(r)!==void 0?(S.warn("Node "+r+": "+JSON.stringify(a.node(r))),n.select("#"+m.id+" #"+r).attr("transform","translate("+(a.node(r).x-a.node(r).width/2)+","+(a.node(r).y+(T[r]?T[r].y:0)-a.node(r).height/2)+" )"),n.select("#"+m.id+" #"+r).attr("data-x-shift",a.node(r).x-a.node(r).width/2),g.querySelectorAll("#"+m.id+" #"+r+" .divider").forEach(h=>{const w=h.parentElement;let v=0,M=0;w&&(w.parentElement&&(v=w.parentElement.getBBox().width),M=parseInt(w.getAttribute("data-x-shift"),10),Number.isNaN(M)&&(M=0)),h.setAttribute("x1",0-M+8),h.setAttribute("x2",v-M-8)})):S.debug("No Node "+r+": "+JSON.stringify(a.node(r)))});let k=m.getBBox();a.edges().forEach(function(r){r!==void 0&&a.edge(r)!==void 0&&(S.debug("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(a.edge(r))),it(i,a.edge(r),a.edge(r).relation))}),k=m.getBBox();const E={id:d||"root",label:d||"root",width:0,height:0};return E.width=k.width+2*b.padding,E.height=k.height+2*b.padding,S.debug("Doc rendered",E,a),E},"renderDoc"),ot={setConf:rt,draw:st},Bt={parser:P,get db(){return new N(1)},renderer:ot,styles:W,init:u(e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")};export{Bt as diagram};
1
+ import{s as W,a as P,S as N}from"./chunk-AEK57VVT-dVGtqA7z.js";import{_ as u,c as t,d as H,l as S,e as C,k as z,u as U}from"./mermaid.core-DQsftHid.js";import{G as F}from"./graph-vn67EOK3.js";import{l as O}from"./layout-CJ42RoVR.js";import{v as J,x as X}from"./conversation-input-sync-CyctUEWr.js";import"./chunk-RZ5BOZE2-Bta5D-vX.js";import"./index-DkZDDEqx.js";import"./_baseUniq-iXcRyKXm.js";import"./_basePickBy-CjK8J1ko.js";import"./ui-preferences-store-BcI6fr9b.js";import"./error-boundary-Chq_L-1d.js";var L={},D=u((e,i)=>{L[e]=i},"set"),Y=u(e=>L[e],"get"),G=u(()=>Object.keys(L),"keys"),I=u(()=>G().length,"size"),$={get:Y,set:D,keys:G,size:I},j=u(e=>e.append("circle").attr("class","start-state").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit).attr("cy",t().state.padding+t().state.sizeUnit),"drawStartState"),q=u(e=>e.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",t().state.textHeight).attr("class","divider").attr("x2",t().state.textHeight*2).attr("y1",0).attr("y2",0),"drawDivider"),Z=u((e,i)=>{const d=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+2*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),o=d.node().getBBox();return e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",o.width+2*t().state.padding).attr("height",o.height+2*t().state.padding).attr("rx",t().state.radius),d},"drawSimpleState"),K=u((e,i)=>{const d=u(function(l,B,m){const k=l.append("tspan").attr("x",2*t().state.padding).text(B);m||k.attr("dy",t().state.textHeight)},"addTspan"),n=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+1.3*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.descriptions[0]).node().getBBox(),g=n.height,x=e.append("text").attr("x",t().state.padding).attr("y",g+t().state.padding*.4+t().state.dividerMargin+t().state.textHeight).attr("class","state-description");let a=!0,s=!0;i.descriptions.forEach(function(l){a||(d(x,l,s),s=!1),a=!1});const y=e.append("line").attr("x1",t().state.padding).attr("y1",t().state.padding+g+t().state.dividerMargin/2).attr("y2",t().state.padding+g+t().state.dividerMargin/2).attr("class","descr-divider"),p=x.node().getBBox(),c=Math.max(p.width,n.width);return y.attr("x2",c+3*t().state.padding),e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",c+2*t().state.padding).attr("height",p.height+g+2*t().state.padding).attr("rx",t().state.radius),e},"drawDescrState"),Q=u((e,i,d)=>{const o=t().state.padding,n=2*t().state.padding,g=e.node().getBBox(),x=g.width,a=g.x,s=e.append("text").attr("x",0).attr("y",t().state.titleShift).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),p=s.node().getBBox().width+n;let c=Math.max(p,x);c===x&&(c=c+n);let l;const B=e.node().getBBox();i.doc,l=a-o,p>x&&(l=(x-c)/2+o),Math.abs(a-B.x)<o&&p>x&&(l=a-(p-x)/2);const m=1-t().state.textHeight;return e.insert("rect",":first-child").attr("x",l).attr("y",m).attr("class",d?"alt-composit":"composit").attr("width",c).attr("height",B.height+t().state.textHeight+t().state.titleShift+1).attr("rx","0"),s.attr("x",l+o),p<=x&&s.attr("x",a+(c-n)/2-p/2+o),e.insert("rect",":first-child").attr("x",l).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",c).attr("height",t().state.textHeight*3).attr("rx",t().state.radius),e.insert("rect",":first-child").attr("x",l).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",c).attr("height",B.height+3+2*t().state.textHeight).attr("rx",t().state.radius),e},"addTitleAndBox"),V=u(e=>(e.append("circle").attr("class","end-state-outer").attr("r",t().state.sizeUnit+t().state.miniPadding).attr("cx",t().state.padding+t().state.sizeUnit+t().state.miniPadding).attr("cy",t().state.padding+t().state.sizeUnit+t().state.miniPadding),e.append("circle").attr("class","end-state-inner").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit+2).attr("cy",t().state.padding+t().state.sizeUnit+2)),"drawEndState"),tt=u((e,i)=>{let d=t().state.forkWidth,o=t().state.forkHeight;if(i.parentId){let n=d;d=o,o=n}return e.append("rect").style("stroke","black").style("fill","black").attr("width",d).attr("height",o).attr("x",t().state.padding).attr("y",t().state.padding)},"drawForkJoinState"),et=u((e,i,d,o)=>{let n=0;const g=o.append("text");g.style("text-anchor","start"),g.attr("class","noteText");let x=e.replace(/\r\n/g,"<br/>");x=x.replace(/\n/g,"<br/>");const a=x.split(z.lineBreakRegex);let s=1.25*t().state.noteMargin;for(const y of a){const p=y.trim();if(p.length>0){const c=g.append("tspan");if(c.text(p),s===0){const l=c.node().getBBox();s+=l.height}n+=s,c.attr("x",i+t().state.noteMargin),c.attr("y",d+n+1.25*t().state.noteMargin)}}return{textWidth:g.node().getBBox().width,textHeight:n}},"_drawLongText"),at=u((e,i)=>{i.attr("class","state-note");const d=i.append("rect").attr("x",0).attr("y",t().state.padding),o=i.append("g"),{textWidth:n,textHeight:g}=et(e,0,0,o);return d.attr("height",g+2*t().state.noteMargin),d.attr("width",n+t().state.noteMargin*2),d},"drawNote"),_=u(function(e,i){const d=i.id,o={id:d,label:i.id,width:0,height:0},n=e.append("g").attr("id",d).attr("class","stateGroup");i.type==="start"&&j(n),i.type==="end"&&V(n),(i.type==="fork"||i.type==="join")&&tt(n,i),i.type==="note"&&at(i.note.text,n),i.type==="divider"&&q(n),i.type==="default"&&i.descriptions.length===0&&Z(n,i),i.type==="default"&&i.descriptions.length>0&&K(n,i);const g=n.node().getBBox();return o.width=g.width+2*t().state.padding,o.height=g.height+2*t().state.padding,$.set(d,o),o},"drawState"),A=0,it=u(function(e,i,d){const o=u(function(s){switch(s){case N.relationType.AGGREGATION:return"aggregation";case N.relationType.EXTENSION:return"extension";case N.relationType.COMPOSITION:return"composition";case N.relationType.DEPENDENCY:return"dependency"}},"getRelationType");i.points=i.points.filter(s=>!Number.isNaN(s.y));const n=i.points,g=J().x(function(s){return s.x}).y(function(s){return s.y}).curve(X),x=e.append("path").attr("d",g(n)).attr("id","edge"+A).attr("class","transition");let a="";if(t().state.arrowMarkerAbsolute&&(a=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,a=a.replace(/\(/g,"\\("),a=a.replace(/\)/g,"\\)")),x.attr("marker-end","url("+a+"#"+o(N.relationType.DEPENDENCY)+"End)"),d.title!==void 0){const s=e.append("g").attr("class","stateLabel"),{x:y,y:p}=U.calcLabelPosition(i.points),c=z.getRows(d.title);let l=0;const B=[];let m=0,k=0;for(let f=0;f<=c.length;f++){const h=s.append("text").attr("text-anchor","middle").text(c[f]).attr("x",y).attr("y",p+l),w=h.node().getBBox();m=Math.max(m,w.width),k=Math.min(k,w.x),S.info(w.x,y,p+l),l===0&&(l=h.node().getBBox().height,S.info("Title height",l,p)),B.push(h)}let E=l*c.length;if(c.length>1){const f=(c.length-1)*l*.5;B.forEach((h,w)=>h.attr("y",p+w*l-f)),E=l*c.length}const r=s.node().getBBox();s.insert("rect",":first-child").attr("class","box").attr("x",y-m/2-t().state.padding/2).attr("y",p-E/2-t().state.padding/2-3.5).attr("width",m+t().state.padding).attr("height",E+t().state.padding),S.info(r)}A++},"drawEdge"),b,T={},rt=u(function(){},"setConf"),nt=u(function(e){e.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"insertMarkers"),st=u(function(e,i,d,o){b=t().state;const n=t().securityLevel;let g;n==="sandbox"&&(g=H("#i"+i));const x=n==="sandbox"?H(g.nodes()[0].contentDocument.body):H("body"),a=n==="sandbox"?g.nodes()[0].contentDocument:document;S.debug("Rendering diagram "+e);const s=x.select(`[id='${i}']`);nt(s);const y=o.db.getRootDoc();R(y,s,void 0,!1,x,a,o);const p=b.padding,c=s.node().getBBox(),l=c.width+p*2,B=c.height+p*2,m=l*1.75;C(s,B,m,b.useMaxWidth),s.attr("viewBox",`${c.x-b.padding} ${c.y-b.padding} `+l+" "+B)},"draw"),dt=u(e=>e?e.length*b.fontSizeFactor:1,"getLabelWidth"),R=u((e,i,d,o,n,g,x)=>{const a=new F({compound:!0,multigraph:!0});let s,y=!0;for(s=0;s<e.length;s++)if(e[s].stmt==="relation"){y=!1;break}d?a.setGraph({rankdir:"LR",multigraph:!0,compound:!0,ranker:"tight-tree",ranksep:y?1:b.edgeLengthFactor,nodeSep:y?1:50,isMultiGraph:!0}):a.setGraph({rankdir:"TB",multigraph:!0,compound:!0,ranksep:y?1:b.edgeLengthFactor,nodeSep:y?1:50,ranker:"tight-tree",isMultiGraph:!0}),a.setDefaultEdgeLabel(function(){return{}});const p=x.db.getStates(),c=x.db.getRelations(),l=Object.keys(p);for(const r of l){const f=p[r];d&&(f.parentId=d);let h;if(f.doc){let w=i.append("g").attr("id",f.id).attr("class","stateGroup");h=R(f.doc,w,f.id,!o,n,g,x);{w=Q(w,f,o);let v=w.node().getBBox();h.width=v.width,h.height=v.height+b.padding/2,T[f.id]={y:b.compositTitleSize}}}else h=_(i,f,a);if(f.note){const w={descriptions:[],id:f.id+"-note",note:f.note,type:"note"},v=_(i,w,a);f.note.position==="left of"?(a.setNode(h.id+"-note",v),a.setNode(h.id,h)):(a.setNode(h.id,h),a.setNode(h.id+"-note",v)),a.setParent(h.id,h.id+"-group"),a.setParent(h.id+"-note",h.id+"-group")}else a.setNode(h.id,h)}S.debug("Count=",a.nodeCount(),a);let B=0;c.forEach(function(r){B++,S.debug("Setting edge",r),a.setEdge(r.id1,r.id2,{relation:r,width:dt(r.title),height:b.labelHeight*z.getRows(r.title).length,labelpos:"c"},"id"+B)}),O(a),S.debug("Graph after layout",a.nodes());const m=i.node();a.nodes().forEach(function(r){r!==void 0&&a.node(r)!==void 0?(S.warn("Node "+r+": "+JSON.stringify(a.node(r))),n.select("#"+m.id+" #"+r).attr("transform","translate("+(a.node(r).x-a.node(r).width/2)+","+(a.node(r).y+(T[r]?T[r].y:0)-a.node(r).height/2)+" )"),n.select("#"+m.id+" #"+r).attr("data-x-shift",a.node(r).x-a.node(r).width/2),g.querySelectorAll("#"+m.id+" #"+r+" .divider").forEach(h=>{const w=h.parentElement;let v=0,M=0;w&&(w.parentElement&&(v=w.parentElement.getBBox().width),M=parseInt(w.getAttribute("data-x-shift"),10),Number.isNaN(M)&&(M=0)),h.setAttribute("x1",0-M+8),h.setAttribute("x2",v-M-8)})):S.debug("No Node "+r+": "+JSON.stringify(a.node(r)))});let k=m.getBBox();a.edges().forEach(function(r){r!==void 0&&a.edge(r)!==void 0&&(S.debug("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(a.edge(r))),it(i,a.edge(r),a.edge(r).relation))}),k=m.getBBox();const E={id:d||"root",label:d||"root",width:0,height:0};return E.width=k.width+2*b.padding,E.height=k.height+2*b.padding,S.debug("Doc rendered",E,a),E},"renderDoc"),ot={setConf:rt,draw:st},Bt={parser:P,get db(){return new N(1)},renderer:ot,styles:W,init:u(e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")};export{Bt as diagram};
@@ -1 +1 @@
1
- import{s as r,b as e,a,S as s}from"./chunk-AEK57VVT-DlcbhveB.js";import{_ as i}from"./mermaid.core-DmRnOx5f.js";import"./chunk-RZ5BOZE2-Ce1S3X33.js";import"./conversation-input-sync-ztF2uENp.js";import"./ui-preferences-store-BcI6fr9b.js";import"./index-DkZDDEqx.js";import"./error-boundary-Chq_L-1d.js";var n={parser:a,get db(){return new s(2)},renderer:e,styles:r,init:i(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")};export{n as diagram};
1
+ import{s as r,b as e,a,S as s}from"./chunk-AEK57VVT-dVGtqA7z.js";import{_ as i}from"./mermaid.core-DQsftHid.js";import"./chunk-RZ5BOZE2-Bta5D-vX.js";import"./conversation-input-sync-CyctUEWr.js";import"./ui-preferences-store-BcI6fr9b.js";import"./index-DkZDDEqx.js";import"./error-boundary-Chq_L-1d.js";var n={parser:a,get db(){return new s(2)},renderer:e,styles:r,init:i(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")};export{n as diagram};
@@ -1,4 +1,4 @@
1
- import{_ as s,c as xt,l as E,d as j,V as kt,W as vt,X as _t,Y as bt,D as wt,$ as St,z as Et}from"./mermaid.core-DmRnOx5f.js";import{d as nt}from"./arc-DIKk33c1.js";import"./conversation-input-sync-ztF2uENp.js";import"./ui-preferences-store-BcI6fr9b.js";import"./index-DkZDDEqx.js";import"./error-boundary-Chq_L-1d.js";var Q=function(){var n=s(function(x,i,a,c){for(a=a||{},c=x.length;c--;a[x[c]]=i);return a},"o"),t=[6,8,10,11,12,14,16,17,20,21],e=[1,9],l=[1,10],r=[1,11],d=[1,12],h=[1,13],f=[1,16],m=[1,17],u={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,period_statement:18,event_statement:19,period:20,event:21,$accept:0,$end:1},terminals_:{2:"error",4:"timeline",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",20:"period",21:"event"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,1],[9,1],[18,1],[19,1]],performAction:s(function(i,a,c,p,y,o,w){var v=o.length-1;switch(y){case 1:return o[v-1];case 2:this.$=[];break;case 3:o[v-1].push(o[v]),this.$=o[v-1];break;case 4:case 5:this.$=o[v];break;case 6:case 7:this.$=[];break;case 8:p.getCommonDb().setDiagramTitle(o[v].substr(6)),this.$=o[v].substr(6);break;case 9:this.$=o[v].trim(),p.getCommonDb().setAccTitle(this.$);break;case 10:case 11:this.$=o[v].trim(),p.getCommonDb().setAccDescription(this.$);break;case 12:p.addSection(o[v].substr(8)),this.$=o[v].substr(8);break;case 15:p.addTask(o[v],0,""),this.$=o[v];break;case 16:p.addEvent(o[v].substr(2)),this.$=o[v];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},n(t,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:e,12:l,14:r,16:d,17:h,18:14,19:15,20:f,21:m},n(t,[2,7],{1:[2,1]}),n(t,[2,3]),{9:18,11:e,12:l,14:r,16:d,17:h,18:14,19:15,20:f,21:m},n(t,[2,5]),n(t,[2,6]),n(t,[2,8]),{13:[1,19]},{15:[1,20]},n(t,[2,11]),n(t,[2,12]),n(t,[2,13]),n(t,[2,14]),n(t,[2,15]),n(t,[2,16]),n(t,[2,4]),n(t,[2,9]),n(t,[2,10])],defaultActions:{},parseError:s(function(i,a){if(a.recoverable)this.trace(i);else{var c=new Error(i);throw c.hash=a,c}},"parseError"),parse:s(function(i){var a=this,c=[0],p=[],y=[null],o=[],w=this.table,v="",N=0,A=0,V=2,U=1,M=o.slice.call(arguments,1),g=Object.create(this.lexer),b={yy:{}};for(var L in this.yy)Object.prototype.hasOwnProperty.call(this.yy,L)&&(b.yy[L]=this.yy[L]);g.setInput(i,b.yy),b.yy.lexer=g,b.yy.parser=this,typeof g.yylloc>"u"&&(g.yylloc={});var P=g.yylloc;o.push(P);var W=g.options&&g.options.ranges;typeof b.yy.parseError=="function"?this.parseError=b.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Z(T){c.length=c.length-2*T,y.length=y.length-T,o.length=o.length-T}s(Z,"popStack");function tt(){var T;return T=p.pop()||g.lex()||U,typeof T!="number"&&(T instanceof Array&&(p=T,T=p.pop()),T=a.symbols_[T]||T),T}s(tt,"lex");for(var S,C,I,J,R={},B,$,et,O;;){if(C=c[c.length-1],this.defaultActions[C]?I=this.defaultActions[C]:((S===null||typeof S>"u")&&(S=tt()),I=w[C]&&w[C][S]),typeof I>"u"||!I.length||!I[0]){var K="";O=[];for(B in w[C])this.terminals_[B]&&B>V&&O.push("'"+this.terminals_[B]+"'");g.showPosition?K="Parse error on line "+(N+1)+`:
1
+ import{_ as s,c as xt,l as E,d as j,V as kt,W as vt,X as _t,Y as bt,D as wt,$ as St,z as Et}from"./mermaid.core-DQsftHid.js";import{d as nt}from"./arc-DSzdvb-p.js";import"./conversation-input-sync-CyctUEWr.js";import"./ui-preferences-store-BcI6fr9b.js";import"./index-DkZDDEqx.js";import"./error-boundary-Chq_L-1d.js";var Q=function(){var n=s(function(x,i,a,c){for(a=a||{},c=x.length;c--;a[x[c]]=i);return a},"o"),t=[6,8,10,11,12,14,16,17,20,21],e=[1,9],l=[1,10],r=[1,11],d=[1,12],h=[1,13],f=[1,16],m=[1,17],u={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,period_statement:18,event_statement:19,period:20,event:21,$accept:0,$end:1},terminals_:{2:"error",4:"timeline",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",20:"period",21:"event"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,1],[9,1],[18,1],[19,1]],performAction:s(function(i,a,c,p,y,o,w){var v=o.length-1;switch(y){case 1:return o[v-1];case 2:this.$=[];break;case 3:o[v-1].push(o[v]),this.$=o[v-1];break;case 4:case 5:this.$=o[v];break;case 6:case 7:this.$=[];break;case 8:p.getCommonDb().setDiagramTitle(o[v].substr(6)),this.$=o[v].substr(6);break;case 9:this.$=o[v].trim(),p.getCommonDb().setAccTitle(this.$);break;case 10:case 11:this.$=o[v].trim(),p.getCommonDb().setAccDescription(this.$);break;case 12:p.addSection(o[v].substr(8)),this.$=o[v].substr(8);break;case 15:p.addTask(o[v],0,""),this.$=o[v];break;case 16:p.addEvent(o[v].substr(2)),this.$=o[v];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},n(t,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:e,12:l,14:r,16:d,17:h,18:14,19:15,20:f,21:m},n(t,[2,7],{1:[2,1]}),n(t,[2,3]),{9:18,11:e,12:l,14:r,16:d,17:h,18:14,19:15,20:f,21:m},n(t,[2,5]),n(t,[2,6]),n(t,[2,8]),{13:[1,19]},{15:[1,20]},n(t,[2,11]),n(t,[2,12]),n(t,[2,13]),n(t,[2,14]),n(t,[2,15]),n(t,[2,16]),n(t,[2,4]),n(t,[2,9]),n(t,[2,10])],defaultActions:{},parseError:s(function(i,a){if(a.recoverable)this.trace(i);else{var c=new Error(i);throw c.hash=a,c}},"parseError"),parse:s(function(i){var a=this,c=[0],p=[],y=[null],o=[],w=this.table,v="",N=0,A=0,V=2,U=1,M=o.slice.call(arguments,1),g=Object.create(this.lexer),b={yy:{}};for(var L in this.yy)Object.prototype.hasOwnProperty.call(this.yy,L)&&(b.yy[L]=this.yy[L]);g.setInput(i,b.yy),b.yy.lexer=g,b.yy.parser=this,typeof g.yylloc>"u"&&(g.yylloc={});var P=g.yylloc;o.push(P);var W=g.options&&g.options.ranges;typeof b.yy.parseError=="function"?this.parseError=b.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Z(T){c.length=c.length-2*T,y.length=y.length-T,o.length=o.length-T}s(Z,"popStack");function tt(){var T;return T=p.pop()||g.lex()||U,typeof T!="number"&&(T instanceof Array&&(p=T,T=p.pop()),T=a.symbols_[T]||T),T}s(tt,"lex");for(var S,C,I,J,R={},B,$,et,O;;){if(C=c[c.length-1],this.defaultActions[C]?I=this.defaultActions[C]:((S===null||typeof S>"u")&&(S=tt()),I=w[C]&&w[C][S]),typeof I>"u"||!I.length||!I[0]){var K="";O=[];for(B in w[C])this.terminals_[B]&&B>V&&O.push("'"+this.terminals_[B]+"'");g.showPosition?K="Parse error on line "+(N+1)+`:
2
2
  `+g.showPosition()+`
3
3
  Expecting `+O.join(", ")+", got '"+(this.terminals_[S]||S)+"'":K="Parse error on line "+(N+1)+": Unexpected "+(S==U?"end of input":"'"+(this.terminals_[S]||S)+"'"),this.parseError(K,{text:g.match,token:this.terminals_[S]||S,line:g.yylineno,loc:P,expected:O})}if(I[0]instanceof Array&&I.length>1)throw new Error("Parse Error: multiple actions possible at state: "+C+", token: "+S);switch(I[0]){case 1:c.push(S),y.push(g.yytext),o.push(g.yylloc),c.push(I[1]),S=null,A=g.yyleng,v=g.yytext,N=g.yylineno,P=g.yylloc;break;case 2:if($=this.productions_[I[1]][1],R.$=y[y.length-$],R._$={first_line:o[o.length-($||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-($||1)].first_column,last_column:o[o.length-1].last_column},W&&(R._$.range=[o[o.length-($||1)].range[0],o[o.length-1].range[1]]),J=this.performAction.apply(R,[v,A,N,b.yy,I[1],y,o].concat(M)),typeof J<"u")return J;$&&(c=c.slice(0,-1*$*2),y=y.slice(0,-1*$),o=o.slice(0,-1*$)),c.push(this.productions_[I[1]][0]),y.push(R.$),o.push(R._$),et=w[c[c.length-2]][c[c.length-1]],c.push(et);break;case 3:return!0}}return!0},"parse")},k=function(){var x={EOF:1,parseError:s(function(a,c){if(this.yy.parser)this.yy.parser.parseError(a,c);else throw new Error(a)},"parseError"),setInput:s(function(i,a){return this.yy=a||this.yy||{},this._input=i,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:s(function(){var i=this._input[0];this.yytext+=i,this.yyleng++,this.offset++,this.match+=i,this.matched+=i;var a=i.match(/(?:\r\n?|\n).*/g);return a?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),i},"input"),unput:s(function(i){var a=i.length,c=i.split(/(?:\r\n?|\n)/g);this._input=i+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-a),this.offset-=a;var p=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),c.length-1&&(this.yylineno-=c.length-1);var y=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:c?(c.length===p.length?this.yylloc.first_column:0)+p[p.length-c.length].length-c[0].length:this.yylloc.first_column-a},this.options.ranges&&(this.yylloc.range=[y[0],y[0]+this.yyleng-a]),this.yyleng=this.yytext.length,this},"unput"),more:s(function(){return this._more=!0,this},"more"),reject:s(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:s(function(i){this.unput(this.match.slice(i))},"less"),pastInput:s(function(){var i=this.matched.substr(0,this.matched.length-this.match.length);return(i.length>20?"...":"")+i.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:s(function(){var i=this.match;return i.length<20&&(i+=this._input.substr(0,20-i.length)),(i.substr(0,20)+(i.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:s(function(){var i=this.pastInput(),a=new Array(i.length+1).join("-");return i+this.upcomingInput()+`
@@ -1,4 +1,4 @@
1
- import{c as l,j as F}from"./error-boundary-Chq_L-1d.js";import{t as j,c as R,n as K,b as _,g as Q,f as U,h as z,i as N,j as S,a as v}from"./en-US-BcB1DWxG.js";import{j as r,c as g,r as V}from"./index-DkZDDEqx.js";import{bH as q,bb as O,bI as B,aM as k,aG as P,u as w,aN as b,aQ as Y,aO as D,be as Z,a8 as C,bf as G}from"./conversation-input-sync-ztF2uENp.js";import{aw as W,ax as X,ay as I}from"./index-2LU4Cd3s.js";import{B as J}from"./book-open-Dm0X0_nl.js";import{j as ee,k as te,m as ae,n as ne,o as se,q as oe,r as ie}from"./use-memberships-query-CX0l7_F8.js";/**
1
+ import{c as l,j as F}from"./error-boundary-Chq_L-1d.js";import{t as j,c as R,n as K,b as _,g as Q,f as U,h as z,i as N,j as S,a as v}from"./en-US-BcB1DWxG.js";import{j as r,c as g,r as V}from"./index-DkZDDEqx.js";import{bH as q,bb as O,bI as B,aM as k,aG as P,u as w,aN as b,aQ as Y,aO as D,be as Z,a8 as C,bf as G}from"./conversation-input-sync-CyctUEWr.js";import{au as W,av as X,aw as I}from"./index-Bu7e3rSb.js";import{B as J}from"./book-open-Dm0X0_nl.js";import{j as ee,k as te,m as ae,n as ne,o as se,q as oe,r as ie}from"./use-memberships-query-DjBVKN3g.js";/**
2
2
  * @license lucide-react v0.507.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{ay as v,az as A,aA as $,aB as I,aC as h,aD as R,aE as L,aF as r,aG as _,aH as w,aI as q,aJ as N,aK as P,aL as S,aM as k}from"./conversation-input-sync-ztF2uENp.js";const f={malware_or_exploitation:"Instructions to build or spread malware, or to attack systems you do not own, cannot be published.",credential_theft:"Instructions to obtain someone else's credentials or tokens cannot be published.",fraud_or_deception:"Instructions to deceive or defraud people cannot be published.",harassment_or_hate:"Instructions to harass, threaten or target people cannot be published.",sexual_content_minors:"This agent cannot be published. If you believe this is a mistake, contact support.",sexual_content:"Explicit sexual content cannot be published.",violence_or_weapons:"Instructions to build weapons or to injure people cannot be published.",drugs_or_controlled_substances:"Instructions to make or traffic illegal drugs cannot be published.",self_harm:"This agent cannot be published. If you believe this is a mistake, contact support.",mass_surveillance_or_privacy_abuse:"Instructions to surveil or profile people without their consent cannot be published.",evasion_or_abuse_tooling:"Instructions to evade or defeat safety and anti-abuse systems cannot be published.",prompt_injection:"This instruction set tries to instruct the reviewer rather than describe an agent, so it cannot be published.",unclear_dual_use:"We could not tell whether this is aimed at your own systems or someone else's. Add a sentence stating the scope and target, then publish again.",other_harmful:"This agent was rejected because its instructions would cause harm."},E=e=>{const n=e.trim();return n.length>12&&/\s/.test(n)&&!/^(not found|bad request|unauthorized|error|internal server error)\.?$/i.test(n)};function O(e){const n=e?.categories?.[0];return n&&L(n)?f[n]:f.other_harmful}function C(e,n){const t=n?.rule?` ${n.rule}`:"";switch(n?.field){case"name":return{body:`Name${t||" is not acceptable"}.`,field:"name"};case"instructions":return{body:t?`The instruction body${t}.`:`The instruction body must be between 1 and ${R} characters.`,field:"instructions"};case"description":return{body:`Description${t}.`,field:"description"};case"tools":return{body:`Tools${t}.`,field:"tools"};case"when_to_use":return{body:`When to use${t}.`,field:"when_to_use"};case"categories":return{body:`Categories${t}.`,field:"categories"};case"tags":return{body:`Tags${t}.`,field:"tags"};default:return{body:e,field:null}}}function X(e,n){const t=n.surface==="pull",a=t?"Nothing was pulled.":"Nothing was published.",o=t?"pull again":"publish again",i=n.name.trim()||(t?"this team":"this agent");switch(e.code){case"name_taken":return e.details?.owned_by_caller===!0?{variant:"danger",headline:"You already published this agent",body:`You published "${i}" already. Update that listing instead of publishing a second one.`,note:null,actions:e.details?.existing_agent_id||n.hubAgentId?["update-listing","focus-name"]:["focus-name"]}:{variant:"danger",headline:"That name is taken",body:`"${i}" is already published on the hub by another account. Agent names are unique across the hub.`,note:null,actions:["focus-name"]};case"name_claim_in_flight":return{variant:"warning",headline:"That name is being published right now",body:`Someone is publishing an agent called "${i}" at this moment. It is not claimed — try again in a moment.`,note:null,actions:["retry"]};case"name_reserved_builtin":{const s=e.details?.builtin_name,d=s?h(s)===h(i):!1;return{variant:"danger",headline:"That name is reserved",body:s&&!d?`"${i}" is reserved by the built-in agent "${s}". Built-in names cannot be published to the hub.`:`"${s??i}" is the name of a built-in agent. Built-in names cannot be published to the hub.`,note:null,actions:["focus-name","install-builtin"]}}case"moderation_rejected":return{variant:"danger",headline:"This agent was not accepted",body:e.details?.reason?.trim()||e.message,note:O(e.details),actions:["edit-instructions"]};case"moderation_unavailable":return{variant:"warning",headline:"Review is temporarily unavailable",body:"We could not review this agent just now. Nothing was published. Try again in a minute.",note:null,actions:["retry"]};case"invalid_instruction_set":{const{body:s,field:d}=C(e.message,e.details);return{variant:"danger",headline:"The agent document is not valid",body:s,note:null,actions:d==="name"?["focus-name"]:d==="instructions"?["edit-instructions"]:["edit-agent"]}}case"payload_too_large":{const s=e.details?.limit_bytes;return{variant:"danger",headline:"This agent is too large to publish",body:s?`The instruction set is larger than ${Math.round(s/1024)} KiB. Shorten the instructions.`:"The instruction set is larger than the hub accepts. Shorten the instructions.",note:null,actions:["edit-instructions"]}}case"not_owner":return{variant:"danger",headline:"You cannot update this listing",body:"This listing belongs to another account.",note:null,actions:["publish-as-new"]};case"agent_not_found":return{variant:"danger",headline:"That listing no longer exists",body:"It may have been delisted.",note:null,actions:["publish-as-new","refresh-hub"]};case"hub_unauthorized":return{variant:"danger",headline:"The hub refused this machine's sign-in",body:`${a} Sign in to Radient again to replace the credential the hub refused, then ${o}.`,note:null,actions:["sign-in"]};case"hub_unavailable":return{variant:"warning",headline:t?"The pull did not go through":"The publication did not go through",body:E(e.message)?e.message:`${a} Try again in a moment, or update the backend if the hub has moved.`,note:null,actions:["retry"]};case"local_failure":return{variant:"warning",headline:t?"The team could not be pulled from this machine":"The agent could not be published from this machine",body:e.message,note:null,actions:["retry"]};case"team_plan_required":return{variant:"warning",headline:"That organization needs an active Team plan",body:t?"Reading an organization's teams is part of the Team plan. Ask an owner of the organization to activate it in the Radient console, then pull again.":"Sharing agents inside an organization is part of the Team plan. Ask an owner of the organization to activate it in the Radient console, then publish again.",note:null,actions:["retry"]};case"not_a_member":return{variant:"danger",headline:"You are not a member of that organization",body:`${a} Ask an owner of the organization to invite you, then ${o}.`,note:null,actions:[]};case"insufficient_role":{const s=e.details?.required;return{variant:"danger",headline:"Your organization role does not allow this",body:s?`${t?"Reading an organization's teams needs":"Publishing into an organization needs"} the ${s} role. Ask an owner of the organization to change your role, then ${o}.`:`${t?"Reading an organization's teams needs":"Publishing into an organization needs"} a higher role than yours. Ask an owner of the organization to change your role, then ${o}.`,note:null,actions:[]}}case"team_not_found":return{variant:"danger",headline:"That team is no longer published",body:"It may have been delisted since this page was loaded.",note:null,actions:["refresh-hub"]};default:return{variant:"danger",headline:"The agent could not be published",body:e.message,note:null,actions:["retry"]}}}const z=[/^(?:Download agent from Radient failed: )?(?:Error downloading agent from Radient: )?\s*/,/^Failed to download agent(?: [^\s]+)? from Radient Agent Hub(?: due to a requests error)?:\s*/,/^[A-Za-z_][\w.]*\([^)]*\):\s*/],U=/^(\d{3})\b/,F=new Set([404,410]),j=["read timed out","connection timed out","connection refused","connection aborted","connection reset","connectionerror","connecttimeout","remote end closed connection","max retries exceeded","temporary failure in name resolution","name or service not known","no route to host"],B=e=>{const n=e.toLowerCase();return j.some(t=>n.includes(t))||I(e)},D=(e,n)=>{const t=n.trim()?`"${n.trim()}"`:"That agent";if(A(e))switch(e.code){case"agent_not_found":return`${t} is no longer on the hub, so nothing was downloaded.`;case"hub_unavailable":return`The hub did not complete the download, so ${t} was not downloaded.`;default:return`${t} was not downloaded: ${e.message}`}const a=z.reduce((i,s)=>i.replace(s,""),$(e,"").trim()).trim();if(!a)return`${t} could not be downloaded.`;const o=Number(U.exec(a)?.[1]??Number.NaN);return F.has(o)?`${t} is no longer on the hub, so nothing was downloaded.`:B(a)||o===408?`The hub could not be reached, so ${t} was not downloaded.`:o===429?`The hub is busy, so ${t} was not downloaded. Try again in a moment.`:o===401||o===403?`The hub refused this machine's sign-in, so ${t} was not downloaded.`:o>=500?`The hub could not complete the download, so ${t} was not downloaded. Try again in a moment.`:o>=400?`The hub refused the download, so ${t} is not here.`:`${t} was not downloaded: ${a}`},x="The action did not complete.",Z=(e,n,t)=>e==="download"?D(n,t):v(x,n),V={"focus-name":"Choose another name","update-listing":"Update the existing listing","install-builtin":"Install the built-in instead",retry:"Try again","edit-instructions":"Edit the instructions","edit-agent":"Edit the agent","publish-as-new":"Publish as a new listing","sign-in":"Sign in again","refresh-hub":"Refresh the hub"};function c(){return crypto.randomUUID()}async function K(e=1,n=20,t){const a={page:e,per_page:n};if(t)for(const[o,i]of Object.entries(t))i&&(a[o]=i);return r({operation:"agents.list",query:a})}async function ee(e){return r({operation:"agents.get",agentId:e})}async function ne(e){return r({operation:"agents.delete",agentId:e,requestId:c(),confirmed:!0})}async function te(e){return r({operation:"agents.like",agentId:e,requestId:c()})}async function ae(e){return r({operation:"agents.unlike",agentId:e,requestId:c(),confirmed:!0})}async function oe(e){return r({operation:"agents.favourite",agentId:e,requestId:c()})}async function se(e){return r({operation:"agents.unfavourite",agentId:e,requestId:c(),confirmed:!0})}async function ie(e,n){return r({operation:"comments.create",agentId:e,payload:n,requestId:c()})}async function re(e,n=1,t=20){return r({operation:"comments.list",agentId:e,query:{page:n,per_page:t}})}async function ue(e,n,t){return r({operation:"comments.update",agentId:e,commentId:n,payload:t,requestId:c()})}async function le(e,n){return r({operation:"comments.delete",agentId:e,commentId:n,requestId:c(),confirmed:!0})}async function ce(e){return r({operation:"agents.statuses",query:{agent_ids:e.join(",")}})}async function M(){return r({operation:"memberships.list"})}async function Q(e,n=1,t=20,a){const o={page:n,per_page:t};if(a)for(const[i,s]of Object.entries(a))s&&(o[i]=s);return r({operation:"org_agents.list",tenantId:e,query:o})}async function de(e){return r({operation:"org_teams.list",tenantId:e})}const W="download_count",b={all:["public-agents"],list:e=>[...b.all,"list",{page:e.page,perPage:e.perPage,categories:e.categories?.join(",")??void 0,name:e.name??void 0,description:e.description??void 0,sort:e.sort,order:e.order}]},m={all:["org-agents"],list:(e,n)=>[...m.all,"list",e,{page:n.page,perPage:n.perPage,categories:n.categories?.join(",")??void 0,name:n.name??void 0,description:n.description??void 0,sort:n.sort,order:n.order}]},Y=e=>e&&e[0]===m.all[0]?String(e[2]??""):null,he=e=>e.invalidateQueries({queryKey:b.all}),ge=(e,n)=>e.invalidateQueries({queryKey:n?[...m.all,"list",n]:m.all}),me=({page:e=1,perPage:n=20,enabled:t=!0,categories:a,name:o,description:i,sort:s=W,order:d="desc",tenantId:g}={})=>{const p={page:e,perPage:n,categories:a,name:o,description:i,sort:s,order:d},T=g?m.list(g,p):b.list(p),l=_({queryKey:T,queryFn:async()=>{const u={};return a&&a.length>0&&(u.categories=a.join(",")),o&&(u.name=o),i&&(u.description=i),u.sort=s,u.order=d,g?await Q(g,e,n,u):await K(e,n,u)},select:u=>u.result,enabled:t,retry:w,staleTime:5*60*1e3,gcTime:10*60*1e3,refetchOnWindowFocus:!1,placeholderData:(u,y)=>Y(y?.queryKey)===(g??null)?u:void 0});return{...l,agents:l.data?.records,isRefreshing:l.isFetching&&l.data!==void 0,pagination:l.data?{page:l.data.page,perPage:l.data.per_page,totalPages:l.data.total_pages,totalRecords:l.data.total_records}:void 0}},H={name:"Name",description:"Description",instructions:"The instruction body",tools:"Tools"};function be(e){const n=[],t=(a,o)=>{o&&n.push({field:a,message:`${H[a]} ${o}.`})};return t("name",q(e.name)),t("description",N(e.description)),e.instructions!==null&&t("instructions",P(e.instructions)),t("tools",S(e.tools??[])),n}function pe(e,n){const t=h(e);return n.some(a=>h(a)===t)}function ye(e){for(const n of e??[]){const t=n.indexOf(":");if(t<0||n.slice(0,t).trim().toLowerCase()!=="tools")continue;const a=n.slice(t+1).split(",").map(o=>o.trim()).filter(Boolean);return a.length>0?a:null}return null}function fe(e,n){const t=h(e);return n.find(a=>h(a)===t)??null}const G={all:["memberships"]},_e=({enabled:e=!0}={})=>{const{isAuthenticated:n}=k(),t=_({queryKey:G.all,queryFn:async()=>(await M()).result??{memberships:[]},enabled:e&&n,staleTime:5*60*1e3,gcTime:10*60*1e3,refetchOnWindowFocus:!1,retry:w});return{...t,memberships:t.data?.memberships??[]}};export{V as P,ne as a,_e as b,ie as c,le as d,Z as e,de as f,ee as g,me as h,he as i,ce as j,b as k,re as l,se as m,oe as n,ae as o,X as p,te as q,fe as r,ge as s,pe as t,ue as u,be as v,ye as w};
1
+ import{ay as v,az as A,aA as $,aB as I,aC as h,aD as R,aE as L,aF as r,aG as _,aH as w,aI as q,aJ as N,aK as P,aL as S,aM as k}from"./conversation-input-sync-CyctUEWr.js";const f={malware_or_exploitation:"Instructions to build or spread malware, or to attack systems you do not own, cannot be published.",credential_theft:"Instructions to obtain someone else's credentials or tokens cannot be published.",fraud_or_deception:"Instructions to deceive or defraud people cannot be published.",harassment_or_hate:"Instructions to harass, threaten or target people cannot be published.",sexual_content_minors:"This agent cannot be published. If you believe this is a mistake, contact support.",sexual_content:"Explicit sexual content cannot be published.",violence_or_weapons:"Instructions to build weapons or to injure people cannot be published.",drugs_or_controlled_substances:"Instructions to make or traffic illegal drugs cannot be published.",self_harm:"This agent cannot be published. If you believe this is a mistake, contact support.",mass_surveillance_or_privacy_abuse:"Instructions to surveil or profile people without their consent cannot be published.",evasion_or_abuse_tooling:"Instructions to evade or defeat safety and anti-abuse systems cannot be published.",prompt_injection:"This instruction set tries to instruct the reviewer rather than describe an agent, so it cannot be published.",unclear_dual_use:"We could not tell whether this is aimed at your own systems or someone else's. Add a sentence stating the scope and target, then publish again.",other_harmful:"This agent was rejected because its instructions would cause harm."},E=e=>{const n=e.trim();return n.length>12&&/\s/.test(n)&&!/^(not found|bad request|unauthorized|error|internal server error)\.?$/i.test(n)};function O(e){const n=e?.categories?.[0];return n&&L(n)?f[n]:f.other_harmful}function C(e,n){const t=n?.rule?` ${n.rule}`:"";switch(n?.field){case"name":return{body:`Name${t||" is not acceptable"}.`,field:"name"};case"instructions":return{body:t?`The instruction body${t}.`:`The instruction body must be between 1 and ${R} characters.`,field:"instructions"};case"description":return{body:`Description${t}.`,field:"description"};case"tools":return{body:`Tools${t}.`,field:"tools"};case"when_to_use":return{body:`When to use${t}.`,field:"when_to_use"};case"categories":return{body:`Categories${t}.`,field:"categories"};case"tags":return{body:`Tags${t}.`,field:"tags"};default:return{body:e,field:null}}}function X(e,n){const t=n.surface==="pull",a=t?"Nothing was pulled.":"Nothing was published.",o=t?"pull again":"publish again",i=n.name.trim()||(t?"this team":"this agent");switch(e.code){case"name_taken":return e.details?.owned_by_caller===!0?{variant:"danger",headline:"You already published this agent",body:`You published "${i}" already. Update that listing instead of publishing a second one.`,note:null,actions:e.details?.existing_agent_id||n.hubAgentId?["update-listing","focus-name"]:["focus-name"]}:{variant:"danger",headline:"That name is taken",body:`"${i}" is already published on the hub by another account. Agent names are unique across the hub.`,note:null,actions:["focus-name"]};case"name_claim_in_flight":return{variant:"warning",headline:"That name is being published right now",body:`Someone is publishing an agent called "${i}" at this moment. It is not claimed — try again in a moment.`,note:null,actions:["retry"]};case"name_reserved_builtin":{const s=e.details?.builtin_name,d=s?h(s)===h(i):!1;return{variant:"danger",headline:"That name is reserved",body:s&&!d?`"${i}" is reserved by the built-in agent "${s}". Built-in names cannot be published to the hub.`:`"${s??i}" is the name of a built-in agent. Built-in names cannot be published to the hub.`,note:null,actions:["focus-name","install-builtin"]}}case"moderation_rejected":return{variant:"danger",headline:"This agent was not accepted",body:e.details?.reason?.trim()||e.message,note:O(e.details),actions:["edit-instructions"]};case"moderation_unavailable":return{variant:"warning",headline:"Review is temporarily unavailable",body:"We could not review this agent just now. Nothing was published. Try again in a minute.",note:null,actions:["retry"]};case"invalid_instruction_set":{const{body:s,field:d}=C(e.message,e.details);return{variant:"danger",headline:"The agent document is not valid",body:s,note:null,actions:d==="name"?["focus-name"]:d==="instructions"?["edit-instructions"]:["edit-agent"]}}case"payload_too_large":{const s=e.details?.limit_bytes;return{variant:"danger",headline:"This agent is too large to publish",body:s?`The instruction set is larger than ${Math.round(s/1024)} KiB. Shorten the instructions.`:"The instruction set is larger than the hub accepts. Shorten the instructions.",note:null,actions:["edit-instructions"]}}case"not_owner":return{variant:"danger",headline:"You cannot update this listing",body:"This listing belongs to another account.",note:null,actions:["publish-as-new"]};case"agent_not_found":return{variant:"danger",headline:"That listing no longer exists",body:"It may have been delisted.",note:null,actions:["publish-as-new","refresh-hub"]};case"hub_unauthorized":return{variant:"danger",headline:"The hub refused this machine's sign-in",body:`${a} Sign in to Radient again to replace the credential the hub refused, then ${o}.`,note:null,actions:["sign-in"]};case"hub_unavailable":return{variant:"warning",headline:t?"The pull did not go through":"The publication did not go through",body:E(e.message)?e.message:`${a} Try again in a moment, or update the backend if the hub has moved.`,note:null,actions:["retry"]};case"local_failure":return{variant:"warning",headline:t?"The team could not be pulled from this machine":"The agent could not be published from this machine",body:e.message,note:null,actions:["retry"]};case"team_plan_required":return{variant:"warning",headline:"That organization needs an active Team plan",body:t?"Reading an organization's teams is part of the Team plan. Ask an owner of the organization to activate it in the Radient console, then pull again.":"Sharing agents inside an organization is part of the Team plan. Ask an owner of the organization to activate it in the Radient console, then publish again.",note:null,actions:["retry"]};case"not_a_member":return{variant:"danger",headline:"You are not a member of that organization",body:`${a} Ask an owner of the organization to invite you, then ${o}.`,note:null,actions:[]};case"insufficient_role":{const s=e.details?.required;return{variant:"danger",headline:"Your organization role does not allow this",body:s?`${t?"Reading an organization's teams needs":"Publishing into an organization needs"} the ${s} role. Ask an owner of the organization to change your role, then ${o}.`:`${t?"Reading an organization's teams needs":"Publishing into an organization needs"} a higher role than yours. Ask an owner of the organization to change your role, then ${o}.`,note:null,actions:[]}}case"team_not_found":return{variant:"danger",headline:"That team is no longer published",body:"It may have been delisted since this page was loaded.",note:null,actions:["refresh-hub"]};default:return{variant:"danger",headline:"The agent could not be published",body:e.message,note:null,actions:["retry"]}}}const z=[/^(?:Download agent from Radient failed: )?(?:Error downloading agent from Radient: )?\s*/,/^Failed to download agent(?: [^\s]+)? from Radient Agent Hub(?: due to a requests error)?:\s*/,/^[A-Za-z_][\w.]*\([^)]*\):\s*/],U=/^(\d{3})\b/,F=new Set([404,410]),j=["read timed out","connection timed out","connection refused","connection aborted","connection reset","connectionerror","connecttimeout","remote end closed connection","max retries exceeded","temporary failure in name resolution","name or service not known","no route to host"],B=e=>{const n=e.toLowerCase();return j.some(t=>n.includes(t))||I(e)},D=(e,n)=>{const t=n.trim()?`"${n.trim()}"`:"That agent";if(A(e))switch(e.code){case"agent_not_found":return`${t} is no longer on the hub, so nothing was downloaded.`;case"hub_unavailable":return`The hub did not complete the download, so ${t} was not downloaded.`;default:return`${t} was not downloaded: ${e.message}`}const a=z.reduce((i,s)=>i.replace(s,""),$(e,"").trim()).trim();if(!a)return`${t} could not be downloaded.`;const o=Number(U.exec(a)?.[1]??Number.NaN);return F.has(o)?`${t} is no longer on the hub, so nothing was downloaded.`:B(a)||o===408?`The hub could not be reached, so ${t} was not downloaded.`:o===429?`The hub is busy, so ${t} was not downloaded. Try again in a moment.`:o===401||o===403?`The hub refused this machine's sign-in, so ${t} was not downloaded.`:o>=500?`The hub could not complete the download, so ${t} was not downloaded. Try again in a moment.`:o>=400?`The hub refused the download, so ${t} is not here.`:`${t} was not downloaded: ${a}`},x="The action did not complete.",Z=(e,n,t)=>e==="download"?D(n,t):v(x,n),V={"focus-name":"Choose another name","update-listing":"Update the existing listing","install-builtin":"Install the built-in instead",retry:"Try again","edit-instructions":"Edit the instructions","edit-agent":"Edit the agent","publish-as-new":"Publish as a new listing","sign-in":"Sign in again","refresh-hub":"Refresh the hub"};function c(){return crypto.randomUUID()}async function K(e=1,n=20,t){const a={page:e,per_page:n};if(t)for(const[o,i]of Object.entries(t))i&&(a[o]=i);return r({operation:"agents.list",query:a})}async function ee(e){return r({operation:"agents.get",agentId:e})}async function ne(e){return r({operation:"agents.delete",agentId:e,requestId:c(),confirmed:!0})}async function te(e){return r({operation:"agents.like",agentId:e,requestId:c()})}async function ae(e){return r({operation:"agents.unlike",agentId:e,requestId:c(),confirmed:!0})}async function oe(e){return r({operation:"agents.favourite",agentId:e,requestId:c()})}async function se(e){return r({operation:"agents.unfavourite",agentId:e,requestId:c(),confirmed:!0})}async function ie(e,n){return r({operation:"comments.create",agentId:e,payload:n,requestId:c()})}async function re(e,n=1,t=20){return r({operation:"comments.list",agentId:e,query:{page:n,per_page:t}})}async function ue(e,n,t){return r({operation:"comments.update",agentId:e,commentId:n,payload:t,requestId:c()})}async function le(e,n){return r({operation:"comments.delete",agentId:e,commentId:n,requestId:c(),confirmed:!0})}async function ce(e){return r({operation:"agents.statuses",query:{agent_ids:e.join(",")}})}async function M(){return r({operation:"memberships.list"})}async function Q(e,n=1,t=20,a){const o={page:n,per_page:t};if(a)for(const[i,s]of Object.entries(a))s&&(o[i]=s);return r({operation:"org_agents.list",tenantId:e,query:o})}async function de(e){return r({operation:"org_teams.list",tenantId:e})}const W="download_count",b={all:["public-agents"],list:e=>[...b.all,"list",{page:e.page,perPage:e.perPage,categories:e.categories?.join(",")??void 0,name:e.name??void 0,description:e.description??void 0,sort:e.sort,order:e.order}]},m={all:["org-agents"],list:(e,n)=>[...m.all,"list",e,{page:n.page,perPage:n.perPage,categories:n.categories?.join(",")??void 0,name:n.name??void 0,description:n.description??void 0,sort:n.sort,order:n.order}]},Y=e=>e&&e[0]===m.all[0]?String(e[2]??""):null,he=e=>e.invalidateQueries({queryKey:b.all}),ge=(e,n)=>e.invalidateQueries({queryKey:n?[...m.all,"list",n]:m.all}),me=({page:e=1,perPage:n=20,enabled:t=!0,categories:a,name:o,description:i,sort:s=W,order:d="desc",tenantId:g}={})=>{const p={page:e,perPage:n,categories:a,name:o,description:i,sort:s,order:d},T=g?m.list(g,p):b.list(p),l=_({queryKey:T,queryFn:async()=>{const u={};return a&&a.length>0&&(u.categories=a.join(",")),o&&(u.name=o),i&&(u.description=i),u.sort=s,u.order=d,g?await Q(g,e,n,u):await K(e,n,u)},select:u=>u.result,enabled:t,retry:w,staleTime:5*60*1e3,gcTime:10*60*1e3,refetchOnWindowFocus:!1,placeholderData:(u,y)=>Y(y?.queryKey)===(g??null)?u:void 0});return{...l,agents:l.data?.records,isRefreshing:l.isFetching&&l.data!==void 0,pagination:l.data?{page:l.data.page,perPage:l.data.per_page,totalPages:l.data.total_pages,totalRecords:l.data.total_records}:void 0}},H={name:"Name",description:"Description",instructions:"The instruction body",tools:"Tools"};function be(e){const n=[],t=(a,o)=>{o&&n.push({field:a,message:`${H[a]} ${o}.`})};return t("name",q(e.name)),t("description",N(e.description)),e.instructions!==null&&t("instructions",P(e.instructions)),t("tools",S(e.tools??[])),n}function pe(e,n){const t=h(e);return n.some(a=>h(a)===t)}function ye(e){for(const n of e??[]){const t=n.indexOf(":");if(t<0||n.slice(0,t).trim().toLowerCase()!=="tools")continue;const a=n.slice(t+1).split(",").map(o=>o.trim()).filter(Boolean);return a.length>0?a:null}return null}function fe(e,n){const t=h(e);return n.find(a=>h(a)===t)??null}const G={all:["memberships"]},_e=({enabled:e=!0}={})=>{const{isAuthenticated:n}=k(),t=_({queryKey:G.all,queryFn:async()=>(await M()).result??{memberships:[]},enabled:e&&n,staleTime:5*60*1e3,gcTime:10*60*1e3,refetchOnWindowFocus:!1,retry:w});return{...t,memberships:t.data?.memberships??[]}};export{V as P,ne as a,_e as b,ie as c,le as d,Z as e,de as f,ee as g,me as h,he as i,ce as j,b as k,re as l,se as m,oe as n,ae as o,X as p,te as q,fe as r,ge as s,pe as t,ue as u,be as v,ye as w};
@@ -1,4 +1,4 @@
1
- import{_ as n,s as ii,g as ei,t as vt,q as si,a as ni,b as ai,l as Lt,K as oi,e as hi,z as ri,G as lt,F as Et,H as li,M as ci,i as ui,N as gi}from"./mermaid.core-DmRnOx5f.js";import{q as kt,o as Tt,v as Rt}from"./conversation-input-sync-ztF2uENp.js";import"./index-DkZDDEqx.js";import"./ui-preferences-store-BcI6fr9b.js";import"./error-boundary-Chq_L-1d.js";var at=function(){var t=n(function(B,h,l,c){for(l=l||{},c=B.length;c--;l[B[c]]=h);return l},"o"),i=[1,10,12,14,16,18,19,21,23],e=[2,6],s=[1,3],o=[1,5],p=[1,6],g=[1,7],y=[1,5,10,12,14,16,18,19,21,23,34,35,36],T=[1,25],E=[1,26],S=[1,28],R=[1,29],I=[1,30],V=[1,31],_=[1,32],L=[1,33],f=[1,34],C=[1,35],r=[1,36],D=[1,37],N=[1,43],mt=[1,42],bt=[1,47],$=[1,50],b=[1,10,12,14,16,18,19,21,23,34,35,36],J=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],P=[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],At=[1,64],tt={trace:n(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:n(function(h,l,c,u,m,a,X){var x=a.length-1;switch(m){case 5:u.setOrientation(a[x]);break;case 9:u.setDiagramTitle(a[x].text.trim());break;case 12:u.setLineData({text:"",type:"text"},a[x]);break;case 13:u.setLineData(a[x-1],a[x]);break;case 14:u.setBarData({text:"",type:"text"},a[x]);break;case 15:u.setBarData(a[x-1],a[x]);break;case 16:this.$=a[x].trim(),u.setAccTitle(this.$);break;case 17:case 18:this.$=a[x].trim(),u.setAccDescription(this.$);break;case 19:this.$=a[x-1];break;case 20:this.$=[Number(a[x-2]),...a[x]];break;case 21:this.$=[Number(a[x])];break;case 22:u.setXAxisTitle(a[x]);break;case 23:u.setXAxisTitle(a[x-1]);break;case 24:u.setXAxisTitle({type:"text",text:""});break;case 25:u.setXAxisBand(a[x]);break;case 26:u.setXAxisRangeData(Number(a[x-2]),Number(a[x]));break;case 27:this.$=a[x-1];break;case 28:this.$=[a[x-2],...a[x]];break;case 29:this.$=[a[x]];break;case 30:u.setYAxisTitle(a[x]);break;case 31:u.setYAxisTitle(a[x-1]);break;case 32:u.setYAxisTitle({type:"text",text:""});break;case 33:u.setYAxisRangeData(Number(a[x-2]),Number(a[x]));break;case 37:this.$={text:a[x],type:"text"};break;case 38:this.$={text:a[x],type:"text"};break;case 39:this.$={text:a[x],type:"markdown"};break;case 40:this.$=a[x];break;case 41:this.$=a[x-1]+""+a[x];break}},"anonymous"),table:[t(i,e,{3:1,4:2,7:4,5:s,34:o,35:p,36:g}),{1:[3]},t(i,e,{4:2,7:4,3:8,5:s,34:o,35:p,36:g}),t(i,e,{4:2,7:4,6:9,3:10,5:s,8:[1,11],34:o,35:p,36:g}),{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]},t(y,[2,34]),t(y,[2,35]),t(y,[2,36]),{1:[2,1]},t(i,e,{4:2,7:4,3:21,5:s,34:o,35:p,36:g}),{1:[2,3]},t(y,[2,5]),t(i,[2,7],{4:22,34:o,35:p,36:g}),{11:23,37:24,38:T,39:E,40:27,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:r,50:D},{11:39,13:38,24:N,27:mt,29:40,30:41,37:24,38:T,39:E,40:27,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:r,50:D},{11:45,15:44,27:bt,33:46,37:24,38:T,39:E,40:27,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:r,50:D},{11:49,17:48,24:$,37:24,38:T,39:E,40:27,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:r,50:D},{11:52,17:51,24:$,37:24,38:T,39:E,40:27,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:r,50:D},{20:[1,53]},{22:[1,54]},t(b,[2,18]),{1:[2,2]},t(b,[2,8]),t(b,[2,9]),t(J,[2,37],{40:55,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:r,50:D}),t(J,[2,38]),t(J,[2,39]),t(P,[2,40]),t(P,[2,42]),t(P,[2,43]),t(P,[2,44]),t(P,[2,45]),t(P,[2,46]),t(P,[2,47]),t(P,[2,48]),t(P,[2,49]),t(P,[2,50]),t(P,[2,51]),t(b,[2,10]),t(b,[2,22],{30:41,29:56,24:N,27:mt}),t(b,[2,24]),t(b,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:T,39:E,40:27,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:r,50:D},t(b,[2,11]),t(b,[2,30],{33:60,27:bt}),t(b,[2,32]),{31:[1,61]},t(b,[2,12]),{17:62,24:$},{25:63,27:At},t(b,[2,14]),{17:65,24:$},t(b,[2,16]),t(b,[2,17]),t(P,[2,41]),t(b,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},t(b,[2,31]),{27:[1,69]},t(b,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},t(b,[2,15]),t(b,[2,26]),t(b,[2,27]),{11:59,32:72,37:24,38:T,39:E,40:27,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:r,50:D},t(b,[2,33]),t(b,[2,19]),{25:73,27:At},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:n(function(h,l){if(l.recoverable)this.trace(h);else{var c=new Error(h);throw c.hash=l,c}},"parseError"),parse:n(function(h){var l=this,c=[0],u=[],m=[null],a=[],X=this.table,x="",G=0,Ct=0,Kt=2,wt=1,Zt=a.slice.call(arguments,1),A=Object.create(this.lexer),W={yy:{}};for(var it in this.yy)Object.prototype.hasOwnProperty.call(this.yy,it)&&(W.yy[it]=this.yy[it]);A.setInput(h,W.yy),W.yy.lexer=A,W.yy.parser=this,typeof A.yylloc>"u"&&(A.yylloc={});var et=A.yylloc;a.push(et);var Jt=A.options&&A.options.ranges;typeof W.yy.parseError=="function"?this.parseError=W.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ti(k){c.length=c.length-2*k,m.length=m.length-k,a.length=a.length-k}n(ti,"popStack");function St(){var k;return k=u.pop()||A.lex()||wt,typeof k!="number"&&(k instanceof Array&&(u=k,k=u.pop()),k=l.symbols_[k]||k),k}n(St,"lex");for(var w,O,v,st,z={},j,M,_t,Q;;){if(O=c[c.length-1],this.defaultActions[O]?v=this.defaultActions[O]:((w===null||typeof w>"u")&&(w=St()),v=X[O]&&X[O][w]),typeof v>"u"||!v.length||!v[0]){var nt="";Q=[];for(j in X[O])this.terminals_[j]&&j>Kt&&Q.push("'"+this.terminals_[j]+"'");A.showPosition?nt="Parse error on line "+(G+1)+`:
1
+ import{_ as n,s as ii,g as ei,t as vt,q as si,a as ni,b as ai,l as Lt,K as oi,e as hi,z as ri,G as lt,F as Et,H as li,M as ci,i as ui,N as gi}from"./mermaid.core-DQsftHid.js";import{q as kt,o as Tt,v as Rt}from"./conversation-input-sync-CyctUEWr.js";import"./index-DkZDDEqx.js";import"./ui-preferences-store-BcI6fr9b.js";import"./error-boundary-Chq_L-1d.js";var at=function(){var t=n(function(B,h,l,c){for(l=l||{},c=B.length;c--;l[B[c]]=h);return l},"o"),i=[1,10,12,14,16,18,19,21,23],e=[2,6],s=[1,3],o=[1,5],p=[1,6],g=[1,7],y=[1,5,10,12,14,16,18,19,21,23,34,35,36],T=[1,25],E=[1,26],S=[1,28],R=[1,29],I=[1,30],V=[1,31],_=[1,32],L=[1,33],f=[1,34],C=[1,35],r=[1,36],D=[1,37],N=[1,43],mt=[1,42],bt=[1,47],$=[1,50],b=[1,10,12,14,16,18,19,21,23,34,35,36],J=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],P=[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],At=[1,64],tt={trace:n(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:n(function(h,l,c,u,m,a,X){var x=a.length-1;switch(m){case 5:u.setOrientation(a[x]);break;case 9:u.setDiagramTitle(a[x].text.trim());break;case 12:u.setLineData({text:"",type:"text"},a[x]);break;case 13:u.setLineData(a[x-1],a[x]);break;case 14:u.setBarData({text:"",type:"text"},a[x]);break;case 15:u.setBarData(a[x-1],a[x]);break;case 16:this.$=a[x].trim(),u.setAccTitle(this.$);break;case 17:case 18:this.$=a[x].trim(),u.setAccDescription(this.$);break;case 19:this.$=a[x-1];break;case 20:this.$=[Number(a[x-2]),...a[x]];break;case 21:this.$=[Number(a[x])];break;case 22:u.setXAxisTitle(a[x]);break;case 23:u.setXAxisTitle(a[x-1]);break;case 24:u.setXAxisTitle({type:"text",text:""});break;case 25:u.setXAxisBand(a[x]);break;case 26:u.setXAxisRangeData(Number(a[x-2]),Number(a[x]));break;case 27:this.$=a[x-1];break;case 28:this.$=[a[x-2],...a[x]];break;case 29:this.$=[a[x]];break;case 30:u.setYAxisTitle(a[x]);break;case 31:u.setYAxisTitle(a[x-1]);break;case 32:u.setYAxisTitle({type:"text",text:""});break;case 33:u.setYAxisRangeData(Number(a[x-2]),Number(a[x]));break;case 37:this.$={text:a[x],type:"text"};break;case 38:this.$={text:a[x],type:"text"};break;case 39:this.$={text:a[x],type:"markdown"};break;case 40:this.$=a[x];break;case 41:this.$=a[x-1]+""+a[x];break}},"anonymous"),table:[t(i,e,{3:1,4:2,7:4,5:s,34:o,35:p,36:g}),{1:[3]},t(i,e,{4:2,7:4,3:8,5:s,34:o,35:p,36:g}),t(i,e,{4:2,7:4,6:9,3:10,5:s,8:[1,11],34:o,35:p,36:g}),{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]},t(y,[2,34]),t(y,[2,35]),t(y,[2,36]),{1:[2,1]},t(i,e,{4:2,7:4,3:21,5:s,34:o,35:p,36:g}),{1:[2,3]},t(y,[2,5]),t(i,[2,7],{4:22,34:o,35:p,36:g}),{11:23,37:24,38:T,39:E,40:27,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:r,50:D},{11:39,13:38,24:N,27:mt,29:40,30:41,37:24,38:T,39:E,40:27,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:r,50:D},{11:45,15:44,27:bt,33:46,37:24,38:T,39:E,40:27,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:r,50:D},{11:49,17:48,24:$,37:24,38:T,39:E,40:27,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:r,50:D},{11:52,17:51,24:$,37:24,38:T,39:E,40:27,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:r,50:D},{20:[1,53]},{22:[1,54]},t(b,[2,18]),{1:[2,2]},t(b,[2,8]),t(b,[2,9]),t(J,[2,37],{40:55,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:r,50:D}),t(J,[2,38]),t(J,[2,39]),t(P,[2,40]),t(P,[2,42]),t(P,[2,43]),t(P,[2,44]),t(P,[2,45]),t(P,[2,46]),t(P,[2,47]),t(P,[2,48]),t(P,[2,49]),t(P,[2,50]),t(P,[2,51]),t(b,[2,10]),t(b,[2,22],{30:41,29:56,24:N,27:mt}),t(b,[2,24]),t(b,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:T,39:E,40:27,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:r,50:D},t(b,[2,11]),t(b,[2,30],{33:60,27:bt}),t(b,[2,32]),{31:[1,61]},t(b,[2,12]),{17:62,24:$},{25:63,27:At},t(b,[2,14]),{17:65,24:$},t(b,[2,16]),t(b,[2,17]),t(P,[2,41]),t(b,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},t(b,[2,31]),{27:[1,69]},t(b,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},t(b,[2,15]),t(b,[2,26]),t(b,[2,27]),{11:59,32:72,37:24,38:T,39:E,40:27,41:S,42:R,43:I,44:V,45:_,46:L,47:f,48:C,49:r,50:D},t(b,[2,33]),t(b,[2,19]),{25:73,27:At},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:n(function(h,l){if(l.recoverable)this.trace(h);else{var c=new Error(h);throw c.hash=l,c}},"parseError"),parse:n(function(h){var l=this,c=[0],u=[],m=[null],a=[],X=this.table,x="",G=0,Ct=0,Kt=2,wt=1,Zt=a.slice.call(arguments,1),A=Object.create(this.lexer),W={yy:{}};for(var it in this.yy)Object.prototype.hasOwnProperty.call(this.yy,it)&&(W.yy[it]=this.yy[it]);A.setInput(h,W.yy),W.yy.lexer=A,W.yy.parser=this,typeof A.yylloc>"u"&&(A.yylloc={});var et=A.yylloc;a.push(et);var Jt=A.options&&A.options.ranges;typeof W.yy.parseError=="function"?this.parseError=W.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ti(k){c.length=c.length-2*k,m.length=m.length-k,a.length=a.length-k}n(ti,"popStack");function St(){var k;return k=u.pop()||A.lex()||wt,typeof k!="number"&&(k instanceof Array&&(u=k,k=u.pop()),k=l.symbols_[k]||k),k}n(St,"lex");for(var w,O,v,st,z={},j,M,_t,Q;;){if(O=c[c.length-1],this.defaultActions[O]?v=this.defaultActions[O]:((w===null||typeof w>"u")&&(w=St()),v=X[O]&&X[O][w]),typeof v>"u"||!v.length||!v[0]){var nt="";Q=[];for(j in X[O])this.terminals_[j]&&j>Kt&&Q.push("'"+this.terminals_[j]+"'");A.showPosition?nt="Parse error on line "+(G+1)+`:
2
2
  `+A.showPosition()+`
3
3
  Expecting `+Q.join(", ")+", got '"+(this.terminals_[w]||w)+"'":nt="Parse error on line "+(G+1)+": Unexpected "+(w==wt?"end of input":"'"+(this.terminals_[w]||w)+"'"),this.parseError(nt,{text:A.match,token:this.terminals_[w]||w,line:A.yylineno,loc:et,expected:Q})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+O+", token: "+w);switch(v[0]){case 1:c.push(w),m.push(A.yytext),a.push(A.yylloc),c.push(v[1]),w=null,Ct=A.yyleng,x=A.yytext,G=A.yylineno,et=A.yylloc;break;case 2:if(M=this.productions_[v[1]][1],z.$=m[m.length-M],z._$={first_line:a[a.length-(M||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(M||1)].first_column,last_column:a[a.length-1].last_column},Jt&&(z._$.range=[a[a.length-(M||1)].range[0],a[a.length-1].range[1]]),st=this.performAction.apply(z,[x,Ct,G,W.yy,v[1],m,a].concat(Zt)),typeof st<"u")return st;M&&(c=c.slice(0,-1*M*2),m=m.slice(0,-1*M),a=a.slice(0,-1*M)),c.push(this.productions_[v[1]][0]),m.push(z.$),a.push(z._$),_t=X[c[c.length-2]][c[c.length-1]],c.push(_t);break;case 3:return!0}}return!0},"parse")},Qt=function(){var B={EOF:1,parseError:n(function(l,c){if(this.yy.parser)this.yy.parser.parseError(l,c);else throw new Error(l)},"parseError"),setInput:n(function(h,l){return this.yy=l||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:n(function(){var h=this._input[0];this.yytext+=h,this.yyleng++,this.offset++,this.match+=h,this.matched+=h;var l=h.match(/(?:\r\n?|\n).*/g);return l?(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:n(function(h){var l=h.length,c=h.split(/(?:\r\n?|\n)/g);this._input=h+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-l),this.offset-=l;var u=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),c.length-1&&(this.yylineno-=c.length-1);var m=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:c?(c.length===u.length?this.yylloc.first_column:0)+u[u.length-c.length].length-c[0].length:this.yylloc.first_column-l},this.options.ranges&&(this.yylloc.range=[m[0],m[0]+this.yyleng-l]),this.yyleng=this.yytext.length,this},"unput"),more:n(function(){return this._more=!0,this},"more"),reject:n(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:n(function(h){this.unput(this.match.slice(h))},"less"),pastInput:n(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:n(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:n(function(){var h=this.pastInput(),l=new Array(h.length+1).join("-");return h+this.upcomingInput()+`
@@ -31,11 +31,11 @@
31
31
  <meta http-equiv="Content-Security-Policy"
32
32
  content="default-src 'self'; connect-src 'self' http://localhost:1111 http://127.0.0.1:1111 http://localhost:8080 http://127.0.0.1:8080 https://api.radienthq.com https://us.i.posthog.com https://login.microsoftonline.com https://accounts.google.com; script-src 'self' https://us-assets.i.posthog.com https://accounts.google.com https://login.microsoftonline.com; style-src 'self' 'unsafe-inline' data:; img-src 'self' data: blob: http://localhost:1111 http://127.0.0.1:1111; media-src 'self' blob: http://localhost:1111 http://127.0.0.1:1111; font-src 'self' data:; frame-src 'self' data: blob: http://localhost:1111 http://127.0.0.1:1111 https://accounts.google.com https://login.microsoftonline.com" />
33
33
  <meta http-equiv="Cross-Origin-Opener-Policy" content="same-origin-allow-popups" />
34
- <script type="module" crossorigin src="./assets/index-2LU4Cd3s.js"></script>
34
+ <script type="module" crossorigin src="./assets/index-Bu7e3rSb.js"></script>
35
35
  <link rel="modulepreload" crossorigin href="./assets/index-DkZDDEqx.js">
36
36
  <link rel="modulepreload" crossorigin href="./assets/ui-preferences-store-BcI6fr9b.js">
37
37
  <link rel="modulepreload" crossorigin href="./assets/error-boundary-Chq_L-1d.js">
38
- <link rel="modulepreload" crossorigin href="./assets/conversation-input-sync-ztF2uENp.js">
38
+ <link rel="modulepreload" crossorigin href="./assets/conversation-input-sync-CyctUEWr.js">
39
39
  <link rel="modulepreload" crossorigin href="./assets/console-mirror-CFdbeNFe.js">
40
40
  <link rel="stylesheet" crossorigin href="./assets/index-CUrucNe7.css">
41
41
  <link rel="stylesheet" crossorigin href="./assets/conversation-input-sync-CIGg7Rga.css">
@@ -6,11 +6,11 @@
6
6
  <title>Local Operator Quick Send</title>
7
7
  <meta http-equiv="Content-Security-Policy"
8
8
  content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:" />
9
- <script type="module" crossorigin src="./assets/mini-Jvr5I_Rk.js"></script>
9
+ <script type="module" crossorigin src="./assets/mini-BzGdxFI_.js"></script>
10
10
  <link rel="modulepreload" crossorigin href="./assets/index-DkZDDEqx.js">
11
11
  <link rel="modulepreload" crossorigin href="./assets/error-boundary-Chq_L-1d.js">
12
12
  <link rel="modulepreload" crossorigin href="./assets/ui-preferences-store-BcI6fr9b.js">
13
- <link rel="modulepreload" crossorigin href="./assets/conversation-input-sync-ztF2uENp.js">
13
+ <link rel="modulepreload" crossorigin href="./assets/conversation-input-sync-CyctUEWr.js">
14
14
  <link rel="stylesheet" crossorigin href="./assets/index-CUrucNe7.css">
15
15
  <link rel="stylesheet" crossorigin href="./assets/conversation-input-sync-CIGg7Rga.css">
16
16
  </head>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "local-operator-ui",
3
- "version": "0.32.3",
3
+ "version": "0.32.4",
4
4
  "productName": "Local Operator",
5
5
  "description": "User interface for AI agent assistants that run Python code safely on your device through an intuitive chat interface. Supports local and cloud LLM models with built-in security features.",
6
6
  "main": "./out/main/index.js",
@@ -86,7 +86,7 @@
86
86
  "check-types": "pnpm run check-types:main && pnpm run check-types:renderer",
87
87
  "check-changed": "node scripts/ci-scope.mjs --since \"$(git merge-base origin/main HEAD)\" --run",
88
88
  "test:session-cookies": "node scripts/session-cookie-electron.test.mjs",
89
- "test:desktop": "node scripts/run-desktop-tests.mjs scripts/agents-config-summary.test.mjs scripts/agents-config-retry.test.mjs scripts/agent-class-toggle.test.mjs scripts/update-fleet-drain.test.mjs scripts/at-mentions.test.mjs scripts/directory-listing.test.mjs scripts/slash-token.test.mjs scripts/slash-rank.test.mjs scripts/slash-submit.test.mjs scripts/slash-highlight.test.mjs scripts/slash-contract.test.mjs scripts/slash-row-format.test.mjs scripts/owned-serve-lifecycle.test.mjs scripts/launcher-watch.test.mjs scripts/linux-sandbox.test.mjs scripts/capture-evidence.test.mjs scripts/evidence-tz.test.mjs scripts/desktop-contract.test.mjs scripts/transcript-reducer.test.mjs scripts/transcript-focus.test.mjs scripts/transcript-focus-behaviour.test.mjs scripts/tool-compose-lifecycle.test.mjs scripts/transcript-paging.test.mjs scripts/transcript-paging-hook.test.mjs scripts/seed-placement.test.mjs scripts/seed-label-gap.test.mjs scripts/provider-state.test.mjs scripts/stale-agent.test.mjs scripts/desktop-renderer-transport.test.mjs scripts/desktop-proxy.test.mjs scripts/session-stream-token.test.mjs scripts/session-load-recovery.test.mjs scripts/session-load-sequence.test.mjs scripts/provider-grid-error-copy.test.mjs scripts/provider-grid-pin.test.mjs scripts/settings-time-to-error.test.mjs scripts/speech-settings.test.mjs scripts/backend-error-surfaces.test.mjs scripts/canonical-chat.test.mjs scripts/stale-caption.test.mjs scripts/desktop-watch-lease.test.mjs scripts/session-switch.test.mjs scripts/chat-search.test.mjs scripts/session-archive-delete.test.mjs scripts/chat-archived.test.mjs scripts/chat-archive-press.test.mjs scripts/desktop-test-lane-bound.test.mjs scripts/palette-search.test.mjs scripts/palette-shortcut.test.mjs scripts/palette-contract.test.mjs scripts/palette-panel-request.test.mjs scripts/run-child-reader.test.mjs scripts/run-detail-model.test.mjs scripts/subagent-pulse.test.mjs scripts/chat-title.test.mjs scripts/clear-search.test.mjs scripts/tool-row.test.mjs scripts/working-line-clock.test.mjs scripts/attachment-url.test.mjs scripts/desktop-notifier.test.mjs scripts/launch-session.test.mjs scripts/desktop-feed.test.mjs scripts/session-status-feed.test.mjs scripts/viewer-record.test.mjs scripts/desktop-stream.test.mjs scripts/python-bytecode-cache.test.mjs scripts/preload-updater-surface.test.mjs scripts/update-affirmation.test.mjs scripts/update-global-install.test.mjs scripts/update-robustness.test.mjs scripts/merge-update-feed.test.mjs scripts/prune-bundled-resources.test.mjs scripts/bundled-runtime-layout.test.mjs scripts/verify-bundled-uv.test.mjs scripts/managed-python.test.mjs scripts/usage-view.test.mjs scripts/usage-container.test.mjs scripts/session-status.test.mjs scripts/composer-readings.test.mjs scripts/composer-file-drop.test.mjs scripts/ask-draft-swap.test.mjs scripts/ask-queue.test.mjs scripts/composer-queued-send.test.mjs scripts/composer-tabs.test.mjs scripts/scroll-region-to-top.test.mjs scripts/ask-options.test.mjs scripts/click-proof-expect.test.mjs scripts/window-mode.test.mjs scripts/relaunch-during-quit-proof.test.mjs scripts/about-panel.test.mjs scripts/evidence-manifest.test.mjs scripts/canonical-notice.test.mjs scripts/evidence-histogram-parity.test.mjs scripts/evidence-run-guard.test.mjs scripts/desktop-test-concurrency.test.mjs scripts/desktop-test-memory-guard.test.mjs scripts/run-desktop-tests.test.mjs scripts/mcp-foreign-config-origin.test.mjs scripts/mentioned-files.test.mjs scripts/picker-feedback.test.mjs scripts/picker-host-selection.test.mjs scripts/panel-chart-motion.test.mjs scripts/panel-info-credentials.test.mjs scripts/panel-info-fleet.test.mjs scripts/warm-session.test.mjs scripts/submit-latency.test.mjs scripts/completion-view-ack.test.mjs scripts/echo-delivery.test.mjs scripts/check-runtime-deps.test.mjs scripts/new-chat-row.test.mjs scripts/new-chat-row-evidence.test.mjs scripts/new-chat-shortcut.test.mjs scripts/reconnect-page-gap.test.mjs scripts/browser-host.test.mjs scripts/check-vendored.test.mjs scripts/check-geometry-sources.test.mjs scripts/chat-session-status.test.mjs scripts/draft-selection.test.mjs scripts/draft-slash-identity.test.mjs scripts/toast-lifetime.test.mjs scripts/toast-close-placement.test.mjs scripts/storybook-query-fixture.test.mjs scripts/mcp-list-query.test.mjs scripts/mcp-target-resolution.test.mjs scripts/mcp-auth-surface.test.mjs scripts/mcp-failure-routing.test.mjs scripts/daemon-discovery.test.mjs scripts/daemon-health-state.test.mjs scripts/daemon-observation.test.mjs scripts/session-cookies.test.mjs scripts/move-session.test.mjs scripts/frontend-replace.test.mjs scripts/browser-chrome.test.mjs scripts/browser-queue-expiry.test.mjs scripts/dev-driver-gate.test.mjs scripts/logger-log-dir.test.mjs scripts/draft-splash.test.mjs scripts/suggestion-stack.test.mjs scripts/suggestion-stack-react.test.mjs scripts/notifications-off.test.mjs scripts/notification-launch.test.mjs scripts/notification-spawn-sites.test.mjs scripts/chrome-keychain.test.mjs scripts/interrupt-control.test.mjs scripts/interrupt-slot-hold-react.test.mjs scripts/chat-sidebar-archive.test.mjs scripts/chat-sidebar-selection.test.mjs scripts/message-quote.test.mjs scripts/panel-chart-hover.test.mjs scripts/panel-read-policy.test.mjs scripts/composer-suggestions.test.mjs scripts/composer-tip-react.test.mjs scripts/sidebar-catalogue-gate.test.mjs scripts/telemetry-launch.test.mjs scripts/telemetry-spawn-sites.test.mjs scripts/sidebar-focus-hold.test.mjs scripts/credential-capture.test.mjs scripts/soft-breaks.test.mjs scripts/credential-composer.test.mjs scripts/secret-ask.test.mjs scripts/run-panel-navigation.test.mjs scripts/backend-settings-tiers.test.mjs scripts/backend-settings-collapse.test.mjs scripts/check-build-env.test.mjs scripts/test-inventory.test.mjs scripts/conflict-markers.test.mjs scripts/compact-receipt.test.mjs scripts/chat-image-expand.test.mjs scripts/prune-python-seed.test.mjs scripts/mcp-auth-complete-no-retry.test.mjs scripts/panel-presentation.test.mjs scripts/turn-timestamp.test.mjs scripts/analytics-session-table.test.mjs scripts/theme-grid-navigation.test.mjs scripts/theme-registry-exhaustiveness.test.mjs scripts/scheduled-task-model.test.mjs scripts/backend-setting-combos.test.mjs scripts/model-setting-options.test.mjs scripts/searchable-select.test.mjs scripts/backend-settings-drafts.test.mjs scripts/typed-row-call-sites.test.mjs scripts/palette-focus.test.mjs scripts/composer-seeding.test.mjs scripts/skill-invocation.test.mjs scripts/skill-list.test.mjs scripts/skill-highlight.test.mjs scripts/theme-inline.test.mjs scripts/composer-refusal.test.mjs scripts/ci-scope.test.mjs scripts/browser-tab-strip-focus.test.mjs scripts/projects-board-focus.test.mjs scripts/browser-file-transfer-row.test.mjs scripts/link-targets.test.mjs scripts/link-actions.test.mjs scripts/chat-link-affordances.test.mjs scripts/streaming-markdown-parity.test.mjs scripts/transcription-failure-copy.test.mjs scripts/backend-version-drift.test.mjs scripts/live-seed-placement.test.mjs scripts/agents-publication.test.mjs scripts/agent-hub-queries.test.mjs scripts/install-builtin-batch.test.mjs scripts/install-progress.test.mjs scripts/attention-seen.test.mjs scripts/mark-all-read-control.test.mjs scripts/update-global-guard.test.mjs scripts/delivery-gate.test.mjs scripts/canvas-file-freshness.test.mjs scripts/no-websocket-plane.test.mjs scripts/update-window-report.test.mjs scripts/canvas-tab-close.test.mjs scripts/chat-sidebar-pins.test.mjs scripts/webauthn.test.mjs scripts/render-mac-entitlements.test.mjs scripts/row-state-floors.test.mjs scripts/pairing-card-copy.test.mjs scripts/update-install-copy.test.mjs scripts/update-shipit.test.mjs scripts/console-close.test.mjs scripts/console-host.test.mjs scripts/console-pack.test.mjs scripts/settings-account-gate.test.mjs scripts/sidebar-pin-order.test.mjs scripts/sidebar-split.test.mjs scripts/radient-session-issue.test.mjs scripts/console-pane.test.mjs scripts/console-mirror.test.mjs scripts/shell-path.test.mjs scripts/build-env-guard.test.mjs scripts/install-scripts-network.test.mjs scripts/console-pane-render.test.mjs scripts/settings-section-routes.test.mjs scripts/authoring-refresh.test.mjs scripts/verify-macos-artifacts.test.mjs scripts/provider-chip-verdict.test.mjs scripts/child-reader-foot-react.test.mjs scripts/backend-spawn-address.test.mjs scripts/connectivity-banner-copy.test.mjs scripts/connectivity-banner-notice.test.mjs scripts/chat-list-sections.test.mjs scripts/chat-keyboard-regions.test.mjs scripts/chat-sidebar-agents.test.mjs scripts/chat-sidebar-view.test.mjs scripts/chat-sidebar-layout.test.mjs scripts/drafts-clear-on-send.test.mjs scripts/chat-sidebar-drafts.test.mjs scripts/undo-toasts.test.mjs scripts/chat-sidebar-sections.test.mjs scripts/titlebar-options.test.mjs scripts/lane-leading.test.mjs scripts/trace-fold-model.test.mjs scripts/trace-fold-behaviour.test.mjs scripts/chat-status-strip.test.mjs scripts/chat-pane-floors.test.mjs scripts/path-utils.test.mjs scripts/window-chrome.test.mjs scripts/chat-sidebar-scope-paging.test.mjs scripts/chat-sidebar-connection-voices.test.mjs scripts/integration-model.test.mjs scripts/mcp-catalog-parity.test.mjs scripts/mcp-catalog-transport.test.mjs scripts/btw-aside.test.mjs scripts/composer-send-failure.test.mjs scripts/composer-text-authority.test.mjs scripts/shared-composer.test.mjs scripts/analytics-rate-format.test.mjs scripts/provider-catalog.test.mjs scripts/provider-sign-in-flow.test.mjs scripts/provider-status.test.mjs scripts/evidence-sign-in-states.test.mjs scripts/provider-detail-remount.test.mjs scripts/model-select-store.test.mjs scripts/onboarding-step-block.test.mjs scripts/onboarding-default-model.test.mjs scripts/server-release-notes.test.mjs scripts/no-hardlink-write.test.mjs scripts/canvas-goals.test.mjs scripts/overlay-drag-zones.test.mjs scripts/message-surface-floors.test.mjs scripts/header-identity-model.test.mjs scripts/pane-slot-ground.test.mjs scripts/projects-tab.test.mjs scripts/agent-hub-org-sharing.test.mjs scripts/mesh-tab.test.mjs scripts/onboarding-search-step.test.mjs scripts/provider-error-guidance.test.mjs scripts/radient-verify-callout.test.mjs scripts/sidebar-account-reconnect.test.mjs scripts/stopped-row-measure.test.mjs scripts/aida-rail-marks.test.mjs scripts/aida-sidebar.test.mjs scripts/currency-math.test.mjs scripts/mesh-canvas-bench.test.mjs scripts/agents-offer-dismiss.test.mjs scripts/projects-card-click.test.mjs scripts/lane-registration.test.mjs scripts/team-initials.test.mjs scripts/projects-sheet.test.mjs scripts/turn-collapse-model.test.mjs scripts/collapse-plan-per-pass.test.mjs scripts/turn-collapse-behaviour.test.mjs scripts/checkpoint-model.test.mjs scripts/checkpoint-rail.test.mjs scripts/use-checkpoints.test.mjs scripts/reveal-record.test.mjs scripts/transcript-loader.test.mjs scripts/transcript-deep-jump.test.mjs scripts/thread-search-contract.test.mjs scripts/thread-search-model.test.mjs scripts/thread-search-overlay.test.mjs scripts/use-thread-search.test.mjs scripts/notification-lifetime.test.mjs scripts/transcript-rail-refusal.test.mjs scripts/use-active-checkpoint.test.mjs scripts/hold-escape-claim.test.mjs scripts/hotkey-registration.test.mjs scripts/mini-view-dictation.test.mjs scripts/mini-view-contract.test.mjs scripts/ptt-keymap-binding.test.mjs scripts/cross-session-visibility.test.mjs scripts/fold-open.test.mjs scripts/transcript-foot-slot.test.mjs scripts/chat-measure-drag.test.mjs scripts/chat-measure-handle.test.mjs scripts/header-identity-menu.test.mjs scripts/hub-updates.test.mjs scripts/monitor-controls.test.mjs scripts/monitor-cancel-dialog.test.mjs scripts/child-transcript-paging.test.mjs scripts/loader-state-machine.test.mjs scripts/transcript-cursor-continuity.test.mjs scripts/older-history-slot.test.mjs scripts/chat-session-subagents.test.mjs scripts/message-actions.test.mjs scripts/update-indicator-segments.test.mjs scripts/reload-picker-close.test.mjs scripts/projects-time-window.test.mjs scripts/audio-recording-levels.test.mjs scripts/chat-sidebar-row-menu.test.mjs scripts/navigation-gesture.test.mjs scripts/fleet-asks.test.mjs scripts/right-slot-width.test.mjs scripts/transcript-fade.test.mjs scripts/agents-config-probe-cadence.test.mjs scripts/turn-segments.test.mjs scripts/turn-partition-predicate.test.mjs scripts/chat-device-model.test.mjs scripts/org-teams-summary.test.mjs scripts/markdown-table-widths.test.mjs scripts/turn-answer-rail.test.mjs scripts/scrollbar-activity.test.mjs scripts/stt-mic-gate-session.test.mjs scripts/transcript-perflush-perf.test.mjs scripts/speech-clip.test.mjs scripts/speech-store.test.mjs scripts/speech-controls.test.mjs scripts/speech-selection.test.mjs scripts/speech-user-copy.test.mjs scripts/pre-push-gate.test.mjs scripts/update-rollover.test.mjs scripts/projects-filters.test.mjs scripts/projects-search.test.mjs scripts/projects-search-index.test.mjs scripts/projects-sort.test.mjs scripts/project-view-perf.test.mjs scripts/projects-request-update.test.mjs scripts/projects-inline-edit.test.mjs scripts/speech-target.test.mjs scripts/agents-composer-mount.test.mjs scripts/evidence-fold.test.mjs scripts/projects-quick-send.test.mjs",
89
+ "test:desktop": "node scripts/run-desktop-tests.mjs scripts/agents-config-summary.test.mjs scripts/agents-config-retry.test.mjs scripts/agent-class-toggle.test.mjs scripts/update-fleet-drain.test.mjs scripts/at-mentions.test.mjs scripts/directory-listing.test.mjs scripts/slash-token.test.mjs scripts/slash-rank.test.mjs scripts/slash-submit.test.mjs scripts/slash-highlight.test.mjs scripts/slash-contract.test.mjs scripts/slash-row-format.test.mjs scripts/owned-serve-lifecycle.test.mjs scripts/launcher-watch.test.mjs scripts/linux-sandbox.test.mjs scripts/capture-evidence.test.mjs scripts/evidence-tz.test.mjs scripts/desktop-contract.test.mjs scripts/transcript-reducer.test.mjs scripts/transcript-focus.test.mjs scripts/transcript-focus-behaviour.test.mjs scripts/tool-compose-lifecycle.test.mjs scripts/transcript-paging.test.mjs scripts/transcript-paging-hook.test.mjs scripts/seed-placement.test.mjs scripts/seed-label-gap.test.mjs scripts/provider-state.test.mjs scripts/stale-agent.test.mjs scripts/desktop-renderer-transport.test.mjs scripts/desktop-proxy.test.mjs scripts/session-stream-token.test.mjs scripts/session-load-recovery.test.mjs scripts/session-load-sequence.test.mjs scripts/provider-grid-error-copy.test.mjs scripts/provider-grid-pin.test.mjs scripts/settings-time-to-error.test.mjs scripts/speech-settings.test.mjs scripts/backend-error-surfaces.test.mjs scripts/canonical-chat.test.mjs scripts/stale-caption.test.mjs scripts/desktop-watch-lease.test.mjs scripts/session-switch.test.mjs scripts/chat-search.test.mjs scripts/session-archive-delete.test.mjs scripts/chat-archived.test.mjs scripts/chat-archive-press.test.mjs scripts/desktop-test-lane-bound.test.mjs scripts/palette-search.test.mjs scripts/palette-shortcut.test.mjs scripts/palette-contract.test.mjs scripts/palette-panel-request.test.mjs scripts/run-child-reader.test.mjs scripts/run-detail-model.test.mjs scripts/subagent-pulse.test.mjs scripts/chat-title.test.mjs scripts/clear-search.test.mjs scripts/tool-row.test.mjs scripts/working-line-clock.test.mjs scripts/attachment-url.test.mjs scripts/desktop-notifier.test.mjs scripts/launch-session.test.mjs scripts/desktop-feed.test.mjs scripts/session-status-feed.test.mjs scripts/viewer-record.test.mjs scripts/desktop-stream.test.mjs scripts/python-bytecode-cache.test.mjs scripts/preload-updater-surface.test.mjs scripts/update-affirmation.test.mjs scripts/update-global-install.test.mjs scripts/update-robustness.test.mjs scripts/merge-update-feed.test.mjs scripts/prune-bundled-resources.test.mjs scripts/bundled-runtime-layout.test.mjs scripts/verify-bundled-uv.test.mjs scripts/managed-python.test.mjs scripts/usage-view.test.mjs scripts/usage-container.test.mjs scripts/session-status.test.mjs scripts/composer-readings.test.mjs scripts/composer-file-drop.test.mjs scripts/ask-draft-swap.test.mjs scripts/ask-queue.test.mjs scripts/ask-revise.test.mjs scripts/composer-queued-send.test.mjs scripts/composer-tabs.test.mjs scripts/scroll-region-to-top.test.mjs scripts/ask-options.test.mjs scripts/click-proof-expect.test.mjs scripts/window-mode.test.mjs scripts/relaunch-during-quit-proof.test.mjs scripts/about-panel.test.mjs scripts/evidence-manifest.test.mjs scripts/canonical-notice.test.mjs scripts/evidence-histogram-parity.test.mjs scripts/evidence-run-guard.test.mjs scripts/desktop-test-concurrency.test.mjs scripts/desktop-test-memory-guard.test.mjs scripts/run-desktop-tests.test.mjs scripts/mcp-foreign-config-origin.test.mjs scripts/mentioned-files.test.mjs scripts/picker-feedback.test.mjs scripts/picker-host-selection.test.mjs scripts/panel-chart-motion.test.mjs scripts/panel-info-credentials.test.mjs scripts/panel-info-fleet.test.mjs scripts/warm-session.test.mjs scripts/submit-latency.test.mjs scripts/completion-view-ack.test.mjs scripts/echo-delivery.test.mjs scripts/check-runtime-deps.test.mjs scripts/new-chat-row.test.mjs scripts/new-chat-row-evidence.test.mjs scripts/new-chat-shortcut.test.mjs scripts/reconnect-page-gap.test.mjs scripts/browser-host.test.mjs scripts/check-vendored.test.mjs scripts/check-geometry-sources.test.mjs scripts/chat-session-status.test.mjs scripts/draft-selection.test.mjs scripts/draft-slash-identity.test.mjs scripts/toast-lifetime.test.mjs scripts/toast-close-placement.test.mjs scripts/storybook-query-fixture.test.mjs scripts/mcp-list-query.test.mjs scripts/mcp-target-resolution.test.mjs scripts/mcp-auth-surface.test.mjs scripts/mcp-failure-routing.test.mjs scripts/daemon-discovery.test.mjs scripts/daemon-health-state.test.mjs scripts/daemon-observation.test.mjs scripts/session-cookies.test.mjs scripts/move-session.test.mjs scripts/frontend-replace.test.mjs scripts/browser-chrome.test.mjs scripts/browser-queue-expiry.test.mjs scripts/dev-driver-gate.test.mjs scripts/logger-log-dir.test.mjs scripts/draft-splash.test.mjs scripts/suggestion-stack.test.mjs scripts/suggestion-stack-react.test.mjs scripts/notifications-off.test.mjs scripts/notification-launch.test.mjs scripts/notification-spawn-sites.test.mjs scripts/chrome-keychain.test.mjs scripts/interrupt-control.test.mjs scripts/interrupt-slot-hold-react.test.mjs scripts/chat-sidebar-archive.test.mjs scripts/chat-sidebar-selection.test.mjs scripts/message-quote.test.mjs scripts/panel-chart-hover.test.mjs scripts/panel-read-policy.test.mjs scripts/composer-suggestions.test.mjs scripts/composer-tip-react.test.mjs scripts/sidebar-catalogue-gate.test.mjs scripts/telemetry-launch.test.mjs scripts/telemetry-spawn-sites.test.mjs scripts/sidebar-focus-hold.test.mjs scripts/credential-capture.test.mjs scripts/soft-breaks.test.mjs scripts/credential-composer.test.mjs scripts/secret-ask.test.mjs scripts/run-panel-navigation.test.mjs scripts/backend-settings-tiers.test.mjs scripts/backend-settings-collapse.test.mjs scripts/check-build-env.test.mjs scripts/test-inventory.test.mjs scripts/conflict-markers.test.mjs scripts/compact-receipt.test.mjs scripts/chat-image-expand.test.mjs scripts/prune-python-seed.test.mjs scripts/mcp-auth-complete-no-retry.test.mjs scripts/panel-presentation.test.mjs scripts/turn-timestamp.test.mjs scripts/analytics-session-table.test.mjs scripts/theme-grid-navigation.test.mjs scripts/theme-registry-exhaustiveness.test.mjs scripts/scheduled-task-model.test.mjs scripts/backend-setting-combos.test.mjs scripts/model-setting-options.test.mjs scripts/searchable-select.test.mjs scripts/backend-settings-drafts.test.mjs scripts/typed-row-call-sites.test.mjs scripts/palette-focus.test.mjs scripts/composer-seeding.test.mjs scripts/skill-invocation.test.mjs scripts/skill-list.test.mjs scripts/skill-highlight.test.mjs scripts/theme-inline.test.mjs scripts/composer-refusal.test.mjs scripts/ci-scope.test.mjs scripts/browser-tab-strip-focus.test.mjs scripts/projects-board-focus.test.mjs scripts/browser-file-transfer-row.test.mjs scripts/link-targets.test.mjs scripts/link-actions.test.mjs scripts/chat-link-affordances.test.mjs scripts/streaming-markdown-parity.test.mjs scripts/transcription-failure-copy.test.mjs scripts/backend-version-drift.test.mjs scripts/live-seed-placement.test.mjs scripts/agents-publication.test.mjs scripts/agent-hub-queries.test.mjs scripts/install-builtin-batch.test.mjs scripts/install-progress.test.mjs scripts/attention-seen.test.mjs scripts/mark-all-read-control.test.mjs scripts/update-global-guard.test.mjs scripts/delivery-gate.test.mjs scripts/canvas-file-freshness.test.mjs scripts/no-websocket-plane.test.mjs scripts/update-window-report.test.mjs scripts/canvas-tab-close.test.mjs scripts/chat-sidebar-pins.test.mjs scripts/webauthn.test.mjs scripts/render-mac-entitlements.test.mjs scripts/row-state-floors.test.mjs scripts/pairing-card-copy.test.mjs scripts/update-install-copy.test.mjs scripts/update-shipit.test.mjs scripts/console-close.test.mjs scripts/console-host.test.mjs scripts/console-pack.test.mjs scripts/settings-account-gate.test.mjs scripts/sidebar-pin-order.test.mjs scripts/sidebar-split.test.mjs scripts/radient-session-issue.test.mjs scripts/console-pane.test.mjs scripts/console-mirror.test.mjs scripts/shell-path.test.mjs scripts/build-env-guard.test.mjs scripts/install-scripts-network.test.mjs scripts/console-pane-render.test.mjs scripts/settings-section-routes.test.mjs scripts/authoring-refresh.test.mjs scripts/verify-macos-artifacts.test.mjs scripts/provider-chip-verdict.test.mjs scripts/child-reader-foot-react.test.mjs scripts/backend-spawn-address.test.mjs scripts/connectivity-banner-copy.test.mjs scripts/connectivity-banner-notice.test.mjs scripts/chat-list-sections.test.mjs scripts/chat-keyboard-regions.test.mjs scripts/chat-sidebar-agents.test.mjs scripts/chat-sidebar-view.test.mjs scripts/chat-sidebar-layout.test.mjs scripts/drafts-clear-on-send.test.mjs scripts/chat-sidebar-drafts.test.mjs scripts/undo-toasts.test.mjs scripts/chat-sidebar-sections.test.mjs scripts/titlebar-options.test.mjs scripts/lane-leading.test.mjs scripts/trace-fold-model.test.mjs scripts/trace-fold-behaviour.test.mjs scripts/chat-status-strip.test.mjs scripts/chat-pane-floors.test.mjs scripts/path-utils.test.mjs scripts/window-chrome.test.mjs scripts/chat-sidebar-scope-paging.test.mjs scripts/chat-sidebar-connection-voices.test.mjs scripts/integration-model.test.mjs scripts/mcp-catalog-parity.test.mjs scripts/mcp-catalog-transport.test.mjs scripts/btw-aside.test.mjs scripts/composer-send-failure.test.mjs scripts/composer-text-authority.test.mjs scripts/shared-composer.test.mjs scripts/analytics-rate-format.test.mjs scripts/provider-catalog.test.mjs scripts/provider-sign-in-flow.test.mjs scripts/provider-status.test.mjs scripts/evidence-sign-in-states.test.mjs scripts/provider-detail-remount.test.mjs scripts/model-select-store.test.mjs scripts/onboarding-step-block.test.mjs scripts/onboarding-default-model.test.mjs scripts/server-release-notes.test.mjs scripts/no-hardlink-write.test.mjs scripts/canvas-goals.test.mjs scripts/overlay-drag-zones.test.mjs scripts/message-surface-floors.test.mjs scripts/header-identity-model.test.mjs scripts/pane-slot-ground.test.mjs scripts/projects-tab.test.mjs scripts/agent-hub-org-sharing.test.mjs scripts/mesh-tab.test.mjs scripts/onboarding-search-step.test.mjs scripts/provider-error-guidance.test.mjs scripts/radient-verify-callout.test.mjs scripts/sidebar-account-reconnect.test.mjs scripts/stopped-row-measure.test.mjs scripts/aida-rail-marks.test.mjs scripts/aida-sidebar.test.mjs scripts/currency-math.test.mjs scripts/mesh-canvas-bench.test.mjs scripts/agents-offer-dismiss.test.mjs scripts/projects-card-click.test.mjs scripts/lane-registration.test.mjs scripts/team-initials.test.mjs scripts/projects-sheet.test.mjs scripts/turn-collapse-model.test.mjs scripts/collapse-plan-per-pass.test.mjs scripts/turn-collapse-behaviour.test.mjs scripts/checkpoint-model.test.mjs scripts/checkpoint-rail.test.mjs scripts/use-checkpoints.test.mjs scripts/reveal-record.test.mjs scripts/transcript-loader.test.mjs scripts/transcript-deep-jump.test.mjs scripts/thread-search-contract.test.mjs scripts/thread-search-model.test.mjs scripts/thread-search-overlay.test.mjs scripts/use-thread-search.test.mjs scripts/notification-lifetime.test.mjs scripts/transcript-rail-refusal.test.mjs scripts/use-active-checkpoint.test.mjs scripts/hold-escape-claim.test.mjs scripts/hotkey-registration.test.mjs scripts/mini-view-dictation.test.mjs scripts/mini-view-contract.test.mjs scripts/ptt-keymap-binding.test.mjs scripts/cross-session-visibility.test.mjs scripts/fold-open.test.mjs scripts/transcript-foot-slot.test.mjs scripts/chat-measure-drag.test.mjs scripts/chat-measure-handle.test.mjs scripts/header-identity-menu.test.mjs scripts/hub-updates.test.mjs scripts/monitor-controls.test.mjs scripts/monitor-cancel-dialog.test.mjs scripts/child-transcript-paging.test.mjs scripts/loader-state-machine.test.mjs scripts/transcript-cursor-continuity.test.mjs scripts/older-history-slot.test.mjs scripts/chat-session-subagents.test.mjs scripts/message-actions.test.mjs scripts/update-indicator-segments.test.mjs scripts/reload-picker-close.test.mjs scripts/projects-time-window.test.mjs scripts/audio-recording-levels.test.mjs scripts/chat-sidebar-row-menu.test.mjs scripts/navigation-gesture.test.mjs scripts/fleet-asks.test.mjs scripts/right-slot-width.test.mjs scripts/transcript-fade.test.mjs scripts/agents-config-probe-cadence.test.mjs scripts/turn-segments.test.mjs scripts/turn-partition-predicate.test.mjs scripts/chat-device-model.test.mjs scripts/org-teams-summary.test.mjs scripts/markdown-table-widths.test.mjs scripts/turn-answer-rail.test.mjs scripts/scrollbar-activity.test.mjs scripts/stt-mic-gate-session.test.mjs scripts/transcript-perflush-perf.test.mjs scripts/speech-clip.test.mjs scripts/speech-store.test.mjs scripts/speech-controls.test.mjs scripts/speech-selection.test.mjs scripts/speech-user-copy.test.mjs scripts/pre-push-gate.test.mjs scripts/update-rollover.test.mjs scripts/projects-filters.test.mjs scripts/projects-search.test.mjs scripts/projects-search-index.test.mjs scripts/projects-sort.test.mjs scripts/project-view-perf.test.mjs scripts/projects-request-update.test.mjs scripts/projects-inline-edit.test.mjs scripts/speech-target.test.mjs scripts/agents-composer-mount.test.mjs scripts/evidence-fold.test.mjs scripts/projects-quick-send.test.mjs",
90
90
  "check-themes": "node scripts/generate-theme-css.mjs --check && node scripts/contrast-contract.mjs",
91
91
  "check-vendored": "node scripts/check-vendored.mjs",
92
92
  "check-evidence": "node scripts/check-evidence.mjs",
@@ -1 +0,0 @@
1
- import{U as a,C as n}from"./mermaid.core-DmRnOx5f.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
@@ -1 +0,0 @@
1
- import{s as a,c as s,a as e,C as t}from"./chunk-A2AXSNBT-C7I3LSLt.js";import{_ as i}from"./mermaid.core-DmRnOx5f.js";import"./chunk-RZ5BOZE2-Ce1S3X33.js";import"./conversation-input-sync-ztF2uENp.js";import"./ui-preferences-store-BcI6fr9b.js";import"./index-DkZDDEqx.js";import"./error-boundary-Chq_L-1d.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-A2AXSNBT-C7I3LSLt.js";import{_ as i}from"./mermaid.core-DmRnOx5f.js";import"./chunk-RZ5BOZE2-Ce1S3X33.js";import"./conversation-input-sync-ztF2uENp.js";import"./ui-preferences-store-BcI6fr9b.js";import"./index-DkZDDEqx.js";import"./error-boundary-Chq_L-1d.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{b as r}from"./_baseUniq-Dsdryz8Q.js";var e=4;function a(o){return r(o,e)}export{a as c};
@@ -1 +0,0 @@
1
- import{r as f,j as t,c as R}from"./index-DkZDDEqx.js";import{aW as we,aX as Xe,aY as Oe,a as qe,aZ as xe,ah as Ze,a_ as Je}from"./conversation-input-sync-ztF2uENp.js";import{P as Qe}from"./page-header-DuslXJJm.js";import{B as U,j as Ie,A as he,k as et,a as ae,D as tt,l as st,m as nt,n as at,o as Ce,p as Se,e as Me}from"./error-boundary-Chq_L-1d.js";import{i as it,d as rt,e as lt,f as ot,g as dt,h as ct,j as ut,k as mt,l as ht,m as pt,n as ft,o as xt,p as bt,q as gt,r as vt,N as kt,s as je,t as wt,u as oe,D as jt,v as yt,w as Nt,x as ye,y as ke,R as It,z as de,C as We,E as ze,F as Ct,G as me,H as be,I as St,J as Mt,K as pe,L as De,M as Dt,O as Et,Q as ge,T as At,U as He,V as _t,W as Be,X as Rt,Y as $t,Z as Lt,_ as Pt,$ as Tt,a0 as Ot,a1 as Wt,a2 as zt,a3 as Ht,a4 as Bt,a5 as Yt,a6 as Ft,a7 as Ut,a8 as Gt,a9 as Vt,aa as Kt,ab as Xt,ac as qt,ad as Zt,ae as le,af as Jt}from"./index-2LU4Cd3s.js";import"./ui-preferences-store-BcI6fr9b.js";import"./console-mirror-CFdbeNFe.js";function Qt(e){return e==="requested"?"attention":e==="failed"?"danger":e==="connected"?"success":"neutral"}function es(e){switch(e){case"requested":return"Approving signs with this machine's operator key; the system may ask for it.";case"approved":return"An agent runs the install and connect (lop network approvals run).";case"connecting":return"Denying now stops it at its next step.";case"failed":return"The runner stopped. Denying abandons it; an agent can retry it.";default:return null}}function ts(e){switch(e){case"requested":return"Signing";case"approved":return"Next";case"connecting":return"Stop";case"failed":return"After a stop";default:return"What this means"}}function ss(e){return e==="connected"?"connected":e==="denied"?"denied":"expired"}const ns=({rows:e,error:s,pending:r,refusal:a,onDecide:d,onRetry:c,nowSeconds:m,networkNames:l})=>{const x=r!==null,v=f.useMemo(()=>e.filter(i=>it(i.state)),[e]),[y,I]=f.useState([]),N=f.useRef(new Map);f.useEffect(()=>{const i=new Map;for(const g of v)i.set(g.approvalId,rt(g));const h=[];for(const[g,j]of N.current){if(i.has(g))continue;const C=e.find(M=>M.approvalId===g)?.state??"";(C==="connected"||C==="denied"||C==="expired")&&h.push({key:`${g}:${C}`,text:`${j} — ${ss(C)}`})}h.length&&I(g=>[...g,...h].slice(-3)),N.current=i},[v,e]);const o=a!==null&&v.some(i=>i.approvalId===a.approvalId);return v.length===0&&y.length===0&&!s&&!a?null:t.jsxs("section",{"aria-label":"Approvals","data-tour-tag":"mesh-approvals-tray",className:"flex flex-col gap-3 rounded-lg border border-hairline bg-surface p-3",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx(lt,{"aria-hidden":"true",className:"size-4 text-ink-muted"}),t.jsx("h2",{className:"text-body-sm text-ink",children:"Approvals"}),v.length>0&&t.jsx("span",{className:"text-meta text-ink-dim",children:v.length===1?"1 waiting":`${v.length} waiting`})]}),s&&t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("p",{className:"min-w-0 flex-1 text-meta text-ink-muted",children:s}),t.jsx(U,{variant:"secondary",size:"sm",onClick:c,children:"Ask again"})]}),v.length>0&&t.jsx("ul",{className:"flex flex-col divide-y divide-hairline",children:v.map(i=>t.jsx(as,{row:i,pending:r?.approvalId===i.approvalId?r:null,busy:x,refusal:a?.approvalId===i.approvalId?a:null,onDecide:d,nowSeconds:m,networkNames:l},i.approvalId))}),a&&!o&&t.jsx(Ye,{refusal:a}),y.length>0&&t.jsx("ul",{className:"flex flex-col gap-0.5 text-meta text-ink-dim","data-tour-tag":"mesh-approvals-resolved",children:y.map(i=>t.jsx("li",{children:i.text},i.key))})]})},as=({row:e,pending:s,busy:r,refusal:a,onDecide:d,nowSeconds:c,networkNames:m})=>{const l=ot(e),x=dt(e),v=ct(e),y=ut(e,m),I=mt(e),N=ht(e.expiresAt,c),o=es(e.state),i=pt(e.state),h=ft(e.state);return t.jsxs("li",{className:"flex flex-col gap-2 py-3 first:pt-0 last:pb-0","data-tour-tag":"mesh-approval-card",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx(Ie,{variant:Qt(e.state),children:xt(e.state)}),t.jsx("span",{className:"text-body-sm text-ink",children:bt(e)}),t.jsx("div",{className:"grow"}),N&&t.jsx("span",{className:"text-meta text-ink-dim",children:N})]}),(l||x)&&t.jsxs("p",{className:"text-meta text-ink-muted",children:[l&&t.jsx("span",{children:l}),l&&x&&t.jsx("span",{children:" · "}),x&&t.jsx("span",{className:"font-mono",children:x})]}),y.length>0&&t.jsx("ul",{className:"flex flex-wrap gap-1",children:y.map(g=>t.jsx("li",{children:t.jsx(Ie,{variant:gt(g),children:g})},g))}),v&&t.jsx("p",{className:"text-meta text-ink-dim",children:v}),I.length>0&&t.jsx("dl",{className:"grid grid-cols-[max-content_1fr] gap-x-4 gap-y-0.5 text-meta text-ink-dim","data-tour-tag":"mesh-approval-scope-glosses",children:I.map(g=>t.jsxs(f.Fragment,{children:[t.jsx("dt",{className:"text-ink-muted",children:g.term}),t.jsx("dd",{children:g.gloss})]},g.term))}),o&&t.jsxs("dl",{className:"grid grid-cols-[max-content_1fr] gap-x-4 gap-y-0.5 text-meta","data-tour-tag":"mesh-approval-consequence",children:[t.jsx("dt",{className:"text-ink-muted",children:ts(e.state)}),t.jsx("dd",{className:"text-ink-muted",children:o})]}),(i||h)&&t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i&&t.jsx(U,{variant:"primary",size:"sm",disabled:r,onClick:()=>d(e.approvalId,"approve"),"data-tour-tag":"mesh-approval-approve",children:"Approve"}),h&&t.jsx(U,{variant:i?"ghost":"secondary",size:"sm",disabled:r,onClick:()=>d(e.approvalId,"deny"),"data-tour-tag":"mesh-approval-deny",children:"Deny"}),s&&t.jsx("span",{className:"text-meta text-ink-dim",children:s.decision==="approve"?"Waiting for the signing prompt…":"Writing the decision…"})]}),a&&t.jsx(Ye,{refusal:a})]})},Ye=({refusal:e})=>t.jsxs(he,{variant:"warning",className:"text-meta",children:[t.jsx("span",{className:"min-w-0 flex-1",children:e.sentence}),t.jsx("span",{className:"shrink-0 font-mono text-ink-dim",children:e.code})]}),is=4,fe={kind:"idle"};function rs(e){switch(e.kind){case"dragging":case"settling":return e.payload.session.id;case"pressing":return null;default:return null}}function Q(e,s){switch(s.kind){case"press":return e.kind!=="idle"?e:{kind:"pressing",payload:s.payload,originX:s.x,originY:s.y,pointerId:s.pointerId};case"move":return e.kind==="pressing"?Math.max(Math.abs(s.x-e.originX),Math.abs(s.y-e.originY))<is?e:{kind:"dragging",payload:e.payload,x:s.x,y:s.y,target:s.target,pointerId:e.pointerId}:e.kind==="dragging"?{...e,x:s.x,y:s.y,target:s.target}:e;case"release":return e.kind==="dragging"?{kind:"settling",payload:e.payload,target:e.target}:e.kind==="pressing"?fe:e;case"cancel":case"settled":return fe;default:return e}}const ls=({edges:e,geometry:s,selectedDeviceId:r})=>t.jsx("svg",{"aria-hidden":"true",className:"pointer-events-none absolute top-0 left-0 overflow-visible",width:s.bounds.width,height:s.bounds.height,children:e.map(a=>{const d=s.networks.get(a.networkId),c=s.devices.get(a.deviceId);if(!d||!c)return null;const m=r!==null&&a.deviceId===r;return t.jsx("path",{"data-mesh-edge":a.key,d:vt(d,c),fill:"none",strokeWidth:m?2:1.5,strokeDasharray:a.active?void 0:"4 4",className:m?"stroke-ink":"stroke-ink-dim"},a.key)})}),os={self:"border-l-hairline",reached:"border-l-hairline",unanswered:"border-l-warning","not-attempted":"border-l-hairline",unknown:"border-l-hairline"};function ds(e){return e.suspect?"border-l-danger":os[oe(e)]}const cs={self:"ring-2 ring-accent",reachable:null,unreachable:null,suspect:null},us={accept:"border-accent bg-accent-wash",refuse:"border-warning"};function ms(e,s,r){return[e.label,ze(e,s),r].filter(Boolean).join(", ")}function ee(e){return e.name.trim()||e.id.slice(-6)}function Fe(e,s,r){if(r!=="reached"&&r!=="self"){const a=de(r);return e.unreachable_reason?`${a} (${e.unreachable_reason})`:a}return e.live_state.trim()?e.live_state.trim():e.locality==="local"?"on this device":`on ${s}`}const hs={resting:"border-l-2 border-l-hairline",attention:"border-l-2 border-l-warning"},ps=({network:e,x:s,y:r,refused:a})=>t.jsxs("li",{"data-mesh-network":e.id,"data-mesh-network-refused":a?"true":void 0,className:R("absolute flex items-center gap-2 rounded-md border bg-elevated px-3",a?"border-warning":"border-hairline"),style:{left:s,top:r,width:je,height:kt},children:[t.jsx(we,{"aria-hidden":"true",className:"size-4 shrink-0 text-ink-muted"}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block truncate text-body-sm text-ink",children:e.label}),t.jsxs("span",{title:`epoch ${e.epoch}`,className:"block truncate text-meta text-ink-dim",children:[e.memberCount," ",e.memberCount===1?"device":"devices",e.revokedCount>0?` · ${e.revokedCount} revoked`:""]})]})]}),fs=({device:e,x:s,y:r,nowSeconds:a,selected:d,sessions:c,sessionTotal:m,dropState:l,movingSessionId:x,draggedSessionId:v,onOpen:y,onChipPointerDown:I,onChipClick:N,onShowAllSessions:o})=>{const{activity:i}=wt(e,c.rows),h=i==="working",g=ms(e,a,h?"working":null),j=oe(e);return t.jsxs("li",{"data-mesh-device":e.id,"data-mesh-state":e.state,"data-mesh-drop":l??void 0,"aria-current":d?"true":void 0,className:R("absolute flex flex-col rounded-md border border-l-4 border-control bg-elevated","hover:bg-row-hover",d&&"border-y-ink border-r-ink bg-row-selected",ds(e),cs[e.state],l&&us[l]),style:{left:s,top:r,width:je,height:jt},children:[t.jsxs("button",{type:"button","data-mesh-device-open":e.id,"data-mesh-reach":j,"aria-label":g,title:Nt(e),onClick:()=>y(e.id),className:R("flex w-full flex-col justify-between rounded-t-[5px] px-3 pt-2 pb-2 text-left","cursor-pointer","focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-[-2px]"),style:{height:yt},children:[t.jsxs("span",{className:"flex w-full min-w-0 items-center gap-2",children:[t.jsx(Xe,{"aria-hidden":"true",className:"size-4 shrink-0 text-ink-muted"}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-body-sm text-ink",children:e.label}),e.suspect&&t.jsx(ye,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-danger"})]}),t.jsxs("span",{className:"flex w-full min-w-0 items-baseline gap-1",children:[t.jsx("span",{className:"w-3 shrink-0 font-mono text-body-sm text-ink tabular-nums",children:e.sessionCount??"–"}),t.jsx("span",{className:R("min-w-0 truncate text-meta",e.sessionCount===null?"text-ink-dim":"text-ink-muted"),children:ke(e.sessionCount)})]}),t.jsxs("span",{"data-mesh-state-line":"",className:"flex w-full min-w-0 items-baseline gap-1.5 text-meta",children:[t.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-ink-dim",children:It[j]}),t.jsx("span",{className:R("shrink-0",We[j]),children:de(j)}),h&&t.jsx("span",{"data-mesh-working":"",className:"shrink-0 text-info",children:"working"}),e.memberships.length>1&&t.jsxs("span",{className:"min-w-0 truncate text-ink-dim",children:["· ",e.memberships.length," networks"]})]})]}),t.jsxs("ul",{"aria-label":`Conversations on ${e.label}`,className:R("m-0 flex h-6 list-none items-center gap-1 overflow-hidden px-3",l==="accept"&&"opacity-40"),children:[c.shown.map(p=>t.jsx(xs,{session:p,ownerLabel:e.label,ownerReach:j,ownerReachable:e.reachable,moving:x===p.id,dragging:v===p.id,onPointerDown:I,onClick:()=>N(p)},p.id)),c.hidden>0&&t.jsx("li",{className:"shrink-0",children:t.jsxs("button",{type:"button","data-mesh-more":e.id,onClick:()=>o(e.id),className:R("flex min-h-6 items-center rounded-sm px-1.5 text-meta text-ink-dim","hover:bg-row-hover hover:text-ink","focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2"),title:`Showing ${c.shown.length} of ${m} conversations`,"aria-label":`Show all ${m} conversations`,children:["+",c.hidden]})})]})]})},xs=({session:e,ownerLabel:s,ownerReach:r,ownerReachable:a,moving:d,dragging:c,onPointerDown:m,onClick:l})=>{const x=Fe(e,s,r);return d?t.jsx("li",{role:"status","data-mesh-session":e.id,"data-mesh-moving":"true",children:t.jsx("span",{className:"flex min-h-6 items-center rounded-sm bg-sunken px-1.5 text-meta text-ink-muted",children:"moving…"})}):t.jsx("li",{className:"min-w-0 flex-1","data-mesh-session-item":e.id,"data-mesh-dragging":c?"true":void 0,children:t.jsx("button",{type:"button","data-mesh-session":e.id,style:{touchAction:"none"},title:`${ee(e)} · ${x}`,"aria-label":`${ee(e)}, ${x}. Opens ${s}.`,onPointerDown:v=>m(v,e),onClick:()=>l(e),className:R("flex min-h-6 w-full max-w-32 items-center rounded-sm border border-hairline bg-surface px-1.5 text-left text-meta text-ink-muted","cursor-grab active:cursor-grabbing","hover:text-ink",hs[Ct(e,a)],c&&"opacity-60","focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2"),children:t.jsx("span",{className:"min-w-0 flex-1 truncate",children:ee(e)})})})};function Ee(e){const s=e.trim();if(!s)return null;if(s.startsWith("[")){const a=s.indexOf("]");if(a<=1)return null;const d=s.slice(1,a),c=s.slice(a+1);if(!c)return{host:d,port:null};if(!c.startsWith(":"))return null;const m=Number(c.slice(1));return{host:d,port:Number.isInteger(m)?m:null}}const r=s.lastIndexOf(":");if(r>0){const a=s.slice(r+1);if(/^\d+$/.test(a))return{host:s.slice(0,r),port:Number(a)}}return{host:s,port:null}}function Ae(e){const s=e.trim().split(".");if(s.length!==4)return null;for(const r of s)if(!/^\d{1,3}$/.test(r)||Number(r)>255)return null;return`${s[0]}.${s[1]}.${s[2]}`}function bs(e){return`${e}.x`}function gs(e){const s=new Map;for(const a of e.values())for(const d of a)s.set(d,(s.get(d)??0)+1);const r=new Set;for(const[a,d]of s)d>1&&r.add(a);return r}function ve(e){return new Set(e.endpoints.map(s=>s.trim()).filter(Boolean))}function vs(e,s){const r=e.filter(o=>o.id!==s),a=e.find(o=>o.id===s)??null,d=new Map;for(const o of e)d.set(o.id,ve(o));const c=gs(d),m=new Set;for(const o of a?ve(a):[]){if(c.has(o))continue;const i=Ee(o),h=i?Ae(i.host):null;h&&m.add(h)}const l=o=>{const i=new Set;for(const h of ve(o)){if(c.has(h))continue;const g=Ee(h),j=g?Ae(g.host):null;j&&i.add(j)}return i},x=new Map,v=new Map;for(const o of r){const i=ks(o);if(i){x.set(i,[...x.get(i)??[],o.id]);continue}for(const h of l(o))v.set(h,[...v.get(h)??[],o.id])}const y=new Map(e.map((o,i)=>[o.id,i])),I=o=>[...o].sort((i,h)=>(y.get(i)??0)-(y.get(h)??0)),N=[];for(const[o,i]of x)N.push({prefix:o,tier:"declared",deviceIds:I(i),words:"declared"});for(const[o,i]of v)m.has(o)?N.push({prefix:o,tier:"shared",deviceIds:I(i),words:"shared with this device"}):i.length>1&&N.push({prefix:o,tier:"probable",deviceIds:I(i),words:"same prefix"});return N.sort((o,i)=>o.tier.localeCompare(i.tier)||o.prefix.localeCompare(i.prefix))}function ks(e){for(const s of e.memberships){const r=s.scope.trim();if(r)return r}return""}const _e={declared:0,shared:1,probable:2};function ws(e,s){const r=new Map;for(const d of e){let c=null;for(const l of d.deviceIds){const x=s.get(l);x!==void 0&&(c===null||x<c.slot)&&(c={id:l,slot:x})}if(c===null)continue;const m=r.get(c.id);m===void 0?r.set(c.id,{slot:c.slot,groups:[d]}):m.groups.push(d)}const a=d=>{let c=-1;for(const m of d.deviceIds){const l=s.get(m);l!==void 0&&l>c&&(c=l)}return c};return[...r.entries()].sort((d,c)=>d[1].slot-c[1].slot).map(([d,c])=>({deviceId:d,groups:c.groups.sort((m,l)=>a(l)-a(m)||_e[m.tier]-_e[l.tier]||m.prefix.localeCompare(l.prefix))}))}function js(e){return new Map(e.map(s=>[s.deviceId,s.groups.length]))}function ys(e){return`${e.tier==="declared"?e.prefix:bs(e.prefix)} · ${e.words}`}const Re=(e,s)=>e.deviceIds.map(r=>s.devices.get(r)).filter(r=>r!==void 0),Ns=({stacks:e,geometry:s})=>t.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute top-0 left-0",children:e.map(r=>{const a=r.groups.length,d=new Array(a).fill(0);let c=null;for(let l=a-1;l>=0;l-=1){const x=Re(r.groups[l],s),v=(x.length===0?0:Math.max(...x.map(y=>y.y+y.height)))+me;c=c===null?v:Math.max(v,c+be),d[l]=c}const m=s.devices.get(r.deviceId);return r.groups.map((l,x)=>{const v=Re(l,s);if(v.length===0)return null;const y=a-1-x,I=Math.min(...v.map(j=>j.x)),N=Math.max(...v.map(j=>j.x)),i=(m?.y??Math.min(...v.map(j=>j.y)))-me-St*y,h=l.tier==="declared",g=ys(l);return t.jsx("div",{"data-mesh-scope":`${l.tier}:${l.prefix}`,"data-mesh-scope-level":x,className:R("absolute rounded-lg",l.tier==="probable"?"border border-dashed border-hairline-strong":"border border-control"),style:{left:I-me-be*y,top:i,width:N+je-I+(me+be*y)*2,height:d[x]-i},children:t.jsx("span",{"data-mesh-scope-label":"",className:R("absolute bottom-full left-1 mb-0.5 whitespace-nowrap text-meta",l.tier==="probable"?"text-ink-dim":"text-ink-muted",h&&"font-medium"),children:g})},`${l.tier}:${l.prefix}`)})})}),$e=48,Le=1.25,Is=.0015,Cs=({graph:e,slots:s,nowSeconds:r,selectedDeviceId:a,sessions:d,sessionTotals:c,movingSessionId:m,canMove:l,onOpenDevice:x,onAskMove:v,onDropRefused:y,onShowAllSessions:I,summaryId:N})=>{const o=f.useRef(null),[i,h]=f.useState({width:0,height:0,clipWidth:0,clipHeight:0,left:0,top:0}),[g,j]=f.useState({k:1,tx:0,ty:0}),p=f.useRef(!1),C=f.useRef(!1),M=f.useRef(null),P=f.useMemo(()=>vs(e.devices,e.selfDeviceId),[e.devices,e.selfDeviceId]),S=f.useMemo(()=>ws(P,s.devices),[P,s]),D=f.useMemo(()=>Mt(s,js(S)),[s,S]),B=f.useMemo(()=>({selfDeviceId:e.selfDeviceId,devices:new Map(e.devices.map(n=>[n.id,n])),networks:new Map(e.networks.map(n=>[n.id,n]))}),[e]),[w,W]=f.useState(fe),te=f.useRef({kind:"ground"}),z=f.useCallback((n,u)=>{const b=document.elementFromPoint(n,u),A=b?.closest("[data-mesh-device]");if(A){const V=A.getAttribute("data-mesh-device");if(V)return{kind:"device",deviceId:V}}const O=b?.closest("[data-mesh-network]");if(O){const V=O.getAttribute("data-mesh-network");if(V)return{kind:"network",networkId:V}}return{kind:"ground"}},[]),L=f.useMemo(()=>w.kind!=="dragging"&&w.kind!=="settling"?null:pe(w.payload,w.target,B),[w,B]),se=f.useCallback(n=>{if(!L)return null;if(L.kind==="plan"){const u=w.kind==="dragging"||w.kind==="settling"?w.target:null;return u&&u.kind==="device"&&u.deviceId===n?"accept":null}if(L.kind==="refused"){const u=w.kind==="dragging"||w.kind==="settling"?w.target:null;return u&&u.kind==="device"&&u.deviceId===n?"refuse":null}return null},[L,w]),ne=f.useCallback((n,u)=>{if(!l||n.button!==0)return;C.current=!1;const b=u.locality==="local"?e.selfDeviceId??"":u.owner_device,A=B.devices.get(b),O={session:u,ownerDeviceId:b,ownerLabel:A?.label??u.owner_device_name};try{n.currentTarget.setPointerCapture(n.pointerId)}catch{}W(V=>Q(V,{kind:"press",payload:O,x:n.clientX,y:n.clientY,pointerId:n.pointerId}))},[l,B,e.selfDeviceId]),ie=n=>{if(w.kind==="pressing"||w.kind==="dragging"){const u=z(n.clientX,n.clientY);te.current=u,W(b=>Q(b,{kind:"move",x:n.clientX,y:n.clientY,target:u}));return}ce(n)},re=n=>{if(J(n),w.kind!=="pressing"&&w.kind!=="dragging")return;if(w.kind==="pressing"){W(b=>Q(b,{kind:"cancel"}));return}const u=pe(w.payload,w.target,B);C.current=!0,W(b=>Q(b,{kind:"release"})),u.kind==="plan"?v({plan:u.plan,alternatives:u.alternatives,risky:u.risky}):u.kind==="refused"&&y({code:u.code,sentence:u.sentence,remedy:u.remedy,plan:u.plan??null}),W(b=>Q(b,{kind:"settled"}))};f.useEffect(()=>()=>W(fe),[]);const Z=f.useCallback(()=>{j(De(D.bounds,i))},[D.bounds,i]);f.useEffect(()=>{const n=o.current;if(!n)return;const u=()=>{const A=n.getBoundingClientRect();h({width:A.width,height:A.height,clipWidth:n.clientWidth,clipHeight:n.clientHeight,left:A.left,top:A.top})};u();const b=new ResizeObserver(u);return b.observe(n),()=>b.disconnect()},[]),f.useEffect(()=>{p.current||i.width<=0||i.height<=0||(p.current=!0,j(De(D.bounds,i)))},[i,D.bounds]),f.useEffect(()=>{const n=M.current;if(M.current={width:i.width,height:i.height},!n||!p.current||i.width<=0||i.height<=0||i.width>=n.width&&i.height>=n.height||!a)return;const u=D.devices.get(a);u&&j(b=>{const A={width:i.clipWidth,height:i.clipHeight},O=Math.max(0,Math.min(A.width-D.bounds.width*b.k,A.height-D.bounds.height*b.k));return Dt(b,u,A,Math.min(At,O))})},[i,a,D]);const Y=w.kind==="dragging"?{x:w.x-i.left+12,y:w.y-i.top+12}:{x:0,y:0},X=L?Et(L):null,k=f.useRef(null),E=f.useRef(null),$=f.useRef(null),T=f.useRef(null),_=f.useCallback(()=>{$.current=null;const n=k.current,u=E.current;if(k.current=null,E.current=null,n){const b=T.current;if(!b)return;j({k:b.transform.k,tx:b.transform.tx+(n.x-b.x),ty:b.transform.ty+(n.y-b.y)});return}u&&j(b=>ge(b,{x:u.x,y:u.y},b.k*Math.exp(-u.deltaY*Is)))},[]),F=f.useCallback(()=>{$.current===null&&($.current=requestAnimationFrame(_))},[_]);f.useEffect(()=>()=>{$.current!==null&&cancelAnimationFrame($.current)},[]);const G=n=>{!(n.target===n.currentTarget)&&n.button!==1||n.button!==0&&n.button!==1||(T.current={x:n.clientX,y:n.clientY,transform:g},n.currentTarget.setPointerCapture(n.pointerId),n.preventDefault())},ce=n=>{T.current&&(k.current={x:n.clientX,y:n.clientY},F())},J=n=>{T.current&&(T.current=null,k.current=null,n.currentTarget.hasPointerCapture(n.pointerId)&&n.currentTarget.releasePointerCapture(n.pointerId))},q=f.useCallback(n=>{if(n.deltaY===0)return;n.preventDefault();const u=n.currentTarget.getBoundingClientRect();E.current={x:n.clientX-u.left,y:n.clientY-u.top,deltaY:n.deltaY},F()},[F]);f.useEffect(()=>{const n=o.current;if(n)return n.addEventListener("wheel",q,{passive:!1}),()=>n.removeEventListener("wheel",q)},[q]);const ue=n=>{const u=n.shiftKey?$e*4:$e;switch(n.key){case"Escape":if(w.kind!=="pressing"&&w.kind!=="dragging")return;n.preventDefault(),w.kind==="dragging"&&(C.current=!0),W(b=>Q(b,{kind:"cancel"}));return;case"0":n.preventDefault(),Z();return;case"+":case"=":n.preventDefault(),j(b=>ge(b,{x:i.width/2,y:i.height/2},b.k*Le));return;case"-":case"_":n.preventDefault(),j(b=>ge(b,{x:i.width/2,y:i.height/2},b.k/Le));return;case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"ArrowDown":{n.preventDefault();const b=n.key==="ArrowLeft"?u:n.key==="ArrowRight"?-u:0,A=n.key==="ArrowUp"?u:n.key==="ArrowDown"?-u:0;j(O=>({...O,tx:O.tx+b,ty:O.ty+A}));return}}};return t.jsxs("div",{ref:o,"data-mesh-canvas":"",role:"group","aria-labelledby":N,tabIndex:0,onPointerDown:G,onPointerMove:ie,onPointerUp:re,onPointerCancel:n=>{w.kind==="dragging"&&(C.current=!0),W(u=>Q(u,{kind:"cancel"})),J(n)},"data-mesh-gesture":w.kind,onKeyDown:ue,onDoubleClick:n=>{n.target===n.currentTarget&&Z()},className:R("relative min-h-0 flex-1 overflow-hidden rounded-lg border border-hairline bg-sunken","[touch-action:none]","cursor-grab active:cursor-grabbing","focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-[-2px]"),children:[t.jsx("div",{"data-mesh-ground":"","aria-hidden":"true",className:"mesh-ground pointer-events-none absolute inset-0",style:{backgroundPosition:`${g.tx}px ${g.ty}px`}}),t.jsxs("div",{"data-mesh-world":"",className:"absolute top-0 left-0",style:{transform:`translate3d(${g.tx}px, ${g.ty}px, 0) scale(${g.k})`,transformOrigin:"0 0",width:D.bounds.width,height:D.bounds.height},children:[t.jsx(Ns,{stacks:S,geometry:D}),t.jsx(ls,{edges:e.edges,geometry:D,selectedDeviceId:a}),t.jsx("ul",{"aria-label":"Networks",className:"m-0 list-none p-0",children:e.networks.map(n=>{const u=D.networks.get(n.id);return u?t.jsx(ps,{network:n,x:u.x,y:u.y,refused:L?.kind==="refused"&&w.kind==="dragging"&&w.target.kind==="network"&&w.target.networkId===n.id},n.id):null})}),t.jsx("ul",{"aria-label":"Devices",className:"m-0 list-none p-0",children:e.devices.map(n=>{const u=D.devices.get(n.id);return u?t.jsx(fs,{device:n,x:u.x,y:u.y,nowSeconds:r,selected:n.id===a,sessions:d.get(n.id)??{rows:[],shown:[],hidden:0},sessionTotal:c.get(n.id)??n.sessionCount??0,dropState:se(n.id),movingSessionId:m,draggedSessionId:rs(w),onOpen:x,onChipPointerDown:ne,onChipClick:()=>{if(C.current){C.current=!1;return}x(n.id)},onShowAllSessions:I},n.id):null})})]}),w.kind==="dragging"&&t.jsx("div",{"data-mesh-ghost":"","aria-hidden":"true",className:"pointer-events-none absolute z-10 max-w-40 truncate rounded-sm border border-ink-dim bg-surface px-1.5 py-0.5 text-meta text-ink",style:{left:Y.x,top:Y.y},children:w.payload.session.name||"untitled"}),w.kind==="dragging"&&X&&t.jsx("div",{"data-mesh-indicator":"",className:R("pointer-events-none absolute z-10 rounded-sm border bg-surface px-2 py-1 text-meta",L?.kind==="refused"?"border-warning text-warning":"border-control text-ink"),style:{left:Y.x,maxWidth:Math.max(160,i.width-Y.x-12),...Y.y>i.height*.6?{bottom:Math.max(12,i.height-Y.y+8)}:{top:Y.y+24}},children:X})]})};function Ss(e,s,r,a){const d=r.locality==="local"?s:r.owner_device,c=[];for(const m of e)if(m.id!==d){if(m.id===s){c.push({deviceId:m.id,label:a,verb:"Recall to this device",keepVerb:"Copy here, leave it there"});continue}c.push({deviceId:m.id,label:m.label,verb:`Move to ${m.label}`,keepVerb:`Copy to ${m.label}`})}return c}function Ms(e,s,r){return Ss(e.devices,e.selfDeviceId,s,r)}function Ue(e,s,r){const a=Ms(e,s,r),d={selfDeviceId:e.selfDeviceId,devices:new Map(e.devices.map(l=>[l.id,l])),networks:new Map(e.networks.map(l=>[l.id,l]))},c=s.locality==="local"?e.selfDeviceId??"":s.owner_device,m=d.devices.get(c);return a.map(l=>{const x=pe({session:s,ownerDeviceId:c,ownerLabel:m?.label??s.owner_device_name},{kind:"device",deviceId:l.deviceId},d);return{...l,refused:x.kind==="refused"&&x.code!=="busy"?x.sentence:null}})}const Ge=({session:e,destinations:s,disabled:r,onChoose:a,onOpenChange:d,trigger:c,triggerLabel:m})=>t.jsxs(tt,{onOpenChange:d,children:[t.jsx(st,{asChild:!0,children:t.jsx("button",{type:"button","aria-label":m,"data-mesh-session-menu":e.id,disabled:r||s.length===0,className:"rounded-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2 disabled:text-ink-disabled",children:c})}),t.jsxs(nt,{align:"start",className:"min-w-56",children:[t.jsx(at,{children:ee(e)}),t.jsx(Ce,{}),s.map(l=>t.jsx(Se,{"data-mesh-move-to":l.deviceId,disabled:!!l.refused,title:l.refused??void 0,onSelect:()=>a(l,!1),children:l.verb},l.deviceId)),t.jsx(Ce,{}),s.map(l=>t.jsx(Se,{"data-mesh-copy-to":l.deviceId,disabled:!!l.refused,title:l.refused??void 0,onSelect:()=>a(l,!0),children:l.keepVerb},`keep-${l.deviceId}`))]})]}),Ds=({device:e,sessions:s,sessionTotal:r,nowSeconds:a,destinationsFor:d,movingSessionId:c,canMove:m,canInvite:l,onClose:x,onMove:v,onShowInList:y,onInvite:I,onRemoveMember:N})=>{const o=oe(e);f.useEffect(()=>{const p=C=>{C.key!=="Escape"||C.defaultPrevented||C.target?.closest('[role="menu"],[role="dialog"]')||(document.querySelector(`[data-mesh-device-open="${e.id}"]`)?.focus(),x())};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[e.id,x]);const i=e.memberships.every(p=>!p.active),h=e.sessionCount===null?ke(null):`${e.sessionCount} ${ke(e.sessionCount)}`,g=e.suspect?He:[i?"revoked membership":h,de(o)].filter(Boolean).join(" · "),j=r>s.rows.length?`${s.rows.length} of ${r}`:`${s.rows.length}`;return t.jsxs("aside",{"aria-label":`${e.label} details`,"data-mesh-panel":e.id,className:"flex w-80 shrink-0 flex-col gap-3 overflow-y-auto rounded-md border border-hairline bg-surface p-4",children:[t.jsxs("header",{className:"flex flex-col gap-1",children:[t.jsx(U,{size:"sm",variant:"ghost",className:"w-fit self-end","data-mesh-panel-close":"",onClick:x,children:"Close"}),t.jsx("h2",{className:"text-body-sm text-ink",children:e.label}),t.jsxs("p",{className:"flex items-center gap-1.5 text-meta text-ink-muted",children:[e.suspect&&t.jsx(ye,{"aria-hidden":"true",className:"size-3.5 text-danger"}),!e.suspect&&o==="unanswered"&&t.jsx(et,{"aria-hidden":"true",className:"size-3.5 text-warning"}),g]})]}),t.jsx(ae,{}),t.jsxs("section",{className:"flex flex-col gap-2",children:[t.jsx("h3",{className:"text-meta text-ink-dim",children:"Memberships"}),t.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0",children:e.memberships.map(p=>t.jsxs("li",{className:"flex flex-col gap-1",children:[t.jsxs("span",{className:"flex items-center gap-2 text-body-sm text-ink",children:[t.jsx(we,{"aria-hidden":"true",className:"size-3.5 text-ink-muted"}),p.networkName]}),t.jsxs("span",{className:"text-meta text-ink-dim",children:[p.role||"member",p.capabilities.length>0?` · ${p.capabilities.join(", ")}`:"",p.active?"":" · revoked"]}),l&&p.active&&t.jsxs(U,{size:"sm",variant:"ghost",className:"w-fit","data-mesh-remove-member":`${p.networkId}:${e.id}`,onClick:()=>N(e,p.networkId),children:["Remove from ",p.networkName,"…"]})]},p.networkId))}),l&&t.jsx(U,{size:"sm",variant:"secondary",className:"w-fit","data-mesh-invite":e.id,onClick:()=>I(e),children:"Invite to a network…"})]}),t.jsx(ae,{}),t.jsxs("section",{className:"flex shrink-0 flex-col gap-2",children:[t.jsxs("h3",{className:"text-meta text-ink-dim",children:["Conversations ",t.jsxs("span",{className:"text-ink-disabled",children:["(",j,")"]})]}),s.rows.length===0?t.jsx("p",{className:"text-meta text-ink-dim",children:e.sessionCount===null?"This device did not report its conversations.":"No conversations here."}):t.jsx("ul",{className:"m-0 flex list-none flex-col gap-1 p-0",children:s.rows.map(p=>t.jsxs("li",{"data-mesh-panel-session":p.id,className:R("flex items-center gap-2 rounded-sm px-2 py-1","border border-hairline bg-elevated",c===p.id&&"border-control"),children:[t.jsx("span",{className:"min-w-0 flex-1 truncate text-body-sm text-ink",title:ee(p),children:ee(p)}),t.jsx("span",{className:"shrink-0 text-meta text-ink-dim",children:Fe(p,e.label,oe(e))}),c===p.id?t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:"moving…"}):t.jsx(Ge,{session:p,destinations:d(p),disabled:!m,onChoose:(C,M)=>v(p,C,M),trigger:t.jsx(Oe,{"aria-hidden":"true",className:"size-4"}),triggerLabel:`Move ${ee(p)}`})]},p.id))})]}),t.jsx(ae,{}),t.jsxs("section",{className:"flex flex-col gap-2",children:[t.jsx("h3",{className:"text-meta text-ink-dim",children:"Network addresses"}),e.endpoints.length===0?t.jsx("p",{className:"text-meta text-ink-dim",children:"No address published."}):t.jsx("ul",{className:"m-0 flex list-none flex-col gap-1 p-0",children:e.endpoints.map(p=>t.jsxs("li",{className:"flex items-baseline justify-between gap-2",children:[t.jsx("span",{className:"min-w-0 truncate font-mono text-body-sm text-ink",children:p}),t.jsx("span",{className:"shrink-0 text-meta text-ink-dim",children:"advertised"})]},p))})]}),t.jsx(ae,{}),t.jsxs("section",{className:"flex flex-col gap-2",children:[t.jsx("h3",{className:"text-meta text-ink-dim",children:"Status"}),t.jsxs("dl",{className:"m-0 flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[t.jsx("dt",{className:"text-meta text-ink-dim",children:"Reach"}),t.jsx("dd",{className:"m-0 text-body-sm text-ink",children:de(o)})]}),t.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[t.jsx("dt",{className:"text-meta text-ink-dim",children:"Last status frame"}),t.jsx("dd",{className:"m-0 text-body-sm text-ink",children:e.lastSeenAt===null?"never":_t(a-e.lastSeenAt)})]})]}),e.reason&&t.jsx("p",{className:"text-meta text-warning",children:e.reason})]}),t.jsx(ae,{}),t.jsx(U,{size:"sm",variant:"ghost",className:"w-fit","data-mesh-show-in-list":e.id,onClick:()=>y(e.id),children:"Show in list"})]})},Es=["name","chats","state"],As={name:"Name",chats:"Conversations",state:"State"},Pe={suspect:0,unreachable:1,self:2,reachable:3};function _s(e,s){const r=[...e];switch(s){case"chats":return r.sort((a,d)=>(d.sessionCount??-1)-(a.sessionCount??-1)||a.label.localeCompare(d.label)),r;case"state":return r.sort((a,d)=>Pe[a.state]-Pe[d.state]||a.label.localeCompare(d.label)),r;default:return r.sort((a,d)=>a.label.localeCompare(d.label))}}const Te=8;function Rs(e,s){if(e.locality==="local")return e.live_state||"here";const r=e.owner_device_name||s,a=e.live_state?` · ${e.live_state}`:"";return e.reachable?`on ${r}${a}`:`on ${r} (not answering)`}const $s=({graph:e,nowSeconds:s,selectedDeviceId:r,sessions:a,selfLabel:d,canMove:c,onSelect:m,onMove:l,onInvite:x,onRemove:v})=>{const[y,I]=f.useState("name"),N=f.useMemo(()=>e.networks.map(o=>({network:o,members:_s(e.devices.filter(i=>i.memberships.some(h=>h.networkId===o.id)),y)})),[e,y]);return t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto pr-1",children:[t.jsxs("fieldset",{className:"m-0 w-fit border-0 p-0",children:[t.jsx("legend",{className:"sr-only",children:"Sort devices by"}),t.jsx("div",{className:"flex gap-0.5 rounded-md bg-sunken p-0.5",children:Es.map(o=>t.jsx("button",{type:"button","aria-pressed":y===o,onClick:()=>I(o),className:R("h-6 rounded-sm px-3 text-body-sm text-ink-muted transition-colors duration-fast ease-out-quart","hover:text-ink","focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2",y===o&&"bg-surface text-ink"),children:As[o]},o))})]}),N.map(({network:o,members:i})=>t.jsxs("section",{"data-mesh-network-group":o.id,className:"flex flex-col gap-2",children:[t.jsxs("h2",{className:"flex flex-wrap items-baseline gap-2 text-body-sm text-ink",title:`epoch ${o.epoch}`,children:[o.label,t.jsxs("span",{className:"text-meta text-ink-dim",children:[o.trust," · ",o.memberCount," ",o.memberCount===1?"device":"devices",o.revokedCount>0?` · ${o.revokedCount} revoked`:""]})]}),t.jsx("ul",{className:"m-0 flex list-none flex-col gap-1 p-0",children:i.map(h=>{const g=h.memberships.find(S=>S.networkId===o.id),j=h.id===r,p=a.get(h.id),C=p?.rows??[],M=p?Be(p,h.sessionCount):h.sessionCount??0,P=oe(h);return t.jsxs("li",{"data-mesh-device-row":h.id,"data-mesh-state":h.state,"aria-current":j?"true":void 0,className:R("flex flex-col gap-1 rounded-md px-3 py-2","border border-hairline bg-surface",j&&"border-ink bg-row-selected"),children:[t.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-3 gap-y-1",children:[t.jsx("button",{type:"button","data-mesh-device-open":h.id,onClick:()=>m(h.id),className:R("min-w-0 flex-1 truncate text-left text-body-sm text-ink","hover:text-ink-muted","focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2"),children:h.label}),t.jsxs("span",{className:R("flex shrink-0 items-center gap-1 text-meta",We[P]),"data-mesh-reach":P,children:[h.suspect&&t.jsx(ye,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-danger"}),h.suspect?de(P):ze(h,s),h.suspect&&t.jsx("span",{className:"shrink-0 rounded-sm border border-danger px-1 text-danger",children:He})]}),t.jsxs("span",{className:"shrink-0 text-meta text-ink-dim",children:[g?.role?`${g.role} · `:"",g&&!g.active?"revoked":"member"]})]}),C.length>0?t.jsxs(t.Fragment,{children:[t.jsx(ae,{className:"my-1"}),t.jsx("ul",{className:"m-0 flex list-none flex-col gap-0.5 p-0",children:C.slice(0,Te).map(S=>t.jsxs("li",{"data-mesh-row-session":S.id,className:"flex items-center gap-2 py-0.5",children:[t.jsx("span",{className:"min-w-0 flex-1 truncate text-meta text-ink-muted",children:S.name||S.id}),t.jsx("span",{className:"shrink-0 text-meta text-ink-dim",children:Rs(S,d)}),t.jsx(Ge,{session:S,destinations:Ue(e,S,d),disabled:!c,onChoose:(D,B)=>l(S,D,B),trigger:t.jsx(Oe,{"aria-hidden":"true",className:"size-3.5"}),triggerLabel:`Move ${S.name||S.id}`})]},S.id))}),M>C.slice(0,Te).length&&t.jsx("button",{type:"button",onClick:()=>m(h.id),className:"w-fit text-meta text-ink-dim hover:text-ink",children:`show all ${M} in the panel`})]}):t.jsx("span",{className:"text-meta text-ink-dim",children:M===0?"no conversations":M===1?"1 conversation":`${M} conversations`}),(g?.active||h.state!=="self")&&t.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[t.jsx(U,{size:"sm",variant:"ghost","data-mesh-invite":h.id,onClick:()=>x({deviceId:h.id,deviceLabel:h.label}),children:"Invite to a network…"}),g?.active&&t.jsxs(U,{size:"sm",variant:"ghost","data-mesh-remove-member":`${o.id}:${h.id}`,onClick:()=>v({networkId:o.id,networkLabel:o.label,deviceId:h.id,deviceLabel:h.label}),children:["Remove from ",o.label,"…"]})]})]},h.id)})})]},o.id)),e.unmatchedPeers.length>0&&t.jsxs("p",{className:"text-meta text-warning",children:[e.unmatchedPeers.length," ",e.unmatchedPeers.length===1?"device":"devices"," answered the peer read but is in no network this app can name."]})]})},Ls=["canvas","list"],Ps={canvas:"Canvas",list:"List"},Ts=({state:e,graph:s,nowSeconds:r,checking:a,staleError:d,onRetry:c,approvals:m,sessions:l,sessionError:x,selfLabel:v,movingSessionId:y,canMove:I,pendingMove:N,onAskMove:o,onDropRefused:i,onChooseMove:h,onCancelMove:g,moveBusy:j,moveReport:p,onDismissReport:C,onWaitForIdle:M,onUndoCopy:P,invite:S,onOpenInvite:D,onInvite:B,onCloseInvite:w,inviteBusy:W,inviteReceipt:te,inviteRefusal:z,remove:L,onOpenRemove:se,onRemove:ne,onCloseRemove:ie,removeBusy:re,removeRefusal:Z,removed:Y})=>{const[X,k]=f.useState("canvas"),[E,$]=f.useState(null),T=s?Rt(s):"",_="mesh-summary",F=$t(s),G=Lt(s,l,s?.selfDeviceId??null),ce=f.useMemo(()=>{const n=new Map;for(const u of s?.devices??[]){const b=G.byDevice.get(u.id);n.set(u.id,b?Be(b,u.sessionCount):u.sessionCount??0)}return n},[s,G]),J=f.useCallback(n=>{$(n)},[]),q=s?s.devices.find(n=>n.id===E)??null:null,ue=f.useCallback((n,u,b)=>{if(!s)return null;const A={selfDeviceId:s.selfDeviceId,devices:new Map(s.devices.map(K=>[K.id,K])),networks:new Map(s.networks.map(K=>[K.id,K]))},O=n.locality==="local"?s.selfDeviceId??"":n.owner_device,V=A.devices.get(O),H=pe({session:n,ownerDeviceId:O,ownerLabel:V?.label??n.owner_device_name},{kind:"device",deviceId:u.deviceId},A);if(H.kind==="refused")return i({code:H.code,sentence:H.sentence,remedy:H.remedy,plan:H.plan??null}),null;if(H.kind==="none")return null;const Ne=b?H.alternatives.find(K=>K.keep)??H.plan:H.plan,Ve=[H.plan,...H.alternatives].filter(K=>K.keep!==Ne.keep),Ke={plan:Ne,alternatives:Ve,risky:H.risky};o(Ke)},[s,o,i]);return t.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-6 overflow-y-auto p-6",children:[t.jsx(Qe,{title:"Mesh",icon:we,subtitle:"Devices this app is paired with, and the networks that hold them.",children:t.jsxs("div",{className:"flex items-center gap-4",children:[a&&t.jsx("output",{className:"text-meta text-ink-dim",children:"checking…"}),(e.kind==="ready"||e.kind==="loading")&&t.jsxs("fieldset",{className:"m-0 w-fit border-0 p-0",children:[t.jsx("legend",{className:"sr-only",children:"Presentation"}),t.jsx("div",{className:"flex gap-0.5 rounded-md bg-sunken p-0.5",children:Ls.map(n=>t.jsx("button",{type:"button","aria-pressed":X===n,disabled:e.kind!=="ready",onClick:()=>k(n),className:R("h-6 rounded-sm px-3 text-body-sm text-ink-muted transition-colors duration-fast ease-out-quart","hover:text-ink","focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2","disabled:text-ink-dim disabled:hover:text-ink-dim",X===n&&"bg-surface text-ink"),children:Ps[n]},n))})]})]})}),t.jsx(ns,{rows:m.rows,error:m.error,pending:m.pending,refusal:m.decisionRefusal,onDecide:m.onDecide,onRetry:m.onRetry,nowSeconds:m.nowSeconds,networkNames:new Map((s?.networks??[]).map(n=>[n.id,n.label]))}),e.kind==="loading"&&t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-3",children:[t.jsx(Me,{className:"h-4 w-64"}),t.jsx(Me,{className:"min-h-40 w-full flex-1"})]}),e.kind==="error"&&t.jsxs(he,{variant:"warning",className:"flex-col items-start gap-2",children:[t.jsx("p",{children:e.message}),t.jsx(U,{variant:"secondary",size:"sm",onClick:c,className:"w-fit",children:"Ask again"})]}),e.kind==="empty"&&t.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center rounded-lg border border-hairline bg-surface p-6",children:t.jsxs("div",{className:"flex flex-col items-start gap-3",children:[t.jsx("h2",{className:"text-heading text-ink",children:"No network on this device"}),t.jsx("p",{className:"max-w-140 text-body-sm text-ink-muted",children:"This device is not in any network, so there is no mesh to draw. Create one on this machine:"}),t.jsx("code",{className:"rounded-sm bg-sunken px-2 py-1 font-mono text-meta text-ink",children:"lop network init <name>"}),t.jsx("p",{className:"text-meta text-ink-dim",children:"A network appears here once this device has joined one."})]})}),e.kind==="ready"&&s&&t.jsx(t.Fragment,{children:t.jsxs("div",{className:"flex min-h-[22rem] flex-1 gap-4",children:[t.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-3",children:[t.jsx("p",{id:_,className:"text-meta text-ink-muted","data-mesh-summary":"",children:T}),d&&t.jsx(he,{variant:"warning",children:t.jsx("p",{children:d})}),x&&t.jsx(he,{variant:"warning",children:t.jsx("p",{children:x})}),p&&t.jsx(Pt,{receipt:p.kind==="moved"?{verb:p.verb,detail:p.detail,undo:p.undo}:null,refusal:p.kind==="refused"?p.refusal:null,canWait:p.kind==="refused"&&p.plan!==null,onWait:M,onRecheck:c,onUndo:P,onDismiss:C,pending:j}),X==="canvas"?t.jsx(Cs,{graph:s,slots:F,nowSeconds:r,selectedDeviceId:E,sessions:G.byDevice,sessionTotals:ce,movingSessionId:y,canMove:I,onOpenDevice:J,onAskMove:o,onDropRefused:i,onShowAllSessions:J,summaryId:_}):t.jsx($s,{graph:s,nowSeconds:r,selectedDeviceId:E,sessions:G.byDevice,selfLabel:v,canMove:I,onSelect:J,onMove:ue,onInvite:D,onRemove:se})]}),q&&t.jsx(Ds,{device:q,sessions:G.byDevice.get(q.id)??{rows:[],shown:[],hidden:0},sessionTotal:ce.get(q.id)??0,nowSeconds:r,canMove:I,canInvite:e.kind==="ready",movingSessionId:y,destinationsFor:n=>Ue(s,n,v),onClose:()=>$(null),onMove:ue,onInvite:n=>D({deviceId:n.id,deviceLabel:n.label}),onRemoveMember:(n,u)=>{const b=s.networks.find(A=>A.id===u);se({networkId:u,networkLabel:b?.label??u,deviceId:n.id,deviceLabel:n.label})},onShowInList:n=>{J(n),k("list")}})]})}),t.jsx(Tt,{open:N!==null,plan:N?.plan??Os,alternatives:N?.alternatives??[],risky:N?.risky??!1,busy:j,onCancel:g,onChoose:h}),S&&t.jsx(Ot,{open:S.open,options:S.options,deviceId:S.deviceId,deviceLabel:S.deviceLabel,onClose:w,onInvite:B,pending:W,receipt:te,refusal:z}),L&&t.jsx(Wt,{open:L.open,networkLabel:L.networkLabel,deviceLabel:L.deviceLabel,onClose:ie,onConfirm:ne,pending:re,refusal:Z,removed:Y})]})},Os={sessionId:"",to:"",keep:!1,verb:"",waitS:0,lost:null},Vs=()=>{const e=qe(),s=xe(e.data,"peers")==="enabled",r=xe(e.data,"session_transfer")==="enabled",a=zt(s),d=Ht(s),c=Bt(s),m=f.useMemo(()=>({peers:a,networks:d}),[a,d]),l=Yt(m),x=Ft(m),v=Ut(),y=xe(e.data,"approvals")==="enabled",I=Gt(s&&y,{poll:!1}),N=Vt(),o=N.isError?{approvalId:N.variables?.approvalId??null,...Kt(N.error)}:null,i=f.useMemo(()=>Math.floor((I.dataUpdatedAt||Date.now())/1e3),[I.dataUpdatedAt]),h=Ze(k=>k.settlePlacement),g=Xt(),j=qt(),[p,C]=f.useState(null),[M,P]=f.useState(null),[S,D]=f.useState(null),[B,w]=f.useState(null),[W,te]=f.useState(null),[z,L]=f.useState(null),[se,ne]=f.useState(null),ie=f.useMemo(()=>{const k=Math.max(a.dataUpdatedAt,d.dataUpdatedAt);return Math.floor((k||Date.now())/1e3)},[a.dataUpdatedAt,d.dataUpdatedAt]),re=f.useCallback(()=>{a.refetch(),d.refetch(),c.refetch()},[a,d,c]),Z=f.useCallback((k,E)=>{C(null);const $={sessionId:k.sessionId,to:k.to,keep:k.keep,waitS:E??k.waitS};v.mutate($,{onSuccess:T=>{if(T.kind==="moved"){const{receipt:_}=T;h(k.sessionId,_);const F=_.locality==="local"?"this device":x?.devices.find(G=>G.id===_.owner_device)?.label??_.owner_device;P({kind:"moved",verb:_.mode==="keep"?"Copied":"Moved",detail:_.mode==="keep"?`${F} holds a copy as ${_.new_session_id.slice(-6)}; the original is still here.`:`${F} holds it now${_.source_retired?"; the copy here is gone":""}.`,undo:_.mode==="keep"?{sessionId:_.new_session_id,to:"local",keep:!1,verb:`Bring the copy back from ${F}`,waitS:0,lost:Zt(F,"this device")}:null});return}P({kind:"refused",refusal:T.refusal,plan:k})},onError:()=>{P({kind:"refused",refusal:{code:"move_failed",sentence:"The move could not be sent. Nothing here changed; the list has been read again.",status:null,unconfirmed:!1},plan:k})}})},[x,v,h]),Y=f.useMemo(()=>{if(!x)return[];const k=S?.deviceId,E=k?x.devices.find($=>$.id===k):void 0;return x.networks.filter($=>{if(!E)return!0;const T=E.memberships.find(_=>_.networkId===$.id);return!T||!T.active}).map($=>({id:$.id,label:$.label}))},[x,S]);if(!s)return t.jsx(Je,{to:"/chat",replace:!0});const X=l.kind==="ready"?a.error?le(a.error):d.error?le(d.error):null:null;return t.jsx(Ts,{state:l,graph:x,nowSeconds:ie,checking:a.isFetching||d.isFetching,staleError:X,onRetry:re,approvals:{rows:I.data??[],error:I.isError?Jt(I.error):null,pending:N.isPending?N.variables??null:null,decisionRefusal:o,onDecide:(k,E)=>N.mutate({approvalId:k,decision:E}),onRetry:()=>void I.refetch(),nowSeconds:i},sessions:c.data??[],movingSessionId:v.isPending?v.variables?.sessionId??null:null,sessionError:c.isError?le(c.error):null,selfLabel:x?.devices.find(k=>k.state==="self")?.label??"this device",canMove:r,pendingMove:p,onAskMove:C,onDropRefused:k=>P({kind:"refused",refusal:{code:k.code,sentence:k.sentence,status:null,unconfirmed:!1},plan:k.plan}),onChooseMove:k=>Z(k),onCancelMove:()=>C(null),moveBusy:v.isPending,moveReport:M,onDismissReport:()=>P(null),onWaitForIdle:()=>{M?.kind!=="refused"||!M.plan||Z(M.plan,Ws)},onUndoCopy:()=>{M?.kind!=="moved"||!M.undo||C({plan:M.undo,alternatives:[],risky:!1})},invite:S===null?null:{open:!0,deviceId:S.deviceId,deviceLabel:S.deviceLabel,options:Y},onOpenInvite:k=>{w(null),te(null),D(k)},onInvite:k=>{g.mutate(k,{onSuccess:E=>w(E),onError:E=>te({code:"invite_refused",sentence:le(E),status:null,unconfirmed:!1})})},onCloseInvite:()=>D(null),inviteBusy:g.isPending,inviteReceipt:B,inviteRefusal:W,remove:z===null?null:{open:!0,networkId:z.networkId,networkLabel:z.networkLabel,deviceId:z.deviceId,deviceLabel:z.deviceLabel},onOpenRemove:k=>{ne(null),L(k)},onRemove:k=>{z&&j.mutate({networkId:z.networkId,deviceId:z.deviceId,confirm:k},{onSuccess:E=>ne(E)})},onCloseRemove:()=>L(null),removeBusy:j.isPending,removeRefusal:j.isError?{code:"remove_refused",sentence:le(j.error),status:null,unconfirmed:!1}:null,removed:se})},Ws=300;export{Vs as MeshPage,Ts as MeshSurface,Vs as default};