@camstack/addon-admin-ui 1.2.485 → 1.2.486

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/dist/assets/{AddonAssetIcon-3vq-0y-v.js → AddonAssetIcon-m0NNmyUn.js} +1 -1
  2. package/dist/assets/{Addons-CW_V36k4.js → Addons-7WgdBSgo.js} +2 -2
  3. package/dist/assets/{AdminPage-QmLz5qjj.js → AdminPage-B4oSYZ0g.js} +1 -1
  4. package/dist/assets/{AdminSectionedPage-D9jBOpIg.js → AdminSectionedPage-DPAJKtca.js} +1 -1
  5. package/dist/assets/{AiProfiles-CP5xqeEk.js → AiProfiles-BjN1tM5x.js} +1 -1
  6. package/dist/assets/{BrokerForm-D8mkRSYS.js → BrokerForm-DdX1uhQY.js} +1 -1
  7. package/dist/assets/{Build-DVpLjguC.js → Build-D0GulkUf.js} +7 -7
  8. package/dist/assets/{Calendars-Beo-YqjO.js → Calendars-BVzAt7n2.js} +1 -1
  9. package/dist/assets/{Cluster-B-_bS1Yq.js → Cluster-CeB3rqq5.js} +1 -1
  10. package/dist/assets/{CompositionBlockEditor-iMNTwm3C.js → CompositionBlockEditor-djPlv-fR.js} +1 -1
  11. package/dist/assets/{CompositionEditorPage-BED3S8xk.js → CompositionEditorPage-D_HviEft.js} +1 -1
  12. package/dist/assets/{Data-CP80sADS.js → Data-CiqiBwno.js} +1 -1
  13. package/dist/assets/{DeviceDetail-DEfKCzwe.js → DeviceDetail-jiR1i6pR.js} +2 -2
  14. package/dist/assets/{DeviceDoActionFields-BJfHVs6x.js → DeviceDoActionFields-C7AR_uSl.js} +1 -1
  15. package/dist/assets/{Devices-_2nQ8QL2.js → Devices-CcSrdYU4.js} +1 -1
  16. package/dist/assets/{EmbedPlayerPage-D6aNp4TG.js → EmbedPlayerPage-hTIE4Eit.js} +1 -1
  17. package/dist/assets/{HelperWizard-2-iOB1DP.js → HelperWizard-DK1ybgYQ.js} +2 -2
  18. package/dist/assets/{History-DU5KjafA.js → History-BTIhciXp.js} +1 -1
  19. package/dist/assets/{Identity-Bx1SUu2F.js → Identity-CxJviVb1.js} +1 -1
  20. package/dist/assets/{IntegrationDetail-BtGF0XsO.js → IntegrationDetail-D-bPsCMC.js} +1 -1
  21. package/dist/assets/{IntegrationHub-D5yLfTfh.js → IntegrationHub-CupxQ79f.js} +1 -1
  22. package/dist/assets/Integrations-BvVYmXyZ.js +1 -0
  23. package/dist/assets/{Integrations-C_kA-dpe.js → Integrations-vD0nMp42.js} +1 -1
  24. package/dist/assets/{Library-Bx344878.js → Library-DSfmvzTT.js} +1 -1
  25. package/dist/assets/{Locations-Do1Y0voR.js → Locations-ClEqm56h.js} +1 -1
  26. package/dist/assets/{Logs-svtt17dH.js → Logs-B5KmSzBM.js} +1 -1
  27. package/dist/assets/{MaskShapeCanvas-CzHUGkc7.js → MaskShapeCanvas-C4d-NKff.js} +1 -1
  28. package/dist/assets/{MotionZonesSettings-sCDWBSMu.js → MotionZonesSettings-dUNCzVp0.js} +1 -1
  29. package/dist/assets/{MyAccess-C3MmE-Hf.js → MyAccess-C-q4Sd6S.js} +1 -1
  30. package/dist/assets/Network-DBBkEL72.js +1 -0
  31. package/dist/assets/{NodeAddonsSettingsPanel-DUUGVGQU.js → NodeAddonsSettingsPanel-C3dKdKw3.js} +1 -1
  32. package/dist/assets/Notifications-DcYqE0RB.js +1 -0
  33. package/dist/assets/{Pipeline-kOwhFjIj.js → Pipeline-Ck7WIwEg.js} +1 -1
  34. package/dist/assets/{PrivacyMaskSettings-DH3PZaEy.js → PrivacyMaskSettings-B7H4E39e.js} +1 -1
  35. package/dist/assets/{Recordings-CUmSLBG6.js → Recordings-CdeXjGkO.js} +1 -1
  36. package/dist/assets/{ScanNetworkModal-PQbiE2mC.js → ScanNetworkModal-DmoC2vFv.js} +1 -1
  37. package/dist/assets/{SceneMonitorEditor-CLWf6Z9-.js → SceneMonitorEditor-D10vUYBN.js} +1 -1
  38. package/dist/assets/{SessionsList-BNTGQ-KG.js → SessionsList-DFLBgUL8.js} +2 -2
  39. package/dist/assets/{Showroom-BOzjtIAL.js → Showroom-Mg0T7kiO.js} +1 -1
  40. package/dist/assets/{System-DrbzraIN.js → System-BKwM9EOI.js} +1 -1
  41. package/dist/assets/{Terminal-B2SRyo3p.js → Terminal-CR49jUSx.js} +1 -1
  42. package/dist/assets/{Viewer-CTvuCeo6.js → Viewer-DTS73PG4.js} +1 -1
  43. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DAW63rZZ.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-C9Ul7ikd.js} +1 -1
  44. package/dist/assets/{addon-icons-context-Bzdujcmt.js → addon-icons-context-DExFimUo.js} +1 -1
  45. package/dist/assets/{archive-dvL2Bchb.js → archive-A7fEIb1q.js} +1 -1
  46. package/dist/assets/{assignment-candidates-D1rkNXjX.js → assignment-candidates-CmSrYKig.js} +1 -1
  47. package/dist/assets/{authed-media-B6hJJcft.js → authed-media-D501OkLb.js} +1 -1
  48. package/dist/assets/{bell-off-C3flB_OF.js → bell-off-DRhRTrjj.js} +1 -1
  49. package/dist/assets/{board-model-BJ20DSDr.js → board-model-Dgsb_T8y.js} +1 -1
  50. package/dist/assets/{boxes-BiMbpzNh.js → boxes-DworaLtS.js} +1 -1
  51. package/dist/assets/{chart-column-BMpUb2lF.js → chart-column-Cu9k1-_L.js} +1 -1
  52. package/dist/assets/circle-slash-C3iHwCAG.js +1 -0
  53. package/dist/assets/{client-Ct1F5MoE.js → client-Bu7S-lNI.js} +1 -1
  54. package/dist/assets/{cloud-upload-CAJgV_u1.js → cloud-upload-DiNWp9rb.js} +1 -1
  55. package/dist/assets/crop-0w6npjI-.js +1 -0
  56. package/dist/assets/{device-integration-icon-Csh9ZCwn.js → device-integration-icon-JvZciNX3.js} +1 -1
  57. package/dist/assets/device-picker-model-CwVdTRpM.js +1 -0
  58. package/dist/assets/{dist-B89wGMMB.js → dist-CQST_CR6.js} +1 -1
  59. package/dist/assets/{dist-CPp8d_RN.js → dist-CU7lsl3c.js} +1 -1
  60. package/dist/assets/{eraser-BL6nSeLQ.js → eraser-BIx6oWwv.js} +1 -1
  61. package/dist/assets/{format-Cl0i0-3O.js → format-CxsQImeC.js} +1 -1
  62. package/dist/assets/{hard-drive-download-ysGKYLwW.js → hard-drive-download-C2whZnE1.js} +1 -1
  63. package/dist/assets/{hostInit-CDPK_pyj.js → hostInit-C1vihvmQ.js} +1 -1
  64. package/dist/assets/i18n-L4Vcqmkj.js +1 -0
  65. package/dist/assets/{icons-B7uNvSe0.js → icons-D7LkYyOa.js} +1 -1
  66. package/dist/assets/index-DVjkG4wf.js +4 -0
  67. package/dist/assets/{key-xS-HUgNI.js → key-CnqY_S5Z.js} +1 -1
  68. package/dist/assets/{key-round-BDT5O9Ed.js → key-round-Bg4FlRj5.js} +1 -1
  69. package/dist/assets/{layers-BeRWYCde.js → layers-CO89kjrf.js} +1 -1
  70. package/dist/assets/{linked-devices-model-zOoasg7W.js → linked-devices-model-xJ9JuUve.js} +1 -1
  71. package/dist/assets/{list-ordered-DKzGLPr6.js → list-ordered-B4zrpAg_.js} +1 -1
  72. package/dist/assets/{location-owned-usage-CWUx1diZ.js → location-owned-usage-B8qso0fm.js} +1 -1
  73. package/dist/assets/{log-in-53JDrQ-P.js → log-in-JK1rD34v.js} +1 -1
  74. package/dist/assets/{memory-stick-B9PVELyF.js → memory-stick-CrYYrfr-.js} +1 -1
  75. package/dist/assets/{message-square-plus-B32IU45x.js → message-square-plus-dJX9lmBW.js} +1 -1
  76. package/dist/assets/{mf-entry-bootstrap-0-40dc4d62.js → mf-entry-bootstrap-0-33640dea.js} +2 -2
  77. package/dist/assets/{mic-off-B0w-1GrV.js → mic-off-CNugTHww.js} +1 -1
  78. package/dist/assets/{monitor-off-Cz2SxBVE.js → monitor-off-BGk9t8dE.js} +1 -1
  79. package/dist/assets/{monitor-smartphone-Cqk6Z8Hg.js → monitor-smartphone-G-egoX2s.js} +1 -1
  80. package/dist/assets/mount-CwVdTRpM.js +1 -0
  81. package/dist/assets/{player-overlays-Cs6l33cj.js → player-overlays-wVkuXGEl.js} +1 -1
  82. package/dist/assets/{recycle-DpB4QxbX.js → recycle-DYW-upWu.js} +1 -1
  83. package/dist/assets/remoteEntry-COE7Dbun.js +1 -0
  84. package/dist/assets/{scan-eye-DcYrgFOu.js → scan-eye-Lmh5eEiU.js} +1 -1
  85. package/dist/assets/{scissors-_j_D3ONm.js → scissors-BnF_HknP.js} +1 -1
  86. package/dist/assets/{search-x-9dPd-b95.js → search-x-x52QirSH.js} +1 -1
  87. package/dist/assets/{send-D42ODbS7.js → send-CxXNctx1.js} +1 -1
  88. package/dist/assets/{settings-2-zgGmo4c8.js → settings-2-Bq552rRI.js} +1 -1
  89. package/dist/assets/{speaker-DIPHxIQ6.js → speaker-DwX7P_b6.js} +1 -1
  90. package/dist/assets/{src-DFzrn-CX.js → src-DeCfVTRV.js} +3 -3
  91. package/dist/assets/{step-inspector-model-DTr-lHt_.js → step-inspector-model-BpauAVB0.js} +1 -1
  92. package/dist/assets/{table-2-lftK0wHb.js → table-2-Ds01pXFk.js} +1 -1
  93. package/dist/assets/{timer-reset-catAE_r9.js → timer-reset-Cqh0KdZ_.js} +1 -1
  94. package/dist/assets/{ungroup-BKImeHER.js → ungroup-CJk4-x9j.js} +1 -1
  95. package/dist/assets/{unlink-Behl018w.js → unlink-XCUPeovX.js} +1 -1
  96. package/dist/assets/{usb-D5kzB8kq.js → usb-DxOVSFBX.js} +1 -1
  97. package/dist/assets/{use-scenes-feed-CGDnep25.js → use-scenes-feed-DMb2SZfo.js} +1 -1
  98. package/dist/assets/{use-stationary-objects-D_R5OahX.js → use-stationary-objects-B2khEus9.js} +1 -1
  99. package/dist/assets/useEventInvalidation-CwVdTRpM.js +1 -0
  100. package/dist/assets/{useNodeUrlSelection-nYjP8xK4.js → useNodeUrlSelection-CAax4VC2.js} +1 -1
  101. package/dist/assets/user-round-BnXncTsD.js +1 -0
  102. package/dist/assets/{user-x-COQ6vhb4.js → user-x-B7qGqREw.js} +1 -1
  103. package/dist/assets/{video-Byw3ItoR.js → video-BqrORDyM.js} +1 -1
  104. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-CsFmgfi4.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DaCd0waG.js} +2 -2
  105. package/dist/index.html +9 -9
  106. package/dist/server/addon.js +15 -2
  107. package/package.json +1 -1
  108. package/dist/assets/Integrations-nsyVrgEK.js +0 -1
  109. package/dist/assets/Network-D3RwGDhy.js +0 -1
  110. package/dist/assets/Notifications-CProzw2o.js +0 -1
  111. package/dist/assets/circle-slash-B8Tjloe5.js +0 -1
  112. package/dist/assets/crop-CS-td_0y.js +0 -1
  113. package/dist/assets/device-picker-model-P-UzQOB7.js +0 -1
  114. package/dist/assets/i18n-sTui-nG3.js +0 -1
  115. package/dist/assets/index-Dow2-3ZC.js +0 -4
  116. package/dist/assets/mount-P-UzQOB7.js +0 -1
  117. package/dist/assets/remoteEntry-BGbchE1L.js +0 -1
  118. package/dist/assets/useEventInvalidation-P-UzQOB7.js +0 -1
  119. package/dist/assets/user-round-BJVl6LX9.js +0 -1
