@camstack/addon-admin-ui 1.2.436 → 1.2.437

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 (133) hide show
  1. package/dist/assets/{AddonAssetIcon-BPpbpBRb.js → AddonAssetIcon-C3Ltt0yX.js} +1 -1
  2. package/dist/assets/Addons-CkBmnKjV.js +4 -0
  3. package/dist/assets/{AdminPage-Dq8Ikceb.js → AdminPage-B7Z1OWO3.js} +1 -1
  4. package/dist/assets/{AdminSectionedPage-CMXlVHaE.js → AdminSectionedPage-USP4OV_Y.js} +1 -1
  5. package/dist/assets/AiProfiles-QWD8PlMr.js +3 -0
  6. package/dist/assets/{BrokerForm-CTEvkdiJ.js → BrokerForm-BxmxiIRw.js} +1 -1
  7. package/dist/assets/{Build-BtwPkUNT.js → Build-CXn4HT3p.js} +4 -4
  8. package/dist/assets/{Calendars-BDEesia0.js → Calendars-DN9ln21d.js} +1 -1
  9. package/dist/assets/Cluster-tgWdVHND.js +1 -0
  10. package/dist/assets/ClusterStepModel-BizBdfIU.js +1 -0
  11. package/dist/assets/{CompositionEditor-thMDSEPc.js → CompositionEditor-GiDCG4Aj.js} +1 -1
  12. package/dist/assets/{CompositionEditorPage-sur0OoTs.js → CompositionEditorPage-wfYMLlvy.js} +1 -1
  13. package/dist/assets/{Data-DYZzdYTt.js → Data-CmT5GPx9.js} +2 -2
  14. package/dist/assets/DeviceDetail-moNYFDGE.js +2 -0
  15. package/dist/assets/{DeviceDoActionFields-C3Dz4KrE.js → DeviceDoActionFields-C1LG9nW0.js} +1 -1
  16. package/dist/assets/{Devices-xUTbIFJe.js → Devices-837Dt931.js} +1 -1
  17. package/dist/assets/{EmbedPlayerPage-DYCZQ47V.js → EmbedPlayerPage-Crrh_6YT.js} +1 -1
  18. package/dist/assets/{Identity-DRemX8Kt.js → Identity-CNNb8wrU.js} +1 -1
  19. package/dist/assets/IntegrationDetail-BER_0Zaz.js +1 -0
  20. package/dist/assets/{IntegrationHub-CKPuIBCW.js → IntegrationHub-BEu0isNR.js} +1 -1
  21. package/dist/assets/Integrations-CuZucOyR.js +1 -0
  22. package/dist/assets/{Integrations-D8689xLx.js → Integrations-Sjh868gF.js} +1 -1
  23. package/dist/assets/Library-B4Nw3n28.js +1 -0
  24. package/dist/assets/Locations-B7dC2DyF.js +3 -0
  25. package/dist/assets/{Logs-BCis7K87.js → Logs-4XWMmfpD.js} +1 -1
  26. package/dist/assets/{MaskShapeCanvas-BDELFcW-.js → MaskShapeCanvas-Bwqusno0.js} +1 -1
  27. package/dist/assets/{MotionZonesSettings-B4Sz3Hxi.js → MotionZonesSettings-CZbGV_dv.js} +1 -1
  28. package/dist/assets/{MyAccess-SjNSbZFI.js → MyAccess-TAG05L5N.js} +1 -1
  29. package/dist/assets/Network-ReY1qUoQ.js +1 -0
  30. package/dist/assets/{NodeAddonsSettingsPanel-DPOu3bzA.js → NodeAddonsSettingsPanel-DIKEaj5p.js} +1 -1
  31. package/dist/assets/{Notifications-CdyKO4mW.js → Notifications-CqTEfaZ_.js} +1 -1
  32. package/dist/assets/{PrivacyMaskSettings-DHIoMgiM.js → PrivacyMaskSettings-CTKUYU5o.js} +1 -1
  33. package/dist/assets/{Recordings-DaqBEWTR.js → Recordings-EMQC9iqz.js} +1 -1
  34. package/dist/assets/ScanNetworkModal-DK98Sjd4.js +1 -0
  35. package/dist/assets/SceneMonitorEditor-CG4pADlP.js +1 -0
  36. package/dist/assets/SessionsList-B1Ni2lo_.js +2 -0
  37. package/dist/assets/{Showroom-DNWKiETZ.js → Showroom-BKLoHB4Z.js} +1 -1
  38. package/dist/assets/System-DEOHPmr3.js +1 -0
  39. package/dist/assets/{Terminal-CZxQeSQv.js → Terminal-dVu7TTAE.js} +2 -2
  40. package/dist/assets/{Viewer-DRzTXkJf.js → Viewer-B9mEIKqz.js} +1 -1
  41. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-C5raVFJt.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BX43JXOX.js} +1 -1
  42. package/dist/assets/{addon-icons-context-PT674I68.js → addon-icons-context-BjcmJD_J.js} +1 -1
  43. package/dist/assets/{archive-Ciq6-gRM.js → archive-Bcg0gLgY.js} +1 -1
  44. package/dist/assets/{authed-media-Dj1jG_u8.js → authed-media-Cf82_ejX.js} +1 -1
  45. package/dist/assets/{bell-off-BSKweN0I.js → bell-off-BnByNJjy.js} +1 -1
  46. package/dist/assets/{board-model-5GbhsRIK.js → board-model-D8m2YmcS.js} +1 -1
  47. package/dist/assets/{boxes-Be_6S2Ig.js → boxes-V2c7jrxe.js} +1 -1
  48. package/dist/assets/circle-slash-B_FzZotu.js +1 -0
  49. package/dist/assets/client-CUuI767h.js +358 -0
  50. package/dist/assets/{cloud-upload-B9nCTjv1.js → cloud-upload-aziKggfg.js} +1 -1
  51. package/dist/assets/crop-DzZyuK_f.js +1 -0
  52. package/dist/assets/{device-integration-icon-C31xC4qv.js → device-integration-icon-3UfBj_i6.js} +1 -1
  53. package/dist/assets/device-picker-model-DJj6igTj.js +1 -0
  54. package/dist/assets/dist-DsAwO6-i.js +358 -0
  55. package/dist/assets/{dist-B6sP5E_m.js → dist-t-gGaOd0.js} +1 -1
  56. package/dist/assets/{eraser-BIioNznG.js → eraser-CsYhDDbY.js} +1 -1
  57. package/dist/assets/{hard-drive-download-B4JsHavv.js → hard-drive-download-CWqd_JKb.js} +1 -1
  58. package/dist/assets/{history-DjLzg0Rr.js → history-DOf9zSG-.js} +1 -1
  59. package/dist/assets/{hostInit-BwwyWMg1.js → hostInit-BCqJwB4Y.js} +1 -1
  60. package/dist/assets/i18n-RHwbGLC0.js +1 -0
  61. package/dist/assets/icons-BrAHwVJD.js +1 -0
  62. package/dist/assets/index-CeO2wVZi.js +4 -0
  63. package/dist/assets/index-M0Q7O5pF.css +2 -0
  64. package/dist/assets/{key-BMcy7xHz.js → key-D0VHbthb.js} +1 -1
  65. package/dist/assets/{key-round-C__KHy-x.js → key-round-CasJ848Z.js} +1 -1
  66. package/dist/assets/{layers-Dbn6yDeS.js → layers-CFb4zoU6.js} +1 -1
  67. package/dist/assets/{linked-devices-model-D8dKG29p.js → linked-devices-model-DbkbB7KM.js} +1 -1
  68. package/dist/assets/{list-ordered-CwWFTuog.js → list-ordered-B14sQnH2.js} +1 -1
  69. package/dist/assets/{location-owned-usage-kz2UtPi1.js → location-owned-usage-C21QUrwl.js} +1 -1
  70. package/dist/assets/{log-in-D-fa0CNC.js → log-in-UZRiT8Rq.js} +1 -1
  71. package/dist/assets/{memory-stick-BNvRqOgn.js → memory-stick-l6hXPEuG.js} +1 -1
  72. package/dist/assets/{message-square-plus-yiE3dC2J.js → message-square-plus-C3grB9GT.js} +1 -1
  73. package/dist/assets/{mf-entry-bootstrap-0-3d7ac4be.js → mf-entry-bootstrap-0-5e54ea5d.js} +2 -2
  74. package/dist/assets/{mic-off-Ct9OQSHX.js → mic-off-wol-RBiS.js} +1 -1
  75. package/dist/assets/{monitor-off-gNZ5sErH.js → monitor-off-BUehkWHc.js} +1 -1
  76. package/dist/assets/{monitor-smartphone-B9ZL4epZ.js → monitor-smartphone-CCDiXDn-.js} +1 -1
  77. package/dist/assets/mount-DJj6igTj.js +1 -0
  78. package/dist/assets/{notification-schedule-field-91fTFul7.js → notification-schedule-field-DiZ-TJBp.js} +1 -1
  79. package/dist/assets/player-overlays-Db_o1Zm2.js +1 -0
  80. package/dist/assets/{recycle-CH0GJM3I.js → recycle-BVxTT0po.js} +1 -1
  81. package/dist/assets/remoteEntry-DSZ__m0a.js +1 -0
  82. package/dist/assets/{scan-eye-D6obPT9p.js → scan-eye-C5EKCLMY.js} +1 -1
  83. package/dist/assets/{scissors-BXMmNEgj.js → scissors-DjP6Unuk.js} +1 -1
  84. package/dist/assets/{search-x-ByAKuo4f.js → search-x-gjRI7PKB.js} +1 -1
  85. package/dist/assets/{send-CholqiEk.js → send-CV6GWVOX.js} +1 -1
  86. package/dist/assets/{settings-2-3k9hj27t.js → settings-2--KyzHb5N.js} +1 -1
  87. package/dist/assets/{speaker-Ca4eeGU9.js → speaker-CnmwOCLp.js} +1 -1
  88. package/dist/assets/src-CL0G8g2V.js +67 -0
  89. package/dist/assets/{timer-reset-bq-8RFf6.js → timer-reset-nORqwwje.js} +1 -1
  90. package/dist/assets/{ungroup-DMrJzuO_.js → ungroup-BQTGGbbf.js} +1 -1
  91. package/dist/assets/{unlink-CgiLXfCU.js → unlink-669jprEf.js} +1 -1
  92. package/dist/assets/{usb-BpqC1Eim.js → usb-BT4hzhxS.js} +1 -1
  93. package/dist/assets/{use-scenes-feed-CtmmYk4L.js → use-scenes-feed-DCExYbbk.js} +1 -1
  94. package/dist/assets/{use-stationary-objects-DsURgc1b.js → use-stationary-objects-DPwgtmOw.js} +1 -1
  95. package/dist/assets/useEventInvalidation-DJj6igTj.js +1 -0
  96. package/dist/assets/{useNodeUrlSelection-nj7EK04j.js → useNodeUrlSelection-ibxCoFYh.js} +1 -1
  97. package/dist/assets/user-round-NWWWc7PC.js +1 -0
  98. package/dist/assets/{user-x-CpjXT41_.js → user-x-Drhirj9Y.js} +1 -1
  99. package/dist/assets/{video-BAANd9N-.js → video-Dzs93Xor.js} +1 -1
  100. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-Bp8_lhik.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DVRZb8h3.js} +2 -2
  101. package/dist/index.html +11 -11
  102. package/dist/server/addon.js +227 -8
  103. package/package.json +1 -1
  104. package/dist/assets/Addons-BKpZvzxZ.js +0 -4
  105. package/dist/assets/AiProfiles-BNa-wvuk.js +0 -3
  106. package/dist/assets/Cluster-CPOYtnsH.js +0 -1
  107. package/dist/assets/ClusterStepModel-CD3lGILg.js +0 -1
  108. package/dist/assets/DeviceDetail-Dfkdbk5S.js +0 -2
  109. package/dist/assets/IntegrationDetail-CVONA8Vu.js +0 -1
  110. package/dist/assets/Integrations-RmhoSCir.js +0 -1
  111. package/dist/assets/Library-bvbXCasj.js +0 -1
  112. package/dist/assets/Locations-DvnbXzXE.js +0 -3
  113. package/dist/assets/Network-BvT1oKui.js +0 -1
  114. package/dist/assets/ScanNetworkModal-C5ek4_xr.js +0 -1
  115. package/dist/assets/SceneMonitorEditor-BPo9HYQH.js +0 -1
  116. package/dist/assets/SessionsList-CLdfIlct.js +0 -2
  117. package/dist/assets/System-BEpuTl2A.js +0 -1
  118. package/dist/assets/circle-slash-CtNDkZYp.js +0 -1
  119. package/dist/assets/client-CPwvt_HG.js +0 -358
  120. package/dist/assets/crop-D5vMVrdf.js +0 -1
  121. package/dist/assets/device-picker-model-zmV5eDza.js +0 -1
  122. package/dist/assets/dist-Sy-AM1_J.js +0 -358
  123. package/dist/assets/i18n-GaxP0h6E.js +0 -1
  124. package/dist/assets/icons-4P43FpmR.js +0 -1
  125. package/dist/assets/index-i0Y8_-ur.css +0 -2
  126. package/dist/assets/index-tgPOSbne.js +0 -4
  127. package/dist/assets/mount-zmV5eDza.js +0 -1
  128. package/dist/assets/octagon-alert-CkSZIflH.js +0 -1
  129. package/dist/assets/player-overlays-CVyuEj4x.js +0 -1
  130. package/dist/assets/remoteEntry-CEVdKgl-.js +0 -1
  131. package/dist/assets/src-D7EY8vSW.js +0 -67
  132. package/dist/assets/useEventInvalidation-zmV5eDza.js +0 -1
  133. package/dist/assets/user-round-B0EP32hl.js +0 -1
