@camstack/addon-admin-ui 1.2.5 → 1.2.7
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-BMp3_ArA.js → AddLocationWizard-CyKRLLsk.js} +1 -1
- package/dist/assets/{AddonCollectionPage-DXPJ4IsQ.js → AddonCollectionPage-CXk6wckg.js} +1 -1
- package/dist/assets/{Addons-B8OcsvV3.js → Addons-DxWqyv8n.js} +1 -1
- package/dist/assets/{AdminTabs-DO-Sr4Tn.js → AdminTabs-WUZUR1_6.js} +1 -1
- package/dist/assets/{AiProfiles-Ch4iQ3B5.js → AiProfiles-BMqEeLB9.js} +1 -1
- package/dist/assets/{BrokerForm-CQDxUGHE.js → BrokerForm-B4reF7bk.js} +1 -1
- package/dist/assets/{Capabilities-MVkRHmqG.js → Capabilities-CGdYm2VO.js} +1 -1
- package/dist/assets/{CapabilityBadges-Cfo1bKEC.js → CapabilityBadges-DupibTp6.js} +1 -1
- package/dist/assets/Cluster-Bg86E_Ph.js +1 -0
- package/dist/assets/{ClusterRecordingTab-XOXRgw3i.js → ClusterRecordingTab-tAD7jTdA.js} +1 -1
- package/dist/assets/{Dashboard-CqoVTR8j.js → Dashboard-D_-AvUFa.js} +1 -1
- package/dist/assets/{Data-k2164crS.js → Data-Df1IWyzV.js} +1 -1
- package/dist/assets/{DetectionIntelligence-OyCdr-l6.js → DetectionIntelligence-BI5eb6VF.js} +1 -1
- package/dist/assets/{DeviceDetail-B1oypwPh.js → DeviceDetail-Dy53krDA.js} +2 -2
- package/dist/assets/{Devices-Chs4dn95.js → Devices-BeGicFJ4.js} +1 -1
- package/dist/assets/{EmbedPlayerPage-DzbToLzX.js → EmbedPlayerPage-Bz16DLEQ.js} +1 -1
- package/dist/assets/Events-C1HeFo1b.js +1 -0
- package/dist/assets/{FormBuilder-DwiLYaBh.js → FormBuilder-Dcrl2dAa.js} +1 -1
- package/dist/assets/Identity-DN84XYQh.js +1 -0
- package/dist/assets/{IntegrationDetail-ClHi8qin.js → IntegrationDetail-UDrWOj_z.js} +1 -1
- package/dist/assets/{Integrations-DKaDwP5n.js → Integrations-BGeF0z1-.js} +1 -1
- package/dist/assets/{Integrations-ZpqED3It.js → Integrations-CyJ8TvXg.js} +1 -1
- package/dist/assets/{Logs-HW__FOKu.js → Logs-CHI7r5Ye.js} +1 -1
- package/dist/assets/{MotionZonesSettings-B8JW1fby.js → MotionZonesSettings-WsP8vtl5.js} +1 -1
- package/dist/assets/{MyAccess-BzQfqfKG.js → MyAccess-bfp4HXqC.js} +1 -1
- package/dist/assets/Network-BspWeG-0.js +1 -0
- package/dist/assets/{NodeAddonsSettingsPanel-BuWZzBM3.js → NodeAddonsSettingsPanel-rffEhcPI.js} +1 -1
- package/dist/assets/{NodeInferenceDevices-DL5frrfI.js → NodeInferenceDevices-BXQmztNN.js} +1 -1
- package/dist/assets/Notifications-Dgc1okWT.js +1 -0
- package/dist/assets/Pipeline--FjxVr2W.js +1 -0
- package/dist/assets/{Plates-CYfYUSbU.js → Plates-DbBtLzJC.js} +1 -1
- package/dist/assets/{PrivacyMaskSettings-x8jlVyJq.js → PrivacyMaskSettings-ql8SIBIL.js} +1 -1
- package/dist/assets/{ProviderIcon-wnMfbQy4.js → ProviderIcon-CdU30uOa.js} +1 -1
- package/dist/assets/{Recordings-OiR9CZFY.js → Recordings-BjBRfyKe.js} +1 -1
- package/dist/assets/{ScanNetworkModal-1Q-_HgV7.js → ScanNetworkModal-4wyR27nx.js} +1 -1
- package/dist/assets/{Settings-zUCdAuEc.js → Settings-4vAsvFH0.js} +1 -1
- package/dist/assets/{Showroom-C9TUeqec.js → Showroom-CxLSIOyr.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-MYM_DFPB.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DAIzy1TU.js} +1 -1
- package/dist/assets/{build-cluster-graph-DFtjBwVv.js → build-cluster-graph-Du7k1coC.js} +1 -1
- package/dist/assets/circle-check-big--QL2GpFx.js +1 -0
- package/dist/assets/clock-CyOcMtqv.js +1 -0
- package/dist/assets/{copy-6aAUV8Mk.js → copy-P5fXgdqY.js} +1 -1
- package/dist/assets/{debounced-invalidate-BMlW3lc0.js → debounced-invalidate-ByBXa--a.js} +1 -1
- package/dist/assets/{dist-CEYXvLds.js → dist-6bufrn_9.js} +1 -1
- package/dist/assets/dist-D5Idz-si.js +7 -0
- package/dist/assets/{download-DSBNUTk-.js → download-CUh_sBGh.js} +1 -1
- package/dist/assets/{face-bbox-D9kGh3_L.js → face-bbox-CmPaZHSA.js} +1 -1
- package/dist/assets/history-Ccgj8IlI.js +1 -0
- package/dist/assets/{hostInit-CHyZb2jR.js → hostInit-DI1uaYRB.js} +1 -1
- package/dist/assets/index-BRI5wMdK.js +4 -0
- package/dist/assets/index-BTiaHVM4.css +2 -0
- package/dist/assets/{key-round-Cstot2GS.js → key-round-CiLCQeTs.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-c9057dc3.js → mf-entry-bootstrap-0-971ffca4.js} +2 -2
- package/dist/assets/{pencil-Bko5beeH.js → pencil-Dn4Tq-6q.js} +1 -1
- package/dist/assets/{player-overlays-BKrLqfAl.js → player-overlays-BlOdAA3b.js} +1 -1
- package/dist/assets/plus-aicZUT2N.js +1 -0
- package/dist/assets/{radio-DVfJmyYr.js → radio-BHc_j2JR.js} +1 -1
- package/dist/assets/{refresh-cw-Cnkkn0UW.js → refresh-cw-BOEcKgeL.js} +1 -1
- package/dist/assets/remoteEntry-DtMf1Sjf.js +1 -0
- package/dist/assets/{rotate-ccw-DDJ9B3KX.js → rotate-ccw-BY7N75CC.js} +1 -1
- package/dist/assets/rotate-cw-EWhrkzd5.js +1 -0
- package/dist/assets/search-De5It8ha.js +1 -0
- package/dist/assets/{send-ea1mmeKQ.js → send-B-LV5moh.js} +1 -1
- package/dist/assets/{server-B33eaAVX.js → server-CLJXfmXf.js} +1 -1
- package/dist/assets/square-LbSm0MOQ.js +1 -0
- package/dist/assets/{square-check-big-BipJcw1N.js → square-check-big-BVXCHO2K.js} +1 -1
- package/dist/assets/{src-CwIdcVoz.js → src--IMzqbG0.js} +10 -10
- package/dist/assets/src-GxiMH1Sc.js +7 -0
- package/dist/assets/{upload-B33Dg1HW.js → upload-Bg8i0i0l.js} +1 -1
- package/dist/assets/{useEventInvalidation-CJRYaSHm.js → useEventInvalidation-C2Xytz1c.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DQyAd46J.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-Xdd8H1t3.js} +2 -2
- package/dist/assets/{wifi-13IJJu3_.js → wifi-DZshyJ4Y.js} +1 -1
- package/dist/assets/{zap-BKYskYDR.js → zap-DUonLa5R.js} +1 -1
- package/dist/index.html +6 -6
- package/dist/server/addon.js +1295 -765
- package/package.json +1 -1
- package/dist/assets/Cluster-CTZ6NmZH.js +0 -1
- package/dist/assets/Events-Ra5oWcAW.js +0 -1
- package/dist/assets/Identity-BENlLATs.js +0 -1
- package/dist/assets/Network-DFmblT51.js +0 -1
- package/dist/assets/NotificationTargets-CKImIUO1.js +0 -1
- package/dist/assets/Pipeline-DENQvEkZ.js +0 -1
- package/dist/assets/circle-check-big-W-N893Qq.js +0 -1
- package/dist/assets/clock-BV9uesj_.js +0 -1
- package/dist/assets/dist-66GfYkbI.js +0 -7
- package/dist/assets/index-C-ZEPJCU.css +0 -2
- package/dist/assets/index-CqPUI4oB.js +0 -4
- package/dist/assets/plus-S9U4mORX.js +0 -1
- package/dist/assets/remoteEntry-DZ0wTuWP.js +0 -1
- package/dist/assets/rotate-cw-CcMz09b3.js +0 -1
- package/dist/assets/search-bAcYqDxO.js +0 -1
- package/dist/assets/square-CasTblrl.js +0 -1
- package/dist/assets/src-awTRXPIW.js +0 -7
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$r as e,Ci as t,Do as n,Ei as r,Eo as i,Ha as a,Ii as o,Ja as s,Ka as c,La as l,Mi as u,Ni as d,Pi as f,Qr as p,Si as m,T as h,Ti as g,Ua as _,Va as v,Vr as y,Wa as b,Xa as x,Za as S,_ as C,_i as w,ai as T,bi as E,bo as D,ci as O,di as k,ei as ee,ft as A,g as j,gi as M,ii as te,ji as N,li as ne,lt as re,mi as ie,ni as ae,oi as oe,qa as se,ri as ce,si as le,ti as ue,ut as de,vi as fe,wi as pe,xi as me,yi as he}from"./src-CwIdcVoz.js";import{I as ge,K as _e,Q as P,S as F,T as ve,W as I,b as L,o as R,q as z,x as B,z as V}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{G as ye,K as be,X as xe}from"./src-awTRXPIW.js";import{c as Se,n as H,o as Ce,r as we,s as Te,t as Ee}from"./NodeInferenceDevices-DL5frrfI.js";import{t as De}from"./download-DSBNUTk-.js";import{i as Oe}from"./AddLocationWizard-BMp3_ArA.js";import{n as ke,r as Ae,t as je}from"./zap-BKYskYDR.js";import{t as Me}from"./pencil-Bko5beeH.js";import{t as Ne}from"./plus-S9U4mORX.js";import{t as Pe}from"./radio-DVfJmyYr.js";import{t as Fe}from"./refresh-cw-Cnkkn0UW.js";import{t as Ie}from"./search-bAcYqDxO.js";import{t as Le}from"./server-B33eaAVX.js";import{t as Re}from"./square-check-big-BipJcw1N.js";import{t as ze}from"./square-CasTblrl.js";import{E as Be,I as Ve,J as He,L as U,M as Ue,N as We,P as Ge,S as W,T as Ke,W as qe,i as Je,j as G,o as Ye,s as Xe}from"./index-CqPUI4oB.js";import{t as Ze}from"./AdminPage-BwmGKnRf.js";import{t as Qe}from"./useEventInvalidation-CJRYaSHm.js";import{r as $e,t as et}from"./build-cluster-graph-DFtjBwVv.js";import{n as tt}from"./format-size-CO9d3C3-.js";import{t as nt}from"./NodeAddonsSettingsPanel-BuWZzBM3.js";import{n as rt,t as it}from"./ClusterRecordingTab-XOXRgw3i.js";var at=qe(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),ot=qe(`flame`,[[`path`,{d:`M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z`,key:`96xj49`}]]),st=qe(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]);P();function ct(e){return e}function lt(e,t){for(let[n,r]of Object.entries(e??{}))if(n===t)return r}function ut(e,t){return typeof e==`boolean`?e:ct(t)}function dt(e,t){return{pipeline:ut(lt(e,`detect`),t),audio:ut(lt(e,`audio`),t),ingest:ut(lt(e,`ingest`),t)}}function ft(e,t,n){let r=e?.find(e=>e.nodeId===t);return dt(r?.settings,n)}function pt({selectedNodeId:e,onSelect:t,refreshToken:r}){let{data:i}=y(void 0),{data:a}=M(void 0),{data:o}=fe(void 0),s=new Map;for(let e of a??[])s.set(e.agentNodeId,(s.get(e.agentNodeId)??0)+1);let c=i??[],l=c.filter(e=>e.isOnline).length,u=c.filter(e=>!e.isOnline).length;return F(`div`,{className:`flex flex-col h-full`,children:[F(`button`,{type:`button`,onClick:()=>t(br),className:`flex items-center gap-3 px-4 py-3 border-b border-border text-left transition-colors ${e===`__cluster__`?`bg-primary/10 text-primary`:`text-foreground hover:bg-surface-hover`}`,children:[B(Ke,{className:`h-4 w-4 flex-shrink-0`}),F(`div`,{className:`min-w-0 flex-1`,children:[B(`div`,{className:`text-xs font-semibold truncate`,children:`Cluster`}),B(`div`,{className:`text-[10px] text-foreground-subtle`,children:`Balancer + failover + assignments`})]})]}),B(`div`,{className:`flex-1 overflow-y-auto`,children:c.map(r=>{let i=e===r.id,a=s.get(r.id)??0,c=r.isHub?Le:G,l=ft(o,r.id,r.isHub),u=r.isOnline?null:n($e(r.lastSeen));return F(`button`,{type:`button`,onClick:()=>t(r.id),className:`flex items-center gap-3 w-full px-4 py-3 border-b border-border text-left transition-colors ${i?`bg-primary/10 text-primary`:`text-foreground hover:bg-surface-hover`}${r.isOnline?``:` opacity-60`}`,children:[B(c,{className:`h-4 w-4 flex-shrink-0`}),F(`div`,{className:`min-w-0 flex-1`,children:[F(`div`,{className:`flex items-center gap-2`,children:[B(`span`,{className:`text-xs font-semibold truncate`,children:r.name}),r.isHub&&B(`span`,{className:`text-[9px] uppercase tracking-wider text-foreground-subtle border border-border rounded px-1 py-0.5`,children:`hub`}),!r.isOnline&&B(`span`,{className:`h-1.5 w-1.5 rounded-full bg-destructive flex-shrink-0`}),r.isOnline&&B(`span`,{className:`h-1.5 w-1.5 rounded-full bg-success flex-shrink-0`})]}),F(`div`,{className:`text-[10px] text-foreground-subtle flex items-center gap-2 mt-0.5`,children:[F(`span`,{children:[r.cpuCores,` cores`]}),B(`span`,{children:`•`}),F(`span`,{children:[Math.round(r.memoryMB/1024),` GB`]}),a>0&&F(L,{children:[B(`span`,{children:`•`}),F(`span`,{className:`inline-flex items-center gap-0.5 text-foreground`,children:[B(ke,{className:`h-2.5 w-2.5`}),a]})]}),!r.isOnline&&F(L,{children:[B(`span`,{children:`•`}),F(`span`,{className:`text-destructive`,children:[`offline`,u===null?``:` · ${u}`]})]})]}),F(`div`,{className:`mt-0.5 flex items-center gap-1`,children:[B(D,{variant:l.pipeline?`success`:`danger`,className:`px-1 py-0 text-[9px] leading-3`,title:l.pipeline?`Pipeline: enabled`:`Pipeline: not enabled (agent capability)`,children:`Pipe`}),B(D,{variant:l.audio?`success`:`danger`,className:`px-1 py-0 text-[9px] leading-3`,title:l.audio?`Audio: enabled`:`Audio: not enabled (agent capability)`,children:`Aud`})]})]})]},r.id)})}),F(`div`,{className:`px-4 py-2 border-t border-border text-[10px] text-foreground-subtle flex items-center justify-between`,children:[F(`span`,{children:[l,` online`]}),u>0&&F(`span`,{className:`text-destructive`,children:[u,` offline`]})]})]})}function mt({nodeId:e,refreshToken:t}){let{data:n}=y(void 0),r=n?.find(t=>t.id===e),i=a(`pipeline.runner-load-snapshot`,t=>t.nodeId===e)?.load??null;return r?F(`div`,{className:`px-6 py-4 border-b border-border`,children:[F(`div`,{className:`flex items-center gap-2 mb-1`,children:[B(`h2`,{className:`text-base font-semibold text-foreground`,children:r.name}),r.isOnline?B(`span`,{className:`text-[10px] px-2 py-0.5 rounded-full bg-success/10 text-success`,children:`online`}):B(`span`,{className:`text-[10px] px-2 py-0.5 rounded-full bg-destructive/10 text-destructive`,children:`offline`}),r.isHub&&B(`span`,{className:`text-[9px] uppercase tracking-wider text-foreground-subtle border border-border rounded px-1 py-0.5`,children:`hub`})]}),F(`div`,{className:`text-[11px] text-foreground-subtle flex items-center gap-2 flex-wrap`,children:[B(`span`,{children:r.cpuModel??`CPU`}),B(`span`,{children:`•`}),F(`span`,{children:[r.cpuCores,` cores`]}),B(`span`,{children:`•`}),F(`span`,{children:[Math.round(r.memoryMB/1024),` GB`]}),i&&F(L,{children:[B(`span`,{children:`•`}),F(`span`,{children:[i.attachedCameras,` cameras (`,i.activeCameras,` active)`]}),B(`span`,{children:`•`}),F(`span`,{children:[i.avgInferenceTimeMs.toFixed(0),`ms avg inference`]}),B(`span`,{children:`•`}),F(`span`,{children:[`queue `,i.queueDepthTotal]}),i.hardware.hasGpu&&F(L,{children:[B(`span`,{children:`•`}),B(`span`,{className:`text-success`,children:`GPU`})]})]})]})]}):B(`div`,{className:`px-6 py-4 border-b border-border`,children:F(`div`,{className:`text-xs text-foreground-subtle`,children:[`Node not found: `,e]})})}function ht({refreshToken:e,nodeId:t}){let[n,r]=z(new Map),{nodes:i}=v();b(`pipeline.camera-metrics-snapshot`,e=>{let t=e.data;typeof t?.deviceId==`number`&&r(e=>{let n=new Map(e);return n.set(t.deviceId,t),n})});let{data:a}=ne(void 0),o=I(()=>{let e=new Map;for(let t of a??[])e.set(t.nodeId,t.deviceCount);return e},[a]),s=I(()=>{let e=new Map,t=Date.now()-3e4;for(let r of n.values()){if(r.timestamp<t)continue;let n=r.nodeId??`hub`,i=e.get(n)??{attachedCameras:0,activeCameras:0,totalFps:0,totalInferenceWeighted:0,queueDepth:0};i.attachedCameras++,r.metrics.phase===`active`&&i.activeCameras++,i.totalFps+=r.metrics.actualFps,i.totalInferenceWeighted+=r.metrics.avgInferenceTimeMs,i.queueDepth+=r.metrics.queueDepth,e.set(n,i)}return e},[n]),c=I(()=>{let e=new Map;for(let t of i)e.set(t.id,t.shortName);return e},[i]),l=I(()=>{let e=0,t=0,n=0,r=0,a=0;for(let i of s.values())e+=i.attachedCameras,t+=i.activeCameras,n+=i.totalFps,r+=i.totalInferenceWeighted,a+=i.queueDepth;let o=e>0?r/e:0;return{totalAgents:i.length,onlineAgents:i.filter(e=>e.isOnline).length,attachedCameras:e,activeCameras:t,avgInferenceTimeMs:o,queueDepth:a,totalFps:n}},[s,i]);if(t){let e=s.get(t);return F(`div`,{className:`@container/liveload`,children:[B(`h3`,{className:`text-sm font-semibold text-foreground mb-2`,children:`Live load`}),F(`div`,{className:`grid grid-cols-2 @md/liveload:grid-cols-3 @3xl/liveload:grid-cols-5 gap-2 mb-3`,children:[B(K,{label:`FPS`,value:e?e.totalFps.toFixed(1):`—`}),B(K,{label:`Active / Attached`,value:e?`${e.activeCameras}/${e.attachedCameras}`:`—`}),B(K,{label:`Avg infer ms`,value:e&&e.attachedCameras>0?(e.totalInferenceWeighted/e.attachedCameras).toFixed(0):`—`}),B(K,{label:`Queue`,value:e?String(e.queueDepth):`—`}),B(K,{label:`Audio`,value:String(o.get(t)??`—`)})]})]})}let u=[...s.entries()].toSorted(([e],[t])=>e===`hub`?-1:t===`hub`?1:e.localeCompare(t));return F(`div`,{className:`@container/liveload`,children:[B(`h3`,{className:`text-sm font-semibold text-foreground mb-2`,children:`Live load`}),F(`div`,{className:`grid grid-cols-2 @md/liveload:grid-cols-3 @3xl/liveload:grid-cols-5 gap-2 sm:gap-3 mb-3`,children:[B(K,{label:`Total agents`,value:`${l.onlineAgents}/${l.totalAgents}`}),B(K,{label:`Active / Attached`,value:`${l.activeCameras}/${l.attachedCameras}`}),B(K,{label:`Total FPS`,value:l.totalFps.toFixed(1)}),B(K,{label:`Avg inference ms`,value:l.avgInferenceTimeMs.toFixed(0)}),B(K,{label:`Queue depth`,value:String(l.queueDepth)})]}),B(`div`,{className:`rounded-lg border border-border overflow-x-auto`,children:F(`table`,{className:`w-full text-xs min-w-[480px]`,children:[B(`thead`,{className:`bg-surface`,children:F(`tr`,{className:`text-foreground-subtle text-[10px] uppercase tracking-wider`,children:[B(`th`,{className:`text-left px-3 py-2`,children:`Agent`}),B(`th`,{className:`text-right px-3 py-2`,children:`FPS`}),B(`th`,{className:`text-right px-3 py-2`,children:`Cameras`}),B(`th`,{className:`text-right px-3 py-2`,children:`Inference ms`}),B(`th`,{className:`text-right px-3 py-2`,children:`Queue`}),B(`th`,{className:`text-right px-3 py-2`,children:`Audio`})]})}),F(`tbody`,{children:[u.map(([e,t])=>F(`tr`,{className:`border-t border-border`,children:[B(`td`,{className:`px-3 py-2 text-foreground font-medium`,children:c.get(e)??e}),B(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.totalFps.toFixed(1)}),B(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.attachedCameras}),B(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.attachedCameras>0?(t.totalInferenceWeighted/t.attachedCameras).toFixed(0):`—`}),B(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.queueDepth}),B(`td`,{className:`px-3 py-2 text-right text-foreground`,children:o.get(e)??`—`})]},e)),u.length===0&&B(`tr`,{children:B(`td`,{colSpan:6,className:`px-3 py-4 text-center text-foreground-subtle text-[11px]`,children:`No camera metrics received yet`})})]})]})})]})}function K({label:e,value:t}){return F(`div`,{className:`rounded-lg border border-border bg-surface/60 p-3`,children:[B(`div`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle mb-1`,children:e}),B(`div`,{className:`text-lg font-semibold text-foreground`,children:t})]})}P();var gt={active:!1,pinned:!1,nodeId:null,reason:``},_t=[`pipeline.camera-assigned`,`pipeline.camera-unassigned`,`pipeline.camera-updated`,`agent.online`,`agent.offline`],vt={pipeline:G,decoder:Be,audio:Ae},yt={pipeline:`Pipeline`,decoder:`Decoder`,audio:`Audio`};function bt({mode:e,nodeId:t,compact:n=!1}){if(e===`agent`&&!t)throw Error(`CameraAssignmentsTable: nodeId is required when mode === "agent"`);let r=R(),[i,a]=z(null),[o,s]=z(null),[c,l]=z(new Map);Qe([`pipelineOrchestrator`,`getPipelineAssignments`],_t),Qe([`pipelineOrchestrator`,`getAudioAssignments`],_t),Qe([`pipelineOrchestrator`,`getCameraStatuses`],_t);let{data:f}=M(void 0),{data:p}=O(void 0),{data:m}=k({},{enabled:e===`agent`}),{nodes:g}=v(),{data:_}=Ce();b(`pipeline.camera-metrics-snapshot`,e=>{let t=e.data;typeof t.deviceId==`number`&&l(e=>{let n=new Map(e);return n.set(t.deviceId,t),n})}),V(()=>{if(c.size===0)return;let e=setInterval(()=>{l(e=>{let t=Date.now()-1e4,n=!1,r=new Map(e);for(let[i,a]of e)a.timestamp<t&&(r.delete(i),n=!0);return n?r:e})},5e3);return()=>clearInterval(e)},[c.size]);let y=I(()=>{let e=new Map;for(let t of _??[])e.set(t.id,t.name);return e},[_]),x=I(()=>{if(e===`agent`){let e=[];for(let n of m??[]){let r=n.assignment,i=(e,n,r)=>({active:e!==null&&e===t,pinned:n,nodeId:e,reason:r??``}),a=i(r.detectionNodeId,r.pinned.detection,r.reasons.detection),o=i(r.decoderNodeId,r.pinned.decoder,r.reasons.decoder),s=i(r.audioNodeId,r.pinned.audio,r.reasons.audio);!a.active&&!o.active&&!s.active||e.push({deviceId:n.deviceId,deviceName:y.get(n.deviceId)??`Device ${n.deviceId}`,pipeline:a,decoder:o,audio:s})}return e.sort((e,t)=>e.deviceId-t.deviceId),e}let n=new Map,r=e=>{let t=n.get(e);if(t)return t;let r={deviceId:e,deviceName:y.get(e)??`Device ${e}`,pipeline:gt,decoder:gt,audio:gt};return n.set(e,r),r};for(let i of f??[]){let a=r(i.deviceId);n.set(i.deviceId,{...a,pipeline:{active:!0,pinned:i.pinned,nodeId:i.agentNodeId,reason:i.reason??``},decoder:{active:e===`cluster`?!0:i.agentNodeId===t,pinned:!1,nodeId:i.agentNodeId,reason:`co-located`}})}for(let e of p??[]){let t=r(e.deviceId);n.set(e.deviceId,{...t,audio:{active:!0,pinned:e.pinned,nodeId:e.nodeId,reason:`capacity`}})}let i=[...n.values()];return i.sort((e,t)=>e.deviceId-t.deviceId),i},[f,p,m,y,e,t]),S=I(()=>(g??[]).filter(e=>e.isOnline).map(e=>({id:e.id,name:e.name})),[g]),C=()=>{r.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getPipelineAssignments`]]}),r.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getAudioAssignments`]]}),r.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getCameraStatuses`]]})},w=oe({onSuccess:C}),E=d({onSuccess:C}),D=T({onSuccess:C}),ee=u({onSuccess:C}),A=(e,t,n)=>{t===`pipeline`?w.mutate({deviceId:e,agentNodeId:n}):D.mutate({deviceId:e,nodeId:n}),a(null)},j=(e,t)=>{t===`pipeline`?E.mutate({deviceId:e}):ee.mutate({deviceId:e}),a(null)};return B(`div`,{className:`rounded-lg border border-border overflow-x-auto`,children:F(`table`,{className:`w-full text-xs min-w-[760px] table-fixed`,children:[B(`thead`,{className:`bg-surface`,children:F(`tr`,{className:`text-foreground-subtle text-[10px] uppercase tracking-wider`,children:[!n&&B(`th`,{className:`w-10`}),B(`th`,{className:`min-w-[200px] text-left px-3 py-2 align-middle`,children:`Camera`}),e===`cluster`?F(L,{children:[B(`th`,{className:`w-[168px] text-left px-3 py-2 align-middle`,children:`Auto | Pin`}),B(`th`,{className:`w-[188px] text-left px-3 py-2 align-middle`,children:`Resolved placement`})]}):F(L,{children:[B(`th`,{className:`w-[120px] text-left px-3 py-2 align-middle`,children:`Pipeline`}),B(`th`,{className:`w-[120px] text-left px-3 py-2 align-middle`,children:`Decoder`}),B(`th`,{className:`w-[120px] text-left px-3 py-2 align-middle`,children:`Audio`})]}),B(`th`,{className:`w-[132px] text-left px-3 py-2 align-middle`,children:`Status`})]})}),F(`tbody`,{children:[x.map(t=>{let r=c.get(t.deviceId),l=o===t.deviceId;return F(ve.Fragment,{children:[F(`tr`,{className:`border-t border-border align-middle relative`,children:[!n&&B(`td`,{className:`px-2 py-2 align-middle`,children:B(`button`,{type:`button`,onClick:()=>s(l?null:t.deviceId),className:`p-1 rounded hover:bg-surface-hover text-foreground-subtle`,"aria-label":l?`Collapse broker details`:`Expand broker details`,children:B(l?Ve:Ge,{className:`h-3.5 w-3.5`})})}),F(`td`,{className:`px-3 py-2 align-middle min-w-0`,children:[B(`div`,{className:`text-foreground font-medium leading-tight line-clamp-2 break-words`,title:t.deviceName,children:t.deviceName}),F(`div`,{className:`text-[10px] text-foreground-subtle leading-tight`,children:[`#`,t.deviceId]})]}),e===`cluster`?F(L,{children:[B(`td`,{className:`px-3 py-2 align-middle`,children:B(St,{state:t.pipeline,onlineNodes:S,pending:w.isPending||E.isPending,onChange:e=>{e===`auto`?j(t.deviceId,`pipeline`):A(t.deviceId,`pipeline`,e)}})}),B(`td`,{className:`px-3 py-2 align-middle`,children:B(Ct,{state:t.pipeline})})]}):F(L,{children:[B(wt,{role:`pipeline`,state:t.pipeline,mode:e,deviceId:t.deviceId,onlineNodes:S,isMenuOpen:i?.deviceId===t.deviceId&&i.role===`pipeline`,onToggleMenu:()=>a(i?.deviceId===t.deviceId&&i.role===`pipeline`?null:{deviceId:t.deviceId,role:`pipeline`}),onCloseMenu:()=>a(null),onMove:e=>A(t.deviceId,`pipeline`,e),onUnpin:()=>j(t.deviceId,`pipeline`)}),B(wt,{role:`decoder`,state:t.decoder,mode:e,deviceId:t.deviceId,onlineNodes:S,readOnly:!0,isMenuOpen:!1,onToggleMenu:()=>void 0,onCloseMenu:()=>void 0,onMove:()=>void 0,onUnpin:()=>void 0}),B(wt,{role:`audio`,state:t.audio,mode:e,deviceId:t.deviceId,onlineNodes:S,isMenuOpen:i?.deviceId===t.deviceId&&i.role===`audio`,onToggleMenu:()=>a(i?.deviceId===t.deviceId&&i.role===`audio`?null:{deviceId:t.deviceId,role:`audio`}),onCloseMenu:()=>a(null),onMove:e=>A(t.deviceId,`audio`,e),onUnpin:()=>j(t.deviceId,`audio`)})]}),B(`td`,{className:`px-3 py-2 align-middle`,children:B(Ot,{snap:r})})]}),l&&!n&&F(`tr`,{className:`bg-surface/50`,children:[B(`td`,{}),F(`td`,{colSpan:e===`cluster`?4:5,className:`px-3 py-2 space-y-3`,children:[t.pipeline.nodeId&&B(xt,{deviceId:t.deviceId,nodeId:t.pipeline.nodeId}),B(h,{widgetId:`stream-broker/stream-broker-panel`,host:`device-tab`,deviceId:t.deviceId,instanceId:`pipeline-row/${t.deviceId}`,config:{variant:`compact`,title:`Stream brokers & clients`}})]})]})]},t.deviceId)}),x.length===0&&B(`tr`,{children:B(`td`,{colSpan:n?e===`cluster`?4:5:e===`cluster`?5:6,className:`px-3 py-4 text-center text-foreground-subtle text-[11px]`,children:e===`agent`?`No cameras assigned to this node`:`No cameras currently assigned`})})]})]})})}function xt({deviceId:e,nodeId:t}){let n=R(),{data:r}=ie({nodeId:t}),{data:i}=w({deviceId:e}),a=N({onSuccess:()=>{n.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getPipelineDevicePin`]]})}}),o=r?.devices??[],s=i?.deviceKey??`auto`,c=s!==`auto`&&!o.some(e=>e.key===s);return F(`label`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle`,children:[B(`span`,{className:`shrink-0 font-medium text-foreground`,children:`Inference device`}),F(`select`,{value:s,disabled:a.isPending,"aria-label":`Inference device pin`,onChange:t=>a.mutate({deviceId:e,deviceKey:t.target.value}),className:`rounded-md border border-border bg-background px-2 py-1 text-xs text-foreground`,children:[B(`option`,{value:`auto`,children:`Auto (balanced)`}),c&&F(`option`,{value:s,children:[`Pin → `,s,` (not on this node)`]}),o.map(e=>F(`option`,{value:e.key,children:[`Pin → `,e.key,e.available?``:` (unavailable)`]},e.key))]}),a.isPending&&B(`span`,{className:`text-[10px] opacity-70`,children:`saving…`})]})}function St({state:e,onlineNodes:t,pending:n,onChange:r}){let i=e.pinned&&e.nodeId?e.nodeId:`auto`,a=[...new Set([...e.nodeId?[e.nodeId]:[],...t.map(e=>e.id)])];return F(`select`,{value:i,disabled:n,"aria-label":`Pipeline placement pin`,onChange:e=>r(e.target.value),className:`w-full min-w-0 rounded-md border border-border bg-background px-2 py-1 text-xs text-foreground`,children:[B(`option`,{value:`auto`,children:`Auto`}),a.map(e=>F(`option`,{value:e,children:[`Pin → `,t.find(t=>t.id===e)?.name??e]},e))]})}function Ct({state:e}){if(!e.active||!e.nodeId)return B(`span`,{className:`text-[10px] text-foreground-subtle italic`,children:`—`});let t=e.pinned?`pinned · manual`:`auto · ${e.reason||`capacity`}`;return F(`div`,{className:`flex flex-col leading-tight min-w-0`,children:[B(`span`,{className:`font-mono text-[11px] text-foreground truncate`,title:e.nodeId,children:e.nodeId}),B(`span`,{className:`truncate ${e.pinned?`text-amber-400 text-[10px]`:`text-foreground-subtle text-[10px]`}`,title:t,children:t})]})}function wt({role:e,state:t,mode:n,onlineNodes:r,readOnly:i=!1,isMenuOpen:a,onToggleMenu:o,onCloseMenu:s,onMove:c,onUnpin:l}){let u=vt[e],d=r.filter(e=>e.id!==(t.nodeId??``)),f=!i&&(t.active||n===`cluster`)&&(d.length>0||t.pinned);return F(`td`,{className:`px-3 py-2 align-middle relative min-w-0`,children:[F(`div`,{className:`flex items-center gap-2 min-w-0`,children:[B(n===`agent`?Tt:Et,{state:t,Icon:u}),B(`div`,{className:`ml-auto shrink-0`,children:f&&B(`button`,{type:`button`,onClick:o,className:`p-1 rounded hover:bg-surface-hover`,"aria-label":`${yt[e]} actions`,children:B(at,{className:`h-3 w-3 text-foreground-subtle`})})})]}),a&&f&&B(kt,{title:yt[e],targets:d,pinned:t.pinned,onMove:c,onUnpin:l,onClose:s})]})}function Tt({state:e,Icon:t}){return F(`div`,{className:`flex items-center gap-1.5`,children:[B(e.active?Re:ze,{className:`h-3.5 w-3.5 ${e.active?`text-success`:`text-foreground-subtle/50`}`}),B(t,{className:`h-3 w-3 ${e.active?`text-foreground-subtle`:`text-foreground-subtle/40`}`}),e.pinned&&B(st,{className:`h-2.5 w-2.5 text-amber-400`})]})}function Et({state:e,Icon:t}){return!e.active||!e.nodeId?F(`div`,{className:`flex items-center gap-1.5 text-foreground-subtle/60`,children:[B(t,{className:`h-3 w-3`}),B(`span`,{className:`text-[10px] italic`,children:`—`})]}):F(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[B(t,{className:`h-3 w-3 text-foreground-subtle shrink-0`}),F(`div`,{className:`flex flex-col leading-tight min-w-0`,children:[B(`span`,{className:`font-mono text-[11px] text-foreground truncate`,children:e.nodeId}),B(`span`,{className:`flex items-center gap-1 text-[10px]`,children:e.pinned?F(`span`,{className:`inline-flex items-center gap-0.5 text-amber-400`,children:[B(st,{className:`h-2.5 w-2.5`}),` manual`]}):F(`span`,{className:`text-foreground-subtle truncate`,children:[`auto · `,e.reason||`capacity`]})})]})]})}var Dt=`min-h-[3.25rem]`;function Ot({snap:e}){if(!e)return B(`div`,{className:`flex items-center ${Dt}`,children:B(`span`,{className:`text-[10px] text-foreground-subtle italic`,children:`—`})});let{phase:t,actualFps:n,avgInferenceTimeMs:r,queueDepth:a,configuredFps:o,droppedFrames:s}=e.metrics,c=i(t);return F(`div`,{className:`flex flex-col justify-center gap-0.5 font-mono text-[10px] tabular-nums leading-tight min-w-0 ${Dt}`,children:[F(`span`,{className:`inline-flex items-center gap-1 min-w-0 ${c.textColor}`,children:[B(C,{phase:t,className:`h-2.5 w-2.5 shrink-0`}),B(`span`,{className:`font-semibold uppercase tracking-wider truncate`,children:c.label})]}),F(`span`,{className:`text-foreground-subtle whitespace-nowrap truncate`,children:[B(`span`,{className:`text-foreground`,children:n.toFixed(1)}),F(`span`,{children:[`/`,o.toFixed(0),` fps`]})]}),F(`span`,{className:`text-foreground-subtle whitespace-nowrap truncate`,children:[B(`span`,{className:`text-foreground`,children:r.toFixed(0)}),B(`span`,{children:` ms`}),a>0&&F(`span`,{className:`text-warning ml-1`,children:[`q`,a]})]}),F(`span`,{className:`whitespace-nowrap truncate ${s>0?`text-warning`:`text-foreground-subtle`}`,children:[`drops `,B(`span`,{className:`text-foreground`,children:s})]})]})}function kt({title:e,targets:t,pinned:n,onMove:r,onUnpin:i,onClose:a}){let o=_e(null);return V(()=>{let e=e=>{o.current?.contains(e.target)||a()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[a]),F(`div`,{ref:o,className:`absolute right-2 top-full mt-1 w-48 rounded-lg border border-border bg-surface shadow-lg z-20 text-left`,children:[B(`div`,{className:`px-3 py-1 text-[9px] uppercase tracking-wider text-foreground-subtle border-b border-border`,children:e}),t.length>0&&B(`div`,{className:`py-1`,children:t.map(e=>F(`button`,{type:`button`,onClick:()=>r(e.id),className:`block w-full text-left px-3 py-1 text-[11px] text-foreground hover:bg-surface-hover`,children:[`Move to `,e.name]},e.id))}),n&&F(`button`,{type:`button`,onClick:i,className:`block w-full text-left px-3 py-1.5 text-[11px] text-destructive hover:bg-destructive/10 border-t border-border`,children:[`Unpin `,e.toLowerCase()]}),t.length===0&&!n&&B(`div`,{className:`px-3 py-1.5 text-[10px] text-foreground-subtle italic`,children:`Already auto · no other nodes online`})]})}function At({nodeId:e,refreshToken:t}){return F(`div`,{className:`space-y-6`,children:[B(ht,{refreshToken:t,nodeId:e}),F(`div`,{children:[B(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Cameras on this node`}),F(`p`,{className:`text-[11px] text-foreground-subtle`,children:[`Checkboxes mark the roles currently running on `,e,`. Use the kebab to move a role to another node or unpin it; live KPIs come from the runner snapshot stream.`]})]}),B(bt,{mode:`agent`,nodeId:e,compact:!0})]})}P();function jt(e,t){let n=Math.max(0,t-e);return`${Math.floor(e/1e3)}s idle · ${Math.floor(n/1e3)}s left`}function Mt({nodeId:e,refreshToken:t}){let n=R(),r=ce({onSettled:()=>{n.invalidateQueries({queryKey:[`pipelineExecutor`,`listLoadedEngines`]})}}),{data:i}=te({nodeId:e}),s=a(`pipeline.engine-metrics-snapshot`,t=>t.nodeId===e)?.engines??i??null,c=s===null;Qe([`pipelineRunner`,`getLocalCameras`],[`pipeline.camera-assigned`,`pipeline.camera-unassigned`]);let{data:l}=o({nodeId:e}),{values:u}=_(`pipeline.camera-metrics-snapshot`,e=>e.deviceId,t=>t.nodeId===e),d=I(()=>u.filter(e=>e.metrics.phase===`active`).length,[u]),f=t=>{let n=l??[];n.length>0&&!window.confirm(`${n.length} camera(s) are dispatching through this engine. Killing it forces a respawn on the next frame. Continue?`)||r.mutate({nodeId:e,engine:t,force:n.length>0})};return F(`div`,{className:`space-y-6`,children:[F(`div`,{children:[B(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Inference engines on this node`}),F(`p`,{className:`text-[11px] text-foreground-subtle`,children:[(s??[]).length,` engine(s) resident in RAM. `,(l??[]).length,` `,`camera(s) attached, `,d,` actively dispatching frames. Refreshes every 5s.`]})]}),B(`div`,{className:`rounded-lg border border-border overflow-x-auto`,children:F(`table`,{className:`w-full text-xs min-w-[640px]`,children:[B(`thead`,{className:`bg-surface`,children:F(`tr`,{className:`text-foreground-subtle text-[10px] uppercase tracking-wider`,children:[B(`th`,{className:`text-left px-3 py-2 whitespace-nowrap`,children:`Kind`}),B(`th`,{className:`text-left px-3 py-2 whitespace-nowrap`,children:`Runtime / Backend / Device`}),B(`th`,{className:`text-left px-3 py-2`,children:`Models`}),B(`th`,{className:`text-right px-3 py-2 whitespace-nowrap`,children:`Pool PID`}),B(`th`,{className:`text-right px-3 py-2 whitespace-nowrap`,children:`Auto-kill`}),B(`th`,{className:`text-right px-3 py-2 whitespace-nowrap`,children:`In use`}),B(`th`,{className:`w-20`})]})}),F(`tbody`,{children:[c&&B(`tr`,{children:B(`td`,{colSpan:7,className:`px-3 py-4 text-center text-foreground-subtle text-[11px]`,children:`Loading…`})}),!c&&(s??[]).map(e=>{let t=e.kind===`warm-override`,n=e.kind===`device-pool`;return F(`tr`,{className:`border-t border-border ${t?`bg-amber-500/5`:n?`bg-primary/[0.05]`:``}`,children:[B(`td`,{className:`px-3 py-2`,children:F(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[10px] font-medium ${t?`bg-amber-500/15 text-amber-400`:n?`bg-primary/15 text-primary`:`bg-success/15 text-success`}`,children:[B(t?ot:n?Se:G,{className:`h-3 w-3`}),t?`warm`:n?`pool`:`runtime`]})}),B(`td`,{className:`px-3 py-2`,children:F(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-sky-400`,children:[B(je,{className:`h-3 w-3`}),e.engine.runtime,`/`,e.engine.backend,e.engine.device?`/${e.engine.device}`:``,e.engine.format?` · ${e.engine.format}`:``]})}),B(`td`,{className:`px-3 py-2`,children:e.modelsLoaded.length===0?B(`span`,{className:`text-foreground-subtle text-[11px]`,children:`—`}):B(`div`,{className:`flex flex-wrap gap-1`,children:e.modelsLoaded.map(e=>B(`span`,{className:`inline-block rounded bg-surface px-1.5 py-0.5 text-[10px] font-mono text-foreground-subtle`,children:e},e))})}),B(`td`,{className:`px-3 py-2 text-right font-mono text-foreground`,children:e.poolPid??`—`}),B(`td`,{className:`px-3 py-2 text-right text-[11px]`,children:e.idleMs!==null&&e.idleTtlMs!==null?B(`span`,{className:`text-foreground-subtle`,children:jt(e.idleMs,e.idleTtlMs)}):B(`span`,{className:`text-foreground-subtle/50`,children:`never`})}),B(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t?`—`:(l??[]).length}),B(`td`,{className:`px-3 py-2 text-right`,children:n?B(`span`,{className:`text-[11px] text-foreground-subtle`,children:`auto`}):F(`button`,{type:`button`,disabled:r.isPending,onClick:()=>f(e.engine),className:`inline-flex items-center gap-1 px-2 py-1 rounded border border-destructive/30 text-destructive text-[11px] hover:bg-destructive/10 disabled:opacity-50`,children:[B(Xe,{className:`h-3 w-3`}),`Kill`]})})]},e.engineKey)}),!c&&(s??[]).length===0&&B(`tr`,{children:B(`td`,{colSpan:7,className:`px-3 py-4 text-center text-foreground-subtle text-[11px]`,children:`No engines resident — the factory spins up on the first pipeline run.`})})]})]})}),F(`div`,{className:`text-[10px] text-foreground-subtle leading-relaxed`,children:[B(`strong`,{className:`text-foreground`,children:`runtime`}),`: main camera-serving engine; never auto-killed while cameras attached. `,B(`strong`,{className:`text-foreground`,children:`warm`}),`: benchmark/test override held in cache for fast re-use; auto-disposed after the idle TTL.`,` `,B(`strong`,{className:`text-foreground`,children:`pool`}),`: a per-device balanced inference pool (one per enabled accelerator, running concurrently); reaper-managed on its own idle TTL.`]}),r.isError&&F(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-[11px] text-destructive`,children:[`Kill failed:`,` `,r.error instanceof Error?r.error.message:`unknown`]})]})}P();var Nt=new Set(xe);function Pt(e){return Nt.has(e)}function Ft(e,t,n){return`${e}/${t}/${n}`}function It(e){return{coreml:`CoreML`,openvino:`OpenVINO`,onnx:`ONNX`}[e.format]??e.format.toUpperCase()}function Lt(e){return{coreml:`Apple Neural Engine / GPU — .mlpackage`,openvino:`Intel CPU / GPU / NPU — .xml`,onnx:`CPU, CUDA, Node.js — .onnx`}[e.format]??`.${e.format}`}function q(e){return e.format}function Rt(e,t){let n=0,r=0,i=0;for(let a of e)for(let e of a.addons)for(let a of e.models){let e=a.formats[t];e&&(n++,e.downloaded&&(r++,i+=e.sizeMB))}return{total:n,downloaded:r,downloadedSizeMB:i}}function zt({addonId:e,model:t,format:n,isActive:r,progress:i,errorMsg:a,onDownload:o,onDelete:s}){let c=t.formats[n];return c?F(`div`,{className:`flex items-center gap-3 px-4 py-3 border-b border-border/50 last:border-b-0 hover:bg-surface-hover/30 transition-colors`,children:[B(`div`,{className:`h-2 w-2 rounded-full shrink-0 ${c.downloaded?`bg-success`:`bg-foreground-subtle/30`}`}),F(`div`,{className:`flex-1 min-w-0`,children:[F(`div`,{className:`flex items-center gap-2`,children:[B(`span`,{className:`text-sm font-medium text-foreground`,children:t.name}),F(`span`,{className:`text-[10px] text-foreground-subtle font-mono`,children:[`(`,t.id,`)`]})]}),i&&i.progress>=0&&i.progress<100&&F(`div`,{className:`mt-1.5 flex items-center gap-2 max-w-xs`,children:[B(`div`,{className:`flex-1 h-1 bg-surface-hover rounded-full overflow-hidden`,children:B(`div`,{className:`bg-primary h-full rounded-full transition-all duration-300`,style:{width:`${i.progress}%`}})}),F(`span`,{className:`text-[9px] text-primary font-mono tabular-nums shrink-0`,children:[Math.round(i.progress),`%`]})]})]}),B(`span`,{className:`text-xs text-foreground-subtle tabular-nums shrink-0`,children:tt(c.sizeMB)}),a&&F(`span`,{className:`flex items-center gap-1 text-[10px] text-danger max-w-[160px] truncate shrink-0`,title:a,children:[B(We,{className:`h-3 w-3 shrink-0`}),a]}),c.downloaded?F(`button`,{onClick:s,disabled:r,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-[11px] font-medium rounded-md border border-danger/30 text-danger hover:bg-danger/10 disabled:opacity-50 transition-colors shrink-0`,children:[r?B(W,{className:`h-3 w-3 animate-spin`}):B(Xe,{className:`h-3 w-3`}),r?`Deleting...`:`Delete`]}):F(`button`,{onClick:o,disabled:r,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-[11px] font-medium rounded-md bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors shrink-0`,children:[r?B(W,{className:`h-3 w-3 animate-spin`}):B(De,{className:`h-3 w-3`}),r?`Downloading...`:`Download`]})]}):null}function Bt({engines:e,activeEngine:t,viewEngine:n,onSelect:r}){let[i,a]=z(!1);return F(`div`,{className:`relative`,children:[F(`button`,{type:`button`,onClick:()=>a(!i),className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-4 py-2.5 w-full text-left hover:bg-surface-hover transition-colors`,children:[B(G,{className:`h-4 w-4 text-primary shrink-0`}),F(`div`,{className:`flex-1 min-w-0`,children:[F(`div`,{className:`flex items-center gap-2`,children:[B(`span`,{className:`text-sm font-medium text-foreground`,children:It(n)}),q(n)===q(t)&&B(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded-full bg-success/10 text-success font-medium`,children:`Active`})]}),B(`div`,{className:`text-[10px] text-foreground-subtle`,children:Lt(n)})]}),B(Ve,{className:`h-4 w-4 text-foreground-subtle transition-transform ${i?`rotate-180`:``}`})]}),i&&B(`div`,{className:`absolute top-full left-0 right-0 mt-1 rounded-lg border border-border bg-surface shadow-lg z-50 overflow-hidden`,children:e.map(e=>{let i=q(e)===q(n),o=q(e)===q(t);return F(`button`,{type:`button`,onClick:()=>{r(e),a(!1)},className:`flex items-center gap-3 px-4 py-2.5 w-full text-left transition-colors ${i?`bg-primary/5`:`hover:bg-surface-hover`}`,children:[B(G,{className:`h-4 w-4 shrink-0 ${i?`text-primary`:`text-foreground-subtle`}`}),F(`div`,{className:`flex-1`,children:[F(`div`,{className:`flex items-center gap-2`,children:[B(`span`,{className:`text-sm font-medium ${i?`text-primary`:`text-foreground`}`,children:It(e)}),o&&B(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded-full bg-success/10 text-success font-medium`,children:`Active`})]}),B(`div`,{className:`text-[10px] text-foreground-subtle`,children:Lt(e)})]}),i&&B(Ue,{className:`h-4 w-4 text-primary shrink-0`})]},q(e))})})]})}function Vt({embedded:t=!1,nodeId:n}={}){let r=R(),i=n??`hub`,[a,o]=z(null),[s,c]=z(new Set),[l,u]=z(new Map),[d,f]=z(new Map),[m,h]=z(``),{data:g=[]}=ee({nodeId:i}),_=g.filter((e,t,n)=>n.findIndex(t=>t.format===e.format)===t),{data:v}=ae({nodeId:i}),y=v,{data:x,isLoading:S}=ue({nodeId:i}),C=e(),w=p();b(`model.download.progress`,e=>{let t=e.data,n=typeof t.modelId==`string`?t.modelId:void 0,i=typeof t.progress==`number`?t.progress:void 0,a=typeof t.totalMB==`number`?t.totalMB:0;n===void 0||i===void 0||(u(e=>{let t=new Map(e);return i===100||i===-1?t.delete(n):t.set(n,{modelId:n,progress:i,totalMB:a}),t}),i===100&&r.invalidateQueries({queryKey:[[`pipelineExecutor`,`getSchema`]]}))});let T=y??{runtime:`node`,backend:`cpu`,format:`onnx`},E=_.find(e=>e.format===a)??T,D=E.format,O=x?.slots??[],k=O.map(e=>({...e,addons:e.addons.map(e=>({...e,models:e.models.filter(e=>e.formats[D]!==void 0)})).filter(e=>e.models.length>0)})).filter(e=>e.addons.length>0),A=Rt(k,D),j=ge(async(e,t,n)=>{if(!Pt(n))return;let a=Ft(e,t,n);c(e=>new Set([...e,a])),f(e=>{let t=new Map(e);return t.delete(a),t});try{await C.mutateAsync({addonId:e,modelId:t,format:n,nodeId:i}),r.invalidateQueries({queryKey:[[`pipelineExecutor`,`getSchema`]]})}catch(e){f(t=>new Map([...t,[a,e instanceof Error?e.message:`Download failed`]]))}finally{c(e=>{let t=new Set(e);return t.delete(a),t})}},[C,r,i]),M=ge(async(e,t,n)=>{if(!Pt(n))return;let a=Ft(e,t,n);c(e=>new Set([...e,a])),f(e=>{let t=new Map(e);return t.delete(a),t});try{await w.mutateAsync({addonId:e,modelId:t,format:n,nodeId:i}),r.invalidateQueries({queryKey:[[`pipelineExecutor`,`getSchema`]]})}catch(e){f(t=>new Map([...t,[a,e instanceof Error?e.message:`Delete failed`]]))}finally{c(e=>{let t=new Set(e);return t.delete(a),t})}},[w,r,i]),te=ge(e=>{o(e.format)},[]),N=m.trim()?k.map(e=>({...e,addons:e.addons.map(e=>({...e,models:e.models.filter(t=>t.name.toLowerCase().includes(m.toLowerCase())||t.id.toLowerCase().includes(m.toLowerCase())||e.name.toLowerCase().includes(m.toLowerCase()))})).filter(e=>e.models.length>0)})).filter(e=>e.addons.length>0):k,ne=F(L,{children:[S&&B(`div`,{className:`flex items-center justify-center py-16`,children:B(W,{className:`h-5 w-5 animate-spin text-foreground-subtle`})}),!S&&O.length===0&&F(`div`,{className:`flex flex-col items-center justify-center py-16 text-foreground-subtle`,children:[B(Oe,{className:`h-8 w-8 mb-3 opacity-30`}),B(`span`,{className:`text-sm`,children:`No pipeline steps available`}),B(`span`,{className:`text-xs mt-1`,children:`Configure the detection pipeline to see available models.`})]}),!S&&O.length>0&&F(L,{children:[B(Bt,{engines:_,activeEngine:T,viewEngine:E,onSelect:te}),F(`div`,{className:`flex items-center gap-4 text-xs text-foreground-subtle`,children:[F(`span`,{children:[B(`span`,{className:`font-semibold text-foreground tabular-nums`,children:A.total}),B(`span`,{className:`ml-1`,children:`compatible models`})]}),B(`span`,{className:`text-border`,children:`|`}),F(`span`,{children:[B(`span`,{className:`font-semibold text-success tabular-nums`,children:A.downloaded}),B(`span`,{className:`ml-1`,children:`downloaded`})]}),B(`span`,{className:`text-border`,children:`|`}),F(`span`,{className:`tabular-nums`,children:[tt(A.downloadedSizeMB),B(`span`,{className:`ml-1`,children:`on disk`})]})]}),A.total>5&&F(`div`,{className:`relative`,children:[B(Ie,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-foreground-subtle`}),B(`input`,{type:`text`,value:m,onChange:e=>h(e.target.value),placeholder:`Search models...`,className:`w-full pl-9 pr-3 py-2 text-sm rounded-lg border border-border bg-surface text-foreground placeholder:text-foreground-subtle/50 focus:outline-none focus:ring-1 focus:ring-primary`})]}),N.map(e=>{let t=e.addons.reduce((e,t)=>e+t.models.length,0),n=e.addons.reduce((e,t)=>e+t.models.filter(e=>e.formats[D]?.downloaded).length,0);return F(`div`,{children:[F(`div`,{className:`flex items-center gap-2 mb-2`,children:[B(`h2`,{className:`text-sm font-semibold text-foreground`,children:e.label}),B(`div`,{className:`flex-1 h-px bg-border`}),F(`span`,{className:`text-[10px] text-foreground-subtle tabular-nums`,children:[n,`/`,t]})]}),B(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:e.addons.map(e=>e.models.map(t=>{let n=Ft(e.id,t.id,D);return B(zt,{addonId:e.id,model:t,format:D,isActive:s.has(n),progress:l.get(t.id),errorMsg:d.get(n),onDownload:()=>j(e.id,t.id,D),onDelete:()=>M(e.id,t.id,D)},`${e.id}/${t.id}`)}))})]},e.id)}),N.length===0&&B(`div`,{className:`text-center py-8 text-sm text-foreground-subtle`,children:m.trim()?F(L,{children:[`No models matching “`,m,`”`]}):F(L,{children:[`No models available for `,It(E),` format`]})})]})]});return t?B(`div`,{className:`space-y-4`,children:ne}):B(Ze,{children:ne})}function Ht({nodeId:e,refreshToken:t}){return B(Vt,{embedded:!0,nodeId:e})}var Ut=`pipeline-runner`,Wt=200;function Gt({nodeId:e}){return F(`div`,{className:`flex flex-col gap-3`,children:[F(`div`,{children:[B(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Runner logs`}),F(`p`,{className:`text-[11px] text-foreground-subtle`,children:[`pipeline-runner activity on `,e,` — camera attach/detach, engine phases and pipeline errors. Streaming live; the device chip on a line tells which camera it refers to.`]})]}),B(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:B(j,{agentId:e,addonId:Ut,limit:Wt,maxHeight:`max-h-[calc(100vh-360px)]`,showScope:!0,showDeviceChip:!0,showFilters:!1})})]})}P(),P();function Kt({nodeId:e,title:t}){let{data:n}=Ce(),{data:r}=M(void 0),a=I(()=>{let e=new Map;for(let t of n??[])e.set(t.id,t.name);return e},[n]),o=I(()=>{if(!e)return null;let t=new Set;for(let n of r??[])n.agentNodeId===e&&t.add(n.deviceId);return t},[e,r]),[s,c]=z(new Map);b(`pipeline.camera-metrics-snapshot`,t=>{let n=t.data;typeof n.deviceId==`number`&&(e&&n.nodeId!==e||c(e=>{let t=new Map(e);return t.set(n.deviceId,n),t}))}),V(()=>{if(s.size===0)return;let e=setInterval(()=>{c(e=>{let t=Date.now()-1e4,n=!1,r=new Map(e);for(let[i,a]of e)a.timestamp<t&&(r.delete(i),n=!0);return n?r:e})},5e3);return()=>clearInterval(e)},[s.size]);let l=I(()=>{let e=[];for(let t of s.values())o&&!o.has(t.deviceId)||e.push(t);return e.sort((e,t)=>e.deviceId-t.deviceId),e},[s,o]);return l.length===0?F(`div`,{className:`rounded-md border border-border bg-surface px-3 py-2 text-[11px] text-foreground-subtle italic`,children:[t??`Cameras`,`: no live snapshots yet`]}):F(`div`,{className:`rounded-md border border-border bg-surface px-3 py-2`,children:[F(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[B(`span`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle`,children:t??`Cameras`}),B(`span`,{className:`text-[10px] text-foreground-subtle`,children:l.length})]}),B(`div`,{className:`flex flex-wrap gap-1.5`,children:l.map(e=>{let t=a.get(e.deviceId)??`#${e.deviceId}`,n=i(e.metrics.phase);return F(`div`,{title:`${t} · ${n.label} · ${e.metrics.actualFps.toFixed(1)} fps · ${e.metrics.avgInferenceTimeMs.toFixed(0)}ms infer · q=${e.metrics.queueDepth}`,className:`inline-flex items-center gap-1 rounded border px-1.5 py-0.5 text-[10px] ${n.badgeClass}`,children:[B(C,{phase:e.metrics.phase,className:`h-2.5 w-2.5`}),B(`span`,{className:`font-medium text-foreground/90 max-w-[220px] truncate`,children:t}),B(`span`,{className:`font-mono tabular-nums`,children:e.metrics.actualFps.toFixed(1)}),B(`span`,{className:`opacity-60`,children:`fps`})]},e.deviceId)})})]})}P();function J(e,t){if(!e)return null;for(let n of e.slots)for(let e of n.addons)if(e.id===t)return e;return null}function qt(e){if(!e)return null;let t=e.modelId!==void 0&&e.modelId!==``?e.modelId:void 0,n=e.settings&&Object.keys(e.settings).length>0?e.settings:void 0;return t===void 0&&n===void 0?null:{...t===void 0?{}:{modelId:t},...n===void 0?{}:{settings:n}}}function Jt({nodeId:e,refreshToken:t}){let n=R(),[r,i]=z(null),[a,o]=z(null),[l,u]=z(``),[d,f]=z(null),p=ie({nodeId:e},{refetchOnMount:`always`}),m=ue({nodeId:e},{refetchOnMount:`always`}),h=p.data?.devices??[],_=g({onSuccess:()=>{n.invalidateQueries({queryKey:[`pipelineOrchestrator`,`getNodeInferenceDevices`]})}}),v=I(()=>m.data?x(m.data):[],[m.data]),y=I(()=>h.map(t=>({agentNodeId:e,engineLabel:t.format,deviceKey:t.key,deviceLabel:H(t).label})),[h,e]),b=e=>h.find(t=>t.key===e)??null,C=I(()=>h.filter(e=>e.enabled),[h]),w=C.length>=2,T=(e,t)=>{let n=J(m.data??null,e),r=t?.format;return n?.models.some(e=>r!==void 0&&!!e.formats[r])??!1},E=e=>{let t=b(e);return t?H(t).label:e},D=(e,t)=>C.filter(n=>n.key!==t&&T(e,n)).toSorted((e,t)=>e.key<t.key?-1:+(e.key>t.key))[0]??null,O=e=>{let t=J(m.data??null,e)?.enabledByDefault??!0;return{kind:`gate`,effectiveOn:t,defaultOn:t,explicit:!1}},k=(e,t)=>{let n=J(m.data??null,e),r=t?.format;if(!(!n||r===void 0))return(n.slot===`detector`?t?.defaultModelId:void 0)??c(n,r)},ee=(e,t)=>{let n=O(e),r=n.kind===`gate`?n.effectiveOn:!1,i=J(m.data??null,e),a=t.deviceKey===void 0?null:b(t.deviceKey),o=a?.format,s=i?.models.some(e=>o!==void 0&&!!e.formats[o])??!1,c=a?.steps?.[e];if(!s){if(!r)return{kind:`na`};let n=c?.jumpDeviceKey,i=n!==void 0&&C.some(e=>e.key===n)?n:t.deviceKey===void 0?void 0:D(e,t.deviceKey)?.key;return i===void 0?{kind:`skip`}:{kind:`skip`,jumpTo:E(i)}}return{kind:`enabled`,modelId:c?.modelId??k(e,a)??`Auto`,...c?.jumpDeviceKey!==void 0&&C.some(e=>e.key===c.jumpDeviceKey)?{jumpTo:E(c.jumpDeviceKey)}:{}}},A=r&&m.data?J(m.data,r.addonId):null,j=r?b(r.deviceKey):null,M=j?.format??`coreml`,te=r?k(r.addonId,j):void 0,N=()=>{i(null),o(null),u(``)},ne=(e,t)=>{if(t.deviceKey===void 0)return;let n=b(t.deviceKey)?.steps?.[e];i({addonId:e,deviceKey:t.deviceKey}),o({enabled:!0,...n?.modelId===void 0?{}:{modelId:n.modelId},settings:n?.settings??{}}),u(n?.jumpDeviceKey??``)},re=()=>{if(!r)return;let t=qt(a),n=l!==``&&l!==r.deviceKey?l:void 0,i=t||n!==void 0?{...t,...n===void 0?{}:{jumpDeviceKey:n}}:null,o={};for(let e of h){if(!e.enabled&&e.key!==r.deviceKey)continue;let t={...e.steps};e.key===r.deviceKey&&(i?t[r.addonId]=i:delete t[r.addonId]);let n=Object.keys(t).length>0;o[e.key]={enabled:!0,weight:Math.max(1,e.weight),...e.maxSessions!=null&&e.maxSessions>0?{maxSessions:e.maxSessions}:{},...n?{steps:t}:{}}}_.mutate({agentNodeId:e,inferenceDevices:o},{onSuccess:N})};if(p.isLoading||m.isLoading)return B(`div`,{className:`text-xs text-foreground-subtle animate-pulse p-4`,children:`Loading pipeline…`});if(h.length===0)return B(`div`,{className:`rounded-md border border-dashed border-border bg-background px-4 py-6 text-center text-xs text-foreground-subtle`,children:`No inference devices reported by this node's platform probe.`});if(!m.data)return B(`div`,{className:`text-xs text-foreground-subtle p-4`,children:`Catalog unavailable.`});let ae=r!==null&&A!==null&&j!==null;return F(`div`,{className:`relative h-full w-full space-y-3`,children:[F(`div`,{className:`rounded-md border border-border bg-muted/20 px-3 py-2 text-[11px] leading-relaxed text-foreground-subtle`,children:[`Each column is one of this node's inference accelerators. A cell shows the`,` `,B(`span`,{className:`font-medium text-foreground`,children:`base model`}),` every camera landing on that accelerator runs; click to change it. Whether a camera runs a step is set per-camera on that camera's Detection pipeline tab — there is no gate here.`]}),B(`div`,{className:ae?`md:pr-[360px]`:``,children:v.length>0?B(se,{tree:v,agents:y,gateFor:O,getCellState:ee,onCellClick:ne,selectedCell:r?{addonId:r.addonId,agentNodeId:e,deviceKey:r.deviceKey}:null,onSetGate:()=>{},fallbackNodeId:d,onFallbackNodeChange:f,hideGate:!0}):B(`div`,{className:`text-xs text-foreground-subtle`,children:`Catalog empty.`})}),B(S,{open:ae,onClose:N,title:A?.name??``,subtitle:r&&j?`${e} · ${H(j).label} · ${j.format}`:``,footer:F(L,{children:[B(`div`,{className:`flex-1`}),B(`button`,{type:`button`,className:`px-3 py-1 text-xs border border-border rounded bg-surface hover:bg-muted`,onClick:N,children:`Cancel`}),B(`button`,{type:`button`,disabled:!r||!a||_.isPending,className:`px-3 py-1 text-xs bg-primary text-primary-foreground rounded disabled:opacity-50`,onClick:re,children:_.isPending?`Saving…`:`Save`})]}),children:A&&r&&a?F(`div`,{className:`space-y-3`,children:[w&&F(`div`,{className:`rounded-md border border-border bg-muted/10 px-3 py-2 space-y-1`,children:[B(`label`,{className:`block text-[11px] font-medium text-foreground`,children:`Run on`}),F(`select`,{className:`w-full rounded border border-border bg-surface px-2 py-1 text-xs`,value:l,onChange:e=>u(e.target.value),children:[B(`option`,{value:``,children:`Auto (this device, or auto-jump if unsupported)`}),C.filter(e=>e.key!==r.deviceKey).map(e=>F(`option`,{value:e.key,children:[H(e).label,` · `,e.format]},e.key))]}),B(`p`,{className:`text-[10px] leading-snug text-foreground-subtle`,children:`Route this step (and its child steps) to another accelerator on this node.`})]}),B(s,{mode:`agent`,addon:A,agentDefault:a,agentNodeId:e,engineFormat:M,effectiveModelId:te,onChangeAgentConfig:o})]}):B(`div`,{className:`rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-[11px] text-amber-300`,children:`This accelerator is no longer reported by the node, so there is nothing to provision here.`})})]})}P();var Yt=[`pipeline-orchestrator`],Xt=[`decoder`],Zt=!1;function Qt({nodeId:e,refreshToken:t}){let n=l(),[r,i]=z(null),[a,o]=z(null),s=(y(void 0).data??[]).find(t=>t.id===e),c=s?.name??e,u=s?.isOnline??!1,d=me({onSuccess:e=>{o(e.effectiveModelId===null?`Reset done — model config cleared (node offline: effective model resolves on reconnect)`:`Reset done — effective detection model: ${e.effectiveModelId} (Auto)`)}}),f=async()=>{await n({title:`Reset ${c} to hardware-aware defaults?`,message:`This clears every per-device model default on this node (back to the format default) and every per-camera step override scoped to it. Existing per-camera customisations on this node are lost.`,confirmLabel:`Reset`,variant:`danger`})&&(o(null),d.mutate({agentNodeId:e}))};return F(`div`,{className:`relative h-full w-full space-y-3`,children:[F(`div`,{className:`flex items-center justify-end gap-2 text-xs`,children:[a&&B(`span`,{className:`text-emerald-400`,children:a}),d.isError&&B(`span`,{className:`text-red-400`,children:d.error instanceof Error?d.error.message:`Reset failed`}),B(`button`,{type:`button`,onClick:()=>{f()},disabled:d.isPending,className:`rounded border border-amber-500/40 bg-surface px-2 py-0.5 text-amber-300 hover:bg-surface-hover disabled:opacity-50`,title:`Clear this node's per-device model defaults + per-camera overrides scoped to this node`,children:d.isPending?`Resetting…`:`Reset to default`})]}),B(Kt,{nodeId:e}),B(nt,{nodeId:e,addonIds:Yt,level:`global`,sectionIds:Xt}),Zt,Zt,F(`div`,{children:[B(`h3`,{className:`mb-1.5 text-xs font-semibold uppercase tracking-wide text-foreground-subtle`,children:`Inference devices — default model per accelerator`}),B(Ee,{nodeId:e,nodeName:c,isOnline:u})]}),F(`div`,{children:[B(`h3`,{className:`mb-1.5 text-xs font-semibold uppercase tracking-wide text-foreground-subtle`,children:`Detection steps — model per accelerator`}),B(Jt,{nodeId:e,refreshToken:t})]})]})}var $t=[`detection-pipeline`,`audio-analyzer`,`pipeline-runner`],en=`decoder-nodeav`;function tn({nodeId:e,refreshToken:t}){let{data:n}=y(void 0),r=n?.find(t=>t.id===e)?.addons.find(e=>e.capabilities.includes(`decoder`))?.id??en,i=[...$t,r];return F(`div`,{className:`flex flex-col h-full`,children:[B(mt,{nodeId:e,refreshToken:t}),B(`div`,{className:`flex-1 min-h-0 overflow-y-auto p-6`,children:B(nt,{nodeId:e,addonIds:i,level:`global`,extraTabs:[{id:`assignments`,label:`Assignments`,order:-10,content:B(At,{nodeId:e,refreshToken:t})},{id:`tree`,label:`Pipeline`,order:39,content:B(Qt,{nodeId:e,refreshToken:t})},{id:`engines`,label:`Warm instances`,order:180,content:B(Mt,{nodeId:e,refreshToken:t})},{id:`models`,label:`Models`,order:200,content:B(Ht,{nodeId:e,refreshToken:t})},{id:`logs`,label:`Logs`,order:300,content:B(Gt,{nodeId:e})}]})})]})}var nn=`pipeline-orchestrator`,rn=`recorder`,an=`recordingNodeId`,on=[`ingestNode`,`recordingNode`,`audioNode`,`motionNode`],sn=[{key:`detect`,label:`Detect`,hint:`Runs the detection pipeline (decode + inference) for assigned cameras`}];function cn(e,t){for(let n of e?.sections??[])for(let e of n.fields??[])if(e.key===t)return e.value}function ln(e,t){for(let[n,r]of Object.entries(e??{}))if(n===t)return r}function un(e,t,n){let r=cn(e,t);return typeof r==`string`&&r.length>0?r:n}function dn(e,t,n){let r=cn(e,t);return typeof r==`number`&&Number.isFinite(r)?r:n}function fn(e,t){let n=ln(e,t);return typeof n==`number`&&Number.isFinite(n)?n:null}function pn(e,t){let n=ln(e,t);return typeof n==`string`&&n.length>0?n:null}function mn(e){return e===`ingestNode`?`Ingest`:e===`recordingNode`?`Recording`:e===`audioNode`?`Audio`:`Motion Node`}function hn(e){return e===`ingestNode`?`Node that terminates default camera ingest`:e===`recordingNode`?`Node that owns the recorder (recording-node)`:e===`audioNode`?`Node that runs singleton audio work`:`Runs software (analyzer) motion-watch. Onboard cameras are unaffected.`}function gn(e,t){switch(t){case`detect`:return e.pipeline}}function _n(e){return e instanceof Error?e.message:`Failed to save`}function vn(e){e.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`listAgentSettings`]]}),e.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getAgentSettings`]]}),e.invalidateQueries({queryKey:[[`addonSettings`,`getGlobalSettings`]]})}function yn({capability:e,label:t,hint:n,nodeId:r,active:i,pending:a,layout:o,onToggle:s}){let c=i?`border-success/30 bg-success/15 text-success hover:bg-success/25`:`border-border bg-surface-hover text-foreground-subtle hover:bg-surface hover:text-foreground`,l=o===`card`?`w-full justify-center px-3 py-2 text-xs`:`px-2.5 py-1 text-[11px]`,u=i?U:Te;return F(`button`,{type:`button`,role:`switch`,"aria-checked":i,"aria-label":`${t} capability for ${r}`,title:`${t} — ${n}`,disabled:a,onClick:()=>s(e,!i),className:`inline-flex items-center gap-1.5 rounded-full border font-medium transition-colors disabled:opacity-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 ${c} ${l}`,children:[B(u,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":`true`}),B(`span`,{children:t})]})}function bn({node:e,emphasis:t=!1}){let n=e.isHub?Le:G;return F(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[B(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${e.isOnline?`bg-success`:`bg-danger`}`,"aria-hidden":`true`}),B(n,{className:`h-4 w-4 shrink-0 text-foreground-subtle`,"aria-hidden":`true`}),F(`div`,{className:`min-w-0`,children:[F(`div`,{className:`flex items-center gap-1.5 ${t?`text-sm`:`text-xs`} font-semibold text-foreground`,children:[B(`span`,{className:`truncate`,children:e.name}),e.isHub&&B(D,{variant:`info`,className:`px-1.5 py-0 text-[9px] uppercase tracking-wider`,children:`hub`}),!e.isOnline&&B(D,{variant:`danger`,className:`px-1.5 py-0 text-[9px] uppercase tracking-wider`,children:`offline`})]}),B(`div`,{className:`font-mono text-[10px] text-foreground-subtle truncate`,children:e.id})]})]})}P();function xn({nodeId:e,value:t,detectedHosts:n,status:r,errorMessage:i,onCommit:a}){let[o,s]=z(t??``);V(()=>{s(t??``)},[t]);let c=n[0],l=c===void 0?`auto-detect`:`auto: ${c}`,u=r===`pending`,d=o.trim(),f=d!==(t??``),p=f&&!u,m=()=>{p&&a(e,d.length>0?d:null)};return F(`div`,{className:`flex items-center gap-1.5`,children:[B(`input`,{"aria-label":`Reachable host for ${e}`,type:`text`,inputMode:`url`,autoComplete:`off`,spellCheck:!1,placeholder:l,value:o,disabled:u,onChange:e=>s(e.target.value),onBlur:m,onKeyDown:e=>{e.key===`Enter`&&m(),e.key===`Escape`&&s(t??``)},className:`w-40 rounded-md border border-border bg-background px-2.5 py-1.5 text-sm text-foreground placeholder:text-foreground-subtle focus:border-primary focus:outline-none disabled:opacity-50`}),F(`button`,{type:`button`,onClick:m,disabled:!p,"aria-label":`Save reachable host for ${e}`,title:`Save reachable host`,className:`inline-flex shrink-0 items-center gap-1 rounded-md px-2 py-1.5 text-[11px] font-medium bg-primary text-white hover:bg-primary/90 disabled:opacity-40 disabled:cursor-not-allowed`,children:[u?B(W,{className:`h-3 w-3 animate-spin`,"aria-hidden":`true`}):B(U,{className:`h-3 w-3`,"aria-hidden":`true`}),`Save`]}),!f&&!u&&r===`success`&&B(U,{className:`h-3.5 w-3.5 shrink-0 text-emerald-400`,"aria-label":`Saved`,role:`img`}),r===`error`&&B(`span`,{title:i??`Failed to save reachable host`,children:B(We,{className:`h-3.5 w-3.5 shrink-0 text-red-400`,"aria-label":i??`Failed to save reachable host`,role:`img`})})]})}function Sn({label:e,children:t}){return F(`div`,{className:`flex items-center justify-between gap-3`,children:[B(`span`,{className:`text-[11px] font-medium uppercase tracking-wide text-foreground-subtle`,children:e}),t]})}function Cn({node:e,actions:t}){return F(`div`,{className:`rounded-xl border border-border bg-background p-4 space-y-4 ${e.isOnline?``:`opacity-60`}`,children:[B(bn,{node:e,emphasis:!0}),B(`div`,{className:`grid grid-cols-2 gap-2`,children:sn.map(n=>B(yn,{capability:n.key,label:n.label,hint:n.hint,nodeId:e.id,active:gn(e.effective,n.key),pending:t.capabilityPending,layout:`card`,onToggle:(n,r)=>t.onToggleCapability(e.id,n,r)},n.key))}),B(`div`,{className:`space-y-3 border-t border-border pt-3`,children:B(Sn,{label:`Reachable host`,children:B(xn,{nodeId:e.id,value:e.reachableHost,detectedHosts:e.detectedHosts,status:t.reachableHostStatus(e.id),errorMessage:t.reachableHostErrorMessage(e.id),onCommit:t.onCommitReachableHost})})})]})}function wn(){return F(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1.5 text-[10px] text-foreground-subtle`,children:[F(`span`,{className:`inline-flex items-center gap-1.5`,children:[B(`span`,{className:`h-2.5 w-2.5 rounded-full border border-success/30 bg-success/15`}),`Active capability`]}),F(`span`,{className:`inline-flex items-center gap-1.5`,children:[B(`span`,{className:`h-2.5 w-2.5 rounded-full border border-border bg-surface-hover`}),`Idle`]}),F(`span`,{className:`inline-flex items-center gap-1.5`,children:[B(`span`,{className:`h-2 w-2 rounded-full bg-success`}),`Node online`]}),F(`span`,{className:`inline-flex items-center gap-1.5`,children:[B(`span`,{className:`h-2 w-2 rounded-full bg-danger`}),`Node offline`]})]})}function Tn({nodes:e,actions:t}){return B(`div`,{className:`overflow-x-auto rounded-lg border border-border`,children:F(`table`,{className:`w-full min-w-[720px] border-collapse text-sm`,children:[B(`thead`,{children:F(`tr`,{className:`border-b border-border bg-background text-[10px] uppercase tracking-wider text-foreground-subtle`,children:[B(`th`,{className:`px-4 py-3 text-left font-semibold`,children:`Node`}),sn.map(e=>B(`th`,{className:`px-3 py-3 text-center font-semibold`,children:e.label},e.key)),B(`th`,{className:`px-4 py-3 text-left font-semibold`,children:`Reachable host`})]})}),B(`tbody`,{children:e.map(e=>F(`tr`,{className:`border-b border-border last:border-b-0 transition-colors hover:bg-surface-hover/40 ${e.isOnline?``:`opacity-60`}`,children:[B(`td`,{className:`px-4 py-3 align-middle`,children:B(bn,{node:e})}),sn.map(n=>B(`td`,{className:`px-3 py-3 text-center align-middle`,children:B(yn,{capability:n.key,label:n.label,hint:n.hint,nodeId:e.id,active:gn(e.effective,n.key),pending:t.capabilityPending,layout:`cell`,onToggle:(n,r)=>t.onToggleCapability(e.id,n,r)})},n.key)),B(`td`,{className:`px-4 py-3 align-middle`,children:B(xn,{nodeId:e.id,value:e.reachableHost,detectedHosts:e.detectedHosts,status:t.reachableHostStatus(e.id),errorMessage:t.reachableHostErrorMessage(e.id),onCommit:t.onCommitReachableHost})})]},e.id))})]})})}function En({role:e,value:t,options:n,pending:r,onChange:i}){return F(`label`,{className:`flex flex-col gap-1.5 rounded-lg border border-border bg-background p-3`,children:[B(`span`,{className:`text-xs font-semibold text-foreground`,children:mn(e)}),B(`select`,{value:t,disabled:r,onChange:t=>i(e,t.target.value),className:`rounded-md border border-border bg-surface px-2.5 py-1.5 text-sm text-foreground focus:border-primary focus:outline-none disabled:opacity-50`,children:n.map(e=>B(`option`,{value:e,children:e===`hub`?`hub (default)`:e},e))}),B(`span`,{className:`text-[10px] leading-tight text-foreground-subtle`,children:hn(e)})]})}function Dn({roleValues:e,options:t,pending:n,lowFpsEnabled:r,fpsMinThreshold:i,onRoleChange:a,onLowFpsToggle:o}){return F(`div`,{className:`grid gap-3 @lg/clustertab:grid-cols-2 @3xl/clustertab:grid-cols-4`,children:[on.map(r=>B(En,{role:r,value:e[r],options:t,pending:n,onChange:a},r)),F(`label`,{className:`flex items-start gap-2.5 rounded-lg border border-border bg-background p-3 text-sm text-foreground`,children:[B(`input`,{type:`checkbox`,checked:r,disabled:n,onChange:e=>o(e.target.checked),className:`mt-0.5 h-4 w-4 shrink-0 accent-primary`}),F(`span`,{className:`flex flex-col gap-0.5`,children:[B(`span`,{className:`text-xs font-semibold`,children:`Low-fps relocate/shed`}),F(`span`,{className:`text-[10px] leading-tight text-foreground-subtle`,children:[`fpsMinThreshold `,r?`${i} fps`:`disabled`]})]})]})]})}P();function On(){let e=R(),{nodes:n}=v(),i=fe(void 0),a=de({addonId:nn}),o=de({addonId:rn}),s=()=>vn(e),c=t({onSuccess:s}),l=pe(),u=r({onSuccess:s}),d=A({onSuccess:s}),[f,p]=z(!1),m=I(()=>{let e=new Map;for(let t of i.data??[])e.set(t.nodeId,t.settings);return e},[i.data]),h=I(()=>n.map(e=>{let t=m.get(e.id),n=dt(t,e.isHub),r=fn(t,`detectWeight`);return{id:e.id,name:e.name,isHub:e.isHub,isOnline:e.isOnline,settings:t,effective:n,weight:r??1,maxCameras:fn(t,`maxCameras`),reachableHost:pn(t,`reachableHost`),detectedHosts:e.localIps}}),[n,m]),g=h.filter(e=>e.effective.pipeline),_={ingestNode:un(a.data,`ingestNode`,`hub`),recordingNode:un(o.data,an,`hub`),audioNode:un(a.data,`audioNode`,`hub`),motionNode:un(a.data,`motionNode`,`hub`)},y=I(()=>{let e=n.filter(e=>e.isOnline).map(e=>e.id);return[...new Set([`hub`,...on.map(e=>_[e]),...e])].filter(e=>e.length>0)},[n,_]),b=dn(a.data,`fpsMinThreshold`,0),x=b>0,S=i.isLoading||a.isLoading||o.isLoading,C=(e,t,n)=>{c.mutate({agentNodeId:e,[t]:n})},w=(e,t)=>{if(e===`recordingNode`){d.mutate({addonId:rn,patch:{[an]:t}});return}d.mutate({addonId:nn,patch:{[e]:t}})},T=e=>{d.mutate({addonId:nn,patch:{fpsMinThreshold:e?Math.max(1,b):0}})},E=e=>u.variables?.agentNodeId===e?u.isPending?`pending`:u.isError?`error`:u.isSuccess?`success`:`idle`:`idle`,D=e=>E(e)===`error`?_n(u.error):null,O=async e=>{p(!0);try{for(let t of e)await l.mutateAsync({agentNodeId:t.nodeId,detectWeight:t.weight})}finally{p(!1),s()}},k={capabilityPending:c.isPending,onToggleCapability:C,onCommitReachableHost:(e,t)=>u.mutate({agentNodeId:e,reachableHost:t}),reachableHostStatus:E,reachableHostErrorMessage:D};return F(`section`,{className:`rounded-xl border border-border bg-surface p-5 @3xl/clustertab:p-6 space-y-6`,children:[F(`header`,{className:`flex items-start justify-between gap-4`,children:[F(`div`,{className:`space-y-1`,children:[B(`h3`,{className:`text-base font-semibold text-foreground`,children:`Pipeline placement`}),B(`p`,{className:`max-w-prose text-xs leading-relaxed text-foreground-subtle`,children:`Toggle which node runs each pipeline capability, distribute detection weight across detect-capable nodes, and choose the singleton cluster roles.`})]}),S&&B(W,{className:`h-5 w-5 shrink-0 animate-spin text-foreground-subtle`,"aria-label":`Loading`})]}),F(`div`,{className:`space-y-3`,children:[B(`h4`,{className:`text-xs font-semibold uppercase tracking-wide text-foreground-subtle`,children:`Singleton cluster roles`}),B(Dn,{roleValues:_,options:y,pending:d.isPending,lowFpsEnabled:x,fpsMinThreshold:b,onRoleChange:w,onLowFpsToggle:T})]}),F(`div`,{className:`space-y-3`,children:[F(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[B(`h4`,{className:`text-xs font-semibold uppercase tracking-wide text-foreground-subtle`,children:`Per-node capabilities`}),B(wn,{})]}),h.length===0?B(`p`,{className:`rounded-lg border border-dashed border-border bg-background px-4 py-6 text-center text-xs text-foreground-subtle`,children:`No cluster nodes reporting yet.`}):F(L,{children:[B(`div`,{className:`grid gap-4 @xl/clustertab:grid-cols-2 @3xl/clustertab:hidden`,children:h.map(e=>B(Cn,{node:e,actions:k},e.id))}),B(`div`,{className:`hidden @3xl/clustertab:block`,children:B(Tn,{nodes:h,actions:k})})]})]}),F(`div`,{className:`space-y-3`,children:[B(`h4`,{className:`text-xs font-semibold uppercase tracking-wide text-foreground-subtle`,children:`Detection weight`}),B(we,{nodes:g,pending:f,onCommitWeights:e=>void O(e)})]}),F(`div`,{className:`space-y-3`,children:[B(`h4`,{className:`text-xs font-semibold uppercase tracking-wide text-foreground-subtle`,children:`Inference devices`}),g.length===0?B(`p`,{className:`rounded-lg border border-dashed border-border bg-background px-4 py-6 text-center text-xs text-foreground-subtle`,children:`No detect-capable nodes — enable detection on a node above to configure its accelerators.`}):B(`div`,{className:`space-y-2`,children:g.map(e=>B(Ee,{nodeId:e.id,nodeName:e.name,isOnline:e.isOnline},e.id))})]})]})}P();var kn=!1;function An({refreshToken:e}){let t=R(),{data:n}=y(void 0);I(()=>et(n??[]),[n]);let r=E({onSuccess:()=>{t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getPipelineAssignments`]]}),t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getAudioAssignments`]]})}});return F(`div`,{className:`space-y-6`,children:[B(Kt,{title:`Cluster cameras`}),B(ht,{refreshToken:e}),B(On,{}),kn,F(`div`,{className:`flex flex-col gap-3 @md/clustertab:flex-row @md/clustertab:items-center @md/clustertab:justify-between`,children:[F(`div`,{className:`min-w-0`,children:[B(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Placement matrix`}),B(`p`,{className:`text-[11px] text-foreground-subtle`,children:`Pipeline · audio assignments per camera (decode always runs co-located with the pipeline). Click the kebab to pin / unpin / move a role; expand the chevron for the per-camera broker drill-down.`})]}),F(`button`,{type:`button`,onClick:()=>r.mutate(void 0),disabled:r.isPending,className:`inline-flex items-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-white hover:bg-primary/90 disabled:opacity-50 shrink-0 self-start @md/clustertab:self-auto whitespace-nowrap`,children:[B(je,{className:`h-3.5 w-3.5`}),r.isPending?`Rebalancing…`:`Rebalance pipelines`]})]}),B(bt,{mode:`cluster`})]})}var jn=[`pipeline-orchestrator`];function Mn({refreshToken:e}){return B(`div`,{className:`space-y-4 max-w-3xl`,children:B(nt,{nodeId:`hub`,addonIds:jn,level:`global`,title:`Cluster settings`,description:`Cluster-wide orchestration knobs: enabled nodes, load balancer thresholds, and failover policy. Per-camera pipelines live in Device Overrides; live cluster load is on the Assignments tab.`})})}P();function Nn({refreshToken:e}){let t=R(),{data:n,isLoading:r}=he(),[i,a]=z(null),[o,s]=z(``),[c,l]=z(``),u=()=>{t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`listTemplates`]]})},d=f({onSuccess:()=>{a(null),u()}}),p=le({onSuccess:u}),m=e=>{a(e.id),s(e.name),l(e.description??``)},h=()=>{a(null),s(``),l(``)},g=()=>{if(!i)return;let e=c.trim();d.mutate({id:i,name:o.trim()||`Untitled`,...e?{description:e}:{}})};if(r)return B(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading templates…`});let _=[...n??[]].toSorted((e,t)=>e.name.localeCompare(t.name));return B(`div`,{className:`space-y-6 max-w-4xl`,children:F(`section`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[F(`div`,{className:`border-b border-border px-4 py-3 flex items-center justify-between`,children:[F(`div`,{children:[B(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Templates`}),B(`p`,{className:`text-[11px] text-foreground-subtle mt-0.5`,children:`Curated pipeline presets operators can apply to any camera. Apply-time is a copy — future edits to a template don't retroactively change cameras that were seeded from it. Save a template from the device Pipeline tab.`})]}),F(`div`,{className:`text-[11px] text-foreground-subtle`,children:[_.length,` template`,_.length===1?``:`s`]})]}),_.length===0?F(`div`,{className:`px-4 py-8 text-xs text-foreground-subtle flex flex-col items-center gap-2`,children:[B(Ne,{className:`h-6 w-6 opacity-40`}),B(`div`,{children:`No templates yet. Create one from a device Pipeline tab ("Save as template").`})]}):B(`ul`,{className:`divide-y divide-border`,children:_.map(e=>{let t=i===e.id;return B(`li`,{className:`px-4 py-3 text-xs`,children:F(`div`,{className:`flex items-start gap-3`,children:[B(`div`,{className:`flex-1 min-w-0`,children:t?F(`div`,{className:`space-y-2`,children:[B(`input`,{className:`w-full rounded border border-border bg-surface-hover px-2 py-1 text-xs text-foreground focus:outline-none focus:border-primary`,value:o,onChange:e=>s(e.target.value),placeholder:`Template name`,autoFocus:!0}),B(`input`,{className:`w-full rounded border border-border bg-surface-hover px-2 py-1 text-[11px] text-foreground focus:outline-none focus:border-primary`,value:c,onChange:e=>l(e.target.value),placeholder:`Description (optional)`})]}):F(L,{children:[B(`div`,{className:`font-medium text-foreground`,children:e.name}),e.description&&B(`div`,{className:`text-foreground-subtle mt-0.5`,children:e.description}),F(`div`,{className:`mt-1 font-mono text-[10px] text-foreground-subtle`,children:[e.config.steps.length,` step(s)`,e.config.audio?.enabled?` · audio`:``,F(`span`,{className:`ml-2`,children:[`updated `,new Date(e.updatedAt).toLocaleString()]})]})]})}),B(`div`,{className:`flex items-center gap-1 shrink-0`,children:t?F(L,{children:[F(`button`,{type:`button`,onClick:g,disabled:d.isPending,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium bg-primary text-white hover:bg-primary/90 disabled:opacity-50`,children:[B(U,{className:`h-3 w-3`}),`Save`]}),F(`button`,{type:`button`,onClick:h,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[11px] text-foreground-subtle hover:bg-surface-hover`,children:[B(Je,{className:`h-3 w-3`}),`Cancel`]})]}):F(L,{children:[B(`button`,{type:`button`,onClick:()=>m(e),title:`Rename`,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[11px] text-foreground-subtle hover:text-foreground hover:bg-surface-hover`,children:B(Me,{className:`h-3 w-3`})}),B(`button`,{type:`button`,onClick:()=>{confirm(`Delete template "${e.name}"?`)&&p.mutate({id:e.id})},disabled:p.isPending,title:`Delete`,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[11px] text-foreground-subtle hover:text-red-400 hover:bg-surface-hover disabled:opacity-50`,children:B(Xe,{className:`h-3 w-3`})})]})})]})},e.id)})})]})})}P();var Pn=`pipeline-analytics`;function Fn(e){for(let t of e?.sections??[])for(let e of t.fields??[])if(e.key===`postProcessingNodeId`&&typeof e.value==`string`)return e.value;return`hub`}function In(){let e=R(),{data:t}=y(void 0),{data:n,isLoading:r}=de({addonId:Pn}),i=Fn(n),a=A({onSuccess:()=>{e.invalidateQueries({queryKey:[[`addonSettings`,`getGlobalSettings`]]})}}),o=I(()=>{let e=(t??[]).filter(e=>e.isOnline).map(e=>e.id);return[...new Set([`hub`,i,...e])].filter(Boolean)},[t,i]);return F(`div`,{className:`flex flex-col gap-6`,children:[F(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[B(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Post-processing node`}),B(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`The single node that runs detection post-processing (events, media, audio & motion). Every other node stays inert — no multi-node balancing. Takes effect on addon restart.`}),F(`div`,{className:`mt-3 flex items-center gap-2`,children:[r?B(W,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):B(`select`,{value:i,onChange:e=>{e.target.value!==i&&a.mutate({addonId:Pn,patch:{postProcessingNodeId:e.target.value}})},disabled:a.isPending,className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:o.map(e=>B(`option`,{value:e,children:e===`hub`?`hub (default)`:e},e))}),a.isPending&&B(W,{className:`h-4 w-4 animate-spin text-primary`})]})]}),F(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[B(`h3`,{className:`mb-1 text-sm font-semibold text-foreground`,children:`Events folder`}),B(`p`,{className:`mb-3 text-[11px] text-foreground-subtle`,children:`Where event crops / full frames are stored. A single folder — no collection / equal-splitting.`}),B(rt,{types:[`eventMedia`]})]})]})}var Ln=`pipeline-orchestrator`,Rn=200;function zn(){return F(`div`,{className:`flex flex-col gap-3`,children:[F(`div`,{children:[B(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Orchestrator logs`}),B(`p`,{className:`text-[11px] text-foreground-subtle`,children:`Dispatch decisions, balancer moves and failover events from the pipeline orchestrator. Streaming live; the device chip on a line tells which camera it refers to.`})]}),B(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:B(j,{addonId:Ln,limit:Rn,maxHeight:`max-h-[calc(100vh-360px)]`,showScope:!0,showDeviceChip:!0,showFilters:!1})})]})}P();var Bn=[{id:`assignments`,label:`Assignments`},{id:`events`,label:`Events`},{id:`recording`,label:`Recording`},{id:`settings`,label:`Settings`},{id:`templates`,label:`Templates`},{id:`logs`,label:`Logs`}];function Vn({refreshToken:e}){let[t,n]=z(`assignments`);return F(`div`,{className:`flex flex-col h-full`,children:[F(`div`,{className:`px-4 sm:px-6 py-4 border-b border-border`,children:[B(`h2`,{className:`text-base font-semibold text-foreground`,children:`Cluster Orchestration`}),B(`div`,{className:`text-[11px] text-foreground-subtle mt-1`,children:`Assignments with live load, cluster-wide settings, pipeline template library, per-camera pipeline overrides.`})]}),B(`div`,{className:`flex items-center gap-1 px-4 sm:px-6 border-b border-border overflow-x-auto`,children:Bn.map(e=>B(`button`,{type:`button`,onClick:()=>n(e.id),className:`shrink-0 whitespace-nowrap px-3 py-2 text-xs font-medium border-b-2 transition-colors ${t===e.id?`border-primary text-primary`:`border-transparent text-foreground-subtle hover:text-foreground`}`,children:e.label},e.id))}),F(`div`,{className:`flex-1 min-h-0 overflow-y-auto p-4 sm:p-6 @container/clustertab`,children:[t===`assignments`&&B(An,{refreshToken:e}),t===`events`&&B(In,{}),t===`recording`&&B(it,{}),t===`settings`&&B(Mn,{refreshToken:e}),t===`templates`&&B(Nn,{refreshToken:e}),t===`logs`&&B(zn,{})]})]})}function Hn(e){let t=[],n=[],{assignment:r,detection:i,decoder:a,broker:o}=e;i!==null&&i.provisioning.state===`failed`&&t.push({code:`provisioning-failed`,severity:`error`,message:i.provisioning.error!==void 0&&i.provisioning.error.length>0?`Engine provisioning failed: ${i.provisioning.error}`:`Engine provisioning failed on the detection node`}),i!==null&&i.phase===`active`&&i.actualFps===0&&t.push({code:`detection-black-hole`,severity:`error`,message:`Detection phase is ACTIVE but 0 fps are being processed — frames are not reaching the detector (cross-node black-hole signature)`}),i!==null&&i.phase===`active`&&a!==null&&a.shm.framesWritten===0&&t.push({code:`decoder-black-hole`,severity:`error`,message:`Decoder on ${a.nodeId} has written 0 frames to the shared-memory plane while detection is active — the decode path is stalled`}),r.detectionNodeId===null&&i===null&&n.push({code:`unassigned`,severity:`warning`,message:`Not placed on any detection node — no pipeline is running for this camera`});for(let e of o?.profiles??[])e.status===`streaming`&&e.inFps===0&&n.push({code:`broker-stalled`,severity:`warning`,message:`Broker profile "${e.profile}" reports streaming but 0 in-fps — the source pull may be stalled`});return[...t,...n]}function Un(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Y(e){return typeof e==`string`&&e.length>0?e:null}function Wn(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function Gn(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function Kn(e,t){return e==null?!1:JSON.stringify(e)!==JSON.stringify(t??null)}var qn={detectionMode:null,detectionStreamProfile:null,detectionFps:null,motionSources:[],motionFps:null,motionCooldownMs:null,motionStreamProfile:null,audioMode:null,pipelineNodeId:null,decoderNodeId:null,audioNodeId:null,overriddenKeys:new Set};function Jn(e){if(!Un(e)||!Array.isArray(e.sections))return qn;let t=ye(e),n=e=>{let n=t.get(e);if(n!==void 0)return n.value??n.default},r=new Set;for(let[e,n]of t)Kn(n.value,n.default)&&r.add(e);return{detectionMode:Y(n(`detectionMode`)),detectionStreamProfile:Y(n(`detectionStreamProfile`)),detectionFps:Wn(n(`detectionFps`)),motionSources:Gn(n(`motionSources`)),motionFps:Wn(n(`motionFps`)),motionCooldownMs:Wn(n(`motionCooldownMs`)),motionStreamProfile:Y(n(`motionStreamProfile`)),audioMode:Y(n(`audioMode`)),pipelineNodeId:Y(n(`pipelineNodeId`)),decoderNodeId:Y(n(`decoderNodeId`)),audioNodeId:Y(n(`audioNodeId`)),overriddenKeys:r}}function Yn(e,t=0){let n=[];for(let r of e)n.push({addonId:r.addonId,modelId:r.modelId??null,enabled:r.enabled,depth:t}),r.children!==void 0&&r.children.length>0&&n.push(...Yn(r.children,t+1));return n}function Xn(e){let{assignment:t,detection:n}=e;return n!==null&&n.provisioning.state===`failed`||t.detectionNodeId===null&&n===null?`error`:n!==null&&n.phase===`active`?`healthy`:`idle`}function X({title:e,children:t}){return F(`div`,{className:`bg-background px-3.5 py-3 min-w-0`,children:[B(`div`,{className:`text-[9px] font-semibold uppercase tracking-[0.14em] text-foreground-subtle mb-2`,children:e}),B(`div`,{className:`flex flex-col gap-1 min-w-0`,children:t})]})}function Z({label:e,children:t,overridden:n=!1}){return F(`div`,{className:`flex items-baseline gap-2 text-[11px] leading-snug min-w-0`,children:[B(`span`,{className:`text-foreground-subtle shrink-0 w-24 truncate`,title:e,children:e}),B(`span`,{className:`font-mono tabular-nums text-foreground min-w-0 truncate flex-1`,children:t}),n&&B(Zn,{})]})}function Zn(){return B(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full bg-warning shrink-0 self-center`,title:`Device-level override active`,"aria-label":`Device-level override active`,role:`img`})}var Qn={neutral:`border-border text-foreground-muted`,success:`border-success/40 text-success`,warning:`border-warning/40 text-warning`,danger:`border-danger/40 text-danger`,info:`border-info/40 text-info`};function Q({tone:e=`neutral`,children:t,title:n}){return B(`span`,{title:n,className:`inline-flex items-center gap-1 rounded border px-1.5 py-px text-[10px] font-medium leading-tight whitespace-nowrap ${Qn[e]}`,children:t})}function $({children:e}){return B(`div`,{className:`text-[11px] text-foreground-subtle italic`,children:e})}function $n({icon:e,label:t,nodeId:n,pinned:r,reason:i,overridden:a}){return F(`div`,{className:`flex items-center gap-2 text-[11px] leading-snug min-w-0`,children:[B(e,{className:`h-3 w-3 text-foreground-subtle shrink-0`}),B(`span`,{className:`text-foreground-subtle w-[4.5rem] shrink-0`,children:t}),n===null?B(`span`,{className:`text-foreground-subtle italic`,children:`unassigned`}):F(L,{children:[B(`span`,{className:`font-mono text-foreground truncate`,title:n,children:n}),r?F(`span`,{className:`inline-flex items-center gap-0.5 text-[10px] text-warning shrink-0`,title:`Manually pinned`,children:[B(st,{className:`h-2.5 w-2.5`}),` manual`]}):F(`span`,{className:`text-[10px] text-foreground-subtle shrink-0 truncate`,children:[`auto · `,i!==void 0&&i.length>0?i:`capacity`]}),a&&B(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full bg-warning shrink-0`,title:`Persisted settings pin for this role`})]})]})}function er({assignment:e,settings:t,onlineNodes:n,pinPending:r,onDetectionPinChange:i}){let a=e.pinned.detection&&e.detectionNodeId!==null?e.detectionNodeId:`auto`,o=[...new Set([...e.detectionNodeId===null?[]:[e.detectionNodeId],...n.map(e=>e.id)])];return F(X,{title:`Where it runs`,children:[B($n,{icon:G,label:`Detection`,nodeId:e.detectionNodeId,pinned:e.pinned.detection,reason:e.reasons.detection,overridden:t.overriddenKeys.has(`pipelineNodeId`)}),B($n,{icon:Be,label:`Decoder`,nodeId:e.decoderNodeId,pinned:e.pinned.decoder,reason:e.reasons.decoder,overridden:t.overriddenKeys.has(`decoderNodeId`)}),B($n,{icon:Ae,label:`Audio`,nodeId:e.audioNodeId,pinned:e.pinned.audio,reason:e.reasons.audio,overridden:t.overriddenKeys.has(`audioNodeId`)}),B($n,{icon:Pe,label:`Source`,nodeId:e.sourceNodeId,pinned:!1,reason:`ingest owner`,overridden:!1}),B(`div`,{className:`mt-1.5`,children:F(`select`,{value:a,disabled:r,"aria-label":`Detection placement pin`,onChange:e=>i(e.target.value),className:`w-full min-w-0 rounded-md border border-border bg-background px-2 py-1 text-[11px] text-foreground disabled:opacity-50`,children:[B(`option`,{value:`auto`,children:`Auto (load balanced)`}),o.map(e=>F(`option`,{value:e,children:[`Pin detection → `,n.find(t=>t.id===e)?.name??e]},e))]})})]})}function tr(e){return`${e.width}×${e.height} ${e.codec} @${e.fps}fps`}function nr(e,t){if(!(t===null||e===void 0))return e.find(e=>e.profile===t)}function rr(e){return e===null?`default`:e===0?`native (no throttle)`:`${e} fps`}function ir({streams:e,brokerProfiles:t,settings:n,motionEnabled:r,motionFpsLive:i}){let a=nr(t,n.detectionStreamProfile),o=nr(t,n.motionStreamProfile),s=n.motionSources.includes(`analyzer`);return F(X,{title:`Streams & motion`,children:[F(Z,{label:`Detect stream`,overridden:n.overriddenKeys.has(`detectionStreamProfile`),children:[n.detectionStreamProfile??`—`,a!==void 0&&` · ${a.width}×${a.height} ${a.codec}`]}),B(Z,{label:`Detect FPS`,overridden:n.overriddenKeys.has(`detectionFps`),children:rr(n.detectionFps)}),F(Z,{label:`Motion src`,overridden:n.overriddenKeys.has(`motionSources`),children:[n.motionSources.length>0?n.motionSources.join(` + `):`none`,r===!1&&` · inactive`]}),s&&F(L,{children:[F(Z,{label:`Motion stream`,overridden:n.overriddenKeys.has(`motionStreamProfile`),children:[n.motionStreamProfile??`—`,o!==void 0&&` · ${o.width}×${o.height} ${o.codec}`]}),F(Z,{label:`Motion FPS`,overridden:n.overriddenKeys.has(`motionFps`),children:[rr(n.motionFps),i!==null&&` · live ${i.toFixed(1)}`]})]}),B(Z,{label:`Cooldown`,overridden:n.overriddenKeys.has(`motionCooldownMs`),children:n.motionCooldownMs===null?`default`:`${n.motionCooldownMs/1e3}s`}),B(`div`,{className:`mt-1.5 flex flex-col gap-0.5`,children:e.length===0?B($,{children:`No streams registered`}):e.map(e=>F(`div`,{className:`text-[10px] font-mono text-foreground-subtle truncate`,title:e.camStreamId,children:[B(`span`,{className:`text-foreground-muted`,children:e.kind}),` `,tr(e)]},e.camStreamId))})]})}function ar({steps:e,audioModelId:t,audioEnabled:n,audioMode:r}){return F(X,{title:`Pipeline steps`,children:[e===void 0?B($,{children:`Resolving…`}):e.length===0?B($,{children:`No steps configured`}):B(`div`,{className:`flex flex-wrap gap-1`,children:e.map((e,t)=>B(Q,{tone:e.enabled&&e.depth===0?`info`:`neutral`,title:e.modelId??e.addonId,children:F(`span`,{className:e.enabled?``:`line-through opacity-60`,children:[e.depth>0&&B(`span`,{className:`opacity-50`,children:`↳ `}),e.addonId,e.modelId!==null&&F(`span`,{className:`font-mono opacity-75`,children:[` · `,e.modelId]})]})},`${e.addonId}-${t}`))}),B(`div`,{className:`mt-1`,children:F(Z,{label:`Audio class.`,children:[r??`—`,n!==null&&(n?` · running`:` · off`),t!==null&&` · ${t}`]})})]})}var or={ready:`success`,installing:`info`,verifying:`info`,idle:`neutral`,failed:`danger`};function sr({detection:e,live:t,detectionMode:n,modeOverridden:r}){if(e===null)return F(X,{title:`Detection runtime`,children:[B(Z,{label:`Mode`,overridden:r,children:n??`—`}),B($,{children:`Detection stage inactive or unreachable`})]});let a=t?.phase??e.phase,o=t?.actualFps??e.actualFps,s=t?.configuredFps??e.configuredFps,c=t?.avgInferenceTimeMs??e.avgInferenceMs,l=t?.queueDepth??e.queueDepth,u=i(a),d=a===`active`&&o===0;return F(X,{title:`Detection runtime`,children:[F(`div`,{className:`flex items-center gap-1.5 mb-0.5`,children:[F(`span`,{className:`inline-flex items-center gap-1 rounded border px-1.5 py-px text-[10px] font-semibold uppercase tracking-wider ${u.badgeClass}`,children:[B(C,{phase:a,className:`h-2.5 w-2.5`}),u.label]}),t!==void 0&&B(`span`,{className:`text-[9px] text-foreground-subtle uppercase tracking-wider`,children:`live`})]}),B(Z,{label:`Mode`,overridden:r,children:n??`—`}),F(Z,{label:`FPS`,children:[B(`span`,{className:d?`text-danger font-semibold`:``,children:o.toFixed(1)}),F(`span`,{className:`text-foreground-subtle`,children:[` / `,s.toFixed(0),` configured`]})]}),F(Z,{label:`Inference`,children:[c.toFixed(0),` ms`,l>0&&F(`span`,{className:`text-warning`,children:[` · queue `,l]}),t!==void 0&&t.droppedFrames>0&&F(`span`,{className:`text-warning`,children:[` · drops `,t.droppedFrames]})]}),F(Z,{label:`Engine`,children:[e.engine.backend,` · `,e.engine.device]}),F(Z,{label:`Provisioning`,children:[B(Q,{tone:or[e.provisioning.state]??`neutral`,children:e.provisioning.state}),e.provisioning.error!==void 0&&F(`span`,{className:`text-danger text-[10px]`,children:[` `,e.provisioning.error]})]})]})}function cr({broker:e}){return e===null?B(X,{title:`Stream broker`,children:B($,{children:`Broker stage inactive or unreachable`})}):F(X,{title:`Stream broker`,children:[e.profiles.length===0?B($,{children:`No broker profiles`}):B(`div`,{className:`flex flex-col gap-1`,children:e.profiles.map(e=>{let t=e.status===`streaming`,n=t&&e.inFps===0;return F(`div`,{className:`flex items-center gap-2 text-[11px] font-mono tabular-nums min-w-0`,children:[B(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full shrink-0 ${n?`bg-danger`:t?`bg-success animate-pulse`:`bg-border`}`,title:e.status}),B(`span`,{className:`text-foreground w-10 shrink-0 truncate`,title:e.profile,children:e.profile}),F(`span`,{className:`text-foreground-subtle truncate`,children:[e.width,`×`,e.height,` `,e.codec]}),F(`span`,{className:`ml-auto shrink-0 ${n?`text-danger`:`text-foreground`}`,children:[e.inFps.toFixed(0),`→`,e.outFps.toFixed(0),`fps`]}),F(`span`,{className:`text-foreground-subtle shrink-0`,title:`Subscribers`,children:[`×`,e.subscribers]})]},e.profile)})}),F(`div`,{className:`mt-1.5 flex flex-wrap gap-1`,children:[F(Q,{tone:e.webrtcSessions>0?`info`:`neutral`,children:[`WebRTC `,e.webrtcSessions]}),F(Q,{tone:e.rtspRestream?`success`:`neutral`,children:[`restream `,e.rtspRestream?`on`:`off`]})]})]})}function lr({decoder:e,detectionActive:t}){if(e===null)return B(X,{title:`Decoder`,children:B($,{children:`Decoder stage inactive or unreachable`})});let n=t&&e.shm.framesWritten===0;return F(X,{title:`Decoder`,children:[B(Z,{label:`Node`,children:e.nodeId}),B(Z,{label:`Sessions`,children:e.sessionCount}),F(Z,{label:`SHM frames`,children:[B(`span`,{className:n?`text-danger font-semibold`:``,children:e.shm.framesWritten}),B(`span`,{className:`text-foreground-subtle`,children:` written`})]}),F(Z,{label:`SHM reads`,children:[e.shm.getFrameHits,` hits`,e.shm.getFrameMisses>0&&F(`span`,{className:`text-warning`,children:[` · `,e.shm.getFrameMisses,` misses`]})]}),F(Z,{label:`SHM budget`,children:[e.shm.budgetMb,` MB`]}),e.formats.length>0&&B(Z,{label:`Formats`,children:e.formats.join(`, `)})]})}P();var ur=`pipeline-orchestrator`,dr={healthy:`bg-success`,idle:`bg-warning`,error:`bg-danger`},fr={healthy:`Healthy`,idle:`Idle`,error:`Error`};function pr({problems:e}){return B(`div`,{role:`alert`,className:`flex flex-col border-b border-border`,children:e.map(e=>F(`div`,{className:`flex items-start gap-2 px-4 py-1.5 text-[11px] font-medium ${e.severity===`error`?`bg-danger/10 text-danger`:`bg-warning/10 text-warning`}`,children:[B(Ye,{className:`h-3.5 w-3.5 shrink-0 mt-px`}),B(`span`,{className:`min-w-0`,children:e.message})]},e.code))})}function mr({deviceId:e,name:t,online:n,status:r,live:i,onlineNodes:a}){let o=R(),{data:s}=re({addonId:ur,deviceId:e,nodeId:`hub`},{staleTime:3e4}),{data:c}=m({deviceId:e},{staleTime:3e4}),l=I(()=>Jn(s),[s]),u=I(()=>c===void 0?void 0:Yn(c.steps),[c]),f=I(()=>r===void 0?[]:Hn(r),[r]),p=()=>{o.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getCameraStatuses`]]}),o.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getPipelineAssignments`]]})},h=oe({onSuccess:p}),g=d({onSuccess:p}),_=t=>{t===`auto`?g.mutate({deviceId:e}):h.mutate({deviceId:e,agentNodeId:t})},v=r===void 0?`idle`:Xn(r),y=f.some(e=>e.severity===`error`),b=f.length>0,x=y?`border-danger/50`:b?`border-warning/40`:`border-border`;return F(`article`,{"aria-label":`${t} pipeline status`,className:`rounded-lg border ${x} bg-background overflow-hidden`,children:[F(`header`,{className:`flex items-center gap-2.5 px-4 py-2.5 border-b border-border bg-surface/50 min-w-0`,children:[B(`span`,{className:`inline-block h-2 w-2 rounded-full shrink-0 ${y?`bg-danger`:dr[v]}`,title:y?`Error`:fr[v],"aria-label":y?`Error`:fr[v],role:`img`}),B(`h3`,{className:`text-[13px] font-semibold text-foreground truncate`,title:t,children:t}),F(`span`,{className:`text-[10px] text-foreground-subtle shrink-0`,children:[`#`,e]}),!n&&B(Q,{tone:`danger`,children:`offline`}),F(`span`,{className:`ml-auto flex items-center gap-1.5 shrink-0`,children:[l.detectionMode!==null&&B(Q,{tone:l.detectionMode===`disabled`?`warning`:l.detectionMode===`always-on`?`info`:`neutral`,title:`Object detection mode`,children:l.detectionMode===`disabled`?`detection off`:l.detectionMode}),r?.recording!=null&&(r.recording.active?F(Q,{tone:`danger`,title:`Recording (${r.recording.mode})`,children:[B(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full bg-danger animate-pulse`}),`REC`]}):r.recording.mode!==`off`&&F(Q,{tone:`neutral`,title:`Recording mode`,children:[`rec `,r.recording.mode]}))]})]}),f.length>0&&B(pr,{problems:f}),r===void 0?B(`div`,{className:`px-4 py-5 text-[11px] text-foreground-subtle italic`,children:`No pipeline status yet — the orchestrator has not composed a snapshot for this camera.`}):F(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-px bg-border`,children:[B(er,{assignment:r.assignment,settings:l,onlineNodes:a,pinPending:h.isPending||g.isPending,onDetectionPinChange:_}),B(sr,{detection:r.detection,live:i,detectionMode:l.detectionMode,modeOverridden:l.overriddenKeys.has(`detectionMode`)}),B(ar,{steps:u,audioModelId:c?.audio?.modelId??null,audioEnabled:r.audio?.enabled??c?.audio?.enabled??null,audioMode:l.audioMode}),B(ir,{streams:r.source.streams,brokerProfiles:r.broker?.profiles,settings:l,motionEnabled:r.motion?.enabled??null,motionFpsLive:r.motion?.fps??null}),B(cr,{broker:r.broker}),B(lr,{decoder:r.decoder,detectionActive:r.detection?.phase===`active`})]})]})}P();var hr=5e3,gr=1e4,_r=5e3;function vr(e){let t=R(),{data:n,isLoading:r}=Ce(),{data:i,isLoading:a}=k({},{refetchInterval:hr}),{nodes:o}=v();V(()=>{e!==0&&t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getCameraStatuses`]]})},[e,t]);let[s,c]=z(new Map);b(be.PipelineCameraMetricsSnapshot,e=>{let t=e.data;typeof t.deviceId==`number`&&c(e=>{let n=new Map(e);return n.set(t.deviceId,{phase:t.metrics.phase,configuredFps:t.metrics.configuredFps,actualFps:t.metrics.actualFps,queueDepth:t.metrics.queueDepth,avgInferenceTimeMs:t.metrics.avgInferenceTimeMs,droppedFrames:t.metrics.droppedFrames,timestamp:t.timestamp}),n})}),V(()=>{if(s.size===0)return;let e=setInterval(()=>{c(e=>{let t=Date.now()-gr,n=!1,r=new Map(e);for(let[i,a]of e)a.timestamp<t&&(r.delete(i),n=!0);return n?r:e})},_r);return()=>clearInterval(e)},[s.size]);let l=I(()=>{let e=new Map;for(let t of i??[])e.set(t.deviceId,t);return e},[i]);return{rows:I(()=>(n??[]).filter(e=>e.isCamera).map(e=>({deviceId:e.id,name:e.name,online:e.online,status:l.get(e.id)})).sort((e,t)=>e.name.localeCompare(t.name)),[n,l]),liveMetrics:s,onlineNodes:I(()=>(o??[]).filter(e=>e.isOnline).map(e=>({id:e.id,name:e.name})),[o]),isLoading:r||a}}P();function yr({refreshToken:e}){let{rows:t,liveMetrics:n,onlineNodes:r,isLoading:i}=vr(e),a=I(()=>[...t.map(e=>{let t=e.status===void 0?[]:Hn(e.status);return{row:e,errorCount:t.filter(e=>e.severity===`error`).length,warningCount:t.filter(e=>e.severity===`warning`).length}})].sort((e,t)=>e.errorCount===t.errorCount?e.warningCount===t.warningCount?0:t.warningCount-e.warningCount:t.errorCount-e.errorCount),[t]),o=I(()=>{let e=0,t=0;for(let r of a)(r.errorCount>0||r.warningCount>0)&&(t+=1),(n.get(r.row.deviceId)?.phase??r.row.status?.detection?.phase)===`active`&&(e+=1);return{total:a.length,active:e,issues:t}},[a,n]);return i&&t.length===0?B(`div`,{className:`flex items-center justify-center h-full text-sm text-foreground-subtle`,children:`Loading camera pipelines…`}):t.length===0?B(`div`,{className:`flex items-center justify-center h-full text-sm text-foreground-subtle`,children:`No cameras found`}):B(`div`,{className:`h-full overflow-y-auto`,children:F(`div`,{className:`max-w-6xl mx-auto flex flex-col gap-3 px-4 py-4`,children:[F(`div`,{className:`flex items-center gap-4 text-[11px] text-foreground-subtle px-1`,children:[F(`span`,{children:[B(`span`,{className:`font-semibold text-foreground`,children:o.total}),` cameras`]}),F(`span`,{children:[B(`span`,{className:`font-semibold text-success`,children:o.active}),` actively inferring`]}),F(`span`,{children:[B(`span`,{className:`font-semibold ${o.issues>0?`text-danger`:`text-foreground`}`,children:o.issues}),` `,`with issues`]}),B(`span`,{className:`ml-auto hidden sm:inline text-[10px]`,children:`polled every 5 s · detection metrics live at 1 Hz`})]}),a.map(({row:e})=>B(mr,{deviceId:e.deviceId,name:e.name,online:e.online,status:e.status,live:n.get(e.deviceId),onlineNodes:r},e.deviceId))]})})}P();var br=`__cluster__`;function xr(e){return e===`cameras`?`cameras`:`nodes`}function Sr(){let[e,t]=He(),n=xr(e.get(`view`)),r=e.get(`node`)??`__cluster__`,[i,a]=z(0),[o,s]=z(!1);return V(()=>{n===`nodes`&&!e.get(`node`)&&t({view:`nodes`,node:br},{replace:!0})},[n,e,t]),F(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[F(`div`,{className:`flex items-center justify-between gap-4 px-4 py-3 border-b border-border shrink-0`,children:[F(`div`,{className:`flex items-center gap-1 rounded-lg border border-border p-0.5 bg-surface`,children:[B(`button`,{type:`button`,onClick:()=>{t({view:`nodes`,node:r},{replace:!0})},className:[`px-3 py-1 rounded-md text-[11px] font-medium transition-colors`,n===`nodes`?`bg-background text-foreground shadow-sm`:`text-foreground-subtle hover:text-foreground`].join(` `),children:`Nodes`}),B(`button`,{type:`button`,onClick:()=>{t({view:`cameras`},{replace:!0})},className:[`px-3 py-1 rounded-md text-[11px] font-medium transition-colors`,n===`cameras`?`bg-background text-foreground shadow-sm`:`text-foreground-subtle hover:text-foreground`].join(` `),children:`Cameras`})]}),F(`button`,{type:`button`,onClick:()=>a(e=>e+1),title:`Refresh`,className:`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[11px] font-medium border border-border text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,children:[B(Fe,{className:`h-3.5 w-3.5`}),`Refresh`]})]}),n===`nodes`&&F(`button`,{type:`button`,onClick:()=>s(e=>!e),"aria-expanded":o,className:`md:hidden flex items-center justify-between gap-2 px-4 py-2 border-b border-border shrink-0 text-[11px] font-medium text-foreground-subtle hover:text-foreground transition-colors`,children:[F(`span`,{children:[o?`Hide`:`Show`,` node list`]}),B(Ve,{className:[`h-4 w-4 transition-transform`,o?`rotate-180`:``].join(` `)})]}),B(`div`,{className:`flex-1 flex flex-col md:flex-row overflow-hidden min-h-0`,children:n===`nodes`?F(L,{children:[B(`aside`,{className:[o?`block`:`hidden`,`md:block w-full md:w-72 shrink-0 border-b md:border-b-0 md:border-r border-border`,`max-h-[60vh] md:max-h-none overflow-y-auto`].join(` `),children:B(pt,{selectedNodeId:r,onSelect:e=>{t({view:`nodes`,node:e},{replace:!0}),s(!1)},refreshToken:i})}),B(`section`,{className:`flex-1 min-h-0 overflow-hidden`,children:r===`__cluster__`?B(Vn,{refreshToken:i}):B(tn,{nodeId:r,refreshToken:i})})]}):B(`section`,{className:`flex-1 min-h-0 overflow-hidden`,children:B(yr,{refreshToken:i})})})]})}export{Sr as PipelinePage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{W as e}from"./index-CqPUI4oB.js";var t=e(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{W as e}from"./index-CqPUI4oB.js";var t=e(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]);export{t};
|