@camstack/addon-admin-ui 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AddLocationWizard-D6tk8U-w.js +1 -0
- package/dist/assets/AddonCollectionPage-CPQWZfC0.js +1 -0
- package/dist/assets/Addons-BIu0hjHd.js +1 -0
- package/dist/assets/AdminPage-CN6ZMhf0.js +1 -0
- package/dist/assets/AdminTabs-Ddi8-SQJ.js +1 -0
- package/dist/assets/BrokerForm-Jzl9BAMO.js +1 -0
- package/dist/assets/BrokerStep-vbWWE4ss.js +1 -0
- package/dist/assets/Capabilities-GrzalIOH.js +1 -0
- package/dist/assets/CapabilityBadges-BN0gXK4w.js +1 -0
- package/dist/assets/Cluster-zuSKpmeo.js +7 -0
- package/dist/assets/Dashboard-Dl3BUDju.js +1 -0
- package/dist/assets/Data-DJn-KYZI.js +1 -0
- package/dist/assets/DetectionIntelligence-BhQAT1WX.js +1 -0
- package/dist/assets/DeviceDetail-C16YaYd6.js +2 -0
- package/dist/assets/Devices-D_zVs1PC.js +1 -0
- package/dist/assets/EmbedPlayerPage-BjQGYATU.js +1 -0
- package/dist/assets/FormBuilder-BXQEmfaE.js +1 -0
- package/dist/assets/Identity-ZvlfZz_A.js +1 -0
- package/dist/assets/IntegrationDetail-Bnpn2hQ2.js +1 -0
- package/dist/assets/Integrations-Bv07bA7c.js +1 -0
- package/dist/assets/Integrations-CsaOfFWR.js +1 -0
- package/dist/assets/Logs-DBoE5z_U.js +1 -0
- package/dist/assets/MaskShapeCanvas-C5K6H6Th.js +1 -0
- package/dist/assets/MotionZonesSettings-CepMSlXn.js +1 -0
- package/dist/assets/MyAccess-Bp5Cp_C6.js +2 -0
- package/dist/assets/Network-Dyg7yTc_.js +1 -0
- package/dist/assets/NodeAddonsSettingsPanel-9HVgS_gw.js +1 -0
- package/dist/assets/Pipeline-DzZm2XqD.js +1 -0
- package/dist/assets/PrivacyMaskSettings-Cl0lj_PR.js +1 -0
- package/dist/assets/ProviderIcon-DWSMqwcl.js +1 -0
- package/dist/assets/SchemaTabBar-ByWwzBUZ.js +1 -0
- package/dist/assets/Settings-ayyuAbCz.js +1 -0
- package/dist/assets/Showroom-CQ1h4YKK.js +1 -0
- package/dist/assets/StatusBadge-CkYubfRG.js +1 -0
- package/dist/assets/_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-CS4OeMKk.js +1 -0
- package/dist/assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CK8iQdP1.js +1 -0
- package/dist/assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.js-DEeasWo3.js +1 -0
- package/dist/assets/{_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.js-C2cB5JUo.js → _virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.js-C1rR7FKs.js} +1 -1
- package/dist/assets/{_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-CXx5u_N6.js → _virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-DQOBkcAT.js} +1 -1
- package/dist/assets/{_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_konva__loadShare__.js-B2sDsXg0.js → _virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_konva__loadShare__.js-PYw2UAZ_.js} +3 -3
- package/dist/assets/bell-C9HUnDGC.js +1 -0
- package/dist/assets/circle-check-big-BDdzTa9p.js +1 -0
- package/dist/assets/copy-BtC330Ic.js +1 -0
- package/dist/assets/download-CEQQi2pw.js +1 -0
- package/dist/assets/format-size-CO9d3C3-.js +1 -0
- package/dist/assets/hls-IujbK-0_.js +40 -0
- package/dist/assets/{hostInit-BTTV3T99.js → hostInit-Y3VsYAf_.js} +1 -1
- package/dist/assets/index-DuroU2aU.js +4 -0
- package/dist/assets/key-round-C1aQCNHE.js +1 -0
- package/dist/assets/{mf-entry-bootstrap-0-2d3bf175.js → mf-entry-bootstrap-0-3e98f17f.js} +2 -2
- package/dist/assets/pencil-Dw6owGVy.js +1 -0
- package/dist/assets/player-overlays-DzZKARlk.js +1 -0
- package/dist/assets/plus-CbaF5MYw.js +1 -0
- package/dist/assets/radio-CyBw1Cvj.js +1 -0
- package/dist/assets/refresh-cw-CPqFoliO.js +1 -0
- package/dist/assets/remoteEntry-BXtCFyvA.js +1 -0
- package/dist/assets/rotate-ccw-BJL6I3ju.js +1 -0
- package/dist/assets/rotate-cw-DZGWB7EU.js +1 -0
- package/dist/assets/search-cFwrysqG.js +1 -0
- package/dist/assets/server-BgZ85UtO.js +1 -0
- package/dist/assets/sparkles-Dj3mm_rJ.js +1 -0
- package/dist/assets/square-D-dTwz52.js +1 -0
- package/dist/assets/square-check-big-CMEqldHV.js +1 -0
- package/dist/assets/src-CqVYgpnN.js +34 -0
- package/dist/assets/upload-tyMJOOSL.js +1 -0
- package/dist/assets/useDevice-DTk9eLX5.js +1 -0
- package/dist/assets/useEventInvalidation-CqPABxEF.js +1 -0
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-Bkv14Bzm.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-B1bVOGqv.js} +2 -2
- package/dist/assets/wifi-Do23YMj8.js +1 -0
- package/dist/assets/zap-CZ68wiP1.js +1 -0
- package/dist/index.html +4 -3
- package/dist/sw.js +1 -1
- package/dist/workbox-14d7584c.js +1 -0
- package/package.json +1 -2
- package/dist/assets/_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BxNjjb9O.js +0 -1
- package/dist/assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-1rzf3QZV.js +0 -1
- package/dist/assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.js-CPJ7iclX.js +0 -1
- package/dist/assets/dist-q2poCTnb.js +0 -75
- package/dist/assets/index-BKoIXFjm.js +0 -82
- package/dist/assets/remoteEntry-DLAuLulq.js +0 -1
- package/dist/assets/src-BE2rTAMO.js +0 -1
- package/dist/workbox-9c191d2f.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Li as e,ci as t,li as n}from"./src-CqVYgpnN.js";import{F as r,G as i,R as a,U as o,X as s,b as c,o as l,x as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CK8iQdP1.js";import{p as d}from"./player-overlays-DzZKARlk.js";import{t as f}from"./pencil-Dw6owGVy.js";import{t as p}from"./plus-CbaF5MYw.js";import{B as m,M as h,i as g,s as _,x as v}from"./index-DuroU2aU.js";import{t as y}from"./FormBuilder-BXQEmfaE.js";var b=m(`hard-drive`,[[`line`,{x1:`22`,x2:`2`,y1:`12`,y2:`12`,key:`1y58io`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}],[`line`,{x1:`6`,x2:`6.01`,y1:`16`,y2:`16`,key:`sgf278`}],[`line`,{x1:`10`,x2:`10.01`,y1:`16`,y2:`16`,key:`1l4acy`}]]),x=m(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]);s();function S(e){let t=e.basePath;if(typeof t==`string`&&t.length>0)return t;let n=Object.keys(e);return n.length===0?``:n.join(`, `)}function C({location:e,cardinality:t,onEdit:n,onDelete:r,onSetDefault:i}){let a=S(e.config);return u(`div`,{className:`flex items-center gap-3 px-3 py-2 border-t border-border first:border-t-0 hover:bg-primary/5`,children:[u(`div`,{className:`flex items-center gap-2 min-w-0 flex-1`,children:[c(`div`,{className:`w-[88px] shrink-0`,children:e.isDefault?u(`span`,{className:`inline-flex items-center gap-0.5 rounded bg-primary/10 border border-primary/20 px-1.5 py-0.5 text-[10px] font-semibold text-primary uppercase tracking-wide`,title:`Default location for this type`,children:[c(x,{className:`h-2.5 w-2.5 fill-primary`}),`Default`]}):u(`button`,{onClick:()=>i(e),className:`inline-flex items-center gap-0.5 rounded border border-border px-1.5 py-0.5 text-[10px] font-medium text-foreground-subtle hover:text-foreground hover:bg-primary/10 hover:border-primary/30 uppercase tracking-wide`,title:`Promote to default for this type`,children:[c(x,{className:`h-2.5 w-2.5`}),`Set default`]})}),c(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle bg-background border border-border rounded px-1.5 py-0.5 font-mono`,children:e.providerId}),e.isSystem&&c(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle bg-background border border-border rounded px-1.5 py-0.5`,title:`System-managed location — cannot be deleted; edit config to relocate`,children:`system`}),u(`div`,{className:`min-w-0`,children:[c(`div`,{className:`text-xs font-medium text-foreground truncate`,children:e.displayName}),a&&c(`div`,{className:`text-[10px] text-foreground-subtle truncate font-mono`,children:a})]})]}),u(`div`,{className:`flex items-center gap-1 shrink-0`,children:[!e.isDefault&&u(`button`,{onClick:()=>i(e),className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-foreground-subtle border border-border hover:text-foreground hover:bg-primary/10`,title:`Set as default for this type`,children:[c(x,{className:`h-3 w-3`}),`Set default`]}),u(`button`,{onClick:()=>n(e),className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-foreground-subtle border border-border hover:text-foreground hover:bg-primary/10`,children:[c(f,{className:`h-3 w-3`}),`Edit`]}),!e.isSystem&&t!==`single`&&c(`button`,{onClick:()=>r(e),className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger hover:bg-danger/10`,title:`Delete location`,children:c(_,{className:`h-3 w-3`})})]})]})}function w({type:e,displayName:t,description:n,cardinality:r,locations:i,onAdd:a,onEdit:s,onDelete:l,onSetDefault:d}){let f=o(()=>{let e=[...i];return e.sort((e,t)=>e.isDefault===t.isDefault?e.displayName.localeCompare(t.displayName):e.isDefault?-1:1),e},[i]);return u(`div`,{className:`rounded-lg border border-border bg-surface`,children:[u(`div`,{className:`flex items-start justify-between border-b border-border px-3 py-2`,children:[u(`div`,{className:`space-y-0.5`,children:[u(`div`,{className:`flex items-center gap-2`,children:[c(`span`,{className:`text-sm font-semibold text-foreground capitalize`,children:t}),c(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle bg-background border border-border rounded px-1.5 py-0.5 font-mono`,children:e})]}),n&&c(`p`,{className:`text-[11px] text-foreground-subtle`,children:n}),r===`single`&&c(`p`,{className:`text-[10px] text-foreground-subtle italic`,children:`Single — one location per type. Edit the existing entry; it can't be split.`})]}),r===`multi`&&u(`button`,{onClick:()=>a(e),className:`inline-flex items-center gap-1 rounded bg-primary px-2 py-1 text-[11px] font-medium text-primary-foreground hover:bg-primary/90`,children:[c(p,{className:`h-3 w-3`}),`Add`]})]}),f.length===0?c(`div`,{className:`px-3 py-4 text-center text-[11px] text-foreground-subtle italic`,children:r===`multi`?`No location registered. Click "Add" to register one.`:`No location registered yet — should be auto-seeded at next boot.`}):c(`div`,{children:f.map(e=>c(C,{location:e,cardinality:r,onEdit:s,onDelete:l,onSetDefault:d},e.id))})]})}s();function T({nodeId:e,value:t,onChange:n}){let o=d().trpcClient,[s,l]=i([]),[f,p]=i(t),[m,h]=i(null),[g,_]=i(null),[v,y]=i(``),b=r(async t=>{_(null);try{let r=await o.filesystemBrowse.browse.query({nodeId:e,path:t});h(r),p(r.path),n(r.path)}catch(e){_(e instanceof Error?e.message:`browse failed`)}},[o,e,n]);a(()=>{(async()=>{let n=await o.filesystemBrowse.listAllowedRoots.query({nodeId:e});l(n),await b(t&&n.some(e=>t.startsWith(e))?t:n[0]??``)})()},[e]);let x=async()=>{if(!(!v.trim()||!m)){_(null);try{let t=`${m.path.replace(/\/+$/,``)}/${v.trim()}`;await o.filesystemBrowse.createDir.mutate({nodeId:e,path:t}),y(``),await b(m.path)}catch(e){_(e instanceof Error?e.message:`create failed`)}}},S=e=>`${(e/1e9).toFixed(1)} GB`;return u(`div`,{className:`space-y-2 rounded border border-border p-2`,children:[c(`div`,{className:`flex flex-wrap gap-1`,children:s.map(e=>c(`button`,{onClick:()=>void b(e),className:`rounded border border-border px-2 py-0.5 text-[10px] font-mono hover:border-primary/40`,children:e},e))}),c(`div`,{className:`text-[10px] font-mono text-foreground-subtle truncate`,children:f||`—`}),m&&u(`div`,{className:`text-[10px] text-foreground-subtle`,children:[S(m.freeBytes),` free / `,S(m.totalBytes)]}),c(`div`,{className:`max-h-40 space-y-0.5 overflow-y-auto`,children:m?.entries.map(e=>u(`button`,{onClick:()=>void b(e.path),className:`block w-full truncate rounded px-2 py-1 text-left text-xs hover:bg-primary/5`,children:[`📁 `,e.name]},e.path))}),u(`div`,{className:`flex gap-1`,children:[c(`input`,{value:v,onChange:e=>y(e.target.value),placeholder:`new folder`,className:`flex-1 rounded border border-border bg-background px-2 py-1 text-xs`}),c(`button`,{onClick:()=>void x(),className:`rounded border border-border px-2 py-1 text-xs hover:border-primary/40`,children:`Create`})]}),g&&c(`div`,{className:`text-[10px] text-red-400`,children:g})]})}s();function E({location:r,onClose:a,onSaved:s}){let f=l(),p=d().trpcClient,[m,h]=i({...r.config}),[_,b]=i(r.displayName),[x,S]=i(null),[C,w]=i(!1),E=t(),D=o(()=>{let e=E.data;return Array.isArray(e)?e.find(e=>e.providerId===r.providerId)??null:null},[E.data,r.providerId]),O=n({onSuccess:()=>{f.invalidateQueries({queryKey:[[`storage`,`listLocations`]]}),s()}}),k=D?.shouldSaveDiskSpace===!0,A=D?.nodeLocal===!0,[j,M]=i(typeof r.nodeId==`string`?r.nodeId:`hub`),N=typeof m.basePath==`string`?m.basePath:``,P=e=>h(t=>({...t,basePath:e})),F=typeof m.minFreePercent==`number`?m.minFreePercent:``,I=e=>{let t=e.trim(),n=t===``?void 0:Number(t);h(e=>{let t={...e};return n===void 0||!Number.isFinite(n)?delete t.minFreePercent:t.minFreePercent=Math.min(100,Math.max(0,n)),t})},L=async()=>{w(!0),S(null);try{S(await(e=>p.storage.testConfig.query(e))({providerId:r.providerId,config:m}))}catch(e){S({ok:!1,error:e instanceof Error?e.message:String(e)})}finally{w(!1)}};return c(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm`,onClick:a,children:u(`div`,{className:`w-full max-w-md rounded-xl border border-border bg-surface shadow-2xl`,onClick:e=>e.stopPropagation(),children:[u(`div`,{className:`flex items-start justify-between border-b border-border px-4 py-3`,children:[u(`div`,{className:`space-y-0.5`,children:[u(`h2`,{className:`text-sm font-semibold text-foreground`,children:[`Edit `,r.displayName]}),u(`p`,{className:`text-xs text-foreground-subtle`,children:[c(`span`,{className:`font-mono`,children:r.id}),` ·`,` `,D?.displayName??r.providerId]})]}),c(`button`,{onClick:a,className:`text-foreground-subtle hover:text-foreground`,children:c(g,{className:`h-4 w-4`})})]}),u(`div`,{className:`p-4 space-y-3 max-h-[60vh] overflow-y-auto`,children:[u(`div`,{className:`space-y-1`,children:[c(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Display name`}),c(`input`,{type:`text`,value:_,onChange:e=>b(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`})]}),D&&c(y,{schema:D.configSchema,values:m,onChange:h}),A&&u(`div`,{className:`space-y-2`,children:[c(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Node`}),c(e,{selectedNodeId:j,onSelect:M,alwaysShow:!0}),c(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Path`}),c(T,{nodeId:j,value:N,onChange:P})]}),k&&u(`div`,{className:`space-y-1`,children:[c(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Min free disk %`}),c(`input`,{type:`number`,min:0,max:100,value:F,placeholder:D?.minFreePercent==null?``:String(D.minFreePercent),onChange:e=>I(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`}),u(`p`,{className:`text-[10px] text-foreground-subtle`,children:[`When free space on this volume drops below this %, the oldest data stored here is evicted to reclaim space.`,D?.minFreePercent==null?` Empty = use the default.`:` Empty = use the default (${D.minFreePercent}%).`]})]}),!D&&!E.isLoading&&u(`div`,{className:`rounded border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-[11px] text-amber-700 dark:text-amber-300`,children:[`Provider `,c(`code`,{className:`font-mono`,children:r.providerId}),` is no longer registered. Field schema unavailable; raw config is preserved on save.`]}),x&&c(`div`,{className:`rounded border px-3 py-2 text-[11px] ${x.ok?`border-success/30 bg-success/5 text-success`:`border-danger/30 bg-danger/5 text-danger`}`,children:x.ok?`Connection OK.`:`Test failed: ${x.error??`unknown error`}`}),O.isError&&c(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:O.error instanceof Error?O.error.message:String(O.error)})]}),u(`div`,{className:`flex items-center justify-between gap-2 border-t border-border px-4 py-3`,children:[c(`button`,{onClick:a,className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Cancel`}),u(`div`,{className:`flex items-center gap-2`,children:[c(`button`,{onClick:()=>{L()},disabled:C||!D,className:`rounded border border-border px-3 py-1.5 text-xs text-foreground hover:bg-primary/10 disabled:opacity-50`,children:C?`Testing…`:`Test connection`}),u(`button`,{onClick:()=>{O.mutate({id:r.id,type:r.type,providerId:r.providerId,isDefault:r.isDefault,displayName:_.trim(),config:m,nodeId:A?j:void 0})},disabled:O.isPending||_.trim().length===0,className:`inline-flex items-center gap-1.5 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:[O.isPending?c(v,{className:`h-3.5 w-3.5 animate-spin`}):null,O.isPending?`Saving…`:`Save`]})]})]})]})})}function D(e){let t=e.trim().toLowerCase();return t.length===0?``:t.replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function O(e,t){let n=D(t);return`${e}:${n.length>0?n:`default`}`}s();function k({initialType:r,onClose:a,onCreated:s}){let f=l(),p=d().trpcClient,[m,_]=i(`picker`),[b,x]=i(r),[S,C]=i(null),[w,E]=i({}),[D,k]=i(``),[A,j]=i(null),[M,N]=i(!1),[P,F]=i(`hub`),[I,L]=i(null),[R,z]=i(!1),B=e=>E(t=>({...t,basePath:e})),V=typeof w.basePath==`string`?w.basePath:``,H=t(),U=o(()=>{let e=H.data;return Array.isArray(e)?e:[]},[H.data]),W=H.isLoading,G=n({onSuccess:()=>{f.invalidateQueries({queryKey:[[`storage`,`listLocations`]]}),s()}}),K=o(()=>A!==null&&A.length>0?A:O(b,D),[b,D,A]),q=async()=>{if(S){z(!0),L(null);try{L(await(e=>p.storage.testConfig.query(e))({providerId:S.providerId,config:w}))}catch(e){L({ok:!1,error:e instanceof Error?e.message:String(e)})}finally{z(!1)}}};return c(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm`,onClick:a,children:u(`div`,{className:`w-full max-w-md rounded-xl border border-border bg-surface shadow-2xl`,onClick:e=>e.stopPropagation(),children:[u(`div`,{className:`flex items-start justify-between border-b border-border px-4 py-3`,children:[u(`div`,{className:`space-y-0.5`,children:[c(`h2`,{className:`text-sm font-semibold text-foreground`,children:{picker:`Add Location — Pick provider`,config:`Add Location — ${S?.displayName??``}`,naming:`Add Location — Name & defaults`}[m]}),u(`p`,{className:`text-xs text-foreground-subtle`,children:[`Type: `,c(`span`,{className:`font-mono`,children:b})]})]}),c(`button`,{onClick:a,className:`text-foreground-subtle hover:text-foreground`,children:c(g,{className:`h-4 w-4`})})]}),m===`picker`&&u(`div`,{className:`p-4 space-y-2`,children:[W&&c(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading providers…`}),!W&&U.length===0&&u(`div`,{className:`rounded border border-border bg-background px-3 py-4 text-center text-xs text-foreground-subtle`,children:[`No storage-provider supports type "`,b,`". Install a compatible addon (e.g.`,` `,c(`code`,{className:`font-mono`,children:`remote-storage`}),`) to enable it.`]}),U.map(e=>u(`button`,{onClick:()=>{C(e),_(`config`)},className:`flex w-full items-center gap-3 rounded-lg border border-border bg-background p-3 text-left hover:border-primary/40 hover:bg-primary/5 transition-colors`,children:[u(`div`,{className:`flex-1 min-w-0`,children:[c(`p`,{className:`text-xs font-semibold text-foreground`,children:e.displayName}),c(`p`,{className:`text-[10px] text-foreground-subtle font-mono mt-0.5 truncate`,children:e.providerId})]}),c(h,{className:`h-4 w-4 text-foreground-subtle flex-shrink-0`})]},e.providerId))]}),m===`config`&&S&&u(`div`,{className:`p-4 space-y-3 max-h-[60vh] overflow-y-auto`,children:[c(y,{schema:S.configSchema,values:w,onChange:E}),S.nodeLocal&&u(`div`,{className:`space-y-2`,children:[c(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Node`}),c(e,{selectedNodeId:P,onSelect:F,alwaysShow:!0}),c(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Path`}),c(T,{nodeId:P,value:V,onChange:B})]}),I&&c(`div`,{className:`rounded border px-3 py-2 text-[11px] ${I.ok?`border-success/30 bg-success/5 text-success`:`border-danger/30 bg-danger/5 text-danger`}`,children:I.ok?`Connection OK.`:`Test failed: ${I.error??`unknown error`}`}),u(`div`,{className:`flex items-center justify-between pt-1`,children:[c(`button`,{onClick:()=>_(`picker`),className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Back`}),u(`div`,{className:`flex items-center gap-2`,children:[c(`button`,{onClick:()=>{q()},disabled:R,className:`rounded border border-border px-3 py-1.5 text-xs text-foreground hover:bg-primary/10 disabled:opacity-50`,children:R?`Testing…`:`Test connection`}),c(`button`,{onClick:()=>_(`naming`),className:`rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90`,children:`Next`})]})]})]}),m===`naming`&&S&&u(`div`,{className:`p-4 space-y-3`,children:[u(`div`,{className:`space-y-1`,children:[c(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Display name`}),c(`input`,{type:`text`,value:D,onChange:e=>k(e.target.value),placeholder:`${b} on ${S.displayName}`,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`})]}),u(`div`,{className:`space-y-1`,children:[u(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:[`Id`,` `,c(`span`,{className:`lowercase tracking-normal text-foreground-subtle`,children:`— auto-derived; override if needed`})]}),c(`input`,{type:`text`,value:K,onChange:e=>j(e.target.value),placeholder:O(b,D),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground font-mono focus:outline-none focus:ring-1 focus:ring-primary`}),u(`p`,{className:`text-[10px] text-foreground-subtle`,children:[`Format: `,c(`code`,{className:`font-mono`,children:`<type>:<slug>`}),`. Lowercase letters, digits, and hyphens only.`]})]}),u(`label`,{className:`flex items-start gap-2 rounded border border-border bg-background px-3 py-2 cursor-pointer hover:bg-primary/5`,children:[c(`input`,{type:`checkbox`,checked:M,onChange:e=>N(e.target.checked),className:`accent-primary mt-0.5`}),u(`div`,{className:`space-y-0.5`,children:[u(`div`,{className:`text-xs font-medium text-foreground`,children:[`Mark as default for type "`,b,`"`]}),u(`div`,{className:`text-[10px] text-foreground-subtle`,children:[`Setting this as default will demote the current default for this type. References like `,u(`code`,{className:`font-mono`,children:[`"`,b,`"`]}),` resolve to whichever location is the default.`]})]})]}),G.isError&&c(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:G.error instanceof Error?G.error.message:String(G.error)}),u(`div`,{className:`flex items-center justify-between pt-1`,children:[c(`button`,{onClick:()=>_(`config`),className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Back`}),u(`div`,{className:`flex items-center gap-2`,children:[c(`button`,{onClick:()=>{x(r),C(null),E({}),k(``),j(null),N(!1),L(null),_(`picker`)},className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Reset`}),u(`button`,{onClick:()=>{S&&G.mutate({id:K,type:b,displayName:D.trim(),providerId:S.providerId,config:w,isDefault:M,nodeId:S.nodeLocal?P:void 0})},disabled:G.isPending||D.trim().length===0,className:`inline-flex items-center gap-1.5 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:[G.isPending?c(v,{className:`h-3.5 w-3.5 animate-spin`}):null,G.isPending?`Saving…`:`Save`]})]})]})]})]})})}export{b as i,E as n,w as r,k as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Fi as e,Ii as t,d as n,da as r,dt as i,g as a,gt as o,m as s,pa as c}from"./src-CqVYgpnN.js";import{G as l,R as u,X as d,b as f,o as p,x as m}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CK8iQdP1.js";import{t as h}from"./bell-C9HUnDGC.js";import{t as g}from"./plus-CbaF5MYw.js";import{t as _}from"./refresh-cw-CPqFoliO.js";import{t as v}from"./square-D-dTwz52.js";import{B as y,P as b,V as x,p as S,x as C}from"./index-DuroU2aU.js";import{t as w}from"./AdminPage-CN6ZMhf0.js";import{t as T}from"./NodeAddonsSettingsPanel-9HVgS_gw.js";var E=y(`play`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]);d();function D({addonId:e,fallback:t,tileClassName:n,iconPath:r=`assets/icon.svg`}){let[i,a]=l(!1),o=`/api/addon-assets/${e}/${r}`;return f(`div`,{className:`h-10 w-10 rounded-lg flex items-center justify-center shrink-0 ${n}`,children:i?f(t,{className:`h-5 w-5`}):f(`img`,{src:o,alt:e,className:`h-7 w-7 rounded-md bg-white p-1 ring-1 ring-black/5`,onError:()=>a(!0)})})}d();function O({addonId:e,defaultActivity:t,showActivity:n=!0,maxHeight:r=`max-h-64`,defaultTab:i,capability:o}){let[c,u]=l(t??(i===`events`?`events`:`logs`));return m(`div`,{className:`flex flex-col gap-4`,children:[f(T,{nodeId:`hub`,addonIds:[e],level:`global`,capability:o}),n&&m(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[m(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border bg-surface-hover/20`,children:[f(`span`,{className:`text-[11px] font-semibold text-foreground-subtle uppercase tracking-wide`,children:`Activity`}),m(`div`,{className:`flex items-center gap-1`,children:[f(k,{kind:`logs`,active:c===`logs`,onClick:()=>u(`logs`)}),f(k,{kind:`events`,active:c===`events`,onClick:()=>u(`events`)})]})]}),c===`logs`?f(a,{addonId:e,maxHeight:r,showFilters:!1}):f(s,{addonId:e,category:`addon.*`,maxHeight:r})]})]})}function k({kind:e,active:t,onClick:n}){return m(`button`,{onClick:n,className:`inline-flex items-center gap-1 rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${t?`bg-primary/10 text-primary`:`text-foreground-subtle hover:text-foreground hover:bg-surface-hover`}`,children:[f(e===`logs`?S:h,{className:`h-3 w-3`}),e===`logs`?`Logs`:`Events`]})}d();function A(n){let{title:i,subtitle:a,pageIcon:o,itemIcon:s,capability:d,installButtonLabel:p=`Add addon`,items:h,isLoading:_,emptyTitle:v=`No addons installed for this capability`,emptyDescription:y,itemIconColor:S,renderStatusBadges:C,renderPrimaryAction:T,itemError:E,renderExpandedPanel:k,workspaceMaxHeight:A=`max-h-72`,trailing:P,showChrome:F=!1}=n,I=h.length>1,[L,R]=l(()=>h[0]?.addonId??null);u(()=>{L&&(h.some(e=>e.addonId===L)||R(h[0]?.addonId??null))},[h,L]);let z=e=>R(t=>t===e?null:e),B=`/system/addons?capability=${encodeURIComponent(d)}`;return f(w,{icon:F?o:void 0,title:F?i:void 0,subtitle:F?a:void 0,actions:F?f(x,{to:B,children:m(c,{variant:`primary`,size:`sm`,children:[f(g,{className:`h-3.5 w-3.5 mr-1`}),p]})}):void 0,children:_?f(r,{children:f(`div`,{className:`p-6 text-sm text-foreground-subtle`,children:`Loading…`})}):h.length===0?f(r,{children:f(t,{title:v,description:y??`Install an addon that declares the "${d}" capability to get started.`,action:F?f(x,{to:B,children:m(c,{variant:`primary`,size:`sm`,children:[f(g,{className:`h-3.5 w-3.5 mr-1`}),p]})}):void 0})}):m(`div`,{className:`flex flex-col gap-4`,children:[h.map(t=>{let n=!I||L===t.addonId,i=S?.(t)??(t.isActive?`bg-emerald-500/15 text-emerald-700 dark:text-emerald-300`:`bg-foreground-subtle/15 text-foreground-subtle`),a=E?.(t)??null;return m(r,{children:[m(`div`,{className:`flex flex-col gap-3 p-4 sm:flex-row sm:items-center ${n?`border-b border-border`:``}`,children:[m(`div`,{className:`flex items-center gap-3 flex-1 min-w-0`,children:[I&&f(`button`,{type:`button`,onClick:()=>z(t.addonId),"aria-label":n?`Collapse`:`Expand`,className:`shrink-0 p-1 rounded hover:bg-foreground-subtle/10 transition-colors`,children:f(b,{className:`h-4 w-4 text-foreground-subtle transition-transform ${n?`rotate-180`:``}`})}),m(`button`,{type:`button`,onClick:()=>I&&z(t.addonId),className:`flex items-center gap-4 flex-1 min-w-0 text-left ${I?`hover:opacity-80 transition-opacity`:``}`,disabled:!I,children:[f(D,{addonId:t.addonId,fallback:s,tileClassName:i}),m(`div`,{className:`flex-1 min-w-0`,children:[m(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[f(`span`,{className:`font-semibold text-foreground`,children:t.displayName}),f(j,{isActive:t.isActive}),C?.(t)]}),m(`div`,{className:`text-xs text-foreground-subtle mt-1 font-mono break-all`,children:[`@camstack/addon-`,t.addonId]})]})]})]}),m(`div`,{className:`flex items-center gap-1 shrink-0 flex-wrap justify-end`,children:[T?.(t),f(M,{capName:d,addonId:t.addonId,isActive:t.isActive}),f(N,{addonId:t.addonId,displayName:t.displayName})]})]}),n&&m(`div`,{className:`p-4 flex flex-col gap-3`,children:[a!==null&&f(e,{message:a}),k?.(t),f(O,{addonId:t.addonId,maxHeight:A,capability:d})]})]},t.addonId)}),P]})})}function j({isActive:e}){return f(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium ${e?`bg-emerald-500/15 text-emerald-700 dark:text-emerald-300`:`bg-foreground-subtle/15 text-foreground-subtle`}`,children:e?`Enabled`:`Disabled`})}function M({capName:e,addonId:t,isActive:n}){let r=p(),i=o({onSuccess:()=>{r.invalidateQueries({queryKey:[[`addons`,`listCapabilityProviders`]]})}}),a=i.isPending;return m(c,{size:`sm`,variant:n?`secondary`:`primary`,disabled:a,onClick:()=>i.mutate({capName:e,addonId:t,enabled:!n}),children:[a?f(C,{className:`h-3 w-3 animate-spin`}):f(n?v:E,{className:`h-3 w-3`}),n?`Disable`:`Enable`]})}function N({addonId:e,displayName:t}){let r=p(),a=i({onSuccess:()=>{r.invalidateQueries({queryKey:[[`addons`,`listCapabilityProviders`]]})}});return f(n,{label:`Restart`,icon:_,size:`sm`,title:`Restart "${t}"?`,description:`Restarting the addon bounces its subprocess — the provider will briefly drop and reconnect automatically.`,confirmLabel:`Restart`,triggerVariant:`ghost`,confirmVariant:`danger`,disabled:a.isPending,action:()=>a.mutateAsync({addonId:e})})}export{E as n,A as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$ as e,Li as t,Pi as n,Q as r,Vi as i,Z as a,_t as o,at as s,bt as c,ct as l,dt as u,et as d,fr as f,g as p,ht as m,it as ee,lt as h,m as te,mt as ne,nt as g,ot as re,pt as _,rt as v,tt as ie,ut as y,v as b,vt as ae,yr as x,yt as S}from"./src-CqVYgpnN.js";import{F as C,G as w,L as oe,R as T,U as E,W as se,X as D,b as O,o as ce,x as k,y as A}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CK8iQdP1.js";import{p as j}from"./player-overlays-DzZKARlk.js";import{t as M}from"./download-CEQQi2pw.js";import{t as le}from"./plus-CbaF5MYw.js";import{t as N}from"./refresh-cw-CPqFoliO.js";import{t as P}from"./search-cFwrysqG.js";import{t as F}from"./upload-tyMJOOSL.js";import{A as ue,B as I,F as L,H as R,P as de,W as z,f as fe,h as B,i as pe,o as V,p as H,s as me,x as U}from"./index-DuroU2aU.js";import{t as W}from"./AdminPage-CN6ZMhf0.js";import{t as he}from"./NodeAddonsSettingsPanel-9HVgS_gw.js";var G=I(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),K=I(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]),ge=I(`octagon-alert`,[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]]),_e=I(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]);D();function ve({packageName:e,currentVersion:t,installSource:n,onInstall:r,onClose:i}){let a=n===`upload`||n===`local`,{data:o,isLoading:s}=v({name:e});return k(`div`,{className:`fixed z-50 w-72 rounded-lg border border-border bg-surface shadow-xl overflow-hidden`,style:{top:`auto`,bottom:`auto`},ref:e=>{if(!e)return;let t=e.parentElement?.getBoundingClientRect();if(!t)return;let n=window.innerHeight-t.bottom,r=t.top;n<280&&r>n?(e.style.bottom=`${window.innerHeight-t.top+4}px`,e.style.top=`auto`):(e.style.top=`${t.bottom+4}px`,e.style.bottom=`auto`),e.style.right=`${window.innerWidth-t.right}px`},onClick:e=>e.stopPropagation(),children:[k(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[O(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle font-medium`,children:`Versions`}),O(`button`,{type:`button`,onClick:i,className:`text-foreground-subtle hover:text-foreground`,children:O(pe,{className:`h-3 w-3`})})]}),a&&k(`div`,{className:`flex items-start gap-2 px-3 py-2 border-b border-border bg-cyan-500/10 text-[10px]`,children:[O(F,{className:`h-3 w-3 mt-0.5 text-cyan-500 shrink-0`}),k(`div`,{className:`text-cyan-700 dark:text-cyan-200`,children:[k(`span`,{className:`font-semibold`,children:[n===`upload`?`Uploaded copy`:`Local copy`,` in place.`]}),` `,`Re-install `,O(`span`,{className:`font-mono`,children:t}),` from npm to track upstream releases again.`]})]}),s&&k(`div`,{className:`flex items-center justify-center gap-2 py-6 text-[10px] text-foreground-subtle`,children:[O(U,{className:`h-3.5 w-3.5 animate-spin`}),`Loading versions...`]}),o&&O(`div`,{className:`max-h-64 overflow-auto divide-y divide-border`,children:o.map(e=>{let n=e.version===t,i=/-(alpha|beta|rc|dev|canary|next)/i.test(e.version);return k(`div`,{className:`flex items-center gap-2 px-3 py-2 text-[11px] ${n?`bg-primary/5`:`hover:bg-surface-hover`} transition-colors`,children:[O(`span`,{className:`font-mono flex-1 ${n?`text-primary font-semibold`:i?`text-amber-400`:`text-foreground`}`,children:e.version}),e.distTags.map(e=>O(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${e===`latest`?`bg-emerald-500/15 text-emerald-400`:e===`beta`?`bg-amber-500/15 text-amber-400`:`bg-gray-500/15 text-gray-400`}`,children:e},e)),e.deprecated&&O(`span`,{className:`text-[9px] text-red-400 line-through`,children:`deprecated`}),O(`span`,{className:`text-[9px] text-foreground-subtle shrink-0`,children:new Date(e.publishedAt).toLocaleDateString()}),n&&!a?O(L,{className:`h-3 w-3 text-primary shrink-0`}):O(`button`,{type:`button`,onClick:()=>r(e.version),className:`shrink-0 rounded p-0.5 hover:bg-primary/20 text-foreground-subtle hover:text-primary transition-colors`,title:n?`Re-install ${e.version} from npm`:`Install ${e.version}`,children:O(M,{className:`h-3 w-3`})})]},e.version)})}),o&&o.length===0&&O(`div`,{className:`py-4 text-center text-[10px] text-foreground-subtle`,children:`No versions found`})]})}var q={queued:{icon:K,bg:`bg-muted text-foreground-subtle`,label:`queued`},updating:{icon:U,bg:`bg-primary/10 text-primary`,label:`updating`,spin:!0},"done-pending-restart":{icon:N,bg:`bg-amber-500/10 text-amber-700`,label:`pending restart`},done:{icon:L,bg:`bg-success/10 text-success`,label:`done`},failed:{icon:ge,bg:`bg-danger/10 text-danger`,label:`failed`}};function ye({item:e}){let t=q[e.status],n=t.icon;return k(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded ${t.bg}`,title:e.error,children:[O(n,{className:`w-2.5 h-2.5 ${t.spin?`animate-spin`:``}`}),t.label]})}var be=`device-export`;function J(e){return e.capabilities.some(e=>(typeof e==`string`?e:e.name)===be)}function xe({isBundle:e,installSource:t,addonId:n,iconPath:r,color:i}){let[a,o]=w(!1),s=i?{backgroundColor:`${i.startsWith(`#`)?i:`#${i}`}26`}:void 0,c=e?`bg-indigo-500/20 text-indigo-700 dark:text-indigo-300`:`bg-purple-500/20 text-purple-700 dark:text-purple-300`,l=n&&r?`/api/addon-assets/${n}/${r}`:null,u=!!l&&!a;return k(`div`,{className:`relative flex-shrink-0`,children:[O(`div`,{className:`h-9 w-9 rounded-lg flex items-center justify-center ${s?``:c}`,style:s,children:u?O(`img`,{src:l,alt:n,className:`h-5 w-5`,onError:()=>o(!0)}):O(e?_e:B,{className:`h-4 w-4`})}),t===`local`&&O(`span`,{className:`absolute -top-1.5 -left-1.5 text-[7px] font-bold leading-none bg-orange-500 text-white px-1 py-0.5 rounded -rotate-12 shadow-sm`,children:`DEV`}),t===`npm`&&O(`span`,{className:`absolute -top-1 -left-1 w-4 h-4 rounded bg-[#cb3837] flex items-center justify-center -rotate-12 shadow-sm`,children:O(`svg`,{viewBox:`0 0 780 250`,className:`w-[11px] h-[11px]`,children:O(`path`,{fill:`#fff`,d:`M240 250h100V50h100v200h340V0H0v250z`})})}),t===`upload`&&O(`span`,{className:`absolute -top-1.5 -left-1.5 flex items-center justify-center h-4 w-4 rounded bg-cyan-500 -rotate-12 shadow-sm`,children:O(F,{className:`h-2.5 w-2.5 text-white`})})]})}function Se({addonId:e}){let t=ce(),{data:n=`inherit`}=d({addonId:e}),r=m({onSuccess:()=>{t.invalidateQueries({queryKey:[[`addons`,`getAddonAutoUpdate`]]})}});return O(`div`,{className:`flex rounded-lg border border-border overflow-hidden text-[10px] font-medium`,children:[`inherit`,`off`,`latest`,`beta`].map(t=>O(`button`,{type:`button`,onClick:n=>{n.stopPropagation(),r.mutate({addonId:e,channel:t})},disabled:r.isPending,className:`px-2.5 py-1 transition-colors capitalize ${n===t?t===`inherit`?`bg-gray-700/50 text-gray-700 dark:text-gray-300`:t===`off`?`bg-gray-700 text-gray-700 dark:text-gray-300`:t===`latest`?`bg-blue-500/20 text-blue-400`:`bg-amber-500/20 text-amber-400`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`} ${t===`inherit`?``:`border-l border-border`}`,children:t},t))})}function Ce({addon:e,agents:t=[],clusterStatus:r,hideVersion:i,availableUpdate:a,onUpdate:o,isUpdating:s,bundle:c,bulkItem:l,disabledByBulk:d,isSystem:f}){let[m,h]=w(!1),[ne,g]=w(!1),[re,v]=w(!1),[ie,y]=w(!1),[x,S]=w(!1),[C,oe]=w(`logs`),T=ce(),E=j(),se=R(),D=n(),{manifest:P}=e,F=e.installedOn??[],ue=!c&&!P.protected&&P.removable!==!1,I=!!c,L=c?.displayName??P.name,z=c?.packageName??P.packageName,B=c?.version??P.packageVersion??P.version,V=c?.installSource??e.installSource,W=c?c.bundle?.description??c.addons[0]?.manifest.description:P.description;!c&&(P.components&&P.components.length>0||t.length);let K=ae({onSuccess:()=>{T.invalidateQueries({queryKey:[[`addons`]]}),T.invalidateQueries({queryKey:[[`addonPages`]]}),T.invalidateQueries({queryKey:[[`capabilities`]]})}}),q=u({onSuccess:()=>{T.invalidateQueries({queryKey:[[`addons`]]})}}),be=ee({onSuccess:()=>{T.invalidateQueries({queryKey:[[`addons`]]}),T.invalidateQueries({queryKey:[[`addonPages`]]}),T.invalidateQueries({queryKey:[[`capabilities`]]}),T.invalidateQueries({queryKey:[[`integrations`]]})}}),Y=_({onSuccess:()=>{T.invalidateQueries({queryKey:[[`addons`]]}),T.invalidateQueries({queryKey:[[`alerts`]]})}}),X=e.health,Z=X?.phase===`failed`&&!X.inGracePeriod,we=Z&&X?.nextRetryAt&&!X.retrying;return k(`div`,{className:`rounded-lg border bg-surface overflow-hidden ${Z?`border-red-500/50`:`border-border`}`,children:[Z&&X&&k(`div`,{className:`bg-danger/10 border-b border-danger/30 px-4 py-2.5 flex items-start gap-2.5`,children:[O(ge,{className:`h-4 w-4 text-danger shrink-0 mt-0.5`}),k(`div`,{className:`flex-1 min-w-0`,children:[k(`div`,{className:`text-xs font-semibold text-danger`,children:[`Failed to load (attempt #`,X.retryCount,`)`]}),O(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:X.lastError?.message??`Unknown error`}),we&&X.nextRetryAt&&k(`div`,{className:`text-[10px] text-foreground-subtle mt-1`,children:[`Auto-retry at `,new Date(X.nextRetryAt).toLocaleTimeString()]})]}),k(`button`,{type:`button`,disabled:Y.isPending||X.retrying,onClick:e=>{e.stopPropagation(),Y.mutate({packageName:z})},className:`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-[11px] font-semibold border border-red-400/40 bg-red-400/10 text-red-700 dark:text-red-300 hover:bg-red-400/20 disabled:opacity-50 disabled:cursor-not-allowed transition-colors shrink-0`,title:`Reset retry counter and force immediate reload`,children:[O(N,{className:`h-3 w-3 ${Y.isPending||X.retrying?`animate-spin`:``}`}),`Retry now`]})]}),k(`div`,{className:`flex items-start gap-3 px-4 py-3`,children:[O(xe,{isBundle:I||!!P.components&&P.components.length>1,installSource:V,addonId:I?c.addons[0]?.manifest.id:P.id,iconPath:I?c.bundle?.icon??c.addons[0]?.manifest.icon:P.icon,color:I?c.addons[0]?.manifest.color:P.color}),k(`div`,{className:`flex-1 min-w-0`,children:[k(`div`,{className:`flex items-center gap-2`,children:[O(`span`,{className:`text-sm font-semibold text-foreground truncate`,children:L}),k(`span`,{className:`text-[10px] text-foreground-subtle font-mono shrink-0`,children:[`(`,z,`)`]}),I&&k(`span`,{className:`text-[10px] rounded-full bg-primary/10 text-primary px-2 py-0.5 font-medium shrink-0 inline-flex items-center gap-1`,children:[O(_e,{className:`h-3 w-3`}),c.addons.length]}),f&&k(`span`,{className:`text-[10px] rounded-full bg-amber-500/15 text-amber-700 dark:text-amber-300 px-2 py-0.5 font-medium shrink-0 inline-flex items-center gap-1`,title:`System package — updating restarts the hub`,children:[O(N,{className:`h-3 w-3`}),`System · restart on update`]}),l!=null&&O(ye,{item:l})]}),W&&O(`p`,{className:`text-[10px] text-foreground-subtle mt-0.5 line-clamp-1`,children:W}),!I&&e.process&&k(`div`,{className:`flex items-center gap-1.5 mt-1`,children:[O(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${e.process.mode===`forked`?`bg-blue-500/15 text-blue-400`:`bg-gray-500/15 text-gray-400`}`,children:e.process.mode===`forked`?`forked`:`in-process`}),e.process.pid!=null&&k(`span`,{className:`text-[9px] font-mono text-foreground-subtle`,children:[`PID `,e.process.pid]}),O(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${e.process.state===`running`?`bg-emerald-500/15 text-emerald-400`:e.process.state===`crashed`||e.process.state===`failed`?`bg-red-500/15 text-red-400`:`bg-gray-500/15 text-gray-400`}`,children:e.process.state})]})]}),!i&&k(`div`,{className:`relative inline-flex items-center gap-1.5 shrink-0 pt-0.5`,children:[s?k(`span`,{className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border border-blue-500/30 bg-blue-500/10 text-blue-400`,children:[O(U,{className:`h-3 w-3 animate-spin`}),`Updating to `,a,`…`]}):a&&o?k(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),o()},disabled:d,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-semibold border border-primary/40 bg-primary/10 text-primary hover:bg-primary/20 transition-colors animate-pulse disabled:opacity-50 disabled:cursor-not-allowed`,title:`Update to ${a}`,children:[O(M,{className:`h-3 w-3`}),a]}):null,k(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),v(e=>!e)},disabled:d,className:[`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-bold font-mono border transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,V===`local`?`border-orange-500/30 bg-orange-500/10 text-orange-400 hover:bg-orange-500/20`:a?`border-amber-500/30 bg-amber-500/10 text-amber-400 hover:bg-amber-500/20`:`border-emerald-500/30 bg-emerald-500/10 text-emerald-400 hover:bg-emerald-500/20`].join(` `),title:a?`Current ${B} — newer ${a} available`:`View all versions`,children:[B,O(de,{className:`h-3 w-3 opacity-50`})]}),re&&O(ve,{packageName:z,currentVersion:B,...V?{installSource:V}:{},onInstall:e=>{v(!1),be.mutate({packageName:z,version:e})},onClose:()=>v(!1)})]})]}),!I&&k(`div`,{className:`flex items-center gap-1 px-4 py-1.5 border-t border-border/50 bg-surface-hover/20`,children:[k(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),q.mutate({addonId:P.id})},disabled:q.isPending||d,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border border-border text-foreground-subtle hover:text-blue-400 hover:border-blue-500/30 hover:bg-blue-500/10 disabled:opacity-50 transition-colors`,children:[O(N,{className:`h-3 w-3 ${q.isPending?`animate-spin`:``}`}),`Restart`]}),k(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),y(e=>!e)},className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border transition-colors ${ie?`border-primary/30 bg-primary/10 text-primary`:`border-border text-foreground-subtle hover:text-foreground hover:border-primary/30 hover:bg-primary/10`}`,children:[O(H,{className:`h-3 w-3`}),`Logs`]}),!I&&k(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),S(!0)},className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border transition-colors ${x?`border-primary/30 bg-primary/10 text-primary`:`border-border text-foreground-subtle hover:text-foreground hover:border-primary/30 hover:bg-primary/10`}`,children:[O(fe,{className:`h-3 w-3`}),`Settings`]}),O(`div`,{className:`flex-1`}),ue&&k(`button`,{type:`button`,onClick:async e=>{e.stopPropagation(),await D({title:`Uninstall ${P.name}?`,message:`This will remove the addon package and all its data. This action cannot be undone.`,confirmLabel:`Uninstall`,variant:`danger`})&&K.mutate({packageName:P.packageName})},disabled:K.isPending||d,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border border-border text-foreground-subtle hover:text-red-400 hover:border-red-500/30 hover:bg-red-500/10 disabled:opacity-50 transition-colors`,children:[O(me,{className:`h-3 w-3`}),K.isPending?`Removing...`:`Uninstall`]})]}),r&&r.nodes.length>1&&!I&&k(`div`,{className:`border-t border-border px-4 py-2 bg-muted/10`,children:[O(`div`,{className:`text-[10px] font-medium text-foreground-subtle mb-1.5`,children:`Cluster Deployment`}),O(`div`,{className:`space-y-1`,children:r.nodes.map(e=>k(`div`,{className:`flex items-center gap-2 text-[10px]`,children:[O(`div`,{className:`h-1.5 w-1.5 rounded-full shrink-0 ${e.status===`offline`?`bg-muted-foreground/30`:e.synced?`bg-success`:`bg-amber-500`}`}),O(`span`,{className:`font-medium text-foreground min-w-[60px]`,children:e.name}),O(`span`,{className:`font-mono text-foreground-subtle`,children:e.version}),!e.synced&&e.status!==`offline`&&O(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-amber-500/10 text-amber-400 border border-amber-500/20`,children:`outdated`}),e.status===`offline`&&O(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-muted text-muted-foreground`,children:`offline`}),e.synced&&e.status!==`offline`&&O(`span`,{className:`text-[9px] text-success`,children:`synced`})]},e.nodeId))})]}),ie&&!I&&k(`div`,{className:`border-t border-border`,children:[k(`div`,{className:`flex items-center px-4 py-1 bg-surface-hover/20 border-b border-border/50`,children:[k(`div`,{className:`flex rounded border border-border overflow-hidden text-[9px]`,children:[O(`button`,{type:`button`,onClick:()=>oe(`logs`),className:`px-2 py-0.5 transition-colors ${C===`logs`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:`Logs`}),O(`button`,{type:`button`,onClick:()=>oe(`events`),className:`px-2 py-0.5 border-l border-border transition-colors ${C===`events`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:`Events`})]}),O(`div`,{className:`flex-1`}),O(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),y(!1)},className:`text-foreground-subtle hover:text-foreground`,children:O(pe,{className:`h-3.5 w-3.5`})})]}),C===`logs`&&O(p,{addonId:P.id,maxHeight:`max-h-64`,showFilters:!1}),C===`events`&&O(te,{addonId:P.id,category:`addon.*`,maxHeight:`max-h-64`})]}),I&&k(A,{children:[O(`button`,{type:`button`,onClick:()=>h(e=>!e),className:`w-full flex items-center justify-center border-t border-border py-1 hover:bg-surface-hover/50 transition-colors`,children:O(m?G:de,{className:`h-3.5 w-3.5 text-foreground-subtle`})}),m&&O(`div`,{className:`border-t border-border px-3 py-2 space-y-2`,children:c.addons.map(e=>O(Ce,{addon:e,agents:t,hideVersion:!0},e.manifest.id))})]}),x&&!I&&O(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4`,onClick:()=>S(!1),children:k(`div`,{className:`w-full max-w-lg max-h-[80vh] rounded-xl border border-border bg-surface shadow-2xl flex flex-col overflow-hidden`,onClick:e=>e.stopPropagation(),children:[k(`div`,{className:`flex items-center justify-between px-5 py-3 border-b border-border flex-shrink-0`,children:[k(`div`,{className:`flex items-center gap-2`,children:[O(fe,{className:`h-4 w-4 text-primary`}),k(`h2`,{className:`text-sm font-semibold text-foreground`,children:[L,` Settings`]})]}),O(`button`,{onClick:()=>S(!1),className:`text-foreground-subtle hover:text-foreground transition-colors p-1 rounded`,children:O(pe,{className:`h-4 w-4`})})]}),k(`div`,{className:`flex-1 overflow-y-auto px-5 py-4 space-y-4`,children:[O(he,{nodeId:`hub`,addonIds:[P.id],level:`global`}),J(P)&&k(`div`,{children:[O(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Device export`}),O(b,{addonId:P.id,trpc:E.trpcClient,onOpenDevice:e=>se(`/devices/${e}`)})]}),V===`npm`&&k(`div`,{children:[O(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Auto-Update`}),O(Se,{addonId:P.id})]}),P.components&&P.components.length>0&&k(`div`,{children:[k(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:[`Components (`,P.components.length,`)`]}),O(`div`,{className:`flex flex-wrap gap-1`,children:P.components.map(e=>O(`span`,{className:`text-[10px] rounded bg-background border border-border px-1.5 py-0.5 text-foreground-subtle font-mono`,children:e},e))})]}),t.length>=2&&k(`div`,{children:[O(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Installed on`}),k(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[F.length===0&&O(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Hub (local)`}),F.map(e=>O(`span`,{className:`rounded-full bg-surface-hover border border-border px-2 py-0.5 text-[10px] text-foreground-subtle`,children:e},e)),k(`div`,{className:`relative`,children:[k(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),g(e=>!e)},className:`inline-flex items-center gap-1 rounded-full border border-dashed border-border px-2 py-0.5 text-[10px] text-foreground-subtle hover:text-foreground hover:border-primary transition-colors`,title:`Install on more agents`,children:[O(le,{className:`h-3 w-3`}),`Add agent`]}),ne&&k(`div`,{className:`absolute left-0 top-full mt-1 z-10 min-w-[160px] rounded-md border border-border bg-surface shadow-lg overflow-hidden`,children:[t.filter(e=>!e.isHub&&!F.includes(e.name)).map(e=>O(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),g(!1)},className:`w-full text-left px-3 py-1.5 text-[10px] text-foreground hover:bg-surface-hover transition-colors`,children:e.name},e.id)),t.filter(e=>!e.isHub&&!F.includes(e.name)).length===0&&O(`div`,{className:`px-3 py-1.5 text-[10px] text-foreground-subtle`,children:`No available agents`})]})]})]})]})]}),O(`div`,{className:`flex items-center justify-end px-5 py-3 border-t border-border flex-shrink-0`,children:O(`button`,{type:`button`,onClick:()=>S(!1),className:`rounded-lg border border-border px-3 py-1.5 text-xs font-medium text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,children:`Close`})})]})})]})}D();var Y=`.tgz,.tar.gz,.zip`;function X({onUploadSuccess:e}){let[t,n]=w(!1),r=se(null),i=C(async t=>{n(!0);let r=new FormData;r.append(`file`,t);let i=localStorage.getItem(`camstack_admin_token`)??``;try{(await(await fetch(`/api/addons/upload`,{method:`POST`,headers:{Authorization:`Bearer ${i}`},body:r})).json()).success&&e()}finally{n(!1)}},[e]);return k(A,{children:[O(`input`,{ref:r,type:`file`,accept:Y,onChange:C(e=>{let t=e.target.files?.[0];t&&i(t),e.target.value=``},[i]),className:`hidden`}),k(`button`,{type:`button`,onClick:()=>r.current?.click(),disabled:t,className:`flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,children:[t?O(U,{className:`w-3.5 h-3.5 animate-spin`}):O(F,{className:`w-3.5 h-3.5`}),t?`Uploading...`:`Upload`]})]})}var Z={regular:`Updating addons`,system:`Updating system packages`,restarting:`Restarting hub… (~10s)`,finalizing:`Finalizing`};function we({state:e,onCancel:t}){let n=e.total===0?0:Math.round(e.completed/e.total*100),r=e.phase!==`restarting`&&!e.cancelled&&e.completedAtMs===void 0;return k(`div`,{className:`sticky top-0 z-30 bg-surface border-b border-border px-3 py-2 space-y-1.5`,children:[k(`div`,{className:`flex items-center gap-2 text-xs`,children:[O(U,{className:`w-3.5 h-3.5 animate-spin text-primary`}),O(`span`,{className:`font-medium`,children:Z[e.phase]}),O(`span`,{className:`text-foreground-subtle`,children:`·`}),k(`span`,{className:`text-foreground-subtle`,children:[e.completed,`/`,e.total]}),e.current!==null&&k(A,{children:[O(`span`,{className:`text-foreground-subtle`,children:`·`}),O(`span`,{className:`font-mono text-foreground-subtle truncate`,children:e.current})]}),k(`div`,{className:`ml-auto flex items-center gap-2`,children:[e.failed>0&&k(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-danger/10 text-danger`,children:[e.failed,` failed`]}),O(`button`,{type:`button`,onClick:t,disabled:!r,className:`text-[10px] px-2 py-0.5 rounded border border-border hover:bg-surface-hover disabled:opacity-40`,children:`Cancel`})]})]}),O(`div`,{className:`h-1 bg-muted rounded overflow-hidden`,children:O(`div`,{className:`h-full bg-primary transition-[width] duration-200`,style:{width:`${n}%`}})}),e.phase===`system`&&k(`div`,{className:`text-[10px] text-amber-700 flex items-center gap-1`,children:[O(V,{className:`w-3 h-3`}),`System phase: the hub will restart once at the end (~10s).`]})]})}function Te({pending:e,onCancel:t,onConfirm:n,isPending:r,error:i}){return O(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60`,children:k(`div`,{className:`bg-surface border border-border rounded-md shadow-xl p-5 max-w-md w-full mx-4 space-y-3`,children:[k(`div`,{className:`flex items-center gap-2`,children:[O(V,{className:`w-4 h-4 text-amber-700`}),O(`h3`,{className:`text-sm font-medium text-foreground`,children:`Update system package?`})]}),k(`div`,{className:`space-y-2 text-[11px] text-foreground-subtle`,children:[k(`div`,{children:[O(`span`,{className:`font-mono text-foreground`,children:e.packageName}),O(`span`,{className:`mx-1`,children:`·`}),k(`span`,{className:`font-mono`,children:[`v`,e.fromVersion]}),O(`span`,{className:`mx-1`,children:`→`}),k(`span`,{className:`font-mono text-amber-700`,children:[`v`,e.toVersion]})]}),O(`div`,{className:`rounded border border-amber-500/30 bg-amber-500/10 p-2 text-amber-800`,children:`The hub will restart immediately after the install. Any in-flight requests will be dropped. The reconnect typically takes ~10 seconds.`}),i!==null&&O(`div`,{className:`rounded border border-danger/40 bg-danger/10 p-2 text-danger`,children:i})]}),k(`div`,{className:`flex justify-end gap-2 pt-1`,children:[O(`button`,{type:`button`,onClick:t,disabled:r,className:`px-3 py-1.5 text-[11px] rounded bg-surface hover:bg-surface-hover border border-border disabled:opacity-50`,children:`Cancel`}),k(`button`,{type:`button`,onClick:n,disabled:r,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-[11px] rounded bg-amber-500/20 text-amber-800 hover:bg-amber-500/30 border border-amber-500/40 font-medium disabled:opacity-50`,children:[r?O(U,{className:`w-3 h-3 animate-spin`}):O(M,{className:`w-3 h-3`}),`Update & restart`]})]})]})})}D();function Ee(e,t){let n=e??`hub-only`;return n===`any-node`?!0:n===`hub-only`?t:!t}function De(e){let t=e;if(!t?.manifest)return null;let n={...t.manifest,name:t.manifest.name??t.manifest.id,version:t.manifest.version??`0.0.0`,capabilities:t.manifest.capabilities??[]},r=t.process,i=r?{pid:r.pid,mode:r.mode===`forked`?`forked`:`in-process`,state:r.state??`unknown`}:void 0,a=t.health,o=t.declaration?.execution,s=t.manifest.execution,c=o?.placement??s?.placement;return{manifest:n,enabled:!0,source:t.source,installSource:t.installSource,installedOn:[],...i?{process:i}:{},hasBackup:t.hasBackup,...a?{health:a}:{},...c?{placement:c}:{}}}function Oe(e){let t=new Map,n=[];for(let r of e){let e=r.manifest.packageName;if(!e){n.push(r);continue}let i=t.get(e);if(i)i.addons.push(r);else{let n=r.manifest.bundle,i={packageName:e,displayName:n?.displayName??r.manifest.packageDisplayName??r.manifest.name,version:r.manifest.packageVersion,addons:[r],...r.installSource===void 0?{}:{installSource:r.installSource},...n===void 0?{}:{bundle:n}};t.set(e,i)}}let r=[];for(let e of t.values())e.bundle!==void 0||e.addons.length>=2?r.push({bundle:e,representative:e.addons[0]}):r.push(e.addons[0]);return r.push(...n),r}function Q(e){return`bundle`in e}function ke({addons:e,clusterStatus:t,selectedNode:s,onRefresh:u,isRefreshing:d}){let f=ce(),[p,m]=w(``),te=oe(p),[_,v]=w(!1),y=se(null);T(()=>{if(!_)return;let e=e=>{y.current&&!y.current.contains(e.target)&&v(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[_]);let{data:b}=h({nodeId:s.id}),ae=E(()=>{let e=new Map;for(let t of b??[])e.set(t.name,t.latestVersion);return e},[b]),[x,D]=w(null),[A,j]=w(null),le=c({onMutate:e=>{D(e.name),j(null)},onSuccess:(e,t)=>{D(null);let n=e;if(n&&n.success===!1){j({name:t.name,message:n.error??`Update failed (no error message returned by server)`});return}f.invalidateQueries({queryKey:[[`addons`]]}),f.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]})},onError:(e,t)=>{D(null),j({name:t.name,message:e instanceof Error?e.message:String(e)})}}),{data:F}=ie(void 0),I=a({onSuccess:()=>{f.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),{data:R,isFetching:de}=ne({query:te||void 0},{enabled:_}),{data:fe}=re({nodeId:s.id},{staleTime:1/0}),[B,pe]=w(null);i(`AddonsBulkUpdateProgress`,e=>{e.data?.nodeId===s.id&&pe(e.data)});let V=E(()=>B===null?(fe??[])[0]??null:B,[B,fe]),H=V!==null&&V.completedAtMs===void 0,me=E(()=>V===null?new Map:new Map(V.items.map(e=>[e.name,e])),[V]),W=o(),he=r(),{data:G}=g(void 0),K=G?.requestedAt,[ge,_e]=w(null),[ve,q]=w(!1);T(()=>{if(G?.kind===`framework-bulk-update`&&G.requestedAt!==ge){_e(G.requestedAt),q(!0);let e=window.setTimeout(()=>q(!1),6e3);return()=>window.clearTimeout(e)}},[K,ge,G]);let{data:ye}=l(void 0),be=E(()=>new Map((ye??[]).map(e=>[e.packageName,e])),[ye]),[J,xe]=w(null),[Se,Y]=w(null),Z=S({onSuccess:()=>{xe(null),f.invalidateQueries({queryKey:[[`addons`]]})},onError:e=>{Y(e instanceof Error?e.message:String(e))}}),De=n(),ke=C(async()=>{let e=b??[];if(e.length===0)return;let t=e.map(e=>({name:e.name,version:e.latestVersion,isSystem:e.isSystem}));t.some(e=>e.isSystem)&&!await De({title:`Update all — includes a system package`,message:`This batch updates a system package (@camstack/system). The hub will restart automatically once the system phase completes. In-flight requests are dropped; reconnect typically takes ~10 seconds.`,confirmLabel:`Update all & restart`,variant:`warning`})||await W.mutateAsync({nodeId:s.id,items:t})},[b,s.id,W,De]),Ae=ee({onSuccess:()=>{f.invalidateQueries({queryKey:[[`addons`]]}),f.invalidateQueries({queryKey:[[`addonPages`]]}),f.invalidateQueries({queryKey:[[`capabilities`]]}),f.invalidateQueries({queryKey:[[`integrations`]]})}}),[je,Me]=w(`type`),[Ne,Pe]=w(()=>typeof window>`u`?`grouped`:window.localStorage.getItem(`camstack.addons.viewMode`)===`flat`?`flat`:`grouped`),Fe=e=>{Pe(e),typeof window<`u`&&window.localStorage.setItem(`camstack.addons.viewMode`,e)},[Ie,Le]=z(),$=Ie.get(`capability`),Re=E(()=>{let t=s.isHub?e:e.filter(e=>Ee(e.placement,s.isHub));return $&&(t=t.filter(e=>(e.manifest.capabilities??[]).some(e=>(typeof e==`string`?e:e.name)===$))),t},[e,s.isHub,$]),ze=()=>{let e=new URLSearchParams(Ie);e.delete(`capability`),Le(e,{replace:!0})},Be=Ne===`flat`?Re:Oe(Re),Ve=E(()=>{let e=[...Be];switch(je){case`type`:e.sort((e,t)=>{let n=+!Q(e),r=+!Q(t);if(n!==r)return n-r;let i=Q(e)?e.bundle.displayName:e.manifest.name,a=Q(t)?t.bundle.displayName:t.manifest.name;return i.localeCompare(a)});break;case`name`:e.sort((e,t)=>{let n=Q(e)?e.bundle.displayName:e.manifest.name,r=Q(t)?t.bundle.displayName:t.manifest.name;return n.localeCompare(r)});break;case`source`:e.sort((e,t)=>{let n=Q(e)?e.bundle.installSource??``:e.installSource??``,r=Q(t)?t.bundle.installSource??``:t.installSource??``;return n.localeCompare(r)});break}return e},[Be,je]);return k(`div`,{className:`space-y-4`,children:[A&&O(`div`,{className:`rounded-md border border-danger/30 bg-danger/5 px-3 py-2 text-[11px]`,children:k(`div`,{className:`flex items-start justify-between gap-3`,children:[k(`div`,{className:`space-y-0.5`,children:[k(`div`,{className:`font-medium text-danger`,children:[`Failed to update `,A.name]}),O(`div`,{className:`text-foreground-subtle font-mono`,children:A.message})]}),O(`button`,{type:`button`,onClick:()=>j(null),className:`text-foreground-subtle hover:text-foreground text-[10px]`,children:`dismiss`})]})}),k(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[k(`div`,{className:`flex items-center gap-1.5`,children:[O(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Sort:`}),k(`select`,{value:je,onChange:e=>Me(e.target.value),className:`rounded-md border border-border bg-surface px-2 py-1.5 text-[11px] text-foreground focus:outline-none focus:border-primary/50`,children:[O(`option`,{value:`type`,children:`Bundles first`}),O(`option`,{value:`name`,children:`Name`}),O(`option`,{value:`source`,children:`Install source`})]})]}),k(`div`,{className:`flex items-center gap-1.5`,children:[O(`span`,{className:`text-[10px] text-foreground-subtle`,children:`View:`}),O(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`grouped`,`flat`].map(e=>O(`button`,{type:`button`,onClick:()=>Fe(e),className:`px-2.5 py-1.5 transition-colors capitalize ${Ne===e?`bg-primary/10 text-primary`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`}`,title:e===`grouped`?`Group multi-addon packages into a bundle card`:`Show every addon as its own card`,children:e},e))})]}),s.isHub&&k(`div`,{className:`flex items-center gap-1.5`,children:[O(N,{className:`h-3 w-3 text-foreground-subtle`}),O(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Auto-Update:`}),O(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`off`,`latest`,`beta`].map(e=>O(`button`,{type:`button`,onClick:()=>I.mutate({channel:e}),disabled:I.isPending,className:`px-2.5 py-1.5 transition-colors capitalize ${F?.channel===e?e===`off`?`bg-gray-700 text-gray-200`:e===`latest`?`bg-blue-500/20 text-blue-400`:`bg-amber-500/20 text-amber-400`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`} ${e===`off`?``:`border-l border-border`}`,children:e},e))})]}),(b?.length??0)>0&&k(`button`,{type:`button`,onClick:()=>void ke(),disabled:W.isPending||H,className:`flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] rounded-md bg-blue-500/10 text-blue-400 hover:bg-blue-500/20 border border-blue-500/30 disabled:opacity-50 transition-colors font-medium`,children:[O(M,{className:`w-3 h-3 ${W.isPending?`animate-bounce`:``}`}),`Update All (`,b.length,`)`]}),k(`button`,{type:`button`,onClick:u,disabled:d||H,className:`flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,children:[O(N,{className:`w-3 h-3 ${d?`animate-spin`:``}`}),`Refresh`]})]}),k(`div`,{className:`flex items-center gap-3`,children:[k(`div`,{className:`relative flex-1 min-w-[200px]`,ref:y,children:[O(P,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-foreground-subtle`}),O(`input`,{type:`text`,value:p,onChange:e=>{m(e.target.value),v(!0)},onFocus:()=>v(!0),placeholder:`Search addons on npm...`,disabled:H,className:`w-full rounded-lg border border-border bg-background pl-9 pr-3 py-2 text-xs text-foreground placeholder:text-foreground-subtle focus:outline-none focus:ring-1 focus:ring-primary disabled:opacity-50 disabled:cursor-not-allowed`}),de&&O(U,{className:`absolute right-2.5 top-1/2 -translate-y-1/2 h-3 w-3 text-foreground-subtle animate-spin`}),_&&R&&R.length>0&&k(`div`,{className:`absolute left-0 right-0 top-full mt-1 z-40 rounded-lg border border-border bg-surface shadow-xl overflow-hidden`,children:[R.length>0&&k(`div`,{className:`px-3 py-1.5 text-[10px] uppercase tracking-wide text-foreground-subtle border-b border-border`,children:[`npm results (`,R.length,`)`]}),R&&R.length>0&&O(`div`,{className:`max-h-72 overflow-auto divide-y divide-border`,children:R.map(e=>k(`div`,{className:`flex items-center gap-3 px-3 py-2 hover:bg-surface-hover transition-colors`,children:[O(`div`,{className:`w-6 h-6 rounded-md bg-primary/10 flex items-center justify-center text-primary text-[9px] font-bold shrink-0`,children:e.name.replace(`@camstack/addon-`,``).charAt(0).toUpperCase()}),k(`div`,{className:`flex-1 min-w-0`,children:[k(`div`,{className:`flex items-center gap-2`,children:[O(`span`,{className:`text-[11px] font-semibold truncate`,children:e.name}),k(`span`,{className:`text-[10px] text-foreground-subtle`,children:[`v`,e.version]})]}),e.description&&O(`div`,{className:`text-[10px] text-foreground-subtle truncate`,children:e.description})]}),e.installed?k(`span`,{className:`inline-flex items-center gap-1 px-2 py-1 text-[10px] font-medium rounded-md border border-emerald-500/30 bg-emerald-500/10 text-emerald-400 shrink-0`,children:[O(L,{className:`h-3 w-3`}),e.installedVersion??`Installed`]}):k(`button`,{type:`button`,onClick:()=>Ae.mutate({packageName:e.name}),disabled:Ae.isPending,className:`inline-flex items-center gap-1 px-2 py-1 text-[10px] font-medium rounded-md bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors shrink-0`,children:[Ae.isPending?O(U,{className:`h-3 w-3 animate-spin`}):O(M,{className:`h-3 w-3`}),`Install`]})]},e.name))})]})]}),O(X,{onUploadSuccess:()=>{f.invalidateQueries({queryKey:[[`addons`]]}),u()}})]}),$&&k(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg bg-primary/10 border border-primary/30 text-sm`,children:[O(`span`,{className:`text-foreground-subtle`,children:`Filtering by capability:`}),O(`span`,{className:`font-mono text-primary font-semibold`,children:$}),O(`button`,{type:`button`,onClick:ze,className:`ml-auto text-xs text-foreground-subtle hover:text-foreground underline`,children:`Clear`})]}),V!==null&&O(we,{state:V,onCancel:()=>he.mutate({id:V.id})}),ve&&k(`div`,{className:`fixed top-4 right-4 z-50 flex items-start gap-2 px-3 py-2.5 rounded-md border border-green-500/30 bg-green-500/10 shadow-lg backdrop-blur-sm max-w-sm pointer-events-auto`,children:[O(ue,{className:`w-4 h-4 shrink-0 mt-0.5 text-green-400`}),k(`div`,{children:[O(`div`,{className:`text-[11px] font-semibold text-foreground`,children:`Bulk update completed`}),O(`div`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:`System packages updated — hub restarted successfully.`})]})]}),Re.length===0&&O(`div`,{className:`text-xs text-foreground-subtle`,children:e.length===0?`No addons installed`:$?`No installed addons declare the "${$}" capability. Browse the npm catalog above to find a compatible addon.`:`No addons compatible with ${s.name} (placement filter active)`}),O(`div`,{className:`space-y-2`,children:Ve.map(e=>{let n=Q(e)?e.bundle.packageName:e.manifest.packageName,r=ae.get(n),i=Q(e)?e.representative:e,a=be.has(n),o=r?a?()=>xe({packageName:n,fromVersion:be.get(n)?.currentVersion??i.manifest.packageVersion??i.manifest.version,toVersion:r}):()=>le.mutate({name:n,version:r,nodeId:s.id}):void 0;return O(Ce,{addon:i,clusterStatus:t?.[i.manifest.id],bundle:Q(e)?e.bundle:void 0,availableUpdate:r,isUpdating:x===n,onUpdate:o,isSystem:a,bulkItem:me.get(n)??null,disabledByBulk:H},Q(e)?n:e.manifest.id)})}),J!==null&&O(Te,{pending:J,onCancel:()=>{xe(null),Y(null)},onConfirm:()=>{Y(null),Z.mutate({packageName:J.packageName,version:J.toVersion})},isPending:Z.isPending,error:Se})]})}function Ae(){let n=ce(),{data:r,isLoading:i,isError:a}=s(),{data:o}=f(void 0),{data:c}=x(void 0,{refetchInterval:1e4}),l=E(()=>{let e=new Map;e.set(`hub`,{id:`hub`,name:`Hub`,isHub:!0});for(let t of c??[]){let n=String(t.id??``);n&&e.set(n,{id:n,name:String(t.name??n),isHub:!!t.isHub})}return[...e.values()]},[c]),[u,d]=w(`hub`),p=l.find(e=>e.id===u)??l[0],m=e(),ee=y(),h=m.isPending||ee.isPending,te=async()=>{await m.mutateAsync({nodeId:u}),await ee.mutateAsync(),n.invalidateQueries({queryKey:[[`addons`]]})},ne=se(m);ne.current=m,T(()=>{ne.current.mutate({nodeId:`hub`})},[]);let g=(r??[]).map(De).filter(e=>e!==null);return k(W,{children:[k(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[O(t,{selectedNodeId:u,onSelect:d}),k(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[!i&&!a&&k(`span`,{className:`text-[10px] rounded-full bg-primary/10 text-primary px-2 py-0.5 font-medium`,children:[g.length,` installed`]}),k(`button`,{type:`button`,onClick:()=>void te(),disabled:h,className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,title:`Re-fetch addons + check npm for new versions`,children:[O(N,{className:`w-3 h-3 ${h?`animate-spin`:``}`}),`Check for updates`]})]})]}),!p.isHub&&k(`div`,{className:`rounded-md border border-warning/30 bg-warning/5 px-3 py-2 text-[11px] text-foreground-subtle`,children:[`Showing only addons compatible with`,` `,O(`span`,{className:`font-medium text-foreground`,children:p.name}),` — agents only run`,` `,O(`code`,{className:`font-mono`,children:`agent-only`}),` and`,` `,O(`code`,{className:`font-mono`,children:`any-node`}),` addons. Install / uninstall is hub-driven; agents auto-sync from the hub.`]}),i&&O(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading…`}),a&&O(`div`,{className:`text-xs text-danger`,children:`Failed to load addons`}),!i&&!a&&O(ke,{addons:g,clusterStatus:o,selectedNode:p,onRefresh:()=>void te(),isRefreshing:h})]})}export{Ae as AddonsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as e,x as t}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CK8iQdP1.js";function n({icon:n,title:r,subtitle:i,actions:a,children:o}){return t(`div`,{className:`p-4 space-y-4 overflow-x-hidden`,children:[(!!r||i!=null||a!=null)&&t(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-4`,children:[t(`div`,{className:`min-w-0`,children:[r&&t(`h1`,{className:`text-lg font-semibold text-foreground flex items-center gap-2`,children:[n&&e(n,{className:`h-4 w-4 text-foreground-subtle shrink-0`}),r]}),i&&e(`p`,{className:`text-xs text-foreground-subtle mt-0.5`,children:i})]}),a&&e(`div`,{className:`shrink-0 flex items-center gap-2 flex-wrap`,children:a})]}),o]})}export{n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as e,x as t}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CK8iQdP1.js";import{W as n}from"./index-DuroU2aU.js";function r({tabs:r,defaultTab:i}){let[a,o]=n(),s=a.get(`tab`),c=i??r[0]?.id??``,l=r.some(e=>e.id===s)?s:c,u=r.find(e=>e.id===l)??r[0],d=e=>{let t=new URLSearchParams(a);t.set(`tab`,e),o(t,{replace:!0})};return t(`div`,{className:`space-y-3`,children:[e(`div`,{className:`flex border-b border-border overflow-x-auto`,children:r.map(n=>{let r=n.icon;return t(`button`,{onClick:()=>d(n.id),className:`flex shrink-0 items-center gap-1.5 whitespace-nowrap px-3 py-2 text-xs font-medium border-b-2 transition-colors ${n.id===l?`border-primary text-primary`:`border-transparent text-foreground-subtle hover:text-foreground`}`,children:[r&&e(r,{className:`h-3.5 w-3.5`}),n.label]},n.id)})}),e(`div`,{children:u?.content})]})}export{r as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{C as e,Kt as t,zt as n}from"./src-CqVYgpnN.js";import{G as r,U as i,X as a,b as o,x as s}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CK8iQdP1.js";import{x as c}from"./index-DuroU2aU.js";import{t as l}from"./FormBuilder-BXQEmfaE.js";a();function u(t,n){if(!t)return n;let r=new Set;for(let i of t.sections){let t=i.fields;for(let i of t)!(`key`in i)||typeof i.key!=`string`||e(i,n,t)&&r.add(i.key)}let i={};for(let[e,t]of Object.entries(n))r.has(e)&&(i[e]=t);return i}function d({kind:e,addonId:a,initialValues:d,onSubmit:f,onCancel:p,submitLabel:m,disabled:h}){let[g,_]=r(d??{}),[v,y]=r(null),b=n({kind:e,...a===void 0?{}:{addonId:a}}),x=i(()=>{let e=b.data;if(e&&typeof e==`object`&&`sections`in e&&Array.isArray(e.sections))return e},[b.data]),S=t(),C=async()=>{y(null);let t=u(x,g);try{let n=await S.mutateAsync({kind:e,settings:t,...a===void 0?{}:{addonId:a}});y(n.ok?{ok:!0}:{ok:!1,error:n.error})}catch(e){y({ok:!1,error:e instanceof Error?e.message:String(e)})}};return s(`div`,{className:`space-y-3`,children:[b.isLoading&&s(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[o(c,{className:`h-3.5 w-3.5 animate-spin`}),` Loading schema…`]}),x&&o(l,{schema:x,values:g,onChange:_}),b.isError&&s(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:[`Failed to load settings schema:`,` `,b.error instanceof Error?b.error.message:`Unknown error`]}),!x&&!b.isLoading&&!b.isError&&s(`div`,{className:`rounded border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-[11px] text-amber-700 dark:text-amber-300`,children:[`No settings schema available for kind `,o(`code`,{className:`font-mono`,children:e}),`. Its broker addon may not be installed or running.`]}),v&&o(`div`,{className:`rounded border px-3 py-2 text-[11px] ${v.ok?`border-success/30 bg-success/5 text-success`:`border-danger/30 bg-danger/5 text-danger`}`,children:v.ok?`Connection OK.`:`Test failed: ${v.error??`unknown error`}`}),s(`div`,{className:`flex items-center justify-between gap-2 pt-1`,children:[o(`button`,{type:`button`,onClick:p,className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Cancel`}),s(`div`,{className:`flex items-center gap-2`,children:[o(`button`,{type:`button`,onClick:()=>{C()},disabled:S.isPending||!x,className:`rounded border border-border px-3 py-1.5 text-xs text-foreground hover:bg-primary/10 disabled:opacity-50`,children:S.isPending?`Testing…`:`Test connection`}),o(`button`,{type:`button`,onClick:()=>{f(u(x,g))},disabled:!x||h,className:`inline-flex items-center gap-1.5 rounded bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:m??`Save`})]})]})]})}export{d as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ht as e,Lt as t,Vt as n}from"./src-CqVYgpnN.js";import{G as r,U as i,X as a,b as o,x as s}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CK8iQdP1.js";import{N as c,x as l}from"./index-DuroU2aU.js";import{t as u}from"./BrokerForm-Jzl9BAMO.js";a();function d(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.id==`string`):[]}function f(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.addonId==`string`&&Array.isArray(e.kinds)):[]}var p={connected:`bg-emerald-500/15 text-emerald-700 dark:text-emerald-300`,connecting:`bg-amber-500/15 text-amber-700 dark:text-amber-300`,disconnected:`bg-foreground-subtle/15 text-foreground-subtle`,"auth-failed":`bg-danger/15 text-danger`,unreachable:`bg-danger/15 text-danger`,error:`bg-danger/15 text-danger`};function m({kind:a,onResolved:m,onBack:h}){let[g,_]=r(`existing`),v=n({kind:a}),y=i(()=>d(v.data).filter(e=>e.kind===a),[v.data,a]),b=e(),x=i(()=>{for(let e of f(b.data))if(e.kinds.some(e=>e.kind===a))return e.addonId},[b.data,a]),[S,C]=r(null),[w,T]=r(``),E=t({}),D=()=>{S&&m(S)},O=async e=>{w.trim().length!==0&&m((await E.mutateAsync({kind:a,name:w.trim(),settings:e,...x===void 0?{}:{addonId:x}})).id)},k=e=>{e===`new`?C(null):E.reset(),_(e)};return s(`div`,{className:`space-y-4`,children:[s(`button`,{type:`button`,onClick:h,className:`inline-flex items-center gap-1 text-[11px] text-foreground-subtle hover:text-foreground`,children:[o(c,{className:`h-3.5 w-3.5`}),` Back`]}),s(`div`,{className:`inline-flex rounded-lg border border-border p-0.5`,children:[o(`button`,{type:`button`,onClick:()=>k(`existing`),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${g===`existing`?`bg-primary text-primary-foreground`:`text-foreground-subtle hover:text-foreground`}`,children:`Use existing`}),o(`button`,{type:`button`,onClick:()=>k(`new`),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${g===`new`?`bg-primary text-primary-foreground`:`text-foreground-subtle hover:text-foreground`}`,children:`Create new`})]}),g===`existing`?s(`div`,{className:`space-y-3`,children:[v.isLoading&&s(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[o(l,{className:`h-3.5 w-3.5 animate-spin`}),` Loading brokers…`]}),v.isError&&s(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:[`Failed to load brokers:`,` `,v.error instanceof Error?v.error.message:`Unknown error`]}),!v.isLoading&&!v.isError&&y.length===0&&s(`div`,{className:`rounded-lg border border-border bg-surface px-3 py-6 text-center text-xs text-foreground-subtle`,children:[`No brokers of this kind yet. Switch to`,` `,o(`span`,{className:`font-medium text-foreground`,children:`Create new`}),` to register one.`]}),o(`div`,{className:`space-y-2`,children:y.map(e=>s(`button`,{type:`button`,onClick:()=>C(e.id),className:`flex w-full items-center justify-between gap-3 rounded-lg border bg-surface p-3 text-left transition-colors ${S===e.id?`border-primary ring-1 ring-primary`:`border-border hover:border-foreground-subtle/30`}`,children:[o(`span`,{className:`text-xs font-semibold text-foreground`,children:e.name}),o(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium ${p[e.status]}`,children:e.status})]},e.id))}),y.length>0&&o(`div`,{className:`flex justify-end pt-1`,children:o(`button`,{type:`button`,onClick:D,disabled:!S,className:`inline-flex items-center gap-1.5 rounded bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:`Use this broker`})})]}):s(`div`,{className:`space-y-3`,children:[s(`div`,{className:`space-y-1`,children:[o(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Name`}),o(`input`,{type:`text`,value:w,onChange:e=>T(e.target.value),placeholder:`My Home Assistant`,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`})]}),E.isError&&o(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:E.error instanceof Error?E.error.message:String(E.error)}),o(u,{kind:a,...x===void 0?{}:{addonId:x},onSubmit:e=>{O(e).catch(()=>{})},onCancel:h,submitLabel:E.isPending?`Creating…`:`Create broker`,disabled:E.isPending||w.trim().length===0}),w.trim().length===0&&o(`p`,{className:`text-[10px] text-foreground-subtle`,children:`Enter a name before creating.`})]})]})}export{m as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Fi as e}from"./src-CqVYgpnN.js";import{G as t,U as n,X as r,a as i,b as a,t as o,x as s}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CK8iQdP1.js";import{p as c}from"./player-overlays-DzZKARlk.js";import{t as l}from"./circle-check-big-BDdzTa9p.js";import{j as u,u as d,x as f}from"./index-DuroU2aU.js";import{t as p}from"./AdminPage-CN6ZMhf0.js";r();var m={detection:`border-green-500`,detector:`border-green-500`,streaming:`border-blue-500`,decode:`border-blue-500`,decoder:`border-blue-500`,recording:`border-orange-500`,recorder:`border-orange-500`,transcoding:`border-purple-500`,transcoder:`border-purple-500`,restream:`border-cyan-500`,restreamer:`border-cyan-500`,storage:`border-yellow-500`,notification:`border-pink-500`,notifier:`border-pink-500`,faces:`border-indigo-500`},h={detection:`bg-green-500/5`,detector:`bg-green-500/5`,streaming:`bg-blue-500/5`,decode:`bg-blue-500/5`,decoder:`bg-blue-500/5`,recording:`bg-orange-500/5`,recorder:`bg-orange-500/5`,transcoding:`bg-purple-500/5`,transcoder:`bg-purple-500/5`,restream:`bg-cyan-500/5`,restreamer:`bg-cyan-500/5`,storage:`bg-yellow-500/5`,notification:`bg-pink-500/5`,notifier:`bg-pink-500/5`,faces:`bg-indigo-500/5`};function g({entry:e,actions:t}){let n=e.name.toLowerCase(),r=m[n]??`border-primary`,i=h[n]??`bg-primary/5`,o=e.providers.find(e=>e.active),c=t?.pendingCapability===e.name;return s(`div`,{className:`rounded-lg border-t-2 border border-border ${r} ${i} p-3 space-y-2`,children:[s(`div`,{className:`flex items-center justify-between gap-2`,children:[s(`span`,{className:`text-xs font-semibold text-foreground capitalize flex items-center gap-1.5`,children:[e.name,c&&a(f,{className:`h-3 w-3 animate-spin text-primary`})]}),a(`span`,{className:`rounded-full px-2 py-0.5 text-[10px] font-medium ${e.mode===`singleton`?`bg-primary/10 text-primary`:`bg-info/10 text-info`}`,children:e.mode})]}),e.mode===`singleton`?a(_,{entry:e,actions:t,activeProvider:o,isPending:c}):a(v,{entry:e,actions:t,isPending:c})]})}function _({entry:e,actions:t,activeProvider:n,isPending:r}){if(!t)return a(`div`,{children:n?s(`div`,{className:`flex items-center gap-1.5 text-[10px] text-foreground`,children:[a(l,{className:`h-3 w-3 text-green-400 shrink-0`}),a(`span`,{className:`font-medium`,children:n.addonName}),a(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto`,children:`ACTIVE`})]}):a(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:`No active provider`})});if(e.providers.length===0)return a(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:`No providers`});let i=`__inherit__`;return s(`div`,{className:`space-y-2`,children:[a(`div`,{className:`space-y-1`,children:e.providers.map(n=>{let i=n.active;return s(`button`,{type:`button`,disabled:r||i,onClick:()=>t.onSelectSingleton(e.name,n.addonId),className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-[10px] text-left transition-colors ${i?`bg-green-500/10 text-foreground cursor-default`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`}`,children:[a(`span`,{className:`h-2.5 w-2.5 rounded-full border shrink-0 ${i?`border-green-400 bg-green-400`:`border-border`}`}),a(`span`,{className:`font-medium truncate`,children:n.addonName}),i&&a(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto shrink-0`,children:`ACTIVE`})]},n.addonId)})}),e.perNode&&e.perNode.length>0&&a(`div`,{className:`space-y-2 pt-1 border-t border-border/40`,children:e.perNode.map(n=>{let o=n.hasOverride&&n.resolvedActive?n.resolvedActive:i,c=[{value:i,label:`Inherit global${n.resolvedActive?` (${n.resolvedActive})`:``}`},...n.providers.map(e=>({value:e,label:e}))],l=r=>{r===i?t.onClearNodeSingleton(e.name,n.nodeId):t.onSelectNodeSingleton(e.name,n.nodeId,r)},u=r;return s(`div`,{className:`space-y-0.5`,children:[s(`div`,{className:`text-[9px] font-semibold uppercase tracking-widest text-foreground-subtle/60 px-1.5`,children:[n.nodeId,n.hasOverride&&a(`span`,{className:`ml-1.5 rounded-full bg-primary/10 text-primary px-1 py-0.5 normal-case tracking-normal font-medium`,children:`override`})]}),c.map(e=>{let t=o===e.value;return s(`button`,{type:`button`,disabled:u||t,onClick:()=>l(e.value),className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-[10px] text-left transition-colors ${t?`bg-green-500/10 text-foreground cursor-default`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`}`,children:[a(`span`,{className:`h-2.5 w-2.5 rounded-full border shrink-0 ${t?`border-green-400 bg-green-400`:`border-border`}`}),a(`span`,{className:`font-medium truncate`,children:e.label}),t&&e.value!==i&&a(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto shrink-0`,children:`ACTIVE`})]},e.value)})]},n.nodeId)})})]})}function v({entry:e,actions:t,isPending:n}){if(e.providers.length===0)return a(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:`No providers`});if(!t)return a(`div`,{className:`space-y-1`,children:e.providers.map(e=>s(`div`,{className:`flex items-center justify-between gap-2 text-[10px]`,children:[a(`span`,{className:`text-foreground-subtle`,children:e.addonName}),e.active&&a(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium`,children:`ACTIVE`})]},e.addonId))});let r=e.providers.filter(e=>e.active).map(e=>e.addonId),i=(n,i)=>{let a=i?[...new Set([...r,n])]:r.filter(e=>e!==n);t.onToggleCollection(e.name,a)};return a(`div`,{className:`space-y-1`,children:e.providers.map(e=>s(`label`,{className:`flex items-center justify-between gap-2 text-[10px] rounded px-1.5 py-1 transition-colors ${n?`opacity-50`:`hover:bg-surface-hover cursor-pointer`}`,children:[s(`span`,{className:`flex items-center gap-1.5 min-w-0`,children:[a(`input`,{type:`checkbox`,checked:e.active,disabled:n,onChange:t=>i(e.addonId,t.target.checked),className:`h-3 w-3 accent-green-500 shrink-0`}),a(`span`,{className:`text-foreground truncate`,children:e.addonName})]}),e.active&&a(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium shrink-0`,children:`ACTIVE`})]},e.addonId))})}function y({capabilities:e,actions:t}){return e.length===0?a(`div`,{className:`text-xs text-foreground-subtle text-center py-8`,children:`No capabilities registered`}):a(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3`,children:e.map(e=>a(g,{entry:e,actions:t},e.name))})}var b=[`capabilities`,`listCapabilities`];function x(e){return e===`singleton`||e===`collection`}function S(e){let t=e.indexOf(`@`);return t===-1?`${e} (hub)`:`${e.slice(0,t)} (${e.slice(t+1)})`}function C(e,t){return{name:e.name,mode:t,providers:e.providers.map(n=>({addonId:n,addonName:S(n),active:t===`singleton`?e.activeProvider===n:!e.disabledProviders.includes(n)})),...t===`singleton`&&e.perNode?{perNode:e.perNode}:{}}}function w(){let r=c(),[f,m]=t(null),[h,g]=t(null),_=i({queryKey:b,queryFn:()=>r.trpcClient.capabilities.listCapabilities.query()}),v=n(()=>{let e=(_.data??[]).flatMap(e=>x(e.mode)?[C(e,e.mode)]:[]),t=e.filter(e=>e.mode===`singleton`).toSorted((e,t)=>e.name.localeCompare(t.name)),n=e.filter(e=>e.mode===`collection`).toSorted((e,t)=>e.name.localeCompare(t.name));return[...t,...n]},[_.data]),S=n(()=>v.filter(e=>e.mode===`singleton`),[v]),w=n(()=>v.filter(e=>e.mode===`collection`),[v]),T=o({mutationFn:e=>r.trpcClient.capabilities.setActiveSingleton.mutate({capability:e.capName,addonId:e.addonId}),onMutate:e=>{m(e.capName),g(null)},onSuccess:async(e,t)=>{g({kind:`success`,message:`${t.capName} → ${t.addonId} is now active.`}),await _.refetch()},onError:(e,t)=>{g({kind:`error`,message:`Failed to set ${t.capName}: ${e instanceof Error?e.message:`unknown error`}`})},onSettled:()=>m(null)}),E=o({mutationFn:e=>r.trpcClient.capabilities.setActiveSingleton.mutate({capability:e.capName,addonId:e.addonId,nodeId:e.nodeId}),onMutate:e=>{m(e.capName),g(null)},onSuccess:async(e,t)=>{g({kind:`success`,message:`${t.capName} @ ${t.nodeId} → ${t.addonId}.`}),await _.refetch()},onError:(e,t)=>{g({kind:`error`,message:`Failed to set ${t.capName} @ ${t.nodeId}: ${e instanceof Error?e.message:`unknown error`}`})},onSettled:()=>m(null)}),D=o({mutationFn:e=>r.trpcClient.capabilities.clearSingletonNodeOverride.mutate({capability:e.capName,nodeId:e.nodeId}),onMutate:e=>{m(e.capName),g(null)},onSuccess:async(e,t)=>{g({kind:`success`,message:`${t.capName} @ ${t.nodeId} now inherits the global default.`}),await _.refetch()},onError:(e,t)=>{g({kind:`error`,message:`Failed to clear ${t.capName} @ ${t.nodeId}: ${e instanceof Error?e.message:`unknown error`}`})},onSettled:()=>m(null)}),O=o({mutationFn:e=>r.trpcClient.capabilities.setCollectionEnabledProviders.mutate({capability:e.capName,enabledAddonIds:[...e.enabledAddonIds]}),onMutate:e=>{m(e.capName),g(null)},onSuccess:async(e,t)=>{g({kind:`success`,message:`${t.capName}: ${t.enabledAddonIds.length} provider(s) enabled.`}),await _.refetch()},onError:(e,t)=>{g({kind:`error`,message:`Failed to update ${t.capName}: ${e instanceof Error?e.message:`unknown error`}`})},onSettled:()=>m(null)}),k={onSelectSingleton:(e,t)=>T.mutate({capName:e,addonId:t}),onSelectNodeSingleton:(e,t,n)=>E.mutate({capName:e,nodeId:t,addonId:n}),onClearNodeSingleton:(e,t)=>D.mutate({capName:e,nodeId:t}),onToggleCollection:(e,t)=>O.mutate({capName:e,enabledAddonIds:t}),pendingCapability:f};return s(p,{icon:d,title:`Capabilities`,subtitle:`Choose which provider is active for each system capability. Singleton caps pick exactly one provider; collection caps enable a set.`,children:[h&&s(`div`,{className:`flex items-center gap-2 rounded-md border px-3 py-2 text-xs ${h.kind===`success`?`border-green-500/30 bg-green-500/10 text-green-700 dark:text-green-300`:`border-danger/40 bg-danger/10 text-danger`}`,children:[h.kind===`success`?a(l,{className:`h-3.5 w-3.5 shrink-0`}):a(u,{className:`h-3.5 w-3.5 shrink-0`}),a(`span`,{children:h.message})]}),_.isLoading&&a(`div`,{className:`flex items-center justify-center py-16`,children:a(`div`,{className:`animate-spin h-6 w-6 border-2 border-primary border-t-transparent rounded-full`})}),_.isError&&!_.isLoading&&a(e,{title:`Failed to load capabilities`,message:_.error instanceof Error?_.error.message:`Unknown error`,onRetry:()=>void _.refetch()}),!_.isLoading&&!_.isError&&v.length===0&&a(`div`,{className:`text-xs text-foreground-subtle text-center py-16`,children:`No capabilities registered.`}),!_.isLoading&&!_.isError&&v.length>0&&s(`div`,{className:`space-y-6`,children:[S.length>0&&s(`section`,{className:`space-y-2`,children:[a(`h2`,{className:`text-[11px] font-semibold uppercase tracking-widest text-foreground-subtle/70`,children:`Singleton — pick one provider`}),a(y,{capabilities:S,actions:k})]}),w.length>0&&s(`section`,{className:`space-y-2`,children:[a(`h2`,{className:`text-[11px] font-semibold uppercase tracking-widest text-foreground-subtle/70`,children:`Collection — enable a set`}),a(y,{capabilities:w,actions:k})]})]})]})}export{w as CapabilitiesPage,w as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as e,x as t}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CK8iQdP1.js";import{t as n}from"./bell-C9HUnDGC.js";import{n as r,r as i,t as a}from"./zap-CZ68wiP1.js";import{t as o}from"./radio-CyBw1Cvj.js";import{t as s}from"./refresh-cw-CPqFoliO.js";import{B as c,I as l,L as u,T as d,f,k as p}from"./index-DuroU2aU.js";var m=c(`battery-full`,[[`rect`,{width:`16`,height:`10`,x:`2`,y:`7`,rx:`2`,ry:`2`,key:`1w10f2`}],[`line`,{x1:`22`,x2:`22`,y1:`11`,y2:`13`,key:`4dh1rd`}],[`line`,{x1:`6`,x2:`6`,y1:`11`,y2:`13`,key:`1wd6dw`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`13`,key:`haxvl5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`13`,key:`c6fn6x`}]]),h=c(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),g=c(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),_={streaming:{icon:r,label:`Streaming`},detection:{icon:d,label:`Detection`},recording:{icon:h,label:`Recording`},audio:{icon:i,label:`Audio`},snapshot:{icon:l,label:`Snapshot`},motion:{icon:a,label:`Motion`},ptz:{icon:f,label:`PTZ`},webrtc:{icon:o,label:`WebRTC`},onvif:{icon:g,label:`ONVIF`},analytics:{icon:p,label:`Analytics`},"battery-operated":{icon:m,label:`Battery`},"native-snapshot":{icon:l,label:`Native Snapshot`},"pan-tilt-zoom":{icon:f,label:`PTZ`},"two-way-audio":{icon:i,label:`Two-way Audio`},"doorbell-button":{icon:n,label:`Doorbell`},rebootable:{icon:s,label:`Rebootable`}},v=u;function y({capabilities:n,showLabels:r=!1}){return e(`div`,{className:`flex items-center gap-1 flex-wrap`,children:n.map(n=>{let i=_[n],a=i?.icon??v,o=i?.label??n;return t(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] text-foreground-subtle`,title:o,children:[e(a,{className:`h-3 w-3`}),r&&e(`span`,{children:o})]},n)})})}export{y as t};
|