@@ -1 +0,0 @@
1
- import{$ as e,B as t,G as n,J as r,L as i,S as a,b as o,q as s,x as c}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEHpkaJP.js";import{Hr as l,Nt as u,Q as d,Rr as f,Sn as p,ar as m,bi as h,dt as g,vi as _,yn as v}from"./player-overlays-CVyuEj4x.js";import{Ti as y}from"./client-CPwvt_HG.js";import{Ea as b,Yi as x,ca as S,mi as C,mo as w,oa as T,va as E,vi as D,yi as O}from"./src-D7EY8vSW.js";import{t as k}from"./useTranslation-D3Is_4B6.js";import"./mount-zmV5eDza.js";import{R as A,X as j}from"./index-tgPOSbne.js";import{t as M}from"./BrokerForm-CTEvkdiJ.js";e();var N=[`amazon.com`,`amazon.it`,`amazon.de`,`amazon.co.uk`,`amazon.fr`,`amazon.es`,`amazon.ca`,`amazon.com.au`,`amazon.co.jp`,`amazon.in`,`amazon.com.br`,`amazon.com.mx`],P=d(`/addon/import-alexa`),F=2e3;function I(e){return typeof e==`object`&&!!e&&typeof e.sessionId==`string`&&typeof e.loginUrl==`string`}function L(e){return typeof e==`object`&&!!e&&typeof e.phase==`string`&&typeof e.sessionId==`string`}function R(e){return typeof e==`object`&&!!e&&typeof e.brokerId==`string`}function z(e){return{"Content-Type":`application/json`,Authorization:`Bearer ${localStorage.getItem(`camstack_admin_token`)??``}`,...e}}async function B(e,t,n){let r=await fetch(`${P}${e}`,{method:`POST`,headers:z(),body:JSON.stringify(t)}),i=await r.json();if(!r.ok){let e=typeof i==`object`&&i?i.error??`Unknown error`:`Unknown error`;throw Error(String(e))}if(!n(i))throw Error(`Unexpected response from server`);return i}async function V(e){let t=new URLSearchParams({sessionId:e}),n=localStorage.getItem(`camstack_admin_token`)??``,r=await fetch(`${P}/login/status?${t.toString()}`,{headers:{Authorization:`Bearer ${n}`}}),i=await r.json();if(!r.ok){let e=typeof i==`object`&&i?i.error??`Unknown error`:`Unknown error`;throw Error(String(e))}if(!L(i))throw Error(`Unexpected status response from server`);return i}async function H(e){try{await fetch(`${P}/login/cancel`,{method:`POST`,headers:z(),body:JSON.stringify({sessionId:e})})}catch{}}function U({brokerId:e,onResolved:n,onCancel:o}){let{t:l}=k(),[d,p]=r(`amazon.it`),[h,g]=r(`Alexa account`),[_,y]=r({kind:`idle`}),b=s(!0);t(()=>(b.current=!0,()=>{b.current=!1}),[]);let x=s(null),S=s(null),C=i(()=>{S.current!==null&&(clearInterval(S.current),S.current=null)},[]),w=i(async t=>{C(),b.current&&y({kind:`committing`,sessionId:t});try{let r=await B(`/login/commit`,{sessionId:t,name:h.trim().length>0?h.trim():`Alexa account`,...e===void 0?{}:{brokerId:e}},R);x.current=null,n(r.brokerId)}catch(e){let n=e instanceof Error?e.message:String(e);b.current&&y({kind:`error`,message:n,sessionId:t})}},[e,h,n,C]),T=i((e,t)=>{C();let n=async()=>{try{let n=await V(e);if(n.phase===`captured`){C(),w(e);return}if(n.phase===`error`){C(),b.current&&y({kind:`error`,message:n.error??l(`integrations.alexaLoginStep.loginProxyReturnedAnError`,`Login proxy returned an error`),sessionId:e});return}if(n.phase===`cancelled`){C(),b.current&&y({kind:`idle`});return}b.current&&y({kind:`polling`,sessionId:e,loginUrl:n.loginUrl||t,phase:n.phase})}catch(e){let t=e instanceof Error?e.message:String(e);b.current&&y(e=>e.kind===`polling`?{...e}:{kind:`error`,message:t,sessionId:null})}};S.current=setInterval(()=>{n()},F)},[C,w,l]);t(()=>()=>{C(),x.current!==null&&H(x.current)},[C]);let E=async()=>{C(),x.current!==null&&(H(x.current),x.current=null),y({kind:`starting`});try{let e=await B(`/login/start`,{amazonDomain:d},I);x.current=e.sessionId,y({kind:`polling`,sessionId:e.sessionId,loginUrl:e.loginUrl,phase:`starting`}),T(e.sessionId,e.loginUrl)}catch(e){y({kind:`error`,message:e instanceof Error?e.message:String(e),sessionId:null})}},D=()=>{C(),x.current!==null&&(H(x.current),x.current=null),y({kind:`idle`})},O=()=>{D()},A=_.kind===`idle`,M=_.kind===`starting`,P=_.kind===`polling`,L=_.kind===`committing`,z=_.kind===`error`,U=M||P||L,W=_.kind===`polling`?_.phase:null,G=_.kind===`polling`?_.loginUrl:null,K=P&&W===`awaiting-login`,q=P&&(W===`starting`||W===null);return a(`div`,{className:`space-y-4`,children:[(A||z)&&a(`div`,{className:`space-y-3`,children:[e===void 0&&a(`div`,{className:`space-y-1`,children:[c(`label`,{htmlFor:`alexa-account-name`,className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:l(`integrations.alexaLoginStep.accountName`,`Account name`)}),c(`input`,{id:`alexa-account-name`,type:`text`,value:h,onChange:e=>g(e.target.value),placeholder:l(`integrations.alexaLoginStep.alexaAccount`,`Alexa account`),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`})]}),a(`div`,{className:`space-y-1`,children:[c(`label`,{htmlFor:`alexa-amazon-region`,className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:l(`integrations.alexaLoginStep.amazonRegion`,`Amazon region`)}),c(`select`,{id:`alexa-amazon-region`,value:d,onChange:e=>p(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`,children:N.map(e=>c(`option`,{value:e,children:e},e))})]})]}),z&&a(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px] flex items-start gap-2`,children:[c(u,{className:`h-3.5 w-3.5 mt-0.5 flex-shrink-0`}),c(`span`,{children:_.message})]}),M&&a(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-3 text-xs text-foreground-subtle`,children:[c(m,{className:`h-4 w-4 animate-spin flex-shrink-0`}),l(`integrations.alexaLoginStep.startingLoginProxy`,`Starting login proxy…`)]}),q&&a(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-3 text-xs text-foreground-subtle`,children:[c(m,{className:`h-4 w-4 animate-spin flex-shrink-0`}),l(`integrations.alexaLoginStep.waitingForProxyToBe`,`Waiting for proxy to be ready…`)]}),L&&a(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-3 text-xs text-foreground-subtle`,children:[c(m,{className:`h-4 w-4 animate-spin flex-shrink-0`}),l(`integrations.alexaLoginStep.savingCredentials`,`Saving credentials…`)]}),K&&G!==null&&a(`div`,{className:`space-y-3`,children:[a(`div`,{className:`rounded-lg border border-border bg-surface p-3 space-y-2`,children:[c(`p`,{className:`text-xs font-semibold text-foreground`,children:l(`integrations.alexaLoginStep.openTheLinkBelowTo`,`Open the link below to log in to your Amazon account`)}),c(`p`,{className:`text-[10px] text-foreground-subtle`,children:l(`integrations.alexaLoginStep.afterCompletingTheLoginAnd`,`After completing the login and any 2FA steps, this wizard will continue automatically.`)}),a(`a`,{href:G,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 rounded bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90`,children:[c(f,{className:`h-3.5 w-3.5`}),l(`integrations.alexaLoginStep.loginToAmazon`,`Login to Amazon`)]})]}),c(`div`,{className:`rounded border border-warning/30 bg-warning/10 px-3 py-2 text-[10px] text-warning`,children:c(j,{i18nKey:`integrations.alexaLoginStep.proxyNote`,components:{b:c(`strong`,{}),code:c(`code`,{className:`font-mono`})}})}),a(`div`,{className:`flex items-center gap-2 text-[10px] text-foreground-subtle`,children:[c(m,{className:`h-3 w-3 animate-spin`}),l(`integrations.alexaLoginStep.waitingForAmazonLoginTo`,`Waiting for Amazon login to complete…`)]})]}),a(`div`,{className:`flex items-center justify-between gap-2 pt-1`,children:[c(`button`,{type:`button`,onClick:U?D:o,className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:U?l(`integrations.alexaLoginStep.cancelLogin`,`Cancel login`):l(`common.back`,`Back`)}),a(`div`,{className:`flex items-center gap-2`,children:[z&&a(`button`,{type:`button`,onClick:O,className:`inline-flex items-center gap-1.5 rounded border border-border px-3 py-1.5 text-xs text-foreground hover:bg-primary/10`,children:[c(v,{className:`h-3.5 w-3.5`}),l(`common.retry`,`Retry`)]}),A&&c(`button`,{type:`button`,onClick:()=>{E()},disabled:e===void 0&&h.trim().length===0,className:`inline-flex items-center gap-1.5 rounded bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:l(`integrations.alexaLoginStep.startLogin`,`Start login`)})]})]})]})}e();var W=`alexa`;function G(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.id==`string`):[]}function K(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.addonId==`string`&&Array.isArray(e.kinds)):[]}var q={connected:`bg-success/15 text-success`,connecting:`bg-warning/15 text-warning`,disconnected:`bg-foreground-subtle/15 text-foreground-subtle`,"auth-failed":`bg-danger/15 text-danger`,unreachable:`bg-danger/15 text-danger`,error:`bg-danger/15 text-danger`};function J({kind:e,onResolved:t,onBack:i}){let{t:o}=k(),[s,l]=r(e===W?`alexa-login`:`existing`),u=D({kind:e}),d=n(()=>G(u.data).filter(t=>t.kind===e),[u.data,e]),f=O(),p=n(()=>{for(let t of K(f.data))if(t.kinds.some(t=>t.kind===e))return t.addonId},[f.data,e]),[h,g]=r(null),[v,y]=r(``),b=C({}),x=()=>{h&&t(h)},S=async n=>{v.trim().length!==0&&t((await b.mutateAsync({kind:e,name:v.trim(),settings:n,...p===void 0?{}:{addonId:p}})).id)},w=e=>{e===`new`?g(null):b.reset(),l(e)};return a(`div`,{className:`space-y-4`,children:[a(`button`,{type:`button`,onClick:i,className:`inline-flex items-center gap-1 text-[11px] text-foreground-subtle hover:text-foreground`,children:[c(_,{className:`h-3.5 w-3.5`}),` `,o(`common.back`)]}),a(`div`,{className:`inline-flex rounded-lg border border-border p-0.5 flex-wrap gap-0.5`,children:[e===W&&c(`button`,{type:`button`,onClick:()=>w(`alexa-login`),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${s===`alexa-login`?`bg-primary text-primary-foreground`:`text-foreground-subtle hover:text-foreground`}`,children:o(`integrations.brokerStep.loginInteractively`,`Login interactively`)}),c(`button`,{type:`button`,onClick:()=>w(`existing`),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${s===`existing`?`bg-primary text-primary-foreground`:`text-foreground-subtle hover:text-foreground`}`,children:o(`integrations.brokerStep.useExisting`,`Use existing`)}),c(`button`,{type:`button`,onClick:()=>w(`new`),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${s===`new`?`bg-primary text-primary-foreground`:`text-foreground-subtle hover:text-foreground`}`,children:e===W?o(`integrations.brokerStep.pasteCookie`,`Paste cookie`):o(`integrations.brokerStep.createNew`,`Create new`)})]}),s===`alexa-login`&&c(U,{onResolved:t,onCancel:i}),s===`existing`&&a(`div`,{className:`space-y-3`,children:[u.isLoading&&a(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[c(m,{className:`h-3.5 w-3.5 animate-spin`}),` `,o(`integrations.brokerStep.loadingBrokers`)]}),u.isError&&a(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:[o(`integrations.brokerStep.failedToLoadBrokers`,`Failed to load brokers:`),` `,u.error instanceof Error?u.error.message:o(`integrations.brokerStep.unknownError`,`Unknown error`)]}),!u.isLoading&&!u.isError&&d.length===0&&c(`div`,{className:`rounded-lg border border-border bg-surface px-3 py-6 text-center text-xs text-foreground-subtle`,children:c(j,{i18nKey:`integrations.brokerStep.noBrokers`,values:{mode:e===W?o(`integrations.brokerStep.loginInteractively`,`Login interactively`):o(`integrations.brokerStep.createNew`,`Create new`)},components:{b:c(`span`,{className:`font-medium text-foreground`})}})}),c(`div`,{className:`space-y-2`,children:d.map(e=>a(`button`,{type:`button`,onClick:()=>g(e.id),className:`flex w-full items-center justify-between gap-3 rounded-lg border bg-surface p-3 text-left transition-colors ${h===e.id?`border-primary ring-1 ring-primary`:`border-border hover:border-foreground-subtle/30`}`,children:[c(`span`,{className:`text-xs font-semibold text-foreground`,children:e.name}),c(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium ${q[e.status]}`,children:e.status})]},e.id))}),d.length>0&&c(`div`,{className:`flex justify-end pt-1`,children:c(`button`,{type:`button`,onClick:x,disabled:!h,className:`inline-flex items-center gap-1.5 rounded bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:o(`integrations.brokerStep.useThisBroker`,`Use this broker`)})})]}),s===`new`&&a(`div`,{className:`space-y-3`,children:[a(`div`,{className:`space-y-1`,children:[c(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:o(`integrations.brokerStep.name`,`Name`)}),c(`input`,{type:`text`,value:v,onChange:e=>y(e.target.value),placeholder:o(`integrations.brokerStep.myHomeAssistant`,`My Home Assistant`),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`})]}),b.isError&&c(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:b.error instanceof Error?b.error.message:String(b.error)}),c(M,{kind:e,...p===void 0?{}:{addonId:p},onSubmit:e=>{S(e).catch(()=>{})},onCancel:i,submitLabel:b.isPending?o(`integrations.brokerStep.creating`,`Creating…`):o(`integrations.brokerStep.createBroker`,`Create broker`),disabled:b.isPending||v.trim().length===0}),v.trim().length===0&&c(`p`,{className:`text-[10px] text-foreground-subtle`,children:o(`integrations.brokerStep.enterANameBeforeCreating`,`Enter a name before creating.`)})]})]})}e();function Y(e){return{status:e.status===`validated`||e.status===`rejected`||e.status===`inconclusive`||e.status===`unsupported`?e.status:e.success?`validated`:`rejected`,...e.error===void 0?{}:{error:e.error},...e.detail===void 0?{}:{detail:e.detail}}}var X={validated:`border-success/30 bg-success/5 text-success`,rejected:`border-danger/30 bg-danger/5 text-danger`,inconclusive:`border-warning/30 bg-warning/5 text-warning`,unsupported:`border-border bg-surface text-foreground-subtle`};function Z({addonId:e,configSchema:t,canTest:n=!0,initialName:i,initialConfig:o,submitLabel:s,hideName:l=!1,onSave:u,onBack:d}){let{t:f}=k(),[p,m]=r(i??``),[h,g]=r(o??{}),[_,v]=r(null),b=w({onSuccess:e=>v(Y(e)),onError:e=>v({status:`inconclusive`,error:String(e)})});return a(`div`,{className:`space-y-4`,children:[!l&&a(`div`,{children:[c(`label`,{className:`block text-[11px] font-medium text-foreground mb-1`,children:f(`integrations.integrationName`)}),c(`input`,{type:`text`,value:p,onChange:e=>m(e.target.value),placeholder:f(`integrations.integrationNamePlaceholder`),className:`w-full rounded-lg border border-border bg-surface px-3 py-2 text-xs text-foreground placeholder:text-foreground-subtle focus:outline-none focus:border-primary/50`})]}),t&&c(A,{schema:t,values:h,onChange:g}),_&&c(`div`,{className:`rounded-lg border px-3 py-2 text-xs ${X[_.status]}`,children:(e=>{switch(e.status){case`validated`:return e.detail?`${f(`integrations.connectionSuccess`)} — ${e.detail}`:f(`integrations.connectionSuccess`);case`rejected`:return`${f(`integrations.errorPrefix`)} ${e.error??``}`;case`inconclusive`:return`${f(`integrations.connectionInconclusive`,{defaultValue:`Could not be checked:`})} ${e.error??``}`;case`unsupported`:return e.error??f(`integrations.connectionUntestable`,{defaultValue:`This integration cannot be tested before it is created.`})}})(_)}),a(`div`,{className:`flex items-center justify-between pt-2`,children:[c(`button`,{onClick:d,className:`rounded-lg border border-border px-3 py-1.5 text-xs text-foreground-subtle hover:text-foreground transition-colors`,children:f(`integrations.back`)}),a(`div`,{className:`flex items-center gap-2`,children:[c(`button`,{onClick:()=>b.mutate({addonId:e,settings:h}),disabled:b.isPending||!n,title:n?void 0:f(`integrations.connectionUntestable`,{defaultValue:`This integration cannot be tested before it is created.`}),className:`rounded-lg border border-border px-3 py-1.5 text-xs text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,children:b.isPending?f(`integrations.testing`):f(`integrations.testConnection`)}),c(`button`,{onClick:()=>u({name:p,config:h,secretKeys:[...y(t)]}),disabled:l?!1:!p.trim(),className:`rounded-lg bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground shadow-sm disabled:opacity-50`,children:s??f(`integrations.forward`)})]})]})]})}e();function Q({open:e,onClose:t,scope:o}){let{t:s}=k(),u=x(),[d,f]=r(new Set),[_,v]=r(new Set),{data:y}=E({projection:`slim`}),b=n(()=>new Set((y??[]).map(e=>e.stableId)),[y]),S=i(async(e,t)=>{v(e=>new Set(e).add(t.stableId));try{await u.mutateAsync({addonId:e,candidate:t}),f(e=>new Set(e).add(t.stableId))}catch{}finally{v(e=>{let n=new Set(e);return n.delete(t.stableId),n})}},[u]),C=i((e,t)=>{let n=typeof t.prefilledConfig.host==`string`?t.prefilledConfig.host:null,r=b.has(t.stableId),i=d.has(t.stableId)||r,o=_.has(t.stableId);return a(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-surface px-3 py-2`,children:[a(`div`,{className:`min-w-0`,children:[c(`p`,{className:`truncate text-xs font-medium text-foreground`,children:t.suggestedName}),n&&c(`p`,{className:`truncate text-[10px] font-mono text-foreground-subtle`,children:n})]}),i?a(`span`,{className:`flex items-center gap-1 text-[11px] text-foreground-subtle`,children:[c(h,{className:`h-3.5 w-3.5`}),` `,r?s(`integrations.scanNetworkModal.alreadyAdded`,`Already added`):s(`integrations.scanNetworkModal.added`,`Added`)]}):a(`button`,{type:`button`,onClick:()=>void S(e,t),disabled:o,className:`flex items-center gap-1 rounded-md bg-primary px-2.5 py-1 text-[11px] font-medium text-primary-foreground disabled:opacity-50`,children:[o?c(m,{className:`h-3.5 w-3.5 animate-spin`}):c(l,{className:`h-3.5 w-3.5`}),s(`common.add`,`Add`)]})]},t.stableId)},[d,_,b,S,s]);if(!e)return null;let w=o?`Scan network — ${o.label}`:`Scan network for devices`;return a(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[c(`div`,{className:`absolute inset-0 bg-black/60`,onClick:t}),a(`div`,{className:`relative z-10 flex w-full max-w-2xl flex-col max-h-[calc(90dvh-2*max(env(safe-area-inset-top),env(safe-area-inset-bottom)))] rounded-xl border border-border bg-background shadow-2xl`,children:[a(`div`,{className:`flex items-center justify-between border-b border-border px-5 py-4 shrink-0`,children:[a(`div`,{className:`flex items-center gap-2`,children:[c(p,{className:`h-4 w-4 text-primary`}),c(`h2`,{className:`text-sm font-semibold text-foreground`,children:w})]}),c(`button`,{onClick:t,className:`rounded-md p-1 text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,children:c(g,{className:`h-4 w-4`})})]}),o?c(te,{scope:o,onAdopt:C,onReset:()=>f(new Set)}):c(ee,{onAdopt:C,onReset:()=>f(new Set)})]})]})}function ee({onAdopt:e,onReset:r}){let{t:s}=k(),l=T(),u=i(()=>{r(),l.mutate({})},[l,r]);t(()=>{!l.isPending&&!l.data&&u()},[]);let d=n(()=>(l.data?.groups??[]).filter(e=>e.candidates.length>0),[l.data]),f=n(()=>d.reduce((e,t)=>e+t.candidates.length,0),[d]);return a(o,{children:[c(`div`,{className:`flex items-center justify-end gap-2 border-b border-border px-5 py-2 shrink-0`,children:a(`button`,{onClick:u,disabled:l.isPending,className:`flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50`,children:[c(v,{className:`h-3.5 w-3.5 ${l.isPending?`animate-spin`:``}`}),s(`integrations.scanNetworkModal.reScan`,`Re-scan`)]})}),a(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-5 py-4 space-y-4`,children:[l.isPending&&c(ne,{label:s(`integrations.scanNetworkModal.scanningTheLocalNetwork`,`Scanning the local network…`)}),!l.isPending&&l.isError&&c($,{}),!l.isPending&&l.data&&d.length===0&&c(`p`,{className:`py-8 text-center text-xs text-foreground-subtle`,children:s(`integrations.scanNetworkModal.noDevicesRespondedToThe`,`No devices responded to the scan.`)}),!l.isPending&&d.length>0&&c(`p`,{className:`text-xs text-foreground-subtle`,children:s(`integrations.scanNetworkModal.found`,{count:f})}),!l.isPending&&d.map(t=>a(`div`,{className:`space-y-1.5`,children:[a(`div`,{className:`flex items-center gap-2`,children:[c(`span`,{className:`text-[11px] font-semibold text-foreground`,children:t.label}),a(`span`,{className:`text-[10px] text-foreground-subtle`,children:[`(`,t.candidates.length,`)`]})]}),t.candidates.map(n=>e(t.addonId,n))]},t.addonId))]})]})}function te({scope:e,onAdopt:t,onReset:n}){let{t:s}=k(),l=b({addonId:e.addonId}).data??null,[u,d]=r({}),f=S(),h=i(()=>{n(),f.mutate({addonId:e.addonId,params:u})},[f,e.addonId,u,n]),g=f.data?.candidates??[];return c(o,{children:a(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-5 py-4 space-y-4`,children:[l&&c(A,{schema:l,values:u,onChange:d}),a(`button`,{onClick:h,disabled:f.isPending,className:`flex items-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground disabled:opacity-50`,children:[f.isPending?c(m,{className:`h-3.5 w-3.5 animate-spin`}):c(p,{className:`h-3.5 w-3.5`}),f.isPending?s(`integrations.scanNetworkModal.scanning`,`Scanning…`):s(`integrations.scanNetworkModal.scan`,`Scan`)]}),f.isError&&c($,{}),!f.isPending&&f.data&&g.length===0&&c(`p`,{className:`py-6 text-center text-xs text-foreground-subtle`,children:s(`integrations.scanNetworkModal.noDevicesRespondedToThe`,`No devices responded to the scan.`)}),!f.isPending&&g.length>0&&a(`div`,{className:`space-y-1.5`,children:[c(`p`,{className:`text-xs text-foreground-subtle`,children:s(`integrations.scanNetworkModal.foundShort`,{count:g.length})}),g.map(n=>t(e.addonId,n))]})]})})}function ne({label:e}){return a(`div`,{className:`flex flex-col items-center py-12`,children:[c(m,{className:`h-6 w-6 animate-spin text-primary`}),c(`p`,{className:`mt-3 text-xs text-foreground-subtle`,children:e})]})}function $(){let{t:e}=k();return a(`div`,{className:`flex items-start gap-3 rounded-lg border border-destructive/40 bg-destructive/10 px-4 py-3`,children:[c(u,{className:`h-4 w-4 text-destructive mt-0.5 shrink-0`}),c(`p`,{className:`text-xs text-destructive`,children:e(`integrations.scanNetworkModal.theScanFailedTryAgain`,`The scan failed. Try again.`)})]})}export{Z as n,J as r,Q as t};
@@ -1 +0,0 @@
1
- import{$ as e,B as t,G as n,J as r,L as i,S as a,b as o,q as s,x as c}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEHpkaJP.js";import{G as l,It as u,J as d,K as f,Q as p,U as m,c as h,d as g,f as _,gr as v,ia as y,l as ee,ot as te,p as b,s as x,ta as S,vn as C,wi as w,z as T}from"./player-overlays-CVyuEj4x.js";import{t as E}from"./settings-2-3k9hj27t.js";import{MaskShapeCanvas as ne}from"./MaskShapeCanvas-BDELFcW-.js";e();var D=p(`/addon/pipeline-analytics/event-media`);function O(e){return`${D}/m/${e}`}function k(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 A(e){return e.states.reduce((e,t)=>e+t.references.length,0)}var j=`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 M({monitor:e,disabled:t,onDelete:n}){let i=y(),o=k(e),s=A(e),[l,d]=r(null);return o.length===0?c(`p`,{className:`${T} leading-relaxed`,children:i(`uiLibrary.sceneReferenceGallery.empty`,`No photographs captured yet. Press “Capture daylight” to take the one this scene will judge everything against.`)}):c(`div`,{className:`flex flex-col gap-2`,children:o.map(e=>a(`div`,{className:`flex flex-col gap-1`,children:[a(`p`,{className:`text-[10px] font-semibold uppercase tracking-wide text-foreground-subtle`,children:[b(e.condition,i),` · `,e.tiles.length]}),c(`ul`,{className:`flex flex-wrap gap-1.5`,children:e.tiles.map(r=>{let o=`${r.stateId}:${String(r.index)}`,f=s===1,p=l===o;return a(`li`,{className:`flex w-24 flex-col gap-1 rounded-md border border-border p-1`,children:[c(N,{reference:r.reference}),c(`span`,{className:`${T} tabular-nums`,children:P(r.reference.capturedAt)}),a(`button`,{type:`button`,className:j,disabled:t,"aria-label":i(`uiLibrary.sceneReferenceGallery.deleteLabel`,`Delete the {{variant}} photograph from {{date}}`,{variant:b(e.condition,i).toLowerCase(),date:P(r.reference.capturedAt)}),onClick:()=>{if(f&&!p){d(o);return}d(null),n({stateId:r.stateId,index:r.index})},children:[c(u,{className:`mr-1 inline h-3 w-3`}),p?i(`uiLibrary.sceneReferenceGallery.confirm`,`Confirm`):i(`uiLibrary.sceneReferenceGallery.delete`,`Delete`)]}),p&&c(`p`,{className:`text-[10px] leading-snug text-warning`,children:i(`uiLibrary.sceneReferenceGallery.lastWarning`,`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 N({reference:e}){let t=y(),[n,i]=r(!1),o=e.thumbnailMediaId;return o===void 0||n?a(`div`,{className:`flex h-16 w-full flex-col items-center justify-center gap-0.5 rounded bg-surface text-foreground-subtle`,title:t(`uiLibrary.sceneReferenceGallery.missingPicture`,`The picture for this reference is no longer stored. The reference itself is intact and still being scored against.`),children:[c(v,{className:`h-4 w-4`}),c(`span`,{className:`text-[9px]`,children:t(`uiLibrary.sceneReferenceGallery.noPicture`,`no picture`)})]}):c(`img`,{src:O(o),alt:``,loading:`lazy`,className:`h-16 w-full rounded object-cover`,onError:()=>i(!0)})}function P(e){let t=new Date(e);return`${t.toLocaleDateString()} ${t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}`}e();var F=`rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground focus:border-primary focus:outline-none disabled:opacity-50`,I=`text-[10px] font-medium text-foreground-subtle`,L=`flex flex-col gap-2 rounded-md border border-border bg-surface/40 p-2`,R=`text-[10px] font-semibold uppercase tracking-wide text-foreground-subtle`,z=5,B=3600;function V(e,t){switch(e){case`periodic`:return t(`uiLibrary.sceneSettingsForm.triggerHintPeriodic`,`Only on the clock. Predictable, and it notices a change even on a camera nothing ever moves in front of.`);case`on-motion`:return t(`uiLibrary.sceneSettingsForm.triggerHintOnMotion`,`Only after the camera has been still again for the quiet window below. Cheapest, but a change nobody walks past is never seen.`);case`both`:return t(`uiLibrary.sceneSettingsForm.triggerHintBoth`,`Both — the clock is the safety net that lets the motion path miss. This is the right answer for almost every scene.`)}}function H(e,t){switch(e){case`skip`:return t(`uiLibrary.sceneSettingsForm.uncoveredHintSkip`,`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.`);case`judge-anyway`:return t(`uiLibrary.sceneSettingsForm.uncoveredHintJudge`,`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 U(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 W({monitor:e,disabled:n,onPatch:i}){let s=y(),[l,u]=r(()=>U(e)),[d,f]=r(!1);t(()=>{d||u(U(e))},[e,d]);let p=e=>{f(!1),i(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 a(`div`,{className:`flex flex-col gap-2`,children:[a(`div`,{className:L,children:[c(`p`,{className:R,children:s(`uiLibrary.sceneSettingsForm.whatItWatches`,`What it watches`)}),a(`label`,{className:`flex flex-col gap-1`,children:[c(`span`,{className:I,children:s(`uiLibrary.sceneSettingsForm.name`,`Name`)}),c(`input`,{type:`text`,value:l.label,disabled:n,className:F,onFocus:()=>f(!0),onChange:e=>u(t=>({...t,label:e.target.value})),onBlur:()=>{let t=l.label.trim();t.length>0&&t!==e.label?p({label:t}):f(!1)}})]}),a(`label`,{className:`flex items-center gap-2`,children:[c(`input`,{type:`checkbox`,checked:e.enabled,disabled:n,onChange:e=>p({enabled:e.target.checked})}),c(`span`,{className:I,children:s(`uiLibrary.sceneSettingsForm.watching`,`Watching`)})]}),c(`p`,{className:T,children:s(`uiLibrary.sceneSettingsForm.watchingHint`,`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.`)}),a(`label`,{className:`flex flex-col gap-1`,children:[c(`span`,{className:I,children:s(`uiLibrary.sceneSettingsForm.whenToLook`,`When to look`)}),a(`select`,{value:e.triggerMode,disabled:n,className:F,onChange:e=>{let t=e.target.value;(t===`periodic`||t===`on-motion`||t===`both`)&&p({triggerMode:t})},children:[c(`option`,{value:`both`,children:s(`uiLibrary.sceneSettingsForm.triggerBoth`,`On the clock and after motion settles`)}),c(`option`,{value:`periodic`,children:s(`uiLibrary.sceneSettingsForm.triggerPeriodic`,`On the clock only`)}),c(`option`,{value:`on-motion`,children:s(`uiLibrary.sceneSettingsForm.triggerOnMotion`,`After motion settles only`)})]})]}),c(`p`,{className:T,children:V(e.triggerMode,s)}),a(`label`,{className:`flex flex-col gap-1`,children:[c(`span`,{className:I,children:s(`uiLibrary.sceneSettingsForm.checkEvery`,`Check every (seconds)`)}),c(`input`,{type:`number`,min:z,max:B,value:l.checkIntervalSec,disabled:n,className:F,onFocus:()=>f(!0),onChange:e=>u(t=>({...t,checkIntervalSec:Number(e.target.value)||0})),onBlur:()=>{let t=G(l.checkIntervalSec,z,B);t===e.checkIntervalSec?f(!1):p({checkIntervalSec:t})}})]}),c(`p`,{className:T,children:s(`uiLibrary.sceneSettingsForm.intervalHint`,`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.`)})]}),a(`div`,{className:L,children:[c(`p`,{className:R,children:s(`uiLibrary.sceneSettingsForm.howSure`,`How sure it has to be`)}),e.check.mode===`similarity`&&a(o,{children:[a(`label`,{className:`flex flex-col gap-1`,children:[c(`span`,{className:I,children:c(S,{uiKey:`uiLibrary.sceneSettingsForm.matchThreshold`,fallback:`Match threshold — <0>{{value}}</0>`,components:[c(`span`,{className:`tabular-nums`},`value`)],values:{value:l.threshold.toFixed(2)}})}),c(`input`,{type:`range`,min:.3,max:.99,step:.01,value:l.threshold,disabled:n,onFocus:()=>f(!0),onChange:e=>u(t=>({...t,threshold:Number(e.target.value)})),onMouseUp:()=>{l.threshold===g?f(!1):p({check:m({threshold:l.threshold})})},onBlur:()=>{l.threshold===g?f(!1):p({check:m({threshold:l.threshold})})}})]}),c(`p`,{className:`text-[10px] text-foreground-subtle`,children:s(`uiLibrary.sceneSettingsForm.thresholdHint`,`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.`)})]}),a(`label`,{className:`flex flex-col gap-1`,children:[c(`span`,{className:I,children:s(`uiLibrary.sceneSettingsForm.agreeingChecks`,`Agreeing checks before it changes its mind`)}),c(`input`,{type:`number`,min:1,max:10,value:l.hysteresisCount,disabled:n,className:F,onFocus:()=>f(!0),onChange:e=>u(t=>({...t,hysteresisCount:Number(e.target.value)||1})),onBlur:()=>{let t=G(l.hysteresisCount,1,10);t===e.check.hysteresisCount?f(!1):p({check:m({hysteresisCount:t})})}})]}),c(`p`,{className:T,children:s(`uiLibrary.sceneSettingsForm.agreeingHint`,`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.`)}),a(`label`,{className:`flex flex-col gap-1`,children:[c(`span`,{className:I,children:s(`uiLibrary.sceneSettingsForm.quietFor`,`Quiet for (seconds) before a check counts`)}),c(`input`,{type:`number`,min:0,max:3600,value:l.quietSeconds,disabled:n,className:F,onFocus:()=>f(!0),onChange:e=>u(t=>({...t,quietSeconds:Number(e.target.value)||0})),onBlur:()=>{let t=G(l.quietSeconds,0,3600);t===e.quietSeconds?f(!1):p({quietSeconds:t})}})]}),c(`p`,{className:T,children:s(`uiLibrary.sceneSettingsForm.quietHint`,`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.`)}),a(`label`,{className:`flex flex-col gap-1`,children:[c(`span`,{className:I,children:s(`uiLibrary.sceneSettingsForm.minGap`,`Minimum gap between counted checks (seconds)`)}),c(`input`,{type:`number`,min:0,max:3600,value:l.minObservationSpacingSec,disabled:n,className:F,onFocus:()=>f(!0),onChange:e=>u(t=>({...t,minObservationSpacingSec:Number(e.target.value)||0})),onBlur:()=>{let t=G(l.minObservationSpacingSec,0,3600);t===e.minObservationSpacingSec?f(!1):p({minObservationSpacingSec:t})}})]}),c(`p`,{className:T,children:s(`uiLibrary.sceneSettingsForm.minGapHint`,`Spreads the agreeing checks over real time instead of letting three adjacent polls inside one long occlusion be mistaken for three independent opinions.`)})]}),a(`div`,{className:L,children:[c(`p`,{className:R,children:s(`uiLibrary.sceneSettingsForm.lighting`,`Lighting`)}),a(`label`,{className:`flex flex-col gap-1`,children:[c(`span`,{className:I,children:s(`uiLibrary.sceneSettingsForm.noReference`,`When a light has no reference of its own`)}),a(`select`,{value:e.onUncoveredCondition,disabled:n,className:F,onChange:e=>{let t=e.target.value;(t===`skip`||t===`judge-anyway`)&&p({onUncoveredCondition:t})},children:[c(`option`,{value:`skip`,children:s(`uiLibrary.sceneSettingsForm.uncoveredSkip`,`Skip the check (recommended)`)}),c(`option`,{value:`judge-anyway`,children:s(`uiLibrary.sceneSettingsForm.uncoveredJudge`,`Judge against the other light anyway`)})]})]}),c(`p`,{className:T,children:H(e.onUncoveredCondition,s)})]}),a(`div`,{className:L,children:[c(`p`,{className:R,children:s(`uiLibrary.sceneSettingsForm.whatYouGetTold`,`What you get told`)}),a(`label`,{className:`flex flex-col gap-1`,children:[c(`span`,{className:I,children:s(`uiLibrary.sceneSettingsForm.notificationsFollow`,`Notifications follow`)}),a(`select`,{value:e.emit,disabled:n,className:F,onChange:e=>{let t=e.target.value;(t===`latched`||t===`live`)&&p({emit:t})},children:[c(`option`,{value:`latched`,children:s(`uiLibrary.sceneSettingsForm.emitLatched`,`The flag — told once, still visible at breakfast`)}),c(`option`,{value:`live`,children:s(`uiLibrary.sceneSettingsForm.emitLive`,`The live state — follows the region as it changes`)})]})]}),c(`p`,{className:T,children:s(`uiLibrary.sceneSettingsForm.emitHint`,`“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.`)}),a(`label`,{className:`flex items-center gap-2`,children:[c(`input`,{type:`checkbox`,checked:e.autoRestore,disabled:n,onChange:e=>p({autoRestore:e.target.checked})}),c(`span`,{className:I,children:s(`uiLibrary.sceneSettingsForm.autoRestore`,`Clear the flag by itself when things look normal again`)})]}),c(`p`,{className:T,children:s(`uiLibrary.sceneSettingsForm.autoRestoreHint`,`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.`)})]}),a(`div`,{className:L,children:[c(`p`,{className:R,children:s(`uiLibrary.sceneSettingsForm.aiDoubleCheck`,`AI double-check`)}),a(`label`,{className:`flex items-center gap-2`,children:[c(`input`,{type:`checkbox`,checked:h,disabled:n||l.confirmPrompt.trim().length===0,onChange:e=>p(e.target.checked?{confirm:{...K(l.confirmPrompt.trim()),enabled:!0}}:{confirm:null})}),c(`span`,{className:I,children:s(`uiLibrary.sceneSettingsForm.askVision`,`Ask a vision model before changing the answer`)})]}),a(`label`,{className:`flex flex-col gap-1`,children:[c(`span`,{className:I,children:s(`uiLibrary.sceneSettingsForm.question`,`The question to ask`)}),c(`input`,{type:`text`,value:l.confirmPrompt,placeholder:s(`uiLibrary.sceneSettingsForm.questionPlaceholder`,`e.g. Is the wheelie bin still there?`),disabled:n,className:F,onFocus:()=>f(!0),onChange:e=>u(t=>({...t,confirmPrompt:e.target.value})),onBlur:()=>{let t=l.confirmPrompt.trim();t.length>0&&t!==e.confirm?.prompt?p({confirm:{...K(t),enabled:h}}):f(!1)}})]}),c(`p`,{className:T,children:c(S,{uiKey:`uiLibrary.sceneSettingsForm.confirmHint`,fallback:`The model is asked <0>only</0> 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.`,components:[c(`strong`,{},`only`)]})})]})]})}function G(e,t,n){return Math.min(n,Math.max(t,e))}function K(e){return{enabled:!1,prompt:e,timeoutMs:8e3,maxImagePx:448,onTimeout:`hold`}}e();var q=`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`,J=`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`,re=`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`,ie={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`},ae=.8,oe=3;function Y({deviceId:e}){let p=y(),v=f(te().trpcClient,e),S=d(v?.state.sceneMonitor),D=l(e,{width:640}),[O,k]=r(null),[A,j]=r(!1),[N,P]=r(null),[F,I]=r(null),[L,R]=r(null),[z,B]=r(null),[V,H]=r(!1),[U,G]=r(null),[K,Y]=r(``),X=s(!0);t(()=>(X.current=!0,()=>{X.current=!1}),[]);let Z=i(async()=>{if(v)try{let e=await v.sceneMonitor?.listScenes({});if(!X.current)return;e&&k(e)}catch(e){if(!X.current)return;m(e)?j(!0):I(e instanceof Error?e.message:String(e))}},[v]);t(()=>{k(null),j(!1),I(null),Z()},[Z]);let Q=S?.monitors??O?.monitors??[],se=Date.now(),$=i(async(e,t)=>{P(e),I(null);try{await t(),await Z()}catch(e){X.current&&I(e instanceof Error?e.message:String(e))}finally{X.current&&P(null)}},[Z]),ce=n(()=>{let e=Q.map(e=>({id:e.id,shape:e.roi,label:e.label,enabled:e.enabled}));return U===null?e:[...e,{id:`__draft__`,shape:U,label:p(`uiLibrary.sceneMonitor.newSceneLabel`,`New scene`)}]},[Q,U,p]),le=i((e,t)=>{if(t.kind===`rect`){if(e===`__draft__`){G(t);return}$(`roi-${String(e)}`,async()=>v?.sceneMonitor?.updateScene({monitorId:String(e),patch:{roi:t}}))}},[v,$]),ue=i(e=>{e.kind===`rect`&&G(e)},[]),de=i(async()=>{U===null||K.trim().length===0||(await $(`create`,async()=>{await v?.sceneMonitor?.createScene({label:K.trim(),roi:U,check:{mode:`similarity`,threshold:ae,hysteresisCount:oe}})}),G(null),Y(``),H(!1))},[v,U,K,$]);return v?c(`div`,{className:`flex flex-col gap-3`,children:A?c(`p`,{className:`${T} leading-relaxed`,children:p(`uiLibrary.sceneMonitor.unsupported`,`Scene monitoring is not available for this camera.`)}):a(o,{children:[c(`p`,{className:`${T} leading-relaxed`,children:p(`uiLibrary.sceneMonitor.intro`,`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.`)}),c(`div`,{className:`relative overflow-hidden rounded-md border border-border`,children:c(ne,{items:ce,supportedShapes:[`rect`],selectedId:L??(U===null?null:`__draft__`),onSelect:e=>R(e===null?null:String(e)),onShapeChange:le,onDrawComplete:ue,drawingKind:V&&U===null?`rect`:null,backdrop:D.src===null?null:c(`img`,{src:D.src,alt:``,className:`h-full w-full object-contain`,draggable:!1})})}),a(`div`,{className:`flex flex-wrap items-center gap-2`,children:[c(`button`,{type:`button`,className:V?J:q,"aria-pressed":V,onClick:()=>{H(e=>!e),G(null)},disabled:N!==null,children:V?p(`uiLibrary.sceneMonitor.cancel`,`Cancel`):p(`uiLibrary.sceneMonitor.newScene`,`+ New scene`)}),c(`button`,{type:`button`,className:q,onClick:D.refresh,disabled:N!==null,children:p(`uiLibrary.sceneMonitor.refresh`,`Refresh frame`)})]}),V&&a(`div`,{className:`flex flex-col gap-2 rounded-md border border-border bg-surface p-2`,children:[c(`p`,{className:`text-[10px] text-foreground-subtle`,children:U===null?p(`uiLibrary.sceneMonitor.draftHint`,`Click on the frame to drop a box, then drag its corner to fit it around the thing you want watched.`):p(`uiLibrary.sceneMonitor.nameHint`,`Name it, then create. You capture what “normal” looks like next.`)}),U!==null&&g(U)&&c(`p`,{className:`text-[11px] leading-relaxed text-warning`,children:p(`uiLibrary.sceneMonitor.tooLarge`,`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.`)}),a(`div`,{className:`flex items-center gap-2`,children:[c(`input`,{type:`text`,value:K,onChange:e=>Y(e.target.value),placeholder:p(`uiLibrary.sceneMonitor.placeholder`,`e.g. Immondizia prelevata`),className:`flex-1 rounded-md border border-border bg-surface px-2 py-1 text-[12px] text-foreground`}),c(`button`,{type:`button`,className:J,onClick:()=>void de(),disabled:U===null||K.trim().length===0||N!==null,children:p(`uiLibrary.sceneMonitor.create`,`Create`)})]})]}),F!==null&&c(`p`,{className:`text-[11px] leading-relaxed text-danger`,children:F}),Q.length===0?c(`p`,{className:`${T} leading-relaxed`,children:p(`uiLibrary.sceneMonitor.empty`,`No scenes on this camera yet.`)}):c(`ul`,{className:`flex flex-col gap-2`,children:Q.map(e=>{let t=h(e,p);return a(`li`,{className:`flex flex-col gap-1.5 rounded-md border p-2 ${L===e.id?`border-primary/50`:`border-border`}`,children:[a(`div`,{className:`flex items-center gap-2`,children:[c(`button`,{type:`button`,className:`flex-1 text-left text-[12px] font-medium text-foreground`,onClick:()=>R(e.id),children:e.label}),c(`span`,{className:`rounded border px-1.5 py-0.5 text-[10px] font-medium ${ie[t.tone]}`,children:t.text})]}),c(`p`,{className:`${T} leading-relaxed`,children:_(e,se,p)}),c(`p`,{className:`${T} tabular-nums`,children:ee(e,p)}),c(M,{monitor:e,disabled:N!==null,onDelete:({stateId:t,index:n})=>void $(`refdel-${e.id}-${t}-${String(n)}`,async()=>v.sceneMonitor?.deleteReference({monitorId:e.id,stateId:t,index:n}))}),a(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[x.map(t=>{let n=t===`ir`;return a(`button`,{type:`button`,className:q,disabled:N!==null,title:n?p(`uiLibrary.sceneMonitor.optionalTitle`,`Optional. Without a night reference the checks in infrared are simply skipped — the scene keeps working in daylight and nothing is reported as broken.`):p(`uiLibrary.sceneMonitor.captureTitle`,`Take a fresh photo now and store it as the {{variant}} reference`,{variant:b(t,p).toLowerCase()}),onClick:()=>void $(`cap-${e.id}-${t}`,async()=>v.sceneMonitor?.captureReference({monitorId:e.id,condition:t})),children:[c(w,{className:`mr-1 inline h-3 w-3`}),p(`uiLibrary.sceneMonitor.capture`,`Capture {{variant}}`,{variant:b(t,p).toLowerCase()}),n&&c(`span`,{className:`ml-1 text-foreground-subtle/70`,children:p(`uiLibrary.sceneMonitor.optional`,`(optional)`)})]},t)}),a(`button`,{type:`button`,className:J,disabled:N!==null||e.states.length===0,title:p(`uiLibrary.sceneMonitor.resetTitle`,`Clear the flag and re-photograph what normal looks like right now`),onClick:()=>void $(`reset-${e.id}`,async()=>v.sceneMonitor?.resetScene({monitorId:e.id})),children:[c(C,{className:`mr-1 inline h-3 w-3`}),p(`uiLibrary.sceneMonitor.reset`,`Reset`)]}),c(`button`,{type:`button`,className:q,disabled:N!==null,onClick:()=>void $(`check-${e.id}`,async()=>v.sceneMonitor?.recheckNow({monitorId:e.id})),children:p(`uiLibrary.sceneMonitor.checkNow`,`Check now`)}),a(`button`,{type:`button`,className:z===e.id?J:q,"aria-pressed":z===e.id,"aria-label":p(`uiLibrary.sceneMonitor.settingsFor`,`Settings for {{label}}`,{label:e.label}),disabled:N!==null,onClick:()=>B(t=>t===e.id?null:e.id),children:[c(E,{className:`mr-1 inline h-3 w-3`}),p(`uiLibrary.sceneMonitor.settings`,`Settings`)]}),c(`button`,{type:`button`,className:re,disabled:N!==null,onClick:()=>void $(`del-${e.id}`,async()=>v.sceneMonitor?.deleteScene({monitorId:e.id})),children:c(u,{className:`h-3 w-3`})})]}),z===e.id&&c(W,{monitor:e,disabled:N!==null,onPatch:t=>void $(`tune-${e.id}`,async()=>v.sceneMonitor?.updateScene({monitorId:e.id,patch:t}))})]},e.id)})})]})}):null}export{Y as SceneMonitorEditor};
@@ -1,2 +0,0 @@
1
- import{$ as e,G as t,J as n,L as r,S 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-CEHpkaJP.js";import{D as s,It as c,ar as l,cn as u,di as d,dt as f,ot as p}from"./player-overlays-CVyuEj4x.js";import{i as m,o as h}from"./video-BAANd9N-.js";import{t as g}from"./key-round-C__KHy-x.js";import{t as _}from"./octagon-alert-CkSZIflH.js";import{An as v,Bl as y,Bn as b,Cu as x,It as S,Kt as C,Lt as ee,Mn as w,Nn as te,On as T,Pn as E,Un as D,Wt as ne,cr as re,du as O,er as ie,iu as ae,jn as oe,qt as se,ru as ce,tr as k,va as le}from"./src-D7EY8vSW.js";import{t as A}from"./i18n-GaxP0h6E.js";import{t as j}from"./useTranslation-D3Is_4B6.js";import{B as ue,a as de,o as fe}from"./index-tgPOSbne.js";e();function M({id:e,title:t,icon:n,description:r,actions:a,tone:c=`default`,notice:l=null,onDismissNotice:u,children:d}){return o(ne,{headingId:`access-${e}`,title:t,icon:n,actions:a,testId:`access-${e}`,children:i(`div`,{className:`${s} space-y-3`,children:[o(`div`,{className:O(`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:r}),l!==null&&o(me,{notice:l,onDismiss:u}),d]})})}var pe={success:{icon:d,line:`border-success/30 text-foreground`,mark:`text-success`},danger:{icon:_,line:`border-danger/40 text-danger`,mark:`text-danger`}};function me({notice:e,onDismiss:t}){let{t:n}=j(),r=pe[e.tone],a=r.icon;return i(`div`,{role:e.tone===`danger`?`alert`:`status`,className:O(`flex items-start gap-2 rounded-md border bg-surface px-3 py-2 text-[11px]`,r.line),children:[o(a,{className:O(`mt-0.5 h-3.5 w-3.5 shrink-0`,r.mark),"aria-hidden":!0}),o(`span`,{className:`min-w-0 flex-1`,children:e.message}),t!==void 0&&o(ae,{type:`button`,variant:`ghost`,size:`sm`,icon:f,"aria-label":n(`access.accessSection.dismiss`,`Dismiss`),onClick:t,className:`-my-1 h-5 w-5`})]})}function he(){let{data:e}=y();return t(()=>{let t=new Map;for(let n of e??[])t.set(n.id,n.username);return t},[e])}function N(e,t=null){return e===null?t:{tone:`danger`,message:e}}var ge={active:`access.credentialColumns.statusActive`,expired:`access.credentialColumns.statusExpired`,revoked:`access.credentialColumns.statusRevoked`,current:`access.credentialColumns.statusCurrent`};function P(e){return A.t(ge[e])}var _e={active:`success`,expired:`warning`,revoked:`default`,current:`info`},ve={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 ye({status:e}){return o(re,{variant:_e[e],className:`text-[10px]`,children:P(e)})}function be({row:e,action:t}){if(!t.isAvailable(e))return null;let n=t.icon,r=t.busyId===e.id;return i(D,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>t.onRun(e),disabled:t.disabled,"aria-label":A.t(`access.credentialColumns.actionOn`,{action:t.label,name:e.name}),className:t.tone===`neutral`?void 0:`text-danger hover:bg-danger/10`,children:[r?o(l,{className:`h-3 w-3 animate-spin`,"aria-hidden":!0}):o(n,{className:`h-3 w-3`,"aria-hidden":!0}),t.label]})}function xe(e){return[{key:`name`,header:A.t(`access.credentialColumns.name`,`Name`),sortValue:e=>e.name.toLowerCase(),render:e=>i(`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:A.t(`access.credentialColumns.owner`,`Owner`),sortValue:e=>e.ownerName.toLowerCase(),render:e=>e.ownerName},{key:`kind`,header:A.t(`access.credentialColumns.kindScope`,`Kind / scope`),sortValue:e=>e.kind.toLowerCase(),nowrap:!1,render:e=>i(`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:A.t(`access.credentialColumns.status`,`Status`),sortValue:e=>ve[e.status],render:e=>o(ye,{status:e.status})},{key:`created`,header:A.t(`access.credentialColumns.created`,`Created`),sortValue:e=>e.createdAt,render:e=>o(`span`,{className:`text-foreground-subtle`,children:F(e.createdAt,`—`)})},{key:`lastUsed`,header:A.t(`access.credentialColumns.lastUsed`,`Last used`),sortValue:e=>e.lastUsedAt,render:e=>o(`span`,{className:`text-foreground-subtle`,children:F(e.lastUsedAt,A.t(`access.credentialColumns.never`))})},{key:`expires`,header:A.t(`access.credentialColumns.expires`,`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:A.t(`access.credentialColumns.actionsHeader`),render:t=>o(`div`,{className:`flex items-center justify-end gap-1`,children:[...e.extraActions??[],e.action].map(e=>e===null?null:o(be,{row:t,action:e},e.label))})}].filter(e=>e!==null)}e();var I=6,Se={"current-session":`access.bulk.skipCurrentSession`,"not-active":`access.bulk.skipNotActive`};function L(e){let t=Se[e];return t===void 0?e:A.t(t)}function R(e,t){return A.t(t.key,{count:e})}function z(e,t){return A.t(`access.bulk.countOf`,{count:e,noun:R(e,t)})}function Ce(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])=>A.t(`access.bulk.statusCount`,{count:t,status:P(e).toLowerCase()})).join(`, `)}function we(e,t){let n=e.slice(0,I).map(e=>`• ${e.name} — ${e.ownerName}`),r=e.length>I?[A.t(`access.bulk.previewMore`,{count:e.length-I})]:[];return[A.t(`access.bulk.previewIntro`,{what:z(e.length,t),breakdown:Ce(e)}),``,...n,...r].join(`
2
- `)}async function B(e,t,n){let r=String(t.length),i=await e({title:A.t(`access.bulk.confirmTitle`,{what:z(t.length,n)}),message:we(t,n),label:A.t(`access.bulk.confirmLabel`,{expected:r}),placeholder:r,confirmLabel:A.t(`access.bulk.confirmButton`,{expected:r}),variant:`danger`,validate:e=>e.trim()===r?null:A.t(`access.bulk.confirmMismatch`,{expected:r,noun:R(2,n)})});return i!==null&&i.trim()===r}function V(e,t,r){let i=k(),a=x.auth.revokeCredentials.useMutation(),[o,s]=n(null);return{run:async n=>{if(n.length===0||!await B(i,n,t))return!1;s(null);try{let r=await a.mutateAsync({kind:e,ids:n.map(e=>e.id),confirmCount:n.length}),i=r.skipped.map(e=>L(e.reason));return s({tone:`success`,message:i.length>0?A.t(`access.bulk.revokedSkipped`,{what:z(r.revoked.length,t),count:i.length,reasons:[...new Set(i)].join(`, `)}):A.t(`access.bulk.revoked`,{what:z(r.revoked.length,t)})}),!0}catch(e){return s({tone:`danger`,message:A.t(`access.bulk.revokeFailed`,{error:e instanceof Error?e.message:A.t(`access.bulk.requestFailed`)})}),!1}finally{r()}},busy:a.isPending,outcome:o,dismiss:()=>s(null)}}function Te(e,t){let r=k(),i=x.auth.revokeCredentials.useMutation(),[a,o]=n(null);return{run:async n=>{if(n.length===0||!await B(r,n,e))return!1;o(null);let a=n.filter(e=>e.kind===`Scoped`).map(e=>e.id),s=n.filter(e=>e.kind===`Admin`).map(e=>e.id);try{let t=[],n=[];if(a.length>0){let e=await i.mutateAsync({kind:`scoped-token`,ids:a,confirmCount:a.length});t.push(...e.revoked),n.push(...e.skipped)}if(s.length>0){let e=await i.mutateAsync({kind:`admin-token`,ids:s,confirmCount:s.length});t.push(...e.revoked),n.push(...e.skipped)}let r=n.map(e=>L(e.reason));return o({tone:`success`,message:r.length>0?A.t(`access.bulk.revokedSkipped`,{what:z(t.length,e),count:r.length,reasons:[...new Set(r)].join(`, `)}):A.t(`access.bulk.revoked`,{what:z(t.length,e)})}),!0}catch(e){return o({tone:`danger`,message:A.t(`access.bulk.revokeFailed`,{error:e instanceof Error?e.message:A.t(`access.bulk.requestFailed`)})}),!1}finally{t()}},busy:i.isPending,outcome:a,dismiss:()=>o(null)}}function Ee(e,t,r){let i=k(),[a,o]=n(!1),[s,c]=n(null);return{run:async n=>{if(n.length===0||!await B(i,n,e))return!1;c(null),o(!0);let a=[],s=0;for(let e of n)try{await t(e.id),s+=1}catch(t){a.push(`${e.name}: ${t instanceof Error?t.message:A.t(`access.bulk.requestFailed`)}`)}return o(!1),r(),a.length===0?(c({tone:`success`,message:A.t(`access.bulk.revoked`,{what:z(s,e)})}),!0):(c({tone:`danger`,message:A.t(a.length>3?`access.bulk.eachPartialMore`:`access.bulk.eachPartial`,{what:z(s,e),count:a.length,details:a.slice(0,3).join(`; `)})}),s>0)},busy:a,outcome:s,dismiss:()=>c(null)}}e();var De={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}]},H={status:`access.credentialTable.groupStatus`,owner:`access.credentialTable.groupOwner`,kind:`access.credentialTable.groupKind`},Oe=e=>e.status!==`current`,ke=[`active`,`current`];function U({rows:e,label:r,isLoading:a,loadError:s,emptyText:c,hideOwner:u=!1,expiresNone:d,action:f,extraActions:p,bulk:m,defaultStatus:h=ke}){let{t:g}=j(),[_]=n(()=>h.length===0?{search:``,facets:[]}:{search:``,facets:[],groups:{status:[...h]}}),v=S(e,De,_),[y,x]=n(()=>new Set),w=d??g(`access.credentialColumns.never`),te=t(()=>xe({hideOwner:u,expiresNone:w,action:f??null,...p===void 0?{}:{extraActions:p}}),[u,w,f,p,g]),T=t(()=>m===void 0?()=>!1:e=>Oe(e)&&m.isSelectable(e),[m]),E=t(()=>v.rows.filter(e=>y.has(e.id)&&T(e)),[v.rows,y,T]);return a?i(`div`,{className:`flex items-center gap-2 py-4 text-xs text-foreground-subtle`,children:[o(l,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":!0}),g(`access.credentialTable.loading`,{label:r})]}):s===null?i(`div`,{className:`space-y-3`,children:[o(ee,{state:v.state,facets:v.facets,groups:v.groups.filter(e=>!(u&&e.id===`owner`)).map(e=>({...e,label:H[e.id]===void 0?e.id:g(H[e.id]),...e.id===`status`?{facetLabel:e=>P(e)}:{}})),labels:{searchPlaceholder:g(`access.credentialTable.searchPlaceholder`,{label:r}),searchLabel:g(`access.credentialTable.searchLabel`,{label:r}),facetsLabel:g(`access.credentialTable.facetsLabel`,{label:r}),clearLabel:g(`access.credentialTable.clearFilters`)},onSearch:v.setSearch,onToggleFacet:v.toggleFacet,onToggleGroupFacet:v.toggleGroupFacet,onClear:v.clear}),m!==void 0&&o(Ae,{bulk:m,shown:v.rows.filter(T),targets:E,onSelect:x}),o(C,{columns:te,rows:v.rows,rowKey:e=>e.id,minWidthPx:u?760:860,maxBodyHeight:se,defaultSort:{columnKey:`created`,dir:`desc`},pageSize:25,paginationLabels:{navLabel:g(`access.credentialTable.pagesLabel`,{label:r}),previous:g(`access.credentialTable.previousPage`),next:g(`access.credentialTable.nextPage`),range:(e,t,n)=>g(`access.credentialTable.range`,{from:e,to:t,total:n})},emptyMessage:v.active?g(`access.credentialTable.noMatchTheFilters`,`No {{label}} match the filters.`,{label:r}):c,rowClassName:e=>e.status===`revoked`||e.status===`expired`?`opacity-70`:void 0,...m===void 0?{}:{selection:{selected:y,onChange:x,isSelectable:T,rowLabel:e=>g(`access.credentialTable.rowLabel`,{name:e.name,owner:e.ownerName}),pageLabel:g(`access.credentialTable.pageLabel`,{noun:R(1,m.noun)})}}})]}):o(b,{title:g(`access.credentialTable.couldNotLoad`,`Could not load {{label}}`,{label:r}),message:s})}function Ae({bulk:e,shown:t,targets:n,onSelect:r}){let{t:a}=j(),{revoke:s,noun:u}=e,d=(e.quickSelect??[]).map(e=>({...e,rows:t.filter(e.match)})).filter(e=>e.rows.length>0),p=async()=>{await s.run(n)&&r(new Set)};return i(`div`,{className:`flex flex-wrap items-center gap-2`,"data-testid":`bulk-bar`,children:[t.length>0&&o(D,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>r(new Set(t.map(e=>e.id))),children:a(`access.credentialTable.selectAllShown`,{count:t.length})}),d.map(e=>i(D,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>r(new Set(e.rows.map(e=>e.id))),children:[e.label,` (`,String(e.rows.length),`)`]},e.label)),n.length>0&&i(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[o(`span`,{className:`text-[11px] tabular-nums text-foreground`,"aria-live":`polite`,children:a(`access.credentialTable.selectedLabel`,{what:z(n.length,u)})}),i(D,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>r(new Set),children:[o(f,{className:`h-3 w-3`,"aria-hidden":!0}),a(`access.credentialTable.clearSelection`,`Clear selection`)]}),i(D,{type:`button`,variant:`danger`,size:`sm`,disabled:s.busy,onClick:()=>void p(),children:[s.busy?o(l,{className:`h-3 w-3 animate-spin`,"aria-hidden":!0}):o(c,{className:`h-3 w-3`,"aria-hidden":!0}),a(`access.credentialTable.revoke`,{what:z(n.length,u)})]})]})]})}var W=(e,t)=>t===null?`—`:e.get(t)??t;function G(e,t){return e!=null&&e<=t?`expired`:`active`}function je(e,t,n){return{id:e.id,name:n.client(e.client),detail:e.ip,ownerId:e.userId,ownerName:W(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 Me(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}}var Ne=`Scoped`,K=`Admin`;function Pe(e,t,n,r,i){return{id:e.id,name:e.name,detail:`${e.tokenPrefix}…`,ownerId:t,ownerName:W(n,t),kind:Ne,scope:r,status:G(e.expiresAt,i),createdAt:e.createdAt,lastUsedAt:e.lastUsedAt??null,expiresAt:e.expiresAt??null}}function Fe(e,t,n){return{id:e.id,name:e.name,detail:`${e.tokenPrefix}…`,ownerId:e.createdBy,ownerName:W(t,e.createdBy),kind:K,scope:`Full administrator`,status:e.revokedAt===null?G(e.expiresAt,n):`revoked`,createdAt:e.createdAt,lastUsedAt:e.lastUsedAt,expiresAt:e.expiresAt}}var Ie={"grid-view":`Grid`,"events-view":`Events`};function Le(e,t){return e.map(e=>t.get(e)??`#${String(e)}`).join(`, `)}function Re(e,t,n,r){let i=Ie[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:W(t,e.userId),kind:e.scope.talk===!0?`${i} + talk`:i,scope:Le(e.scope.deviceIds,n),status:G(e.expiresAt,r),createdAt:e.createdAt,lastUsedAt:e.lastUsedAt??null,expiresAt:e.expiresAt}}function q(e){return`${e.provider}\u0000${e.subject}`}function ze(e,t){return{id:q(e),name:e.label??e.subject,detail:e.issuer,ownerId:e.userId,ownerName:W(t,e.userId),kind:e.provider,scope:null,status:`active`,createdAt:e.linkedAt,lastUsedAt:null,expiresAt:null}}function Be(e,t){let n=e.allowedProviders;return{id:e.id,name:e.label,detail:`${e.tokenPrefix}…`,ownerId:e.userId??null,ownerName:W(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 J=40,Ve=[{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`}],He=[{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`}],Ue=[{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 Y(e,t){return e.find(e=>e.test.test(t))?.name??null}function We(e){return e.length<=J?e:`${e.slice(0,J)}…`}function X(e){if(e===null||e.trim().length===0)return{label:A.t(`helpers.sessionClient.unknownDevice`),raw:null};let t=e.trim(),n=Y(Ue,t);if(n!==null)return{label:n,raw:t};let r=Y(Ve,t),i=Y(He,t);return r!==null&&i!==null?{label:A.t(`helpers.sessionClient.browserOnSystem`,{browser:r,system:i}),raw:t}:r===null?{label:We(t),raw:t}:{label:r,raw:t}}var Ge={password:`helpers.sessionClient.method.password`,passkey:`helpers.sessionClient.method.passkey`,sso:`helpers.sessionClient.method.sso`,handoff:`helpers.sessionClient.method.handoff`,exchange:`helpers.sessionClient.method.exchange`};function Z(e){let t=Ge[e];return t===void 0?e:A.t(t)}function Q(e){if(e==null)return`—`;let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleString()}e();function Ke(e,t){return e instanceof Error&&e.message.length>0?e.message:t}function qe(e){let{t}=j(),s=p(),[c,u]=n(!1),[d,f]=n(``),[m,h]=n(null),[_,y]=n(null),b=a(null),x=r(e=>{b.current?.(e),b.current=null,u(!1),f(``),h(null),y(null)},[]),S=r(()=>new Promise(e=>{b.current?.(null),b.current=e,y(null),u(!0)}),[]),C=async()=>{h(`password`),y(null);try{let{reauthToken:e}=await s.reauthenticate({password:d});x(e)}catch(e){y(Ke(e,`Password is incorrect`)),h(null)}},ee=async()=>{h(`passkey`),y(null);try{let{optionsJSON:e}=await s.reauthBeginPasskey();if(!de(e))throw Error(`passkey authentication options missing challenge`);let t=await fe({optionsJSON:e}),{reauthToken:n}=await s.reauthenticate({passkeyResponse:Object.fromEntries(Object.entries(t))});x(n)}catch(e){y(Ke(e,`Passkey verification failed`)),h(null)}};return{requestProof:S,dialog:o(T,{open:c,onOpenChange:e=>!e&&x(null),children:i(v,{children:[i(te,{children:[o(E,{children:t(`auth.reauthDialog.confirmItSYou`,`Confirm it’s you`)}),o(oe,{children:t(`auth.reauthDialog.needsPassword`,{action:e})})]}),i(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),d.length>0&&m===null&&C()},children:[o(ce,{type:`password`,autoComplete:`current-password`,placeholder:t(`auth.reauthDialog.currentPassword`,`Current password`),value:d,onChange:e=>f(e.target.value),"aria-label":t(`auth.reauthDialog.currentPassword`,`Current password`)}),_!==null&&o(`p`,{role:`alert`,className:`text-xs text-danger`,children:_}),i(w,{className:`flex flex-wrap gap-2`,children:[i(D,{type:`button`,variant:`outline`,disabled:m!==null,onClick:()=>void ee(),children:[m===`passkey`?o(l,{className:`h-4 w-4 animate-spin`}):o(g,{className:`h-4 w-4`}),t(`auth.reauthDialog.useAPasskey`,`Use a passkey`)]}),i(D,{type:`submit`,disabled:d.length===0||m!==null,children:[m===`password`&&o(l,{className:`h-4 w-4 animate-spin`}),t(`common.confirm`,`Confirm`)]})]})]})]})})}}e();var Je={key:`access.nouns.shareLink`};function $(e){let{t:r}=j(),i=ie(),a=x.useUtils(),o=x.auth.listShareTokens.useQuery({owner:e}),s=he(),{data:l}=le({isCamera:!0,projection:`slim`}),[u,d]=n(null),f=()=>void a.auth.listShareTokens.invalidate(),p=x.auth.revokeShareToken.useMutation({onSuccess:f,onError:e=>d(`Revoke failed: ${e.message}`)}),m=t(()=>{let e=new Map;for(let t of l??[])e.set(t.id,t.name);return e},[l]),h=Date.now(),g=(o.data??[]).map(e=>Re(e,s,m,h)),_=async e=>{await i({title:r(`users.shareLinksSection.revokeShareLink`,`Revoke share link`),message:r(`users.shareLinksSection.anyoneHoldingThisLinkTo`,`Anyone holding this link to {{value1}} loses access immediately. This cannot be undone.`,{value1:e.scope??e.name}),confirmLabel:r(`users.shareLinksSection.revoke`,`Revoke`),variant:`danger`})&&(d(null),p.mutate({id:e.id}))};return{rows:g,refresh:f,error:u,clearError:()=>d(null),isLoading:o.isLoading,loadError:o.isError?o.error?.message??`Request failed`:null,action:{label:r(`users.shareLinksSection.revoke`,`Revoke`),icon:c,isAvailable:()=>!0,onRun:e=>void _(e),busyId:p.isPending?p.variables?.id??null:null,disabled:p.isPending}}}function Ye(){let{t:e}=j(),t=$(`self`);return o(M,{notice:N(t.error),onDismissNotice:t.clearError,id:`my-share-links`,title:e(`users.shareLinksSection.shareLinks`,`Share links`),icon:u,description:e(`users.shareLinksSection.viewOnlyLinksYouCreated`,`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(U,{rows:t.rows,label:e(`users.shareLinksSection.shareLinks2`,`share links`),isLoading:t.isLoading,loadError:t.loadError,emptyText:`You have no share links.`,hideOwner:!0,action:t.action})})}function Xe(){let{user:e}=ue();return e?.isAdmin?o(Ze,{}):null}function Ze(){let{t:e}=j(),t=$(`all`),n=V(`share-link`,Je,t.refresh);return o(M,{notice:N(t.error,n.outcome),onDismissNotice:()=>{t.clearError(),n.dismiss()},id:`share-links`,title:e(`users.shareLinksSection.shareLinks`,`Share links`),icon:u,description:e(`users.shareLinksSection.everyUserSViewOnly`,`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(U,{rows:t.rows,label:e(`users.shareLinksSection.shareLinks2`,`share links`),isLoading:t.isLoading,loadError:t.loadError,emptyText:`No user has any share links.`,action:{...t.action,disabled:t.action.disabled||n.busy},bulk:{revoke:n,noun:Je,isSelectable:()=>!0,quickSelect:[{label:e(`users.shareLinksSection.selectExpired`,`Select expired`),match:e=>e.status===`expired`}]}})})}var Qe=864e5,$e={qr:`QR (by an admin)`,self:`Self-enrolled`},et={ios:`iOS`,android:`Android`,web:`Web`,other:`Other`};function tt(e){return e.status===`revoked`}function nt(e){return e.status!==`revoked`}function rt(e,t=`—`){if(e===null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:n.toLocaleString()}function it(e,t){return e===null||Number.isNaN(e)?null:Math.floor((e-t)/Qe)}function at(e,t){let n=it(e,t);return n===null?`unknown`:n<0?`expired`:n<30?`soon`:`ok`}function ot(e,t){let n=it(e,t);return n===null?A.t(`helpers.certificateModel.unknown`):n===0?A.t(`helpers.certificateModel.today`):n>0?A.t(`helpers.certificateModel.inDays`,{count:n}):A.t(`helpers.certificateModel.daysAgo`,{count:-n})}function st(e){if(e===null)return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function ct(e){return e===null||e.length===0?`—`:e.length<=17?e:`${e.slice(0,8)}…${e.slice(-8)}`}function lt(e){return e.length<=10?e:`${e.slice(0,10)}…`}function ut(e){if(!e.online)return{allowed:!1,reason:A.t(`helpers.certificateModel.nodeOffline`)};if(e.isHub&&e.https.kind===`served`){if(e.https.status.mode===`uploaded`)return{allowed:!1,reason:A.t(`helpers.certificateModel.uploadedCert`)};if(e.https.status.mode===`disabled`)return{allowed:!1,reason:A.t(`helpers.certificateModel.tlsDisabled`)}}return{allowed:!0,reason:null}}var dt={prepare:`helpers.certificateModel.stage.prepare`,issue:`helpers.certificateModel.stage.issue`,install:`helpers.certificateModel.stage.install`,reconnect:`helpers.certificateModel.stage.reconnect`,confirm:`helpers.certificateModel.stage.confirm`};function ft(e){if(e.ok)return{tone:`success`,message:A.t(`helpers.certificateModel.renewed`,{nodeId:e.nodeId,serial:lt(e.newSerial)})};let t=e.keptPreviousLeaf?A.t(`helpers.certificateModel.keptPrevious`):A.t(`helpers.certificateModel.maybeNoCert`);return{tone:`danger`,message:A.t(`helpers.certificateModel.renewalFailed`,{nodeId:e.nodeId,stage:A.t(dt[e.stage]),reason:e.reason,kept:t})}}function pt(e,t){let n=Math.max(0,e-t),r=Math.ceil(n/1e3),i=Math.floor(r/60),a=r%60;return{expired:n===0,label:`${String(i)}:${String(a).padStart(2,`0`)}`}}var mt=11;function ht(e,t){let n=e.slice(0,mt);return t===null?n:`${n} · ${t}`}function gt(e){return{id:e.id,name:e.deviceName,detail:ht(e.fingerprint,e.lastUsedFrom),ownerId:e.userId,ownerName:e.username??e.userId,kind:et[e.platform],scope:$e[e.enrolledVia],status:e.status,createdAt:e.issuedAt,lastUsedAt:e.lastUsedAt,expiresAt:e.expiresAt}}function _t(e,t){return{id:e.id,name:e.deviceName,detail:null,ownerId:null,ownerName:t,kind:et[e.platform],scope:null,status:e.status,createdAt:e.issuedAt,lastUsedAt:e.lastUsedAt,expiresAt:e.expiresAt}}function vt({sessions:e,isLoading:t,loadError:n,emptyText:r,onRevoke:a,revokingId:s}){let{t:c}=j();return t?i(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[o(l,{className:`h-3.5 w-3.5 animate-spin`}),c(`auth.sessionsList.loadingSessions`,`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:r}):o(`ul`,{className:`divide-y divide-border rounded-md border border-border`,children:e.map(e=>o(yt,{session:e,revoking:s===e.id,onRevoke:()=>a(e)},e.id))}):i(`div`,{className:`text-[11px] text-danger`,children:[c(`auth.sessionsList.couldNotLoadSessions`,`Could not load sessions:`),` `,n]})}function yt({session:e,revoking:t,onRevoke:n}){let{t:r}=j(),a=X(e.client);return i(`li`,{"data-testid":`session-row`,className:`flex items-start gap-3 px-3 py-2 text-xs`,children:[o(m,{className:`h-3.5 w-3.5 mt-0.5 shrink-0 text-foreground-subtle`}),i(`div`,{className:`flex-1 min-w-0 space-y-0.5`,children:[i(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[o(`span`,{className:`font-medium text-foreground truncate`,title:a.raw??void 0,children:a.label}),e.current&&o(`span`,{className:`rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary`,children:r(`auth.sessionsList.thisDevice`,`This device`)})]}),i(`div`,{className:`flex flex-wrap gap-x-3 text-[11px] text-foreground-subtle`,children:[o(`span`,{children:Z(e.method)}),o(`span`,{className:`font-mono`,children:e.ip??r(`auth.sessionsList.ipUnknown`,`IP unknown`)}),o(`span`,{children:r(`auth.sessionsList.lastActive`,{when:Q(e.lastUsedAt)})}),o(`span`,{children:r(`auth.sessionsList.expires`,{when:Q(e.expiresAt)})})]})]}),!e.current&&i(`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(l,{className:`h-3 w-3 animate-spin`}):o(h,{className:`h-3 w-3`}),r(`auth.sessionsList.signOut`,`Sign out`)]})]})}export{V as A,Be as C,je as D,Me as E,he as F,Te as M,M as N,Pe as O,N as P,Fe as S,ze as T,qe as _,nt as a,Q as b,ot as c,rt as d,ut as f,Ye as g,Xe as h,tt as i,Ee as j,U as k,ft as l,lt as m,gt as n,pt as o,ct as p,_t as r,st as s,vt as t,at as u,X as v,q as w,K as x,Z as y};
@@ -1 +0,0 @@
1
- import{$ as e,B as t,G as n,J as r,L as i,S as a,a as o,b as s,o as c,t as l,x as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEHpkaJP.js";import{$t as d,D as f,Ir as p,It as m,Nt as h,_i as g,ar as _,er as v,fi as y,ln as b,nr as x,on as S,ot as C,pi as w,pr as T,un as ee,vi as te,wn as ne,yi as re,yn as ie}from"./player-overlays-CVyuEj4x.js";import{ur as ae}from"./client-CPwvt_HG.js";import{t as E}from"./key-round-C__KHy-x.js";import{t as oe}from"./octagon-alert-CkSZIflH.js";import{$n as D,An as se,Bn as ce,Co as le,Do as ue,Eo as de,Kt as O,Ln as fe,Mn as pe,Nn as me,On as he,Oo as ge,Pn as _e,Rt as k,So as ve,To as ye,Un as A,Wt as j,Xl as M,an as N,bo as P,cr as F,du as I,er as be,fl as xe,hl as Se,in as L,jn as Ce,kn as we,ko as Te,ll as Ee,on as R,qt as De,rn as Oe,ru as z,tr as ke,vu as Ae,wo as je,xo as Me,yo as Ne}from"./src-D7EY8vSW.js";import{t as B}from"./i18n-GaxP0h6E.js";import{t as V}from"./useTranslation-D3Is_4B6.js";import{O as Pe,X as Fe,tt as Ie,w as Le}from"./index-tgPOSbne.js";import{t as Re}from"./AdminSectionedPage-CMXlVHaE.js";import{t as H}from"./AdminPage-Dq8Ikceb.js";import{t as ze}from"./NodeAddonsSettingsPanel-DPOu3bzA.js";import{t as Be}from"./AddonAssetIcon-BPpbpBRb.js";e();var Ve={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`},He={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 Ue({entry:e,actions:t}){let n=e.name.toLowerCase(),r=Ve[n]??`border-primary`,i=He[n]??`bg-primary/5`,o=e.providers.find(e=>e.active),s=t?.pendingCapability===e.name;return a(`div`,{className:`rounded-lg border-t-2 border border-border ${r} ${i} p-3 space-y-2`,children:[a(`div`,{className:`flex items-center justify-between gap-2`,children:[a(`span`,{className:`text-xs font-semibold text-foreground capitalize flex items-center gap-1.5`,children:[e.name,s&&u(_,{className:`h-3 w-3 animate-spin text-primary`})]}),u(`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`?u(We,{entry:e,actions:t,activeProvider:o,isPending:s}):u(Ge,{entry:e,actions:t,isPending:s})]})}function We({entry:e,actions:t,activeProvider:n,isPending:r}){let{t:i}=V();if(!t)return u(`div`,{children:n?a(`div`,{className:`flex items-center gap-1.5 text-[10px] text-foreground`,children:[u(y,{className:`h-3 w-3 text-green-400 shrink-0`}),u(`span`,{className:`font-medium`,children:n.addonName}),u(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto`,children:`ACTIVE`})]}):u(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:i(`addons.capabilityMap.noActiveProvider`,`No active provider`)})});if(e.providers.length===0)return u(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:i(`addons.capabilityMap.noProviders`,`No providers`)});let o=`__inherit__`;return a(`div`,{className:`space-y-2`,children:[u(`div`,{className:`space-y-1`,children:e.providers.map(n=>{let i=n.active;return a(`button`,{type:`button`,disabled:r||i,onClick:()=>t.onSelectSingleton(e.name,n.addonId),className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-[10px] text-left transition-colors ${i?`bg-green-500/10 text-foreground cursor-default`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`}`,children:[u(`span`,{className:`h-2.5 w-2.5 rounded-full border shrink-0 ${i?`border-green-400 bg-green-400`:`border-border`}`}),u(`span`,{className:`font-medium truncate`,children:n.addonName}),i&&u(`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`})]},n.addonId)})}),e.perNode&&e.perNode.length>0&&u(`div`,{className:`space-y-2 pt-1 border-t border-border/40`,children:e.perNode.map(n=>{let s=n.hasOverride&&n.resolvedActive?n.resolvedActive:o,c=[{value:o,label:n.resolvedActive?i(`addons.capabilityMap.inheritGlobalWith`,{provider:n.resolvedActive}):i(`addons.capabilityMap.inheritGlobal`)},...n.providers.map(e=>({value:e,label:e}))],l=r=>{r===o?t.onClearNodeSingleton(e.name,n.nodeId):t.onSelectNodeSingleton(e.name,n.nodeId,r)},d=r;return a(`div`,{className:`space-y-0.5`,children:[a(`div`,{className:`text-[9px] font-semibold uppercase tracking-widest text-foreground-subtle/60 px-1.5`,children:[n.nodeId,n.hasOverride&&u(`span`,{className:`ml-1.5 rounded-full bg-primary/10 text-primary px-1 py-0.5 normal-case tracking-normal font-medium`,children:i(`common.override`)})]}),c.map(e=>{let t=s===e.value;return a(`button`,{type:`button`,disabled:d||t,onClick:()=>l(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:[u(`span`,{className:`h-2.5 w-2.5 rounded-full border shrink-0 ${t?`border-green-400 bg-green-400`:`border-border`}`}),u(`span`,{className:`font-medium truncate`,children:e.label}),t&&e.value!==o&&u(`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)})]},n.nodeId)})})]})}function Ge({entry:e,actions:t,isPending:n}){let{t:r}=V();if(e.providers.length===0)return u(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:r(`addons.capabilityMap.noProviders`,`No providers`)});if(!t)return u(`div`,{className:`space-y-1`,children:e.providers.map(e=>a(`div`,{className:`flex items-center justify-between gap-2 text-[10px]`,children:[u(`span`,{className:`text-foreground-subtle`,children:e.addonName}),e.active&&u(`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),o=(n,r)=>{let a=r?[...new Set([...i,n])]:i.filter(e=>e!==n);t.onToggleCollection(e.name,a)};return u(`div`,{className:`space-y-1`,children:e.providers.map(e=>a(`label`,{className:`flex items-center justify-between gap-2 text-[10px] rounded px-1.5 py-1 transition-colors ${n?`opacity-50`:`hover:bg-surface-hover cursor-pointer`}`,children:[a(`span`,{className:`flex items-center gap-1.5 min-w-0`,children:[u(`input`,{type:`checkbox`,checked:e.active,disabled:n,onChange:t=>o(e.addonId,t.target.checked),className:`h-3 w-3 accent-green-500 shrink-0`}),u(`span`,{className:`text-foreground truncate`,children:e.addonName})]}),e.active&&u(`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 U({capabilities:e,actions:t}){let{t:n}=V();return e.length===0?u(`div`,{className:`text-xs text-foreground-subtle text-center py-8`,children:n(`addons.capabilityMap.noCapabilitiesRegistered`,`No capabilities registered`)}):u(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3`,children:e.map(e=>u(Ue,{entry:e,actions:t},e.name))})}var Ke=[`capabilities`,`listCapabilities`];function qe(e){return e===`singleton`||e===`collection`}function W(e){let t=e.indexOf(`@`);return t===-1?B.t(`system.capabilities.providerHub`,{addonId:e}):`${e.slice(0,t)} (${e.slice(t+1)})`}function Je(e,t){return{name:e.name,mode:t,providers:e.providers.map(n=>({addonId:n,addonName:W(n),active:t===`singleton`?e.activeProvider===n:!e.disabledProviders.includes(n)})),...t===`singleton`&&e.perNode?{perNode:e.perNode}:{}}}function Ye(){let{t:e}=V(),t=C(),[i,s]=r(null),[c,f]=r(null),p=o({queryKey:Ke,queryFn:()=>t.trpcClient.capabilities.listCapabilities.query()}),m=n(()=>{let e=(p.data??[]).flatMap(e=>qe(e.mode)?[Je(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]},[p.data]),h=n(()=>m.filter(e=>e.mode===`singleton`),[m]),g=n(()=>m.filter(e=>e.mode===`collection`),[m]),_=l({mutationFn:e=>t.trpcClient.capabilities.setActiveSingleton.mutate({capability:e.capName,addonId:e.addonId}),onMutate:e=>{s(e.capName),f(null)},onSuccess:async(t,n)=>{f({kind:`success`,message:e(`system.capabilities.isNowActive`,`{{capName}} → {{addonId}} is now active.`,{capName:n.capName,addonId:n.addonId})}),await p.refetch()},onError:(t,n)=>{f({kind:`error`,message:e(`system.capabilities.failedToSet`,{cap:n.capName,error:t instanceof Error?t.message:e(`common.unknownError`)})})},onSettled:()=>s(null)}),v=l({mutationFn:e=>t.trpcClient.capabilities.setActiveSingleton.mutate({capability:e.capName,addonId:e.addonId,nodeId:e.nodeId}),onMutate:e=>{s(e.capName),f(null)},onSuccess:async(e,t)=>{f({kind:`success`,message:`${t.capName} @ ${t.nodeId} → ${t.addonId}.`}),await p.refetch()},onError:(t,n)=>{f({kind:`error`,message:e(`system.capabilities.failedToSetOnNode`,{cap:n.capName,node:n.nodeId,error:t instanceof Error?t.message:e(`common.unknownError`)})})},onSettled:()=>s(null)}),b=l({mutationFn:e=>t.trpcClient.capabilities.clearSingletonNodeOverride.mutate({capability:e.capName,nodeId:e.nodeId}),onMutate:e=>{s(e.capName),f(null)},onSuccess:async(t,n)=>{f({kind:`success`,message:e(`system.capabilities.nowInheritsTheGlobalDefault`,`{{capName}} @ {{nodeId}} now inherits the global default.`,{capName:n.capName,nodeId:n.nodeId})}),await p.refetch()},onError:(t,n)=>{f({kind:`error`,message:e(`system.capabilities.failedToClearOnNode`,{cap:n.capName,node:n.nodeId,error:t instanceof Error?t.message:e(`common.unknownError`)})})},onSettled:()=>s(null)}),x=l({mutationFn:e=>t.trpcClient.capabilities.setCollectionEnabledProviders.mutate({capability:e.capName,enabledAddonIds:[...e.enabledAddonIds]}),onMutate:e=>{s(e.capName),f(null)},onSuccess:async(t,n)=>{f({kind:`success`,message:e(`system.capabilities.providerSEnabled`,`{{capName}}: {{length}} provider(s) enabled.`,{capName:n.capName,length:n.enabledAddonIds.length})}),await p.refetch()},onError:(t,n)=>{f({kind:`error`,message:e(`system.capabilities.failedToUpdate`,{cap:n.capName,error:t instanceof Error?t.message:e(`common.unknownError`)})})},onSettled:()=>s(null)}),S={onSelectSingleton:(e,t)=>_.mutate({capName:e,addonId:t}),onSelectNodeSingleton:(e,t,n)=>v.mutate({capName:e,nodeId:t,addonId:n}),onClearNodeSingleton:(e,t)=>b.mutate({capName:e,nodeId:t}),onToggleCollection:(e,t)=>x.mutate({capName:e,enabledAddonIds:t}),pendingCapability:i};return a(H,{embedded:!0,icon:d,title:e(`system.capabilities.capabilities`,`Capabilities`),subtitle:e(`system.capabilities.chooseWhichProviderIsActive`,`Choose which provider is active for each system capability. Singleton caps pick exactly one provider; collection caps enable a set.`),children:[c&&a(`div`,{className:`flex items-center gap-2 rounded-md border px-3 py-2 text-xs ${c.kind===`success`?`border-success/30 bg-success/10 text-success`:`border-danger/40 bg-danger/10 text-danger`}`,children:[c.kind===`success`?u(y,{className:`h-3.5 w-3.5 shrink-0`}):u(w,{className:`h-3.5 w-3.5 shrink-0`}),u(`span`,{children:c.message})]}),p.isLoading&&u(`div`,{className:`flex items-center justify-center py-16`,children:u(`div`,{className:`animate-spin h-6 w-6 border-2 border-primary border-t-transparent rounded-full`})}),p.isError&&!p.isLoading&&u(ce,{title:e(`system.capabilities.failedToLoadCapabilities`,`Failed to load capabilities`),message:p.error instanceof Error?p.error.message:e(`system.capabilities.unknownError`,`Unknown error`),onRetry:()=>void p.refetch()}),!p.isLoading&&!p.isError&&m.length===0&&u(`div`,{className:`text-xs text-foreground-subtle text-center py-16`,children:e(`system.capabilities.noCapabilitiesRegistered`,`No capabilities registered.`)}),!p.isLoading&&!p.isError&&m.length>0&&a(`div`,{className:`space-y-6`,children:[h.length>0&&a(`section`,{className:`space-y-2`,children:[u(`h2`,{className:`text-[11px] font-semibold uppercase tracking-widest text-foreground-subtle/70`,children:e(`system.capabilities.singletonPickOneProvider`,`Singleton — pick one provider`)}),u(U,{capabilities:h,actions:S})]}),g.length>0&&a(`section`,{className:`space-y-2`,children:[u(`h2`,{className:`text-[11px] font-semibold uppercase tracking-widest text-foreground-subtle/70`,children:e(`system.capabilities.collectionEnableASet`,`Collection — enable a set`)}),u(U,{capabilities:g,actions:S})]})]})]})}var G=[`locked`,`reset`,`shares-backup`,`recovery-key`,`rotation-pending`,`orphans`],Xe={"key-missing":`helpers.keychainNotices.lockedKeyMissing`,"wrong-key":`helpers.keychainNotices.lockedWrongKey`,"key-file-unreadable":`helpers.keychainNotices.lockedKeyFileUnreadable`,"store-unavailable":`helpers.keychainNotices.lockedStoreUnavailable`,"not-initialized":`helpers.keychainNotices.lockedNotInitialized`,"decrypt-failed":`helpers.keychainNotices.lockedDecryptFailed`};function Ze(e){let t=Xe[e];return t===void 0?e:B.t(t)}function Qe({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:B.t(`helpers.keychainNotices.locked`,{reason:Ze(e.keychain.reason)})}),t!==null&&t.acknowledgedAt===null&&o.push({id:`reset`,tone:`danger`,title:n>0?B.t(`helpers.keychainNotices.resetPending`,{count:n}):B.t(`helpers.keychainNotices.resetDone`)}),a.sharesBackupWithDatabase&&o.push({id:`shares-backup`,tone:`warning`,title:B.t(`helpers.keychainNotices.sharesBackup`)}),!i&&e.recoveryKeyDownloadedAt===null&&o.push({id:`recovery-key`,tone:`warning`,title:B.t(`helpers.keychainNotices.recoveryKey`)}),!i&&e.rotationPending&&o.push({id:`rotation-pending`,tone:`info`,title:B.t(`helpers.keychainNotices.rotationPending`)}),!i&&r>0&&o.push({id:`orphans`,tone:`info`,title:B.t(`helpers.keychainNotices.orphans`,{count:r})}),[...o].sort((e,t)=>G.indexOf(e.id)-G.indexOf(t.id))}var $e={dateStyle:`short`,timeStyle:`short`};function K(e){return e===null?`—`:new Date(e).toLocaleString(void 0,$e)}function q({value:e,copyValue:t,srLabel:n,maxWidthClass:r,className:i}){let o=t??e;return a(`span`,{className:I(`flex min-w-0 items-center gap-0.5`,r),children:[u(`span`,{className:I(`min-w-0 truncate font-mono`,i),title:o,children:e}),u(k,{value:o,srLabel:n,className:`h-6 shrink-0 px-1.5`})]})}e();var et=new Set([`reveal`,`download-recovery-key`,`rotate-master-key`,`reset`]);function tt(e){return[{key:`at`,header:e(`system.keychainAuditTable.colWhen`),render:e=>K(e.at)},{key:`action`,header:e(`system.keychainAuditTable.colAction`),render:e=>u(F,{variant:et.has(e.action)?`warning`:`default`,children:e.action})},{key:`actor`,header:e(`system.keychainAuditTable.colActor`),render:e=>u(`span`,{className:`font-mono`,children:e.actor})},{key:`ref`,header:e(`system.keychainAuditTable.colRef`),render:e=>e.ref===null?u(`span`,{className:`text-foreground-subtle`,children:`—`}):u(q,{value:e.ref,srLabel:`secret ref`,maxWidthClass:`max-w-[22rem]`})},{key:`detail`,header:e(`system.keychainAuditTable.colDetail`),render:e=>u(`span`,{className:`text-foreground-muted`,children:e.detail??``})}]}function nt({entries:e}){let{t}=V(),[i,o]=r(0),s=n(()=>tt(t),[t]);if(e===void 0)return u(`p`,{className:`text-xs text-foreground-subtle`,children:t(`common.loading`,`Loading…`)});let c=Math.max(1,Math.ceil(e.length/25)),l=Math.min(i,c-1),d=l*25,f=e.slice(d,d+25);return a(`div`,{className:`space-y-2`,children:[u(O,{columns:s,rows:f,rowKey:e=>e.id,minWidthPx:760,emptyMessage:t(`secrets.keychainAuditTable.nothingHasBeenAuditedYet`,`Nothing has been audited yet.`)}),e.length>25&&a(`div`,{className:`flex flex-wrap items-center justify-between gap-2 text-[11px] text-foreground-subtle`,children:[u(`span`,{children:t(e.length>=500?`system.keychainAuditTable.rangeRecent`:`system.keychainAuditTable.range`,{from:d+1,to:d+f.length,total:e.length})}),a(`span`,{className:`inline-flex items-center gap-1`,children:[u(A,{size:`sm`,variant:`outline`,"aria-label":t(`secrets.keychainAuditTable.previousPage`,`Previous page`),disabled:l===0,onClick:()=>o(l-1),children:u(te,{className:`h-3.5 w-3.5`,"aria-hidden":!0})}),a(`span`,{className:`tabular-nums`,children:[l+1,` / `,c]}),u(A,{size:`sm`,variant:`outline`,"aria-label":t(`secrets.keychainAuditTable.nextPage`,`Next page`),disabled:l>=c-1,onClick:()=>o(l+1),children:u(g,{className:`h-3.5 w-3.5`,"aria-hidden":!0})})]})]})]})}function rt(e,t){switch(e){case`locked`:return u(A,{size:`sm`,variant:`danger`,disabled:t.busy,onClick:t.onReset,children:B.t(`secrets.keychainNoticeContent.resetKeychain`,`Reset keychain`)});case`reset`:return u(A,{size:`sm`,variant:`outline`,disabled:t.busy,onClick:t.onAcknowledgeReset,children:B.t(`secrets.keychainNoticeContent.dismiss`,`Dismiss`)});case`recovery-key`:return u(A,{size:`sm`,variant:`outline`,disabled:t.busy,onClick:t.onDownload,children:B.t(`secrets.keychainNoticeContent.download`,`Download`)});case`rotation-pending`:return u(A,{size:`sm`,variant:`outline`,disabled:t.busy,onClick:t.onRotate,children:B.t(`secrets.keychainNoticeContent.rotate`,`Rotate`)});case`orphans`:return u(A,{size:`sm`,variant:`outline`,onClick:t.onShowOrphans,children:B.t(`secrets.keychainNoticeContent.review`,`Review`)});case`shares-backup`:return null}}function it(e,t){switch(e){case`locked`:return u(`p`,{children:B.t(`secrets.keychainNoticeContent.noValueCanBeRead`,`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:u(at,{reset:t.reset,pending:t.pendingReentry});case`shares-backup`:return u(`p`,{children:u(Fe,{i18nKey:`secrets.keychainNoticeContent.backupKeyFile`,components:{code:u(`code`,{className:`font-mono`})}})});case`recovery-key`:return u(`p`,{children:B.t(`secrets.keychainNoticeContent.withoutACopyOfThe`,`Without a copy of the master key, the stored values cannot be recovered.`)});case`rotation-pending`:return u(`p`,{children:B.t(`secrets.keychainNoticeContent.theKeychainUnlockedWithA`,`The keychain unlocked with a previous key. Rotate to move onto the configured one.`)});case`orphans`:return null}}function at({reset:e,pending:t}){let{t:n}=V(),r=e.actor===`trigger-file`?n(`secrets.keychainNoticeContent.resetByTrigger`):n(`secrets.keychainNoticeContent.resetByAdmin`,{actor:e.actor});return a(`div`,{className:`space-y-1.5`,children:[u(`p`,{children:n(`secrets.keychainNoticeContent.resetDetail`,{when:K(e.at),by:r,archived:e.archived})}),t.length>0&&u(`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=>a(`li`,{className:`break-all`,children:[e.owner,` · `,e.scope,` · `,e.fieldPath]},e.ref))})]})}e();var ot=2,J={danger:{icon:oe,text:`text-danger`,border:`border-danger/40`},warning:{icon:h,text:`text-warning`,border:`border-warning/40`},info:{icon:T,text:`text-info`,border:`border-border`}};function st({notices:e,renderAction:t,renderDetail:n}){let{t:i}=V(),[o,s]=r(!1),c=e[0];if(c===void 0)return null;let l=e.length>ot,d=l&&!o?e.slice(0,1):e,f=e.length-d.length;return a(`section`,{"aria-label":i(`secrets.keychainNotices.keychainNotices`,`Keychain notices`),className:I(`rounded-lg border bg-surface`,J[c.tone].border),children:[u(`ul`,{className:`divide-y divide-border`,children:d.map(e=>u(ct,{notice:e,action:t(e.id),detail:n(e.id)},e.id))}),l&&u(`div`,{className:`border-t border-border px-3 py-1`,children:a(A,{size:`sm`,variant:`ghost`,"aria-expanded":o,onClick:()=>s(e=>!e),children:[u(re,{className:I(`h-3.5 w-3.5 transition-transform`,o&&`rotate-180`),"aria-hidden":!0}),o?i(`secrets.keychainNotices.showLess`,`Show less`):i(`secrets.keychainNotices.more`,`{{hidden}} more`,{hidden:f})]})})]})}function ct({notice:e,action:t,detail:n}){let{t:i}=V(),[o,s]=r(!1),c=J[e.tone],l=c.icon,d=n!=null,f=`keychain-notice-${e.id}`;return a(`li`,{className:`px-3 py-2`,children:[a(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,children:[a(`p`,{className:`flex min-w-0 flex-1 items-start gap-2 text-xs text-foreground`,children:[u(l,{className:I(`mt-0.5 h-3.5 w-3.5 shrink-0`,c.text),"aria-hidden":!0}),u(`span`,{className:`min-w-0 break-words`,children:e.title})]}),a(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1.5 pl-5 sm:pl-0`,children:[d&&u(A,{size:`sm`,variant:`ghost`,"aria-expanded":o,"aria-controls":f,onClick:()=>s(e=>!e),children:i(`secrets.keychainNotices.details`,`Details`)}),t]})]}),d&&o&&u(`div`,{id:f,className:`mt-2 pl-5 text-xs text-foreground-muted`,children:n})]})}var lt={"config-file":`Key file (config.yaml)`,"previous-config-file":`Previous key file`,platform:`OS keychain`,"default-file":`Default key file (data volume)`},ut=8;function dt({status:e,busy:t,onDownload:n,onRotate:r,onPurge:i}){let{t:o}=V(),s=e.keychain.state===`locked`,c=e.keySource??e.configuredSource;return u(j,{headingId:`keychain-status`,title:o(`secrets.keychainStatusCard.keychain`,`Keychain`),icon:E,actions:a(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[e.retiredWraps>0&&u(A,{size:`sm`,variant:`ghost`,disabled:t||s,onClick:i,children:o(`secrets.keychainStatusCard.purge`,{count:e.retiredWraps})}),u(A,{size:`sm`,variant:`outline`,disabled:t||s,onClick:r,children:o(`secrets.keychainStatusCard.rotateKey`,`Rotate key`)}),u(A,{size:`sm`,variant:`outline`,disabled:t||s,onClick:n,children:o(`secrets.keychainStatusCard.downloadRecoveryKey`,`Download recovery key`)})]}),children:a(`dl`,{className:`${f} grid grid-cols-1 gap-x-6 gap-y-3 sm:grid-cols-2 xl:grid-cols-4`,children:[a(Y,{label:o(`secrets.keychainStatusCard.state`,`State`),children:[s?a(F,{variant:`danger`,className:`gap-1`,children:[u(x,{className:`h-3 w-3`,"aria-hidden":!0}),o(`secrets.keychainStatusCard.locked`,`Locked`)]}):a(F,{variant:`success`,className:`gap-1`,children:[u(S,{className:`h-3 w-3`,"aria-hidden":!0}),o(`secrets.keychainStatusCard.unlocked`,`Unlocked`)]}),u(`span`,{className:`ml-2 text-foreground-subtle`,children:o(`common.stored`,{count:e.secretCount})})]}),a(Y,{label:o(`secrets.keychainStatusCard.keySource`,`Key source`),children:[u(`span`,{className:`block`,children:lt[c.kind]}),c.path!==void 0&&u(q,{value:c.path,srLabel:`key path`})]}),u(Y,{label:o(`secrets.keychainStatusCard.fingerprint`,`Fingerprint`),children:e.fingerprint===null?u(`span`,{className:`text-foreground-subtle`,children:`—`}):a(`span`,{className:`inline-flex items-center gap-0.5`,children:[u(`span`,{className:`font-mono`,title:e.fingerprint,children:e.fingerprint.slice(0,ut)}),u(k,{value:e.fingerprint,srLabel:`fingerprint`})]})}),u(Y,{label:o(`secrets.keychainStatusCard.recoveryKey`,`Recovery key`),children:e.recoveryKeyDownloadedAt===null?u(F,{variant:`warning`,children:o(`secrets.keychainStatusCard.notTaken`,`Not taken`)}):u(`span`,{children:o(`secrets.keychainStatusCard.taken`,{when:K(e.recoveryKeyDownloadedAt)})})})]})})}function Y({label:e,children:t}){return a(`div`,{className:`min-w-0 text-xs`,children:[u(`dt`,{className:`text-foreground-subtle`,children:e}),u(`dd`,{className:`mt-0.5 min-w-0 text-foreground`,children:t})]})}e();var ft=1e3;function pt({revealed:e,onClose:n}){let{t:i}=V(),[o,c]=r(M);t(()=>{if(e===null)return;let t=Date.now();c(M);let r=setTimeout(n,M),i=setInterval(()=>c(Math.max(0,M-(Date.now()-t))),ft);return()=>{clearTimeout(r),clearInterval(i)}},[e,n]);let l=Math.ceil(o/1e3);return u(he,{open:e!==null,onOpenChange:e=>!e&&n(),children:u(se,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:e!==null&&a(s,{children:[a(me,{children:[u(_e,{className:`break-all`,children:e.entry.fieldPath}),a(Ce,{className:`break-all`,children:[e.entry.owner,` · `,e.entry.scope]})]}),u(we,{children:u(`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})}),a(pe,{className:`flex-col items-stretch gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[u(`p`,{className:`text-[11px] text-foreground-subtle`,children:i(`secrets.revealDialog.recorded`,{seconds:l})}),a(`div`,{className:`flex justify-end gap-2`,children:[u(k,{value:e.value,label:i(`common.copy`,`Copy`),srLabel:`revealed value`}),u(A,{size:`sm`,variant:`outline`,onClick:n,children:i(`secrets.revealDialog.hide`,`Hide`)})]})]})]})})})}var X={orphan:{labelKey:`secrets.secretsTableState.usageOrphan`,variant:`warning`,hintKey:`secrets.secretsTableState.usageOrphanHint`,rank:0},unknown:{labelKey:`secrets.secretsTableState.usageUnknown`,variant:`default`,hintKey:`secrets.secretsTableState.usageUnknownHint`,rank:1},"in-use":{labelKey:`secrets.secretsTableState.usageInUse`,variant:`success`,hintKey:`secrets.secretsTableState.usageInUseHint`,rank:2}},mt=[{id:`all`,labelKey:`common.all`},{id:`in-use`,labelKey:`secrets.secretsTableState.usageInUse`},{id:`orphan`,labelKey:`secrets.secretsTableState.filterOrphans`},{id:`unknown`,labelKey:`secrets.secretsTableState.usageUnknown`}],Z=`system`;function ht(e){let{t}=V(),{secrets:n,filter:r,onFilterChange:i,onDeleteOrphans:o,deleting:s,locked:c}=e;if(n===void 0)return u(`p`,{className:`text-xs text-foreground-subtle`,children:t(`common.loading`,`Loading…`)});let l=e=>e===`all`?n.length:n.filter(t=>t.usage===e).length,d=n.filter(e=>e.usage===`orphan`).map(e=>e.ref),f=r===`all`?n:n.filter(e=>e.usage===r);return a(`div`,{className:`space-y-2`,children:[a(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[u(`div`,{className:`flex flex-wrap gap-1`,role:`group`,"aria-label":t(`secrets.secretsTable.filterByUsage`,`Filter by usage`),children:mt.map(e=>a(A,{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:[t(e.labelKey),u(`span`,{className:`text-foreground-subtle tabular-nums`,children:l(e.id)})]},e.id))}),d.length>0&&a(A,{size:`sm`,variant:`outline`,className:`ml-auto`,disabled:s||c,onClick:()=>o(d),children:[u(m,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),t(`secrets.secretsTableState.deleteOrphans`,{count:d.length})]})]}),u(O,{columns:_t(e),rows:f,rowKey:e=>e.ref,minWidthPx:860,maxBodyHeight:De,defaultSort:{columnKey:`owner`,dir:`asc`},emptyMessage:n.length===0?t(`secrets.secretsTable.noValueIsStoredIn`,`No value is stored in the keychain yet.`):t(`secrets.secretsTable.noStoredValueMatchesThis`,`No stored value matches this filter.`)})]})}function gt({owner:e}){let{t}=V();return a(`span`,{className:`flex items-center gap-2`,children:[u(Be,{addonId:e,fallback:e===Z?ee:ne,tileClassName:`bg-surface-hover text-foreground-subtle`,size:`sm`}),u(`span`,{className:`font-medium`,children:e===Z?t(`secrets.secretsTable.hubSystem`,`Hub (system)`):e})]})}function _t({locked:e,onReveal:t,revealing:n}){return[{key:`owner`,header:B.t(`secrets.secretsTable.owner`,`Owner`),render:e=>u(gt,{owner:e.owner}),sortValue:e=>e.owner},{key:`scope`,header:B.t(`secrets.secretsTable.scope`,`Scope`),render:e=>u(`span`,{className:`block max-w-[11rem] truncate font-mono`,title:e.scope,children:e.scope}),sortValue:e=>e.scope},{key:`field`,header:B.t(`secrets.secretsTable.field`,`Field`),render:e=>u(q,{value:e.fieldPath,copyValue:e.ref,srLabel:`secret ref`,maxWidthClass:`max-w-[16rem]`}),sortValue:e=>e.fieldPath},{key:`updated`,header:B.t(`secrets.secretsTable.updated`,`Updated`),render:e=>K(e.updatedAt),sortValue:e=>e.updatedAt},{key:`last-read`,header:B.t(`secrets.secretsTable.lastRead`,`Last read`),render:e=>K(e.lastReadAt),sortValue:e=>e.lastReadAt},{key:`status`,header:B.t(`secrets.secretsTable.status`,`Status`),render:e=>u(F,{variant:X[e.usage].variant,title:B.t(X[e.usage].hintKey),children:B.t(X[e.usage].labelKey)}),sortValue:e=>X[e.usage].rank},{key:`actions`,header:``,align:`right`,notSortableReason:`Actions`,render:r=>a(A,{size:`sm`,variant:`ghost`,disabled:e||n,"aria-label":B.t(`secrets.secretsTable.reveal`,`Reveal {{fieldPath}}`,{fieldPath:r.fieldPath}),title:e?B.t(`secrets.secretsTable.theKeychainIsLocked`,`The keychain is locked`):B.t(`secrets.secretsTable.revealAudited`,`Reveal (audited)`),onClick:()=>t(r),children:[u(p,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),B.t(`secrets.secretsTable.reveal2`,`Reveal`)]})}]}function vt(e){return e instanceof Error?e.message:String(e)}function yt(e){let{t}=V(),n=be(),r=D(),i=ke(),a=Me(),o=ge(),s=je(),c=ye(),l=Ne(),u=P(),d=async(t,n)=>{try{await n()}catch(e){await r({title:t,message:vt(e),variant:`danger`})}e()};return{busy:a.isPending||o.isPending||s.isPending||c.isPending,deleting:u.isPending,download:async()=>{await n({title:t(`secrets.useKeychainActions.downloadTitle`),message:t(`secrets.useKeychainActions.downloadMessage`),confirmLabel:t(`secrets.useKeychainActions.downloadConfirm`),variant:`warning`})&&await d(t(`secrets.useKeychainActions.downloadRefused`),async()=>{let e=await a.mutateAsync({});await i({title:t(`secrets.useKeychainActions.recoveryTitle`,{fingerprint:e.fingerprint}),message:t(`secrets.useKeychainActions.recoveryMessage`),defaultValue:e.key,readOnly:!0,confirmLabel:t(`secrets.useKeychainActions.recoveryDone`)})})},rotate:async()=>{await n({title:t(`secrets.useKeychainActions.rotateTitle`),message:t(`secrets.useKeychainActions.rotateMessage`),confirmLabel:t(`secrets.useKeychainActions.rotateConfirm`),variant:`warning`})&&await d(t(`secrets.useKeychainActions.rotateRefused`),async()=>{let e=await o.mutateAsync({});await r({title:t(`secrets.useKeychainActions.rotatedTitle`),message:t(`secrets.useKeychainActions.rotatedMessage`,{fingerprint:e.fingerprint})})})},purge:async()=>{await n({title:t(`secrets.useKeychainActions.purgeTitle`),message:t(`secrets.useKeychainActions.purgeMessage`),confirmLabel:t(`secrets.useKeychainActions.purgeConfirm`),variant:`warning`})&&await d(t(`secrets.useKeychainActions.purgeRefused`),async()=>{await s.mutateAsync({})})},reset:async()=>{await i({title:t(`secrets.useKeychainActions.resetTitle`),message:t(`secrets.useKeychainActions.resetMessage`,{confirmation:`RESET KEYCHAIN`}),confirmLabel:t(`secrets.useKeychainActions.resetConfirm`),validate:e=>e===`RESET KEYCHAIN`?null:t(`secrets.useKeychainActions.resetMismatch`)})===`RESET KEYCHAIN`&&await d(t(`secrets.useKeychainActions.resetRefused`),async()=>{await c.mutateAsync({confirm:ae})})},acknowledgeReset:async()=>{await d(t(`secrets.useKeychainActions.dismissFailed`),async()=>{await l.mutateAsync({})})},deleteOrphans:async e=>{await n({title:t(`secrets.useKeychainActions.orphansTitle`,{count:e.length}),message:t(`secrets.useKeychainActions.orphansMessage`),confirmLabel:t(`secrets.useKeychainActions.orphansConfirm`),variant:`danger`})&&await d(t(`secrets.useKeychainActions.orphansRefused`),async()=>{let n=await u.mutateAsync({refs:[...e]});n.kept.length>0&&await r({title:t(`secrets.useKeychainActions.keptTitle`),message:t(`secrets.useKeychainActions.keptMessage`,{deleted:n.deleted.length,kept:n.kept.length})})})}}}e();var Q=`view`;function bt(){let[e,t]=Ie();return[e.get(Q)===`audit`?`audit`:`values`,n=>{let r=new URLSearchParams(e);n===`values`?r.delete(Q):r.set(Q,n),t(r,{replace:!0})}]}function xt(){let{t:e}=V(),t=Te({}),o=le({}),s=ve({limit:500}),c=de({}),l=ue(),d=D(),[f,p]=bt(),[m,h]=r(`all`),[g,_]=r(null),v=yt(()=>{t.refetch(),o.refetch(),s.refetch(),c.refetch()}),y=t.data?.keychain.state===`locked`,b=n(()=>(o.data??[]).filter(e=>e.usage===`orphan`).length,[o.data]),x=n(()=>t.data===void 0?[]:Qe({status:t.data,reset:c.data?.reset??null,pendingReentry:c.data?.pendingReentry.length??0,orphans:b}),[t.data,c.data,b]),S={reset:c.data?.reset??null,pendingReentry:c.data?.pendingReentry??[],busy:v.busy,onReset:()=>void v.reset(),onAcknowledgeReset:()=>void v.acknowledgeReset(),onDownload:()=>void v.download(),onRotate:()=>void v.rotate(),onShowOrphans:()=>{h(`orphan`),p(`values`)}},C=async t=>{try{_({entry:t,value:(await l.mutateAsync({ref:t.ref})).value}),o.refetch()}catch(t){await d({title:e(`admin.system.secrets.revealRefused`,`Reveal refused`),message:Pe(t),variant:`danger`})}},w=i(()=>_(null),[]);return a(H,{embedded:!0,icon:E,title:e(`admin.system.secrets.secrets`,`Secrets`),subtitle:e(`admin.system.secrets.passwordsTokensAndKeysEncrypted`,`Passwords, tokens and keys, encrypted in the hub keychain. Values leave the hub only through an audited reveal.`),children:[u(st,{notices:x,renderAction:e=>rt(e,S),renderDetail:e=>it(e,S)}),t.data!==void 0&&u(dt,{status:t.data,busy:v.busy,onDownload:S.onDownload,onRotate:S.onRotate,onPurge:()=>void v.purge()}),a(Oe,{value:f,onValueChange:e=>p(e===`audit`?`audit`:`values`),children:[a(N,{children:[u(R,{value:`values`,children:e(`admin.system.secrets.storedValues`,`Stored values`)}),u(R,{value:`audit`,children:e(`admin.system.secrets.audit`,`Audit`)})]}),u(L,{value:`values`,children:u(ht,{secrets:o.data,locked:y,filter:m,onFilterChange:h,onReveal:e=>void C(e),revealing:l.isPending,onDeleteOrphans:e=>void v.deleteOrphans(e),deleting:v.deleting})}),u(L,{value:`audit`,children:u(nt,{entries:s.data})})]}),u(pt,{revealed:g,onClose:w})]})}e();var St=[[`system`]];function $(e){return e.toFixed(6).replace(/0+$/,``).replace(/\.$/,``)}function Ct(){let{t:e}=V(),n=c(),i=xe(),o=Se(),s=Ee(),[l,d]=r(``),[f,p]=r(``),[m,h]=r(null),g=i.data?.location??null;t(()=>{d(g===null?``:$(g.latitude)),p(g===null?``:$(g.longitude))},[g]);let _=async()=>{await n.invalidateQueries({queryKey:St})},y=async e=>{e.preventDefault();let t=Number(l),n=Number(f);if(l.trim()===``||f.trim()===``){h(`Enter both a latitude and a longitude, or press Clear.`);return}if(!Number.isFinite(t)||t<-90||t>90){h(`Latitude must be between -90 and 90 decimal degrees.`);return}if(!Number.isFinite(n)||n<-180||n>180){h(`Longitude must be between -180 and 180 decimal degrees.`);return}h(null),await o.mutateAsync({latitude:t,longitude:n}),await _()},b=async()=>{h(null),await o.mutateAsync(null),await _()},x=async()=>{h(null),await s.mutateAsync(),await _()},S=o.isPending||s.isPending||i.isLoading;return a(fe,{className:`space-y-3`,children:[a(`div`,{className:`flex items-start justify-between gap-3`,children:[a(`div`,{className:`flex items-start gap-2`,children:[u(v,{className:`h-4 w-4 mt-0.5 text-muted-foreground shrink-0`}),u(`div`,{children:u(`h3`,{className:`text-sm font-medium`,children:e(`settings.siteLocationCard.siteLocation`,`Site location`)})})]}),g===null?u(F,{variant:`warning`,children:e(`settings.siteLocationCard.notConfigured`,`Not configured`)}):u(F,{variant:g.source===`operator-set`?`success`:`info`,children:g.source===`operator-set`?e(`settings.siteLocationCard.setByYou`,`Set by you`):e(`settings.siteLocationCard.derivedFromIp`,`Derived from IP`)})]}),g?.label!==void 0&&g.label!==``?u(`p`,{className:`text-xs text-muted-foreground`,children:e(`settings.siteLocationCard.detectedNear`,{place:g.label})}):null,g===null&&i.data?.derivationAttemptedAt!==null?a(`p`,{className:`text-xs text-warning`,children:[e(`settings.siteLocationCard.automaticDetectionFromThePublic`,`Automatic detection from the public IP did not succeed`),i.data?.derivationError!==null&&i.data?.derivationError!==void 0?`: ${i.data.derivationError}`:`.`,` `,e(`settings.siteLocationCard.itIsNotRetriedOn`,`It is not retried on its own — enter the coordinates, or press Detect.`)]}):null,a(`form`,{className:`flex flex-wrap items-end gap-3`,onSubmit:y,children:[a(`label`,{className:`flex flex-col gap-1 text-xs`,children:[u(`span`,{className:`text-muted-foreground`,children:e(`settings.siteLocationCard.latitude`,`Latitude`)}),u(z,{className:`w-40`,value:l,inputMode:`decimal`,placeholder:`40.851800`,onChange:e=>d(e.target.value),"aria-label":e(`settings.siteLocationCard.latitude`,`Latitude`)})]}),a(`label`,{className:`flex flex-col gap-1 text-xs`,children:[u(`span`,{className:`text-muted-foreground`,children:e(`settings.siteLocationCard.longitude`,`Longitude`)}),u(z,{className:`w-40`,value:f,inputMode:`decimal`,placeholder:`14.268100`,onChange:e=>p(e.target.value),"aria-label":e(`settings.siteLocationCard.longitude`,`Longitude`)})]}),u(A,{type:`submit`,disabled:S,children:e(`common.save`,`Save`)}),a(A,{type:`button`,variant:`ghost`,disabled:S,onClick:x,children:[u(ie,{className:`h-3.5 w-3.5 mr-1`}),e(`settings.siteLocationCard.detectFromIp`,`Detect from IP`)]}),g===null?null:u(A,{type:`button`,variant:`ghost`,disabled:S,onClick:b,children:e(`settings.siteLocationCard.clear`,`Clear`)})]}),m===null?null:u(`p`,{className:`text-xs text-danger`,children:m}),u(`p`,{className:`text-xs text-muted-foreground`,children:e(`settings.siteLocationCard.wgs84DecimalDegreesDetectAsks`,`WGS84 decimal degrees. Detect asks a public geo-IP service once and will not overwrite a value you typed — clear it first.`)})]})}function wt(){let{t:e}=V(),{nodes:t,isLoading:n}=Ae(),r=t.find(e=>e.isHub&&e.isOnline),i=r?.addons.map(e=>e.addonId)??[];return a(H,{embedded:!0,children:[u(Ct,{}),n?u(`div`,{className:`text-muted-foreground text-sm py-12 text-center`,children:e(`admin.system.settings.loadingHubTopology`,`Loading hub topology…`)}):r?i.length===0?u(`div`,{className:`text-muted-foreground text-sm py-12 text-center`,children:e(`admin.system.settings.noAddonsInstalledOnThe`,`No addons installed on the hub yet.`)}):u(ze,{nodeId:r.id,addonIds:i,level:`global`}):a(`div`,{className:`flex flex-col items-center justify-center text-muted-foreground text-sm gap-2 py-12`,children:[u(b,{className:`h-8 w-8 opacity-30`}),u(`p`,{children:e(`admin.system.settings.noOnlineHubNodeFound`,`No online hub node found.`)}),u(`p`,{className:`text-xs`,children:e(`admin.system.settings.settingsWillAppearOnceThe`,`Settings will appear once the hub is reachable.`)})]})]})}function Tt(){let{t:e}=V(),t=Le(`/system/settings`,{t:e,isAdmin:!0})??{icon:b,title:e(`system.systemNav`,`System`)};return u(Re,{icon:t.icon,title:t.title,defaultSection:`settings`,sectionsLabel:`${t.title} sections`,sections:[{id:`settings`,label:e(`system.system.settings`,`Settings`),content:u(wt,{})},{id:`secrets`,label:e(`system.system.secrets`,`Secrets`),content:u(xt,{}),ownedParams:[`view`]},{id:`capabilities`,label:e(`system.system.capabilities`,`Capabilities`),content:u(Ye,{})}]})}export{Tt as SystemPage};
@@ -1 +0,0 @@
1
- import{$i as e}from"./player-overlays-CVyuEj4x.js";var t=e(`circle-slash`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]);export{t};