@camstack/addon-admin-ui 1.2.614 → 1.2.616
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/CHANGELOG.md +13 -0
- package/dist/assets/Addons-Drg_F6l5.js +5 -0
- package/dist/assets/{AdminPage-CFwzuQZq.js → AdminPage-Dr63s4g1.js} +1 -1
- package/dist/assets/{AdminSectionedPage-CLelstTQ.js → AdminSectionedPage-BLcBNdcD.js} +1 -1
- package/dist/assets/{AiProfiles-BRWqnNZw.js → AiProfiles-D3Q8LX08.js} +2 -2
- package/dist/assets/{Authentication-DnTfdKv0.js → Authentication-Cny_U-Ec.js} +1 -1
- package/dist/assets/{Build-Dcb2pWJ3.js → Build-C--JkJiK.js} +3 -3
- package/dist/assets/{Calendars-e6-I6axd.js → Calendars-XlEmimqQ.js} +1 -1
- package/dist/assets/{CameraGrids-B50NWiaX.js → CameraGrids-DXtZMvPT.js} +1 -1
- package/dist/assets/Cluster-MOVZh0iU.js +1 -0
- package/dist/assets/{CompositionBlockEditor-B6jhi4aP.js → CompositionBlockEditor-DuAgeV-P.js} +2 -2
- package/dist/assets/{CompositionEditorPage-BNCoZYmk.js → CompositionEditorPage-aBvP7SJT.js} +1 -1
- package/dist/assets/Data-DFYNsBPn.js +2 -0
- package/dist/assets/DeviceDetail-DMswpKXJ.js +2 -0
- package/dist/assets/{DeviceDoActionFields-Ck7XT6eT.js → DeviceDoActionFields-Dzmks86B.js} +1 -1
- package/dist/assets/{Devices-BheZyJ-P.js → Devices-CfyiqOHT.js} +1 -1
- package/dist/assets/{EditTemplateButton-DfaR1xaE.js → EditTemplateButton-hVIHmM2y.js} +1 -1
- package/dist/assets/{EmbedPlayerPage-BLyprrLe.js → EmbedPlayerPage-BJe1Ps29.js} +1 -1
- package/dist/assets/{History-CMAcE6-w.js → History-C_RFzaIx.js} +1 -1
- package/dist/assets/Identity-CyyAo5Ts.js +1 -0
- package/dist/assets/InstancesTable-BmmC27pU.js +1 -0
- package/dist/assets/{IntegrationDetail-xN1LX9eo.js → IntegrationDetail-DYaSoB9L.js} +1 -1
- package/dist/assets/{IntegrationHub-C2lol4OL.js → IntegrationHub-0gxAZhI_.js} +1 -1
- package/dist/assets/{Integrations-g-niY6cn.js → Integrations-8IetfyM6.js} +1 -1
- package/dist/assets/Integrations-C-DnSnBR.js +2 -0
- package/dist/assets/Library-csRRY_2h.js +1 -0
- package/dist/assets/Locations-slVY93jW.js +3 -0
- package/dist/assets/{Logs-DnrXua_L.js → Logs-PKfddu2i.js} +1 -1
- package/dist/assets/{MaskShapeCanvas-C6oPs8v9.js → MaskShapeCanvas-DMXSe9GH.js} +1 -1
- package/dist/assets/{MotionZonesSettings-CQDdomka.js → MotionZonesSettings-BwO4KAm1.js} +1 -1
- package/dist/assets/{MyAccess-B_zQMOku.js → MyAccess-B6AAL29s.js} +1 -1
- package/dist/assets/Network-Csf_6Jzi.js +1 -0
- package/dist/assets/{NodeAddonsSettingsPanel-cxbuP4ql.js → NodeAddonsSettingsPanel-fFZ1L1c0.js} +1 -1
- package/dist/assets/Notifications-DEST0syp.js +1 -0
- package/dist/assets/Pipeline-DlyWPv7O.js +1 -0
- package/dist/assets/{PrivacyMaskSettings-B393FBCM.js → PrivacyMaskSettings-tqDBT7wc.js} +1 -1
- package/dist/assets/{Recordings-D5nf9HZf.js → Recordings-C75nL3Qm.js} +1 -1
- package/dist/assets/{ScanSubnetEditor-DDCY_Smw.js → ScanSubnetEditor-VGXOCBIe.js} +1 -1
- package/dist/assets/{SceneMonitorEditor-C4SLNj7I.js → SceneMonitorEditor-C0ZLt_FE.js} +1 -1
- package/dist/assets/SessionsList-BDofSeHx.js +2 -0
- package/dist/assets/{Showroom-CAKlBSf_.js → Showroom-BAgtcDk2.js} +1 -1
- package/dist/assets/StorageLocationsTable-BoYDeu0_.js +1 -0
- package/dist/assets/{System-tBNwbwSw.js → System-B-xiRllm.js} +1 -1
- package/dist/assets/{Templates-15bFODqK.js → Templates-Bc4j-2v1.js} +1 -1
- package/dist/assets/{Terminal-CKF5OWVY.js → Terminal-Dwfw8N-B.js} +2 -2
- package/dist/assets/{TrainingProviders-TZdkLaIZ.js → TrainingProviders-BbwcmuZi.js} +1 -1
- package/dist/assets/{Viewer-DFYKi9Wb.js → Viewer-BGBbojOW.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BP4WbWeD.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DRYUB-aH.js} +1 -1
- package/dist/assets/{addon-icons-context-BATuZHTE.js → addon-icons-context-qhDMLpPS.js} +1 -1
- package/dist/assets/{ai-page.helpers-DdhWucEq.js → ai-page.helpers-njHq7G60.js} +1 -1
- package/dist/assets/{archive-BoBKxtQ-.js → archive-CvOMe4gf.js} +1 -1
- package/dist/assets/{assignment-candidates-CxG90bWr.js → assignment-candidates-BwQVwrmi.js} +1 -1
- package/dist/assets/{authed-media-DnXUvZXJ.js → authed-media-B7bl8tPz.js} +1 -1
- package/dist/assets/{bell-off-BzoeiUVh.js → bell-off-BsP6ddBp.js} +1 -1
- package/dist/assets/{board-model-CtzCCjoE.js → board-model-DWxnYEWa.js} +1 -1
- package/dist/assets/{boxes-C6W6e-rK.js → boxes-DIhbjn5a.js} +1 -1
- package/dist/assets/{calendar-clock-pwKTUpB4.js → calendar-clock-BsT9Lwvq.js} +1 -1
- package/dist/assets/circle-slash-Csf7e9y5.js +1 -0
- package/dist/assets/{create-composition-D1HcJt41.js → create-composition-BpGtUfUl.js} +2 -2
- package/dist/assets/crop-BwDvG8SO.js +1 -0
- package/dist/assets/{database-zap-BixS9sEU.js → database-zap-CwRJ0-SM.js} +1 -1
- package/dist/assets/{device-integration-icon-B20WxJ4F.js → device-integration-icon-iVPQ5kKM.js} +1 -1
- package/dist/assets/device-picker-model-nW8vP7T1.js +1 -0
- package/dist/assets/{eraser-BgUWN8pT.js → eraser-CuLdbo7W.js} +1 -1
- package/dist/assets/{file-up-DH881GrF.js → file-up-F0uKRM-I.js} +1 -1
- package/dist/assets/{format-BsOPQm9n.js → format-DBBv3FG3.js} +1 -1
- package/dist/assets/{grip-vertical-_jfdera5.js → grip-vertical-B-IndDz6.js} +1 -1
- package/dist/assets/{hard-drive-download-BGhjVh74.js → hard-drive-download-DY-OQh0v.js} +1 -1
- package/dist/assets/{hostInit-CO036Kz-.js → hostInit-DkAHM_1E.js} +1 -1
- package/dist/assets/i18n-_4l4T7tH.js +1 -0
- package/dist/assets/icons-ChdyRSvl.js +1 -0
- package/dist/assets/index-CKdLDmIt.js +4 -0
- package/dist/assets/{key-4O6zcP-D.js → key-BCxCEqdb.js} +1 -1
- package/dist/assets/{key-square-45doQ7Dg.js → key-square-CxmlVr0h.js} +1 -1
- package/dist/assets/{layers-DaT1iT13.js → layers-BQ4CfwT4.js} +1 -1
- package/dist/assets/{link-2-off-DtNWZ97C.js → link-2-off-KZXTolmN.js} +1 -1
- package/dist/assets/{linked-devices-model-BxWV-O4v.js → linked-devices-model-BEE-GxdH.js} +1 -1
- package/dist/assets/{list-ordered-cIv3ExKb.js → list-ordered-BD9rtsb8.js} +1 -1
- package/dist/assets/{memory-stick-PjDavRx_.js → memory-stick-BWqihNRD.js} +1 -1
- package/dist/assets/{message-square-plus-DXescy-B.js → message-square-plus-BKfambdz.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-f77a2fc3.js → mf-entry-bootstrap-0-b532ab4d.js} +2 -2
- package/dist/assets/{mic-off-BXQSysjl.js → mic-off-B6rqYts5.js} +1 -1
- package/dist/assets/{monitor-off-DBW86jnf.js → monitor-off-DHS2nIpy.js} +1 -1
- package/dist/assets/{monitor-smartphone-BuyeEe1i.js → monitor-smartphone-CHT4W6lM.js} +1 -1
- package/dist/assets/mount-nW8vP7T1.js +1 -0
- package/dist/assets/{notification-rule-status-DORi1LR8.js → notification-rule-status-BzrPNI2x.js} +1 -1
- package/dist/assets/player-overlays-CDEJeChs.js +1 -0
- package/dist/assets/remoteEntry-CCCk77d7.js +1 -0
- package/dist/assets/{ruler-Bu3N8rrH.js → ruler-CIXXEKsv.js} +1 -1
- package/dist/assets/{scan-eye-BZaxSxlS.js → scan-eye-Mq4zK06M.js} +1 -1
- package/dist/assets/{scissors-DJgb5Dpv.js → scissors-BcW6Mc7M.js} +1 -1
- package/dist/assets/{search-x-CXApjOId.js → search-x-i3gDm6mI.js} +1 -1
- package/dist/assets/{send-SWldcTuN.js → send-wpBryEwN.js} +1 -1
- package/dist/assets/{settings-2-CWXy2awV.js → settings-2-B6wA8SQQ.js} +1 -1
- package/dist/assets/{shapes-BmXpqq30.js → shapes-D0lS1sG-.js} +1 -1
- package/dist/assets/{sigma-DiGmvY8h.js → sigma-BkoUYx-o.js} +1 -1
- package/dist/assets/{speaker-B8m2jKCq.js → speaker-CqOk3MNB.js} +1 -1
- package/dist/assets/src-Bz_Mw4PZ.js +100 -0
- package/dist/assets/{sso-popup-CQV5EFHP.js → sso-popup-9QEjaqmi.js} +1 -1
- package/dist/assets/{step-inspector-model-qn2KNkFH.js → step-inspector-model-DhcHrtkG.js} +1 -1
- package/dist/assets/{table-2-D4kzIxer.js → table-2-C8eX9UBz.js} +1 -1
- package/dist/assets/{timer-reset-kOifM6eK.js → timer-reset-DmyTvMJb.js} +1 -1
- package/dist/assets/{unlink-C_Ulygv5.js → unlink-C1AgH7gH.js} +1 -1
- package/dist/assets/{usb-CkkUZj4I.js → usb-Crbrwo0M.js} +1 -1
- package/dist/assets/{use-device-bound-caps-CZpFb_Qq.js → use-device-bound-caps-CRV9yvzO.js} +1 -1
- package/dist/assets/{use-scenes-feed-Cu_zC57R.js → use-scenes-feed-31kGki0u.js} +1 -1
- package/dist/assets/{use-stationary-objects-Q5PKhCS6.js → use-stationary-objects-CXcjkOWj.js} +1 -1
- package/dist/assets/{useAdminDeviceRemoval-Bz4WkutY.js → useAdminDeviceRemoval-CD-eLAEs.js} +1 -1
- package/dist/assets/useEventInvalidation-nW8vP7T1.js +1 -0
- package/dist/assets/{useNodeUrlSelection-tdR3ldN7.js → useNodeUrlSelection-B0wt3Abi.js} +1 -1
- package/dist/assets/user-round-B8uNRnbG.js +1 -0
- package/dist/assets/{user-x-BLftkftU.js → user-x-CXK-3Bzx.js} +1 -1
- package/dist/assets/{variable-DjMixfBE.js → variable-CjnitRxC.js} +1 -1
- package/dist/assets/{video-CYBcnY0R.js → video-CbOJmRcC.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-C8oQmSMS.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BqeYgF3b.js} +2 -2
- package/dist/index.html +9 -9
- package/dist/server/addon.js +1 -1
- package/package.json +2 -2
- package/dist/assets/Addons-BJfkLwLO.js +0 -5
- package/dist/assets/Cluster-D9cpYS50.js +0 -1
- package/dist/assets/Data-BFkaT-HN.js +0 -2
- package/dist/assets/DeviceDetail-CRQXzGOA.js +0 -2
- package/dist/assets/Identity-BLgJKNk9.js +0 -1
- package/dist/assets/InstancesTable-D2yWNUaZ.js +0 -1
- package/dist/assets/Integrations-DcQm6Aj2.js +0 -2
- package/dist/assets/Library-CyT_JYCP.js +0 -1
- package/dist/assets/Locations-EQv-h_uV.js +0 -3
- package/dist/assets/Network-6hbESyUy.js +0 -1
- package/dist/assets/Notifications-NBpKEuZV.js +0 -1
- package/dist/assets/Pipeline-BvFoujQo.js +0 -1
- package/dist/assets/SessionsList-DpwHjjFs.js +0 -2
- package/dist/assets/StorageLocationsTable-CqPhkqVL.js +0 -1
- package/dist/assets/circle-slash-B2xq8hu-.js +0 -1
- package/dist/assets/crop-DdLH59eG.js +0 -1
- package/dist/assets/device-picker-model-DVfMULL6.js +0 -1
- package/dist/assets/i18n-C6fCBciG.js +0 -1
- package/dist/assets/icons-BUi4kBRk.js +0 -1
- package/dist/assets/index-BCsJtJDS.js +0 -4
- package/dist/assets/mount-DVfMULL6.js +0 -1
- package/dist/assets/player-overlays-DRJ5jYka.js +0 -1
- package/dist/assets/remoteEntry-BvXi9rH1.js +0 -1
- package/dist/assets/src-He9Tsysa.js +0 -100
- package/dist/assets/useEventInvalidation-DVfMULL6.js +0 -1
- package/dist/assets/user-round-DjzMluaj.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,S as t}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Xn as n,dt as r}from"./player-overlays-DRJ5jYka.js";import{Ar as i,Or as a,Pr as o,_r as s,gr as c,hr as l,jr as u,kr as d,mr as f,vr as p}from"./client-Dd2wRwgL.js";import{t as m}from"./grip-vertical-_jfdera5.js";import{bf as h,vi as g}from"./src-He9Tsysa.js";import{t as _}from"./useTranslation-BJr-n0es.js";import{Rr as v}from"./index-BCsJtJDS.js";function y(){return{columns:3,rows:4,buttons:[]}}var b=e=>({status:`refused`,reason:e}),x=e=>({status:`ok`,grid:e});function S(e,t){return t.row>=0&&t.col>=0&&t.row+t.rowSpan<=e.rows&&t.col+t.colSpan<=e.columns}var C=d;function w(e,t){return t.row>=e.row&&t.col>=e.col&&t.row+t.rowSpan<=e.row+e.rowSpan&&t.col+t.colSpan<=e.col+e.colSpan}function T(e){return e.groups??[]}function E(e,t){return T(e).find(e=>e.id===t)}function ee(e,t){return e.buttons.filter(e=>e.groupId===t)}function D(e,t){let{groups:n,...r}=e;return t.length===0?r:{...r,groups:[...t]}}function O(e,t){let{groupId:n,...r}=t;for(let n of T(e))if(C(n,t))return n.frame===`divider`||!w(n,t)?`overlap`:{...r,groupId:n.id};return r}function k(e,t,n){if(t.rowSpan<1||t.colSpan<1)return`invalid-size`;if(!S(e,t))return`outside`;if(e.buttons.some(e=>e.id!==n&&C(e,t)))return`overlap`;let r=O(e,t);return typeof r==`string`?r:null}function A(e,t){let n=k(e,t,t.id);if(n!==null)return b(n);let r=O(e,t);return typeof r==`string`?b(r):x({...e,buttons:e.buttons.map(e=>e.id===t.id?r:e)})}function j(e,t){return e.buttons.find(e=>e.id===t)}function te(e){let t=new Set(e.buttons.map(e=>e.id));for(let n=e.buttons.length+1;;n+=1)if(!t.has(`b${n}`))return`b${n}`}function ne(e){for(let t=0;t<e.rows;t+=1)for(let n=0;n<e.columns;n+=1){let r={id:``,row:t,col:n,rowSpan:1,colSpan:1,role:`power`};if(!T(e).some(e=>C(e,r))&&k(e,r,null)===null)return{row:t,col:n}}return null}function re(e,t){if(e.buttons.length>=200)return b(`outside`);let n=ne(e);if(n===null)return b(`outside`);let r=O(e,{id:te(e),row:n.row,col:n.col,rowSpan:1,colSpan:1,role:t});return typeof r==`string`?b(r):x({...e,buttons:[...e.buttons,r]})}function M(e,t,n,r){let i=j(e,t);return i===void 0?b(`unknown-button`):A(e,{...i,row:n,col:r})}function ie(e,t,n,r){let i=j(e,t);return i===void 0?b(`unknown-button`):M(e,t,i.row+n,i.col+r)}function ae(e,t,n,r){let i=j(e,t);return i===void 0?b(`unknown-button`):A(e,{...i,rowSpan:n,colSpan:r})}function oe(e,t,n){let r=j(e,t);if(r===void 0)return b(`unknown-button`);let i=n.icon===void 0?r.icon:n.icon??void 0,a=n.label===void 0?r.label:n.label??void 0,o=a===void 0||a.trim()===``?void 0:a,{icon:s,label:c,...l}=r,u={...l,role:n.role??r.role,...i===void 0?{}:{icon:i},...o===void 0?{}:{label:o}};return x({...e,buttons:e.buttons.map(e=>e.id===t?u:e)})}function se(e,t,n){let r=j(e,t);if(r===void 0)return b(`unknown-button`);let{shape:i,tone:a,...o}=r,s=n.shape===void 0?r.shape:n.shape??void 0,c=n.tone===void 0?r.tone:n.tone??void 0,l={...o,...s===void 0?{}:{shape:s},...c===void 0?{}:{tone:c}};return x({...e,buttons:e.buttons.map(e=>e.id===t?l:e)})}function ce(e,t){return{...e,buttons:e.buttons.filter(e=>e.id!==t)}}var N=e=>e.ok?x(e.layout):b(e.reason);function le(e,t,n,r){return N(f(e,t,{row:n,col:r}))}function ue(e,t,n){return N(l(e,t,{keepButtons:n}))}function de(e,t,n){let r=E(e,t);if(r===void 0)return b(`unknown-group`);let{title:i,...a}=r,o=n.trim()===``?a:{...a,title:n.slice(0,40)};return x(D(e,T(e).map(e=>e.id===t?o:e)))}function fe(e){return e.frame===`divider`&&e.rowSpan===1&&e.size!==`normal`}function P(e){let t=new Set,n=T(e);for(let r of n){if(!fe(r))continue;let i=r.row;e.buttons.some(e=>e.row<=i&&i<e.row+e.rowSpan)||n.some(e=>e!==r&&e.row<=i&&i<e.row+e.rowSpan)||t.add(i)}return t}function F(e){let t=P(e);return Array.from({length:e.rows},(e,n)=>(t.has(n)?1:2.75)+.375)}function I(e,t,n){let r=E(e,t);if(r===void 0)return b(`unknown-group`);let{size:i,hideTitle:a,...o}=r,s=n.size??r.size,c=n.hideTitle??r.hideTitle,l={...o,...s===`normal`?{size:s}:{},...c===!0?{hideTitle:c}:{}};return x(D(e,T(e).map(e=>e.id===t?l:e)))}function L(e,t,n){let r=e=>!Number.isInteger(e)||e<1||e>24;if(r(t)||r(n))return b(`invalid-size`);let i={...e,columns:t,rows:n};return e.buttons.some(e=>!S(i,e))||T(e).some(e=>!S(i,e))?b(`would-drop-buttons`):x(i)}function R(e){let t=a.safeParse(e);return t.success?t.data:null}function z(e){let t=a.safeParse(e);return t.success?t.data:y()}var B=[`power`,`volume`,`channel`,`navigation`,`playback`,`digits`,`other`];function V(e){return e.startsWith(`power`)?`power`:e.startsWith(`volume`)||e===`mute`?`volume`:e.startsWith(`channel`)?`channel`:e.startsWith(`digit_`)?`digits`:[`up`,`down`,`left`,`right`,`ok`,`back`,`home`,`menu`,`exit`].includes(e)?`navigation`:[`play`,`pause`,`play_pause`,`stop`,`next`,`previous`,`fast_forward`,`rewind`].includes(e)?`playback`:`other`}function pe(e){return i.filter(t=>V(t)===e)}function me(e){let t=u(e),n=(t??e).replace(/_/g,` `);return t===null?n.charAt(0).toUpperCase()+n.slice(1):n}function he(e){return u(e)!==null&&!o(e)}function ge(e,t,n){let r={columns:e,rows:t,buttons:[]};for(let e of n){let t={id:e.id,row:e.row,col:e.col,rowSpan:e.rowSpan??1,colSpan:e.colSpan??1,role:e.role,...e.icon===void 0?{}:{icon:e.icon},...e.label===void 0?{}:{label:e.label}},n=k(r,t,null);if(n!==null||r.buttons.some(t=>t.id===e.id))throw Error(`layout button "${e.id}": ${n??`duplicate id`}`);r={...r,buttons:[...r.buttons,t]}}return r}var H=`"/></svg>`,_e={title:`Apple Music`,slug:`applemusic`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Apple Music</title><path d="`+this.path+H},path:`M23.994 6.124a9.23 9.23 0 00-.24-2.19c-.317-1.31-1.062-2.31-2.18-3.043a5.022 5.022 0 00-1.877-.726 10.496 10.496 0 00-1.564-.15c-.04-.003-.083-.01-.124-.013H5.986c-.152.01-.303.017-.455.026-.747.043-1.49.123-2.193.4-1.336.53-2.3 1.452-2.865 2.78-.192.448-.292.925-.363 1.408-.056.392-.088.785-.1 1.18 0 .032-.007.062-.01.093v12.223c.01.14.017.283.027.424.05.815.154 1.624.497 2.373.65 1.42 1.738 2.353 3.234 2.801.42.127.856.187 1.293.228.555.053 1.11.06 1.667.06h11.03a12.5 12.5 0 001.57-.1c.822-.106 1.596-.35 2.295-.81a5.046 5.046 0 001.88-2.207c.186-.42.293-.87.37-1.324.113-.675.138-1.358.137-2.04-.002-3.8 0-7.595-.003-11.393zm-6.423 3.99v5.712c0 .417-.058.827-.244 1.206-.29.59-.76.962-1.388 1.14-.35.1-.706.157-1.07.173-.95.045-1.773-.6-1.943-1.536a1.88 1.88 0 011.038-2.022c.323-.16.67-.25 1.018-.324.378-.082.758-.153 1.134-.24.274-.063.457-.23.51-.516a.904.904 0 00.02-.193c0-1.815 0-3.63-.002-5.443a.725.725 0 00-.026-.185c-.04-.15-.15-.243-.304-.234-.16.01-.318.035-.475.066-.76.15-1.52.303-2.28.456l-2.325.47-1.374.278c-.016.003-.032.01-.048.013-.277.077-.377.203-.39.49-.002.042 0 .086 0 .13-.002 2.602 0 5.204-.003 7.805 0 .42-.047.836-.215 1.227-.278.64-.77 1.04-1.434 1.233-.35.1-.71.16-1.075.172-.96.036-1.755-.6-1.92-1.544-.14-.812.23-1.685 1.154-2.075.357-.15.73-.232 1.108-.31.287-.06.575-.116.86-.177.383-.083.583-.323.6-.714v-.15c0-2.96 0-5.922.002-8.882 0-.123.013-.25.042-.37.07-.285.273-.448.546-.518.255-.066.515-.112.774-.165.733-.15 1.466-.296 2.2-.444l2.27-.46c.67-.134 1.34-.27 2.01-.403.22-.043.442-.088.663-.106.31-.025.523.17.554.482.008.073.012.148.012.223.002 1.91.002 3.822 0 5.732z`,source:`https://www.apple.com/itunes/marketing-on-music/identity-guidelines.html#apple-music-icon`,hex:`FA243C`},ve={title:`Apple TV`,slug:`appletv`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Apple TV</title><path d="`+this.path+H},path:`M20.57 17.735h-1.815l-3.34-9.203h1.633l2.02 5.987c.075.231.273.9.586 2.012l.297-.997.33-1.006 2.094-6.004H24zm-5.344-.066a5.76 5.76 0 0 1-1.55.207c-1.23 0-1.84-.693-1.84-2.087V9.646h-1.063V8.532h1.121V7.081l1.476-.602v2.062h1.707v1.113H13.38v5.805c0 .446.074.75.214.932.14.182.396.264.75.264.207 0 .495-.041.883-.115zm-7.29-5.343c.017 1.764 1.55 2.358 1.567 2.366-.017.042-.248.842-.808 1.658-.487.71-.99 1.418-1.79 1.435-.783.016-1.03-.462-1.93-.462-.89 0-1.17.445-1.913.478-.758.025-1.344-.775-1.838-1.484-.998-1.451-1.765-4.098-.734-5.88.51-.89 1.426-1.451 2.416-1.46.75-.016 1.468.512 1.93.512.461 0 1.327-.627 2.234-.536.38.016 1.452.157 2.136 1.154-.058.033-1.278.743-1.27 2.219M6.468 7.988c.404-.495.685-1.18.61-1.864-.585.025-1.294.388-1.723.883-.38.437-.71 1.138-.619 1.806.652.05 1.328-.338 1.732-.825Z`,source:`https://en.wikipedia.org/wiki/File:Apple_TV_(logo).svg`,hex:`000000`},ye={title:`Crunchyroll`,slug:`crunchyroll`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Crunchyroll</title><path d="`+this.path+H},path:`M2.909 13.436C2.914 7.61 7.642 2.893 13.468 2.898c5.576.005 10.137 4.339 10.51 9.819q.021-.351.022-.706C24.007 5.385 18.64.006 12.012 0S.007 5.36 0 11.988 5.36 23.994 11.988 24q.412 0 .815-.027c-5.526-.338-9.9-4.928-9.894-10.538Zm16.284.155a4.1 4.1 0 0 1-4.095-4.103 4.1 4.1 0 0 1 2.712-3.855 8.95 8.95 0 0 0-4.187-1.037 9.007 9.007 0 1 0 8.997 9.016q-.001-.847-.15-1.651a4.1 4.1 0 0 1-3.278 1.63Z`,source:`https://www.crunchyroll.com`,hex:`FF5E00`},be={title:`DAZN`,slug:`dazn`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>DAZN</title><path d="`+this.path+H},path:`M14.774 8.291l.772-2.596.79 2.596zm3.848 2.268l-2.025-6.128c-.045-.135-.097-.224-.154-.266-.059-.041-.152-.063-.28-.063h-1.12a.485.485 0 0 0-.284.068c-.06.045-.11.132-.149.261l-2.045 6.128c-.025.032-.038.096-.038.192 0 .149.09.223.27.223h.84c.076 0 .139-.003.187-.01a.207.207 0 0 0 .116-.048.326.326 0 0 0 .077-.116c.022-.051.046-.119.072-.202l.318-1.071h2.306l.327 1.051c.026.09.051.16.077.213a.395.395 0 0 0 .087.12c.031.028.07.047.114.053h.002c.045.006.103.01.173.01h.897c.18 0 .27-.074.27-.223a.59.59 0 0 0-.005-.09.878.878 0 0 0-.036-.108l.003.006zm-.994 2.467h-.646c-.168 0-.279.024-.333.072-.055.049-.082.147-.082.295v3.638l-1.91-3.647c-.076-.155-.152-.253-.226-.295-.074-.041-.204-.063-.39-.063h-.599c-.167 0-.278.025-.332.073-.055.048-.082.147-.082.294v6.138c0 .148.025.246.077.294.052.048.16.072.328.072h.656c.167 0 .278-.024.332-.072.055-.048.082-.146.082-.294v-3.648l1.91 3.657c.077.155.152.253.227.295.073.042.204.062.39.062h.598c.167 0 .278-.024.333-.072.054-.048.082-.146.082-.294v-6.138c0-.148-.028-.246-.082-.294-.055-.048-.166-.073-.333-.073zm3.203-.581l1.665 1.665v8.385H1.505V14.11l1.663-1.664a.63.63 0 0 0 0-.89L1.504 9.891V1.505h20.991v8.384l-1.665 1.666a.63.63 0 0 0 0 .89zM24 0H0v10.613L1.387 12 0 13.387V24h24V13.387L22.613 12 24 10.613zM10.67 18.469H7.96l2.855-4.014a.67.67 0 0 0 .087-.155.425.425 0 0 0 .019-.135v-.772c0-.148-.028-.246-.082-.294-.055-.048-.166-.073-.334-.073H6.382c-.149 0-.245.028-.29.082-.045.055-.068.169-.068.343v.58c0 .172.023.287.068.341.045.055.141.083.29.083h2.545L6.11 18.469a.438.438 0 0 0-.107.27v.792c0 .148.027.245.082.294.055.048.167.072.334.072h4.25c.148 0 .245-.027.29-.081.045-.055.068-.17.068-.344v-.579c0-.173-.023-.287-.068-.342-.045-.055-.142-.082-.29-.082zM9.408 8.233c0 .264-.017.484-.052.661-.036.177-.093.32-.174.43a.648.648 0 0 1-.318.231 1.523 1.523 0 0 1-.487.068h-.79v-4.17h.79c.366 0 .63.11.79.324.16.215.241.571.241 1.067v1.389zm1.38-2.789c-.225-.457-.533-.795-.921-1.013-.39-.219-.88-.328-1.47-.328H6.418c-.167 0-.278.024-.333.072-.054.049-.082.147-.082.294v6.138c0 .148.028.246.082.295.055.048.166.072.333.072h2.218c1.048 0 1.765-.447 2.15-1.342.09-.205.153-.413.188-.622a4.91 4.91 0 0 0 .054-.796V6.911c0-.367-.018-.656-.054-.868a2.2 2.2 0 0 0-.193-.612l.006.013z`,source:`https://media.dazn.com/en/assets/`,hex:`F8F8F5`},xe={title:`Kodi`,slug:`kodi`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Kodi</title><path d="`+this.path+H},path:`M12.03.047c-.226 0-.452.107-.669.324-.922.922-1.842 1.845-2.763 2.768-.233.233-.455.48-.703.695-.31.267-.405.583-.399.988.02 1.399.008 2.799.008 4.198 0 1.453-.002 2.907 0 4.36 0 .11.002.223.03.327.087.337.303.393.546.15 1.31-1.31 2.618-2.622 3.928-3.933l4.449-4.453c.43-.431.43-.905 0-1.336L12.697.37c-.216-.217-.442-.324-.668-.324zm7.224 7.23c-.223 0-.445.104-.65.309L14.82 11.37c-.428.429-.427.895 0 1.322l3.76 3.766c.44.44.908.44 1.346.002 1.215-1.216 2.427-2.433 3.644-3.647.182-.18.353-.364.43-.615v-.33c-.077-.251-.246-.436-.428-.617-1.224-1.22-2.443-2.445-3.666-3.668-.205-.205-.429-.307-.652-.307zM4.18 7.611c-.086.014-.145.094-.207.157L.209 11.572c-.28.284-.278.677.004.96l2.043 2.046c.59.59 1.177 1.182 1.767 1.772.169.168.33.139.416-.084.044-.114.062-.242.063-.364.004-1.283.004-2.567.004-3.851h-.002V8.184c0-.085-.01-.169-.022-.252-.019-.135-.072-.258-.207-.309a.186.186 0 0 0-.095-.012zm7.908 6.838c-.224 0-.447.106-.656.315L7.66 18.537c-.433.434-.433.899.002 1.334 1.215 1.216 2.43 2.43 3.643 3.649.18.18.361.354.611.433h.33c.244-.069.423-.226.598-.402 1.222-1.23 2.45-2.453 3.676-3.68.43-.43.427-.905-.004-1.338l-3.772-3.773c-.208-.208-.432-.311-.656-.31z`,source:`https://kodi.tv`,hex:`17B2E7`},Se={title:`Max`,slug:`max`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Max</title><path d="`+this.path+H},path:`M1.769 0A1.77 1.77 0 0 0 0 1.769V22.23A1.77 1.77 0 0 0 1.769 24H22.23A1.77 1.77 0 0 0 24 22.231V1.77A1.77 1.77 0 0 0 22.231 0zm12.485 3.28a4.301 4.301 0 0 1 4.3 4.302 4.301 4.301 0 0 1-1.993 3.63 6.085 6.085 0 0 1 1.054 3.422 6.085 6.085 0 0 1-6.085 6.085 6.085 6.085 0 0 1-6.085-6.085 6.085 6.085 0 0 1 4.66-5.916 4.301 4.301 0 0 1-.152-1.136 4.301 4.301 0 0 1 4.301-4.301zm0 1.849a2.453 2.453 0 0 0-2.453 2.453 2.453 2.453 0 0 0 2.453 2.453 2.453 2.453 0 0 0 2.453-2.453 2.453 2.453 0 0 0-2.453-2.453zm-2.724 5.268a4.237 4.237 0 0 0-4.237 4.237 4.237 4.237 0 0 0 4.237 4.237 4.237 4.237 0 0 0 4.237-4.237 4.237 4.237 0 0 0-4.237-4.237zm.032 2.54a1.781 1.781 0 1 1 0 3.562 1.781 1.781 0 0 1 0-3.562Z`,source:`https://cycling74.com`,hex:`525252`},Ce={title:`Netflix`,slug:`netflix`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Netflix</title><path d="`+this.path+H},path:`m5.398 0 8.348 23.602c2.346.059 4.856.398 4.856.398L10.113 0H5.398zm8.489 0v9.172l4.715 13.33V0h-4.715zM5.398 1.5V24c1.873-.225 2.81-.312 4.715-.398V14.83L5.398 1.5z`,source:`https://brand.netflix.com/en/assets/logos`,hex:`E50914`,guidelines:`https://brand.netflix.com/en/assets/logos`},we={title:`NOW`,slug:`now`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>NOW</title><path d="`+this.path+H},path:`M8.8009 11.9974c0-.974.7878-1.7634 1.7596-1.7634.9718 0 1.7596.7895 1.7596 1.7634 0 .9738-.7878 1.7634-1.7596 1.7634-.9718 0-1.7596-.7896-1.7596-1.7634zm13.0277-2.896l-1.2166 2.4524-.7878-2.3188-.0015-.0003c-.1566-.4505-.5822-.7737-1.0829-.7737-.399 0-.7505.2054-.956.517-.5255.8015-1.0497 1.6094-1.5735 2.414l-.2785-1.956c-.0963-.6296-.6807-1.0587-1.3048-.9624-.6249.096-1.0538.6778-.958 1.304l.0488.328c-.6427-1.0749-1.8162-1.7945-3.1575-1.7945-1.353 0-2.5352.7324-3.174 1.823l.07-.3434c.1223-.6008-.2645-1.1873-.864-1.31-.5993-.1223-1.1848.265-1.307.8659l-.4763 2.3382-1.752-2.7177c-.198-.3042-.5399-.5053-.9284-.5053-.5317 0-.976.3765-1.084.879l-1.0217 5.012c-.1223.6007.257 1.1846.8575 1.3121.0747.0159.1556.0235.2291.024.5139.0036.9763-.3579 1.0844-.892l.4763-2.3383c.5924.9217 1.1845 1.844 1.779 2.7641.196.2777.5281.4662.9018.4662.5462 0 1.0002-.398 1.0915-.9219l.469-2.302c.2292 1.815 1.7755 3.2187 3.6488 3.2187 1.7257 0 3.1736-1.191 3.5705-2.7972l.2613 1.759c.0736.579.5474 1.0371 1.1411 1.0371.4272 0 .7756-.2445.9972-.5841l1.8844-2.8942.905 2.6645c.1622.4752.5808.8138 1.0961.8138.4788 0 .855-.288 1.0609-.7155l2.402-4.845c.2834-.568.0528-1.2551-.5123-1.5403-.5647-.285-1.2558-.0524-1.5379.5196Z`,source:`https://www.nowtv.com`,hex:`001211`},Te={title:`Paramount+`,slug:`paramountplus`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Paramount+</title><path d="`+this.path+H},path:`M16.347 21.373c.057-.084.151-.314-.025-.74l-.53-1.428c-.073-.182.084-.293.19-.173 0 0 1.004 1.157 1.264 1.64l.495.822c.425.028 1.6.06 2.732.06a3.26 3.26 0 0 1-.316-.364c-1.93-2.392-3.154-3.724-3.166-3.737-.391-.426-.572-.508-.87-.643a4.82 4.82 0 0 1-.138-.065v.364c0 .047-.057.073-.086.022l-2.846-5.001a1.598 1.598 0 0 0-.508-.587l-.277-.194-1.354 3.123c.212 0 .354.216.27.409l-1.25 2.893h1.147c.443 0 .883.087 1.294.255l.302.125s-.913 1.878-.913 2.867c0 .181.028.362.075.534h2.104l-.096-.595s1.266.294 2.502.413M12 2.437c-6.627 0-12 5.373-12 12 0 2.669.873 5.133 2.346 7.126.503-.218.783-.542.983-.791l2.234-2.858a.467.467 0 0 1 .179-.138l.336-.146 3.674-4.659.534-.417 1.094-1.524a.482.482 0 0 1 .101-.102l.478-.347a.34.34 0 0 1 .398-.004l.578.407c.308.216.557.504.726.84l2.322 4.077c.051.09.09.129.182.174.454.227.732.268 1.33.913.277.304 1.495 1.666 3.203 3.784.236.318.538.588.963.783A11.948 11.948 0 0 0 24 14.437c0-6.627-5.373-12-12-12M3.236 15.1l-.778-.253-.48.662v-.818l-.778-.253.778-.253v-.818l.48.662.778-.253-.48.662Zm-.185 2.676-.252.778-.253-.778h-.818l.661-.481-.253-.777.663.48.66-.48-.252.777.662.481Zm.156-6.195.253.778-.661-.48-.663.48.253-.778-.66-.48h.817l.253-.778.252.777h.818Zm1.314-1.76L4.04 9.16l-.778.253.48-.661-.48-.663.778.254.48-.662v.818l.778.253-.777.252Zm2.045-2.862-.253.777-.252-.777h-.818l.662-.48-.253-.778.661.48.661-.48-.252.777.662.48Zm2.577-1.313-.48.661V5.49l-.779-.254.778-.253v-.817l.48.66.78-.253-.481.663.48.66zm3.265-.75.253.778-.661-.48-.662.48.252-.777-.66-.481h.818L12 3.637l.252.778h.818zm2.93.595v.816l-.481-.661-.777.252.48-.662-.48-.662.777.253.48-.66v.817l.779.252zm5.426 8.285.778.253.48-.662v.818l.778.253-.778.253v.818l-.48-.662-.778.253.48-.662zm-3.077-6.04-.253-.777h-.818l.662-.48-.253-.778.662.48.662-.48-.254.778.662.48h-.818zm1.792 2.086v-.818l-.777-.252.777-.253V7.68l.481.662.777-.254-.48.663.48.66-.777-.252zm1.469 1.278.253-.777.254.777h.816l-.66.481.252.778-.662-.48-.661.48.253-.778-.662-.48zm.506 6.676-.253.778-.253-.778h-.817l.662-.481-.253-.777.66.48.663-.48-.253.777.661.481zm-12.08-.615.76-1.588c.024-.048-.032-.108-.067-.067l-.664.668c-.313.329-.847 1.25-.95 1.421l-.808 1.335a.109.109 0 0 1 .1.162l-.739 1.238c-.18.309.145.523.189.452 1.157-1.868 1.832-1.719 1.832-1.719l.387-.897c.022-.047-.001-.1-.05-.12-.12-.05-.316-.27.01-.885z`,source:`https://www.paramount.com/brand/paramount-plus`,hex:`0064FF`},Ee={title:`Plex`,slug:`plex`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Plex</title><path d="`+this.path+H},path:`M3.987 8.409c-.96 0-1.587.28-2.12.933v-.72H0v8.88s.038.018.127.037c.138.03.821.187 1.331-.249.441-.377.542-.814.542-1.318v-1.283c.533.573 1.147.813 2 .813 1.84 0 3.253-1.493 3.253-3.48 0-2.12-1.36-3.613-3.266-3.613Zm16.748 5.595.406.591c.391.614.894.906 1.492.908.621-.012 1.064-.562 1.226-.755 0 0-.307-.27-.686-.72-.517-.614-1.214-1.755-1.24-1.803l-1.198 1.779Zm-3.205-1.955c0-2.08-1.52-3.64-3.52-3.64s-3.467 1.587-3.467 3.573a3.48 3.48 0 0 0 3.507 3.52c1.413 0 2.626-.84 3.253-2.293h-2.04l-.093.093c-.427.4-.72.533-1.227.533-.787 0-1.373-.506-1.453-1.266h4.986c.04-.214.054-.307.054-.52Zm-7.671-.219c0 .769.11 1.701.868 2.722l.056.069c-.306.526-.742.88-1.248.88-.399 0-.814-.211-1.138-.579a2.177 2.177 0 0 1-.538-1.441V6.409H9.86l-.001 5.421Zm9.283 3.46h-2.39l2.247-3.332-2.247-3.335h2.39l2.248 3.335-2.248 3.332Zm1.593-1.286Zm-17.162-.342c-.933 0-1.68-.773-1.68-1.72s.76-1.666 1.68-1.666c.92 0 1.68.733 1.68 1.68 0 .946-.733 1.706-1.68 1.706Zm18.361-1.974L24 8.622h-2.391l-.87 1.293 1.195 1.773Zm-9.404-.466c.16-.706.72-1.133 1.493-1.133.773 0 1.373.467 1.507 1.133h-3Z`,source:`https://brand.plex.tv`,hex:`EBAF00`,guidelines:`https://brand.plex.tv`},De={title:`Sky`,slug:`sky`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Sky</title><path d="`+this.path+H},path:`M7.387 13.656c0 1.423-.933 2.454-2.823 2.675-1.35.147-3.337-.025-4.294-.148-.025-.147-.074-.343-.074-.49 0-1.252.663-1.522 1.3-1.522.664 0 1.694.123 2.455.123.834 0 1.104-.295 1.104-.565 0-.368-.343-.515-1.006-.638l-1.767-.343C.785 12.453 0 11.423 0 10.343c0-1.325.933-2.454 2.798-2.65 1.398-.148 3.116.024 4.049.122.024.172.049.32.049.491 0 1.252-.663 1.522-1.276 1.522-.491 0-1.227-.099-2.086-.099-.884 0-1.227.246-1.227.54 0 .32.343.442.883.54l1.718.32c1.742.294 2.479 1.3 2.479 2.527m3.092 1.521c0 .761-.295 1.203-1.792 1.203-.196 0-.368-.025-.54-.05V6.22c0-.76.27-1.57 1.767-1.57.196 0 .393.024.565.049zm6.085 3.927c.197.098.59.22 1.105.245.859.025 1.325-.319 1.693-1.08L24 7.913a2.5 2.5 0 0 0-.957-.22c-.589 0-1.399.122-1.914 1.325l-1.497 3.534-2.945-4.81c-.196-.05-.662-.148-1.006-.148-1.03 0-1.62.393-2.233 1.031l-2.871 3.141 2.306 3.632c.418.663.982 1.006 1.89 1.006.589 0 1.104-.147 1.325-.245l-2.773-4.196 1.963-2.086 3.24 5.08Z`,source:`https://www.skysports.com`,hex:`0072C9`},Oe={title:`Spotify`,slug:`spotify`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Spotify</title><path d="`+this.path+H},path:`M12 0C5.4 0 0 5.4 0 12s5.4 12 12 12 12-5.4 12-12S18.66 0 12 0zm5.521 17.34c-.24.359-.66.48-1.021.24-2.82-1.74-6.36-2.101-10.561-1.141-.418.122-.779-.179-.899-.539-.12-.421.18-.78.54-.9 4.56-1.021 8.52-.6 11.64 1.32.42.18.479.659.301 1.02zm1.44-3.3c-.301.42-.841.6-1.262.3-3.239-1.98-8.159-2.58-11.939-1.38-.479.12-1.02-.12-1.14-.6-.12-.48.12-1.021.6-1.141C9.6 9.9 15 10.561 18.72 12.84c.361.181.54.78.241 1.2zm.12-3.36C15.24 8.4 8.82 8.16 5.16 9.301c-.6.179-1.2-.181-1.38-.721-.18-.601.18-1.2.72-1.381 4.26-1.26 11.28-1.02 15.721 1.621.539.3.719 1.02.419 1.56-.299.421-1.02.599-1.559.3z`,source:`https://developer.spotify.com/documentation/general/design-and-branding/#using-our-logo`,hex:`1ED760`,guidelines:`https://developer.spotify.com/documentation/general/design-and-branding/#using-our-logo`},ke={title:`Twitch`,slug:`twitch`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Twitch</title><path d="`+this.path+H},path:`M11.571 4.714h1.715v5.143H11.57zm4.715 0H18v5.143h-1.714zM6 0L1.714 4.286v15.428h5.143V24l4.286-4.286h3.428L22.286 12V0zm14.571 11.143l-3.428 3.428h-3.429l-3 3v-3H6.857V1.714h13.714Z`,source:`https://brand.twitch.tv`,hex:`9146FF`,guidelines:`https://brand.twitch.tv`},Ae={title:`YouTube`,slug:`youtube`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>YouTube</title><path d="`+this.path+H},path:`M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z`,source:`https://www.youtube.com/howyoutubeworks/resources/brand-resources/#logos-icons-and-colors`,hex:`FF0000`,guidelines:`https://www.youtube.com/howyoutubeworks/resources/brand-resources/#logos-icons-and-colors`},je={title:`YouTube Music`,slug:`youtubemusic`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>YouTube Music</title><path d="`+this.path+H},path:`M12 0C5.376 0 0 5.376 0 12s5.376 12 12 12 12-5.376 12-12S18.624 0 12 0zm0 19.104c-3.924 0-7.104-3.18-7.104-7.104S8.076 4.896 12 4.896s7.104 3.18 7.104 7.104-3.18 7.104-7.104 7.104zm0-13.332c-3.432 0-6.228 2.796-6.228 6.228S8.568 18.228 12 18.228s6.228-2.796 6.228-6.228S15.432 5.772 12 5.772zM9.684 15.54V8.46L15.816 12l-6.132 3.54z`,source:`https://partnermarketinghub.withgoogle.com/#/brands`,hex:`FF0000`},Me=`app:`,U=(e,t,n)=>({key:e,label:t,mark:{kind:`glyph`,path:n.path,hex:n.hex}}),W=(e,t,n)=>({key:e,label:t,mark:{kind:`lettermark`,text:n}}),G=[U(`netflix`,`Netflix`,Ce),U(`youtube`,`YouTube`,Ae),W(`primevideo`,`Prime Video`,`prime`),W(`disneyplus`,`Disney+`,`D+`),U(`spotify`,`Spotify`,Oe),U(`plex`,`Plex`,Ee),U(`appletv`,`Apple TV`,ve),U(`dazn`,`DAZN`,be),W(`raiplay`,`RaiPlay`,`Rai`),W(`mediasetinfinity`,`Mediaset Infinity`,`MI`),U(`now`,`NOW`,we),U(`twitch`,`Twitch`,ke),U(`max`,`Max`,Se),U(`paramountplus`,`Paramount+`,Te),U(`crunchyroll`,`Crunchyroll`,ye),U(`sky`,`Sky`,De),U(`youtubemusic`,`YouTube Music`,je),U(`applemusic`,`Apple Music`,_e),U(`kodi`,`Kodi`,xe)],Ne=new Map(G.map(e=>[e.key,e]));function Pe(e){return`${Me}${e}`}function K(e){if(!(e===void 0||!e.startsWith(`app:`)))return Ne.get(e.slice(4))}function Fe(e){if(!/^[0-9a-fA-F]{6}$/.test(e))return null;let t=t=>{let n=Number.parseInt(e.slice(t,t+2),16)/255;return n<=.03928?n/12.92:((n+.055)/1.055)**2.4};return .2126*t(0)+.7152*t(2)+.0722*t(4)}var Ie=.011,Le=.91,q=2.2;function J(e,t){let[n,r]=e>t?[e,t]:[t,e];return(n+.05)/(r+.05)}function Re(e){if(e.kind!==`glyph`)return null;let t=Fe(e.hex);return t===null?null:J(t,Ie)>=q&&J(t,Le)>=q?`#${e.hex}`:null}function ze({brand:e}){if(e.mark.kind===`lettermark`)return t(`span`,{className:`text-[11px] font-semibold leading-none`,"aria-hidden":!0,children:e.mark.text});let n=Re(e.mark);return t(`svg`,{viewBox:`0 0 24 24`,className:`h-4 w-4 fill-current`,"aria-hidden":!0,style:n===null?void 0:{fill:n},children:t(`path`,{d:e.mark.path})})}function Be(e){return e.toLowerCase().startsWith(`it`)?`it`:`en`}function Y(e,t){return s(e,Be(t))}function Ve(e){switch(e){case`rect`:return`rounded-sm`;case`rounded`:return`rounded-xl`;case`round`:return`aspect-square h-full w-auto justify-self-center rounded-full`;case`pill`:return`rounded-full`;default:return``}}function He(e){switch(e){case`accent`:return`border-primary bg-primary text-primary-foreground hover:bg-primary/90`;case`danger`:return`border-danger bg-danger-fill text-danger-on hover:bg-danger-fill/90`;case`red`:return`border-danger/40 bg-danger/15 text-danger hover:bg-danger/25`;case`green`:return`border-success/40 bg-success/15 text-success hover:bg-success/25`;case`yellow`:return`border-warning/40 bg-warning/15 text-warning hover:bg-warning/25`;case`blue`:return`border-info/40 bg-info/15 text-info hover:bg-info/25`;default:return``}}function Ue(e){switch(e){case`panel`:return`rounded-lg border border-border bg-surface/40`;case`dpad`:return`rounded-3xl border border-border bg-surface`;case`rocker-v`:case`rocker-h`:return`rounded-full border border-border bg-surface`;case`keypad`:return`rounded-lg border border-border-subtle bg-surface/60`;default:return``}}function We(e){return e===`divider`}function X(e,t){let n=Math.min(Math.max(t.row,0),e.rows-1),r=Math.min(Math.max(t.col,0),e.columns-1),i=Math.min(Math.max(t.row+t.rowSpan,n+1),e.rows),a=Math.min(Math.max(t.col+t.colSpan,r+1),e.columns);return{row:n,col:r,rowSpan:i-n,colSpan:a-r}}var Ge=`2.75rem`,Ke=`1.25rem`,qe=`1rem`;function Je(e){let t=new Set;for(let n of e.buttons)for(let e=n.row;e<n.row+n.rowSpan;e+=1)for(let r=n.col;r<n.col+n.colSpan;r+=1)t.add(`${e}:${r}`);return t}var Z=new Set([`red`,`green`,`yellow`,`blue`]);function Ye(e,t){return e.label??K(e.icon)?.label??t}function Xe(e){return e.label===void 0||K(e.icon)!==void 0?!1:e.tone===void 0||!Z.has(e.tone)}function Ze(e){if(e.icon!==void 0)return e.icon;if(!(e.tone!==void 0&&Z.has(e.tone)))return c(e.role)}function Qe({button:n,compact:r}){let i=h(),a=K(n.icon),o=Ze(n),s=n.icon===void 0?p(n.role):void 0,c=o===void 0||a!==void 0||s!==void 0?void 0:i(o),l=Xe(n)?n.label:void 0;return e(`span`,{className:`flex flex-col items-center justify-center gap-0.5 leading-none`,children:[a!==void 0&&t(ze,{brand:a}),c!==void 0&&t(c,{className:`h-4 w-4`,"aria-hidden":!0}),s!==void 0&&t(`span`,{className:`text-sm font-medium`,children:s}),l!==void 0&&!r&&t(`span`,{className:`max-w-full truncate text-[11px]`,children:l})]})}function Q(e){return{gridRow:`${e.row+1} / span ${e.rowSpan}`,gridColumn:`${e.col+1} / span ${e.colSpan}`}}function $e({group:n,selected:i,dragging:a,compact:o,editable:s,onSelect:c,onPointerDown:l,onKeyDown:u}){let{t:d}=_(),f=We(n.frame),p=!s||o||n.hideTitle===!0?void 0:n.title;return e(`div`,{"data-testid":`remote-group-${n.id}`,"data-frame":n.frame,className:r(`relative -m-0.5 flex`,Ue(n.frame),a&&`opacity-40`,i&&`ring-2 ring-primary`),style:Q(n),children:[f?e(`div`,{className:`flex w-full items-center gap-2 px-1 text-[10px] uppercase tracking-wide text-foreground-muted`,children:[t(`span`,{className:`h-px flex-1 bg-border`,"aria-hidden":!0}),p!==void 0&&t(`span`,{className:`truncate`,children:p}),p!==void 0&&t(`span`,{className:`h-px flex-1 bg-border`,"aria-hidden":!0})]}):p!==void 0&&t(`span`,{className:`absolute -top-1.5 left-3 max-w-[70%] truncate bg-background-elevated px-1 text-[10px] uppercase leading-none tracking-wide text-foreground-muted`,children:p}),s&&t(`button`,{type:`button`,"aria-label":d(`remote.layout.groupHandle`,{name:n.title??n.componentId}),"aria-pressed":i,"data-testid":`remote-group-handle-${n.id}`,className:`absolute -right-1 -top-2.5 z-20 flex h-4 w-4 touch-none cursor-grab items-center justify-center rounded-full border border-border bg-surface-hover text-foreground-muted hover:text-foreground`,onClick:c,onPointerDown:l,onKeyDown:u,children:t(m,{className:`h-3 w-3`,"aria-hidden":!0})})]})}function et({grid:n,label:i,selectedId:a=null,onSelect:o,boundRoles:s,showEmptyCells:c=!1,compact:l=!1,gridRef:u,selectedGroupId:d=null,onSelectGroup:f,onItemPointerDown:p,onItemKeyDown:m,drag:h=null}){let{i18n:v}=_(),y=p!==void 0,b=h!==null,x=Je(n),S=P(n),C=[];if(c||b)for(let e=0;e<n.rows;e+=1)for(let t=0;t<n.columns;t+=1)(b||!x.has(`${e}:${t}`)&&!S.has(e))&&C.push({row:e,col:t});let w=h?.preview??null;return e(`div`,{role:`group`,"aria-label":i,"data-testid":`remote-grid`,ref:u,className:r(`grid gap-1.5`,l?`auto-rows-[1.25rem] gap-0.5`:`auto-rows-[2.75rem]`),style:{gridTemplateColumns:`repeat(${n.columns}, minmax(0, 1fr))`,...S.size===0?{}:{gridTemplateRows:Array.from({length:n.rows},(e,t)=>S.has(t)?qe:l?Ke:Ge).join(` `)}},children:[C.map(({row:e,col:n})=>t(`div`,{"aria-hidden":!0,"data-testid":`remote-grid-cell`,className:r(`rounded-md border border-dashed`,b?`border-border`:`border-border-subtle`),style:{gridRow:`${e+1}`,gridColumn:`${n+1}`}},`e${e}:${n}`)),(n.groups??[]).map(e=>t($e,{group:e,selected:e.id===d,dragging:h?.item.kind===`group`&&h.item.id===e.id,compact:l,editable:y,onSelect:f===void 0?void 0:()=>f(e.id),onPointerDown:p===void 0?void 0:t=>p({kind:`group`,id:e.id},t),onKeyDown:m===void 0?void 0:t=>m({kind:`group`,id:e.id},t)},e.id)),n.buttons.map(e=>{let n=e.id===a,i=s===void 0||s.has(e.role),c=h?.item.kind===`button`&&h.item.id===e.id,u={kind:`button`,id:e.id},d=Ye(e,Y(e.role,v.language));return t(g,{type:`button`,size:`sm`,variant:i?`secondary`:`outline`,"aria-pressed":o===void 0?void 0:n,"aria-label":d,title:d,"data-testid":`remote-grid-button-${e.id}`,"data-shape":e.shape,"data-tone":e.tone,className:r(`z-10 h-full min-w-0 overflow-hidden border border-border px-1`,l&&`px-0`,Ve(e.shape),He(e.tone),y&&`touch-none`,c&&`opacity-40`,n&&`ring-2 ring-primary ring-offset-1 ring-offset-background`),style:Q(e),onClick:o===void 0?void 0:()=>o(e.id),onPointerDown:p===void 0?void 0:e=>p(u,e),onKeyDown:m===void 0?void 0:e=>m(u,e),children:t(Qe,{button:e,compact:l})},e.id)}),w!==null&&t(`div`,{"aria-hidden":!0,"data-testid":`remote-drop-target`,"data-valid":w.valid,className:r(`pointer-events-none z-30 rounded-md border-2 border-dashed`,w.valid?`border-success bg-success/20`:`border-danger bg-danger/20`),style:Q(X(n,w.rect))})]})}var $=`edit`;function tt(e){return`/system/templates?${$}=${encodeURIComponent(e)}`}function nt({templateId:r,testId:i}){let{t:a}=_(),o=v();return e(g,{size:`sm`,variant:`ghost`,onClick:()=>o(tt(r)),"data-testid":i??`remote-edit-template`,children:[t(n,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),a(`remote.editTemplate`)]})}export{ie as A,ae as C,se as D,oe as E,de as O,ce as S,F as T,pe as _,G as a,M as b,B as c,R as d,ue as f,he as g,me as h,Y as i,I as k,re as l,E as m,$ as n,Pe as o,y as p,et as r,K as s,nt as t,ge as u,z as v,L as w,le as x,ee as y};
|
|
1
|
+
import{C as e,S as t}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Yn as n,dt as r}from"./player-overlays-CDEJeChs.js";import{Ar as i,Or as a,Pr as o,_r as s,gr as c,hr as l,jr as u,kr as d,mr as f,vr as p}from"./client-Dd2wRwgL.js";import{t as m}from"./grip-vertical-B-IndDz6.js";import{bf as h,vi as g}from"./src-Bz_Mw4PZ.js";import{t as _}from"./useTranslation-BJr-n0es.js";import{Rr as v}from"./index-CKdLDmIt.js";function y(){return{columns:3,rows:4,buttons:[]}}var b=e=>({status:`refused`,reason:e}),x=e=>({status:`ok`,grid:e});function S(e,t){return t.row>=0&&t.col>=0&&t.row+t.rowSpan<=e.rows&&t.col+t.colSpan<=e.columns}var C=d;function w(e,t){return t.row>=e.row&&t.col>=e.col&&t.row+t.rowSpan<=e.row+e.rowSpan&&t.col+t.colSpan<=e.col+e.colSpan}function T(e){return e.groups??[]}function E(e,t){return T(e).find(e=>e.id===t)}function ee(e,t){return e.buttons.filter(e=>e.groupId===t)}function D(e,t){let{groups:n,...r}=e;return t.length===0?r:{...r,groups:[...t]}}function O(e,t){let{groupId:n,...r}=t;for(let n of T(e))if(C(n,t))return n.frame===`divider`||!w(n,t)?`overlap`:{...r,groupId:n.id};return r}function k(e,t,n){if(t.rowSpan<1||t.colSpan<1)return`invalid-size`;if(!S(e,t))return`outside`;if(e.buttons.some(e=>e.id!==n&&C(e,t)))return`overlap`;let r=O(e,t);return typeof r==`string`?r:null}function A(e,t){let n=k(e,t,t.id);if(n!==null)return b(n);let r=O(e,t);return typeof r==`string`?b(r):x({...e,buttons:e.buttons.map(e=>e.id===t.id?r:e)})}function j(e,t){return e.buttons.find(e=>e.id===t)}function te(e){let t=new Set(e.buttons.map(e=>e.id));for(let n=e.buttons.length+1;;n+=1)if(!t.has(`b${n}`))return`b${n}`}function ne(e){for(let t=0;t<e.rows;t+=1)for(let n=0;n<e.columns;n+=1){let r={id:``,row:t,col:n,rowSpan:1,colSpan:1,role:`power`};if(!T(e).some(e=>C(e,r))&&k(e,r,null)===null)return{row:t,col:n}}return null}function re(e,t){if(e.buttons.length>=200)return b(`outside`);let n=ne(e);if(n===null)return b(`outside`);let r=O(e,{id:te(e),row:n.row,col:n.col,rowSpan:1,colSpan:1,role:t});return typeof r==`string`?b(r):x({...e,buttons:[...e.buttons,r]})}function M(e,t,n,r){let i=j(e,t);return i===void 0?b(`unknown-button`):A(e,{...i,row:n,col:r})}function ie(e,t,n,r){let i=j(e,t);return i===void 0?b(`unknown-button`):M(e,t,i.row+n,i.col+r)}function ae(e,t,n,r){let i=j(e,t);return i===void 0?b(`unknown-button`):A(e,{...i,rowSpan:n,colSpan:r})}function oe(e,t,n){let r=j(e,t);if(r===void 0)return b(`unknown-button`);let i=n.icon===void 0?r.icon:n.icon??void 0,a=n.label===void 0?r.label:n.label??void 0,o=a===void 0||a.trim()===``?void 0:a,{icon:s,label:c,...l}=r,u={...l,role:n.role??r.role,...i===void 0?{}:{icon:i},...o===void 0?{}:{label:o}};return x({...e,buttons:e.buttons.map(e=>e.id===t?u:e)})}function se(e,t,n){let r=j(e,t);if(r===void 0)return b(`unknown-button`);let{shape:i,tone:a,...o}=r,s=n.shape===void 0?r.shape:n.shape??void 0,c=n.tone===void 0?r.tone:n.tone??void 0,l={...o,...s===void 0?{}:{shape:s},...c===void 0?{}:{tone:c}};return x({...e,buttons:e.buttons.map(e=>e.id===t?l:e)})}function ce(e,t){return{...e,buttons:e.buttons.filter(e=>e.id!==t)}}var N=e=>e.ok?x(e.layout):b(e.reason);function le(e,t,n,r){return N(f(e,t,{row:n,col:r}))}function ue(e,t,n){return N(l(e,t,{keepButtons:n}))}function de(e,t,n){let r=E(e,t);if(r===void 0)return b(`unknown-group`);let{title:i,...a}=r,o=n.trim()===``?a:{...a,title:n.slice(0,40)};return x(D(e,T(e).map(e=>e.id===t?o:e)))}function fe(e){return e.frame===`divider`&&e.rowSpan===1&&e.size!==`normal`}function P(e){let t=new Set,n=T(e);for(let r of n){if(!fe(r))continue;let i=r.row;e.buttons.some(e=>e.row<=i&&i<e.row+e.rowSpan)||n.some(e=>e!==r&&e.row<=i&&i<e.row+e.rowSpan)||t.add(i)}return t}function F(e){let t=P(e);return Array.from({length:e.rows},(e,n)=>(t.has(n)?1:2.75)+.375)}function I(e,t,n){let r=E(e,t);if(r===void 0)return b(`unknown-group`);let{size:i,hideTitle:a,...o}=r,s=n.size??r.size,c=n.hideTitle??r.hideTitle,l={...o,...s===`normal`?{size:s}:{},...c===!0?{hideTitle:c}:{}};return x(D(e,T(e).map(e=>e.id===t?l:e)))}function L(e,t,n){let r=e=>!Number.isInteger(e)||e<1||e>24;if(r(t)||r(n))return b(`invalid-size`);let i={...e,columns:t,rows:n};return e.buttons.some(e=>!S(i,e))||T(e).some(e=>!S(i,e))?b(`would-drop-buttons`):x(i)}function R(e){let t=a.safeParse(e);return t.success?t.data:null}function z(e){let t=a.safeParse(e);return t.success?t.data:y()}var B=[`power`,`volume`,`channel`,`navigation`,`playback`,`digits`,`other`];function V(e){return e.startsWith(`power`)?`power`:e.startsWith(`volume`)||e===`mute`?`volume`:e.startsWith(`channel`)?`channel`:e.startsWith(`digit_`)?`digits`:[`up`,`down`,`left`,`right`,`ok`,`back`,`home`,`menu`,`exit`].includes(e)?`navigation`:[`play`,`pause`,`play_pause`,`stop`,`next`,`previous`,`fast_forward`,`rewind`].includes(e)?`playback`:`other`}function pe(e){return i.filter(t=>V(t)===e)}function me(e){let t=u(e),n=(t??e).replace(/_/g,` `);return t===null?n.charAt(0).toUpperCase()+n.slice(1):n}function he(e){return u(e)!==null&&!o(e)}function ge(e,t,n){let r={columns:e,rows:t,buttons:[]};for(let e of n){let t={id:e.id,row:e.row,col:e.col,rowSpan:e.rowSpan??1,colSpan:e.colSpan??1,role:e.role,...e.icon===void 0?{}:{icon:e.icon},...e.label===void 0?{}:{label:e.label}},n=k(r,t,null);if(n!==null||r.buttons.some(t=>t.id===e.id))throw Error(`layout button "${e.id}": ${n??`duplicate id`}`);r={...r,buttons:[...r.buttons,t]}}return r}var H=`"/></svg>`,_e={title:`Apple Music`,slug:`applemusic`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Apple Music</title><path d="`+this.path+H},path:`M23.994 6.124a9.23 9.23 0 00-.24-2.19c-.317-1.31-1.062-2.31-2.18-3.043a5.022 5.022 0 00-1.877-.726 10.496 10.496 0 00-1.564-.15c-.04-.003-.083-.01-.124-.013H5.986c-.152.01-.303.017-.455.026-.747.043-1.49.123-2.193.4-1.336.53-2.3 1.452-2.865 2.78-.192.448-.292.925-.363 1.408-.056.392-.088.785-.1 1.18 0 .032-.007.062-.01.093v12.223c.01.14.017.283.027.424.05.815.154 1.624.497 2.373.65 1.42 1.738 2.353 3.234 2.801.42.127.856.187 1.293.228.555.053 1.11.06 1.667.06h11.03a12.5 12.5 0 001.57-.1c.822-.106 1.596-.35 2.295-.81a5.046 5.046 0 001.88-2.207c.186-.42.293-.87.37-1.324.113-.675.138-1.358.137-2.04-.002-3.8 0-7.595-.003-11.393zm-6.423 3.99v5.712c0 .417-.058.827-.244 1.206-.29.59-.76.962-1.388 1.14-.35.1-.706.157-1.07.173-.95.045-1.773-.6-1.943-1.536a1.88 1.88 0 011.038-2.022c.323-.16.67-.25 1.018-.324.378-.082.758-.153 1.134-.24.274-.063.457-.23.51-.516a.904.904 0 00.02-.193c0-1.815 0-3.63-.002-5.443a.725.725 0 00-.026-.185c-.04-.15-.15-.243-.304-.234-.16.01-.318.035-.475.066-.76.15-1.52.303-2.28.456l-2.325.47-1.374.278c-.016.003-.032.01-.048.013-.277.077-.377.203-.39.49-.002.042 0 .086 0 .13-.002 2.602 0 5.204-.003 7.805 0 .42-.047.836-.215 1.227-.278.64-.77 1.04-1.434 1.233-.35.1-.71.16-1.075.172-.96.036-1.755-.6-1.92-1.544-.14-.812.23-1.685 1.154-2.075.357-.15.73-.232 1.108-.31.287-.06.575-.116.86-.177.383-.083.583-.323.6-.714v-.15c0-2.96 0-5.922.002-8.882 0-.123.013-.25.042-.37.07-.285.273-.448.546-.518.255-.066.515-.112.774-.165.733-.15 1.466-.296 2.2-.444l2.27-.46c.67-.134 1.34-.27 2.01-.403.22-.043.442-.088.663-.106.31-.025.523.17.554.482.008.073.012.148.012.223.002 1.91.002 3.822 0 5.732z`,source:`https://www.apple.com/itunes/marketing-on-music/identity-guidelines.html#apple-music-icon`,hex:`FA243C`},ve={title:`Apple TV`,slug:`appletv`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Apple TV</title><path d="`+this.path+H},path:`M20.57 17.735h-1.815l-3.34-9.203h1.633l2.02 5.987c.075.231.273.9.586 2.012l.297-.997.33-1.006 2.094-6.004H24zm-5.344-.066a5.76 5.76 0 0 1-1.55.207c-1.23 0-1.84-.693-1.84-2.087V9.646h-1.063V8.532h1.121V7.081l1.476-.602v2.062h1.707v1.113H13.38v5.805c0 .446.074.75.214.932.14.182.396.264.75.264.207 0 .495-.041.883-.115zm-7.29-5.343c.017 1.764 1.55 2.358 1.567 2.366-.017.042-.248.842-.808 1.658-.487.71-.99 1.418-1.79 1.435-.783.016-1.03-.462-1.93-.462-.89 0-1.17.445-1.913.478-.758.025-1.344-.775-1.838-1.484-.998-1.451-1.765-4.098-.734-5.88.51-.89 1.426-1.451 2.416-1.46.75-.016 1.468.512 1.93.512.461 0 1.327-.627 2.234-.536.38.016 1.452.157 2.136 1.154-.058.033-1.278.743-1.27 2.219M6.468 7.988c.404-.495.685-1.18.61-1.864-.585.025-1.294.388-1.723.883-.38.437-.71 1.138-.619 1.806.652.05 1.328-.338 1.732-.825Z`,source:`https://en.wikipedia.org/wiki/File:Apple_TV_(logo).svg`,hex:`000000`},ye={title:`Crunchyroll`,slug:`crunchyroll`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Crunchyroll</title><path d="`+this.path+H},path:`M2.909 13.436C2.914 7.61 7.642 2.893 13.468 2.898c5.576.005 10.137 4.339 10.51 9.819q.021-.351.022-.706C24.007 5.385 18.64.006 12.012 0S.007 5.36 0 11.988 5.36 23.994 11.988 24q.412 0 .815-.027c-5.526-.338-9.9-4.928-9.894-10.538Zm16.284.155a4.1 4.1 0 0 1-4.095-4.103 4.1 4.1 0 0 1 2.712-3.855 8.95 8.95 0 0 0-4.187-1.037 9.007 9.007 0 1 0 8.997 9.016q-.001-.847-.15-1.651a4.1 4.1 0 0 1-3.278 1.63Z`,source:`https://www.crunchyroll.com`,hex:`FF5E00`},be={title:`DAZN`,slug:`dazn`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>DAZN</title><path d="`+this.path+H},path:`M14.774 8.291l.772-2.596.79 2.596zm3.848 2.268l-2.025-6.128c-.045-.135-.097-.224-.154-.266-.059-.041-.152-.063-.28-.063h-1.12a.485.485 0 0 0-.284.068c-.06.045-.11.132-.149.261l-2.045 6.128c-.025.032-.038.096-.038.192 0 .149.09.223.27.223h.84c.076 0 .139-.003.187-.01a.207.207 0 0 0 .116-.048.326.326 0 0 0 .077-.116c.022-.051.046-.119.072-.202l.318-1.071h2.306l.327 1.051c.026.09.051.16.077.213a.395.395 0 0 0 .087.12c.031.028.07.047.114.053h.002c.045.006.103.01.173.01h.897c.18 0 .27-.074.27-.223a.59.59 0 0 0-.005-.09.878.878 0 0 0-.036-.108l.003.006zm-.994 2.467h-.646c-.168 0-.279.024-.333.072-.055.049-.082.147-.082.295v3.638l-1.91-3.647c-.076-.155-.152-.253-.226-.295-.074-.041-.204-.063-.39-.063h-.599c-.167 0-.278.025-.332.073-.055.048-.082.147-.082.294v6.138c0 .148.025.246.077.294.052.048.16.072.328.072h.656c.167 0 .278-.024.332-.072.055-.048.082-.146.082-.294v-3.648l1.91 3.657c.077.155.152.253.227.295.073.042.204.062.39.062h.598c.167 0 .278-.024.333-.072.054-.048.082-.146.082-.294v-6.138c0-.148-.028-.246-.082-.294-.055-.048-.166-.073-.333-.073zm3.203-.581l1.665 1.665v8.385H1.505V14.11l1.663-1.664a.63.63 0 0 0 0-.89L1.504 9.891V1.505h20.991v8.384l-1.665 1.666a.63.63 0 0 0 0 .89zM24 0H0v10.613L1.387 12 0 13.387V24h24V13.387L22.613 12 24 10.613zM10.67 18.469H7.96l2.855-4.014a.67.67 0 0 0 .087-.155.425.425 0 0 0 .019-.135v-.772c0-.148-.028-.246-.082-.294-.055-.048-.166-.073-.334-.073H6.382c-.149 0-.245.028-.29.082-.045.055-.068.169-.068.343v.58c0 .172.023.287.068.341.045.055.141.083.29.083h2.545L6.11 18.469a.438.438 0 0 0-.107.27v.792c0 .148.027.245.082.294.055.048.167.072.334.072h4.25c.148 0 .245-.027.29-.081.045-.055.068-.17.068-.344v-.579c0-.173-.023-.287-.068-.342-.045-.055-.142-.082-.29-.082zM9.408 8.233c0 .264-.017.484-.052.661-.036.177-.093.32-.174.43a.648.648 0 0 1-.318.231 1.523 1.523 0 0 1-.487.068h-.79v-4.17h.79c.366 0 .63.11.79.324.16.215.241.571.241 1.067v1.389zm1.38-2.789c-.225-.457-.533-.795-.921-1.013-.39-.219-.88-.328-1.47-.328H6.418c-.167 0-.278.024-.333.072-.054.049-.082.147-.082.294v6.138c0 .148.028.246.082.295.055.048.166.072.333.072h2.218c1.048 0 1.765-.447 2.15-1.342.09-.205.153-.413.188-.622a4.91 4.91 0 0 0 .054-.796V6.911c0-.367-.018-.656-.054-.868a2.2 2.2 0 0 0-.193-.612l.006.013z`,source:`https://media.dazn.com/en/assets/`,hex:`F8F8F5`},xe={title:`Kodi`,slug:`kodi`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Kodi</title><path d="`+this.path+H},path:`M12.03.047c-.226 0-.452.107-.669.324-.922.922-1.842 1.845-2.763 2.768-.233.233-.455.48-.703.695-.31.267-.405.583-.399.988.02 1.399.008 2.799.008 4.198 0 1.453-.002 2.907 0 4.36 0 .11.002.223.03.327.087.337.303.393.546.15 1.31-1.31 2.618-2.622 3.928-3.933l4.449-4.453c.43-.431.43-.905 0-1.336L12.697.37c-.216-.217-.442-.324-.668-.324zm7.224 7.23c-.223 0-.445.104-.65.309L14.82 11.37c-.428.429-.427.895 0 1.322l3.76 3.766c.44.44.908.44 1.346.002 1.215-1.216 2.427-2.433 3.644-3.647.182-.18.353-.364.43-.615v-.33c-.077-.251-.246-.436-.428-.617-1.224-1.22-2.443-2.445-3.666-3.668-.205-.205-.429-.307-.652-.307zM4.18 7.611c-.086.014-.145.094-.207.157L.209 11.572c-.28.284-.278.677.004.96l2.043 2.046c.59.59 1.177 1.182 1.767 1.772.169.168.33.139.416-.084.044-.114.062-.242.063-.364.004-1.283.004-2.567.004-3.851h-.002V8.184c0-.085-.01-.169-.022-.252-.019-.135-.072-.258-.207-.309a.186.186 0 0 0-.095-.012zm7.908 6.838c-.224 0-.447.106-.656.315L7.66 18.537c-.433.434-.433.899.002 1.334 1.215 1.216 2.43 2.43 3.643 3.649.18.18.361.354.611.433h.33c.244-.069.423-.226.598-.402 1.222-1.23 2.45-2.453 3.676-3.68.43-.43.427-.905-.004-1.338l-3.772-3.773c-.208-.208-.432-.311-.656-.31z`,source:`https://kodi.tv`,hex:`17B2E7`},Se={title:`Max`,slug:`max`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Max</title><path d="`+this.path+H},path:`M1.769 0A1.77 1.77 0 0 0 0 1.769V22.23A1.77 1.77 0 0 0 1.769 24H22.23A1.77 1.77 0 0 0 24 22.231V1.77A1.77 1.77 0 0 0 22.231 0zm12.485 3.28a4.301 4.301 0 0 1 4.3 4.302 4.301 4.301 0 0 1-1.993 3.63 6.085 6.085 0 0 1 1.054 3.422 6.085 6.085 0 0 1-6.085 6.085 6.085 6.085 0 0 1-6.085-6.085 6.085 6.085 0 0 1 4.66-5.916 4.301 4.301 0 0 1-.152-1.136 4.301 4.301 0 0 1 4.301-4.301zm0 1.849a2.453 2.453 0 0 0-2.453 2.453 2.453 2.453 0 0 0 2.453 2.453 2.453 2.453 0 0 0 2.453-2.453 2.453 2.453 0 0 0-2.453-2.453zm-2.724 5.268a4.237 4.237 0 0 0-4.237 4.237 4.237 4.237 0 0 0 4.237 4.237 4.237 4.237 0 0 0 4.237-4.237 4.237 4.237 0 0 0-4.237-4.237zm.032 2.54a1.781 1.781 0 1 1 0 3.562 1.781 1.781 0 0 1 0-3.562Z`,source:`https://cycling74.com`,hex:`525252`},Ce={title:`Netflix`,slug:`netflix`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Netflix</title><path d="`+this.path+H},path:`m5.398 0 8.348 23.602c2.346.059 4.856.398 4.856.398L10.113 0H5.398zm8.489 0v9.172l4.715 13.33V0h-4.715zM5.398 1.5V24c1.873-.225 2.81-.312 4.715-.398V14.83L5.398 1.5z`,source:`https://brand.netflix.com/en/assets/logos`,hex:`E50914`,guidelines:`https://brand.netflix.com/en/assets/logos`},we={title:`NOW`,slug:`now`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>NOW</title><path d="`+this.path+H},path:`M8.8009 11.9974c0-.974.7878-1.7634 1.7596-1.7634.9718 0 1.7596.7895 1.7596 1.7634 0 .9738-.7878 1.7634-1.7596 1.7634-.9718 0-1.7596-.7896-1.7596-1.7634zm13.0277-2.896l-1.2166 2.4524-.7878-2.3188-.0015-.0003c-.1566-.4505-.5822-.7737-1.0829-.7737-.399 0-.7505.2054-.956.517-.5255.8015-1.0497 1.6094-1.5735 2.414l-.2785-1.956c-.0963-.6296-.6807-1.0587-1.3048-.9624-.6249.096-1.0538.6778-.958 1.304l.0488.328c-.6427-1.0749-1.8162-1.7945-3.1575-1.7945-1.353 0-2.5352.7324-3.174 1.823l.07-.3434c.1223-.6008-.2645-1.1873-.864-1.31-.5993-.1223-1.1848.265-1.307.8659l-.4763 2.3382-1.752-2.7177c-.198-.3042-.5399-.5053-.9284-.5053-.5317 0-.976.3765-1.084.879l-1.0217 5.012c-.1223.6007.257 1.1846.8575 1.3121.0747.0159.1556.0235.2291.024.5139.0036.9763-.3579 1.0844-.892l.4763-2.3383c.5924.9217 1.1845 1.844 1.779 2.7641.196.2777.5281.4662.9018.4662.5462 0 1.0002-.398 1.0915-.9219l.469-2.302c.2292 1.815 1.7755 3.2187 3.6488 3.2187 1.7257 0 3.1736-1.191 3.5705-2.7972l.2613 1.759c.0736.579.5474 1.0371 1.1411 1.0371.4272 0 .7756-.2445.9972-.5841l1.8844-2.8942.905 2.6645c.1622.4752.5808.8138 1.0961.8138.4788 0 .855-.288 1.0609-.7155l2.402-4.845c.2834-.568.0528-1.2551-.5123-1.5403-.5647-.285-1.2558-.0524-1.5379.5196Z`,source:`https://www.nowtv.com`,hex:`001211`},Te={title:`Paramount+`,slug:`paramountplus`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Paramount+</title><path d="`+this.path+H},path:`M16.347 21.373c.057-.084.151-.314-.025-.74l-.53-1.428c-.073-.182.084-.293.19-.173 0 0 1.004 1.157 1.264 1.64l.495.822c.425.028 1.6.06 2.732.06a3.26 3.26 0 0 1-.316-.364c-1.93-2.392-3.154-3.724-3.166-3.737-.391-.426-.572-.508-.87-.643a4.82 4.82 0 0 1-.138-.065v.364c0 .047-.057.073-.086.022l-2.846-5.001a1.598 1.598 0 0 0-.508-.587l-.277-.194-1.354 3.123c.212 0 .354.216.27.409l-1.25 2.893h1.147c.443 0 .883.087 1.294.255l.302.125s-.913 1.878-.913 2.867c0 .181.028.362.075.534h2.104l-.096-.595s1.266.294 2.502.413M12 2.437c-6.627 0-12 5.373-12 12 0 2.669.873 5.133 2.346 7.126.503-.218.783-.542.983-.791l2.234-2.858a.467.467 0 0 1 .179-.138l.336-.146 3.674-4.659.534-.417 1.094-1.524a.482.482 0 0 1 .101-.102l.478-.347a.34.34 0 0 1 .398-.004l.578.407c.308.216.557.504.726.84l2.322 4.077c.051.09.09.129.182.174.454.227.732.268 1.33.913.277.304 1.495 1.666 3.203 3.784.236.318.538.588.963.783A11.948 11.948 0 0 0 24 14.437c0-6.627-5.373-12-12-12M3.236 15.1l-.778-.253-.48.662v-.818l-.778-.253.778-.253v-.818l.48.662.778-.253-.48.662Zm-.185 2.676-.252.778-.253-.778h-.818l.661-.481-.253-.777.663.48.66-.48-.252.777.662.481Zm.156-6.195.253.778-.661-.48-.663.48.253-.778-.66-.48h.817l.253-.778.252.777h.818Zm1.314-1.76L4.04 9.16l-.778.253.48-.661-.48-.663.778.254.48-.662v.818l.778.253-.777.252Zm2.045-2.862-.253.777-.252-.777h-.818l.662-.48-.253-.778.661.48.661-.48-.252.777.662.48Zm2.577-1.313-.48.661V5.49l-.779-.254.778-.253v-.817l.48.66.78-.253-.481.663.48.66zm3.265-.75.253.778-.661-.48-.662.48.252-.777-.66-.481h.818L12 3.637l.252.778h.818zm2.93.595v.816l-.481-.661-.777.252.48-.662-.48-.662.777.253.48-.66v.817l.779.252zm5.426 8.285.778.253.48-.662v.818l.778.253-.778.253v.818l-.48-.662-.778.253.48-.662zm-3.077-6.04-.253-.777h-.818l.662-.48-.253-.778.662.48.662-.48-.254.778.662.48h-.818zm1.792 2.086v-.818l-.777-.252.777-.253V7.68l.481.662.777-.254-.48.663.48.66-.777-.252zm1.469 1.278.253-.777.254.777h.816l-.66.481.252.778-.662-.48-.661.48.253-.778-.662-.48zm.506 6.676-.253.778-.253-.778h-.817l.662-.481-.253-.777.66.48.663-.48-.253.777.661.481zm-12.08-.615.76-1.588c.024-.048-.032-.108-.067-.067l-.664.668c-.313.329-.847 1.25-.95 1.421l-.808 1.335a.109.109 0 0 1 .1.162l-.739 1.238c-.18.309.145.523.189.452 1.157-1.868 1.832-1.719 1.832-1.719l.387-.897c.022-.047-.001-.1-.05-.12-.12-.05-.316-.27.01-.885z`,source:`https://www.paramount.com/brand/paramount-plus`,hex:`0064FF`},Ee={title:`Plex`,slug:`plex`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Plex</title><path d="`+this.path+H},path:`M3.987 8.409c-.96 0-1.587.28-2.12.933v-.72H0v8.88s.038.018.127.037c.138.03.821.187 1.331-.249.441-.377.542-.814.542-1.318v-1.283c.533.573 1.147.813 2 .813 1.84 0 3.253-1.493 3.253-3.48 0-2.12-1.36-3.613-3.266-3.613Zm16.748 5.595.406.591c.391.614.894.906 1.492.908.621-.012 1.064-.562 1.226-.755 0 0-.307-.27-.686-.72-.517-.614-1.214-1.755-1.24-1.803l-1.198 1.779Zm-3.205-1.955c0-2.08-1.52-3.64-3.52-3.64s-3.467 1.587-3.467 3.573a3.48 3.48 0 0 0 3.507 3.52c1.413 0 2.626-.84 3.253-2.293h-2.04l-.093.093c-.427.4-.72.533-1.227.533-.787 0-1.373-.506-1.453-1.266h4.986c.04-.214.054-.307.054-.52Zm-7.671-.219c0 .769.11 1.701.868 2.722l.056.069c-.306.526-.742.88-1.248.88-.399 0-.814-.211-1.138-.579a2.177 2.177 0 0 1-.538-1.441V6.409H9.86l-.001 5.421Zm9.283 3.46h-2.39l2.247-3.332-2.247-3.335h2.39l2.248 3.335-2.248 3.332Zm1.593-1.286Zm-17.162-.342c-.933 0-1.68-.773-1.68-1.72s.76-1.666 1.68-1.666c.92 0 1.68.733 1.68 1.68 0 .946-.733 1.706-1.68 1.706Zm18.361-1.974L24 8.622h-2.391l-.87 1.293 1.195 1.773Zm-9.404-.466c.16-.706.72-1.133 1.493-1.133.773 0 1.373.467 1.507 1.133h-3Z`,source:`https://brand.plex.tv`,hex:`EBAF00`,guidelines:`https://brand.plex.tv`},De={title:`Sky`,slug:`sky`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Sky</title><path d="`+this.path+H},path:`M7.387 13.656c0 1.423-.933 2.454-2.823 2.675-1.35.147-3.337-.025-4.294-.148-.025-.147-.074-.343-.074-.49 0-1.252.663-1.522 1.3-1.522.664 0 1.694.123 2.455.123.834 0 1.104-.295 1.104-.565 0-.368-.343-.515-1.006-.638l-1.767-.343C.785 12.453 0 11.423 0 10.343c0-1.325.933-2.454 2.798-2.65 1.398-.148 3.116.024 4.049.122.024.172.049.32.049.491 0 1.252-.663 1.522-1.276 1.522-.491 0-1.227-.099-2.086-.099-.884 0-1.227.246-1.227.54 0 .32.343.442.883.54l1.718.32c1.742.294 2.479 1.3 2.479 2.527m3.092 1.521c0 .761-.295 1.203-1.792 1.203-.196 0-.368-.025-.54-.05V6.22c0-.76.27-1.57 1.767-1.57.196 0 .393.024.565.049zm6.085 3.927c.197.098.59.22 1.105.245.859.025 1.325-.319 1.693-1.08L24 7.913a2.5 2.5 0 0 0-.957-.22c-.589 0-1.399.122-1.914 1.325l-1.497 3.534-2.945-4.81c-.196-.05-.662-.148-1.006-.148-1.03 0-1.62.393-2.233 1.031l-2.871 3.141 2.306 3.632c.418.663.982 1.006 1.89 1.006.589 0 1.104-.147 1.325-.245l-2.773-4.196 1.963-2.086 3.24 5.08Z`,source:`https://www.skysports.com`,hex:`0072C9`},Oe={title:`Spotify`,slug:`spotify`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Spotify</title><path d="`+this.path+H},path:`M12 0C5.4 0 0 5.4 0 12s5.4 12 12 12 12-5.4 12-12S18.66 0 12 0zm5.521 17.34c-.24.359-.66.48-1.021.24-2.82-1.74-6.36-2.101-10.561-1.141-.418.122-.779-.179-.899-.539-.12-.421.18-.78.54-.9 4.56-1.021 8.52-.6 11.64 1.32.42.18.479.659.301 1.02zm1.44-3.3c-.301.42-.841.6-1.262.3-3.239-1.98-8.159-2.58-11.939-1.38-.479.12-1.02-.12-1.14-.6-.12-.48.12-1.021.6-1.141C9.6 9.9 15 10.561 18.72 12.84c.361.181.54.78.241 1.2zm.12-3.36C15.24 8.4 8.82 8.16 5.16 9.301c-.6.179-1.2-.181-1.38-.721-.18-.601.18-1.2.72-1.381 4.26-1.26 11.28-1.02 15.721 1.621.539.3.719 1.02.419 1.56-.299.421-1.02.599-1.559.3z`,source:`https://developer.spotify.com/documentation/general/design-and-branding/#using-our-logo`,hex:`1ED760`,guidelines:`https://developer.spotify.com/documentation/general/design-and-branding/#using-our-logo`},ke={title:`Twitch`,slug:`twitch`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Twitch</title><path d="`+this.path+H},path:`M11.571 4.714h1.715v5.143H11.57zm4.715 0H18v5.143h-1.714zM6 0L1.714 4.286v15.428h5.143V24l4.286-4.286h3.428L22.286 12V0zm14.571 11.143l-3.428 3.428h-3.429l-3 3v-3H6.857V1.714h13.714Z`,source:`https://brand.twitch.tv`,hex:`9146FF`,guidelines:`https://brand.twitch.tv`},Ae={title:`YouTube`,slug:`youtube`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>YouTube</title><path d="`+this.path+H},path:`M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z`,source:`https://www.youtube.com/howyoutubeworks/resources/brand-resources/#logos-icons-and-colors`,hex:`FF0000`,guidelines:`https://www.youtube.com/howyoutubeworks/resources/brand-resources/#logos-icons-and-colors`},je={title:`YouTube Music`,slug:`youtubemusic`,get svg(){return`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>YouTube Music</title><path d="`+this.path+H},path:`M12 0C5.376 0 0 5.376 0 12s5.376 12 12 12 12-5.376 12-12S18.624 0 12 0zm0 19.104c-3.924 0-7.104-3.18-7.104-7.104S8.076 4.896 12 4.896s7.104 3.18 7.104 7.104-3.18 7.104-7.104 7.104zm0-13.332c-3.432 0-6.228 2.796-6.228 6.228S8.568 18.228 12 18.228s6.228-2.796 6.228-6.228S15.432 5.772 12 5.772zM9.684 15.54V8.46L15.816 12l-6.132 3.54z`,source:`https://partnermarketinghub.withgoogle.com/#/brands`,hex:`FF0000`},Me=`app:`,U=(e,t,n)=>({key:e,label:t,mark:{kind:`glyph`,path:n.path,hex:n.hex}}),W=(e,t,n)=>({key:e,label:t,mark:{kind:`lettermark`,text:n}}),G=[U(`netflix`,`Netflix`,Ce),U(`youtube`,`YouTube`,Ae),W(`primevideo`,`Prime Video`,`prime`),W(`disneyplus`,`Disney+`,`D+`),U(`spotify`,`Spotify`,Oe),U(`plex`,`Plex`,Ee),U(`appletv`,`Apple TV`,ve),U(`dazn`,`DAZN`,be),W(`raiplay`,`RaiPlay`,`Rai`),W(`mediasetinfinity`,`Mediaset Infinity`,`MI`),U(`now`,`NOW`,we),U(`twitch`,`Twitch`,ke),U(`max`,`Max`,Se),U(`paramountplus`,`Paramount+`,Te),U(`crunchyroll`,`Crunchyroll`,ye),U(`sky`,`Sky`,De),U(`youtubemusic`,`YouTube Music`,je),U(`applemusic`,`Apple Music`,_e),U(`kodi`,`Kodi`,xe)],Ne=new Map(G.map(e=>[e.key,e]));function Pe(e){return`${Me}${e}`}function K(e){if(!(e===void 0||!e.startsWith(`app:`)))return Ne.get(e.slice(4))}function Fe(e){if(!/^[0-9a-fA-F]{6}$/.test(e))return null;let t=t=>{let n=Number.parseInt(e.slice(t,t+2),16)/255;return n<=.03928?n/12.92:((n+.055)/1.055)**2.4};return .2126*t(0)+.7152*t(2)+.0722*t(4)}var Ie=.011,Le=.91,q=2.2;function J(e,t){let[n,r]=e>t?[e,t]:[t,e];return(n+.05)/(r+.05)}function Re(e){if(e.kind!==`glyph`)return null;let t=Fe(e.hex);return t===null?null:J(t,Ie)>=q&&J(t,Le)>=q?`#${e.hex}`:null}function ze({brand:e}){if(e.mark.kind===`lettermark`)return t(`span`,{className:`text-[11px] font-semibold leading-none`,"aria-hidden":!0,children:e.mark.text});let n=Re(e.mark);return t(`svg`,{viewBox:`0 0 24 24`,className:`h-4 w-4 fill-current`,"aria-hidden":!0,style:n===null?void 0:{fill:n},children:t(`path`,{d:e.mark.path})})}function Be(e){return e.toLowerCase().startsWith(`it`)?`it`:`en`}function Y(e,t){return s(e,Be(t))}function Ve(e){switch(e){case`rect`:return`rounded-sm`;case`rounded`:return`rounded-xl`;case`round`:return`aspect-square h-full w-auto justify-self-center rounded-full`;case`pill`:return`rounded-full`;default:return``}}function He(e){switch(e){case`accent`:return`border-primary bg-primary text-primary-foreground hover:bg-primary/90`;case`danger`:return`border-danger bg-danger-fill text-danger-on hover:bg-danger-fill/90`;case`red`:return`border-danger/40 bg-danger/15 text-danger hover:bg-danger/25`;case`green`:return`border-success/40 bg-success/15 text-success hover:bg-success/25`;case`yellow`:return`border-warning/40 bg-warning/15 text-warning hover:bg-warning/25`;case`blue`:return`border-info/40 bg-info/15 text-info hover:bg-info/25`;default:return``}}function Ue(e){switch(e){case`panel`:return`rounded-lg border border-border bg-surface/40`;case`dpad`:return`rounded-3xl border border-border bg-surface`;case`rocker-v`:case`rocker-h`:return`rounded-full border border-border bg-surface`;case`keypad`:return`rounded-lg border border-border-subtle bg-surface/60`;default:return``}}function We(e){return e===`divider`}function X(e,t){let n=Math.min(Math.max(t.row,0),e.rows-1),r=Math.min(Math.max(t.col,0),e.columns-1),i=Math.min(Math.max(t.row+t.rowSpan,n+1),e.rows),a=Math.min(Math.max(t.col+t.colSpan,r+1),e.columns);return{row:n,col:r,rowSpan:i-n,colSpan:a-r}}var Ge=`2.75rem`,Ke=`1.25rem`,qe=`1rem`;function Je(e){let t=new Set;for(let n of e.buttons)for(let e=n.row;e<n.row+n.rowSpan;e+=1)for(let r=n.col;r<n.col+n.colSpan;r+=1)t.add(`${e}:${r}`);return t}var Z=new Set([`red`,`green`,`yellow`,`blue`]);function Ye(e,t){return e.label??K(e.icon)?.label??t}function Xe(e){return e.label===void 0||K(e.icon)!==void 0?!1:e.tone===void 0||!Z.has(e.tone)}function Ze(e){if(e.icon!==void 0)return e.icon;if(!(e.tone!==void 0&&Z.has(e.tone)))return c(e.role)}function Qe({button:n,compact:r}){let i=h(),a=K(n.icon),o=Ze(n),s=n.icon===void 0?p(n.role):void 0,c=o===void 0||a!==void 0||s!==void 0?void 0:i(o),l=Xe(n)?n.label:void 0;return e(`span`,{className:`flex flex-col items-center justify-center gap-0.5 leading-none`,children:[a!==void 0&&t(ze,{brand:a}),c!==void 0&&t(c,{className:`h-4 w-4`,"aria-hidden":!0}),s!==void 0&&t(`span`,{className:`text-sm font-medium`,children:s}),l!==void 0&&!r&&t(`span`,{className:`max-w-full truncate text-[11px]`,children:l})]})}function Q(e){return{gridRow:`${e.row+1} / span ${e.rowSpan}`,gridColumn:`${e.col+1} / span ${e.colSpan}`}}function $e({group:n,selected:i,dragging:a,compact:o,editable:s,onSelect:c,onPointerDown:l,onKeyDown:u}){let{t:d}=_(),f=We(n.frame),p=!s||o||n.hideTitle===!0?void 0:n.title;return e(`div`,{"data-testid":`remote-group-${n.id}`,"data-frame":n.frame,className:r(`relative -m-0.5 flex`,Ue(n.frame),a&&`opacity-40`,i&&`ring-2 ring-primary`),style:Q(n),children:[f?e(`div`,{className:`flex w-full items-center gap-2 px-1 text-[10px] uppercase tracking-wide text-foreground-muted`,children:[t(`span`,{className:`h-px flex-1 bg-border`,"aria-hidden":!0}),p!==void 0&&t(`span`,{className:`truncate`,children:p}),p!==void 0&&t(`span`,{className:`h-px flex-1 bg-border`,"aria-hidden":!0})]}):p!==void 0&&t(`span`,{className:`absolute -top-1.5 left-3 max-w-[70%] truncate bg-background-elevated px-1 text-[10px] uppercase leading-none tracking-wide text-foreground-muted`,children:p}),s&&t(`button`,{type:`button`,"aria-label":d(`remote.layout.groupHandle`,{name:n.title??n.componentId}),"aria-pressed":i,"data-testid":`remote-group-handle-${n.id}`,className:`absolute -right-1 -top-2.5 z-20 flex h-4 w-4 touch-none cursor-grab items-center justify-center rounded-full border border-border bg-surface-hover text-foreground-muted hover:text-foreground`,onClick:c,onPointerDown:l,onKeyDown:u,children:t(m,{className:`h-3 w-3`,"aria-hidden":!0})})]})}function et({grid:n,label:i,selectedId:a=null,onSelect:o,boundRoles:s,showEmptyCells:c=!1,compact:l=!1,gridRef:u,selectedGroupId:d=null,onSelectGroup:f,onItemPointerDown:p,onItemKeyDown:m,drag:h=null}){let{i18n:v}=_(),y=p!==void 0,b=h!==null,x=Je(n),S=P(n),C=[];if(c||b)for(let e=0;e<n.rows;e+=1)for(let t=0;t<n.columns;t+=1)(b||!x.has(`${e}:${t}`)&&!S.has(e))&&C.push({row:e,col:t});let w=h?.preview??null;return e(`div`,{role:`group`,"aria-label":i,"data-testid":`remote-grid`,ref:u,className:r(`grid gap-1.5`,l?`auto-rows-[1.25rem] gap-0.5`:`auto-rows-[2.75rem]`),style:{gridTemplateColumns:`repeat(${n.columns}, minmax(0, 1fr))`,...S.size===0?{}:{gridTemplateRows:Array.from({length:n.rows},(e,t)=>S.has(t)?qe:l?Ke:Ge).join(` `)}},children:[C.map(({row:e,col:n})=>t(`div`,{"aria-hidden":!0,"data-testid":`remote-grid-cell`,className:r(`rounded-md border border-dashed`,b?`border-border`:`border-border-subtle`),style:{gridRow:`${e+1}`,gridColumn:`${n+1}`}},`e${e}:${n}`)),(n.groups??[]).map(e=>t($e,{group:e,selected:e.id===d,dragging:h?.item.kind===`group`&&h.item.id===e.id,compact:l,editable:y,onSelect:f===void 0?void 0:()=>f(e.id),onPointerDown:p===void 0?void 0:t=>p({kind:`group`,id:e.id},t),onKeyDown:m===void 0?void 0:t=>m({kind:`group`,id:e.id},t)},e.id)),n.buttons.map(e=>{let n=e.id===a,i=s===void 0||s.has(e.role),c=h?.item.kind===`button`&&h.item.id===e.id,u={kind:`button`,id:e.id},d=Ye(e,Y(e.role,v.language));return t(g,{type:`button`,size:`sm`,variant:i?`secondary`:`outline`,"aria-pressed":o===void 0?void 0:n,"aria-label":d,title:d,"data-testid":`remote-grid-button-${e.id}`,"data-shape":e.shape,"data-tone":e.tone,className:r(`z-10 h-full min-w-0 overflow-hidden border border-border px-1`,l&&`px-0`,Ve(e.shape),He(e.tone),y&&`touch-none`,c&&`opacity-40`,n&&`ring-2 ring-primary ring-offset-1 ring-offset-background`),style:Q(e),onClick:o===void 0?void 0:()=>o(e.id),onPointerDown:p===void 0?void 0:e=>p(u,e),onKeyDown:m===void 0?void 0:e=>m(u,e),children:t(Qe,{button:e,compact:l})},e.id)}),w!==null&&t(`div`,{"aria-hidden":!0,"data-testid":`remote-drop-target`,"data-valid":w.valid,className:r(`pointer-events-none z-30 rounded-md border-2 border-dashed`,w.valid?`border-success bg-success/20`:`border-danger bg-danger/20`),style:Q(X(n,w.rect))})]})}var $=`edit`;function tt(e){return`/system/templates?${$}=${encodeURIComponent(e)}`}function nt({templateId:r,testId:i}){let{t:a}=_(),o=v();return e(g,{size:`sm`,variant:`ghost`,onClick:()=>o(tt(r)),"data-testid":i??`remote-edit-template`,children:[t(n,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),a(`remote.editTemplate`)]})}export{ie as A,ae as C,se as D,oe as E,de as O,ce as S,F as T,pe as _,G as a,M as b,B as c,R as d,ue as f,he as g,me as h,Y as i,I as k,re as l,E as m,$ as n,Pe as o,y as p,et as r,K as s,nt as t,ge as u,z as v,L as w,le as x,ee as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,K as t,S as n,V as r,Y as i,d as a,et as o,u as s}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{pt as c}from"./player-overlays-
|
|
1
|
+
import{C as e,K as t,S as n,V as r,Y as i,d as a,et as o,u as s}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{pt as c}from"./player-overlays-CDEJeChs.js";import{Yo as l}from"./client-Dd2wRwgL.js";import{D as u,F as d,N as f,O as p,T as m,y as h}from"./__vite-browser-external-BCAtXlNQ.js";import{Bn as g,Mf as _,Pn as v,Sn as y,vn as b}from"./src-Bz_Mw4PZ.js";import{t as x}from"./useTranslation-BJr-n0es.js";o();var S=d([p({kind:m(`adaptive`)}),p({kind:m(`profile`),profile:l})]),C=p({serverUrl:f().min(1),token:f().min(1),deviceId:u().int().nonnegative(),target:S,muted:h()});function w(e,t){let n=t===void 0?{type:`state`,state:e}:{type:`state`,state:e,message:t};window.ReactNativeWebView?.postMessage(JSON.stringify(n))}function T(e){switch(e){case`playing`:return`playing`;case`error`:return`error`;case`connecting`:case`disconnected`:case`idle`:return`connecting`}}function E(e){return e.kind===`adaptive`?{kind:`adaptive`}:{kind:`profile`,profile:e.profile}}function D(e){return e.kind===`adaptive`?`embed:adaptive`:`embed:profile:${e.profile}`}function O(){let e=window.__CAMSTACK_EMBED__;if(e==null)return{ok:!1,error:`window.__CAMSTACK_EMBED__ is not set`};let t=C.safeParse(e);return t.success?{ok:!0,config:t.data}:{ok:!1,error:t.error.issues.map(e=>`${e.path.join(`.`)||`(root)`}: ${e.message}`).join(`; `)}}function k({message:t}){let{t:n}=x();return r(()=>{w(`error`,t)},[t]),e(`div`,{style:{position:`fixed`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`#000`,color:`#f87171`,fontFamily:`system-ui, sans-serif`,fontSize:13,padding:16,textAlign:`center`},children:[n(`embedPlayerPage.embedConfigError`,`Embed config error:`),` `,t]})}function A({system:e,deviceId:a,initialTarget:o,initialMuted:s}){let[c,l]=i(o),[u,d]=i(s),{handleOffer:f,getIceServers:p,addIceCandidate:m,getIceCandidates:h,closeSession:_,getSessionState:y,getSessionDebug:b,applyDownlinkProbe:x}=v(e.trpcClient,a),C=t(()=>E(c),[c]),O=t(()=>(e,t)=>f(C,e,t),[f,C]),k=t(()=>(e,t,n)=>f(n,t,e),[f]);r(()=>(window.__camstackEmbed={setMuted:e=>d(e),setTarget:e=>{let t=S.safeParse(e);t.success&&l(t.data)}},()=>{window.__camstackEmbed&&delete window.__camstackEmbed}),[]);let A=D(c);return n(`div`,{style:{position:`fixed`,inset:0,width:`100vw`,height:`100vh`,background:`#000`},children:n(g,{serverUrl:e.serverUrl,streamKey:A,autoPlay:!0,muted:u,showControls:!1,className:`w-full h-full`,getSessionDebug:b,applyDownlinkProbe:x,handleOffer:O,reoffer:k,getSessionState:y,getIceServers:p,addIceCandidate:m,getIceCandidates:h,closeSession:_,onStateChange:e=>w(T(e)),onError:e=>w(`error`,e)},A)})}function j(){let{t:e}=x(),i=t(()=>O(),[]),o=t(()=>{if(!i.ok)return null;let e=y({serverUrl:i.config.serverUrl,token:i.config.token}),t=new a({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}});return b(t),{system:e,queryClient:t}},[i]);return r(()=>{if(o)return()=>{o.system.close()}},[o]),i.ok?o?n(c,{system:o.system,children:n(s,{client:o.queryClient,children:n(_.Provider,{client:o.system.trpcClient,queryClient:o.queryClient,children:n(A,{system:o.system,deviceId:i.config.deviceId,initialTarget:i.config.target,initialMuted:i.config.muted})})})}):n(k,{message:e(`embedPlayerPage.failedToInitialiseTheEmbed`,`Failed to initialise the embed player`)}):n(k,{message:i.error})}export{j as EmbedPlayerPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,K as t,S as n,Y as r,et as i,i as a,x as o}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Dn as s,Fn as c,Kt as l,Pr as u,Ri as d,Sa as f,bt as p,ct as m,ht as h,lt as g,xr as _}from"./player-overlays-DRJ5jYka.js";import{bo as v,qr as y}from"./client-Dd2wRwgL.js";import{$u as b,A as x,B as S,Br as C,C as w,D as ee,Df as T,E,Ei as D,F as O,Fr as k,H as A,I as j,In as M,Ir as te,Jr as N,Kr as ne,L as re,M as ie,N as ae,On as oe,Pr as se,R as ce,Rn as P,Rr as le,U as ue,V as F,Wo as I,Xr as de,Yr as L,Zr as R,_o as fe,b as pe,j as me,k as z,kn as he,oi as B,ri as ge,ui as V,vi as H,vo as _e,w as ve,x as ye,y as be,z as xe,zn as U,zr as Se}from"./src-He9Tsysa.js";import{t as W}from"./useTranslation-BJr-n0es.js";import{Br as Ce}from"./index-BCsJtJDS.js";import{t as we}from"./AdminPage-CFwzuQZq.js";i();function G(e,t){return e.scope===``?e.displayName:`${e.displayName} · ${t?.(e)??e.scope}`}function Te(e,t,n){let r=[];for(let{device:t,series:i}of e)for(let e of i){let i={subject:{kind:`device`,deviceId:t.id},key:e.key,scope:e.scope};r.push({id:x(i),ref:i,info:e,subjectName:t.name,location:t.location??``,nodeId:``,metric:G(e,n)})}for(let{node:e,series:i}of t)for(let t of i){let i={subject:{kind:`node`,nodeId:e.id},key:t.key,scope:t.scope};r.push({id:x(i),ref:i,info:t,subjectName:e.name,location:``,nodeId:e.id,metric:G(t,n)})}return r}function Ee(e){return[e.subjectName,e.location,e.metric,e.info.key,e.info.unit??``,e.nodeId].join(` `)}function K(e,t,n){if(e.ref.subject.kind!==`device`||t===null)return e.subjectName;let r=t.byId.get(e.ref.subject.deviceId);return r===void 0?e.subjectName:ge(r,`compact`,t,n)}var De=[`energy`,`temperatures`,`nodes`,`storage`],Oe=new Set([`cap:temperature-sensor.temperature`,`cap:climate-control.currentTemp`]),q=[`addon:metrics-native/node-cpu-percent`,`addon:metrics-native/node-memory-percent`],ke=`addon:storage-orchestrator/location-used-percent`;function Ae(e,t){let n=(e,n)=>{let r=t.filter(e);return z((n?[...r].sort(n):r).map(e=>e.ref))};switch(e){case`energy`:return n(e=>e.ref.subject.kind===`device`&&e.info.key===`derived:energy.kwh`);case`temperatures`:return n(e=>e.ref.subject.kind===`device`&&Oe.has(e.info.key)&&e.info.scope===``,(e,t)=>e.location.localeCompare(t.location)||e.subjectName.localeCompare(t.subjectName));case`nodes`:return n(e=>e.ref.subject.kind===`node`&&q.includes(e.info.key)&&e.info.scope===``,(e,t)=>q.indexOf(e.info.key)-q.indexOf(t.info.key)||e.subjectName.localeCompare(t.subjectName));case`storage`:return n(e=>e.ref.subject.kind===`node`&&e.info.key===ke)}}function je(e,t){let n=new Map(t.map(e=>[e.id,e])),r=[],i=[],a=[],o=[];for(let t of z(e)){let e=n.get(x(t));if(e===void 0){o.push(t);continue}e.info.key===`derived:energy.kwh`?a.push(e):e.info.kind===`boolean`||e.info.kind===`enum`?i.push(e):r.push(e)}return{lines:r,states:i,energy:a,missing:o}}function Me(e){return e.subject.kind===`device`?{deviceId:e.subject.deviceId,key:e.key,scope:e.scope}:{forNodeId:e.subject.nodeId,key:e.key,scope:e.scope}}var J=`history-page`;function Ne({part:r,window:i}){let{t:a}=W(),o=f(),s=V(),c=B(),l=e=>`${K(e,s,c)} · ${e.metric}`,u=t(()=>[...r.lines,...r.states,...r.energy],[r]),p=w(t(()=>u.map(e=>Me(e.ref)),[u]),i,!1),m=e=>p.status===`ok`?p.data.current.get(ye(Me(e.ref))):void 0,h=e=>{let t=m(e);return t?.ok?t.result:void 0};if(u.length===0)return n(L,{icon:d,title:a(`history.page.emptyTitle`,`Pick series to compare`),description:a(`history.page.emptyHint`,`Choose up to 24 series on the left, or start from a panel above.`)});if(p.status===`error`)return n(N,{title:a(`history.page.readFailed`,`History could not be read`),message:p.error});let g=p.status===`pending`,_=u.map(e=>({c:e,e:m(e)})).filter(e=>e.e?.ok===!1),v=r.lines.map((e,t)=>{let n=h(e),r=j(e.info,n,i.from);return{id:e.id,label:l(e),unit:e.info.unit,colorIndex:t,points:r.points,gapMs:r.gapMs,interpolation:r.held&&n?.resolution===`raw`?`step`:`linear`}}),y=r.states.map((e,t)=>{let n=re(e.info,h(e),i.from,i.to),r=ae(e.info.key,o);return{id:e.id,label:l(e),kind:e.info.kind===`boolean`?`boolean`:`enum`,colorIndex:e.info.kind===`boolean`?t:0,states:n.states,segments:n.segments,totals:n.totals,stateLabel:e.info.kind===`boolean`?e=>e===`true`?r.on:r.off:void 0}}),b=r.energy.map(e=>({c:e,...O(h(e))})),x=b[0]?.bucketMs??36e5,S=[...new Set(b.flatMap(e=>e.buckets.map(e=>e.t)))].sort((e,t)=>e-t).map(e=>({t:e,values:b.map(t=>t.buckets.find(t=>t.t===e)?.values[0]??null)}));return e(`div`,{className:`space-y-5 min-w-0`,children:[_.length>0&&n(N,{title:a(`history.page.someFailed`,`Some series could not be read`),message:_.map(e=>`${l(e.c)}: ${e.e.error}`).join(` · `)}),v.length>0&&n(ue,{title:a(`history.page.lines`,`Measurements`),series:v,range:i,height:260,syncKey:J,pending:g}),b.length>0&&n(ne,{title:a(`history.page.energy`,`Energy`),layers:b.map((e,t)=>({id:e.c.id,label:K(e.c,s,c),colorIndex:t})),buckets:S,bucketMs:x,range:i,unit:`kWh`,showTotal:!0,height:160,syncKey:J,pending:g}),y.length>0&&n(A,{title:y.length===1?y[0]?.label??``:a(`history.page.states`,`States`),rows:y,range:i,syncKey:J,pending:g})]})}function Pe(e,t){let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}async function Fe(e,t){let n=[];for(let r of Pe(e,50))try{let{results:e}=await t(r),i=new Map(e.map(e=>[e.seriesId,e]));for(let e of r)n.push(i.get(e)??{seriesId:e,ok:!1,reason:`not-found`})}catch(e){let t=e instanceof Error?e.message:String(e);for(let e of r)n.push({seriesId:e,ok:!1,reason:`request-failed`,message:t})}return n}function Y(e){return e.raw+e[`5m`]+e[`1h`]+e[`1d`]}function Ie(e){return e.reduce((e,t)=>t.ok?{...e,deleted:e.deleted+1,points:e.points+Y(t.deleted)}:{...e,refused:e.refused+1},{deleted:0,refused:0,points:0})}function Le(e,t){let n=new Map(e.map(e=>[e.seriesId,e]));return t.flatMap(e=>{let t=n.get(e.seriesId);return t===void 0?[]:[{series:t,outcome:e}]})}var X=e=>new Date(e).toLocaleDateString(void 0,{dateStyle:`short`});function Z(e,t,n){let r=t.get(e.deviceId);return r===void 0?e.reason===`device-gone`?n(`history.orphans.deviceRemoved`,`#{{id}} (removed)`,{id:e.deviceId}):n(`history.orphans.deviceId`,`#{{id}}`,{id:e.deviceId}):r}function Q(e){let t=e.displayName??e.key;return e.scope===``?t:`${t} · ${e.scope}`}function Re(t,r,i){return{key:`series`,header:i(`history.orphans.colSeries`,`Series`),render:a=>{let o=t(a);return e(`div`,{className:`min-w-0 max-w-[16rem]`,children:[n(`div`,{className:`truncate text-foreground`,title:o.key,children:Q(o)}),n(`div`,{className:`truncate text-[10px] text-foreground-subtle`,children:Z(o,r,i)})]})},sortValue:e=>`${Z(t(e),r,i)} ${Q(t(e))}`}}var ze=[`raw`,`5m`,`1h`,`1d`];function Be(e,t){return e===`raw`?t(`history.orphans.colRaw`,`Raw points`):e===`5m`?t(`history.orphans.col5m`,`5 min`):e===`1h`?t(`history.orphans.col1h`,`1 h`):t(`history.orphans.col1d`,`1 day`)}function Ve(t,r){return[Re(e=>e,t,r),{key:`reason`,header:r(`history.orphans.colReason`,`Reason`),render:t=>e(`div`,{className:`flex flex-col items-start gap-0.5`,children:[n(D,{variant:t.reason===`device-gone`?`warning`:`neutral`,className:`text-[10px]`,children:t.reason===`device-gone`?r(`history.orphans.deviceGone`,`Device removed`):r(`history.orphans.undeclared`,`No longer declared`)}),t.missingSince!==null&&n(`span`,{className:`text-[10px] text-foreground-subtle`,children:r(`history.orphans.since`,`since {{date}}`,{date:X(t.missingSince)})})]}),sortValue:e=>e.reason},{key:`span`,header:r(`history.orphans.colSpan`,`Recorded`),render:t=>e(`span`,{className:`tabular-nums text-foreground-muted`,children:[X(t.firstTs),` → `,X(t.lastTs)]}),sortValue:e=>e.lastTs},...ze.map(e=>({key:`rows-${e}`,header:Be(e,r),align:`right`,render:t=>n(`span`,{className:`tabular-nums text-foreground-muted`,children:t.rows[e].toLocaleString()}),sortValue:t=>t.rows[e]}))]}function He(e,t){if(e.ok)return n(D,{variant:`success`,className:`text-[10px]`,children:t(`history.orphans.deleted`,{count:Y(e.deleted),points:Y(e.deleted).toLocaleString(),defaultValue_one:`Deleted · {{points}} point`,defaultValue_other:`Deleted · {{points}} points`})});let r=e.reason===`request-failed`?t(`history.orphans.requestFailed`,`Not sent: {{message}}`,{message:e.message}):e.reason===`not-orphan`?t(`history.orphans.refusedNotOrphan`,`Kept: no longer orphan`):e.reason===`not-found`?t(`history.orphans.refusedNotFound`,`Already gone`):t(`history.orphans.refusedFailed`,`The hub could not delete it`);return n(D,{variant:e.reason===`not-found`?`neutral`:`warning`,className:`text-[10px]`,children:r})}function Ue(e,t){return[Re(e=>e.series,e,t),{key:`result`,header:t(`history.orphans.colResult`,`Result`),render:e=>He(e.outcome,t),sortValue:e=>+!e.outcome.ok}]}i();function We({open:i,onClose:a,list:o,deviceNames:s,onDelete:u,onRefresh:d,refreshing:f}){let{t:p}=W(),h=m(),[g,v]=r(new Set),[y,b]=r(!1),[x,S]=r([]),w=t(()=>Ve(s,p),[s,p]),ee=t(()=>Ue(s,p),[s,p]),T=t(()=>new Set(o.series.map(e=>String(e.seriesId))),[o.series]),E=[...g].filter(e=>T.has(e)).map(Number),D=Ie(x.map(e=>e.outcome)),O=async()=>{if(await h({title:p(`history.orphans.confirmTitle`,{count:E.length,defaultValue_one:`Delete {{count}} series`,defaultValue_other:`Delete {{count}} series`}),message:p(`history.orphans.confirmMessage`,`Every recorded point of these series is removed from the hub. This cannot be undone.`),confirmLabel:p(`history.orphans.confirmLabel`,`Delete`),variant:`danger`})){b(!0);try{let e=await Fe(E,u);S(Le(o.series,e)),v(new Set)}finally{b(!1),d()}}};return n(se,{open:i,onOpenChange:e=>!e&&a(),children:e(te,{width:`xl`,placement:`sheet-on-mobile`,scroll:`body`,"data-testid":`orphan-series-dialog`,children:[n(Se,{children:n(C,{children:p(`history.orphans.title`,`Series no longer linked to a device`)})}),e(k,{className:`space-y-3`,children:[n(`p`,{className:`text-xs text-foreground-muted`,children:p(`history.orphans.intro`,`Nothing records into these series any more: their device was removed, or no capability declares them now. Select the ones to delete.`)}),o.truncated&&e(`div`,{className:`flex flex-wrap items-center gap-2`,"data-testid":`orphan-truncated`,children:[n(`p`,{className:`text-xs text-warning`,children:p(`history.orphans.truncated`,`More series are unlinked than are listed here. Delete these, then load the rest.`)}),e(H,{size:`sm`,variant:`outline`,onClick:d,disabled:f,children:[n(c,{className:`h-3 w-3`,"aria-hidden":!0}),p(`history.orphans.loadAgain`,`Load again`)]})]}),x.length>0&&e(`div`,{className:`space-y-2`,"data-testid":`orphan-outcomes`,children:[n(`p`,{className:`text-xs text-foreground`,"aria-live":`polite`,children:p(`history.orphans.summary`,{count:D.deleted,refused:D.refused,points:D.points.toLocaleString(),defaultValue_one:`{{count}} series deleted ({{points}} points), {{refused}} kept.`,defaultValue_other:`{{count}} series deleted ({{points}} points), {{refused}} kept.`})}),n(P,{columns:ee,rows:x,rowKey:e=>String(e.series.seriesId),minWidthPx:420,maxBodyHeight:`max-h-[60vh]`,emptyMessage:``})]}),n(P,{columns:w,rows:o.series,rowKey:e=>String(e.seriesId),minWidthPx:760,maxBodyHeight:U,defaultSort:{columnKey:`series`,dir:`asc`},emptyMessage:p(`history.orphans.empty`,`Every series is linked to a device.`),selection:{selected:g,onChange:v,rowLabel:e=>`${Q(e)} — ${Z(e,s,p)}`,pageLabel:p(`history.orphans.selectAll`,`Select every listed series`)}})]}),e(le,{children:[n(`span`,{className:`mr-auto text-[11px] tabular-nums text-foreground`,"aria-live":`polite`,children:p(`history.orphans.selected`,{count:E.length,defaultValue_one:`{{count}} selected`,defaultValue_other:`{{count}} selected`})}),n(H,{variant:`ghost`,size:`sm`,onClick:a,children:p(`history.orphans.close`,`Close`)}),e(H,{variant:`danger`,size:`sm`,disabled:E.length===0||y,onClick:()=>void O(),children:[y?n(_,{className:`h-3 w-3 animate-spin`,"aria-hidden":!0}):n(l,{className:`h-3 w-3`,"aria-hidden":!0}),p(`history.orphans.deleteSelected`,`Delete selected`)]})]})]})})}i();var Ge=5*6e4;function Ke({enabled:i}){let{t:a}=W(),[s,c]=r(!1),l=_e({},{enabled:i,staleTime:Ge}),u=I({projection:`slim`},{enabled:i}),d=fe(),f=t(()=>new Map((u.data??[]).map(e=>[e.id,e.name])),[u.data]),p=e=>d.mutateAsync({seriesIds:[...e]});if(!i||l.status===`pending`)return null;if(l.status===`error`)return n(N,{variant:`warning`,title:a(`history.orphans.checkFailedTitle`,`Could not check for unlinked series`),message:l.error.message,onRetry:()=>void l.refetch()});let m=l.data;if(m.series.length===0&&!s)return null;let h=m.series.length;return e(o,{children:[h>0&&n(N,{variant:`warning`,message:m.truncated?a(`history.orphans.noticeMore`,{count:h,defaultValue_one:`More than {{count}} series are no longer linked to a device.`,defaultValue_other:`More than {{count}} series are no longer linked to a device.`}):a(`history.orphans.notice`,{count:h,defaultValue_one:`{{count}} series is no longer linked to a device.`,defaultValue_other:`{{count}} series are no longer linked to a device.`}),action:n(H,{size:`sm`,variant:`outline`,onClick:()=>c(!0),children:a(`history.orphans.review`,`Review`)})}),n(We,{open:s,onClose:()=>c(!1),list:m,deviceNames:f,onDelete:p,onRefresh:()=>void l.refetch(),refreshing:l.isFetching})]})}i();var qe=`device`,Je=`node`;function Ye({catalog:r,selected:i,onChange:a,loading:o}){let{t:s}=W(),c=V(),l=B(),u=e=>K(e,c,l),d=oe(r,{searchText:e=>[Ee(e)],facetGroups:[{id:`subject`,value:e=>e.ref.subject.kind===`device`?qe:Je},{id:`room`,value:e=>e.location},{id:`unit`,value:e=>e.info.unit??``}]}),f=t(()=>[{key:`metric`,header:s(`history.picker.series`,`Series`),render:t=>e(`div`,{className:`min-w-0`,children:[n(`div`,{className:`truncate text-foreground`,children:t.metric}),n(`div`,{className:`truncate text-[10px] text-foreground-subtle`,children:t.location===``?u(t):`${u(t)} · ${t.location}`})]}),sortValue:e=>`${e.subjectName} ${e.metric}`},{key:`unit`,header:s(`history.picker.unit`,`Unit`),render:e=>n(`span`,{className:`text-foreground-muted`,children:e.info.unit??`—`}),sortValue:e=>e.info.unit??``}],[s,c,l]),p=i.size>=24;return e(`div`,{className:`space-y-2 min-w-0`,children:[n(he,{state:d.state,facets:[],groups:[{...d.groups.find(e=>e.id===`subject`)??{id:`subject`,facets:[],selected:[]},label:s(`history.picker.subject`,`Source`),facetLabel:e=>e===qe?s(`history.picker.devices`,`Devices`):s(`history.picker.nodes`,`Nodes`)},{...d.groups.find(e=>e.id===`room`)??{id:`room`,facets:[],selected:[]},label:s(`history.picker.room`,`Room`),facetLabel:e=>e===``?s(`history.picker.noRoom`,`No room`):e},{...d.groups.find(e=>e.id===`unit`)??{id:`unit`,facets:[],selected:[]},label:s(`history.picker.metricType`,`Unit`),facetLabel:e=>e===``?s(`history.picker.noUnit`,`States & counts`):e}],labels:{searchPlaceholder:s(`history.picker.search`,`Search device, room, metric or node…`),searchLabel:s(`history.picker.searchLabel`,`Search series`),facetsLabel:s(`history.picker.facets`,`Filters`),clearLabel:s(`history.picker.clear`,`Clear`)},onSearch:d.setSearch,onToggleFacet:d.toggleFacet,onToggleGroupFacet:d.toggleGroupFacet,onClear:d.clear}),n(`p`,{className:`text-[10px] text-foreground-subtle`,"aria-live":`polite`,children:s(`history.picker.count`,`{{count}} of {{max}} selected`,{count:i.size,max:24})}),n(P,{columns:f,rows:d.rows,rowKey:e=>e.id,maxBodyHeight:U,pageSize:50,defaultSort:{columnKey:`metric`,dir:`asc`},emptyMessage:o?s(`history.picker.loading`,`Reading the series of every device…`):d.active?s(`history.picker.emptyFiltered`,`No series match these filters.`):s(`history.picker.empty`,`Nothing is recorded yet.`),selection:{selected:i,onChange:e=>{let t=[...e].filter(e=>i.has(e)),n=[...e].filter(e=>!i.has(e));a(new Set([...t,...n].slice(0,24)))},isSelectable:e=>i.has(e.id)||!p,rowLabel:e=>`${u(e)} · ${e.metric}`,pageLabel:s(`history.picker.selectPage`,`Select every series on this page`)}})]})}i();var Xe=new Set([v.Hub,v.Container]),$=5*6e4;function Ze(){let{t:r}=W(),i=de(`device-history`),[a,o]=Ce(),c=t(()=>z(a.getAll(`s`).flatMap(e=>{let t=E(e);return t===null?[]:[t]})),[a]),l=a.get(`window`),f=S(l)?l:`7d`,h=ce(a.get(`range`)),_=(e,t,n)=>{let r=new URLSearchParams;for(let t of z(e))r.append(`s`,ee(t));t!==`7d`&&r.set(`window`,t);let i=n===void 0?a.get(`range`):n;t===`custom`&&i&&r.set(`range`,i),o(r,{replace:!0})},v=Qe(i===`present`),y=F(f,Date.now(),h),b=F(f,pe(Date.now(),y.to-y.from),h),C=t(()=>je(c,v.candidates),[c,v.candidates]),w=t(()=>new Set(c.map(x)),[c]),T=be(),D=g(),O=m(),k=async()=>{let e=await D({title:r(`history.page.saveTitle`,`Save as panel`),label:r(`history.page.saveName`,`Panel name`),confirmLabel:r(`history.page.save`,`Save`)});e===null||e.trim()===``||await T.update(t=>me(t,{id:`panel-${Date.now().toString(36)}`,name:e.trim().slice(0,80),window:f,selection:[...c]}))},A=async(e,t)=>{await O({title:r(`history.page.deleteTitle`,`Delete panel`),message:r(`history.page.deleteMessage`,`The panel "{{name}}" is removed from your account.`,{name:t}),confirmLabel:r(`history.page.delete`,`Delete`),variant:`danger`})&&await T.update(t=>ie(t,e))},j=e=>e===`energy`?r(`history.panels.energy`,`Total energy`):e===`temperatures`?r(`history.panels.temperatures`,`Temperatures by room`):e===`nodes`?r(`history.panels.nodes`,`Cluster nodes`):r(`history.panels.storage`,`Storage locations`);return n(we,{icon:d,title:r(`history.page.title`,`History`),subtitle:r(`history.page.subtitle`,`What devices, nodes and storage recorded over time, side by side.`),actions:i===`present`?e(H,{size:`sm`,variant:`outline`,onClick:()=>void k(),disabled:c.length===0||!T.writable,children:[n(s,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),r(`history.page.saveTitle`,`Save as panel`)]}):void 0,children:i===`pending`?n(R,{className:`h-64 w-full`}):i===`unknown`?n(N,{title:r(`history.page.presenceUnknownTitle`,`Could not reach the hub`),message:r(`history.page.presenceUnknown`,`The hub did not say whether device history is installed. Try again in a moment.`)}):i===`absent`?n(L,{icon:u,title:r(`history.page.absentTitle`,`Device history is not running on this hub`),description:r(`history.page.absent`,`Nothing is recorded until the device-history system addon is enabled.`)}):e(`div`,{className:`space-y-3 sm:space-y-4`,children:[n(Ke,{enabled:i===`present`}),e(`div`,{className:`flex flex-wrap items-center gap-2`,role:`group`,"aria-label":r(`history.page.panels`,`Panels`),children:[De.map(e=>n(H,{size:`sm`,variant:`outline`,disabled:v.status!==`ok`,onClick:()=>_(Ae(e,v.candidates),f),children:j(e)},e)),T.value.panels.map(t=>e(`span`,{className:`inline-flex items-center`,children:[n(H,{size:`sm`,variant:`secondary`,onClick:()=>_(t.selection,t.window,null),children:t.name}),n(H,{size:`sm`,variant:`ghost`,"aria-label":r(`history.page.deleteNamed`,`Delete panel {{name}}`,{name:t.name}),onClick:()=>void A(t.id,t.name),disabled:!T.writable,children:n(p,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})})]},t.id))]}),e(`div`,{className:`grid grid-cols-1 gap-3 sm:gap-4 xl:grid-cols-5`,children:[n(`div`,{className:`min-w-0 xl:col-span-2`,children:n(M,{headingId:`history-picker`,title:r(`history.picker.title`,`Series`),children:n(`div`,{className:`p-2 sm:p-3`,children:v.status===`error`?n(N,{message:v.error}):n(Ye,{catalog:v.candidates,loading:v.status===`pending`,selected:w,onChange:e=>{let t=c.filter(t=>e.has(x(t))),n=v.candidates.filter(t=>e.has(t.id)&&!w.has(t.id)).map(e=>e.ref);_([...t,...n],f)}})})})}),n(`div`,{className:`min-w-0 xl:col-span-3`,children:n(M,{headingId:`history-overlay`,title:r(`history.page.overlay`,`Overlay`),actions:c.length>0?n(H,{size:`sm`,variant:`ghost`,onClick:()=>_([],f),children:r(`history.page.clear`,`Clear`)}):void 0,children:e(`div`,{className:`p-2 sm:p-3 space-y-3 min-w-0`,children:[n(ve,{value:f,onChange:e=>_(c,e),custom:h,onCustomChange:e=>_(c,`custom`,xe(e))}),v.status===`pending`&&c.length>0?n(R,{className:`h-64 w-full`}):n(Ne,{part:C,window:b}),C.missing.length>0&&v.status===`ok`&&n(`p`,{className:`text-[11px] text-foreground-subtle`,children:r(`history.page.missing`,{count:C.missing.length,defaultValue_one:`{{count}} selected series is no longer recorded.`,defaultValue_other:`{{count}} selected series are no longer recorded.`})})]})})})]})]})})}function Qe(e){let{t:n}=W(),r=n(`history.picker.wholeFrame`,`Whole frame`),i=h().trpcClient,o=I({projection:`slim`},{enabled:e}),{nodes:s}=T(),c=t(()=>(o.data??[]).filter(e=>!Xe.has(String(e.type))),[o.data]),l=a({queries:c.map(t=>({queryKey:[`device-history`,`listSeries`,t.id],queryFn:()=>i.deviceHistory.listSeries.query({deviceId:t.id}),enabled:e,staleTime:$}))}),u=a({queries:s.map(t=>({queryKey:[`device-history`,`listNodeSeries`,t.id],queryFn:()=>i.deviceHistory.listNodeSeries.query({forNodeId:t.id}),enabled:e,staleTime:$}))}),d=b({},{enabled:e,staleTime:$}),f=t(()=>new Map((d?.data??[]).map(e=>[e.id,e.displayName])),[d?.data]),p=l.map(e=>e.data),m=u.map(e=>e.data),g=t(()=>Te(c.flatMap((e,t)=>{let n=p[t];return n===void 0?[]:[{device:{id:e.id,name:e.name,location:e.location??null},series:n}]}),s.flatMap((e,t)=>{let n=m[t];return n===void 0?[]:[{node:{id:e.id,name:e.name},series:n}]}),e=>{if(e.key!==`addon:pipeline-analytics/occupancy`)return f.get(e.scope)??e.scope;let{zoneId:t,className:n}=y(e.scope),i=t===``?r:t;return n===void 0?i:`${i} · ${n}`}),[c,s,f,[...l,...u].map(e=>e.dataUpdatedAt).join(`,`),r]);return o.status===`error`?{status:`error`,error:o.error.message,candidates:[]}:{status:o.status===`pending`||l.some(e=>e.isPending)||u.some(e=>e.isPending)?`pending`:`ok`,error:``,candidates:g}}export{Ze as HistoryPage};
|
|
1
|
+
import{C as e,K as t,S as n,Y as r,et as i,i as a,x as o}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{En as s,Kt as c,Li as l,Nr as u,Pn as d,br as f,bt as p,ct as m,ht as h,lt as g,xa as _}from"./player-overlays-CDEJeChs.js";import{bo as v,qr as y}from"./client-Dd2wRwgL.js";import{$u as b,A as x,B as S,Br as C,C as w,D as ee,Df as T,E,Ei as D,F as O,Fr as k,H as A,I as j,In as M,Ir as te,Jr as N,Kr as ne,L as re,M as ie,N as ae,On as oe,Pr as se,R as ce,Rn as P,Rr as le,U as ue,V as F,Wo as I,Xr as de,Yr as L,Zr as R,_o as fe,b as pe,j as me,k as z,kn as he,oi as B,ri as ge,ui as V,vi as H,vo as _e,w as ve,x as ye,y as be,z as xe,zn as U,zr as Se}from"./src-Bz_Mw4PZ.js";import{t as W}from"./useTranslation-BJr-n0es.js";import{Br as Ce}from"./index-CKdLDmIt.js";import{t as we}from"./AdminPage-Dr63s4g1.js";i();function G(e,t){return e.scope===``?e.displayName:`${e.displayName} · ${t?.(e)??e.scope}`}function Te(e,t,n){let r=[];for(let{device:t,series:i}of e)for(let e of i){let i={subject:{kind:`device`,deviceId:t.id},key:e.key,scope:e.scope};r.push({id:x(i),ref:i,info:e,subjectName:t.name,location:t.location??``,nodeId:``,metric:G(e,n)})}for(let{node:e,series:i}of t)for(let t of i){let i={subject:{kind:`node`,nodeId:e.id},key:t.key,scope:t.scope};r.push({id:x(i),ref:i,info:t,subjectName:e.name,location:``,nodeId:e.id,metric:G(t,n)})}return r}function Ee(e){return[e.subjectName,e.location,e.metric,e.info.key,e.info.unit??``,e.nodeId].join(` `)}function K(e,t,n){if(e.ref.subject.kind!==`device`||t===null)return e.subjectName;let r=t.byId.get(e.ref.subject.deviceId);return r===void 0?e.subjectName:ge(r,`compact`,t,n)}var De=[`energy`,`temperatures`,`nodes`,`storage`],Oe=new Set([`cap:temperature-sensor.temperature`,`cap:climate-control.currentTemp`]),q=[`addon:metrics-native/node-cpu-percent`,`addon:metrics-native/node-memory-percent`],ke=`addon:storage-orchestrator/location-used-percent`;function Ae(e,t){let n=(e,n)=>{let r=t.filter(e);return z((n?[...r].sort(n):r).map(e=>e.ref))};switch(e){case`energy`:return n(e=>e.ref.subject.kind===`device`&&e.info.key===`derived:energy.kwh`);case`temperatures`:return n(e=>e.ref.subject.kind===`device`&&Oe.has(e.info.key)&&e.info.scope===``,(e,t)=>e.location.localeCompare(t.location)||e.subjectName.localeCompare(t.subjectName));case`nodes`:return n(e=>e.ref.subject.kind===`node`&&q.includes(e.info.key)&&e.info.scope===``,(e,t)=>q.indexOf(e.info.key)-q.indexOf(t.info.key)||e.subjectName.localeCompare(t.subjectName));case`storage`:return n(e=>e.ref.subject.kind===`node`&&e.info.key===ke)}}function je(e,t){let n=new Map(t.map(e=>[e.id,e])),r=[],i=[],a=[],o=[];for(let t of z(e)){let e=n.get(x(t));if(e===void 0){o.push(t);continue}e.info.key===`derived:energy.kwh`?a.push(e):e.info.kind===`boolean`||e.info.kind===`enum`?i.push(e):r.push(e)}return{lines:r,states:i,energy:a,missing:o}}function Me(e){return e.subject.kind===`device`?{deviceId:e.subject.deviceId,key:e.key,scope:e.scope}:{forNodeId:e.subject.nodeId,key:e.key,scope:e.scope}}var J=`history-page`;function Ne({part:r,window:i}){let{t:a}=W(),o=_(),s=V(),c=B(),u=e=>`${K(e,s,c)} · ${e.metric}`,d=t(()=>[...r.lines,...r.states,...r.energy],[r]),f=w(t(()=>d.map(e=>Me(e.ref)),[d]),i,!1),p=e=>f.status===`ok`?f.data.current.get(ye(Me(e.ref))):void 0,m=e=>{let t=p(e);return t?.ok?t.result:void 0};if(d.length===0)return n(L,{icon:l,title:a(`history.page.emptyTitle`,`Pick series to compare`),description:a(`history.page.emptyHint`,`Choose up to 24 series on the left, or start from a panel above.`)});if(f.status===`error`)return n(N,{title:a(`history.page.readFailed`,`History could not be read`),message:f.error});let h=f.status===`pending`,g=d.map(e=>({c:e,e:p(e)})).filter(e=>e.e?.ok===!1),v=r.lines.map((e,t)=>{let n=m(e),r=j(e.info,n,i.from);return{id:e.id,label:u(e),unit:e.info.unit,colorIndex:t,points:r.points,gapMs:r.gapMs,interpolation:r.held&&n?.resolution===`raw`?`step`:`linear`}}),y=r.states.map((e,t)=>{let n=re(e.info,m(e),i.from,i.to),r=ae(e.info.key,o);return{id:e.id,label:u(e),kind:e.info.kind===`boolean`?`boolean`:`enum`,colorIndex:e.info.kind===`boolean`?t:0,states:n.states,segments:n.segments,totals:n.totals,stateLabel:e.info.kind===`boolean`?e=>e===`true`?r.on:r.off:void 0}}),b=r.energy.map(e=>({c:e,...O(m(e))})),x=b[0]?.bucketMs??36e5,S=[...new Set(b.flatMap(e=>e.buckets.map(e=>e.t)))].sort((e,t)=>e-t).map(e=>({t:e,values:b.map(t=>t.buckets.find(t=>t.t===e)?.values[0]??null)}));return e(`div`,{className:`space-y-5 min-w-0`,children:[g.length>0&&n(N,{title:a(`history.page.someFailed`,`Some series could not be read`),message:g.map(e=>`${u(e.c)}: ${e.e.error}`).join(` · `)}),v.length>0&&n(ue,{title:a(`history.page.lines`,`Measurements`),series:v,range:i,height:260,syncKey:J,pending:h}),b.length>0&&n(ne,{title:a(`history.page.energy`,`Energy`),layers:b.map((e,t)=>({id:e.c.id,label:K(e.c,s,c),colorIndex:t})),buckets:S,bucketMs:x,range:i,unit:`kWh`,showTotal:!0,height:160,syncKey:J,pending:h}),y.length>0&&n(A,{title:y.length===1?y[0]?.label??``:a(`history.page.states`,`States`),rows:y,range:i,syncKey:J,pending:h})]})}function Pe(e,t){let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}async function Fe(e,t){let n=[];for(let r of Pe(e,50))try{let{results:e}=await t(r),i=new Map(e.map(e=>[e.seriesId,e]));for(let e of r)n.push(i.get(e)??{seriesId:e,ok:!1,reason:`not-found`})}catch(e){let t=e instanceof Error?e.message:String(e);for(let e of r)n.push({seriesId:e,ok:!1,reason:`request-failed`,message:t})}return n}function Y(e){return e.raw+e[`5m`]+e[`1h`]+e[`1d`]}function Ie(e){return e.reduce((e,t)=>t.ok?{...e,deleted:e.deleted+1,points:e.points+Y(t.deleted)}:{...e,refused:e.refused+1},{deleted:0,refused:0,points:0})}function Le(e,t){let n=new Map(e.map(e=>[e.seriesId,e]));return t.flatMap(e=>{let t=n.get(e.seriesId);return t===void 0?[]:[{series:t,outcome:e}]})}var X=e=>new Date(e).toLocaleDateString(void 0,{dateStyle:`short`});function Z(e,t,n){let r=t.get(e.deviceId);return r===void 0?e.reason===`device-gone`?n(`history.orphans.deviceRemoved`,`#{{id}} (removed)`,{id:e.deviceId}):n(`history.orphans.deviceId`,`#{{id}}`,{id:e.deviceId}):r}function Q(e){let t=e.displayName??e.key;return e.scope===``?t:`${t} · ${e.scope}`}function Re(t,r,i){return{key:`series`,header:i(`history.orphans.colSeries`,`Series`),render:a=>{let o=t(a);return e(`div`,{className:`min-w-0 max-w-[16rem]`,children:[n(`div`,{className:`truncate text-foreground`,title:o.key,children:Q(o)}),n(`div`,{className:`truncate text-[10px] text-foreground-subtle`,children:Z(o,r,i)})]})},sortValue:e=>`${Z(t(e),r,i)} ${Q(t(e))}`}}var ze=[`raw`,`5m`,`1h`,`1d`];function Be(e,t){return e===`raw`?t(`history.orphans.colRaw`,`Raw points`):e===`5m`?t(`history.orphans.col5m`,`5 min`):e===`1h`?t(`history.orphans.col1h`,`1 h`):t(`history.orphans.col1d`,`1 day`)}function Ve(t,r){return[Re(e=>e,t,r),{key:`reason`,header:r(`history.orphans.colReason`,`Reason`),render:t=>e(`div`,{className:`flex flex-col items-start gap-0.5`,children:[n(D,{variant:t.reason===`device-gone`?`warning`:`neutral`,className:`text-[10px]`,children:t.reason===`device-gone`?r(`history.orphans.deviceGone`,`Device removed`):r(`history.orphans.undeclared`,`No longer declared`)}),t.missingSince!==null&&n(`span`,{className:`text-[10px] text-foreground-subtle`,children:r(`history.orphans.since`,`since {{date}}`,{date:X(t.missingSince)})})]}),sortValue:e=>e.reason},{key:`span`,header:r(`history.orphans.colSpan`,`Recorded`),render:t=>e(`span`,{className:`tabular-nums text-foreground-muted`,children:[X(t.firstTs),` → `,X(t.lastTs)]}),sortValue:e=>e.lastTs},...ze.map(e=>({key:`rows-${e}`,header:Be(e,r),align:`right`,render:t=>n(`span`,{className:`tabular-nums text-foreground-muted`,children:t.rows[e].toLocaleString()}),sortValue:t=>t.rows[e]}))]}function He(e,t){if(e.ok)return n(D,{variant:`success`,className:`text-[10px]`,children:t(`history.orphans.deleted`,{count:Y(e.deleted),points:Y(e.deleted).toLocaleString(),defaultValue_one:`Deleted · {{points}} point`,defaultValue_other:`Deleted · {{points}} points`})});let r=e.reason===`request-failed`?t(`history.orphans.requestFailed`,`Not sent: {{message}}`,{message:e.message}):e.reason===`not-orphan`?t(`history.orphans.refusedNotOrphan`,`Kept: no longer orphan`):e.reason===`not-found`?t(`history.orphans.refusedNotFound`,`Already gone`):t(`history.orphans.refusedFailed`,`The hub could not delete it`);return n(D,{variant:e.reason===`not-found`?`neutral`:`warning`,className:`text-[10px]`,children:r})}function Ue(e,t){return[Re(e=>e.series,e,t),{key:`result`,header:t(`history.orphans.colResult`,`Result`),render:e=>He(e.outcome,t),sortValue:e=>+!e.outcome.ok}]}i();function We({open:i,onClose:a,list:o,deviceNames:s,onDelete:l,onRefresh:u,refreshing:p}){let{t:h}=W(),g=m(),[_,v]=r(new Set),[y,b]=r(!1),[x,S]=r([]),w=t(()=>Ve(s,h),[s,h]),ee=t(()=>Ue(s,h),[s,h]),T=t(()=>new Set(o.series.map(e=>String(e.seriesId))),[o.series]),E=[..._].filter(e=>T.has(e)).map(Number),D=Ie(x.map(e=>e.outcome)),O=async()=>{if(await g({title:h(`history.orphans.confirmTitle`,{count:E.length,defaultValue_one:`Delete {{count}} series`,defaultValue_other:`Delete {{count}} series`}),message:h(`history.orphans.confirmMessage`,`Every recorded point of these series is removed from the hub. This cannot be undone.`),confirmLabel:h(`history.orphans.confirmLabel`,`Delete`),variant:`danger`})){b(!0);try{let e=await Fe(E,l);S(Le(o.series,e)),v(new Set)}finally{b(!1),u()}}};return n(se,{open:i,onOpenChange:e=>!e&&a(),children:e(te,{width:`xl`,placement:`sheet-on-mobile`,scroll:`body`,"data-testid":`orphan-series-dialog`,children:[n(Se,{children:n(C,{children:h(`history.orphans.title`,`Series no longer linked to a device`)})}),e(k,{className:`space-y-3`,children:[n(`p`,{className:`text-xs text-foreground-muted`,children:h(`history.orphans.intro`,`Nothing records into these series any more: their device was removed, or no capability declares them now. Select the ones to delete.`)}),o.truncated&&e(`div`,{className:`flex flex-wrap items-center gap-2`,"data-testid":`orphan-truncated`,children:[n(`p`,{className:`text-xs text-warning`,children:h(`history.orphans.truncated`,`More series are unlinked than are listed here. Delete these, then load the rest.`)}),e(H,{size:`sm`,variant:`outline`,onClick:u,disabled:p,children:[n(d,{className:`h-3 w-3`,"aria-hidden":!0}),h(`history.orphans.loadAgain`,`Load again`)]})]}),x.length>0&&e(`div`,{className:`space-y-2`,"data-testid":`orphan-outcomes`,children:[n(`p`,{className:`text-xs text-foreground`,"aria-live":`polite`,children:h(`history.orphans.summary`,{count:D.deleted,refused:D.refused,points:D.points.toLocaleString(),defaultValue_one:`{{count}} series deleted ({{points}} points), {{refused}} kept.`,defaultValue_other:`{{count}} series deleted ({{points}} points), {{refused}} kept.`})}),n(P,{columns:ee,rows:x,rowKey:e=>String(e.series.seriesId),minWidthPx:420,maxBodyHeight:`max-h-[60vh]`,emptyMessage:``})]}),n(P,{columns:w,rows:o.series,rowKey:e=>String(e.seriesId),minWidthPx:760,maxBodyHeight:U,defaultSort:{columnKey:`series`,dir:`asc`},emptyMessage:h(`history.orphans.empty`,`Every series is linked to a device.`),selection:{selected:_,onChange:v,rowLabel:e=>`${Q(e)} — ${Z(e,s,h)}`,pageLabel:h(`history.orphans.selectAll`,`Select every listed series`)}})]}),e(le,{children:[n(`span`,{className:`mr-auto text-[11px] tabular-nums text-foreground`,"aria-live":`polite`,children:h(`history.orphans.selected`,{count:E.length,defaultValue_one:`{{count}} selected`,defaultValue_other:`{{count}} selected`})}),n(H,{variant:`ghost`,size:`sm`,onClick:a,children:h(`history.orphans.close`,`Close`)}),e(H,{variant:`danger`,size:`sm`,disabled:E.length===0||y,onClick:()=>void O(),children:[y?n(f,{className:`h-3 w-3 animate-spin`,"aria-hidden":!0}):n(c,{className:`h-3 w-3`,"aria-hidden":!0}),h(`history.orphans.deleteSelected`,`Delete selected`)]})]})]})})}i();var Ge=5*6e4;function Ke({enabled:i}){let{t:a}=W(),[s,c]=r(!1),l=_e({},{enabled:i,staleTime:Ge}),u=I({projection:`slim`},{enabled:i}),d=fe(),f=t(()=>new Map((u.data??[]).map(e=>[e.id,e.name])),[u.data]),p=e=>d.mutateAsync({seriesIds:[...e]});if(!i||l.status===`pending`)return null;if(l.status===`error`)return n(N,{variant:`warning`,title:a(`history.orphans.checkFailedTitle`,`Could not check for unlinked series`),message:l.error.message,onRetry:()=>void l.refetch()});let m=l.data;if(m.series.length===0&&!s)return null;let h=m.series.length;return e(o,{children:[h>0&&n(N,{variant:`warning`,message:m.truncated?a(`history.orphans.noticeMore`,{count:h,defaultValue_one:`More than {{count}} series are no longer linked to a device.`,defaultValue_other:`More than {{count}} series are no longer linked to a device.`}):a(`history.orphans.notice`,{count:h,defaultValue_one:`{{count}} series is no longer linked to a device.`,defaultValue_other:`{{count}} series are no longer linked to a device.`}),action:n(H,{size:`sm`,variant:`outline`,onClick:()=>c(!0),children:a(`history.orphans.review`,`Review`)})}),n(We,{open:s,onClose:()=>c(!1),list:m,deviceNames:f,onDelete:p,onRefresh:()=>void l.refetch(),refreshing:l.isFetching})]})}i();var qe=`device`,Je=`node`;function Ye({catalog:r,selected:i,onChange:a,loading:o}){let{t:s}=W(),c=V(),l=B(),u=e=>K(e,c,l),d=oe(r,{searchText:e=>[Ee(e)],facetGroups:[{id:`subject`,value:e=>e.ref.subject.kind===`device`?qe:Je},{id:`room`,value:e=>e.location},{id:`unit`,value:e=>e.info.unit??``}]}),f=t(()=>[{key:`metric`,header:s(`history.picker.series`,`Series`),render:t=>e(`div`,{className:`min-w-0`,children:[n(`div`,{className:`truncate text-foreground`,children:t.metric}),n(`div`,{className:`truncate text-[10px] text-foreground-subtle`,children:t.location===``?u(t):`${u(t)} · ${t.location}`})]}),sortValue:e=>`${e.subjectName} ${e.metric}`},{key:`unit`,header:s(`history.picker.unit`,`Unit`),render:e=>n(`span`,{className:`text-foreground-muted`,children:e.info.unit??`—`}),sortValue:e=>e.info.unit??``}],[s,c,l]),p=i.size>=24;return e(`div`,{className:`space-y-2 min-w-0`,children:[n(he,{state:d.state,facets:[],groups:[{...d.groups.find(e=>e.id===`subject`)??{id:`subject`,facets:[],selected:[]},label:s(`history.picker.subject`,`Source`),facetLabel:e=>e===qe?s(`history.picker.devices`,`Devices`):s(`history.picker.nodes`,`Nodes`)},{...d.groups.find(e=>e.id===`room`)??{id:`room`,facets:[],selected:[]},label:s(`history.picker.room`,`Room`),facetLabel:e=>e===``?s(`history.picker.noRoom`,`No room`):e},{...d.groups.find(e=>e.id===`unit`)??{id:`unit`,facets:[],selected:[]},label:s(`history.picker.metricType`,`Unit`),facetLabel:e=>e===``?s(`history.picker.noUnit`,`States & counts`):e}],labels:{searchPlaceholder:s(`history.picker.search`,`Search device, room, metric or node…`),searchLabel:s(`history.picker.searchLabel`,`Search series`),facetsLabel:s(`history.picker.facets`,`Filters`),clearLabel:s(`history.picker.clear`,`Clear`)},onSearch:d.setSearch,onToggleFacet:d.toggleFacet,onToggleGroupFacet:d.toggleGroupFacet,onClear:d.clear}),n(`p`,{className:`text-[10px] text-foreground-subtle`,"aria-live":`polite`,children:s(`history.picker.count`,`{{count}} of {{max}} selected`,{count:i.size,max:24})}),n(P,{columns:f,rows:d.rows,rowKey:e=>e.id,maxBodyHeight:U,pageSize:50,defaultSort:{columnKey:`metric`,dir:`asc`},emptyMessage:o?s(`history.picker.loading`,`Reading the series of every device…`):d.active?s(`history.picker.emptyFiltered`,`No series match these filters.`):s(`history.picker.empty`,`Nothing is recorded yet.`),selection:{selected:i,onChange:e=>{let t=[...e].filter(e=>i.has(e)),n=[...e].filter(e=>!i.has(e));a(new Set([...t,...n].slice(0,24)))},isSelectable:e=>i.has(e.id)||!p,rowLabel:e=>`${u(e)} · ${e.metric}`,pageLabel:s(`history.picker.selectPage`,`Select every series on this page`)}})]})}i();var Xe=new Set([v.Hub,v.Container]),$=5*6e4;function Ze(){let{t:r}=W(),i=de(`device-history`),[a,o]=Ce(),c=t(()=>z(a.getAll(`s`).flatMap(e=>{let t=E(e);return t===null?[]:[t]})),[a]),d=a.get(`window`),f=S(d)?d:`7d`,h=ce(a.get(`range`)),_=(e,t,n)=>{let r=new URLSearchParams;for(let t of z(e))r.append(`s`,ee(t));t!==`7d`&&r.set(`window`,t);let i=n===void 0?a.get(`range`):n;t===`custom`&&i&&r.set(`range`,i),o(r,{replace:!0})},v=Qe(i===`present`),y=F(f,Date.now(),h),b=F(f,pe(Date.now(),y.to-y.from),h),C=t(()=>je(c,v.candidates),[c,v.candidates]),w=t(()=>new Set(c.map(x)),[c]),T=be(),D=g(),O=m(),k=async()=>{let e=await D({title:r(`history.page.saveTitle`,`Save as panel`),label:r(`history.page.saveName`,`Panel name`),confirmLabel:r(`history.page.save`,`Save`)});e===null||e.trim()===``||await T.update(t=>me(t,{id:`panel-${Date.now().toString(36)}`,name:e.trim().slice(0,80),window:f,selection:[...c]}))},A=async(e,t)=>{await O({title:r(`history.page.deleteTitle`,`Delete panel`),message:r(`history.page.deleteMessage`,`The panel "{{name}}" is removed from your account.`,{name:t}),confirmLabel:r(`history.page.delete`,`Delete`),variant:`danger`})&&await T.update(t=>ie(t,e))},j=e=>e===`energy`?r(`history.panels.energy`,`Total energy`):e===`temperatures`?r(`history.panels.temperatures`,`Temperatures by room`):e===`nodes`?r(`history.panels.nodes`,`Cluster nodes`):r(`history.panels.storage`,`Storage locations`);return n(we,{icon:l,title:r(`history.page.title`,`History`),subtitle:r(`history.page.subtitle`,`What devices, nodes and storage recorded over time, side by side.`),actions:i===`present`?e(H,{size:`sm`,variant:`outline`,onClick:()=>void k(),disabled:c.length===0||!T.writable,children:[n(s,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),r(`history.page.saveTitle`,`Save as panel`)]}):void 0,children:i===`pending`?n(R,{className:`h-64 w-full`}):i===`unknown`?n(N,{title:r(`history.page.presenceUnknownTitle`,`Could not reach the hub`),message:r(`history.page.presenceUnknown`,`The hub did not say whether device history is installed. Try again in a moment.`)}):i===`absent`?n(L,{icon:u,title:r(`history.page.absentTitle`,`Device history is not running on this hub`),description:r(`history.page.absent`,`Nothing is recorded until the device-history system addon is enabled.`)}):e(`div`,{className:`space-y-3 sm:space-y-4`,children:[n(Ke,{enabled:i===`present`}),e(`div`,{className:`flex flex-wrap items-center gap-2`,role:`group`,"aria-label":r(`history.page.panels`,`Panels`),children:[De.map(e=>n(H,{size:`sm`,variant:`outline`,disabled:v.status!==`ok`,onClick:()=>_(Ae(e,v.candidates),f),children:j(e)},e)),T.value.panels.map(t=>e(`span`,{className:`inline-flex items-center`,children:[n(H,{size:`sm`,variant:`secondary`,onClick:()=>_(t.selection,t.window,null),children:t.name}),n(H,{size:`sm`,variant:`ghost`,"aria-label":r(`history.page.deleteNamed`,`Delete panel {{name}}`,{name:t.name}),onClick:()=>void A(t.id,t.name),disabled:!T.writable,children:n(p,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})})]},t.id))]}),e(`div`,{className:`grid grid-cols-1 gap-3 sm:gap-4 xl:grid-cols-5`,children:[n(`div`,{className:`min-w-0 xl:col-span-2`,children:n(M,{headingId:`history-picker`,title:r(`history.picker.title`,`Series`),children:n(`div`,{className:`p-2 sm:p-3`,children:v.status===`error`?n(N,{message:v.error}):n(Ye,{catalog:v.candidates,loading:v.status===`pending`,selected:w,onChange:e=>{let t=c.filter(t=>e.has(x(t))),n=v.candidates.filter(t=>e.has(t.id)&&!w.has(t.id)).map(e=>e.ref);_([...t,...n],f)}})})})}),n(`div`,{className:`min-w-0 xl:col-span-3`,children:n(M,{headingId:`history-overlay`,title:r(`history.page.overlay`,`Overlay`),actions:c.length>0?n(H,{size:`sm`,variant:`ghost`,onClick:()=>_([],f),children:r(`history.page.clear`,`Clear`)}):void 0,children:e(`div`,{className:`p-2 sm:p-3 space-y-3 min-w-0`,children:[n(ve,{value:f,onChange:e=>_(c,e),custom:h,onCustomChange:e=>_(c,`custom`,xe(e))}),v.status===`pending`&&c.length>0?n(R,{className:`h-64 w-full`}):n(Ne,{part:C,window:b}),C.missing.length>0&&v.status===`ok`&&n(`p`,{className:`text-[11px] text-foreground-subtle`,children:r(`history.page.missing`,{count:C.missing.length,defaultValue_one:`{{count}} selected series is no longer recorded.`,defaultValue_other:`{{count}} selected series are no longer recorded.`})})]})})})]})]})})}function Qe(e){let{t:n}=W(),r=n(`history.picker.wholeFrame`,`Whole frame`),i=h().trpcClient,o=I({projection:`slim`},{enabled:e}),{nodes:s}=T(),c=t(()=>(o.data??[]).filter(e=>!Xe.has(String(e.type))),[o.data]),l=a({queries:c.map(t=>({queryKey:[`device-history`,`listSeries`,t.id],queryFn:()=>i.deviceHistory.listSeries.query({deviceId:t.id}),enabled:e,staleTime:$}))}),u=a({queries:s.map(t=>({queryKey:[`device-history`,`listNodeSeries`,t.id],queryFn:()=>i.deviceHistory.listNodeSeries.query({forNodeId:t.id}),enabled:e,staleTime:$}))}),d=b({},{enabled:e,staleTime:$}),f=t(()=>new Map((d?.data??[]).map(e=>[e.id,e.displayName])),[d?.data]),p=l.map(e=>e.data),m=u.map(e=>e.data),g=t(()=>Te(c.flatMap((e,t)=>{let n=p[t];return n===void 0?[]:[{device:{id:e.id,name:e.name,location:e.location??null},series:n}]}),s.flatMap((e,t)=>{let n=m[t];return n===void 0?[]:[{node:{id:e.id,name:e.name},series:n}]}),e=>{if(e.key!==`addon:pipeline-analytics/occupancy`)return f.get(e.scope)??e.scope;let{zoneId:t,className:n}=y(e.scope),i=t===``?r:t;return n===void 0?i:`${i} · ${n}`}),[c,s,f,[...l,...u].map(e=>e.dataUpdatedAt).join(`,`),r]);return o.status===`error`?{status:`error`,error:o.error.message,candidates:[]}:{status:o.status===`pending`||l.some(e=>e.isPending)||u.some(e=>e.isPending)?`pending`:`ok`,error:``,candidates:g}}export{Ze as HistoryPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{C as e,J as t,K as n,S as r,V as i,Y as a,a 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{Cr as u,D as d,Ft as f,Kt as p,Oi as m,Or as h,Pn as g,Qr as _,Sn as v,Un as y,Ut as b,Yn as x,_r as S,aa as C,br as w,bt as T,ct as E,gn as D,ht as O,ii as ee,ln as k,lt as te,ut as ne,vn as re,wn as A,yn as ie}from"./player-overlays-CDEJeChs.js";import{So as j,l as ae,xo as oe}from"./client-Dd2wRwgL.js";import{c as M,f as se,h as ce,r as N}from"./video-CbOJmRcC.js";import{t as le}from"./file-up-F0uKRM-I.js";import{t as ue}from"./key-BCxCEqdb.js";import{t as de}from"./monitor-smartphone-CHT4W6lM.js";import{t as fe}from"./unlink-C1AgH7gH.js";import{An as pe,Bd as me,Br as P,Dc as he,Ec as ge,Ei as F,Et as _e,Fr as I,Gd as ve,Hd as ye,Id as be,In as xe,Ir as L,Jr as R,Kd as z,Ld as Se,Ln as B,Mf as V,Mr as Ce,Pr as H,Pt as U,Rd as we,Rn as Te,Rr as Ee,Sc as De,Ud as Oe,Vd as ke,Wd as Ae,Wo as je,X as Me,Yr as Ne,_c as Pe,ar as Fe,cr as Ie,ef as Le,er as Re,ht as ze,if as Be,ir as Ve,jn as He,lr as Ue,nf as We,nr as Ge,or as Ke,qd as qe,rf as Je,rr as Ye,tf as Xe,vi as W,wt as Ze,yc as Qe,zd as $e,zn as et,zr as tt}from"./src-Bz_Mw4PZ.js";import{t as G}from"./i18n-_4l4T7tH.js";import{t as K}from"./useTranslation-BJr-n0es.js";import{Br as nt,I as rt,Ir as it,Rr as at,S as ot,a as st,d as ct,i as lt,l as ut,t as dt}from"./index-CKdLDmIt.js";import{t as ft}from"./AdminSectionedPage-BLcBNdcD.js";import{t as pt}from"./AdminPage-Dr63s4g1.js";import{C as mt,D as q,E as ht,O as J,S as gt,T as _t,_ as vt,a as yt,b as bt,c as xt,d as St,f as Ct,g as wt,h as Tt,i as Et,k as Dt,l as Ot,m as kt,n as At,o as jt,p as Mt,s as Nt,t as Pt,u as Ft,v as It,w as Lt,x as Rt,y as zt}from"./SessionsList-BDofSeHx.js";import{r as Bt}from"./IntegrationHub-0gxAZhI_.js";import{n as Vt}from"./Authentication-Cny_U-Ec.js";s();function Ht(){let{t:e}=K(),t=E(),i=V.useUtils(),o=Dt(),{data:s,isLoading:c}=ye(),l=n(()=>s??[],[s]),u=V.useQueries(e=>l.map(t=>e.userManagement.listExternalIdentities({userId:t.id}))),d=V.auth.listLoginMethods.useQuery(),[f,p]=a(null),m=z({onSuccess:()=>void i.userManagement.listExternalIdentities.invalidate(),onError:e=>p(`Remove failed: ${e.message}`)}),h=n(()=>new Map((d.data??[]).flatMap(e=>e.kind===`redirect`?[[e.id,e.label]]:[])),[d.data]),g=l.flatMap((e,t)=>u[t]?.data??[]),_=g.map(e=>({...Rt(e,o),kind:h.get(e.provider)??e.provider})),v=async n=>{let r=g.find(e=>bt(e)===n.id);r!==void 0&&await t({title:e(`access.externalIdentitiesSection.removeSignInLink`,`Remove sign-in link`),message:e(`access.externalIdentitiesSection.willNoLongerBeAble`,`"{{ownerName}}" will no longer be able to sign in with this {{kind}} account.`,{ownerName:n.ownerName,kind:n.kind}),confirmLabel:e(`common.remove`,`Remove`),variant:`danger`})&&(p(null),m.mutate({userId:r.userId,provider:r.provider,subject:r.subject}))};return r(q,{notice:J(f),onDismissNotice:()=>{p(null)},id:`external-identities`,title:e(`access.externalIdentitiesSection.signInLinks`,`Sign-in links`),icon:ce,description:e(`access.externalIdentitiesSection.externalAccountsSingleSignOn`,`External accounts (single sign-on) each user linked to their CamStack account. Only the owner can link one, from their profile; an admin can remove it.`),children:r(Lt,{rows:_,label:`sign-in links`,isLoading:c||u.some(e=>e.isLoading),loadError:u.find(e=>e.isError)?.error?.message??null,emptyText:`No user has linked a sign-in account.`,expiresNone:`—`,action:{label:e(`common.remove`,`Remove`),icon:fe,isAvailable:()=>!0,onRun:e=>void v(e),busyId:null,disabled:m.isPending}})})}s();var Ut={key:`access.nouns.linkedApp`};function Wt(e){if(e.type===`category`){let t=e.target??``;return t===`device`?G.t(`access.linkedAppsSection.allDevices`):G.t(`access.linkedAppsSection.allTarget`,{target:t})}if(e.type===`device`)return`device:[${(e.targets??[]).join(`,`)}]`;let t=e;return`${t.type}:${t.target??``}`}function Gt(){let{t:e}=K(),t=E(),i=c(),o=ke(),[s,l]=a(null),d=()=>void i.invalidateQueries({queryKey:[[`userManagement`,`listOauthSessions`]]}),f=Ae({onSuccess:d,onError:e=>l(`Revoke failed: ${e.message}`)}),m=_t(Ut,d),h=n(()=>(o.data??[]).map(e=>gt(e,e.scopes.map(Wt).join(`, `))),[o.data]),g=async n=>{await t({title:e(`access.linkedAppsSection.revokeTheLink`,`Revoke the "{{name}}" link?`,{name:n.name}),message:e(`access.linkedAppsSection.losesAccessForOnIts`,`{{name}} loses access for {{ownerName}} on its next call. Linking it again needs the account-link flow from the start.`,{name:n.name,ownerName:n.ownerName}),confirmLabel:e(`access.linkedAppsSection.revoke`,`Revoke`),variant:`danger`})&&(l(null),f.mutate({id:n.id}))},_=f.isPending?f.variables?.id??null:null;return r(q,{notice:J(s,m.outcome),onDismissNotice:()=>{l(null),m.dismiss()},id:`linked-apps`,title:e(`access.linkedAppsSection.linkedApps`,`Linked apps`),icon:u,description:e(`access.linkedAppsSection.externalIntegrationsAlexaLinkedTo`,`External integrations (Alexa, …) linked to this hub through OAuth. Revoking one stops that integration on its next call. Already-revoked rows can be selected and removed from the list.`),children:r(Lt,{rows:h,label:e(`access.linkedAppsSection.linkedApps2`,`linked apps`),isLoading:o.isLoading,loadError:o.isError?o.error?.message??`Request failed`:null,emptyText:`No linked apps — an integration appears here once it completes the account-link flow.`,expiresNone:`—`,action:{label:e(`access.linkedAppsSection.revoke`,`Revoke`),icon:p,isAvailable:e=>e.status===`active`||e.status===`revoked`,onRun:e=>void g(e),busyId:_,disabled:f.isPending||m.busy},bulk:{revoke:m,noun:Ut,isSelectable:e=>e.status===`active`||e.status===`revoked`,quickSelect:[{label:e(`access.linkedAppsSection.selectRevoked`,`Select revoked`),match:e=>e.status===`revoked`}]}})})}var Kt=5e3;function qt(){let{t}=K(),n=V.useUtils(),i=V.auth.cliLoginPending.useQuery(void 0,{refetchInterval:Kt}),a=V.auth.cliLoginDeny.useMutation({onSuccess:()=>void n.auth.cliLoginPending.invalidate()}),o=i.data??[];if(o.length===0)return null;let s=Date.now();return e(`div`,{className:`space-y-2 rounded-md border border-border bg-background-elevated p-3`,"data-testid":`pending-terminal-signins`,children:[e(`div`,{className:`flex items-center gap-2 text-xs font-medium text-foreground`,children:[r(N,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),t(`cliLogin.pendingTitle`,`Pending terminal sign-ins`)]}),r(`ul`,{className:`space-y-1`,children:o.map(n=>{let i=dt(n.createdAt,s);return e(`li`,{className:`flex items-center justify-between gap-3 text-xs`,children:[e(`span`,{className:`min-w-0 truncate text-foreground-muted`,children:[n.userAgent??t(`cliLogin.unknownValue`,`Unknown`),` · `,n.ip??t(`cliLogin.unknownValue`,`Unknown`),` · `,i.key===`justNow`?t(`cliLogin.ageNow`,`just now`):i.key===`seconds`?t(`cliLogin.ageSeconds`,`{{count}} s ago`,{count:i.value}):t(`cliLogin.ageMinutes`,`{{count}} min ago`,{count:i.value})]}),r(W,{type:`button`,size:`sm`,variant:`ghost`,disabled:a.isPending,onClick:()=>a.mutate({requestId:n.requestId}),children:t(`cliLogin.notMe`,`Not me`)})]},n.requestId)})}),r(`p`,{className:`text-[11px] text-foreground-subtle`,children:t(`cliLogin.pendingHint`,`To approve one, open the approval page and type the code the terminal shows.`)})]})}s();var Jt={key:`access.nouns.session`};function Yt(){let{t}=K(),i=E(),o=V.useUtils(),s=Dt(),c=V.auth.listSessions.useQuery(),[l,u]=a(null),d=()=>void o.auth.listSessions.invalidate(),f=V.auth.revokeSessions.useMutation({onSuccess:d,onError:e=>u(`Sign out failed: ${e.message}`)}),p=_t(Jt,d),m=n(()=>(c.data??[]).map(e=>mt(e,s,{client:e=>vt(e).label,method:It})),[c.data,s]),h=async e=>{await i({title:t(`access.loginSessionsSection.signOutThisSession`,`Sign out this session`),message:t(`access.loginSessionsSection.onWillHaveToSign`,`{{ownerName}} on {{name}} will have to sign in again.`,{ownerName:e.ownerName,name:e.name}),confirmLabel:t(`access.loginSessionsSection.signOut`,`Sign out`),variant:`danger`})&&(u(null),f.mutate({id:e.id}))};return e(q,{notice:J(l,p.outcome),onDismissNotice:()=>{u(null),p.dismiss()},id:`login-sessions`,title:t(`access.loginSessionsSection.loginSessions`,`Login sessions`),icon:de,description:t(`access.loginSessionsSection.everyBrowserAndAppSigned`,`Every browser and app signed in to this hub, for every user. Signing one out ends it at once; it has to sign in again. Your own current session is marked and never included in a bulk sign-out.`),children:[r(qt,{}),r(Lt,{rows:m,label:t(`common.sessionsLabel`),isLoading:c.isLoading,loadError:c.isError?c.error?.message??`Request failed`:null,emptyText:`No active sessions.`,action:{label:t(`access.loginSessionsSection.signOut`,`Sign out`),icon:M,isAvailable:e=>e.status===`active`,onRun:e=>void h(e),busyId:f.isPending&&f.variables!==void 0&&`id`in f.variables?f.variables.id:null,disabled:f.isPending||p.busy},bulk:{revoke:p,noun:Jt,isSelectable:e=>e.status===`active`}})]})}var Xt={"by-id":`helpers.authAuditWording.bulkNoun.credential`,"share-link":`helpers.authAuditWording.bulkNoun.shareLink`,"admin-token":`helpers.authAuditWording.bulkNoun.adminToken`,"login-session":`helpers.authAuditWording.bulkNoun.loginSession`};function Y(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:null}function X(e,t){let n=Y(e,`tokenId`);return Y(e,`name`)??(n===null?void 0:t.get(n))??n??`?`}function Z(e){return e.filter(e=>e!==null)}function Zt(e){let t=Y(e,`prefix`);return t===null?null:G.t(`helpers.authAuditWording.prefix`,{prefix:t})}function Qt(e,t){let n=e.detail??{};switch(e.action){case`admin-token-created`:{let e=n.expiresAt;return{title:G.t(`helpers.authAuditWording.tokenCreated`,{name:X(n,t)}),details:Z([Zt(n),typeof e==`number`?G.t(`helpers.authAuditWording.expires`,{at:zt(e)}):null])}}case`admin-token-used`:{let e=Y(n,`path`);return{title:G.t(`helpers.authAuditWording.tokenUsed`,{name:X(n,t)}),details:Z([Zt(n),e===null?null:G.t(`helpers.authAuditWording.call`,{path:e})])}}case`token-minted`:{let e=n.expiresAt;return{title:G.t(`helpers.authAuditWording.tokenMinted`,{name:X(n,t)}),details:Z([typeof e==`number`?G.t(`helpers.authAuditWording.expires`,{at:zt(e)}):null])}}case`token-revoked`:return{title:G.t(`helpers.authAuditWording.anyTokenRevoked`,{name:X(n,t)}),details:[]};case`admin-token-revoked`:return{title:G.t(`helpers.authAuditWording.tokenRevoked`,{name:X(n,t)}),details:Z([Zt(n)])};case`credentials-revoked`:{let e=Y(n,`kind`)??`credential`,t=n.revoked,r=n.skipped,i=Xt[e],a=i===void 0?`${e}s`:G.t(i);return{title:G.t(`helpers.authAuditWording.bulkRevoked`,{n:typeof t==`number`?String(t):`?`,noun:a}),details:Z([typeof r==`number`&&r>0?G.t(`helpers.authAuditWording.skipped`,{count:r}):null,Y(n,`ids`)===null?null:G.t(`helpers.authAuditWording.ids`,{ids:Y(n,`ids`)??``})])}}case`second-factor-skipped`:{let e=Y(n,`method`),t=Y(n,`factors`);return{title:G.t(`helpers.authAuditWording.secondFactorSkipped`),details:Z([e===null?null:G.t(`helpers.authAuditWording.signedInWith`,{method:It(e)}),t===null?null:G.t(`helpers.authAuditWording.skippedFactors`,{factors:t.split(`,`).join(`, `)})])}}default:return{title:e.action,details:Object.entries(n).map(([e,t])=>`${e}: ${String(t)}`)}}}s();var $t=100;function en(){let{user:e}=rt();return e?.isAdmin?r(nn,{}):null}function tn(){let{data:e}=ye(),{data:t}=V.auth.listTokens.useQuery(void 0);return n(()=>{let n=new Map;for(let t of e??[])n.set(t.id,t.username);let r=new Map;for(let e of t??[])r.set(e.id,e.label);return{userNameById:n,tokenNameById:r}},[e,t])}function nn(){let{t}=K(),n=V.auth.listAuthAudit.useQuery({limit:$t}),{userNameById:i,tokenNameById:a}=tn(),o=n.data??[];return e(`div`,{"data-testid":`auth-audit`,className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[e(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[r(A,{className:`h-3.5 w-3.5 text-foreground-subtle`}),r(`div`,{className:`text-xs font-semibold text-foreground`,children:t(`auth.authAuditSection.authenticationAudit`,`Authentication audit`)}),r(`span`,{className:`ml-auto text-[10px] text-foreground-subtle`,children:t(`auth.authAuditSection.latest`,{count:$t})})]}),r(`div`,{className:`p-4`,children:n.isLoading?e(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[r(w,{className:`h-3.5 w-3.5 animate-spin`}),t(`auth.authAuditSection.loadingAuditTrail`,`Loading audit trail…`)]}):n.isError?e(`div`,{className:`text-[11px] text-danger`,children:[t(`auth.authAuditSection.couldNotLoadTheAudit`,`Could not load the audit trail:`),` `,n.error?.message??t(`auth.authAuditSection.requestFailed`,`Request failed`)]}):o.length===0?e(`div`,{className:`rounded border border-dashed border-border px-3 py-4 text-xs text-foreground-subtle text-center space-y-1`,children:[r(`div`,{children:t(`auth.authAuditSection.noAuthenticationEventsRecordedYet`,`No authentication events recorded yet.`)}),r(`div`,{className:`text-[11px] text-foreground-subtle/90`,children:t(`auth.authAuditSection.thisTrailRecordsAdminToken`,`This trail records admin-token create/use/revoke, trusted-network 2FA skips, and credential revokes (including single share-link revoke). Browser password logins are not listed here.`)})]}):r(`ul`,{className:`divide-y divide-border rounded-md border border-border max-h-[420px] overflow-y-auto`,children:o.map(e=>r(rn,{record:e,userName:e.userId===void 0?null:i.get(e.userId)??e.userId,tokenNameById:a},e.id))})})]})}function rn({record:t,userName:n,tokenNameById:i}){let a=Qt(t,i);return e(`li`,{"data-testid":`auth-audit-row`,className:`px-3 py-2 text-xs space-y-0.5`,children:[e(`div`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[r(`span`,{className:`font-medium text-foreground`,children:a.title}),r(`span`,{className:`ml-auto text-[10px] text-foreground-subtle`,children:zt(t.at)})]}),e(`div`,{className:`flex flex-wrap gap-x-3 text-[11px] text-foreground-subtle`,children:[n!==null&&r(`span`,{className:`text-foreground`,children:n}),t.ip!==void 0&&r(`span`,{className:`font-mono`,children:t.ip}),a.details.map(e=>r(`span`,{className:`font-mono`,children:e},e))]})]})}s();var Q={loginSessions:`login-sessions`,linkedApps:`linked-apps`,tokens:`tokens`,scopedTokens:`scoped-tokens`,adminTokens:`admin-tokens`,shareLinks:`share-links`,externalIdentities:`external-identities`,audit:`auth-audit`},an={[Q.scopedTokens]:Q.tokens,[Q.adminTokens]:Q.tokens,[Q.shareLinks]:Q.tokens};function on(){return[{id:Q.loginSessions,label:G.t(`system.access.loginSessions`,`Login sessions`),icon:de,render:()=>r(Yt,{})},{id:Q.linkedApps,label:G.t(`system.access.linkedApps`,`Linked apps`),icon:u,render:()=>r(Gt,{})},{id:Q.tokens,label:G.t(`system.access.tokens`,`Tokens`),icon:se,render:({createRequested:e,onCreateConsumed:t})=>r(Tt,{headerOwnsCreate:!0,createRequested:e,onCreateConsumed:t})},{id:Q.externalIdentities,label:G.t(`system.access.signInLinks`,`Sign-in links`),icon:ce,render:()=>r(Ht,{})},{id:Q.audit,label:G.t(`system.access.audit`,`Audit`),icon:A,render:()=>r(en,{})}]}function sn({createRequested:t=!1,onCreateConsumed:i}){let{t:a}=K(),o=n(()=>on(),[]),s=Bt({ids:n(()=>o.map(e=>e.id),[o]),answered:!0}),c=at(),[l]=nt(),u=l.get(`integration`),d=u===null?void 0:an[u];if(d!==void 0){let e=new URLSearchParams(l);return e.set(`integration`,d),r(it,{to:`?${e.toString()}`,replace:!0})}let f=o.find(e=>e.id===s.selectedId)??o[0];return e(`div`,{className:`flex flex-col gap-3`,"data-testid":`access-page`,children:[r(Re,{appearance:`pills`,value:f?.id??Q.loginSessions,onValueChange:e=>{c(`?${ct(l,e,null,null).toString()}`)},children:r(Ge,{"aria-label":a(`system.access.credentialKinds`,`Credential kinds`),children:o.map(t=>e(Ye,{value:t.id,"data-testid":`access-kind-${t.id}`,children:[r(t.icon,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),t.label]},t.id))})}),f===void 0?null:r(`div`,{role:`region`,"aria-label":f.label,"data-testid":`access-kind-body`,children:f.render({createRequested:t&&f.id===Q.tokens,onCreateConsumed:i??(()=>void 0)})},f.id)]})}function cn(t,n){if(t===Q.tokens)return e(W,{size:`sm`,type:`button`,"data-testid":`access-new-token`,onClick:n,children:[r(se,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),G.t(`system.access.newToken`,`New token`)]})}function ln(){let[e,t]=a(!1);return{createRequested:e,requestCreate:()=>t(!0),clearCreate:()=>t(!1)}}function un({isPending:t,error:n,what:i,onRetry:a,children:o}){let{t:s}=K();return t?e(`div`,{className:`flex items-center gap-2 py-3 text-xs text-foreground-subtle`,role:`status`,"data-testid":`query-pending`,children:[r(w,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":!0}),s(`certificates.queryBody.reading`,{what:i})]}):n===null?o:r(R,{title:s(`certificates.queryBody.couldNotRead`,`Could not read {{what}}`,{what:i}),message:n.message.length>0?n.message:s(`certificates.queryBody.requestFailed`,`Request failed`),onRetry:a})}function dn(){let{t}=K(),n=V.deviceCredentials.getDeviceCaStatus.useQuery({}),i=n.data;return r(q,{id:`device-ca`,title:t(`certificates.deviceCaCard.deviceCertificateAuthority`,`Device certificate authority`),icon:re,description:t(`certificates.deviceCaCard.signsTheCertificateEachPaired`,`Signs the certificate each paired device holds. It is created the first time a device is paired.`),children:r(un,{isPending:n.isPending,error:n.error,what:`the device CA`,onRetry:()=>void n.refetch(),children:i!==void 0&&e(`div`,{className:`space-y-1`,"data-testid":`device-ca-status`,children:[e(B,{label:t(`certificates.deviceCaCard.state`,`State`),children:[i.state===`ready`&&r(F,{variant:`success`,children:t(`certificates.deviceCaCard.ready`,`Ready`)}),i.state===`absent`&&r(F,{variant:`default`,children:t(`certificates.deviceCaCard.notCreatedYet`,`Not created yet`)}),i.state===`unavailable`&&r(F,{variant:`danger`,children:t(`certificates.deviceCaCard.unavailable`,`Unavailable`)})]}),i.state===`ready`&&e(l,{children:[r(B,{label:t(`certificates.deviceCaCard.subject`,`Subject`),valueClassName:`font-mono`,children:i.subject}),r(B,{label:t(`certificates.deviceCaCard.fingerprintSha256`,`Fingerprint (SHA-256)`),valueClassName:`font-mono`,children:i.fingerprintSha256}),r(B,{label:t(`certificates.deviceCaCard.validUntil`,`Valid until`),children:i.validTo})]}),i.state===`unavailable`&&r(B,{label:t(`certificates.deviceCaCard.reason`,`Reason`),children:r(`span`,{className:`text-danger`,children:i.reason})})]})})})}s();function fn(){let{t}=K(),n=V.useUtils(),i=V.deviceCredentials.getDeviceCertificateSettings.useQuery({}),[o,s]=a(null),c=V.deviceCredentials.setDeviceCertificateSettings.useMutation({onSuccess:()=>{s(null),n.deviceCredentials.getDeviceCertificateSettings.invalidate()},onError:e=>s(`Could not save: ${e.message}`)});return r(un,{isPending:i.isPending,error:i.error,what:`the enrollment setting`,onRetry:()=>void i.refetch(),children:i.data!==void 0&&e(B,{label:t(`certificates.deviceSettingsRow.usersCanEnrollTheirOwn`,`Users can enroll their own devices`),actions:r(Ve,{checked:i.data.selfEnrollment===`allowed`,disabled:c.isPending,"aria-label":t(`certificates.deviceSettingsRow.usersCanEnrollTheirOwn`,`Users can enroll their own devices`),onCheckedChange:e=>c.mutate({selfEnrollment:e?`allowed`:`disabled`})}),children:[r(`span`,{className:`text-[11px] text-foreground-subtle`,children:i.data.selfEnrollment===`allowed`?t(`certificates.deviceSettingsRow.allowedAUserSignedIn`,`Allowed - a user signed in on a phone can keep it signed in. Pairing by QR works either way.`):t(`certificates.deviceSettingsRow.disabledOnlyAnAdminCan`,`Disabled - only an admin can pair a device, with a QR code.`)}),o!==null&&r(`span`,{className:`block text-[11px] text-danger`,children:o})]})})}s();function pn(e){let[t,n]=a(()=>Date.now());return i(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}s();var mn=80,hn=208;function gn({open:t,users:n,onClose:i,onPaired:o}){let{t:s}=K(),c=V.deviceCredentials.startEnrollment.useMutation({onSuccess:o}),[l,u]=a(``),[d,f]=a(``),p=l===``?n[0]?.id??``:l,m=c.data,h=()=>{c.reset(),f(``),i()};return r(_e,{open:t,onClose:h,title:s(`certificates.pairDeviceDialog.pairADevice`,`Pair a device`),icon:k,width:`md`,testId:`pair-device-dialog`,error:c.isError?c.error.message:null,footer:m===void 0?e(W,{type:`button`,onClick:()=>{let e=d.trim();p===``||e===``||c.mutate({userId:p,deviceName:e})},disabled:c.isPending||p===``||d.trim()===``,children:[c.isPending&&r(w,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":!0}),s(`certificates.pairDeviceDialog.createPairingCode`,`Create pairing code`)]}):r(W,{type:`button`,variant:`outline`,onClick:h,children:s(`certificates.pairDeviceDialog.done`,`Done`)}),children:m===void 0?e(`div`,{className:`space-y-3`,children:[r(`p`,{className:`text-[11px] text-foreground-subtle`,children:s(`certificates.pairDeviceDialog.createsAOneTimeCode`,`Creates a one-time code for a phone you hold. Scan it with the CamStack app on that phone; the phone then stays signed in as the chosen user until you revoke it.`)}),r(U,{label:s(`certificates.pairDeviceDialog.user`,`User`),required:!0,children:r(ne,{value:p,onChange:e=>u(e.target.value),options:n.map(e=>({value:e.id,label:e.username}))})}),r(U,{label:s(`certificates.pairDeviceDialog.deviceName`,`Device name`),required:!0,description:s(`certificates.pairDeviceDialog.howThisPhoneIsListed`,`How this phone is listed, e.g. Anna's iPhone.`),children:r(Be,{value:d,maxLength:mn,onChange:e=>f(e.target.value),placeholder:s(`certificates.pairDeviceDialog.annaSIphone`,`Anna's iPhone`),autoFocus:!0})})]}):r(_n,{enrollUrl:m.enrollUrl,expiresAt:m.expiresAt,hubKnown:m.hubOrigin!==null,onRestart:()=>c.reset()})})}function _n({enrollUrl:t,expiresAt:n,hubKnown:i,onRestart:a}){let{t:o}=K(),s=jt(n,pn(1e3));return r(`div`,{className:`space-y-3`,"data-testid":`pair-issued`,children:e(`div`,{className:`flex flex-col items-center gap-3 sm:flex-row sm:items-start`,children:[r(`div`,{className:s.expired?`opacity-30`:void 0,children:r(Ce,{value:t,size:hn,alt:o(`certificates.pairDeviceDialog.enrollmentQrCode`,`Enrollment QR code`)})}),e(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[r(`p`,{className:`text-[11px] text-foreground-subtle`,children:o(`certificates.pairDeviceDialog.openTheCamstackAppOn`,`Open the CamStack app on the phone and scan this code. It works once.`)}),r(`div`,{className:`text-sm font-semibold tabular-nums text-foreground`,role:`timer`,"data-testid":`pair-countdown`,children:s.expired?o(`certificates.pairDeviceDialog.expiredCreateANewCode`,`Expired - create a new code`):o(`certificates.pairDeviceDialog.expiresIn`,`Expires in {{label}}`,{label:s.label})}),e(`div`,{className:`flex items-center gap-1 rounded-md border border-border bg-background px-2 py-1`,children:[r(`code`,{className:`min-w-0 flex-1 select-all break-all font-mono text-[11px] text-foreground`,children:t}),r(pe,{value:t,srLabel:`Enrollment link`})]}),!i&&e(`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:[r(b,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-warning`,"aria-hidden":!0}),r(`span`,{children:o(`certificates.pairDeviceDialog.theHubCouldNotName`,`The hub could not name an address for this link, so the app must already know it.`)})]}),s.expired&&r(W,{type:`button`,variant:`outline`,size:`sm`,onClick:a,children:o(`certificates.pairDeviceDialog.newCode`,`New code`)})]})]})})}s();var vn={key:`access.nouns.device`};function yn({pairOpen:t,onPairClose:i}){let{t:o}=K(),s=E(),c=te(),l=V.useUtils(),u=V.deviceCredentials.listDeviceCredentials.useQuery({includeRevoked:!0}),d=ye(),[f,m]=a(null),[h,g]=a(null),_=()=>void l.deviceCredentials.listDeviceCredentials.invalidate(),v=e=>t=>{g(null),m(`${e} failed: ${t.message}`)},y=()=>{g(null),_()},b=V.deviceCredentials.revokeDeviceCredential.useMutation({onSuccess:y,onError:v(`Revoke`)}),S=V.deviceCredentials.deleteDeviceCredential.useMutation({onSuccess:e=>{e.result!==`deleted`&&m(e.result===`live`?`Only a revoked device can be deleted: revoke it first.`:`That device no longer exists.`),y()},onError:v(`Delete`)}),w=V.deviceCredentials.renameDeviceCredential.useMutation({onSuccess:y,onError:v(`Rename`)}),T=ht(vn,e=>b.mutateAsync({id:e}),_),D=T.busy||h!==null,O=n(()=>(u.data??[]).map(At),[u.data]),ee=async e=>{await s({title:o(`certificates.devicesCard.revoke`,`Revoke "{{name}}"?`,{name:e.name}),message:o(`certificates.devicesCard.sDeviceStopsSigningIn`,`{{ownerName}}'s device stops signing in at once and its open sessions end. To use it again it has to be paired anew. This cannot be undone.`,{ownerName:e.ownerName}),confirmLabel:o(`certificates.devicesCard.revoke2`,`Revoke`),variant:`danger`})&&(m(null),g(e.id),b.mutate({id:e.id}))},ne=async e=>{await s({title:o(`certificates.devicesCard.delete`,`Delete "{{name}}"?`,{name:e.name}),message:o(`certificates.devicesCard.isRemovedFromTheList`,`{{name}} is removed from the list. The audit trail keeps the revocation.`,{name:e.name}),confirmLabel:o(`common.delete`,`Delete`),variant:`danger`})&&(m(null),g(e.id),S.mutate({id:e.id}))},re=async e=>{let t=(await c({title:o(`certificates.devicesCard.renameDevice`,`Rename device`),label:o(`certificates.devicesCard.deviceName`,`Device name`),defaultValue:e.name,confirmLabel:o(`certificates.devicesCard.rename`,`Rename`)}))?.trim()??``;t===``||t===e.name||(m(null),g(e.id),w.mutate({id:e.id,deviceName:t}))},A={label:o(`certificates.devicesCard.revoke2`,`Revoke`),icon:C,isAvailable:yt,onRun:e=>void ee(e),busyId:b.isPending?h:null,disabled:D},ie=[{label:o(`certificates.devicesCard.rename`,`Rename`),icon:x,tone:`neutral`,isAvailable:()=>!0,onRun:e=>void re(e),busyId:w.isPending?h:null,disabled:D},{label:o(`common.delete`,`Delete`),icon:p,isAvailable:Et,onRun:e=>void ne(e),busyId:S.isPending?h:null,disabled:D}];return e(q,{id:`devices`,title:o(`certificates.devicesCard.devices`,`Devices`),icon:k,description:o(`certificates.devicesCard.phonesThatStaySignedIn`,`Phones that stay signed in with a certificate instead of a login. Revoking one signs it out at once; it has to be paired again.`),notice:J(f,T.outcome),onDismissNotice:()=>{m(null),T.dismiss()},children:[r(fn,{}),r(Lt,{rows:O,label:o(`certificates.devicesCard.label`),isLoading:u.isPending,loadError:u.error===null?null:u.error.message||`Request failed`,emptyText:`No devices paired yet.`,expiresNone:`—`,action:A,extraActions:ie,bulk:{revoke:T,noun:vn,isSelectable:yt}}),r(gn,{open:t,users:d.data??[],onClose:i,onPaired:_})]})}var bn=/-----BEGIN CERTIFICATE-----[\s\S]+?-----END CERTIFICATE-----/,xn=/-----BEGIN ((?:RSA |EC |ENCRYPTED )?PRIVATE KEY)-----[\s\S]+?-----END \1-----/,Sn={certificate:`.pem,.crt,.cer`,privateKey:`.pem,.key`,ca:`.pem,.crt,.cer`};function Cn(e,t){if(t.trim()===``)return null;if(e===`privateKey`){let e=xn.exec(t);return e===null?bn.test(t)?G.t(`helpers.pemFile.isCert`):G.t(`helpers.pemFile.notKey`):e[1]===`ENCRYPTED PRIVATE KEY`?G.t(`helpers.pemFile.encrypted`):null}return bn.test(t)?e===`certificate`&&xn.test(t)?G.t(`helpers.pemFile.certHasKey`):null:xn.test(t)?G.t(`helpers.pemFile.isKey`):G.t(`helpers.pemFile.notCert`)}function wn(e){return e.text()}s();function Tn({kind:n,label:i,value:o,onChange:s,rows:c=6}){let{t:l}=K(),u=t(null),[d,f]=a(null),[p,m]=a(null),h=p??Cn(n,o),g=`pem-${n}`,_=async e=>{let t=e.target.files?.[0];if(e.target.value=``,t!==void 0){f(t.name);try{let e=await wn(t);m(null),s(e)}catch(e){m(`Could not read ${t.name}: ${e instanceof Error?e.message:String(e)}`)}}};return e(`div`,{className:`space-y-1`,children:[e(`div`,{className:`flex items-center justify-between gap-2`,children:[r(`label`,{htmlFor:g,className:`text-[11px] text-foreground-subtle`,children:i}),e(`div`,{className:`flex min-w-0 items-center gap-2`,children:[d!==null&&r(`span`,{className:`truncate font-mono text-[10px] text-foreground-subtle`,"data-testid":`${g}-file-name`,children:d}),r(Fe,{ref:u,accept:Sn[n],onChange:e=>void _(e),className:`hidden`,"data-testid":`${g}-file`}),e(W,{size:`sm`,variant:`outline`,type:`button`,onClick:()=>u.current?.click(),children:[r(le,{className:`mr-1 h-3 w-3`}),l(`system.pemField.chooseFile`,`Choose file`)]})]})]}),r(Ie,{id:g,value:o,onChange:e=>{f(null),m(null),s(e.target.value)},rows:c,"aria-invalid":h!==null,className:`w-full rounded border border-border bg-surface px-2 py-1 font-mono text-[11px]`}),h!==null&&r(`p`,{className:`text-[11px] text-danger`,role:`alert`,children:h})]})}s();var En=30;function Dn(e){let t=Date.parse(e);return!Number.isNaN(t)&&Date.now()-t<En*864e5}function On(e){if(e===null||e===``)return`—`;let t=e.replace(/:/g,``);return t.length<=16?e:`${t.slice(0,8)}…${t.slice(-8)}`}function kn(){let{t}=K(),n=c(),i=Pe(void 0,{refetchInterval:15e3}),o=Qe({onSuccess:()=>void n.invalidateQueries({queryKey:[[`localNetwork`]]})}),s=De({onSuccess:()=>void n.invalidateQueries({queryKey:[[`localNetwork`]]})}),l=he({onSuccess:()=>void n.invalidateQueries({queryKey:[[`localNetwork`]]})}),u=ge({onSuccess:()=>{m(!1),g(``),v(``),b(``),n.invalidateQueries({queryKey:[[`localNetwork`]]})}}),f=i.data,[p,m]=a(!1),[h,g]=a(``),[_,v]=a(``),[y,b]=a(``),x=()=>{if(!f?.caCertPem)return;let e=new Blob([f.caCertPem],{type:`application/x-pem-file`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`camstack-ca.crt`,n.click(),URL.revokeObjectURL(t)},S=f?.mode===`uploaded`?`Uploaded`:f?.mode===`generated`?`Generated local CA`:`TLS disabled`;return r(xe,{headingId:`local-access-certificate`,title:t(`system.localAccess.certificate`,`Certificate`),icon:D,children:e(`div`,{className:`${d} space-y-3`,children:[i.isError&&r(`p`,{className:`text-xs text-danger`,children:t(`system.localAccess.couldNotReadTlsStatus`,`Could not read TLS status.`)}),f?.reissueError&&r(R,{variant:`warning`,title:t(`system.localAccess.certificateReissue`,`Certificate reissue`),message:f.reissueError}),f?.restartRequired&&r(R,{variant:`warning`,title:t(`system.localAccess.restartRequired`,`Restart required`),message:t(`system.localAccess.theHttpsListenerStillServes`,`The HTTPS listener still serves the previous certificate. Restart the hub to apply it.`)}),f?.caMissing===!0&&r(R,{variant:`warning`,title:t(`system.localAccess.caMissingTitle`,`CA missing - devices cannot trust this hub`),message:t(`system.localAccess.caMissingBody`,"The uploaded certificate was not issued by a public CA and no CA was stored with it, so Download CA has nothing to hand out. Upload the certificate again together with its CA (for mkcert, the rootCA.pem in the folder `mkcert -CAROOT` prints).")}),f?.caReplacedAt!=null&&Dn(f.caReplacedAt)&&r(R,{variant:`warning`,title:t(`system.localAccess.caReplacedTitle`,`The local CA was replaced - re-install it on your devices`),message:t(`system.localAccess.caReplacedBody`,`The previous local CA had no name constraints: if its key ever leaked it could vouch for any website. The hub now uses a CA limited to private addresses and local names. Download it again and trust it on every phone and computer that used the old one (replaced {{when}}).`,{when:new Date(f.caReplacedAt).toLocaleString()})}),e(`dl`,{className:`grid grid-cols-1 gap-2 text-xs sm:grid-cols-2`,children:[e(`div`,{children:[r(`dt`,{className:`text-foreground-subtle`,children:t(`system.localAccess.mode`,`Mode`)}),r(`dd`,{className:`font-medium`,children:S})]}),e(`div`,{children:[r(`dt`,{className:`text-foreground-subtle`,children:t(`system.localAccess.validTo`,`Valid to`)}),r(`dd`,{className:`font-mono`,children:f?.validTo?new Date(f.validTo).toLocaleString():`—`})]}),e(`div`,{children:[r(`dt`,{className:`text-foreground-subtle`,children:t(`system.localAccess.leafSha256`,`Leaf SHA-256`)}),r(`dd`,{className:`font-mono`,title:f?.leafFingerprintSha256??void 0,children:On(f?.leafFingerprintSha256??null)})]}),f?.storedUpload!=null&&e(`div`,{children:[r(`dt`,{className:`text-foreground-subtle`,children:t(`system.localAccess.storedUpload`,`Stored upload`)}),r(`dd`,{className:`font-medium`,children:t(`system.localAccess.storedUploadValue`,`valid to {{validTo}}, {{ca}}`,{validTo:new Date(f.storedUpload.validTo).toLocaleDateString(),ca:f.storedUpload.hasCa?t(`system.localAccess.storedUploadWithCa`,`with its CA`):t(`system.localAccess.storedUploadNoCa`,`no CA`)})})]}),e(`div`,{children:[r(`dt`,{className:`text-foreground-subtle`,children:t(`system.localAccess.caSha256`,`CA SHA-256`)}),r(`dd`,{className:`font-mono`,title:f?.caFingerprintSha256??void 0,children:f?.mode===`uploaded`&&f.caFingerprintSha256===null?r(`span`,{className:`font-sans text-foreground-subtle`,children:t(`system.localAccess.issuerNotIncludedInThe`,`Issuer not included in the upload (not the local CA)`)}):On(f?.caFingerprintSha256??null)})]})]}),f&&f.sans.length>0&&r(`div`,{className:`flex flex-wrap gap-1`,children:f.sans.map(e=>r(`span`,{className:`rounded border border-border bg-surface px-1.5 py-0.5 font-mono text-[10px] text-foreground-subtle`,children:e},e))}),e(`div`,{className:`flex flex-wrap gap-2`,children:[r(He,{label:t(`system.localAccess.regenerate`,`Regenerate`),title:t(`system.localAccess.issueANewLeaf`,`Issue a new leaf?`),description:t(`system.localAccess.issuesANewLeafUnder`,`Issues a new leaf under the current local CA. Clients that trust the CA keep working. The HTTPS listener reloads.`),confirmLabel:t(`system.localAccess.regenerate`,`Regenerate`),disabled:f?.mode===`uploaded`||o.isPending,action:()=>o.mutateAsync({})}),r(W,{size:`sm`,variant:`outline`,onClick:()=>m(e=>!e),children:t(`system.localAccess.upload`,`Upload`)}),f?.caCertPem&&r(W,{size:`sm`,variant:`outline`,onClick:x,children:t(`system.localAccess.downloadCa`,`Download CA`)}),f?.mode===`uploaded`&&r(He,{label:t(`system.localAccess.revertToGenerated`,`Revert to generated`),title:t(`system.localAccess.revertTitle`,`Switch back to the generated certificate?`),description:t(`system.localAccess.keepsTheUploadedPair`,`Returns to the generated local CA. The uploaded certificate and its CA stay stored here; you can select them again.`),confirmLabel:t(`system.localAccess.revert`,`Revert`),disabled:s.isPending,action:()=>s.mutateAsync({})}),f?.mode===`generated`&&f.storedUpload!=null&&r(He,{label:t(`system.localAccess.useUploaded`,`Use uploaded certificate`),title:t(`system.localAccess.useUploadedTitle`,`Serve the stored upload again?`),description:t(`system.localAccess.useUploadedDescription`,`The stored uploaded certificate replaces the generated one on the HTTPS listener. The generated certificate stays stored.`),confirmLabel:t(`system.localAccess.useUploaded`,`Use uploaded certificate`),disabled:l.isPending,action:()=>l.mutateAsync(void 0)})]}),p&&e(`div`,{className:`space-y-2 border-t border-border pt-3`,children:[r(Tn,{kind:`certificate`,label:t(`system.localAccess.certificateOrFullChainPem`,`Certificate or full chain (PEM)`),value:h,onChange:g}),r(Tn,{kind:`privateKey`,label:t(`system.localAccess.privateKeyPem`,`Private key (PEM)`),value:_,onChange:v}),r(Tn,{kind:`ca`,label:t(`system.localAccess.caPemRequired`,`CA (PEM) - required unless the certificate comes from a public CA`),value:y,onChange:b,rows:4}),r(W,{size:`sm`,disabled:!h.trim()||!_.trim()||Cn(`certificate`,h)!==null||Cn(`privateKey`,_)!==null||Cn(`ca`,y)!==null||u.isPending,onClick:()=>u.mutate({certPem:h,keyPem:_,...y.trim()?{caPem:y}:{}}),children:t(`system.localAccess.saveCertificate`,`Save certificate`)}),u.isError&&r(`p`,{className:`text-xs text-danger`,children:u.error instanceof Error?u.error.message:t(`system.localAccess.uploadFailed`,`Upload failed`)})]})]})})}var An={ok:`text-foreground-subtle`,soon:`text-warning`,expired:`text-danger`,unknown:`text-foreground-subtle`};function jn(e){let t=e.find(e=>e.isHub);return t?.https.kind===`served`?t.https.status.caFingerprintSha256:null}function Mn({https:t,mesh:n,now:i}){let{t:a}=K(),o=Pe().data?.caCertPem??``,s=()=>{if(o===``)return;let e=URL.createObjectURL(new Blob([o],{type:`application/x-pem-file`})),t=document.createElement(`a`);t.href=e,t.download=`camstack-ca.crt`,t.click(),URL.revokeObjectURL(e)},c=n?.ca,l=c?.state===`ready`?Date.parse(c.validTo):null,u=n?.listener;return e(`div`,{className:`space-y-1`,"data-testid":`ca-strip`,children:[r(B,{label:a(`certificates.caStrip.localHttpsCaSha256`,`Local HTTPS CA (SHA-256)`),valueClassName:`font-mono`,children:e(`span`,{className:`flex flex-wrap items-center gap-2`,children:[jn(t)??`—`,o!==``&&e(W,{type:`button`,variant:`ghost`,size:`sm`,onClick:s,children:[r(ee,{className:`h-3 w-3`,"aria-hidden":!0}),a(`certificates.caStrip.downloadCa`,`Download CA`)]})]})}),r(B,{label:a(`certificates.caStrip.clusterCaSha256`,`Cluster CA (SHA-256)`),valueClassName:`font-mono`,children:c===void 0?`—`:c.state===`ready`?c.fingerprintSha256:r(`span`,{className:`text-danger`,children:a(`certificates.caStrip.unavailable`,{reason:c.reason})})}),c?.state===`ready`&&e(B,{label:a(`certificates.caStrip.clusterCaValidUntil`,`Cluster CA valid until`),children:[c.validTo,l!==null&&!Number.isNaN(l)&&e(`span`,{className:`ml-2 text-[10px] ${An[Ft(l,i)]}`,children:[`(`,xt(l,i),`)`]})]}),u!==void 0&&e(B,{label:a(`certificates.caStrip.nodeListener`,`Node listener`),children:[u.state===`open`&&r(F,{variant:`success`,children:a(`certificates.caStrip.open`,`Open`)}),u.state===`not-started`&&r(F,{variant:`default`,children:a(`certificates.caStrip.notStarted`,`Not started`)}),u.state===`closed`&&e(`span`,{className:`text-danger`,children:[a(`certificates.caStrip.closedSince`,{when:St(u.since)}),` `,u.reason]})]}),n!==void 0&&!n.registryAvailable&&e(`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:[r(b,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-warning`,"aria-hidden":!0}),r(`span`,{children:a(`certificates.caStrip.theCertificateRegistryIsNot`,`The certificate registry is not up, so the node list below is incomplete.`)})]})]})}function Nn(e,t){let n=new Set;for(let t of e)n.add(t.nodeId);for(let e of t?.nodes??[])n.add(e.nodeId);return[...n].map(n=>{let r=e.find(e=>e.nodeId===n)??null,i=t?.nodes.find(e=>e.nodeId===n)??null;return{nodeId:n,isHub:r?.isHub??n===`hub`,online:r?.online??i?.online??!1,https:r,mesh:i}}).toSorted((e,t)=>Number(t.isHub)-Number(e.isHub)||e.nodeId.localeCompare(t.nodeId))}function Pn(e){return e.isHub?G.t(`helpers.nodesModel.hubReissued`):e.mesh===null?G.t(`helpers.nodesModel.noCertRecorded`):e.online?null:G.t(`helpers.certificateModel.nodeOffline`)}function Fn(e){return e.isHub||e.mesh===null?Pn(e):null}var In={ok:`text-foreground-subtle`,soon:`text-warning`,expired:`text-danger`,unknown:`text-foreground-subtle`},Ln={enroll:`Issued at enrollment`,renewal:`Issued by a renewal`,boot:`Issued at boot`,pairing:`Issued at pairing`,observed:`Observed on its connection`},Rn={uploaded:`Uploaded`,generated:`Generated`,disabled:`Disabled`};function zn(e){let t=e.https?.https;return t?.kind===`served`?Nt(t.status.validTo):null}function Bn({ms:t,now:n}){return t===null?r(`span`,{className:`text-foreground-subtle`,children:`—`}):e(`div`,{children:[r(`div`,{children:St(t)}),r(`div`,{className:`text-[10px] ${In[Ft(t,n)]}`,children:xt(t,n)})]})}function Vn({row:t}){let{t:n}=K(),i=t.https?.https;return i===void 0?r(`span`,{className:`text-foreground-subtle`,children:`—`}):i.kind===`served`?e(`div`,{title:i.status.leafFingerprintSha256??``,children:[r(F,{variant:`success`,className:`text-[10px]`,children:n(`certificates.nodesColumns.served`,`Served`)}),r(`span`,{className:`ml-1.5 text-[10px] text-foreground-subtle`,children:Rn[i.status.mode]}),r(`div`,{className:`mt-1 font-mono text-[10px] text-foreground-subtle`,children:Mt(i.status.leafFingerprintSha256)}),i.status.sans.length>0&&r(`div`,{className:`mt-0.5 max-w-[14rem] truncate font-mono text-[10px] text-foreground-subtle`,title:i.status.sans.join(`, `),children:i.status.sans.join(`, `)})]}):e(`div`,{className:`max-w-[16rem]`,children:[r(F,{variant:i.kind===`unreadable`?`danger`:`warning`,className:`text-[10px]`,children:i.kind===`unreadable`?n(`certificates.nodesColumns.unreadable`,`Unreadable`):n(`certificates.nodesColumns.notServed`,`Not served`)}),r(`div`,{className:`mt-1 whitespace-normal text-[10px] text-foreground-subtle`,children:i.reason})]})}function Hn({row:t}){let{t:n}=K(),i=t.mesh?.current??null;if(i===null)return r(`span`,{className:`text-foreground-subtle`,children:n(`certificates.nodesColumns.noneRecorded`,`None recorded`)});let a=t.mesh?.history.length??0;return e(`div`,{children:[r(`div`,{className:`font-mono text-[11px]`,title:i.serial,children:kt(i.serial)}),r(`div`,{className:`font-mono text-[10px] text-foreground-subtle`,title:i.fingerprintSha256,children:Mt(i.fingerprintSha256)}),e(`div`,{className:`text-[10px] text-foreground-subtle`,children:[Ln[i.issuedVia],a>0?` · ${n(`certificates.nodesColumns.earlier`,{count:a})}`:``]})]})}function Un({row:e}){let{t}=K(),n=e.mesh?.presentingCurrent??null;return n===null?r(`span`,{className:`text-foreground-subtle`,children:e.online?`—`:t(`certificates.nodesColumns.offline`,`Offline`)}):n?r(F,{variant:`success`,className:`text-[10px]`,children:t(`common.yes`,`Yes`)}):r(F,{variant:`warning`,className:`text-[10px]`,children:t(`certificates.nodesColumns.noPresentsAnother`,`No - presents another`)})}function Wn(t){let n=t.icon;return e(W,{type:`button`,variant:`ghost`,size:`sm`,className:t.danger?`text-danger hover:bg-danger/10`:void 0,disabled:t.reason!==null||t.busy,title:t.reason??void 0,"aria-label":t.ariaLabel,onClick:t.onClick,children:[t.spinning?r(w,{className:`h-3 w-3 animate-spin`,"aria-hidden":!0}):r(n,{className:`h-3 w-3`,"aria-hidden":!0}),t.label]})}function Gn({reasons:t}){let{t:n}=K();return e(Xe,{className:`inline-block`,children:[r(Je,{children:r(`span`,{className:`cursor-help text-[11px] text-foreground-subtle`,"data-testid":`hub-managed-note`,children:n(`certificates.nodesColumns.managedByTheHub`,`Managed by the hub`)})}),r(We,{children:r(`ul`,{className:`max-w-xs space-y-1 whitespace-normal text-left text-[11px]`,children:t.map(e=>r(`li`,{children:e},e))})})]})}function Kn({row:t,o:n}){let{t:i}=K(),a=t.https===null?`No HTTPS inventory for this node.`:Ct(t.https).reason,o=Pn(t),s=Fn(t),c=e=>n.running?.nodeId===t.nodeId&&n.running.action===e,l=e=>!t.isHub||e===null,u=[a,o,s].filter((e,t,n)=>e!==null&&n.indexOf(e)===t);return e(`div`,{className:`flex w-44 flex-col items-end gap-1`,children:[e(`div`,{className:`flex flex-col items-end gap-0.5`,children:[l(a)&&r(Wn,{label:i(`certificates.nodesColumns.renewHttps`,`Renew HTTPS`),ariaLabel:i(`certificates.nodesColumns.renewTheCertificateOn`,`Renew the certificate on {{nodeId}}`,{nodeId:t.nodeId}),icon:g,reason:a,busy:n.busy,spinning:c(`renew-https`),danger:!1,onClick:()=>n.onRenewHttps(t)}),l(o)&&r(Wn,{label:c(`renew-identity`)?i(`certificates.nodesColumns.renewing`,`Renewing…`):i(`certificates.nodesColumns.renewIdentity`,`Renew identity`),ariaLabel:i(`certificates.nodesColumns.renewTheClusterCertificateOf`,`Renew the cluster certificate of {{nodeId}}`,{nodeId:t.nodeId}),icon:g,reason:o,busy:n.busy,spinning:c(`renew-identity`),danger:!1,onClick:()=>n.onRenewIdentity(t)}),l(s)&&r(Wn,{label:i(`certificates.nodesColumns.revokeIdentity`,`Revoke identity`),ariaLabel:i(`certificates.nodesColumns.revokeTheClusterCertificateOf`,`Revoke the cluster certificate of {{nodeId}}`,{nodeId:t.nodeId}),icon:C,reason:s,busy:n.busy,spinning:c(`revoke-identity`),danger:!0,onClick:()=>n.onRevokeIdentity(t)})]}),t.isHub&&u.length>0&&r(Gn,{reasons:u}),!t.isHub&&a!==null&&t.https!==null&&r(`div`,{className:`w-full whitespace-normal text-right text-[10px] text-foreground-subtle`,"data-testid":`renew-reason-${t.nodeId}`,children:a}),!t.isHub&&o!==null&&r(`div`,{className:`w-full whitespace-normal text-right text-[10px] text-foreground-subtle`,"data-testid":`mesh-reason-${t.nodeId}`,children:o})]})}function qn(t){return[{key:`node`,header:G.t(`certificates.nodesColumns.node`,`Node`),sortValue:e=>e.isHub?``:e.nodeId.toLowerCase(),render:t=>e(`div`,{className:`flex items-center gap-1.5`,children:[r(`span`,{className:`font-medium text-foreground`,children:t.nodeId}),t.nodeId===`hub`&&r(F,{variant:`info`,className:`text-[10px]`,children:G.t(`common.hubWord`)}),!t.online&&r(F,{variant:`default`,className:`text-[10px]`,children:G.t(`common.offline`)})]})},{key:`https-state`,header:`HTTPS`,notSortableReason:`A state with a reason has no single order.`,render:e=>r(Vn,{row:e})},{key:`https-expires`,header:G.t(`certificates.nodesColumns.httpsExpires`,`HTTPS expires`),sortValue:e=>zn(e),render:e=>r(Bn,{ms:zn(e),now:t.now})},{key:`identity`,header:G.t(`certificates.nodesColumns.identity`,`Identity`),sortValue:e=>e.mesh?.current?.serial??null,render:e=>r(Hn,{row:e})},{key:`identity-expires`,header:G.t(`certificates.nodesColumns.identityExpires`,`Identity expires`),sortValue:e=>e.mesh?.current?.notAfter??null,render:e=>r(Bn,{ms:e.mesh?.current?.notAfter??null,now:t.now})},{key:`presenting`,header:G.t(`certificates.nodesColumns.inUse`,`In use`),notSortableReason:`Offline nodes have no answer to order by.`,render:e=>r(Un,{row:e})},{key:`actions`,header:G.t(`certificates.nodesColumns.actions`,`Actions`),align:`right`,notSortableReason:`Actions have no order.`,render:e=>r(Kn,{row:e,o:t})}]}s();function Jn(){let{t}=K(),i=E(),o=V.useUtils(),s=pn(6e4),c=V.certificates.listHttpsCertificates.useQuery(),l=V.certificates.getMeshCertificates.useQuery(),[u,d]=a(null),[f,p]=a(null),[m,h]=a(null),g=()=>{h(null),o.certificates.listHttpsCertificates.invalidate(),o.certificates.getMeshCertificates.invalidate()},_=e=>(t,n)=>{h(null),d(`${n.nodeId}: ${e} - ${t.message}`)},y=V.certificates.renewHttpsOnNode.useMutation({onSuccess:(e,n)=>{p({tone:`success`,message:e.restartRequired?t(`certificates.nodesCard.newCertificateIssuedRestartThe`,`{{nodeId}}: new certificate issued. Restart the node to serve it.`,{nodeId:n.nodeId}):t(`certificates.nodesCard.newCertificateIssuedAndServed`,`{{nodeId}}: new certificate issued and served.`,{nodeId:n.nodeId})}),g()},onError:_(`renewal failed`)}),b=V.certificates.renewMeshOnNode.useMutation({onSuccess:e=>{p(Ot(e)),g()},onError:_(`renewal could not start`)}),x=V.certificates.revokeMeshOnNode.useMutation({onSuccess:e=>{p({tone:`success`,message:`${e.nodeId}: ${e.next}`}),g()},onError:_(`revoke failed`)}),S=y.isPending||b.isPending||x.isPending,C=(e,t)=>{d(null),p(null),h({nodeId:e,action:t})},w=async e=>{await i({title:t(`certificates.nodesCard.renewHttpsOn`,`Renew HTTPS on "{{nodeId}}"?`,{nodeId:e.nodeId}),message:e.isHub?t(`certificates.nodesCard.aNewCertificateIsIssued`,`A new certificate is issued from the local CA. Clients that trust the CA keep working.`):t(`certificates.nodesCard.theNodeMakesANew`,`The node makes a new key, the hub signs it and the node switches over without a restart. It keeps serving what it had if anything fails.`),confirmLabel:t(`certificates.nodesCard.renew`,`Renew`)})&&(C(e.nodeId,`renew-https`),y.mutate({nodeId:e.nodeId}))},T=e=>{C(e.nodeId,`renew-identity`),b.mutate({nodeId:e.nodeId})},D=async e=>{await i({title:t(`certificates.nodesCard.revokeTheIdentityOf`,`Revoke the identity of "{{nodeId}}"?`,{nodeId:e.nodeId}),message:t(`certificates.nodesCard.isDisconnectedAtOnceAnd`,`{{nodeId}} is disconnected at once and can no longer connect. To bring it back it must be paired again from System → Cluster → Agents. It stays in the node list until you forget it on the Cluster page. This cannot be undone.`,{nodeId:e.nodeId}),confirmLabel:t(`certificates.nodesCard.revokeAndDisconnect`,`Revoke and disconnect`),variant:`danger`})&&(C(e.nodeId,`revoke-identity`),x.mutate({nodeId:e.nodeId}))},O=qn({now:s,busy:S,running:m,onRenewHttps:e=>void w(e),onRenewIdentity:T,onRevokeIdentity:e=>void D(e)}),ee=n(()=>Nn(c.data??[],l.data),[c.data,l.data]),k=l.data?.registryAvailable??!0;return r(q,{id:`nodes`,title:t(`certificates.nodesCard.nodes`,`Nodes`),icon:v,description:t(`certificates.nodesCard.eachNodeHoldsTwoCertificates`,`Each node holds two certificates: one it serves over HTTPS, one that proves its identity to the hub. Renewing replaces a certificate without a gap; revoking an identity cuts the node off until it re-joins.`),notice:J(u,f),onDismissNotice:()=>{d(null),p(null)},children:r(un,{isPending:c.isPending||l.isPending,error:c.error??l.error,what:`node certificates`,onRetry:()=>{c.refetch(),l.refetch()},children:e(`div`,{className:`space-y-3`,children:[r(Mn,{https:c.data??[],mesh:l.data,now:s}),r(Te,{columns:O,rows:ee,rowKey:e=>e.nodeId,minWidthPx:960,maxBodyHeight:et,defaultSort:{columnKey:`node`,dir:`asc`},emptyMessage:k?t(`certificates.nodesCard.noNodesReported`,`No nodes reported.`):t(`certificates.nodesCard.theCertificateRegistryIsNot`,`The certificate registry is not available yet, so nodes cannot be listed.`)})]})})})}function Yn({pairOpen:t,onPairClose:n}){return e(`div`,{className:`space-y-4`,"data-testid":`certificates-page`,children:[r(yn,{pairOpen:t,onPairClose:n}),r(dn,{}),r(kn,{}),r(Jn,{})]})}function Xn({userId:t,username:n,onClose:i}){let{t:a}=K(),o=E(),s=V.useUtils(),c=me({userId:t}),l=V.auth.listLoginMethods.useQuery(),d=z({onSuccess:()=>void s.userManagement.listExternalIdentities.invalidate()}),f=new Map((l.data??[]).flatMap(e=>e.kind===`redirect`?[[e.id,e.label]]:[])),p=c.data??[],m=async(e,r)=>{await o({title:a(`users.externalIdentitiesModal.removeSignInLink`,`Remove sign-in link`),message:a(`users.externalIdentitiesModal.willNoLongerBeAble`,`"{{username}}" will no longer be able to sign in with this {{label}} account.`,{username:n,label:r}),confirmLabel:a(`common.remove`,`Remove`),variant:`danger`})&&d.mutate({userId:t,provider:e.provider,subject:e.subject})};return r(H,{open:!0,onOpenChange:e=>!e&&i(),children:e(L,{width:`md`,placement:`sheet-on-mobile`,scroll:`body`,"data-testid":`external-identities-modal`,children:[r(tt,{children:e(P,{className:`flex items-center gap-2`,children:[r(u,{className:`h-4 w-4 text-primary`}),e(`span`,{children:[a(`users.externalIdentitiesModal.linkedSignInAccounts`,`Linked sign-in accounts`),e(`span`,{className:`mt-0.5 block text-[11px] font-normal text-foreground-subtle`,children:[a(`users.externalIdentitiesModal.user`,`User:`),` `,r(`span`,{className:`font-mono`,children:n})]})]})]})}),r(I,{className:`space-y-3`,children:c.isLoading?e(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[r(w,{className:`h-3.5 w-3.5 animate-spin`}),a(`common.loading`,`Loading…`)]}):p.length===0?r(`p`,{className:`text-xs text-foreground-subtle`,children:a(`users.externalIdentitiesModal.noLinkedAccountsOnlyThe`,`No linked accounts. Only the user can link one, from their own profile page.`)}):r(`ul`,{className:`divide-y divide-border rounded-md border border-border`,children:p.map(t=>{let n=f.get(t.provider),i=n??t.provider;return e(`li`,{className:`flex items-center gap-3 px-3 py-2 text-xs`,children:[e(`div`,{className:`flex-1 min-w-0`,children:[e(`div`,{className:`font-medium text-foreground truncate`,children:[i,n===void 0&&r(`span`,{className:`ml-2 rounded bg-foreground-subtle/15 px-1.5 py-0.5 text-[10px] font-normal text-foreground-subtle`,children:a(`users.externalIdentitiesModal.providerUnavailable`,`provider unavailable`)})]}),e(`div`,{className:`text-[11px] text-foreground-subtle truncate`,children:[t.label??t.subject,` ·`,` `,new Date(t.linkedAt).toLocaleDateString()]})]}),e(W,{variant:`unstyled`,onClick:()=>void m(t,i),disabled:d.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:[r(fe,{className:`h-3 w-3`}),a(`common.remove`,`Remove`)]})]},`${t.provider}|${t.subject}`)})})}),r(Ee,{children:r(W,{onClick:i,variant:`secondary`,children:a(`common.close`,`Close`)})})]})})}function Zn({userId:t,username:n,onClose:i}){let{t:a}=K(),o=c(),s=E(),u=$e({userId:t}),d=u.data,f=()=>o.invalidateQueries({queryKey:[[`userManagement`,`getTotpStatus`]]}),p=we({onSuccess:()=>{f(),i()}}),g=u.isLoading?`loading`:d?.enabled?`enrolled`:`not_enrolled`;return r(H,{open:!0,onOpenChange:e=>!e&&i(),children:e(L,{width:`md`,placement:`sheet-on-mobile`,scroll:`body`,children:[r(tt,{children:e(P,{className:`flex items-center gap-2`,children:[r(k,{className:`h-4 w-4 text-primary`}),e(`span`,{children:[a(`users.totpModal.twoFactorAuthentication`,`Two-factor authentication`),e(`span`,{className:`mt-0.5 block text-[11px] font-normal text-foreground-subtle`,children:[a(`users.totpModal.user`,`User:`),` `,r(`span`,{className:`font-mono`,children:n})]})]})]})}),e(I,{className:`space-y-4`,children:[g===`loading`&&e(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[r(w,{className:`h-3.5 w-3.5 animate-spin`}),a(`users.totpModal.checkingStatus`,`Checking status…`)]}),g===`not_enrolled`&&e(`div`,{className:`rounded-md border border-border bg-surface-hover/30 px-3 py-2.5 flex items-start gap-2.5 text-xs text-foreground-subtle`,children:[r(h,{className:`h-4 w-4 mt-0.5 shrink-0`}),e(`div`,{children:[r(`div`,{className:`font-medium text-foreground`,children:a(`users.totpModal.2faNotEnrolled`,`2FA not enrolled`)}),r(`p`,{className:`mt-0.5`,children:a(`users.totpModal.onlyTheUserThemselvesCan`,`Only the user themselves can enable 2FA, from their own profile page.`)})]})]}),g===`enrolled`&&d&&e(l,{children:[e(`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:[r(m,{className:`h-4 w-4 mt-0.5 text-emerald-500 shrink-0`}),e(`div`,{className:`text-xs text-foreground space-y-0.5`,children:[r(`div`,{className:`font-medium`,children:a(`users.totpModal.2faIsActive`,`2FA is active`)}),r(`div`,{className:`text-foreground-subtle`,children:a(`common.enrolledOn`,{when:d.confirmedAt?new Date(d.confirmedAt).toLocaleString():`—`})})]})]}),r(`div`,{className:`text-[11px] text-foreground-subtle`,children:a(`users.totpModal.removingHereClearsTheServer`,`Removing here clears the server-side secret. Use this only when the user has lost access — they'll have to re-enroll from their profile page afterwards.`)}),e(`div`,{className:`flex justify-end gap-2`,children:[r(W,{onClick:i,variant:`secondary`,children:a(`common.close`,`Close`)}),e(W,{variant:`unstyled`,onClick:async()=>{await s({title:a(`users.totpModal.remove2fa`,`Remove 2FA`),message:a(`users.totpModal.removeTwoFactorAuthenticationFor`,`Remove two-factor authentication for "{{username}}"? They'll be able to log in with just their password until they re-enroll from their own profile page.`,{username:n}),confirmLabel:a(`common.remove`,`Remove`),variant:`danger`})&&p.mutate({userId:t})},disabled:p.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:[p.isPending?r(w,{className:`h-3 w-3 animate-spin`}):r(T,{className:`h-3 w-3`}),a(`users.totpModal.remove2fa`,`Remove 2FA`)]})]})]})]})]})})}s();function Qn({userId:t,username:n,onClose:i}){let{t:o}=K(),{user:s,logout:c}=rt(),l=s?.id===t,u=E(),d=V.useUtils(),f=V.auth.listSessions.useQuery({userId:t}),[p,m]=a(null),h=V.auth.revokeSessions.useMutation({onSuccess:(e,t)=>{if(l&&`userId`in t){c();return}d.auth.listSessions.invalidate()},onError:e=>m(`Sign out failed: ${e.message}`)}),g=async e=>{await u({title:o(`users.userSessionsModal.signOutThisSession`,`Sign out this session`),message:o(`users.userSessionsModal.onWillHaveToSign`,`"{{username}}" on {{label}} will have to sign in again.`,{username:n,label:vt(e.client).label}),confirmLabel:o(`users.userSessionsModal.signOut`,`Sign out`),variant:`danger`})&&(m(null),h.mutate({id:e.id}))},_=async()=>{await u({title:o(`users.userSessionsModal.signOutEverywhere`,`Sign out everywhere`),message:l?o(`users.userSessionsModal.everySessionOfYourOwn`,`Every session of your own account ends, this browser included: you will be signed out here too.`):o(`users.userSessionsModal.everySessionOfEndsAt`,`Every session of "{{username}}" ends at once; each device has to sign in again.`,{username:n}),confirmLabel:o(`users.userSessionsModal.signOutEverywhere`,`Sign out everywhere`),variant:`danger`})&&(m(null),h.mutate({userId:t}))},v=h.isPending&&h.variables!==void 0&&`id`in h.variables?h.variables.id:null;return r(H,{open:!0,onOpenChange:e=>!e&&i(),children:e(L,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,"data-testid":`user-sessions-modal`,children:[r(tt,{children:e(P,{className:`flex items-center gap-2`,children:[r(de,{className:`h-4 w-4 text-primary`}),e(`span`,{children:[o(`users.userSessionsModal.activeSessions`,`Active sessions`),e(`span`,{className:`mt-0.5 block text-[11px] font-normal text-foreground-subtle`,children:[o(`users.userSessionsModal.user`,`User:`),` `,r(`span`,{className:`font-mono`,children:n})]})]})]})}),e(I,{className:`space-y-3`,children:[p!==null&&r(`div`,{className:`text-[11px] text-danger`,children:p}),r(Pt,{sessions:f.data??[],isLoading:f.isLoading,loadError:f.isError?f.error?.message??`Request failed`:null,emptyText:`No active sessions.`,onRevoke:e=>void g(e),revokingId:v})]}),e(Ee,{className:`justify-between`,children:[e(W,{variant:`unstyled`,onClick:()=>void _(),disabled:h.isPending||(f.data??[]).length===0,className:`inline-flex items-center gap-1.5 rounded border border-danger/40 px-2.5 py-1 text-[11px] font-medium text-danger hover:bg-danger/10 disabled:opacity-50`,children:[h.isPending&&v===null?r(w,{className:`h-3 w-3 animate-spin`}):r(M,{className:`h-3 w-3`}),o(`users.userSessionsModal.signOutEverywhere`,`Sign out everywhere`)]}),r(W,{onClick:i,variant:`secondary`,children:o(`common.close`,`Close`)})]})]})})}function $n({scopes:t,invalidReason:n}){let{t:i}=K(),a=O(),s=o({queryKey:[`auth`,`previewScope`,t,!1],enabled:n===null,queryFn:()=>a.trpcClient.auth.previewScope.query({scopes:[...t],isAdmin:!1})}),{data:c}=je({projection:`slim`}),l=c?.length??null;if(n!==null)return e(`p`,{className:`flex items-center gap-1.5 text-[11px] text-warning`,"data-testid":`role-preview`,children:[r(ie,{className:`h-3 w-3 shrink-0`}),n]});if(s.isLoading)return e(`p`,{className:`flex items-center gap-1.5 text-[11px] text-foreground-subtle`,"data-testid":`role-preview`,children:[r(w,{className:`h-3 w-3 shrink-0 animate-spin`}),i(`users.rolePreview.resolving`)]});if(s.isError||!s.data)return r(`p`,{className:`text-[11px] text-danger`,"data-testid":`role-preview`,children:i(`users.rolePreview.couldNotResolve`)});let u=s.data.viewableDeviceCount,d=s.data.device.view.all?i(`users.rolePreview.everyDevice`,{count:u}):l===null?i(`users.rolePreview.devicesVisible`,{count:u}):i(`users.rolePreview.devicesVisibleOf`,{count:u,total:l});return e(`p`,{className:`flex items-center gap-1.5 text-[11px] ${u===0?`text-warning`:`text-foreground`}`,"data-testid":`role-preview`,children:[u===0?r(ie,{className:`h-3 w-3 shrink-0`}):r(_,{className:`h-3 w-3 shrink-0 text-foreground-subtle`}),u===0?i(`users.rolePreview.noDevice`):d]})}function er(e){let t=ae(e.scopes??[]);if(t===null)return{role:e.isAdmin?`admin`:`viewer`,mode:`except`,pickedIds:[],viewer:oe,unconfigured:!e.isAdmin};let n=sr(t);return{role:e.isAdmin?`admin`:`viewer`,mode:n.mode,pickedIds:n.pickedIds,viewer:cr(n.mode,n.pickedIds,t.features),unconfigured:!1}}function tr(e,t){return{...e,role:t}}function nr(e,t){return{...e,mode:t,viewer:cr(t,e.pickedIds,e.viewer.features)}}function rr(e,t){let n=lr(t);return{...e,pickedIds:n,viewer:cr(e.mode,n,e.viewer.features)}}function ir(e,t,n){let r=e.viewer.features.filter(e=>e!==t),i=n?[...r,t]:r;return{...e,viewer:cr(e.mode,e.pickedIds,i)}}function ar(e){return e.role===`viewer`&&e.mode===`only`&&e.pickedIds.length===0?`no-allowed-device`:null}function or(e){return ar(e)===null?e.role===`admin`?{isAdmin:!0,scopes:[]}:{isAdmin:!1,scopes:[e.viewer]}:null}function sr(e){if(e.allow===`*`)return{mode:`except`,pickedIds:e.block};let t=new Set(e.block);return{mode:`only`,pickedIds:e.allow.filter(e=>!t.has(e))}}function cr(e,t,n){let r=lr(t);return e===`except`?{type:`viewer`,allow:`*`,block:r,features:[...n]}:{type:`viewer`,allow:r,block:[],features:[...n]}}function lr(e){return[...new Set(e)]}s();var ur=`text-[11px] font-semibold uppercase tracking-wide text-foreground-subtle`;function dr(e,t){return e?`failed`:t===void 0?`pending`:`answered`}function fr(e){let t=[];for(let n of e)n.parentDeviceId===null&&t.push({id:n.id,name:n.name,type:String(n.type),...n.location===null?{}:{location:n.location}});return t}function pr({user:t,isSelf:i,onClose:o,onSubmit:s,submitting:c,error:u}){let{t:d}=K(),[f,p]=a(n(()=>er(t),[t])),m=je({projection:`slim`}),h=m.data,g=dr(m.isError,h),_=n(()=>fr(h??[]),[h]),v=n(()=>({state:g,devices:g===`answered`?(h??[]).map(e=>({id:e.id,name:e.name})):void 0}),[g,h]),y=ar(f),b=or(f),x=y===`no-allowed-device`?d(`users.userAccessModal.pickAllowedDevice`):null,S=e=>{p(tr(f,e))},C=[{value:`except`,label:d(`users.userAccessModal.modeExcept`)},{value:`only`,label:d(`users.userAccessModal.modeOnly`)}];return r(H,{open:!0,onOpenChange:e=>!e&&o(),children:e(L,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,className:`md:max-w-2xl`,children:[r(tt,{children:r(P,{children:d(`users.userAccessModal.title`,{name:t.username})})}),e(I,{className:`space-y-4`,children:[f.unconfigured&&f.role===`viewer`&&r(R,{variant:`warning`,title:d(`users.userAccessModal.noAccessYet`),message:d(`users.userAccessModal.noAccessYetDetail`,{name:t.username})}),e(`section`,{className:`space-y-2`,children:[r(`h3`,{className:ur,children:d(`users.userAccessModal.role`)}),e(`div`,{role:`radiogroup`,"aria-label":d(`users.userAccessModal.role`),className:`grid gap-1.5 sm:grid-cols-2`,children:[r(mr,{name:`admin`,checked:f.role===`admin`,label:d(`users.userAccessModal.admin`),description:d(`users.userAccessModal.adminDescription`),onPick:()=>S(`admin`)}),r(mr,{name:`viewer`,checked:f.role===`viewer`,disabled:i,label:d(`users.userAccessModal.viewer`),description:d(i?`users.userAccessModal.cannotDemoteSelf`:`users.userAccessModal.viewerDescription`),onPick:()=>S(`viewer`)})]})]}),f.role===`viewer`&&e(l,{children:[e(`section`,{className:`space-y-3`,children:[r(`h3`,{className:ur,children:d(`users.userAccessModal.devices`)}),r(ze,{label:d(`users.userAccessModal.whichDevices`),value:f.mode,options:C,onChange:e=>p(nr(f,e))}),r(Me,{devices:_,listState:g,fleet:v,value:[...f.pickedIds],onChange:e=>p(rr(f,e)),emptyMeansAll:f.mode===`except`,noun:`device`,testId:`viewer-device-picker`}),r($n,{scopes:b?.scopes??[],invalidReason:x})]}),e(`section`,{className:`space-y-2`,children:[r(`h3`,{className:ur,children:d(`users.userAccessModal.features`)}),r(`div`,{className:`space-y-1`,children:j.map(t=>e(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-md p-1.5 hover:bg-surface-hover`,children:[r(Ue,{className:`mt-0.5`,checked:f.viewer.features.includes(t.id),onChange:e=>p(ir(f,t.id,e.target.checked))}),e(`span`,{className:`min-w-0`,children:[r(`span`,{className:`block text-[12px] font-medium text-foreground`,children:d(`users.viewerFeatures.${t.id}.label`,t.label)}),r(`span`,{className:`block text-[10px] text-foreground-subtle`,children:d(`users.viewerFeatures.${t.id}.description`,t.description)})]})]},t.id))})]})]}),u!==null&&r(R,{message:u})]}),e(Ee,{children:[r(W,{variant:`outline`,size:`sm`,onClick:o,children:d(`common.cancel`,`Cancel`)}),r(W,{size:`sm`,onClick:()=>b!==null&&s(b),disabled:c||b===null,children:c?r(w,{className:`h-3 w-3 animate-spin`}):d(`users.userAccessModal.saveAccess`)})]})]})})}function mr({name:t,checked:n,disabled:i=!1,label:a,description:o,onPick:s}){return e(`label`,{className:`flex items-start gap-2 rounded-lg border p-2.5 transition-colors ${n?`border-primary bg-primary/5`:`border-border hover:bg-surface-hover`} ${i?`cursor-not-allowed opacity-60`:`cursor-pointer`}`,children:[r(Ke,{name:`user-role`,value:t,checked:n,disabled:i,onChange:s,className:`mt-0.5`}),e(`span`,{className:`min-w-0`,children:[r(`span`,{className:`block text-[12px] font-medium text-foreground`,children:a}),r(`span`,{className:`block text-[10px] text-foreground-subtle`,children:o})]})]})}s();var $=8;function hr(){return{username:``,password:``,isAdmin:!1}}function gr(e){return{id:e.id,username:e.username,password:``,isAdmin:e.isAdmin}}function _r(e){return e instanceof Error?e.message:G.t(`admin.system.users.genericError`)}function vr(){let{t}=K(),n=c(),{user:o}=rt(),{state:s,openNew:d,openEdit:m,close:h}=Ze(),[g,_]=a(null),[v,b]=a(null),[S,C]=a(!1),{data:T,isLoading:D,isError:O,error:ee,refetch:ne}=ye(),A=E(),ie=te(),j=()=>n.invalidateQueries({queryKey:[[`userManagement`,`listUsers`]]}),ae=be(),oe=Se({onSuccess:j}),M=qe({onSuccess:j}),se=Oe({onSuccess:j}),ce=ve(),[N,le]=a(null),[fe,pe]=a(!1),[me,P]=a(null),[he,ge]=a(null),[F,I]=a(null),[xe,L]=a(null),z=T??[],B=s.mode===`edit`?z.find(e=>e.id===s.id)??null:null,V=()=>{_(null),b(null),C(!1),ae.reset(),M.reset(),h()};i(()=>{if(s.mode===`closed`){_(null),b(null),C(!1);return}if(s.mode===`new`){_(e=>e!==null&&e.id===void 0?e:hr());return}if(B===null){D||h();return}_(e=>e?.id===B.id?e:gr(B))},[s,B,D,h]);let Ce=s.mode===`new`&&g!==null&&g.id===void 0||s.mode===`edit`&&g!==null&&B!==null;async function H(e){await A({title:t(`admin.system.users.deleteUser`,`Delete user`),message:t(`admin.system.users.permanentlyDeleteUserThisCannot`,`Permanently delete user "{{username}}"? This cannot be undone — any active sessions will be revoked on next request.`,{username:e.username}),confirmLabel:t(`common.delete`,`Delete`),variant:`danger`})&&(oe.mutate({id:e.id}),s.mode===`edit`&&s.id===e.id&&V())}async function we(e){let n=await ie({title:t(`admin.system.users.resetPassword`,`Reset password`),message:t(`admin.system.users.setANewPasswordFor`,`Set a new password for "{{username}}".`,{username:e.username}),label:t(`admin.system.users.newPassword`,`New password`),inputType:`password`,placeholder:t(`admin.system.users.atLeast8Characters`,`At least 8 characters`),confirmLabel:t(`admin.system.users.continue`,`Continue`),validate:e=>e.length<$?G.t(`admin.system.users.passwordTooShort`,{min:$}):null});n===null||n.length===0||await A({title:t(`admin.system.users.resetPassword`,`Reset password`),message:t(`admin.system.users.resetThePasswordForThey`,`Reset the password for "{{username}}"? They will need to use the new password on their next login.`,{username:e.username}),confirmLabel:t(`common.reset`,`Reset`)})&&se.mutate({id:e.id,newPassword:n})}function Ee(e){P(null),le(e)}async function De(e,t){pe(!0),P(null);try{t.isAdmin!==e.isAdmin&&await M.mutateAsync({id:e.id,isAdmin:t.isAdmin}),await ce.mutateAsync({userId:e.id,scopes:[...t.scopes]}),le(null)}catch(e){P(_r(e))}finally{pe(!1),j()}}async function ke(){if(g!==null){b(null);try{if(g.id===void 0){let e=g.username.trim();if(e===``||g.password.length<$)return;await ae.mutateAsync({username:e,password:g.password,isAdmin:g.isAdmin})}else await M.mutateAsync({id:g.id,isAdmin:g.isAdmin});j(),V()}catch(e){b(_r(e))}}}function Ae(e){return e?new Date(typeof e==`number`?e:String(e)).toLocaleDateString(`en-GB`,{day:`2-digit`,month:`short`,year:`numeric`}):`—`}let je=ae.isPending||M.isPending,Me=g!==null&&g.id===void 0&&g.username.trim()!==``&&g.password.length>=$,Pe=g!==null&&g.id!==void 0,Fe=je||(g?.id===void 0?!Me:!Pe),Ie=e=>oe.isPending&&oe.variables?.id===e.id||M.isPending&&M.variables?.id===e.id||se.isPending&&se.variables?.id===e.id,Re=[{key:`username`,header:t(`admin.system.users.username`,`Username`),sortValue:e=>e.username,render:e=>r(`span`,{className:`font-medium text-foreground`,"data-testid":`user-open-${e.id}`,children:e.username})},{key:`scopes`,header:t(`admin.system.users.access`,`Access`),sortValue:e=>yr(e),render:n=>r(`span`,{onClick:e=>e.stopPropagation(),children:e(W,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>Ee(n),disabled:Ie(n),title:t(`admin.system.users.configureAccess`,`Configure access`),"data-testid":`user-access-${n.id}`,children:[r(re,{className:`h-3 w-3 shrink-0 text-foreground-subtle`}),r(br,{user:n})]})})},{key:`createdAt`,header:t(`admin.system.users.created`,`Created`),nowrap:!0,sortValue:e=>e.createdAt,render:e=>r(`span`,{className:`text-foreground-subtle`,children:Ae(e.createdAt)})},{key:`actions`,header:t(`admin.system.users.actions`,`Actions`),align:`right`,nowrap:!0,notSortableReason:`Row actions`,render:n=>{let i=Ie(n),a=n.id!==o?.id&&n.totpEnabled;return e(`div`,{className:`flex items-center justify-end gap-1`,onClick:e=>e.stopPropagation(),children:[e(W,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>m(n.id),disabled:i,title:t(`admin.system.users.editUser`,`Edit user`),children:[r(x,{className:`h-3 w-3`}),t(`common.edit`,`Edit`)]}),a&&e(W,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>ge(n),disabled:i,title:t(`admin.system.users.removeTwoFactorAuthentication`,`Remove two-factor authentication`),children:[r(k,{className:`h-3 w-3`}),t(`admin.system.users.remove2fa`,`Remove 2FA`)]}),e(W,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>I(n),disabled:i,title:t(`admin.system.users.linkedSignInAccounts`,`Linked sign-in accounts`),children:[r(u,{className:`h-3 w-3`}),t(`admin.system.users.signInLinks`,`Sign-in links`)]}),e(W,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>L(n),disabled:i,title:t(`admin.system.users.activeSessions`,`Active sessions`),children:[r(de,{className:`h-3 w-3`}),t(`admin.system.users.sessions`,`Sessions`)]}),e(W,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>void we(n),disabled:i,title:t(`admin.system.users.resetPassword`,`Reset password`),children:[r(ue,{className:`h-3 w-3`}),t(`admin.system.users.resetPassword`,`Reset password`)]}),e(W,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>void H(n),disabled:i,title:t(`admin.system.users.deleteUser`,`Delete user`),className:`text-danger hover:bg-danger/10`,children:[i?r(w,{className:`h-3 w-3 animate-spin`}):r(p,{className:`h-3 w-3`}),t(`common.delete`,`Delete`)]})]})}}];return e(pt,{embedded:!0,icon:f,title:t(`admin.system.users.users`,`Users`),subtitle:t(`admin.system.users.hubAccountsAdminFlagAccess`,`Hub accounts, admin flag, access scopes, sessions and sign-in links.`),actions:e(W,{size:`sm`,type:`button`,onClick:()=>{b(null),d()},children:[r(y,{className:`h-3.5 w-3.5`}),t(`admin.system.users.createUser`,`Create User`)]}),children:[O&&r(R,{title:t(`admin.system.users.couldNotLoadUsers`,`Could not load users`),message:_r(ee),onRetry:()=>void ne()}),D&&e(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[r(w,{className:`h-3.5 w-3.5 animate-spin`}),t(`common.loading`,`Loading…`)]}),!D&&!O&&z.length===0&&r(Ne,{icon:f,title:t(`admin.system.users.noUsersYet`,`No users yet`),description:t(`admin.system.users.createAUserToGrant`,`Create a user to grant hub access.`)}),!D&&!O&&z.length>0&&r(Te,{columns:Re,rows:z,rowKey:e=>e.id,minWidthPx:560,maxBodyHeight:`max-h-[60vh]`,onRowClick:e=>m(e.id)}),r(_e,{open:Ce,onClose:V,title:g?.id===void 0?t(`admin.system.users.createUser`,`Create User`):t(`admin.system.users.edit`,`Edit {{value1}}`,{value1:g.username||`user`}),icon:f,error:v,testId:`user-form-dialog`,footer:r(W,{size:`sm`,type:`button`,disabled:Fe,onClick:()=>void ke(),children:je?e(l,{children:[r(w,{className:`h-3.5 w-3.5 animate-spin`}),t(`admin.system.users.saving`,`Saving…`)]}):g?.id===void 0?t(`admin.system.users.create`,`Create`):t(`common.save`,`Save`)}),children:g!==null&&e(`div`,{className:`space-y-3`,children:[r(U,{label:t(`admin.system.users.username`,`Username`),required:g.id===void 0,children:r(Be,{value:g.username,onChange:e=>_({...g,username:e.target.value}),placeholder:`john`,autoFocus:g.id===void 0,disabled:g.id!==void 0,"data-testid":`user-form-username`})}),g.id===void 0&&r(U,{label:t(`admin.system.users.password`,`Password`),required:!0,description:t(`admin.system.users.atLeastCharacters`,`At least {{value1}} characters.`,{value1:String($)}),children:r(Le,{value:g.password,onValueChange:e=>_({...g,password:e}),shown:S,onToggleShown:()=>C(e=>!e),placeholder:`••••••••`,"data-testid":`user-form-password`})}),r(U,{label:t(`admin.system.users.admin`,`Admin`),description:t(`admin.system.users.unrestrictedAccessToEveryCapability`,`Unrestricted access to every capability and device.`),children:e(`label`,{className:`inline-flex items-center gap-2 text-xs text-foreground cursor-pointer`,children:[r(Ue,{checked:g.isAdmin,onChange:e=>_({...g,isAdmin:e.target.checked}),className:`rounded border-border focus:ring-primary`,"data-testid":`user-form-admin`}),r(`span`,{children:t(`admin.system.users.admin`,`Admin`)})]})}),g.id!==void 0&&r(`p`,{className:`text-[11px] text-foreground-subtle`,children:t(`admin.system.users.toChangeThePasswordUse`,`To change the password, use Reset password on the user's row. Access scopes are configured from the Access column.`)})]})}),he&&r(Zn,{userId:he.id,username:he.username,onClose:()=>ge(null)}),F&&r(Xn,{userId:F.id,username:F.username,onClose:()=>I(null)}),xe&&r(Qn,{userId:xe.id,username:xe.username,onClose:()=>L(null)}),N&&r(pr,{user:N,isSelf:N.id===o?.id,onClose:()=>le(null),onSubmit:e=>void De(N,e),submitting:fe,error:me})]})}function yr(e){let t=er(e);return t.role===`admin`?0:t.unconfigured?2:1}function br({user:t}){let{t:n}=K(),i=er(t);if(i.role===`admin`)return r(`span`,{className:`font-medium text-foreground`,children:n(`users.accessSummary.admin`)});if(i.unconfigured)return r(`span`,{className:`font-medium text-warning`,children:n(`admin.system.users.noAccess`,`No access`)});let{allow:a,block:o,features:s}=i.viewer,c=a===`*`?n(`users.accessSummary.allDevices`):n(`users.accessSummary.devices`,{count:a.length});return e(`span`,{className:`text-foreground-subtle`,children:[r(`span`,{className:`font-medium text-foreground`,children:n(`users.accessSummary.viewer`)}),` ·`,` `,c,o.length>0&&e(l,{children:[` · `,n(`users.accessSummary.blocked`,{count:o.length})]}),s.length>0&&e(l,{children:[` · `,n(`users.accessSummary.features`,{count:s.length})]})]})}s();var xr={"api-keys":Q.tokens,"linked-sessions":Q.linkedApps},Sr=`certificates`;function Cr(t){return e(W,{size:`sm`,type:`button`,"data-testid":`certificates-pair-device`,onClick:t,children:[r(k,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),G.t(`systemPage.identity.pairADevice`,`Pair a device`)]})}function wr(){let{t:e}=K(),[t]=nt(),n=ln(),[i,o]=a(!1),s=xr[t.get(`tab`)??``];if(s!==void 0)return r(it,{to:ut(`access`,{integration:s}),replace:!0});let c=ot(`/system/identity`,{t:e,isAdmin:!0})??{icon:S,title:e(`system.identity`,`Identity & Access`)},l=t.get(`tab`)??`users`,u=t.get(`integration`),d=l===st.access.tab?cn(u,n.requestCreate):l===`certificates`?Cr(()=>o(!0)):void 0;return r(ft,{icon:c.icon,title:c.title,defaultSection:`users`,sectionsLabel:`${c.title} sections`,actions:d,sections:[{id:`users`,label:e(`systemPage.identity.users`,`Users`),content:r(vr,{})},{id:st.access.tab,label:e(`systemPage.identity.tokensSessions`,`Tokens & sessions`),ownedParams:lt.concat([wt.token,wt.scoped,wt.admin]),content:r(sn,{createRequested:n.createRequested,onCreateConsumed:n.clearCreate})},{id:Sr,label:e(`systemPage.identity.certificates`,`Certificates`),content:r(Yn,{pairOpen:i,onPairClose:()=>o(!1)})},{id:st.authentication.tab,label:e(`systemPage.identity.authentication`,`Authentication`),content:r(Vt,{}),ownedParams:lt}]})}export{wr as IdentityPage};
|
|
@@ -0,0 +1 @@
|
|
|
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,k as c,o as l,x as u,z as d}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Cr as ee,Kt as f,Pn as p,Un as m,V as h,Wn as g,Yn as te,Zi as ne,an as _,br as v,ct as re,ht as ie,wn as y}from"./player-overlays-CDEJeChs.js";import{yr as b}from"./client-Dd2wRwgL.js";import{t as ae}from"./link-2-off-KZXTolmN.js";import{Br as x,Ei as S,Et as oe,Fr as se,In as ce,Ir as C,Jr as le,Oi as ue,Pr as w,Rn as de,Us as T,Yr as fe,_a as E,_n as D,af as O,da as k,gn as A,ir as j,jn as M,kt as pe,vi as N,wt as me,zr as P}from"./src-Bz_Mw4PZ.js";import{t as F}from"./useTranslation-BJr-n0es.js";import{n as I}from"./addon-icons-context-qhDMLpPS.js";import{$ as he,Fr as L,J as R,Mr as ge,Nr as _e,Y as ve,Z as ye,at as be,ct as xe,et as z,it as B,lt as Se,nt as Ce,q as we,r as Te,rt as V,st as Ee,tt as De}from"./index-CKdLDmIt.js";import{t as H}from"./NodeAddonsSettingsPanel-fFZ1L1c0.js";s();var U=[[[`addons`,`listCapabilityProviders`]],[[`addons`,`list`]]],W=`text-[10px]`;function Oe({isActive:e}){let{t}=F();return i(S,{variant:e?`success`:`default`,className:W,children:e?t(`integrationHub.addonControls.enabled`,`Enabled`):t(`integrationHub.addonControls.disabled`,`Disabled`)})}function G({capName:t,addonId:n,isActive:r}){let{t:a}=F(),o=l(),s=E({onSuccess:()=>{for(let e of U)o.invalidateQueries({queryKey:e})}}),c=s.isPending;return e(N,{size:`sm`,variant:r?`secondary`:`primary`,disabled:c,onClick:()=>s.mutate({capName:t,addonId:n,enabled:!r}),children:[c?i(v,{className:`h-3 w-3 animate-spin`}):i(r?_:g,{className:`h-3 w-3`}),r?a(`common.disable`,`Disable`):a(`common.enable`,`Enable`)]})}function K(){let e=l();return k({onSuccess:()=>{for(let t of U)e.invalidateQueries({queryKey:t})}})}function q({addonId:e,displayName:t,message:n}){let{t:r}=F(),a=re(),o=K();return i(O,{icon:o.isPending?v:p,variant:`ghost`,size:`sm`,"aria-label":r(`integrationHub.addonControls.restartNamed`,`Restart {{name}}`,{name:t}),disabled:o.isPending,onClick:()=>void a({title:r(`integrationHub.addonControls.restart2`,`Restart "{{displayName}}"?`,{displayName:t}),message:n,confirmLabel:r(`integrationHub.addonControls.restart`,`Restart`),variant:`danger`}).then(t=>t?o.mutateAsync({addonId:e}):void 0)})}function ke({addonId:e,displayName:t,iconOnly:n=!1,description:r}){let{t:a}=F(),o=K(),s=r??a(`integrationHub.addonControls.restartingTheAddonBouncesIts`,`Restarting the addon bounces its subprocess — the provider will briefly drop and reconnect automatically.`);return n?i(q,{addonId:e,displayName:t,message:s}):i(M,{label:a(`integrationHub.addonControls.restart`,`Restart`),icon:p,size:`sm`,title:a(`integrationHub.addonControls.restart2`,`Restart "{{displayName}}"?`,{displayName:t}),description:s,confirmLabel:a(`integrationHub.addonControls.restart`,`Restart`),triggerVariant:`ghost`,confirmVariant:`danger`,disabled:o.isPending,action:()=>o.mutateAsync({addonId:e})})}var J=600,Y=c(null);function X({id:n,title:r,icon:a,actions:o,framed:s=!1,children:c}){let{t:l}=F(),f=d(Y),p=t(null),m=`integration-section-${n}`;Z(p,f,n);let g=e(u,{children:[f===null?null:i(L,{to:f.sectionHref(n),"aria-label":l(`integrationHub.integrationSection.linkTo`,`Link to {{title}}`,{title:r}),title:l(`integrationHub.integrationSection.linkTo`,`Link to {{title}}`,{title:r}),className:`rounded p-0.5 text-foreground-subtle/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40`,children:i(ee,{className:`h-3 w-3`,"aria-hidden":!0})}),o]});return s?i(`div`,{ref:p,className:`scroll-mt-4`,children:i(ce,{headingId:m,title:r,icon:a,actions:g,children:c})}):e(`section`,{ref:p,"aria-labelledby":m,className:`scroll-mt-4 space-y-2`,children:[e(`header`,{className:`flex min-h-7 flex-wrap items-center gap-2 px-0.5`,children:[a!==void 0&&i(a,{className:`h-3.5 w-3.5 shrink-0 text-foreground-subtle`,"aria-hidden":!0}),i(`h2`,{id:m,className:`${h} min-w-0 flex-1`,children:r}),g]}),c]})}function Z(e,t,n){let r=t?.requestedSection===n,i=t?.integrationId;a(()=>{if(!r)return;let t=()=>e.current?.scrollIntoView?.({block:`start`});t();let n=!1,i=()=>{n=!0},a=[`wheel`,`touchmove`,`keydown`];for(let e of a)window.addEventListener(e,i,{once:!0,passive:!0});let o=window.setTimeout(()=>{n||t()},J);return()=>{window.clearTimeout(o);for(let e of a)window.removeEventListener(e,i)}},[r,i,e])}s();var Q=`max-h-72`,$=[{kind:`logs`,labelKey:`common.logs`,icon:y},{kind:`events`,labelKey:`common.events`,icon:ne}];function Ae({addonId:t,switcher:n}){let{t:r}=F(),[a,s]=o(`logs`);return e(X,{id:Te,title:r(`integrationHub.addonIntegrationBody.activity`,`Activity`),framed:!0,actions:i(`div`,{className:`flex flex-wrap items-center gap-2`,children:i(`div`,{role:`group`,"aria-label":r(`integrationHub.addonIntegrationBody.activityStream`,`Activity stream`),className:`flex items-center gap-1`,children:$.map(({kind:t,labelKey:n,icon:o})=>e(N,{variant:`unstyled`,type:`button`,"aria-pressed":a===t,onClick:()=>s(t),className:`inline-flex items-center gap-1 rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${a===t?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground`}`,children:[i(o,{className:`h-3 w-3`,"aria-hidden":!0}),r(n)]},t))})}),children:[n!==void 0&&i(`div`,{className:`px-3 pt-2`,children:n}),a===`logs`?i(D,{addonId:t,maxHeight:Q,showFilters:!1}):i(A,{addonId:t,category:`addon.*`,maxHeight:Q})]})}function je({addonId:t,title:n=`Settings`,subtitle:r,fieldScope:a,onClose:o}){return i(w,{open:!0,onOpenChange:e=>!e&&o(),children:e(C,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,className:`md:max-w-3xl`,children:[e(P,{children:[i(x,{children:n}),r&&i(`p`,{className:`text-xs text-foreground-subtle`,children:r})]}),i(se,{children:i(H,{nodeId:null,addonIds:[t],level:`global`,...a===void 0?{}:{fieldScope:a}})})]})})}function Me({addonId:e,title:t,onClose:n}){return i(je,{addonId:e,title:t,fieldScope:`cluster`,onClose:n})}var Ne=`inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-full border py-1 pl-1 pr-2.5 text-xs transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40`,Pe=`border-primary bg-primary/10 text-primary font-medium`,Fe=`border-border bg-surface text-foreground-subtle hover:bg-surface-hover hover:text-foreground`;s();var Ie={md:{tile:`h-10 w-10 rounded-lg`,img:`h-7 w-7 rounded-md p-1`,fallback:`h-5 w-5`},sm:{tile:`h-5 w-5 rounded`,img:`h-5 w-5 rounded p-0.5`,fallback:`h-3.5 w-3.5`}};function Le({addonId:e,fallback:t,tileClassName:n,size:r=`md`}){let[a,s]=o(!1),c=I(e),l=Ie[r];return i(`div`,{className:`${l.tile} flex items-center justify-center shrink-0 ${n}`,children:a||!c?i(t,{className:l.fallback,"aria-hidden":!0}):i(`img`,{src:c,alt:``,className:`${l.img} bg-white ring-1 ring-black/5`,onError:()=>s(!0)})})}var Re={ok:`bg-success`,off:`bg-foreground-subtle/60`,error:`bg-danger`,unknown:`border border-foreground-subtle bg-transparent`};function ze(e,t){switch(t){case`ok`:return e(`instances.health.ok`,`Healthy`);case`error`:return e(`instances.health.error`,`Error`);case`off`:return e(`instances.health.off`,`Off`);case`unknown`:return e(`instances.health.unknown`,`Unknown`)}}function Be({pills:t,selected:n,onSelect:r,fallbackIcon:a,install:o}){let{t:s}=F(),c=t.length>1;return!c&&o===void 0?null:i(`div`,{className:`px-3 pt-2`,children:e(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[c&&i(`div`,{role:`group`,"aria-label":s(`instances.filterByProvider`,`Filter by provider`),className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:t.map(t=>e(N,{variant:`unstyled`,type:`button`,"aria-pressed":n===t.addonId,"data-testid":`instance-pill-${t.addonId}`,onClick:()=>r(n===t.addonId?null:t.addonId),className:`inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-full border py-1 pl-1 pr-2.5 text-xs transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 ${n===t.addonId?`border-primary bg-primary/10 text-primary font-medium`:`border-border bg-surface text-foreground-subtle hover:bg-surface-hover hover:text-foreground`}`,children:[i(Le,{addonId:t.addonId,fallback:a,tileClassName:``,size:`sm`}),i(`span`,{className:`truncate`,children:t.name}),i(`span`,{className:`shrink-0 text-[10px] font-normal text-foreground-subtle`,children:t.count}),i(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full ${Re[t.health]}`,"aria-hidden":!0}),i(`span`,{className:`sr-only`,children:ze(s,t.health)})]},t.addonId))}),o!==void 0&&e(L,{to:b(o.capability),className:`inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-full border py-1 pl-1 pr-2.5 text-xs transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 border-dashed border-border pl-2 text-foreground-subtle hover:border-primary/50 hover:text-foreground`,children:[i(m,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),i(`span`,{className:`truncate`,children:o.label})]})]})})}function Ve({providers:t,title:n,onPick:r,onCancel:a}){let{t:o}=F();return e(oe,{open:!0,onClose:a,title:n,width:`lg`,children:[i(`p`,{className:`mb-3 text-xs text-foreground-muted`,children:o(`providerInstances.pickProvider`,`Choose which provider the new one belongs to.`)}),i(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-2`,children:t.map(t=>e(`button`,{type:`button`,onClick:()=>r(t.addonId),className:`flex flex-col items-start gap-1 rounded-lg border border-border bg-surface px-3 py-3 text-left text-xs transition-colors hover:border-primary/50 hover:bg-surface-hover`,children:[i(`span`,{className:`font-medium text-foreground`,children:t.name}),t.description.length>0&&i(`span`,{className:`line-clamp-2 text-[11px] text-foreground-subtle`,children:t.description})]},t.addonId))})]})}function He(e){let t=T({onSuccess:e.onSuccess});return{mutate:e=>t.mutate({...e}),isPending:t.isPending}}s();var Ue=`instance`;function We(e){let t=[e.status?.detail,e.lastCheckedAt===void 0?void 0:new Date(e.lastCheckedAt).toLocaleString()].filter(e=>e!==void 0&&e.length>0);return t.length>0?t.join(` · `):void 0}function Ge({row:t}){let{t:n}=F();return t.enabled?e(`span`,{className:`flex flex-wrap items-center gap-1`,children:[i(S,{variant:t.configured?`success`:`default`,children:t.configured?n(`providerInstances.configured`,`Configured`):n(`providerInstances.notConfigured`,`Not configured`)}),t.status!==void 0&&i(S,{variant:t.status.state===`error`?`danger`:t.status.state===`ok`?`success`:`default`,title:We(t),children:B(t.status)})]}):i(`span`,{className:`flex flex-wrap items-center gap-1`,children:i(S,{variant:`default`,children:n(`providerInstances.off`,`Off`)})})}function Ke({row:t,pinning:n}){let{t:r}=F(),a=l(),o=He({onSuccess:()=>void a.invalidateQueries({queryKey:[R]})});return e(`span`,{className:`flex flex-col gap-1`,children:[i(j,{checked:t.enabled,disabled:o.isPending,"aria-label":r(`providerInstances.enable`,`Enable {{name}}`,{name:t.name}),onCheckedChange:e=>o.mutate({addonId:t.addonId,id:t.id,enabled:e})}),n>0&&i(`span`,{className:`text-[11px] text-foreground-subtle`,children:r(`providerInstances.pinnedBy`,{count:n})})]})}function qe({row:e,functionCap:t}){let{t:n}=F(),r=l(),a=E({onSuccess:()=>void r.invalidateQueries()});return i(j,{checked:e.isActive,disabled:a.isPending,"aria-label":n(`providerInstances.enable`,`Enable {{name}}`,{name:e.providerName}),onCheckedChange:n=>a.mutate({capName:t,addonId:e.addonId,enabled:n})})}function Je({functionCap:t,icon:a,title:s,subtitle:c,emptyTitle:d,emptyDescription:p,addLabel:h,install:ne,extraColumns:_,lead:y,rowActions:b,canDelete:x,pageActions:oe,typedId:se,rowFilter:C}){let{t:w}=F(),T=ie(),E=l(),D=re(),k=ve(t),A=me({editKey:Ue,newKey:`${Ue}-new`}),[j,M]=o(null),[P,I]=o(null),L=ue({functionCap:`notification-output`}),B=r(e=>be(L.data??[],e).length,[L.data]),[we,Te]=o(null),[V,De]=o(null),H=n(()=>ye(k.holders),[k.holders]),U=n(()=>Ce(k.functionProviders,k.rows,k.displayNames),[k.functionProviders,k.rows,k.displayNames]),W=U.some(e=>e.addonId===V)?V:null,Oe=n(()=>{let e=he(k.rows,W);return C===void 0?e:e.filter(C)},[k.rows,W,C]),G=r(e=>k.displayNames.get(e)??e,[k.displayNames]),K=r(async e=>{M(e.key),I(null);try{let t=await T.trpcClient.integrationInstances.testInstance.mutate({addonId:e.addonId,id:e.id,values:{}});I({name:e.name,verdict:Se(t)})}catch(t){let n=t instanceof Error?t.message:String(t);I({name:e.name,verdict:{status:`inconclusive`,error:n}})}finally{M(null)}},[T]),q=r(async e=>{let t=be(L.data??[],e.id),n=t.length>0?` ${w(`providerInstances.deletePinned`,`These notification targets use it and will stop delivering: {{names}}.`,{names:t.join(`, `)})}`:``;if(await D({title:w(`providerInstances.deleteTitle`,`Delete {{name}}?`,{name:e.name}),message:`${w(`providerInstances.deleteMessage`,`The record and its stored credentials are removed.`)}${n}`,confirmLabel:w(`common.delete`,`Delete`),variant:`danger`}))try{await T.trpcClient.integrationInstances.deleteInstance.mutate({addonId:e.addonId,id:e.id}),await E.invalidateQueries({queryKey:[R]})}catch(t){Ee({title:w(`providerInstances.deleteFailed`,`Could not delete`),message:`${e.name}: ${t instanceof Error?t.message:String(t)}`,severity:`critical`})}},[D,E,T,w,L.data]),J=n(()=>k.rows.some(e=>e.kind===`instance`&&e.kindLabel!==void 0),[k.rows]),Y=r((e,t)=>{e!==void 0&&_e(ge(e,t),()=>{E.invalidateQueries({queryKey:[R]})})},[E]),X=n(()=>[{key:`name`,nowrap:!1,header:w(`providerInstances.colName`,`Name`),sortValue:e=>e.name,render:t=>e(`span`,{className:`flex flex-col`,children:[i(`span`,{className:`font-medium ${t.kind===`instance`&&!t.enabled?`text-foreground-muted`:`text-foreground`}`,children:t.name}),t.kind===`fixed`&&t.description.length>0&&i(`span`,{className:`line-clamp-2 text-[11px] text-foreground-subtle`,title:t.description,children:t.description})]})},{key:`provider`,header:w(`providerInstances.colProvider`,`Provider`),sortValue:e=>e.providerName,render:e=>i(`span`,{className:`text-foreground-muted`,children:e.providerName})},...J?[{key:`kind`,header:w(`providerInstances.colKind`,`Kind`),sortValue:e=>e.kind===`instance`?e.kindLabel??``:``,render:e=>i(`span`,{className:`text-foreground-muted`,children:e.kind===`instance`?e.kindLabel??``:``})}]:[],{key:`state`,header:w(`instances.colStatus`,`Status`),notSortableReason:w(`providerInstances.stateNotSortable`,`A row carries a badge, not a value to order by.`),render:e=>e.kind===`instance`?i(Ge,{row:e}):i(S,{variant:e.isActive?`success`:`default`,children:e.isActive?w(`instances.active`,`Active`):w(`providerInstances.off`,`Off`)})},{key:`on`,header:w(`providerInstances.colOn`,`On`),notSortableReason:w(`providerInstances.onNotSortable`,`A switch is not a value to order by.`),render:e=>e.kind===`fixed`?i(qe,{row:e,functionCap:t}):i(Ke,{row:e,pinning:B(e.id)})},..._??[],{key:`actions`,align:`right`,notSortableReason:w(`providerInstances.actionsNotSortable`,`Row actions are not values.`),render:t=>e(`span`,{className:`inline-flex items-center gap-1`,children:[t.kind===`instance`&&t.connectPath!==void 0&&i(O,{icon:ee,variant:`ghost`,size:`sm`,"aria-label":w(`providerInstances.connectRow`,`Connect {{name}}`,{name:t.name}),onClick:()=>Y(t.connectPath,t.id)}),t.kind===`instance`&&t.disconnectPath!==void 0&&i(O,{icon:ae,variant:`ghost`,size:`sm`,"aria-label":w(`providerInstances.disconnectRow`,`Disconnect {{name}}`,{name:t.name}),onClick:()=>Y(t.disconnectPath,t.id)}),t.kind===`instance`&&t.canTest&&i(O,{icon:j===t.key?v:g,variant:`ghost`,size:`sm`,"aria-label":w(`providerInstances.testRow`,`Test {{name}}`,{name:t.name}),disabled:j!==null,onClick:()=>void K(t)}),t.kind===`instance`&&b?.(t),i(O,{icon:te,variant:`ghost`,size:`sm`,"aria-label":w(`providerInstances.editRow`,`Edit {{name}}`,{name:t.name}),onClick:()=>A.openEdit(z(t.addonId,t.kind===`instance`?t.id:void 0))}),i(ke,{iconOnly:!0,addonId:t.addonId,displayName:t.providerName,description:w(`providerInstances.restartConfirm`,`Restarts the addon on the hub. If it shares a runner group, every addon in that group restarts with it.`)}),t.kind===`instance`&&(x?.(t)??!0)&&i(O,{icon:f,variant:`ghost`,size:`sm`,"aria-label":w(`providerInstances.deleteRow`,`Delete {{name}}`,{name:t.name}),onClick:()=>void q(t)})]})}],[_,A,t,B,b,x,q,Y,K,J,w,j]),Z;Z=k.state===`error`?i(`div`,{className:`p-3`,children:i(le,{title:w(`providerInstances.loadFailed`,`Could not load the list`),message:k.error??``,onRetry:k.refetch})}):k.state===`pending`?e(`div`,{className:`flex items-center gap-2 p-3 text-xs text-foreground-subtle`,children:[i(v,{className:`h-3 w-3 animate-spin`}),w(`providerInstances.loading`,`Loading…`)]}):k.rows.length===0?i(fe,{icon:a,title:d,description:p}):i(de,{columns:X,rows:Oe,rowKey:e=>e.key,bordered:!1,emptyMessage:w(`instances.noneForProvider`,`This provider has no instance yet.`)});let Q=k.holders.filter(e=>!H.includes(e)).map(e=>G(e.addonId)),$=H.length>0?void 0:Q.length>0?w(`instances.addBlocked`,`{{names}}: only one instance is allowed and it already exists.`,{names:Q.join(`, `)}):w(`instances.addNone`,`No provider here can hold instances.`);return e(ce,{headingId:`provider-instances-${t}`,title:s,icon:a,children:[i(`p`,{className:`px-3 pt-2 text-xs text-foreground-muted`,children:c}),k.state===`ready`&&$!==void 0&&i(`p`,{className:`px-3 pt-1 text-[11px] text-foreground-subtle`,children:$}),k.state===`ready`&&e(u,{children:[e(pe,{children:[oe?.(k.rows.filter(e=>e.kind===`instance`)),e(N,{size:`sm`,variant:`primary`,disabled:$!==void 0,title:$,onClick:()=>{let e=H.find(e=>e.addonId===W)??(H.length===1?H[0]:void 0);e===void 0?A.openNew():A.openEdit(z(e.addonId,null))},children:[i(m,{className:`h-3.5 w-3.5`}),h]})]}),i(Be,{pills:U,selected:W,onSelect:De,fallbackIcon:a,...ne===void 0?{}:{install:ne}})]}),Z,k.state===`ready`&&k.rows.length>0&&i(Ye,{rows:k.rows,selected:we,onSelect:Te}),P!==null&&e(`div`,{className:`space-y-1 p-3`,children:[i(`p`,{className:`text-[11px] font-medium text-foreground`,children:P.name}),i(xe,{verdict:P.verdict})]}),k.state===`ready`&&A.state.mode===`new`&&i(Ve,{title:h,providers:H.map(e=>({addonId:e.addonId,name:G(e.addonId),description:k.descriptions.get(e.addonId)??``})),onPick:e=>A.openEdit(z(e,null)),onCancel:A.close}),k.state===`ready`&&A.state.mode===`edit`&&i(Xe,{refValue:A.state.id,data:k,nameOf:G,onClose:A.close,onOpen:(e,t)=>A.openEdit(z(e,t)),...y===void 0?{}:{lead:y},...se===void 0?{}:{typedId:se}},A.state.id)]})}function Ye({rows:e,selected:t,onSelect:r}){let{t:a}=F(),o=n(()=>V(e),[e]),s=o[0];if(s===void 0)return null;let c=o.find(e=>e.addonId===t)??s;return i(`div`,{className:`p-3`,children:i(Ae,{addonId:c.addonId,switcher:o.length>1?i(`div`,{role:`group`,"aria-label":a(`providerInstances.activityProvider`,`Activity of`),className:`flex flex-wrap items-center gap-1`,children:o.map(e=>i(N,{variant:`unstyled`,type:`button`,"aria-pressed":e.addonId===c.addonId,onClick:()=>r(e.addonId),className:`rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${e.addonId===c.addonId?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground`}`,children:e.name},e.addonId))}):void 0})})}function Xe({refValue:e,data:t,nameOf:n,onClose:r,onOpen:a,lead:o,typedId:s}){let c=De(e);if(c.kind===`fixed`)return i(Me,{addonId:c.addonId,title:n(c.addonId),onClose:r});let l=t.holders.find(e=>e.addonId===c.addonId);if(l===void 0)return null;let u=c.kind===`instance`?l.instances.find(e=>e.id===c.id)??null:null;if(c.kind===`instance`&&u===null)return null;let d=t.rows.find(e=>e.kind===`instance`&&e.addonId===c.addonId&&e.id===u?.id);return i(Ze,{addonId:c.addonId,...o!==void 0&&d!==void 0?{lead:o(d)}:{},providerName:n(c.addonId),description:l.description,instance:u,onClose:r,onOpen:a,...s===void 0?{}:{typedId:s}})}function Ze(e){let{onOpen:n,onClose:r,onSaved:a,...o}=e,s=t(null),c=e.instance===null;return i(we,{...o,onSaved:e=>{c&&(s.current=e),a?.(e)},onClose:()=>{s.current===null?r():n(e.addonId,s.current)}})}export{Fe as a,Y as c,ke as d,W as f,Pe as i,G as l,Le as n,Ae as o,Ne as r,X as s,Je as t,Oe as u};
|