@camstack/addon-admin-ui 1.0.7 → 1.0.8
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-BPXjVkoq.js → AddLocationWizard-DomSxpGI.js} +1 -1
- package/dist/assets/AddonCollectionPage-DpSbeFq7.js +1 -0
- package/dist/assets/Addons-1gQjuR9S.js +1 -0
- package/dist/assets/AdminPage-vtcsGqRq.js +1 -0
- package/dist/assets/{AdminTabs-C5BWg3Pz.js → AdminTabs-B7an3aYB.js} +1 -1
- package/dist/assets/{BrokerForm-CwBhT_Zu.js → BrokerForm-DImaKHz8.js} +1 -1
- package/dist/assets/{BrokerStep-kInoZsZ8.js → BrokerStep-D4L9bUsk.js} +1 -1
- package/dist/assets/Capabilities-D0caXSgs.js +1 -0
- package/dist/assets/{CapabilityBadges-CqlDFU27.js → CapabilityBadges-BCofv88Z.js} +1 -1
- package/dist/assets/{Cluster-vA3G3Xt-.js → Cluster-BtOVpJ4s.js} +1 -1
- package/dist/assets/{Dashboard-CIarzGjr.js → Dashboard-TKoXQaIb.js} +1 -1
- package/dist/assets/{Data-CBUx81MG.js → Data-B5u4dAnY.js} +1 -1
- package/dist/assets/DetectionIntelligence-C4FeIOdR.js +1 -0
- package/dist/assets/DeviceDetail-BPaQwx2C.js +2 -0
- package/dist/assets/{Devices-KDtIE02J.js → Devices-D1-l4svU.js} +1 -1
- package/dist/assets/EmbedPlayerPage-6o-vVqJv.js +1 -0
- package/dist/assets/FormBuilder-aFYGmiS4.js +1 -0
- package/dist/assets/{Identity-CYHFXu1M.js → Identity-DoN_l5BA.js} +1 -1
- package/dist/assets/IntegrationDetail-ChyVujgZ.js +1 -0
- package/dist/assets/Integrations-SnvWread.js +1 -0
- package/dist/assets/{Integrations-BXICd-JI.js → Integrations-vgx-gq-F.js} +1 -1
- package/dist/assets/{Logs-kzrdYdPu.js → Logs-ByT8Fq04.js} +1 -1
- package/dist/assets/{MaskShapeCanvas-C5K6H6Th.js → MaskShapeCanvas-CQ2SgaNa.js} +1 -1
- package/dist/assets/MotionZonesSettings-CsC6s4D-.js +1 -0
- package/dist/assets/MyAccess-CcV3suRC.js +2 -0
- package/dist/assets/Network-DSUa74-e.js +1 -0
- package/dist/assets/NodeAddonsSettingsPanel-C8dKpqZh.js +1 -0
- package/dist/assets/{Pipeline-C460Q1dM.js → Pipeline-DvAGol7e.js} +1 -1
- package/dist/assets/PrivacyMaskSettings-BYqj289i.js +1 -0
- package/dist/assets/{ProviderIcon-BS00rCO4.js → ProviderIcon-DnjoN_gW.js} +1 -1
- package/dist/assets/SchemaTabBar-DRo5sGP1.js +1 -0
- package/dist/assets/Settings-McpLfu8Z.js +1 -0
- package/dist/assets/Showroom-DBUVcfqM.js +1 -0
- package/dist/assets/{StatusBadge-CkYubfRG.js → StatusBadge-BSsUNFG6.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BCWO2hJt.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-73q_gPW1.js} +1 -1
- package/dist/assets/{_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CK8iQdP1.js → _virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CCjPq1YD.js} +1 -1
- package/dist/assets/{_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.js-DEeasWo3.js → _virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.js-DqrXu-jG.js} +1 -1
- package/dist/assets/{_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.js-C1rR7FKs.js → _virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.js-DcnMG4y9.js} +1 -1
- package/dist/assets/{_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-DQOBkcAT.js → _virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-CUURKTLp.js} +1 -1
- package/dist/assets/{_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_konva__loadShare__.js-PYw2UAZ_.js → _virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_konva__loadShare__.js-xmx-auwe.js} +3 -3
- package/dist/assets/{bell-CRa7XWAs.js → bell-C5Uv_byR.js} +1 -1
- package/dist/assets/circle-check-big-CToOIOTu.js +1 -0
- package/dist/assets/{copy-Bi-BgxBp.js → copy-B_qOe5z2.js} +1 -1
- package/dist/assets/dist-DBAJfCeK.js +1 -0
- package/dist/assets/{dist-B82tlPWR.js → dist-DivYVFrG.js} +1 -1
- package/dist/assets/{download-Bq_ArgRU.js → download-BT33CH3j.js} +1 -1
- package/dist/assets/{esm-C6_--ziT.js → esm-C2ZjsqSd.js} +3 -3
- package/dist/assets/{hostInit-B8ISRO-X.js → hostInit-BzUwQrc2.js} +1 -1
- package/dist/assets/index-C9dLNgtt.js +4 -0
- package/dist/assets/{key-round-DdK6mTCz.js → key-round-CMLRqbrq.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-ebe1e057.js → mf-entry-bootstrap-0-49f53064.js} +2 -2
- package/dist/assets/{pencil-WwVUhRC9.js → pencil-CLwBxZCl.js} +1 -1
- package/dist/assets/{player-overlays-ZG1nYuYj.js → player-overlays-BD7QrhVv.js} +1 -1
- package/dist/assets/plus-tJZHYmsB.js +1 -0
- package/dist/assets/{radio-B8E0UhzS.js → radio-CnJYCpke.js} +1 -1
- package/dist/assets/{refresh-cw-DewUBhjl.js → refresh-cw-CLgLEKc_.js} +1 -1
- package/dist/assets/remoteEntry-CtF0a_XV.js +1 -0
- package/dist/assets/{rotate-ccw-CZ8RwUso.js → rotate-ccw-B53meVG1.js} +1 -1
- package/dist/assets/rotate-cw-EY9cIQs9.js +1 -0
- package/dist/assets/search-BT8SB-Ig.js +1 -0
- package/dist/assets/{server-DnaOYw5t.js → server-C-7gGEm3.js} +1 -1
- package/dist/assets/{sparkles-D9CcRRON.js → sparkles-DKm7eNvc.js} +1 -1
- package/dist/assets/square-UU8oWHzQ.js +1 -0
- package/dist/assets/{square-check-big-9Ki4zQ6C.js → square-check-big-XneAXRht.js} +1 -1
- package/dist/assets/src-DsE0ulBa.js +1 -0
- package/dist/assets/{src-BB1LG2-C.js → src-tFxrblhL.js} +6 -6
- package/dist/assets/{upload-DHwenRyJ.js → upload-C45qaDPP.js} +1 -1
- package/dist/assets/{useDevice-BuSIXBXp.js → useDevice-CEFTGk-N.js} +1 -1
- package/dist/assets/useEventInvalidation-BtLXp2PR.js +1 -0
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-OHA5nJNY.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-B5yi8CSR.js} +2 -2
- package/dist/assets/{wifi-BJgMgcFe.js → wifi-DstzyoYP.js} +1 -1
- package/dist/assets/{zap-BAH9oFRn.js → zap-DHsYuJKW.js} +1 -1
- package/dist/index.html +5 -5
- package/dist/server/addon.js +4 -4
- package/package.json +1 -1
- package/dist/assets/AddonCollectionPage-BHk_82L1.js +0 -1
- package/dist/assets/Addons-Bu6k7qrw.js +0 -1
- package/dist/assets/AdminPage-CN6ZMhf0.js +0 -1
- package/dist/assets/Capabilities-DazohgP2.js +0 -1
- package/dist/assets/DetectionIntelligence-DmE8QQvK.js +0 -1
- package/dist/assets/DeviceDetail-DqTWl3Kz.js +0 -2
- package/dist/assets/EmbedPlayerPage-BcG6bilu.js +0 -1
- package/dist/assets/FormBuilder-DBTf1H_B.js +0 -1
- package/dist/assets/IntegrationDetail-DqViKcp6.js +0 -1
- package/dist/assets/Integrations-Cyg_bOkD.js +0 -1
- package/dist/assets/MotionZonesSettings-C1INb9Ec.js +0 -1
- package/dist/assets/MyAccess-DvxBmUhb.js +0 -2
- package/dist/assets/Network-BEet8LbP.js +0 -1
- package/dist/assets/NodeAddonsSettingsPanel-BU3fsQhW.js +0 -1
- package/dist/assets/PrivacyMaskSettings-Isrt2Rzc.js +0 -1
- package/dist/assets/SchemaTabBar-ByWwzBUZ.js +0 -1
- package/dist/assets/Settings-BPtVhsDv.js +0 -1
- package/dist/assets/Showroom-qtUMm-lj.js +0 -1
- package/dist/assets/circle-check-big-Ca1L631f.js +0 -1
- package/dist/assets/dist-B8KtyWbO.js +0 -1
- package/dist/assets/index-D5OTguVm.js +0 -4
- package/dist/assets/plus-D2fCWFPc.js +0 -1
- package/dist/assets/remoteEntry-vWrz4ebK.js +0 -1
- package/dist/assets/rotate-cw-DiyghCam.js +0 -1
- package/dist/assets/search-DZ8Fw9-F.js +0 -1
- package/dist/assets/square-CO0xPDBD.js +0 -1
- package/dist/assets/src-Cno9Ci3x.js +0 -1
- package/dist/assets/useEventInvalidation-wNGhDdi_.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$r as e,Bi as t,Br as n,Cr as r,Dr as i,Er as a,Fr as o,Hr as s,Ir as c,J as l,Ki as u,Kr as d,Mr as f,Nr as p,Or as m,Pi as h,Qr as g,Ri as _,Rr as v,Sr as y,Ui as b,Ur as x,Vi as S,Vr as C,Wi as w,X as T,_ as E,ai as D,br as O,ei as k,gr as A,jr as ee,kr as te,li as ne,oi as j,qi as M,qr as N,ri as P,si as re,ti as ie,va as ae,vr as oe,w as se,wr as ce,xr as le,yr as ue,zi as de}from"./src-BB1LG2-C.js";import{F as fe,G as F,R as I,U as L,W as pe,X as R,a as me,b as z,o as B,w as he,x as V,y as H}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CK8iQdP1.js";import{p as ge}from"./player-overlays-ZG1nYuYj.js";import{D as U,O as _e}from"./src-Cno9Ci3x.js";import{t as ve}from"./download-Bq_ArgRU.js";import{i as ye,n as be,r as xe,t as Se}from"./AddLocationWizard-BPXjVkoq.js";import{n as Ce,r as we,t as Te}from"./zap-BAH9oFRn.js";import{t as Ee}from"./pencil-WwVUhRC9.js";import{t as De}from"./plus-D2fCWFPc.js";import{t as Oe}from"./refresh-cw-DewUBhjl.js";import{t as ke}from"./search-DZ8Fw9-F.js";import{t as Ae}from"./server-DnaOYw5t.js";import{t as je}from"./square-check-big-9Ki4zQ6C.js";import{t as Me}from"./square-CO0xPDBD.js";import{A as Ne,B as W,F as Pe,M as Fe,P as Ie,W as Le,i as Re,j as ze,k as G,s as Be,w as Ve,x as K}from"./index-D5OTguVm.js";import{t as He}from"./AdminPage-CN6ZMhf0.js";import{r as Ue}from"./useDevice-BuSIXBXp.js";import{t as q}from"./useEventInvalidation-wNGhDdi_.js";import{n as We}from"./format-size-CO9d3C3-.js";import{t as Ge}from"./NodeAddonsSettingsPanel-BU3fsQhW.js";import{a as J,i as Ke,n as qe,r as Y,t as Je}from"./esm-C6_--ziT.js";var Ye=W(`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`}]]),Xe=W(`film`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M3 7.5h4`,key:`zfgn84`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M3 16.5h4`,key:`1230mu`}],[`path`,{d:`M17 3v18`,key:`in4fa5`}],[`path`,{d:`M17 7.5h4`,key:`myr1c1`}],[`path`,{d:`M17 16.5h4`,key:`go4c1d`}]]),Ze=W(`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`}]]),Qe=W(`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`}]]);R();function $e({selectedNodeId:e,onSelect:t,refreshToken:r}){let{data:i}=A(void 0),{data:a}=n(void 0),o=new Map;for(let e of a??[])o.set(e.agentNodeId,(o.get(e.agentNodeId)??0)+1);let s=i??[],c=s.filter(e=>e.isOnline).length,l=s.filter(e=>!e.isOnline).length;return V(`div`,{className:`flex flex-col h-full`,children:[V(`button`,{type:`button`,onClick:()=>t(Tn),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:[z(Ve,{className:`h-4 w-4 flex-shrink-0`}),V(`div`,{className:`min-w-0 flex-1`,children:[z(`div`,{className:`text-xs font-semibold truncate`,children:`Cluster`}),z(`div`,{className:`text-[10px] text-foreground-subtle`,children:`Balancer + failover + assignments`})]})]}),z(`div`,{className:`flex-1 overflow-y-auto`,children:s.map(n=>{let r=e===n.id,i=o.get(n.id)??0,a=n.isHub?Ae:G;return V(`button`,{type:`button`,onClick:()=>t(n.id),className:`flex items-center gap-3 w-full px-4 py-3 border-b border-border text-left transition-colors ${r?`bg-primary/10 text-primary`:`text-foreground hover:bg-surface-hover`}`,children:[z(a,{className:`h-4 w-4 flex-shrink-0`}),V(`div`,{className:`min-w-0 flex-1`,children:[V(`div`,{className:`flex items-center gap-2`,children:[z(`span`,{className:`text-xs font-semibold truncate`,children:n.name}),n.isHub&&z(`span`,{className:`text-[9px] uppercase tracking-wider text-foreground-subtle border border-border rounded px-1 py-0.5`,children:`hub`}),!n.isOnline&&z(`span`,{className:`h-1.5 w-1.5 rounded-full bg-destructive flex-shrink-0`}),n.isOnline&&z(`span`,{className:`h-1.5 w-1.5 rounded-full bg-success flex-shrink-0`})]}),V(`div`,{className:`text-[10px] text-foreground-subtle flex items-center gap-2 mt-0.5`,children:[V(`span`,{children:[n.cpuCores,` cores`]}),z(`span`,{children:`•`}),V(`span`,{children:[Math.round(n.memoryMB/1024),` GB`]}),i>0&&V(H,{children:[z(`span`,{children:`•`}),V(`span`,{className:`inline-flex items-center gap-0.5 text-foreground`,children:[z(Ce,{className:`h-2.5 w-2.5`}),i]})]})]})]})]},n.id)})}),V(`div`,{className:`px-4 py-2 border-t border-border text-[10px] text-foreground-subtle flex items-center justify-between`,children:[V(`span`,{children:[c,` online`]}),l>0&&V(`span`,{className:`text-destructive`,children:[l,` offline`]})]})]})}function et({nodeId:e,refreshToken:t}){let{data:n}=A(void 0),r=n?.find(t=>t.id===e),i=de(`pipeline.runner-load-snapshot`,t=>t.nodeId===e)?.load??null;return r?V(`div`,{className:`px-6 py-4 border-b border-border`,children:[V(`div`,{className:`flex items-center gap-2 mb-1`,children:[z(`h2`,{className:`text-base font-semibold text-foreground`,children:r.name}),r.isOnline?z(`span`,{className:`text-[10px] px-2 py-0.5 rounded-full bg-success/10 text-success`,children:`online`}):z(`span`,{className:`text-[10px] px-2 py-0.5 rounded-full bg-destructive/10 text-destructive`,children:`offline`}),r.isHub&&z(`span`,{className:`text-[9px] uppercase tracking-wider text-foreground-subtle border border-border rounded px-1 py-0.5`,children:`hub`})]}),V(`div`,{className:`text-[11px] text-foreground-subtle flex items-center gap-2 flex-wrap`,children:[z(`span`,{children:r.cpuModel??`CPU`}),z(`span`,{children:`•`}),V(`span`,{children:[r.cpuCores,` cores`]}),z(`span`,{children:`•`}),V(`span`,{children:[Math.round(r.memoryMB/1024),` GB`]}),i&&V(H,{children:[z(`span`,{children:`•`}),V(`span`,{children:[i.attachedCameras,` cameras (`,i.activeCameras,` active)`]}),z(`span`,{children:`•`}),V(`span`,{children:[i.avgInferenceTimeMs.toFixed(0),`ms avg inference`]}),z(`span`,{children:`•`}),V(`span`,{children:[`queue `,i.queueDepthTotal]}),i.hardware.hasGpu&&V(H,{children:[z(`span`,{children:`•`}),z(`span`,{className:`text-success`,children:`GPU`})]})]})]})]}):z(`div`,{className:`px-6 py-4 border-b border-border`,children:V(`div`,{className:`text-xs text-foreground-subtle`,children:[`Node not found: `,e]})})}function tt({refreshToken:e,nodeId:t}){let[n,r]=F(new Map),{nodes:i}=_();S(`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}=p(void 0),o=L(()=>{let e=new Map;for(let t of a??[])e.set(t.nodeId,t.deviceCount);return e},[a]),s=L(()=>{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=L(()=>{let e=new Map;for(let t of i)e.set(t.id,t.shortName);return e},[i]),l=L(()=>{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 V(`div`,{className:`@container/liveload`,children:[z(`h3`,{className:`text-sm font-semibold text-foreground mb-2`,children:`Live load`}),V(`div`,{className:`grid grid-cols-2 @md/liveload:grid-cols-3 @3xl/liveload:grid-cols-5 gap-2 mb-3`,children:[z(X,{label:`FPS`,value:e?e.totalFps.toFixed(1):`—`}),z(X,{label:`Cameras`,value:e?`${e.activeCameras}/${e.attachedCameras}`:`—`}),z(X,{label:`Avg infer ms`,value:e&&e.attachedCameras>0?(e.totalInferenceWeighted/e.attachedCameras).toFixed(0):`—`}),z(X,{label:`Queue`,value:e?String(e.queueDepth):`—`}),z(X,{label:`Audio`,value:String(o.get(t)??`—`)})]})]})}let u=[...s.entries()].toSorted(([e],[t])=>e===`hub`?-1:t===`hub`?1:e.localeCompare(t));return V(`div`,{className:`@container/liveload`,children:[z(`h3`,{className:`text-sm font-semibold text-foreground mb-2`,children:`Live load`}),V(`div`,{className:`grid grid-cols-2 @md/liveload:grid-cols-3 @3xl/liveload:grid-cols-5 gap-2 sm:gap-3 mb-3`,children:[z(X,{label:`Total agents`,value:`${l.onlineAgents}/${l.totalAgents}`}),z(X,{label:`Cameras`,value:`${l.activeCameras}/${l.attachedCameras}`}),z(X,{label:`Total FPS`,value:l.totalFps.toFixed(1)}),z(X,{label:`Avg inference ms`,value:l.avgInferenceTimeMs.toFixed(0)}),z(X,{label:`Queue depth`,value:String(l.queueDepth)})]}),z(`div`,{className:`rounded-lg border border-border overflow-x-auto`,children:V(`table`,{className:`w-full text-xs min-w-[480px]`,children:[z(`thead`,{className:`bg-surface`,children:V(`tr`,{className:`text-foreground-subtle text-[10px] uppercase tracking-wider`,children:[z(`th`,{className:`text-left px-3 py-2`,children:`Agent`}),z(`th`,{className:`text-right px-3 py-2`,children:`FPS`}),z(`th`,{className:`text-right px-3 py-2`,children:`Cameras`}),z(`th`,{className:`text-right px-3 py-2`,children:`Inference ms`}),z(`th`,{className:`text-right px-3 py-2`,children:`Queue`}),z(`th`,{className:`text-right px-3 py-2`,children:`Audio`})]})}),V(`tbody`,{children:[u.map(([e,t])=>V(`tr`,{className:`border-t border-border`,children:[z(`td`,{className:`px-3 py-2 text-foreground font-medium`,children:c.get(e)??e}),z(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.totalFps.toFixed(1)}),z(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.attachedCameras}),z(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.attachedCameras>0?(t.totalInferenceWeighted/t.attachedCameras).toFixed(0):`—`}),z(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.queueDepth}),z(`td`,{className:`px-3 py-2 text-right text-foreground`,children:o.get(e)??`—`})]},e)),u.length===0&&z(`tr`,{children:z(`td`,{colSpan:6,className:`px-3 py-4 text-center text-foreground-subtle text-[11px]`,children:`No camera metrics received yet`})})]})]})})]})}function X({label:e,value:t}){return V(`div`,{className:`rounded-lg border border-border bg-surface/60 p-3`,children:[z(`div`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle mb-1`,children:e}),z(`div`,{className:`text-lg font-semibold text-foreground`,children:t})]})}R();var nt={active:!1,pinned:!1,nodeId:null,reason:``},rt=[`pipeline.camera-assigned`,`pipeline.camera-unassigned`,`pipeline.camera-updated`,`agent.online`,`agent.offline`],it={pipeline:G,decoder:Xe,audio:we},at={pipeline:`Pipeline`,decoder:`Decoder`,audio:`Audio`};function ot({mode:t,nodeId:r,compact:o=!1}){if(t===`agent`&&!r)throw Error(`CameraAssignmentsTable: nodeId is required when mode === "agent"`);let s=B(),[c,l]=F(null),[u,d]=F(null),[p,h]=F(new Map);q([`pipelineOrchestrator`,`getPipelineAssignments`],rt),q([`pipelineOrchestrator`,`getDecoderAssignments`],rt),q([`pipelineOrchestrator`,`getAudioAssignments`],rt);let{data:y}=n(void 0),{data:b}=v(void 0),{data:x}=f(void 0),{nodes:C}=_(),{data:w}=Ue();S(`pipeline.camera-metrics-snapshot`,e=>{let t=e.data;typeof t.deviceId==`number`&&h(e=>{let n=new Map(e);return n.set(t.deviceId,t),n})}),I(()=>{if(p.size===0)return;let e=setInterval(()=>{h(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)},[p.size]);let T=L(()=>{let e=new Map;for(let t of w??[])e.set(t.id,t.name);return e},[w]),E=L(()=>{let e=new Map,n=t=>{let n=e.get(t);if(n)return n;let r={deviceId:t,deviceName:T.get(t)??`Device ${t}`,pipeline:nt,decoder:nt,audio:nt};return e.set(t,r),r};for(let i of y??[]){let a=n(i.deviceId);e.set(i.deviceId,{...a,pipeline:{active:t===`cluster`?!0:i.agentNodeId===r,pinned:i.pinned,nodeId:i.agentNodeId,reason:i.reason??``}})}for(let i of b??[]){let a=n(i.deviceId);e.set(i.deviceId,{...a,decoder:{active:t===`cluster`?!0:i.decoderNodeId===r,pinned:i.pinned,nodeId:i.decoderNodeId,reason:i.reason??``}})}for(let i of x??[]){let a=n(i.deviceId);e.set(i.deviceId,{...a,audio:{active:t===`cluster`?!0:i.nodeId===r,pinned:i.pinned,nodeId:i.nodeId,reason:`capacity`}})}let i=[...e.values()];return t===`agent`&&(i=i.filter(e=>e.pipeline.active||e.decoder.active||e.audio.active)),i.sort((e,t)=>e.deviceId-t.deviceId),i},[y,b,x,T,t,r]),D=L(()=>(C??[]).filter(e=>e.isOnline).map(e=>({id:e.id,name:e.name})),[C]),O=()=>{s.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getPipelineAssignments`]]}),s.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getDecoderAssignments`]]}),s.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getAudioAssignments`]]})},A=m({onSuccess:O}),ee=k({onSuccess:O}),te=i({onSuccess:O}),ne=e({onSuccess:O}),j=a({onSuccess:O}),M=g({onSuccess:O}),N=(e,t,n)=>{t===`pipeline`?A.mutate({deviceId:e,agentNodeId:n}):t===`decoder`?te.mutate({deviceId:e,nodeId:n}):j.mutate({deviceId:e,nodeId:n}),l(null)},P=(e,t)=>{t===`pipeline`?ee.mutate({deviceId:e}):t===`decoder`?ne.mutate({deviceId:e}):M.mutate({deviceId:e}),l(null)};return z(`div`,{className:`rounded-lg border border-border overflow-x-auto`,children:V(`table`,{className:`w-full text-xs min-w-[640px]`,children:[z(`thead`,{className:`bg-surface`,children:V(`tr`,{className:`text-foreground-subtle text-[10px] uppercase tracking-wider`,children:[!o&&z(`th`,{className:`w-6`}),z(`th`,{className:`text-left px-3 py-2 align-middle`,children:`Camera`}),z(`th`,{className:`text-left px-3 py-2 align-middle`,children:`Pipeline`}),z(`th`,{className:`text-left px-3 py-2 align-middle`,children:`Decoder`}),z(`th`,{className:`text-left px-3 py-2 align-middle`,children:`Audio`}),z(`th`,{className:`text-left px-3 py-2 align-middle`,children:`Status`})]})}),V(`tbody`,{children:[E.map(e=>{let n=p.get(e.deviceId),r=u===e.deviceId;return V(he.Fragment,{children:[V(`tr`,{className:`border-t border-border align-middle relative`,children:[!o&&z(`td`,{className:`px-2 py-2 align-middle`,children:z(`button`,{type:`button`,onClick:()=>d(r?null:e.deviceId),className:`p-1 rounded hover:bg-surface-hover text-foreground-subtle`,"aria-label":r?`Collapse broker details`:`Expand broker details`,children:z(r?Ie:Fe,{className:`h-3.5 w-3.5`})})}),V(`td`,{className:`px-3 py-2 align-middle`,children:[z(`div`,{className:`text-foreground font-medium leading-tight`,children:e.deviceName}),V(`div`,{className:`text-[10px] text-foreground-subtle leading-tight`,children:[`#`,e.deviceId]})]}),z(st,{role:`pipeline`,state:e.pipeline,mode:t,deviceId:e.deviceId,onlineNodes:D,isMenuOpen:c?.deviceId===e.deviceId&&c.role===`pipeline`,onToggleMenu:()=>l(c?.deviceId===e.deviceId&&c.role===`pipeline`?null:{deviceId:e.deviceId,role:`pipeline`}),onCloseMenu:()=>l(null),onMove:t=>N(e.deviceId,`pipeline`,t),onUnpin:()=>P(e.deviceId,`pipeline`)}),z(st,{role:`decoder`,state:e.decoder,mode:t,deviceId:e.deviceId,onlineNodes:D,isMenuOpen:c?.deviceId===e.deviceId&&c.role===`decoder`,onToggleMenu:()=>l(c?.deviceId===e.deviceId&&c.role===`decoder`?null:{deviceId:e.deviceId,role:`decoder`}),onCloseMenu:()=>l(null),onMove:t=>N(e.deviceId,`decoder`,t),onUnpin:()=>P(e.deviceId,`decoder`)}),z(st,{role:`audio`,state:e.audio,mode:t,deviceId:e.deviceId,onlineNodes:D,isMenuOpen:c?.deviceId===e.deviceId&&c.role===`audio`,onToggleMenu:()=>l(c?.deviceId===e.deviceId&&c.role===`audio`?null:{deviceId:e.deviceId,role:`audio`}),onCloseMenu:()=>l(null),onMove:t=>N(e.deviceId,`audio`,t),onUnpin:()=>P(e.deviceId,`audio`)}),z(`td`,{className:`px-3 py-2 align-middle`,children:z(ut,{snap:n})})]}),r&&!o&&V(`tr`,{className:`bg-surface/50`,children:[z(`td`,{}),z(`td`,{colSpan:5,className:`px-3 py-2`,children:z(se,{widgetId:`stream-broker/stream-broker-panel`,host:`device-tab`,deviceId:e.deviceId,instanceId:`pipeline-row/${e.deviceId}`,config:{variant:`compact`,title:`Stream brokers & clients`}})})]})]},e.deviceId)}),E.length===0&&z(`tr`,{children:z(`td`,{colSpan:o?5:6,className:`px-3 py-4 text-center text-foreground-subtle text-[11px]`,children:t===`agent`?`No cameras assigned to this node`:`No cameras currently assigned`})})]})]})})}function st({role:e,state:t,mode:n,onlineNodes:r,isMenuOpen:i,onToggleMenu:a,onCloseMenu:o,onMove:s,onUnpin:c}){let l=it[e],u=r.filter(e=>e.id!==(t.nodeId??``)),d=(t.active||n===`cluster`)&&(u.length>0||t.pinned);return V(`td`,{className:`px-3 py-2 align-middle relative`,children:[V(`div`,{className:`flex items-center gap-2`,children:[z(n===`agent`?ct:lt,{state:t,Icon:l}),z(`div`,{className:`ml-auto`,children:d&&z(`button`,{type:`button`,onClick:a,className:`p-1 rounded hover:bg-surface-hover`,"aria-label":`${at[e]} actions`,children:z(Ye,{className:`h-3 w-3 text-foreground-subtle`})})})]}),i&&d&&z(dt,{title:at[e],targets:u,pinned:t.pinned,onMove:s,onUnpin:c,onClose:o})]})}function ct({state:e,Icon:t}){return V(`div`,{className:`flex items-center gap-1.5`,children:[z(e.active?je:Me,{className:`h-3.5 w-3.5 ${e.active?`text-success`:`text-foreground-subtle/50`}`}),z(t,{className:`h-3 w-3 ${e.active?`text-foreground-subtle`:`text-foreground-subtle/40`}`}),e.pinned&&z(Qe,{className:`h-2.5 w-2.5 text-amber-400`})]})}function lt({state:e,Icon:t}){return!e.active||!e.nodeId?V(`div`,{className:`flex items-center gap-1.5 text-foreground-subtle/60`,children:[z(t,{className:`h-3 w-3`}),z(`span`,{className:`text-[10px] italic`,children:`—`})]}):V(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[z(t,{className:`h-3 w-3 text-foreground-subtle shrink-0`}),V(`div`,{className:`flex flex-col leading-tight min-w-0`,children:[z(`span`,{className:`font-mono text-[11px] text-foreground truncate`,children:e.nodeId}),z(`span`,{className:`flex items-center gap-1 text-[10px]`,children:e.pinned?V(`span`,{className:`inline-flex items-center gap-0.5 text-amber-400`,children:[z(Qe,{className:`h-2.5 w-2.5`}),` manual`]}):V(`span`,{className:`text-foreground-subtle truncate`,children:[`auto · `,e.reason||`capacity`]})})]})]})}function ut({snap:e}){if(!e)return z(`span`,{className:`text-[10px] text-foreground-subtle italic`,children:`—`});let{phase:t,actualFps:n,avgInferenceTimeMs:r,queueDepth:i,configuredFps:a}=e.metrics,o=ae(t);return V(`div`,{className:`flex flex-col gap-0.5 font-mono text-[10px] tabular-nums leading-tight`,children:[V(`span`,{className:`inline-flex items-center gap-1 ${o.textColor}`,children:[z(E,{phase:t,className:`h-2.5 w-2.5`}),z(`span`,{className:`font-semibold uppercase tracking-wider`,children:o.label})]}),V(`span`,{className:`text-foreground-subtle`,children:[z(`span`,{className:`text-foreground`,children:n.toFixed(1)}),V(`span`,{children:[`/`,a.toFixed(0),` fps`]})]}),V(`span`,{className:`text-foreground-subtle`,children:[z(`span`,{className:`text-foreground`,children:r.toFixed(0)}),z(`span`,{children:` ms`}),i>0&&V(`span`,{className:`text-warning ml-1`,children:[`q`,i]})]})]})}function dt({title:e,targets:t,pinned:n,onMove:r,onUnpin:i,onClose:a}){let o=pe(null);return I(()=>{let e=e=>{o.current?.contains(e.target)||a()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[a]),V(`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:[z(`div`,{className:`px-3 py-1 text-[9px] uppercase tracking-wider text-foreground-subtle border-b border-border`,children:e}),t.length>0&&z(`div`,{className:`py-1`,children:t.map(e=>V(`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&&V(`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&&z(`div`,{className:`px-3 py-1.5 text-[10px] text-foreground-subtle italic`,children:`Already auto · no other nodes online`})]})}function ft({nodeId:e,refreshToken:t}){return V(`div`,{className:`space-y-6`,children:[z(tt,{refreshToken:t,nodeId:e}),V(`div`,{children:[z(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Cameras on this node`}),V(`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.`]})]}),z(ot,{mode:`agent`,nodeId:e,compact:!0})]})}R();function pt(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:n}){let i=B(),a=r({onSettled:()=>{i.invalidateQueries({queryKey:[`pipelineExecutor`,`listLoadedEngines`]})}}),{data:o}=ce({nodeId:e}),s=de(`pipeline.engine-metrics-snapshot`,t=>t.nodeId===e)?.engines??o??null,c=s===null;q([`pipelineRunner`,`getLocalCameras`],[`pipeline.camera-assigned`,`pipeline.camera-unassigned`]);let{data:l}=P({nodeId:e}),{values:u}=t(`pipeline.camera-metrics-snapshot`,e=>e.deviceId,t=>t.nodeId===e),d=L(()=>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?`)||a.mutate({nodeId:e,engine:t,force:n.length>0})};return V(`div`,{className:`space-y-6`,children:[V(`div`,{children:[z(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Inference engines on this node`}),V(`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.`]})]}),z(`div`,{className:`rounded-lg border border-border overflow-x-auto`,children:V(`table`,{className:`w-full text-xs min-w-[640px]`,children:[z(`thead`,{className:`bg-surface`,children:V(`tr`,{className:`text-foreground-subtle text-[10px] uppercase tracking-wider`,children:[z(`th`,{className:`text-left px-3 py-2 whitespace-nowrap`,children:`Kind`}),z(`th`,{className:`text-left px-3 py-2 whitespace-nowrap`,children:`Runtime / Backend / Device`}),z(`th`,{className:`text-left px-3 py-2`,children:`Models`}),z(`th`,{className:`text-right px-3 py-2 whitespace-nowrap`,children:`Pool PID`}),z(`th`,{className:`text-right px-3 py-2 whitespace-nowrap`,children:`Auto-kill`}),z(`th`,{className:`text-right px-3 py-2 whitespace-nowrap`,children:`In use`}),z(`th`,{className:`w-20`})]})}),V(`tbody`,{children:[c&&z(`tr`,{children:z(`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`;return V(`tr`,{className:`border-t border-border ${t?`bg-amber-500/5`:``}`,children:[z(`td`,{className:`px-3 py-2`,children:V(`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`:`bg-success/15 text-success`}`,children:[z(t?Ze:G,{className:`h-3 w-3`}),t?`warm`:`runtime`]})}),z(`td`,{className:`px-3 py-2`,children:V(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-sky-400`,children:[z(Te,{className:`h-3 w-3`}),e.engine.runtime,`/`,e.engine.backend,e.engine.device?`/${e.engine.device}`:``,e.engine.format?` · ${e.engine.format}`:``]})}),z(`td`,{className:`px-3 py-2`,children:e.modelsLoaded.length===0?z(`span`,{className:`text-foreground-subtle text-[11px]`,children:`—`}):z(`div`,{className:`flex flex-wrap gap-1`,children:e.modelsLoaded.map(e=>z(`span`,{className:`inline-block rounded bg-surface px-1.5 py-0.5 text-[10px] font-mono text-foreground-subtle`,children:e},e))})}),z(`td`,{className:`px-3 py-2 text-right font-mono text-foreground`,children:e.poolPid??`—`}),z(`td`,{className:`px-3 py-2 text-right text-[11px]`,children:e.idleMs!==null&&e.idleTtlMs!==null?z(`span`,{className:`text-foreground-subtle`,children:pt(e.idleMs,e.idleTtlMs)}):z(`span`,{className:`text-foreground-subtle/50`,children:`never`})}),z(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t?`—`:(l??[]).length}),z(`td`,{className:`px-3 py-2 text-right`,children:V(`button`,{type:`button`,disabled:a.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:[z(Be,{className:`h-3 w-3`}),`Kill`]})})]},e.engineKey)}),!c&&(s??[]).length===0&&z(`tr`,{children:z(`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.`})})]})]})}),V(`div`,{className:`text-[10px] text-foreground-subtle leading-relaxed`,children:[z(`strong`,{className:`text-foreground`,children:`runtime`}),`: main camera-serving engine; never auto-killed while cameras attached. `,z(`strong`,{className:`text-foreground`,children:`warm`}),`: benchmark/test override held in cache for fast re-use; auto-disposed after the idle TTL.`]}),a.isError&&V(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-[11px] text-destructive`,children:[`Kill failed:`,` `,a.error instanceof Error?a.error.message:`unknown`]})]})}R();var ht=new Set(_e);function gt(e){return ht.has(e)}function _t(e,t,n){return`${e}/${t}/${n}`}function vt(e){return{coreml:`CoreML`,openvino:`OpenVINO`,onnx:`ONNX`}[e.format]??e.format.toUpperCase()}function yt(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 Z(e){return e.format}function bt(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 xt({addonId:e,model:t,format:n,isActive:r,progress:i,errorMsg:a,onDownload:o,onDelete:s}){let c=t.formats[n];return c?V(`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:[z(`div`,{className:`h-2 w-2 rounded-full shrink-0 ${c.downloaded?`bg-success`:`bg-foreground-subtle/30`}`}),V(`div`,{className:`flex-1 min-w-0`,children:[V(`div`,{className:`flex items-center gap-2`,children:[z(`span`,{className:`text-sm font-medium text-foreground`,children:t.name}),V(`span`,{className:`text-[10px] text-foreground-subtle font-mono`,children:[`(`,t.id,`)`]})]}),i&&i.progress>=0&&i.progress<100&&V(`div`,{className:`mt-1.5 flex items-center gap-2 max-w-xs`,children:[z(`div`,{className:`flex-1 h-1 bg-surface-hover rounded-full overflow-hidden`,children:z(`div`,{className:`bg-primary h-full rounded-full transition-all duration-300`,style:{width:`${i.progress}%`}})}),V(`span`,{className:`text-[9px] text-primary font-mono tabular-nums shrink-0`,children:[Math.round(i.progress),`%`]})]})]}),z(`span`,{className:`text-xs text-foreground-subtle tabular-nums shrink-0`,children:We(c.sizeMB)}),a&&V(`span`,{className:`flex items-center gap-1 text-[10px] text-danger max-w-[160px] truncate shrink-0`,title:a,children:[z(ze,{className:`h-3 w-3 shrink-0`}),a]}),c.downloaded?V(`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?z(K,{className:`h-3 w-3 animate-spin`}):z(Be,{className:`h-3 w-3`}),r?`Deleting...`:`Delete`]}):V(`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?z(K,{className:`h-3 w-3 animate-spin`}):z(ve,{className:`h-3 w-3`}),r?`Downloading...`:`Download`]})]}):null}function St({engines:e,activeEngine:t,viewEngine:n,onSelect:r}){let[i,a]=F(!1);return V(`div`,{className:`relative`,children:[V(`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:[z(G,{className:`h-4 w-4 text-primary shrink-0`}),V(`div`,{className:`flex-1 min-w-0`,children:[V(`div`,{className:`flex items-center gap-2`,children:[z(`span`,{className:`text-sm font-medium text-foreground`,children:vt(n)}),Z(n)===Z(t)&&z(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded-full bg-success/10 text-success font-medium`,children:`Active`})]}),z(`div`,{className:`text-[10px] text-foreground-subtle`,children:yt(n)})]}),z(Ie,{className:`h-4 w-4 text-foreground-subtle transition-transform ${i?`rotate-180`:``}`})]}),i&&z(`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=Z(e)===Z(n),o=Z(e)===Z(t);return V(`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:[z(G,{className:`h-4 w-4 shrink-0 ${i?`text-primary`:`text-foreground-subtle`}`}),V(`div`,{className:`flex-1`,children:[V(`div`,{className:`flex items-center gap-2`,children:[z(`span`,{className:`text-sm font-medium ${i?`text-primary`:`text-foreground`}`,children:vt(e)}),o&&z(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded-full bg-success/10 text-success font-medium`,children:`Active`})]}),z(`div`,{className:`text-[10px] text-foreground-subtle`,children:yt(e)})]}),i&&z(Ne,{className:`h-4 w-4 text-primary shrink-0`})]},Z(e))})})]})}function Ct({embedded:e=!1,nodeId:t}={}){let n=B(),r=t??`hub`,[i,a]=F(null),[o,s]=F(new Set),[c,l]=F(new Map),[u,d]=F(new Map),[f,p]=F(``),{data:m=[]}=O({nodeId:r}),h=m.filter((e,t,n)=>n.findIndex(t=>t.format===e.format)===t),{data:g}=y({nodeId:r}),_=g,{data:v,isLoading:b}=le({nodeId:r}),x=ue(),C=oe();S(`model.download.progress`,e=>{let t=e.data,r=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;r===void 0||i===void 0||(l(e=>{let t=new Map(e);return i===100||i===-1?t.delete(r):t.set(r,{modelId:r,progress:i,totalMB:a}),t}),i===100&&n.invalidateQueries({queryKey:[[`pipelineExecutor`,`getSchema`]]}))});let w=_??{runtime:`node`,backend:`cpu`,format:`onnx`},T=h.find(e=>e.format===i)??w,E=T.format,D=v?.slots??[],k=D.map(e=>({...e,addons:e.addons.map(e=>({...e,models:e.models.filter(e=>e.formats[E]!==void 0)})).filter(e=>e.models.length>0)})).filter(e=>e.addons.length>0),A=bt(k,E),ee=fe(async(e,t,i)=>{if(!gt(i))return;let a=_t(e,t,i);s(e=>new Set([...e,a])),d(e=>{let t=new Map(e);return t.delete(a),t});try{await x.mutateAsync({addonId:e,modelId:t,format:i,nodeId:r}),n.invalidateQueries({queryKey:[[`pipelineExecutor`,`getSchema`]]})}catch(e){d(t=>new Map([...t,[a,e instanceof Error?e.message:`Download failed`]]))}finally{s(e=>{let t=new Set(e);return t.delete(a),t})}},[x,n,r]),te=fe(async(e,t,i)=>{if(!gt(i))return;let a=_t(e,t,i);s(e=>new Set([...e,a])),d(e=>{let t=new Map(e);return t.delete(a),t});try{await C.mutateAsync({addonId:e,modelId:t,format:i,nodeId:r}),n.invalidateQueries({queryKey:[[`pipelineExecutor`,`getSchema`]]})}catch(e){d(t=>new Map([...t,[a,e instanceof Error?e.message:`Delete failed`]]))}finally{s(e=>{let t=new Set(e);return t.delete(a),t})}},[C,n,r]),ne=fe(e=>{a(e.format)},[]),j=f.trim()?k.map(e=>({...e,addons:e.addons.map(e=>({...e,models:e.models.filter(t=>t.name.toLowerCase().includes(f.toLowerCase())||t.id.toLowerCase().includes(f.toLowerCase())||e.name.toLowerCase().includes(f.toLowerCase()))})).filter(e=>e.models.length>0)})).filter(e=>e.addons.length>0):k,M=V(H,{children:[b&&z(`div`,{className:`flex items-center justify-center py-16`,children:z(K,{className:`h-5 w-5 animate-spin text-foreground-subtle`})}),!b&&D.length===0&&V(`div`,{className:`flex flex-col items-center justify-center py-16 text-foreground-subtle`,children:[z(ye,{className:`h-8 w-8 mb-3 opacity-30`}),z(`span`,{className:`text-sm`,children:`No pipeline steps available`}),z(`span`,{className:`text-xs mt-1`,children:`Configure the detection pipeline to see available models.`})]}),!b&&D.length>0&&V(H,{children:[z(St,{engines:h,activeEngine:w,viewEngine:T,onSelect:ne}),V(`div`,{className:`flex items-center gap-4 text-xs text-foreground-subtle`,children:[V(`span`,{children:[z(`span`,{className:`font-semibold text-foreground tabular-nums`,children:A.total}),z(`span`,{className:`ml-1`,children:`compatible models`})]}),z(`span`,{className:`text-border`,children:`|`}),V(`span`,{children:[z(`span`,{className:`font-semibold text-success tabular-nums`,children:A.downloaded}),z(`span`,{className:`ml-1`,children:`downloaded`})]}),z(`span`,{className:`text-border`,children:`|`}),V(`span`,{className:`tabular-nums`,children:[We(A.downloadedSizeMB),z(`span`,{className:`ml-1`,children:`on disk`})]})]}),A.total>5&&V(`div`,{className:`relative`,children:[z(ke,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-foreground-subtle`}),z(`input`,{type:`text`,value:f,onChange:e=>p(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`})]}),j.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[E]?.downloaded).length,0);return V(`div`,{children:[V(`div`,{className:`flex items-center gap-2 mb-2`,children:[z(`h2`,{className:`text-sm font-semibold text-foreground`,children:e.label}),z(`div`,{className:`flex-1 h-px bg-border`}),V(`span`,{className:`text-[10px] text-foreground-subtle tabular-nums`,children:[n,`/`,t]})]}),z(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:e.addons.map(e=>e.models.map(t=>{let n=_t(e.id,t.id,E);return z(xt,{addonId:e.id,model:t,format:E,isActive:o.has(n),progress:c.get(t.id),errorMsg:u.get(n),onDownload:()=>ee(e.id,t.id,E),onDelete:()=>te(e.id,t.id,E)},`${e.id}/${t.id}`)}))})]},e.id)}),j.length===0&&z(`div`,{className:`text-center py-8 text-sm text-foreground-subtle`,children:f.trim()?V(H,{children:[`No models matching “`,f,`”`]}):V(H,{children:[`No models available for `,vt(T),` format`]})})]})]});return e?z(`div`,{className:`space-y-4`,children:M}):z(He,{children:M})}function wt({nodeId:e,refreshToken:t}){return z(Ct,{embedded:!0,nodeId:e})}R();function Tt({nodeId:e,title:t}){let{data:r}=Ue(),{data:i}=n(void 0),a=L(()=>{let e=new Map;for(let t of r??[])e.set(t.id,t.name);return e},[r]),o=L(()=>{if(!e)return null;let t=new Set;for(let n of i??[])n.agentNodeId===e&&t.add(n.deviceId);return t},[e,i]),[s,c]=F(new Map);S(`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}))}),I(()=>{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=L(()=>{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?V(`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`]}):V(`div`,{className:`rounded-md border border-border bg-surface px-3 py-2`,children:[V(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[z(`span`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle`,children:t??`Cameras`}),z(`span`,{className:`text-[10px] text-foreground-subtle`,children:l.length})]}),z(`div`,{className:`flex flex-wrap gap-1.5`,children:l.map(e=>{let t=a.get(e.deviceId)??`#${e.deviceId}`,n=ae(e.metrics.phase);return V(`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:[z(E,{phase:e.metrics.phase,className:`h-2.5 w-2.5`}),z(`span`,{className:`font-medium text-foreground/90 max-w-[120px] truncate`,children:t}),z(`span`,{className:`font-mono tabular-nums`,children:e.metrics.actualFps.toFixed(1)}),z(`span`,{className:`opacity-60`,children:`fps`})]},e.deviceId)})})]})}R();function Et(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 Dt({nodeId:e,refreshToken:t}){let n=B(),[r,i]=F(null),[a,o]=F(null),s=le({nodeId:e},{refetchOnMount:`always`}),c=ee({agentNodeId:e},{refetchOnMount:`always`}),l=()=>{n.invalidateQueries({queryKey:[[`addonSettings`]]}),n.invalidateQueries({queryKey:[[`pipelineOrchestrator`]]}),n.invalidateQueries({queryKey:[[`pipelineExecutor`]]})},f=d({onSuccess:l}),p=N({onSuccess:l}),m=s.data??null,h=c.data,g=m?.selectedEngine.format??`coreml`,_=L(()=>m?u(m):[],[m]),v=L(()=>[{agentNodeId:e,engineLabel:g}],[e,g]),y=(e,t)=>{let n=h?.addonDefaults[e];return!Et(m,e)?.models.some(e=>!!e.formats[g])||!n?{kind:`na`}:n.enabled?{kind:`enabled`,modelId:n.modelId}:{kind:`disabled`}},x=r&&m?Et(m,r.addonId):null,S=t=>{let n=h?.addonDefaults[t]??null;i({addonId:t,agentNodeId:e}),o(n)},C=(t,n)=>{if(!h)return;let r=h.addonDefaults[t],i=Et(m,t);if(!r&&!i)return;let a={enabled:n,modelId:r?.modelId??i?.defaultModelId??``,settings:r?.settings??{}};f.mutate({agentNodeId:e,defaults:{...h.addonDefaults,[t]:a}})},T=()=>{i(null),o(null)},E=()=>{!a||!r||!h||f.mutate({agentNodeId:e,defaults:{...h.addonDefaults,[r.addonId]:a}},{onSuccess:T})};if(s.isLoading||c.isLoading)return z(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading pipeline…`});if(s.error)return V(`div`,{className:`text-xs text-red-400`,children:[`Failed to load catalog: `,String(s.error)]});if(!m)return z(`div`,{className:`text-xs text-foreground-subtle`,children:`Catalog unavailable for this node (runner offline?).`});let D=r!==null&&x!==null&&a!==null,O=c.data?.maxCameras??null;return V(`div`,{className:`relative h-full w-full space-y-3`,children:[z(Tt,{nodeId:e}),V(`div`,{className:`flex items-center gap-3 text-xs text-foreground`,children:[z(`label`,{htmlFor:`max-cameras-${e}`,className:`font-medium text-muted-foreground whitespace-nowrap`,children:`Max cameras (0 = unlimited)`}),z(`input`,{id:`max-cameras-${e}`,type:`number`,min:0,step:1,defaultValue:O??0,onBlur:t=>{let n=t.target.value.trim(),r=n===``?0:Number.parseInt(n,10),i=Number.isNaN(r)||r<=0?null:r;p.mutate({agentNodeId:e,maxCameras:i})},disabled:p.isPending,className:`w-20 rounded border border-border bg-surface px-2 py-0.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary disabled:opacity-50`},O??`unlimited`),p.isPending&&z(`span`,{className:`text-[10px] text-muted-foreground animate-pulse`,children:`Saving…`}),p.isError&&V(`span`,{className:`text-[10px] text-destructive`,children:[`Save failed: `,p.error instanceof Error?p.error.message:``]})]}),z(`div`,{className:D?`pr-[360px]`:``,children:_.length>0?z(b,{tree:_,agents:v,getCellState:y,onCellClick:S,selectedCell:r,onToggleEnabled:C}):z(`div`,{className:`text-xs text-foreground-subtle`,children:`Catalog empty.`})}),z(M,{open:D,onClose:T,title:x?.name??``,subtitle:r?`${r.agentNodeId} · ${g}`:``,footer:V(H,{children:[z(`button`,{type:`button`,className:`px-3 py-1 text-xs border border-border rounded bg-surface hover:bg-muted`,onClick:T,children:`Cancel`}),z(`button`,{type:`button`,disabled:!a||!r||f.isPending,className:`px-3 py-1 text-xs bg-primary text-primary-foreground rounded disabled:opacity-50`,onClick:E,children:f.isPending?`Saving…`:`Save`})]}),children:x&&a&&r&&z(w,{mode:`agent`,addon:x,agentDefault:a,agentNodeId:r.agentNodeId,engineFormat:g,onChangeAgentConfig:e=>o(e)})})]})}var Ot=[`detection-pipeline`,`decoder-nodeav`,`audio-analyzer`,`pipeline-runner`];function kt({nodeId:e,refreshToken:t}){return V(`div`,{className:`flex flex-col h-full`,children:[z(et,{nodeId:e,refreshToken:t}),z(`div`,{className:`flex-1 min-h-0 overflow-y-auto p-6`,children:z(Ge,{nodeId:e,addonIds:Ot,level:`global`,extraTabs:[{id:`assignments`,label:`Assignments`,order:-10,content:z(ft,{nodeId:e,refreshToken:t})},{id:`tree`,label:`Pipeline`,order:39,content:z(Dt,{nodeId:e,refreshToken:t})},{id:`engines`,label:`Warm instances`,order:180,content:z(mt,{nodeId:e,refreshToken:t})},{id:`models`,label:`Models`,order:200,content:z(wt,{nodeId:e,refreshToken:t})}]})})]})}function At({refreshToken:e}){let t=B(),n=x({onSuccess:()=>{t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getPipelineAssignments`]]}),t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getDecoderAssignments`]]}),t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getAudioAssignments`]]})}});return V(`div`,{className:`space-y-6`,children:[z(tt,{refreshToken:e}),V(`div`,{className:`flex flex-col gap-3 @md/clustertab:flex-row @md/clustertab:items-center @md/clustertab:justify-between`,children:[V(`div`,{className:`min-w-0`,children:[z(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Placement matrix`}),z(`p`,{className:`text-[11px] text-foreground-subtle`,children:`Pipeline · decoder · audio assignments per camera. Click the kebab to pin / unpin / move any role; expand the chevron for the per-camera broker drill-down.`})]}),V(`button`,{type:`button`,onClick:()=>n.mutate(void 0),disabled:n.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:[z(Te,{className:`h-3.5 w-3.5`}),n.isPending?`Rebalancing…`:`Rebalance pipelines`]})]}),z(ot,{mode:`cluster`})]})}var jt=[`pipeline-orchestrator`];function Mt({refreshToken:e}){return z(`div`,{className:`space-y-4 max-w-3xl`,children:z(Ge,{nodeId:`hub`,addonIds:jt,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.`})})}R();function Nt({refreshToken:e}){let t=B(),{data:n,isLoading:r}=s(),[i,a]=F(null),[o,c]=F(``),[l,u]=F(``),d=()=>{t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`listTemplates`]]})},f=ie({onSuccess:()=>{a(null),d()}}),p=te({onSuccess:d}),m=e=>{a(e.id),c(e.name),u(e.description??``)},h=()=>{a(null),c(``),u(``)},g=()=>{if(!i)return;let e=l.trim();f.mutate({id:i,name:o.trim()||`Untitled`,...e?{description:e}:{}})};if(r)return z(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading templates…`});let _=[...n??[]].toSorted((e,t)=>e.name.localeCompare(t.name));return z(`div`,{className:`space-y-6 max-w-4xl`,children:V(`section`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[V(`div`,{className:`border-b border-border px-4 py-3 flex items-center justify-between`,children:[V(`div`,{children:[z(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Templates`}),z(`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.`})]}),V(`div`,{className:`text-[11px] text-foreground-subtle`,children:[_.length,` template`,_.length===1?``:`s`]})]}),_.length===0?V(`div`,{className:`px-4 py-8 text-xs text-foreground-subtle flex flex-col items-center gap-2`,children:[z(De,{className:`h-6 w-6 opacity-40`}),z(`div`,{children:`No templates yet. Create one from a device Pipeline tab ("Save as template").`})]}):z(`ul`,{className:`divide-y divide-border`,children:_.map(e=>{let t=i===e.id;return z(`li`,{className:`px-4 py-3 text-xs`,children:V(`div`,{className:`flex items-start gap-3`,children:[z(`div`,{className:`flex-1 min-w-0`,children:t?V(`div`,{className:`space-y-2`,children:[z(`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=>c(e.target.value),placeholder:`Template name`,autoFocus:!0}),z(`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:l,onChange:e=>u(e.target.value),placeholder:`Description (optional)`})]}):V(H,{children:[z(`div`,{className:`font-medium text-foreground`,children:e.name}),e.description&&z(`div`,{className:`text-foreground-subtle mt-0.5`,children:e.description}),V(`div`,{className:`mt-1 font-mono text-[10px] text-foreground-subtle`,children:[`engine `,e.config.engine.runtime,`/`,e.config.engine.backend,` ·`,` `,e.config.steps.length,` step(s)`,e.config.audio?.enabled?` · audio`:``,V(`span`,{className:`ml-2`,children:[`updated `,new Date(e.updatedAt).toLocaleString()]})]})]})}),z(`div`,{className:`flex items-center gap-1 shrink-0`,children:t?V(H,{children:[V(`button`,{type:`button`,onClick:g,disabled:f.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:[z(Pe,{className:`h-3 w-3`}),`Save`]}),V(`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:[z(Re,{className:`h-3 w-3`}),`Cancel`]})]}):V(H,{children:[z(`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:z(Ee,{className:`h-3 w-3`})}),z(`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:z(Be,{className:`h-3 w-3`})})]})})]})},e.id)})})]})})}R();function Pt(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 Ft({nodeId:e,refreshToken:t}){let n=B(),r=ge().trpcClient,[i,a]=F(null),[o,s]=F(null),c=C(void 0,{refetchOnMount:`always`});q([`nodes`,`topology`],[`agent.online`,`agent.offline`,`agent.unregistered`,`addon.installed`,`addon.uninstalled`,`addon.updated`]);let l=A(void 0,{refetchOnMount:`always`}),f=L(()=>{let e=new Set;for(let t of l.data??[])t.isOnline&&e.add(t.id);return e},[l.data]),p=le({nodeId:e},{refetchOnMount:`always`}),m=L(()=>(c.data??[]).filter(e=>f.has(e.nodeId)).map(e=>e.nodeId),[c.data,f]),h=me({enabled:m.length>0,queryKey:[[`pipelineExecutor`,`getSchema`],`schema-by-agent`,m.join(`,`),t],queryFn:async()=>{let e={};for(let t of m)try{e[t]=(await r.pipelineExecutor.getSchema.query({nodeId:t})).selectedEngine.format}catch{e[t]=`coreml`}return e}}),g=d({onSuccess:()=>{n.invalidateQueries({queryKey:[[`pipelineOrchestrator`]]}),n.invalidateQueries({queryKey:[[`pipelineExecutor`]]}),n.invalidateQueries({queryKey:[[`addonSettings`]]})}}),_=L(()=>p.data?u(p.data):[],[p.data]),v=L(()=>{let e=c.data??[],t=f;return(t.size===0?[]:e.filter(e=>t.has(e.nodeId))).map(e=>{let t=h.data?.[e.nodeId];return{agentNodeId:e.nodeId,engineLabel:t??`(engine unknown)`}})},[c.data,h.data,f]),y=(e,t)=>{let n=(c.data?.find(e=>e.nodeId===t))?.settings.addonDefaults[e],r=h.data?.[t];return!Pt(p.data??null,e)?.models.some(e=>r!==void 0&&!!e.formats[r])||!n?{kind:`na`}:n.enabled?{kind:`enabled`,modelId:n.modelId}:{kind:`disabled`}},x=i?c.data?.find(e=>e.nodeId===i.agentNodeId)??null:null,S=i&&p.data?Pt(p.data,i.addonId):null,T=i?h.data?.[i.agentNodeId]??`coreml`:`coreml`,E=()=>{a(null),s(null)},D=(e,t)=>{let n=(c.data?.find(e=>e.nodeId===t))?.settings.addonDefaults[e]??null;a({addonId:e,agentNodeId:t}),s(n)},O=()=>{!o||!i||!x||g.mutate({agentNodeId:i.agentNodeId,defaults:{...x.settings.addonDefaults,[i.addonId]:o}},{onSuccess:E})};if(c.isLoading||p.isLoading)return z(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading agents…`});if(!p.data)return V(`div`,{className:`text-xs text-foreground-subtle`,children:[`Catalog unavailable for `,e,`.`]});let k=i!==null&&S!==null&&o!==null;return V(`div`,{className:`relative h-full w-full space-y-3`,children:[z(Tt,{title:`Cluster cameras`}),z(`div`,{className:k?`pr-[360px]`:``,children:_.length>0&&v.length>0?z(b,{tree:_,agents:v,getCellState:y,onCellClick:D,selectedCell:i}):z(`div`,{className:`text-xs text-foreground-subtle`,children:`No agents or catalog empty.`})}),z(M,{open:k,onClose:E,title:S?.name??``,subtitle:i?`${i.agentNodeId} · ${T}`:``,footer:V(H,{children:[z(`button`,{type:`button`,className:`px-3 py-1 text-xs border border-border rounded bg-surface hover:bg-muted`,onClick:E,children:`Cancel`}),z(`button`,{type:`button`,disabled:!o||!i||g.isPending,className:`px-3 py-1 text-xs bg-primary text-primary-foreground rounded disabled:opacity-50`,onClick:O,children:g.isPending?`Saving…`:`Save`})]}),children:S&&o&&i&&z(w,{mode:`agent`,addon:S,agentDefault:o,agentNodeId:i.agentNodeId,engineFormat:T,onChangeAgentConfig:e=>s(e)})})]})}R();function It({types:e}){let t=B(),n=h(),{data:r}=re({}),i=j(),a=L(()=>i.data??[],[i.data]),[o,s]=F(null),[c,l]=F(null),u=()=>{t.invalidateQueries({queryKey:[[`storage`,`listLocations`]]})},d=ne({onSuccess:u}),f=D({onSuccess:u}),p=L(()=>{let e=new Map;for(let t of r??[]){let n=e.get(t.type);n?n.push(t):e.set(t.type,[t])}return e},[r]),m=e=>{e.isDefault||d.mutate({id:e.id,type:e.type,providerId:e.providerId,displayName:e.displayName,config:e.config,isDefault:!0})},g=async e=>{if(e.isDefault){await n({title:`Cannot delete default location`,message:`"${e.displayName}" is the default for type "${e.type}". Mark another as default first.`,confirmLabel:`OK`,variant:`warning`});return}await n({title:`Delete location "${e.displayName}"?`,message:`Removes the record; files on disk are untouched.`,confirmLabel:`Delete`,variant:`danger`})&&f.mutate({id:e.id})},_=e.map(e=>a.find(t=>t.id===e)).filter(e=>e!==void 0);return V(`div`,{className:`space-y-3`,children:[_.length===0?z(`p`,{className:`text-[11px] text-foreground-subtle italic`,children:`No storage locations declared for this purpose.`}):_.map(e=>z(xe,{type:e.id,displayName:e.displayName,description:e.description,cardinality:e.cardinality,locations:p.get(e.id)??[],onAdd:e=>s(e),onEdit:e=>l(e),onDelete:e=>{g(e)},onSetDefault:e=>m(e)},e.id)),o!==null&&z(Se,{initialType:o,onClose:()=>s(null),onCreated:()=>{u(),s(null)}}),c!==null&&z(be,{location:c,onClose:()=>l(null),onSaved:()=>{u(),l(null)}})]})}R();var Lt=`pipeline-analytics`;function Rt(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 zt(){let e=B(),{data:t}=A(void 0),{data:n,isLoading:r}=l({addonId:Lt}),i=Rt(n),a=T({onSuccess:()=>{e.invalidateQueries({queryKey:[[`addonSettings`,`getGlobalSettings`]]})}}),o=L(()=>{let e=(t??[]).filter(e=>e.isOnline).map(e=>e.id);return[...new Set([`hub`,i,...e])].filter(Boolean)},[t,i]);return V(`div`,{className:`flex flex-col gap-6`,children:[V(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[z(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Post-processing node`}),z(`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.`}),V(`div`,{className:`mt-3 flex items-center gap-2`,children:[r?z(K,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):z(`select`,{value:i,onChange:e=>{e.target.value!==i&&a.mutate({addonId:Lt,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=>z(`option`,{value:e,children:e===`hub`?`hub (default)`:e},e))}),a.isPending&&z(K,{className:`h-4 w-4 animate-spin text-primary`})]})]}),V(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[z(`h3`,{className:`mb-1 text-sm font-semibold text-foreground`,children:`Events folder`}),z(`p`,{className:`mb-3 text-[11px] text-foreground-subtle`,children:`Where event crops / full frames are stored. A single folder — no collection / equal-splitting.`}),z(It,{types:[`eventMedia`]})]})]})}R();var Bt=`recorder`;function Vt(e,t,n){for(let n of e?.sections??[])for(let e of n.fields??[])if(e.key===t&&typeof e.value==`string`)return e.value;return n}function Ht(){let e=B(),{data:t}=A(void 0),{data:n,isLoading:r}=l({addonId:Bt}),i=Vt(n,`recordingNodeId`,`hub`),a=T({onSuccess:()=>{e.invalidateQueries({queryKey:[[`addonSettings`,`getGlobalSettings`]]})}}),o=L(()=>{let e=(t??[]).filter(e=>e.isOnline).map(e=>e.id);return[...new Set([`hub`,i,...e])].filter(Boolean)},[t,i]);return V(`div`,{className:`flex flex-col gap-6`,children:[V(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[z(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Recording node`}),z(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`The single node that records (continuous & events) and serves playback. Every other node stays inert — no multi-node balancing. Takes effect on addon restart.`}),V(`div`,{className:`mt-3 flex items-center gap-2`,children:[r?z(K,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):z(`select`,{value:i,onChange:e=>{e.target.value!==i&&a.mutate({addonId:Bt,patch:{recordingNodeId: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=>z(`option`,{value:e,children:e===`hub`?`hub (default)`:e},e))}),a.isPending&&z(K,{className:`h-4 w-4 animate-spin text-primary`})]}),i!==`hub`&&V(`p`,{className:`mt-2 text-[11px] text-amber-500`,children:[`The stream-broker is hub-only — an agent recorder pulls streams from the hub over the network. The hub's RTSP restream port must be reachable from`,` `,z(`span`,{className:`font-medium`,children:i}),`. If the auto-derived host doesn't work, set the recorder's`,z(`span`,{className:`font-medium`,children:` recordingHubHostname`}),` global setting.`]})]}),V(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[z(`h3`,{className:`mb-1 text-sm font-semibold text-foreground`,children:`Recordings folders`}),z(`p`,{className:`mb-3 text-[11px] text-foreground-subtle`,children:`Where recordings are stored. Multi-location collections — segments are split across the locations of a type. Add a location to grow capacity; mark one default per type.`}),z(It,{types:[`recordings`,`recordingsLow`]})]})]})}R();var Ut=[{id:`assignments`,label:`Assignments`},{id:`pipeline`,label:`Pipeline`},{id:`events`,label:`Events`},{id:`recording`,label:`Recording`},{id:`settings`,label:`Settings`},{id:`templates`,label:`Templates`}];function Wt({refreshToken:e}){let[t,n]=F(`assignments`),{data:r}=A(void 0),i=r?.find(e=>e.isHub&&e.isOnline)?.id??r?.find(e=>e.isOnline)?.id??null;return V(`div`,{className:`flex flex-col h-full`,children:[V(`div`,{className:`px-4 sm:px-6 py-4 border-b border-border`,children:[z(`h2`,{className:`text-base font-semibold text-foreground`,children:`Cluster Orchestration`}),z(`div`,{className:`text-[11px] text-foreground-subtle mt-1`,children:`Assignments with live load, cluster-wide settings, pipeline template library, per-camera pipeline overrides.`})]}),z(`div`,{className:`flex items-center gap-1 px-4 sm:px-6 border-b border-border overflow-x-auto`,children:Ut.map(e=>z(`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))}),V(`div`,{className:`flex-1 min-h-0 overflow-y-auto p-4 sm:p-6 @container/clustertab`,children:[t===`assignments`&&z(At,{refreshToken:e}),t===`pipeline`&&(i?z(Ft,{nodeId:i,refreshToken:e}):z(`div`,{className:`text-xs text-foreground-subtle`,children:`No online node available — schema unreachable.`})),t===`events`&&z(zt,{}),t===`recording`&&z(Ht,{}),t===`settings`&&z(Mt,{refreshToken:e}),t===`templates`&&z(Nt,{refreshToken:e})]})]})}function Gt(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`}R();var Kt={healthy:`bg-green-500`,idle:`bg-yellow-400`,error:`bg-red-500`},qt={healthy:`Healthy`,idle:`Idle`,error:`Error`};function Jt({health:e}){return z(`span`,{className:`inline-block h-2 w-2 rounded-full shrink-0 ${Kt[e]}`,title:qt[e],"aria-label":qt[e],role:`img`})}function Yt({selectedDeviceId:e,onSelect:t}){let{data:n}=Ue(),{data:r}=c({}),i=L(()=>{let e=new Map;for(let t of r??[])e.set(t.deviceId,t);return e},[r]),a=L(()=>(n??[]).filter(e=>e.isCamera).map(e=>{let t=i.get(e.id);return{deviceId:e.id,name:e.name,health:t===void 0?`idle`:Gt(t)}}),[n,i]);return a.length===0?z(`div`,{className:`px-4 py-6 text-center text-[11px] text-foreground-subtle italic`,children:`No cameras found`}):z(`ul`,{className:`divide-y divide-border`,children:a.map(n=>{let r=n.deviceId===e;return z(`li`,{children:V(`button`,{type:`button`,onClick:()=>t(n.deviceId),className:[`w-full flex items-center gap-2.5 px-4 py-3 text-left transition-colors`,r?`bg-surface-active text-foreground`:`hover:bg-surface-hover text-foreground-subtle hover:text-foreground`].join(` `),"aria-pressed":r,children:[z(Jt,{health:n.health}),V(`span`,{className:`flex-1 min-w-0`,children:[z(`span`,{className:`block truncate text-[12px] font-medium leading-tight`,children:n.name}),V(`span`,{className:`block text-[10px] text-foreground-subtle leading-tight mt-0.5`,children:[`#`,n.deviceId]})]})]})},n.deviceId)})})}var Q={camera:0,source:200,broker:400,decoder:600,motion:800,detection:800,audio:800,recorder:800},$=120;function Xt(e,t){return e===null||t===null?!1:e!==t}function Zt(e){let t=e.profiles.reduce((e,t)=>e+t.subscribers,0),n=e.profiles.reduce((e,t)=>e+t.inFps,0),r=e.profiles.reduce((e,t)=>e+t.outFps,0);return`${t} subs · ${n.toFixed(1)}→${r.toFixed(1)} fps`}function Qt(e){return`${e.actualFps.toFixed(1)} fps · q${e.queueDepth} · ${e.avgInferenceMs.toFixed(1)}ms`}function $t(e){return`shm ${e.shm.getFrameHits+e.shm.getFrameMisses>0?Math.round(e.shm.getFrameHits/(e.shm.getFrameHits+e.shm.getFrameMisses)*100):0}% hit`}function en(e){let t=[],n=[],r={id:`camera`,kind:`camera`,nodeId:null,data:{deviceId:e.deviceId},position:{x:Q.camera,y:0}};t.push(r);let i={id:`source`,kind:`source`,nodeId:null,data:{streams:e.source.streams},position:{x:Q.source,y:0}};t.push(i),n.push({id:`camera->source`,source:`camera`,target:`source`,crossNode:!1});let a=e.broker;if(a!==null){let e={id:`broker`,kind:`broker`,nodeId:null,data:{profiles:a.profiles,webrtcSessions:a.webrtcSessions,rtspRestream:a.rtspRestream},position:{x:Q.broker,y:0}};t.push(e),n.push({id:`source->broker`,source:`source`,target:`broker`,crossNode:!1})}let o=e.decoder;if(o!==null){let r={id:`decoder`,kind:`decoder`,nodeId:o.nodeId,data:{nodeId:o.nodeId,formats:o.formats,sessionCount:o.sessionCount,shm:o.shm},position:{x:Q.decoder,y:0}};t.push(r);let i=a===null?`source`:`broker`,s=a===null?void 0:Zt(a),c=a===null?$t(o):s;n.push({id:`${i}->decoder`,source:i,target:`decoder`,crossNode:Xt(null,o.nodeId),...c===void 0?{}:{label:c}});let l=0,u=e.motion;if(u!==null){let e={id:`motion`,kind:`motion`,nodeId:null,data:{enabled:u.enabled,fps:u.fps},position:{x:Q.motion,y:l*$}};t.push(e),n.push({id:`decoder->motion`,source:`decoder`,target:`motion`,crossNode:!1}),l++}let d=e.detection;if(d!==null){let e={id:`detection`,kind:`detection`,nodeId:d.nodeId,data:{nodeId:d.nodeId,engine:d.engine,phase:d.phase,configuredFps:d.configuredFps,actualFps:d.actualFps,queueDepth:d.queueDepth,avgInferenceMs:d.avgInferenceMs,provisioning:d.provisioning},position:{x:Q.detection,y:l*$}};t.push(e),n.push({id:`decoder->detection`,source:`decoder`,target:`detection`,crossNode:Xt(o.nodeId,d.nodeId),label:Qt(d)}),l++}let f=e.audio;if(f!==null){let e={id:`audio`,kind:`audio`,nodeId:f.nodeId,data:{nodeId:f.nodeId,enabled:f.enabled},position:{x:Q.audio,y:l*$}};t.push(e),n.push({id:`decoder->audio`,source:`decoder`,target:`audio`,crossNode:Xt(o.nodeId,f.nodeId)}),l++}let p=e.recording;if(p!==null){let e={id:`recorder`,kind:`recorder`,nodeId:null,data:{mode:p.mode,active:p.active,storageBytes:p.storageBytes},position:{x:Q.recorder,y:l*$}};t.push(e),n.push({id:`decoder->recorder`,source:`decoder`,target:`recorder`,crossNode:!1})}}return{nodes:t,edges:n}}R();function tn(e){let{data:t,isLoading:n}=o({deviceId:e}),[r,i]=F(void 0);return I(()=>{t!==void 0&&i(t)},[t]),S(U.PipelineCameraMetricsSnapshot,t=>{let n=t.data;n.deviceId===e&&i(e=>e===void 0||e.detection===null?e:{...e,detection:{...e.detection,phase:n.metrics.phase,actualFps:n.metrics.actualFps,queueDepth:n.metrics.queueDepth,avgInferenceMs:n.metrics.avgInferenceTimeMs}})}),S(U.PipelineEngineProvisioning,e=>{let t=e.data;i(n=>{if(n===void 0||n.detection===null)return n;let r=n.detection.nodeId??n.assignment?.detectionNodeId??null;return r===null||e.source.type!==`node`||e.source.id!==r?n:{...n,detection:{...n.detection,provisioning:{state:t.state,error:t.error}}}})}),S(U.MotionAnalysis,t=>{t.source.type!==`device`||t.source.id!==e||i(e=>e===void 0||e.motion===null?e:{...e,motion:{...e.motion,enabled:!0}})}),S(U.StreamBrokerMetricsSnapshot,t=>{let n=t.data;n.deviceId===e&&i(e=>e===void 0||e.broker===null?e:{...e,broker:{...e.broker,profiles:e.broker.profiles.map(e=>e.profile===n.profile?{...e,subscribers:n.stats.encodedSubscribers+n.stats.decodedSubscribers,inFps:n.stats.inputFps,outFps:n.stats.decodeFps}:e)}})}),S(U.PipelineAudioInferenceResult,t=>{t.data.deviceId===e&&i(e=>e===void 0||e.audio===null?e:{...e,audio:{...e.audio,enabled:!0}})}),S(U.RecordingStarted,t=>{t.data.deviceId===e&&i(e=>e===void 0||e.recording===null?e:{...e,recording:{...e.recording,active:!0}})}),S(U.RecordingStopped,t=>{t.data.deviceId===e&&i(e=>e===void 0||e.recording===null?e:{...e,recording:{...e.recording,active:!1}})}),{status:r,isLoading:n}}function nn({data:e}){return V(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[160px] px-3 py-2`,children:[z(Y,{type:`source`,position:J.Right}),V(`div`,{className:`flex items-center gap-2`,children:[z(`span`,{className:`h-2 w-2 rounded-full bg-green-500 shrink-0`,"aria-label":`healthy`}),V(`span`,{className:`text-sm font-semibold truncate`,children:[`Camera #`,e.deviceId]})]}),z(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`source`})]})}function rn(e){return e>0?`bg-green-500`:`bg-yellow-500`}function an({data:e}){let t=e.streams[0],n=e.streams.length;return V(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[160px] px-3 py-2`,children:[z(Y,{type:`target`,position:J.Left}),z(Y,{type:`source`,position:J.Right}),V(`div`,{className:`flex items-center gap-2`,children:[z(`span`,{className:`h-2 w-2 rounded-full shrink-0 ${rn(n)}`,"aria-label":n>0?`healthy`:`idle`}),z(`span`,{className:`text-sm font-semibold`,children:`Source`}),V(`span`,{className:`text-xs text-muted-foreground`,children:[n,` streams`]})]}),t!==void 0&&V(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[t.codec,` `,t.width,`×`,t.height,` `,t.fps,`fps`]})]})}function on(e){return e>0?`bg-green-500`:`bg-yellow-500`}function sn({data:e}){let t=e.profiles.reduce((e,t)=>e+t.subscribers,0),n=e.profiles.length;return V(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[160px] px-3 py-2`,children:[z(Y,{type:`target`,position:J.Left}),z(Y,{type:`source`,position:J.Right}),V(`div`,{className:`flex items-center gap-2`,children:[z(`span`,{className:`h-2 w-2 rounded-full shrink-0 ${on(t)}`,"aria-label":t>0?`healthy`:`idle`}),z(`span`,{className:`text-sm font-semibold`,children:`Broker`}),V(`span`,{className:`text-xs text-muted-foreground`,children:[n,` profiles`]})]}),V(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[t,` subs · WebRTC `,e.webrtcSessions,e.rtspRestream&&` · RTSP`]})]})}function cn(e){return e>0?`bg-green-500`:`bg-yellow-500`}function ln(e,t){let n=e+t;return n>0?Math.round(e/n*100):0}function un({data:e}){let t=ln(e.shm.getFrameHits,e.shm.getFrameMisses);return V(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[160px] px-3 py-2`,children:[z(Y,{type:`target`,position:J.Left}),z(Y,{type:`source`,position:J.Right}),V(`div`,{className:`flex items-center gap-2`,children:[z(`span`,{className:`h-2 w-2 rounded-full shrink-0 ${cn(e.sessionCount)}`,"aria-label":e.sessionCount>0?`healthy`:`idle`}),z(`span`,{className:`text-sm font-semibold`,children:`Decoder`}),V(`span`,{className:`text-xs text-muted-foreground`,children:[`@`,e.nodeId]})]}),V(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[e.formats.join(`, `),` · `,e.sessionCount,` sessions`]}),V(`div`,{className:`text-xs text-muted-foreground`,children:[`shm `,t,`% hit`]})]})}function dn(e){return e?`bg-green-500`:`bg-yellow-500`}function fn({data:e}){return V(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[160px] px-3 py-2`,children:[z(Y,{type:`target`,position:J.Left}),V(`div`,{className:`flex items-center gap-2`,children:[z(`span`,{className:`h-2 w-2 rounded-full shrink-0 ${dn(e.enabled)}`,"aria-label":e.enabled?`enabled`:`disabled`}),z(`span`,{className:`text-sm font-semibold`,children:`Motion`})]}),V(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[e.enabled?`enabled`:`disabled`,` · `,e.fps,` fps`]})]})}function pn(e){return e.provisioning.state===`failed`?`bg-red-500`:e.phase===`active`?`bg-green-500`:(e.phase,`bg-yellow-500`)}function mn(e){return e===`ready`?`bg-green-500 text-white`:e===`failed`?`bg-red-500 text-white`:`bg-yellow-500 text-white`}function hn({data:e}){return V(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[180px] px-3 py-2`,children:[z(Y,{type:`target`,position:J.Left}),V(`div`,{className:`flex items-center gap-2`,children:[z(`span`,{className:`h-2 w-2 rounded-full shrink-0 ${pn(e)}`,"aria-label":e.phase}),z(`span`,{className:`text-sm font-semibold`,children:`Detection`}),V(`span`,{className:`text-xs text-muted-foreground`,children:[`@`,e.nodeId]})]}),V(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[e.engine.backend,`·`,e.engine.device,` · `,e.phase]}),V(`div`,{className:`text-xs text-muted-foreground`,children:[e.actualFps.toFixed(1),`/`,e.configuredFps,` fps · q`,e.queueDepth,` ·`,` `,e.avgInferenceMs.toFixed(1),`ms`]}),V(`div`,{className:`flex items-center gap-1 mt-1`,children:[z(`span`,{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded ${mn(e.provisioning.state)}`,"aria-label":`provisioning ${e.provisioning.state}`,children:e.provisioning.state}),e.provisioning.state===`failed`&&e.provisioning.error!==void 0&&z(`span`,{className:`text-[10px] text-red-500 truncate`,children:e.provisioning.error})]})]})}function gn(e){return e?`bg-green-500`:`bg-yellow-500`}function _n({data:e}){return V(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[160px] px-3 py-2`,children:[z(Y,{type:`target`,position:J.Left}),V(`div`,{className:`flex items-center gap-2`,children:[z(`span`,{className:`h-2 w-2 rounded-full shrink-0 ${gn(e.enabled)}`,"aria-label":e.enabled?`enabled`:`disabled`}),z(`span`,{className:`text-sm font-semibold`,children:`Audio`}),V(`span`,{className:`text-xs text-muted-foreground`,children:[`@`,e.nodeId]})]}),z(`div`,{className:`text-xs text-muted-foreground mt-1`,children:e.enabled?`enabled`:`disabled`})]})}function vn(e){return e.mode===`off`?`bg-red-500`:e.active?`bg-green-500`:`bg-yellow-500`}function yn(e){return e>=1073741824?`${(e/1073741824).toFixed(1)} GB`:`${(e/1048576).toFixed(1)} MB`}function bn({data:e}){return V(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[160px] px-3 py-2`,children:[z(Y,{type:`target`,position:J.Left}),V(`div`,{className:`flex items-center gap-2`,children:[z(`span`,{className:`h-2 w-2 rounded-full shrink-0 ${vn(e)}`,"aria-label":e.active?`active`:e.mode===`off`?`off`:`inactive`}),z(`span`,{className:`text-sm font-semibold`,children:`Recorder`}),z(`span`,{className:`text-xs text-muted-foreground`,children:e.mode})]}),V(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[e.active?`active`:`inactive`,` · `,yn(e.storageBytes)]})]})}R();var xn={camera:nn,source:an,broker:sn,decoder:un,motion:fn,detection:hn,audio:_n,recorder:bn},Sn={stroke:`#f59e0b`,strokeWidth:2},Cn={strokeWidth:1.5};function wn({deviceId:e}){let{status:t,isLoading:n}=tn(e),{rfNodes:r,rfEdges:i}=L(()=>{if(t===void 0)return{rfNodes:[],rfEdges:[]};let e=en(t);return{rfNodes:e.nodes.map(e=>({id:e.id,type:e.kind,position:{x:e.position.x,y:e.position.y},data:{...e.data}})),rfEdges:e.edges.map(e=>({id:e.id,source:e.source,target:e.target,animated:e.crossNode,style:e.crossNode?Sn:Cn,label:e.label}))}},[t]);return n?z(`div`,{className:`flex items-center justify-center h-full text-sm text-muted-foreground`,children:`Loading…`}):t===void 0?z(`div`,{className:`flex items-center justify-center h-full text-sm text-muted-foreground`,children:`No pipeline data`}):z(`div`,{className:`w-full h-full`,children:V(Ke,{nodes:r,edges:i,nodeTypes:xn,fitView:!0,proOptions:{hideAttribution:!0},children:[z(Je,{gap:20,size:1}),z(qe,{showInteractive:!1})]})})}R();var Tn=`__cluster__`;function En(e){return e===`cameras`?`cameras`:`nodes`}function Dn(){let[e,t]=Le(),n=En(e.get(`view`)),r=e.get(`node`)??`__cluster__`,i=e.get(`camera`),a=i===null?null:parseInt(i,10),[o,s]=F(0);return I(()=>{n===`nodes`&&!e.get(`node`)&&t({view:`nodes`,node:Tn},{replace:!0})},[n,e,t]),V(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[V(`div`,{className:`flex items-center justify-between gap-4 px-4 py-3 border-b border-border shrink-0`,children:[V(`div`,{className:`flex items-center gap-1 rounded-lg border border-border p-0.5 bg-surface`,children:[z(`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`}),z(`button`,{type:`button`,onClick:()=>{let e={view:`cameras`};a!==null&&(e.camera=String(a)),t(e,{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`})]}),V(`button`,{type:`button`,onClick:()=>s(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:[z(Oe,{className:`h-3.5 w-3.5`}),`Refresh`]})]}),z(`div`,{className:`flex-1 flex flex-col md:flex-row overflow-hidden min-h-0`,children:n===`nodes`?V(H,{children:[z(`aside`,{className:`w-full md:w-72 shrink-0 border-b md:border-b-0 md:border-r border-border overflow-y-auto`,children:z($e,{selectedNodeId:r,onSelect:e=>{t({view:`nodes`,node:e},{replace:!0})},refreshToken:o})}),z(`section`,{className:`flex-1 min-h-0 overflow-hidden`,children:r===`__cluster__`?z(Wt,{refreshToken:o}):z(kt,{nodeId:r,refreshToken:o})})]}):V(H,{children:[z(`aside`,{className:`w-full md:w-72 shrink-0 border-b md:border-b-0 md:border-r border-border overflow-y-auto`,children:z(Yt,{selectedDeviceId:a,onSelect:e=>{t({view:`cameras`,camera:String(e)},{replace:!0})}})}),z(`section`,{className:`flex-1 min-h-0 overflow-hidden`,children:a!==null&&Number.isFinite(a)&&!Number.isNaN(a)?z(wn,{deviceId:a}):z(`div`,{className:`flex items-center justify-center h-full text-sm text-foreground-subtle`,children:`Select a camera to view its pipeline flow`})})]})})]})}export{Dn as PipelinePage};
|
|
1
|
+
import{$r as e,Bi as t,Br as n,Cr as r,Dr as i,Er as a,Fr as o,Hr as s,Ir as c,J as l,Ki as u,Kr as d,Mr as f,Nr as p,Or as m,Pi as h,Qr as g,Ri as _,Rr as v,Sr as y,Ui as b,Ur as x,Vi as S,Vr as C,Wi as w,X as T,_ as E,ai as D,br as O,ei as k,gr as A,jr as ee,kr as te,li as ne,oi as j,qi as M,qr as N,ri as P,si as re,ti as ie,va as ae,vr as oe,w as se,wr as ce,xr as le,yr as ue,zi as de}from"./src-tFxrblhL.js";import{G as fe,I as pe,K as F,S as I,T as me,W as L,Z as R,a as he,b as z,o as B,x as V,z as H}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CCjPq1YD.js";import{p as ge}from"./player-overlays-BD7QrhVv.js";import{D as U,O as _e}from"./src-DsE0ulBa.js";import{t as ve}from"./download-BT33CH3j.js";import{i as ye,n as be,r as xe,t as Se}from"./AddLocationWizard-DomSxpGI.js";import{n as Ce,r as we,t as Te}from"./zap-DHsYuJKW.js";import{t as Ee}from"./pencil-CLwBxZCl.js";import{t as De}from"./plus-tJZHYmsB.js";import{t as Oe}from"./refresh-cw-CLgLEKc_.js";import{t as ke}from"./search-BT8SB-Ig.js";import{t as Ae}from"./server-C-7gGEm3.js";import{t as je}from"./square-check-big-XneAXRht.js";import{t as Me}from"./square-UU8oWHzQ.js";import{A as Ne,B as W,F as Pe,M as Fe,P as Ie,W as Le,i as Re,j as ze,k as G,s as Be,w as Ve,x as K}from"./index-C9dLNgtt.js";import{t as He}from"./AdminPage-vtcsGqRq.js";import{r as Ue}from"./useDevice-CEFTGk-N.js";import{t as q}from"./useEventInvalidation-BtLXp2PR.js";import{n as We}from"./format-size-CO9d3C3-.js";import{t as Ge}from"./NodeAddonsSettingsPanel-C8dKpqZh.js";import{a as J,i as Ke,n as qe,r as Y,t as Je}from"./esm-C2ZjsqSd.js";var Ye=W(`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`}]]),Xe=W(`film`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M3 7.5h4`,key:`zfgn84`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M3 16.5h4`,key:`1230mu`}],[`path`,{d:`M17 3v18`,key:`in4fa5`}],[`path`,{d:`M17 7.5h4`,key:`myr1c1`}],[`path`,{d:`M17 16.5h4`,key:`go4c1d`}]]),Ze=W(`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`}]]),Qe=W(`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`}]]);R();function $e({selectedNodeId:e,onSelect:t,refreshToken:r}){let{data:i}=A(void 0),{data:a}=n(void 0),o=new Map;for(let e of a??[])o.set(e.agentNodeId,(o.get(e.agentNodeId)??0)+1);let s=i??[],c=s.filter(e=>e.isOnline).length,l=s.filter(e=>!e.isOnline).length;return I(`div`,{className:`flex flex-col h-full`,children:[I(`button`,{type:`button`,onClick:()=>t(Tn),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:[V(Ve,{className:`h-4 w-4 flex-shrink-0`}),I(`div`,{className:`min-w-0 flex-1`,children:[V(`div`,{className:`text-xs font-semibold truncate`,children:`Cluster`}),V(`div`,{className:`text-[10px] text-foreground-subtle`,children:`Balancer + failover + assignments`})]})]}),V(`div`,{className:`flex-1 overflow-y-auto`,children:s.map(n=>{let r=e===n.id,i=o.get(n.id)??0,a=n.isHub?Ae:G;return I(`button`,{type:`button`,onClick:()=>t(n.id),className:`flex items-center gap-3 w-full px-4 py-3 border-b border-border text-left transition-colors ${r?`bg-primary/10 text-primary`:`text-foreground hover:bg-surface-hover`}`,children:[V(a,{className:`h-4 w-4 flex-shrink-0`}),I(`div`,{className:`min-w-0 flex-1`,children:[I(`div`,{className:`flex items-center gap-2`,children:[V(`span`,{className:`text-xs font-semibold truncate`,children:n.name}),n.isHub&&V(`span`,{className:`text-[9px] uppercase tracking-wider text-foreground-subtle border border-border rounded px-1 py-0.5`,children:`hub`}),!n.isOnline&&V(`span`,{className:`h-1.5 w-1.5 rounded-full bg-destructive flex-shrink-0`}),n.isOnline&&V(`span`,{className:`h-1.5 w-1.5 rounded-full bg-success flex-shrink-0`})]}),I(`div`,{className:`text-[10px] text-foreground-subtle flex items-center gap-2 mt-0.5`,children:[I(`span`,{children:[n.cpuCores,` cores`]}),V(`span`,{children:`•`}),I(`span`,{children:[Math.round(n.memoryMB/1024),` GB`]}),i>0&&I(z,{children:[V(`span`,{children:`•`}),I(`span`,{className:`inline-flex items-center gap-0.5 text-foreground`,children:[V(Ce,{className:`h-2.5 w-2.5`}),i]})]})]})]})]},n.id)})}),I(`div`,{className:`px-4 py-2 border-t border-border text-[10px] text-foreground-subtle flex items-center justify-between`,children:[I(`span`,{children:[c,` online`]}),l>0&&I(`span`,{className:`text-destructive`,children:[l,` offline`]})]})]})}function et({nodeId:e,refreshToken:t}){let{data:n}=A(void 0),r=n?.find(t=>t.id===e),i=de(`pipeline.runner-load-snapshot`,t=>t.nodeId===e)?.load??null;return r?I(`div`,{className:`px-6 py-4 border-b border-border`,children:[I(`div`,{className:`flex items-center gap-2 mb-1`,children:[V(`h2`,{className:`text-base font-semibold text-foreground`,children:r.name}),r.isOnline?V(`span`,{className:`text-[10px] px-2 py-0.5 rounded-full bg-success/10 text-success`,children:`online`}):V(`span`,{className:`text-[10px] px-2 py-0.5 rounded-full bg-destructive/10 text-destructive`,children:`offline`}),r.isHub&&V(`span`,{className:`text-[9px] uppercase tracking-wider text-foreground-subtle border border-border rounded px-1 py-0.5`,children:`hub`})]}),I(`div`,{className:`text-[11px] text-foreground-subtle flex items-center gap-2 flex-wrap`,children:[V(`span`,{children:r.cpuModel??`CPU`}),V(`span`,{children:`•`}),I(`span`,{children:[r.cpuCores,` cores`]}),V(`span`,{children:`•`}),I(`span`,{children:[Math.round(r.memoryMB/1024),` GB`]}),i&&I(z,{children:[V(`span`,{children:`•`}),I(`span`,{children:[i.attachedCameras,` cameras (`,i.activeCameras,` active)`]}),V(`span`,{children:`•`}),I(`span`,{children:[i.avgInferenceTimeMs.toFixed(0),`ms avg inference`]}),V(`span`,{children:`•`}),I(`span`,{children:[`queue `,i.queueDepthTotal]}),i.hardware.hasGpu&&I(z,{children:[V(`span`,{children:`•`}),V(`span`,{className:`text-success`,children:`GPU`})]})]})]})]}):V(`div`,{className:`px-6 py-4 border-b border-border`,children:I(`div`,{className:`text-xs text-foreground-subtle`,children:[`Node not found: `,e]})})}function tt({refreshToken:e,nodeId:t}){let[n,r]=F(new Map),{nodes:i}=_();S(`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}=p(void 0),o=L(()=>{let e=new Map;for(let t of a??[])e.set(t.nodeId,t.deviceCount);return e},[a]),s=L(()=>{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=L(()=>{let e=new Map;for(let t of i)e.set(t.id,t.shortName);return e},[i]),l=L(()=>{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 I(`div`,{className:`@container/liveload`,children:[V(`h3`,{className:`text-sm font-semibold text-foreground mb-2`,children:`Live load`}),I(`div`,{className:`grid grid-cols-2 @md/liveload:grid-cols-3 @3xl/liveload:grid-cols-5 gap-2 mb-3`,children:[V(X,{label:`FPS`,value:e?e.totalFps.toFixed(1):`—`}),V(X,{label:`Cameras`,value:e?`${e.activeCameras}/${e.attachedCameras}`:`—`}),V(X,{label:`Avg infer ms`,value:e&&e.attachedCameras>0?(e.totalInferenceWeighted/e.attachedCameras).toFixed(0):`—`}),V(X,{label:`Queue`,value:e?String(e.queueDepth):`—`}),V(X,{label:`Audio`,value:String(o.get(t)??`—`)})]})]})}let u=[...s.entries()].toSorted(([e],[t])=>e===`hub`?-1:t===`hub`?1:e.localeCompare(t));return I(`div`,{className:`@container/liveload`,children:[V(`h3`,{className:`text-sm font-semibold text-foreground mb-2`,children:`Live load`}),I(`div`,{className:`grid grid-cols-2 @md/liveload:grid-cols-3 @3xl/liveload:grid-cols-5 gap-2 sm:gap-3 mb-3`,children:[V(X,{label:`Total agents`,value:`${l.onlineAgents}/${l.totalAgents}`}),V(X,{label:`Cameras`,value:`${l.activeCameras}/${l.attachedCameras}`}),V(X,{label:`Total FPS`,value:l.totalFps.toFixed(1)}),V(X,{label:`Avg inference ms`,value:l.avgInferenceTimeMs.toFixed(0)}),V(X,{label:`Queue depth`,value:String(l.queueDepth)})]}),V(`div`,{className:`rounded-lg border border-border overflow-x-auto`,children:I(`table`,{className:`w-full text-xs min-w-[480px]`,children:[V(`thead`,{className:`bg-surface`,children:I(`tr`,{className:`text-foreground-subtle text-[10px] uppercase tracking-wider`,children:[V(`th`,{className:`text-left px-3 py-2`,children:`Agent`}),V(`th`,{className:`text-right px-3 py-2`,children:`FPS`}),V(`th`,{className:`text-right px-3 py-2`,children:`Cameras`}),V(`th`,{className:`text-right px-3 py-2`,children:`Inference ms`}),V(`th`,{className:`text-right px-3 py-2`,children:`Queue`}),V(`th`,{className:`text-right px-3 py-2`,children:`Audio`})]})}),I(`tbody`,{children:[u.map(([e,t])=>I(`tr`,{className:`border-t border-border`,children:[V(`td`,{className:`px-3 py-2 text-foreground font-medium`,children:c.get(e)??e}),V(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.totalFps.toFixed(1)}),V(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.attachedCameras}),V(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.attachedCameras>0?(t.totalInferenceWeighted/t.attachedCameras).toFixed(0):`—`}),V(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.queueDepth}),V(`td`,{className:`px-3 py-2 text-right text-foreground`,children:o.get(e)??`—`})]},e)),u.length===0&&V(`tr`,{children:V(`td`,{colSpan:6,className:`px-3 py-4 text-center text-foreground-subtle text-[11px]`,children:`No camera metrics received yet`})})]})]})})]})}function X({label:e,value:t}){return I(`div`,{className:`rounded-lg border border-border bg-surface/60 p-3`,children:[V(`div`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle mb-1`,children:e}),V(`div`,{className:`text-lg font-semibold text-foreground`,children:t})]})}R();var nt={active:!1,pinned:!1,nodeId:null,reason:``},rt=[`pipeline.camera-assigned`,`pipeline.camera-unassigned`,`pipeline.camera-updated`,`agent.online`,`agent.offline`],it={pipeline:G,decoder:Xe,audio:we},at={pipeline:`Pipeline`,decoder:`Decoder`,audio:`Audio`};function ot({mode:t,nodeId:r,compact:o=!1}){if(t===`agent`&&!r)throw Error(`CameraAssignmentsTable: nodeId is required when mode === "agent"`);let s=B(),[c,l]=F(null),[u,d]=F(null),[p,h]=F(new Map);q([`pipelineOrchestrator`,`getPipelineAssignments`],rt),q([`pipelineOrchestrator`,`getDecoderAssignments`],rt),q([`pipelineOrchestrator`,`getAudioAssignments`],rt);let{data:y}=n(void 0),{data:b}=v(void 0),{data:x}=f(void 0),{nodes:C}=_(),{data:w}=Ue();S(`pipeline.camera-metrics-snapshot`,e=>{let t=e.data;typeof t.deviceId==`number`&&h(e=>{let n=new Map(e);return n.set(t.deviceId,t),n})}),H(()=>{if(p.size===0)return;let e=setInterval(()=>{h(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)},[p.size]);let T=L(()=>{let e=new Map;for(let t of w??[])e.set(t.id,t.name);return e},[w]),E=L(()=>{let e=new Map,n=t=>{let n=e.get(t);if(n)return n;let r={deviceId:t,deviceName:T.get(t)??`Device ${t}`,pipeline:nt,decoder:nt,audio:nt};return e.set(t,r),r};for(let i of y??[]){let a=n(i.deviceId);e.set(i.deviceId,{...a,pipeline:{active:t===`cluster`?!0:i.agentNodeId===r,pinned:i.pinned,nodeId:i.agentNodeId,reason:i.reason??``}})}for(let i of b??[]){let a=n(i.deviceId);e.set(i.deviceId,{...a,decoder:{active:t===`cluster`?!0:i.decoderNodeId===r,pinned:i.pinned,nodeId:i.decoderNodeId,reason:i.reason??``}})}for(let i of x??[]){let a=n(i.deviceId);e.set(i.deviceId,{...a,audio:{active:t===`cluster`?!0:i.nodeId===r,pinned:i.pinned,nodeId:i.nodeId,reason:`capacity`}})}let i=[...e.values()];return t===`agent`&&(i=i.filter(e=>e.pipeline.active||e.decoder.active||e.audio.active)),i.sort((e,t)=>e.deviceId-t.deviceId),i},[y,b,x,T,t,r]),D=L(()=>(C??[]).filter(e=>e.isOnline).map(e=>({id:e.id,name:e.name})),[C]),O=()=>{s.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getPipelineAssignments`]]}),s.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getDecoderAssignments`]]}),s.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getAudioAssignments`]]})},A=m({onSuccess:O}),ee=k({onSuccess:O}),te=i({onSuccess:O}),ne=e({onSuccess:O}),j=a({onSuccess:O}),M=g({onSuccess:O}),N=(e,t,n)=>{t===`pipeline`?A.mutate({deviceId:e,agentNodeId:n}):t===`decoder`?te.mutate({deviceId:e,nodeId:n}):j.mutate({deviceId:e,nodeId:n}),l(null)},P=(e,t)=>{t===`pipeline`?ee.mutate({deviceId:e}):t===`decoder`?ne.mutate({deviceId:e}):M.mutate({deviceId:e}),l(null)};return V(`div`,{className:`rounded-lg border border-border overflow-x-auto`,children:I(`table`,{className:`w-full text-xs min-w-[640px]`,children:[V(`thead`,{className:`bg-surface`,children:I(`tr`,{className:`text-foreground-subtle text-[10px] uppercase tracking-wider`,children:[!o&&V(`th`,{className:`w-6`}),V(`th`,{className:`text-left px-3 py-2 align-middle`,children:`Camera`}),V(`th`,{className:`text-left px-3 py-2 align-middle`,children:`Pipeline`}),V(`th`,{className:`text-left px-3 py-2 align-middle`,children:`Decoder`}),V(`th`,{className:`text-left px-3 py-2 align-middle`,children:`Audio`}),V(`th`,{className:`text-left px-3 py-2 align-middle`,children:`Status`})]})}),I(`tbody`,{children:[E.map(e=>{let n=p.get(e.deviceId),r=u===e.deviceId;return I(me.Fragment,{children:[I(`tr`,{className:`border-t border-border align-middle relative`,children:[!o&&V(`td`,{className:`px-2 py-2 align-middle`,children:V(`button`,{type:`button`,onClick:()=>d(r?null:e.deviceId),className:`p-1 rounded hover:bg-surface-hover text-foreground-subtle`,"aria-label":r?`Collapse broker details`:`Expand broker details`,children:V(r?Ie:Fe,{className:`h-3.5 w-3.5`})})}),I(`td`,{className:`px-3 py-2 align-middle`,children:[V(`div`,{className:`text-foreground font-medium leading-tight`,children:e.deviceName}),I(`div`,{className:`text-[10px] text-foreground-subtle leading-tight`,children:[`#`,e.deviceId]})]}),V(st,{role:`pipeline`,state:e.pipeline,mode:t,deviceId:e.deviceId,onlineNodes:D,isMenuOpen:c?.deviceId===e.deviceId&&c.role===`pipeline`,onToggleMenu:()=>l(c?.deviceId===e.deviceId&&c.role===`pipeline`?null:{deviceId:e.deviceId,role:`pipeline`}),onCloseMenu:()=>l(null),onMove:t=>N(e.deviceId,`pipeline`,t),onUnpin:()=>P(e.deviceId,`pipeline`)}),V(st,{role:`decoder`,state:e.decoder,mode:t,deviceId:e.deviceId,onlineNodes:D,isMenuOpen:c?.deviceId===e.deviceId&&c.role===`decoder`,onToggleMenu:()=>l(c?.deviceId===e.deviceId&&c.role===`decoder`?null:{deviceId:e.deviceId,role:`decoder`}),onCloseMenu:()=>l(null),onMove:t=>N(e.deviceId,`decoder`,t),onUnpin:()=>P(e.deviceId,`decoder`)}),V(st,{role:`audio`,state:e.audio,mode:t,deviceId:e.deviceId,onlineNodes:D,isMenuOpen:c?.deviceId===e.deviceId&&c.role===`audio`,onToggleMenu:()=>l(c?.deviceId===e.deviceId&&c.role===`audio`?null:{deviceId:e.deviceId,role:`audio`}),onCloseMenu:()=>l(null),onMove:t=>N(e.deviceId,`audio`,t),onUnpin:()=>P(e.deviceId,`audio`)}),V(`td`,{className:`px-3 py-2 align-middle`,children:V(ut,{snap:n})})]}),r&&!o&&I(`tr`,{className:`bg-surface/50`,children:[V(`td`,{}),V(`td`,{colSpan:5,className:`px-3 py-2`,children:V(se,{widgetId:`stream-broker/stream-broker-panel`,host:`device-tab`,deviceId:e.deviceId,instanceId:`pipeline-row/${e.deviceId}`,config:{variant:`compact`,title:`Stream brokers & clients`}})})]})]},e.deviceId)}),E.length===0&&V(`tr`,{children:V(`td`,{colSpan:o?5:6,className:`px-3 py-4 text-center text-foreground-subtle text-[11px]`,children:t===`agent`?`No cameras assigned to this node`:`No cameras currently assigned`})})]})]})})}function st({role:e,state:t,mode:n,onlineNodes:r,isMenuOpen:i,onToggleMenu:a,onCloseMenu:o,onMove:s,onUnpin:c}){let l=it[e],u=r.filter(e=>e.id!==(t.nodeId??``)),d=(t.active||n===`cluster`)&&(u.length>0||t.pinned);return I(`td`,{className:`px-3 py-2 align-middle relative`,children:[I(`div`,{className:`flex items-center gap-2`,children:[V(n===`agent`?ct:lt,{state:t,Icon:l}),V(`div`,{className:`ml-auto`,children:d&&V(`button`,{type:`button`,onClick:a,className:`p-1 rounded hover:bg-surface-hover`,"aria-label":`${at[e]} actions`,children:V(Ye,{className:`h-3 w-3 text-foreground-subtle`})})})]}),i&&d&&V(dt,{title:at[e],targets:u,pinned:t.pinned,onMove:s,onUnpin:c,onClose:o})]})}function ct({state:e,Icon:t}){return I(`div`,{className:`flex items-center gap-1.5`,children:[V(e.active?je:Me,{className:`h-3.5 w-3.5 ${e.active?`text-success`:`text-foreground-subtle/50`}`}),V(t,{className:`h-3 w-3 ${e.active?`text-foreground-subtle`:`text-foreground-subtle/40`}`}),e.pinned&&V(Qe,{className:`h-2.5 w-2.5 text-amber-400`})]})}function lt({state:e,Icon:t}){return!e.active||!e.nodeId?I(`div`,{className:`flex items-center gap-1.5 text-foreground-subtle/60`,children:[V(t,{className:`h-3 w-3`}),V(`span`,{className:`text-[10px] italic`,children:`—`})]}):I(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[V(t,{className:`h-3 w-3 text-foreground-subtle shrink-0`}),I(`div`,{className:`flex flex-col leading-tight min-w-0`,children:[V(`span`,{className:`font-mono text-[11px] text-foreground truncate`,children:e.nodeId}),V(`span`,{className:`flex items-center gap-1 text-[10px]`,children:e.pinned?I(`span`,{className:`inline-flex items-center gap-0.5 text-amber-400`,children:[V(Qe,{className:`h-2.5 w-2.5`}),` manual`]}):I(`span`,{className:`text-foreground-subtle truncate`,children:[`auto · `,e.reason||`capacity`]})})]})]})}function ut({snap:e}){if(!e)return V(`span`,{className:`text-[10px] text-foreground-subtle italic`,children:`—`});let{phase:t,actualFps:n,avgInferenceTimeMs:r,queueDepth:i,configuredFps:a}=e.metrics,o=ae(t);return I(`div`,{className:`flex flex-col gap-0.5 font-mono text-[10px] tabular-nums leading-tight`,children:[I(`span`,{className:`inline-flex items-center gap-1 ${o.textColor}`,children:[V(E,{phase:t,className:`h-2.5 w-2.5`}),V(`span`,{className:`font-semibold uppercase tracking-wider`,children:o.label})]}),I(`span`,{className:`text-foreground-subtle`,children:[V(`span`,{className:`text-foreground`,children:n.toFixed(1)}),I(`span`,{children:[`/`,a.toFixed(0),` fps`]})]}),I(`span`,{className:`text-foreground-subtle`,children:[V(`span`,{className:`text-foreground`,children:r.toFixed(0)}),V(`span`,{children:` ms`}),i>0&&I(`span`,{className:`text-warning ml-1`,children:[`q`,i]})]})]})}function dt({title:e,targets:t,pinned:n,onMove:r,onUnpin:i,onClose:a}){let o=fe(null);return H(()=>{let e=e=>{o.current?.contains(e.target)||a()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[a]),I(`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:[V(`div`,{className:`px-3 py-1 text-[9px] uppercase tracking-wider text-foreground-subtle border-b border-border`,children:e}),t.length>0&&V(`div`,{className:`py-1`,children:t.map(e=>I(`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&&I(`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&&V(`div`,{className:`px-3 py-1.5 text-[10px] text-foreground-subtle italic`,children:`Already auto · no other nodes online`})]})}function ft({nodeId:e,refreshToken:t}){return I(`div`,{className:`space-y-6`,children:[V(tt,{refreshToken:t,nodeId:e}),I(`div`,{children:[V(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Cameras on this node`}),I(`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.`]})]}),V(ot,{mode:`agent`,nodeId:e,compact:!0})]})}R();function pt(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:n}){let i=B(),a=r({onSettled:()=>{i.invalidateQueries({queryKey:[`pipelineExecutor`,`listLoadedEngines`]})}}),{data:o}=ce({nodeId:e}),s=de(`pipeline.engine-metrics-snapshot`,t=>t.nodeId===e)?.engines??o??null,c=s===null;q([`pipelineRunner`,`getLocalCameras`],[`pipeline.camera-assigned`,`pipeline.camera-unassigned`]);let{data:l}=P({nodeId:e}),{values:u}=t(`pipeline.camera-metrics-snapshot`,e=>e.deviceId,t=>t.nodeId===e),d=L(()=>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?`)||a.mutate({nodeId:e,engine:t,force:n.length>0})};return I(`div`,{className:`space-y-6`,children:[I(`div`,{children:[V(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Inference engines on this node`}),I(`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.`]})]}),V(`div`,{className:`rounded-lg border border-border overflow-x-auto`,children:I(`table`,{className:`w-full text-xs min-w-[640px]`,children:[V(`thead`,{className:`bg-surface`,children:I(`tr`,{className:`text-foreground-subtle text-[10px] uppercase tracking-wider`,children:[V(`th`,{className:`text-left px-3 py-2 whitespace-nowrap`,children:`Kind`}),V(`th`,{className:`text-left px-3 py-2 whitespace-nowrap`,children:`Runtime / Backend / Device`}),V(`th`,{className:`text-left px-3 py-2`,children:`Models`}),V(`th`,{className:`text-right px-3 py-2 whitespace-nowrap`,children:`Pool PID`}),V(`th`,{className:`text-right px-3 py-2 whitespace-nowrap`,children:`Auto-kill`}),V(`th`,{className:`text-right px-3 py-2 whitespace-nowrap`,children:`In use`}),V(`th`,{className:`w-20`})]})}),I(`tbody`,{children:[c&&V(`tr`,{children:V(`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`;return I(`tr`,{className:`border-t border-border ${t?`bg-amber-500/5`:``}`,children:[V(`td`,{className:`px-3 py-2`,children:I(`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`:`bg-success/15 text-success`}`,children:[V(t?Ze:G,{className:`h-3 w-3`}),t?`warm`:`runtime`]})}),V(`td`,{className:`px-3 py-2`,children:I(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-sky-400`,children:[V(Te,{className:`h-3 w-3`}),e.engine.runtime,`/`,e.engine.backend,e.engine.device?`/${e.engine.device}`:``,e.engine.format?` · ${e.engine.format}`:``]})}),V(`td`,{className:`px-3 py-2`,children:e.modelsLoaded.length===0?V(`span`,{className:`text-foreground-subtle text-[11px]`,children:`—`}):V(`div`,{className:`flex flex-wrap gap-1`,children:e.modelsLoaded.map(e=>V(`span`,{className:`inline-block rounded bg-surface px-1.5 py-0.5 text-[10px] font-mono text-foreground-subtle`,children:e},e))})}),V(`td`,{className:`px-3 py-2 text-right font-mono text-foreground`,children:e.poolPid??`—`}),V(`td`,{className:`px-3 py-2 text-right text-[11px]`,children:e.idleMs!==null&&e.idleTtlMs!==null?V(`span`,{className:`text-foreground-subtle`,children:pt(e.idleMs,e.idleTtlMs)}):V(`span`,{className:`text-foreground-subtle/50`,children:`never`})}),V(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t?`—`:(l??[]).length}),V(`td`,{className:`px-3 py-2 text-right`,children:I(`button`,{type:`button`,disabled:a.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:[V(Be,{className:`h-3 w-3`}),`Kill`]})})]},e.engineKey)}),!c&&(s??[]).length===0&&V(`tr`,{children:V(`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.`})})]})]})}),I(`div`,{className:`text-[10px] text-foreground-subtle leading-relaxed`,children:[V(`strong`,{className:`text-foreground`,children:`runtime`}),`: main camera-serving engine; never auto-killed while cameras attached. `,V(`strong`,{className:`text-foreground`,children:`warm`}),`: benchmark/test override held in cache for fast re-use; auto-disposed after the idle TTL.`]}),a.isError&&I(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-[11px] text-destructive`,children:[`Kill failed:`,` `,a.error instanceof Error?a.error.message:`unknown`]})]})}R();var ht=new Set(_e);function gt(e){return ht.has(e)}function _t(e,t,n){return`${e}/${t}/${n}`}function vt(e){return{coreml:`CoreML`,openvino:`OpenVINO`,onnx:`ONNX`}[e.format]??e.format.toUpperCase()}function yt(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 Z(e){return e.format}function bt(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 xt({addonId:e,model:t,format:n,isActive:r,progress:i,errorMsg:a,onDownload:o,onDelete:s}){let c=t.formats[n];return c?I(`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:[V(`div`,{className:`h-2 w-2 rounded-full shrink-0 ${c.downloaded?`bg-success`:`bg-foreground-subtle/30`}`}),I(`div`,{className:`flex-1 min-w-0`,children:[I(`div`,{className:`flex items-center gap-2`,children:[V(`span`,{className:`text-sm font-medium text-foreground`,children:t.name}),I(`span`,{className:`text-[10px] text-foreground-subtle font-mono`,children:[`(`,t.id,`)`]})]}),i&&i.progress>=0&&i.progress<100&&I(`div`,{className:`mt-1.5 flex items-center gap-2 max-w-xs`,children:[V(`div`,{className:`flex-1 h-1 bg-surface-hover rounded-full overflow-hidden`,children:V(`div`,{className:`bg-primary h-full rounded-full transition-all duration-300`,style:{width:`${i.progress}%`}})}),I(`span`,{className:`text-[9px] text-primary font-mono tabular-nums shrink-0`,children:[Math.round(i.progress),`%`]})]})]}),V(`span`,{className:`text-xs text-foreground-subtle tabular-nums shrink-0`,children:We(c.sizeMB)}),a&&I(`span`,{className:`flex items-center gap-1 text-[10px] text-danger max-w-[160px] truncate shrink-0`,title:a,children:[V(ze,{className:`h-3 w-3 shrink-0`}),a]}),c.downloaded?I(`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?V(K,{className:`h-3 w-3 animate-spin`}):V(Be,{className:`h-3 w-3`}),r?`Deleting...`:`Delete`]}):I(`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?V(K,{className:`h-3 w-3 animate-spin`}):V(ve,{className:`h-3 w-3`}),r?`Downloading...`:`Download`]})]}):null}function St({engines:e,activeEngine:t,viewEngine:n,onSelect:r}){let[i,a]=F(!1);return I(`div`,{className:`relative`,children:[I(`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:[V(G,{className:`h-4 w-4 text-primary shrink-0`}),I(`div`,{className:`flex-1 min-w-0`,children:[I(`div`,{className:`flex items-center gap-2`,children:[V(`span`,{className:`text-sm font-medium text-foreground`,children:vt(n)}),Z(n)===Z(t)&&V(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded-full bg-success/10 text-success font-medium`,children:`Active`})]}),V(`div`,{className:`text-[10px] text-foreground-subtle`,children:yt(n)})]}),V(Ie,{className:`h-4 w-4 text-foreground-subtle transition-transform ${i?`rotate-180`:``}`})]}),i&&V(`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=Z(e)===Z(n),o=Z(e)===Z(t);return I(`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:[V(G,{className:`h-4 w-4 shrink-0 ${i?`text-primary`:`text-foreground-subtle`}`}),I(`div`,{className:`flex-1`,children:[I(`div`,{className:`flex items-center gap-2`,children:[V(`span`,{className:`text-sm font-medium ${i?`text-primary`:`text-foreground`}`,children:vt(e)}),o&&V(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded-full bg-success/10 text-success font-medium`,children:`Active`})]}),V(`div`,{className:`text-[10px] text-foreground-subtle`,children:yt(e)})]}),i&&V(Ne,{className:`h-4 w-4 text-primary shrink-0`})]},Z(e))})})]})}function Ct({embedded:e=!1,nodeId:t}={}){let n=B(),r=t??`hub`,[i,a]=F(null),[o,s]=F(new Set),[c,l]=F(new Map),[u,d]=F(new Map),[f,p]=F(``),{data:m=[]}=O({nodeId:r}),h=m.filter((e,t,n)=>n.findIndex(t=>t.format===e.format)===t),{data:g}=y({nodeId:r}),_=g,{data:v,isLoading:b}=le({nodeId:r}),x=ue(),C=oe();S(`model.download.progress`,e=>{let t=e.data,r=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;r===void 0||i===void 0||(l(e=>{let t=new Map(e);return i===100||i===-1?t.delete(r):t.set(r,{modelId:r,progress:i,totalMB:a}),t}),i===100&&n.invalidateQueries({queryKey:[[`pipelineExecutor`,`getSchema`]]}))});let w=_??{runtime:`node`,backend:`cpu`,format:`onnx`},T=h.find(e=>e.format===i)??w,E=T.format,D=v?.slots??[],k=D.map(e=>({...e,addons:e.addons.map(e=>({...e,models:e.models.filter(e=>e.formats[E]!==void 0)})).filter(e=>e.models.length>0)})).filter(e=>e.addons.length>0),A=bt(k,E),ee=pe(async(e,t,i)=>{if(!gt(i))return;let a=_t(e,t,i);s(e=>new Set([...e,a])),d(e=>{let t=new Map(e);return t.delete(a),t});try{await x.mutateAsync({addonId:e,modelId:t,format:i,nodeId:r}),n.invalidateQueries({queryKey:[[`pipelineExecutor`,`getSchema`]]})}catch(e){d(t=>new Map([...t,[a,e instanceof Error?e.message:`Download failed`]]))}finally{s(e=>{let t=new Set(e);return t.delete(a),t})}},[x,n,r]),te=pe(async(e,t,i)=>{if(!gt(i))return;let a=_t(e,t,i);s(e=>new Set([...e,a])),d(e=>{let t=new Map(e);return t.delete(a),t});try{await C.mutateAsync({addonId:e,modelId:t,format:i,nodeId:r}),n.invalidateQueries({queryKey:[[`pipelineExecutor`,`getSchema`]]})}catch(e){d(t=>new Map([...t,[a,e instanceof Error?e.message:`Delete failed`]]))}finally{s(e=>{let t=new Set(e);return t.delete(a),t})}},[C,n,r]),ne=pe(e=>{a(e.format)},[]),j=f.trim()?k.map(e=>({...e,addons:e.addons.map(e=>({...e,models:e.models.filter(t=>t.name.toLowerCase().includes(f.toLowerCase())||t.id.toLowerCase().includes(f.toLowerCase())||e.name.toLowerCase().includes(f.toLowerCase()))})).filter(e=>e.models.length>0)})).filter(e=>e.addons.length>0):k,M=I(z,{children:[b&&V(`div`,{className:`flex items-center justify-center py-16`,children:V(K,{className:`h-5 w-5 animate-spin text-foreground-subtle`})}),!b&&D.length===0&&I(`div`,{className:`flex flex-col items-center justify-center py-16 text-foreground-subtle`,children:[V(ye,{className:`h-8 w-8 mb-3 opacity-30`}),V(`span`,{className:`text-sm`,children:`No pipeline steps available`}),V(`span`,{className:`text-xs mt-1`,children:`Configure the detection pipeline to see available models.`})]}),!b&&D.length>0&&I(z,{children:[V(St,{engines:h,activeEngine:w,viewEngine:T,onSelect:ne}),I(`div`,{className:`flex items-center gap-4 text-xs text-foreground-subtle`,children:[I(`span`,{children:[V(`span`,{className:`font-semibold text-foreground tabular-nums`,children:A.total}),V(`span`,{className:`ml-1`,children:`compatible models`})]}),V(`span`,{className:`text-border`,children:`|`}),I(`span`,{children:[V(`span`,{className:`font-semibold text-success tabular-nums`,children:A.downloaded}),V(`span`,{className:`ml-1`,children:`downloaded`})]}),V(`span`,{className:`text-border`,children:`|`}),I(`span`,{className:`tabular-nums`,children:[We(A.downloadedSizeMB),V(`span`,{className:`ml-1`,children:`on disk`})]})]}),A.total>5&&I(`div`,{className:`relative`,children:[V(ke,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-foreground-subtle`}),V(`input`,{type:`text`,value:f,onChange:e=>p(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`})]}),j.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[E]?.downloaded).length,0);return I(`div`,{children:[I(`div`,{className:`flex items-center gap-2 mb-2`,children:[V(`h2`,{className:`text-sm font-semibold text-foreground`,children:e.label}),V(`div`,{className:`flex-1 h-px bg-border`}),I(`span`,{className:`text-[10px] text-foreground-subtle tabular-nums`,children:[n,`/`,t]})]}),V(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:e.addons.map(e=>e.models.map(t=>{let n=_t(e.id,t.id,E);return V(xt,{addonId:e.id,model:t,format:E,isActive:o.has(n),progress:c.get(t.id),errorMsg:u.get(n),onDownload:()=>ee(e.id,t.id,E),onDelete:()=>te(e.id,t.id,E)},`${e.id}/${t.id}`)}))})]},e.id)}),j.length===0&&V(`div`,{className:`text-center py-8 text-sm text-foreground-subtle`,children:f.trim()?I(z,{children:[`No models matching “`,f,`”`]}):I(z,{children:[`No models available for `,vt(T),` format`]})})]})]});return e?V(`div`,{className:`space-y-4`,children:M}):V(He,{children:M})}function wt({nodeId:e,refreshToken:t}){return V(Ct,{embedded:!0,nodeId:e})}R();function Tt({nodeId:e,title:t}){let{data:r}=Ue(),{data:i}=n(void 0),a=L(()=>{let e=new Map;for(let t of r??[])e.set(t.id,t.name);return e},[r]),o=L(()=>{if(!e)return null;let t=new Set;for(let n of i??[])n.agentNodeId===e&&t.add(n.deviceId);return t},[e,i]),[s,c]=F(new Map);S(`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}))}),H(()=>{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=L(()=>{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?I(`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`]}):I(`div`,{className:`rounded-md border border-border bg-surface px-3 py-2`,children:[I(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[V(`span`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle`,children:t??`Cameras`}),V(`span`,{className:`text-[10px] text-foreground-subtle`,children:l.length})]}),V(`div`,{className:`flex flex-wrap gap-1.5`,children:l.map(e=>{let t=a.get(e.deviceId)??`#${e.deviceId}`,n=ae(e.metrics.phase);return I(`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:[V(E,{phase:e.metrics.phase,className:`h-2.5 w-2.5`}),V(`span`,{className:`font-medium text-foreground/90 max-w-[120px] truncate`,children:t}),V(`span`,{className:`font-mono tabular-nums`,children:e.metrics.actualFps.toFixed(1)}),V(`span`,{className:`opacity-60`,children:`fps`})]},e.deviceId)})})]})}R();function Et(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 Dt({nodeId:e,refreshToken:t}){let n=B(),[r,i]=F(null),[a,o]=F(null),s=le({nodeId:e},{refetchOnMount:`always`}),c=ee({agentNodeId:e},{refetchOnMount:`always`}),l=()=>{n.invalidateQueries({queryKey:[[`addonSettings`]]}),n.invalidateQueries({queryKey:[[`pipelineOrchestrator`]]}),n.invalidateQueries({queryKey:[[`pipelineExecutor`]]})},f=d({onSuccess:l}),p=N({onSuccess:l}),m=s.data??null,h=c.data,g=m?.selectedEngine.format??`coreml`,_=L(()=>m?u(m):[],[m]),v=L(()=>[{agentNodeId:e,engineLabel:g}],[e,g]),y=(e,t)=>{let n=h?.addonDefaults[e];return!Et(m,e)?.models.some(e=>!!e.formats[g])||!n?{kind:`na`}:n.enabled?{kind:`enabled`,modelId:n.modelId}:{kind:`disabled`}},x=r&&m?Et(m,r.addonId):null,S=t=>{let n=h?.addonDefaults[t]??null;i({addonId:t,agentNodeId:e}),o(n)},C=(t,n)=>{if(!h)return;let r=h.addonDefaults[t],i=Et(m,t);if(!r&&!i)return;let a={enabled:n,modelId:r?.modelId??i?.defaultModelId??``,settings:r?.settings??{}};f.mutate({agentNodeId:e,defaults:{...h.addonDefaults,[t]:a}})},T=()=>{i(null),o(null)},E=()=>{!a||!r||!h||f.mutate({agentNodeId:e,defaults:{...h.addonDefaults,[r.addonId]:a}},{onSuccess:T})};if(s.isLoading||c.isLoading)return V(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading pipeline…`});if(s.error)return I(`div`,{className:`text-xs text-red-400`,children:[`Failed to load catalog: `,String(s.error)]});if(!m)return V(`div`,{className:`text-xs text-foreground-subtle`,children:`Catalog unavailable for this node (runner offline?).`});let D=r!==null&&x!==null&&a!==null,O=c.data?.maxCameras??null;return I(`div`,{className:`relative h-full w-full space-y-3`,children:[V(Tt,{nodeId:e}),I(`div`,{className:`flex items-center gap-3 text-xs text-foreground`,children:[V(`label`,{htmlFor:`max-cameras-${e}`,className:`font-medium text-muted-foreground whitespace-nowrap`,children:`Max cameras (0 = unlimited)`}),V(`input`,{id:`max-cameras-${e}`,type:`number`,min:0,step:1,defaultValue:O??0,onBlur:t=>{let n=t.target.value.trim(),r=n===``?0:Number.parseInt(n,10),i=Number.isNaN(r)||r<=0?null:r;p.mutate({agentNodeId:e,maxCameras:i})},disabled:p.isPending,className:`w-20 rounded border border-border bg-surface px-2 py-0.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary disabled:opacity-50`},O??`unlimited`),p.isPending&&V(`span`,{className:`text-[10px] text-muted-foreground animate-pulse`,children:`Saving…`}),p.isError&&I(`span`,{className:`text-[10px] text-destructive`,children:[`Save failed: `,p.error instanceof Error?p.error.message:``]})]}),V(`div`,{className:D?`pr-[360px]`:``,children:_.length>0?V(b,{tree:_,agents:v,getCellState:y,onCellClick:S,selectedCell:r,onToggleEnabled:C}):V(`div`,{className:`text-xs text-foreground-subtle`,children:`Catalog empty.`})}),V(M,{open:D,onClose:T,title:x?.name??``,subtitle:r?`${r.agentNodeId} · ${g}`:``,footer:I(z,{children:[V(`button`,{type:`button`,className:`px-3 py-1 text-xs border border-border rounded bg-surface hover:bg-muted`,onClick:T,children:`Cancel`}),V(`button`,{type:`button`,disabled:!a||!r||f.isPending,className:`px-3 py-1 text-xs bg-primary text-primary-foreground rounded disabled:opacity-50`,onClick:E,children:f.isPending?`Saving…`:`Save`})]}),children:x&&a&&r&&V(w,{mode:`agent`,addon:x,agentDefault:a,agentNodeId:r.agentNodeId,engineFormat:g,onChangeAgentConfig:e=>o(e)})})]})}var Ot=[`detection-pipeline`,`decoder-nodeav`,`audio-analyzer`,`pipeline-runner`];function kt({nodeId:e,refreshToken:t}){return I(`div`,{className:`flex flex-col h-full`,children:[V(et,{nodeId:e,refreshToken:t}),V(`div`,{className:`flex-1 min-h-0 overflow-y-auto p-6`,children:V(Ge,{nodeId:e,addonIds:Ot,level:`global`,extraTabs:[{id:`assignments`,label:`Assignments`,order:-10,content:V(ft,{nodeId:e,refreshToken:t})},{id:`tree`,label:`Pipeline`,order:39,content:V(Dt,{nodeId:e,refreshToken:t})},{id:`engines`,label:`Warm instances`,order:180,content:V(mt,{nodeId:e,refreshToken:t})},{id:`models`,label:`Models`,order:200,content:V(wt,{nodeId:e,refreshToken:t})}]})})]})}function At({refreshToken:e}){let t=B(),n=x({onSuccess:()=>{t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getPipelineAssignments`]]}),t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getDecoderAssignments`]]}),t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getAudioAssignments`]]})}});return I(`div`,{className:`space-y-6`,children:[V(tt,{refreshToken:e}),I(`div`,{className:`flex flex-col gap-3 @md/clustertab:flex-row @md/clustertab:items-center @md/clustertab:justify-between`,children:[I(`div`,{className:`min-w-0`,children:[V(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Placement matrix`}),V(`p`,{className:`text-[11px] text-foreground-subtle`,children:`Pipeline · decoder · audio assignments per camera. Click the kebab to pin / unpin / move any role; expand the chevron for the per-camera broker drill-down.`})]}),I(`button`,{type:`button`,onClick:()=>n.mutate(void 0),disabled:n.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:[V(Te,{className:`h-3.5 w-3.5`}),n.isPending?`Rebalancing…`:`Rebalance pipelines`]})]}),V(ot,{mode:`cluster`})]})}var jt=[`pipeline-orchestrator`];function Mt({refreshToken:e}){return V(`div`,{className:`space-y-4 max-w-3xl`,children:V(Ge,{nodeId:`hub`,addonIds:jt,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.`})})}R();function Nt({refreshToken:e}){let t=B(),{data:n,isLoading:r}=s(),[i,a]=F(null),[o,c]=F(``),[l,u]=F(``),d=()=>{t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`listTemplates`]]})},f=ie({onSuccess:()=>{a(null),d()}}),p=te({onSuccess:d}),m=e=>{a(e.id),c(e.name),u(e.description??``)},h=()=>{a(null),c(``),u(``)},g=()=>{if(!i)return;let e=l.trim();f.mutate({id:i,name:o.trim()||`Untitled`,...e?{description:e}:{}})};if(r)return V(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading templates…`});let _=[...n??[]].toSorted((e,t)=>e.name.localeCompare(t.name));return V(`div`,{className:`space-y-6 max-w-4xl`,children:I(`section`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[I(`div`,{className:`border-b border-border px-4 py-3 flex items-center justify-between`,children:[I(`div`,{children:[V(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Templates`}),V(`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.`})]}),I(`div`,{className:`text-[11px] text-foreground-subtle`,children:[_.length,` template`,_.length===1?``:`s`]})]}),_.length===0?I(`div`,{className:`px-4 py-8 text-xs text-foreground-subtle flex flex-col items-center gap-2`,children:[V(De,{className:`h-6 w-6 opacity-40`}),V(`div`,{children:`No templates yet. Create one from a device Pipeline tab ("Save as template").`})]}):V(`ul`,{className:`divide-y divide-border`,children:_.map(e=>{let t=i===e.id;return V(`li`,{className:`px-4 py-3 text-xs`,children:I(`div`,{className:`flex items-start gap-3`,children:[V(`div`,{className:`flex-1 min-w-0`,children:t?I(`div`,{className:`space-y-2`,children:[V(`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=>c(e.target.value),placeholder:`Template name`,autoFocus:!0}),V(`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:l,onChange:e=>u(e.target.value),placeholder:`Description (optional)`})]}):I(z,{children:[V(`div`,{className:`font-medium text-foreground`,children:e.name}),e.description&&V(`div`,{className:`text-foreground-subtle mt-0.5`,children:e.description}),I(`div`,{className:`mt-1 font-mono text-[10px] text-foreground-subtle`,children:[`engine `,e.config.engine.runtime,`/`,e.config.engine.backend,` ·`,` `,e.config.steps.length,` step(s)`,e.config.audio?.enabled?` · audio`:``,I(`span`,{className:`ml-2`,children:[`updated `,new Date(e.updatedAt).toLocaleString()]})]})]})}),V(`div`,{className:`flex items-center gap-1 shrink-0`,children:t?I(z,{children:[I(`button`,{type:`button`,onClick:g,disabled:f.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:[V(Pe,{className:`h-3 w-3`}),`Save`]}),I(`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:[V(Re,{className:`h-3 w-3`}),`Cancel`]})]}):I(z,{children:[V(`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:V(Ee,{className:`h-3 w-3`})}),V(`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:V(Be,{className:`h-3 w-3`})})]})})]})},e.id)})})]})})}R();function Pt(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 Ft({nodeId:e,refreshToken:t}){let n=B(),r=ge().trpcClient,[i,a]=F(null),[o,s]=F(null),c=C(void 0,{refetchOnMount:`always`});q([`nodes`,`topology`],[`agent.online`,`agent.offline`,`agent.unregistered`,`addon.installed`,`addon.uninstalled`,`addon.updated`]);let l=A(void 0,{refetchOnMount:`always`}),f=L(()=>{let e=new Set;for(let t of l.data??[])t.isOnline&&e.add(t.id);return e},[l.data]),p=le({nodeId:e},{refetchOnMount:`always`}),m=L(()=>(c.data??[]).filter(e=>f.has(e.nodeId)).map(e=>e.nodeId),[c.data,f]),h=he({enabled:m.length>0,queryKey:[[`pipelineExecutor`,`getSchema`],`schema-by-agent`,m.join(`,`),t],queryFn:async()=>{let e={};for(let t of m)try{e[t]=(await r.pipelineExecutor.getSchema.query({nodeId:t})).selectedEngine.format}catch{e[t]=`coreml`}return e}}),g=d({onSuccess:()=>{n.invalidateQueries({queryKey:[[`pipelineOrchestrator`]]}),n.invalidateQueries({queryKey:[[`pipelineExecutor`]]}),n.invalidateQueries({queryKey:[[`addonSettings`]]})}}),_=L(()=>p.data?u(p.data):[],[p.data]),v=L(()=>{let e=c.data??[],t=f;return(t.size===0?[]:e.filter(e=>t.has(e.nodeId))).map(e=>{let t=h.data?.[e.nodeId];return{agentNodeId:e.nodeId,engineLabel:t??`(engine unknown)`}})},[c.data,h.data,f]),y=(e,t)=>{let n=(c.data?.find(e=>e.nodeId===t))?.settings.addonDefaults[e],r=h.data?.[t];return!Pt(p.data??null,e)?.models.some(e=>r!==void 0&&!!e.formats[r])||!n?{kind:`na`}:n.enabled?{kind:`enabled`,modelId:n.modelId}:{kind:`disabled`}},x=i?c.data?.find(e=>e.nodeId===i.agentNodeId)??null:null,S=i&&p.data?Pt(p.data,i.addonId):null,T=i?h.data?.[i.agentNodeId]??`coreml`:`coreml`,E=()=>{a(null),s(null)},D=(e,t)=>{let n=(c.data?.find(e=>e.nodeId===t))?.settings.addonDefaults[e]??null;a({addonId:e,agentNodeId:t}),s(n)},O=()=>{!o||!i||!x||g.mutate({agentNodeId:i.agentNodeId,defaults:{...x.settings.addonDefaults,[i.addonId]:o}},{onSuccess:E})};if(c.isLoading||p.isLoading)return V(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading agents…`});if(!p.data)return I(`div`,{className:`text-xs text-foreground-subtle`,children:[`Catalog unavailable for `,e,`.`]});let k=i!==null&&S!==null&&o!==null;return I(`div`,{className:`relative h-full w-full space-y-3`,children:[V(Tt,{title:`Cluster cameras`}),V(`div`,{className:k?`pr-[360px]`:``,children:_.length>0&&v.length>0?V(b,{tree:_,agents:v,getCellState:y,onCellClick:D,selectedCell:i}):V(`div`,{className:`text-xs text-foreground-subtle`,children:`No agents or catalog empty.`})}),V(M,{open:k,onClose:E,title:S?.name??``,subtitle:i?`${i.agentNodeId} · ${T}`:``,footer:I(z,{children:[V(`button`,{type:`button`,className:`px-3 py-1 text-xs border border-border rounded bg-surface hover:bg-muted`,onClick:E,children:`Cancel`}),V(`button`,{type:`button`,disabled:!o||!i||g.isPending,className:`px-3 py-1 text-xs bg-primary text-primary-foreground rounded disabled:opacity-50`,onClick:O,children:g.isPending?`Saving…`:`Save`})]}),children:S&&o&&i&&V(w,{mode:`agent`,addon:S,agentDefault:o,agentNodeId:i.agentNodeId,engineFormat:T,onChangeAgentConfig:e=>s(e)})})]})}R();function It({types:e}){let t=B(),n=h(),{data:r}=re({}),i=j(),a=L(()=>i.data??[],[i.data]),[o,s]=F(null),[c,l]=F(null),u=()=>{t.invalidateQueries({queryKey:[[`storage`,`listLocations`]]})},d=ne({onSuccess:u}),f=D({onSuccess:u}),p=L(()=>{let e=new Map;for(let t of r??[]){let n=e.get(t.type);n?n.push(t):e.set(t.type,[t])}return e},[r]),m=e=>{e.isDefault||d.mutate({id:e.id,type:e.type,providerId:e.providerId,displayName:e.displayName,config:e.config,isDefault:!0})},g=async e=>{if(e.isDefault){await n({title:`Cannot delete default location`,message:`"${e.displayName}" is the default for type "${e.type}". Mark another as default first.`,confirmLabel:`OK`,variant:`warning`});return}await n({title:`Delete location "${e.displayName}"?`,message:`Removes the record; files on disk are untouched.`,confirmLabel:`Delete`,variant:`danger`})&&f.mutate({id:e.id})},_=e.map(e=>a.find(t=>t.id===e)).filter(e=>e!==void 0);return I(`div`,{className:`space-y-3`,children:[_.length===0?V(`p`,{className:`text-[11px] text-foreground-subtle italic`,children:`No storage locations declared for this purpose.`}):_.map(e=>V(xe,{type:e.id,displayName:e.displayName,description:e.description,cardinality:e.cardinality,locations:p.get(e.id)??[],onAdd:e=>s(e),onEdit:e=>l(e),onDelete:e=>{g(e)},onSetDefault:e=>m(e)},e.id)),o!==null&&V(Se,{initialType:o,onClose:()=>s(null),onCreated:()=>{u(),s(null)}}),c!==null&&V(be,{location:c,onClose:()=>l(null),onSaved:()=>{u(),l(null)}})]})}R();var Lt=`pipeline-analytics`;function Rt(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 zt(){let e=B(),{data:t}=A(void 0),{data:n,isLoading:r}=l({addonId:Lt}),i=Rt(n),a=T({onSuccess:()=>{e.invalidateQueries({queryKey:[[`addonSettings`,`getGlobalSettings`]]})}}),o=L(()=>{let e=(t??[]).filter(e=>e.isOnline).map(e=>e.id);return[...new Set([`hub`,i,...e])].filter(Boolean)},[t,i]);return I(`div`,{className:`flex flex-col gap-6`,children:[I(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[V(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Post-processing node`}),V(`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.`}),I(`div`,{className:`mt-3 flex items-center gap-2`,children:[r?V(K,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):V(`select`,{value:i,onChange:e=>{e.target.value!==i&&a.mutate({addonId:Lt,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=>V(`option`,{value:e,children:e===`hub`?`hub (default)`:e},e))}),a.isPending&&V(K,{className:`h-4 w-4 animate-spin text-primary`})]})]}),I(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[V(`h3`,{className:`mb-1 text-sm font-semibold text-foreground`,children:`Events folder`}),V(`p`,{className:`mb-3 text-[11px] text-foreground-subtle`,children:`Where event crops / full frames are stored. A single folder — no collection / equal-splitting.`}),V(It,{types:[`eventMedia`]})]})]})}R();var Bt=`recorder`;function Vt(e,t,n){for(let n of e?.sections??[])for(let e of n.fields??[])if(e.key===t&&typeof e.value==`string`)return e.value;return n}function Ht(){let e=B(),{data:t}=A(void 0),{data:n,isLoading:r}=l({addonId:Bt}),i=Vt(n,`recordingNodeId`,`hub`),a=T({onSuccess:()=>{e.invalidateQueries({queryKey:[[`addonSettings`,`getGlobalSettings`]]})}}),o=L(()=>{let e=(t??[]).filter(e=>e.isOnline).map(e=>e.id);return[...new Set([`hub`,i,...e])].filter(Boolean)},[t,i]);return I(`div`,{className:`flex flex-col gap-6`,children:[I(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[V(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Recording node`}),V(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`The single node that records (continuous & events) and serves playback. Every other node stays inert — no multi-node balancing. Takes effect on addon restart.`}),I(`div`,{className:`mt-3 flex items-center gap-2`,children:[r?V(K,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):V(`select`,{value:i,onChange:e=>{e.target.value!==i&&a.mutate({addonId:Bt,patch:{recordingNodeId: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=>V(`option`,{value:e,children:e===`hub`?`hub (default)`:e},e))}),a.isPending&&V(K,{className:`h-4 w-4 animate-spin text-primary`})]}),i!==`hub`&&I(`p`,{className:`mt-2 text-[11px] text-amber-500`,children:[`The stream-broker is hub-only — an agent recorder pulls streams from the hub over the network. The hub's RTSP restream port must be reachable from`,` `,V(`span`,{className:`font-medium`,children:i}),`. If the auto-derived host doesn't work, set the recorder's`,V(`span`,{className:`font-medium`,children:` recordingHubHostname`}),` global setting.`]})]}),I(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[V(`h3`,{className:`mb-1 text-sm font-semibold text-foreground`,children:`Recordings folders`}),V(`p`,{className:`mb-3 text-[11px] text-foreground-subtle`,children:`Where recordings are stored. Multi-location collections — segments are split across the locations of a type. Add a location to grow capacity; mark one default per type.`}),V(It,{types:[`recordings`,`recordingsLow`]})]})]})}R();var Ut=[{id:`assignments`,label:`Assignments`},{id:`pipeline`,label:`Pipeline`},{id:`events`,label:`Events`},{id:`recording`,label:`Recording`},{id:`settings`,label:`Settings`},{id:`templates`,label:`Templates`}];function Wt({refreshToken:e}){let[t,n]=F(`assignments`),{data:r}=A(void 0),i=r?.find(e=>e.isHub&&e.isOnline)?.id??r?.find(e=>e.isOnline)?.id??null;return I(`div`,{className:`flex flex-col h-full`,children:[I(`div`,{className:`px-4 sm:px-6 py-4 border-b border-border`,children:[V(`h2`,{className:`text-base font-semibold text-foreground`,children:`Cluster Orchestration`}),V(`div`,{className:`text-[11px] text-foreground-subtle mt-1`,children:`Assignments with live load, cluster-wide settings, pipeline template library, per-camera pipeline overrides.`})]}),V(`div`,{className:`flex items-center gap-1 px-4 sm:px-6 border-b border-border overflow-x-auto`,children:Ut.map(e=>V(`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))}),I(`div`,{className:`flex-1 min-h-0 overflow-y-auto p-4 sm:p-6 @container/clustertab`,children:[t===`assignments`&&V(At,{refreshToken:e}),t===`pipeline`&&(i?V(Ft,{nodeId:i,refreshToken:e}):V(`div`,{className:`text-xs text-foreground-subtle`,children:`No online node available — schema unreachable.`})),t===`events`&&V(zt,{}),t===`recording`&&V(Ht,{}),t===`settings`&&V(Mt,{refreshToken:e}),t===`templates`&&V(Nt,{refreshToken:e})]})]})}function Gt(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`}R();var Kt={healthy:`bg-green-500`,idle:`bg-yellow-400`,error:`bg-red-500`},qt={healthy:`Healthy`,idle:`Idle`,error:`Error`};function Jt({health:e}){return V(`span`,{className:`inline-block h-2 w-2 rounded-full shrink-0 ${Kt[e]}`,title:qt[e],"aria-label":qt[e],role:`img`})}function Yt({selectedDeviceId:e,onSelect:t}){let{data:n}=Ue(),{data:r}=c({}),i=L(()=>{let e=new Map;for(let t of r??[])e.set(t.deviceId,t);return e},[r]),a=L(()=>(n??[]).filter(e=>e.isCamera).map(e=>{let t=i.get(e.id);return{deviceId:e.id,name:e.name,health:t===void 0?`idle`:Gt(t)}}),[n,i]);return a.length===0?V(`div`,{className:`px-4 py-6 text-center text-[11px] text-foreground-subtle italic`,children:`No cameras found`}):V(`ul`,{className:`divide-y divide-border`,children:a.map(n=>{let r=n.deviceId===e;return V(`li`,{children:I(`button`,{type:`button`,onClick:()=>t(n.deviceId),className:[`w-full flex items-center gap-2.5 px-4 py-3 text-left transition-colors`,r?`bg-surface-active text-foreground`:`hover:bg-surface-hover text-foreground-subtle hover:text-foreground`].join(` `),"aria-pressed":r,children:[V(Jt,{health:n.health}),I(`span`,{className:`flex-1 min-w-0`,children:[V(`span`,{className:`block truncate text-[12px] font-medium leading-tight`,children:n.name}),I(`span`,{className:`block text-[10px] text-foreground-subtle leading-tight mt-0.5`,children:[`#`,n.deviceId]})]})]})},n.deviceId)})})}var Q={camera:0,source:200,broker:400,decoder:600,motion:800,detection:800,audio:800,recorder:800},$=120;function Xt(e,t){return e===null||t===null?!1:e!==t}function Zt(e){let t=e.profiles.reduce((e,t)=>e+t.subscribers,0),n=e.profiles.reduce((e,t)=>e+t.inFps,0),r=e.profiles.reduce((e,t)=>e+t.outFps,0);return`${t} subs · ${n.toFixed(1)}→${r.toFixed(1)} fps`}function Qt(e){return`${e.actualFps.toFixed(1)} fps · q${e.queueDepth} · ${e.avgInferenceMs.toFixed(1)}ms`}function $t(e){return`shm ${e.shm.getFrameHits+e.shm.getFrameMisses>0?Math.round(e.shm.getFrameHits/(e.shm.getFrameHits+e.shm.getFrameMisses)*100):0}% hit`}function en(e){let t=[],n=[],r={id:`camera`,kind:`camera`,nodeId:null,data:{deviceId:e.deviceId},position:{x:Q.camera,y:0}};t.push(r);let i={id:`source`,kind:`source`,nodeId:null,data:{streams:e.source.streams},position:{x:Q.source,y:0}};t.push(i),n.push({id:`camera->source`,source:`camera`,target:`source`,crossNode:!1});let a=e.broker;if(a!==null){let e={id:`broker`,kind:`broker`,nodeId:null,data:{profiles:a.profiles,webrtcSessions:a.webrtcSessions,rtspRestream:a.rtspRestream},position:{x:Q.broker,y:0}};t.push(e),n.push({id:`source->broker`,source:`source`,target:`broker`,crossNode:!1})}let o=e.decoder;if(o!==null){let r={id:`decoder`,kind:`decoder`,nodeId:o.nodeId,data:{nodeId:o.nodeId,formats:o.formats,sessionCount:o.sessionCount,shm:o.shm},position:{x:Q.decoder,y:0}};t.push(r);let i=a===null?`source`:`broker`,s=a===null?void 0:Zt(a),c=a===null?$t(o):s;n.push({id:`${i}->decoder`,source:i,target:`decoder`,crossNode:Xt(null,o.nodeId),...c===void 0?{}:{label:c}});let l=0,u=e.motion;if(u!==null){let e={id:`motion`,kind:`motion`,nodeId:null,data:{enabled:u.enabled,fps:u.fps},position:{x:Q.motion,y:l*$}};t.push(e),n.push({id:`decoder->motion`,source:`decoder`,target:`motion`,crossNode:!1}),l++}let d=e.detection;if(d!==null){let e={id:`detection`,kind:`detection`,nodeId:d.nodeId,data:{nodeId:d.nodeId,engine:d.engine,phase:d.phase,configuredFps:d.configuredFps,actualFps:d.actualFps,queueDepth:d.queueDepth,avgInferenceMs:d.avgInferenceMs,provisioning:d.provisioning},position:{x:Q.detection,y:l*$}};t.push(e),n.push({id:`decoder->detection`,source:`decoder`,target:`detection`,crossNode:Xt(o.nodeId,d.nodeId),label:Qt(d)}),l++}let f=e.audio;if(f!==null){let e={id:`audio`,kind:`audio`,nodeId:f.nodeId,data:{nodeId:f.nodeId,enabled:f.enabled},position:{x:Q.audio,y:l*$}};t.push(e),n.push({id:`decoder->audio`,source:`decoder`,target:`audio`,crossNode:Xt(o.nodeId,f.nodeId)}),l++}let p=e.recording;if(p!==null){let e={id:`recorder`,kind:`recorder`,nodeId:null,data:{mode:p.mode,active:p.active,storageBytes:p.storageBytes},position:{x:Q.recorder,y:l*$}};t.push(e),n.push({id:`decoder->recorder`,source:`decoder`,target:`recorder`,crossNode:!1})}}return{nodes:t,edges:n}}R();function tn(e){let{data:t,isLoading:n}=o({deviceId:e}),[r,i]=F(void 0);return H(()=>{t!==void 0&&i(t)},[t]),S(U.PipelineCameraMetricsSnapshot,t=>{let n=t.data;n.deviceId===e&&i(e=>e===void 0||e.detection===null?e:{...e,detection:{...e.detection,phase:n.metrics.phase,actualFps:n.metrics.actualFps,queueDepth:n.metrics.queueDepth,avgInferenceMs:n.metrics.avgInferenceTimeMs}})}),S(U.PipelineEngineProvisioning,e=>{let t=e.data;i(n=>{if(n===void 0||n.detection===null)return n;let r=n.detection.nodeId??n.assignment?.detectionNodeId??null;return r===null||e.source.type!==`node`||e.source.id!==r?n:{...n,detection:{...n.detection,provisioning:{state:t.state,error:t.error}}}})}),S(U.MotionAnalysis,t=>{t.source.type!==`device`||t.source.id!==e||i(e=>e===void 0||e.motion===null?e:{...e,motion:{...e.motion,enabled:!0}})}),S(U.StreamBrokerMetricsSnapshot,t=>{let n=t.data;n.deviceId===e&&i(e=>e===void 0||e.broker===null?e:{...e,broker:{...e.broker,profiles:e.broker.profiles.map(e=>e.profile===n.profile?{...e,subscribers:n.stats.encodedSubscribers+n.stats.decodedSubscribers,inFps:n.stats.inputFps,outFps:n.stats.decodeFps}:e)}})}),S(U.PipelineAudioInferenceResult,t=>{t.data.deviceId===e&&i(e=>e===void 0||e.audio===null?e:{...e,audio:{...e.audio,enabled:!0}})}),S(U.RecordingStarted,t=>{t.data.deviceId===e&&i(e=>e===void 0||e.recording===null?e:{...e,recording:{...e.recording,active:!0}})}),S(U.RecordingStopped,t=>{t.data.deviceId===e&&i(e=>e===void 0||e.recording===null?e:{...e,recording:{...e.recording,active:!1}})}),{status:r,isLoading:n}}function nn({data:e}){return I(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[160px] px-3 py-2`,children:[V(Y,{type:`source`,position:J.Right}),I(`div`,{className:`flex items-center gap-2`,children:[V(`span`,{className:`h-2 w-2 rounded-full bg-green-500 shrink-0`,"aria-label":`healthy`}),I(`span`,{className:`text-sm font-semibold truncate`,children:[`Camera #`,e.deviceId]})]}),V(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`source`})]})}function rn(e){return e>0?`bg-green-500`:`bg-yellow-500`}function an({data:e}){let t=e.streams[0],n=e.streams.length;return I(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[160px] px-3 py-2`,children:[V(Y,{type:`target`,position:J.Left}),V(Y,{type:`source`,position:J.Right}),I(`div`,{className:`flex items-center gap-2`,children:[V(`span`,{className:`h-2 w-2 rounded-full shrink-0 ${rn(n)}`,"aria-label":n>0?`healthy`:`idle`}),V(`span`,{className:`text-sm font-semibold`,children:`Source`}),I(`span`,{className:`text-xs text-muted-foreground`,children:[n,` streams`]})]}),t!==void 0&&I(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[t.codec,` `,t.width,`×`,t.height,` `,t.fps,`fps`]})]})}function on(e){return e>0?`bg-green-500`:`bg-yellow-500`}function sn({data:e}){let t=e.profiles.reduce((e,t)=>e+t.subscribers,0),n=e.profiles.length;return I(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[160px] px-3 py-2`,children:[V(Y,{type:`target`,position:J.Left}),V(Y,{type:`source`,position:J.Right}),I(`div`,{className:`flex items-center gap-2`,children:[V(`span`,{className:`h-2 w-2 rounded-full shrink-0 ${on(t)}`,"aria-label":t>0?`healthy`:`idle`}),V(`span`,{className:`text-sm font-semibold`,children:`Broker`}),I(`span`,{className:`text-xs text-muted-foreground`,children:[n,` profiles`]})]}),I(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[t,` subs · WebRTC `,e.webrtcSessions,e.rtspRestream&&` · RTSP`]})]})}function cn(e){return e>0?`bg-green-500`:`bg-yellow-500`}function ln(e,t){let n=e+t;return n>0?Math.round(e/n*100):0}function un({data:e}){let t=ln(e.shm.getFrameHits,e.shm.getFrameMisses);return I(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[160px] px-3 py-2`,children:[V(Y,{type:`target`,position:J.Left}),V(Y,{type:`source`,position:J.Right}),I(`div`,{className:`flex items-center gap-2`,children:[V(`span`,{className:`h-2 w-2 rounded-full shrink-0 ${cn(e.sessionCount)}`,"aria-label":e.sessionCount>0?`healthy`:`idle`}),V(`span`,{className:`text-sm font-semibold`,children:`Decoder`}),I(`span`,{className:`text-xs text-muted-foreground`,children:[`@`,e.nodeId]})]}),I(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[e.formats.join(`, `),` · `,e.sessionCount,` sessions`]}),I(`div`,{className:`text-xs text-muted-foreground`,children:[`shm `,t,`% hit`]})]})}function dn(e){return e?`bg-green-500`:`bg-yellow-500`}function fn({data:e}){return I(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[160px] px-3 py-2`,children:[V(Y,{type:`target`,position:J.Left}),I(`div`,{className:`flex items-center gap-2`,children:[V(`span`,{className:`h-2 w-2 rounded-full shrink-0 ${dn(e.enabled)}`,"aria-label":e.enabled?`enabled`:`disabled`}),V(`span`,{className:`text-sm font-semibold`,children:`Motion`})]}),I(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[e.enabled?`enabled`:`disabled`,` · `,e.fps,` fps`]})]})}function pn(e){return e.provisioning.state===`failed`?`bg-red-500`:e.phase===`active`?`bg-green-500`:(e.phase,`bg-yellow-500`)}function mn(e){return e===`ready`?`bg-green-500 text-white`:e===`failed`?`bg-red-500 text-white`:`bg-yellow-500 text-white`}function hn({data:e}){return I(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[180px] px-3 py-2`,children:[V(Y,{type:`target`,position:J.Left}),I(`div`,{className:`flex items-center gap-2`,children:[V(`span`,{className:`h-2 w-2 rounded-full shrink-0 ${pn(e)}`,"aria-label":e.phase}),V(`span`,{className:`text-sm font-semibold`,children:`Detection`}),I(`span`,{className:`text-xs text-muted-foreground`,children:[`@`,e.nodeId]})]}),I(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[e.engine.backend,`·`,e.engine.device,` · `,e.phase]}),I(`div`,{className:`text-xs text-muted-foreground`,children:[e.actualFps.toFixed(1),`/`,e.configuredFps,` fps · q`,e.queueDepth,` ·`,` `,e.avgInferenceMs.toFixed(1),`ms`]}),I(`div`,{className:`flex items-center gap-1 mt-1`,children:[V(`span`,{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded ${mn(e.provisioning.state)}`,"aria-label":`provisioning ${e.provisioning.state}`,children:e.provisioning.state}),e.provisioning.state===`failed`&&e.provisioning.error!==void 0&&V(`span`,{className:`text-[10px] text-red-500 truncate`,children:e.provisioning.error})]})]})}function gn(e){return e?`bg-green-500`:`bg-yellow-500`}function _n({data:e}){return I(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[160px] px-3 py-2`,children:[V(Y,{type:`target`,position:J.Left}),I(`div`,{className:`flex items-center gap-2`,children:[V(`span`,{className:`h-2 w-2 rounded-full shrink-0 ${gn(e.enabled)}`,"aria-label":e.enabled?`enabled`:`disabled`}),V(`span`,{className:`text-sm font-semibold`,children:`Audio`}),I(`span`,{className:`text-xs text-muted-foreground`,children:[`@`,e.nodeId]})]}),V(`div`,{className:`text-xs text-muted-foreground mt-1`,children:e.enabled?`enabled`:`disabled`})]})}function vn(e){return e.mode===`off`?`bg-red-500`:e.active?`bg-green-500`:`bg-yellow-500`}function yn(e){return e>=1073741824?`${(e/1073741824).toFixed(1)} GB`:`${(e/1048576).toFixed(1)} MB`}function bn({data:e}){return I(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[160px] px-3 py-2`,children:[V(Y,{type:`target`,position:J.Left}),I(`div`,{className:`flex items-center gap-2`,children:[V(`span`,{className:`h-2 w-2 rounded-full shrink-0 ${vn(e)}`,"aria-label":e.active?`active`:e.mode===`off`?`off`:`inactive`}),V(`span`,{className:`text-sm font-semibold`,children:`Recorder`}),V(`span`,{className:`text-xs text-muted-foreground`,children:e.mode})]}),I(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[e.active?`active`:`inactive`,` · `,yn(e.storageBytes)]})]})}R();var xn={camera:nn,source:an,broker:sn,decoder:un,motion:fn,detection:hn,audio:_n,recorder:bn},Sn={stroke:`#f59e0b`,strokeWidth:2},Cn={strokeWidth:1.5};function wn({deviceId:e}){let{status:t,isLoading:n}=tn(e),{rfNodes:r,rfEdges:i}=L(()=>{if(t===void 0)return{rfNodes:[],rfEdges:[]};let e=en(t);return{rfNodes:e.nodes.map(e=>({id:e.id,type:e.kind,position:{x:e.position.x,y:e.position.y},data:{...e.data}})),rfEdges:e.edges.map(e=>({id:e.id,source:e.source,target:e.target,animated:e.crossNode,style:e.crossNode?Sn:Cn,label:e.label}))}},[t]);return n?V(`div`,{className:`flex items-center justify-center h-full text-sm text-muted-foreground`,children:`Loading…`}):t===void 0?V(`div`,{className:`flex items-center justify-center h-full text-sm text-muted-foreground`,children:`No pipeline data`}):V(`div`,{className:`w-full h-full`,children:I(Ke,{nodes:r,edges:i,nodeTypes:xn,fitView:!0,proOptions:{hideAttribution:!0},children:[V(Je,{gap:20,size:1}),V(qe,{showInteractive:!1})]})})}R();var Tn=`__cluster__`;function En(e){return e===`cameras`?`cameras`:`nodes`}function Dn(){let[e,t]=Le(),n=En(e.get(`view`)),r=e.get(`node`)??`__cluster__`,i=e.get(`camera`),a=i===null?null:parseInt(i,10),[o,s]=F(0);return H(()=>{n===`nodes`&&!e.get(`node`)&&t({view:`nodes`,node:Tn},{replace:!0})},[n,e,t]),I(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[I(`div`,{className:`flex items-center justify-between gap-4 px-4 py-3 border-b border-border shrink-0`,children:[I(`div`,{className:`flex items-center gap-1 rounded-lg border border-border p-0.5 bg-surface`,children:[V(`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`}),V(`button`,{type:`button`,onClick:()=>{let e={view:`cameras`};a!==null&&(e.camera=String(a)),t(e,{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`})]}),I(`button`,{type:`button`,onClick:()=>s(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:[V(Oe,{className:`h-3.5 w-3.5`}),`Refresh`]})]}),V(`div`,{className:`flex-1 flex flex-col md:flex-row overflow-hidden min-h-0`,children:n===`nodes`?I(z,{children:[V(`aside`,{className:`w-full md:w-72 shrink-0 border-b md:border-b-0 md:border-r border-border overflow-y-auto`,children:V($e,{selectedNodeId:r,onSelect:e=>{t({view:`nodes`,node:e},{replace:!0})},refreshToken:o})}),V(`section`,{className:`flex-1 min-h-0 overflow-hidden`,children:r===`__cluster__`?V(Wt,{refreshToken:o}):V(kt,{nodeId:r,refreshToken:o})})]}):I(z,{children:[V(`aside`,{className:`w-full md:w-72 shrink-0 border-b md:border-b-0 md:border-r border-border overflow-y-auto`,children:V(Yt,{selectedDeviceId:a,onSelect:e=>{t({view:`cameras`,camera:String(e)},{replace:!0})}})}),V(`section`,{className:`flex-1 min-h-0 overflow-hidden`,children:a!==null&&Number.isFinite(a)&&!Number.isNaN(a)?V(wn,{deviceId:a}):V(`div`,{className:`flex items-center justify-center h-full text-sm text-foreground-subtle`,children:`Select a camera to view its pipeline flow`})})]})})]})}export{Dn as PipelinePage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ga as e,ha as t,ma as n}from"./src-tFxrblhL.js";import{G as r,I as i,K as a,S as o,W as s,Z as c,b as ee,x as l,z as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CCjPq1YD.js";import{L as d,V as f,c as te,g as p,n as m,p as h,s as g}from"./player-overlays-BD7QrhVv.js";import{MaskShapeCanvas as _}from"./MaskShapeCanvas-CQ2SgaNa.js";var ne=p(`hexagon`,[[`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}]]);c();var re=120,ie=`privacy-mask`,v=`rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors`,y=`rounded-md border border-primary/50 bg-primary/15 px-2.5 py-1 text-[11px] font-medium text-primary hover:bg-primary/25 disabled:opacity-40 transition-colors`;function b(e){return e.kind===`rect`||e.kind===`polygon`?e:null}function x(e){let t=new Set(e.map(e=>e.id)),n=0;for(;t.has(n);)n+=1;return n}function S(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(JSON.stringify(e[n])!==JSON.stringify(t[n]))return!1;return!0}function C({deviceId:c}){let p=te(h().trpcClient,c),[C,w]=a(null),[T,E]=a(!1),[D,O]=a(null),[k,A]=a(null),[j,M]=a(!1),[N,P]=a(!1),[F,I]=a(null),[L,R]=a(null),z=r(!1);u(()=>{if(!p)return;let e=!1;return z.current=!1,w(null),E(!1),O(null),A(null),P(!1),I(null),R(null),(async()=>{try{let t=await p.privacyMask?.getOptions({});if(e)return;if(!t)throw Error(`device proxy not ready`);if(w(t),z.current)return;let n=await p.privacyMask?.getStatus({});if(e)return;if(!n)throw Error(`device proxy not ready`);z.current=!0;let r={enabled:n.enabled,regions:n.regions};A(r),O(r)}catch(t){if(e)return;f(t)?E(!0):console.error(`Privacy Mask load failed`,t)}})(),()=>{e=!0}},[p]);let B=s(()=>D!==null&&k!==null&&(D.enabled!==k.enabled||!S(D.regions,k.regions)),[D,k]),V=D?D.regions.length:0,H=C?C.maxRegions:0,U=r(0);u(()=>{U.current=H},[H]);let W=H>0&&V>=H,G=i(()=>{O(e=>e&&{...e,enabled:!e.enabled})},[]),K=i(e=>{I(typeof e==`number`?e:null)},[]),q=s(()=>D?D.regions.map(e=>({id:e.id,shape:e.shape,enabled:e.enabled,label:`Zone ${String(e.id)}`})):[],[D]),J=i((e,t)=>{let n=b(t);n&&O(t=>t&&{...t,regions:t.regions.map(t=>t.id===e?{...t,shape:n}:t)})},[]),Y=i(e=>{let t=b(e);t&&(R(null),O(e=>{if(!e)return e;let n=U.current;if(n>0&&e.regions.length>=n)return e;let r=x(e.regions),i={id:r,enabled:!0,shape:t};return I(r),{...e,regions:[...e.regions,i]}}))},[]),X=i(e=>{P(!0),I(null),R(e)},[]),ae=i(e=>{P(!0),R(null),I(e)},[]),oe=i(e=>{I(t=>t===e?null:t),O(t=>t&&{...t,regions:t.regions.filter(t=>t.id!==e)})},[]),Z=i(()=>{R(null),I(null),k&&O({enabled:k.enabled,regions:k.regions})},[k]),se=i(async()=>{if(!(!p||!D)){M(!0);try{await p.privacyMask?.setMask({patch:{enabled:D.enabled,regions:[...D.regions]}});let e=await p.privacyMask?.getStatus({});if(e){let t={enabled:e.enabled,regions:e.regions};A(t),O(t)}}catch(e){console.error(`Privacy Mask save failed`,e)}finally{M(!1)}}},[p,D]),ce=i(()=>{P(e=>(e&&(R(null),I(null)),!e))},[]),Q=C?.supportedShapes??[];m(s(()=>N&&!T&&C&&D?{id:ie,order:re,node:l(_,{transparent:!0,items:q,supportedShapes:Q,polygonVertices:C.polygonVertices,selectedId:F,onSelect:K,onShapeChange:J,onDrawComplete:Y,drawingKind:L})}:null,[N,T,C,D,q,Q,F,K,J,Y,L]));let le=C?.supportedShapes.includes(`rect`)??!1,ue=C?.supportedShapes.includes(`polygon`)??!1,$=C!==null&&(C.maxRegions<=0||C.supportedShapes.length===0);return p?l(g,{title:`Privacy Mask`,icon:l(e,{className:`h-3.5 w-3.5 text-foreground-subtle`}),children:l(`div`,{className:`flex flex-col gap-3`,children:T||$?l(`p`,{className:`${d} leading-relaxed`,children:`This camera doesn't support an on-board privacy mask.`}):!T&&!$&&C!==null&&D!==null?o(ee,{children:[o(`p`,{className:`${d} leading-relaxed`,children:[`Toggle `,l(`strong`,{className:`text-foreground`,children:`Edit mask`}),` to draw blanked-out zones on the live frame, then `,l(`strong`,{className:`text-foreground`,children:`Save`}),` to push them to the camera. Drag a rectangle to move, its corner to resize; drag polygon vertices, click an edge midpoint to add one, or right-click a vertex to remove it.`]}),o(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[l(`button`,{type:`button`,onClick:ce,disabled:j,"aria-pressed":N,className:N?y:v,children:N?`Done editing`:`Edit mask`}),l(`button`,{type:`button`,onClick:G,disabled:j,"aria-pressed":D.enabled,className:D.enabled?y:v,children:D.enabled?`Mask on`:`Mask off`}),le&&l(`button`,{type:`button`,onClick:()=>X(`rect`),disabled:j||W,"aria-pressed":L===`rect`,className:L===`rect`?y:v,title:W?`Maximum zones reached`:`Add a rectangle zone`,children:`+ Rect`}),ue&&l(`button`,{type:`button`,onClick:()=>X(`polygon`),disabled:j||W,"aria-pressed":L===`polygon`,className:L===`polygon`?y:v,title:W?`Maximum zones reached`:`Add a polygon zone`,children:`+ Polygon`}),o(`span`,{className:`${d} ml-1 tabular-nums`,children:[V,` / `,H,` zones`]}),l(`span`,{className:`flex-1`}),l(`button`,{type:`button`,onClick:Z,disabled:j||!B,className:`rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors`,children:`Revert`}),l(`button`,{type:`button`,onClick:()=>void se(),disabled:j||!B,className:y,children:j?`Saving…`:`Save`})]}),V>0?l(`div`,{className:`flex flex-col gap-1`,children:D.regions.map(e=>{let r=F===e.id,i=e.shape.kind===`polygon`?ne:t;return o(`div`,{className:`flex items-center gap-2 rounded-md border px-2 py-1 transition-colors ${r?`border-primary/50 bg-primary/10`:`border-border bg-surface`}`,children:[o(`button`,{type:`button`,onClick:()=>ae(e.id),disabled:j,className:`flex flex-1 items-center gap-2 text-left text-[11px] font-medium text-foreground-subtle hover:text-foreground disabled:opacity-40 transition-colors`,children:[l(i,{className:`h-3.5 w-3.5 shrink-0`}),o(`span`,{children:[`Zone `,e.id]}),l(`span`,{className:`text-foreground-faint capitalize`,children:e.shape.kind})]}),l(`button`,{type:`button`,onClick:()=>oe(e.id),disabled:j,"aria-label":`Delete zone ${String(e.id)}`,title:`Delete zone`,className:`inline-flex h-6 w-6 items-center justify-center rounded border border-border bg-surface text-foreground-subtle hover:border-red-400/40 hover:bg-red-500/10 hover:text-red-400 disabled:opacity-40 transition-colors`,children:l(n,{className:`h-3.5 w-3.5`})})]},e.id)})}):null]}):l(`p`,{className:`${d} leading-relaxed`,children:`Loading the camera's privacy mask…`})})}):null}export{C as PrivacyMaskSettings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{K as e,S as t,Z as n,x as r}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CCjPq1YD.js";import{t as i}from"./radio-CnJYCpke.js";import{t as a}from"./server-C-7gGEm3.js";import{t as o}from"./wifi-DstzyoYP.js";import{B as s}from"./index-C9dLNgtt.js";var c=s(`cctv`,[[`path`,{d:`M16.75 12h3.632a1 1 0 0 1 .894 1.447l-2.034 4.069a1 1 0 0 1-1.708.134l-2.124-2.97`,key:`ir91b5`}],[`path`,{d:`M17.106 9.053a1 1 0 0 1 .447 1.341l-3.106 6.211a1 1 0 0 1-1.342.447L3.61 12.3a2.92 2.92 0 0 1-1.3-3.91L3.69 5.6a2.92 2.92 0 0 1 3.92-1.3z`,key:`jlp8i1`}],[`path`,{d:`M2 19h3.76a2 2 0 0 0 1.8-1.1L9 15`,key:`19bib8`}],[`path`,{d:`M2 21v-4`,key:`l40lih`}],[`path`,{d:`M7 9h.01`,key:`19b3jx`}]]),l=s(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`1d0kgt`}]]);n();var u={frigate:{icon:c,color:`#3b82f6`,label:`Frigate`},scrypted:{icon:a,color:`#a855f7`,label:`Scrypted`},reolink:{icon:i,color:`#06b6d4`,label:`Reolink`},homeassistant:{icon:l,color:`#22d3ee`,label:`Home Assistant`},rtsp:{icon:o,color:`#78716c`,label:`RTSP`},onvif:{icon:o,color:`#78716c`,label:`ONVIF`}},d={sm:`h-4 w-4`,md:`h-5 w-5`,lg:`h-6 w-6`},f={sm:`h-7 w-7`,md:`h-8 w-8`,lg:`h-10 w-10`};function p(e){let t=e.toLowerCase();return t.startsWith(`provider-`)?t.slice(9):t}function m(e){return u[p(e)]??{icon:c,color:`#78716c`,label:e}}function h(e){let t=p(e);return`/api/addon-assets/${e.toLowerCase().startsWith(`provider-`)?e:`provider-${t}`}/assets/icon.svg`}function g({type:n,size:i=`md`,showLabel:a}){let o=m(n),s=o.icon,[c,l]=e(!1),u=h(n);return t(`div`,{className:`flex items-center gap-2`,children:[r(`div`,{className:`flex items-center justify-center rounded-lg ${f[i]}`,style:{backgroundColor:`${o.color}15`},children:c?r(s,{className:d[i],style:{color:o.color}}):r(`img`,{src:u,alt:o.label,className:d[i],onError:()=>l(!0)})}),a&&r(`span`,{className:`text-xs font-medium text-foreground-subtle`,children:o.label})]})}export{g as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{G as e,I as t,K as n,S as r,W as i,Z as a,x as o,z as s}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CCjPq1YD.js";a();function c(e,t){for(let n of e)for(let e of n.fields){if(!(`key`in e)||e.key!==t)continue;if(e.type===`button`||e.type===`separator`||e.type===`info`)return!0;let r=e.immediate;return r===!0?!0:r===!1?!1:n.immediate===!0}return!1}function l({schema:r,serverValues:a,onImmediateSave:o,onDeferredSave:l}){let[u,d]=n({}),[f,p]=n(!1),m=e(null),h=r?.sections??[],g=Object.keys(u).length>0,_=i(()=>({...a,...u}),[a,u]);s(()=>{if(g){p(!0);return}m.current&&clearTimeout(m.current),m.current=setTimeout(()=>p(!1),500)},[g]);let v=t(()=>{p(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>p(!1),2e3)},[]),y=t(e=>{v();let t={},n={},r={...a,...u};for(let[i,a]of Object.entries(e))r[i]!==a&&(c(h,i)?t[i]=a:n[i]=a);Object.keys(t).length>0&&o(t),d(e=>{let r={...e};for(let e of Object.keys(t))delete r[e];for(let[e,t]of Object.entries(n))r[e]=t;return r})},[v,a,u,h,o]),b=t(e=>{let t={},n={};for(let[r,i]of Object.entries(u))e.includes(r)?t[r]=i:n[r]=i;d(n),Object.keys(t).length>0&&l(t)},[u,l]),x=t(e=>{d(t=>{let n={...t};for(let t of e)delete n[t];return n})},[]),S=t(()=>{d({})},[]);return{values:_,pendingKeys:Object.keys(u),hasPendingEdits:g,editingPaused:f,handleChange:y,handleSave:b,handleDiscard:x,resetAll:S}}function u({pendingCount:e,onSave:t,onDiscard:n,saving:i=!1,saveLabel:a=`Save`,discardLabel:s=`Discard`}){return e<=0?null:r(`div`,{className:`sticky bottom-0 -mb-3 flex items-center justify-between gap-3 rounded-lg border border-primary/40 bg-primary/5 px-3 py-2 shadow-sm z-10`,children:[r(`span`,{className:`text-xs text-foreground`,children:[e,` unsaved change`,e===1?``:`s`]}),r(`div`,{className:`flex items-center gap-2`,children:[o(`button`,{type:`button`,onClick:n,disabled:i,className:`inline-flex items-center rounded-md border border-border px-2.5 py-1 text-xs text-foreground-subtle hover:bg-surface-hover disabled:opacity-50`,children:s}),o(`button`,{type:`button`,onClick:t,disabled:i,className:`inline-flex items-center rounded-md bg-primary px-3 py-1 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:i?`Saving…`:a})]})]})}function d({tabs:e,activeId:t,onChange:n,countByTab:i,pendingByTab:a}){return e.length===0?null:o(`div`,{className:`flex flex-wrap items-center gap-1 border-b border-border shrink-0`,children:e.map(e=>{let s=e.id===t,c=i?.get(e.id)??0,l=a?.get(e.id)??0;return r(`button`,{type:`button`,onClick:()=>n(e.id),className:`relative px-3 py-1.5 text-xs font-medium rounded-t-md transition-colors -mb-px border-b-2 whitespace-nowrap ${s?`text-primary border-primary bg-primary/5`:`text-foreground-subtle border-transparent hover:text-foreground hover:bg-surface-hover`}`,children:[e.label,c>0&&r(`span`,{className:`ml-1.5 text-[10px] opacity-60`,children:[`(`,c,`)`]}),l>0&&o(`span`,{className:`ml-1.5 inline-flex h-1.5 w-1.5 rounded-full bg-primary`})]},e.id)})})}export{u as n,l as r,d as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{gr as e}from"./src-tFxrblhL.js";import{S as t,x as n}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CCjPq1YD.js";import{f as r}from"./index-C9dLNgtt.js";import{t as i}from"./AdminPage-vtcsGqRq.js";import{t as a}from"./NodeAddonsSettingsPanel-C8dKpqZh.js";function o(){let{data:o,isLoading:s}=e(void 0),c=(o??[]).find(e=>e.isHub&&e.isOnline),l=c?.addons.map(e=>e.id)??[];return n(i,{children:s?n(`div`,{className:`text-muted-foreground text-sm py-12 text-center`,children:`Loading hub topology…`}):c?l.length===0?n(`div`,{className:`text-muted-foreground text-sm py-12 text-center`,children:`No addons installed on the hub yet.`}):n(a,{nodeId:c.id,addonIds:l,level:`global`}):t(`div`,{className:`flex flex-col items-center justify-center text-muted-foreground text-sm gap-2 py-12`,children:[n(r,{className:`h-8 w-8 opacity-30`}),n(`p`,{children:`No online hub node found.`}),n(`p`,{className:`text-xs`,children:`Settings will appear once the hub is reachable.`})]})})}export{o as SettingsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{K as e,S as t,Z as n,x as r}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CCjPq1YD.js";import{t as i}from"./CapabilityBadges-BCofv88Z.js";import{t as a}from"./ProviderIcon-DnjoN_gW.js";import{t as o}from"./StatusBadge-BSsUNFG6.js";import{t as s}from"./FormBuilder-aFYGmiS4.js";n();function c({title:e,children:n}){return t(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[r(`div`,{className:`border-b border-border px-4 py-2.5`,children:r(`h2`,{className:`text-xs font-semibold text-foreground uppercase tracking-wider`,children:e})}),r(`div`,{className:`p-4`,children:n})]})}function l({name:e,cssVar:n,hex:i}){return t(`div`,{className:`flex flex-col items-center gap-1.5`,children:[r(`div`,{className:`h-10 w-10 rounded-lg border border-border shadow-inner`,style:{backgroundColor:n?`var(${n})`:i}}),r(`span`,{className:`text-[10px] text-foreground-subtle text-center leading-tight`,children:e})]})}var u={sections:[{id:`demo`,title:`Demo Fields`,columns:2,fields:[{key:`name`,type:`text`,label:`Name`,placeholder:`Enter name`},{key:`count`,type:`number`,label:`Count`,min:0,max:100,unit:`items`},{key:`enabled`,type:`boolean`,label:`Enabled`},{key:`mode`,type:`select`,label:`Mode`,options:[{value:`a`,label:`Alpha`},{value:`b`,label:`Beta`}]},{key:`tags`,type:`tags`,label:`Tags`,span:2,suggestions:[`camera`,`zone`,`alert`]},{key:`confidence`,type:`slider`,label:`Confidence`,min:0,max:100,step:5,unit:`%`,span:2},{key:`info`,type:`info`,label:`Note`,content:`This is an informational message for the user.`,variant:`info`}]}]};function d(){let[n,d]=e({name:`Example`,count:10,enabled:!0,mode:`a`,tags:[`camera`],confidence:60});return t(`div`,{className:`p-6 space-y-6 max-w-5xl mx-auto`,children:[t(`div`,{className:`mb-6`,children:[r(`h1`,{className:`text-xl font-bold text-foreground`,children:`Component Showroom`}),r(`p`,{className:`text-sm text-foreground-subtle mt-1`,children:`All UI components at a glance`})]}),r(c,{title:`Typography`,children:t(`div`,{className:`space-y-3`,children:[r(`h1`,{className:`text-2xl font-bold text-foreground`,children:`Heading 1 — Display title`}),r(`h2`,{className:`text-xl font-semibold text-foreground`,children:`Heading 2 — Section title`}),r(`h3`,{className:`text-base font-semibold text-foreground`,children:`Heading 3 — Card title`}),r(`h4`,{className:`text-sm font-semibold text-foreground`,children:`Heading 4 — Sub-section`}),r(`p`,{className:`text-sm text-foreground`,children:`Body text — Regular paragraph content goes here. It uses the foreground color.`}),r(`p`,{className:`text-sm text-foreground-subtle`,children:`Subtle text — Secondary/descriptive text with reduced emphasis.`}),r(`p`,{className:`text-xs text-foreground-subtle uppercase tracking-wider font-semibold`,children:`Label / Caption`}),r(`p`,{className:`text-xs text-foreground-disabled`,children:`Disabled / placeholder text`})]})}),r(c,{title:`Colors`,children:t(`div`,{className:`flex flex-wrap gap-4`,children:[r(l,{name:`primary`,cssVar:`--color-primary`}),r(l,{name:`background`,cssVar:`--color-background`}),r(l,{name:`surface`,cssVar:`--color-surface`}),r(l,{name:`foreground`,cssVar:`--color-foreground`}),r(l,{name:`success`,cssVar:`--color-success`}),r(l,{name:`warning`,cssVar:`--color-warning`}),r(l,{name:`danger`,cssVar:`--color-danger`}),r(l,{name:`info`,cssVar:`--color-info`}),r(l,{name:`border`,cssVar:`--color-border`}),r(`div`,{className:`w-px`}),r(l,{name:`frigate`,hex:`#3b82f6`}),r(l,{name:`scrypted`,hex:`#a855f7`}),r(l,{name:`reolink`,hex:`#06b6d4`}),r(l,{name:`ha`,hex:`#22d3ee`}),r(l,{name:`rtsp`,hex:`#78716c`})]})}),r(c,{title:`Buttons`,children:t(`div`,{className:`flex flex-wrap gap-3`,children:[r(`button`,{className:`inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-white hover:opacity-90 transition-opacity`,children:`Primary`}),r(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-border bg-surface px-4 py-2 text-sm font-medium text-foreground hover:bg-surface-hover transition-colors`,children:`Secondary`}),r(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-danger/40 bg-danger/10 px-4 py-2 text-sm font-medium text-danger hover:bg-danger/20 transition-colors`,children:`Danger`}),r(`button`,{disabled:!0,className:`inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-white opacity-40 cursor-not-allowed`,children:`Disabled`}),r(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-warning/40 bg-warning/10 px-4 py-2 text-sm font-medium text-warning hover:bg-warning/20 transition-colors`,children:`Warning`}),r(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-success/40 bg-success/10 px-4 py-2 text-sm font-medium text-success hover:bg-success/20 transition-colors`,children:`Success`})]})}),r(c,{title:`Inputs`,children:t(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Text input`}),r(`input`,{type:`text`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`Type something...`})]}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Number input`}),r(`input`,{type:`number`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`0`})]}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Password input`}),r(`input`,{type:`password`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`••••••••`})]}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Select`}),t(`select`,{className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,children:[r(`option`,{children:`Option A`}),r(`option`,{children:`Option B`}),r(`option`,{children:`Option C`})]})]}),t(`div`,{className:`md:col-span-2`,children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Textarea`}),r(`textarea`,{className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30 resize-y min-h-[60px]`,placeholder:`Enter multi-line text...`,rows:3})]}),r(`div`,{children:t(`label`,{className:`flex items-center gap-2 cursor-pointer select-none`,children:[r(`input`,{type:`checkbox`,className:`h-3.5 w-3.5 rounded border-border accent-primary`,defaultChecked:!0}),r(`span`,{className:`text-xs font-medium text-foreground`,children:`Checkbox (checked)`})]})}),r(`div`,{children:t(`div`,{className:`flex items-center justify-between`,children:[r(`span`,{className:`text-xs font-medium text-foreground`,children:`Toggle switch`}),r(f,{})]})}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Slider`}),r(`input`,{type:`range`,className:`w-full h-1 accent-primary cursor-pointer`,min:0,max:100,defaultValue:60})]}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Tags example`}),r(`div`,{className:`flex flex-wrap gap-1.5 rounded-md border border-border bg-background px-2 py-1.5 min-h-[38px]`,children:[`camera`,`zone`,`alert`].map(e=>r(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-primary/10 px-1.5 py-0.5 text-xs text-primary`,children:e},e))})]})]})}),r(c,{title:`Badges`,children:t(`div`,{className:`space-y-3`,children:[t(`div`,{children:[r(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`StatusBadge`}),r(`div`,{className:`flex flex-wrap gap-2`,children:[`running`,`stopped`,`error`,`online`,`offline`,`idle`].map(e=>r(o,{status:e},e))})]}),t(`div`,{children:[r(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`CapabilityBadges`}),r(i,{capabilities:[`streaming`,`detection`,`recording`,`audio`]})]})]})}),r(c,{title:`Cards`,children:t(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[t(`div`,{className:`rounded-lg bg-surface p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Surface card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `bg-surface`. Default card background."})]}),t(`div`,{className:`rounded-lg border border-border bg-surface p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Bordered card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `border border-border bg-surface`."})]}),t(`div`,{className:`rounded-lg border border-primary/30 bg-primary/5 p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-primary mb-1`,children:`Accent card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:`Highlighted with primary color.`})]}),t(`div`,{className:`rounded-lg bg-background p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Background card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `bg-background`. Inset card."})]})]})}),r(c,{title:`Provider Icons`,children:r(`div`,{className:`flex flex-wrap gap-4`,children:[`frigate`,`scrypted`,`reolink`,`homeassistant`,`rtsp`,`onvif`].map(e=>r(a,{type:e,size:`lg`,showLabel:!0},e))})}),t(c,{title:`Form Builder Demo`,children:[r(s,{schema:u,values:n,onChange:d}),t(`details`,{className:`mt-3`,children:[r(`summary`,{className:`text-[10px] text-foreground-subtle cursor-pointer hover:text-foreground`,children:`View current values`}),r(`pre`,{className:`mt-2 rounded-md bg-background p-3 text-[10px] text-foreground-subtle overflow-auto`,children:JSON.stringify(n,null,2)})]})]}),r(c,{title:`Info Boxes`,children:r(`div`,{className:`space-y-2`,children:[{variant:`info`,label:`Info`,content:`This is an informational message. Use it for tips and hints.`},{variant:`warning`,label:`Warning`,content:`This action may have side effects. Proceed with caution.`},{variant:`success`,label:`Success`,content:`Operation completed successfully. All systems are green.`},{variant:`danger`,label:`Danger`,content:`This operation is irreversible. Data will be permanently deleted.`}].map(({variant:e,label:n,content:i})=>{let a={info:{border:`border-info`,bg:`bg-info/5`,text:`text-info`},warning:{border:`border-warning`,bg:`bg-warning/5`,text:`text-warning`},success:{border:`border-success`,bg:`bg-success/5`,text:`text-success`},danger:{border:`border-danger`,bg:`bg-danger/5`,text:`text-danger`}}[e];return t(`div`,{className:`rounded-md border-l-4 px-3 py-2.5 ${a.border} ${a.bg}`,children:[r(`p`,{className:`text-xs font-semibold mb-0.5 ${a.text}`,children:n}),r(`p`,{className:`text-xs text-foreground-subtle leading-relaxed`,children:i})]},e)})})})]})}function f(){let[t,n]=e(!0);return r(`button`,{type:`button`,role:`switch`,"aria-checked":t,onClick:()=>n(e=>!e),className:[`relative inline-flex h-4 w-8 shrink-0 items-center rounded-full transition-colors duration-150 cursor-pointer`,t?`bg-primary`:`bg-foreground-subtle/30`].join(` `),children:r(`span`,{className:[`inline-block h-3 w-3 rounded-full bg-white shadow transition-transform duration-150`,t?`translate-x-4`:`translate-x-0.5`].join(` `)})})}export{d as ShowroomPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{S as e,x as t}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CCjPq1YD.js";var n={running:{bg:`bg-success/10`,text:`text-success`,dot:`bg-success`,label:`Running`},stopped:{bg:`bg-foreground-subtle/10`,text:`text-foreground-subtle`,dot:`bg-foreground-subtle`,label:`Stopped`},error:{bg:`bg-danger/10`,text:`text-danger`,dot:`bg-danger`,label:`Error`},online:{bg:`bg-success/10`,text:`text-success`,dot:`bg-success`,label:`Online`},offline:{bg:`bg-foreground-subtle/10`,text:`text-foreground-subtle`,dot:`bg-foreground-subtle`,label:`Offline`},idle:{bg:`bg-info/10`,text:`text-info`,dot:`bg-info`,label:`Idle`},disabled:{bg:`bg-warning/10`,text:`text-warning`,dot:`bg-warning`,label:`Disabled`},enabled:{bg:`bg-success/10`,text:`text-success`,dot:`bg-success`,label:`Enabled`}};function r({status:r}){let i=n[r]??n.stopped;return e(`span`,{className:`inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[10px] font-medium ${i.bg} ${i.text}`,children:[t(`span`,{className:`h-1.5 w-1.5 rounded-full ${i.dot}`}),i.label]})}export{r as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-
|
|
1
|
+
import"./virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-B5yi8CSR.js";import{t as e}from"./vite-preload-helper-zJ_50EbN.js";var t={"@camstack/sdk":async()=>await e(()=>import(`./dist-DivYVFrG.js`),[]),"@camstack/types":async()=>await e(()=>import(`./dist-DBAJfCeK.js`),[]),"@camstack/ui-library":async()=>await e(()=>import(`./src-tFxrblhL.js`).then(e=>e.t),[]),"@tanstack/react-query":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CCjPq1YD.js`).then(e=>e.y),[]),"@trpc/client":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_client__loadShare__.js-CSJxMxg6.js`).then(e=>e.A),[]),"@trpc/react-query":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.js-DqrXu-jG.js`).then(e=>e.r),[]),konva:async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare__konva__loadShare__.js-B7XYY0cV.js`).then(e=>e.n),[]),react:async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CCjPq1YD.js`).then(e=>(e.$(),e.Q)),[]),"react-dom":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.js-DcnMG4y9.js`).then(e=>(e.a(),e.i)),[]),"react-dom/client":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-CUURKTLp.js`).then(e=>e.r),[]),"react-konva":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_konva__loadShare__.js-xmx-auwe.js`).then(e=>e.u),[]),"react/jsx-runtime":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CCjPq1YD.js`).then(e=>e.w),[])},n={"@camstack/sdk":{name:`@camstack/sdk`,version:`1.0.7`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`@camstack/sdk`].loaded=!0;let{"@camstack/sdk":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^1.0.7`}},"@camstack/types":{name:`@camstack/types`,version:`1.0.7`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`@camstack/types`].loaded=!0;let{"@camstack/types":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^1.0.7`}},"@camstack/ui-library":{name:`@camstack/ui-library`,version:`1.0.7`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`@camstack/ui-library`].loaded=!0;let{"@camstack/ui-library":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^1.0.7`}},"@tanstack/react-query":{name:`@tanstack/react-query`,version:`5.101.0`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`@tanstack/react-query`].loaded=!0;let{"@tanstack/react-query":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^5.101.0`}},"@trpc/client":{name:`@trpc/client`,version:`11.18.0`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`@trpc/client`].loaded=!0;let{"@trpc/client":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^11.18.0`}},"@trpc/react-query":{name:`@trpc/react-query`,version:`11.18.0`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`@trpc/react-query`].loaded=!0;let{"@trpc/react-query":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^11.18.0`}},konva:{name:`konva`,version:`10.3.0`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n.konva.loaded=!0;let{konva:e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^10.3.0`}},react:{name:`react`,version:`19.2.7`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n.react.loaded=!0;let{react:e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^19.2.7`}},"react-dom":{name:`react-dom`,version:`19.2.7`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`react-dom`].loaded=!0;let{"react-dom":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^19.2.7`}},"react-dom/client":{name:`react-dom/client`,version:`19.2.7`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`react-dom/client`].loaded=!0;let{"react-dom/client":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^19.2.7`}},"react-konva":{name:`react-konva`,version:`19.2.5`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`react-konva`].loaded=!0;let{"react-konva":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^19.2.5`}},"react/jsx-runtime":{name:`react/jsx-runtime`,version:`19.2.7`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`react/jsx-runtime`].loaded=!0;let{"react/jsx-runtime":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^19.2.7`}}},r=[];export{r as usedRemotes,n as usedShared};
|