@camstack/addon-admin-ui 1.2.425 → 1.2.426

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/dist/assets/{AddonAssetIcon-CYCgFnh-.js → AddonAssetIcon-1n6JfETw.js} +1 -1
  2. package/dist/assets/Addons-DcQF2HWV.js +4 -0
  3. package/dist/assets/{AdminPage-250c5IIz.js → AdminPage-BayHfBSO.js} +1 -1
  4. package/dist/assets/{AdminSectionedPage-Bx9l4jGV.js → AdminSectionedPage-9IY48UKI.js} +1 -1
  5. package/dist/assets/{AiProfiles-CUuAciGa.js → AiProfiles-CP8RCOWa.js} +1 -1
  6. package/dist/assets/{BrokerForm-nkI-Qcl_.js → BrokerForm-CVQRFpTU.js} +1 -1
  7. package/dist/assets/Build-mKTtALNy.js +40 -0
  8. package/dist/assets/{Calendars-B5LzurzV.js → Calendars-63ZesTzm.js} +1 -1
  9. package/dist/assets/{Cluster-BRfEOot0.js → Cluster-1D-vyKfY.js} +1 -1
  10. package/dist/assets/{ClusterStepModel-RbVpM7O6.js → ClusterStepModel-T7xQsXN8.js} +1 -1
  11. package/dist/assets/CompositionEditor-BRCQx5kS.js +1 -0
  12. package/dist/assets/{CompositionEditorPage-Dwc53zIU.js → CompositionEditorPage-BrPXl60f.js} +1 -1
  13. package/dist/assets/{Data-w3RkRs0J.js → Data-CuarRBth.js} +1 -1
  14. package/dist/assets/{DeviceDetail-De_43vZZ.js → DeviceDetail-I4ZB53GH.js} +2 -2
  15. package/dist/assets/{DeviceDoActionFields-GnzcNn1m.js → DeviceDoActionFields-crgCrJSp.js} +1 -1
  16. package/dist/assets/{Devices-CPzgp4KM.js → Devices-BGcheInk.js} +1 -1
  17. package/dist/assets/{EmbedPlayerPage-f4jubzvX.js → EmbedPlayerPage-DZve5q4n.js} +1 -1
  18. package/dist/assets/{Identity-CAsJZhy-.js → Identity-OZbZYHE_.js} +1 -1
  19. package/dist/assets/{IntegrationDetail-DVzyFVQi.js → IntegrationDetail-wgO85DgR.js} +1 -1
  20. package/dist/assets/IntegrationHub-B1IIsNvb.js +1 -0
  21. package/dist/assets/{Integrations-DYJZbIJb.js → Integrations-BJ8YilHM.js} +1 -1
  22. package/dist/assets/Integrations-D1TLRWe3.js +1 -0
  23. package/dist/assets/{Library-CuaDA83A.js → Library-BB99yEEE.js} +1 -1
  24. package/dist/assets/Locations-qkPy4yUO.js +3 -0
  25. package/dist/assets/Logs-kaf6YI9u.js +1 -0
  26. package/dist/assets/{MotionZonesSettings-sQ16MBx7.js → MotionZonesSettings-ZKRlA5gv.js} +1 -1
  27. package/dist/assets/MyAccess-DJMmxXtZ.js +2 -0
  28. package/dist/assets/{Network-gdhbKSd3.js → Network-CpWThxQe.js} +1 -1
  29. package/dist/assets/NodeAddonsSettingsPanel-D4T6WpHA.js +1 -0
  30. package/dist/assets/Notifications-B4AABX6U.js +1 -0
  31. package/dist/assets/{PrivacyMaskSettings-ck5SNB0S.js → PrivacyMaskSettings-DzwxrD1B.js} +1 -1
  32. package/dist/assets/{Recordings-C_wXXKNm.js → Recordings-BGHR8x4_.js} +1 -1
  33. package/dist/assets/{ScanNetworkModal-DL_B-AVn.js → ScanNetworkModal-BBFG95i_.js} +1 -1
  34. package/dist/assets/{SceneMonitorEditor-8CpDpVOM.js → SceneMonitorEditor-MMVFnPh6.js} +1 -1
  35. package/dist/assets/{SessionsList-DZBaHZJv.js → SessionsList-B-ST9nsT.js} +1 -1
  36. package/dist/assets/{Showroom-CaiMghAf.js → Showroom-D3SvRPvv.js} +1 -1
  37. package/dist/assets/{System-DBkSQMrh.js → System-BjDn5cIv.js} +1 -1
  38. package/dist/assets/{Terminal-C6_w6IRM.js → Terminal-Cd68HdDW.js} +1 -1
  39. package/dist/assets/{Viewer-ClJ6Xfm_.js → Viewer-BtdOcDPJ.js} +1 -1
  40. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DUcH4sBh.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-Db4GEmHF.js} +1 -1
  41. package/dist/assets/{addon-icons-context-_Q-TMhpS.js → addon-icons-context-DeAZhH9N.js} +1 -1
  42. package/dist/assets/{archive-5Mi3cn4y.js → archive-CIl2Clyv.js} +1 -1
  43. package/dist/assets/{authed-media-CIBSu5eS.js → authed-media-DEosobUG.js} +1 -1
  44. package/dist/assets/{bell-off-O6w2Rfx2.js → bell-off-DlTo6h_B.js} +1 -1
  45. package/dist/assets/{boxes-gwiYF6bh.js → boxes-BT3FYBTS.js} +1 -1
  46. package/dist/assets/circle-slash-wO8v909U.js +1 -0
  47. package/dist/assets/client-D-ClAw3a.js +358 -0
  48. package/dist/assets/{cloud-upload-BkkCpA1A.js → cloud-upload-FFgr-Bus.js} +1 -1
  49. package/dist/assets/crop-AF56iSVW.js +1 -0
  50. package/dist/assets/{device-integration-icon-CPrOtTLY.js → device-integration-icon-DULhoOk4.js} +1 -1
  51. package/dist/assets/device-picker-model-BWYGPnze.js +1 -0
  52. package/dist/assets/dist-BDlPgqtC.js +358 -0
  53. package/dist/assets/{dist-CJ-8B9yY.js → dist-Kz53UTaO.js} +1 -1
  54. package/dist/assets/{eraser-TGwVVn87.js → eraser-B4ziYD-z.js} +1 -1
  55. package/dist/assets/{file-up-BGAdeddG.js → file-up-Dm9E2rU8.js} +1 -1
  56. package/dist/assets/{hard-drive-download-srWFcoIp.js → hard-drive-download-DmAkyZu-.js} +1 -1
  57. package/dist/assets/{history-BuUr8Pf8.js → history-B7Br9-pG.js} +1 -1
  58. package/dist/assets/{hostInit-DWnakaq9.js → hostInit-D2KXxrgo.js} +1 -1
  59. package/dist/assets/{icons-DrL-Fdok.js → icons-CCewF9ms.js} +1 -1
  60. package/dist/assets/{index-D7FGxQMl.js → index-DFK8wKFu.js} +3 -3
  61. package/dist/assets/{key-B0MTvYot.js → key-ZXEHTEbP.js} +1 -1
  62. package/dist/assets/{key-round-Cl-qLeAZ.js → key-round-S9D6eShB.js} +1 -1
  63. package/dist/assets/{layers-Df1aeR99.js → layers-oP1uhEhI.js} +1 -1
  64. package/dist/assets/{list-ordered-BzkisKLy.js → list-ordered-DIyB2-8L.js} +1 -1
  65. package/dist/assets/{location-owned-usage-CVdW20Z2.js → location-owned-usage-DWEbmaK0.js} +1 -1
  66. package/dist/assets/{log-in-xkUb0jne.js → log-in-BPdhdZAD.js} +1 -1
  67. package/dist/assets/{memory-stick-C4-nNgvT.js → memory-stick-BQg97R_B.js} +1 -1
  68. package/dist/assets/{message-square-plus-B2M8qlsN.js → message-square-plus-BSNGyUpm.js} +1 -1
  69. package/dist/assets/{mf-entry-bootstrap-0-cd3d1253.js → mf-entry-bootstrap-0-96997ff0.js} +2 -2
  70. package/dist/assets/{mic-off-C-BZDmBY.js → mic-off-Dzx4N9nb.js} +1 -1
  71. package/dist/assets/{monitor-off-DeEjoNtE.js → monitor-off-Bewl4xJ0.js} +1 -1
  72. package/dist/assets/{monitor-smartphone-DmzFXiIW.js → monitor-smartphone-BBqLfRLn.js} +1 -1
  73. package/dist/assets/mount-BWYGPnze.js +1 -0
  74. package/dist/assets/{notification-schedule-field-BDMeSniX.js → notification-schedule-field-B_e7occL.js} +1 -1
  75. package/dist/assets/{octagon-alert-AbeyZo0w.js → octagon-alert-CyhdXSRT.js} +1 -1
  76. package/dist/assets/{player-overlays-DEJGWVeQ.js → player-overlays-V9UtVzaL.js} +1 -1
  77. package/dist/assets/{recycle-Cg5L5URL.js → recycle-Bk1hihs6.js} +1 -1
  78. package/dist/assets/remoteEntry-B7VRbZTK.js +1 -0
  79. package/dist/assets/{scan-eye-QKQlUjSj.js → scan-eye-B2rYni8O.js} +1 -1
  80. package/dist/assets/{scissors-CixnGpmu.js → scissors-CYNXjLiq.js} +1 -1
  81. package/dist/assets/{search-x-Cjg-NClW.js → search-x-CBruBHBg.js} +1 -1
  82. package/dist/assets/{send-C_JQVC2l.js → send-DroR6ITx.js} +1 -1
  83. package/dist/assets/{settings-2-0Dzmg5ID.js → settings-2-B61v9YLv.js} +1 -1
  84. package/dist/assets/{speaker-D_GGxoIS.js → speaker-D-Jov9sv.js} +1 -1
  85. package/dist/assets/{src-CVCI1YgT.js → src-0C0o0YVH.js} +8 -8
  86. package/dist/assets/{timer-reset-DbjUS-e3.js → timer-reset-C8in2gzS.js} +1 -1
  87. package/dist/assets/{ungroup-Bn_PEJ2F.js → ungroup-CHnEC_da.js} +1 -1
  88. package/dist/assets/{unlink-C2XiU97D.js → unlink-CslfTlgU.js} +1 -1
  89. package/dist/assets/{usb-Yb2y3179.js → usb-B5CzoN_q.js} +1 -1
  90. package/dist/assets/{use-scenes-feed-Bg10fjvd.js → use-scenes-feed-Dm82V1NT.js} +1 -1
  91. package/dist/assets/{use-stationary-objects-BE7lNV-s.js → use-stationary-objects-CgauQ_lU.js} +1 -1
  92. package/dist/assets/useEventInvalidation-BWYGPnze.js +1 -0
  93. package/dist/assets/{useNodeUrlSelection-DVvZOo0G.js → useNodeUrlSelection-gZ1IWqyB.js} +1 -1
  94. package/dist/assets/user-round-B5fwfTG9.js +1 -0
  95. package/dist/assets/{user-x-HpPBhUXj.js → user-x-x2vSZ8z0.js} +1 -1
  96. package/dist/assets/{video-47m9GMk0.js → video-pPaTYzzY.js} +1 -1
  97. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BHVW3f4G.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DOjtJ7CO.js} +2 -2
  98. package/dist/index.html +9 -9
  99. package/dist/server/addon.js +34 -5
  100. package/package.json +1 -1
  101. package/dist/assets/Addons-BrNO-gNV.js +0 -4
  102. package/dist/assets/Build-BKUHKW99.js +0 -40
  103. package/dist/assets/CompositionEditor-paHohkHN.js +0 -1
  104. package/dist/assets/IntegrationHub-Bufk1Dn6.js +0 -1
  105. package/dist/assets/Integrations-CrWX5s2l.js +0 -1
  106. package/dist/assets/Locations-DC7Mbk0N.js +0 -3
  107. package/dist/assets/Logs-B3gxHPJx.js +0 -1
  108. package/dist/assets/MyAccess-Dk-eK9Ik.js +0 -2
  109. package/dist/assets/NodeAddonsSettingsPanel-Dh4z-QGr.js +0 -1
  110. package/dist/assets/Notifications-CP3XZDYw.js +0 -1
  111. package/dist/assets/circle-slash-LeaAcO0Z.js +0 -1
  112. package/dist/assets/client-Cm-sr0wc.js +0 -358
  113. package/dist/assets/crop-CSoFpLsd.js +0 -1
  114. package/dist/assets/device-picker-model-DSRwVBTr.js +0 -1
  115. package/dist/assets/dist-DH3WcYkO.js +0 -358
  116. package/dist/assets/mount-DSRwVBTr.js +0 -1
  117. package/dist/assets/remoteEntry-Cdw06LwW.js +0 -1
  118. package/dist/assets/useEventInvalidation-DSRwVBTr.js +0 -1
  119. package/dist/assets/user-round-Bn5beI9W.js +0 -1
