@camstack/addon-admin-ui 1.2.367 → 1.2.368
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AddonAssetIcon-DpOYiFwy.js → AddonAssetIcon-DFj-ju1T.js} +1 -1
- package/dist/assets/{AddonIntegrationBody-DdNzzr-6.js → AddonIntegrationBody-FGAYdPUA.js} +1 -1
- package/dist/assets/{Addons-B0udTC2D.js → Addons-WwpkTbDd.js} +1 -1
- package/dist/assets/{AdminTabs-Bw0vLcQV.js → AdminTabs-DTp_qwRF.js} +1 -1
- package/dist/assets/{AiProfiles-DLiFaDiD.js → AiProfiles-CBco5ewR.js} +1 -1
- package/dist/assets/{BrokerForm-BOnoKZt-.js → BrokerForm-C1gCAO_i.js} +1 -1
- package/dist/assets/{Build-BJlvXVpa.js → Build-DurNKP8T.js} +1 -1
- package/dist/assets/{Calendars-CMaYwnFF.js → Calendars-CgpSaf57.js} +1 -1
- package/dist/assets/{Cluster-DLlURHMO.js → Cluster-DvhjeS7K.js} +1 -1
- package/dist/assets/ClusterStepModel-B6r5CyPs.js +1 -0
- package/dist/assets/{CompositionEditor-BGu7clTR.js → CompositionEditor-B72RWTAg.js} +1 -1
- package/dist/assets/{CompositionEditorPage-Lv4rlb7_.js → CompositionEditorPage-Czh4hLXm.js} +1 -1
- package/dist/assets/{Data-DF4tGpWD.js → Data-DXof6DOP.js} +1 -1
- package/dist/assets/{DetectionIntelligence-fSWafsKy.js → DetectionIntelligence-DOHtIjr_.js} +1 -1
- package/dist/assets/{DeviceDetail-nMeXPEtL.js → DeviceDetail-DJTOlefk.js} +1 -1
- package/dist/assets/{DeviceDoActionFields-DHRkE5xP.js → DeviceDoActionFields-CgcW2y34.js} +1 -1
- package/dist/assets/{Devices-DQBiqk6T.js → Devices-Dxdfsu2U.js} +1 -1
- package/dist/assets/{EmbedPlayerPage-C6S5WEa7.js → EmbedPlayerPage-DBDO4iGl.js} +1 -1
- package/dist/assets/{Events-CH3iXReO.js → Events-BfvAxlZU.js} +1 -1
- package/dist/assets/{Identity-CrnEnlEQ.js → Identity-CdNS5Nbo.js} +1 -1
- package/dist/assets/{IntegrationDetail-BLdUZANt.js → IntegrationDetail-v37t7dlu.js} +1 -1
- package/dist/assets/{Integrations-iPnsLoVn.js → Integrations-B46b2Fdt.js} +1 -1
- package/dist/assets/{Integrations-DIZiDn_B.js → Integrations-BhXxxG3u.js} +1 -1
- package/dist/assets/{Locations-CXQv36Yt.js → Locations-DS7U1LC0.js} +1 -1
- package/dist/assets/{Logs-DPwwQi8h.js → Logs-CEo_ltyB.js} +1 -1
- package/dist/assets/{MotionZonesSettings-CftAgxWi.js → MotionZonesSettings-CEgwXQs4.js} +1 -1
- package/dist/assets/{MyAccess-ZAW5kVD_.js → MyAccess-BPfDF0OL.js} +1 -1
- package/dist/assets/{Network-C6JvbIXt.js → Network-CsE6aS-2.js} +1 -1
- package/dist/assets/{NodeAddonsSettingsPanel-BiE-QIvS.js → NodeAddonsSettingsPanel-ud5IAMLM.js} +1 -1
- package/dist/assets/{Notifications-h9VuRiTF.js → Notifications-Dq9lhOuh.js} +1 -1
- package/dist/assets/{Plates-BvdnDkGc.js → Plates-DY7gAqtN.js} +1 -1
- package/dist/assets/{PrivacyMaskSettings-CUbD6k0L.js → PrivacyMaskSettings-3Qj6iJyr.js} +1 -1
- package/dist/assets/{Recordings-BdgobGao.js → Recordings-Cu6I48Ge.js} +1 -1
- package/dist/assets/{ScanNetworkModal-iiJJTylP.js → ScanNetworkModal-DeQVAhiv.js} +1 -1
- package/dist/assets/{SceneMonitorEditor-nRqgGlp2.js → SceneMonitorEditor-DLTybD7E.js} +1 -1
- package/dist/assets/{Scenes-DgqiTzk9.js → Scenes-yXnX2BEQ.js} +1 -1
- package/dist/assets/{SessionsList-Ba2Ozpmv.js → SessionsList-DTYAg11v.js} +1 -1
- package/dist/assets/{Showroom-iXUFZXmM.js → Showroom-DWPBOwhC.js} +1 -1
- package/dist/assets/{System-k1CqgwqI.js → System-B2dJPzzY.js} +1 -1
- package/dist/assets/{Terminal-Dv-j25I5.js → Terminal-Dw2mDFS9.js} +1 -1
- package/dist/assets/{Viewer-kmcfxFof.js → Viewer-BOmPgDRl.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-Ca2DwjVP.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DtaIXYDp.js} +1 -1
- package/dist/assets/{archive-C_-iEHhW.js → archive-6pzbE4zL.js} +1 -1
- package/dist/assets/{authed-media-rH30orNX.js → authed-media-dlxPHLGt.js} +1 -1
- package/dist/assets/{boxes-Cj3enrG0.js → boxes-B9mRSNXT.js} +1 -1
- package/dist/assets/circle-slash-D3OU4sq-.js +1 -0
- package/dist/assets/client-DdTCFotl.js +357 -0
- package/dist/assets/crop-C4_qNtVc.js +1 -0
- package/dist/assets/{debounced-invalidate-CUPcL0rQ.js → debounced-invalidate-CjvnQ6zt.js} +1 -1
- package/dist/assets/{device-integration-icon-CjpZldgd.js → device-integration-icon-BRBO6DaZ.js} +1 -1
- package/dist/assets/device-picker-model-DOwpVM5h.js +1 -0
- package/dist/assets/{dist-B3-nKFP1.js → dist-BPTn9PvV.js} +1 -1
- package/dist/assets/dist-CJxcey0N.js +357 -0
- package/dist/assets/{face-bbox-CqIiQdVy.js → face-bbox-CPsQ49nP.js} +1 -1
- package/dist/assets/{hard-drive-download-B1qrAMQ7.js → hard-drive-download-CUKF7GIe.js} +1 -1
- package/dist/assets/{history-Ixgo2o2a.js → history-BR0cgtxK.js} +1 -1
- package/dist/assets/{hostInit-Cgl65BZF.js → hostInit-D7PExcI5.js} +1 -1
- package/dist/assets/{index-Bq3Mrl-l.js → index-BhXNFlQG.js} +3 -3
- package/dist/assets/{layers-JboEX-t3.js → layers-BEphtFOD.js} +1 -1
- package/dist/assets/{location-owned-usage-DAWlSLDx.js → location-owned-usage-BHS4BUrZ.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-5f4030f8.js → mf-entry-bootstrap-0-f35db814.js} +2 -2
- package/dist/assets/{monitor-smartphone-DEvaCEpt.js → monitor-smartphone-DbkPiYT_.js} +1 -1
- package/dist/assets/mount-DOwpVM5h.js +1 -0
- package/dist/assets/{notification-schedule-field-mbJZiR_t.js → notification-schedule-field-DQOVzLdk.js} +1 -1
- package/dist/assets/{octagon-alert-CQuofVwc.js → octagon-alert-DI2r29y1.js} +1 -1
- package/dist/assets/{player-overlays-OREckyXS.js → player-overlays-CVsVEZkx.js} +1 -1
- package/dist/assets/remoteEntry-8sPAjus8.js +1 -0
- package/dist/assets/{send-CuHij6pJ.js → send-CsS0XJlB.js} +1 -1
- package/dist/assets/{settings-2-BQZcFYTR.js → settings-2-CyVUMXY7.js} +1 -1
- package/dist/assets/{src-CEnvJotZ.js → src-DBOD88Il.js} +3 -3
- package/dist/assets/{use-scenes-feed-1Od0TZaA.js → use-scenes-feed-B3khNWlP.js} +1 -1
- package/dist/assets/{use-stationary-objects-DqVVD1DW.js → use-stationary-objects-DONRHYCH.js} +1 -1
- package/dist/assets/useEventInvalidation-DOwpVM5h.js +1 -0
- package/dist/assets/{useNodeUrlSelection-C3vDpTz0.js → useNodeUrlSelection-CqbePEmt.js} +1 -1
- package/dist/assets/user-round-DIYdKGlH.js +1 -0
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-CjZzajvR.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-Cns_eCdr.js} +2 -2
- package/dist/index.html +7 -7
- package/dist/server/addon.js +13 -2
- package/package.json +1 -1
- package/dist/assets/ClusterStepModel-DUqB59eQ.js +0 -1
- package/dist/assets/circle-slash-B9leNw8c.js +0 -1
- package/dist/assets/client-1c3e-nOc.js +0 -357
- package/dist/assets/crop-Cz85GIsX.js +0 -1
- package/dist/assets/device-picker-model-qjRcMIFg.js +0 -1
- package/dist/assets/dist-Dp0Vbww8.js +0 -357
- package/dist/assets/mount-qjRcMIFg.js +0 -1
- package/dist/assets/remoteEntry-DAkePvGv.js +0 -1
- package/dist/assets/useEventInvalidation-qjRcMIFg.js +0 -1
- package/dist/assets/user-round-BmFyUIzE.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{I as e,K as t,Q as n,S as r,W as i,b as a,q as o,x as s,z as c}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{G as l,H as u,R as d,W as f,Z as p,_t as m,at as h,c as g,d as ee,f as _,ft as v,l as te,lt as y,p as b,q as ne,s as re,st as x}from"./player-overlays-OREckyXS.js";import{t as S}from"./settings-2-BQZcFYTR.js";import{MaskShapeCanvas as C}from"./MaskShapeCanvas-Dcpby34M.js";n();var w=p(`/addon/pipeline-analytics/event-media`);function T(e){return`${w}/m/${e}`}function E(e){let t=new Map;for(let n of e.states)n.references.forEach((e,r)=>{let i=t.get(e.condition)??[];i.push({stateId:n.id,index:r,reference:e}),t.set(e.condition,i)});return[...t.entries()].map(([e,t])=>({condition:e,tiles:[...t].sort((e,t)=>t.reference.capturedAt-e.reference.capturedAt)})).sort((e,t)=>e.condition.localeCompare(t.condition))}function D(e){return e.states.reduce((e,t)=>e+t.references.length,0)}var O=`rounded border border-danger/50 bg-danger/10 px-1 py-0.5 text-[10px] font-medium text-danger hover:bg-danger/20 disabled:opacity-40 transition-colors`;function k({monitor:e,disabled:t,onDelete:n}){let i=E(e),a=D(e),[c,l]=o(null);return i.length===0?s(`p`,{className:`${d} leading-relaxed`,children:`No photographs captured yet. Press “Capture daylight” to take the one this scene will judge everything against.`}):s(`div`,{className:`flex flex-col gap-2`,children:i.map(e=>r(`div`,{className:`flex flex-col gap-1`,children:[r(`p`,{className:`text-[10px] font-semibold uppercase tracking-wide text-foreground-subtle`,children:[b(e.condition),` · `,e.tiles.length]}),s(`ul`,{className:`flex flex-wrap gap-1.5`,children:e.tiles.map(i=>{let o=`${i.stateId}:${String(i.index)}`,u=a===1,f=c===o;return r(`li`,{className:`flex w-24 flex-col gap-1 rounded-md border border-border p-1`,children:[s(A,{reference:i.reference}),s(`span`,{className:`${d} tabular-nums`,children:j(i.reference.capturedAt)}),r(`button`,{type:`button`,className:O,disabled:t,"aria-label":`Delete the ${b(e.condition).toLowerCase()} photograph from ${j(i.reference.capturedAt)}`,onClick:()=>{if(u&&!f){l(o);return}l(null),n({stateId:i.stateId,index:i.index})},children:[s(x,{className:`mr-1 inline h-3 w-3`}),f?`Confirm`:`Delete`]}),f&&s(`p`,{className:`text-[10px] leading-snug text-warning`,children:`This is the only photograph this scene has. Delete it and the scene no longer knows what normal looks like — it stops judging until you capture again.`})]},o)})})]},e.condition))})}function A({reference:e}){let[t,n]=o(!1),i=e.thumbnailMediaId;return i===void 0||t?r(`div`,{className:`flex h-16 w-full flex-col items-center justify-center gap-0.5 rounded bg-surface text-foreground-subtle`,title:`The picture for this reference is no longer stored. The reference itself is intact and still being scored against.`,children:[s(v,{className:`h-4 w-4`}),s(`span`,{className:`text-[9px]`,children:`no picture`})]}):s(`img`,{src:T(i),alt:``,loading:`lazy`,className:`h-16 w-full rounded object-cover`,onError:()=>n(!0)})}function j(e){let t=new Date(e);return`${t.toLocaleDateString()} ${t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}`}n();var M=`rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground focus:border-primary focus:outline-none disabled:opacity-50`,N=`text-[10px] font-medium text-foreground-subtle`,P=`flex flex-col gap-2 rounded-md border border-border bg-surface/40 p-2`,F=`text-[10px] font-semibold uppercase tracking-wide text-foreground-subtle`,I=5,L=3600,R={periodic:`Only on the clock. Predictable, and it notices a change even on a camera nothing ever moves in front of.`,"on-motion":`Only after the camera has been still again for the quiet window below. Cheapest, but a change nobody walks past is never seen.`,both:`Both — the clock is the safety net that lets the motion path miss. This is the right answer for almost every scene.`},z={skip:`Sit that light out. No verdict, no alarm, no flag touched — it picks itself back up when a light it knows returns. This is why the night capture is optional.`,"judge-anyway":`Compare against the references you do have. Only correct when the two lights genuinely look alike (a floodlit driveway, an indoor lamp) — against a real infrared frame it will report a change that did not happen.`};function B(e){return{label:e.label,checkIntervalSec:e.checkIntervalSec??60,threshold:e.check.mode===`similarity`?e.check.threshold:.8,hysteresisCount:e.check.hysteresisCount,quietSeconds:e.quietSeconds,minObservationSpacingSec:e.minObservationSpacingSec,confirmPrompt:e.confirm?.prompt??``}}function ie({monitor:e,disabled:t,onPatch:n}){let[i,l]=o(()=>B(e)),[u,f]=o(!1);c(()=>{u||l(B(e))},[e,u]);let p=e=>{f(!1),n(e)},m=t=>e.check.mode===`similarity`?{mode:`similarity`,threshold:t.threshold??e.check.threshold,hysteresisCount:t.hysteresisCount??e.check.hysteresisCount}:{...e.check,hysteresisCount:t.hysteresisCount??e.check.hysteresisCount},h=e.confirm?.enabled===!0,g=e.check.mode===`similarity`?e.check.threshold:null;return r(`div`,{className:`flex flex-col gap-2`,children:[r(`div`,{className:P,children:[s(`p`,{className:F,children:`What it watches`}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`Name`}),s(`input`,{type:`text`,value:i.label,disabled:t,className:M,onFocus:()=>f(!0),onChange:e=>l(t=>({...t,label:e.target.value})),onBlur:()=>{let t=i.label.trim();t.length>0&&t!==e.label?p({label:t}):f(!1)}})]}),r(`label`,{className:`flex items-center gap-2`,children:[s(`input`,{type:`checkbox`,checked:e.enabled,disabled:t,onChange:e=>p({enabled:e.target.checked})}),s(`span`,{className:N,children:`Watching`})]}),s(`p`,{className:d,children:`Turned off, the scene keeps its region, its references and its flag — it simply stops checking. Nothing is lost by pausing one for a while.`}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`When to look`}),r(`select`,{value:e.triggerMode,disabled:t,className:M,onChange:e=>{let t=e.target.value;(t===`periodic`||t===`on-motion`||t===`both`)&&p({triggerMode:t})},children:[s(`option`,{value:`both`,children:`On the clock and after motion settles`}),s(`option`,{value:`periodic`,children:`On the clock only`}),s(`option`,{value:`on-motion`,children:`After motion settles only`})]})]}),s(`p`,{className:d,children:R[e.triggerMode]}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`Check every (seconds)`}),s(`input`,{type:`number`,min:I,max:L,value:i.checkIntervalSec,disabled:t,className:M,onFocus:()=>f(!0),onChange:e=>l(t=>({...t,checkIntervalSec:Number(e.target.value)||0})),onBlur:()=>{let t=V(i.checkIntervalSec,I,L);t===e.checkIntervalSec?f(!1):p({checkIntervalSec:t})}})]}),s(`p`,{className:d,children:`60 s suits “is the bin still out”. Every check costs one photograph and one encode, so going below about 30 s buys latency you almost never need and multiplies the cost by the number of scenes you own.`})]}),r(`div`,{className:P,children:[s(`p`,{className:F,children:`How sure it has to be`}),e.check.mode===`similarity`&&r(a,{children:[r(`label`,{className:`flex flex-col gap-1`,children:[r(`span`,{className:N,children:[`Match threshold — `,s(`span`,{className:`tabular-nums`,children:i.threshold.toFixed(2)})]}),s(`input`,{type:`range`,min:.3,max:.99,step:.01,value:i.threshold,disabled:t,onFocus:()=>f(!0),onChange:e=>l(t=>({...t,threshold:Number(e.target.value)})),onMouseUp:()=>{i.threshold===g?f(!1):p({check:m({threshold:i.threshold})})},onBlur:()=>{i.threshold===g?f(!1):p({check:m({threshold:i.threshold})})}})]}),s(`p`,{className:`text-[10px] text-foreground-subtle`,children:`How closely the region still has to resemble the photograph to count as unchanged. Higher means fussier: at 0.95 a passing cloud can read as a change; at 0.60 the bin can be taken and the scene will shrug. 0.80 is a sensible start — if it cries wolf, lower it; if it misses the thing you care about, raise it.`})]}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`Agreeing checks before it changes its mind`}),s(`input`,{type:`number`,min:1,max:10,value:i.hysteresisCount,disabled:t,className:M,onFocus:()=>f(!0),onChange:e=>l(t=>({...t,hysteresisCount:Number(e.target.value)||1})),onBlur:()=>{let t=V(i.hysteresisCount,1,10);t===e.check.hysteresisCount?f(!1):p({check:m({hysteresisCount:t})})}})]}),s(`p`,{className:d,children:`One bad photograph must never be able to flip a scene. 3 agreeing checks at 60 s is about four minutes of latency and is what makes the answer trustworthy — leaving a state costs exactly the same as entering one.`}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`Quiet for (seconds) before a check counts`}),s(`input`,{type:`number`,min:0,max:3600,value:i.quietSeconds,disabled:t,className:M,onFocus:()=>f(!0),onChange:e=>l(t=>({...t,quietSeconds:Number(e.target.value)||0})),onBlur:()=>{let t=V(i.quietSeconds,0,3600);t===e.quietSeconds?f(!1):p({quietSeconds:t})}})]}),s(`p`,{className:d,children:`A check taken while something is moving is a photograph of the van parked in front of the bin, so it is discarded rather than merely delayed. 0 disables the gate.`}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`Minimum gap between counted checks (seconds)`}),s(`input`,{type:`number`,min:0,max:3600,value:i.minObservationSpacingSec,disabled:t,className:M,onFocus:()=>f(!0),onChange:e=>l(t=>({...t,minObservationSpacingSec:Number(e.target.value)||0})),onBlur:()=>{let t=V(i.minObservationSpacingSec,0,3600);t===e.minObservationSpacingSec?f(!1):p({minObservationSpacingSec:t})}})]}),s(`p`,{className:d,children:`Spreads the agreeing checks over real time instead of letting three adjacent polls inside one long occlusion be mistaken for three independent opinions.`})]}),r(`div`,{className:P,children:[s(`p`,{className:F,children:`Lighting`}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`When a light has no reference of its own`}),r(`select`,{value:e.onUncoveredCondition,disabled:t,className:M,onChange:e=>{let t=e.target.value;(t===`skip`||t===`judge-anyway`)&&p({onUncoveredCondition:t})},children:[s(`option`,{value:`skip`,children:`Skip the check (recommended)`}),s(`option`,{value:`judge-anyway`,children:`Judge against the other light anyway`})]})]}),s(`p`,{className:d,children:z[e.onUncoveredCondition]})]}),r(`div`,{className:P,children:[s(`p`,{className:F,children:`What you get told`}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`Notifications follow`}),r(`select`,{value:e.emit,disabled:t,className:M,onChange:e=>{let t=e.target.value;(t===`latched`||t===`live`)&&p({emit:t})},children:[s(`option`,{value:`latched`,children:`The flag — told once, still visible at breakfast`}),s(`option`,{value:`live`,children:`The live state — follows the region as it changes`})]})]}),s(`p`,{className:d,children:`“Is the bin gone” is a flag: you want to be told once and still see it later. “Is the gate open” is a live state.`}),r(`label`,{className:`flex items-center gap-2`,children:[s(`input`,{type:`checkbox`,checked:e.autoRestore,disabled:t,onChange:e=>p({autoRestore:e.target.checked})}),s(`span`,{className:N,children:`Clear the flag by itself when things look normal again`})]}),s(`p`,{className:d,children:`Off by default, so an alarm never silently clears itself. The “back to normal” moment is recorded either way, so an automation can still react to it.`})]}),r(`div`,{className:P,children:[s(`p`,{className:F,children:`AI double-check`}),r(`label`,{className:`flex items-center gap-2`,children:[s(`input`,{type:`checkbox`,checked:h,disabled:t||i.confirmPrompt.trim().length===0,onChange:e=>p(e.target.checked?{confirm:{...H(i.confirmPrompt.trim()),enabled:!0}}:{confirm:null})}),s(`span`,{className:N,children:`Ask a vision model before changing the answer`})]}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`The question to ask`}),s(`input`,{type:`text`,value:i.confirmPrompt,placeholder:`e.g. Is the wheelie bin still there?`,disabled:t,className:M,onFocus:()=>f(!0),onChange:e=>l(t=>({...t,confirmPrompt:e.target.value})),onBlur:()=>{let t=i.confirmPrompt.trim();t.length>0&&t!==e.confirm?.prompt?p({confirm:{...H(t),enabled:h}}):f(!1)}})]}),r(`p`,{className:d,children:[`The model is asked `,s(`strong`,{children:`only`}),` when the region has already changed enough to flip the answer — roughly twice a week for a bin, not once a minute. It reasons about the object rather than the pixels, so rain, shadows and a repositioned bin stop counting as the thing being taken. If it cannot be reached, the change is held rather than announced.`]})]})]})}function V(e,t,n){return Math.min(n,Math.max(t,e))}function H(e){return{enabled:!1,prompt:e,timeoutMs:8e3,maxImagePx:448,onTimeout:`hold`}}n();var U=`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`,W=`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`,G=`rounded-md border border-danger/50 bg-danger/10 px-2 py-1 text-[11px] font-medium text-danger hover:bg-danger/20 disabled:opacity-40 transition-colors`,K={alarm:`border-danger/50 bg-danger/15 text-danger`,ok:`border-success/50 bg-success/15 text-success`,unknown:`border-border bg-surface text-foreground-subtle`},q=.8,J=3;function Y({deviceId:n}){let p=l(h().trpcClient,n),v=ne(p?.state.sceneMonitor),w=f(n,{width:640}),[T,E]=o(null),[D,O]=o(!1),[A,j]=o(null),[M,N]=o(null),[P,F]=o(null),[I,L]=o(null),[R,z]=o(!1),[B,V]=o(null),[H,Y]=o(``),X=t(!0);c(()=>(X.current=!0,()=>{X.current=!1}),[]);let Z=e(async()=>{if(p)try{let e=await p.sceneMonitor?.listScenes({});if(!X.current)return;e&&E(e)}catch(e){if(!X.current)return;u(e)?O(!0):N(e instanceof Error?e.message:String(e))}},[p]);c(()=>{E(null),O(!1),N(null),Z()},[Z]);let Q=v?.monitors??T?.monitors??[],ae=Date.now(),$=e(async(e,t)=>{j(e),N(null);try{await t(),await Z()}catch(e){X.current&&N(e instanceof Error?e.message:String(e))}finally{X.current&&j(null)}},[Z]),oe=i(()=>{let e=Q.map(e=>({id:e.id,shape:e.roi,label:e.label,enabled:e.enabled}));return B===null?e:[...e,{id:`__draft__`,shape:B,label:`New scene`}]},[Q,B]),se=e((e,t)=>{if(t.kind===`rect`){if(e===`__draft__`){V(t);return}$(`roi-${String(e)}`,async()=>p?.sceneMonitor?.updateScene({monitorId:String(e),patch:{roi:t}}))}},[p,$]),ce=e(e=>{e.kind===`rect`&&V(e)},[]),le=e(async()=>{B===null||H.trim().length===0||(await $(`create`,async()=>{await p?.sceneMonitor?.createScene({label:H.trim(),roi:B,check:{mode:`similarity`,threshold:q,hysteresisCount:J}})}),V(null),Y(``),z(!1))},[p,B,H,$]);return p?s(`div`,{className:`flex flex-col gap-3`,children:D?s(`p`,{className:`${d} leading-relaxed`,children:`Scene monitoring is not available for this camera.`}):r(a,{children:[s(`p`,{className:`${d} leading-relaxed`,children:`A scene watches one region of this camera and tells you when it stops looking like the picture you captured. Draw a box around the thing you care about — a wheelie bin, a gate, a parking space — then capture what “normal” looks like. Daylight is enough to start: the night reference is optional, and without it the scene simply sits the infrared hours out instead of reporting a problem.`}),s(`div`,{className:`relative overflow-hidden rounded-md border border-border`,children:s(C,{items:oe,supportedShapes:[`rect`],selectedId:P??(B===null?null:`__draft__`),onSelect:e=>F(e===null?null:String(e)),onShapeChange:se,onDrawComplete:ce,drawingKind:R&&B===null?`rect`:null,backdrop:w.src===null?null:s(`img`,{src:w.src,alt:``,className:`h-full w-full object-contain`,draggable:!1})})}),r(`div`,{className:`flex flex-wrap items-center gap-2`,children:[s(`button`,{type:`button`,className:R?W:U,"aria-pressed":R,onClick:()=>{z(e=>!e),V(null)},disabled:A!==null,children:R?`Cancel`:`+ New scene`}),s(`button`,{type:`button`,className:U,onClick:w.refresh,disabled:A!==null,children:`Refresh frame`})]}),R&&r(`div`,{className:`flex flex-col gap-2 rounded-md border border-border bg-surface p-2`,children:[s(`p`,{className:`text-[10px] text-foreground-subtle`,children:B===null?`Click on the frame to drop a box, then drag its corner to fit it around the thing you want watched.`:`Name it, then create. You capture what “normal” looks like next.`}),B!==null&&ee(B)&&s(`p`,{className:`text-[11px] leading-relaxed text-warning`,children:`That box covers most of the frame. A scene that big is dominated by the weather, the sky and passing cars — it will quietly stop noticing the thing you actually care about. Draw it tighter.`}),r(`div`,{className:`flex items-center gap-2`,children:[s(`input`,{type:`text`,value:H,onChange:e=>Y(e.target.value),placeholder:`e.g. Immondizia prelevata`,className:`flex-1 rounded-md border border-border bg-surface px-2 py-1 text-[12px] text-foreground`}),s(`button`,{type:`button`,className:W,onClick:()=>void le(),disabled:B===null||H.trim().length===0||A!==null,children:`Create`})]})]}),M!==null&&s(`p`,{className:`text-[11px] leading-relaxed text-danger`,children:M}),Q.length===0?s(`p`,{className:`${d} leading-relaxed`,children:`No scenes on this camera yet.`}):s(`ul`,{className:`flex flex-col gap-2`,children:Q.map(e=>{let t=g(e);return r(`li`,{className:`flex flex-col gap-1.5 rounded-md border p-2 ${P===e.id?`border-primary/50`:`border-border`}`,children:[r(`div`,{className:`flex items-center gap-2`,children:[s(`button`,{type:`button`,className:`flex-1 text-left text-[12px] font-medium text-foreground`,onClick:()=>F(e.id),children:e.label}),s(`span`,{className:`rounded border px-1.5 py-0.5 text-[10px] font-medium ${K[t.tone]}`,children:t.text})]}),s(`p`,{className:`${d} leading-relaxed`,children:_(e,ae)}),s(`p`,{className:`${d} tabular-nums`,children:te(e)}),s(k,{monitor:e,disabled:A!==null,onDelete:({stateId:t,index:n})=>void $(`refdel-${e.id}-${t}-${String(n)}`,async()=>p.sceneMonitor?.deleteReference({monitorId:e.id,stateId:t,index:n}))}),r(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[re.map(t=>{let n=t===`ir`;return r(`button`,{type:`button`,className:U,disabled:A!==null,title:n?`Optional. Without a night reference the checks in infrared are simply skipped — the scene keeps working in daylight and nothing is reported as broken.`:`Take a fresh photo now and store it as the ${b(t).toLowerCase()} reference`,onClick:()=>void $(`cap-${e.id}-${t}`,async()=>p.sceneMonitor?.captureReference({monitorId:e.id,condition:t})),children:[s(m,{className:`mr-1 inline h-3 w-3`}),`Capture `,b(t).toLowerCase(),n&&s(`span`,{className:`ml-1 text-foreground-subtle/70`,children:`(optional)`})]},t)}),r(`button`,{type:`button`,className:W,disabled:A!==null||e.states.length===0,title:`Clear the flag and re-photograph what normal looks like right now`,onClick:()=>void $(`reset-${e.id}`,async()=>p.sceneMonitor?.resetScene({monitorId:e.id})),children:[s(y,{className:`mr-1 inline h-3 w-3`}),`Reset`]}),s(`button`,{type:`button`,className:U,disabled:A!==null,onClick:()=>void $(`check-${e.id}`,async()=>p.sceneMonitor?.recheckNow({monitorId:e.id})),children:`Check now`}),r(`button`,{type:`button`,className:I===e.id?W:U,"aria-pressed":I===e.id,"aria-label":`Settings for ${e.label}`,disabled:A!==null,onClick:()=>L(t=>t===e.id?null:e.id),children:[s(S,{className:`mr-1 inline h-3 w-3`}),`Settings`]}),s(`button`,{type:`button`,className:G,disabled:A!==null,onClick:()=>void $(`del-${e.id}`,async()=>p.sceneMonitor?.deleteScene({monitorId:e.id})),children:s(x,{className:`h-3 w-3`})})]}),I===e.id&&s(ie,{monitor:e,disabled:A!==null,onPatch:t=>void $(`tune-${e.id}`,async()=>p.sceneMonitor?.updateScene({monitorId:e.id,patch:t}))})]},e.id)})})]})}):null}export{Y as SceneMonitorEditor};
|
|
1
|
+
import{I as e,K as t,Q as n,S as r,W as i,b as a,q as o,x as s,z as c}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{G as l,H as u,R as d,W as f,Z as p,_t as m,at as h,c as g,d as ee,f as _,ft as v,l as te,lt as y,p as b,q as ne,s as re,st as x}from"./player-overlays-CVsVEZkx.js";import{t as S}from"./settings-2-CyVUMXY7.js";import{MaskShapeCanvas as C}from"./MaskShapeCanvas-Dcpby34M.js";n();var w=p(`/addon/pipeline-analytics/event-media`);function T(e){return`${w}/m/${e}`}function E(e){let t=new Map;for(let n of e.states)n.references.forEach((e,r)=>{let i=t.get(e.condition)??[];i.push({stateId:n.id,index:r,reference:e}),t.set(e.condition,i)});return[...t.entries()].map(([e,t])=>({condition:e,tiles:[...t].sort((e,t)=>t.reference.capturedAt-e.reference.capturedAt)})).sort((e,t)=>e.condition.localeCompare(t.condition))}function D(e){return e.states.reduce((e,t)=>e+t.references.length,0)}var O=`rounded border border-danger/50 bg-danger/10 px-1 py-0.5 text-[10px] font-medium text-danger hover:bg-danger/20 disabled:opacity-40 transition-colors`;function k({monitor:e,disabled:t,onDelete:n}){let i=E(e),a=D(e),[c,l]=o(null);return i.length===0?s(`p`,{className:`${d} leading-relaxed`,children:`No photographs captured yet. Press “Capture daylight” to take the one this scene will judge everything against.`}):s(`div`,{className:`flex flex-col gap-2`,children:i.map(e=>r(`div`,{className:`flex flex-col gap-1`,children:[r(`p`,{className:`text-[10px] font-semibold uppercase tracking-wide text-foreground-subtle`,children:[b(e.condition),` · `,e.tiles.length]}),s(`ul`,{className:`flex flex-wrap gap-1.5`,children:e.tiles.map(i=>{let o=`${i.stateId}:${String(i.index)}`,u=a===1,f=c===o;return r(`li`,{className:`flex w-24 flex-col gap-1 rounded-md border border-border p-1`,children:[s(A,{reference:i.reference}),s(`span`,{className:`${d} tabular-nums`,children:j(i.reference.capturedAt)}),r(`button`,{type:`button`,className:O,disabled:t,"aria-label":`Delete the ${b(e.condition).toLowerCase()} photograph from ${j(i.reference.capturedAt)}`,onClick:()=>{if(u&&!f){l(o);return}l(null),n({stateId:i.stateId,index:i.index})},children:[s(x,{className:`mr-1 inline h-3 w-3`}),f?`Confirm`:`Delete`]}),f&&s(`p`,{className:`text-[10px] leading-snug text-warning`,children:`This is the only photograph this scene has. Delete it and the scene no longer knows what normal looks like — it stops judging until you capture again.`})]},o)})})]},e.condition))})}function A({reference:e}){let[t,n]=o(!1),i=e.thumbnailMediaId;return i===void 0||t?r(`div`,{className:`flex h-16 w-full flex-col items-center justify-center gap-0.5 rounded bg-surface text-foreground-subtle`,title:`The picture for this reference is no longer stored. The reference itself is intact and still being scored against.`,children:[s(v,{className:`h-4 w-4`}),s(`span`,{className:`text-[9px]`,children:`no picture`})]}):s(`img`,{src:T(i),alt:``,loading:`lazy`,className:`h-16 w-full rounded object-cover`,onError:()=>n(!0)})}function j(e){let t=new Date(e);return`${t.toLocaleDateString()} ${t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}`}n();var M=`rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground focus:border-primary focus:outline-none disabled:opacity-50`,N=`text-[10px] font-medium text-foreground-subtle`,P=`flex flex-col gap-2 rounded-md border border-border bg-surface/40 p-2`,F=`text-[10px] font-semibold uppercase tracking-wide text-foreground-subtle`,I=5,L=3600,R={periodic:`Only on the clock. Predictable, and it notices a change even on a camera nothing ever moves in front of.`,"on-motion":`Only after the camera has been still again for the quiet window below. Cheapest, but a change nobody walks past is never seen.`,both:`Both — the clock is the safety net that lets the motion path miss. This is the right answer for almost every scene.`},z={skip:`Sit that light out. No verdict, no alarm, no flag touched — it picks itself back up when a light it knows returns. This is why the night capture is optional.`,"judge-anyway":`Compare against the references you do have. Only correct when the two lights genuinely look alike (a floodlit driveway, an indoor lamp) — against a real infrared frame it will report a change that did not happen.`};function B(e){return{label:e.label,checkIntervalSec:e.checkIntervalSec??60,threshold:e.check.mode===`similarity`?e.check.threshold:.8,hysteresisCount:e.check.hysteresisCount,quietSeconds:e.quietSeconds,minObservationSpacingSec:e.minObservationSpacingSec,confirmPrompt:e.confirm?.prompt??``}}function ie({monitor:e,disabled:t,onPatch:n}){let[i,l]=o(()=>B(e)),[u,f]=o(!1);c(()=>{u||l(B(e))},[e,u]);let p=e=>{f(!1),n(e)},m=t=>e.check.mode===`similarity`?{mode:`similarity`,threshold:t.threshold??e.check.threshold,hysteresisCount:t.hysteresisCount??e.check.hysteresisCount}:{...e.check,hysteresisCount:t.hysteresisCount??e.check.hysteresisCount},h=e.confirm?.enabled===!0,g=e.check.mode===`similarity`?e.check.threshold:null;return r(`div`,{className:`flex flex-col gap-2`,children:[r(`div`,{className:P,children:[s(`p`,{className:F,children:`What it watches`}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`Name`}),s(`input`,{type:`text`,value:i.label,disabled:t,className:M,onFocus:()=>f(!0),onChange:e=>l(t=>({...t,label:e.target.value})),onBlur:()=>{let t=i.label.trim();t.length>0&&t!==e.label?p({label:t}):f(!1)}})]}),r(`label`,{className:`flex items-center gap-2`,children:[s(`input`,{type:`checkbox`,checked:e.enabled,disabled:t,onChange:e=>p({enabled:e.target.checked})}),s(`span`,{className:N,children:`Watching`})]}),s(`p`,{className:d,children:`Turned off, the scene keeps its region, its references and its flag — it simply stops checking. Nothing is lost by pausing one for a while.`}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`When to look`}),r(`select`,{value:e.triggerMode,disabled:t,className:M,onChange:e=>{let t=e.target.value;(t===`periodic`||t===`on-motion`||t===`both`)&&p({triggerMode:t})},children:[s(`option`,{value:`both`,children:`On the clock and after motion settles`}),s(`option`,{value:`periodic`,children:`On the clock only`}),s(`option`,{value:`on-motion`,children:`After motion settles only`})]})]}),s(`p`,{className:d,children:R[e.triggerMode]}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`Check every (seconds)`}),s(`input`,{type:`number`,min:I,max:L,value:i.checkIntervalSec,disabled:t,className:M,onFocus:()=>f(!0),onChange:e=>l(t=>({...t,checkIntervalSec:Number(e.target.value)||0})),onBlur:()=>{let t=V(i.checkIntervalSec,I,L);t===e.checkIntervalSec?f(!1):p({checkIntervalSec:t})}})]}),s(`p`,{className:d,children:`60 s suits “is the bin still out”. Every check costs one photograph and one encode, so going below about 30 s buys latency you almost never need and multiplies the cost by the number of scenes you own.`})]}),r(`div`,{className:P,children:[s(`p`,{className:F,children:`How sure it has to be`}),e.check.mode===`similarity`&&r(a,{children:[r(`label`,{className:`flex flex-col gap-1`,children:[r(`span`,{className:N,children:[`Match threshold — `,s(`span`,{className:`tabular-nums`,children:i.threshold.toFixed(2)})]}),s(`input`,{type:`range`,min:.3,max:.99,step:.01,value:i.threshold,disabled:t,onFocus:()=>f(!0),onChange:e=>l(t=>({...t,threshold:Number(e.target.value)})),onMouseUp:()=>{i.threshold===g?f(!1):p({check:m({threshold:i.threshold})})},onBlur:()=>{i.threshold===g?f(!1):p({check:m({threshold:i.threshold})})}})]}),s(`p`,{className:`text-[10px] text-foreground-subtle`,children:`How closely the region still has to resemble the photograph to count as unchanged. Higher means fussier: at 0.95 a passing cloud can read as a change; at 0.60 the bin can be taken and the scene will shrug. 0.80 is a sensible start — if it cries wolf, lower it; if it misses the thing you care about, raise it.`})]}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`Agreeing checks before it changes its mind`}),s(`input`,{type:`number`,min:1,max:10,value:i.hysteresisCount,disabled:t,className:M,onFocus:()=>f(!0),onChange:e=>l(t=>({...t,hysteresisCount:Number(e.target.value)||1})),onBlur:()=>{let t=V(i.hysteresisCount,1,10);t===e.check.hysteresisCount?f(!1):p({check:m({hysteresisCount:t})})}})]}),s(`p`,{className:d,children:`One bad photograph must never be able to flip a scene. 3 agreeing checks at 60 s is about four minutes of latency and is what makes the answer trustworthy — leaving a state costs exactly the same as entering one.`}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`Quiet for (seconds) before a check counts`}),s(`input`,{type:`number`,min:0,max:3600,value:i.quietSeconds,disabled:t,className:M,onFocus:()=>f(!0),onChange:e=>l(t=>({...t,quietSeconds:Number(e.target.value)||0})),onBlur:()=>{let t=V(i.quietSeconds,0,3600);t===e.quietSeconds?f(!1):p({quietSeconds:t})}})]}),s(`p`,{className:d,children:`A check taken while something is moving is a photograph of the van parked in front of the bin, so it is discarded rather than merely delayed. 0 disables the gate.`}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`Minimum gap between counted checks (seconds)`}),s(`input`,{type:`number`,min:0,max:3600,value:i.minObservationSpacingSec,disabled:t,className:M,onFocus:()=>f(!0),onChange:e=>l(t=>({...t,minObservationSpacingSec:Number(e.target.value)||0})),onBlur:()=>{let t=V(i.minObservationSpacingSec,0,3600);t===e.minObservationSpacingSec?f(!1):p({minObservationSpacingSec:t})}})]}),s(`p`,{className:d,children:`Spreads the agreeing checks over real time instead of letting three adjacent polls inside one long occlusion be mistaken for three independent opinions.`})]}),r(`div`,{className:P,children:[s(`p`,{className:F,children:`Lighting`}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`When a light has no reference of its own`}),r(`select`,{value:e.onUncoveredCondition,disabled:t,className:M,onChange:e=>{let t=e.target.value;(t===`skip`||t===`judge-anyway`)&&p({onUncoveredCondition:t})},children:[s(`option`,{value:`skip`,children:`Skip the check (recommended)`}),s(`option`,{value:`judge-anyway`,children:`Judge against the other light anyway`})]})]}),s(`p`,{className:d,children:z[e.onUncoveredCondition]})]}),r(`div`,{className:P,children:[s(`p`,{className:F,children:`What you get told`}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`Notifications follow`}),r(`select`,{value:e.emit,disabled:t,className:M,onChange:e=>{let t=e.target.value;(t===`latched`||t===`live`)&&p({emit:t})},children:[s(`option`,{value:`latched`,children:`The flag — told once, still visible at breakfast`}),s(`option`,{value:`live`,children:`The live state — follows the region as it changes`})]})]}),s(`p`,{className:d,children:`“Is the bin gone” is a flag: you want to be told once and still see it later. “Is the gate open” is a live state.`}),r(`label`,{className:`flex items-center gap-2`,children:[s(`input`,{type:`checkbox`,checked:e.autoRestore,disabled:t,onChange:e=>p({autoRestore:e.target.checked})}),s(`span`,{className:N,children:`Clear the flag by itself when things look normal again`})]}),s(`p`,{className:d,children:`Off by default, so an alarm never silently clears itself. The “back to normal” moment is recorded either way, so an automation can still react to it.`})]}),r(`div`,{className:P,children:[s(`p`,{className:F,children:`AI double-check`}),r(`label`,{className:`flex items-center gap-2`,children:[s(`input`,{type:`checkbox`,checked:h,disabled:t||i.confirmPrompt.trim().length===0,onChange:e=>p(e.target.checked?{confirm:{...H(i.confirmPrompt.trim()),enabled:!0}}:{confirm:null})}),s(`span`,{className:N,children:`Ask a vision model before changing the answer`})]}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`The question to ask`}),s(`input`,{type:`text`,value:i.confirmPrompt,placeholder:`e.g. Is the wheelie bin still there?`,disabled:t,className:M,onFocus:()=>f(!0),onChange:e=>l(t=>({...t,confirmPrompt:e.target.value})),onBlur:()=>{let t=i.confirmPrompt.trim();t.length>0&&t!==e.confirm?.prompt?p({confirm:{...H(t),enabled:h}}):f(!1)}})]}),r(`p`,{className:d,children:[`The model is asked `,s(`strong`,{children:`only`}),` when the region has already changed enough to flip the answer — roughly twice a week for a bin, not once a minute. It reasons about the object rather than the pixels, so rain, shadows and a repositioned bin stop counting as the thing being taken. If it cannot be reached, the change is held rather than announced.`]})]})]})}function V(e,t,n){return Math.min(n,Math.max(t,e))}function H(e){return{enabled:!1,prompt:e,timeoutMs:8e3,maxImagePx:448,onTimeout:`hold`}}n();var U=`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`,W=`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`,G=`rounded-md border border-danger/50 bg-danger/10 px-2 py-1 text-[11px] font-medium text-danger hover:bg-danger/20 disabled:opacity-40 transition-colors`,K={alarm:`border-danger/50 bg-danger/15 text-danger`,ok:`border-success/50 bg-success/15 text-success`,unknown:`border-border bg-surface text-foreground-subtle`},q=.8,J=3;function Y({deviceId:n}){let p=l(h().trpcClient,n),v=ne(p?.state.sceneMonitor),w=f(n,{width:640}),[T,E]=o(null),[D,O]=o(!1),[A,j]=o(null),[M,N]=o(null),[P,F]=o(null),[I,L]=o(null),[R,z]=o(!1),[B,V]=o(null),[H,Y]=o(``),X=t(!0);c(()=>(X.current=!0,()=>{X.current=!1}),[]);let Z=e(async()=>{if(p)try{let e=await p.sceneMonitor?.listScenes({});if(!X.current)return;e&&E(e)}catch(e){if(!X.current)return;u(e)?O(!0):N(e instanceof Error?e.message:String(e))}},[p]);c(()=>{E(null),O(!1),N(null),Z()},[Z]);let Q=v?.monitors??T?.monitors??[],ae=Date.now(),$=e(async(e,t)=>{j(e),N(null);try{await t(),await Z()}catch(e){X.current&&N(e instanceof Error?e.message:String(e))}finally{X.current&&j(null)}},[Z]),oe=i(()=>{let e=Q.map(e=>({id:e.id,shape:e.roi,label:e.label,enabled:e.enabled}));return B===null?e:[...e,{id:`__draft__`,shape:B,label:`New scene`}]},[Q,B]),se=e((e,t)=>{if(t.kind===`rect`){if(e===`__draft__`){V(t);return}$(`roi-${String(e)}`,async()=>p?.sceneMonitor?.updateScene({monitorId:String(e),patch:{roi:t}}))}},[p,$]),ce=e(e=>{e.kind===`rect`&&V(e)},[]),le=e(async()=>{B===null||H.trim().length===0||(await $(`create`,async()=>{await p?.sceneMonitor?.createScene({label:H.trim(),roi:B,check:{mode:`similarity`,threshold:q,hysteresisCount:J}})}),V(null),Y(``),z(!1))},[p,B,H,$]);return p?s(`div`,{className:`flex flex-col gap-3`,children:D?s(`p`,{className:`${d} leading-relaxed`,children:`Scene monitoring is not available for this camera.`}):r(a,{children:[s(`p`,{className:`${d} leading-relaxed`,children:`A scene watches one region of this camera and tells you when it stops looking like the picture you captured. Draw a box around the thing you care about — a wheelie bin, a gate, a parking space — then capture what “normal” looks like. Daylight is enough to start: the night reference is optional, and without it the scene simply sits the infrared hours out instead of reporting a problem.`}),s(`div`,{className:`relative overflow-hidden rounded-md border border-border`,children:s(C,{items:oe,supportedShapes:[`rect`],selectedId:P??(B===null?null:`__draft__`),onSelect:e=>F(e===null?null:String(e)),onShapeChange:se,onDrawComplete:ce,drawingKind:R&&B===null?`rect`:null,backdrop:w.src===null?null:s(`img`,{src:w.src,alt:``,className:`h-full w-full object-contain`,draggable:!1})})}),r(`div`,{className:`flex flex-wrap items-center gap-2`,children:[s(`button`,{type:`button`,className:R?W:U,"aria-pressed":R,onClick:()=>{z(e=>!e),V(null)},disabled:A!==null,children:R?`Cancel`:`+ New scene`}),s(`button`,{type:`button`,className:U,onClick:w.refresh,disabled:A!==null,children:`Refresh frame`})]}),R&&r(`div`,{className:`flex flex-col gap-2 rounded-md border border-border bg-surface p-2`,children:[s(`p`,{className:`text-[10px] text-foreground-subtle`,children:B===null?`Click on the frame to drop a box, then drag its corner to fit it around the thing you want watched.`:`Name it, then create. You capture what “normal” looks like next.`}),B!==null&&ee(B)&&s(`p`,{className:`text-[11px] leading-relaxed text-warning`,children:`That box covers most of the frame. A scene that big is dominated by the weather, the sky and passing cars — it will quietly stop noticing the thing you actually care about. Draw it tighter.`}),r(`div`,{className:`flex items-center gap-2`,children:[s(`input`,{type:`text`,value:H,onChange:e=>Y(e.target.value),placeholder:`e.g. Immondizia prelevata`,className:`flex-1 rounded-md border border-border bg-surface px-2 py-1 text-[12px] text-foreground`}),s(`button`,{type:`button`,className:W,onClick:()=>void le(),disabled:B===null||H.trim().length===0||A!==null,children:`Create`})]})]}),M!==null&&s(`p`,{className:`text-[11px] leading-relaxed text-danger`,children:M}),Q.length===0?s(`p`,{className:`${d} leading-relaxed`,children:`No scenes on this camera yet.`}):s(`ul`,{className:`flex flex-col gap-2`,children:Q.map(e=>{let t=g(e);return r(`li`,{className:`flex flex-col gap-1.5 rounded-md border p-2 ${P===e.id?`border-primary/50`:`border-border`}`,children:[r(`div`,{className:`flex items-center gap-2`,children:[s(`button`,{type:`button`,className:`flex-1 text-left text-[12px] font-medium text-foreground`,onClick:()=>F(e.id),children:e.label}),s(`span`,{className:`rounded border px-1.5 py-0.5 text-[10px] font-medium ${K[t.tone]}`,children:t.text})]}),s(`p`,{className:`${d} leading-relaxed`,children:_(e,ae)}),s(`p`,{className:`${d} tabular-nums`,children:te(e)}),s(k,{monitor:e,disabled:A!==null,onDelete:({stateId:t,index:n})=>void $(`refdel-${e.id}-${t}-${String(n)}`,async()=>p.sceneMonitor?.deleteReference({monitorId:e.id,stateId:t,index:n}))}),r(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[re.map(t=>{let n=t===`ir`;return r(`button`,{type:`button`,className:U,disabled:A!==null,title:n?`Optional. Without a night reference the checks in infrared are simply skipped — the scene keeps working in daylight and nothing is reported as broken.`:`Take a fresh photo now and store it as the ${b(t).toLowerCase()} reference`,onClick:()=>void $(`cap-${e.id}-${t}`,async()=>p.sceneMonitor?.captureReference({monitorId:e.id,condition:t})),children:[s(m,{className:`mr-1 inline h-3 w-3`}),`Capture `,b(t).toLowerCase(),n&&s(`span`,{className:`ml-1 text-foreground-subtle/70`,children:`(optional)`})]},t)}),r(`button`,{type:`button`,className:W,disabled:A!==null||e.states.length===0,title:`Clear the flag and re-photograph what normal looks like right now`,onClick:()=>void $(`reset-${e.id}`,async()=>p.sceneMonitor?.resetScene({monitorId:e.id})),children:[s(y,{className:`mr-1 inline h-3 w-3`}),`Reset`]}),s(`button`,{type:`button`,className:U,disabled:A!==null,onClick:()=>void $(`check-${e.id}`,async()=>p.sceneMonitor?.recheckNow({monitorId:e.id})),children:`Check now`}),r(`button`,{type:`button`,className:I===e.id?W:U,"aria-pressed":I===e.id,"aria-label":`Settings for ${e.label}`,disabled:A!==null,onClick:()=>L(t=>t===e.id?null:e.id),children:[s(S,{className:`mr-1 inline h-3 w-3`}),`Settings`]}),s(`button`,{type:`button`,className:G,disabled:A!==null,onClick:()=>void $(`del-${e.id}`,async()=>p.sceneMonitor?.deleteScene({monitorId:e.id})),children:s(x,{className:`h-3 w-3`})})]}),I===e.id&&s(ie,{monitor:e,disabled:A!==null,onPatch:t=>void $(`tune-${e.id}`,async()=>p.sceneMonitor?.updateScene({monitorId:e.id,patch:t}))})]},e.id)})})]})}):null}export{Y as SceneMonitorEditor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Q as e,S as t,W as n,X as r,q as i,x as a}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{c as o,f as s,l as c,u as l}from"./player-overlays-
|
|
1
|
+
import{Q as e,S as t,W as n,X as r,q as i,x as a}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{c as o,f as s,l as c,u as l}from"./player-overlays-CVsVEZkx.js";import{$n as u,Ft as d,It as f,Nn as p,Od as m,On as h,Pn as g,Sn as _,Tn as v,bn as y,sa as b,t as x,wn as S,xn as C,yn as w}from"./src-DBOD88Il.js";import{nt as T}from"./index-BhXNFlQG.js";import{t as E}from"./AdminPage-BSFohA3i.js";import{t as D}from"./use-scenes-feed-B3khNWlP.js";e();function O(e){return e.states.length===0?3:e.latched?0:e.verdict===`diverged`?1:e.verdict===`unknown`?2:4}function k(e){let t=[e.divergedAt,e.restoredAt].filter(e=>typeof e==`number`);return t.length===0?null:Math.max(...t)}function A(e,t){let n=new Map(e.map(e=>[e.deviceId,e.deviceName])),r=[];for(let e of t)for(let t of e.monitors)r.push({deviceId:e.deviceId,deviceName:n.get(e.deviceId)??`Camera ${e.deviceId}`,monitor:t});return r.toSorted((e,t)=>{let n=O(e.monitor)-O(t.monitor);if(n!==0)return n;let r=k(e.monitor)??-1,i=k(t.monitor)??-1;if(r!==i)return i-r;let a=e.deviceName.localeCompare(t.deviceName);return a===0?e.monitor.label.localeCompare(t.monitor.label):a})}var j={alarm:`danger`,ok:`success`,unknown:`default`};function M(e,t){let n=k(e);return n===null?`—`:`${l(Math.max(0,t-n))} ago`}function N(){let e=b({isCamera:!0,projection:`slim`}),l=n(()=>(e.data??[]).map(e=>({deviceId:e.id,deviceName:e.name})).sort((e,t)=>e.deviceName.localeCompare(t.deviceName)),[e.data]),O=n(()=>l.map(e=>e.deviceId),[l]),k=D(O),N=n(()=>A(l,k.results),[l,k.results]),[P,F]=i(null),[I,L]=i(null),R=Date.now(),z=l.find(e=>e.deviceId===P)?.deviceName??``;return t(E,{icon:T,title:`Scenes`,subtitle:`A scene watches one region of one camera and tells you when it stops looking like the picture you captured — a wheelie bin, a gate, a parking space.`,actions:t(g,{onClick:()=>L(O[0]??null),disabled:l.length===0,children:[a(m,{className:`mr-1 h-3.5 w-3.5`}),`New scene`]}),children:[k.unreachableCount>0?t(`p`,{className:`text-xs text-warning`,children:[k.unreachableCount,` camera`,k.unreachableCount===1?``:`s`,` could not be asked about scenes. Those cameras are missing from this list — this is not the same as having no scenes.`]}):null,a(h,{variant:`flat`,className:`p-0`,children:a(d,{columns:[{key:`label`,header:`Scene`,render:e=>a(`span`,{className:`font-medium`,children:e.monitor.label})},{key:`camera`,header:`Camera`,nowrap:!0,render:e=>e.deviceName},{key:`state`,header:`State`,nowrap:!0,render:e=>{let t=o(e.monitor);return a(u,{variant:j[t.tone],children:t.text})}},{key:`status`,header:`What it says`,render:e=>a(`span`,{className:`text-xs text-muted-foreground`,children:s(e.monitor,R)})},{key:`coverage`,header:`Variants`,render:e=>a(`span`,{className:`text-xs text-muted-foreground`,children:c(e.monitor)})},{key:`transition`,header:`Last change`,align:`right`,nowrap:!0,render:e=>a(`span`,{className:`text-xs tabular-nums text-muted-foreground`,children:M(e.monitor,R)})},{key:`actions`,header:``,align:`right`,nowrap:!0,render:e=>a(g,{variant:`ghost`,onClick:()=>F(e.deviceId),children:`Open`})}],rows:N,rowKey:e=>`${e.deviceId}:${e.monitor.id}`,minWidthPx:880,bordered:!1,mobileMode:`scroll`,maxBodyHeight:f,emptyMessage:k.isLoading?`Loading scenes…`:`No scenes yet. Press “New scene”, pick a camera, then draw a box around the thing you want watched.`})}),a(w,{open:I!==null,onOpenChange:e=>!e&&L(null),children:t(C,{width:`sm`,children:[t(S,{children:[a(v,{children:`Which camera?`}),a(_,{children:`A scene lives on one camera. Pick the one that can see the thing.`})]}),t(`div`,{className:`mt-3 flex items-center gap-2`,children:[a(p,{value:I===null?``:String(I),onChange:e=>L(Number(e.target.value)),"aria-label":`Camera`,options:l.map(e=>({value:String(e.deviceId),label:e.deviceName}))}),a(g,{onClick:()=>{F(I),L(null)},disabled:I===null,children:`Continue`})]})]})}),a(w,{open:P!==null,onOpenChange:e=>!e&&F(null),children:t(C,{width:`lg`,scroll:`body`,children:[t(S,{children:[t(v,{children:[`Scenes — `,z]}),a(_,{children:`Draw a box, name it, then capture what “normal” looks like. Daylight is enough — the night reference is optional, and “Settings” on each scene tunes how fussy and how often it checks.`})]}),a(y,{className:`mt-3`,children:P===null?null:a(r,{fallback:a(`p`,{className:`text-xs text-muted-foreground`,children:`Loading the editor…`}),children:a(x,{deviceId:P})})})]})})]})}export{N as ScenesPage};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{I as e,K as t,Q as n,S as r,W as i,q as a,x as o}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{E as s,at as c,st as l,vt as u}from"./player-overlays-
|
|
1
|
+
import{I as e,K as t,Q as n,S as r,W as i,q as a,x as o}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{E as s,at as c,st as l,vt as u}from"./player-overlays-CVsVEZkx.js";import{$n as d,Cf as f,Cn as p,Dt as m,Du as h,Et as g,Fd as _,Ft as v,Gn as y,Hd as b,It as x,Kn as S,Pn as C,Pt as ee,Ql as te,Sn as ne,Tn as re,fd as w,hu as T,jn as E,ju as D,mu as ie,pu as ae,qd as oe,sa as se,wn as ce,xn as le,yn as ue}from"./src-DBOD88Il.js";import{t as de}from"./octagon-alert-DI2r29y1.js";import{R as O,a as fe,rt as pe}from"./index-BhXNFlQG.js";var me=u(`unlink`,[[`path`,{d:`m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71`,key:`yqzxt4`}],[`path`,{d:`m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71`,key:`4qinb0`}],[`line`,{x1:`8`,x2:`8`,y1:`2`,y2:`5`,key:`1041cp`}],[`line`,{x1:`2`,x2:`5`,y1:`8`,y2:`8`,key:`14m1p5`}],[`line`,{x1:`16`,x2:`16`,y1:`19`,y2:`22`,key:`rzdirn`}],[`line`,{x1:`19`,x2:`22`,y1:`16`,y2:`16`,key:`ox905f`}]]);n();function k({id:e,title:t,icon:n,description:i,actions:a,tone:c=`default`,notice:l=null,onDismissNotice:u,children:d}){return o(ee,{headingId:`access-${e}`,title:t,icon:n,actions:a,testId:`access-${e}`,children:r(`div`,{className:`${s} space-y-3`,children:[o(`div`,{className:T(`text-[11px] leading-relaxed`,c===`danger`?`rounded-md border border-danger/30 bg-danger/5 px-3 py-2 text-foreground`:`text-foreground-subtle`),children:i}),l!==null&&o(ge,{notice:l,onDismiss:u}),d]})})}var he={success:{icon:f,line:`border-success/30 text-foreground`,mark:`text-success`},danger:{icon:de,line:`border-danger/40 text-danger`,mark:`text-danger`}};function ge({notice:e,onDismiss:t}){let n=he[e.tone],i=n.icon;return r(`div`,{role:e.tone===`danger`?`alert`:`status`,className:T(`flex items-start gap-2 rounded-md border bg-surface px-3 py-2 text-[11px]`,n.line),children:[o(i,{className:T(`mt-0.5 h-3.5 w-3.5 shrink-0`,n.mark),"aria-hidden":!0}),o(`span`,{className:`min-w-0 flex-1`,children:e.message}),t!==void 0&&o(ie,{type:`button`,variant:`ghost`,size:`sm`,icon:D,"aria-label":`Dismiss`,onClick:t,className:`-my-1 h-5 w-5`})]})}function A(){let{data:e}=te();return i(()=>{let t=new Map;for(let n of e??[])t.set(n.id,n.username);return t},[e])}function j(e,t=null){return e===null?t:{tone:`danger`,message:e}}var M={active:`Active`,expired:`Expired`,revoked:`Revoked`,current:`This session`},N={active:`success`,expired:`warning`,revoked:`default`,current:`info`},P={current:0,active:1,expired:2,revoked:3};function F(e,t){if(e===null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?`—`:n.toLocaleString()}function I({status:e}){return o(d,{variant:N[e],className:`text-[10px]`,children:M[e]})}function L({row:e,action:t}){if(!t.isAvailable(e))return null;let n=t.icon,i=t.busyId===e.id;return r(C,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>t.onRun(e),disabled:t.disabled,"aria-label":`${t.label} ${e.name}`,className:`text-danger hover:bg-danger/10`,children:[i?o(b,{className:`h-3 w-3 animate-spin`,"aria-hidden":!0}):o(n,{className:`h-3 w-3`,"aria-hidden":!0}),t.label]})}function _e(e){return[{key:`name`,header:`Name`,sortValue:e=>e.name.toLowerCase(),render:e=>r(`div`,{className:`min-w-0 max-w-[18rem]`,children:[o(`div`,{className:`truncate font-medium text-foreground`,title:e.name,children:e.name}),e.detail!==null&&o(`div`,{className:`truncate font-mono text-[10px] text-foreground-subtle`,title:e.detail,children:e.detail})]})},e.hideOwner?null:{key:`owner`,header:`Owner`,sortValue:e=>e.ownerName.toLowerCase(),render:e=>e.ownerName},{key:`kind`,header:`Kind / scope`,sortValue:e=>e.kind.toLowerCase(),nowrap:!1,render:e=>r(`div`,{className:`min-w-[8rem] max-w-[16rem]`,children:[o(`div`,{className:`text-foreground`,children:e.kind}),e.scope!==null&&o(`div`,{className:`line-clamp-2 text-[10px] text-foreground-subtle`,title:e.scope,children:e.scope})]})},{key:`status`,header:`Status`,sortValue:e=>P[e.status],render:e=>o(I,{status:e.status})},{key:`created`,header:`Created`,sortValue:e=>e.createdAt,render:e=>o(`span`,{className:`text-foreground-subtle`,children:F(e.createdAt,`—`)})},{key:`lastUsed`,header:`Last used`,sortValue:e=>e.lastUsedAt,render:e=>o(`span`,{className:`text-foreground-subtle`,children:F(e.lastUsedAt,`Never`)})},{key:`expires`,header:`Expires`,sortValue:e=>e.expiresAt,render:t=>o(`span`,{className:`text-foreground-subtle`,children:F(t.expiresAt,e.expiresNone)})},e.action===null?null:{key:`actions`,header:``,align:`right`,notSortableReason:`Actions`,render:t=>e.action===null?null:o(L,{row:t,action:e.action})}].filter(e=>e!==null)}n();var R=6,ve={"current-session":`your current session`,"not-active":`already gone`};function z(e,t){return`${String(e)} ${e===1?t.one:t.many}`}function ye(e){let t=new Map;for(let n of e)t.set(n.status,(t.get(n.status)??0)+1);return[...t.entries()].map(([e,t])=>`${String(t)} ${M[e].toLowerCase()}`).join(`, `)}function be(e,t){let n=e.slice(0,R).map(e=>`• ${e.name} — ${e.ownerName}`),r=e.length>R?[`…and ${String(e.length-R)} more`]:[];return[`${z(e.length,t)} (${ye(e)}) stop working at once. This cannot be undone.`,``,...n,...r].join(`
|
|
2
2
|
`)}function B(e,t,n){let r=S(),i=h.auth.revokeCredentials.useMutation(),[o,s]=a(null);return{run:async a=>{if(a.length===0)return!1;let o=String(a.length),c=await r({title:`Revoke ${z(a.length,t)}?`,message:be(a,t),label:`Type ${o} to confirm`,placeholder:o,confirmLabel:`Revoke ${o}`,variant:`danger`,validate:e=>e.trim()===o?null:`Type ${o} — the number of ${t.many} selected`});if(c===null||c.trim()!==o)return!1;s(null);try{let n=await i.mutateAsync({kind:e,ids:a.map(e=>e.id),confirmCount:a.length}),r=n.skipped.map(e=>ve[e.reason]??e.reason);return s({tone:`success`,message:`Revoked ${z(n.revoked.length,t)}.`+(r.length>0?` Skipped ${String(r.length)}: ${[...new Set(r)].join(`, `)}.`:``)}),!0}catch(e){return s({tone:`danger`,message:`The revoke failed: ${e instanceof Error?e.message:`request failed`}. The list below is reloaded — check what is left.`}),!1}finally{n()}},busy:i.isPending,outcome:o,dismiss:()=>s(null)}}n();var xe={searchText:e=>[e.name,e.detail??``,e.ownerName,e.kind,e.scope??``],facetGroups:[{id:`status`,value:e=>e.status},{id:`owner`,value:e=>e.ownerName},{id:`kind`,value:e=>e.kind}]},Se={status:`Status`,owner:`Owner`,kind:`Kind`},V=e=>e.status!==`current`;function H({rows:e,label:t,isLoading:n,loadError:s,emptyText:c,hideOwner:l=!1,expiresNone:u=`Never`,action:d,bulk:f}){let p=g(e,xe),[h,_]=a(()=>new Set),y=i(()=>_e({hideOwner:l,expiresNone:u,action:d??null}),[l,u,d]),S=i(()=>f===void 0?()=>!1:e=>V(e)&&f.isSelectable(e),[f]),C=i(()=>p.rows.filter(e=>h.has(e.id)&&S(e)),[p.rows,h,S]);return n?r(`div`,{className:`flex items-center gap-2 py-4 text-xs text-foreground-subtle`,children:[o(b,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":!0}),`Loading `,t,`…`]}):s===null?r(`div`,{className:`space-y-3`,children:[o(m,{state:p.state,facets:p.facets,groups:p.groups.filter(e=>!(l&&e.id===`owner`)).map(e=>({...e,label:Se[e.id]??e.id,...e.id===`status`?{facetLabel:e=>M[e]??e}:{}})),labels:{searchPlaceholder:`Search ${t}…`,searchLabel:`Search ${t}`,facetsLabel:`Filter ${t}`,clearLabel:`Clear filters`},onSearch:p.setSearch,onToggleFacet:p.toggleFacet,onToggleGroupFacet:p.toggleGroupFacet,onClear:p.clear}),f!==void 0&&o(Ce,{bulk:f,shown:p.rows.filter(S),targets:C,onSelect:_}),o(v,{columns:y,rows:p.rows,rowKey:e=>e.id,minWidthPx:l?760:860,mobileMode:`scroll`,maxBodyHeight:x,defaultSort:{columnKey:`created`,dir:`desc`},pageSize:25,paginationLabels:{navLabel:`${t} pages`,previous:`Previous page`,next:`Next page`,range:(e,t,n)=>`${e}–${t} of ${n}`},emptyMessage:p.active?`No ${t} match the filters.`:c,rowClassName:e=>e.status===`revoked`||e.status===`expired`?`opacity-70`:void 0,...f===void 0?{}:{selection:{selected:h,onChange:_,isSelectable:S,rowLabel:e=>`Select ${e.name} (${e.ownerName})`,pageLabel:`Select every ${f.noun.one} on this page`}}})]}):o(E,{title:`Could not load ${t}`,message:s})}function Ce({bulk:e,shown:t,targets:n,onSelect:i}){let{revoke:a,noun:s}=e,c=(e.quickSelect??[]).map(e=>({...e,rows:t.filter(e.match)})).filter(e=>e.rows.length>0),u=async()=>{await a.run(n)&&i(new Set)};return r(`div`,{className:`flex flex-wrap items-center gap-2`,"data-testid":`bulk-bar`,children:[t.length>0&&r(C,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>i(new Set(t.map(e=>e.id))),children:[`Select all `,String(t.length),` shown`]}),c.map(e=>r(C,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>i(new Set(e.rows.map(e=>e.id))),children:[e.label,` (`,String(e.rows.length),`)`]},e.label)),n.length>0&&r(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[r(`span`,{className:`text-[11px] tabular-nums text-foreground`,"aria-live":`polite`,children:[z(n.length,s),` selected`]}),r(C,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>i(new Set),children:[o(D,{className:`h-3 w-3`,"aria-hidden":!0}),`Clear selection`]}),r(C,{type:`button`,variant:`danger`,size:`sm`,disabled:a.busy,onClick:()=>void u(),children:[a.busy?o(b,{className:`h-3 w-3 animate-spin`,"aria-hidden":!0}):o(l,{className:`h-3 w-3`,"aria-hidden":!0}),`Revoke `,z(n.length,s),`…`]})]})]})}var U=(e,t)=>t===null?`—`:e.get(t)??t;function W(e,t){return e!=null&&e<=t?`expired`:`active`}function we(e,t,n){return{id:e.id,name:n.client(e.client),detail:e.ip,ownerId:e.userId,ownerName:U(t,e.userId),kind:n.method(e.method),scope:null,status:e.current?`current`:`active`,createdAt:e.createdAt,lastUsedAt:e.lastUsedAt,expiresAt:e.expiresAt}}function Te(e,t){return{id:e.id,name:e.integrationId,detail:null,ownerId:e.userId,ownerName:e.username,kind:e.integrationId,scope:t,status:e.revokedAt===null?`active`:`revoked`,createdAt:e.createdAt,lastUsedAt:e.lastUsedAt,expiresAt:null}}function Ee(e,t,n,r,i){let a=[...new Set(e.scopes.map(e=>e.type))].toSorted();return{id:e.id,name:e.name,detail:`${e.tokenPrefix}…`,ownerId:t,ownerName:U(n,t),kind:a.length===0?`none`:a.join(` + `),scope:r,status:W(e.expiresAt,i),createdAt:e.createdAt,lastUsedAt:e.lastUsedAt??null,expiresAt:e.expiresAt??null}}function De(e,t,n){return{id:e.id,name:e.name,detail:`${e.tokenPrefix}…`,ownerId:e.createdBy,ownerName:U(t,e.createdBy),kind:`Full administrator`,scope:null,status:e.revokedAt===null?W(e.expiresAt,n):`revoked`,createdAt:e.createdAt,lastUsedAt:e.lastUsedAt,expiresAt:e.expiresAt}}var Oe={"grid-view":`Grid`,"events-view":`Events`};function ke(e,t){return e.map(e=>t.get(e)??`#${String(e)}`).join(`, `)}function Ae(e,t,n,r){let i=Oe[e.scope.kind];return{id:e.id,name:`${i} · ${String(e.scope.deviceIds.length)} camera${e.scope.deviceIds.length===1?``:`s`}`,detail:`${e.tokenPrefix}…`,ownerId:e.userId,ownerName:U(t,e.userId),kind:e.scope.talk===!0?`${i} + talk`:i,scope:ke(e.scope.deviceIds,n),status:W(e.expiresAt,r),createdAt:e.createdAt,lastUsedAt:e.lastUsedAt??null,expiresAt:e.expiresAt}}function G(e){return`${e.provider}\u0000${e.subject}`}function je(e,t){return{id:G(e),name:e.label??e.subject,detail:e.issuer,ownerId:e.userId,ownerName:U(t,e.userId),kind:e.provider,scope:null,status:`active`,createdAt:e.linkedAt,lastUsedAt:null,expiresAt:null}}function Me(e,t){let n=e.allowedProviders;return{id:e.id,name:e.label,detail:`${e.tokenPrefix}…`,ownerId:e.userId??null,ownerName:U(t,e.userId??null),kind:e.isAdmin===!0?`Admin`:`Regular`,scope:n===void 0||n===`*`?`All providers`:n.join(`, `)||`All providers`,status:`active`,createdAt:e.createdAt??null,lastUsedAt:e.lastUsedAt??null,expiresAt:null}}var K=40,Ne=[{test:/Electron\//,name:`CamStack desktop`},{test:/Edg(e|A|iOS)?\//,name:`Edge`},{test:/OPR\/|Opera/,name:`Opera`},{test:/Firefox\/|FxiOS\//,name:`Firefox`},{test:/Chrome\/|CriOS\//,name:`Chrome`},{test:/Version\/[\d.]+.*Safari\//,name:`Safari`}],Pe=[{test:/iPhone/,name:`iPhone`},{test:/iPad/,name:`iPad`},{test:/Android/,name:`Android`},{test:/Mac OS X|Macintosh/,name:`macOS`},{test:/Windows/,name:`Windows`},{test:/CrOS/,name:`ChromeOS`},{test:/Linux/,name:`Linux`}],Fe=[{test:/CFNetwork\/.*Darwin\//,name:`CamStack app on iOS`},{test:/^okhttp\//i,name:`CamStack app on Android`},{test:/^(node|undici)\b/i,name:`Script (Node.js)`},{test:/^curl\//i,name:`curl`}];function q(e,t){return e.find(e=>e.test.test(t))?.name??null}function Ie(e){return e.length<=K?e:`${e.slice(0,K)}…`}function J(e){if(e===null||e.trim().length===0)return{label:`Unknown device`,raw:null};let t=e.trim(),n=q(Fe,t);if(n!==null)return{label:n,raw:t};let r=q(Ne,t),i=q(Pe,t);return r!==null&&i!==null?{label:`${r} on ${i}`,raw:t}:r===null?{label:Ie(t),raw:t}:{label:r,raw:t}}var Le={password:`Password`,passkey:`Passkey`,sso:`Single sign-on`,handoff:`App hand-off`,exchange:`Session exchange`};function Y(e){return Le[e]??e}function X(e){if(e==null)return`—`;let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleString()}n();function Z(e,t){return e instanceof Error&&e.message.length>0?e.message:t}function Re(n){let i=c(),[s,l]=a(!1),[u,d]=a(``),[f,m]=a(null),[h,g]=a(null),_=t(null),v=e(e=>{_.current?.(e),_.current=null,l(!1),d(``),m(null),g(null)},[]),y=e(()=>new Promise(e=>{_.current?.(null),_.current=e,g(null),l(!0)}),[]),x=async()=>{m(`password`),g(null);try{let{reauthToken:e}=await i.reauthenticate({password:u});v(e)}catch(e){g(Z(e,`Password is incorrect`)),m(null)}},S=async()=>{m(`passkey`),g(null);try{let{optionsJSON:e}=await i.reauthBeginPasskey(),t=await fe({optionsJSON:e}),{reauthToken:n}=await i.reauthenticate({passkeyResponse:Object.fromEntries(Object.entries(t))});v(n)}catch(e){g(Z(e,`Passkey verification failed`)),m(null)}};return{requestProof:y,dialog:o(ue,{open:s,onOpenChange:e=>!e&&v(null),children:r(le,{children:[r(ce,{children:[o(re,{children:`Confirm it’s you`}),r(ne,{children:[n,` needs your password or a passkey, even though you are signed in.`]})]}),r(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),u.length>0&&f===null&&x()},children:[o(ae,{type:`password`,autoComplete:`current-password`,placeholder:`Current password`,value:u,onChange:e=>d(e.target.value),"aria-label":`Current password`}),h!==null&&o(`p`,{role:`alert`,className:`text-xs text-danger`,children:h}),r(p,{className:`flex flex-wrap gap-2`,children:[r(C,{type:`button`,variant:`outline`,disabled:f!==null,onClick:()=>void S(),children:[f===`passkey`?o(b,{className:`h-4 w-4 animate-spin`}):o(oe,{className:`h-4 w-4`}),`Use a passkey`]}),r(C,{type:`submit`,disabled:u.length===0||f!==null,children:[f===`password`&&o(b,{className:`h-4 w-4 animate-spin`}),`Confirm`]})]})]})]})})}}n();var Q={one:`share link`,many:`share links`};function $(e){let t=y(),n=h.useUtils(),r=h.auth.listShareTokens.useQuery({owner:e}),o=A(),{data:s}=se({isCamera:!0,projection:`slim`}),[c,u]=a(null),d=()=>void n.auth.listShareTokens.invalidate(),f=h.auth.revokeShareToken.useMutation({onSuccess:d,onError:e=>u(`Revoke failed: ${e.message}`)}),p=i(()=>{let e=new Map;for(let t of s??[])e.set(t.id,t.name);return e},[s]),m=Date.now(),g=(r.data??[]).map(e=>Ae(e,o,p,m)),_=async e=>{await t({title:`Revoke share link`,message:`Anyone holding this link to ${e.scope??e.name} loses access immediately. This cannot be undone.`,confirmLabel:`Revoke`,variant:`danger`})&&(u(null),f.mutate({id:e.id}))};return{rows:g,refresh:d,error:c,clearError:()=>u(null),isLoading:r.isLoading,loadError:r.isError?r.error?.message??`Request failed`:null,action:{label:`Revoke`,icon:l,isAvailable:()=>!0,onRun:e=>void _(e),busyId:f.isPending?f.variables?.id??null:null,disabled:f.isPending}}}function ze(){let e=$(`self`);return o(k,{notice:j(e.error),onDismissNotice:e.clearError,id:`my-share-links`,title:`Share links`,icon:w,description:`View-only links you created in the viewer app to share a grid or the events of some cameras. Revoking a link stops it working everywhere it was sent.`,children:o(H,{rows:e.rows,label:`share links`,isLoading:e.isLoading,loadError:e.loadError,emptyText:`You have no share links.`,hideOwner:!0,action:e.action})})}function Be(){let{user:e}=O();return e?.isAdmin?o(Ve,{}):null}function Ve(){let e=$(`all`),t=B(`share-link`,Q,e.refresh);return o(k,{notice:j(e.error,t.outcome),onDismissNotice:()=>{e.clearError(),t.dismiss()},id:`share-links`,title:`Share links`,icon:w,description:`Every user's view-only share links. Revoking one stops it working for whoever it was sent to — a revoked link is deleted and cannot be restored.`,children:o(H,{rows:e.rows,label:`share links`,isLoading:e.isLoading,loadError:e.loadError,emptyText:`No user has any share links.`,action:{...e.action,disabled:e.action.disabled||t.busy},bulk:{revoke:t,noun:Q,isSelectable:()=>!0,quickSelect:[{label:`Select expired`,match:e=>e.status===`expired`}]}})})}function He({sessions:e,isLoading:t,loadError:n,emptyText:i,onRevoke:a,revokingId:s}){return t?r(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[o(b,{className:`h-3.5 w-3.5 animate-spin`}),`Loading sessions…`]}):n===null?e.length===0?o(`div`,{className:`rounded border border-dashed border-border px-3 py-4 text-xs text-foreground-subtle text-center`,children:i}):o(`ul`,{className:`divide-y divide-border rounded-md border border-border`,children:e.map(e=>o(Ue,{session:e,revoking:s===e.id,onRevoke:()=>a(e)},e.id))}):r(`div`,{className:`text-[11px] text-danger`,children:[`Could not load sessions: `,n]})}function Ue({session:e,revoking:t,onRevoke:n}){let i=J(e.client);return r(`li`,{"data-testid":`session-row`,className:`flex items-start gap-3 px-3 py-2 text-xs`,children:[o(_,{className:`h-3.5 w-3.5 mt-0.5 shrink-0 text-foreground-subtle`}),r(`div`,{className:`flex-1 min-w-0 space-y-0.5`,children:[r(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[o(`span`,{className:`font-medium text-foreground truncate`,title:i.raw??void 0,children:i.label}),e.current&&o(`span`,{className:`rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary`,children:`This device`})]}),r(`div`,{className:`flex flex-wrap gap-x-3 text-[11px] text-foreground-subtle`,children:[o(`span`,{children:Y(e.method)}),o(`span`,{className:`font-mono`,children:e.ip??`IP unknown`}),r(`span`,{children:[`Last active `,X(e.lastUsedAt)]}),r(`span`,{children:[`Expires `,X(e.expiresAt)]})]})]}),!e.current&&r(`button`,{onClick:n,disabled:t,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] text-danger hover:bg-danger/10 disabled:opacity-50`,children:[t?o(b,{className:`h-3 w-3 animate-spin`}):o(pe,{className:`h-3 w-3`}),`Sign out`]})]})}export{k as _,J as a,me as b,De as c,je as d,Te as f,B as g,H as h,Re as i,Me as l,Ee as m,Be as n,Y as o,we as p,ze as r,X as s,He as t,G as u,j as v,A as y};
|
|
@@ -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-DhP-Lgiq.js";import{M as i}from"./src-CEnvJotZ.js";import{I as a,J as o,K as s}from"./index-Bq3Mrl-l.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:`onvif`,hex:`#3b82f6`}),r(l,{name:`hikvision`,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(i,{status:e},e))})]}),t(`div`,{children:[r(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`CapabilityBadges`}),r(o,{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:[`onvif`,`hikvision`,`reolink`,`homeassistant`,`rtsp`,`onvif`].map(e=>r(s,{type:e,size:`lg`,showLabel:!0},e))})}),t(c,{title:`Form Builder Demo`,children:[r(a,{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-DhP-Lgiq.js";import{M as i}from"./src-DBOD88Il.js";import{I as a,J as o,K as s}from"./index-BhXNFlQG.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:`onvif`,hex:`#3b82f6`}),r(l,{name:`hikvision`,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(i,{status:e},e))})]}),t(`div`,{children:[r(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`CapabilityBadges`}),r(o,{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:[`onvif`,`hikvision`,`reolink`,`homeassistant`,`rtsp`,`onvif`].map(e=>r(s,{type:e,size:`lg`,showLabel:!0},e))})}),t(c,{title:`Form Builder Demo`,children:[r(a,{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{I as e,Q as t,S as n,W as r,a as i,b as a,o,q as s,t as c,x as l,z as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{E as d,at as f,gt as p,ht as m,st as h}from"./player-overlays-OREckyXS.js";import{$n as g,Bd as _,Cn as v,Df as y,Dl as b,Ft as x,Gn as S,Gt as C,Hd as w,Ht as ee,It as te,Jd as ne,Kn as re,Ku as ie,On as T,Ot as E,Pn as D,Pt as ae,Rd as oe,Sd as se,Sl as ce,Sn as le,Su as ue,Td as de,Tf as fe,Tl as pe,Tn as me,Ut as O,Wn as k,Wt as he,_o as ge,ad as A,bn as _e,co as ve,cu as j,do as M,fo as N,go as P,ho as F,hu as I,jn as ye,lo as be,md as xe,mo as Se,pd as L,po as Ce,pu as R,qd as z,sf as we,ud as Te,uo as Ee,vo as De,wf as B,wn as Oe,xn as ke,yn as Ae}from"./src-CEnvJotZ.js";import{t as je}from"./octagon-alert-CQuofVwc.js";import{ir as Me}from"./client-1c3e-nOc.js";import{$ as Ne,T as Pe}from"./index-Bq3Mrl-l.js";import{t as V}from"./AdminPage-BSFohA3i.js";import{t as Fe}from"./NodeAddonsSettingsPanel-BiE-QIvS.js";import{t as Ie}from"./AdminTabs-Bw0vLcQV.js";import{t as Le}from"./AddonAssetIcon-DpOYiFwy.js";t();var Re={detection:`border-green-500`,detector:`border-green-500`,streaming:`border-blue-500`,decode:`border-blue-500`,decoder:`border-blue-500`,recording:`border-orange-500`,recorder:`border-orange-500`,transcoding:`border-purple-500`,transcoder:`border-purple-500`,restream:`border-cyan-500`,restreamer:`border-cyan-500`,storage:`border-yellow-500`,notification:`border-pink-500`,notifier:`border-pink-500`,faces:`border-indigo-500`},ze={detection:`bg-green-500/5`,detector:`bg-green-500/5`,streaming:`bg-blue-500/5`,decode:`bg-blue-500/5`,decoder:`bg-blue-500/5`,recording:`bg-orange-500/5`,recorder:`bg-orange-500/5`,transcoding:`bg-purple-500/5`,transcoder:`bg-purple-500/5`,restream:`bg-cyan-500/5`,restreamer:`bg-cyan-500/5`,storage:`bg-yellow-500/5`,notification:`bg-pink-500/5`,notifier:`bg-pink-500/5`,faces:`bg-indigo-500/5`};function Be({entry:e,actions:t}){let r=e.name.toLowerCase(),i=Re[r]??`border-primary`,a=ze[r]??`bg-primary/5`,o=e.providers.find(e=>e.active),s=t?.pendingCapability===e.name;return n(`div`,{className:`rounded-lg border-t-2 border border-border ${i} ${a} p-3 space-y-2`,children:[n(`div`,{className:`flex items-center justify-between gap-2`,children:[n(`span`,{className:`text-xs font-semibold text-foreground capitalize flex items-center gap-1.5`,children:[e.name,s&&l(w,{className:`h-3 w-3 animate-spin text-primary`})]}),l(`span`,{className:`rounded-full px-2 py-0.5 text-[10px] font-medium ${e.mode===`singleton`?`bg-primary/10 text-primary`:`bg-info/10 text-info`}`,children:e.mode})]}),e.mode===`singleton`?l(Ve,{entry:e,actions:t,activeProvider:o,isPending:s}):l(He,{entry:e,actions:t,isPending:s})]})}function Ve({entry:e,actions:t,activeProvider:r,isPending:i}){if(!t)return l(`div`,{children:r?n(`div`,{className:`flex items-center gap-1.5 text-[10px] text-foreground`,children:[l(B,{className:`h-3 w-3 text-green-400 shrink-0`}),l(`span`,{className:`font-medium`,children:r.addonName}),l(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto`,children:`ACTIVE`})]}):l(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:`No active provider`})});if(e.providers.length===0)return l(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:`No providers`});let a=`__inherit__`;return n(`div`,{className:`space-y-2`,children:[l(`div`,{className:`space-y-1`,children:e.providers.map(r=>{let a=r.active;return n(`button`,{type:`button`,disabled:i||a,onClick:()=>t.onSelectSingleton(e.name,r.addonId),className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-[10px] text-left transition-colors ${a?`bg-green-500/10 text-foreground cursor-default`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`}`,children:[l(`span`,{className:`h-2.5 w-2.5 rounded-full border shrink-0 ${a?`border-green-400 bg-green-400`:`border-border`}`}),l(`span`,{className:`font-medium truncate`,children:r.addonName}),a&&l(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto shrink-0`,children:`ACTIVE`})]},r.addonId)})}),e.perNode&&e.perNode.length>0&&l(`div`,{className:`space-y-2 pt-1 border-t border-border/40`,children:e.perNode.map(r=>{let o=r.hasOverride&&r.resolvedActive?r.resolvedActive:a,s=[{value:a,label:`Inherit global${r.resolvedActive?` (${r.resolvedActive})`:``}`},...r.providers.map(e=>({value:e,label:e}))],c=n=>{n===a?t.onClearNodeSingleton(e.name,r.nodeId):t.onSelectNodeSingleton(e.name,r.nodeId,n)},u=i;return n(`div`,{className:`space-y-0.5`,children:[n(`div`,{className:`text-[9px] font-semibold uppercase tracking-widest text-foreground-subtle/60 px-1.5`,children:[r.nodeId,r.hasOverride&&l(`span`,{className:`ml-1.5 rounded-full bg-primary/10 text-primary px-1 py-0.5 normal-case tracking-normal font-medium`,children:`override`})]}),s.map(e=>{let t=o===e.value;return n(`button`,{type:`button`,disabled:u||t,onClick:()=>c(e.value),className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-[10px] text-left transition-colors ${t?`bg-green-500/10 text-foreground cursor-default`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`}`,children:[l(`span`,{className:`h-2.5 w-2.5 rounded-full border shrink-0 ${t?`border-green-400 bg-green-400`:`border-border`}`}),l(`span`,{className:`font-medium truncate`,children:e.label}),t&&e.value!==a&&l(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto shrink-0`,children:`ACTIVE`})]},e.value)})]},r.nodeId)})})]})}function He({entry:e,actions:t,isPending:r}){if(e.providers.length===0)return l(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:`No providers`});if(!t)return l(`div`,{className:`space-y-1`,children:e.providers.map(e=>n(`div`,{className:`flex items-center justify-between gap-2 text-[10px]`,children:[l(`span`,{className:`text-foreground-subtle`,children:e.addonName}),e.active&&l(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium`,children:`ACTIVE`})]},e.addonId))});let i=e.providers.filter(e=>e.active).map(e=>e.addonId),a=(n,r)=>{let a=r?[...new Set([...i,n])]:i.filter(e=>e!==n);t.onToggleCollection(e.name,a)};return l(`div`,{className:`space-y-1`,children:e.providers.map(e=>n(`label`,{className:`flex items-center justify-between gap-2 text-[10px] rounded px-1.5 py-1 transition-colors ${r?`opacity-50`:`hover:bg-surface-hover cursor-pointer`}`,children:[n(`span`,{className:`flex items-center gap-1.5 min-w-0`,children:[l(`input`,{type:`checkbox`,checked:e.active,disabled:r,onChange:t=>a(e.addonId,t.target.checked),className:`h-3 w-3 accent-green-500 shrink-0`}),l(`span`,{className:`text-foreground truncate`,children:e.addonName})]}),e.active&&l(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium shrink-0`,children:`ACTIVE`})]},e.addonId))})}function H({capabilities:e,actions:t}){return e.length===0?l(`div`,{className:`text-xs text-foreground-subtle text-center py-8`,children:`No capabilities registered`}):l(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3`,children:e.map(e=>l(Be,{entry:e,actions:t},e.name))})}var Ue=[`capabilities`,`listCapabilities`];function We(e){return e===`singleton`||e===`collection`}function Ge(e){let t=e.indexOf(`@`);return t===-1?`${e} (hub)`:`${e.slice(0,t)} (${e.slice(t+1)})`}function Ke(e,t){return{name:e.name,mode:t,providers:e.providers.map(n=>({addonId:n,addonName:Ge(n),active:t===`singleton`?e.activeProvider===n:!e.disabledProviders.includes(n)})),...t===`singleton`&&e.perNode?{perNode:e.perNode}:{}}}function qe(){let e=f(),[t,a]=s(null),[o,u]=s(null),d=i({queryKey:Ue,queryFn:()=>e.trpcClient.capabilities.listCapabilities.query()}),p=r(()=>{let e=(d.data??[]).flatMap(e=>We(e.mode)?[Ke(e,e.mode)]:[]),t=e.filter(e=>e.mode===`singleton`).toSorted((e,t)=>e.name.localeCompare(t.name)),n=e.filter(e=>e.mode===`collection`).toSorted((e,t)=>e.name.localeCompare(t.name));return[...t,...n]},[d.data]),m=r(()=>p.filter(e=>e.mode===`singleton`),[p]),h=r(()=>p.filter(e=>e.mode===`collection`),[p]),g=c({mutationFn:t=>e.trpcClient.capabilities.setActiveSingleton.mutate({capability:t.capName,addonId:t.addonId}),onMutate:e=>{a(e.capName),u(null)},onSuccess:async(e,t)=>{u({kind:`success`,message:`${t.capName} → ${t.addonId} is now active.`}),await d.refetch()},onError:(e,t)=>{u({kind:`error`,message:`Failed to set ${t.capName}: ${e instanceof Error?e.message:`unknown error`}`})},onSettled:()=>a(null)}),_=c({mutationFn:t=>e.trpcClient.capabilities.setActiveSingleton.mutate({capability:t.capName,addonId:t.addonId,nodeId:t.nodeId}),onMutate:e=>{a(e.capName),u(null)},onSuccess:async(e,t)=>{u({kind:`success`,message:`${t.capName} @ ${t.nodeId} → ${t.addonId}.`}),await d.refetch()},onError:(e,t)=>{u({kind:`error`,message:`Failed to set ${t.capName} @ ${t.nodeId}: ${e instanceof Error?e.message:`unknown error`}`})},onSettled:()=>a(null)}),v=c({mutationFn:t=>e.trpcClient.capabilities.clearSingletonNodeOverride.mutate({capability:t.capName,nodeId:t.nodeId}),onMutate:e=>{a(e.capName),u(null)},onSuccess:async(e,t)=>{u({kind:`success`,message:`${t.capName} @ ${t.nodeId} now inherits the global default.`}),await d.refetch()},onError:(e,t)=>{u({kind:`error`,message:`Failed to clear ${t.capName} @ ${t.nodeId}: ${e instanceof Error?e.message:`unknown error`}`})},onSettled:()=>a(null)}),y=c({mutationFn:t=>e.trpcClient.capabilities.setCollectionEnabledProviders.mutate({capability:t.capName,enabledAddonIds:[...t.enabledAddonIds]}),onMutate:e=>{a(e.capName),u(null)},onSuccess:async(e,t)=>{u({kind:`success`,message:`${t.capName}: ${t.enabledAddonIds.length} provider(s) enabled.`}),await d.refetch()},onError:(e,t)=>{u({kind:`error`,message:`Failed to update ${t.capName}: ${e instanceof Error?e.message:`unknown error`}`})},onSettled:()=>a(null)}),b={onSelectSingleton:(e,t)=>g.mutate({capName:e,addonId:t}),onSelectNodeSingleton:(e,t,n)=>_.mutate({capName:e,nodeId:t,addonId:n}),onClearNodeSingleton:(e,t)=>v.mutate({capName:e,nodeId:t}),onToggleCollection:(e,t)=>y.mutate({capName:e,enabledAddonIds:t}),pendingCapability:t};return n(V,{icon:A,title:`Capabilities`,subtitle:`Choose which provider is active for each system capability. Singleton caps pick exactly one provider; collection caps enable a set.`,children:[o&&n(`div`,{className:`flex items-center gap-2 rounded-md border px-3 py-2 text-xs ${o.kind===`success`?`border-success/30 bg-success/10 text-success`:`border-danger/40 bg-danger/10 text-danger`}`,children:[o.kind===`success`?l(B,{className:`h-3.5 w-3.5 shrink-0`}):l(fe,{className:`h-3.5 w-3.5 shrink-0`}),l(`span`,{children:o.message})]}),d.isLoading&&l(`div`,{className:`flex items-center justify-center py-16`,children:l(`div`,{className:`animate-spin h-6 w-6 border-2 border-primary border-t-transparent rounded-full`})}),d.isError&&!d.isLoading&&l(ye,{title:`Failed to load capabilities`,message:d.error instanceof Error?d.error.message:`Unknown error`,onRetry:()=>void d.refetch()}),!d.isLoading&&!d.isError&&p.length===0&&l(`div`,{className:`text-xs text-foreground-subtle text-center py-16`,children:`No capabilities registered.`}),!d.isLoading&&!d.isError&&p.length>0&&n(`div`,{className:`space-y-6`,children:[m.length>0&&n(`section`,{className:`space-y-2`,children:[l(`h2`,{className:`text-[11px] font-semibold uppercase tracking-widest text-foreground-subtle/70`,children:`Singleton — pick one provider`}),l(H,{capabilities:m,actions:b})]}),h.length>0&&n(`section`,{className:`space-y-2`,children:[l(`h2`,{className:`text-[11px] font-semibold uppercase tracking-widest text-foreground-subtle/70`,children:`Collection — enable a set`}),l(H,{capabilities:h,actions:b})]})]})]})}var U=[`locked`,`reset`,`shares-backup`,`recovery-key`,`rotation-pending`,`orphans`],Je={"key-missing":`no master key could be loaded`,"wrong-key":`the master key does not match`,"key-file-unreadable":`the key file cannot be read`,"store-unavailable":`the keychain tables cannot be read`,"not-initialized":`still starting`,"decrypt-failed":`a value did not decrypt`};function Ye(e){return Je[e]??e}function W(e,t,n){return`${e} ${e===1?t:n}`}function Xe({status:e,reset:t,pendingReentry:n,orphans:r}){let i=e.keychain.state===`locked`,a=e.keySource??e.configuredSource,o=[];return e.keychain.state===`locked`&&o.push({id:`locked`,tone:`danger`,title:`Keychain locked: ${Ye(e.keychain.reason)}`}),t!==null&&t.acknowledgedAt===null&&o.push({id:`reset`,tone:`danger`,title:n>0?`Keychain was reset: ${W(n,`field`,`fields`)} to re-enter`:`Keychain was reset: every archived field holds a value again`}),a.sharesBackupWithDatabase&&o.push({id:`shares-backup`,tone:`warning`,title:`The master key sits next to the database in whole-volume backups`}),!i&&e.recoveryKeyDownloadedAt===null&&o.push({id:`recovery-key`,tone:`warning`,title:`No recovery copy of the master key has been taken`}),!i&&e.rotationPending&&o.push({id:`rotation-pending`,tone:`info`,title:`The configured master key is not in use yet`}),!i&&r>0&&o.push({id:`orphans`,tone:`info`,title:`${W(r,`stored value`,`stored values`)} no setting points at`}),[...o].sort((e,t)=>U.indexOf(e.id)-U.indexOf(t.id))}var Ze={dateStyle:`short`,timeStyle:`short`};function G(e){return e===null?`—`:new Date(e).toLocaleString(void 0,Ze)}function K({value:e,copyValue:t,srLabel:r,maxWidthClass:i,className:a}){let o=t??e;return n(`span`,{className:I(`flex min-w-0 items-center gap-0.5`,i),children:[l(`span`,{className:I(`min-w-0 truncate font-mono`,a),title:o,children:e}),l(E,{value:o,srLabel:r,className:`h-6 shrink-0 px-1.5`})]})}t();var Qe=new Set([`reveal`,`download-recovery-key`,`rotate-master-key`,`reset`]),$e=[{key:`at`,header:`When`,render:e=>G(e.at)},{key:`action`,header:`Action`,render:e=>l(g,{variant:Qe.has(e.action)?`warning`:`default`,children:e.action})},{key:`actor`,header:`Actor`,render:e=>l(`span`,{className:`font-mono`,children:e.actor})},{key:`ref`,header:`Ref`,render:e=>e.ref===null?l(`span`,{className:`text-foreground-subtle`,children:`—`}):l(K,{value:e.ref,srLabel:`secret ref`,maxWidthClass:`max-w-[22rem]`})},{key:`detail`,header:`Detail`,render:e=>l(`span`,{className:`text-foreground-muted`,children:e.detail??``})}];function et({entries:e}){let[t,r]=s(0);if(e===void 0)return l(`p`,{className:`text-xs text-foreground-subtle`,children:`Loading…`});let i=Math.max(1,Math.ceil(e.length/25)),a=Math.min(t,i-1),o=a*25,c=e.slice(o,o+25);return n(`div`,{className:`space-y-2`,children:[l(x,{columns:$e,rows:c,rowKey:e=>e.id,minWidthPx:760,mobileMode:`scroll`,emptyMessage:`Nothing has been audited yet.`}),e.length>25&&n(`div`,{className:`flex flex-wrap items-center justify-between gap-2 text-[11px] text-foreground-subtle`,children:[n(`span`,{children:[o+1,`–`,o+c.length,` of `,e.length,e.length>=500?` most recent`:``]}),n(`span`,{className:`inline-flex items-center gap-1`,children:[l(D,{size:`sm`,variant:`outline`,"aria-label":`Previous page`,disabled:a===0,onClick:()=>r(a-1),children:l(y,{className:`h-3.5 w-3.5`,"aria-hidden":!0})}),n(`span`,{className:`tabular-nums`,children:[a+1,` / `,i]}),l(D,{size:`sm`,variant:`outline`,"aria-label":`Next page`,disabled:a>=i-1,onClick:()=>r(a+1),children:l(m,{className:`h-3.5 w-3.5`,"aria-hidden":!0})})]})]})]})}function tt(e,t){switch(e){case`locked`:return l(D,{size:`sm`,variant:`danger`,disabled:t.busy,onClick:t.onReset,children:`Reset keychain`});case`reset`:return l(D,{size:`sm`,variant:`outline`,disabled:t.busy,onClick:t.onAcknowledgeReset,children:`Dismiss`});case`recovery-key`:return l(D,{size:`sm`,variant:`outline`,disabled:t.busy,onClick:t.onDownload,children:`Download`});case`rotation-pending`:return l(D,{size:`sm`,variant:`outline`,disabled:t.busy,onClick:t.onRotate,children:`Rotate`});case`orphans`:return l(D,{size:`sm`,variant:`outline`,onClick:t.onShowOrphans,children:`Review`});case`shares-backup`:return null}}function nt(e,t){switch(e){case`locked`:return l(`p`,{children:`No value can be read or stored. If the master key is lost for good, Reset archives every stored value and starts a new keychain; every secret field then reads “not set”.`});case`reset`:return t.reset===null?null:l(rt,{reset:t.reset,pending:t.pendingReentry});case`shares-backup`:return n(`p`,{children:[`CamStack’s own backups leave the key out, but a backup of the whole data directory (an appdata tar) carries both. Point `,l(`code`,{className:`font-mono`,children:`keychain.keyFile`}),` in config.yaml at a file outside the data volume, keep the old one as`,` `,l(`code`,{className:`font-mono`,children:`keychain.previousKeyFile`}),`, restart, then rotate.`]});case`recovery-key`:return l(`p`,{children:`Without a copy of the master key, the stored values cannot be recovered.`});case`rotation-pending`:return l(`p`,{children:`The keychain unlocked with a previous key. Rotate to move onto the configured one.`});case`orphans`:return null}}function rt({reset:e,pending:t}){let r=e.actor===`trigger-file`?`the RESET_KEYCHAIN trigger file`:`an admin (${e.actor})`;return n(`div`,{className:`space-y-1.5`,children:[n(`p`,{children:[`Reset on `,G(e.at),` by `,r,`. `,e.archived,` stored value(s) were archived — unreadable without the lost master key. Everyone was signed out once.`]}),e.clearedSettingsKeys.includes(`cluster.clusterSecret`)&&l(`p`,{children:`The cluster secret was cleared. If your agents used one, set it again in System → Cluster; until then any node may register.`}),t.length>0&&l(`ul`,{className:`max-h-40 space-y-0.5 overflow-y-auto rounded-md border border-border bg-background p-2 font-mono text-[11px] text-foreground`,children:t.map(e=>n(`li`,{className:`break-all`,children:[e.owner,` · `,e.scope,` · `,e.fieldPath]},e.ref))})]})}t();var it=2,q={danger:{icon:je,text:`text-danger`,border:`border-danger/40`},warning:{icon:ie,text:`text-warning`,border:`border-warning/40`},info:{icon:ne,text:`text-info`,border:`border-border`}};function at({notices:e,renderAction:t,renderDetail:r}){let[i,a]=s(!1),o=e[0];if(o===void 0)return null;let c=e.length>it,u=c&&!i?e.slice(0,1):e,d=e.length-u.length;return n(`section`,{"aria-label":`Keychain notices`,className:I(`rounded-lg border bg-surface`,q[o.tone].border),children:[l(`ul`,{className:`divide-y divide-border`,children:u.map(e=>l(ot,{notice:e,action:t(e.id),detail:r(e.id)},e.id))}),c&&l(`div`,{className:`border-t border-border px-3 py-1`,children:n(D,{size:`sm`,variant:`ghost`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[l(p,{className:I(`h-3.5 w-3.5 transition-transform`,i&&`rotate-180`),"aria-hidden":!0}),i?`Show less`:`${d} more`]})})]})}function ot({notice:e,action:t,detail:r}){let[i,a]=s(!1),o=q[e.tone],c=o.icon,u=r!=null,d=`keychain-notice-${e.id}`;return n(`li`,{className:`px-3 py-2`,children:[n(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,children:[n(`p`,{className:`flex min-w-0 flex-1 items-start gap-2 text-xs text-foreground`,children:[l(c,{className:I(`mt-0.5 h-3.5 w-3.5 shrink-0`,o.text),"aria-hidden":!0}),l(`span`,{className:`min-w-0 break-words`,children:e.title})]}),n(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1.5 pl-5 sm:pl-0`,children:[u&&l(D,{size:`sm`,variant:`ghost`,"aria-expanded":i,"aria-controls":d,onClick:()=>a(e=>!e),children:`Details`}),t]})]}),u&&i&&l(`div`,{id:d,className:`mt-2 pl-5 text-xs text-foreground-muted`,children:r})]})}var st={"config-file":`Key file (config.yaml)`,"previous-config-file":`Previous key file`,platform:`OS keychain`,"default-file":`Default key file (data volume)`},ct=8;function lt({status:e,busy:t,onDownload:r,onRotate:i,onPurge:a}){let o=e.keychain.state===`locked`,s=e.keySource??e.configuredSource;return l(ae,{headingId:`keychain-status`,title:`Keychain`,icon:z,actions:n(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[e.retiredWraps>0&&n(D,{size:`sm`,variant:`ghost`,disabled:t||o,onClick:a,children:[`Purge `,e.retiredWraps,` retired wrap`,e.retiredWraps===1?``:`s`]}),l(D,{size:`sm`,variant:`outline`,disabled:t||o,onClick:i,children:`Rotate key`}),l(D,{size:`sm`,variant:`outline`,disabled:t||o,onClick:r,children:`Download recovery key`})]}),children:n(`dl`,{className:`${d} grid grid-cols-1 gap-x-6 gap-y-3 sm:grid-cols-2 xl:grid-cols-4`,children:[n(J,{label:`State`,children:[o?n(g,{variant:`danger`,className:`gap-1`,children:[l(_,{className:`h-3 w-3`,"aria-hidden":!0}),`Locked`]}):n(g,{variant:`success`,className:`gap-1`,children:[l(Te,{className:`h-3 w-3`,"aria-hidden":!0}),`Unlocked`]}),n(`span`,{className:`ml-2 text-foreground-subtle`,children:[e.secretCount,` stored`]})]}),n(J,{label:`Key source`,children:[l(`span`,{className:`block`,children:st[s.kind]}),s.path!==void 0&&l(K,{value:s.path,srLabel:`key path`})]}),l(J,{label:`Fingerprint`,children:e.fingerprint===null?l(`span`,{className:`text-foreground-subtle`,children:`—`}):n(`span`,{className:`inline-flex items-center gap-0.5`,children:[l(`span`,{className:`font-mono`,title:e.fingerprint,children:e.fingerprint.slice(0,ct)}),l(E,{value:e.fingerprint,srLabel:`fingerprint`})]})}),l(J,{label:`Recovery key`,children:e.recoveryKeyDownloadedAt===null?l(g,{variant:`warning`,children:`Not taken`}):n(`span`,{children:[`Taken `,G(e.recoveryKeyDownloadedAt)]})})]})})}function J({label:e,children:t}){return n(`div`,{className:`min-w-0 text-xs`,children:[l(`dt`,{className:`text-foreground-subtle`,children:e}),l(`dd`,{className:`mt-0.5 min-w-0 text-foreground`,children:t})]})}t();var ut=1e3;function dt({revealed:e,onClose:t}){let[r,i]=s(j);u(()=>{if(e===null)return;let n=Date.now();i(j);let r=setTimeout(t,j),a=setInterval(()=>i(Math.max(0,j-(Date.now()-n))),ut);return()=>{clearTimeout(r),clearInterval(a)}},[e,t]);let o=Math.ceil(r/1e3);return l(Ae,{open:e!==null,onOpenChange:e=>!e&&t(),children:l(ke,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:e!==null&&n(a,{children:[n(Oe,{children:[l(me,{className:`break-all`,children:e.entry.fieldPath}),n(le,{className:`break-all`,children:[e.entry.owner,` · `,e.entry.scope]})]}),l(_e,{children:l(`pre`,{"data-testid":`revealed-value`,className:`whitespace-pre-wrap break-all rounded-md border border-border bg-background p-3 font-mono text-xs text-foreground`,children:e.value})}),n(v,{className:`flex-col items-stretch gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[n(`p`,{className:`text-[11px] text-foreground-subtle`,children:[`This reveal is recorded in the keychain audit. Hides in `,o,`s.`]}),n(`div`,{className:`flex justify-end gap-2`,children:[l(E,{value:e.value,label:`Copy`,srLabel:`revealed value`}),l(D,{size:`sm`,variant:`outline`,onClick:t,children:`Hide`})]})]})]})})})}var Y={orphan:{label:`Orphan`,variant:`warning`,hint:`No setting points at this value any more.`,rank:0},unknown:{label:`Unavailable`,variant:`default`,hint:`Its owner's settings could not be read, so whether it is in use is unknown. Never deleted as an orphan.`,rank:1},"in-use":{label:`In use`,variant:`success`,hint:`A setting points at this value.`,rank:2}},ft=[{id:`all`,label:`All`},{id:`in-use`,label:`In use`},{id:`orphan`,label:`Orphans`},{id:`unknown`,label:`Unavailable`}],X=`system`;function pt(e){let{secrets:t,filter:r,onFilterChange:i,onDeleteOrphans:a,deleting:o,locked:s}=e;if(t===void 0)return l(`p`,{className:`text-xs text-foreground-subtle`,children:`Loading…`});let c=e=>e===`all`?t.length:t.filter(t=>t.usage===e).length,u=t.filter(e=>e.usage===`orphan`).map(e=>e.ref),d=r===`all`?t:t.filter(e=>e.usage===r);return n(`div`,{className:`space-y-2`,children:[n(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[l(`div`,{className:`flex flex-wrap gap-1`,role:`group`,"aria-label":`Filter by usage`,children:ft.map(e=>n(D,{size:`sm`,variant:r===e.id?`secondary`:`ghost`,"aria-pressed":r===e.id,className:r===e.id?`ring-1 ring-border`:void 0,onClick:()=>i(e.id),children:[e.label,l(`span`,{className:`text-foreground-subtle tabular-nums`,children:c(e.id)})]},e.id))}),u.length>0&&n(D,{size:`sm`,variant:`outline`,className:`ml-auto`,disabled:o||s,onClick:()=>a(u),children:[l(h,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),`Delete `,u.length,` orphan`,u.length===1?``:`s`]})]}),l(x,{columns:ht(e),rows:d,rowKey:e=>e.ref,minWidthPx:860,mobileMode:`scroll`,maxBodyHeight:te,defaultSort:{columnKey:`owner`,dir:`asc`},emptyMessage:t.length===0?`No value is stored in the keychain yet.`:`No stored value matches this filter.`})]})}function mt({owner:e}){return n(`span`,{className:`flex items-center gap-2`,children:[l(Le,{addonId:e,fallback:e===X?xe:de,tileClassName:`bg-surface-hover text-foreground-subtle`,size:`sm`}),l(`span`,{className:`font-medium`,children:e===X?`Hub (system)`:e})]})}function ht({locked:e,onReveal:t,revealing:r}){return[{key:`owner`,header:`Owner`,render:e=>l(mt,{owner:e.owner}),sortValue:e=>e.owner},{key:`scope`,header:`Scope`,render:e=>l(`span`,{className:`block max-w-[11rem] truncate font-mono`,title:e.scope,children:e.scope}),sortValue:e=>e.scope},{key:`field`,header:`Field`,render:e=>l(K,{value:e.fieldPath,copyValue:e.ref,srLabel:`secret ref`,maxWidthClass:`max-w-[16rem]`}),sortValue:e=>e.fieldPath},{key:`updated`,header:`Updated`,render:e=>G(e.updatedAt),sortValue:e=>e.updatedAt},{key:`last-read`,header:`Last read`,render:e=>G(e.lastReadAt),sortValue:e=>e.lastReadAt},{key:`status`,header:`Status`,render:e=>l(g,{variant:Y[e.usage].variant,title:Y[e.usage].hint,children:Y[e.usage].label}),sortValue:e=>Y[e.usage].rank},{key:`actions`,header:``,align:`right`,notSortableReason:`Actions`,render:i=>n(D,{size:`sm`,variant:`ghost`,disabled:e||r,"aria-label":`Reveal ${i.fieldPath}`,title:e?`The keychain is locked`:`Reveal (audited)`,onClick:()=>t(i),children:[l(we,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),`Reveal`]})}]}function gt(e){return e instanceof Error?e.message:String(e)}function _t(e){let t=S(),n=k(),r=re(),i=Ee(),a=ge(),o=Ce(),s=Se(),c=ve(),l=be(),u=async(t,r)=>{try{await r()}catch(e){await n({title:t,message:gt(e),variant:`danger`})}e()};return{busy:i.isPending||a.isPending||o.isPending||s.isPending,deleting:l.isPending,download:async()=>{await t({title:`Download the recovery key`,message:`This shows the MASTER key. Anyone holding it and a copy of the database can read every secret. Store it in a password manager, not on this machine.`,confirmLabel:`Show the key`,variant:`warning`})&&await u(`Download refused`,async()=>{let e=await i.mutateAsync({});await r({title:`Recovery key (fingerprint ${e.fingerprint})`,message:`Copy it now. It is not shown again until you ask for it again (audited).`,defaultValue:e.key,readOnly:!0,confirmLabel:`Done`})})},rotate:async()=>{await t({title:`Rotate the master key`,message:`The data key is re-wrapped under the configured master key; no value is re-encrypted. The previous wrap is kept until you purge it.`,confirmLabel:`Rotate`,variant:`warning`})&&await u(`Rotation refused`,async()=>{await n({title:`Rotated`,message:`New fingerprint ${(await a.mutateAsync({})).fingerprint}. Take a new recovery copy.`})})},purge:async()=>{await t({title:`Purge retired key wraps`,message:`Copies of the data key wrapped under a previous master key are deleted. After this, the previous master key opens nothing.`,confirmLabel:`Purge`,variant:`warning`})&&await u(`Purge refused`,async()=>{await o.mutateAsync({})})},reset:async()=>{await r({title:`Reset the keychain`,message:`Every stored value is archived (unreadable without the lost key) and every secret field reads "not set". A new session signing key signs everyone out, and the cluster secret is cleared. Type RESET KEYCHAIN to confirm.`,confirmLabel:`Reset`,validate:e=>e===`RESET KEYCHAIN`?null:`Type the confirmation exactly`})===`RESET KEYCHAIN`&&await u(`Reset refused`,async()=>{await s.mutateAsync({confirm:Me})})},acknowledgeReset:async()=>{await u(`Could not dismiss`,async()=>{await c.mutateAsync({})})},deleteOrphans:async e=>{await t({title:`Delete ${e.length} orphaned value${e.length===1?``:`s`}`,message:`No setting points at these values any more. The hub checks each one again before deleting; anything found in use is kept.`,confirmLabel:`Delete`,variant:`danger`})&&await u(`Delete refused`,async()=>{let t=await l.mutateAsync({refs:[...e]});t.kept.length>0&&await n({title:`Some values were kept`,message:`${t.deleted.length} deleted; ${t.kept.length} kept because they are in use again or their owner could not be read.`})})}}}t();var Z=`view`;function vt(){let[e,t]=Ne();return[e.get(Z)===`audit`?`audit`:`values`,n=>{let r=new URLSearchParams(e);n===`values`?r.delete(Z):r.set(Z,n),t(r,{replace:!0})}]}function yt(){let t=De({}),i=N({}),a=M({limit:500}),o=F({}),c=P(),u=k(),[d,f]=vt(),[p,m]=s(`all`),[h,g]=s(null),_=_t(()=>{t.refetch(),i.refetch(),a.refetch(),o.refetch()}),v=t.data?.keychain.state===`locked`,y=r(()=>(i.data??[]).filter(e=>e.usage===`orphan`).length,[i.data]),b=r(()=>t.data===void 0?[]:Xe({status:t.data,reset:o.data?.reset??null,pendingReentry:o.data?.pendingReentry.length??0,orphans:y}),[t.data,o.data,y]),x={reset:o.data?.reset??null,pendingReentry:o.data?.pendingReentry??[],busy:_.busy,onReset:()=>void _.reset(),onAcknowledgeReset:()=>void _.acknowledgeReset(),onDownload:()=>void _.download(),onRotate:()=>void _.rotate(),onShowOrphans:()=>{m(`orphan`),f(`values`)}},S=async e=>{try{g({entry:e,value:(await c.mutateAsync({ref:e.ref})).value}),i.refetch()}catch(e){await u({title:`Reveal refused`,message:Pe(e),variant:`danger`})}},w=e(()=>g(null),[]);return n(V,{icon:z,title:`Secrets`,subtitle:`Passwords, tokens and keys, encrypted in the hub keychain. Values leave the hub only through an audited reveal.`,children:[l(at,{notices:b,renderAction:e=>tt(e,x),renderDetail:e=>nt(e,x)}),t.data!==void 0&&l(lt,{status:t.data,busy:_.busy,onDownload:x.onDownload,onRotate:x.onRotate,onPurge:()=>void _.purge()}),n(ee,{value:d,onValueChange:e=>f(e===`audit`?`audit`:`values`),children:[n(he,{children:[l(C,{value:`values`,children:`Stored values`}),l(C,{value:`audit`,children:`Audit`})]}),l(O,{value:`values`,children:l(pt,{secrets:i.data,locked:v,filter:p,onFilterChange:m,onReveal:e=>void S(e),revealing:c.isPending,onDeleteOrphans:e=>void _.deleteOrphans(e),deleting:_.deleting})}),l(O,{value:`audit`,children:l(et,{entries:a.data})})]}),l(dt,{revealed:h,onClose:w})]})}t();var Q=[[`system`]];function $(e){return e.toFixed(6).replace(/0+$/,``).replace(/\.$/,``)}function bt(){let e=o(),t=pe(),r=b(),i=ce(),[a,c]=s(``),[d,f]=s(``),[p,m]=s(null),h=t.data?.location??null;u(()=>{c(h===null?``:$(h.latitude)),f(h===null?``:$(h.longitude))},[h]);let _=async()=>{await e.invalidateQueries({queryKey:Q})},v=async e=>{e.preventDefault();let t=Number(a),n=Number(d);if(a.trim()===``||d.trim()===``){m(`Enter both a latitude and a longitude, or press Clear.`);return}if(!Number.isFinite(t)||t<-90||t>90){m(`Latitude must be between -90 and 90 decimal degrees.`);return}if(!Number.isFinite(n)||n<-180||n>180){m(`Longitude must be between -180 and 180 decimal degrees.`);return}m(null),await r.mutateAsync({latitude:t,longitude:n}),await _()},y=async()=>{m(null),await r.mutateAsync(null),await _()},x=async()=>{m(null),await i.mutateAsync(),await _()},S=r.isPending||i.isPending||t.isLoading;return n(T,{className:`space-y-3`,children:[n(`div`,{className:`flex items-start justify-between gap-3`,children:[n(`div`,{className:`flex items-start gap-2`,children:[l(oe,{className:`h-4 w-4 mt-0.5 text-muted-foreground shrink-0`}),l(`div`,{children:l(`h3`,{className:`text-sm font-medium`,children:`Site location`})})]}),h===null?l(g,{variant:`warning`,children:`Not configured`}):l(g,{variant:h.source===`operator-set`?`success`:`info`,children:h.source===`operator-set`?`Set by you`:`Derived from IP`})]}),h?.label!==void 0&&h.label!==``?n(`p`,{className:`text-xs text-muted-foreground`,children:[`Detected near `,h.label,`.`]}):null,h===null&&t.data?.derivationAttemptedAt!==null?n(`p`,{className:`text-xs text-warning`,children:[`Automatic detection from the public IP did not succeed`,t.data?.derivationError!==null&&t.data?.derivationError!==void 0?`: ${t.data.derivationError}`:`.`,` `,`It is not retried on its own — enter the coordinates, or press Detect.`]}):null,n(`form`,{className:`flex flex-wrap items-end gap-3`,onSubmit:v,children:[n(`label`,{className:`flex flex-col gap-1 text-xs`,children:[l(`span`,{className:`text-muted-foreground`,children:`Latitude`}),l(R,{className:`w-40`,value:a,inputMode:`decimal`,placeholder:`40.851800`,onChange:e=>c(e.target.value),"aria-label":`Latitude`})]}),n(`label`,{className:`flex flex-col gap-1 text-xs`,children:[l(`span`,{className:`text-muted-foreground`,children:`Longitude`}),l(R,{className:`w-40`,value:d,inputMode:`decimal`,placeholder:`14.268100`,onChange:e=>f(e.target.value),"aria-label":`Longitude`})]}),l(D,{type:`submit`,disabled:S,children:`Save`}),n(D,{type:`button`,variant:`ghost`,disabled:S,onClick:x,children:[l(se,{className:`h-3.5 w-3.5 mr-1`}),`Detect from IP`]}),h===null?null:l(D,{type:`button`,variant:`ghost`,disabled:S,onClick:y,children:`Clear`})]}),p===null?null:l(`p`,{className:`text-xs text-danger`,children:p}),l(`p`,{className:`text-xs text-muted-foreground`,children:`WGS84 decimal degrees. Detect asks a public geo-IP service once and will not overwrite a value you typed — clear it first.`})]})}function xt(){let{nodes:e,isLoading:t}=ue(),r=e.find(e=>e.isHub&&e.isOnline),i=r?.addons.map(e=>e.addonId)??[];return n(V,{children:[l(bt,{}),t?l(`div`,{className:`text-muted-foreground text-sm py-12 text-center`,children:`Loading hub topology…`}):r?i.length===0?l(`div`,{className:`text-muted-foreground text-sm py-12 text-center`,children:`No addons installed on the hub yet.`}):l(Fe,{nodeId:r.id,addonIds:i,level:`global`}):n(`div`,{className:`flex flex-col items-center justify-center text-muted-foreground text-sm gap-2 py-12`,children:[l(L,{className:`h-8 w-8 opacity-30`}),l(`p`,{children:`No online hub node found.`}),l(`p`,{className:`text-xs`,children:`Settings will appear once the hub is reachable.`})]})]})}function St(){return l(`div`,{className:`flex flex-col p-2 sm:p-4`,children:l(Ie,{defaultTab:`settings`,tabs:[{id:`settings`,label:`Settings`,icon:L,content:l(xt,{})},{id:`secrets`,label:`Secrets`,icon:z,content:l(yt,{}),ownedParams:[`view`]},{id:`capabilities`,label:`Capabilities`,icon:A,content:l(qe,{})}]})})}export{St as SystemPage};
|
|
1
|
+
import{I as e,Q as t,S as n,W as r,a as i,b as a,o,q as s,t as c,x as l,z as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{E as d,at as f,gt as p,ht as m,st as h}from"./player-overlays-CVsVEZkx.js";import{$n as g,Bd as _,Cn as v,Df as y,Dl as b,Ft as x,Gn as S,Gt as C,Hd as w,Ht as ee,It as te,Jd as ne,Kn as re,Ku as ie,On as T,Ot as E,Pn as D,Pt as ae,Rd as oe,Sd as se,Sl as ce,Sn as le,Su as ue,Td as de,Tf as fe,Tl as pe,Tn as me,Ut as O,Wn as k,Wt as he,_o as ge,ad as A,bn as _e,co as ve,cu as j,do as M,fo as N,go as P,ho as F,hu as I,jn as ye,lo as be,md as xe,mo as Se,pd as L,po as Ce,pu as R,qd as z,sf as we,ud as Te,uo as Ee,vo as De,wf as B,wn as Oe,xn as ke,yn as Ae}from"./src-DBOD88Il.js";import{t as je}from"./octagon-alert-DI2r29y1.js";import{ir as Me}from"./client-DdTCFotl.js";import{$ as Ne,T as Pe}from"./index-BhXNFlQG.js";import{t as V}from"./AdminPage-BSFohA3i.js";import{t as Fe}from"./NodeAddonsSettingsPanel-ud5IAMLM.js";import{t as Ie}from"./AdminTabs-DTp_qwRF.js";import{t as Le}from"./AddonAssetIcon-DFj-ju1T.js";t();var Re={detection:`border-green-500`,detector:`border-green-500`,streaming:`border-blue-500`,decode:`border-blue-500`,decoder:`border-blue-500`,recording:`border-orange-500`,recorder:`border-orange-500`,transcoding:`border-purple-500`,transcoder:`border-purple-500`,restream:`border-cyan-500`,restreamer:`border-cyan-500`,storage:`border-yellow-500`,notification:`border-pink-500`,notifier:`border-pink-500`,faces:`border-indigo-500`},ze={detection:`bg-green-500/5`,detector:`bg-green-500/5`,streaming:`bg-blue-500/5`,decode:`bg-blue-500/5`,decoder:`bg-blue-500/5`,recording:`bg-orange-500/5`,recorder:`bg-orange-500/5`,transcoding:`bg-purple-500/5`,transcoder:`bg-purple-500/5`,restream:`bg-cyan-500/5`,restreamer:`bg-cyan-500/5`,storage:`bg-yellow-500/5`,notification:`bg-pink-500/5`,notifier:`bg-pink-500/5`,faces:`bg-indigo-500/5`};function Be({entry:e,actions:t}){let r=e.name.toLowerCase(),i=Re[r]??`border-primary`,a=ze[r]??`bg-primary/5`,o=e.providers.find(e=>e.active),s=t?.pendingCapability===e.name;return n(`div`,{className:`rounded-lg border-t-2 border border-border ${i} ${a} p-3 space-y-2`,children:[n(`div`,{className:`flex items-center justify-between gap-2`,children:[n(`span`,{className:`text-xs font-semibold text-foreground capitalize flex items-center gap-1.5`,children:[e.name,s&&l(w,{className:`h-3 w-3 animate-spin text-primary`})]}),l(`span`,{className:`rounded-full px-2 py-0.5 text-[10px] font-medium ${e.mode===`singleton`?`bg-primary/10 text-primary`:`bg-info/10 text-info`}`,children:e.mode})]}),e.mode===`singleton`?l(Ve,{entry:e,actions:t,activeProvider:o,isPending:s}):l(He,{entry:e,actions:t,isPending:s})]})}function Ve({entry:e,actions:t,activeProvider:r,isPending:i}){if(!t)return l(`div`,{children:r?n(`div`,{className:`flex items-center gap-1.5 text-[10px] text-foreground`,children:[l(B,{className:`h-3 w-3 text-green-400 shrink-0`}),l(`span`,{className:`font-medium`,children:r.addonName}),l(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto`,children:`ACTIVE`})]}):l(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:`No active provider`})});if(e.providers.length===0)return l(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:`No providers`});let a=`__inherit__`;return n(`div`,{className:`space-y-2`,children:[l(`div`,{className:`space-y-1`,children:e.providers.map(r=>{let a=r.active;return n(`button`,{type:`button`,disabled:i||a,onClick:()=>t.onSelectSingleton(e.name,r.addonId),className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-[10px] text-left transition-colors ${a?`bg-green-500/10 text-foreground cursor-default`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`}`,children:[l(`span`,{className:`h-2.5 w-2.5 rounded-full border shrink-0 ${a?`border-green-400 bg-green-400`:`border-border`}`}),l(`span`,{className:`font-medium truncate`,children:r.addonName}),a&&l(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto shrink-0`,children:`ACTIVE`})]},r.addonId)})}),e.perNode&&e.perNode.length>0&&l(`div`,{className:`space-y-2 pt-1 border-t border-border/40`,children:e.perNode.map(r=>{let o=r.hasOverride&&r.resolvedActive?r.resolvedActive:a,s=[{value:a,label:`Inherit global${r.resolvedActive?` (${r.resolvedActive})`:``}`},...r.providers.map(e=>({value:e,label:e}))],c=n=>{n===a?t.onClearNodeSingleton(e.name,r.nodeId):t.onSelectNodeSingleton(e.name,r.nodeId,n)},u=i;return n(`div`,{className:`space-y-0.5`,children:[n(`div`,{className:`text-[9px] font-semibold uppercase tracking-widest text-foreground-subtle/60 px-1.5`,children:[r.nodeId,r.hasOverride&&l(`span`,{className:`ml-1.5 rounded-full bg-primary/10 text-primary px-1 py-0.5 normal-case tracking-normal font-medium`,children:`override`})]}),s.map(e=>{let t=o===e.value;return n(`button`,{type:`button`,disabled:u||t,onClick:()=>c(e.value),className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-[10px] text-left transition-colors ${t?`bg-green-500/10 text-foreground cursor-default`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`}`,children:[l(`span`,{className:`h-2.5 w-2.5 rounded-full border shrink-0 ${t?`border-green-400 bg-green-400`:`border-border`}`}),l(`span`,{className:`font-medium truncate`,children:e.label}),t&&e.value!==a&&l(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto shrink-0`,children:`ACTIVE`})]},e.value)})]},r.nodeId)})})]})}function He({entry:e,actions:t,isPending:r}){if(e.providers.length===0)return l(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:`No providers`});if(!t)return l(`div`,{className:`space-y-1`,children:e.providers.map(e=>n(`div`,{className:`flex items-center justify-between gap-2 text-[10px]`,children:[l(`span`,{className:`text-foreground-subtle`,children:e.addonName}),e.active&&l(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium`,children:`ACTIVE`})]},e.addonId))});let i=e.providers.filter(e=>e.active).map(e=>e.addonId),a=(n,r)=>{let a=r?[...new Set([...i,n])]:i.filter(e=>e!==n);t.onToggleCollection(e.name,a)};return l(`div`,{className:`space-y-1`,children:e.providers.map(e=>n(`label`,{className:`flex items-center justify-between gap-2 text-[10px] rounded px-1.5 py-1 transition-colors ${r?`opacity-50`:`hover:bg-surface-hover cursor-pointer`}`,children:[n(`span`,{className:`flex items-center gap-1.5 min-w-0`,children:[l(`input`,{type:`checkbox`,checked:e.active,disabled:r,onChange:t=>a(e.addonId,t.target.checked),className:`h-3 w-3 accent-green-500 shrink-0`}),l(`span`,{className:`text-foreground truncate`,children:e.addonName})]}),e.active&&l(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium shrink-0`,children:`ACTIVE`})]},e.addonId))})}function H({capabilities:e,actions:t}){return e.length===0?l(`div`,{className:`text-xs text-foreground-subtle text-center py-8`,children:`No capabilities registered`}):l(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3`,children:e.map(e=>l(Be,{entry:e,actions:t},e.name))})}var Ue=[`capabilities`,`listCapabilities`];function We(e){return e===`singleton`||e===`collection`}function Ge(e){let t=e.indexOf(`@`);return t===-1?`${e} (hub)`:`${e.slice(0,t)} (${e.slice(t+1)})`}function Ke(e,t){return{name:e.name,mode:t,providers:e.providers.map(n=>({addonId:n,addonName:Ge(n),active:t===`singleton`?e.activeProvider===n:!e.disabledProviders.includes(n)})),...t===`singleton`&&e.perNode?{perNode:e.perNode}:{}}}function qe(){let e=f(),[t,a]=s(null),[o,u]=s(null),d=i({queryKey:Ue,queryFn:()=>e.trpcClient.capabilities.listCapabilities.query()}),p=r(()=>{let e=(d.data??[]).flatMap(e=>We(e.mode)?[Ke(e,e.mode)]:[]),t=e.filter(e=>e.mode===`singleton`).toSorted((e,t)=>e.name.localeCompare(t.name)),n=e.filter(e=>e.mode===`collection`).toSorted((e,t)=>e.name.localeCompare(t.name));return[...t,...n]},[d.data]),m=r(()=>p.filter(e=>e.mode===`singleton`),[p]),h=r(()=>p.filter(e=>e.mode===`collection`),[p]),g=c({mutationFn:t=>e.trpcClient.capabilities.setActiveSingleton.mutate({capability:t.capName,addonId:t.addonId}),onMutate:e=>{a(e.capName),u(null)},onSuccess:async(e,t)=>{u({kind:`success`,message:`${t.capName} → ${t.addonId} is now active.`}),await d.refetch()},onError:(e,t)=>{u({kind:`error`,message:`Failed to set ${t.capName}: ${e instanceof Error?e.message:`unknown error`}`})},onSettled:()=>a(null)}),_=c({mutationFn:t=>e.trpcClient.capabilities.setActiveSingleton.mutate({capability:t.capName,addonId:t.addonId,nodeId:t.nodeId}),onMutate:e=>{a(e.capName),u(null)},onSuccess:async(e,t)=>{u({kind:`success`,message:`${t.capName} @ ${t.nodeId} → ${t.addonId}.`}),await d.refetch()},onError:(e,t)=>{u({kind:`error`,message:`Failed to set ${t.capName} @ ${t.nodeId}: ${e instanceof Error?e.message:`unknown error`}`})},onSettled:()=>a(null)}),v=c({mutationFn:t=>e.trpcClient.capabilities.clearSingletonNodeOverride.mutate({capability:t.capName,nodeId:t.nodeId}),onMutate:e=>{a(e.capName),u(null)},onSuccess:async(e,t)=>{u({kind:`success`,message:`${t.capName} @ ${t.nodeId} now inherits the global default.`}),await d.refetch()},onError:(e,t)=>{u({kind:`error`,message:`Failed to clear ${t.capName} @ ${t.nodeId}: ${e instanceof Error?e.message:`unknown error`}`})},onSettled:()=>a(null)}),y=c({mutationFn:t=>e.trpcClient.capabilities.setCollectionEnabledProviders.mutate({capability:t.capName,enabledAddonIds:[...t.enabledAddonIds]}),onMutate:e=>{a(e.capName),u(null)},onSuccess:async(e,t)=>{u({kind:`success`,message:`${t.capName}: ${t.enabledAddonIds.length} provider(s) enabled.`}),await d.refetch()},onError:(e,t)=>{u({kind:`error`,message:`Failed to update ${t.capName}: ${e instanceof Error?e.message:`unknown error`}`})},onSettled:()=>a(null)}),b={onSelectSingleton:(e,t)=>g.mutate({capName:e,addonId:t}),onSelectNodeSingleton:(e,t,n)=>_.mutate({capName:e,nodeId:t,addonId:n}),onClearNodeSingleton:(e,t)=>v.mutate({capName:e,nodeId:t}),onToggleCollection:(e,t)=>y.mutate({capName:e,enabledAddonIds:t}),pendingCapability:t};return n(V,{icon:A,title:`Capabilities`,subtitle:`Choose which provider is active for each system capability. Singleton caps pick exactly one provider; collection caps enable a set.`,children:[o&&n(`div`,{className:`flex items-center gap-2 rounded-md border px-3 py-2 text-xs ${o.kind===`success`?`border-success/30 bg-success/10 text-success`:`border-danger/40 bg-danger/10 text-danger`}`,children:[o.kind===`success`?l(B,{className:`h-3.5 w-3.5 shrink-0`}):l(fe,{className:`h-3.5 w-3.5 shrink-0`}),l(`span`,{children:o.message})]}),d.isLoading&&l(`div`,{className:`flex items-center justify-center py-16`,children:l(`div`,{className:`animate-spin h-6 w-6 border-2 border-primary border-t-transparent rounded-full`})}),d.isError&&!d.isLoading&&l(ye,{title:`Failed to load capabilities`,message:d.error instanceof Error?d.error.message:`Unknown error`,onRetry:()=>void d.refetch()}),!d.isLoading&&!d.isError&&p.length===0&&l(`div`,{className:`text-xs text-foreground-subtle text-center py-16`,children:`No capabilities registered.`}),!d.isLoading&&!d.isError&&p.length>0&&n(`div`,{className:`space-y-6`,children:[m.length>0&&n(`section`,{className:`space-y-2`,children:[l(`h2`,{className:`text-[11px] font-semibold uppercase tracking-widest text-foreground-subtle/70`,children:`Singleton — pick one provider`}),l(H,{capabilities:m,actions:b})]}),h.length>0&&n(`section`,{className:`space-y-2`,children:[l(`h2`,{className:`text-[11px] font-semibold uppercase tracking-widest text-foreground-subtle/70`,children:`Collection — enable a set`}),l(H,{capabilities:h,actions:b})]})]})]})}var U=[`locked`,`reset`,`shares-backup`,`recovery-key`,`rotation-pending`,`orphans`],Je={"key-missing":`no master key could be loaded`,"wrong-key":`the master key does not match`,"key-file-unreadable":`the key file cannot be read`,"store-unavailable":`the keychain tables cannot be read`,"not-initialized":`still starting`,"decrypt-failed":`a value did not decrypt`};function Ye(e){return Je[e]??e}function W(e,t,n){return`${e} ${e===1?t:n}`}function Xe({status:e,reset:t,pendingReentry:n,orphans:r}){let i=e.keychain.state===`locked`,a=e.keySource??e.configuredSource,o=[];return e.keychain.state===`locked`&&o.push({id:`locked`,tone:`danger`,title:`Keychain locked: ${Ye(e.keychain.reason)}`}),t!==null&&t.acknowledgedAt===null&&o.push({id:`reset`,tone:`danger`,title:n>0?`Keychain was reset: ${W(n,`field`,`fields`)} to re-enter`:`Keychain was reset: every archived field holds a value again`}),a.sharesBackupWithDatabase&&o.push({id:`shares-backup`,tone:`warning`,title:`The master key sits next to the database in whole-volume backups`}),!i&&e.recoveryKeyDownloadedAt===null&&o.push({id:`recovery-key`,tone:`warning`,title:`No recovery copy of the master key has been taken`}),!i&&e.rotationPending&&o.push({id:`rotation-pending`,tone:`info`,title:`The configured master key is not in use yet`}),!i&&r>0&&o.push({id:`orphans`,tone:`info`,title:`${W(r,`stored value`,`stored values`)} no setting points at`}),[...o].sort((e,t)=>U.indexOf(e.id)-U.indexOf(t.id))}var Ze={dateStyle:`short`,timeStyle:`short`};function G(e){return e===null?`—`:new Date(e).toLocaleString(void 0,Ze)}function K({value:e,copyValue:t,srLabel:r,maxWidthClass:i,className:a}){let o=t??e;return n(`span`,{className:I(`flex min-w-0 items-center gap-0.5`,i),children:[l(`span`,{className:I(`min-w-0 truncate font-mono`,a),title:o,children:e}),l(E,{value:o,srLabel:r,className:`h-6 shrink-0 px-1.5`})]})}t();var Qe=new Set([`reveal`,`download-recovery-key`,`rotate-master-key`,`reset`]),$e=[{key:`at`,header:`When`,render:e=>G(e.at)},{key:`action`,header:`Action`,render:e=>l(g,{variant:Qe.has(e.action)?`warning`:`default`,children:e.action})},{key:`actor`,header:`Actor`,render:e=>l(`span`,{className:`font-mono`,children:e.actor})},{key:`ref`,header:`Ref`,render:e=>e.ref===null?l(`span`,{className:`text-foreground-subtle`,children:`—`}):l(K,{value:e.ref,srLabel:`secret ref`,maxWidthClass:`max-w-[22rem]`})},{key:`detail`,header:`Detail`,render:e=>l(`span`,{className:`text-foreground-muted`,children:e.detail??``})}];function et({entries:e}){let[t,r]=s(0);if(e===void 0)return l(`p`,{className:`text-xs text-foreground-subtle`,children:`Loading…`});let i=Math.max(1,Math.ceil(e.length/25)),a=Math.min(t,i-1),o=a*25,c=e.slice(o,o+25);return n(`div`,{className:`space-y-2`,children:[l(x,{columns:$e,rows:c,rowKey:e=>e.id,minWidthPx:760,mobileMode:`scroll`,emptyMessage:`Nothing has been audited yet.`}),e.length>25&&n(`div`,{className:`flex flex-wrap items-center justify-between gap-2 text-[11px] text-foreground-subtle`,children:[n(`span`,{children:[o+1,`–`,o+c.length,` of `,e.length,e.length>=500?` most recent`:``]}),n(`span`,{className:`inline-flex items-center gap-1`,children:[l(D,{size:`sm`,variant:`outline`,"aria-label":`Previous page`,disabled:a===0,onClick:()=>r(a-1),children:l(y,{className:`h-3.5 w-3.5`,"aria-hidden":!0})}),n(`span`,{className:`tabular-nums`,children:[a+1,` / `,i]}),l(D,{size:`sm`,variant:`outline`,"aria-label":`Next page`,disabled:a>=i-1,onClick:()=>r(a+1),children:l(m,{className:`h-3.5 w-3.5`,"aria-hidden":!0})})]})]})]})}function tt(e,t){switch(e){case`locked`:return l(D,{size:`sm`,variant:`danger`,disabled:t.busy,onClick:t.onReset,children:`Reset keychain`});case`reset`:return l(D,{size:`sm`,variant:`outline`,disabled:t.busy,onClick:t.onAcknowledgeReset,children:`Dismiss`});case`recovery-key`:return l(D,{size:`sm`,variant:`outline`,disabled:t.busy,onClick:t.onDownload,children:`Download`});case`rotation-pending`:return l(D,{size:`sm`,variant:`outline`,disabled:t.busy,onClick:t.onRotate,children:`Rotate`});case`orphans`:return l(D,{size:`sm`,variant:`outline`,onClick:t.onShowOrphans,children:`Review`});case`shares-backup`:return null}}function nt(e,t){switch(e){case`locked`:return l(`p`,{children:`No value can be read or stored. If the master key is lost for good, Reset archives every stored value and starts a new keychain; every secret field then reads “not set”.`});case`reset`:return t.reset===null?null:l(rt,{reset:t.reset,pending:t.pendingReentry});case`shares-backup`:return n(`p`,{children:[`CamStack’s own backups leave the key out, but a backup of the whole data directory (an appdata tar) carries both. Point `,l(`code`,{className:`font-mono`,children:`keychain.keyFile`}),` in config.yaml at a file outside the data volume, keep the old one as`,` `,l(`code`,{className:`font-mono`,children:`keychain.previousKeyFile`}),`, restart, then rotate.`]});case`recovery-key`:return l(`p`,{children:`Without a copy of the master key, the stored values cannot be recovered.`});case`rotation-pending`:return l(`p`,{children:`The keychain unlocked with a previous key. Rotate to move onto the configured one.`});case`orphans`:return null}}function rt({reset:e,pending:t}){let r=e.actor===`trigger-file`?`the RESET_KEYCHAIN trigger file`:`an admin (${e.actor})`;return n(`div`,{className:`space-y-1.5`,children:[n(`p`,{children:[`Reset on `,G(e.at),` by `,r,`. `,e.archived,` stored value(s) were archived — unreadable without the lost master key. Everyone was signed out once.`]}),e.clearedSettingsKeys.includes(`cluster.clusterSecret`)&&l(`p`,{children:`The cluster secret was cleared. If your agents used one, set it again in System → Cluster; until then any node may register.`}),t.length>0&&l(`ul`,{className:`max-h-40 space-y-0.5 overflow-y-auto rounded-md border border-border bg-background p-2 font-mono text-[11px] text-foreground`,children:t.map(e=>n(`li`,{className:`break-all`,children:[e.owner,` · `,e.scope,` · `,e.fieldPath]},e.ref))})]})}t();var it=2,q={danger:{icon:je,text:`text-danger`,border:`border-danger/40`},warning:{icon:ie,text:`text-warning`,border:`border-warning/40`},info:{icon:ne,text:`text-info`,border:`border-border`}};function at({notices:e,renderAction:t,renderDetail:r}){let[i,a]=s(!1),o=e[0];if(o===void 0)return null;let c=e.length>it,u=c&&!i?e.slice(0,1):e,d=e.length-u.length;return n(`section`,{"aria-label":`Keychain notices`,className:I(`rounded-lg border bg-surface`,q[o.tone].border),children:[l(`ul`,{className:`divide-y divide-border`,children:u.map(e=>l(ot,{notice:e,action:t(e.id),detail:r(e.id)},e.id))}),c&&l(`div`,{className:`border-t border-border px-3 py-1`,children:n(D,{size:`sm`,variant:`ghost`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[l(p,{className:I(`h-3.5 w-3.5 transition-transform`,i&&`rotate-180`),"aria-hidden":!0}),i?`Show less`:`${d} more`]})})]})}function ot({notice:e,action:t,detail:r}){let[i,a]=s(!1),o=q[e.tone],c=o.icon,u=r!=null,d=`keychain-notice-${e.id}`;return n(`li`,{className:`px-3 py-2`,children:[n(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,children:[n(`p`,{className:`flex min-w-0 flex-1 items-start gap-2 text-xs text-foreground`,children:[l(c,{className:I(`mt-0.5 h-3.5 w-3.5 shrink-0`,o.text),"aria-hidden":!0}),l(`span`,{className:`min-w-0 break-words`,children:e.title})]}),n(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1.5 pl-5 sm:pl-0`,children:[u&&l(D,{size:`sm`,variant:`ghost`,"aria-expanded":i,"aria-controls":d,onClick:()=>a(e=>!e),children:`Details`}),t]})]}),u&&i&&l(`div`,{id:d,className:`mt-2 pl-5 text-xs text-foreground-muted`,children:r})]})}var st={"config-file":`Key file (config.yaml)`,"previous-config-file":`Previous key file`,platform:`OS keychain`,"default-file":`Default key file (data volume)`},ct=8;function lt({status:e,busy:t,onDownload:r,onRotate:i,onPurge:a}){let o=e.keychain.state===`locked`,s=e.keySource??e.configuredSource;return l(ae,{headingId:`keychain-status`,title:`Keychain`,icon:z,actions:n(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[e.retiredWraps>0&&n(D,{size:`sm`,variant:`ghost`,disabled:t||o,onClick:a,children:[`Purge `,e.retiredWraps,` retired wrap`,e.retiredWraps===1?``:`s`]}),l(D,{size:`sm`,variant:`outline`,disabled:t||o,onClick:i,children:`Rotate key`}),l(D,{size:`sm`,variant:`outline`,disabled:t||o,onClick:r,children:`Download recovery key`})]}),children:n(`dl`,{className:`${d} grid grid-cols-1 gap-x-6 gap-y-3 sm:grid-cols-2 xl:grid-cols-4`,children:[n(J,{label:`State`,children:[o?n(g,{variant:`danger`,className:`gap-1`,children:[l(_,{className:`h-3 w-3`,"aria-hidden":!0}),`Locked`]}):n(g,{variant:`success`,className:`gap-1`,children:[l(Te,{className:`h-3 w-3`,"aria-hidden":!0}),`Unlocked`]}),n(`span`,{className:`ml-2 text-foreground-subtle`,children:[e.secretCount,` stored`]})]}),n(J,{label:`Key source`,children:[l(`span`,{className:`block`,children:st[s.kind]}),s.path!==void 0&&l(K,{value:s.path,srLabel:`key path`})]}),l(J,{label:`Fingerprint`,children:e.fingerprint===null?l(`span`,{className:`text-foreground-subtle`,children:`—`}):n(`span`,{className:`inline-flex items-center gap-0.5`,children:[l(`span`,{className:`font-mono`,title:e.fingerprint,children:e.fingerprint.slice(0,ct)}),l(E,{value:e.fingerprint,srLabel:`fingerprint`})]})}),l(J,{label:`Recovery key`,children:e.recoveryKeyDownloadedAt===null?l(g,{variant:`warning`,children:`Not taken`}):n(`span`,{children:[`Taken `,G(e.recoveryKeyDownloadedAt)]})})]})})}function J({label:e,children:t}){return n(`div`,{className:`min-w-0 text-xs`,children:[l(`dt`,{className:`text-foreground-subtle`,children:e}),l(`dd`,{className:`mt-0.5 min-w-0 text-foreground`,children:t})]})}t();var ut=1e3;function dt({revealed:e,onClose:t}){let[r,i]=s(j);u(()=>{if(e===null)return;let n=Date.now();i(j);let r=setTimeout(t,j),a=setInterval(()=>i(Math.max(0,j-(Date.now()-n))),ut);return()=>{clearTimeout(r),clearInterval(a)}},[e,t]);let o=Math.ceil(r/1e3);return l(Ae,{open:e!==null,onOpenChange:e=>!e&&t(),children:l(ke,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:e!==null&&n(a,{children:[n(Oe,{children:[l(me,{className:`break-all`,children:e.entry.fieldPath}),n(le,{className:`break-all`,children:[e.entry.owner,` · `,e.entry.scope]})]}),l(_e,{children:l(`pre`,{"data-testid":`revealed-value`,className:`whitespace-pre-wrap break-all rounded-md border border-border bg-background p-3 font-mono text-xs text-foreground`,children:e.value})}),n(v,{className:`flex-col items-stretch gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[n(`p`,{className:`text-[11px] text-foreground-subtle`,children:[`This reveal is recorded in the keychain audit. Hides in `,o,`s.`]}),n(`div`,{className:`flex justify-end gap-2`,children:[l(E,{value:e.value,label:`Copy`,srLabel:`revealed value`}),l(D,{size:`sm`,variant:`outline`,onClick:t,children:`Hide`})]})]})]})})})}var Y={orphan:{label:`Orphan`,variant:`warning`,hint:`No setting points at this value any more.`,rank:0},unknown:{label:`Unavailable`,variant:`default`,hint:`Its owner's settings could not be read, so whether it is in use is unknown. Never deleted as an orphan.`,rank:1},"in-use":{label:`In use`,variant:`success`,hint:`A setting points at this value.`,rank:2}},ft=[{id:`all`,label:`All`},{id:`in-use`,label:`In use`},{id:`orphan`,label:`Orphans`},{id:`unknown`,label:`Unavailable`}],X=`system`;function pt(e){let{secrets:t,filter:r,onFilterChange:i,onDeleteOrphans:a,deleting:o,locked:s}=e;if(t===void 0)return l(`p`,{className:`text-xs text-foreground-subtle`,children:`Loading…`});let c=e=>e===`all`?t.length:t.filter(t=>t.usage===e).length,u=t.filter(e=>e.usage===`orphan`).map(e=>e.ref),d=r===`all`?t:t.filter(e=>e.usage===r);return n(`div`,{className:`space-y-2`,children:[n(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[l(`div`,{className:`flex flex-wrap gap-1`,role:`group`,"aria-label":`Filter by usage`,children:ft.map(e=>n(D,{size:`sm`,variant:r===e.id?`secondary`:`ghost`,"aria-pressed":r===e.id,className:r===e.id?`ring-1 ring-border`:void 0,onClick:()=>i(e.id),children:[e.label,l(`span`,{className:`text-foreground-subtle tabular-nums`,children:c(e.id)})]},e.id))}),u.length>0&&n(D,{size:`sm`,variant:`outline`,className:`ml-auto`,disabled:o||s,onClick:()=>a(u),children:[l(h,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),`Delete `,u.length,` orphan`,u.length===1?``:`s`]})]}),l(x,{columns:ht(e),rows:d,rowKey:e=>e.ref,minWidthPx:860,mobileMode:`scroll`,maxBodyHeight:te,defaultSort:{columnKey:`owner`,dir:`asc`},emptyMessage:t.length===0?`No value is stored in the keychain yet.`:`No stored value matches this filter.`})]})}function mt({owner:e}){return n(`span`,{className:`flex items-center gap-2`,children:[l(Le,{addonId:e,fallback:e===X?xe:de,tileClassName:`bg-surface-hover text-foreground-subtle`,size:`sm`}),l(`span`,{className:`font-medium`,children:e===X?`Hub (system)`:e})]})}function ht({locked:e,onReveal:t,revealing:r}){return[{key:`owner`,header:`Owner`,render:e=>l(mt,{owner:e.owner}),sortValue:e=>e.owner},{key:`scope`,header:`Scope`,render:e=>l(`span`,{className:`block max-w-[11rem] truncate font-mono`,title:e.scope,children:e.scope}),sortValue:e=>e.scope},{key:`field`,header:`Field`,render:e=>l(K,{value:e.fieldPath,copyValue:e.ref,srLabel:`secret ref`,maxWidthClass:`max-w-[16rem]`}),sortValue:e=>e.fieldPath},{key:`updated`,header:`Updated`,render:e=>G(e.updatedAt),sortValue:e=>e.updatedAt},{key:`last-read`,header:`Last read`,render:e=>G(e.lastReadAt),sortValue:e=>e.lastReadAt},{key:`status`,header:`Status`,render:e=>l(g,{variant:Y[e.usage].variant,title:Y[e.usage].hint,children:Y[e.usage].label}),sortValue:e=>Y[e.usage].rank},{key:`actions`,header:``,align:`right`,notSortableReason:`Actions`,render:i=>n(D,{size:`sm`,variant:`ghost`,disabled:e||r,"aria-label":`Reveal ${i.fieldPath}`,title:e?`The keychain is locked`:`Reveal (audited)`,onClick:()=>t(i),children:[l(we,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),`Reveal`]})}]}function gt(e){return e instanceof Error?e.message:String(e)}function _t(e){let t=S(),n=k(),r=re(),i=Ee(),a=ge(),o=Ce(),s=Se(),c=ve(),l=be(),u=async(t,r)=>{try{await r()}catch(e){await n({title:t,message:gt(e),variant:`danger`})}e()};return{busy:i.isPending||a.isPending||o.isPending||s.isPending,deleting:l.isPending,download:async()=>{await t({title:`Download the recovery key`,message:`This shows the MASTER key. Anyone holding it and a copy of the database can read every secret. Store it in a password manager, not on this machine.`,confirmLabel:`Show the key`,variant:`warning`})&&await u(`Download refused`,async()=>{let e=await i.mutateAsync({});await r({title:`Recovery key (fingerprint ${e.fingerprint})`,message:`Copy it now. It is not shown again until you ask for it again (audited).`,defaultValue:e.key,readOnly:!0,confirmLabel:`Done`})})},rotate:async()=>{await t({title:`Rotate the master key`,message:`The data key is re-wrapped under the configured master key; no value is re-encrypted. The previous wrap is kept until you purge it.`,confirmLabel:`Rotate`,variant:`warning`})&&await u(`Rotation refused`,async()=>{await n({title:`Rotated`,message:`New fingerprint ${(await a.mutateAsync({})).fingerprint}. Take a new recovery copy.`})})},purge:async()=>{await t({title:`Purge retired key wraps`,message:`Copies of the data key wrapped under a previous master key are deleted. After this, the previous master key opens nothing.`,confirmLabel:`Purge`,variant:`warning`})&&await u(`Purge refused`,async()=>{await o.mutateAsync({})})},reset:async()=>{await r({title:`Reset the keychain`,message:`Every stored value is archived (unreadable without the lost key) and every secret field reads "not set". A new session signing key signs everyone out, and the cluster secret is cleared. Type RESET KEYCHAIN to confirm.`,confirmLabel:`Reset`,validate:e=>e===`RESET KEYCHAIN`?null:`Type the confirmation exactly`})===`RESET KEYCHAIN`&&await u(`Reset refused`,async()=>{await s.mutateAsync({confirm:Me})})},acknowledgeReset:async()=>{await u(`Could not dismiss`,async()=>{await c.mutateAsync({})})},deleteOrphans:async e=>{await t({title:`Delete ${e.length} orphaned value${e.length===1?``:`s`}`,message:`No setting points at these values any more. The hub checks each one again before deleting; anything found in use is kept.`,confirmLabel:`Delete`,variant:`danger`})&&await u(`Delete refused`,async()=>{let t=await l.mutateAsync({refs:[...e]});t.kept.length>0&&await n({title:`Some values were kept`,message:`${t.deleted.length} deleted; ${t.kept.length} kept because they are in use again or their owner could not be read.`})})}}}t();var Z=`view`;function vt(){let[e,t]=Ne();return[e.get(Z)===`audit`?`audit`:`values`,n=>{let r=new URLSearchParams(e);n===`values`?r.delete(Z):r.set(Z,n),t(r,{replace:!0})}]}function yt(){let t=De({}),i=N({}),a=M({limit:500}),o=F({}),c=P(),u=k(),[d,f]=vt(),[p,m]=s(`all`),[h,g]=s(null),_=_t(()=>{t.refetch(),i.refetch(),a.refetch(),o.refetch()}),v=t.data?.keychain.state===`locked`,y=r(()=>(i.data??[]).filter(e=>e.usage===`orphan`).length,[i.data]),b=r(()=>t.data===void 0?[]:Xe({status:t.data,reset:o.data?.reset??null,pendingReentry:o.data?.pendingReentry.length??0,orphans:y}),[t.data,o.data,y]),x={reset:o.data?.reset??null,pendingReentry:o.data?.pendingReentry??[],busy:_.busy,onReset:()=>void _.reset(),onAcknowledgeReset:()=>void _.acknowledgeReset(),onDownload:()=>void _.download(),onRotate:()=>void _.rotate(),onShowOrphans:()=>{m(`orphan`),f(`values`)}},S=async e=>{try{g({entry:e,value:(await c.mutateAsync({ref:e.ref})).value}),i.refetch()}catch(e){await u({title:`Reveal refused`,message:Pe(e),variant:`danger`})}},w=e(()=>g(null),[]);return n(V,{icon:z,title:`Secrets`,subtitle:`Passwords, tokens and keys, encrypted in the hub keychain. Values leave the hub only through an audited reveal.`,children:[l(at,{notices:b,renderAction:e=>tt(e,x),renderDetail:e=>nt(e,x)}),t.data!==void 0&&l(lt,{status:t.data,busy:_.busy,onDownload:x.onDownload,onRotate:x.onRotate,onPurge:()=>void _.purge()}),n(ee,{value:d,onValueChange:e=>f(e===`audit`?`audit`:`values`),children:[n(he,{children:[l(C,{value:`values`,children:`Stored values`}),l(C,{value:`audit`,children:`Audit`})]}),l(O,{value:`values`,children:l(pt,{secrets:i.data,locked:v,filter:p,onFilterChange:m,onReveal:e=>void S(e),revealing:c.isPending,onDeleteOrphans:e=>void _.deleteOrphans(e),deleting:_.deleting})}),l(O,{value:`audit`,children:l(et,{entries:a.data})})]}),l(dt,{revealed:h,onClose:w})]})}t();var Q=[[`system`]];function $(e){return e.toFixed(6).replace(/0+$/,``).replace(/\.$/,``)}function bt(){let e=o(),t=pe(),r=b(),i=ce(),[a,c]=s(``),[d,f]=s(``),[p,m]=s(null),h=t.data?.location??null;u(()=>{c(h===null?``:$(h.latitude)),f(h===null?``:$(h.longitude))},[h]);let _=async()=>{await e.invalidateQueries({queryKey:Q})},v=async e=>{e.preventDefault();let t=Number(a),n=Number(d);if(a.trim()===``||d.trim()===``){m(`Enter both a latitude and a longitude, or press Clear.`);return}if(!Number.isFinite(t)||t<-90||t>90){m(`Latitude must be between -90 and 90 decimal degrees.`);return}if(!Number.isFinite(n)||n<-180||n>180){m(`Longitude must be between -180 and 180 decimal degrees.`);return}m(null),await r.mutateAsync({latitude:t,longitude:n}),await _()},y=async()=>{m(null),await r.mutateAsync(null),await _()},x=async()=>{m(null),await i.mutateAsync(),await _()},S=r.isPending||i.isPending||t.isLoading;return n(T,{className:`space-y-3`,children:[n(`div`,{className:`flex items-start justify-between gap-3`,children:[n(`div`,{className:`flex items-start gap-2`,children:[l(oe,{className:`h-4 w-4 mt-0.5 text-muted-foreground shrink-0`}),l(`div`,{children:l(`h3`,{className:`text-sm font-medium`,children:`Site location`})})]}),h===null?l(g,{variant:`warning`,children:`Not configured`}):l(g,{variant:h.source===`operator-set`?`success`:`info`,children:h.source===`operator-set`?`Set by you`:`Derived from IP`})]}),h?.label!==void 0&&h.label!==``?n(`p`,{className:`text-xs text-muted-foreground`,children:[`Detected near `,h.label,`.`]}):null,h===null&&t.data?.derivationAttemptedAt!==null?n(`p`,{className:`text-xs text-warning`,children:[`Automatic detection from the public IP did not succeed`,t.data?.derivationError!==null&&t.data?.derivationError!==void 0?`: ${t.data.derivationError}`:`.`,` `,`It is not retried on its own — enter the coordinates, or press Detect.`]}):null,n(`form`,{className:`flex flex-wrap items-end gap-3`,onSubmit:v,children:[n(`label`,{className:`flex flex-col gap-1 text-xs`,children:[l(`span`,{className:`text-muted-foreground`,children:`Latitude`}),l(R,{className:`w-40`,value:a,inputMode:`decimal`,placeholder:`40.851800`,onChange:e=>c(e.target.value),"aria-label":`Latitude`})]}),n(`label`,{className:`flex flex-col gap-1 text-xs`,children:[l(`span`,{className:`text-muted-foreground`,children:`Longitude`}),l(R,{className:`w-40`,value:d,inputMode:`decimal`,placeholder:`14.268100`,onChange:e=>f(e.target.value),"aria-label":`Longitude`})]}),l(D,{type:`submit`,disabled:S,children:`Save`}),n(D,{type:`button`,variant:`ghost`,disabled:S,onClick:x,children:[l(se,{className:`h-3.5 w-3.5 mr-1`}),`Detect from IP`]}),h===null?null:l(D,{type:`button`,variant:`ghost`,disabled:S,onClick:y,children:`Clear`})]}),p===null?null:l(`p`,{className:`text-xs text-danger`,children:p}),l(`p`,{className:`text-xs text-muted-foreground`,children:`WGS84 decimal degrees. Detect asks a public geo-IP service once and will not overwrite a value you typed — clear it first.`})]})}function xt(){let{nodes:e,isLoading:t}=ue(),r=e.find(e=>e.isHub&&e.isOnline),i=r?.addons.map(e=>e.addonId)??[];return n(V,{children:[l(bt,{}),t?l(`div`,{className:`text-muted-foreground text-sm py-12 text-center`,children:`Loading hub topology…`}):r?i.length===0?l(`div`,{className:`text-muted-foreground text-sm py-12 text-center`,children:`No addons installed on the hub yet.`}):l(Fe,{nodeId:r.id,addonIds:i,level:`global`}):n(`div`,{className:`flex flex-col items-center justify-center text-muted-foreground text-sm gap-2 py-12`,children:[l(L,{className:`h-8 w-8 opacity-30`}),l(`p`,{children:`No online hub node found.`}),l(`p`,{className:`text-xs`,children:`Settings will appear once the hub is reachable.`})]})]})}function St(){return l(`div`,{className:`flex flex-col p-2 sm:p-4`,children:l(Ie,{defaultTab:`settings`,tabs:[{id:`settings`,label:`Settings`,icon:L,content:l(xt,{})},{id:`secrets`,label:`Secrets`,icon:z,content:l(yt,{}),ownedParams:[`view`]},{id:`capabilities`,label:`Capabilities`,icon:A,content:l(qe,{})}]})})}export{St as SystemPage};
|