@@ -1 +0,0 @@
1
- import{C as e,J as t,K as n,R as r,S as i,V as a,Y as o,et as s,o as c,x as l}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{An as u,Ci as d,Oi as f,Si as p,bi as m,dn as h,dt as g,kn as _,ot as v,pn as y,pr as ee,sr as b,wn as x,xn as te}from"./player-overlays-Cs6l33cj.js";import{t as ne}from"./table-2-lftK0wHb.js";import{$a as re,At as S,Er as C,F as ie,Nt as w,So as ae,_d as T,_i as oe,at as E,bs as D,do as se,ei as O,hs as k,jt as A,ld as ce,r as j,ud as le,vs as M}from"./src-DFzrn-CX.js";import{t as N}from"./i18n-sTui-nG3.js";import{t as P}from"./useTranslation-BJr-n0es.js";import{fr as ue,hr as F,pr as de,sr as I}from"./index-Dow2-3ZC.js";import{t as L}from"./AdminPage-QmLz5qjj.js";import"./useEventInvalidation-P-UzQOB7.js";import{t as R}from"./device-integration-icon-Csh9ZCwn.js";import{i as fe,n as pe,r as z,t as me}from"./ScanNetworkModal-PQbiE2mC.js";s();function he({rows:t,isExpanded:r,onToggleExpand:a,onOpen:s,renderExpanded:c,searchPlaceholder:l,emptyLabel:u}){let[d,f]=o(``),p=n(()=>{let e=d.trim().toLowerCase();return e.length===0?t:t.filter(t=>`${t.name} ${t.addonId}`.toLowerCase().includes(e))},[d,t]);return e(`div`,{className:`space-y-3`,children:[e(`div`,{className:`relative`,children:[i(y,{className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-foreground-subtle`,"aria-hidden":!0}),i(ce,{type:`search`,value:d,onChange:e=>f(e.target.value),placeholder:l,"aria-label":l,className:`pl-8`})]}),p.length===0?i(`p`,{className:`py-8 text-center text-xs text-foreground-subtle`,children:u}):i(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-2 sm:gap-3 lg:grid-cols-3`,children:p.map(e=>i(ge,{integration:e,expanded:r(e),onToggleExpand:a,onOpen:s,renderExpanded:c},e.id))})]})}function ge({integration:t,expanded:n,onToggleExpand:r,onOpen:a,renderExpanded:o}){return e(`article`,{"data-testid":`integration-card-${t.id}`,className:T(`flex min-w-0 flex-col gap-2 overflow-x-clip rounded-lg border border-border bg-surface p-3`,n&&`sm:col-span-2 lg:col-span-3`),children:[i(_e,{integration:t,expanded:n,onToggleExpand:r,onOpen:a}),n?i(`div`,{className:`min-w-0`,children:o(t)}):null]})}function _e({integration:t,expanded:n,onToggleExpand:r,onOpen:a}){let{t:o}=P(),s=n?o(`integrations.integrationColumns.collapse`,`Collapse`):o(`integrations.integrationColumns.expand`,`Expand`);return e(`div`,{className:`relative flex min-w-0 items-stretch gap-3`,children:[i(O,{type:`button`,variant:`ghost`,"aria-label":o(`integrations.openNamed`,{name:t.name,defaultValue:`Open {{name}}`}),onClick:()=>a(t),className:`absolute inset-0 z-0 h-auto w-auto rounded-lg p-0 focus-visible:ring-2 focus-visible:ring-primary`}),i(B,{integration:t}),e(`div`,{className:`pointer-events-none relative z-10 flex min-w-0 flex-1 flex-col items-start gap-1.5`,children:[i(E,{status:t.status,className:`shrink-0`}),i(`p`,{className:`text-[11px] text-foreground-muted`,children:o(`integrations.integrationColumns.deviceCount`,{count:t.deviceCount})}),i(`div`,{className:`pointer-events-auto mt-auto self-end`,children:i(le,{type:`button`,variant:`ghost`,size:`sm`,icon:n?p:m,"aria-label":s,"aria-expanded":n,onClick:e=>H(e,t.addonId,r)})})]})]})}function B({integration:t}){return e(`div`,{className:`pointer-events-none relative z-10 flex w-28 shrink-0 flex-col items-center gap-1 lg:w-24`,children:[i(I,{type:t.addonId,size:`xl`}),i(`p`,{className:`w-full text-center text-xs font-semibold text-foreground`,children:t.name}),i(V,{addonId:t.addonId})]})}function V({addonId:t}){return i(`p`,{className:`w-full text-center text-[10px] leading-tight text-foreground-subtle`,children:t.split(`-`).map((t,n)=>e(`span`,{children:[n>0?e(l,{children:[`-`,i(`wbr`,{})]}):null,t]},`${t}-${String(n)}`))})}function H(e,t,n){e.stopPropagation(),n(t)}s();var U=`camstack.admin.integrations.view`;function W(e){return e===`table`||e===`grid`}function G(){try{return typeof window>`u`?null:window.localStorage}catch{return null}}function K(e=G()){if(e===null)return`table`;try{let t=e.getItem(U);return W(t)?t:`table`}catch{return`table`}}function q(e,t=G()){if(t!==null)try{t.setItem(U,e)}catch{}}function ve(){let[e,t]=o(()=>K());return[e,r(e=>{t(e),q(e)},[])]}s();function J(e=!0){a(()=>{if(!e)return;let t=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=t}},[e])}s();function ye(e,t){let[n,r]=o(!1);return a(()=>{if(!e){r(!1);return}r(!1);let n=setTimeout(()=>r(!0),t);return()=>clearTimeout(n)},[e,t]),n}s();function be({providerId:t,onImport:n,onSkip:r}){let{t:s}=P(),[c,l]=o(new Set),u=se(),p=u.data,m=u.isPending||!u.data&&!u.isError;a(()=>{t&&(u.isPending||u.data||u.mutate({addonId:t}))},[t,u]);function h(e){l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}if(m)return e(`div`,{className:`flex flex-col items-center py-12`,children:[i(`div`,{className:`h-6 w-6 animate-spin rounded-full border-2 border-primary border-t-transparent`}),i(`p`,{className:`mt-3 text-xs text-foreground-subtle`,children:s(`integrations.searchingDevices`)})]});let g=p??[];return e(`div`,{className:`space-y-4`,children:[i(`p`,{className:`text-xs text-foreground-subtle`,children:g.length>0?s(`integrations.foundDevices`,{count:g.length}):s(`integrations.noDevicesFound`)}),g.length>0&&i(`div`,{className:`space-y-1.5 max-h-64 overflow-y-auto`,children:g.map(t=>{let n=t.stableId,r=t.suggestedName??n,a=c.has(n),o=t.alreadyOnboarded===!0;return e(`button`,{onClick:()=>{o||h(n)},disabled:o,title:o?s(`integrations.alreadyAddedHint`,{defaultValue:`Already added as "{{name}}" — re-adding would overwrite its settings.`,name:t.onboardedName??r}):void 0,className:`flex w-full items-center gap-3 rounded-lg border p-3 text-left transition-colors ${o?`border-border bg-surface opacity-60 cursor-not-allowed`:a?`border-primary/40 bg-primary/5`:`border-border bg-surface hover:border-foreground-subtle/30`}`,children:[i(`div`,{className:`flex h-5 w-5 items-center justify-center rounded border flex-shrink-0 ${a&&!o?`border-primary bg-primary`:`border-border`}`,children:a&&!o&&i(d,{className:`h-3 w-3 text-primary-foreground`})}),i(f,{className:`h-3.5 w-3.5 text-foreground-subtle flex-shrink-0`}),i(`span`,{className:`text-xs font-medium text-foreground truncate`,children:r}),o&&i(`span`,{className:`ml-auto flex-shrink-0 rounded bg-surface-muted px-1.5 py-0.5 text-[10px] font-medium text-foreground-subtle`,children:s(`integrations.alreadyAdded`,{defaultValue:`Already added`})})]},n)})}),e(`div`,{className:`flex items-center justify-between pt-2`,children:[i(`button`,{onClick:r,className:`rounded-lg border border-border px-3 py-1.5 text-xs text-foreground-subtle hover:text-foreground transition-colors`,children:s(`integrations.skip`)}),g.length>0&&e(`button`,{onClick:()=>n(Array.from(c)),disabled:c.size===0,className:`rounded-lg bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground shadow-sm disabled:opacity-50`,children:[s(`integrations.importSelected`),` (`,c.size,`)`]})]})]})}var Y=`(hover: none) and (pointer: coarse)`;function X(){if(typeof window>`u`||typeof window.matchMedia!=`function`)return!0;try{return!window.matchMedia(Y).matches}catch{return!0}}s();function Z({onSelect:r,onClose:s,pendingAddonId:c=null}){let{t:l}=P(),u=de(),[d,f]=o(``),p=t(null),{data:m,isLoading:g}=M();a(()=>{g||!X()||p.current?.focus()},[g]);let _=n(()=>{let e=m??[],t=d.trim().toLowerCase();return t.length===0?e:e.filter(e=>`${e.name} ${e.description??``} ${e.addonId}`.toLowerCase().includes(t))},[m,d]);if(g)return i(`div`,{className:`grid grid-cols-2 gap-2 p-2`,children:[1,2,3,4].map(e=>i(`div`,{className:`h-24 rounded-lg bg-surface animate-pulse`},e))});let v=c!==null;return e(`div`,{className:`space-y-3`,"data-testid":`provider-picker`,children:[e(`div`,{className:`relative`,children:[i(y,{className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-foreground-subtle`,"aria-hidden":!0}),i(ce,{ref:p,type:`search`,value:d,onChange:e=>f(e.target.value),placeholder:l(`integrations.searchProviders`,`Search integrations…`),className:`pl-8`,"data-testid":`provider-picker-search`,"aria-label":l(`integrations.searchProviders`,`Search integrations…`)})]}),i(`div`,{className:`grid grid-cols-2 gap-2`,children:_.map(t=>{let n=t.instanceMode===`unique`&&t.existingInstances.length>0,a=c===t.addonId,o=v;return e(`button`,{type:`button`,disabled:o,"data-testid":`provider-pick-${t.addonId}`,onClick:()=>{if(!o)if(n){let e=t.existingInstances[0].id;s(),u(`/integrations/${e}`)}else r(t.addonId,t.instanceMode,t.discoveryMode,t.name,t.kind,t.brokerKind,t.mode,t.canTest)},className:`flex flex-col items-center gap-1.5 rounded-lg border border-border bg-surface px-3 py-3 text-center text-xs hover:border-primary/50 hover:bg-surface-hover transition-colors disabled:opacity-60 disabled:cursor-not-allowed disabled:hover:border-border`,children:[t.iconUrl?i(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-lg flex-shrink-0`,style:{backgroundColor:`${t.color}15`},children:i(`img`,{src:t.iconUrl,alt:``,className:`h-5 w-5`})}):i(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-lg flex-shrink-0`,style:{backgroundColor:`${t.color}15`},children:i(`span`,{className:`text-sm`,style:{color:t.color},children:`◉`})}),i(`p`,{className:`w-full truncate text-xs font-semibold text-foreground`,children:t.name}),t.description?i(`p`,{className:`w-full line-clamp-2 text-[10px] text-foreground-subtle`,children:t.description}):null,a?i(b,{className:`h-4 w-4 animate-spin text-primary`}):n?e(`span`,{className:`flex items-center gap-1 text-[10px] font-medium text-foreground-subtle`,children:[i(h,{className:`h-3 w-3`}),l(`integrations.manage`)]}):null]},t.addonId)})}),_.length===0&&i(`div`,{className:`py-8 text-center text-xs text-foreground-subtle`,children:(m??[]).length===0?l(`integrations.noProviders`):l(`integrations.noProvidersMatch`,`No integrations match your search.`)})]})}s();function xe(e){let t=e=>{if(e.type===`separator`||e.type===`info`||e.type===`button`)return e;if(e.type===`group`)return{...e,fields:e.fields.map(e=>t(e))};let{value:n,...r}=e;return r};return{...e.tabs?{tabs:e.tabs}:{},sections:e.sections.map(e=>({...e,fields:e.fields.map(t)}))}}var Se=2e4;function Ce({open:t,onClose:r,seed:s=null}){let{t:u}=P(),d=de(),f=c(),[p,m]=o(`picker`),[h,_]=o(null),[v,y]=o(null),[ee,x]=o(`manual`),[te,ne]=o(null),[S,C]=o(``),[ie,w]=o(null),[ae,T]=o(null),[E,D]=o(!1),[O,A]=o({}),[ce,j]=o(``),le=s?.config.host,N=s===null?``:`${s.addonId}\0${s.name}\0${typeof le==`string`?le:``}`;t&&s!==null&&ce!==N&&(j(N),_(s.addonId),C(s.name),A({...s.config}),m(`config`));let ue=M(void 0,{enabled:t&&s!==null}),{data:F}=oe({addonId:h??``,nodeId:`hub`},{enabled:h!=null}),I=n(()=>F?xe(F):null,[F]),L=k({onSuccess:()=>f.invalidateQueries({queryKey:[[`integrations`]]})}),R=se(),pe=R.data;a(()=>{if(!t||s===null)return;let e=ue.data?.find(e=>e.addonId===s.addonId);e&&(D(e.canTest),x(e.discoveryMode))},[t,s,ue.data]),a(()=>{p!==`discovery`||!v||!h||R.isPending||R.data||R.mutate({addonId:h})},[p,v,h,R]);let me=re({onSuccess:()=>f.invalidateQueries({queryKey:[[`deviceManager`]]})});function he(e,t,n,r,i,a,o,s){if(!L.isPending){if(_(e),D(s),x(n),C(r),T(null),o===`broker`){if(!a){T(`Addon '${e}' declares mode 'broker' but no brokerKind in its manifest`);return}ne(a),m(`broker`);return}if(o===`account`){m(`config`);return}ge(e,r)}}async function ge(e,t){try{let n=await L.mutateAsync({addonId:e,name:t,settings:{}});r(),U(),d(`/integrations/${n.id}?add=1`)}catch{}}async function _e(e){if(h)try{let t=await L.mutateAsync({addonId:h,name:e.name,settings:e.config,secretKeys:[...e.secretKeys]});y(t.id),w(t.id),ee===`auto`||ee===`both`?m(`discovery`):H(t.id,{openAdd:!0})}catch{}}async function B(e){if(h)try{let t=await L.mutateAsync({addonId:h,name:S,settings:{brokerId:e}});w(t.id),y(t.id),H(t.id)}catch{}}async function V(e){if(h){for(let t of e){let e=pe?.find(e=>e.stableId===t);e&&await me.mutateAsync({addonId:h,candidate:e,...ie===null?{}:{integrationId:ie}})}H()}}function H(e,t){let n=e??v??h;r(),U(),n&&d(t?.openAdd===!0?`/integrations/${n}?add=1`:`/integrations/${n}`)}function U(){m(`picker`),_(null),y(null),x(`manual`),ne(null),C(``),w(null),T(null),D(!1),A({}),j(``)}function W(){r(),U()}J(t);let G=L.isPending,K=ye(G,Se);if(!t)return null;let q={picker:u(`integrations.newIntegration`),config:u(`integrations.configureIntegration`),discovery:u(`integrations.importDevices`),broker:u(`integrations.connectBroker`,{defaultValue:`Connect a broker`})},ve=G?h:null,Y=L.error,X=G&&!K;return e(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[i(`div`,{className:`absolute inset-0 bg-black/60`,onClick:X?void 0:W}),e(`div`,{className:`relative z-10 w-full max-w-lg max-h-[calc(85dvh-2*max(env(safe-area-inset-top),env(safe-area-inset-bottom)))] rounded-xl border border-border bg-background shadow-2xl flex flex-col overflow-hidden`,children:[e(`div`,{className:`flex items-center justify-between border-b border-border px-5 py-4 flex-shrink-0`,children:[i(`h2`,{className:`text-sm font-semibold text-foreground`,children:q[p]}),i(`button`,{onClick:W,disabled:X,className:`rounded-md p-1 text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-40 disabled:cursor-not-allowed`,children:i(g,{className:`h-4 w-4`})})]}),e(`div`,{className:`px-5 py-4 flex-1 overflow-y-auto overscroll-contain`,children:[Y&&!G&&i(`div`,{className:`mb-3 rounded-lg border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:Y instanceof Error?Y.message:String(Y)}),p===`picker`&&e(l,{children:[ae&&i(`div`,{className:`mb-3 rounded-lg border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:ae}),i(Z,{onSelect:he,onClose:W,pendingAddonId:ve})]}),p===`config`&&h&&i(z,{addonId:h,configSchema:I??null,canTest:E,initialName:typeof O.host==`string`?S:void 0,initialConfig:{...O},onSave:_e,onBack:()=>{A({}),m(`picker`)}},N.length>0?N:h),p===`broker`&&te&&i(fe,{kind:te,onResolved:e=>{B(e)},onBack:()=>m(`picker`)}),p===`discovery`&&v&&i(be,{providerId:v,onImport:V,onSkip:H})]}),G&&e(`div`,{className:`absolute inset-0 z-20 flex flex-col items-center justify-center gap-2 rounded-xl bg-background/85 backdrop-blur-sm px-6 text-center`,children:[i(b,{className:`h-6 w-6 animate-spin text-primary`}),i(`p`,{className:`text-xs font-medium text-foreground`,children:u(`integrations.creating`,{defaultValue:`Creating integration…`})}),!K&&i(`p`,{className:`text-[10px] text-foreground-subtle`,children:u(`integrations.creatingHint`,{defaultValue:`Waiting for the addon to restart and register`})}),K&&e(l,{children:[i(`p`,{className:`text-[10px] text-foreground-subtle max-w-xs`,children:u(`integrations.creatingOverdue`,{defaultValue:`This is taking longer than expected. The integration may already have been created — close this dialog and refresh to check.`})}),i(`button`,{onClick:W,className:`mt-1 rounded-md border border-border bg-surface px-3 py-1.5 text-[11px] font-medium text-foreground hover:bg-surface-hover transition-colors`,children:u(`integrations.closeAndRefresh`,{defaultValue:`Close`})})]})]})]})]})}function we({integration:t,expanded:n,onToggleExpand:r}){let{t:a}=P();return e(`div`,{className:`flex items-center gap-2.5`,children:[i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),r(t.addonId)},"aria-label":n?a(`integrations.integrationColumns.collapse`,`Collapse`):a(`integrations.integrationColumns.expand`,`Expand`),"aria-expanded":n,className:`flex h-5 w-5 flex-shrink-0 items-center justify-center rounded text-foreground-subtle transition-colors hover:bg-surface-hover hover:text-foreground`,children:i(n?p:m,{className:`h-3.5 w-3.5`})}),i(I,{type:t.addonId,size:`sm`}),e(`div`,{className:`flex min-w-0 flex-col`,children:[i(`span`,{className:`truncate text-xs font-semibold text-foreground`,children:t.name}),i(`span`,{className:`truncate text-[10px] text-foreground-subtle`,children:t.addonId})]})]})}function Te(e){let{isExpanded:t,onToggleExpand:n}=e;return[{key:`name`,header:N.t(`integrations.integrationColumns.integration`,`Integration`),headerClassName:`w-[55%]`,cell:e=>i(we,{integration:e,expanded:t(e),onToggleExpand:n})},{key:`devices`,header:N.t(`integrations.integrationColumns.devices`,`Devices`),headerClassName:`w-[15%]`,cellClassName:`text-[11px] text-foreground-subtle`,cell:e=>N.t(`integrations.integrationColumns.deviceCount`,{count:e.deviceCount})},{key:`status`,header:N.t(`integrations.integrationColumns.status`,`Status`),headerClassName:`w-[15%]`,cell:e=>i(E,{status:e.status})}]}s();function Ee(e){if(!e.enabled)return`disabled`;switch(e.processState){case`running`:return`running`;default:return`stopped`}}var De=`expand`;function Oe(){let{t}=P(),s=de(),c=ue(),d=v(),[f]=F(),[p,m]=ve(),[h,g]=o(!1),[y,b]=o(null),re=r(()=>{b(null),g(!0)},[]),oe=r(()=>{g(!1),b(null)},[]),E=r(e=>{O(!1),b(e),g(!0)},[]),[se,O]=o(!1);a(()=>{let e=pe(c.state);e!==null&&(b(e),g(!0),s(`/integrations`,{replace:!0,state:null}))},[c.state,s]);let k=f.get(`setup`);a(()=>{k===null||k.length===0||(b({addonId:k,name:k,config:{}}),g(!0))},[k]);let ce=r(()=>O(!0),[]),le=r(()=>O(!1),[]);j([`integrations`],[`integration.enabled`,`integration.disabled`,`integration.deleted`,`provider.started`,`provider.stopped`,`addon.installed`,`addon.uninstalled`,`addon.started`,`addon.stopped`,`addon.updated`]),j([`deviceManager`],[`device.registered`,`device.unregistered`,`device.online`,`device.offline`,`device.disabled`,`device.enabled`]);let{data:M,isLoading:N,isError:I,refetch:fe}=D(void 0),{data:z,isLoading:ge,isError:_e,refetch:B}=ae({projection:`slim`}),V=n(()=>z??[],[z]),H=n(()=>M??[],[M]),U=n(()=>{let e=new Map;for(let t of V)e.set(t.id,{id:t.id,name:t.name??t.stableId??`#${String(t.id)}`});return e},[V]),W=n(()=>A(M),[M]),G=n(()=>{let e=new Map;for(let t of w(V)){let n=W(t);if(n.kind!==`resolved`)continue;let r=n.integration.id;e.set(r,(e.get(r)??0)+1)}return e},[V,W]),K=n(()=>H.map(e=>({id:e.id,addonId:e.addonId,name:e.name,enabled:e.enabled,status:Ee(e),deviceCount:G.get(e.id)??0})),[H,G]),q=f.get(De),J=r(e=>{let t=new URLSearchParams(window.location.search);t.get(De)===e?t.delete(De):t.set(De,e);let n=t.toString(),r=`${window.location.pathname}${n?`?${n}`:``}${window.location.hash}`;window.history.replaceState(window.history.state,``,r),window.dispatchEvent(new PopStateEvent(`popstate`))},[]),ye=r(e=>s(`/integrations/${e.id}`),[s]),be=r(e=>U.get(e)??null,[U]),Y=r(e=>s(`/devices/${String(e)}`),[s]),X=r(e=>i(S,{context:`integration-detail`,devices:V,trpc:d.trpcClient,integrationOf:W,forceIntegrationId:e.id,urlScope:`nested`,lsKey:`integrations:nested:${e.addonId}`,resolveIntegrationIcon:R,resolveParent:be,onNavigate:Y}),[V,d.trpcClient,W,be,Y]),Z=r(e=>q===e.addonId,[q]),xe=n(()=>Te({isExpanded:Z,onToggleExpand:J}),[Z,J]),Se=r(e=>`${e.name} ${e.addonId}`,[]),we=r(e=>e.addonId,[]),Oe=r(()=>{fe(),B()},[fe,B]),Q=I===!0||_e===!0,$=!Q&&(N||ge||M===void 0||z===void 0),ke=H.length>0,Ae=[{id:`table`,label:t(`integrations.viewTable`,`Table`),icon:ne},{id:`grid`,label:t(`integrations.viewGrid`,`Grid`),icon:ee}];return e(L,{icon:_,title:t(`nav.integrations`,`Integrations`),actions:e(l,{children:[i(ie,{ariaLabel:t(`integrations.viewLabel`,`Layout`),value:p,onChange:m,options:Ae,testId:`integrations-view`}),i(`button`,{onClick:Oe,disabled:$,className:`flex items-center gap-1 rounded-lg border border-border bg-surface px-2.5 py-1.5 text-xs font-medium text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50`,title:t(`common.refresh`,`Refresh`),children:i(te,{className:T(`h-3.5 w-3.5`,$&&`animate-spin`)})}),e(`button`,{onClick:ce,className:`flex items-center gap-1.5 rounded-lg border border-border bg-surface px-2.5 py-1.5 text-xs font-medium text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,title:t(`integrations.scanTheLocalNetworkFor`,`Scan the local network for devices`),children:[i(x,{className:`h-3.5 w-3.5`}),t(`integrations.scanNetwork`,`Scan network`)]}),e(`button`,{onClick:re,className:`flex items-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground shadow-sm`,children:[i(u,{className:`h-3.5 w-3.5`}),t(`integrations.newIntegration`,`New Integration`)]})]}),children:[Q&&i(C,{message:t(`integrations.loadFailed`,`Integrations could not be loaded.`),onRetry:Oe}),$&&i(`div`,{className:`space-y-2`,"data-testid":`integrations-pending`,children:[1,2,3].map(e=>i(`div`,{className:`h-12 rounded-lg border border-border bg-surface animate-pulse`},e))}),!Q&&!$&&!ke&&e(`div`,{className:`flex flex-col items-center py-20 text-foreground-subtle`,children:[i(`p`,{className:`text-sm`,children:t(`integrations.noIntegrationsConfigured`,`No integrations configured.`)}),i(`p`,{className:`text-xs mt-1`,children:t(`integrations.clickNewIntegrationToConnect`,`Click "New Integration" to connect cameras and devices.`)})]}),!Q&&!$&&ke&&p===`table`&&i(S,{mode:`generic`,items:K,getKey:we,getSearchText:Se,columns:xe,onRowClick:ye,isExpanded:Z,renderExpanded:X,searchPlaceholder:t(`integrations.search`,{defaultValue:`Search integrations…`}),emptyLabel:t(`integrations.empty`,{defaultValue:`No integrations found.`})}),!Q&&!$&&ke&&p===`grid`&&i(he,{rows:K,isExpanded:Z,onToggleExpand:J,onOpen:ye,renderExpanded:X,searchPlaceholder:t(`integrations.search`,{defaultValue:`Search integrations…`}),emptyLabel:t(`integrations.empty`,{defaultValue:`No integrations found.`})}),i(Ce,{open:h,onClose:oe,seed:y}),i(me,{open:se,onClose:le,onSetupIntegration:E})]})}export{Oe as IntegrationsPage};
@@ -1 +0,0 @@
1
- import{C as e,K as t,R as n,S as r,V as i,Y as a,et as o,o as s,x as c}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{An as l,Bn as u,Ci as d,D as f,L as p,Lt as m,Pt as h,Qr as g,Qt as _,Vr as v,Xt as y,Z as b,bn as x,dt as S,fn as C,gn as ee,ht as w,ir as T,jn as te,ot as E,sn as D,sr as O,xn as ne}from"./player-overlays-Cs6l33cj.js";import{Ar as re,Fr as ie,Pr as ae,Xn as oe}from"./client-Ct1F5MoE.js";import{t as k}from"./boxes-BiMbpzNh.js";import{l as A,s as se}from"./video-Byw3ItoR.js";import{t as ce}from"./log-in-53JDrQ-P.js";import{$s as le,Ai as j,Bs as ue,Cn as de,Er as fe,Gs as pe,Js as me,Ks as he,Qs as ge,Rs as _e,So as ve,Us as ye,Vu as be,Wn as xe,Ys as Se,ac as Ce,bn as we,ec as Te,ei as M,id as Ee,ji as N,ld as De,nc as Oe,oc as ke,sc as Ae,si as P,tc as je,vn as Me,xn as Ne,xr as Pe,zs as Fe}from"./src-DFzrn-CX.js";import{t as F}from"./i18n-sTui-nG3.js";import{t as I}from"./useTranslation-BJr-n0es.js";import"./mount-P-UzQOB7.js";import{S as Ie,a as L,dr as Le,hr as Re,i as R,ur as ze}from"./index-Dow2-3ZC.js";import{t as Be}from"./AdminSectionedPage-D9jBOpIg.js";import{t as z}from"./AdminPage-QmLz5qjj.js";import{t as Ve}from"./NodeAddonsSettingsPanel-DUUGVGQU.js";import{n as B,r as He,t as V}from"./IntegrationHub-D5yLfTfh.js";import{n as H,t as U}from"./addon-display-names-BkwMrExv.js";o();var W=5e3,G=`network-access`,Ue={connected:!1,endpoint:null};function We(){let{t:e}=I(),n=s(),i=N({capName:`network-access`},{refetchInterval:W}),o=j(void 0,{refetchInterval:W}),c=t(()=>U(o.data??[]),[o.data]),l=t(()=>(i.data??[]).map(e=>({addonId:e.addonId,displayName:c.get(e.addonId)??e.addonId,isActive:e.isActive})),[i.data,c]),[u,d]=a(null),[f,p]=a({}),m=(e,t)=>{let r=t?.addonId;n.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=ke({onSuccess:m,onError:h}),_=Ae({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:()=>r(B,{addonId:e.addonId,displayName:e.displayName,capName:G,isActive:e.isActive,badges:r(Ke,{addonId:e.addonId}),error:f[e.addonId]??null,primaryAction:r(qe,{addonId:e.addonId,busyId:u,onStart:e=>{d(e),g.mutate({addonId:e})},onStop:e=>{d(e),_.mutate({addonId:e})}})})}))}];return r(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:i.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 Ge(e){let{data:t}=Ce({addonId:e},{refetchInterval:W,retry:!1}),n=t?re.safeParse(t):null;return n?.success?n.data:Ue}function Ke({addonId:t}){let{t:n}=I(),i=Ge(t);return e(c,{children:[r(P,{variant:i.connected?`success`:`default`,className:He,children:i.connected?n(`system.remoteAccess.connected`,`Connected`):n(`system.remoteAccess.disconnected`,`Disconnected`)}),i.endpoint&&e(`a`,{href:i.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:[r(v,{className:`h-3 w-3`}),i.endpoint.url]})]})}function qe({addonId:t,busyId:n,onStart:i,onStop:a}){let{t:o}=I(),s=Ge(t),c=n===t;return s.connected?e(M,{size:`sm`,variant:`secondary`,disabled:c,onClick:()=>a(t),children:[c?r(O,{className:`h-3 w-3 animate-spin`}):r(y,{className:`h-3 w-3`}),o(`system.remoteAccess.stop`,`Stop`)]}):e(M,{size:`sm`,variant:`primary`,disabled:c,onClick:()=>i(t),children:[c?r(O,{className:`h-3 w-3 animate-spin`}):r(te,{className:`h-3 w-3`}),o(`system.remoteAccess.start`,`Start`)]})}o();var Je=3e4,K=`turn-provider`;function Ye(e){let t=[];for(let n of e)typeof n.urls==`string`?t.push(n.urls):t.push(...n.urls);return t}function Xe(){let{t:n}=I(),i=N({capName:`turn-provider`},{refetchInterval:Je}),a=j(void 0,{refetchInterval:Je}),o=be(),s=o.data??[],c=t(()=>U(a.data??[]),[a.data]),l=t(()=>(i.data??[]).map(e=>({addonId:e.addonId,displayName:c.get(e.addonId)??e.addonId,isActive:e.isActive})),[i.data,c]),d=[{id:K,label:n(`system.turnServers.turnProviders`,`TURN providers`),install:{capability:K,label:n(`system.turnServers.addProvider`,`Add provider`)},entries:l.map(e=>({id:e.addonId,name:e.displayName,fallbackIcon:u,...H(e.isActive),render:()=>r(B,{addonId:e.addonId,displayName:e.displayName,capName:K,isActive:e.isActive,panels:[{id:`ice-servers`,title:n(`system.turnServers.discoveredIceServers`,`Discovered ICE servers`),icon:u,content:r(Ze,{addonId:e.addonId,enabled:e.isActive})}]})}))}];return r(V,{embedded:!0,icon:u,title:n(`system.turnServers.turnServers`,`TURN Servers`),subtitle:n(`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:i.isLoading,emptyTitle:n(`system.turnServers.noTurnProvidersInstalled`,`No TURN providers installed`),emptyDescription:n(`system.turnServers.installATurnAddonE`,`Install a TURN addon (e.g. @camstack/addon-cloudflare) to enable WebRTC behind restrictive NATs.`),trailing:r(Ne,{headingId:`turn-combined-ice`,title:n(`system.turnServers.combinedIceServerListAll`,`Combined ICE server list — all enabled providers`),icon:u,actions:r(M,{size:`sm`,variant:`secondary`,onClick:()=>o.refetch(),disabled:o.isFetching,children:n(`common.refresh`,`Refresh`)}),children:r(`div`,{className:f,children:s.length===0?r(`div`,{className:`text-xs text-foreground-subtle`,children:n(`system.turnServers.noServersFromEnabledProviders`,`No servers from enabled providers.`)}):r(`div`,{className:`flex flex-col gap-3`,children:s.map((t,n)=>{let i=Array.isArray(t.urls)?t.urls:[t.urls];return e(`div`,{className:`rounded border border-border bg-surface`,children:[(t.username||t.credential)&&e(`div`,{className:`px-3 py-1.5 border-b border-border text-[10px] font-mono text-foreground-subtle flex items-center gap-3`,children:[t.username&&e(`span`,{children:[r(`span`,{className:`text-foreground-subtle`,children:`user:`}),` `,r(`span`,{className:`text-foreground`,children:t.username})]}),t.credential&&e(`span`,{children:[r(`span`,{className:`text-foreground-subtle`,children:`credential:`}),` `,r(`span`,{className:`text-foreground`,children:`••••••••`})]})]}),r(`ul`,{className:`divide-y divide-border`,children:i.map(e=>r(`li`,{className:`px-3 py-1.5 font-mono text-xs text-foreground break-all`,children:e},e))})]},n)})})})})})}function Ze({addonId:e,enabled:n}){let i=be({addonId:e},{enabled:n,retry:!1}),a=t(()=>Ye(i.data??[]),[i.data]),o=n?i.isLoading?`Loading…`:a.length===0?`This provider returned no servers.`:null:`Disabled — enable the provider to fetch its servers.`;return r(`div`,{className:`rounded-lg border border-border bg-surface p-2 sm:p-3`,children:o===null?r(`div`,{className:`flex flex-wrap gap-1`,children:a.map(e=>r(`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))}):r(`div`,{className:`text-xs text-foreground-subtle`,children:o})})}o();var Qe={lan:u,wifi:w,docker:k,vpn:T,loopback:C,other:C},$e={lan:`LAN`,wifi:`Wi-Fi`,docker:`Docker`,vpn:`VPN`,loopback:`Loopback`,other:`Other`},et=[`lan`,`wifi`,`vpn`,`docker`,`other`,`loopback`];function tt(n){let{t:i}=I(),{interfaces:a,disabled:o,hideLoopback:s,ipv4Only:c,emptyMessage:l}=n,u=t(()=>a.filter(e=>!(s&&e.kind===`loopback`||c&&e.family!==`IPv4`)),[a,s,c]),f=t(()=>{let e=new Map;for(let t of u){let n=e.get(t.kind)??[];n.push(t),e.set(t.kind,n)}return et.filter(t=>e.has(t)).map(t=>({kind:t,items:e.get(t)}))},[u]),p=e=>n.mode===`single`?n.value===e:n.value.includes(e),m=e=>{if(o||e.kind===`loopback`)return;if(n.mode===`single`){n.onChange(n.value===e.address?null:e.address);return}let t=new Set(n.value);t.has(e.address)?t.delete(e.address):t.add(e.address),n.onChange([...t])};return u.length===0?r(`div`,{className:`text-xs text-foreground-subtle italic`,children:l??i(`shared.addressSelector.noAddressesAvailable`,`No addresses available.`)}):r(`div`,{className:`flex flex-col gap-3`,children:f.map(({kind:t,items:a})=>e(`div`,{className:`rounded-md border border-border overflow-hidden`,children:[e(`div`,{className:`flex items-center gap-2 px-3 py-1.5 bg-surface-hover/30 border-b border-border`,children:[r(Qe[t]??C,{className:`h-3.5 w-3.5 text-foreground-subtle`}),r(`span`,{className:`text-[11px] font-semibold uppercase tracking-wide text-foreground-subtle`,children:$e[t]??t}),e(`span`,{className:`text-[10px] text-foreground-subtle`,children:[`· `,a.length]})]}),r(`ul`,{className:`divide-y divide-border`,children:a.map(t=>{let a=p(t.address),s=t.kind===`loopback`,c=!t.plausible&&!s;return e(`li`,{className:`flex items-center gap-3 px-3 py-2 ${s?`opacity-60 cursor-not-allowed`:o?`opacity-60`:c?`cursor-pointer hover:bg-surface-hover/30 bg-amber-500/[0.04]`:`cursor-pointer hover:bg-surface-hover/30`}`,onClick:()=>m(t),children:[r(`span`,{className:`flex items-center justify-center h-4 w-4 rounded ${n.mode===`single`?`rounded-full`:`rounded`} border ${a?`border-primary bg-primary text-primary-foreground`:`border-border bg-surface`}`,children:a&&r(d,{className:`h-3 w-3`})}),e(`div`,{className:`flex-1 min-w-0 ${c?`text-foreground-subtle`:``}`,children:[e(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[r(`span`,{className:`font-mono text-xs font-semibold ${c?`text-foreground-subtle`:`text-foreground`}`,children:t.name}),r(`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&&r(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium bg-primary/15 text-primary`,children:i(`shared.addressSelector.autoPreferred`,`Auto-preferred`)}),s&&r(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium bg-foreground-subtle/15 text-foreground-subtle`,children:i(`shared.addressSelector.alwaysIncluded`,`Always included`)}),c&&e(`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:[r(h,{className:`h-2.5 w-2.5`}),i(`shared.addressSelector.unlikelyUsable`,`Unlikely usable`)]})]}),e(`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 q=[{role:`appConnections`,get title(){return F.t(`helpers.addressTableModel.appConnectionsTitle`)},single:!1,get help(){return F.t(`helpers.addressTableModel.appConnectionsHelp`)}},{role:`notificationTaps`,get title(){return F.t(`helpers.addressTableModel.notificationTapsTitle`)},single:!0,get help(){return F.t(`helpers.addressTableModel.notificationTapsHelp`)}},{role:`publicEndpoint`,get title(){return F.t(`helpers.addressTableModel.publicEndpointTitle`)},single:!0,get help(){return F.t(`helpers.addressTableModel.publicEndpointHelp`)}},{role:`internal`,get title(){return F.t(`helpers.addressTableModel.internalTitle`)},single:!0,get help(){return F.t(`helpers.addressTableModel.internalHelp`)}}],nt=`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 rt(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:ae}:{kind:`set`,input:n}}function it(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`}})}o();var at={"lan-ipv4":{labelKey:`system.addressesCard.kindIpv4`,className:`bg-emerald-500/15 text-emerald-700 dark:text-emerald-300`},"lan-ipv6":{labelKey:`system.addressesCard.kindIpv6`,className:`bg-violet-500/15 text-violet-700 dark:text-violet-300`},public:{labelKey:`system.addressesCard.kindPublic`,className:`bg-blue-500/15 text-blue-700 dark:text-blue-300`},"app-link":{labelKey:`system.addressesCard.kindAppLink`,className:`bg-amber-500/15 text-amber-700 dark:text-amber-300`},custom:{labelKey:`system.addressesCard.kindCustom`,className:`bg-sky-500/15 text-sky-700 dark:text-sky-300`},loopback:{labelKey:`system.addressesCard.kindLoopback`,className:`bg-foreground-subtle/15 text-foreground-subtle`}};function ot({book:t,loading:n,saving:i,error:o,onSetRole:s,onAdd:c,onRemove:u}){let{t:d}=I(),[f,p]=a(``),[g,_]=a(``),[v,y]=a(null),[b,x]=a(null),S=()=>{let e=ie(f);if(!e.ok){y(e.reason);return}y(null),p(``),_(``),c(e.baseUrl,g.trim())},C=(e,t)=>{let n=rt(e,t.role);if(n.kind!==`none`){if(n.kind===`confirm-http`){x({input:n.input,reason:n.reason});return}x(null),s(n.input)}},ee=[{key:`url`,header:d(`system.addressesCard.address`,`Address`),render:n=>e(`div`,{className:`min-w-0 py-0.5`,children:[r(`div`,{className:`font-mono text-[12px] break-all ${n.plausible?`text-foreground`:`text-foreground-subtle`}`,children:n.baseUrl}),e(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-1.5 text-[11px] text-foreground-subtle`,children:[r(`span`,{children:n.label}),n.kind===`app-link`&&e(`span`,{className:`font-mono`,children:[`hub=`,` `,t?.appLinkHub??d(`system.addressesCard.noneNoTunnelOrTailscale`,`none (no tunnel or Tailscale)`)]}),n.custom&&n.detected&&r(`span`,{children:d(`system.addressesCard.alsoAddedAsACustom`,`also added as a custom address`)}),n.kind!==`custom`&&n.interfaceKind!==`lan`&&n.interfaceKind!==`public`&&n.interfaceKind!==`other`&&r(`span`,{className:`uppercase tracking-wide`,children:n.interfaceKind}),!n.plausible&&n.interfaceKind!==`loopback`&&e(`span`,{className:`inline-flex items-center gap-1 text-amber-700 dark:text-amber-300`,title:n.plausibleReason||void 0,children:[r(h,{className:`h-2.5 w-2.5`}),d(`system.addressesCard.unlikelyUsable`,`Unlikely usable`)]})]})]})},{key:`kind`,header:d(`system.addressesCard.kind`,`Kind`),nowrap:!0,render:e=>{let t=at[e.kind]??at.loopback;return r(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium ${t.className}`,children:d(t.labelKey)})}},...q.map(t=>({key:t.role,headerRender:()=>r(`span`,{title:t.help,children:t.title}),align:`center`,nowrap:!0,width:`w-24`,render:n=>{let a=n.eligible.includes(t.role),o=n.flags.includes(t.role),s=J(n,t.role);return e(`label`,{className:`inline-flex items-center justify-center gap-1 ${a?`cursor-pointer`:`cursor-not-allowed opacity-40`}`,title:a?s&&!o?d(`system.addressesCard.inUseAutomatically`,`{{title}}: in use automatically. {{help}}`,{title:t.title,help:t.help}):t.help:d(`system.addressesCard.thisAddressCannotBeUsed`,`This address cannot be used for this.`),children:[r(xe,{checked:a&&s,disabled:!a||i,onChange:()=>C(n,t),"aria-label":`${t.title}: ${n.baseUrl}`}),s&&!o&&a&&r(`span`,{className:`text-[9px] text-foreground-subtle`,children:d(`common.auto`)})]})}})),{key:`actions`,header:``,align:`right`,nowrap:!0,render:e=>e.custom?r(M,{size:`sm`,variant:`ghost`,disabled:i,onClick:()=>u(e.baseUrl),"aria-label":d(`system.addressesCard.remove`,`Remove {{baseUrl}}`,{baseUrl:e.baseUrl}),title:d(`system.addressesCard.removeThisCustomAddressIts`,`Remove this custom address (its roles turn automatic)`),children:r(m,{className:`h-3 w-3`})}):null}],w=t===void 0?[]:it(t);return e(Pe,{children:[e(`div`,{className:`px-4 py-3 border-b border-border flex flex-col gap-2`,children:[e(`div`,{children:[r(`div`,{className:`text-sm font-semibold`,children:d(`system.addressesCard.addresses`,`Addresses`)}),r(`div`,{className:`text-xs text-foreground-subtle max-w-3xl`,children:d(`system.addressesCard.everyAddressThisHubIs`,`Every address this hub is reached at, detected or added by you. Tick what each one is used for.`)}),e(`details`,{className:`mt-1.5 text-xs max-w-3xl`,"data-testid":`address-roles-help`,children:[r(`summary`,{className:`cursor-pointer select-none text-foreground-subtle hover:text-foreground`,children:d(`system.addressesCard.whatAreRoles`,`What are roles?`)}),r(`dl`,{className:`mt-1.5 grid grid-cols-[auto_1fr] gap-x-3 gap-y-1`,children:q.map(t=>e(`div`,{className:`contents`,children:[r(`dt`,{className:`font-medium`,children:t.title}),r(`dd`,{className:`text-foreground-subtle`,children:t.help})]},t.role))}),r(`p`,{className:`mt-1.5 text-foreground-subtle`,children:nt})]})]}),w.length>0&&r(`div`,{className:`grid grid-cols-[auto_1fr_auto] gap-x-3 gap-y-1 items-baseline text-xs`,"data-testid":`address-roles-summary`,children:w.map(t=>e(`div`,{className:`contents`,children:[r(`span`,{className:`text-foreground-subtle`,children:t.title}),e(`span`,{className:`font-mono break-all`,"data-testid":`address-role-${t.role}`,children:[t.inUse,r(`span`,{className:`ml-1.5 font-sans text-foreground-subtle`,children:t.automatic?d(`system.addressesCard.automatic`,`(automatic)`):d(`system.addressesCard.setByYou`,`(set by you)`)})]}),t.automatic?r(`span`,{}):r(M,{size:`sm`,variant:`secondary`,disabled:i,onClick:()=>s({role:t.role,baseUrl:null,enabled:!1}),children:d(`system.addressesCard.useAutomatic`,`Use automatic`)})]},t.role))}),b!==null&&e(`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:[r(h,{className:`h-3.5 w-3.5 text-amber-600`}),r(`span`,{className:`flex-1 min-w-[220px]`,children:b.reason}),r(M,{size:`sm`,variant:`secondary`,onClick:()=>{s({...b.input,acceptInsecureHttp:!0}),x(null)},children:d(`system.addressesCard.useHttpAnyway`,`Use http anyway`)}),r(M,{size:`sm`,variant:`ghost`,onClick:()=>x(null),children:d(`common.cancel`,`Cancel`)})]}),o!==null&&r(`div`,{className:`text-[11px] text-red-600 dark:text-red-400`,role:`alert`,children:o})]}),r(de,{columns:ee,rows:t?.rows??[],rowKey:e=>`${e.kind}-${e.baseUrl}`,minWidthPx:760,bordered:!1,emptyMessage:n?d(`common.loading`,`Loading…`):d(`system.addressesCard.noAddressesAvailable`,`No addresses available.`),rowClassName:e=>e.plausible?void 0:`opacity-80`}),e(`div`,{className:`px-4 py-3 border-t border-border flex flex-wrap items-start gap-2`,children:[e(`div`,{className:`flex-1 min-w-[220px]`,children:[r(De,{value:f,onChange:e=>{p(e.target.value),y(null)},placeholder:`https://cams.example.com or https://192.0.2.20:4443`,"aria-label":d(`system.addressesCard.customAddress`,`Custom address`),disabled:i}),v!==null&&r(`div`,{className:`mt-1 text-[11px] text-red-600 dark:text-red-400`,children:v})]}),r(`div`,{className:`w-48`,children:r(De,{value:g,onChange:e=>_(e.target.value),placeholder:d(`system.addressesCard.labelOptional`,`Label (optional)`),"aria-label":d(`system.addressesCard.customAddressLabel`,`Custom address label`),maxLength:80,disabled:i})}),e(M,{size:`sm`,variant:`secondary`,disabled:i||f.trim()===``,onClick:S,children:[r(l,{className:`h-3 w-3`}),d(`system.addressesCard.addCustomAddress`,`Add custom address`)]})]})]})}o();function st(){let{t:n}=I(),o=s(),c=()=>{o.invalidateQueries({queryKey:[[`localNetwork`]]})},l=ye(void 0,{refetchInterval:3e4}),u=ue(void 0),d=Se({onSuccess:c}),p=he({onSuccess:e=>{w(e.addresses),c()}}),m=t(()=>l.data?.interfaces??[],[l.data]),h=Fe({scheme:typeof window<`u`&&window.location.protocol===`https:`?`https`:`http`},{refetchInterval:3e4}),g=me({onSuccess:c}),v=_e({onSuccess:c}),y=pe({onSuccess:c}),b=g.error?.message??v.error?.message??y.error?.message??null,S=g.isPending||v.isPending||y.isPending,[C,w]=a([]),[T,te]=a(!1);i(()=>{!T&&u.data&&(w(u.data.addresses),te(!0))},[u.data,T]);let E=u.data?.addresses??[],D=t(()=>{if(C.length!==E.length)return!0;let e=[...C].toSorted(),t=[...E].toSorted();return e.some((e,n)=>e!==t[n])},[C,E]);return e(z,{embedded:!0,children:[e(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[r(`p`,{className:`text-xs text-foreground-subtle max-w-2xl`,children:n(`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.`)}),r(`div`,{className:`flex items-center gap-2 shrink-0`,children:e(M,{size:`sm`,variant:`secondary`,onClick:()=>{l.refetch(),u.refetch(),h.refetch()},disabled:l.isLoading,children:[r(ne,{className:`h-3 w-3 ${l.isLoading?`animate-spin`:``}`}),n(`common.refresh`,`Refresh`)]})})]}),r(Ne,{headingId:`network-allowed-addresses`,title:n(`system.networkAddresses.allowedAddresses`,`Allowed addresses`),actions:e(`div`,{className:`flex flex-wrap items-center gap-1`,children:[e(M,{size:`sm`,variant:`secondary`,onClick:()=>p.mutate(void 0),disabled:p.isPending||d.isPending,title:n(`system.networkAddresses.reRunTheAutoDetection`,`Re-run the auto-detection heuristic + overwrite the current allowlist with the best matches.`),children:[r(_,{className:`h-3 w-3`}),p.isPending?n(`system.networkAddresses.detecting`,`Detecting…`):n(`system.networkAddresses.bestMatch`,`Best match`)]}),e(M,{size:`sm`,variant:`secondary`,onClick:()=>{w([])},disabled:C.length===0||d.isPending,children:[r(x,{className:`h-3 w-3`}),n(`system.networkAddresses.clear`,`Clear`)]}),D&&r(M,{size:`sm`,variant:`secondary`,onClick:()=>{w(E)},disabled:d.isPending,children:n(`system.networkAddresses.discard`,`Discard`)}),e(M,{size:`sm`,variant:`primary`,onClick:()=>{d.mutate({addresses:[...C]})},disabled:!D||d.isPending,children:[r(ee,{className:`h-3 w-3`}),d.isPending?n(`system.networkAddresses.saving`,`Saving…`):n(`common.save`,`Save`)]})]}),children:e(`div`,{className:f,children:[r(`p`,{className:`mb-3 text-xs text-foreground-subtle`,children:C.length===0?n(`system.networkAddresses.autoEveryNonLoopbackNon`,`Auto — every non-loopback / non-link-local interface participates.`):n(`system.networkAddresses.pinned`,`{{value1}} pinned`,{value1:String(C.length)})}),r(tt,{mode:`multiple`,interfaces:m,value:C,onChange:w,disabled:d.isPending,emptyMessage:l.isLoading?n(`system.networkAddresses.loadingInterfaces`,`Loading interfaces…`):n(`system.networkAddresses.noInterfacesDetected`,`No interfaces detected.`)})]})}),r(ot,{book:h.data,loading:h.isLoading,saving:S,error:b,onSetRole:e=>g.mutate({...e}),onAdd:(e,t)=>v.mutate({baseUrl:e,label:t}),onRemove:e=>y.mutate({baseUrl:e})})]})}o();var ct={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`,lt=3e4,ut={joined:!1,meshIp:``,magicDnsHostname:``,peerCount:0,endpoints:[],tenantName:``,magicDnsSuffix:``,userLogin:null,controlPlaneUrl:``,keyExpiry:null};function dt(){let{t:e}=I(),n=N({capName:`mesh-network`},{refetchInterval:Y}),i=j(void 0,{refetchInterval:Y}),a=t(()=>U(i.data??[]),[i.data]),o=t(()=>(n.data??[]).map(e=>({addonId:e.addonId,displayName:a.get(e.addonId)??e.addonId,isActive:e.isActive})),[n.data,a]),s=[{id:X,label:e(`system.meshNetworks.meshNetworks`,`Mesh networks`),install:{capability:X,label:e(`system.meshNetworks.addMesh`,`Add mesh`)},entries:o.map(t=>({id:t.addonId,name:t.displayName,fallbackIcon:u,...H(t.isActive),render:()=>r(B,{addonId:t.addonId,displayName:t.displayName,capName:X,isActive:t.isActive,badges:r(ft,{addonId:t.addonId}),primaryAction:r(pt,{addonId:t.addonId}),panels:[{id:`status`,title:e(`system.meshNetworks.status`,`Status`),icon:k,content:r(mt,{addonId:t.addonId})}]})}))}];return r(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:s,isLoading:n.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}=ge({addonId:e},{refetchInterval:Y,retry:!1}),r=t?oe.safeParse(t):null;return{status:r?.success?r.data:ut,isLoading:n}}function ft({addonId:t}){let{t:n}=I(),{status:i}=Z(t);return e(c,{children:[r(P,{variant:i.joined?`success`:`default`,className:He,children:i.joined?n(`system.meshNetworks.joined`,`Joined`):n(`system.meshNetworks.notJoined`,`Not joined`)}),i.joined&&r(P,{className:`text-[10px]`,children:n(`common.peers`,{count:i.peerCount})})]})}function pt({addonId:t}){let{t:i}=I(),o=s(),[l,u]=a(!1),[d,f]=a(null),p=E(),{status:m}=Z(t),h=n(()=>{o.invalidateQueries({queryKey:[[`meshNetwork`]]})},[o]),g=Oe(),_=le({onSuccess:h}),v=je({onSuccess:h}),y=n(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 bt(2e3),!e.cancelled);){let e=await p.trpcClient.meshNetwork.getStatus.query({addonId:t}).catch(()=>null),n=e?oe.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=n(()=>{d&&(d.cancelled=!0),u(!1),f(null)},[d]);return r(c,{children:m.joined?e(c,{children:[e(M,{size:`sm`,variant:`secondary`,disabled:_.isPending,onClick:()=>_.mutate({addonId:t}),children:[_.isPending?r(O,{className:`h-3 w-3 animate-spin`}):r(se,{className:`h-3 w-3`}),i(`system.meshNetworks.disconnect`,`Disconnect`)]}),e(M,{size:`sm`,variant:`ghost`,disabled:v.isPending,onClick:()=>v.mutate({addonId:t}),children:[v.isPending?r(O,{className:`h-3 w-3 animate-spin`}):r(D,{className:`h-3 w-3`}),i(`system.meshNetworks.logOut`,`Log out`)]})]}):l?e(M,{size:`sm`,variant:`ghost`,onClick:b,children:[r(S,{className:`h-3 w-3 mr-1`}),` `,i(`common.cancel`)]}):e(c,{children:[e(M,{size:`sm`,variant:`primary`,onClick:()=>void y(),children:[r(ce,{className:`h-3 w-3`}),i(`system.meshNetworks.connect`,`Connect`)]}),e(M,{size:`sm`,variant:`ghost`,disabled:v.isPending,onClick:()=>v.mutate({addonId:t}),children:[v.isPending?r(O,{className:`h-3 w-3 animate-spin`}):r(D,{className:`h-3 w-3`}),i(`system.meshNetworks.logOut`,`Log out`)]})]})})}function mt({addonId:t}){let{t:n}=I(),{status:i}=Z(t),a=Te({addonId:t},{refetchInterval:lt,retry:!1});return e(`div`,{className:`rounded-lg border border-border bg-surface`,children:[e(`div`,{className:`space-y-4 p-2 sm:p-4`,children:[i.error&&r(fe,{message:i.error}),r(ht,{status:i}),i.endpoints.length>0&&e(`div`,{className:`space-y-1.5`,children:[r(`div`,{className:`text-[11px] font-semibold text-foreground-subtle uppercase tracking-wide`,children:n(`system.meshNetworks.endpoints`,`Endpoints`)}),i.endpoints.map(t=>e(`div`,{className:`flex items-center gap-2 text-xs flex-wrap`,children:[e(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium ${ct[t.scope]??`bg-foreground-subtle/15 text-foreground-subtle`}`,children:[t.scope===`public`?r(A,{className:`inline h-2.5 w-2.5 mr-0.5`}):null,t.label]}),e(`a`,{href:t.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-emerald-700 dark:text-emerald-300 hover:underline break-all flex items-center gap-1`,children:[r(v,{className:`h-3 w-3 shrink-0`}),t.url]})]},t.id))]})]}),r(`div`,{className:`border-t border-border`,children:r(_t,{peers:a.data?.peers??[],loading:a.isLoading})})]})}function ht({status:t}){let{t:n}=I();return r(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-1.5`,children:[{label:n(`system.meshNetworks.tenant`,`Tenant`),value:t.tenantName||`—`},{label:n(`system.meshNetworks.user`,`User`),value:t.userLogin??`—`},{label:n(`system.meshNetworks.controlPlane`,`Control plane`),value:t.controlPlaneUrl||`—`},{label:n(`system.meshNetworks.meshIp`,`Mesh IP`),value:t.meshIp||`—`,mono:!0},{label:n(`system.meshNetworks.magicdns`,`MagicDNS`),value:t.magicDnsHostname||`—`,mono:!0},{label:n(`system.meshNetworks.dnsSuffix`,`DNS suffix`),value:t.magicDnsSuffix||`—`,mono:!0},{label:n(`system.meshNetworks.peers`,`Peers`),value:String(t.peerCount)},{label:n(`system.meshNetworks.keyExpiry`,`Key expiry`),value:t.keyExpiry?gt(t.keyExpiry):`—`}].map(t=>e(`div`,{className:`flex items-baseline justify-between gap-3 text-xs`,children:[r(`span`,{className:`text-foreground-subtle shrink-0`,children:t.label}),r(`span`,{className:`text-foreground truncate ${t.mono?`font-mono`:``}`,children:t.value})]},t.label))})}function gt(e){let t=e-Date.now();if(t<0)return F.t(`system.meshNetworks.expiredAgo`,{when:Q(e)});let n=Math.floor(t/864e5);if(n>60)return new Date(e).toLocaleDateString();if(n>1)return F.t(`system.meshNetworks.expiryDays`,{count:n});let r=Math.floor(t/36e5);return r>1?F.t(`system.meshNetworks.expiryHours`,{count:r}):F.t(`system.meshNetworks.expiryMin`,{count:Math.max(1,Math.floor(t/6e4))})}function _t({peers:i,loading:a}){let{t:o}=I(),s=t(()=>i.map(e=>({...e,_id:e.id})),[i]),c=n(e=>{e&&navigator.clipboard?.writeText(e)},[]),l=t(()=>[{key:`hostname`,header:o(`system.meshNetworks.hostname`,`Hostname`),render:t=>e(`div`,{className:`flex flex-col`,children:[e(`div`,{className:`flex items-center gap-1.5`,children:[r(`span`,{className:`font-medium text-foreground`,children:t.hostname||o(`system.meshNetworks.unknown`,`(unknown)`)}),t.isSelf&&r(P,{variant:`info`,children:o(`common.self`)}),t.exitNodeOption&&r(P,{variant:`warning`,children:`exit-node`})]}),t.userLogin&&r(`div`,{className:`text-[10px] text-foreground-subtle truncate`,children:t.userLogin})]})},{key:`magicDns`,header:o(`system.meshNetworks.magicdns`,`MagicDNS`),render:t=>t.magicDns?e(`div`,{className:`flex items-center gap-1`,children:[r(`span`,{className:`font-mono text-xs truncate`,children:t.magicDns}),r(`button`,{onClick:()=>c(t.magicDns),className:`p-0.5 hover:bg-foreground-subtle/10 rounded`,"aria-label":o(`system.meshNetworks.copyMagicdns`,`Copy MagicDNS`),children:r(g,{className:`h-3 w-3 text-foreground-subtle`})})]}):r(`span`,{className:`text-foreground-subtle`,children:`—`})},{key:`addresses`,header:`IP`,render:t=>{let n=t.addresses[0]??``;return n?e(`div`,{className:`flex items-center gap-1`,children:[r(`span`,{className:`font-mono text-xs`,children:n}),r(`button`,{onClick:()=>c(n),className:`p-0.5 hover:bg-foreground-subtle/10 rounded`,"aria-label":o(`system.meshNetworks.copyIp`,`Copy IP`),children:r(g,{className:`h-3 w-3 text-foreground-subtle`})})]}):r(`span`,{className:`text-foreground-subtle`,children:`—`})}},{key:`connection`,header:o(`system.meshNetworks.connection`,`Connection`),render:t=>e(`div`,{className:`flex items-center gap-1.5`,children:[r(P,{variant:vt(t.connection),children:t.connection}),t.relay&&r(`span`,{className:`text-[10px] text-foreground-subtle font-mono`,children:t.relay})]})},{key:`routes`,header:o(`system.meshNetworks.routes`,`Routes`),render:e=>e.advertisedRoutes.length>0?r(`span`,{className:`text-[10px] font-mono text-foreground-subtle truncate`,children:e.advertisedRoutes.join(`, `)}):r(`span`,{className:`text-foreground-subtle`,children:`—`})},{key:`tx`,header:o(`system.meshNetworks.txRx`,`TX / RX`),render:t=>e(`span`,{className:`text-[10px] text-foreground-subtle font-mono`,children:[`↑ `,yt(t.txBytes),` · ↓ `,yt(t.rxBytes)]})},{key:`lastSeen`,header:o(`system.meshNetworks.lastSeen`,`Last seen`),render:e=>r(`span`,{className:`text-[10px] text-foreground-subtle`,children:e.lastSeenMs>0?Q(e.lastSeenMs):`—`})}],[c,o]);return a&&i.length===0?e(`div`,{className:`p-4 text-xs text-foreground-subtle`,children:[r(O,{className:`h-3 w-3 animate-spin inline mr-1`}),` `,o(`systemPage.meshNetworks.loadingPeers`)]}):i.length===0?r(`div`,{className:`p-4 text-xs text-foreground-subtle`,children:o(`system.meshNetworks.noPeersVisibleYourTailnet`,`No peers visible — your tailnet may be empty or the host is not joined.`)}):r(`div`,{className:`p-4`,children:r(de,{columns:l,rows:s,rowKey:e=>e._id,minWidthPx:820})})}function vt(e){return e===`direct`?`success`:e===`relay`?`warning`:`info`}function yt(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 Q(e){let t=Date.now()-e;return t<6e4?F.t(`system.meshNetworks.justNow`):t<36e5?F.t(`system.meshNetworks.agoMin`,{count:Math.round(t/6e4)}):t<864e5?F.t(`system.meshNetworks.agoHour`,{count:Math.round(t/36e5)}):F.t(`system.meshNetworks.agoDay`,{count:Math.round(t/864e5)})}function bt(e){return new Promise(t=>setTimeout(t,e))}var $=`/system/identity?tab=certificates`;function xt(){let{t}=I();return r(z,{embedded:!0,children:e(`div`,{className:p,children:[r(Ve,{nodeId:`hub`,addonIds:[`local-network`],level:`global`,title:t(`system.localAccess.lanHttp`,`LAN HTTP`),description:t(`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.`)}),e(`p`,{className:`text-xs text-foreground-subtle`,"data-testid":`https-certificate-hint`,children:[t(`system.localAccess.certificateMoved`,`The HTTPS certificate and the local CA are managed under`),` `,r(ze,{className:`underline`,to:$,children:t(`system.localAccess.certificateMovedLink`,`Identity → Certificates`)}),`.`]})]})})}o();function St({value:n,onChange:i}){let{t:a}=I(),{data:o}=ve({isCamera:!0,projection:`slim`}),s=t(()=>o===void 0?[{value:``,label:a(`system.networkDiagnostics.loadingCameras`,`Loading cameras…`)}]:o.length===0?[{value:``,label:a(`system.networkDiagnostics.noCameras`,`No cameras`)}]:[{value:``,label:a(`system.networkDiagnostics.pickACamera`,`Pick a camera`)},...o.toSorted((e,t)=>e.name.localeCompare(t.name)).map(e=>({value:String(e.id),label:`${e.name} (#${String(e.id)})`}))],[o,a]);return e(`label`,{className:`flex min-w-0 flex-col gap-1`,children:[r(`span`,{className:`text-[11px] text-foreground-subtle`,children:a(`system.networkDiagnostics.camera`,`Camera`)}),r(Ee,{value:n===null?``:String(n),disabled:o===void 0||o.length===0,onChange:e=>i(e.target.value===``?null:Number(e.target.value)),options:s})]})}function Ct(){let t=E(),[i,o]=a(null);return r(z,{embedded:!0,children:e(`div`,{className:p,"data-testid":`network-diagnostics`,children:[r(we,{loadServers:n(async()=>t.trpcClient.turnProvider.getTurnServers.query(),[t])}),r(Me,{trpc:t.trpcClient,serverUrl:b(),deviceId:i,cameraField:r(St,{value:i,onChange:o})})]})})}var wt=[`certificate`,`certificates`,`https`];function Tt(){let{t:e}=I(),[t]=Re();if(wt.includes(t.get(`tab`)??``))return r(Le,{to:$,replace:!0});let n=Ie(`/system/network`,{t:e,isAdmin:!0})??{icon:A,title:e(`system.network`,`Network`)};return r(Be,{icon:n.icon,title:n.title,defaultSection:`addresses`,sectionsLabel:`${n.title} sections`,sections:[{id:`local-access`,label:e(`systemPage.network.localAccess`,`Local access`),content:r(xt,{})},{id:`addresses`,label:e(`systemPage.network.networkAddresses`,`Network Addresses`),content:r(st,{})},{id:L.remoteAccess.tab,label:e(`systemPage.network.remoteAccess`,`Remote Access`),content:r(We,{}),ownedParams:R},{id:L.mesh.tab,label:e(`systemPage.network.meshNetworks`,`Mesh Networks`),content:r(dt,{}),ownedParams:R},{id:L.turn.tab,label:e(`systemPage.network.turnServers`,`TURN Servers`),content:r(Xe,{}),ownedParams:R},{id:`diagnostics`,label:e(`systemPage.network.diagnostics`,`Diagnostics`),content:r(Ct,{})}]})}export{Tt as NetworkPage};