local-operator-ui 0.36.4 → 0.36.5
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 +438 -143
- package/out/preload/index.js +120 -0
- package/out/renderer/assets/{_basePickBy-DQ6BzkJm.js → _basePickBy-CxqDmmHv.js} +1 -1
- package/out/renderer/assets/{_baseUniq-D4Pzw8OZ.js → _baseUniq-DZ5q-4MO.js} +1 -1
- package/out/renderer/assets/{agent-details-page-vUtr6XRL.js → agent-details-page-BBaVqJ-k.js} +2 -2
- package/out/renderer/assets/{agent-hub-page-DLfJB8ns.js → agent-hub-page-TSnDpkEN.js} +2 -7
- package/out/renderer/assets/{agents-page-B-PHMFxF.js → agents-page-BpAcSHU9.js} +3 -3
- package/out/renderer/assets/{arc-BvXLfjiv.js → arc-Cj5oOdNk.js} +1 -1
- package/out/renderer/assets/{architectureDiagram-IEHRJDOE-DGO7ixLg.js → architectureDiagram-IEHRJDOE-BLG-Rki4.js} +1 -1
- package/out/renderer/assets/{arrow-up-D8Tgt51O.js → arrow-up-B9XooY3R.js} +1 -1
- package/out/renderer/assets/{blockDiagram-JOT3LUYC-Bpj3zFYQ.js → blockDiagram-JOT3LUYC-DJkmqNYL.js} +1 -1
- package/out/renderer/assets/{book-open-DeWHPw1t.js → book-open-CSxa_YmK.js} +1 -1
- package/out/renderer/assets/browser-page-C9MH7MXX.js +1 -0
- package/out/renderer/assets/{browser-webauthn-prompt-CLrsocAn.js → browser-webauthn-prompt-CuaS1ZyY.js} +1 -1
- package/out/renderer/assets/building-2-BgiPDMo-.js +6 -0
- package/out/renderer/assets/{c4Diagram-VJAJSXHY-tA5p19nS.js → c4Diagram-VJAJSXHY-sgmFcnZ9.js} +1 -1
- package/out/renderer/assets/channel-Ccp6y6yN.js +1 -0
- package/out/renderer/assets/{chunk-4BMEZGHF-CAtpoCnM.js → chunk-4BMEZGHF-BBWXJqFy.js} +1 -1
- package/out/renderer/assets/{chunk-A2AXSNBT-CYHy7Mvk.js → chunk-A2AXSNBT-q8UkjaB1.js} +1 -1
- package/out/renderer/assets/{chunk-AEK57VVT-B2bXanTe.js → chunk-AEK57VVT-qKzkVDpt.js} +1 -1
- package/out/renderer/assets/{chunk-D6G4REZN-DfhdrNKB.js → chunk-D6G4REZN-Cnve3iPN.js} +1 -1
- package/out/renderer/assets/{chunk-RZ5BOZE2-BNdcLGHR.js → chunk-RZ5BOZE2-CXlNa1ns.js} +1 -1
- package/out/renderer/assets/{chunk-XZIHB7SX-Caa_mRlB.js → chunk-XZIHB7SX-CH_n0WpC.js} +1 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-DWJzEShu.js +1 -0
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-DWJzEShu.js +1 -0
- package/out/renderer/assets/clone-PErpKu4z.js +1 -0
- package/out/renderer/assets/{console-mirror-BnHVC7eO.js → console-mirror-Cb5yLix0.js} +1 -1
- package/out/renderer/assets/{consoleCapture-BxykZlLx.js → consoleCapture-DTUn8btA.js} +1 -1
- package/out/renderer/assets/{conversation-input-sync-CJiOSzCX.js → conversation-input-sync-BWiC2ZNQ.js} +6 -6
- package/out/renderer/assets/{dagre-OKDRZEBW-pq4RiyaY.js → dagre-OKDRZEBW-CcLBj9dR.js} +1 -1
- package/out/renderer/assets/{diagram-SSKATNLV-DnlzCGD2.js → diagram-SSKATNLV-BnBuzUHq.js} +1 -1
- package/out/renderer/assets/{diagram-VNBRO52H-DbJ2RTVe.js → diagram-VNBRO52H-B4nIkHdB.js} +1 -1
- package/out/renderer/assets/{erDiagram-Q7BY3M3F-C56WVcbc.js → erDiagram-Q7BY3M3F-D5sW3c1J.js} +1 -1
- package/out/renderer/assets/{error-boundary-Tv9TlaZ8.js → error-boundary-DxVWsYpy.js} +2 -2
- package/out/renderer/assets/{flowDiagram-4HSFHLVR-CL1GRaaq.js → flowDiagram-4HSFHLVR-q9AjGiBl.js} +1 -1
- package/out/renderer/assets/{ganttDiagram-APWFNJXF-CES2U6dP.js → ganttDiagram-APWFNJXF-y0u1sOsY.js} +4 -4
- package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-CRyPEqXz.js → gitGraphDiagram-7IBYFJ6S-Av-mS9kO.js} +1 -1
- package/out/renderer/assets/{graph-Dtsej9jG.js → graph-D0BldG7q.js} +1 -1
- package/out/renderer/assets/hash-yZIrwUE4.js +6 -0
- package/out/renderer/assets/{index-BsV4LVu3.js → index-C6Pn32aB.js} +1 -1
- package/out/renderer/assets/index-CjToIHDL.js +57 -0
- package/out/renderer/assets/index-Ctcid6gL.css +1 -0
- package/out/renderer/assets/{index-DAoplO_Z.js → index-FVvzpk9i.js} +1 -1
- package/out/renderer/assets/{index-D0l2JJ6w.js → index-lLn4-su7.js} +208 -208
- package/out/renderer/assets/{infoDiagram-PH2N3AL5-BwRaN2ZH.js → infoDiagram-PH2N3AL5-CLYc4y61.js} +1 -1
- package/out/renderer/assets/{installer-DjflOef5.js → installer-D3I6JJnd.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-U35MCT3I-CwrSuzth.js → journeyDiagram-U35MCT3I-o0YPT9KT.js} +1 -1
- package/out/renderer/assets/{kanban-definition-NDS4AKOZ-CjW130n-.js → kanban-definition-NDS4AKOZ-B1WRSBgd.js} +1 -1
- package/out/renderer/assets/{layout-DnBx2qbk.js → layout-6qCmOzEc.js} +1 -1
- package/out/renderer/assets/{legacy-agents-page-BiAHAYWZ.js → legacy-agents-page-DlYBCvv7.js} +6 -6
- package/out/renderer/assets/library-page-CjhrFVEo.js +157 -0
- package/out/renderer/assets/{mermaid.core-BHqZ2SZO.js → mermaid.core-DePJ3QoR.js} +5 -5
- package/out/renderer/assets/mesh-page-BSJFgFCr.js +1 -0
- package/out/renderer/assets/{mindmap-definition-ALO5MXBD-Ca2VY79V.js → mindmap-definition-ALO5MXBD-BgpnkVkf.js} +1 -1
- package/out/renderer/assets/{mini-Dd3N58po.js → mini-Csq--Wlq.js} +1 -1
- package/out/renderer/assets/{notebook-pen-CcH01r1l.js → notebook-pen-Bt8ewXE9.js} +1 -1
- package/out/renderer/assets/{org-access-WIuI99P6.js → org-access-BzNFiBDx.js} +1 -1
- package/out/renderer/assets/{org-surface-gate-BsP8aWCi.js → org-surface-gate-CIJNYTYB.js} +1 -1
- package/out/renderer/assets/{page-header-ggruiR-O.js → page-header-DM0jhCF2.js} +1 -1
- package/out/renderer/assets/{pieDiagram-IB7DONF6-C7lP9J7V.js → pieDiagram-IB7DONF6-WDOJ33Hk.js} +1 -1
- package/out/renderer/assets/{projects-page-BIRVv4yi.js → projects-page-CcNU6_X8.js} +6 -6
- package/out/renderer/assets/publication-validation-BcIDRO_Q.js +1 -0
- package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-CPMEK8EO.js → quadrantDiagram-7GDLP6J5-qxT7WPZD.js} +1 -1
- package/out/renderer/assets/{radar-MK3ICKWK-sbfBaJo0.js → radar-MK3ICKWK-xGtvrCw2.js} +1 -1
- package/out/renderer/assets/{radient-auth-buttons-C0ljZy4O.js → radient-auth-buttons-D9Y-bems.js} +1 -1
- package/out/renderer/assets/{requirementDiagram-KVF5MWMF-S2rhrmTH.js → requirementDiagram-KVF5MWMF-CX_IrGLA.js} +1 -1
- package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-sNpc3Wfn.js → sankeyDiagram-QLVOVGJD-DV1ZdXxS.js} +1 -1
- package/out/renderer/assets/{schedules-page-DbZSRb3g.js → schedules-page-Ce0-woL0.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-Cv-47OeQ.js → sequenceDiagram-X6HHIX6F-DKqwb67S.js} +1 -1
- package/out/renderer/assets/{settings-page-DH9sXfEW.js → settings-page-JTZ4QBJW.js} +8 -8
- package/out/renderer/assets/smartart-BNasG3UO.js +1 -0
- package/out/renderer/assets/{stateDiagram-DGXRK772-DIBWf8qm.js → stateDiagram-DGXRK772-B7kjPArX.js} +1 -1
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-BAZmozFm.js +1 -0
- package/out/renderer/assets/{tags-input-chips-B4_gHGYO.js → tags-input-chips-Cv0lsEDt.js} +1 -1
- package/out/renderer/assets/team-bridge-page-XaIwS8Qz.js +1 -0
- package/out/renderer/assets/{timeline-definition-BDJGKUSR-CE8q2f33.js → timeline-definition-BDJGKUSR-84zVvGlx.js} +1 -1
- package/out/renderer/assets/ui-preferences-store-D0NZNchc.js +1 -0
- package/out/renderer/assets/{use-download-agent-mutation-LdjExo2g.js → use-download-agent-mutation-DeuSzNhw.js} +4 -4
- package/out/renderer/assets/{use-memberships-query-DcD9UeVY.js → use-memberships-query-yUmGp-Y1.js} +1 -1
- package/out/renderer/assets/{use-session-snapshot-Cqye2iDz.js → use-session-snapshot-D70s2vL7.js} +1 -1
- package/out/renderer/assets/{xychartDiagram-VJFVF3MP-DlbgdRgT.js → xychartDiagram-VJFVF3MP-BhpruKGF.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/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-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,11 +1,6 @@
|
|
|
1
|
-
import{r as c,j as e,c as D,t as u}from"./index-
|
|
1
|
+
import{r as c,j as e,c as D,t as u}from"./index-CjToIHDL.js";import{aQ as cs,B as Ce,aS as Ve,bI as Ws,A as os,C as X,al as Q,u as ae,a as Re,D as Ae,c as me,aN as Ie,d as Ee,bJ as We,bK as Ys,aO as Gs,bL as Js,a2 as ds,a1 as Oe,aW as us,bM as ce,by as Xs,bG as Zs,bN as et,a_ as st,bO as tt}from"./conversation-input-sync-BWiC2ZNQ.js";import{P as at}from"./page-header-DM0jhCF2.js";import{c as nt,y as J,a as C,x as _,u as he,J as it,I as te,T as ms,A as Z,z as ee,E as se,a0 as lt,a1 as rt,a2 as ct,a3 as ot,K as Ye,M as Ge,N as Je,O as Xe,P as Ze}from"./error-boundary-DxVWsYpy.js";import{a as dt,p as hs,P as xs,u as ut}from"./publication-validation-BcIDRO_Q.js";import{h as Y,O as mt,A as ht,d as xt,H as gt,a as bt,b as pt,c as ft,e as gs,C as jt,f as kt,n as yt,u as Nt,i as vt}from"./use-download-agent-mutation-DeuSzNhw.js";import{F as wt,b2 as St,b1 as Pt,a_ as Se,aQ as Tt,aK as bs,b3 as _t}from"./index-lLn4-su7.js";import{n as Pe,i as Ct,H as ps,p as es,o as fs,u as Rt}from"./org-access-BzNFiBDx.js";import{p as js,r as ks,P as ys,h as At,i as It,j as Et,u as Ot}from"./use-memberships-query-yUmGp-Y1.js";import"./ui-preferences-store-D0NZNchc.js";import{R as Ns}from"./radient-auth-buttons-D9Y-bems.js";import{f as $t}from"./format-esAOn2VS.js";import{o as Ft,a as ss}from"./org-surface-gate-CIJNYTYB.js";import{B as Lt}from"./building-2-BgiPDMo-.js";import"./en-US-CHJkXXr4.js";import"./book-open-CSxa_YmK.js";import"./console-mirror-Cb5yLix0.js";/**
|
|
2
2
|
* @license lucide-react v0.507.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const Lt=[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]],zt=ms("building-2",Lt);/**
|
|
7
|
-
* @license lucide-react v0.507.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const Mt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M7 12h.01",key:"eqddd0"}]],Dt=ms("circle-ellipsis",Mt),qt=({agent:s,isLiked:t,isFavourited:n,onLikeToggle:a,onFavouriteToggle:i,onDownload:o,isLikeActionLoading:m=!1,isFavouriteActionLoading:w=!1,isDownloading:y=!1,actionError:j=null,onRetryAction:N,showActions:x=!0,viewerStateKnown:f=!0,orgName:g=null})=>{const S=cs(),{isAuthenticated:d}=Ce(),T=s.description??"",[R,k]=c.useState(!1),b=c.useRef(null),P=c.useCallback(L=>{if(b.current?.disconnect(),b.current=null,!L)return;const $=()=>k(L.scrollHeight-L.clientHeight>1);$();const q=new ResizeObserver($);q.observe(L),b.current=q},[]),I=d?f?t?"Unlike agent":"Like agent":"Your likes could not be read, so this is not shown as unliked.":"Log in to Radient to like agents",A=d?f?n?"Unfavourite agent":"Favourite agent":"Your favourites could not be read, so this is not shown as unfavourited.":"Log in to Radient to favourite agents",h=f?t?"Unlike agent":"Like agent":"Like state unavailable",E=f?n?"Unfavourite agent":"Favourite agent":"Favourite state unavailable",l=s.visibility==="org",p=W(s.name);return e.jsxs("div",{"data-glass-block":"",className:"flex h-full flex-col overflow-hidden rounded-md bg-surface transition-colors duration-fast ease-out-quart hover:bg-elevated",children:[e.jsxs("button",{type:"button",onClick:()=>S(`/agent-hub/${s.id}`),className:"flex min-h-0 flex-1 cursor-pointer flex-col gap-2 p-4 text-left","aria-label":`View details for ${p}`,children:[e.jsx("h3",{className:"truncate font-medium text-heading text-ink",children:p}),l&&e.jsx(mt,{orgName:g}),e.jsx(J,{content:R?T:"",children:e.jsx("span",{ref:P,className:"line-clamp-3 min-h-0 text-body-sm text-ink-muted",children:T})}),e.jsxs("div",{className:"mt-auto flex flex-col gap-2 pt-2",children:[e.jsx(ht,{tags:s.tags,categories:s.categories}),e.jsxs("p",{className:"truncate text-ink-dim text-meta",children:[s.account_metadata?.name??"Unknown author",e.jsx("span",{"aria-hidden":"true",className:"mx-1.5",children:"·"}),"updated ",xt(new Date(s.updated_at))," ago"]})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-t border-hairline px-3 py-2",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-0.5","data-viewer-state":l?"org":d?f?"known":"unknown":"signed-out",children:[!l&&e.jsxs(e.Fragment,{children:[e.jsx(J,{content:I,children:e.jsx("span",{children:e.jsxs(C,{variant:"ghost",size:"sm",onClick:d&&f?()=>a(s.id):void 0,disabled:m||!d||!f,"aria-label":h,className:D(t&&"text-danger"),children:[e.jsx(gt,{fill:t?"currentColor":"none","data-testid":"agent-like-heart"}),e.jsx("span",{"data-testid":"agent-like-count",className:"inline-flex h-4 min-w-4 items-center font-mono text-mono-sm text-ink-muted",children:s.like_count??0})]})})}),e.jsx(J,{content:A,children:e.jsx("span",{children:e.jsxs(C,{variant:"ghost",size:"sm",onClick:d?()=>i(s.id):void 0,disabled:w||!d||!f,"aria-label":E,className:D(n&&"text-warning"),children:[e.jsx(wt,{fill:n?"currentColor":"none","data-testid":"agent-favourite-star"}),e.jsx("span",{"data-testid":"agent-favourite-count",className:"inline-flex h-4 min-w-4 items-center font-mono text-mono-sm text-ink-muted",children:s.favourite_count??0})]})})})]}),e.jsx(J,{content:"Downloads",children:e.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 pr-1 text-ink-dim",children:[e.jsx(Ve,{"aria-hidden":"true",className:"size-3.5"}),e.jsx("span",{className:"inline-flex h-4 min-w-6 items-center font-mono text-mono-sm",children:y?e.jsx(_,{className:"h-3 w-6"}):(s.download_count??0).toLocaleString()})]})})]}),x&&o&&e.jsx("div",{className:"ml-auto flex shrink-0 items-center",children:e.jsxs(C,{variant:"secondary",size:"sm",onClick:()=>o(s),disabled:y,"aria-label":`Download ${p}`,"data-tour-tag":"agent-hub-download-button",children:[e.jsx(Ve,{"data-testid":"agent-download"}),"Get"]})})]}),j&&e.jsxs("output",{"data-testid":"agent-card-error",className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-t border-hairline px-3 py-2 text-body-sm text-danger",children:[e.jsx("span",{className:"min-w-0 flex-1",children:j}),N&&e.jsx(C,{variant:"ghost",size:"sm",onClick:N,children:"Try again"})]})]})},Ut=({agent:s,status:t,viewerStateKnown:n=!0,orgName:a=null})=>{const{isAuthenticated:i}=Ce(),[o,m]=c.useState(null),w=t?.liked??!1,y=t?.favourited??!1,j=bt(),N=pt(),x=ft(),f=()=>{!i||j.isPending||(m(null),j.mutate({agentId:s.id,isCurrentlyLiked:w},{onError:()=>m("like")}))},g=()=>{!i||N.isPending||(m(null),N.mutate({agentId:s.id,isCurrentlyFavourited:y},{onError:()=>m("favourite")}))},S=()=>{x.isPending||(m(null),x.mutate({agentId:s.id,agentName:s.name},{onError:()=>m("download")}))},d=o?o==="like"?{action:"like",error:j.error,retry:f}:o==="favourite"?{action:"favourite",error:N.error,retry:g}:{action:"download",error:x.error,retry:S}:null;return e.jsx(qt,{agent:s,isLiked:i&&w,isFavourited:i&&y,onLikeToggle:f,onFavouriteToggle:g,onDownload:S,isLikeActionLoading:j.isPending,isFavouriteActionLoading:N.isPending,isDownloading:x.isPending,viewerStateKnown:n,orgName:a,actionError:d?dt(d.action,d.error,W(s.name)):null,onRetryAction:d?.retry})},ts=({selected:s,onClick:t,children:n,...a})=>e.jsx("button",{type:"button",onClick:t,"aria-pressed":s,className:D("flex w-full cursor-pointer items-center gap-2.5 rounded-sm px-3 py-1.5 text-left","text-body-sm transition-colors duration-fast ease-out-quart",s?Pt:"text-ink hover:bg-row-hover"),...a,children:n}),as=Object.keys(jt),Bt=s=>[...s].sort((t,n)=>{const a=as.indexOf(t),i=as.indexOf(n);return a!==-1&&i!==-1?a-i:a!==-1?-1:i!==-1?1:t.localeCompare(n)}),Ht=({selectedCategory:s,onSelectCategory:t,categories:n})=>{he();const a=Bt(s&&!n.includes(s)?[...n,s]:n);return e.jsxs("div",{className:"flex h-full flex-col overflow-y-auto",children:[e.jsx("h2",{className:"mb-2 px-3 font-medium text-ink-dim text-meta",children:u("ui.hub.taxonomy.heading")}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs(ts,{selected:s===null,onClick:()=>t(null),"data-testid":"category-all",children:[e.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center",children:e.jsx(St,{size:16,"aria-hidden":"true"})}),u("ui.hub.taxonomy.all")]}),a.map(i=>{const o=bs(i),m=i==="other"?e.jsx(Dt,{size:16}):o.icon;return e.jsxs(ts,{selected:s===i,onClick:()=>t(i),"data-testid":`category-${i}`,children:[e.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center",children:m}),o.label]},i)})]})]})},Fe=({page:s,count:t,onChange:n,ariaLabel:a="Agent pages"})=>{const i=c.useRef(null),o=c.useRef(null),m=c.useRef(null);return c.useEffect(()=>{const w=m.current;m.current=null,w==="previous"&&i.current?.focus(),w==="next"&&o.current?.focus()},[s]),t<=1?null:e.jsxs("nav",{"aria-label":a,className:"mt-6 flex min-h-13 items-center justify-between gap-3 border-t border-hairline","data-testid":"agent-hub-pager",children:[e.jsxs("span",{className:"select-none text-meta text-ink-dim",children:["Page ",s," of ",t]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(C,{variant:"secondary",size:"sm",ref:i,onClick:()=>{s-1<=1&&(m.current="next"),n(s-1)},disabled:s<=1,"aria-label":"Previous page",children:[e.jsx(Ws,{"aria-hidden":"true"}),"Previous"]}),e.jsxs(C,{variant:"secondary",size:"sm",ref:o,onClick:()=>{s+1>=t&&(m.current="previous"),n(s+1)},disabled:s>=t,"aria-label":"Next page",children:["Next",e.jsx(it,{"aria-hidden":"true"})]})]})]})},ns=s=>s?.skills===1&&s.revision_cas===1;function Kt(s,t=1,n=20){const a=new URL(ks(s,"skills"));return a.searchParams.set("page",String(t)),a.searchParams.set("per_page",String(n)),ys(a.toString())}function Qt(s,t){return ys(ks(s,"skills",t))}function Vt(s){return os({operation:"org_skills.list",tenantId:s})}function Yt(s,t){return os({operation:"org_skill.get",tenantId:s,skillId:t})}const ws=12,oe={all:["public-teams"],list:(s,t)=>[...oe.all,"list",{page:s,perPage:t}],detail:s=>[...oe.all,"detail",s]},xe=(s,t)=>t instanceof vs?t.status===null?!1:t.status>=500&&s<1:s<1,Wt=({page:s=1,perPage:t=ws,enabled:n=!0}={})=>{const a=X({queryKey:oe.list(s,t),queryFn:()=>At(K.radientBaseUrl,s,t),select:i=>i.result,enabled:n,retry:xe,staleTime:3e5,gcTime:6e5,refetchOnWindowFocus:!1,placeholderData:i=>i});return{...a,teams:a.data?.records??[],isRefreshing:a.isFetching&&a.data!==void 0,pagination:a.data?{page:a.data.page,perPage:a.data.per_page,totalPages:a.data.total_pages,totalRecords:a.data.total_records}:void 0}},Gt=({teamId:s,enabled:t=!0})=>{const n=X({queryKey:oe.detail(s??""),queryFn:()=>It(K.radientBaseUrl,s),select:a=>a.result,enabled:t&&!!s,retry:xe,staleTime:3e5,gcTime:6e5,refetchOnWindowFocus:!1,retryOnMount:!1});return{...n,team:n.data}};function ge(s){if(s.getQueryState(Ye.capabilities)?.status!=="success"||!me(s.getQueryData(Ye.capabilities),"hub_skills"))throw new Error("This backend does not support the complete Hub Skills adapter.")}function Jt(s,t,n){const a=ae(),i=Re();return X({queryKey:["hub-skills",K.radientBaseUrl,s.visibility,s.tenantId,t],enabled:n&&!i.isError&&me(i.data,"hub_skills"),queryFn:async()=>{if(ge(a),s.visibility==="org"){const m=(await Vt(s.tenantId)).result;return{rows:m.skills,pages:1,contract:m.sync_contract}}const o=(await Kt(K.radientBaseUrl,t,20)).result;return{rows:o.records,pages:o.total_pages,contract:o.sync_contract}},staleTime:3e4,retry:s.visibility==="org"?Ae:xe,retryOnMount:!1,refetchOnWindowFocus:!1})}function Xt(s,t,n){const a=ae(),i=Re();return X({queryKey:["hub-skill",K.radientBaseUrl,s.visibility,s.tenantId,t],enabled:n&&t!==null&&!i.isError&&me(i.data,"hub_skills"),queryFn:async()=>(ge(a),(s.visibility==="org"?await Yt(s.tenantId,t):await Qt(K.radientBaseUrl,t)).result),staleTime:3e4,retry:s.visibility==="org"?Ae:xe,retryOnMount:!1})}function Zt(){const s=ae();return Ie({mutationFn:t=>(ge(s),Ee({op:"hub.skillPull",requestId:t.requestId,hubId:t.remoteId,hubSource:K.radientBaseUrl,visibility:t.scope.visibility,tenantId:t.scope.tenantId,localAlias:t.alias,subscribe:t.subscribe,autoPush:t.autoPush,confirmPublicEgress:t.consent})),onSuccess:t=>{s.setQueryData(Se,t.links)},onSettled:()=>{s.invalidateQueries({queryKey:Se}),s.invalidateQueries({queryKey:["desktop","skills"]})}})}function ea(){const s=ae();return Ie({mutationFn:t=>(ge(s),Ee({op:"hub.skillPublish",requestId:t.requestId,...t.draft,dryRun:t.previewReceipt===void 0,...t.previewReceipt?{previewReceipt:t.previewReceipt,confirmPublish:!0}:{}})),onSuccess:t=>{t.local_link_receipt?.state==="complete"&&(s.invalidateQueries({queryKey:Se}),s.invalidateQueries({queryKey:["desktop","skills"]}),s.invalidateQueries({queryKey:["hub-skills"]}))}})}function sa({scope:s,source:t,verifiedCas:n,enabled:a=!0}){he();const i=c.useId(),[o,m]=c.useState(""),[w,y]=c.useState(""),[j,N]=c.useState(Pe),[x,f]=c.useState(null),[g,S]=c.useState(!1),d=ea(),T=c.useRef(null),R=X({queryKey:["desktop","skills","hub-publication"],queryFn:()=>Ee({op:"skills.list"}),staleTime:3e4,retry:!1}),k=`${s.visibility}:${s.tenantId??""}`,b=c.useRef(k);c.useEffect(()=>{b.current!==k&&(b.current=k,N(h=>({...h,autoPush:!1,confirmPublicEgress:!1})),f(null),S(!0))},[k]);const P={sourceSkill:o,localAlias:w,visibility:s.visibility,tenantId:s.tenantId,...j},I=x?Ct(x,P):!1;c.useEffect(()=>{if(!x)return;const h=setTimeout(()=>{f(null),S(!0)},Math.max(0,Math.min(Date.parse(x.expires_at)-Date.now(),2147483647)));return()=>clearTimeout(h)},[x]);const A=h=>{if(!a||d.isPending||!o||!w||h&&!I)return;const E=JSON.stringify({draft:P,receipt:h?x?.preview_receipt:null}),l=T.current&&T.current.tuple===E&&(h||d.error)?T.current:{tuple:E,id:crypto.randomUUID()};T.current=l,h||(f(null),S(!1)),d.mutate({requestId:l.id,draft:P,...h&&x?{previewReceipt:x.preview_receipt}:{}},{onSuccess:p=>{p.preview?(f(p.preview),S(!1)):es(p)&&f(null)}})};return e.jsxs("section",{className:"flex min-w-0 flex-col gap-4","data-hub-skill-publication":!0,children:[e.jsx("h3",{className:"text-heading text-ink",children:u("ui.hub.skills.publish_title")}),e.jsx("label",{htmlFor:`${i}-source`,className:"text-body-sm text-ink",children:u("ui.hub.skills.select_authored")}),e.jsxs("select",{id:`${i}-source`,"data-testid":"hub-skill-publish-source",value:o,disabled:d.isPending||!a,className:"rounded-md border border-control bg-surface px-3 py-2 text-body-sm text-ink",onChange:h=>{m(h.target.value),y(h.target.value),f(null),N(E=>({...E,autoPush:!1,confirmPublicEgress:!1}))},children:[e.jsx("option",{value:"",children:u("ui.hub.skills.select_authored")}),R.data?.data.skills.map(h=>e.jsx("option",{value:h.name,children:h.name},h.name))]}),e.jsx("label",{htmlFor:`${i}-alias`,className:"text-body-sm text-ink",children:u("ui.hub.subscriptions.alias")}),e.jsx(te,{id:`${i}-alias`,"data-testid":"hub-skill-publish-alias",value:w,disabled:d.isPending||!a,onChange:h=>{y(h.target.value),N(E=>({...E,autoPush:!1,confirmPublicEgress:!1}))}}),e.jsx("p",{className:"text-meta text-ink-muted",children:u("ui.hub.skills.text_limits")}),e.jsx(fs,{value:j,onChange:N,source:t,item:o||w,visibility:s.visibility,organization:s.organization,destinationKey:`${k}:${o}`,canEnableAutoPush:n,disabled:d.isPending||!a}),R.isLoading&&e.jsx("output",{className:"text-meta text-ink-muted",children:u("ui.hub.skills.loading")}),R.error&&e.jsx("p",{role:"alert",className:"text-body-sm text-danger",children:u("ui.hub.status.other_error")}),d.error&&e.jsx("p",{role:"alert",className:"text-body-sm text-danger",children:u("ui.hub.links.action_failed",{direction:u("ui.hub.links.direction_push"),item:o||w,source:t})}),(g||x&&!I&&x.can_confirm)&&e.jsx("p",{role:"alert",className:"text-body-sm text-warning",children:u("ui.hub.links.preview_changed")}),x&&x.visibility===s.visibility&&x.tenant_id===s.tenantId&&e.jsxs("div",{className:"flex min-w-0 flex-col gap-3",children:[e.jsx("h4",{className:"text-body-sm text-ink",children:u("ui.hub.links.preview_payload",{source:t})}),e.jsx(hs,{readOnly:!0,rows:12,"aria-label":u("ui.hub.links.preview_payload",{source:t}),value:JSON.stringify(x.proposal.fields,null,2),className:"max-h-96 bg-sunken text-mono-sm"}),x.warnings.map((h,E)=>e.jsx("p",{className:"break-words text-body-sm text-warning",children:h},`${E}-${h}`)),x.reason&&e.jsx("p",{className:"text-body-sm text-warning",children:Tt(x.reason)})]}),d.data?.publication===null&&d.data.local_link_receipt?.state==="pending-reconciliation"&&e.jsx("output",{className:"text-body-sm text-warning","data-testid":"hub-skill-pending-reconcile",children:u("ui.hub.links.publication_pending")}),d.data?.publication&&e.jsx("output",{className:"text-body-sm text-ink","data-testid":"hub-skill-published",children:es(d.data)?u("ui.hub.links.published",{item:d.data.link?.name??w,source:d.data.link?ps(d.data.link):t}):u("ui.hub.skills.policy_pending")}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(C,{variant:"outline","data-testid":"hub-skill-publish-preview",disabled:!a||d.isPending||!o||!w,onClick:()=>A(!1),children:u("ui.hub.subscriptions.preview_publish")}),e.jsx(C,{"data-testid":"hub-skill-publish-confirm",disabled:!a||d.isPending||!I,onClick:()=>A(!0),children:u("ui.hub.links.confirm_publish")})]})]})}function ta({scope:s,signedIn:t,accessible:n=!0}){he();const a=c.useId(),[i,o]=c.useState(1),[m,w]=c.useState(""),[y,j]=c.useState(null),[N,x]=c.useState(""),[f,g]=c.useState(Pe),S=c.useRef(null),d=s.visibility==="public"?u("ui.hub.links.source_public"):s.organization?u("ui.hub.links.source_private",{organization:s.organization}):u("ui.hub.links.source_unavailable"),T=Jt(s,i,n&&(s.visibility==="public"||t)),R=ns(T.data?.contract),k=Xt(s,y,R&&n),b=Zt(),P=b.data?.link?.link_id,I=k.data?.visibility===s.visibility&&(s.visibility==="public"?!k.data.tenant_id:k.data.tenant_id===s.tenantId),A=n&&!k.error&&!T.error&&I&&ns(k.data?.sync_contract)&&!!k.data?.revision,h=(T.data?.rows??[]).filter(l=>`${l.name} ${l.description}`.toLocaleLowerCase().includes(m.toLocaleLowerCase())),E=()=>{if(!y||!A||!N||b.isPending||!t)return;const l=JSON.stringify({selected:y,scope:s,alias:N,policy:f});S.current?.tuple!==l&&(S.current={tuple:l,id:crypto.randomUUID()}),b.mutate({requestId:S.current.id,remoteId:y,scope:s,alias:N,subscribe:f.subscribe,autoPush:f.autoPush,consent:f.confirmPublicEgress})};return e.jsxs("section",{className:"flex min-w-0 flex-col gap-5","data-hub-skills-library":!0,children:[e.jsxs("header",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("h2",{className:"text-heading text-ink",children:u("ui.hub.skills.title")}),e.jsx("span",{className:"text-meta text-ink-muted","data-testid":"hub-skill-source",children:d})]}),s.visibility==="org"&&!t?e.jsx("p",{role:"alert",className:"text-body-sm text-warning",children:u("ui.hub.status.no_credential")}):e.jsxs(e.Fragment,{children:[e.jsx("label",{className:"sr-only",htmlFor:`${a}-search`,children:u("ui.hub.skills.search")}),e.jsx(te,{id:`${a}-search`,"data-testid":"hub-skill-search",value:m,placeholder:u("ui.hub.skills.search"),onChange:l=>w(l.target.value)}),e.jsx("p",{className:"text-meta text-ink-muted",children:u("ui.hub.skills.search_loaded")}),T.isLoading&&e.jsx("output",{className:"min-h-20 text-body-sm text-ink-muted",children:u("ui.hub.skills.loading")}),T.error&&e.jsxs("div",{role:"alert",className:"flex flex-col gap-2 text-body-sm text-warning",children:[e.jsx("p",{children:u("ui.hub.skills.catalogue_failed",{source:d})}),e.jsx(C,{variant:"outline",disabled:T.isFetching,onClick:()=>void T.refetch(),children:u("ui.hub.links.retry")})]}),T.isSuccess&&!R&&e.jsx("p",{className:"text-body-sm text-warning",children:u("ui.hub.skills.unavailable")}),R&&e.jsxs(e.Fragment,{children:[h.length===0&&e.jsx("p",{className:"text-body-sm text-ink-muted",children:u(m?"ui.hub.skills.search_empty":"ui.hub.skills.remote_empty")}),e.jsx("div",{className:"grid min-w-0 gap-3 sm:grid-cols-2",children:h.map(l=>e.jsxs("div",{className:"flex min-w-0 flex-col gap-3 rounded-md border border-hairline p-4",children:[e.jsx("h3",{className:"break-words text-body-sm font-medium text-ink",children:l.name}),e.jsx("p",{className:"break-words text-meta text-ink-muted",children:l.description}),e.jsx(C,{variant:"outline","aria-pressed":y===l.id,"data-testid":"hub-skill-open",disabled:b.isPending,onClick:()=>{j(l.id),x(l.name),g(Pe()),b.reset()},children:u("ui.hub.skills.open_detail",{item:l.name})})]},l.id))}),e.jsx(Fe,{page:i,count:T.data?.pages??1,onChange:o,ariaLabel:u("ui.hub.skills.title")})]})]}),y&&R&&e.jsxs("section",{className:"flex min-w-0 flex-col gap-3 border-t border-hairline pt-4","data-hub-skill-detail":!0,children:[k.isLoading&&e.jsx("output",{className:"text-meta text-ink-muted",children:u("ui.hub.skills.loading")}),k.error&&e.jsx("p",{role:"alert",className:"text-body-sm text-warning",children:u("ui.hub.status.other_error")}),k.data&&I&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"break-words text-heading text-ink",children:k.data.name}),e.jsx("p",{className:"text-meta text-ink-muted",children:u("ui.hub.skills.file_count",{count:k.data.files.length})}),k.data.files.map(l=>e.jsxs("details",{className:"min-w-0",children:[e.jsx("summary",{className:"break-words text-mono-sm text-ink",children:l.path}),e.jsx(hs,{readOnly:!0,rows:12,"aria-label":l.path,value:l.content,className:"max-h-96 bg-sunken text-mono-sm"})]},l.path)),e.jsx("label",{htmlFor:`${a}-alias`,className:"text-body-sm text-ink",children:u("ui.hub.subscriptions.alias")}),e.jsx(te,{id:`${a}-alias`,"data-testid":"hub-skill-alias",value:N,disabled:b.isPending,onChange:l=>{x(l.target.value),g(p=>({...p,autoPush:!1,confirmPublicEgress:!1}))}}),e.jsx("p",{className:"text-meta text-ink-muted",children:u("ui.hub.skills.pull_help")}),e.jsx(fs,{value:f,onChange:g,source:d,item:N,visibility:s.visibility,organization:s.organization,destinationKey:`${s.visibility}:${s.tenantId??""}:${y}`,canEnableAutoPush:!!A,disabled:b.isPending}),e.jsx(C,{"data-testid":"hub-skill-create",disabled:!t||!A||!N||b.isPending,onClick:E,children:u("ui.hub.subscriptions.create_copy")})]}),!t&&e.jsx("p",{className:"text-meta text-ink-muted",children:u("ui.hub.status.no_credential")}),(b.error||b.data&&!b.data.reports?.some(l=>l.applied||l.outcome==="unchanged"))&&e.jsx("p",{role:"alert",className:"text-body-sm text-danger","data-testid":"hub-skill-pull-failed",children:u("ui.hub.skills.pull_failed")}),b.data?.link&&b.data.reports?.some(l=>l.link_id===P&&l.direction==="pull"&&l.applied)&&e.jsx("output",{className:"text-body-sm text-ink","data-testid":"hub-skill-installed",children:u("ui.hub.skills.installed_alias",{item:b.data.link.name,source:ps(b.data.link)})}),b.data?.link&&e.jsx("p",{className:"text-meta text-ink-muted",children:u("ui.hub.skills.session_selection")})]}),!n&&e.jsx("p",{role:"alert",className:"text-body-sm text-warning",children:u("ui.hub.status.access_lost")}),e.jsx("div",{className:"border-t border-hairline pt-5",children:e.jsx(sa,{scope:s,source:d,verifiedCas:R&&n&&t,enabled:R&&n&&t})})]})}const Ss={all:["org-teams"],list:s=>[...Ss.all,"list",s]},Ps=({tenantId:s,enabled:t=!0})=>{const n=X({queryKey:Ss.list(s??""),queryFn:async()=>(await Et(s)).result??{teams:[]},enabled:t&&!!s,staleTime:3e5,gcTime:6e5,refetchOnWindowFocus:!1,retryOnMount:!1,retry:Ae});return{...n,teams:n.data?.teams??[]}},aa=(s,t)=>{const n=s?.name?.trim()||t?.trim()||"Team",a=s?.renamed_from?.trim()||null;return s?.invalid_name===!0&&a?{level:"warning",message:`Pulled "${n}". The published name "${a}" is not usable locally, so the team was stored as "${n}".`}:a?{level:"success",message:`Pulled "${n}" (you already have a team called "${a}").`}:{level:"success",message:`Pulled team "${n}".`}},Ts=()=>{const s=ae();return Ie({mutationFn:async({teamId:t,tenantId:n})=>{if(!K.baseUrl)throw new Error("Local Operator API URL is not configured.");return Xs.pullOrgTeamFromRadient(K.baseUrl,t,n)},onSuccess:(t,n)=>{const a=aa(t.result,n.name);a.level==="warning"?Gs(a.message):Js(a.message),s.invalidateQueries({queryKey:["desktop","teams"]})},onError:t=>{console.error("Pulling an organization team failed:",t)}})},na=/^v/i,_s=s=>s.members.reduce((t,n)=>t+n.count,0),ia=s=>s.count>1?`${s.role} ×${s.count}`:s.role,Te=s=>s.members.map(ia).join(", "),Cs=s=>{const t=(s.version??"").trim().replace(na,"").trim();return t===""?null:t},Rs=s=>{const t=s.account_metadata?.name?.trim();return t||null},la=s=>{const t=(s.description??"").trim();return t===""?null:t},_e=240,ra=_e/2,ca=(s,t)=>{if(t||s.length<=_e)return s;const n=s.slice(0,_e),a=n.lastIndexOf(" ");return`${(a>=ra?n.slice(0,a):n).trimEnd()}…`},de=s=>Ft(s,"d MMM yyyy"),ue=s=>{if(!s)return null;const t=new Date(s);return Number.isNaN(t.getTime())?null:t},is=(s,t,n)=>{const a=n-t.getTime();let i;return a<0?i=de(t):a<6e4?i="just now":i=`${kt(t,new Date(n))} ago`,{label:s,when:i,iso:t.toISOString(),exact:de(t)}},oa=(s,t=Date.now())=>{const n=ue(s.updated_at);if(n)return is("updated",n,t);const a=ue(s.created_date);return a?is("created",a,t):null},da=s=>{const t=ue(s.created_date),n=ue(s.updated_at);return{created:t?de(t):null,updated:n?de(n):null}},ua=s=>s==="role"?"Role":s==="specialist"?"Specialist":s,ma=["refresh-hub","retry","sign-in"],ha=({tenantId:s,orgName:t})=>{const{teams:n,isLoading:a,isFetching:i,isError:o,error:m,refetch:w}=Ps({tenantId:s}),y=js(m),j=Ts(),[N,x]=c.useState(null),[f,g]=c.useState(null),S=c.useRef(new Map),d=c.useRef(null);c.useEffect(()=>{j.isPending||d.current===null||(S.current.get(d.current)?.focus(),d.current=null)},[j.isPending]);const[T,R]=c.useState(!1),[k,b]=c.useState(()=>new Set),P=(l,p)=>b(L=>{const $=new Set(L);return p?$.add(l):$.delete(l),$}),I=(l,p)=>{l.key!=="Escape"||!k.has(p)||(l.target instanceof Element?l.target:null)?.closest('[data-testid="org-team-pull-error"]')||(P(p,!1),l.currentTarget.querySelector("button[aria-expanded]")?.focus(),l.preventDefault())},A=c.useMemo(()=>{if(!ds(j.error))return null;const l=n.find(p=>p.id===N);return xs({code:j.error.code,message:j.error.message,details:j.error.details},{name:l?.name??"this team",hubAgentId:null,surface:"pull"})},[j.error,N,n]),h=(l,p)=>{switch(l){case"refresh-hub":w();break;case"retry":E(p);break;case"sign-in":R(!0);break}},E=l=>{j.isPending||(d.current=l.id,x(null),g(l.id),j.mutate({teamId:l.id,tenantId:s,name:l.name},{onSettled:()=>g(null),onError:()=>x(l.id)}))};return e.jsxs("section",{className:"mb-6 max-w-4xl rounded-md bg-surface","aria-label":`Teams shared with ${t??"this organization"}`,"data-testid":"org-teams",children:[a&&e.jsxs("div",{"aria-hidden":"true",className:"flex flex-col divide-y divide-hairline","data-testid":"org-teams-loading",children:[e.jsx(Ne,{}),e.jsx(Ne,{}),e.jsx(Ne,{})]}),!a&&o&&e.jsxs(Z,{variant:y?"warning":"danger",className:"m-4 w-auto","data-testid":"org-teams-error",children:[e.jsx(ee,{children:y==="plan"?"That organization needs an active Team plan":y==="no_access"?"You do not have access to that organization":"Teams could not be loaded"}),e.jsx(se,{children:y==="plan"?`Reading an organization's teams is part of the Team plan. An owner of ${t??"this organization"} can activate it in the Radient console, and then its teams will be listed here.`:y==="no_access"?`You are not a member of ${t??"that organization"}, so its teams are not listed here. An owner can invite you again.`:$e("The teams shared with this organization could not be read.",m)}),y!=="no_access"&&e.jsx("div",{className:"mt-2",children:e.jsx(C,{variant:"primary",size:"sm",onClick:()=>void w(),disabled:i,"aria-busy":i,children:i?"Trying…":"Try again"})})]}),!a&&!o&&n.length===0&&e.jsx("p",{className:"p-4 text-body-sm text-ink-muted","data-testid":"org-teams-empty",children:`Teams shared into ${t??"this organization"} appear here for its members.`}),!a&&!o&&n.length>0&&e.jsx("ul",{className:"flex flex-col divide-y divide-hairline",children:n.map(l=>e.jsxs("li",{className:D(As,"transition-colors duration-fast ease-out-quart hover:bg-elevated first:rounded-t-md last:rounded-b-md"),onKeyDown:p=>I(p,l.id),children:[e.jsx(us,{className:"min-w-0",open:k.has(l.id),onOpenChange:p=>P(l.id,p),summaryAlign:"firstLine",triggerClassName:"min-w-0",chevronClassName:"text-ink-dim mt-1",rowClassName:"py-0",summary:e.jsx(ba,{team:l,expanded:k.has(l.id)}),trailing:e.jsx("div",{className:"-mt-1 ml-3 shrink-0 self-start",children:e.jsx(C,{ref:p=>{p?S.current.set(l.id,p):S.current.delete(l.id)},variant:"secondary",size:"sm",onClick:()=>E(l),disabled:j.isPending,"aria-label":`Pull team ${W(l.name)}`,children:f===l.id?"Pulling…":"Pull"})}),children:e.jsx(pa,{team:l})}),N===l.id&&e.jsxs("div",{className:"mt-1 flex flex-col items-start gap-1 pl-5","data-testid":"org-team-pull-error",children:[e.jsx("output",{className:"text-meta text-danger",children:A?.body??j.error?.message??`"${W(l.name)}" could not be pulled.`}),A?.actions.filter(p=>ma.includes(p)).map(p=>e.jsx(C,{variant:"primary",size:"sm",onClick:()=>h(p,l),children:gs[p]},p)),T&&e.jsx("div",{className:"mt-1","data-testid":"org-team-pull-reauth",children:e.jsx(Ns,{titleText:"Sign in again",descriptionText:"",onSignInSuccess:()=>{R(!1),x(null),w()}})})]})]},l.id))})]})},As="px-4 py-3",Is=()=>e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true",className:"mx-1.5",children:"·"}),e.jsx("span",{className:"sr-only",children:", "})]}),xa=({team:s})=>{const t=s.manager?.trim(),n=_s(s);return e.jsxs("span",{className:"block truncate text-meta",children:[t?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-ink-dim",children:"Manager:"})," ",e.jsx("span",{className:"text-ink-muted",children:t})]}):null,t?e.jsx(Is,{}):null,s.members.length===0?e.jsx("span",{className:"text-ink-dim",children:"No members"}):e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"text-ink-dim",children:[n," ",n===1?"member":"members",":"]})," ",e.jsx("span",{className:"text-ink-muted",children:Te(s)})]})]})},ga=({team:s})=>{const t=s.project?.trim(),n=Rs(s),a=oa(s),i=[];return t&&i.push({key:"project",node:t}),n&&i.push({key:"author",node:n}),a&&i.push({key:"recency",node:e.jsxs(e.Fragment,{children:[a.label," ",e.jsx(J,{content:a.exact,children:e.jsx("time",{dateTime:a.iso,children:a.when})})]})}),i.length===0?null:e.jsx("span",{className:"block truncate text-ink-dim text-meta",children:i.map((o,m)=>e.jsxs("span",{children:[m>0?e.jsx(Is,{}):null,o.node]},o.key))})},ba=({team:s,expanded:t})=>{const n=la(s),a=Cs(s);return e.jsxs("span",{className:"flex min-w-0 flex-col",children:[e.jsxs("span",{className:"flex min-w-0 items-baseline",children:[e.jsx("span",{className:"truncate font-medium text-body text-ink",children:W(s.name)}),a?e.jsxs("span",{className:"ml-2 shrink-0 text-ink-dim text-meta",children:["v",a]}):null]}),n?e.jsxs(e.Fragment,{children:[e.jsx("span",{...ce,"aria-hidden":"true",className:D("mt-1 select-text break-words text-body-sm text-ink-muted",t?"line-clamp-[12] whitespace-pre-line":"line-clamp-2"),children:n}),e.jsx("span",{className:"sr-only",children:ca(n,t)})]}):e.jsx("span",{className:"mt-1 text-body-sm text-ink-dim",children:"No description"}),e.jsxs("span",{className:"mt-1 flex min-w-0 flex-col",children:[e.jsx(xa,{team:s}),e.jsx(ga,{team:s})]})]})},pa=({team:s})=>{const t=s.manager?.trim(),n=da(s),a=[n.created?`Created ${n.created}`:null,n.updated?`Updated ${n.updated}`:null].filter(o=>o!==null),i=!!t||s.members.length>0;return e.jsxs("div",{className:"mt-1 flex flex-col gap-2",children:[i||a.length===0?e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("p",{className:"text-ink-dim text-meta",children:"Members"}),e.jsxs("ul",{className:"flex flex-col gap-0.5",children:[t?e.jsxs("li",{className:"flex items-baseline gap-1.5",children:[e.jsx("span",{className:"text-body-sm text-ink-muted",children:t}),e.jsx("span",{className:"text-ink-dim text-meta",children:"Manager"})]}):null,s.members.map(o=>e.jsxs("li",{className:"flex items-baseline gap-1.5",children:[e.jsx("span",{className:"text-body-sm text-ink-muted",children:o.role}),e.jsx("span",{className:"text-ink-dim text-meta",children:ua(o.kind)}),o.count>1?e.jsxs("span",{className:"text-ink-dim text-meta tabular-nums",children:["×",o.count]}):null]},`${o.kind}:${o.role}`)),i?null:e.jsx("li",{className:"text-ink-dim text-meta",children:"No members"})]})]}):null,a.length>0?e.jsx("p",{className:"text-ink-dim text-meta",children:a.join(" · ")}):null]})},Ne=()=>e.jsxs("div",{className:D(As,"pl-9"),"data-testid":"org-team-skeleton-row",children:[e.jsx("div",{className:"flex h-[1lh] items-center text-body",children:e.jsx(_,{className:"h-4.5 w-40"})}),e.jsxs("div",{className:"mt-1 flex h-[2lh] flex-col justify-evenly text-body-sm",children:[e.jsx(_,{className:"h-3.5 w-full"}),e.jsx(_,{className:"h-3.5 w-2/3"})]}),e.jsx("div",{className:"mt-1 flex h-[1lh] items-center text-meta",children:e.jsx(_,{className:"h-3 w-64"})}),e.jsx("div",{className:"flex h-[1lh] items-center text-meta",children:e.jsx(_,{className:"h-3 w-48"})})]}),Es=(s,t)=>t instanceof vs?t.message:$e(s,t),fa=["refresh-hub","retry","sign-in"],ja=({signedIn:s,onOpenSettings:t})=>{const[n,a]=c.useState(1),[i,o]=c.useState(""),{teams:m,isLoading:w,isFetching:y,isError:j,error:N,refetch:x,pagination:f}=Wt({page:n,perPage:ws}),g=Ts(),[S,d]=c.useState(null),[T,R]=c.useState(null),k=c.useRef(new Map),b=c.useRef(null);c.useEffect(()=>{g.isPending||b.current===null||(k.current.get(b.current)?.focus(),b.current=null)},[g.isPending]);const P=yt(i.trim()),I=c.useMemo(()=>P?m.filter(v=>W(v.name).toLowerCase().includes(P)||(v.description??"").toLowerCase().includes(P)):m,[m,P]),A=v=>{g.isPending||(d(null),R(v.id),b.current=v.id,g.mutate({teamId:v.id,name:v.name},{onSettled:()=>R(null),onError:()=>d(v.id)}))},h=c.useMemo(()=>{if(!ds(g.error))return null;const v=m.find(O=>O.id===S);return xs({code:g.error.code,message:g.error.message,details:g.error.details},{name:v?.name??"this team",hubAgentId:null,surface:"pull"})},[g.error,S,m]),E=h?.body??(Zs(g.error)==="unauthorized"?"The team could not be pulled: this machine has no Radient sign-in for the hub. Sign in on the settings page, then pull again.":"The team could not be pulled."),[l,p]=c.useState(!1),L=(v,O)=>{switch(v){case"refresh-hub":x();break;case"retry":A(O);break;case"sign-in":p(!0);break}},$=w&&m.length===0,q=f?.totalRecords??m.length,F=c.useRef(null),z=v=>{const O=i!=="";o(v),O&&v===""&&F.current?.focus()};return e.jsxs("section",{"aria-label":"Public teams",className:"flex flex-col","data-testid":"agent-hub-public-teams",children:[e.jsx("h2",{className:"sr-only",children:"Public teams"}),e.jsx("p",{className:"mb-3 max-w-3xl text-body-sm text-ink-muted",children:"Public teams are published to the hub by anyone and can be read here without signing in. Pulling one copies it into this machine's local team registry."}),s?null:e.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2","data-testid":"agent-hub-public-teams-signed-out",children:[e.jsx("span",{className:"text-meta text-ink-dim",children:"Sign in to Radient to pull a team into this machine."}),e.jsx(C,{variant:"secondary",size:"sm",onClick:t,children:"Open settings to sign in"})]}),e.jsx("div",{className:"mb-4 flex flex-wrap items-center gap-2",children:e.jsxs("div",{className:D("flex min-w-56 max-w-md flex-1 items-center rounded-sm border border-control bg-surface","transition-colors duration-fast ease-out-quart","has-[:focus-visible]:outline-solid has-[:focus-visible]:outline-2","has-[:focus-visible]:outline-accent has-[:focus-visible]:outline-offset-2"),children:[e.jsx(et,{"aria-hidden":"true",className:"ml-2 shrink-0 text-ink-dim"}),e.jsx(te,{ref:F,type:"search",value:i,onChange:v=>z(v.target.value),placeholder:"Search teams","aria-label":"Search teams",className:"h-8 min-w-0 flex-1 border-0 bg-transparent outline-none","data-testid":"agent-hub-public-teams-search"})]})}),$&&e.jsxs("div",{"aria-hidden":"true",className:"flex max-w-4xl flex-col gap-3","data-testid":"agent-hub-public-teams-loading",children:[e.jsx(we,{}),e.jsx(we,{}),e.jsx(we,{})]}),!$&&j&&e.jsxs(Z,{variant:"danger",className:"w-auto max-w-2xl","data-testid":"agent-hub-public-teams-error",children:[e.jsx(ee,{children:"Public teams could not be loaded"}),e.jsx(se,{children:Es("The public team catalogue could not be read.",N)}),e.jsx("div",{className:"mt-2",children:e.jsx(C,{variant:"primary",size:"sm",onClick:()=>void x(),disabled:y,"aria-busy":y,children:y?"Trying…":"Try again"})})]}),!$&&!j&&m.length===0&&e.jsx("p",{className:"max-w-2xl text-body-sm text-ink-muted","data-testid":"agent-hub-public-teams-empty",children:"No teams have been published to the public hub yet."}),!$&&!j&&m.length>0&&e.jsxs(e.Fragment,{children:[!P||I.length>0?e.jsxs("p",{className:"mb-3 text-meta text-ink-dim","data-testid":"agent-hub-public-teams-status",children:[P?`${I.length} of ${m.length} teams on this page match "${i.trim()}"`:`${q} ${q===1?"team":"teams"} in the public hub`,P?e.jsxs("span",{className:"text-ink-dim",children:[" ","· search covers the teams loaded here"]}):null]}):null,I.length===0?e.jsx("p",{className:"max-w-2xl text-body-sm text-ink-muted","data-testid":"agent-hub-public-teams-search-miss",children:`No team on this page matches "${i.trim()}".`}):e.jsx("ul",{className:"flex max-w-4xl flex-col gap-3",children:I.map(v=>e.jsx(ka,{team:v,pulling:T===v.id,pullPending:g.isPending,onPull:A,pullButtonRef:O=>{O?k.current.set(v.id,O):k.current.delete(v.id)},failed:S===v.id,failureBody:E,treatment:h,onTreatmentAction:L,reauthenticating:l,onReauthenticated:()=>{p(!1),d(null),x()}},v.id))}),!P&&f&&f.totalPages>1&&e.jsx(Fe,{count:f.totalPages,page:f.page,onChange:v=>{a(v),F.current?.scrollIntoView({block:"nearest"})}})]})]})},ka=({team:s,pulling:t,pullPending:n,onPull:a,failed:i,failureBody:o,treatment:m,onTreatmentAction:w,reauthenticating:y,onReauthenticated:j,pullButtonRef:N})=>{const[x,f]=c.useState(!1),g=Gt({teamId:x?s.id:void 0}),S=W(s.name),d=Cs(s),T=Rs(s),R=s.manager?.trim(),k=_s(s),b=(s.description??"").trim();return e.jsxs("li",{className:"rounded-md bg-surface p-4","data-testid":"agent-hub-public-team","data-team-name":s.name,children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-baseline",children:[e.jsx("h3",{className:"truncate font-medium text-heading text-ink",children:S}),d?e.jsxs("span",{className:"ml-2 shrink-0 text-ink-dim text-meta",children:["v",d]}):null]}),b?e.jsx("p",{...ce,className:"mt-1 line-clamp-3 max-w-3xl select-text text-body-sm text-ink-muted",children:b}):e.jsx("p",{className:"mt-1 text-body-sm text-ink-dim",children:"No description"}),e.jsxs("p",{className:"mt-2 flex flex-wrap items-baseline gap-x-2 text-meta",children:[R?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-ink-dim",children:"Manager:"}),e.jsx("span",{className:"text-ink-muted",children:R})]}):null,s.members.length===0?e.jsx("span",{className:"text-ink-dim",children:"No members"}):e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"text-ink-dim",children:[k," ",k===1?"member":"members",":"]}),e.jsx(J,{content:Te(s),children:e.jsx("span",{className:"truncate text-ink-muted",children:Te(s)})})]})]}),T?e.jsxs("p",{className:"mt-1 text-ink-dim text-meta",children:["Published by ",e.jsx("span",{className:"text-ink-muted",children:T})]}):null]}),e.jsxs("div",{className:"flex shrink-0 flex-col items-end gap-2",children:[e.jsx(C,{ref:N,variant:"secondary",size:"sm",onClick:()=>a(s),disabled:n,"aria-label":`Pull team ${S}`,children:t?"Pulling…":"Pull"}),i&&e.jsxs("div",{className:"flex max-w-56 flex-col items-end gap-1","data-testid":"agent-hub-public-team-pull-error",children:[e.jsx("output",{className:"text-right text-meta text-danger",children:o}),m?.actions.filter(P=>fa.includes(P)).map(P=>e.jsx(C,{variant:"primary",size:"sm",onClick:()=>w(P,s),children:gs[P]},P)),y&&e.jsx("div",{"data-testid":"agent-hub-public-team-pull-reauth",children:e.jsx(Ns,{titleText:"Sign in again",descriptionText:"",onSignInSuccess:j})})]})]})]}),e.jsx("div",{className:"mt-2",children:e.jsx(us,{summary:"Brief",open:x,onOpenChange:f,className:"w-full",triggerClassName:"w-full",triggerLabel:`View the brief for ${S}`,chevronClassName:"text-ink-dim",children:e.jsx(ya,{detail:g})})})]})},ya=({detail:s})=>{if(s.isLoading)return e.jsxs("div",{className:"flex flex-col gap-1","data-testid":"agent-hub-public-team-brief-loading",children:[e.jsx(_,{className:"h-[1lh] w-2/3"}),e.jsx(_,{className:"h-[2lh] w-full"})]});if(s.isError)return e.jsxs("div",{className:"flex flex-col items-start gap-1",children:[e.jsx("output",{className:"text-meta text-danger",children:Es("This team's brief could not be read.",s.error)}),e.jsx(C,{variant:"primary",size:"sm",onClick:()=>void s.refetch(),disabled:s.isFetching,"aria-busy":s.isFetching,children:s.isFetching?"Trying…":"Try again"})]});const t=s.team;if(!t)return null;const n=(t.instructions??"").trim(),a=(t.project??"").trim();return e.jsxs("div",{className:"flex max-w-3xl flex-col gap-3 text-body-sm","data-testid":"agent-hub-public-team-brief",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("p",{className:"text-ink-dim text-meta",children:"Collaboration brief"}),n?e.jsx("p",{...ce,className:"whitespace-pre-line select-text text-ink-muted",children:n}):e.jsx("p",{className:"text-ink-dim",children:"This team has no collaboration brief."})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("p",{className:"text-ink-dim text-meta",children:"Project brief"}),a?e.jsx("p",{...ce,className:"whitespace-pre-line select-text text-ink-muted",children:a}):e.jsx("p",{className:"text-ink-dim",children:"This team has no project brief."})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("p",{className:"text-ink-dim text-meta",children:"Roster"}),e.jsxs("ul",{className:"flex flex-col gap-0.5",children:[t.manager?.trim()?e.jsxs("li",{className:"flex items-baseline gap-1.5",children:[e.jsx("span",{className:"text-body-sm text-ink-muted",children:t.manager.trim()}),e.jsx("span",{className:"text-ink-dim text-meta",children:"Manager"})]}):null,t.members.length===0?e.jsx("li",{className:"text-ink-dim",children:"No members"}):t.members.map(i=>e.jsxs("li",{className:"flex items-baseline gap-1.5",children:[e.jsx("span",{className:"text-body-sm text-ink-muted",children:i.count>1?`${i.role} ×${i.count}`:i.role}),e.jsx("span",{className:"text-ink-dim text-meta",children:i.kind})]},`${i.kind}:${i.role}`))]})]})]})},we=()=>e.jsxs("div",{className:"rounded-md bg-surface p-4",children:[e.jsx(_,{className:"h-[1lh] w-1/3"}),e.jsx(_,{className:"mt-1 flex h-[3lh] w-full"}),e.jsx(_,{className:"mt-2 h-[1lh] w-2/3"})]}),va=(s,t)=>{const[n,a]=c.useState(s);return c.useEffect(()=>{const i=setTimeout(()=>a(s),t);return()=>clearTimeout(i)},[s,t]),n},re=[{value:"download_count:desc",label:"Most downloaded",sort:"download_count",order:"desc"},{value:"like_count:desc",label:"Most liked",sort:"like_count",order:"desc"},{value:"favourite_count:desc",label:"Most favourited",sort:"favourite_count",order:"desc"},{value:"created_at:desc",label:"Newest",sort:"created_at",order:"desc"},{value:"updated_at:desc",label:"Recently updated",sort:"updated_at",order:"desc"},{value:"name:asc",label:"Name (A to Z)",sort:"name",order:"asc"}],Na=[{value:"name",label:"Name"},{value:"description",label:"Description"}],wa=300,Y="public",ls={agents:"agent-hub-view-agents",teams:"agent-hub-view-teams",skills:"agent-hub-view-skills"},rs="agent-hub-view-panel",Sa=()=>e.jsxs("div",{className:"flex h-full flex-col overflow-hidden rounded-md bg-surface",children:[e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2 p-4",children:[e.jsx(_,{className:"h-5.5 w-2/3"}),e.jsx(_,{className:"h-3.5 w-full"}),e.jsx(_,{className:"h-3.5 w-full"}),e.jsx(_,{className:"h-3.5 w-1/2"}),e.jsxs("div",{className:"mt-auto flex flex-col gap-2 pt-2",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(_,{className:"h-5.5 w-24"}),e.jsx(_,{className:"h-5.5 w-20"})]}),e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsx(_,{className:"h-5.5 w-24"})})]}),e.jsx(_,{className:"h-4.5 w-32"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 border-t border-hairline px-3 py-2",children:[e.jsx(_,{className:"size-4"}),e.jsx(_,{className:"h-4 w-6"}),e.jsx(_,{className:"size-4"}),e.jsx(_,{className:"h-4 w-6"}),e.jsx(_,{className:"ml-auto h-7 w-16"})]})]}),Ua=()=>{const s=cs(),{isAuthenticated:t}=Ce(),[n,a]=c.useState(1),[i]=c.useState(12),[o,m]=c.useState(null),[w,y]=c.useState(""),[j,N]=c.useState("name"),[x,f]=c.useState(re[0].value),[g,S]=c.useState(Y),[d,T]=c.useState("agents");he();const[R,k]=c.useState([]),b=va(w,wa),P=re.find(r=>r.value===x)??re[0],I=Re(),A=!I.isError&&me(I.data,"hub_skills"),h=d==="skills"&&!A?"agents":d;c.useEffect(()=>{d==="skills"&&!A&&T("agents")},[d,A]);const E=st(),l=tt(I.data,"radient_org"),p=t?Ot(l,E??null):null,{memberships:L}=$t({enabled:ss(l)}),$=c.useMemo(()=>Rt(L),[L]),q=g===Y||$.some(r=>r.tenant_id===g);c.useEffect(()=>{!q&&h!=="skills"&&S(Y)},[q,h]);const F=g===Y?null:$.find(r=>r.tenant_id===g)??null,z=F?.tenant_id,v=F?.tenant_name||null,O=o!==null||b!=="",be=Ps({tenantId:z}),ne=z&&be.isSuccess&&!O?be.teams.length:null,$s=F?.role==="owner"||F?.role==="admin",Fs=c.useMemo(()=>new Map(L.map(r=>[r.tenant_id,r.tenant_name])),[L]),{data:ie,agents:Os,isLoading:Ls,isFetching:U,error:Q,refetch:Oe,pagination:B}=ut({page:n,perPage:i,categories:o?[o]:void 0,name:j==="name"&&b||void 0,description:j==="description"&&b||void 0,sort:P.sort,order:P.order,tenantId:z}),G=F?js(Q):null,le=Os??[],Le=U&&ie!==void 0,{statuses:ze,isKnown:zs,isError:Ms,isFetching:pe,refetch:Ds}=vt({agentIds:z?[]:le.map(r=>r.id)}),fe=c.useRef(null),je=c.useRef(null),[Me,qs]=c.useState(0);c.useEffect(()=>{Me!==0&&(fe.current??je.current)?.focus()},[Me]);const De=c.useRef(null),ke=c.useRef(!1),ye=c.useMemo(()=>[...new Set((ie?.records??[]).flatMap(r=>r.categories??[]))],[ie]);c.useEffect(()=>{k(r=>ye.every(V=>r.includes(V))?r:[...new Set([...r,...ye])])},[ye]);const Us=()=>{m(null),y(""),a(1),qs(r=>r+1)},M=(Ls||U)&&ie===void 0,qe=!M&&!O&&(Q!==null||le.length===0);c.useEffect(()=>{!ke.current||M||(ke.current=!1,Q?De.current?.focus():(fe.current??je.current)?.focus())},[M,Q]);const Ue=c.useRef(null),Bs=r=>{a(r),Ue.current?.scrollIntoView({block:"nearest"})},Hs=r=>{m(r),a(1)},Ks=r=>{y(r),a(1)},Qs=r=>{S(r),a(1)},Be=c.useRef(new Map),Vs=r=>{N(r),a(1)},He=B&&!O?B.totalRecords:null,ve=z?`shared with ${v??"this organization"}`:"in the public hub",Ke=(r,V)=>`${r} ${V}${r===1?"":"s"} ${ve}`;let H;return h==="skills"?H=" ":h==="teams"?z?be.isLoading?H="Loading teams…":ne!==null?H=Ke(ne,"team"):H=`Teams ${ve}`:H=" ":M?H="Loading agents…":B?H=Ke(B.totalRecords,"agent"):H=`Agents ${ve}`,e.jsxs("div",{className:"flex h-full flex-col gap-8 p-6",children:[e.jsx(nt,{title:"Agent hub",subtitle:"Discover and download community agents on Radient",icon:_t}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-4",children:[p&&e.jsxs(Z,{variant:"warning",className:"max-w-2xl","data-testid":"agent-hub-org-unavailable",children:[e.jsx(ee,{children:"Organizations are unavailable"}),e.jsx(se,{children:p})]}),e.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-x-4 gap-y-2","data-testid":"agent-hub-browse-bar",children:[e.jsx(lt,{value:h,onValueChange:r=>T(r),children:e.jsx(rt,{"aria-label":"Browse the hub by type",children:["agents","teams",...A?["skills"]:[]].map(r=>e.jsxs(ct,{value:r,id:ls[r],"aria-controls":h===r?rs:void 0,"data-testid":`agent-hub-view-${r}`,children:[r==="agents"?"Agents":r==="teams"?"Teams":u("ui.hub.skills.title"),r!=="skills"&&(r==="agents"?He:ne)!==null&&e.jsx("span",{className:"min-w-[2ch] font-normal text-ink-dim tabular-nums",children:r==="agents"?He:ne})]},r))})}),$.length>0&&e.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-2",children:[e.jsx("span",{"aria-hidden":"true",className:"text-meta text-ink-muted",children:"Showing"}),e.jsxs("fieldset",{className:"m-0 min-w-0 border-0 p-0","data-testid":"agent-hub-scope",children:[e.jsx("legend",{className:"sr-only",children:"Show the hub of"}),e.jsx("div",{className:"flex flex-wrap gap-0.5 rounded-md bg-sunken p-0.5",children:[{value:Y,label:"Public hub",Icon:at},...$.map(r=>({value:r.tenant_id,label:r.tenant_name||"Organization",Icon:zt}))].map(({value:r,label:V,Icon:Ys})=>e.jsxs(C,{ref:Qe=>{Qe?Be.current.set(r,Qe):Be.current.delete(r)},variant:"ghost",size:"sm","aria-pressed":g===r,onClick:()=>Qs(r),title:V,"data-testid":`agent-hub-scope-${r===Y?"public":`org-${r}`}`,className:D("max-w-48",g===r&&"bg-surface text-ink hover:bg-surface"),children:[e.jsx(Ys,{"aria-hidden":"true"}),e.jsx("span",{className:"truncate",children:V})]},r))})]})]})]}),e.jsx(ot,{id:rs,labelledBy:ls[h],children:e.jsxs("div",{className:"flex min-h-0 flex-1 flex-row overflow-hidden",children:[h==="agents"&&e.jsx(e.Fragment,{children:e.jsx("div",{className:"mr-6 hidden w-60 shrink-0 rounded-md bg-surface p-2 md:block","data-glass-region":"panel","data-tour-tag":"agent-hub-sidebar-container",children:!qe&&e.jsx(Ht,{selectedCategory:o,onSelectCategory:Hs,categories:R})})}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-y-auto",children:[h==="agents"&&!qe&&e.jsxs("div",{className:"mb-4 flex flex-wrap items-center gap-2",children:[e.jsxs("div",{className:D("flex min-w-56 flex-1 items-center rounded-sm border border-control bg-surface","transition-colors duration-fast ease-out-quart","has-[:focus-visible]:outline-solid has-[:focus-visible]:outline-2","has-[:focus-visible]:outline-accent has-[:focus-visible]:outline-offset-2"),children:[e.jsx(te,{ref:fe,type:"search",value:w,onChange:r=>Ks(r.target.value),placeholder:"Search agents","aria-label":"Search agents",className:"h-8 min-w-0 flex-1 border-0 bg-transparent outline-none","data-testid":"agent-hub-search"}),e.jsxs(We,{value:j,onValueChange:Vs,children:[e.jsx(Ge,{className:"w-auto shrink-0 border-y-0 border-l border-hairline border-r-0 bg-transparent pl-2 outline-none","aria-label":"Search in","data-testid":"agent-hub-search-scope",children:e.jsx(Je,{})}),e.jsx(Xe,{children:Na.map(r=>e.jsx(Ze,{value:r.value,children:r.label},r.value))})]})]}),e.jsxs(We,{value:x,onValueChange:f,children:[e.jsx(Ge,{className:"w-48","aria-label":"Sort agents","data-testid":"agent-hub-sort",children:e.jsx(Je,{})}),e.jsx(Xe,{children:re.map(r=>e.jsx(Ze,{value:r.value,children:r.label},r.value))})]})]}),e.jsxs("p",{ref:Ue,"aria-live":"polite",className:"mb-3 text-meta text-ink-dim","data-testid":"agent-hub-status",children:[H,h==="agents"&&Le?e.jsxs(e.Fragment,{children:[" ",e.jsx("span",{"data-testid":"agent-hub-updating",children:"Updating…"})]}):null]}),h==="agents"&&e.jsxs(e.Fragment,{children:[t&&Ms&&e.jsxs("output",{className:"mb-3 flex flex-wrap items-center gap-2 text-meta text-warning","data-testid":"agent-hub-status-unknown",children:[e.jsx("span",{children:"Your likes and favourites could not be read, so no card shows a viewer state."}),e.jsx(C,{variant:"ghost",size:"sm",onClick:()=>void Ds(),disabled:pe,"aria-busy":pe,children:pe?"Trying…":"Try again"})]}),M&&e.jsx("div",{"data-testid":"agent-hub-loading",className:"grid grid-cols-[repeat(auto-fill,minmax(17.5rem,1fr))] gap-6",children:Array.from({length:6},(r,V)=>e.jsx(Sa,{},V))}),M&&B===void 0&&e.jsx("div",{"aria-hidden":"true",className:"mt-6 flex min-h-13 items-center justify-center","data-testid":"agent-hub-pager-placeholder",children:e.jsx(_,{className:"h-4 w-24"})}),e.jsx("output",{"aria-live":"polite","data-testid":"agent-hub-outage",className:D(!M&&Q&&!G?"block":"sr-only"),children:!M&&Q&&!G&&e.jsxs(Z,{variant:"danger",className:"max-w-2xl","aria-busy":U,"data-testid":"agent-hub-error",children:[e.jsx(ee,{children:t?"The hub could not be loaded":"Sign in to use the hub"}),e.jsx(se,{children:t?$e("The agent list could not be loaded.",Q):"You are not signed in to Radient, so the hub has no credential to read the agent list with. Sign in on the settings page, then try again."}),e.jsx("div",{className:"mt-2",children:e.jsx(C,{ref:De,variant:"outline",size:"sm",onClick:()=>{ke.current=!0,Oe()},disabled:U,"aria-busy":U,children:U?"Trying…":"Try again"})})]})}),!M&&G&&F&&e.jsxs(Z,{variant:"warning",className:"max-w-2xl","data-testid":"agent-hub-org-no-access",children:[e.jsx(ee,{children:G==="plan"?"That organization needs an active Team plan":"You do not have access to that organization"}),e.jsx(se,{children:G==="plan"?`Sharing agents inside an organization is part of the Team plan. An owner of ${F.tenant_name||"this organization"} can activate it in the Radient console, and then its agents will be listed here.`:`You are not a member of ${F.tenant_name||"that organization"}, so its agents are not listed here. An owner can invite you again.`}),G==="plan"&&e.jsx("div",{className:"mt-2",children:e.jsx(C,{variant:"primary",size:"sm",onClick:()=>void Oe(),disabled:U,"aria-busy":U,children:U?"Trying…":"Try again"})})]}),!M&&!Q&&e.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(17.5rem,1fr))] gap-6","aria-busy":Le,children:le.length===0?e.jsxs("div",{"data-testid":"agent-hub-empty",className:D("col-span-full w-full flex flex-col items-center gap-2 rounded-md bg-surface px-6 py-10 text-center",!z&&"max-w-2xl justify-self-center"),children:[e.jsx("p",{className:"text-heading text-ink",children:z?"This organization has no shared agents yet.":o?`No agents in ${bs(o).label}.`:O?"No agents match that search.":"The hub is empty."}),e.jsx("p",{className:"max-w-md text-body-sm text-ink-muted",children:z?`Agents published into ${F?.tenant_name||"this organization"} appear here for its members.`:o?"Nothing in this category yet. Clear the filter to see the whole hub.":O?"No agent's name or description carries that. Clear it to see the whole hub.":"Nobody has published an agent yet. Yours could be the first."}),e.jsx("div",{className:"mt-2 flex flex-wrap items-center justify-center gap-2",children:O?e.jsx(C,{variant:"secondary",onClick:Us,children:o?"Clear filter":"Clear search"}):z&&!$s?null:e.jsx(C,{ref:je,variant:"secondary",onClick:()=>s("/agents"),children:"Publish an agent"})})]}):le.map(r=>e.jsx(Ut,{agent:r,status:t?ze[r.id]:void 0,viewerStateKnown:t&&Nt(zs,ze,r.id),orgName:r.visibility==="org"?Fs.get(r.tenant_id)??null:null},r.id))}),!M&&B&&B.totalPages>1&&e.jsx(Fe,{count:B.totalPages,page:B.page,onChange:Bs})]}),h==="skills"&&(A?e.jsx(ta,{scope:g===Y?{visibility:"public",tenantId:null,organization:null}:{visibility:"org",tenantId:g,organization:v},signedIn:t,accessible:q&&(g===Y||ss(l))},`skills:${g}`):e.jsx("p",{className:"text-body-sm text-warning",children:u("ui.hub.skills.unavailable")})),h==="teams"&&(F?e.jsx(ha,{tenantId:F.tenant_id,orgName:v}):e.jsx(ja,{signedIn:t,onOpenSettings:()=>s("/settings")}))]})]})})]})]})};export{Ua as AgentHubPage};
|
|
6
|
+
*/const zt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M7 12h.01",key:"eqddd0"}]],Mt=nt("circle-ellipsis",zt),Dt=({agent:s,isLiked:t,isFavourited:n,onLikeToggle:a,onFavouriteToggle:i,onDownload:o,isLikeActionLoading:m=!1,isFavouriteActionLoading:w=!1,isDownloading:y=!1,actionError:j=null,onRetryAction:v,showActions:x=!0,viewerStateKnown:f=!0,orgName:g=null})=>{const S=cs(),{isAuthenticated:d}=Ce(),T=s.description??"",[R,k]=c.useState(!1),b=c.useRef(null),P=c.useCallback(L=>{if(b.current?.disconnect(),b.current=null,!L)return;const O=()=>k(L.scrollHeight-L.clientHeight>1);O();const q=new ResizeObserver(O);q.observe(L),b.current=q},[]),I=d?f?t?"Unlike agent":"Like agent":"Your likes could not be read, so this is not shown as unliked.":"Log in to Radient to like agents",A=d?f?n?"Unfavourite agent":"Favourite agent":"Your favourites could not be read, so this is not shown as unfavourited.":"Log in to Radient to favourite agents",h=f?t?"Unlike agent":"Like agent":"Like state unavailable",E=f?n?"Unfavourite agent":"Favourite agent":"Favourite state unavailable",l=s.visibility==="org",p=Y(s.name);return e.jsxs("div",{"data-glass-block":"",className:"flex h-full flex-col overflow-hidden rounded-md bg-surface transition-colors duration-fast ease-out-quart hover:bg-elevated",children:[e.jsxs("button",{type:"button",onClick:()=>S(`/agent-hub/${s.id}`),className:"flex min-h-0 flex-1 cursor-pointer flex-col gap-2 p-4 text-left","aria-label":`View details for ${p}`,children:[e.jsx("h3",{className:"truncate font-medium text-heading text-ink",children:p}),l&&e.jsx(mt,{orgName:g}),e.jsx(J,{content:R?T:"",children:e.jsx("span",{ref:P,className:"line-clamp-3 min-h-0 text-body-sm text-ink-muted",children:T})}),e.jsxs("div",{className:"mt-auto flex flex-col gap-2 pt-2",children:[e.jsx(ht,{tags:s.tags,categories:s.categories}),e.jsxs("p",{className:"truncate text-ink-dim text-meta",children:[s.account_metadata?.name??"Unknown author",e.jsx("span",{"aria-hidden":"true",className:"mx-1.5",children:"·"}),"updated ",xt(new Date(s.updated_at))," ago"]})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-t border-hairline px-3 py-2",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-0.5","data-viewer-state":l?"org":d?f?"known":"unknown":"signed-out",children:[!l&&e.jsxs(e.Fragment,{children:[e.jsx(J,{content:I,children:e.jsx("span",{children:e.jsxs(C,{variant:"ghost",size:"sm",onClick:d&&f?()=>a(s.id):void 0,disabled:m||!d||!f,"aria-label":h,className:D(t&&"text-danger"),children:[e.jsx(gt,{fill:t?"currentColor":"none","data-testid":"agent-like-heart"}),e.jsx("span",{"data-testid":"agent-like-count",className:"inline-flex h-4 min-w-4 items-center font-mono text-mono-sm text-ink-muted",children:s.like_count??0})]})})}),e.jsx(J,{content:A,children:e.jsx("span",{children:e.jsxs(C,{variant:"ghost",size:"sm",onClick:d?()=>i(s.id):void 0,disabled:w||!d||!f,"aria-label":E,className:D(n&&"text-warning"),children:[e.jsx(wt,{fill:n?"currentColor":"none","data-testid":"agent-favourite-star"}),e.jsx("span",{"data-testid":"agent-favourite-count",className:"inline-flex h-4 min-w-4 items-center font-mono text-mono-sm text-ink-muted",children:s.favourite_count??0})]})})})]}),e.jsx(J,{content:"Downloads",children:e.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 pr-1 text-ink-dim",children:[e.jsx(Ve,{"aria-hidden":"true",className:"size-3.5"}),e.jsx("span",{className:"inline-flex h-4 min-w-6 items-center font-mono text-mono-sm",children:y?e.jsx(_,{className:"h-3 w-6"}):(s.download_count??0).toLocaleString()})]})})]}),x&&o&&e.jsx("div",{className:"ml-auto flex shrink-0 items-center",children:e.jsxs(C,{variant:"secondary",size:"sm",onClick:()=>o(s),disabled:y,"aria-label":`Download ${p}`,"data-tour-tag":"agent-hub-download-button",children:[e.jsx(Ve,{"data-testid":"agent-download"}),"Get"]})})]}),j&&e.jsxs("output",{"data-testid":"agent-card-error",className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-t border-hairline px-3 py-2 text-body-sm text-danger",children:[e.jsx("span",{className:"min-w-0 flex-1",children:j}),v&&e.jsx(C,{variant:"ghost",size:"sm",onClick:v,children:"Try again"})]})]})},qt=({agent:s,status:t,viewerStateKnown:n=!0,orgName:a=null})=>{const{isAuthenticated:i}=Ce(),[o,m]=c.useState(null),w=t?.liked??!1,y=t?.favourited??!1,j=bt(),v=pt(),x=ft(),f=()=>{!i||j.isPending||(m(null),j.mutate({agentId:s.id,isCurrentlyLiked:w},{onError:()=>m("like")}))},g=()=>{!i||v.isPending||(m(null),v.mutate({agentId:s.id,isCurrentlyFavourited:y},{onError:()=>m("favourite")}))},S=()=>{x.isPending||(m(null),x.mutate({agentId:s.id,agentName:s.name},{onError:()=>m("download")}))},d=o?o==="like"?{action:"like",error:j.error,retry:f}:o==="favourite"?{action:"favourite",error:v.error,retry:g}:{action:"download",error:x.error,retry:S}:null;return e.jsx(Dt,{agent:s,isLiked:i&&w,isFavourited:i&&y,onLikeToggle:f,onFavouriteToggle:g,onDownload:S,isLikeActionLoading:j.isPending,isFavouriteActionLoading:v.isPending,isDownloading:x.isPending,viewerStateKnown:n,orgName:a,actionError:d?dt(d.action,d.error,Y(s.name)):null,onRetryAction:d?.retry})},ts=({selected:s,onClick:t,children:n,...a})=>e.jsx("button",{type:"button",onClick:t,"aria-pressed":s,className:D("flex w-full cursor-pointer items-center gap-2.5 rounded-sm px-3 py-1.5 text-left","text-body-sm transition-colors duration-fast ease-out-quart",s?Pt:"text-ink hover:bg-row-hover"),...a,children:n}),as=Object.keys(jt),Ut=s=>[...s].sort((t,n)=>{const a=as.indexOf(t),i=as.indexOf(n);return a!==-1&&i!==-1?a-i:a!==-1?-1:i!==-1?1:t.localeCompare(n)}),Bt=({selectedCategory:s,onSelectCategory:t,categories:n})=>{he();const a=Ut(s&&!n.includes(s)?[...n,s]:n);return e.jsxs("div",{className:"flex h-full flex-col overflow-y-auto",children:[e.jsx("h2",{className:"mb-2 px-3 font-medium text-ink-dim text-meta",children:u("ui.hub.taxonomy.heading")}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs(ts,{selected:s===null,onClick:()=>t(null),"data-testid":"category-all",children:[e.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center",children:e.jsx(St,{size:16,"aria-hidden":"true"})}),u("ui.hub.taxonomy.all")]}),a.map(i=>{const o=gs(i),m=i==="other"?e.jsx(Mt,{size:16}):o.icon;return e.jsxs(ts,{selected:s===i,onClick:()=>t(i),"data-testid":`category-${i}`,children:[e.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center",children:m}),o.label]},i)})]})]})},$e=({page:s,count:t,onChange:n,ariaLabel:a="Agent pages"})=>{const i=c.useRef(null),o=c.useRef(null),m=c.useRef(null);return c.useEffect(()=>{const w=m.current;m.current=null,w==="previous"&&i.current?.focus(),w==="next"&&o.current?.focus()},[s]),t<=1?null:e.jsxs("nav",{"aria-label":a,className:"mt-6 flex min-h-13 items-center justify-between gap-3 border-t border-hairline","data-testid":"agent-hub-pager",children:[e.jsxs("span",{className:"select-none text-meta text-ink-dim",children:["Page ",s," of ",t]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(C,{variant:"secondary",size:"sm",ref:i,onClick:()=>{s-1<=1&&(m.current="next"),n(s-1)},disabled:s<=1,"aria-label":"Previous page",children:[e.jsx(Ws,{"aria-hidden":"true"}),"Previous"]}),e.jsxs(C,{variant:"secondary",size:"sm",ref:o,onClick:()=>{s+1>=t&&(m.current="previous"),n(s+1)},disabled:s>=t,"aria-label":"Next page",children:["Next",e.jsx(it,{"aria-hidden":"true"})]})]})]})},ns=s=>s?.skills===1&&s.revision_cas===1;function Ht(s,t=1,n=20){const a=new URL(js(s,"skills"));return a.searchParams.set("page",String(t)),a.searchParams.set("per_page",String(n)),ks(a.toString())}function Qt(s,t){return ks(js(s,"skills",t))}function Kt(s){return os({operation:"org_skills.list",tenantId:s})}function Vt(s,t){return os({operation:"org_skill.get",tenantId:s,skillId:t})}const vs=12,oe={all:["public-teams"],list:(s,t)=>[...oe.all,"list",{page:s,perPage:t}],detail:s=>[...oe.all,"detail",s]},xe=(s,t)=>t instanceof ys?t.status===null?!1:t.status>=500&&s<1:s<1,Wt=({page:s=1,perPage:t=vs,enabled:n=!0}={})=>{const a=X({queryKey:oe.list(s,t),queryFn:()=>At(Q.radientBaseUrl,s,t),select:i=>i.result,enabled:n,retry:xe,staleTime:3e5,gcTime:6e5,refetchOnWindowFocus:!1,placeholderData:i=>i});return{...a,teams:a.data?.records??[],isRefreshing:a.isFetching&&a.data!==void 0,pagination:a.data?{page:a.data.page,perPage:a.data.per_page,totalPages:a.data.total_pages,totalRecords:a.data.total_records}:void 0}},Yt=({teamId:s,enabled:t=!0})=>{const n=X({queryKey:oe.detail(s??""),queryFn:()=>It(Q.radientBaseUrl,s),select:a=>a.result,enabled:t&&!!s,retry:xe,staleTime:3e5,gcTime:6e5,refetchOnWindowFocus:!1,retryOnMount:!1});return{...n,team:n.data}};function ge(s){if(s.getQueryState(We.capabilities)?.status!=="success"||!me(s.getQueryData(We.capabilities),"hub_skills"))throw new Error("This backend does not support the complete Hub Skills adapter.")}function Gt(s,t,n){const a=ae(),i=Re();return X({queryKey:["hub-skills",Q.radientBaseUrl,s.visibility,s.tenantId,t],enabled:n&&!i.isError&&me(i.data,"hub_skills"),queryFn:async()=>{if(ge(a),s.visibility==="org"){const m=(await Kt(s.tenantId)).result;return{rows:m.skills,pages:1,contract:m.sync_contract}}const o=(await Ht(Q.radientBaseUrl,t,20)).result;return{rows:o.records,pages:o.total_pages,contract:o.sync_contract}},staleTime:3e4,retry:s.visibility==="org"?Ae:xe,retryOnMount:!1,refetchOnWindowFocus:!1})}function Jt(s,t,n){const a=ae(),i=Re();return X({queryKey:["hub-skill",Q.radientBaseUrl,s.visibility,s.tenantId,t],enabled:n&&t!==null&&!i.isError&&me(i.data,"hub_skills"),queryFn:async()=>(ge(a),(s.visibility==="org"?await Vt(s.tenantId,t):await Qt(Q.radientBaseUrl,t)).result),staleTime:3e4,retry:s.visibility==="org"?Ae:xe,retryOnMount:!1})}function Xt(){const s=ae();return Ie({mutationFn:t=>(ge(s),Ee({op:"hub.skillPull",requestId:t.requestId,hubId:t.remoteId,hubSource:Q.radientBaseUrl,visibility:t.scope.visibility,tenantId:t.scope.tenantId,localAlias:t.alias,subscribe:t.subscribe,autoPush:t.autoPush,confirmPublicEgress:t.consent})),onSuccess:t=>{s.setQueryData(Se,t.links)},onSettled:()=>{s.invalidateQueries({queryKey:Se}),s.invalidateQueries({queryKey:["desktop","skills"]})}})}function Zt(){const s=ae();return Ie({mutationFn:t=>(ge(s),Ee({op:"hub.skillPublish",requestId:t.requestId,...t.draft,dryRun:t.previewReceipt===void 0,...t.previewReceipt?{previewReceipt:t.previewReceipt,confirmPublish:!0}:{}})),onSuccess:t=>{t.local_link_receipt?.state==="complete"&&(s.invalidateQueries({queryKey:Se}),s.invalidateQueries({queryKey:["desktop","skills"]}),s.invalidateQueries({queryKey:["hub-skills"]}))}})}function ea({scope:s,source:t,verifiedCas:n,enabled:a=!0}){he();const i=c.useId(),[o,m]=c.useState(""),[w,y]=c.useState(""),[j,v]=c.useState(Pe),[x,f]=c.useState(null),[g,S]=c.useState(!1),d=Zt(),T=c.useRef(null),R=X({queryKey:["desktop","skills","hub-publication"],queryFn:()=>Ee({op:"skills.list"}),staleTime:3e4,retry:!1}),k=`${s.visibility}:${s.tenantId??""}`,b=c.useRef(k);c.useEffect(()=>{b.current!==k&&(b.current=k,v(h=>({...h,autoPush:!1,confirmPublicEgress:!1})),f(null),S(!0))},[k]);const P={sourceSkill:o,localAlias:w,visibility:s.visibility,tenantId:s.tenantId,...j},I=x?Ct(x,P):!1;c.useEffect(()=>{if(!x)return;const h=setTimeout(()=>{f(null),S(!0)},Math.max(0,Math.min(Date.parse(x.expires_at)-Date.now(),2147483647)));return()=>clearTimeout(h)},[x]);const A=h=>{if(!a||d.isPending||!o||!w||h&&!I)return;const E=JSON.stringify({draft:P,receipt:h?x?.preview_receipt:null}),l=T.current&&T.current.tuple===E&&(h||d.error)?T.current:{tuple:E,id:crypto.randomUUID()};T.current=l,h||(f(null),S(!1)),d.mutate({requestId:l.id,draft:P,...h&&x?{previewReceipt:x.preview_receipt}:{}},{onSuccess:p=>{p.preview?(f(p.preview),S(!1)):es(p)&&f(null)}})};return e.jsxs("section",{className:"flex min-w-0 flex-col gap-4","data-hub-skill-publication":!0,children:[e.jsx("h3",{className:"text-heading text-ink",children:u("ui.hub.skills.publish_title")}),e.jsx("label",{htmlFor:`${i}-source`,className:"text-body-sm text-ink",children:u("ui.hub.skills.select_authored")}),e.jsxs("select",{id:`${i}-source`,"data-testid":"hub-skill-publish-source",value:o,disabled:d.isPending||!a,className:"rounded-md border border-control bg-surface px-3 py-2 text-body-sm text-ink",onChange:h=>{m(h.target.value),y(h.target.value),f(null),v(E=>({...E,autoPush:!1,confirmPublicEgress:!1}))},children:[e.jsx("option",{value:"",children:u("ui.hub.skills.select_authored")}),R.data?.data.skills.map(h=>e.jsx("option",{value:h.name,children:h.name},h.name))]}),e.jsx("label",{htmlFor:`${i}-alias`,className:"text-body-sm text-ink",children:u("ui.hub.subscriptions.alias")}),e.jsx(te,{id:`${i}-alias`,"data-testid":"hub-skill-publish-alias",value:w,disabled:d.isPending||!a,onChange:h=>{y(h.target.value),v(E=>({...E,autoPush:!1,confirmPublicEgress:!1}))}}),e.jsx("p",{className:"text-meta text-ink-muted",children:u("ui.hub.skills.text_limits")}),e.jsx(ps,{value:j,onChange:v,source:t,item:o||w,visibility:s.visibility,organization:s.organization,destinationKey:`${k}:${o}`,canEnableAutoPush:n,disabled:d.isPending||!a}),R.isLoading&&e.jsx("output",{className:"text-meta text-ink-muted",children:u("ui.hub.skills.loading")}),R.error&&e.jsx("p",{role:"alert",className:"text-body-sm text-danger",children:u("ui.hub.status.other_error")}),d.error&&e.jsx("p",{role:"alert",className:"text-body-sm text-danger",children:u("ui.hub.links.action_failed",{direction:u("ui.hub.links.direction_push"),item:o||w,source:t})}),(g||x&&!I&&x.can_confirm)&&e.jsx("p",{role:"alert",className:"text-body-sm text-warning",children:u("ui.hub.links.preview_changed")}),x&&x.visibility===s.visibility&&x.tenant_id===s.tenantId&&e.jsxs("div",{className:"flex min-w-0 flex-col gap-3",children:[e.jsx("h4",{className:"text-body-sm text-ink",children:u("ui.hub.links.preview_payload",{source:t})}),e.jsx(ms,{readOnly:!0,rows:12,"aria-label":u("ui.hub.links.preview_payload",{source:t}),value:JSON.stringify(x.proposal.fields,null,2),className:"max-h-96 bg-sunken text-mono-sm"}),x.warnings.map((h,E)=>e.jsx("p",{className:"break-words text-body-sm text-warning",children:h},`${E}-${h}`)),x.reason&&e.jsx("p",{className:"text-body-sm text-warning",children:Tt(x.reason)})]}),d.data?.publication===null&&d.data.local_link_receipt?.state==="pending-reconciliation"&&e.jsx("output",{className:"text-body-sm text-warning","data-testid":"hub-skill-pending-reconcile",children:u("ui.hub.links.publication_pending")}),d.data?.publication&&e.jsx("output",{className:"text-body-sm text-ink","data-testid":"hub-skill-published",children:es(d.data)?u("ui.hub.links.published",{item:d.data.link?.name??w,source:d.data.link?bs(d.data.link):t}):u("ui.hub.skills.policy_pending")}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(C,{variant:"outline","data-testid":"hub-skill-publish-preview",disabled:!a||d.isPending||!o||!w,onClick:()=>A(!1),children:u("ui.hub.subscriptions.preview_publish")}),e.jsx(C,{"data-testid":"hub-skill-publish-confirm",disabled:!a||d.isPending||!I,onClick:()=>A(!0),children:u("ui.hub.links.confirm_publish")})]})]})}function sa({scope:s,signedIn:t,accessible:n=!0}){he();const a=c.useId(),[i,o]=c.useState(1),[m,w]=c.useState(""),[y,j]=c.useState(null),[v,x]=c.useState(""),[f,g]=c.useState(Pe),S=c.useRef(null),d=s.visibility==="public"?u("ui.hub.links.source_public"):s.organization?u("ui.hub.links.source_private",{organization:s.organization}):u("ui.hub.links.source_unavailable"),T=Gt(s,i,n&&(s.visibility==="public"||t)),R=ns(T.data?.contract),k=Jt(s,y,R&&n),b=Xt(),P=b.data?.link?.link_id,I=k.data?.visibility===s.visibility&&(s.visibility==="public"?!k.data.tenant_id:k.data.tenant_id===s.tenantId),A=n&&!k.error&&!T.error&&I&&ns(k.data?.sync_contract)&&!!k.data?.revision,h=(T.data?.rows??[]).filter(l=>`${l.name} ${l.description}`.toLocaleLowerCase().includes(m.toLocaleLowerCase())),E=()=>{if(!y||!A||!v||b.isPending||!t)return;const l=JSON.stringify({selected:y,scope:s,alias:v,policy:f});S.current?.tuple!==l&&(S.current={tuple:l,id:crypto.randomUUID()}),b.mutate({requestId:S.current.id,remoteId:y,scope:s,alias:v,subscribe:f.subscribe,autoPush:f.autoPush,consent:f.confirmPublicEgress})};return e.jsxs("section",{className:"flex min-w-0 flex-col gap-5","data-hub-skills-library":!0,children:[e.jsxs("header",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("h2",{className:"text-heading text-ink",children:u("ui.hub.skills.title")}),e.jsx("span",{className:"text-meta text-ink-muted","data-testid":"hub-skill-source",children:d})]}),s.visibility==="org"&&!t?e.jsx("p",{role:"alert",className:"text-body-sm text-warning",children:u("ui.hub.status.no_credential")}):e.jsxs(e.Fragment,{children:[e.jsx("label",{className:"sr-only",htmlFor:`${a}-search`,children:u("ui.hub.skills.search")}),e.jsx(te,{id:`${a}-search`,"data-testid":"hub-skill-search",value:m,placeholder:u("ui.hub.skills.search"),onChange:l=>w(l.target.value)}),e.jsx("p",{className:"text-meta text-ink-muted",children:u("ui.hub.skills.search_loaded")}),T.isLoading&&e.jsx("output",{className:"min-h-20 text-body-sm text-ink-muted",children:u("ui.hub.skills.loading")}),T.error&&e.jsxs("div",{role:"alert",className:"flex flex-col gap-2 text-body-sm text-warning",children:[e.jsx("p",{children:u("ui.hub.skills.catalogue_failed",{source:d})}),e.jsx(C,{variant:"outline",disabled:T.isFetching,onClick:()=>void T.refetch(),children:u("ui.hub.links.retry")})]}),T.isSuccess&&!R&&e.jsx("p",{className:"text-body-sm text-warning",children:u("ui.hub.skills.unavailable")}),R&&e.jsxs(e.Fragment,{children:[h.length===0&&e.jsx("p",{className:"text-body-sm text-ink-muted",children:u(m?"ui.hub.skills.search_empty":"ui.hub.skills.remote_empty")}),e.jsx("div",{className:"grid min-w-0 gap-3 sm:grid-cols-2",children:h.map(l=>e.jsxs("div",{className:"flex min-w-0 flex-col gap-3 rounded-md border border-hairline p-4",children:[e.jsx("h3",{className:"break-words text-body-sm font-medium text-ink",children:l.name}),e.jsx("p",{className:"break-words text-meta text-ink-muted",children:l.description}),e.jsx(C,{variant:"outline","aria-pressed":y===l.id,"data-testid":"hub-skill-open",disabled:b.isPending,onClick:()=>{j(l.id),x(l.name),g(Pe()),b.reset()},children:u("ui.hub.skills.open_detail",{item:l.name})})]},l.id))}),e.jsx($e,{page:i,count:T.data?.pages??1,onChange:o,ariaLabel:u("ui.hub.skills.title")})]})]}),y&&R&&e.jsxs("section",{className:"flex min-w-0 flex-col gap-3 border-t border-hairline pt-4","data-hub-skill-detail":!0,children:[k.isLoading&&e.jsx("output",{className:"text-meta text-ink-muted",children:u("ui.hub.skills.loading")}),k.error&&e.jsx("p",{role:"alert",className:"text-body-sm text-warning",children:u("ui.hub.status.other_error")}),k.data&&I&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"break-words text-heading text-ink",children:k.data.name}),e.jsx("p",{className:"text-meta text-ink-muted",children:u("ui.hub.skills.file_count",{count:k.data.files.length})}),k.data.files.map(l=>e.jsxs("details",{className:"min-w-0",children:[e.jsx("summary",{className:"break-words text-mono-sm text-ink",children:l.path}),e.jsx(ms,{readOnly:!0,rows:12,"aria-label":l.path,value:l.content,className:"max-h-96 bg-sunken text-mono-sm"})]},l.path)),e.jsx("label",{htmlFor:`${a}-alias`,className:"text-body-sm text-ink",children:u("ui.hub.subscriptions.alias")}),e.jsx(te,{id:`${a}-alias`,"data-testid":"hub-skill-alias",value:v,disabled:b.isPending,onChange:l=>{x(l.target.value),g(p=>({...p,autoPush:!1,confirmPublicEgress:!1}))}}),e.jsx("p",{className:"text-meta text-ink-muted",children:u("ui.hub.skills.pull_help")}),e.jsx(ps,{value:f,onChange:g,source:d,item:v,visibility:s.visibility,organization:s.organization,destinationKey:`${s.visibility}:${s.tenantId??""}:${y}`,canEnableAutoPush:!!A,disabled:b.isPending}),e.jsx(C,{"data-testid":"hub-skill-create",disabled:!t||!A||!v||b.isPending,onClick:E,children:u("ui.hub.subscriptions.create_copy")})]}),!t&&e.jsx("p",{className:"text-meta text-ink-muted",children:u("ui.hub.status.no_credential")}),(b.error||b.data&&!b.data.reports?.some(l=>l.applied||l.outcome==="unchanged"))&&e.jsx("p",{role:"alert",className:"text-body-sm text-danger","data-testid":"hub-skill-pull-failed",children:u("ui.hub.skills.pull_failed")}),b.data?.link&&b.data.reports?.some(l=>l.link_id===P&&l.direction==="pull"&&l.applied)&&e.jsx("output",{className:"text-body-sm text-ink","data-testid":"hub-skill-installed",children:u("ui.hub.skills.installed_alias",{item:b.data.link.name,source:bs(b.data.link)})}),b.data?.link&&e.jsx("p",{className:"text-meta text-ink-muted",children:u("ui.hub.skills.session_selection")})]}),!n&&e.jsx("p",{role:"alert",className:"text-body-sm text-warning",children:u("ui.hub.status.access_lost")}),e.jsx("div",{className:"border-t border-hairline pt-5",children:e.jsx(ea,{scope:s,source:d,verifiedCas:R&&n&&t,enabled:R&&n&&t})})]})}const ws={all:["org-teams"],list:s=>[...ws.all,"list",s]},Ss=({tenantId:s,enabled:t=!0})=>{const n=X({queryKey:ws.list(s??""),queryFn:async()=>(await Et(s)).result??{teams:[]},enabled:t&&!!s,staleTime:3e5,gcTime:6e5,refetchOnWindowFocus:!1,retryOnMount:!1,retry:Ae});return{...n,teams:n.data?.teams??[]}},ta=(s,t)=>{const n=s?.name?.trim()||t?.trim()||"Team",a=s?.renamed_from?.trim()||null;return s?.invalid_name===!0&&a?{level:"warning",message:`Pulled "${n}". The published name "${a}" is not usable locally, so the team was stored as "${n}".`}:a?{level:"success",message:`Pulled "${n}" (you already have a team called "${a}").`}:{level:"success",message:`Pulled team "${n}".`}},Ps=()=>{const s=ae();return Ie({mutationFn:async({teamId:t,tenantId:n})=>{if(!Q.baseUrl)throw new Error("Local Operator API URL is not configured.");return Js.pullOrgTeamFromRadient(Q.baseUrl,t,n)},onSuccess:(t,n)=>{const a=ta(t.result,n.name);a.level==="warning"?Ys(a.message):Gs(a.message),s.invalidateQueries({queryKey:["desktop","teams"]})},onError:t=>{console.error("Pulling an organization team failed:",t)}})},aa=/^v/i,Ts=s=>s.members.reduce((t,n)=>t+n.count,0),na=s=>s.count>1?`${s.role} ×${s.count}`:s.role,Te=s=>s.members.map(na).join(", "),_s=s=>{const t=(s.version??"").trim().replace(aa,"").trim();return t===""?null:t},Cs=s=>{const t=s.account_metadata?.name?.trim();return t||null},ia=s=>{const t=(s.description??"").trim();return t===""?null:t},_e=240,la=_e/2,ra=(s,t)=>{if(t||s.length<=_e)return s;const n=s.slice(0,_e),a=n.lastIndexOf(" ");return`${(a>=la?n.slice(0,a):n).trimEnd()}…`},de=s=>$t(s,"d MMM yyyy"),ue=s=>{if(!s)return null;const t=new Date(s);return Number.isNaN(t.getTime())?null:t},is=(s,t,n)=>{const a=n-t.getTime();let i;return a<0?i=de(t):a<6e4?i="just now":i=`${kt(t,new Date(n))} ago`,{label:s,when:i,iso:t.toISOString(),exact:de(t)}},ca=(s,t=Date.now())=>{const n=ue(s.updated_at);if(n)return is("updated",n,t);const a=ue(s.created_date);return a?is("created",a,t):null},oa=s=>{const t=ue(s.created_date),n=ue(s.updated_at);return{created:t?de(t):null,updated:n?de(n):null}},da=s=>s==="role"?"Role":s==="specialist"?"Specialist":s,ua=["refresh-hub","retry","sign-in"],ma=({tenantId:s,orgName:t})=>{const{teams:n,isLoading:a,isFetching:i,isError:o,error:m,refetch:w}=Ss({tenantId:s}),y=fs(m),j=Ps(),[v,x]=c.useState(null),[f,g]=c.useState(null),S=c.useRef(new Map),d=c.useRef(null);c.useEffect(()=>{j.isPending||d.current===null||(S.current.get(d.current)?.focus(),d.current=null)},[j.isPending]);const[T,R]=c.useState(!1),[k,b]=c.useState(()=>new Set),P=(l,p)=>b(L=>{const O=new Set(L);return p?O.add(l):O.delete(l),O}),I=(l,p)=>{l.key!=="Escape"||!k.has(p)||(l.target instanceof Element?l.target:null)?.closest('[data-testid="org-team-pull-error"]')||(P(p,!1),l.currentTarget.querySelector("button[aria-expanded]")?.focus(),l.preventDefault())},A=c.useMemo(()=>{if(!ds(j.error))return null;const l=n.find(p=>p.id===v);return hs({code:j.error.code,message:j.error.message,details:j.error.details},{name:l?.name??"this team",hubAgentId:null,surface:"pull"})},[j.error,v,n]),h=(l,p)=>{switch(l){case"refresh-hub":w();break;case"retry":E(p);break;case"sign-in":R(!0);break}},E=l=>{j.isPending||(d.current=l.id,x(null),g(l.id),j.mutate({teamId:l.id,tenantId:s,name:l.name},{onSettled:()=>g(null),onError:()=>x(l.id)}))};return e.jsxs("section",{className:"mb-6 max-w-4xl rounded-md bg-surface","aria-label":`Teams shared with ${t??"this organization"}`,"data-testid":"org-teams",children:[a&&e.jsxs("div",{"aria-hidden":"true",className:"flex flex-col divide-y divide-hairline","data-testid":"org-teams-loading",children:[e.jsx(ve,{}),e.jsx(ve,{}),e.jsx(ve,{})]}),!a&&o&&e.jsxs(Z,{variant:y?"warning":"danger",className:"m-4 w-auto","data-testid":"org-teams-error",children:[e.jsx(ee,{children:y==="plan"?"That organization needs an active Team plan":y==="no_access"?"You do not have access to that organization":"Teams could not be loaded"}),e.jsx(se,{children:y==="plan"?`Reading an organization's teams is part of the Team plan. An owner of ${t??"this organization"} can activate it in the Radient console, and then its teams will be listed here.`:y==="no_access"?`You are not a member of ${t??"that organization"}, so its teams are not listed here. An owner can invite you again.`:Oe("The teams shared with this organization could not be read.",m)}),y!=="no_access"&&e.jsx("div",{className:"mt-2",children:e.jsx(C,{variant:"primary",size:"sm",onClick:()=>void w(),disabled:i,"aria-busy":i,children:i?"Trying…":"Try again"})})]}),!a&&!o&&n.length===0&&e.jsx("p",{className:"p-4 text-body-sm text-ink-muted","data-testid":"org-teams-empty",children:`Teams shared into ${t??"this organization"} appear here for its members.`}),!a&&!o&&n.length>0&&e.jsx("ul",{className:"flex flex-col divide-y divide-hairline",children:n.map(l=>e.jsxs("li",{className:D(Rs,"transition-colors duration-fast ease-out-quart hover:bg-elevated first:rounded-t-md last:rounded-b-md"),onKeyDown:p=>I(p,l.id),children:[e.jsx(us,{className:"min-w-0",open:k.has(l.id),onOpenChange:p=>P(l.id,p),summaryAlign:"firstLine",triggerClassName:"min-w-0",chevronClassName:"text-ink-dim mt-1",rowClassName:"py-0",summary:e.jsx(ga,{team:l,expanded:k.has(l.id)}),trailing:e.jsx("div",{className:"-mt-1 ml-3 shrink-0 self-start",children:e.jsx(C,{ref:p=>{p?S.current.set(l.id,p):S.current.delete(l.id)},variant:"secondary",size:"sm",onClick:()=>E(l),disabled:j.isPending,"aria-label":`Pull team ${Y(l.name)}`,children:f===l.id?"Pulling…":"Pull"})}),children:e.jsx(ba,{team:l})}),v===l.id&&e.jsxs("div",{className:"mt-1 flex flex-col items-start gap-1 pl-5","data-testid":"org-team-pull-error",children:[e.jsx("output",{className:"text-meta text-danger",children:A?.body??j.error?.message??`"${Y(l.name)}" could not be pulled.`}),A?.actions.filter(p=>ua.includes(p)).map(p=>e.jsx(C,{variant:"primary",size:"sm",onClick:()=>h(p,l),children:xs[p]},p)),T&&e.jsx("div",{className:"mt-1","data-testid":"org-team-pull-reauth",children:e.jsx(Ns,{titleText:"Sign in again",descriptionText:"",onSignInSuccess:()=>{R(!1),x(null),w()}})})]})]},l.id))})]})},Rs="px-4 py-3",As=()=>e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true",className:"mx-1.5",children:"·"}),e.jsx("span",{className:"sr-only",children:", "})]}),ha=({team:s})=>{const t=s.manager?.trim(),n=Ts(s);return e.jsxs("span",{className:"block truncate text-meta",children:[t?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-ink-dim",children:"Manager:"})," ",e.jsx("span",{className:"text-ink-muted",children:t})]}):null,t?e.jsx(As,{}):null,s.members.length===0?e.jsx("span",{className:"text-ink-dim",children:"No members"}):e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"text-ink-dim",children:[n," ",n===1?"member":"members",":"]})," ",e.jsx("span",{className:"text-ink-muted",children:Te(s)})]})]})},xa=({team:s})=>{const t=s.project?.trim(),n=Cs(s),a=ca(s),i=[];return t&&i.push({key:"project",node:t}),n&&i.push({key:"author",node:n}),a&&i.push({key:"recency",node:e.jsxs(e.Fragment,{children:[a.label," ",e.jsx(J,{content:a.exact,children:e.jsx("time",{dateTime:a.iso,children:a.when})})]})}),i.length===0?null:e.jsx("span",{className:"block truncate text-ink-dim text-meta",children:i.map((o,m)=>e.jsxs("span",{children:[m>0?e.jsx(As,{}):null,o.node]},o.key))})},ga=({team:s,expanded:t})=>{const n=ia(s),a=_s(s);return e.jsxs("span",{className:"flex min-w-0 flex-col",children:[e.jsxs("span",{className:"flex min-w-0 items-baseline",children:[e.jsx("span",{className:"truncate font-medium text-body text-ink",children:Y(s.name)}),a?e.jsxs("span",{className:"ml-2 shrink-0 text-ink-dim text-meta",children:["v",a]}):null]}),n?e.jsxs(e.Fragment,{children:[e.jsx("span",{...ce,"aria-hidden":"true",className:D("mt-1 select-text break-words text-body-sm text-ink-muted",t?"line-clamp-[12] whitespace-pre-line":"line-clamp-2"),children:n}),e.jsx("span",{className:"sr-only",children:ra(n,t)})]}):e.jsx("span",{className:"mt-1 text-body-sm text-ink-dim",children:"No description"}),e.jsxs("span",{className:"mt-1 flex min-w-0 flex-col",children:[e.jsx(ha,{team:s}),e.jsx(xa,{team:s})]})]})},ba=({team:s})=>{const t=s.manager?.trim(),n=oa(s),a=[n.created?`Created ${n.created}`:null,n.updated?`Updated ${n.updated}`:null].filter(o=>o!==null),i=!!t||s.members.length>0;return e.jsxs("div",{className:"mt-1 flex flex-col gap-2",children:[i||a.length===0?e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("p",{className:"text-ink-dim text-meta",children:"Members"}),e.jsxs("ul",{className:"flex flex-col gap-0.5",children:[t?e.jsxs("li",{className:"flex items-baseline gap-1.5",children:[e.jsx("span",{className:"text-body-sm text-ink-muted",children:t}),e.jsx("span",{className:"text-ink-dim text-meta",children:"Manager"})]}):null,s.members.map(o=>e.jsxs("li",{className:"flex items-baseline gap-1.5",children:[e.jsx("span",{className:"text-body-sm text-ink-muted",children:o.role}),e.jsx("span",{className:"text-ink-dim text-meta",children:da(o.kind)}),o.count>1?e.jsxs("span",{className:"text-ink-dim text-meta tabular-nums",children:["×",o.count]}):null]},`${o.kind}:${o.role}`)),i?null:e.jsx("li",{className:"text-ink-dim text-meta",children:"No members"})]})]}):null,a.length>0?e.jsx("p",{className:"text-ink-dim text-meta",children:a.join(" · ")}):null]})},ve=()=>e.jsxs("div",{className:D(Rs,"pl-9"),"data-testid":"org-team-skeleton-row",children:[e.jsx("div",{className:"flex h-[1lh] items-center text-body",children:e.jsx(_,{className:"h-4.5 w-40"})}),e.jsxs("div",{className:"mt-1 flex h-[2lh] flex-col justify-evenly text-body-sm",children:[e.jsx(_,{className:"h-3.5 w-full"}),e.jsx(_,{className:"h-3.5 w-2/3"})]}),e.jsx("div",{className:"mt-1 flex h-[1lh] items-center text-meta",children:e.jsx(_,{className:"h-3 w-64"})}),e.jsx("div",{className:"flex h-[1lh] items-center text-meta",children:e.jsx(_,{className:"h-3 w-48"})})]}),Is=(s,t)=>t instanceof ys?t.message:Oe(s,t),pa=["refresh-hub","retry","sign-in"],fa=({signedIn:s,onOpenSettings:t})=>{const[n,a]=c.useState(1),[i,o]=c.useState(""),{teams:m,isLoading:w,isFetching:y,isError:j,error:v,refetch:x,pagination:f}=Wt({page:n,perPage:vs}),g=Ps(),[S,d]=c.useState(null),[T,R]=c.useState(null),k=c.useRef(new Map),b=c.useRef(null);c.useEffect(()=>{g.isPending||b.current===null||(k.current.get(b.current)?.focus(),b.current=null)},[g.isPending]);const P=yt(i.trim()),I=c.useMemo(()=>P?m.filter(N=>Y(N.name).toLowerCase().includes(P)||(N.description??"").toLowerCase().includes(P)):m,[m,P]),A=N=>{g.isPending||(d(null),R(N.id),b.current=N.id,g.mutate({teamId:N.id,name:N.name},{onSettled:()=>R(null),onError:()=>d(N.id)}))},h=c.useMemo(()=>{if(!ds(g.error))return null;const N=m.find(F=>F.id===S);return hs({code:g.error.code,message:g.error.message,details:g.error.details},{name:N?.name??"this team",hubAgentId:null,surface:"pull"})},[g.error,S,m]),E=h?.body??(Xs(g.error)==="unauthorized"?"The team could not be pulled: this machine has no Radient sign-in for the hub. Sign in on the settings page, then pull again.":"The team could not be pulled."),[l,p]=c.useState(!1),L=(N,F)=>{switch(N){case"refresh-hub":x();break;case"retry":A(F);break;case"sign-in":p(!0);break}},O=w&&m.length===0,q=f?.totalRecords??m.length,$=c.useRef(null),z=N=>{const F=i!=="";o(N),F&&N===""&&$.current?.focus()};return e.jsxs("section",{"aria-label":"Public teams",className:"flex flex-col","data-testid":"agent-hub-public-teams",children:[e.jsx("h2",{className:"sr-only",children:"Public teams"}),e.jsx("p",{className:"mb-3 max-w-3xl text-body-sm text-ink-muted",children:"Public teams are published to the hub by anyone and can be read here without signing in. Pulling one copies it into this machine's local team registry."}),s?null:e.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2","data-testid":"agent-hub-public-teams-signed-out",children:[e.jsx("span",{className:"text-meta text-ink-dim",children:"Sign in to Radient to pull a team into this machine."}),e.jsx(C,{variant:"secondary",size:"sm",onClick:t,children:"Open settings to sign in"})]}),e.jsx("div",{className:"mb-4 flex flex-wrap items-center gap-2",children:e.jsxs("div",{className:D("flex min-w-56 max-w-md flex-1 items-center rounded-sm border border-control bg-surface","transition-colors duration-fast ease-out-quart","has-[:focus-visible]:outline-solid has-[:focus-visible]:outline-2","has-[:focus-visible]:outline-accent has-[:focus-visible]:outline-offset-2"),children:[e.jsx(Zs,{"aria-hidden":"true",className:"ml-2 shrink-0 text-ink-dim"}),e.jsx(te,{ref:$,type:"search",value:i,onChange:N=>z(N.target.value),placeholder:"Search teams","aria-label":"Search teams",className:"h-8 min-w-0 flex-1 border-0 bg-transparent outline-none","data-testid":"agent-hub-public-teams-search"})]})}),O&&e.jsxs("div",{"aria-hidden":"true",className:"flex max-w-4xl flex-col gap-3","data-testid":"agent-hub-public-teams-loading",children:[e.jsx(we,{}),e.jsx(we,{}),e.jsx(we,{})]}),!O&&j&&e.jsxs(Z,{variant:"danger",className:"w-auto max-w-2xl","data-testid":"agent-hub-public-teams-error",children:[e.jsx(ee,{children:"Public teams could not be loaded"}),e.jsx(se,{children:Is("The public team catalogue could not be read.",v)}),e.jsx("div",{className:"mt-2",children:e.jsx(C,{variant:"primary",size:"sm",onClick:()=>void x(),disabled:y,"aria-busy":y,children:y?"Trying…":"Try again"})})]}),!O&&!j&&m.length===0&&e.jsx("p",{className:"max-w-2xl text-body-sm text-ink-muted","data-testid":"agent-hub-public-teams-empty",children:"No teams have been published to the public hub yet."}),!O&&!j&&m.length>0&&e.jsxs(e.Fragment,{children:[!P||I.length>0?e.jsxs("p",{className:"mb-3 text-meta text-ink-dim","data-testid":"agent-hub-public-teams-status",children:[P?`${I.length} of ${m.length} teams on this page match "${i.trim()}"`:`${q} ${q===1?"team":"teams"} in the public hub`,P?e.jsxs("span",{className:"text-ink-dim",children:[" ","· search covers the teams loaded here"]}):null]}):null,I.length===0?e.jsx("p",{className:"max-w-2xl text-body-sm text-ink-muted","data-testid":"agent-hub-public-teams-search-miss",children:`No team on this page matches "${i.trim()}".`}):e.jsx("ul",{className:"flex max-w-4xl flex-col gap-3",children:I.map(N=>e.jsx(ja,{team:N,pulling:T===N.id,pullPending:g.isPending,onPull:A,pullButtonRef:F=>{F?k.current.set(N.id,F):k.current.delete(N.id)},failed:S===N.id,failureBody:E,treatment:h,onTreatmentAction:L,reauthenticating:l,onReauthenticated:()=>{p(!1),d(null),x()}},N.id))}),!P&&f&&f.totalPages>1&&e.jsx($e,{count:f.totalPages,page:f.page,onChange:N=>{a(N),$.current?.scrollIntoView({block:"nearest"})}})]})]})},ja=({team:s,pulling:t,pullPending:n,onPull:a,failed:i,failureBody:o,treatment:m,onTreatmentAction:w,reauthenticating:y,onReauthenticated:j,pullButtonRef:v})=>{const[x,f]=c.useState(!1),g=Yt({teamId:x?s.id:void 0}),S=Y(s.name),d=_s(s),T=Cs(s),R=s.manager?.trim(),k=Ts(s),b=(s.description??"").trim();return e.jsxs("li",{className:"rounded-md bg-surface p-4","data-testid":"agent-hub-public-team","data-team-name":s.name,children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-baseline",children:[e.jsx("h3",{className:"truncate font-medium text-heading text-ink",children:S}),d?e.jsxs("span",{className:"ml-2 shrink-0 text-ink-dim text-meta",children:["v",d]}):null]}),b?e.jsx("p",{...ce,className:"mt-1 line-clamp-3 max-w-3xl select-text text-body-sm text-ink-muted",children:b}):e.jsx("p",{className:"mt-1 text-body-sm text-ink-dim",children:"No description"}),e.jsxs("p",{className:"mt-2 flex flex-wrap items-baseline gap-x-2 text-meta",children:[R?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-ink-dim",children:"Manager:"}),e.jsx("span",{className:"text-ink-muted",children:R})]}):null,s.members.length===0?e.jsx("span",{className:"text-ink-dim",children:"No members"}):e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"text-ink-dim",children:[k," ",k===1?"member":"members",":"]}),e.jsx(J,{content:Te(s),children:e.jsx("span",{className:"truncate text-ink-muted",children:Te(s)})})]})]}),T?e.jsxs("p",{className:"mt-1 text-ink-dim text-meta",children:["Published by ",e.jsx("span",{className:"text-ink-muted",children:T})]}):null]}),e.jsxs("div",{className:"flex shrink-0 flex-col items-end gap-2",children:[e.jsx(C,{ref:v,variant:"secondary",size:"sm",onClick:()=>a(s),disabled:n,"aria-label":`Pull team ${S}`,children:t?"Pulling…":"Pull"}),i&&e.jsxs("div",{className:"flex max-w-56 flex-col items-end gap-1","data-testid":"agent-hub-public-team-pull-error",children:[e.jsx("output",{className:"text-right text-meta text-danger",children:o}),m?.actions.filter(P=>pa.includes(P)).map(P=>e.jsx(C,{variant:"primary",size:"sm",onClick:()=>w(P,s),children:xs[P]},P)),y&&e.jsx("div",{"data-testid":"agent-hub-public-team-pull-reauth",children:e.jsx(Ns,{titleText:"Sign in again",descriptionText:"",onSignInSuccess:j})})]})]})]}),e.jsx("div",{className:"mt-2",children:e.jsx(us,{summary:"Brief",open:x,onOpenChange:f,className:"w-full",triggerClassName:"w-full",triggerLabel:`View the brief for ${S}`,chevronClassName:"text-ink-dim",children:e.jsx(ka,{detail:g})})})]})},ka=({detail:s})=>{if(s.isLoading)return e.jsxs("div",{className:"flex flex-col gap-1","data-testid":"agent-hub-public-team-brief-loading",children:[e.jsx(_,{className:"h-[1lh] w-2/3"}),e.jsx(_,{className:"h-[2lh] w-full"})]});if(s.isError)return e.jsxs("div",{className:"flex flex-col items-start gap-1",children:[e.jsx("output",{className:"text-meta text-danger",children:Is("This team's brief could not be read.",s.error)}),e.jsx(C,{variant:"primary",size:"sm",onClick:()=>void s.refetch(),disabled:s.isFetching,"aria-busy":s.isFetching,children:s.isFetching?"Trying…":"Try again"})]});const t=s.team;if(!t)return null;const n=(t.instructions??"").trim(),a=(t.project??"").trim();return e.jsxs("div",{className:"flex max-w-3xl flex-col gap-3 text-body-sm","data-testid":"agent-hub-public-team-brief",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("p",{className:"text-ink-dim text-meta",children:"Collaboration brief"}),n?e.jsx("p",{...ce,className:"whitespace-pre-line select-text text-ink-muted",children:n}):e.jsx("p",{className:"text-ink-dim",children:"This team has no collaboration brief."})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("p",{className:"text-ink-dim text-meta",children:"Project brief"}),a?e.jsx("p",{...ce,className:"whitespace-pre-line select-text text-ink-muted",children:a}):e.jsx("p",{className:"text-ink-dim",children:"This team has no project brief."})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("p",{className:"text-ink-dim text-meta",children:"Roster"}),e.jsxs("ul",{className:"flex flex-col gap-0.5",children:[t.manager?.trim()?e.jsxs("li",{className:"flex items-baseline gap-1.5",children:[e.jsx("span",{className:"text-body-sm text-ink-muted",children:t.manager.trim()}),e.jsx("span",{className:"text-ink-dim text-meta",children:"Manager"})]}):null,t.members.length===0?e.jsx("li",{className:"text-ink-dim",children:"No members"}):t.members.map(i=>e.jsxs("li",{className:"flex items-baseline gap-1.5",children:[e.jsx("span",{className:"text-body-sm text-ink-muted",children:i.count>1?`${i.role} ×${i.count}`:i.role}),e.jsx("span",{className:"text-ink-dim text-meta",children:i.kind})]},`${i.kind}:${i.role}`))]})]})]})},we=()=>e.jsxs("div",{className:"rounded-md bg-surface p-4",children:[e.jsx(_,{className:"h-[1lh] w-1/3"}),e.jsx(_,{className:"mt-1 flex h-[3lh] w-full"}),e.jsx(_,{className:"mt-2 h-[1lh] w-2/3"})]}),ya=(s,t)=>{const[n,a]=c.useState(s);return c.useEffect(()=>{const i=setTimeout(()=>a(s),t);return()=>clearTimeout(i)},[s,t]),n},re=[{value:"download_count:desc",label:"Most downloaded",sort:"download_count",order:"desc"},{value:"like_count:desc",label:"Most liked",sort:"like_count",order:"desc"},{value:"favourite_count:desc",label:"Most favourited",sort:"favourite_count",order:"desc"},{value:"created_at:desc",label:"Newest",sort:"created_at",order:"desc"},{value:"updated_at:desc",label:"Recently updated",sort:"updated_at",order:"desc"},{value:"name:asc",label:"Name (A to Z)",sort:"name",order:"asc"}],Na=[{value:"name",label:"Name"},{value:"description",label:"Description"}],va=300,W="public",ls={agents:"agent-hub-view-agents",teams:"agent-hub-view-teams",skills:"agent-hub-view-skills"},rs="agent-hub-view-panel",wa=()=>e.jsxs("div",{className:"flex h-full flex-col overflow-hidden rounded-md bg-surface",children:[e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2 p-4",children:[e.jsx(_,{className:"h-5.5 w-2/3"}),e.jsx(_,{className:"h-3.5 w-full"}),e.jsx(_,{className:"h-3.5 w-full"}),e.jsx(_,{className:"h-3.5 w-1/2"}),e.jsxs("div",{className:"mt-auto flex flex-col gap-2 pt-2",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(_,{className:"h-5.5 w-24"}),e.jsx(_,{className:"h-5.5 w-20"})]}),e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsx(_,{className:"h-5.5 w-24"})})]}),e.jsx(_,{className:"h-4.5 w-32"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 border-t border-hairline px-3 py-2",children:[e.jsx(_,{className:"size-4"}),e.jsx(_,{className:"h-4 w-6"}),e.jsx(_,{className:"size-4"}),e.jsx(_,{className:"h-4 w-6"}),e.jsx(_,{className:"ml-auto h-7 w-16"})]})]}),Ua=()=>{const s=cs(),{isAuthenticated:t}=Ce(),[n,a]=c.useState(1),[i]=c.useState(12),[o,m]=c.useState(null),[w,y]=c.useState(""),[j,v]=c.useState("name"),[x,f]=c.useState(re[0].value),[g,S]=c.useState(W),[d,T]=c.useState("agents");he();const[R,k]=c.useState([]),b=ya(w,va),P=re.find(r=>r.value===x)??re[0],I=Re(),A=!I.isError&&me(I.data,"hub_skills"),h=d==="skills"&&!A?"agents":d;c.useEffect(()=>{d==="skills"&&!A&&T("agents")},[d,A]);const E=et(),l=st(I.data,"radient_org"),p=t?Ft(l,E??null):null,{memberships:L}=Ot({enabled:ss(l)}),O=c.useMemo(()=>Rt(L),[L]),q=g===W||O.some(r=>r.tenant_id===g);c.useEffect(()=>{!q&&h!=="skills"&&S(W)},[q,h]);const $=g===W?null:O.find(r=>r.tenant_id===g)??null,z=$?.tenant_id,N=$?.tenant_name||null,F=o!==null||b!=="",be=Ss({tenantId:z}),ne=z&&be.isSuccess&&!F?be.teams.length:null,Es=$?.role==="owner"||$?.role==="admin",Os=c.useMemo(()=>new Map(L.map(r=>[r.tenant_id,r.tenant_name])),[L]),{data:ie,agents:$s,isLoading:Fs,isFetching:U,error:K,refetch:Fe,pagination:B}=ut({page:n,perPage:i,categories:o?[o]:void 0,name:j==="name"&&b||void 0,description:j==="description"&&b||void 0,sort:P.sort,order:P.order,tenantId:z}),G=$?fs(K):null,le=$s??[],Le=U&&ie!==void 0,{statuses:ze,isKnown:Ls,isError:zs,isFetching:pe,refetch:Ms}=Nt({agentIds:z?[]:le.map(r=>r.id)}),fe=c.useRef(null),je=c.useRef(null),[Me,Ds]=c.useState(0);c.useEffect(()=>{Me!==0&&(fe.current??je.current)?.focus()},[Me]);const De=c.useRef(null),ke=c.useRef(!1),ye=c.useMemo(()=>[...new Set((ie?.records??[]).flatMap(r=>r.categories??[]))],[ie]);c.useEffect(()=>{k(r=>ye.every(V=>r.includes(V))?r:[...new Set([...r,...ye])])},[ye]);const qs=()=>{m(null),y(""),a(1),Ds(r=>r+1)},M=(Fs||U)&&ie===void 0,qe=!M&&!F&&(K!==null||le.length===0);c.useEffect(()=>{!ke.current||M||(ke.current=!1,K?De.current?.focus():(fe.current??je.current)?.focus())},[M,K]);const Ue=c.useRef(null),Us=r=>{a(r),Ue.current?.scrollIntoView({block:"nearest"})},Bs=r=>{m(r),a(1)},Hs=r=>{y(r),a(1)},Qs=r=>{S(r),a(1)},Be=c.useRef(new Map),Ks=r=>{v(r),a(1)},He=B&&!F?B.totalRecords:null,Ne=z?`shared with ${N??"this organization"}`:"in the public hub",Qe=(r,V)=>`${r} ${V}${r===1?"":"s"} ${Ne}`;let H;return h==="skills"?H=" ":h==="teams"?z?be.isLoading?H="Loading teams…":ne!==null?H=Qe(ne,"team"):H=`Teams ${Ne}`:H=" ":M?H="Loading agents…":B?H=Qe(B.totalRecords,"agent"):H=`Agents ${Ne}`,e.jsxs("div",{className:"flex h-full flex-col gap-8 p-6",children:[e.jsx(at,{title:"Agent hub",subtitle:"Discover and download community agents on Radient",icon:_t}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-4",children:[p&&e.jsxs(Z,{variant:"warning",className:"max-w-2xl","data-testid":"agent-hub-org-unavailable",children:[e.jsx(ee,{children:"Organizations are unavailable"}),e.jsx(se,{children:p})]}),e.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-x-4 gap-y-2","data-testid":"agent-hub-browse-bar",children:[e.jsx(lt,{value:h,onValueChange:r=>T(r),children:e.jsx(rt,{"aria-label":"Browse the hub by type",children:["agents","teams",...A?["skills"]:[]].map(r=>e.jsxs(ct,{value:r,id:ls[r],"aria-controls":h===r?rs:void 0,"data-testid":`agent-hub-view-${r}`,children:[r==="agents"?"Agents":r==="teams"?"Teams":u("ui.hub.skills.title"),r!=="skills"&&(r==="agents"?He:ne)!==null&&e.jsx("span",{className:"min-w-[2ch] font-normal text-ink-dim tabular-nums",children:r==="agents"?He:ne})]},r))})}),O.length>0&&e.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-2",children:[e.jsx("span",{"aria-hidden":"true",className:"text-meta text-ink-muted",children:"Showing"}),e.jsxs("fieldset",{className:"m-0 min-w-0 border-0 p-0","data-testid":"agent-hub-scope",children:[e.jsx("legend",{className:"sr-only",children:"Show the hub of"}),e.jsx("div",{className:"flex flex-wrap gap-0.5 rounded-md bg-sunken p-0.5",children:[{value:W,label:"Public hub",Icon:tt},...O.map(r=>({value:r.tenant_id,label:r.tenant_name||"Organization",Icon:Lt}))].map(({value:r,label:V,Icon:Vs})=>e.jsxs(C,{ref:Ke=>{Ke?Be.current.set(r,Ke):Be.current.delete(r)},variant:"ghost",size:"sm","aria-pressed":g===r,onClick:()=>Qs(r),title:V,"data-testid":`agent-hub-scope-${r===W?"public":`org-${r}`}`,className:D("max-w-48",g===r&&"bg-surface text-ink hover:bg-surface"),children:[e.jsx(Vs,{"aria-hidden":"true"}),e.jsx("span",{className:"truncate",children:V})]},r))})]})]})]}),e.jsx(ot,{id:rs,labelledBy:ls[h],children:e.jsxs("div",{className:"flex min-h-0 flex-1 flex-row overflow-hidden",children:[h==="agents"&&e.jsx(e.Fragment,{children:e.jsx("div",{className:"mr-6 hidden w-60 shrink-0 rounded-md bg-surface p-2 md:block","data-glass-region":"panel","data-tour-tag":"agent-hub-sidebar-container",children:!qe&&e.jsx(Bt,{selectedCategory:o,onSelectCategory:Bs,categories:R})})}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-y-auto",children:[h==="agents"&&!qe&&e.jsxs("div",{className:"mb-4 flex flex-wrap items-center gap-2",children:[e.jsxs("div",{className:D("flex min-w-56 flex-1 items-center rounded-sm border border-control bg-surface","transition-colors duration-fast ease-out-quart","has-[:focus-visible]:outline-solid has-[:focus-visible]:outline-2","has-[:focus-visible]:outline-accent has-[:focus-visible]:outline-offset-2"),children:[e.jsx(te,{ref:fe,type:"search",value:w,onChange:r=>Hs(r.target.value),placeholder:"Search agents","aria-label":"Search agents",className:"h-8 min-w-0 flex-1 border-0 bg-transparent outline-none","data-testid":"agent-hub-search"}),e.jsxs(Ye,{value:j,onValueChange:Ks,children:[e.jsx(Ge,{className:"w-auto shrink-0 border-y-0 border-l border-hairline border-r-0 bg-transparent pl-2 outline-none","aria-label":"Search in","data-testid":"agent-hub-search-scope",children:e.jsx(Je,{})}),e.jsx(Xe,{children:Na.map(r=>e.jsx(Ze,{value:r.value,children:r.label},r.value))})]})]}),e.jsxs(Ye,{value:x,onValueChange:f,children:[e.jsx(Ge,{className:"w-48","aria-label":"Sort agents","data-testid":"agent-hub-sort",children:e.jsx(Je,{})}),e.jsx(Xe,{children:re.map(r=>e.jsx(Ze,{value:r.value,children:r.label},r.value))})]})]}),e.jsxs("p",{ref:Ue,"aria-live":"polite",className:"mb-3 text-meta text-ink-dim","data-testid":"agent-hub-status",children:[H,h==="agents"&&Le?e.jsxs(e.Fragment,{children:[" ",e.jsx("span",{"data-testid":"agent-hub-updating",children:"Updating…"})]}):null]}),h==="agents"&&e.jsxs(e.Fragment,{children:[t&&zs&&e.jsxs("output",{className:"mb-3 flex flex-wrap items-center gap-2 text-meta text-warning","data-testid":"agent-hub-status-unknown",children:[e.jsx("span",{children:"Your likes and favourites could not be read, so no card shows a viewer state."}),e.jsx(C,{variant:"ghost",size:"sm",onClick:()=>void Ms(),disabled:pe,"aria-busy":pe,children:pe?"Trying…":"Try again"})]}),M&&e.jsx("div",{"data-testid":"agent-hub-loading",className:"grid grid-cols-[repeat(auto-fill,minmax(17.5rem,1fr))] gap-6",children:Array.from({length:6},(r,V)=>e.jsx(wa,{},V))}),M&&B===void 0&&e.jsx("div",{"aria-hidden":"true",className:"mt-6 flex min-h-13 items-center justify-center","data-testid":"agent-hub-pager-placeholder",children:e.jsx(_,{className:"h-4 w-24"})}),e.jsx("output",{"aria-live":"polite","data-testid":"agent-hub-outage",className:D(!M&&K&&!G?"block":"sr-only"),children:!M&&K&&!G&&e.jsxs(Z,{variant:"danger",className:"max-w-2xl","aria-busy":U,"data-testid":"agent-hub-error",children:[e.jsx(ee,{children:t?"The hub could not be loaded":"Sign in to use the hub"}),e.jsx(se,{children:t?Oe("The agent list could not be loaded.",K):"You are not signed in to Radient, so the hub has no credential to read the agent list with. Sign in on the settings page, then try again."}),e.jsx("div",{className:"mt-2",children:e.jsx(C,{ref:De,variant:"outline",size:"sm",onClick:()=>{ke.current=!0,Fe()},disabled:U,"aria-busy":U,children:U?"Trying…":"Try again"})})]})}),!M&&G&&$&&e.jsxs(Z,{variant:"warning",className:"max-w-2xl","data-testid":"agent-hub-org-no-access",children:[e.jsx(ee,{children:G==="plan"?"That organization needs an active Team plan":"You do not have access to that organization"}),e.jsx(se,{children:G==="plan"?`Sharing agents inside an organization is part of the Team plan. An owner of ${$.tenant_name||"this organization"} can activate it in the Radient console, and then its agents will be listed here.`:`You are not a member of ${$.tenant_name||"that organization"}, so its agents are not listed here. An owner can invite you again.`}),G==="plan"&&e.jsx("div",{className:"mt-2",children:e.jsx(C,{variant:"primary",size:"sm",onClick:()=>void Fe(),disabled:U,"aria-busy":U,children:U?"Trying…":"Try again"})})]}),!M&&!K&&e.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(17.5rem,1fr))] gap-6","aria-busy":Le,children:le.length===0?e.jsxs("div",{"data-testid":"agent-hub-empty",className:D("col-span-full w-full flex flex-col items-center gap-2 rounded-md bg-surface px-6 py-10 text-center",!z&&"max-w-2xl justify-self-center"),children:[e.jsx("p",{className:"text-heading text-ink",children:z?"This organization has no shared agents yet.":o?`No agents in ${gs(o).label}.`:F?"No agents match that search.":"The hub is empty."}),e.jsx("p",{className:"max-w-md text-body-sm text-ink-muted",children:z?`Agents published into ${$?.tenant_name||"this organization"} appear here for its members.`:o?"Nothing in this category yet. Clear the filter to see the whole hub.":F?"No agent's name or description carries that. Clear it to see the whole hub.":"Nobody has published an agent yet. Yours could be the first."}),e.jsx("div",{className:"mt-2 flex flex-wrap items-center justify-center gap-2",children:F?e.jsx(C,{variant:"secondary",onClick:qs,children:o?"Clear filter":"Clear search"}):z&&!Es?null:e.jsx(C,{ref:je,variant:"secondary",onClick:()=>s("/agents"),children:"Publish an agent"})})]}):le.map(r=>e.jsx(qt,{agent:r,status:t?ze[r.id]:void 0,viewerStateKnown:t&&vt(Ls,ze,r.id),orgName:r.visibility==="org"?Os.get(r.tenant_id)??null:null},r.id))}),!M&&B&&B.totalPages>1&&e.jsx($e,{count:B.totalPages,page:B.page,onChange:Us})]}),h==="skills"&&(A?e.jsx(sa,{scope:g===W?{visibility:"public",tenantId:null,organization:null}:{visibility:"org",tenantId:g,organization:N},signedIn:t,accessible:q&&(g===W||ss(l))},`skills:${g}`):e.jsx("p",{className:"text-body-sm text-warning",children:u("ui.hub.skills.unavailable")})),h==="teams"&&($?e.jsx(ma,{tenantId:$.tenant_id,orgName:N}):e.jsx(fa,{signedIn:t,onOpenSettings:()=>s("/settings")}))]})]})})]})]})};export{Ua as AgentHubPage};
|