@camstack/addon-admin-ui 1.2.688 → 1.2.690

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 (134) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/assets/Addons-Ckr6vlsW.js +5 -0
  3. package/dist/assets/{AdminPage-BGtK1GBq.js → AdminPage-z8USGyNk.js} +1 -1
  4. package/dist/assets/{AdminSectionedPage-CRtQpSxT.js → AdminSectionedPage-CtcZ5jHa.js} +1 -1
  5. package/dist/assets/AiProfiles-DZj0TWuh.js +3 -0
  6. package/dist/assets/Archive-B0FJwta9.js +1 -0
  7. package/dist/assets/ArchiveCamera-DdovP4ro.js +1 -0
  8. package/dist/assets/{BootstrapSettingsForm-BS87l0cS.js → BootstrapSettingsForm-CKBDm4C-.js} +1 -1
  9. package/dist/assets/Build-B3CB1er7.js +40 -0
  10. package/dist/assets/{Calendars-CF3LuetJ.js → Calendars-DeXYk6f7.js} +1 -1
  11. package/dist/assets/{CameraGrids-6UFohBNL.js → CameraGrids-A_aGLmzE.js} +1 -1
  12. package/dist/assets/{Cluster-mnQtI40N.js → Cluster-D2auKPXI.js} +1 -1
  13. package/dist/assets/{CompositionBlockEditor-CY2C2J8Z.js → CompositionBlockEditor-DtVxeX5F.js} +2 -2
  14. package/dist/assets/CompositionEditorPage-BvetDCib.js +1 -0
  15. package/dist/assets/Data-oQJyojZK.js +2 -0
  16. package/dist/assets/DeviceDetail-DPxmWhcP.js +1 -0
  17. package/dist/assets/{Devices-MX4ikexb.js → Devices-3Lm2uV9o.js} +1 -1
  18. package/dist/assets/EmbedDevicePage-BgNfY1Ap.js +1 -0
  19. package/dist/assets/{EmbedPlayerPage-DRlowAOp.js → EmbedPlayerPage-BFXQpQxb.js} +1 -1
  20. package/dist/assets/History-jl2iyeKb.js +1 -0
  21. package/dist/assets/Identity-BpPWgRxJ.js +1 -0
  22. package/dist/assets/InstancesTable-DIKWKA5W.js +1 -0
  23. package/dist/assets/IntegrationDetail-ClVirS0M.js +1 -0
  24. package/dist/assets/{Integrations-DpijggGk.js → Integrations-CldsYVl0.js} +2 -2
  25. package/dist/assets/Integrations-CprYyiDb.js +1 -0
  26. package/dist/assets/Library-B86tjZ0-.js +1 -0
  27. package/dist/assets/Locations-CpNbotTl.js +3 -0
  28. package/dist/assets/Logs-DSr8wCY-.js +1 -0
  29. package/dist/assets/{MaskShapeCanvas-DjZ_ENJI.js → MaskShapeCanvas-_BFcQxc-.js} +1 -1
  30. package/dist/assets/{MotionZonesSettings-BRV1q6cp.js → MotionZonesSettings-DJDcu3fl.js} +1 -1
  31. package/dist/assets/MyAccess-DqKyBAxI.js +2 -0
  32. package/dist/assets/{Network-A8Hzlr9I.js → Network-Csm4YFXB.js} +1 -1
  33. package/dist/assets/NodeAddonsSettingsPanel-FjpwQjGM.js +2 -0
  34. package/dist/assets/Notifications-B-JLj82A.js +1 -0
  35. package/dist/assets/PanelContent-DJ8p-hQ1.js +2 -0
  36. package/dist/assets/Pipeline-DIXgco7S.js +1 -0
  37. package/dist/assets/{PrivacyMaskSettings-YvPDriCm.js → PrivacyMaskSettings-Dx5nRU-t.js} +1 -1
  38. package/dist/assets/{SceneMonitorEditor-DH2-nekM.js → SceneMonitorEditor-DFZ94G-a.js} +1 -1
  39. package/dist/assets/{ServerShell-W8Wp5cGt.js → ServerShell-BYRylYTw.js} +1 -1
  40. package/dist/assets/SessionsList-BcO2x9OZ.js +2 -0
  41. package/dist/assets/{Showroom-DFesEW-P.js → Showroom-DO1bQcNO.js} +1 -1
  42. package/dist/assets/StorageLocationsTable-BymZx5tG.js +1 -0
  43. package/dist/assets/System-dsyXpTx9.js +1 -0
  44. package/dist/assets/TemplateEditorDialog-DJIaNKn3.js +1 -0
  45. package/dist/assets/Terminal-BiXbwaPr.js +3 -0
  46. package/dist/assets/{TerminalPanel-J1w2vmDS.js → TerminalPanel-BeJx-I2E.js} +2 -2
  47. package/dist/assets/{TrainingProviders-BFbXHvOM.js → TrainingProviders-CPV9_SJC.js} +1 -1
  48. package/dist/assets/{Viewer-ZYjr8fFf.js → Viewer-BN42pCqQ.js} +1 -1
  49. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-D3ruWlC-.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DQNUYumg.js} +1 -1
  50. package/dist/assets/{action-draft-DNplCdnd.js → action-draft-BBdPH6FV.js} +1 -1
  51. package/dist/assets/{ai-page.helpers-CLp_BM_b.js → ai-page.helpers-ChgVcsV9.js} +1 -1
  52. package/dist/assets/{assignment-candidates-Cs1bHYCE.js → assignment-candidates-Bs3KAjz2.js} +1 -1
  53. package/dist/assets/{authed-media-D3P2p3qZ.js → authed-media-BK50tJc4.js} +1 -1
  54. package/dist/assets/{board-model-CEczoawG.js → board-model-CWzkqJEj.js} +1 -1
  55. package/dist/assets/circle-play-BxUrE_Qy.js +1 -0
  56. package/dist/assets/client-DhfZUoXe.js +1120 -0
  57. package/dist/assets/{command-vocab-Dp8EnV9z.js → command-vocab-B3pUOKtp.js} +1 -1
  58. package/dist/assets/device-detail-B0RHrAPi.js +1 -0
  59. package/dist/assets/{device-integration-icon-CGnRiBbM.js → device-integration-icon-JcMIVFtX.js} +1 -1
  60. package/dist/assets/device-picker-model-B2oUIKRS.js +1 -0
  61. package/dist/assets/{dist-DVUXvJ_X.js → dist-BNuE6NKf.js} +1 -1
  62. package/dist/assets/dist-CyFeeFb8.js +1120 -0
  63. package/dist/assets/{format-BqZcr5Z7.js → format-iFFzavy7.js} +1 -1
  64. package/dist/assets/{hostInit-BCFIcylY.js → hostInit-CzaZPFle.js} +1 -1
  65. package/dist/assets/i18n-DCYaeyv_.js +1 -0
  66. package/dist/assets/icons-CXirq6Hu.js +1 -0
  67. package/dist/assets/index-CpurjMmX.css +2 -0
  68. package/dist/assets/index-DPyWa2vo.js +6 -0
  69. package/dist/assets/{linked-devices-model-BIS0JhHd.js → linked-devices-model-CuXMtCW5.js} +1 -1
  70. package/dist/assets/{mf-entry-bootstrap-0-8782dcf2.js → mf-entry-bootstrap-0-02bb2c8e.js} +2 -2
  71. package/dist/assets/mount-B2oUIKRS.js +1 -0
  72. package/dist/assets/{notification-rule-status-ikR-6LJe.js → notification-rule-status-zg20pl7f.js} +1 -1
  73. package/dist/assets/player-overlays-BF9w4QU-.js +1 -0
  74. package/dist/assets/remoteEntry-ZZWQQQTl.js +1 -0
  75. package/dist/assets/square-check-big-DAcFGNUN.js +1 -0
  76. package/dist/assets/src-D9hgltMI.js +279 -0
  77. package/dist/assets/{sso-popup-Dd0yy6b3.js → sso-popup-CdVjmZ9n.js} +1 -1
  78. package/dist/assets/{step-inspector-model-Dbe3pGib.js → step-inspector-model-CxSQZZiN.js} +1 -1
  79. package/dist/assets/terminal-Dgb4lrgM.js +1 -0
  80. package/dist/assets/use-archive-data-D7nUbRKv.js +1 -0
  81. package/dist/assets/use-paged-list-DTJY2xpg.js +1 -0
  82. package/dist/assets/{use-scenes-feed-Cbr4UyCd.js → use-scenes-feed-BW5wMevx.js} +1 -1
  83. package/dist/assets/{useAdminDeviceRemoval-DNwUFqF2.js → useAdminDeviceRemoval-kU8epr6n.js} +1 -1
  84. package/dist/assets/useEventInvalidation-B2oUIKRS.js +1 -0
  85. package/dist/assets/{useNodeUrlSelection-Cbif6CY8.js → useNodeUrlSelection-CfN-OrGq.js} +1 -1
  86. package/dist/assets/user-x-DkWcmF99.js +1 -0
  87. package/dist/assets/variable-DTEpBbRf.js +1 -0
  88. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-CExmog1q.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-D3AQM66O.js} +2 -2
  89. package/dist/index.html +10 -10
  90. package/dist/server/addon.js +243 -4
  91. package/package.json +2 -2
  92. package/dist/assets/Addons-2wfM1edN.js +0 -5
  93. package/dist/assets/AiProfiles-BHwb3nSo.js +0 -3
  94. package/dist/assets/Build-DIVuAKYP.js +0 -42
  95. package/dist/assets/CompositionEditorPage-B37HL2Dz.js +0 -1
  96. package/dist/assets/Data-C7m-cbr4.js +0 -2
  97. package/dist/assets/DeviceDetail-BBiCkxxi.js +0 -2
  98. package/dist/assets/EmbedDevicePage-DHBOCKzI.js +0 -1
  99. package/dist/assets/History-DqZqNlZz.js +0 -1
  100. package/dist/assets/Identity-CM4Ortr-.js +0 -1
  101. package/dist/assets/InstancesTable-CT4Kr3zo.js +0 -1
  102. package/dist/assets/IntegrationDetail-CsdGAa7R.js +0 -1
  103. package/dist/assets/Integrations-Dl7VYw1x.js +0 -1
  104. package/dist/assets/Library-Bp85cSAL.js +0 -1
  105. package/dist/assets/Locations-IZq43PGv.js +0 -3
  106. package/dist/assets/Logs-CrDOCX6k.js +0 -1
  107. package/dist/assets/MyAccess-d5w8yPDS.js +0 -2
  108. package/dist/assets/NodeAddonsSettingsPanel-CFTTKJTW.js +0 -2
  109. package/dist/assets/Notifications-yofgwGYi.js +0 -1
  110. package/dist/assets/Pipeline-C58uJw5q.js +0 -1
  111. package/dist/assets/Recordings-CNS2YQnv.js +0 -1
  112. package/dist/assets/SessionsList-CYvDTfln.js +0 -2
  113. package/dist/assets/StorageLocationsTable-D7z9VM03.js +0 -1
  114. package/dist/assets/System-B8KmJqiE.js +0 -1
  115. package/dist/assets/TemplateEditorDialog-DTAAJR9z.js +0 -1
  116. package/dist/assets/Terminal-D0cZGsnW.js +0 -3
  117. package/dist/assets/archive-ChKlYFY2.js +0 -1
  118. package/dist/assets/client-DIFc5Ulp.js +0 -1120
  119. package/dist/assets/device-detail-D28nIlrx.js +0 -1
  120. package/dist/assets/device-picker-model-DMqoJA3J.js +0 -1
  121. package/dist/assets/dist-GJ2aJJ7U.js +0 -1120
  122. package/dist/assets/i18n-CmzYiG85.js +0 -1
  123. package/dist/assets/icons-Cjxpx-EC.js +0 -1
  124. package/dist/assets/index-CJG5kQrR.css +0 -2
  125. package/dist/assets/index-CqFqTrNf.js +0 -4
  126. package/dist/assets/mount-DMqoJA3J.js +0 -1
  127. package/dist/assets/player-overlays-Cro1Q2AX.js +0 -1
  128. package/dist/assets/remoteEntry-Cr4tLhkx.js +0 -1
  129. package/dist/assets/src-o5EApxkv.js +0 -279
  130. package/dist/assets/terminal-DU-tvcEm.js +0 -1
  131. package/dist/assets/use-stationary-objects-tm2lHAjw.js +0 -1
  132. package/dist/assets/useEventInvalidation-DMqoJA3J.js +0 -1
  133. package/dist/assets/user-x-BcmVBo8D.js +0 -1
  134. package/dist/assets/variable-Cq3v1-Kt.js +0 -1
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./browser-BHo8W_uH.js","./rolldown-runtime-Cyuzqnbw.js"])))=>i.map(i=>d[i]);
2
- import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{t}from"./vite-preload-helper-kNaey6uv.js";import{C as n,J as r,K as i,S as a,V as o,Y as s,a as c,et as l,t as u,x as d}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{$a as f,Aa as p,Br as m,Cn as h,Gr as g,Ji as _,Ki as v,Lr as y,Nn as b,Pr as x,Q as S,Zt as C,ct as w,ft as T,hi as E,ki as D,tn as O,ur as k,yt as A}from"./player-overlays-Cro1Q2AX.js";import{bi as j,yi as M}from"./client-DIFc5Ulp.js";import{l as N,o as P}from"./terminal-DU-tvcEm.js";import{t as ee}from"./monitor-smartphone-DPI9EQus.js";import{t as te}from"./unlink-D3-IGpS8.js";import{Er as ne,Fi as re,Ii as F,Pp as I,Xf as L,dl as ie,ip as R,mt as ae,pl as oe,ra as se}from"./src-o5EApxkv.js";import{t as ce}from"./i18n-CmzYiG85.js";import{t as z}from"./useTranslation-BJr-n0es.js";import"./mount-DMqoJA3J.js";import{c as le,i as ue,l as B,s as V}from"./sso-popup-Dd0yy6b3.js";import{F as H,fi as U,gi as de,i as W,ui as G}from"./index-CqFqTrNf.js";import{t as fe}from"./AdminSectionedPage-CRtQpSxT.js";import{t as pe}from"./AdminPage-BGtK1GBq.js";import{D as me,O as he,_ as ge,a as _e,h as ve,r as ye,t as be,w as xe}from"./SessionsList-CYvDTfln.js";l();var Se=`${M}/connect`,K={public:0,mesh:1,lan:2,"lan-ipv6":3};function Ce(e){switch(e.kind){case`public`:return e.interfaceKind===`vpn`?`mesh`:`public`;case`lan-ipv4`:return`lan`;case`lan-ipv6`:return`lan-ipv6`;case`custom`:return`public`;case`loopback`:case`app-link`:return null}}function q(e){return j(e)}function we(e){return e.startsWith(`https://`)}function Te(e){let t=e.flatMap(e=>{let t=Ce(e),n=q(e.baseUrl);return t===null||n===null?[]:[{endpoint:e,tier:t,origin:n}]}).toSorted((e,t)=>K[e.tier]-K[t.tier]||Number(t.endpoint.plausible)-Number(e.endpoint.plausible)||e.endpoint.priority-t.endpoint.priority),n=new Set;return t.flatMap(({endpoint:e,tier:t,origin:r})=>n.has(r)?[]:(n.add(r),[{origin:r,label:e.label,tier:t,secure:we(r),plausible:e.plausible}]))}function Ee(e,t,n=null){for(let r of[t,n]){if(r===null)continue;let t=q(r),n=e.find(e=>e.origin===t);if(n!==void 0)return n}return e[0]??null}function De(e){let t=new URL(Se);return t.searchParams.set(`hub`,e),t.toString()}var Oe=176,J={scheme:`https`};function ke(){let{t:e}=z(),t=oe(J),r=ie(J).data?.roles.publicEndpoint.resolved??null;return n(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[n(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[a(h,{className:`h-3.5 w-3.5 text-foreground-subtle`}),a(`div`,{className:`text-xs font-semibold text-foreground`,children:e(`connectPhone.title`)})]}),n(`div`,{className:`p-4 space-y-3`,children:[a(`p`,{className:`text-[11px] text-foreground-subtle`,children:e(`connectPhone.description`)}),t.isPending?n(`div`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle`,children:[a(y,{className:`h-3.5 w-3.5 animate-spin`}),e(`connectPhone.loading`)]}):t.isError?n(`div`,{className:`flex items-start gap-2 text-[11px] text-danger`,children:[a(C,{className:`h-3.5 w-3.5 mt-0.5 shrink-0`}),n(`div`,{className:`flex-1 min-w-0 space-y-1.5`,children:[a(`div`,{className:`break-words`,children:e(`connectPhone.error`,{message:t.error.message})}),a(L,{size:`sm`,variant:`ghost`,onClick:()=>void t.refetch(),children:e(`connectPhone.retry`)})]})]}):a(Ae,{candidates:Te(t.data.endpoints),preferredOrigin:r})]})]})}function Ae({candidates:e,preferredOrigin:t}){let{t:r}=z(),[o,c]=s(null),l=Ee(e,o,t),u=i(()=>l?De(l.origin):null,[l]);if(l===null||u===null)return a(`p`,{className:`text-[11px] text-foreground-subtle`,children:r(`connectPhone.empty`)});let d=e=>r(`connectPhone.tier.${e}`),f=e.map(e=>({value:e.origin,label:`${d(e.tier)} — ${e.origin}`}));return n(`div`,{className:`flex flex-col sm:flex-row gap-4`,children:[a(re,{value:u,size:Oe,alt:r(`connectPhone.qrAlt`),className:`self-start`}),n(`div`,{className:`flex-1 min-w-0 space-y-3`,children:[n(`label`,{className:`block space-y-1`,children:[a(`span`,{className:`text-[11px] font-medium text-foreground`,children:r(`connectPhone.addressLabel`)}),a(T,{value:l.origin,options:f,onChange:e=>c(e.target.value)}),n(`span`,{className:`block text-[10px] text-foreground-subtle`,children:[d(l.tier),` · `,l.label]})]}),!l.secure&&a(Y,{text:r(`connectPhone.insecure`)}),!l.plausible&&a(Y,{text:r(`connectPhone.implausible`)}),n(`div`,{className:`space-y-1`,children:[a(`span`,{className:`text-[11px] font-medium text-foreground`,children:r(`connectPhone.linkLabel`)}),n(`div`,{className:`flex items-center gap-1 rounded-md border border-border bg-background px-2 py-1`,children:[a(`code`,{className:`flex-1 min-w-0 font-mono text-[11px] text-foreground break-all select-all`,children:u}),a(ne,{value:u,srLabel:r(`connectPhone.linkLabel`)})]})]}),a(`p`,{className:`text-[11px] text-foreground-subtle`,children:r(`connectPhone.signInHint`)})]})]})}function Y({text:e}){return n(`div`,{className:`flex items-start gap-2 rounded-md border border-warning/30 bg-warning/5 px-2.5 py-1.5 text-[11px] text-foreground`,children:[a(C,{className:`h-3.5 w-3.5 text-warning mt-0.5 shrink-0`}),a(`span`,{children:e})]})}l();function je(e){return new Date(e).toLocaleDateString()}function Me(){let{t:e}=z(),t=w(),i=I.useUtils(),c=I.auth.listLinkableProviders.useQuery(),l=I.auth.listOwnExternalIdentities.useQuery(),[u,d]=s(null),[f,p]=s(()=>B(window.location.search)),h=r(null),g=W(`Linking a sign-in account`),b=r(null);o(()=>()=>b.current?.(),[]);let[x,C]=s(null);o(()=>{if(f===null)return;let e=new URL(window.location.href);e.searchParams.delete(`linked`),e.searchParams.delete(`linkError`),window.history.replaceState({},``,e.pathname+e.search+e.hash)},[f]);let T=I.auth.beginExternalLink.useMutation({onSuccess:({url:e})=>{let t=h.current;if(h.current=null,t===null||t.closed){window.location.assign(e);return}let n=e=>{C(null),p(B(`?${e}`)),i.auth.listOwnExternalIdentities.invalidate()};b.current?.(),b.current=V(t,{onReturn:e=>{e.target===`profile`&&n(e.query)},onDone:e=>{e.target===`profile`&&n(e.query)},onClosed:()=>{b.current?.(),b.current=null,i.auth.listOwnExternalIdentities.invalidate()}}),t.location.href=S(le(e))},onError:e=>{h.current?.close(),h.current=null,C(null),d(e.message)}}),E=I.auth.unlinkOwnExternalIdentity.useMutation({onSuccess:()=>void i.auth.listOwnExternalIdentities.invalidate(),onError:e=>d(e.message)}),D=c.data??[],O=l.data??[],k=x!==null&&O.some(e=>e.provider===x);if(o(()=>{!k||x===null||(C(null),p({kind:`linked`,provider:x}))},[k,x]),D.length===0&&O.length===0)return null;let A=new Set(O.map(e=>e.provider)),j=e=>D.find(t=>t.provider===e)?.label??e,M=async(n,r)=>{await t({title:e(`users.linkedSignInsSection.unlinkSignInAccount`,`Unlink sign-in account`),message:e(`users.linkedSignInsSection.stopSigningInWithThis`,`Stop signing in with this {{label}} account?`,{label:r}),confirmLabel:e(`users.linkedSignInsSection.unlink`,`Unlink`),variant:`danger`})&&(d(null),E.mutate({provider:n.provider,subject:n.subject}))};return n(`div`,{"data-testid":`linked-sign-ins`,className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[g.dialog,n(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[a(m,{className:`h-3.5 w-3.5 text-foreground-subtle`}),a(`div`,{className:`text-xs font-semibold text-foreground`,children:e(`users.linkedSignInsSection.linkedSignInAccounts`,`Linked sign-in accounts`)})]}),n(`div`,{className:`p-4 space-y-3`,children:[a(`p`,{className:`text-[11px] text-foreground-subtle`,children:e(`users.linkedSignInsSection.signInWithAnExternal`,`Sign in with an external account instead of your password. Only accounts you link here can sign you in; your two-factor authentication still applies.`)}),f?.kind===`linked`&&n(`div`,{className:`flex items-center gap-2 rounded-md border border-emerald-500/30 bg-emerald-500/5 px-3 py-2 text-xs text-foreground`,children:[a(v,{className:`h-3.5 w-3.5 text-emerald-500 shrink-0`}),e(`users.linkedSignIns.linkedNotice`,{provider:j(f.provider)})]}),(f?.kind===`error`||u)&&n(`div`,{className:`flex items-center gap-2 rounded-md border border-danger/20 bg-danger/10 px-3 py-2 text-xs text-danger`,children:[a(_,{className:`h-3.5 w-3.5 shrink-0`}),u??(f?.kind===`error`?f.message:``)]}),O.length>0&&a(`ul`,{className:`divide-y divide-border rounded-md border border-border`,children:O.map(t=>{let r=t.providerLabel??t.provider;return n(`li`,{className:`flex items-center gap-3 px-3 py-2 text-xs`,children:[n(`div`,{className:`flex-1 min-w-0`,children:[n(`div`,{className:`font-medium text-foreground truncate`,children:[r,!t.available&&a(`span`,{className:`ml-2 rounded bg-foreground-subtle/15 px-1.5 py-0.5 text-[10px] font-normal text-foreground-subtle`,children:e(`users.linkedSignInsSection.providerUnavailable`,`provider unavailable`)})]}),a(`div`,{className:`text-[11px] text-foreground-subtle truncate`,children:e(`users.linkedSignIns.linkedOn`,{label:t.label??t.subject,date:je(t.linkedAt)})})]}),n(L,{variant:`unstyled`,onClick:()=>void M(t,r),disabled:E.isPending,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] text-danger hover:bg-danger/10 disabled:opacity-50`,children:[a(te,{className:`h-3 w-3`}),e(`users.linkedSignInsSection.unlink`,`Unlink`)]})]},`${t.provider}|${t.subject}`)})}),a(`div`,{className:`flex flex-wrap gap-2`,children:D.filter(e=>!A.has(e.provider)).map(t=>n(L,{variant:`unstyled`,onClick:()=>{d(null),p(null),g.requestProof().then(e=>{e!==null&&(h.current=ue(null),C(h.current===null?null:t.provider),T.mutate({provider:t.provider,reauthToken:e}))})},disabled:T.isPending,className:`inline-flex items-center gap-1.5 rounded border border-border px-2.5 py-1 text-[11px] font-medium text-foreground hover:bg-surface-hover disabled:opacity-50`,children:[T.isPending&&T.variables?.provider===t.provider?a(y,{className:`h-3 w-3 animate-spin`}):a(m,{className:`h-3 w-3`}),e(`users.linkedSignIns.link`,{provider:t.label})]},t.provider))})]})]})}l();function Ne({value:r,size:i=192}){let{t:c}=z(),[l,u]=s(null),[d,f]=s(null);if(o(()=>{let n=!1;return t(()=>import(`./browser-BHo8W_uH.js`).then(t=>e(t.default,1)).then(async e=>{if(n)return;let t=e.create;if(typeof t!=`function`){f(`qrcode.create() unavailable in installed version`);return}try{let e=t(r,{errorCorrectionLevel:`M`});n||u(e)}catch(e){n||f(e instanceof Error?e.message:`QR generation failed`)}}),__vite__mapDeps([0,1]),import.meta.url).catch(()=>{n||f(`qrcode library not installed`)}),()=>{n=!0}},[r]),d)return a(`div`,{className:`flex items-center justify-center text-[10px] text-foreground-subtle text-center p-4`,style:{width:i,height:i},children:c(`users.totpQrCode.qrRenderingUnavailableUseThe`,`QR rendering unavailable — use the secret below.`)});if(!l)return a(`div`,{className:`flex items-center justify-center text-[10px] text-foreground-subtle animate-pulse`,style:{width:i,height:i},children:c(`users.totpQrCode.generating`,`Generating…`)});let p=l.modules.size,m=i/p,h=[];for(let e=0;e<p;e++)for(let t=0;t<p;t++)l.modules.data[e*p+t]&&h.push(a(`rect`,{x:t*m,y:e*m,width:m,height:m,fill:`currentColor`},`${t}-${e}`));return n(`svg`,{width:i,height:i,viewBox:`0 0 ${i} ${i}`,className:`text-black`,children:[a(`rect`,{x:0,y:0,width:i,height:i,fill:`white`}),h]})}l();function Pe(){let{t:e}=z(),t=A(),[r,i]=s(``),[o,c]=s(``),[l,d]=s(``),[f,p]=s(null),m=u({mutationFn:e=>t.changeOwnPassword(e),onSuccess:()=>{p({kind:`success`,msg:`Password updated.`}),i(``),c(``),d(``)},onError:e=>{p({kind:`error`,msg:e instanceof Error?e.message:`Update failed`})}}),h=o.length>0&&l.length>0&&o!==l,g=o.length>0&&o.length<8,b=r.length>=1&&o.length>=8&&o===l;return n(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[n(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[a(N,{className:`h-3.5 w-3.5 text-foreground-subtle`}),a(`div`,{className:`text-xs font-semibold text-foreground`,children:e(`systemPage.myAccess.changePassword`,`Change password`)})]}),n(`div`,{className:`p-4 space-y-3`,children:[a(X,{label:e(`systemPage.myAccess.currentPassword`,`Current password`),value:r,onChange:i,autoComplete:`current-password`}),a(X,{label:e(`systemPage.myAccess.newPassword`,`New password`),value:o,onChange:c,autoComplete:`new-password`,hint:e(`systemPage.myAccess.atLeast8Characters`,`At least 8 characters.`)}),a(X,{label:e(`systemPage.myAccess.confirmNewPassword`,`Confirm new password`),value:l,onChange:d,autoComplete:`new-password`}),(h||g)&&a(`div`,{className:`text-[11px] text-danger`,children:h?e(`systemPage.myAccess.passwordsDoNotMatch`,`Passwords do not match.`):e(`systemPage.myAccess.newPasswordMustBeAt`,`New password must be at least 8 characters.`)}),f&&n(`div`,{className:`text-[11px] flex items-center gap-1 ${f.kind===`success`?`text-success`:`text-danger`}`,children:[f.kind===`success`?a(v,{className:`h-3 w-3`}):a(_,{className:`h-3 w-3`}),f.msg]}),a(`div`,{className:`flex justify-end`,children:n(L,{onClick:()=>{p(null),m.mutate({currentPassword:r,newPassword:o})},disabled:!b||m.isPending,children:[m.isPending?a(y,{className:`h-3 w-3 animate-spin`}):a(x,{className:`h-3 w-3`}),e(`systemPage.myAccess.updatePassword`,`Update password`)]})})]})]})}function X({label:e,value:t,onChange:r,autoComplete:i,hint:o}){return n(`div`,{className:`space-y-1`,children:[a(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:e}),a(R,{type:`password`,value:t,onChange:e=>r(e.target.value),autoComplete:i,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`}),o&&a(`div`,{className:`text-[10px] text-foreground-subtle`,children:o})]})}function Fe({username:e}){let{t}=z(),r=A(),l=c({queryKey:[`auth`,`getOwnTotpStatus`],queryFn:()=>r.getOwnTotpStatus()}),f=l.data,[p,m]=s(null),[g,b]=s(``),[x,S]=s(null),[C,w]=s(!1),T=u({mutationFn:()=>r.setupOwnTotp(),onSuccess:e=>{m({secret:e.secret,otpauthUrl:e.otpauthUrl}),b(``),S(null)},onError:e=>S(e instanceof Error?e.message:`Setup failed`)}),E=u({mutationFn:e=>r.confirmOwnTotp(e),onSuccess:()=>{m(null),b(``),S(null),l.refetch()},onError:e=>S(e instanceof Error?e.message:`Confirmation failed — code did not match`)}),O=W(`Turning off two-factor authentication`),k=u({mutationFn:async()=>{let e=await O.requestProof();return e===null?null:r.disableOwnTotp({reauthToken:e})},onSuccess:()=>{S(null),l.refetch()},onError:e=>S(e instanceof Error?e.message:`Disable failed`)});o(()=>{if(!C)return;let e=setTimeout(()=>w(!1),1500);return()=>clearTimeout(e)},[C]);let j=i(()=>l.isLoading?`loading`:p?`setup_in_progress`:f?.enabled?`enrolled`:`not_enrolled`,[l.isLoading,f?.enabled,p]);return n(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[O.dialog,n(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[a(h,{className:`h-3.5 w-3.5 text-foreground-subtle`}),a(`div`,{className:`text-xs font-semibold text-foreground`,children:t(`systemPage.myAccess.twoFactorAuthentication`,`Two-factor authentication`)})]}),n(`div`,{className:`p-4 space-y-3`,children:[j===`loading`&&n(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[a(y,{className:`h-3.5 w-3.5 animate-spin`}),t(`systemPage.myAccess.checkingStatus`,`Checking status…`)]}),j===`not_enrolled`&&n(d,{children:[a(`div`,{className:`text-xs text-foreground-subtle`,children:t(`systemPage.myAccess.2faIsnTActiveOn`,`2FA isn't active on your account. Enable it to require a 6-digit code from your authenticator app at every login.`)}),a(`div`,{className:`flex justify-end`,children:n(L,{onClick:()=>{S(null),T.mutate()},disabled:T.isPending,children:[T.isPending?a(y,{className:`h-3 w-3 animate-spin`}):a(h,{className:`h-3 w-3`}),t(`systemPage.myAccess.enable2fa`,`Enable 2FA`)]})})]}),j===`setup_in_progress`&&p&&n(d,{children:[a(`div`,{className:`text-[11px] text-foreground-subtle`,children:a(G,{i18nKey:`systemPage.myAccess.scanQr`,values:{username:e},components:{mono:a(`span`,{className:`font-mono`})}})}),n(`div`,{className:`flex flex-col items-center gap-3`,children:[a(`div`,{className:`rounded-lg border border-border bg-white p-3`,children:a(Ne,{value:p.otpauthUrl,size:180})}),n(`div`,{className:`w-full`,children:[a(`div`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle mb-1`,children:t(`systemPage.myAccess.secretManualEntry`,`Secret (manual entry)`)}),n(`div`,{className:`flex items-center gap-2 rounded border border-border bg-surface-hover/30 px-2 py-1.5`,children:[a(`code`,{className:`text-[11px] font-mono text-foreground break-all flex-1`,children:p.secret}),n(L,{variant:`ghost`,onClick:()=>{p&&navigator.clipboard.writeText(p.secret).then(()=>w(!0))},children:[C?a(v,{className:`h-3 w-3 text-success`}):a(D,{className:`h-3 w-3`}),C?t(`systemPage.myAccess.copied`,`Copied`):t(`common.copy`,`Copy`)]})]})]})]}),n(`div`,{className:`space-y-1`,children:[a(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`6-digit code`}),a(R,{type:`text`,inputMode:`numeric`,autoComplete:`one-time-code`,placeholder:`123456`,value:g,onChange:e=>b(e.target.value.replace(/\D/g,``).slice(0,6)),className:`w-full rounded-md border border-border bg-surface px-3 py-2 text-center text-lg font-mono tracking-widest text-foreground focus:outline-none focus:ring-2 focus:ring-primary`})]}),x&&n(`div`,{className:`text-[11px] text-danger flex items-center gap-1`,children:[a(_,{className:`h-3 w-3`}),x]}),n(`div`,{className:`flex justify-end gap-2`,children:[a(L,{variant:`outline`,onClick:()=>{m(null),S(null),b(``)},children:t(`common.cancel`,`Cancel`)}),n(L,{onClick:()=>{S(null),E.mutate({code:g})},disabled:E.isPending||g.length!==6,children:[E.isPending?a(y,{className:`h-3 w-3 animate-spin`}):a(v,{className:`h-3 w-3`}),t(`common.confirm`,`Confirm`)]})]})]}),j===`enrolled`&&f&&n(d,{children:[n(`div`,{className:`rounded-md border border-success/30 bg-success/5 px-3 py-2.5 flex items-start gap-2.5`,children:[a(v,{className:`h-4 w-4 mt-0.5 text-success shrink-0`}),n(`div`,{className:`text-xs text-foreground space-y-0.5`,children:[a(`div`,{className:`font-medium`,children:t(`systemPage.myAccess.2faIsActive`,`2FA is active`)}),a(`div`,{className:`text-foreground-subtle`,children:t(`common.enrolledOn`,{when:f.confirmedAt?new Date(f.confirmedAt).toLocaleString():`—`})})]})]}),x&&n(`div`,{className:`text-[11px] text-danger flex items-center gap-1`,children:[a(_,{className:`h-3 w-3`}),x]}),a(`div`,{className:`flex justify-end`,children:n(L,{variant:`danger`,onClick:()=>{S(null),k.mutate()},disabled:k.isPending,children:[k.isPending?a(y,{className:`h-3 w-3 animate-spin`}):a(h,{className:`h-3 w-3`}),t(`systemPage.myAccess.disable2fa`,`Disable 2FA`)]})})]})]})]})}function Ie(){return se(`auth-webauthn/passkey-enrollment`)?a(F,{widgetId:`auth-webauthn/passkey-enrollment`,host:`dashboard`}):null}l();function Z(e){return e.message.length>0?e.message:ce.t(`auth.authAuditSection.requestFailed`)}function Le(){let{t:e}=z(),{logout:t}=H(),r=w(),i=I.useUtils(),o=I.auth.listOwnSessions.useQuery(),[c,l]=s(null),u=I.auth.revokeOwnSession.useMutation({onSuccess:()=>void i.auth.listOwnSessions.invalidate(),onError:e=>l(`Sign out failed: ${Z(e)}`)}),d=I.auth.logout.useMutation({onSuccess:()=>t(),onError:e=>l(`Sign out failed: ${Z(e)}`)}),f=async t=>{await r({title:e(`auth.mySessionsSection.signOutThisSession`,`Sign out this session`),message:e(`auth.mySessionsSection.willHaveToSignIn`,`{{label}} will have to sign in again.`,{label:ge(t.client).label}),confirmLabel:e(`auth.mySessionsSection.signOut`,`Sign out`),variant:`danger`})&&(l(null),u.mutate({id:t.id}))},p=async()=>{await r({title:e(`auth.mySessionsSection.signOutEverywhere`,`Sign out everywhere`),message:e(`auth.mySessionsSection.everySessionOfYourAccount`,`Every session of your account ends, this browser included: you will be signed out here too and every device has to sign in again.`),confirmLabel:e(`auth.mySessionsSection.signOutEverywhere`,`Sign out everywhere`),variant:`danger`})&&(l(null),d.mutate({everywhere:!0}))};return n(`div`,{"data-testid":`my-sessions`,className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[n(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[a(ee,{className:`h-3.5 w-3.5 text-foreground-subtle`}),a(`div`,{className:`text-xs font-semibold text-foreground`,children:e(`auth.mySessionsSection.activeSessions`,`Active sessions`)})]}),n(`div`,{className:`p-4 space-y-3`,children:[a(`p`,{className:`text-[11px] text-foreground-subtle`,children:e(`auth.mySessionsSection.theBrowsersAndAppsSigned`,`The browsers and apps signed in to your account. Signing one out ends it at once.`)}),c!==null&&a(`div`,{className:`text-[11px] text-danger`,children:c}),a(be,{sessions:o.data??[],isLoading:o.isLoading,loadError:o.isError?o.error?.message??e(`auth.authAuditSection.requestFailed`):null,emptyText:`No active sessions.`,onRevoke:e=>void f(e),revokingId:u.isPending?u.variables?.id??null:null}),a(`div`,{className:`flex justify-end`,children:n(L,{variant:`unstyled`,onClick:()=>void p(),disabled:d.isPending,className:`inline-flex items-center gap-1.5 rounded border border-danger/40 px-2.5 py-1 text-[11px] font-medium text-danger hover:bg-danger/10 disabled:opacity-50`,children:[d.isPending?a(y,{className:`h-3 w-3 animate-spin`}):a(P,{className:`h-3 w-3`}),e(`auth.mySessionsSection.signOutEverywhere`,`Sign out everywhere`)]})})]})]})}l();var Re=`You`;function Q(){let{t:e}=z(),t=w(),n=I.useUtils(),r=I.auth.listOwnDeviceCredentials.useQuery(),[o,c]=s(null),l=I.auth.revokeOwnDeviceCredential.useMutation({onSuccess:e=>{e.revoked||c(`That device could not be revoked - it may already be gone.`),n.auth.listOwnDeviceCredentials.invalidate()},onError:e=>c(`Revoke failed: ${e.message}`)}),u=i(()=>(r.data??[]).map(e=>ye(e,Re)),[r.data]),d=async n=>{await t({title:e(`certificates.myDevicesSection.revoke`,`Revoke "{{name}}"?`,{name:n.name}),message:e(`certificates.myDevicesSection.theDeviceStopsSigningIn`,`The device stops signing in at once and its open sessions end. To use it again you have to pair it anew. This cannot be undone.`),confirmLabel:e(`certificates.myDevicesSection.revoke2`,`Revoke`),variant:`danger`})&&(c(null),l.mutate({id:n.id}))},f={label:e(`certificates.myDevicesSection.revoke2`,`Revoke`),icon:p,isAvailable:_e,onRun:e=>void d(e),busyId:l.isPending?l.variables?.id??null:null,disabled:l.isPending};return a(me,{id:`my-devices`,title:e(`certificates.myDevicesSection.myDevices`,`My devices`),icon:h,description:e(`certificates.myDevicesSection.phonesThatStaySignedIn`,`Phones that stay signed in to your account with a certificate. If one is lost, revoke it here and it is signed out at once.`),notice:he(o),onDismissNotice:()=>c(null),children:a(xe,{rows:u,label:e(`certificates.devicesCard.label`),isLoading:r.isPending,loadError:r.error===null?null:r.error.message||`Request failed`,emptyText:`No devices are signed in with a certificate.`,hideOwner:!0,expiresNone:`—`,action:f})})}var $={profile:`profile`,signIn:`sign-in`,sessions:`sessions`,tokens:`tokens`},ze=[`linked`,`linkError`],Be={view:{icon:E,cls:`bg-foreground-subtle/15 text-foreground-subtle`},create:{icon:k,cls:`bg-primary/15 text-primary`},delete:{icon:O,cls:`bg-danger/15 text-danger`}};function Ve(){let{t:e}=z(),{user:t,logout:r}=H(),[i]=de(),o=e(`system.myAccess`,`My access`);if(!t)return a(pe,{icon:b,title:o,children:a(`div`,{className:`text-xs text-foreground-subtle`,children:e(`systemPage.myAccess.notSignedIn`,`Not signed in.`)})});if(i.get(`tab`)===`preferences`)return a(U,{to:`/system/settings`,replace:!0});if(ze.some(e=>i.has(e))&&!i.has(`tab`)){let e=new URLSearchParams(i);return e.set(`tab`,$.signIn),a(U,{to:`?${e.toString()}`,replace:!0})}return a(fe,{icon:b,title:o,subtitle:e(`systemPage.myAccess.subtitle`,`Your account, how you sign in, where you are signed in, and your tokens.`),sectionsLabel:e(`systemPage.myAccess.sectionsLabel`,`My access sections`),defaultSection:$.profile,actions:n(L,{variant:`outline`,onClick:r,children:[a(P,{className:`h-3 w-3`}),e(`systemPage.myAccess.signOut`,`Sign out`)]}),sections:[{id:$.profile,label:e(`systemPage.myAccess.sections.profile`,`Profile`),content:a(He,{user:t})},{id:$.signIn,label:e(`systemPage.myAccess.sections.signIn`,`Sign-in & security`),content:n(`div`,{className:`space-y-4`,children:[a(Pe,{}),a(Fe,{username:t.username}),a(Ie,{}),a(Me,{})]})},{id:$.sessions,label:e(`systemPage.myAccess.sections.sessions`,`Sessions & devices`),content:n(`div`,{className:`space-y-4`,children:[a(Le,{}),a(Q,{}),a(ke,{})]})},{id:$.tokens,label:e(`systemPage.myAccess.sections.tokens`,`Tokens`),content:a(ve,{ownOnly:!0})}]})}function He({user:e}){let{t}=z(),r=e.isAdmin,i=e.scopes??[];return n(`div`,{className:`space-y-4`,children:[n(`div`,{className:`rounded-lg border border-border bg-surface px-4 py-3 flex items-center gap-3`,children:[a(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-full bg-primary/10 text-primary font-semibold text-base`,children:e.username.slice(0,1).toUpperCase()}),n(`div`,{className:`flex-1 min-w-0`,children:[a(`div`,{className:`text-sm font-semibold text-foreground truncate`,children:e.username}),n(`div`,{className:`text-[11px] text-foreground-subtle`,children:[r?t(`systemPage.myAccess.administrator`,`Administrator`):t(`systemPage.myAccess.user`,`User`),` `,a(G,{i18nKey:`systemPage.myAccess.sessionId`,values:{id:e.id.slice(0,8)},components:{mono:a(`span`,{className:`font-mono`})}})]})]})]}),r&&n(`div`,{className:`rounded-lg border border-primary/30 bg-primary/5 px-4 py-3 text-xs text-foreground flex items-start gap-2.5`,children:[a(g,{className:`h-4 w-4 text-primary mt-0.5 shrink-0`}),n(`div`,{children:[a(`div`,{className:`font-semibold text-foreground`,children:t(`systemPage.myAccess.unrestrictedAccess`,`Unrestricted access`)}),a(`p`,{className:`text-foreground-subtle mt-0.5`,children:t(`systemPage.myAccess.adminSessionsBypassThePer`,`Admin sessions bypass the per-call scope check. Every protected endpoint is reachable regardless of the list below.`)})]})]}),i.length>0&&a(Ue,{scopes:i})]})}function Ue({scopes:e}){let{t}=z(),r=f();return n(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[n(`div`,{className:`px-4 py-2 border-b border-border`,children:[a(`div`,{className:`text-xs font-semibold text-foreground`,children:t(`systemPage.myAccess.grantedScopes`,`Granted scopes`)}),a(`div`,{className:`text-[10px] text-foreground-subtle`,children:t(`systemPage.myAccess.bakedIntoYourSessionToken`,`Baked into your session token at login; sign out + back in to refresh after changes.`)})]}),n(`div`,{className:`grid grid-cols-[100px_1fr_240px] gap-3 px-4 py-2 text-[10px] uppercase tracking-wide text-foreground-subtle border-b border-border`,children:[a(`div`,{children:t(`systemPage.myAccess.type`,`Type`)}),a(`div`,{children:t(`systemPage.myAccess.target`,`Target`)}),a(`div`,{children:t(`systemPage.myAccess.access`,`Access`)})]}),a(`ul`,{className:`divide-y divide-border`,children:e.map((e,i)=>n(`li`,{className:`grid grid-cols-[100px_1fr_240px] gap-3 px-4 py-2.5 items-center text-xs`,children:[a(`span`,{className:`font-mono text-foreground-subtle`,children:e.type}),a(`span`,{className:`font-mono text-foreground`,children:e.type===`device`?ae(e.selector,r):e.target}),a(`div`,{className:`flex items-center gap-1`,children:[`view`,`create`,`delete`].map(r=>{let i=e.access.includes(r),{icon:o,cls:s}=Be[r];return n(`span`,{className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium ${i?s:`bg-transparent text-foreground-subtle/40 line-through`}`,title:i?t(`systemPage.myAccess.can`,`Can {{a}}`,{a:r}):t(`systemPage.myAccess.cannot`,`Cannot {{a}}`,{a:r}),children:[a(o,{className:`h-3 w-3`}),r]},r)})})]},i))})]})}export{Ve as MyAccessPage};
@@ -1,2 +0,0 @@
1
- import{C as e,J as t,K as n,R as r,S as i,V as a,W as o,Y as s,a as c,et as l,i as u,j as d,o as f,p,t as m}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{yt as h}from"./player-overlays-Cro1Q2AX.js";import{Bc as g,zc as _}from"./client-DIFc5Ulp.js";import{Ua as v,Wa as y,Xf as b,as as ee,at as te,eo as ne,xo as re}from"./src-o5EApxkv.js";import{t as ie}from"./useTranslation-BJr-n0es.js";import{M as ae,N as oe,Nt as x,P as S}from"./index-CqFqTrNf.js";l();var C=d(function({addonId:e,schema:s,serverValues:c,onImmediateSave:l,onStateChange:u,onAction:d,disabled:f},p){let m=S({schema:s,serverValues:c,onImmediateSave:r(t=>l(e,t),[e,l]),onDeferredSave:r(()=>{},[])});o(p,()=>({flush:()=>{let e={};for(let t of m.pendingKeys)e[t]=m.values[t];return m.handleDiscard(m.pendingKeys),e},discard:()=>m.resetAll()}),[m]);let h=m.pendingKeys,g=h.join(`|`),_=n(()=>h.map(e=>`${e}=${JSON.stringify(m.values[e])}`).join(`,`),[h,m.values]),v=t(u);a(()=>{v.current=u},[u]),a(()=>{let t={};for(let e of h)t[e]=m.values[e];v.current({addonId:e,pendingKeys:h,pendingValues:t})},[e,g,_]);let y=n(()=>{if(d)return(t,n,r)=>d(e,t,n,r)},[e,d]);return i(x,{schema:s,values:m.values,onChange:m.handleChange,disabled:f,onAction:y})});function w(e){return`perNode`in e&&e.perNode===!0}function T(e,t){if(e.type===`group`){let n=E(e.fields,t);return n.length>0?{...e,fields:n}:null}if(e.type===`sub-tabs`){let n=e.tabs.map(e=>({...e,fields:E(e.fields,t)})).filter(e=>e.fields.length>0);return n.length>0?{...e,tabs:n}:null}return w(e)===(t===`perNode`)?e:null}function E(e,t){let n=[];for(let r of e){let e=T(r,t);e!==null&&n.push(e)}return n}function se(e,t){let n=[];for(let r of e.sections){let e=E(r.fields,t);e.length!==0&&n.push({...r,fields:e})}return{...e,sections:n}}function D(e,t){return t===void 0?!0:t===`perNode`?e===`node`:e!==`node`}function ce(e){let t=e.allowSectionIds?new Set(e.allowSectionIds):null,n=e.omitSectionIds?new Set(e.omitSectionIds):null,r=new Set,i=[];for(let a of e.declarations){if(!D(a.scope,e.fieldScope)||e.capability!==void 0&&a.cap!==e.capability)continue;let o=a.sectionIds.filter(e=>r.has(e)||(r.add(e),t!==null&&!t.has(e))?!1:n===null||!n.has(e));o.length>0&&i.push({cap:a.cap,scope:a.scope,sectionIds:o})}return i}function le(e){let t=[],n=new Map,r={};for(let{declaration:i,form:a}of e){let e=new Set(i.sectionIds),o=a.sections.filter(t=>e.has(t.id));t.push(...o);for(let e of a.tabs??[])n.has(e.id)||n.set(e.id,e);for(let e of g({sections:o}).keys()){let t=r[e]??[];t.push({cap:i.cap,scope:i.scope}),r[e]=t}}return{form:{...n.size>0?{tabs:[...n.values()]}:{},sections:t},keyTargets:r}}function ue(e,t){let n=new Map,r=[];for(let[i,a]of Object.entries(e)){let e=t[i];if(e===void 0||e.length===0){r.push(i);continue}for(let t of e){let e=`${t.cap}\u0000${t.scope}`,r=n.get(e)??{target:t,patch:{}};r.patch[i]=a,n.set(e,r)}}return{groups:[...n.values()].map(e=>({...e.target,patch:e.patch})),unowned:r}}function de(e,t){let n=e??`general`;return t?.[n]??n}function O(e){return typeof e!=`object`||!e||!(`key`in e)?null:typeof e.key==`string`?e.key:null}function fe(e,t){let n=t.fieldKeys===void 0?null:new Set(t.fieldKeys),r=[];for(let i of e){let e=n===null?i.fields:i.fields.filter(e=>{let t=O(e);return t!==null&&n.has(t)});e.length!==0&&r.push({...i,fields:e,...t.tabAliases===void 0?{}:{tab:de(i.tab,t.tabAliases)},...t.hideSectionChrome===!0?{title:``,description:void 0}:{}})}return r}var k=`login-method`,A=`integration-instances`,j=new Set;function pe(e){return e.level===`global`&&e.capability===void 0&&e.sectionIds===void 0&&e.fieldScope===void 0&&e.fieldKeys===void 0}function me(e){let t=new Set([k]);for(let n of e)for(let e of n)t.add(e);return t}function M(e){return!e.isSuccess&&!e.isError}function N(e){return e instanceof Error&&e.message.length>0?e.message:`Could not list connection providers`}function P(e){if(!e.active)return{phase:`off`,caps:j,error:null};if(!e.canQuery)return{phase:`ready`,caps:j,error:null};if(M(e.holders))return{phase:`loading`,caps:j,error:null};if(e.holders.isError)return{phase:`ready`,caps:me([]),error:N(e.holders.error)};if(e.described.some(M))return{phase:`loading`,caps:j,error:null};let t=e.described.find(e=>e.isError);return{phase:`ready`,caps:me(e.described.flatMap(e=>e.data===void 0?[]:[e.data])),error:t===void 0?null:N(t.error)}}function F(e){if(typeof e!=`object`||!e||!(`addonId`in e))return null;let t=e.addonId;return typeof t==`string`&&t.length>0?t:null}async function I(e){let t=await e({capName:A});if(!Array.isArray(t))throw Error(`listCapabilityProviders did not answer with a list`);let n=[];for(let e of t){let t=F(e);t!==null&&n.push(t)}return n}function L(e){if(typeof e!=`object`||!e||!(`kinds`in e))return[];let t=e.kinds;if(!Array.isArray(t))return[];let n=[];for(let e of t){if(typeof e!=`object`||!e||!(`functionCap`in e))continue;let t=e.functionCap;typeof t==`string`&&t.length>0&&n.push(t)}return n}function he(e){let t=h().trpcClient,n=t.addons.listCapabilityProviders?.query,r=t.integrationInstances?.describe?.query,i=n!==void 0&&r!==void 0,a=c({queryKey:[`settings`,`provider-page-holders`],enabled:e&&i,queryFn:()=>{if(n===void 0)throw Error(`listCapabilityProviders is not available`);return I(n)}});return P({active:e,canQuery:i,holders:a,described:u({queries:(a.data??[]).map(t=>({queryKey:[`settings`,`provider-page-kinds`,t],enabled:e&&i&&a.isSuccess,queryFn:async()=>{if(r===void 0)throw Error(`integrationInstances.describe is not available`);return L(await r({addonId:t}))}}))})})}l();function R(e,t){if(e.type===`separator`||e.type===`info`||e.type===`button`)return e;if(e.type===`group`){let n=e.fields.map(e=>R(e,t));return{...e,fields:n}}let n=e;t[e.key]=n.value;let{value:r,...i}=n;return i}function z(e,t){return{...e,fields:e.fields.map(e=>R(e,t))}}function ge(e){let t={};return{schema:{...e.tabs?{tabs:e.tabs}:{},sections:e.sections.map(e=>z(e,t))},values:t}}function B({nodeId:a,addonIds:o,level:c,deviceId:l,capability:d,sectionIds:g,omitSectionIds:b,fieldKeys:x,hideSectionChrome:S,tabAliases:C,tabLabelOverrides:w,sectionTab:T,fieldScope:E,emptyMessage:D,extraTabs:O,schemaTabExtras:k,title:A,description:j,selfTabbed:me,activeTab:M,onActiveTabChange:N}){let{t:P}=ie(),F=f(),I=h().trpcClient,L=y(),R=v(),z=ee(),B=re(),V=me===!0||!!(O&&O.length>0),[ve,ye]=s(null);if(c===`device`&&!l)throw Error(`NodeAddonsSettingsPanel: deviceId is required when level === "device"`);let H=a??`hub`,U=he(pe({level:c,...d===void 0?{}:{capability:d},...g===void 0?{}:{sectionIds:g},...E===void 0?{}:{fieldScope:E},...x===void 0?{}:{fieldKeys:x}})),be=U.phase===`ready`?[...U.caps].sort().join(`
2
- `):``,W=u({queries:o.map(e=>({queryKey:[[`addonSettings`,c===`global`?`listScopedSettings`:`getDeviceSettings`],{addonId:e,nodeId:H,deviceId:l??null,cap:d??null,scope:E??null,sections:[g??null,b??null],providerCaps:be}],enabled:U.phase!==`loading`,queryFn:async()=>{if(c===`global`){let t=await I.addonSettings.listScopedSettings.query({addonId:e,nodeId:H});if(t===null)return{addonId:e,result:null,keyTargets:{}};let n=ce({declarations:U.phase===`ready`?t.filter(e=>!U.caps.has(e.cap)):t,...E===void 0?{}:{fieldScope:E},...d===void 0?{}:{capability:d},...g===void 0?{}:{allowSectionIds:g},...b===void 0?{}:{omitSectionIds:b}}),r=await Promise.all(n.map(async t=>{let n=await I.addonSettings.getScopedSettings.query({addonId:e,cap:t.cap,scope:t.scope,...t.scope===`node`?{nodeId:H}:{}});return n===null?null:{declaration:t,form:n}})),i=r.filter(e=>e!==null);if(i.length!==r.length)return{addonId:e,result:null,keyTargets:{}};let a=le(i);return{addonId:e,result:a.form,keyTargets:a.keyTargets}}let t=await I.addonSettings.getDeviceSettings.query({addonId:e,deviceId:l,nodeId:H});return{addonId:e,result:t!==null&&E!==void 0?se(t,E):t,keyTargets:{}}},placeholderData:p}))}),xe=U.phase===`loading`||W.some(e=>e.isLoading),G=W.map(e=>{if(!e.data)return`-`;if(e.data.result===null)return`${e.data.addonId}:n`;let t=[];for(let n of e.data.result.sections){t.push(`s:${n.id}:${n.tab??`general`}`);for(let e of n.fields){if(!(`key`in e))continue;let n=`options`in e&&Array.isArray(e.options)?e.options.map(e=>e.value).join(`,`):``,r=e.value,i=r===void 0?``:typeof r==`string`?r:JSON.stringify(r);t.push(`f:${e.key}:${n}:${i}`)}}return`${e.data.addonId}:${t.join(`|`)}`}).join(`||`),K=n(()=>{let e=new Set;for(let t of W){let n=t.data?.result?.sections;if(n)for(let t of n)e.add(de(t.tab,C))}return[...e]},[C,G+`::`+W.map(e=>(e.data?.result?.sections??[]).map(e=>e.tab??`general`).join(`,`)).join(`::`)]),q=n(()=>new Map((O??[]).map(e=>[e.id,e])),[O]),Se=n(()=>{if(!V)return[];let e=[...new Set([...K,...(O??[]).map(e=>e.id),...(k??[]).map(e=>e.tabId)])],t=e=>{let t=q.get(e);if(t?.order!==void 0)return t.order;let n=_[e];return n?n.order:50};return e.toSorted((e,n)=>{let r=t(e),i=t(n);return r===i?e.localeCompare(n):r-i})},[V,K,O,q,k]),Ce=n(()=>{let e=new Map,t=e=>_[e]?.label??e.charAt(0).toUpperCase()+e.slice(1);for(let n of K)e.set(n,t(n));for(let n of k??[])e.has(n.tabId)||e.set(n.tabId,t(n.tabId));for(let t of O??[])e.set(t.id,t.label);for(let[t,n]of Object.entries(w??{}))e.set(t,n);return e},[K,O,k,w]),we=M===void 0?ve:M,J=V?we&&Se.includes(we)?we:Se[0]??null:null,Te=e=>{ye(e),N?.(e)},Ee=J!==null&&q.has(J),Y=V?J&&!Ee?J:void 0:T,{data:De}=ne(void 0),Oe=n(()=>{let e=new Map;for(let t of De??[]){let n=t.manifest?.id;if(!n)continue;let r=t.manifest?.name??t.manifest?.packageDisplayName??n;e.set(n,r)}return e},[De]),ke=t(new Map),X=n(()=>{let e=g?new Set(g):null,t=b?new Set(b):null,n=n=>!(e!==null&&!e.has(n)||t!==null&&t.has(n)),r=[];for(let e of W){if(!e.data)continue;e.data.result!==null&&ke.current.set(e.data.addonId,{result:e.data.result,keyTargets:e.data.keyTargets});let t=ke.current.get(e.data.addonId)??null;if(t===null)continue;let{result:i,keyTargets:a}=t,{schema:o,values:s}=ge(i),c={...x===void 0?{}:{fieldKeys:x},...S===void 0?{}:{hideSectionChrome:S},...C===void 0?{}:{tabAliases:C}},l=fe(o.sections.filter(e=>n(e.id)),c);if(l.length===0)continue;let u={...i,sections:fe(i.sections.filter(e=>n(e.id)),c)},d={...o,sections:l};r.push({addonId:e.data.addonId,schemaWithValues:u,schema:d,serverValues:s,keyTargets:a})}return r},[G,g,b,x,S,C]),Ae=n(()=>W.flatMap(e=>c===`global`&&e.data!==void 0&&e.data.result===null&&!ke.current.has(e.data.addonId)?[e.data.addonId]:[]),[G,c]),[Z,je]=s(new Map),Me=r(e=>{je(t=>{let n=new Map(t);return n.set(e.addonId,e),n})},[]),Q=t(new Map),Ne=r(e=>t=>{t?Q.current.set(e,t):Q.current.delete(e)},[]),Pe=r(async(e,t)=>{if(c!==`global`){await R.mutateAsync({addonId:e,deviceId:l,nodeId:H,patch:t});return}let{groups:n,unowned:r}=ue(t,X.find(t=>t.addonId===e)?.keyTargets??{});if(r.length>0)throw Error(`${e}: no scoped setting declares ${r.join(`, `)}`);let i=(await Promise.allSettled(n.map(t=>L.mutateAsync({addonId:e,cap:t.cap,scope:t.scope,...t.scope===`node`?{nodeId:H}:{},patch:t.patch})))).flatMap((e,t)=>{let r=n[t];if(e.status!==`rejected`||r===void 0)return[];let i=e.reason instanceof Error?e.reason.message:String(e.reason);return[`${r.cap}/${r.scope}: ${i}`]});if(i.length>0)throw F.invalidateQueries({queryKey:[[`addonSettings`]]}),Error(`${e}: not saved to ${i.join(`; `)}`)},[c,X,L,R,F,H,l]),Fe=r(async(e,t)=>{await Pe(e,t),F.invalidateQueries({queryKey:[[`addonSettings`]]})},[Pe,F]),Ie=r(async(e,t,n,r)=>{let i=H;try{switch(t){case`reprobe-hwaccel`:await z.mutateAsync({nodeId:i}),F.invalidateQueries({queryKey:[[`addonSettings`]]});return;case`reprobe-audio-engine`:await B.mutateAsync({nodeId:i}),F.invalidateQueries({queryKey:[[`addonSettings`]]});return;default:{let n=await I.addons.custom.mutate({addonId:e,action:t,input:r});return F.invalidateQueries({queryKey:[[`addonSettings`]]}),n}}}catch(n){throw console.error(`[NodeAddonsSettingsPanel] action failed`,{addonId:e,action:t,err:n}),n}},[z,B,H,F,I]),Le=r((e,t)=>{Fe(e,t)},[Fe]),$=m({mutationFn:async()=>{let e=[];for(let t of X){let n=Z.get(t.addonId);!n||n.pendingKeys.length===0||e.push({addonId:t.addonId,patch:n.pendingValues})}return e.length===0?{saved:[]}:{saved:await Promise.all(e.map(async({addonId:e,patch:t})=>(await Pe(e,t),e)))}},onSuccess:({saved:e})=>{for(let t of e)Q.current.get(t)?.discard();F.invalidateQueries({queryKey:[[`addonSettings`]]})}}),Re=r(()=>{for(let e of Q.current.values())e.discard()},[]),ze=n(()=>{let e=0;for(let t of X){let n=Z.get(t.addonId);n&&(e+=n.pendingKeys.length)}return e},[X,Z]),Be=n(()=>{let e=new Map;for(let t of X){let n=Z.get(t.addonId);if(!n||n.pendingKeys.length===0)continue;let r=new Set(n.pendingKeys);for(let n of t.schema.sections){let t=n.tab??`general`;for(let i of n.fields)`key`in i&&r.has(i.key)&&e.set(t,(e.get(t)??0)+1)}}return e},[X,Z]);if(xe)return i(`div`,{className:`h-24 rounded-lg border border-border bg-surface animate-pulse`});let Ve=J&&Ee?q.get(J):void 0,He=Ae.length>0?i(`div`,{className:`space-y-1 text-[11px] text-foreground-subtle`,role:`status`,children:Ae.map(e=>i(`div`,{children:P(`settings.nodeAddonsSettingsPanel.addonUnavailable`,`{{name}} not available.`,{name:Oe.get(e)??e})},e))}):null;if(!V&&X.length===0)return He===null?i(`div`,{className:`text-[11px] text-foreground-subtle italic`,children:D??P(`settings.nodeAddonsSettingsPanel.noAddonsIn`,{scope:o.length>0?`[${o.join(`, `)}]`:P(`settings.nodeAddonsSettingsPanel.theCurrentSelection`,`the current selection`),level:c})}):He;let Ue=$.isPending;return e(`div`,{className:`space-y-4`,children:[(A||j)&&e(`div`,{className:`border-b border-border pb-2`,children:[A&&i(`h2`,{className:`text-sm font-semibold text-foreground`,children:A}),j&&i(`p`,{className:`text-[11px] text-foreground-subtle mt-0.5`,children:j})]}),X.length>0||V?He:null,V&&i(ae,{tabs:Se.map(e=>({id:e,label:Ce.get(e)??e})),activeId:J,onChange:Te,pendingByTab:Be}),U.error!==null&&i(`div`,{role:`alert`,className:`rounded-md border border-danger/40 bg-danger/10 px-3 py-2 text-xs text-danger`,children:P(`settings.nodeAddonsSettingsPanel.providerPagesUnknown`,`Could not check which settings already live on a connection page: {{reason}}`,{reason:U.error})}),$.isError&&e(`div`,{className:`rounded-md border border-red-500/40 bg-red-500/10 px-3 py-2 text-[11px] text-red-400`,children:[P(`settings.nodeAddonsSettingsPanel.saveFailed`,`Save failed:`),` `,String($.error?.message??$.error)]}),i(te,{tabKey:Ve?`extra:${J??``}`:`tab:${J??``}`,children:Ve?Ve.content:(()=>{let t=Y?X.reduce((e,t)=>e+t.schemaWithValues.sections.filter(e=>(e.tab??`general`)===Y).length,0):0,n=!!Y&&t<=1,r=X.map(e=>({...e,renderedWithValues:{...e.schemaWithValues,sections:e.schemaWithValues.sections.filter(e=>Y?(e.tab??`general`)===Y:!0).map(e=>n?{...e,title:``,description:void 0}:e)}})).filter(e=>e.renderedWithValues.sections.length>0).toSorted((e,t)=>{let n=e=>{let t=1/0;for(let n of e)typeof n.order==`number`&&n.order<t&&(t=n.order);return t},r=n(e.renderedWithValues.sections),i=n(t.renderedWithValues.sections);return r===i?0:r-i}),a=(k??[]).filter(e=>e.tabId===Y),o=a.filter(e=>(e.placement??`before`)===`before`),s=a.filter(e=>e.placement===`after`);return r.length===0&&a.length===0?i(`div`,{className:`text-[11px] text-foreground-subtle italic`,children:D??P(`settings.nodeAddonsSettingsPanel.nothingToConfigureHereFor`,`Nothing to configure here for this node.`)}):e(`div`,{className:`space-y-6`,children:[o.map((e,t)=>i(`div`,{children:e.content},`extra-before-${t}`)),r.length>0&&i(_e,{entries:r,paneStates:Z,displayNames:Oe,disabled:Ue,setPaneRef:Ne,onPaneStateChange:Me,onImmediateSave:Le,onAction:Ie,inline:V||!!T}),s.map((e,t)=>i(`div`,{children:e.content},`extra-after-${t}`))]})})()}),!xe&&i(oe,{pendingCount:ze,onSave:()=>$.mutate(),onDiscard:Re,saving:Ue})]})}function _e({entries:t,paneStates:r,displayNames:o,disabled:c,setPaneRef:l,onPaneStateChange:u,onImmediateSave:d,onAction:f,inline:p}){let m=n(()=>[...t].toSorted((e,t)=>{let n=o.get(e.addonId)??e.addonId,r=o.get(t.addonId)??t.addonId;return n.localeCompare(r)}),[t,o]),[h,g]=s(m[0]?.addonId??``);a(()=>{m.length!==0&&(m.find(e=>e.addonId===h)||g(m[0].addonId))},[m,h]);let _=m.find(e=>e.addonId===h)??m[0];if(!_)return null;let v=n(()=>f?(e,t,n,r)=>f(e,t,n,r):void 0,[f]),y=e=>i(C,{ref:l(e.addonId),addonId:e.addonId,schema:e.renderedWithValues,serverValues:e.serverValues,onImmediateSave:d,onStateChange:u,onAction:v,disabled:c},e.addonId);return m.length===1||p?i(`div`,{className:`flex flex-col gap-4`,children:m.map(y)}):e(`div`,{className:`flex flex-col gap-3`,children:[i(`div`,{className:`flex flex-wrap items-center gap-1 border-b border-border shrink-0`,children:m.map(t=>{let n=o.get(t.addonId)??t.addonId,a=t.addonId===_.addonId,s=(r.get(t.addonId)?.pendingKeys.length??0)>0;return e(b,{variant:`unstyled`,type:`button`,onClick:()=>g(t.addonId),className:`relative px-3 py-1.5 text-xs font-medium rounded-t-md transition-colors -mb-px border-b-2 whitespace-nowrap ${a?`text-primary border-primary bg-primary/5`:`text-foreground-subtle border-transparent hover:text-foreground hover:bg-surface-hover`}`,children:[n,s&&i(`span`,{className:`ml-1.5 inline-flex h-1.5 w-1.5 rounded-full bg-amber-400`})]},t.addonId)})}),i(`div`,{className:`space-y-2`,children:m.map(e=>i(`div`,{style:e.addonId===_.addonId?void 0:{display:`none`},children:y(e)},e.addonId))})]})}export{fe as n,B as t};