@camstack/addon-admin-ui 1.1.51 → 1.1.53

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.
Files changed (103) hide show
  1. package/dist/assets/{AddLocationWizard-C5_TbCTT.js → AddLocationWizard-B2-uyYmP.js} +1 -1
  2. package/dist/assets/{AddonCollectionPage-DdcqJdFw.js → AddonCollectionPage-FU3E6QGz.js} +1 -1
  3. package/dist/assets/Addons-DU5z1ZvU.js +1 -0
  4. package/dist/assets/{AdminTabs-rrSAZD3O.js → AdminTabs-CICieyaN.js} +1 -1
  5. package/dist/assets/AiProfiles-BRTUYeoH.js +1 -0
  6. package/dist/assets/{BrokerForm-DL1TXr2B.js → BrokerForm-CuIg_iOf.js} +1 -1
  7. package/dist/assets/{Capabilities-G9KINvPO.js → Capabilities-CEZc9Dcc.js} +1 -1
  8. package/dist/assets/{CapabilityBadges-Q2qm_QNP.js → CapabilityBadges-DDSnGBgk.js} +1 -1
  9. package/dist/assets/Cluster-DjZVaBCZ.js +1 -0
  10. package/dist/assets/{Dashboard-B9Qq3GKN.js → Dashboard-CLWVhKF4.js} +1 -1
  11. package/dist/assets/{Data-F4Z7wulI.js → Data-aqRyEVJp.js} +1 -1
  12. package/dist/assets/DetectionIntelligence-Bvw_e-lH.js +1 -0
  13. package/dist/assets/DeviceDetail-Bt08IJis.js +2 -0
  14. package/dist/assets/{Devices-BbPVwY-D.js → Devices-CZ_Moh5w.js} +1 -1
  15. package/dist/assets/{EmbedPlayerPage-DDKRlZMR.js → EmbedPlayerPage-DAeQe0Bf.js} +1 -1
  16. package/dist/assets/Events-OajEJc_n.js +1 -0
  17. package/dist/assets/{FormBuilder-vCzPEjPM.js → FormBuilder-B69YBaq9.js} +1 -1
  18. package/dist/assets/Identity-DWgcf-tI.js +1 -0
  19. package/dist/assets/IntegrationDetail-BOTeJU5I.js +1 -0
  20. package/dist/assets/{Integrations-AlnqolAL.js → Integrations-CMT2Jroo.js} +1 -1
  21. package/dist/assets/Integrations-nY6HlQUf.js +1 -0
  22. package/dist/assets/{Logs-CBDPfk6Z.js → Logs-BTWVO572.js} +1 -1
  23. package/dist/assets/{MotionZonesSettings-CFYI6s-_.js → MotionZonesSettings-BWhNWsPJ.js} +1 -1
  24. package/dist/assets/{MyAccess-6qmJkzue.js → MyAccess-CJLeYWfN.js} +1 -1
  25. package/dist/assets/Network-DTQVXNuu.js +1 -0
  26. package/dist/assets/{NodeAddonsSettingsPanel-CynxbOEk.js → NodeAddonsSettingsPanel-BQWXa7vq.js} +1 -1
  27. package/dist/assets/NotificationTargets-DqrqQvJN.js +1 -0
  28. package/dist/assets/Pipeline-BZPrco_d.js +1 -0
  29. package/dist/assets/Plates-Cy7kPDK4.js +1 -0
  30. package/dist/assets/{PrivacyMaskSettings-CbVO58Pz.js → PrivacyMaskSettings-DTEI02Vz.js} +1 -1
  31. package/dist/assets/ProviderIcon-Ba4DQXPs.js +1 -0
  32. package/dist/assets/ScanNetworkModal-CbDd4Bl9.js +1 -0
  33. package/dist/assets/{Settings-DdHS4and.js → Settings-BxK0kuED.js} +1 -1
  34. package/dist/assets/{Showroom-BPudQyp1.js → Showroom-BLBcs7XJ.js} +1 -1
  35. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DzuuqQDr.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-jFLPXlhw.js} +1 -1
  36. package/dist/assets/{build-cluster-graph-C8acdV1N.js → build-cluster-graph-CIiqGgZL.js} +2 -2
  37. package/dist/assets/circle-check-big-B-tT2CHM.js +1 -0
  38. package/dist/assets/clock-cwKSxYZs.js +1 -0
  39. package/dist/assets/{copy-jHaoig1Z.js → copy-CTAQpm07.js} +1 -1
  40. package/dist/assets/debounced-invalidate-DZ3oxQDl.js +1 -0
  41. package/dist/assets/{dist-D9oUwgkq.js → dist-BMrXztkM.js} +1 -1
  42. package/dist/assets/dist-tu4iBgMD.js +7 -0
  43. package/dist/assets/{download-B8Uv2BOb.js → download-DjYX33pK.js} +1 -1
  44. package/dist/assets/face-bbox-vlSxiLet.js +1 -0
  45. package/dist/assets/{film-CzfyiWOL.js → film-lIXZ0TIf.js} +1 -1
  46. package/dist/assets/{hostInit-DY1mt8Vv.js → hostInit-BhKkSxQn.js} +1 -1
  47. package/dist/assets/index-Cdp6OaKK.js +4 -0
  48. package/dist/assets/index-Cmln2hC6.css +2 -0
  49. package/dist/assets/{key-round-B1u42XSy.js → key-round-D6koQlXg.js} +1 -1
  50. package/dist/assets/{mf-entry-bootstrap-0-3bf5f308.js → mf-entry-bootstrap-0-1af432ca.js} +2 -2
  51. package/dist/assets/{pencil-BEjUgvtJ.js → pencil-CUVzuL3L.js} +1 -1
  52. package/dist/assets/{player-overlays-DzoWZHnz.js → player-overlays-BrjDKJA9.js} +1 -1
  53. package/dist/assets/plus-CTLCXGgQ.js +1 -0
  54. package/dist/assets/{radio-CvK77vEM.js → radio-_KFBV9h-.js} +1 -1
  55. package/dist/assets/{refresh-cw-BoM3__QD.js → refresh-cw-BM18Lfvw.js} +1 -1
  56. package/dist/assets/remoteEntry-xwnWPwER.js +1 -0
  57. package/dist/assets/{rotate-ccw-CG8Dl-0A.js → rotate-ccw-EdLXWeWN.js} +1 -1
  58. package/dist/assets/rotate-cw-CE0Ns6Fz.js +1 -0
  59. package/dist/assets/search-mDjJzMoX.js +1 -0
  60. package/dist/assets/{send-DdbXLRkn.js → send-C5a5_8YJ.js} +1 -1
  61. package/dist/assets/server-CTi1sPfP.js +1 -0
  62. package/dist/assets/square-CfQwX-85.js +1 -0
  63. package/dist/assets/{square-check-big-BIo_99Ss.js → square-check-big-DqE0lyuf.js} +1 -1
  64. package/dist/assets/src-BIAY4cjr.js +7 -0
  65. package/dist/assets/src-Bx1PCCWV.js +67 -0
  66. package/dist/assets/{upload-DUlWrtL9.js → upload-CBvWlRd4.js} +1 -1
  67. package/dist/assets/useDevice-CRWDjGkB.js +1 -0
  68. package/dist/assets/{useEventInvalidation-Bwynn5Fd.js → useEventInvalidation-BgQYjLEl.js} +1 -1
  69. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-CmeeGMkM.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BzCJlGIx.js} +2 -2
  70. package/dist/assets/{wifi-CW0cSDNa.js → wifi-D9LNVG6Y.js} +1 -1
  71. package/dist/assets/{zap-CPf6Bdf3.js → zap-CjGIHi-s.js} +1 -1
  72. package/dist/index.html +6 -6
  73. package/dist/server/addon.js +4741 -4645
  74. package/package.json +1 -1
  75. package/dist/assets/Addons-DENvhGXs.js +0 -1
  76. package/dist/assets/AiProfiles-I6sx_kzO.js +0 -1
  77. package/dist/assets/Cluster-D5fOIpSM.js +0 -1
  78. package/dist/assets/DetectionIntelligence-DysJUSVa.js +0 -1
  79. package/dist/assets/DeviceDetail-DnOzyoSG.js +0 -2
  80. package/dist/assets/Events-CdArV4tl.js +0 -1
  81. package/dist/assets/Identity-Dmu7k7pC.js +0 -1
  82. package/dist/assets/IntegrationDetail-CXnSPpKp.js +0 -1
  83. package/dist/assets/Integrations-BIx0NuFX.js +0 -1
  84. package/dist/assets/Network-CX6T3X7F.js +0 -1
  85. package/dist/assets/NotificationTargets-DFmIRZfI.js +0 -1
  86. package/dist/assets/Pipeline-HtfEITUn.js +0 -1
  87. package/dist/assets/ProviderIcon-Bc8wWWqT.js +0 -1
  88. package/dist/assets/ScanNetworkModal-Bxjqv5aL.js +0 -1
  89. package/dist/assets/ServerManagement-QTJJqUUL.js +0 -1
  90. package/dist/assets/circle-check-big-Ci2qKS9O.js +0 -1
  91. package/dist/assets/clock-DvPVZaz2.js +0 -1
  92. package/dist/assets/debounced-invalidate-BtUOLpbU.js +0 -1
  93. package/dist/assets/dist-BpbjPYkI.js +0 -7
  94. package/dist/assets/index-CRBZZNxE.css +0 -2
  95. package/dist/assets/index-msAq9OfF.js +0 -4
  96. package/dist/assets/plus-CDCmEkS2.js +0 -1
  97. package/dist/assets/remoteEntry-Bm4uDKFt.js +0 -1
  98. package/dist/assets/rotate-cw-BcZwqoT5.js +0 -1
  99. package/dist/assets/search-Dh7U_-43.js +0 -1
  100. package/dist/assets/square-Mc9QW6dp.js +0 -1
  101. package/dist/assets/src-B_-PRq3y.js +0 -67
  102. package/dist/assets/src-DYmw2iAG.js +0 -7
  103. package/dist/assets/useDevice-CDxSSKpG.js +0 -1
