@p4code/cli 0.8.21 → 0.8.23
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/LICENSE +1 -1
- package/dist/{AcpMcpStdioBridge-BL9bAh79.mjs → AcpMcpStdioBridge-BuIIHL4p.mjs} +18 -18
- package/dist/{AcpMcpStdioBridge-DxwEM6O4.mjs → AcpMcpStdioBridge-BvUHCq9r.mjs} +1 -1
- package/dist/{Effect-B-zvTJgX.mjs → Effect-Dxd2t1f5.mjs} +34 -2
- package/dist/{Schema-inVr7S-v.mjs → Schema-CoZlakRf.mjs} +2 -2
- package/dist/{Stream-CX7G9D0M.mjs → Stream-CdSxHO_5.mjs} +2 -2
- package/dist/bin.mjs +4 -4
- package/dist/{binCli-7vuQm4vY.mjs → binCli-DzKk3bdm.mjs} +3764 -2727
- package/dist/claude-history-worker.mjs +1 -1
- package/dist/{claudeHistoryWorker-BvaF6m2o.mjs → claudeHistoryWorker-js6Jgg9C.mjs} +2 -2
- package/dist/client/.vite/manifest.json +2272 -2230
- package/dist/client/assets/AlertDialogRoot-Cc8kVCUa.js +2 -0
- package/dist/client/assets/{AnimatedHeight-B1LdeRxh.js → AnimatedHeight-wZzihILs.js} +2 -2
- package/dist/client/assets/{AuthSurfaceShell-BwoVNx9S.js → AuthSurfaceShell-DJcUG_EN.js} +2 -2
- package/dist/client/assets/{CSPContext-Bn8q5RdR.js → CSPContext-BjqtxKhA.js} +2 -2
- package/dist/client/assets/ChatGptUsageButton-BDCO7XMy.js +2 -0
- package/dist/client/assets/ChatMarkdown-CDno8Ayh.js +65 -0
- package/dist/client/assets/CheckboxIndicator-CuZi7Ixm.js +2 -0
- package/dist/client/assets/ClippedText-DPgP0ObI.js +2 -0
- package/dist/client/assets/CodexSetupSection.logic-BB9JxUR1.js +2 -0
- package/dist/client/assets/ComboboxClear-zheEdyAa.js +2 -0
- package/dist/client/assets/ComboboxGroupLabel-BxCdL7I3.js +2 -0
- package/dist/client/assets/{CommandBlock-BGFFySU3.js → CommandBlock-DQi0VdAG.js} +2 -2
- package/dist/client/assets/{ComposerPromptEditor-DlIuiQ2e.js → ComposerPromptEditor-DCjk2_nI.js} +44 -44
- package/dist/client/assets/CompositeRoot-Bg5KGYGp.js +2 -0
- package/dist/client/assets/{ConnectionStatusDot-DvalNlEr.js → ConnectionStatusDot-Bx8Imvqc.js} +2 -2
- package/dist/client/assets/DesignPageTile-ClF5Va3g.js +2 -0
- package/dist/client/assets/DevicePanel-D192Fic3.js +2 -0
- package/dist/client/assets/{DeviceSetup-ERWR4ZzH.js → DeviceSetup-D9F7F9pV.js} +2 -2
- package/dist/client/assets/DialogTitle-CVP748Gv.js +2 -0
- package/dist/client/assets/{DiffCommentAnnotation-YjjFdEbc.js → DiffCommentAnnotation-mA-RZ8Su.js} +3 -3
- package/dist/client/assets/{DiffFileTree-DynXKsOn.js → DiffFileTree-CaPQB8J4.js} +2 -2
- package/dist/client/assets/DiffPanel-3G1enpU9.js +2 -0
- package/dist/client/assets/{DiffWorkerPoolProvider-DDWtmCyP.js → DiffWorkerPoolProvider-BOInEqDW.js} +3 -3
- package/dist/client/assets/EmbeddedDesign-D97sS_-D.js +19 -0
- package/dist/client/assets/EmbeddedDesign-DYfQOv0y.css +1 -0
- package/dist/client/assets/{EnvironmentMachineIcon-DszKXxD_.js → EnvironmentMachineIcon-B2v_GWgB.js} +2 -2
- package/dist/client/assets/{ExpandableText-hoL-6ubc.js → ExpandableText-fJVIbCvG.js} +3 -3
- package/dist/client/assets/{FieldControl-DDVVfmpB.js → FieldControl-mq4xNgmP.js} +2 -2
- package/dist/client/assets/{FileDiff-BAjD8hTV.js → FileDiff-DLYKd8S8.js} +2 -2
- package/dist/client/assets/{FilePreviewPanel-BjYyaBX0.js → FilePreviewPanel-BCtCBzc7.js} +10 -10
- package/dist/client/assets/{FoldedSettingsSection-CoyiJ_Zj.js → FoldedSettingsSection-BIr-uvTu.js} +2 -2
- package/dist/client/assets/{FormContext-B0PXExmu.js → FormContext-Vtmj_mkP.js} +2 -2
- package/dist/client/assets/{Icons-CX6xNdVb.js → Icons-C0Zjws-3.js} +2 -2
- package/dist/client/assets/Input-B0ah2lnC.js +2 -0
- package/dist/client/assets/{KeybindingsSettings.logic-6FRd2ilb.js → KeybindingsSettings.logic-D-GClV-c.js} +2 -2
- package/dist/client/assets/{NoProjectsHero-A1VZ7ogx.js → NoProjectsHero-Dj3URl4e.js} +2 -2
- package/dist/client/assets/{T3ConnectAccountPages-Cfc33ihi.js → P4ConnectAccountPages-CFPHk3YU.js} +2 -2
- package/dist/client/assets/{T3ConnectSidebarSignIn-HRtCfmCk.js → P4ConnectSidebarSignIn-BMrzp8XI.js} +2 -2
- package/dist/client/assets/PanelLayoutControls-C1Bf67DQ.js +216 -0
- package/dist/client/assets/{PierreEntryIcon-Ds39h2AA.js → PierreEntryIcon--dw21QmY.js} +2 -2
- package/dist/client/assets/PopoverHandle-BT83XTq9.js +2 -0
- package/dist/client/assets/PreviewPanel-DCqFsoQM.js +2 -0
- package/dist/client/assets/ProjectDefaultsSettings-B4srG1Zj.js +2 -0
- package/dist/client/assets/{ProjectFavicon-BtNx7IEw.js → ProjectFavicon--HkFaTb7.js} +3 -3
- package/dist/client/assets/{ProjectIconPickerDialog-CODB2BT9.js → ProjectIconPickerDialog-Bl6Uid40.js} +2 -2
- package/dist/client/assets/{ProjectMonogram-IuYJI7zN.js → ProjectMonogram-BUy_N1of.js} +2 -2
- package/dist/client/assets/{ProviderAuthTerminal-78p4XZgL.js → ProviderAuthTerminal-njw98kWo.js} +2 -2
- package/dist/client/assets/ProviderModelPicker-DBjdgQjr.js +2 -0
- package/dist/client/assets/{ProviderSettingsForm-j7_6yEo7.js → ProviderSettingsForm-_kCwzsZ5.js} +2 -2
- package/dist/client/assets/PullRequestCodeTab-2OTuKeLP.js +6 -0
- package/dist/client/assets/{ReadOnlySourcePreview-kG5bicDV.js → ReadOnlySourcePreview-BfF8Dhuk.js} +2 -2
- package/dist/client/assets/RenderErrorBoundary-CReszKsZ.js +2 -0
- package/dist/client/assets/ScheduledTasksSettings-BJ6fD98R.js +4 -0
- package/dist/client/assets/{ScopedSwitch-D9a9Wx-e.js → ScopedSwitch-QH2iiv6j.js} +2 -2
- package/dist/client/assets/{ScrollAreaCorner-Ck3L5tlH.js → ScrollAreaCorner-3gSiyg8H.js} +2 -2
- package/dist/client/assets/{SecretInput-UofV3Jxx.js → SecretInput-itt3KL-b.js} +2 -2
- package/dist/client/assets/SelectScrollUpArrow-D_o_f6Fh.js +2 -0
- package/dist/client/assets/{SettingsPanels-BoUeQYqp.js → SettingsPanels-BRQsxDAj.js} +7 -7
- package/dist/client/assets/{SettingsPanels.logic-BE_JM5Fc.js → SettingsPanels.logic-DADnLbJa.js} +2 -2
- package/dist/client/assets/{SettingsScopeNotice-CHsOo_U6.js → SettingsScopeNotice-D8WXgfaz.js} +2 -2
- package/dist/client/assets/ThemeEditorPanel-UEzfMVAc.js +5 -0
- package/dist/client/assets/ThreadTerminalDrawer-Do19kCZu.js +5 -0
- package/dist/client/assets/TooltipViewport-DJ2VRKCt.js +2 -0
- package/dist/client/assets/{Virtualizer-DRAoNAc2.js → Virtualizer-BSpDafyf.js} +2 -2
- package/dist/client/assets/{WorkspaceBreadcrumb-CpHuVRke.js → WorkspaceBreadcrumb-B5ZV6VNj.js} +2 -2
- package/dist/client/assets/{WorkspacePageContainer-BQ0Bk5Qy.js → WorkspacePageContainer-BTN44jG6.js} +2 -2
- package/dist/client/assets/{WorkspacePageHeader-Cx1gpU1l.js → WorkspacePageHeader-BaCxaW-R.js} +2 -2
- package/dist/client/assets/_chat-D4YotsBW.js +45 -0
- package/dist/client/assets/_chat.design-BPvdgNpo.js +2 -0
- package/dist/client/assets/{_chat.index-T3ADOYa1.js → _chat.index-Z_VqAv7I.js} +2 -2
- package/dist/client/assets/{_chat.new-egywwPr3.js → _chat.new-DOi-AUHb.js} +3 -3
- package/dist/client/assets/_chat.pull-requests-6QyjmUBZ.js +2 -0
- package/dist/client/assets/{abnfDiagram-VCTEODGH-BctM0h9j.js → abnfDiagram-VCTEODGH--jeYDB6y.js} +2 -2
- package/dist/client/assets/{alert-CNni4aGm.js → alert-CdZT7d18.js} +2 -2
- package/dist/client/assets/architecture-7GRP2DOG-5FKzTtFB.js +1 -0
- package/dist/client/assets/{architectureDiagram-5GKGNRK7-T6dn-Aw8.js → architectureDiagram-5GKGNRK7-CZT297Q4.js} +2 -2
- package/dist/client/assets/assets-CJFG5Oow.js +2 -0
- package/dist/client/assets/{blockDiagram-I7D4REHJ-2KUW7DJ1.js → blockDiagram-I7D4REHJ-EkNtHyvf.js} +2 -2
- package/dist/client/assets/{browserHistoryStore-hEHIMltt.js → browserHistoryStore-DO5WuJ8O.js} +2 -2
- package/dist/client/assets/{browserLinkTarget-CdzL1FA-.js → browserLinkTarget-CJGymzWC.js} +2 -2
- package/dist/client/assets/{c4Diagram-7LVT6UL2-1uZnjRIl.js → c4Diagram-7LVT6UL2-CWpB4Da8.js} +2 -2
- package/dist/client/assets/channel-mtMr1s7n.js +2 -0
- package/dist/client/assets/{checkbox-BpAfakhx.js → checkbox-Q0bv8RvC.js} +2 -2
- package/dist/client/assets/{chunk-4HAMMTFA-DTdSC_bt.js → chunk-4HAMMTFA-DmxkShmg.js} +2 -2
- package/dist/client/assets/{chunk-75Z2AOVW-D8m_ip6d.js → chunk-75Z2AOVW-DR0PpYOm.js} +2 -2
- package/dist/client/assets/{chunk-DU6HZSFF-cx0FIxcU.js → chunk-DU6HZSFF-BO8x-KoS.js} +2 -2
- package/dist/client/assets/{chunk-F27PBJKO-CLaT5xm4.js → chunk-F27PBJKO-Bj6z3Mgi.js} +2 -2
- package/dist/client/assets/{chunk-GMAD6QVW-Dh_22wYw.js → chunk-GMAD6QVW-DDPfmhbi.js} +2 -2
- package/dist/client/assets/{chunk-GVQU2GXP-Cl592Z8q.js → chunk-GVQU2GXP-Dt2y3Ljq.js} +2 -2
- package/dist/client/assets/{chunk-IMKFNOWR-b4olkqo9.js → chunk-IMKFNOWR-ulVnFkwU.js} +2 -2
- package/dist/client/assets/{chunk-L3NEJ4N5-C3zHyNed.js → chunk-L3NEJ4N5-Bq_d7JXK.js} +2 -2
- package/dist/client/assets/{chunk-OSK3NFVY-DfOyV50p.js → chunk-OSK3NFVY-D3zjZoqS.js} +2 -2
- package/dist/client/assets/{chunk-P2QGCYS3-CtwwhFBb.js → chunk-P2QGCYS3-BO8zGK2Q.js} +2 -2
- package/dist/client/assets/{chunk-POPQ4Y6H-Bn_dv1-6.js → chunk-POPQ4Y6H-gzBrIuwg.js} +2 -2
- package/dist/client/assets/{chunk-PWAF6VOD-DB5x5BPu.js → chunk-PWAF6VOD-D5kNvXnl.js} +2 -2
- package/dist/client/assets/{chunk-SHT3W25Y-4SWCrL8G.js → chunk-SHT3W25Y-BUoRhLSC.js} +2 -2
- package/dist/client/assets/{chunk-SVP7TREG-B9UQB6rs.js → chunk-SVP7TREG-Bjv2VnZc.js} +2 -2
- package/dist/client/assets/{chunk-TICWLB2K-I0Ma7uE4.js → chunk-TICWLB2K-DAdtg5Kx.js} +2 -2
- package/dist/client/assets/classDiagram-ZZMXUADV-B1oFCLrU.js +2 -0
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-B1oFCLrU.js +2 -0
- package/dist/client/assets/{color-picker-KVitc2gM.js → color-picker-BWZhsiZJ.js} +2 -2
- package/dist/client/assets/{combobox-DiUoVqyf.js → combobox-BdGKdc6i.js} +2 -2
- package/dist/client/assets/{command-CMR1n6Uf.js → command-CIj8Rufv.js} +2 -2
- package/dist/client/assets/composer-logic-LXlav2Vb.js +6 -0
- package/dist/client/assets/{composerDraftUploads-Vg0GXwnb.js → composerDraftUploads-ykQlcbPE.js} +2 -2
- package/dist/client/assets/{connect-C-gMnpNs.js → connect-BtrTxy8-.js} +2 -2
- package/dist/client/assets/{connect-agent-C4zyA6ta.js → connect-agent-CVmArWh1.js} +2 -2
- package/dist/client/assets/{cynefin-OW5HDTMX-BJCfymNy.js → cynefin-OW5HDTMX-DOViMxbO.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-Cxc8iWLh.js → cynefinDiagram-5FMLGOSQ-BWRCt23-.js} +2 -2
- package/dist/client/assets/{dagre-GXQ25YYZ-DvjGFTC6.js → dagre-GXQ25YYZ-DgnOAR1P.js} +2 -2
- package/dist/client/assets/design-D2FoGDbP.js +2 -0
- package/dist/client/assets/device-CdLsoK0D.js +2 -0
- package/dist/client/assets/{diagram-S7CK7UJ4-DQ3d5nRG.js → diagram-S7CK7UJ4-C-BUdvbR.js} +2 -2
- package/dist/client/assets/{diagram-UQ7AKVKN-Hzoc39HG.js → diagram-UQ7AKVKN-CYox921O.js} +2 -2
- package/dist/client/assets/{diagram-VSXAHHWV-BiAz9eK3.js → diagram-VSXAHHWV-CCHV1RQz.js} +2 -2
- package/dist/client/assets/{diagram-VX7I27RA-ZvxW6orI.js → diagram-VX7I27RA-B4SkxxZx.js} +2 -2
- package/dist/client/assets/{diagram-Z3DM3KII-DYVNNS6J.js → diagram-Z3DM3KII-D80OJGVQ.js} +2 -2
- package/dist/client/assets/{dialog-D--IO2tX.js → dialog-Cgb4jap2.js} +2 -2
- package/dist/client/assets/{diffRendering-CH8Pp2NZ.js → diffRendering-CdquEtfn.js} +2 -2
- package/dist/client/assets/{discovery-list-E9mW3ie9.js → discovery-list-DXkskf2A.js} +2 -2
- package/dist/client/assets/{dist-D_us60iU.js → dist-DWlOCBGN.js} +5 -5
- package/dist/client/assets/{draft-input-BqhTvFTz.js → draft-input-DQxVE9YJ.js} +2 -2
- package/dist/client/assets/{duoViewer-C1ysZzHj.js → duoViewer-Cig0lw70.js} +2 -2
- package/dist/client/assets/{dynamic-D3BvMY7V.js → dynamic-DUhOBcsP.js} +3 -3
- package/dist/client/assets/{ebnfDiagram-PWID7BFC-ARv-iUm5.js → ebnfDiagram-PWID7BFC-AJpsDjYU.js} +2 -2
- package/dist/client/assets/{embeddedScripts-iET5Slgf.js → embeddedScripts-DVwzRCwI.js} +2 -2
- package/dist/client/assets/{empty-IIGW45Hv.js → empty-DHl8_LXy.js} +2 -2
- package/dist/client/assets/entities-BBhhC0Ry.js +2 -0
- package/dist/client/assets/{erDiagram-RLTQ6QDP-BbhShOfn.js → erDiagram-RLTQ6QDP-qU4wtJw2.js} +2 -2
- package/dist/client/assets/eventmodeling-NTZA5JFV-CIzOZUSe.js +1 -0
- package/dist/client/assets/{fileLinks-BVZWyXb4.js → fileLinks-16LrhkMX.js} +2 -2
- package/dist/client/assets/{fileTreeExpansion-CWBDW5x7.js → fileTreeExpansion-BwModZ8t.js} +5 -5
- package/dist/client/assets/flowDiagram-HODETNUW-G6NoS3v2.js +1 -0
- package/dist/client/assets/{ganttDiagram-EL5Y4UJY-YyvVQr9f.js → ganttDiagram-EL5Y4UJY-CMa5sD7U.js} +2 -2
- package/dist/client/assets/{getDiffFileInput-CqWRYbh0.js → getDiffFileInput-CMp2lO2J.js} +2 -2
- package/dist/client/assets/git-compare-CCnx9obs.js +2 -0
- package/dist/client/assets/{gitGraph-4MIJSDKK-B1sT41xD.js → gitGraph-4MIJSDKK-d8ivfU97.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-2YfTeJPY.js → gitGraphDiagram-WWUBYQGX-dltGGWCt.js} +2 -2
- package/dist/client/assets/{guideRunStore-C8EitNtt.js → guideRunStore-CKZDf9-2.js} +2 -2
- package/dist/client/assets/{htmlRender-n-z4ejOb.js → htmlRender-BUb_wWp9.js} +2 -2
- package/dist/client/assets/{index-D5grnFOh.js → index-oiPu1asR.js} +3 -3
- package/dist/client/assets/{info-A6RAGUB7-Bxvrguok.js → info-A6RAGUB7-B_ozJ3Df.js} +1 -1
- package/dist/client/assets/{infoDiagram-27XIBGKW-Ci9YhEz1.js → infoDiagram-27XIBGKW-BiB0fE5_.js} +2 -2
- package/dist/client/assets/{input-DX_wpYEr.js → input-D_jxqXLR.js} +2 -2
- package/dist/client/assets/{input-group-B7App4HX.js → input-group-BM_USnbh.js} +2 -2
- package/dist/client/assets/{ishikawaDiagram-5VMMS53U-DrTMtdZr.js → ishikawaDiagram-5VMMS53U-DhfuI9PX.js} +2 -2
- package/dist/client/assets/{journeyDiagram-3NMN7TZE-Cad85NEf.js → journeyDiagram-3NMN7TZE-8alknR0e.js} +2 -2
- package/dist/client/assets/{kanban-definition-UXKFOSKX-CyPoc7fr.js → kanban-definition-UXKFOSKX-IrCQ1z1D.js} +2 -2
- package/dist/client/assets/{kbd-CBsCsK1C.js → kbd-B2uytHus.js} +2 -2
- package/dist/client/assets/{keybindings-DQLn36Qh.js → keybindings-CqjUKNRx.js} +2 -2
- package/dist/client/assets/{lazyRouteComponent-F8XJwdjp.js → lazyRouteComponent-CByGrW41.js} +2 -2
- package/dist/client/assets/{line-D-vamv77.js → line-wwHo_z2p.js} +2 -2
- package/dist/client/assets/{link-Dsk-mMeT.js → link-BjP3qTK9.js} +2 -2
- package/dist/client/assets/{linkedPrompt-QuSBC7T4.js → linkedPrompt-P6UqYCja.js} +2 -2
- package/dist/client/assets/main-COMts6-0.js +28 -0
- package/dist/client/assets/main-Dwir4BoC.css +2 -0
- package/dist/client/assets/{mediaReference-CyhWqXsL.js → mediaReference-C10FT-nO.js} +2 -2
- package/dist/client/assets/mediaSource-tGWQYhPt.js +2 -0
- package/dist/client/assets/{mermaid-parser.core-DPipy20D.js → mermaid-parser.core-YE1Gxotj.js} +4 -4
- package/dist/client/assets/{mermaid.core-BhvlRFAw.js → mermaid.core-DE9uOpTH.js} +5 -5
- package/dist/client/assets/{mindmap-definition-YA3MSWOX-BmaL4P3W.js → mindmap-definition-YA3MSWOX-CLa2hbBW.js} +2 -2
- package/dist/client/assets/number-field-Dj0uYTJQ.js +2 -0
- package/dist/client/assets/{observeResize-DnTxIA8M.js → observeResize-jHx61cGA.js} +2 -2
- package/dist/client/assets/onboarding-DCwprQF7.js +2 -0
- package/dist/client/assets/openFileInPreview-Dj9ZUFfJ.js +2 -0
- package/dist/client/assets/{p4ProjectFile-Cvz5u0b7.js → p4ProjectFile-DfE23uqD.js} +2 -2
- package/dist/client/assets/{packet-AYTQ26CC-Dv1A4BvT.js → packet-AYTQ26CC-Be9nXFns.js} +1 -1
- package/dist/client/assets/{pair-Bvx1yb_1.js → pair-CZDxH6ja.js} +2 -2
- package/dist/client/assets/{pegDiagram-XKGWAZYB-BSldN3hU.js → pegDiagram-XKGWAZYB-C230ixTv.js} +2 -2
- package/dist/client/assets/pendingSendStore-CaGsppQi.js +2 -0
- package/dist/client/assets/{phoneViewer-CEU-YPRt.js → phoneViewer-CdFM4t6r.js} +2 -2
- package/dist/client/assets/{pie-WAS4IAKB-iLUxjnvf.js → pie-WAS4IAKB-DdxLVm9y.js} +1 -1
- package/dist/client/assets/{pieDiagram-E7YTZNPT-4ZtbrRQa.js → pieDiagram-E7YTZNPT-AK3e5d1A.js} +2 -2
- package/dist/client/assets/{pierre-icons-duX6avqL.js → pierre-icons-BodtO6xC.js} +22 -22
- package/dist/client/assets/{popover-BJ6nvlLO.js → popover-2XJd3KEJ.js} +2 -2
- package/dist/client/assets/{preview-Cf8NQ1hB.js → preview-8bBtJM5H.js} +2 -2
- package/dist/client/assets/{preview-iwQ6KbXA.js → preview-x-GNJPih.js} +2 -2
- package/dist/client/assets/{previewMiniPlayerStore-C-S6Z_7R.js → previewMiniPlayerStore-DMd0mA7a.js} +2 -2
- package/dist/client/assets/primary-BDy4SXjC.js +2 -0
- package/dist/client/assets/primaryCloudLinkState--Kh80aBj.js +2 -0
- package/dist/client/assets/projectFilesQueryState-Bb-3twEo.js +2 -0
- package/dist/client/assets/projectScriptEditor-CAk1a7Bv.js +2 -0
- package/dist/client/assets/{providerSkills-h-0NbrXw.js → providerSkills-9AaADmXt.js} +2 -2
- package/dist/client/assets/{pullRequestDetail.logic-w9YCNM32.js → pullRequestDetail.logic-Fv7ouL_B.js} +4 -4
- package/dist/client/assets/{pullRequestIcons-BjW5TUsG.js → pullRequestIcons-e8EZW8_y.js} +2 -2
- package/dist/client/assets/{pullRequestReviewStore-CfDcNEFp.js → pullRequestReviewStore-DJx8EOVl.js} +2 -2
- package/dist/client/assets/pullRequests-I9yJXxf5.js +2 -0
- package/dist/client/assets/{quadrantDiagram-AXDQQJYC-BA_0gIwm.js → quadrantDiagram-AXDQQJYC-CcagVHbG.js} +2 -2
- package/dist/client/assets/queries-DY5q7KFy.js +2 -0
- package/dist/client/assets/query-BFP47tsD.js +2 -0
- package/dist/client/assets/{radar-RG4KPBEZ-ClHSGc5G.js → radar-RG4KPBEZ-YiDR7Sp-.js} +1 -1
- package/dist/client/assets/radio-group-BNV16qlg.js +2 -0
- package/dist/client/assets/{railroad-74A4TZTK-CLfqlsOS.js → railroad-74A4TZTK-Cg9vU93U.js} +1 -1
- package/dist/client/assets/railroad-abnf-HS5TGJTU-CFQBiMqT.js +1 -0
- package/dist/client/assets/railroad-ebnf-LZEXJU2U-KvUMMzpJ.js +1 -0
- package/dist/client/assets/railroad-peg-WCYAUIDC-ps7Jjity.js +1 -0
- package/dist/client/assets/{railroadDiagram-O6MQD6OU-C3O0sd3N.js → railroadDiagram-O6MQD6OU-DKJFQoet.js} +2 -2
- package/dist/client/assets/{renderScheduler-C_PxJDPT.js → renderScheduler-skv2ZK84.js} +2 -2
- package/dist/client/assets/{requirementDiagram-BXWQKSXE-DTD2i006.js → requirementDiagram-BXWQKSXE-CsnTqOO2.js} +2 -2
- package/dist/client/assets/rightPanelStore-XfAJpUIA.js +2 -0
- package/dist/client/assets/runtime-BSS7jQw6.js +2 -0
- package/dist/client/assets/runtime-D-mOwjrE.js +6 -0
- package/dist/client/assets/runtimeModeConfig-sQBlbgY3.js +2 -0
- package/dist/client/assets/{sankeyDiagram-P5KCCOFB-DN-FD0Rw.js → sankeyDiagram-P5KCCOFB-DkydPO4_.js} +2 -2
- package/dist/client/assets/{scheduledTasksSettings.logic-V_IgyOeJ.js → scheduledTasksSettings.logic-C-rCAoCn.js} +3 -3
- package/dist/client/assets/{scroll-area-BStafc_O.js → scroll-area-DORwTFtw.js} +2 -2
- package/dist/client/assets/{select-BIK-KVyd.js → select-Bsag72zE.js} +2 -2
- package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-BpTwzO_D.js → sequenceDiagram-WJ2MYXX4-Df0N4Qqb.js} +2 -2
- package/dist/client/assets/server-WufAYYa2.js +2 -0
- package/dist/client/assets/session-logic-VyTvpA5f.js +26 -0
- package/dist/client/assets/session-pjgqVscl.js +2 -0
- package/dist/client/assets/{settings-CX5J7KOC.js → settings-CsOciX79.js} +2 -2
- package/dist/client/assets/settings.appearance-BTa_DZJP.js +2 -0
- package/dist/client/assets/settings.archived-5E_Gxvpz.js +2 -0
- package/dist/client/assets/{settings.computer-use-CYOpSx3u.js → settings.computer-use-0aB9RoDX.js} +2 -2
- package/dist/client/assets/settings.connections-DUkG_06v.js +2 -0
- package/dist/client/assets/{settings.data-controls-Dw1t2NUy.js → settings.data-controls-Cn2MWFbv.js} +2 -2
- package/dist/client/assets/{settings.decisions-CjQBlU5H.js → settings.decisions-nRlfWokn.js} +2 -2
- package/dist/client/assets/settings.designs-CYIwYmP5.js +2 -0
- package/dist/client/assets/settings.diagnostics-pCb9rEgL.js +2 -0
- package/dist/client/assets/settings.general-DPkJcwHC.js +2 -0
- package/dist/client/assets/settings.integrations-DVMeSb1K.js +2 -0
- package/dist/client/assets/{settings.keybindings-BYfmXPXW.js → settings.keybindings-PZlDKFMi.js} +2 -2
- package/dist/client/assets/{settings.open-source-licenses-Cmww0egR.js → settings.open-source-licenses-CoY0kkph.js} +2 -2
- package/dist/client/assets/{settings.plugins-DOL0xzP_.js → settings.plugins-DCo7nzjN.js} +5 -5
- package/dist/client/assets/settings.projects-iA51Y3aj.js +4 -0
- package/dist/client/assets/settings.providers-BkUKaZF-.js +3 -0
- package/dist/client/assets/settings.scheduled-tasks-C0FpV34l.js +2 -0
- package/dist/client/assets/settings.snap-shot-C29-fDJw.js +2 -0
- package/dist/client/assets/settings.source-control-CqLszsPJ.js +2 -0
- package/dist/client/assets/{settings.storage-_Qk3Am6V.js → settings.storage-JCo0X6p0.js} +2 -2
- package/dist/client/assets/settingsLayout-DkRcMtAs.js +3 -0
- package/dist/client/assets/{sidebar-CilourkR.js → sidebar-CV_a9dPF.js} +2 -2
- package/dist/client/assets/{sidebarProjectGrouping-Bk_4pOCF.js → sidebarProjectGrouping-C94BzdFc.js} +2 -2
- package/dist/client/assets/{skeleton-DoQ8WJ33.js → skeleton-Bq50sEah.js} +2 -2
- package/dist/client/assets/{sourceControl-CbwbzP2H.js → sourceControl-BvubWC9K.js} +2 -2
- package/dist/client/assets/{sourceControlClients-Bqx0yIVC.js → sourceControlClients-DKVeNHGN.js} +2 -2
- package/dist/client/assets/{spinner-dBHTxMdw.js → spinner-Bzrp5oww.js} +2 -2
- package/dist/client/assets/{standalone-page-7u6OMfTi.js → standalone-page-BGqmgLmI.js} +2 -2
- package/dist/client/assets/{stateDiagram-D77RDMKH-B5DXt7YQ.js → stateDiagram-D77RDMKH-Ctp0qVPg.js} +2 -2
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-DTjnbS5I.js +2 -0
- package/dist/client/assets/{swimlanes-42K2YHIH-BwtHh4XF.js → swimlanes-42K2YHIH-_LIKBAWu.js} +2 -2
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-BEo2_7TC.js +9 -0
- package/dist/client/assets/{terminal-links-DaTgSxq7.js → terminal-links-DHw7nXFF.js} +2 -2
- package/dist/client/assets/{terminalSessions-BH4SsD0n.js → terminalSessions-WR45SySR.js} +2 -2
- package/dist/client/assets/{textarea-DyCJe8OO.js → textarea-wDfYVvpo.js} +2 -2
- package/dist/client/assets/themePalette-CLR_iiPi.js +5 -0
- package/dist/client/assets/{timeline-definition-24CTP7MA-DcZAbrWX.js → timeline-definition-24CTP7MA--fH4g9Xi.js} +2 -2
- package/dist/client/assets/toast-x69BFrW5.js +2 -0
- package/dist/client/assets/{toggle-C4iGKTHY.js → toggle-ExdxBJoI.js} +2 -2
- package/dist/client/assets/{toggle-group-CM-lVPv_.js → toggle-group-Clz6KDtW.js} +2 -2
- package/dist/client/assets/{tooltip-C85X81rS.js → tooltip-D-SzZpgJ.js} +2 -2
- package/dist/client/assets/{treeView-Q6P3EWNA-Bi9LlHgf.js → treeView-Q6P3EWNA-BYF4NjYA.js} +1 -1
- package/dist/client/assets/{treemap-WGGIJYW6-Ddxv0kaw.js → treemap-WGGIJYW6-DTEnfmuA.js} +1 -1
- package/dist/client/assets/{uiStateStore-BQNw2Dqk.js → uiStateStore-CP4WDmc8.js} +3 -3
- package/dist/client/assets/usage-C8NW06hk.js +2 -0
- package/dist/client/assets/{usageAccess-BS7RH41F.js → usageAccess-ZgmQIiWk.js} +2 -2
- package/dist/client/assets/{usageFormat-neDCKBUu.js → usageFormat-C54RJiV9.js} +2 -2
- package/dist/client/assets/{usageShortcuts-BXE7khxl.js → usageShortcuts-B3af64g0.js} +2 -2
- package/dist/client/assets/{use-atom-command-BZ0heqC5.js → use-atom-command-rhVarDA8.js} +2 -2
- package/dist/client/assets/{useAriaLabelledBy-0jbiz1G5.js → useAriaLabelledBy-BG5RCb1o.js} +2 -2
- package/dist/client/assets/useHandleNewThread-Bhl1v82B.js +2 -0
- package/dist/client/assets/{useLocation-CEeuom34.js → useLocation-7uJHNdPS.js} +2 -2
- package/dist/client/assets/useNavigate-DCj963r2.js +2 -0
- package/dist/client/assets/{useNavigateBack-B1hKrkap.js → useNavigateBack-DpCLZais.js} +2 -2
- package/dist/client/assets/{useT3ConnectAuthPrompt-xAWzgrFw.js → useP4ConnectAuthPrompt-ubtmHQ6f.js} +2 -2
- package/dist/client/assets/{useParams-DPNRViD9.js → useParams-Br7l7qPU.js} +2 -2
- package/dist/client/assets/{usePermissionStatus-DhHAmOgT.js → usePermissionStatus-SyBwmFSK.js} +2 -2
- package/dist/client/assets/{usePullRequestActions-BxkTyNnd.js → usePullRequestActions-Djf1UHJs.js} +3 -3
- package/dist/client/assets/{useRegisterFieldControl-DHg4qk95.js → useRegisterFieldControl-qXOWsCr5.js} +2 -2
- package/dist/client/assets/{useScopedModelAvailability-6832Pqao.js → useScopedModelAvailability-BAzgc0gB.js} +2 -2
- package/dist/client/assets/useSettings-BNs1IeKk.js +3 -0
- package/dist/client/assets/utils-hgbJ2TVM.js +37 -0
- package/dist/client/assets/vcsRefInvalidation-DmqB0sWy.js +2 -0
- package/dist/client/assets/{vennDiagram-4TSXK5OY-gRgKfcwz.js → vennDiagram-4TSXK5OY-BzIqk05W.js} +2 -2
- package/dist/client/assets/{wardley-WFR3VGLG-DcrHek4R.js → wardley-WFR3VGLG-CWuiB19I.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-VM6X3IG4-Dy8jwPMm.js → wardleyDiagram-VM6X3IG4-C3KRakQk.js} +2 -2
- package/dist/client/assets/welcome-BFUhADQd.js +2 -0
- package/dist/client/assets/{xychartDiagram-S5SC5T6Z-BE_oCBL1.js → xychartDiagram-S5SC5T6Z-cK0SAbmi.js} +2 -2
- package/dist/client/index.html +9 -31
- package/dist/{renderer-5lNN05tA.mjs → renderer-U6GevbYv.mjs} +2 -2
- package/dist/resource-monitor/darwin-arm64/{t3-resource-monitor → p4-resource-monitor} +0 -0
- package/dist/{runtime-BuR0otfT.mjs → runtime-Cui_uQWU.mjs} +203 -44
- package/package.json +1 -1
- package/dist/client/assets/AlertDialogRoot-CI-BT04n.js +0 -2
- package/dist/client/assets/ChatGptUsageButton-BKwNHMSp.js +0 -2
- package/dist/client/assets/ChatMarkdown-DvwRAy0e.js +0 -65
- package/dist/client/assets/CheckboxIndicator-DUUgNp1r.js +0 -2
- package/dist/client/assets/CodexSetupSection.logic-CGR92Snb.js +0 -2
- package/dist/client/assets/CollapsiblePanel-D1aZAbsh.js +0 -2
- package/dist/client/assets/ComboboxClear-CMNv82AR.js +0 -2
- package/dist/client/assets/ComboboxGroupLabel-BqpdqndG.js +0 -2
- package/dist/client/assets/CompositeRoot-BP063J4d.js +0 -2
- package/dist/client/assets/DevicePanel-FC3DPqLr.js +0 -2
- package/dist/client/assets/DialogTitle-OaePW-Ih.js +0 -2
- package/dist/client/assets/DiffPanel-BpuFnTQ7.js +0 -2
- package/dist/client/assets/EmbeddedDesign-B1fJ5Mbz.js +0 -19
- package/dist/client/assets/EmbeddedDesign-DmybFtYo.css +0 -1
- package/dist/client/assets/Input-C7aWgRC_.js +0 -2
- package/dist/client/assets/PanelLayoutControls-Bp96ytbx.js +0 -216
- package/dist/client/assets/PopoverHandle-DRjGw1Yt.js +0 -2
- package/dist/client/assets/PreviewPanel-ChNkAjUz.js +0 -2
- package/dist/client/assets/ProjectDefaultsSettings-Df_lGEeD.js +0 -2
- package/dist/client/assets/ProviderModelPicker-C3S7ixLD.js +0 -2
- package/dist/client/assets/PullRequestCodeTab-DkUNpmvf.js +0 -6
- package/dist/client/assets/RenderErrorBoundary-BbYl2ykS.js +0 -2
- package/dist/client/assets/ScheduledTasksSettings-YdKTaY5U.js +0 -4
- package/dist/client/assets/SelectScrollUpArrow-C_YHAw_f.js +0 -2
- package/dist/client/assets/ThemeEditorPanel-ezln4yFM.js +0 -5
- package/dist/client/assets/ThreadTerminalDrawer-D_GQQ1Ly.js +0 -5
- package/dist/client/assets/TooltipViewport-B_Oz-gLq.js +0 -2
- package/dist/client/assets/_chat-COwukFSB.js +0 -45
- package/dist/client/assets/_chat.pull-requests-CkgRG9UN.js +0 -2
- package/dist/client/assets/architecture-7GRP2DOG-5VIB8Eba.js +0 -1
- package/dist/client/assets/assets-B_A7RkiF.js +0 -2
- package/dist/client/assets/channel-B7HSUXfW.js +0 -2
- package/dist/client/assets/classDiagram-ZZMXUADV-9HCpqDrm.js +0 -2
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-9HCpqDrm.js +0 -2
- package/dist/client/assets/composer-logic-D76QXdUM.js +0 -6
- package/dist/client/assets/design-Cvqy5-YM.js +0 -2
- package/dist/client/assets/device-CHTG1mA3.js +0 -2
- package/dist/client/assets/entities-BNeCRVLN.js +0 -2
- package/dist/client/assets/eventmodeling-NTZA5JFV-7Qy1WUdw.js +0 -1
- package/dist/client/assets/flowDiagram-HODETNUW-WrRfiKZh.js +0 -1
- package/dist/client/assets/git-compare-DW_c6fci.js +0 -2
- package/dist/client/assets/main-B3UqEpE9.css +0 -2
- package/dist/client/assets/main-D398MK8V.js +0 -26
- package/dist/client/assets/mediaSource-DzNyV4QZ.js +0 -2
- package/dist/client/assets/number-field-CO0djGoZ.js +0 -2
- package/dist/client/assets/onboarding-Bk1fay_k.js +0 -2
- package/dist/client/assets/openFileInPreview-BoDixD_F.js +0 -2
- package/dist/client/assets/primary-BWLl-lP0.js +0 -2
- package/dist/client/assets/primaryCloudLinkState-_2yJcM8W.js +0 -2
- package/dist/client/assets/projectFilesQueryState-Dnhdh9Fp.js +0 -2
- package/dist/client/assets/projectScriptEditor-BI4TQzLb.js +0 -2
- package/dist/client/assets/pullRequests-PrPMEuwL.js +0 -2
- package/dist/client/assets/queries-WzVTFKPw.js +0 -2
- package/dist/client/assets/query-MZn8giyP.js +0 -2
- package/dist/client/assets/radio-group-Ca6IMyWa.js +0 -2
- package/dist/client/assets/railroad-abnf-HS5TGJTU-D6sBNrTv.js +0 -1
- package/dist/client/assets/railroad-ebnf-LZEXJU2U-DQmVNLBf.js +0 -1
- package/dist/client/assets/railroad-peg-WCYAUIDC-BmxuO4Yw.js +0 -1
- package/dist/client/assets/rightPanelStore-UcehuwgS.js +0 -2
- package/dist/client/assets/runtime-CvGlGrbH.js +0 -6
- package/dist/client/assets/runtime-DgUiDuq4.js +0 -2
- package/dist/client/assets/runtimeModeConfig-CTQ97M7F.js +0 -2
- package/dist/client/assets/server-h8-LTzsE.js +0 -2
- package/dist/client/assets/session-BnZv-sUV.js +0 -2
- package/dist/client/assets/session-logic-Chq6Fhx9.js +0 -26
- package/dist/client/assets/settings.appearance-CX8WldRu.js +0 -2
- package/dist/client/assets/settings.archived-BLphtU6e.js +0 -2
- package/dist/client/assets/settings.connections-CPZLelaw.js +0 -2
- package/dist/client/assets/settings.designs-CdUp5EKA.js +0 -2
- package/dist/client/assets/settings.diagnostics-CChxKGXN.js +0 -2
- package/dist/client/assets/settings.general-fPNbGy-A.js +0 -2
- package/dist/client/assets/settings.integrations-lsI9Ds_Z.js +0 -2
- package/dist/client/assets/settings.projects-BmPcRKSU.js +0 -4
- package/dist/client/assets/settings.providers-BmXJRxVY.js +0 -3
- package/dist/client/assets/settings.scheduled-tasks-DIrqKW18.js +0 -2
- package/dist/client/assets/settings.snap-shot-cYlYvsZa.js +0 -2
- package/dist/client/assets/settings.source-control-DiCRUoZ-.js +0 -2
- package/dist/client/assets/settingsLayout-BxEP0uF3.js +0 -3
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-DKxchkZ_.js +0 -2
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-DcmT28cJ.js +0 -9
- package/dist/client/assets/themePalette-mGukKeaJ.js +0 -5
- package/dist/client/assets/toast-CylvOlB4.js +0 -2
- package/dist/client/assets/usage-D_p-kdF1.js +0 -2
- package/dist/client/assets/useHandleNewThread-xDPfeiE8.js +0 -2
- package/dist/client/assets/useNavigate-B5WzUZJ7.js +0 -2
- package/dist/client/assets/useSettings-CHo-Nv-3.js +0 -3
- package/dist/client/assets/utils-ChK8VEFC.js +0 -37
- package/dist/client/assets/vcsRefInvalidation-C1-o4QR4.js +0 -2
- package/dist/client/assets/welcome-Bx0ykTSW.js +0 -2
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{NE as n,Pp as r,Um as i,fp as a,lE as o,sr as s,t as c,vp as l}from"./utils-ChK8VEFC.js";import{f as u,l as d,m as f}from"./TooltipViewport-B_Oz-gLq.js";import{A as p,E as m,G as h,H as g,O as _,S as v,U as y,W as b,_ as x,d as ee,et as S,g as C,m as w,s as te,u as T,y as E}from"./themePalette-mGukKeaJ.js";import{a as ne,n as re,t as ie}from"./tooltip-C85X81rS.js";import{n as D,t as O}from"./toggle-group-CM-lVPv_.js";import{t as ae}from"./input-DX_wpYEr.js";import{i as k,o as A,t as j}from"./popover-BJ6nvlLO.js";import{i as M,n as N,r as P,t as F}from"./color-picker-KVitc2gM.js";import{na as I}from"./main-D398MK8V.js";var oe=n(),L=e(t(),1),R=e(o(),1);function z(e){return{canvas:`Background`,toolbar:`Toolbar background`,toolbarForeground:`Toolbar text`,toolbarBorder:`Toolbar border`,toolbarControl:`Toolbar control`,toolbarControlForeground:`Toolbar control text`,toolbarControlHover:`Toolbar control hover`,accent:`Accent color`,errorForeground:`Error text`,errorSurface:`Error background`,warningForeground:`Warning text`,warningSurface:`Warning background`,updateForeground:`Update text`,updateSurface:`Update background`}[e]||e.replace(/([A-Z])/g,` $1`).replace(/^./,e=>e.toUpperCase())}function B(e){let t=g(e)??``,n=t.length===9?t.slice(7):``;return n===`ff`?``:n}function se(e){return(g(e)??`#000000`).slice(0,7)}function ce(e){let t=Number.parseInt(se(e).slice(1),16);return[t>>16,t>>8&255,t&255]}function le(e){let t=e.trim().replace(/^rgb\(\s*/i,``).replace(/\s*\)$/,``).split(/[,\s]+/).filter(Boolean).map(Number);return t.length!==3||t.some(e=>!Number.isInteger(e)||e<0||e>255)?null:`#${t.map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}function V(e){return ce(e).join(`, `)}function H({label:e,value:t,onChange:n}){let r=se(t),i=B(t),[a,o]=(0,L.useState)(()=>P(r)),[s,c]=(0,L.useState)(r),[l,u]=(0,L.useState)(()=>V(r)),d=(0,L.useRef)(!1),f=M(a.h,a.s,a.v),p=V(f);(0,L.useEffect)(()=>{d.current||(c(r),u(V(r))),o(e=>M(e.h,e.s,e.v)===r?e:P(r))},[r]);let m=(0,L.useRef)(n);m.current=n;let h=(0,L.useRef)(null),g=(0,L.useRef)(null),_=(0,L.useCallback)(()=>{g.current!==null&&(cancelAnimationFrame(g.current),g.current=null);let e=h.current;h.current=null,e!==null&&m.current(e)},[]);(0,L.useEffect)(()=>()=>_(),[_]);let v=(0,L.useCallback)(e=>{h.current=e,g.current??=requestAnimationFrame(()=>{g.current=null;let e=h.current;h.current=null,e!==null&&m.current(e)})},[]),y=(0,L.useCallback)(e=>{o(e);let t=M(e.h,e.s,e.v);c(t),u(V(t)),v(t+i)},[i,v]),b=e=>{if(c(e),!/^#[0-9a-f]{6}$/i.test(e))return;let t=P(e);o(t),u(V(e)),n(e.toLowerCase())},x=e=>{u(e);let t=le(e);t&&(o(P(t)),c(t),n(t+i))};return(0,R.jsxs)(`div`,{className:`w-72 bg-popover`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/70 px-4 py-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`p`,{className:`truncate text-xs font-semibold text-foreground`,children:e}),(0,R.jsx)(`p`,{className:`text-2xs text-muted-foreground`,children:`Choose a color`})]}),(0,R.jsx)(`span`,{className:`size-7 shrink-0 rounded-full shadow-sm`,style:{backgroundColor:f}})]}),(0,R.jsxs)(`div`,{className:`grid gap-3 px-3 pb-3 pt-3`,children:[(0,R.jsx)(N,{label:e,value:a,onChange:y,onInteractionEnd:_}),(0,R.jsx)(F,{label:`${e} hue`,value:a.h,onChange:e=>y({...a,h:e}),onInteractionEnd:_}),(0,R.jsxs)(`div`,{className:`grid grid-cols-[1fr_1.2fr] gap-2`,children:[(0,R.jsxs)(`label`,{className:`grid min-w-0 gap-1`,children:[(0,R.jsx)(`span`,{className:`px-1 text-3xs font-semibold uppercase tracking-widest text-muted-foreground`,children:`HEX`}),(0,R.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 rounded-lg border border-input bg-background px-2 focus-within:border-ring`,children:[(0,R.jsx)(`span`,{className:`size-3.5 shrink-0 rounded-full`,style:{backgroundColor:f}}),(0,R.jsx)(`input`,{"aria-label":`${e} picker hex value`,className:`h-8 min-w-0 flex-1 bg-transparent font-mono text-xs text-foreground outline-none`,onBlur:()=>{d.current=!1,c(f),u(p)},onChange:e=>b(e.currentTarget.value),onFocus:()=>{d.current=!0},spellCheck:!1,value:s})]})]}),(0,R.jsxs)(`label`,{className:`grid min-w-0 gap-1`,children:[(0,R.jsx)(`span`,{className:`px-1 text-3xs font-semibold uppercase tracking-widest text-muted-foreground`,children:`RGB`}),(0,R.jsx)(`span`,{className:`flex min-w-0 items-center rounded-lg border border-input bg-background px-2 focus-within:border-ring`,children:(0,R.jsx)(`input`,{"aria-label":`${e} picker RGB value`,className:`h-8 min-w-0 flex-1 bg-transparent font-mono text-xs text-foreground outline-none`,onBlur:()=>{d.current=!1,c(f),u(p)},onChange:e=>x(e.currentTarget.value),onFocus:()=>{d.current=!0},spellCheck:!1,value:l})})]})]})]})]})}function U(e){let t=(0,oe.c)(13),{label:n,value:r,onChange:i,onInteract:a}=e,o=`Choose ${n} color`,s;t[0]===r?s=t[1]:(s=(0,R.jsx)(`span`,{className:`absolute inset-0 rounded-full shadow-sm`,style:{backgroundColor:r}}),t[0]=r,t[1]=s);let c;t[2]!==a||t[3]!==o||t[4]!==s?(c=(0,R.jsx)(A,{render:(0,R.jsx)(`button`,{"aria-label":o,className:`relative flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-full border border-foreground/30 transition-transform hover:scale-105 focus-visible:outline-2 focus-visible:outline-solid focus-visible:-outline-offset-2 focus-visible:outline-ring`,onFocus:a,onPointerDown:a,type:`button`,children:s})}),t[2]=a,t[3]=o,t[4]=s,t[5]=c):c=t[5];let l;t[6]!==n||t[7]!==i||t[8]!==r?(l=(0,R.jsx)(k,{align:`end`,padding:`none`,"data-theme-editor-panel":``,side:`bottom`,sideOffset:10,children:(0,R.jsx)(H,{label:n,onChange:i,value:r})}),t[6]=n,t[7]=i,t[8]=r,t[9]=l):l=t[9];let u;return t[10]!==c||t[11]!==l?(u=(0,R.jsxs)(j,{children:[c,l]}),t[10]=c,t[11]=l,t[12]=u):u=t[12],u}var ue=(0,L.memo)(function(e){let t=(0,oe.c)(58),{role:n,value:r,onChange:i,onSelect:a,onToggleSelected:o,selected:s,label:l}=e,u=s!==void 0&&s,d;t[0]!==l||t[1]!==n?(d=l??z(n),t[0]=l,t[1]=n,t[2]=d):d=t[2];let f=d,p;t[3]===r?p=t[4]:(p=m(r),t[3]=r,t[4]=p);let h=p,_=h?r:`#000000`,v;t[5]===r?v=t[6]:(v=r.trim().toLowerCase().startsWith(`oklch(`)?g(r)??r:r,t[5]=r,t[6]=v);let y=v,b=u&&`bg-accent/60 inset-ring inset-ring-ring`,x;t[7]===b?x=t[8]:(x=c(`flex min-h-11 min-w-0 items-center gap-2 rounded-lg px-2 py-1.5 transition-[background-color,box-shadow]`,b),t[7]=b,t[8]=x);let ee=`${u?`Hide`:`Show`} ${f} usage`,S;t[9]!==o||t[10]!==n?(S=()=>o?.(n),t[9]=o,t[10]=n,t[11]=S):S=t[11];let C;t[12]===f?C=t[13]:(C=(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:f}),t[12]=f,t[13]=C);let w;t[14]!==u||t[15]!==ee||t[16]!==S||t[17]!==C?(w=(0,R.jsx)(ne,{render:(0,R.jsx)(`button`,{"aria-label":ee,"aria-pressed":u,className:`flex min-w-0 flex-1 cursor-pointer items-center rounded-md text-left text-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,onClick:S,type:`button`,children:C})}),t[14]=u,t[15]=ee,t[16]=S,t[17]=C,t[18]=w):w=t[18];let te=`${u?`Hide`:`Show`} where ${f} is used`,T;t[19]===te?T=t[20]:(T=(0,R.jsx)(re,{side:`top`,children:te}),t[19]=te,t[20]=T);let E;t[21]!==w||t[22]!==T?(E=(0,R.jsxs)(ie,{children:[w,T]}),t[21]=w,t[22]=T,t[23]=E):E=t[23];let D;t[24]!==i||t[25]!==n?(D=e=>i(n,e),t[24]=i,t[25]=n,t[26]=D):D=t[26];let O;t[27]!==a||t[28]!==n?(O=()=>a?.(n),t[27]=a,t[28]=n,t[29]=O):O=t[29];let k;t[30]!==f||t[31]!==_||t[32]!==D||t[33]!==O?(k=(0,R.jsx)(U,{label:f,onChange:D,onInteract:O,value:_}),t[30]=f,t[31]=_,t[32]=D,t[33]=O,t[34]=k):k=t[34];let A=!h,j=`${f} hex value`,M=`${n}-hex`,N;t[35]!==i||t[36]!==n?(N=e=>i(n,e.currentTarget.value),t[35]=i,t[36]=n,t[37]=N):N=t[37];let P,F;t[38]!==a||t[39]!==n?(P=()=>a?.(n),F=()=>a?.(n),t[38]=a,t[39]=n,t[40]=P,t[41]=F):(P=t[40],F=t[41]);let I;t[42]!==y||t[43]!==A||t[44]!==j||t[45]!==M||t[46]!==N||t[47]!==P||t[48]!==F?(I=(0,R.jsx)(ae,{"aria-invalid":A,"aria-label":j,className:`w-28 shrink-0`,font:`mono`,id:M,nativeInput:!0,onChange:N,onFocus:P,onPointerDown:F,size:`compact`,value:y}),t[42]=y,t[43]=A,t[44]=j,t[45]=M,t[46]=N,t[47]=P,t[48]=F,t[49]=I):I=t[49];let L;t[50]!==k||t[51]!==I?(L=(0,R.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[k,I]}),t[50]=k,t[51]=I,t[52]=L):L=t[52];let B;return t[53]!==n||t[54]!==E||t[55]!==L||t[56]!==x?(B=(0,R.jsxs)(`div`,{className:x,"data-theme-color-role":n,children:[E,L]}),t[53]=n,t[54]=E,t[55]=L,t[56]=x,t[57]=B):B=t[57],B}),de=[`background`,`border`,`foreground`],W=`data-theme-inspector-match`,fe=`data-theme-token-probe`,G=`#01fea7`,pe=`#fe01a7`,K=`theme-inspector-spotlight`,q=`theme-inspector-spotlight-mask`,me=`theme-inspector-spotlight-glow`,J=`theme-inspector-hover`,Y=`http://www.w3.org/2000/svg`,he={background:`canvas`,foreground:`text`,card:`surface`,"card-foreground":`text`,popover:`surfaceOverlay`,"popover-foreground":`text`,"surface-raised":`surfaceRaised`,primary:`messageAction`,"primary-foreground":`messageActionForeground`,secondary:`secondary`,"secondary-foreground":`secondaryForeground`,muted:`muted`,"muted-foreground":`mutedForeground`,placeholder:`placeholder`,"secondary-label":`secondaryLabel`,"icon-muted":`iconMuted`,accent:`accentSurface`,"accent-foreground":`accentSurfaceForeground`,destructive:`error`,"destructive-foreground":`errorForeground`,error:`error`,"error-foreground":`errorForeground`,"error-surface":`errorSurface`,warning:`warning`,"warning-foreground":`warningForeground`,"warning-surface":`warningSurface`,update:`update`,"update-foreground":`updateForeground`,"update-surface":`updateSurface`,message:`messageSurface`,"message-foreground":`messageForeground`,"message-action":`messageAction`,"message-action-foreground":`messageActionForeground`,"message-action-hover":`messageActionHover`,sidebar:`sidebar`,"sidebar-foreground":`sidebarForeground`,"sidebar-muted-foreground":`sidebarMutedForeground`,"sidebar-control-surface":`sidebarControlSurface`,"sidebar-row-hover":`sidebarRowHover`,"sidebar-row-active":`sidebarRowActive`,"sidebar-row-selected":`sidebarRowSelected`,"sidebar-border":`sidebarBorder`,border:`border`,input:`input`,ring:`focus`},ge={background:[`bg-`],border:[`border-`,`outline-`,`ring-`],foreground:[`text-`,`caret-`,`fill-`,`stroke-`]};function _e(e){document.querySelectorAll(`[${e}]`).forEach(t=>t.removeAttribute(e))}function ve(){_e(W),document.getElementById(K)?.remove()}function ye(){document.getElementById(J)?.remove()}function X(e){return document.createElementNS(Y,e)}function be(e){let t=e.getBoundingClientRect();if(t.width<=0||t.height<=0||t.right<0||t.bottom<0||t.left>window.innerWidth||t.top>window.innerHeight)return null;let n=t.left-5,r=t.top-5,i=Number.parseFloat(window.getComputedStyle(e).borderTopLeftRadius)||0;return{x:n,y:r,width:t.width+10,height:t.height+10,radius:Math.min(18,Math.max(7,i+5))}}function xe(e,t){let n=be(e.element);if(!n){ye();return}let r=document.getElementById(J);if(!r){r=document.createElement(`div`),r.id=J,r.setAttribute(`aria-hidden`,`true`);let e=document.createElement(`span`);e.dataset.themeInspectorHoverLabel=``,r.append(e),document.body.append(r)}r.style.left=`${n.x}px`,r.style.top=`${n.y}px`,r.style.width=`${n.width}px`,r.style.height=`${n.height}px`,r.style.borderRadius=`${n.radius}px`,r.dataset.placement=n.y<32?`below`:`above`;let i=r.querySelector(`[data-theme-inspector-hover-label]`);i&&(i.textContent=t)}function Se(e){let t=new Map;for(let n of e){let e=be(n);if(!e)continue;let r=[e.x,e.y,e.width,e.height].map(e=>Math.round(e)).join(`:`);t.set(r,e)}if(t.size===0){document.getElementById(K)?.remove();return}let n=document.getElementById(K);n||(n=X(`svg`),n.id=K,n.setAttribute(`aria-hidden`,`true`),n.setAttribute(`focusable`,`false`),document.body.append(n)),n.setAttribute(`viewBox`,`0 0 ${window.innerWidth} ${window.innerHeight}`);let r=X(`defs`),i=X(`mask`);i.id=q,i.setAttribute(`maskUnits`,`userSpaceOnUse`);let a=X(`rect`);a.setAttribute(`width`,String(window.innerWidth)),a.setAttribute(`height`,String(window.innerHeight)),a.setAttribute(`fill`,`white`),i.append(a);let o=X(`filter`);o.id=me,o.setAttribute(`x`,`-50%`),o.setAttribute(`y`,`-50%`),o.setAttribute(`width`,`200%`),o.setAttribute(`height`,`200%`);let s=X(`feGaussianBlur`);s.setAttribute(`stdDeviation`,`5`),s.setAttribute(`result`,`blur`);let c=X(`feMerge`),l=X(`feMergeNode`);l.setAttribute(`in`,`blur`);let u=X(`feMergeNode`);u.setAttribute(`in`,`SourceGraphic`),c.append(l,u),o.append(s,c),r.append(i,o);let d=X(`g`);for(let e of t.values()){let t=X(`rect`);t.setAttribute(`x`,String(e.x)),t.setAttribute(`y`,String(e.y)),t.setAttribute(`width`,String(e.width)),t.setAttribute(`height`,String(e.height)),t.setAttribute(`rx`,String(e.radius)),t.setAttribute(`fill`,`black`),i.append(t);let n=t.cloneNode(!1);n.removeAttribute(`fill`),n.setAttribute(`class`,`theme-inspector-spotlight-glow`),n.setAttribute(`filter`,`url(#${me})`),d.append(n)}let f=X(`rect`);f.setAttribute(`class`,`theme-inspector-spotlight-dimmer`),f.setAttribute(`width`,String(window.innerWidth)),f.setAttribute(`height`,String(window.innerHeight)),f.setAttribute(`mask`,`url(#${q})`),n.replaceChildren(r,f,d)}function Ce(){Se([...document.querySelectorAll(`[${W}]`)])}function we(e){return e.matches(`input, textarea, select, option`)?!0:Array.from(e.childNodes).some(e=>e.nodeType===Node.TEXT_NODE&&!!e.textContent?.trim())}function Z(e,{forHitTest:t=!1}={}){let n=window.getComputedStyle(e);if(n.display===`none`||n.visibility===`hidden`||Number(n.opacity)===0)return null;let r=[];for(let[e,t,i]of[[n.borderTopColor,n.borderTopStyle,n.borderTopWidth],[n.borderRightColor,n.borderRightStyle,n.borderRightWidth],[n.borderBottomColor,n.borderBottomStyle,n.borderBottomWidth],[n.borderLeftColor,n.borderLeftStyle,n.borderLeftWidth]])t!==`none`&&Number.parseFloat(i)>0&&r.push(e);n.outlineStyle!==`none`&&Number.parseFloat(n.outlineWidth)>0&&r.push(n.outlineColor),n.borderImageSource!==`none`&&r.push(n.borderImageSource),n.boxShadow!==`none`&&r.push(n.boxShadow);let i=[];return(t||we(e))&&i.push(n.color),e instanceof SVGElement&&i.push(n.fill,n.stroke),e.matches(`input, textarea`)&&i.push(n.caretColor),n.textDecorationLine!==`none`&&i.push(n.textDecorationColor),n.textShadow!==`none`&&i.push(n.textShadow),{background:[n.backgroundColor,n.backgroundImage].join(`
|
|
2
|
-
`),border:r.join(`
|
|
3
|
-
`),foreground:i.join(`
|
|
4
|
-
`)}}function Te(e,t){return de.filter(n=>e[n]!==t[n])}function Ee(e){let t=document.documentElement,n=t.hasAttribute(fe);n||t.setAttribute(fe,``);try{return e()}finally{window.getComputedStyle(t).color,n||t.removeAttribute(fe)}}function De(e){let t=document.documentElement,n=C(e),r=t.style.getPropertyValue(n),i=t.style.getPropertyPriority(n),a=r.trim().toLowerCase()===G?pe:G;return t.style.setProperty(n,a,`important`),()=>{r?t.style.setProperty(n,r,i):t.style.removeProperty(n)}}function Q(e){let t=e.map(De);return()=>{for(let e of t.toReversed())e()}}function Oe(){return[document.body,...document.body.querySelectorAll(`*`)].filter(e=>!e.closest(`[data-theme-editor-panel]`)&&!e.closest(`#${K}, #${J}`))}function ke(e,t){if(e.includes(`:`))return null;for(let n of ge[t])if(e.startsWith(n))return he[e.slice(n.length).split(`/`,1)[0]??``]??null;return null}function Ae(e){for(let t of de)for(let n of e.classList){let e=ke(n,t);if(e)return e}return null}function je(e){let t=[],n=e;for(;n&&n!==document.documentElement;)n.closest(`[data-theme-editor-panel]`)||t.push(n),n=n.parentElement;return t}function Me(e){if(e.closest(`[data-theme-editor-panel]`))return null;for(let t of je(e)){let e=Ae(t);if(e)return{element:t,role:e}}return null}function Ne(e){performance.now(),_e(W);let t=Oe(),n=performance.now(),r=Ee(()=>{let n=new Map;for(let e of t){let t=Z(e);t&&n.set(e,t)}let r=Q(e),i=new Set;try{for(let[e,t]of n){let n=Z(e);n&&Te(t,n).length>0&&i.add(e)}}finally{r()}return i});performance.now()-n;let i=new Set;for(let e of r)i.add(e instanceof SVGElement?e.closest(`svg`)??e:e);for(let e of i)e.setAttribute(W,``);return Se([...i]),i.size}function Pe(e){if(e.closest(`[data-theme-editor-panel]`))return null;let t=je(e),n=Me(e);if(n)return n;let r=Ee(()=>{let e=new Map,n=new Map;for(let n of t){let t=Z(n,{forHitTest:!0});t&&e.set(n,t)}for(let t of S){let r=De(t);try{for(let[r,i]of e){let e=Z(r,{forHitTest:!0});if(!e)continue;let a=n.get(r)??{};for(let n of Te(i,e))a[n]??=t;n.set(r,a)}}finally{r()}}return n});for(let e of t){let t=r.get(e);if(t)for(let n of de){let r=t[n];if(r)return{element:e,role:r}}}return null}var $=[`canvas`,`accent`],Fe=[{id:`foundation`,title:`Foundation`,families:[{id:`background`,label:`Background`,role:`canvas`,roles:[`canvas`,`chrome`,`toolbar`]},{id:`surface`,label:`Surface`,role:`surface`,roles:[`surface`]},{id:`raised-surface`,label:`Raised surface`,role:`surfaceRaised`,roles:[`surfaceRaised`]},{id:`overlay`,label:`Overlay`,role:`surfaceOverlay`,roles:[`surfaceOverlay`]},{id:`text`,label:`Text`,role:`text`,roles:[`text`,`toolbarForeground`,`toolbarControlForeground`]},{id:`muted-text`,label:`Muted text`,role:`mutedForeground`,roles:[`textMuted`,`mutedForeground`,`placeholder`,`secondaryLabel`,`iconMuted`,`sidebarMutedForeground`]},{id:`border`,label:`Border`,role:`border`,roles:[`border`,`toolbarBorder`,`sidebarBorder`]},{id:`input`,label:`Input`,role:`input`,roles:[`input`]}]},{id:`brand-content`,title:`Brand & content`,families:[{id:`subtle-surface`,label:`Subtle surface`,role:`secondary`,roles:[`secondary`,`secondaryForeground`,`muted`,`toolbarControl`]},{id:`highlight-surface`,label:`Highlight surface`,role:`accentSurface`,roles:[`accentSurface`,`accentSurfaceForeground`,`toolbarControlHover`]},{id:`accent`,label:`Accent`,role:`accent`,roles:[`accent`,`accentForeground`,`focus`,`update`,`updateForeground`,`updateSurface`,`terminalCursor`]},{id:`action`,label:`Action`,role:`messageAction`,roles:[`messageAction`,`messageActionForeground`,`messageActionHover`]},{id:`message-surface`,label:`Message surface`,role:`messageSurface`,roles:[`messageSurface`,`messageForeground`]},{id:`code-surface`,label:`Code surface`,role:`codeBackground`,roles:[`codeBackground`,`codeForeground`]}]},{id:`search`,title:`Search`,families:[{id:`search-matches`,label:`Search matches`,role:`searchMatchBackground`,roles:[`searchMatchBackground`,`searchMatchForeground`]},{id:`current-match`,label:`Current match`,role:`searchMatchActiveBackground`,roles:[`searchMatchActiveBackground`,`searchMatchActiveForeground`]}]},{id:`context`,title:`Context`,families:[{id:`sidebar-background`,label:`Sidebar background`,role:`sidebar`,roles:[`sidebar`,`sidebarForeground`]},{id:`sidebar-controls`,label:`Sidebar controls`,role:`sidebarControlSurface`,roles:[`sidebarControlSurface`]},{id:`sidebar-selection`,label:`Sidebar selection`,role:`sidebarRowSelected`,roles:[`sidebarRowHover`,`sidebarRowActive`,`sidebarRowSelected`]},{id:`terminal-background`,label:`Terminal background`,role:`terminalBackground`,roles:[`terminalBackground`,`terminalForeground`,`terminalSelection`,`terminalScrollbar`,`terminalScrollbarHover`]}]},{id:`status`,title:`Status`,families:[{id:`error`,label:`Error`,role:`error`,roles:[`error`,`errorForeground`,`errorSurface`]},{id:`warning`,label:`Warning`,role:`warning`,roles:[`warning`,`warningForeground`,`warningSurface`]}]}],Ie=Fe.flatMap(e=>e.families),Le=new Map(Ie.flatMap(e=>e.roles.map(t=>[t,e])));function Re(e){return Le.get(e)??null}function ze(e){return{...w(e)}}function Be(){return{light:ze(`light`),dark:ze(`dark`)}}function Ve(e){return m(e.trim())}function He(e,t){let n=w(e);return T(e,Ve(t.canvas)?t.canvas:n.canvas,Ve(t.accent)?t.accent:n.accent)}function Ue({open:e,onOpenChange:t,onSaved:n,editingTheme:o,initialAppearance:m,seedTheme:g,seedName:C,restoreTheme:w}){let T=o!==null,[k,A]=(0,L.useState)(``),[j,M]=(0,L.useState)(m),[N,P]=(0,L.useState)(!1),[F,oe]=(0,L.useState)(()=>Be()),[B,se]=(0,L.useState)({light:!1,dark:!1}),[ce,le]=(0,L.useState)(!1),[V,H]=(0,L.useState)(null),[U,de]=(0,L.useState)(!1),[W,fe]=(0,L.useState)(``),[G,pe]=(0,L.useState)(!1),[K,q]=(0,L.useState)(null),[me,J]=(0,L.useState)(null),[Y,he]=(0,L.useState)(null),[ge,_e]=(0,L.useState)(null),X=(0,L.useRef)(null),be=(0,L.useRef)(null),Se=(0,L.useRef)(null);(0,L.useEffect)(()=>{if(!e)return;let t=()=>{let e,t;_e(n=>n&&(e=Math.max(280,Math.min(n.width,window.innerWidth-16)),t=Math.max(220,Math.min(n.height,window.innerHeight-16)),{width:e,height:t})),he(n=>{if(!n)return n;let r=et(n.x,n.y,e),i=U?X.current?.offsetHeight??0:t??X.current?.offsetHeight??0,a=Math.max(8,window.innerHeight-i-8);return{x:r.x,y:Math.min(r.y,a)}})};return window.addEventListener(`resize`,t),()=>window.removeEventListener(`resize`,t)},[U,e]);let[we,Z]=(0,L.useState)(!1),Te=(0,L.useRef)(!1);(0,L.useEffect)(()=>{if(e&&!Te.current){let e=o??g??null,t=Be(),n=e?x(e,m)?m:e.appearance:m;if(e){t[e.appearance]={...e.colors};for(let n of[`light`,`dark`]){let r=e.variants?.[n];r&&(t[n]={...r})}}A(o?.label??C??``),M(n),P(e!==null&&e.managed!==!0),se({light:!1,dark:!1}),le(e!==null&&e.managed!==!0),oe(t),q(null),J(null),pe(!1),H(null),Z(!0)}!e&&we&&Z(!1),Te.current=e},[o,m,we,e,C,g]);let Ee=y(k),De=k.trim().toLowerCase(),Q=De===``?null:ee().find(e=>e.id!==o?.id&&(e.id===Ee||e.label.trim().toLowerCase()===De))??null,Oe=Q?E(Q):[],ke=o?E(o):null,Ae=e=>ke&&!ke.includes(e)?`“${o?.label}” has no ${e} palette. Create a theme with the same name to add one.`:!T&&Oe.includes(e)?`“${Q?.label}” already has a ${e} palette.`:null,je=Q?.id??null,Ie=Oe.join(`,`);(0,L.useEffect)(()=>{if(T||je===null)return;let e=Ie.split(`,`).filter(Boolean);e.length===1&&M(t=>e.includes(t)?e[0]===`light`?`dark`:`light`:t)},[T,je,Ie]),(0,L.useEffect)(()=>{e&&we&&te(F[j],j)},[j,F,we,e]),(0,L.useEffect)(()=>{if(e)return()=>{w()}},[e,w]);let Le=(0,L.useCallback)((e,t)=>{oe(n=>{let r={...n[j],[e]:t},i=!N&&$.includes(e)&&Ve(t);return{...n,[j]:N?h(j,n[j],e,t):i?He(j,r):r}}),!N&&$.includes(e)&&Ve(t)&&se(e=>({...e,[j]:!0})),N&&le(!0)},[j,N]),ze=(0,L.useCallback)((e,t=!1)=>{let n=Re(e)?.role??e;q(n),$.includes(n)||(P(!0),fe(``)),t&&requestAnimationFrame(()=>{X.current?.querySelector(`[data-theme-color-role="${n}"]`)?.scrollIntoView({behavior:`smooth`,block:`nearest`})})},[]),Ue=(0,L.useCallback)(e=>{q(t=>t===e?null:e)},[]),We=(0,L.useCallback)(()=>{q(null),J(null),pe(!1)},[]),Ge=(K?N?Re(K)?.roles??[K]:$.includes(K)?S.filter(e=>F[j][e].trim().toLowerCase()===F[j][K].trim().toLowerCase()):[K]:[]).join(`,`);(0,L.useEffect)(()=>{if(ve(),!e||K===null){J(null);return}if(G)return;let t=Ge.split(`,`),n=()=>J(Ne(t));n();let r=null,i=null,a=performance.now(),o=()=>{if(r!==null||i!==null)return;let e=Math.max(0,500-(performance.now()-a)),t=()=>{r=null,i=null,a=performance.now(),n()};e===0?r=requestAnimationFrame(t):i=setTimeout(t,e)},s=new MutationObserver(e=>{e.every(e=>e.target instanceof Element&&(e.target.closest(`#theme-inspector-spotlight`)||e.target.closest(`[data-theme-editor-panel]`)))||o()});s.observe(document.body,{childList:!0,subtree:!0});let c=null,l=()=>{c??=requestAnimationFrame(()=>{c=null,Ce()})};return window.addEventListener(`resize`,l),window.addEventListener(`scroll`,l,!0),()=>{s.disconnect(),r!==null&&cancelAnimationFrame(r),i!==null&&clearTimeout(i),c!==null&&cancelAnimationFrame(c),window.removeEventListener(`resize`,l),window.removeEventListener(`scroll`,l,!0),ve()}},[G,e,Ge,K]),(0,L.useEffect)(()=>{if(!e||!G){ye();return}let t=!1,n=null,r=null,i=null,a=null,o=()=>{i!==null&&(window.clearTimeout(i),i=null)},s=()=>{o(),n=null,r=null,ye()},c=e=>{r=e,xe(e,Re(e.role)?.label??z(e.role))},l=e=>{let t=e.target;if(!(t instanceof Element)||t.closest(`[data-theme-editor-panel]`)){s();return}o(),n=t,r=null;let a=Me(t);if(a){c(a);return}ye(),i=window.setTimeout(()=>{if(i=null,n!==t||!t.isConnected)return;let e=Pe(t);e&&c(e)},140)},u=e=>{e.relatedTarget===null&&s()},d=e=>{let i=e.target;if(!(i instanceof Element)||i.closest(`[data-theme-editor-panel]`))return;e.preventDefault(),e.stopPropagation(),o();let a=n===i&&r?r:Pe(i);a&&(s(),ze(a.role,!0),t=!0)},f=e=>{let n=e.target;n instanceof Element&&!n.closest(`[data-theme-editor-panel]`)&&(e.preventDefault(),e.stopPropagation(),t&&pe(!1),t=!1)},p=e=>{e.key===`Escape`&&(e.preventDefault(),s(),We())},m=()=>{r&&(a??=requestAnimationFrame(()=>{a=null,r&&xe(r,Re(r.role)?.label??z(r.role))}))},h=()=>s();return document.addEventListener(`pointerover`,l,!0),document.addEventListener(`pointerout`,u,!0),document.addEventListener(`pointerdown`,d,!0),document.addEventListener(`click`,f,!0),document.addEventListener(`keydown`,p,!0),window.addEventListener(`resize`,m),window.addEventListener(`scroll`,h,!0),()=>{document.removeEventListener(`pointerover`,l,!0),document.removeEventListener(`pointerout`,u,!0),document.removeEventListener(`pointerdown`,d,!0),document.removeEventListener(`click`,f,!0),document.removeEventListener(`keydown`,p,!0),window.removeEventListener(`resize`,m),window.removeEventListener(`scroll`,h,!0),o(),a!==null&&cancelAnimationFrame(a),ye()}},[We,G,e,ze]);let Ke=(0,L.useCallback)(e=>{if(P(e),e||(K&&!$.includes(K)&&q(null),!ce))return;let t=o&&E(o).length>1?[`light`,`dark`]:[j];se(e=>{let n={...e};for(let e of t)n[e]=!0;return n}),oe(e=>{let n={...e};for(let r of t)n[r]=He(r,e[r]);return n}),le(!1)},[j,o,K,ce]),qe=()=>{if(!k.trim()){H(`Name your theme first.`);return}try{let e=N?F:{light:B.light?He(`light`,F.light):F.light,dark:B.dark?He(`dark`,F.dark):F.dark},r,i=null,a=null;if(o&&Q){let t=E(o),n=t.find(e=>Oe.includes(e));if(n){H(`“${Q.label}” already has a ${n} palette. Pick another name.`);return}i=t[0]??null,r=b({..._({version:1,id:Q.id,name:Q.label,appearance:Q.appearance,colors:Q.colors,variants:{...Q.variants,...Object.fromEntries(t.map(t=>[t,e[t]]))},...Q.managed===!0&&!N?{managed:!0}:{}}),...Q.collection?{collection:Q.collection}:{}}),a=o;try{p(o.id)}catch(e){try{b(Q)}catch{}throw e}}else if(o){let t=o.appearance,n=t===`light`?`dark`:`light`;r=b({..._({version:1,id:o.id,name:k,appearance:t,colors:e[t],...E(o).length>1?{variants:{[n]:e[n]}}:{},...N?{}:{managed:!0}}),...o.collection?{collection:o.collection}:{}})}else if(Q){if(Oe.includes(j)){H(`“${Q.label}” already has light and dark palettes. Pick another name.`);return}i=j,r=b({..._({version:1,id:Q.id,name:Q.label,appearance:Q.appearance,colors:Q.colors,variants:{...Q.variants,[j]:e[j]},...Q.managed===!0&&!N?{managed:!0}:{}}),...Q.collection?{collection:Q.collection}:{}})}else r=v(_({version:1,name:k,appearance:j,colors:e[j],...N?{}:{managed:!0}}));if(!n(r,{created:o===null&&i===null,...i?{mergedAppearance:i}:{}})){if(!o&&i===null)try{p(r.id)}catch{}else if(Q&&i!==null)try{b(Q),a&&v(a)}catch{}H(`Theme saved, but it could not be made active. Try again.`);return}t(!1)}catch(e){H(e instanceof Error?e.message:T?`Could not save the theme.`:`Could not create the theme.`)}},Je=()=>(0,R.jsxs)(`label`,{className:`grid grid-cols-[minmax(0,1fr)_minmax(0,2fr)] items-center gap-3`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium`,children:`Theme name`}),(0,R.jsx)(ae,{autoFocus:!0,size:`sm`,onChange:e=>{A(e.currentTarget.value),H(null)},placeholder:T?`Theme name`:`e.g. Aurora`,value:k})]}),Ye=e=>{let t=Ae(e),n=(0,R.jsx)(O,{"aria-disabled":t!==null,value:e,children:e===`light`?`Light`:`Dark`});return t===null?n:(0,R.jsxs)(ie,{children:[(0,R.jsx)(ne,{render:n}),(0,R.jsx)(re,{children:t})]})},Xe=()=>(0,R.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_minmax(0,2fr)] items-center gap-3`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium`,children:`Appearance`}),(0,R.jsxs)(D,{"aria-label":`Theme appearance`,variant:`segmented`,value:[j],onValueChange:e=>{let t=e[0];(t===`light`||t===`dark`)&&Ae(t)===null&&M(t)},children:[Ye(`light`),Ye(`dark`)]})]}),Ze=()=>(0,R.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_minmax(0,2fr)] items-start gap-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`text-sm font-medium`,children:`Colors`}),N?null:(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Two colors, rest derived`})]}),(0,R.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[N?(0,R.jsx)(ae,{"aria-label":`Filter colors`,className:`min-w-0 flex-1`,onChange:e=>fe(e.currentTarget.value),placeholder:`Filter colors`,size:`sm`,value:W}):null,(0,R.jsxs)(`label`,{className:`ml-auto flex shrink-0 cursor-pointer items-center gap-2 pt-0.5 text-sm font-medium`,children:[(0,R.jsx)(`span`,{children:`Advanced`}),(0,R.jsx)(I,{"aria-label":`Use advanced theme colors`,checked:N,onCheckedChange:e=>Ke(!!e)})]})]})]}),Qe=(e,t=`grid gap-2 sm:grid-cols-2`)=>(0,R.jsx)(`div`,{className:t,children:e.map(e=>(0,R.jsx)(ue,{label:e.label,onChange:Le,onSelect:ze,onToggleSelected:Ue,role:e.role,selected:K===e.role,value:F[j][e.role]},e.id))}),$e=()=>{let e=W.trim().toLowerCase(),t=Fe.map(t=>({...t,families:t.families.filter(t=>!e||[t.label,...t.roles.map(e=>z(e))].join(` `).toLowerCase().includes(e))})).filter(e=>e.families.length>0);return N?(0,R.jsxs)(`div`,{className:`space-y-5`,children:[t.map(e=>(0,R.jsxs)(`section`,{className:`space-y-2`,children:[(0,R.jsx)(`h4`,{className:`text-sm font-medium text-foreground`,children:e.title}),Qe(e.families,`grid gap-1`)]},e.id)),t.length===0?(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No matches.`}):null]}):(0,R.jsx)(`div`,{className:`grid gap-1`,children:$.map(e=>(0,R.jsx)(ue,{onChange:Le,onSelect:ze,onToggleSelected:Ue,role:e,label:e===`canvas`?`Background`:`Accent`,selected:K===e,value:F[j][e]},e))})},et=(e,t,n)=>{let r=X.current,i=n??r?.offsetWidth??0;return{x:Math.min(Math.max(e,8),Math.max(8,window.innerWidth-i-8)),y:Math.min(Math.max(t,8),Math.max(8,window.innerHeight-48))}},tt=e=>{if(e.target.closest(`button, input, a`))return;let t=X.current?.getBoundingClientRect();t&&(be.current={dx:e.clientX-t.x,dy:e.clientY-t.y},e.currentTarget.setPointerCapture(e.pointerId))},nt=e=>{let t=be.current;t&&he(et(e.clientX-t.dx,e.clientY-t.dy))},rt=()=>{be.current=null},it=e=>{let t=X.current?.getBoundingClientRect();t&&(e.preventDefault(),Y===null&&he(et(t.x,t.y)),Se.current={pointerX:e.clientX,pointerY:e.clientY,left:t.x,top:t.y,width:t.width,height:t.height},e.currentTarget.setPointerCapture(e.pointerId))},at=e=>{let t=Se.current;if(!t)return;let n=Math.max(280,window.innerWidth-8-t.left),r=Math.max(220,window.innerHeight-8-t.top);_e({width:Math.min(Math.max(t.width+e.clientX-t.pointerX,280),n),height:Math.min(Math.max(t.height+e.clientY-t.pointerY,220),r)})},ot=()=>{Se.current=null};return(0,R.jsxs)(`div`,{"aria-label":T?`Edit theme`:`Create theme`,className:c(`dialog-glass fixed z-[110] flex max-h-[min(42rem,calc(100dvh-6rem))] w-[min(26rem,calc(100vw-2rem))] flex-col overflow-hidden rounded-xl border text-popover-foreground`,Y===null&&`bottom-4 right-4`,U&&`max-h-none`),"data-theme-editor-panel":!0,ref:X,role:`dialog`,style:{...Y?{left:Y.x,top:Y.y}:{},...ge?{width:ge.width}:{},...ge&&!U?{height:ge.height,maxHeight:`calc(100dvh - 1rem)`}:{}},children:[(0,R.jsxs)(`div`,{className:`flex cursor-grab touch-none select-none items-center gap-1 border-b border-border/70 px-3 py-2 active:cursor-grabbing`,onPointerCancel:rt,onPointerDown:tt,onPointerMove:nt,onPointerUp:rt,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[(0,R.jsx)(`h2`,{className:`shrink-0 truncate text-sm font-medium`,children:T?`Edit theme`:`Create theme`}),U?null:(0,R.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:G?`Select an element · Esc to cancel`:K?`${N?Re(K)?.label??z(K):z(K)} · ${me??0} ${me===1?`use`:`uses`}`:`Select a color below`})]}),(0,R.jsxs)(ie,{children:[(0,R.jsx)(ne,{render:(0,R.jsxs)(s,{"aria-label":G?`Cancel inspecting app colors`:`Inspect app colors`,"aria-pressed":G,size:`xs`,variant:G?`secondary`:`ghost`,onClick:()=>{if(G){We();return}pe(!0)},children:[(0,R.jsx)(a,{}),G?`Cancel`:`Inspect`]})}),(0,R.jsx)(re,{"data-theme-editor-panel":``,children:G?`Cancel and clear the selection`:`Pick a color from the app`})]}),(0,R.jsx)(s,{"aria-label":U?`Expand the theme editor`:`Minimize the theme editor`,size:`icon-xs`,variant:`ghost`,onClick:()=>de(!U),children:(0,R.jsx)(d,{icon:U?f:u})}),(0,R.jsx)(s,{"aria-label":`Close the theme editor`,size:`icon-xs`,variant:`ghost`,onClick:()=>t(!1),children:(0,R.jsx)(i,{})})]}),U?null:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto py-3 pl-3 pr-1.5`,children:[Je(),V?(0,R.jsx)(`p`,{"aria-live":`polite`,className:`text-sm text-destructive`,children:V}):null,Xe(),(0,R.jsxs)(`div`,{className:`space-y-3`,children:[Ze(),$e()]})]}),(0,R.jsxs)(`div`,{className:`flex items-center justify-end gap-2 border-t border-border/70 px-3 py-2`,children:[(0,R.jsx)(s,{size:`sm`,variant:`ghost`,onClick:()=>t(!1),children:`Cancel`}),(0,R.jsx)(s,{disabled:!k.trim(),size:`sm`,onClick:qe,children:T?Q?`Merge into “${Q.label}”`:`Save changes`:Q?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(r,{}),`Add ${j} palette`]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(l,{}),`Create theme`]})})]}),(0,R.jsx)(`div`,{"aria-hidden":!0,className:`absolute bottom-0 right-0 z-10 flex size-5 cursor-se-resize touch-none select-none items-end justify-end p-1 text-muted-foreground/70`,onPointerCancel:ot,onPointerDown:it,onPointerMove:at,onPointerUp:ot,children:(0,R.jsx)(`svg`,{className:`size-2.5`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.2`,viewBox:`0 0 8 8`,children:(0,R.jsx)(`path`,{d:`M7 1 1 7M7 4.5 4.5 7`})})})]})]})}export{Ue as ThemeEditorPanel};
|
|
5
|
-
//# sourceMappingURL=ThemeEditorPanel-ezln4yFM.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{By as n,Cm as r,Cy as i,Dc as a,E_ as o,Es as s,Iy as c,NE as l,Pp as u,Um as d,Yo as f,__ as p,dm as m,jo as h,lE as g,sm as ee,sr as te,t as _,um as v,vm as y,xy as ne}from"./utils-ChK8VEFC.js";import{R as re,W as ie}from"./runtime-CvGlGrbH.js";import{f as ae,i as oe,m as se}from"./toast-CylvOlB4.js";import{J as b,s as ce}from"./useSettings-CHo-Nv-3.js";import{f as le}from"./server-h8-LTzsE.js";import{i as ue,n as de}from"./session-BnZv-sUV.js";import{t as fe}from"./use-atom-command-BZ0heqC5.js";import{l as x}from"./rightPanelStore-UcehuwgS.js";import{a as pe}from"./fileLinks-BVZWyXb4.js";import{n as me}from"./toastHelpers-Dsph6LwL.js";import{a as S,n as C,t as he}from"./tooltip-C85X81rS.js";import{t as ge}from"./observeResize-DnTxIA8M.js";import{S as _e,c as ve,d as w,n as T,s as E,x as ye}from"./browserHistoryStore-hEHIMltt.js";import{S as D,a as be,c as xe,d as Se,f as Ce,l as we,p as Te,u as Ee,x as O}from"./keybindings-DQLn36Qh.js";import{t as De}from"./preview-iwQ6KbXA.js";import{n as k,r as A}from"./browserLinkTarget-CdzL1FA-.js";import{i as Oe,o as j,t as ke}from"./popover-BJ6nvlLO.js";import{i as Ae,n as je,t as M}from"./terminal-links-DaTgSxq7.js";import{a as Me,i as Ne,o as N,t as P}from"./terminalSessions-BH4SsD0n.js";import{t as Pe}from"./terminalLabels-BgLOlb2G.js";import{Bi as Fe,Ki as Ie,Ui as F,la as Le,qi as Re}from"./main-D398MK8V.js";var I=e(t(),1),ze=l(),L=e(g(),1);function Be(e){let{bounds:t,selectionRect:n,pointer:r,viewport:i}=e,a=r??{x:n?.right??t.left+t.width-140,y:n?n.bottom+4:t.top+12};return{x:Math.max(8,Math.min(Math.max(t.left,a.x),t.left+t.width,i.width-8)),y:Math.max(8,Math.min(Math.max(t.top,a.y),t.top+t.height,i.height-8))}}function Ve({element:e,getActionElement:t,onSelection:n,onDismiss:r}){let i=e.ownerDocument,a=i.defaultView,o=!1,s=!1,c=!1,l=null,u=null,d=null,f=e=>e!==null&&(t?.()?.contains(e)??!1),p=()=>{u!==null&&a.clearTimeout(u),d!==null&&a.cancelAnimationFrame(d),u=d=null},m=()=>{p(),o=s=!1,l=null,c=!0},h=()=>{m(),r(`cancel`)},g=()=>{m(),r(`interaction`)},ee=e=>{p(),u=a.setTimeout(()=>{u=null,d=a.requestAnimationFrame(()=>{d=null,n(l)})},e)},te=n=>{if(!n.isPrimary)return;if(f(n.target)){m();return}p(),o=n.button===0;let i=e.contains(n.target);s=!1,c=!0,l=null,i?r(`interaction`):t?.()&&r(`cancel`)},_=e=>{e.isPrimary&&(e.target?.closest(`button, [role=button]`)||(s=e.button===0&&!e.defaultPrevented,c=!s))},v=e=>{e.isPrimary&&e.button===0&&(o=!1)},y=e=>{e.button===0&&(o=!1,s&&(s=!1,l={x:e.clientX,y:e.clientY},ee(e.detail>=2?500:0)))},ne=e=>{f(e.target)&&e.key!==`Escape`||(e.key===`Escape`?h():o||(p(),s=!1,l=null,c=!1))},re=e=>{f(e.target)?m():!o&&t?.()&&h()},ie=()=>{p(),o||(l=null,c=!0),r(`cancel`)};return i.addEventListener(`pointerdown`,te,!0),e.addEventListener(`pointerdown`,_),a.addEventListener(`pointerup`,v),a.addEventListener(`mouseup`,y),a.addEventListener(`pointercancel`,h),i.addEventListener(`keydown`,ne),i.addEventListener(`focusin`,re),e.addEventListener(`contextmenu`,g,!0),e.addEventListener(`scroll`,ie,!0),a.addEventListener(`blur`,h),a.addEventListener(`resize`,h),{get pending(){return u!==null||d!==null},cancel:m,selectionChanged(){f(i.activeElement)||(o||s?r(`cancel`):!c&&u===null&&d===null&&ee(0))},dispose(){m(),i.removeEventListener(`pointerdown`,te,!0),e.removeEventListener(`pointerdown`,_),a.removeEventListener(`pointerup`,v),a.removeEventListener(`mouseup`,y),a.removeEventListener(`pointercancel`,h),i.removeEventListener(`keydown`,ne),i.removeEventListener(`focusin`,re),e.removeEventListener(`contextmenu`,g,!0),e.removeEventListener(`scroll`,ie,!0),a.removeEventListener(`blur`,h),a.removeEventListener(`resize`,h)}}}var R=new Map(`Unidentified.Backquote.Backslash.BracketLeft.BracketRight.Comma.Digit0.Digit1.Digit2.Digit3.Digit4.Digit5.Digit6.Digit7.Digit8.Digit9.Equal.IntlBackslash.IntlRo.IntlYen.KeyA.KeyB.KeyC.KeyD.KeyE.KeyF.KeyG.KeyH.KeyI.KeyJ.KeyK.KeyL.KeyM.KeyN.KeyO.KeyP.KeyQ.KeyR.KeyS.KeyT.KeyU.KeyV.KeyW.KeyX.KeyY.KeyZ.Minus.Period.Quote.Semicolon.Slash.AltLeft.AltRight.Backspace.CapsLock.ContextMenu.ControlLeft.ControlRight.Enter.MetaLeft.MetaRight.ShiftLeft.ShiftRight.Space.Tab.Convert.KanaMode.NonConvert.Delete.End.Help.Home.Insert.PageDown.PageUp.ArrowDown.ArrowLeft.ArrowRight.ArrowUp.NumLock.Numpad0.Numpad1.Numpad2.Numpad3.Numpad4.Numpad5.Numpad6.Numpad7.Numpad8.Numpad9.NumpadAdd.NumpadBackspace.NumpadClear.NumpadClearEntry.NumpadComma.NumpadDecimal.NumpadDivide.NumpadEnter.NumpadEqual.NumpadMemoryAdd.NumpadMemoryClear.NumpadMemoryRecall.NumpadMemoryStore.NumpadMemorySubtract.NumpadMultiply.NumpadParenLeft.NumpadParenRight.NumpadSubtract.NumpadSeparator.NumpadArrowUp.NumpadArrowDown.NumpadArrowRight.NumpadArrowLeft.NumpadBegin.NumpadHome.NumpadEnd.NumpadInsert.NumpadDelete.NumpadPageUp.NumpadPageDown.Escape.F1.F2.F3.F4.F5.F6.F7.F8.F9.F10.F11.F12.F13.F14.F15.F16.F17.F18.F19.F20.F21.F22.F23.F24.F25.Fn.FnLock.PrintScreen.ScrollLock.Pause.BrowserBack.BrowserFavorites.BrowserForward.BrowserHome.BrowserRefresh.BrowserSearch.BrowserStop.Eject.LaunchApp1.LaunchApp2.LaunchMail.MediaPlayPause.MediaSelect.MediaStop.MediaTrackNext.MediaTrackPrevious.Power.Sleep.AudioVolumeDown.AudioVolumeMute.AudioVolumeUp.WakeUp.Copy.Cut.Paste`.split(`.`).map((e,t)=>[e,t]));function z(e){return R.get(e)??0}var He=new Map([[`!`,`1`],[`@`,`2`],[`#`,`3`],[`$`,`4`],[`%`,`5`],[`^`,`6`],[`&`,`7`],[`*`,`8`],[`(`,`9`],[`)`,`0`],[`~`,"`"],[`_`,`-`],[`+`,`=`],[`{`,`[`],[`}`,`]`],[`|`,`\\`],[`:`,`;`],[`"`,`'`],[`<`,`,`],[`>`,`.`],[`?`,`/`]]),Ue;function We(){if(Ue)return Ue;let e=(globalThis.navigator?.keyboard)?.getLayoutMap().catch(()=>void 0)??Promise.resolve(void 0);return Ue=e,e}function B(e){return!e.shiftKey||e.ctrlKey||e.altKey||e.metaKey?0:+([...e.key].length===1)}function V(e,t){if([...e.key].length!==1)return 0;let n=t?.get(e.code);if(n&&[...n].length===1)return n.codePointAt(0)??0;if(/^[A-Z]$/u.test(e.key))return e.key.charCodeAt(0)+32;if(e.shiftKey){let t=He.get(e.key);if(t)return t.codePointAt(0)??0;let n=e.key.toLowerCase();return n!==e.key&&[...n].length===1?n.codePointAt(0)??0:0}return e.key.codePointAt(0)??0}var H=`/assets/ghostty-vt-DdA0Zryv.wasm`,Ge=`/assets/ghostty-write-pty-hgyAvVbe.wasm`,U=new TextDecoder,Ke=class e{memory;layouts;exports;memoryView;ptyWriters=new Map;nextPtyWriterId=1;writePtyFunctionIndex=0;constructor(e){this.exports=e.exports;let t=e.exports.memory;if(!(t instanceof WebAssembly.Memory))throw Error(`libghostty-vt did not export WebAssembly memory`);this.memory=t,this.memoryView=new DataView(t.buffer);let n=this.call(`ghostty_type_json`),r=new Uint8Array(t.buffer),i=n;for(;i<r.length&&r[i]!==0;)i+=1;this.layouts=JSON.parse(U.decode(r.subarray(n,i)))}static async load(){let t=await fetch(H);if(!t.ok)throw Error(`Unable to load libghostty-vt (${t.status})`);let n,r=await WebAssembly.instantiate(await t.arrayBuffer(),{env:{log:(e,t)=>{if(!n)return;let r=n.exports.memory;if(!(r instanceof WebAssembly.Memory))return;let i=U.decode(new Uint8Array(r.buffer,e,t));console.debug(`[libghostty-vt]`,i)}}});n=r.instance;let i=new e(r.instance);return await i.installWritePtyTrampoline(),i}call(e,...t){let n=this.exports[e];if(typeof n!=`function`)throw Error(`libghostty-vt export is unavailable: ${e}`);return n(...t)}layout(e){let t=this.layouts[e];if(!t)throw Error(`libghostty-vt type layout is unavailable: ${e}`);return t}alloc(e){let t=this.call(`ghostty_wasm_alloc_u8_array`,e);if(t===0)throw Error(`libghostty-vt failed to allocate ${e} bytes`);return new Uint8Array(this.memory.buffer,t,e).fill(0),t}free(e,t){e!==0&&this.call(`ghostty_wasm_free_u8_array`,e,t)}allocOpaque(){let e=this.call(`ghostty_wasm_alloc_opaque`);if(e===0)throw Error(`libghostty-vt failed to allocate an opaque pointer`);return new DataView(this.memory.buffer).setUint32(e,0,!0),e}freeOpaque(e){e!==0&&this.call(`ghostty_wasm_free_opaque`,e)}readPointer(e){return this.memoryDataView().getUint32(e,!0)}attachPtyWriter(e,t){if(this.writePtyFunctionIndex===0)throw Error(`libghostty-vt PTY callback trampoline is unavailable`);let n=this.nextPtyWriterId++;return this.ptyWriters.set(n,t),this.call(`ghostty_terminal_set`,e,0,n),this.call(`ghostty_terminal_set`,e,1,this.writePtyFunctionIndex),n}detachPtyWriter(e,t){this.call(`ghostty_terminal_set`,e,1,0),this.call(`ghostty_terminal_set`,e,0,0),this.ptyWriters.delete(t)}view(e,t){return new DataView(this.memory.buffer,e,t)}bytes(e,t){return new Uint8Array(this.memory.buffer,e,t)}memoryDataView(){return this.memoryView.buffer!==this.memory.buffer&&(this.memoryView=new DataView(this.memory.buffer)),this.memoryView}setField(e,t,n,r){let i=this.layout(t).fields[n];if(!i)throw Error(`libghostty-vt field is unavailable: ${t}.${n}`);let a=this.memoryDataView(),o=e+i.offset;switch(i.type){case`bool`:case`u8`:a.setUint8(o,r);return;case`u16`:a.setUint16(o,r,!0);return;case`i32`:a.setInt32(o,r,!0);return;case`u32`:case`enum`:a.setUint32(o,r,!0);return;case`u64`:a.setBigUint64(o,BigInt(r),!0);return;default:throw Error(`Unsupported libghostty-vt field type: ${i.type}`)}}readField(e,t,n){let r=this.layout(t).fields[n];if(!r)throw Error(`libghostty-vt field is unavailable: ${t}.${n}`);let i=this.memoryDataView(),a=e+r.offset;switch(r.type){case`bool`:case`u8`:return i.getUint8(a);case`u16`:return i.getUint16(a,!0);case`i32`:return i.getInt32(a,!0);case`u32`:case`enum`:return i.getUint32(a,!0);case`u64`:return Number(i.getBigUint64(a,!0));default:throw Error(`Unsupported libghostty-vt field type: ${r.type}`)}}async installWritePtyTrampoline(){let e=await fetch(Ge);if(!e.ok)throw Error(`Unable to load the libghostty-vt PTY trampoline (${e.status})`);let t=(await WebAssembly.instantiate(await e.arrayBuffer(),{env:{t3_write_pty:(e,t,n,r)=>{let i=this.ptyWriters.get(t);i&&r!==0&&i(U.decode(new Uint8Array(this.memory.buffer,n,r)))}}})).instance.exports.ghostty_write_pty,n=this.exports.__indirect_function_table;if(typeof t!=`function`||!(n instanceof WebAssembly.Table))throw Error(`libghostty-vt did not expose its callback table`);let r=n.length;n.grow(1),n.set(r,t),this.writePtyFunctionIndex=r}},W=null;function G(){return W??=Ke.load().catch(e=>{throw W=null,e}),W}var K=0,qe=-3,Je=1e4,Ye=16,Xe=768,q={cols:1,rows:2,dirty:3,rowIterator:4,background:5,foreground:6,cursor:7,cursorHasValue:8,cursorStyle:10,cursorVisible:11,cursorBlinking:12,cursorInViewport:14,cursorX:15,cursorY:16},J={dirty:1,raw:2,cells:3},Y={raw:1,style:2,graphemesLength:3,graphemes:4,background:5,foreground:6,selected:7},X={keys:0,values:20,graphemesLength:40,selected:44,background:48,foreground:52,written:56,size:60},Ze={wide:3},Qe={narrow:0,wide:1,spacerTail:2,spacerHead:3},$e=new TextDecoder,et=new TextEncoder;function tt(e,t){let n=(e,t)=>Math.floor((e*155+t*100)/255);return{r:n(e.r,t.r),g:n(e.g,t.g),b:n(e.b,t.b)}}function nt(e,t){return e.r===t.r&&e.g===t.g&&e.b===t.b}function rt(e,t){if(t===1)return String.fromCodePoint(e.getUint32(0,!0));let n=4096,r=``;for(let i=0;i<t;i+=n){let a=Math.min(n,t-i),o=Array(a);for(let t=0;t<a;t+=1)o[t]=e.getUint32((i+t)*4,!0);r+=String.fromCodePoint(...o)}return r}var it=class e{runtime;terminalSlot=0;terminal=0;renderStateSlot=0;renderState=0;rowIteratorSlot=0;rowCellsSlot=0;keyEncoderSlot=0;keyEncoder=0;keyEventSlot=0;keyEvent=0;mouseEncoderSlot=0;mouseEncoder=0;mouseEventSlot=0;mouseEvent=0;ptyWriterId=0;ptyWriter=null;scratch=0;graphemes=0;graphemeCapacity=0;style=0;cellQuery=0;scrollbar=0;rows=[];disposed=!1;keyboardLayoutMap;constructor(e){this.runtime=e,We().then(e=>{this.disposed||(this.keyboardLayoutMap=e)})}static async create(t,n,r,i,a,o){let s=new e(await G());try{return s.initialize(t,n,r,i,a,o),s}catch(e){throw s.dispose(),e}}initialize(e,t,n,r,i,a){let o=this.runtime.layout(`GhosttyTerminalOptions`).size,s=this.runtime.alloc(o);this.runtime.setField(s,`GhosttyTerminalOptions`,`cols`,e),this.runtime.setField(s,`GhosttyTerminalOptions`,`rows`,t),this.runtime.setField(s,`GhosttyTerminalOptions`,`max_scrollback`,Je),this.terminalSlot=this.runtime.allocOpaque();let c=this.runtime.call(`ghostty_terminal_new`,0,this.terminalSlot,s);this.runtime.free(s,o),this.assertSuccess(`ghostty_terminal_new`,c),this.terminal=this.runtime.readPointer(this.terminalSlot),this.applyDefaultCursorBlink(),this.ptyWriter=a,this.ptyWriterId=this.runtime.attachPtyWriter(this.terminal,a),this.renderStateSlot=this.runtime.allocOpaque(),this.assertSuccess(`ghostty_render_state_new`,this.runtime.call(`ghostty_render_state_new`,0,this.renderStateSlot)),this.renderState=this.runtime.readPointer(this.renderStateSlot),this.rowIteratorSlot=this.runtime.allocOpaque(),this.assertSuccess(`ghostty_render_state_row_iterator_new`,this.runtime.call(`ghostty_render_state_row_iterator_new`,0,this.rowIteratorSlot)),this.rowCellsSlot=this.runtime.allocOpaque(),this.assertSuccess(`ghostty_render_state_row_cells_new`,this.runtime.call(`ghostty_render_state_row_cells_new`,0,this.rowCellsSlot)),this.keyEncoderSlot=this.runtime.allocOpaque(),this.assertSuccess(`ghostty_key_encoder_new`,this.runtime.call(`ghostty_key_encoder_new`,0,this.keyEncoderSlot)),this.keyEncoder=this.runtime.readPointer(this.keyEncoderSlot),this.keyEventSlot=this.runtime.allocOpaque(),this.assertSuccess(`ghostty_key_event_new`,this.runtime.call(`ghostty_key_event_new`,0,this.keyEventSlot)),this.keyEvent=this.runtime.readPointer(this.keyEventSlot),this.mouseEncoderSlot=this.runtime.allocOpaque(),this.assertSuccess(`ghostty_mouse_encoder_new`,this.runtime.call(`ghostty_mouse_encoder_new`,0,this.mouseEncoderSlot)),this.mouseEncoder=this.runtime.readPointer(this.mouseEncoderSlot),this.mouseEventSlot=this.runtime.allocOpaque(),this.assertSuccess(`ghostty_mouse_event_new`,this.runtime.call(`ghostty_mouse_event_new`,0,this.mouseEventSlot)),this.mouseEvent=this.runtime.readPointer(this.mouseEventSlot),this.scratch=this.runtime.alloc(16);let l=this.runtime.layout(`GhosttyStyle`).size;this.style=this.runtime.alloc(l),this.runtime.setField(this.style,`GhosttyStyle`,`size`,l),this.cellQuery=this.runtime.alloc(X.size);let u=this.runtime.memoryDataView(),d=[[Y.style,this.style],[Y.graphemesLength,this.cellQuery+X.graphemesLength],[Y.selected,this.cellQuery+X.selected],[Y.background,this.cellQuery+X.background],[Y.foreground,this.cellQuery+X.foreground]];for(let[e,[t,n]]of d.entries())u.setUint32(this.cellQuery+X.keys+e*4,t,!0),u.setUint32(this.cellQuery+X.values+e*4,n,!0);this.scrollbar=this.runtime.alloc(this.runtime.layout(`GhosttyTerminalScrollbar`).size),this.setTheme(i),this.resize(e,t,n,r)}write(e){this.ensureActive();let t=typeof e==`string`?et.encode(e):e;if(t.length===0)return;let n=this.runtime.alloc(t.length);this.runtime.bytes(n,t.length).set(t),this.runtime.call(`ghostty_terminal_vt_write`,this.terminal,n,t.length),this.runtime.free(n,t.length)}resetAndWrite(e){if(this.ensureActive(),this.runtime.call(`ghostty_terminal_reset`,this.terminal),this.applyDefaultCursorBlink(),this.rows=[],e.length===0)return;let t=this.ptyWriter;this.ptyWriterId!==0&&(this.runtime.detachPtyWriter(this.terminal,this.ptyWriterId),this.ptyWriterId=0);try{this.write(e)}finally{t!==null&&!this.disposed&&(this.ptyWriterId=this.runtime.attachPtyWriter(this.terminal,t))}}resize(e,t,n,r){this.ensureActive(),this.assertSuccess(`ghostty_terminal_resize`,this.runtime.call(`ghostty_terminal_resize`,this.terminal,Math.max(1,Math.min(65535,e)),Math.max(1,Math.min(65535,t)),Math.max(1,Math.round(n)),Math.max(1,Math.round(r))))}applyDefaultCursorBlink(){let e=this.runtime.alloc(1);this.runtime.bytes(e,1)[0]=1,this.runtime.call(`ghostty_terminal_set`,this.terminal,23,e),this.runtime.free(e,1)}setTheme(e){this.ensureActive();let t=this.runtime.alloc(3);for(let[n,r]of[[11,e.foreground],[12,e.background],[13,e.cursor]])this.runtime.bytes(t,3).set([r.r,r.g,r.b]),this.runtime.call(`ghostty_terminal_set`,this.terminal,n,t);this.runtime.free(t,3),e.palette&&this.setPalette(e.palette)}setPalette(e){let t=this.runtime.alloc(Xe);this.runtime.call(`ghostty_terminal_get`,this.terminal,25,t);let n=this.runtime.bytes(t,Xe);e.slice(0,16).forEach((e,t)=>{n.set([e.r,e.g,e.b],t*3)}),this.runtime.call(`ghostty_terminal_set`,this.terminal,14,t),this.runtime.free(t,Xe)}scroll(e){this.ensureActive();let t=this.runtime.layout(`GhosttyTerminalScrollViewport`),n=this.runtime.alloc(t.size);this.runtime.setField(n,`GhosttyTerminalScrollViewport`,`tag`,2);let r=t.fields.value;this.runtime.view(n+r.offset,r.size).setInt32(0,e,!0),this.runtime.call(`ghostty_terminal_scroll_viewport`,this.terminal,n),this.runtime.free(n,t.size)}scrollToBottom(){this.ensureActive();let e=this.runtime.layout(`GhosttyTerminalScrollViewport`),t=this.runtime.alloc(e.size);this.runtime.setField(t,`GhosttyTerminalScrollViewport`,`tag`,1),this.runtime.call(`ghostty_terminal_scroll_viewport`,this.terminal,t),this.runtime.free(t,e.size)}isViewportActive(){return this.ensureActive(),this.runtime.bytes(this.scratch,1)[0]=0,this.runtime.call(`ghostty_terminal_get`,this.terminal,32,this.scratch)===K&&this.runtime.bytes(this.scratch,1)[0]!==0}scrollbarState(){this.ensureActive();let e=this.runtime.layout(`GhosttyTerminalScrollbar`);return this.runtime.bytes(this.scrollbar,e.size).fill(0),this.runtime.call(`ghostty_terminal_get`,this.terminal,9,this.scrollbar)===K?{total:this.runtime.readField(this.scrollbar,`GhosttyTerminalScrollbar`,`total`),offset:this.runtime.readField(this.scrollbar,`GhosttyTerminalScrollbar`,`offset`),len:this.runtime.readField(this.scrollbar,`GhosttyTerminalScrollbar`,`len`)}:null}isMouseTracking(){return this.ensureActive(),this.runtime.bytes(this.scratch,1)[0]=0,this.runtime.call(`ghostty_terminal_get`,this.terminal,11,this.scratch)===K&&this.runtime.bytes(this.scratch,1)[0]!==0}isMouseAnyEventTracking(){return this.ensureActive(),this.runtime.bytes(this.scratch,1)[0]=0,this.runtime.call(`ghostty_terminal_mode_get`,this.terminal,1003,this.scratch)===K&&this.runtime.bytes(this.scratch,1)[0]!==0}isAlternateScreen(){return this.ensureActive(),this.runtime.bytes(this.scratch,4).fill(0),this.runtime.call(`ghostty_terminal_get`,this.terminal,6,this.scratch)===K&&this.runtime.view(this.scratch,4).getUint32(0,!0)===1}isApplicationCursorKeys(){return this.ensureActive(),this.runtime.bytes(this.scratch,1)[0]=0,this.runtime.call(`ghostty_terminal_mode_get`,this.terminal,1,this.scratch)===K&&this.runtime.bytes(this.scratch,1)[0]!==0}encodeKey(e,t=`press`){this.ensureActive(),this.runtime.call(`ghostty_key_encoder_setopt_from_terminal`,this.keyEncoder,this.terminal),this.runtime.call(`ghostty_key_event_set_action`,this.keyEvent,t===`release`?0:e.repeat?2:1),this.runtime.call(`ghostty_key_event_set_key`,this.keyEvent,z(e.code));let n=+!!e.shiftKey|(e.ctrlKey?2:0)|(e.altKey?4:0)|(e.metaKey?8:0)|(e.getModifierState(`CapsLock`)?16:0)|(e.getModifierState(`NumLock`)?32:0);this.runtime.call(`ghostty_key_event_set_mods`,this.keyEvent,n),this.runtime.call(`ghostty_key_event_set_consumed_mods`,this.keyEvent,B(e)),this.runtime.call(`ghostty_key_event_set_composing`,this.keyEvent,+!!e.isComposing),this.runtime.call(`ghostty_key_event_set_unshifted_codepoint`,this.keyEvent,V(e,this.keyboardLayoutMap));let r=e.key.length===1?e.key:``,i=et.encode(r),a=i.length===0?0:this.runtime.alloc(i.length);a!==0&&this.runtime.bytes(a,i.length).set(i),this.runtime.call(`ghostty_key_event_set_utf8`,this.keyEvent,a,i.length);let o=this.runtime.call(`ghostty_wasm_alloc_usize`),s=this.encodeOutput(o,(e,t)=>this.runtime.call(`ghostty_key_encoder_encode`,this.keyEncoder,this.keyEvent,e,t,o));return this.runtime.call(`ghostty_wasm_free_usize`,o),a!==0&&this.runtime.free(a,i.length),s}encodePaste(e){this.ensureActive();let t=et.encode(e);if(t.length===0)return``;let n=this.runtime.alloc(t.length);this.runtime.bytes(n,t.length).set(t),this.runtime.bytes(this.scratch,1)[0]=0;let r=this.runtime.call(`ghostty_terminal_mode_get`,this.terminal,2004,this.scratch)===K&&this.runtime.bytes(this.scratch,1)[0]!==0,i=this.runtime.call(`ghostty_wasm_alloc_usize`),a=``,o=this.runtime.call(`ghostty_paste_encode`,n,t.length,+!!r,0,0,i),s=this.runtime.view(i,4).getUint32(0,!0);if(o===qe&&s>0){let e=this.runtime.alloc(s),o=this.runtime.call(`ghostty_paste_encode`,n,t.length,+!!r,e,s,i),c=this.runtime.view(i,4).getUint32(0,!0);a=o===K?$e.decode(this.runtime.bytes(e,c)):``,this.runtime.free(e,s)}return this.runtime.call(`ghostty_wasm_free_usize`,i),this.runtime.free(n,t.length),a}encodeMouse(e){this.ensureActive(),this.runtime.call(`ghostty_mouse_encoder_setopt_from_terminal`,this.mouseEncoder,this.terminal);let t=this.runtime.layout(`GhosttyMouseEncoderSize`),n=this.runtime.alloc(t.size);for(let[r,i]of[[`size`,t.size],[`screen_width`,e.screenWidth],[`screen_height`,e.screenHeight],[`cell_width`,e.cellWidth],[`cell_height`,e.cellHeight],[`padding_top`,e.paddingTop],[`padding_bottom`,e.paddingBottom],[`padding_right`,e.paddingRight],[`padding_left`,e.paddingLeft]])this.runtime.setField(n,`GhosttyMouseEncoderSize`,r,Math.max(0,Math.round(i)));this.runtime.call(`ghostty_mouse_encoder_setopt`,this.mouseEncoder,2,n),this.runtime.free(n,t.size),this.runtime.bytes(this.scratch,1)[0]=+!!e.anyButtonPressed,this.runtime.call(`ghostty_mouse_encoder_setopt`,this.mouseEncoder,3,this.scratch),this.runtime.bytes(this.scratch,1)[0]=1,this.runtime.call(`ghostty_mouse_encoder_setopt`,this.mouseEncoder,4,this.scratch),this.runtime.call(`ghostty_mouse_event_set_action`,this.mouseEvent,e.action===`press`?0:e.action===`release`?1:2),e.button===null?this.runtime.call(`ghostty_mouse_event_clear_button`,this.mouseEvent):this.runtime.call(`ghostty_mouse_event_set_button`,this.mouseEvent,e.button),this.runtime.call(`ghostty_mouse_event_set_mods`,this.mouseEvent,e.mods);let r=this.runtime.layout(`GhosttyMousePosition`),i=this.runtime.alloc(r.size),a=this.runtime.view(i,r.size);a.setFloat32(r.fields.x.offset,e.x,!0),a.setFloat32(r.fields.y.offset,e.y,!0),this.runtime.call(`ghostty_mouse_event_set_position`,this.mouseEvent,i),this.runtime.free(i,r.size);let o=this.runtime.call(`ghostty_wasm_alloc_usize`),s=this.encodeOutput(o,(e,t)=>this.runtime.call(`ghostty_mouse_encoder_encode`,this.mouseEncoder,this.mouseEvent,e,t,o));return this.runtime.call(`ghostty_wasm_free_usize`,o),s}setSelection(e,t){this.ensureActive();let n=this.runtime.layout(`GhosttySelection`),r=this.runtime.layout(`GhosttyGridRef`).size,i=this.runtime.alloc(n.size),a=0,o=0;try{this.runtime.setField(i,`GhosttySelection`,`size`,n.size),a=this.gridRef(e.x,e.y,e.tag??1),o=this.gridRef(t.x,t.y,t.tag??1);let r=n.fields.start,s=n.fields.end;this.runtime.bytes(i+r.offset,r.size).set(this.runtime.bytes(a,r.size)),this.runtime.bytes(i+s.offset,s.size).set(this.runtime.bytes(o,s.size)),this.runtime.call(`ghostty_terminal_set`,this.terminal,21,i)}finally{this.runtime.free(a,r),this.runtime.free(o,r),this.runtime.free(i,n.size)}}selectAll(){this.ensureActive();let e=this.runtime.layout(`GhosttySelection`),t=this.runtime.alloc(e.size);try{if(this.runtime.setField(t,`GhosttySelection`,`size`,e.size),this.runtime.call(`ghostty_terminal_select_all`,this.terminal,t)!==K)return null;let n=this.pointFromGridRef(t+e.fields.start.offset,2),r=this.pointFromGridRef(t+e.fields.end.offset,2);return!n||!r?null:(this.runtime.call(`ghostty_terminal_set`,this.terminal,21,t),{start:n,end:r})}finally{this.runtime.free(t,e.size)}}selectWord(e,t){return this.selectAt(`GhosttyTerminalSelectWordOptions`,`ghostty_terminal_select_word`,e,t)}selectLine(e,t){return this.selectAt(`GhosttyTerminalSelectLineOptions`,`ghostty_terminal_select_line`,e,t)}hyperlinkAt(e,t){this.ensureActive();let n=this.gridRef(e,t),r=this.runtime.call(`ghostty_wasm_alloc_usize`),i=this.runtime.call(`ghostty_grid_ref_hyperlink_uri`,n,0,0,r),a=this.runtime.view(r,4).getUint32(0,!0),o=null;if(i===qe&&a>0){let e=this.runtime.alloc(a),t=this.runtime.call(`ghostty_grid_ref_hyperlink_uri`,n,e,a,r),i=this.runtime.view(r,4).getUint32(0,!0);t===K&&i>0&&(o=$e.decode(this.runtime.bytes(e,i))),this.runtime.free(e,a)}return this.runtime.call(`ghostty_wasm_free_usize`,r),this.runtime.free(n,this.runtime.layout(`GhosttyGridRef`).size),o}clearSelection(){this.ensureActive(),this.runtime.call(`ghostty_terminal_set`,this.terminal,21,0)}snapshot(){this.ensureActive(),this.assertSuccess(`ghostty_render_state_update`,this.runtime.call(`ghostty_render_state_update`,this.renderState,this.terminal));let e=this.getU16(q.cols),t=this.getU16(q.rows),n=this.getU32(q.dirty),r=this.getColor(q.foreground,{r:229,g:231,b:235}),i=this.getColor(q.background,{r:0,g:0,b:0}),a=this.getBool(q.cursorHasValue)?this.getColor(q.cursor,r):r,o=this.getBool(q.cursorInViewport),s=this.getBool(q.cursorVisible)&&o,c=o?this.getU16(q.cursorX):-1,l=o?this.getU16(q.cursorY):-1;(this.rows.length!==t||this.rows.some(t=>t.cells.length!==e))&&(this.rows=Array.from({length:t},()=>({cells:Array.from({length:e},()=>this.emptyCell(r,i)),text:``,isWrapContinuation:!1,wrapsToNext:!1})));let u=new Set;if(n!==0){this.assertSuccess(`ghostty_render_state_get(row iterator)`,this.runtime.call(`ghostty_render_state_get`,this.renderState,q.rowIterator,this.rowIteratorSlot));let a=this.runtime.readPointer(this.rowIteratorSlot),o=0;for(;o<t&&this.runtime.call(`ghostty_render_state_row_iterator_next`,a)!==0;)(n===2||this.getRowBool(a,J.dirty))&&(this.rows[o]=this.readRow(a,e,r,i),u.add(o),this.runtime.bytes(this.scratch,1)[0]=0,this.runtime.call(`ghostty_render_state_row_set`,a,0,this.scratch)),o+=1;this.runtime.view(this.scratch,4).setUint32(0,0,!0),this.runtime.call(`ghostty_render_state_set`,this.renderState,0,this.scratch)}return{cols:e,rows:t,foreground:r,background:i,cursor:a,cursorX:c,cursorY:l,cursorVisible:s,cursorBlinking:this.getBool(q.cursorBlinking),cursorStyle:this.getU32(q.cursorStyle),dirtyRows:u,rowData:this.rows}}selectionText(){this.ensureActive();let e=this.runtime.alloc(Ye),t=this.runtime.view(e,Ye);t.setUint32(0,Ye,!0),t.setUint32(4,0,!0),t.setUint8(8,1),t.setUint8(9,1),t.setUint32(12,0,!0);let n=this.runtime.call(`ghostty_wasm_alloc_usize`),r=this.runtime.call(`ghostty_terminal_selection_format_buf`,this.terminal,e,0,0,n),i=this.runtime.view(n,4).getUint32(0,!0),a=``;if(r===qe&&i>0){let t=this.runtime.alloc(i),r=this.runtime.call(`ghostty_terminal_selection_format_buf`,this.terminal,e,t,i,n),o=this.runtime.view(n,4).getUint32(0,!0);r===K&&(a=$e.decode(this.runtime.bytes(t,o))),this.runtime.free(t,i)}return this.runtime.call(`ghostty_wasm_free_usize`,n),this.runtime.free(e,Ye),a}viewportPointToScreen(e,t){return this.convertPoint(e,t,1,2)}screenPointToViewport(e,t){return this.convertPoint(e,t,2,1)}convertPoint(e,t,n,r){this.ensureActive();let i=this.gridRef(e,t,n),a=this.pointFromGridRef(i,r);return this.runtime.free(i,this.runtime.layout(`GhosttyGridRef`).size),a}dispose(){if(!this.disposed){if(this.disposed=!0,this.mouseEvent&&this.runtime.call(`ghostty_mouse_event_free`,this.mouseEvent),this.mouseEncoder&&this.runtime.call(`ghostty_mouse_encoder_free`,this.mouseEncoder),this.keyEvent&&this.runtime.call(`ghostty_key_event_free`,this.keyEvent),this.keyEncoder&&this.runtime.call(`ghostty_key_encoder_free`,this.keyEncoder),this.rowCellsSlot){let e=this.runtime.readPointer(this.rowCellsSlot);e&&this.runtime.call(`ghostty_render_state_row_cells_free`,e)}if(this.rowIteratorSlot){let e=this.runtime.readPointer(this.rowIteratorSlot);e&&this.runtime.call(`ghostty_render_state_row_iterator_free`,e)}this.renderState&&this.runtime.call(`ghostty_render_state_free`,this.renderState),this.terminal&&(this.ptyWriterId&&this.runtime.detachPtyWriter(this.terminal,this.ptyWriterId),this.runtime.call(`ghostty_terminal_free`,this.terminal)),this.style&&this.runtime.free(this.style,this.runtime.layout(`GhosttyStyle`).size),this.cellQuery&&this.runtime.free(this.cellQuery,X.size),this.scrollbar&&this.runtime.free(this.scrollbar,this.runtime.layout(`GhosttyTerminalScrollbar`).size),this.scratch&&this.runtime.free(this.scratch,16),this.graphemes&&this.runtime.free(this.graphemes,this.graphemeCapacity);for(let e of[this.mouseEventSlot,this.mouseEncoderSlot,this.keyEventSlot,this.keyEncoderSlot,this.rowCellsSlot,this.rowIteratorSlot,this.renderStateSlot,this.terminalSlot])this.runtime.freeOpaque(e)}}encodeOutput(e,t){let n=t(0,0),r=this.runtime.view(e,4).getUint32(0,!0);if(n===K&&r===0||n!==qe||r===0)return``;let i=this.runtime.alloc(r),a=t(i,r),o=this.runtime.view(e,4).getUint32(0,!0),s=a===K?$e.decode(this.runtime.bytes(i,o)):``;return this.runtime.free(i,r),s}readRow(e,t,n,r){this.assertSuccess(`ghostty_render_state_row_get(raw)`,this.runtime.call(`ghostty_render_state_row_get`,e,J.raw,this.scratch));let i=this.runtime.view(this.scratch,8).getBigUint64(0,!0);this.runtime.bytes(this.scratch+8,1)[0]=0,this.assertSuccess(`ghostty_row_get(wrap continuation)`,this.runtime.call(`ghostty_row_get`,i,2,this.scratch+8));let a=this.runtime.bytes(this.scratch+8,1)[0]!==0;this.runtime.bytes(this.scratch+8,1)[0]=0,this.assertSuccess(`ghostty_row_get(wrap)`,this.runtime.call(`ghostty_row_get`,i,1,this.scratch+8));let o=this.runtime.bytes(this.scratch+8,1)[0]!==0;this.assertSuccess(`ghostty_render_state_row_get(cells)`,this.runtime.call(`ghostty_render_state_row_get`,e,J.cells,this.rowCellsSlot));let s=this.runtime.readPointer(this.rowCellsSlot),{size:c,fields:l}=this.runtime.layout(`GhosttyStyle`),u=[];for(;u.length<t&&this.runtime.call(`ghostty_render_state_row_cells_next`,s)!==0;){this.runtime.bytes(this.style,c).fill(0),this.runtime.setField(this.style,`GhosttyStyle`,`size`,c);let e=this.runtime.call(`ghostty_render_state_row_cells_get_multi`,s,5,this.cellQuery+X.keys,this.cellQuery+X.values,this.cellQuery+X.written),t=this.runtime.memoryDataView(),i=t.getUint32(this.cellQuery+X.written,!0);i<3&&this.assertSuccess(`ghostty_render_state_row_cells_get_multi`,e);let a=t.getUint32(this.cellQuery+X.graphemesLength,!0),o=t.getUint8(this.cellQuery+X.selected)!==0,d=i>=4?this.readColor(this.cellQuery+X.background):r,f=i===5?this.readColor(this.cellQuery+X.foreground):i===3?this.getCellColor(s,Y.foreground,n):n,p=``;if(a>0){let e=a*4;if(e>this.graphemeCapacity){let t=Math.max(e,this.graphemeCapacity*2),n=this.runtime.alloc(t);this.runtime.free(this.graphemes,this.graphemeCapacity),this.graphemes=n,this.graphemeCapacity=t}this.runtime.call(`ghostty_render_state_row_cells_get`,s,Y.graphemes,this.graphemes)===K&&(p=rt(this.runtime.view(this.graphemes,e),a))}let m=0;if(p.length===0&&u.at(-1)?.text.length){this.assertSuccess(`ghostty_render_state_row_cells_get(raw)`,this.runtime.call(`ghostty_render_state_row_cells_get`,s,Y.raw,this.scratch));let e=this.runtime.view(this.scratch,8).getBigUint64(0,!0);this.runtime.view(this.scratch+8,4).setUint32(0,0,!0),this.assertSuccess(`ghostty_cell_get(wide)`,this.runtime.call(`ghostty_cell_get`,e,Ze.wide,this.scratch+8)),m=this.runtime.view(this.scratch+8,4).getUint32(0,!0)}let h=this.runtime.memoryDataView();h.getUint8(this.style+l.inverse.offset)!==0&&([f,d]=[d,f]),h.getUint8(this.style+l.faint.offset)!==0&&(f=tt(f,d)),u.push({text:p,wide:m,foreground:f,background:d,bold:h.getUint8(this.style+l.bold.offset)!==0,italic:h.getUint8(this.style+l.italic.offset)!==0,invisible:h.getUint8(this.style+l.invisible.offset)!==0,strikethrough:h.getUint8(this.style+l.strikethrough.offset)!==0,overline:h.getUint8(this.style+l.overline.offset)!==0,underline:h.getInt32(this.style+l.underline.offset,!0)!==0,selected:o})}for(;u.length<t;)u.push(this.emptyCell(n,r));return{cells:u,text:u.map(e=>e.text||` `).join(``).trimEnd(),isWrapContinuation:a,wrapsToNext:o}}gridRef(e,t,n=1){let r=this.runtime.layout(`GhosttyPoint`),i=this.runtime.alloc(r.size);this.runtime.setField(i,`GhosttyPoint`,`tag`,n);let a=r.fields.value,o=a.offset,s=this.runtime.view(i+o,a.size);s.setUint16(0,Math.max(0,e),!0),s.setUint32(4,Math.max(0,t),!0);let c=this.runtime.layout(`GhosttyGridRef`).size,l=this.runtime.alloc(c);this.runtime.setField(l,`GhosttyGridRef`,`size`,c);let u=this.runtime.call(`ghostty_terminal_grid_ref`,this.terminal,i,l);return this.runtime.free(i,r.size),u!==K&&(this.runtime.free(l,c),this.assertSuccess(`ghostty_terminal_grid_ref`,u)),l}selectAt(e,t,n,r){this.ensureActive();let i=this.runtime.layout(e),a=this.runtime.layout(`GhosttySelection`),o=this.runtime.alloc(i.size),s=0,c=0,l=null;try{this.runtime.setField(o,e,`size`,i.size),s=this.gridRef(n,r);let u=i.fields.ref;if(this.runtime.bytes(o+u.offset,u.size).set(this.runtime.bytes(s,u.size)),c=this.runtime.alloc(a.size),this.runtime.setField(c,`GhosttySelection`,`size`,a.size),this.runtime.call(t,this.terminal,o,c)===K){let e=c+a.fields.start.offset,t=c+a.fields.end.offset,n=this.pointFromGridRef(e,1),r=this.pointFromGridRef(t,1),i=this.pointFromGridRef(e,2),o=this.pointFromGridRef(t,2);n&&r&&i&&o&&(l={viewport:{start:n,end:r},screen:{start:i,end:o}}),this.runtime.call(`ghostty_terminal_set`,this.terminal,21,c)}}finally{this.runtime.free(c,a.size),this.runtime.free(s,this.runtime.layout(`GhosttyGridRef`).size),this.runtime.free(o,i.size)}return l}pointFromGridRef(e,t){let n=this.runtime.layout(`GhosttyPointCoordinate`),r=this.runtime.alloc(n.size),i=this.runtime.call(`ghostty_terminal_point_from_grid_ref`,this.terminal,e,t,r)===K?{x:this.runtime.readField(r,`GhosttyPointCoordinate`,`x`),y:this.runtime.readField(r,`GhosttyPointCoordinate`,`y`)}:null;return this.runtime.free(r,n.size),i}getU16(e){return this.runtime.bytes(this.scratch,2).fill(0),this.assertSuccess(`ghostty_render_state_get`,this.runtime.call(`ghostty_render_state_get`,this.renderState,e,this.scratch)),this.runtime.view(this.scratch,2).getUint16(0,!0)}getU32(e){return this.runtime.bytes(this.scratch,4).fill(0),this.assertSuccess(`ghostty_render_state_get`,this.runtime.call(`ghostty_render_state_get`,this.renderState,e,this.scratch)),this.runtime.view(this.scratch,4).getUint32(0,!0)}getBool(e){return this.runtime.bytes(this.scratch,1)[0]=0,this.assertSuccess(`ghostty_render_state_get`,this.runtime.call(`ghostty_render_state_get`,this.renderState,e,this.scratch)),this.runtime.bytes(this.scratch,1)[0]!==0}getColor(e,t){return this.runtime.bytes(this.scratch,3).fill(0),this.runtime.call(`ghostty_render_state_get`,this.renderState,e,this.scratch)===K?this.readColor(this.scratch):t}getRowBool(e,t){return this.runtime.bytes(this.scratch,1)[0]=0,this.runtime.call(`ghostty_render_state_row_get`,e,t,this.scratch)===K&&this.runtime.bytes(this.scratch,1)[0]!==0}getCellColor(e,t,n){return this.runtime.bytes(this.scratch,3).fill(0),this.runtime.call(`ghostty_render_state_row_cells_get`,e,t,this.scratch)===K?this.readColor(this.scratch):n}readColor(e){let t=this.runtime.memoryDataView();return{r:t.getUint8(e),g:t.getUint8(e+1),b:t.getUint8(e+2)}}emptyCell(e,t){return{text:``,wide:0,foreground:e,background:t,bold:!1,italic:!1,invisible:!1,strikethrough:!1,overline:!1,underline:!1,selected:!1}}assertSuccess(e,t){if(t!==K)throw Error(`${e} failed with result ${t}`)}ensureActive(){if(this.disposed)throw Error(`libghostty-vt terminal has been disposed`)}};function at(e,t){return nt(e,t)}var ot=`rgba(72, 122, 191, 0.35)`;function Z(e){return`rgb(${e.r}, ${e.g}, ${e.b})`}function st(e,t){return at(e.foreground,t.foreground)&&e.bold===t.bold&&e.italic===t.italic&&e.invisible===t.invisible}function ct(e,t,n){let r=t+1;for(;r<e.length;){let t=e[r];if(!t)break;if(t.wide===Qe.spacerTail){r+=1;continue}if(t.text.length===0||!n(t))break;r+=1}return r}function lt(e,t,n){return`${e.italic?`italic`:`normal`} ${e.bold?`700`:`400`} ${t}px ${n}`}function ut(e,t,n){e.font=`normal 400 ${t}px ${n}`;let r=e.measureText(`M`),i=e.measureText(`Mg`),a=i.actualBoundingBoxAscent||t,o=a+i.actualBoundingBoxDescent,s=Math.max(1,Math.round(t*1.35),Math.ceil(o));return{width:Math.max(1,r.width),height:s,baseline:Math.round((s-o)/2+a)}}function Q(e,t,n,r){return{cols:Math.max(1,Math.floor((e-r*2)/n.width)),rows:Math.max(1,Math.floor((t-r*2)/n.height))}}function dt(e){let{context:t,snapshot:n,metrics:r,fontSize:i,fontFamily:a,padding:o,forceFull:s,cursorOn:c,previousCursorY:l}=e,u=e.focused??!0,d=e.selectionBackground??ot,f=e.hoveredLinkRange??null,p=e.originY??o,m=s?Array.from({length:n.rows},(e,t)=>t):[...n.dirtyRows];l!=null&&l>=0&&!m.includes(l)&&m.push(l),n.cursorVisible&&n.cursorY>=0&&!m.includes(n.cursorY)&&m.push(n.cursorY),s&&(t.save(),t.resetTransform(),t.fillStyle=Z(n.background),t.fillRect(0,0,t.canvas.width,t.canvas.height),t.restore()),t.textBaseline=`alphabetic`;for(let e of m){let s=n.rowData[e];if(!s)continue;let c=p+e*r.height;t.fillStyle=Z(n.background),t.fillRect(o,c,n.cols*r.width,r.height);let l=0;for(;l<s.cells.length;){let e=s.cells[l];if(!e)break;let i=l+1;for(;i<s.cells.length;){let t=s.cells[i];if(!t||t.selected!==e.selected||!at(t.background,e.background))break;i+=1}if(e.selected||!at(e.background,n.background)){let a=o+l*r.width,s=(i-l)*r.width;at(e.background,n.background)||(t.fillStyle=Z(e.background),t.fillRect(a,c,s,r.height)),e.selected&&(t.fillStyle=d,t.fillRect(a,c,s,r.height))}l=i}let u=0;for(;u<s.cells.length;){let e=s.cells[u];if(!e)break;if(e.text.length===0){u+=1;continue}let n=ct(s.cells,u,t=>st(t,e)),l=s.cells.slice(u,n).map(e=>e.text).join(``);!e.invisible&&l.trim().length>0&&(t.save(),t.beginPath(),t.rect(o+u*r.width,c,(n-u)*r.width,r.height),t.clip(),t.font=lt(e,i,a),t.fillStyle=Z(e.foreground),t.fillText(l,o+u*r.width,c+r.baseline,(n-u)*r.width),t.restore()),u=n}for(let n=0;n<s.cells.length;n+=1){let i=s.cells[n],a=f!==null&&e>=f.start.y&&e<=f.end.y&&(e>f.start.y||n>=f.start.x)&&(e<f.end.y||n<=f.end.x);if(!i||!i.underline&&!i.strikethrough&&!i.overline&&!a)continue;t.fillStyle=Z(i.foreground);let l=o+n*r.width;(i.underline||a)&&t.fillRect(l,c+r.height-2,r.width,1),i.strikethrough&&t.fillRect(l,c+Math.floor(r.height*.55),r.width,1),i.overline&&t.fillRect(l,c+1,r.width,1)}}if(c&&n.cursorVisible&&n.cursorX>=0&&n.cursorY>=0){let e=o+n.cursorX*r.width,s=p+n.cursorY*r.height;if(t.fillStyle=Z(n.cursor),!u)t.strokeStyle=Z(n.cursor),t.strokeRect(e+.5,s+.5,r.width-1,r.height-1);else if(n.cursorStyle===0)t.fillRect(e,s,2,r.height);else if(n.cursorStyle===2)t.fillRect(e,s+r.height-2,r.width,2);else if(n.cursorStyle===3)t.strokeStyle=Z(n.cursor),t.strokeRect(e+.5,s+.5,r.width-1,r.height-1);else{t.fillRect(e,s,r.width,r.height);let o=n.rowData[n.cursorY]?.cells[n.cursorX];o?.text&&(t.font=lt(o,i,a),t.fillStyle=Z(n.background),t.fillText(o.text,e,s+r.baseline,r.width))}}}var ft=`/assets/SymbolsNerdFontMono-Regular-aK5vsLov.woff2`,pt=6,mt=32,ht=`"Symbols Nerd Font Mono", "Symbols Nerd Font", "JetBrainsMono Nerd Font", "JetBrainsMono NF", "FiraCode Nerd Font", "Hack Nerd Font", "MesloLGS NF", "CaskaydiaCove Nerd Font", "PowerlineSymbols", monospace`,gt=`"SF Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", `+ht,$=4,_t=18,vt=500,yt=`iMW0@# .`,bt=[`normal 400`,`normal 700`,`italic 400`,`italic 700`],xt=null;function St(){return xt===null&&(xt=(async()=>{try{let e=new FontFace(`Symbols Nerd Font Mono`,`url(${ft})`);document.fonts.add(await e.load())}catch{}})()),xt}function Ct(e){return e.split(`,`).map(e=>{let t=e.trim();return t.length===0?``:/^(['"]).*\1$/.test(t)||/^[a-zA-Z][a-zA-Z0-9-]*$/.test(t)?t:`"${t.replaceAll(`"`,``)}"`}).filter(e=>e.length>0).join(`, `)}function wt(e){let t=e===void 0?``:Ct(e);return t.length===0?gt:`${t}, ${ht}`}function Tt(e){let t=e===void 0?``:Ct(e);return t.length===0||!F(t)?gt:wt(t)}async function Et(e,t,n){let r=wt(e),i=n?.load??((e,t)=>document.fonts.load(e,t));try{await Promise.all(bt.map(e=>i(`${e} ${t}px ${r}`,yt)))}catch{}return(n?.resolve??Tt)(e)}function Dt(e){return e===void 0||!Number.isFinite(e)?12:Math.max(pt,Math.min(mt,Math.round(e)))}function Ot(e){return e.focused&&e.cursorBlinking&&e.cursorVisible&&!e.reducedMotion}function kt(e,t,n,r,i){if(!i)return t;let a=e-t*2-n*r;return t+Math.max(0,a)}function At(e,t){let n=Math.max(0,e.total),r=Math.max(0,Math.min(e.len,n)),i=Math.max(0,n-r);if(t<=0||r<=0||i===0)return null;let a=Math.min(t,Math.max(_t,t*r/n));return{thumbHeight:a,thumbTop:Math.max(0,t-a)*(Math.max(0,Math.min(e.offset,i))/i),maxOffset:i}}function jt(e,t,n,r){let i=At(e,t);if(i===null)return 0;let a=Math.max(0,t-i.thumbHeight);if(a===0)return 0;let o=Math.max(0,Math.min(n-r,a));return Math.round(o/a*i.maxOffset)}function Mt(e){let{bounds:t,clientX:n,clientY:r,cols:i,rows:a,metrics:o,padding:s,originY:c}=e,l=n-t.left-s,u=r-t.top-c;return l<0||u<0||l>=i*o.width||u>=a*o.height?null:{x:Math.floor(l/o.width),y:Math.floor(u/o.height)}}function Nt(e,t){let n=e.cells.map(e=>e.text||` `).join(``);return t?n.trimEnd():n}function Pt(e,t){let n=0;for(let r=0;r<t;r+=1)n+=e.cells[r]?.text.length||1;return n}function Ft(e,t){return t?.text===e.text&&t.range.start.x===e.range.start.x&&t.range.start.y===e.range.start.y&&t.range.end.x===e.range.end.x&&t.range.end.y===e.range.end.y}function It(e,t){for(let n=0;n<e.cells.length;n+=1)if(t<Pt(e,n+1))return n;return Math.max(0,e.cells.length-1)}function Lt(e,t,n){let r=M(t+1,t=>{let n=e[t];return n?{isWrapped:n.isWrapContinuation,translateToString:(e=!1)=>Nt(n,e)}:null});if(!r)return null;let i=r.segments[0];if(i&&e[i.bufferLineNumber-1]?.isWrapContinuation)return null;let a=r.segments.find(e=>e.bufferLineNumber===t+1),o=e[t];if(!a||!o)return null;let s=r.segments.at(-1),c=s?e[s.bufferLineNumber-1]:void 0,l=c!==void 0&&c.wrapsToNext,u=a.startIndex+Pt(o,n);for(let t of je(r.text))if(u>=t.start&&u<t.end){if(t.end===r.text.length&&l)return null;let n=r.segments.find(e=>t.start>=e.startIndex&&t.start<e.endIndex),i=r.segments.find(e=>t.end-1>=e.startIndex&&t.end-1<e.endIndex),a=n?e[n.bufferLineNumber-1]:void 0,o=i?e[i.bufferLineNumber-1]:void 0;return!n||!i||!a||!o?null:{text:t.text,range:{start:{x:It(a,t.start-n.startIndex),y:n.bufferLineNumber-1},end:{x:It(o,t.end-1-i.startIndex),y:i.bufferLineNumber-1}}}}return null}function Rt(e,t=navigator.platform){let n=e.key.toLowerCase();return n===`insert`&&!a(t)?e.ctrlKey&&!e.shiftKey&&!e.metaKey:n===`c`?a(t)?e.metaKey:e.ctrlKey:!1}function zt(e,t){e.value=t,t.length!==0&&e.select()}function Bt(e,t){t.length!==0&&e.value===t&&(e.value=``)}function Vt(e,t){return e.length===0||!t?{preventDefault:!1,claimWriteFallback:!1}:(t.setData(`text/plain`,e),{preventDefault:!0,claimWriteFallback:!0})}function Ht(e,t=navigator.platform){let n=e.key.toLowerCase();return n===`insert`&&!a(t)?e.shiftKey&&!e.ctrlKey&&!e.metaKey:n===`v`?a(t)?e.metaKey:e.ctrlKey&&e.shiftKey:!1}function Ut(){return/linux|bsd/i.test(navigator.platform)}function Wt(e){return e.inputType===``||e.inputType===`insertCompositionText`||e.inputType===`insertFromComposition`}function Gt(e,t){return e.isComposing||t||e.key===`Process`||e.keyCode===229}function Kt(e){return e.getModifierState(`AltGraph`)&&[...e.key].length===1}function qt(e,t){return e&&!t.shiftKey&&!t.ctrlKey&&!t.metaKey}function Jt(e,t,n){let r=e===`motion`?t:``;return{send:t.length>0&&(e!==`motion`||t!==n),nextMotionData:r}}function Yt(e,t,n){return{tracking:t,motionData:e===t?n:``}}function Xt(e,t,n,r){let i=r+(e.deltaMode===1?e.deltaY*t:e.deltaMode===2?e.deltaY*n*t:e.deltaY)/t,a=Math.trunc(i);return{rows:a,remainder:i-a}}function Zt(e,t){return e===0?``:(e<0?t?`\x1BOA`:`\x1B[A`:t?`\x1BOB`:`\x1B[B`).repeat(Math.abs(e))}function Qt(e){switch(e){case 0:return 1;case 1:return 3;case 2:return 2;case 3:return 4;case 4:return 5;default:return null}}var $t=4;function en(e,t){return{count:e!==null&&t.timeStamp-e.time<=500&&Math.hypot(t.clientX-e.x,t.clientY-e.y)<=$t?e.count>=3?1:e.count+1:1,time:t.timeStamp,x:t.clientX,y:t.clientY}}var tn=class e{canvas;input;scrollbar;cols=1;rows=1;mount;context;core;options;visible;hasSize=!1;metrics;fontFamily;requestedFontFamily;fontSize;fontEpoch=0;pendingFontEpoch=null;stopObservingResize;scrollbarThumb;snapshot=null;frame=0;cursorTimer=null;compositionInputToSuppress=null;compositionSuppressionTimer=null;cursorOn=!0;renderedCursorY=null;forceFullRender=!0;scrollbarDirty=!0;scrollbarState=null;scrollbarPointerId=null;scrollbarPointerOffset=0;disposed=!1;resizeNotifyTimer=null;originY=$;mountHeight=0;selectionEnd=null;selectionAnchorScreen=null;selectionEndScreen=null;selectionMode=`cell`;selectionBase=null;selectionScrollTimer=null;selectionScrollDelta=0;selectionPointer=null;mouseReportingPointerId=null;mouseReportingButton=null;linkActivationPointerId=null;linkActivationLink=null;linkActivationOrigin=null;hoveredLink=null;hoverPointer=null;selectionClickSequence=null;selectionMoved=!1;composing=!1;focused=!1;resizeNotified=!1;canvasConfigured=!1;theme;suppressedKeyCodes=new Set;pasteShortcutToken=0;copyShortcutToken=0;clearSelectionAfterCopy=!1;primedCopySelection=``;wheelRemainder=0;touchScroll=null;lastMouseMotionData=``;mouseAnyEventTracking=!1;dprMedia=null;reducedMotionMedia=window.matchMedia?.(`(prefers-reduced-motion: reduce)`);inputLeft=-1;inputTop=-1;constructor(e,t,n,r,i,a,o,s,c,l){this.mount=e,this.canvas=t,this.input=n,this.scrollbar=r,this.scrollbarThumb=i,this.context=a,this.core=o,this.mouseAnyEventTracking=o.isMouseAnyEventTracking(),this.metrics=s,this.options=l,this.visible=l.visible??!0,this.theme=l.theme,this.fontFamily=c,this.requestedFontFamily=l.font?.family,this.fontSize=Dt(l.font?.size),this.installEvents(),this.watchDevicePixelRatio(),this.reducedMotionMedia?.addEventListener(`change`,this.onReducedMotionChange),document.fonts.addEventListener(`loadingdone`,this.onFontsLoaded),this.stopObservingResize=ge(e,()=>this.fit())}static async create(t,n){let r=document.createElement(`canvas`);r.className=`block size-full cursor-text`,r.style.touchAction=`pan-x pinch-zoom`,r.setAttribute(`aria-hidden`,`true`);let i=document.createElement(`textarea`);i.className=`t3-ghostty-input`,i.setAttribute(`aria-label`,`Terminal input`),i.autocapitalize=`off`,i.autocomplete=`off`,i.spellcheck=!1,i.style.cssText=`position:absolute;left:4px;top:4px;width:1px;height:1px;opacity:0;padding:0;border:0;resize:none;pointer-events:none;`;let a=document.createElement(`div`);a.className=`group absolute top-1 right-px bottom-1 z-1 w-[var(--app-scrollbar-width)] cursor-default touch-none`,a.setAttribute(`role`,`scrollbar`),a.setAttribute(`aria-label`,`Terminal scrollback`),a.setAttribute(`aria-orientation`,`vertical`),a.tabIndex=0,a.hidden=!0;let o=document.createElement(`div`);o.className=`absolute inset-x-px top-0 rounded-[3px] bg-[var(--app-scrollbar-thumb)] transition-[background-color] duration-[120ms] ease-[ease-out] group-hover:bg-[var(--app-scrollbar-thumb-hover)] group-focus-visible:bg-[var(--app-scrollbar-thumb-hover)]`,a.append(o),t.replaceChildren(r,i,a);let s=r.getContext(`2d`,{alpha:!1});if(!s)throw Error(`Canvas 2D is unavailable`);s.fillStyle=`rgb(${n.theme.background.r}, ${n.theme.background.g}, ${n.theme.background.b})`,s.fillRect(0,0,r.width,r.height);let c=Dt(n.font?.size);try{await St()}catch{}let l=await Et(n.font?.family,c),u=ut(s,c,l),d=Q(t.clientWidth,t.clientHeight,u,$),f=await it.create(d.cols,d.rows,u.width,u.height,n.theme,n.onData),p=new e(t,r,i,a,o,s,f,u,l,n);return p.fit(),p}setVisible(e){if(!(this.disposed||this.visible===e)){if(this.visible=e,this.cursorOn=!0,this.forceFullRender=!0,this.scrollbarDirty=!0,!e){this.cancelRender(),this.setSelectionAutoscroll(0);return}this.fit()}}write(e){this.disposed||(this.core.write(e),this.synchronizeMouseTrackingState(),this.cursorOn=!0,this.scrollbarDirty=!0,this.requestRender())}resetAndWrite(e){this.disposed||(this.lastMouseMotionData=``,this.core.resetAndWrite(e),this.synchronizeMouseTrackingState(),this.cursorOn=!0,this.forceFullRender=!0,this.scrollbarDirty=!0,this.requestRender())}setTheme(e){this.disposed||(this.theme=e,this.core.setTheme(e),this.forceFullRender=!0,this.requestRender())}refreshLinkActivation(){this.disposed||this.refreshHoveredLink()}async setFont(e){if(this.disposed)return;let t=Dt(e.size),n=++this.fontEpoch;this.pendingFontEpoch=n;let r=await Et(e.family,t);this.disposed||n!==this.fontEpoch||(this.pendingFontEpoch=null,this.fontFamily=r,this.requestedFontFamily=e.family,this.fontSize=t,this.applyFontMetrics())}applyFontMetrics(){this.metrics=ut(this.context,this.fontSize,this.fontFamily),this.core.resize(this.cols,this.rows,this.metrics.width,this.metrics.height),this.inputLeft=-1,this.inputTop=-1,this.forceFullRender=!0,this.scrollbarDirty=!0,this.fit(),this.requestRender()}onReducedMotionChange=()=>{this.disposed||(this.cursorOn=!0,this.requestRender())};onFontsLoaded=()=>{if(this.disposed||this.pendingFontEpoch!==null)return;let e=Tt(this.requestedFontFamily);if(e!==this.fontFamily){this.fontFamily=e,this.applyFontMetrics();return}let t=ut(this.context,this.fontSize,this.fontFamily);(t.width!==this.metrics.width||t.height!==this.metrics.height||t.baseline!==this.metrics.baseline)&&this.applyFontMetrics()};resendSize(){this.resizeNotified=!1,this.fit()}fit(){if(this.disposed||!this.visible)return!1;let e=this.mount.clientWidth,t=this.mount.clientHeight;if(e<=0||t<=0)return this.hasSize=!1,this.forceFullRender=!0,this.cancelRender(),!1;this.hasSize=!0;let n=window.devicePixelRatio||1,r=Math.max(1,Math.round(e*n)),i=Math.max(1,Math.round(t*n)),a=!1;(this.canvas.width!==r||this.canvas.height!==i||!this.canvasConfigured)&&(this.canvas.width=r,this.canvas.height=i,this.context.setTransform(n,0,0,n,0,0),this.canvasConfigured=!0,this.forceFullRender=!0,this.scrollbarDirty=!0,a=!0);let o=Q(e,t,this.metrics,$);return this.mountHeight=t,(o.cols!==this.cols||o.rows!==this.rows||!this.resizeNotified)&&(this.cols=o.cols,this.rows=o.rows,this.core.resize(o.cols,o.rows,this.metrics.width,this.metrics.height),this.notifyResize(),this.forceFullRender=!0,this.scrollbarDirty=!0,a=!0),(a||this.forceFullRender)&&this.renderFrame(),!0}notifyResize(){this.resizeNotified=!0,this.resizeNotifyTimer!==null&&window.clearTimeout(this.resizeNotifyTimer),this.resizeNotifyTimer=window.setTimeout(()=>{this.resizeNotifyTimer=null,this.disposed||this.options.onResize(this.cols,this.rows)},150)}onWindowPointerRelease=()=>{this.disposed||this.resizeNotifyTimer===null||(this.fit(),this.resizeNotifyTimer!==null&&(window.clearTimeout(this.resizeNotifyTimer),this.resizeNotifyTimer=null,this.options.onResize(this.cols,this.rows)))};focus(){!this.disposed&&this.visible&&this.input.focus({preventScroll:!0})}async pasteFromClipboard(e,t=()=>!0){let n=++this.pasteShortcutToken,r=await e();if(this.disposed||this.pasteShortcutToken!==n||!t()||(this.pasteShortcutToken+=1,r.length===0))return;let i=this.core.encodePaste(r);i.length>0&&this.options.onData(i)}pasteTerminalSelection(){let e=this.getSelection();e.length!==0&&this.pasteFromClipboard(()=>Promise.resolve(e))}hasSelection(){return this.core.selectionText().length>0}getSelection(){return this.core.selectionText()}selectAll(){this.clearPrimedCopy();let e=this.core.selectAll();this.selectionAnchorScreen=e?.start??null,this.selectionEndScreen=e?.end??null,this.selectionEnd=e?this.core.screenPointToViewport(e.end.x,e.end.y):null,this.selectionMode=`cell`,this.selectionBase=null,this.setSelectionAutoscroll(0),this.options.onSelectionChange(),this.forceFullRender=!0,this.requestRender()}getSelectionPosition(){return!this.selectionAnchorScreen||!this.selectionEndScreen||!this.hasSelection()?null:this.selectionAnchorScreen.y<this.selectionEndScreen.y||this.selectionAnchorScreen.y===this.selectionEndScreen.y&&this.selectionAnchorScreen.x<=this.selectionEndScreen.x?{start:this.selectionAnchorScreen,end:this.selectionEndScreen}:{start:this.selectionEndScreen,end:this.selectionAnchorScreen}}getSelectionEndClientRect(){let e=this.getSelectionPosition();if(!e)return null;let t=this.core.screenPointToViewport(e.end.x,e.end.y);if(!t||t.x<0||t.x>=this.cols||t.y<0||t.y>=this.rows)return null;let n=this.canvas.getBoundingClientRect();return{right:n.left+$+(t.x+1)*this.metrics.width,bottom:n.top+this.originY+(t.y+1)*this.metrics.height}}clearSelection(){this.clearPrimedCopy(),this.core.clearSelection(),this.selectionEnd=null,this.selectionAnchorScreen=null,this.selectionEndScreen=null,this.selectionMode=`cell`,this.selectionBase=null,this.setSelectionAutoscroll(0),this.options.onSelectionChange(),this.forceFullRender=!0,this.requestRender()}scrollToBottom(){this.core.scrollToBottom(),this.forceFullRender=!0,this.scrollbarDirty=!0,this.requestRender()}isAtBottom(){return this.core.isViewportActive()}dispose(){this.disposed||(this.disposed=!0,this.stopObservingResize(),document.fonts.removeEventListener(`loadingdone`,this.onFontsLoaded),this.dprMedia?.removeEventListener(`change`,this.onDevicePixelRatioChange),this.dprMedia=null,this.reducedMotionMedia?.removeEventListener(`change`,this.onReducedMotionChange),this.selectionScrollTimer!==null&&window.clearInterval(this.selectionScrollTimer),this.resizeNotifyTimer!==null&&(window.clearTimeout(this.resizeNotifyTimer),this.resizeNotifyTimer=null,this.options.onResize(this.cols,this.rows)),this.cancelRender(),this.compositionSuppressionTimer!==null&&window.clearTimeout(this.compositionSuppressionTimer),this.removeEvents(),this.core.dispose(),(this.canvas.parentElement===this.mount||this.input.parentElement===this.mount||this.scrollbar.parentElement===this.mount)&&(this.canvas.remove(),this.input.remove(),this.scrollbar.remove()))}onKeyDown=e=>{if(Kt(e)||!this.options.beforeKey(e)){this.suppressedKeyCodes.add(e.code);return}if(Gt(e,this.composing)){this.suppressedKeyCodes.add(e.code);return}let t=a(navigator.platform),n=t?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey;if(e.key.toLowerCase()===`a`&&n&&!e.altKey&&(t?!e.shiftKey:e.shiftKey)){e.preventDefault(),e.stopPropagation(),this.suppressedKeyCodes.add(e.code),this.selectAll();return}let r=e.shiftKey&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&(e.key===`PageUp`||e.key===`PageDown`),i=e.shiftKey&&!e.altKey&&n&&(e.key===`Home`||e.key===`End`);if((r||i)&&!this.core.isAlternateScreen()){let t=this.readScrollbarState();if(t!==null){e.preventDefault(),e.stopPropagation(),this.suppressedKeyCodes.add(e.code);let n=e.key===`Home`?-t.offset:e.key===`End`?t.total-t.len-t.offset:Math.max(1,t.len)*(e.key===`PageUp`?-1:1);this.scrollViewport(n);return}}if(Rt(e)&&this.hasSelection()){let t=this.getSelection();if(this.primeCopy(t),e.shiftKey||e.key.toLowerCase()===`insert`)e.preventDefault(),document.execCommand(`copy`);else{this.clearSelectionAfterCopy=!e.shiftKey&&!a(navigator.platform);let n=navigator.clipboard;if(typeof n?.writeText==`function`){let e=++this.copyShortcutToken;Promise.resolve().then(()=>{this.disposed||this.copyShortcutToken!==e||n.writeText(t).then(()=>{this.disposed||this.copyShortcutToken!==e||this.clearSelectionAfterCopy&&(this.clearSelectionAfterCopy=!1,this.clearSelection())},()=>{this.copyShortcutToken===e&&(this.clearSelectionAfterCopy=!1)})})}}this.suppressedKeyCodes.add(e.code);return}if(Ht(e)){this.suppressedKeyCodes.add(e.code);let t=navigator.clipboard;if(typeof t?.readText==`function`){let e=++this.pasteShortcutToken;t.readText().then(t=>{this.disposed||this.pasteShortcutToken!==e||(this.pasteShortcutToken+=1,t.length>0&&this.options.onData(this.core.encodePaste(t)))},()=>{})}return}this.clearPrimedCopy();let o=this.core.encodeKey(e);o.length!==0&&(this.suppressedKeyCodes.delete(e.code),e.preventDefault(),e.stopPropagation(),this.options.onData(o))};onKeyUp=e=>{if(this.suppressedKeyCodes.delete(e.code)||Gt(e,this.composing))return;let t=this.core.encodeKey(e,`release`);t.length!==0&&(e.preventDefault(),e.stopPropagation(),this.options.onData(t))};onFocus=()=>{this.focused=!0,this.cursorOn=!0,this.requestRender()};onBlur=()=>{this.focused=!1,this.refreshHoveredLink(),this.cursorOn=!0,this.requestRender()};onDevicePixelRatioChange=()=>{this.watchDevicePixelRatio(),this.fit()};watchDevicePixelRatio(){this.dprMedia?.removeEventListener(`change`,this.onDevicePixelRatioChange),this.dprMedia=window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`),this.dprMedia.addEventListener(`change`,this.onDevicePixelRatioChange)}primeCopy(e){this.primedCopySelection=e,zt(this.input,e)}clearPrimedCopy(){Bt(this.input,this.primedCopySelection),this.primedCopySelection=``}onCopyEvent=e=>{let t=this.hasSelection()?this.getSelection():this.input.value;this.primeCopy(t);let n=Vt(t,e.clipboardData);n.preventDefault&&e.preventDefault(),n.claimWriteFallback&&(this.copyShortcutToken+=1,this.clearSelectionAfterCopy&&(this.clearSelectionAfterCopy=!1,this.clearSelection()))};onPaste=e=>{e.preventDefault();let t=e.clipboardData?.getData(`text/plain`)??``;t.length!==0&&(this.pasteShortcutToken+=1,this.options.onData(this.core.encodePaste(t)))};onCompositionStart=()=>{this.clearPrimedCopy(),this.clearCompositionInputSuppression(),this.composing=!0};onCompositionEnd=e=>{this.composing=!1;let t=this.input.value||e.data;t.length>0&&this.options.onData(t),this.input.value=``,this.compositionInputToSuppress=t,this.compositionSuppressionTimer=window.setTimeout(()=>{this.compositionInputToSuppress=null,this.compositionSuppressionTimer=null},100)};onInput=e=>{let t=e;if(this.composing||t.isComposing)return;let n=this.input.value||t.data||``;if(n===this.compositionInputToSuppress&&Wt(t)){this.clearCompositionInputSuppression(),this.input.value=``;return}this.clearCompositionInputSuppression(),n.length>0&&this.options.onData(n),this.input.value=``};clearCompositionInputSuppression(){this.compositionSuppressionTimer!==null&&(window.clearTimeout(this.compositionSuppressionTimer),this.compositionSuppressionTimer=null),this.compositionInputToSuppress=null}onPointerDown=e=>{if(e.pointerType===`touch`){if(e.preventDefault(),!e.isPrimary||this.touchScroll!==null)return;this.touchScroll={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,lastY:e.clientY,remainder:0,moved:!1},this.clearHoveredLink(),this.canvas.setPointerCapture(e.pointerId);return}if(this.focus(),qt(this.core.isMouseTracking(),e)){let t=Qt(e.button);if(t===null)return;e.preventDefault(),e.stopPropagation(),this.clearHoveredLink(`default`),this.mouseReportingPointerId=e.pointerId,this.mouseReportingButton=t,this.sendMouse(`press`,t,e),this.canvas.setPointerCapture(e.pointerId);return}if(e.button===1&&Ut()){this.pasteTerminalSelection();return}if(e.button!==0)return;let t=this.recordSelectionClick(e),n=this.linkAt(e.clientX,e.clientY);if(n&&!e.shiftKey&&t===1){e.preventDefault(),e.stopPropagation(),this.linkActivationPointerId=e.pointerId,this.linkActivationLink=n,this.linkActivationOrigin={x:e.clientX,y:e.clientY,clickCount:t},this.canvas.setPointerCapture(e.pointerId);return}this.clearHoveredLink(),this.beginSelection(e,t),this.canvas.setPointerCapture(e.pointerId)};recordSelectionClick(e){return this.selectionClickSequence=en(this.selectionClickSequence,e),this.selectionClickSequence.count}beginSelection(e,t){let n=this.cellAt(e.clientX,e.clientY);this.selectionMoved=!1,this.selectionMode=t>=3?`line`:t===2?`word`:`cell`;let r=this.selectionMode===`line`?this.core.selectLine(n.x,n.y):this.selectionMode===`word`?this.core.selectWord(n.x,n.y):null;if(r)this.selectionBase=r.screen,this.selectionEnd=r.viewport.end,this.selectionAnchorScreen=r.screen.start,this.selectionEndScreen=r.screen.end,this.options.onSelectionChange();else{this.selectionMode=`cell`,this.selectionBase=null,this.selectionEnd=n;let e=this.core.viewportPointToScreen(n.x,n.y);this.selectionAnchorScreen=e,this.selectionEndScreen=e,e?this.core.setSelection({...e,tag:2},{...e,tag:2}):this.core.setSelection(n,n)}this.forceFullRender=!0,this.requestRender()}onPointerMove=e=>{if(e.pointerType===`touch`){let t=this.touchScroll;if(t?.pointerId!==e.pointerId||(e.preventDefault(),t.moved||=Math.hypot(e.clientX-t.startX,e.clientY-t.startY)>$t,!t.moved))return;let n=Xt({deltaY:t.lastY-e.clientY,deltaMode:0},this.metrics.height,this.rows,t.remainder);t.lastY=e.clientY,t.remainder=n.remainder,this.scrollRows(n.rows,e);return}if(this.linkActivationPointerId===e.pointerId){let t=this.linkActivationOrigin;if(t===null||Math.hypot(e.clientX-t.x,e.clientY-t.y)<=$t)return;this.linkActivationPointerId=null,this.linkActivationLink=null,this.linkActivationOrigin=null,this.clearHoveredLink(),this.beginSelection({clientX:t.x,clientY:t.y},t.clickCount)}let t=this.synchronizeMouseTrackingState();if(this.mouseReportingPointerId===e.pointerId||qt(t,e)){e.preventDefault(),this.hoverPointer={x:e.clientX,y:e.clientY},this.setHoveredLink(null),this.canvas.style.cursor=`default`,this.sendMouse(`motion`,this.buttonFromButtons(e.buttons),e);return}if(this.lastMouseMotionData=``,!this.selectionAnchorScreen||!this.canvas.hasPointerCapture(e.pointerId)){this.updateHoverCursor(e);return}this.clearHoveredLink(),this.selectionPointer={x:e.clientX,y:e.clientY};let n=this.canvas.getBoundingClientRect(),r=Math.max(n.top,0)+$,i=Math.min(n.bottom,window.innerHeight)-$;this.setSelectionAutoscroll(e.clientY<r?-1:+(e.clientY>i));let a=this.cellAt(e.clientX,e.clientY);(a.x!==this.selectionEnd?.x||a.y!==this.selectionEnd.y)&&this.extendSelectionTo(e.clientX,e.clientY)};extendSelectionTo(e,t){let n=this.selectionAnchorScreen;if(n===null)return;let r=this.cellAt(e,t);this.selectionMoved=!0,this.selectionEnd=r;let i=this.selectionMode===`line`?this.core.selectLine(r.x,r.y):this.selectionMode===`word`?this.core.selectWord(r.x,r.y):null,a=this.core.viewportPointToScreen(r.x,r.y);if(a===null)return;let o=this.selectionBase,s=o!==null&&(a.y<o.start.y||a.y===o.start.y&&a.x<o.start.x),c=o===null?n:s?o.end:o.start,l=i===null?a:s?i.screen.start:i.screen.end;this.selectionAnchorScreen=c,this.selectionEndScreen=l,this.core.setSelection({...c,tag:2},{...l,tag:2}),this.options.onSelectionChange(),this.forceFullRender=!0,this.requestRender()}setSelectionAutoscroll(e){if(this.selectionScrollDelta=e,e===0){this.selectionScrollTimer!==null&&(window.clearInterval(this.selectionScrollTimer),this.selectionScrollTimer=null);return}this.selectionScrollTimer===null&&(this.selectionScrollTimer=window.setInterval(()=>{if(this.disposed||this.selectionScrollDelta===0)return;this.scrollViewport(this.selectionScrollDelta);let e=this.selectionPointer;e&&this.extendSelectionTo(e.x,e.y)},80))}updateHoverCursor(e){this.hoverPointer={x:e.clientX,y:e.clientY},this.refreshHoveredLink()}onPointerLeave=()=>{this.lastMouseMotionData=``,this.clearHoveredLink()};clearHoveredLink(e=``){this.hoverPointer=null,this.setHoveredLink(null),this.canvas.style.cursor=e}refreshHoveredLink(){let e=this.hoverPointer,t=e?this.linkAt(e.x,e.y):null;this.setHoveredLink(t)}setHoveredLink(e){let t=this.hoveredLink,n=t?.text===e?.text&&t?.range.start.x===e?.range.start.x&&t?.range.start.y===e?.range.start.y&&t?.range.end.x===e?.range.end.x&&t?.range.end.y===e?.range.end.y;this.canvas.style.cursor=e?`pointer`:``,!n&&(this.hoveredLink=e,this.forceFullRender=!0,this.requestRender())}onPointerUp=e=>{if(e.pointerType===`touch`){let t=this.touchScroll;if(t?.pointerId!==e.pointerId||(this.touchScroll=null,e.preventDefault(),this.canvas.hasPointerCapture(e.pointerId)&&this.canvas.releasePointerCapture(e.pointerId),e.type===`pointercancel`||t.moved))return;if(this.focus(),qt(this.core.isMouseTracking(),e))this.sendMouse(`press`,Qt(0),e),this.sendMouse(`release`,Qt(0),e);else{let t=this.linkAt(e.clientX,e.clientY);t?this.options.onLinkActivate(t.text,e):this.clearSelection()}return}if(this.setSelectionAutoscroll(0),this.linkActivationPointerId===e.pointerId){e.preventDefault(),e.stopPropagation();let t=this.linkActivationLink;this.linkActivationPointerId=null,this.linkActivationLink=null,this.linkActivationOrigin=null,this.canvas.hasPointerCapture(e.pointerId)&&this.canvas.releasePointerCapture(e.pointerId),e.type!==`pointercancel`&&t&&Ft(t,this.linkAt(e.clientX,e.clientY))&&this.options.onLinkActivate(t.text,e);return}if(this.mouseReportingPointerId===e.pointerId){e.preventDefault(),e.stopPropagation(),this.sendMouse(`release`,this.mouseReportingButton,e),this.mouseReportingPointerId=null,this.mouseReportingButton=null,this.canvas.hasPointerCapture(e.pointerId)&&this.canvas.releasePointerCapture(e.pointerId),e.type===`pointercancel`?this.clearHoveredLink():(this.hoverPointer={x:e.clientX,y:e.clientY},this.refreshHoveredLink());return}if(this.canvas.hasPointerCapture(e.pointerId)&&this.canvas.releasePointerCapture(e.pointerId),e.button===1&&Ut()){e.preventDefault();return}e.button===0&&(!this.selectionMoved&&this.selectionMode===`cell`&&this.clearSelection(),this.options.onSelectionChange())};onWheel=e=>{if(e.deltaY===0)return;e.preventDefault();let t=Xt(e,this.metrics.height,this.rows,this.wheelRemainder);this.wheelRemainder=t.remainder,this.scrollRows(t.rows,e)};scrollRows(e,t){if(e===0)return;let n=Math.abs(e);if(qt(this.core.isMouseTracking(),t)){let r=e<0?4:5;for(let e=0;e<n;e+=1)this.sendMouse(`press`,r,t);return}if(this.core.isAlternateScreen()){this.options.onData(Zt(e,this.core.isApplicationCursorKeys()));return}this.scrollViewport(e)}onMouseDown=e=>{(e.button===0||e.button===1&&Ut())&&e.preventDefault(),this.focus()};onMouseUp=e=>{e.button===1&&Ut()&&e.preventDefault()};onContextMenu=e=>{if(qt(this.core.isMouseTracking(),e)){e.preventDefault();return}this.options.onContextMenu?.(e)};onScrollbarPointerDown=e=>{if(e.button!==0)return;let t=this.readScrollbarState();if(t===null)return;let n=this.scrollbar.getBoundingClientRect(),r=At(t,n.height);r!==null&&(e.preventDefault(),e.stopPropagation(),this.scrollbarPointerId=e.pointerId,this.scrollbarPointerOffset=e.target===this.scrollbarThumb?e.clientY-n.top-r.thumbTop:r.thumbHeight/2,this.scrollbar.setPointerCapture(e.pointerId),this.scrollbarToPointer(e.clientY,n))};onScrollbarPointerMove=e=>{e.pointerId===this.scrollbarPointerId&&this.scrollbarState!==null&&(e.preventDefault(),this.scrollbarToPointer(e.clientY,this.scrollbar.getBoundingClientRect()))};onScrollbarPointerUp=e=>{e.pointerId===this.scrollbarPointerId&&(e.preventDefault(),this.scrollbarPointerId=null,this.scrollbar.hasPointerCapture(e.pointerId)&&this.scrollbar.releasePointerCapture(e.pointerId))};onScrollbarKeyDown=e=>{let t=this.readScrollbarState();if(t===null)return;let n=0;switch(e.key){case`ArrowUp`:n=-1;break;case`ArrowDown`:n=1;break;case`PageUp`:n=-Math.max(1,t.len);break;case`PageDown`:n=Math.max(1,t.len);break;case`Home`:n=-t.offset;break;case`End`:n=t.total-t.len-t.offset;break;default:return}e.preventDefault(),e.stopPropagation(),this.scrollViewport(n)};installEvents(){this.input.addEventListener(`keydown`,this.onKeyDown),this.input.addEventListener(`keyup`,this.onKeyUp),this.input.addEventListener(`focus`,this.onFocus),this.input.addEventListener(`blur`,this.onBlur),this.input.addEventListener(`input`,this.onInput),this.input.addEventListener(`paste`,this.onPaste),this.input.addEventListener(`copy`,this.onCopyEvent),this.input.addEventListener(`compositionstart`,this.onCompositionStart),this.input.addEventListener(`compositionend`,this.onCompositionEnd),this.canvas.addEventListener(`pointerdown`,this.onPointerDown),this.canvas.addEventListener(`pointermove`,this.onPointerMove),this.canvas.addEventListener(`pointerleave`,this.onPointerLeave),this.canvas.addEventListener(`pointerup`,this.onPointerUp),this.canvas.addEventListener(`pointercancel`,this.onPointerUp),this.canvas.addEventListener(`wheel`,this.onWheel,{passive:!1}),this.canvas.addEventListener(`mousedown`,this.onMouseDown),this.canvas.addEventListener(`mouseup`,this.onMouseUp),this.canvas.addEventListener(`contextmenu`,this.onContextMenu),this.scrollbar.addEventListener(`pointerdown`,this.onScrollbarPointerDown),this.scrollbar.addEventListener(`pointermove`,this.onScrollbarPointerMove),this.scrollbar.addEventListener(`pointerup`,this.onScrollbarPointerUp),this.scrollbar.addEventListener(`pointercancel`,this.onScrollbarPointerUp),this.scrollbar.addEventListener(`keydown`,this.onScrollbarKeyDown),window.addEventListener(`pointerup`,this.onWindowPointerRelease),window.addEventListener(`pointercancel`,this.onWindowPointerRelease)}removeEvents(){this.input.removeEventListener(`keydown`,this.onKeyDown),this.input.removeEventListener(`keyup`,this.onKeyUp),this.input.removeEventListener(`focus`,this.onFocus),this.input.removeEventListener(`blur`,this.onBlur),this.input.removeEventListener(`input`,this.onInput),this.input.removeEventListener(`paste`,this.onPaste),this.input.removeEventListener(`copy`,this.onCopyEvent),this.input.removeEventListener(`compositionstart`,this.onCompositionStart),this.input.removeEventListener(`compositionend`,this.onCompositionEnd),this.canvas.removeEventListener(`pointerdown`,this.onPointerDown),this.canvas.removeEventListener(`pointermove`,this.onPointerMove),this.canvas.removeEventListener(`pointerleave`,this.onPointerLeave),this.canvas.removeEventListener(`pointerup`,this.onPointerUp),this.canvas.removeEventListener(`pointercancel`,this.onPointerUp),this.canvas.removeEventListener(`wheel`,this.onWheel),this.canvas.removeEventListener(`mousedown`,this.onMouseDown),this.canvas.removeEventListener(`mouseup`,this.onMouseUp),this.canvas.removeEventListener(`contextmenu`,this.onContextMenu),this.scrollbar.removeEventListener(`pointerdown`,this.onScrollbarPointerDown),this.scrollbar.removeEventListener(`pointermove`,this.onScrollbarPointerMove),this.scrollbar.removeEventListener(`pointerup`,this.onScrollbarPointerUp),this.scrollbar.removeEventListener(`pointercancel`,this.onScrollbarPointerUp),this.scrollbar.removeEventListener(`keydown`,this.onScrollbarKeyDown),window.removeEventListener(`pointerup`,this.onWindowPointerRelease),window.removeEventListener(`pointercancel`,this.onWindowPointerRelease)}scrollViewport(e){let t=Math.trunc(e),n=this.readScrollbarState();if(n!==null){let e=Math.max(0,n.total-n.len),r=Math.max(0,Math.min(n.offset+t,e));t=r-n.offset,this.scrollbarState={...n,offset:r}}t!==0&&(this.core.scroll(t),this.forceFullRender=!0,this.scrollbarDirty=!0,this.requestRender())}scrollbarToPointer(e,t){let n=this.scrollbarState;if(n===null)return;let r=jt(n,t.height,e-t.top,this.scrollbarPointerOffset);this.scrollViewport(r-n.offset)}updateScrollbar(){let e=this.readScrollbarState(),t=e===null?null:At(e,Math.max(0,this.mount.clientHeight-8));this.scrollbar.hidden=t===null,e!==null&&t!==null&&(this.scrollbar.setAttribute(`aria-valuemin`,`0`),this.scrollbar.setAttribute(`aria-valuemax`,String(t.maxOffset)),this.scrollbar.setAttribute(`aria-valuenow`,String(Math.max(0,Math.min(e.offset,t.maxOffset)))),this.scrollbarThumb.style.height=`${t.thumbHeight}px`,this.scrollbarThumb.style.transform=`translateY(${t.thumbTop}px)`)}readScrollbarState(){let e=this.core.scrollbarState();return this.scrollbarState=e,e}requestRender(){!this.disposed&&this.visible&&this.hasSize&&this.frame===0&&(this.frame=window.requestAnimationFrame(()=>{this.frame=0,this.renderFrame()}))}cancelRender(){this.frame!==0&&(window.cancelAnimationFrame(this.frame),this.frame=0),this.cursorTimer!==null&&(window.clearTimeout(this.cursorTimer),this.cursorTimer=null)}renderFrame(){if(this.disposed||!this.visible)return;if(this.frame!==0&&(window.cancelAnimationFrame(this.frame),this.frame=0),this.mount.clientWidth===0||this.mount.clientHeight===0){this.hasSize=!1,this.forceFullRender=!0,this.cancelRender();return}this.snapshot=this.core.snapshot(),this.blinkEnabled()||(this.cursorOn=!0);let e=this.readScrollbarState(),t=e!==null&&e.total>e.len,n=kt(this.mountHeight,$,this.rows,this.metrics.height,t);n!==this.originY&&(this.originY=n,this.forceFullRender=!0),this.refreshHoveredLink(),dt({context:this.context,snapshot:this.snapshot,metrics:this.metrics,fontSize:this.fontSize,fontFamily:this.fontFamily,padding:$,originY:this.originY,forceFull:this.forceFullRender,cursorOn:this.cursorOn,previousCursorY:this.renderedCursorY,focused:this.focused,hoveredLinkRange:this.hoveredLink?.range??null,...this.theme.selectionBackground===void 0?{}:{selectionBackground:this.theme.selectionBackground}}),this.positionInput(),this.renderedCursorY=this.cursorOn&&this.snapshot.cursorVisible&&this.snapshot.cursorY>=0?this.snapshot.cursorY:null,this.scrollbarDirty&&(this.scrollbarDirty=!1,this.updateScrollbar()),this.forceFullRender=!1,this.scheduleCursorBlink()}scheduleCursorBlink(){this.cursorTimer!==null&&window.clearTimeout(this.cursorTimer),this.cursorTimer=null,this.blinkEnabled()&&(this.cursorTimer=window.setTimeout(()=>{this.cursorTimer=null,this.cursorOn=!this.cursorOn,this.requestRender()},vt))}blinkEnabled(){let e=this.snapshot;return!e||!this.visible||!this.hasSize?!1:Ot({focused:this.focused,cursorBlinking:e.cursorBlinking,cursorVisible:e.cursorVisible,reducedMotion:this.reducedMotionMedia?.matches??!1})}positionInput(){let e=this.snapshot;if(!e||!e.cursorVisible||e.cursorX<0||e.cursorY<0)return;let t=$+e.cursorX*this.metrics.width,n=this.originY+e.cursorY*this.metrics.height;(t!==this.inputLeft||n!==this.inputTop)&&(this.inputLeft=t,this.inputTop=n,this.input.style.left=`${t}px`,this.input.style.top=`${n}px`,this.input.style.height=`${this.metrics.height}px`)}cellAt(e,t){let n=this.canvas.getBoundingClientRect();return{x:Math.max(0,Math.min(this.cols-1,Math.floor((e-n.left-$)/this.metrics.width))),y:Math.max(0,Math.min(this.rows-1,Math.floor((t-n.top-this.originY)/this.metrics.height)))}}linkAt(e,t){let n=this.findLinkAt(e,t);return n&&this.options.canActivateLink?.(n.text)!==!1?n:null}findLinkAt(e,t){if(!this.snapshot)return null;let n=Mt({bounds:this.canvas.getBoundingClientRect(),clientX:e,clientY:t,cols:this.cols,rows:this.rows,metrics:this.metrics,padding:$,originY:this.originY});if(!n)return null;let r=this.core.hyperlinkAt(n.x,n.y);if(r){let e={...n},t={...n};for(;;){let t=e.x>0?{x:e.x-1,y:e.y}:e.y>0&&this.snapshot.rowData[e.y]?.isWrapContinuation?{x:this.cols-1,y:e.y-1}:null;if(!t||this.core.hyperlinkAt(t.x,t.y)!==r)break;e.x=t.x,e.y=t.y}for(;;){let e=t.x+1<this.cols?{x:t.x+1,y:t.y}:t.y+1<this.rows&&this.snapshot.rowData[t.y]?.wrapsToNext?{x:0,y:t.y+1}:null;if(!e||this.core.hyperlinkAt(e.x,e.y)!==r)break;t.x=e.x,t.y=e.y}return{text:r,range:{start:e,end:t}}}return Lt(this.snapshot.rowData,n.y,n.x)}sendMouse(e,t,n){let r=this.canvas.getBoundingClientRect(),i=this.core.encodeMouse({action:e,button:t,mods:+!!n.shiftKey|(n.ctrlKey?2:0)|(n.altKey?4:0)|(n.metaKey?8:0),x:Math.max(0,n.clientX-r.left),y:Math.max(0,n.clientY-r.top),screenWidth:r.width,screenHeight:r.height,cellWidth:this.metrics.width,cellHeight:this.metrics.height,paddingLeft:$,paddingRight:$,paddingTop:this.originY,paddingBottom:Math.max(0,r.height-this.originY-this.rows*this.metrics.height),anyButtonPressed:n.buttons!==0}),a=Jt(e,i,this.lastMouseMotionData);this.lastMouseMotionData=a.nextMotionData,a.send&&this.options.onData(i)}synchronizeMouseTrackingState(){let e=this.core.isMouseAnyEventTracking(),t=Yt(this.mouseAnyEventTracking,e,this.lastMouseMotionData);return this.mouseAnyEventTracking=t.tracking,this.lastMouseMotionData=t.motionData,e}buttonFromButtons(e){return e&1?1:e&4?3:e&2?2:e&8?4:e&16?5:null}};function nn(e){let t=(0,ze.c)(14),{children:n,label:r,onClick:i,tooltip:a}=e,o;t[0]===n?o=t[1]:(o=(0,L.jsx)(`span`,{className:`relative flex size-3 items-center justify-center group-hover/tab:hidden group-focus-visible/close:hidden`,children:n}),t[0]=n,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,L.jsx)(d,{className:`hidden size-3 group-hover/tab:block group-focus-visible/close:block`}),t[2]=s):s=t[2];let c;t[3]!==r||t[4]!==i||t[5]!==o?(c=(0,L.jsxs)(`button`,{type:`button`,className:`cursor-pointer group/close relative flex size-4 shrink-0 items-center justify-center rounded-sm hover:bg-muted`,"aria-label":r,onClick:i,children:[o,s]}),t[3]=r,t[4]=i,t[5]=o,t[6]=c):c=t[6];let l=c;if(!a)return l;let u;t[7]===l?u=t[8]:(u=(0,L.jsx)(S,{render:l}),t[7]=l,t[8]=u);let f;t[9]===a?f=t[10]:(f=(0,L.jsx)(C,{children:a}),t[9]=a,t[10]=f);let p;return t[11]!==u||t[12]!==f?(p=(0,L.jsxs)(he,{children:[u,f]}),t[11]=u,t[12]=f,t[13]=p):p=t[13],p}var rn=0;function an(){return rn>0}async function on(e){let t=b();if(!t)return!0;rn+=1;try{return await t.dialogs.confirm(e.length===1?[`Close terminal "${e[0]}"?`,`This stops the running process and clears its history.`].join(`
|
|
2
|
-
`):[`Close ${e.length} terminals?`,`This stops their running processes and clears their histories: ${e.map(e=>`"${e}"`).join(`, `)}.`].join(`
|
|
3
|
-
`),{variant:`destructive`})}catch{return!1}finally{--rn}}var sn={environmentId:c,threadId:c,targetOrigin:c,cause:i()},cn=class extends n()(`TerminalLinkPreviewOpenError`,sn){get message(){return`Failed to open terminal link ${this.targetOrigin} in preview for thread ${this.threadId}.`}};async function ln(e){if(!(!e.forceBrowser&&k(e.url)&&ye(e.threadRef.environmentId)&&e.threadRef.threadId.length>0&&await A()===`app`)){e.fallbackToBrowser();return}let t={environmentId:e.threadRef.environmentId,threadId:e.threadRef.threadId,targetOrigin:new URL(e.url).origin},n=await w(),r=_e(e.threadRef.environmentId),i=await e.openPreview({environmentId:e.threadRef.environmentId,input:{threadId:e.threadRef.threadId,url:e.url,viewport:ve(n),profileId:E(n),...r===void 0?{}:{runtime:r}}});if(i._tag===`Failure`){if(re(i))return;console.error(new cn({...t,cause:i.cause})),e.fallbackToBrowser();return}T(e.threadRef,e.url),h(e.threadRef,i.value),x.getState().openBrowser(e.threadRef,i.value.tabId)}function un(e){return{...e===void 0?{}:{platform:e},context:{terminalFocus:!0,terminalOpen:!0}}}function dn(e,t,n){return we(e,t,un(n))?(e.preventDefault(),!0):!1}function fn(e,t,n){return e.repeat?dn(e,t,n):!1}var pn=180,mn=.75;function hn(){return typeof window>`u`?280:Math.max(pn,Math.floor(window.innerHeight*mn))}function gn(e,t=hn()){return Math.min(Math.max(Math.round(Number.isFinite(e)?e:280),pn),t)}function _n(e,t){e.write(`\r\n[terminal] ${t}\r\n`)}function vn(e,t){t.type===`reset`?e.resetAndWrite(t.data):t.type===`append`&&e.write(t.data)}function yn(e,t,n){if(t.version===0)return n;let r=N(t.output,n);return vn(e,r),e.clearSelection(),r.cursor}function bn(e,t){if(typeof document>`u`)return t;let n=document.createElement(`canvas`);n.width=1,n.height=1;let r=n.getContext(`2d`,{willReadFrequently:!0});if(!r)return t;r.clearRect(0,0,1,1),r.fillStyle=e,r.fillRect(0,0,1,1);let[i,a,o,s]=r.getImageData(0,0,1,1).data;return s===0?t:{r:i??t.r,g:a??t.g,b:o??t.b}}function xn(e){let t=Number.parseInt(e.slice(1),16);return{r:t>>16&255,g:t>>8&255,b:t&255}}var Sn={light:[`#000000`,`#cd3131`,`#107c10`,`#949800`,`#0451a5`,`#bc05bc`,`#0598bc`,`#555555`,`#666666`,`#cd3131`,`#14ce14`,`#b5ba00`,`#0451a5`,`#bc05bc`,`#0598bc`,`#a5a5a5`].map(xn),dark:[`#000000`,`#cd3131`,`#0dbc79`,`#e5e510`,`#2472c8`,`#bc3fbc`,`#11a8cd`,`#e5e5e5`,`#666666`,`#f14c4c`,`#23d18b`,`#f5f543`,`#3b8eea`,`#d670d6`,`#29b8db`,`#e5e5e5`].map(xn)};function Cn(e){return e?JSON.stringify(Object.entries(e).filter(([e,t])=>e.length>0&&typeof t==`string`).sort(([e],[t])=>e.localeCompare(t))):``}function wn(e,t){let n=e?.trim().toLowerCase();return!n||n===`transparent`||n===`rgba(0, 0, 0, 0)`||n===`rgba(0 0 0 / 0)`?t:e??t}function Tn(e,t,n){return wn(e.getPropertyValue(t),n)}function En(e,t){let n=e.trim();return n.length>0?{family:n,size:t}:{size:t}}function Dn(e){let t=e?.closest(`[data-thread-terminal-drawer]`)??document.querySelector(`[data-thread-terminal-drawer]`)??document.body,n=getComputedStyle(t),r=e?getComputedStyle(e):n,i=r.colorScheme,a=i===`dark`||i!==`light`&&document.documentElement.classList.contains(`dark`),o=a?`rgb(14, 18, 24)`:`rgb(255, 255, 255)`,s=a?`rgb(237, 241, 247)`:`rgb(28, 33, 41)`,c=getComputedStyle(document.body),l=getComputedStyle(document.documentElement),u=wn(n.backgroundColor,wn(c.backgroundColor,o)),d=wn(n.color,wn(c.color,s)),f=Tn(r,`--terminal-background`,Tn(l,`--terminal-background`,u)),p=Tn(r,`--terminal-foreground`,Tn(l,`--terminal-foreground`,d)),m=Tn(r,`--terminal-cursor`,a?`rgb(180, 203, 255)`:`rgb(38, 56, 78)`),h=Tn(r,`--terminal-selection-background`,a?`rgba(180, 203, 255, 0.25)`:`rgba(37, 63, 99, 0.2)`);return{background:bn(f,a?{r:14,g:18,b:24}:{r:255,g:255,b:255}),foreground:bn(p,a?{r:237,g:241,b:247}:{r:28,g:33,b:41}),cursor:bn(m,a?{r:180,g:203,b:255}:{r:38,g:56,b:78}),palette:Sn[a?`dark`:`light`],selectionBackground:h}}function On(e){let t=e.start.y+1;return{lineStart:t,lineEnd:Math.max(t,e.end.y+1)}}function kn(e){return[...e?.canAddToChat===!1?[]:[{id:`add-to-chat`,label:`Add to chat`}],{id:`copy`,label:`Copy`}]}function An(e){let{hasSelection:t,canAddToChat:n=!0}=e;return[...kn({canAddToChat:n}).map(e=>({...e,disabled:!t})),{id:`paste`,label:`Paste`,...e.readOnly?{disabled:!0}:{}},{id:`select-all`,label:`Select all`},{id:`scroll-to-bottom`,label:`Jump to latest`}]}function jn(e){return e.actionPending||e.openMenuRequestId===e.currentRequestId}function Mn(e,t,n,r){return r>0&&(e===`closed`||e===`exited`)&&e!==t&&!n}function Nn({advancedTypography:e,threadRef:t,threadId:n,terminalId:r,terminalLabel:i,cwd:a,worktreePath:s,runtimeEnv:c,providerInstanceId:l,onSessionExited:u,onAddTerminalContext:d,focusRequestId:m,autoFocus:h,visible:g,resizeEpoch:ee,drawerHeight:te,keybindings:_}){let v=(0,I.useRef)(null),y=(0,I.useRef)(null),ne=(0,I.useRef)(g),x=t.environmentId,S=ue(x,o),C=(0,I.useEffectEvent)(()=>de(x,o)),he=ue(x,p),ge=(0,I.useEffectEvent)(e=>Ae(e)||de(x,`orchestration:operate`)),_e=f(le.configValueAtom(x)),ve=Le(x,_e?.availableEditors??[]),w=(0,I.useEffectEvent)(e=>ve(e)),T=fe(De.open,{reportFailure:!1}),E=fe(Ne.write,{reportFailure:!1}),ye=fe(Ne.resize,{reportFailure:!1}),we=(0,I.useRef)(!1),k=(0,I.useRef)(0),A=(0,I.useRef)(null),Oe=(0,I.useRef)(_),j=(0,I.useMemo)(()=>Cn(c),[c]),ke=(0,I.useEffectEvent)(()=>{C()&&u()}),je=(0,I.useEffectEvent)(e=>{d?.(e)}),M=(0,I.useEffectEvent)(()=>d!==void 0),Pe=(0,I.useEffectEvent)(()=>i),Fe=ce(t=>Ie({advanced:e,code:t.fontFamilyCode,terminal:t.fontFamilyTerminal})),F=ce(t=>Re({advanced:e,code:t.fontSizeCode,terminal:t.fontSizeTerminal})),ze=(0,I.useRef)({family:Fe,size:F}),R=P({environmentId:x,terminal:{threadId:n,terminalId:r,cwd:a,...s===void 0?{}:{worktreePath:s},...c?{env:c}:{},...l?{providerInstanceId:l}:{}}}),z=S&&R.version>0&&R.status===`running`,He=z?R.output.generation:null,Ue=(0,I.useEffectEvent)(e=>E({environmentId:x,input:{threadId:n,terminalId:r,data:e}})),We=(0,I.useEffectEvent)((e,t)=>{if(z&&C())return ye({environmentId:x,input:{threadId:n,terminalId:r,cols:e,rows:t}})}),B=R.output,V=R.error,H=R.status,Ge=(0,I.useRef)(Me),U=(0,I.useRef)(`closed`),Ke=(0,I.useEffectEvent)((e,t,n)=>{let r=U.current;n>0&&t===`running`?we.current=!1:Mn(t,r,we.current,n)&&(we.current=!0,_n(e,t===`closed`?`Terminal closed`:`Process exited`),window.setTimeout(()=>{we.current&&ke()},0)),n>0&&(U.current=t)}),W=R.version,G=(0,I.useRef)({output:B,error:V,status:H,version:W}),K=(0,I.useRef)(G.current);return K.current={output:B,error:V,status:H,version:W},(0,I.useEffect)(()=>{Oe.current=_},[_]),(0,I.useLayoutEffect)(()=>{y.current&&(y.current.input.readOnly=!S)},[S]),(0,I.useEffect)(()=>{y.current?.refreshLinkActivation()},[he]),(0,I.useEffect)(()=>{He!==null&&y.current?.resendSize()},[He]),(0,I.useLayoutEffect)(()=>{ne.current=g,y.current?.setVisible(g)},[g]),(0,I.useEffect)(()=>{let e=ze.current;(e.family!==Fe||e.size!==F)&&(ze.current={family:Fe,size:F},y.current?.setFont(En(Fe,F)))},[Fe,F]),(0,I.useEffect)(()=>{let e=v.current;if(!e)return;let n=b(),i=!1,o=null,s=null,c=[],l=null;return(async()=>{let o=ze.current,u={theme:Dn(e),font:En(o.family,o.size),get visible(){return ne.current},onData:e=>ve(e),onResize:(e,t)=>void We(e,t),onSelectionChange:()=>E(),beforeKey:e=>he(e),onLinkActivate:(e,t)=>_e(e,t),canActivateLink:e=>ge(e),onContextMenu:e=>{y.current&&ue(e)}},d=await tn.create(e,u);if(i)return d.dispose(),null;d.setVisible(ne.current),d.setTheme(Dn(e)),s=d,y.current=d,d.input.readOnly=!C();let f=ze.current;(f.family!==o.family||f.size!==o.size)&&d.setFont(En(f.family,f.size));let p=K.current;G.current=p;let m=N(p.output,Me);m.type===`reset`&&m.data.length>0&&vn(d,m),Ge.current=m.cursor,p.error!==null&&_n(d,p.error),U.current=`closed`,Ke(d,p.status,p.version),C()&&ne.current&&e.contains(document.activeElement)&&d.focus();let h=(e=!1)=>{let t=A.current===k.current;(e||t)&&(k.current+=1),t&&n?.contextMenu.close()},g=()=>{l?.cancel(),h(!0)};c.push(g);let ee=(e=null)=>{let t=y.current,n=v.current;if(!t||!n||!t.hasSelection())return null;let i=t.getSelection(),a=t.getSelectionPosition(),o=i.replace(/\r\n/g,`
|
|
4
|
-
`).replace(/^\n+|\n+$/g,``);if(!a||o.length===0)return null;let{lineStart:s,lineEnd:c}=On(a);return{position:Be({bounds:n.getBoundingClientRect(),selectionRect:t.getSelectionEndClientRect(),pointer:e,viewport:{width:window.innerWidth,height:window.innerHeight}}),clipboardText:i,selection:{terminalId:r,terminalLabel:Pe(),lineStart:s,lineEnd:c,text:o}}},te=e=>{je(e),y.current?.clearSelection(),y.current?.focus()},_=(e,t,n)=>{if(e!==k.current)return;let r=y.current;r&&_n(r,t instanceof Error?t.message:n)},b=e=>{e===k.current&&y.current?.focus()},ce=async(e,t)=>{try{await se(e,`terminal selection`)}catch(e){_(t,e,`Unable to copy terminal selection`)}b(t)},le=async e=>{if(!C())return;let t=y.current;if(t){try{await t.pasteFromClipboard(()=>ae(`terminal input`),()=>e===k.current)}catch(t){_(e,t,`Unable to read the clipboard`);return}b(e)}},ue=async e=>{if(!n||!y.current)return;e.preventDefault(),g();let t=ee(),r=k.current,i;try{i=await n.contextMenu.show(An({hasSelection:t!==null,canAddToChat:M(),readOnly:!C()}),{x:e.clientX,y:e.clientY})}catch(e){_(r,e,`Unable to open the terminal context menu`),b(r);return}if(r===k.current&&i!==null)switch(i){case`add-to-chat`:t&&M()&&te(t.selection);return;case`copy`:t&&await ce(t.clipboardText,r);return;case`paste`:await le(r);return;case`select-all`:y.current?.selectAll(),b(r);return;case`scroll-to-bottom`:y.current?.scrollToBottom(),b(r);return}},fe=async e=>{if(!n){g();return}if(A.current===k.current)return;let t=ee(e);if(!t){g();return}let r=++k.current;A.current=r;let i=await n.contextMenu.show(kn({canAddToChat:M()}),t.position).finally(()=>{A.current===r&&(A.current=null)});if(r===k.current&&i!==null)switch(i){case`add-to-chat`:M()&&te(t.selection);return;case`copy`:await ce(t.clipboardText,r);return}},S=async(e,t)=>{if(!C())return;let n=y.current;if(!n)return;let r=await Ue(e);if(r._tag===`Failure`&&!re(r)){let e=ie(r);_n(n,e instanceof Error?e.message:t)}};function he(e){let t=Oe.current,n={context:{terminalFocus:!0,terminalOpen:!0}};if(dn(e,t)||Te(e,t,n)||Se(e,t,n)||Ce(e,t,n)||Ee(e,t,n)||be(e,t,n))return!1;let r=D(e);if(r!==null)return e.preventDefault(),e.stopPropagation(),S(r,`Failed to move cursor`),!1;let i=O(e);return i===null?!xe(e)||(e.preventDefault(),e.stopPropagation(),S(`\f`,`Failed to clear terminal`),!1):(e.preventDefault(),e.stopPropagation(),S(i,`Failed to delete terminal input`),!1)}function _e(e,r){if(!ge(e))return;let i=y.current;if(!i)return;if(Ae(e)){if(!n){_n(i,`Opening links is unavailable in this browser.`);return}let a=()=>{n.shell.openExternal(e).catch(e=>{_n(i,e instanceof Error?e.message:`Unable to open link`)})};if(!de(x,`preview:operate`)){a();return}ln({url:e,threadRef:t,openPreview:T,fallbackToBrowser:a,forceBrowser:r.metaKey||r.ctrlKey}).catch(e=>{oe.add(me({type:`error`,title:`Unable to open link`,description:e instanceof Error?e.message:`An error occurred.`}))});return}let o=pe(e,a);(async()=>{let e=await w(o);if(e._tag===`Success`||re(e))return;let t=ie(e);_n(i,t instanceof Error?t.message:`Unable to open path`)})()}function ve(e){C()&&(async()=>{let t=await Ue(e);if(t._tag===`Success`||re(t))return;let n=ie(t);_n(d,n instanceof Error?n.message:`Terminal write failed`)})()}function E(){y.current?.hasSelection()||jn({actionPending:l?.pending??!1,openMenuRequestId:A.current,currentRequestId:k.current})&&g()}l=Ve({element:e,onSelection:e=>{fe(e)},onDismiss:e=>h(e===`interaction`)}),c.push(()=>l?.dispose());let ye=new MutationObserver(()=>{let e=y.current;e&&e.setTheme(Dn(v.current))});ye.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`style`]}),c.push(()=>ye.disconnect());let we=window.setTimeout(()=>{let e=y.current;if(!e)return;let t=e.isAtBottom();e.fit(),t&&e.scrollToBottom()},30);c.push(()=>window.clearTimeout(we));let De=c;return c=[],s=null,()=>{for(let e of De.toReversed())e();y.current===d&&(y.current=null),d.dispose()}})().then(e=>{if(i){e?.();return}o=e}).catch(t=>{for(let e of c.toReversed())e();if(c=[],y.current===s&&(y.current=null),s?.dispose(),s=null,i)return;let n=t instanceof Error?t.message:`Unable to initialize libghostty-vt`;e.textContent=`${n} — close and reopen the terminal to retry.`}),()=>{i=!0;let t=e.contains(document.activeElement);o?.(),C()&&t&&e.isConnected&&e.focus({preventScroll:!0})}},[a,x,j,r,n,s]),(0,I.useEffect)(()=>{let e=y.current,t={output:B,error:V,status:H,version:W};if(!e){G.current=t;return}let n=G.current;Ke(e,t.status,t.version),(t.version!==n.version||t.output!==n.output)&&(Ge.current=yn(e,t,Ge.current),t.error!==null&&t.error!==n.error&&_n(e,t.error),G.current=t)},[B,V,H,W]),(0,I.useEffect)(()=>{h&&S&&g&&(y.current??v.current)?.focus()},[h,S,m,g]),(0,I.useEffect)(()=>{let e=y.current;if(!e||!ne.current)return;let t=e.isAtBottom(),n=window.requestAnimationFrame(()=>{ne.current&&(e.fit(),t&&e.scrollToBottom())});return()=>{window.cancelAnimationFrame(n)}},[te,x,ee,r,n]),(0,L.jsx)(`div`,{ref:v,tabIndex:-1,className:`relative h-full w-full overflow-hidden bg-(--terminal-background)`})}function Pn(e){let t=(0,ze.c)(16),{label:n,className:r,onClick:i,children:a,disabled:o}=e,s=o&&`opacity-45 cursor-not-allowed`,c;t[0]!==r||t[1]!==s?(c=_(r,s),t[0]=r,t[1]=s,t[2]=c):c=t[2];let l=o?void 0:i,u;t[3]!==o||t[4]!==n||t[5]!==c||t[6]!==l?(u=(0,L.jsx)(`button`,{type:`button`,className:c,onClick:l,"aria-label":n,"aria-disabled":o}),t[3]=o,t[4]=n,t[5]=c,t[6]=l,t[7]=u):u=t[7];let d;t[8]!==a||t[9]!==u?(d=(0,L.jsx)(j,{openOnHover:!0,render:u,children:a}),t[8]=a,t[9]=u,t[10]=d):d=t[10];let f;t[11]===n?f=t[12]:(f=(0,L.jsx)(Oe,{tooltipStyle:!0,side:`bottom`,sideOffset:6,align:`center`,className:`pointer-events-none select-none`,children:n}),t[11]=n,t[12]=f);let p;return t[13]!==d||t[14]!==f?(p=(0,L.jsxs)(ke,{children:[d,f]}),t[13]=d,t[14]=f,t[15]=p):p=t[15],p}function Fn(e){let t=(0,ze.c)(169),{mode:n,threadRef:i,threadId:a,cwd:c,worktreePath:l,runtimeEnv:d,visible:f,height:p,terminalIds:h,activeTerminalId:g,terminalGroups:re,activeTerminalGroupId:ie,focusRequestId:ae,onSplitTerminal:oe,onSplitTerminalVertical:se,onNewTerminal:b,splitShortcutLabel:ce,splitVerticalShortcutLabel:le,newShortcutLabel:fe,closeShortcutLabel:x,onActiveTerminalChange:pe,onCloseTerminal:me,onHeightChange:S,onAddTerminalContext:C,keybindings:he,terminalLabelsById:ge,terminalLaunchLocationsById:_e}=e,ve=n===void 0?`drawer`:n,w=f===void 0||f,T=ue(i.environmentId,o),E=ve===`panel`,[ye]=s(Fe,!1,ne),D=p,[be,xe]=(0,I.useState)(hn),Se;t[0]!==D||t[1]!==a?(Se=()=>({threadId:a,height:D}),t[0]=D,t[1]=a,t[2]=Se):Se=t[2];let[Ce,we]=(0,I.useState)(Se),Te=Ce.threadId===a?Ce.height:D,Ee;t[3]!==Te||t[4]!==be?(Ee=gn(Te,be),t[3]=Te,t[4]=be,t[5]=Ee):Ee=t[5];let O=Ee,De;t[6]!==D||t[7]!==a?(De=e=>{we(t=>{let n=t.threadId===a?t.height:D,r=typeof e==`function`?e(n):e;return r===n&&t.threadId===a?t:{threadId:a,height:r}})},t[6]=D,t[7]=a,t[8]=De):De=t[8];let k=De,[A,Oe]=(0,I.useState)(0),j=(0,I.useRef)(O),ke=(0,I.useRef)(Te),Ae=(0,I.useRef)(D),je=(0,I.useRef)(S),M=(0,I.useRef)(null),Me=(0,I.useRef)(!1),Ne;if(t[9]!==h){Ne=[];let e=new Set;for(let t of h){let n=t.trim();n.length===0||e.has(n)||(e.add(n),Ne.push(n))}t[9]=h,t[10]=Ne}else Ne=t[10];let N=Ne,P=N.length===0?``:N.includes(g)?g:N[0]??``,Ie;bb0:{if(N.length===0){let e;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[11]=e):e=t[11],Ie=e;break bb0}let e;t[12]===N?e=t[13]:(e=new Set(N),t[12]=N,t[13]=e);let n=e,r;if(t[14]!==N||t[15]!==re||t[16]!==n){let e=new Set,i=new Set;r=[];let a=e=>{if(!i.has(e))return i.add(e),e;let t=2;for(;i.has(`${e}-${t}`);)t+=1;let n=`${e}-${t}`;return i.add(n),n};for(let t of re){let i=[],o=new Set;for(let r of t.terminalIds){let t=r.trim();t.length!==0&&(o.has(t)||(o.add(t),n.has(t)&&(e.has(t)||i.push(t))))}if(i.length===0)continue;for(let t of i)e.add(t);let s=t.id.trim().length>0?t.id.trim():`group-${i[0]??N[0]??``}`;r.push({id:a(s),terminalIds:i,...t.splitDirection===`vertical`?{splitDirection:`vertical`}:{}})}for(let t of N)e.has(t)||r.push({id:a(`group-${t}`),terminalIds:[t]});let o=new Map(N.map(Bn));r.sort((e,t)=>{let n=e=>Math.min(...e.map(e=>o.get(e)??1/0));return n(e.terminalIds)-n(t.terminalIds)}),t[14]=N,t[15]=re,t[16]=n,t[17]=r}else r=t[17];Ie=r}let F=Ie,Le;bb1:{let e=F.findIndex(e=>e.id===ie);if(e>=0){Le=e;break bb1}let t=F.findIndex(e=>e.terminalIds.includes(P));Le=t>=0?t:0}let Re=Le,Be;t[18]!==N.length||t[19]!==Re||t[20]!==P||t[21]!==F?(Be=F[Re]?.terminalIds??(N.length>0?[P]:[]),t[18]=N.length,t[19]=Re,t[20]=P,t[21]=F,t[22]=Be):Be=t[22];let Ve=Be,R=F[Re]?.splitDirection??`horizontal`,z=N.length>1,He=Ve.length>1,Ue;t[23]===F?Ue=t[24]:(Ue=F.length>1||F.some(zn),t[23]=F,t[24]=Ue);let We=Ue,B=Ve.length>=4,V;if(t[25]!==N||t[26]!==ge){V=new Map;for(let e of N)V.set(e,ge?.get(e)??Pe(e));t[25]=N,t[26]=ge,t[27]=V}else V=t[27];let H=V,Ge;t[28]!==c||t[29]!==d||t[30]!==_e||t[31]!==l?(Ge=e=>_e?.get(e)??{cwd:c,...l===void 0?{}:{worktreePath:l},...d?{runtimeEnv:d}:{}},t[28]=c,t[29]=d,t[30]=_e,t[31]=l,t[32]=Ge):Ge=t[32];let U=Ge,Ke=B?`Split Terminal Horizontally (max 4 per group)`:ce?`Split Terminal Horizontally (${ce})`:`Split Terminal Horizontally`,W=B?`Split Terminal Vertically (max 4 per group)`:le?`Split Terminal Vertically (${le})`:`Split Terminal Vertically`,G=fe?`New Terminal (${fe})`:`New Terminal`,K=x?`Close Terminal (${x})`:`Close Terminal`,qe;t[33]!==T||t[34]!==B||t[35]!==oe?(qe=()=>{T&&!B&&oe()},t[33]=T,t[34]=B,t[35]=oe,t[36]=qe):qe=t[36];let Je=qe,Ye;t[37]!==T||t[38]!==B||t[39]!==se?(Ye=()=>{T&&!B&&se()},t[37]=T,t[38]=B,t[39]=se,t[40]=Ye):Ye=t[40];let Xe=Ye,q;t[41]!==T||t[42]!==b?(q=()=>{T&&b()},t[41]=T,t[42]=b,t[43]=q):q=t[43];let J=q,Y;t[44]!==T||t[45]!==me||t[46]!==H||t[47]!==i.environmentId?(Y=e=>{T&&on([H.get(e)??Pe(e)]).then(t=>{t&&de(i.environmentId,`terminal:operate`)&&me(e)})},t[44]=T,t[45]=me,t[46]=H,t[47]=i.environmentId,t[48]=Y):Y=t[48];let X=Y,Ze,Qe;t[49]===S?(Ze=t[50],Qe=t[51]):(Ze=()=>{je.current=S},Qe=[S],t[49]=S,t[50]=Ze,t[51]=Qe),(0,I.useEffect)(Ze,Qe);let $e,et;t[52]===O?($e=t[53],et=t[54]):($e=()=>{let e=M.current;if(e){e.drawer?.style.setProperty(`height`,`${j.current}px`);return}j.current=O},et=[O],t[52]=O,t[53]=$e,t[54]=et),(0,I.useLayoutEffect)($e,et);let tt,nt;t[55]===Te?(tt=t[56],nt=t[57]):(tt=()=>{ke.current=Te},nt=[Te],t[55]=Te,t[56]=tt,t[57]=nt),(0,I.useEffect)(tt,nt);let rt;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(rt=e=>{Ae.current!==e&&(Ae.current=e,je.current(e))},t[58]=rt):rt=t[58];let it=rt,at;t[59]===D?at=t[60]:(at=()=>{Ae.current=D},t[59]=D,t[60]=at);let ot;t[61]!==D||t[62]!==a?(ot=[D,a],t[61]=D,t[62]=a,t[63]=ot):ot=t[63],(0,I.useEffect)(at,ot);let Z;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(Z=e=>{e.button===0&&(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),Me.current=!1,M.current={pointerId:e.pointerId,startY:e.clientY,startHeight:j.current,drawer:e.currentTarget.parentElement})},t[64]=Z):Z=t[64];let st=Z,ct;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(ct=e=>{let t=M.current;if(!t||t.pointerId!==e.pointerId)return;e.preventDefault();let n=gn(t.startHeight+(t.startY-e.clientY));n!==j.current&&(Me.current=!0,j.current=n,t.drawer?.style.setProperty(`height`,`${n}px`))},t[65]=ct):ct=t[65];let lt=ct,ut;t[66]===k?ut=t[67]:(ut=e=>{let t=M.current;if(t&&t.pointerId===e.pointerId){if(M.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),!Me.current||j.current===t.startHeight){let e=gn(ke.current);j.current=e,t.drawer?.style.setProperty(`height`,`${e}px`);return}k(j.current),it(j.current),Oe(Rn)}},t[66]=k,t[67]=ut);let Q=ut,dt,ft;t[68]===w?(dt=t[69],ft=t[70]):(dt=()=>{if(!w)return;let e=()=>{let e=M.current,t=gn(j.current);e&&t!==j.current&&(j.current=t,e.drawer?.style.setProperty(`height`,`${t}px`)),xe(hn()),Oe(Ln)};return window.addEventListener(`resize`,e),()=>{window.removeEventListener(`resize`,e)}},ft=[w],t[68]=w,t[69]=dt,t[70]=ft),(0,I.useEffect)(dt,ft);let pt,mt;t[71]===w?(pt=t[72],mt=t[73]):(pt=()=>{w&&(xe(hn()),Oe(In))},mt=[w],t[71]=w,t[72]=pt,t[73]=mt),(0,I.useEffect)(pt,mt);let ht,gt;if(t[74]===Symbol.for(`react.memo_cache_sentinel`)?(ht=()=>()=>{it(ke.current)},gt=[it],t[74]=ht,t[75]=gt):(ht=t[74],gt=t[75]),(0,I.useEffect)(ht,gt),N.length===0){let e=E?`right-panel`:`drawer`,n=E?`h-full flex-1`:`shrink-0 border-t border-border/80`,r;t[76]===n?r=t[77]:(r=_(`relative flex min-w-0 flex-col overflow-hidden bg-background`,n),t[76]=n,t[77]=r);let i;t[78]!==O||t[79]!==E?(i=E?void 0:{height:`${O}px`},t[78]=O,t[79]=E,t[80]=i):i=t[80];let a;t[81]!==Q||t[82]!==E?(a=E?null:(0,L.jsx)(`div`,{className:`absolute inset-x-0 top-0 z-20 h-1.5 cursor-row-resize`,onPointerDown:st,onPointerMove:lt,onPointerUp:Q,onPointerCancel:Q,onLostPointerCapture:Q}),t[81]=Q,t[82]=E,t[83]=a):a=t[83];let o;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,L.jsx)(`p`,{children:`No terminal sessions for this thread yet.`}),t[84]=o):o=t[84];let s=!T,c;t[85]!==G||t[86]!==J||t[87]!==s?(c=(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center gap-3 px-4 py-6 text-center text-sm text-muted-foreground`,children:[o,(0,L.jsx)(te,{size:`xs`,variant:`outline`,onClick:J,disabled:s,children:G})]}),t[85]=G,t[86]=J,t[87]=s,t[88]=c):c=t[88];let l;return t[89]!==e||t[90]!==r||t[91]!==i||t[92]!==a||t[93]!==c?(l=(0,L.jsxs)(`aside`,{"data-thread-terminal-drawer":!0,"data-terminal-owner":e,className:r,style:i,children:[a,c]}),t[89]=e,t[90]=r,t[91]=i,t[92]=a,t[93]=c,t[94]=l):l=t[94],l}let $;t[95]!==U||t[96]!==P?($=U(P),t[95]=U,t[96]=P,t[97]=$):$=t[97];let _t=$,vt=E?`right-panel`:`drawer`,yt=E?`h-full flex-1`:`shrink-0 border-t border-border/80`,bt;t[98]===yt?bt=t[99]:(bt=_(`relative flex min-w-0 flex-col overflow-hidden bg-background`,yt),t[98]=yt,t[99]=bt);let xt;t[100]!==O||t[101]!==E?(xt=E?void 0:{height:`${O}px`},t[100]=O,t[101]=E,t[102]=xt):xt=t[102];let St;t[103]!==Q||t[104]!==E?(St=E?null:(0,L.jsx)(`div`,{className:`absolute inset-x-0 top-0 z-20 h-1.5 cursor-row-resize`,onPointerDown:st,onPointerMove:lt,onPointerUp:Q,onPointerCancel:Q,onLostPointerCapture:Q}),t[103]=Q,t[104]=E,t[105]=St):St=t[105];let Ct;t[106]!==T||t[107]!==K||t[108]!==X||t[109]!==B||t[110]!==z||t[111]!==G||t[112]!==J||t[113]!==Je||t[114]!==Xe||t[115]!==P||t[116]!==Ke||t[117]!==W?(Ct=!z&&(0,L.jsx)(`div`,{className:`pointer-events-none absolute right-2 top-2 z-20`,children:(0,L.jsxs)(`div`,{className:`pointer-events-auto inline-flex items-center overflow-hidden rounded-md border border-border/80 bg-background shadow-xs`,children:[(0,L.jsx)(Pn,{disabled:!T,className:`p-1 text-foreground/90 transition-colors ${B?`cursor-not-allowed opacity-64 hover:bg-transparent`:`hover:bg-accent`}`,onClick:Je,label:Ke,children:(0,L.jsx)(v,{className:`size-3.25`})}),(0,L.jsx)(`div`,{className:`h-4 w-px bg-border/80`}),(0,L.jsx)(Pn,{disabled:!T,className:`p-1 text-foreground/90 transition-colors ${B?`cursor-not-allowed opacity-64 hover:bg-transparent`:`hover:bg-accent`}`,onClick:Xe,label:W,children:(0,L.jsx)(m,{className:`size-3.25`})}),(0,L.jsx)(`div`,{className:`h-4 w-px bg-border/80`}),(0,L.jsx)(Pn,{disabled:!T,className:`p-1 text-foreground/90 transition-colors hover:bg-accent`,onClick:J,label:G,children:(0,L.jsx)(u,{className:`size-3.25`})}),(0,L.jsx)(`div`,{className:`h-4 w-px bg-border/80`}),(0,L.jsx)(Pn,{disabled:!T,className:`p-1 text-foreground/90 transition-colors hover:bg-accent`,onClick:()=>X(P),label:K,children:(0,L.jsx)(r,{className:`size-3.25`})})]})}),t[106]=T,t[107]=K,t[108]=X,t[109]=B,t[110]=z,t[111]=G,t[112]=J,t[113]=Je,t[114]=Xe,t[115]=P,t[116]=Ke,t[117]=W,t[118]=Ct):Ct=t[118];let wt=z&&`gap-1.5`,Tt;t[119]===wt?Tt=t[120]:(Tt=_(`flex h-full min-h-0 bg-(--terminal-background)`,wt),t[119]=wt,t[120]=Tt);let Et;t[121]!==_t||t[122]!==ye||t[123]!==O||t[124]!==ae||t[125]!==He||t[126]!==he||t[127]!==pe||t[128]!==C||t[129]!==me||t[130]!==A||t[131]!==U||t[132]!==P||t[133]!==R||t[134]!==H||t[135]!==a||t[136]!==i||t[137]!==w||t[138]!==Ve?(Et=(0,L.jsx)(`div`,{className:`min-w-0 flex-1`,children:He?(0,L.jsx)(`div`,{className:`grid h-full w-full min-w-0 gap-0 overflow-hidden`,style:R===`vertical`?{gridTemplateRows:`repeat(${Ve.length}, minmax(0, 1fr))`}:{gridTemplateColumns:`repeat(${Ve.length}, minmax(0, 1fr))`},children:Ve.map(e=>{let t=U(e);return(0,L.jsx)(`div`,{className:`min-h-0 min-w-0 ${R===`vertical`?`border-t first:border-t-0`:`border-l first:border-l-0`} ${e===P?`border-border`:`border-border/70`}`,onPointerDown:()=>{e!==P&&pe(e)},children:(0,L.jsx)(`div`,{className:`h-full`,children:(0,L.jsx)(Nn,{advancedTypography:ye,threadRef:i,threadId:a,terminalId:e,terminalLabel:H.get(e)??`Terminal`,cwd:t.cwd,...t.worktreePath===void 0?{}:{worktreePath:t.worktreePath},...t.runtimeEnv?{runtimeEnv:t.runtimeEnv}:{},onSessionExited:()=>me(e),onAddTerminalContext:C,focusRequestId:ae,autoFocus:e===P,visible:w,resizeEpoch:A,drawerHeight:O,keybindings:he})})},e)})}):(0,L.jsx)(`div`,{className:`h-full`,children:(0,L.jsx)(Nn,{advancedTypography:ye,threadRef:i,threadId:a,terminalId:P,terminalLabel:H.get(P)??`Terminal`,cwd:_t.cwd,..._t.worktreePath===void 0?{}:{worktreePath:_t.worktreePath},..._t.runtimeEnv?{runtimeEnv:_t.runtimeEnv}:{},onSessionExited:()=>me(P),onAddTerminalContext:C,focusRequestId:ae,autoFocus:!0,visible:w,resizeEpoch:A,drawerHeight:O,keybindings:he},P)})}),t[121]=_t,t[122]=ye,t[123]=O,t[124]=ae,t[125]=He,t[126]=he,t[127]=pe,t[128]=C,t[129]=me,t[130]=A,t[131]=U,t[132]=P,t[133]=R,t[134]=H,t[135]=a,t[136]=i,t[137]=w,t[138]=Ve,t[139]=Et):Et=t[139];let Dt;t[140]!==T||t[141]!==x||t[142]!==K||t[143]!==X||t[144]!==B||t[145]!==z||t[146]!==G||t[147]!==pe||t[148]!==J||t[149]!==Je||t[150]!==Xe||t[151]!==P||t[152]!==F||t[153]!==We||t[154]!==Ke||t[155]!==W||t[156]!==H?(Dt=z&&(0,L.jsxs)(`aside`,{className:`flex w-36 min-w-36 flex-col border border-border/70 bg-muted/10`,children:[(0,L.jsx)(`div`,{className:`flex h-[22px] items-stretch justify-end border-b border-border/70`,children:(0,L.jsxs)(`div`,{className:`inline-flex h-full items-stretch`,children:[(0,L.jsx)(Pn,{disabled:!T,className:`inline-flex h-full items-center px-1 text-foreground/90 transition-colors ${B?`cursor-not-allowed opacity-64 hover:bg-transparent`:`hover:bg-accent/70`}`,onClick:Je,label:Ke,children:(0,L.jsx)(v,{className:`size-3.25`})}),(0,L.jsx)(Pn,{disabled:!T,className:`inline-flex h-full items-center border-l border-border/70 px-1 text-foreground/90 transition-colors ${B?`cursor-not-allowed opacity-64 hover:bg-transparent`:`hover:bg-accent/70`}`,onClick:Xe,label:W,children:(0,L.jsx)(m,{className:`size-3.25`})}),(0,L.jsx)(Pn,{disabled:!T,className:`inline-flex h-full items-center border-l border-border/70 px-1 text-foreground/90 transition-colors hover:bg-accent/70`,onClick:J,label:G,children:(0,L.jsx)(u,{className:`size-3.25`})}),(0,L.jsx)(Pn,{disabled:!T,className:`inline-flex h-full items-center border-l border-border/70 px-1 text-foreground/90 transition-colors hover:bg-accent/70`,onClick:()=>X(P),label:K,children:(0,L.jsx)(r,{className:`size-3.25`})})]})}),(0,L.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-1 py-1`,children:F.map(e=>{let t=e.terminalIds.includes(P),n=t?P:e.terminalIds[0]??P,r=e.terminalIds.length,i=r>1,a=i?e.splitDirection===`vertical`?`Stacked`:`Side by side`:`Single`,o=i?e.splitDirection===`vertical`?m:v:ee;return(0,L.jsxs)(`div`,{className:`pb-0.5`,children:[We&&(0,L.jsxs)(`button`,{type:`button`,className:`flex h-[22px] w-full cursor-pointer items-center gap-1 rounded px-1.5 text-2xs ${t?`bg-accent/50 text-foreground`:`text-muted-foreground hover:bg-accent/40 hover:text-foreground`}`,onClick:()=>pe(n),children:[(0,L.jsx)(o,{className:`size-3 shrink-0`}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:a}),(0,L.jsx)(`span`,{className:`text-muted-foreground/70 text-3xs tabular-nums`,children:r})]}),(0,L.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:e.terminalIds.map(e=>{let t=e===P,n=H.get(e)??`Terminal`,r=`Close ${n}${t&&x?` (${x})`:``}`;return(0,L.jsxs)(`div`,{className:_(`group/tab flex h-6 w-full items-center gap-0.5 rounded-md pr-2 pl-1.5 text-xs`,t?`bg-accent text-foreground`:`text-muted-foreground hover:bg-accent/60 hover:text-foreground`),children:[T?(0,L.jsx)(nn,{label:r,onClick:()=>X(e),tooltip:r,children:(0,L.jsx)(y,{className:`size-3 shrink-0`})}):(0,L.jsx)(y,{className:`size-3 shrink-0`}),(0,L.jsx)(`button`,{type:`button`,className:`flex min-w-0 flex-1 cursor-pointer items-center gap-1 text-left`,onClick:()=>pe(e),children:(0,L.jsx)(`span`,{className:`truncate`,children:n})})]},e)})})]},e.id)})})]}),t[140]=T,t[141]=x,t[142]=K,t[143]=X,t[144]=B,t[145]=z,t[146]=G,t[147]=pe,t[148]=J,t[149]=Je,t[150]=Xe,t[151]=P,t[152]=F,t[153]=We,t[154]=Ke,t[155]=W,t[156]=H,t[157]=Dt):Dt=t[157];let Ot;t[158]!==Tt||t[159]!==Et||t[160]!==Dt?(Ot=(0,L.jsx)(`div`,{className:`min-h-0 w-full flex-1`,children:(0,L.jsxs)(`div`,{className:Tt,children:[Et,Dt]})}),t[158]=Tt,t[159]=Et,t[160]=Dt,t[161]=Ot):Ot=t[161];let kt;return t[162]!==vt||t[163]!==bt||t[164]!==xt||t[165]!==St||t[166]!==Ct||t[167]!==Ot?(kt=(0,L.jsxs)(`aside`,{"data-thread-terminal-drawer":!0,"data-terminal-owner":vt,className:bt,style:xt,children:[St,Ct,Ot]}),t[162]=vt,t[163]=bt,t[164]=xt,t[165]=St,t[166]=Ct,t[167]=Ot,t[168]=kt):kt=t[168],kt}function In(e){return e+1}function Ln(e){return e+1}function Rn(e){return e+1}function zn(e){return e.terminalIds.length>1}function Bn(e,t){return[e,t]}export{dn as a,tn as c,fn as i,Ve as l,Fn as n,on as o,Dn as r,an as s,Nn as t,Be as u};
|
|
5
|
-
//# sourceMappingURL=ThreadTerminalDrawer-D_GQQ1Ly.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{i as e,t}from"./rolldown-runtime-Dd_uD5pT.js";import{r as n}from"./Icon-l19w4AjM.js";import{AE as r,Ar as i,Ba as a,Bi as o,CE as s,Ca as c,Co as l,DE as u,Di as d,EE as f,Eo as p,Fa as m,Fi as h,Ga as g,Ia as _,Ja as v,Km as y,La as b,ME as x,NE as S,OE as C,Or as w,Pr as T,Qr as E,Ra as D,SE as O,Si as k,So as A,TE as j,Ta as ee,Ti as M,Tr as N,Ym as P,Zi as F,_E as I,_a as L,_i as te,_o as R,aa as z,bE as B,ca as V,ci as H,co as ne,dE as re,di as ie,fE as ae,fi as oe,fo as se,gE as ce,ga as le,gi as ue,hE as de,ho as fe,ia as pe,ii as me,io as he,jE as ge,jr as _e,kE as ve,kr as ye,lE as be,la as xe,li as Se,lo as Ce,mE as we,ma as Te,mi as Ee,na as De,ni as Oe,oi as ke,pE as Ae,pa as je,pi as Me,po as Ne,qm as Pe,ri as Fe,si as Ie,ta as Le,ti as Re,uE as ze,ua as Be,ui as Ve,vE as He,va as Ue,vi as We,vo as Ge,wE as Ke,xE as qe,xa as Je,xi as Ye,xr as Xe,yE as Ze,yo as Qe,za as $e}from"./utils-ChK8VEFC.js";var U=e(n()),W=e(be()),et=U.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new je,currentIdRef:{current:null},currentContextRef:{current:null}});function tt(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=U.useRef(n),a=U.useRef(n),o=U.useRef(null),s=U.useRef(null),c=Te();return(0,W.jsx)(et.Provider,{value:U.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function nt(e,t={open:!1}){let{open:n}=t,r=`rootStore`in e?e.rootStore:e,i=r.useState(`floatingId`),{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:l,currentContextRef:u,hasProvider:d,timeout:f}=U.useContext(et),[p,h]=U.useState(!1);return m(()=>{function e(){h(!1),u.current?.setIsInstantPhase(!1),a.current=null,u.current=null,o.current=l.current}if(a.current&&!n&&a.current===i){if(h(!1),s){let t=i;return f.start(s,()=>{r.select(`open`)||a.current&&a.current!==t||e()}),()=>{f.clear()}}e()}},[n,i,a,o,s,l,u,f,r]),m(()=>{if(!n)return;let e=u.current,t=a.current;f.clear(),u.current={onOpenChange:r.setOpen,setIsInstantPhase:h},a.current=i,o.current={open:0,close:z(l.current,`close`)},t!==null&&t!==i?(h(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,c(he))):(h(!1),e?.setIsInstantPhase(!1))},[n,i,r,a,o,l,u,f]),m(()=>()=>{u.current=null},[u]),U.useMemo(()=>({hasProvider:d,delayRef:o,isInstantPhase:p}),[d,o,p])}function rt(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function it(e){return e!=null&&e.clientX!=null}function at(e,t={}){let{enabled:n=!0,axis:r=`both`}=t,i=`rootStore`in e?e.rootStore:e,a=i.useState(`open`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.context.dataRef,l=U.useRef(!1),u=U.useRef(null),[d,f]=U.useState(),[p,m]=U.useState([]),h=_(e=>{i.set(`positionReference`,e)}),g=_((e,t,n)=>{l.current||(!c.current.openEvent||it(c.current.openEvent))&&i.set(`positionReference`,rt(n??s,{x:e,y:t,axis:r,dataRef:c,pointerType:d}))}),v=_(e=>{a?u.current||(g(e.clientX,e.clientY,e.currentTarget),m([])):g(e.clientX,e.clientY,e.currentTarget)}),y=Be(d)?o:a;U.useEffect(()=>{if(!n){h(s);return}if(!y)return;function e(){u.current?.(),u.current=null}let t=D(o);function r(t){let n=xe(t);V(o,n)?e():g(t.clientX,t.clientY)}return!c.current.openEvent||it(c.current.openEvent)?u.current=pe(t,`mousemove`,r):h(s),e},[y,n,o,c,s,i,g,h,p]),U.useEffect(()=>()=>{i.set(`positionReference`,null)},[i]),U.useEffect(()=>{n&&!o&&(l.current=!1)},[n,o]),U.useEffect(()=>{!n&&a&&(l.current=!0)},[n,a]);let b=U.useMemo(()=>{function e(e){f(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:v,onMouseEnter:v}},[v]);return U.useMemo(()=>n?{reference:b,trigger:b}:{},[n,b])}var ot=S(),st=e(Ue());function ct(e){let[t,n]=U.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}function lt(e){let t=b(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=a(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r;return(F(n)!==o||F(r)!==s)&&(n=o,r=s),{width:n,height:r}}var ut=()=>!0;function dt(e){let{popupElement:t,positionerElement:n,content:r,mounted:i,enabled:a=ut,onMeasureLayout:o,onMeasureLayoutComplete:s,side:c,direction:u}=e,d=L(t,!0,!1),f=Je(),p=U.useRef(null),h=U.useRef(null),g=U.useRef(!0),v=U.useRef(l),y=_(o),b=_(s),x=U.useMemo(()=>{let e=c===`top`,t=c===`left`;return u===`rtl`?(e||=c===`inline-end`,t||=c===`inline-end`):(e||=c===`inline-start`,t||=c===`inline-start`),e?{position:`absolute`,[c===`top`?`bottom`:`top`]:`0`,[t?`right`:`left`]:`0`}:A},[c,u]);m(()=>{if(!i||!a()||typeof ResizeObserver!=`function`){v.current=l,g.current=!0,p.current=null,h.current=null;return}if(!t||!n)return;v.current=pt(t,x);let e=new ResizeObserver(e=>{let t=e[0];t&&(h.current={width:Math.ceil(t.borderBoxSize[0].inlineSize),height:Math.ceil(t.borderBoxSize[0].blockSize)})});e.observe(t),mt(t,`auto`);let r=ft(t,`position`,`static`),o=ft(t,`transform`,`none`),s=ft(t,`scale`,`1`),c=pt(n,{"--available-width":`max-content`,"--available-height":`max-content`});function u(){r(),o(),c()}function m(){u(),s()}if(y?.(),g.current||p.current===null){G(n,`max-content`);let r=lt(t);return p.current=r,G(n,r),m(),b?.(null,r),g.current=!1,()=>{e.disconnect(),v.current(),v.current=l}}mt(t,`auto`),G(n,`max-content`);let _=p.current??h.current,S=lt(t);if(p.current=S,!_)return G(n,S),m(),b?.(null,S),()=>{e.disconnect(),f.cancel(),v.current(),v.current=l};mt(t,_),m(),b?.(_,S),G(n,S);let C=new AbortController;return f.request(()=>{mt(t,S),d(()=>{t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`)},C.signal)}),()=>{e.disconnect(),C.abort(),f.cancel(),v.current(),v.current=l}},[r,t,n,d,f,a,i,y,b,x])}function ft(e,t,n){let r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}function pt(e,t){let n=[];for(let[r,i]of Object.entries(t))n.push(ft(e,r,i));return n.length?()=>{n.forEach(e=>e())}:l}function mt(e,t){let n=t===`auto`?`auto`:`${t.width}px`,r=t===`auto`?`auto`:`${t.height}px`;e.style.setProperty(`--popup-width`,n),e.style.setProperty(`--popup-height`,r)}function G(e,t){let n=t===`max-content`?`max-content`:`${t.width}px`,r=t===`max-content`?`max-content`:`${t.height}px`;e.style.setProperty(`--positioner-width`,n),e.style.setProperty(`--positioner-height`,r)}function ht(e){let{store:t,side:n,cssVars:r,children:a}=e,o=i(),s=t.useState(`activeTriggerElement`),c=t.useState(`activeTriggerId`),l=t.useState(`open`),u=t.useState(`payload`),d=t.useState(`mounted`),f=t.useState(`popupElement`),p=t.useState(`positionerElement`),h=ct(l?s:null),g=yt(c,u),v=U.useRef(null),[y,b]=U.useState(null),[x,S]=U.useState(null),C=U.useRef(null),w=U.useRef(null),T=L(C,!0,!1),E=Je(),[D,O]=U.useState(null),[k,A]=U.useState(!1);m(()=>(t.set(`hasViewport`,!0),()=>{t.set(`hasViewport`,!1)}),[t]);let j=_(()=>{C.current?.style.setProperty(`animation`,`none`),C.current?.style.setProperty(`transition`,`none`),w.current?.style.setProperty(`display`,`none`)}),ee=_(e=>{C.current?.style.removeProperty(`animation`),C.current?.style.removeProperty(`transition`),w.current?.style.removeProperty(`display`),e&&O(e)}),M=U.useRef(null);m(()=>{if(s&&h&&s!==h&&M.current!==s&&v.current){b(v.current),A(!0);let e=vt(h,s);S(e),E.request(()=>{st.flushSync(()=>{A(!1)}),T(()=>{b(null),O(null),v.current=null})}),M.current=s}},[s,h,y,T,E]),m(()=>{let e=C.current;if(!e)return;let t=Le(e).createElement(`div`);for(let n of Array.from(e.childNodes))t.appendChild(n.cloneNode(!0));v.current=t});let N=y!=null,P;P=N?(0,W.jsxs)(U.Fragment,{children:[(0,W.jsx)(`div`,{"data-previous":!0,inert:_e(!0),ref:w,style:{...D?{[r.popupWidth]:`${D.width}px`,[r.popupHeight]:`${D.height}px`}:null,position:`absolute`},"data-ending-style":k?void 0:``},`previous`),(0,W.jsx)(`div`,{"data-current":!0,ref:C,"data-starting-style":k?``:void 0,children:a},g)]}):(0,W.jsx)(`div`,{"data-current":!0,ref:C,children:a},g),m(()=>{let e=w.current;e&&y&&e.replaceChildren(...Array.from(y.childNodes))},[y]),dt({popupElement:f,positionerElement:p,mounted:d,content:u,onMeasureLayout:j,onMeasureLayoutComplete:ee,side:n,direction:o});let F={activationDirection:gt(x),transitioning:N};return{children:P,state:F}}function gt(e){if(e)return`${_t(e.horizontal,5,`right`,`left`)} ${_t(e.vertical,5,`down`,`up`)}`}function _t(e,t,n,r){return e>t?n:e<-t?r:``}function vt(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i={x:n.left+n.width/2,y:n.top+n.height/2},a={x:r.left+r.width/2,y:r.top+r.height/2};return{horizontal:a.x-i.x,vertical:a.y-i.y}}function yt(e,t){let[n,r]=U.useState(0),i=U.useRef(e),a=U.useRef(t),o=U.useRef(!1);return m(()=>{let n=i.current,s=a.current,c=e!==n,l=t!==s;c?(r(e=>e+1),o.current=!l):o.current&&l&&(r(e=>e+1),o.current=!1),i.current=e,a.current=t},[e,t]),`${e??`current`}-${n}`}var K=e(t((e=>{e.Check=[[`path`,{d:`M20 6 9 17l-5-5`}]],e.ChevronDown=[[`path`,{d:`m6 9 6 6 6-6`}]],e.ChevronRight=[[`path`,{d:`m9 18 6-6-6-6`}]],e.ChevronUp=[[`path`,{d:`m18 15-6-6-6 6`}]],e.ChevronsDownUp=[[`path`,{d:`m7 20 5-5 5 5`}],[`path`,{d:`m7 4 5 5 5-5`}]],e.ChevronsUpDown=[[`path`,{d:`m7 15 5 5 5-5`}],[`path`,{d:`m7 9 5-5 5 5`}]],e.Circle=[[`circle`,{cx:`12`,cy:`12`,r:`10`}]],e.CircleAlert=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`}]],e.CircleCheck=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`m9 12 2 2 4-4`}]],e.Code2=[[`path`,{d:`m18 16 4-4-4-4`}],[`path`,{d:`m6 8-4 4 4 4`}],[`path`,{d:`m14.5 4-5 16`}]],e.Copy=[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`}]],e.CornerUpRight=[[`path`,{d:`m15 14 5-5-5-5`}],[`path`,{d:`M4 20v-7a4 4 0 0 1 4-4h12`}]],e.Eye=[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`}]],e.FoldVertical=[[`path`,{d:`M12 22v-6`}],[`path`,{d:`M12 8V2`}],[`path`,{d:`M4 12H2`}],[`path`,{d:`M10 12H8`}],[`path`,{d:`M16 12h-2`}],[`path`,{d:`M22 12h-2`}],[`path`,{d:`m15 19-3-3-3 3`}],[`path`,{d:`m15 5-3 3-3-3`}]],e.Folder=[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`}]],e.FolderClosed=[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`}],[`path`,{d:`M2 10h20`}]],e.FolderOpen=[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`}]],e.Image=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`}],[`circle`,{cx:`9`,cy:`9`,r:`2`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`}]],e.Link=[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`}]],e.ListPlus=[[`path`,{d:`M16 5H3`}],[`path`,{d:`M11 12H3`}],[`path`,{d:`M16 19H3`}],[`path`,{d:`M18 9v6`}],[`path`,{d:`M21 12h-6`}]],e.Lock=[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`}]],e.LockOpen=[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`}],[`path`,{d:`M7 11V7a5 5 0 0 1 9.9-1`}]],e.Maximize2=[[`path`,{d:`M15 3h6v6`}],[`path`,{d:`m21 3-7 7`}],[`path`,{d:`m3 21 7-7`}],[`path`,{d:`M9 21H3v-6`}]],e.Minimize2=[[`path`,{d:`m14 10 7-7`}],[`path`,{d:`M20 10h-6V4`}],[`path`,{d:`m3 21 7-7`}],[`path`,{d:`M4 14h6v6`}]],e.Minus=[[`path`,{d:`M5 12h14`}]],e.Moon=[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`}]],e.PanelLeft=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M9 3v18`}]],e.PanelLeftClose=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M9 3v18`}],[`path`,{d:`m16 15-3-3 3-3`}]],e.Plus=[[`path`,{d:`M5 12h14`}],[`path`,{d:`M12 5v14`}]],e.Sun=[[`circle`,{cx:`12`,cy:`12`,r:`4`}],[`path`,{d:`M12 2v2`}],[`path`,{d:`M12 20v2`}],[`path`,{d:`m4.93 4.93 1.41 1.41`}],[`path`,{d:`m17.66 17.66 1.41 1.41`}],[`path`,{d:`M2 12h2`}],[`path`,{d:`M20 12h2`}],[`path`,{d:`m6.34 17.66-1.41 1.41`}],[`path`,{d:`m19.07 4.93-1.41 1.41`}]],e.Table2=[[`path`,{d:`M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18`}]],e.Text=[[`path`,{d:`M21 5H3`}],[`path`,{d:`M15 12H3`}],[`path`,{d:`M17 19H3`}]],e.UnfoldVertical=[[`path`,{d:`M12 22v-6`}],[`path`,{d:`M12 8V2`}],[`path`,{d:`M4 12H2`}],[`path`,{d:`M10 12H8`}],[`path`,{d:`M16 12h-2`}],[`path`,{d:`M22 12h-2`}],[`path`,{d:`m15 19-3 3-3-3`}],[`path`,{d:`m15 5-3-3-3 3`}]],e.Volume2=[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`}]],e.VolumeOff=[[`path`,{d:`M16 9a5 5 0 0 1 .95 2.293`}],[`path`,{d:`M19.364 5.636a9 9 0 0 1 1.889 9.96`}],[`path`,{d:`m2 2 20 20`}],[`path`,{d:`m7 7-.587.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298V11`}],[`path`,{d:`M9.828 4.172A.686.686 0 0 1 11 4.657v.686`}]]}))(),1),bt=y(K.Check,ae),xt=y(K.ChevronDown,Ae),St=y(K.ChevronRight,we),Ct=y(K.ChevronUp,de),wt=y(K.ChevronsDownUp,null),Tt=y(K.ChevronsUpDown,null),Et=y(K.Circle,ce),Dt=y(K.CircleAlert,re),Ot=y(K.CircleCheck,r),kt=y(K.Code2,I),At=y(K.Copy,He),jt=y(K.CornerUpRight,null),Mt=y(K.Eye,null),Nt=y(K.FoldVertical,null),Pt=y(K.Folder,Ze),Ft=y(K.FolderClosed,Ze),It=y(K.FolderOpen,B),Lt=y(K.Image,qe),Rt=y(K.Link,O),zt=y(K.ListPlus,null),Bt=y(K.Lock,null),Vt=y(K.LockOpen,null),Ht=y(K.Maximize2,s),Ut=y(K.Minimize2,null),Wt=y(K.Minus,Ke),Gt=y(K.Moon,j),Kt=y(K.PanelLeft,f),qt=y(K.PanelLeftClose,null),Jt=y(K.Plus,ze),Yt=y(K.Sun,u),Xt=y(K.Table2,C),Zt=y(K.Text,ve),Qt=y(K.UnfoldVertical,null),$t=y(K.Volume2,ge),en=y(K.VolumeOff,x),tn=U.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{portalNode:c,portalSubtree:l}=h({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,W.jsxs)(U.Fragment,{children:[l,c&&st.createPortal(n,c)]})}),nn=`MmLlHhVvCcSsQqTtAaZz`;function rn(e){let t=[],n=e.length,r=0,i=0,a=0,o=0,s=0,c=null,l=``,u=0,d=0,f=``,p=!1,m=e=>{throw Error(`morphicons: ${e} at d[${r}]`)},h=e=>e>=48&&e<=57,g=()=>{for(;r<n;){let t=e.charCodeAt(r);if(t===32||t===9||t===10||t===13||t===12||t===44)r++;else break}},_=()=>{g();let t=r;r<n&&(e[r]===`+`||e[r]===`-`)&&r++;let i=!1;for(;r<n&&h(e.charCodeAt(r));)r++,i=!0;if(r<n&&e[r]===`.`)for(r++;r<n&&h(e.charCodeAt(r));)r++,i=!0;if(i||m(`expected number`),r<n&&(e[r]===`e`||e[r]===`E`)){let t=r;r++,r<n&&(e[r]===`+`||e[r]===`-`)&&r++;let i=!1;for(;r<n&&h(e.charCodeAt(r));)r++,i=!0;i||(r=t)}return Number(e.slice(t,r))},v=()=>{g();let t=e[r];return t===`0`||t===`1`?(r++,+(t===`1`)):m(`expected arc flag (0|1)`)},y=()=>(p||m(`path must start with M/m`),c||(c={x0:i,y0:a,segs:[],closed:!1},t.push(c)),c),b=!1,x=()=>_()+(b?i:0),S=()=>_()+(b?a:0);for(;g(),!(r>=n);){let n=e[r];switch(nn.includes(n)?(l=n,r++):l===``?m(`path must start with M/m`):l===`M`?l=`L`:l===`m`?l=`l`:(l===`Z`||l===`z`)&&m(`stray data after Z`),b=l>=`a`,b?l.toUpperCase():l){case`M`:{p=!0;let e=x(),n=S();i=e,a=n,o=e,s=n,c={x0:e,y0:n,segs:[],closed:!1},t.push(c),f=``;break}case`L`:{let e=x(),t=S();y().segs.push([`L`,e,t]),i=e,a=t,f=``;break}case`H`:{let e=x();y().segs.push([`L`,e,a]),i=e,f=``;break}case`V`:{let e=S();y().segs.push([`L`,i,e]),a=e,f=``;break}case`C`:case`S`:{let e,t;l===`C`||l===`c`?(e=x(),t=S()):(e=f===`C`?2*i-u:i,t=f===`C`?2*a-d:a);let n=x(),r=S(),o=x(),s=S();y().segs.push([`C`,e,t,n,r,o,s]),u=n,d=r,i=o,a=s,f=`C`;break}case`Q`:case`T`:{let e,t;l===`Q`||l===`q`?(e=x(),t=S()):(e=f===`Q`?2*i-u:i,t=f===`Q`?2*a-d:a);let n=x(),r=S();y().segs.push([`Q`,e,t,n,r]),u=e,d=t,i=n,a=r,f=`Q`;break}case`A`:{let e=_(),t=_(),n=_(),r=v(),o=v(),s=x(),c=S();y().segs.push([`A`,e,t,n,r,o,s,c]),i=s,a=c,f=``;break}case`Z`:c&&=(c.closed=!0,null),i=o,a=s,f=``;break;default:m(`unsupported command "${l}"`)}}return t.filter(e=>e.segs.length>0)}function an(e){return String(Math.round(e*100)/100)}function on(e,t){let n=``;for(let r=0;r<e.length;r++){let i=e[r],a=i.length/2;n+=`M${an(i[0])} ${an(i[1])}`;for(let e=1;e<a;e++)n+=`L${an(i[2*e])} ${an(i[2*e+1])}`;t?.[r]&&(n+=`Z`)}return n}function q(e){return String(Math.round(e*1e4)/1e4)}function sn(e){let t=``;for(let{pts:n,closed:r}of e){t+=`M${q(n[0])} ${q(n[1])}`;for(let e=2;e<n.length;e+=6)t+=`C${q(n[e])} ${q(n[e+1])} ${q(n[e+2])} ${q(n[e+3])} ${q(n[e+4])} ${q(n[e+5])}`;r&&(t+=`Z`)}return t}var cn=4/3*Math.tan(Math.PI/8),ln=2*Math.PI;function J(e,t){let n=[e,t],r=e,i=t,a=(e,t,a,o,s,c)=>{n.push(e,t,a,o,s,c),r=s,i=c},o=(e,t)=>{Math.abs(e-r)<1e-12&&Math.abs(t-i)<1e-12||a(r+(e-r)/3,i+(t-i)/3,r+2*(e-r)/3,i+2*(t-i)/3,e,t)};return[a,o,(e,t,n,o)=>{a(r+2/3*(e-r),i+2/3*(t-i),n+2/3*(e-n),o+2/3*(t-o),n,o)},(e,t,n,s,c,l,u)=>{let d=r,f=i;if(Math.abs(l-d)<1e-12&&Math.abs(u-f)<1e-12)return;let p=Math.abs(e),m=Math.abs(t);if(p<1e-12||m<1e-12){o(l,u);return}let h=n*Math.PI/180,g=Math.cos(h),_=Math.sin(h),v=(d-l)/2,y=(f-u)/2,b=g*v+_*y,x=-_*v+g*y,S=b*b/(p*p)+x*x/(m*m);if(S>1){let e=Math.sqrt(S);p*=e,m*=e}let C=p*p,w=m*m,T=b*b,E=x*x,D=(C*w-C*E-w*T)/(C*E+w*T);D<0&&(D=0);let O=(s===c?-1:1)*Math.sqrt(D),k=O*p*x/m,A=-O*m*b/p,j=g*k-_*A+(d+l)/2,ee=_*k+g*A+(f+u)/2,M=Math.atan2((x-A)/m,(b-k)/p),N=Math.atan2((-x-A)/m,(-b-k)/p)-M;c===0&&N>0?N-=ln:c===1&&N<0&&(N+=ln);let P=Math.max(1,Math.ceil(Math.abs(N)/(Math.PI/2)-1e-9)),F=N/P,I=4/3*Math.tan(F/4),L=e=>j+p*Math.cos(e)*g-m*Math.sin(e)*_,te=e=>ee+p*Math.cos(e)*_+m*Math.sin(e)*g,R=e=>-p*Math.sin(e)*g-m*Math.cos(e)*_,z=e=>-p*Math.sin(e)*_+m*Math.cos(e)*g,B=M,V=d,H=f;for(let e=1;e<=P;e++){let t=M+F*e,n=e===P?l:L(t),r=e===P?u:te(t);a(V+I*R(B),H+I*z(B),n-I*R(t),r-I*z(t),n,r),B=t,V=n,H=r}},e=>(e&&o(n[0],n[1]),n.length<8?null:{pts:Float64Array.from(n),closed:e})]}function un(e){let[t,n,r,i,a]=J(e.x0,e.y0);for(let a of e.segs)switch(a[0]){case`L`:n(a[1],a[2]);break;case`C`:t(a[1],a[2],a[3],a[4],a[5],a[6]);break;case`Q`:r(a[1],a[2],a[3],a[4]);break;case`A`:i(a[1],a[2],a[3],a[4],a[5],a[6],a[7])}return a(e.closed)}function Y(e,t,n=0){let r=e[t];if(r===void 0)return n;let i=typeof r==`number`?r:Number(r);return Number.isFinite(i)?i:n}function dn(e){let t=String(e??``).trim();if(!t)return[];let n=t.split(/[\s,]+/).map(Number);if(n.some(e=>!Number.isFinite(e)))throw Error(`morphicons: invalid points: "${t}"`);return n}function fn(e,t){if(e.length<4)return null;let[,n,,,r]=J(e[0],e[1]);for(let t=2;t+1<e.length;t+=2)n(e[t],e[t+1]);return r(t)}function pn(e,t,n,r){if(n<1e-12||r<1e-12)return null;let i=cn*n,a=cn*r,o=e+n,s=e-n,c=t+r,l=t-r,[u,,,,d]=J(o,t);return u(o,t+a,e+i,c,e,c),u(e-i,c,s,t+a,s,t),u(s,t-a,e-i,l,e,l),u(e+i,l,o,t-a,o,t),d(!0)}function mn(e){let t=Y(e,`x`),n=Y(e,`y`),r=Y(e,`width`),i=Y(e,`height`);if(r<1e-12||i<1e-12)return null;let a=Y(e,`rx`,NaN),o=Y(e,`ry`,NaN);if(Number.isNaN(a)&&(a=Number.isNaN(o)?0:o),Number.isNaN(o)&&(o=a),a=Math.min(Math.max(a,0),r/2),o=Math.min(Math.max(o,0),i/2),a<1e-12||o<1e-12)return fn([t,n,t+r,n,t+r,n+i,t,n+i],!0);let s=t+a,c=t+r-a,l=t+r,u=n+o,d=n+i-o,f=n+i,p=cn*a,m=cn*o,[h,g,,,_]=J(s,n);return g(c,n),h(c+p,n,l,u-m,l,u),g(l,d),h(l,d+m,c+p,f,c,f),g(s,f),h(s-p,f,t,d+m,t,d),g(t,u),h(t,u-m,s-p,n,s,n),_(!0)}function hn(e){let t=[],n=e=>{e&&t.push(e)};if(typeof e==`string`){for(let t of rn(e))n(un(t));return t}for(let[t,r]of e)switch(t){case`path`:for(let e of rn(String(r.d??``)))n(un(e));break;case`line`:{let[,e,,,t]=J(Y(r,`x1`),Y(r,`y1`));e(Y(r,`x2`),Y(r,`y2`)),n(t(!1));break}case`circle`:{let e=Y(r,`r`);n(pn(Y(r,`cx`),Y(r,`cy`),e,e));break}case`ellipse`:n(pn(Y(r,`cx`),Y(r,`cy`),Y(r,`rx`),Y(r,`ry`)));break;case`rect`:n(mn(r));break;case`polyline`:n(fn(dn(r.points),!1));break;case`polygon`:n(fn(dn(r.points),!0));break;default:throw Error(`morphicons: unsupported tag <${t}>`)}return t}function gn(e){return e.items.map(()=>new Float64Array(2*e.n))}function _n(e,t,n){for(let r=0;r<e.items.length;r++){let i=e.items[r],a=n[r],o=e.n,s=Math.exp(i.lnSigma*t),c=i.theta*t,l=Math.cos(c)*s,u=Math.sin(c)*s,d,f;if(i.block){let[e,n]=i.block.off,[r,a]=i.block.drift;d=i.ca[0]+r*t+(e*l-n*u-e),f=i.ca[1]+a*t+(e*u+n*l-n)}else d=i.ca[0]+(i.cb[0]-i.ca[0])*t,f=i.ca[1]+(i.cb[1]-i.ca[1])*t;for(let e=0;e<o;e++){let n=i.aC[2*e]+(i.bT[2*e]-i.aC[2*e])*t,r=i.aC[2*e+1]+(i.bT[2*e+1]-i.aC[2*e+1])*t;a[2*e]=d+n*l-r*u,a[2*e+1]=f+n*u+r*l}}}var vn=.35,yn=.05,bn=.005,xn=8,Sn=1e5;function X(e){let t=e.length/2,n=0,r=0;for(let i=0;i<t;i++)n+=e[2*i],r+=e[2*i+1];return[n/t,r/t]}function Cn(e){let t=e.length/2,n=0;for(let r=1;r<t;r++)n+=Math.hypot(e[2*r]-e[2*r-2],e[2*r+1]-e[2*r-1]);return n}function wn(e){let t=e.length/2,n=new Float64Array(2*t);for(let r=0;r<t;r++)n[2*r]=e[2*(t-1-r)],n[2*r+1]=e[2*(t-1-r)+1];return n}function Tn(e,t){let n=e.length/2,r=new Float64Array(2*n);for(let i=0;i<n;i++){let a=(i+t)%n;r[2*i]=e[2*a],r[2*i+1]=e[2*a+1]}return r}function En(e,t,n,r){let i=e.length/2,a=0,o=0,s=0,c=0,l=0,u=0;for(let d=0;d<i;d++){let i=e[2*d]-n[0],f=e[2*d+1]-n[1],p=t[2*d]-r[0],m=t[2*d+1]-r[1];a+=i*p,c+=f*m,o+=i*m,s+=f*p,l+=i*i+f*f,u+=p*p+m*m}let d=Math.atan2(o-s,a+c),f=Math.cos(d)*(a+c)+Math.sin(d)*(o-s),p=l>1e-12?f/l:1;p>1e-6||(p=1e-6);let m=Math.max(0,p*p*l-2*p*f+u),h=u>1e-12?Math.sqrt(m/u):0;return{theta:d,sigma:p,res:h}}function Dn(e,t,n=!1,r=!1){let i=X(e),a=X(t),o=n&&!r,s=o?e:t,c=n||r?s.length/2:1,l=1/0,u=s,d={theta:0,sigma:1,res:0};for(let n=0;n<2;n++){let r=n?wn(s):s;for(let n=0;n<c;n++){let s=n?Tn(r,n):r,c=o?En(s,t,i,a):En(e,s,i,a),f=c.res+yn*Math.abs(c.theta)/Math.PI;f<l&&(l=f,u=s,d=c)}}return o?{ca:i,cb:a,a:u,b:t,...d}:{ca:i,cb:a,a:e,b:u,...d}}function On(e,t){let n=t.map(X),r=t.map(Cn);return e.map(e=>{let t=X(e),i=Cn(e);return n.map((e,n)=>Math.hypot(t[0]-e[0],t[1]-e[1])+vn*Math.abs(i-r[n]))})}function kn(e){let t=e.length;if(t>xn){let n=[];for(let r=0;r<t;r++)for(let i=0;i<t;i++)n.push([e[r][i],r,i]);n.sort((e,t)=>e[0]-t[0]);let r=Array(t).fill(-1),i=Array(t).fill(!1);for(let[,e,t]of n)r[e]<0&&!i[t]&&(r[e]=t,i[t]=!0);return r}let n=Array.from({length:t},(e,t)=>t),r=n.slice(),i=1/0,a=(n,o,s)=>{if(!(s>=i)){if(o===t){i=s,r=n.slice();return}for(let r=o;r<t;r++)[n[o],n[r]]=[n[r],n[o]],a(n,o+1,s+e[o][n[o]]),[n[o],n[r]]=[n[r],n[o]]}};return a(n,0,0),r}function An(e){let t=e.length,n=e[0].length;if(n**t>Sn){let r=e.map(e=>{let t=0;for(let n=1;n<e.length;n++)e[n]<e[t]&&(t=n);return t}),i=Array(n).fill(0);for(let e of r)i[e]++;for(let a=0;a<n;a++){if(i[a]>0)continue;let n=-1,o=1/0;for(let s=0;s<t;s++){if(i[r[s]]<2)continue;let t=e[s][a]-e[s][r[s]];t<o&&(o=t,n=s)}i[r[n]]--,r[n]=a,i[a]++}return r}let r=null,i=1/0,a=Array(t),o=Array(n).fill(0),s=(c,l,u)=>{if(!(l>=i||n-u>t-c)){if(c===t){i=l,r=a.slice();return}for(let t=0;t<n;t++)a[c]=t,o[t]++,s(c+1,l+e[c][t],u+ +(o[t]===1)),o[t]--}};if(s(0,0,0),!r)throw Error(`morphicons: no valid surjection (B < S)`);return r}function jn(e,t){let n=e.length*t,r=new Float64Array(2*n),i=new Float64Array(2*n);e.forEach((e,n)=>{r.set(e.a,2*t*n),i.set(e.bO,2*t*n)});let a=X(r),o=En(r,i,a,X(i));if(o.res>=bn)return;let s=Math.cos(-o.theta),c=Math.sin(-o.theta),l=Math.cos(o.theta),u=Math.sin(o.theta);for(let n of e){let e=0,r=0;for(let i=0;i<t;i++){let t=n.bO[2*i]-n.cb[0],a=n.bO[2*i+1]-n.cb[1];n.bT[2*i]=(t*s-a*c)/o.sigma,n.bT[2*i+1]=(t*c+a*s)/o.sigma;let d=o.sigma*(l*n.aC[2*i]-u*n.aC[2*i+1])-t,f=o.sigma*(u*n.aC[2*i]+l*n.aC[2*i+1])-a;e+=d*d+f*f,r+=t*t+a*a}n.theta=o.theta,n.lnSigma=Math.log(o.sigma),n.res=r>1e-12?Math.sqrt(e/r):0;let i=Math.exp(n.lnSigma),d=Math.cos(n.theta)*i,f=Math.sin(n.theta)*i,p=n.ca[0]-a[0],m=n.ca[1]-a[1],h=p*d-m*f-p,g=p*f+m*d-m;n.block={off:[p,m],drift:[n.cb[0]-n.ca[0]-h,n.cb[1]-n.ca[1]-g]}}}function Mn(e,t){let n=e.length,r=t.length;if(n===0||r===0)throw Error(`morphicons: icon has no subpaths`);let i=e.map(e=>e.pts),a=t.map(e=>e.pts),o=[];if(n===r){let e=kn(On(i,a));for(let t=0;t<n;t++)o.push([t,e[t]])}else if(n<r){let e=An(On(a,i));for(let t=0;t<r;t++)o.push([e[t],t])}else{let e=An(On(i,a));for(let t=0;t<n;t++)o.push([t,e[t]])}let s=i[0].length/2,c=o.map(([n,r])=>{let o=Dn(i[n],a[r],e[n].closed,t[r].closed),c=o.a,l=new Float64Array(2*s),u=new Float64Array(2*s),d=new Float64Array(2*s),f=Math.cos(-o.theta),p=Math.sin(-o.theta);for(let e=0;e<s;e++){l[2*e]=c[2*e]-o.ca[0],l[2*e+1]=c[2*e+1]-o.ca[1];let t=o.b[2*e]-o.cb[0],n=o.b[2*e+1]-o.cb[1];u[2*e]=(t*f-n*p)/o.sigma,u[2*e+1]=(t*p+n*f)/o.sigma,d[2*e]=o.b[2*e],d[2*e+1]=o.b[2*e+1]}return{a:c,aC:l,bT:u,bO:d,ca:o.ca,cb:o.cb,theta:o.theta,lnSigma:Math.log(o.sigma),res:o.res,closed:e[n].closed&&t[r].closed,block:null}});return c.length>1&&jn(c,s),{items:c,n:s}}var Nn=Math.PI/8,Pn=[.18343464249564978,.525532409916329,.7966664774136267,.9602898564975363],Fn=[.362683783378362,.31370664587788727,.22238103445337448,.10122853629037626];function In(e,t,n){let r=6*t,i=1-n,a=3*i*i,o=6*i*n,s=3*n*n,c=a*(e[r+2]-e[r])+o*(e[r+4]-e[r+2])+s*(e[r+6]-e[r+4]),l=a*(e[r+3]-e[r+1])+o*(e[r+5]-e[r+3])+s*(e[r+7]-e[r+5]);return Math.hypot(c,l)}function Ln(e,t,n=1){let r=n/2,i=0;for(let n=0;n<4;n++)i+=Fn[n]*(In(e,t,r+r*Pn[n])+In(e,t,r-r*Pn[n]));return i*r}function Rn(e,t,n,r,i){let a=6*t,o=1-n,s=o*o*o,c=3*o*o*n,l=3*o*n*n,u=n*n*n;r[i]=s*e[a]+c*e[a+2]+l*e[a+4]+u*e[a+6],r[i+1]=s*e[a+1]+c*e[a+3]+l*e[a+5]+u*e[a+7]}function zn(e,t,n){let r=6*t,i=n?r+6:r,a=n?-1:1;for(let t of n?[4,2,0]:[2,4,6]){let n=a*(e[r+t]-e[i]),o=a*(e[r+t+1]-e[i+1]);if(n*n+o*o>1e-18)return[n,o]}return null}function Bn(e,t=Nn){let n=e.pts,r=(n.length/2-1)/3,i=[];for(let e=0;e<r;e++)Ln(n,e)>1e-9&&i.push(e);if(i.length===0)return[];let a=new Set,o=(e,r)=>{let i=zn(n,e,!0),o=zn(n,r,!1);i&&o&&Math.abs(Math.atan2(i[0]*o[1]-i[1]*o[0],i[0]*o[0]+i[1]*o[1]))>t&&a.add(r)};for(let e=0;e+1<i.length;e++)o(i[e],i[e+1]);return e.closed&&i.length>1&&o(i[i.length-1],i[0]),[...a].sort((e,t)=>e-t)}function Vn(e,t,n,r){if(n<=0)return 0;if(n>=r)return 1;let i=0,a=1,o=n/r;for(let s=0;s<12;s++){let s=Ln(e,t,o)-n;if(Math.abs(s)<1e-10*r+1e-14)break;s>0?a=o:i=o;let c=In(e,t,o),l=c>1e-12?o-s/c:(i+a)/2;l>i&&l<a||(l=(i+a)/2),o=l}return o}function Hn(e,t=64,n=Nn){let r=e.pts,i=(r.length/2-1)/3,a=new Float64Array(2*t),o=()=>{for(let e=0;e<t;e++)a[2*e]=r[0],a[2*e+1]=r[1];return a};if(i<1)return o();let s=Array(i),c=0;for(let e=0;e<i;e++)s[e]=Ln(r,e),c+=s[e];if(c<1e-12)return o();let l=Bn(e,n),u=e.closed?l.length>0?l:[0]:[...new Set([0,...l,i])].sort((e,t)=>e-t),d=[];if(e.closed)for(let e=0;e<u.length;e++){let t=u[e],n=e+1<u.length?u[e+1]:u[0]+i;d.push([t,n])}else for(let e=0;e+1<u.length;e++)d.push([u[e],u[e+1]]);let f=d.map(([e,t])=>{let n=0;for(let r=e;r<t;r++)n+=s[r%i];return n}),p=e.closed?t:t-1;if(d.length>p)throw Error(`morphicons: N=${t} too small (${d.length} runs)`);let m=f.reduce((e,t)=>e+t,0)||1,h=f.map(e=>p*e/m),g=h.map(e=>Math.max(1,Math.floor(e))),_=p-g.reduce((e,t)=>e+t,0);if(_>0){let e=h.map((e,t)=>[Math.round((e-Math.floor(e))*1e9),t]).sort((e,t)=>t[0]-e[0]||e[1]-t[1]);for(let t=0;t<_;t++)g[e[t%g.length][1]]++}for(;_<0;){let e=0;for(let t=1;t<g.length;t++)g[t]>g[e]&&(e=t);if(g[e]<=1)break;g[e]--,_++}let v=0;for(let e=0;e<d.length;e++){let[t,n]=d[e],o=g[e],c=f[e],l=t%i*6;a[2*v]=r[l],a[2*v+1]=r[l+1],v++;let u=t,p=0;for(let e=1;e<o;e++){let t=c*e/o;for(;u<n-1&&p+s[u%i]<t;)p+=s[u%i],u++;let l=u%i,d=s[l];Rn(r,l,d>1e-12?Vn(r,l,t-p,d):0,a,2*v),v++}}if(!e.closed){let e=6*i;a[2*v]=r[e],a[2*v+1]=r[e+1]}return a}function Un(e,t=64){return hn(e).map(e=>({pts:Hn(e,t),closed:e.closed}))}var Wn=class{x=1;v=0;k=250;c=24;config(e,t){this.k=e,this.c=t}start(){this.x=0,this.v>14&&(this.v=14),this.v<-14&&(this.v=-14)}step(e){let t=Math.max(1,Math.min(16,Math.ceil(e/(1/240)))),n=e/t;for(let e=0;e<t;e++){let e=this.k*(1-this.x)-this.c*this.v;this.v+=e*n,this.x+=this.v*n}return Math.abs(1-this.x)<.001&&Math.abs(this.v)<.02}},Gn={smooth:{k:170,c:26},snappy:{k:420,c:30},bouncy:{k:300,c:14}},Kn=new Set,Z=0,Q=-1;function qn(e){let t=Q<0?0:Math.min(Math.max((e-Q)/1e3,0),.1);Q=e;for(let e of[...Kn])e(t);Kn.size>0?Z=requestAnimationFrame(qn):(Z=0,Q=-1)}function Jn(e){Kn.add(e),Z===0&&(Q=-1,Z=requestAnimationFrame(qn))}function Yn(e){Kn.delete(e),Kn.size===0&&Z!==0&&(cancelAnimationFrame(Z),Z=0,Q=-1)}var Xn=new WeakMap,Zn=new WeakMap,Qn=new WeakMap;function $(e){if(typeof e==`string`)return Un(e);let t=Xn.get(e);return t||(t=Un(e),Xn.set(e,t)),t}function $n(e){if(typeof e==`string`)return e;let t=Zn.get(e);return t||(t=sn(hn(e)),Zn.set(e,t)),t}function er(e,t){if(typeof e==`string`||typeof t==`string`)return Mn($(e),$(t));let n=Qn.get(e);n||(n=new WeakMap,Qn.set(e,n));let r=n.get(t);return r||(r=Mn($(e),$(t)),n.set(t,r)),r}function tr(e){if(typeof e==`string`)return Gn[e];let t=Gn.snappy;return{k:e?.stiffness??t.k,c:e?.damping??t.c}}function nr(e,t,n){let r=new Wn,i=n?.reducedMotion??`never`,a=t,o=!0,s=null,c=null,l=null,u=1,d=!1,f=!1;e.setAttribute(`d`,$n(t));let p=t=>{let n=s,r=c,i=l;n&&r&&i&&(u=t,_n(n,t,r),e.setAttribute(`d`,on(r,i)))},m=()=>{d&&(d=!1,Yn(h))},h=e=>{let t=r.step(e);p(r.x),t&&(m(),g())},g=()=>{o=!0,s=null,c=null,l=null,u=1,r.x=1,r.v=0,e.setAttribute(`d`,$n(a))},_=()=>{let e=s,t=c;return o||!e||!t?$(a):t.map((t,n)=>({pts:Float64Array.from(t),closed:e.items[n].closed}))},v=e=>{s=o?er(a,e):Mn(_(),$(e)),c=gn(s),l=s.items.map(e=>e.closed),a=e,o=!1},y=e=>{m(),a=e,g()},b=()=>i===`always`?!0:i!==`user`||typeof matchMedia>`u`?!1:matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1,x=(e,t)=>{if(f)return;let n=!o&&s!==null&&e===a;m(),r.v=0,n||v(e),p(t)};return{morphTo(e,t){if(f||e===a&&(o||d))return;if(b()){y(e);return}let{k:n,c:i}=tr(t);r.config(n,i),v(e),r.start(),d||(d=!0,Jn(h))},set(e){f||y(e)},seek:x,get progress(){return o?1:u},set progress(e){f||x(a,e)},get reducedMotion(){return i},set reducedMotion(e){i=e},destroy(){m(),f=!0,s=null,c=null,l=null}}}var rr=typeof document>`u`?U.useEffect:U.useLayoutEffect;function ir(e,t,n){if(n<=0)return $n(e);if(n>=1)return $n(t);let r=Mn(Un(e),Un(t)),i=gn(r);return _n(r,n,i),on(i,r.items.map(e=>e.closed))}var ar=(0,U.forwardRef)(function(e,t){let{icon:n,from:r,to:i,progress:a,spring:o,reducedMotion:s,size:c=24,color:l=`currentColor`,strokeWidth:u=2,absoluteStrokeWidth:d,label:f,...p}=e,m=r!==void 0&&i!==void 0,h=n??r??i,[g]=(0,U.useState)(()=>m?ir(r,i,a??0):h===void 0?``:$n(h)),_=(0,U.useRef)(null),v=(0,U.useRef)(null),y=(0,U.useRef)(o);y.current=o;let b=(0,U.useRef)(s);b.current=s;let x=(0,U.useRef)(n),S=(0,U.useRef)(m),C=(0,U.useRef)(!1),w=(0,U.useRef)(!1),T=(0,U.useRef)(null),E=(0,U.useCallback)(e=>{if(v.current)return v.current;let t=_.current;return C.current||!t?null:(v.current=nr(t,e,{reducedMotion:b.current}),v.current)},[]);rr(()=>{C.current=!1;let e=_.current;if(e&&h!==void 0){let t=nr(e,m?r:h,{reducedMotion:b.current});if(v.current=t,m){T.current=[r,i];let e=a??0;e<=0?t.set(r):e>=1?t.set(i):(t.seek(i,e),w.current=!0)}}return()=>{C.current=!0,v.current?.destroy(),v.current=null,w.current=!1,T.current=null}},[]),(0,U.useEffect)(()=>{let e=v.current;e&&(e.reducedMotion=s??`never`)},[s]),(0,U.useEffect)(()=>{let e=S.current&&!m;S.current=m;let t=n!==x.current;if(x.current=n,m||n===void 0||!t&&!e)return;T.current=null,w.current=!1;let r=v.current;r?r.morphTo(n,y.current):E(n)},[n,m,E]),(0,U.useEffect)(()=>{if(!m)return;let e=v.current??E(r);if(!e)return;let t=a??0;(!T.current||T.current[0]!==r||T.current[1]!==i)&&(T.current=[r,i],w.current=!1),t<=0?(e.set(r),w.current=!1):t>=1?(e.set(i),w.current=!1):(w.current||=(e.set(r),!0),e.seek(i,t))},[m,r,i,a,E]),(0,U.useImperativeHandle)(t,()=>({morphTo:(e,t)=>{T.current=null,w.current=!1;let n=v.current;n?n.morphTo(e,t??y.current):E(e)},set:e=>{T.current=null,w.current=!1;let t=v.current;t?t.set(e):E(e)}}),[E]);let D=d?Number(u)*24/Number(c):u;return(0,W.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:c,height:c,viewBox:`0 0 24 24`,fill:`none`,stroke:l,strokeWidth:D,strokeLinecap:`round`,strokeLinejoin:`round`,role:f?`img`:void 0,"aria-hidden":!f||void 0,...p,children:[f?(0,W.jsx)(`title`,{children:f}):null,(0,W.jsx)(`path`,{ref:_,d:g})]})});function or(e){return typeof e==`object`&&!!e&&`lucide`in e}function sr(e){let t=(0,ot.c)(17),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({reducedMotion:a,icon:n,strokeWidth:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`user`:a,s=P(),c=or(n)?s===`p4`?n.p4??n.lucide:n.lucide:n,l;t[5]!==s||t[6]!==i?(l=s===`p4`?Pe(i):i,t[5]=s,t[6]=i,t[7]=l):l=t[7];let u=l,d;t[8]===c?d=t[9]:(d=c===void 0?{}:{icon:c},t[8]=c,t[9]=d);let f;t[10]===u?f=t[11]:(f=u===void 0?{}:{strokeWidth:u},t[10]=u,t[11]=f);let p;return t[12]!==r||t[13]!==o||t[14]!==d||t[15]!==f?(p=(0,W.jsx)(ar,{reducedMotion:o,...d,...f,...r}),t[12]=r,t[13]=o,t[14]=d,t[15]=f,t[16]=p):p=t[16],p}var cr=U.createContext(void 0);function lr(e){let t=U.useContext(cr);if(t===void 0&&!e)throw Error(p(72));return t}var ur={...H,disabled:M(e=>e.disabled),instantType:M(e=>e.instantType),isInstantPhase:M(e=>e.isInstantPhase),trackCursorAxis:M(e=>e.trackCursorAxis),disableHoverablePopup:M(e=>e.disableHoverablePopup),lastOpenChangeReason:M(e=>e.openChangeReason),closeOnClick:M(e=>e.closeOnClick),closeDelay:M(e=>e.closeDelay),hasViewport:M(e=>e.hasViewport)},dr=class e extends We{constructor(e,t,n=!1){let r=new Se,i={...fr(),...e};i.floatingRootContext=Ie(r,t,n),super(i,{popupRef:U.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:r},ur)}setOpen=(e,t)=>{let n=t.reason,r=n===ne,i=e&&n===`trigger-focus`,a=!e&&(n===`trigger-press`||n===`escape-key`);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let o=()=>{let r={open:e,openChangeReason:n};i?r.instantType=`focus`:a?r.instantType=`dismiss`:n===`trigger-hover`&&(r.instantType=void 0),ie(r,e,t.trigger),this.update(r)};r?st.flushSync(o):o()};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,c(Ce,e))}static useStore(t,n){return ue(t,(t,r)=>new e(n,t,r)).store}};function fr(){return{...ke(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}var pr=Ye(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:l,handle:u,triggerId:d,defaultTriggerId:f=null,children:p}=e,h=dr.useStore(u?.store,{open:n,openProp:r,activeTriggerId:f,triggerIdProp:d});Xe(()=>{r===void 0&&h.state.open===!1&&n===!0&&h.update({open:!0,activeTriggerId:f})}),h.useControlledProp(`openProp`,r),h.useControlledProp(`triggerIdProp`,d),h.useContextCallback(`onOpenChange`,s),h.useContextCallback(`onOpenChangeComplete`,l);let _=h.useState(`open`),y=!t&&_,b=h.useState(`activeTriggerId`),x=h.useState(`mounted`),S=h.useState(`payload`);h.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i}),h.useSyncedValue(`disabled`,t),oe(h);let{forceUnmount:C,transitionStatus:w}=Me(y,h),T=h.useState(`isInstantPhase`),E=h.useState(`instantType`),D=h.useState(`lastOpenChangeReason`),O=U.useRef(null);m(()=>{_&&t&&h.setOpen(!1,c(g))},[_,t,h]),m(()=>{w===`ending`&&D===`none`||w!==`ending`&&T?(E!==`delay`&&(O.current=E),h.set(`instantType`,`delay`)):O.current!==null&&(h.set(`instantType`,O.current),O.current=null)},[w,T,D,E,h]),m(()=>{y&&(b??h.set(`payload`,void 0))},[h,b,y]);let k=U.useCallback(()=>{h.setOpen(!1,c(v))},[h]);U.useImperativeHandle(o,()=>({unmount:C,close:k}),[C,k]);let A=y||x||!t&&a!==`none`;return(0,W.jsxs)(cr.Provider,{value:h,children:[A&&(0,W.jsx)(mr,{store:h,disabled:t,trackCursorAxis:a}),typeof p==`function`?p({payload:S}):p]})});function mr({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=d(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=at(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n}),o=U.useMemo(()=>Qe(a.reference,i.reference),[a.reference,i.reference]),s=U.useMemo(()=>Qe(a.trigger,i.trigger),[a.trigger,i.trigger]),c=U.useMemo(()=>Qe(Ve,a.floating,i.floating),[a.floating,i.floating]);return Ee(e,{activeTriggerProps:o,inactiveTriggerProps:s,popupProps:c}),null}var hr=U.createContext(void 0);function gr(){return U.useContext(hr)}var _r=function(e){return e[e.popupOpen=se.popupOpen]=`popupOpen`,e.triggerDisabled=`data-trigger-disabled`,e}({}),vr=`data-base-ui-tooltip-trigger`;function yr(e){if(`composedPath`in e){let t=e.composedPath();for(let e=0;e<t.length;e+=1){let n=t[e];if($e(n))return n}}let t=e.target;return $e(t)?t:null}function br(e){let t=e;for(;t;){if(t.hasAttribute(vr))return t;let e=t.parentElement;if(e){t=e;continue}let n=t.getRootNode();t=`host`in n&&$e(n.host)?n.host:null}return null}var xr=k(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:l,closeOnClick:u=!0,closeDelay:d,id:f,...m}=e,h=lr(!0),g=a?.store??h;if(!g)throw Error(p(82));let _=ee(f),v=g.useState(`isTriggerActive`,_),y=g.useState(`isOpenedByTrigger`,_),b=g.useState(`floatingRootContext`),x=U.useRef(null),S=l??600,C=d??0,{registerTrigger:w,isMountedByThisTrigger:T}=te(_,x,g,{payload:o,closeOnClick:u,closeDelay:C}),D=gr(),{delayRef:O,isInstantPhase:k,hasProvider:A}=nt(b,{open:y}),j=Fe(b);g.useSyncedValue(`isInstantPhase`,k);let M=g.useState(`disabled`),N=s??M,P=De(N),F=g.useState(`trackCursorAxis`),I=g.useState(`disableHoverablePopup`),L=U.useRef(!1),R=Te(),z=U.useRef(void 0);function B(){let e=D?.delay,t=typeof O.current==`object`?O.current.open:void 0,n=S;return A&&(n=t===0?0:l??e??S),n}function H(e){let t=x.current;if(!t||!e)return!1;let n=br(e);return n!==null&&n!==t&&V(t,n)}function re(e){let t=H(e);return L.current=t,t&&(j.openChangeTimeout.clear(),j.restTimeout.clear(),j.restTimeoutPending=!1,R.clear()),t}let ie=Re(b,{enabled:!N,mouseOnly:!0,move:!1,handleClose:!I&&F!==`both`?E():null,restMs:B,delay(){let e=typeof O.current==`object`?O.current.close:void 0,t=C;return d==null&&A&&(t=e),{close:t}},triggerElementRef:x,isActiveTrigger:v,isClosing:()=>g.select(`transitionStatus`)===`ending`,shouldOpen(){return!L.current}}),ae=me(b,{enabled:!N}).reference,oe=e=>{let t=L.current,n=yr(e),r=re(n),i=x.current,a=i&&n&&V(i,n);if(r&&g.select(`open`)&&g.select(`lastOpenChangeReason`)===`trigger-hover`){g.setOpen(!1,c(ne,e));return}if(t&&!r&&a&&!P.current&&!g.select(`open`)&&i&&Be(z.current)){let t=()=>{!L.current&&!P.current&&!g.select(`open`)&&g.setOpen(!0,c(ne,e,i))},n=B();n===0?(R.clear(),t()):R.start(n,t)}},se=g.useState(`triggerProps`,T);return Ge(`button`,e,{state:{open:y},ref:[t,w,x],props:[ie,ae,T||F!==`none`?se:void 0,{onMouseOver(e){oe(e.nativeEvent)},onFocus(e){H(yr(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){L.current=!1,R.clear(),z.current=void 0},onPointerEnter(e){z.current=e.pointerType},onPointerDown(e){z.current=e.pointerType,g.set(`closeOnClick`,u),u&&!g.select(`open`)&&g.cancelPendingOpen(e.nativeEvent)},onClick(e){u&&!g.select(`open`)&&g.cancelPendingOpen(e.nativeEvent)},id:_,[_r.triggerDisabled]:N?``:void 0,[vr]:N?void 0:``},m],stateAttributesMapping:fe})}),Sr=U.createContext(void 0);function Cr(){let e=U.useContext(Sr);if(e===void 0)throw Error(p(70));return e}var wr=U.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return lr().useState(`mounted`)||n?(0,W.jsx)(Sr.Provider,{value:n,children:(0,W.jsx)(tn,{ref:t,...r})}):null}),Tr=U.createContext(void 0);function Er(){let e=U.useContext(Tr);if(e===void 0)throw Error(p(71));return e}var Dr=U.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:s=`top`,align:c=`center`,sideOffset:l=0,alignOffset:u=0,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f=5,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:h=!1,collisionAvoidance:g=o,style:_,...v}=e,y=lr(),b=Cr(),x=y.useState(`open`),S=y.useState(`mounted`),C=y.useState(`trackCursorAxis`),T=y.useState(`disableHoverablePopup`),E=y.useState(`floatingRootContext`),D=y.useState(`instantType`),O=y.useState(`transitionStatus`),k=y.useState(`hasViewport`),A=w({anchor:i,positionMethod:a,floatingRootContext:E,mounted:S,side:s,sideOffset:l,align:c,alignOffset:u,collisionBoundary:d,collisionPadding:f,sticky:m,arrowPadding:p,disableAnchorTracking:h,keepMounted:b,collisionAvoidance:g,adaptiveOrigin:k?ye:void 0}),j=U.useMemo(()=>({open:x,side:A.side,align:A.align,anchorHidden:A.anchorHidden,instant:C===`none`?D:`tracking-cursor`}),[x,A.side,A.align,A.anchorHidden,C,D]),ee=N(e,j,{styles:A.positionerStyles,transitionStatus:O,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!S,inert:!x||C===`both`||T});return(0,W.jsx)(Tr.Provider,{value:A,children:ee})}),Or={...Ne,...R},kr=U.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=lr(),{side:s,align:c}=Er(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`disabled`),h=o.useState(`closeDelay`);le({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),Oe(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return Ge(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[f,T(d),a],stateAttributesMapping:Or})}),Ar=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=U.useMemo(()=>({delay:t,closeDelay:n}),[t,n]),a=U.useMemo(()=>({open:t,close:n}),[t,n]);return(0,W.jsx)(hr.Provider,{value:i,children:(0,W.jsx)(tt,{delay:a,timeoutMs:r,children:e.children})})},jr=function(e){return e.popupWidth=`--popup-width`,e.popupHeight=`--popup-height`,e}({}),Mr={activationDirection:e=>e?{"data-activation-direction":e}:null},Nr=U.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,s=lr(),c=Er(),l=s.useState(`instantType`),{children:u,state:d}=ht({store:s,side:c.side,cssVars:jr,children:a}),f={activationDirection:d.activationDirection,transitioning:d.transitioning,instant:l};return Ge(`div`,e,{state:f,ref:t,props:[o,{children:u}],stateAttributesMapping:Mr})});export{zt as A,Yt as B,Mt as C,It as D,Ft as E,Wt as F,en as G,Zt as H,Gt as I,ht as K,Kt as L,Vt as M,Ht as N,Lt as O,Ut as P,qt as R,jt as S,Pt as T,Qt as U,Xt as V,$t as W,Et as _,wr as a,kt as b,dr as c,bt as d,xt as f,Tt as g,wt as h,Dr as i,Bt as j,Rt as k,sr as l,Ct as m,Ar as n,xr as o,St as p,ct as q,kr as r,pr as s,Nr as t,tn as u,Dt as v,Nt as w,At as x,Ot as y,Jt as z};
|
|
2
|
-
//# sourceMappingURL=TooltipViewport-B_Oz-gLq.js.map
|