@camstack/addon-admin-ui 1.2.428 → 1.2.429
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AddonAssetIcon-Cs_blBpK.js → AddonAssetIcon-DR35yt0E.js} +1 -1
- package/dist/assets/Addons-gkGgGpTC.js +4 -0
- package/dist/assets/{AdminPage-DuuyDIsY.js → AdminPage-DAO24U0w.js} +1 -1
- package/dist/assets/AdminSectionedPage-B-qoE6ra.js +1 -0
- package/dist/assets/AiProfiles-BXcreqZP.js +3 -0
- package/dist/assets/BrokerForm-B3xs9aBj.js +1 -0
- package/dist/assets/Build-DeMAJfjN.js +40 -0
- package/dist/assets/Calendars-VPH-vy-o.js +1 -0
- package/dist/assets/Cluster-B-k0M79z.js +1 -0
- package/dist/assets/ClusterStepModel-DaAc_6nI.js +1 -0
- package/dist/assets/CompositionEditor-BrtLjoSu.js +1 -0
- package/dist/assets/{CompositionEditorPage-Acq7iapA.js → CompositionEditorPage-D51jS9td.js} +1 -1
- package/dist/assets/Data-IfJuKcwc.js +2 -0
- package/dist/assets/DeviceDetail-D1qU_p1k.js +2 -0
- package/dist/assets/DeviceDoActionFields-B62Nv4K7.js +1 -0
- package/dist/assets/Devices-Cf5Exjsk.js +1 -0
- package/dist/assets/{EmbedPlayerPage-RXOmf2F3.js → EmbedPlayerPage-CnEcSJ8D.js} +1 -1
- package/dist/assets/Identity-DNE80jdX.js +1 -0
- package/dist/assets/IntegrationDetail-LKbiJFU3.js +1 -0
- package/dist/assets/IntegrationHub-DdjWEObX.js +1 -0
- package/dist/assets/Integrations-CU7Ll9U_.js +1 -0
- package/dist/assets/Integrations-uZB2ozhn.js +1 -0
- package/dist/assets/Library-DSuCaXt6.js +1 -0
- package/dist/assets/Locations-BeaznsZS.js +3 -0
- package/dist/assets/{Logs-DIeXeCqI.js → Logs-cm-1R2Z4.js} +1 -1
- package/dist/assets/MaskShapeCanvas-CM9D4FOf.js +1 -0
- package/dist/assets/MotionZonesSettings-DqS8ndiK.js +1 -0
- package/dist/assets/MyAccess-Dxb11B6h.js +2 -0
- package/dist/assets/Network-BCDUHSB0.js +1 -0
- package/dist/assets/NodeAddonsSettingsPanel-BMat4ckt.js +1 -0
- package/dist/assets/Notifications-EPQiEZ1t.js +1 -0
- package/dist/assets/PrivacyMaskSettings-Bis0PO01.js +1 -0
- package/dist/assets/Recordings-BCeoXxL4.js +1 -0
- package/dist/assets/ScanNetworkModal-dHWFmbFe.js +1 -0
- package/dist/assets/SceneMonitorEditor-SFMMIopn.js +1 -0
- package/dist/assets/SessionsList-BRTwG3uv.js +2 -0
- package/dist/assets/{Showroom-W2yJvb8s.js → Showroom-Er-hes9K.js} +1 -1
- package/dist/assets/System-BDXxfgsq.js +1 -0
- package/dist/assets/{Terminal-CrFum1tE.js → Terminal-B70jnm8e.js} +4 -4
- package/dist/assets/{Viewer-YBzeS3RA.js → Viewer-BsGL5Dfa.js} +1 -1
- package/dist/assets/_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-C7iEnSHU.js +1 -0
- package/dist/assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEHpkaJP.js +1 -0
- package/dist/assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.js-DdJYWyu3.js +1 -0
- package/dist/assets/{_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.js-BsvPG3BX.js → _virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.js-DPkvGqVU.js} +1 -1
- package/dist/assets/{_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-DtoGixA1.js → _virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-Cb2QlpvS.js} +1 -1
- package/dist/assets/{_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_konva__loadShare__.js-PmiLsYEK.js → _virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_konva__loadShare__.js-Cyj0Xie_.js} +4 -4
- package/dist/assets/{addon-icons-context-D6glxUQF.js → addon-icons-context--6Hi3qRW.js} +1 -1
- package/dist/assets/{archive-kvflMCgL.js → archive-DtcjevJM.js} +1 -1
- package/dist/assets/{authed-media-CSlndmzS.js → authed-media-LCmlAEZ5.js} +1 -1
- package/dist/assets/{bell-off-BYnwGeiH.js → bell-off-eQBpwamg.js} +1 -1
- package/dist/assets/board-model-wzCmdEKJ.js +1 -0
- package/dist/assets/{boxes-Dx4USyB3.js → boxes-DikDfAoo.js} +1 -1
- package/dist/assets/circle-slash-YVgGJTpJ.js +1 -0
- package/dist/assets/client-DYbvGOid.js +358 -0
- package/dist/assets/{cloud-upload-82x5w5u8.js → cloud-upload-DI9XunFf.js} +1 -1
- package/dist/assets/crop-CxZbpOyK.js +1 -0
- package/dist/assets/{device-integration-icon-bTnWrYe0.js → device-integration-icon-D2lWVDM2.js} +1 -1
- package/dist/assets/device-picker-model-C4w1vbly.js +1 -0
- package/dist/assets/dist-CPO0KWoy.js +358 -0
- package/dist/assets/dist-ChQzskeX.js +1 -0
- package/dist/assets/{eraser-B8Awx5Sj.js → eraser-Dl5ROV0l.js} +1 -1
- package/dist/assets/{file-up-LqDVgVVa.js → file-up-WS3s_T9x.js} +1 -1
- package/dist/assets/{hard-drive-download-C24D80x2.js → hard-drive-download-B1ard6ym.js} +1 -1
- package/dist/assets/{history-DZsORyBG.js → history-BMhP0SFG.js} +1 -1
- package/dist/assets/{hostInit-D2EmEDvv.js → hostInit-FCvre9AW.js} +1 -1
- package/dist/assets/i18n-Vb3uBp7P.js +1 -0
- package/dist/assets/{icons-D5RaCH1q.js → icons-DocdgFuy.js} +1 -1
- package/dist/assets/index-DKqvG7BE.css +2 -0
- package/dist/assets/index-DvOECbab.js +4 -0
- package/dist/assets/{key-DLwSBrPM.js → key-B1M6i1mf.js} +1 -1
- package/dist/assets/{key-round-CYflkUyd.js → key-round-yCDTbIQb.js} +1 -1
- package/dist/assets/{layers-C1wzFfr1.js → layers-c960YTPf.js} +1 -1
- package/dist/assets/linked-devices-model-CB7qgVjI.js +1 -0
- package/dist/assets/{list-ordered-CFeS9o_w.js → list-ordered-C7hEwAd1.js} +1 -1
- package/dist/assets/location-owned-usage-D28vwYJT.js +1 -0
- package/dist/assets/{log-in-Be_RcxDr.js → log-in-DFfxcqYz.js} +1 -1
- package/dist/assets/{memory-stick-4BwYEagi.js → memory-stick-BBfIGrWx.js} +1 -1
- package/dist/assets/{message-square-plus-D7BNG3h7.js → message-square-plus-D8ZUT6rz.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-9df0d08c.js → mf-entry-bootstrap-0-3035e647.js} +2 -2
- package/dist/assets/{mic-off-e162Bcfu.js → mic-off-w2mFOBi3.js} +1 -1
- package/dist/assets/{monitor-off-CARYfHC4.js → monitor-off-DPi_gm_c.js} +1 -1
- package/dist/assets/{monitor-smartphone-lsNgnRRZ.js → monitor-smartphone-9Ife1Trw.js} +1 -1
- package/dist/assets/mount-C4w1vbly.js +1 -0
- package/dist/assets/notification-schedule-field-BuLfSYLZ.js +1 -0
- package/dist/assets/{octagon-alert-h80nyWRM.js → octagon-alert-C-jH7VH_.js} +1 -1
- package/dist/assets/player-overlays-D0U2dNvn.js +1 -0
- package/dist/assets/{recycle-0MLWppmT.js → recycle-Bbki65G2.js} +1 -1
- package/dist/assets/remoteEntry-DYVoozgD.js +1 -0
- package/dist/assets/{scan-eye-DVK8MF3K.js → scan-eye-AfIM_Dlr.js} +1 -1
- package/dist/assets/{scissors-Cz3GoeOd.js → scissors-CnL6g0BO.js} +1 -1
- package/dist/assets/{search-x-i_A-Upbe.js → search-x-eqJd3G8u.js} +1 -1
- package/dist/assets/{send-B5VKcNUH.js → send-B72RQ9UL.js} +1 -1
- package/dist/assets/{settings-2-ZQsYJ0Zb.js → settings-2-CXZ6DVRg.js} +1 -1
- package/dist/assets/{speaker-Cl8DZGk_.js → speaker-CcCWWecW.js} +1 -1
- package/dist/assets/src-CGxdJN_f.js +67 -0
- package/dist/assets/{timer-reset-A5ofAkBW.js → timer-reset-B9Lihcw9.js} +1 -1
- package/dist/assets/{ungroup-t0yDnzVf.js → ungroup-D753owNE.js} +1 -1
- package/dist/assets/{unlink-C1ZpCxl3.js → unlink-DzoLNfsq.js} +1 -1
- package/dist/assets/{usb-DmUPajSy.js → usb-CuSU-_EY.js} +1 -1
- package/dist/assets/{use-scenes-feed-BQlYhRMq.js → use-scenes-feed-CZjJNxfD.js} +1 -1
- package/dist/assets/{use-stationary-objects-BWM4vE0E.js → use-stationary-objects-BoGqWyLV.js} +1 -1
- package/dist/assets/useEventInvalidation-C4w1vbly.js +1 -0
- package/dist/assets/useNodeUrlSelection-BA6CgjTU.js +1 -0
- package/dist/assets/useTranslation-D3Is_4B6.js +1 -0
- package/dist/assets/user-round-CMg3Ndlt.js +1 -0
- package/dist/assets/{user-x-DRcPeM9C.js → user-x-PK8sSsso.js} +1 -1
- package/dist/assets/{video-tLHyNE3q.js → video-BBtESt54.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DOOXjnRq.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BKfTL-9e.js} +2 -2
- package/dist/index.html +12 -12
- package/dist/server/addon.js +174 -5
- package/package.json +1 -1
- package/dist/assets/Addons-2xWF73cR.js +0 -4
- package/dist/assets/AdminSectionedPage-C3VHg80L.js +0 -1
- package/dist/assets/AiProfiles-DmHcVlS2.js +0 -3
- package/dist/assets/BrokerForm-Dqhjsi3Y.js +0 -1
- package/dist/assets/Build-CBYP1fT5.js +0 -40
- package/dist/assets/Calendars-C926x7b_.js +0 -1
- package/dist/assets/Cluster-OZlA14uV.js +0 -1
- package/dist/assets/ClusterStepModel-DHbwIGAW.js +0 -1
- package/dist/assets/CompositionEditor-vP3JcV2R.js +0 -1
- package/dist/assets/Data-7BoejvKA.js +0 -1
- package/dist/assets/DeviceDetail-ByM0856T.js +0 -2
- package/dist/assets/DeviceDoActionFields-BDJsvRNX.js +0 -1
- package/dist/assets/Devices-PIrWjfhq.js +0 -1
- package/dist/assets/Identity-C-tztwfa.js +0 -1
- package/dist/assets/IntegrationDetail-DugB7cv6.js +0 -1
- package/dist/assets/IntegrationHub-BePMbmC5.js +0 -1
- package/dist/assets/Integrations-Dj3nT9ZT.js +0 -1
- package/dist/assets/Integrations-OH5z-t03.js +0 -1
- package/dist/assets/Library-DDNti2te.js +0 -1
- package/dist/assets/Locations-OL9_NoSi.js +0 -3
- package/dist/assets/MaskShapeCanvas-Dcpby34M.js +0 -1
- package/dist/assets/MotionZonesSettings-CfTOerul.js +0 -1
- package/dist/assets/MyAccess-iJP3JQIS.js +0 -2
- package/dist/assets/Network-DYssxNiN.js +0 -1
- package/dist/assets/NodeAddonsSettingsPanel-mmtEgDbu.js +0 -1
- package/dist/assets/Notifications-DEcxFWp3.js +0 -1
- package/dist/assets/PrivacyMaskSettings-CJUKFEIs.js +0 -1
- package/dist/assets/Recordings-lygSYEJj.js +0 -1
- package/dist/assets/ScanNetworkModal-C2oJlLfj.js +0 -1
- package/dist/assets/SceneMonitorEditor-D1S-D2V9.js +0 -1
- package/dist/assets/SessionsList-CIN4GdSm.js +0 -2
- package/dist/assets/System-ChWpOOqN.js +0 -1
- package/dist/assets/_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-CE2IIKhe.js +0 -1
- package/dist/assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js +0 -1
- package/dist/assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.js-DX7sYWrs.js +0 -1
- package/dist/assets/board-model-Bmts6hrg.js +0 -1
- package/dist/assets/circle-slash-D5mo-8G0.js +0 -1
- package/dist/assets/client-CMlUvfoK.js +0 -358
- package/dist/assets/crop-Dev61hIh.js +0 -1
- package/dist/assets/device-picker-model-DlnG_8P7.js +0 -1
- package/dist/assets/dist--5X8Gy0U.js +0 -1
- package/dist/assets/dist-Dod19ois.js +0 -358
- package/dist/assets/i18n-vggiB6gm.js +0 -1
- package/dist/assets/index-BgQGn3LX.js +0 -4
- package/dist/assets/index-BndCgmxf.css +0 -2
- package/dist/assets/linked-devices-model-CCTQ_gka.js +0 -1
- package/dist/assets/location-owned-usage-DSLiI6RY.js +0 -1
- package/dist/assets/mount-DlnG_8P7.js +0 -1
- package/dist/assets/notification-schedule-field-DWpT_5Vh.js +0 -1
- package/dist/assets/player-overlays-Cda8wso6.js +0 -1
- package/dist/assets/remoteEntry-V_83-NrI.js +0 -1
- package/dist/assets/src-eoSUZcV-.js +0 -67
- package/dist/assets/useEventInvalidation-DlnG_8P7.js +0 -1
- package/dist/assets/useNodeUrlSelection-CTxv9Em7.js +0 -1
- package/dist/assets/useTranslation-Bc5yH9V9.js +0 -1
- package/dist/assets/user-round-BTaID248.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{K as n,Q as r,S as i,W as a,a as o,b as s,q as c,t as l,x as u,z as d}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{Hi as f,Ir as p,It as m,Nt as h,Pn as g,Q as _,Qt as v,Yr as y,ar as b,cr as x,fi as S,nr as C,ot as w,pi as T,pr as E}from"./player-overlays-Cda8wso6.js";import{o as D}from"./video-tLHyNE3q.js";import{t as O}from"./key-round-CYflkUyd.js";import{t as k}from"./monitor-smartphone-lsNgnRRZ.js";import{t as A}from"./unlink-C1ZpCxl3.js";import{Jn as j,Yn as M}from"./client-CMlUvfoK.js";import{Bn as N,Cn as ee,Do as te,Ft as ne,Kl as P,Wn as re,Z as ie,Zn as F,_u as I,ko as ae,wn as oe}from"./src-eoSUZcV-.js";import{t as L}from"./useTranslation-Bc5yH9V9.js";import"./mount-DlnG_8P7.js";import{R,i as z,n as se,r as B,t as V}from"./index-BgQGn3LX.js";import{t as H}from"./AdminPage-DuuyDIsY.js";import{N as U,P as W,_ as G,a as K,g as ce,k as le,r as ue,t as de,v as q}from"./SessionsList-CIN4GdSm.js";r();function fe({value:n,size:r=192}){let{t:a}=L(),[o,s]=c(null),[l,f]=c(null);if(d(()=>{let r=!1;return t(()=>import(`./browser-BHo8W_uH.js`).then(t=>e(t.default,1)).then(async e=>{if(r)return;let t=e.create;if(typeof t!=`function`){f(`qrcode.create() unavailable in installed version`);return}try{let e=t(n,{errorCorrectionLevel:`M`});r||s(e)}catch(e){r||f(e instanceof Error?e.message:`QR generation failed`)}}),__vite__mapDeps([0,1]),import.meta.url).catch(()=>{r||f(`qrcode library not installed`)}),()=>{r=!0}},[n]),l)return u(`div`,{className:`flex items-center justify-center text-[10px] text-foreground-subtle text-center p-4`,style:{width:r,height:r},children:a(`users.totpQrCode.qrRenderingUnavailableUseThe`,`QR rendering unavailable — use the secret below.`)});if(!o)return u(`div`,{className:`flex items-center justify-center text-[10px] text-foreground-subtle animate-pulse`,style:{width:r,height:r},children:a(`users.totpQrCode.generating`,`Generating…`)});let p=o.modules.size,m=r/p,h=[];for(let e=0;e<p;e++)for(let t=0;t<p;t++)o.modules.data[e*p+t]&&h.push(u(`rect`,{x:t*m,y:e*m,width:m,height:m,fill:`currentColor`},`${t}-${e}`));return i(`svg`,{width:r,height:r,viewBox:`0 0 ${r} ${r}`,className:`text-black`,children:[u(`rect`,{x:0,y:0,width:r,height:r,fill:`white`}),h]})}var pe=`${j}/connect`,J={public:0,mesh:1,lan:2,"lan-ipv6":3};function me(e){switch(e.kind){case`public`:return e.interfaceKind===`vpn`?`mesh`:`public`;case`lan-ipv4`:return`lan`;case`lan-ipv6`:return`lan-ipv6`;case`custom`:return`public`;case`loopback`:case`app-link`:return null}}function Y(e){return M(e)}function he(e){return e.startsWith(`https://`)}function ge(e){let t=e.flatMap(e=>{let t=me(e),n=Y(e.baseUrl);return t===null||n===null?[]:[{endpoint:e,tier:t,origin:n}]}).toSorted((e,t)=>J[e.tier]-J[t.tier]||Number(t.endpoint.plausible)-Number(e.endpoint.plausible)||e.endpoint.priority-t.endpoint.priority),n=new Set;return t.flatMap(({endpoint:e,tier:t,origin:r})=>n.has(r)?[]:(n.add(r),[{origin:r,label:e.label,tier:t,secure:he(r),plausible:e.plausible}]))}function _e(e,t,n=null){for(let r of[t,n]){if(r===null)continue;let t=Y(r),n=e.find(e=>e.origin===t);if(n!==void 0)return n}return e[0]??null}function ve(e){let t=new URL(pe);return t.searchParams.set(`hub`,e),t.toString()}r();var ye=176,X={scheme:`https`};function be(){let{t:e}=L(),t=ae(X),n=te(X).data?.roles.publicEndpoint.resolved??null;return i(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[i(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[u(v,{className:`h-3.5 w-3.5 text-foreground-subtle`}),u(`div`,{className:`text-xs font-semibold text-foreground`,children:e(`connectPhone.title`)})]}),i(`div`,{className:`p-4 space-y-3`,children:[u(`p`,{className:`text-[11px] text-foreground-subtle`,children:e(`connectPhone.description`)}),t.isPending?i(`div`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle`,children:[u(b,{className:`h-3.5 w-3.5 animate-spin`}),e(`connectPhone.loading`)]}):t.isError?i(`div`,{className:`flex items-start gap-2 text-[11px] text-danger`,children:[u(h,{className:`h-3.5 w-3.5 mt-0.5 shrink-0`}),i(`div`,{className:`flex-1 min-w-0 space-y-1.5`,children:[u(`div`,{className:`break-words`,children:e(`connectPhone.error`,{message:t.error.message})}),u(N,{size:`sm`,variant:`ghost`,onClick:()=>void t.refetch(),children:e(`connectPhone.retry`)})]})]}):u(xe,{candidates:ge(t.data.endpoints),preferredOrigin:n})]})]})}function xe({candidates:e,preferredOrigin:t}){let{t:n}=L(),[r,o]=c(null),s=_e(e,r,t),l=a(()=>s?ve(s.origin):null,[s]);if(s===null||l===null)return u(`p`,{className:`text-[11px] text-foreground-subtle`,children:n(`connectPhone.empty`)});let d=e=>n(`connectPhone.tier.${e}`),f=e.map(e=>({value:e.origin,label:`${d(e.tier)} — ${e.origin}`}));return i(`div`,{className:`flex flex-col sm:flex-row gap-4`,children:[u(ee,{value:l,size:ye,alt:n(`connectPhone.qrAlt`),className:`self-start`}),i(`div`,{className:`flex-1 min-w-0 space-y-3`,children:[i(`label`,{className:`block space-y-1`,children:[u(`span`,{className:`text-[11px] font-medium text-foreground`,children:n(`connectPhone.addressLabel`)}),u(P,{value:s.origin,options:f,onChange:e=>o(e.target.value)}),i(`span`,{className:`block text-[10px] text-foreground-subtle`,children:[d(s.tier),` · `,s.label]})]}),!s.secure&&u(Z,{text:n(`connectPhone.insecure`)}),!s.plausible&&u(Z,{text:n(`connectPhone.implausible`)}),i(`div`,{className:`space-y-1`,children:[u(`span`,{className:`text-[11px] font-medium text-foreground`,children:n(`connectPhone.linkLabel`)}),i(`div`,{className:`flex items-center gap-1 rounded-md border border-border bg-background px-2 py-1`,children:[u(`code`,{className:`flex-1 min-w-0 font-mono text-[11px] text-foreground break-all select-all`,children:l}),u(ne,{value:l,srLabel:n(`connectPhone.linkLabel`)})]})]}),u(`p`,{className:`text-[11px] text-foreground-subtle`,children:n(`connectPhone.signInHint`)})]})]})}function Z({text:e}){return i(`div`,{className:`flex items-start gap-2 rounded-md border border-warning/30 bg-warning/5 px-2.5 py-1.5 text-[11px] text-foreground`,children:[u(h,{className:`h-3.5 w-3.5 text-warning mt-0.5 shrink-0`}),u(`span`,{children:e})]})}r();function Se(e){return new Date(e).toLocaleDateString()}function Ce(){let{t:e}=L(),t=F(),r=I.useUtils(),a=I.auth.listLinkableProviders.useQuery(),o=I.auth.listOwnExternalIdentities.useQuery(),[s,l]=c(null),[f,p]=c(()=>z(window.location.search)),m=n(null),h=G(`Linking a sign-in account`),g=n(null);d(()=>()=>g.current?.(),[]);let[v,y]=c(null);d(()=>{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 C=I.auth.beginExternalLink.useMutation({onSuccess:({url:e})=>{let t=m.current;if(m.current=null,t===null||t.closed){window.location.assign(e);return}let n=e=>{y(null),p(z(`?${e}`)),r.auth.listOwnExternalIdentities.invalidate()};g.current?.(),g.current=se(t,{onReturn:e=>{e.target===`profile`&&n(e.query)},onDone:e=>{e.target===`profile`&&n(e.query)},onClosed:()=>{g.current?.(),g.current=null,r.auth.listOwnExternalIdentities.invalidate()}}),t.location.href=_(B(e))},onError:e=>{m.current?.close(),m.current=null,y(null),l(e.message)}}),w=I.auth.unlinkOwnExternalIdentity.useMutation({onSuccess:()=>void r.auth.listOwnExternalIdentities.invalidate(),onError:e=>l(e.message)}),E=a.data??[],D=o.data??[],O=v!==null&&D.some(e=>e.provider===v);if(d(()=>{!O||v===null||(y(null),p({kind:`linked`,provider:v}))},[O,v]),E.length===0&&D.length===0)return null;let k=new Set(D.map(e=>e.provider)),j=e=>E.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`})&&(l(null),w.mutate({provider:n.provider,subject:n.subject}))};return i(`div`,{"data-testid":`linked-sign-ins`,className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[h.dialog,i(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[u(x,{className:`h-3.5 w-3.5 text-foreground-subtle`}),u(`div`,{className:`text-xs font-semibold text-foreground`,children:e(`users.linkedSignInsSection.linkedSignInAccounts`,`Linked sign-in accounts`)})]}),i(`div`,{className:`p-4 space-y-3`,children:[u(`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`&&i(`div`,{className:`flex items-center gap-2 rounded-md border border-emerald-500/30 bg-emerald-500/5 px-3 py-2 text-xs text-foreground`,children:[u(S,{className:`h-3.5 w-3.5 text-emerald-500 shrink-0`}),`Linked your `,j(f.provider),` account.`]}),(f?.kind===`error`||s)&&i(`div`,{className:`flex items-center gap-2 rounded-md border border-danger/20 bg-danger/10 px-3 py-2 text-xs text-danger`,children:[u(T,{className:`h-3.5 w-3.5 shrink-0`}),s??(f?.kind===`error`?f.message:``)]}),D.length>0&&u(`ul`,{className:`divide-y divide-border rounded-md border border-border`,children:D.map(t=>{let n=t.providerLabel??t.provider;return i(`li`,{className:`flex items-center gap-3 px-3 py-2 text-xs`,children:[i(`div`,{className:`flex-1 min-w-0`,children:[i(`div`,{className:`font-medium text-foreground truncate`,children:[n,!t.available&&u(`span`,{className:`ml-2 rounded bg-foreground-subtle/15 px-1.5 py-0.5 text-[10px] font-normal text-foreground-subtle`,children:e(`users.linkedSignInsSection.providerUnavailable`,`provider unavailable`)})]}),i(`div`,{className:`text-[11px] text-foreground-subtle truncate`,children:[t.label??t.subject,` · linked `,Se(t.linkedAt)]})]}),i(`button`,{onClick:()=>void M(t,n),disabled:w.isPending,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] text-danger hover:bg-danger/10 disabled:opacity-50`,children:[u(A,{className:`h-3 w-3`}),e(`users.linkedSignInsSection.unlink`,`Unlink`)]})]},`${t.provider}|${t.subject}`)})}),u(`div`,{className:`flex flex-wrap gap-2`,children:E.filter(e=>!k.has(e.provider)).map(e=>i(`button`,{onClick:()=>{l(null),p(null),h.requestProof().then(t=>{t!==null&&(m.current=V(null),y(m.current===null?null:e.provider),C.mutate({provider:e.provider,reauthToken:t}))})},disabled:C.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:[C.isPending&&C.variables?.provider===e.provider?u(b,{className:`h-3 w-3 animate-spin`}):u(x,{className:`h-3 w-3`}),`Link `,e.label]},e.provider))})]})]})}r();function Q(e){return e.message.length>0?e.message:`Request failed`}function we(){let{t:e}=L(),{logout:t}=R(),n=F(),r=I.useUtils(),a=I.auth.listOwnSessions.useQuery(),[o,s]=c(null),l=I.auth.revokeOwnSession.useMutation({onSuccess:()=>void r.auth.listOwnSessions.invalidate(),onError:e=>s(`Sign out failed: ${Q(e)}`)}),d=I.auth.logout.useMutation({onSuccess:()=>t(),onError:e=>s(`Sign out failed: ${Q(e)}`)}),f=async t=>{await n({title:e(`auth.mySessionsSection.signOutThisSession`,`Sign out this session`),message:e(`auth.mySessionsSection.willHaveToSignIn`,`{{label}} will have to sign in again.`,{label:q(t.client).label}),confirmLabel:e(`auth.mySessionsSection.signOut`,`Sign out`),variant:`danger`})&&(s(null),l.mutate({id:t.id}))},p=async()=>{await n({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`})&&(s(null),d.mutate({everywhere:!0}))};return i(`div`,{"data-testid":`my-sessions`,className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[i(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[u(k,{className:`h-3.5 w-3.5 text-foreground-subtle`}),u(`div`,{className:`text-xs font-semibold text-foreground`,children:e(`auth.mySessionsSection.activeSessions`,`Active sessions`)})]}),i(`div`,{className:`p-4 space-y-3`,children:[u(`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.`)}),o!==null&&u(`div`,{className:`text-[11px] text-danger`,children:o}),u(de,{sessions:a.data??[],isLoading:a.isLoading,loadError:a.isError?a.error?.message??`Request failed`:null,emptyText:`No active sessions.`,onRevoke:e=>void f(e),revokingId:l.isPending?l.variables?.id??null:null}),u(`div`,{className:`flex justify-end`,children:i(`button`,{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?u(b,{className:`h-3 w-3 animate-spin`}):u(D,{className:`h-3 w-3`}),e(`auth.mySessionsSection.signOutEverywhere`,`Sign out everywhere`)]})})]})]})}r();var Te=`You`;function Ee(){let{t:e}=L(),t=F(),n=I.useUtils(),r=I.auth.listOwnDeviceCredentials.useQuery(),[i,o]=c(null),s=I.auth.revokeOwnDeviceCredential.useMutation({onSuccess:e=>{e.revoked||o(`That device could not be revoked - it may already be gone.`),n.auth.listOwnDeviceCredentials.invalidate()},onError:e=>o(`Revoke failed: ${e.message}`)}),l=a(()=>(r.data??[]).map(e=>ue(e,Te)),[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`})&&(o(null),s.mutate({id:n.id}))},p={label:e(`certificates.myDevicesSection.revoke2`,`Revoke`),icon:f,isAvailable:K,onRun:e=>void d(e),busyId:s.isPending?s.variables?.id??null:null,disabled:s.isPending};return u(U,{id:`my-devices`,title:e(`certificates.myDevicesSection.myDevices`,`My devices`),icon:v,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:W(i),onDismissNotice:()=>o(null),children:u(le,{rows:l,label:`devices`,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:p})})}r();var De={view:{icon:p,cls:`bg-foreground-subtle/15 text-foreground-subtle`},create:{icon:g,cls:`bg-primary/15 text-primary`},delete:{icon:m,cls:`bg-danger/15 text-danger`}};function Oe(){let{t:e}=L(),{user:t,logout:n}=R();if(!t)return u(H,{children:u(`div`,{className:`text-xs text-foreground-subtle`,children:e(`systemPage.myAccess.notSignedIn`,`Not signed in.`)})});let r=t.isAdmin,a=t.scopes??[];return i(H,{children:[i(`div`,{className:`rounded-lg border border-border bg-surface px-4 py-3 flex items-center gap-3`,children:[u(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-full bg-primary/10 text-primary font-semibold text-base`,children:t.username.slice(0,1).toUpperCase()}),i(`div`,{className:`flex-1 min-w-0`,children:[u(`div`,{className:`text-sm font-semibold text-foreground truncate`,children:t.username}),i(`div`,{className:`text-[11px] text-foreground-subtle`,children:[r?e(`systemPage.myAccess.administrator`,`Administrator`):e(`systemPage.myAccess.user`,`User`),` `,`· session id `,i(`span`,{className:`font-mono`,children:[t.id.slice(0,8),`…`]})]})]})]}),r&&i(`div`,{className:`rounded-lg border border-primary/30 bg-primary/5 px-4 py-3 text-xs text-foreground flex items-start gap-2.5`,children:[u(E,{className:`h-4 w-4 text-primary mt-0.5 shrink-0`}),i(`div`,{children:[u(`div`,{className:`font-semibold text-foreground`,children:e(`systemPage.myAccess.unrestrictedAccess`,`Unrestricted access`)}),u(`p`,{className:`text-foreground-subtle mt-0.5`,children:e(`systemPage.myAccess.adminSessionsBypassThePer`,`Admin sessions bypass the per-call scope check. Every protected endpoint is reachable regardless of the list below.`)})]})]}),u(ke,{}),u(Ae,{username:t.username}),u(je,{}),u(Ce,{}),u(ce,{}),u(we,{}),u(Ee,{}),u(be,{}),a.length>0&&i(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[i(`div`,{className:`px-4 py-2 border-b border-border`,children:[u(`div`,{className:`text-xs font-semibold text-foreground`,children:e(`systemPage.myAccess.grantedScopes`,`Granted scopes`)}),u(`div`,{className:`text-[10px] text-foreground-subtle`,children:e(`systemPage.myAccess.bakedIntoYourSessionToken`,`Baked into your session token at login; sign out + back in to refresh after changes.`)})]}),i(`div`,{className:`grid grid-cols-[100px_1fr_240px] gap-3 px-4 py-2 text-[10px] uppercase tracking-wide text-foreground-subtle border-b border-border`,children:[u(`div`,{children:e(`systemPage.myAccess.type`,`Type`)}),u(`div`,{children:e(`systemPage.myAccess.target`,`Target`)}),u(`div`,{children:e(`systemPage.myAccess.access`,`Access`)})]}),u(`ul`,{className:`divide-y divide-border`,children:a.map((t,n)=>i(`li`,{className:`grid grid-cols-[100px_1fr_240px] gap-3 px-4 py-2.5 items-center text-xs`,children:[u(`span`,{className:`font-mono text-foreground-subtle`,children:t.type}),u(`span`,{className:`font-mono text-foreground`,children:t.type===`device`?ie(t.selector):t.target}),u(`div`,{className:`flex items-center gap-1`,children:[`view`,`create`,`delete`].map(n=>{let r=t.access.includes(n),{icon:a,cls:o}=De[n];return i(`span`,{className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium ${r?o:`bg-transparent text-foreground-subtle/40 line-through`}`,title:r?e(`systemPage.myAccess.can`,`Can {{a}}`,{a:n}):e(`systemPage.myAccess.cannot`,`Cannot {{a}}`,{a:n}),children:[u(a,{className:`h-3 w-3`}),n]},n)})})]},n))})]}),u(`div`,{className:`flex justify-end`,children:i(`button`,{onClick:n,className:`inline-flex items-center gap-1.5 rounded border border-border px-2.5 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-foreground-subtle/10 hover:text-foreground transition-colors`,children:[u(D,{className:`h-3 w-3`}),e(`systemPage.myAccess.signOut`,`Sign out`)]})})]})}function ke(){let{t:e}=L(),t=w(),[n,r]=c(``),[a,o]=c(``),[s,d]=c(``),[f,p]=c(null),m=l({mutationFn:e=>t.changeOwnPassword(e),onSuccess:()=>{p({kind:`success`,msg:`Password updated.`}),r(``),o(``),d(``)},onError:e=>{p({kind:`error`,msg:e instanceof Error?e.message:`Update failed`})}}),h=a.length>0&&s.length>0&&a!==s,g=a.length>0&&a.length<8,_=n.length>=1&&a.length>=8&&a===s;return i(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[i(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[u(O,{className:`h-3.5 w-3.5 text-foreground-subtle`}),u(`div`,{className:`text-xs font-semibold text-foreground`,children:e(`systemPage.myAccess.changePassword`,`Change password`)})]}),i(`div`,{className:`p-4 space-y-3`,children:[u($,{label:e(`systemPage.myAccess.currentPassword`,`Current password`),value:n,onChange:r,autoComplete:`current-password`}),u($,{label:e(`systemPage.myAccess.newPassword`,`New password`),value:a,onChange:o,autoComplete:`new-password`,hint:e(`systemPage.myAccess.atLeast8Characters`,`At least 8 characters.`)}),u($,{label:e(`systemPage.myAccess.confirmNewPassword`,`Confirm new password`),value:s,onChange:d,autoComplete:`new-password`}),(h||g)&&u(`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&&i(`div`,{className:`text-[11px] flex items-center gap-1 ${f.kind===`success`?`text-emerald-500`:`text-danger`}`,children:[f.kind===`success`?u(S,{className:`h-3 w-3`}):u(T,{className:`h-3 w-3`}),f.msg]}),u(`div`,{className:`flex justify-end`,children:i(`button`,{onClick:()=>{p(null),m.mutate({currentPassword:n,newPassword:a})},disabled:!_||m.isPending,className:`inline-flex items-center gap-1 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:[m.isPending?u(b,{className:`h-3 w-3 animate-spin`}):u(C,{className:`h-3 w-3`}),e(`systemPage.myAccess.updatePassword`,`Update password`)]})})]})]})}function $({label:e,value:t,onChange:n,autoComplete:r,hint:a}){return i(`div`,{className:`space-y-1`,children:[u(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:e}),u(`input`,{type:`password`,value:t,onChange:e=>n(e.target.value),autoComplete:r,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`}),a&&u(`div`,{className:`text-[10px] text-foreground-subtle`,children:a})]})}function Ae({username:e}){let{t}=L(),n=w(),r=o({queryKey:[`auth`,`getOwnTotpStatus`],queryFn:()=>n.getOwnTotpStatus()}),f=r.data,[p,m]=c(null),[h,g]=c(``),[_,x]=c(null),[C,E]=c(!1),D=l({mutationFn:()=>n.setupOwnTotp(),onSuccess:e=>{m({secret:e.secret,otpauthUrl:e.otpauthUrl}),g(``),x(null)},onError:e=>x(e instanceof Error?e.message:`Setup failed`)}),O=l({mutationFn:e=>n.confirmOwnTotp(e),onSuccess:()=>{m(null),g(``),x(null),r.refetch()},onError:e=>x(e instanceof Error?e.message:`Confirmation failed — code did not match`)}),k=G(`Turning off two-factor authentication`),A=l({mutationFn:async()=>{let e=await k.requestProof();return e===null?null:n.disableOwnTotp({reauthToken:e})},onSuccess:()=>{x(null),r.refetch()},onError:e=>x(e instanceof Error?e.message:`Disable failed`)});d(()=>{if(!C)return;let e=setTimeout(()=>E(!1),1500);return()=>clearTimeout(e)},[C]);let j=a(()=>r.isLoading?`loading`:p?`setup_in_progress`:f?.enabled?`enrolled`:`not_enrolled`,[r.isLoading,f?.enabled,p]);return i(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[k.dialog,i(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[u(v,{className:`h-3.5 w-3.5 text-foreground-subtle`}),u(`div`,{className:`text-xs font-semibold text-foreground`,children:t(`systemPage.myAccess.twoFactorAuthentication`,`Two-factor authentication`)})]}),i(`div`,{className:`p-4 space-y-3`,children:[j===`loading`&&i(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[u(b,{className:`h-3.5 w-3.5 animate-spin`}),t(`systemPage.myAccess.checkingStatus`,`Checking status…`)]}),j===`not_enrolled`&&i(s,{children:[u(`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.`)}),u(`div`,{className:`flex justify-end`,children:i(`button`,{onClick:()=>{x(null),D.mutate()},disabled:D.isPending,className:`inline-flex items-center gap-1 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:[D.isPending?u(b,{className:`h-3 w-3 animate-spin`}):u(v,{className:`h-3 w-3`}),t(`systemPage.myAccess.enable2fa`,`Enable 2FA`)]})})]}),j===`setup_in_progress`&&p&&i(s,{children:[i(`div`,{className:`text-[11px] text-foreground-subtle`,children:[`Scan the QR code (or enter the secret manually) into your authenticator app for`,` `,u(`span`,{className:`font-mono`,children:e}),`, then enter the 6-digit code below to confirm.`]}),i(`div`,{className:`flex flex-col items-center gap-3`,children:[u(`div`,{className:`rounded-lg border border-border bg-white p-3`,children:u(fe,{value:p.otpauthUrl,size:180})}),i(`div`,{className:`w-full`,children:[u(`div`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle mb-1`,children:t(`systemPage.myAccess.secretManualEntry`,`Secret (manual entry)`)}),i(`div`,{className:`flex items-center gap-2 rounded border border-border bg-surface-hover/30 px-2 py-1.5`,children:[u(`code`,{className:`text-[11px] font-mono text-foreground break-all flex-1`,children:p.secret}),i(`button`,{onClick:()=>{p&&navigator.clipboard.writeText(p.secret).then(()=>E(!0))},className:`inline-flex items-center gap-1 text-[10px] text-foreground-subtle hover:text-foreground`,children:[C?u(S,{className:`h-3 w-3 text-emerald-500`}):u(y,{className:`h-3 w-3`}),C?t(`systemPage.myAccess.copied`,`Copied`):t(`common.copy`,`Copy`)]})]})]})]}),i(`div`,{className:`space-y-1`,children:[u(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`6-digit code`}),u(`input`,{type:`text`,inputMode:`numeric`,autoComplete:`one-time-code`,placeholder:`123456`,value:h,onChange:e=>g(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`})]}),_&&i(`div`,{className:`text-[11px] text-danger flex items-center gap-1`,children:[u(T,{className:`h-3 w-3`}),_]}),i(`div`,{className:`flex justify-end gap-2`,children:[u(`button`,{onClick:()=>{m(null),x(null),g(``)},className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:t(`common.cancel`,`Cancel`)}),i(`button`,{onClick:()=>{x(null),O.mutate({code:h})},disabled:O.isPending||h.length!==6,className:`inline-flex items-center gap-1 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:[O.isPending?u(b,{className:`h-3 w-3 animate-spin`}):u(S,{className:`h-3 w-3`}),t(`common.confirm`,`Confirm`)]})]})]}),j===`enrolled`&&f&&i(s,{children:[i(`div`,{className:`rounded-md border border-emerald-500/30 bg-emerald-500/5 px-3 py-2.5 flex items-start gap-2.5`,children:[u(S,{className:`h-4 w-4 mt-0.5 text-emerald-500 shrink-0`}),i(`div`,{className:`text-xs text-foreground space-y-0.5`,children:[u(`div`,{className:`font-medium`,children:t(`systemPage.myAccess.2faIsActive`,`2FA is active`)}),i(`div`,{className:`text-foreground-subtle`,children:[`Enrolled on`,` `,f.confirmedAt?new Date(f.confirmedAt).toLocaleString():`—`]})]})]}),_&&i(`div`,{className:`text-[11px] text-danger flex items-center gap-1`,children:[u(T,{className:`h-3 w-3`}),_]}),u(`div`,{className:`flex justify-end`,children:i(`button`,{onClick:()=>{x(null),A.mutate()},disabled:A.isPending,className:`rounded bg-danger px-3 py-1.5 text-xs font-medium text-white hover:bg-danger/90 disabled:opacity-50 inline-flex items-center gap-1`,children:[A.isPending?u(b,{className:`h-3 w-3 animate-spin`}):u(v,{className:`h-3 w-3`}),t(`systemPage.myAccess.disable2fa`,`Disable 2FA`)]})})]})]})]})}function je(){return re(`auth-webauthn/passkey-enrollment`)?u(oe,{widgetId:`auth-webauthn/passkey-enrollment`,host:`dashboard`}):null}export{Oe as MyAccessPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as e,K as t,Q as n,S as r,W as i,b as a,o,q as s,x as c,z as l}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{D as u,It as d,Jt as f,L as p,Nt as m,On as h,Rn as g,Rr as _,Xt as v,Yr as y,Z as b,an as x,ar as S,bi as C,dt as w,ht as T,in as E,kn as D,mn as ee,nr as te,ot as ne,un as O,vn as re,yn as ie}from"./player-overlays-Cda8wso6.js";import{t as k}from"./boxes-Dx4USyB3.js";import{c as A,o as ae}from"./video-tLHyNE3q.js";import{t as oe}from"./file-up-LqDVgVVa.js";import{t as se}from"./log-in-Be_RcxDr.js";import{Kn as ce,Un as le,_n as ue,qn as de}from"./client-CMlUvfoK.js";import{Ao as fe,Bn as j,Bo as pe,Bt as me,Do as he,Dr as M,Eo as ge,Er as _e,Fo as ve,Ho as ye,Ht as be,Io as xe,It as Se,Jo as Ce,Kl as we,Ko as Te,Ln as N,Lo as Ee,Mo as De,No as Oe,Oo as ke,Pn as Ae,Po as je,Ro as Me,Rt as Ne,Tl as Pe,Uo as Fe,Vo as Ie,Vt as P,Zl as Le,an as Re,ar as F,jo as ze,ma as Be,qo as Ve,zo as He}from"./src-eoSUZcV-.js";import{t as I}from"./useTranslation-Bc5yH9V9.js";import"./mount-DlnG_8P7.js";import{C as Ue,c as L,s as R}from"./index-BgQGn3LX.js";import{t as We}from"./AdminSectionedPage-C3VHg80L.js";import{t as z}from"./AdminPage-DuuyDIsY.js";import{t as Ge}from"./NodeAddonsSettingsPanel-mmtEgDbu.js";import{n as B,r as Ke,t as V}from"./IntegrationHub-BePMbmC5.js";import{n as H,t as U}from"./addon-display-names-BkwMrExv.js";n();var W=5e3,G=`network-access`,qe={connected:!1,endpoint:null};function Je(){let{t:e}=I(),t=o(),n=M({capName:`network-access`},{refetchInterval:W}),r=_e(void 0,{refetchInterval:W}),a=i(()=>U(r.data??[]),[r.data]),l=i(()=>(n.data??[]).map(e=>({addonId:e.addonId,displayName:a.get(e.addonId)??e.addonId,isActive:e.isActive})),[n.data,a]),[u,d]=s(null),[f,p]=s({}),m=(e,n)=>{let r=n?.addonId;t.invalidateQueries({queryKey:[[`networkAccess`,`getStatus`],{input:{addonId:r},type:`query`}]}),d(null),p(e=>{if(r===void 0||!(r in e))return e;let t={...e};return delete t[r],t})},h=(e,t)=>{d(null);let n=t?.addonId;if(n===void 0)return;let r=e instanceof Error?e.message:String(e);p(e=>({...e,[n]:r}))},g=Ve({onSuccess:m,onError:h}),_=Ce({onSuccess:m,onError:h}),v=[{id:G,label:e(`system.remoteAccess.remoteAccess`,`Remote access`),install:{capability:G,label:e(`system.remoteAccess.addTunnel`,`Add tunnel`)},entries:l.map(e=>({id:e.addonId,name:e.displayName,fallbackIcon:A,...H(e.isActive),render:()=>c(B,{addonId:e.addonId,displayName:e.displayName,capName:G,isActive:e.isActive,badges:c(Xe,{addonId:e.addonId}),error:f[e.addonId]??null,primaryAction:c(Ze,{addonId:e.addonId,busyId:u,onStart:e=>{d(e),g.mutate({addonId:e})},onStop:e=>{d(e),_.mutate({addonId:e})}})})}))}];return c(V,{embedded:!0,icon:A,title:e(`system.remoteAccess.remoteAccess2`,`Remote Access`),subtitle:e(`system.remoteAccess.publicFacingTunnelsThatExpose`,`Public-facing tunnels that expose this hub to the internet (Cloudflare Tunnel, ngrok, …).`),groups:v,isLoading:n.isLoading,emptyTitle:e(`system.remoteAccess.noRemoteAccessProvidersInstalled`,`No remote-access providers installed`),emptyDescription:e(`system.remoteAccess.installATunnelAddonE`,`Install a tunnel addon (e.g. @camstack/addon-cloudflare) to expose this hub publicly.`)})}function Ye(e){let{data:t}=Te({addonId:e},{refetchInterval:W,retry:!1}),n=t?le.safeParse(t):null;return n?.success?n.data:qe}function Xe({addonId:e}){let{t}=I(),n=Ye(e);return r(a,{children:[c(F,{variant:n.connected?`success`:`default`,className:Ke,children:n.connected?t(`system.remoteAccess.connected`,`Connected`):t(`system.remoteAccess.disconnected`,`Disconnected`)}),n.endpoint&&r(`a`,{href:n.endpoint.url,target:`_blank`,rel:`noopener noreferrer`,className:`flex min-w-0 items-center gap-1 break-all text-[11px] text-success hover:underline`,children:[c(_,{className:`h-3 w-3`}),n.endpoint.url]})]})}function Ze({addonId:e,busyId:t,onStart:n,onStop:i}){let{t:a}=I(),o=Ye(e),s=t===e;return o.connected?r(j,{size:`sm`,variant:`secondary`,disabled:s,onClick:()=>i(e),children:[s?c(S,{className:`h-3 w-3 animate-spin`}):c(f,{className:`h-3 w-3`}),a(`system.remoteAccess.stop`,`Stop`)]}):r(j,{size:`sm`,variant:`primary`,disabled:s,onClick:()=>n(e),children:[s?c(S,{className:`h-3 w-3 animate-spin`}):c(D,{className:`h-3 w-3`}),a(`system.remoteAccess.start`,`Start`)]})}n();var Qe=3e4,K=`turn-provider`;function $e(e){let t=[];for(let n of e)typeof n.urls==`string`?t.push(n.urls):t.push(...n.urls);return t}function et(){let{t:e}=I(),t=M({capName:`turn-provider`},{refetchInterval:Qe}),n=_e(void 0,{refetchInterval:Qe}),a=Pe(),o=a.data??[],s=i(()=>U(n.data??[]),[n.data]),l=i(()=>(t.data??[]).map(e=>({addonId:e.addonId,displayName:s.get(e.addonId)??e.addonId,isActive:e.isActive})),[t.data,s]),d=[{id:K,label:e(`system.turnServers.turnProviders`,`TURN providers`),install:{capability:K,label:e(`system.turnServers.addProvider`,`Add provider`)},entries:l.map(t=>({id:t.addonId,name:t.displayName,fallbackIcon:g,...H(t.isActive),render:()=>c(B,{addonId:t.addonId,displayName:t.displayName,capName:K,isActive:t.isActive,panels:[{id:`ice-servers`,title:e(`system.turnServers.discoveredIceServers`,`Discovered ICE servers`),icon:g,content:c(tt,{addonId:t.addonId,enabled:t.isActive})}]})}))}];return c(V,{embedded:!0,icon:g,title:e(`system.turnServers.turnServers`,`TURN Servers`),subtitle:e(`system.turnServers.iceServersUsedForWebrtc`,`ICE servers used for WebRTC NAT traversal. Multiple providers can coexist — the WebRTC layer concatenates servers from all enabled providers per session.`),groups:d,isLoading:t.isLoading,emptyTitle:e(`system.turnServers.noTurnProvidersInstalled`,`No TURN providers installed`),emptyDescription:e(`system.turnServers.installATurnAddonE`,`Install a TURN addon (e.g. @camstack/addon-cloudflare) to enable WebRTC behind restrictive NATs.`),trailing:c(P,{headingId:`turn-combined-ice`,title:e(`system.turnServers.combinedIceServerListAll`,`Combined ICE server list — all enabled providers`),icon:g,actions:c(j,{size:`sm`,variant:`secondary`,onClick:()=>a.refetch(),disabled:a.isFetching,children:e(`common.refresh`,`Refresh`)}),children:c(`div`,{className:u,children:o.length===0?c(`div`,{className:`text-xs text-foreground-subtle`,children:e(`system.turnServers.noServersFromEnabledProviders`,`No servers from enabled providers.`)}):c(`div`,{className:`flex flex-col gap-3`,children:o.map((e,t)=>{let n=Array.isArray(e.urls)?e.urls:[e.urls];return r(`div`,{className:`rounded border border-border bg-surface`,children:[(e.username||e.credential)&&r(`div`,{className:`px-3 py-1.5 border-b border-border text-[10px] font-mono text-foreground-subtle flex items-center gap-3`,children:[e.username&&r(`span`,{children:[c(`span`,{className:`text-foreground-subtle`,children:`user:`}),` `,c(`span`,{className:`text-foreground`,children:e.username})]}),e.credential&&r(`span`,{children:[c(`span`,{className:`text-foreground-subtle`,children:`credential:`}),` `,c(`span`,{className:`text-foreground`,children:`••••••••`})]})]}),c(`ul`,{className:`divide-y divide-border`,children:n.map(e=>c(`li`,{className:`px-3 py-1.5 font-mono text-xs text-foreground break-all`,children:e},e))})]},t)})})})})})}function tt({addonId:e,enabled:t}){let n=Pe({addonId:e},{enabled:t,retry:!1}),r=i(()=>$e(n.data??[]),[n.data]),a=t?n.isLoading?`Loading…`:r.length===0?`This provider returned no servers.`:null:`Disabled — enable the provider to fetch its servers.`;return c(`div`,{className:`rounded-lg border border-border bg-surface p-2 sm:p-3`,children:a===null?c(`div`,{className:`flex flex-wrap gap-1`,children:r.map(e=>c(`span`,{className:`inline-block break-all rounded bg-foreground-subtle/10 px-1.5 py-0.5 font-mono text-[10px] text-foreground`,children:e},e))}):c(`div`,{className:`text-xs text-foreground-subtle`,children:a})})}n();var nt={lan:g,wifi:T,docker:k,vpn:te,loopback:O,other:O},rt={lan:`LAN`,wifi:`Wi-Fi`,docker:`Docker`,vpn:`VPN`,loopback:`Loopback`,other:`Other`},it=[`lan`,`wifi`,`vpn`,`docker`,`other`,`loopback`];function at(e){let{t}=I(),{interfaces:n,disabled:a,hideLoopback:o,ipv4Only:s,emptyMessage:l}=e,u=i(()=>n.filter(e=>!(o&&e.kind===`loopback`||s&&e.family!==`IPv4`)),[n,o,s]),d=i(()=>{let e=new Map;for(let t of u){let n=e.get(t.kind)??[];n.push(t),e.set(t.kind,n)}return it.filter(t=>e.has(t)).map(t=>({kind:t,items:e.get(t)}))},[u]),f=t=>e.mode===`single`?e.value===t:e.value.includes(t),p=t=>{if(a||t.kind===`loopback`)return;if(e.mode===`single`){e.onChange(e.value===t.address?null:t.address);return}let n=new Set(e.value);n.has(t.address)?n.delete(t.address):n.add(t.address),e.onChange([...n])};return u.length===0?c(`div`,{className:`text-xs text-foreground-subtle italic`,children:l??t(`shared.addressSelector.noAddressesAvailable`,`No addresses available.`)}):c(`div`,{className:`flex flex-col gap-3`,children:d.map(({kind:n,items:i})=>r(`div`,{className:`rounded-md border border-border overflow-hidden`,children:[r(`div`,{className:`flex items-center gap-2 px-3 py-1.5 bg-surface-hover/30 border-b border-border`,children:[c(nt[n]??O,{className:`h-3.5 w-3.5 text-foreground-subtle`}),c(`span`,{className:`text-[11px] font-semibold uppercase tracking-wide text-foreground-subtle`,children:rt[n]??n}),r(`span`,{className:`text-[10px] text-foreground-subtle`,children:[`· `,i.length]})]}),c(`ul`,{className:`divide-y divide-border`,children:i.map(n=>{let i=f(n.address),o=n.kind===`loopback`,s=!n.plausible&&!o;return r(`li`,{className:`flex items-center gap-3 px-3 py-2 ${o?`opacity-60 cursor-not-allowed`:a?`opacity-60`:s?`cursor-pointer hover:bg-surface-hover/30 bg-amber-500/[0.04]`:`cursor-pointer hover:bg-surface-hover/30`}`,onClick:()=>p(n),children:[c(`span`,{className:`flex items-center justify-center h-4 w-4 rounded ${e.mode===`single`?`rounded-full`:`rounded`} border ${i?`border-primary bg-primary text-primary-foreground`:`border-border bg-surface`}`,children:i&&c(C,{className:`h-3 w-3`})}),r(`div`,{className:`flex-1 min-w-0 ${s?`text-foreground-subtle`:``}`,children:[r(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[c(`span`,{className:`font-mono text-xs font-semibold ${s?`text-foreground-subtle`:`text-foreground`}`,children:n.name}),c(`span`,{className:`text-[10px] rounded px-1.5 py-0.5 bg-foreground-subtle/10 text-foreground-subtle font-mono`,children:n.family}),n.preferred&&c(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium bg-primary/15 text-primary`,children:t(`shared.addressSelector.autoPreferred`,`Auto-preferred`)}),o&&c(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium bg-foreground-subtle/15 text-foreground-subtle`,children:t(`shared.addressSelector.alwaysIncluded`,`Always included`)}),s&&r(`span`,{className:`inline-flex items-center gap-1 text-[10px] rounded-full px-2 py-0.5 font-medium bg-amber-500/15 text-amber-700 dark:text-amber-300`,title:n.plausibleReason||void 0,children:[c(m,{className:`h-2.5 w-2.5`}),t(`shared.addressSelector.unlikelyUsable`,`Unlikely usable`)]})]}),r(`div`,{className:`text-xs text-foreground-subtle mt-0.5 font-mono break-all`,children:[n.address,n.cidr&&n.cidr!==n.address?` (${n.cidr})`:``]})]})]},`${n.name}-${n.family}-${n.address}`)})})]},n))})}var q=[{role:`appConnections`,title:`App connections`,single:!1,help:`Addresses the CamStack apps try when connecting; tick several. Automatic: LAN addresses plus your public tunnel. Each LAN address also has an HTTPS row (the hub's secure port): a phone that trusts the hub's local certificate uses it, any other skips it — untick it to stop offering it.`},{role:`notificationTaps`,title:`Notification taps`,single:!0,help:`Only where tapping a notification opens; one address. Automatic: the CamStack app link (opens the app if installed, otherwise the web app).`},{role:`publicEndpoint`,title:`Public endpoint`,single:!0,help:`Every link that must work away from home: sign-in, single sign-on and account linking, passkeys, and the buttons, attachments and admin links in notifications; one address. Automatic: your public tunnel, then Tailscale, then the LAN. Changing it invalidates registered passkeys.`},{role:`internal`,title:`Internal`,single:!0,help:`Where other CamStack machines and LAN devices download addons, models and media from; one address. Automatic: the hub's LAN address.`}],ot=`A role with nothing ticked is automatic. Add a custom address when the hub is reached at an address it cannot see itself (NAT, reverse proxy, VPN, Docker bridge).`;function J(e,t){return e.inUse.includes(t)}function st(e,t){if(!e.eligible.includes(t))return{kind:`none`};if(e.kind===`app-link`)return J(e,t)?{kind:`none`}:{kind:`set`,input:{role:t,baseUrl:null,enabled:!0}};if(e.flags.includes(t)||t===`appConnections`&&J(e,t))return{kind:`set`,input:{role:t,baseUrl:e.baseUrl,enabled:!1}};let n={role:t,baseUrl:e.baseUrl,enabled:!0};return t===`publicEndpoint`&&e.baseUrl.startsWith(`http:`)?{kind:`confirm-http`,input:n,reason:ce}:{kind:`set`,input:n}}function ct(e){return q.map(({role:t,title:n})=>{if(t===`appConnections`){let r=e.roles.appConnections;return{role:t,title:n,inUse:r.resolved.length===0?`nothing reachable`:r.resolved.join(`, `),automatic:r.source!==`flagged`}}let r=e.roles[t];return{role:t,title:n,inUse:r.resolved===null?`nothing reachable`:t===`notificationTaps`&&r.source===`auto`?`CamStack app link`:r.resolved,automatic:r.source!==`flagged`}})}n();var lt={"lan-ipv4":{label:`IPv4`,className:`bg-emerald-500/15 text-emerald-700 dark:text-emerald-300`},"lan-ipv6":{label:`IPv6`,className:`bg-violet-500/15 text-violet-700 dark:text-violet-300`},public:{label:`Public`,className:`bg-blue-500/15 text-blue-700 dark:text-blue-300`},"app-link":{label:`App link`,className:`bg-amber-500/15 text-amber-700 dark:text-amber-300`},custom:{label:`Custom`,className:`bg-sky-500/15 text-sky-700 dark:text-sky-300`},loopback:{label:`Loopback`,className:`bg-foreground-subtle/15 text-foreground-subtle`}};function ut({book:e,loading:t,saving:n,error:i,onSetRole:a,onAdd:o,onRemove:l}){let{t:u}=I(),[f,p]=s(``),[g,_]=s(``),[v,y]=s(null),[b,x]=s(null),S=()=>{let e=de(f);if(!e.ok){y(e.reason);return}y(null),p(``),_(``),o(e.baseUrl,g.trim())},C=(e,t)=>{let n=st(e,t.role);if(n.kind!==`none`){if(n.kind===`confirm-http`){x({input:n.input,reason:n.reason});return}x(null),a(n.input)}},w=[{key:`url`,header:u(`system.addressesCard.address`,`Address`),render:t=>r(`div`,{className:`min-w-0 py-0.5`,children:[c(`div`,{className:`font-mono text-[12px] break-all ${t.plausible?`text-foreground`:`text-foreground-subtle`}`,children:t.baseUrl}),r(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-1.5 text-[11px] text-foreground-subtle`,children:[c(`span`,{children:t.label}),t.kind===`app-link`&&r(`span`,{className:`font-mono`,children:[`hub=`,` `,e?.appLinkHub??u(`system.addressesCard.noneNoTunnelOrTailscale`,`none (no tunnel or Tailscale)`)]}),t.custom&&t.detected&&c(`span`,{children:u(`system.addressesCard.alsoAddedAsACustom`,`also added as a custom address`)}),t.kind!==`custom`&&t.interfaceKind!==`lan`&&t.interfaceKind!==`public`&&t.interfaceKind!==`other`&&c(`span`,{className:`uppercase tracking-wide`,children:t.interfaceKind}),!t.plausible&&t.interfaceKind!==`loopback`&&r(`span`,{className:`inline-flex items-center gap-1 text-amber-700 dark:text-amber-300`,title:t.plausibleReason||void 0,children:[c(m,{className:`h-2.5 w-2.5`}),u(`system.addressesCard.unlikelyUsable`,`Unlikely usable`)]})]})]})},{key:`kind`,header:u(`system.addressesCard.kind`,`Kind`),nowrap:!0,render:e=>{let t=lt[e.kind]??lt.loopback;return c(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium ${t.className}`,children:t.label})}},...q.map(e=>({key:e.role,headerRender:()=>c(`span`,{title:e.help,children:e.title}),align:`center`,nowrap:!0,width:`w-24`,render:t=>{let i=t.eligible.includes(e.role),a=t.flags.includes(e.role),o=J(t,e.role);return r(`label`,{className:`inline-flex items-center justify-center gap-1 ${i?`cursor-pointer`:`cursor-not-allowed opacity-40`}`,title:i?o&&!a?u(`system.addressesCard.inUseAutomatically`,`{{title}}: in use automatically. {{help}}`,{title:e.title,help:e.help}):e.help:u(`system.addressesCard.thisAddressCannotBeUsed`,`This address cannot be used for this.`),children:[c(Re,{checked:i&&o,disabled:!i||n,onChange:()=>C(t,e),"aria-label":`${e.title}: ${t.baseUrl}`}),o&&!a&&i&&c(`span`,{className:`text-[9px] text-foreground-subtle`,children:`auto`})]})}})),{key:`actions`,header:``,align:`right`,nowrap:!0,render:e=>e.custom?c(j,{size:`sm`,variant:`ghost`,disabled:n,onClick:()=>l(e.baseUrl),"aria-label":u(`system.addressesCard.remove`,`Remove {{baseUrl}}`,{baseUrl:e.baseUrl}),title:u(`system.addressesCard.removeThisCustomAddressIts`,`Remove this custom address (its roles turn automatic)`),children:c(d,{className:`h-3 w-3`})}):null}],T=e===void 0?[]:ct(e);return r(Ae,{children:[r(`div`,{className:`px-4 py-3 border-b border-border flex flex-col gap-2`,children:[r(`div`,{children:[c(`div`,{className:`text-sm font-semibold`,children:u(`system.addressesCard.addresses`,`Addresses`)}),c(`div`,{className:`text-xs text-foreground-subtle max-w-3xl`,children:u(`system.addressesCard.everyAddressThisHubIs`,`Every address this hub is reached at, detected or added by you. Tick what each one is used for.`)}),r(`details`,{className:`mt-1.5 text-xs max-w-3xl`,"data-testid":`address-roles-help`,children:[c(`summary`,{className:`cursor-pointer select-none text-foreground-subtle hover:text-foreground`,children:u(`system.addressesCard.whatAreRoles`,`What are roles?`)}),c(`dl`,{className:`mt-1.5 grid grid-cols-[auto_1fr] gap-x-3 gap-y-1`,children:q.map(e=>r(`div`,{className:`contents`,children:[c(`dt`,{className:`font-medium`,children:e.title}),c(`dd`,{className:`text-foreground-subtle`,children:e.help})]},e.role))}),c(`p`,{className:`mt-1.5 text-foreground-subtle`,children:ot})]})]}),T.length>0&&c(`div`,{className:`grid grid-cols-[auto_1fr_auto] gap-x-3 gap-y-1 items-baseline text-xs`,"data-testid":`address-roles-summary`,children:T.map(e=>r(`div`,{className:`contents`,children:[c(`span`,{className:`text-foreground-subtle`,children:e.title}),r(`span`,{className:`font-mono break-all`,"data-testid":`address-role-${e.role}`,children:[e.inUse,c(`span`,{className:`ml-1.5 font-sans text-foreground-subtle`,children:e.automatic?u(`system.addressesCard.automatic`,`(automatic)`):u(`system.addressesCard.setByYou`,`(set by you)`)})]}),e.automatic?c(`span`,{}):c(j,{size:`sm`,variant:`secondary`,disabled:n,onClick:()=>a({role:e.role,baseUrl:null,enabled:!1}),children:u(`system.addressesCard.useAutomatic`,`Use automatic`)})]},e.role))}),b!==null&&r(`div`,{className:`rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-xs flex flex-wrap items-center gap-2`,children:[c(m,{className:`h-3.5 w-3.5 text-amber-600`}),c(`span`,{className:`flex-1 min-w-[220px]`,children:b.reason}),c(j,{size:`sm`,variant:`secondary`,onClick:()=>{a({...b.input,acceptInsecureHttp:!0}),x(null)},children:u(`system.addressesCard.useHttpAnyway`,`Use http anyway`)}),c(j,{size:`sm`,variant:`ghost`,onClick:()=>x(null),children:u(`common.cancel`,`Cancel`)})]}),i!==null&&c(`div`,{className:`text-[11px] text-red-600 dark:text-red-400`,role:`alert`,children:i})]}),c(be,{columns:w,rows:e?.rows??[],rowKey:e=>`${e.kind}-${e.baseUrl}`,minWidthPx:760,bordered:!1,mobileMode:`scroll`,emptyMessage:t?u(`common.loading`,`Loading…`):u(`system.addressesCard.noAddressesAvailable`,`No addresses available.`),rowClassName:e=>e.plausible?void 0:`opacity-80`}),r(`div`,{className:`px-4 py-3 border-t border-border flex flex-wrap items-start gap-2`,children:[r(`div`,{className:`flex-1 min-w-[220px]`,children:[c(Le,{value:f,onChange:e=>{p(e.target.value),y(null)},placeholder:`https://cams.example.com or https://192.168.1.50:4443`,"aria-label":u(`system.addressesCard.customAddress`,`Custom address`),disabled:n}),v!==null&&c(`div`,{className:`mt-1 text-[11px] text-red-600 dark:text-red-400`,children:v})]}),c(`div`,{className:`w-48`,children:c(Le,{value:g,onChange:e=>_(e.target.value),placeholder:u(`system.addressesCard.labelOptional`,`Label (optional)`),"aria-label":u(`system.addressesCard.customAddressLabel`,`Custom address label`),maxLength:80,disabled:n})}),r(j,{size:`sm`,variant:`secondary`,disabled:n||f.trim()===``,onClick:S,children:[c(h,{className:`h-3 w-3`}),u(`system.addressesCard.addCustomAddress`,`Add custom address`)]})]})]})}n();function dt(){let{t:e}=I(),t=o(),n=()=>{t.invalidateQueries({queryKey:[[`localNetwork`]]})},a=ze(void 0,{refetchInterval:3e4}),d=ke(void 0),f=Ee({onSuccess:n}),p=je({onSuccess:e=>{C(e.addresses),n()}}),m=i(()=>a.data?.interfaces??[],[a.data]),h=he({scheme:typeof window<`u`&&window.location.protocol===`https:`?`https`:`http`},{refetchInterval:3e4}),g=xe({onSuccess:n}),_=ge({onSuccess:n}),y=Oe({onSuccess:n}),b=g.error?.message??_.error?.message??y.error?.message??null,x=g.isPending||_.isPending||y.isPending,[S,C]=s([]),[w,T]=s(!1);l(()=>{!w&&d.data&&(C(d.data.addresses),T(!0))},[d.data,w]);let E=d.data?.addresses??[],D=i(()=>{if(S.length!==E.length)return!0;let e=[...S].toSorted(),t=[...E].toSorted();return e.some((e,n)=>e!==t[n])},[S,E]);return r(z,{embedded:!0,children:[r(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[c(`p`,{className:`text-xs text-foreground-subtle max-w-2xl`,children:e(`system.networkAddresses.pinWhichHostInterfacesExist`,`Pin which host interfaces exist, then tick what each address is used for. Add a custom address when this hub is reached at one it cannot detect.`)}),c(`div`,{className:`flex items-center gap-2 shrink-0`,children:r(j,{size:`sm`,variant:`secondary`,onClick:()=>{a.refetch(),d.refetch(),h.refetch()},disabled:a.isLoading,children:[c(ie,{className:`h-3 w-3 ${a.isLoading?`animate-spin`:``}`}),e(`common.refresh`,`Refresh`)]})})]}),c(P,{headingId:`network-allowed-addresses`,title:e(`system.networkAddresses.allowedAddresses`,`Allowed addresses`),actions:r(`div`,{className:`flex flex-wrap items-center gap-1`,children:[r(j,{size:`sm`,variant:`secondary`,onClick:()=>p.mutate(void 0),disabled:p.isPending||f.isPending,title:e(`system.networkAddresses.reRunTheAutoDetection`,`Re-run the auto-detection heuristic + overwrite the current allowlist with the best matches.`),children:[c(v,{className:`h-3 w-3`}),p.isPending?e(`system.networkAddresses.detecting`,`Detecting…`):e(`system.networkAddresses.bestMatch`,`Best match`)]}),r(j,{size:`sm`,variant:`secondary`,onClick:()=>{C([])},disabled:S.length===0||f.isPending,children:[c(re,{className:`h-3 w-3`}),e(`system.networkAddresses.clear`,`Clear`)]}),D&&c(j,{size:`sm`,variant:`secondary`,onClick:()=>{C(E)},disabled:f.isPending,children:e(`system.networkAddresses.discard`,`Discard`)}),r(j,{size:`sm`,variant:`primary`,onClick:()=>{f.mutate({addresses:[...S]})},disabled:!D||f.isPending,children:[c(ee,{className:`h-3 w-3`}),f.isPending?e(`system.networkAddresses.saving`,`Saving…`):e(`common.save`,`Save`)]})]}),children:r(`div`,{className:u,children:[c(`p`,{className:`mb-3 text-xs text-foreground-subtle`,children:S.length===0?e(`system.networkAddresses.autoEveryNonLoopbackNon`,`Auto — every non-loopback / non-link-local interface participates.`):e(`system.networkAddresses.pinned`,`{{value1}} pinned`,{value1:String(S.length)})}),c(at,{mode:`multiple`,interfaces:m,value:S,onChange:C,disabled:f.isPending,emptyMessage:a.isLoading?e(`system.networkAddresses.loadingInterfaces`,`Loading interfaces…`):e(`system.networkAddresses.noInterfacesDetected`,`No interfaces detected.`)})]})}),c(ut,{book:h.data,loading:h.isLoading,saving:x,error:b,onSetRole:e=>g.mutate({...e}),onAdd:(e,t)=>_.mutate({baseUrl:e,label:t}),onRemove:e=>y.mutate({baseUrl:e})})]})}n();var ft={mesh:`bg-violet-500/15 text-violet-700 dark:text-violet-300`,public:`bg-blue-500/15 text-blue-700 dark:text-blue-300`},Y=5e3,X=`mesh-network`,pt=3e4,mt={joined:!1,meshIp:``,magicDnsHostname:``,peerCount:0,endpoints:[],tenantName:``,magicDnsSuffix:``,userLogin:null,controlPlaneUrl:``,keyExpiry:null};function ht(){let{t:e}=I(),t=M({capName:`mesh-network`},{refetchInterval:Y}),n=_e(void 0,{refetchInterval:Y}),r=i(()=>U(n.data??[]),[n.data]),a=i(()=>(t.data??[]).map(e=>({addonId:e.addonId,displayName:r.get(e.addonId)??e.addonId,isActive:e.isActive})),[t.data,r]),o=[{id:X,label:e(`system.meshNetworks.meshNetworks`,`Mesh networks`),install:{capability:X,label:e(`system.meshNetworks.addMesh`,`Add mesh`)},entries:a.map(t=>({id:t.addonId,name:t.displayName,fallbackIcon:g,...H(t.isActive),render:()=>c(B,{addonId:t.addonId,displayName:t.displayName,capName:X,isActive:t.isActive,badges:c(gt,{addonId:t.addonId}),primaryAction:c(_t,{addonId:t.addonId}),panels:[{id:`status`,title:e(`system.meshNetworks.status`,`Status`),icon:k,content:c(vt,{addonId:t.addonId})}]})}))}];return c(V,{embedded:!0,icon:k,title:e(`system.meshNetworks.meshNetworks2`,`Mesh Networks`),subtitle:e(`system.meshNetworks.privateVpnMeshesThatConnect`,`Private VPN meshes that connect CamStack to your other devices (Tailscale, Headscale, …). Each provider can also expose this hub publicly via its ingress (Tailscale Funnel).`),groups:o,isLoading:t.isLoading,emptyTitle:e(`system.meshNetworks.noMeshNetworkProvidersInstalled`,`No mesh-network providers installed`),emptyDescription:e(`system.meshNetworks.installAMeshAddonE`,`Install a mesh addon (e.g. @camstack/addon-tailscale) to join this hub into a private VPN mesh.`)})}function Z(e){let{data:t,isLoading:n}=He({addonId:e},{refetchInterval:Y,retry:!1}),r=t?ue.safeParse(t):null;return{status:r?.success?r.data:mt,isLoading:n}}function gt({addonId:e}){let{t}=I(),{status:n}=Z(e);return r(a,{children:[c(F,{variant:n.joined?`success`:`default`,className:Ke,children:n.joined?t(`system.meshNetworks.joined`,`Joined`):t(`system.meshNetworks.notJoined`,`Not joined`)}),n.joined&&r(F,{className:`text-[10px]`,children:[n.peerCount,` peer`,n.peerCount===1?``:`s`]})]})}function _t({addonId:t}){let{t:n}=I(),i=o(),[l,u]=s(!1),[d,f]=s(null),p=ne(),{status:m}=Z(t),h=e(()=>{i.invalidateQueries({queryKey:[[`meshNetwork`]]})},[i]),g=Fe(),_=pe({onSuccess:h}),v=ye({onSuccess:h}),y=e(async()=>{u(!0);let e={cancelled:!1};f(e);try{let n=await g.mutateAsync({addonId:t});if(e.cancelled)return;n.loginUrl&&window.open(n.loginUrl,`_blank`,`noopener,noreferrer`);let r=Date.now();for(;!e.cancelled&&(await Tt(2e3),!e.cancelled);){let e=await p.trpcClient.meshNetwork.getStatus.query({addonId:t}).catch(()=>null),n=e?ue.safeParse(e):null;if(n?.success&&n.data.joined){h();break}if(Date.now()-r>6e5)break}}finally{u(!1),f(null)}},[t,h,g,p]),b=e(()=>{d&&(d.cancelled=!0),u(!1),f(null)},[d]);return c(a,{children:m.joined?r(a,{children:[r(j,{size:`sm`,variant:`secondary`,disabled:_.isPending,onClick:()=>_.mutate({addonId:t}),children:[_.isPending?c(S,{className:`h-3 w-3 animate-spin`}):c(ae,{className:`h-3 w-3`}),n(`system.meshNetworks.disconnect`,`Disconnect`)]}),r(j,{size:`sm`,variant:`ghost`,disabled:v.isPending,onClick:()=>v.mutate({addonId:t}),children:[v.isPending?c(S,{className:`h-3 w-3 animate-spin`}):c(x,{className:`h-3 w-3`}),n(`system.meshNetworks.logOut`,`Log out`)]})]}):l?r(j,{size:`sm`,variant:`ghost`,onClick:b,children:[c(w,{className:`h-3 w-3 mr-1`}),` Cancel`]}):r(a,{children:[r(j,{size:`sm`,variant:`primary`,onClick:()=>void y(),children:[c(se,{className:`h-3 w-3`}),n(`system.meshNetworks.connect`,`Connect`)]}),r(j,{size:`sm`,variant:`ghost`,disabled:v.isPending,onClick:()=>v.mutate({addonId:t}),children:[v.isPending?c(S,{className:`h-3 w-3 animate-spin`}):c(x,{className:`h-3 w-3`}),n(`system.meshNetworks.logOut`,`Log out`)]})]})})}function vt({addonId:e}){let{t}=I(),{status:n}=Z(e),i=Ie({addonId:e},{refetchInterval:pt,retry:!1});return r(`div`,{className:`rounded-lg border border-border bg-surface`,children:[r(`div`,{className:`space-y-4 p-2 sm:p-4`,children:[n.error&&c(N,{message:n.error}),c(yt,{status:n}),n.endpoints.length>0&&r(`div`,{className:`space-y-1.5`,children:[c(`div`,{className:`text-[11px] font-semibold text-foreground-subtle uppercase tracking-wide`,children:t(`system.meshNetworks.endpoints`,`Endpoints`)}),n.endpoints.map(e=>r(`div`,{className:`flex items-center gap-2 text-xs flex-wrap`,children:[r(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium ${ft[e.scope]??`bg-foreground-subtle/15 text-foreground-subtle`}`,children:[e.scope===`public`?c(A,{className:`inline h-2.5 w-2.5 mr-0.5`}):null,e.label]}),r(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-emerald-700 dark:text-emerald-300 hover:underline break-all flex items-center gap-1`,children:[c(_,{className:`h-3 w-3 shrink-0`}),e.url]})]},e.id))]})]}),c(`div`,{className:`border-t border-border`,children:c(xt,{peers:i.data?.peers??[],loading:i.isLoading})})]})}function yt({status:e}){let{t}=I();return c(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-1.5`,children:[{label:t(`system.meshNetworks.tenant`,`Tenant`),value:e.tenantName||`—`},{label:t(`system.meshNetworks.user`,`User`),value:e.userLogin??`—`},{label:t(`system.meshNetworks.controlPlane`,`Control plane`),value:e.controlPlaneUrl||`—`},{label:t(`system.meshNetworks.meshIp`,`Mesh IP`),value:e.meshIp||`—`,mono:!0},{label:t(`system.meshNetworks.magicdns`,`MagicDNS`),value:e.magicDnsHostname||`—`,mono:!0},{label:t(`system.meshNetworks.dnsSuffix`,`DNS suffix`),value:e.magicDnsSuffix||`—`,mono:!0},{label:t(`system.meshNetworks.peers`,`Peers`),value:String(e.peerCount)},{label:t(`system.meshNetworks.keyExpiry`,`Key expiry`),value:e.keyExpiry?bt(e.keyExpiry):`—`}].map(e=>r(`div`,{className:`flex items-baseline justify-between gap-3 text-xs`,children:[c(`span`,{className:`text-foreground-subtle shrink-0`,children:e.label}),c(`span`,{className:`text-foreground truncate ${e.mono?`font-mono`:``}`,children:e.value})]},e.label))})}function bt(e){let t=e-Date.now();if(t<0)return`Expired ${wt(e)}`;let n=Math.floor(t/864e5);if(n>60)return new Date(e).toLocaleDateString();if(n>1)return`in ${n} days`;let r=Math.floor(t/36e5);return r>1?`in ${r}h`:`in ${Math.max(1,Math.floor(t/6e4))} min`}function xt({peers:t,loading:n}){let{t:a}=I(),o=i(()=>t.map(e=>({...e,_id:e.id})),[t]),s=e(e=>{e&&navigator.clipboard?.writeText(e)},[]),l=i(()=>[{key:`hostname`,header:a(`system.meshNetworks.hostname`,`Hostname`),render:e=>r(`div`,{className:`flex flex-col`,children:[r(`div`,{className:`flex items-center gap-1.5`,children:[c(`span`,{className:`font-medium text-foreground`,children:e.hostname||a(`system.meshNetworks.unknown`,`(unknown)`)}),e.isSelf&&c(F,{variant:`info`,children:`self`}),e.exitNodeOption&&c(F,{variant:`warning`,children:`exit-node`})]}),e.userLogin&&c(`div`,{className:`text-[10px] text-foreground-subtle truncate`,children:e.userLogin})]})},{key:`magicDns`,header:a(`system.meshNetworks.magicdns`,`MagicDNS`),render:e=>e.magicDns?r(`div`,{className:`flex items-center gap-1`,children:[c(`span`,{className:`font-mono text-xs truncate`,children:e.magicDns}),c(`button`,{onClick:()=>s(e.magicDns),className:`p-0.5 hover:bg-foreground-subtle/10 rounded`,"aria-label":a(`system.meshNetworks.copyMagicdns`,`Copy MagicDNS`),children:c(y,{className:`h-3 w-3 text-foreground-subtle`})})]}):c(`span`,{className:`text-foreground-subtle`,children:`—`})},{key:`addresses`,header:`IP`,render:e=>{let t=e.addresses[0]??``;return t?r(`div`,{className:`flex items-center gap-1`,children:[c(`span`,{className:`font-mono text-xs`,children:t}),c(`button`,{onClick:()=>s(t),className:`p-0.5 hover:bg-foreground-subtle/10 rounded`,"aria-label":a(`system.meshNetworks.copyIp`,`Copy IP`),children:c(y,{className:`h-3 w-3 text-foreground-subtle`})})]}):c(`span`,{className:`text-foreground-subtle`,children:`—`})}},{key:`connection`,header:a(`system.meshNetworks.connection`,`Connection`),render:e=>r(`div`,{className:`flex items-center gap-1.5`,children:[c(F,{variant:St(e.connection),children:e.connection}),e.relay&&c(`span`,{className:`text-[10px] text-foreground-subtle font-mono`,children:e.relay})]})},{key:`routes`,header:a(`system.meshNetworks.routes`,`Routes`),render:e=>e.advertisedRoutes.length>0?c(`span`,{className:`text-[10px] font-mono text-foreground-subtle truncate`,children:e.advertisedRoutes.join(`, `)}):c(`span`,{className:`text-foreground-subtle`,children:`—`})},{key:`tx`,header:a(`system.meshNetworks.txRx`,`TX / RX`),render:e=>r(`span`,{className:`text-[10px] text-foreground-subtle font-mono`,children:[`↑ `,Ct(e.txBytes),` · ↓ `,Ct(e.rxBytes)]})},{key:`lastSeen`,header:a(`system.meshNetworks.lastSeen`,`Last seen`),render:e=>c(`span`,{className:`text-[10px] text-foreground-subtle`,children:e.lastSeenMs>0?wt(e.lastSeenMs):`—`})}],[s,a]);return n&&t.length===0?r(`div`,{className:`p-4 text-xs text-foreground-subtle`,children:[c(S,{className:`h-3 w-3 animate-spin inline mr-1`}),` Loading peers…`]}):t.length===0?c(`div`,{className:`p-4 text-xs text-foreground-subtle`,children:a(`system.meshNetworks.noPeersVisibleYourTailnet`,`No peers visible — your tailnet may be empty or the host is not joined.`)}):c(`div`,{className:`p-4`,children:c(be,{columns:l,rows:o,rowKey:e=>e._id,minWidthPx:820})})}function St(e){return e===`direct`?`success`:e===`relay`?`warning`:`info`}function Ct(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:e<1024*1024*1024?`${(e/1024/1024).toFixed(1)}MB`:`${(e/1024/1024/1024).toFixed(2)}GB`}function wt(e){let t=Date.now()-e;return t<6e4?`just now`:t<36e5?`${Math.round(t/6e4)}m ago`:t<864e5?`${Math.round(t/36e5)}h ago`:`${Math.round(t/864e5)}d ago`}function Tt(e){return new Promise(t=>setTimeout(t,e))}var Et=/-----BEGIN CERTIFICATE-----[\s\S]+?-----END CERTIFICATE-----/,Q=/-----BEGIN ((?:RSA |EC |ENCRYPTED )?PRIVATE KEY)-----[\s\S]+?-----END \1-----/,Dt={certificate:`.pem,.crt,.cer`,privateKey:`.pem,.key`,ca:`.pem,.crt,.cer`};function $(e,t){if(t.trim()===``)return null;if(e===`privateKey`){let e=Q.exec(t);return e===null?Et.test(t)?`This is a certificate, not a private key.`:`Not a PEM private key — expected -----BEGIN … PRIVATE KEY-----.`:e[1]===`ENCRYPTED PRIVATE KEY`?`The private key is password-protected. Export it without a passphrase.`:null}return Et.test(t)?e===`certificate`&&Q.test(t)?`This file also contains a private key. Pick the certificate file, and the key in its own field.`:null:Q.test(t)?`This is a private key, not a certificate.`:`Not a PEM certificate — expected -----BEGIN CERTIFICATE-----.`}function Ot(e){return e.text()}n();function kt({kind:e,label:n,value:i,onChange:a,rows:o=6}){let{t:l}=I(),u=t(null),[d,f]=s(null),[p,m]=s(null),h=p??$(e,i),g=`pem-${e}`,_=async e=>{let t=e.target.files?.[0];if(e.target.value=``,t!==void 0){f(t.name);try{let e=await Ot(t);m(null),a(e)}catch(e){m(`Could not read ${t.name}: ${e instanceof Error?e.message:String(e)}`)}}};return r(`div`,{className:`space-y-1`,children:[r(`div`,{className:`flex items-center justify-between gap-2`,children:[c(`label`,{htmlFor:g,className:`text-[11px] text-foreground-subtle`,children:n}),r(`div`,{className:`flex min-w-0 items-center gap-2`,children:[d!==null&&c(`span`,{className:`truncate font-mono text-[10px] text-foreground-subtle`,"data-testid":`${g}-file-name`,children:d}),c(`input`,{ref:u,type:`file`,accept:Dt[e],onChange:e=>void _(e),className:`hidden`,"data-testid":`${g}-file`}),r(j,{size:`sm`,variant:`outline`,type:`button`,onClick:()=>u.current?.click(),children:[c(oe,{className:`mr-1 h-3 w-3`}),l(`system.pemField.chooseFile`,`Choose file`)]})]})]}),c(`textarea`,{id:g,value:i,onChange:e=>{f(null),m(null),a(e.target.value)},rows:o,"aria-invalid":h!==null,className:`w-full rounded border border-border bg-surface px-2 py-1 font-mono text-[11px]`}),h!==null&&c(`p`,{className:`text-[11px] text-danger`,role:`alert`,children:h})]})}n();function At(e){if(e===null||e===``)return`—`;let t=e.replace(/:/g,``);return t.length<=16?e:`${t.slice(0,8)}…${t.slice(-8)}`}function jt(){let{t:e}=I(),t=o(),n=fe(void 0,{refetchInterval:15e3}),i=De({onSuccess:()=>void t.invalidateQueries({queryKey:[[`localNetwork`]]})}),a=ve({onSuccess:()=>void t.invalidateQueries({queryKey:[[`localNetwork`]]})}),l=Me({onSuccess:()=>{m(!1),g(``),v(``),b(``),t.invalidateQueries({queryKey:[[`localNetwork`]]})}}),d=n.data,[f,m]=s(!1),[h,g]=s(``),[_,v]=s(``),[y,b]=s(``),x=()=>{if(!d?.caCertPem)return;let e=new Blob([d.caCertPem],{type:`application/x-pem-file`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`camstack-ca.crt`,n.click(),URL.revokeObjectURL(t)},S=d?.mode===`uploaded`?`Uploaded`:d?.mode===`generated`?`Generated local CA`:`TLS disabled`;return c(z,{embedded:!0,children:r(`div`,{className:p,children:[c(Ge,{nodeId:`hub`,addonIds:[`local-network`],level:`global`,title:e(`system.localAccess.lanHttp`,`LAN HTTP`),description:e(`system.localAccess.nativeAppsOnThisWi`,`Native apps on this Wi-Fi use http:// and skip the private certificate. The tunnel and this admin UI stay on HTTPS.`)}),c(P,{headingId:`local-access-certificate`,title:e(`system.localAccess.certificate`,`Certificate`),icon:E,children:r(`div`,{className:`${u} space-y-3`,children:[n.isError&&c(`p`,{className:`text-xs text-danger`,children:e(`system.localAccess.couldNotReadTlsStatus`,`Could not read TLS status.`)}),d?.reissueError&&c(N,{variant:`warning`,title:e(`system.localAccess.certificateReissue`,`Certificate reissue`),message:d.reissueError}),d?.restartRequired&&c(N,{variant:`warning`,title:e(`system.localAccess.restartRequired`,`Restart required`),message:e(`system.localAccess.theHttpsListenerStillServes`,`The HTTPS listener still serves the previous certificate. Restart the hub to apply it.`)}),r(`dl`,{className:`grid grid-cols-1 gap-2 text-xs sm:grid-cols-2`,children:[r(`div`,{children:[c(`dt`,{className:`text-foreground-subtle`,children:e(`system.localAccess.mode`,`Mode`)}),c(`dd`,{className:`font-medium`,children:S})]}),r(`div`,{children:[c(`dt`,{className:`text-foreground-subtle`,children:e(`system.localAccess.validTo`,`Valid to`)}),c(`dd`,{className:`font-mono`,children:d?.validTo?new Date(d.validTo).toLocaleString():`—`})]}),r(`div`,{children:[c(`dt`,{className:`text-foreground-subtle`,children:e(`system.localAccess.leafSha256`,`Leaf SHA-256`)}),c(`dd`,{className:`font-mono`,title:d?.leafFingerprintSha256??void 0,children:At(d?.leafFingerprintSha256??null)})]}),r(`div`,{children:[c(`dt`,{className:`text-foreground-subtle`,children:e(`system.localAccess.caSha256`,`CA SHA-256`)}),c(`dd`,{className:`font-mono`,title:d?.caFingerprintSha256??void 0,children:d?.mode===`uploaded`&&d.caFingerprintSha256===null?c(`span`,{className:`font-sans text-foreground-subtle`,children:e(`system.localAccess.issuerNotIncludedInThe`,`Issuer not included in the upload (not the local CA)`)}):At(d?.caFingerprintSha256??null)})]})]}),d&&d.sans.length>0&&c(`div`,{className:`flex flex-wrap gap-1`,children:d.sans.map(e=>c(`span`,{className:`rounded border border-border bg-surface px-1.5 py-0.5 font-mono text-[10px] text-foreground-subtle`,children:e},e))}),r(`div`,{className:`flex flex-wrap gap-2`,children:[c(Se,{label:e(`system.localAccess.regenerate`,`Regenerate`),title:e(`system.localAccess.issueANewLeaf`,`Issue a new leaf?`),description:e(`system.localAccess.issuesANewLeafUnder`,`Issues a new leaf under the current local CA. Clients that trust the CA keep working. The HTTPS listener reloads.`),confirmLabel:e(`system.localAccess.regenerate`,`Regenerate`),disabled:d?.mode===`uploaded`||i.isPending,action:()=>i.mutateAsync({})}),c(j,{size:`sm`,variant:`outline`,onClick:()=>m(e=>!e),children:e(`system.localAccess.upload`,`Upload`)}),d?.caCertPem&&c(j,{size:`sm`,variant:`outline`,onClick:x,children:e(`system.localAccess.downloadCa`,`Download CA`)}),d?.mode===`uploaded`&&c(Se,{label:e(`system.localAccess.revertToGenerated`,`Revert to generated`),title:e(`system.localAccess.dropTheUploadedCertificate`,`Drop the uploaded certificate?`),description:e(`system.localAccess.deletesTheUploadedPairAnd`,`Deletes the uploaded pair and returns to the generated local CA.`),confirmLabel:e(`system.localAccess.revert`,`Revert`),confirmVariant:`danger`,disabled:a.isPending,action:()=>a.mutateAsync({})})]}),f&&r(`div`,{className:`space-y-2 border-t border-border pt-3`,children:[c(kt,{kind:`certificate`,label:e(`system.localAccess.certificateOrFullChainPem`,`Certificate or full chain (PEM)`),value:h,onChange:g}),c(kt,{kind:`privateKey`,label:e(`system.localAccess.privateKeyPem`,`Private key (PEM)`),value:_,onChange:v}),c(kt,{kind:`ca`,label:e(`system.localAccess.caPemOptional`,`CA (PEM, optional)`),value:y,onChange:b,rows:4}),c(j,{size:`sm`,disabled:!h.trim()||!_.trim()||$(`certificate`,h)!==null||$(`privateKey`,_)!==null||$(`ca`,y)!==null||l.isPending,onClick:()=>l.mutate({certPem:h,keyPem:_,...y.trim()?{caPem:y}:{}}),children:e(`system.localAccess.saveCertificate`,`Save certificate`)}),l.isError&&c(`p`,{className:`text-xs text-danger`,children:l.error instanceof Error?l.error.message:e(`system.localAccess.uploadFailed`,`Upload failed`)})]})]})})]})})}n();function Mt({value:e,onChange:t}){let{t:n}=I(),{data:a}=Be({isCamera:!0,projection:`slim`}),o=i(()=>a===void 0?[{value:``,label:n(`system.networkDiagnostics.loadingCameras`,`Loading cameras…`)}]:a.length===0?[{value:``,label:n(`system.networkDiagnostics.noCameras`,`No cameras`)}]:[{value:``,label:n(`system.networkDiagnostics.pickACamera`,`Pick a camera`)},...a.toSorted((e,t)=>e.name.localeCompare(t.name)).map(e=>({value:String(e.id),label:`${e.name} (#${String(e.id)})`}))],[a,n]);return r(`label`,{className:`flex min-w-0 flex-col gap-1`,children:[c(`span`,{className:`text-[11px] text-foreground-subtle`,children:n(`system.networkDiagnostics.camera`,`Camera`)}),c(we,{value:e===null?``:String(e),disabled:a===void 0||a.length===0,onChange:e=>t(e.target.value===``?null:Number(e.target.value)),options:o})]})}function Nt(){let t=ne(),[n,i]=s(null);return c(z,{embedded:!0,children:r(`div`,{className:p,"data-testid":`network-diagnostics`,children:[c(me,{loadServers:e(async()=>t.trpcClient.turnProvider.getTurnServers.query(),[t])}),c(Ne,{trpc:t.trpcClient,serverUrl:b(),deviceId:n,cameraField:c(Mt,{value:n,onChange:i})})]})})}function Pt(){let{t:e}=I(),t=Ue(`/system/network`,{t:e,isAdmin:!0})??{icon:A,title:e(`system.network`,`Network`)};return c(We,{icon:t.icon,title:t.title,defaultSection:`addresses`,sectionsLabel:`${t.title} sections`,sections:[{id:`local-access`,label:e(`systemPage.network.localAccess`,`Local access`),content:c(jt,{})},{id:`addresses`,label:e(`systemPage.network.networkAddresses`,`Network Addresses`),content:c(dt,{})},{id:L.remoteAccess.tab,label:e(`systemPage.network.remoteAccess`,`Remote Access`),content:c(Je,{}),ownedParams:R},{id:L.mesh.tab,label:e(`systemPage.network.meshNetworks`,`Mesh Networks`),content:c(ht,{}),ownedParams:R},{id:L.turn.tab,label:e(`systemPage.network.turnServers`,`TURN Servers`),content:c(et,{}),ownedParams:R},{id:`diagnostics`,label:e(`systemPage.network.diagnostics`,`Diagnostics`),content:c(Nt,{})}]})}export{Pt as NetworkPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{H as e,I as t,K as n,Q as r,S as i,W as a,b as o,i as s,k as c,o as l,p as u,q as d,t as f,x as p,z as m}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{ot as h}from"./player-overlays-Cda8wso6.js";import{_i as g}from"./client-CMlUvfoK.js";import{Er as _,Ri as v,V as y,_r as ee,gr as te,qr as ne}from"./src-eoSUZcV-.js";import{t as re}from"./useTranslation-Bc5yH9V9.js";import{F as ie,I as b,L as x,P as ae}from"./index-BgQGn3LX.js";r();var S=c(function({addonId:r,schema:i,serverValues:o,onImmediateSave:s,onStateChange:c,onAction:l,disabled:u},d){let f=x({schema:i,serverValues:o,onImmediateSave:t(e=>s(r,e),[r,s]),onDeferredSave:t(()=>{},[])});e(d,()=>({flush:()=>{let e={};for(let t of f.pendingKeys)e[t]=f.values[t];return f.handleDiscard(f.pendingKeys),e},discard:()=>f.resetAll()}),[f]);let h=f.pendingKeys,g=h.join(`|`),_=a(()=>h.map(e=>`${e}=${JSON.stringify(f.values[e])}`).join(`,`),[h,f.values]),v=n(c);m(()=>{v.current=c},[c]),m(()=>{let e={};for(let t of h)e[t]=f.values[t];v.current({addonId:r,pendingKeys:h,pendingValues:e})},[r,g,_]);let y=a(()=>{if(l)return(e,t,n)=>l(r,e,t,n)},[r,l]);return p(b,{schema:i,values:f.values,onChange:f.handleChange,disabled:u,onAction:y})});function C(e){return`perNode`in e&&e.perNode===!0}function w(e,t){if(e.type===`group`){let n=T(e.fields,t);return n.length>0?{...e,fields:n}:null}if(e.type===`sub-tabs`){let n=e.tabs.map(e=>({...e,fields:T(e.fields,t)})).filter(e=>e.fields.length>0);return n.length>0?{...e,tabs:n}:null}return C(e)===(t===`perNode`)?e:null}function T(e,t){let n=[];for(let r of e){let e=w(r,t);e!==null&&n.push(e)}return n}function oe(e,t){let n=[];for(let r of e.sections){let e=T(r.fields,t);e.length!==0&&n.push({...r,fields:e})}return{...e,sections:n}}function se(e,t){let n=e??`general`;return t?.[n]??n}function E(e){return typeof e!=`object`||!e||!(`key`in e)?null:typeof e.key==`string`?e.key:null}function ce(e,t){let n=t.fieldKeys===void 0?null:new Set(t.fieldKeys),r=[];for(let i of e){let e=n===null?i.fields:i.fields.filter(e=>{let t=E(e);return t!==null&&n.has(t)});e.length!==0&&r.push({...i,fields:e,...t.tabAliases===void 0?{}:{tab:se(i.tab,t.tabAliases)},...t.hideSectionChrome===!0?{title:``,description:void 0}:{}})}return r}r();function D(e,t){if(e.type===`separator`||e.type===`info`||e.type===`button`)return e;if(e.type===`group`){let n=e.fields.map(e=>D(e,t));return{...e,fields:n}}let n=e;t[e.key]=n.value;let{value:r,...i}=n;return i}function O(e,t){return{...e,fields:e.fields.map(e=>D(e,t))}}function le(e){let t={};return{schema:{...e.tabs?{tabs:e.tabs}:{},sections:e.sections.map(e=>O(e,t))},values:t}}function k({nodeId:e,addonIds:r,level:c,deviceId:m,capability:b,sectionIds:x,omitSectionIds:S,fieldKeys:C,hideSectionChrome:w,tabAliases:T,tabLabelOverrides:E,sectionTab:D,fieldScope:O,surface:k,emptyMessage:de,extraTabs:A,schemaTabExtras:j,title:M,description:N,selfTabbed:fe,activeTab:P,onActiveTabChange:pe}){let{t:F}=re(),I=l(),L=h().trpcClient,R=ee(),z=te(),me=v(),he=ne(),B=fe===!0||!!(A&&A.length>0),[ge,_e]=d(null);if(c===`device`&&!m)throw Error(`NodeAddonsSettingsPanel: deviceId is required when level === "device"`);if(k!==void 0){if(c!==`global`||m!==void 0)throw Error(`NodeAddonsSettingsPanel: integration-level settings are addon-wide — they cannot be mounted at device level or with a deviceId. A second page, never a second scope.`);if(e!==null)throw Error(`NodeAddonsSettingsPanel: an integration has no node behind it — pass nodeId={null}. Received ${JSON.stringify(e)}.`);if(O!==void 0)throw Error("NodeAddonsSettingsPanel: integration-level settings arrive already cluster-scoped from core — remove `fieldScope` rather than restating it.")}let V=e??`hub`,H=s({queries:r.map(e=>({queryKey:[[`addonSettings`,k===void 0?c===`global`?`getGlobalSettings`:`getDeviceSettings`:`getIntegrationSettings`],{addonId:e,nodeId:V,deviceId:m??null,cap:b??null,scope:O??null}],queryFn:async()=>{let t=e=>e!==null&&O!==void 0?oe(e,O):e;return k===void 0?c===`global`?{addonId:e,result:t(await L.addonSettings.getGlobalSettings.query({addonId:e,nodeId:V,...b?{cap:b}:{}}))}:{addonId:e,result:t(await L.addonSettings.getDeviceSettings.query({addonId:e,deviceId:m,nodeId:V}))}:{addonId:e,result:await L.addonSettings.getIntegrationSettings.query({addonId:e,nodeId:V})}},placeholderData:u}))}),ve=H.some(e=>e.isLoading),ye=H.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(`||`),U=a(()=>{let e=new Set;for(let t of H){let n=t.data?.result?.sections;if(n)for(let t of n)e.add(se(t.tab,T))}return[...e]},[T,ye+`::`+H.map(e=>(e.data?.result?.sections??[]).map(e=>e.tab??`general`).join(`,`)).join(`::`)]),W=a(()=>new Map((A??[]).map(e=>[e.id,e])),[A]),G=a(()=>{if(!B)return[];let e=[...new Set([...U,...(A??[]).map(e=>e.id),...(j??[]).map(e=>e.tabId)])],t=e=>{let t=W.get(e);if(t?.order!==void 0)return t.order;let n=g[e];return n?n.order:50};return e.toSorted((e,n)=>{let r=t(e),i=t(n);return r===i?e.localeCompare(n):r-i})},[B,U,A,W,j]),be=a(()=>{let e=new Map,t=e=>g[e]?.label??e.charAt(0).toUpperCase()+e.slice(1);for(let n of U)e.set(n,t(n));for(let n of j??[])e.has(n.tabId)||e.set(n.tabId,t(n.tabId));for(let t of A??[])e.set(t.id,t.label);for(let[t,n]of Object.entries(E??{}))e.set(t,n);return e},[U,A,j,E]),K=P===void 0?ge:P,q=B?K&&G.includes(K)?K:G[0]??null:null,xe=e=>{_e(e),pe?.(e)},Se=q!==null&&W.has(q),J=B?q&&!Se?q:void 0:D,{data:Ce}=_(void 0),we=a(()=>{let e=new Map;for(let t of Ce??[]){let n=t.manifest?.id;if(!n)continue;let r=t.manifest?.name??t.manifest?.packageDisplayName??n;e.set(n,r)}return e},[Ce]),Te=n(new Map),Y=a(()=>{let e=x?new Set(x):null,t=S?new Set(S):null,n=n=>!(e!==null&&!e.has(n)||t!==null&&t.has(n)),r=[];for(let e of H){if(!e.data)continue;let t=e.data.result??Te.current.get(e.data.addonId)??null;if(e.data.result!==null&&Te.current.set(e.data.addonId,e.data.result),t===null)continue;let{schema:i,values:a}=le(t),o={...C===void 0?{}:{fieldKeys:C},...w===void 0?{}:{hideSectionChrome:w},...T===void 0?{}:{tabAliases:T}},s=ce(i.sections.filter(e=>n(e.id)),o);if(s.length===0)continue;let c={...t,sections:ce(t.sections.filter(e=>n(e.id)),o)},l={...i,sections:s};r.push({addonId:e.data.addonId,schemaWithValues:c,schema:l,serverValues:a})}return r},[ye,x,S,C,w,T]),[X,Ee]=d(new Map),De=t(e=>{Ee(t=>{let n=new Map(t);return n.set(e.addonId,e),n})},[]),Z=n(new Map),Oe=t(e=>t=>{t?Z.current.set(e,t):Z.current.delete(e)},[]),ke=t(async(e,t)=>{c===`global`?await R.mutateAsync({addonId:e,nodeId:V,patch:t}):await z.mutateAsync({addonId:e,deviceId:m,nodeId:V,patch:t}),I.invalidateQueries({queryKey:[[`addonSettings`]]})},[R,z,V,c,m,I]),Ae=t(async(e,t,n,r)=>{let i=V;try{switch(t){case`reprobe-hwaccel`:await me.mutateAsync({nodeId:i}),I.invalidateQueries({queryKey:[[`addonSettings`]]});return;case`reprobe-audio-engine`:await he.mutateAsync({nodeId:i}),I.invalidateQueries({queryKey:[[`addonSettings`]]});return;default:{let n=await L.addons.custom.mutate({addonId:e,action:t,input:r});return I.invalidateQueries({queryKey:[[`addonSettings`]]}),n}}}catch(n){throw console.error(`[NodeAddonsSettingsPanel] action failed`,{addonId:e,action:t,err:n}),n}},[me,he,V,I,L]),je=t((e,t)=>{ke(e,t)},[ke]),Q=f({mutationFn:async()=>{let e=[];for(let t of Y){let n=X.get(t.addonId);!n||n.pendingKeys.length===0||e.push({addonId:t.addonId,patch:n.pendingValues})}return e.length===0?{saved:[]}:{saved:await Promise.all(e.map(async({addonId:e,patch:t})=>(c===`global`?await R.mutateAsync({addonId:e,nodeId:V,patch:t}):await z.mutateAsync({addonId:e,deviceId:m,nodeId:V,patch:t}),e)))}},onSuccess:({saved:e})=>{for(let t of e)Z.current.get(t)?.discard();I.invalidateQueries({queryKey:[[`addonSettings`]]})}}),Me=t(()=>{for(let e of Z.current.values())e.discard()},[]),Ne=a(()=>{let e=0;for(let t of Y){let n=X.get(t.addonId);n&&(e+=n.pendingKeys.length)}return e},[Y,X]),Pe=a(()=>{let e=new Map;for(let t of Y){let n=X.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},[Y,X]);if(ve)return p(`div`,{className:`h-24 rounded-lg border border-border bg-surface animate-pulse`});let $=q&&Se?W.get(q):void 0;if(!B&&Y.length===0)return p(`div`,{className:`text-[11px] text-foreground-subtle italic`,children:de??i(o,{children:[`No addons in`,` `,r.length>0?`[${r.join(`, `)}]`:F(`settings.nodeAddonsSettingsPanel.theCurrentSelection`,`the current selection`),` `,`expose `,c,`-level settings on this node.`]})});let Fe=Q.isPending;return i(`div`,{className:`space-y-4`,children:[(M||N)&&i(`div`,{className:`border-b border-border pb-2`,children:[M&&p(`h2`,{className:`text-sm font-semibold text-foreground`,children:M}),N&&p(`p`,{className:`text-[11px] text-foreground-subtle mt-0.5`,children:N})]}),B&&p(ae,{tabs:G.map(e=>({id:e,label:be.get(e)??e})),activeId:q,onChange:xe,pendingByTab:Pe}),Q.isError&&i(`div`,{className:`rounded-md border border-red-500/40 bg-red-500/10 px-3 py-2 text-[11px] text-red-400`,children:[F(`settings.nodeAddonsSettingsPanel.saveFailed`,`Save failed:`),` `,String(Q.error?.message??Q.error)]}),p(y,{tabKey:$?`extra:${q??``}`:`tab:${q??``}`,children:$?$.content:(()=>{let e=J?Y.reduce((e,t)=>e+t.schemaWithValues.sections.filter(e=>(e.tab??`general`)===J).length,0):0,t=!!J&&e<=1,n=Y.map(e=>({...e,renderedWithValues:{...e.schemaWithValues,sections:e.schemaWithValues.sections.filter(e=>J?(e.tab??`general`)===J:!0).map(e=>t?{...e,title:``,description:void 0}:e)}})).filter(e=>e.renderedWithValues.sections.length>0).toSorted((e,t)=>{let n=e=>{let t=1/0;for(let n of e)typeof n.order==`number`&&n.order<t&&(t=n.order);return t},r=n(e.renderedWithValues.sections),i=n(t.renderedWithValues.sections);return r===i?0:r-i}),r=(j??[]).filter(e=>e.tabId===J),a=r.filter(e=>(e.placement??`before`)===`before`),o=r.filter(e=>e.placement===`after`);return n.length===0&&r.length===0?p(`div`,{className:`text-[11px] text-foreground-subtle italic`,children:de??F(`settings.nodeAddonsSettingsPanel.nothingToConfigureHereFor`,`Nothing to configure here for this node.`)}):i(`div`,{className:`space-y-6`,children:[a.map((e,t)=>p(`div`,{children:e.content},`extra-before-${t}`)),n.length>0&&p(ue,{entries:n,paneStates:X,displayNames:we,disabled:Fe,setPaneRef:Oe,onPaneStateChange:De,onImmediateSave:je,onAction:Ae,inline:B||!!D}),o.map((e,t)=>p(`div`,{children:e.content},`extra-after-${t}`))]})})()}),!ve&&p(ie,{pendingCount:Ne,onSave:()=>Q.mutate(),onDiscard:Me,saving:Fe})]})}function ue({entries:e,paneStates:t,displayNames:n,disabled:r,setPaneRef:o,onPaneStateChange:s,onImmediateSave:c,onAction:l,inline:u}){let f=a(()=>[...e].toSorted((e,t)=>{if(e.addonId===`system-config`)return-1;if(t.addonId===`system-config`)return 1;let r=n.get(e.addonId)??e.addonId,i=n.get(t.addonId)??t.addonId;return r.localeCompare(i)}),[e,n]),[h,g]=d(f[0]?.addonId??``);m(()=>{f.length!==0&&(f.find(e=>e.addonId===h)||g(f[0].addonId))},[f,h]);let _=f.find(e=>e.addonId===h)??f[0];if(!_)return null;let v=a(()=>l?(e,t,n,r)=>l(e,t,n,r):void 0,[l]),y=e=>p(S,{ref:o(e.addonId),addonId:e.addonId,schema:e.renderedWithValues,serverValues:e.serverValues,onImmediateSave:c,onStateChange:s,onAction:v,disabled:r},e.addonId);return f.length===1||u?p(`div`,{className:`flex flex-col gap-4`,children:f.map(y)}):i(`div`,{className:`flex flex-col gap-3`,children:[p(`div`,{className:`flex flex-wrap items-center gap-1 border-b border-border shrink-0`,children:f.map(e=>{let r=n.get(e.addonId)??e.addonId,a=e.addonId===_.addonId,o=(t.get(e.addonId)?.pendingKeys.length??0)>0;return i(`button`,{type:`button`,onClick:()=>g(e.addonId),className:`relative px-3 py-1.5 text-xs font-medium rounded-t-md transition-colors -mb-px border-b-2 whitespace-nowrap ${a?`text-primary border-primary bg-primary/5`:`text-foreground-subtle border-transparent hover:text-foreground hover:bg-surface-hover`}`,children:[r,o&&p(`span`,{className:`ml-1.5 inline-flex h-1.5 w-1.5 rounded-full bg-amber-400`})]},e.addonId)})}),p(`div`,{className:`space-y-2`,children:f.map(e=>p(`div`,{style:e.addonId===_.addonId?void 0:{display:`none`},children:y(e)},e.addonId))})]})}export{k as t};
|