local-operator-ui 0.36.4 → 0.36.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/main/index.js +3915 -150
- package/out/preload/index.js +120 -0
- package/out/renderer/assets/{_basePickBy-DQ6BzkJm.js → _basePickBy-B0B_HryP.js} +1 -1
- package/out/renderer/assets/{_baseUniq-D4Pzw8OZ.js → _baseUniq-BC6WfZEZ.js} +1 -1
- package/out/renderer/assets/{agent-details-page-vUtr6XRL.js → agent-details-page-CIKeI8ax.js} +2 -2
- package/out/renderer/assets/{agent-hub-page-DLfJB8ns.js → agent-hub-page-NKE7fJK1.js} +2 -7
- package/out/renderer/assets/agents-page-BIRTx9kB.js +7 -0
- package/out/renderer/assets/{arc-BvXLfjiv.js → arc-DyL52bz_.js} +1 -1
- package/out/renderer/assets/{architectureDiagram-IEHRJDOE-DGO7ixLg.js → architectureDiagram-IEHRJDOE-OQsI3Nan.js} +1 -1
- package/out/renderer/assets/{arrow-up-D8Tgt51O.js → arrow-up-BpuHf_sB.js} +1 -1
- package/out/renderer/assets/{blockDiagram-JOT3LUYC-Bpj3zFYQ.js → blockDiagram-JOT3LUYC-CS1fz58m.js} +1 -1
- package/out/renderer/assets/{book-open-DeWHPw1t.js → book-open-BiI_r4jM.js} +1 -1
- package/out/renderer/assets/browser-page-CvUjgYjV.js +1 -0
- package/out/renderer/assets/{browser-webauthn-prompt-CLrsocAn.js → browser-webauthn-prompt-ja8N1ehh.js} +1 -1
- package/out/renderer/assets/building-2-Dar5h3t0.js +6 -0
- package/out/renderer/assets/{c4Diagram-VJAJSXHY-tA5p19nS.js → c4Diagram-VJAJSXHY-C6RZIvJP.js} +1 -1
- package/out/renderer/assets/channel-Ca9itbEI.js +1 -0
- package/out/renderer/assets/{chunk-4BMEZGHF-CAtpoCnM.js → chunk-4BMEZGHF-Cpn-cLXo.js} +1 -1
- package/out/renderer/assets/{chunk-A2AXSNBT-CYHy7Mvk.js → chunk-A2AXSNBT-S8Vffyme.js} +1 -1
- package/out/renderer/assets/{chunk-AEK57VVT-B2bXanTe.js → chunk-AEK57VVT-K1GcoFUy.js} +1 -1
- package/out/renderer/assets/{chunk-D6G4REZN-DfhdrNKB.js → chunk-D6G4REZN-CyqTe7_6.js} +1 -1
- package/out/renderer/assets/{chunk-RZ5BOZE2-BNdcLGHR.js → chunk-RZ5BOZE2-QWUc1JND.js} +1 -1
- package/out/renderer/assets/{chunk-XZIHB7SX-Caa_mRlB.js → chunk-XZIHB7SX-v3MFY8Qn.js} +1 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-BDSTmyjZ.js +1 -0
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-BDSTmyjZ.js +1 -0
- package/out/renderer/assets/clone-OIhREtCX.js +1 -0
- package/out/renderer/assets/{console-mirror-BnHVC7eO.js → console-mirror-BfM9Le8Y.js} +1 -1
- package/out/renderer/assets/{consoleCapture-BxykZlLx.js → consoleCapture-mqMk3W7y.js} +1 -1
- package/out/renderer/assets/{conversation-input-sync-CJiOSzCX.js → conversation-input-sync-BD8ZrQRq.js} +292 -262
- package/out/renderer/assets/{dagre-OKDRZEBW-pq4RiyaY.js → dagre-OKDRZEBW-D1-V7-Tj.js} +1 -1
- package/out/renderer/assets/{diagram-SSKATNLV-DnlzCGD2.js → diagram-SSKATNLV-D7jQdHV1.js} +1 -1
- package/out/renderer/assets/{diagram-VNBRO52H-DbJ2RTVe.js → diagram-VNBRO52H-DB_YZ9C8.js} +1 -1
- package/out/renderer/assets/{erDiagram-Q7BY3M3F-C56WVcbc.js → erDiagram-Q7BY3M3F-Blv-3W3v.js} +1 -1
- package/out/renderer/assets/{error-boundary-Tv9TlaZ8.js → error-boundary-Bpk2r3Ma.js} +2 -2
- package/out/renderer/assets/{flowDiagram-4HSFHLVR-CL1GRaaq.js → flowDiagram-4HSFHLVR-BTShSZPF.js} +1 -1
- package/out/renderer/assets/{ganttDiagram-APWFNJXF-CES2U6dP.js → ganttDiagram-APWFNJXF-_SXfULy-.js} +4 -4
- package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-CRyPEqXz.js → gitGraphDiagram-7IBYFJ6S-9E7LTj7S.js} +1 -1
- package/out/renderer/assets/{graph-Dtsej9jG.js → graph-BhaFec28.js} +1 -1
- package/out/renderer/assets/hash-CrDnkZ9w.js +6 -0
- package/out/renderer/assets/index-BgwxrPpP.css +1 -0
- package/out/renderer/assets/index-BuM037wD.js +824 -0
- package/out/renderer/assets/index-ByYW6G08.js +57 -0
- package/out/renderer/assets/{index-BsV4LVu3.js → index-ClCIwVJj.js} +1 -1
- package/out/renderer/assets/{index-DAoplO_Z.js → index-Shz25Z8Y.js} +1 -1
- package/out/renderer/assets/{infoDiagram-PH2N3AL5-BwRaN2ZH.js → infoDiagram-PH2N3AL5-CCsEuNFb.js} +1 -1
- package/out/renderer/assets/{installer-DjflOef5.js → installer-CJRb2tgb.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-U35MCT3I-CwrSuzth.js → journeyDiagram-U35MCT3I-LXUs-hfi.js} +1 -1
- package/out/renderer/assets/{kanban-definition-NDS4AKOZ-CjW130n-.js → kanban-definition-NDS4AKOZ-GLYV-Ku1.js} +1 -1
- package/out/renderer/assets/{layout-DnBx2qbk.js → layout-erSNWSH-.js} +1 -1
- package/out/renderer/assets/{legacy-agents-page-BiAHAYWZ.js → legacy-agents-page-CtFhdgCi.js} +7 -7
- package/out/renderer/assets/library-page-C6-aUarQ.js +157 -0
- package/out/renderer/assets/{mermaid.core-BHqZ2SZO.js → mermaid.core-BGROKqtx.js} +5 -5
- package/out/renderer/assets/mesh-page-CzSDWDfu.js +1 -0
- package/out/renderer/assets/{mindmap-definition-ALO5MXBD-Ca2VY79V.js → mindmap-definition-ALO5MXBD-C1KlK3C5.js} +1 -1
- package/out/renderer/assets/{mini-Dd3N58po.js → mini-Dnf6EgXd.js} +1 -1
- package/out/renderer/assets/{notebook-pen-CcH01r1l.js → notebook-pen-CTurnI5u.js} +1 -1
- package/out/renderer/assets/{org-access-WIuI99P6.js → org-access-DTXfQgW5.js} +1 -1
- package/out/renderer/assets/{org-surface-gate-BsP8aWCi.js → org-surface-gate-CDaexKo1.js} +1 -1
- package/out/renderer/assets/{page-header-ggruiR-O.js → page-header-Does21Km.js} +1 -1
- package/out/renderer/assets/{pieDiagram-IB7DONF6-C7lP9J7V.js → pieDiagram-IB7DONF6-DaaMC8-4.js} +1 -1
- package/out/renderer/assets/{projects-page-BIRVv4yi.js → projects-page-Bw0c4vc_.js} +6 -6
- package/out/renderer/assets/publication-validation-MxGQJEQj.js +1 -0
- package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-CPMEK8EO.js → quadrantDiagram-7GDLP6J5-BVFqf3uw.js} +1 -1
- package/out/renderer/assets/{radar-MK3ICKWK-sbfBaJo0.js → radar-MK3ICKWK-BbBjm1y3.js} +1 -1
- package/out/renderer/assets/{radient-auth-buttons-C0ljZy4O.js → radient-auth-buttons-BeDvFHK7.js} +1 -1
- package/out/renderer/assets/{requirementDiagram-KVF5MWMF-S2rhrmTH.js → requirementDiagram-KVF5MWMF-luASPwgm.js} +1 -1
- package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-sNpc3Wfn.js → sankeyDiagram-QLVOVGJD-DJ-Xk1mH.js} +1 -1
- package/out/renderer/assets/{schedules-page-DbZSRb3g.js → schedules-page-D7XfeTME.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-Cv-47OeQ.js → sequenceDiagram-X6HHIX6F-C9vBEHGW.js} +1 -1
- package/out/renderer/assets/{settings-page-DH9sXfEW.js → settings-page-BubJ0gmV.js} +8 -8
- package/out/renderer/assets/smartart-DCxfy3Tv.js +1 -0
- package/out/renderer/assets/{stateDiagram-DGXRK772-DIBWf8qm.js → stateDiagram-DGXRK772-DCbA594R.js} +1 -1
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-P9yjg6o0.js +1 -0
- package/out/renderer/assets/{tags-input-chips-B4_gHGYO.js → tags-input-chips-BSg2kzIn.js} +1 -1
- package/out/renderer/assets/team-bridge-page-DshgiIxJ.js +1 -0
- package/out/renderer/assets/{timeline-definition-BDJGKUSR-CE8q2f33.js → timeline-definition-BDJGKUSR-AlhVX480.js} +1 -1
- package/out/renderer/assets/ui-preferences-store-CAt3Nng3.js +1 -0
- package/out/renderer/assets/{use-download-agent-mutation-LdjExo2g.js → use-download-agent-mutation-DmirSifx.js} +4 -4
- package/out/renderer/assets/{use-memberships-query-DcD9UeVY.js → use-memberships-query-fzcoT-92.js} +1 -1
- package/out/renderer/assets/{use-session-snapshot-Cqye2iDz.js → use-session-snapshot-DQQ3D8W6.js} +1 -1
- package/out/renderer/assets/{xychartDiagram-VJFVF3MP-DlbgdRgT.js → xychartDiagram-VJFVF3MP-djayCUFZ.js} +1 -1
- package/out/renderer/console-capture.html +5 -5
- package/out/renderer/index.html +7 -7
- package/out/renderer/installer.html +4 -4
- package/out/renderer/mini.html +7 -7
- package/package.json +2 -2
- package/out/renderer/assets/agents-page-B-PHMFxF.js +0 -7
- package/out/renderer/assets/browser-page-DAQis2Rt.js +0 -1
- package/out/renderer/assets/channel-CG3c-hsB.js +0 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-BGWu-T14.js +0 -1
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-BGWu-T14.js +0 -1
- package/out/renderer/assets/clone-UwOnPjS7.js +0 -1
- package/out/renderer/assets/index-D0l2JJ6w.js +0 -829
- package/out/renderer/assets/index-hX_aZwq0.js +0 -57
- package/out/renderer/assets/index-vPvXCaIy.css +0 -1
- package/out/renderer/assets/library-page-BGmng_P-.js +0 -162
- package/out/renderer/assets/mesh-page-1yPLxWRO.js +0 -1
- package/out/renderer/assets/publication-validation-C73bqNja.js +0 -1
- package/out/renderer/assets/smartart-C2eRO4WK.js +0 -1
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-DBPLNjJl.js +0 -1
- package/out/renderer/assets/ui-preferences-store-C6eXGzFs.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as g,j as t,t as a,c as L}from"./index-hX_aZwq0.js";import{aT as He,aU as ye,aV as et,aW as qe,a as tt,aX as be,ar as Ce,aY as st}from"./conversation-input-sync-CJiOSzCX.js";import{P as nt}from"./page-header-ggruiR-O.js";import{u as W,a as G,A as fe,q as at,i as re,r as it,s as rt,t as lt,v as ot,w as Se,x as Me,l as Ee}from"./error-boundary-Tv9TlaZ8.js";import{i as ce,j as dt,k as ct,l as ut,m as mt,o as ht,p as pt,q as xt,s as ft,t as gt,v as vt,x as bt,y as _t,N as kt,z as je,C as wt,D as ue,E as yt,F as jt,G as Nt,H as Ne,I as Fe,R as It,J as me,K as Ye,L as Be,M as Ct,O as xe,Q as _e,T as St,U as Mt,V as ge,W as De,X as Et,Y as Dt,Z as ke,_ as Rt,$ as Ue,a0 as At,a1 as Ge,a2 as Lt,a3 as Pt,a4 as Tt,a5 as Ot,a6 as $t,a7 as zt,a8 as Wt,a9 as Ht,aa as qt,ab as Ft,ac as Yt,ad as Bt,ae as Ut,af as Gt,ag as Vt,ah as Kt,ai as Xt,aj as Zt,ak as Jt,al as de,am as Qt}from"./index-D0l2JJ6w.js";import"./ui-preferences-store-C6eXGzFs.js";import"./console-mirror-BnHVC7eO.js";function es(e){return e==="failed"?"text-danger":ce(e)?"text-ink-muted":"text-ink-dim"}function ts(e){return e==="failed"?a("ui.mesh.mesh_approvals_tray.abandon"):a("ui.mesh.mesh_approvals_tray.stop")}function ss(e){switch(e){case"requested":return[{term:a("ui.mesh.mesh_approvals_tray.signing"),text:a("ui.mesh.mesh_approvals_tray.approving_signs_with_this_machine_s_operator")}];case"approved":return[{term:a("ui.mesh.mesh_approvals_tray.next"),text:a("ui.mesh.mesh_approvals_tray.an_agent_runs_the_install_and_connect")},{term:a("ui.mesh.mesh_approvals_tray.stop"),text:a("ui.mesh.mesh_approvals_tray.stopping_now_denies_the_request_nothing_has")}];case"connecting":return[{term:a("ui.mesh.mesh_approvals_tray.stop"),text:a("ui.mesh.mesh_approvals_tray.stopping_now_denies_the_request_the_runner")}];case"failed":return[{term:a("ui.mesh.mesh_approvals_tray.after_a_stop"),text:a("ui.mesh.mesh_approvals_tray.the_runner_stopped_before_it_finished_abandoning")}];default:return[]}}const ns=({rows:e,error:s,pending:r,refusal:i,onDecide:d,onRetry:u,nowSeconds:x,networkNames:l})=>{W();const v=r!==null,_=g.useMemo(()=>e.filter(h=>ce(h.state)),[e]),j=g.useMemo(()=>e.filter(h=>!ce(h.state)),[e]),[I,C]=g.useState(!1),o=g.useRef(null),c=g.useRef(null),f=g.useRef(null),N=(h,D)=>{D==="deny"&&_.some(S=>S.approvalId===h&&S.kind==="credential")&&(f.current={id:h,origin:document.activeElement,sawPending:!1}),d(h,D)};g.useLayoutEffect(()=>{const h=f.current;if(!h)return;if(r?.approvalId===h.id&&(h.sawPending=!0),i?.approvalId===h.id){f.current=null;return}const D=e.find(E=>E.approvalId===h.id);if(D?.state==="requested"){!r&&h.sawPending&&(f.current=null);return}if(D?.state==="denied"&&r||(f.current=null,D?.state!=="denied"||document.activeElement!==document.body&&document.activeElement!==h.origin))return;(_.length?o.current?.querySelector('[data-tour-tag="mesh-approval-controls"] button:not(:disabled)'):c.current?.querySelector("button"))?.focus({preventScroll:!0})},[e,r,i,_.length]);const k=j.some(h=>h.state==="failed"),p=j.filter(h=>h.state==="failed").length,M=i!==null&&e.some(h=>h.approvalId===i.approvalId&&(ce(h.state)||I));return _.length===0&&j.length===0&&!s&&!i?null:t.jsxs("section",{ref:o,"aria-label":a("ui.mesh.mesh_approvals_tray.approvals"),"data-tour-tag":"mesh-approvals-tray",className:"flex flex-col gap-3",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx(dt,{"aria-hidden":"true",className:"size-4 text-ink-muted"}),t.jsx("h2",{className:"text-body-sm text-ink",children:a("ui.mesh.mesh_approvals_tray.approvals")}),_.length>0&&t.jsx("span",{className:"text-meta text-ink-dim",children:a("ui.mesh.mesh_approvals_tray.waiting_count",{count:_.length})})]}),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(G,{variant:"secondary",size:"sm",onClick:u,children:a("ui.mesh.mesh_approvals_tray.ask_again")})]}),_.length>0&&t.jsx("ul",{className:"flex flex-col divide-y divide-hairline",children:_.map(h=>t.jsx(Re,{row:h,pending:r?.approvalId===h.approvalId?r:null,busy:v,refusal:i?.approvalId===h.approvalId?i:null,onDecide:N,nowSeconds:x,networkNames:l},h.approvalId))}),i&&!M&&t.jsx(Ve,{refusal:i}),j.length>0&&t.jsx("div",{ref:c,children:t.jsx(He,{open:I,onOpenChange:C,chevronClassName:"text-ink-dim",className:L(_.length>0&&"border-hairline border-t pt-3"),summary:t.jsxs("span",{className:"flex items-center gap-1.5 text-meta text-ink-muted",children:[a("ui.mesh.mesh_approvals_tray.settled_approvals"),t.jsxs("span",{className:"text-ink-dim",children:["(",j.length,")"]}),k&&t.jsx("span",{"aria-hidden":"true",className:"size-1.5 rounded-full bg-danger"}),p>0&&t.jsx("span",{className:"text-danger",children:a("ui.mesh.mesh_approvals_tray.failed_count",{count:p})})]}),children:t.jsx("ul",{className:"flex flex-col divide-y divide-hairline","data-tour-tag":"mesh-approvals-records",children:j.map(h=>t.jsx(Re,{row:h,pending:r?.approvalId===h.approvalId?r:null,busy:v,refusal:i?.approvalId===h.approvalId?i:null,onDecide:N,nowSeconds:x,networkNames:l},h.approvalId))})})})]})},Re=({row:e,pending:s,busy:r,refusal:i,onDecide:d,nowSeconds:u,networkNames:x})=>{W();const l=ce(e.state),v=ct(e),_=ut(e,x),j=mt(e,x),I=ht(e),C=pt(e),o=xt(e),c=ft(e.expiresAt,u),f=e.kind==="credential"||e.kind==="unknown",N=f||e.canApproveHere===!1,k=N?[]:ss(e.state),p=gt(e),M=vt(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("span",{className:L("text-meta",es(e.state)),children:e.kind==="credential"&&e.state==="approved"?a("ui.mesh.approval.approved_pending_apply"):bt(e.state)}),t.jsx("div",{className:"grow"}),l&&c&&t.jsx("span",{className:"text-meta text-ink-dim",children:e.kind==="credential"?a("ui.mesh.approval.request_window",{remaining:c}):c})]}),t.jsx("p",{className:"text-body-sm text-ink [overflow-wrap:anywhere]","data-tour-tag":"mesh-approval-summary",children:l?_:v}),!N&&e.state==="failed"&&t.jsx("p",{className:"text-meta text-ink-muted","data-tour-tag":"mesh-approval-stopped-note",children:a("ui.mesh.mesh_approvals_tray.the_runner_stopped_before_it_finished_it")}),l&&N&&t.jsx("p",{className:"text-meta text-ink-muted whitespace-pre-wrap [overflow-wrap:anywhere]","data-tour-tag":"mesh-approval-cli-remedy",children:e.approveRemedy||a("ui.mesh.approval.cli_review")}),e.kind==="credential"&&e.state==="approved"&&t.jsx("p",{className:"text-meta text-ink-muted","data-tour-tag":"mesh-approval-apply-hint",children:e.details?.length?a("ui.mesh.approval.approved_apply_hint"):a("ui.mesh.approval.approved_details_missing")}),(p||M)&&t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p&&t.jsx(G,{variant:"primary",size:"sm",disabled:r,onClick:()=>d(e.approvalId,"approve"),"data-tour-tag":"mesh-approval-approve",children:a("ui.mesh.mesh_approvals_tray.approve")}),M&&t.jsx(G,{variant:"ghost",size:"sm",disabled:r,onClick:()=>d(e.approvalId,"deny"),"data-tour-tag":l?"mesh-approval-deny":"mesh-approval-stop",children:l?a("ui.mesh.mesh_approvals_tray.deny"):ts(e.state)}),s&&t.jsx("span",{className:"text-meta text-ink-dim",children:s.decision==="approve"?a("ui.mesh.mesh_approvals_tray.waiting_for_the_signing_prompt"):a("ui.mesh.mesh_approvals_tray.writing_the_decision")})]}),t.jsxs(He,{chevronClassName:"text-ink-dim",summary:t.jsx("span",{className:"text-meta",children:a("ui.mesh.mesh_approvals_tray.details")}),children:[f&&(e.details?.length?t.jsx("ul",{className:"flex flex-col gap-1.5 text-meta text-ink-muted [overflow-wrap:anywhere]","data-tour-tag":"mesh-approval-server-details",children:e.details.map((h,D)=>t.jsx("li",{className:"whitespace-pre-wrap",children:h},`${D}:${h}`))}):t.jsx("p",{className:"text-meta text-ink-muted",children:a("ui.mesh.approval.details_unavailable")})),j.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-consequences",children:j.map(h=>t.jsxs(g.Fragment,{children:[t.jsx("dt",{className:"text-ink-muted",children:h.term}),t.jsx("dd",{children:h.consequence})]},h.term))}),(I||C)&&t.jsxs("p",{className:"text-meta text-ink-muted",children:[I&&t.jsx("span",{children:I}),I&&C&&t.jsx("span",{children:" · "}),C&&t.jsx("span",{className:"font-mono",children:C})]}),o&&t.jsx("p",{className:"text-meta text-ink-dim",children:o}),k.length>0&&t.jsx("dl",{className:"grid grid-cols-[max-content_1fr] gap-x-4 gap-y-0.5 text-meta","data-tour-tag":"mesh-approval-consequence",children:k.map(h=>t.jsxs(g.Fragment,{children:[t.jsx("dt",{className:"text-ink-muted",children:h.term}),t.jsx("dd",{className:"text-ink-muted",children:h.text})]},h.term))})]}),i&&t.jsx(Ve,{refusal:i})]})},Ve=({refusal:e})=>(W(),t.jsx(fe,{variant:"warning",className:"text-meta","data-tour-tag":"mesh-approval-refusal",children:t.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-2",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})]})})),as=4,ve={kind:"idle"};function is(e){switch(e.kind){case"dragging":case"settling":return e.payload.session.id;case"pressing":return null;default:return null}}function te(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))<as?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"?ve:e;case"cancel":case"settled":return ve;default:return e}}const rs=({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(i=>{const d=s.networks.get(i.networkId),u=s.devices.get(i.deviceId);if(!d||!u)return null;const x=r!==null&&i.deviceId===r;return t.jsx("path",{"data-mesh-edge":i.key,d:_t(d,u),fill:"none",strokeWidth:x?2:1.5,strokeDasharray:i.active?void 0:"4 4",className:x?"stroke-ink":"stroke-ink-dim"},i.key)})}),ls={self:"border-l-hairline",reached:"border-l-hairline",unanswered:"border-l-warning","not-attempted":"border-l-hairline",unknown:"border-l-hairline"};function os(e){return e.suspect?"border-l-danger":ls[ue(e)]}const ds={self:"ring-2 ring-accent",reachable:null,unreachable:null,suspect:null},cs={accept:"border-accent bg-accent-wash",refuse:"border-warning"};function us(e,s,r){return[e.label,Be(e,s),r].filter(Boolean).join(", ")}function se(e){return e.name.trim()||e.id.slice(-6)}function Ke(e,s,r){if(r!=="reached"&&r!=="self"){const i=me(r);return e.unreachable_reason?`${i} (${e.unreachable_reason})`:i}return e.live_state.trim()?e.live_state.trim():e.locality==="local"?a("ui.mesh.mesh_drop.on_this_device"):a("ui.mesh.mesh_node.on_device",{device:s})}const ms={resting:"border-l-2 border-l-hairline",attention:"border-l-2 border-l-warning"},hs=({network:e,x:s,y:r,refused:i})=>(W(),t.jsxs("li",{"data-mesh-network":e.id,"data-mesh-network-refused":i?"true":void 0,"data-glass-block":"",className:L("absolute flex items-center gap-2 rounded-md border bg-elevated px-3",i?"border-warning":"border-hairline"),style:{left:s,top:r,width:je,height:kt},children:[t.jsx(ye,{"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:a("ui.mesh.mesh_list.epoch",{epoch:e.epoch}),className:"block truncate text-meta text-ink-dim",children:[a("ui.mesh.mesh_graph.device_count",{count:e.memberCount}),e.revokedCount>0?a("ui.mesh.mesh_list.revoked_count",{count:e.revokedCount}):""]})]})]})),ps=({device:e,x:s,y:r,nowSeconds:i,selected:d,sessions:u,sessionTotal:x,dropState:l,movingSessionId:v,draggedSessionId:_,onOpen:j,onChipPointerDown:I,onChipClick:C,onShowAllSessions:o})=>{W();const{activity:c}=wt(e,u.rows),f=c==="working",N=us(e,i,f?"working":null),k=ue(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,"data-glass-block":"",className:L("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",os(e),ds[e.state],l&&cs[l]),style:{left:s,top:r,width:je,height:yt},children:[t.jsxs("button",{type:"button","data-mesh-device-open":e.id,"data-mesh-reach":k,"aria-label":N,title:Nt(e),onClick:()=>j(e.id),className:L("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:jt},children:[t.jsxs("span",{className:"flex w-full min-w-0 items-center gap-2",children:[t.jsx(et,{"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(Ne,{"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:L("min-w-0 truncate text-meta",e.sessionCount===null?"text-ink-dim":"text-ink-muted"),children:Fe(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[k]}),t.jsx("span",{className:L("shrink-0",Ye[k]),children:me(k)}),f&&t.jsx("span",{"data-mesh-working":"",className:"shrink-0 text-info",children:a("ui.mesh.mesh_node.working")}),e.memberships.length>1&&t.jsx("span",{className:"min-w-0 truncate text-ink-dim",children:a("ui.mesh.mesh_node.memberships",{count:e.memberships.length})})]})]}),t.jsxs("ul",{"aria-label":a("ui.mesh.mesh_node.conversations_on",{device:e.label}),className:L("m-0 flex h-6 list-none items-center gap-1 overflow-hidden px-3",l==="accept"&&"opacity-40"),children:[u.shown.map(p=>t.jsx(xs,{session:p,ownerLabel:e.label,ownerReach:k,ownerReachable:e.reachable,moving:v===p.id,dragging:_===p.id,onPointerDown:I,onClick:()=>C(p)},p.id)),u.hidden>0&&t.jsx("li",{className:"shrink-0",children:t.jsxs("button",{type:"button","data-mesh-more":e.id,onClick:()=>o(e.id),className:L("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:a("ui.mesh.mesh_node.shown_conversations",{shown:u.shown.length,total:x}),"aria-label":a("ui.mesh.mesh_node.show_all_conversations",{count:x}),children:["+",u.hidden]})})]})]})},xs=({session:e,ownerLabel:s,ownerReach:r,ownerReachable:i,moving:d,dragging:u,onPointerDown:x,onClick:l})=>{W();const v=Ke(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:a("ui.mesh.mesh_card.moving")})}):t.jsx("li",{className:"min-w-0 flex-1","data-mesh-session-item":e.id,"data-mesh-dragging":u?"true":void 0,children:t.jsx("button",{type:"button","data-mesh-session":e.id,style:{touchAction:"none"},title:`${se(e)} · ${v}`,"aria-label":a("ui.mesh.mesh_node.open_conversation",{conversation:se(e),fact:v,owner:s}),onPointerDown:_=>x(_,e),onClick:()=>l(e),className:L("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",ms[Ct(e,i)],u&&"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:se(e)})})})};function Ae(e){const s=e.trim();if(!s)return null;if(s.startsWith("[")){const i=s.indexOf("]");if(i<=1)return null;const d=s.slice(1,i),u=s.slice(i+1);if(!u)return{host:d,port:null};if(!u.startsWith(":"))return null;const x=Number(u.slice(1));return{host:d,port:Number.isInteger(x)?x:null}}const r=s.lastIndexOf(":");if(r>0){const i=s.slice(r+1);if(/^\d+$/.test(i))return{host:s.slice(0,r),port:Number(i)}}return{host:s,port:null}}function Le(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 fs(e){return`${e}.x`}function gs(e){const s=new Map;for(const i of e.values())for(const d of i)s.set(d,(s.get(d)??0)+1);const r=new Set;for(const[i,d]of s)d>1&&r.add(i);return r}function we(e){return new Set(e.endpoints.map(s=>s.trim()).filter(Boolean))}function vs(e,s){const r=e.filter(o=>o.id!==s),i=e.find(o=>o.id===s)??null,d=new Map;for(const o of e)d.set(o.id,we(o));const u=gs(d),x=new Set;for(const o of i?we(i):[]){if(u.has(o))continue;const c=Ae(o),f=c?Le(c.host):null;f&&x.add(f)}const l=o=>{const c=new Set;for(const f of we(o)){if(u.has(f))continue;const N=Ae(f),k=N?Le(N.host):null;k&&c.add(k)}return c},v=new Map,_=new Map;for(const o of r){const c=bs(o);if(c){v.set(c,[...v.get(c)??[],o.id]);continue}for(const f of l(o))_.set(f,[..._.get(f)??[],o.id])}const j=new Map(e.map((o,c)=>[o.id,c])),I=o=>[...o].sort((c,f)=>(j.get(c)??0)-(j.get(f)??0)),C=[];for(const[o,c]of v)C.push({prefix:o,tier:"declared",deviceIds:I(c),get words(){return a("ui.mesh.mesh_scope.declared")}});for(const[o,c]of _)x.has(o)?C.push({prefix:o,tier:"shared",deviceIds:I(c),get words(){return a("ui.mesh.mesh_scope.shared_with_this_device")}}):c.length>1&&C.push({prefix:o,tier:"probable",deviceIds:I(c),get words(){return a("ui.mesh.mesh_scope.same_prefix")}});return C.sort((o,c)=>o.tier.localeCompare(c.tier)||o.prefix.localeCompare(c.prefix))}function bs(e){for(const s of e.memberships){const r=s.scope.trim();if(r)return r}return""}const Pe={declared:0,shared:1,probable:2};function _s(e,s){const r=new Map;for(const d of e){let u=null;for(const l of d.deviceIds){const v=s.get(l);v!==void 0&&(u===null||v<u.slot)&&(u={id:l,slot:v})}if(u===null)continue;const x=r.get(u.id);x===void 0?r.set(u.id,{slot:u.slot,groups:[d]}):x.groups.push(d)}const i=d=>{let u=-1;for(const x of d.deviceIds){const l=s.get(x);l!==void 0&&l>u&&(u=l)}return u};return[...r.entries()].sort((d,u)=>d[1].slot-u[1].slot).map(([d,u])=>({deviceId:d,groups:u.groups.sort((x,l)=>i(l)-i(x)||Pe[x.tier]-Pe[l.tier]||x.prefix.localeCompare(l.prefix))}))}function ks(e){return new Map(e.map(s=>[s.deviceId,s.groups.length]))}function ws(e){return`${e.tier==="declared"?e.prefix:fs(e.prefix)} · ${e.words}`}const Te=(e,s)=>e.deviceIds.map(r=>s.devices.get(r)).filter(r=>r!==void 0),ys=({stacks:e,geometry:s})=>(W(),t.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute top-0 left-0",children:e.map(r=>{const i=r.groups.length,d=new Array(i).fill(0);let u=null;for(let l=i-1;l>=0;l-=1){const v=Te(r.groups[l],s),_=(v.length===0?0:Math.max(...v.map(j=>j.y+j.height)))+xe;u=u===null?_:Math.max(_,u+_e),d[l]=u}const x=s.devices.get(r.deviceId);return r.groups.map((l,v)=>{const _=Te(l,s);if(_.length===0)return null;const j=i-1-v,I=Math.min(..._.map(k=>k.x)),C=Math.max(..._.map(k=>k.x)),c=(x?.y??Math.min(..._.map(k=>k.y)))-xe-St*j,f=l.tier==="declared",N=ws(l);return t.jsx("div",{"data-mesh-scope":`${l.tier}:${l.prefix}`,"data-mesh-scope-level":v,className:L("absolute rounded-lg",l.tier==="probable"?"border border-dashed border-hairline-strong":"border border-control"),style:{left:I-xe-_e*j,top:c,width:C+je-I+(xe+_e*j)*2,height:d[v]-c},children:t.jsx("span",{"data-mesh-scope-label":"",className:L("absolute bottom-full left-1 mb-0.5 whitespace-nowrap text-meta",l.tier==="probable"?"text-ink-dim":"text-ink-muted",f&&"font-medium"),children:N})},`${l.tier}:${l.prefix}`)})})})),Oe=48,$e=1.25,js=.0015,Ns=({graph:e,slots:s,nowSeconds:r,selectedDeviceId:i,sessions:d,sessionTotals:u,movingSessionId:x,canMove:l,onOpenDevice:v,onAskMove:_,onDropRefused:j,onShowAllSessions:I,summaryId:C})=>{W();const o=g.useRef(null),[c,f]=g.useState({width:0,height:0,clipWidth:0,clipHeight:0,left:0,top:0}),[N,k]=g.useState({k:1,tx:0,ty:0}),p=g.useRef(!1),M=g.useRef(!1),h=g.useRef(null),D=g.useMemo(()=>vs(e.devices,e.selfDeviceId),[e.devices,e.selfDeviceId]),S=g.useMemo(()=>_s(D,s.devices),[D,s]),E=g.useMemo(()=>Mt(s,ks(S)),[s,S]),Y=g.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]),[y,H]=g.useState(ve),ne=g.useRef({kind:"ground"}),q=g.useCallback((n,m)=>{const b=document.elementFromPoint(n,m),A=b?.closest("[data-mesh-device]");if(A){const K=A.getAttribute("data-mesh-device");if(K)return{kind:"device",deviceId:K}}const z=b?.closest("[data-mesh-network]");if(z){const K=z.getAttribute("data-mesh-network");if(K)return{kind:"network",networkId:K}}return{kind:"ground"}},[]),O=g.useMemo(()=>y.kind!=="dragging"&&y.kind!=="settling"?null:ge(y.payload,y.target,Y),[y,Y]),ae=g.useCallback(n=>{if(!O)return null;if(O.kind==="plan"){const m=y.kind==="dragging"||y.kind==="settling"?y.target:null;return m&&m.kind==="device"&&m.deviceId===n?"accept":null}if(O.kind==="refused"){const m=y.kind==="dragging"||y.kind==="settling"?y.target:null;return m&&m.kind==="device"&&m.deviceId===n?"refuse":null}return null},[O,y]),ie=g.useCallback((n,m)=>{if(!l||n.button!==0)return;M.current=!1;const b=m.locality==="local"?e.selfDeviceId??"":m.owner_device,A=Y.devices.get(b),z={session:m,ownerDeviceId:b,ownerLabel:A?.label??m.owner_device_name};try{n.currentTarget.setPointerCapture(n.pointerId)}catch{}H(K=>te(K,{kind:"press",payload:z,x:n.clientX,y:n.clientY,pointerId:n.pointerId}))},[l,Y,e.selfDeviceId]),le=n=>{if(y.kind==="pressing"||y.kind==="dragging"){const m=q(n.clientX,n.clientY);ne.current=m,H(b=>te(b,{kind:"move",x:n.clientX,y:n.clientY,target:m}));return}he(n)},oe=n=>{if(ee(n),y.kind!=="pressing"&&y.kind!=="dragging")return;if(y.kind==="pressing"){H(b=>te(b,{kind:"cancel"}));return}const m=ge(y.payload,y.target,Y);M.current=!0,H(b=>te(b,{kind:"release"})),m.kind==="plan"?_({plan:m.plan,alternatives:m.alternatives,risky:m.risky}):m.kind==="refused"&&j({code:m.code,sentence:m.sentence,remedy:m.remedy,plan:m.plan??null}),H(b=>te(b,{kind:"settled"}))};g.useEffect(()=>()=>H(ve),[]);const Q=g.useCallback(()=>{k(De(E.bounds,c))},[E.bounds,c]);g.useEffect(()=>{const n=o.current;if(!n)return;const m=()=>{const A=n.getBoundingClientRect();f({width:A.width,height:A.height,clipWidth:n.clientWidth,clipHeight:n.clientHeight,left:A.left,top:A.top})};m();const b=new ResizeObserver(m);return b.observe(n),()=>b.disconnect()},[]),g.useEffect(()=>{p.current||c.width<=0||c.height<=0||(p.current=!0,k(De(E.bounds,c)))},[c,E.bounds]),g.useEffect(()=>{const n=h.current;if(h.current={width:c.width,height:c.height},!n||!p.current||c.width<=0||c.height<=0||c.width>=n.width&&c.height>=n.height||!i)return;const m=E.devices.get(i);m&&k(b=>{const A={width:c.clipWidth,height:c.clipHeight},z=Math.max(0,Math.min(A.width-E.bounds.width*b.k,A.height-E.bounds.height*b.k));return Et(b,m,A,Math.min(Rt,z))})},[c,i,E]);const B=y.kind==="dragging"?{x:y.x-c.left+12,y:y.y-c.top+12}:{x:0,y:0},Z=O?Dt(O):null,w=g.useRef(null),R=g.useRef(null),T=g.useRef(null),$=g.useRef(null),P=g.useCallback(()=>{T.current=null;const n=w.current,m=R.current;if(w.current=null,R.current=null,n){const b=$.current;if(!b)return;k({k:b.transform.k,tx:b.transform.tx+(n.x-b.x),ty:b.transform.ty+(n.y-b.y)});return}m&&k(b=>ke(b,{x:m.x,y:m.y},b.k*Math.exp(-m.deltaY*js)))},[]),U=g.useCallback(()=>{T.current===null&&(T.current=requestAnimationFrame(P))},[P]);g.useEffect(()=>()=>{T.current!==null&&cancelAnimationFrame(T.current)},[]);const V=n=>{!(n.target===n.currentTarget)&&n.button!==1||n.button!==0&&n.button!==1||($.current={x:n.clientX,y:n.clientY,transform:N},n.currentTarget.setPointerCapture(n.pointerId),n.preventDefault())},he=n=>{$.current&&(w.current={x:n.clientX,y:n.clientY},U())},ee=n=>{$.current&&($.current=null,w.current=null,n.currentTarget.hasPointerCapture(n.pointerId)&&n.currentTarget.releasePointerCapture(n.pointerId))},J=g.useCallback(n=>{if(n.deltaY===0)return;n.preventDefault();const m=n.currentTarget.getBoundingClientRect();R.current={x:n.clientX-m.left,y:n.clientY-m.top,deltaY:n.deltaY},U()},[U]);g.useEffect(()=>{const n=o.current;if(n)return n.addEventListener("wheel",J,{passive:!1}),()=>n.removeEventListener("wheel",J)},[J]);const pe=n=>{const m=n.shiftKey?Oe*4:Oe;switch(n.key){case"Escape":if(y.kind!=="pressing"&&y.kind!=="dragging")return;n.preventDefault(),y.kind==="dragging"&&(M.current=!0),H(b=>te(b,{kind:"cancel"}));return;case"0":n.preventDefault(),Q();return;case"+":case"=":n.preventDefault(),k(b=>ke(b,{x:c.width/2,y:c.height/2},b.k*$e));return;case"-":case"_":n.preventDefault(),k(b=>ke(b,{x:c.width/2,y:c.height/2},b.k/$e));return;case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"ArrowDown":{n.preventDefault();const b=n.key==="ArrowLeft"?m:n.key==="ArrowRight"?-m:0,A=n.key==="ArrowUp"?m:n.key==="ArrowDown"?-m:0;k(z=>({...z,tx:z.tx+b,ty:z.ty+A}));return}}};return t.jsxs("div",{ref:o,"data-mesh-canvas":"",role:"group","aria-labelledby":C,tabIndex:0,onPointerDown:V,onPointerMove:le,onPointerUp:oe,onPointerCancel:n=>{y.kind==="dragging"&&(M.current=!0),H(m=>te(m,{kind:"cancel"})),ee(n)},"data-mesh-gesture":y.kind,"data-glass-well":"clear",onKeyDown:pe,onDoubleClick:n=>{n.target===n.currentTarget&&Q()},className:L("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:`${N.tx}px ${N.ty}px`}}),t.jsxs("div",{"data-mesh-world":"",className:"absolute top-0 left-0",style:{transform:`translate3d(${N.tx}px, ${N.ty}px, 0) scale(${N.k})`,transformOrigin:"0 0",width:E.bounds.width,height:E.bounds.height},children:[t.jsx(ys,{stacks:S,geometry:E}),t.jsx(rs,{edges:e.edges,geometry:E,selectedDeviceId:i}),t.jsx("ul",{"aria-label":a("ui.mesh.mesh_canvas.networks"),className:"m-0 list-none p-0",children:e.networks.map(n=>{const m=E.networks.get(n.id);return m?t.jsx(hs,{network:n,x:m.x,y:m.y,refused:O?.kind==="refused"&&y.kind==="dragging"&&y.target.kind==="network"&&y.target.networkId===n.id},n.id):null})}),t.jsx("ul",{"aria-label":a("ui.mesh.mesh_canvas.devices"),className:"m-0 list-none p-0",children:e.devices.map(n=>{const m=E.devices.get(n.id);return m?t.jsx(ps,{device:n,x:m.x,y:m.y,nowSeconds:r,selected:n.id===i,sessions:d.get(n.id)??{rows:[],shown:[],hidden:0},sessionTotal:u.get(n.id)??n.sessionCount??0,dropState:ae(n.id),movingSessionId:x,draggedSessionId:is(y),onOpen:v,onChipPointerDown:ie,onChipClick:()=>{if(M.current){M.current=!1;return}v(n.id)},onShowAllSessions:I},n.id):null})})]}),y.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:B.x,top:B.y},children:y.payload.session.name||"untitled"}),y.kind==="dragging"&&Z&&t.jsx("div",{"data-mesh-indicator":"",className:L("pointer-events-none absolute z-10 rounded-sm border bg-surface px-2 py-1 text-meta",O?.kind==="refused"?"border-warning text-warning":"border-control text-ink"),style:{left:B.x,maxWidth:Math.max(160,c.width-B.x-12),...B.y>c.height*.6?{bottom:Math.max(12,c.height-B.y+8)}:{top:B.y+24}},children:Z})]})};function Is(e,s,r,i){const d=r.locality==="local"?s:r.owner_device,u=[];for(const x of e)if(x.id!==d){if(x.id===s){u.push({deviceId:x.id,label:i,verb:a("ui.mesh.mesh_card.recall_to_this_device"),keepVerb:a("ui.mesh.mesh_card.copy_here_leave_it_there")});continue}u.push({deviceId:x.id,label:x.label,verb:a("ui.mesh.mesh_card.move_to",{device:x.label}),keepVerb:a("ui.mesh.mesh_card.copy_to",{device:x.label})})}return u}function Cs(e,s,r){return Is(e.devices,e.selfDeviceId,s,r)}function Xe(e,s,r){const i=Cs(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]))},u=s.locality==="local"?e.selfDeviceId??"":s.owner_device,x=d.devices.get(u);return i.map(l=>{const v=ge({session:s,ownerDeviceId:u,ownerLabel:x?.label??s.owner_device_name},{kind:"device",deviceId:l.deviceId},d);return{...l,refused:v.kind==="refused"&&v.code!=="busy"?v.sentence:null}})}const Ze=({session:e,destinations:s,disabled:r,onChoose:i,onOpenChange:d,trigger:u,triggerLabel:x})=>(W(),t.jsxs(it,{onOpenChange:d,children:[t.jsx(rt,{asChild:!0,children:t.jsx("button",{type:"button","aria-label":x,"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:u})}),t.jsxs(lt,{align:"start",className:"min-w-56",children:[t.jsx(ot,{children:se(e)}),t.jsx(Se,{}),s.map(l=>t.jsx(Me,{"data-mesh-move-to":l.deviceId,disabled:!!l.refused,title:l.refused??void 0,onSelect:()=>i(l,!1),children:l.verb},l.deviceId)),t.jsx(Se,{}),s.map(l=>t.jsx(Me,{"data-mesh-copy-to":l.deviceId,disabled:!!l.refused,title:l.refused??void 0,onSelect:()=>i(l,!0),children:l.keepVerb},`keep-${l.deviceId}`))]})]})),Ss=({device:e,sessions:s,sessionTotal:r,nowSeconds:i,destinationsFor:d,movingSessionId:u,canMove:x,canInvite:l,onClose:v,onMove:_,onShowInList:j,onInvite:I,onRemoveMember:C})=>{W();const o=ue(e);g.useEffect(()=>{const p=M=>{M.key!=="Escape"||M.defaultPrevented||M.target?.closest('[role="menu"],[role="dialog"]')||(document.querySelector(`[data-mesh-device-open="${e.id}"]`)?.focus(),v())};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[e.id,v]);const c=e.memberships.every(p=>!p.active),f=e.sessionCount===null?Fe(null):a("ui.mesh.mesh_card.conversation_count",{count:e.sessionCount}),N=e.suspect?Ue():[c?a("ui.mesh.mesh_card.revoked_membership"):f,me(o)].filter(Boolean).join(" · "),k=r>s.rows.length?a("ui.mesh.mesh_card.shown_of",{shown:s.rows.length,total:r}):`${s.rows.length}`;return t.jsxs("aside",{"aria-label":a("ui.mesh.mesh_card.device_details",{device:e.label}),"data-mesh-panel":e.id,"data-glass-block":"",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(G,{size:"sm",variant:"ghost",className:"w-fit self-end","data-mesh-panel-close":"",onClick:v,children:a("ui.mesh.mesh_actions.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(Ne,{"aria-hidden":"true",className:"size-3.5 text-danger"}),!e.suspect&&o==="unanswered"&&t.jsx(at,{"aria-hidden":"true",className:"size-3.5 text-warning"}),N]})]}),t.jsx(re,{}),t.jsxs("section",{className:"flex flex-col gap-2",children:[t.jsx("h3",{className:"text-meta text-ink-dim",children:a("ui.mesh.mesh_card.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(ye,{"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?"":a("ui.mesh.mesh_card.revoked")]}),l&&p.active&&t.jsxs(G,{size:"sm",variant:"ghost",className:"w-fit","data-mesh-remove-member":`${p.networkId}:${e.id}`,onClick:()=>C(e,p.networkId),children:[a("ui.mesh.mesh_card.remove_from"),p.networkName,"…"]})]},p.networkId))}),l&&t.jsx(G,{size:"sm",variant:"secondary",className:"w-fit","data-mesh-invite":e.id,onClick:()=>I(e),children:a("ui.mesh.mesh_actions.invite_to_a_network")})]}),t.jsx(re,{}),t.jsxs("section",{className:"flex shrink-0 flex-col gap-2",children:[t.jsxs("h3",{className:"text-meta text-ink-dim",children:[a("ui.mesh.mesh_card.conversations"),t.jsxs("span",{className:"text-ink-disabled",children:["(",k,")"]})]}),s.rows.length===0?t.jsx("p",{className:"text-meta text-ink-dim",children:e.sessionCount===null?a("ui.mesh.mesh_card.this_device_did_not_report_its_conversations"):a("ui.mesh.mesh_card.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:L("flex items-center gap-2 rounded-sm px-2 py-1","border border-hairline bg-elevated",u===p.id&&"border-control"),children:[t.jsx("span",{className:"min-w-0 flex-1 truncate text-body-sm text-ink",title:se(p),children:se(p)}),t.jsx("span",{className:"shrink-0 text-meta text-ink-dim",children:Ke(p,e.label,ue(e))}),u===p.id?t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:a("ui.mesh.mesh_card.moving")}):t.jsx(Ze,{session:p,destinations:d(p),disabled:!x,onChoose:(M,h)=>_(p,M,h),trigger:t.jsx(qe,{"aria-hidden":"true",className:"size-4"}),triggerLabel:a("ui.mesh.mesh_card.move_conversation",{conversation:se(p)})})]},p.id))})]}),t.jsx(re,{}),t.jsxs("section",{className:"flex flex-col gap-2",children:[t.jsx("h3",{className:"text-meta text-ink-dim",children:a("ui.mesh.mesh_card.network_addresses")}),e.endpoints.length===0?t.jsx("p",{className:"text-meta text-ink-dim",children:a("ui.mesh.mesh_card.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:a("ui.mesh.mesh_card.advertised")})]},p))})]}),t.jsx(re,{}),t.jsxs("section",{className:"flex flex-col gap-2",children:[t.jsx("h3",{className:"text-meta text-ink-dim",children:a("ui.mesh.mesh_card.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:a("ui.mesh.mesh_card.reach")}),t.jsx("dd",{className:"m-0 text-body-sm text-ink",children:me(o)})]}),t.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[t.jsx("dt",{className:"text-meta text-ink-dim",children:a("ui.mesh.mesh_card.last_status_frame")}),t.jsx("dd",{className:"m-0 text-body-sm text-ink",children:e.lastSeenAt===null?a("ui.mesh.mesh_card.never"):At(i-e.lastSeenAt)})]})]}),e.reason&&t.jsx("p",{className:"text-meta text-warning",children:e.reason})]}),t.jsx(re,{}),t.jsx(G,{size:"sm",variant:"ghost",className:"w-fit","data-mesh-show-in-list":e.id,onClick:()=>j(e.id),children:a("ui.mesh.mesh_card.show_in_list")})]})},Ms=["name","chats","state"],Es={get name(){return a("ui.mesh.mesh_list.name")},get chats(){return a("ui.mesh.mesh_list.sort_conversations")},get state(){return a("ui.mesh.mesh_list.state")}},ze={suspect:0,unreachable:1,self:2,reachable:3};function Ds(e,s){const r=[...e];switch(s){case"chats":return r.sort((i,d)=>(d.sessionCount??-1)-(i.sessionCount??-1)||i.label.localeCompare(d.label)),r;case"state":return r.sort((i,d)=>ze[i.state]-ze[d.state]||i.label.localeCompare(d.label)),r;default:return r.sort((i,d)=>i.label.localeCompare(d.label))}}const We=8;function Rs(e,s){if(e.locality==="local")return e.live_state||"here";const r=e.owner_device_name||s,i=e.live_state?` · ${e.live_state}`:"";return e.reachable?a("ui.mesh.mesh_list.on_device_state",{device:r,state:i}):a("ui.mesh.mesh_list.on_device_no_answer",{device:r})}const As=({graph:e,nowSeconds:s,selectedDeviceId:r,sessions:i,selfLabel:d,canMove:u,onSelect:x,onMove:l,onInvite:v,onRemove:_})=>{W();const[j,I]=g.useState("name"),C=g.useMemo(()=>e.networks.map(o=>({network:o,members:Ds(e.devices.filter(c=>c.memberships.some(f=>f.networkId===o.id)),j)})),[e,j]);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:a("ui.mesh.mesh_list.sort_devices_by")}),t.jsx("div",{"data-glass-well":"",className:"flex gap-0.5 rounded-md bg-sunken p-0.5",children:Ms.map(o=>t.jsx("button",{type:"button","aria-pressed":j===o,onClick:()=>I(o),className:L("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",j===o&&"bg-surface text-ink"),children:Es[o]},o))})]}),C.map(({network:o,members:c})=>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:a("ui.mesh.mesh_list.epoch",{epoch:o.epoch}),children:[o.label,t.jsxs("span",{className:"text-meta text-ink-dim",children:[o.trust," ·"," ",a("ui.mesh.mesh_graph.device_count",{count:o.memberCount}),o.revokedCount>0?a("ui.mesh.mesh_list.revoked_count",{count:o.revokedCount}):""]})]}),t.jsx("ul",{className:"m-0 flex list-none flex-col gap-1 p-0",children:c.map(f=>{const N=f.memberships.find(S=>S.networkId===o.id),k=f.id===r,p=i.get(f.id),M=p?.rows??[],h=p?Ge(p,f.sessionCount):f.sessionCount??0,D=ue(f);return t.jsxs("li",{"data-mesh-device-row":f.id,"data-mesh-state":f.state,"aria-current":k?"true":void 0,className:L("flex flex-col gap-1 rounded-md px-3 py-2","border border-hairline bg-surface",k&&"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":f.id,onClick:()=>x(f.id),className:L("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:f.label}),t.jsxs("span",{className:L("flex shrink-0 items-center gap-1 text-meta",Ye[D]),"data-mesh-reach":D,children:[f.suspect&&t.jsx(Ne,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-danger"}),f.suspect?me(D):Be(f,s),f.suspect&&t.jsx("span",{className:"shrink-0 rounded-sm border border-danger px-1 text-danger",children:Ue()})]}),t.jsxs("span",{className:"shrink-0 text-meta text-ink-dim",children:[N?.role?`${N.role} · `:"",N&&!N.active?a("ui.mesh.mesh_list.revoked"):a("ui.mesh.mesh_list.member")]})]}),M.length>0?t.jsxs(t.Fragment,{children:[t.jsx(re,{className:"my-1"}),t.jsx("ul",{className:"m-0 flex list-none flex-col gap-0.5 p-0",children:M.slice(0,We).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(Ze,{session:S,destinations:Xe(e,S,d),disabled:!u,onChoose:(E,Y)=>l(S,E,Y),trigger:t.jsx(qe,{"aria-hidden":"true",className:"size-3.5"}),triggerLabel:a("ui.mesh.mesh_list.move_conversation",{conversation:S.name||S.id})})]},S.id))}),h>M.slice(0,We).length&&t.jsx("button",{type:"button",onClick:()=>x(f.id),className:"w-fit text-meta text-ink-dim hover:text-ink",children:a("ui.mesh.mesh_list.show_all_panel",{count:h})})]}):t.jsx("span",{className:"text-meta text-ink-dim",children:a("ui.mesh.mesh_list.conversation_count",{count:h})}),(N?.active||f.state!=="self")&&t.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[t.jsx(G,{size:"sm",variant:"ghost","data-mesh-invite":f.id,onClick:()=>v({deviceId:f.id,deviceLabel:f.label}),children:a("ui.mesh.mesh_actions.invite_to_a_network")}),N?.active&&t.jsxs(G,{size:"sm",variant:"ghost","data-mesh-remove-member":`${o.id}:${f.id}`,onClick:()=>_({networkId:o.id,networkLabel:o.label,deviceId:f.id,deviceLabel:f.label}),children:[a("ui.mesh.mesh_card.remove_from"),o.label,"…"]})]})]},f.id)})})]},o.id)),e.unmatchedPeers.length>0&&t.jsxs("p",{className:"text-meta text-warning",children:[a("ui.mesh.mesh_graph.device_count",{count:e.unmatchedPeers.length})," ",a("ui.mesh.mesh_list.answered_the_peer_read_but_is_in")]})]})},Ls=["canvas","list"],Ps={get canvas(){return a("ui.mesh.mesh_page.canvas")},get list(){return a("ui.mesh.mesh_page.list")}},Ts=({state:e,graph:s,nowSeconds:r,checking:i,staleError:d,onRetry:u,approvals:x,sessions:l,sessionError:v,selfLabel:_,movingSessionId:j,canMove:I,pendingMove:C,onAskMove:o,onDropRefused:c,onChooseMove:f,onCancelMove:N,moveBusy:k,moveReport:p,onDismissReport:M,onWaitForIdle:h,onUndoCopy:D,invite:S,onOpenInvite:E,onInvite:Y,onCloseInvite:y,inviteBusy:H,inviteReceipt:ne,inviteRefusal:q,remove:O,onOpenRemove:ae,onRemove:ie,onCloseRemove:le,removeBusy:oe,removeRefusal:Q,removed:B})=>{W();const[Z,w]=g.useState("canvas"),[R,T]=g.useState(null),$=s?Lt(s):"",P="mesh-summary",U=Pt(s),V=Tt(s,l,s?.selfDeviceId??null),he=g.useMemo(()=>{const n=new Map;for(const m of s?.devices??[]){const b=V.byDevice.get(m.id);n.set(m.id,b?Ge(b,m.sessionCount):m.sessionCount??0)}return n},[s,V]),ee=g.useCallback(n=>{T(n)},[]),J=s?s.devices.find(n=>n.id===R)??null:null,pe=g.useCallback((n,m,b)=>{if(!s)return null;const A={selfDeviceId:s.selfDeviceId,devices:new Map(s.devices.map(X=>[X.id,X])),networks:new Map(s.networks.map(X=>[X.id,X]))},z=n.locality==="local"?s.selfDeviceId??"":n.owner_device,K=A.devices.get(z),F=ge({session:n,ownerDeviceId:z,ownerLabel:K?.label??n.owner_device_name},{kind:"device",deviceId:m.deviceId},A);if(F.kind==="refused")return c({code:F.code,sentence:F.sentence,remedy:F.remedy,plan:F.plan??null}),null;if(F.kind==="none")return null;const Ie=b?F.alternatives.find(X=>X.keep)??F.plan:F.plan,Je=[F.plan,...F.alternatives].filter(X=>X.keep!==Ie.keep),Qe={plan:Ie,alternatives:Je,risky:F.risky};o(Qe)},[s,o,c]);return t.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-6 overflow-y-auto p-6",children:[t.jsx(nt,{title:a("ui.mesh.mesh_page.mesh"),icon:ye,subtitle:a("ui.mesh.mesh_page.devices_this_app_is_paired_with_and"),children:t.jsxs("div",{className:"flex items-center gap-4",children:[i&&t.jsx("output",{className:"text-meta text-ink-dim",children:a("ui.mesh.mesh_page.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:a("ui.mesh.mesh_page.presentation")}),t.jsx("div",{"data-glass-well":"",className:"flex gap-0.5 rounded-md bg-sunken p-0.5",children:Ls.map(n=>t.jsx("button",{type:"button","aria-pressed":Z===n,disabled:e.kind!=="ready",onClick:()=>w(n),className:L("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",Z===n&&"bg-surface text-ink"),children:Ps[n]},n))})]})]})}),t.jsx(ns,{rows:x.rows,error:x.error,pending:x.pending,refusal:x.decisionRefusal,onDecide:x.onDecide,onRetry:x.onRetry,nowSeconds:x.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(Ee,{className:"h-4 w-64"}),t.jsx(Ee,{className:"min-h-40 w-full flex-1"})]}),e.kind==="error"&&t.jsxs(fe,{variant:"warning",className:"flex-col items-start gap-2",children:[t.jsx("p",{children:e.message}),t.jsx(G,{variant:"secondary",size:"sm",onClick:u,className:"w-fit",children:a("ui.mesh.mesh_approvals_tray.ask_again")})]}),e.kind==="empty"&&t.jsx("div",{"data-glass-block":"",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:a("ui.mesh.mesh_page.no_network_on_this_device")}),t.jsx("p",{className:"max-w-140 text-body-sm text-ink-muted",children:a("ui.mesh.mesh_page.this_device_is_not_in_any_network")}),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("ui.mesh.mesh_page.a_network_appears_here_once_this_device")})]})}),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:P,className:"text-meta text-ink-muted","data-mesh-summary":"",children:$}),d&&t.jsx(fe,{variant:"warning",children:t.jsx("p",{children:d})}),v&&t.jsx(fe,{variant:"warning",children:t.jsx("p",{children:v})}),p&&t.jsx(Ot,{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:h,onRecheck:u,onUndo:D,onDismiss:M,pending:k}),Z==="canvas"?t.jsx(Ns,{graph:s,slots:U,nowSeconds:r,selectedDeviceId:R,sessions:V.byDevice,sessionTotals:he,movingSessionId:j,canMove:I,onOpenDevice:ee,onAskMove:o,onDropRefused:c,onShowAllSessions:ee,summaryId:P}):t.jsx(As,{graph:s,nowSeconds:r,selectedDeviceId:R,sessions:V.byDevice,selfLabel:_,canMove:I,onSelect:ee,onMove:pe,onInvite:E,onRemove:ae})]}),J&&t.jsx(Ss,{device:J,sessions:V.byDevice.get(J.id)??{rows:[],shown:[],hidden:0},sessionTotal:he.get(J.id)??0,nowSeconds:r,canMove:I,canInvite:e.kind==="ready",movingSessionId:j,destinationsFor:n=>Xe(s,n,_),onClose:()=>T(null),onMove:pe,onInvite:n=>E({deviceId:n.id,deviceLabel:n.label}),onRemoveMember:(n,m)=>{const b=s.networks.find(A=>A.id===m);ae({networkId:m,networkLabel:b?.label??m,deviceId:n.id,deviceLabel:n.label})},onShowInList:n=>{ee(n),w("list")}})]})}),t.jsx($t,{open:C!==null,plan:C?.plan??Os,alternatives:C?.alternatives??[],risky:C?.risky??!1,busy:k,onCancel:N,onChoose:f}),S&&t.jsx(zt,{open:S.open,options:S.options,deviceId:S.deviceId,deviceLabel:S.deviceLabel,onClose:y,onInvite:Y,pending:H,receipt:ne,refusal:q}),O&&t.jsx(Wt,{open:O.open,networkLabel:O.networkLabel,deviceLabel:O.deviceLabel,onClose:le,onConfirm:ie,pending:oe,refusal:Q,removed:B})]})},Os={sessionId:"",to:"",keep:!1,verb:"",waitS:0,lost:null},Us=()=>{W();const e=tt(),s=be(e.data,"peers")==="enabled",r=be(e.data,"session_transfer")==="enabled",i=Ht(s),d=qt(s),u=Ft(s,{poll:!1,stamp:()=>Ce.getState().beginAnswer()}),x=g.useMemo(()=>({peers:i,networks:d}),[i,d]),l=Yt(x),v=Bt(x),_=Ut(),j=be(e.data,"approvals")==="enabled",I=Gt(s&&j,{poll:!1}),C=Vt(),o=C.isError?{approvalId:C.variables?.approvalId??null,...Kt(C.error)}:null,c=g.useMemo(()=>Math.floor((I.dataUpdatedAt||Date.now())/1e3),[I.dataUpdatedAt]),f=Ce(w=>w.settlePlacement),N=Xt(),k=Zt(),[p,M]=g.useState(null),[h,D]=g.useState(null),[S,E]=g.useState(null),[Y,y]=g.useState(null),[H,ne]=g.useState(null),[q,O]=g.useState(null),[ae,ie]=g.useState(null),le=g.useMemo(()=>{const w=Math.max(i.dataUpdatedAt,d.dataUpdatedAt);return Math.floor((w||Date.now())/1e3)},[i.dataUpdatedAt,d.dataUpdatedAt]),oe=g.useCallback(()=>{i.refetch(),d.refetch(),u.refetch()},[i,d,u]),Q=g.useCallback((w,R)=>{M(null);const T={sessionId:w.sessionId,to:w.to,keep:w.keep,waitS:R??w.waitS};_.mutate(T,{onSuccess:$=>{if($.kind==="moved"){const{receipt:P}=$;f(w.sessionId,P);const U=P.locality==="local"?a("ui.mesh.mesh_drop.this_device"):v?.devices.find(V=>V.id===P.owner_device)?.label??P.owner_device;D({kind:"moved",verb:P.mode==="keep"?a("ui.mesh.mesh_page.copied"):a("ui.mesh.mesh_page.moved"),detail:P.mode==="keep"?a("ui.mesh.mesh_page.copy_receipt",{destination:U,suffix:P.new_session_id.slice(-6)}):a("ui.mesh.mesh_page.move_receipt",{destination:U,retirement:P.source_retired?a("ui.mesh.mesh_page.the_copy_here_is_gone"):""}),undo:P.mode==="keep"?{sessionId:P.new_session_id,to:"local",keep:!1,verb:a("ui.mesh.mesh_page.bring_copy_back",{device:U}),waitS:0,lost:Jt(U,a("ui.mesh.mesh_drop.this_device"))}:null});return}D({kind:"refused",refusal:$.refusal,plan:w})},onError:()=>{D({kind:"refused",refusal:{code:"move_failed",sentence:a("ui.mesh.mesh_page.the_move_could_not_be_sent_nothing"),status:null,unconfirmed:!1},plan:w})}})},[v,_,f]),B=g.useMemo(()=>{if(!v)return[];const w=S?.deviceId,R=w?v.devices.find(T=>T.id===w):void 0;return v.networks.filter(T=>{if(!R)return!0;const $=R.memberships.find(P=>P.networkId===T.id);return!$||!$.active}).map(T=>({id:T.id,label:T.label}))},[v,S]);if(!s)return t.jsx(st,{to:"/chat",replace:!0});const Z=l.kind==="ready"?i.error?de(i.error):d.error?de(d.error):null:null;return t.jsx(Ts,{state:l,graph:v,nowSeconds:le,checking:i.isFetching||d.isFetching,staleError:Z,onRetry:oe,approvals:{rows:I.data??[],error:I.isError?Qt(I.error):null,pending:C.isPending?C.variables??null:null,decisionRefusal:o,onDecide:(w,R)=>C.mutate({approvalId:w,decision:R}),onRetry:()=>void I.refetch(),nowSeconds:c},sessions:u.data?.rows??[],movingSessionId:_.isPending?_.variables?.sessionId??null:null,sessionError:u.isError?de(u.error):null,selfLabel:v?.devices.find(w=>w.state==="self")?.label??a("ui.mesh.mesh_drop.this_device"),canMove:r,pendingMove:p,onAskMove:M,onDropRefused:w=>D({kind:"refused",refusal:{code:w.code,sentence:w.sentence,status:null,unconfirmed:!1},plan:w.plan}),onChooseMove:w=>Q(w),onCancelMove:()=>M(null),moveBusy:_.isPending,moveReport:h,onDismissReport:()=>D(null),onWaitForIdle:()=>{h?.kind!=="refused"||!h.plan||Q(h.plan,$s)},onUndoCopy:()=>{h?.kind!=="moved"||!h.undo||M({plan:h.undo,alternatives:[],risky:!1})},invite:S===null?null:{open:!0,deviceId:S.deviceId,deviceLabel:S.deviceLabel,options:B},onOpenInvite:w=>{y(null),ne(null),E(w)},onInvite:w=>{N.mutate(w,{onSuccess:R=>y(R),onError:R=>ne({code:"invite_refused",sentence:de(R),status:null,unconfirmed:!1})})},onCloseInvite:()=>E(null),inviteBusy:N.isPending,inviteReceipt:Y,inviteRefusal:H,remove:q===null?null:{open:!0,networkId:q.networkId,networkLabel:q.networkLabel,deviceId:q.deviceId,deviceLabel:q.deviceLabel},onOpenRemove:w=>{ie(null),O(w)},onRemove:w=>{q&&k.mutate({networkId:q.networkId,deviceId:q.deviceId,confirm:w},{onSuccess:R=>ie(R)})},onCloseRemove:()=>O(null),removeBusy:k.isPending,removeRefusal:k.isError?{code:"remove_refused",sentence:de(k.error),status:null,unconfirmed:!1}:null,removed:ae})},$s=300;export{Us as MeshPage,Ts as MeshSurface,Us as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as y,$ as w,a0 as f,a1 as T,a2 as v,C as $,D as A}from"./conversation-input-sync-CJiOSzCX.js";import{p as d,P as R,a as L,b as I,c as N,d as P}from"./ui-preferences-store-C6eXGzFs.js";import{l as S,a as E}from"./use-memberships-query-DcD9UeVY.js";const p={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."},O=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 z(e){const n=e?.categories?.[0];return n&&v(n)?p[n]:p.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 H(e,n){const t=n.surface==="pull",a=t?"Nothing was pulled.":"Nothing was published.",o=t?"pull again":"publish again",s=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 "${s}" 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:`"${s}" 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 "${s}" at this moment. It is not claimed — try again in a moment.`,note:null,actions:["retry"]};case"name_reserved_builtin":{const i=e.details?.builtin_name,u=i?d(i)===d(s):!1;return{variant:"danger",headline:"That name is reserved",body:i&&!u?`"${s}" is reserved by the built-in agent "${i}". Built-in names cannot be published to the hub.`:`"${i??s}" 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:z(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:i,field:u}=C(e.message,e.details);return{variant:"danger",headline:"The agent document is not valid",body:i,note:null,actions:u==="name"?["focus-name"]:u==="instructions"?["edit-instructions"]:["edit-agent"]}}case"payload_too_large":{const i=e.details?.limit_bytes;return{variant:"danger",headline:"This agent is too large to publish",body:i?`The instruction set is larger than ${Math.round(i/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:O(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 i=e.details?.required;return{variant:"danger",headline:"Your organization role does not allow this",body:i?`${t?"Reading an organization's teams needs":"Publishing into an organization needs"} the ${i} 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 k=[/^(?: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/,B=new Set([404,410]),D=["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"],q=e=>{const n=e.toLowerCase();return D.some(t=>n.includes(t))||T(e)},x=(e,n)=>{const t=n.trim()?`"${n.trim()}"`:"That agent";if(w(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=k.reduce((s,i)=>s.replace(i,""),f(e,"").trim()).trim();if(!a)return`${t} could not be downloaded.`;const o=Number(U.exec(a)?.[1]??Number.NaN);return B.has(o)?`${t} is no longer on the hub, so nothing was downloaded.`:q(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}`},F="The action did not complete.",G=(e,n,t)=>e==="download"?x(n,t):y(F,n),X={"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"},j="download_count",g={all:["public-agents"],list:e=>[...g.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}]},h={all:["org-agents"],list:(e,n)=>[...h.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}]},K=e=>e&&e[0]===h.all[0]?String(e[2]??""):null,Z=e=>e.invalidateQueries({queryKey:g.all}),J=(e,n)=>e.invalidateQueries({queryKey:n?[...h.all,"list",n]:h.all}),V=({page:e=1,perPage:n=20,enabled:t=!0,categories:a,name:o,description:s,sort:i=j,order:u="desc",tenantId:c}={})=>{const b={page:e,perPage:n,categories:a,name:o,description:s,sort:i,order:u},_=c?h.list(c,b):g.list(b),l=$({queryKey:_,queryFn:async()=>{const r={};return a&&a.length>0&&(r.categories=a.join(",")),o&&(r.name=o),s&&(r.description=s),r.sort=i,r.order=u,c?await S(c,e,n,r):await E(e,n,r)},select:r=>r.result,enabled:t,retry:A,staleTime:5*60*1e3,gcTime:10*60*1e3,refetchOnWindowFocus:!1,placeholderData:(r,m)=>K(m?.queryKey)===(c??null)?r: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}},M={name:"Name",description:"Description",instructions:"The instruction body",tools:"Tools"};function ee(e){const n=[],t=(a,o)=>{o&&n.push({field:a,message:`${M[a]} ${o}.`})};return t("name",L(e.name)),t("description",I(e.description)),e.instructions!==null&&t("instructions",N(e.instructions)),t("tools",P(e.tools??[])),n}function ne(e,n){const t=d(e);return n.some(a=>d(a)===t)}function te(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 ae(e,n){const t=d(e);return n.find(a=>d(a)===t)??null}export{X as P,G as a,g as b,J as c,ne as d,ee as e,Z as i,ae as l,H as p,te as t,V as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as Y,a as E,b as F}from"./library-page-BGmng_P-.js";import"./index-hX_aZwq0.js";import"./index-D0l2JJ6w.js";import"./conversation-input-sync-CJiOSzCX.js";import"./ui-preferences-store-C6eXGzFs.js";import"./error-boundary-Tv9TlaZ8.js";import"./console-mirror-BnHVC7eO.js";import"./page-header-ggruiR-O.js";import"./tags-input-chips-B4_gHGYO.js";import"./arrow-up-D8Tgt51O.js";const B=["#4472C4","#ED7D31","#A9D18E","#FF0000","#FFC000","#5B9BD5","#70AD47","#C00000","#7030A0","#00B0F0"];function W(n,t){const c=`accent${n%6+1}`;return t[c]?"#"+t[c]:B[n%B.length]}function j(n,t=.45){const c=parseInt(n.slice(1,3),16),s=parseInt(n.slice(3,5),16),a=parseInt(n.slice(5,7),16),p=Math.round(c+(255-c)*t),M=Math.round(s+(255-s)*t),o=Math.round(a+(255-a)*t);return`rgb(${p},${M},${o})`}function G(n){const t=[];for(const c of E(n,"t")){const s=c.textContent.trim();s&&t.push(s)}return t.join(" ")}function V(n){if(!n)return[];const t=Y(n,"ptLst");if(!t)return[];const c=[];for(const s of E(t,"pt")){const a=F(s,"type","node");if(a==="parTrans"||a==="sibTrans")continue;const p=G(s);(p||a==="node")&&c.push({id:F(s,"modelId",""),type:a,text:p})}return c.filter(s=>s.text)}function z(n){if(!n)return"list";const t=Y(n,"layoutDef")||n,s=(F(t,"uniqueId","")||F(t,"defStyle","")||"").toLowerCase();return s.includes("chevron")||s.includes("arrowprocess")||s.includes("process")?"process":s.includes("cycle")||s.includes("continuouscycle")?"cycle":s.includes("hierarchy")||s.includes("orgchart")||s.includes("org")?"hierarchy":s.includes("radial")||s.includes("diverging")?"radial":s.includes("pyramid")||s.includes("invertedpyramid")?"pyramid":s.includes("funnel")?"funnel":s.includes("venn")?"venn":s.includes("matrix")?"matrix":s.includes("list")||s.includes("bullet")?"list":s.includes("relationship")||s.includes("balance")?"relationship":"list"}function $(n,t,c,s,a,p,M,o="#fff",f="center"){if(!t)return;n.save(),n.fillStyle=o,n.textAlign=f,n.textBaseline="middle";const l=t.split(" "),g=M*1.3;let h=[],r="";for(const u of l){const y=r?r+" "+u:u;n.measureText(y).width>a-4&&r?(h.push(r),r=u):r=y}r&&h.push(r);const i=Math.max(1,Math.floor(p/g));h.length>i&&(h=h.slice(0,i));const e=s-(h.length-1)*g/2;for(let u=0;u<h.length;u++)n.fillText(h[u],c,e+u*g);n.restore()}function I(n,t,c,s=14){const a=Math.floor(t/(s*.55)),p=n.split(" "),M=Math.ceil(p.join(" ").length/Math.max(a,1)),o=c/(M*1.4);return Math.max(8,Math.min(s,o))}function L(n,t,c,s,a,p,M,o){n.save(),n.beginPath(),p=Math.min(p,s/2,a/2),n.moveTo(t+p,c),n.arcTo(t+s,c,t+s,c+a,p),n.arcTo(t+s,c+a,t,c+a,p),n.arcTo(t,c+a,t,c,p),n.arcTo(t,c,t+s,c,p),n.closePath(),M&&(n.fillStyle=M,n.fill()),n.restore()}function X(n,t,c,s,a,p,M=1.5){const o=Math.atan2(a-c,s-t),f=8;n.save(),n.strokeStyle=p,n.fillStyle=p,n.lineWidth=M,n.beginPath(),n.moveTo(t,c),n.lineTo(s,a),n.stroke(),n.beginPath(),n.moveTo(s,a),n.lineTo(s-f*Math.cos(o-.4),a-f*Math.sin(o-.4)),n.lineTo(s-f*Math.cos(o+.4),a-f*Math.sin(o+.4)),n.closePath(),n.fill(),n.restore()}function J(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t.length,l=a/f,g=Math.min(l*.08,10*o),h=Math.min(l*.12,18*o),r=l-h-g,i=p*.7,e=s+(p-i)/2;for(let u=0;u<f;u++){const y=W(u,M),d=c+l*u+g/2,b=u===f-1;n.save(),n.beginPath();const P=d+r+(b?0:h);n.moveTo(d,e),n.lineTo(d+r,e),b||n.lineTo(P,e+i/2),n.lineTo(d+r,e+i),n.lineTo(d,e+i),u>0&&n.lineTo(d+h,e+i/2),n.closePath(),n.fillStyle=y,n.fill(),n.restore();const m=I(t[u].text,r-h,i)*o;n.font=`${m}px sans-serif`;const T=d+(r+(u>0?h:0))/2;$(n,t[u].text,T,e+i/2,r,i,m)}}function K(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t.length,l=c+a/2,g=s+p/2,h=Math.min(a,p)*.33,r=Math.min(h*.32,40*o);n.save(),n.strokeStyle="#ccc",n.lineWidth=2*o,n.setLineDash([4*o,4*o]),n.beginPath(),n.arc(l,g,h,0,Math.PI*2),n.stroke(),n.setLineDash([]),n.restore();for(let i=0;i<f;i++){const e=i/f*Math.PI*2-Math.PI/2,u=l+h*Math.cos(e),y=g+h*Math.sin(e),d=W(i,M);if(n.save(),n.beginPath(),n.arc(u,y,r,0,Math.PI*2),n.fillStyle=d,n.fill(),n.restore(),f>1){const P=(i+1)/f*Math.PI*2-Math.PI/2,m=(e+P)/2,T=l+h*Math.cos(e+.15),v=g+h*Math.sin(e+.15),k=l+h*Math.cos(P-.15),S=g+h*Math.sin(P-.15);n.save(),n.strokeStyle=d+"99",n.lineWidth=1.5*o,n.beginPath(),n.moveTo(T,v),n.quadraticCurveTo(l+h*1.1*Math.cos(m),g+h*1.1*Math.sin(m),k,S),n.stroke(),n.restore()}const b=I(t[i].text,r*1.7,r*1.2)*o;n.font=`${b}px sans-serif`,$(n,t[i].text,u,y,r*2,r*1.8,b)}}function O(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t[0],l=t.slice(1),g=Math.max(l.length,1),h=p/(l.length>0?2.8:1.2),r=h*.75,i=Math.min(a*.3,160*o),e=r,u=c+(a-i)/2,y=s+(h-e)/2,d=W(0,M);L(n,u,y,i,e,6*o,d);const b=I(f.text,i-10*o,e)*o;if(n.font=`bold ${b}px sans-serif`,$(n,f.text,u+i/2,y+e/2,i-10,e,b),!l.length)return;const P=(a-20*o)/g,m=s+h*1.5,T=y+e,v=m-4*o;n.save(),n.strokeStyle="#999",n.lineWidth=1.5*o,n.beginPath(),n.moveTo(u+i/2,T),n.lineTo(u+i/2,(T+v)/2),n.lineTo(c+10*o,(T+v)/2),n.lineTo(c+a-10*o,(T+v)/2),n.stroke(),n.restore();for(let k=0;k<l.length;k++){const S=c+P*k+8*o,R=m,A=P-16*o,H=r,N=W(k+1,M);n.save(),n.strokeStyle="#999",n.lineWidth=1.5*o,n.beginPath(),n.moveTo(S+A/2,(T+v)/2),n.lineTo(S+A/2,R),n.stroke(),n.restore(),L(n,S,R,A,H,5*o,N);const D=I(l[k].text,A-8*o,H)*o;n.font=`${D}px sans-serif`,$(n,l[k].text,S+A/2,R+H/2,A-8,H,D)}}function Q(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t[0],l=t.slice(1),g=c+a/2,h=s+p/2,r=Math.min(a,p)*.18,i=Math.min(a,p)*.36,e=Math.min(i*.28,38*o),u=l.length||1,y=W(0,M);n.save(),n.beginPath(),n.arc(g,h,r,0,Math.PI*2),n.fillStyle=y,n.fill(),n.restore();const d=I(f.text,r*1.6,r*1.2)*o;n.font=`bold ${d}px sans-serif`,$(n,f.text,g,h,r*2,r*2,d);for(let b=0;b<u;b++){const P=b/u*Math.PI*2-Math.PI/2,m=g+i*Math.cos(P),T=h+i*Math.sin(P),v=W(b+1,M),k=g+r*Math.cos(P),S=h+r*Math.sin(P),R=m-e*Math.cos(P),A=T-e*Math.sin(P);X(n,k,S,R,A,v+"99",1.5*o),n.save(),n.beginPath(),n.arc(m,T,e,0,Math.PI*2),n.fillStyle=v,n.fill(),n.restore();const H=I(l[b].text,e*1.7,e*1.2)*o;n.font=`${H}px sans-serif`,$(n,l[b].text,m,T,e*2,e*1.8,H)}}function U(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t.length,l=p/f;for(let g=0;g<f;g++){const h=(f-g)/f,r=a*h,i=c+(a-r)/2,e=s+g*l,u=W(g,M);n.save(),n.beginPath(),n.moveTo(i,e+l),n.lineTo(i+r,e+l);const y=a*((f-g-1)/f);n.lineTo(c+(a+y)/2,e),n.lineTo(c+(a-y)/2,e),n.closePath(),n.fillStyle=u,n.strokeStyle="#fff",n.lineWidth=2*o,n.fill(),n.stroke(),n.restore();const d=I(t[g].text,r*.6,l*.7)*o;n.font=`${d}px sans-serif`,$(n,t[g].text,c+a/2,e+l/2,r*.6,l*.7,d)}}function Z(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t.length,l=p/f;for(let g=0;g<f;g++){const h=1-g/f*.55,r=1-(g+1)/f*.55,i=a*h,e=a*r,u=c+(a-i)/2,y=c+(a-e)/2,d=s+g*l,b=W(g,M);n.save(),n.beginPath(),n.moveTo(u,d),n.lineTo(u+i,d),n.lineTo(y+e,d+l),n.lineTo(y,d+l),n.closePath(),n.fillStyle=b,n.strokeStyle="#fff",n.lineWidth=2*o,n.fill(),n.stroke(),n.restore();const P=(i+e)/2,m=I(t[g].text,P*.8,l*.7)*o;n.font=`${m}px sans-serif`,$(n,t[g].text,c+a/2,d+l/2,P*.8,l*.7,m)}}function _(n,t,c,s,a,p,M,o){if(!t.length)return;const f=Math.min(t.length,4),l=c+a/2,g=s+p/2,h=Math.min(a,p)*(f<=2?.32:.28),r=h*.65,i=[];for(let e=0;e<f;e++)i.push(e/f*Math.PI*2-Math.PI/2);for(let e=0;e<f;e++){const u=f>1?l+r*Math.cos(i[e]):l,y=f>1?g+r*Math.sin(i[e]):g,d=W(e,M);n.save(),n.globalAlpha=.55,n.beginPath(),n.arc(u,y,h,0,Math.PI*2),n.fillStyle=d,n.fill(),n.globalAlpha=1,n.strokeStyle="#fff",n.lineWidth=1.5*o,n.stroke(),n.restore();const b=f>1?l+(r+h*.45)*Math.cos(i[e]):l,P=f>1?g+(r+h*.45)*Math.sin(i[e]):g,m=I(t[e].text,h*1.2,h*.7)*o;n.font=`${m}px sans-serif`,$(n,t[e].text,b,P,h*1.2,h*.7,m,"#333")}}function w(n,t,c,s,a,p,M,o){const f=[t[0]||{text:""},t[1]||{text:""},t[2]||{text:""},t[3]||{text:""}],l=a/2,g=p/2,h=8*o;for(let r=0;r<2;r++)for(let i=0;i<2;i++){const e=r*2+i,u=c+i*l+h,y=s+r*g+h,d=l-h*2,b=g-h*2,P=W(e,M);L(n,u,y,d,b,8*o,P);const m=I(f[e].text,d-10,b)*o;n.font=`${m}px sans-serif`,$(n,f[e].text,u+d/2,y+b/2,d-10,b,m)}}function q(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t.length,l=p/f,g=Math.min(l*.2,14*o),h=g*3;for(let r=0;r<f;r++){const i=s+r*l,e=i+l/2,u=W(r,M);n.save(),n.beginPath(),n.arc(c+g,e,g,0,Math.PI*2),n.fillStyle=u,n.fill(),n.restore(),L(n,c+h,i+l*.1,a-h-4*o,l*.8,4*o,u+"22");const y=I(t[r].text,a-h-20*o,l*.7)*o;n.font=`${y}px sans-serif`,n.fillStyle="#333",n.textAlign="left",n.textBaseline="middle",n.fillText(t[r].text,c+h+8*o,e)}}function C(n,t,c,s,a,p,M,o){if(t.length<2){q(n,t,c,s,a,p,M,o);return}const f=t[Math.floor(t.length/2)],l=t.slice(0,Math.floor(t.length/2)),g=t.slice(Math.floor(t.length/2)+1),h=c+a/2,r=s+p/2,i=Math.min(a*.14,p*.25),e=W(Math.floor(t.length/2),M);n.save(),n.beginPath(),n.arc(h,r,i,0,Math.PI*2),n.fillStyle=e,n.fill(),n.restore();const u=I(f.text,i*1.6,i*1.2)*o;n.font=`bold ${u}px sans-serif`,$(n,f.text,h,r,i*2,i*1.8,u);const y=p/Math.max(l.length,g.length,1),d=a*.3,b=y*.7,P=(m,T)=>{const v=T==="left"?c:c+a-d,k=T==="left"?h-i:h+i;for(let S=0;S<m.length;S++){const R=s+y*S+(y-b)/2,A=W(S+(T==="right"?l.length+1:0),M);L(n,v,R,d,b,5*o,A);const H=I(m[S].text,d-8,b)*o;n.font=`${H}px sans-serif`,$(n,m[S].text,v+d/2,R+b/2,d-8,b,H);const N=T==="left"?v+d:v;X(n,N,R+b/2,k,r,A+"88",1.5*o)}};P(l,"left"),P(g,"right")}function x(n,t,c,s,a,p,M,o){const f=t.length;if(!f)return;const l=Math.ceil(Math.sqrt(f)),g=Math.ceil(f/l),h=a/l,r=p/g,i=Math.min(h,r)*.1;for(let e=0;e<f;e++){const u=e%l,y=Math.floor(e/l),d=c+u*h+i,b=s+y*r+i,P=h-i*2,m=r-i*2,T=W(e,M);L(n,d,b,P,m,8*o,T),j(T),n.save();const v=n.createLinearGradient(d,b,d,b+m*.5);v.addColorStop(0,"rgba(255,255,255,0.18)"),v.addColorStop(1,"rgba(255,255,255,0)"),n.fillStyle=v,n.beginPath(),n.roundRect?.(d,b,P,m,8*o),n.fill(),n.restore();const k=I(t[e].text,P-12*o,m)*o;n.font=`${k}px sans-serif`,$(n,t[e].text,d+P/2,b+m/2,P-12*o,m,k)}}function cn(n,t,c,s,a,p,M,o,f){const l=V(t),g=z(c),h=16*f;n.save(),n.fillStyle="#f7f9fc",n.strokeStyle="#e0e4ec",n.lineWidth=1,n.beginPath(),n.roundRect?.(s,a,p,M,6*f)||n.rect(s,a,p,M),n.fill(),n.stroke();const r=s+h,i=a+h,e=p-h*2,u=M-h*2;if(!l.length){n.fillStyle="#aaa",n.font=`${12*f}px sans-serif`,n.textAlign="center",n.textBaseline="middle",n.fillText("SmartArt Diagram",s+p/2,a+M/2),n.restore();return}switch(g){case"process":J(n,l,r,i,e,u,o,f);break;case"cycle":K(n,l,r,i,e,u,o,f);break;case"hierarchy":O(n,l,r,i,e,u,o,f);break;case"radial":Q(n,l,r,i,e,u,o,f);break;case"pyramid":U(n,l,r,i,e,u,o,f);break;case"funnel":Z(n,l,r,i,e,u,o,f);break;case"venn":_(n,l,r,i,e,u,o,f);break;case"matrix":w(n,l,r,i,e,u,o,f);break;case"list":q(n,l,r,i,e,u,o,f);break;case"relationship":C(n,l,r,i,e,u,o,f);break;default:x(n,l,r,i,e,u,o,f)}n.restore()}export{cn as renderSmartArt};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as r,b as e,a,S as s}from"./chunk-AEK57VVT-B2bXanTe.js";import{_ as i}from"./mermaid.core-BHqZ2SZO.js";import"./chunk-RZ5BOZE2-BNdcLGHR.js";import"./conversation-input-sync-CJiOSzCX.js";import"./index-hX_aZwq0.js";import"./ui-preferences-store-C6eXGzFs.js";import"./error-boundary-Tv9TlaZ8.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};
|