@camstack/addon-admin-ui 1.2.624 → 1.2.625
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 +11 -0
- package/dist/assets/{Addons-D9_oXciB.js → Addons-pz9Q1cs6.js} +1 -1
- package/dist/assets/{AdminPage-CjU3Qym-.js → AdminPage-D54ZN64f.js} +1 -1
- package/dist/assets/{AdminSectionedPage-LULz7C3_.js → AdminSectionedPage-BHMmyL4w.js} +1 -1
- package/dist/assets/{AiProfiles-B2Pqa3a7.js → AiProfiles-COUMccnV.js} +1 -1
- package/dist/assets/{Authentication-gZeEIiCJ.js → Authentication-DZFEeCxa.js} +1 -1
- package/dist/assets/{Build-CpiTrCbQ.js → Build-b5YHP3m-.js} +1 -1
- package/dist/assets/Calendars-B_J8ESm4.js +1 -0
- package/dist/assets/{CameraGrids-WUfNL6ST.js → CameraGrids-BI1TEiXl.js} +1 -1
- package/dist/assets/{Cluster-CP2CoYke.js → Cluster-C3sHoZv8.js} +1 -1
- package/dist/assets/{CompositionBlockEditor-DKBOCxVr.js → CompositionBlockEditor-WeSCGBdL.js} +1 -1
- package/dist/assets/{CompositionEditorPage-BUUQqQOo.js → CompositionEditorPage-Ci3xVucy.js} +1 -1
- package/dist/assets/{Data-Dz-E4akc.js → Data-DY5Hc-VL.js} +1 -1
- package/dist/assets/DeviceDetail-24D1kNN2.js +2 -0
- package/dist/assets/{DeviceDoActionFields-HEC7yYzf.js → DeviceDoActionFields-CmTveJuv.js} +1 -1
- package/dist/assets/{Devices-DjFRDFOP.js → Devices-C-YnjQtE.js} +1 -1
- package/dist/assets/{EmbedPlayerPage-Dz0ThiJO.js → EmbedPlayerPage-DB8PCqEy.js} +1 -1
- package/dist/assets/{History-DR_06KaD.js → History-BpK7iHjw.js} +1 -1
- package/dist/assets/{Identity-BDR1TOR3.js → Identity-C8YQPLVs.js} +1 -1
- package/dist/assets/InstanceSwitchCell-y0VqI68Y.js +1 -0
- package/dist/assets/InstancesTable-C5ocf6KU.js +1 -0
- package/dist/assets/{IntegrationDetail-DZgCMWiP.js → IntegrationDetail-D48iWKb-.js} +1 -1
- package/dist/assets/{IntegrationHub-CfofBRon.js → IntegrationHub-CuxPMwsj.js} +1 -1
- package/dist/assets/{Integrations-Q42WYHHG.js → Integrations-B9GLaXfL.js} +1 -1
- package/dist/assets/{Integrations-D9yP6yzP.js → Integrations-ChVn_c2r.js} +1 -1
- package/dist/assets/{Library-C6tHqw32.js → Library-C04T0RYP.js} +1 -1
- package/dist/assets/{Locations-07eSvEIU.js → Locations-CNaTr00A.js} +1 -1
- package/dist/assets/{Logs-CdwRDasW.js → Logs-R-ZPaTxq.js} +1 -1
- package/dist/assets/{MaskShapeCanvas-Cdd-VtkN.js → MaskShapeCanvas-C6vw0mq_.js} +1 -1
- package/dist/assets/{MotionZonesSettings-DLejOdp6.js → MotionZonesSettings-BPLgHoj3.js} +1 -1
- package/dist/assets/{MyAccess-Db0DJKX-.js → MyAccess-D-uWLTS-.js} +1 -1
- package/dist/assets/{Network-Bh6FEQrB.js → Network-BrE6i_BP.js} +1 -1
- package/dist/assets/{NodeAddonsSettingsPanel-o-ykaRNH.js → NodeAddonsSettingsPanel-n2v2LAWi.js} +1 -1
- package/dist/assets/{Notifications-Bl5golQS.js → Notifications-BYZxT9AP.js} +1 -1
- package/dist/assets/{Pipeline-DSQKBqRo.js → Pipeline-BDiIc9C5.js} +1 -1
- package/dist/assets/{PrivacyMaskSettings-D6upVDCO.js → PrivacyMaskSettings-mpx3kl1W.js} +1 -1
- package/dist/assets/{Recordings-BnE73Fzq.js → Recordings-BwDKglkp.js} +1 -1
- package/dist/assets/{ScanSubnetEditor-IaqiW7y-.js → ScanSubnetEditor-B_jVzJCm.js} +1 -1
- package/dist/assets/{SceneMonitorEditor-B9efTbgK.js → SceneMonitorEditor-HTEqKGnK.js} +1 -1
- package/dist/assets/{SessionsList-7r1RdGCD.js → SessionsList-jMPji6fi.js} +1 -1
- package/dist/assets/{Showroom-783xHdUL.js → Showroom-DXbBEIk5.js} +1 -1
- package/dist/assets/{StorageLocationsTable-DKHWC9nh.js → StorageLocationsTable-B9gPPayG.js} +1 -1
- package/dist/assets/{System-Bx9kJ2Vx.js → System-CEoVcTQk.js} +1 -1
- package/dist/assets/Templates-CtKnUTcZ.js +1 -0
- package/dist/assets/{Terminal-D7L1JyUx.js → Terminal-CMeY2gPT.js} +1 -1
- package/dist/assets/{TrainingProviders-I5H6sEuq.js → TrainingProviders-B7wPszf6.js} +1 -1
- package/dist/assets/{Viewer-1Blv7Ztf.js → Viewer-07BkGobi.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DmpAM1mu.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BfC_P9cK.js} +1 -1
- package/dist/assets/{addon-icons-context-BEfxHNMO.js → addon-icons-context-24OnMWI-.js} +1 -1
- package/dist/assets/{ai-page.helpers-zhKHU1bv.js → ai-page.helpers-V2sVuwrA.js} +1 -1
- package/dist/assets/{archive-Djs_JYv3.js → archive-CvMfQY3E.js} +1 -1
- package/dist/assets/{assignment-candidates-CmqGReT0.js → assignment-candidates-w1YrnWCI.js} +1 -1
- package/dist/assets/{authed-media-BpqhukLe.js → authed-media-sNQSh-A8.js} +1 -1
- package/dist/assets/{bell-off-Ct98laYU.js → bell-off-B4ksiU12.js} +1 -1
- package/dist/assets/{board-model-D6ERqD8s.js → board-model-CCoTj6a4.js} +1 -1
- package/dist/assets/{boxes-B29vzWV6.js → boxes-C9Y0YvOc.js} +1 -1
- package/dist/assets/{calendar-clock-CBwyNflj.js → calendar-clock-CqZRVSc3.js} +1 -1
- package/dist/assets/circle-slash-DDhnvhLN.js +1 -0
- package/dist/assets/client-kWeONSGL.js +809 -0
- package/dist/assets/{create-composition-BjzhtLA0.js → create-composition-BxoEkLNU.js} +1 -1
- package/dist/assets/crop-D1l0Xs25.js +1 -0
- package/dist/assets/{database-zap-BSNprl1e.js → database-zap-Bk33ph_X.js} +1 -1
- package/dist/assets/{device-integration-icon-CVQW3uUx.js → device-integration-icon-C_3I9KjH.js} +1 -1
- package/dist/assets/device-picker-model-C64DegYL.js +1 -0
- package/dist/assets/dist-DXhYk_uu.js +809 -0
- package/dist/assets/{dist-BtWxYt15.js → dist-Dli1FBe2.js} +1 -1
- package/dist/assets/{eraser-B2SV94Kf.js → eraser-C1LaIkqO.js} +1 -1
- package/dist/assets/{file-up-BY1FyH2Q.js → file-up-CODncsO3.js} +1 -1
- package/dist/assets/{format-DAm6he6w.js → format-DJ7tKDrP.js} +1 -1
- package/dist/assets/{hard-drive-download-BTrg390i.js → hard-drive-download-gFUluoPC.js} +1 -1
- package/dist/assets/{hostInit-BDNMYuMC.js → hostInit-DPsNwfFC.js} +1 -1
- package/dist/assets/i18n-DBlmrJTH.js +1 -0
- package/dist/assets/icons-BM3wcj03.js +1 -0
- package/dist/assets/{index-0zF1qyaf.js → index-UQRaV7sW.js} +3 -3
- package/dist/assets/{key-VMD0Nojq.js → key-BSgMvX5L.js} +1 -1
- package/dist/assets/{key-square-DYDS2ySy.js → key-square-CX058EfV.js} +1 -1
- package/dist/assets/{layers-B5Q59zGJ.js → layers-DgoxyPih.js} +1 -1
- package/dist/assets/{link-2-off-D2FSHUkT.js → link-2-off-DmtgBwh-.js} +1 -1
- package/dist/assets/{linked-devices-model-DdQpLGk3.js → linked-devices-model-D_tVbJ-Z.js} +1 -1
- package/dist/assets/{list-ordered-Dcctov2f.js → list-ordered-C0l-Wwk-.js} +1 -1
- package/dist/assets/{memory-stick-C7K-tKSa.js → memory-stick-BSUaqG9H.js} +1 -1
- package/dist/assets/{message-square-plus-mVoh3HdQ.js → message-square-plus-spORh6qX.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-137671ea.js → mf-entry-bootstrap-0-513ce36e.js} +2 -2
- package/dist/assets/{mic-off-DtLUWxtz.js → mic-off-DiGyKjsE.js} +1 -1
- package/dist/assets/{monitor-off-DyTKg8lR.js → monitor-off-CatAL1-V.js} +1 -1
- package/dist/assets/{monitor-smartphone-gg9swCyF.js → monitor-smartphone-CrChoiUo.js} +1 -1
- package/dist/assets/mount-C64DegYL.js +1 -0
- package/dist/assets/{notification-rule-status-hT9lSvAp.js → notification-rule-status-QcUW9-xh.js} +1 -1
- package/dist/assets/{player-overlays-nsKWep_b.js → player-overlays-CC-b3--a.js} +1 -1
- package/dist/assets/remoteEntry-USvAUUw-.js +1 -0
- package/dist/assets/{ruler-B1CteblT.js → ruler-6Q54d4xt.js} +1 -1
- package/dist/assets/{scissors-CaA205Yl.js → scissors-BBC_GGoc.js} +1 -1
- package/dist/assets/{search-x-DFRNlPyV.js → search-x-CHDiifxm.js} +1 -1
- package/dist/assets/{send-CPG04w86.js → send-CwDFB9fX.js} +1 -1
- package/dist/assets/{settings-2-BFvRIHHf.js → settings-2-C5tt8eea.js} +1 -1
- package/dist/assets/shapes-C5Nnn9NE.js +1 -0
- package/dist/assets/{sigma-CGh2ukye.js → sigma-BSlFNDI5.js} +1 -1
- package/dist/assets/{speaker-CiFv1--z.js → speaker-ydML9LxI.js} +1 -1
- package/dist/assets/{src-C8Zf9Q7y.js → src-74VUgk_H.js} +3 -3
- package/dist/assets/{sso-popup-Cs85_JEB.js → sso-popup-UlSzMwYE.js} +1 -1
- package/dist/assets/{step-inspector-model-DeHccH5q.js → step-inspector-model-BjV68lpZ.js} +1 -1
- package/dist/assets/{table-2-Cgy92RuE.js → table-2-CeAydAOI.js} +1 -1
- package/dist/assets/{timer-reset-BtNgj9Cs.js → timer-reset-B_Ta8kGS.js} +1 -1
- package/dist/assets/{tv-DXjaCKCw.js → tv-BdJr-riI.js} +1 -1
- package/dist/assets/{unlink-CK0jpIZO.js → unlink-DzO14DVn.js} +1 -1
- package/dist/assets/{usb-CDcQOKbY.js → usb-W-ktPgHL.js} +1 -1
- package/dist/assets/{use-device-bound-caps-CvYPEjf_.js → use-device-bound-caps-BzRqxW9K.js} +1 -1
- package/dist/assets/{use-scenes-feed-tId-2Z23.js → use-scenes-feed-DZH0C2Or.js} +1 -1
- package/dist/assets/{use-stationary-objects-Bx6JK5H8.js → use-stationary-objects-CxfCt8t5.js} +1 -1
- package/dist/assets/{useAdminDeviceRemoval-ScXvVZYj.js → useAdminDeviceRemoval-BDwjFK9L.js} +1 -1
- package/dist/assets/useEventInvalidation-C64DegYL.js +1 -0
- package/dist/assets/{useNodeUrlSelection-ArB2g5FQ.js → useNodeUrlSelection-CavUTTX3.js} +1 -1
- package/dist/assets/useTemplateSave-BSq-JUcx.js +1 -0
- package/dist/assets/user-round-D8euVsR1.js +1 -0
- package/dist/assets/{user-x-Y72N_IkT.js → user-x--TnMk2gT.js} +1 -1
- package/dist/assets/{variable-CEsk8LrD.js → variable-Bz8zKWo2.js} +1 -1
- package/dist/assets/{video-CUSTu3rp.js → video-b4uGYAxS.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DvhyKcT_.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BTYYp2-O.js} +2 -2
- package/dist/index.html +10 -10
- package/dist/server/addon.js +24 -9
- package/package.json +2 -2
- package/dist/assets/Calendars-DclOLLCN.js +0 -1
- package/dist/assets/DeviceDetail-DrLi8nYZ.js +0 -2
- package/dist/assets/EditTemplateButton-CDWvPMbz.js +0 -1
- package/dist/assets/InstancesTable-CjKHvk50.js +0 -1
- package/dist/assets/Templates-7WYPtw3p.js +0 -1
- package/dist/assets/circle-slash-JQ7haXmS.js +0 -1
- package/dist/assets/client-wsT1qo5a.js +0 -809
- package/dist/assets/crop-DhVFvaTE.js +0 -1
- package/dist/assets/device-picker-model-DOA_AHBE.js +0 -1
- package/dist/assets/dist-Bh55Njjh.js +0 -809
- package/dist/assets/grip-vertical-BWxAjsXl.js +0 -1
- package/dist/assets/i18n-DFz3VmFc.js +0 -1
- package/dist/assets/icons-ZjiGL3Qs.js +0 -1
- package/dist/assets/mount-DOA_AHBE.js +0 -1
- package/dist/assets/remoteEntry-CmIIKd59.js +0 -1
- package/dist/assets/shapes-Cv8yN5GQ.js +0 -1
- package/dist/assets/useEventInvalidation-DOA_AHBE.js +0 -1
- package/dist/assets/user-round-BtQRG_UD.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,S as t,Y 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-nsKWep_b.js";import{cr as a,lr as o,sf as s,ur as c,vt as l,yi as u}from"./src-C8Zf9Q7y.js";import{G as d,W as f,ut as p}from"./index-0zF1qyaf.js";r();function m({title:n,children:r}){return e(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[t(`div`,{className:`border-b border-border px-4 py-2.5`,children:t(`h2`,{className:`text-xs font-semibold text-foreground uppercase tracking-wider`,children:n})}),t(`div`,{className:`p-4`,children:r})]})}function h({name:n,cssVar:r,hex:i}){return e(`div`,{className:`flex flex-col items-center gap-1.5`,children:[t(`div`,{className:`h-10 w-10 rounded-lg border border-border shadow-inner`,style:{backgroundColor:r?`var(${r})`:i}}),t(`span`,{className:`text-[10px] text-foreground-subtle text-center leading-tight`,children:n})]})}var g={sections:[{id:`demo`,title:`Demo Fields`,columns:2,fields:[{key:`name`,type:`text`,label:`Name`,placeholder:`Enter name`},{key:`count`,type:`number`,label:`Count`,min:0,max:100,unit:`items`},{key:`enabled`,type:`boolean`,label:`Enabled`},{key:`mode`,type:`select`,label:`Mode`,options:[{value:`a`,label:`Alpha`},{value:`b`,label:`Beta`}]},{key:`tags`,type:`tags`,label:`Tags`,span:2,suggestions:[`camera`,`zone`,`alert`]},{key:`confidence`,type:`slider`,label:`Confidence`,min:0,max:100,step:5,unit:`%`,span:2},{key:`info`,type:`info`,label:`Note`,content:`This is an informational message for the user.`,variant:`info`}]}]};function _(){let[r,_]=n({name:`Example`,count:10,enabled:!0,mode:`a`,tags:[`camera`],confidence:60});return e(`div`,{className:`p-6 space-y-6 max-w-5xl mx-auto`,children:[e(`div`,{className:`mb-6`,children:[t(`h1`,{className:`text-xl font-bold text-foreground`,children:`Component Showroom`}),t(`p`,{className:`text-sm text-foreground-subtle mt-1`,children:`All UI components at a glance`})]}),t(m,{title:`Typography`,children:e(`div`,{className:`space-y-3`,children:[t(`h1`,{className:`text-2xl font-bold text-foreground`,children:`Heading 1 — Display title`}),t(`h2`,{className:`text-xl font-semibold text-foreground`,children:`Heading 2 — Section title`}),t(`h3`,{className:`text-base font-semibold text-foreground`,children:`Heading 3 — Card title`}),t(`h4`,{className:`text-sm font-semibold text-foreground`,children:`Heading 4 — Sub-section`}),t(`p`,{className:`text-sm text-foreground`,children:`Body text — Regular paragraph content goes here. It uses the foreground color.`}),t(`p`,{className:`text-sm text-foreground-subtle`,children:`Subtle text — Secondary/descriptive text with reduced emphasis.`}),t(`p`,{className:`text-xs text-foreground-subtle uppercase tracking-wider font-semibold`,children:`Label / Caption`}),t(`p`,{className:`text-xs text-foreground-disabled`,children:`Disabled / placeholder text`})]})}),t(m,{title:`Colors`,children:e(`div`,{className:`flex flex-wrap gap-4`,children:[t(h,{name:`primary`,cssVar:`--color-primary`}),t(h,{name:`background`,cssVar:`--color-background`}),t(h,{name:`surface`,cssVar:`--color-surface`}),t(h,{name:`foreground`,cssVar:`--color-foreground`}),t(h,{name:`success`,cssVar:`--color-success`}),t(h,{name:`warning`,cssVar:`--color-warning`}),t(h,{name:`danger`,cssVar:`--color-danger`}),t(h,{name:`info`,cssVar:`--color-info`}),t(h,{name:`border`,cssVar:`--color-border`}),t(`div`,{className:`w-px`}),t(h,{name:`onvif`,hex:`#3b82f6`}),t(h,{name:`hikvision`,hex:`#a855f7`}),t(h,{name:`reolink`,hex:`#06b6d4`}),t(h,{name:`ha`,hex:`#22d3ee`}),t(h,{name:`rtsp`,hex:`#78716c`})]})}),t(m,{title:`Buttons`,children:e(`div`,{className:`flex flex-wrap gap-3`,children:[t(u,{variant:`unstyled`,className:`inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-white hover:opacity-90 transition-opacity`,children:`Primary`}),t(u,{variant:`unstyled`,className:`inline-flex items-center gap-1.5 rounded-md border border-border bg-surface px-4 py-2 text-sm font-medium text-foreground hover:bg-surface-hover transition-colors`,children:`Secondary`}),t(u,{variant:`unstyled`,className:`inline-flex items-center gap-1.5 rounded-md border border-danger/40 bg-danger/10 px-4 py-2 text-sm font-medium text-danger hover:bg-danger/20 transition-colors`,children:`Danger`}),t(u,{variant:`unstyled`,disabled:!0,className:`inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-white opacity-40 cursor-not-allowed`,children:`Disabled`}),t(u,{variant:`unstyled`,className:`inline-flex items-center gap-1.5 rounded-md border border-warning/40 bg-warning/10 px-4 py-2 text-sm font-medium text-warning hover:bg-warning/20 transition-colors`,children:`Warning`}),t(u,{variant:`unstyled`,className:`inline-flex items-center gap-1.5 rounded-md border border-success/40 bg-success/10 px-4 py-2 text-sm font-medium text-success hover:bg-success/20 transition-colors`,children:`Success`})]})}),t(m,{title:`Inputs`,children:e(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Text input`}),t(s,{type:`text`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`Type something...`})]}),e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Number input`}),t(s,{type:`number`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`0`})]}),e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Password input`}),t(s,{type:`password`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`••••••••`})]}),e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Select`}),e(i,{className:`w-full`,children:[t(`option`,{children:`Option A`}),t(`option`,{children:`Option B`}),t(`option`,{children:`Option C`})]})]}),e(`div`,{className:`md:col-span-2`,children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Textarea`}),t(o,{className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30 resize-y min-h-[60px]`,placeholder:`Enter multi-line text...`,rows:3})]}),t(`div`,{children:e(`label`,{className:`flex items-center gap-2 cursor-pointer select-none`,children:[t(c,{className:`h-3.5 w-3.5 rounded border-border accent-primary`,defaultChecked:!0}),t(`span`,{className:`text-xs font-medium text-foreground`,children:`Checkbox (checked)`})]})}),t(`div`,{children:e(`div`,{className:`flex items-center justify-between`,children:[t(`span`,{className:`text-xs font-medium text-foreground`,children:`Toggle switch`}),t(v,{})]})}),e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Slider`}),t(a,{className:`w-full h-1 accent-primary cursor-pointer`,min:0,max:100,defaultValue:60})]}),e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Tags example`}),t(`div`,{className:`flex flex-wrap gap-1.5 rounded-md border border-border bg-background px-2 py-1.5 min-h-[38px]`,children:[`camera`,`zone`,`alert`].map(e=>t(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-primary/10 px-1.5 py-0.5 text-xs text-primary`,children:e},e))})]})]})}),t(m,{title:`Badges`,children:e(`div`,{className:`space-y-3`,children:[e(`div`,{children:[t(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`StatusBadge`}),t(`div`,{className:`flex flex-wrap gap-2`,children:[`running`,`stopped`,`error`,`online`,`offline`,`idle`].map(e=>t(l,{status:e},e))})]}),e(`div`,{children:[t(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`CapabilityBadges`}),t(d,{capabilities:[`streaming`,`detection`,`recording`,`audio`]})]})]})}),t(m,{title:`Cards`,children:e(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[e(`div`,{className:`rounded-lg bg-surface p-4`,children:[t(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Surface card`}),t(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `bg-surface`. Default card background."})]}),e(`div`,{className:`rounded-lg border border-border bg-surface p-4`,children:[t(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Bordered card`}),t(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `border border-border bg-surface`."})]}),e(`div`,{className:`rounded-lg border border-primary/30 bg-primary/5 p-4`,children:[t(`h3`,{className:`text-sm font-semibold text-primary mb-1`,children:`Accent card`}),t(`p`,{className:`text-xs text-foreground-subtle`,children:`Highlighted with primary color.`})]}),e(`div`,{className:`rounded-lg bg-background p-4`,children:[t(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Background card`}),t(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `bg-background`. Inset card."})]})]})}),t(m,{title:`Provider Icons`,children:t(`div`,{className:`flex flex-wrap gap-4`,children:[`onvif`,`hikvision`,`reolink`,`homeassistant`,`rtsp`,`onvif`].map(e=>t(f,{type:e,size:`lg`,showLabel:!0},e))})}),e(m,{title:`Form Builder Demo`,children:[t(p,{schema:g,values:r,onChange:_}),e(`details`,{className:`mt-3`,children:[t(`summary`,{className:`text-[10px] text-foreground-subtle cursor-pointer hover:text-foreground`,children:`View current values`}),t(`pre`,{className:`mt-2 rounded-md bg-background p-3 text-[10px] text-foreground-subtle overflow-auto`,children:JSON.stringify(r,null,2)})]})]}),t(m,{title:`Info Boxes`,children:t(`div`,{className:`space-y-2`,children:[{variant:`info`,label:`Info`,content:`This is an informational message. Use it for tips and hints.`},{variant:`warning`,label:`Warning`,content:`This action may have side effects. Proceed with caution.`},{variant:`success`,label:`Success`,content:`Operation completed successfully. All systems are green.`},{variant:`danger`,label:`Danger`,content:`This operation is irreversible. Data will be permanently deleted.`}].map(({variant:n,label:r,content:i})=>{let a={info:{border:`border-info`,bg:`bg-info/5`,text:`text-info`},warning:{border:`border-warning`,bg:`bg-warning/5`,text:`text-warning`},success:{border:`border-success`,bg:`bg-success/5`,text:`text-success`},danger:{border:`border-danger`,bg:`bg-danger/5`,text:`text-danger`}}[n];return e(`div`,{className:`rounded-md border-l-4 px-3 py-2.5 ${a.border} ${a.bg}`,children:[t(`p`,{className:`text-xs font-semibold mb-0.5 ${a.text}`,children:r}),t(`p`,{className:`text-xs text-foreground-subtle leading-relaxed`,children:i})]},n)})})})]})}function v(){let[e,r]=n(!0);return t(u,{variant:`unstyled`,type:`button`,role:`switch`,"aria-checked":e,onClick:()=>r(e=>!e),className:[`relative inline-flex h-4 w-8 shrink-0 items-center rounded-full transition-colors duration-150 cursor-pointer`,e?`bg-primary`:`bg-foreground-subtle/30`].join(` `),children:t(`span`,{className:[`inline-block h-3 w-3 rounded-full bg-white shadow transition-transform duration-150`,e?`translate-x-4`:`translate-x-0.5`].join(` `)})})}export{_ as ShowroomPage};
|
|
1
|
+
import{C as e,S as t,Y 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-CC-b3--a.js";import{cr as a,lr as o,sf as s,ur as c,vt as l,yi as u}from"./src-74VUgk_H.js";import{G as d,W as f,ut as p}from"./index-UQRaV7sW.js";r();function m({title:n,children:r}){return e(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[t(`div`,{className:`border-b border-border px-4 py-2.5`,children:t(`h2`,{className:`text-xs font-semibold text-foreground uppercase tracking-wider`,children:n})}),t(`div`,{className:`p-4`,children:r})]})}function h({name:n,cssVar:r,hex:i}){return e(`div`,{className:`flex flex-col items-center gap-1.5`,children:[t(`div`,{className:`h-10 w-10 rounded-lg border border-border shadow-inner`,style:{backgroundColor:r?`var(${r})`:i}}),t(`span`,{className:`text-[10px] text-foreground-subtle text-center leading-tight`,children:n})]})}var g={sections:[{id:`demo`,title:`Demo Fields`,columns:2,fields:[{key:`name`,type:`text`,label:`Name`,placeholder:`Enter name`},{key:`count`,type:`number`,label:`Count`,min:0,max:100,unit:`items`},{key:`enabled`,type:`boolean`,label:`Enabled`},{key:`mode`,type:`select`,label:`Mode`,options:[{value:`a`,label:`Alpha`},{value:`b`,label:`Beta`}]},{key:`tags`,type:`tags`,label:`Tags`,span:2,suggestions:[`camera`,`zone`,`alert`]},{key:`confidence`,type:`slider`,label:`Confidence`,min:0,max:100,step:5,unit:`%`,span:2},{key:`info`,type:`info`,label:`Note`,content:`This is an informational message for the user.`,variant:`info`}]}]};function _(){let[r,_]=n({name:`Example`,count:10,enabled:!0,mode:`a`,tags:[`camera`],confidence:60});return e(`div`,{className:`p-6 space-y-6 max-w-5xl mx-auto`,children:[e(`div`,{className:`mb-6`,children:[t(`h1`,{className:`text-xl font-bold text-foreground`,children:`Component Showroom`}),t(`p`,{className:`text-sm text-foreground-subtle mt-1`,children:`All UI components at a glance`})]}),t(m,{title:`Typography`,children:e(`div`,{className:`space-y-3`,children:[t(`h1`,{className:`text-2xl font-bold text-foreground`,children:`Heading 1 — Display title`}),t(`h2`,{className:`text-xl font-semibold text-foreground`,children:`Heading 2 — Section title`}),t(`h3`,{className:`text-base font-semibold text-foreground`,children:`Heading 3 — Card title`}),t(`h4`,{className:`text-sm font-semibold text-foreground`,children:`Heading 4 — Sub-section`}),t(`p`,{className:`text-sm text-foreground`,children:`Body text — Regular paragraph content goes here. It uses the foreground color.`}),t(`p`,{className:`text-sm text-foreground-subtle`,children:`Subtle text — Secondary/descriptive text with reduced emphasis.`}),t(`p`,{className:`text-xs text-foreground-subtle uppercase tracking-wider font-semibold`,children:`Label / Caption`}),t(`p`,{className:`text-xs text-foreground-disabled`,children:`Disabled / placeholder text`})]})}),t(m,{title:`Colors`,children:e(`div`,{className:`flex flex-wrap gap-4`,children:[t(h,{name:`primary`,cssVar:`--color-primary`}),t(h,{name:`background`,cssVar:`--color-background`}),t(h,{name:`surface`,cssVar:`--color-surface`}),t(h,{name:`foreground`,cssVar:`--color-foreground`}),t(h,{name:`success`,cssVar:`--color-success`}),t(h,{name:`warning`,cssVar:`--color-warning`}),t(h,{name:`danger`,cssVar:`--color-danger`}),t(h,{name:`info`,cssVar:`--color-info`}),t(h,{name:`border`,cssVar:`--color-border`}),t(`div`,{className:`w-px`}),t(h,{name:`onvif`,hex:`#3b82f6`}),t(h,{name:`hikvision`,hex:`#a855f7`}),t(h,{name:`reolink`,hex:`#06b6d4`}),t(h,{name:`ha`,hex:`#22d3ee`}),t(h,{name:`rtsp`,hex:`#78716c`})]})}),t(m,{title:`Buttons`,children:e(`div`,{className:`flex flex-wrap gap-3`,children:[t(u,{variant:`unstyled`,className:`inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-white hover:opacity-90 transition-opacity`,children:`Primary`}),t(u,{variant:`unstyled`,className:`inline-flex items-center gap-1.5 rounded-md border border-border bg-surface px-4 py-2 text-sm font-medium text-foreground hover:bg-surface-hover transition-colors`,children:`Secondary`}),t(u,{variant:`unstyled`,className:`inline-flex items-center gap-1.5 rounded-md border border-danger/40 bg-danger/10 px-4 py-2 text-sm font-medium text-danger hover:bg-danger/20 transition-colors`,children:`Danger`}),t(u,{variant:`unstyled`,disabled:!0,className:`inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-white opacity-40 cursor-not-allowed`,children:`Disabled`}),t(u,{variant:`unstyled`,className:`inline-flex items-center gap-1.5 rounded-md border border-warning/40 bg-warning/10 px-4 py-2 text-sm font-medium text-warning hover:bg-warning/20 transition-colors`,children:`Warning`}),t(u,{variant:`unstyled`,className:`inline-flex items-center gap-1.5 rounded-md border border-success/40 bg-success/10 px-4 py-2 text-sm font-medium text-success hover:bg-success/20 transition-colors`,children:`Success`})]})}),t(m,{title:`Inputs`,children:e(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Text input`}),t(s,{type:`text`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`Type something...`})]}),e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Number input`}),t(s,{type:`number`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`0`})]}),e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Password input`}),t(s,{type:`password`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`••••••••`})]}),e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Select`}),e(i,{className:`w-full`,children:[t(`option`,{children:`Option A`}),t(`option`,{children:`Option B`}),t(`option`,{children:`Option C`})]})]}),e(`div`,{className:`md:col-span-2`,children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Textarea`}),t(o,{className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30 resize-y min-h-[60px]`,placeholder:`Enter multi-line text...`,rows:3})]}),t(`div`,{children:e(`label`,{className:`flex items-center gap-2 cursor-pointer select-none`,children:[t(c,{className:`h-3.5 w-3.5 rounded border-border accent-primary`,defaultChecked:!0}),t(`span`,{className:`text-xs font-medium text-foreground`,children:`Checkbox (checked)`})]})}),t(`div`,{children:e(`div`,{className:`flex items-center justify-between`,children:[t(`span`,{className:`text-xs font-medium text-foreground`,children:`Toggle switch`}),t(v,{})]})}),e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Slider`}),t(a,{className:`w-full h-1 accent-primary cursor-pointer`,min:0,max:100,defaultValue:60})]}),e(`div`,{children:[t(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Tags example`}),t(`div`,{className:`flex flex-wrap gap-1.5 rounded-md border border-border bg-background px-2 py-1.5 min-h-[38px]`,children:[`camera`,`zone`,`alert`].map(e=>t(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-primary/10 px-1.5 py-0.5 text-xs text-primary`,children:e},e))})]})]})}),t(m,{title:`Badges`,children:e(`div`,{className:`space-y-3`,children:[e(`div`,{children:[t(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`StatusBadge`}),t(`div`,{className:`flex flex-wrap gap-2`,children:[`running`,`stopped`,`error`,`online`,`offline`,`idle`].map(e=>t(l,{status:e},e))})]}),e(`div`,{children:[t(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`CapabilityBadges`}),t(d,{capabilities:[`streaming`,`detection`,`recording`,`audio`]})]})]})}),t(m,{title:`Cards`,children:e(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[e(`div`,{className:`rounded-lg bg-surface p-4`,children:[t(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Surface card`}),t(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `bg-surface`. Default card background."})]}),e(`div`,{className:`rounded-lg border border-border bg-surface p-4`,children:[t(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Bordered card`}),t(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `border border-border bg-surface`."})]}),e(`div`,{className:`rounded-lg border border-primary/30 bg-primary/5 p-4`,children:[t(`h3`,{className:`text-sm font-semibold text-primary mb-1`,children:`Accent card`}),t(`p`,{className:`text-xs text-foreground-subtle`,children:`Highlighted with primary color.`})]}),e(`div`,{className:`rounded-lg bg-background p-4`,children:[t(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Background card`}),t(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `bg-background`. Inset card."})]})]})}),t(m,{title:`Provider Icons`,children:t(`div`,{className:`flex flex-wrap gap-4`,children:[`onvif`,`hikvision`,`reolink`,`homeassistant`,`rtsp`,`onvif`].map(e=>t(f,{type:e,size:`lg`,showLabel:!0},e))})}),e(m,{title:`Form Builder Demo`,children:[t(p,{schema:g,values:r,onChange:_}),e(`details`,{className:`mt-3`,children:[t(`summary`,{className:`text-[10px] text-foreground-subtle cursor-pointer hover:text-foreground`,children:`View current values`}),t(`pre`,{className:`mt-2 rounded-md bg-background p-3 text-[10px] text-foreground-subtle overflow-auto`,children:JSON.stringify(r,null,2)})]})]}),t(m,{title:`Info Boxes`,children:t(`div`,{className:`space-y-2`,children:[{variant:`info`,label:`Info`,content:`This is an informational message. Use it for tips and hints.`},{variant:`warning`,label:`Warning`,content:`This action may have side effects. Proceed with caution.`},{variant:`success`,label:`Success`,content:`Operation completed successfully. All systems are green.`},{variant:`danger`,label:`Danger`,content:`This operation is irreversible. Data will be permanently deleted.`}].map(({variant:n,label:r,content:i})=>{let a={info:{border:`border-info`,bg:`bg-info/5`,text:`text-info`},warning:{border:`border-warning`,bg:`bg-warning/5`,text:`text-warning`},success:{border:`border-success`,bg:`bg-success/5`,text:`text-success`},danger:{border:`border-danger`,bg:`bg-danger/5`,text:`text-danger`}}[n];return e(`div`,{className:`rounded-md border-l-4 px-3 py-2.5 ${a.border} ${a.bg}`,children:[t(`p`,{className:`text-xs font-semibold mb-0.5 ${a.text}`,children:r}),t(`p`,{className:`text-xs text-foreground-subtle leading-relaxed`,children:i})]},n)})})})]})}function v(){let[e,r]=n(!0);return t(u,{variant:`unstyled`,type:`button`,role:`switch`,"aria-checked":e,onClick:()=>r(e=>!e),className:[`relative inline-flex h-4 w-8 shrink-0 items-center rounded-full transition-colors duration-150 cursor-pointer`,e?`bg-primary`:`bg-foreground-subtle/30`].join(` `),children:t(`span`,{className:[`inline-block h-3 w-3 rounded-full bg-white shadow transition-transform duration-150`,e?`translate-x-4`:`translate-x-0.5`].join(` `)})})}export{_ as ShowroomPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,K as t,S as n,V as r,Y as i,et as a,o}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 s,Bn as c,Fi as l,Ir as u,_n as d,br as f,bt as p,ct as m}from"./player-overlays-nsKWep_b.js";import{ts as h}from"./client-wsT1qo5a.js";import{t as g}from"./archive-Djs_JYv3.js";import{t as _}from"./eraser-B2SV94Kf.js";import{t as v}from"./hard-drive-download-BTrg390i.js";import{Di as y,Js as b,Qi as x,Tu as S,cf as C,ed as w,nd as ee,td as te,yi as T}from"./src-C8Zf9Q7y.js";import{t as E}from"./i18n-DFz3VmFc.js";import{t as D}from"./useTranslation-BJr-n0es.js";import{J as O,st as k}from"./index-0zF1qyaf.js";import{t as A}from"./format-size-DIxKXxtj.js";import{t as ne}from"./InstancesTable-CjKHvk50.js";a();var re=`forceDeleteLocation`;function ie({row:e}){let{t}=D(),r=m(),i=o(),a=x(),s=async()=>{if(await r({title:t(`system.storage.forceDeleteTitle`,`Force delete "{{name}}"?`,{name:e.name}),message:t(`system.storage.forceDeleteNote`,`Removes the record only, without checking what is on the location. Anything still stored there becomes unreachable — index rows naming it stop resolving, and playback of those segments goes silently black rather than erroring.`),confirmLabel:t(`system.storage.forceDelete`,`Force delete`),variant:`danger`}))try{await a.mutateAsync({addonId:e.addonId,action:re,input:{id:e.id}}),await i.invalidateQueries({queryKey:[O]}),await i.invalidateQueries({queryKey:[[`storage`,`listLocations`]]})}catch(n){k({title:t(`providerInstances.deleteFailed`,`Could not delete`),message:`${e.name}: ${n instanceof Error?n.message:String(n)}`,severity:`critical`})}};return n(C,{icon:d,variant:`ghost`,size:`sm`,disabled:a.isPending,"aria-label":t(`system.storage.forceDeleteRow`,`Force delete {{name}}`,{name:e.name}),onClick:()=>void s()})}function ae(e){return`${(e/1024**3).toFixed(e>=100*1024**3?0:1)} GB`}function oe(e){return new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}function j({drain:t}){let{t:r}=D();if(t.kind===`idle`)return null;if(t.kind===`unreported`)return n(`span`,{"data-testid":`drain-unreported`,className:`text-[10px] text-foreground-subtle`,title:r(`storage.drainProgressLine.thisLocationIsDrainingThe`,`This location is draining. The hub has not reported how much is left yet — either the drain has just been set, or this hub predates the drain-progress report.`),children:r(`storage.drainProgressLine.drainingRemainingNotReportedYet`,`Draining · remaining not reported yet`)});if(t.kind===`drained`)return n(`span`,{"data-testid":`drain-done`,className:`text-[10px] text-success`,title:r(`storage.drainProgressLine.everythingThatWasHereHas`,`Everything that was here has been moved. The location is still in drain mode — it receives no new writes until you change that.`),children:r(`storage.drainProgressLine.drainedNothingLeftToMove`,`Drained · nothing left to move`)});let i=t.drainedFraction===null?null:Math.round(t.drainedFraction*100);return e(`span`,{"data-testid":`drain-progress`,className:`flex items-center gap-1.5 text-[10px] text-foreground-subtle tabular-nums`,children:[i!==null&&n(`span`,{"data-testid":`drain-bar`,className:`inline-block h-1 w-10 rounded-full bg-border overflow-hidden`,role:`progressbar`,"aria-label":r(`storage.drainProgressLine.drainProgress`,`Drain progress`),"aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":100,children:n(`span`,{className:`block h-full bg-warning`,style:{width:`${i}%`}})}),e(`span`,{children:[r(`storage.drainProgressLine.left`,{size:ae(t.bytesRemaining)}),i!==null&&` · ${r(`storage.drainProgressLine.moved`,{percent:i})}`]}),t.estimatedEmptyAtMs===null?n(`span`,{"data-testid":`drain-eta-absent`,title:r(`storage.drainProgressLine.theDrainIsPacedBy`,`The drain is paced by how fast this class of data is still growing, and that has not been observed yet. There is no date to give.`),children:r(`storage.drainProgressLine.emptyTimeNotKnownYet`,`· empty time not known yet`)}):e(`span`,{"data-testid":`drain-eta`,children:[`·`,` `,r(`storage.drainProgressLine.empty`,{when:oe(t.estimatedEmptyAtMs)})]})]})}var M=[`ok`,`warn`,`critical`];function N(e){return e>=.95?`critical`:e>=.85?`warn`:`ok`}function P(e){return Math.min(1,Math.max(0,e))}function F(e){let{availableBytes:t,totalBytes:n}=e;if(n===null||n<=0||t===null)return null;let r=P((n-t)/n);return{fraction:r,severity:N(r),recordingsFraction:P(e.usedBytes/n),freeBytes:t,totalBytes:n}}function se(e){if(e.length===0)return null;let t=0,n=0,r=0,i=0,a=null;for(let o of e){let e=F(o);if(e===null){n+=1;continue}t+=1,r+=e.totalBytes,i+=e.freeBytes,(a===null||M.indexOf(e.severity)>M.indexOf(a))&&(a=e.severity)}return{knownVolumes:t,unknownVolumes:n,totalBytes:r,freeBytes:i,severity:a}}function I(e){return Math.min(1,Math.max(0,e))}function L(e){return Math.round(I(e)*1e3)/10}function R(e){return`${String(Math.round(I(e)*100))}%`}function ce(e,t,n={}){let{totalBytes:r,availableBytes:i}=e;if(r===null||r<=0||i===null){let e=n.ownedBytes===void 0||n.ownedBytes===null||!Number.isFinite(n.ownedBytes)||n.ownedBytes<0?null:A(n.ownedBytes);return{kind:`unknown`,owned:e,summary:e===null?E.t(`helpers.locationCapacityBar.unknownSummary`):E.t(`helpers.locationCapacityBar.unknownSummaryOwned`,{size:e})}}let a=Math.min(Math.max(i,0),r),o=r-a,s=t===null||t<=0?0:t,c=Math.min(s,a),l=s>a,u=a-c,d=n.ownedBytes,f=d==null||!Number.isFinite(d)||d<0?null:Math.min(d,o),p=o-(f??0),m=F({usedBytes:f??o,availableBytes:a,totalBytes:r}),h=m===null?I(o/r):m.fraction,g=m===null?N(h):m.severity,_=f===null?null:m===null?I(f/r):m.recordingsFraction,v=n.cap??null,y=v===null?null:I((c+v.bytes)/r),b=v!==null&&f!==null&&f>v.bytes,x={total:A(r),freeTotal:A(a),freeTotalPercent:R(a/r),used:A(p),usedPercent:R(p/r),free:A(u),freePercent:R(u/r),reserve:s===0?null:E.t(`helpers.locationCapacityBar.reserveKept`,{size:A(s)}),owned:f===null||_===null?null:E.t(`helpers.locationCapacityBar.ownedOfRecordings`,{size:A(f),percent:R(_)}),cap:v===null?null:v.reason===`drain`?E.t(`helpers.locationCapacityBar.capDrain`,{size:A(v.bytes)}):E.t(`helpers.locationCapacityBar.capCap`,{size:A(v.bytes)})},S=[E.t(`helpers.locationCapacityBar.summaryFree`,{free:x.freeTotal,total:x.total,percent:x.freeTotalPercent}),x.owned===null?null:E.t(`helpers.locationCapacityBar.summaryOwned`,{owned:x.owned}),x.reserve===null?null:l?E.t(`helpers.locationCapacityBar.summaryReserveShort`,{reserve:x.reserve}):x.reserve,x.cap===null?null:b?E.t(`helpers.locationCapacityBar.summaryCapBelow`,{cap:x.cap}):x.cap].filter(e=>e!==null).join(` · `),C=[];return c>0&&C.push({segment:`reserve`,label:E.t(`helpers.locationCapacityBar.legendKeptFree`),value:A(s),alarming:l}),x.owned!==null&&C.push({segment:`owned`,label:E.t(`helpers.locationCapacityBar.legendCamstack`),value:x.owned,alarming:!1}),C.push({segment:`used`,label:f===null?E.t(`helpers.locationCapacityBar.legendUsed`):E.t(`helpers.locationCapacityBar.legendOtherData`),value:`${x.used} (${x.usedPercent})`,alarming:g===`critical`}),C.push({segment:`free`,label:E.t(`helpers.locationCapacityBar.legendFree`),value:`${x.free} (${x.freePercent})`,alarming:l}),v!==null&&C.push({segment:`cap`,label:v.reason===`drain`?E.t(`helpers.locationCapacityBar.legendDrainTarget`):E.t(`helpers.locationCapacityBar.legendCap`),value:E.t(`helpers.locationCapacityBar.legendCapValue`,{size:A(v.bytes)}),alarming:b}),{kind:`known`,severity:g,legend:C,segments:{reservePercent:L(c/r),ownedPercent:f===null?null:L(f/r),usedPercent:L(p/r),freePercent:L(u/r),capPercent:y===null?null:L(y)},labels:x,reserveExceedsFree:l,capBelowOwned:b,summary:S}}function z(e){return h(e)}function B(e){return e===`active`}var V=[{mode:`active`,get label(){return E.t(`helpers.locationMode.activeLabel`)},get consequence(){return E.t(`helpers.locationMode.activeConsequence`)},requiresConfirmation:!1},{mode:`readonly`,get label(){return E.t(`helpers.locationMode.readonlyLabel`)},get consequence(){return E.t(`helpers.locationMode.readonlyConsequence`)},requiresConfirmation:!1},{mode:`drain`,get label(){return E.t(`helpers.locationMode.drainLabel`)},get consequence(){return E.t(`helpers.locationMode.drainConsequence`)},requiresConfirmation:!1},{mode:`disabled`,get label(){return E.t(`helpers.locationMode.disabledLabel`)},get consequence(){return E.t(`helpers.locationMode.disabledConsequence`)},requiresConfirmation:!0}];function H(e){return V.find(t=>t.mode===e)??V[0]}function le(e){return H(e).requiresConfirmation}var ue=`Blocked: this is the last location of its type still accepting writes — new data would have nowhere to go.`;function U(e,t,n){return B(n)||!B(z(e))||t.some(t=>t.id!==e.id&&B(z(t)))?{blocked:!1,reason:``}:{blocked:!0,reason:ue}}function de(e,t){return{active:U(e,t,`active`).reason,readonly:U(e,t,`readonly`).reason,drain:U(e,t,`drain`).reason,disabled:U(e,t,`disabled`).reason}}var W=1024**3;function G(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function fe(e){let t=G(e.minFreeGb);if(t!==null)return{unit:`gb`,value:t};let n=G(e.minFreePercent);return n===null?{unit:`percent`,value:null}:{unit:`percent`,value:n}}function pe(e,t,n=10){if(e.unit===`gb`&&e.value!==null)return e.value*W;let r=e.value??n;return t===null||t<=0?null:t*Math.min(100,Math.max(0,r))/100}function me(e,t){let n=G(e.maxUsedGb);return n===null||n<0?null:{bytes:n*W,reason:t===`drain`?`drain`:`legacy`}}var K={ok:`bg-primary`,warn:`bg-warning`,critical:`bg-danger`},q={reserve:`bg-danger/40`,owned:`bg-foreground/50`,free:`bg-border`,cap:`bg-foreground`};function he(e,t){return e===`used`?K[t]:q[e]}function J({location:t,ownedBytes:r}){let{t:i}=D(),a=t.capacity??null,o=pe(fe(t.config),a?.totalBytes??null),s=ce({totalBytes:a?.totalBytes??null,availableBytes:a?.availableBytes??null},o,{ownedBytes:r??null,cap:me(t.config,z(t))});return s.kind===`unknown`?n(`div`,{className:`text-[10px] text-foreground-subtle italic`,title:s.summary,children:s.owned===null?i(`storage.locationCapacityBar.capacityUnknown`,`Capacity unknown`):i(`storage.locationCapacityBar.capacityUnknownCamstackHolds`,`Capacity unknown · CamStack holds {{owned}}`,{owned:s.owned})}):e(`div`,{className:`mt-1 space-y-1`,title:s.summary,children:[e(`div`,{className:`relative flex h-2 w-full max-w-md overflow-hidden rounded-full bg-border`,children:[s.segments.reservePercent>0&&n(`div`,{className:q.reserve,style:{width:`${String(s.segments.reservePercent)}%`}}),s.segments.ownedPercent!==null&&n(`div`,{className:q.owned,style:{width:`${String(s.segments.ownedPercent)}%`}}),n(`div`,{className:K[s.severity],style:{width:`${String(s.segments.usedPercent)}%`}}),n(`div`,{className:q.free,style:{width:`${String(s.segments.freePercent)}%`}}),s.segments.capPercent!==null&&n(`div`,{className:`absolute inset-y-0 w-px ${s.capBelowOwned?`bg-danger`:q.cap}`,style:{left:`${String(s.segments.capPercent)}%`}})]}),n(`ul`,{className:`flex flex-wrap items-center gap-x-3 gap-y-0.5`,children:s.legend.map(t=>e(`li`,{className:`flex items-center gap-1`,children:[n(`span`,{"aria-hidden":`true`,className:`inline-block h-2 w-2 shrink-0 rounded-sm ${he(t.segment,s.severity)}`}),e(`span`,{className:`text-[10px] tabular-nums ${t.alarming?`text-danger`:`text-foreground-subtle`}`,children:[t.label,` `,t.value]})]},t.segment))})]})}var ge={eventMedia:[`events`],recordingsLow:[`low`],recordings:[`high`,`mid`]},_e={eventMedia:`pipeline-analytics`,recordingsLow:`recorder`,recordings:`recorder`},ve=`storage.discardLocation`,Y=`storage.discardLocationStatus`,ye=`storage.discardLocationCancel`;function be(e){return ge[e]??null}function xe(e){return _e[e]??null}function Se(e){return!B(z(e))}function Ce(e,t){return be(e.type)===null||!Se(e)?!1:t.some(t=>t.id!==e.id&&B(z(t)))}var we=new Set([`idle`,`scanning`,`wiping-fs`,`wiping-db`,`cascading`,`complete`,`cancelled`,`error`]);function X(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function Z(e){return typeof e==`string`?e:null}function Te(e){if(typeof e!=`object`||!e)return null;let t=e;if(typeof t.running!=`boolean`)return null;let n=t.phase;if(typeof n!=`string`||!we.has(n))return null;let r=X(t.camerasTotal),i=X(t.camerasDone),a=X(t.foldersRemoved),o=X(t.dbRowsDeleted),s=X(t.ownersCascaded);return r===null||i===null||a===null||o===null||s===null?null:{running:t.running,locationId:Z(t.locationId),jobId:Z(t.jobId),phase:n,camerasTotal:r,camerasDone:i,foldersRemoved:a,dbRowsDeleted:o,ownersCascaded:s,detail:Z(t.detail)??``,startedAtMs:X(t.startedAtMs),finishedAtMs:X(t.finishedAtMs),error:Z(t.error)}}function Ee(e){if(e.phase===`complete`)return 100;if(e.phase===`cancelled`||e.phase===`error`||e.phase===`idle`)return e.camerasTotal>0?Math.min(99,Math.round(e.camerasDone/e.camerasTotal*100)):0;if(e.camerasTotal>0){let t=e.camerasDone/e.camerasTotal*85;return e.phase===`wiping-db`?Math.min(95,Math.round(t+8)):e.phase===`cascading`?Math.min(99,Math.round(t+12)):Math.min(85,Math.round(t))}return e.phase===`scanning`?2:5}var De=2e3;function Oe({location:e,siblings:t}){return Ce(e,t)?n(ke,{location:e}):null}function ke({location:t}){let{t:a}=D(),o=m(),s=x(),c=xe(t.type),[l,u]=i(null),[d,h]=i(null),[g,v]=i(!1);if(r(()=>{if(c===null)return;let e=!1,t=async()=>{try{let t=await s.mutateAsync({addonId:c,action:Y,input:{}});if(e)return;u(Te(t))}catch{}};t();let n=setInterval(()=>void t(),De);return()=>{e=!0,clearInterval(n)}},[c,t.id]),c===null)return null;let y=l!==null&&l.locationId===t.id,b=y&&l.running,S=y&&l.phase!==`idle`,C=async()=>{if(await o({title:a(`storage.locationDiscardControl.discardLeftoversOn`,`Discard leftovers on "{{displayName}}"?`,{displayName:t.displayName}),message:a(`storage.locationDiscardControl.permanentlyDeletesLeftoverFilesAnd`,`Permanently deletes leftover files and records on this location. Other locations are not affected. This cannot be undone and may take hours.`),confirmLabel:a(`storage.locationDiscardControl.discardLeftovers`,`Discard leftovers`),variant:`danger`})){h(null),v(!0);try{await s.mutateAsync({addonId:c,action:ve,input:{locationId:t.id}}),u(Te(await s.mutateAsync({addonId:c,action:Y,input:{}})))}catch(e){h(e instanceof Error?e.message:String(e))}finally{v(!1)}}},w=async()=>{try{await s.mutateAsync({addonId:c,action:ye,input:{}})}catch(e){h(e instanceof Error?e.message:String(e))}};return e(`div`,{className:`flex flex-col gap-1 min-w-[9rem] max-w-[16rem]`,children:[b?e(T,{variant:`unstyled`,type:`button`,onClick:()=>void w(),className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger border border-danger/40 hover:bg-danger/10`,children:[n(p,{className:`h-3 w-3`}),a(`common.cancel`,`Cancel`)]}):e(T,{variant:`unstyled`,type:`button`,onClick:()=>void C(),disabled:g,title:a(`storage.locationDiscardControl.permanentlyDeleteLeftoverFilesOn`,`Permanently delete leftover files on this location. Other locations are not affected.`),className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger border border-danger/40 hover:bg-danger/10 disabled:opacity-50`,children:[g?n(f,{className:`h-3 w-3 animate-spin`}):n(_,{className:`h-3 w-3`}),a(`storage.locationDiscardControl.discardLeftovers`,`Discard leftovers`)]}),S&&l!==null&&e(`div`,{className:`space-y-0.5`,children:[n(`div`,{className:`h-1 rounded bg-border overflow-hidden`,children:n(`div`,{className:`h-full bg-primary transition-[width] duration-300`,style:{width:`${Ee(l)}%`}})}),e(`p`,{className:`text-[10px] text-foreground-subtle leading-tight`,children:[l.phase,l.camerasTotal>0?` · ${a(`storage.locationDiscardControl.camsProgress`,{done:l.camerasDone,total:l.camerasTotal})}`:``,l.dbRowsDeleted>0?` · ${a(`storage.locationDiscardControl.rowsDeleted`,{count:l.dbRowsDeleted})}`:``,l.detail?` · ${l.detail}`:``]})]}),(d||y&&l?.error)&&n(`p`,{className:`text-[10px] text-danger leading-tight`,children:d??l?.error})]})}a();var Ae={active:c,readonly:g,drain:v,disabled:s},je={active:`border-success/30 text-success hover:bg-success/10`,readonly:`border-border text-foreground-subtle hover:text-foreground hover:bg-primary/10`,drain:`border-warning/40 text-warning hover:bg-warning/10`,disabled:`border-danger/40 text-danger hover:bg-danger/10`};function Me({mode:t,open:r,onToggle:i}){let{t:a}=D(),o=H(t),s=Ae[t];return e(T,{variant:`unstyled`,type:`button`,"aria-expanded":r,"aria-label":a(`storage.locationModeSelector.locationState`,`Location state`),onClick:i,title:o.consequence,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium border ${je[t]}`,children:[n(s,{className:`h-3 w-3`}),o.label,n(l,{className:`h-3 w-3 ${r?`rotate-180`:``}`})]})}function Ne({mode:t,blockedReasons:i,onSelect:a,onDismiss:o}){let{t:s}=D();return r(()=>{let e=e=>{e.key===`Escape`&&o()};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[o]),e(`div`,{className:`w-full basis-full rounded-lg border border-border bg-background p-1`,role:`group`,"aria-label":s(`storage.locationModeSelector.locationStateChoices`,`Location state choices`),children:[e(`div`,{className:`flex items-center justify-between px-2 py-1`,children:[n(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:s(`storage.locationModeSelector.locationState`,`Location state`)}),n(T,{variant:`unstyled`,type:`button`,"aria-label":s(`storage.locationModeSelector.closeLocationStateChoices`,`Close location state choices`),onClick:o,className:`text-foreground-subtle hover:text-foreground`,children:n(p,{className:`h-3 w-3`})})]}),V.map(r=>{let c=i[r.mode],l=c!==``,u=Ae[r.mode],d=r.mode===t;return e(T,{variant:`unstyled`,type:`button`,role:`radio`,"aria-checked":d,"aria-label":r.label,disabled:l,onClick:()=>{l||(o(),d||a(r.mode))},className:`flex w-full flex-col items-start gap-0.5 rounded px-2 py-1.5 text-left ${l?`cursor-not-allowed opacity-60`:d?`bg-primary/10`:`hover:bg-primary/5`}`,children:[e(`span`,{className:`flex items-center gap-1.5 text-[11px] font-medium text-foreground`,children:[n(u,{className:`h-3 w-3`}),r.label,d&&n(`span`,{className:`text-[9px] uppercase text-primary`,children:s(`common.current`)})]}),n(`span`,{className:`text-[10px] leading-snug text-foreground-subtle`,children:r.consequence}),l&&n(`span`,{className:`text-[10px] leading-snug text-warning`,children:c})]},r.mode)})]})}function Pe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Q(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function Fe(e){if(!Pe(e))return null;let t=e.locationId;if(typeof t!=`string`||t.length===0)return null;let n=Q(e.startedAtMs),r=Q(e.startBytes),i=Q(e.bytesRemaining);return n===null||r===null||i===null||typeof e.drained!=`boolean`?null:{locationId:t,startedAtMs:n,startBytes:r,bytesRemaining:i,drained:e.drained,estimatedEmptyAtMs:Q(e.estimatedEmptyAtMs)}}function Ie(e){let t=new Map;if(!Array.isArray(e))return t;for(let n of e){let e=Fe(n);e!==null&&t.set(e.locationId,e)}return t}function Le(e){if(e.startBytes<=0||e.bytesRemaining>e.startBytes)return null;let t=e.startBytes-e.bytesRemaining;return Math.min(1,Math.max(0,t/e.startBytes))}function Re(e,t){return e?t===void 0?{kind:`unreported`}:t.drained||t.bytesRemaining<=0?{kind:`drained`}:{kind:`draining`,bytesRemaining:t.bytesRemaining,drainedFraction:Le(t),estimatedEmptyAtMs:t.estimatedEmptyAtMs}:{kind:`idle`}}function ze(e){return e.mode===`drain`?!0:e.config.readOnly===!0}var Be=[`recordings`,`recordingsLow`];function Ve(e){return e.locationIds!==void 0&&e.locationIds.length>0?e.locationIds:e.locationId===null?[]:[e.locationId]}function He(e,t){if(t===void 0||!Be.includes(e.type))return null;let n=t.find(t=>Ve(t).includes(e.id));return n===void 0||!Number.isFinite(n.usedBytes)||n.usedBytes<0?null:n.usedBytes}function Ue(e,t){let n=new Map;for(let r of e){let e=He(r,t);e!==null&&n.set(r.id,e)}return n}a();var We=[];function $(){let e=ee({}),n=S({},{refetchOnWindowFocus:!1}),r=w({},{refetchOnWindowFocus:!1}),i=e.data??We,a=t(()=>Ue(i,n.data?.locations),[i,n.data?.locations]),o=t(()=>Ie(r.data),[r.data]);return t(()=>({locations:i,ownedBytesById:a,drainOf:e=>Re(ze(e),o.get(e.id))}),[i,a,o])}a();function Ge({row:t}){let{t:r}=D(),a=m(),s=o(),c=$(),[l,u]=i(!1),d=b({onSuccess:()=>{s.invalidateQueries({queryKey:[O]}),s.invalidateQueries({queryKey:[[`storage`,`listLocations`]]}),u(!1)},onError:e=>k({title:r(`system.storage.modeFailed`,`Could not change the state`),message:`${t.name}: ${e.message}`,severity:`critical`})}),f=c.locations.find(e=>e.id===t.id);if(f===void 0)return null;let p=c.locations.filter(e=>e.type===f.type),h=z(f),g=c.drainOf(f),_=async e=>{le(e)&&!await a({title:r(`system.storage.disable`,`Disable "{{displayName}}"?`,{displayName:f.displayName}),message:r(`system.storage.nothingIsDeletedSetThe`,`{{consequence}} Nothing is deleted — set the location back to Read-only or Active to bring its footage back.`,{consequence:H(e).consequence}),confirmLabel:r(`common.disable`,`Disable`),variant:`danger`})||d.mutate({addonId:t.addonId,id:t.id,values:{mode:e}})};return e(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2 rounded-lg border border-border bg-surface p-3`,children:[e(`div`,{className:`min-w-0 flex-1 basis-60`,children:[n(J,{location:f,ownedBytes:c.ownedBytesById.get(f.id)??null}),g.kind!==`idle`&&n(j,{drain:g})]}),e(`div`,{className:`flex flex-wrap items-center gap-1`,children:[n(Oe,{location:f,siblings:p}),n(Me,{mode:h,open:l,onToggle:()=>u(e=>!e)})]}),l&&n(Ne,{mode:h,blockedReasons:de(f,p),onSelect:e=>void _(e),onDismiss:()=>u(!1)})]})}function Ke({row:t}){let r=$();if(t.kind!==`instance`)return null;let i=r.locations.find(e=>e.id===t.id);if(i===void 0)return null;let a=r.drainOf(i);return e(`div`,{className:`min-w-48`,children:[n(J,{location:i,ownedBytes:r.ownedBytesById.get(i.id)??null}),a.kind!==`idle`&&n(j,{drain:a})]})}function qe({row:e}){let t=$();if(e.kind!==`instance`)return null;let r=t.locations.find(t=>t.id===e.id);if(r===void 0)return null;let i=z(r);return n(y,{variant:i===`active`?`success`:i===`disabled`?`danger`:`default`,children:H(i).label})}function Je(e){return[{key:`capacity`,header:e.capacity,notSortableReason:e.capacity,render:e=>n(Ke,{row:e})},{key:`mode`,header:e.mode,nowrap:!0,notSortableReason:e.mode,render:e=>n(qe,{row:e})}]}function Ye(e,t,n){return!(n===`single`||t.length<=1||B(z(e))&&t.filter(e=>B(z(e))).length<=1)}a();var Xe=`storage`;function Ze({kinds:e}){let{t:r}=D(),{locations:i}=$(),a=te({}).data,o=e=>{let t=i.find(t=>t.id===e.id),n=a?.find(e=>e.id===t?.type);return t===void 0||n===void 0?!1:Ye(t,i.filter(e=>e.type===t.type),n.cardinality)},s=t(()=>Je({capacity:r(`system.storage.colCapacity`,`Capacity`),mode:r(`system.storage.colMode`,`State`)}),[r]),c=t(()=>e===void 0?void 0:t=>t.kind===`instance`&&t.kindId!==void 0&&e.includes(t.kindId),[e]);return n(ne,{functionCap:Xe,icon:u,title:r(`system.storage.title`,`Storage locations`),subtitle:r(`system.storage.subtitle`,`Where recordings, event media, artifacts and backups are kept. Each location is one kind on one provider; the state decides whether it takes writes, is only read, drains or is left alone.`),emptyTitle:r(`system.storage.emptyTitle`,`No storage locations yet`),emptyDescription:r(`system.storage.noStorageLocationsDeclaredBy`,`No storage locations declared by any installed addon.`),addLabel:r(`system.storage.addLocation`,`Add location`),extraColumns:s,lead:e=>n(Ge,{row:e}),canDelete:o,rowActions:e=>o(e)?n(ie,{row:e}):null,...c===void 0?{}:{rowFilter:c}})}export{F as n,se as r,Ze as t};
|
|
1
|
+
import{C as e,K as t,S as n,V as r,Y as i,et as a,o}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 s,Bn as c,Fi as l,Ir as u,_n as d,br as f,bt as p,ct as m}from"./player-overlays-CC-b3--a.js";import{ts as h}from"./client-kWeONSGL.js";import{t as g}from"./archive-CvMfQY3E.js";import{t as _}from"./eraser-C1LaIkqO.js";import{t as v}from"./hard-drive-download-gFUluoPC.js";import{Di as y,Js as b,Qi as x,Tu as S,cf as C,ed as w,nd as ee,td as te,yi as T}from"./src-74VUgk_H.js";import{t as E}from"./i18n-DBlmrJTH.js";import{t as D}from"./useTranslation-BJr-n0es.js";import{J as O,st as k}from"./index-UQRaV7sW.js";import{t as A}from"./format-size-DIxKXxtj.js";import{t as ne}from"./InstancesTable-C5ocf6KU.js";a();var re=`forceDeleteLocation`;function ie({row:e}){let{t}=D(),r=m(),i=o(),a=x(),s=async()=>{if(await r({title:t(`system.storage.forceDeleteTitle`,`Force delete "{{name}}"?`,{name:e.name}),message:t(`system.storage.forceDeleteNote`,`Removes the record only, without checking what is on the location. Anything still stored there becomes unreachable — index rows naming it stop resolving, and playback of those segments goes silently black rather than erroring.`),confirmLabel:t(`system.storage.forceDelete`,`Force delete`),variant:`danger`}))try{await a.mutateAsync({addonId:e.addonId,action:re,input:{id:e.id}}),await i.invalidateQueries({queryKey:[O]}),await i.invalidateQueries({queryKey:[[`storage`,`listLocations`]]})}catch(n){k({title:t(`providerInstances.deleteFailed`,`Could not delete`),message:`${e.name}: ${n instanceof Error?n.message:String(n)}`,severity:`critical`})}};return n(C,{icon:d,variant:`ghost`,size:`sm`,disabled:a.isPending,"aria-label":t(`system.storage.forceDeleteRow`,`Force delete {{name}}`,{name:e.name}),onClick:()=>void s()})}function ae(e){return`${(e/1024**3).toFixed(e>=100*1024**3?0:1)} GB`}function oe(e){return new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}function j({drain:t}){let{t:r}=D();if(t.kind===`idle`)return null;if(t.kind===`unreported`)return n(`span`,{"data-testid":`drain-unreported`,className:`text-[10px] text-foreground-subtle`,title:r(`storage.drainProgressLine.thisLocationIsDrainingThe`,`This location is draining. The hub has not reported how much is left yet — either the drain has just been set, or this hub predates the drain-progress report.`),children:r(`storage.drainProgressLine.drainingRemainingNotReportedYet`,`Draining · remaining not reported yet`)});if(t.kind===`drained`)return n(`span`,{"data-testid":`drain-done`,className:`text-[10px] text-success`,title:r(`storage.drainProgressLine.everythingThatWasHereHas`,`Everything that was here has been moved. The location is still in drain mode — it receives no new writes until you change that.`),children:r(`storage.drainProgressLine.drainedNothingLeftToMove`,`Drained · nothing left to move`)});let i=t.drainedFraction===null?null:Math.round(t.drainedFraction*100);return e(`span`,{"data-testid":`drain-progress`,className:`flex items-center gap-1.5 text-[10px] text-foreground-subtle tabular-nums`,children:[i!==null&&n(`span`,{"data-testid":`drain-bar`,className:`inline-block h-1 w-10 rounded-full bg-border overflow-hidden`,role:`progressbar`,"aria-label":r(`storage.drainProgressLine.drainProgress`,`Drain progress`),"aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":100,children:n(`span`,{className:`block h-full bg-warning`,style:{width:`${i}%`}})}),e(`span`,{children:[r(`storage.drainProgressLine.left`,{size:ae(t.bytesRemaining)}),i!==null&&` · ${r(`storage.drainProgressLine.moved`,{percent:i})}`]}),t.estimatedEmptyAtMs===null?n(`span`,{"data-testid":`drain-eta-absent`,title:r(`storage.drainProgressLine.theDrainIsPacedBy`,`The drain is paced by how fast this class of data is still growing, and that has not been observed yet. There is no date to give.`),children:r(`storage.drainProgressLine.emptyTimeNotKnownYet`,`· empty time not known yet`)}):e(`span`,{"data-testid":`drain-eta`,children:[`·`,` `,r(`storage.drainProgressLine.empty`,{when:oe(t.estimatedEmptyAtMs)})]})]})}var M=[`ok`,`warn`,`critical`];function N(e){return e>=.95?`critical`:e>=.85?`warn`:`ok`}function P(e){return Math.min(1,Math.max(0,e))}function F(e){let{availableBytes:t,totalBytes:n}=e;if(n===null||n<=0||t===null)return null;let r=P((n-t)/n);return{fraction:r,severity:N(r),recordingsFraction:P(e.usedBytes/n),freeBytes:t,totalBytes:n}}function se(e){if(e.length===0)return null;let t=0,n=0,r=0,i=0,a=null;for(let o of e){let e=F(o);if(e===null){n+=1;continue}t+=1,r+=e.totalBytes,i+=e.freeBytes,(a===null||M.indexOf(e.severity)>M.indexOf(a))&&(a=e.severity)}return{knownVolumes:t,unknownVolumes:n,totalBytes:r,freeBytes:i,severity:a}}function I(e){return Math.min(1,Math.max(0,e))}function L(e){return Math.round(I(e)*1e3)/10}function R(e){return`${String(Math.round(I(e)*100))}%`}function ce(e,t,n={}){let{totalBytes:r,availableBytes:i}=e;if(r===null||r<=0||i===null){let e=n.ownedBytes===void 0||n.ownedBytes===null||!Number.isFinite(n.ownedBytes)||n.ownedBytes<0?null:A(n.ownedBytes);return{kind:`unknown`,owned:e,summary:e===null?E.t(`helpers.locationCapacityBar.unknownSummary`):E.t(`helpers.locationCapacityBar.unknownSummaryOwned`,{size:e})}}let a=Math.min(Math.max(i,0),r),o=r-a,s=t===null||t<=0?0:t,c=Math.min(s,a),l=s>a,u=a-c,d=n.ownedBytes,f=d==null||!Number.isFinite(d)||d<0?null:Math.min(d,o),p=o-(f??0),m=F({usedBytes:f??o,availableBytes:a,totalBytes:r}),h=m===null?I(o/r):m.fraction,g=m===null?N(h):m.severity,_=f===null?null:m===null?I(f/r):m.recordingsFraction,v=n.cap??null,y=v===null?null:I((c+v.bytes)/r),b=v!==null&&f!==null&&f>v.bytes,x={total:A(r),freeTotal:A(a),freeTotalPercent:R(a/r),used:A(p),usedPercent:R(p/r),free:A(u),freePercent:R(u/r),reserve:s===0?null:E.t(`helpers.locationCapacityBar.reserveKept`,{size:A(s)}),owned:f===null||_===null?null:E.t(`helpers.locationCapacityBar.ownedOfRecordings`,{size:A(f),percent:R(_)}),cap:v===null?null:v.reason===`drain`?E.t(`helpers.locationCapacityBar.capDrain`,{size:A(v.bytes)}):E.t(`helpers.locationCapacityBar.capCap`,{size:A(v.bytes)})},S=[E.t(`helpers.locationCapacityBar.summaryFree`,{free:x.freeTotal,total:x.total,percent:x.freeTotalPercent}),x.owned===null?null:E.t(`helpers.locationCapacityBar.summaryOwned`,{owned:x.owned}),x.reserve===null?null:l?E.t(`helpers.locationCapacityBar.summaryReserveShort`,{reserve:x.reserve}):x.reserve,x.cap===null?null:b?E.t(`helpers.locationCapacityBar.summaryCapBelow`,{cap:x.cap}):x.cap].filter(e=>e!==null).join(` · `),C=[];return c>0&&C.push({segment:`reserve`,label:E.t(`helpers.locationCapacityBar.legendKeptFree`),value:A(s),alarming:l}),x.owned!==null&&C.push({segment:`owned`,label:E.t(`helpers.locationCapacityBar.legendCamstack`),value:x.owned,alarming:!1}),C.push({segment:`used`,label:f===null?E.t(`helpers.locationCapacityBar.legendUsed`):E.t(`helpers.locationCapacityBar.legendOtherData`),value:`${x.used} (${x.usedPercent})`,alarming:g===`critical`}),C.push({segment:`free`,label:E.t(`helpers.locationCapacityBar.legendFree`),value:`${x.free} (${x.freePercent})`,alarming:l}),v!==null&&C.push({segment:`cap`,label:v.reason===`drain`?E.t(`helpers.locationCapacityBar.legendDrainTarget`):E.t(`helpers.locationCapacityBar.legendCap`),value:E.t(`helpers.locationCapacityBar.legendCapValue`,{size:A(v.bytes)}),alarming:b}),{kind:`known`,severity:g,legend:C,segments:{reservePercent:L(c/r),ownedPercent:f===null?null:L(f/r),usedPercent:L(p/r),freePercent:L(u/r),capPercent:y===null?null:L(y)},labels:x,reserveExceedsFree:l,capBelowOwned:b,summary:S}}function z(e){return h(e)}function B(e){return e===`active`}var V=[{mode:`active`,get label(){return E.t(`helpers.locationMode.activeLabel`)},get consequence(){return E.t(`helpers.locationMode.activeConsequence`)},requiresConfirmation:!1},{mode:`readonly`,get label(){return E.t(`helpers.locationMode.readonlyLabel`)},get consequence(){return E.t(`helpers.locationMode.readonlyConsequence`)},requiresConfirmation:!1},{mode:`drain`,get label(){return E.t(`helpers.locationMode.drainLabel`)},get consequence(){return E.t(`helpers.locationMode.drainConsequence`)},requiresConfirmation:!1},{mode:`disabled`,get label(){return E.t(`helpers.locationMode.disabledLabel`)},get consequence(){return E.t(`helpers.locationMode.disabledConsequence`)},requiresConfirmation:!0}];function H(e){return V.find(t=>t.mode===e)??V[0]}function le(e){return H(e).requiresConfirmation}var ue=`Blocked: this is the last location of its type still accepting writes — new data would have nowhere to go.`;function U(e,t,n){return B(n)||!B(z(e))||t.some(t=>t.id!==e.id&&B(z(t)))?{blocked:!1,reason:``}:{blocked:!0,reason:ue}}function de(e,t){return{active:U(e,t,`active`).reason,readonly:U(e,t,`readonly`).reason,drain:U(e,t,`drain`).reason,disabled:U(e,t,`disabled`).reason}}var W=1024**3;function G(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function fe(e){let t=G(e.minFreeGb);if(t!==null)return{unit:`gb`,value:t};let n=G(e.minFreePercent);return n===null?{unit:`percent`,value:null}:{unit:`percent`,value:n}}function pe(e,t,n=10){if(e.unit===`gb`&&e.value!==null)return e.value*W;let r=e.value??n;return t===null||t<=0?null:t*Math.min(100,Math.max(0,r))/100}function me(e,t){let n=G(e.maxUsedGb);return n===null||n<0?null:{bytes:n*W,reason:t===`drain`?`drain`:`legacy`}}var K={ok:`bg-primary`,warn:`bg-warning`,critical:`bg-danger`},q={reserve:`bg-danger/40`,owned:`bg-foreground/50`,free:`bg-border`,cap:`bg-foreground`};function he(e,t){return e===`used`?K[t]:q[e]}function J({location:t,ownedBytes:r}){let{t:i}=D(),a=t.capacity??null,o=pe(fe(t.config),a?.totalBytes??null),s=ce({totalBytes:a?.totalBytes??null,availableBytes:a?.availableBytes??null},o,{ownedBytes:r??null,cap:me(t.config,z(t))});return s.kind===`unknown`?n(`div`,{className:`text-[10px] text-foreground-subtle italic`,title:s.summary,children:s.owned===null?i(`storage.locationCapacityBar.capacityUnknown`,`Capacity unknown`):i(`storage.locationCapacityBar.capacityUnknownCamstackHolds`,`Capacity unknown · CamStack holds {{owned}}`,{owned:s.owned})}):e(`div`,{className:`mt-1 space-y-1`,title:s.summary,children:[e(`div`,{className:`relative flex h-2 w-full max-w-md overflow-hidden rounded-full bg-border`,children:[s.segments.reservePercent>0&&n(`div`,{className:q.reserve,style:{width:`${String(s.segments.reservePercent)}%`}}),s.segments.ownedPercent!==null&&n(`div`,{className:q.owned,style:{width:`${String(s.segments.ownedPercent)}%`}}),n(`div`,{className:K[s.severity],style:{width:`${String(s.segments.usedPercent)}%`}}),n(`div`,{className:q.free,style:{width:`${String(s.segments.freePercent)}%`}}),s.segments.capPercent!==null&&n(`div`,{className:`absolute inset-y-0 w-px ${s.capBelowOwned?`bg-danger`:q.cap}`,style:{left:`${String(s.segments.capPercent)}%`}})]}),n(`ul`,{className:`flex flex-wrap items-center gap-x-3 gap-y-0.5`,children:s.legend.map(t=>e(`li`,{className:`flex items-center gap-1`,children:[n(`span`,{"aria-hidden":`true`,className:`inline-block h-2 w-2 shrink-0 rounded-sm ${he(t.segment,s.severity)}`}),e(`span`,{className:`text-[10px] tabular-nums ${t.alarming?`text-danger`:`text-foreground-subtle`}`,children:[t.label,` `,t.value]})]},t.segment))})]})}var ge={eventMedia:[`events`],recordingsLow:[`low`],recordings:[`high`,`mid`]},_e={eventMedia:`pipeline-analytics`,recordingsLow:`recorder`,recordings:`recorder`},ve=`storage.discardLocation`,Y=`storage.discardLocationStatus`,ye=`storage.discardLocationCancel`;function be(e){return ge[e]??null}function xe(e){return _e[e]??null}function Se(e){return!B(z(e))}function Ce(e,t){return be(e.type)===null||!Se(e)?!1:t.some(t=>t.id!==e.id&&B(z(t)))}var we=new Set([`idle`,`scanning`,`wiping-fs`,`wiping-db`,`cascading`,`complete`,`cancelled`,`error`]);function X(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function Z(e){return typeof e==`string`?e:null}function Te(e){if(typeof e!=`object`||!e)return null;let t=e;if(typeof t.running!=`boolean`)return null;let n=t.phase;if(typeof n!=`string`||!we.has(n))return null;let r=X(t.camerasTotal),i=X(t.camerasDone),a=X(t.foldersRemoved),o=X(t.dbRowsDeleted),s=X(t.ownersCascaded);return r===null||i===null||a===null||o===null||s===null?null:{running:t.running,locationId:Z(t.locationId),jobId:Z(t.jobId),phase:n,camerasTotal:r,camerasDone:i,foldersRemoved:a,dbRowsDeleted:o,ownersCascaded:s,detail:Z(t.detail)??``,startedAtMs:X(t.startedAtMs),finishedAtMs:X(t.finishedAtMs),error:Z(t.error)}}function Ee(e){if(e.phase===`complete`)return 100;if(e.phase===`cancelled`||e.phase===`error`||e.phase===`idle`)return e.camerasTotal>0?Math.min(99,Math.round(e.camerasDone/e.camerasTotal*100)):0;if(e.camerasTotal>0){let t=e.camerasDone/e.camerasTotal*85;return e.phase===`wiping-db`?Math.min(95,Math.round(t+8)):e.phase===`cascading`?Math.min(99,Math.round(t+12)):Math.min(85,Math.round(t))}return e.phase===`scanning`?2:5}var De=2e3;function Oe({location:e,siblings:t}){return Ce(e,t)?n(ke,{location:e}):null}function ke({location:t}){let{t:a}=D(),o=m(),s=x(),c=xe(t.type),[l,u]=i(null),[d,h]=i(null),[g,v]=i(!1);if(r(()=>{if(c===null)return;let e=!1,t=async()=>{try{let t=await s.mutateAsync({addonId:c,action:Y,input:{}});if(e)return;u(Te(t))}catch{}};t();let n=setInterval(()=>void t(),De);return()=>{e=!0,clearInterval(n)}},[c,t.id]),c===null)return null;let y=l!==null&&l.locationId===t.id,b=y&&l.running,S=y&&l.phase!==`idle`,C=async()=>{if(await o({title:a(`storage.locationDiscardControl.discardLeftoversOn`,`Discard leftovers on "{{displayName}}"?`,{displayName:t.displayName}),message:a(`storage.locationDiscardControl.permanentlyDeletesLeftoverFilesAnd`,`Permanently deletes leftover files and records on this location. Other locations are not affected. This cannot be undone and may take hours.`),confirmLabel:a(`storage.locationDiscardControl.discardLeftovers`,`Discard leftovers`),variant:`danger`})){h(null),v(!0);try{await s.mutateAsync({addonId:c,action:ve,input:{locationId:t.id}}),u(Te(await s.mutateAsync({addonId:c,action:Y,input:{}})))}catch(e){h(e instanceof Error?e.message:String(e))}finally{v(!1)}}},w=async()=>{try{await s.mutateAsync({addonId:c,action:ye,input:{}})}catch(e){h(e instanceof Error?e.message:String(e))}};return e(`div`,{className:`flex flex-col gap-1 min-w-[9rem] max-w-[16rem]`,children:[b?e(T,{variant:`unstyled`,type:`button`,onClick:()=>void w(),className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger border border-danger/40 hover:bg-danger/10`,children:[n(p,{className:`h-3 w-3`}),a(`common.cancel`,`Cancel`)]}):e(T,{variant:`unstyled`,type:`button`,onClick:()=>void C(),disabled:g,title:a(`storage.locationDiscardControl.permanentlyDeleteLeftoverFilesOn`,`Permanently delete leftover files on this location. Other locations are not affected.`),className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger border border-danger/40 hover:bg-danger/10 disabled:opacity-50`,children:[g?n(f,{className:`h-3 w-3 animate-spin`}):n(_,{className:`h-3 w-3`}),a(`storage.locationDiscardControl.discardLeftovers`,`Discard leftovers`)]}),S&&l!==null&&e(`div`,{className:`space-y-0.5`,children:[n(`div`,{className:`h-1 rounded bg-border overflow-hidden`,children:n(`div`,{className:`h-full bg-primary transition-[width] duration-300`,style:{width:`${Ee(l)}%`}})}),e(`p`,{className:`text-[10px] text-foreground-subtle leading-tight`,children:[l.phase,l.camerasTotal>0?` · ${a(`storage.locationDiscardControl.camsProgress`,{done:l.camerasDone,total:l.camerasTotal})}`:``,l.dbRowsDeleted>0?` · ${a(`storage.locationDiscardControl.rowsDeleted`,{count:l.dbRowsDeleted})}`:``,l.detail?` · ${l.detail}`:``]})]}),(d||y&&l?.error)&&n(`p`,{className:`text-[10px] text-danger leading-tight`,children:d??l?.error})]})}a();var Ae={active:c,readonly:g,drain:v,disabled:s},je={active:`border-success/30 text-success hover:bg-success/10`,readonly:`border-border text-foreground-subtle hover:text-foreground hover:bg-primary/10`,drain:`border-warning/40 text-warning hover:bg-warning/10`,disabled:`border-danger/40 text-danger hover:bg-danger/10`};function Me({mode:t,open:r,onToggle:i}){let{t:a}=D(),o=H(t),s=Ae[t];return e(T,{variant:`unstyled`,type:`button`,"aria-expanded":r,"aria-label":a(`storage.locationModeSelector.locationState`,`Location state`),onClick:i,title:o.consequence,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium border ${je[t]}`,children:[n(s,{className:`h-3 w-3`}),o.label,n(l,{className:`h-3 w-3 ${r?`rotate-180`:``}`})]})}function Ne({mode:t,blockedReasons:i,onSelect:a,onDismiss:o}){let{t:s}=D();return r(()=>{let e=e=>{e.key===`Escape`&&o()};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[o]),e(`div`,{className:`w-full basis-full rounded-lg border border-border bg-background p-1`,role:`group`,"aria-label":s(`storage.locationModeSelector.locationStateChoices`,`Location state choices`),children:[e(`div`,{className:`flex items-center justify-between px-2 py-1`,children:[n(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:s(`storage.locationModeSelector.locationState`,`Location state`)}),n(T,{variant:`unstyled`,type:`button`,"aria-label":s(`storage.locationModeSelector.closeLocationStateChoices`,`Close location state choices`),onClick:o,className:`text-foreground-subtle hover:text-foreground`,children:n(p,{className:`h-3 w-3`})})]}),V.map(r=>{let c=i[r.mode],l=c!==``,u=Ae[r.mode],d=r.mode===t;return e(T,{variant:`unstyled`,type:`button`,role:`radio`,"aria-checked":d,"aria-label":r.label,disabled:l,onClick:()=>{l||(o(),d||a(r.mode))},className:`flex w-full flex-col items-start gap-0.5 rounded px-2 py-1.5 text-left ${l?`cursor-not-allowed opacity-60`:d?`bg-primary/10`:`hover:bg-primary/5`}`,children:[e(`span`,{className:`flex items-center gap-1.5 text-[11px] font-medium text-foreground`,children:[n(u,{className:`h-3 w-3`}),r.label,d&&n(`span`,{className:`text-[9px] uppercase text-primary`,children:s(`common.current`)})]}),n(`span`,{className:`text-[10px] leading-snug text-foreground-subtle`,children:r.consequence}),l&&n(`span`,{className:`text-[10px] leading-snug text-warning`,children:c})]},r.mode)})]})}function Pe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Q(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function Fe(e){if(!Pe(e))return null;let t=e.locationId;if(typeof t!=`string`||t.length===0)return null;let n=Q(e.startedAtMs),r=Q(e.startBytes),i=Q(e.bytesRemaining);return n===null||r===null||i===null||typeof e.drained!=`boolean`?null:{locationId:t,startedAtMs:n,startBytes:r,bytesRemaining:i,drained:e.drained,estimatedEmptyAtMs:Q(e.estimatedEmptyAtMs)}}function Ie(e){let t=new Map;if(!Array.isArray(e))return t;for(let n of e){let e=Fe(n);e!==null&&t.set(e.locationId,e)}return t}function Le(e){if(e.startBytes<=0||e.bytesRemaining>e.startBytes)return null;let t=e.startBytes-e.bytesRemaining;return Math.min(1,Math.max(0,t/e.startBytes))}function Re(e,t){return e?t===void 0?{kind:`unreported`}:t.drained||t.bytesRemaining<=0?{kind:`drained`}:{kind:`draining`,bytesRemaining:t.bytesRemaining,drainedFraction:Le(t),estimatedEmptyAtMs:t.estimatedEmptyAtMs}:{kind:`idle`}}function ze(e){return e.mode===`drain`?!0:e.config.readOnly===!0}var Be=[`recordings`,`recordingsLow`];function Ve(e){return e.locationIds!==void 0&&e.locationIds.length>0?e.locationIds:e.locationId===null?[]:[e.locationId]}function He(e,t){if(t===void 0||!Be.includes(e.type))return null;let n=t.find(t=>Ve(t).includes(e.id));return n===void 0||!Number.isFinite(n.usedBytes)||n.usedBytes<0?null:n.usedBytes}function Ue(e,t){let n=new Map;for(let r of e){let e=He(r,t);e!==null&&n.set(r.id,e)}return n}a();var We=[];function $(){let e=ee({}),n=S({},{refetchOnWindowFocus:!1}),r=w({},{refetchOnWindowFocus:!1}),i=e.data??We,a=t(()=>Ue(i,n.data?.locations),[i,n.data?.locations]),o=t(()=>Ie(r.data),[r.data]);return t(()=>({locations:i,ownedBytesById:a,drainOf:e=>Re(ze(e),o.get(e.id))}),[i,a,o])}a();function Ge({row:t}){let{t:r}=D(),a=m(),s=o(),c=$(),[l,u]=i(!1),d=b({onSuccess:()=>{s.invalidateQueries({queryKey:[O]}),s.invalidateQueries({queryKey:[[`storage`,`listLocations`]]}),u(!1)},onError:e=>k({title:r(`system.storage.modeFailed`,`Could not change the state`),message:`${t.name}: ${e.message}`,severity:`critical`})}),f=c.locations.find(e=>e.id===t.id);if(f===void 0)return null;let p=c.locations.filter(e=>e.type===f.type),h=z(f),g=c.drainOf(f),_=async e=>{le(e)&&!await a({title:r(`system.storage.disable`,`Disable "{{displayName}}"?`,{displayName:f.displayName}),message:r(`system.storage.nothingIsDeletedSetThe`,`{{consequence}} Nothing is deleted — set the location back to Read-only or Active to bring its footage back.`,{consequence:H(e).consequence}),confirmLabel:r(`common.disable`,`Disable`),variant:`danger`})||d.mutate({addonId:t.addonId,id:t.id,values:{mode:e}})};return e(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2 rounded-lg border border-border bg-surface p-3`,children:[e(`div`,{className:`min-w-0 flex-1 basis-60`,children:[n(J,{location:f,ownedBytes:c.ownedBytesById.get(f.id)??null}),g.kind!==`idle`&&n(j,{drain:g})]}),e(`div`,{className:`flex flex-wrap items-center gap-1`,children:[n(Oe,{location:f,siblings:p}),n(Me,{mode:h,open:l,onToggle:()=>u(e=>!e)})]}),l&&n(Ne,{mode:h,blockedReasons:de(f,p),onSelect:e=>void _(e),onDismiss:()=>u(!1)})]})}function Ke({row:t}){let r=$();if(t.kind!==`instance`)return null;let i=r.locations.find(e=>e.id===t.id);if(i===void 0)return null;let a=r.drainOf(i);return e(`div`,{className:`min-w-48`,children:[n(J,{location:i,ownedBytes:r.ownedBytesById.get(i.id)??null}),a.kind!==`idle`&&n(j,{drain:a})]})}function qe({row:e}){let t=$();if(e.kind!==`instance`)return null;let r=t.locations.find(t=>t.id===e.id);if(r===void 0)return null;let i=z(r);return n(y,{variant:i===`active`?`success`:i===`disabled`?`danger`:`default`,children:H(i).label})}function Je(e){return[{key:`capacity`,header:e.capacity,notSortableReason:e.capacity,render:e=>n(Ke,{row:e})},{key:`mode`,header:e.mode,nowrap:!0,notSortableReason:e.mode,render:e=>n(qe,{row:e})}]}function Ye(e,t,n){return!(n===`single`||t.length<=1||B(z(e))&&t.filter(e=>B(z(e))).length<=1)}a();var Xe=`storage`;function Ze({kinds:e}){let{t:r}=D(),{locations:i}=$(),a=te({}).data,o=e=>{let t=i.find(t=>t.id===e.id),n=a?.find(e=>e.id===t?.type);return t===void 0||n===void 0?!1:Ye(t,i.filter(e=>e.type===t.type),n.cardinality)},s=t(()=>Je({capacity:r(`system.storage.colCapacity`,`Capacity`),mode:r(`system.storage.colMode`,`State`)}),[r]),c=t(()=>e===void 0?void 0:t=>t.kind===`instance`&&t.kindId!==void 0&&e.includes(t.kindId),[e]);return n(ne,{functionCap:Xe,icon:u,title:r(`system.storage.title`,`Storage locations`),subtitle:r(`system.storage.subtitle`,`Where recordings, event media, artifacts and backups are kept. Each location is one kind on one provider; the state decides whether it takes writes, is only read, drains or is left alone.`),emptyTitle:r(`system.storage.emptyTitle`,`No storage locations yet`),emptyDescription:r(`system.storage.noStorageLocationsDeclaredBy`,`No storage locations declared by any installed addon.`),addLabel:r(`system.storage.addLocation`,`Add location`),extraColumns:s,lead:e=>n(Ge,{row:e}),canDelete:o,rowActions:e=>o(e)?n(ie,{row:e}):null,...c===void 0?{}:{rowFilter:c}})}export{F as n,se as r,Ze as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,K as t,S as n,V as r,Y as i,a,et as o,o as s,t 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{Oi as u,Pn as d,br as f,hr as p,ht as m,ki as h,un as g,ut as _,xn as v}from"./player-overlays-nsKWep_b.js";import{fs as y}from"./client-wsT1qo5a.js";import{n as b,t as x}from"./ruler-B1CteblT.js";import{Af as S,Cd as C,Di as w,Ln as T,Rn as E,Wr as D,Xr as ee,Yr as O,_d as k,bd as A,bf as j,m as te,mn as ne,sf as M,ur as N,xf as P,yf as F,yi as I}from"./src-C8Zf9Q7y.js";import{t as L}from"./i18n-DFz3VmFc.js";import{t as R}from"./useTranslation-BJr-n0es.js";import{Ir as z,Lr as B,S as V,T as H}from"./index-0zF1qyaf.js";import{t as U}from"./AdminSectionedPage-LULz7C3_.js";import{t as W}from"./AdminPage-CjU3Qym-.js";import{t as G}from"./NodeAddonsSettingsPanel-o-ykaRNH.js";import{i as K,r as q,t as J}from"./Authentication-gZeEIiCJ.js";o();var re={detection:`border-green-500`,detector:`border-green-500`,streaming:`border-blue-500`,decode:`border-blue-500`,decoder:`border-blue-500`,recording:`border-orange-500`,recorder:`border-orange-500`,transcoding:`border-purple-500`,transcoder:`border-purple-500`,restream:`border-cyan-500`,restreamer:`border-cyan-500`,storage:`border-yellow-500`,notification:`border-pink-500`,notifier:`border-pink-500`,faces:`border-indigo-500`},Y={detection:`bg-green-500/5`,detector:`bg-green-500/5`,streaming:`bg-blue-500/5`,decode:`bg-blue-500/5`,decoder:`bg-blue-500/5`,recording:`bg-orange-500/5`,recorder:`bg-orange-500/5`,transcoding:`bg-purple-500/5`,transcoder:`bg-purple-500/5`,restream:`bg-cyan-500/5`,restreamer:`bg-cyan-500/5`,storage:`bg-yellow-500/5`,notification:`bg-pink-500/5`,notifier:`bg-pink-500/5`,faces:`bg-indigo-500/5`};function X({entry:t,actions:r}){let i=t.name.toLowerCase(),a=re[i]??`border-primary`,o=Y[i]??`bg-primary/5`,s=t.providers.find(e=>e.active),c=r?.pendingCapability===t.name;return e(`div`,{className:`rounded-lg border-t-2 border border-border ${a} ${o} p-3 space-y-2`,children:[e(`div`,{className:`flex items-center justify-between gap-2`,children:[e(`span`,{className:`text-xs font-semibold text-foreground capitalize flex items-center gap-1.5`,children:[t.name,c&&n(f,{className:`h-3 w-3 animate-spin text-primary`})]}),n(`span`,{className:`rounded-full px-2 py-0.5 text-[10px] font-medium ${t.mode===`singleton`?`bg-primary/10 text-primary`:`bg-info/10 text-info`}`,children:t.mode})]}),t.mode===`singleton`?n(ie,{entry:t,actions:r,activeProvider:s,isPending:c}):n(ae,{entry:t,actions:r,isPending:c})]})}function ie({entry:t,actions:r,activeProvider:i,isPending:a}){let{t:o}=R();if(!r)return n(`div`,{children:i?e(`div`,{className:`flex items-center gap-1.5 text-[10px] text-foreground`,children:[n(u,{className:`h-3 w-3 text-green-400 shrink-0`}),n(`span`,{className:`font-medium`,children:i.addonName}),n(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto`,children:`ACTIVE`})]}):n(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:o(`addons.capabilityMap.noActiveProvider`,`No active provider`)})});if(t.providers.length===0)return n(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:o(`addons.capabilityMap.noProviders`,`No providers`)});let s=`__inherit__`;return e(`div`,{className:`space-y-2`,children:[n(`div`,{className:`space-y-1`,children:t.providers.map(i=>{let o=i.active;return e(I,{variant:`unstyled`,type:`button`,disabled:a||o,onClick:()=>r.onSelectSingleton(t.name,i.addonId),className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-[10px] text-left transition-colors ${o?`bg-green-500/10 text-foreground cursor-default`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`}`,children:[n(`span`,{className:`h-2.5 w-2.5 rounded-full border shrink-0 ${o?`border-green-400 bg-green-400`:`border-border`}`}),n(`span`,{className:`font-medium truncate`,children:i.addonName}),o&&n(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto shrink-0`,children:`ACTIVE`})]},i.addonId)})}),t.perNode&&t.perNode.length>0&&n(`div`,{className:`space-y-2 pt-1 border-t border-border/40`,children:t.perNode.map(i=>{let c=i.hasOverride&&i.resolvedActive?i.resolvedActive:s,l=[{value:s,label:i.resolvedActive?o(`addons.capabilityMap.inheritGlobalWith`,{provider:i.resolvedActive}):o(`addons.capabilityMap.inheritGlobal`)},...i.providers.map(e=>({value:e,label:e}))],u=e=>{e===s?r.onClearNodeSingleton(t.name,i.nodeId):r.onSelectNodeSingleton(t.name,i.nodeId,e)},d=a;return e(`div`,{className:`space-y-0.5`,children:[e(`div`,{className:`text-[9px] font-semibold uppercase tracking-widest text-foreground-subtle/60 px-1.5`,children:[i.nodeId,i.hasOverride&&n(`span`,{className:`ml-1.5 rounded-full bg-primary/10 text-primary px-1 py-0.5 normal-case tracking-normal font-medium`,children:o(`common.override`)})]}),l.map(t=>{let r=c===t.value;return e(I,{variant:`unstyled`,type:`button`,disabled:d||r,onClick:()=>u(t.value),className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-[10px] text-left transition-colors ${r?`bg-green-500/10 text-foreground cursor-default`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`}`,children:[n(`span`,{className:`h-2.5 w-2.5 rounded-full border shrink-0 ${r?`border-green-400 bg-green-400`:`border-border`}`}),n(`span`,{className:`font-medium truncate`,children:t.label}),r&&t.value!==s&&n(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto shrink-0`,children:`ACTIVE`})]},t.value)})]},i.nodeId)})})]})}function ae({entry:t,actions:r,isPending:i}){let{t:a}=R();if(t.providers.length===0)return n(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:a(`addons.capabilityMap.noProviders`,`No providers`)});if(!r)return n(`div`,{className:`space-y-1`,children:t.providers.map(t=>e(`div`,{className:`flex items-center justify-between gap-2 text-[10px]`,children:[n(`span`,{className:`text-foreground-subtle`,children:t.addonName}),t.active&&n(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium`,children:`ACTIVE`})]},t.addonId))});let o=t.providers.filter(e=>e.active).map(e=>e.addonId),s=(e,n)=>{let i=n?[...new Set([...o,e])]:o.filter(t=>t!==e);r.onToggleCollection(t.name,i)};return n(`div`,{className:`space-y-1`,children:t.providers.map(t=>e(`label`,{className:`flex items-center justify-between gap-2 text-[10px] rounded px-1.5 py-1 transition-colors ${i?`opacity-50`:`hover:bg-surface-hover cursor-pointer`}`,children:[e(`span`,{className:`flex items-center gap-1.5 min-w-0`,children:[n(N,{checked:t.active,disabled:i,onChange:e=>s(t.addonId,e.target.checked),className:`h-3 w-3 accent-green-500 shrink-0`}),n(`span`,{className:`text-foreground truncate`,children:t.addonName})]}),t.active&&n(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium shrink-0`,children:`ACTIVE`})]},t.addonId))})}function Z({capabilities:e,actions:t}){let{t:r}=R();return e.length===0?n(`div`,{className:`text-xs text-foreground-subtle text-center py-8`,children:r(`addons.capabilityMap.noCapabilitiesRegistered`,`No capabilities registered`)}):n(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3`,children:e.map(e=>n(X,{entry:e,actions:t},e.name))})}var oe=[`capabilities`,`listCapabilities`];function se(e){return e===`singleton`||e===`collection`}function ce(e){let t=e.indexOf(`@`);return t===-1?L.t(`system.capabilities.providerHub`,{addonId:e}):`${e.slice(0,t)} (${e.slice(t+1)})`}function le(e,t){return{name:e.name,mode:t,providers:e.providers.map(n=>({addonId:n,addonName:ce(n),active:t===`singleton`?e.activeProvider===n:!e.disabledProviders.includes(n)})),...t===`singleton`&&e.perNode?{perNode:e.perNode}:{}}}function ue(){let{t:r}=R(),o=m(),[s,l]=i(null),[d,f]=i(null),p=a({queryKey:oe,queryFn:()=>o.trpcClient.capabilities.listCapabilities.query()}),_=t(()=>{let e=(p.data??[]).flatMap(e=>se(e.mode)?[le(e,e.mode)]:[]),t=e.filter(e=>e.mode===`singleton`).toSorted((e,t)=>e.name.localeCompare(t.name)),n=e.filter(e=>e.mode===`collection`).toSorted((e,t)=>e.name.localeCompare(t.name));return[...t,...n]},[p.data]),v=t(()=>_.filter(e=>e.mode===`singleton`),[_]),y=t(()=>_.filter(e=>e.mode===`collection`),[_]),b=c({mutationFn:e=>o.trpcClient.capabilities.setActiveSingleton.mutate({capability:e.capName,addonId:e.addonId}),onMutate:e=>{l(e.capName),f(null)},onSuccess:async(e,t)=>{f({kind:`success`,message:r(`system.capabilities.isNowActive`,`{{capName}} → {{addonId}} is now active.`,{capName:t.capName,addonId:t.addonId})}),await p.refetch()},onError:(e,t)=>{f({kind:`error`,message:r(`system.capabilities.failedToSet`,{cap:t.capName,error:e instanceof Error?e.message:r(`common.unknownError`)})})},onSettled:()=>l(null)}),x=c({mutationFn:e=>o.trpcClient.capabilities.setActiveSingleton.mutate({capability:e.capName,addonId:e.addonId,nodeId:e.nodeId}),onMutate:e=>{l(e.capName),f(null)},onSuccess:async(e,t)=>{f({kind:`success`,message:`${t.capName} @ ${t.nodeId} → ${t.addonId}.`}),await p.refetch()},onError:(e,t)=>{f({kind:`error`,message:r(`system.capabilities.failedToSetOnNode`,{cap:t.capName,node:t.nodeId,error:e instanceof Error?e.message:r(`common.unknownError`)})})},onSettled:()=>l(null)}),S=c({mutationFn:e=>o.trpcClient.capabilities.clearSingletonNodeOverride.mutate({capability:e.capName,nodeId:e.nodeId}),onMutate:e=>{l(e.capName),f(null)},onSuccess:async(e,t)=>{f({kind:`success`,message:r(`system.capabilities.nowInheritsTheGlobalDefault`,`{{capName}} @ {{nodeId}} now inherits the global default.`,{capName:t.capName,nodeId:t.nodeId})}),await p.refetch()},onError:(e,t)=>{f({kind:`error`,message:r(`system.capabilities.failedToClearOnNode`,{cap:t.capName,node:t.nodeId,error:e instanceof Error?e.message:r(`common.unknownError`)})})},onSettled:()=>l(null)}),C=c({mutationFn:e=>o.trpcClient.capabilities.setCollectionEnabledProviders.mutate({capability:e.capName,enabledAddonIds:[...e.enabledAddonIds]}),onMutate:e=>{l(e.capName),f(null)},onSuccess:async(e,t)=>{f({kind:`success`,message:r(`system.capabilities.providerSEnabled`,`{{capName}}: {{length}} provider(s) enabled.`,{capName:t.capName,length:t.enabledAddonIds.length})}),await p.refetch()},onError:(e,t)=>{f({kind:`error`,message:r(`system.capabilities.failedToUpdate`,{cap:t.capName,error:e instanceof Error?e.message:r(`common.unknownError`)})})},onSettled:()=>l(null)}),w={onSelectSingleton:(e,t)=>b.mutate({capName:e,addonId:t}),onSelectNodeSingleton:(e,t,n)=>x.mutate({capName:e,nodeId:t,addonId:n}),onClearNodeSingleton:(e,t)=>S.mutate({capName:e,nodeId:t}),onToggleCollection:(e,t)=>C.mutate({capName:e,enabledAddonIds:t}),pendingCapability:s};return e(W,{embedded:!0,icon:g,title:r(`system.capabilities.capabilities`,`Capabilities`),subtitle:r(`system.capabilities.chooseWhichProviderIsActive`,`Choose which provider is active for each system capability. Singleton caps pick exactly one provider; collection caps enable a set.`),children:[d&&e(`div`,{className:`flex items-center gap-2 rounded-md border px-3 py-2 text-xs ${d.kind===`success`?`border-success/30 bg-success/10 text-success`:`border-danger/40 bg-danger/10 text-danger`}`,children:[d.kind===`success`?n(u,{className:`h-3.5 w-3.5 shrink-0`}):n(h,{className:`h-3.5 w-3.5 shrink-0`}),n(`span`,{children:d.message})]}),p.isLoading&&n(`div`,{className:`flex items-center justify-center py-16`,children:n(`div`,{className:`animate-spin h-6 w-6 border-2 border-primary border-t-transparent rounded-full`})}),p.isError&&!p.isLoading&&n(O,{title:r(`system.capabilities.failedToLoadCapabilities`,`Failed to load capabilities`),message:p.error instanceof Error?p.error.message:r(`system.capabilities.unknownError`,`Unknown error`),onRetry:()=>void p.refetch()}),!p.isLoading&&!p.isError&&_.length===0&&n(`div`,{className:`text-xs text-foreground-subtle text-center py-16`,children:r(`system.capabilities.noCapabilitiesRegistered`,`No capabilities registered.`)}),!p.isLoading&&!p.isError&&_.length>0&&e(`div`,{className:`space-y-6`,children:[v.length>0&&e(`section`,{className:`space-y-2`,children:[n(`h2`,{className:`text-[11px] font-semibold uppercase tracking-widest text-foreground-subtle/70`,children:r(`system.capabilities.singletonPickOneProvider`,`Singleton — pick one provider`)}),n(Z,{capabilities:v,actions:w})]}),y.length>0&&e(`section`,{className:`space-y-2`,children:[n(`h2`,{className:`text-[11px] font-semibold uppercase tracking-widest text-foreground-subtle/70`,children:r(`system.capabilities.collectionEnableASet`,`Collection — enable a set`)}),n(Z,{capabilities:y,actions:w})]})]})]})}var de={escape:`Esc`,enter:`Enter`};function fe(e,t){let n=P(e),r=de[n.key]??n.key.toUpperCase();return t===`mac`?`${n.alt?`⌥`:``}${n.shift?`⇧`:``}${n.mod?`⌘`:``}${r}`:[...n.mod?[`Ctrl`]:[],...n.alt?[`Alt`]:[],...n.shift?[`Shift`]:[],r].join(`+`)}function pe(){let{t}=R(),r=F(),i=j();return n(T,{headingId:`settings-hotkeys`,title:t(`systemPage.settings.hotkeys.title`,`Keyboard shortcuts`),icon:b,testId:`settings-hotkeys`,children:e(`div`,{className:`space-y-2 p-3`,children:[n(`p`,{className:`text-xs text-foreground-subtle`,children:t(`systemPage.settings.hotkeys.description`,`The shortcuts active on this page. They cannot be changed.`)}),r.length===0?n(ee,{title:t(`systemPage.settings.hotkeys.empty`,`No shortcuts are active on this page.`)}):r.map(e=>n(E,{label:e.label??t(`systemPage.settings.hotkeys.unnamed`,`Shortcut`),children:n(`kbd`,{className:`rounded-md border border-border bg-surface px-1.5 py-0.5 font-mono text-xs text-foreground`,children:fe(e.combo,i)})},`${e.scope}|${e.combo}`))]})})}o();var me=[[`system`]];function Q(e){return e.toFixed(6).replace(/0+$/,``).replace(/\.$/,``)}function he(){let{t}=R(),a=s(),o=A(),c=C(),l=k(),[u,f]=i(``),[m,h]=i(``),[g,_]=i(null),v=o.data?.location??null;r(()=>{f(v===null?``:Q(v.latitude)),h(v===null?``:Q(v.longitude))},[v]);let y=async()=>{await a.invalidateQueries({queryKey:me})},b=async e=>{e.preventDefault();let t=Number(u),n=Number(m);if(u.trim()===``||m.trim()===``){_(`Enter both a latitude and a longitude, or press Clear.`);return}if(!Number.isFinite(t)||t<-90||t>90){_(`Latitude must be between -90 and 90 decimal degrees.`);return}if(!Number.isFinite(n)||n<-180||n>180){_(`Longitude must be between -180 and 180 decimal degrees.`);return}_(null),await c.mutateAsync({latitude:t,longitude:n}),await y()},x=async()=>{_(null),await c.mutateAsync(null),await y()},S=async()=>{_(null),await l.mutateAsync(),await y()},T=c.isPending||l.isPending||o.isLoading;return e(D,{className:`space-y-3`,children:[e(`div`,{className:`flex items-start justify-between gap-3`,children:[e(`div`,{className:`flex items-start gap-2`,children:[n(p,{className:`h-4 w-4 mt-0.5 text-muted-foreground shrink-0`}),n(`div`,{children:n(`h3`,{className:`text-sm font-medium`,children:t(`settings.siteLocationCard.siteLocation`,`Site location`)})})]}),v===null?n(w,{variant:`warning`,children:t(`settings.siteLocationCard.notConfigured`,`Not configured`)}):n(w,{variant:v.source===`operator-set`?`success`:`info`,children:v.source===`operator-set`?t(`settings.siteLocationCard.setByYou`,`Set by you`):t(`settings.siteLocationCard.derivedFromIp`,`Derived from IP`)})]}),v?.label!==void 0&&v.label!==``?n(`p`,{className:`text-xs text-muted-foreground`,children:t(`settings.siteLocationCard.detectedNear`,{place:v.label})}):null,v===null&&o.data?.derivationAttemptedAt!==null?e(`p`,{className:`text-xs text-warning`,children:[t(`settings.siteLocationCard.automaticDetectionFromThePublic`,`Automatic detection from the public IP did not succeed`),o.data?.derivationError!==null&&o.data?.derivationError!==void 0?`: ${o.data.derivationError}`:`.`,` `,t(`settings.siteLocationCard.itIsNotRetriedOn`,`It is not retried on its own — enter the coordinates, or press Detect.`)]}):null,e(`form`,{className:`flex flex-wrap items-end gap-3`,onSubmit:b,children:[e(`label`,{className:`flex flex-col gap-1 text-xs`,children:[n(`span`,{className:`text-muted-foreground`,children:t(`settings.siteLocationCard.latitude`,`Latitude`)}),n(M,{className:`w-40`,value:u,inputMode:`decimal`,placeholder:`40.851800`,onChange:e=>f(e.target.value),"aria-label":t(`settings.siteLocationCard.latitude`,`Latitude`)})]}),e(`label`,{className:`flex flex-col gap-1 text-xs`,children:[n(`span`,{className:`text-muted-foreground`,children:t(`settings.siteLocationCard.longitude`,`Longitude`)}),n(M,{className:`w-40`,value:m,inputMode:`decimal`,placeholder:`14.268100`,onChange:e=>h(e.target.value),"aria-label":t(`settings.siteLocationCard.longitude`,`Longitude`)})]}),n(I,{type:`submit`,disabled:T,children:t(`common.save`,`Save`)}),e(I,{type:`button`,variant:`ghost`,disabled:T,onClick:S,children:[n(d,{className:`h-3.5 w-3.5 mr-1`}),t(`settings.siteLocationCard.detectFromIp`,`Detect from IP`)]}),v===null?null:n(I,{type:`button`,variant:`ghost`,disabled:T,onClick:x,children:t(`settings.siteLocationCard.clear`,`Clear`)})]}),g===null?null:n(`p`,{className:`text-xs text-danger`,children:g}),n(`p`,{className:`text-xs text-muted-foreground`,children:t(`settings.siteLocationCard.wgs84DecimalDegreesDetectAsks`,`WGS84 decimal degrees. Detect asks a public geo-IP service once and will not overwrite a value you typed — clear it first.`)})]})}o();function ge(e){return y.some(t=>t===e)}function $(e){return ne.some(t=>t===e)}function _e(){let{t}=R(),r=te(),[a,o]=i(!1),[s,c]=i(null),l=e=>{o(!0),c(null),r.update(e).catch(e=>c(e instanceof Error?e.message:String(e))).finally(()=>o(!1))},u=r.status!==`ok`||!r.writable||a;return n(T,{headingId:`settings-units`,title:t(`systemPage.myAccess.units.title`,`Units`),icon:x,testId:`settings-units`,children:e(`div`,{className:`space-y-2 p-3`,children:[n(`p`,{className:`text-xs text-foreground-subtle`,children:t(`systemPage.myAccess.units.description`,`How readings are shown to you, on every device you sign in on. Stored values do not change.`)}),r.status===`error`&&n(O,{message:t(`systemPage.myAccess.units.loadError`,`Your unit preferences could not be read.`)}),r.status===`ok`&&!r.writable&&n(O,{message:t(`systemPage.myAccess.units.unreadable`,`The saved unit preferences are in a format this version cannot read, so they are left untouched.`)}),s!==null&&n(O,{message:s}),n(E,{label:t(`systemPage.myAccess.units.temperature`,`Temperature`),children:n(_,{"aria-label":t(`systemPage.myAccess.units.temperature`,`Temperature`),value:r.value.temperature,disabled:u,onChange:e=>{let t=e.target.value;$(t)&&l({temperature:t})},options:[{value:`celsius`,label:t(`systemPage.myAccess.units.celsius`,`Celsius (°C)`)},{value:`fahrenheit`,label:t(`systemPage.myAccess.units.fahrenheit`,`Fahrenheit (°F)`)}]})}),n(E,{label:t(`systemPage.myAccess.units.system`,`Other measurements`),children:n(_,{"aria-label":t(`systemPage.myAccess.units.system`,`Other measurements`),value:r.value.system,disabled:u,onChange:e=>{let t=e.target.value;ge(t)&&l({system:t})},options:[{value:`metric`,label:t(`systemPage.myAccess.units.metric`,`Metric (km/h, hPa, mm)`)},{value:`imperial`,label:t(`systemPage.myAccess.units.imperial`,`Imperial (mph, inHg, in)`)}]})})]})})}var ve=`system-config`;function ye(){let{t}=R(),{nodes:r,isLoading:i}=S(),a=r.find(e=>e.isHub&&e.isOnline),o=(a?.addons.map(e=>e.addonId)??[]).filter(e=>e!==ve);return e(W,{embedded:!0,children:[n(he,{}),i?n(`div`,{className:`text-foreground-subtle text-sm py-12 text-center`,children:t(`admin.system.settings.loadingHubTopology`,`Loading hub topology…`)}):a?e(l,{children:[n(K,{omitSectionIds:[J],emptyMessage:t(`admin.system.settings.bootstrapUnavailable`,`Not available — the addon that owns the server settings did not answer.`)}),o.length===0?n(`div`,{className:`text-foreground-subtle text-sm py-12 text-center`,children:t(`admin.system.settings.noAddonsInstalledOnThe`,`No addons installed on the hub yet.`)}):n(G,{nodeId:a.id,addonIds:o,level:`global`,omitSectionIds:[J,q]})]}):e(`div`,{className:`flex flex-col items-center justify-center text-foreground-subtle text-sm gap-2 py-12`,children:[n(v,{className:`h-8 w-8 opacity-30`}),n(`p`,{children:t(`admin.system.settings.noOnlineHubNodeFound`,`No online hub node found.`)}),n(`p`,{className:`text-xs`,children:t(`admin.system.settings.settingsWillAppearOnceThe`,`Settings will appear once the hub is reachable.`)})]}),e(`section`,{"aria-labelledby":`settings-per-user`,className:`mt-3 sm:mt-4 space-y-3 sm:space-y-4`,children:[n(`h2`,{id:`settings-per-user`,className:`text-xs font-semibold uppercase tracking-wide text-foreground-subtle`,children:t(`systemPage.settings.perUser`,`Your settings`)}),n(_e,{}),n(pe,{})]})]})}function be(){let{t:e}=R(),t=V(`/system/settings`,{t:e,isAdmin:!0})??{icon:v,title:e(`system.systemNav`,`System`)},{search:r,hash:i}=B();return new URLSearchParams(r).get(`tab`)===`secrets`?n(z,{replace:!0,to:`${H(r)}${i}`}):n(U,{icon:t.icon,title:t.title,defaultSection:`settings`,sectionsLabel:`${t.title} sections`,sections:[{id:`settings`,label:e(`system.system.settings`,`Settings`),content:n(ye,{})},{id:`capabilities`,label:e(`system.system.capabilities`,`Capabilities`),content:n(ue,{})}]})}export{be as SystemPage};
|
|
1
|
+
import{C as e,K as t,S as n,V as r,Y as i,a,et as o,o as s,t 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{Oi as u,Pn as d,br as f,hr as p,ht as m,ki as h,un as g,ut as _,xn as v}from"./player-overlays-CC-b3--a.js";import{fs as y}from"./client-kWeONSGL.js";import{n as b,t as x}from"./ruler-6Q54d4xt.js";import{Af as S,Cd as C,Di as w,Ln as T,Rn as E,Wr as D,Xr as ee,Yr as O,_d as k,bd as A,bf as j,m as te,mn as ne,sf as M,ur as N,xf as P,yf as F,yi as I}from"./src-74VUgk_H.js";import{t as L}from"./i18n-DBlmrJTH.js";import{t as R}from"./useTranslation-BJr-n0es.js";import{Ir as z,Lr as B,S as V,T as H}from"./index-UQRaV7sW.js";import{t as U}from"./AdminSectionedPage-BHMmyL4w.js";import{t as W}from"./AdminPage-D54ZN64f.js";import{t as G}from"./NodeAddonsSettingsPanel-n2v2LAWi.js";import{i as K,r as q,t as J}from"./Authentication-DZFEeCxa.js";o();var re={detection:`border-green-500`,detector:`border-green-500`,streaming:`border-blue-500`,decode:`border-blue-500`,decoder:`border-blue-500`,recording:`border-orange-500`,recorder:`border-orange-500`,transcoding:`border-purple-500`,transcoder:`border-purple-500`,restream:`border-cyan-500`,restreamer:`border-cyan-500`,storage:`border-yellow-500`,notification:`border-pink-500`,notifier:`border-pink-500`,faces:`border-indigo-500`},Y={detection:`bg-green-500/5`,detector:`bg-green-500/5`,streaming:`bg-blue-500/5`,decode:`bg-blue-500/5`,decoder:`bg-blue-500/5`,recording:`bg-orange-500/5`,recorder:`bg-orange-500/5`,transcoding:`bg-purple-500/5`,transcoder:`bg-purple-500/5`,restream:`bg-cyan-500/5`,restreamer:`bg-cyan-500/5`,storage:`bg-yellow-500/5`,notification:`bg-pink-500/5`,notifier:`bg-pink-500/5`,faces:`bg-indigo-500/5`};function X({entry:t,actions:r}){let i=t.name.toLowerCase(),a=re[i]??`border-primary`,o=Y[i]??`bg-primary/5`,s=t.providers.find(e=>e.active),c=r?.pendingCapability===t.name;return e(`div`,{className:`rounded-lg border-t-2 border border-border ${a} ${o} p-3 space-y-2`,children:[e(`div`,{className:`flex items-center justify-between gap-2`,children:[e(`span`,{className:`text-xs font-semibold text-foreground capitalize flex items-center gap-1.5`,children:[t.name,c&&n(f,{className:`h-3 w-3 animate-spin text-primary`})]}),n(`span`,{className:`rounded-full px-2 py-0.5 text-[10px] font-medium ${t.mode===`singleton`?`bg-primary/10 text-primary`:`bg-info/10 text-info`}`,children:t.mode})]}),t.mode===`singleton`?n(ie,{entry:t,actions:r,activeProvider:s,isPending:c}):n(ae,{entry:t,actions:r,isPending:c})]})}function ie({entry:t,actions:r,activeProvider:i,isPending:a}){let{t:o}=R();if(!r)return n(`div`,{children:i?e(`div`,{className:`flex items-center gap-1.5 text-[10px] text-foreground`,children:[n(u,{className:`h-3 w-3 text-green-400 shrink-0`}),n(`span`,{className:`font-medium`,children:i.addonName}),n(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto`,children:`ACTIVE`})]}):n(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:o(`addons.capabilityMap.noActiveProvider`,`No active provider`)})});if(t.providers.length===0)return n(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:o(`addons.capabilityMap.noProviders`,`No providers`)});let s=`__inherit__`;return e(`div`,{className:`space-y-2`,children:[n(`div`,{className:`space-y-1`,children:t.providers.map(i=>{let o=i.active;return e(I,{variant:`unstyled`,type:`button`,disabled:a||o,onClick:()=>r.onSelectSingleton(t.name,i.addonId),className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-[10px] text-left transition-colors ${o?`bg-green-500/10 text-foreground cursor-default`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`}`,children:[n(`span`,{className:`h-2.5 w-2.5 rounded-full border shrink-0 ${o?`border-green-400 bg-green-400`:`border-border`}`}),n(`span`,{className:`font-medium truncate`,children:i.addonName}),o&&n(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto shrink-0`,children:`ACTIVE`})]},i.addonId)})}),t.perNode&&t.perNode.length>0&&n(`div`,{className:`space-y-2 pt-1 border-t border-border/40`,children:t.perNode.map(i=>{let c=i.hasOverride&&i.resolvedActive?i.resolvedActive:s,l=[{value:s,label:i.resolvedActive?o(`addons.capabilityMap.inheritGlobalWith`,{provider:i.resolvedActive}):o(`addons.capabilityMap.inheritGlobal`)},...i.providers.map(e=>({value:e,label:e}))],u=e=>{e===s?r.onClearNodeSingleton(t.name,i.nodeId):r.onSelectNodeSingleton(t.name,i.nodeId,e)},d=a;return e(`div`,{className:`space-y-0.5`,children:[e(`div`,{className:`text-[9px] font-semibold uppercase tracking-widest text-foreground-subtle/60 px-1.5`,children:[i.nodeId,i.hasOverride&&n(`span`,{className:`ml-1.5 rounded-full bg-primary/10 text-primary px-1 py-0.5 normal-case tracking-normal font-medium`,children:o(`common.override`)})]}),l.map(t=>{let r=c===t.value;return e(I,{variant:`unstyled`,type:`button`,disabled:d||r,onClick:()=>u(t.value),className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-[10px] text-left transition-colors ${r?`bg-green-500/10 text-foreground cursor-default`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`}`,children:[n(`span`,{className:`h-2.5 w-2.5 rounded-full border shrink-0 ${r?`border-green-400 bg-green-400`:`border-border`}`}),n(`span`,{className:`font-medium truncate`,children:t.label}),r&&t.value!==s&&n(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto shrink-0`,children:`ACTIVE`})]},t.value)})]},i.nodeId)})})]})}function ae({entry:t,actions:r,isPending:i}){let{t:a}=R();if(t.providers.length===0)return n(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:a(`addons.capabilityMap.noProviders`,`No providers`)});if(!r)return n(`div`,{className:`space-y-1`,children:t.providers.map(t=>e(`div`,{className:`flex items-center justify-between gap-2 text-[10px]`,children:[n(`span`,{className:`text-foreground-subtle`,children:t.addonName}),t.active&&n(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium`,children:`ACTIVE`})]},t.addonId))});let o=t.providers.filter(e=>e.active).map(e=>e.addonId),s=(e,n)=>{let i=n?[...new Set([...o,e])]:o.filter(t=>t!==e);r.onToggleCollection(t.name,i)};return n(`div`,{className:`space-y-1`,children:t.providers.map(t=>e(`label`,{className:`flex items-center justify-between gap-2 text-[10px] rounded px-1.5 py-1 transition-colors ${i?`opacity-50`:`hover:bg-surface-hover cursor-pointer`}`,children:[e(`span`,{className:`flex items-center gap-1.5 min-w-0`,children:[n(N,{checked:t.active,disabled:i,onChange:e=>s(t.addonId,e.target.checked),className:`h-3 w-3 accent-green-500 shrink-0`}),n(`span`,{className:`text-foreground truncate`,children:t.addonName})]}),t.active&&n(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium shrink-0`,children:`ACTIVE`})]},t.addonId))})}function Z({capabilities:e,actions:t}){let{t:r}=R();return e.length===0?n(`div`,{className:`text-xs text-foreground-subtle text-center py-8`,children:r(`addons.capabilityMap.noCapabilitiesRegistered`,`No capabilities registered`)}):n(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3`,children:e.map(e=>n(X,{entry:e,actions:t},e.name))})}var oe=[`capabilities`,`listCapabilities`];function se(e){return e===`singleton`||e===`collection`}function ce(e){let t=e.indexOf(`@`);return t===-1?L.t(`system.capabilities.providerHub`,{addonId:e}):`${e.slice(0,t)} (${e.slice(t+1)})`}function le(e,t){return{name:e.name,mode:t,providers:e.providers.map(n=>({addonId:n,addonName:ce(n),active:t===`singleton`?e.activeProvider===n:!e.disabledProviders.includes(n)})),...t===`singleton`&&e.perNode?{perNode:e.perNode}:{}}}function ue(){let{t:r}=R(),o=m(),[s,l]=i(null),[d,f]=i(null),p=a({queryKey:oe,queryFn:()=>o.trpcClient.capabilities.listCapabilities.query()}),_=t(()=>{let e=(p.data??[]).flatMap(e=>se(e.mode)?[le(e,e.mode)]:[]),t=e.filter(e=>e.mode===`singleton`).toSorted((e,t)=>e.name.localeCompare(t.name)),n=e.filter(e=>e.mode===`collection`).toSorted((e,t)=>e.name.localeCompare(t.name));return[...t,...n]},[p.data]),v=t(()=>_.filter(e=>e.mode===`singleton`),[_]),y=t(()=>_.filter(e=>e.mode===`collection`),[_]),b=c({mutationFn:e=>o.trpcClient.capabilities.setActiveSingleton.mutate({capability:e.capName,addonId:e.addonId}),onMutate:e=>{l(e.capName),f(null)},onSuccess:async(e,t)=>{f({kind:`success`,message:r(`system.capabilities.isNowActive`,`{{capName}} → {{addonId}} is now active.`,{capName:t.capName,addonId:t.addonId})}),await p.refetch()},onError:(e,t)=>{f({kind:`error`,message:r(`system.capabilities.failedToSet`,{cap:t.capName,error:e instanceof Error?e.message:r(`common.unknownError`)})})},onSettled:()=>l(null)}),x=c({mutationFn:e=>o.trpcClient.capabilities.setActiveSingleton.mutate({capability:e.capName,addonId:e.addonId,nodeId:e.nodeId}),onMutate:e=>{l(e.capName),f(null)},onSuccess:async(e,t)=>{f({kind:`success`,message:`${t.capName} @ ${t.nodeId} → ${t.addonId}.`}),await p.refetch()},onError:(e,t)=>{f({kind:`error`,message:r(`system.capabilities.failedToSetOnNode`,{cap:t.capName,node:t.nodeId,error:e instanceof Error?e.message:r(`common.unknownError`)})})},onSettled:()=>l(null)}),S=c({mutationFn:e=>o.trpcClient.capabilities.clearSingletonNodeOverride.mutate({capability:e.capName,nodeId:e.nodeId}),onMutate:e=>{l(e.capName),f(null)},onSuccess:async(e,t)=>{f({kind:`success`,message:r(`system.capabilities.nowInheritsTheGlobalDefault`,`{{capName}} @ {{nodeId}} now inherits the global default.`,{capName:t.capName,nodeId:t.nodeId})}),await p.refetch()},onError:(e,t)=>{f({kind:`error`,message:r(`system.capabilities.failedToClearOnNode`,{cap:t.capName,node:t.nodeId,error:e instanceof Error?e.message:r(`common.unknownError`)})})},onSettled:()=>l(null)}),C=c({mutationFn:e=>o.trpcClient.capabilities.setCollectionEnabledProviders.mutate({capability:e.capName,enabledAddonIds:[...e.enabledAddonIds]}),onMutate:e=>{l(e.capName),f(null)},onSuccess:async(e,t)=>{f({kind:`success`,message:r(`system.capabilities.providerSEnabled`,`{{capName}}: {{length}} provider(s) enabled.`,{capName:t.capName,length:t.enabledAddonIds.length})}),await p.refetch()},onError:(e,t)=>{f({kind:`error`,message:r(`system.capabilities.failedToUpdate`,{cap:t.capName,error:e instanceof Error?e.message:r(`common.unknownError`)})})},onSettled:()=>l(null)}),w={onSelectSingleton:(e,t)=>b.mutate({capName:e,addonId:t}),onSelectNodeSingleton:(e,t,n)=>x.mutate({capName:e,nodeId:t,addonId:n}),onClearNodeSingleton:(e,t)=>S.mutate({capName:e,nodeId:t}),onToggleCollection:(e,t)=>C.mutate({capName:e,enabledAddonIds:t}),pendingCapability:s};return e(W,{embedded:!0,icon:g,title:r(`system.capabilities.capabilities`,`Capabilities`),subtitle:r(`system.capabilities.chooseWhichProviderIsActive`,`Choose which provider is active for each system capability. Singleton caps pick exactly one provider; collection caps enable a set.`),children:[d&&e(`div`,{className:`flex items-center gap-2 rounded-md border px-3 py-2 text-xs ${d.kind===`success`?`border-success/30 bg-success/10 text-success`:`border-danger/40 bg-danger/10 text-danger`}`,children:[d.kind===`success`?n(u,{className:`h-3.5 w-3.5 shrink-0`}):n(h,{className:`h-3.5 w-3.5 shrink-0`}),n(`span`,{children:d.message})]}),p.isLoading&&n(`div`,{className:`flex items-center justify-center py-16`,children:n(`div`,{className:`animate-spin h-6 w-6 border-2 border-primary border-t-transparent rounded-full`})}),p.isError&&!p.isLoading&&n(O,{title:r(`system.capabilities.failedToLoadCapabilities`,`Failed to load capabilities`),message:p.error instanceof Error?p.error.message:r(`system.capabilities.unknownError`,`Unknown error`),onRetry:()=>void p.refetch()}),!p.isLoading&&!p.isError&&_.length===0&&n(`div`,{className:`text-xs text-foreground-subtle text-center py-16`,children:r(`system.capabilities.noCapabilitiesRegistered`,`No capabilities registered.`)}),!p.isLoading&&!p.isError&&_.length>0&&e(`div`,{className:`space-y-6`,children:[v.length>0&&e(`section`,{className:`space-y-2`,children:[n(`h2`,{className:`text-[11px] font-semibold uppercase tracking-widest text-foreground-subtle/70`,children:r(`system.capabilities.singletonPickOneProvider`,`Singleton — pick one provider`)}),n(Z,{capabilities:v,actions:w})]}),y.length>0&&e(`section`,{className:`space-y-2`,children:[n(`h2`,{className:`text-[11px] font-semibold uppercase tracking-widest text-foreground-subtle/70`,children:r(`system.capabilities.collectionEnableASet`,`Collection — enable a set`)}),n(Z,{capabilities:y,actions:w})]})]})]})}var de={escape:`Esc`,enter:`Enter`};function fe(e,t){let n=P(e),r=de[n.key]??n.key.toUpperCase();return t===`mac`?`${n.alt?`⌥`:``}${n.shift?`⇧`:``}${n.mod?`⌘`:``}${r}`:[...n.mod?[`Ctrl`]:[],...n.alt?[`Alt`]:[],...n.shift?[`Shift`]:[],r].join(`+`)}function pe(){let{t}=R(),r=F(),i=j();return n(T,{headingId:`settings-hotkeys`,title:t(`systemPage.settings.hotkeys.title`,`Keyboard shortcuts`),icon:b,testId:`settings-hotkeys`,children:e(`div`,{className:`space-y-2 p-3`,children:[n(`p`,{className:`text-xs text-foreground-subtle`,children:t(`systemPage.settings.hotkeys.description`,`The shortcuts active on this page. They cannot be changed.`)}),r.length===0?n(ee,{title:t(`systemPage.settings.hotkeys.empty`,`No shortcuts are active on this page.`)}):r.map(e=>n(E,{label:e.label??t(`systemPage.settings.hotkeys.unnamed`,`Shortcut`),children:n(`kbd`,{className:`rounded-md border border-border bg-surface px-1.5 py-0.5 font-mono text-xs text-foreground`,children:fe(e.combo,i)})},`${e.scope}|${e.combo}`))]})})}o();var me=[[`system`]];function Q(e){return e.toFixed(6).replace(/0+$/,``).replace(/\.$/,``)}function he(){let{t}=R(),a=s(),o=A(),c=C(),l=k(),[u,f]=i(``),[m,h]=i(``),[g,_]=i(null),v=o.data?.location??null;r(()=>{f(v===null?``:Q(v.latitude)),h(v===null?``:Q(v.longitude))},[v]);let y=async()=>{await a.invalidateQueries({queryKey:me})},b=async e=>{e.preventDefault();let t=Number(u),n=Number(m);if(u.trim()===``||m.trim()===``){_(`Enter both a latitude and a longitude, or press Clear.`);return}if(!Number.isFinite(t)||t<-90||t>90){_(`Latitude must be between -90 and 90 decimal degrees.`);return}if(!Number.isFinite(n)||n<-180||n>180){_(`Longitude must be between -180 and 180 decimal degrees.`);return}_(null),await c.mutateAsync({latitude:t,longitude:n}),await y()},x=async()=>{_(null),await c.mutateAsync(null),await y()},S=async()=>{_(null),await l.mutateAsync(),await y()},T=c.isPending||l.isPending||o.isLoading;return e(D,{className:`space-y-3`,children:[e(`div`,{className:`flex items-start justify-between gap-3`,children:[e(`div`,{className:`flex items-start gap-2`,children:[n(p,{className:`h-4 w-4 mt-0.5 text-muted-foreground shrink-0`}),n(`div`,{children:n(`h3`,{className:`text-sm font-medium`,children:t(`settings.siteLocationCard.siteLocation`,`Site location`)})})]}),v===null?n(w,{variant:`warning`,children:t(`settings.siteLocationCard.notConfigured`,`Not configured`)}):n(w,{variant:v.source===`operator-set`?`success`:`info`,children:v.source===`operator-set`?t(`settings.siteLocationCard.setByYou`,`Set by you`):t(`settings.siteLocationCard.derivedFromIp`,`Derived from IP`)})]}),v?.label!==void 0&&v.label!==``?n(`p`,{className:`text-xs text-muted-foreground`,children:t(`settings.siteLocationCard.detectedNear`,{place:v.label})}):null,v===null&&o.data?.derivationAttemptedAt!==null?e(`p`,{className:`text-xs text-warning`,children:[t(`settings.siteLocationCard.automaticDetectionFromThePublic`,`Automatic detection from the public IP did not succeed`),o.data?.derivationError!==null&&o.data?.derivationError!==void 0?`: ${o.data.derivationError}`:`.`,` `,t(`settings.siteLocationCard.itIsNotRetriedOn`,`It is not retried on its own — enter the coordinates, or press Detect.`)]}):null,e(`form`,{className:`flex flex-wrap items-end gap-3`,onSubmit:b,children:[e(`label`,{className:`flex flex-col gap-1 text-xs`,children:[n(`span`,{className:`text-muted-foreground`,children:t(`settings.siteLocationCard.latitude`,`Latitude`)}),n(M,{className:`w-40`,value:u,inputMode:`decimal`,placeholder:`40.851800`,onChange:e=>f(e.target.value),"aria-label":t(`settings.siteLocationCard.latitude`,`Latitude`)})]}),e(`label`,{className:`flex flex-col gap-1 text-xs`,children:[n(`span`,{className:`text-muted-foreground`,children:t(`settings.siteLocationCard.longitude`,`Longitude`)}),n(M,{className:`w-40`,value:m,inputMode:`decimal`,placeholder:`14.268100`,onChange:e=>h(e.target.value),"aria-label":t(`settings.siteLocationCard.longitude`,`Longitude`)})]}),n(I,{type:`submit`,disabled:T,children:t(`common.save`,`Save`)}),e(I,{type:`button`,variant:`ghost`,disabled:T,onClick:S,children:[n(d,{className:`h-3.5 w-3.5 mr-1`}),t(`settings.siteLocationCard.detectFromIp`,`Detect from IP`)]}),v===null?null:n(I,{type:`button`,variant:`ghost`,disabled:T,onClick:x,children:t(`settings.siteLocationCard.clear`,`Clear`)})]}),g===null?null:n(`p`,{className:`text-xs text-danger`,children:g}),n(`p`,{className:`text-xs text-muted-foreground`,children:t(`settings.siteLocationCard.wgs84DecimalDegreesDetectAsks`,`WGS84 decimal degrees. Detect asks a public geo-IP service once and will not overwrite a value you typed — clear it first.`)})]})}o();function ge(e){return y.some(t=>t===e)}function $(e){return ne.some(t=>t===e)}function _e(){let{t}=R(),r=te(),[a,o]=i(!1),[s,c]=i(null),l=e=>{o(!0),c(null),r.update(e).catch(e=>c(e instanceof Error?e.message:String(e))).finally(()=>o(!1))},u=r.status!==`ok`||!r.writable||a;return n(T,{headingId:`settings-units`,title:t(`systemPage.myAccess.units.title`,`Units`),icon:x,testId:`settings-units`,children:e(`div`,{className:`space-y-2 p-3`,children:[n(`p`,{className:`text-xs text-foreground-subtle`,children:t(`systemPage.myAccess.units.description`,`How readings are shown to you, on every device you sign in on. Stored values do not change.`)}),r.status===`error`&&n(O,{message:t(`systemPage.myAccess.units.loadError`,`Your unit preferences could not be read.`)}),r.status===`ok`&&!r.writable&&n(O,{message:t(`systemPage.myAccess.units.unreadable`,`The saved unit preferences are in a format this version cannot read, so they are left untouched.`)}),s!==null&&n(O,{message:s}),n(E,{label:t(`systemPage.myAccess.units.temperature`,`Temperature`),children:n(_,{"aria-label":t(`systemPage.myAccess.units.temperature`,`Temperature`),value:r.value.temperature,disabled:u,onChange:e=>{let t=e.target.value;$(t)&&l({temperature:t})},options:[{value:`celsius`,label:t(`systemPage.myAccess.units.celsius`,`Celsius (°C)`)},{value:`fahrenheit`,label:t(`systemPage.myAccess.units.fahrenheit`,`Fahrenheit (°F)`)}]})}),n(E,{label:t(`systemPage.myAccess.units.system`,`Other measurements`),children:n(_,{"aria-label":t(`systemPage.myAccess.units.system`,`Other measurements`),value:r.value.system,disabled:u,onChange:e=>{let t=e.target.value;ge(t)&&l({system:t})},options:[{value:`metric`,label:t(`systemPage.myAccess.units.metric`,`Metric (km/h, hPa, mm)`)},{value:`imperial`,label:t(`systemPage.myAccess.units.imperial`,`Imperial (mph, inHg, in)`)}]})})]})})}var ve=`system-config`;function ye(){let{t}=R(),{nodes:r,isLoading:i}=S(),a=r.find(e=>e.isHub&&e.isOnline),o=(a?.addons.map(e=>e.addonId)??[]).filter(e=>e!==ve);return e(W,{embedded:!0,children:[n(he,{}),i?n(`div`,{className:`text-foreground-subtle text-sm py-12 text-center`,children:t(`admin.system.settings.loadingHubTopology`,`Loading hub topology…`)}):a?e(l,{children:[n(K,{omitSectionIds:[J],emptyMessage:t(`admin.system.settings.bootstrapUnavailable`,`Not available — the addon that owns the server settings did not answer.`)}),o.length===0?n(`div`,{className:`text-foreground-subtle text-sm py-12 text-center`,children:t(`admin.system.settings.noAddonsInstalledOnThe`,`No addons installed on the hub yet.`)}):n(G,{nodeId:a.id,addonIds:o,level:`global`,omitSectionIds:[J,q]})]}):e(`div`,{className:`flex flex-col items-center justify-center text-foreground-subtle text-sm gap-2 py-12`,children:[n(v,{className:`h-8 w-8 opacity-30`}),n(`p`,{children:t(`admin.system.settings.noOnlineHubNodeFound`,`No online hub node found.`)}),n(`p`,{className:`text-xs`,children:t(`admin.system.settings.settingsWillAppearOnceThe`,`Settings will appear once the hub is reachable.`)})]}),e(`section`,{"aria-labelledby":`settings-per-user`,className:`mt-3 sm:mt-4 space-y-3 sm:space-y-4`,children:[n(`h2`,{id:`settings-per-user`,className:`text-xs font-semibold uppercase tracking-wide text-foreground-subtle`,children:t(`systemPage.settings.perUser`,`Your settings`)}),n(_e,{}),n(pe,{})]})]})}function be(){let{t:e}=R(),t=V(`/system/settings`,{t:e,isAdmin:!0})??{icon:v,title:e(`system.systemNav`,`System`)},{search:r,hash:i}=B();return new URLSearchParams(r).get(`tab`)===`secrets`?n(z,{replace:!0,to:`${H(r)}${i}`}):n(U,{icon:t.icon,title:t.title,defaultSection:`settings`,sectionsLabel:`${t.title} sections`,sections:[{id:`settings`,label:e(`system.system.settings`,`Settings`),content:n(ye,{})},{id:`capabilities`,label:e(`system.system.capabilities`,`Capabilities`),content:n(ue,{})}]})}export{be as SystemPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{C as e,K as t,S as n,V as r,Y as i,et as a,o}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Kt as s,Un as c,Yn as l,ct as u,di as d,ot as f}from"./player-overlays-CC-b3--a.js";import{Er as p}from"./client-kWeONSGL.js";import{d as m}from"./video-b4uGYAxS.js";import{Bn as h,Di as g,Ed as _,Nt as v,Qr as y,Td as b,Xr as x,Yr as S,wd as C,yi as w,zn as T}from"./src-74VUgk_H.js";import{t as E}from"./useTranslation-BJr-n0es.js";import{Br as D}from"./index-UQRaV7sW.js";import{t as O}from"./AdminPage-D54ZN64f.js";import{i as k,r as A,t as j}from"./useTemplateSave-BSq-JUcx.js";a();var M=`edit`,N=p[0];function P(){let{t:a}=E(),p=o(),P=_({}),F=C(),I=j(),L=b(),R=u(),z=f(),[B,V]=i(null),[H,U]=D(),W=H.get(M);r(()=>{if(W===null||P.data===void 0)return;let e=P.data.find(e=>e.id===W);e!==void 0&&V({id:e.id,kind:e.kind,name:e.name,payload:e.payload}),U(e=>{let t=new URLSearchParams(e);return t.delete(M),t},{replace:!0})},[W,P.data,U]);let G=()=>void p.invalidateQueries({queryKey:[[`template`]]}),K=async e=>{await I.save(e)&&V(null)},q=async e=>{try{await F.mutateAsync({kind:e.kind,name:a(`remote.templates.copyName`,{name:e.name}),payload:e.payload}),G()}catch(e){await z({title:a(`remote.templates.duplicateFailed`),message:e instanceof Error?e.message:String(e),variant:`danger`})}},J=async e=>{if(await R({title:a(`remote.templates.deleteTitle`,{name:e.name}),message:a(`remote.templates.deleteMessage`),confirmLabel:a(`common.delete`),variant:`danger`}))try{let t=await L.mutateAsync({id:e.id});if(t.status===`in-use`){await z({title:a(`remote.templates.inUseTitle`,{name:e.name}),message:a(`remote.templates.inUseMessage`,{devices:t.devices.map(e=>e.name).join(`, `)}),variant:`warning`});return}G()}catch(e){await z({title:a(`remote.templates.deleteFailed`),message:e instanceof Error?e.message:String(e),variant:`danger`})}},Y=t(()=>[{key:`name`,header:a(`remote.templates.name`),sortValue:e=>e.name.toLowerCase(),render:e=>n(`span`,{className:`font-medium text-foreground`,children:e.name})},{key:`kind`,header:a(`remote.templates.kind.label`),sortValue:e=>e.kind,render:e=>n(g,{variant:`neutral`,children:k(e.kind).label(a)})},{key:`summary`,header:a(`remote.templates.summary`),notSortableReason:`A sentence built from the payload.`,render:e=>n(`span`,{className:`text-foreground-muted`,children:k(e.kind).summary(e.payload,a)})},{key:`updated`,header:a(`remote.templates.updated`),sortValue:e=>e.updatedAt,render:e=>n(`span`,{className:`text-foreground-muted`,children:new Date(e.updatedAt).toLocaleDateString()})},{key:`actions`,align:`right`,notSortableReason:`Row actions.`,render:e=>n(v,{title:a(`remote.templates.actionsFor`,{name:e.name}),items:[{id:`edit`,label:a(`common.edit`),icon:l,onClick:()=>{I.clearError(),V({id:e.id,kind:e.kind,name:e.name,payload:e.payload})}},{id:`duplicate`,label:a(`remote.templates.duplicate`),icon:d,onClick:()=>void q(e)},{id:`delete`,label:a(`common.delete`),icon:s,danger:!0,onClick:()=>void J(e)}]})}],[a]),X=P.data??[],Z=()=>{I.clearError(),V({id:null,kind:N,name:``,payload:k(N).emptyPayload()})};return e(O,{icon:m,title:a(`remote.templates.title`),subtitle:a(`remote.templates.subtitle`),actions:e(w,{size:`sm`,onClick:Z,"data-testid":`template-new`,children:[n(c,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),a(`remote.templates.new`)]}),children:[P.status===`error`?n(S,{title:a(`remote.templates.loadFailed`),message:P.error.message,onRetry:()=>void P.refetch()}):P.data===void 0?n(y,{className:`h-32 w-full`}):X.length===0?n(x,{icon:m,title:a(`remote.templates.emptyTitle`),description:a(`remote.templates.emptyDescription`),action:n(w,{size:`sm`,onClick:Z,children:a(`remote.templates.new`)})}):n(T,{columns:Y,rows:X,rowKey:e=>e.id,maxBodyHeight:h,defaultSort:{columnKey:`name`,dir:`asc`},onRowClick:e=>{I.clearError(),V({id:e.id,kind:e.kind,name:e.name,payload:e.payload})}}),n(A,{draft:B,saving:I.saving,error:I.error,onSave:e=>void K(e),onClose:()=>V(null)})]})}export{P as TemplatesPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./rolldown-runtime-Cyuzqnbw.js";import{C as t,J as n,K as r,S as i,V as a,Y as o,et 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{Fi as c,Hi as l,Ni as u,Sn as d,br as f,bt as p,ht as m,un as h,ut as g}from"./player-overlays-
|
|
1
|
+
import{t as e}from"./rolldown-runtime-Cyuzqnbw.js";import{C as t,J as n,K as r,S as i,V as a,Y as o,et 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{Fi as c,Hi as l,Ni as u,Sn as d,br as f,bt as p,ht as m,un as h,ut as g}from"./player-overlays-CC-b3--a.js";import{n as _}from"./video-b4uGYAxS.js";import{Ad as v,Af as y,Di as b,Dr as x,Er as S,Fd as C,Ff as w,Go as T,Id as E,Js as D,Ln as O,Md as k,Nd as A,Od as j,Pd as M,Qr as N,Yr as P,jd as F,kd as I,ki as L,yi as R}from"./src-74VUgk_H.js";import{t as z}from"./useTranslation-BJr-n0es.js";import{Fr as ee}from"./index-UQRaV7sW.js";import{t as te}from"./AdminPage-D54ZN64f.js";import{t as B}from"./InstancesTable-C5ocf6KU.js";import{t as V}from"./useInvalidateAddonSettings-CyofQfBo.js";s();var H=`terminal`,U=`terminal-session`;function ne({nodeId:e}){let t=m(),n=V();return i(S,{trpc:t.trpcClient,addonId:H,cap:U,scope:`node`,nodeId:e,onAfterChange:n})}var W=e(((e,t)=>{(function(n,r){if(typeof e==`object`&&typeof t==`object`)t.exports=r();else if(typeof define==`function`&&define.amd)define([],r);else{var i=r();for(var a in i)(typeof e==`object`?e:n)[a]=i[a]}})(globalThis,(()=>(()=>{var e={4567:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;let a=n(9042),o=n(9924),s=n(844),c=n(4725),l=n(2585),u=n(3656),d=t.AccessibilityManager=class extends s.Disposable{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``,this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=this._coreBrowserService.mainDocument.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new o.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this.register(this._terminal.onResize((e=>this._handleResize(e.rows)))),this.register(this._terminal.onRender((e=>this._refreshRows(e.start,e.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((e=>this._handleChar(e)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
2
2
|
`)))),this.register(this._terminal.onA11yTab((e=>this._handleTab(e)))),this.register(this._terminal.onKey((e=>this._handleKey(e.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,u.addDisposableDomListener)(document,`selectionchange`,(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,s.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
3
3
|
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=a.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.innerText=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=document.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error(`anchorNode and/or focusNode are null`);let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(a&&o){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}};t.AccessibilityManager=d=r([i(1,l.IInstantiationService),i(2,c.ICoreBrowserService),i(3,c.IRenderService)],d)},3614:(e,t)=>{function n(e){return e.replace(/\r?\n/g,`\r`)}function r(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function i(e,t,i,a){e=r(e=n(e),i.decPrivateModes.bracketedPasteMode&&!0!==a.rawOptions.ignoreBracketedPasteMode),i.triggerDataEvent(e,!0),t.value=``}function a(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=n,t.bracketTextForPaste=r,t.copyHandler=function(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()},t.handlePasteEvent=function(e,t,n,r){e.stopPropagation(),e.clipboardData&&i(e.clipboardData.getData(`text/plain`),t,n,r)},t.paste=i,t.moveTextAreaUnderMouseCursor=a,t.rightClickHandler=function(e,t,n,r,i){a(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}},7239:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;let r=n(1505);t.ColorContrastCache=class{constructor(){this._color=new r.TwoKeyMap,this._css=new r.TwoKeyMap}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}}},3656:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,n,r){e.addEventListener(t,n,r);let i=!1;return{dispose:()=>{i||(i=!0,e.removeEventListener(t,n,r))}}}},3551:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;let a=n(3656),o=n(8460),s=n(844),c=n(2585),l=n(4725),u=t.Linkifier=class extends s.Disposable{get currentLink(){return this._currentLink}constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new o.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new o.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,s.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,s.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,a.addDisposableDomListener)(this._element,`mouseleave`,(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,a.addDisposableDomListener)(this._element,`mousemove`,this._handleMouseMove.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,`mousedown`,this._handleMouseDown.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,`mouseup`,this._handleMouseUp.bind(this)))}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.classList.contains(`xterm-hover`))return}this._lastBufferCell&&t.x===this._lastBufferCell.x&&t.y===this._lastBufferCell.y||(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(e,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){this._activeProviderReplies&&t||(this._activeProviderReplies?.forEach((e=>{e?.forEach((e=>{e.link.dispose&&e.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,(t=>{if(this._isMouseOut)return;let i=t?.map((e=>({link:e})));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)}))}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)this._activeProviderReplies.has(t)&&!this._activeProviderReplies.get(t)||(i=!0);if(!i&&r){let e=r.find((e=>this._linkAtPosition(e.link,t)));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find((e=>this._linkAtPosition(e.link,t)));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){this._currentLink&&this._lastMouseEvent&&(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,s.disposeArray)(this._linkCacheDisposables))}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}}))))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};t.Linkifier=u=r([i(1,l.IMouseService),i(2,l.IRenderService),i(3,c.IBufferService),i(4,l.ILinkProviderService)],u)},9042:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel=`Terminal input`,t.tooMuchOutput=`Too much output to announce, navigate to rows manually to read`},3730:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;let a=n(511),o=n(2585),s=t.OscLinkProvider=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n)return void t(void 0);let r=[],i=this._optionsService.rawOptions.linkHandler,o=new a.CellData,s=n.getTrimmedLength(),l=-1,u=-1,d=!1;for(let t=0;t<s;t++)if(u!==-1||n.hasContent(t)){if(n.loadCell(t,o),o.hasExtendedAttrs()&&o.extended.urlId){if(u===-1){u=t,l=o.extended.urlId;continue}d=o.extended.urlId!==l}else u!==-1&&(d=!0);if(d||u!==-1&&t===s-1){let n=this._oscLinkService.getLinkData(l)?.uri;if(n){let a={start:{x:u+1,y:e},end:{x:t+(d||t!==s-1?0:1),y:e}},o=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(o=!0)}catch{o=!0}o||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):c(0,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}d=!1,o.hasExtendedAttrs()&&o.extended.urlId?(u=t,l=o.extended.urlId):(u=-1,l=-1)}}t(r)}};function c(e,t){if(confirm(`Do you want to navigate to ${t}?\n\nWARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}t.OscLinkProvider=s=r([i(0,o.IBufferService),i(1,o.IOptionsService),i(2,o.IOscLinkService)],s)},6193:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}}},3236:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;let r=n(3614),i=n(3656),a=n(3551),o=n(9042),s=n(3730),c=n(1680),l=n(3107),u=n(5744),d=n(2950),f=n(1296),p=n(428),m=n(4269),h=n(5114),g=n(8934),_=n(3230),v=n(9312),y=n(4725),b=n(6731),x=n(8055),S=n(8969),C=n(8460),w=n(844),T=n(6114),E=n(8437),D=n(2584),O=n(7399),k=n(5941),A=n(9074),j=n(2585),M=n(5435),N=n(4567),P=n(779);class F extends S.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(e={}){super(e),this.browser=T,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new w.MutableDisposable),this._onCursorMove=this.register(new C.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new C.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new C.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new C.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new C.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new C.EventEmitter),this._onBlur=this.register(new C.EventEmitter),this._onA11yCharEmitter=this.register(new C.EventEmitter),this._onA11yTabEmitter=this.register(new C.EventEmitter),this._onWillOpen=this.register(new C.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(A.DecorationService),this._instantiationService.setService(j.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(P.LinkProviderService),this._instantiationService.setService(y.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(s.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((e,t)=>this.refresh(e,t)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((e=>this._reportWindowsOptions(e)))),this.register(this._inputHandler.onColor((e=>this._handleColorEvent(e)))),this.register((0,C.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,C.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((e=>this._afterResize(e.cols,e.rows)))),this.register((0,w.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=x.color.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${D.C0.ESC}]${n};${(0,k.toRgbString)(r)}${D.C1_ESCAPED.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors((e=>e.ansi[t.index]=x.channels.toColor(...t.color)));else{let n=e;this._themeService.modifyColors((e=>e[n]=x.channels.toColor(...t.color)))}break;case 2:this._themeService.restoreColor(t.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(D.C0.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(D.C0.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this.register((0,i.addDisposableDomListener)(this.element,`copy`,(e=>{this.hasSelection()&&(0,r.copyHandler)(e,this._selectionService)})));let e=e=>(0,r.handlePasteEvent)(e,this.textarea,this.coreService,this.optionsService);this.register((0,i.addDisposableDomListener)(this.textarea,`paste`,e)),this.register((0,i.addDisposableDomListener)(this.element,`paste`,e)),T.isFirefox?this.register((0,i.addDisposableDomListener)(this.element,`mousedown`,(e=>{e.button===2&&(0,r.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,i.addDisposableDomListener)(this.element,`contextmenu`,(e=>{(0,r.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),T.isLinux&&this.register((0,i.addDisposableDomListener)(this.element,`auxclick`,(e=>{e.button===1&&(0,r.moveTextAreaUnderMouseCursor)(e,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,i.addDisposableDomListener)(this.textarea,`keyup`,(e=>this._keyUp(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`keydown`,(e=>this._keyDown(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`keypress`,(e=>this._keyPress(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionstart`,(()=>this._compositionHelper.compositionstart()))),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionupdate`,(e=>this._compositionHelper.compositionupdate(e)))),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionend`,(()=>this._compositionHelper.compositionend()))),this.register((0,i.addDisposableDomListener)(this.textarea,`input`,(e=>this._inputEvent(e)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement(`div`),this._viewportScrollArea.classList.add(`xterm-scroll-area`),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this.register((0,i.addDisposableDomListener)(this.screenElement,`mousemove`,(e=>this.updateCursorStyle(e)))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement),this.textarea=this._document.createElement(`textarea`),this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,o.promptLabel),T.isChromeOS||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(h.CoreBrowserService,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(y.ICoreBrowserService,this._coreBrowserService),this.register((0,i.addDisposableDomListener)(this.textarea,`focus`,(e=>this._handleTextAreaFocus(e)))),this.register((0,i.addDisposableDomListener)(this.textarea,`blur`,(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(p.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(y.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(b.ThemeService),this._instantiationService.setService(y.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(m.CharacterJoinerService),this._instantiationService.setService(y.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(_.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(y.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((e=>this._onRender.fire(e)))),this.onResize((e=>this._renderService.resize(e.cols,e.rows))),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(d.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(g.MouseService),this._instantiationService.setService(y.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(a.Linkifier,this.screenElement)),this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(c.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((e=>this.scrollLines(e.amount,e.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(v.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(y.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((e=>this.scrollLines(e.amount,e.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((e=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,i.addDisposableDomListener)(this._viewportElement,`scroll`,(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(l.BufferDecorationRenderer,this.screenElement)),this.register((0,i.addDisposableDomListener)(this.element,`mousedown`,(e=>this._selectionService.handleMouseDown(e)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add(`enable-mouse-events`)):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,(e=>this._handleScreenReaderModeOptionChange(e)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRulerWidth`,(e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(f.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=1&t.buttons?0:4&t.buttons?1:2&t.buttons?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&!1===e._customWheelEventHandler(t)||e.viewport.getLinesScrolled(t)===0)return!1;i=t.deltaY<0?0:1,r=4;break;default:return!1}return!(i===void 0||r===void 0||r>4)&&e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},a={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this.register(this.coreMouseService.onProtocolChange((e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),this.element.classList.add(`enable-mouse-events`),this._selectionService.disable()):(this._logService.debug(`Unbinding from mouse events.`),this.element.classList.remove(`enable-mouse-events`),this._selectionService.enable()),8&e?r.mousemove||=(t.addEventListener(`mousemove`,a.mousemove),a.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),16&e?r.wheel||=(t.addEventListener(`wheel`,a.wheel,{passive:!1}),a.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),2&e?r.mouseup||=a.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),4&e?r.mousedrag||=a.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,i.addDisposableDomListener)(t,`mousedown`,(e=>{if(e.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(e))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)}))),this.register((0,i.addDisposableDomListener)(t,`wheel`,(e=>{if(!r.wheel){if(this._customWheelEventHandler&&!1===this._customWheelEventHandler(e))return!1;if(!this.buffer.hasScrollback){let t=this.viewport.getLinesScrolled(e);if(t===0)return;let n=D.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(e.deltaY<0?`A`:`B`),r=``;for(let e=0;e<Math.abs(t);e++)r+=n;return this.coreService.triggerDataEvent(r,!0),this.cancel(e,!0)}return this.viewport.handleWheel(e)?this.cancel(e):void 0}}),{passive:!1})),this.register((0,i.addDisposableDomListener)(t,`touchstart`,(e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(e),this.cancel(e)}),{passive:!0})),this.register((0,i.addDisposableDomListener)(t,`touchmove`,(e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(e)?void 0:this.cancel(e)}),{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t,n=0){n===1?(super.scrollLines(e,t,n),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(e)}paste(e){(0,r.paste)(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;t||e.key!==`Dead`&&e.key!==`AltGraph`||(this._unprocessedDeadKey=!0);let n=(0,O.evaluateKeyboardEvent)(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}return n.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key||!!(e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(n.key!==D.C0.ETX&&n.key!==D.C0.CR||(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey?this.cancel(e,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(function(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else{if(e.which===0||e.charCode===0)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)||(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){e!==this.cols||t!==this.rows?super.resize(e,t):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(e,t){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(E.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent(D.C0.ESC+`[I`):this.coreService.triggerDataEvent(D.C0.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case M.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${D.C0.ESC}[4;${t};${e}t`);break;case M.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${D.C0.ESC}[6;${r};${n}t`)}}cancel(e,t){if(this.options.cancelEvents||t)return e.preventDefault(),e.stopPropagation(),!1}}t.Terminal=F},9924:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(e,t=1e3){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=Date.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}}},1680:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;let a=n(3656),o=n(4725),s=n(8460),c=n(844),l=n(2585),u=t.Viewport=class extends c.Disposable{constructor(e,t,n,r,i,o,c,l){super(),this._viewportElement=e,this._scrollArea=t,this._bufferService=n,this._optionsService=r,this._charSizeService=i,this._renderService=o,this._coreBrowserService=c,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new s.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,a.addDisposableDomListener)(this._viewportElement,`scroll`,this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((e=>this._activeBuffer=e.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((e=>this._renderDimensions=e))),this._handleThemeChange(l.colors),this.register(l.onChangeColors((e=>this._handleThemeChange(e)))),this.register(this._optionsService.onSpecificOptionChange(`scrollback`,(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(e){this._viewportElement.style.backgroundColor=e.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(e){if(e)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;let e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+`px`)}let e=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==e&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=e),this._refreshAnimationFrame=null}syncScrollArea(e=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(e);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(e)}_handleScroll(e){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});let t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:t,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let e=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(e*(this._smoothScrollState.target-this._smoothScrollState.origin)),e<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(e,t){let n=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&this._viewportElement.scrollTop!==0||t>0&&n<this._lastRecordedBufferHeight)||(e.cancelable&&e.preventDefault(),!1)}handleWheel(e){let t=this._getPixelsScrolled(e);return t!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+t:this._smoothScrollState.target+=t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}scrollLines(e){if(e!==0)if(this._optionsService.rawOptions.smoothScrollDuration){let t=e*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:e,suppressScrollEvent:!1})}_getPixelsScrolled(e){if(e.deltaY===0||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_LINE?t*=this._currentRowHeight:e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._currentRowHeight*this._bufferService.rows),t}getBufferElements(e,t){let n,r=``,i=[],a=t??this._bufferService.buffer.lines.length,o=this._bufferService.buffer.lines;for(let t=e;t<a;t++){let e=o.get(t);if(!e)continue;let a=o.get(t+1)?.isWrapped;if(r+=e.translateToString(!a),!a||t===o.length-1){let e=document.createElement(`div`);e.textContent=r,i.push(e),r.length>0&&(n=e),r=``}}return{bufferElements:i,cursorElement:n}}getLinesScrolled(e){if(e.deltaY===0||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(t/=this._currentRowHeight+0,this._wheelPartialScroll+=t,t=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t}_applyScrollModifier(e,t){let n=this._optionsService.rawOptions.fastScrollModifier;return n===`alt`&&t.altKey||n===`ctrl`&&t.ctrlKey||n===`shift`&&t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(e){this._lastTouchY=e.touches[0].pageY}handleTouchMove(e){let t=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,t!==0&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}};t.Viewport=u=r([i(2,l.IBufferService),i(3,l.IOptionsService),i(4,o.ICharSizeService),i(5,o.IRenderService),i(6,o.ICoreBrowserService),i(7,o.IThemeService)],u)},3107:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;let a=n(4725),o=n(844),s=n(2585),c=t.BufferDecorationRenderer=class extends o.Disposable{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((e=>this._removeDecoration(e)))),this.register((0,o.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+`px`,t.style.top=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+`px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose((()=>{this._decorationElements.delete(e),n.remove()}))),n.style.top=t*this._renderService.dimensions.css.cell.height+`px`,n.style.display=this._altBufferIsActive?`none`:`block`,e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?n*this._renderService.dimensions.css.cell.width+`px`:``:t.style.left=n?n*this._renderService.dimensions.css.cell.width+`px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};t.BufferDecorationRenderer=c=r([i(1,s.IBufferService),i(2,a.ICoreBrowserService),i(3,s.IDecorationService),i(4,a.IRenderService)],c)},5871:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorZoneStore=void 0,t.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position))return void this._addLineToZone(t,e.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}}},5744:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;let a=n(5871),o=n(4725),s=n(844),c=n(2585),l={full:0,left:0,center:0,right:0},u={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},f=t.OverviewRulerRenderer=class extends s.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(e,t,n,r,i,o,c){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=o,this._coreBrowserService=c,this._colorZoneStore=new a.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-decoration-overview-ruler`),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);let l=this._canvas.getContext(`2d`);if(!l)throw Error(`Ctx cannot be null`);this._ctx=l,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,s.toDisposable)((()=>{this._canvas?.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?`none`:`block`}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange(`overviewRulerWidth`,(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){let e=Math.floor(this._canvas.width/3),t=Math.ceil(this._canvas.width/3);u.full=this._canvas.width,u.left=e,u.center=t,u.right=e,this._refreshDrawHeightConstants(),d.full=0,d.left=0,d.center=u.left,d.right=u.left+u.center}_refreshDrawHeightConstants(){l.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);l.left=t,l.center=t,l.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1;let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(d[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-l[e.position||`full`]/2),u[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+l[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};t.OverviewRulerRenderer=f=r([i(2,c.IBufferService),i(3,c.IDecorationService),i(4,o.IRenderService),i(5,c.IOptionsService),i(6,o.ICoreBrowserService)],f)},2950:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;let a=n(4725),o=n(2585),s=n(2584),c=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let t;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}}),0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${s.C0.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}}),0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};t.CompositionHelper=c=r([i(2,o.IBufferService),i(3,o.IOptionsService),i(4,o.ICoreService),i(5,a.IRenderService)],c)},9806:(e,t)=>{function n(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=n,t.getCoords=function(e,t,r,i,a,o,s,c,l){if(!o)return;let u=n(e,t,r);return u?(u[0]=Math.ceil((u[0]+(l?s/2:0))/s),u[1]=Math.ceil(u[1]/c),u[0]=Math.min(Math.max(u[0],1),i+ +!!l),u[1]=Math.min(Math.max(u[1],1),a),u):void 0}},9504:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;let r=n(2584);function i(e,t,n,r){let i=e-a(e,n),s=t-a(t,n);return l(Math.abs(i-s)-function(e,t,n){let r=0,i=e-a(e,n),s=t-a(t,n);for(let a=0;a<Math.abs(i-s);a++){let s=o(e,t)===`A`?-1:1;n.buffer.lines.get(i+s*a)?.isWrapped&&r++}return r}(e,t,n),c(o(e,t),r))}function a(e,t){let n=0,r=t.buffer.lines.get(e),i=r?.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r?.isWrapped;return n}function o(e,t){return e>t?`A`:`B`}function s(e,t,n,r,i,a){let o=e,s=t,c=``;for(;o!==n||s!==r;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function c(e,t){let n=t?`O`:`[`;return r.C0.ESC+n+e}function l(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}t.moveToCellSequence=function(e,t,n,r){let o=n.buffer.x,u=n.buffer.y;if(!n.buffer.hasScrollback)return function(e,t,n,r,o,u){return i(t,r,o,u).length===0?``:l(s(e,t,e,t-a(t,o),!1,o).length,c(`D`,u))}(o,u,0,t,n,r)+i(u,t,n,r)+function(e,t,n,r,o,u){let d;d=i(t,r,o,u).length>0?r-a(r,o):t;let f=r,p=function(e,t,n,r,o,s){let c;return c=i(n,r,o,s).length>0?r-a(r,o):t,e<n&&c<=r||e>=n&&c<r?`C`:`D`}(e,t,n,r,o,u);return l(s(e,d,n,f,p===`C`,o).length,c(p,u))}(o,u,e,t,n,r);let d;if(u===t)return d=o>e?`D`:`C`,l(Math.abs(o-e),c(d,r));d=u>t?`D`:`C`;let f=Math.abs(u-t);return l(function(e,t){return t.cols-e}(u>t?e:o,n)+(f-1)*n.cols+1+((u>t?o:e)-1),c(d,r))}},1296:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;let a=n(3787),o=n(2550),s=n(2223),c=n(6171),l=n(6052),u=n(4725),d=n(8055),f=n(8460),p=n(844),m=n(2585),h=`xterm-dom-renderer-owner-`,g=`xterm-rows`,_=`xterm-fg-`,v=`xterm-bg-`,y=`xterm-focus`,b=`xterm-selection`,x=1,S=t.DomRenderer=class extends p.Disposable{constructor(e,t,n,r,i,s,u,d,m,_,v,y,S){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=s,this._linkifier2=u,this._charSizeService=m,this._optionsService=_,this._bufferService=v,this._coreBrowserService=y,this._themeService=S,this._terminalClass=x++,this._rowElements=[],this._selectionRenderModel=(0,l.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new f.EventEmitter).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(g),this._rowContainer.style.lineHeight=`normal`,this._rowContainer.setAttribute(`aria-hidden`,`true`),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement(`div`),this._selectionContainer.classList.add(b),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=(0,c.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((e=>this._injectCss(e)))),this._injectCss(this._themeService.colors),this._rowFactory=d.createInstance(a.DomRendererRowFactory,document),this._element.classList.add(h+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((e=>this._handleLinkHover(e)))),this.register(this._linkifier2.onHideLinkUnderline((e=>this._handleLinkLeave(e)))),this.register((0,p.toDisposable)((()=>{this._element.classList.remove(h+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new o.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${g} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${g} { color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${g} .xterm-dim { color: ${d.color.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${b} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${b} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${b} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${_}${n} { color: ${r.css}; }${this._terminalSelector} .${_}${n}.xterm-dim { color: ${d.color.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${v}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${_}${s.INVERTED_DEFAULT_COLOR} { color: ${d.color.opaque(e.background).css}; }${this._terminalSelector} .${_}${s.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${d.color.multiplyOpacity(d.color.opaque(e.background),.5).css}; }${this._terminalSelector} .${v}${s.INVERTED_DEFAULT_COLOR} { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(y),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(y),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t)return;this._selectionRenderModel.update(this._terminal,e,t,n);let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow;if(a>=this._bufferService.rows||o<0)return;let s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=r*this.dimensions.css.cell.height+`px`,i.style.top=e*this.dimensions.css.cell.height+`px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._optionsService.rawOptions.cursorBlink,o=this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${h}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};t.DomRenderer=S=r([i(7,m.IInstantiationService),i(8,u.ICharSizeService),i(9,m.IOptionsService),i(10,m.IBufferService),i(11,u.ICoreBrowserService),i(12,u.IThemeService)],S)},3787:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;let a=n(2223),o=n(643),s=n(511),c=n(2585),l=n(8055),u=n(4725),d=n(4269),f=n(6171),p=n(3734),m=t.DomRendererRowFactory=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new s.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,s,c,u,f,m,g){let _=[],v=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors,b,x=e.getNoBgTrimmedLength();n&&x<s+1&&(x=s+1);let S=0,C=``,w=0,T=0,E=0,D=!1,O=0,k=!1,A=0,j=[],M=m!==-1&&g!==-1;for(let N=0;N<x;N++){e.loadCell(N,this._workCell);let x=this._workCell.getWidth();if(x===0)continue;let P=!1,F=N,I=this._workCell;if(v.length>0&&N===v[0][0]){P=!0;let t=v.shift();I=new d.JoinedCellData(this._workCell,e.translateToString(!0,t[0],t[1]),t[1]-t[0]),F=t[1]-1,x=I.getWidth()}let L=this._isCellInSelection(N,t),R=n&&N===s,z=M&&N>=m&&N<=g,ee=!1;this._decorationService.forEachDecorationAtCell(N,t,void 0,(e=>{ee=!0}));let te=I.getChars()||o.WHITESPACE_CELL_CHAR;if(te===` `&&(I.isUnderline()||I.isOverline())&&(te=`\xA0`),A=x*u-f.get(te,I.isBold(),I.isItalic()),b){if(S&&(L&&k||!L&&!k&&I.bg===w)&&(L&&k&&y.selectionForeground||I.fg===T)&&I.extended.ext===E&&z===D&&A===O&&!R&&!P&&!ee){I.isInvisible()?C+=o.WHITESPACE_CELL_CHAR:C+=te,S++;continue}S&&(b.textContent=C),b=this._document.createElement(`span`),S=0,C=``}else b=this._document.createElement(`span`);if(w=I.bg,T=I.fg,E=I.extended.ext,D=z,O=A,k=L,P&&s>=N&&s<=F&&(s=N),!this._coreService.isCursorHidden&&R&&this._coreService.isCursorInitialized){if(j.push(`xterm-cursor`),this._coreBrowserService.isFocused)c&&j.push(`xterm-cursor-blink`),j.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:j.push(`xterm-cursor-outline`);break;case`block`:j.push(`xterm-cursor-block`);break;case`bar`:j.push(`xterm-cursor-bar`);break;case`underline`:j.push(`xterm-cursor-underline`)}}if(I.isBold()&&j.push(`xterm-bold`),I.isItalic()&&j.push(`xterm-italic`),I.isDim()&&j.push(`xterm-dim`),C=I.isInvisible()?o.WHITESPACE_CELL_CHAR:I.getChars()||o.WHITESPACE_CELL_CHAR,I.isUnderline()&&(j.push(`xterm-underline-${I.extended.underlineStyle}`),C===` `&&(C=`\xA0`),!I.isUnderlineColorDefault()))if(I.isUnderlineColorRGB())b.style.textDecorationColor=`rgb(${p.AttributeData.toColorRGB(I.getUnderlineColor()).join(`,`)})`;else{let e=I.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&I.isBold()&&e<8&&(e+=8),b.style.textDecorationColor=y.ansi[e].css}I.isOverline()&&(j.push(`xterm-overline`),C===` `&&(C=`\xA0`)),I.isStrikethrough()&&j.push(`xterm-strikethrough`),z&&(b.style.textDecoration=`underline`);let B=I.getFgColor(),V=I.getFgColorMode(),H=I.getBgColor(),U=I.getBgColorMode(),ne=!!I.isInverse();if(ne){let e=B;B=H,H=e;let t=V;V=U,U=t}let W,G,K,q=!1;switch(this._decorationService.forEachDecorationAtCell(N,t,void 0,(e=>{e.options.layer!==`top`&&q||(e.backgroundColorRGB&&(U=50331648,H=e.backgroundColorRGB.rgba>>8&16777215,W=e.backgroundColorRGB),e.foregroundColorRGB&&(V=50331648,B=e.foregroundColorRGB.rgba>>8&16777215,G=e.foregroundColorRGB),q=e.options.layer===`top`)})),!q&&L&&(W=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,H=W.rgba>>8&16777215,U=50331648,q=!0,y.selectionForeground&&(V=50331648,B=y.selectionForeground.rgba>>8&16777215,G=y.selectionForeground)),q&&j.push(`xterm-decoration-top`),U){case 16777216:case 33554432:K=y.ansi[H],j.push(`xterm-bg-${H}`);break;case 50331648:K=l.channels.toColor(H>>16,H>>8&255,255&H),this._addStyle(b,`background-color:#${h((H>>>0).toString(16),`0`,6)}`);break;default:ne?(K=y.foreground,j.push(`xterm-bg-${a.INVERTED_DEFAULT_COLOR}`)):K=y.background}switch(W||I.isDim()&&(W=l.color.multiplyOpacity(K,.5)),V){case 16777216:case 33554432:I.isBold()&&B<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(B+=8),this._applyMinimumContrast(b,K,y.ansi[B],I,W,void 0)||j.push(`xterm-fg-${B}`);break;case 50331648:let e=l.channels.toColor(B>>16&255,B>>8&255,255&B);this._applyMinimumContrast(b,K,e,I,W,G)||this._addStyle(b,`color:#${h(B.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(b,K,y.foreground,I,W,G)||ne&&j.push(`xterm-fg-${a.INVERTED_DEFAULT_COLOR}`)}j.length&&=(b.className=j.join(` `),0),R||P||ee?b.textContent=C:S++,A!==this.defaultSpacing&&(b.style.letterSpacing=`${A}px`),_.push(b),N=F}return b&&S&&(b.textContent=C),_}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,f.treatGlyphAsBackgroundColor)(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(i||a||(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=l.color.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return!!s&&(this._addStyle(e,`color:${s.css}`),!0)}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!(!n||!r)&&(this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0])}};function h(e,t,n){for(;e.length<n;)e=t+e;return e}t.DomRendererRowFactory=m=r([i(1,u.ICharacterJoinerService),i(2,c.IOptionsService),i(3,u.ICoreBrowserService),i(4,c.ICoreService),i(5,c.IDecorationService),i(6,u.IThemeService)],m)},2550:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(e,t){this._flat=new Float32Array(256),this._font=``,this._fontSize=0,this._weight=`normal`,this._weightBold=`bold`,this._measureElements=[],this._container=e.createElement(`div`),this._container.classList.add(`xterm-width-cache-measure-container`),this._container.setAttribute(`aria-hidden`,`true`),this._container.style.whiteSpace=`pre`,this._container.style.fontKerning=`none`;let n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}}},2223:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;let r=n(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=r.isFirefox||r.isLegacyEdge?`bottom`:`ideographic`},6171:(e,t)=>{function n(e){return 57508<=e&&e<=57558}function r(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw Error(`value must not be falsy`);return e},t.isPowerlineGlyph=n,t.isRestrictedPowerlineGlyph=function(e){return 57520<=e&&e<=57527},t.isEmoji=r,t.allowRescaling=function(e,t,i,a){return t===1&&i>Math.ceil(1.5*a)&&e!==void 0&&e>255&&!r(e)&&!n(e)&&!function(e){return 57344<=e&&e<=63743}(e)},t.treatGlyphAsBackgroundColor=function(e){return n(e)||function(e){return 9472<=e&&e<=9631}(e)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(e,t,n=0){return(e-(2*Math.round(t)-n))%(2*Math.round(t))}},6052:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class n{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1])return void this.clear();let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);s>=e.rows||c<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0])}isCellSelected(e,t,n){return!!this.hasSelection&&(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol)}}t.createSelectionRenderModel=function(){return new n}},456:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0,t.SelectionModel=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!(!e||!t)&&(e[1]>t[1]||e[1]===t[1]&&e[0]>t[0])}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;let a=n(2585),o=n(8460),s=n(844),c=t.CharSizeService=class extends s.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this.register(new o.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new d(this._optionsService))}catch{this._measureStrategy=this.register(new u(e,t,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],(()=>this.measure())))}measure(){let e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};t.CharSizeService=c=r([i(2,a.IOptionsService)],c);class l extends s.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}}class u extends l{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class d extends l{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}}},4269:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;let a=n(3734),o=n(643),s=n(511),c=n(2585);class l extends a.AttributeData{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.JoinedCellData=l;let u=t.CharacterJoinerService=class e{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new s.CellData}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,a=0,s=0,c=t.getFg(0),l=t.getBg(0);for(let e=0;e<t.getTrimmedLength();e++)if(t.loadCell(e,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==c||this._workCell.bg!==l){if(e-i>1){let e=this._getJoinedRanges(r,s,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,s=a,c=this._workCell.fg,l=this._workCell.bg}a+=this._workCell.getChars().length||o.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,s,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(t,n,r,i,a){let o=t.substring(n,r),s=[];try{s=this._characterJoiners[0].handler(o)}catch(e){console.error(e)}for(let t=1;t<this._characterJoiners.length;t++)try{let n=this._characterJoiners[t].handler(o);for(let t=0;t<n.length;t++)e._mergeRanges(s,n[t])}catch(e){console.error(e)}return this._stringRangesToCellRanges(s,i,a),s}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,s=e[r];if(s){for(let c=n;c<this._bufferService.cols;c++){let n=t.getWidth(c),l=t.getString(c).length||o.WHITESPACE_CELL_CHAR.length;if(n!==0){if(!i&&s[0]<=a&&(s[0]=c,i=!0),s[1]<=a){if(s[1]=c,s=e[++r],!s)break;s[0]<=a?(s[0]=c,i=!0):i=!1}a+=l}}s&&(s[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0)}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};t.CharacterJoinerService=u=r([i(0,c.IBufferService)],u)},5114:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;let r=n(844),i=n(8460),a=n(3656);class o extends r.Disposable{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new s(this._window),this._onDprChange=this.register(new i.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new i.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((e=>this._screenDprMonitor.setWindow(e)))),this.register((0,i.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener(`focus`,(()=>this._isFocused=!0)),this._textarea.addEventListener(`blur`,(()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}t.CoreBrowserService=o;class s extends r.Disposable{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this.register(new r.MutableDisposable),this._onDprChange=this.register(new i.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,r.toDisposable)((()=>this.clearListener())))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,a.addDisposableDomListener)(this._parentWindow,`resize`,(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;let r=n(844);class i extends r.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,r.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}}t.LinkProviderService=i},8934:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;let a=n(4725),o=n(9806),s=t.MouseService=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return(0,o.getCoords)(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=(0,o.getCoordsRelativeToElement)(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};t.MouseService=s=r([i(0,a.IRenderService),i(1,a.ICharSizeService)],s)},3230:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;let a=n(6193),o=n(4725),s=n(8460),c=n(844),l=n(7226),u=n(2585),d=t.RenderService=class extends c.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,t,n,r,i,o,u,d){super(),this._rowCount=e,this._charSizeService=r,this._renderer=this.register(new c.MutableDisposable),this._pausedResizeTask=new l.DebouncedIdleTask,this._observerDisposable=this.register(new c.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new s.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new s.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new s.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new s.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new a.RenderDebouncer(((e,t)=>this._renderRows(e,t)),u),this.register(this._renderDebouncer),this.register(u.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(o.onResize((()=>this._fullRefresh()))),this.register(o.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(n.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(i.onDecorationRegistered((()=>this._fullRefresh()))),this.register(i.onDecorationRemoved((()=>this._fullRefresh()))),this.register(n.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],(()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()}))),this.register(n.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],(()=>this.refreshRows(o.buffer.y,o.buffer.y,!0)))),this.register(d.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(u.window,t),this.register(u.onWindowChange((e=>this._registerIntersectionObserver(e,t))))}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver((e=>this._handleIntersectionChange(e[e.length-1])),{threshold:0});n.observe(t),this._observerDisposable.value=(0,c.toDisposable)((()=>n.disconnect()))}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){this._isPaused?this._needsFullRefresh=!0:(n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))}_renderRows(e,t){this._renderer.value&&(e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0)}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw((e=>this.refreshRows(e.start,e.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(e,t))):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};t.RenderService=d=r([i(2,u.IOptionsService),i(3,o.ICharSizeService),i(4,u.IDecorationService),i(5,u.IBufferService),i(6,o.ICoreBrowserService),i(7,o.IThemeService)],d)},9312:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;let a=n(9806),o=n(9504),s=n(456),c=n(4725),l=n(8460),u=n(844),d=n(6114),f=n(4841),p=n(511),m=n(2585),h=RegExp(`\xA0`,`g`),g=t.SelectionService=class extends u.Disposable{constructor(e,t,n,r,i,a,o,c,d){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=c,this._coreBrowserService=d,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new p.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new l.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new l.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new l.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new l.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((e=>this._handleTrim(e))),this.register(this._bufferService.buffers.onBufferActivate((e=>this._handleBufferActivate(e)))),this.enable(),this._model=new s.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,u.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!(!e||!t||e[0]===t[0]&&e[1]===t[1])}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=n.translateBufferLineToString(o,!0,i,a);r.push(e)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let i=e[1]+1;i<=t[1]-1;i++){let e=n.lines.get(i),t=n.translateBufferLineToString(i,!0);e?.isWrapped?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=i:r.push(i)}}return r.map((e=>e.replace(h,` `))).join(d.isWindows?`\r
|
|
4
4
|
`:`
|