@@ -1 +0,0 @@
1
- import{Q as e,S as t,W as n,q as r,x as i}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{Qi as a,ar as o,bi as s,fn as c,wi as l}from"./player-overlays-DEJGWVeQ.js";import{n as u,t as d}from"./timer-reset-DbjUS-e3.js";import{t as f}from"./layers-Df1aeR99.js";import{Dr as p,Er as m,Tt as h,al as g,du as _,sl as v}from"./src-CVCI1YgT.js";import{t as y}from"./useTranslation-Bc5yH9V9.js";import{C as b,c as x,s as S}from"./index-D7FGxQMl.js";import{t as C}from"./AdminSectionedPage-Bx9l4jGV.js";import{t as w}from"./AdminPage-250c5IIz.js";import{n as T,t as E}from"./IntegrationHub-Bufk1Dn6.js";import{n as D,t as O}from"./addon-display-names-BkwMrExv.js";e();var k=5e3,A=`log-destination`,j={"winston-logging":`Rotated log files on this node’s disk.`,"console-logging":`stdout / stderr of the node process.`,"loki-logging":`Pushes to a Grafana Loki instance. Off until enabled with a URL.`,"hub-forwarder":`Agent-only — forwards this node’s entries to the hub.`};function M(){let e=p({capName:`log-destination`},{refetchInterval:k}),t=m(void 0,{refetchInterval:k}),r=n(()=>O(t.data??[]),[t.data]),a=n(()=>{let e=new Map;for(let n of t.data??[]){let t=n.description,r=n.id;typeof r==`string`&&typeof t==`string`&&t.length>0&&e.set(r,t)}return e},[t.data]),o=n(()=>(e.data??[]).map(e=>({addonId:e.addonId,displayName:r.get(e.addonId)??e.addonId,isActive:e.isActive,caption:a.get(e.addonId)??j[e.addonId]??``})),[e.data,r,a]);return i(E,{embedded:!0,icon:c,title:`Destinations`,subtitle:`Every registered log destination. Entries are fanned to all enabled destinations at once — enabling one does not disable another.`,groups:[{id:A,label:`Log destinations`,install:{capability:A,label:`Add destination`},entries:o.map(e=>({id:e.addonId,name:e.displayName,fallbackIcon:u,...D(e.isActive),render:()=>i(T,{addonId:e.addonId,displayName:e.displayName,capName:A,isActive:e.isActive,badges:e.caption.length>0?i(`span`,{className:`text-[11px] text-foreground-subtle`,children:e.caption}):null})}))}],isLoading:e.isLoading,emptyTitle:`No log destinations registered`,emptyDescription:`This should not happen — the console and rotated-file destinations are builtins. If the list is empty, the node is still booting.`})}e();var N=[12e4,3e5,6e5,18e5],P={"request-census":`Counts every tRPC call by TRANSPORT PLANE — http, ws, mesh — and by procedure, caller, address and user-agent. Subscriptions are counted apart from calls, so a long-lived stream cannot pass for a storm. Arm it, then restart: the deadline is persisted, so the window is still running when clients reconnect.`};function F(){let{t:e}=y(),n=g({},{refetchInterval:5e3}),s=v(),[c,l]=r(null),u=(e,t)=>{l(e),s.mutate({patch:{diagnostics:[{id:e,armMs:t}]}},{onSettled:()=>{l(null),n.refetch()}})},d=n.data?.activeWindows??[],f=n.data?.channels??[],p=n.data?.activeChannels??[],m=(e,t,r)=>{l(e),s.mutate({patch:{channels:[{channel:e,armMs:t,deviceIds:r}]}},{onSettled:()=>{l(null),n.refetch()}})};return t(w,{embedded:!0,icon:a,title:e(`logging.diagnostics.title`,`Diagnostics`),subtitle:e(`logging.diagnostics.subtitle`,`Diagnostics are armed for a window, never switched on. Each carries a deadline and expires by itself — one left running is an incident of its own.`),children:[n.isLoading?t(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[i(o,{className:`h-3.5 w-3.5 animate-spin`}),e(`common.loading`,`Loading…`)]}):i(`div`,{className:`rounded-lg border border-border bg-surface divide-y divide-border`,children:d.map(e=>i(L,{window:e,busy:c===e.id,onArm:t=>u(e.id,t)},e.id))}),i(`h3`,{className:`mt-6 text-sm font-medium text-foreground`,children:e(`logging.diagnostics.channels`,`Component channels`)}),i(`p`,{className:`mb-2 max-w-3xl text-[11px] text-foreground-subtle`,children:e(`logging.diagnostics.channelsSubtitle`,`Declared by the addons that own them — this list is not maintained by hand. Arming a channel opens a window with a deadline; it closes by itself.`)}),f.length===0?i(`p`,{className:`text-[11px] text-foreground-subtle`,children:e(`logging.diagnostics.noChannels`,`No addon on this cluster declares a log channel, or none could be reached right now.`)}):i(`div`,{className:`rounded-lg border border-border bg-surface divide-y divide-border`,children:f.map(e=>i(I,{channel:e,state:p.find(t=>t.channel===e.name),busy:c===e.name,onArm:(t,n)=>m(e.name,t,n)},e.name))})]})}function I({channel:e,state:n,busy:a,onArm:o}){let{t:s}=y(),[c,u]=r(``),f=n?.armed===!0,p=()=>{let e=c.split(/[\s,+]+/).filter(e=>/^\d+$/.test(e)).map(e=>Number(e));return e.length>0?e:null};return t(`div`,{className:`flex flex-col gap-2 p-3 lg:flex-row lg:items-center lg:justify-between`,children:[t(`div`,{className:`min-w-0`,children:[t(`div`,{className:`flex flex-wrap items-center gap-2`,children:[i(`span`,{className:`text-sm font-medium text-foreground`,children:e.name}),f?t(`span`,{className:`inline-flex items-center gap-1 rounded bg-warning/10 px-1.5 py-0.5 text-[10px] font-semibold text-warning`,children:[i(d,{className:`h-3 w-3`}),s(`logging.diagnostics.expiresIn`,`expires in {{left}}`,{left:R(n?.remainingMs??0)})]}):i(`span`,{className:`rounded border border-border px-1.5 py-0.5 text-[10px] text-foreground-subtle`,children:s(`logging.diagnostics.disarmed`,`disarmed`)}),f&&n?.deviceIds!==null&&n?.deviceIds!==void 0&&t(`span`,{className:`inline-flex items-center gap-1 rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-semibold text-primary`,children:[i(l,{className:`h-3 w-3`}),n.deviceIds.join(`, `)]}),!e.perDevice&&i(`span`,{className:`rounded border border-border px-1.5 py-0.5 text-[10px] text-foreground-subtle`,children:s(`logging.diagnostics.notPerCamera`,`not filterable per camera`)})]}),i(`p`,{className:`mt-0.5 max-w-2xl text-[11px] text-foreground-subtle`,children:e.description})]}),t(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1`,children:[e.perDevice&&i(`input`,{type:`text`,inputMode:`numeric`,value:c,disabled:a,onChange:e=>u(e.target.value),placeholder:s(`logging.diagnostics.camerasPlaceholder`,`all cameras`),className:`w-28 rounded border border-border bg-surface px-2 py-1 text-[11px] text-foreground`}),N.map(e=>i(`button`,{type:`button`,disabled:a,onClick:()=>o(e,p()),className:`rounded border border-border px-2 py-1 text-[11px] text-foreground-subtle hover:text-foreground disabled:opacity-50`,children:R(e)},e)),i(`button`,{type:`button`,disabled:a||!f,onClick:()=>o(0,null),className:`rounded bg-primary px-2 py-1 text-[11px] font-medium text-primary-foreground disabled:opacity-40`,children:s(`logging.diagnostics.disarm`,`Disarm`)})]})]})}function L({window:e,busy:n,onArm:r}){let{t:a}=y();return t(`div`,{className:`flex flex-col gap-2 p-3 lg:flex-row lg:items-center lg:justify-between`,children:[t(`div`,{className:`min-w-0`,children:[t(`div`,{className:`flex items-center gap-2`,children:[i(`span`,{className:`text-sm font-medium text-foreground`,children:e.id}),e.armed?t(`span`,{className:`inline-flex items-center gap-1 rounded bg-warning/10 px-1.5 py-0.5 text-[10px] font-semibold text-warning`,children:[i(d,{className:`h-3 w-3`}),a(`logging.diagnostics.expiresIn`,`expires in {{left}}`,{left:R(e.remainingMs)})]}):i(`span`,{className:`rounded border border-border px-1.5 py-0.5 text-[10px] text-foreground-subtle`,children:a(`logging.diagnostics.disarmed`,`disarmed`)}),e.armed&&!e.persisted&&i(`span`,{className:`text-[10px] text-warning`,children:a(`logging.diagnostics.notPersisted`,`not persisted — will not survive a restart`)})]}),i(`p`,{className:`mt-0.5 max-w-2xl text-[11px] text-foreground-subtle`,children:P[e.id]??``})]}),t(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1`,children:[N.map(e=>i(`button`,{type:`button`,disabled:n,onClick:()=>r(e),className:`rounded border border-border px-2 py-1 text-[11px] text-foreground-subtle hover:text-foreground disabled:opacity-50`,children:R(e)},e)),i(`button`,{type:`button`,disabled:n||!e.armed,onClick:()=>r(0),className:`rounded bg-primary px-2 py-1 text-[11px] font-medium text-primary-foreground disabled:opacity-40`,children:a(`logging.diagnostics.disarm`,`Disarm`)})]})]})}function R(e){let t=Math.max(0,Math.round(e/1e3)),n=Math.floor(t/60),r=t%60;return n===0?`${r}s`:r===0?`${n}m`:`${n}m ${r}s`}e();var z=[`debug`,`info`,`warn`,`error`],B=``,V=``;function H(){let{t:e}=y(),[a,s]=r(B),[c,l]=r(V),{nodes:u}=_(),d=n(()=>u.map(e=>({id:e.id,label:e.name||e.id})),[u]),p=g({...a===B?{}:{scopeNodeId:a},...c===V?{}:{scopeComponent:c}},{refetchInterval:15e3}),m=v(),h=p.data,b=m.isPending||p.isFetching,x=h?.channels??[],S=(e,t)=>{m.mutate({...e.nodeId===null?{}:{scopeNodeId:e.nodeId},...e.component===null?{}:{scopeComponent:e.component},patch:{level:t}},{onSuccess:()=>void p.refetch()})};return i(w,{embedded:!0,icon:f,title:e(`logging.levels.title`,`Levels`),subtitle:e(`logging.levels.subtitle`,`Cluster → node, most specific wins. The floor gates what reaches the log destinations; the in-memory viewer keeps every line either way.`),actions:t(`div`,{className:`flex flex-wrap items-center gap-3`,children:[t(`label`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[e(`logging.levels.scope`,`Scope`),t(`select`,{className:`rounded border border-border bg-surface px-2 py-1 text-xs text-foreground disabled:opacity-50`,value:a,disabled:c!==V,onChange:e=>s(e.target.value),children:[i(`option`,{value:B,children:e(`logging.levels.cluster`,`Cluster`)}),d.map(e=>i(`option`,{value:e.id,children:e.label},e.id))]})]}),t(`label`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[e(`logging.levels.component`,`Component`),t(`select`,{className:`rounded border border-border bg-surface px-2 py-1 text-xs text-foreground`,value:c,onChange:e=>l(e.target.value),children:[i(`option`,{value:V,children:e(`logging.levels.noComponent`,`None`)}),x.map(e=>i(`option`,{value:e.name,children:e.name},e.name))]})]})]}),children:p.isLoading||h===void 0?t(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[i(o,{className:`h-3.5 w-3.5 animate-spin`}),e(`common.loading`,`Loading…`)]}):t(`div`,{className:`space-y-3`,children:[i(W,{level:h.effective.level,source:h.effective.levelSource,persisted:h.persisted}),i(`div`,{className:`rounded-lg border border-border bg-surface divide-y divide-border`,children:h.explicit.layers.map(e=>i(G,{layer:e,inForce:e.scope===h.effective.levelSource,busy:b,onSet:t=>S(e,t),onClear:()=>S(e,null)},`${e.scope}:${e.nodeId??e.component??`cluster`}`))}),c!==V&&i(`p`,{className:`text-[11px] text-foreground-subtle`,children:x.find(e=>e.name===c)?.description??``}),i(`p`,{className:`text-[11px] text-foreground-subtle`,children:e(`logging.levels.componentNote`,`A component is a log channel an addon declared. Its level is cluster-wide and beats both the node and the cluster layer.`)}),i(U,{days:h.opsLogRetentionDays,busy:b,onSet:e=>m.mutate({patch:{opsLogRetentionDays:e}},{onSuccess:()=>void p.refetch()})})]})})}function U({days:e,busy:n,onSet:r}){let{t:a}=y();return t(`div`,{className:`rounded-lg border border-border bg-surface p-3 space-y-1`,children:[t(`label`,{className:`flex items-center justify-between gap-3`,children:[i(`span`,{className:`text-xs font-medium`,children:a(`logging.levels.opsLogRetention`,`Retention audit trail`)}),t(`span`,{className:`flex items-center gap-1.5`,children:[i(`input`,{type:`number`,min:0,max:3650,step:1,defaultValue:e,disabled:n,onBlur:t=>{let n=Number.parseInt(t.target.value,10);Number.isFinite(n)&&n!==e&&r(n)},className:`w-20 rounded border border-border bg-surface px-2 py-1 text-xs`}),i(`span`,{className:`text-[11px] text-foreground-subtle`,children:a(`common.days`,`days`)})]})]}),i(`p`,{className:`text-[11px] text-foreground-subtle`,children:a(`logging.levels.opsLogRetentionNote`,`How long the record of what retention deleted is kept. Cluster-wide, and deliberately longer than any camera window — it is the history of the sweep, not of the camera, and it is what makes a storage leak explainable after the fact. 0 keeps it forever.`)})]})}function W({level:e,source:n,persisted:r}){let{t:a}=y();return t(`div`,{className:`rounded-lg border border-border bg-surface p-3`,children:[t(`div`,{className:`flex items-center gap-2`,children:[i(`span`,{className:`text-xs text-foreground-subtle`,children:a(`logging.levels.effective`,`In force here`)}),i(`span`,{className:`rounded bg-primary/10 px-2 py-0.5 text-xs font-semibold text-primary`,children:e}),i(`span`,{className:`text-[11px] text-foreground-subtle`,children:n==="default"?a(`logging.levels.fromDefault`,`nothing is set anywhere — this is the default`):a(`logging.levels.fromLayer`,`decided by the {{source}} layer`,{source:n})})]}),!r&&i(`p`,{className:`mt-1 text-[11px] text-warning`,children:a(`logging.levels.notPersisted`,`The settings store could not be read or written — what you see is live, but it would not survive a restart.`)})]})}function G({layer:e,inForce:n,busy:r,onSet:a,onClear:o}){let{t:c}=y();return t(`div`,{className:`flex flex-col gap-2 p-3 sm:flex-row sm:items-center sm:justify-between`,children:[t(`div`,{className:`min-w-0`,children:[t(`div`,{className:`flex items-center gap-2`,children:[i(`span`,{className:`text-sm font-medium text-foreground`,children:e.scope===`cluster`?c(`logging.levels.cluster`,`Cluster`):e.scope===`component`?e.component??``:e.nodeId??``}),n&&t(`span`,{className:`inline-flex items-center gap-1 rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-semibold text-primary`,children:[i(s,{className:`h-3 w-3`}),c(`logging.levels.inForce`,`in force`)]})]}),i(`p`,{className:`mt-0.5 text-[11px] text-foreground-subtle`,children:e.level===null?c(`logging.levels.inherits`,`inherits — nothing set at this layer`):c(`logging.levels.setHere`,`set here: {{level}}`,{level:e.level})})]}),t(`div`,{className:`flex shrink-0 items-center gap-1`,children:[z.map(t=>i(`button`,{type:`button`,disabled:r,onClick:()=>a(t),className:`rounded px-2 py-1 text-[11px] font-medium transition-colors disabled:opacity-50 ${e.level===t?`bg-primary text-primary-foreground`:`border border-border text-foreground-subtle hover:text-foreground`}`,children:t},t)),i(`button`,{type:`button`,disabled:r||e.level===null,onClick:o,className:`rounded border border-border px-2 py-1 text-[11px] text-foreground-subtle hover:text-foreground disabled:opacity-40`,children:c(`logging.levels.clear`,`Clear`)})]})]})}function K(){return i(w,{embedded:!0,children:i(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:i(h,{limit:500,maxHeight:`max-h-[calc(100vh-310px)]`,showScope:!0,showFilters:!0})})})}function q(){let{t:e}=y(),t=b(`/system/logs`,{t:e,isAdmin:!0})??{icon:c,title:e(`system.logs`,`Logs`)};return i(C,{icon:t.icon,title:t.title,defaultSection:`viewer`,sectionsLabel:`${t.title} sections`,sections:[{id:`viewer`,label:`Viewer`,content:i(K,{})},{id:x.logging.tab,label:`Destinations`,content:i(M,{}),ownedParams:S},{id:`levels`,label:`Levels`,content:i(H,{})},{id:`diagnostics`,label:`Diagnostics`,content:i(F,{})}]})}export{q as LogsPage};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./browser-BHo8W_uH.js","./rolldown-runtime-Cyuzqnbw.js"])))=>i.map(i=>d[i]);
2
- import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{t}from"./vite-preload-helper-kNaey6uv.js";import{K as n,Q as r,S as i,W as a,a as o,b as s,q as c,t as l,x as u,z as d}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{Hi as f,Ir as p,It as m,Nt as h,Pn as g,Q as _,Qt as v,Yr as y,ar as b,cr as x,fi as S,nr as C,ot as w,pi as T,pr as E}from"./player-overlays-DEJGWVeQ.js";import{o as D}from"./video-47m9GMk0.js";import{t as O}from"./key-round-Cl-qLeAZ.js";import{t as k}from"./monitor-smartphone-DmzFXiIW.js";import{t as A}from"./unlink-C2XiU97D.js";import{Kn as j,qn as M}from"./client-Cm-sr0wc.js";import{Bn as ee,Cn as te,Do as ne,Ft as re,Gl as N,Wn as ie,Z as ae,Zn as P,gu as F,ko as oe,wn as se}from"./src-CVCI1YgT.js";import{t as I}from"./useTranslation-Bc5yH9V9.js";import"./mount-DSRwVBTr.js";import{R as L,i as R,n as z,r as B,t as V}from"./index-D7FGxQMl.js";import{t as H}from"./AdminPage-250c5IIz.js";import{N as U,P as W,_ as G,a as K,g as ce,k as le,r as ue,t as de,v as q}from"./SessionsList-DZBaHZJv.js";r();function fe({value:n,size:r=192}){let[a,o]=c(null),[s,l]=c(null);if(d(()=>{let r=!1;return t(()=>import(`./browser-BHo8W_uH.js`).then(t=>e(t.default,1)).then(async e=>{if(r)return;let t=e.create;if(typeof t!=`function`){l(`qrcode.create() unavailable in installed version`);return}try{let e=t(n,{errorCorrectionLevel:`M`});r||o(e)}catch(e){r||l(e instanceof Error?e.message:`QR generation failed`)}}),__vite__mapDeps([0,1]),import.meta.url).catch(()=>{r||l(`qrcode library not installed`)}),()=>{r=!0}},[n]),s)return u(`div`,{className:`flex items-center justify-center text-[10px] text-foreground-subtle text-center p-4`,style:{width:r,height:r},children:`QR rendering unavailable — use the secret below.`});if(!a)return u(`div`,{className:`flex items-center justify-center text-[10px] text-foreground-subtle animate-pulse`,style:{width:r,height:r},children:`Generating…`});let f=a.modules.size,p=r/f,m=[];for(let e=0;e<f;e++)for(let t=0;t<f;t++)a.modules.data[e*f+t]&&m.push(u(`rect`,{x:t*p,y:e*p,width:p,height:p,fill:`currentColor`},`${t}-${e}`));return i(`svg`,{width:r,height:r,viewBox:`0 0 ${r} ${r}`,className:`text-black`,children:[u(`rect`,{x:0,y:0,width:r,height:r,fill:`white`}),m]})}var pe=`${j}/connect`,J={public:0,mesh:1,lan:2,"lan-ipv6":3};function me(e){switch(e.kind){case`public`:return e.interfaceKind===`vpn`?`mesh`:`public`;case`lan-ipv4`:return`lan`;case`lan-ipv6`:return`lan-ipv6`;case`custom`:return`public`;case`loopback`:case`app-link`:return null}}function Y(e){return M(e)}function he(e){return e.startsWith(`https://`)}function ge(e){let t=e.flatMap(e=>{let t=me(e),n=Y(e.baseUrl);return t===null||n===null?[]:[{endpoint:e,tier:t,origin:n}]}).toSorted((e,t)=>J[e.tier]-J[t.tier]||Number(t.endpoint.plausible)-Number(e.endpoint.plausible)||e.endpoint.priority-t.endpoint.priority),n=new Set;return t.flatMap(({endpoint:e,tier:t,origin:r})=>n.has(r)?[]:(n.add(r),[{origin:r,label:e.label,tier:t,secure:he(r),plausible:e.plausible}]))}function _e(e,t,n=null){for(let r of[t,n]){if(r===null)continue;let t=Y(r),n=e.find(e=>e.origin===t);if(n!==void 0)return n}return e[0]??null}function ve(e){let t=new URL(pe);return t.searchParams.set(`hub`,e),t.toString()}r();var ye=176,X={scheme:`https`};function be(){let{t:e}=I(),t=oe(X),n=ne(X).data?.roles.publicEndpoint.resolved??null;return i(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[i(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[u(v,{className:`h-3.5 w-3.5 text-foreground-subtle`}),u(`div`,{className:`text-xs font-semibold text-foreground`,children:e(`connectPhone.title`)})]}),i(`div`,{className:`p-4 space-y-3`,children:[u(`p`,{className:`text-[11px] text-foreground-subtle`,children:e(`connectPhone.description`)}),t.isPending?i(`div`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle`,children:[u(b,{className:`h-3.5 w-3.5 animate-spin`}),e(`connectPhone.loading`)]}):t.isError?i(`div`,{className:`flex items-start gap-2 text-[11px] text-danger`,children:[u(h,{className:`h-3.5 w-3.5 mt-0.5 shrink-0`}),i(`div`,{className:`flex-1 min-w-0 space-y-1.5`,children:[u(`div`,{className:`break-words`,children:e(`connectPhone.error`,{message:t.error.message})}),u(ee,{size:`sm`,variant:`ghost`,onClick:()=>void t.refetch(),children:e(`connectPhone.retry`)})]})]}):u(xe,{candidates:ge(t.data.endpoints),preferredOrigin:n})]})]})}function xe({candidates:e,preferredOrigin:t}){let{t:n}=I(),[r,o]=c(null),s=_e(e,r,t),l=a(()=>s?ve(s.origin):null,[s]);if(s===null||l===null)return u(`p`,{className:`text-[11px] text-foreground-subtle`,children:n(`connectPhone.empty`)});let d=e=>n(`connectPhone.tier.${e}`),f=e.map(e=>({value:e.origin,label:`${d(e.tier)} — ${e.origin}`}));return i(`div`,{className:`flex flex-col sm:flex-row gap-4`,children:[u(te,{value:l,size:ye,alt:n(`connectPhone.qrAlt`),className:`self-start`}),i(`div`,{className:`flex-1 min-w-0 space-y-3`,children:[i(`label`,{className:`block space-y-1`,children:[u(`span`,{className:`text-[11px] font-medium text-foreground`,children:n(`connectPhone.addressLabel`)}),u(N,{value:s.origin,options:f,onChange:e=>o(e.target.value)}),i(`span`,{className:`block text-[10px] text-foreground-subtle`,children:[d(s.tier),` · `,s.label]})]}),!s.secure&&u(Z,{text:n(`connectPhone.insecure`)}),!s.plausible&&u(Z,{text:n(`connectPhone.implausible`)}),i(`div`,{className:`space-y-1`,children:[u(`span`,{className:`text-[11px] font-medium text-foreground`,children:n(`connectPhone.linkLabel`)}),i(`div`,{className:`flex items-center gap-1 rounded-md border border-border bg-background px-2 py-1`,children:[u(`code`,{className:`flex-1 min-w-0 font-mono text-[11px] text-foreground break-all select-all`,children:l}),u(re,{value:l,srLabel:n(`connectPhone.linkLabel`)})]})]}),u(`p`,{className:`text-[11px] text-foreground-subtle`,children:n(`connectPhone.signInHint`)})]})]})}function Z({text:e}){return i(`div`,{className:`flex items-start gap-2 rounded-md border border-warning/30 bg-warning/5 px-2.5 py-1.5 text-[11px] text-foreground`,children:[u(h,{className:`h-3.5 w-3.5 text-warning mt-0.5 shrink-0`}),u(`span`,{children:e})]})}r();function Se(e){return new Date(e).toLocaleDateString()}function Ce(){let e=P(),t=F.useUtils(),r=F.auth.listLinkableProviders.useQuery(),a=F.auth.listOwnExternalIdentities.useQuery(),[o,s]=c(null),[l,f]=c(()=>R(window.location.search)),p=n(null),m=G(`Linking a sign-in account`),h=n(null);d(()=>()=>h.current?.(),[]);let[g,v]=c(null);d(()=>{if(l===null)return;let e=new URL(window.location.href);e.searchParams.delete(`linked`),e.searchParams.delete(`linkError`),window.history.replaceState({},``,e.pathname+e.search+e.hash)},[l]);let y=F.auth.beginExternalLink.useMutation({onSuccess:({url:e})=>{let n=p.current;if(p.current=null,n===null||n.closed){window.location.assign(e);return}let r=e=>{v(null),f(R(`?${e}`)),t.auth.listOwnExternalIdentities.invalidate()};h.current?.(),h.current=z(n,{onReturn:e=>{e.target===`profile`&&r(e.query)},onDone:e=>{e.target===`profile`&&r(e.query)},onClosed:()=>{h.current?.(),h.current=null,t.auth.listOwnExternalIdentities.invalidate()}}),n.location.href=_(B(e))},onError:e=>{p.current?.close(),p.current=null,v(null),s(e.message)}}),C=F.auth.unlinkOwnExternalIdentity.useMutation({onSuccess:()=>void t.auth.listOwnExternalIdentities.invalidate(),onError:e=>s(e.message)}),w=r.data??[],E=a.data??[],D=g!==null&&E.some(e=>e.provider===g);if(d(()=>{!D||g===null||(v(null),f({kind:`linked`,provider:g}))},[D,g]),w.length===0&&E.length===0)return null;let O=new Set(E.map(e=>e.provider)),k=e=>w.find(t=>t.provider===e)?.label??e,j=async(t,n)=>{await e({title:`Unlink sign-in account`,message:`Stop signing in with this ${n} account?`,confirmLabel:`Unlink`,variant:`danger`})&&(s(null),C.mutate({provider:t.provider,subject:t.subject}))};return i(`div`,{"data-testid":`linked-sign-ins`,className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[m.dialog,i(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[u(x,{className:`h-3.5 w-3.5 text-foreground-subtle`}),u(`div`,{className:`text-xs font-semibold text-foreground`,children:`Linked sign-in accounts`})]}),i(`div`,{className:`p-4 space-y-3`,children:[u(`p`,{className:`text-[11px] text-foreground-subtle`,children:`Sign in with an external account instead of your password. Only accounts you link here can sign you in; your two-factor authentication still applies.`}),l?.kind===`linked`&&i(`div`,{className:`flex items-center gap-2 rounded-md border border-emerald-500/30 bg-emerald-500/5 px-3 py-2 text-xs text-foreground`,children:[u(S,{className:`h-3.5 w-3.5 text-emerald-500 shrink-0`}),`Linked your `,k(l.provider),` account.`]}),(l?.kind===`error`||o)&&i(`div`,{className:`flex items-center gap-2 rounded-md border border-danger/20 bg-danger/10 px-3 py-2 text-xs text-danger`,children:[u(T,{className:`h-3.5 w-3.5 shrink-0`}),o??(l?.kind===`error`?l.message:``)]}),E.length>0&&u(`ul`,{className:`divide-y divide-border rounded-md border border-border`,children:E.map(e=>{let t=e.providerLabel??e.provider;return i(`li`,{className:`flex items-center gap-3 px-3 py-2 text-xs`,children:[i(`div`,{className:`flex-1 min-w-0`,children:[i(`div`,{className:`font-medium text-foreground truncate`,children:[t,!e.available&&u(`span`,{className:`ml-2 rounded bg-foreground-subtle/15 px-1.5 py-0.5 text-[10px] font-normal text-foreground-subtle`,children:`provider unavailable`})]}),i(`div`,{className:`text-[11px] text-foreground-subtle truncate`,children:[e.label??e.subject,` · linked `,Se(e.linkedAt)]})]}),i(`button`,{onClick:()=>void j(e,t),disabled:C.isPending,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] text-danger hover:bg-danger/10 disabled:opacity-50`,children:[u(A,{className:`h-3 w-3`}),`Unlink`]})]},`${e.provider}|${e.subject}`)})}),u(`div`,{className:`flex flex-wrap gap-2`,children:w.filter(e=>!O.has(e.provider)).map(e=>i(`button`,{onClick:()=>{s(null),f(null),m.requestProof().then(t=>{t!==null&&(p.current=V(null),v(p.current===null?null:e.provider),y.mutate({provider:e.provider,reauthToken:t}))})},disabled:y.isPending,className:`inline-flex items-center gap-1.5 rounded border border-border px-2.5 py-1 text-[11px] font-medium text-foreground hover:bg-surface-hover disabled:opacity-50`,children:[y.isPending&&y.variables?.provider===e.provider?u(b,{className:`h-3 w-3 animate-spin`}):u(x,{className:`h-3 w-3`}),`Link `,e.label]},e.provider))})]})]})}r();function Q(e){return e.message.length>0?e.message:`Request failed`}function we(){let{logout:e}=L(),t=P(),n=F.useUtils(),r=F.auth.listOwnSessions.useQuery(),[a,o]=c(null),s=F.auth.revokeOwnSession.useMutation({onSuccess:()=>void n.auth.listOwnSessions.invalidate(),onError:e=>o(`Sign out failed: ${Q(e)}`)}),l=F.auth.logout.useMutation({onSuccess:()=>e(),onError:e=>o(`Sign out failed: ${Q(e)}`)}),d=async e=>{await t({title:`Sign out this session`,message:`${q(e.client).label} will have to sign in again.`,confirmLabel:`Sign out`,variant:`danger`})&&(o(null),s.mutate({id:e.id}))},f=async()=>{await t({title:`Sign out everywhere`,message:`Every session of your account ends, this browser included: you will be signed out here too and every device has to sign in again.`,confirmLabel:`Sign out everywhere`,variant:`danger`})&&(o(null),l.mutate({everywhere:!0}))};return i(`div`,{"data-testid":`my-sessions`,className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[i(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[u(k,{className:`h-3.5 w-3.5 text-foreground-subtle`}),u(`div`,{className:`text-xs font-semibold text-foreground`,children:`Active sessions`})]}),i(`div`,{className:`p-4 space-y-3`,children:[u(`p`,{className:`text-[11px] text-foreground-subtle`,children:`The browsers and apps signed in to your account. Signing one out ends it at once.`}),a!==null&&u(`div`,{className:`text-[11px] text-danger`,children:a}),u(de,{sessions:r.data??[],isLoading:r.isLoading,loadError:r.isError?r.error?.message??`Request failed`:null,emptyText:`No active sessions.`,onRevoke:e=>void d(e),revokingId:s.isPending?s.variables?.id??null:null}),u(`div`,{className:`flex justify-end`,children:i(`button`,{onClick:()=>void f(),disabled:l.isPending,className:`inline-flex items-center gap-1.5 rounded border border-danger/40 px-2.5 py-1 text-[11px] font-medium text-danger hover:bg-danger/10 disabled:opacity-50`,children:[l.isPending?u(b,{className:`h-3 w-3 animate-spin`}):u(D,{className:`h-3 w-3`}),`Sign out everywhere`]})})]})]})}r();var Te=`You`;function Ee(){let e=P(),t=F.useUtils(),n=F.auth.listOwnDeviceCredentials.useQuery(),[r,i]=c(null),o=F.auth.revokeOwnDeviceCredential.useMutation({onSuccess:e=>{e.revoked||i(`That device could not be revoked - it may already be gone.`),t.auth.listOwnDeviceCredentials.invalidate()},onError:e=>i(`Revoke failed: ${e.message}`)}),s=a(()=>(n.data??[]).map(e=>ue(e,Te)),[n.data]),l=async t=>{await e({title:`Revoke "${t.name}"?`,message:`The device stops signing in at once and its open sessions end. To use it again you have to pair it anew. This cannot be undone.`,confirmLabel:`Revoke`,variant:`danger`})&&(i(null),o.mutate({id:t.id}))},d={label:`Revoke`,icon:f,isAvailable:K,onRun:e=>void l(e),busyId:o.isPending?o.variables?.id??null:null,disabled:o.isPending};return u(U,{id:`my-devices`,title:`My devices`,icon:v,description:`Phones that stay signed in to your account with a certificate. If one is lost, revoke it here and it is signed out at once.`,notice:W(r),onDismissNotice:()=>i(null),children:u(le,{rows:s,label:`devices`,isLoading:n.isPending,loadError:n.error===null?null:n.error.message||`Request failed`,emptyText:`No devices are signed in with a certificate.`,hideOwner:!0,expiresNone:`—`,action:d})})}r();var De={view:{icon:p,cls:`bg-foreground-subtle/15 text-foreground-subtle`},create:{icon:g,cls:`bg-primary/15 text-primary`},delete:{icon:m,cls:`bg-danger/15 text-danger`}};function Oe(){let{user:e,logout:t}=L();if(!e)return u(H,{children:u(`div`,{className:`text-xs text-foreground-subtle`,children:`Not signed in.`})});let n=e.isAdmin,r=e.scopes??[];return i(H,{children:[i(`div`,{className:`rounded-lg border border-border bg-surface px-4 py-3 flex items-center gap-3`,children:[u(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-full bg-primary/10 text-primary font-semibold text-base`,children:e.username.slice(0,1).toUpperCase()}),i(`div`,{className:`flex-1 min-w-0`,children:[u(`div`,{className:`text-sm font-semibold text-foreground truncate`,children:e.username}),i(`div`,{className:`text-[11px] text-foreground-subtle`,children:[n?`Administrator`:`User`,` · session id`,` `,i(`span`,{className:`font-mono`,children:[e.id.slice(0,8),`…`]})]})]})]}),n&&i(`div`,{className:`rounded-lg border border-primary/30 bg-primary/5 px-4 py-3 text-xs text-foreground flex items-start gap-2.5`,children:[u(E,{className:`h-4 w-4 text-primary mt-0.5 shrink-0`}),i(`div`,{children:[u(`div`,{className:`font-semibold text-foreground`,children:`Unrestricted access`}),u(`p`,{className:`text-foreground-subtle mt-0.5`,children:`Admin sessions bypass the per-call scope check. Every protected endpoint is reachable regardless of the list below.`})]})]}),u(ke,{}),u(Ae,{username:e.username}),u(je,{}),u(Ce,{}),u(ce,{}),u(we,{}),u(Ee,{}),u(be,{}),r.length>0&&i(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[i(`div`,{className:`px-4 py-2 border-b border-border`,children:[u(`div`,{className:`text-xs font-semibold text-foreground`,children:`Granted scopes`}),u(`div`,{className:`text-[10px] text-foreground-subtle`,children:`Baked into your session token at login; sign out + back in to refresh after changes.`})]}),i(`div`,{className:`grid grid-cols-[100px_1fr_240px] gap-3 px-4 py-2 text-[10px] uppercase tracking-wide text-foreground-subtle border-b border-border`,children:[u(`div`,{children:`Type`}),u(`div`,{children:`Target`}),u(`div`,{children:`Access`})]}),u(`ul`,{className:`divide-y divide-border`,children:r.map((e,t)=>i(`li`,{className:`grid grid-cols-[100px_1fr_240px] gap-3 px-4 py-2.5 items-center text-xs`,children:[u(`span`,{className:`font-mono text-foreground-subtle`,children:e.type}),u(`span`,{className:`font-mono text-foreground`,children:e.type===`device`?ae(e.selector):e.target}),u(`div`,{className:`flex items-center gap-1`,children:[`view`,`create`,`delete`].map(t=>{let n=e.access.includes(t),{icon:r,cls:a}=De[t];return i(`span`,{className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium ${n?a:`bg-transparent text-foreground-subtle/40 line-through`}`,title:n?`Can ${t}`:`Cannot ${t}`,children:[u(r,{className:`h-3 w-3`}),t]},t)})})]},t))})]}),u(`div`,{className:`flex justify-end`,children:i(`button`,{onClick:t,className:`inline-flex items-center gap-1.5 rounded border border-border px-2.5 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-foreground-subtle/10 hover:text-foreground transition-colors`,children:[u(D,{className:`h-3 w-3`}),`Sign out`]})})]})}function ke(){let e=w(),[t,n]=c(``),[r,a]=c(``),[o,s]=c(``),[d,f]=c(null),p=l({mutationFn:t=>e.changeOwnPassword(t),onSuccess:()=>{f({kind:`success`,msg:`Password updated.`}),n(``),a(``),s(``)},onError:e=>{f({kind:`error`,msg:e instanceof Error?e.message:`Update failed`})}}),m=r.length>0&&o.length>0&&r!==o,h=r.length>0&&r.length<8,g=t.length>=1&&r.length>=8&&r===o;return i(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[i(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[u(O,{className:`h-3.5 w-3.5 text-foreground-subtle`}),u(`div`,{className:`text-xs font-semibold text-foreground`,children:`Change password`})]}),i(`div`,{className:`p-4 space-y-3`,children:[u($,{label:`Current password`,value:t,onChange:n,autoComplete:`current-password`}),u($,{label:`New password`,value:r,onChange:a,autoComplete:`new-password`,hint:`At least 8 characters.`}),u($,{label:`Confirm new password`,value:o,onChange:s,autoComplete:`new-password`}),(m||h)&&u(`div`,{className:`text-[11px] text-danger`,children:m?`Passwords do not match.`:`New password must be at least 8 characters.`}),d&&i(`div`,{className:`text-[11px] flex items-center gap-1 ${d.kind===`success`?`text-emerald-500`:`text-danger`}`,children:[d.kind===`success`?u(S,{className:`h-3 w-3`}):u(T,{className:`h-3 w-3`}),d.msg]}),u(`div`,{className:`flex justify-end`,children:i(`button`,{onClick:()=>{f(null),p.mutate({currentPassword:t,newPassword:r})},disabled:!g||p.isPending,className:`inline-flex items-center gap-1 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:[p.isPending?u(b,{className:`h-3 w-3 animate-spin`}):u(C,{className:`h-3 w-3`}),`Update password`]})})]})]})}function $({label:e,value:t,onChange:n,autoComplete:r,hint:a}){return i(`div`,{className:`space-y-1`,children:[u(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:e}),u(`input`,{type:`password`,value:t,onChange:e=>n(e.target.value),autoComplete:r,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`}),a&&u(`div`,{className:`text-[10px] text-foreground-subtle`,children:a})]})}function Ae({username:e}){let t=w(),n=o({queryKey:[`auth`,`getOwnTotpStatus`],queryFn:()=>t.getOwnTotpStatus()}),r=n.data,[f,p]=c(null),[m,h]=c(``),[g,_]=c(null),[x,C]=c(!1),E=l({mutationFn:()=>t.setupOwnTotp(),onSuccess:e=>{p({secret:e.secret,otpauthUrl:e.otpauthUrl}),h(``),_(null)},onError:e=>_(e instanceof Error?e.message:`Setup failed`)}),D=l({mutationFn:e=>t.confirmOwnTotp(e),onSuccess:()=>{p(null),h(``),_(null),n.refetch()},onError:e=>_(e instanceof Error?e.message:`Confirmation failed — code did not match`)}),O=G(`Turning off two-factor authentication`),k=l({mutationFn:async()=>{let e=await O.requestProof();return e===null?null:t.disableOwnTotp({reauthToken:e})},onSuccess:()=>{_(null),n.refetch()},onError:e=>_(e instanceof Error?e.message:`Disable failed`)});d(()=>{if(!x)return;let e=setTimeout(()=>C(!1),1500);return()=>clearTimeout(e)},[x]);let A=a(()=>n.isLoading?`loading`:f?`setup_in_progress`:r?.enabled?`enrolled`:`not_enrolled`,[n.isLoading,r?.enabled,f]);return i(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[O.dialog,i(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[u(v,{className:`h-3.5 w-3.5 text-foreground-subtle`}),u(`div`,{className:`text-xs font-semibold text-foreground`,children:`Two-factor authentication`})]}),i(`div`,{className:`p-4 space-y-3`,children:[A===`loading`&&i(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[u(b,{className:`h-3.5 w-3.5 animate-spin`}),`Checking status…`]}),A===`not_enrolled`&&i(s,{children:[u(`div`,{className:`text-xs text-foreground-subtle`,children:`2FA isn't active on your account. Enable it to require a 6-digit code from your authenticator app at every login.`}),u(`div`,{className:`flex justify-end`,children:i(`button`,{onClick:()=>{_(null),E.mutate()},disabled:E.isPending,className:`inline-flex items-center gap-1 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:[E.isPending?u(b,{className:`h-3 w-3 animate-spin`}):u(v,{className:`h-3 w-3`}),`Enable 2FA`]})})]}),A===`setup_in_progress`&&f&&i(s,{children:[i(`div`,{className:`text-[11px] text-foreground-subtle`,children:[`Scan the QR code (or enter the secret manually) into your authenticator app for`,` `,u(`span`,{className:`font-mono`,children:e}),`, then enter the 6-digit code below to confirm.`]}),i(`div`,{className:`flex flex-col items-center gap-3`,children:[u(`div`,{className:`rounded-lg border border-border bg-white p-3`,children:u(fe,{value:f.otpauthUrl,size:180})}),i(`div`,{className:`w-full`,children:[u(`div`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle mb-1`,children:`Secret (manual entry)`}),i(`div`,{className:`flex items-center gap-2 rounded border border-border bg-surface-hover/30 px-2 py-1.5`,children:[u(`code`,{className:`text-[11px] font-mono text-foreground break-all flex-1`,children:f.secret}),i(`button`,{onClick:()=>{f&&navigator.clipboard.writeText(f.secret).then(()=>C(!0))},className:`inline-flex items-center gap-1 text-[10px] text-foreground-subtle hover:text-foreground`,children:[x?u(S,{className:`h-3 w-3 text-emerald-500`}):u(y,{className:`h-3 w-3`}),x?`Copied`:`Copy`]})]})]})]}),i(`div`,{className:`space-y-1`,children:[u(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`6-digit code`}),u(`input`,{type:`text`,inputMode:`numeric`,autoComplete:`one-time-code`,placeholder:`123456`,value:m,onChange:e=>h(e.target.value.replace(/\D/g,``).slice(0,6)),className:`w-full rounded-md border border-border bg-surface px-3 py-2 text-center text-lg font-mono tracking-widest text-foreground focus:outline-none focus:ring-2 focus:ring-primary`})]}),g&&i(`div`,{className:`text-[11px] text-danger flex items-center gap-1`,children:[u(T,{className:`h-3 w-3`}),g]}),i(`div`,{className:`flex justify-end gap-2`,children:[u(`button`,{onClick:()=>{p(null),_(null),h(``)},className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Cancel`}),i(`button`,{onClick:()=>{_(null),D.mutate({code:m})},disabled:D.isPending||m.length!==6,className:`inline-flex items-center gap-1 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:[D.isPending?u(b,{className:`h-3 w-3 animate-spin`}):u(S,{className:`h-3 w-3`}),`Confirm`]})]})]}),A===`enrolled`&&r&&i(s,{children:[i(`div`,{className:`rounded-md border border-emerald-500/30 bg-emerald-500/5 px-3 py-2.5 flex items-start gap-2.5`,children:[u(S,{className:`h-4 w-4 mt-0.5 text-emerald-500 shrink-0`}),i(`div`,{className:`text-xs text-foreground space-y-0.5`,children:[u(`div`,{className:`font-medium`,children:`2FA is active`}),i(`div`,{className:`text-foreground-subtle`,children:[`Enrolled on`,` `,r.confirmedAt?new Date(r.confirmedAt).toLocaleString():`—`]})]})]}),g&&i(`div`,{className:`text-[11px] text-danger flex items-center gap-1`,children:[u(T,{className:`h-3 w-3`}),g]}),u(`div`,{className:`flex justify-end`,children:i(`button`,{onClick:()=>{_(null),k.mutate()},disabled:k.isPending,className:`rounded bg-danger px-3 py-1.5 text-xs font-medium text-white hover:bg-danger/90 disabled:opacity-50 inline-flex items-center gap-1`,children:[k.isPending?u(b,{className:`h-3 w-3 animate-spin`}):u(v,{className:`h-3 w-3`}),`Disable 2FA`]})})]})]})]})}function je(){return ie(`auth-webauthn/passkey-enrollment`)?u(se,{widgetId:`auth-webauthn/passkey-enrollment`,host:`dashboard`}):null}export{Oe as MyAccessPage};
@@ -1 +0,0 @@
1
- import{H as e,I as t,K as n,Q as r,S as i,W as a,b as o,i as s,k as c,o as l,p as u,q as d,t as f,x as p,z as m}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{ot as h}from"./player-overlays-DEJGWVeQ.js";import{hi as g}from"./client-Cm-sr0wc.js";import{Er as _,Ri as v,V as y,_r as ee,gr as te,qr as ne}from"./src-CVCI1YgT.js";import{F as re,I as b,L as x,P as ie}from"./index-D7FGxQMl.js";r();var S=c(function({addonId:r,schema:i,serverValues:o,onImmediateSave:s,onStateChange:c,onAction:l,disabled:u},d){let f=x({schema:i,serverValues:o,onImmediateSave:t(e=>s(r,e),[r,s]),onDeferredSave:t(()=>{},[])});e(d,()=>({flush:()=>{let e={};for(let t of f.pendingKeys)e[t]=f.values[t];return f.handleDiscard(f.pendingKeys),e},discard:()=>f.resetAll()}),[f]);let h=f.pendingKeys,g=h.join(`|`),_=a(()=>h.map(e=>`${e}=${JSON.stringify(f.values[e])}`).join(`,`),[h,f.values]),v=n(c);m(()=>{v.current=c},[c]),m(()=>{let e={};for(let t of h)e[t]=f.values[t];v.current({addonId:r,pendingKeys:h,pendingValues:e})},[r,g,_]);let y=a(()=>{if(l)return(e,t,n)=>l(r,e,t,n)},[r,l]);return p(b,{schema:i,values:f.values,onChange:f.handleChange,disabled:u,onAction:y})});function C(e){return`perNode`in e&&e.perNode===!0}function w(e,t){if(e.type===`group`){let n=T(e.fields,t);return n.length>0?{...e,fields:n}:null}if(e.type===`sub-tabs`){let n=e.tabs.map(e=>({...e,fields:T(e.fields,t)})).filter(e=>e.fields.length>0);return n.length>0?{...e,tabs:n}:null}return C(e)===(t===`perNode`)?e:null}function T(e,t){let n=[];for(let r of e){let e=w(r,t);e!==null&&n.push(e)}return n}function ae(e,t){let n=[];for(let r of e.sections){let e=T(r.fields,t);e.length!==0&&n.push({...r,fields:e})}return{...e,sections:n}}function oe(e,t){let n=e??`general`;return t?.[n]??n}function E(e){return typeof e!=`object`||!e||!(`key`in e)?null:typeof e.key==`string`?e.key:null}function se(e,t){let n=t.fieldKeys===void 0?null:new Set(t.fieldKeys),r=[];for(let i of e){let e=n===null?i.fields:i.fields.filter(e=>{let t=E(e);return t!==null&&n.has(t)});e.length!==0&&r.push({...i,fields:e,...t.tabAliases===void 0?{}:{tab:oe(i.tab,t.tabAliases)},...t.hideSectionChrome===!0?{title:``,description:void 0}:{}})}return r}r();function D(e,t){if(e.type===`separator`||e.type===`info`||e.type===`button`)return e;if(e.type===`group`){let n=e.fields.map(e=>D(e,t));return{...e,fields:n}}let n=e;t[e.key]=n.value;let{value:r,...i}=n;return i}function O(e,t){return{...e,fields:e.fields.map(e=>D(e,t))}}function ce(e){let t={};return{schema:{...e.tabs?{tabs:e.tabs}:{},sections:e.sections.map(e=>O(e,t))},values:t}}function k({nodeId:e,addonIds:r,level:c,deviceId:m,capability:b,sectionIds:x,omitSectionIds:S,fieldKeys:C,hideSectionChrome:w,tabAliases:T,tabLabelOverrides:E,sectionTab:D,fieldScope:O,surface:k,emptyMessage:ue,extraTabs:A,schemaTabExtras:j,title:M,description:N,selfTabbed:de,activeTab:P,onActiveTabChange:fe}){let F=l(),I=h().trpcClient,L=ee(),R=te(),pe=v(),me=ne(),z=de===!0||!!(A&&A.length>0),[he,ge]=d(null);if(c===`device`&&!m)throw Error(`NodeAddonsSettingsPanel: deviceId is required when level === "device"`);if(k!==void 0){if(c!==`global`||m!==void 0)throw Error(`NodeAddonsSettingsPanel: integration-level settings are addon-wide — they cannot be mounted at device level or with a deviceId. A second page, never a second scope.`);if(e!==null)throw Error(`NodeAddonsSettingsPanel: an integration has no node behind it — pass nodeId={null}. Received ${JSON.stringify(e)}.`);if(O!==void 0)throw Error("NodeAddonsSettingsPanel: integration-level settings arrive already cluster-scoped from core — remove `fieldScope` rather than restating it.")}let B=e??`hub`,V=s({queries:r.map(e=>({queryKey:[[`addonSettings`,k===void 0?c===`global`?`getGlobalSettings`:`getDeviceSettings`:`getIntegrationSettings`],{addonId:e,nodeId:B,deviceId:m??null,cap:b??null,scope:O??null}],queryFn:async()=>{let t=e=>e!==null&&O!==void 0?ae(e,O):e;return k===void 0?c===`global`?{addonId:e,result:t(await I.addonSettings.getGlobalSettings.query({addonId:e,nodeId:B,...b?{cap:b}:{}}))}:{addonId:e,result:t(await I.addonSettings.getDeviceSettings.query({addonId:e,deviceId:m,nodeId:B}))}:{addonId:e,result:await I.addonSettings.getIntegrationSettings.query({addonId:e,nodeId:B})}},placeholderData:u}))}),_e=V.some(e=>e.isLoading),ve=V.map(e=>{if(!e.data)return`-`;if(e.data.result===null)return`${e.data.addonId}:n`;let t=[];for(let n of e.data.result.sections){t.push(`s:${n.id}:${n.tab??`general`}`);for(let e of n.fields){if(!(`key`in e))continue;let n=`options`in e&&Array.isArray(e.options)?e.options.map(e=>e.value).join(`,`):``,r=e.value,i=r===void 0?``:typeof r==`string`?r:JSON.stringify(r);t.push(`f:${e.key}:${n}:${i}`)}}return`${e.data.addonId}:${t.join(`|`)}`}).join(`||`),H=a(()=>{let e=new Set;for(let t of V){let n=t.data?.result?.sections;if(n)for(let t of n)e.add(oe(t.tab,T))}return[...e]},[T,ve+`::`+V.map(e=>(e.data?.result?.sections??[]).map(e=>e.tab??`general`).join(`,`)).join(`::`)]),U=a(()=>new Map((A??[]).map(e=>[e.id,e])),[A]),W=a(()=>{if(!z)return[];let e=[...new Set([...H,...(A??[]).map(e=>e.id),...(j??[]).map(e=>e.tabId)])],t=e=>{let t=U.get(e);if(t?.order!==void 0)return t.order;let n=g[e];return n?n.order:50};return e.toSorted((e,n)=>{let r=t(e),i=t(n);return r===i?e.localeCompare(n):r-i})},[z,H,A,U,j]),ye=a(()=>{let e=new Map,t=e=>g[e]?.label??e.charAt(0).toUpperCase()+e.slice(1);for(let n of H)e.set(n,t(n));for(let n of j??[])e.has(n.tabId)||e.set(n.tabId,t(n.tabId));for(let t of A??[])e.set(t.id,t.label);for(let[t,n]of Object.entries(E??{}))e.set(t,n);return e},[H,A,j,E]),G=P===void 0?he:P,K=z?G&&W.includes(G)?G:W[0]??null:null,be=e=>{ge(e),fe?.(e)},xe=K!==null&&U.has(K),q=z?K&&!xe?K:void 0:D,{data:Se}=_(void 0),Ce=a(()=>{let e=new Map;for(let t of Se??[]){let n=t.manifest?.id;if(!n)continue;let r=t.manifest?.name??t.manifest?.packageDisplayName??n;e.set(n,r)}return e},[Se]),we=n(new Map),J=a(()=>{let e=x?new Set(x):null,t=S?new Set(S):null,n=n=>!(e!==null&&!e.has(n)||t!==null&&t.has(n)),r=[];for(let e of V){if(!e.data)continue;let t=e.data.result??we.current.get(e.data.addonId)??null;if(e.data.result!==null&&we.current.set(e.data.addonId,e.data.result),t===null)continue;let{schema:i,values:a}=ce(t),o={...C===void 0?{}:{fieldKeys:C},...w===void 0?{}:{hideSectionChrome:w},...T===void 0?{}:{tabAliases:T}},s=se(i.sections.filter(e=>n(e.id)),o);if(s.length===0)continue;let c={...t,sections:se(t.sections.filter(e=>n(e.id)),o)},l={...i,sections:s};r.push({addonId:e.data.addonId,schemaWithValues:c,schema:l,serverValues:a})}return r},[ve,x,S,C,w,T]),[Y,Te]=d(new Map),Ee=t(e=>{Te(t=>{let n=new Map(t);return n.set(e.addonId,e),n})},[]),X=n(new Map),De=t(e=>t=>{t?X.current.set(e,t):X.current.delete(e)},[]),Z=t(async(e,t)=>{c===`global`?await L.mutateAsync({addonId:e,nodeId:B,patch:t}):await R.mutateAsync({addonId:e,deviceId:m,nodeId:B,patch:t}),F.invalidateQueries({queryKey:[[`addonSettings`]]})},[L,R,B,c,m,F]),Oe=t(async(e,t,n,r)=>{let i=B;try{switch(t){case`reprobe-hwaccel`:await pe.mutateAsync({nodeId:i}),F.invalidateQueries({queryKey:[[`addonSettings`]]});return;case`reprobe-audio-engine`:await me.mutateAsync({nodeId:i}),F.invalidateQueries({queryKey:[[`addonSettings`]]});return;default:{let n=await I.addons.custom.mutate({addonId:e,action:t,input:r});return F.invalidateQueries({queryKey:[[`addonSettings`]]}),n}}}catch(n){throw console.error(`[NodeAddonsSettingsPanel] action failed`,{addonId:e,action:t,err:n}),n}},[pe,me,B,F,I]),ke=t((e,t)=>{Z(e,t)},[Z]),Q=f({mutationFn:async()=>{let e=[];for(let t of J){let n=Y.get(t.addonId);!n||n.pendingKeys.length===0||e.push({addonId:t.addonId,patch:n.pendingValues})}return e.length===0?{saved:[]}:{saved:await Promise.all(e.map(async({addonId:e,patch:t})=>(c===`global`?await L.mutateAsync({addonId:e,nodeId:B,patch:t}):await R.mutateAsync({addonId:e,deviceId:m,nodeId:B,patch:t}),e)))}},onSuccess:({saved:e})=>{for(let t of e)X.current.get(t)?.discard();F.invalidateQueries({queryKey:[[`addonSettings`]]})}}),Ae=t(()=>{for(let e of X.current.values())e.discard()},[]),je=a(()=>{let e=0;for(let t of J){let n=Y.get(t.addonId);n&&(e+=n.pendingKeys.length)}return e},[J,Y]),Me=a(()=>{let e=new Map;for(let t of J){let n=Y.get(t.addonId);if(!n||n.pendingKeys.length===0)continue;let r=new Set(n.pendingKeys);for(let n of t.schema.sections){let t=n.tab??`general`;for(let i of n.fields)`key`in i&&r.has(i.key)&&e.set(t,(e.get(t)??0)+1)}}return e},[J,Y]);if(_e)return p(`div`,{className:`h-24 rounded-lg border border-border bg-surface animate-pulse`});let $=K&&xe?U.get(K):void 0;if(!z&&J.length===0)return p(`div`,{className:`text-[11px] text-foreground-subtle italic`,children:ue??i(o,{children:[`No addons in`,` `,r.length>0?`[${r.join(`, `)}]`:`the current selection`,` expose`,` `,c,`-level settings on this node.`]})});let Ne=Q.isPending;return i(`div`,{className:`space-y-4`,children:[(M||N)&&i(`div`,{className:`border-b border-border pb-2`,children:[M&&p(`h2`,{className:`text-sm font-semibold text-foreground`,children:M}),N&&p(`p`,{className:`text-[11px] text-foreground-subtle mt-0.5`,children:N})]}),z&&p(ie,{tabs:W.map(e=>({id:e,label:ye.get(e)??e})),activeId:K,onChange:be,pendingByTab:Me}),Q.isError&&i(`div`,{className:`rounded-md border border-red-500/40 bg-red-500/10 px-3 py-2 text-[11px] text-red-400`,children:[`Save failed: `,String(Q.error?.message??Q.error)]}),p(y,{tabKey:$?`extra:${K??``}`:`tab:${K??``}`,children:$?$.content:(()=>{let e=q?J.reduce((e,t)=>e+t.schemaWithValues.sections.filter(e=>(e.tab??`general`)===q).length,0):0,t=!!q&&e<=1,n=J.map(e=>({...e,renderedWithValues:{...e.schemaWithValues,sections:e.schemaWithValues.sections.filter(e=>q?(e.tab??`general`)===q:!0).map(e=>t?{...e,title:``,description:void 0}:e)}})).filter(e=>e.renderedWithValues.sections.length>0).toSorted((e,t)=>{let n=e=>{let t=1/0;for(let n of e)typeof n.order==`number`&&n.order<t&&(t=n.order);return t},r=n(e.renderedWithValues.sections),i=n(t.renderedWithValues.sections);return r===i?0:r-i}),r=(j??[]).filter(e=>e.tabId===q),a=r.filter(e=>(e.placement??`before`)===`before`),o=r.filter(e=>e.placement===`after`);return n.length===0&&r.length===0?p(`div`,{className:`text-[11px] text-foreground-subtle italic`,children:ue??`Nothing to configure here for this node.`}):i(`div`,{className:`space-y-6`,children:[a.map((e,t)=>p(`div`,{children:e.content},`extra-before-${t}`)),n.length>0&&p(le,{entries:n,paneStates:Y,displayNames:Ce,disabled:Ne,setPaneRef:De,onPaneStateChange:Ee,onImmediateSave:ke,onAction:Oe,inline:z||!!D}),o.map((e,t)=>p(`div`,{children:e.content},`extra-after-${t}`))]})})()}),!_e&&p(re,{pendingCount:je,onSave:()=>Q.mutate(),onDiscard:Ae,saving:Ne})]})}function le({entries:e,paneStates:t,displayNames:n,disabled:r,setPaneRef:o,onPaneStateChange:s,onImmediateSave:c,onAction:l,inline:u}){let f=a(()=>[...e].toSorted((e,t)=>{if(e.addonId===`system-config`)return-1;if(t.addonId===`system-config`)return 1;let r=n.get(e.addonId)??e.addonId,i=n.get(t.addonId)??t.addonId;return r.localeCompare(i)}),[e,n]),[h,g]=d(f[0]?.addonId??``);m(()=>{f.length!==0&&(f.find(e=>e.addonId===h)||g(f[0].addonId))},[f,h]);let _=f.find(e=>e.addonId===h)??f[0];if(!_)return null;let v=a(()=>l?(e,t,n,r)=>l(e,t,n,r):void 0,[l]),y=e=>p(S,{ref:o(e.addonId),addonId:e.addonId,schema:e.renderedWithValues,serverValues:e.serverValues,onImmediateSave:c,onStateChange:s,onAction:v,disabled:r},e.addonId);return f.length===1||u?p(`div`,{className:`flex flex-col gap-4`,children:f.map(y)}):i(`div`,{className:`flex flex-col gap-3`,children:[p(`div`,{className:`flex flex-wrap items-center gap-1 border-b border-border shrink-0`,children:f.map(e=>{let r=n.get(e.addonId)??e.addonId,a=e.addonId===_.addonId,o=(t.get(e.addonId)?.pendingKeys.length??0)>0;return i(`button`,{type:`button`,onClick:()=>g(e.addonId),className:`relative px-3 py-1.5 text-xs font-medium rounded-t-md transition-colors -mb-px border-b-2 whitespace-nowrap ${a?`text-primary border-primary bg-primary/5`:`text-foreground-subtle border-transparent hover:text-foreground hover:bg-surface-hover`}`,children:[r,o&&p(`span`,{className:`ml-1.5 inline-flex h-1.5 w-1.5 rounded-full bg-amber-400`})]},e.addonId)})}),p(`div`,{className:`space-y-2`,children:f.map(e=>p(`div`,{style:e.addonId===_.addonId?void 0:{display:`none`},children:y(e)},e.addonId))})]})}export{k as t};