@camstack/addon-admin-ui 1.2.134 → 1.2.136
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-Cwdgmtfs.js → AddLocationWizard-mVaAkllu.js} +1 -1
- package/dist/assets/{AddonCollectionPage-RHQ9yvVK.js → AddonCollectionPage-CaPJcCMl.js} +1 -1
- package/dist/assets/{Addons-rrutEpuH.js → Addons-D2I_esyD.js} +1 -1
- package/dist/assets/{AdminTabs-BES2bRcj.js → AdminTabs-Deriw2hW.js} +1 -1
- package/dist/assets/{AiProfiles-DHmStPHk.js → AiProfiles-DpGUrbkq.js} +1 -1
- package/dist/assets/{BrokerForm-CDvqKRks.js → BrokerForm-BV2ENKUn.js} +1 -1
- package/dist/assets/{Build-Bdd6VKQq.js → Build-DIwjJX1u.js} +1 -1
- package/dist/assets/{Capabilities-BlBsIIKz.js → Capabilities-CUk8ImxR.js} +1 -1
- package/dist/assets/{CapabilityBadges-CaL2z_pA.js → CapabilityBadges-BljLOSl8.js} +1 -1
- package/dist/assets/{Cluster-DI4H3z9p.js → Cluster-B04Dntx1.js} +1 -1
- package/dist/assets/{Data-CMufz0ly.js → Data-8q9qJ1E1.js} +1 -1
- package/dist/assets/{DetectionIntelligence-CC2bnU1G.js → DetectionIntelligence-M69Rh2Fu.js} +1 -1
- package/dist/assets/{DeviceAggregateSection-DtmhOYC-.js → DeviceAggregateSection-ZEdmE1Tr.js} +1 -1
- package/dist/assets/{DeviceDetail-D4JyE8Q4.js → DeviceDetail-D-4CwvyO.js} +1 -1
- package/dist/assets/{Devices-DPoOJ28S.js → Devices-DF6jpmce.js} +1 -1
- package/dist/assets/{EmbedPlayerPage-DVHKytpg.js → EmbedPlayerPage-KrGElk9a.js} +1 -1
- package/dist/assets/Events-DoYqNSUV.js +1 -0
- package/dist/assets/{FormBuilder-BIcajZrR.js → FormBuilder-CsypX2wJ.js} +1 -1
- package/dist/assets/{Identity-I-w2MCJo.js → Identity-Cly1pkY0.js} +1 -1
- package/dist/assets/{IntegrationDetail-BM_A5fuC.js → IntegrationDetail-Ua-4eUiQ.js} +1 -1
- package/dist/assets/{Integrations-D4-yTaal.js → Integrations-BKW9f5Tq.js} +1 -1
- package/dist/assets/{Integrations-BPh5t296.js → Integrations-Dw_5CkVj.js} +1 -1
- package/dist/assets/{Locations-DMliZ_uK.js → Locations-BzyjI6El.js} +1 -1
- package/dist/assets/{Logs-C1gzkJh5.js → Logs-D2LjU4W5.js} +1 -1
- package/dist/assets/{MotionZonesSettings-D5bsz1Jg.js → MotionZonesSettings-dUd4dTsA.js} +1 -1
- package/dist/assets/{MyAccess-DPbKorXj.js → MyAccess-CYtGheNF.js} +1 -1
- package/dist/assets/{Network-Dhlj9iZg.js → Network-EIyn_EB4.js} +1 -1
- package/dist/assets/{NodeAddonsSettingsPanel-iExlTFdf.js → NodeAddonsSettingsPanel-Cn-rIXGF.js} +1 -1
- package/dist/assets/{NodeInferenceDevices-BFbIgscJ.js → NodeInferenceDevices-FBayPhvF.js} +1 -1
- package/dist/assets/{Notifications-D70xO34C.js → Notifications-ASnN4lfj.js} +1 -1
- package/dist/assets/{Pipeline-CK08_4T5.js → Pipeline-BLI2Oq15.js} +1 -1
- package/dist/assets/{Plates-BeruKIQC.js → Plates-C4OD82o4.js} +1 -1
- package/dist/assets/{PrivacyMaskSettings-CQxnmksk.js → PrivacyMaskSettings-CJwRkAjL.js} +1 -1
- package/dist/assets/{ProviderIcon-C8rLTyFr.js → ProviderIcon-CBNqs16I.js} +1 -1
- package/dist/assets/{Recordings-CIbUuuE4.js → Recordings-BZXYg9q5.js} +1 -1
- package/dist/assets/{ScanNetworkModal-DnZZD6cS.js → ScanNetworkModal-CHyzU4Pu.js} +1 -1
- package/dist/assets/{SceneMonitorEditor-CUWuIcgd.js → SceneMonitorEditor-BmK8D-Mn.js} +1 -1
- package/dist/assets/{Scenes-o8RqEZ0X.js → Scenes-CbxsoKAl.js} +1 -1
- package/dist/assets/{Settings-Bq2Ruh_W.js → Settings-B858OsRX.js} +1 -1
- package/dist/assets/{Showroom-D_3Y_kaA.js → Showroom-tr1EdFcT.js} +1 -1
- package/dist/assets/{StorageLocationsPanel-CNaSNDZz.js → StorageLocationsPanel-BiP3z_s1.js} +1 -1
- package/dist/assets/{Terminal-DyvxUA1l.js → Terminal-CbuRFD97.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-C4P5BjZb.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DP3QHSOf.js} +1 -1
- package/dist/assets/{bell-off-f9cOeYHR.js → bell-off-3pzidZwL.js} +1 -1
- package/dist/assets/{bell-ring-BOLQ3-sn.js → bell-ring-BNMfRLHE.js} +1 -1
- package/dist/assets/{boxes-D67mOgyH.js → boxes-wUdab8Mw.js} +1 -1
- package/dist/assets/circle-check-big-DqrpEEJk.js +1 -0
- package/dist/assets/circle-dot-BQYpE1hW.js +1 -0
- package/dist/assets/{circle-x-BhSycz1t.js → circle-x-Cxto7gxg.js} +1 -1
- package/dist/assets/clock-DcwuYKfL.js +1 -0
- package/dist/assets/{copy-yEuX36Q9.js → copy-Dzoj1sL2.js} +1 -1
- package/dist/assets/{debounced-invalidate-C6oftOsc.js → debounced-invalidate-DS28CcfM.js} +1 -1
- package/dist/assets/dist-8TKoJB2v.js +349 -0
- package/dist/assets/{dist-B7WBVVYD.js → dist-DFSfnZbu.js} +1 -1
- package/dist/assets/{download-Cns2b0I4.js → download-DxszViZg.js} +1 -1
- package/dist/assets/{face-bbox-_inWE1us.js → face-bbox-rixxoMVN.js} +1 -1
- package/dist/assets/{flame-B3wdUf-B.js → flame-y-WWWoqN.js} +1 -1
- package/dist/assets/{hard-drive-BSubXVbL.js → hard-drive-Cx9nO3D9.js} +1 -1
- package/dist/assets/{hostInit-BxXzisKg.js → hostInit-M-UNOI3G.js} +1 -1
- package/dist/assets/index-BGfoUOZH.js +4 -0
- package/dist/assets/index-CJR_GTd3.css +2 -0
- package/dist/assets/{key-round-Hwjyfxut.js → key-round-Cf_iahkO.js} +1 -1
- package/dist/assets/{layers-4y_LNvsk.js → layers-D2h0nzB6.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-b0011344.js → mf-entry-bootstrap-0-7877987d.js} +2 -2
- package/dist/assets/{pencil-DM8jm3KB.js → pencil-BYfHIRND.js} +1 -1
- package/dist/assets/play-3WHdfZns.js +1 -0
- package/dist/assets/{player-overlays-Bx_ObCKU.js → player-overlays-CbzaJwg-.js} +1 -1
- package/dist/assets/plus-DybJZLlz.js +1 -0
- package/dist/assets/power-V-NCnOD5.js +1 -0
- package/dist/assets/{radio-C8kTOvFE.js → radio-CVCZPeGS.js} +1 -1
- package/dist/assets/{refresh-cw-CAE9U9W8.js → refresh-cw-zgZZERqO.js} +1 -1
- package/dist/assets/remoteEntry-C33H90bT.js +1 -0
- package/dist/assets/rotate-ccw-P6KpUkTu.js +1 -0
- package/dist/assets/rotate-cw-Bmr-g_8P.js +1 -0
- package/dist/assets/{send-Bepqdqz0.js → send-pS3EZzI2.js} +1 -1
- package/dist/assets/{server-BRZbW4kE.js → server-DxNJ1sP2.js} +1 -1
- package/dist/assets/{shield-Dd2SR8lz.js → shield-DdRJkqKO.js} +1 -1
- package/dist/assets/{shield-alert-DEZ-Rp12.js → shield-alert-CFw-3aoD.js} +1 -1
- package/dist/assets/{square-check-big-D1dZ8PB3.js → square-check-big-Dlho6m1g.js} +1 -1
- package/dist/assets/square-k5jQT1Qs.js +1 -0
- package/dist/assets/src-HS-Ah-dU.js +67 -0
- package/dist/assets/src-P91nlzf3.js +349 -0
- package/dist/assets/{undo-2-Dm8GwG7l.js → undo-2-L-coRO82.js} +1 -1
- package/dist/assets/{use-scenes-feed-Caku898Y.js → use-scenes-feed-C6jbwvBT.js} +1 -1
- package/dist/assets/useEventInvalidation-B3ksj3kK.js +1 -0
- package/dist/assets/{useNodeUrlSelection-BNegm9oW.js → useNodeUrlSelection-C8kKmEH-.js} +1 -1
- package/dist/assets/user-round-Ce2JWAZY.js +1 -0
- package/dist/assets/{video-Bj8owium.js → video-VQ0yM0l4.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-CO1akns_.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DR-QYwCq.js} +2 -2
- package/dist/assets/{wifi-BXcW1Zsl.js → wifi-BWx65_WT.js} +1 -1
- package/dist/assets/{zap-Dnu811tV.js → zap-g_CScZV9.js} +1 -1
- package/dist/index.html +6 -6
- package/dist/server/addon.js +19 -24
- package/package.json +1 -1
- package/dist/assets/Events-BvGnhYlg.js +0 -1
- package/dist/assets/circle-check-big-BmkRuS0o.js +0 -1
- package/dist/assets/circle-dot-DMPqGtZX.js +0 -1
- package/dist/assets/clock-Cv-904ff.js +0 -1
- package/dist/assets/dist-BspaX-ZV.js +0 -349
- package/dist/assets/index-CNUAoFCi.js +0 -4
- package/dist/assets/index-DpyC2pdq.css +0 -2
- package/dist/assets/play-BwcRp88C.js +0 -1
- package/dist/assets/plus-BpLCw4Ck.js +0 -1
- package/dist/assets/power-D0XTxtP5.js +0 -1
- package/dist/assets/remoteEntry-DYu70_xx.js +0 -1
- package/dist/assets/rotate-ccw-Dd7L2QLp.js +0 -1
- package/dist/assets/rotate-cw-CW4nUKNY.js +0 -1
- package/dist/assets/square-D3ZDvwga.js +0 -1
- package/dist/assets/src-Baix3Xmi.js +0 -349
- package/dist/assets/src-DBcmPfFY.js +0 -67
- package/dist/assets/useEventInvalidation-stXd0-Bb.js +0 -1
- package/dist/assets/user-round-BxsYc8VU.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as e,K as t,Q as n,S as r,U as i,W as a,a as o,b as s,o as c,q as l,x as u,z as d}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{Q as f}from"./player-overlays-Bx_ObCKU.js";import{Aa as p,An as m,Ca as h,Da as g,Dt as _,Ft as v,Gs as y,It as b,Lt as x,Oa as S,Pt as C,Rt as w,Sa as T,Ta as E,Tt as D,Wr as O,Xs as k,Xt as A,_a as j,da as M,ea as N,fn as P,ga as ee,j as F,ja as I,ka as L,ma as R,pa as z,pn as B,va as V,wa as te,xa as H,ya as U}from"./src-DBcmPfFY.js";import{Vt as ne,at as re}from"./src-Baix3Xmi.js";import{t as W}from"./clock-Cv-904ff.js";import{t as ie}from"./copy-yEuX36Q9.js";import{t as ae}from"./download-Cns2b0I4.js";import{a as oe,c as se,d as ce,f as le,i as ue,m as de,n as fe,o as pe,p as me,r as he,s as ge,t as _e}from"./debounced-invalidate-C6oftOsc.js";import{t as ve}from"./refresh-cw-CAE9U9W8.js";import{t as ye}from"./square-check-big-D1dZ8PB3.js";import{t as be}from"./square-D3ZDvwga.js";import{t as xe}from"./undo-2-Dm8GwG7l.js";import{B as Se,F as Ce,J as G,L as we,c as Te,k as Ee,o as De,p as Oe,q as ke,r as Ae,t as je,w as K,z as Me}from"./index-CNUAoFCi.js";import{t as Ne}from"./AdminPage-CCD07UMs.js";import{i as Pe,n as Fe,t as Ie}from"./authed-media-BPd_L9jr.js";import{t as Le}from"./AdminTabs-BES2bRcj.js";var Re=G(`arrow-down-wide-narrow`,[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`M11 4h10`,key:`1w87gc`}],[`path`,{d:`M11 8h7`,key:`djye34`}],[`path`,{d:`M11 12h4`,key:`q8tih4`}]]),ze=G(`bug`,[[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M9 7.13v-1a3.003 3.003 0 1 1 6 0v1`,key:`d7y7pr`}],[`path`,{d:`M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6`,key:`xs1cw7`}],[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M6.53 9C4.6 8.8 3 7.1 3 5`,key:`32zzws`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`M3 21c0-2.1 1.7-3.9 3.8-4`,key:`4p0ekp`}],[`path`,{d:`M20.97 5c0 2.1-1.6 3.8-3.5 4`,key:`18gb23`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M17.2 17c2.1.1 3.8 1.9 3.8 4`,key:`k3fwyw`}]]),Be=G(`circle-dashed`,[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]),Ve=G(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),He=G(`copy-plus`,[[`line`,{x1:`15`,x2:`15`,y1:`12`,y2:`18`,key:`1p7wdc`}],[`line`,{x1:`12`,x2:`18`,y1:`15`,y2:`15`,key:`1nscbv`}],[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Ue=G(`graduation-cap`,[[`path`,{d:`M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z`,key:`j76jl0`}],[`path`,{d:`M22 10v6`,key:`1lu8f3`}],[`path`,{d:`M6 12.5V16a6 3 0 0 0 12 0v-3.5`,key:`1r8lef`}]]),We=G(`square-parking`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 17V7h4a3 3 0 0 1 0 6H9`,key:`1dfk2c`}]]),Ge=G(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),Ke=G(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]);n();function qe(e){return e.subLabel??e.label}var Je=720*60*60*1e3;function Ye(e){let t=[];for(let n of e)t.push(...n);return t}function Xe(e,t){let n=[...e];return n.sort((e,n)=>t===`importance`?n.importance-e.importance:n.timestamp-e.timestamp),n}function Ze(e,t){return e.filter(e=>!(e.importance<t.minImportance||t.cameras.size>0&&!t.cameras.has(e.deviceId)||t.classes.size>0&&!t.classes.has(e.className)))}function Qe(e,t){return`${String(e)}:${t}`}function $e(e,t){let n=new Map,r=new Set;for(let i of e){let e=Qe(i.deviceId,i.trackId);if(!t.has(e)||r.has(e))continue;r.add(e);let a=n.get(i.deviceId);a?a.push(i.trackId):n.set(i.deviceId,[i.trackId])}return n}function et(e,t){return{since:e.fromMs??t-Je,until:e.toMs??t}}var tt=[`native`,`raster`,`standin`];function nt(e){return tt.some(t=>t===e)}var rt={standin:{label:`stand-in`,title:`Stand-in: this tile is a face or plate detail crop copied in because no frame of the subject was captured. It is not a best shot.`,tone:`warning`},raster:{label:`low-res`,title:`Raster crop: a sub-native cut of the subject, not a native capture. Honest, but lower resolution than a best shot.`,tone:`info`}};function it(e){return e===`standin`?rt.standin:e===`raster`?rt.raster:null}var at={"no-key-frame":`No key frame existed at close, so no native tile could be cut.`,"no-best-seen-bbox":`No subject box was ever recorded, so there was nothing to cut around.`,"derive-returned-null":`The close-time crop was attempted and produced nothing.`,"derive-threw":`The close-time crop failed with an error.`,"derive-not-wired":`No close-time crop was wired on this node.`,"no-media-store":`The node was shutting down mid-close.`,"no-thumbnail":`The track closed with no tile of any kind.`,"standin-tile":`The track closed with a detail crop standing in for the subject.`,"raster-tile":`The track closed with a sub-native raster crop of the subject.`,"native-tile":`The track closed with a native tile.`};function ot(e){if(e===void 0)return null;let t=e.trim();if(t.length===0)return null;let n=t.split(/\s+/),r=n[0]??t,i=[];for(let e of n.slice(1)){let t=e.indexOf(`=`);t===-1?i.push({key:e,value:null}):i.push({key:e.slice(0,t),value:e.slice(t+1)})}return{sentence:at[r]??r,detail:i,raw:t}}function st(e){if(e===void 0||!Number.isFinite(e)||e<=0)return``;let t=e/1e3;if(t<60)return`${t.toFixed(1)}s`;let n=Math.floor(t/60),r=Math.round(t%60);return`${String(n)}m ${String(r).padStart(2,`0`)}s`}function ct({row:e,cameraName:t,nowMs:n,onOpenDetail:i,selected:a=!1,onToggleSelect:o,score:s,provenance:c,footer:l}){let d=Pe(e.bestEventId?`${Ie}/${e.bestEventId}`:void 0),f=Math.round(e.importance*100),p=s===void 0?void 0:Math.round(s*100),m=st(e.windowMs),h=()=>i(e),g=it(c);return r(`div`,{className:`relative flex flex-col rounded-md border bg-surface overflow-hidden ${a?`border-primary ring-1 ring-primary`:`border-border`}`,children:[r(`div`,{className:`aspect-video relative overflow-hidden bg-surface-hover`,children:[d.src?u(`img`,{src:d.src,alt:`Event from ${t}`,onClick:h,className:`h-full w-full cursor-zoom-in object-cover`}):u(`button`,{type:`button`,onClick:h,className:`flex h-full w-full flex-col items-center justify-center gap-1 bg-surface-hover text-foreground-subtle`,title:d.failed?`Key-event media unavailable`:`No key-event media`,children:u(de,{className:`h-6 w-6 opacity-60`})}),o&&u(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),o(Qe(e.deviceId,e.trackId))},className:`absolute left-0 top-0 z-10 rounded-br-md bg-black/50 p-1.5 text-white hover:bg-black/70`,"aria-label":a?`Deselect`:`Select`,children:a?u(ye,{className:`h-4 w-4 text-primary`}):u(be,{className:`h-4 w-4`})}),p!==void 0&&r(`span`,{className:`absolute left-1 top-1 z-10 rounded bg-primary/85 px-1.5 py-0.5 text-[10px] font-semibold text-white tabular-nums`,title:`CLIP semantic-match score`,children:[String(p),`%`]}),f>0&&u(`span`,{className:`absolute right-1 top-1 z-10 rounded bg-black/60 px-1.5 py-0.5 text-[10px] font-semibold text-white`,children:String(f)}),g!==null&&u(`span`,{className:`absolute bottom-1 right-1 z-10 rounded px-1.5 py-0.5 text-[10px] font-semibold text-white ${g.tone===`warning`?`bg-warning/90`:`bg-black/70`}`,title:g.title,children:g.label}),(e.markForTrain===!0||e.debug===!0||e.favourited===!0)&&r(`span`,{className:`absolute bottom-1 left-1 z-10 flex gap-1`,children:[e.markForTrain===!0&&u(`span`,{className:`rounded bg-primary/85 p-0.5 text-white`,title:`Marked for training`,"aria-label":`Marked for training`,children:u(Ue,{className:`h-3 w-3`})}),e.debug===!0&&u(`span`,{className:`rounded bg-black/70 p-0.5 text-white`,title:`Flagged for debug`,"aria-label":`Flagged for debug`,children:u(ze,{className:`h-3 w-3`})}),e.favourited===!0&&u(`span`,{className:`rounded bg-primary/85 p-0.5 text-white`,title:`Favourited`,"aria-label":`Favourited`,children:u(Ge,{className:`h-3 w-3`})})]})]}),r(`button`,{type:`button`,onClick:h,className:`min-w-0 px-2 py-1.5 text-left space-y-0.5`,children:[r(`p`,{className:`text-[11px] font-medium text-foreground truncate`,title:e.className,children:[e.className,qe(e)?r(`span`,{className:`text-foreground-subtle`,children:[` · `,qe(e)]}):null]}),u(`p`,{className:`text-[10px] text-foreground-subtle truncate`,title:t,children:t}),r(`div`,{className:`flex items-center justify-between gap-2`,children:[u(`span`,{className:`text-[10px] text-foreground-subtle truncate`,children:le(e.timestamp,n)}),m&&u(`span`,{className:`text-[10px] text-foreground-subtle shrink-0`,children:m})]})]}),l!==void 0&&u(`div`,{className:`px-2 pb-1.5`,children:l})]})}var lt=1400,ut=`Admin-gated URL — opens only inside an authenticated session`;function dt({label:t,value:n,title:i}){let[a,o]=l(!1);return d(()=>{if(!a)return;let e=setTimeout(()=>o(!1),lt);return()=>clearTimeout(e)},[a]),r(`button`,{type:`button`,onClick:e(()=>{(async()=>{try{await navigator.clipboard.writeText(n),o(!0)}catch{window.prompt(`Copy the media URL:`,n)}})()},[n]),title:i,"aria-label":`Copy ${t} URL`,className:`flex min-w-0 items-center gap-1 rounded border px-1.5 py-0.5 text-[10px] font-medium transition-colors ${a?`border-emerald-500/40 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`border-border text-foreground-subtle hover:border-primary hover:text-foreground`}`,children:[u(a?Se:ie,{className:`h-2.5 w-2.5 shrink-0`}),u(`span`,{className:`truncate`,children:a?`Copied`:t})]})}function ft({localUrl:e,publicUrl:t}){return r(`div`,{className:`flex flex-wrap gap-1`,children:[u(dt,{label:`Local`,value:e,title:`Copy LAN URL — ${ut}`}),t&&u(dt,{label:`Public`,value:t,title:`Copy public URL — ${ut}`})]})}var pt={firstFrame:`First frame (track start)`,lastFrame:`Last frame (track end)`,thumbnail:`Best detection`,thumbnailSmall:`Best detection (480)`,snapshot:`Snapshot`,keyFrame:`Key frame (native-res)`,keyFrameSmall:`Key frame (960)`,crop:`Object crop`,fullFrame:`Full frame`,fullFrameBoxed:`Full frame (boxed)`,faceCrop:`Face crop`,plateCrop:`Plate crop`};function mt(e){return e in pt}function ht(e){return mt(e)?pt[e]:e}function gt(e,t){return`${e}${Ie}/${encodeURIComponent(t)}`}n();var _t=3e4;function vt(t){let[n,r]=l(null),i=e(e=>{r(t=>t??e)},[]);return d(()=>{t||r(null)},[t]),{publicOrigin:n,probes:t?u(yt,{onOrigin:i}):null}}function yt({onOrigin:e}){let{data:t}=m({capName:`network-access`});return u(s,{children:(t??[]).map(t=>u(bt,{addonId:t.addonId,onOrigin:e},t.addonId))})}function bt({addonId:e,onOrigin:t}){let{data:n}=N({addonId:e},{refetchInterval:_t,retry:!1});return d(()=>{let e=n?re.safeParse(n):null,r=e?.success?e.data.endpoint?.url:void 0;if(r)try{t(new URL(r).origin)}catch{}},[n,t]),null}var q=typeof I==`function`,xt=`Track flags arrive with the next server update`;function St(){return{mutateAsync:async()=>{throw Error(`setTrackFlags unavailable`)},isPending:!1}}var Ct=q?I:St;function wt(e){if(typeof e!=`object`||!e||!(`trackId`in e)||!(`markForTrain`in e)||!(`debug`in e)||!(`favourited`in e))return null;let{trackId:t,markForTrain:n,debug:r,favourited:i}=e;return typeof t!=`string`||typeof n!=`boolean`||typeof r!=`boolean`||typeof i!=`boolean`?null:{trackId:t,markForTrain:n,debug:r,favourited:i}}n();function Tt({label:e,hint:t,checked:n,disabled:i,title:a,icon:o,onToggle:s}){return r(`button`,{type:`button`,role:`switch`,"aria-checked":n,"aria-label":e,disabled:i,title:a,onClick:s,className:`flex w-full items-center gap-2 rounded-md border px-2 py-1.5 text-left transition-colors disabled:opacity-50 ${n?`border-primary bg-primary/10`:`border-border bg-surface hover:bg-surface-hover`}`,children:[u(`span`,{className:n?`text-primary`:`text-foreground-subtle`,children:o}),r(`span`,{className:`min-w-0 flex-1`,children:[u(`span`,{className:`block text-[11px] font-medium text-foreground`,children:e}),u(`span`,{className:`block text-[10px] text-foreground-subtle`,children:t})]}),u(`span`,{"aria-hidden":`true`,className:`h-4 w-7 shrink-0 rounded-full p-0.5 transition-colors ${n?`bg-primary`:`bg-border`}`,children:u(`span`,{className:`block h-3 w-3 rounded-full bg-white transition-transform ${n?`translate-x-3`:``}`})})]})}function Et({deviceId:e,trackId:t,markForTrain:n,debug:i,favourited:a,onChange:o}){let s=Ct(),[c,d]=l(null),f=c?.markForTrain??n===!0,p=c?.debug??i===!0,m=c?.favourited??a===!0,h=!q||s.isPending,g=q?void 0:xt,_=n=>{h||(async()=>{try{let r=wt(await s.mutateAsync({deviceId:e,trackId:t,flags:n}));if(!r)return;d(r),o?.(r)}catch(e){let t=e instanceof Error?e.message:``;window.alert(t===``?`Could not update this track. Check the server logs.`:`Could not update this track — ${t}`)}})()};return r(`div`,{className:`grid gap-1.5 sm:grid-cols-2`,children:[u(Tt,{label:`Mark for training`,hint:`Keeps this track and its media past retention`,checked:f,disabled:h,...g===void 0?{}:{title:g},icon:u(Ue,{className:`h-4 w-4`}),onToggle:()=>_({markForTrain:!f})}),u(Tt,{label:`Debug`,hint:`Flag this track for diagnostic attention`,checked:p,disabled:h,...g===void 0?{}:{title:g},icon:u(ze,{className:`h-4 w-4`}),onToggle:()=>_({debug:!p})}),u(Tt,{label:`Favourited`,hint:`Keeps this track and its media past retention`,checked:m,disabled:h,...g===void 0?{}:{title:g},icon:u(Ge,{className:`h-4 w-4`}),onToggle:()=>_({favourited:!m})})]})}var J=100,Dt=120,Ot={polyline:``,points:[],snapshots:[],start:null,end:null,peakBox:null},Y=e=>e<0?0:e>1?1:e,X=e=>Math.round(e*100)/100;function kt(e,t){if(e.length<=t)return[...e];let n=(e.length-1)/(t-1),r=[];for(let i=0;i<t;i++)r.push(e[Math.round(i*n)]);return r[r.length-1]=e[e.length-1],r}function At(e,t,n){if(e.length===0||t===null)return Ot;let{width:r,height:i}=t;if(!Number.isFinite(r)||!Number.isFinite(i)||r<=0||i<=0)return Ot;let a=kt(e,n?.maxPoints??Dt).map(e=>({x:X(Y(e.x/r)*J),y:X(Y(e.y/i)*J)})),o=a[0]??null,s=a[a.length-1]??null,c=a.length>=2?a.map(e=>`${e.x},${e.y}`).join(` `):``,l=(n?.snapshots??[]).map(e=>({x:X(Y(e.x/r)*J),y:X(Y(e.y/i)*J),mediaKey:e.mediaKey})),u=null,d=-1;for(let t of e){let e=Y(t.bbox.w/r)*Y(t.bbox.h/i);e>d&&(d=e,u=t)}return{polyline:c,points:a,snapshots:l,start:o,end:s,peakBox:u?{x:X(Y(u.bbox.x/r)*J),y:X(Y(u.bbox.y/i)*J),w:X(Y(u.bbox.w/r)*J),h:X(Y(u.bbox.h/i)*J)}:null}}var jt=typeof z==`function`,Mt=`Track deletion arrives with the next server update`;function Nt(){return{mutateAsync:async()=>{throw Error(`deleteTracks unavailable`)},isPending:!1}}var Pt=jt?z:Nt;n();var Ft=15e3;function It(e){return`${Ie}/${encodeURIComponent(e)}`}var Lt=window.location.origin;function Rt({mediaKey:e,label:t}){let{src:n,failed:r}=Pe(It(e));return n===null?u(`div`,{className:`flex h-full w-full items-center justify-center bg-surface-hover`,children:r?u(de,{className:`h-4 w-4 text-foreground-subtle opacity-60`}):u(K,{className:`h-4 w-4 animate-spin text-foreground-subtle opacity-70`})}):u(`img`,{src:n,alt:t,className:`h-full w-full object-cover`})}var zt=new Set([`firstFrame`,`lastFrame`,`thumbnail`,`snapshot`]),Bt=new Set([`keyFrame`,`fullFrame`,`fullFrameBoxed`,`firstFrame`,`lastFrame`,`thumbnail`,`snapshot`]);function Vt(e){let[t,n]=l(null);return d(()=>{if(n(null),!e)return;let t=!1,r=new Image;return r.onload=()=>{t||n({width:r.naturalWidth,height:r.naturalHeight})},r.src=e,()=>{t=!0,r.onload=null}},[e]),t}function Ht({overlay:e,onPickSnapshot:t}){return!e.polyline&&!e.peakBox&&e.snapshots.length===0?null:r(`svg`,{viewBox:`0 0 100 100`,preserveAspectRatio:`none`,className:`pointer-events-none absolute inset-0 h-full w-full`,children:[e.peakBox&&u(`rect`,{x:e.peakBox.x,y:e.peakBox.y,width:e.peakBox.w,height:e.peakBox.h,fill:`none`,stroke:`#f59e0b`,strokeWidth:2,vectorEffect:`non-scaling-stroke`,rx:1}),e.polyline&&u(`polyline`,{points:e.polyline,fill:`none`,stroke:`#38bdf8`,strokeWidth:2,strokeLinejoin:`round`,strokeLinecap:`round`,strokeOpacity:.85,vectorEffect:`non-scaling-stroke`}),e.points.map((e,t)=>u(`circle`,{cx:e.x,cy:e.y,r:1,fill:`#38bdf8`,fillOpacity:.6,vectorEffect:`non-scaling-stroke`},`${String(e.x)}-${String(e.y)}-${String(t)}`)),e.snapshots.map((e,n)=>u(`circle`,{cx:e.x,cy:e.y,r:1.9,fill:`#0ea5e9`,fillOpacity:.95,stroke:`#082f49`,strokeWidth:.7,vectorEffect:`non-scaling-stroke`,className:t?`pointer-events-auto cursor-pointer`:void 0,onClick:t?n=>{n.stopPropagation(),t(e.mediaKey)}:void 0,children:u(`title`,{children:`Snapshot checkpoint — click to view this frame`})},`snap-${e.mediaKey}-${String(n)}`)),e.start&&u(`circle`,{cx:e.start.x,cy:e.start.y,r:2.4,fill:`#22c55e`,stroke:`#052e16`,strokeWidth:.6,vectorEffect:`non-scaling-stroke`}),e.end&&u(`circle`,{cx:e.end.x,cy:e.end.y,r:2.4,fill:`#ef4444`,stroke:`#450a0a`,strokeWidth:.6,vectorEffect:`non-scaling-stroke`})]})}function Z({label:e,value:t,mono:n}){return r(`div`,{className:`flex items-baseline justify-between gap-3 border-b border-border/60 py-1.5 last:border-0`,children:[u(`span`,{className:`shrink-0 text-[11px] uppercase tracking-wide text-foreground-subtle`,children:e}),u(`span`,{className:`min-w-0 truncate text-right text-xs font-medium text-foreground ${n?`font-mono text-[11px]`:``}`,title:t,children:t})]})}function Ut({row:t,cameraName:n,deleteAvailable:i,onClose:o,onDeleted:c,onFlagsChanged:p}){let m=f(),h=Pt(),g=t!==null,v=t?.deviceId??0,b=t?.trackId??``,x=t?.bestEventId??``,S=t?.timestamp??0,C=t?.windowMs??0,{data:T}=j({deviceId:v,trackId:b},{enabled:g}),{data:E}=te({trackId:b,deviceId:v},{enabled:g}),{data:O}=U({eventId:x,deviceId:v},{enabled:g&&x!==``}),{data:k}=y({deviceId:v,since:S-Ft,until:S+C+Ft},{enabled:g}),[A,M]=l(null),[N,P]=l(!1),{publicOrigin:ee,probes:F}=vt(g);d(()=>{M(null)},[v,b]);let I=a(()=>{let e=E??[],t=O??[];return e.find(e=>e.kind===`keyFrame`)||t.find(e=>e.kind===`fullFrameBoxed`)||([...t,...e].find(e=>e.kind===`crop`)??null)},[E,O]),L=A??I,R=Pe(L?It(L.key):void 0),z=a(()=>{let e=new Set,t=[];for(let n of[...O??[],...E??[]])n.key===``||e.has(n.key)||(e.add(n.key),t.push(n));return t},[O,E]),B=a(()=>z.find(e=>zt.has(e.kind))??null,[z]),V=Vt(Pe(B?It(B.key):void 0).src),H=a(()=>At(T?.positions??[],V,{snapshots:(T?.snapshots??[]).map(e=>({x:e.position.x,y:e.position.y,mediaKey:e.mediaKey}))}),[T?.positions,T?.snapshots,V]),ne=e(e=>{let t=z.find(t=>t.key===e);t&&M(t)},[z]);if(t===null)return null;let re=R.src,W=L?.kind,ie=W!==void 0&&Bt.has(W)&&V!==null&&(T?.positions.length??0)>=2,ae=k&&k.length>0?k[0]:null,oe=()=>{ae&&(P(!0),(async()=>{try{let e=await m.trpcClient.videoclips.getClipPlayback.query({deviceId:t.deviceId,clipId:ae.id});window.open(e.playbackUrl,`_blank`,`noopener`)}catch{window.alert(`Could not resolve clip playback. Check the server logs.`)}finally{P(!1)}})())},se=()=>{!i||h.isPending||window.confirm(`Delete this track and all its media? This cannot be undone.`)&&(async()=>{try{await h.mutateAsync({deviceId:t.deviceId,trackIds:[t.trackId]}),c()}catch{window.alert(`Failed to delete this track. Check the server logs.`)}})()},le=Math.round(t.importance*100),ue=T?.importanceReason?`${String(le)}% · ${T.importanceReason}`:`${String(le)}%`,pe=T?.zonesVisited&&T.zonesVisited.length>0?T.zonesVisited.join(`, `):`—`,he=T?.audioLabels&&T.audioLabels.length>0?T.audioLabels.map(e=>`${e.label} ×${String(e.count)} (${String(Math.round(e.peakScore*100))}%)`).join(` · `):`—`,ge=T?T.totalDistance.toFixed(2):`—`,_e=ot(T?.previewMissReason),ve=me(T?T.firstSeen:S),ye=T?me(T.lastSeen):`—`;return u(D,{open:!0,onOpenChange:e=>!e&&o(),children:r(_,{width:`lg`,placement:`sheet-on-mobile`,"aria-label":`Event detail`,className:`flex h-[92dvh] flex-col gap-0 overflow-hidden p-0 bottom-0 left-0 right-0 top-auto w-full max-w-full translate-x-0 translate-y-0 rounded-b-none md:bottom-auto md:left-1/2 md:right-auto md:top-1/2 md:h-auto md:w-[calc(100vw-2rem)] md:max-w-xl md:-translate-x-1/2 md:-translate-y-1/2 md:rounded-lg md:max-h-[calc(100dvh-2rem)]`,children:[r(`header`,{className:`flex shrink-0 items-start justify-between gap-2 border-b border-border px-4 py-3`,children:[r(`div`,{className:`min-w-0`,children:[r(`div`,{className:`truncate text-sm font-semibold text-foreground`,children:[t.className,qe(t)?r(`span`,{className:`text-foreground-subtle`,children:[` · `,qe(t)]}):null]}),u(`div`,{className:`mt-0.5 truncate text-[11px] text-foreground-subtle`,children:n})]}),u(`button`,{type:`button`,onClick:o,className:`rounded p-1 text-foreground-subtle hover:bg-surface-hover hover:text-foreground`,"aria-label":`Close`,children:u(Ae,{className:`h-4 w-4`})})]}),r(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto overscroll-contain px-4 py-3`,children:[re?u(`div`,{className:`overflow-hidden rounded-lg border border-border bg-background`,children:u(fe,{src:re,alt:`Key frame from ${n}`,fit:`natural`,className:`w-full`,overlay:ie?u(Ht,{overlay:H,onPickSnapshot:ne}):void 0})}):u(`div`,{className:`flex aspect-video w-full flex-col items-center justify-center gap-1.5 rounded-lg border border-border bg-surface-hover text-foreground-subtle`,children:R.failed?r(s,{children:[u(de,{className:`h-8 w-8 opacity-60`}),u(`span`,{className:`text-[11px]`,children:`Key-frame media unavailable`})]}):u(K,{className:`h-6 w-6 animate-spin opacity-70`})}),z.length>0&&u(`div`,{className:`-mx-1 flex gap-2 overflow-x-auto px-1 pb-1`,children:z.map(e=>{let t=ht(e.kind),n=gt(Lt,e.key),i=ee?gt(ee,e.key):null;return r(`figure`,{className:`flex w-32 shrink-0 flex-col gap-1`,children:[u(`button`,{type:`button`,onClick:()=>M(e),className:`relative h-16 w-full overflow-hidden rounded border border-border hover:border-primary`,title:`${t} · ${me(e.timestamp)}`,children:u(Rt,{mediaKey:e.key,label:t})}),r(`figcaption`,{className:`min-w-0 px-0.5`,children:[u(`div`,{className:`truncate text-[10px] font-medium leading-tight text-foreground`,title:t,children:t}),u(`div`,{className:`text-[10px] leading-tight text-foreground-subtle`,title:me(e.timestamp),children:ce(e.timestamp)})]}),u(ft,{localUrl:n,publicUrl:i})]},e.key)})}),F,ae&&r(w,{variant:`secondary`,onClick:oe,disabled:N,children:[N?u(K,{className:`h-3.5 w-3.5 animate-spin`}):u(Ee,{className:`h-3.5 w-3.5`}),` `,`View clip`]}),u(Et,{deviceId:t.deviceId,trackId:t.trackId,...(T?.markForTrain??t.markForTrain)===void 0?{}:{markForTrain:T?.markForTrain??t.markForTrain},...(T?.debug??t.debug)===void 0?{}:{debug:T?.debug??t.debug},...(T?.favourited??t.favourited)===void 0?{}:{favourited:T?.favourited??t.favourited},onChange:p}),_e!==null&&r(`div`,{className:`rounded-lg border border-warning/40 bg-warning/8 px-3 py-2`,children:[u(`p`,{className:`text-[11px] font-semibold uppercase tracking-wide text-foreground-subtle`,children:`Best shot`}),u(`p`,{className:`mt-0.5 text-xs text-foreground`,children:_e.sentence}),u(`code`,{className:`mt-1 block break-all font-mono text-[10px] text-foreground-subtle`,children:_e.raw})]}),r(`div`,{className:`rounded-lg border border-border bg-surface px-3 py-1`,children:[u(Z,{label:`Camera`,value:n}),u(Z,{label:`Class`,value:t.className}),u(Z,{label:`Label`,value:t.label??`—`}),u(Z,{label:`Sub-label`,value:t.subLabel??`—`}),u(Z,{label:`Importance`,value:ue}),u(Z,{label:`Zones visited`,value:pe}),u(Z,{label:`Audio heard`,value:he}),u(Z,{label:`Total distance`,value:ge}),u(Z,{label:`First seen`,value:ve}),u(Z,{label:`Last seen`,value:ye}),u(Z,{label:`Track`,value:t.trackId,mono:!0})]})]}),u(`footer`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-border px-4 py-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]`,children:u(`span`,{title:i?void 0:Mt,children:r(w,{variant:`secondary`,onClick:se,disabled:!i||h.isPending,children:[h.isPending?u(K,{className:`h-3.5 w-3.5 animate-spin`}):u(De,{className:`h-3.5 w-3.5`}),` `,`Delete track`]})})})]})})}var Wt=`pipeline-analytics`,Gt=`debug.listTracks`,Kt=`debug.analyze`,qt=`/addon/pipeline-analytics/debug-export`;function Jt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Q(e,t){let n=e[t];return typeof n==`string`?n:null}function $(e,t){let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:null}function Yt(e,t){let n=e[t];return typeof n==`boolean`?n:null}function Xt(e){return e===`error`||e===`warn`||e===`info`}function Zt(e){if(!Jt(e))return null;let t=Q(e,`code`),n=Q(e,`detail`),r=e.severity;return t===null||n===null||!Xt(r)?null:{code:t,severity:r,detail:n}}function Qt(e){if(!Jt(e))return null;let t=Q(e,`trackId`),n=$(e,`deviceId`),r=Q(e,`className`),i=$(e,`firstSeen`),a=$(e,`lastSeen`),o=$(e,`durationMs`),s=Yt(e,`active`);if(t===null||n===null||r===null||i===null||a===null||o===null||s===null)return null;let c=Q(e,`label`),l=Q(e,`subLabel`),u=Q(e,`previewMissReason`),d=Yt(e,`markForTrain`),f=Yt(e,`favourited`);return{trackId:t,deviceId:n,className:r,...c===null?{}:{label:c},...l===null?{}:{subLabel:l},firstSeen:i,lastSeen:a,durationMs:o,active:s,timestamp:i,windowMs:o,importance:$(e,`importance`)??0,bestEventId:Q(e,`bestEventId`)??``,...d===null?{}:{markForTrain:d},...f===null?{}:{favourited:f},debug:!0,...u===null||u.length===0?{}:{previewMissReason:u}}}function $t(e){let t=Qt(e);if(t===null||!Jt(e))return null;let n=$(e,`mediaCount`),r=$(e,`eventCount`),i=$(e,`positionCount`);if(n===null||r===null||i===null)return null;let a=e.mediaKinds,o=e.findings;if(!Array.isArray(a)||!Array.isArray(o))return null;let s=a.filter(e=>typeof e==`string`),c=[];for(let e of o){let t=Zt(e);t!==null&&c.push(t)}let l=e.thumbnailProvenance;return{...t,mediaCount:n,mediaKinds:s,eventCount:r,positionCount:i,findings:c,...nt(l)?{thumbnailProvenance:l}:{}}}function en(e){if(!Jt(e))return null;let t=Yt(e,`truncated`),n=e.tracks;if(t===null||!Array.isArray(n))return null;let r=[];for(let e of n){let t=Qt(e);if(t===null)return null;r.push(t)}return{tracks:r,truncated:t}}function tn(e){if(!Jt(e))return null;let t=e.reports,n=e.vanished;if(!Array.isArray(t)||!Array.isArray(n))return null;let r=[];for(let e of t){let t=$t(e);if(t===null)return null;r.push(t)}return{reports:r,vanished:n.filter(e=>typeof e==`string`)}}var nn={MEDIA_EVICTED_OR_NEVER:`no media`,MISSING_KEYFRAME:`no keyframe`,MISSING_FIRSTFRAME:`no first frame`,MISSING_LASTFRAME:`no last frame`,MISSING_THUMBNAIL:`no thumbnail`,MISSING_BEST_CROP:`no crop`,SHORT_TRACK:`very short`,ZERO_EVENTS:`no events`,ZERO_POSITIONS:`no trajectory`,NO_PERIODIC_SNAPSHOTS:`no snapshots`,LASTFRAME_STALE:`stale last frame`,MEDIA_STOPPED_EARLY:`media stopped early`,NO_BEST_EVENT:`no best event`,LOW_BEST_SCORE:`low score`,BEST_SHOT_STANDIN:`stand-in best shot`,BEST_SHOT_RASTER:`low-res best shot`};function rn(e){return nn[e]??e}var an={error:0,warn:1,info:2};function on(e){return e.toSorted((e,t)=>an[e.severity]-an[t.severity]||e.code.localeCompare(t.code))}function sn(e){return e.length===0?qt:`${qt}?deviceIds=${e.join(`,`)}`}function cn(e,t){return`${String(e)}:${t}`}function ln(e,t){let n=[],r=new Set;for(let i of e){let e=cn(i.deviceId,i.trackId);!t.has(e)||r.has(e)||(r.add(e),n.push({deviceId:i.deviceId,trackId:i.trackId}))}return n}n();var un=`all`,dn=`The server answered in a shape this build does not understand.`,fn={error:`danger`,warn:`warning`,info:`info`};function pn({findings:e}){return e.length===0?u(x,{variant:`success`,children:`no anomaly found`}):u(`div`,{className:`flex flex-wrap gap-1`,children:on(e).map(e=>u(x,{variant:fn[e.severity],title:e.detail,children:rn(e.code)},e.code))})}function mn({track:e,report:t,analyzing:n}){let i=ot(t?.previewMissReason??e.previewMissReason);return r(`div`,{className:`space-y-1 border-t border-border pt-1.5`,children:[t===void 0?u(`span`,{className:`text-[10px] text-foreground-subtle`,children:n?`analysing…`:`not analysed`}):r(s,{children:[u(pn,{findings:t.findings}),r(`p`,{className:`text-[10px] text-foreground-subtle`,title:t.mediaKinds.length>0?t.mediaKinds.join(`, `):`no media of any kind`,children:[String(t.mediaCount),` media · `,String(t.eventCount),` events ·`,` `,String(t.positionCount),` positions`]})]}),i!==null&&u(`p`,{className:`text-[10px] text-foreground-subtle`,title:i.raw,children:i.sentence})]})}function hn(){let e=f(),[t,n]=l(un),[i,s]=l(!1),[c,d]=l(null),[p,m]=l(new Set),[h,g]=l(null),[_,v]=l(null),[y,x]=l(null),[S,T]=l([]),E=Ct(),D=O({isCamera:!0,projection:`slim`}),k=a(()=>[{value:un,label:`All cameras`},...(D.data??[]).map(e=>({value:String(e.id),label:e.name}))],[D.data]),j=a(()=>{let e=new Map;for(let t of D.data??[])e.set(t.id,t.name);return e},[D.data]),M=e=>j.get(e)??`Camera ${String(e)}`,N=a(()=>t===un?[]:[Number.parseInt(t,10)],[t]),P=o({queryKey:[`events-debug`,`list`,N],queryFn:async()=>en(await e.trpcClient.addons.custom.mutate({addonId:Wt,action:Gt,input:N.length===0?{}:{deviceIds:N}}))}),ee=a(()=>(P.data?.tracks??[]).map(e=>e.trackId),[P.data]),F=o({queryKey:[`events-debug`,`analyze`,ee],enabled:ee.length>0,queryFn:async()=>tn(await e.trpcClient.addons.custom.mutate({addonId:Wt,action:Kt,input:{trackIds:ee}}))}),I=a(()=>{let e=new Map;for(let t of F.data?.reports??[])e.set(t.trackId,t);return e},[F.data]),L=P.data?.tracks??[],R=P.data===null||F.data===null,z=()=>{P.refetch(),F.refetch()},B=e=>{m(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},V=()=>{m(new Set(L.map(e=>cn(e.deviceId,e.trackId))))},te=()=>m(new Set),H=async(e,t)=>{let n=e===`analyzed`?{debug:!1}:{favourited:!0},r=0,i=[];for(let e of t)try{await E.mutateAsync({deviceId:e.deviceId,trackId:e.trackId,flags:n}),r+=1}catch{i.push(e.trackId)}return{applied:r,refused:i}},U=e=>{if(!q||_!==null)return;let t=ln(L,p);t.length!==0&&(v(e),x(null),(async()=>{let n=await H(e,t);v(null);let r=new Set(n.refused);m(new Set(t.filter(e=>r.has(e.trackId)).map(e=>cn(e.deviceId,e.trackId)))),e===`analyzed`&&T(t.filter(e=>!r.has(e.trackId))),n.refused.length>0&&x(`${String(n.refused.length)} of ${String(t.length)} were refused by the server and are still selected. Check the hub log.`),P.refetch()})())},ne=()=>{let e=S;e.length===0||_!==null||(v(`analyzed`),x(null),(async()=>{for(let t of e)try{await E.mutateAsync({deviceId:t.deviceId,trackId:t.trackId,flags:{debug:!0}})}catch{x(`Some tracks could not be re-marked. Refresh and try again.`)}v(null),T([]),P.refetch()})())},re=async()=>{s(!0),d(null);try{await Fe(sn(N),`camstack-debug.zip`)}catch(e){d(e instanceof Error?e.message:`Export failed.`)}finally{s(!1)}},W=_!==null;return u(Ne,{children:r(`section`,{className:`space-y-3`,children:[r(`div`,{className:`flex flex-wrap items-center gap-2`,children:[u(`div`,{className:`w-44`,children:u(C,{value:t,options:k,onChange:e=>n(e.target.value)})}),r(w,{variant:`secondary`,onClick:z,disabled:P.isFetching,children:[P.isFetching?u(K,{className:`h-3.5 w-3.5 animate-spin`}):u(ve,{className:`h-3.5 w-3.5`}),`Refresh`]}),r(w,{onClick:()=>void re(),disabled:i||L.length===0,children:[i?u(K,{className:`h-3.5 w-3.5 animate-spin`}):u(ae,{className:`h-3.5 w-3.5`}),`Export all (`,String(L.length),`)`]}),L.length>0&&p.size<L.length&&u(w,{variant:`ghost`,onClick:V,children:`Select all`})]}),r(`p`,{className:`text-xs text-foreground-subtle`,children:[`A `,u(`code`,{children:`debug`}),` mark does not pin retention — this lists the marked tracks that still exist. A track whose media was evicted shows as missing media. Use `,u(`strong`,{children:`Keep`}),` `,`to hold a selection against pruning while you investigate, and `,u(`strong`,{children:`Analyzed`}),` `,`to un-mark the ones you are finished with.`]}),P.isError&&u(A,{message:`Could not load the marked tracks.`}),R&&!P.isError&&u(A,{message:dn}),c!==null&&u(A,{message:c}),y!==null&&u(A,{message:y}),P.data?.truncated===!0&&u(A,{message:`A camera filled the per-camera cap — some marked tracks are not listed. Un-mark a few, or filter to one camera.`}),(F.data?.vanished.length??0)>0&&r(`p`,{className:`text-xs text-foreground-subtle`,children:[String(F.data?.vanished.length),` marked track(s) were evicted between the list and the analysis.`]}),p.size>0&&r(`div`,{className:`flex flex-wrap items-center gap-2 rounded-md border border-primary/40 bg-primary/8 px-3 py-2`,children:[r(`span`,{className:`text-xs font-medium text-foreground`,children:[String(p.size),` selected`]}),r(`div`,{className:`ml-auto flex flex-wrap items-center gap-1.5`,children:[u(`span`,{title:q?void 0:`Track flags arrive with the next server update`,children:r(w,{variant:`secondary`,onClick:()=>U(`keep`),disabled:!q||W,children:[_===`keep`?u(K,{className:`h-3.5 w-3.5 animate-spin`}):u(Ge,{className:`h-3.5 w-3.5`}),` `,`Keep`]})}),u(`span`,{title:q?void 0:`Track flags arrive with the next server update`,children:r(w,{onClick:()=>U(`analyzed`),disabled:!q||W,children:[_===`analyzed`?u(K,{className:`h-3.5 w-3.5 animate-spin`}):u(Se,{className:`h-3.5 w-3.5`}),` `,`Analyzed`]})}),u(w,{variant:`ghost`,onClick:te,disabled:W,children:u(Ae,{className:`h-3.5 w-3.5`})})]})]}),S.length>0&&r(`div`,{className:`flex flex-wrap items-center gap-2 rounded-md border border-border bg-surface px-3 py-2`,children:[r(`span`,{className:`text-xs text-foreground`,children:[String(S.length),` track(s) marked analyzed and removed from this list.`]}),r(w,{variant:`ghost`,onClick:ne,disabled:W,children:[u(xe,{className:`h-3.5 w-3.5`}),` Undo`]}),u(w,{variant:`ghost`,onClick:()=>T([]),disabled:W,children:u(Ae,{className:`h-3.5 w-3.5`})})]}),P.isLoading?u(b,{children:u(`div`,{className:`px-3 py-6 text-center text-xs text-foreground-subtle`,children:`Loading…`})}):L.length===0?u(b,{children:r(`div`,{className:`flex flex-col items-center gap-2 px-3 py-8 text-center`,children:[u(ze,{className:`h-5 w-5 text-foreground-subtle`}),u(`p`,{className:`text-xs text-foreground-subtle`,children:`No track is marked for debug. Mark one from a track's actions to see it here.`})]})}):u(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(11rem,1fr))] gap-2`,children:L.map(e=>{let t=I.get(e.trackId);return u(ct,{row:e,cameraName:M(e.deviceId),nowMs:e.lastSeen,selected:p.has(cn(e.deviceId,e.trackId)),onToggleSelect:B,onOpenDetail:g,...t?.thumbnailProvenance===void 0?{}:{provenance:t.thumbnailProvenance},footer:u(mn,{track:e,report:t,analyzing:F.isFetching})},cn(e.deviceId,e.trackId))})}),h&&u(Ut,{row:h,cameraName:M(h.deviceId),deleteAvailable:jt,onClose:()=>g(null),onDeleted:()=>{g(null),P.refetch()},onFlagsChanged:e=>{e.debug||(g(null),P.refetch())}})]})})}var gn=200,_n=3e4,vn=[];function yn(e){let t=f(),n=e.deviceIds.length>0,r=[...e.deviceIds].sort((e,t)=>e-t),{data:i,isLoading:a}=o({queryKey:[`events-feed`,r,e.since,e.until,e.minImportance??null,e.classFilter??null],enabled:n,staleTime:_n,refetchInterval:_n,queryFn:async()=>(await t.trpcClient.pipelineAnalytics.getKeyEventsBatch.query({deviceIds:r,since:e.since,until:e.until,limit:gn,...e.minImportance===void 0?{}:{minImportance:e.minImportance},...e.classFilter===void 0?{}:{classFilter:e.classFilter}})).map(e=>e.events.map(t=>({...t,deviceId:e.deviceId})))});return{rows:Xe(Ye(i??vn),`importance`),isLoading:n&&a}}n();var bn=[`events-feed`],xn=2e3;function Sn(n){let r=c(),i=n?.paused===!0,a=t(r);a.current=r;let o=t(i);o.current=i;let[s,u]=l(!1),f=e(()=>{a.current.invalidateQueries({queryKey:bn})},[]),p=t(void 0);p.current||=_e({delayMs:xn,invalidate:()=>{o.current?u(!0):f()}}),d(()=>()=>p.current?.cancel(),[]),d(()=>{i||!s||(u(!1),f())},[i,s,f]);let m=e(()=>{u(!1),f()},[f]);return k(ne.PipelineAnalyticsDetectionEvent,()=>{p.current?.trigger()}),k(ne.PipelineAnalyticsTrackEnded,()=>{p.current?.trigger()}),{pending:s,refreshNow:m}}n();function Cn({groups:e,selected:t,onChange:n,loading:i=!1}){let{t:o}=je(),[s,c]=l(!1),[d,f]=l(``),[p,m]=l(new Set),h=d.trim().toLowerCase(),g=e=>h.length===0||P(e,o).toLowerCase().includes(h),_=a(()=>e.map(e=>({macro:e.macro,subs:e.subs.filter(t=>g(t)||g(e.macro))})).filter(e=>g(e.macro)||e.subs.length>0),[e,h]),v=e=>m(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),y=e=>{let r=new Set(t),i=t.has(e.macro.kind)&&e.subs.every(e=>t.has(e.kind)),a=[e.macro.kind,...e.subs.map(e=>e.kind)];if(i)for(let e of a)r.delete(e);else for(let e of a)r.add(e);n(r)},b=e=>{let r=new Set(t);r.has(e)?r.delete(e):r.add(e),n(r)},x=()=>n(new Set),S=t.size;return r(`div`,{className:`relative`,children:[r(`button`,{type:`button`,onClick:()=>c(e=>!e),className:`flex items-center gap-1 rounded-md px-2.5 py-1 text-xs transition-colors ${S>0?`bg-primary/12 text-primary font-medium`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground`}`,children:[u(Ke,{className:`h-3.5 w-3.5`}),S>0?`Kinds (${String(S)})`:`Kinds`,u(Me,{className:`h-3 w-3`})]}),s&&r(`div`,{className:`absolute z-20 mt-1 max-h-80 w-64 overflow-auto rounded-md border border-border bg-surface p-2 shadow-lg`,children:[r(`div`,{className:`mb-2 flex items-center gap-1 rounded border border-border px-1.5`,children:[u(Oe,{className:`h-3.5 w-3.5 text-foreground-subtle`}),u(`input`,{type:`text`,value:d,onChange:e=>f(e.target.value),placeholder:`Search kinds…`,className:`w-full bg-transparent py-1 text-xs outline-none`}),S>0&&u(`button`,{type:`button`,onClick:x,className:`text-[10px] text-foreground-subtle hover:text-foreground`,children:`Clear`})]}),_.length===0&&u(`div`,{className:`px-1 py-2 text-[11px] text-foreground-subtle`,children:i?`Loading kinds…`:h.length>0?`No kind matches that search.`:`These cameras advertise no event kinds.`}),_.map(e=>{let n=B(e.macro.iconId),i=p.has(e.macro.kind)||h.length>0,a=t.has(e.macro.kind);return r(`div`,{className:`mb-0.5`,children:[r(`div`,{className:`flex items-center gap-1`,children:[e.subs.length>0?u(`button`,{type:`button`,onClick:()=>v(e.macro.kind),className:`text-foreground-subtle hover:text-foreground`,"aria-label":`Expand`,children:u(i?Me:we,{className:`h-3 w-3`})}):u(`span`,{className:`w-3`}),r(`label`,{className:`flex flex-1 cursor-pointer items-center gap-1.5 rounded px-1 py-0.5 text-xs hover:bg-surface-hover`,children:[u(`input`,{type:`checkbox`,checked:a,onChange:()=>y(e),className:`accent-primary`}),u(n,{className:`h-3.5 w-3.5`,style:{color:e.macro.color}}),u(`span`,{className:`font-medium`,children:P(e.macro,o)})]})]}),i&&e.subs.map(e=>{let n=B(e.iconId);return r(`label`,{className:`ml-5 flex cursor-pointer items-center gap-1.5 rounded px-1 py-0.5 text-xs hover:bg-surface-hover`,children:[u(`input`,{type:`checkbox`,checked:t.has(e.kind),onChange:()=>b(e.kind),className:`accent-primary`}),u(n,{className:`h-3.5 w-3.5`,style:{color:e.color}}),u(`span`,{children:P(e,o)})]},e.kind)})]},e.macro.kind)})]})]})}function wn(e,t){let n=new Map;for(let r of e)if(!(t.size>0&&!t.has(r.deviceId)))for(let e of r.kinds)n.has(e.kind)||n.set(e.kind,e);return n}function Tn(e,t){return{...t,kind:e,labelKey:`eventKind.${e}`,label:e.charAt(0).toUpperCase()+e.slice(1),iconId:e,parentKind:null,level:`macro`}}var En=new Set([`detection`,`package`]);function Dn(e,t){return[...wn(e,t).values()].filter(e=>e.parentKind===null&&En.has(e.category)).sort((e,t)=>e.label.localeCompare(t.label))}function On(e,t){let n=wn(e,t),r=new Map,i=new Map;for(let e of n.values()){if(e.parentKind===null){i.set(e.kind,e);continue}let t=r.get(e.parentKind);t===void 0?r.set(e.parentKind,[e]):t.push(e)}for(let[e,t]of r){if(i.has(e))continue;let n=t[0];n!==void 0&&i.set(e,Tn(e,n))}return[...i.values()].map(e=>({macro:e,subs:[...r.get(e.kind)??[]].sort((e,t)=>e.label.localeCompare(t.label))})).sort((e,t)=>e.macro.label.localeCompare(t.macro.label))}n();function kn(){let[n,r]=l(!1),i=t(null),[a,o]=l(0),s=e(e=>{i.current!==e&&(i.current=e,o(e=>e+1))},[]);return d(()=>{let e=i.current;if(!e||typeof IntersectionObserver>`u`){r(!1);return}let t=new IntersectionObserver(e=>{let t=e[e.length-1];t&&r(!t.isIntersecting)},{rootMargin:`64px 0px 0px 0px`,threshold:0});return t.observe(e),()=>t.disconnect()},[a]),{ref:s,scrolledPast:n}}n();var An=[`events-feed`],jn=60,Mn=[{value:`importance`,label:`Importance`,icon:Re},{value:`time`,label:`Recent`,icon:W}];function Nn(){let e=c(),[t,n]=l(ge),[i,o]=l(new Set),[f,p]=l(new Set),[m,h]=l(0),[g,_]=l(`time`),[v,y]=l(new Set),[b,x]=l(null),[S,C]=l(()=>Date.now());d(()=>{let e=setInterval(()=>C(Date.now()),6e4);return()=>clearInterval(e)},[]);let{since:T,until:E}=a(()=>et({fromMs:t.fromMs,toMs:t.toMs},S),[t.fromMs,t.toMs,S]),D=kn(),{pending:k,refreshNow:A}=Sn({paused:b!==null||v.size>0||D.scrolledPast}),{data:j=[]}=O({isCamera:!0,projection:`slim`}),M=a(()=>j.map(e=>e.id),[j]),{data:N,isLoading:P}=V({deviceIds:M},{enabled:M.length>0,staleTime:5*6e4}),ee=a(()=>On(N??[],i),[N,i]),F=Pt(),I=F.isPending,{rows:L,isLoading:R}=yn({deviceIds:M,since:T,until:E,minImportance:m>0?m:void 0,classFilter:f.size===1?[...f][0]:void 0}),z=a(()=>{let e=new Map;for(let t of j??[])e.set(t.id,t.name);return e},[j]),B=e=>z.get(e)??`Camera #${String(e)}`,te=a(()=>se(L).map(e=>({id:e,name:B(e)})).sort((e,t)=>e.name.localeCompare(t.name)),[L,z]),H=a(()=>Xe(Ze(L,{cameras:i,classes:f,minImportance:m}),g),[L,i,f,m,g]),U=pe(H,jn,a(()=>JSON.stringify([[...i].sort((e,t)=>e-t),[...f].sort(),m,g,T,E]),[i,f,m,g,T,E])),ne=()=>{e.invalidateQueries({queryKey:An})},re=()=>y(new Set);function W(e){y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function ie(){if(v.size===0||!jt)return;let e=$e(L,v),t=[...e.values()].reduce((e,t)=>e+t.length,0);if(t===0||!window.confirm(`Delete ${String(t)} track${t===1?``:`s`} and all their media? This cannot be undone.`))return;let n=[...e];Promise.allSettled(n.map(([e,t])=>F.mutateAsync({deviceId:e,trackIds:t}))).then(e=>{ne();let t=[],r=new Set;if(e.forEach((e,i)=>{let a=n[i];if(!a)return;let[o,s]=a;if(e.status===`fulfilled`)for(let e of s)r.add(Qe(o,e));else t.push(o)}),y(e=>{let t=new Set(e);for(let e of r)t.delete(e);return t}),t.length>0){let e=t.map(e=>B(e)).join(`, `);window.alert(`Failed to delete tracks on: ${e}. They remain selected — retry, or check the server logs.`)}})}let ae=H.length!==L.length;return r(`div`,{className:`relative space-y-3`,children:[r(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[u(he,{onChange:n}),u(ue,{cameras:te,selected:i,onChange:o}),u(Cn,{groups:ee,selected:f,onChange:p,loading:P}),r(`label`,{className:`flex items-center gap-1.5 text-[11px] text-foreground-subtle`,children:[u(`span`,{children:`Min score`}),u(`input`,{type:`range`,min:0,max:1,step:.05,value:m,onChange:e=>h(Number(e.target.value)),className:`h-1 w-24 cursor-pointer accent-primary`,"aria-label":`Minimum importance`}),u(`span`,{className:`w-6 tabular-nums text-foreground`,children:Math.round(m*100)})]}),u(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5`,children:Mn.map(e=>{let t=e.icon;return r(`button`,{type:`button`,onClick:()=>_(e.value),className:`flex items-center gap-1 rounded px-2 py-1 text-[11px] transition-colors ${g===e.value?`bg-primary/12 text-primary font-medium`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground`}`,children:[u(t,{className:`h-3.5 w-3.5`}),` `,e.label]},e.value)})}),!R&&u(`span`,{className:`ml-auto text-[10px] text-foreground-subtle`,children:ae?`${String(H.length)} of ${String(L.length)} events`:`${String(H.length)} event${H.length===1?``:`s`}`})]}),v.size>0&&r(`div`,{className:`flex flex-wrap items-center gap-2 rounded-md border border-primary/40 bg-primary/8 px-3 py-2`,children:[r(`span`,{className:`text-xs font-medium text-foreground`,children:[v.size,` selected`]}),r(`div`,{className:`ml-auto flex flex-wrap items-center gap-1.5`,children:[u(`span`,{title:jt?void 0:`Track deletion arrives with the next server update`,children:r(w,{variant:`secondary`,onClick:ie,disabled:!jt||I,children:[I?u(K,{className:`h-3.5 w-3.5 animate-spin`}):u(De,{className:`h-3.5 w-3.5`}),` `,`Delete`]})}),u(w,{variant:`ghost`,onClick:re,disabled:I,children:u(Ae,{className:`h-3.5 w-3.5`})})]})]}),R&&r(`div`,{className:`flex items-center gap-2 py-4 text-xs text-foreground-subtle`,children:[u(K,{className:`h-4 w-4 animate-spin`}),` Loading events…`]}),!R&&H.length===0&&u(`p`,{className:`py-4 text-xs text-foreground-subtle`,children:`No key events in this window.`}),k&&u(`div`,{className:`sticky top-2 z-20 flex justify-center`,children:u(`button`,{type:`button`,onClick:A,className:`rounded-full border border-primary/40 bg-surface px-3 py-1 text-[11px] font-medium text-primary shadow-sm hover:bg-primary/10`,children:`New events — refresh`})}),!R&&H.length>0&&r(s,{children:[u(`div`,{ref:D.ref,"aria-hidden":!0,className:`h-0`}),u(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(11rem,1fr))] gap-2`,children:U.pageItems.map(e=>u(ct,{row:e,cameraName:B(e.deviceId),nowMs:S,selected:v.has(Qe(e.deviceId,e.trackId)),onToggleSelect:W,onOpenDetail:x},Qe(e.deviceId,e.trackId)))}),u(oe,{currentPage:U.page,totalItems:U.totalItems,pageSize:U.pageSize,onPageChange:U.setPage,itemNoun:`events`})]}),b&&u(Ut,{row:b,cameraName:B(b.deviceId),deleteAvailable:jt,onClose:()=>x(null),onDeleted:()=>{ne(),x(null)},onFlagsChanged:e=>{x(t=>t&&t.trackId===e.trackId?{...t,markForTrain:e.markForTrain,debug:e.debug,favourited:e.favourited}:t)}})]})}n();var Pn=50,Fn=350,In=[{value:.2,label:`Loose`},{value:.25,label:`Balanced`},{value:.3,label:`Strict`}];function Ln(e){return{id:e.id,trackId:e.trackId??e.id,deviceId:e.deviceId,timestamp:e.timestamp,className:e.className,label:e.label,subLabel:e.subLabel,importance:e.importance??0,bestEventId:e.mediaKey??e.trackId??e.id,windowMs:void 0}}function Rn({onActiveChange:e}){let[t,n]=l(``),[i,o]=l(.2),[s,c]=l(null),[f,p]=l(null),[m,h]=l(null),g=F(t,Fn).trim(),_=g.length>0;d(()=>{e(_)},[_,e]);let[v,y]=l(()=>Date.now());d(()=>{let e=setInterval(()=>y(Date.now()),6e4);return()=>clearInterval(e)},[]);let{data:b=[]}=O({isCamera:!0,projection:`slim`}),x=a(()=>{let e=new Map;for(let t of b)e.set(t.id,t.name);return e},[b]),S=e=>x.get(e)??`Camera #${String(e)}`,C=a(()=>b.map(e=>e.id),[b]),{data:w}=V({deviceIds:C},{enabled:C.length>0,staleTime:5*6e4}),T=a(()=>Dn(w??[],new Set(f===null?[]:[f])),[w,f]);d(()=>{s!==null&&(T.some(e=>e.kind===s)||c(null))},[T,s]);let{data:E,isFetching:D,isError:k,error:A}=L({text:g,minScore:i,limit:Pn,classFilter:s??void 0,deviceId:f??void 0},{enabled:_}),j=a(()=>[...E??[]].sort((e,t)=>t.score-e.score).map(e=>({...Ln(e),score:e.score})),[E]);function M(e){c(t=>t===e?null:e)}return r(`div`,{className:`space-y-3`,children:[r(`div`,{className:`rounded-lg border border-border bg-surface p-3 space-y-3`,children:[r(`div`,{className:`flex flex-wrap items-center gap-2`,children:[r(`div`,{className:`relative min-w-[16rem] flex-1`,children:[u(Oe,{className:`pointer-events-none absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-foreground-subtle`}),u(`input`,{type:`text`,value:t,onChange:e=>n(e.target.value),placeholder:`Semantic search — describe what you're looking for…`,className:`h-9 w-full rounded-md border border-border bg-background pl-8 pr-8 text-sm text-foreground placeholder:text-foreground-subtle focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary`,"aria-label":`Semantic event search`}),t&&u(`button`,{type:`button`,onClick:()=>n(``),className:`absolute right-2 top-1/2 -translate-y-1/2 rounded p-0.5 text-foreground-subtle hover:bg-surface-hover hover:text-foreground`,"aria-label":`Clear search`,children:u(Ae,{className:`h-3.5 w-3.5`})})]}),D&&_&&u(K,{className:`h-4 w-4 shrink-0 animate-spin text-foreground-subtle`})]}),r(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[u(`div`,{className:`flex items-center gap-1`,children:T.map(e=>u(`button`,{type:`button`,onClick:()=>M(e.kind),className:`rounded-md px-2.5 py-1 text-xs transition-colors ${s===e.kind?`bg-primary/12 text-primary font-medium`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground`}`,children:P(e)},e.kind))}),r(`label`,{className:`flex items-center gap-1.5 text-[11px] text-foreground-subtle`,children:[u(`span`,{children:`Camera`}),r(`select`,{value:f===null?``:String(f),onChange:e=>p(e.target.value===``?null:Number(e.target.value)),className:`h-7 rounded-md border border-border bg-background px-1.5 text-xs text-foreground focus:border-primary focus:outline-none`,"aria-label":`Filter by camera`,children:[u(`option`,{value:``,children:`All`}),b.map(e=>u(`option`,{value:String(e.id),children:e.name},e.id))]})]}),r(`div`,{className:`flex items-center gap-1.5 text-[11px] text-foreground-subtle`,children:[u(`span`,{children:`Match`}),u(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5`,children:In.map(e=>u(`button`,{type:`button`,onClick:()=>o(e.value),className:`rounded px-2 py-1 text-[11px] transition-colors ${i===e.value?`bg-primary/12 text-primary font-medium`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground`}`,title:`Minimum CLIP score ${e.value.toFixed(2)}`,children:e.label},e.value))})]}),_&&!D&&!k&&r(`span`,{className:`ml-auto text-[10px] text-foreground-subtle`,children:[j.length,` match`,j.length===1?``:`es`]})]})]}),_&&r(`div`,{className:`space-y-3`,children:[k&&r(`p`,{className:`py-4 text-xs text-danger`,children:[`Search failed: `,A instanceof Error?A.message:`unknown error`,`. Check that the CLIP embedding step is enabled.`]}),!k&&D&&j.length===0&&r(`div`,{className:`flex items-center gap-2 py-4 text-xs text-foreground-subtle`,children:[u(K,{className:`h-4 w-4 animate-spin`}),` Searching…`]}),!k&&!D&&j.length===0&&r(`p`,{className:`py-4 text-xs text-foreground-subtle`,children:[`No semantic matches for “`,g,`”. Try a looser match threshold or a different phrasing.`]}),!k&&j.length>0&&u(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(11rem,1fr))] gap-2`,children:j.map(e=>u(ct,{row:e,cameraName:S(e.deviceId),nowMs:v,score:e.score,onOpenDetail:h},e.id))})]}),m&&u(Ut,{row:m,cameraName:S(m.deviceId),deleteAvailable:jt,onClose:()=>h(null),onDeleted:()=>h(null)})]})}var zn=15e3,Bn={rows:[],unreadableCount:0};function Vn(e){let t=f(),n=e.length>0,r=[...e].sort((e,t)=>e-t),{data:i,isLoading:a}=o({queryKey:[`stationary-objects`,r],enabled:n,staleTime:zn,refetchInterval:zn,queryFn:async()=>{let e=await t.trpcClient.zoneAnalytics.getCurrentSnapshotBatch.query({deviceIds:r}),n=[],i=0;for(let t of e){if(t.read===`unreadable`){i++;continue}for(let e of t.snapshot?.stationaryObjects??[])n.push({...e,deviceId:t.deviceId})}return{rows:n,unreadableCount:i}}}),s=i??Bn;return{rows:s.rows.toSorted((e,t)=>t.becameStationaryAt-e.becameStationaryAt),isLoading:n&&a,unreadableCount:s.unreadableCount}}n();function Hn(e,t){let n=Math.max(0,Math.round((e-t)/6e4));if(n<1)return`just now`;if(n<60)return`${String(n)}m`;let r=Math.floor(n/60);return`${String(r)}h ${String(n%60)}m`}function Un({row:e,cameraName:t,nowMs:n}){let i=e.keyFrameMediaKey?.startsWith(`track:`)?e.keyFrameMediaKey.split(`:`)[1]:e.keyFrameMediaKey,a=Pe(i?`${Ie}/${i}`:void 0);return r(`div`,{className:`flex flex-col overflow-hidden rounded-md border border-border bg-surface`,children:[r(`div`,{className:`relative aspect-video overflow-hidden bg-surface-hover`,children:[a.src?u(`img`,{src:a.src,alt:`Parked ${e.className} on ${t}`,className:`h-full w-full object-cover`}):u(`div`,{className:`flex h-full w-full items-center justify-center text-foreground-subtle`,children:u(We,{className:`h-6 w-6`})}),u(`span`,{className:`absolute left-1 top-1 rounded bg-black/60 px-1.5 py-0.5 text-[10px] font-medium capitalize text-white`,children:e.label??e.className})]}),r(`div`,{className:`flex flex-col gap-0.5 p-1.5`,children:[u(`span`,{className:`truncate text-[11px] text-foreground`,children:t}),r(`span`,{className:`text-[10px] text-foreground-subtle`,children:[`parked `,Hn(n,e.becameStationaryAt)]})]})]})}function Wn(){let[e,t]=l(!1),n=Date.now(),{data:i=[]}=O({isCamera:!0,projection:`slim`}),o=a(()=>i.map(e=>e.id),[i]),s=a(()=>{let e=new Map;for(let t of i)e.set(t.id,t.name);return e},[i]),{rows:c,unreadableCount:d}=Vn(o);return c.length===0&&d===0?null:r(`div`,{className:`rounded-md border border-border bg-surface/40`,children:[r(`button`,{type:`button`,onClick:()=>t(e=>!e),className:`flex w-full items-center gap-2 px-3 py-2 text-left`,children:[u(e?Me:we,{className:`h-4 w-4 text-foreground-subtle`}),u(We,{className:`h-4 w-4 text-foreground-subtle`}),u(`span`,{className:`text-sm font-semibold text-foreground`,children:`Stationary`}),u(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[10px] font-medium text-foreground-subtle`,children:c.length}),u(`span`,{className:`ml-2 text-[11px] text-foreground-subtle`,children:`Parked objects — kept out of the event feed`}),d>0?r(`span`,{className:`ml-2 text-[11px] text-warning`,children:[d,` camera`,d===1?``:`s`,` could not be read`]}):null]}),e&&u(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(9rem,1fr))] gap-2 p-3 pt-0`,children:c.map(e=>u(Un,{row:e,cameraName:s.get(e.deviceId)??`Camera #${String(e.deviceId)}`,nowMs:n},e.id))})]})}n();function Gn(){let[e,t]=l(!1);return u(Ne,{children:r(`section`,{className:`space-y-3`,children:[u(Rn,{onActiveChange:t}),!e&&u(Wn,{}),!e&&u(Nn,{})]})})}var Kn=[`person`,`vehicle`,`animal`,`package`,`face`,`plate`],qn=new Set(Kn);function Jn(e){let t=e?.trim().toLowerCase();return t===void 0||t===``?null:qn.has(t)?`"${t}" is a macro class, not a label — person / postman / Marco are three different tiers`:null}function Yn({annotations:e,selectedIndex:t,onSelect:n,onChange:i,onDelete:a}){return e.length===0?r(`p`,{className:`text-[11px] text-foreground-subtle p-3`,children:[`No subject on this frame yet. Drag on the image to draw one, or ask the pipeline for a proposal. Annotate `,u(`strong`,{children:`every`}),` subject — a frame with one box and three unlabelled people teaches the model that two thirds of the people in it are background.`]}):u(`ul`,{className:`divide-y divide-border`,children:e.map((e,o)=>{let s=o===t,c=Jn(e.label),l=Jn(e.subLabel);return r(`li`,{className:`p-2.5 space-y-1.5 ${s?`bg-surface-hover`:``}`,onFocus:()=>{n(o)},children:[r(`div`,{className:`flex items-center gap-2`,children:[u(C,{className:`w-28`,value:e.macroClass,options:Kn.map(e=>({value:e,label:e})),onChange:e=>{let t=Kn.find(t=>t===e.target.value);t!==void 0&&i(o,{macroClass:t})}}),u(C,{className:`w-32`,value:e.kind,options:[{value:`subject`,label:`subject`},{value:`model_error`,label:`model error`}],onChange:e=>{i(o,{kind:e.target.value===`model_error`?`model_error`:`subject`})}}),e.source===`assist`&&r(x,{variant:`info`,children:[e.assistModelId??`assist`,e.assistScore===void 0?``:` ${e.assistScore.toFixed(2)}`]}),u(w,{variant:`ghost`,size:`sm`,"aria-label":`Delete this subject`,onClick:()=>{a(o)},children:u(De,{className:`h-3 w-3`})})]}),r(`div`,{className:`flex items-center gap-2`,children:[u(v,{className:`flex-1`,placeholder:`label (postman, van, cat…)`,value:e.label??``,onChange:e=>{i(o,{label:e.target.value})}}),u(v,{className:`flex-1`,placeholder:`sub-label (a name, a plate…)`,value:e.subLabel??``,onChange:e=>{i(o,{subLabel:e.target.value})}})]}),c!==null&&u(`p`,{className:`text-[11px] text-danger`,children:c}),l!==null&&u(`p`,{className:`text-[11px] text-danger`,children:l})]},`${String(o)}-${String(e.bbox.x)}`)})})}function Xn(e){return e.every(e=>Jn(e.label)===null&&Jn(e.subLabel)===null&&qn.has(e.macroClass))}function Zn(e){return e<0?0:e>1?1:e}function Qn(e,t,n,r){if(!(e>0)||!(t>0)||!(n>0)||!(r>0))return null;let i=Math.min(e/n,t/r),a=n*i,o=r*i;return{left:(e-a)/2,top:(t-o)/2,width:a,height:o}}function $n(e,t,n){return{x:Zn((e-n.left)/n.width),y:Zn((t-n.top)/n.height)}}function er(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),w:Math.abs(t.x-e.x),h:Math.abs(t.y-e.y)}}function tr(e){return e.w>=.01&&e.h>=.01}function nr(e,t){return{left:t.left+e.x*t.width,top:t.top+e.y*t.height,width:e.w*t.width,height:e.h*t.height}}function rr(e,t){let n=-1,r=1/0;return e.forEach((e,i)=>{if(!(t.x>=e.x&&t.x<=e.x+e.w&&t.y>=e.y&&t.y<=e.y+e.h))return;let a=e.w*e.h;a<r&&(n=i,r=a)}),n}n();function ir({imageSrc:n,imageWidth:a,imageHeight:o,boxes:s,selectedIndex:c,onSelect:d,onDraw:f}){let p=t(null),[m,h]=l({w:0,h:0}),[g,_]=l(null);i(()=>{let e=p.current;if(e===null)return;let t=new ResizeObserver(()=>{h({w:e.clientWidth,h:e.clientHeight})});return t.observe(e),h({w:e.clientWidth,h:e.clientHeight}),()=>{t.disconnect()}},[]);let v=Qn(m.w,m.h,a,o),y=e(e=>{let t=p.current;if(t===null||v===null)return null;let n=t.getBoundingClientRect();return $n(e.clientX-n.left,e.clientY-n.top,v)},[v]);return r(`div`,{ref:p,className:`relative w-full h-full min-h-[280px] bg-surface-sunken select-none touch-none`,onPointerDown:e=>{let t=y(e);t!==null&&(e.currentTarget.setPointerCapture(e.pointerId),_({start:t,current:er(t,t)}))},onPointerMove:e=>{if(g===null)return;let t=y(e);t!==null&&_({start:g.start,current:er(g.start,t)})},onPointerUp:()=>{if(g===null)return;let e=g.current;_(null),tr(e)?f(e):d(rr(s.map(e=>e.bbox),g.start))},children:[u(`img`,{src:n,alt:`Frame being annotated`,className:`absolute inset-0 w-full h-full object-contain pointer-events-none`}),v!==null&&s.map((e,t)=>{let n=nr(e.bbox,v),i=e.kind===`model_error`,a=t===c,o=i?`#ef4444`:a?`#22c55e`:`#3b82f6`;return u(`div`,{className:`absolute pointer-events-none`,style:{left:n.left,top:n.top,width:n.width,height:n.height,border:`${a?`2px`:`1px`} ${i?`dashed`:`solid`} ${o}`,opacity:e.source===`assist`&&!a?.65:1},children:r(`span`,{className:`absolute -top-4 left-0 text-[10px] px-1 rounded`,style:{background:o,color:`#08121f`},children:[e.label??e.macroClass,i?` ✕`:``]})},`${String(t)}-${String(e.bbox.x)}-${String(e.bbox.y)}`)}),g!==null&&v!==null&&u(`div`,{className:`absolute border border-dashed border-primary pointer-events-none`,style:nr(g.current,v)})]})}function ar(e){return e>=1e6?`${(e/1e6).toFixed(1)} MB`:`${Math.round(e/1e3)} KB`}function or({candidates:e,copies:t,activeFrameId:n,refusals:i,isSelecting:a,onSelectCandidate:o,onOpenCopy:s,onRemoveCopy:c}){let l=new Set(t.map(e=>e.sourceMediaKey)),d=e.filter(e=>!l.has(e.mediaKey));return r(`div`,{className:`space-y-3`,children:[r(`section`,{children:[r(`h3`,{className:`text-xs font-semibold text-foreground mb-1.5`,children:[`In the dataset (`,t.length,`)`]}),t.length===0?u(`p`,{className:`text-[11px] text-foreground-subtle`,children:`No frame copied yet. Selecting a frame copies it into retrain storage immediately — the dataset stops depending on the track's own media from that moment.`}):u(`ul`,{className:`flex flex-wrap gap-2`,children:t.map(e=>u(`li`,{children:r(`div`,{className:`rounded-md border px-2 py-1.5 text-[11px] ${e.frameId===n?`border-primary bg-surface-hover`:`border-border`}`,children:[r(`button`,{type:`button`,className:`flex items-center gap-1.5 text-left`,onClick:()=>{s(e.frameId)},children:[u(Se,{className:`h-3 w-3 text-success`}),u(`span`,{className:`font-medium text-foreground`,children:e.sourceKind}),r(`span`,{className:`text-foreground-subtle`,children:[e.width,`×`,e.height,` · `,ar(e.sizeBytes)]})]}),r(`button`,{type:`button`,"aria-label":`Remove this frame from the dataset`,className:`mt-1 flex items-center gap-1 text-foreground-muted hover:text-danger`,onClick:()=>{c(e.frameId)},children:[u(De,{className:`h-3 w-3`}),`remove`]})]})},e.frameId))})]}),r(`section`,{children:[r(`h3`,{className:`text-xs font-semibold text-foreground mb-1.5`,children:[`Available frames (`,d.length,`)`]}),d.length===0?u(`p`,{className:`text-[11px] text-foreground-subtle`,children:e.length===0?`This track has no whole, unannotated frame left — its media aged out before it was marked. Anything already copied above is still usable.`:`Every available frame is already in the dataset.`}):u(`ul`,{className:`flex flex-wrap gap-2`,children:d.map(e=>{let t=i.get(e.mediaKey);return r(`li`,{children:[r(w,{variant:`secondary`,size:`sm`,disabled:a||t!==void 0,onClick:()=>{o(e.mediaKey)},children:[a?u(K,{className:`h-3 w-3 animate-spin`}):u(t===void 0?He:de,{className:`h-3 w-3`}),u(`span`,{className:`ml-1`,children:e.kind}),u(`span`,{className:`ml-1 text-foreground-subtle`,children:ar(e.sizeBytes)})]}),t!==void 0&&u(x,{variant:`danger`,className:`ml-1`,children:t})]},e.mediaKey)})})]})]})}function sr(e){return e.frameCount===0?`untouched`:e.annotationCount===0?`started`:`ready`}var cr={untouched:{icon:Ve,label:`to do`,variant:`default`},started:{icon:Be,label:`frames only`,variant:`info`},ready:{icon:Ce,label:`annotated`,variant:`success`}};function lr(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function ur({tracks:e,isLoading:t,selectedTrackId:n,deviceNames:i,onSelect:a}){return t?r(`div`,{className:`flex items-center gap-2 p-4 text-xs text-foreground-subtle`,children:[u(K,{className:`h-3.5 w-3.5 animate-spin`}),`Loading staging tracks…`]}):e.length===0?u(`div`,{className:`p-4 text-xs text-foreground-subtle`,children:`Nothing in staging. Mark a track for training from the viewer or the Events grid and it appears here.`}):u(`ul`,{className:`divide-y divide-border`,children:e.map(e=>{let t=cr[sr(e)],o=t.icon;return u(`li`,{children:r(`button`,{type:`button`,onClick:()=>{a(e)},className:`w-full text-left px-3 py-2 flex items-start gap-2 hover:bg-surface-hover ${e.trackId===n?`bg-surface-hover`:``}`,children:[u(o,{className:`h-3.5 w-3.5 mt-0.5 shrink-0 text-foreground-subtle`}),r(`span`,{className:`min-w-0 flex-1`,children:[r(`span`,{className:`flex items-center gap-2`,children:[u(`span`,{className:`text-xs font-medium text-foreground truncate`,children:e.label??e.className}),u(x,{variant:t.variant,children:t.label})]}),r(`span`,{className:`block text-[11px] text-foreground-subtle truncate`,children:[i.get(e.deviceId)??`Camera ${String(e.deviceId)}`,` ·`,` `,lr(e.lastSeen)]}),r(`span`,{className:`block text-[11px] text-foreground-muted`,children:[e.frameCount,` frame`,e.frameCount===1?``:`s`,` ·`,` `,e.annotationCount,` subject`,e.annotationCount===1?``:`s`]})]})]})},e.trackId)})})}n();var dr=`person`;function fr(){let[t,n]=l(null),[i,o]=l(null),[c,f]=l([]),[m,_]=l(-1),[v,y]=l(new Map),[b,C]=l(null),D=O({projection:`slim`,isCamera:!0}),k=a(()=>{let e=new Map;for(let t of D.data??[])e.set(t.id,t.name);return e},[D.data]),A=h({}),j=T({trackId:t?.trackId??``},{enabled:t!==null}),N=H({trackId:t?.trackId??``},{enabled:t!==null}),P=ee({frameId:i??``},{enabled:i!==null}),F=p(),I=R(),L=E(),z=S(),B=M(),V=g();d(()=>{if(i===null){f([]);return}f((N.data??[]).filter(e=>e.mediaKey===i).map(e=>({bbox:e.bbox,macroClass:e.macroClass,...e.label===void 0?{}:{label:e.label},...e.subLabel===void 0?{}:{subLabel:e.subLabel},kind:e.kind,source:e.source,...e.assistModelId===void 0?{}:{assistModelId:e.assistModelId},...e.assistScore===void 0?{}:{assistScore:e.assistScore}}))),_(-1)},[i,N.data]),d(()=>{let e=j.data?.copies??[];i===null&&e.length>0&&o(e[0].frameId)},[j.data,i]);let te=e(e=>{n(e),o(null),f([]),y(new Map),C(null)},[]),U=e(async e=>{if(t===null)return;let n=await F.mutateAsync({deviceId:t.deviceId,trackId:t.trackId,mediaKeys:[e]});if(n.refused.length>0){let e=new Map(v);for(let t of n.refused)e.set(t.sourceMediaKey,t.reason);y(e)}n.copied.length>0&&o(n.copied[0].frameId),await j.refetch(),await A.refetch()},[t,F,v,j,A]),ne=e(async e=>{t!==null&&(await I.mutateAsync({deviceId:t.deviceId,trackId:t.trackId,frameId:e}),i===e&&o(null),await j.refetch(),await N.refetch(),await A.refetch())},[t,I,i,j,N,A]),re=e(async e=>{if(t===null||i===null)return;C(null);let n=await L.mutateAsync({deviceId:t.deviceId,trackId:t.trackId,frameId:i,subject:e===`package`?{kind:`package`}:{kind:`objects`,modelId:`yolo26n`,minScore:.3}});if(n.kind===`refused`){C(n.reason===`no-zone`?`A package proposal runs on the zone crop only — this camera has no zone, and running the detector on the whole frame at 0.35 proposes furniture.`:`The pipeline refused: ${n.reason}${n.detail===void 0?``:` — ${n.detail}`}`);return}f(e=>[...e,...n.proposals.map(e=>({bbox:e.bbox,macroClass:e.macroClass,...e.label===void 0?{}:{label:e.label},kind:e.kind,source:e.source,...e.assistModelId===void 0?{}:{assistModelId:e.assistModelId},...e.assistScore===void 0?{}:{assistScore:e.assistScore}}))]),C(`${n.proposals.length} proposal${n.proposals.length===1?``:`s`} from ${n.modelId}`+(n.belowThreshold>0?` — ${n.belowThreshold} more were below ${n.minScore.toFixed(2)}`:``))},[t,i,L]),W=e(e=>{f(t=>[...t,{bbox:e,macroClass:dr,kind:`subject`,source:`operator`}]),_(c.length)},[c.length]),ie=e((e,t)=>{f(n=>n.map((n,r)=>r===e?{...n,...t}:n))},[]),ae=e(e=>{f(t=>t.filter((t,n)=>n!==e)),_(-1)},[]),oe=e(async()=>{t===null||i===null||(await z.mutateAsync({deviceId:t.deviceId,trackId:t.trackId,frameId:i,annotations:c.map(e=>({bbox:e.bbox,macroClass:e.macroClass,...e.label!==void 0&&e.label!==``?{label:e.label}:{},...e.subLabel!==void 0&&e.subLabel!==``?{subLabel:e.subLabel}:{},kind:e.kind,source:e.source,...e.assistModelId===void 0?{}:{assistModelId:e.assistModelId},...e.assistScore===void 0?{}:{assistScore:e.assistScore}}))}),await N.refetch(),await A.refetch(),C(`Annotations saved.`))},[t,i,c,z,N,A]),se=e(async()=>{if(t===null)return;let e=await B.mutateAsync({deviceId:t.deviceId,trackId:t.trackId});C(e.changed?`Track completed — it is now trained, and its own media is evictable again.`:e.reason===`no-frames-copied`?`Refused: no frame was ever copied into the dataset. Completing would let retention delete material nothing was extracted from.`:`Refused: ${e.reason??`unknown`}`),await A.refetch(),e.changed&&n(null)},[t,B,A]),ce=e(async()=>{if(t===null)return;let e=await V.mutateAsync({deviceId:t.deviceId,trackId:t.trackId});C(e.changed?`Track returned to staging. Its copies and annotations were left alone.`:`Refused: ${e.reason??`unknown`}`),await A.refetch()},[t,V,A]),le=P.data,ue=Xn(c)&&i!==null;return r(Ne,{subtitle:`Turn the tracks you marked for training into an annotated dataset. Selecting a frame copies it — the dataset never depends on media that can be swept.`,actions:t===null?null:r(`div`,{className:`flex items-center gap-2`,children:[r(w,{variant:`secondary`,size:`sm`,onClick:()=>void ce(),children:[u(xe,{className:`h-3 w-3`}),u(`span`,{className:`ml-1`,children:`Back to staging`})]}),r(w,{size:`sm`,onClick:()=>void se(),children:[u(Ue,{className:`h-3 w-3`}),u(`span`,{className:`ml-1`,children:`Complete track`})]})]}),children:[b!==null&&u(`div`,{className:`rounded-md border border-border bg-surface px-3 py-2 text-xs text-foreground`,children:b}),r(`div`,{className:`grid grid-cols-1 lg:grid-cols-[minmax(0,260px)_minmax(0,1fr)] gap-4`,children:[r(`aside`,{className:`rounded-md border border-border bg-surface overflow-hidden`,children:[r(`div`,{className:`px-3 py-2 border-b border-border flex items-center justify-between`,children:[u(`h2`,{className:`text-xs font-semibold text-foreground`,children:`Staging`}),u(x,{children:A.data?.length??0})]}),u(ur,{tracks:A.data??[],isLoading:A.isLoading,selectedTrackId:t?.trackId??null,deviceNames:k,onSelect:te})]}),u(`section`,{className:`space-y-3 min-w-0`,children:t===null?u(`p`,{className:`text-xs text-foreground-subtle`,children:`Pick a track from the staging list to start annotating it.`}):r(s,{children:[u(`div`,{className:`rounded-md border border-border bg-surface p-3`,children:u(or,{candidates:j.data?.candidates??[],copies:j.data?.copies??[],activeFrameId:i,refusals:v,isSelecting:F.isPending,onSelectCandidate:e=>void U(e),onOpenCopy:o,onRemoveCopy:e=>void ne(e)})}),i!==null&&r(`div`,{className:`grid grid-cols-1 xl:grid-cols-[minmax(0,1fr)_minmax(0,380px)] gap-3`,children:[u(`div`,{className:`rounded-md border border-border overflow-hidden`,children:le===void 0?r(`div`,{className:`flex items-center gap-2 p-6 text-xs text-foreground-subtle`,children:[u(K,{className:`h-3.5 w-3.5 animate-spin`}),`Loading the frame…`]}):u(ir,{imageSrc:`data:image/jpeg;base64,${le.base64}`,imageWidth:le.width,imageHeight:le.height,boxes:c,selectedIndex:m,onSelect:_,onDraw:W})}),r(`div`,{className:`rounded-md border border-border bg-surface flex flex-col min-h-0`,children:[r(`div`,{className:`px-3 py-2 border-b border-border flex items-center gap-2`,children:[u(`h2`,{className:`text-xs font-semibold text-foreground flex-1`,children:`Subjects`}),r(w,{variant:`secondary`,size:`sm`,disabled:L.isPending,onClick:()=>void re(`objects`),children:[u(Te,{className:`h-3 w-3`}),u(`span`,{className:`ml-1`,children:`Propose`})]}),r(w,{variant:`secondary`,size:`sm`,disabled:L.isPending,onClick:()=>void re(`package`),children:[u(Te,{className:`h-3 w-3`}),u(`span`,{className:`ml-1`,children:`Packages`})]})]}),u(`div`,{className:`flex-1 overflow-y-auto`,children:u(Yn,{annotations:c,selectedIndex:m,onSelect:_,onChange:ie,onDelete:ae})}),r(`div`,{className:`px-3 py-2 border-t border-border flex items-center justify-between`,children:[r(`span`,{className:`text-[11px] text-foreground-subtle`,children:[c.filter(e=>e.kind===`model_error`).length,` marked as model errors`]}),u(w,{size:`sm`,disabled:!ue||z.isPending,onClick:()=>void oe(),children:`Save frame`})]})]})]})]})})]})]})}function pr(){return u(`div`,{className:`flex flex-col p-4`,children:u(Le,{tabs:[{id:`feed`,label:`Feed`,icon:ke,content:u(Gn,{})},{id:`retrain`,label:`Retrain`,icon:Ue,content:u(fr,{})},{id:`debug`,label:`Debug`,icon:ze,content:u(hn,{})}]})})}export{pr as EventsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{J as e}from"./index-CNUAoFCi.js";var t=e(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{J as e}from"./index-CNUAoFCi.js";var t=e(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{J as e}from"./index-CNUAoFCi.js";var t=e(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]);export{t};
|