@@ -0,0 +1 @@
1
+ import{$a as e,Ga as t,Ja as n,Qa as r,S as i,Sa as a,Wa as o,Xa as s,Ya as c,eo as l,qa as u}from"./src-Bx1PCCWV.js";import{Q as d,S as f,W as p,a as m,q as h,t as g,x as _}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{p as v}from"./player-overlays-BrjDKJA9.js";import{t as y}from"./circle-check-big-B-tT2CHM.js";import{t as b}from"./pencil-CUVzuL3L.js";import{t as x}from"./plus-CTLCXGgQ.js";import{t as S}from"./search-mDjJzMoX.js";import{t as C}from"./send-C5a5_8YJ.js";import{B as w,M as T,S as E,s as D}from"./index-Cdp6OaKK.js";import{t as O}from"./AdminPage-BwmGKnRf.js";d();var k=e=>typeof e==`string`&&e.length>0;function A(e){return{levels:e.levels,formats:e.format,bodyMaxLen:e.bodyMaxLen,attachmentSlots:e.attachments.mediaTypes,attachmentMode:e.attachments.mode,attachmentMax:e.attachments.max,attachmentMaxBytes:e.attachments.maxBytes,maxActions:e.actions,showActions:e.actions>0,showClickUrl:e.clickUrl,showSound:e.sound,showTtl:e.ttl,showTag:!0}}function j(e,t){return e.format.includes(t)?t:e.format[0]??`text`}function M(e,t){let n=[];for(let r of e.attachments.mediaTypes){if(n.length>=e.attachments.max)break;let i=t[r];k(i)&&n.push({mediaType:r,url:i})}return n}function N(e,t){if(e.actions<=0)return[];let n=[];for(let r of t){if(n.length>=e.actions)break;let t=k(r.label),i=k(r.url);!t&&!i||n.push({id:`test-${n.length+1}`,label:t?r.label:`Action ${n.length+1}`,...i?{url:r.url}:{}})}return n}function P(e,t){let n=e.levels.some(e=>e.id===t.level)?t.level:void 0,r=M(e,t.attachmentUrls),i=N(e,t.actions),a=e.ttl&&k(t.ttl)?Number(t.ttl):void 0;return{body:t.body,format:j(e,t.format),priority:F(t.priority),...k(t.title)?{title:t.title}:{},...n?{level:n}:{},...r.length>0?{attachments:r}:{},...i.length>0?{actions:i}:{},...e.clickUrl&&k(t.clickUrl)?{clickUrl:t.clickUrl}:{},...e.sound&&k(t.sound)?{sound:t.sound}:{},...a!==void 0&&Number.isFinite(a)?{ttl:a}:{},...k(t.tag)?{tag:t.tag}:{}}}function F(e){return Number.isFinite(e)?Math.min(5,Math.max(1,Math.round(e))):3}function I(e){return e.levels.find(e=>e.flags?.critical===!0)||e.levels.filter(e=>typeof e.ordinal==`number`).sort((e,t)=>t.ordinal-e.ordinal)[0]}function L(e){return{level:``,priority:3,format:e.format[0]??`text`,title:``,body:``,attachmentUrls:{},actions:[],clickUrl:``,sound:``,ttl:``,tag:``}}var R={image:`https://example.com/sample.jpg`,video:`https://example.com/sample.mp4`,gif:`https://example.com/sample.gif`,audio:`https://example.com/sample.mp3`,icon:`https://example.com/icon.png`};function z(e,t){let n=L(e);switch(t){case`minimal`:return{...n,body:`Test notification`};case`overflow`:return{...n,body:`X`.repeat(e.bodyMaxLen+50)};case`critical`:{let t=I(e);return{...n,body:`Critical test notification`,priority:5,level:t?.id??``}}case`everything`:{let t={},n=0;for(let r of e.attachments.mediaTypes){if(n>=e.attachments.max)break;t[r]=R[r],n+=1}let r=Array.from({length:e.actions},(e,t)=>({label:`Action ${t+1}`,url:`https://example.com/action/${t+1}`}));return{level:``,priority:4,format:e.format.includes(`markdown`)?`markdown`:e.format.includes(`html`)?`html`:e.format[0]??`text`,title:`Everything the kind supports`,body:`This sample fills every control the kind advertises.`,attachmentUrls:t,actions:r,clickUrl:e.clickUrl?`https://example.com/open`:``,sound:e.sound?`default`:``,ttl:e.ttl?`3600`:``,tag:`camstack-test`}}}}var B=[{id:`minimal`,label:`Minimal (body only)`},{id:`everything`,label:`Everything supported`},{id:`overflow`,label:`Overflow`},{id:`critical`,label:`Critical`}],V=`w-full rounded-md border border-border bg-background px-2.5 py-1.5 text-xs text-foreground focus:border-primary focus:ring-1 focus:ring-primary/30 outline-none`,H=`block text-[11px] font-medium text-foreground mb-1`;function U({target:r,kind:i,open:a,onClose:s}){let d=v(),m=p(()=>A(i.caps),[i.caps]),[y,b]=h(()=>L(i.caps)),[x,S]=h(null),w=p(()=>P(i.caps,y),[i.caps,y]),T=y.body.length,D=T>m.bodyMaxLen,O=e=>b(t=>({...t,...e})),k=g({mutationFn:()=>d.trpcClient.notificationOutput.testTarget.mutate({addonId:r.addonId,targetId:r.id,sample:P(i.caps,y)}),onMutate:()=>S(null),onSuccess:e=>S(e),onError:e=>S({success:!1,error:e instanceof Error?e.message:`Test failed`})}),j=e=>{b(z(i.caps,e)),S(null)},M=(e,t,n)=>{let r=y.actions.length>0?[...y.actions]:[];for(;r.length<=e;)r.push({label:``,url:``});r[e]={...r[e],[t]:n},O({actions:r})};return _(o,{open:a,onOpenChange:e=>!e&&s(),children:f(t,{width:`lg`,className:`!max-w-2xl`,children:[_(n,{children:f(c,{children:[`Test "`,r.name,`" (`,i.label,`)`]})}),f(`div`,{className:`space-y-4 max-h-[60vh] overflow-y-auto pr-1`,children:[_(`div`,{className:`flex flex-wrap gap-1.5`,children:B.map(e=>_(l,{size:`sm`,variant:`outline`,type:`button`,onClick:()=>j(e.id),children:e.label},e.id))}),f(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[m.levels.length>0&&f(`div`,{children:[_(`label`,{className:H,children:`Level`}),f(`select`,{className:V,value:y.level,onChange:e=>O({level:e.target.value}),children:[_(`option`,{value:``,children:`— derive from priority —`}),m.levels.map(e=>f(`option`,{value:e.id,children:[e.label,e.ordinal===null?` (qualitative)`:` (p${e.ordinal})`]},e.id))]}),(()=>{let t=m.levels.find(e=>e.id===y.level);return t?f(`div`,{className:`mt-1 space-y-1`,children:[t.description&&_(`p`,{className:`text-[10px] text-foreground-subtle`,children:t.description}),f(`div`,{className:`flex flex-wrap gap-1`,children:[t.flags?.critical&&_(e,{variant:`danger`,"data-testid":`flag-critical`,children:`critical`}),t.flags?.silent&&_(e,{variant:`info`,children:`silent`}),t.flags?.noPush&&_(e,{variant:`warning`,children:`no-push`})]}),t.requires&&t.requires.length>0&&f(`p`,{className:`text-[10px] text-warning`,children:[`Requires target config: `,t.requires.join(`, `)]})]}):null})()]}),f(`div`,{children:[f(`label`,{className:H,children:[`Priority (ordinal): `,y.priority]}),_(`input`,{type:`range`,min:1,max:5,step:1,value:y.priority,onChange:e=>O({priority:Number(e.target.value)}),className:`w-full accent-primary`,"aria-label":`priority`})]})]}),m.formats.length>0&&f(`div`,{children:[_(`label`,{className:H,children:`Format`}),_(`div`,{className:`flex flex-wrap gap-2`,children:m.formats.map(e=>f(`label`,{className:`flex items-center gap-1.5 text-xs cursor-pointer`,children:[_(`input`,{type:`radio`,name:`format`,className:`accent-primary`,checked:y.format===e,onChange:()=>O({format:e})}),e]},e))})]}),f(`div`,{children:[_(`label`,{className:H,children:`Title`}),_(`input`,{className:V,value:y.title,onChange:e=>O({title:e.target.value})})]}),f(`div`,{children:[f(`label`,{className:H,children:[`Body`,` `,f(`span`,{className:D?`text-danger`:`text-foreground-subtle`,children:[`(`,T,`/`,m.bodyMaxLen,D?` — overflow`:``,`)`]})]}),_(`textarea`,{className:`${V} min-h-[80px] resize-y`,value:y.body,onChange:e=>O({body:e.target.value})})]}),m.attachmentSlots.length>0&&f(`div`,{children:[f(`label`,{className:H,children:[`Attachments`,` `,f(`span`,{className:`text-foreground-subtle`,children:[`(mode: `,m.attachmentMode,`, max `,m.attachmentMax,m.attachmentMaxBytes?`, ≤${Math.round(m.attachmentMaxBytes/1024/1024)}MB`:``,`)`]})]}),_(`div`,{className:`space-y-1.5`,children:m.attachmentSlots.map(e=>f(`div`,{className:`flex items-center gap-2`,children:[_(`span`,{className:`text-[10px] w-12 shrink-0 text-foreground-subtle`,children:e}),_(`input`,{className:V,placeholder:`${e} URL`,value:y.attachmentUrls[e]??``,onChange:t=>O({attachmentUrls:{...y.attachmentUrls,[e]:t.target.value}})})]},e))})]}),m.showActions&&f(`div`,{children:[f(`label`,{className:H,children:[`Actions (up to `,m.maxActions,`)`]}),_(`div`,{className:`space-y-1.5`,children:Array.from({length:Math.min(m.maxActions,3)},(e,t)=>f(`div`,{className:`flex items-center gap-2`,children:[_(`input`,{className:V,placeholder:`label`,value:y.actions[t]?.label??``,onChange:e=>M(t,`label`,e.target.value)}),_(`input`,{className:V,placeholder:`url`,value:y.actions[t]?.url??``,onChange:e=>M(t,`url`,e.target.value)})]},t))})]}),f(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[m.showClickUrl&&f(`div`,{children:[_(`label`,{className:H,children:`Click URL`}),_(`input`,{className:V,value:y.clickUrl,onChange:e=>O({clickUrl:e.target.value})})]}),m.showSound&&f(`div`,{children:[_(`label`,{className:H,children:`Sound`}),_(`input`,{className:V,value:y.sound,onChange:e=>O({sound:e.target.value})})]}),m.showTtl&&f(`div`,{children:[_(`label`,{className:H,children:`TTL (seconds)`}),_(`input`,{className:V,type:`number`,value:y.ttl,onChange:e=>O({ttl:e.target.value})})]}),m.showTag&&f(`div`,{children:[_(`label`,{className:H,children:`Tag`}),_(`input`,{className:V,value:y.tag,onChange:e=>O({tag:e.target.value})})]})]}),x&&_(W,{result:x}),f(`details`,{className:`text-[10px]`,children:[_(`summary`,{className:`cursor-pointer text-foreground-subtle`,children:`Payload preview`}),_(`pre`,{className:`mt-1 overflow-x-auto rounded bg-surface p-2 text-foreground-subtle`,children:JSON.stringify(w,null,2)})]})]}),f(u,{children:[_(l,{variant:`secondary`,size:`sm`,type:`button`,onClick:s,children:`Close`}),f(l,{size:`sm`,type:`button`,disabled:k.isPending||y.body.length===0,onClick:()=>k.mutate(),children:[k.isPending?_(E,{className:`h-3.5 w-3.5 animate-spin`}):_(C,{className:`h-3.5 w-3.5`}),`Send test`]})]})]})})}function W({result:e}){let t=e.renderedAs;return f(`div`,{className:`rounded-md border px-3 py-2 text-xs ${e.success?`border-success/40 bg-success/10`:`border-danger/40 bg-danger/10`}`,"data-testid":`test-result`,children:[f(`div`,{className:`flex items-center gap-2 font-medium`,children:[e.success?_(y,{className:`h-3.5 w-3.5 text-success`}):_(T,{className:`h-3.5 w-3.5 text-danger`}),_(`span`,{children:e.success?`Delivered`:`Failed`})]}),e.error&&_(`p`,{className:`mt-1 text-danger`,children:e.error}),t&&f(`dl`,{className:`mt-2 grid grid-cols-2 gap-x-3 gap-y-0.5 text-[11px] text-foreground-subtle`,children:[_(`dt`,{children:`Resolved level`}),_(`dd`,{className:`text-foreground`,children:t.level}),_(`dt`,{children:`Format sent`}),_(`dd`,{className:`text-foreground`,children:t.format}),_(`dt`,{children:`Attachments sent`}),_(`dd`,{className:`text-foreground`,children:t.attachmentsSent}),_(`dt`,{children:`Actions sent`}),_(`dd`,{className:`text-foreground`,children:t.actionsSent}),_(`dt`,{children:`Truncated`}),_(`dd`,{className:`text-foreground`,children:t.truncated?`yes`:`no`}),_(`dt`,{children:`Dropped`}),_(`dd`,{className:`text-foreground`,children:t.dropped.length>0?t.dropped.join(`, `):`—`})]})]})}function G(e){let t=[],n=new Map;for(let r of e){let e=n.get(r.addonId);e?e.push(r):(n.set(r.addonId,[r]),t.push(r.addonId))}return t.map(e=>({addonId:e,kinds:n.get(e)??[]}))}function K(e){let t=[],n=e=>{for(let r of e){if(r.type===`password`){t.push(r.key);continue}if(r.type===`group`){n(r.fields);continue}if(r.type===`sub-tabs`)for(let e of r.tabs)n(e.fields)}};for(let t of e.sections)n(t.fields);return t}function q(e,t,n){let r=new Set(n),i={};for(let[n,a]of Object.entries(e)){if(!r.has(n)){i[n]=a;continue}a==null||a===``||a!==t[n]&&(i[n]=a)}return i}function J(e,t){let n=new Set(t),r={};for(let[t,i]of Object.entries(e))r[t]=n.has(t)?``:i;return r}d();var Y=[`notificationOutput`,`listTargets`],X=[`notificationOutput`,`listTargetKinds`];function Z({kind:e,imgClassName:t,fallbackClassName:n}){return e?.iconUrl?_(`img`,{src:e.iconUrl,alt:e.label,className:t,loading:`lazy`,draggable:!1}):_(`span`,{className:n,children:e?.icon??`🔔`})}function Q(){let t=v(),[n,i]=h({mode:`closed`}),[o,c]=h(null),u=m({queryKey:Y,queryFn:()=>t.trpcClient.notificationOutput.listTargets.query({})}),d=m({queryKey:X,queryFn:async()=>(await t.trpcClient.notificationOutput.listTargetKinds.query({})).map(e=>{let t=e.iconUrl;return{...e,configSchema:e.configSchema,iconUrl:t}})}),y=p(()=>d.data??[],[d.data]),S=p(()=>{let e=new Map;for(let t of y)e.set(t.kind,t);return e},[y]),T=g({mutationFn:e=>t.trpcClient.notificationOutput.setTargetEnabled.mutate({addonId:e.target.addonId,targetId:e.target.id,enabled:e.enabled}),onSuccess:()=>void u.refetch()}),k=g({mutationFn:e=>t.trpcClient.notificationOutput.deleteTarget.mutate({addonId:e.addonId,targetId:e.id}),onSuccess:()=>void u.refetch()}),A=o?S.get(o.kind):void 0;return f(O,{icon:w,title:`Notification Targets`,subtitle:`Deliver notifications to ntfy, Pushover, Telegram, Home Assistant and more. Each target's kind declares its capabilities; the test panel shows exactly what a message degrades to.`,actions:f(l,{size:`sm`,type:`button`,onClick:()=>i({mode:`pick-kind`}),children:[_(x,{className:`h-3.5 w-3.5`}),`Add target`]}),children:[u.isLoading&&_(`div`,{className:`flex items-center justify-center py-16`,children:_(E,{className:`h-6 w-6 animate-spin text-primary`})}),u.isError&&!u.isLoading&&_(a,{title:`Failed to load targets`,message:u.error instanceof Error?u.error.message:`Unknown error`,onRetry:()=>void u.refetch()}),!u.isLoading&&!u.isError&&(u.data??[]).length===0&&_(`div`,{className:`text-xs text-foreground-subtle text-center py-16`,children:`No notification targets yet. Click "Add target" to configure one.`}),(u.data??[]).length>0&&_(r,{children:_(`ul`,{className:`divide-y divide-border`,children:(u.data??[]).map(t=>{let n=S.get(t.kind);return f(`li`,{className:`flex items-center gap-3 px-4 py-2.5`,children:[_(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-surface text-xs`,title:n?.label??t.kind,children:_(Z,{kind:n,imgClassName:`h-5 w-5 object-contain`,fallbackClassName:``})}),f(`div`,{className:`min-w-0 flex-1`,children:[_(`div`,{className:`truncate text-sm font-medium text-foreground`,children:t.name}),_(`div`,{className:`text-[11px] text-foreground-subtle`,children:n?.label??t.kind})]}),!t.enabled&&_(e,{variant:`warning`,children:`disabled`}),_(s,{checked:t.enabled,onCheckedChange:e=>T.mutate({target:t,enabled:e}),"aria-label":`toggle ${t.name}`}),_(l,{size:`sm`,variant:`ghost`,type:`button`,disabled:!n,onClick:()=>c(t),title:`Test`,children:_(C,{className:`h-3.5 w-3.5`})}),_(l,{size:`sm`,variant:`ghost`,type:`button`,disabled:!n,onClick:()=>n&&i({mode:`form`,kind:n,target:t}),title:`Edit`,children:_(b,{className:`h-3.5 w-3.5`})}),_(l,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>k.mutate(t),title:`Delete`,children:_(D,{className:`h-3.5 w-3.5 text-danger`})})]},t.id)})})}),n.mode===`pick-kind`&&_($,{kinds:y,onCancel:()=>i({mode:`closed`}),onPick:e=>i({mode:`form`,kind:e,target:null})}),n.mode===`form`&&_(ee,{kind:n.kind,target:n.target,onCancel:()=>i({mode:`closed`}),onSaved:()=>{i({mode:`closed`}),u.refetch()}}),o&&A&&_(U,{target:o,kind:A,open:!0,onClose:()=>c(null)})]})}function $({kinds:t,onPick:n,onCancel:i}){let a=p(()=>G(t),[t]);return f(r,{className:`p-4 space-y-4`,children:[f(`div`,{className:`flex items-center justify-between`,children:[_(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Choose a notification kind`}),_(l,{size:`sm`,variant:`ghost`,type:`button`,onClick:i,children:`Cancel`})]}),a.length===0&&_(`p`,{className:`text-xs text-foreground-subtle`,children:`No notification providers are installed. Install the notifiers addon (or connect Home Assistant) to add targets.`}),a.map(t=>f(`div`,{children:[_(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-foreground-subtle mb-1.5`,children:t.addonId}),_(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-2`,children:t.kinds.map(r=>f(`button`,{type:`button`,onClick:()=>n(r),className:`flex flex-col items-center gap-1.5 rounded-lg border border-border bg-surface px-3 py-3 text-xs hover:border-primary/50 hover:bg-surface-hover transition-colors`,children:[_(Z,{kind:r,imgClassName:`h-7 w-7 object-contain`,fallbackClassName:`text-lg leading-7`}),_(`span`,{className:`font-medium text-foreground`,children:r.label}),r.supportsDiscovery&&_(e,{variant:`info`,style:`outline`,children:`discover`})]},`${t.addonId}:${r.kind}`))})]},t.addonId))]})}function ee({kind:e,target:t,onSaved:n,onCancel:a}){let o=v(),s=p(()=>K(e.configSchema),[e.configSchema]),c=p(()=>t?.config??{},[t]),[u,d]=h(t?.name??e.label),[m,y]=h(()=>t?J(t.config,s):{}),[b,x]=h(null),[C,w]=h(null),T=g({mutationFn:()=>o.trpcClient.notificationOutput.discoverTargets.query({addonId:e.addonId,kind:e.kind,config:m}),onSuccess:e=>x(e),onError:e=>w(e instanceof Error?e.message:`Discovery failed`)}),D=g({mutationFn:()=>{let n=q(m,c,s),r={id:t?.id??`${e.kind}-${Date.now()}`,name:u,kind:e.kind,addonId:e.addonId,enabled:t?.enabled??!0,config:n};return o.trpcClient.notificationOutput.upsertTarget.mutate({addonId:e.addonId,target:r})},onSuccess:n,onError:e=>w(e instanceof Error?e.message:`Save failed`)}),O=e=>{d(e.suggestedName),y(t=>({...t,...e.config})),x(null)};return f(r,{className:`p-4 space-y-4`,children:[f(`div`,{className:`flex items-center justify-between`,children:[f(`h3`,{className:`text-sm font-semibold text-foreground flex items-center gap-2`,children:[_(Z,{kind:e,imgClassName:`h-5 w-5 object-contain`,fallbackClassName:`text-lg`}),t?`Edit ${t.name}`:`Add ${e.label} target`]}),_(l,{size:`sm`,variant:`ghost`,type:`button`,onClick:a,children:`Cancel`})]}),C&&_(`div`,{className:`rounded-md border border-danger/40 bg-danger/10 px-3 py-2 text-xs text-danger`,children:C}),f(`div`,{children:[_(`label`,{className:`block text-[11px] font-medium text-foreground mb-1`,children:`Name`}),_(`input`,{className:`w-full rounded-md border border-border bg-background px-2.5 py-1.5 text-xs text-foreground focus:border-primary focus:ring-1 focus:ring-primary/30 outline-none`,value:u,onChange:e=>d(e.target.value)})]}),e.supportsDiscovery&&f(`div`,{className:`space-y-2`,children:[f(l,{size:`sm`,variant:`outline`,type:`button`,disabled:T.isPending,onClick:()=>{w(null),T.mutate()},children:[T.isPending?_(E,{className:`h-3.5 w-3.5 animate-spin`}):_(S,{className:`h-3.5 w-3.5`}),`Discover`]}),b&&b.length===0&&_(`p`,{className:`text-[11px] text-foreground-subtle`,children:`No candidates discovered.`}),b&&b.length>0&&_(`div`,{className:`rounded-md border border-border divide-y divide-border`,children:b.map((e,t)=>f(`button`,{type:`button`,onClick:()=>O(e),className:`flex w-full items-center justify-between px-3 py-1.5 text-xs hover:bg-surface-hover`,children:[_(`span`,{className:`text-foreground`,children:e.suggestedName}),_(`span`,{className:`text-[10px] text-primary`,children:`use`})]},`${e.suggestedName}-${t}`))})]}),s.length>0&&t&&_(`p`,{className:`text-[10px] text-foreground-subtle`,children:`Secret fields are hidden. Leave them blank to keep the stored value; type a new value to replace it.`}),_(i,{schema:e.configSchema,values:m,onChange:y}),f(`div`,{className:`flex justify-end gap-2`,children:[_(l,{variant:`secondary`,size:`sm`,type:`button`,onClick:a,children:`Cancel`}),f(l,{size:`sm`,type:`button`,disabled:D.isPending||u.trim().length===0,onClick:()=>{w(null),D.mutate()},children:[D.isPending&&_(E,{className:`h-3.5 w-3.5 animate-spin`}),t?`Save changes`:`Create target`]})]})]})}export{Q as NotificationTargetsPage,Q as default};
@@ -0,0 +1 @@
1
+ import{$a as e,$r as t,Aa as n,Ci as r,Da as i,Di as a,Ea as o,Gr as s,Ji as c,Jr as l,Kr as u,Na as d,Oa as f,Pa as p,Rr as m,T as h,Ta as g,Ti as _,Xr as v,Yi as y,Yr as b,Zi as x,Zr as S,_ as C,_i as w,ao as T,ct as E,di as D,ei as O,fi as k,g as A,gi as j,hi as M,ii as ee,ja as te,li as N,mi as P,ni as ne,oi as F,pi as re,qi as ie,qr as ae,ri as oe,so as se,st as ce,ti as le,ui as ue,ut as de,vi as fe,wi as pe,xa as me}from"./src-Bx1PCCWV.js";import{I as he,K as ge,Q as I,S as L,T as _e,W as R,a as ve,b as z,o as B,q as V,x as H,z as U}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{H as ye,L as be,R as xe}from"./src-BIAY4cjr.js";import{p as Se}from"./player-overlays-BrjDKJA9.js";import{t as Ce}from"./download-DjYX33pK.js";import{t as we}from"./film-lIXZ0TIf.js";import{i as Te,n as Ee,r as De,t as Oe}from"./AddLocationWizard-B2-uyYmP.js";import{n as ke,r as Ae,t as je}from"./zap-CjGIHi-s.js";import{i as Me,r as Ne}from"./useDevice-CRWDjGkB.js";import{t as Pe}from"./pencil-CUVzuL3L.js";import{t as Fe}from"./plus-CTLCXGgQ.js";import{t as Ie}from"./radio-_KFBV9h-.js";import{t as Le}from"./refresh-cw-BM18Lfvw.js";import{t as Re}from"./search-mDjJzMoX.js";import{t as ze}from"./server-CTi1sPfP.js";import{t as Be}from"./square-check-big-DqE0lyuf.js";import{t as Ve}from"./square-CfQwX-85.js";import{A as W,F as He,I as Ue,M as We,N as Ge,S as G,T as Ke,U as qe,i as Je,j as Ye,o as Xe,q as Ze,s as Qe,x as $e}from"./index-Cdp6OaKK.js";import{t as et}from"./AdminPage-BwmGKnRf.js";import{t as K}from"./useEventInvalidation-BgQYjLEl.js";import{r as tt,t as nt}from"./build-cluster-graph-CIiqGgZL.js";import{n as rt}from"./format-size-CO9d3C3-.js";import{t as it}from"./NodeAddonsSettingsPanel-BQWXa7vq.js";var at=qe(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),ot=qe(`flame`,[[`path`,{d:`M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z`,key:`96xj49`}]]),st=qe(`lock-open`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 9.9-1`,key:`1mm8w8`}]]),ct=qe(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]);I();function lt(e){return e}function ut(e,t){for(let[n,r]of Object.entries(e??{}))if(n===t)return r}function dt(e,t){return typeof e==`boolean`?e:lt(t)}function ft(e,t){return{pipeline:dt(ut(e,`detect`),t),audio:dt(ut(e,`audio`),t),ingest:dt(ut(e,`ingest`),t)}}function pt(e,t,n){let r=e?.find(e=>e.nodeId===t);return ft(r?.settings,n)}function mt({selectedNodeId:t,onSelect:n,refreshToken:r}){let{data:i}=m(void 0),{data:a}=N(void 0),{data:o}=ue(void 0),s=new Map;for(let e of a??[])s.set(e.agentNodeId,(s.get(e.agentNodeId)??0)+1);let c=i??[],l=c.filter(e=>e.isOnline).length,u=c.filter(e=>!e.isOnline).length;return L(`div`,{className:`flex flex-col h-full`,children:[L(`button`,{type:`button`,onClick:()=>n(Ar),className:`flex items-center gap-3 px-4 py-3 border-b border-border text-left transition-colors ${t===`__cluster__`?`bg-primary/10 text-primary`:`text-foreground hover:bg-surface-hover`}`,children:[H(Ke,{className:`h-4 w-4 flex-shrink-0`}),L(`div`,{className:`min-w-0 flex-1`,children:[H(`div`,{className:`text-xs font-semibold truncate`,children:`Cluster`}),H(`div`,{className:`text-[10px] text-foreground-subtle`,children:`Balancer + failover + assignments`})]})]}),H(`div`,{className:`flex-1 overflow-y-auto`,children:c.map(r=>{let i=t===r.id,a=s.get(r.id)??0,c=r.isHub?ze:W,l=pt(o,r.id,r.isHub),u=r.isOnline?null:se(tt(r.lastSeen));return L(`button`,{type:`button`,onClick:()=>n(r.id),className:`flex items-center gap-3 w-full px-4 py-3 border-b border-border text-left transition-colors ${i?`bg-primary/10 text-primary`:`text-foreground hover:bg-surface-hover`}${r.isOnline?``:` opacity-60`}`,children:[H(c,{className:`h-4 w-4 flex-shrink-0`}),L(`div`,{className:`min-w-0 flex-1`,children:[L(`div`,{className:`flex items-center gap-2`,children:[H(`span`,{className:`text-xs font-semibold truncate`,children:r.name}),r.isHub&&H(`span`,{className:`text-[9px] uppercase tracking-wider text-foreground-subtle border border-border rounded px-1 py-0.5`,children:`hub`}),!r.isOnline&&H(`span`,{className:`h-1.5 w-1.5 rounded-full bg-destructive flex-shrink-0`}),r.isOnline&&H(`span`,{className:`h-1.5 w-1.5 rounded-full bg-success flex-shrink-0`})]}),L(`div`,{className:`text-[10px] text-foreground-subtle flex items-center gap-2 mt-0.5`,children:[L(`span`,{children:[r.cpuCores,` cores`]}),H(`span`,{children:`•`}),L(`span`,{children:[Math.round(r.memoryMB/1024),` GB`]}),a>0&&L(z,{children:[H(`span`,{children:`•`}),L(`span`,{className:`inline-flex items-center gap-0.5 text-foreground`,children:[H(ke,{className:`h-2.5 w-2.5`}),a]})]}),!r.isOnline&&L(z,{children:[H(`span`,{children:`•`}),L(`span`,{className:`text-destructive`,children:[`offline`,u===null?``:` · ${u}`]})]})]}),L(`div`,{className:`mt-0.5 flex items-center gap-1`,children:[H(e,{variant:l.pipeline?`success`:`danger`,className:`px-1 py-0 text-[9px] leading-3`,title:l.pipeline?`Pipeline: enabled`:`Pipeline: not enabled (agent capability)`,children:`Pipe`}),H(e,{variant:l.audio?`success`:`danger`,className:`px-1 py-0 text-[9px] leading-3`,title:l.audio?`Audio: enabled`:`Audio: not enabled (agent capability)`,children:`Aud`})]})]})]},r.id)})}),L(`div`,{className:`px-4 py-2 border-t border-border text-[10px] text-foreground-subtle flex items-center justify-between`,children:[L(`span`,{children:[l,` online`]}),u>0&&L(`span`,{className:`text-destructive`,children:[u,` offline`]})]})]})}function ht({nodeId:e,refreshToken:t}){let{data:n}=m(void 0),r=n?.find(t=>t.id===e),i=o(`pipeline.runner-load-snapshot`,t=>t.nodeId===e)?.load??null;return r?L(`div`,{className:`px-6 py-4 border-b border-border`,children:[L(`div`,{className:`flex items-center gap-2 mb-1`,children:[H(`h2`,{className:`text-base font-semibold text-foreground`,children:r.name}),r.isOnline?H(`span`,{className:`text-[10px] px-2 py-0.5 rounded-full bg-success/10 text-success`,children:`online`}):H(`span`,{className:`text-[10px] px-2 py-0.5 rounded-full bg-destructive/10 text-destructive`,children:`offline`}),r.isHub&&H(`span`,{className:`text-[9px] uppercase tracking-wider text-foreground-subtle border border-border rounded px-1 py-0.5`,children:`hub`})]}),L(`div`,{className:`text-[11px] text-foreground-subtle flex items-center gap-2 flex-wrap`,children:[H(`span`,{children:r.cpuModel??`CPU`}),H(`span`,{children:`•`}),L(`span`,{children:[r.cpuCores,` cores`]}),H(`span`,{children:`•`}),L(`span`,{children:[Math.round(r.memoryMB/1024),` GB`]}),i&&L(z,{children:[H(`span`,{children:`•`}),L(`span`,{children:[i.attachedCameras,` cameras (`,i.activeCameras,` active)`]}),H(`span`,{children:`•`}),L(`span`,{children:[i.avgInferenceTimeMs.toFixed(0),`ms avg inference`]}),H(`span`,{children:`•`}),L(`span`,{children:[`queue `,i.queueDepthTotal]}),i.hardware.hasGpu&&L(z,{children:[H(`span`,{children:`•`}),H(`span`,{className:`text-success`,children:`GPU`})]})]})]})]}):H(`div`,{className:`px-6 py-4 border-b border-border`,children:L(`div`,{className:`text-xs text-foreground-subtle`,children:[`Node not found: `,e]})})}function gt({refreshToken:e,nodeId:t}){let[n,r]=V(new Map),{nodes:i}=g();f(`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}=ee(void 0),o=R(()=>{let e=new Map;for(let t of a??[])e.set(t.nodeId,t.deviceCount);return e},[a]),s=R(()=>{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=R(()=>{let e=new Map;for(let t of i)e.set(t.id,t.shortName);return e},[i]),l=R(()=>{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 L(`div`,{className:`@container/liveload`,children:[H(`h3`,{className:`text-sm font-semibold text-foreground mb-2`,children:`Live load`}),L(`div`,{className:`grid grid-cols-2 @md/liveload:grid-cols-3 @3xl/liveload:grid-cols-5 gap-2 mb-3`,children:[H(q,{label:`FPS`,value:e?e.totalFps.toFixed(1):`—`}),H(q,{label:`Active / Attached`,value:e?`${e.activeCameras}/${e.attachedCameras}`:`—`}),H(q,{label:`Avg infer ms`,value:e&&e.attachedCameras>0?(e.totalInferenceWeighted/e.attachedCameras).toFixed(0):`—`}),H(q,{label:`Queue`,value:e?String(e.queueDepth):`—`}),H(q,{label:`Audio`,value:String(o.get(t)??`—`)})]})]})}let u=[...s.entries()].toSorted(([e],[t])=>e===`hub`?-1:t===`hub`?1:e.localeCompare(t));return L(`div`,{className:`@container/liveload`,children:[H(`h3`,{className:`text-sm font-semibold text-foreground mb-2`,children:`Live load`}),L(`div`,{className:`grid grid-cols-2 @md/liveload:grid-cols-3 @3xl/liveload:grid-cols-5 gap-2 sm:gap-3 mb-3`,children:[H(q,{label:`Total agents`,value:`${l.onlineAgents}/${l.totalAgents}`}),H(q,{label:`Active / Attached`,value:`${l.activeCameras}/${l.attachedCameras}`}),H(q,{label:`Total FPS`,value:l.totalFps.toFixed(1)}),H(q,{label:`Avg inference ms`,value:l.avgInferenceTimeMs.toFixed(0)}),H(q,{label:`Queue depth`,value:String(l.queueDepth)})]}),H(`div`,{className:`rounded-lg border border-border overflow-x-auto`,children:L(`table`,{className:`w-full text-xs min-w-[480px]`,children:[H(`thead`,{className:`bg-surface`,children:L(`tr`,{className:`text-foreground-subtle text-[10px] uppercase tracking-wider`,children:[H(`th`,{className:`text-left px-3 py-2`,children:`Agent`}),H(`th`,{className:`text-right px-3 py-2`,children:`FPS`}),H(`th`,{className:`text-right px-3 py-2`,children:`Cameras`}),H(`th`,{className:`text-right px-3 py-2`,children:`Inference ms`}),H(`th`,{className:`text-right px-3 py-2`,children:`Queue`}),H(`th`,{className:`text-right px-3 py-2`,children:`Audio`})]})}),L(`tbody`,{children:[u.map(([e,t])=>L(`tr`,{className:`border-t border-border`,children:[H(`td`,{className:`px-3 py-2 text-foreground font-medium`,children:c.get(e)??e}),H(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.totalFps.toFixed(1)}),H(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.attachedCameras}),H(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.attachedCameras>0?(t.totalInferenceWeighted/t.attachedCameras).toFixed(0):`—`}),H(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.queueDepth}),H(`td`,{className:`px-3 py-2 text-right text-foreground`,children:o.get(e)??`—`})]},e)),u.length===0&&H(`tr`,{children:H(`td`,{colSpan:6,className:`px-3 py-4 text-center text-foreground-subtle text-[11px]`,children:`No camera metrics received yet`})})]})]})})]})}function q({label:e,value:t}){return L(`div`,{className:`rounded-lg border border-border bg-surface/60 p-3`,children:[H(`div`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle mb-1`,children:e}),H(`div`,{className:`text-lg font-semibold text-foreground`,children:t})]})}I();var _t={active:!1,pinned:!1,nodeId:null,reason:``},vt=[`pipeline.camera-assigned`,`pipeline.camera-unassigned`,`pipeline.camera-updated`,`agent.online`,`agent.offline`],yt={pipeline:W,decoder:we,audio:Ae},bt={pipeline:`Pipeline`,decoder:`Decoder`,audio:`Audio`};function xt({mode:e,nodeId:n,compact:i=!1}){if(e===`agent`&&!n)throw Error(`CameraAssignmentsTable: nodeId is required when mode === "agent"`);let a=B(),[o,s]=V(null),[c,l]=V(null),[u,d]=V(new Map);K([`pipelineOrchestrator`,`getPipelineAssignments`],vt),K([`pipelineOrchestrator`,`getAudioAssignments`],vt),K([`pipelineOrchestrator`,`getCameraStatuses`],vt);let{data:p}=N(void 0),{data:m}=oe(void 0),{data:_}=F({},{enabled:e===`agent`}),{nodes:v}=g(),{data:y}=Ne();f(`pipeline.camera-metrics-snapshot`,e=>{let t=e.data;typeof t.deviceId==`number`&&d(e=>{let n=new Map(e);return n.set(t.deviceId,t),n})}),U(()=>{if(u.size===0)return;let e=setInterval(()=>{d(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)},[u.size]);let b=R(()=>{let e=new Map;for(let t of y??[])e.set(t.id,t.name);return e},[y]),x=R(()=>{if(e===`agent`){let e=[];for(let t of _??[]){let r=t.assignment,i=(e,t,r)=>({active:e!==null&&e===n,pinned:t,nodeId:e,reason:r??``}),a=i(r.detectionNodeId,r.pinned.detection,r.reasons.detection),o=i(r.decoderNodeId,r.pinned.decoder,r.reasons.decoder),s=i(r.audioNodeId,r.pinned.audio,r.reasons.audio);!a.active&&!o.active&&!s.active||e.push({deviceId:t.deviceId,deviceName:b.get(t.deviceId)??`Device ${t.deviceId}`,pipeline:a,decoder:o,audio:s})}return e.sort((e,t)=>e.deviceId-t.deviceId),e}let t=new Map,r=e=>{let n=t.get(e);if(n)return n;let r={deviceId:e,deviceName:b.get(e)??`Device ${e}`,pipeline:_t,decoder:_t,audio:_t};return t.set(e,r),r};for(let i of p??[]){let a=r(i.deviceId);t.set(i.deviceId,{...a,pipeline:{active:!0,pinned:i.pinned,nodeId:i.agentNodeId,reason:i.reason??``},decoder:{active:e===`cluster`?!0:i.agentNodeId===n,pinned:!1,nodeId:i.agentNodeId,reason:`co-located`}})}for(let e of m??[]){let n=r(e.deviceId);t.set(e.deviceId,{...n,audio:{active:!0,pinned:e.pinned,nodeId:e.nodeId,reason:`capacity`}})}let i=[...t.values()];return i.sort((e,t)=>e.deviceId-t.deviceId),i},[p,m,_,b,e,n]),S=R(()=>(v??[]).filter(e=>e.isOnline).map(e=>({id:e.id,name:e.name})),[v]),C=()=>{a.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getPipelineAssignments`]]}),a.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getAudioAssignments`]]}),a.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getCameraStatuses`]]})},w=O({onSuccess:C}),T=pe({onSuccess:C}),E=t({onSuccess:C}),D=r({onSuccess:C}),k=(e,t,n)=>{t===`pipeline`?w.mutate({deviceId:e,agentNodeId:n}):E.mutate({deviceId:e,nodeId:n}),s(null)},A=(e,t)=>{t===`pipeline`?T.mutate({deviceId:e}):D.mutate({deviceId:e}),s(null)};return H(`div`,{className:`rounded-lg border border-border overflow-x-auto`,children:L(`table`,{className:`w-full text-xs min-w-[760px] table-fixed`,children:[H(`thead`,{className:`bg-surface`,children:L(`tr`,{className:`text-foreground-subtle text-[10px] uppercase tracking-wider`,children:[!i&&H(`th`,{className:`w-10`}),H(`th`,{className:`min-w-[200px] text-left px-3 py-2 align-middle`,children:`Camera`}),e===`cluster`?L(z,{children:[H(`th`,{className:`w-[168px] text-left px-3 py-2 align-middle`,children:`Auto | Pin`}),H(`th`,{className:`w-[188px] text-left px-3 py-2 align-middle`,children:`Resolved placement`})]}):L(z,{children:[H(`th`,{className:`w-[120px] text-left px-3 py-2 align-middle`,children:`Pipeline`}),H(`th`,{className:`w-[120px] text-left px-3 py-2 align-middle`,children:`Decoder`}),H(`th`,{className:`w-[120px] text-left px-3 py-2 align-middle`,children:`Audio`})]}),H(`th`,{className:`w-[132px] text-left px-3 py-2 align-middle`,children:`Status`})]})}),L(`tbody`,{children:[x.map(t=>{let n=u.get(t.deviceId),r=c===t.deviceId;return L(_e.Fragment,{children:[L(`tr`,{className:`border-t border-border align-middle relative`,children:[!i&&H(`td`,{className:`px-2 py-2 align-middle`,children:H(`button`,{type:`button`,onClick:()=>l(r?null:t.deviceId),className:`p-1 rounded hover:bg-surface-hover text-foreground-subtle`,"aria-label":r?`Collapse broker details`:`Expand broker details`,children:H(r?He:Ge,{className:`h-3.5 w-3.5`})})}),L(`td`,{className:`px-3 py-2 align-middle min-w-0`,children:[H(`div`,{className:`text-foreground font-medium leading-tight line-clamp-2 break-words`,title:t.deviceName,children:t.deviceName}),L(`div`,{className:`text-[10px] text-foreground-subtle leading-tight`,children:[`#`,t.deviceId]})]}),e===`cluster`?L(z,{children:[H(`td`,{className:`px-3 py-2 align-middle`,children:H(St,{state:t.pipeline,onlineNodes:S,pending:w.isPending||T.isPending,onChange:e=>{e===`auto`?A(t.deviceId,`pipeline`):k(t.deviceId,`pipeline`,e)}})}),H(`td`,{className:`px-3 py-2 align-middle`,children:H(Ct,{state:t.pipeline})})]}):L(z,{children:[H(wt,{role:`pipeline`,state:t.pipeline,mode:e,deviceId:t.deviceId,onlineNodes:S,isMenuOpen:o?.deviceId===t.deviceId&&o.role===`pipeline`,onToggleMenu:()=>s(o?.deviceId===t.deviceId&&o.role===`pipeline`?null:{deviceId:t.deviceId,role:`pipeline`}),onCloseMenu:()=>s(null),onMove:e=>k(t.deviceId,`pipeline`,e),onUnpin:()=>A(t.deviceId,`pipeline`)}),H(wt,{role:`decoder`,state:t.decoder,mode:e,deviceId:t.deviceId,onlineNodes:S,readOnly:!0,isMenuOpen:!1,onToggleMenu:()=>void 0,onCloseMenu:()=>void 0,onMove:()=>void 0,onUnpin:()=>void 0}),H(wt,{role:`audio`,state:t.audio,mode:e,deviceId:t.deviceId,onlineNodes:S,isMenuOpen:o?.deviceId===t.deviceId&&o.role===`audio`,onToggleMenu:()=>s(o?.deviceId===t.deviceId&&o.role===`audio`?null:{deviceId:t.deviceId,role:`audio`}),onCloseMenu:()=>s(null),onMove:e=>k(t.deviceId,`audio`,e),onUnpin:()=>A(t.deviceId,`audio`)})]}),H(`td`,{className:`px-3 py-2 align-middle`,children:H(Ot,{snap:n})})]}),r&&!i&&L(`tr`,{className:`bg-surface/50`,children:[H(`td`,{}),H(`td`,{colSpan:e===`cluster`?4:5,className:`px-3 py-2`,children:H(h,{widgetId:`stream-broker/stream-broker-panel`,host:`device-tab`,deviceId:t.deviceId,instanceId:`pipeline-row/${t.deviceId}`,config:{variant:`compact`,title:`Stream brokers & clients`}})})]})]},t.deviceId)}),x.length===0&&H(`tr`,{children:H(`td`,{colSpan:i?e===`cluster`?4:5:e===`cluster`?5:6,className:`px-3 py-4 text-center text-foreground-subtle text-[11px]`,children:e===`agent`?`No cameras assigned to this node`:`No cameras currently assigned`})})]})]})})}function St({state:e,onlineNodes:t,pending:n,onChange:r}){let i=e.pinned&&e.nodeId?e.nodeId:`auto`,a=[...new Set([...e.nodeId?[e.nodeId]:[],...t.map(e=>e.id)])];return L(`select`,{value:i,disabled:n,"aria-label":`Pipeline placement pin`,onChange:e=>r(e.target.value),className:`w-full min-w-0 rounded-md border border-border bg-background px-2 py-1 text-xs text-foreground`,children:[H(`option`,{value:`auto`,children:`Auto`}),a.map(e=>L(`option`,{value:e,children:[`Pin → `,t.find(t=>t.id===e)?.name??e]},e))]})}function Ct({state:e}){if(!e.active||!e.nodeId)return H(`span`,{className:`text-[10px] text-foreground-subtle italic`,children:`—`});let t=e.pinned?`pinned · manual`:`auto · ${e.reason||`capacity`}`;return L(`div`,{className:`flex flex-col leading-tight min-w-0`,children:[H(`span`,{className:`font-mono text-[11px] text-foreground truncate`,title:e.nodeId,children:e.nodeId}),H(`span`,{className:`truncate ${e.pinned?`text-amber-400 text-[10px]`:`text-foreground-subtle text-[10px]`}`,title:t,children:t})]})}function wt({role:e,state:t,mode:n,onlineNodes:r,readOnly:i=!1,isMenuOpen:a,onToggleMenu:o,onCloseMenu:s,onMove:c,onUnpin:l}){let u=yt[e],d=r.filter(e=>e.id!==(t.nodeId??``)),f=!i&&(t.active||n===`cluster`)&&(d.length>0||t.pinned);return L(`td`,{className:`px-3 py-2 align-middle relative min-w-0`,children:[L(`div`,{className:`flex items-center gap-2 min-w-0`,children:[H(n===`agent`?Tt:Et,{state:t,Icon:u}),H(`div`,{className:`ml-auto shrink-0`,children:f&&H(`button`,{type:`button`,onClick:o,className:`p-1 rounded hover:bg-surface-hover`,"aria-label":`${bt[e]} actions`,children:H(at,{className:`h-3 w-3 text-foreground-subtle`})})})]}),a&&f&&H(kt,{title:bt[e],targets:d,pinned:t.pinned,onMove:c,onUnpin:l,onClose:s})]})}function Tt({state:e,Icon:t}){return L(`div`,{className:`flex items-center gap-1.5`,children:[H(e.active?Be:Ve,{className:`h-3.5 w-3.5 ${e.active?`text-success`:`text-foreground-subtle/50`}`}),H(t,{className:`h-3 w-3 ${e.active?`text-foreground-subtle`:`text-foreground-subtle/40`}`}),e.pinned&&H(ct,{className:`h-2.5 w-2.5 text-amber-400`})]})}function Et({state:e,Icon:t}){return!e.active||!e.nodeId?L(`div`,{className:`flex items-center gap-1.5 text-foreground-subtle/60`,children:[H(t,{className:`h-3 w-3`}),H(`span`,{className:`text-[10px] italic`,children:`—`})]}):L(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[H(t,{className:`h-3 w-3 text-foreground-subtle shrink-0`}),L(`div`,{className:`flex flex-col leading-tight min-w-0`,children:[H(`span`,{className:`font-mono text-[11px] text-foreground truncate`,children:e.nodeId}),H(`span`,{className:`flex items-center gap-1 text-[10px]`,children:e.pinned?L(`span`,{className:`inline-flex items-center gap-0.5 text-amber-400`,children:[H(ct,{className:`h-2.5 w-2.5`}),` manual`]}):L(`span`,{className:`text-foreground-subtle truncate`,children:[`auto · `,e.reason||`capacity`]})})]})]})}var Dt=`min-h-[3.25rem]`;function Ot({snap:e}){if(!e)return H(`div`,{className:`flex items-center ${Dt}`,children:H(`span`,{className:`text-[10px] text-foreground-subtle italic`,children:`—`})});let{phase:t,actualFps:n,avgInferenceTimeMs:r,queueDepth:i,configuredFps:a,droppedFrames:o}=e.metrics,s=T(t);return L(`div`,{className:`flex flex-col justify-center gap-0.5 font-mono text-[10px] tabular-nums leading-tight min-w-0 ${Dt}`,children:[L(`span`,{className:`inline-flex items-center gap-1 min-w-0 ${s.textColor}`,children:[H(C,{phase:t,className:`h-2.5 w-2.5 shrink-0`}),H(`span`,{className:`font-semibold uppercase tracking-wider truncate`,children:s.label})]}),L(`span`,{className:`text-foreground-subtle whitespace-nowrap truncate`,children:[H(`span`,{className:`text-foreground`,children:n.toFixed(1)}),L(`span`,{children:[`/`,a.toFixed(0),` fps`]})]}),L(`span`,{className:`text-foreground-subtle whitespace-nowrap truncate`,children:[H(`span`,{className:`text-foreground`,children:r.toFixed(0)}),H(`span`,{children:` ms`}),i>0&&L(`span`,{className:`text-warning ml-1`,children:[`q`,i]})]}),L(`span`,{className:`whitespace-nowrap truncate ${o>0?`text-warning`:`text-foreground-subtle`}`,children:[`drops `,H(`span`,{className:`text-foreground`,children:o})]})]})}function kt({title:e,targets:t,pinned:n,onMove:r,onUnpin:i,onClose:a}){let o=ge(null);return U(()=>{let e=e=>{o.current?.contains(e.target)||a()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[a]),L(`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:[H(`div`,{className:`px-3 py-1 text-[9px] uppercase tracking-wider text-foreground-subtle border-b border-border`,children:e}),t.length>0&&H(`div`,{className:`py-1`,children:t.map(e=>L(`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&&L(`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&&H(`div`,{className:`px-3 py-1.5 text-[10px] text-foreground-subtle italic`,children:`Already auto · no other nodes online`})]})}function At({nodeId:e,refreshToken:t}){return L(`div`,{className:`space-y-6`,children:[H(gt,{refreshToken:t,nodeId:e}),L(`div`,{children:[H(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Cameras on this node`}),L(`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.`]})]}),H(xt,{mode:`agent`,nodeId:e,compact:!0})]})}I();function jt(e,t){let n=Math.max(0,t-e);return`${Math.floor(e/1e3)}s idle · ${Math.floor(n/1e3)}s left`}function Mt({nodeId:e,refreshToken:t}){let n=B(),r=v({onSettled:()=>{n.invalidateQueries({queryKey:[`pipelineExecutor`,`listLoadedEngines`]})}}),{data:s}=S({nodeId:e}),c=o(`pipeline.engine-metrics-snapshot`,t=>t.nodeId===e)?.engines??s??null,l=c===null;K([`pipelineRunner`,`getLocalCameras`],[`pipeline.camera-assigned`,`pipeline.camera-unassigned`]);let{data:u}=a({nodeId:e}),{values:d}=i(`pipeline.camera-metrics-snapshot`,e=>e.deviceId,t=>t.nodeId===e),f=R(()=>d.filter(e=>e.metrics.phase===`active`).length,[d]),p=t=>{let n=u??[];n.length>0&&!window.confirm(`${n.length} camera(s) are dispatching through this engine. Killing it forces a respawn on the next frame. Continue?`)||r.mutate({nodeId:e,engine:t,force:n.length>0})};return L(`div`,{className:`space-y-6`,children:[L(`div`,{children:[H(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Inference engines on this node`}),L(`p`,{className:`text-[11px] text-foreground-subtle`,children:[(c??[]).length,` engine(s) resident in RAM. `,(u??[]).length,` `,`camera(s) attached, `,f,` actively dispatching frames. Refreshes every 5s.`]})]}),H(`div`,{className:`rounded-lg border border-border overflow-x-auto`,children:L(`table`,{className:`w-full text-xs min-w-[640px]`,children:[H(`thead`,{className:`bg-surface`,children:L(`tr`,{className:`text-foreground-subtle text-[10px] uppercase tracking-wider`,children:[H(`th`,{className:`text-left px-3 py-2 whitespace-nowrap`,children:`Kind`}),H(`th`,{className:`text-left px-3 py-2 whitespace-nowrap`,children:`Runtime / Backend / Device`}),H(`th`,{className:`text-left px-3 py-2`,children:`Models`}),H(`th`,{className:`text-right px-3 py-2 whitespace-nowrap`,children:`Pool PID`}),H(`th`,{className:`text-right px-3 py-2 whitespace-nowrap`,children:`Auto-kill`}),H(`th`,{className:`text-right px-3 py-2 whitespace-nowrap`,children:`In use`}),H(`th`,{className:`w-20`})]})}),L(`tbody`,{children:[l&&H(`tr`,{children:H(`td`,{colSpan:7,className:`px-3 py-4 text-center text-foreground-subtle text-[11px]`,children:`Loading…`})}),!l&&(c??[]).map(e=>{let t=e.kind===`warm-override`;return L(`tr`,{className:`border-t border-border ${t?`bg-amber-500/5`:``}`,children:[H(`td`,{className:`px-3 py-2`,children:L(`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:[H(t?ot:W,{className:`h-3 w-3`}),t?`warm`:`runtime`]})}),H(`td`,{className:`px-3 py-2`,children:L(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-sky-400`,children:[H(je,{className:`h-3 w-3`}),e.engine.runtime,`/`,e.engine.backend,e.engine.device?`/${e.engine.device}`:``,e.engine.format?` · ${e.engine.format}`:``]})}),H(`td`,{className:`px-3 py-2`,children:e.modelsLoaded.length===0?H(`span`,{className:`text-foreground-subtle text-[11px]`,children:`—`}):H(`div`,{className:`flex flex-wrap gap-1`,children:e.modelsLoaded.map(e=>H(`span`,{className:`inline-block rounded bg-surface px-1.5 py-0.5 text-[10px] font-mono text-foreground-subtle`,children:e},e))})}),H(`td`,{className:`px-3 py-2 text-right font-mono text-foreground`,children:e.poolPid??`—`}),H(`td`,{className:`px-3 py-2 text-right text-[11px]`,children:e.idleMs!==null&&e.idleTtlMs!==null?H(`span`,{className:`text-foreground-subtle`,children:jt(e.idleMs,e.idleTtlMs)}):H(`span`,{className:`text-foreground-subtle/50`,children:`never`})}),H(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t?`—`:(u??[]).length}),H(`td`,{className:`px-3 py-2 text-right`,children:L(`button`,{type:`button`,disabled:r.isPending,onClick:()=>p(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:[H(Qe,{className:`h-3 w-3`}),`Kill`]})})]},e.engineKey)}),!l&&(c??[]).length===0&&H(`tr`,{children:H(`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.`})})]})]})}),L(`div`,{className:`text-[10px] text-foreground-subtle leading-relaxed`,children:[H(`strong`,{className:`text-foreground`,children:`runtime`}),`: main camera-serving engine; never auto-killed while cameras attached. `,H(`strong`,{className:`text-foreground`,children:`warm`}),`: benchmark/test override held in cache for fast re-use; auto-disposed after the idle TTL.`]}),r.isError&&L(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-[11px] text-destructive`,children:[`Kill failed:`,` `,r.error instanceof Error?r.error.message:`unknown`]})]})}I();var Nt=new Set(ye);function Pt(e){return Nt.has(e)}function Ft(e,t,n){return`${e}/${t}/${n}`}function It(e){return{coreml:`CoreML`,openvino:`OpenVINO`,onnx:`ONNX`}[e.format]??e.format.toUpperCase()}function Lt(e){return{coreml:`Apple Neural Engine / GPU — .mlpackage`,openvino:`Intel CPU / GPU / NPU — .xml`,onnx:`CPU, CUDA, Node.js — .onnx`}[e.format]??`.${e.format}`}function J(e){return e.format}function Rt(e,t){let n=0,r=0,i=0;for(let a of e)for(let e of a.addons)for(let a of e.models){let e=a.formats[t];e&&(n++,e.downloaded&&(r++,i+=e.sizeMB))}return{total:n,downloaded:r,downloadedSizeMB:i}}function zt({addonId:e,model:t,format:n,isActive:r,progress:i,errorMsg:a,onDownload:o,onDelete:s}){let c=t.formats[n];return c?L(`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:[H(`div`,{className:`h-2 w-2 rounded-full shrink-0 ${c.downloaded?`bg-success`:`bg-foreground-subtle/30`}`}),L(`div`,{className:`flex-1 min-w-0`,children:[L(`div`,{className:`flex items-center gap-2`,children:[H(`span`,{className:`text-sm font-medium text-foreground`,children:t.name}),L(`span`,{className:`text-[10px] text-foreground-subtle font-mono`,children:[`(`,t.id,`)`]})]}),i&&i.progress>=0&&i.progress<100&&L(`div`,{className:`mt-1.5 flex items-center gap-2 max-w-xs`,children:[H(`div`,{className:`flex-1 h-1 bg-surface-hover rounded-full overflow-hidden`,children:H(`div`,{className:`bg-primary h-full rounded-full transition-all duration-300`,style:{width:`${i.progress}%`}})}),L(`span`,{className:`text-[9px] text-primary font-mono tabular-nums shrink-0`,children:[Math.round(i.progress),`%`]})]})]}),H(`span`,{className:`text-xs text-foreground-subtle tabular-nums shrink-0`,children:rt(c.sizeMB)}),a&&L(`span`,{className:`flex items-center gap-1 text-[10px] text-danger max-w-[160px] truncate shrink-0`,title:a,children:[H(We,{className:`h-3 w-3 shrink-0`}),a]}),c.downloaded?L(`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?H(G,{className:`h-3 w-3 animate-spin`}):H(Qe,{className:`h-3 w-3`}),r?`Deleting...`:`Delete`]}):L(`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?H(G,{className:`h-3 w-3 animate-spin`}):H(Ce,{className:`h-3 w-3`}),r?`Downloading...`:`Download`]})]}):null}function Bt({engines:e,activeEngine:t,viewEngine:n,onSelect:r}){let[i,a]=V(!1);return L(`div`,{className:`relative`,children:[L(`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:[H(W,{className:`h-4 w-4 text-primary shrink-0`}),L(`div`,{className:`flex-1 min-w-0`,children:[L(`div`,{className:`flex items-center gap-2`,children:[H(`span`,{className:`text-sm font-medium text-foreground`,children:It(n)}),J(n)===J(t)&&H(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded-full bg-success/10 text-success font-medium`,children:`Active`})]}),H(`div`,{className:`text-[10px] text-foreground-subtle`,children:Lt(n)})]}),H(He,{className:`h-4 w-4 text-foreground-subtle transition-transform ${i?`rotate-180`:``}`})]}),i&&H(`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=J(e)===J(n),o=J(e)===J(t);return L(`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:[H(W,{className:`h-4 w-4 shrink-0 ${i?`text-primary`:`text-foreground-subtle`}`}),L(`div`,{className:`flex-1`,children:[L(`div`,{className:`flex items-center gap-2`,children:[H(`span`,{className:`text-sm font-medium ${i?`text-primary`:`text-foreground`}`,children:It(e)}),o&&H(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded-full bg-success/10 text-success font-medium`,children:`Active`})]}),H(`div`,{className:`text-[10px] text-foreground-subtle`,children:Lt(e)})]}),i&&H(Ye,{className:`h-4 w-4 text-primary shrink-0`})]},J(e))})})]})}function Vt({embedded:e=!1,nodeId:t}={}){let n=B(),r=t??`hub`,[i,a]=V(null),[o,c]=V(new Set),[d,p]=V(new Map),[m,h]=V(new Map),[g,_]=V(``),{data:v=[]}=ae({nodeId:r}),y=v.filter((e,t,n)=>n.findIndex(t=>t.format===e.format)===t),{data:x}=b({nodeId:r}),S=x,{data:C,isLoading:w}=l({nodeId:r}),T=u(),E=s();f(`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||(p(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 D=S??{runtime:`node`,backend:`cpu`,format:`onnx`},O=y.find(e=>e.format===i)??D,k=O.format,A=C?.slots??[],j=A.map(e=>({...e,addons:e.addons.map(e=>({...e,models:e.models.filter(e=>e.formats[k]!==void 0)})).filter(e=>e.models.length>0)})).filter(e=>e.addons.length>0),M=Rt(j,k),ee=he(async(e,t,i)=>{if(!Pt(i))return;let a=Ft(e,t,i);c(e=>new Set([...e,a])),h(e=>{let t=new Map(e);return t.delete(a),t});try{await T.mutateAsync({addonId:e,modelId:t,format:i,nodeId:r}),n.invalidateQueries({queryKey:[[`pipelineExecutor`,`getSchema`]]})}catch(e){h(t=>new Map([...t,[a,e instanceof Error?e.message:`Download failed`]]))}finally{c(e=>{let t=new Set(e);return t.delete(a),t})}},[T,n,r]),te=he(async(e,t,i)=>{if(!Pt(i))return;let a=Ft(e,t,i);c(e=>new Set([...e,a])),h(e=>{let t=new Map(e);return t.delete(a),t});try{await E.mutateAsync({addonId:e,modelId:t,format:i,nodeId:r}),n.invalidateQueries({queryKey:[[`pipelineExecutor`,`getSchema`]]})}catch(e){h(t=>new Map([...t,[a,e instanceof Error?e.message:`Delete failed`]]))}finally{c(e=>{let t=new Set(e);return t.delete(a),t})}},[E,n,r]),N=he(e=>{a(e.format)},[]),P=g.trim()?j.map(e=>({...e,addons:e.addons.map(e=>({...e,models:e.models.filter(t=>t.name.toLowerCase().includes(g.toLowerCase())||t.id.toLowerCase().includes(g.toLowerCase())||e.name.toLowerCase().includes(g.toLowerCase()))})).filter(e=>e.models.length>0)})).filter(e=>e.addons.length>0):j,ne=L(z,{children:[w&&H(`div`,{className:`flex items-center justify-center py-16`,children:H(G,{className:`h-5 w-5 animate-spin text-foreground-subtle`})}),!w&&A.length===0&&L(`div`,{className:`flex flex-col items-center justify-center py-16 text-foreground-subtle`,children:[H(Te,{className:`h-8 w-8 mb-3 opacity-30`}),H(`span`,{className:`text-sm`,children:`No pipeline steps available`}),H(`span`,{className:`text-xs mt-1`,children:`Configure the detection pipeline to see available models.`})]}),!w&&A.length>0&&L(z,{children:[H(Bt,{engines:y,activeEngine:D,viewEngine:O,onSelect:N}),L(`div`,{className:`flex items-center gap-4 text-xs text-foreground-subtle`,children:[L(`span`,{children:[H(`span`,{className:`font-semibold text-foreground tabular-nums`,children:M.total}),H(`span`,{className:`ml-1`,children:`compatible models`})]}),H(`span`,{className:`text-border`,children:`|`}),L(`span`,{children:[H(`span`,{className:`font-semibold text-success tabular-nums`,children:M.downloaded}),H(`span`,{className:`ml-1`,children:`downloaded`})]}),H(`span`,{className:`text-border`,children:`|`}),L(`span`,{className:`tabular-nums`,children:[rt(M.downloadedSizeMB),H(`span`,{className:`ml-1`,children:`on disk`})]})]}),M.total>5&&L(`div`,{className:`relative`,children:[H(Re,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-foreground-subtle`}),H(`input`,{type:`text`,value:g,onChange:e=>_(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`})]}),P.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[k]?.downloaded).length,0);return L(`div`,{children:[L(`div`,{className:`flex items-center gap-2 mb-2`,children:[H(`h2`,{className:`text-sm font-semibold text-foreground`,children:e.label}),H(`div`,{className:`flex-1 h-px bg-border`}),L(`span`,{className:`text-[10px] text-foreground-subtle tabular-nums`,children:[n,`/`,t]})]}),H(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:e.addons.map(e=>e.models.map(t=>{let n=Ft(e.id,t.id,k);return H(zt,{addonId:e.id,model:t,format:k,isActive:o.has(n),progress:d.get(t.id),errorMsg:m.get(n),onDownload:()=>ee(e.id,t.id,k),onDelete:()=>te(e.id,t.id,k)},`${e.id}/${t.id}`)}))})]},e.id)}),P.length===0&&H(`div`,{className:`text-center py-8 text-sm text-foreground-subtle`,children:g.trim()?L(z,{children:[`No models matching “`,g,`”`]}):L(z,{children:[`No models available for `,It(O),` format`]})})]})]});return e?H(`div`,{className:`space-y-4`,children:ne}):H(et,{children:ne})}function Ht({nodeId:e,refreshToken:t}){return H(Vt,{embedded:!0,nodeId:e})}var Ut=`pipeline-runner`,Wt=200;function Gt({nodeId:e}){return L(`div`,{className:`flex flex-col gap-3`,children:[L(`div`,{children:[H(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Runner logs`}),L(`p`,{className:`text-[11px] text-foreground-subtle`,children:[`pipeline-runner activity on `,e,` — camera attach/detach, engine phases and pipeline errors. Streaming live; the device chip on a line tells which camera it refers to.`]})]}),H(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:H(A,{agentId:e,addonId:Ut,limit:Wt,maxHeight:`max-h-[calc(100vh-360px)]`,showScope:!0,showDeviceChip:!0,showFilters:!1})})]})}I(),I();function Kt({nodeId:e,title:t}){let{data:n}=Ne(),{data:r}=N(void 0),i=R(()=>{let e=new Map;for(let t of n??[])e.set(t.id,t.name);return e},[n]),a=R(()=>{if(!e)return null;let t=new Set;for(let n of r??[])n.agentNodeId===e&&t.add(n.deviceId);return t},[e,r]),[o,s]=V(new Map);f(`pipeline.camera-metrics-snapshot`,t=>{let n=t.data;typeof n.deviceId==`number`&&(e&&n.nodeId!==e||s(e=>{let t=new Map(e);return t.set(n.deviceId,n),t}))}),U(()=>{if(o.size===0)return;let e=setInterval(()=>{s(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)},[o.size]);let c=R(()=>{let e=[];for(let t of o.values())a&&!a.has(t.deviceId)||e.push(t);return e.sort((e,t)=>e.deviceId-t.deviceId),e},[o,a]);return c.length===0?L(`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`]}):L(`div`,{className:`rounded-md border border-border bg-surface px-3 py-2`,children:[L(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[H(`span`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle`,children:t??`Cameras`}),H(`span`,{className:`text-[10px] text-foreground-subtle`,children:c.length})]}),H(`div`,{className:`flex flex-wrap gap-1.5`,children:c.map(e=>{let t=i.get(e.deviceId)??`#${e.deviceId}`,n=T(e.metrics.phase);return L(`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:[H(C,{phase:e.metrics.phase,className:`h-2.5 w-2.5`}),H(`span`,{className:`font-medium text-foreground/90 max-w-[220px] truncate`,children:t}),H(`span`,{className:`font-mono tabular-nums`,children:e.metrics.actualFps.toFixed(1)}),H(`span`,{className:`opacity-60`,children:`fps`})]},e.deviceId)})})]})}I();var qt=[`pipeline-orchestrator`],Jt=[`decoder`],Yt=!1;function Xt(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 Zt({nodeId:e,refreshToken:t}){let r=B(),i=me(),[a,o]=V(null),[s,c]=V(null),[u,f]=V(null),[h,g]=V(null),_=(m(void 0).data??[]).find(t=>t.id===e)?.name??e,v=l({nodeId:e},{refetchOnMount:`always`}),y=ne({agentNodeId:e},{refetchOnMount:`always`}),b=()=>{r.invalidateQueries({queryKey:[[`addonSettings`]]}),r.invalidateQueries({queryKey:[[`pipelineOrchestrator`]]}),r.invalidateQueries({queryKey:[[`pipelineExecutor`]]})},x=M({onSuccess:b}),S=re({onSuccess:e=>{b(),g(e.effectiveModelId===null?`Reset done — model pins cleared (node offline: effective model resolves on reconnect)`:`Reset done — effective detection model: ${e.effectiveModelId} (Auto)`)}}),C=async()=>{await i({title:`Reset ${_} to hardware-aware defaults?`,message:`This clears every model pin on this node (back to Auto) and every per-camera step override scoped to it. Existing per-camera customisations on this node are lost.`,confirmLabel:`Reset`,variant:`danger`})&&(g(null),S.mutate({agentNodeId:e}))},w=v.data??null,T=y.data,E=w?.selectedEngine.format??`coreml`,D=R(()=>w?d(w):[],[w]),O=R(()=>[{agentNodeId:e,engineLabel:E}],[e,E]),k=(e,t)=>{let n=T?.addonDefaults[e];return!Xt(w,e)?.models.some(e=>!!e.formats[E])||!n?{kind:`na`}:n.enabled?{kind:`enabled`,modelId:n.modelId??`Auto`}:{kind:`disabled`}},A=a&&w?Xt(w,a.addonId):null,j=t=>{let n=T?.addonDefaults[t]??null;o({addonId:t,agentNodeId:e}),c(n)},ee=(t,n)=>{if(!T)return;let r=T.addonDefaults[t],i=Xt(w,t);if(!r&&!i)return;let a={enabled:n,modelId:r?.modelId??i?.defaultModelId??``,settings:r?.settings??{}};x.mutate({agentNodeId:e,defaults:{...T.addonDefaults,[t]:a}})},N=()=>{o(null),c(null)},P=()=>{!s||!a||!T||x.mutate({agentNodeId:e,defaults:{...T.addonDefaults,[a.addonId]:s}},{onSuccess:N})};if(v.isLoading||y.isLoading)return H(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading pipeline…`});if(v.error)return L(`div`,{className:`text-xs text-red-400`,children:[`Failed to load catalog: `,String(v.error)]});if(!w)return H(`div`,{className:`text-xs text-foreground-subtle`,children:`Catalog unavailable for this node (runner offline?).`});let F=a!==null&&A!==null&&s!==null;return L(`div`,{className:`relative h-full w-full space-y-3`,children:[L(`div`,{className:`flex items-center justify-end gap-2 text-xs`,children:[h&&H(`span`,{className:`text-emerald-400`,children:h}),S.isError&&H(`span`,{className:`text-red-400`,children:S.error instanceof Error?S.error.message:`Reset failed`}),H(`button`,{type:`button`,onClick:()=>{C()},disabled:S.isPending,className:`rounded border border-amber-500/40 bg-surface px-2 py-0.5 text-amber-300 hover:bg-surface-hover disabled:opacity-50`,title:`Clear this node's model pins (back to Auto) + per-camera overrides scoped to this node`,children:S.isPending?`Resetting…`:`Reset to default`})]}),H(Kt,{nodeId:e}),H(it,{nodeId:e,addonIds:qt,level:`global`,sectionIds:Jt}),Yt,Yt,H(`div`,{className:F?`md:pr-[360px]`:``,children:D.length>0?H(n,{tree:D,agents:O,getCellState:k,onCellClick:j,selectedCell:a,onToggleEnabled:ee}):H(`div`,{className:`text-xs text-foreground-subtle`,children:`Catalog empty.`})}),L(p,{open:F,onClose:N,title:A?.name??``,subtitle:a?`${a.agentNodeId} · ${E}`:``,footer:L(z,{children:[H(`button`,{type:`button`,className:`px-3 py-1 text-xs border border-border rounded bg-surface hover:bg-muted`,onClick:N,children:`Cancel`}),H(`button`,{type:`button`,disabled:!s||!a||x.isPending,className:`px-3 py-1 text-xs bg-primary text-primary-foreground rounded disabled:opacity-50`,onClick:P,children:x.isPending?`Saving…`:`Save`})]}),children:[x.isError&&L(`div`,{className:`mb-3 rounded-md border border-red-500/40 bg-red-500/10 px-3 py-2 text-[11px] text-red-400`,children:[`Save failed:`,` `,x.error instanceof Error?x.error.message:String(x.error)]}),A&&s&&a&&H(te,{mode:`agent`,addon:A,agentDefault:s,agentNodeId:a.agentNodeId,engineFormat:E,onChangeAgentConfig:e=>c(e)})]})]})}var Qt=[`detection-pipeline`,`audio-analyzer`,`pipeline-runner`],$t=`decoder-nodeav`;function en({nodeId:e,refreshToken:t}){let{data:n}=m(void 0),r=n?.find(t=>t.id===e)?.addons.find(e=>e.capabilities.includes(`decoder`))?.id??$t,i=[...Qt,r];return L(`div`,{className:`flex flex-col h-full`,children:[H(ht,{nodeId:e,refreshToken:t}),H(`div`,{className:`flex-1 min-h-0 overflow-y-auto p-6`,children:H(it,{nodeId:e,addonIds:i,level:`global`,extraTabs:[{id:`assignments`,label:`Assignments`,order:-10,content:H(At,{nodeId:e,refreshToken:t})},{id:`tree`,label:`Pipeline`,order:39,content:H(Zt,{nodeId:e,refreshToken:t})},{id:`engines`,label:`Warm instances`,order:180,content:H(Mt,{nodeId:e,refreshToken:t})},{id:`models`,label:`Models`,order:200,content:H(Ht,{nodeId:e,refreshToken:t})},{id:`logs`,label:`Logs`,order:300,content:H(Gt,{nodeId:e})}]})})]})}var tn=`pipeline-orchestrator`,nn=`recorder`,rn=`recordingNodeId`,an=[`ingestNode`,`recordingNode`,`audioNode`,`motionNode`],on=[{key:`detect`,label:`Detect`,hint:`Runs the detection pipeline (decode + inference) for assigned cameras`}];function sn(e,t){for(let n of e?.sections??[])for(let e of n.fields??[])if(e.key===t)return e.value}function cn(e,t){for(let[n,r]of Object.entries(e??{}))if(n===t)return r}function ln(e,t,n){let r=sn(e,t);return typeof r==`string`&&r.length>0?r:n}function un(e,t,n){let r=sn(e,t);return typeof r==`number`&&Number.isFinite(r)?r:n}function dn(e,t){let n=cn(e,t);return typeof n==`number`&&Number.isFinite(n)?n:null}function fn(e,t){let n=cn(e,t);return typeof n==`string`&&n.length>0?n:null}function pn(e){return e===`ingestNode`?`Ingest`:e===`recordingNode`?`Recording`:e===`audioNode`?`Audio`:`Motion Node`}function mn(e){return e===`ingestNode`?`Node that terminates default camera ingest`:e===`recordingNode`?`Node that owns the recorder (recording-node)`:e===`audioNode`?`Node that runs singleton audio work`:`Runs software (analyzer) motion-watch. Onboard cameras are unaffected.`}function hn(e,t){switch(t){case`detect`:return e.pipeline}}function gn(e){return e instanceof Error?e.message:`Failed to save`}function _n(e){e.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`listAgentSettings`]]}),e.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getAgentSettings`]]}),e.invalidateQueries({queryKey:[[`addonSettings`,`getGlobalSettings`]]})}function vn({capability:e,label:t,hint:n,nodeId:r,active:i,pending:a,layout:o,onToggle:s}){let c=i?`border-success/30 bg-success/15 text-success hover:bg-success/25`:`border-border bg-surface-hover text-foreground-subtle hover:bg-surface hover:text-foreground`,l=o===`card`?`w-full justify-center px-3 py-2 text-xs`:`px-2.5 py-1 text-[11px]`,u=i?Ue:Me;return L(`button`,{type:`button`,role:`switch`,"aria-checked":i,"aria-label":`${t} capability for ${r}`,title:`${t} — ${n}`,disabled:a,onClick:()=>s(e,!i),className:`inline-flex items-center gap-1.5 rounded-full border font-medium transition-colors disabled:opacity-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 ${c} ${l}`,children:[H(u,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":`true`}),H(`span`,{children:t})]})}function yn({node:t,emphasis:n=!1}){let r=t.isHub?ze:W;return L(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[H(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${t.isOnline?`bg-success`:`bg-danger`}`,"aria-hidden":`true`}),H(r,{className:`h-4 w-4 shrink-0 text-foreground-subtle`,"aria-hidden":`true`}),L(`div`,{className:`min-w-0`,children:[L(`div`,{className:`flex items-center gap-1.5 ${n?`text-sm`:`text-xs`} font-semibold text-foreground`,children:[H(`span`,{className:`truncate`,children:t.name}),t.isHub&&H(e,{variant:`info`,className:`px-1.5 py-0 text-[9px] uppercase tracking-wider`,children:`hub`}),!t.isOnline&&H(e,{variant:`danger`,className:`px-1.5 py-0 text-[9px] uppercase tracking-wider`,children:`offline`})]}),H(`div`,{className:`font-mono text-[10px] text-foreground-subtle truncate`,children:t.id})]})]})}I();function bn({nodeId:e,value:t,detectedHosts:n,status:r,errorMessage:i,onCommit:a}){let[o,s]=V(t??``);U(()=>{s(t??``)},[t]);let c=n[0],l=c===void 0?`auto-detect`:`auto: ${c}`,u=r===`pending`,d=o.trim(),f=d!==(t??``),p=f&&!u,m=()=>{p&&a(e,d.length>0?d:null)};return L(`div`,{className:`flex items-center gap-1.5`,children:[H(`input`,{"aria-label":`Reachable host for ${e}`,type:`text`,inputMode:`url`,autoComplete:`off`,spellCheck:!1,placeholder:l,value:o,disabled:u,onChange:e=>s(e.target.value),onBlur:m,onKeyDown:e=>{e.key===`Enter`&&m(),e.key===`Escape`&&s(t??``)},className:`w-40 rounded-md border border-border bg-background px-2.5 py-1.5 text-sm text-foreground placeholder:text-foreground-subtle focus:border-primary focus:outline-none disabled:opacity-50`}),L(`button`,{type:`button`,onClick:m,disabled:!p,"aria-label":`Save reachable host for ${e}`,title:`Save reachable host`,className:`inline-flex shrink-0 items-center gap-1 rounded-md px-2 py-1.5 text-[11px] font-medium bg-primary text-white hover:bg-primary/90 disabled:opacity-40 disabled:cursor-not-allowed`,children:[u?H(G,{className:`h-3 w-3 animate-spin`,"aria-hidden":`true`}):H(Ue,{className:`h-3 w-3`,"aria-hidden":`true`}),`Save`]}),!f&&!u&&r===`success`&&H(Ue,{className:`h-3.5 w-3.5 shrink-0 text-emerald-400`,"aria-label":`Saved`,role:`img`}),r===`error`&&H(`span`,{title:i??`Failed to save reachable host`,children:H(We,{className:`h-3.5 w-3.5 shrink-0 text-red-400`,"aria-label":i??`Failed to save reachable host`,role:`img`})})]})}function xn({label:e,children:t}){return L(`div`,{className:`flex items-center justify-between gap-3`,children:[H(`span`,{className:`text-[11px] font-medium uppercase tracking-wide text-foreground-subtle`,children:e}),t]})}function Sn({node:e,actions:t}){return L(`div`,{className:`rounded-xl border border-border bg-background p-4 space-y-4 ${e.isOnline?``:`opacity-60`}`,children:[H(yn,{node:e,emphasis:!0}),H(`div`,{className:`grid grid-cols-2 gap-2`,children:on.map(n=>H(vn,{capability:n.key,label:n.label,hint:n.hint,nodeId:e.id,active:hn(e.effective,n.key),pending:t.capabilityPending,layout:`card`,onToggle:(n,r)=>t.onToggleCapability(e.id,n,r)},n.key))}),H(`div`,{className:`space-y-3 border-t border-border pt-3`,children:H(xn,{label:`Reachable host`,children:H(bn,{nodeId:e.id,value:e.reachableHost,detectedHosts:e.detectedHosts,status:t.reachableHostStatus(e.id),errorMessage:t.reachableHostErrorMessage(e.id),onCommit:t.onCommitReachableHost})})})]})}function Cn(){return L(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1.5 text-[10px] text-foreground-subtle`,children:[L(`span`,{className:`inline-flex items-center gap-1.5`,children:[H(`span`,{className:`h-2.5 w-2.5 rounded-full border border-success/30 bg-success/15`}),`Active capability`]}),L(`span`,{className:`inline-flex items-center gap-1.5`,children:[H(`span`,{className:`h-2.5 w-2.5 rounded-full border border-border bg-surface-hover`}),`Idle`]}),L(`span`,{className:`inline-flex items-center gap-1.5`,children:[H(`span`,{className:`h-2 w-2 rounded-full bg-success`}),`Node online`]}),L(`span`,{className:`inline-flex items-center gap-1.5`,children:[H(`span`,{className:`h-2 w-2 rounded-full bg-danger`}),`Node offline`]})]})}function wn({nodes:e,actions:t}){return H(`div`,{className:`overflow-x-auto rounded-lg border border-border`,children:L(`table`,{className:`w-full min-w-[720px] border-collapse text-sm`,children:[H(`thead`,{children:L(`tr`,{className:`border-b border-border bg-background text-[10px] uppercase tracking-wider text-foreground-subtle`,children:[H(`th`,{className:`px-4 py-3 text-left font-semibold`,children:`Node`}),on.map(e=>H(`th`,{className:`px-3 py-3 text-center font-semibold`,children:e.label},e.key)),H(`th`,{className:`px-4 py-3 text-left font-semibold`,children:`Reachable host`})]})}),H(`tbody`,{children:e.map(e=>L(`tr`,{className:`border-b border-border last:border-b-0 transition-colors hover:bg-surface-hover/40 ${e.isOnline?``:`opacity-60`}`,children:[H(`td`,{className:`px-4 py-3 align-middle`,children:H(yn,{node:e})}),on.map(n=>H(`td`,{className:`px-3 py-3 text-center align-middle`,children:H(vn,{capability:n.key,label:n.label,hint:n.hint,nodeId:e.id,active:hn(e.effective,n.key),pending:t.capabilityPending,layout:`cell`,onToggle:(n,r)=>t.onToggleCapability(e.id,n,r)})},n.key)),H(`td`,{className:`px-4 py-3 align-middle`,children:H(bn,{nodeId:e.id,value:e.reachableHost,detectedHosts:e.detectedHosts,status:t.reachableHostStatus(e.id),errorMessage:t.reachableHostErrorMessage(e.id),onCommit:t.onCommitReachableHost})})]},e.id))})]})})}function Tn({role:e,value:t,options:n,pending:r,onChange:i}){return L(`label`,{className:`flex flex-col gap-1.5 rounded-lg border border-border bg-background p-3`,children:[H(`span`,{className:`text-xs font-semibold text-foreground`,children:pn(e)}),H(`select`,{value:t,disabled:r,onChange:t=>i(e,t.target.value),className:`rounded-md border border-border bg-surface px-2.5 py-1.5 text-sm text-foreground focus:border-primary focus:outline-none disabled:opacity-50`,children:n.map(e=>H(`option`,{value:e,children:e===`hub`?`hub (default)`:e},e))}),H(`span`,{className:`text-[10px] leading-tight text-foreground-subtle`,children:mn(e)})]})}function En({roleValues:e,options:t,pending:n,lowFpsEnabled:r,fpsMinThreshold:i,onRoleChange:a,onLowFpsToggle:o}){return L(`div`,{className:`grid gap-3 @lg/clustertab:grid-cols-2 @3xl/clustertab:grid-cols-4`,children:[an.map(r=>H(Tn,{role:r,value:e[r],options:t,pending:n,onChange:a},r)),L(`label`,{className:`flex items-start gap-2.5 rounded-lg border border-border bg-background p-3 text-sm text-foreground`,children:[H(`input`,{type:`checkbox`,checked:r,disabled:n,onChange:e=>o(e.target.checked),className:`mt-0.5 h-4 w-4 shrink-0 accent-primary`}),L(`span`,{className:`flex flex-col gap-0.5`,children:[H(`span`,{className:`text-xs font-semibold`,children:`Low-fps relocate/shed`}),L(`span`,{className:`text-[10px] leading-tight text-foreground-subtle`,children:[`fpsMinThreshold `,r?`${i} fps`:`disabled`]})]})]})]})}I();function Dn(e,t,n){return Math.min(Math.max(e,t),n)}function On(e){let t=e.reduce((e,t)=>e+Math.max(t.weight,0),0);if(t<=0){let t=e.length>0?100/e.length:0;return Object.fromEntries(e.map(e=>[e.id,t]))}return Object.fromEntries(e.map(e=>[e.id,Math.max(e.weight,0)/t*100]))}function kn(e,t,n,r,i){let a=i.filter(e=>e!==t&&r.has(e)).reduce((t,n)=>t+Math.max(e[n]??0,0),0),o=Math.max(0,100-a),s=i.filter(e=>e!==t&&!r.has(e)),c=s.length===0?o:Dn(n,0,o),l={...e,[t]:c};if(s.length>0){let e=Math.max(0,o-c)/s.length;for(let t of s)l[t]=e}return l}function An(e,t,n){let r={},i=0,a=[];for(let o of t){let t=Math.max(e[o]??0,0);if(n.has(o)){let e=Math.round(t);r[o]=e,i+=e}else{let e=Math.floor(t);r[o]=e,a.push({id:o,floor:e,frac:t-e})}}let o=Math.max(0,100-i)-a.reduce((e,t)=>e+t.floor,0),s=[...a].sort((e,t)=>t.frac-e.frac);for(let e=0;o>0&&s.length>0;e+=1)r[s[e%s.length].id]+=1,--o;let c=[...a].sort((e,t)=>e.frac-t.frac);for(let e=0;o<0&&c.length>0;e+=1){let t=c[e%c.length].id;r[t]>0&&(--r[t],o+=1)}return r}function jn({nodes:e,pending:t,onCommitWeights:n}){let[r,i]=V(()=>On(e)),[a,o]=V(new Set);U(()=>{i(On(e)),o(t=>new Set([...t].filter(t=>e.some(e=>e.id===t))))},[e.map(e=>`${e.id}:${e.weight}`).join(`|`)]);let s=e.map(e=>e.id),c=e=>{o(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},l=(e,t)=>{i(n=>kn(n,e,t,a,s))},u=()=>{let t=An(r,s,a),i=e.filter(e=>(t[e.id]??0)!==e.weight).map(e=>e.id);if(i.length===0)return;let o=new Set([...i,...a]);n(e.filter(e=>o.has(e.id)).map(e=>({nodeId:e.id,weight:t[e.id]??0})))};if(e.length===0)return H(`p`,{className:`rounded-lg border border-dashed border-border bg-background px-4 py-6 text-center text-xs text-foreground-subtle`,children:`No detect-enabled nodes. Enable “Detect” on a node above to distribute detection weight.`});let d=e.length===1;return L(`div`,{className:`space-y-3`,children:[e.map(e=>{let n=r[e.id]??0,i=a.has(e.id);return L(`div`,{className:`flex items-center gap-3`,children:[H(`span`,{className:`w-28 shrink-0 truncate text-xs font-medium text-foreground`,title:e.name,children:e.name}),H(`input`,{"aria-label":`Detection weight for ${e.name}`,type:`range`,min:0,max:100,step:1,value:Math.round(n),disabled:t||i||d,onChange:t=>l(e.id,Number(t.target.value)),onPointerUp:()=>u(),onKeyUp:()=>u(),className:`h-1.5 flex-1 cursor-pointer accent-primary disabled:cursor-not-allowed disabled:opacity-50`}),L(`span`,{className:`w-10 shrink-0 text-right font-mono text-xs tabular-nums text-foreground`,children:[Math.round(n),`%`]}),H(`button`,{type:`button`,onClick:()=>c(e.id),disabled:t||d,"aria-pressed":i,title:i?`Unlock — allow rebalancing`:`Lock this share when others change`,className:`shrink-0 rounded p-1 hover:bg-surface-hover disabled:opacity-40 ${i?`text-amber-400`:`text-foreground-subtle`}`,children:H(i?$e:st,{className:`h-3.5 w-3.5`})})]},e.id)}),H(`p`,{className:`text-[10px] leading-tight text-foreground-subtle`,children:`Dragging one slider splits the rest equally across the unlocked nodes; lock a node to pin its share — locked nodes never move and the total always stays at 100%, so a drag is bounded by the room the unlocked nodes leave. Detection only distributes across nodes that can source a camera’s frames.`})]})}I();function Mn(){let e=B(),{nodes:t}=g(),n=ue(void 0),r=E({addonId:tn}),i=E({addonId:nn}),a=()=>_n(e),o=j({onSuccess:a}),s=w(),c=fe({onSuccess:a}),l=de({onSuccess:a}),[u,d]=V(!1),f=R(()=>{let e=new Map;for(let t of n.data??[])e.set(t.nodeId,t.settings);return e},[n.data]),p=R(()=>t.map(e=>{let t=f.get(e.id),n=ft(t,e.isHub),r=dn(t,`detectWeight`);return{id:e.id,name:e.name,isHub:e.isHub,isOnline:e.isOnline,settings:t,effective:n,weight:r??1,maxCameras:dn(t,`maxCameras`),reachableHost:fn(t,`reachableHost`),detectedHosts:e.localIps}}),[t,f]),m=p.filter(e=>e.effective.pipeline),h={ingestNode:ln(r.data,`ingestNode`,`hub`),recordingNode:ln(i.data,rn,`hub`),audioNode:ln(r.data,`audioNode`,`hub`),motionNode:ln(r.data,`motionNode`,`hub`)},_=R(()=>{let e=t.filter(e=>e.isOnline).map(e=>e.id);return[...new Set([`hub`,...an.map(e=>h[e]),...e])].filter(e=>e.length>0)},[t,h]),v=un(r.data,`fpsMinThreshold`,0),y=v>0,b=n.isLoading||r.isLoading||i.isLoading,x=(e,t,n)=>{o.mutate({agentNodeId:e,[t]:n})},S=(e,t)=>{if(e===`recordingNode`){l.mutate({addonId:nn,patch:{[rn]:t}});return}l.mutate({addonId:tn,patch:{[e]:t}})},C=e=>{l.mutate({addonId:tn,patch:{fpsMinThreshold:e?Math.max(1,v):0}})},T=e=>c.variables?.agentNodeId===e?c.isPending?`pending`:c.isError?`error`:c.isSuccess?`success`:`idle`:`idle`,D=e=>T(e)===`error`?gn(c.error):null,O=async e=>{d(!0);try{for(let t of e)await s.mutateAsync({agentNodeId:t.nodeId,detectWeight:t.weight})}finally{d(!1),a()}},k={capabilityPending:o.isPending,onToggleCapability:x,onCommitReachableHost:(e,t)=>c.mutate({agentNodeId:e,reachableHost:t}),reachableHostStatus:T,reachableHostErrorMessage:D};return L(`section`,{className:`rounded-xl border border-border bg-surface p-5 @3xl/clustertab:p-6 space-y-6`,children:[L(`header`,{className:`flex items-start justify-between gap-4`,children:[L(`div`,{className:`space-y-1`,children:[H(`h3`,{className:`text-base font-semibold text-foreground`,children:`Pipeline placement`}),H(`p`,{className:`max-w-prose text-xs leading-relaxed text-foreground-subtle`,children:`Toggle which node runs each pipeline capability, distribute detection weight across detect-capable nodes, and choose the singleton cluster roles.`})]}),b&&H(G,{className:`h-5 w-5 shrink-0 animate-spin text-foreground-subtle`,"aria-label":`Loading`})]}),L(`div`,{className:`space-y-3`,children:[H(`h4`,{className:`text-xs font-semibold uppercase tracking-wide text-foreground-subtle`,children:`Singleton cluster roles`}),H(En,{roleValues:h,options:_,pending:l.isPending,lowFpsEnabled:y,fpsMinThreshold:v,onRoleChange:S,onLowFpsToggle:C})]}),L(`div`,{className:`space-y-3`,children:[L(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[H(`h4`,{className:`text-xs font-semibold uppercase tracking-wide text-foreground-subtle`,children:`Per-node capabilities`}),H(Cn,{})]}),p.length===0?H(`p`,{className:`rounded-lg border border-dashed border-border bg-background px-4 py-6 text-center text-xs text-foreground-subtle`,children:`No cluster nodes reporting yet.`}):L(z,{children:[H(`div`,{className:`grid gap-4 @xl/clustertab:grid-cols-2 @3xl/clustertab:hidden`,children:p.map(e=>H(Sn,{node:e,actions:k},e.id))}),H(`div`,{className:`hidden @3xl/clustertab:block`,children:H(wn,{nodes:p,actions:k})})]})]}),L(`div`,{className:`space-y-3`,children:[H(`h4`,{className:`text-xs font-semibold uppercase tracking-wide text-foreground-subtle`,children:`Detection weight`}),H(jn,{nodes:m,pending:u,onCommitWeights:e=>void O(e)})]})]})}I();var Nn=!1;function Pn({refreshToken:e}){let t=B(),{data:n}=m(void 0);R(()=>nt(n??[]),[n]);let r=k({onSuccess:()=>{t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getPipelineAssignments`]]}),t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getAudioAssignments`]]})}});return L(`div`,{className:`space-y-6`,children:[H(gt,{refreshToken:e}),H(Mn,{}),Nn,L(`div`,{className:`flex flex-col gap-3 @md/clustertab:flex-row @md/clustertab:items-center @md/clustertab:justify-between`,children:[L(`div`,{className:`min-w-0`,children:[H(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Placement matrix`}),H(`p`,{className:`text-[11px] text-foreground-subtle`,children:`Pipeline · audio assignments per camera (decode always runs co-located with the pipeline). Click the kebab to pin / unpin / move a role; expand the chevron for the per-camera broker drill-down.`})]}),L(`button`,{type:`button`,onClick:()=>r.mutate(void 0),disabled:r.isPending,className:`inline-flex items-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-white hover:bg-primary/90 disabled:opacity-50 shrink-0 self-start @md/clustertab:self-auto whitespace-nowrap`,children:[H(je,{className:`h-3.5 w-3.5`}),r.isPending?`Rebalancing…`:`Rebalance pipelines`]})]}),H(xt,{mode:`cluster`})]})}var Fn=[`pipeline-orchestrator`];function In({refreshToken:e}){return H(`div`,{className:`space-y-4 max-w-3xl`,children:H(it,{nodeId:`hub`,addonIds:Fn,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.`})})}I();function Ln({refreshToken:e}){let t=B(),{data:n,isLoading:r}=D(),[i,a]=V(null),[o,s]=V(``),[c,l]=V(``),u=()=>{t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`listTemplates`]]})},d=_({onSuccess:()=>{a(null),u()}}),f=le({onSuccess:u}),p=e=>{a(e.id),s(e.name),l(e.description??``)},m=()=>{a(null),s(``),l(``)},h=()=>{if(!i)return;let e=c.trim();d.mutate({id:i,name:o.trim()||`Untitled`,...e?{description:e}:{}})};if(r)return H(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading templates…`});let g=[...n??[]].toSorted((e,t)=>e.name.localeCompare(t.name));return H(`div`,{className:`space-y-6 max-w-4xl`,children:L(`section`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[L(`div`,{className:`border-b border-border px-4 py-3 flex items-center justify-between`,children:[L(`div`,{children:[H(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Templates`}),H(`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.`})]}),L(`div`,{className:`text-[11px] text-foreground-subtle`,children:[g.length,` template`,g.length===1?``:`s`]})]}),g.length===0?L(`div`,{className:`px-4 py-8 text-xs text-foreground-subtle flex flex-col items-center gap-2`,children:[H(Fe,{className:`h-6 w-6 opacity-40`}),H(`div`,{children:`No templates yet. Create one from a device Pipeline tab ("Save as template").`})]}):H(`ul`,{className:`divide-y divide-border`,children:g.map(e=>{let t=i===e.id;return H(`li`,{className:`px-4 py-3 text-xs`,children:L(`div`,{className:`flex items-start gap-3`,children:[H(`div`,{className:`flex-1 min-w-0`,children:t?L(`div`,{className:`space-y-2`,children:[H(`input`,{className:`w-full rounded border border-border bg-surface-hover px-2 py-1 text-xs text-foreground focus:outline-none focus:border-primary`,value:o,onChange:e=>s(e.target.value),placeholder:`Template name`,autoFocus:!0}),H(`input`,{className:`w-full rounded border border-border bg-surface-hover px-2 py-1 text-[11px] text-foreground focus:outline-none focus:border-primary`,value:c,onChange:e=>l(e.target.value),placeholder:`Description (optional)`})]}):L(z,{children:[H(`div`,{className:`font-medium text-foreground`,children:e.name}),e.description&&H(`div`,{className:`text-foreground-subtle mt-0.5`,children:e.description}),L(`div`,{className:`mt-1 font-mono text-[10px] text-foreground-subtle`,children:[e.config.steps.length,` step(s)`,e.config.audio?.enabled?` · audio`:``,L(`span`,{className:`ml-2`,children:[`updated `,new Date(e.updatedAt).toLocaleString()]})]})]})}),H(`div`,{className:`flex items-center gap-1 shrink-0`,children:t?L(z,{children:[L(`button`,{type:`button`,onClick:h,disabled:d.isPending,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium bg-primary text-white hover:bg-primary/90 disabled:opacity-50`,children:[H(Ue,{className:`h-3 w-3`}),`Save`]}),L(`button`,{type:`button`,onClick:m,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[11px] text-foreground-subtle hover:bg-surface-hover`,children:[H(Je,{className:`h-3 w-3`}),`Cancel`]})]}):L(z,{children:[H(`button`,{type:`button`,onClick:()=>p(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:H(Pe,{className:`h-3 w-3`})}),H(`button`,{type:`button`,onClick:()=>{confirm(`Delete template "${e.name}"?`)&&f.mutate({id:e.id})},disabled:f.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:H(Qe,{className:`h-3 w-3`})})]})})]})},e.id)})})]})})}I();function Rn(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 zn({nodeId:e,refreshToken:t}){let r=B(),i=Se().trpcClient,[a,o]=V(null),[s,c]=V(null),u=ue(void 0,{refetchOnMount:`always`});K([`nodes`,`topology`],[`agent.online`,`agent.offline`,`agent.unregistered`,`addon.installed`,`addon.uninstalled`,`addon.updated`]);let f=m(void 0,{refetchOnMount:`always`}),h=R(()=>{let e=new Set;for(let t of f.data??[])t.isOnline&&e.add(t.id);return e},[f.data]),g=l({nodeId:e},{refetchOnMount:`always`}),_=R(()=>(u.data??[]).filter(e=>h.has(e.nodeId)).map(e=>e.nodeId),[u.data,h]),v=ve({enabled:_.length>0,queryKey:[[`pipelineExecutor`,`getSchema`],`schema-by-agent`,_.join(`,`),t],queryFn:async()=>{let e={};for(let t of _)try{e[t]=(await i.pipelineExecutor.getSchema.query({nodeId:t})).selectedEngine.format}catch{e[t]=`coreml`}return e}}),y=M({onSuccess:()=>{r.invalidateQueries({queryKey:[[`pipelineOrchestrator`]]}),r.invalidateQueries({queryKey:[[`pipelineExecutor`]]}),r.invalidateQueries({queryKey:[[`addonSettings`]]})}}),b=R(()=>g.data?d(g.data):[],[g.data]),x=R(()=>{let e=u.data??[],t=h;return(t.size===0?[]:e.filter(e=>t.has(e.nodeId))).map(e=>{let t=v.data?.[e.nodeId];return{agentNodeId:e.nodeId,engineLabel:t??`(engine unknown)`}})},[u.data,v.data,h]),S=(e,t)=>{let n=(u.data?.find(e=>e.nodeId===t))?.settings.addonDefaults[e],r=v.data?.[t];return!Rn(g.data??null,e)?.models.some(e=>r!==void 0&&!!e.formats[r])||!n?{kind:`na`}:n.enabled?{kind:`enabled`,modelId:n.modelId??`Auto`}:{kind:`disabled`}},C=a?u.data?.find(e=>e.nodeId===a.agentNodeId)??null:null,w=a&&g.data?Rn(g.data,a.addonId):null,T=a?v.data?.[a.agentNodeId]??`coreml`:`coreml`,E=()=>{o(null),c(null)},D=(e,t)=>{let n=(u.data?.find(e=>e.nodeId===t))?.settings.addonDefaults[e]??null;o({addonId:e,agentNodeId:t}),c(n)},O=()=>{!s||!a||!C||y.mutate({agentNodeId:a.agentNodeId,defaults:{...C.settings.addonDefaults,[a.addonId]:s}},{onSuccess:E})};if(u.isLoading||g.isLoading)return H(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading agents…`});if(!g.data)return L(`div`,{className:`text-xs text-foreground-subtle`,children:[`Catalog unavailable for `,e,`.`]});let k=a!==null&&w!==null&&s!==null;return L(`div`,{className:`relative h-full w-full space-y-3`,children:[H(Kt,{title:`Cluster cameras`}),H(`div`,{className:k?`md:pr-[360px]`:``,children:b.length>0&&x.length>0?H(n,{tree:b,agents:x,getCellState:S,onCellClick:D,selectedCell:a}):H(`div`,{className:`text-xs text-foreground-subtle`,children:`No agents or catalog empty.`})}),L(p,{open:k,onClose:E,title:w?.name??``,subtitle:a?`${a.agentNodeId} · ${T}`:``,footer:L(z,{children:[H(`button`,{type:`button`,className:`px-3 py-1 text-xs border border-border rounded bg-surface hover:bg-muted`,onClick:E,children:`Cancel`}),H(`button`,{type:`button`,disabled:!s||!a||y.isPending,className:`px-3 py-1 text-xs bg-primary text-primary-foreground rounded disabled:opacity-50`,onClick:O,children:y.isPending?`Saving…`:`Save`})]}),children:[y.isError&&L(`div`,{className:`mb-3 rounded-md border border-red-500/40 bg-red-500/10 px-3 py-2 text-[11px] text-red-400`,children:[`Save failed:`,` `,y.error instanceof Error?y.error.message:String(y.error)]}),w&&s&&a&&H(te,{mode:`agent`,addon:w,agentDefault:s,agentNodeId:a.agentNodeId,engineFormat:T,onChangeAgentConfig:e=>c(e)})]})]})}I();function Bn({types:e}){let t=B(),n=me(),{data:r}=y({}),i=c(),a=R(()=>i.data??[],[i.data]),[o,s]=V(null),[l,u]=V(null),d=()=>{t.invalidateQueries({queryKey:[[`storage`,`listLocations`]]})},f=x({onSuccess:d}),p=ie({onSuccess:d}),m=R(()=>{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]),h=e=>{e.isDefault||f.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`})&&p.mutate({id:e.id})},_=e.map(e=>a.find(t=>t.id===e)).filter(e=>e!==void 0);return L(`div`,{className:`space-y-3`,children:[_.length===0?H(`p`,{className:`text-[11px] text-foreground-subtle italic`,children:`No storage locations declared for this purpose.`}):_.map(e=>H(De,{type:e.id,displayName:e.displayName,description:e.description,cardinality:e.cardinality,locations:m.get(e.id)??[],onAdd:e=>s(e),onEdit:e=>u(e),onDelete:e=>{g(e)},onSetDefault:e=>h(e)},e.id)),o!==null&&H(Oe,{initialType:o,onClose:()=>s(null),onCreated:()=>{d(),s(null)}}),l!==null&&H(Ee,{location:l,onClose:()=>u(null),onSaved:()=>{d(),u(null)}})]})}I();var Vn=`pipeline-analytics`;function Hn(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 Un(){let e=B(),{data:t}=m(void 0),{data:n,isLoading:r}=E({addonId:Vn}),i=Hn(n),a=de({onSuccess:()=>{e.invalidateQueries({queryKey:[[`addonSettings`,`getGlobalSettings`]]})}}),o=R(()=>{let e=(t??[]).filter(e=>e.isOnline).map(e=>e.id);return[...new Set([`hub`,i,...e])].filter(Boolean)},[t,i]);return L(`div`,{className:`flex flex-col gap-6`,children:[L(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[H(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Post-processing node`}),H(`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.`}),L(`div`,{className:`mt-3 flex items-center gap-2`,children:[r?H(G,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):H(`select`,{value:i,onChange:e=>{e.target.value!==i&&a.mutate({addonId:Vn,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=>H(`option`,{value:e,children:e===`hub`?`hub (default)`:e},e))}),a.isPending&&H(G,{className:`h-4 w-4 animate-spin text-primary`})]})]}),L(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[H(`h3`,{className:`mb-1 text-sm font-semibold text-foreground`,children:`Events folder`}),H(`p`,{className:`mb-3 text-[11px] text-foreground-subtle`,children:`Where event crops / full frames are stored. A single folder — no collection / equal-splitting.`}),H(Bn,{types:[`eventMedia`]})]})]})}I();var Wn=`recorder`;function Gn(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 Kn(){let e=B(),{data:t}=m(void 0),{data:n,isLoading:r}=E({addonId:Wn}),i=Gn(n,`recordingNodeId`,`hub`),a=de({onSuccess:()=>{e.invalidateQueries({queryKey:[[`addonSettings`,`getGlobalSettings`]]})}}),o=R(()=>{let e=(t??[]).filter(e=>e.isOnline).map(e=>e.id);return[...new Set([`hub`,i,...e])].filter(Boolean)},[t,i]);return L(`div`,{className:`flex flex-col gap-6`,children:[L(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[H(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Recording node`}),H(`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.`}),L(`div`,{className:`mt-3 flex items-center gap-2`,children:[r?H(G,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):H(`select`,{value:i,onChange:e=>{e.target.value!==i&&a.mutate({addonId:Wn,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=>H(`option`,{value:e,children:e===`hub`?`hub (default)`:e},e))}),a.isPending&&H(G,{className:`h-4 w-4 animate-spin text-primary`})]}),i!==`hub`&&L(`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`,` `,H(`span`,{className:`font-medium`,children:i}),`. If the auto-derived host doesn't work, set the recorder's`,H(`span`,{className:`font-medium`,children:` recordingHubHostname`}),` global setting.`]})]}),L(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[H(`h3`,{className:`mb-1 text-sm font-semibold text-foreground`,children:`Recordings folders`}),H(`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.`}),H(Bn,{types:[`recordings`,`recordingsLow`]})]})]})}var qn=`pipeline-orchestrator`,Jn=200;function Yn(){return L(`div`,{className:`flex flex-col gap-3`,children:[L(`div`,{children:[H(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Orchestrator logs`}),H(`p`,{className:`text-[11px] text-foreground-subtle`,children:`Dispatch decisions, balancer moves and failover events from the pipeline orchestrator. Streaming live; the device chip on a line tells which camera it refers to.`})]}),H(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:H(A,{addonId:qn,limit:Jn,maxHeight:`max-h-[calc(100vh-360px)]`,showScope:!0,showDeviceChip:!0,showFilters:!1})})]})}I();var Xn=[{id:`assignments`,label:`Assignments`},{id:`pipeline`,label:`Pipeline`},{id:`events`,label:`Events`},{id:`recording`,label:`Recording`},{id:`settings`,label:`Settings`},{id:`templates`,label:`Templates`},{id:`logs`,label:`Logs`}];function Zn({refreshToken:e}){let[t,n]=V(`assignments`),{data:r}=m(void 0),i=r?.find(e=>e.isHub&&e.isOnline)?.id??r?.find(e=>e.isOnline)?.id??null;return L(`div`,{className:`flex flex-col h-full`,children:[L(`div`,{className:`px-4 sm:px-6 py-4 border-b border-border`,children:[H(`h2`,{className:`text-base font-semibold text-foreground`,children:`Cluster Orchestration`}),H(`div`,{className:`text-[11px] text-foreground-subtle mt-1`,children:`Assignments with live load, cluster-wide settings, pipeline template library, per-camera pipeline overrides.`})]}),H(`div`,{className:`flex items-center gap-1 px-4 sm:px-6 border-b border-border overflow-x-auto`,children:Xn.map(e=>H(`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))}),L(`div`,{className:`flex-1 min-h-0 overflow-y-auto p-4 sm:p-6 @container/clustertab`,children:[t===`assignments`&&H(Pn,{refreshToken:e}),t===`pipeline`&&(i?H(zn,{nodeId:i,refreshToken:e}):H(`div`,{className:`text-xs text-foreground-subtle`,children:`No online node available — schema unreachable.`})),t===`events`&&H(Un,{}),t===`recording`&&H(Kn,{}),t===`settings`&&H(In,{refreshToken:e}),t===`templates`&&H(Ln,{refreshToken:e}),t===`logs`&&H(Yn,{})]})]})}function Qn(e){let t=[],n=[],{assignment:r,detection:i,decoder:a,broker:o}=e;i!==null&&i.provisioning.state===`failed`&&t.push({code:`provisioning-failed`,severity:`error`,message:i.provisioning.error!==void 0&&i.provisioning.error.length>0?`Engine provisioning failed: ${i.provisioning.error}`:`Engine provisioning failed on the detection node`}),i!==null&&i.phase===`active`&&i.actualFps===0&&t.push({code:`detection-black-hole`,severity:`error`,message:`Detection phase is ACTIVE but 0 fps are being processed — frames are not reaching the detector (cross-node black-hole signature)`}),i!==null&&i.phase===`active`&&a!==null&&a.shm.framesWritten===0&&t.push({code:`decoder-black-hole`,severity:`error`,message:`Decoder on ${a.nodeId} has written 0 frames to the shared-memory plane while detection is active — the decode path is stalled`}),r.detectionNodeId===null&&i===null&&n.push({code:`unassigned`,severity:`warning`,message:`Not placed on any detection node — no pipeline is running for this camera`});for(let e of o?.profiles??[])e.status===`streaming`&&e.inFps===0&&n.push({code:`broker-stalled`,severity:`warning`,message:`Broker profile "${e.profile}" reports streaming but 0 in-fps — the source pull may be stalled`});return[...t,...n]}function $n(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Y(e){return typeof e==`string`&&e.length>0?e:null}function er(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function tr(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function nr(e,t){return e==null?!1:JSON.stringify(e)!==JSON.stringify(t??null)}var rr={detectionMode:null,detectionStreamProfile:null,detectionFps:null,motionSources:[],motionFps:null,motionCooldownMs:null,motionStreamProfile:null,audioMode:null,pipelineNodeId:null,decoderNodeId:null,audioNodeId:null,overriddenKeys:new Set};function ir(e){if(!$n(e)||!Array.isArray(e.sections))return rr;let t=be(e),n=e=>{let n=t.get(e);if(n!==void 0)return n.value??n.default},r=new Set;for(let[e,n]of t)nr(n.value,n.default)&&r.add(e);return{detectionMode:Y(n(`detectionMode`)),detectionStreamProfile:Y(n(`detectionStreamProfile`)),detectionFps:er(n(`detectionFps`)),motionSources:tr(n(`motionSources`)),motionFps:er(n(`motionFps`)),motionCooldownMs:er(n(`motionCooldownMs`)),motionStreamProfile:Y(n(`motionStreamProfile`)),audioMode:Y(n(`audioMode`)),pipelineNodeId:Y(n(`pipelineNodeId`)),decoderNodeId:Y(n(`decoderNodeId`)),audioNodeId:Y(n(`audioNodeId`)),overriddenKeys:r}}function ar(e,t=0){let n=[];for(let r of e)n.push({addonId:r.addonId,modelId:r.modelId??null,enabled:r.enabled,depth:t}),r.children!==void 0&&r.children.length>0&&n.push(...ar(r.children,t+1));return n}function or(e){let{assignment:t,detection:n}=e;return n!==null&&n.provisioning.state===`failed`||t.detectionNodeId===null&&n===null?`error`:n!==null&&n.phase===`active`?`healthy`:`idle`}function X({title:e,children:t}){return L(`div`,{className:`bg-background px-3.5 py-3 min-w-0`,children:[H(`div`,{className:`text-[9px] font-semibold uppercase tracking-[0.14em] text-foreground-subtle mb-2`,children:e}),H(`div`,{className:`flex flex-col gap-1 min-w-0`,children:t})]})}function Z({label:e,children:t,overridden:n=!1}){return L(`div`,{className:`flex items-baseline gap-2 text-[11px] leading-snug min-w-0`,children:[H(`span`,{className:`text-foreground-subtle shrink-0 w-24 truncate`,title:e,children:e}),H(`span`,{className:`font-mono tabular-nums text-foreground min-w-0 truncate flex-1`,children:t}),n&&H(sr,{})]})}function sr(){return H(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full bg-warning shrink-0 self-center`,title:`Device-level override active`,"aria-label":`Device-level override active`,role:`img`})}var cr={neutral:`border-border text-foreground-muted`,success:`border-success/40 text-success`,warning:`border-warning/40 text-warning`,danger:`border-danger/40 text-danger`,info:`border-info/40 text-info`};function Q({tone:e=`neutral`,children:t,title:n}){return H(`span`,{title:n,className:`inline-flex items-center gap-1 rounded border px-1.5 py-px text-[10px] font-medium leading-tight whitespace-nowrap ${cr[e]}`,children:t})}function $({children:e}){return H(`div`,{className:`text-[11px] text-foreground-subtle italic`,children:e})}function lr({icon:e,label:t,nodeId:n,pinned:r,reason:i,overridden:a}){return L(`div`,{className:`flex items-center gap-2 text-[11px] leading-snug min-w-0`,children:[H(e,{className:`h-3 w-3 text-foreground-subtle shrink-0`}),H(`span`,{className:`text-foreground-subtle w-[4.5rem] shrink-0`,children:t}),n===null?H(`span`,{className:`text-foreground-subtle italic`,children:`unassigned`}):L(z,{children:[H(`span`,{className:`font-mono text-foreground truncate`,title:n,children:n}),r?L(`span`,{className:`inline-flex items-center gap-0.5 text-[10px] text-warning shrink-0`,title:`Manually pinned`,children:[H(ct,{className:`h-2.5 w-2.5`}),` manual`]}):L(`span`,{className:`text-[10px] text-foreground-subtle shrink-0 truncate`,children:[`auto · `,i!==void 0&&i.length>0?i:`capacity`]}),a&&H(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full bg-warning shrink-0`,title:`Persisted settings pin for this role`})]})]})}function ur({assignment:e,settings:t,onlineNodes:n,pinPending:r,onDetectionPinChange:i}){let a=e.pinned.detection&&e.detectionNodeId!==null?e.detectionNodeId:`auto`,o=[...new Set([...e.detectionNodeId===null?[]:[e.detectionNodeId],...n.map(e=>e.id)])];return L(X,{title:`Where it runs`,children:[H(lr,{icon:W,label:`Detection`,nodeId:e.detectionNodeId,pinned:e.pinned.detection,reason:e.reasons.detection,overridden:t.overriddenKeys.has(`pipelineNodeId`)}),H(lr,{icon:we,label:`Decoder`,nodeId:e.decoderNodeId,pinned:e.pinned.decoder,reason:e.reasons.decoder,overridden:t.overriddenKeys.has(`decoderNodeId`)}),H(lr,{icon:Ae,label:`Audio`,nodeId:e.audioNodeId,pinned:e.pinned.audio,reason:e.reasons.audio,overridden:t.overriddenKeys.has(`audioNodeId`)}),H(lr,{icon:Ie,label:`Source`,nodeId:e.sourceNodeId,pinned:!1,reason:`ingest owner`,overridden:!1}),H(`div`,{className:`mt-1.5`,children:L(`select`,{value:a,disabled:r,"aria-label":`Detection placement pin`,onChange:e=>i(e.target.value),className:`w-full min-w-0 rounded-md border border-border bg-background px-2 py-1 text-[11px] text-foreground disabled:opacity-50`,children:[H(`option`,{value:`auto`,children:`Auto (load balanced)`}),o.map(e=>L(`option`,{value:e,children:[`Pin detection → `,n.find(t=>t.id===e)?.name??e]},e))]})})]})}function dr(e){return`${e.width}×${e.height} ${e.codec} @${e.fps}fps`}function fr(e,t){if(!(t===null||e===void 0))return e.find(e=>e.profile===t)}function pr(e){return e===null?`default`:e===0?`native (no throttle)`:`${e} fps`}function mr({streams:e,brokerProfiles:t,settings:n,motionEnabled:r,motionFpsLive:i}){let a=fr(t,n.detectionStreamProfile),o=fr(t,n.motionStreamProfile),s=n.motionSources.includes(`analyzer`);return L(X,{title:`Streams & motion`,children:[L(Z,{label:`Detect stream`,overridden:n.overriddenKeys.has(`detectionStreamProfile`),children:[n.detectionStreamProfile??`—`,a!==void 0&&` · ${a.width}×${a.height} ${a.codec}`]}),H(Z,{label:`Detect FPS`,overridden:n.overriddenKeys.has(`detectionFps`),children:pr(n.detectionFps)}),L(Z,{label:`Motion src`,overridden:n.overriddenKeys.has(`motionSources`),children:[n.motionSources.length>0?n.motionSources.join(` + `):`none`,r===!1&&` · inactive`]}),s&&L(z,{children:[L(Z,{label:`Motion stream`,overridden:n.overriddenKeys.has(`motionStreamProfile`),children:[n.motionStreamProfile??`—`,o!==void 0&&` · ${o.width}×${o.height} ${o.codec}`]}),L(Z,{label:`Motion FPS`,overridden:n.overriddenKeys.has(`motionFps`),children:[pr(n.motionFps),i!==null&&` · live ${i.toFixed(1)}`]})]}),H(Z,{label:`Cooldown`,overridden:n.overriddenKeys.has(`motionCooldownMs`),children:n.motionCooldownMs===null?`default`:`${n.motionCooldownMs/1e3}s`}),H(`div`,{className:`mt-1.5 flex flex-col gap-0.5`,children:e.length===0?H($,{children:`No streams registered`}):e.map(e=>L(`div`,{className:`text-[10px] font-mono text-foreground-subtle truncate`,title:e.camStreamId,children:[H(`span`,{className:`text-foreground-muted`,children:e.kind}),` `,dr(e)]},e.camStreamId))})]})}function hr({steps:e,audioModelId:t,audioEnabled:n,audioMode:r}){return L(X,{title:`Pipeline steps`,children:[e===void 0?H($,{children:`Resolving…`}):e.length===0?H($,{children:`No steps configured`}):H(`div`,{className:`flex flex-wrap gap-1`,children:e.map((e,t)=>H(Q,{tone:e.enabled&&e.depth===0?`info`:`neutral`,title:e.modelId??e.addonId,children:L(`span`,{className:e.enabled?``:`line-through opacity-60`,children:[e.depth>0&&H(`span`,{className:`opacity-50`,children:`↳ `}),e.addonId,e.modelId!==null&&L(`span`,{className:`font-mono opacity-75`,children:[` · `,e.modelId]})]})},`${e.addonId}-${t}`))}),H(`div`,{className:`mt-1`,children:L(Z,{label:`Audio class.`,children:[r??`—`,n!==null&&(n?` · running`:` · off`),t!==null&&` · ${t}`]})})]})}var gr={ready:`success`,installing:`info`,verifying:`info`,idle:`neutral`,failed:`danger`};function _r({detection:e,live:t,detectionMode:n,modeOverridden:r}){if(e===null)return L(X,{title:`Detection runtime`,children:[H(Z,{label:`Mode`,overridden:r,children:n??`—`}),H($,{children:`Detection stage inactive or unreachable`})]});let i=t?.phase??e.phase,a=t?.actualFps??e.actualFps,o=t?.configuredFps??e.configuredFps,s=t?.avgInferenceTimeMs??e.avgInferenceMs,c=t?.queueDepth??e.queueDepth,l=T(i),u=i===`active`&&a===0;return L(X,{title:`Detection runtime`,children:[L(`div`,{className:`flex items-center gap-1.5 mb-0.5`,children:[L(`span`,{className:`inline-flex items-center gap-1 rounded border px-1.5 py-px text-[10px] font-semibold uppercase tracking-wider ${l.badgeClass}`,children:[H(C,{phase:i,className:`h-2.5 w-2.5`}),l.label]}),t!==void 0&&H(`span`,{className:`text-[9px] text-foreground-subtle uppercase tracking-wider`,children:`live`})]}),H(Z,{label:`Mode`,overridden:r,children:n??`—`}),L(Z,{label:`FPS`,children:[H(`span`,{className:u?`text-danger font-semibold`:``,children:a.toFixed(1)}),L(`span`,{className:`text-foreground-subtle`,children:[` / `,o.toFixed(0),` configured`]})]}),L(Z,{label:`Inference`,children:[s.toFixed(0),` ms`,c>0&&L(`span`,{className:`text-warning`,children:[` · queue `,c]}),t!==void 0&&t.droppedFrames>0&&L(`span`,{className:`text-warning`,children:[` · drops `,t.droppedFrames]})]}),L(Z,{label:`Engine`,children:[e.engine.backend,` · `,e.engine.device]}),L(Z,{label:`Provisioning`,children:[H(Q,{tone:gr[e.provisioning.state]??`neutral`,children:e.provisioning.state}),e.provisioning.error!==void 0&&L(`span`,{className:`text-danger text-[10px]`,children:[` `,e.provisioning.error]})]})]})}function vr({broker:e}){return e===null?H(X,{title:`Stream broker`,children:H($,{children:`Broker stage inactive or unreachable`})}):L(X,{title:`Stream broker`,children:[e.profiles.length===0?H($,{children:`No broker profiles`}):H(`div`,{className:`flex flex-col gap-1`,children:e.profiles.map(e=>{let t=e.status===`streaming`,n=t&&e.inFps===0;return L(`div`,{className:`flex items-center gap-2 text-[11px] font-mono tabular-nums min-w-0`,children:[H(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full shrink-0 ${n?`bg-danger`:t?`bg-success animate-pulse`:`bg-border`}`,title:e.status}),H(`span`,{className:`text-foreground w-10 shrink-0 truncate`,title:e.profile,children:e.profile}),L(`span`,{className:`text-foreground-subtle truncate`,children:[e.width,`×`,e.height,` `,e.codec]}),L(`span`,{className:`ml-auto shrink-0 ${n?`text-danger`:`text-foreground`}`,children:[e.inFps.toFixed(0),`→`,e.outFps.toFixed(0),`fps`]}),L(`span`,{className:`text-foreground-subtle shrink-0`,title:`Subscribers`,children:[`×`,e.subscribers]})]},e.profile)})}),L(`div`,{className:`mt-1.5 flex flex-wrap gap-1`,children:[L(Q,{tone:e.webrtcSessions>0?`info`:`neutral`,children:[`WebRTC `,e.webrtcSessions]}),L(Q,{tone:e.rtspRestream?`success`:`neutral`,children:[`restream `,e.rtspRestream?`on`:`off`]})]})]})}function yr({decoder:e,detectionActive:t}){if(e===null)return H(X,{title:`Decoder`,children:H($,{children:`Decoder stage inactive or unreachable`})});let n=t&&e.shm.framesWritten===0;return L(X,{title:`Decoder`,children:[H(Z,{label:`Node`,children:e.nodeId}),H(Z,{label:`Sessions`,children:e.sessionCount}),L(Z,{label:`SHM frames`,children:[H(`span`,{className:n?`text-danger font-semibold`:``,children:e.shm.framesWritten}),H(`span`,{className:`text-foreground-subtle`,children:` written`})]}),L(Z,{label:`SHM reads`,children:[e.shm.getFrameHits,` hits`,e.shm.getFrameMisses>0&&L(`span`,{className:`text-warning`,children:[` · `,e.shm.getFrameMisses,` misses`]})]}),L(Z,{label:`SHM budget`,children:[e.shm.budgetMb,` MB`]}),e.formats.length>0&&H(Z,{label:`Formats`,children:e.formats.join(`, `)})]})}I();var br=`pipeline-orchestrator`,xr={healthy:`bg-success`,idle:`bg-warning`,error:`bg-danger`},Sr={healthy:`Healthy`,idle:`Idle`,error:`Error`};function Cr({problems:e}){return H(`div`,{role:`alert`,className:`flex flex-col border-b border-border`,children:e.map(e=>L(`div`,{className:`flex items-start gap-2 px-4 py-1.5 text-[11px] font-medium ${e.severity===`error`?`bg-danger/10 text-danger`:`bg-warning/10 text-warning`}`,children:[H(Xe,{className:`h-3.5 w-3.5 shrink-0 mt-px`}),H(`span`,{className:`min-w-0`,children:e.message})]},e.code))})}function wr({deviceId:e,name:t,online:n,status:r,live:i,onlineNodes:a}){let o=B(),{data:s}=ce({addonId:br,deviceId:e,nodeId:`hub`},{staleTime:3e4}),{data:c}=P({deviceId:e},{staleTime:3e4}),l=R(()=>ir(s),[s]),u=R(()=>c===void 0?void 0:ar(c.steps),[c]),d=R(()=>r===void 0?[]:Qn(r),[r]),f=()=>{o.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getCameraStatuses`]]}),o.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getPipelineAssignments`]]})},p=O({onSuccess:f}),m=pe({onSuccess:f}),h=t=>{t===`auto`?m.mutate({deviceId:e}):p.mutate({deviceId:e,agentNodeId:t})},g=r===void 0?`idle`:or(r),_=d.some(e=>e.severity===`error`),v=d.length>0,y=_?`border-danger/50`:v?`border-warning/40`:`border-border`;return L(`article`,{"aria-label":`${t} pipeline status`,className:`rounded-lg border ${y} bg-background overflow-hidden`,children:[L(`header`,{className:`flex items-center gap-2.5 px-4 py-2.5 border-b border-border bg-surface/50 min-w-0`,children:[H(`span`,{className:`inline-block h-2 w-2 rounded-full shrink-0 ${_?`bg-danger`:xr[g]}`,title:_?`Error`:Sr[g],"aria-label":_?`Error`:Sr[g],role:`img`}),H(`h3`,{className:`text-[13px] font-semibold text-foreground truncate`,title:t,children:t}),L(`span`,{className:`text-[10px] text-foreground-subtle shrink-0`,children:[`#`,e]}),!n&&H(Q,{tone:`danger`,children:`offline`}),L(`span`,{className:`ml-auto flex items-center gap-1.5 shrink-0`,children:[l.detectionMode!==null&&H(Q,{tone:l.detectionMode===`disabled`?`warning`:l.detectionMode===`always-on`?`info`:`neutral`,title:`Object detection mode`,children:l.detectionMode===`disabled`?`detection off`:l.detectionMode}),r?.recording!=null&&(r.recording.active?L(Q,{tone:`danger`,title:`Recording (${r.recording.mode})`,children:[H(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full bg-danger animate-pulse`}),`REC`]}):r.recording.mode!==`off`&&L(Q,{tone:`neutral`,title:`Recording mode`,children:[`rec `,r.recording.mode]}))]})]}),d.length>0&&H(Cr,{problems:d}),r===void 0?H(`div`,{className:`px-4 py-5 text-[11px] text-foreground-subtle italic`,children:`No pipeline status yet — the orchestrator has not composed a snapshot for this camera.`}):L(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-px bg-border`,children:[H(ur,{assignment:r.assignment,settings:l,onlineNodes:a,pinPending:p.isPending||m.isPending,onDetectionPinChange:h}),H(_r,{detection:r.detection,live:i,detectionMode:l.detectionMode,modeOverridden:l.overriddenKeys.has(`detectionMode`)}),H(hr,{steps:u,audioModelId:c?.audio?.modelId??null,audioEnabled:r.audio?.enabled??c?.audio?.enabled??null,audioMode:l.audioMode}),H(mr,{streams:r.source.streams,brokerProfiles:r.broker?.profiles,settings:l,motionEnabled:r.motion?.enabled??null,motionFpsLive:r.motion?.fps??null}),H(vr,{broker:r.broker}),H(yr,{decoder:r.decoder,detectionActive:r.detection?.phase===`active`})]})]})}I();var Tr=5e3,Er=1e4,Dr=5e3;function Or(e){let t=B(),{data:n,isLoading:r}=Ne(),{data:i,isLoading:a}=F({},{refetchInterval:Tr}),{nodes:o}=g();U(()=>{e!==0&&t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getCameraStatuses`]]})},[e,t]);let[s,c]=V(new Map);f(xe.PipelineCameraMetricsSnapshot,e=>{let t=e.data;typeof t.deviceId==`number`&&c(e=>{let n=new Map(e);return n.set(t.deviceId,{phase:t.metrics.phase,configuredFps:t.metrics.configuredFps,actualFps:t.metrics.actualFps,queueDepth:t.metrics.queueDepth,avgInferenceTimeMs:t.metrics.avgInferenceTimeMs,droppedFrames:t.metrics.droppedFrames,timestamp:t.timestamp}),n})}),U(()=>{if(s.size===0)return;let e=setInterval(()=>{c(e=>{let t=Date.now()-Er,n=!1,r=new Map(e);for(let[i,a]of e)a.timestamp<t&&(r.delete(i),n=!0);return n?r:e})},Dr);return()=>clearInterval(e)},[s.size]);let l=R(()=>{let e=new Map;for(let t of i??[])e.set(t.deviceId,t);return e},[i]);return{rows:R(()=>(n??[]).filter(e=>e.isCamera).map(e=>({deviceId:e.id,name:e.name,online:e.online,status:l.get(e.id)})).sort((e,t)=>e.name.localeCompare(t.name)),[n,l]),liveMetrics:s,onlineNodes:R(()=>(o??[]).filter(e=>e.isOnline).map(e=>({id:e.id,name:e.name})),[o]),isLoading:r||a}}I();function kr({refreshToken:e}){let{rows:t,liveMetrics:n,onlineNodes:r,isLoading:i}=Or(e),a=R(()=>[...t.map(e=>{let t=e.status===void 0?[]:Qn(e.status);return{row:e,errorCount:t.filter(e=>e.severity===`error`).length,warningCount:t.filter(e=>e.severity===`warning`).length}})].sort((e,t)=>e.errorCount===t.errorCount?e.warningCount===t.warningCount?0:t.warningCount-e.warningCount:t.errorCount-e.errorCount),[t]),o=R(()=>{let e=0,t=0;for(let r of a)(r.errorCount>0||r.warningCount>0)&&(t+=1),(n.get(r.row.deviceId)?.phase??r.row.status?.detection?.phase)===`active`&&(e+=1);return{total:a.length,active:e,issues:t}},[a,n]);return i&&t.length===0?H(`div`,{className:`flex items-center justify-center h-full text-sm text-foreground-subtle`,children:`Loading camera pipelines…`}):t.length===0?H(`div`,{className:`flex items-center justify-center h-full text-sm text-foreground-subtle`,children:`No cameras found`}):H(`div`,{className:`h-full overflow-y-auto`,children:L(`div`,{className:`max-w-6xl mx-auto flex flex-col gap-3 px-4 py-4`,children:[L(`div`,{className:`flex items-center gap-4 text-[11px] text-foreground-subtle px-1`,children:[L(`span`,{children:[H(`span`,{className:`font-semibold text-foreground`,children:o.total}),` cameras`]}),L(`span`,{children:[H(`span`,{className:`font-semibold text-success`,children:o.active}),` actively inferring`]}),L(`span`,{children:[H(`span`,{className:`font-semibold ${o.issues>0?`text-danger`:`text-foreground`}`,children:o.issues}),` `,`with issues`]}),H(`span`,{className:`ml-auto hidden sm:inline text-[10px]`,children:`polled every 5 s · detection metrics live at 1 Hz`})]}),a.map(({row:e})=>H(wr,{deviceId:e.deviceId,name:e.name,online:e.online,status:e.status,live:n.get(e.deviceId),onlineNodes:r},e.deviceId))]})})}I();var Ar=`__cluster__`;function jr(e){return e===`cameras`?`cameras`:`nodes`}function Mr(){let[e,t]=Ze(),n=jr(e.get(`view`)),r=e.get(`node`)??`__cluster__`,[i,a]=V(0),[o,s]=V(!1);return U(()=>{n===`nodes`&&!e.get(`node`)&&t({view:`nodes`,node:Ar},{replace:!0})},[n,e,t]),L(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[L(`div`,{className:`flex items-center justify-between gap-4 px-4 py-3 border-b border-border shrink-0`,children:[L(`div`,{className:`flex items-center gap-1 rounded-lg border border-border p-0.5 bg-surface`,children:[H(`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`}),H(`button`,{type:`button`,onClick:()=>{t({view:`cameras`},{replace:!0})},className:[`px-3 py-1 rounded-md text-[11px] font-medium transition-colors`,n===`cameras`?`bg-background text-foreground shadow-sm`:`text-foreground-subtle hover:text-foreground`].join(` `),children:`Cameras`})]}),L(`button`,{type:`button`,onClick:()=>a(e=>e+1),title:`Refresh`,className:`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[11px] font-medium border border-border text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,children:[H(Le,{className:`h-3.5 w-3.5`}),`Refresh`]})]}),n===`nodes`&&L(`button`,{type:`button`,onClick:()=>s(e=>!e),"aria-expanded":o,className:`md:hidden flex items-center justify-between gap-2 px-4 py-2 border-b border-border shrink-0 text-[11px] font-medium text-foreground-subtle hover:text-foreground transition-colors`,children:[L(`span`,{children:[o?`Hide`:`Show`,` node list`]}),H(He,{className:[`h-4 w-4 transition-transform`,o?`rotate-180`:``].join(` `)})]}),H(`div`,{className:`flex-1 flex flex-col md:flex-row overflow-hidden min-h-0`,children:n===`nodes`?L(z,{children:[H(`aside`,{className:[o?`block`:`hidden`,`md:block w-full md:w-72 shrink-0 border-b md:border-b-0 md:border-r border-border`,`max-h-[60vh] md:max-h-none overflow-y-auto`].join(` `),children:H(mt,{selectedNodeId:r,onSelect:e=>{t({view:`nodes`,node:e},{replace:!0}),s(!1)},refreshToken:i})}),H(`section`,{className:`flex-1 min-h-0 overflow-hidden`,children:r===`__cluster__`?H(Zn,{refreshToken:i}):H(en,{nodeId:r,refreshToken:i})})]}):H(`section`,{className:`flex-1 min-h-0 overflow-hidden`,children:H(kr,{refreshToken:i})})})]})}export{Mr as PipelinePage};
@@ -0,0 +1 @@
1
+ import{$a as e,Ai as t,Bi as n,Fi as r,Ga as i,Ii as a,Ja as o,Ka as s,Li as c,Mi as l,Ni as u,Oa as d,Oi as f,On as p,Pi as m,Ri as h,Wa as g,Ya as _,Za as v,eo as y,ji as b,ki as x,qa as S,zi as C}from"./src-Bx1PCCWV.js";import{K as w,Q as T,S as E,W as D,b as O,o as k,q as A,x as j,z as M}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{R as N}from"./src-BIAY4cjr.js";import{a as P,i as ee,n as F,r as te,t as I}from"./face-bbox-vlSxiLet.js";import{a as L,c as R,f as z,i as B,l as ne,m as V,n as re,o as ie,p as ae,r as H,s as oe,t as U,u as se}from"./debounced-invalidate-DZ3oxQDl.js";import{t as W}from"./pencil-CUVzuL3L.js";import{t as G}from"./plus-CTLCXGgQ.js";import{t as ce}from"./square-check-big-DqE0lyuf.js";import{t as K}from"./square-CfQwX-85.js";import{F as q,I as le,L as J,N as ue,S as Y,U as de,i as X,s as Z}from"./index-Cdp6OaKK.js";import{t as fe}from"./AdminPage-BwmGKnRf.js";import{n as pe,t as me}from"./authed-media-XfBD4Ma-.js";var he=de(`badge-check`,[[`path`,{d:`M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z`,key:`3c2336`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]);T();var Q=[[`plateGallery`]];function ge({vehicleId:e}){let t=k(),{data:n,isLoading:i}=r({vehicleId:e}),a=c();function o(n){a.mutate({vehicleId:e,sampleId:n.id},{onSettled:()=>{t.invalidateQueries({queryKey:Q})}})}return i?E(`div`,{className:`flex items-center gap-2 py-3 text-xs text-foreground-subtle`,children:[j(Y,{className:`h-3.5 w-3.5 animate-spin`}),`Loading plates…`]}):!n||n.length===0?j(`p`,{className:`py-2 text-xs text-foreground-subtle`,children:`No plates yet.`}):j(`div`,{className:`mt-2 grid grid-cols-3 gap-2 sm:grid-cols-4 md:grid-cols-6`,children:n.map(e=>E(`div`,{className:`group relative overflow-hidden rounded-md border border-border bg-surface`,children:[E(`div`,{className:`relative aspect-[2/1] overflow-hidden bg-surface-hover`,children:[e.base64?j(`img`,{src:`data:image/jpeg;base64,${e.base64}`,alt:e.text,className:`h-full w-full object-cover`}):j(`div`,{className:`flex h-full w-full items-center justify-center text-foreground-subtle`,children:j(J,{className:`h-6 w-6`})}),j(`button`,{type:`button`,onClick:()=>o(e),disabled:a.isPending,className:`absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 transition-opacity group-hover:opacity-100 disabled:cursor-not-allowed`,"aria-label":`Remove plate sample`,children:j(X,{className:`h-4 w-4 text-white`})})]}),j(`p`,{className:`truncate px-1.5 py-1 text-center font-mono text-[11px] font-semibold tracking-wide text-foreground`,title:e.text,children:e.text})]},e.id))})}function _e({vehicle:t,expanded:n,onToggle:r}){let a=k(),[c,u]=A(``),[d,f]=A(!1),[p,m]=A(!1),b=h(),x=l();function C(){u(t.name),f(!0)}function w(){f(!1),u(``)}function T(){let e=c.trim();if(!e||e===t.name){w();return}b.mutate({id:t.id,name:e},{onSettled:()=>{a.invalidateQueries({queryKey:Q}),w()}})}function D(){x.mutate({id:t.id},{onSettled:()=>{a.invalidateQueries({queryKey:Q}),m(!1)}})}return E(`div`,{className:`rounded-md border border-border bg-surface`,children:[E(`div`,{className:`flex items-center gap-2 px-3 py-2`,children:[j(`div`,{className:`h-8 w-12 shrink-0 overflow-hidden rounded border border-border bg-surface-hover`,children:t.coverBase64?j(`img`,{src:`data:image/jpeg;base64,${t.coverBase64}`,alt:t.name,className:`h-full w-full object-cover`}):j(`div`,{className:`flex h-full w-full items-center justify-center`,children:j(J,{className:`h-4 w-4 text-foreground-subtle`})})}),j(`div`,{className:`flex flex-1 min-w-0 items-center gap-2`,children:d?E(O,{children:[j(v,{value:c,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&T(),e.key===`Escape`&&w()},className:`h-6 text-xs`,autoFocus:!0}),j(`button`,{type:`button`,onClick:T,disabled:b.isPending,className:`text-success hover:text-success/80 disabled:opacity-50`,"aria-label":`Confirm rename`,children:j(le,{className:`h-3.5 w-3.5`})}),j(`button`,{type:`button`,onClick:w,className:`text-foreground-subtle hover:text-foreground`,"aria-label":`Cancel rename`,children:j(X,{className:`h-3.5 w-3.5`})})]}):j(`span`,{className:`truncate text-sm font-medium text-foreground`,children:t.name})}),j(e,{variant:`default`,className:`text-[10px]`,children:t.sampleCount}),!d&&E(`div`,{className:`flex items-center gap-1`,children:[j(`button`,{type:`button`,onClick:C,className:`p-1 rounded hover:bg-surface-hover text-foreground-subtle hover:text-foreground`,"aria-label":`Rename`,children:j(W,{className:`h-3.5 w-3.5`})}),j(`button`,{type:`button`,onClick:()=>m(!0),className:`p-1 rounded hover:bg-danger/10 text-foreground-subtle hover:text-danger`,"aria-label":`Delete`,children:j(Z,{className:`h-3.5 w-3.5`})})]}),j(`button`,{type:`button`,onClick:r,className:`p-1 rounded hover:bg-surface-hover text-foreground-subtle`,"aria-label":n?`Collapse`:`Expand`,children:j(n?q:ue,{className:`h-3.5 w-3.5`})})]}),n&&j(`div`,{className:`border-t border-border px-3 pb-3 pt-2`,children:j(ge,{vehicleId:t.id})}),j(g,{open:p,onOpenChange:e=>!e&&m(!1),children:E(i,{children:[E(o,{children:[j(_,{children:`Delete vehicle`}),E(s,{children:[`Delete `,j(`strong`,{children:t.name}),` and all its plate samples? This cannot be undone.`]})]}),E(S,{children:[j(y,{variant:`secondary`,onClick:()=>m(!1),children:`Cancel`}),E(y,{variant:`danger`,onClick:D,disabled:x.isPending,children:[x.isPending?j(Y,{className:`h-3.5 w-3.5 animate-spin`}):null,`Delete`]})]})]})})]})}function ve(){let e=k(),[n,r]=A(``),i=t();function a(){let t=n.trim();t&&i.mutate({name:t},{onSettled:()=>{e.invalidateQueries({queryKey:Q}),r(``)}})}return E(`div`,{className:`flex items-center gap-2 pt-2`,children:[j(v,{placeholder:`New vehicle name…`,value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&a()},className:`h-7 text-xs flex-1`}),E(y,{variant:`primary`,size:`sm`,onClick:a,disabled:i.isPending||!n.trim(),children:[i.isPending?j(Y,{className:`h-3.5 w-3.5 animate-spin`}):j(G,{className:`h-3.5 w-3.5`}),`Add`]})]})}function ye(){let{data:e,isLoading:t}=a(),[n,r]=A(null);function i(e){r(t=>t===e?null:e)}return t?E(`div`,{className:`flex items-center gap-2 py-4 text-xs text-foreground-subtle`,children:[j(Y,{className:`h-4 w-4 animate-spin`}),`Loading vehicles…`]}):E(`div`,{className:`space-y-2`,children:[(!e||e.length===0)&&j(`p`,{className:`py-2 text-xs text-foreground-subtle`,children:`No vehicles enrolled yet. Add one below.`}),e?.map(e=>j(_e,{vehicle:e,expanded:n===e.id,onToggle:()=>i(e.id)},e.id)),j(ve,{})]})}T();var be=[[`plateGallery`]];function xe(e){let[t,n]=A(null),[r,i]=A(null),[a,o]=A(!1);return M(()=>{if(n(null),i(null),o(!1),!e)return;let t=!1,r=null;return(async()=>{try{let i=await pe(`${me}/${encodeURIComponent(e)}`);if(t)return;r=URL.createObjectURL(i),n(r)}catch{t||o(!0)}})(),()=>{t=!0,r&&URL.revokeObjectURL(r)}},[e]),M(()=>{if(!t)return;let e=new Image;return e.onload=()=>i({width:e.naturalWidth,height:e.naturalHeight}),e.onerror=()=>o(!0),e.src=t,()=>{e.onload=null,e.onerror=null}},[t]),{frameSrc:t,naturalWidth:r?.width??null,naturalHeight:r?.height??null,failed:a}}function Se(e){let t=e.filter(e=>e.base64.length>0);return t.length===0?null:t.find(e=>/crop|plate/i.test(e.kind))??t[0]}function $({label:e,value:t,mono:n}){return E(`div`,{className:`flex items-baseline justify-between gap-3 py-1.5 border-b border-border/60 last:border-0`,children:[j(`span`,{className:`shrink-0 text-[11px] uppercase tracking-wide text-foreground-subtle`,children:e}),j(`span`,{className:`min-w-0 truncate text-right text-xs font-medium text-foreground ${n?`font-mono`:``}`,title:t,children:t})]})}function Ce({box:e}){return j(`div`,{className:`pointer-events-none absolute rounded-[3px] border-2 border-primary shadow-[0_0_0_9999px_rgba(0,0,0,0.28)]`,style:{left:`${String(e.x*100)}%`,top:`${String(e.y*100)}%`,width:`${String(e.width*100)}%`,height:`${String(e.height*100)}%`},children:j(`span`,{className:`absolute -top-4 left-0 rounded bg-primary px-1 text-[9px] font-semibold uppercase tracking-wide text-white`,children:`Plate`})})}function we({plate:e,cameraName:t,onClose:n,onAssign:r,onUnassign:a,onDelete:o,actionsPending:s}){let c=k(),{data:l,isFetching:d}=u({plateId:e?.plateId??``},{enabled:e!==null}),f=x(),[p,m]=A(`frame`),[h,_]=A(!1),[b,S]=A(``),{frameSrc:C,naturalWidth:w,naturalHeight:T,failed:O}=xe(e?.keyFrameMediaKey);M(()=>{_(!1),S(``),m(`frame`)},[e?.plateId]);let N=D(()=>{let t=Se(l??[]);return t?`data:image/jpeg;base64,${t.base64}`:e?.base64?`data:image/jpeg;base64,${e.base64}`:null},[l,e]),L=D(()=>!e?.plateBbox||w===null||T===null?null:I(e.plateBbox,w,T),[e?.plateBbox,w,T]);if(e===null)return null;let R=typeof e.keyFrameMediaKey==`string`&&e.keyFrameMediaKey.length>0&&!O,z=R&&p===`frame`,ne=e.assigned?e.vehicleName??`Assigned`:e.recognizedVehicleId?`${e.vehicleName??`Recognized`} (suggested)`:`Unassigned`,re=`${String(Math.round(e.score*100))}%${e.corrected?` · corrected`:``}`;function ie(){e&&(S(e.text),_(!0))}function H(){if(!e)return;let t=b.trim().toUpperCase();if(!t||t===e.text){_(!1);return}f.mutate({plateId:e.plateId,text:t},{onSettled:()=>{c.invalidateQueries({queryKey:be}),_(!1)}})}return j(g,{open:!0,onOpenChange:e=>!e&&n(),children:E(i,{width:`lg`,placement:`sheet-on-mobile`,"aria-label":`Plate 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:[E(`header`,{className:`flex shrink-0 items-start justify-between gap-2 border-b border-border px-4 py-3`,children:[E(`div`,{className:`min-w-0`,children:[j(`div`,{className:`truncate font-mono text-sm font-semibold tracking-wide text-foreground`,children:e.text||`Plate detail`}),j(`div`,{className:`mt-0.5 truncate text-[11px] text-foreground-subtle`,children:t})]}),j(`button`,{type:`button`,onClick:n,className:`rounded p-1 text-foreground-subtle hover:bg-surface-hover hover:text-foreground`,"aria-label":`Close`,children:j(X,{className:`h-4 w-4`})})]}),E(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto overscroll-contain px-4 py-3`,children:[R&&E(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5 text-xs`,children:[E(`button`,{type:`button`,onClick:()=>m(`frame`),className:`flex flex-1 items-center justify-center gap-1 rounded px-2 py-1 transition-colors ${p===`frame`?`bg-primary/12 font-medium text-primary`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground`}`,children:[j(ee,{className:`h-3.5 w-3.5`}),` Full frame`]}),E(`button`,{type:`button`,onClick:()=>m(`crop`),className:`flex flex-1 items-center justify-center gap-1 rounded px-2 py-1 transition-colors ${p===`crop`?`bg-primary/12 font-medium text-primary`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground`}`,children:[j(P,{className:`h-3.5 w-3.5`}),` Crop`]})]}),z&&C?j(`div`,{className:`overflow-hidden rounded-lg border border-border bg-background`,children:j(B,{src:C,alt:`Full frame with detected plate`,fit:`natural`,className:`w-full`,overlay:L?j(Ce,{box:L}):void 0})}):N?E(`div`,{className:`relative aspect-[2/1] w-full overflow-hidden rounded-lg border border-border bg-background`,children:[j(B,{src:N,alt:`Detected plate`,className:`h-full w-full`}),d&&j(`div`,{className:`absolute right-2 top-2 rounded-full bg-black/50 p-1 text-white`,children:j(Y,{className:`h-3.5 w-3.5 animate-spin`})})]}):E(`div`,{className:`flex aspect-[2/1] w-full flex-col items-center justify-center gap-1.5 rounded-lg border border-border bg-warning/5 text-foreground-subtle`,children:[j(V,{className:`h-8 w-8 text-warning/70`}),j(`span`,{className:`text-[11px] font-medium uppercase tracking-wide text-warning/80`,children:`No image`}),j(`span`,{className:`px-6 text-center text-[10px] text-foreground-subtle`,children:`The crop media for this plate could not be resolved. Safe to delete.`})]}),j(`div`,{className:`rounded-lg border border-border bg-surface px-3 py-2`,children:E(`div`,{className:`flex items-center justify-between gap-3`,children:[j(`span`,{className:`shrink-0 text-[11px] uppercase tracking-wide text-foreground-subtle`,children:`Plate text`}),h?E(`div`,{className:`flex min-w-0 flex-1 items-center justify-end gap-1.5`,children:[j(v,{value:b,onChange:e=>S(e.target.value),onKeyDown:e=>{e.key===`Enter`&&H(),e.key===`Escape`&&_(!1)},className:`h-7 max-w-[10rem] text-right font-mono text-xs uppercase`,autoFocus:!0}),j(`button`,{type:`button`,onClick:H,disabled:f.isPending,className:`text-success hover:text-success/80 disabled:opacity-50`,"aria-label":`Save corrected text`,children:f.isPending?j(Y,{className:`h-3.5 w-3.5 animate-spin`}):j(le,{className:`h-3.5 w-3.5`})}),j(`button`,{type:`button`,onClick:()=>_(!1),className:`text-foreground-subtle hover:text-foreground`,"aria-label":`Cancel`,children:j(X,{className:`h-3.5 w-3.5`})})]}):E(`button`,{type:`button`,onClick:ie,className:`group flex min-w-0 items-center gap-1.5`,title:`Correct the OCR reading`,children:[j(`span`,{className:`truncate font-mono text-sm font-semibold tracking-wide text-foreground`,children:e.text||`—`}),j(W,{className:`h-3 w-3 shrink-0 text-foreground-subtle group-hover:text-foreground`})]})]})}),E(`div`,{className:`rounded-lg border border-border bg-surface px-3 py-1`,children:[j($,{label:`Camera`,value:t}),j($,{label:`Captured`,value:ae(e.timestamp)}),j($,{label:`Confidence`,value:re}),j($,{label:`Vehicle`,value:ne}),j($,{label:`Track`,value:e.trackId,mono:!0})]})]}),E(`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:[e.assigned?E(y,{variant:`secondary`,onClick:()=>a(e.plateId),disabled:s,children:[j(F,{className:`h-3.5 w-3.5`}),` Detach`]}):E(y,{variant:`primary`,onClick:()=>r(e.plateId),disabled:s,children:[j(te,{className:`h-3.5 w-3.5`}),` Assign`]}),E(y,{variant:`secondary`,onClick:()=>o(e.plateId),disabled:s,children:[j(Z,{className:`h-3.5 w-3.5`}),` Delete`]})]})]})})}T();var Te=[[`plateGallery`]];function Ee({plateIds:e,vehicles:n,onDone:r}){let a=k(),c=f(),l=t(),[u,d]=A(``),[p,m]=A(!1),[h,b]=A(null),x=e!==null&&e.length>0,C=e?.length??0;function w(){m(!1),d(``),b(null)}function T(){w(),r()}function D(t){!e||e.length===0||c.mutate({plateIds:[...e],vehicleId:t},{onSettled:()=>{a.invalidateQueries({queryKey:Te}),T()}})}function O(){!e||!u.trim()||l.mutate({name:u.trim()},{onSuccess:e=>{e?.id&&D(e.id)},onError:()=>{a.invalidateQueries({queryKey:Te}),T()}})}let M=c.isPending||l.isPending;return j(g,{open:x,onOpenChange:e=>!e&&T(),children:E(i,{children:[E(o,{children:[j(_,{children:C>1?`Assign ${String(C)} plates to vehicle`:`Assign plate to vehicle`}),j(s,{children:`Select an existing vehicle or create a new one.`})]}),j(`div`,{className:`space-y-1 max-h-56 overflow-y-auto`,children:n.map(e=>E(`button`,{type:`button`,onClick:()=>b(e.id),className:`w-full rounded-md px-3 py-2 text-left text-xs transition-colors ${h===e.id?`bg-primary/12 text-primary`:`hover:bg-surface-hover text-foreground`}`,children:[j(`span`,{className:`font-medium`,children:e.name}),E(`span`,{className:`ml-2 text-foreground-subtle`,children:[e.sampleCount,` plates`]})]},e.id))}),p?j(`div`,{className:`flex items-center gap-2 pt-2 border-t border-border`,children:j(v,{placeholder:`New vehicle name…`,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&O()},autoFocus:!0,className:`flex-1`})}):j(`button`,{type:`button`,onClick:()=>{b(null),m(!0)},className:`mt-2 w-full rounded-md border border-dashed border-border px-3 py-2 text-left text-xs text-foreground-subtle hover:border-primary hover:text-primary transition-colors`,children:`+ New vehicle…`}),E(S,{children:[j(y,{variant:`secondary`,onClick:T,disabled:M,children:`Cancel`}),p?E(y,{variant:`primary`,onClick:O,disabled:M||!u.trim(),children:[M&&j(Y,{className:`h-3.5 w-3.5 animate-spin`}),`Create & assign`]}):E(y,{variant:`primary`,onClick:()=>h&&D(h),disabled:M||!h,children:[M&&j(Y,{className:`h-3.5 w-3.5 animate-spin`}),`Assign`,C>1?` ${String(C)}`:``]})]})]})})}T();var De=[[`plateGallery`]],Oe=500,ke=120;function Ae({plate:e,cameraName:t,nowMs:n,selected:r,onToggleSelect:i,onAssign:a,onOpenDetail:o}){let s=k(),c=C(),l=b(),u=()=>{s.invalidateQueries({queryKey:De})},d=()=>o(e.plateId);return E(`div`,{className:`relative flex flex-col overflow-hidden rounded-md border bg-surface ${r?`border-primary ring-1 ring-primary`:`border-border`}`,children:[E(`div`,{className:`relative aspect-[2/1] overflow-hidden bg-surface-hover`,children:[e.base64?j(`img`,{src:`data:image/jpeg;base64,${e.base64}`,alt:`Plate ${e.text} from ${t}`,onClick:d,className:`h-full w-full cursor-zoom-in object-cover`}):E(`button`,{type:`button`,onClick:d,className:`flex h-full w-full flex-col items-center justify-center gap-1 bg-warning/5 text-foreground-subtle`,title:`No crop image — the plate's crop media is missing. Safe to delete.`,children:[j(V,{className:`h-7 w-7 text-warning/70`}),j(`span`,{className:`text-[9px] font-medium uppercase tracking-wide text-warning/80`,children:`No crop`})]}),j(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),i(e.plateId)},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":r?`Deselect`:`Select`,children:r?j(ce,{className:`h-4 w-4 text-primary`}):j(K,{className:`h-4 w-4`})}),e.corrected&&E(`span`,{className:`absolute right-0 top-0 z-10 flex items-center gap-0.5 rounded-bl-md bg-primary/80 px-1 py-0.5 text-[8px] font-semibold uppercase tracking-wide text-white`,title:`Manually corrected`,children:[j(he,{className:`h-3 w-3`}),` Fixed`]})]}),E(`div`,{className:`min-w-0 px-2 pt-1.5 space-y-0.5`,children:[j(`p`,{className:`truncate font-mono text-xs font-bold tracking-wide text-foreground`,title:e.text,children:e.text||`—`}),j(`p`,{className:`truncate text-[10px] text-foreground-subtle`,title:t,children:t}),j(`p`,{className:`truncate text-[10px] text-foreground-subtle`,children:z(e.timestamp,n)}),e.vehicleName&&j(`p`,{className:`truncate text-[10px] font-medium text-primary`,title:e.vehicleName,children:e.vehicleName})]}),E(`div`,{className:`mt-1 flex items-center gap-0.5 border-t border-border/60 px-1 py-0.5`,children:[e.assigned?j(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),c.mutate({plateId:e.plateId},{onSettled:u})},disabled:c.isPending,className:`rounded p-1.5 text-foreground-subtle transition-colors hover:bg-warning/10 hover:text-warning disabled:opacity-40`,"aria-label":`Detach plate`,title:`Detach`,children:c.isPending?j(Y,{className:`h-4 w-4 animate-spin`}):j(F,{className:`h-4 w-4`})}):j(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),a(e.plateId)},className:`rounded p-1.5 text-foreground-subtle transition-colors hover:bg-primary/10 hover:text-primary`,"aria-label":`Assign plate to vehicle`,title:`Assign to vehicle`,children:j(te,{className:`h-4 w-4`})}),j(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),l.mutate({plateId:e.plateId},{onSettled:u})},disabled:l.isPending,className:`ml-auto rounded p-1.5 text-foreground-subtle transition-colors hover:bg-danger/10 hover:text-danger disabled:opacity-40`,"aria-label":`Delete plate`,title:`Delete plate`,children:l.isPending?j(Y,{className:`h-4 w-4 animate-spin`}):j(Z,{className:`h-4 w-4`})})]})]})}var je=[{label:`All`,value:`all`},{label:`Unassigned`,value:`unassigned`},{label:`Assigned`,value:`assigned`}];function Me(e,t){return t===`unassigned`?e.filter(e=>!e.assigned):t===`assigned`?e.filter(e=>e.assigned):e}function Ne(){let e=k(),[t,r]=A(`all`),[i,o]=A(oe),[s,c]=A(new Set),[l,u]=A(new Set),[d,f]=A(null),[h,g]=A(null),{data:_,isLoading:v}=m({limit:Oe},{refetchInterval:3e4}),{data:x=[]}=a(),{data:S}=p({}),w=C(),T=n(),M=b(),N=Date.now(),P=_??[],ee=D(()=>{let e=new Map;for(let t of S??[])e.set(t.id,t.name);return e},[S]),I=e=>ee.get(e)??`Camera #${String(e)}`,z=D(()=>R(P).map(e=>({id:e,name:I(e)})).sort((e,t)=>e.name.localeCompare(t.name)),[P,ee]),B=D(()=>ne(se(Me(P,t),i),s),[P,t,i,s]),V=re(B,ke,D(()=>JSON.stringify([t,i.fromMs,i.toMs,[...s].sort((e,t)=>e-t)]),[t,i.fromMs,i.toMs,s])),ae=D(()=>new Map(P.map(e=>[e.plateId,e])),[P]),U=h===null?null:ae.get(h)??null,W=()=>{e.invalidateQueries({queryKey:De})},G=()=>u(new Set);function ce(e){u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}let K=[...l],q=T.isPending||M.isPending,le=w.isPending||M.isPending;function J(){K.length!==0&&T.mutate({plateIds:K},{onSettled:()=>{W(),G()}})}function ue(){K.length!==0&&Promise.allSettled(K.map(e=>M.mutateAsync({plateId:e}))).then(()=>{W(),G()})}function de(e){g(null),f([e])}function fe(e){w.mutate({plateId:e},{onSettled:W}),g(null)}function pe(e){M.mutate({plateId:e},{onSettled:W}),g(null)}let me=B.length!==P.length;return E(`div`,{className:`relative space-y-3`,children:[E(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[j(`div`,{className:`flex items-center gap-1`,children:je.map(e=>j(`button`,{type:`button`,onClick:()=>r(e.value),className:`rounded-md px-2.5 py-1 text-xs transition-colors ${t===e.value?`bg-primary/12 text-primary font-medium`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground`}`,children:e.label},e.value))}),j(L,{onChange:o}),j(ie,{cameras:z,selected:s,onChange:c}),!v&&j(`span`,{className:`ml-auto text-[10px] text-foreground-subtle`,children:me?`${String(B.length)} of ${String(P.length)} plates`:`${String(B.length)} plate${B.length===1?``:`s`}`})]}),l.size>0&&E(`div`,{className:`flex flex-wrap items-center gap-2 rounded-md border border-primary/40 bg-primary/8 px-3 py-2`,children:[E(`span`,{className:`text-xs font-medium text-foreground`,children:[l.size,` selected`]}),E(`div`,{className:`ml-auto flex flex-wrap items-center gap-1.5`,children:[E(y,{variant:`primary`,onClick:()=>f(K),disabled:q,children:[j(te,{className:`h-3.5 w-3.5`}),` Assign`]}),E(y,{variant:`secondary`,onClick:J,disabled:q,children:[T.isPending?j(Y,{className:`h-3.5 w-3.5 animate-spin`}):j(F,{className:`h-3.5 w-3.5`}),` `,`Detach`]}),E(y,{variant:`secondary`,onClick:ue,disabled:q,children:[j(Z,{className:`h-3.5 w-3.5`}),` Delete`]}),j(y,{variant:`ghost`,onClick:G,disabled:q,children:j(X,{className:`h-3.5 w-3.5`})})]})]}),v&&E(`div`,{className:`flex items-center gap-2 py-4 text-xs text-foreground-subtle`,children:[j(Y,{className:`h-4 w-4 animate-spin`}),` Loading plates…`]}),!v&&B.length===0&&j(`p`,{className:`py-4 text-xs text-foreground-subtle`,children:P.length>0?`No plates match the current filters.`:`No plates recognized yet.`}),!v&&B.length>0&&E(O,{children:[j(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(9rem,1fr))] gap-2`,children:V.pageItems.map(e=>j(Ae,{plate:e,cameraName:I(e.deviceId),nowMs:N,selected:l.has(e.plateId),onToggleSelect:ce,onAssign:e=>f([e]),onOpenDetail:g},e.plateId))}),j(H,{currentPage:V.page,totalItems:V.totalItems,pageSize:V.pageSize,onPageChange:V.setPage,itemNoun:`plates`})]}),j(we,{plate:U,cameraName:U?I(U.deviceId):``,onClose:()=>g(null),onAssign:de,onUnassign:fe,onDelete:pe,actionsPending:le}),j(Ee,{plateIds:d,vehicles:x,onDone:()=>{f(null),G()}})]})}T();var Pe=[[`plateGallery`]],Fe=2e3;function Ie(){let e=k(),t=w(e);t.current=e;let n=w(void 0);n.current||=U({delayMs:Fe,invalidate:()=>{t.current.invalidateQueries({queryKey:Pe})}}),M(()=>()=>n.current?.cancel(),[]),d(N.PipelineAnalyticsPlateGalleryChanged,()=>{n.current?.trigger()})}function Le(){return Ie(),j(fe,{icon:J,title:`Plates`,subtitle:`Manage enrolled vehicles and assign recognized license plates to them.`,children:E(`section`,{className:`space-y-3`,children:[E(`div`,{children:[j(`h2`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Vehicles`}),j(`p`,{className:`text-xs text-foreground-subtle mb-3`,children:`Enrolled vehicle identities used for plate recognition. Expand a row to view or remove plate samples.`}),j(ye,{})]}),E(`div`,{className:`pt-4 border-t border-border`,children:[j(`h2`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Recent recognized plates`}),j(`p`,{className:`text-xs text-foreground-subtle mb-3`,children:`License plates read by the detection pipeline. Assign them to a vehicle, correct the OCR text, or delete.`}),j(Ne,{})]})]})})}export{Le as PlatesPage};
@@ -1 +1 @@
1
- import{Ba as e,Ha as t,Va as n}from"./src-B_-PRq3y.js";import{I as r,K as i,Q as a,S as o,W as s,b 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-DTufy7Ue.js";import{L as f,V as p,c as ee,g as m,n as h,p as g,s as te}from"./player-overlays-DzoWZHnz.js";import{MaskShapeCanvas as _}from"./MaskShapeCanvas-pGn6MKOi.js";var ne=m(`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`}]]);a();var v=120,y=`privacy-mask`,b=`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`,x=`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 S(e){return e.kind===`rect`||e.kind===`polygon`?e:null}function re(e){let t=new Set(e.map(e=>e.id)),n=0;for(;t.has(n);)n+=1;return n}function C(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 w({deviceId:a}){let m=ee(g().trpcClient,a),[w,T]=l(null),[E,D]=l(!1),[O,k]=l(null),[A,j]=l(null),[M,N]=l(!1),[P,F]=l(!1),[I,L]=l(null),[R,z]=l(null),B=i(!1);d(()=>{if(!m)return;let e=!1;return B.current=!1,T(null),D(!1),k(null),j(null),F(!1),L(null),z(null),(async()=>{try{let t=await m.privacyMask?.getOptions({});if(e)return;if(!t)throw Error(`device proxy not ready`);if(T(t),B.current)return;let n=await m.privacyMask?.getStatus({});if(e)return;if(!n)throw Error(`device proxy not ready`);B.current=!0;let r={enabled:n.enabled,regions:n.regions};j(r),k(r)}catch(t){if(e)return;p(t)?D(!0):console.error(`Privacy Mask load failed`,t)}})(),()=>{e=!0}},[m]);let V=s(()=>O!==null&&A!==null&&(O.enabled!==A.enabled||!C(O.regions,A.regions)),[O,A]),H=O?O.regions.length:0,U=w?w.maxRegions:0,W=i(0);d(()=>{W.current=U},[U]);let G=U>0&&H>=U,K=r(()=>{k(e=>e&&{...e,enabled:!e.enabled})},[]),q=r(e=>{L(typeof e==`number`?e:null)},[]),J=s(()=>O?O.regions.map(e=>({id:e.id,shape:e.shape,enabled:e.enabled,label:`Zone ${String(e.id)}`})):[],[O]),Y=r((e,t)=>{let n=S(t);n&&k(t=>t&&{...t,regions:t.regions.map(t=>t.id===e?{...t,shape:n}:t)})},[]),X=r(e=>{let t=S(e);t&&(z(null),k(e=>{if(!e)return e;let n=W.current;if(n>0&&e.regions.length>=n)return e;let r=re(e.regions),i={id:r,enabled:!0,shape:t};return L(r),{...e,regions:[...e.regions,i]}}))},[]),Z=r(e=>{F(!0),L(null),z(e)},[]),ie=r(e=>{F(!0),z(null),L(e)},[]),ae=r(e=>{L(t=>t===e?null:t),k(t=>t&&{...t,regions:t.regions.filter(t=>t.id!==e)})},[]),oe=r(()=>{z(null),L(null),A&&k({enabled:A.enabled,regions:A.regions})},[A]),se=r(async()=>{if(!(!m||!O)){N(!0);try{await m.privacyMask?.setMask({patch:{enabled:O.enabled,regions:[...O.regions]}});let e=await m.privacyMask?.getStatus({});if(e){let t={enabled:e.enabled,regions:e.regions};j(t),k(t)}}catch(e){console.error(`Privacy Mask save failed`,e)}finally{N(!1)}}},[m,O]),ce=r(()=>{F(e=>(e&&(z(null),L(null)),!e))},[]),Q=w?.supportedShapes??[];h(s(()=>P&&!E&&w&&O?{id:y,order:v,node:u(_,{transparent:!0,items:J,supportedShapes:Q,polygonVertices:w.polygonVertices,selectedId:I,onSelect:q,onShapeChange:Y,onDrawComplete:X,drawingKind:R})}:null,[P,E,w,O,J,Q,I,q,Y,X,R]));let le=w?.supportedShapes.includes(`rect`)??!1,ue=w?.supportedShapes.includes(`polygon`)??!1,$=w!==null&&(w.maxRegions<=0||w.supportedShapes.length===0);return m?u(te,{title:`Privacy Mask`,icon:u(t,{className:`h-3.5 w-3.5 text-foreground-subtle`}),children:u(`div`,{className:`flex flex-col gap-3`,children:E||$?u(`p`,{className:`${f} leading-relaxed`,children:`This camera doesn't support an on-board privacy mask.`}):!E&&!$&&w!==null&&O!==null?o(c,{children:[o(`p`,{className:`${f} leading-relaxed`,children:[`Toggle `,u(`strong`,{className:`text-foreground`,children:`Edit mask`}),` to draw blanked-out zones on the live frame, then `,u(`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:[u(`button`,{type:`button`,onClick:ce,disabled:M,"aria-pressed":P,className:P?x:b,children:P?`Done editing`:`Edit mask`}),u(`button`,{type:`button`,onClick:K,disabled:M,"aria-pressed":O.enabled,className:O.enabled?x:b,children:O.enabled?`Mask on`:`Mask off`}),le&&u(`button`,{type:`button`,onClick:()=>Z(`rect`),disabled:M||G,"aria-pressed":R===`rect`,className:R===`rect`?x:b,title:G?`Maximum zones reached`:`Add a rectangle zone`,children:`+ Rect`}),ue&&u(`button`,{type:`button`,onClick:()=>Z(`polygon`),disabled:M||G,"aria-pressed":R===`polygon`,className:R===`polygon`?x:b,title:G?`Maximum zones reached`:`Add a polygon zone`,children:`+ Polygon`}),o(`span`,{className:`${f} ml-1 tabular-nums`,children:[H,` / `,U,` zones`]}),u(`span`,{className:`flex-1`}),u(`button`,{type:`button`,onClick:oe,disabled:M||!V,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`}),u(`button`,{type:`button`,onClick:()=>void se(),disabled:M||!V,className:x,children:M?`Saving…`:`Save`})]}),H>0?u(`div`,{className:`flex flex-col gap-1`,children:O.regions.map(t=>{let r=I===t.id,i=t.shape.kind===`polygon`?ne:n;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:()=>ie(t.id),disabled:M,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:[u(i,{className:`h-3.5 w-3.5 shrink-0`}),o(`span`,{children:[`Zone `,t.id]}),u(`span`,{className:`text-foreground-faint capitalize`,children:t.shape.kind})]}),u(`button`,{type:`button`,onClick:()=>ae(t.id),disabled:M,"aria-label":`Delete zone ${String(t.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:u(e,{className:`h-3.5 w-3.5`})})]},t.id)})}):null]}):u(`p`,{className:`${f} leading-relaxed`,children:`Loading the camera's privacy mask…`})})}):null}export{w as PrivacyMaskSettings};
1
+ import{no as e,ro as t,to as n}from"./src-Bx1PCCWV.js";import{I as r,K as i,Q as a,S as o,W as s,b 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-DTufy7Ue.js";import{L as f,V as p,c as ee,g as m,n as h,p as g,s as te}from"./player-overlays-BrjDKJA9.js";import{MaskShapeCanvas as _}from"./MaskShapeCanvas-pGn6MKOi.js";var ne=m(`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`}]]);a();var v=120,y=`privacy-mask`,b=`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`,x=`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 S(e){return e.kind===`rect`||e.kind===`polygon`?e:null}function re(e){let t=new Set(e.map(e=>e.id)),n=0;for(;t.has(n);)n+=1;return n}function C(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 w({deviceId:a}){let m=ee(g().trpcClient,a),[w,T]=l(null),[E,D]=l(!1),[O,k]=l(null),[A,j]=l(null),[M,N]=l(!1),[P,F]=l(!1),[I,L]=l(null),[R,z]=l(null),B=i(!1);d(()=>{if(!m)return;let e=!1;return B.current=!1,T(null),D(!1),k(null),j(null),F(!1),L(null),z(null),(async()=>{try{let t=await m.privacyMask?.getOptions({});if(e)return;if(!t)throw Error(`device proxy not ready`);if(T(t),B.current)return;let n=await m.privacyMask?.getStatus({});if(e)return;if(!n)throw Error(`device proxy not ready`);B.current=!0;let r={enabled:n.enabled,regions:n.regions};j(r),k(r)}catch(t){if(e)return;p(t)?D(!0):console.error(`Privacy Mask load failed`,t)}})(),()=>{e=!0}},[m]);let V=s(()=>O!==null&&A!==null&&(O.enabled!==A.enabled||!C(O.regions,A.regions)),[O,A]),H=O?O.regions.length:0,U=w?w.maxRegions:0,W=i(0);d(()=>{W.current=U},[U]);let G=U>0&&H>=U,K=r(()=>{k(e=>e&&{...e,enabled:!e.enabled})},[]),q=r(e=>{L(typeof e==`number`?e:null)},[]),J=s(()=>O?O.regions.map(e=>({id:e.id,shape:e.shape,enabled:e.enabled,label:`Zone ${String(e.id)}`})):[],[O]),Y=r((e,t)=>{let n=S(t);n&&k(t=>t&&{...t,regions:t.regions.map(t=>t.id===e?{...t,shape:n}:t)})},[]),X=r(e=>{let t=S(e);t&&(z(null),k(e=>{if(!e)return e;let n=W.current;if(n>0&&e.regions.length>=n)return e;let r=re(e.regions),i={id:r,enabled:!0,shape:t};return L(r),{...e,regions:[...e.regions,i]}}))},[]),Z=r(e=>{F(!0),L(null),z(e)},[]),ie=r(e=>{F(!0),z(null),L(e)},[]),ae=r(e=>{L(t=>t===e?null:t),k(t=>t&&{...t,regions:t.regions.filter(t=>t.id!==e)})},[]),oe=r(()=>{z(null),L(null),A&&k({enabled:A.enabled,regions:A.regions})},[A]),se=r(async()=>{if(!(!m||!O)){N(!0);try{await m.privacyMask?.setMask({patch:{enabled:O.enabled,regions:[...O.regions]}});let e=await m.privacyMask?.getStatus({});if(e){let t={enabled:e.enabled,regions:e.regions};j(t),k(t)}}catch(e){console.error(`Privacy Mask save failed`,e)}finally{N(!1)}}},[m,O]),ce=r(()=>{F(e=>(e&&(z(null),L(null)),!e))},[]),Q=w?.supportedShapes??[];h(s(()=>P&&!E&&w&&O?{id:y,order:v,node:u(_,{transparent:!0,items:J,supportedShapes:Q,polygonVertices:w.polygonVertices,selectedId:I,onSelect:q,onShapeChange:Y,onDrawComplete:X,drawingKind:R})}:null,[P,E,w,O,J,Q,I,q,Y,X,R]));let le=w?.supportedShapes.includes(`rect`)??!1,ue=w?.supportedShapes.includes(`polygon`)??!1,$=w!==null&&(w.maxRegions<=0||w.supportedShapes.length===0);return m?u(te,{title:`Privacy Mask`,icon:u(t,{className:`h-3.5 w-3.5 text-foreground-subtle`}),children:u(`div`,{className:`flex flex-col gap-3`,children:E||$?u(`p`,{className:`${f} leading-relaxed`,children:`This camera doesn't support an on-board privacy mask.`}):!E&&!$&&w!==null&&O!==null?o(c,{children:[o(`p`,{className:`${f} leading-relaxed`,children:[`Toggle `,u(`strong`,{className:`text-foreground`,children:`Edit mask`}),` to draw blanked-out zones on the live frame, then `,u(`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:[u(`button`,{type:`button`,onClick:ce,disabled:M,"aria-pressed":P,className:P?x:b,children:P?`Done editing`:`Edit mask`}),u(`button`,{type:`button`,onClick:K,disabled:M,"aria-pressed":O.enabled,className:O.enabled?x:b,children:O.enabled?`Mask on`:`Mask off`}),le&&u(`button`,{type:`button`,onClick:()=>Z(`rect`),disabled:M||G,"aria-pressed":R===`rect`,className:R===`rect`?x:b,title:G?`Maximum zones reached`:`Add a rectangle zone`,children:`+ Rect`}),ue&&u(`button`,{type:`button`,onClick:()=>Z(`polygon`),disabled:M||G,"aria-pressed":R===`polygon`,className:R===`polygon`?x:b,title:G?`Maximum zones reached`:`Add a polygon zone`,children:`+ Polygon`}),o(`span`,{className:`${f} ml-1 tabular-nums`,children:[H,` / `,U,` zones`]}),u(`span`,{className:`flex-1`}),u(`button`,{type:`button`,onClick:oe,disabled:M||!V,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`}),u(`button`,{type:`button`,onClick:()=>void se(),disabled:M||!V,className:x,children:M?`Saving…`:`Save`})]}),H>0?u(`div`,{className:`flex flex-col gap-1`,children:O.regions.map(t=>{let r=I===t.id,i=t.shape.kind===`polygon`?ne:e;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:()=>ie(t.id),disabled:M,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:[u(i,{className:`h-3.5 w-3.5 shrink-0`}),o(`span`,{children:[`Zone `,t.id]}),u(`span`,{className:`text-foreground-faint capitalize`,children:t.shape.kind})]}),u(`button`,{type:`button`,onClick:()=>ae(t.id),disabled:M,"aria-label":`Delete zone ${String(t.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:u(n,{className:`h-3.5 w-3.5`})})]},t.id)})}):null]}):u(`p`,{className:`${f} leading-relaxed`,children:`Loading the camera's privacy mask…`})})}):null}export{w as PrivacyMaskSettings};
@@ -0,0 +1 @@
1
+ import{Q as e,S as t,q 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-DTufy7Ue.js";import{t as i}from"./radio-_KFBV9h-.js";import{t as a}from"./server-CTi1sPfP.js";import{t as o}from"./wifi-D9LNVG6Y.js";import{U as s}from"./index-Cdp6OaKK.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`}]]);e();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:e,size:i=`md`,showLabel:a}){let o=m(e),s=o.icon,[c,l]=n(!1),u=h(e);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{$t as e,Jt as t,Mn as n,On as r,Qt as i,cn as a,gn as o,vn as s}from"./src-Bx1PCCWV.js";import{I as c,K as l,Q as u,S as d,W as f,b as p,q as m,x as h,z as g}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{t as _}from"./download-DjYX33pK.js";import{t as v}from"./refresh-cw-BM18Lfvw.js";import{I as y,O as b,P as x,S,U as C,i as w,o as T}from"./index-Cdp6OaKK.js";import{t as E}from"./FormBuilder-B69YBaq9.js";import{t as D}from"./BrokerForm-CuIg_iOf.js";var O=C(`radar`,[[`path`,{d:`M19.07 4.93A10 10 0 0 0 6.99 3.34`,key:`z3du51`}],[`path`,{d:`M4 6h.01`,key:`oypzma`}],[`path`,{d:`M2.29 9.62A10 10 0 1 0 21.31 8.35`,key:`qzzz0`}],[`path`,{d:`M16.24 7.76A6 6 0 1 0 8.23 16.67`,key:`1yjesh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M17.99 11.66A6 6 0 0 1 15.77 16.67`,key:`1u2y91`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`m13.41 10.59 5.66-5.66`,key:`mhq4k0`}]]);u();var k=[`amazon.com`,`amazon.it`,`amazon.de`,`amazon.co.uk`,`amazon.fr`,`amazon.es`,`amazon.ca`,`amazon.com.au`,`amazon.co.jp`,`amazon.in`,`amazon.com.br`,`amazon.com.mx`],A=`/addon/import-alexa`,j=2e3;function M(e){return typeof e==`object`&&!!e&&typeof e.sessionId==`string`&&typeof e.loginUrl==`string`}function N(e){return typeof e==`object`&&!!e&&typeof e.phase==`string`&&typeof e.sessionId==`string`}function P(e){return typeof e==`object`&&!!e&&typeof e.brokerId==`string`}function F(e){return{"Content-Type":`application/json`,Authorization:`Bearer ${localStorage.getItem(`camstack_admin_token`)??``}`,...e}}async function I(e,t,n){let r=await fetch(`${A}${e}`,{method:`POST`,headers:F(),body:JSON.stringify(t)}),i=await r.json();if(!r.ok){let e=typeof i==`object`&&i?i.error??`Unknown error`:`Unknown error`;throw Error(String(e))}if(!n(i))throw Error(`Unexpected response from server`);return i}async function L(e){let t=new URLSearchParams({sessionId:e}),n=localStorage.getItem(`camstack_admin_token`)??``,r=await fetch(`${A}/login/status?${t.toString()}`,{headers:{Authorization:`Bearer ${n}`}}),i=await r.json();if(!r.ok){let e=typeof i==`object`&&i?i.error??`Unknown error`:`Unknown error`;throw Error(String(e))}if(!N(i))throw Error(`Unexpected status response from server`);return i}async function R(e){try{await fetch(`${A}/login/cancel`,{method:`POST`,headers:F(),body:JSON.stringify({sessionId:e})})}catch{}}function z({brokerId:e,onResolved:t,onCancel:n}){let[r,i]=m(`amazon.it`),[a,o]=m(`Alexa account`),[s,u]=m({kind:`idle`}),f=l(!0);g(()=>(f.current=!0,()=>{f.current=!1}),[]);let p=l(null),_=l(null),y=c(()=>{_.current!==null&&(clearInterval(_.current),_.current=null)},[]),x=c(async n=>{y(),f.current&&u({kind:`committing`,sessionId:n});try{let r=await I(`/login/commit`,{sessionId:n,name:a.trim().length>0?a.trim():`Alexa account`,...e===void 0?{}:{brokerId:e}},P);p.current=null,t(r.brokerId)}catch(e){let t=e instanceof Error?e.message:String(e);f.current&&u({kind:`error`,message:t,sessionId:n})}},[e,a,t,y]),C=c((e,t)=>{y();let n=async()=>{try{let n=await L(e);if(n.phase===`captured`){y(),x(e);return}if(n.phase===`error`){y(),f.current&&u({kind:`error`,message:n.error??`Login proxy returned an error`,sessionId:e});return}if(n.phase===`cancelled`){y(),f.current&&u({kind:`idle`});return}f.current&&u({kind:`polling`,sessionId:e,loginUrl:n.loginUrl||t,phase:n.phase})}catch(e){let t=e instanceof Error?e.message:String(e);f.current&&u(e=>e.kind===`polling`?{...e}:{kind:`error`,message:t,sessionId:null})}};_.current=setInterval(()=>{n()},j)},[y,x]);g(()=>()=>{y(),p.current!==null&&R(p.current)},[y]);let w=async()=>{y(),p.current!==null&&(R(p.current),p.current=null),u({kind:`starting`});try{let e=await I(`/login/start`,{amazonDomain:r},M);p.current=e.sessionId,u({kind:`polling`,sessionId:e.sessionId,loginUrl:e.loginUrl,phase:`starting`}),C(e.sessionId,e.loginUrl)}catch(e){u({kind:`error`,message:e instanceof Error?e.message:String(e),sessionId:null})}},E=()=>{y(),p.current!==null&&(R(p.current),p.current=null),u({kind:`idle`})},D=()=>{E()},O=s.kind===`idle`,A=s.kind===`starting`,N=s.kind===`polling`,F=s.kind===`committing`,z=s.kind===`error`,B=A||N||F,V=s.kind===`polling`?s.phase:null,H=s.kind===`polling`?s.loginUrl:null,U=N&&V===`awaiting-login`,W=N&&(V===`starting`||V===null);return d(`div`,{className:`space-y-4`,children:[(O||z)&&d(`div`,{className:`space-y-3`,children:[e===void 0&&d(`div`,{className:`space-y-1`,children:[h(`label`,{htmlFor:`alexa-account-name`,className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Account name`}),h(`input`,{id:`alexa-account-name`,type:`text`,value:a,onChange:e=>o(e.target.value),placeholder:`Alexa account`,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`})]}),d(`div`,{className:`space-y-1`,children:[h(`label`,{htmlFor:`alexa-amazon-region`,className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Amazon region`}),h(`select`,{id:`alexa-amazon-region`,value:r,onChange:e=>i(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`,children:k.map(e=>h(`option`,{value:e,children:e},e))})]})]}),z&&d(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px] flex items-start gap-2`,children:[h(T,{className:`h-3.5 w-3.5 mt-0.5 flex-shrink-0`}),h(`span`,{children:s.message})]}),A&&d(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-3 text-xs text-foreground-subtle`,children:[h(S,{className:`h-4 w-4 animate-spin flex-shrink-0`}),`Starting login proxy…`]}),W&&d(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-3 text-xs text-foreground-subtle`,children:[h(S,{className:`h-4 w-4 animate-spin flex-shrink-0`}),`Waiting for proxy to be ready…`]}),F&&d(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-3 text-xs text-foreground-subtle`,children:[h(S,{className:`h-4 w-4 animate-spin flex-shrink-0`}),`Saving credentials…`]}),U&&H!==null&&d(`div`,{className:`space-y-3`,children:[d(`div`,{className:`rounded-lg border border-border bg-surface p-3 space-y-2`,children:[h(`p`,{className:`text-xs font-semibold text-foreground`,children:`Open the link below to log in to your Amazon account`}),h(`p`,{className:`text-[10px] text-foreground-subtle`,children:`After completing the login and any 2FA steps, this wizard will continue automatically.`}),d(`a`,{href:H,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 rounded bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90`,children:[h(b,{className:`h-3.5 w-3.5`}),`Login to Amazon`]})]}),d(`div`,{className:`rounded border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-[10px] text-amber-700 dark:text-amber-300`,children:[h(`strong`,{children:`Note:`}),` The login proxy runs directly on the hub. If the link does not open or the page does not load, make sure the hub's proxy host and port are reachable from your browser. You can configure `,h(`code`,{className:`font-mono`,children:`proxyHost`}),` in the Alexa addon settings and ensure the proxy port is published (Docker port mapping).`]}),d(`div`,{className:`flex items-center gap-2 text-[10px] text-foreground-subtle`,children:[h(S,{className:`h-3 w-3 animate-spin`}),`Waiting for Amazon login to complete…`]})]}),d(`div`,{className:`flex items-center justify-between gap-2 pt-1`,children:[h(`button`,{type:`button`,onClick:B?E:n,className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:B?`Cancel login`:`Back`}),d(`div`,{className:`flex items-center gap-2`,children:[z&&d(`button`,{type:`button`,onClick:D,className:`inline-flex items-center gap-1.5 rounded border border-border px-3 py-1.5 text-xs text-foreground hover:bg-primary/10`,children:[h(v,{className:`h-3.5 w-3.5`}),`Retry`]}),O&&h(`button`,{type:`button`,onClick:()=>{w()},disabled:e===void 0&&a.trim().length===0,className:`inline-flex items-center gap-1.5 rounded bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:`Start login`})]})]})]})}u();var B=`alexa`;function V(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.id==`string`):[]}function H(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.addonId==`string`&&Array.isArray(e.kinds)):[]}var U={connected:`bg-emerald-500/15 text-emerald-700 dark:text-emerald-300`,connecting:`bg-amber-500/15 text-amber-700 dark:text-amber-300`,disconnected:`bg-foreground-subtle/15 text-foreground-subtle`,"auth-failed":`bg-danger/15 text-danger`,unreachable:`bg-danger/15 text-danger`,error:`bg-danger/15 text-danger`};function W({kind:n,onResolved:r,onBack:a}){let[o,s]=m(n===B?`alexa-login`:`existing`),c=i({kind:n}),l=f(()=>V(c.data).filter(e=>e.kind===n),[c.data,n]),u=e(),p=f(()=>{for(let e of H(u.data))if(e.kinds.some(e=>e.kind===n))return e.addonId},[u.data,n]),[g,_]=m(null),[v,y]=m(``),b=t({}),C=()=>{g&&r(g)},w=async e=>{v.trim().length!==0&&r((await b.mutateAsync({kind:n,name:v.trim(),settings:e,...p===void 0?{}:{addonId:p}})).id)},T=e=>{e===`new`?_(null):b.reset(),s(e)};return d(`div`,{className:`space-y-4`,children:[d(`button`,{type:`button`,onClick:a,className:`inline-flex items-center gap-1 text-[11px] text-foreground-subtle hover:text-foreground`,children:[h(x,{className:`h-3.5 w-3.5`}),` Back`]}),d(`div`,{className:`inline-flex rounded-lg border border-border p-0.5 flex-wrap gap-0.5`,children:[n===B&&h(`button`,{type:`button`,onClick:()=>T(`alexa-login`),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${o===`alexa-login`?`bg-primary text-primary-foreground`:`text-foreground-subtle hover:text-foreground`}`,children:`Login interactively`}),h(`button`,{type:`button`,onClick:()=>T(`existing`),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${o===`existing`?`bg-primary text-primary-foreground`:`text-foreground-subtle hover:text-foreground`}`,children:`Use existing`}),h(`button`,{type:`button`,onClick:()=>T(`new`),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${o===`new`?`bg-primary text-primary-foreground`:`text-foreground-subtle hover:text-foreground`}`,children:n===B?`Paste cookie`:`Create new`})]}),o===`alexa-login`&&h(z,{onResolved:r,onCancel:a}),o===`existing`&&d(`div`,{className:`space-y-3`,children:[c.isLoading&&d(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[h(S,{className:`h-3.5 w-3.5 animate-spin`}),` Loading brokers…`]}),c.isError&&d(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:[`Failed to load brokers:`,` `,c.error instanceof Error?c.error.message:`Unknown error`]}),!c.isLoading&&!c.isError&&l.length===0&&d(`div`,{className:`rounded-lg border border-border bg-surface px-3 py-6 text-center text-xs text-foreground-subtle`,children:[`No brokers of this kind yet. Switch to`,` `,h(`span`,{className:`font-medium text-foreground`,children:n===B?`Login interactively`:`Create new`}),` `,`to register one.`]}),h(`div`,{className:`space-y-2`,children:l.map(e=>d(`button`,{type:`button`,onClick:()=>_(e.id),className:`flex w-full items-center justify-between gap-3 rounded-lg border bg-surface p-3 text-left transition-colors ${g===e.id?`border-primary ring-1 ring-primary`:`border-border hover:border-foreground-subtle/30`}`,children:[h(`span`,{className:`text-xs font-semibold text-foreground`,children:e.name}),h(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium ${U[e.status]}`,children:e.status})]},e.id))}),l.length>0&&h(`div`,{className:`flex justify-end pt-1`,children:h(`button`,{type:`button`,onClick:C,disabled:!g,className:`inline-flex items-center gap-1.5 rounded bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:`Use this broker`})})]}),o===`new`&&d(`div`,{className:`space-y-3`,children:[d(`div`,{className:`space-y-1`,children:[h(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Name`}),h(`input`,{type:`text`,value:v,onChange:e=>y(e.target.value),placeholder:`My Home Assistant`,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`})]}),b.isError&&h(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:b.error instanceof Error?b.error.message:String(b.error)}),h(D,{kind:n,...p===void 0?{}:{addonId:p},onSubmit:e=>{w(e).catch(()=>{})},onCancel:a,submitLabel:b.isPending?`Creating…`:`Create broker`,disabled:b.isPending||v.trim().length===0}),v.trim().length===0&&h(`p`,{className:`text-[10px] text-foreground-subtle`,children:`Enter a name before creating.`})]})]})}u();function G({open:e,onClose:t,scope:n}){let i=a(),[o,s]=m(new Set),[l,u]=m(new Set),{data:p}=r({}),g=f(()=>new Set((p??[]).map(e=>e.stableId)),[p]),v=c(async(e,t)=>{u(e=>new Set(e).add(t.stableId));try{await i.mutateAsync({addonId:e,candidate:t}),s(e=>new Set(e).add(t.stableId))}catch{}finally{u(e=>{let n=new Set(e);return n.delete(t.stableId),n})}},[i]),b=c((e,t)=>{let n=typeof t.prefilledConfig.host==`string`?t.prefilledConfig.host:null,r=g.has(t.stableId),i=o.has(t.stableId)||r,a=l.has(t.stableId);return d(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-surface px-3 py-2`,children:[d(`div`,{className:`min-w-0`,children:[h(`p`,{className:`truncate text-xs font-medium text-foreground`,children:t.suggestedName}),n&&h(`p`,{className:`truncate text-[10px] font-mono text-foreground-subtle`,children:n})]}),i?d(`span`,{className:`flex items-center gap-1 text-[11px] text-foreground-subtle`,children:[h(y,{className:`h-3.5 w-3.5`}),` `,r?`Already added`:`Added`]}):d(`button`,{type:`button`,onClick:()=>void v(e,t),disabled:a,className:`flex items-center gap-1 rounded-md bg-primary px-2.5 py-1 text-[11px] font-medium text-primary-foreground disabled:opacity-50`,children:[a?h(S,{className:`h-3.5 w-3.5 animate-spin`}):h(_,{className:`h-3.5 w-3.5`}),`Add`]})]},t.stableId)},[o,l,g,v]);if(!e)return null;let x=n?`Scan network — ${n.label}`:`Scan network for devices`;return d(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[h(`div`,{className:`absolute inset-0 bg-black/60`,onClick:t}),d(`div`,{className:`relative z-10 flex w-full max-w-2xl flex-col max-h-[90vh] rounded-xl border border-border bg-background shadow-2xl`,children:[d(`div`,{className:`flex items-center justify-between border-b border-border px-5 py-4 shrink-0`,children:[d(`div`,{className:`flex items-center gap-2`,children:[h(O,{className:`h-4 w-4 text-primary`}),h(`h2`,{className:`text-sm font-semibold text-foreground`,children:x})]}),h(`button`,{onClick:t,className:`rounded-md p-1 text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,children:h(w,{className:`h-4 w-4`})})]}),n?h(q,{scope:n,onAdopt:b,onReset:()=>s(new Set)}):h(K,{onAdopt:b,onReset:()=>s(new Set)})]})]})}function K({onAdopt:e,onReset:t}){let n=o(),r=c(()=>{t(),n.mutate({})},[n,t]);g(()=>{!n.isPending&&!n.data&&r()},[]);let i=f(()=>(n.data?.groups??[]).filter(e=>e.candidates.length>0),[n.data]),a=f(()=>i.reduce((e,t)=>e+t.candidates.length,0),[i]);return d(p,{children:[h(`div`,{className:`flex items-center justify-end gap-2 border-b border-border px-5 py-2 shrink-0`,children:d(`button`,{onClick:r,disabled:n.isPending,className:`flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50`,children:[h(v,{className:`h-3.5 w-3.5 ${n.isPending?`animate-spin`:``}`}),`Re-scan`]})}),d(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-5 py-4 space-y-4`,children:[n.isPending&&h(J,{label:`Scanning the local network…`}),!n.isPending&&n.isError&&h(Y,{}),!n.isPending&&n.data&&i.length===0&&h(`p`,{className:`py-8 text-center text-xs text-foreground-subtle`,children:`No devices responded to the scan.`}),!n.isPending&&i.length>0&&d(`p`,{className:`text-xs text-foreground-subtle`,children:[`Found `,a,` device`,a===1?``:`s`,` on the network.`]}),!n.isPending&&i.map(t=>d(`div`,{className:`space-y-1.5`,children:[d(`div`,{className:`flex items-center gap-2`,children:[h(`span`,{className:`text-[11px] font-semibold text-foreground`,children:t.label}),d(`span`,{className:`text-[10px] text-foreground-subtle`,children:[`(`,t.candidates.length,`)`]})]}),t.candidates.map(n=>e(t.addonId,n))]},t.addonId))]})]})}function q({scope:e,onAdopt:t,onReset:r}){let i=n({addonId:e.addonId}).data??null,[a,o]=m({}),l=s(),u=c(()=>{r(),l.mutate({addonId:e.addonId,params:a})},[l,e.addonId,a,r]),f=l.data?.candidates??[];return h(p,{children:d(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-5 py-4 space-y-4`,children:[i&&h(E,{schema:i,values:a,onChange:o}),d(`button`,{onClick:u,disabled:l.isPending,className:`flex items-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground disabled:opacity-50`,children:[l.isPending?h(S,{className:`h-3.5 w-3.5 animate-spin`}):h(O,{className:`h-3.5 w-3.5`}),l.isPending?`Scanning…`:`Scan`]}),l.isError&&h(Y,{}),!l.isPending&&l.data&&f.length===0&&h(`p`,{className:`py-6 text-center text-xs text-foreground-subtle`,children:`No devices responded to the scan.`}),!l.isPending&&f.length>0&&d(`div`,{className:`space-y-1.5`,children:[d(`p`,{className:`text-xs text-foreground-subtle`,children:[`Found `,f.length,` device`,f.length===1?``:`s`,`.`]}),f.map(n=>t(e.addonId,n))]})]})})}function J({label:e}){return d(`div`,{className:`flex flex-col items-center py-12`,children:[h(S,{className:`h-6 w-6 animate-spin text-primary`}),h(`p`,{className:`mt-3 text-xs text-foreground-subtle`,children:e})]})}function Y(){return d(`div`,{className:`flex items-start gap-3 rounded-lg border border-destructive/40 bg-destructive/10 px-4 py-3`,children:[h(T,{className:`h-4 w-4 text-destructive mt-0.5 shrink-0`}),h(`p`,{className:`text-xs text-destructive`,children:`The scan failed. Try again.`})]})}export{W as n,O as r,G as t};
@@ -1 +1 @@
1
- import{Lr as e}from"./src-B_-PRq3y.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-DTufy7Ue.js";import{p as r}from"./index-msAq9OfF.js";import{t as i}from"./AdminPage-BwmGKnRf.js";import{t as a}from"./NodeAddonsSettingsPanel-CynxbOEk.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};
1
+ import{Rr as e}from"./src-Bx1PCCWV.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-DTufy7Ue.js";import{p as r}from"./index-Cdp6OaKK.js";import{t as i}from"./AdminPage-BwmGKnRf.js";import{t as a}from"./NodeAddonsSettingsPanel-BQWXa7vq.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};
@@ -1 +1 @@
1
- import{Q as e,S as t,q 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-DTufy7Ue.js";import{t as i}from"./CapabilityBadges-Q2qm_QNP.js";import{t as a}from"./ProviderIcon-Bc8wWWqT.js";import{t as o}from"./StatusBadge-Dcr2bw58.js";import{t as s}from"./FormBuilder-vCzPEjPM.js";e();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[e,d]=n({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:e,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(e,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[e,t]=n(!0);return r(`button`,{type:`button`,role:`switch`,"aria-checked":e,onClick:()=>t(e=>!e),className:[`relative inline-flex h-4 w-8 shrink-0 items-center rounded-full transition-colors duration-150 cursor-pointer`,e?`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`,e?`translate-x-4`:`translate-x-0.5`].join(` `)})})}export{d as ShowroomPage};
1
+ import{Q as e,S as t,q 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-DTufy7Ue.js";import{t as i}from"./CapabilityBadges-DDSnGBgk.js";import{t as a}from"./ProviderIcon-Ba4DQXPs.js";import{t as o}from"./StatusBadge-Dcr2bw58.js";import{t as s}from"./FormBuilder-B69YBaq9.js";e();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[e,d]=n({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:e,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(e,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[e,t]=n(!0);return r(`button`,{type:`button`,role:`switch`,"aria-checked":e,onClick:()=>t(e=>!e),className:[`relative inline-flex h-4 w-8 shrink-0 items-center rounded-full transition-colors duration-150 cursor-pointer`,e?`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`,e?`translate-x-4`:`translate-x-0.5`].join(` `)})})}export{d as ShowroomPage};
@@ -1 +1 @@
1
- import"./virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-CmeeGMkM.js";import{t as e}from"./vite-preload-helper-zJ_50EbN.js";var t={"@camstack/sdk":async()=>await e(()=>import(`./dist-D9oUwgkq.js`),[]),"@camstack/types":async()=>await e(()=>import(`./dist-BpbjPYkI.js`),[]),"@camstack/ui-library":async()=>await e(()=>import(`./src-B_-PRq3y.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-DTufy7Ue.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-DkcC9IVF.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-DTufy7Ue.js`).then(e=>(e.et(),e.$)),[]),"react-dom":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.js-D9-wIasd.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-DstpX0yz.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-BBBrLLEa.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-DTufy7Ue.js`).then(e=>e.w),[])},n={"@camstack/sdk":{name:`@camstack/sdk`,version:`1.1.24`,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.1.24`}},"@camstack/types":{name:`@camstack/types`,version:`1.1.44`,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.1.44`}},"@camstack/ui-library":{name:`@camstack/ui-library`,version:`1.1.36`,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.1.36`}},"@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};
1
+ import"./virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BzCJlGIx.js";import{t as e}from"./vite-preload-helper-zJ_50EbN.js";var t={"@camstack/sdk":async()=>await e(()=>import(`./dist-BMrXztkM.js`),[]),"@camstack/types":async()=>await e(()=>import(`./dist-tu4iBgMD.js`),[]),"@camstack/ui-library":async()=>await e(()=>import(`./src-Bx1PCCWV.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-DTufy7Ue.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-DkcC9IVF.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-DTufy7Ue.js`).then(e=>(e.et(),e.$)),[]),"react-dom":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.js-D9-wIasd.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-DstpX0yz.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-BBBrLLEa.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-DTufy7Ue.js`).then(e=>e.w),[])},n={"@camstack/sdk":{name:`@camstack/sdk`,version:`1.1.25`,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.1.25`}},"@camstack/types":{name:`@camstack/types`,version:`1.1.46`,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.1.46`}},"@camstack/ui-library":{name:`@camstack/ui-library`,version:`1.1.37`,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.1.37`}},"@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};