@camstack/addon-admin-ui 1.2.604 → 1.2.606
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 +14 -0
- package/dist/assets/Addons-DwdVdYn5.js +5 -0
- package/dist/assets/{AdminPage-B9sdR6yD.js → AdminPage-qR6elCnl.js} +1 -1
- package/dist/assets/{AdminSectionedPage-Di2VI8A1.js → AdminSectionedPage-6893SaIU.js} +1 -1
- package/dist/assets/{AiProfiles-DwQZldFN.js → AiProfiles-qBmxjey8.js} +2 -2
- package/dist/assets/{Authentication-CMBgIYCp.js → Authentication-CDgdDuh0.js} +1 -1
- package/dist/assets/{Build-BPF-jpLK.js → Build-DaOoHR-6.js} +3 -3
- package/dist/assets/{Calendars-lddz6ZEe.js → Calendars-BGQ8HwrY.js} +1 -1
- package/dist/assets/CameraGrids-UIVs5OTB.js +1 -0
- package/dist/assets/{Cluster-De1RL3Fs.js → Cluster-D2l7vSfX.js} +1 -1
- package/dist/assets/{CompositionBlockEditor-B0oU4gJG.js → CompositionBlockEditor-CSCK2rCI.js} +2 -2
- package/dist/assets/{CompositionEditorPage-o4_rUh83.js → CompositionEditorPage-D2LWLo3H.js} +1 -1
- package/dist/assets/{Data-BrdEF29B.js → Data-BVrTjAgG.js} +2 -2
- package/dist/assets/{DeviceDetail-BZUd-DAf.js → DeviceDetail-CDHbp6Im.js} +2 -2
- package/dist/assets/{DeviceDoActionFields-BPsB-f31.js → DeviceDoActionFields-NY7wB-VN.js} +1 -1
- package/dist/assets/{Devices-DmDA_J0U.js → Devices-BPiNbgT8.js} +1 -1
- package/dist/assets/{EditTemplateButton-Bazz4Pt4.js → EditTemplateButton-B8SCTea8.js} +1 -1
- package/dist/assets/{EmbedPlayerPage-B28rSWqV.js → EmbedPlayerPage--uqLrJXG.js} +1 -1
- package/dist/assets/History-BP-AB2nV.js +1 -0
- package/dist/assets/Identity-CocJq58e.js +1 -0
- package/dist/assets/InstancesTable-CgR4OQbD.js +1 -0
- package/dist/assets/IntegrationDetail-puYzC2ri.js +1 -0
- package/dist/assets/{IntegrationHub-DwJAPbKr.js → IntegrationHub-50C35JXv.js} +1 -1
- package/dist/assets/{Integrations-Be3dLjNq.js → Integrations-DJpMIOMj.js} +1 -1
- package/dist/assets/{Integrations-BWF9wcWz.js → Integrations-qPptabot.js} +2 -2
- package/dist/assets/{Library-CvnIw7kn.js → Library-BJHez0dz.js} +1 -1
- package/dist/assets/{Locations-BMg1Zl7f.js → Locations-BAf5NoRS.js} +1 -1
- package/dist/assets/{Logs-CLzySzHb.js → Logs-LsCNqILy.js} +1 -1
- package/dist/assets/{MaskShapeCanvas-DfSAMcgB.js → MaskShapeCanvas-D1jjdVSr.js} +1 -1
- package/dist/assets/{MotionZonesSettings-lq8C670W.js → MotionZonesSettings-DiIPf88t.js} +1 -1
- package/dist/assets/MyAccess-D4Hu1xA1.js +2 -0
- package/dist/assets/{Network-whsaEkOS.js → Network-CRa159Fl.js} +1 -1
- package/dist/assets/{NodeAddonsSettingsPanel-B8UxjFBZ.js → NodeAddonsSettingsPanel-hPglGkot.js} +1 -1
- package/dist/assets/{Notifications-CurhviRP.js → Notifications-CLYFpSJP.js} +1 -1
- package/dist/assets/{Pipeline-C2akOMKR.js → Pipeline-CawM5bRg.js} +1 -1
- package/dist/assets/{PrivacyMaskSettings-Cp5Q0GE2.js → PrivacyMaskSettings-tg9GXaVS.js} +1 -1
- package/dist/assets/Recordings-CRp_FkXE.js +1 -0
- package/dist/assets/{ScanSubnetEditor-lKcDCgXF.js → ScanSubnetEditor-DN3Ie7Og.js} +1 -1
- package/dist/assets/{SceneMonitorEditor-D4HtqSC1.js → SceneMonitorEditor-CINJ-4Mp.js} +1 -1
- package/dist/assets/SessionsList-DwHQoi9f.js +2 -0
- package/dist/assets/{Showroom-C25UNaak.js → Showroom-DMiHvqBS.js} +1 -1
- package/dist/assets/StorageLocationsTable-Cd_oXHgn.js +1 -0
- package/dist/assets/{System-DXfDAESB.js → System-C4UGj5Nu.js} +1 -1
- package/dist/assets/{Templates-C-6WUOdi.js → Templates-mjnjZIoX.js} +1 -1
- package/dist/assets/{Terminal-DNZoAT74.js → Terminal-BRS-F-xZ.js} +3 -5
- package/dist/assets/{TrainingProviders-CRP4iTuX.js → TrainingProviders-Sy1iY23E.js} +1 -1
- package/dist/assets/{Viewer-CVu0k37l.js → Viewer-D8XgtpH4.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-PiMYY04-.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-Dx3SvE4V.js} +1 -1
- package/dist/assets/{addon-icons-context-DzG39awM.js → addon-icons-context-DihpM3HF.js} +1 -1
- package/dist/assets/{ai-page.helpers-tWf2BKhe.js → ai-page.helpers-BrgCvprD.js} +1 -1
- package/dist/assets/{archive-7oqv5c2w.js → archive-B2eCCknS.js} +1 -1
- package/dist/assets/{assignment-candidates-B8uBn9td.js → assignment-candidates-C6YdocP-.js} +1 -1
- package/dist/assets/{authed-media-BsEr81QN.js → authed-media-C1aRt5ci.js} +1 -1
- package/dist/assets/{bell-off-CGgJclc7.js → bell-off-CHS3Aly3.js} +1 -1
- package/dist/assets/{board-model-UxhF05M4.js → board-model-C14bsdrK.js} +1 -1
- package/dist/assets/{boxes-B_Y4V3Ek.js → boxes-DftcHvx4.js} +1 -1
- package/dist/assets/{calendar-clock-B0-YSjGo.js → calendar-clock-DHLZaiyj.js} +1 -1
- package/dist/assets/circle-slash-C5yZWtgS.js +1 -0
- package/dist/assets/client-DTyBaAoV.js +809 -0
- package/dist/assets/{create-composition-DhUup0uF.js → create-composition-gstr8g_x.js} +2 -2
- package/dist/assets/crop-CvVxDKo4.js +1 -0
- package/dist/assets/{database-zap-BC8v5Gc5.js → database-zap-B8fphlJj.js} +1 -1
- package/dist/assets/{device-integration-icon-Cvjh6ihp.js → device-integration-icon-Cap0VdNl.js} +1 -1
- package/dist/assets/device-picker-model-DgL25n41.js +1 -0
- package/dist/assets/dist-B57q2s8O.js +809 -0
- package/dist/assets/{dist-BZOmaLJ2.js → dist-CIX_FLwE.js} +1 -1
- package/dist/assets/{eraser-BN9Jm7v9.js → eraser-DnVOOBJ7.js} +1 -1
- package/dist/assets/{file-up-D3z4d_SX.js → file-up-CS3QVGu0.js} +1 -1
- package/dist/assets/{format-kc3FiPSl.js → format-Ch0AKvVb.js} +1 -1
- package/dist/assets/{grip-vertical-CVi57Mnf.js → grip-vertical-Dx0Aqv-v.js} +1 -1
- package/dist/assets/{hard-drive-download-XJqU5Yhh.js → hard-drive-download-BL7h_atC.js} +1 -1
- package/dist/assets/{hostInit-D412Cho_.js → hostInit-BpnP417g.js} +1 -1
- package/dist/assets/i18n-BETemoOB.js +1 -0
- package/dist/assets/{icons-DZNWg00W.js → icons-C5yBX8zj.js} +1 -1
- package/dist/assets/index-Cr7bUFvd.js +4 -0
- package/dist/assets/{key-CXhExtg1.js → key-KMleps0f.js} +1 -1
- package/dist/assets/{key-square-OYFlMu43.js → key-square-CknpM0L_.js} +1 -1
- package/dist/assets/{layers-B8emxX0I.js → layers-CA0xrUXV.js} +1 -1
- package/dist/assets/{link-2-off-C4UZJh-L.js → link-2-off-I79TL553.js} +1 -1
- package/dist/assets/{linked-devices-model-DIyr-r0R.js → linked-devices-model-Di0tfcU-.js} +1 -1
- package/dist/assets/{list-ordered-COE9JhoK.js → list-ordered-H5cpKqfQ.js} +1 -1
- package/dist/assets/{memory-stick-DxMJDVF9.js → memory-stick-BYu3Pl2-.js} +1 -1
- package/dist/assets/{message-square-plus-mfEtoXqX.js → message-square-plus-C-VzE-nz.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-4af06987.js → mf-entry-bootstrap-0-09df2f33.js} +2 -2
- package/dist/assets/{mic-off-chy45-le.js → mic-off-BB0y3SKK.js} +1 -1
- package/dist/assets/{monitor-off-CYZktw89.js → monitor-off-CeTiFn5M.js} +1 -1
- package/dist/assets/{monitor-smartphone-Cla2sWWl.js → monitor-smartphone-DiwqWkLr.js} +1 -1
- package/dist/assets/mount-DgL25n41.js +1 -0
- package/dist/assets/{notification-rule-status-CX6NUm4f.js → notification-rule-status-BaNEQqyB.js} +1 -1
- package/dist/assets/{player-overlays-Dikds8gI.js → player-overlays-BDeIsXux.js} +1 -1
- package/dist/assets/remoteEntry-C_e5pzbe.js +1 -0
- package/dist/assets/{ruler-Bc_pxTOp.js → ruler-Cuy2zovK.js} +1 -1
- package/dist/assets/{scan-eye-BUPnUTKr.js → scan-eye-BuWxqByv.js} +1 -1
- package/dist/assets/{scissors-DdbRlSDX.js → scissors-BJTb03-b.js} +1 -1
- package/dist/assets/{search-x-eS925uQD.js → search-x-D8VnLXBR.js} +1 -1
- package/dist/assets/{send-BHWiY78y.js → send-B00RXUVi.js} +1 -1
- package/dist/assets/{settings-2-CyRa-bUA.js → settings-2-C90cMzQT.js} +1 -1
- package/dist/assets/{shapes-C9UDTqdB.js → shapes-CBF9943U.js} +1 -1
- package/dist/assets/{sigma-D5JGGdP2.js → sigma-CJJT2Cam.js} +1 -1
- package/dist/assets/{speaker-Cl3Koi46.js → speaker-B5S7k0DT.js} +1 -1
- package/dist/assets/src-Da4HIMZv.js +100 -0
- package/dist/assets/{sso-popup-BaK-NY5x.js → sso-popup-DF07jkOe.js} +1 -1
- package/dist/assets/{step-inspector-model-BDAJBL2T.js → step-inspector-model-Czc1qNL0.js} +1 -1
- package/dist/assets/{table-2-BV86FpaK.js → table-2-l7PUi3h6.js} +1 -1
- package/dist/assets/{timer-reset-CQFbOsih.js → timer-reset-DqOUz58T.js} +1 -1
- package/dist/assets/{unlink-CO3ZHU5X.js → unlink-Bj6T0cfp.js} +1 -1
- package/dist/assets/{usb-Ib0Kj-IW.js → usb-7d2iIO7E.js} +1 -1
- package/dist/assets/{use-device-bound-caps-WSOdDrrB.js → use-device-bound-caps-Davivnb7.js} +1 -1
- package/dist/assets/{use-scenes-feed-BydEv6TD.js → use-scenes-feed-DpaATilO.js} +1 -1
- package/dist/assets/{use-stationary-objects-CcgUGmNJ.js → use-stationary-objects-Cu-P84Mj.js} +1 -1
- package/dist/assets/{useAdminDeviceRemoval-BdSgd4AO.js → useAdminDeviceRemoval-COqvh6I9.js} +1 -1
- package/dist/assets/useEventInvalidation-DgL25n41.js +1 -0
- package/dist/assets/{useNodeUrlSelection-mzzzEn3T.js → useNodeUrlSelection-DSNzRVoI.js} +1 -1
- package/dist/assets/user-round-BvKrqouP.js +1 -0
- package/dist/assets/{user-x-CUrAwpls.js → user-x-CK_55Ufn.js} +1 -1
- package/dist/assets/{variable-COKKMJbR.js → variable-qhs89ABT.js} +1 -1
- package/dist/assets/{video-BSNDvfCe.js → video-BMbZ77OA.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-De1PJyhy.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-tmFYPP3M.js} +2 -2
- package/dist/index.html +10 -10
- package/dist/server/addon.js +3 -72
- package/package.json +2 -2
- package/dist/assets/Addons-cMrauTBc.js +0 -5
- package/dist/assets/History-BQYmqLbi.js +0 -1
- package/dist/assets/Identity-DZe6EnfF.js +0 -1
- package/dist/assets/InstancesTable-tMHEIn4o.js +0 -1
- package/dist/assets/IntegrationDetail-DbyHZmhw.js +0 -1
- package/dist/assets/MyAccess-nVzeQLPF.js +0 -2
- package/dist/assets/Recordings-k9xWpSTi.js +0 -1
- package/dist/assets/SessionsList-CxJU6jkU.js +0 -2
- package/dist/assets/StorageLocationsTable-BeMq-Y4a.js +0 -1
- package/dist/assets/circle-slash-CeIIQW23.js +0 -1
- package/dist/assets/client-C3Nr53Gn.js +0 -809
- package/dist/assets/crop-BCtCO5Qk.js +0 -1
- package/dist/assets/device-picker-model-TeZnNAB7.js +0 -1
- package/dist/assets/dist-Du8dfILw.js +0 -809
- package/dist/assets/i18n-ChjX2Pvm.js +0 -1
- package/dist/assets/index-Bec3SQjl.js +0 -4
- package/dist/assets/mount-TeZnNAB7.js +0 -1
- package/dist/assets/remoteEntry-4sXHM_Xw.js +0 -1
- package/dist/assets/src-VAvW-zoJ.js +0 -100
- package/dist/assets/useEventInvalidation-TeZnNAB7.js +0 -1
- package/dist/assets/user-round-C9-NR3Al.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,K as t,S as n,et as r}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{ut as i}from"./player-overlays-
|
|
1
|
+
import{C as e,K as t,S as n,et as r}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{ut as i}from"./player-overlays-BDeIsXux.js";import{_n as a,dn as o,fn as s,gn as c,hn as l,mn as u,pn as d,un as f}from"./client-DTyBaAoV.js";import{X as p,of as m}from"./src-Da4HIMZv.js";import{t as h}from"./i18n-BETemoOB.js";import{t as g}from"./useTranslation-BJr-n0es.js";import"./index-Cr7bUFvd.js";import{n as _,t as v}from"./use-device-bound-caps-Davivnb7.js";r();var y=`mt-1 w-full rounded border border-border bg-background px-2 py-1 text-xs`,b=`block text-[11px] font-medium text-foreground`,x=`deviceId`;function S(e,t){return t.length===0?0:t.length===1?t[0]:t.find(t=>!e.includes(t))??t[t.length-1]}function C(e,t,n){if(t.length===0)return[];if(t.length===1)return t;let r=t.find(t=>!e.includes(t));if(r===void 0)return t;let i=n(r);if(i===void 0)return[r];let o=e[0]??t.find(e=>e!==r);if(o===void 0)return[r];let s=n(o);return s===void 0||!a(s,i)?[r]:t.filter(e=>{let t=n(e);return t!==void 0&&a(s,t)})}function w(e){return e.length===0?0:e.length===1?e[0]:[...e]}function T(e){return typeof e==`number`?e>0?[e]:[]:Array.isArray(e)?e.filter(e=>e>0):[]}function E(e,t){return{deviceId:e,cap:t.cap,method:t.method,...t.args===void 0?{}:{args:{...t.args}}}}function D(e,t){return h.t(`deviceDoAction.customLabel`,{name:`${e}.${t}`})}function O({value:r,onChange:h,devices:O,listState:k,fleet:A,allowTriggerDevice:j=!1,allowMultiSameFamily:M=!1,testId:N=`device-do-action`}){let{t:P}=g(),F=typeof r.deviceId!=`number`&&!Array.isArray(r.deviceId),I=T(r.deviceId),L=t(()=>O.filter(e=>l(String(e.type??``))),[O]),R=t(()=>{let e=new Map;for(let t of L)t.type!==void 0&&t.type!==null&&e.set(t.id,String(t.type));return e},[L]),z=t(()=>{if(!M||I.length===0)return L;let e=R.get(I[0]);return e===void 0?L:L.filter(t=>{if(I.includes(t.id))return!0;let n=t.type!==void 0&&t.type!==null?String(t.type):void 0;return n!==void 0&&a(e,n)})},[M,I,L,R]),B=v(!M&&I.length===1?I[0]:0),V=_(M?I:[]),H=t(()=>F?d():I.length===0?[]:M?V.isLoading&&V.data===void 0?[]:s(I.map(e=>({boundCaps:V.data?.get(e),deviceType:R.get(e)}))):B.data===void 0&&B.isLoading?[]:o({boundCaps:B.data,deviceType:R.get(I[0])}),[F,I,M,V.data,V.isLoading,B.data,B.isLoading,R]),U=u(r.cap,r.method,r.args),W=c(r.cap,r.method,r.args),G=r.cap!==``&&r.method!==``&&W===null&&(F||I.length>0),K=M?V.isLoading:B.isLoading,q=M?V.isError:B.isError,J=e=>{if(e.startsWith(`custom:`))return;let t=f.find(t=>t.id===e);t!==void 0&&h(E(F?r.deviceId:I.length>0?w(I):L[0]?.id??0,t))};return e(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,"data-testid":N,children:[j&&e(`div`,{className:`w-full max-w-xs`,children:[n(`label`,{className:b,children:P(`deviceDoAction.deviceDoActionFields.target`,`Target`)}),e(i,{wrapperClassName:`inline-block w-auto`,className:y,"data-testid":`${N}-target`,value:F?`trigger`:`device`,onChange:e=>{if(e.target.value===`trigger`){h({deviceId:{$var:x},cap:``,method:``});return}h({deviceId:L[0]?.id??0,cap:``,method:``})},children:[n(`option`,{value:`device`,children:P(`deviceDoAction.deviceDoActionFields.specificDevice`,`Specific device`)}),n(`option`,{value:`trigger`,children:P(`deviceDoAction.deviceDoActionFields.theDeviceThatTriggeredThis`,`The device that triggered this run`)})]})]}),!F&&e(`div`,{"data-testid":`${N}-device`,children:[n(`label`,{className:b,children:P(`deviceDoAction.deviceLabel`,{count:M?2:1})}),n(p,{devices:z,listState:k,...A===void 0?{}:{fleet:A},value:[...I],onChange:e=>{h({deviceId:w(M?C(I,e,e=>R.get(e)):(()=>{let t=S(I,e);return t>0?[t]:[]})()),cap:``,method:``})},emptyLabel:M?`No devices selected`:`No device selected`,noun:`device`,testId:`${N}-device-picker`}),M&&I.length>1&&n(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:P(`deviceDoAction.deviceDoActionFields.sameFamilyOnlyTheAction`,`Same family only — the action runs on each selected device.`)})]}),e(`div`,{className:`w-full max-w-sm`,children:[n(`label`,{className:b,children:P(`deviceDoAction.deviceDoActionFields.action`,`Action`)}),e(i,{wrapperClassName:`inline-block w-auto`,className:y,"data-testid":`${N}-action`,value:U===`custom:${r.cap}.${r.method}`?U:W?.id??``,disabled:!F&&(I.length===0||K),onChange:e=>J(e.target.value),children:[n(`option`,{value:``,children:!F&&I.length===0?P(`deviceDoAction.deviceDoActionFields.pickADeviceFirst`,`Pick a device first`):K?P(`deviceDoAction.deviceDoActionFields.loadingActions`,`Loading actions…`):H.length===0?P(`deviceDoAction.deviceDoActionFields.noActionsForThisDevice`,`No actions for this device`):P(`deviceDoAction.deviceDoActionFields.selectAnAction`,`Select an action…`)}),G&&n(`option`,{value:U,children:D(r.cap,r.method)}),H.map(e=>n(`option`,{value:e.id,children:e.label},e.id))]}),q&&n(`p`,{className:`mt-1 text-[11px] text-warning`,children:P(`deviceDoAction.deviceDoActionFields.couldNotReadThisDevice`,`Could not read this device’s capabilities.`)})]}),W?.openArgs!==void 0&&W.openArgs.length>0&&n(`div`,{className:`flex flex-col gap-2`,children:W.openArgs.map(t=>{let i=r.args?.[t.key],a=typeof i==`string`||typeof i==`number`?String(i):``;return e(`div`,{className:`w-full max-w-sm`,children:[n(`label`,{className:b,htmlFor:`${N}-${t.key}`,children:t.label}),n(m,{id:`${N}-${t.key}`,className:y,"data-testid":`${N}-${t.key}`,type:t.kind===`number`?`number`:`text`,value:a,onChange:e=>{let n=e.target.value,i=r.args===void 0?{}:{...r.args};if(n===``)delete i[t.key];else if(t.kind===`number`){let e=Number(n);Number.isNaN(e)?delete i[t.key]:i[t.key]=e}else i[t.key]=n;h(Object.keys(i).length>0?{...r,args:i}:{deviceId:r.deviceId,cap:r.cap,method:r.method})}})]},t.key)})})]})}export{O as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,K as t,R as n,S as r,Y as i,et as a,o,x 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{Hi as c,Un as l,Ut as u,Wn as d,ht as f}from"./player-overlays-
|
|
1
|
+
import{C as e,K as t,R as n,S as r,Y as i,et as a,o,x 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{Hi as c,Un as l,Ut as u,Wn as d,ht as f}from"./player-overlays-BDeIsXux.js";import{Br as p,Fr as m,Ir as h,Jr as g,Ko as _,Mo as v,Pr as y,Qs as b,Ro as x,Ut as S,Wt as C,Yr as w,Zr as T,Zs as E,a as D,vi as O,zr as k}from"./src-Da4HIMZv.js";import{t as A}from"./useTranslation-BJr-n0es.js";import{H as j,Nr as M}from"./index-Cr7bUFvd.js";import{t as N}from"./AdminPage-qR6elCnl.js";import"./useEventInvalidation-DgL25n41.js";import{t as P}from"./useAdminDeviceRemoval-COqvh6I9.js";import{t as F}from"./device-integration-icon-Cap0VdNl.js";import{n as I}from"./addon-kind-filter-CEGKkC1O.js";a();function L(e,t){return e.filter(e=>e.canAdd).map(e=>({addonId:e.addonId,name:e.name,instances:t.filter(t=>t.addonId===e.addonId&&t.enabled&&t.info?.fixed!==!0)})).filter(e=>e.instances.length>0||!t.some(t=>t.addonId===e.addonId&&t.info?.fixed===!0)).sort((e,t)=>e.name.localeCompare(t.name))}function R(e,t){return`/integrations/${encodeURIComponent(e)}?instance=${encodeURIComponent(t)}&add=1`}function z(e){return`/integrations?setup=${encodeURIComponent(e)}`}function B({open:n,onClose:i}){let{t:a}=A(),o=M(),s=E(void 0,{enabled:n}),c=b(void 0,{enabled:n}),u=t(()=>s.data===void 0||c.data===void 0?null:L(s.data,c.data),[s.data,c.data]),d=s.isError||c.isError,f=e=>{i(),o(e)};return r(y,{open:n,onOpenChange:e=>!e&&i(),children:e(h,{width:`md`,placement:`sheet-on-mobile`,children:[r(k,{children:r(p,{children:a(`devices.addDevice.title`,`Add device`)})}),r(m,{children:d?r(g,{message:a(`devices.addDevice.loadFailed`,`Integrations could not be loaded.`),onRetry:()=>{s.refetch(),c.refetch()}}):u===null?e(`div`,{className:`space-y-2`,"data-testid":`add-device-pending`,children:[r(T,{className:`h-10 w-full`}),r(T,{className:`h-10 w-full`})]}):u.length===0?r(w,{icon:l,title:a(`devices.addDevice.noneTitle`,`No integration installed`),description:a(`devices.addDevice.noneDescription`,`Install an integration first, then add devices from it.`),action:r(O,{onClick:()=>f(I),children:a(`devices.browseIntegrations`,`Browse integrations`)})}):r(`ul`,{className:`space-y-1.5`,children:u.map(t=>t.instances.length===0?r(`li`,{children:e(O,{variant:`outline`,className:`w-full justify-between`,onClick:()=>f(z(t.addonId)),children:[r(`span`,{className:`truncate`,children:t.name}),r(`span`,{className:`text-foreground-subtle`,children:a(`devices.addDevice.setUp`,`Set up`)})]})},t.addonId):t.instances.map(n=>r(`li`,{children:e(O,{variant:`outline`,className:`w-full justify-between`,onClick:()=>f(R(t.addonId,n.id)),children:[r(`span`,{className:`truncate`,children:t.name}),n.name!==t.name&&r(`span`,{className:`truncate text-foreground-subtle`,children:n.name})]})},n.id)))})})]})})}var V=32;function H(e,t){let n=e=>t(e).kind===`orphan`,r=new Set;for(let t of e)n(t)&&r.add(t.id);let i=new Map;for(let t of e)i.set(t.id,t);let a=(e,t=0)=>{if(t>V)return!1;if(r.has(e.id))return!0;if(e.parentDeviceId==null)return!1;let n=i.get(e.parentDeviceId);return n?a(n,t+1):!1},o=[],s=[];for(let t of e)a(t)?s.push(t):o.push(t);return{activeDevices:o,orphanDevices:s}}a();function U(){let{t:a}=A(),p=M(),[m,h]=i(!1),g=f(),y=o();D([`deviceManager`],[`device.registered`,`device.unregistered`,`device.online`,`device.offline`,`device.disabled`,`device.enabled`]),D([`integrations`],[`integration.enabled`,`integration.disabled`,`integration.deleted`,`provider.started`,`provider.stopped`,`addon.installed`,`addon.uninstalled`,`addon.started`,`addon.stopped`]);let{data:w}=_({projection:`slim`}),{data:T}=b(void 0),E=P(),k=v({onSuccess:()=>{y.invalidateQueries({queryKey:[[`deviceManager`]]})}}),L=x({onSuccess:()=>{y.invalidateQueries({queryKey:[[`deviceManager`]]})}}),R=t(()=>w??[],[w]),z=t(()=>C(T),[T]),{activeDevices:V,orphanDevices:U}=t(()=>H(R,z),[R,z]),W=t(()=>{let e=new Map;for(let t of R)e.set(t.id,{id:t.id,name:t.name??t.stableId??`#${String(t.id)}`});return e},[R]),G=n(e=>W.get(e)??null,[W]),K=t(()=>(T??[]).map(e=>({id:e.id,name:e.name??e.addonId,icon:r(j,{type:e.addonId,size:`sm`})})),[T]),q=n(e=>p(`/devices/${String(e)}`),[p]);return e(N,{icon:c,title:a(`nav.devices`,`Devices`),actions:e(s,{children:[e(O,{variant:`outline`,size:`sm`,onClick:()=>p(I),children:[r(l,{className:`h-3.5 w-3.5`}),a(`devices.browseIntegrations`,`Browse integrations`)]}),e(O,{size:`sm`,onClick:()=>h(!0),children:[r(d,{className:`h-3.5 w-3.5`}),a(`devices.addDevice.title`,`Add device`)]})]}),children:[r(B,{open:m,onClose:()=>h(!1)}),r(S,{context:`devices`,devices:V,trpc:g.trpcClient,filters:{integrations:K},integrationOf:z,resolveIntegrationIcon:F,resolveParent:G,onNavigate:q,rowOperation:E.rowOperation,batchActions:{remove:E.remove,disable:k.mutate,enable:L.mutate}}),U.length>0&&e(`div`,{className:`mt-6 space-y-2`,children:[e(`div`,{className:`flex items-baseline gap-2`,children:[r(u,{className:`h-3.5 w-3.5 text-warning shrink-0`}),r(`h2`,{className:`text-sm font-semibold text-foreground`,children:a(`devices.orphanDevices`,`Orphan devices`)}),r(`span`,{className:`text-[10px] text-foreground-subtle`,children:a(`common.deviceOrphans`,{count:U.length})})]}),e(`div`,{className:`rounded-lg border border-warning/30 bg-warning/5 p-2`,children:[r(`p`,{className:`text-[11px] text-foreground-subtle px-2 pb-2`,children:a(`devices.theseDevicesReferenceAnIntegration`,"These devices reference an integration that is no longer registered (their `integrationId`, or — for older devices without one — their `addonId`). Delete them, or re-install the missing integration to bring them back online. The provider badge beside each row is the addon that serves it.")}),r(S,{context:`devices`,devices:U,trpc:g.trpcClient,integrationOf:z,urlScope:`nested`,lsKey:`devices:orphan`,resolveIntegrationIcon:F,resolveParent:G,onNavigate:q})]})]})]})}export{U as DevicesPage};
|
|
@@ -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-Dikds8gI.js";import{Cr as i,Er as a,Sr as o,br as s,cr as c,lr as l,or as u,sr as d,ur as f,xr as p}from"./client-C3Nr53Gn.js";import{t as m}from"./grip-vertical-CVi57Mnf.js";import{Df as h,vi as g}from"./src-VAvW-zoJ.js";import{t as _}from"./useTranslation-BJr-n0es.js";import{Nr as v}from"./index-Bec3SQjl.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=p;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(u(e,t,{row:n,col:r}))}function ue(e,t,n){return N(d(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=s.safeParse(e);return t.success?t.data:null}function z(e){let t=s.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 o.filter(t=>V(t)===e)}function me(e){let t=i(e),n=(t??e).replace(/_/g,` `);return t===null?n.charAt(0).toUpperCase()+n.slice(1):n}function he(e){return i(e)!==null&&!a(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 l(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?f(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{Xn as n,dt as r}from"./player-overlays-BDeIsXux.js";import{Cr as i,Er as a,Sr as o,br as s,cr as c,lr as l,or as u,sr as d,ur as f,xr as p}from"./client-DTyBaAoV.js";import{t as m}from"./grip-vertical-Dx0Aqv-v.js";import{Sf as h,vi as g}from"./src-Da4HIMZv.js";import{t as _}from"./useTranslation-BJr-n0es.js";import{Nr as v}from"./index-Cr7bUFvd.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=p;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(u(e,t,{row:n,col:r}))}function ue(e,t,n){return N(d(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=s.safeParse(e);return t.success?t.data:null}function z(e){let t=s.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 o.filter(t=>V(t)===e)}function me(e){let t=i(e),n=(t??e).replace(/_/g,` `);return t===null?n.charAt(0).toUpperCase()+n.slice(1):n}function he(e){return i(e)!==null&&!a(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 l(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?f(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-BDeIsXux.js";import{Vo as l}from"./client-DTyBaAoV.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,Pf as _,Pn as v,Sn as y,vn as b}from"./src-Da4HIMZv.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};
|
|
@@ -0,0 +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-BDeIsXux.js";import{fo as v,zr as y}from"./client-DTyBaAoV.js";import{A as b,B as x,Br as S,C,D as w,E as T,Ei as E,F as D,Fr as O,H as k,I as A,In as j,Ir as ee,Jr as M,Ko as N,Kr as te,L as ne,M as re,N as ie,On as ae,Pr as oe,R as se,Rn as P,Rr as ce,U as le,V as F,Xr as ue,Yr as I,Zr as L,b as de,bo as fe,j as pe,k as R,kf as me,kn as he,oi as z,ri as ge,td as _e,ui as B,vi as V,w as ve,x as ye,y as be,yo as xe,z as Se,zn as H,zr as Ce}from"./src-Da4HIMZv.js";import{t as U}from"./useTranslation-BJr-n0es.js";import{Fr as we}from"./index-Cr7bUFvd.js";import{t as Te}from"./AdminPage-qR6elCnl.js";i();function W(e,t){return e.scope===``?e.displayName:`${e.displayName} · ${t?.(e)??e.scope}`}function Ee(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:b(i),ref:i,info:e,subjectName:t.name,location:t.location??``,nodeId:``,metric:W(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:b(i),ref:i,info:t,subjectName:e.name,location:``,nodeId:e.id,metric:W(t,n)})}return r}function De(e){return[e.subjectName,e.location,e.metric,e.info.key,e.info.unit??``,e.nodeId].join(` `)}function G(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 Oe=[`energy`,`temperatures`,`nodes`,`storage`],ke=new Set([`cap:temperature-sensor.temperature`,`cap:climate-control.currentTemp`]),K=[`addon:metrics-native/node-cpu-percent`,`addon:metrics-native/node-memory-percent`],Ae=`addon:storage-orchestrator/location-used-percent`;function je(e,t){let n=(e,n)=>{let r=t.filter(e);return R((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`&&ke.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`&&K.includes(e.info.key)&&e.info.scope===``,(e,t)=>K.indexOf(e.info.key)-K.indexOf(t.info.key)||e.subjectName.localeCompare(t.subjectName));case`storage`:return n(e=>e.ref.subject.kind===`node`&&e.info.key===Ae)}}function Me(e,t){let n=new Map(t.map(e=>[e.id,e])),r=[],i=[],a=[],o=[];for(let t of R(e)){let e=n.get(b(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 q(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}=U(),o=f(),s=B(),c=z(),l=e=>`${G(e,s,c)} · ${e.metric}`,u=t(()=>[...r.lines,...r.states,...r.energy],[r]),p=C(t(()=>u.map(e=>q(e.ref)),[u]),i,!1),m=e=>p.status===`ok`?p.data.current.get(ye(q(e.ref))):void 0,h=e=>{let t=m(e);return t?.ok?t.result:void 0};if(u.length===0)return n(I,{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(M,{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=A(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=ne(e.info,h(e),i.from,i.to),r=ie(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,...D(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(M,{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(le,{title:a(`history.page.lines`,`Measurements`),series:v,range:i,height:260,syncKey:J,pending:g}),b.length>0&&n(te,{title:a(`history.page.energy`,`Energy`),layers:b.map((e,t)=>({id:e.c.id,label:G(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(k,{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(E,{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(E,{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(E,{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}=U(),h=m(),[g,v]=r(new Set),[y,b]=r(!1),[x,C]=r([]),w=t(()=>Ve(s,p),[s,p]),T=t(()=>Ue(s,p),[s,p]),E=t(()=>new Set(o.series.map(e=>String(e.seriesId))),[o.series]),D=[...g].filter(e=>E.has(e)).map(Number),k=Ie(x.map(e=>e.outcome)),A=async()=>{if(await h({title:p(`history.orphans.confirmTitle`,{count:D.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(D,u);C(Le(o.series,e)),v(new Set)}finally{b(!1),d()}}};return n(oe,{open:i,onOpenChange:e=>!e&&a(),children:e(ee,{width:`xl`,placement:`sheet-on-mobile`,scroll:`body`,"data-testid":`orphan-series-dialog`,children:[n(Ce,{children:n(S,{children:p(`history.orphans.title`,`Series no longer linked to a device`)})}),e(O,{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(V,{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:k.deleted,refused:k.refused,points:k.points.toLocaleString(),defaultValue_one:`{{count}} series deleted ({{points}} points), {{refused}} kept.`,defaultValue_other:`{{count}} series deleted ({{points}} points), {{refused}} kept.`})}),n(P,{columns:T,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:H,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(ce,{children:[n(`span`,{className:`mr-auto text-[11px] tabular-nums text-foreground`,"aria-live":`polite`,children:p(`history.orphans.selected`,{count:D.length,defaultValue_one:`{{count}} selected`,defaultValue_other:`{{count}} selected`})}),n(V,{variant:`ghost`,size:`sm`,onClick:a,children:p(`history.orphans.close`,`Close`)}),e(V,{variant:`danger`,size:`sm`,disabled:D.length===0||y,onClick:()=>void A(),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}=U(),[s,c]=r(!1),l=fe({},{enabled:i,staleTime:Ge}),u=N({projection:`slim`},{enabled:i}),d=xe(),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(M,{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(M,{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(V,{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}=U(),c=B(),l=z(),u=e=>G(e,c,l),d=ae(r,{searchText:e=>[De(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:H,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}=U(),i=ue(`device-history`),[a,o]=we(),c=t(()=>R(a.getAll(`s`).flatMap(e=>{let t=T(e);return t===null?[]:[t]})),[a]),l=a.get(`window`),f=x(l)?l:`7d`,h=se(a.get(`range`)),_=(e,t,n)=>{let r=new URLSearchParams;for(let t of R(e))r.append(`s`,w(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),S=F(f,de(Date.now(),y.to-y.from),h),C=t(()=>Me(c,v.candidates),[c,v.candidates]),E=t(()=>new Set(c.map(b)),[c]),D=be(),O=g(),k=m(),A=async()=>{let e=await O({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 D.update(t=>pe(t,{id:`panel-${Date.now().toString(36)}`,name:e.trim().slice(0,80),window:f,selection:[...c]}))},ee=async(e,t)=>{await k({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 D.update(t=>re(t,e))},N=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(Te,{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(V,{size:`sm`,variant:`outline`,onClick:()=>void A(),disabled:c.length===0||!D.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(L,{className:`h-64 w-full`}):i===`unknown`?n(M,{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(I,{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:[Oe.map(e=>n(V,{size:`sm`,variant:`outline`,disabled:v.status!==`ok`,onClick:()=>_(je(e,v.candidates),f),children:N(e)},e)),D.value.panels.map(t=>e(`span`,{className:`inline-flex items-center`,children:[n(V,{size:`sm`,variant:`secondary`,onClick:()=>_(t.selection,t.window,null),children:t.name}),n(V,{size:`sm`,variant:`ghost`,"aria-label":r(`history.page.deleteNamed`,`Delete panel {{name}}`,{name:t.name}),onClick:()=>void ee(t.id,t.name),disabled:!D.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(j,{headingId:`history-picker`,title:r(`history.picker.title`,`Series`),children:n(`div`,{className:`p-2 sm:p-3`,children:v.status===`error`?n(M,{message:v.error}):n(Ye,{catalog:v.candidates,loading:v.status===`pending`,selected:E,onChange:e=>{let t=c.filter(t=>e.has(b(t))),n=v.candidates.filter(t=>e.has(t.id)&&!E.has(t.id)).map(e=>e.ref);_([...t,...n],f)}})})})}),n(`div`,{className:`min-w-0 xl:col-span-3`,children:n(j,{headingId:`history-overlay`,title:r(`history.page.overlay`,`Overlay`),actions:c.length>0?n(V,{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`,Se(e))}),v.status===`pending`&&c.length>0?n(L,{className:`h-64 w-full`}):n(Ne,{part:C,window:S}),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}=U(),r=n(`history.picker.wholeFrame`,`Whole frame`),i=h().trpcClient,o=N({projection:`slim`},{enabled:e}),{nodes:s}=me(),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=_e({},{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(()=>Ee(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{$r as u,Cn as d,D as f,Fn as p,Ft as m,Kt as h,Tn as g,Ut as _,Wn as v,Xn as y,_n as b,ai as x,bn as S,bt as C,ct as w,ht as T,ki as E,kr as ee,lt as te,oa as ne,un as D,ut as re,vr as ie,wr as O,xr as k,yn as ae}from"./player-overlays-BDeIsXux.js";import{l as A,mo as oe,po as se}from"./client-DTyBaAoV.js";import{c as j,f as M,h as ce,r as le}from"./video-BMbZ77OA.js";import{t as ue}from"./file-up-CS3QVGu0.js";import{t as de}from"./key-KMleps0f.js";import{t as fe}from"./monitor-smartphone-DiwqWkLr.js";import{t as pe}from"./unlink-Bj6T0cfp.js";import{An as me,Bd as he,Br as N,Ei as P,Et as ge,Fr as F,Gd as _e,Hd as ve,In as ye,Ir as I,Jd as be,Jr as L,Kd as R,Ko as z,Ln as B,Mr as xe,Oc as Se,Pf as V,Pr as H,Pt as U,Rd as Ce,Rn as we,Rr as Te,Ud as Ee,Vd as De,Wd as Oe,X as ke,Yd as Ae,Yr as je,af as Me,ar as Ne,cr as Pe,er as Fe,ht as Ie,if as Le,ir as Re,jn as ze,kc as Be,lr as Ve,nf as He,nr as Ue,of as We,or as Ge,qd as Ke,rf as qe,rr as Je,vi as W,wc as Ye,wt as Xe,xc as Ze,yc as Qe,zd as $e,zn as et,zr as tt}from"./src-Da4HIMZv.js";import{t as G}from"./i18n-BETemoOB.js";import{t as K}from"./useTranslation-BJr-n0es.js";import{Fr as nt,Nr as rt,P as it,a as at,b as ot,d as st,i as ct,jr as lt,l as ut,t as dt}from"./index-Cr7bUFvd.js";import{t as ft}from"./AdminSectionedPage-6893SaIU.js";import{t as pt}from"./AdminPage-qR6elCnl.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-DwHQoi9f.js";import{r as Bt}from"./IntegrationHub-50C35JXv.js";import{n as Vt}from"./Authentication-CDgdDuh0.js";s();function Ht(){let{t:e}=K(),t=w(),i=V.useUtils(),o=Dt(),{data:s,isLoading:c}=Oe(),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=be({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:pe,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=w(),i=c(),o=Ee(),[s,l]=a(null),u=()=>void i.invalidateQueries({queryKey:[[`userManagement`,`listOauthSessions`]]}),d=R({onSuccess:u,onError:e=>l(`Revoke failed: ${e.message}`)}),f=_t(Ut,u),p=n(()=>(o.data??[]).map(e=>gt(e,e.scopes.map(Wt).join(`, `))),[o.data]),m=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),d.mutate({id:n.id}))},g=d.isPending?d.variables?.id??null:null;return r(q,{notice:J(s,f.outcome),onDismissNotice:()=>{l(null),f.dismiss()},id:`linked-apps`,title:e(`access.linkedAppsSection.linkedApps`,`Linked apps`),icon:O,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:p,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:h,isAvailable:e=>e.status===`active`||e.status===`revoked`,onRun:e=>void m(e),busyId:g,disabled:d.isPending||f.busy},bulk:{revoke:f,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(le,{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=w(),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:fe,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:j,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}=it();return e?.isAdmin?r(nn,{}):null}function tn(){let{data:e}=Oe(),{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(g,{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(k,{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:fe,render:()=>r(Yt,{})},{id:Q.linkedApps,label:G.t(`system.access.linkedApps`,`Linked apps`),icon:O,render:()=>r(Gt,{})},{id:Q.tokens,label:G.t(`system.access.tokens`,`Tokens`),icon:M,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:g,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=rt(),[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(lt,{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(Fe,{appearance:`pills`,value:f?.id??Q.loginSessions,onValueChange:e=>{c(`?${st(l,e,null,null).toString()}`)},children:r(Ue,{"aria-label":a(`system.access.credentialKinds`,`Credential kinds`),children:o.map(t=>e(Je,{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(M,{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(k,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":!0}),s(`certificates.queryBody.reading`,{what:i})]}):n===null?o:r(L,{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:ae,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(P,{variant:`success`,children:t(`certificates.deviceCaCard.ready`,`Ready`)}),i.state===`absent`&&r(P,{variant:`default`,children:t(`certificates.deviceCaCard.notCreatedYet`,`Not created yet`)}),i.state===`unavailable`&&r(P,{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(Re,{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(ge,{open:t,onClose:h,title:s(`certificates.pairDeviceDialog.pairADevice`,`Pair a device`),icon:D,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(k,{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(re,{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(We,{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(xe,{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(me,{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(_,{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=w(),c=te(),l=V.useUtils(),u=V.deviceCredentials.listDeviceCredentials.useQuery({includeRevoked:!0}),d=Oe(),[f,p]=a(null),[m,g]=a(null),_=()=>void l.deviceCredentials.listDeviceCredentials.invalidate(),v=e=>t=>{g(null),p(`${e} failed: ${t.message}`)},b=()=>{g(null),_()},x=V.deviceCredentials.revokeDeviceCredential.useMutation({onSuccess:b,onError:v(`Revoke`)}),S=V.deviceCredentials.deleteDeviceCredential.useMutation({onSuccess:e=>{e.result!==`deleted`&&p(e.result===`live`?`Only a revoked device can be deleted: revoke it first.`:`That device no longer exists.`),b()},onError:v(`Delete`)}),C=V.deviceCredentials.renameDeviceCredential.useMutation({onSuccess:b,onError:v(`Rename`)}),T=ht(vn,e=>x.mutateAsync({id:e}),_),E=T.busy||m!==null,ee=n(()=>(u.data??[]).map(At),[u.data]),re=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`})&&(p(null),g(e.id),x.mutate({id:e.id}))},ie=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`})&&(p(null),g(e.id),S.mutate({id:e.id}))},O=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||(p(null),g(e.id),C.mutate({id:e.id,deviceName:t}))},k={label:o(`certificates.devicesCard.revoke2`,`Revoke`),icon:ne,isAvailable:yt,onRun:e=>void re(e),busyId:x.isPending?m:null,disabled:E},ae=[{label:o(`certificates.devicesCard.rename`,`Rename`),icon:y,tone:`neutral`,isAvailable:()=>!0,onRun:e=>void O(e),busyId:C.isPending?m:null,disabled:E},{label:o(`common.delete`,`Delete`),icon:h,isAvailable:Et,onRun:e=>void ie(e),busyId:S.isPending?m:null,disabled:E}];return e(q,{id:`devices`,title:o(`certificates.devicesCard.devices`,`Devices`),icon:D,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:()=>{p(null),T.dismiss()},children:[r(fn,{}),r(Lt,{rows:ee,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:k,extraActions:ae,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(Ne,{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(ue,{className:`mr-1 h-3 w-3`}),l(`system.pemField.chooseFile`,`Choose file`)]})]})]}),r(Pe,{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=Qe(void 0,{refetchInterval:15e3}),o=Ze({onSuccess:()=>void n.invalidateQueries({queryKey:[[`localNetwork`]]})}),s=Ye({onSuccess:()=>void n.invalidateQueries({queryKey:[[`localNetwork`]]})}),l=Be({onSuccess:()=>void n.invalidateQueries({queryKey:[[`localNetwork`]]})}),u=Se({onSuccess:()=>{m(!1),g(``),v(``),x(``),n.invalidateQueries({queryKey:[[`localNetwork`]]})}}),d=i.data,[p,m]=a(!1),[h,g]=a(``),[_,v]=a(``),[y,x]=a(``),S=()=>{if(!d?.caCertPem)return;let e=new Blob([d.caCertPem],{type:`application/x-pem-file`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`camstack-ca.crt`,n.click(),URL.revokeObjectURL(t)},C=d?.mode===`uploaded`?`Uploaded`:d?.mode===`generated`?`Generated local CA`:`TLS disabled`;return r(ye,{headingId:`local-access-certificate`,title:t(`system.localAccess.certificate`,`Certificate`),icon:b,children:e(`div`,{className:`${f} space-y-3`,children:[i.isError&&r(`p`,{className:`text-xs text-danger`,children:t(`system.localAccess.couldNotReadTlsStatus`,`Could not read TLS status.`)}),d?.reissueError&&r(L,{variant:`warning`,title:t(`system.localAccess.certificateReissue`,`Certificate reissue`),message:d.reissueError}),d?.restartRequired&&r(L,{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.`)}),d?.caMissing===!0&&r(L,{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).")}),d?.caReplacedAt!=null&&Dn(d.caReplacedAt)&&r(L,{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(d.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:C})]}),e(`div`,{children:[r(`dt`,{className:`text-foreground-subtle`,children:t(`system.localAccess.validTo`,`Valid to`)}),r(`dd`,{className:`font-mono`,children:d?.validTo?new Date(d.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:d?.leafFingerprintSha256??void 0,children:On(d?.leafFingerprintSha256??null)})]}),d?.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(d.storedUpload.validTo).toLocaleDateString(),ca:d.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:d?.caFingerprintSha256??void 0,children:d?.mode===`uploaded`&&d.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(d?.caFingerprintSha256??null)})]})]}),d&&d.sans.length>0&&r(`div`,{className:`flex flex-wrap gap-1`,children:d.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(ze,{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:d?.mode===`uploaded`||o.isPending,action:()=>o.mutateAsync({})}),r(W,{size:`sm`,variant:`outline`,onClick:()=>m(e=>!e),children:t(`system.localAccess.upload`,`Upload`)}),d?.caCertPem&&r(W,{size:`sm`,variant:`outline`,onClick:S,children:t(`system.localAccess.downloadCa`,`Download CA`)}),d?.mode===`uploaded`&&r(ze,{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({})}),d?.mode===`generated`&&d.storedUpload!=null&&r(ze,{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:x,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=Qe().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(x,{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(P,{variant:`success`,children:a(`certificates.caStrip.open`,`Open`)}),u.state===`not-started`&&r(P,{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(_,{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(P,{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(P,{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(P,{variant:`success`,className:`text-[10px]`,children:t(`common.yes`,`Yes`)}):r(P,{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(k,{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(qe,{className:`inline-block`,children:[r(Me,{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(Le,{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:p,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:p,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:ne,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(P,{variant:`info`,className:`text-[10px]`,children:G.t(`common.hubWord`)}),!t.online&&r(P,{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=w(),o=V.useUtils(),s=pn(6e4),c=V.certificates.listHttpsCertificates.useQuery(),l=V.certificates.getMeshCertificates.useQuery(),[u,f]=a(null),[p,m]=a(null),[h,g]=a(null),_=()=>{g(null),o.certificates.listHttpsCertificates.invalidate(),o.certificates.getMeshCertificates.invalidate()},v=e=>(t,n)=>{g(null),f(`${n.nodeId}: ${e} - ${t.message}`)},y=V.certificates.renewHttpsOnNode.useMutation({onSuccess:(e,n)=>{m({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})}),_()},onError:v(`renewal failed`)}),b=V.certificates.renewMeshOnNode.useMutation({onSuccess:e=>{m(Ot(e)),_()},onError:v(`renewal could not start`)}),x=V.certificates.revokeMeshOnNode.useMutation({onSuccess:e=>{m({tone:`success`,message:`${e.nodeId}: ${e.next}`}),_()},onError:v(`revoke failed`)}),S=y.isPending||b.isPending||x.isPending,C=(e,t)=>{f(null),m(null),g({nodeId:e,action:t})},T=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}))},E=e=>{C(e.nodeId,`renew-identity`),b.mutate({nodeId:e.nodeId})},ee=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}))},te=qn({now:s,busy:S,running:h,onRenewHttps:e=>void T(e),onRenewIdentity:E,onRevokeIdentity:e=>void ee(e)}),ne=n(()=>Nn(c.data??[],l.data),[c.data,l.data]),D=l.data?.registryAvailable??!0;return r(q,{id:`nodes`,title:t(`certificates.nodesCard.nodes`,`Nodes`),icon:d,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,p),onDismissNotice:()=>{f(null),m(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(we,{columns:te,rows:ne,rowKey:e=>e.nodeId,minWidthPx:960,maxBodyHeight:et,defaultSort:{columnKey:`node`,dir:`asc`},emptyMessage:D?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=w(),s=V.useUtils(),c=ve({userId:t}),l=V.auth.listLoginMethods.useQuery(),u=be({onSuccess:()=>void s.userManagement.listExternalIdentities.invalidate()}),d=new Map((l.data??[]).flatMap(e=>e.kind===`redirect`?[[e.id,e.label]]:[])),f=c.data??[],p=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`})&&u.mutate({userId:t,provider:e.provider,subject:e.subject})};return r(H,{open:!0,onOpenChange:e=>!e&&i(),children:e(I,{width:`md`,placement:`sheet-on-mobile`,scroll:`body`,"data-testid":`external-identities-modal`,children:[r(tt,{children:e(N,{className:`flex items-center gap-2`,children:[r(O,{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(F,{className:`space-y-3`,children:c.isLoading?e(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[r(k,{className:`h-3.5 w-3.5 animate-spin`}),a(`common.loading`,`Loading…`)]}):f.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:f.map(t=>{let n=d.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 p(t,i),disabled:u.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(pe,{className:`h-3 w-3`}),a(`common.remove`,`Remove`)]})]},`${t.provider}|${t.subject}`)})})}),r(Te,{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=w(),u=De({userId:t}),d=u.data,f=()=>o.invalidateQueries({queryKey:[[`userManagement`,`getTotpStatus`]]}),p=he({onSuccess:()=>{f(),i()}}),m=u.isLoading?`loading`:d?.enabled?`enrolled`:`not_enrolled`;return r(H,{open:!0,onOpenChange:e=>!e&&i(),children:e(I,{width:`md`,placement:`sheet-on-mobile`,scroll:`body`,children:[r(tt,{children:e(N,{className:`flex items-center gap-2`,children:[r(D,{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(F,{className:`space-y-4`,children:[m===`loading`&&e(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[r(k,{className:`h-3.5 w-3.5 animate-spin`}),a(`users.totpModal.checkingStatus`,`Checking status…`)]}),m===`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(ee,{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.`)})]})]}),m===`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(E,{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(k,{className:`h-3 w-3 animate-spin`}):r(C,{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}=it(),l=s?.id===t,u=w(),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(I,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,"data-testid":`user-sessions-modal`,children:[r(tt,{children:e(N,{className:`flex items-center gap-2`,children:[r(fe,{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(F,{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(Te,{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(k,{className:`h-3 w-3 animate-spin`}):r(j,{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=T(),s=o({queryKey:[`auth`,`previewScope`,t,!1],enabled:n===null,queryFn:()=>a.trpcClient.auth.previewScope.query({scopes:[...t],isAdmin:!1})}),{data:c}=z({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(S,{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(k,{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 d=s.data.viewableDeviceCount,f=s.data.device.view.all?i(`users.rolePreview.everyDevice`,{count:d}):l===null?i(`users.rolePreview.devicesVisible`,{count:d}):i(`users.rolePreview.devicesVisibleOf`,{count:d,total:l});return e(`p`,{className:`flex items-center gap-1.5 text-[11px] ${d===0?`text-warning`:`text-foreground`}`,"data-testid":`role-preview`,children:[d===0?r(S,{className:`h-3 w-3 shrink-0`}):r(u,{className:`h-3 w-3 shrink-0 text-foreground-subtle`}),d===0?i(`users.rolePreview.noDevice`):f]})}function er(e){let t=A(e.scopes??[]);if(t===null)return{role:e.isAdmin?`admin`:`viewer`,mode:`except`,pickedIds:[],viewer:se,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=z({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(I,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,className:`md:max-w-2xl`,children:[r(tt,{children:r(N,{children:d(`users.userAccessModal.title`,{name:t.username})})}),e(F,{className:`space-y-4`,children:[f.unconfigured&&f.role===`viewer`&&r(L,{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(Ie,{label:d(`users.userAccessModal.whichDevices`),value:f.mode,options:C,onChange:e=>p(nr(f,e))}),r(ke,{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:oe.map(t=>e(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-md p-1.5 hover:bg-surface-hover`,children:[r(Ve,{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(L,{message:u})]}),e(Te,{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(k,{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(Ge,{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}=it(),{state:s,openNew:u,openEdit:d,close:f}=Xe(),[p,g]=a(null),[_,b]=a(null),[x,S]=a(!1),{data:C,isLoading:T,isError:E,error:ee,refetch:ne}=Oe(),re=w(),ie=te(),A=()=>n.invalidateQueries({queryKey:[[`userManagement`,`listUsers`]]}),oe=Ce(),se=$e({onSuccess:A}),j=Ae({onSuccess:A}),M=_e({onSuccess:A}),ce=Ke(),[le,ue]=a(null),[pe,me]=a(!1),[he,N]=a(null),[P,F]=a(null),[ve,ye]=a(null),[I,be]=a(null),R=C??[],z=s.mode===`edit`?R.find(e=>e.id===s.id)??null:null,B=()=>{g(null),b(null),S(!1),oe.reset(),j.reset(),f()};i(()=>{if(s.mode===`closed`){g(null),b(null),S(!1);return}if(s.mode===`new`){g(e=>e!==null&&e.id===void 0?e:hr());return}if(z===null){T||f();return}g(e=>e?.id===z.id?e:gr(z))},[s,z,T,f]);let xe=s.mode===`new`&&p!==null&&p.id===void 0||s.mode===`edit`&&p!==null&&z!==null;async function Se(e){await re({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`})&&(se.mutate({id:e.id}),s.mode===`edit`&&s.id===e.id&&B())}async function V(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 re({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`)})&&M.mutate({id:e.id,newPassword:n})}function H(e){N(null),ue(e)}async function Te(e,t){me(!0),N(null);try{t.isAdmin!==e.isAdmin&&await j.mutateAsync({id:e.id,isAdmin:t.isAdmin}),await ce.mutateAsync({userId:e.id,scopes:[...t.scopes]}),ue(null)}catch(e){N(_r(e))}finally{me(!1),A()}}async function Ee(){if(p!==null){b(null);try{if(p.id===void 0){let e=p.username.trim();if(e===``||p.password.length<$)return;await oe.mutateAsync({username:e,password:p.password,isAdmin:p.isAdmin})}else await j.mutateAsync({id:p.id,isAdmin:p.isAdmin});A(),B()}catch(e){b(_r(e))}}}function De(e){return e?new Date(typeof e==`number`?e:String(e)).toLocaleDateString(`en-GB`,{day:`2-digit`,month:`short`,year:`numeric`}):`—`}let ke=oe.isPending||j.isPending,Me=p!==null&&p.id===void 0&&p.username.trim()!==``&&p.password.length>=$,Ne=p!==null&&p.id!==void 0,Pe=ke||(p?.id===void 0?!Me:!Ne),Fe=e=>se.isPending&&se.variables?.id===e.id||j.isPending&&j.variables?.id===e.id||M.isPending&&M.variables?.id===e.id,Ie=[{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:()=>H(n),disabled:Fe(n),title:t(`admin.system.users.configureAccess`,`Configure access`),"data-testid":`user-access-${n.id}`,children:[r(ae,{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:De(e.createdAt)})},{key:`actions`,header:t(`admin.system.users.actions`,`Actions`),align:`right`,nowrap:!0,notSortableReason:`Row actions`,render:n=>{let i=Fe(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:()=>d(n.id),disabled:i,title:t(`admin.system.users.editUser`,`Edit user`),children:[r(y,{className:`h-3 w-3`}),t(`common.edit`,`Edit`)]}),a&&e(W,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>F(n),disabled:i,title:t(`admin.system.users.removeTwoFactorAuthentication`,`Remove two-factor authentication`),children:[r(D,{className:`h-3 w-3`}),t(`admin.system.users.remove2fa`,`Remove 2FA`)]}),e(W,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>ye(n),disabled:i,title:t(`admin.system.users.linkedSignInAccounts`,`Linked sign-in accounts`),children:[r(O,{className:`h-3 w-3`}),t(`admin.system.users.signInLinks`,`Sign-in links`)]}),e(W,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>be(n),disabled:i,title:t(`admin.system.users.activeSessions`,`Active sessions`),children:[r(fe,{className:`h-3 w-3`}),t(`admin.system.users.sessions`,`Sessions`)]}),e(W,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>void V(n),disabled:i,title:t(`admin.system.users.resetPassword`,`Reset password`),children:[r(de,{className:`h-3 w-3`}),t(`admin.system.users.resetPassword`,`Reset password`)]}),e(W,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>void Se(n),disabled:i,title:t(`admin.system.users.deleteUser`,`Delete user`),className:`text-danger hover:bg-danger/10`,children:[i?r(k,{className:`h-3 w-3 animate-spin`}):r(h,{className:`h-3 w-3`}),t(`common.delete`,`Delete`)]})]})}}];return e(pt,{embedded:!0,icon:m,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),u()},children:[r(v,{className:`h-3.5 w-3.5`}),t(`admin.system.users.createUser`,`Create User`)]}),children:[E&&r(L,{title:t(`admin.system.users.couldNotLoadUsers`,`Could not load users`),message:_r(ee),onRetry:()=>void ne()}),T&&e(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[r(k,{className:`h-3.5 w-3.5 animate-spin`}),t(`common.loading`,`Loading…`)]}),!T&&!E&&R.length===0&&r(je,{icon:m,title:t(`admin.system.users.noUsersYet`,`No users yet`),description:t(`admin.system.users.createAUserToGrant`,`Create a user to grant hub access.`)}),!T&&!E&&R.length>0&&r(we,{columns:Ie,rows:R,rowKey:e=>e.id,minWidthPx:560,maxBodyHeight:`max-h-[60vh]`,onRowClick:e=>d(e.id)}),r(ge,{open:xe,onClose:B,title:p?.id===void 0?t(`admin.system.users.createUser`,`Create User`):t(`admin.system.users.edit`,`Edit {{value1}}`,{value1:p.username||`user`}),icon:m,error:_,testId:`user-form-dialog`,footer:r(W,{size:`sm`,type:`button`,disabled:Pe,onClick:()=>void Ee(),children:ke?e(l,{children:[r(k,{className:`h-3.5 w-3.5 animate-spin`}),t(`admin.system.users.saving`,`Saving…`)]}):p?.id===void 0?t(`admin.system.users.create`,`Create`):t(`common.save`,`Save`)}),children:p!==null&&e(`div`,{className:`space-y-3`,children:[r(U,{label:t(`admin.system.users.username`,`Username`),required:p.id===void 0,children:r(We,{value:p.username,onChange:e=>g({...p,username:e.target.value}),placeholder:`john`,autoFocus:p.id===void 0,disabled:p.id!==void 0,"data-testid":`user-form-username`})}),p.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(He,{value:p.password,onValueChange:e=>g({...p,password:e}),shown:x,onToggleShown:()=>S(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(Ve,{checked:p.isAdmin,onChange:e=>g({...p,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`)})]})}),p.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.`)})]})}),P&&r(Zn,{userId:P.id,username:P.username,onClose:()=>F(null)}),ve&&r(Xn,{userId:ve.id,username:ve.username,onClose:()=>ye(null)}),I&&r(Qn,{userId:I.id,username:I.username,onClose:()=>be(null)}),le&&r(pr,{user:le,isSelf:le.id===o?.id,onClose:()=>ue(null),onSubmit:e=>void Te(le,e),submitting:pe,error:he})]})}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(D,{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(lt,{to:ut(`access`,{integration:s}),replace:!0});let c=ot(`/system/identity`,{t:e,isAdmin:!0})??{icon:ie,title:e(`system.identity`,`Identity & Access`)},l=t.get(`tab`)??`users`,u=t.get(`integration`),d=l===at.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:at.access.tab,label:e(`systemPage.identity.tokensSessions`,`Tokens & sessions`),ownedParams:ct.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:at.authentication.tab,label:e(`systemPage.identity.authentication`,`Authentication`),content:r(Vt,{}),ownedParams:ct}]})}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{Fn as f,Gn as p,Kt as m,Qi as h,Tn as g,V as _,Wn as ee,Xn as te,ct as ne,ht as re,on as ie,wr as ae,xr as v}from"./player-overlays-BDeIsXux.js";import{dr as y}from"./client-DTyBaAoV.js";import{t as oe}from"./link-2-off-I79TL553.js";import{Br as b,Ei as x,Et as se,Fr as S,Gs as C,In as ce,Ir as w,Jr as le,Oi as ue,Pr as T,Rn as de,Yr as fe,_n as E,gn as D,ir as O,jn as k,kt as pe,pa as A,sf as j,vi as M,wt as me,ya as N,zr as P}from"./src-Da4HIMZv.js";import{t as F}from"./useTranslation-BJr-n0es.js";import{n as I}from"./addon-icons-context-DihpM3HF.js";import{$ as L,Ar as R,Dr as he,G as ge,K as z,Or as _e,Q as B,Y as ve,Z as ye,at as be,et as xe,nt as Se,ot as Ce,q as we,r as V,rt as Te,st as Ee,tt as De}from"./index-Cr7bUFvd.js";import{t as H}from"./NodeAddonsSettingsPanel-hPglGkot.js";s();var U=[[[`addons`,`listCapabilityProviders`]],[[`addons`,`list`]]],W=`text-[10px]`;function Oe({isActive:e}){let{t}=F();return i(x,{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=N({onSuccess:()=>{for(let e of U)o.invalidateQueries({queryKey:e})}}),c=s.isPending;return e(M,{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?ie:p,{className:`h-3 w-3`}),r?a(`common.disable`,`Disable`):a(`common.enable`,`Enable`)]})}function K(){let e=l();return A({onSuccess:()=>{for(let t of U)e.invalidateQueries({queryKey:t})}})}function q({addonId:e,displayName:t,message:n}){let{t:r}=F(),a=ne(),o=K();return i(j,{icon:o.isPending?v:f,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(k,{label:a(`integrationHub.addonControls.restart`,`Restart`),icon:f,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 h=e(u,{children:[f===null?null:i(R,{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(ae,{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:h,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:`${_} min-w-0 flex-1`,children:r}),h]}),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:g},{kind:`events`,labelKey:`common.events`,icon:h}];function Ae({addonId:t,switcher:n}){let{t:r}=F(),[a,s]=o(`logs`);return e(X,{id:V,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(M,{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(E,{addonId:t,maxHeight:Q,showFilters:!1}):i(D,{addonId:t,category:`addon.*`,maxHeight:Q})]})}function je({addonId:t,title:n=`Settings`,subtitle:r,fieldScope:a,onClose:o}){return i(T,{open:!0,onOpenChange:e=>!e&&o(),children:e(w,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,className:`md:max-w-3xl`,children:[e(P,{children:[i(b,{children:n}),r&&i(`p`,{className:`text-xs text-foreground-subtle`,children:r})]}),i(S,{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(M,{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(R,{to:y(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(ee,{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(se,{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=C({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(x,{variant:t.configured?`success`:`default`,children:t.configured?n(`providerInstances.configured`,`Configured`):n(`providerInstances.notConfigured`,`Not configured`)}),t.status!==void 0&&i(x,{variant:t.status.state===`error`?`danger`:t.status.state===`ok`?`success`:`default`,title:We(t),children:Se(t.status)})]}):i(`span`,{className:`flex flex-wrap items-center gap-1`,children:i(x,{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:[z]})});return e(`span`,{className:`flex flex-col gap-1`,children:[i(O,{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=N({onSuccess:()=>void r.invalidateQueries()});return i(O,{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:f,addLabel:h,install:g,extraColumns:_,lead:ie,rowActions:y,canDelete:b,pageActions:se,typedId:S,rowFilter:C}){let{t:w}=F(),T=re(),E=l(),D=ne(),O=we(t),k=me({editKey:Ue,newKey:`${Ue}-new`}),[A,N]=o(null),[P,I]=o(null),L=ue({functionCap:`notification-output`}),R=r(e=>Te(L.data??[],e).length,[L.data]),[ge,Se]=o(null),[V,De]=o(null),H=n(()=>ve(O.holders),[O.holders]),U=n(()=>xe(O.functionProviders,O.rows,O.displayNames),[O.functionProviders,O.rows,O.displayNames]),W=U.some(e=>e.addonId===V)?V:null,Oe=n(()=>{let e=ye(O.rows,W);return C===void 0?e:e.filter(C)},[O.rows,W,C]),G=r(e=>O.displayNames.get(e)??e,[O.displayNames]),K=r(async e=>{N(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:Ee(t)})}catch(t){let n=t instanceof Error?t.message:String(t);I({name:e.name,verdict:{status:`inconclusive`,error:n}})}finally{N(null)}},[T]),q=r(async e=>{let t=Te(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:[z]})}catch(t){be({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(()=>O.rows.some(e=>e.kind===`instance`&&e.kindLabel!==void 0),[O.rows]),Y=r((e,t)=>{e!==void 0&&_e(he(e,t),()=>{E.invalidateQueries({queryKey:[z]})})},[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(x,{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:R(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(j,{icon:ae,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(j,{icon:oe,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(j,{icon:A===t.key?v:p,variant:`ghost`,size:`sm`,"aria-label":w(`providerInstances.testRow`,`Test {{name}}`,{name:t.name}),disabled:A!==null,onClick:()=>void K(t)}),t.kind===`instance`&&y?.(t),i(j,{icon:te,variant:`ghost`,size:`sm`,"aria-label":w(`providerInstances.editRow`,`Edit {{name}}`,{name:t.name}),onClick:()=>k.openEdit(B(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`&&(b?.(t)??!0)&&i(j,{icon:m,variant:`ghost`,size:`sm`,"aria-label":w(`providerInstances.deleteRow`,`Delete {{name}}`,{name:t.name}),onClick:()=>void q(t)})]})}],[_,k,t,R,y,b,q,Y,K,J,w,A]),Z;Z=O.state===`error`?i(`div`,{className:`p-3`,children:i(le,{title:w(`providerInstances.loadFailed`,`Could not load the list`),message:O.error??``,onRetry:O.refetch})}):O.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…`)]}):O.rows.length===0?i(fe,{icon:a,title:d,description:f}):i(de,{columns:X,rows:Oe,rowKey:e=>e.key,bordered:!1,emptyMessage:w(`instances.noneForProvider`,`This provider has no instance yet.`)});let Q=O.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}),O.state===`ready`&&$!==void 0&&i(`p`,{className:`px-3 pt-1 text-[11px] text-foreground-subtle`,children:$}),O.state===`ready`&&e(u,{children:[e(pe,{children:[se?.(O.rows.filter(e=>e.kind===`instance`)),e(M,{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?k.openNew():k.openEdit(B(e.addonId,null))},children:[i(ee,{className:`h-3.5 w-3.5`}),h]})]}),i(Be,{pills:U,selected:W,onSelect:De,fallbackIcon:a,...g===void 0?{}:{install:g}})]}),Z,O.state===`ready`&&O.rows.length>0&&i(Ye,{rows:O.rows,selected:ge,onSelect:Se}),P!==null&&e(`div`,{className:`space-y-1 p-3`,children:[i(`p`,{className:`text-[11px] font-medium text-foreground`,children:P.name}),i(Ce,{verdict:P.verdict})]}),O.state===`ready`&&k.state.mode===`new`&&i(Ve,{title:h,providers:H.map(e=>({addonId:e.addonId,name:G(e.addonId),description:O.descriptions.get(e.addonId)??``})),onPick:e=>k.openEdit(B(e,null)),onCancel:k.close}),O.state===`ready`&&k.state.mode===`edit`&&i(Xe,{refValue:k.state.id,data:O,nameOf:G,onClose:k.close,onOpen:(e,t)=>k.openEdit(B(e,t)),...ie===void 0?{}:{lead:ie},...S===void 0?{}:{typedId:S}},k.state.id)]})}function Ye({rows:e,selected:t,onSelect:r}){let{t:a}=F(),o=n(()=>De(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(M,{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=L(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(ge,{...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};
|