@camstack/addon-admin-ui 1.2.354 → 1.2.356
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/Addons-vaVt3N8c.js +4 -0
- package/dist/assets/{AdminTabs-BhOeTpzS.js → AdminTabs-BOhyA0v_.js} +1 -1
- package/dist/assets/AiProfiles-gc9Na6rv.js +3 -0
- package/dist/assets/{BrokerForm-BcIi7X-k.js → BrokerForm-Bxjn8Xkb.js} +1 -1
- package/dist/assets/Build-DNhwnx2k.js +40 -0
- package/dist/assets/{Calendars-B0fN7lOZ.js → Calendars-9eEuusHn.js} +1 -1
- package/dist/assets/{Capabilities-DT5AfeU6.js → Capabilities-BuQgXiX1.js} +1 -1
- package/dist/assets/Cluster-BGpeqgpD.js +11 -0
- package/dist/assets/ClusterStepModel-Cg0YqJM-.js +1 -0
- package/dist/assets/CompositionEditor-DsZomdtR.js +1 -0
- package/dist/assets/{CompositionEditorPage-vZmTGOZa.js → CompositionEditorPage-CEYhfRyr.js} +1 -1
- package/dist/assets/Data-CxzcaPPX.js +1 -0
- package/dist/assets/DetectionIntelligence-esy4sm8-.js +1 -0
- package/dist/assets/DeviceDetail-BUFpgkeN.js +2 -0
- package/dist/assets/{DeviceDoActionFields-ByplmFm2.js → DeviceDoActionFields-C_OPAByq.js} +1 -1
- package/dist/assets/{Devices-CzY-IKW4.js → Devices-D5wKCK9_.js} +1 -1
- package/dist/assets/{EmbedPlayerPage-DWY9Lhk4.js → EmbedPlayerPage-xTUcKS8t.js} +1 -1
- package/dist/assets/Events-BD2v1o2Z.js +1 -0
- package/dist/assets/Identity-hydVfEcG.js +1 -0
- package/dist/assets/IntegrationDetail-IjNeTPn2.js +1 -0
- package/dist/assets/IntegrationHub-Czg3bSVM.js +1 -0
- package/dist/assets/Integrations-ErVYCOG1.js +1 -0
- package/dist/assets/Integrations-xrJzBxAs.js +1 -0
- package/dist/assets/Locations-BBu_JUg1.js +3 -0
- package/dist/assets/{Logs-D9Z3ttJa.js → Logs-hVhOlpsU.js} +1 -1
- package/dist/assets/{MotionZonesSettings-DLDLTjEm.js → MotionZonesSettings-B8426WyB.js} +1 -1
- package/dist/assets/MyAccess-D0PqfqUg.js +2 -0
- package/dist/assets/Network-1FUHkoPH.js +1 -0
- package/dist/assets/NodeAddonsSettingsPanel-Bin020YC.js +1 -0
- package/dist/assets/Notifications-DBedpZv-.js +1 -0
- package/dist/assets/{Plates-Dt0TJWJz.js → Plates-D1_YX1bj.js} +1 -1
- package/dist/assets/{PrivacyMaskSettings-Duop0Nv-.js → PrivacyMaskSettings-C-lyYBaQ.js} +1 -1
- package/dist/assets/Recordings-9M71-km4.js +1 -0
- package/dist/assets/ScanNetworkModal-DjrnLqkB.js +1 -0
- package/dist/assets/{SceneMonitorEditor-DW0CWVpI.js → SceneMonitorEditor-CnTzBKHk.js} +1 -1
- package/dist/assets/{Scenes-uql5nKII.js → Scenes-9o38vvfG.js} +1 -1
- package/dist/assets/Secrets-Di_XuHEM.js +1 -0
- package/dist/assets/{Settings-D9iP6dNh.js → Settings-CdsQXImT.js} +1 -1
- package/dist/assets/{Showroom-tad-iI89.js → Showroom-CueI9Hof.js} +1 -1
- package/dist/assets/{Terminal-CNbcxFd6.js → Terminal-CgkhEdVL.js} +3 -3
- package/dist/assets/{Viewer-CFDK9NZ7.js → Viewer-CXSln4qp.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-IsYcVs88.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-D23uSeCV.js} +1 -1
- package/dist/assets/{archive-DNJAWP0V.js → archive-HjFKqcYJ.js} +1 -1
- package/dist/assets/{authed-media-D6G9zhfa.js → authed-media-DTi-1YAt.js} +1 -1
- package/dist/assets/{boxes-BvyAsUqS.js → boxes-Bhz-2O4q.js} +1 -1
- package/dist/assets/circle-slash-RDy1aZkR.js +1 -0
- package/dist/assets/client-DuQQ55XQ.js +357 -0
- package/dist/assets/crop-BWtvQsYY.js +1 -0
- package/dist/assets/{debounced-invalidate-B9MDA5Pm.js → debounced-invalidate-BmvWt3Mf.js} +1 -1
- package/dist/assets/{device-integration-icon-5QFgnyqj.js → device-integration-icon-vpQeGGPt.js} +1 -1
- package/dist/assets/device-picker-model-C1VaG3XC.js +1 -0
- package/dist/assets/dist-B46vwY9Q.js +357 -0
- package/dist/assets/{dist-Bb5UmIgC.js → dist-BVQ0qNkk.js} +1 -1
- package/dist/assets/{face-bbox-BnhKQ-DD.js → face-bbox-DIMw9bdN.js} +1 -1
- package/dist/assets/{hard-drive-download-DPC7ldA-.js → hard-drive-download-DGUpD-NK.js} +1 -1
- package/dist/assets/{hostInit-vIPYIM3V.js → hostInit-jbr3yepU.js} +1 -1
- package/dist/assets/index-B-nNtYMr.css +2 -0
- package/dist/assets/index-I9Gc2ACc.js +4 -0
- package/dist/assets/{layers-CT9pfE_S.js → layers-TAdyTRRS.js} +1 -1
- package/dist/assets/{location-owned-usage-Bf05xmeX.js → location-owned-usage-D5P9h6fD.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-8000e3a6.js → mf-entry-bootstrap-0-c002b961.js} +2 -2
- package/dist/assets/mount-C1VaG3XC.js +1 -0
- package/dist/assets/notification-schedule-field-DdO5UXE-.js +1 -0
- package/dist/assets/{player-overlays-BOmyWZfG.js → player-overlays-PPtffSZH.js} +1 -1
- package/dist/assets/remoteEntry-CdbrIBDO.js +1 -0
- package/dist/assets/{send-CDRgtlhp.js → send-qYTKAtys.js} +1 -1
- package/dist/assets/{settings-2-921DSlZF.js → settings-2-BfvfZMIZ.js} +1 -1
- package/dist/assets/src-EnVigh-D.js +67 -0
- package/dist/assets/{unlink-D-XpELXi.js → unlink-CvsfIFka.js} +1 -1
- package/dist/assets/{use-scenes-feed-DLhiAewy.js → use-scenes-feed-DupdXK3r.js} +1 -1
- package/dist/assets/{use-stationary-objects-VZzKIBwG.js → use-stationary-objects-Blrh3fb3.js} +1 -1
- package/dist/assets/useEventInvalidation-C1VaG3XC.js +1 -0
- package/dist/assets/{useNodeUrlSelection-Bip3BpQO.js → useNodeUrlSelection-DemYJ0D7.js} +1 -1
- package/dist/assets/user-round-BCwcukON.js +1 -0
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BTr5fMW1.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-CFcHLszk.js} +2 -2
- package/dist/index.html +8 -8
- package/dist/server/addon.js +1905 -56
- package/package.json +1 -1
- package/dist/assets/Addons-BK4doplV.js +0 -4
- package/dist/assets/AiProfiles-LwSpryE9.js +0 -3
- package/dist/assets/Build-lkz9i41s.js +0 -40
- package/dist/assets/Cluster-BU-IW9ia.js +0 -11
- package/dist/assets/ClusterStepModel-CV8nR3LE.js +0 -1
- package/dist/assets/CompositionEditor-CRGXdz6W.js +0 -1
- package/dist/assets/Data-Devgvo7R.js +0 -1
- package/dist/assets/DetectionIntelligence-BNouaDPB.js +0 -1
- package/dist/assets/DeviceDetail-Bwdzgfsp.js +0 -2
- package/dist/assets/Events-BgvUDZye.js +0 -1
- package/dist/assets/Identity-CVki_J0y.js +0 -1
- package/dist/assets/IntegrationDetail-CFe1KUYl.js +0 -1
- package/dist/assets/IntegrationHub-DPnXLm5X.js +0 -1
- package/dist/assets/Integrations-D_Q4Q2Tu.js +0 -1
- package/dist/assets/Integrations-a2p57lhh.js +0 -1
- package/dist/assets/Locations-Bi-vKJNZ.js +0 -3
- package/dist/assets/MyAccess-Bwn4T2qP.js +0 -2
- package/dist/assets/Network-WFS_m89k.js +0 -1
- package/dist/assets/NodeAddonsSettingsPanel-DIsYvw9n.js +0 -1
- package/dist/assets/Notifications-DWRse6RT.js +0 -1
- package/dist/assets/Recordings-C9pif7GZ.js +0 -1
- package/dist/assets/ScanNetworkModal-DED--MPT.js +0 -1
- package/dist/assets/circle-slash-L3gtCdUp.js +0 -1
- package/dist/assets/client-B39fb-5f.js +0 -357
- package/dist/assets/crop-9Uo16aZV.js +0 -1
- package/dist/assets/device-picker-model-CFoBiQlw.js +0 -1
- package/dist/assets/dist-CaF0IBF0.js +0 -357
- package/dist/assets/index-4T59f71F.js +0 -4
- package/dist/assets/index-CFkS00_M.css +0 -2
- package/dist/assets/mount-CFoBiQlw.js +0 -1
- package/dist/assets/notification-schedule-field-DwaGi1xB.js +0 -1
- package/dist/assets/remoteEntry-D2ZsmuAM.js +0 -1
- package/dist/assets/src-Dj3kqlvn.js +0 -67
- package/dist/assets/useEventInvalidation-CFoBiQlw.js +0 -1
- package/dist/assets/user-round-BRSQ0WPK.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{Q as n,S as r,W as i,a,b as o,q as s,t as c,x as l,z as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{at as d,st as f}from"./player-overlays-BOmyWZfG.js";import{Cu as p,En as m,Et as h,Fn as g,Hd as _,Jl as v,Kn as y,Nd as b,Pn as x,Td as S,Tn as C,U as w,Ud as T,Yu as E,ad as D,co as O,du as k,fd as A,ld as j,pd as ee,sd as M,uo as N,zn as P}from"./src-Dj3kqlvn.js";import{t as te}from"./unlink-D-XpELXi.js";import{Jn as ne,qn as re}from"./client-B39fb-5f.js";import{t as F}from"./useTranslation-Bc5yH9V9.js";import{M as I,Y as L,t as R}from"./index-4T59f71F.js";import{t as z}from"./AdminPage-BSFohA3i.js";n();function B({value:n,size:i=192}){let[a,o]=s(null),[c,d]=s(null);if(u(()=>{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`){d(`qrcode.create() unavailable in installed version`);return}try{let e=t(n,{errorCorrectionLevel:`M`});r||o(e)}catch(e){r||d(e instanceof Error?e.message:`QR generation failed`)}}),__vite__mapDeps([0,1]),import.meta.url).catch(()=>{r||d(`qrcode library not installed`)}),()=>{r=!0}},[n]),c)return l(`div`,{className:`flex items-center justify-center text-[10px] text-foreground-subtle text-center p-4`,style:{width:i,height:i},children:`QR rendering unavailable — use the secret below.`});if(!a)return l(`div`,{className:`flex items-center justify-center text-[10px] text-foreground-subtle animate-pulse`,style:{width:i,height:i},children:`Generating…`});let f=a.modules.size,p=i/f,m=[];for(let e=0;e<f;e++)for(let t=0;t<f;t++)a.modules.data[e*f+t]&&m.push(l(`rect`,{x:t*p,y:e*p,width:p,height:p,fill:`currentColor`},`${t}-${e}`));return r(`svg`,{width:i,height:i,viewBox:`0 0 ${i} ${i}`,className:`text-black`,children:[l(`rect`,{x:0,y:0,width:i,height:i,fill:`white`}),m]})}var V=`${re}/connect`,H={public:0,mesh:1,lan:2,"lan-ipv6":3};function U(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 W(e){return ne(e)}function G(e){return e.startsWith(`https://`)}function K(e){let t=e.flatMap(e=>{let t=U(e),n=W(e.baseUrl);return t===null||n===null?[]:[{endpoint:e,tier:t,origin:n}]}).toSorted((e,t)=>H[e.tier]-H[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:G(r),plausible:e.plausible}]))}function q(e,t,n=null){for(let r of[t,n]){if(r===null)continue;let t=W(r),n=e.find(e=>e.origin===t);if(n!==void 0)return n}return e[0]??null}function J(e){let t=new URL(V);return t.searchParams.set(`hub`,e),t.toString()}n();var Y=176,X={scheme:`https`};function ie(){let{t:e}=F(),t=N(X),n=O(X).data?.roles.publicEndpoint.resolved??null;return r(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[r(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[l(p,{className:`h-3.5 w-3.5 text-foreground-subtle`}),l(`div`,{className:`text-xs font-semibold text-foreground`,children:e(`connectPhone.title`)})]}),r(`div`,{className:`p-4 space-y-3`,children:[l(`p`,{className:`text-[11px] text-foreground-subtle`,children:e(`connectPhone.description`)}),t.isPending?r(`div`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle`,children:[l(M,{className:`h-3.5 w-3.5 animate-spin`}),e(`connectPhone.loading`)]}):t.isError?r(`div`,{className:`flex items-start gap-2 text-[11px] text-danger`,children:[l(k,{className:`h-3.5 w-3.5 mt-0.5 shrink-0`}),r(`div`,{className:`flex-1 min-w-0 space-y-1.5`,children:[l(`div`,{className:`break-words`,children:e(`connectPhone.error`,{message:t.error.message})}),l(g,{size:`sm`,variant:`ghost`,onClick:()=>void t.refetch(),children:e(`connectPhone.retry`)})]})]}):l(ae,{candidates:K(t.data.endpoints),preferredOrigin:n})]})]})}function ae({candidates:e,preferredOrigin:t}){let{t:n}=F(),[a,o]=s(null),c=q(e,a,t),u=i(()=>c?J(c.origin):null,[c]);if(c===null||u===null)return l(`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 r(`div`,{className:`flex flex-col sm:flex-row gap-4`,children:[l(C,{value:u,size:Y,alt:n(`connectPhone.qrAlt`),className:`self-start`}),r(`div`,{className:`flex-1 min-w-0 space-y-3`,children:[r(`label`,{className:`block space-y-1`,children:[l(`span`,{className:`text-[11px] font-medium text-foreground`,children:n(`connectPhone.addressLabel`)}),l(x,{value:c.origin,options:f,onChange:e=>o(e.target.value)}),r(`span`,{className:`block text-[10px] text-foreground-subtle`,children:[d(c.tier),` · `,c.label]})]}),!c.secure&&l(Z,{text:n(`connectPhone.insecure`)}),!c.plausible&&l(Z,{text:n(`connectPhone.implausible`)}),r(`div`,{className:`space-y-1`,children:[l(`span`,{className:`text-[11px] font-medium text-foreground`,children:n(`connectPhone.linkLabel`)}),r(`div`,{className:`flex items-center gap-1 rounded-md border border-border bg-background px-2 py-1`,children:[l(`code`,{className:`flex-1 min-w-0 font-mono text-[11px] text-foreground break-all select-all`,children:u}),l(h,{value:u,srLabel:n(`connectPhone.linkLabel`)})]})]}),l(`p`,{className:`text-[11px] text-foreground-subtle`,children:n(`connectPhone.signInHint`)})]})]})}function Z({text:e}){return r(`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:[l(k,{className:`h-3.5 w-3.5 text-warning mt-0.5 shrink-0`}),l(`span`,{children:e})]})}n();function oe(e){return new Date(e).toLocaleDateString()}function se(){let e=y(),t=v.useUtils(),n=v.auth.listLinkableProviders.useQuery(),i=v.auth.listOwnExternalIdentities.useQuery(),[a,o]=s(null),[c]=s(()=>R(window.location.search));u(()=>{if(c===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)},[c]);let d=v.auth.beginExternalLink.useMutation({onSuccess:({url:e})=>window.location.assign(e),onError:e=>o(e.message)}),f=v.auth.unlinkOwnExternalIdentity.useMutation({onSuccess:()=>void t.auth.listOwnExternalIdentities.invalidate(),onError:e=>o(e.message)}),p=n.data??[],m=i.data??[];if(p.length===0&&m.length===0)return null;let h=new Set(m.map(e=>e.provider)),g=e=>p.find(t=>t.provider===e)?.label??e,b=async(t,n)=>{await e({title:`Unlink sign-in account`,message:`Stop signing in with this ${n} account?`,confirmLabel:`Unlink`,variant:`danger`})&&(o(null),f.mutate({provider:t.provider,subject:t.subject}))};return r(`div`,{"data-testid":`linked-sign-ins`,className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[r(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[l(j,{className:`h-3.5 w-3.5 text-foreground-subtle`}),l(`div`,{className:`text-xs font-semibold text-foreground`,children:`Linked sign-in accounts`})]}),r(`div`,{className:`p-4 space-y-3`,children:[l(`p`,{className:`text-[11px] text-foreground-subtle`,children:`Sign in with an external account instead of your password. Only accounts you link here can sign you in; your two-factor authentication still applies.`}),c?.kind===`linked`&&r(`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:[l(_,{className:`h-3.5 w-3.5 text-emerald-500 shrink-0`}),`Linked your `,g(c.provider),` account.`]}),(c?.kind===`error`||a)&&r(`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:[l(T,{className:`h-3.5 w-3.5 shrink-0`}),a??(c?.kind===`error`?c.message:``)]}),m.length>0&&l(`ul`,{className:`divide-y divide-border rounded-md border border-border`,children:m.map(e=>{let t=e.providerLabel??e.provider;return r(`li`,{className:`flex items-center gap-3 px-3 py-2 text-xs`,children:[r(`div`,{className:`flex-1 min-w-0`,children:[r(`div`,{className:`font-medium text-foreground truncate`,children:[t,!e.available&&l(`span`,{className:`ml-2 rounded bg-foreground-subtle/15 px-1.5 py-0.5 text-[10px] font-normal text-foreground-subtle`,children:`provider unavailable`})]}),r(`div`,{className:`text-[11px] text-foreground-subtle truncate`,children:[e.label??e.subject,` · linked `,oe(e.linkedAt)]})]}),r(`button`,{onClick:()=>void b(e,t),disabled:f.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:[l(te,{className:`h-3 w-3`}),`Unlink`]})]},`${e.provider}|${e.subject}`)})}),l(`div`,{className:`flex flex-wrap gap-2`,children:p.filter(e=>!h.has(e.provider)).map(e=>r(`button`,{onClick:()=>{o(null),d.mutate({provider:e.provider})},disabled:d.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:[d.isPending&&d.variables?.provider===e.provider?l(M,{className:`h-3 w-3 animate-spin`}):l(j,{className:`h-3 w-3`}),`Link `,e.label]},e.provider))})]})]})}n();var Q={view:{icon:S,cls:`bg-foreground-subtle/15 text-foreground-subtle`},create:{icon:E,cls:`bg-primary/15 text-primary`},delete:{icon:f,cls:`bg-danger/15 text-danger`}};function ce(){let{user:e,logout:t}=I();if(!e)return l(z,{children:l(`div`,{className:`text-xs text-foreground-subtle`,children:`Not signed in.`})});let n=e.isAdmin,i=e.scopes??[];return r(z,{children:[r(`div`,{className:`rounded-lg border border-border bg-surface px-4 py-3 flex items-center gap-3`,children:[l(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-full bg-primary/10 text-primary font-semibold text-base`,children:e.username.slice(0,1).toUpperCase()}),r(`div`,{className:`flex-1 min-w-0`,children:[l(`div`,{className:`text-sm font-semibold text-foreground truncate`,children:e.username}),r(`div`,{className:`text-[11px] text-foreground-subtle`,children:[n?`Administrator`:`User`,` · session id`,` `,r(`span`,{className:`font-mono`,children:[e.id.slice(0,8),`…`]})]})]})]}),n&&r(`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:[l(ee,{className:`h-4 w-4 text-primary mt-0.5 shrink-0`}),r(`div`,{children:[l(`div`,{className:`font-semibold text-foreground`,children:`Unrestricted access`}),l(`p`,{className:`text-foreground-subtle mt-0.5`,children:`Admin sessions bypass the per-call scope check. Every protected endpoint is reachable regardless of the list below.`})]})]}),l(le,{}),l(ue,{username:e.username}),l(de,{}),l(se,{}),l(ie,{}),i.length>0&&r(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[r(`div`,{className:`px-4 py-2 border-b border-border`,children:[l(`div`,{className:`text-xs font-semibold text-foreground`,children:`Granted scopes`}),l(`div`,{className:`text-[10px] text-foreground-subtle`,children:`Baked into your session token at login; sign out + back in to refresh after changes.`})]}),r(`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:[l(`div`,{children:`Type`}),l(`div`,{children:`Target`}),l(`div`,{children:`Access`})]}),l(`ul`,{className:`divide-y divide-border`,children:i.map((e,t)=>r(`li`,{className:`grid grid-cols-[100px_1fr_240px] gap-3 px-4 py-2.5 items-center text-xs`,children:[l(`span`,{className:`font-mono text-foreground-subtle`,children:e.type}),l(`span`,{className:`font-mono text-foreground`,children:e.type===`device`?w(e.selector):e.target}),l(`div`,{className:`flex items-center gap-1`,children:[`view`,`create`,`delete`].map(t=>{let n=e.access.includes(t),{icon:i,cls:a}=Q[t];return r(`span`,{className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium ${n?a:`bg-transparent text-foreground-subtle/40 line-through`}`,title:n?`Can ${t}`:`Cannot ${t}`,children:[l(i,{className:`h-3 w-3`}),t]},t)})})]},t))})]}),l(`div`,{className:`flex justify-end`,children:r(`button`,{onClick:t,className:`inline-flex items-center gap-1.5 rounded border border-border px-2.5 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-foreground-subtle/10 hover:text-foreground transition-colors`,children:[l(L,{className:`h-3 w-3`}),`Sign out`]})})]})}function le(){let e=d(),[t,n]=s(``),[i,a]=s(``),[o,u]=s(``),[f,p]=s(null),m=c({mutationFn:t=>e.changeOwnPassword(t),onSuccess:()=>{p({kind:`success`,msg:`Password updated.`}),n(``),a(``),u(``)},onError:e=>{p({kind:`error`,msg:e instanceof Error?e.message:`Update failed`})}}),h=i.length>0&&o.length>0&&i!==o,g=i.length>0&&i.length<8,v=t.length>=1&&i.length>=8&&i===o;return r(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[r(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[l(A,{className:`h-3.5 w-3.5 text-foreground-subtle`}),l(`div`,{className:`text-xs font-semibold text-foreground`,children:`Change password`})]}),r(`div`,{className:`p-4 space-y-3`,children:[l($,{label:`Current password`,value:t,onChange:n,autoComplete:`current-password`}),l($,{label:`New password`,value:i,onChange:a,autoComplete:`new-password`,hint:`At least 8 characters.`}),l($,{label:`Confirm new password`,value:o,onChange:u,autoComplete:`new-password`}),(h||g)&&l(`div`,{className:`text-[11px] text-danger`,children:h?`Passwords do not match.`:`New password must be at least 8 characters.`}),f&&r(`div`,{className:`text-[11px] flex items-center gap-1 ${f.kind===`success`?`text-emerald-500`:`text-danger`}`,children:[f.kind===`success`?l(_,{className:`h-3 w-3`}):l(T,{className:`h-3 w-3`}),f.msg]}),l(`div`,{className:`flex justify-end`,children:r(`button`,{onClick:()=>{p(null),m.mutate({currentPassword:t,newPassword:i})},disabled:!v||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?l(M,{className:`h-3 w-3 animate-spin`}):l(D,{className:`h-3 w-3`}),`Update password`]})})]})]})}function $({label:e,value:t,onChange:n,autoComplete:i,hint:a}){return r(`div`,{className:`space-y-1`,children:[l(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:e}),l(`input`,{type:`password`,value:t,onChange:e=>n(e.target.value),autoComplete:i,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`}),a&&l(`div`,{className:`text-[10px] text-foreground-subtle`,children:a})]})}function ue({username:e}){let t=d(),n=a({queryKey:[`auth`,`getOwnTotpStatus`],queryFn:()=>t.getOwnTotpStatus()}),f=n.data,[m,h]=s(null),[g,v]=s(``),[y,x]=s(null),[S,C]=s(!1),w=c({mutationFn:()=>t.setupOwnTotp(),onSuccess:e=>{h({secret:e.secret,otpauthUrl:e.otpauthUrl}),v(``),x(null)},onError:e=>x(e instanceof Error?e.message:`Setup failed`)}),E=c({mutationFn:e=>t.confirmOwnTotp(e),onSuccess:()=>{h(null),v(``),x(null),n.refetch()},onError:e=>x(e instanceof Error?e.message:`Confirmation failed — code did not match`)}),D=c({mutationFn:()=>t.disableOwnTotp(),onSuccess:()=>{x(null),n.refetch()},onError:e=>x(e instanceof Error?e.message:`Disable failed`)});u(()=>{if(!S)return;let e=setTimeout(()=>C(!1),1500);return()=>clearTimeout(e)},[S]);let O=i(()=>n.isLoading?`loading`:m?`setup_in_progress`:f?.enabled?`enrolled`:`not_enrolled`,[n.isLoading,f?.enabled,m]);return r(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[r(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[l(p,{className:`h-3.5 w-3.5 text-foreground-subtle`}),l(`div`,{className:`text-xs font-semibold text-foreground`,children:`Two-factor authentication`})]}),r(`div`,{className:`p-4 space-y-3`,children:[O===`loading`&&r(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[l(M,{className:`h-3.5 w-3.5 animate-spin`}),`Checking status…`]}),O===`not_enrolled`&&r(o,{children:[l(`div`,{className:`text-xs text-foreground-subtle`,children:`2FA isn't active on your account. Enable it to require a 6-digit code from your authenticator app at every login.`}),l(`div`,{className:`flex justify-end`,children:r(`button`,{onClick:()=>{x(null),w.mutate()},disabled:w.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:[w.isPending?l(M,{className:`h-3 w-3 animate-spin`}):l(p,{className:`h-3 w-3`}),`Enable 2FA`]})})]}),O===`setup_in_progress`&&m&&r(o,{children:[r(`div`,{className:`text-[11px] text-foreground-subtle`,children:[`Scan the QR code (or enter the secret manually) into your authenticator app for`,` `,l(`span`,{className:`font-mono`,children:e}),`, then enter the 6-digit code below to confirm.`]}),r(`div`,{className:`flex flex-col items-center gap-3`,children:[l(`div`,{className:`rounded-lg border border-border bg-white p-3`,children:l(B,{value:m.otpauthUrl,size:180})}),r(`div`,{className:`w-full`,children:[l(`div`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle mb-1`,children:`Secret (manual entry)`}),r(`div`,{className:`flex items-center gap-2 rounded border border-border bg-surface-hover/30 px-2 py-1.5`,children:[l(`code`,{className:`text-[11px] font-mono text-foreground break-all flex-1`,children:m.secret}),r(`button`,{onClick:()=>{m&&navigator.clipboard.writeText(m.secret).then(()=>C(!0))},className:`inline-flex items-center gap-1 text-[10px] text-foreground-subtle hover:text-foreground`,children:[S?l(_,{className:`h-3 w-3 text-emerald-500`}):l(b,{className:`h-3 w-3`}),S?`Copied`:`Copy`]})]})]})]}),r(`div`,{className:`space-y-1`,children:[l(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`6-digit code`}),l(`input`,{type:`text`,inputMode:`numeric`,autoComplete:`one-time-code`,placeholder:`123456`,value:g,onChange:e=>v(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`})]}),y&&r(`div`,{className:`text-[11px] text-danger flex items-center gap-1`,children:[l(T,{className:`h-3 w-3`}),y]}),r(`div`,{className:`flex justify-end gap-2`,children:[l(`button`,{onClick:()=>{h(null),x(null),v(``)},className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Cancel`}),r(`button`,{onClick:()=>{x(null),E.mutate({code:g})},disabled:E.isPending||g.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:[E.isPending?l(M,{className:`h-3 w-3 animate-spin`}):l(_,{className:`h-3 w-3`}),`Confirm`]})]})]}),O===`enrolled`&&f&&r(o,{children:[r(`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:[l(_,{className:`h-4 w-4 mt-0.5 text-emerald-500 shrink-0`}),r(`div`,{className:`text-xs text-foreground space-y-0.5`,children:[l(`div`,{className:`font-medium`,children:`2FA is active`}),r(`div`,{className:`text-foreground-subtle`,children:[`Enrolled on`,` `,f.confirmedAt?new Date(f.confirmedAt).toLocaleString():`—`]})]})]}),y&&r(`div`,{className:`text-[11px] text-danger flex items-center gap-1`,children:[l(T,{className:`h-3 w-3`}),y]}),l(`div`,{className:`flex justify-end`,children:r(`button`,{onClick:()=>{x(null),D.mutate()},disabled:D.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:[D.isPending?l(M,{className:`h-3 w-3 animate-spin`}):l(p,{className:`h-3 w-3`}),`Disable 2FA`]})})]})]})]})}function de(){return P(`auth-webauthn/passkey-enrollment`)?l(m,{widgetId:`auth-webauthn/passkey-enrollment`,host:`dashboard`}):null}export{ce 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{E as u,I as d,X as f,at as p,ct as m,lt as h,st as g,vt as _}from"./player-overlays-BOmyWZfG.js";import{$l as v,Co as y,Cr as b,Do as x,Dt as S,Du as ee,Ed as C,Fn as w,Ju as T,Kd as te,Lu as ne,Mn as re,Mt as ie,Nd as E,Nt as ae,Nu as D,Oo as oe,Ou as se,Pn as ce,So as le,Sr as O,Vu as ue,Xl as de,Zu as k,_l as fe,_o as pe,ad as me,bo as he,bu as ge,co as _e,do as ve,du as A,er as j,fo as ye,go as be,hf as xe,ho as Se,jt as Ce,kn as M,ko as we,kt as Te,lo as Ee,mo as De,oa as Oe,on as ke,po as Ae,qu as je,sd as N,sn as Me,so as Ne,vo as Pe,wo as Fe,xo as Ie,yo as Le}from"./src-Dj3kqlvn.js";import{t as P}from"./boxes-BvyAsUqS.js";import{Gn as Re,Kn as ze,Un as Be,yn as F}from"./client-B39fb-5f.js";import"./mount-CFoBiQlw.js";import{X as I,Y as Ve,i as L,r as R}from"./index-4T59f71F.js";import{t as He}from"./AdminPage-BSFohA3i.js";import{t as Ue}from"./NodeAddonsSettingsPanel-DIsYvw9n.js";import{t as We}from"./AdminTabs-BhOeTpzS.js";import{n as z,r as Ge,t as B}from"./IntegrationHub-DPnXLm5X.js";import{n as V,t as H}from"./addon-display-names-BkwMrExv.js";var Ke=_(`file-up`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`m15 15-3-3-3 3`,key:`15xj92`}]]),qe=_(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]);n();var U=5e3,W=`network-access`,Je={connected:!1,endpoint:null};function Ye(){let e=o(),t=b({capName:`network-access`},{refetchInterval:U}),n=O(void 0,{refetchInterval:U}),r=i(()=>H(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]),[l,u]=s(null),[d,f]=s({}),p=(t,n)=>{let r=n?.addonId;e.invalidateQueries({queryKey:[[`networkAccess`,`getStatus`],{input:{addonId:r},type:`query`}]}),u(null),f(e=>{if(r===void 0||!(r in e))return e;let t={...e};return delete t[r],t})},m=(e,t)=>{u(null);let n=t?.addonId;if(n===void 0)return;let r=e instanceof Error?e.message:String(e);f(e=>({...e,[n]:r}))},h=oe({onSuccess:p,onError:m}),g=we({onSuccess:p,onError:m});return c(B,{icon:I,title:`Remote Access`,subtitle:`Public-facing tunnels that expose this hub to the internet (Cloudflare Tunnel, ngrok, …).`,groups:[{id:W,label:`Remote access`,install:{capability:W,label:`Add tunnel`},entries:a.map(e=>({id:e.addonId,name:e.displayName,fallbackIcon:I,...V(e.isActive),render:()=>c(z,{addonId:e.addonId,displayName:e.displayName,capName:W,isActive:e.isActive,badges:c(Ze,{addonId:e.addonId}),error:d[e.addonId]??null,primaryAction:c(Qe,{addonId:e.addonId,busyId:l,onStart:e=>{u(e),h.mutate({addonId:e})},onStop:e=>{u(e),g.mutate({addonId:e})}})})}))}],isLoading:t.isLoading,emptyTitle:`No remote-access providers installed`,emptyDescription:`Install a tunnel addon (e.g. @camstack/addon-cloudflare) to expose this hub publicly.`})}function Xe(e){let{data:t}=x({addonId:e},{refetchInterval:U,retry:!1}),n=t?Be.safeParse(t):null;return n?.success?n.data:Je}function Ze({addonId:e}){let t=Xe(e);return r(a,{children:[c(j,{variant:t.connected?`success`:`default`,className:Ge,children:t.connected?`Connected`:`Disconnected`}),t.endpoint&&r(`a`,{href:t.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(C,{className:`h-3 w-3`}),t.endpoint.url]})]})}function Qe({addonId:e,busyId:t,onStart:n,onStop:i}){let a=Xe(e),o=t===e;return a.connected?r(w,{size:`sm`,variant:`secondary`,disabled:o,onClick:()=>i(e),children:[o?c(N,{className:`h-3 w-3 animate-spin`}):c(m,{className:`h-3 w-3`}),`Stop`]}):r(w,{size:`sm`,variant:`primary`,disabled:o,onClick:()=>n(e),children:[o?c(N,{className:`h-3 w-3 animate-spin`}):c(T,{className:`h-3 w-3`}),`Start`]})}n();var $e=3e4,G=`turn-provider`;function et(e){let t=[];for(let n of e)typeof n.urls==`string`?t.push(n.urls):t.push(...n.urls);return t}function tt(){let e=b({capName:`turn-provider`},{refetchInterval:$e}),t=O(void 0,{refetchInterval:$e}),n=fe(),a=n.data??[],o=i(()=>H(t.data??[]),[t.data]),s=i(()=>(e.data??[]).map(e=>({addonId:e.addonId,displayName:o.get(e.addonId)??e.addonId,isActive:e.isActive})),[e.data,o]);return c(B,{icon:k,title:`TURN Servers`,subtitle:`ICE servers used for WebRTC NAT traversal. Multiple providers can coexist — the WebRTC layer concatenates servers from all enabled providers per session.`,groups:[{id:G,label:`TURN providers`,install:{capability:G,label:`Add provider`},entries:s.map(e=>({id:e.addonId,name:e.displayName,fallbackIcon:k,...V(e.isActive),render:()=>c(z,{addonId:e.addonId,displayName:e.displayName,capName:G,isActive:e.isActive,panels:[{id:`ice-servers`,title:`Discovered ICE servers`,icon:k,content:c(nt,{addonId:e.addonId,enabled:e.isActive})}]})}))}],isLoading:e.isLoading,emptyTitle:`No TURN providers installed`,emptyDescription:`Install a TURN addon (e.g. @camstack/addon-cloudflare) to enable WebRTC behind restrictive NATs.`,trailing:c(ie,{headingId:`turn-combined-ice`,title:`Combined ICE server list — all enabled providers`,icon:k,actions:c(w,{size:`sm`,variant:`secondary`,onClick:()=>n.refetch(),disabled:n.isFetching,children:`Refresh`}),children:c(`div`,{className:u,children:a.length===0?c(`div`,{className:`text-xs text-foreground-subtle`,children:`No servers from enabled providers.`}):c(`div`,{className:`flex flex-col gap-3`,children:a.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 nt({addonId:e,enabled:t}){let n=fe({addonId:e},{enabled:t,retry:!1}),r=i(()=>et(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 rt={lan:k,wifi:v,docker:P,vpn:me,loopback:D,other:D},it={lan:`LAN`,wifi:`Wi-Fi`,docker:`Docker`,vpn:`VPN`,loopback:`Loopback`,other:`Other`},at=[`lan`,`wifi`,`vpn`,`docker`,`other`,`loopback`];function ot(e){let{interfaces:t,disabled:n,hideLoopback:a,ipv4Only:o,emptyMessage:s}=e,l=i(()=>t.filter(e=>!(a&&e.kind===`loopback`||o&&e.family!==`IPv4`)),[t,a,o]),u=i(()=>{let e=new Map;for(let t of l){let n=e.get(t.kind)??[];n.push(t),e.set(t.kind,n)}return at.filter(t=>e.has(t)).map(t=>({kind:t,items:e.get(t)}))},[l]),d=t=>e.mode===`single`?e.value===t:e.value.includes(t),f=t=>{if(n||t.kind===`loopback`)return;if(e.mode===`single`){e.onChange(e.value===t.address?null:t.address);return}let r=new Set(e.value);r.has(t.address)?r.delete(t.address):r.add(t.address),e.onChange([...r])};return l.length===0?c(`div`,{className:`text-xs text-foreground-subtle italic`,children:s??`No addresses available.`}):c(`div`,{className:`flex flex-col gap-3`,children:u.map(({kind:t,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(rt[t]??D,{className:`h-3.5 w-3.5 text-foreground-subtle`}),c(`span`,{className:`text-[11px] font-semibold uppercase tracking-wide text-foreground-subtle`,children:it[t]??t}),r(`span`,{className:`text-[10px] text-foreground-subtle`,children:[`· `,i.length]})]}),c(`ul`,{className:`divide-y divide-border`,children:i.map(t=>{let i=d(t.address),a=t.kind===`loopback`,o=!t.plausible&&!a;return r(`li`,{className:`flex items-center gap-3 px-3 py-2 ${a?`opacity-60 cursor-not-allowed`:n?`opacity-60`:o?`cursor-pointer hover:bg-surface-hover/30 bg-amber-500/[0.04]`:`cursor-pointer hover:bg-surface-hover/30`}`,onClick:()=>f(t),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(te,{className:`h-3 w-3`})}),r(`div`,{className:`flex-1 min-w-0 ${o?`text-foreground-subtle`:``}`,children:[r(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[c(`span`,{className:`font-mono text-xs font-semibold ${o?`text-foreground-subtle`:`text-foreground`}`,children:t.name}),c(`span`,{className:`text-[10px] rounded px-1.5 py-0.5 bg-foreground-subtle/10 text-foreground-subtle font-mono`,children:t.family}),t.preferred&&c(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium bg-primary/15 text-primary`,children:`Auto-preferred`}),a&&c(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium bg-foreground-subtle/15 text-foreground-subtle`,children:`Always included`}),o&&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:t.plausibleReason||void 0,children:[c(A,{className:`h-2.5 w-2.5`}),`Unlikely usable`]})]}),r(`div`,{className:`text-xs text-foreground-subtle mt-0.5 font-mono break-all`,children:[t.address,t.cidr&&t.cidr!==t.address?` (${t.cidr})`:``]})]})]},`${t.name}-${t.family}-${t.address}`)})})]},t))})}var K=[{role:`appConnections`,title:`App connections`,single:!1,help:`Addresses the CamStack apps try when connecting; tick several. Automatic: LAN addresses plus your public tunnel.`},{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.`}],st=`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 q(e,t){return e.inUse.includes(t)}function ct(e,t){if(!e.eligible.includes(t))return{kind:`none`};if(e.kind===`app-link`)return q(e,t)?{kind:`none`}:{kind:`set`,input:{role:t,baseUrl:null,enabled:!0}};if(e.flags.includes(t)||t===`appConnections`&&q(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:Re}:{kind:`set`,input:n}}function lt(e){return K.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 ut={"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 dt({book:e,loading:t,saving:n,error:i,onSetRole:a,onAdd:o,onRemove:l}){let[u,d]=s(``),[f,p]=s(``),[m,h]=s(null),[_,v]=s(null),y=()=>{let e=ze(u);if(!e.ok){h(e.reason);return}h(null),d(``),p(``),o(e.baseUrl,f.trim())},b=(e,t)=>{let n=ct(e,t.role);if(n.kind!==`none`){if(n.kind===`confirm-http`){v({input:n.input,reason:n.reason});return}v(null),a(n.input)}},x=[{key:`url`,header:`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??`none (no tunnel or Tailscale)`]}),t.custom&&t.detected&&c(`span`,{children:`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(A,{className:`h-2.5 w-2.5`}),`Unlikely usable`]})]})]})},{key:`kind`,header:`Kind`,nowrap:!0,render:e=>{let t=ut[e.kind]??ut.loopback;return c(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium ${t.className}`,children:t.label})}},...K.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=q(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?`${e.title}: in use automatically. ${e.help}`:e.help:`This address cannot be used for this.`,children:[c(ke,{checked:i&&o,disabled:!i||n,onChange:()=>b(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(w,{size:`sm`,variant:`ghost`,disabled:n,onClick:()=>l(e.baseUrl),"aria-label":`Remove ${e.baseUrl}`,title:`Remove this custom address (its roles turn automatic)`,children:c(g,{className:`h-3 w-3`})}):null}],S=e===void 0?[]:lt(e);return r(M,{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:`Addresses`}),c(`div`,{className:`text-xs text-foreground-subtle max-w-3xl`,children:`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:`What are roles?`}),c(`dl`,{className:`mt-1.5 grid grid-cols-[auto_1fr] gap-x-3 gap-y-1`,children:K.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:st})]})]}),S.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:S.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?`(automatic)`:`(set by you)`})]}),e.automatic?c(`span`,{}):c(w,{size:`sm`,variant:`secondary`,disabled:n,onClick:()=>a({role:e.role,baseUrl:null,enabled:!1}),children:`Use automatic`})]},e.role))}),_!==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(A,{className:`h-3.5 w-3.5 text-amber-600`}),c(`span`,{className:`flex-1 min-w-[220px]`,children:_.reason}),c(w,{size:`sm`,variant:`secondary`,onClick:()=>{a({..._.input,acceptInsecureHttp:!0}),v(null)},children:`Use http anyway`}),c(w,{size:`sm`,variant:`ghost`,onClick:()=>v(null),children:`Cancel`})]}),i!==null&&c(`div`,{className:`text-[11px] text-red-600 dark:text-red-400`,role:`alert`,children:i})]}),c(ae,{columns:x,rows:e?.rows??[],rowKey:e=>`${e.kind}-${e.baseUrl}`,minWidthPx:760,bordered:!1,mobileMode:`scroll`,emptyMessage:t?`Loading…`:`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(Me,{value:u,onChange:e=>{d(e.target.value),h(null)},placeholder:`https://cams.example.com or https://192.168.1.50:4443`,"aria-label":`Custom address`,disabled:n}),m!==null&&c(`div`,{className:`mt-1 text-[11px] text-red-600 dark:text-red-400`,children:m})]}),c(`div`,{className:`w-48`,children:c(Me,{value:f,onChange:e=>p(e.target.value),placeholder:`Label (optional)`,"aria-label":`Custom address label`,maxLength:80,disabled:n})}),r(w,{size:`sm`,variant:`secondary`,disabled:n||u.trim()===``,onClick:y,children:[c(je,{className:`h-3 w-3`}),`Add custom address`]})]})]})}n();function ft(){let e=o(),t=()=>{e.invalidateQueries({queryKey:[[`localNetwork`]]})},n=ye(void 0,{refetchInterval:3e4}),a=Ee(void 0),u=Pe({onSuccess:t}),d=Se({onSuccess:e=>{x(e.addresses),t()}}),f=i(()=>n.data?.interfaces??[],[n.data]),p=_e({scheme:typeof window<`u`&&window.location.protocol===`https:`?`https`:`http`},{refetchInterval:3e4}),m=pe({onSuccess:t}),g=Ne({onSuccess:t}),_=De({onSuccess:t}),v=m.error?.message??g.error?.message??_.error?.message??null,y=m.isPending||g.isPending||_.isPending,[b,x]=s([]),[S,ee]=s(!1);l(()=>{!S&&a.data&&(x(a.data.addresses),ee(!0))},[a.data,S]);let C=a.data?.addresses??[],T=i(()=>{if(b.length!==C.length)return!0;let e=[...b].toSorted(),t=[...C].toSorted();return e.some((e,n)=>e!==t[n])},[b,C]);return r(He,{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:`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(w,{size:`sm`,variant:`secondary`,onClick:()=>{n.refetch(),a.refetch(),p.refetch()},disabled:n.isLoading,children:[c(ue,{className:`h-3 w-3 ${n.isLoading?`animate-spin`:``}`}),`Refresh`]})})]}),r(M,{children:[r(`div`,{className:`px-4 py-3 border-b border-border flex items-center justify-between gap-3 flex-wrap`,children:[r(`div`,{children:[c(`div`,{className:`text-sm font-semibold`,children:`Allowed addresses`}),c(`div`,{className:`text-xs text-foreground-subtle`,children:b.length===0?`Auto — every non-loopback / non-link-local interface participates.`:`${b.length} pinned`})]}),r(`div`,{className:`flex items-center gap-1`,children:[r(w,{size:`sm`,variant:`secondary`,onClick:()=>d.mutate(void 0),disabled:d.isPending||u.isPending,title:`Re-run the auto-detection heuristic + overwrite the current allowlist with the best matches.`,children:[c(ge,{className:`h-3 w-3`}),d.isPending?`Detecting…`:`Best match`]}),r(w,{size:`sm`,variant:`secondary`,onClick:()=>{x([])},disabled:b.length===0||u.isPending,children:[c(h,{className:`h-3 w-3`}),`Clear`]}),T&&c(w,{size:`sm`,variant:`secondary`,onClick:()=>{x(C)},disabled:u.isPending,children:`Discard`}),r(w,{size:`sm`,variant:`primary`,onClick:()=>{u.mutate({addresses:[...b]})},disabled:!T||u.isPending,children:[c(ne,{className:`h-3 w-3`}),u.isPending?`Saving…`:`Save`]})]})]}),c(`div`,{className:`p-4`,children:c(ot,{mode:`multiple`,interfaces:f,value:b,onChange:x,disabled:u.isPending,emptyMessage:n.isLoading?`Loading interfaces…`:`No interfaces detected.`})})]}),c(dt,{book:p.data,loading:p.isLoading,saving:y,error:v,onSetRole:e=>m.mutate({...e}),onAdd:(e,t)=>g.mutate({baseUrl:e,label:t}),onRemove:e=>_.mutate({baseUrl:e})})]})}n();var pt={mesh:`bg-violet-500/15 text-violet-700 dark:text-violet-300`,public:`bg-blue-500/15 text-blue-700 dark:text-blue-300`},J=5e3,Y=`mesh-network`,mt=3e4,ht={joined:!1,meshIp:``,magicDnsHostname:``,peerCount:0,endpoints:[],tenantName:``,magicDnsSuffix:``,userLogin:null,controlPlaneUrl:``,keyExpiry:null};function gt(){let e=b({capName:`mesh-network`},{refetchInterval:J}),t=O(void 0,{refetchInterval:J}),n=i(()=>H(t.data??[]),[t.data]),r=i(()=>(e.data??[]).map(e=>({addonId:e.addonId,displayName:n.get(e.addonId)??e.addonId,isActive:e.isActive})),[e.data,n]);return c(B,{icon:P,title:`Mesh Networks`,subtitle:`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:[{id:Y,label:`Mesh networks`,install:{capability:Y,label:`Add mesh`},entries:r.map(e=>({id:e.addonId,name:e.displayName,fallbackIcon:k,...V(e.isActive),render:()=>c(z,{addonId:e.addonId,displayName:e.displayName,capName:Y,isActive:e.isActive,badges:c(_t,{addonId:e.addonId}),primaryAction:c(vt,{addonId:e.addonId}),panels:[{id:`status`,title:`Status`,icon:P,content:c(yt,{addonId:e.addonId})}]})}))}],isLoading:e.isLoading,emptyTitle:`No mesh-network providers installed`,emptyDescription:`Install a mesh addon (e.g. @camstack/addon-tailscale) to join this hub into a private VPN mesh.`})}function X(e){let{data:t,isLoading:n}=he({addonId:e},{refetchInterval:J,retry:!1}),r=t?F.safeParse(t):null;return{status:r?.success?r.data:ht,isLoading:n}}function _t({addonId:e}){let{status:t}=X(e);return r(a,{children:[c(j,{variant:t.joined?`success`:`default`,className:Ge,children:t.joined?`Joined`:`Not joined`}),t.joined&&r(j,{className:`text-[10px]`,children:[t.peerCount,` peer`,t.peerCount===1?``:`s`]})]})}function vt({addonId:t}){let n=o(),[i,l]=s(!1),[u,d]=s(null),f=p(),{status:m}=X(t),h=e(()=>{n.invalidateQueries({queryKey:[[`meshNetwork`]]})},[n]),g=Fe(),_=Ie({onSuccess:h}),v=y({onSuccess:h}),b=e(async()=>{l(!0);let e={cancelled:!1};d(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 Et(2e3),!e.cancelled);){let e=await f.trpcClient.meshNetwork.getStatus.query({addonId:t}).catch(()=>null),n=e?F.safeParse(e):null;if(n?.success&&n.data.joined){h();break}if(Date.now()-r>6e5)break}}finally{l(!1),d(null)}},[t,h,g,f]),x=e(()=>{u&&(u.cancelled=!0),l(!1),d(null)},[u]);return c(a,{children:m.joined?r(a,{children:[r(w,{size:`sm`,variant:`secondary`,disabled:_.isPending,onClick:()=>_.mutate({addonId:t}),children:[_.isPending?c(N,{className:`h-3 w-3 animate-spin`}):c(Ve,{className:`h-3 w-3`}),`Disconnect`]}),r(w,{size:`sm`,variant:`ghost`,disabled:v.isPending,onClick:()=>v.mutate({addonId:t}),children:[v.isPending?c(N,{className:`h-3 w-3 animate-spin`}):c(se,{className:`h-3 w-3`}),`Log out`]})]}):i?r(w,{size:`sm`,variant:`ghost`,onClick:x,children:[c(de,{className:`h-3 w-3 mr-1`}),` Cancel`]}):r(a,{children:[r(w,{size:`sm`,variant:`primary`,onClick:()=>void b(),children:[c(qe,{className:`h-3 w-3`}),`Connect`]}),r(w,{size:`sm`,variant:`ghost`,disabled:v.isPending,onClick:()=>v.mutate({addonId:t}),children:[v.isPending?c(N,{className:`h-3 w-3 animate-spin`}):c(se,{className:`h-3 w-3`}),`Log out`]})]})})}function yt({addonId:e}){let{status:t}=X(e),n=le({addonId:e},{refetchInterval:mt,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:[t.error&&c(re,{message:t.error}),c(bt,{status:t}),t.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:`Endpoints`}),t.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 ${pt[e.scope]??`bg-foreground-subtle/15 text-foreground-subtle`}`,children:[e.scope===`public`?c(I,{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(C,{className:`h-3 w-3 shrink-0`}),e.url]})]},e.id))]})]}),c(`div`,{className:`border-t border-border`,children:c(St,{peers:n.data?.peers??[],loading:n.isLoading})})]})}function bt({status:e}){return c(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-1.5`,children:[{label:`Tenant`,value:e.tenantName||`—`},{label:`User`,value:e.userLogin??`—`},{label:`Control plane`,value:e.controlPlaneUrl||`—`},{label:`Mesh IP`,value:e.meshIp||`—`,mono:!0},{label:`MagicDNS`,value:e.magicDnsHostname||`—`,mono:!0},{label:`DNS suffix`,value:e.magicDnsSuffix||`—`,mono:!0},{label:`Peers`,value:String(e.peerCount)},{label:`Key expiry`,value:e.keyExpiry?xt(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 xt(e){let t=e-Date.now();if(t<0)return`Expired ${Tt(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 St({peers:t,loading:n}){let a=i(()=>t.map(e=>({...e,_id:e.id})),[t]),o=e(e=>{e&&navigator.clipboard?.writeText(e)},[]),s=i(()=>[{key:`hostname`,header:`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||`(unknown)`}),e.isSelf&&c(j,{variant:`info`,children:`self`}),e.exitNodeOption&&c(j,{variant:`warning`,children:`exit-node`})]}),e.userLogin&&c(`div`,{className:`text-[10px] text-foreground-subtle truncate`,children:e.userLogin})]})},{key:`magicDns`,header:`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:()=>o(e.magicDns),className:`p-0.5 hover:bg-foreground-subtle/10 rounded`,"aria-label":`Copy MagicDNS`,children:c(E,{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:()=>o(t),className:`p-0.5 hover:bg-foreground-subtle/10 rounded`,"aria-label":`Copy IP`,children:c(E,{className:`h-3 w-3 text-foreground-subtle`})})]}):c(`span`,{className:`text-foreground-subtle`,children:`—`})}},{key:`connection`,header:`Connection`,render:e=>r(`div`,{className:`flex items-center gap-1.5`,children:[c(j,{variant:Ct(e.connection),children:e.connection}),e.relay&&c(`span`,{className:`text-[10px] text-foreground-subtle font-mono`,children:e.relay})]})},{key:`routes`,header:`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:`TX / RX`,render:e=>r(`span`,{className:`text-[10px] text-foreground-subtle font-mono`,children:[`↑ `,wt(e.txBytes),` · ↓ `,wt(e.rxBytes)]})},{key:`lastSeen`,header:`Last seen`,render:e=>c(`span`,{className:`text-[10px] text-foreground-subtle`,children:e.lastSeenMs>0?Tt(e.lastSeenMs):`—`})}],[o]);return n&&t.length===0?r(`div`,{className:`p-4 text-xs text-foreground-subtle`,children:[c(N,{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:`No peers visible — your tailnet may be empty or the host is not joined.`}):c(`div`,{className:`p-4`,children:c(ae,{columns:s,rows:a,rowKey:e=>e._id,minWidthPx:820})})}function Ct(e){return e===`direct`?`success`:e===`relay`?`warning`:`info`}function wt(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 Tt(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 Et(e){return new Promise(t=>setTimeout(t,e))}var Dt=/-----BEGIN CERTIFICATE-----[\s\S]+?-----END CERTIFICATE-----/,Z=/-----BEGIN ((?:RSA |EC |ENCRYPTED )?PRIVATE KEY)-----[\s\S]+?-----END \1-----/,Ot={certificate:`.pem,.crt,.cer`,privateKey:`.pem,.key`,ca:`.pem,.crt,.cer`};function Q(e,t){if(t.trim()===``)return null;if(e===`privateKey`){let e=Z.exec(t);return e===null?Dt.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 Dt.test(t)?e===`certificate`&&Z.test(t)?`This file also contains a private key. Pick the certificate file, and the key in its own field.`:null:Z.test(t)?`This is a private key, not a certificate.`:`Not a PEM certificate — expected -----BEGIN CERTIFICATE-----.`}function kt(e){return e.text()}n();function $({kind:e,label:n,value:i,onChange:a,rows:o=6}){let l=t(null),[u,d]=s(null),[f,p]=s(null),m=f??Q(e,i),h=`pem-${e}`,g=async e=>{let t=e.target.files?.[0];if(e.target.value=``,t!==void 0){d(t.name);try{let e=await kt(t);p(null),a(e)}catch(e){p(`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:h,className:`text-[11px] text-foreground-subtle`,children:n}),r(`div`,{className:`flex min-w-0 items-center gap-2`,children:[u!==null&&c(`span`,{className:`truncate font-mono text-[10px] text-foreground-subtle`,"data-testid":`${h}-file-name`,children:u}),c(`input`,{ref:l,type:`file`,accept:Ot[e],onChange:e=>void g(e),className:`hidden`,"data-testid":`${h}-file`}),r(w,{size:`sm`,variant:`outline`,type:`button`,onClick:()=>l.current?.click(),children:[c(Ke,{className:`mr-1 h-3 w-3`}),`Choose file`]})]})]}),c(`textarea`,{id:h,value:i,onChange:e=>{d(null),p(null),a(e.target.value)},rows:o,"aria-invalid":m!==null,className:`w-full rounded border border-border bg-surface px-2 py-1 font-mono text-[11px]`}),m!==null&&c(`p`,{className:`text-[11px] text-danger`,role:`alert`,children:m})]})}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 e=o(),t=ve(void 0,{refetchInterval:15e3}),n=Ae({onSuccess:()=>void e.invalidateQueries({queryKey:[[`localNetwork`]]})}),i=be({onSuccess:()=>void e.invalidateQueries({queryKey:[[`localNetwork`]]})}),a=Le({onSuccess:()=>{d(!1),p(``),h(``),_(``),e.invalidateQueries({queryKey:[[`localNetwork`]]})}}),l=t.data,[u,d]=s(!1),[f,p]=s(``),[m,h]=s(``),[g,_]=s(``),v=()=>{if(!l?.caCertPem)return;let e=new Blob([l.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)},y=l?.mode===`uploaded`?`Uploaded`:l?.mode===`generated`?`Generated local CA`:`TLS disabled`;return r(`div`,{className:`flex flex-col gap-4`,children:[c(Ue,{nodeId:`hub`,addonIds:[`local-network`],level:`global`,title:`LAN HTTP`,description:`Native apps on this Wi-Fi use http:// and skip the private certificate. The tunnel and this admin UI stay on HTTPS.`}),r(M,{className:`p-4 space-y-3`,children:[r(`div`,{className:`flex items-center gap-2`,children:[c(ee,{className:`h-4 w-4 text-foreground-subtle`}),c(`h3`,{className:`text-sm font-semibold`,children:`Certificate`})]}),t.isError&&c(`p`,{className:`text-xs text-danger`,children:`Could not read TLS status.`}),l?.reissueError&&c(`p`,{className:`rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-[11px] text-amber-700 dark:text-amber-300`,children:l.reissueError}),l?.restartRequired&&c(`p`,{className:`rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-[11px] text-amber-700 dark:text-amber-300`,children:`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:`Mode`}),c(`dd`,{className:`font-medium`,children:y})]}),r(`div`,{children:[c(`dt`,{className:`text-foreground-subtle`,children:`Valid to`}),c(`dd`,{className:`font-mono`,children:l?.validTo?new Date(l.validTo).toLocaleString():`—`})]}),r(`div`,{children:[c(`dt`,{className:`text-foreground-subtle`,children:`Leaf SHA-256`}),c(`dd`,{className:`font-mono`,title:l?.leafFingerprintSha256??void 0,children:At(l?.leafFingerprintSha256??null)})]}),r(`div`,{children:[c(`dt`,{className:`text-foreground-subtle`,children:`CA SHA-256`}),c(`dd`,{className:`font-mono`,title:l?.caFingerprintSha256??void 0,children:l?.mode===`uploaded`&&l.caFingerprintSha256===null?c(`span`,{className:`font-sans text-foreground-subtle`,children:`Issuer not included in the upload (not the local CA)`}):At(l?.caFingerprintSha256??null)})]})]}),l&&l.sans.length>0&&c(`div`,{className:`flex flex-wrap gap-1`,children:l.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(S,{label:`Regenerate`,title:`Issue a new leaf?`,description:`Issues a new leaf under the current local CA. Clients that trust the CA keep working. The HTTPS listener reloads.`,confirmLabel:`Regenerate`,disabled:l?.mode===`uploaded`||n.isPending,action:()=>n.mutateAsync({})}),c(w,{size:`sm`,variant:`outline`,onClick:()=>d(e=>!e),children:`Upload`}),l?.caCertPem&&c(w,{size:`sm`,variant:`outline`,onClick:v,children:`Download CA`}),l?.mode===`uploaded`&&c(S,{label:`Revert to generated`,title:`Drop the uploaded certificate?`,description:`Deletes the uploaded pair and returns to the generated local CA.`,confirmLabel:`Revert`,confirmVariant:`danger`,disabled:i.isPending,action:()=>i.mutateAsync({})})]}),u&&r(`div`,{className:`space-y-2 border-t border-border pt-3`,children:[c($,{kind:`certificate`,label:`Certificate or full chain (PEM)`,value:f,onChange:p}),c($,{kind:`privateKey`,label:`Private key (PEM)`,value:m,onChange:h}),c($,{kind:`ca`,label:`CA (PEM, optional)`,value:g,onChange:_,rows:4}),c(w,{size:`sm`,disabled:!f.trim()||!m.trim()||Q(`certificate`,f)!==null||Q(`privateKey`,m)!==null||Q(`ca`,g)!==null||a.isPending,onClick:()=>a.mutate({certPem:f,keyPem:m,...g.trim()?{caPem:g}:{}}),children:`Save certificate`}),a.isError&&c(`p`,{className:`text-xs text-danger`,children:a.error instanceof Error?a.error.message:`Upload failed`})]})]})]})}n();function Mt({value:e,onChange:t}){let{data:n}=Oe({isCamera:!0,projection:`slim`}),a=i(()=>n===void 0?[{value:``,label:`Loading cameras…`}]:n.length===0?[{value:``,label:`No cameras`}]:[{value:``,label:`Pick a camera`},...n.toSorted((e,t)=>e.name.localeCompare(t.name)).map(e=>({value:String(e.id),label:`${e.name} (#${String(e.id)})`}))],[n]);return r(`label`,{className:`flex min-w-0 flex-col gap-1`,children:[c(`span`,{className:`text-[11px] text-foreground-subtle`,children:`Camera`}),c(ce,{value:e===null?``:String(e),disabled:n===void 0||n.length===0,onChange:e=>t(e.target.value===``?null:Number(e.target.value)),options:a})]})}function Nt(){let t=p(),[n,i]=s(null);return r(`div`,{className:d,"data-testid":`network-diagnostics`,children:[c(Ce,{loadServers:e(async()=>t.trpcClient.turnProvider.getTurnServers.query(),[t])}),c(Te,{trpc:t.trpcClient,serverUrl:f(),deviceId:n,cameraField:c(Mt,{value:n,onChange:i})})]})}function Pt(){return c(`div`,{className:`flex flex-col p-4`,children:c(We,{defaultTab:`addresses`,tabs:[{id:`local-access`,label:`Local access`,icon:v,content:c(jt,{})},{id:`addresses`,label:`Network Addresses`,icon:D,content:c(ft,{})},{id:L.remoteAccess.tab,label:`Remote Access`,icon:I,content:c(Ye,{}),ownedParams:R},{id:L.mesh.tab,label:`Mesh Networks`,icon:P,content:c(gt,{}),ownedParams:R},{id:L.turn.tab,label:`TURN Servers`,icon:k,content:c(tt,{}),ownedParams:R},{id:`diagnostics`,label:`Diagnostics`,icon:xe,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{at as h}from"./player-overlays-BOmyWZfG.js";import{Ai as g,Sr as _,Ur as v,fr as y,pr as ee}from"./src-Dj3kqlvn.js";import{ai as te}from"./client-B39fb-5f.js";import{A as b,D as ne,O as re,j as x,k as ie}from"./index-4T59f71F.js";r();var S=c(function({addonId:r,schema:i,serverValues:o,onImmediateSave:s,onStateChange:c,onAction:l,disabled:u},d){let f=x({schema:i,serverValues:o,onImmediateSave:t(e=>s(r,e),[r,s]),onDeferredSave:t(()=>{},[])});e(d,()=>({flush:()=>{let e={};for(let t of f.pendingKeys)e[t]=f.values[t];return f.handleDiscard(f.pendingKeys),e},discard:()=>f.resetAll()}),[f]);let h=f.pendingKeys,g=h.join(`|`),_=a(()=>h.map(e=>`${e}=${JSON.stringify(f.values[e])}`).join(`,`),[h,f.values]),v=n(c);m(()=>{v.current=c},[c]),m(()=>{let e={};for(let t of h)e[t]=f.values[t];v.current({addonId:r,pendingKeys:h,pendingValues:e})},[r,g,_]);let y=a(()=>{if(l)return(e,t,n)=>l(r,e,t,n)},[r,l]);return p(b,{schema:i,values:f.values,onChange:f.handleChange,disabled:u,onAction:y})});function C(e){return`perNode`in e&&e.perNode===!0}function w(e,t){if(e.type===`group`){let n=T(e.fields,t);return n.length>0?{...e,fields:n}:null}if(e.type===`sub-tabs`){let n=e.tabs.map(e=>({...e,fields:T(e.fields,t)})).filter(e=>e.fields.length>0);return n.length>0?{...e,tabs:n}:null}return C(e)===(t===`perNode`)?e:null}function T(e,t){let n=[];for(let r of e){let e=w(r,t);e!==null&&n.push(e)}return n}function ae(e,t){let n=[];for(let r of e.sections){let e=T(r.fields,t);e.length!==0&&n.push({...r,fields:e})}return{...e,sections:n}}function oe(e,t){let n=e??`general`;return t?.[n]??n}function E(e){return typeof e!=`object`||!e||!(`key`in e)?null:typeof e.key==`string`?e.key:null}function se(e,t){let n=t.fieldKeys===void 0?null:new Set(t.fieldKeys),r=[];for(let i of e){let e=n===null?i.fields:i.fields.filter(e=>{let t=E(e);return t!==null&&n.has(t)});e.length!==0&&r.push({...i,fields:e,...t.tabAliases===void 0?{}:{tab:oe(i.tab,t.tabAliases)},...t.hideSectionChrome===!0?{title:``,description:void 0}:{}})}return r}r();function D(e,t){if(e.type===`separator`||e.type===`info`||e.type===`button`)return e;if(e.type===`group`){let n=e.fields.map(e=>D(e,t));return{...e,fields:n}}let n=e;t[e.key]=n.value;let{value:r,...i}=n;return i}function O(e,t){return{...e,fields:e.fields.map(e=>D(e,t))}}function ce(e){let t={};return{schema:{...e.tabs?{tabs:e.tabs}:{},sections:e.sections.map(e=>O(e,t))},values:t}}function k({nodeId:e,addonIds:r,level:c,deviceId:m,capability:b,sectionIds:x,omitSectionIds:S,fieldKeys:C,hideSectionChrome:w,tabAliases:T,tabLabelOverrides:E,sectionTab:D,fieldScope:O,surface:k,emptyMessage:ue,extraTabs:A,schemaTabExtras:j,title:M,description:N,selfTabbed:de,activeTab:fe,onActiveTabChange:pe}){let P=l(),F=h().trpcClient,I=ee(),L=y(),me=g(),he=v(),R=de===!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 z=e??`hub`,B=s({queries:r.map(e=>({queryKey:[[`addonSettings`,k===void 0?c===`global`?`getGlobalSettings`:`getDeviceSettings`:`getIntegrationSettings`],{addonId:e,nodeId:z,deviceId:m??null,cap:b??null,scope:O??null}],queryFn:async()=>{let t=e=>e!==null&&O!==void 0?ae(e,O):e;return k===void 0?c===`global`?{addonId:e,result:t(await F.addonSettings.getGlobalSettings.query({addonId:e,nodeId:z,...b?{cap:b}:{}}))}:{addonId:e,result:t(await F.addonSettings.getDeviceSettings.query({addonId:e,deviceId:m,nodeId:z}))}:{addonId:e,result:await F.addonSettings.getIntegrationSettings.query({addonId:e,nodeId:z})}},placeholderData:u}))}),ve=B.some(e=>e.isLoading),ye=B.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(`||`),V=a(()=>{let e=new Set;for(let t of B){let n=t.data?.result?.sections;if(n)for(let t of n)e.add(oe(t.tab,T))}return[...e]},[T,ye+`::`+B.map(e=>(e.data?.result?.sections??[]).map(e=>e.tab??`general`).join(`,`)).join(`::`)]),H=a(()=>new Map((A??[]).map(e=>[e.id,e])),[A]),U=a(()=>{if(!R)return[];let e=[...new Set([...V,...(A??[]).map(e=>e.id),...(j??[]).map(e=>e.tabId)])],t=e=>{let t=H.get(e);if(t?.order!==void 0)return t.order;let n=te[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})},[R,V,A,H,j]),be=a(()=>{let e=new Map,t=e=>te[e]?.label??e.charAt(0).toUpperCase()+e.slice(1);for(let n of V)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},[V,A,j,E]),W=fe===void 0?ge:fe,G=R?W&&U.includes(W)?W:U[0]??null:null,xe=e=>{_e(e),pe?.(e)},Se=G!==null&&H.has(G),K=R?G&&!Se?G: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),q=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 B){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}=ce(t),o={...C===void 0?{}:{fieldKeys:C},...w===void 0?{}:{hideSectionChrome:w},...T===void 0?{}:{tabAliases:T}},s=se(i.sections.filter(e=>n(e.id)),o);if(s.length===0)continue;let c={...t,sections:se(t.sections.filter(e=>n(e.id)),o)},l={...i,sections:s};r.push({addonId:e.data.addonId,schemaWithValues:c,schema:l,serverValues:a})}return r},[ye,x,S,C,w,T]),[J,Ee]=d(new Map),De=t(e=>{Ee(t=>{let n=new Map(t);return n.set(e.addonId,e),n})},[]),Y=n(new Map),Oe=t(e=>t=>{t?Y.current.set(e,t):Y.current.delete(e)},[]),X=t(async(e,t)=>{c===`global`?await I.mutateAsync({addonId:e,nodeId:z,patch:t}):await L.mutateAsync({addonId:e,deviceId:m,nodeId:z,patch:t}),P.invalidateQueries({queryKey:[[`addonSettings`]]})},[I,L,z,c,m,P]),ke=t(async(e,t,n,r)=>{let i=z;try{switch(t){case`reprobe-hwaccel`:await me.mutateAsync({nodeId:i}),P.invalidateQueries({queryKey:[[`addonSettings`]]});return;case`reprobe-audio-engine`:await he.mutateAsync({nodeId:i}),P.invalidateQueries({queryKey:[[`addonSettings`]]});return;default:{let n=await F.addons.custom.mutate({addonId:e,action:t,input:r});return P.invalidateQueries({queryKey:[[`addonSettings`]]}),n}}}catch(n){throw console.error(`[NodeAddonsSettingsPanel] action failed`,{addonId:e,action:t,err:n}),n}},[me,he,z,P,F]),Ae=t((e,t)=>{X(e,t)},[X]),Z=f({mutationFn:async()=>{let e=[];for(let t of q){let n=J.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 I.mutateAsync({addonId:e,nodeId:z,patch:t}):await L.mutateAsync({addonId:e,deviceId:m,nodeId:z,patch:t}),e)))}},onSuccess:({saved:e})=>{for(let t of e)Y.current.get(t)?.discard();P.invalidateQueries({queryKey:[[`addonSettings`]]})}}),je=t(()=>{for(let e of Y.current.values())e.discard()},[]),Me=a(()=>{let e=0;for(let t of q){let n=J.get(t.addonId);n&&(e+=n.pendingKeys.length)}return e},[q,J]),Ne=a(()=>{let e=new Map;for(let t of q){let n=J.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},[q,J]);if(ve)return p(`div`,{className:`h-24 rounded-lg border border-border bg-surface animate-pulse`});let Q=G&&Se?H.get(G):void 0;if(!R&&q.length===0)return p(`div`,{className:`text-[11px] text-foreground-subtle italic`,children:ue??i(o,{children:[`No addons in`,` `,r.length>0?`[${r.join(`, `)}]`:`the current selection`,` expose`,` `,c,`-level settings on this node.`]})});let $=Z.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})]}),R&&p(re,{tabs:U.map(e=>({id:e,label:be.get(e)??e})),activeId:G,onChange:xe,pendingByTab:Ne}),Z.isError&&i(`div`,{className:`rounded-md border border-red-500/40 bg-red-500/10 px-3 py-2 text-[11px] text-red-400`,children:[`Save failed: `,String(Z.error?.message??Z.error)]}),p(ne,{tabKey:Q?`extra:${G??``}`:`tab:${G??``}`,children:Q?Q.content:(()=>{let e=K?q.reduce((e,t)=>e+t.schemaWithValues.sections.filter(e=>(e.tab??`general`)===K).length,0):0,t=K!==null&&e<=1,n=q.map(e=>({...e,renderedWithValues:{...e.schemaWithValues,sections:e.schemaWithValues.sections.filter(e=>K?(e.tab??`general`)===K:!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===K),a=r.filter(e=>(e.placement??`before`)===`before`),o=r.filter(e=>e.placement===`after`);return n.length===0&&r.length===0?p(`div`,{className:`text-[11px] text-foreground-subtle italic`,children:ue??`Nothing to configure here for this node.`}):i(`div`,{className:`space-y-6`,children:[a.map((e,t)=>p(`div`,{children:e.content},`extra-before-${t}`)),n.length>0&&p(le,{entries:n,paneStates:J,displayNames:we,disabled:$,setPaneRef:Oe,onPaneStateChange:De,onImmediateSave:Ae,onAction:ke,inline:R||!!D}),o.map((e,t)=>p(`div`,{children:e.content},`extra-after-${t}`))]})})()}),!ve&&p(ie,{pendingCount:Me,onSave:()=>Z.mutate(),onDiscard:je,saving:$})]})}function le({entries:e,paneStates:t,displayNames:n,disabled:r,setPaneRef:o,onPaneStateChange:s,onImmediateSave:c,onAction:l,inline:u}){let f=a(()=>[...e].toSorted((e,t)=>{if(e.addonId===`system-config`)return-1;if(t.addonId===`system-config`)return 1;let r=n.get(e.addonId)??e.addonId,i=n.get(t.addonId)??t.addonId;return r.localeCompare(i)}),[e,n]),[h,g]=d(f[0]?.addonId??``);m(()=>{f.length!==0&&(f.find(e=>e.addonId===h)||g(f[0].addonId))},[f,h]);let _=f.find(e=>e.addonId===h)??f[0];if(!_)return null;let v=a(()=>l?(e,t,n,r)=>l(e,t,n,r):void 0,[l]),y=e=>p(S,{ref:o(e.addonId),addonId:e.addonId,schema:e.renderedWithValues,serverValues:e.serverValues,onImmediateSave:c,onStateChange:s,onAction:v,disabled:r},e.addonId);return f.length===1||u?p(`div`,{className:`flex flex-col gap-4`,children:f.map(y)}):i(`div`,{className:`flex flex-col gap-3`,children:[p(`div`,{className:`flex flex-wrap items-center gap-1 border-b border-border shrink-0`,children:f.map(e=>{let r=n.get(e.addonId)??e.addonId,a=e.addonId===_.addonId,o=(t.get(e.addonId)?.pendingKeys.length??0)>0;return i(`button`,{type:`button`,onClick:()=>g(e.addonId),className:`relative px-3 py-1.5 text-xs font-medium rounded-t-md transition-colors -mb-px border-b-2 whitespace-nowrap ${a?`text-primary border-primary bg-primary/5`:`text-foreground-subtle border-transparent hover:text-foreground hover:bg-surface-hover`}`,children:[r,o&&p(`span`,{className:`ml-1.5 inline-flex h-1.5 w-1.5 rounded-full bg-amber-400`})]},e.addonId)})}),p(`div`,{className:`space-y-2`,children:f.map(e=>p(`div`,{style:e.addonId===_.addonId?void 0:{display:`none`},children:y(e)},e.addonId))})]})}export{k as t};
|