@p4code/cli 0.8.22 → 0.8.24
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/dist/bin.mjs +1 -1
- package/dist/{binCli-CfXLOppT.mjs → binCli-DNod5652.mjs} +747 -492
- package/dist/client/.vite/manifest.json +2255 -2213
- package/dist/client/assets/AlertDialogRoot-Cc8kVCUa.js +2 -0
- package/dist/client/assets/{AnimatedHeight-DcrvwWWb.js → AnimatedHeight-wZzihILs.js} +2 -2
- package/dist/client/assets/{AuthSurfaceShell-CFBHG1UK.js → AuthSurfaceShell-Wwq6fM9A.js} +2 -2
- package/dist/client/assets/{CSPContext-BP4s0CJv.js → CSPContext-BjqtxKhA.js} +2 -2
- package/dist/client/assets/ChatGptUsageButton-8lmdyDiG.js +2 -0
- package/dist/client/assets/{ChatMarkdown-C6I8N1IH.js → ChatMarkdown-Cd3yE4VU.js} +12 -12
- package/dist/client/assets/CheckboxIndicator-CuZi7Ixm.js +2 -0
- package/dist/client/assets/ClippedText-DPgP0ObI.js +2 -0
- package/dist/client/assets/CodexSetupSection.logic-oYzzgIWo.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-B5S9so33.js → CommandBlock-ByCjpPww.js} +2 -2
- package/dist/client/assets/{ComposerPromptEditor-C7ZRV_6P.js → ComposerPromptEditor-4EkkS1N5.js} +44 -44
- package/dist/client/assets/CompositeRoot-Bg5KGYGp.js +2 -0
- package/dist/client/assets/{ConnectionStatusDot-Bz5Ps6Bm.js → ConnectionStatusDot-Bx8Imvqc.js} +2 -2
- package/dist/client/assets/DesignPageTile-ClF5Va3g.js +2 -0
- package/dist/client/assets/DevicePanel-DWlHQcLW.js +2 -0
- package/dist/client/assets/{DeviceSetup-Br_kHy6n.js → DeviceSetup-Dm9ZbkMC.js} +2 -2
- package/dist/client/assets/DialogTitle-CVP748Gv.js +2 -0
- package/dist/client/assets/{DiffCommentAnnotation-FcSG-wBG.js → DiffCommentAnnotation-Dx-VhoLU.js} +3 -3
- package/dist/client/assets/{DiffFileTree-IIdU6CqP.js → DiffFileTree-BgjyfH71.js} +2 -2
- package/dist/client/assets/DiffPanel-tZN29mdM.js +2 -0
- package/dist/client/assets/{DiffWorkerPoolProvider-C_VbNhAr.js → DiffWorkerPoolProvider-C_yNvh6o.js} +3 -3
- package/dist/client/assets/EmbeddedDesign-DDApp-WI.js +19 -0
- package/dist/client/assets/EmbeddedDesign-DYfQOv0y.css +1 -0
- package/dist/client/assets/{EnvironmentMachineIcon-b_kKEeAf.js → EnvironmentMachineIcon-B2v_GWgB.js} +2 -2
- package/dist/client/assets/{ExpandableText-anFaXhXF.js → ExpandableText-fJVIbCvG.js} +3 -3
- package/dist/client/assets/{FieldControl-w2_zp1DT.js → FieldControl-mq4xNgmP.js} +2 -2
- package/dist/client/assets/{FileDiff-B-9keGlb.js → FileDiff-B_422yEN.js} +2 -2
- package/dist/client/assets/{FilePreviewPanel-C1f_ibuL.js → FilePreviewPanel-B26lXYsA.js} +10 -10
- package/dist/client/assets/{FoldedSettingsSection-gN3w1sSZ.js → FoldedSettingsSection-TLqDB_1b.js} +2 -2
- package/dist/client/assets/{FormContext-BWWAKTFF.js → FormContext-Vtmj_mkP.js} +2 -2
- package/dist/client/assets/{Icons-DzTpHpn1.js → Icons-C0Zjws-3.js} +2 -2
- package/dist/client/assets/Input-B0ah2lnC.js +2 -0
- package/dist/client/assets/{KeybindingsSettings.logic-D8LAdmvB.js → KeybindingsSettings.logic-D-GClV-c.js} +2 -2
- package/dist/client/assets/{NoProjectsHero-CtzChQ7p.js → NoProjectsHero-Bx1X9Us-.js} +2 -2
- package/dist/client/assets/{P4ConnectAccountPages-B3SBsg6B.js → P4ConnectAccountPages-BWvaLOY-.js} +2 -2
- package/dist/client/assets/{P4ConnectSidebarSignIn-DKcaDv93.js → P4ConnectSidebarSignIn-C8z-Gfq5.js} +2 -2
- package/dist/client/assets/PanelLayoutControls-C2deQDB2.js +216 -0
- package/dist/client/assets/{PierreEntryIcon-CjZ8gyJq.js → PierreEntryIcon-Ddl-VPd4.js} +2 -2
- package/dist/client/assets/PopoverHandle-BT83XTq9.js +2 -0
- package/dist/client/assets/PreviewPanel-8NDLwOfI.js +2 -0
- package/dist/client/assets/ProjectDefaultsSettings-DN1GxlYC.js +2 -0
- package/dist/client/assets/{ProjectFavicon-va5UQPLo.js → ProjectFavicon-BDaMxno-.js} +3 -3
- package/dist/client/assets/{ProjectIconPickerDialog-CN2gK_o7.js → ProjectIconPickerDialog-Be5IQyyr.js} +2 -2
- package/dist/client/assets/{ProjectMonogram-B3Dkc8yq.js → ProjectMonogram-BUy_N1of.js} +2 -2
- package/dist/client/assets/{ProviderAuthTerminal-BSIgib7h.js → ProviderAuthTerminal-BFGd236-.js} +2 -2
- package/dist/client/assets/ProviderModelPicker-DMtMvBKn.js +2 -0
- package/dist/client/assets/{ProviderSettingsForm-D6zHGIeN.js → ProviderSettingsForm-D6u9dY73.js} +2 -2
- package/dist/client/assets/PullRequestCodeTab-hXtKZAP9.js +6 -0
- package/dist/client/assets/{ReadOnlySourcePreview-BSCVTdYH.js → ReadOnlySourcePreview-CDLZaWo2.js} +2 -2
- package/dist/client/assets/RenderErrorBoundary-BkcvpgEh.js +2 -0
- package/dist/client/assets/ScheduledTasksSettings-BJyFxVyR.js +4 -0
- package/dist/client/assets/{ScopedSwitch-D3fAHI1-.js → ScopedSwitch-yznbaSh9.js} +2 -2
- package/dist/client/assets/{ScrollAreaCorner-CNzfnpwK.js → ScrollAreaCorner-3gSiyg8H.js} +2 -2
- package/dist/client/assets/{SecretInput-D7hYUoFA.js → SecretInput-itt3KL-b.js} +2 -2
- package/dist/client/assets/SelectScrollUpArrow-D_o_f6Fh.js +2 -0
- package/dist/client/assets/{SettingsPanels-6SOZMWhg.js → SettingsPanels-DdhZ2nXb.js} +7 -7
- package/dist/client/assets/{SettingsPanels.logic-CMErdEeV.js → SettingsPanels.logic-DIuWE5Xf.js} +2 -2
- package/dist/client/assets/{SettingsScopeNotice-CyzbYUPJ.js → SettingsScopeNotice-D8K81IzP.js} +2 -2
- package/dist/client/assets/{ThemeEditorPanel-vZ4MSCBx.js → ThemeEditorPanel-ePX4nwaV.js} +3 -3
- package/dist/client/assets/ThreadTerminalDrawer-5z4y3z0y.js +5 -0
- package/dist/client/assets/TooltipViewport-DJ2VRKCt.js +2 -0
- package/dist/client/assets/{Virtualizer-CoK0zXAG.js → Virtualizer-DEM6HN7-.js} +2 -2
- package/dist/client/assets/{WorkspaceBreadcrumb-qAYKTgm8.js → WorkspaceBreadcrumb-B5ZV6VNj.js} +2 -2
- package/dist/client/assets/{WorkspacePageContainer-D6i--Hwz.js → WorkspacePageContainer-BTN44jG6.js} +2 -2
- package/dist/client/assets/{WorkspacePageHeader-covOFYhv.js → WorkspacePageHeader-BaCxaW-R.js} +2 -2
- package/dist/client/assets/_chat-C0vR23gu.js +45 -0
- package/dist/client/assets/_chat.design-CQ52N70I.js +2 -0
- package/dist/client/assets/{_chat.index-C3PnT6ae.js → _chat.index-SFAYIX_P.js} +2 -2
- package/dist/client/assets/{_chat.new-CxErZ7CC.js → _chat.new-BO6oEisx.js} +3 -3
- package/dist/client/assets/_chat.pull-requests-BfyCJw7Q.js +2 -0
- package/dist/client/assets/{abnfDiagram-VCTEODGH-CWxKS58m.js → abnfDiagram-VCTEODGH-DhiN6SMz.js} +2 -2
- package/dist/client/assets/{alert-DsgAHDNi.js → alert-CdZT7d18.js} +2 -2
- package/dist/client/assets/architecture-7GRP2DOG-Yd6b7qRF.js +1 -0
- package/dist/client/assets/{architectureDiagram-5GKGNRK7-kc6KNP-H.js → architectureDiagram-5GKGNRK7-bs37U5FM.js} +2 -2
- package/dist/client/assets/assets-BU-ex_t8.js +2 -0
- package/dist/client/assets/{blockDiagram-I7D4REHJ-CFJYOAbd.js → blockDiagram-I7D4REHJ-Bz9mN89n.js} +2 -2
- package/dist/client/assets/{browserHistoryStore-DjDw15jq.js → browserHistoryStore-KDG9Uz1t.js} +2 -2
- package/dist/client/assets/{browserLinkTarget-Br8BmA6w.js → browserLinkTarget-DmKK3HY0.js} +2 -2
- package/dist/client/assets/{c4Diagram-7LVT6UL2-Sxaodxxv.js → c4Diagram-7LVT6UL2-CtkHQd_E.js} +2 -2
- package/dist/client/assets/channel-DrCQqhMU.js +2 -0
- package/dist/client/assets/{checkbox-D33R1soh.js → checkbox-Q0bv8RvC.js} +2 -2
- package/dist/client/assets/{chunk-4HAMMTFA-CxocYFD0.js → chunk-4HAMMTFA-BtUnQAH6.js} +2 -2
- package/dist/client/assets/{chunk-75Z2AOVW-CBCO5Noa.js → chunk-75Z2AOVW-CwSe19lZ.js} +2 -2
- package/dist/client/assets/{chunk-DU6HZSFF-CEaklbmE.js → chunk-DU6HZSFF-Bwy7A0TF.js} +2 -2
- package/dist/client/assets/{chunk-F27PBJKO-Iw-0qjF9.js → chunk-F27PBJKO-CVsi2uk3.js} +2 -2
- package/dist/client/assets/{chunk-GMAD6QVW-CbDVrypn.js → chunk-GMAD6QVW-CVzXn5Hv.js} +2 -2
- package/dist/client/assets/{chunk-GVQU2GXP-BEqmpgLD.js → chunk-GVQU2GXP-7pPJVhuz.js} +2 -2
- package/dist/client/assets/{chunk-IMKFNOWR-bgZmQWS5.js → chunk-IMKFNOWR-D-dmx49n.js} +2 -2
- package/dist/client/assets/{chunk-L3NEJ4N5-LW_IXl13.js → chunk-L3NEJ4N5-DEJnMXSk.js} +2 -2
- package/dist/client/assets/{chunk-OSK3NFVY-DvGdSD7J.js → chunk-OSK3NFVY-CBtNmbZ8.js} +2 -2
- package/dist/client/assets/{chunk-P2QGCYS3-BAXEcEik.js → chunk-P2QGCYS3-TNHN3Sve.js} +2 -2
- package/dist/client/assets/{chunk-POPQ4Y6H-yM2kH99r.js → chunk-POPQ4Y6H-1cq1nl-Z.js} +2 -2
- package/dist/client/assets/{chunk-PWAF6VOD-B19ZyrVH.js → chunk-PWAF6VOD-B85KpsBk.js} +2 -2
- package/dist/client/assets/{chunk-SHT3W25Y-BhcwXJOc.js → chunk-SHT3W25Y-3tA2UDk1.js} +2 -2
- package/dist/client/assets/{chunk-SVP7TREG-B9xbRF9R.js → chunk-SVP7TREG-CHzBNDDY.js} +2 -2
- package/dist/client/assets/{chunk-TICWLB2K-D_VEGQbw.js → chunk-TICWLB2K-MeLbkhnz.js} +2 -2
- package/dist/client/assets/classDiagram-ZZMXUADV-MCjIu9oU.js +2 -0
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-MCjIu9oU.js +2 -0
- package/dist/client/assets/{color-picker-D3b0sEoy.js → color-picker-BWZhsiZJ.js} +2 -2
- package/dist/client/assets/{combobox-DzFRsaks.js → combobox-BdGKdc6i.js} +2 -2
- package/dist/client/assets/{command-IDMJ6pXc.js → command-CIj8Rufv.js} +2 -2
- package/dist/client/assets/composer-logic-DyIi6K9e.js +6 -0
- package/dist/client/assets/{composerDraftUploads-Qq0xOGEc.js → composerDraftUploads-BEFyD-t4.js} +2 -2
- package/dist/client/assets/{connect-BTIPE2au.js → connect-BUAMGrjt.js} +2 -2
- package/dist/client/assets/{connect-agent-hbkOBaFx.js → connect-agent-BNwEsc4t.js} +2 -2
- package/dist/client/assets/{cynefin-OW5HDTMX-CWOcHmwk.js → cynefin-OW5HDTMX-DTUXnTov.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-ksIfZeWS.js → cynefinDiagram-5FMLGOSQ-Cd9_EwZX.js} +2 -2
- package/dist/client/assets/{dagre-GXQ25YYZ-D7qz-Azr.js → dagre-GXQ25YYZ-D0hUgab8.js} +2 -2
- package/dist/client/assets/design-DaqMSnWJ.js +2 -0
- package/dist/client/assets/device-DnfWBPpo.js +2 -0
- package/dist/client/assets/{diagram-S7CK7UJ4-IBhHReDK.js → diagram-S7CK7UJ4-DY-wIVhL.js} +2 -2
- package/dist/client/assets/{diagram-UQ7AKVKN-EX7tFJEV.js → diagram-UQ7AKVKN-CmWAx8wR.js} +2 -2
- package/dist/client/assets/{diagram-VSXAHHWV-BEHOoBER.js → diagram-VSXAHHWV-DvIYORJP.js} +2 -2
- package/dist/client/assets/{diagram-VX7I27RA-Df_ThjhC.js → diagram-VX7I27RA-Dj3l0KCm.js} +2 -2
- package/dist/client/assets/{diagram-Z3DM3KII-DudywHX4.js → diagram-Z3DM3KII-ClP8dtWB.js} +2 -2
- package/dist/client/assets/{dialog-YpQOq7Ug.js → dialog-Cgb4jap2.js} +2 -2
- package/dist/client/assets/{diffRendering-CgLbOp0J.js → diffRendering-BWY0g219.js} +2 -2
- package/dist/client/assets/{discovery-list-CnlrZrDo.js → discovery-list-DXkskf2A.js} +2 -2
- package/dist/client/assets/{dist-usNgCtd_.js → dist-C5JAYxip.js} +5 -5
- package/dist/client/assets/{draft-input-DW6EgVbF.js → draft-input-DQxVE9YJ.js} +2 -2
- package/dist/client/assets/{duoViewer-CgVOZcYe.js → duoViewer-fztyITHM.js} +2 -2
- package/dist/client/assets/{dynamic-C1qIL2Wy.js → dynamic-CnYAeR9T.js} +3 -3
- package/dist/client/assets/{ebnfDiagram-PWID7BFC-DPJg2C3n.js → ebnfDiagram-PWID7BFC-DtbBVfJO.js} +2 -2
- package/dist/client/assets/{embeddedScripts-CAZM4r8Y.js → embeddedScripts-Bf2j7tmA.js} +2 -2
- package/dist/client/assets/{empty-QSN6WiRO.js → empty-DHl8_LXy.js} +2 -2
- package/dist/client/assets/entities-BJgMc8pv.js +2 -0
- package/dist/client/assets/{erDiagram-RLTQ6QDP-BySDEjHG.js → erDiagram-RLTQ6QDP-Dm2mBAGp.js} +2 -2
- package/dist/client/assets/eventmodeling-NTZA5JFV-rDo_pcJr.js +1 -0
- package/dist/client/assets/{fileLinks-ShhGM_AF.js → fileLinks-C9oYzhXv.js} +2 -2
- package/dist/client/assets/{fileTreeExpansion-DZnEBuaB.js → fileTreeExpansion-CpkONCrM.js} +2 -2
- package/dist/client/assets/flowDiagram-HODETNUW-C55XBPww.js +1 -0
- package/dist/client/assets/{ganttDiagram-EL5Y4UJY-CJAhE7we.js → ganttDiagram-EL5Y4UJY-D4UHegQH.js} +2 -2
- package/dist/client/assets/{getDiffFileInput-BxuEGdnM.js → getDiffFileInput-BKRfCrth.js} +2 -2
- package/dist/client/assets/ghostty-write-pty-BWDOU6dy.wasm +0 -0
- package/dist/client/assets/git-compare-CCnx9obs.js +2 -0
- package/dist/client/assets/{gitGraph-4MIJSDKK-BqKoI8Rd.js → gitGraph-4MIJSDKK-BUhEDO22.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-BPFwoaRw.js → gitGraphDiagram-WWUBYQGX-BwJT0OjN.js} +2 -2
- package/dist/client/assets/{guideRunStore-CYD68wqk.js → guideRunStore-DkBR0CPU.js} +2 -2
- package/dist/client/assets/{htmlRender-p6atQGoW.js → htmlRender-BUb_wWp9.js} +2 -2
- package/dist/client/assets/{index-CnQWjeBY.js → index-BYQ1ybfT.js} +3 -3
- package/dist/client/assets/{info-A6RAGUB7-R8j64K2s.js → info-A6RAGUB7-scwAD75p.js} +1 -1
- package/dist/client/assets/{infoDiagram-27XIBGKW-DFqL9n-v.js → infoDiagram-27XIBGKW-BgR5Wn6l.js} +2 -2
- package/dist/client/assets/{input-Df_UyHLk.js → input-D_jxqXLR.js} +2 -2
- package/dist/client/assets/{input-group-CpRPTpIU.js → input-group-BM_USnbh.js} +2 -2
- package/dist/client/assets/{ishikawaDiagram-5VMMS53U-C-786VMl.js → ishikawaDiagram-5VMMS53U-BOnOvOet.js} +2 -2
- package/dist/client/assets/{journeyDiagram-3NMN7TZE-lzAoDD4e.js → journeyDiagram-3NMN7TZE-B1wXWe62.js} +2 -2
- package/dist/client/assets/{kanban-definition-UXKFOSKX-CJDCWAxz.js → kanban-definition-UXKFOSKX-DI-FwQ_D.js} +2 -2
- package/dist/client/assets/{kbd-BWmfbdyt.js → kbd-B2uytHus.js} +2 -2
- package/dist/client/assets/{keybindings-Cwx4RZou.js → keybindings-CqjUKNRx.js} +2 -2
- package/dist/client/assets/{lazyRouteComponent-AWcDof8d.js → lazyRouteComponent-CByGrW41.js} +2 -2
- package/dist/client/assets/{line-BV7EkscB.js → line-c6BqGnEH.js} +2 -2
- package/dist/client/assets/{link-ymnjoepm.js → link-BjP3qTK9.js} +2 -2
- package/dist/client/assets/{linkedPrompt-D1v0zLjD.js → linkedPrompt-DjSidfRe.js} +2 -2
- package/dist/client/assets/main-4dRVuXx2.js +28 -0
- package/dist/client/assets/main-Dwir4BoC.css +2 -0
- package/dist/client/assets/{mediaReference-DjHCSaNZ.js → mediaReference-CWzBBNFa.js} +2 -2
- package/dist/client/assets/mediaSource-CHfRwmOf.js +2 -0
- package/dist/client/assets/{mermaid-parser.core-dhHCExtt.js → mermaid-parser.core-DOOH_cP_.js} +4 -4
- package/dist/client/assets/{mermaid.core-DixI3w-9.js → mermaid.core-9Tao6ZdD.js} +5 -5
- package/dist/client/assets/{mindmap-definition-YA3MSWOX-BHehI_9I.js → mindmap-definition-YA3MSWOX-CqmRXnVH.js} +2 -2
- package/dist/client/assets/number-field-Dj0uYTJQ.js +2 -0
- package/dist/client/assets/{observeResize-uogErzin.js → observeResize-jHx61cGA.js} +2 -2
- package/dist/client/assets/onboarding-BmDFkmWD.js +2 -0
- package/dist/client/assets/openFileInPreview-DF_vZEIK.js +2 -0
- package/dist/client/assets/{p4ProjectFile-B9fwmcbM.js → p4ProjectFile-YfIRB1xP.js} +2 -2
- package/dist/client/assets/{packet-AYTQ26CC-DhFsyjVR.js → packet-AYTQ26CC-B8LkZ5j3.js} +1 -1
- package/dist/client/assets/{pair-DJbA4cVs.js → pair-DSE8uuft.js} +2 -2
- package/dist/client/assets/{pegDiagram-XKGWAZYB-DBKpIU8U.js → pegDiagram-XKGWAZYB-CS17GwTP.js} +2 -2
- package/dist/client/assets/pendingSendStore-CaGsppQi.js +2 -0
- package/dist/client/assets/{phoneViewer-CywOkDco.js → phoneViewer-CYzqv5af.js} +2 -2
- package/dist/client/assets/{pie-WAS4IAKB-cW3as8Lm.js → pie-WAS4IAKB-B0WBcNHW.js} +1 -1
- package/dist/client/assets/{pieDiagram-E7YTZNPT-CuM-4V4_.js → pieDiagram-E7YTZNPT-Bk2IwUHp.js} +2 -2
- package/dist/client/assets/{pierre-icons-Bhwlc2rO.js → pierre-icons-CY4HbMoq.js} +2 -2
- package/dist/client/assets/{popover-2GkuSL2i.js → popover-2XJd3KEJ.js} +2 -2
- package/dist/client/assets/{preview-BnLuRquy.js → preview-8bBtJM5H.js} +2 -2
- package/dist/client/assets/{preview-DWVmLubs.js → preview-B5v36DP8.js} +2 -2
- package/dist/client/assets/{previewMiniPlayerStore-B2cko9-z.js → previewMiniPlayerStore-DMd0mA7a.js} +2 -2
- package/dist/client/assets/primary-BKQnuXrW.js +2 -0
- package/dist/client/assets/primaryCloudLinkState-CJSCsrUH.js +2 -0
- package/dist/client/assets/projectFilesQueryState-DltGYM_H.js +2 -0
- package/dist/client/assets/projectScriptEditor-CZb_iNq3.js +2 -0
- package/dist/client/assets/{providerSkills-OICI2srI.js → providerSkills-Ct4SZ-mY.js} +2 -2
- package/dist/client/assets/{pullRequestDetail.logic-DT8Qo5OA.js → pullRequestDetail.logic-COstpMB1.js} +4 -4
- package/dist/client/assets/{pullRequestIcons-BBzWaymE.js → pullRequestIcons-e8EZW8_y.js} +2 -2
- package/dist/client/assets/{pullRequestReviewStore-DKeU327h.js → pullRequestReviewStore-DJx8EOVl.js} +2 -2
- package/dist/client/assets/pullRequests-ClG7PJe0.js +2 -0
- package/dist/client/assets/{quadrantDiagram-AXDQQJYC-DSJ5VFnE.js → quadrantDiagram-AXDQQJYC-B0vWHjBG.js} +2 -2
- package/dist/client/assets/queries-BWcz-n4a.js +2 -0
- package/dist/client/assets/query-BFP47tsD.js +2 -0
- package/dist/client/assets/{radar-RG4KPBEZ-CfIGvIx_.js → radar-RG4KPBEZ-DmYBXYPt.js} +1 -1
- package/dist/client/assets/radio-group-BNV16qlg.js +2 -0
- package/dist/client/assets/{railroad-74A4TZTK-DB4Av5dd.js → railroad-74A4TZTK-D-4grcyc.js} +1 -1
- package/dist/client/assets/railroad-abnf-HS5TGJTU-6H_zYY6R.js +1 -0
- package/dist/client/assets/railroad-ebnf-LZEXJU2U-DYahAqN_.js +1 -0
- package/dist/client/assets/railroad-peg-WCYAUIDC-CdcgHAXA.js +1 -0
- package/dist/client/assets/{railroadDiagram-O6MQD6OU-cpv2Uyk5.js → railroadDiagram-O6MQD6OU-C7n4Qist.js} +2 -2
- package/dist/client/assets/{renderScheduler-h5pQXGNH.js → renderScheduler-DrstEe4y.js} +2 -2
- package/dist/client/assets/{requirementDiagram-BXWQKSXE-DYwMIoLP.js → requirementDiagram-BXWQKSXE-BYX3uen6.js} +2 -2
- package/dist/client/assets/rightPanelStore-XfAJpUIA.js +2 -0
- package/dist/client/assets/runtime-CArTL2GH.js +2 -0
- package/dist/client/assets/runtime-Cj24N7je.js +6 -0
- package/dist/client/assets/runtimeModeConfig-sQBlbgY3.js +2 -0
- package/dist/client/assets/{sankeyDiagram-P5KCCOFB-BqmXJBYG.js → sankeyDiagram-P5KCCOFB-tAgp-_Ny.js} +2 -2
- package/dist/client/assets/{scheduledTasksSettings.logic-Cg8SF9mr.js → scheduledTasksSettings.logic-zleH3iJ_.js} +3 -3
- package/dist/client/assets/{scroll-area-0-l4q4Pk.js → scroll-area-DORwTFtw.js} +2 -2
- package/dist/client/assets/{select-Dhapqr3j.js → select-Bsag72zE.js} +2 -2
- package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-h3AJox3t.js → sequenceDiagram-WJ2MYXX4-DlvnWAh_.js} +2 -2
- package/dist/client/assets/server-Vynm5NwP.js +2 -0
- package/dist/client/assets/session-DyiiEN5g.js +2 -0
- package/dist/client/assets/session-logic-B8t9Dfk3.js +26 -0
- package/dist/client/assets/{settings-CGf9Ad5Y.js → settings-CjeBlT1I.js} +2 -2
- package/dist/client/assets/settings.appearance-DUvYlE0y.js +2 -0
- package/dist/client/assets/settings.archived-B5WGVqfk.js +2 -0
- package/dist/client/assets/{settings.computer-use-C3SE4DHj.js → settings.computer-use-S7DPGiAx.js} +2 -2
- package/dist/client/assets/settings.connections-DJEqNVad.js +2 -0
- package/dist/client/assets/{settings.data-controls-DjgZVIMy.js → settings.data-controls-Bj1pQ5cL.js} +2 -2
- package/dist/client/assets/{settings.decisions-z3RVOG7-.js → settings.decisions-BufUBcem.js} +2 -2
- package/dist/client/assets/settings.designs-bWCNQca4.js +2 -0
- package/dist/client/assets/settings.diagnostics-Dx_NdxOm.js +2 -0
- package/dist/client/assets/settings.general-BQ6775Hi.js +2 -0
- package/dist/client/assets/settings.integrations-CgxBXw6p.js +2 -0
- package/dist/client/assets/{settings.keybindings-D78CWKIy.js → settings.keybindings-DrBH8mlK.js} +2 -2
- package/dist/client/assets/{settings.open-source-licenses-BhpBR1nY.js → settings.open-source-licenses-B3CGE-JI.js} +2 -2
- package/dist/client/assets/{settings.plugins-d9-jrUr-.js → settings.plugins-BGUgmDOY.js} +4 -4
- package/dist/client/assets/settings.projects-BJ1cpGGM.js +4 -0
- package/dist/client/assets/settings.providers-D2I5mNzk.js +3 -0
- package/dist/client/assets/settings.scheduled-tasks-D8hRaqp8.js +2 -0
- package/dist/client/assets/settings.snap-shot-C2X5_E0H.js +2 -0
- package/dist/client/assets/settings.source-control-Dvac_5mZ.js +2 -0
- package/dist/client/assets/{settings.storage-D6vDu4vG.js → settings.storage-1JdpL3lo.js} +2 -2
- package/dist/client/assets/settingsLayout-CuUCC6iL.js +3 -0
- package/dist/client/assets/{sidebar-DTT0HQ9J.js → sidebar-CV_a9dPF.js} +2 -2
- package/dist/client/assets/{sidebarProjectGrouping-JqsedUb6.js → sidebarProjectGrouping-r5ezKRMx.js} +2 -2
- package/dist/client/assets/{skeleton-D-FcvmF0.js → skeleton-Bq50sEah.js} +2 -2
- package/dist/client/assets/{sourceControl-CrjTZJC-.js → sourceControl-b1QZpCro.js} +2 -2
- package/dist/client/assets/{sourceControlClients-DYQ3gMZ2.js → sourceControlClients-DUvOeR-2.js} +2 -2
- package/dist/client/assets/{spinner-AJeHmaWN.js → spinner-Bzrp5oww.js} +2 -2
- package/dist/client/assets/{standalone-page-Df29sgRU.js → standalone-page-BGqmgLmI.js} +2 -2
- package/dist/client/assets/{stateDiagram-D77RDMKH-C0KiABVq.js → stateDiagram-D77RDMKH-BOgNCEU1.js} +2 -2
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-D00LPIWv.js +2 -0
- package/dist/client/assets/{swimlanes-42K2YHIH-BdAWIkuy.js → swimlanes-42K2YHIH-BZG7hJb7.js} +2 -2
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-vkEAWikD.js +9 -0
- package/dist/client/assets/{terminal-links-BjKL3dH7.js → terminal-links-DHw7nXFF.js} +2 -2
- package/dist/client/assets/{terminalSessions-dkFe-6qM.js → terminalSessions-BHzkH7av.js} +2 -2
- package/dist/client/assets/{textarea-CqADnND1.js → textarea-wDfYVvpo.js} +2 -2
- package/dist/client/assets/{themePalette-Co4xeJnW.js → themePalette-CLR_iiPi.js} +3 -3
- package/dist/client/assets/{timeline-definition-24CTP7MA-CkYp2QT_.js → timeline-definition-24CTP7MA-B5YiUA25.js} +2 -2
- package/dist/client/assets/toast-B3hjhWRf.js +2 -0
- package/dist/client/assets/{toggle-BM8lnQ29.js → toggle-ExdxBJoI.js} +2 -2
- package/dist/client/assets/{toggle-group-DaqkIApY.js → toggle-group-Clz6KDtW.js} +2 -2
- package/dist/client/assets/{tooltip-ngKqo-lA.js → tooltip-D-SzZpgJ.js} +2 -2
- package/dist/client/assets/{treeView-Q6P3EWNA-YWYRI1IG.js → treeView-Q6P3EWNA-Cb4H3xoG.js} +1 -1
- package/dist/client/assets/{treemap-WGGIJYW6-DOqHNCbg.js → treemap-WGGIJYW6-BdpTgSX1.js} +1 -1
- package/dist/client/assets/{uiStateStore-Ddhpg65j.js → uiStateStore-DoJ0IbwQ.js} +3 -3
- package/dist/client/assets/usage-C2lJ6qWL.js +2 -0
- package/dist/client/assets/{usageAccess-AcIxVQqJ.js → usageAccess-ZgmQIiWk.js} +2 -2
- package/dist/client/assets/{usageFormat-BXW38hCK.js → usageFormat-C54RJiV9.js} +2 -2
- package/dist/client/assets/{usageShortcuts-Qkdifm3k.js → usageShortcuts-B3af64g0.js} +2 -2
- package/dist/client/assets/{use-atom-command-BJxdfyHC.js → use-atom-command-D34CFqu3.js} +2 -2
- package/dist/client/assets/{useAriaLabelledBy-C0a8QEEb.js → useAriaLabelledBy-BG5RCb1o.js} +2 -2
- package/dist/client/assets/useHandleNewThread-DtUtwJAY.js +2 -0
- package/dist/client/assets/{useLocation-BQDC59xg.js → useLocation-7uJHNdPS.js} +2 -2
- package/dist/client/assets/useNavigate-DCj963r2.js +2 -0
- package/dist/client/assets/{useNavigateBack-BH5As9D1.js → useNavigateBack-DpCLZais.js} +2 -2
- package/dist/client/assets/{useP4ConnectAuthPrompt-DHu7R38-.js → useP4ConnectAuthPrompt-D4kHnZ3Q.js} +2 -2
- package/dist/client/assets/{useParams-BMa26XZG.js → useParams-Br7l7qPU.js} +2 -2
- package/dist/client/assets/{usePermissionStatus-CUViQRYY.js → usePermissionStatus-SyBwmFSK.js} +2 -2
- package/dist/client/assets/{usePullRequestActions-DGkavykA.js → usePullRequestActions-BypvA9CK.js} +3 -3
- package/dist/client/assets/{useRegisterFieldControl-CosvijuC.js → useRegisterFieldControl-qXOWsCr5.js} +2 -2
- package/dist/client/assets/{useScopedModelAvailability-DOJzIjns.js → useScopedModelAvailability-YXOv7_8D.js} +2 -2
- package/dist/client/assets/useSettings-BcmuuiTp.js +3 -0
- package/dist/client/assets/utils-hgbJ2TVM.js +37 -0
- package/dist/client/assets/vcsRefInvalidation-hPKz3TmL.js +2 -0
- package/dist/client/assets/{vennDiagram-4TSXK5OY-DvpVodA1.js → vennDiagram-4TSXK5OY-D4zvlwrY.js} +2 -2
- package/dist/client/assets/{wardley-WFR3VGLG-CW8u1RAF.js → wardley-WFR3VGLG-Cscy0eBS.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-VM6X3IG4-B34GmEPm.js → wardleyDiagram-VM6X3IG4-od5X9Ppf.js} +2 -2
- package/dist/client/assets/welcome-7UQgfS5x.js +2 -0
- package/dist/client/assets/{xychartDiagram-S5SC5T6Z-Ds5Ioly5.js → xychartDiagram-S5SC5T6Z-KWfWaW4I.js} +2 -2
- package/dist/client/index.html +1 -1
- package/dist/{renderer-ClrN4p2R.mjs → renderer-U6GevbYv.mjs} +2 -2
- package/dist/{runtime-BQydA64s.mjs → runtime-Cui_uQWU.mjs} +88 -5
- package/package.json +1 -1
- package/dist/client/assets/AlertDialogRoot-DCfR_LaK.js +0 -2
- package/dist/client/assets/ChatGptUsageButton-CoiZRjaS.js +0 -2
- package/dist/client/assets/CheckboxIndicator-DcH9EpvK.js +0 -2
- package/dist/client/assets/CodexSetupSection.logic-sXohw-MK.js +0 -2
- package/dist/client/assets/CollapsiblePanel-FknKvWoA.js +0 -2
- package/dist/client/assets/ComboboxClear-RsGmZUJN.js +0 -2
- package/dist/client/assets/ComboboxGroupLabel-DO1lnPnr.js +0 -2
- package/dist/client/assets/CompositeRoot-DDZcK2m0.js +0 -2
- package/dist/client/assets/DevicePanel-DmfTFNuU.js +0 -2
- package/dist/client/assets/DialogTitle-Dr-LJLpq.js +0 -2
- package/dist/client/assets/DiffPanel-CEx8f_mo.js +0 -2
- package/dist/client/assets/EmbeddedDesign-DmybFtYo.css +0 -1
- package/dist/client/assets/EmbeddedDesign-Hba9k7LF.js +0 -19
- package/dist/client/assets/Input-DCMTYdrA.js +0 -2
- package/dist/client/assets/PanelLayoutControls-CCYVBazN.js +0 -216
- package/dist/client/assets/PopoverHandle-1bqR8KHF.js +0 -2
- package/dist/client/assets/PreviewPanel-Kq4mVufQ.js +0 -2
- package/dist/client/assets/ProjectDefaultsSettings-DUCUj4oc.js +0 -2
- package/dist/client/assets/ProviderModelPicker-BrEkNDPF.js +0 -2
- package/dist/client/assets/PullRequestCodeTab-DA-5pWeg.js +0 -6
- package/dist/client/assets/RenderErrorBoundary-yWjbnzsc.js +0 -2
- package/dist/client/assets/ScheduledTasksSettings-B1bSNXTP.js +0 -4
- package/dist/client/assets/SelectScrollUpArrow-kQBsA9rk.js +0 -2
- package/dist/client/assets/ThreadTerminalDrawer-BU_DR6wu.js +0 -5
- package/dist/client/assets/TooltipViewport-CG7gtflQ.js +0 -2
- package/dist/client/assets/_chat-DMXSEEst.js +0 -45
- package/dist/client/assets/_chat.pull-requests-w2FCKIZ8.js +0 -2
- package/dist/client/assets/architecture-7GRP2DOG-BVExhwPq.js +0 -1
- package/dist/client/assets/assets-DW8sK93I.js +0 -2
- package/dist/client/assets/channel-BLnKdGtk.js +0 -2
- package/dist/client/assets/classDiagram-ZZMXUADV-B839piSM.js +0 -2
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-B839piSM.js +0 -2
- package/dist/client/assets/composer-logic-CEsP6SV6.js +0 -6
- package/dist/client/assets/design-B7V20I1i.js +0 -2
- package/dist/client/assets/device-DX-G6J1j.js +0 -2
- package/dist/client/assets/entities-Bj5ceyfn.js +0 -2
- package/dist/client/assets/eventmodeling-NTZA5JFV-CrSSBuUT.js +0 -1
- package/dist/client/assets/flowDiagram-HODETNUW-GdATwCAd.js +0 -1
- package/dist/client/assets/ghostty-write-pty-hgyAvVbe.wasm +0 -0
- package/dist/client/assets/git-compare-DW_c6fci.js +0 -2
- package/dist/client/assets/main-Byysx0nX.css +0 -2
- package/dist/client/assets/main-D8FWUaO_.js +0 -26
- package/dist/client/assets/mediaSource-DrVcMaQl.js +0 -2
- package/dist/client/assets/number-field-BHWzsgFF.js +0 -2
- package/dist/client/assets/onboarding-BkSIwdaJ.js +0 -2
- package/dist/client/assets/openFileInPreview-3vlmqdKv.js +0 -2
- package/dist/client/assets/primary-CKEI970r.js +0 -2
- package/dist/client/assets/primaryCloudLinkState-CwxbxrZn.js +0 -2
- package/dist/client/assets/projectFilesQueryState-45r9sIZp.js +0 -2
- package/dist/client/assets/projectScriptEditor-CI1LZs9V.js +0 -2
- package/dist/client/assets/pullRequests-DLPX2CY-.js +0 -2
- package/dist/client/assets/queries-lVyDrFzk.js +0 -2
- package/dist/client/assets/query-tgXMuDtS.js +0 -2
- package/dist/client/assets/radio-group-CJu78gKo.js +0 -2
- package/dist/client/assets/railroad-abnf-HS5TGJTU-Ce_EhWE2.js +0 -1
- package/dist/client/assets/railroad-ebnf-LZEXJU2U-BWrImE-J.js +0 -1
- package/dist/client/assets/railroad-peg-WCYAUIDC-BydBUlqT.js +0 -1
- package/dist/client/assets/rightPanelStore-Csibei0O.js +0 -2
- package/dist/client/assets/runtime-DATbE5vH.js +0 -6
- package/dist/client/assets/runtime-Dks8Wo5P.js +0 -2
- package/dist/client/assets/runtimeModeConfig-n1vq0Zzd.js +0 -2
- package/dist/client/assets/server-rxH1493J.js +0 -2
- package/dist/client/assets/session-Bgs0dTwK.js +0 -2
- package/dist/client/assets/session-logic-BuYRdtPc.js +0 -26
- package/dist/client/assets/settings.appearance-DV608fbL.js +0 -2
- package/dist/client/assets/settings.archived-Cav4CAd_.js +0 -2
- package/dist/client/assets/settings.connections-C9Kh1b2k.js +0 -2
- package/dist/client/assets/settings.designs-DgLVIZOE.js +0 -2
- package/dist/client/assets/settings.diagnostics-CaXx9YEU.js +0 -2
- package/dist/client/assets/settings.general-BOpvFj1F.js +0 -2
- package/dist/client/assets/settings.integrations-MHjX-SLC.js +0 -2
- package/dist/client/assets/settings.projects-BiDMtruF.js +0 -4
- package/dist/client/assets/settings.providers-BarMZxaG.js +0 -3
- package/dist/client/assets/settings.scheduled-tasks-BA_O1-Fn.js +0 -2
- package/dist/client/assets/settings.snap-shot-Crh49RtQ.js +0 -2
- package/dist/client/assets/settings.source-control-DIrrX9Dt.js +0 -2
- package/dist/client/assets/settingsLayout-BQsOdImg.js +0 -3
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-DlcRyn96.js +0 -2
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-lbxQDJ07.js +0 -9
- package/dist/client/assets/toast-gFAddE-Q.js +0 -2
- package/dist/client/assets/usage-B3PzCXST.js +0 -2
- package/dist/client/assets/useHandleNewThread-BUYzfgdc.js +0 -2
- package/dist/client/assets/useNavigate-BziZQ-Vx.js +0 -2
- package/dist/client/assets/useSettings-B_WzhJqU.js +0 -3
- package/dist/client/assets/utils-BctiQ4Ue.js +0 -37
- package/dist/client/assets/vcsRefInvalidation-cn2N4Xey.js +0 -2
- package/dist/client/assets/welcome-DEFnpzjQ.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{$n as n,$o as r,Ds as i,Es as a,I_ as o,Jm as s,Jn as c,Jp as l,Lf as u,Ny as d,Od as f,RE as p,RT as m,Ty as h,Uy as g,Yo as _,Zn as v,cr as y,ds as b,el as x,gb as S,ks as C,lb as w,lr as T,mE as E,qn as D,rr as O,rs as k,s_ as A,sm as j,t as M,ts as N,ur as P,xd as ee,zp as F}from"./utils-hgbJ2TVM.js";import{B as I,L,W as R,q as z}from"./runtime-Cj24N7je.js";import{a as B,c as V,o as te,s as ne,t as re}from"./select-Bsag72zE.js";import{t as ie}from"./useNavigateBack-DpCLZais.js";import{rt as ae}from"./useSettings-BcmuuiTp.js";import{f as oe,s as se}from"./server-Vynm5NwP.js";import{n as H,t as U}from"./session-DyiiEN5g.js";import{t as ce}from"./use-atom-command-D34CFqu3.js";import{a as le,c as ue,d as W,f as G,i as de,l as K,n as fe,o as pe,r as q,s as J,t as Y,u as me}from"./usageFormat-C54RJiV9.js";import{t as he}from"./env-wK1YYxA8.js";import{a as ge,n as _e,t as ve}from"./tooltip-D-SzZpgJ.js";import{t as X}from"./skeleton-Bq50sEah.js";import{n as ye,t as be}from"./toggle-group-Clz6KDtW.js";import{t as xe}from"./input-D_jxqXLR.js";import{t as Se}from"./scroll-area-DORwTFtw.js";import{a as Ce,c as we,i as Te,o as Ee,r as De,s as Oe,t as ke}from"./dialog-Cgb4jap2.js";import{o as Ae}from"./sidebar-CV_a9dPF.js";import{t as je}from"./observeResize-jHx61cGA.js";import{y as Me}from"./keybindings-CqjUKNRx.js";import{i as Ne,o as Pe,t as Fe}from"./popover-2XJd3KEJ.js";import{S as Ie,n as Le,t as Re}from"./ChatGptUsageButton-8lmdyDiG.js";import{t as ze}from"./WorkspacePageContainer-BTN44jG6.js";import{n as Be,r as Ve,t as He}from"./usageShortcuts-B3af64g0.js";import{Ca as Ue,Wr as We,ar as Ge,bi as Ke,cr as qe,or as Je,pi as Ye,sr as Xe}from"./main-4dRVuXx2.js";import{t as Ze}from"./WorkspacePageHeader-BaCxaW-R.js";import{i as Qe,n as $e,r as et,t as tt}from"./WorkspaceBreadcrumb-B5ZV6VNj.js";import{t as nt}from"./usageAccess-ZgmQIiWk.js";var Z=e(t(),1),Q=p(),rt=w(z);function it(e,t){return e?.sources.some(e=>e.action===`enableCursorKeychain`)===!0&&t?.some(e=>e.driver===`cursor`&&e.status===`ready`)===!0}function at(e){return e.some(e=>e.summary?.sources.some(e=>e.fingerprint.provider===`cursor`&&e.fingerprint.hostId===`cursor.com`))?[]:e.filter(e=>e.needsCursorKeychainAccess)}var ot=new Map,st=new Map;async function ct(e,t,n=!1,r=!1){let i=st.get(e);if(i!==void 0){if(r){try{await i}catch{}return ct(e,t,!1,!0)}return n?void 0:await i}let a=ot.get(e)??0;if(n&&Date.now()<a)return;let o=Promise.resolve().then(t).finally(()=>{st.delete(e),ot.set(e,Date.now()+3e5)});return st.set(e,o),await o}async function lt({registry:e,server:t,presentations:n,environmentIds:r,input:i}){await Promise.all(r.map(async r=>{let a=t.usageSummary({environmentId:r,input:i}),o=n.presentationAtom(r),s=new AbortController,c=()=>{e.get(o)?.connection.phase!==`connected`&&s.abort()},l=e.subscribe(o,c);c();try{let n=await I(e,t.refreshUsageRates,{environmentId:r,input:{}},{reportFailure:!1}),i=n._tag===`Failure`&&rt(R(n));if(e.refresh(a),i||s.signal.aborted)return;await L(e,a,{reportFailure:!1,signal:s.signal})}finally{l()}}))}function ut(e,t=!1){let{summary:n}=e;if(!e.isConnected||e.error!==null)return{phase:`inactive`};if(n===null)return{phase:`loading`};if(t)return{phase:`stale`};if(!e.isPending)return{phase:`ready`};let r=[...new Set(n.sources.flatMap(e=>e.refreshing?[e.fingerprint.provider]:[]))];return r.length>0?{phase:`partway`,providers:r}:{phase:`stale`}}function dt(e,t){return e.length===1?`Updating ${t(e[0])}…`:`Updating ${e.length} providers…`}function ft(e,t=!1){let n=new Set,r=!1;for(let i of e){let e=ut(i,t);if((e.phase===`loading`||e.phase===`stale`)&&(r=!0),e.phase===`partway`)for(let t of e.providers)n.add(t)}return{partial:r||n.size>0,everyProvider:r,providers:n}}function pt(e){return e.records>0&&e.unpricedRecords>=e.records}function mt(e){return[e.hostId,e.provider,e.resolvedHomePath,e.volumeId].join(` `)}function ht(e,t){let n=e.sources.filter(e=>e.fingerprint.provider===t.fingerprint.provider);return e.buckets.filter(e=>e.provider===t.fingerprint.provider&&(e.sourcePath===t.fingerprint.resolvedHomePath||e.sourcePath===void 0&&n.length===1))}function gt(e){return JSON.stringify([e.day,e.hourStart??null,e.provider,e.model])}function _t(e){let t=new Map,n=new Map,r=new Map,i=new Map,a=new Map,o=[],s=[...e].sort((e,t)=>(Date.parse(t.summary.readAt)||0)-(Date.parse(e.summary.readAt)||0)||e.environmentId.localeCompare(t.environmentId));for(let e of[`ok`,`partial`,`failed`])for(let r of s)for(let i of r.summary.sources){if(i.status!==e)continue;let s=mt(i.fingerprint);if(t.has(s)){o.push(`${r.label}: ${i.fingerprint.resolvedHomePath}`);continue}t.set(s,r.environmentId),n.set(s,{environment:r,source:i}),a.set(s,i.distinctSessions)}for(let e of s)for(let t of e.summary.sources){if(t.status!==`partial`)continue;let o=mt(t.fingerprint),s=n.get(o);if(s?.source.status!==`ok`||Date.parse(e.summary.readAt)<=Date.parse(s.environment.summary.readAt))continue;let c=r.get(o);c===void 0&&(c=new Set(ht(s.environment.summary,s.source).map(gt)),r.set(o,c));let l=i.get(e.environmentId)??new Set,u=!1;for(let n of ht(e.summary,t)){let e=gt(n);c.has(e)||(c.add(e),l.add(n),u=!0)}u&&(i.set(e.environmentId,l),a.set(o,Math.max(a.get(o)??0,t.distinctSessions)))}return{ownerByFingerprint:t,supplementalBucketsByEnvironment:i,sessionsByFingerprint:a,duplicates:o}}function vt(e,t,n,r){let i=new Set,a=new Set,o=new Map;for(let n of e.summary.sources){if(n.status===`missing`)continue;let s=mt(n.fingerprint);if(t.get(s)===e.environmentId){let e=n.fingerprint.provider;i.add(e),a.add(`${e}\u0000${n.fingerprint.resolvedHomePath}`),o.set(e,(o.get(e)??0)+(r.get(s)??n.distinctSessions))}}return{buckets:e.summary.buckets.filter(e=>n.has(e)||(e.sourcePath===void 0?i.has(e.provider):a.has(`${e.provider}\u0000${e.sourcePath}`))),sessionsByProvider:o}}function yt(e){return e.totals.uncachedInputTokens+e.totals.cachedInputTokens+e.totals.cacheCreationTokens+e.totals.outputTokens}function bt(e,t){return e>=4&&e<=t}var xt={costUsd:0,uncachedInputTokens:0,cachedInputTokens:0,cacheCreationTokens:0,outputTokens:0,reasoningTokens:0,totalTokens:0,records:0,sessions:0,providers:[],models:[],daily:[],hourly:[],costQuality:{providerReportedShare:0,modelPricedShare:0,unpricedShare:0,cacheSavingsUsd:0},categoryCost:{input:0,cacheRead:0,cacheWrite:0,output:0,unsplit:0},speedCost:{standard:0,fast:0,ultrafast:0,premium:0},duplicateSources:[],contributingEnvironments:[],contractMismatches:[]};function St(e,t){if(e.length===0)return xt;let n=[],r=[];for(let i of e)bt(i.summary.contractVersion,t)?n.push(i):r.push({environmentId:i.environmentId,direction:i.summary.contractVersion<t?`serverBehind`:`clientBehind`,contractVersion:i.summary.contractVersion});let{ownerByFingerprint:i,supplementalBucketsByEnvironment:a,sessionsByFingerprint:o,duplicates:s}=_t(n),c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0,y={input:0,cacheRead:0,cacheWrite:0,output:0},b={fast:0,ultrafast:0,premium:0},x=new Map,S=new Map,C=new Map,w=new Map,T=[];for(let e of n){let{buckets:t,sessionsByProvider:n}=vt(e,i,a.get(e.environmentId)??new Set,o);t.length>0&&T.push(e.environmentId);for(let[e,t]of n){if(h+=t,t===0)continue;let n=x.get(e)??{costUsd:0,totalTokens:0,records:0,sessions:0};n.sessions+=t,x.set(e,n)}for(let e of t){let t=yt(e);c+=e.costUsd,g+=e.cacheSavingsUsd,l+=e.totals.uncachedInputTokens,u+=e.totals.cachedInputTokens,d+=e.totals.cacheCreationTokens,f+=e.totals.outputTokens,p+=e.totals.reasoningTokens,m+=e.records,v+=e.unpricedRecords,e.costSource===`providerReported`&&(_+=e.records),e.categoryCostUsd!==void 0&&(y.input+=e.categoryCostUsd.input,y.cacheRead+=e.categoryCostUsd.cacheRead,y.cacheWrite+=e.categoryCostUsd.cacheWrite,y.output+=e.categoryCostUsd.output),b.fast+=e.fastCostUsd??0,b.ultrafast+=e.ultrafastCostUsd??0,b.premium+=e.speedPremiumUsd??0;let n=x.get(e.provider)??{costUsd:0,totalTokens:0,records:0,sessions:0};n.costUsd+=e.costUsd,n.totalTokens+=t,n.records+=e.records,x.set(e.provider,n);let r=`${e.provider} ${e.model}`,i=S.get(r)??{provider:e.provider,costUsd:0,totalTokens:0,tokens:{uncachedInputTokens:0,cachedInputTokens:0,cacheCreationTokens:0,outputTokens:0,reasoningTokens:0},records:0,unpricedRecords:0,unpricedTokens:0};i.costUsd+=e.costUsd,i.totalTokens+=t,i.tokens={uncachedInputTokens:i.tokens.uncachedInputTokens+e.totals.uncachedInputTokens,cachedInputTokens:i.tokens.cachedInputTokens+e.totals.cachedInputTokens,cacheCreationTokens:i.tokens.cacheCreationTokens+e.totals.cacheCreationTokens,outputTokens:i.tokens.outputTokens+e.totals.outputTokens,reasoningTokens:i.tokens.reasoningTokens+e.totals.reasoningTokens},i.records+=e.records,i.unpricedRecords+=e.unpricedRecords,e.records>0&&(i.unpricedTokens+=t*e.unpricedRecords/e.records),S.set(r,i);let a=C.get(e.day)??{costUsd:0,totalTokens:0,byProvider:new Map};a.costUsd+=e.costUsd,a.totalTokens+=t;let o=a.byProvider.get(e.provider)??{costUsd:0,totalTokens:0};if(o.costUsd+=e.costUsd,o.totalTokens+=t,a.byProvider.set(e.provider,o),C.set(e.day,a),e.hourStart!==void 0){let n=w.get(e.hourStart)??{day:e.day,hourStart:e.hourStart,costUsd:0,totalTokens:0,byProvider:new Map};n.costUsd+=e.costUsd,n.totalTokens+=t;let r=n.byProvider.get(e.provider)??{costUsd:0,totalTokens:0};r.costUsd+=e.costUsd,r.totalTokens+=t,n.byProvider.set(e.provider,r),w.set(e.hourStart,n)}}}let E=l+u+d+f,D=[...x.entries()].map(([e,t])=>({provider:e,costUsd:t.costUsd,totalTokens:t.totalTokens,records:t.records,sessions:t.sessions,costShare:c===0?0:t.costUsd/c,tokenShare:E===0?0:t.totalTokens/E})).sort((e,t)=>t.costUsd-e.costUsd),O=[...S.entries()].map(([e,t])=>({model:e.slice(e.indexOf(` `)+1),provider:t.provider,costUsd:t.costUsd,totalTokens:t.totalTokens,tokens:t.tokens,records:t.records,unpricedRecords:t.unpricedRecords,unpricedTokens:t.unpricedTokens,costShare:c===0?0:t.costUsd/c,tokenShare:E===0?0:t.totalTokens/E})).sort((e,t)=>t.costUsd-e.costUsd||t.totalTokens-e.totalTokens),k=[...C.entries()].map(([e,t])=>({day:e,costUsd:t.costUsd,totalTokens:t.totalTokens,byProvider:t.byProvider})).sort((e,t)=>e.day.localeCompare(t.day)),A=[...w.values()].sort((e,t)=>e.hourStart.localeCompare(t.hourStart));return{costUsd:c,uncachedInputTokens:l,cachedInputTokens:u,cacheCreationTokens:d,outputTokens:f,reasoningTokens:p,totalTokens:E,records:m,sessions:h,providers:D,models:O,daily:k,hourly:A,costQuality:{providerReportedShare:m===0?0:_/m,unpricedShare:m===0?0:v/m,modelPricedShare:m===0?0:(m-_-v)/m,cacheSavingsUsd:g},categoryCost:{...y,unsplit:Math.max(0,c-y.input-y.cacheRead-y.cacheWrite-y.output)},speedCost:{...b,standard:Math.max(0,c-b.fast-b.ultrafast)},duplicateSources:s,contributingEnvironments:T,contractMismatches:r}}var Ct=N(e=>k(t=>{let n=JSON.parse(e),r=t(ae.presentationsAtom),i=[];for(let[e,o]of r){let r=o.connection.phase===`connected`,s=t(U.sessionStateAtom(e)),c=nt({connectionPhase:o.connection.phase,session:m(a(s)),hasSessionError:s._tag===`Failure`});if(!c.canReadDiagnostics){i.push({environmentId:e,label:o.entry.target.label,isConnected:r,...c,summary:null,needsCursorKeychainAccess:!1});continue}let l=t(oe.usageSummary({environmentId:e,input:n})),u=m(a(l));i.push({environmentId:e,label:o.entry.target.label,isPending:l.waiting,canReadDiagnostics:!0,isConnected:r,error:l._tag===`Failure`?`This environment could not report usage.`:null,summary:u,needsCursorKeychainAccess:it(u,t(oe.providersValueAtom(e)))})}return i}).pipe(b(`web-usage:window:${e}`)));function wt(e,t){return St(e.flatMap(({environmentId:e,label:n,summary:r})=>r===null?[]:[{environmentId:e,label:n,summary:t===void 0?r:{...r,buckets:r.buckets.filter(t)}}]),6)}var Tt=new Set;function Et(e,t){return t.size===0?e:e.map(e=>e.summary===null?e:{...e,summary:{...e.summary,buckets:e.summary.buckets.filter(e=>!t.has(e.provider)),sources:e.summary.sources.filter(e=>!t.has(e.fingerprint.provider))}})}function Dt(e,t,n){let i=(0,Q.c)(36),a=t===void 0?null:t,o=n===void 0?Tt:n,s;i[0]!==e.resolution||i[1]!==e.sinceDay||i[2]!==e.sinceTime||i[3]!==e.timeZone||i[4]!==e.untilDay||i[5]!==e.untilTime?(s=JSON.stringify({sinceDay:e.sinceDay,untilDay:e.untilDay,timeZone:e.timeZone,resolution:e.resolution,sinceTime:e.sinceTime,untilTime:e.untilTime}),i[0]=e.resolution,i[1]=e.sinceDay,i[2]=e.sinceTime,i[3]=e.timeZone,i[4]=e.untilDay,i[5]=e.untilTime,i[6]=s):s=i[6];let c=s,l;i[7]===c?l=i[8]:(l=Ct(c),i[7]=c,i[8]=l);let u=r(l),d;i[9]!==u||i[10]!==a?(d=a===null?u:u.filter(e=>a.has(e.environmentId)),i[9]=u,i[10]=a,i[11]=d):d=i[11];let f=d,p;i[12]!==f||i[13]!==c?(p=e=>lt({registry:_,server:oe,presentations:ae,environmentIds:f.filter(jt).map(At),input:e??JSON.parse(c)}),i[12]=f,i[13]=c,i[14]=p):p=i[14];let m=p,h;i[15]!==o||i[16]!==f?(h=wt(Et(f,o)),i[15]=o,i[16]=f,i[17]=h):h=i[17];let g=h,v;i[18]===f?v=i[19]:(v=f.filter(kt),i[18]=f,i[19]=v);let y=v.length,b;i[20]===f?b=i[21]:(b=f.filter(Ot),i[20]=f,i[21]=b);let x=b.length,S=y===0&&x>0,[C,w]=(0,Z.useState)(null);y>0&&(C?.merged!==g||C.window!==e||C.selection!==a||C.hidden!==o)&&w({window:e,merged:g,selection:a,hidden:o});let T=C?.selection===a&&C.hidden===o?C:null,E;i[22]!==y||i[23]!==e||i[24]!==S||i[25]!==T||i[26]!==g?(E=y>0?{window:e,merged:g}:T??(S?null:{window:e,merged:g}),i[22]=y,i[23]=e,i[24]=S,i[25]=T,i[26]=g,i[27]=E):E=i[27];let D=E,O=y>0&&x>0,k;return i[28]!==u||i[29]!==S||i[30]!==g||i[31]!==m||i[32]!==f||i[33]!==D||i[34]!==O?(k={merged:g,environments:u,selectedEnvironments:f,isPending:S,shown:D,isPartial:O,refresh:m},i[28]=u,i[29]=S,i[30]=g,i[31]=m,i[32]=f,i[33]=D,i[34]=O,i[35]=k):k=i[35],k}function Ot(e){return e.summary===null&&e.error===null}function kt(e){return e.summary!==null}function At(e){let{environmentId:t}=e;return t}function jt(e){return e.canReadDiagnostics&&H(e.environmentId,`diagnostics:read`)}var $=e(E(),1);function Mt(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=M(`w-full caption-bottom text-xs`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,$.jsx)(`table`,{"data-slot":`table`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Nt(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=M(`[&_tr]:border-b`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`thead`,{"data-slot":`table-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Pt(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=M(`[&_tr:last-child]:border-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`tbody`,{"data-slot":`table-body`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ft(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=M(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`tr`,{"data-slot":`table-row`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function It(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=M(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`th`,{"data-slot":`table-head`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Lt(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=M(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`td`,{"data-slot":`table-cell`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Rt=[{key:`inputCostPerMillionTokens`,label:`Input`,optional:!1},{key:`outputCostPerMillionTokens`,label:`Output`,optional:!1},{key:`cacheReadCostPerMillionTokens`,label:`Cache read`,optional:!0},{key:`cacheWriteCostPerMillionTokens`,label:`Cache write`,optional:!0}];function zt(e=``,t){return{model:e,inputCostPerMillionTokens:t?.inputCostPerMillionTokens.toString()??``,outputCostPerMillionTokens:t?.outputCostPerMillionTokens.toString()??``,cacheReadCostPerMillionTokens:t?.cacheReadCostPerMillionTokens?.toString()??``,cacheWriteCostPerMillionTokens:t?.cacheWriteCostPerMillionTokens?.toString()??``}}function Bt(e){let t=e.model.trim();if(t.length===0)return null;let n={};for(let t of Rt){let r=e[t.key].trim();if(r===``){if(t.optional)continue;return null}if(!/^(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i.test(r))return null;let i=Number(r);if(!Number.isFinite(i)||i<0)return null;n[t.key]=i}return n.inputCostPerMillionTokens===void 0||n.outputCostPerMillionTokens===void 0?null:{model:t,price:{inputCostPerMillionTokens:n.inputCostPerMillionTokens,outputCostPerMillionTokens:n.outputCostPerMillionTokens,...n.cacheReadCostPerMillionTokens===void 0?{}:{cacheReadCostPerMillionTokens:n.cacheReadCostPerMillionTokens},...n.cacheWriteCostPerMillionTokens===void 0?{}:{cacheWriteCostPerMillionTokens:n.cacheWriteCostPerMillionTokens}}}}function Vt(e){return e.isNew&&e.model.trim()===``&&(e.alias??``).trim()===``&&Object.values(e.values).every(e=>e.trim()===``)}function Ht(e,t){return e.prices&&Object.hasOwn(e.prices,t)?e.prices[t]:void 0}function Ut(e,t){return e.aliases&&Object.hasOwn(e.aliases,t)?e.aliases[t]:void 0}function Wt(e,t){if(e.some(e=>e.aliases===null))return{value:``,placeholder:`Unavailable`};let n=e.map(e=>Ut(e,t)??``);return n.some(e=>e!==n[0])?{value:``,placeholder:`Mixed`}:{value:n[0]??``,placeholder:`None`}}function Gt(e,t,n){let r=Rt.find(e=>e.key===n).optional,i=e.map(e=>Ht(e,t)?zt(t,Ht(e,t))[n]:null);return e.some(e=>e.prices===null)?{value:``,placeholder:`Unavailable`}:i.some(e=>e!==i[0])?{value:``,placeholder:`Mixed`}:{value:i[0]??``,placeholder:i[0]===null?`Automatic`:r?`Input rate`:`0.00`}}function Kt(e,t){let n=[],r=new Map;for(let i of t){if(Vt(i))continue;let t=i.model.trim(),a=Ut(e,t);if(i.removed){Ht(e,t)&&n.push({model:t,price:null}),a!==void 0&&n.push({model:t,alias:null});continue}let o=(i.alias??a??``).trim();if(o!==``){t===``?r.set(i.id,`Enter a model ID.`):o===t?r.set(i.id,`Map to a different model.`):(o!==a&&n.push({model:t,alias:o}),Ht(e,t)&&n.push({model:t,price:null}));continue}if(a!==void 0&&(n.push({model:t,alias:null}),!Ht(e,t)&&Object.values(i.values).every(e=>e.trim()===``)))continue;let s=zt(t,Ht(e,t)),c={...s,...i.values},l=Bt(c);if(l===null){let n=Rt.find(e=>!e.optional&&c[e.key].trim()===``);r.set(i.id,t===``?`Enter a model ID.`:n?`${n.label} is required on ${e.label}.`:`Use non-negative numbers for prices.`);continue}let u=zt(t,l.price);Rt.some(e=>s[e.key]!==u[e.key])&&n.push(l)}return{changes:n,errors:r}}function qt(e,t){return new Map(e.filter(e=>e.unavailable===null&&e.prices!==null).flatMap(e=>[...Kt(e,t).errors]))}async function Jt(e){await Promise.all(e.targets.map(async t=>{let n,r=e.changes.get(t.environmentId)??[],i=r.flatMap(e=>`price`in e?[[e.model,e.price]]:[]),a=r.flatMap(e=>`alias`in e?[[e.model,e.alias]]:[]);if(t.unavailable!==null)n={status:`failed`,error:t.unavailable};else if(a.length>0&&t.aliases===null)n={status:`failed`,error:`Update server to map models`};else try{n=(r.length===0?{_tag:`Success`}:await e.write({environmentId:t.environmentId,input:{patch:{...i.length>0?{usagePriceOverrides:Object.fromEntries(i)}:{},...a.length>0?{usageModelAliases:Object.fromEntries(a)}:{}}}}))._tag===`Success`?{status:`saved`}:{status:`failed`,error:`Could not save. Try again.`}}catch{n={status:`failed`,error:`Could not save. Try again.`}}e.onResult(t.environmentId,n)}))}var Yt=k(e=>[...e(ae.presentationsAtom)].map(([t,n])=>{let r=e(oe.settingsValueAtom(t)),i=e(U.sessionStateAtom(t)),s=m(a(i)),c=i._tag===`Failure`?`denied`:s===null?i.waiting?`pending`:`denied`:o(s,`settings:write`)?`granted`:`denied`;return{environmentId:t,label:n.entry.target.label,prices:r?.usagePriceOverrides??null,aliases:n.serverConfig?.environment.capabilities.usageModelAliases===!0?r?.usageModelAliases??null:null,unavailable:n.connection.phase===`connected`?r===null?`Prices not loaded`:n.serverConfig?.environment.capabilities.usagePriceOverrides===!0?c===`pending`?`Checking permissions…`:c===`denied`?`Read-only access`:null:`Update server to edit prices`:`Offline`}}));function Xt(e){let t=(0,Q.c)(119),{usage:i,initialSelectedEnvironmentIds:a,initialModel:o,onOpenChange:u}=e,d=r(Yt),[f,p]=(0,Z.useState)(a),m;if(t[0]!==d||t[1]!==f){let e;t[3]===f?e=t[4]:(e=e=>f===null||f.has(e.environmentId),t[3]=f,t[4]=e),m=d.filter(e),t[0]=d,t[1]=f,t[2]=m}else m=t[2];let h=m,g;t[5]!==o||t[6]!==h?(g=()=>o===void 0||h.some(e=>Object.hasOwn(e.prices??{},o)||Object.hasOwn(e.aliases??{},o))?[]:[{id:`new:initial`,model:o,isNew:!0,values:{}}],t[5]=o,t[6]=h,t[7]=g):g=t[7];let[_,v]=(0,Z.useState)(g),[b,x]=(0,Z.useState)(!1),[S,C]=(0,Z.useState)(null),w=(0,Z.useRef)(null),E=(0,Z.useRef)(0),k;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(k={reportFailure:!1},t[8]=k):k=t[8];let A=ce(oe.updateSettings,k),j,N,P,I,L,R,z,B,V,te,ne,re,ie,ae,se;if(t[9]!==S||t[10]!==_||t[11]!==d||t[12]!==u||t[13]!==b||t[14]!==h||t[15]!==f||t[16]!==A||t[17]!==i){let e=[...new Set(h.flatMap(mn))].sort(),r;t[33]===h?r=t[34]:(r=e=>h.some(t=>t.environmentId===e.environmentId),t[33]=h,t[34]=r);let a=[...new Set([...e,...i.filter(r).flatMap(fn)])].sort(),o;t[35]===_?o=t[36]:(o=new Set(_.filter(dn).map(un)),t[35]=_,t[36]=o);let m=o,g;t[37]!==S||t[38]!==m?(g=e=>S===null||!m.has(e),t[37]=S,t[38]=m,t[39]=g):g=t[39];let k=[...e.filter(g).map(e=>_.find(t=>t.id===`model:${e}`)??{id:`model:${e}`,model:e,isNew:!1,values:{}}),..._.filter(ln)],oe=_.filter(cn);R=qt(h,oe);for(let t of oe)t.isNew&&(t.model.trim()===``?R.set(t.id,`Enter a model ID.`):S===null&&(e.includes(t.model.trim())||_.some(e=>e.id!==t.id&&e.model.trim()===t.model.trim()))&&R.set(t.id,`This model already has a row. Edit its prices there.`));z=S?.destinations.filter(e=>S.results.get(e.environmentId)?.status===`failed`)??[];let U=b||z.length>0;B=oe.length>0,I=h.length===1?h[0].label:`${h.length} environments`;let ce=f===null?`All environments`:I,le;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>{v([]),C(null)},t[40]=le):le=t[40],L=le;let ue;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(ue=e=>{p(e),C(null)},t[41]=ue):ue=t[41];let W=ue,G;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(G=e=>{v(t=>t.some(t=>t.id===e.id)?t.map(t=>t.id===e.id?e:t):[...t,e]),C(null)},t[42]=G):G=t[42];let de=G,K=sn,fe;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(fe=e=>{!e.isNew&&Object.keys(e.values).length===0&&e.alias===void 0?v(t=>t.filter(t=>t.id!==e.id)):de(e)},t[43]=fe):fe=t[43];let pe=fe,q;t[44]===h?q=t[45]:(q=(e,t,n)=>{let r={...e.values,[t]:n},i=Gt(h,e.model,t);K(e,i,n)&&delete r[t],pe({...e,values:r})},t[44]=h,t[45]=q);let J=q,Y;t[46]===h?Y=t[47]:(Y=(e,t)=>{let{alias:n,...r}=e,i=Wt(h,e.model);pe(K(e,i,t)?r:{...r,alias:t})},t[46]=h,t[47]=Y);let me=Y;V=async e=>{let t=e!==void 0&&e;if(b)return;let n=t?z:h,r=t&&S?S.drafts:oe;if(n.length===0||r.length===0)return;let i=n.map(e=>d.find(t=>t.environmentId===e.environmentId)??{...e,prices:null,aliases:null,unavailable:`Environment removed`}),a=new Map(i.map(e=>[e.environmentId,Kt(e,r)]));x(!0),C(e=>({drafts:r,destinations:t&&e?e.destinations:i,results:new Map([...t&&e?e.results:[],...i.map(on)])}));let o=!1;await Jt({targets:i.map(e=>({...e,unavailable:e.unavailable??[...a.get(e.environmentId).errors.values()][0]??null})),changes:new Map([...a].map(an)),write:async e=>H(e.environmentId,`settings:write`)?A(e):{_tag:`Failure`},onResult:(e,t)=>{t.status===`failed`&&(o=!0),C(n=>n===null?null:{...n,results:new Map(n.results).set(e,t)})}}),x(!1),o||v([])},P=ke,ae=!0,t[48]!==u||t[49]!==b?(se=e=>{b||u(e)},t[48]=u,t[49]=b,t[50]=se):se=t[50],N=Oe,re=`max-w-4xl`,t[51]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsxs)(Ce,{children:[(0,$.jsx)(we,{children:`Custom model prices`}),(0,$.jsx)(De,{children:`Prices and mappings apply to all past and future usage on the environments you select.`})]}),t[51]=ie):ie=t[51],j=Ee;let he;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,$.jsx)(Ye,{id:`usage-prices-apply-label`,className:`shrink-0`,children:`Apply to`}),t[52]=he):he=t[52];let X;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,$.jsx)(T,{variant:`outline`,size:`sm`,className:`min-w-0`}),t[53]=X):X=t[53];let ye=b||B,be;t[54]===ce?be=t[55]:(be=(0,$.jsx)(`span`,{id:`usage-prices-selection`,className:`truncate`,children:ce}),t[54]=ce,t[55]=be);let Se;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,$.jsx)(ee,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[56]=Se):Se=t[56];let Te;t[57]!==ye||t[58]!==be?(Te=(0,$.jsxs)(y,{render:X,"aria-labelledby":`usage-prices-apply-label usage-prices-selection`,disabled:ye,children:[be,Se]}),t[57]=ye,t[58]=be,t[59]=Te):Te=t[59];let Ae=f===null,je;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(je=e=>W(e?null:new Set),t[60]=je):je=t[60];let Me;t[61]===Ae?Me=t[62]:(Me=(0,$.jsx)(c,{checked:Ae,closeOnClick:!1,onCheckedChange:je,children:`All environments`}),t[61]=Ae,t[62]=Me);let Ne;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,$.jsx)(O,{}),t[63]=Ne):Ne=t[63];let Pe;if(t[64]!==d||t[65]!==h||t[66]!==f){let e;t[68]!==d.length||t[69]!==h||t[70]!==f?(e=e=>(0,$.jsx)(c,{checked:f===null||f.has(e.environmentId),closeOnClick:!1,onCheckedChange:t=>{let n=new Set(h.map(rn));t?n.add(e.environmentId):n.delete(e.environmentId),W(n.size===d.length?null:n)},children:(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.unavailable?(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.unavailable}):null]})},e.environmentId),t[68]=d.length,t[69]=h,t[70]=f,t[71]=e):e=t[71],Pe=d.map(e),t[64]=d,t[65]=h,t[66]=f,t[67]=Pe}else Pe=t[67];let Fe;t[72]!==Me||t[73]!==Pe?(Fe=(0,$.jsxs)(n,{align:`start`,children:[Me,Ne,Pe]}),t[72]=Me,t[73]=Pe,t[74]=Fe):Fe=t[74];let Ie;t[75]!==Te||t[76]!==Fe?(Ie=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[he,(0,$.jsxs)(D,{children:[Te,Fe]})]}),t[75]=Te,t[76]=Fe,t[77]=Ie):Ie=t[77];let Le;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`USD / million tokens`}),t[78]=Le):Le=t[78],t[79]===Ie?te=t[80]:(te=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[Ie,Le]}),t[79]=Ie,t[80]=te),ne=h.length===0?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:d.length===0?`Connect an environment to set model prices.`:`Select an environment to see and change its model prices.`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`min-w-0 overflow-hidden rounded-lg border border-border`,children:(0,$.jsxs)(Mt,{className:`min-w-180 table-fixed`,"aria-label":`Custom model prices`,children:[(0,$.jsxs)(`colgroup`,{children:[(0,$.jsx)(`col`,{className:`w-[22%]`}),(0,$.jsx)(`col`,{className:`w-[18%]`}),Rt.map(nn),(0,$.jsx)(`col`,{className:`w-10`})]}),(0,$.jsx)(Nt,{children:(0,$.jsxs)(Ft,{children:[(0,$.jsx)(It,{children:`Model ID`}),(0,$.jsx)(It,{children:`Map to`}),Rt.map(tn),(0,$.jsx)(It,{children:(0,$.jsx)(T,{size:`icon-xs`,variant:`ghost`,"aria-label":`Add model price`,disabled:U,onClick:()=>{E.current+=1;let e=`new:${E.current}`;w.current=e,de({id:e,model:``,isNew:!0,values:{}})},children:(0,$.jsx)(F,{"aria-hidden":!0})})})]})}),(0,$.jsx)(Pt,{children:k.length===0?(0,$.jsx)(Ft,{children:(0,$.jsx)(Lt,{colSpan:7,className:`text-center whitespace-normal`,children:(0,$.jsx)(`p`,{className:`py-6 text-muted-foreground`,children:h.some(en)?`Some environment prices are unavailable.`:`No custom prices or mappings. Add a row to set one.`})})}):k.map(e=>{let t=Wt(h,e.model),n=(e.alias??t.value).trim();return(0,$.jsxs)(Ft,{"data-row-id":e.id,children:[(0,$.jsxs)(Lt,{className:`whitespace-normal`,children:[e.isNew?(0,$.jsx)(xe,{size:`compact`,value:e.model,ref:t=>{t&&w.current===e.id&&(t.focus(),w.current=null)},"aria-label":`New model ID`,"aria-invalid":e.model.trim()!==``&&R.has(e.id)||void 0,list:`usage-price-models`,placeholder:`Model ID`,autoComplete:`off`,spellCheck:!1,disabled:U,onChange:t=>de({...e,model:t.target.value})}):(0,$.jsx)(`span`,{className:M(`block break-all`,e.removed&&`text-muted-foreground line-through`),children:e.model}),R.has(e.id)&&(e.model.trim()!==``||Object.values(e.values).some($t))?(0,$.jsx)(`p`,{role:`alert`,className:`mt-1 text-xs text-destructive`,children:R.get(e.id)}):null]}),e.removed?(0,$.jsx)(Lt,{colSpan:5,children:(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`Automatic pricing after saving`})}):(0,$.jsx)(Lt,{children:(0,$.jsx)(xe,{size:`compact`,value:e.alias??t.value,"aria-label":`Map ${e.model||`new model`} to model`,list:`usage-alias-models`,placeholder:e.isNew?`Optional`:t.placeholder,autoComplete:`off`,spellCheck:!1,disabled:U,onChange:t=>me(e,t.target.value)})}),e.removed?null:n===``?Rt.map(t=>{let n=Gt(h,e.model,t.key);return(0,$.jsx)(Lt,{children:(0,$.jsx)(xe,{size:`compact`,inputMode:`decimal`,"aria-label":`${t.label} price for ${e.model||`new model`}`,value:e.values[t.key]??(e.isNew?``:n.value),placeholder:e.isNew?t.optional?`Input rate`:`0.00`:n.placeholder,autoComplete:`off`,disabled:U,font:`mono`,onChange:n=>J(e,t.key,n.target.value)})},t.key)}):(0,$.jsx)(Lt,{colSpan:4,className:`whitespace-normal`,children:(0,$.jsxs)(`span`,{className:`break-all text-muted-foreground`,children:[`Counted as `,n]})}),(0,$.jsx)(Lt,{children:(0,$.jsxs)(ve,{children:[(0,$.jsx)(ge,{render:(0,$.jsx)(T,{size:`icon-xs`,variant:`ghost`}),disabled:U,"aria-label":e.removed?`Undo reset for ${e.model}`:e.isNew?`Remove new model`:`Reset price for ${e.model} to automatic`,onClick:()=>{e.isNew?v(t=>t.filter(t=>t.id!==e.id)):e.removed?pe({...e,removed:!1}):de({...e,removed:!0})},children:e.isNew?(0,$.jsx)(s,{"aria-hidden":!0}):(0,$.jsx)(l,{"aria-hidden":!0})}),(0,$.jsx)(_e,{children:e.removed?`Undo reset`:e.isNew?`Remove row`:`Reset to automatic`})]})})]},e.id)})})]})}),(0,$.jsx)(`datalist`,{id:`usage-price-models`,children:a.filter(t=>!e.includes(t)).map(Qt)}),(0,$.jsx)(`datalist`,{id:`usage-alias-models`,children:a.filter(e=>h.every(t=>!Object.hasOwn(t.aliases??{},e))).map(Zt)}),(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Blank cache rates use the input price. Enter 0 for free tokens. A mapped model’s usage counts as the model it maps to.`,h.length>1?` Mixed cells keep each environment’s rate until you edit them.`:``]})]}),t[9]=S,t[10]=_,t[11]=d,t[12]=u,t[13]=b,t[14]=h,t[15]=f,t[16]=A,t[17]=i,t[18]=j,t[19]=N,t[20]=P,t[21]=I,t[22]=L,t[23]=R,t[24]=z,t[25]=B,t[26]=V,t[27]=te,t[28]=ne,t[29]=re,t[30]=ie,t[31]=ae,t[32]=se}else j=t[18],N=t[19],P=t[20],I=t[21],L=t[22],R=t[23],z=t[24],B=t[25],V=t[26],te=t[27],ne=t[28],re=t[29],ie=t[30],ae=t[31],se=t[32];let U;t[81]===S?U=t[82]:(U=S?(0,$.jsx)(`div`,{role:`status`,className:`grid gap-1 text-xs`,children:S.destinations.map(e=>{let t=S.results.get(e.environmentId);return(0,$.jsxs)(`div`,{className:`flex justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`truncate text-muted-foreground`,children:e.label}),(0,$.jsx)(`span`,{className:t?.status===`failed`?`text-right text-destructive`:`text-muted-foreground`,children:t?.status===`failed`?`Not saved · ${t.error}`:t?.status===`saved`?`Saved`:`Saving…`})]},e.environmentId)})}):null,t[81]=S,t[82]=U);let le;t[83]!==j||t[84]!==U||t[85]!==te||t[86]!==ne?(le=(0,$.jsxs)(j,{children:[te,ne,U]}),t[83]=j,t[84]=U,t[85]=te,t[86]=ne,t[87]=le):le=t[87];let ue=B?`Changes apply to ${I}`:``,W;t[88]===ue?W=t[89]:(W=(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:ue}),t[88]=ue,t[89]=W);let G;t[90]!==L||t[91]!==z.length||t[92]!==B||t[93]!==b?(G=B?(0,$.jsx)(T,{variant:`ghost`,disabled:b,onClick:L,children:z.length>0?`Discard pending changes`:`Discard changes`}):null,t[90]=L,t[91]=z.length,t[92]=B,t[93]=b,t[94]=G):G=t[94];let de=b||!B&&z.length===0||z.length===0&&(R.size>0||h.length===0),K;t[95]!==z.length||t[96]!==V?(K=()=>void V(z.length>0),t[95]=z.length,t[96]=V,t[97]=K):K=t[97];let fe=b?`Saving…`:z.length>0?`Retry failed saves`:`Save changes`,pe;t[98]!==de||t[99]!==K||t[100]!==fe?(pe=(0,$.jsx)(T,{disabled:de,onClick:K,children:fe}),t[98]=de,t[99]=K,t[100]=fe,t[101]=pe):pe=t[101];let q;t[102]!==G||t[103]!==pe?(q=(0,$.jsxs)(`div`,{className:`flex w-full flex-wrap justify-end gap-2 sm:w-auto`,children:[G,pe]}),t[102]=G,t[103]=pe,t[104]=q):q=t[104];let J;t[105]!==W||t[106]!==q?(J=(0,$.jsxs)(Te,{variant:`bare`,className:`items-center sm:justify-between`,children:[W,q]}),t[105]=W,t[106]=q,t[107]=J):J=t[107];let Y;t[108]!==N||t[109]!==le||t[110]!==J||t[111]!==re||t[112]!==ie?(Y=(0,$.jsxs)(N,{className:re,children:[ie,le,J]}),t[108]=N,t[109]=le,t[110]=J,t[111]=re,t[112]=ie,t[113]=Y):Y=t[113];let me;return t[114]!==P||t[115]!==Y||t[116]!==ae||t[117]!==se?(me=(0,$.jsx)(P,{open:ae,onOpenChange:se,children:Y}),t[114]=P,t[115]=Y,t[116]=ae,t[117]=se,t[118]=me):me=t[118],me}function Zt(e){return(0,$.jsx)(`option`,{value:e},e)}function Qt(e){return(0,$.jsx)(`option`,{value:e},e)}function $t(e){return e!==``}function en(e){return e.prices===null}function tn(e){return(0,$.jsx)(It,{children:e.label},e.key)}function nn(e){return(0,$.jsx)(`col`,{},e.key)}function rn(e){return e.environmentId}function an(e){let[t,n]=e;return[t,n.changes]}function on(e){return[e.environmentId,{status:`saving`}]}function sn(e,t,n){return!e.isNew&&t.placeholder!==`Mixed`&&t.placeholder!==`Unavailable`&&n===t.value}function cn(e){return!Vt(e)}function ln(e){return e.isNew}function un(e){return e.model.trim()}function dn(e){return e.isNew}function fn(e){return e.summary?.buckets.map(pn)??[]}function pn(e){return e.model}function mn(e){return[...Object.keys(e.prices??{}),...Object.keys(e.aliases??{})]}var hn=960,gn=260,_n=4,vn=8,yn=new Set;function bn(e,t,n){let r=e?.byProvider.get(t);return r===void 0?0:n===`tokens`?r.totalTokens:r.costUsd}function xn(e,t,n){return e.map(e=>{let r=t.get(e),i=Je.map(e=>({provider:e,value:bn(r,e,n)}));return{bands:i,total:i.reduce((e,t)=>e+t.value,0)}})}function Sn(e){let t=e.length;if(t<2)return[0];let n=[];for(let r=0;r<t-1;r+=1){let t=(e[r+1]?.x??0)-(e[r]?.x??0),i=(e[r+1]?.y??0)-(e[r]?.y??0);n.push(t===0?0:i/t)}let r=Array.from({length:t},()=>0);r[0]=n[0]??0,r[t-1]=n[t-2]??0;for(let e=1;e<t-1;e+=1){let t=n[e-1]??0,i=n[e]??0;r[e]=t*i<=0?0:(t+i)/2}for(let e=0;e<t-1;e+=1){let t=n[e]??0;if(t===0){r[e]=0,r[e+1]=0;continue}let i=(r[e]??0)/t,a=(r[e+1]??0)/t,o=i*i+a*a;if(o>9){let n=3/Math.sqrt(o);r[e]=n*i*t,r[e+1]=n*a*t}}return r}function Cn(e){if(e.length<2)return[];let t=Sn(e),n=[];for(let r=0;r<e.length-1;r+=1){let i=e[r],a=e[r+1];if(i===void 0||a===void 0)continue;let o=a.x-i.x;n.push({from:i,c1:{x:i.x+o/3,y:i.y+(t[r]??0)*o/3},c2:{x:a.x-o/3,y:a.y-(t[r+1]??0)*o/3},to:a})}return n}function wn(e){let t=e[0];if(t===void 0)return``;let n=`M${t.from.x.toFixed(2)},${t.from.y.toFixed(2)}`;for(let t of e)n+=` C${t.c1.x.toFixed(2)},${t.c1.y.toFixed(2)} ${t.c2.x.toFixed(2)},${t.c2.y.toFixed(2)} ${t.to.x.toFixed(2)},${t.to.y.toFixed(2)}`;return n}function Tn(e){return e===``?``:`${e} L${hn},${gn} L0,${gn} Z`}function En(e,t){if(e<=0)return{max:0,ticks:[0]};let n=e/t,r=10**Math.floor(Math.log10(n)),i=n/r,a=(i>5?10:i>2?5:i>1?2:1)*r,o=Math.ceil(e/a)*a,s=[];for(let e=0;e<=o+a*1e-6;e+=a)s.push(e);return{max:o,ticks:s}}var Dn=Array.from({length:5},(e,t)=>t);function On(e,t){let n=e.reduce((e,t)=>t.bands.reduce((e,t)=>Math.max(e,t.value),e),0);return n===0&&t.size>0?{max:_n,ticks:Dn,labeled:!1}:{...En(n,_n),labeled:!0}}function kn(e,t){return t===0?gn:gn-e/t*252}function An(e,t,n,r,i){let a=xn(e,t,n),o=On(a,i),s=e.length<2?0:hn/(e.length-1);return{columns:a,scale:o,stepX:s,paths:r.map(e=>{let t=Je.indexOf(e),n=wn(Cn(a.map((e,n)=>({x:n*s,y:kn(e.bands[t]?.value??0,o.max)}))));return{provider:e,loading:i.has(e),total:a.reduce((e,n)=>e+(n.bands[t]?.value??0),0),line:n,area:Tn(n)}}).toSorted((e,t)=>t.total-e.total)}}function jn(e){let t=(0,Q.c)(97),{providers:n,loadingProviders:r,days:i,daily:a,hours:o,hourly:s,metric:c,referenceTime:l,resolution:u,timeZone:d}=e,f=r===void 0?yn:r,p=u===`hour`?o:i,m;t[0]!==a||t[1]!==s||t[2]!==u?(m=u===`hour`?new Map(s.map(Pn)):new Map(a.map(Nn)),t[0]=a,t[1]=s,t[2]=u,t[3]=m):m=t[3];let h=m,[g,_]=(0,Z.useState)(null),v=(0,Z.useRef)(null),y=(0,Z.useRef)(null),b=(0,Z.useRef)(null),x;t[4]!==h||t[5]!==f||t[6]!==c||t[7]!==p||t[8]!==n?(x=An(p,h,c,n,f),t[4]=h,t[5]=f,t[6]=c,t[7]=p,t[8]=n,t[9]=x):x=t[9];let{columns:S,scale:C,paths:w,stepX:T}=x,E;t[10]===C.max?E=t[11]:(E=e=>kn(e,C.max),t[10]=C.max,t[11]=E);let D=E,O=Mn,k=c===`tokens`?K:W,A;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>{let e=v.current,t=y.current,n=b.current;if(e===null||t===null||n===null)return;let r=t.offsetWidth,i=t.offsetHeight,a=e.clientWidth,o=e.clientHeight,s=n.x+12+r<=a?n.x+12:n.x-12-r,c=n.y+12+i<=o?n.y+12:n.y-12-i,l=Math.min(Math.max(0,s),Math.max(0,a-r)),u=Math.min(Math.max(0,c),Math.max(0,o-i));e.style.setProperty(`--usage-tooltip-left`,`${l}px`),e.style.setProperty(`--usage-tooltip-top`,`${u}px`)},t[12]=A):A=t[12];let j=A,N,P;t[13]===g?(N=t[14],P=t[15]):(N=()=>{if(g===null)return;j();let e=v.current,t=y.current;if(e!==null&&t!==null)return je([e,t],j)},P=[g,j],t[13]=g,t[14]=N,t[15]=P),(0,Z.useLayoutEffect)(N,P);let ee;t[16]===p.length?ee=t[17]:(ee=e=>{let t=v.current;if(t===null||p.length===0)return;let n=t.getBoundingClientRect();if(n.width===0)return;let r=Math.min(n.width,Math.max(0,e.clientX-n.left)),i=Math.min(n.height,Math.max(0,e.clientY-n.top)),a=r/n.width,o=Math.round(a*(p.length-1));b.current={x:r,y:i},j(),_(Math.min(p.length-1,Math.max(0,o)))},t[16]=p.length,t[17]=ee);let F=ee,I=g===null?void 0:p[g],L=g===null?void 0:S[g],R;if(t[18]!==f||t[19]!==n){let e;t[21]===f?e=t[22]:(e=e=>f.has(e),t[21]=f,t[22]=e),R=n.some(e),t[18]=f,t[19]=n,t[20]=R}else R=t[20];let z=R,B;t[23]!==u||t[24]!==d?(B=e=>u===`hour`?pe(e,d):le(e),t[23]=u,t[24]=d,t[25]=B):B=t[25];let V=B,te;t[26]!==V||t[27]!==l||t[28]!==u||t[29]!==d?(te=e=>u===`hour`&&l!==void 0?ue(e,l,d):V(e),t[26]=V,t[27]=l,t[28]=u,t[29]=d,t[30]=te):te=t[30];let ne=te,re;t[31]!==k||t[32]!==C.labeled||t[33]!==C.ticks||t[34]!==D?(re=C.labeled?C.ticks.map(e=>(0,$.jsx)(`span`,{className:`absolute right-0 -translate-y-1/2 text-3xs text-muted-foreground tabular-nums`,style:{top:`${D(e)/gn*100}%`},children:e===0?`0`:k(e)},e)):null,t[31]=k,t[32]=C.labeled,t[33]=C.ticks,t[34]=D,t[35]=re):re=t[35];let ie;t[36]===re?ie=t[37]:(ie=(0,$.jsx)(`div`,{className:`relative h-56 w-14 shrink-0`,children:re}),t[36]=re,t[37]=ie);let ae;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ae=()=>{b.current=null,_(null)},t[38]=ae):ae=t[38];let oe=`${u===`hour`?`Hourly`:`Daily`} ${c===`tokens`?`processed tokens`:`cost`} by provider`,se;if(t[39]!==C.ticks||t[40]!==D){let e;t[42]===D?e=t[43]:(e=e=>{let t=D(e);return(0,$.jsx)(`line`,{x1:0,x2:hn,y1:t,y2:t,stroke:`currentColor`,strokeWidth:1,className:`text-border`,vectorEffect:`non-scaling-stroke`},e)},t[42]=D,t[43]=e),se=C.ticks.map(e),t[39]=C.ticks,t[40]=D,t[41]=se}else se=t[41];let H;if(t[44]!==w){let e;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(e=e=>{let{provider:t,loading:n,area:r}=e;return(0,$.jsx)(`path`,{d:r,className:O(n),fill:Xe[t].color,fillOpacity:.12},t)},t[46]=e):e=t[46],H=w.map(e),t[44]=w,t[45]=H}else H=t[45];let U;if(t[47]!==w){let e;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(e=e=>{let{provider:t,loading:n,line:r}=e;return(0,$.jsx)(`path`,{d:r,className:O(n),fill:`none`,stroke:Xe[t].color,strokeWidth:2,vectorEffect:`non-scaling-stroke`},t)},t[49]=e):e=t[49],U=w.map(e),t[47]=w,t[48]=U}else U=t[48];let ce;t[50]!==g||t[51]!==T?(ce=g===null?null:(0,$.jsx)(`line`,{x1:g*T,x2:g*T,y1:vn,y2:gn,stroke:`currentColor`,strokeWidth:1,className:`text-muted-foreground`,vectorEffect:`non-scaling-stroke`}),t[50]=g,t[51]=T,t[52]=ce):ce=t[52];let G;t[53]!==oe||t[54]!==se||t[55]!==H||t[56]!==U||t[57]!==ce?(G=(0,$.jsxs)(`svg`,{className:`h-full w-full`,viewBox:`0 0 ${hn} ${gn}`,preserveAspectRatio:`none`,role:`img`,"aria-label":oe,children:[se,H,U,ce]}),t[53]=oe,t[54]=se,t[55]=H,t[56]=U,t[57]=ce,t[58]=G):G=t[58];let de;t[59]!==k||t[60]!==ne||t[61]!==L?.bands||t[62]!==L?.total||t[63]!==I||t[64]!==f||t[65]!==z||t[66]!==n?(de=I===void 0?null:(0,$.jsxs)(`div`,{ref:y,className:`surface-glass pointer-events-none absolute z-10 min-w-36 max-w-full rounded-xl border border-border/50 px-2.5 py-2 text-xs shadow-lg`,style:{left:`var(--usage-tooltip-left, 0px)`,top:`var(--usage-tooltip-top, 0px)`},children:[(0,$.jsx)(`div`,{className:`mb-1 text-muted-foreground`,children:ne(I)}),n.map(e=>{let{label:t,driverKind:n}=Xe[e];return(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,$.jsx)(Le,{driverKind:n,displayName:t,iconClassName:`size-3`}),t]}),(0,$.jsx)(`span`,{className:M(`tabular-nums`,f.has(e)?`text-muted-foreground`:`text-foreground`),children:k(L?.bands.find(t=>t.provider===e)?.value??0)})]},e)}),(0,$.jsxs)(`div`,{className:`mt-1 flex items-center justify-between gap-3 border-t border-border pt-1`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`Total`}),(0,$.jsx)(`span`,{className:M(`tabular-nums`,z?`text-muted-foreground`:`text-foreground`),children:k(L?.total??0)})]})]}),t[59]=k,t[60]=ne,t[61]=L?.bands,t[62]=L?.total,t[63]=I,t[64]=f,t[65]=z,t[66]=n,t[67]=de):de=t[67];let fe;t[68]!==F||t[69]!==G||t[70]!==de?(fe=(0,$.jsxs)(`div`,{ref:v,className:`relative h-56 flex-1`,onMouseMove:F,onMouseLeave:ae,children:[G,de]}),t[68]=F,t[69]=G,t[70]=de,t[71]=fe):fe=t[71];let q;t[72]!==ie||t[73]!==fe?(q=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[ie,fe]}),t[72]=ie,t[73]=fe,t[74]=q):q=t[74];let J;t[75]!==V||t[76]!==p[0]?(J=p[0]===void 0?``:V(p[0]),t[75]=V,t[76]=p[0],t[77]=J):J=t[77];let Y;t[78]===J?Y=t[79]:(Y=(0,$.jsx)(`span`,{children:J}),t[78]=J,t[79]=Y);let me;t[80]!==V||t[81]!==p?(me=p[Math.floor(p.length/2)]===void 0?``:V(p[Math.floor(p.length/2)]??``),t[80]=V,t[81]=p,t[82]=me):me=t[82];let he;t[83]===me?he=t[84]:(he=(0,$.jsx)(`span`,{children:me}),t[83]=me,t[84]=he);let ge;t[85]!==V||t[86]!==p?(ge=p[p.length-1]===void 0?``:V(p[p.length-1]??``),t[85]=V,t[86]=p,t[87]=ge):ge=t[87];let _e;t[88]===ge?_e=t[89]:(_e=(0,$.jsx)(`span`,{children:ge}),t[88]=ge,t[89]=_e);let ve;t[90]!==Y||t[91]!==he||t[92]!==_e?(ve=(0,$.jsxs)(`div`,{className:`flex justify-between pl-16 text-3xs text-muted-foreground uppercase`,children:[Y,he,_e]}),t[90]=Y,t[91]=he,t[92]=_e,t[93]=ve):ve=t[93];let X;return t[94]!==q||t[95]!==ve?(X=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[q,ve]}),t[94]=q,t[95]=ve,t[96]=X):X=t[96],X}function Mn(e){return M(`transition-opacity`,e&&`opacity-40 delay-150`)}function Nn(e){return[e.day,e]}function Pn(e){return[e.hourStart,e]}function Fn(e){let t=(0,Q.c)(30),{label:n,segments:r,format:i,aside:a}=e,o,s,c,l,u,d;if(t[0]!==a||t[1]!==i||t[2]!==n||t[3]!==r){d=Symbol.for(`react.early_return_sentinel`);bb0:{let e=r.filter(Ln),f=e.reduce(In,0);if(f<=0){d=null;break bb0}c=`flex min-w-0 flex-col gap-2.5`;let p;t[10]===n?p=t[11]:(p=(0,$.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:n}),t[10]=n,t[11]=p),t[12]!==a||t[13]!==p?(l=(0,$.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[p,a]}),t[12]=a,t[13]=p,t[14]=l):l=t[14];let m;t[15]===i?m=t[16]:(m=e=>`${e.label} ${i(e.value)}`,t[15]=i,t[16]=m);let h;t[17]!==i||t[18]!==f?(h=e=>(0,$.jsxs)(ve,{children:[(0,$.jsx)(ge,{render:(0,$.jsx)(`div`,{className:`h-full min-w-1 rounded-xs first:rounded-l-full last:rounded-r-full`,style:{flex:`${e.value} 1 0`,backgroundColor:e.color}})}),(0,$.jsxs)(_e,{children:[e.label,` · `,i(e.value),` · `,J(e.value/f)]})]},e.label),t[17]=i,t[18]=f,t[19]=h):h=t[19],u=(0,$.jsx)(`div`,{role:`img`,"aria-label":`${n}: ${e.map(m).join(`, `)}`,className:`flex h-2 gap-0.5`,children:e.map(h)}),o=`flex flex-wrap gap-x-4 gap-y-1 text-xs`;let g;t[20]===i?g=t[21]:(g=e=>(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-2 rounded-xs`,style:{backgroundColor:e.color}}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:e.label}),(0,$.jsx)(`span`,{className:`text-foreground tabular-nums`,children:i(e.value)})]},e.label),t[20]=i,t[21]=g),s=e.map(g)}t[0]=a,t[1]=i,t[2]=n,t[3]=r,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d}else o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9];if(d!==Symbol.for(`react.early_return_sentinel`))return d;let f;t[22]!==o||t[23]!==s?(f=(0,$.jsx)(`div`,{className:o,children:s}),t[22]=o,t[23]=s,t[24]=f):f=t[24];let p;return t[25]!==c||t[26]!==l||t[27]!==u||t[28]!==f?(p=(0,$.jsxs)(`div`,{className:c,children:[l,u,f]}),t[25]=c,t[26]=l,t[27]=u,t[28]=f,t[29]=p):p=t[29],p}function In(e,t){return e+t.value}function Ln(e){return e.value>0}function Rn(e){return e.toSorted((e,t)=>t.totalTokens-e.totalTokens||t.costUsd-e.costUsd)}function zn(e,t){return t===`tokens`?e.tokenShare:pt(e)?null:e.costShare}function Bn({tokens:e}){let t=e.uncachedInputTokens+e.cachedInputTokens+e.cacheCreationTokens;return t===0?null:e.cachedInputTokens/t}function Vn(e){let t=e.totalTokens-e.unpricedTokens;return t<=0||pt(e)?null:e.costUsd/t*1e6}var Hn=e=>`color-mix(in oklab, var(--foreground) ${e}%, var(--background))`,Un={input:Hn(60),cacheRead:Hn(30),cacheWrite:Hn(72),output:Hn(100),other:Hn(44)};function Wn(e){return[{label:`Input`,value:e.input,color:Un.input},{label:`Cache read`,value:e.cacheRead,color:Un.cacheRead},{label:`Cache write`,value:e.cacheWrite,color:Un.cacheWrite},{label:`Output`,value:e.output,color:Un.output},{label:`Other`,value:e.unsplit>=.005?e.unsplit:0,color:Un.other}]}function Gn(e){return[{label:`Input`,value:e.uncachedInputTokens,color:Un.input},{label:`Cache read`,value:e.cachedInputTokens,color:Un.cacheRead},{label:`Cache write`,value:e.cacheCreationTokens,color:Un.cacheWrite},{label:`Output`,value:e.outputTokens,color:Un.output}]}function Kn(e){return[{label:`Standard`,value:e.standard,color:Hn(34)},{label:`Fast`,value:e.fast,color:Hn(66)},{label:`Ultrafast`,value:e.ultrafast,color:Hn(100)}]}function qn(e){let t=(0,Q.c)(80),{model:n,environments:r,metric:i,chartWindow:a,onSetPrice:o,onClose:s}=e,c;t[0]!==n.model||t[1]!==n.provider?(c=e=>e.provider===n.provider&&e.model===n.model,t[0]=n.model,t[1]=n.provider,t[2]=c):c=t[2];let l;t[3]!==r||t[4]!==c?(l=wt(r,c),t[3]=r,t[4]=c,t[5]=l):l=t[5];let u=l,d;t[6]===n.provider?d=t[7]:(d=[n.provider],t[6]=n.provider,t[7]=d);let f=d,p=Xe[n.provider],m;t[8]===n?m=t[9]:(m=pt(n),t[8]=n,t[9]=m);let h=m,g;if(t[10]!==h||t[11]!==n){let e=Bn(n),r=Vn(n),i;t[13]!==h||t[14]!==n.costUsd?(i=h?`Unpriced`:W(n.costUsd),t[13]=h,t[14]=n.costUsd,t[15]=i):i=t[15];let a;t[16]===i?a=t[17]:(a={label:`Cost`,value:i},t[16]=i,t[17]=a);let o;t[18]===n.totalTokens?o=t[19]:(o=K(n.totalTokens),t[18]=n.totalTokens,t[19]=o);let s;t[20]===o?s=t[21]:(s={label:`Tokens`,value:o},t[20]=o,t[21]=s),g=[a,s,r===null?null:{label:`Per 1M tokens`,value:W(r)},e===null?null:{label:`Cache hit`,value:J(e)}].filter(Yn),t[10]=h,t[11]=n,t[12]=g}else g=t[12];let _=g,v;t[22]===s?v=t[23]:(v=e=>{e||s()},t[22]=s,t[23]=v);let y;t[24]!==p.driverKind||t[25]!==p.label?(y=(0,$.jsx)(Le,{driverKind:p.driverKind,displayName:p.label,iconClassName:`size-5`}),t[24]=p.driverKind,t[25]=p.label,t[26]=y):y=t[26];let b;t[27]===n.model?b=t[28]:(b=(0,$.jsx)(we,{children:n.model}),t[27]=n.model,t[28]=b);let x;t[29]!==y||t[30]!==b?(x=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y,b]}),t[29]=y,t[30]=b,t[31]=x):x=t[31];let S;t[32]!==h||t[33]!==n.costShare?(S=h?``:` · ${J(n.costShare)} of cost`,t[32]=h,t[33]=n.costShare,t[34]=S):S=t[34];let C;t[35]!==p.label||t[36]!==S?(C=(0,$.jsxs)(De,{children:[p.label,S]}),t[35]=p.label,t[36]=S,t[37]=C):C=t[37];let w;t[38]!==C||t[39]!==x?(w=(0,$.jsxs)(Ce,{children:[x,C]}),t[38]=C,t[39]=x,t[40]=w):w=t[40];let E;t[41]===_?E=t[42]:(E=(0,$.jsx)(`div`,{className:`grid grid-cols-2 gap-x-6 gap-y-4 sm:grid-cols-4`,children:_.map(Jn)}),t[41]=_,t[42]=E);let D=h?`tokens`:i,O;t[43]!==a.days||t[44]!==a.hours||t[45]!==a.referenceTime||t[46]!==a.resolution||t[47]!==a.timeZone||t[48]!==f||t[49]!==D||t[50]!==u.daily||t[51]!==u.hourly?(O=(0,$.jsx)(jn,{providers:f,days:a.days,daily:u.daily,hours:a.hours,hourly:u.hourly,metric:D,referenceTime:a.referenceTime,resolution:a.resolution,timeZone:a.timeZone}),t[43]=a.days,t[44]=a.hours,t[45]=a.referenceTime,t[46]=a.resolution,t[47]=a.timeZone,t[48]=f,t[49]=D,t[50]=u.daily,t[51]=u.hourly,t[52]=O):O=t[52];let k;t[53]!==h||t[54]!==u.categoryCost?(k=h?null:(0,$.jsx)(Fn,{label:`Cost by type`,segments:Wn(u.categoryCost),format:W}),t[53]=h,t[54]=u.categoryCost,t[55]=k):k=t[55];let A;t[56]===n.tokens?A=t[57]:(A=Gn(n.tokens),t[56]=n.tokens,t[57]=A);let j;t[58]===A?j=t[59]:(j=(0,$.jsx)(Fn,{label:`Tokens by type`,segments:A,format:K}),t[58]=A,t[59]=j);let M;t[60]===u.speedCost?M=t[61]:(M=u.speedCost.fast+u.speedCost.ultrafast>0?(0,$.jsx)(Fn,{label:`Cost by speed`,segments:Kn(u.speedCost),format:W,aside:(0,$.jsx)(Xn,{premiumUsd:u.speedCost.premium})}):null,t[60]=u.speedCost,t[61]=M);let N;t[62]!==k||t[63]!==j||t[64]!==M?(N=(0,$.jsxs)(`div`,{className:`grid gap-x-10 gap-y-8 sm:grid-cols-2`,children:[k,j,M]}),t[62]=k,t[63]=j,t[64]=M,t[65]=N):N=t[65];let P;t[66]!==E||t[67]!==O||t[68]!==N?(P=(0,$.jsx)(Ee,{children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[E,O,N]})}),t[66]=E,t[67]=O,t[68]=N,t[69]=P):P=t[69];let ee;t[70]!==n.unpricedTokens||t[71]!==o?(ee=n.unpricedTokens>0?(0,$.jsxs)(Te,{variant:`bare`,className:`items-center sm:justify-between`,children:[(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[K(n.unpricedTokens),` tokens have no known price`]}),(0,$.jsx)(T,{onClick:o,children:`Set price`})]}):null,t[70]=n.unpricedTokens,t[71]=o,t[72]=ee):ee=t[72];let F;t[73]!==w||t[74]!==P||t[75]!==ee?(F=(0,$.jsxs)(Oe,{className:`max-w-3xl`,children:[w,P,ee]}),t[73]=w,t[74]=P,t[75]=ee,t[76]=F):F=t[76];let I;return t[77]!==F||t[78]!==v?(I=(0,$.jsx)(ke,{open:!0,onOpenChange:v,children:F}),t[77]=F,t[78]=v,t[79]=I):I=t[79],I}function Jn(e){return(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.label}),(0,$.jsx)(`span`,{className:`text-2xl font-semibold text-foreground`,children:e.value})]},e.label)}function Yn(e){return e!==null}function Xn(e){let t=(0,Q.c)(4),{premiumUsd:n}=e,r;t[0]===n?r=t[1]:(r=W(n),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Premium `,(0,$.jsx)(`span`,{className:`text-foreground tabular-nums`,children:r})]}),t[2]=r,t[3]=i),i}var Zn=`p4code:usage-page-preferences:v1`,Qn=g({metric:d([`cost`,`tokens`,`limits`]),windowDays:d([1,7,30,90]),hiddenProviders:S(h(x))}),$n={metric:`limits`,windowDays:30};function er(){try{return i(Zn,Qn)??$n}catch(e){return console.error(`Could not read Usage page preferences.`,e),$n}}function tr(e){try{C(Zn,e,Qn)}catch(e){console.error(`Could not save Usage page preferences.`,e)}}function nr(e){return He.some(t=>t.value===e)}function rr(e){return Be.some(t=>t.days===e)}var ir=e=>Xe[e].label;function ar(){let[e,t]=(0,Z.useState)(er);ie();let n=r(se),i=e=>{let t=Me(n,e.command,{context:{usagePageOpen:!0}});return t?`${e.label} (${t})`:e.label},[a,o]=(0,Z.useState)(()=>({days:e.windowDays,window:G(e.windowDays,void 0,e.windowDays===1?`hour`:`day`)})),s=e.metric,c=s===`limits`,[l,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(()=>Date.now()),m=(0,Z.useRef)(!1),[h,g]=(0,Z.useState)(`model`),[_,v]=(0,Z.useState)(null),[y,b]=(0,Z.useState)(null),[x,S]=(0,Z.useState)(null),C=(0,Z.useMemo)(()=>new Set(e.hiddenProviders),[e.hiddenProviders]),{days:w,window:E}=a,D=w===1,{merged:O,environments:k,selectedEnvironments:A,shown:j,isPartial:N,refresh:ee}=Dt(E,x,C),F=j?.merged??O,I=j?.window??E,L=I.resolution===`hour`,R=l&&!c,z=j!==null&&j.window!==E,H=(0,Z.useMemo)(()=>{if(z)return{partial:!0,everyProvider:!0,providers:new Set};let e=ft(A,R),t=new Set([...e.providers].filter(e=>!C.has(e)));return{partial:e.everyProvider||t.size>0,everyProvider:e.everyProvider,providers:t}},[z,R,A,C]),U=e=>H.everyProvider||H.providers.has(e),ue=r(ae.presentationsAtom),me=C.has(`cursor`)?[]:at(A),ge=[...new Set(A.flatMap(e=>e.summary?.sources.flatMap(e=>e.message&&!e.action&&!C.has(e.fingerprint.provider)&&(e.status===`partial`||e.status===`failed`||e.fingerprint.provider===`cursor`)?[e.message]:[])??[]))],_e=ce(oe.refreshProviders,{reportFailure:!1}),ve=A.some(e=>e.canReadDiagnostics),X=(0,Z.useMemo)(()=>Y(I.sinceDay,I.untilDay),[I.sinceDay,I.untilDay]),xe=(0,Z.useMemo)(()=>I.sinceTime===void 0||I.untilTime===void 0?[]:fe(I.sinceTime,I.untilTime),[I.sinceTime,I.untilTime]),Ce=(0,Z.useMemo)(()=>(L?F.hourly:F.daily).toReversed(),[L,F.daily,F.hourly]),we=(0,Z.useMemo)(()=>h===`model`&&s===`tokens`?Rn(F.models):F.models,[h,F.models,s]),Te=(0,Z.useMemo)(()=>qe(F.providers),[F.providers]),Ee=(0,Z.useMemo)(()=>Je.filter(e=>Te.includes(e)||H.providers.has(e)),[H.providers,Te]),De=(0,Z.useMemo)(()=>new Set(Ee.filter(e=>H.everyProvider||H.providers.has(e))),[Ee,H.everyProvider,H.providers]),Oe=y===null?void 0:F.models.find(e=>`${e.provider}:${e.model}`===y),ke=we.reduce((e,t)=>Math.max(e,s===`tokens`?t.totalTokens:t.costUsd),0),je=Ee.map(e=>({kind:`usage`,provider:e})),Le=Math.max(Ee.indexOf(`codex`),Ee.indexOf(`claude`))+1;je.splice(Le,0,...me.map(e=>({kind:`enable`,environment:e})));let Ye=`${60/(Ee.length+2)}%`,Qe=n=>{let r={...e,...n};t(r),tr(r)},nt=e=>{rr(e)&&(Qe({windowDays:e}),o({days:e,window:G(e,void 0,e===1?`hour`:`day`)}))},Q=e=>{e===`limits`&&p(Date.now()),Qe({metric:e})},rt=async(e=!1,t=!1)=>{try{await Promise.all(Array.from(ue,([n,r])=>{if((x===null||x.has(n))&&r.connection.phase===`connected`&&r.serverConfig!==null)return ct(n,()=>_e({environmentId:n,input:{}}),e,t)}))}finally{p(Date.now())}},it=(0,Z.useEffectEvent)(e=>{if(e.defaultPrevented||e.repeat||e.isComposing||We()||Ke())return;let t=Ve(e,n),r=He.find(e=>e.command===t),i=Be.find(e=>e.command===t);(r||i)&&(e.preventDefault(),e.stopPropagation(),r&&Q(r.value),i&&!c&&nt(i.days))});(0,Z.useEffect)(()=>(globalThis.window.addEventListener(`keydown`,it,!0),()=>globalThis.window.removeEventListener(`keydown`,it,!0)),[]);let ot=()=>{if(m.current)return;if(c){m.current=!0,d(!0),rt().finally(()=>{m.current=!1,d(!1)});return}let e=G(w,void 0,D?`hour`:`day`);(e.sinceDay!==E.sinceDay||e.untilDay!==E.untilDay||e.sinceTime!==E.sinceTime||e.untilTime!==E.untilTime)&&o({days:w,window:e}),m.current=!0,d(!0),ee(e).finally(()=>{m.current=!1,d(!1)})},st=[...ue].filter(([e,t])=>t.connection.phase===`connected`&&t.serverConfig!==null&&(x===null||x.has(e))).map(([e])=>e).sort().join(`,`),lt=(0,Z.useEffectEvent)(()=>{rt(!0)});(0,Z.useEffect)(()=>{c&&st&<()},[c,st]);let ut=L&&I.sinceTime!==void 0&&I.untilTime!==void 0?`${de(I.sinceTime,I.timeZone)} to ${de(I.untilTime,I.timeZone)}`:`${le(I.sinceDay)} to ${le(I.untilDay)}`,dt=(0,$.jsxs)(`div`,{className:`grid w-full min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 py-2 xl:flex`,children:[(0,$.jsxs)(tt,{ariaLabel:`Usage breadcrumb`,className:`min-w-0`,children:[(0,$.jsx)($e,{children:(0,$.jsx)(`h1`,{children:`Usage`})}),(0,$.jsx)(et,{}),(0,$.jsx)($e,{className:`min-w-10 shrink`,children:(0,$.jsx)(vr,{environments:k,selectedEnvironments:A,selectedEnvironmentIds:x,onSelectionChange:S,showUsageStatus:!c,refreshing:R,isPartial:N,duplicateSources:F.duplicateSources,contractMismatches:F.contractMismatches,onOpenModelPrices:()=>v({})})}),(0,$.jsx)(et,{}),(0,$.jsx)($e,{current:!0,className:`min-w-10`,children:(0,$.jsx)(xr,{hiddenProviders:C,onChange:e=>Qe({hiddenProviders:e})})})]}),c?null:(0,$.jsx)(`span`,{className:`hidden min-w-0 truncate text-xs text-muted-foreground 2xl:block`,children:ut}),(0,$.jsxs)(`div`,{className:`ms-auto hidden min-w-0 items-center justify-end gap-2 xl:flex`,children:[(0,$.jsx)(ye,{"aria-label":`Usage metric`,variant:`segmented`,value:[s],onValueChange:e=>{let t=e[0];nr(t)&&Q(t)},children:He.map(e=>(0,$.jsx)(be,{value:e.value,title:i(e),children:e.label},e.value))}),(0,$.jsx)(ye,{"aria-label":`Usage period`,variant:`segmented`,value:[String(w)],disabled:c,onValueChange:e=>{let t=e[0];t&&nt(Number(t))},children:Be.map(e=>(0,$.jsx)(be,{value:String(e.days),title:i(e),children:e.label},e.days))}),(0,$.jsx)(T,{onClick:ot,"aria-label":c?`Refresh limits`:`Refresh usage`,"aria-busy":l,disabled:l||!c&&!ve,size:`icon-sm`,variant:`ghost`,children:(0,$.jsx)(Ue,{size:`sm`,refreshing:l})})]}),(0,$.jsxs)(`div`,{className:`ms-auto flex min-w-0 items-center justify-end gap-1 xl:hidden`,children:[(0,$.jsxs)(re,{value:s,onValueChange:e=>{nr(e)&&Q(e)},children:[(0,$.jsx)(ne,{"aria-label":`Usage metric`,size:`compact`,variant:`ghost`,className:`w-auto min-w-0`,children:(0,$.jsx)(V,{children:He.find(e=>e.value===s)?.label})}),(0,$.jsx)(te,{align:`end`,alignItemWithTrigger:!1,children:He.map(e=>(0,$.jsx)(B,{value:e.value,title:i(e),children:e.label},e.value))})]}),(0,$.jsxs)(re,{value:String(w),disabled:c,onValueChange:e=>nt(Number(e)),children:[(0,$.jsx)(ne,{"aria-label":`Usage period`,size:`compact`,variant:`ghost`,className:`w-auto min-w-0`,children:(0,$.jsx)(V,{children:Be.find(e=>e.days===w)?.label})}),(0,$.jsx)(te,{align:`end`,alignItemWithTrigger:!1,children:Be.map(e=>(0,$.jsx)(B,{value:String(e.days),title:i(e),children:e.label},e.days))})]}),(0,$.jsx)(T,{onClick:ot,"aria-label":c?`Refresh limits`:`Refresh usage`,"aria-busy":l,disabled:l||!c&&!ve,size:`icon-sm`,variant:`ghost`,children:(0,$.jsx)(Ue,{size:`sm`,refreshing:l})})]})]});return(0,$.jsxs)(Ae,{className:`h-dvh min-h-0 overflow-hidden overscroll-y-none isolate`,children:[(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-background text-foreground`,children:[(0,$.jsx)(Ze,{electron:he,children:dt}),(0,$.jsx)(Se,{className:`min-h-0 flex-1`,children:(0,$.jsx)(ze,{width:`wide`,children:A.length===0?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:k.length===0?`Connect an environment to see ${c?`limits`:`usage`}.`:`Select an environment to see ${c?`limits`:`usage`}.`}):c?(0,$.jsx)(Ge,{selectedEnvironmentIds:x,hiddenProviders:C,now:f,cursorPrompt:me.length>0?(0,$.jsx)(lr,{environments:me,onEnabled:()=>{ee(),rt(!1,!0)}}):null}):j===null?(0,$.jsx)(Sr,{}):ve?(0,$.jsxs)(`div`,{"aria-busy":H.partial,className:`flex flex-col gap-6`,children:[ge.map(e=>(0,$.jsx)(`p`,{className:`mb-4 text-sm text-muted-foreground`,children:e},e)),(0,$.jsxs)(`section`,{className:`grid gap-6 lg:grid-cols-[minmax(0,18rem)_minmax(0,1fr)]`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:M(`text-4xl font-semibold text-foreground tabular-nums`,dr(H.partial)),children:s===`cost`?W(F.costUsd):K(F.totalTokens)}),(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,$.jsxs)(`span`,{children:[(0,$.jsxs)(`span`,{className:dr(H.partial),children:[q(F.sessions),` sessions`]}),s===`cost`&&` · API estimate`]}),s===`cost`&&F.costQuality.unpricedShare>0&&(0,$.jsxs)(Fe,{children:[(0,$.jsx)(Pe,{openOnHover:!0,render:(0,$.jsx)(P,{tone:`muted`}),"aria-label":`Unpriced usage details`,children:(0,$.jsx)(u,{className:`size-3`,"aria-hidden":!0})}),(0,$.jsxs)(Ne,{side:`top`,tooltipStyle:!0,children:[`API estimate excludes`,` `,J(F.costQuality.unpricedShare),` unpriced records.`]})]})]})]}),!C.has(`codex`)&&[...ue].some(([e,t])=>(x===null||x.has(e))&&t.serverConfig?.providers.some(Ie))?(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:`ChatGPT shared usage`}),(0,$.jsx)(Re,{size:`xs`})]}):null,je.map(e=>{if(e.kind===`enable`)return(0,$.jsx)(cr,{environmentId:e.environment.environmentId,label:e.environment.label,showEnvironment:A.length>1,onEnabled:()=>{ee(),rt(!1,!0)}},`enable:${e.environment.environmentId}`);let t=e.provider,n=F.providers.find(e=>e.provider===t),r=s===`cost`?n?.costShare??0:n?.tokenShare??0,i=n?.sessions??0,a=`${q(i)} ${i===1?`session`:`sessions`}`,o=U(t),c=o&&!Te.includes(t);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-sm text-foreground`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-2 shrink-0 rounded-full`,style:{backgroundColor:Xe[t].color}}),(0,$.jsx)(ur,{provider:t,className:`size-4`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-1.5`,children:[(0,$.jsx)(`span`,{className:`truncate`,children:Xe[t].label}),(0,$.jsx)(`span`,{className:M(`shrink-0 whitespace-nowrap text-2xs text-muted-foreground tabular-nums`,dr(o),c&&`invisible`),children:a})]})]}),(0,$.jsx)(`span`,{className:M(`shrink-0 text-sm font-medium text-foreground tabular-nums`,dr(o)),children:c?`—`:s===`cost`?W(n?.costUsd??0):K(n?.totalTokens??0)})]}),(0,$.jsx)(`span`,{className:M(`text-xs text-muted-foreground`,dr(o),c&&`invisible`),children:s===`cost`?`${J(r)} of cost · ${K(n?.totalTokens??0)} tokens`:`${J(r)} of tokens · ${W(n?.costUsd??0)}`})]},t)})]}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,$.jsxs)(`h2`,{className:`text-sm font-medium text-foreground`,children:[L?`Hourly`:`Daily`,` `,s===`tokens`?`processed tokens`:`cost`]}),(0,$.jsx)(jn,{providers:Ee,loadingProviders:De,days:X,daily:F.daily,hours:xe,hourly:F.hourly,metric:s,referenceTime:I.untilTime,resolution:L?`hour`:`day`,timeZone:I.timeZone})]})]}),(0,$.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:`Totals`}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-6 gap-y-4 py-1 md:grid-cols-5`,children:[(0,$.jsx)(fr,{loading:H.partial,label:`Processed tokens`,value:K(F.totalTokens)}),(0,$.jsx)(fr,{loading:H.partial,label:`Cached input`,value:K(F.cachedInputTokens)}),(0,$.jsx)(fr,{loading:H.partial,label:`Uncached input`,value:K(F.uncachedInputTokens)}),(0,$.jsx)(fr,{loading:H.partial,label:`Output`,value:K(F.outputTokens)}),(0,$.jsx)(fr,{loading:H.partial,label:`Cache savings`,value:W(F.costQuality.cacheSavingsUsd)})]})]}),F.totalTokens>0?(0,$.jsx)(`section`,{className:M(`grid gap-x-12 gap-y-8 lg:grid-cols-2`,dr(H.partial)),children:s===`tokens`?(0,$.jsx)(Fn,{label:`Tokens by type`,segments:Gn(F),format:K}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Fn,{label:`Cost by type`,segments:Wn(F.categoryCost),format:W}),F.speedCost.fast+F.speedCost.ultrafast>0?(0,$.jsx)(Fn,{label:`Cost by speed`,segments:Kn(F.speedCost),format:W,aside:(0,$.jsx)(Xn,{premiumUsd:F.speedCost.premium})}):null]})}):null,(0,$.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:`Breakdown`}),(0,$.jsx)(ye,{"aria-label":`Usage breakdown`,variant:`segmented`,value:[h],onValueChange:e=>{let t=e[0];(t===`model`||t===`time`)&&g(t)},children:[{value:`model`,label:`Model`},{value:`time`,label:L?`Hour`:`Day`}].map(e=>(0,$.jsx)(be,{value:e.value,children:e.label},e.value))})]}),h===`model`?(0,$.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{className:`border-b border-border text-right text-xs text-muted-foreground`,children:[(0,$.jsx)(`th`,{className:`py-2 pr-3 text-left font-normal`,children:`#`}),(0,$.jsx)(`th`,{className:`w-full py-2 text-left font-normal`,children:`Model`}),(0,$.jsx)(`th`,{className:`py-2 pl-6 font-normal`,children:`Cost`}),(0,$.jsx)(`th`,{className:`hidden py-2 pl-6 font-normal sm:table-cell`,children:`Share`}),(0,$.jsx)(`th`,{className:`py-2 pl-6 font-normal`,children:`Tokens`})]})}),(0,$.jsx)(`tbody`,{children:we.length===0?(0,$.jsx)(`tr`,{children:(0,$.jsx)(`td`,{colSpan:5,className:`py-6 text-center text-muted-foreground`,children:`No activity in this window.`})}):we.map((e,t)=>{let n=`${e.provider}:${e.model}`,r=s===`tokens`?e.totalTokens:e.costUsd,i=zn(e,s===`tokens`?`tokens`:`cost`),a=dr(U(e.provider));return(0,$.jsxs)(`tr`,{className:`relative border-b border-border/50 text-right whitespace-nowrap text-muted-foreground tabular-nums transition-colors hover:bg-muted/50 has-focus-visible:bg-muted/50`,children:[(0,$.jsx)(`td`,{className:`py-2.5 pr-3 text-left text-xs`,children:t+1}),(0,$.jsxs)(`td`,{className:`py-2.5 text-left whitespace-normal`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>b(n),className:`flex items-center gap-2 text-left text-foreground outline-none after:absolute after:inset-0`,children:[(0,$.jsx)(ur,{provider:e.provider,className:`size-3.5`}),e.model]}),(0,$.jsx)(`div`,{"aria-hidden":!0,className:M(`mt-1.5 h-0.5 max-w-48`,a),children:(0,$.jsx)(`div`,{className:`h-full rounded-full`,style:{width:r>0&&ke>0?`max(0.5rem, ${r/ke*100}%)`:0,backgroundColor:Xe[e.provider].color}})})]}),(0,$.jsx)(`td`,{className:M(`py-2.5 pl-6 text-foreground`,a),children:pt(e)?(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`Unpriced`}):W(e.costUsd)}),(0,$.jsx)(`td`,{className:M(`hidden py-2.5 pl-6 sm:table-cell`,a),children:i===null?``:J(i)}),(0,$.jsx)(`td`,{className:M(`py-2.5 pl-6`,a),children:K(e.totalTokens)})]},n)})})]}):(0,$.jsxs)(`table`,{className:`w-full table-fixed text-sm`,children:[(0,$.jsxs)(`colgroup`,{children:[(0,$.jsx)(`col`,{className:`w-2/5`}),Ee.map(e=>(0,$.jsx)(`col`,{style:{width:Ye}},e)),(0,$.jsx)(`col`,{style:{width:Ye}}),(0,$.jsx)(`col`,{style:{width:Ye}})]}),(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{className:`border-b border-border text-left text-xs text-muted-foreground`,children:[(0,$.jsx)(`th`,{className:`py-2 font-normal`,children:L?`Hour`:`Day`}),Ee.map(e=>(0,$.jsx)(`th`,{className:`py-2 text-right font-normal`,children:Xe[e].label},e)),(0,$.jsx)(`th`,{className:`py-2 text-right font-normal`,children:`Total`}),(0,$.jsx)(`th`,{className:`py-2 text-right font-normal`,children:`Tokens`})]})}),(0,$.jsx)(`tbody`,{children:Ce.length===0?(0,$.jsx)(`tr`,{children:(0,$.jsx)(`td`,{colSpan:Ee.length+3,className:`py-6 text-center text-muted-foreground`,children:`No activity in this window.`})}):Ce.map(e=>(0,$.jsxs)(`tr`,{className:`border-b border-border/50 transition-colors hover:bg-muted/50`,children:[(0,$.jsx)(`td`,{className:`py-2 text-foreground`,children:`hourStart`in e?pe(e.hourStart,I.timeZone):le(e.day)}),Ee.map(t=>(0,$.jsx)(`td`,{className:M(`py-2 text-right text-muted-foreground tabular-nums`,dr(U(t))),children:W(e.byProvider.get(t)?.costUsd??0)},t)),(0,$.jsx)(`td`,{className:M(`py-2 text-right text-foreground tabular-nums`,dr(H.partial)),children:W(e.costUsd)}),(0,$.jsx)(`td`,{className:M(`py-2 text-right text-muted-foreground tabular-nums`,dr(H.partial)),children:K(e.totalTokens)})]},`hourStart`in e?e.hourStart:e.day))})]})]})]}):(0,$.jsx)(`div`,{className:`space-y-2 py-12 text-center text-sm text-muted-foreground`,children:A.map(e=>(0,$.jsxs)(`p`,{children:[A.length>1?`${e.label}: `:null,e.error]},e.environmentId))})})})]}),Oe!==void 0&&!c?(0,$.jsx)(qn,{model:Oe,environments:A,metric:s===`tokens`?`tokens`:`cost`,chartWindow:{days:X,hours:xe,resolution:L?`hour`:`day`,timeZone:I.timeZone,referenceTime:I.untilTime},onSetPrice:()=>{b(null),v({model:Oe.model})},onClose:()=>b(null)}):null,_?(0,$.jsx)(Xt,{usage:k,initialSelectedEnvironmentIds:x,initialModel:_.model,onOpenChange:e=>{e||v(null)}}):null]})}var or=`Requires access to your Cursor login in macOS Keychain.`;function sr({environmentId:e,label:t,onEnabled:n,tooltip:r,buttonText:i=`Enable`}){let a=ce(oe.updateSettings,{label:`enable Cursor account usage`}),[o,s]=(0,Z.useState)(!1),c=async()=>{s(!0);try{(await a({environmentId:e,input:{patch:{cursorKeychainUsageEnabled:!0}}}))._tag===`Success`&&n()}finally{s(!1)}},l=r?(0,$.jsx)(P,{disabled:o,"aria-busy":o,"aria-label":`Enable Cursor usage from ${t}`,onClick:()=>void c(),children:i}):(0,$.jsx)(T,{size:`sm`,variant:`outline`,disabled:o,"aria-busy":o,"aria-label":`Enable Cursor usage from ${t}`,onClick:()=>void c(),children:i});return r?(0,$.jsxs)(ve,{children:[(0,$.jsx)(ge,{render:l}),(0,$.jsx)(_e,{children:or})]}):l}function cr(e){let t=(0,Q.c)(11),{environmentId:n,label:r,showEnvironment:i,onEnabled:a}=e,o,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-2 shrink-0 rounded-full`,style:{backgroundColor:Xe.cursor.color}}),s=(0,$.jsx)(ur,{provider:`cursor`,className:`size-4`}),t[0]=o,t[1]=s):(o=t[0],s=t[1]);let c=i?` · ${r}`:``,l;t[2]===c?l=t[3]:(l=(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-sm text-foreground`,children:[o,s,(0,$.jsxs)(`span`,{className:`truncate`,children:[`Cursor`,c]})]}),t[2]=c,t[3]=l);let u;t[4]!==n||t[5]!==r||t[6]!==a?(u=(0,$.jsx)(sr,{environmentId:n,label:r,onEnabled:a,tooltip:!0}),t[4]=n,t[5]=r,t[6]=a,t[7]=u):u=t[7];let d;return t[8]!==l||t[9]!==u?(d=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-baseline justify-between gap-4 text-sm`,children:[l,u]}),t[8]=l,t[9]=u,t[10]=d):d=t[10],d}function lr(e){let t=(0,Q.c)(10),{environments:n,onEnabled:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-medium text-foreground`,children:[(0,$.jsx)(Le,{driverKind:A.make(`cursor`),displayName:`Cursor`,indicatorBackground:`var(--background)`,className:`size-5`,iconClassName:`size-4 text-foreground/80`}),`Cursor`]}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:or}),t[1]=a):a=t[1];let o;if(t[2]!==n||t[3]!==r){let e;t[5]!==n.length||t[6]!==r?(e=e=>(0,$.jsx)(sr,{environmentId:e.environmentId,label:e.label,buttonText:n.length>1?`Enable on ${e.label}`:`Enable`,onEnabled:r,tooltip:!1},e.environmentId),t[5]=n.length,t[6]=r,t[7]=e):e=t[7],o=n.map(e),t[2]=n,t[3]=r,t[4]=o}else o=t[4];let s;return t[8]===o?s=t[9]:(s=(0,$.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[i,(0,$.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-lg border border-border/60 p-4`,children:[a,(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:o})]})]}),t[8]=o,t[9]=s),s}function ur(e){let t=(0,Q.c)(4),{provider:n,className:r}=e,i=Xe[n],a;return t[0]!==r||t[1]!==i.driverKind||t[2]!==i.label?(a=(0,$.jsx)(Le,{driverKind:i.driverKind,displayName:i.label,iconClassName:r}),t[0]=r,t[1]=i.driverKind,t[2]=i.label,t[3]=a):a=t[3],a}function dr(e){return M(`transition-opacity`,e&&`opacity-40 delay-150`)}function fr(e){let t=(0,Q.c)(10),{label:n,value:r,loading:i}=e,a;t[0]===n?a=t[1]:(a=(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n}),t[0]=n,t[1]=a);let o;t[2]===i?o=t[3]:(o=M(`text-base font-medium text-foreground tabular-nums`,dr(i)),t[2]=i,t[3]=o);let s;t[4]!==o||t[5]!==r?(s=(0,$.jsx)(`span`,{className:o,children:r}),t[4]=o,t[5]=r,t[6]=s):s=t[6];let c;return t[7]!==a||t[8]!==s?(c=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[a,s]}),t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function pr(e){let t=(0,Q.c)(14),{environments:n,duplicateSources:r,contractMismatches:i}=e,a,o,s,c;if(t[0]!==i||t[1]!==r||t[2]!==n){c=Symbol.for(`react.early_return_sentinel`);bb0:{let e=n.filter(_r),t=new Map(i.map(gr)),l=n.flatMap(e=>{let n=t.get(e.environmentId);return n===void 0?[]:[{environment:e,mismatch:n}]});if(e.length===0&&l.length===0&&r.length===0){c=null;break bb0}a=`flex flex-col gap-1 border-t border-border px-2 py-2 text-xs text-muted-foreground`,o=e.map(hr),s=l.map(mr)}t[0]=i,t[1]=r,t[2]=n,t[3]=a,t[4]=o,t[5]=s,t[6]=c}else a=t[3],o=t[4],s=t[5],c=t[6];if(c!==Symbol.for(`react.early_return_sentinel`))return c;let l;t[7]===r?l=t[8]:(l=r.length>0?(0,$.jsxs)(`span`,{children:[`Counted once across environments sharing a transcript directory:`,` `,r.join(`, `)]}):null,t[7]=r,t[8]=l);let u;return t[9]!==a||t[10]!==o||t[11]!==s||t[12]!==l?(u=(0,$.jsxs)(`div`,{className:a,children:[o,s,l]}),t[9]=a,t[10]=o,t[11]=s,t[12]=l,t[13]=u):u=t[13],u}function mr(e){let{environment:t,mismatch:n}=e;return(0,$.jsx)(`span`,{children:me(t.label,n)},t.environmentId)}function hr(e){return(0,$.jsxs)(`span`,{children:[e.label,`: `,e.error]},e.label)}function gr(e){return[e.environmentId,e]}function _r(e){return e.error!==null}function vr(e){let t=(0,Q.c)(56),{environments:r,selectedEnvironments:i,selectedEnvironmentIds:a,onSelectionChange:o,showUsageStatus:s,refreshing:l,isPartial:u,duplicateSources:d,contractMismatches:p,onOpenModelPrices:m}=e,h=a===null,g=h?`All environments`:i.length===1?i[0].label:`${i.length} environments`,_;t[0]!==p||t[1]!==i?(_=i.some(br)||p.length>0,t[0]=p,t[1]=i,t[2]=_):_=t[2];let b=_,x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(P,{}),t[3]=x):x=t[3];let S;t[4]===g?S=t[5]:(S=(0,$.jsx)(Qe,{children:g}),t[4]=g,t[5]=S);let C;t[6]!==b||t[7]!==s?(C=(0,$.jsx)(`span`,{className:`flex size-3.5 shrink-0 items-center justify-center text-muted-foreground`,children:s&&b?(0,$.jsx)(f,{className:`size-3.5 text-warning-foreground`,"aria-label":`Some environments could not report usage`}):(0,$.jsx)(ee,{className:`size-3.5 opacity-0 transition-opacity group-hover/usage-environment:opacity-100 group-focus-visible/usage-environment:opacity-100 group-data-popup-open/usage-environment:opacity-100`,"aria-hidden":!0})}),t[6]=b,t[7]=s,t[8]=C):C=t[8];let w;t[9]!==S||t[10]!==C?(w=(0,$.jsxs)(y,{render:x,className:`group/usage-environment min-w-0 max-w-full`,children:[S,C]}),t[9]=S,t[10]=C,t[11]=w):w=t[11];let T;t[12]===o?T=t[13]:(T=e=>o(e?null:new Set),t[12]=o,t[13]=T);let E;t[14]!==h||t[15]!==T?(E=(0,$.jsx)(c,{checked:h,closeOnClick:!1,onCheckedChange:T,children:`All environments`}),t[14]=h,t[15]=T,t[16]=E):E=t[16];let k;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(O,{}),t[17]=k):k=t[17];let A;if(t[18]!==r||t[19]!==o||t[20]!==l||t[21]!==a||t[22]!==i||t[23]!==s){let e;t[25]!==r.length||t[26]!==o||t[27]!==l||t[28]!==a||t[29]!==i||t[30]!==s?(e=e=>{let t=a===null||a.has(e.environmentId),n=ut(e,l),u=e.error===null?e.summary!==null&&!bt(e.summary.contractVersion,6)?`Update required`:e.isConnected?n.phase===`loading`?`Scanning…`:n.phase===`stale`?`Refreshing…`:n.phase===`partway`?dt(n.providers,ir):`Ready`:`Connecting…`:`Unavailable`;return(0,$.jsx)(c,{checked:t,closeOnClick:!1,onCheckedChange:t=>{let n=new Set(i.map(yr));t?n.add(e.environmentId):n.delete(e.environmentId),o(n.size===r.length?null:n)},children:(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),s?(0,$.jsx)(`span`,{className:M(`shrink-0 text-xs text-muted-foreground`,e.error!==null&&`text-destructive`),children:u}):null]})},e.environmentId)},t[25]=r.length,t[26]=o,t[27]=l,t[28]=a,t[29]=i,t[30]=s,t[31]=e):e=t[31],A=r.map(e),t[18]=r,t[19]=o,t[20]=l,t[21]=a,t[22]=i,t[23]=s,t[24]=A}else A=t[24];let N;t[32]===r.length?N=t[33]:(N=r.length===0?(0,$.jsx)(`p`,{className:`px-2 py-2 text-xs text-muted-foreground`,children:`No environments connected.`}):null,t[32]=r.length,t[33]=N);let F;t[34]!==u||t[35]!==s?(F=s&&u?(0,$.jsx)(`p`,{className:`px-2 py-2 text-xs text-muted-foreground`,children:`Totals are partial while selected environments scan.`}):null,t[34]=u,t[35]=s,t[36]=F):F=t[36];let I;t[37]!==p||t[38]!==d||t[39]!==i||t[40]!==s?(I=s?(0,$.jsx)(pr,{environments:i,duplicateSources:d,contractMismatches:p}):null,t[37]=p,t[38]=d,t[39]=i,t[40]=s,t[41]=I):I=t[41];let L;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(O,{}),t[42]=L):L=t[42];let R;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(j,{"aria-hidden":!0}),t[43]=R):R=t[43];let z;t[44]===m?z=t[45]:(z=(0,$.jsxs)(v,{onClick:m,children:[R,`Model prices`]}),t[44]=m,t[45]=z);let B;t[46]!==N||t[47]!==F||t[48]!==I||t[49]!==z||t[50]!==E||t[51]!==A?(B=(0,$.jsxs)(n,{align:`start`,children:[E,k,A,N,F,I,L,z]}),t[46]=N,t[47]=F,t[48]=I,t[49]=z,t[50]=E,t[51]=A,t[52]=B):B=t[52];let V;return t[53]!==B||t[54]!==w?(V=(0,$.jsxs)(D,{children:[w,B]}),t[53]=B,t[54]=w,t[55]=V):V=t[55],V}function yr(e){return e.environmentId}function br(e){return e.error!==null}function xr(e){let t=(0,Q.c)(23),{hiddenProviders:r,onChange:i}=e,a;t[0]===r?a=t[1]:(a=Je.filter(e=>!r.has(e)),t[0]=r,t[1]=a);let o=a,s=o.length===Je.length?`All providers`:o.length===0?`No providers`:o.length===1?Xe[o[0]].label:`${o.length} providers`,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(P,{}),t[2]=l):l=t[2];let u;t[3]===s?u=t[4]:(u=(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:s}),t[3]=s,t[4]=u);let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(ee,{className:`size-3.5 shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover/usage-provider:opacity-100 group-focus-visible/usage-provider:opacity-100 group-data-popup-open/usage-provider:opacity-100`,"aria-hidden":!0}),t[5]=d):d=t[5];let f;t[6]===u?f=t[7]:(f=(0,$.jsxs)(y,{render:l,className:`group/usage-provider min-w-0 max-w-full`,children:[u,d]}),t[6]=u,t[7]=f);let p=r.size===0,m;t[8]===i?m=t[9]:(m=e=>i(e?[]:Je),t[8]=i,t[9]=m);let h;t[10]!==p||t[11]!==m?(h=(0,$.jsx)(c,{checked:p,closeOnClick:!1,onCheckedChange:m,children:`All providers`}),t[10]=p,t[11]=m,t[12]=h):h=t[12];let g;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(O,{}),t[13]=g):g=t[13];let _;t[14]!==r||t[15]!==i?(_=Je.map(e=>(0,$.jsx)(c,{checked:!r.has(e),closeOnClick:!1,onCheckedChange:t=>i(Je.filter(n=>n===e?!t:r.has(n))),children:(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(ur,{provider:e,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`truncate`,children:Xe[e].label})]})},e)),t[14]=r,t[15]=i,t[16]=_):_=t[16];let v;t[17]!==_||t[18]!==h?(v=(0,$.jsxs)(n,{align:`start`,children:[h,g,_]}),t[17]=_,t[18]=h,t[19]=v):v=t[19];let b;return t[20]!==v||t[21]!==f?(b=(0,$.jsxs)(D,{children:[f,v]}),t[20]=v,t[21]=f,t[22]=b):b=t[22],b}function Sr(){let e=(0,Q.c)(7),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(X,{className:`h-10 w-36`}),(0,$.jsx)(X,{className:`h-4 w-32`})]}),Je.map(Cr)]}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(X,{className:`h-5 w-24`}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsxs)(`section`,{className:`grid gap-6 lg:grid-cols-[minmax(0,18rem)_minmax(0,1fr)]`,children:[t,(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[n,(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(X,{className:`ml-16 h-56`}),(0,$.jsx)(X,{className:`ml-16 h-4`})]})]})]}),e[2]=r):r=e[2];let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:`Totals`}),e[3]=i):i=e[3];let a;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[i,(0,$.jsx)(wr,{labels:[`Processed tokens`,`Cached input`,`Uncached input`,`Output`,`Cache savings`]})]}),e[4]=a):a=e[4];let o;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(`section`,{className:`grid gap-x-12 gap-y-8 lg:grid-cols-2`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,$.jsx)(X,{className:`h-5 w-28`}),(0,$.jsx)(X,{className:`h-2`}),(0,$.jsx)(X,{className:`h-4 w-72`})]})}),e[5]=o):o=e[5];let s;return e[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsxs)($.Fragment,{children:[r,a,o,(0,$.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:`Breakdown`}),(0,$.jsx)(X,{shape:`card`,className:`h-7 w-28`})]}),(0,$.jsx)(X,{className:`h-44`})]})]}),e[6]=s):s=e[6],s}function Cr(e){return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`div`,{className:`flex min-h-5 items-center justify-between gap-4`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(X,{shape:`pill`,className:`size-2 shrink-0`}),(0,$.jsx)(X,{shape:`pill`,className:`size-4 shrink-0`}),(0,$.jsx)(X,{className:`h-3.5 w-20`})]}),(0,$.jsx)(X,{className:`h-3.5 w-14`})]}),(0,$.jsx)(X,{className:`h-4 w-36`})]},e)}function wr(e){let t=(0,Q.c)(4),{labels:n}=e,r;t[0]===n?r=t[1]:(r=n.map(Tr),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsx)(`div`,{className:`grid grid-cols-2 gap-x-6 gap-y-4 py-1 md:grid-cols-5`,children:r}),t[2]=r,t[3]=i),i}function Tr(e){return(0,$.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e}),(0,$.jsx)(X,{className:`h-6 w-16`})]},e)}var Er=ar;export{Er as component};
|
|
2
|
+
//# sourceMappingURL=usage-C2lJ6qWL.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=usageAccess-
|
|
1
|
+
import{I_ as e,h_ as t}from"./utils-hgbJ2TVM.js";function n(n){if(n.hasSessionError)return{canReadDiagnostics:!1,isPending:!1,error:`Could not check this connection's access to diagnostics and usage.`};if(n.session===null){let e=n.connectionPhase===`connected`||n.connectionPhase===`connecting`||n.connectionPhase===`reconnecting`;return{canReadDiagnostics:!1,isPending:e,error:e?null:`This environment is not connected.`}}let r=e(n.session,t);return{canReadDiagnostics:r,isPending:!1,error:r?null:`This connection does not have access to diagnostics and usage.`}}export{n as t};
|
|
2
|
+
//# sourceMappingURL=usageAccess-ZgmQIiWk.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=usageFormat-
|
|
1
|
+
import{$c as e}from"./utils-hgbJ2TVM.js";var t=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:2}),n=new Intl.NumberFormat(`en-US`);function r(e){return t.format(e)}function i(e){return n.format(Math.round(e))}function a(e){let t=Math.abs(e);return t>=0xe8d4a51000?`${o(e/0xe8d4a51000)}T`:t>=1e9?`${o(e/1e9)}B`:t>=1e6?`${o(e/1e6)}M`:t>=1e3?`${o(e/1e3)}K`:n.format(Math.round(e))}function o(e){let t=Math.abs(e),n=t>=100?0:t>=10?1:2;return e.toFixed(n).replace(/\.0+$/,``)}function s(e,t=1){let n=e*100,r=10**-t;return n>0&&n<r?`<${r.toFixed(t)}%`:`${n.toFixed(t)}%`}function c(e,t){return t.direction===`serverBehind`?`${e} runs an older server version and is excluded from totals.`:`This client is older than the server on ${e}; its usage is excluded from totals.`}function l(e){let[t,n,r]=e.split(`-`).map(e=>Number(e));return t===void 0||n===void 0||r===void 0?e:`${[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`][n-1]??``} ${r}`}function u(e,t){let n=[],r=Date.parse(`${e}T00:00:00Z`),i=Date.parse(`${t}T00:00:00Z`);if(Number.isNaN(r)||Number.isNaN(i)||i<r)return n;for(let e=r;e<=i;e+=864e5)n.push(new Date(e).toISOString().slice(0,10));return n}var d=36e5,f=new Map;function p(e,t){if(t.timeZone===void 0)return new Intl.DateTimeFormat(e,t);let n=JSON.stringify([e,t]),r=f.get(n);return r===void 0&&(r=new Intl.DateTimeFormat(e,t),f.size>=16&&f.clear(),f.set(n,r)),r}function m(e,t){let n=[],r=Date.parse(e),i=Date.parse(t);if(Number.isNaN(r)||Number.isNaN(i)||i<=r)return n;for(let e=r;e<i;e+=d)n.push(new Date(e).toISOString());return n}function h(e,t){let n=new Date(e);if(Number.isNaN(n.getTime()))return e;let r=t===void 0?{}:{timeZone:t},i=p(`en-US`,{...r,hour:`numeric`}),a=p(`en-CA`,{...r,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,hourCycle:`h23`}),o=a.format(n);return[-36e5,d].some(e=>a.format(new Date(n.getTime()+e))===o)?p(`en-US`,{...t===void 0?{}:{timeZone:t},hour:`numeric`,timeZoneName:`short`}).format(n):i.format(n)}function g(e,t){let n=new Date(e);return Number.isNaN(n.getTime())?e:p(`en-US`,{...t===void 0?{}:{timeZone:t},month:`short`,day:`numeric`,hour:`numeric`}).format(n)}function _(e,t,n){let r=new Date(e),i=new Date(t);if(Number.isNaN(r.getTime())||Number.isNaN(i.getTime()))return g(e,n);let a=p(`en-CA`,{...n===void 0?{}:{timeZone:n},year:`numeric`,month:`2-digit`,day:`2-digit`}),o=Date.parse(`${a.format(r)}T00:00:00Z`),s=Date.parse(`${a.format(i)}T00:00:00Z`),c=Math.round((s-o)/(24*d)),l=h(e,n);return c===0?`${l} today`:c===1?`${l} yesterday`:g(e,n)}function v(t,n=new Date,r=`day`){let i=Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`,a;try{a=new Intl.DateTimeFormat(`en-CA`,{timeZone:i,year:`numeric`,month:`2-digit`,day:`2-digit`})}catch{i=`UTC`,a=new Intl.DateTimeFormat(`en-CA`,{timeZone:`UTC`,year:`numeric`,month:`2-digit`,day:`2-digit`})}let o=a.format(n);if(r===`hour`){let t=Math.floor(n.getTime()/6e4)*6e4,o=t-24*d,s=new Date(o),c=new Date(t);return{sinceDay:e.make(a.format(s)),untilDay:e.make(a.format(c)),timeZone:i,resolution:r,sinceTime:s.toISOString(),untilTime:c.toISOString()}}let[s=0,c=1,l=1]=o.split(`-`).map(e=>Number.parseInt(e,10)),u=new Date(Date.UTC(s,c-1,l-(t-1)));return{sinceDay:e.make(u.toISOString().slice(0,10)),untilDay:e.make(o),timeZone:i,resolution:r}}export{l as a,_ as c,r as d,v as f,g as i,a as l,m as n,h as o,i as r,s,u as t,c as u};
|
|
2
|
+
//# sourceMappingURL=usageFormat-C54RJiV9.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as e}from"./keybindings-
|
|
2
|
-
//# sourceMappingURL=usageShortcuts-
|
|
1
|
+
import{_ as e}from"./keybindings-CqjUKNRx.js";var t=[{value:`cost`,label:`Cost`,command:`usage.cost`},{value:`tokens`,label:`Tokens`,command:`usage.tokens`},{value:`limits`,label:`Limits`,command:`usage.limits`}],n=[{days:1,label:`Past 24h`,command:`usage.period.day`},{days:7,label:`7 days`,command:`usage.period.week`},{days:30,label:`30 days`,command:`usage.period.month`},{days:90,label:`90 days`,command:`usage.period.quarter`}];function r(t,n){let r=t.target;return r instanceof HTMLElement&&(r.tagName===`INPUT`||r.tagName===`TEXTAREA`||r.tagName===`SELECT`||r.isContentEditable||r.closest(`[role="dialog"], [aria-modal="true"], [data-slot$="popup"]`))?null:e(t,n,{context:{usagePageOpen:!0}})}export{n,r,t};
|
|
2
|
+
//# sourceMappingURL=usageShortcuts-B3af64g0.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{
|
|
2
|
-
//# sourceMappingURL=use-atom-command-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{RE as n,es as r}from"./utils-hgbJ2TVM.js";import{B as i}from"./runtime-Cj24N7je.js";var a=n(),o=e(t(),1);function s(e,t){let n=(0,a.c)(6),s=(0,o.useContext)(r),c=typeof t==`string`?t:t?.label??e.label,l=typeof t==`string`?!0:t?.reportFailure??!0,u=typeof t==`string`?!0:t?.reportDefect??!0,d;return n[0]!==e||n[1]!==c||n[2]!==s||n[3]!==u||n[4]!==l?(d=t=>i(s,e,t,{label:c,reportFailure:l,reportDefect:u}),n[0]=e,n[1]=c,n[2]=s,n[3]=u,n[4]=l,n[5]=d):d=n[5],d}export{s as t};
|
|
2
|
+
//# sourceMappingURL=use-atom-command-D34CFqu3.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{
|
|
2
|
-
//# sourceMappingURL=useAriaLabelledBy-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{ka as n,za as r}from"./utils-hgbJ2TVM.js";var i=e(t());function a(e,t,a,s=!0,c){let[l,u]=i.useState(),d=n(c?`${c}-label`:void 0),f=e??t??l;return r(()=>{let n=e||t||!s?void 0:o(a.current,d);l!==n&&u(n)}),f}function o(e,t){let n=s(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function s(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}export{a as t};
|
|
2
|
+
//# sourceMappingURL=useAriaLabelledBy-BG5RCb1o.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{$o as n,C as r,D as i,RE as a,Xs as o,Yo as s,Ys as c,Zs as l,al as u,c as d,g as f,gh as p,i as m,s as h}from"./utils-hgbJ2TVM.js";import{L as g,R as _}from"./runtime-Cj24N7je.js";import{d as ee,f as te,k as v,m as ne,p as y,w as re}from"./entities-BJgMc8pv.js";import{$t as b,cn as x,tt as S}from"./runtime-CArTL2GH.js";import{a as C,t as ie}from"./useParams-Br7l7qPU.js";import{d as w}from"./toast-B3hjhWRf.js";import{s as T}from"./useSettings-BcmuuiTp.js";import{n as E}from"./server-Vynm5NwP.js";import"./queries-BWcz-n4a.js";import{p as D}from"./session-logic-B8t9Dfk3.js";import{a as O,i as k,n as ae,o as A}from"./threadSort-Bd2rijEy.js";import{c as j,r as M}from"./projectFilesQueryState-DltGYM_H.js";import{r as N,t as oe}from"./uiStateStore-DoJ0IbwQ.js";import{d as P,f as F,i as se,r as ce,s as le,t as I}from"./p4ProjectFile-YfIRB1xP.js";var L=e(t(),1),R=a(),z=`[data-thread-item], [data-thread-selection-safe]`,B=3,V=160;function H(e){let t=(0,R.c)(6),[n,r]=L.useState(null),[i,a]=L.useState(e),o,s;t[0]!==e||t[1]!==n?(o=()=>{if(e){a(!0);return}if(n===null)return;if(typeof IntersectionObserver>`u`){a(!0);return}let t=n.closest(`[data-slot="scroll-area-viewport"]`),r=new IntersectionObserver(e=>{let[t]=e;return a(t?.isIntersecting===!0)},{root:t,rootMargin:`${V}px 0px`});return r.observe(n),()=>r.disconnect()},s=[e,n],t[0]=e,t[1]=n,t[2]=o,t[3]=s):(o=t[2],s=t[3]),L.useEffect(o,s);let c=e||i,l;return t[4]===c?l=t[5]:(l={leaseLiveStatus:c,rowRef:r},t[4]=c,t[5]=l),l}function U(e,t){let n=L.useRef(null);return e!==null&&t!==null&&(n.current={key:e,value:t}),t===null?e!==null&&n.current?.key===e?n.current.value:null:t}function W(e,t,n,r){let i=e.indexOf(t),a=e.indexOf(n);return i===-1||a===-1?[]:e.slice(Math.min(i,a),Math.max(i,a)+1).filter(r)}async function G(e){let t=new Set,n=null;for(let r of e.entries){let i=await e.delete(r,t);if(i!==null){if(i._tag===`Failure`){if(_(i))break;n??=i;continue}t.add(r.threadKey)}}return{deletedThreadKeys:t,firstFailure:n}}async function K(e){let t=[],n=[];for(let r of e.entries){let i=!1,a=await e.archive(r,()=>{i=!0});if((i||a._tag===`Success`)&&t.push(r.threadKey),a._tag===`Success`)continue;let o=a;if(i){n.push(o);continue}return{archivedThreadKeys:t,mutationFailure:o,followupFailures:n}}return{archivedThreadKeys:t,mutationFailure:null,followupFailures:n}}function q(e){return[{id:`mark-unread`,label:`Mark unread (${e.count})`},{id:`archive`,label:`Archive (${e.count})`,disabled:e.hasRunningThread},{id:`delete`,label:`Delete (${e.count})`,destructive:!0}]}function J(e){return e.lineage.relationshipToParent===`subagent`}function ue(e,t){let n=S(e);return e.filter(e=>e.archivedAt===null&&!J(e)&&n(e)&&(t===null||t.has(`${e.environmentId}:${e.projectId}`)))}var de={"Pending Approval":5,"Awaiting Input":4,Working:3,Connecting:3,Waiting:2.5,"Plan Ready":2,Completed:1};function fe(e){let t=e.setTimeoutFn??globalThis.setTimeout,n=e.clearTimeoutFn??globalThis.clearTimeout,r=!1,i=null,a=()=>{i!==null&&(n(i),i=null)};return{sync:n=>{if(!n){a(),r&&(r=!1,e.onVisibilityChange(!1));return}r||i!==null||(i=t(()=>{i=null,r=!0,e.onVisibilityChange(!0)},e.delayMs))},dispose:()=>{a()}}}function pe(){let e=(0,R.c)(5),[t,n]=L.useState(!1),r=L.useRef(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=fe({delayMs:200,onVisibilityChange:e=>{n(e)},setTimeoutFn:window.setTimeout.bind(window),clearTimeoutFn:window.clearTimeout.bind(window)});return r.current=e,()=>{e.dispose(),r.current=null}},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),L.useEffect(i,a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=e=>{r.current?.sync(e)},e[2]=o):o=e[2];let s=o,c;return e[3]===t?c=e[4]:(c={showThreadJumpHints:t,updateThreadJumpHintsVisibility:s},e[3]=t,e[4]=c),c}function me(e,t){return e===void 0?t:e??void 0}function he(e){if(!e.latestRun?.completedAt)return!1;let t=Date.parse(e.latestRun.completedAt);if(Number.isNaN(t)||!e.lastVisitedAt)return!1;let n=Date.parse(e.lastVisitedAt);return Number.isNaN(n)?!0:t>n}function ge(e){return e===null||!e.closest(z)}function _e(e){return e>1}function ve(e,t){return e===null||!(`closest`in e)||typeof e.closest!=`function`?null:e.closest(t)}function ye(e){return typeof e!=`object`||!e?!1:ve(e,`a[href]`)!==null||ve(`parentElement`in e&&e.parentElement!==null&&typeof e.parentElement==`object`?e.parentElement:null,`a[href]`)!==null}function be(e){let{getId:t,getPreferenceIds:n,items:r,preferredIds:i}=e;if(i.length===0)return[...r];let a=new Map;for(let[e,i]of r.entries()){let r=n?.(i)??[t(i)];for(let t of new Set(r)){let n=a.get(t);n?n.push(e):a.set(t,[e])}}let o=new Set,s=i.flatMap(e=>{let t=a.get(e)?.find(e=>!o.has(e));return t===void 0?[]:(o.add(t),[r[t]])}),c=r.filter((e,t)=>!o.has(t));return[...s,...c]}function xe(e,t=B){return e.slice(0,Math.max(0,t))}function Se(e){let{currentThreadId:t,direction:n,threadIds:r}=e;if(r.length===0)return null;if(t===null)return n===`previous`?r.at(-1)??null:r[0]??null;let i=r.indexOf(t);return i===-1?null:n===`previous`?i>0?r[i-1]??null:null:i<r.length-1?r[i+1]??null:null}function Ce(e){return e.button===2||e.isMac&&e.button===0&&e.ctrlKey}function we(e){return e.hasPendingApprovals||e.pendingSubagentRequest===`approval`?`approval`:e.hasPendingUserInput||e.pendingSubagentRequest===`user_input`?`input`:e.runtime!==null&&[`preparing`,`queued`,`starting`,`running`,`waiting`].includes(e.runtime.status)?`working`:e.runtime?.status===`idle`?`waiting`:e.runtime?.status===`failed`?e.runtime.lastErrorClass===`usage_limit`?`limited`:`failed`:`ready`}function Te(e,t){let n=O(e,t),r=n.filter(e=>e.pinnedAt!=null);return r.length===0?n:[...k(r),...n.filter(e=>e.pinnedAt==null)]}function Ee(e,t){let n=d(t);if(n.length===0)return!1;let r=d(x(e).join(` `));return n.split(` `).every(e=>r.includes(e))}function De(e){let{thread:t}=e;return t.hasPendingApprovals||t.pendingSubagentRequest===`approval`?{label:`Pending Approval`,colorClass:`text-amber-600 dark:text-amber-300/90`,dotClass:`bg-amber-500 dark:bg-amber-300/90`,pulse:!1}:t.hasPendingUserInput||t.pendingSubagentRequest===`user_input`?{label:`Awaiting Input`,colorClass:`text-indigo-600 dark:text-indigo-300/90`,dotClass:`bg-indigo-500 dark:bg-indigo-300/90`,pulse:!1}:t.runtime?.status===`running`||t.runtime?.status===`waiting`?{label:`Working`,colorClass:`text-sky-600 dark:text-sky-300/80`,dotClass:`bg-sky-500 dark:bg-sky-300/80`,pulse:!0}:t.runtime?.status===`preparing`||t.runtime?.status===`starting`||t.runtime?.status===`queued`?{label:`Connecting`,colorClass:`text-sky-600 dark:text-sky-300/80`,dotClass:`bg-sky-500 dark:bg-sky-300/80`,pulse:!0}:b(t.pendingBackgroundTasks??[])?{label:`Waiting`,colorClass:`text-sidebar-muted-foreground`,dotClass:`bg-sidebar-muted-foreground`,pulse:!1}:!t.hasPendingUserInput&&t.interactionMode===`plan`&&D(t.latestRun,t.runtime)&&t.hasActionableProposedPlan?{label:`Plan Ready`,colorClass:`text-violet-600 dark:text-violet-300/90`,dotClass:`bg-violet-500 dark:bg-violet-300/90`,pulse:!1}:he(t)?{label:`Completed`,colorClass:`text-emerald-600 dark:text-emerald-300/90`,dotClass:`bg-emerald-500 dark:bg-emerald-300/90`,pulse:!1}:null}function Oe(e){let t=null;for(let n of e)n!==null&&(t===null||de[n.label]>de[t.label])&&(t=n);return t}function ke(e,t){return t.projectExpanded?t.isThreadListExpanded||e.length<=t.previewCount?e:e.slice(0,t.previewCount):[]}function Ae(e){let{deletedThreadId:t,deletedThreadIds:n,sortOrder:r,threads:i}=e,a=i.find(e=>e.id===t);return a?O(i.filter(e=>e.projectId===a.projectId&&e.id!==t&&!n?.has(e.id)),r)[0]?.id??null:null}function je(e,t,n){return t.length>0?t.reduce((e,t)=>Math.max(e,ae(t,n)),-1/0):n===`created_at`?A(e.createdAt)??-1/0:A(e.updatedAt??e.createdAt)??-1/0}function Y(e,t,n,r){return t===`manual`?[...e]:e.map(e=>({project:e,timestamp:je(e,n(e),t)})).sort((e,t)=>(t.timestamp===e.timestamp?0:t.timestamp>e.timestamp?1:-1)||r(e.project,t.project)).map(({project:e})=>e)}function Me(e,t,n){let r=new Map;for(let e of t){let t=r.get(e.projectId)??[];t.push(e),r.set(e.projectId,t)}return Y(e,n,e=>r.get(e.id)??[],(e,t)=>e.title.localeCompare(t.title)||e.id.localeCompare(t.id))}function Ne(e,t,n){let r=new Map(e.flatMap(e=>e.memberProjectRefs.map(t=>[`${t.environmentId}\0${t.projectId}`,e.projectKey]))),i=new Map;for(let e of t){if(e.archivedAt!==null)continue;let t=r.get(`${e.environmentId}\0${e.projectId}`);if(!t)continue;let n=i.get(t);n?n.push(e):i.set(t,[e])}return Y(e,n,e=>i.get(e.projectKey)??[],(e,t)=>e.title.localeCompare(t.title)||e.projectKey.localeCompare(t.projectKey))}function Pe(e,t,n){return Ne(e,ue(t,null),n)}function Fe(e,t,n){let r=(e,t)=>`${e}\u0000${t}`,i=new Map;for(let e of t){if(e.archivedAt!==null)continue;let t=r(e.environmentId,e.projectId),n=i.get(t)??[];n.push(e),i.set(t,n)}return Y(e,n,e=>i.get(r(e.environmentId,e.id))??[],(e,t)=>e.title.localeCompare(t.title)||e.environmentId.localeCompare(t.environmentId)||e.id.localeCompare(t.id))}function X(e){return e.envMode!==`local`&&e.newWorktreesStartFromOrigin}function Ie(e){return e.projectDefaultSelection??(e.carrySourceDraftId===e.destinationDraftId?null:e.carrySelection)}function Z(e){let t=e?.activeProvider;return e?.modelSelectionExplicit===!0&&t!=null&&e.modelSelectionByProvider[t]!==void 0}function Le(e){return e.activeThread?c(e.activeThread.environmentId,e.activeThread.projectId):e.activeDraftThread?c(e.activeDraftThread.environmentId,e.activeDraftThread.projectId):e.defaultProjectRef}async function Re(e){let t=Le(e);return t?(await e.handleNewThread(t),!0):!1}async function ze(e,t){let n=await g(s,M(e,t,u),{reportDefect:!1,reportFailure:!1}),r=j(e,t,u,j(e,t,n._tag===`Success`?n.value.relativePath:u,n._tag===`Success`?n.value:null));return r===null||r.truncated?null:I(r.contents)}function Q(e){return{...e?.branch===void 0?{}:{branch:e.branch},...e?.worktreePath===void 0?{}:{worktreePath:e.worktreePath},...e?.envMode===void 0?{}:{envMode:e.envMode},...e?.startFromOrigin===void 0?{}:{startFromOrigin:e.startFromOrigin}}}function $(){let e=(0,R.c)(7),t=n(E),a=T(F),s=C(),c;e[0]===s.state.matches?c=e[1]:(c=()=>{let e=s.state.matches[s.state.matches.length-1]?.params??{};return w(e)},e[0]=s.state.matches,e[1]=c);let u=c,d;return e[2]!==t||e[3]!==u||e[4]!==a||e[5]!==s?(d=(e,n)=>{let c=te(),d=t.get(e.environmentId)?.settings??p,{getComposerDraft:g,getDraftSessionByLogicalProjectKey:_,getDraftSession:v,getDraftThread:re,applyStickyState:b,setDraftThreadContext:x,setLogicalProjectDraftThreadId:S,setModelSelection:C}=i.getState(),ie=s.state.location.href,w=()=>s.state.location.href!==ie,T=u(),E=T?.kind===`server`?y(T.threadRef):null,D=T?.kind===`draft`?v(T.draftId):null,O=T?g(T.kind===`server`?T.threadRef:T.draftId):null,k=O?.activeProvider??null,ae=(k?O?.modelSelectionByProvider[k]??null:null)??E?.modelSelection??null,A=O?.interactionMode??E?.interactionMode??D?.interactionMode??null,j=c.find(t=>t.id===e.projectId&&t.environmentId===e.environmentId),M=()=>w()||j!==void 0&&ee(e)===null,N=se(d,j?.id??null,j),oe=N.settings.defaultModelSelection,P=N.settings.defaultRuntimeMode,F=e=>Ie({projectDefaultSelection:oe??null,carrySelection:ae,carrySourceDraftId:T?.kind===`draft`?T.draftId:null,destinationDraftId:e}),I=async()=>{let n=j!==void 0&&N.settings.defaultThreadEnvMode===null?await ze(j.environmentId,j.workspaceRoot):null;return ce({projectSettings:se(d,j?.id??null,j,n),workspaceRoot:j?.workspaceRoot??null,newProjectsRoot:t.get(e.environmentId)?.newProjectsRoot,projectHasThreads:ne().some(t=>t.environmentId===e.environmentId&&t.projectId===e.projectId)})},L=j?le(j,a):l(e),R=n?.branch!==void 0,z=n?.worktreePath!==void 0,B=n?.envMode!==void 0,V=n?.startFromOrigin!==void 0,H=_(L),U=H?o(H.environmentId,H.threadId):null,W=H!==null&&H.promotedTo==null&&U!==null&&y(U)===null?H:null;U&&W===null&&r(U);let G=W&&!f(g(W.draftId))?W:null,K=T?T.kind===`server`?re(T.threadRef):v(T.draftId):null;if(G)return(async()=>{let t=T?.kind===`draft`&&T.draftId===G.draftId,r=R||z||B||V,i=null;if(r)i=Q(n);else if(!t){let e=await I();if(M())return null;let t=u(),n=t?.kind===`draft`&&t.draftId===G.draftId,r=U!==null&&y(U)!==null,a=_(L)?.draftId!==G.draftId,o=f(g(G.draftId));if(n||r||a||o)return null;i={branch:null,worktreePath:null,envMode:e,startFromOrigin:X({envMode:e,newWorktreesStartFromOrigin:N.settings.newWorktreesStartFromOrigin})}}if(i&&x(G.draftId,{...i,...t?{}:{runtimeMode:P},...A?{interactionMode:A}:{}}),!Z(g(G.draftId))){b(G.draftId);let e=F(G.draftId);e&&C(G.draftId,e,{replaceOptions:!0})}S(L,e,G.draftId,{threadId:G.threadId,...i,...t?{}:{runtimeMode:P},...A?{interactionMode:A}:{}});let a={draftId:G.draftId,threadId:G.threadId},o=u();return o?.kind===`draft`&&o.draftId===G.draftId||await s.navigate({to:`/draft/$draftId`,params:{draftId:G.draftId},replace:n?.replace??!1}),a})();if(K&&T?.kind===`draft`&&K.logicalProjectKey===L&&K.promotedTo==null&&!f(g(T.draftId)))return(R||z||B||V)&&x(T.draftId,Q(n)),S(L,e,T.draftId,{threadId:K.threadId,createdAt:K.createdAt,runtimeMode:K.runtimeMode,interactionMode:K.interactionMode,...Q(n)}),Promise.resolve({draftId:T.draftId,threadId:K.threadId});let q=m(),J=h(),ue=new Date().toISOString();return(async()=>{let t=n?.envMode??await I();if(M())return null;let r=_(L);if(r&&r.draftId!==H?.draftId&&y(o(r.environmentId,r.threadId))===null)return S(L,e,r.draftId,{threadId:r.threadId,createdAt:r.createdAt,runtimeMode:r.runtimeMode,interactionMode:r.interactionMode,...Q(n)}),await s.navigate({to:`/draft/$draftId`,params:{draftId:r.draftId},replace:n?.replace??!1}),{draftId:r.draftId,threadId:r.threadId};S(L,e,q,{threadId:J,createdAt:ue,branch:n?.branch??null,worktreePath:n?.worktreePath??null,envMode:t,startFromOrigin:n?.startFromOrigin??X({envMode:t,newWorktreesStartFromOrigin:N.settings.newWorktreesStartFromOrigin}),runtimeMode:P,...A?{interactionMode:A}:{}}),b(q);let i=F(q);return i&&C(q,i,{replaceOptions:!0}),await s.navigate({to:`/draft/$draftId`,params:{draftId:q},replace:n?.replace??!1}),{draftId:q,threadId:J}})()},e[2]=t,e[3]=u,e[4]=a,e[5]=s,e[6]=d):d=e[6],d}function Be(){let e=(0,R.c)(16),t=N(We),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={strict:!1,select:Ue},e[0]=n):n=e[0];let r=ie(n),a=r?.kind===`server`?r.threadRef:null,o=r?.kind===`draft`?r.draftId:null,s=v(a),l=i(He),u;e[1]!==l||e[2]!==r?(u=()=>r?r.kind===`server`?l(r.threadRef):i.getState().getDraftSession(r.draftId):null,e[1]=l,e[2]=r,e[3]=u):u=e[3];let d=i(u),f=re(),p;e[4]!==t||e[5]!==f?(p=be({items:f,preferredIds:t,getId:P,getPreferenceIds:Ve}),e[4]=t,e[5]=f,e[6]=p):p=e[6];let m=p,h=$(),g;e[7]===m[0]?g=e[8]:(g=m[0]?c(m[0].environmentId,m[0].id):null,e[7]=m[0],e[8]=g);let _;return e[9]!==d||e[10]!==s||e[11]!==h||e[12]!==o||e[13]!==a||e[14]!==g?(_={activeDraftThread:d,activeThread:s,defaultProjectRef:g,handleNewThread:h,routeDraftId:o,routeThreadRef:a},e[9]=d,e[10]=s,e[11]=h,e[12]=o,e[13]=a,e[14]=g,e[15]=_):_=e[15],_}function Ve(e){return[P(e),oe(e.workspaceRoot)]}function He(e){return e.getDraftThread}function Ue(e){return w(e)}function We(e){return e.projectOrder}export{U as A,De as C,Fe as D,Me as E,pe as M,Pe as O,me as S,Ne as T,Se as _,Le as a,W as b,q as c,xe as d,Ce as f,Ee as g,be as h,X as i,H as j,Te as k,G as l,_e as m,$ as n,Re as o,ye as p,Z as r,K as s,Be as t,Ae as u,Oe as v,ge as w,we as x,ke as y};
|
|
2
|
+
//# sourceMappingURL=useHandleNewThread-DtUtwJAY.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{a as n,r,x as i}from"./useParams-
|
|
2
|
-
//# sourceMappingURL=useLocation-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{a as n,r,x as i}from"./useParams-Br7l7qPU.js";var a=e(t(),1);function o(e){let t=n(),o=(0,a.useRef)(void 0);return r(t.stores.location,n=>{let r=e?.select?e.select(n):n;if(e?.structuralSharing??t.options.defaultStructuralSharing){let e=i(o.current,r);return o.current=e,e}return r})}export{o as t};
|
|
2
|
+
//# sourceMappingURL=useLocation-7uJHNdPS.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{a as n}from"./useParams-Br7l7qPU.js";var r=e(t(),1);function i(e){let t=n();return r.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}export{i as t};
|
|
2
|
+
//# sourceMappingURL=useNavigate-DCj963r2.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{
|
|
2
|
-
//# sourceMappingURL=useNavigateBack-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{RE as n}from"./utils-hgbJ2TVM.js";import{a as r,r as i}from"./useParams-Br7l7qPU.js";import{t as a}from"./useNavigate-DCj963r2.js";function o(){let e=r();return i(e.stores.location,e=>e.state.__TSR_index!==0)}var s=n(),c=e(t(),1);function l(){let e=(0,s.c)(3),t=a(),n=o(),r;return e[0]!==n||e[1]!==t?(r=()=>{if(n){window.history.back();return}t({to:`/`})},e[0]=n,e[1]=t,e[2]=r):r=e[2],r}function u(e){let t=(0,s.c)(3),n=l(),r=e??n,i,a;t[0]===r?(i=t[1],a=t[2]):(i=()=>{let e=e=>{if(e.defaultPrevented||e.repeat||e.isComposing||e.key!==`Escape`)return;e.preventDefault();let t=document.activeElement;t instanceof HTMLElement&&t.blur(),r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},a=[r],t[0]=r,t[1]=i,t[2]=a),(0,c.useEffect)(i,a)}export{u as t};
|
|
2
|
+
//# sourceMappingURL=useNavigateBack-DpCLZais.js.map
|
package/dist/client/assets/{useP4ConnectAuthPrompt-DHu7R38-.js → useP4ConnectAuthPrompt-D4kHnZ3Q.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=useP4ConnectAuthPrompt-
|
|
1
|
+
import{RE as e}from"./utils-hgbJ2TVM.js";import{t}from"./env-wK1YYxA8.js";import{i as n}from"./dist-C5JAYxip.js";import{t as r}from"./authRedirect-DWE5a_T9.js";var i=e();function a(){let e=(0,i.c)(2),a=n(),o;return e[0]===a?o=e[1]:(o={authPrompt:null,openAuthPrompt:()=>{a.openSignIn(r(window.location.href,t))}},e[0]=a,e[1]=o),o}export{a as t};
|
|
2
|
+
//# sourceMappingURL=useP4ConnectAuthPrompt-D4kHnZ3Q.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{
|
|
2
|
-
//# sourceMappingURL=useParams-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{Di as n}from"./utils-hgbJ2TVM.js";function r(e){return e[e.length-1]}function i(e){return typeof e==`function`}function a(e,t){return i(e)?e(t):e}var o=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;function c(e){for(let t in e)if(o.call(e,t))return!0;return!1}var l=()=>Object.create(null),u=(e,t)=>d(e,t,l);function d(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=h(e)&&h(i);if(!a&&!(p(e)&&p(i)))return i;let s=a?e:f(e);if(!s)return i;let c=a?i:f(i);if(!c)return i;let l=s.length,u=c.length,m=a?Array(u):n(),g=0;for(let t=0;t<u;t++){let s=a?t:c[t],u=e[s],f=i[s];if(u===f){m[s]=u,(a?t<l:o.call(e,s))&&g++;continue}if(u===null||f===null||typeof u!=`object`||typeof f!=`object`){m[s]=f;continue}let p=d(u,f,n,r+1);m[s]=p,p===u&&g++}return l===u&&g===l?e:m}function f(e){let t=Object.getOwnPropertyNames(e);for(let n of t)if(!s.call(e,n))return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;let r=t;for(let t of n){if(!s.call(e,t))return!1;r.push(t)}return r}function p(e){if(!m(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!m(n)||!n.hasOwnProperty(`isPrototypeOf`))}function m(e){return Object.prototype.toString.call(e)===`[object Object]`}function h(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function g(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!g(e[r],t[r],n))return!1;return!0}if(p(e)&&p(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!g(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!g(e[o],t[o],n)))return!1;return i===a}return!1}function _(e){let t,n,r=new Promise((e,r)=>{t=e,n=r});return r.status=`pending`,r.resolve=n=>{r.status=`resolved`,r.value=n,t(n),e?.(n)},r.reject=e=>{r.status=`rejected`,n(e)},r}function v(e){return typeof e?.message==`string`?e.message.startsWith(`Failed to fetch dynamically imported module`)||e.message.startsWith(`error loading dynamically imported module`)||e.message.startsWith(`Importing a module script failed`):!1}function y(e){return!!(e&&typeof e==`object`&&typeof e.then==`function`)}function b(e){return e.replace(/[\x00-\x1f\x7f]/g,``)}function x(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return b(t)}var S=[`http:`,`https:`,`mailto:`,`tel:`];function C(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function w(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=x(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=x(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function T(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function E(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function D(){throw Error(`Invariant failed`)}var O=n(),k=e(t(),1),A=k.createContext(null);function j(e){return k.useContext(A)}var M=k.createContext(void 0),N=k.createContext(void 0);function P(e,t){return e===t}function F(e,t,n=P){let r=(0,k.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,k.useCallback)(()=>e?.get(),[e]);return(0,O.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var I={get:()=>void 0,subscribe:()=>({unsubscribe:()=>{}})};function L(e){let t=j(),n=k.useContext(e.from?N:M),r=e.from??n,i=r?e.from?t.stores.getRouteMatchStore(r):t.stores.matchStores.get(r):void 0,a=k.useRef(void 0);return F(i??I,n=>{if((e.shouldThrow??!0)&&!n&&D(),n===void 0)return;let r=e.select?e.select(n):n;if(e.structuralSharing??t.options.defaultStructuralSharing){let e=d(a.current,r);return a.current=e,e}return r})}function R(e){return L({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}export{v as _,j as a,u as b,S as c,w as d,g as f,C as g,c as h,M as i,E as l,a as m,L as n,A as o,T as p,F as r,D as s,R as t,_ as u,y as v,d as x,r as y};
|
|
2
|
+
//# sourceMappingURL=useParams-Br7l7qPU.js.map
|
package/dist/client/assets/{usePermissionStatus-CUViQRYY.js → usePermissionStatus-SyBwmFSK.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{
|
|
2
|
-
//# sourceMappingURL=usePermissionStatus-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{Ad as n,RE as r,lr as i,mE as a}from"./utils-hgbJ2TVM.js";var o=r(),s=e(a(),1);function c(e){let t=(0,o.c)(7),{permissions:r,busy:a}=e,c=a!==void 0&&a,l;if(t[0]!==c||t[1]!==r){let e;t[3]===c?e=t[4]:(e=e=>(0,s.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border px-3 py-2`,children:[e.icon,(0,s.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,s.jsx)(`p`,{className:`font-medium`,children:e.title}),(0,s.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.description})]}),e.granted?(0,s.jsxs)(`span`,{role:`status`,className:`flex items-center gap-1 text-xs text-success`,children:[(0,s.jsx)(n,{className:`size-4`,"aria-hidden":`true`}),`Allowed`]}):(0,s.jsx)(i,{size:`xs`,variant:`outline`,disabled:c,onClick:e.onAllow,children:`Allow`})]},e.id),t[3]=c,t[4]=e),l=r.map(e),t[0]=c,t[1]=r,t[2]=l}else l=t[2];let u;return t[5]===l?u=t[6]:(u=(0,s.jsx)(`div`,{className:`space-y-2`,children:l}),t[5]=l,t[6]=u),u}function l(e){let t=(0,o.c)(9),n,r,a,c;t[0]===e?(n=t[1],r=t[2],a=t[3],c=t[4]):({ready:r,busy:a,children:c,...n}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=c);let l=a!==void 0&&a,u=c===void 0?`Continue`:c,d=!r||l,f;return t[5]!==u||t[6]!==n||t[7]!==d?(f=(0,s.jsx)(i,{...n,disabled:d,children:u}),t[5]=u,t[6]=n,t[7]=d,t[8]=f):f=t[8],f}var u=e(t(),1);function d(e,t,n){let r=(0,o.c)(12),i=n===void 0||n,[a,s]=(0,u.useState)(t),[c,l]=(0,u.useState)(null),d=(0,u.useEffectEvent)(e),f;r[0]!==d||r[1]!==i?(f=()=>{if(!i)return;let e=!1,t=!1,n=async()=>{if(!(e||t||document.visibilityState===`hidden`)){t=!0;try{let t=await d();e||(s(t),l(null))}catch{e||l(`Could not check permissions. We'll try again automatically.`)}t=!1}};n();let r=window.setInterval(()=>void n(),1500);return window.addEventListener(`focus`,n),document.addEventListener(`visibilitychange`,n),()=>{e=!0,window.clearInterval(r),window.removeEventListener(`focus`,n),document.removeEventListener(`visibilitychange`,n)}},r[0]=d,r[1]=i,r[2]=f):f=r[2];let p;r[3]===i?p=r[4]:(p=[i],r[3]=i,r[4]=p),(0,u.useEffect)(f,p);let m;r[5]!==c||r[6]!==a?(m=e=>c===null&&e.every(e=>a[e]),r[5]=c,r[6]=a,r[7]=m):m=r[7];let h;return r[8]!==c||r[9]!==a||r[10]!==m?(h={status:a,error:c,isReady:m},r[8]=c,r[9]=a,r[10]=m,r[11]=h):h=r[11],h}export{c as n,l as r,d as t};
|
|
2
|
+
//# sourceMappingURL=usePermissionStatus-SyBwmFSK.js.map
|
package/dist/client/assets/{usePullRequestActions-DGkavykA.js → usePullRequestActions-BypvA9CK.js}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{D as n,Go as r,Gs as i,Lc as a,NE as o,NT as s,Ss as c,Yo as l,__ as u,fw as d,k_ as f,ms as p,w_ as m,ys as h}from"./utils-BctiQ4Ue.js";import{M as g,N as _,W as v}from"./runtime-DATbE5vH.js";import{a as y,i as b}from"./vcsRefInvalidation-cn2N4Xey.js";import{C as ee}from"./entities-Bj5ceyfn.js";import{t as te}from"./runtime-Dks8Wo5P.js";import{i as x}from"./toast-gFAddE-Q.js";import{O as S,f as C,s as w}from"./useSettings-B_WzhJqU.js";import{i as T,n as E}from"./session-Bgs0dTwK.js";import{n as D}from"./query-tgXMuDtS.js";import{t as O}from"./use-atom-command-BJxdfyHC.js";import{d as k,l as A,u as j}from"./queries-lVyDrFzk.js";import{t as M}from"./sourceControl-CrjTZJC-.js";import{C as N,r as P}from"./pullRequests-DLPX2CY-.js";import{R as F,b as ne,y as re}from"./pullRequestDetail.logic-DT8Qo5OA.js";import{n as ie}from"./useHandleNewThread-BUYzfgdc.js";import{c as ae,f as I,i as L,s as R}from"./p4ProjectFile-B9fwmcbM.js";import{t as z}from"./sidebarProjectGrouping-JqsedUb6.js";var B=e(t(),1),V=o();function H(e){return{pullRequestResolution:_(e,{label:`environment-data:git:resolve-pull-request`,tag:a.gitResolvePullRequest}),preparePullRequestThread:g(e,{label:`environment-data:git:prepare-pull-request-thread`,tag:a.gitPreparePullRequestThread,scheduler:y,concurrency:b})}}var U=H(te),W={init:`init`,pull:`pull`,publishRepository:`publish_repository`,runStackedAction:`run_change_request`,preparePullRequestThread:`prepare_pull_request_thread`};function G(e){let t=T(e.scope.environmentId,m),n=W[e.kind],i=l(A.stateAtom(e.scope)),a=i.operation===n,o=(0,B.useCallback)(()=>{A.resetError(r,e.scope,n)},[e.scope,n]),s=(0,B.useCallback)(async(...t)=>{if(e.scope.environmentId===null||!E(e.scope.environmentId,`source-control:write`))return p(d(new f({requiredScope:m,message:`This connection cannot change source control.`})));let i=async()=>{let n=await e.action(...t);return h(n)&&e.onSuccess?.(),n};return e.managedExternally===!0?i():A.track(r,e.scope,{operation:n,label:e.label},i)},[e.action,e.label,e.managedExternally,e.onSuccess,e.scope,n]);return{isAllowed:t,error:a?i.error:null,isPending:a&&i.isRunning,resetError:o,run:s}}function K(e){return e.environmentId===null||e.cwd===null?null:{environmentId:e.environmentId,cwd:e.cwd}}function q(e,t){let n=(0,V.c)(6),r;n[0]===e?r=n[1]:(r=A.stateAtom(e),n[0]=e,n[1]=r);let i=l(r),a;return n[2]!==t||n[3]!==i.isRunning||n[4]!==i.operation?(a=i.isRunning&&i.operation!==null&&t.some(e=>W[e]===i.operation),n[2]=t,n[3]=i.isRunning,n[4]=i.operation,n[5]=a):a=n[5],a}function J(e){let t=(0,V.c)(7),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},t[0]=n):n=t[0];let r=O(j.init,n),i;t[1]!==r||t[2]!==e?(i=async()=>{let t=K(e);return t===null?p(d(new k({operation:`init`,environmentId:e.environmentId,cwd:e.cwd}))):r({environmentId:t.environmentId,input:{cwd:t.cwd}})},t[1]=r,t[2]=e,t[3]=i):i=t[3];let a=i,o;return t[4]!==a||t[5]!==e?(o={kind:`init`,label:`Initializing repository`,scope:e,action:a},t[4]=a,t[5]=e,t[6]=o):o=t[6],G(o)}function oe(e){let t=(0,V.c)(11),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},t[0]=n):n=t[0];let r=O(j.pull,n),i;t[1]!==e.cwd||t[2]!==e.environmentId?(i=e.environmentId!==null&&e.cwd!==null?j.status({environmentId:e.environmentId,input:{cwd:e.cwd}}):null,t[1]=e.cwd,t[2]=e.environmentId,t[3]=i):i=t[3];let a=D(i),o;t[4]!==r||t[5]!==e?(o=async()=>{let t=K(e);return t===null?p(d(new k({operation:`pull`,environmentId:e.environmentId,cwd:e.cwd}))):r({environmentId:t.environmentId,input:{cwd:t.cwd}})},t[4]=r,t[5]=e,t[6]=o):o=t[6];let s=o,c;return t[7]!==s||t[8]!==e||t[9]!==a.refresh?(c={kind:`pull`,label:`Pulling latest changes...`,scope:e,action:s,onSuccess:a.refresh},t[7]=s,t[8]=e,t[9]=a.refresh,t[10]=c):c=t[10],G(c)}function se(e){let t=(0,V.c)(13),n;t[0]===e?n=t[1]:(n=A.runStackedAction(e),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r={reportFailure:!1},t[2]=r):r=t[2];let i=O(n,r),a;t[3]!==e.cwd||t[4]!==e.environmentId?(a=e.environmentId!==null&&e.cwd!==null?j.status({environmentId:e.environmentId,input:{cwd:e.cwd}}):null,t[3]=e.cwd,t[4]=e.environmentId,t[5]=a):a=t[5];let o=D(a),s;t[6]!==i||t[7]!==e?(s=async t=>K(e)===null?p(d(new k({operation:`run_change_request`,environmentId:e.environmentId,cwd:e.cwd}))):i(t),t[6]=i,t[7]=e,t[8]=s):s=t[8];let c=s,l;return t[9]!==c||t[10]!==e||t[11]!==o.refresh?(l={kind:`runStackedAction`,label:`Running source control action`,scope:e,action:c,onSuccess:o.refresh,managedExternally:!0},t[9]=c,t[10]=e,t[11]=o.refresh,t[12]=l):l=t[12],G(l)}function ce(e){let t=(0,V.c)(11),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},t[0]=n):n=t[0];let r=O(M.publishRepository,n),i;t[1]!==e.cwd||t[2]!==e.environmentId?(i=e.environmentId!==null&&e.cwd!==null?j.status({environmentId:e.environmentId,input:{cwd:e.cwd}}):null,t[1]=e.cwd,t[2]=e.environmentId,t[3]=i):i=t[3];let a=D(i),o;t[4]!==r||t[5]!==e?(o=async t=>{let n=K(e);return n===null?p(d(new k({operation:`publish_repository`,environmentId:e.environmentId,cwd:e.cwd}))):r({environmentId:n.environmentId,input:{cwd:n.cwd,...t}})},t[4]=r,t[5]=e,t[6]=o):o=t[6];let s=o,c;return t[7]!==s||t[8]!==e||t[9]!==a.refresh?(c={kind:`publishRepository`,label:`Publishing repository`,scope:e,action:s,onSuccess:a.refresh},t[7]=s,t[8]=e,t[9]=a.refresh,t[10]=c):c=t[10],G(c)}function Y(e){let t=(0,V.c)(7),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},t[0]=n):n=t[0];let r=O(U.preparePullRequestThread,n),i;t[1]!==r||t[2]!==e?(i=async t=>{let n=K(e);return n===null?p(d(new k({operation:`prepare_pull_request_thread`,environmentId:e.environmentId,cwd:e.cwd}))):t.mode===`worktree`&&t.threadId!==void 0&&!E(n.environmentId,`orchestration:operate`)?p(d(new f({requiredScope:u,message:`This connection cannot change threads.`}))):r({environmentId:n.environmentId,input:{cwd:n.cwd,reference:t.reference,mode:t.mode,...t.threadId?{threadId:t.threadId}:{}}})},t[1]=r,t[2]=e,t[3]=i):i=t[3];let a=i,o;return t[4]!==a||t[5]!==e?(o={kind:`preparePullRequestThread`,label:`Preparing pull request thread`,scope:e,action:a},t[4]=a,t[5]=e,t[6]=o):o=t[6],G(o)}function X(e){return e.environmentId===null||e.cwd===null||e.reference===null?null:s(c(r.get(U.pullRequestResolution({environmentId:e.environmentId,input:{cwd:e.cwd,reference:e.reference}}))))}function le(e){let t=(0,V.c)(12),n;t[0]!==e.cwd||t[1]!==e.environmentId||t[2]!==e.reference?(n=e.environmentId!==null&&e.cwd!==null&&e.reference!==null?U.pullRequestResolution({environmentId:e.environmentId,input:{cwd:e.cwd,reference:e.reference}}):null,t[0]=e.cwd,t[1]=e.environmentId,t[2]=e.reference,t[3]=n):n=t[3];let r=D(n),i;t[4]===e?i=t[5]:(i=X(e),t[4]=e,t[5]=i);let a=i,o=r.data??a,s=r.isPending&&a===null,c;return t[6]!==r.error||t[7]!==r.isPending||t[8]!==r.refresh||t[9]!==o||t[10]!==s?(c={data:o,error:r.error,isPending:s,isFetching:r.isPending,refresh:r.refresh},t[6]=r.error,t[7]=r.isPending,t[8]=r.refresh,t[9]=o,t[10]=s,t[11]=c):c=t[11],c}function ue(e,t){let n=(0,V.c)(10),r;n[0]===t?r=n[1]:(r=e=>L(e,t).settings.pullRequestMergeMethod,n[0]=t,n[1]=r);let i=C(e,r),a=w(de),o=w(I),s=ee(),c=S(),l;return n[2]!==e||n[3]!==o||n[4]!==a||n[5]!==c||n[6]!==i||n[7]!==t||n[8]!==s?(l=()=>{if(i!=null)return i;if(Object.keys(a).length===0)return;let n=s.find(n=>n.environmentId===e&&n.id===t);if(!n)return;let r=z({projects:s,settings:o,primaryEnvironmentId:c}).get(ae(n))??R(n,o);return a[r]},n[2]=e,n[3]=o,n[4]=a,n[5]=c,n[6]=i,n[7]=t,n[8]=s,n[9]=l):l=n[9],l}function de(e){return e.pullRequestMergeMethodOverrides}var fe={merge:`Merge requested`,ready:`Marked ready for review`,draft:`Converted to draft`,close:`Pull request closed`,reopen:`Pull request reopened`,"update-branch":`Branch updated with the base branch`,"enable-auto-merge":`Auto-merge enabled`,"disable-auto-merge":`Auto-merge disabled`,revert:`Revert pull request opened`,"delete-branch":`Branch deleted`,"approve-workflows":`Workflows approved`},pe={merge:`Could not merge this pull request`,ready:`Could not mark this ready for review`,draft:`Could not convert this to a draft`,close:`Could not close this pull request`,reopen:`Could not reopen this pull request`,"update-branch":`Could not update this branch`,"enable-auto-merge":`Could not enable auto-merge`,"disable-auto-merge":`Could not disable auto-merge`,revert:`Could not open a revert pull request`,"delete-branch":`Could not delete this branch`,"approve-workflows":`Could not approve workflows`},Z={merge:`The host refused the merge. Check that you have write access, that the checks it requires have passed, and that the branch is not conflicting.`,ready:`The host refused it. Check that you have write access to this repository.`,draft:`The host refused it. Check that you have write access to this repository.`,close:`The host refused it. Check that you have write access, or that you opened it.`,reopen:`The host refused it. Check that you have write access, and that the branch still exists.`,"update-branch":`The host refused it. Check that you have write access, and that the base branch has not diverged in a way the host cannot merge.`,"enable-auto-merge":`The host refused it. Check that auto-merge is enabled for this repository and that you have write access.`,"disable-auto-merge":`The host refused it. Check that you have write access to this repository.`,revert:`The host refused it. Check that you have write access and that this pull request was merged on the host.`,"delete-branch":`The host refused it. Check that you have write access to the source repository and that the branch has not moved since this page loaded.`,"approve-workflows":`The host refused it. Check that you have Actions write access and that these workflow runs are still awaiting approval.`};function me({environmentId:e,reference:t,onSuccess:n,resolveMergeMethod:r}){let i=O(P.runAction,{reportFailure:!1}),[a,o]=(0,B.useState)(!1),s=(0,B.useRef)(!1);return{actionPending:a,perform:async(a,c)=>{if(!(s.current||t===null)){s.current=!0,o(!0);try{let o=await i({environmentId:e,input:{...t,action:a,...c?{mergeMethod:c}:r?{resolveMergeMethod:r}:{}}});if(o._tag===`Failure`)throw v(o);x.add({type:`success`,title:fe[a]}),n?.(a)}catch(e){x.add({type:`error`,title:pe[a],description:F(e,Z[a])})}finally{s.current=!1,o(!1)}}}}}function Q(e){let t=O(P.runAction,{reportFailure:!1}),n=(0,B.useRef)(new Set),[r,i]=(0,B.useState)(()=>new Set);return{close:(0,B.useCallback)(async r=>{let a=r.filter(e=>{let t=N(e);return e.state!==`open`||n.current.has(t)?!1:(n.current.add(t),!0)});if(a.length===0)return;i(new Set(n.current));let o=0,s=[];await Promise.all(a.map(async r=>{try{let n=await t({environmentId:r.environmentId,input:{projectId:r.projectId,host:r.host,repository:r.repository,number:r.number,action:`close`}});if(n._tag===`Failure`)throw v(n);o++,e(r)}catch(e){s.push(`#${r.number}: ${F(e,Z.close)}`)}finally{n.current.delete(N(r)),i(new Set(n.current))}})),x.add({type:s.length>0?`error`:`success`,title:s.length>0?`Closed ${o} of ${a.length} pull requests`:`Closed ${o} pull request${o===1?``:`s`}`,...s.length>0?{description:s.slice(0,3).join(`
|
|
2
|
-
`)}:{}})},[e,t]),closingKeys:r}}var $=new Map;function he(e){let t=(0,V.c)(21),{environmentId:
|
|
3
|
-
//# sourceMappingURL=usePullRequestActions-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{$o as n,Cs as r,D as i,Es as a,P_ as o,RE as s,RT as c,S_ as l,Vc as u,Yo as d,Ys as f,_w as p,k_ as m,vs as h}from"./utils-hgbJ2TVM.js";import{M as g,N as _,W as v}from"./runtime-Cj24N7je.js";import{a as y,i as b}from"./vcsRefInvalidation-hPKz3TmL.js";import{w as ee}from"./entities-BJgMc8pv.js";import{t as te}from"./runtime-CArTL2GH.js";import{i as x}from"./toast-B3hjhWRf.js";import{O as S,f as C,s as w}from"./useSettings-BcmuuiTp.js";import{i as T,n as E}from"./session-DyiiEN5g.js";import{n as D}from"./query-BFP47tsD.js";import{t as O}from"./use-atom-command-D34CFqu3.js";import{d as k,l as A,u as j}from"./queries-BWcz-n4a.js";import{t as M}from"./sourceControl-b1QZpCro.js";import{C as N,r as P}from"./pullRequests-ClG7PJe0.js";import{R as F,b as ne,y as re}from"./pullRequestDetail.logic-COstpMB1.js";import{n as ie}from"./useHandleNewThread-DtUtwJAY.js";import{c as ae,f as I,i as L,s as R}from"./p4ProjectFile-YfIRB1xP.js";import{t as z}from"./sidebarProjectGrouping-r5ezKRMx.js";var B=e(t(),1),V=s();function H(e){return{pullRequestResolution:_(e,{label:`environment-data:git:resolve-pull-request`,tag:u.gitResolvePullRequest}),preparePullRequestThread:g(e,{label:`environment-data:git:prepare-pull-request-thread`,tag:u.gitPreparePullRequestThread,scheduler:y,concurrency:b})}}var U=H(te),W={init:`init`,pull:`pull`,publishRepository:`publish_repository`,runStackedAction:`run_change_request`,preparePullRequestThread:`prepare_pull_request_thread`};function G(e){let t=T(e.scope.environmentId,m),i=W[e.kind],a=n(A.stateAtom(e.scope)),s=a.operation===i,c=(0,B.useCallback)(()=>{A.resetError(d,e.scope,i)},[e.scope,i]),l=(0,B.useCallback)(async(...t)=>{if(e.scope.environmentId===null||!E(e.scope.environmentId,`source-control:write`))return h(p(new o({requiredScope:m,message:`This connection cannot change source control.`})));let n=async()=>{let n=await e.action(...t);return r(n)&&e.onSuccess?.(),n};return e.managedExternally===!0?n():A.track(d,e.scope,{operation:i,label:e.label},n)},[e.action,e.label,e.managedExternally,e.onSuccess,e.scope,i]);return{isAllowed:t,error:s?a.error:null,isPending:s&&a.isRunning,resetError:c,run:l}}function K(e){return e.environmentId===null||e.cwd===null?null:{environmentId:e.environmentId,cwd:e.cwd}}function q(e,t){let r=(0,V.c)(6),i;r[0]===e?i=r[1]:(i=A.stateAtom(e),r[0]=e,r[1]=i);let a=n(i),o;return r[2]!==t||r[3]!==a.isRunning||r[4]!==a.operation?(o=a.isRunning&&a.operation!==null&&t.some(e=>W[e]===a.operation),r[2]=t,r[3]=a.isRunning,r[4]=a.operation,r[5]=o):o=r[5],o}function J(e){let t=(0,V.c)(7),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},t[0]=n):n=t[0];let r=O(j.init,n),i;t[1]!==r||t[2]!==e?(i=async()=>{let t=K(e);return t===null?h(p(new k({operation:`init`,environmentId:e.environmentId,cwd:e.cwd}))):r({environmentId:t.environmentId,input:{cwd:t.cwd}})},t[1]=r,t[2]=e,t[3]=i):i=t[3];let a=i,o;return t[4]!==a||t[5]!==e?(o={kind:`init`,label:`Initializing repository`,scope:e,action:a},t[4]=a,t[5]=e,t[6]=o):o=t[6],G(o)}function oe(e){let t=(0,V.c)(11),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},t[0]=n):n=t[0];let r=O(j.pull,n),i;t[1]!==e.cwd||t[2]!==e.environmentId?(i=e.environmentId!==null&&e.cwd!==null?j.status({environmentId:e.environmentId,input:{cwd:e.cwd}}):null,t[1]=e.cwd,t[2]=e.environmentId,t[3]=i):i=t[3];let a=D(i),o;t[4]!==r||t[5]!==e?(o=async()=>{let t=K(e);return t===null?h(p(new k({operation:`pull`,environmentId:e.environmentId,cwd:e.cwd}))):r({environmentId:t.environmentId,input:{cwd:t.cwd}})},t[4]=r,t[5]=e,t[6]=o):o=t[6];let s=o,c;return t[7]!==s||t[8]!==e||t[9]!==a.refresh?(c={kind:`pull`,label:`Pulling latest changes...`,scope:e,action:s,onSuccess:a.refresh},t[7]=s,t[8]=e,t[9]=a.refresh,t[10]=c):c=t[10],G(c)}function se(e){let t=(0,V.c)(13),n;t[0]===e?n=t[1]:(n=A.runStackedAction(e),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r={reportFailure:!1},t[2]=r):r=t[2];let i=O(n,r),a;t[3]!==e.cwd||t[4]!==e.environmentId?(a=e.environmentId!==null&&e.cwd!==null?j.status({environmentId:e.environmentId,input:{cwd:e.cwd}}):null,t[3]=e.cwd,t[4]=e.environmentId,t[5]=a):a=t[5];let o=D(a),s;t[6]!==i||t[7]!==e?(s=async t=>K(e)===null?h(p(new k({operation:`run_change_request`,environmentId:e.environmentId,cwd:e.cwd}))):i(t),t[6]=i,t[7]=e,t[8]=s):s=t[8];let c=s,l;return t[9]!==c||t[10]!==e||t[11]!==o.refresh?(l={kind:`runStackedAction`,label:`Running source control action`,scope:e,action:c,onSuccess:o.refresh,managedExternally:!0},t[9]=c,t[10]=e,t[11]=o.refresh,t[12]=l):l=t[12],G(l)}function ce(e){let t=(0,V.c)(11),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},t[0]=n):n=t[0];let r=O(M.publishRepository,n),i;t[1]!==e.cwd||t[2]!==e.environmentId?(i=e.environmentId!==null&&e.cwd!==null?j.status({environmentId:e.environmentId,input:{cwd:e.cwd}}):null,t[1]=e.cwd,t[2]=e.environmentId,t[3]=i):i=t[3];let a=D(i),o;t[4]!==r||t[5]!==e?(o=async t=>{let n=K(e);return n===null?h(p(new k({operation:`publish_repository`,environmentId:e.environmentId,cwd:e.cwd}))):r({environmentId:n.environmentId,input:{cwd:n.cwd,...t}})},t[4]=r,t[5]=e,t[6]=o):o=t[6];let s=o,c;return t[7]!==s||t[8]!==e||t[9]!==a.refresh?(c={kind:`publishRepository`,label:`Publishing repository`,scope:e,action:s,onSuccess:a.refresh},t[7]=s,t[8]=e,t[9]=a.refresh,t[10]=c):c=t[10],G(c)}function Y(e){let t=(0,V.c)(7),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},t[0]=n):n=t[0];let r=O(U.preparePullRequestThread,n),i;t[1]!==r||t[2]!==e?(i=async t=>{let n=K(e);return n===null?h(p(new k({operation:`prepare_pull_request_thread`,environmentId:e.environmentId,cwd:e.cwd}))):t.mode===`worktree`&&t.threadId!==void 0&&!E(n.environmentId,`orchestration:operate`)?h(p(new o({requiredScope:l,message:`This connection cannot change threads.`}))):r({environmentId:n.environmentId,input:{cwd:n.cwd,reference:t.reference,mode:t.mode,...t.threadId?{threadId:t.threadId}:{}}})},t[1]=r,t[2]=e,t[3]=i):i=t[3];let a=i,s;return t[4]!==a||t[5]!==e?(s={kind:`preparePullRequestThread`,label:`Preparing pull request thread`,scope:e,action:a},t[4]=a,t[5]=e,t[6]=s):s=t[6],G(s)}function X(e){return e.environmentId===null||e.cwd===null||e.reference===null?null:c(a(d.get(U.pullRequestResolution({environmentId:e.environmentId,input:{cwd:e.cwd,reference:e.reference}}))))}function le(e){let t=(0,V.c)(12),n;t[0]!==e.cwd||t[1]!==e.environmentId||t[2]!==e.reference?(n=e.environmentId!==null&&e.cwd!==null&&e.reference!==null?U.pullRequestResolution({environmentId:e.environmentId,input:{cwd:e.cwd,reference:e.reference}}):null,t[0]=e.cwd,t[1]=e.environmentId,t[2]=e.reference,t[3]=n):n=t[3];let r=D(n),i;t[4]===e?i=t[5]:(i=X(e),t[4]=e,t[5]=i);let a=i,o=r.data??a,s=r.isPending&&a===null,c;return t[6]!==r.error||t[7]!==r.isPending||t[8]!==r.refresh||t[9]!==o||t[10]!==s?(c={data:o,error:r.error,isPending:s,isFetching:r.isPending,refresh:r.refresh},t[6]=r.error,t[7]=r.isPending,t[8]=r.refresh,t[9]=o,t[10]=s,t[11]=c):c=t[11],c}function ue(e,t){let n=(0,V.c)(10),r;n[0]===t?r=n[1]:(r=e=>L(e,t).settings.pullRequestMergeMethod,n[0]=t,n[1]=r);let i=C(e,r),a=w(de),o=w(I),s=ee(),c=S(),l;return n[2]!==e||n[3]!==o||n[4]!==a||n[5]!==c||n[6]!==i||n[7]!==t||n[8]!==s?(l=()=>{if(i!=null)return i;if(Object.keys(a).length===0)return;let n=s.find(n=>n.environmentId===e&&n.id===t);if(!n)return;let r=z({projects:s,settings:o,primaryEnvironmentId:c}).get(ae(n))??R(n,o);return a[r]},n[2]=e,n[3]=o,n[4]=a,n[5]=c,n[6]=i,n[7]=t,n[8]=s,n[9]=l):l=n[9],l}function de(e){return e.pullRequestMergeMethodOverrides}var fe={merge:`Merge requested`,ready:`Marked ready for review`,draft:`Converted to draft`,close:`Pull request closed`,reopen:`Pull request reopened`,"update-branch":`Branch updated with the base branch`,"enable-auto-merge":`Auto-merge enabled`,"disable-auto-merge":`Auto-merge disabled`,revert:`Revert pull request opened`,"delete-branch":`Branch deleted`,"approve-workflows":`Workflows approved`},pe={merge:`Could not merge this pull request`,ready:`Could not mark this ready for review`,draft:`Could not convert this to a draft`,close:`Could not close this pull request`,reopen:`Could not reopen this pull request`,"update-branch":`Could not update this branch`,"enable-auto-merge":`Could not enable auto-merge`,"disable-auto-merge":`Could not disable auto-merge`,revert:`Could not open a revert pull request`,"delete-branch":`Could not delete this branch`,"approve-workflows":`Could not approve workflows`},Z={merge:`The host refused the merge. Check that you have write access, that the checks it requires have passed, and that the branch is not conflicting.`,ready:`The host refused it. Check that you have write access to this repository.`,draft:`The host refused it. Check that you have write access to this repository.`,close:`The host refused it. Check that you have write access, or that you opened it.`,reopen:`The host refused it. Check that you have write access, and that the branch still exists.`,"update-branch":`The host refused it. Check that you have write access, and that the base branch has not diverged in a way the host cannot merge.`,"enable-auto-merge":`The host refused it. Check that auto-merge is enabled for this repository and that you have write access.`,"disable-auto-merge":`The host refused it. Check that you have write access to this repository.`,revert:`The host refused it. Check that you have write access and that this pull request was merged on the host.`,"delete-branch":`The host refused it. Check that you have write access to the source repository and that the branch has not moved since this page loaded.`,"approve-workflows":`The host refused it. Check that you have Actions write access and that these workflow runs are still awaiting approval.`};function me({environmentId:e,reference:t,onSuccess:n,resolveMergeMethod:r}){let i=O(P.runAction,{reportFailure:!1}),[a,o]=(0,B.useState)(!1),s=(0,B.useRef)(!1);return{actionPending:a,perform:async(a,c)=>{if(!(s.current||t===null)){s.current=!0,o(!0);try{let o=await i({environmentId:e,input:{...t,action:a,...c?{mergeMethod:c}:r?{resolveMergeMethod:r}:{}}});if(o._tag===`Failure`)throw v(o);x.add({type:`success`,title:fe[a]}),n?.(a)}catch(e){x.add({type:`error`,title:pe[a],description:F(e,Z[a])})}finally{s.current=!1,o(!1)}}}}}function Q(e){let t=O(P.runAction,{reportFailure:!1}),n=(0,B.useRef)(new Set),[r,i]=(0,B.useState)(()=>new Set);return{close:(0,B.useCallback)(async r=>{let a=r.filter(e=>{let t=N(e);return e.state!==`open`||n.current.has(t)?!1:(n.current.add(t),!0)});if(a.length===0)return;i(new Set(n.current));let o=0,s=[];await Promise.all(a.map(async r=>{try{let n=await t({environmentId:r.environmentId,input:{projectId:r.projectId,host:r.host,repository:r.repository,number:r.number,action:`close`}});if(n._tag===`Failure`)throw v(n);o++,e(r)}catch(e){s.push(`#${r.number}: ${F(e,Z.close)}`)}finally{n.current.delete(N(r)),i(new Set(n.current))}})),x.add({type:s.length>0?`error`:`success`,title:s.length>0?`Closed ${o} of ${a.length} pull requests`:`Closed ${o} pull request${o===1?``:`s`}`,...s.length>0?{description:s.slice(0,3).join(`
|
|
2
|
+
`)}:{}})},[e,t]),closingKeys:r}}var $=new Map;function he(e){let t=(0,V.c)(21),{environmentId:n,detail:r}=e,a=ie(),o=r?.workspaceRoot??null,s;t[0]!==n||t[1]!==o?(s={environmentId:n,cwd:o},t[0]=n,t[1]=o,t[2]=s):s=t[2];let c=Y(s),[l,u]=(0,B.useState)(null),d;t[3]===a?d=t[4]:(d=async(e,t,n)=>{let r=n??await a(e).then(xe,be);if(r===null)return null;let o=i.getState();if(t===null)return r;let s=o.getComposerDraft(r.draftId),c=s?.reviewComments??[],l=re({prompt:s?.prompt??``,lastHandoffPrompt:$.get(r.draftId)},t.prompt);return $.set(r.draftId,t.prompt),o.setPrompt(r.draftId,l),o.setReviewComments(r.draftId,ne(c,t.reviewComments??[])),r},t[3]=a,t[4]=d);let p=d,m;t[5]!==r||t[6]!==n||t[7]!==l||t[8]!==p?(m=async(e,t)=>{if(!r||l!==null)return;u(e);let i=f(n,r.projectId),a=await p(i,t);if(u(null),a===null){x.add({type:`error`,title:`Could not open a thread`,description:`Try again from the project, or open a thread first.`});return}x.add({type:`success`,title:`Asked in a thread`,description:t.prompt.length>0?`The question is in the composer — read it over, then send.`:`The pull request is in the composer — type your question, then send.`})},t[5]=r,t[6]=n,t[7]=l,t[8]=p,t[9]=m):m=t[9];let h=m,g;t[10]!==r||t[11]!==n||t[12]!==l||t[13]!==a||t[14]!==p||t[15]!==c?(g=async(e,t,i)=>{let o=i===void 0?`worktree`:i;if(!r||l!==null)return;u(e);let s=x.add({type:`loading`,title:`Preparing the pull request checkout...`}),d=f(n,r.projectId),m=await a(d).then(ye,ve);if(m===null){u(null),x.update(s,{type:`error`,title:`Could not open a thread for the checkout`,description:`Try again from the project, or open a thread first.`});return}let h=await c.run({reference:r.url,mode:o,threadId:m.threadId});if(h._tag===`Failure`){u(null);let e=c.error instanceof Error?c.error.message:null;x.update(s,{type:`error`,title:`Could not prepare the pull request checkout`,...e?{description:e}:{}});return}if(!await a(d,{branch:h.value.branch,worktreePath:h.value.worktreePath,envMode:h.value.worktreePath===null?`local`:`worktree`}).then(_e,ge)){u(null),x.update(s,{type:`error`,title:`Checked out, but the thread stayed where it was`,description:`The checkout is ready on \`${h.value.branch}\`. Point a thread at it from the branch picker, then ask again.`});return}u(null);let g={type:`warning`,title:`Checked out, but not on the latest commits`,description:`The checkout could not be moved onto the pull request's latest commits, so the code there is older than the pull request. Uncommitted work or local commits keep it where it is.`};if(t===null){x.update(s,h.value.isOnPullRequestHead?{type:`success`,title:o===`local`?`Checked out here`:`Checked out`,description:o===`local`?`This repository is on the pull request's branch, with a thread open on it.`:`The pull request is in its own worktree, with a thread open on it.`}:g);return}await p(d,t,m),x.update(s,h.value.isOnPullRequestHead?{type:`success`,title:`Checkout ready`,description:`The task is in the composer — read it over, then send.`}:g)},t[10]=r,t[11]=n,t[12]=l,t[13]=a,t[14]=p,t[15]=c,t[16]=g):g=t[16];let _=g,v;return t[17]!==l||t[18]!==h||t[19]!==_?(v={handoff:l,startAsk:h,startHandoff:_},t[17]=l,t[18]=h,t[19]=_,t[20]=v):v=t[20],v}function ge(){return!1}function _e(e){return e!==null}function ve(){return null}function ye(e){return e}function be(){return null}function xe(e){return e}export{X as a,le as c,J as d,oe as f,he as i,q as l,Q as n,se as o,ue as r,Y as s,me as t,ce as u};
|
|
3
|
+
//# sourceMappingURL=usePullRequestActions-BypvA9CK.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{
|
|
2
|
-
//# sourceMappingURL=useRegisterFieldControl-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{za as n,zn as r}from"./utils-hgbJ2TVM.js";var i=e(t());function a(e,t,a,o,s=!0){let{registerFieldControl:c}=r(),l=i.useRef(null);l.current||=Symbol(),n(()=>{let n=l.current;if(n&&s)return c(n,{controlRef:e,getValue:o,id:t,value:a}),()=>{c(n,void 0)}},[e,s,o,t,c,a])}export{a as t};
|
|
2
|
+
//# sourceMappingURL=useRegisterFieldControl-qXOWsCr5.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Ht as e,
|
|
2
|
-
//# sourceMappingURL=useScopedModelAvailability-
|
|
1
|
+
import{Ht as e,Nt as t,RE as n,Vt as r}from"./utils-hgbJ2TVM.js";import{E as i,i as a}from"./useSettings-BcmuuiTp.js";import{B as o}from"./settingsLayout-CuUCC6iL.js";var s=n();function c(n,c){let l=(0,s.c)(5),{targets:u}=o(),{environments:d}=i(),f;return l[0]!==c||l[1]!==d||l[2]!==n||l[3]!==u?(f=(i,o)=>{let s=c.find(e=>e.instanceId===i);for(let c of u){let l=d.find(e=>e.environmentId===c.environmentId),u=l?.serverConfig;if(!u)continue;let f=r(e(u.providers),c.settings,c.projectId).find(e=>e.instanceId===i),p=t(a(c.settings,n),u.providers).get(i);if(!f?.enabled||!f.isAvailable||f.driverKind!==s?.driverKind||!p?.some(e=>e.slug===o&&!e.isUnavailable))return`This model is unavailable on ${l?.label??`a selected environment`}. Select that environment to choose its model separately.`}return null},l[0]=c,l[1]=d,l[2]=n,l[3]=u,l[4]=f):f=l[4],f}export{c as t};
|
|
2
|
+
//# sourceMappingURL=useScopedModelAvailability-YXOv7_8D.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{$o as n,Ah as r,Bb as i,Bg as a,Cs as o,Db as s,Ds as c,Eb as l,Es as u,Gy as d,HT as f,Hs as p,I_ as ee,Ib as te,LT as ne,Lb as re,Nx as ie,Ny as ae,O_ as oe,Oh as se,Oy as ce,Pb as le,Pv as ue,Qy as de,RE as fe,RT as m,Rg as pe,Sl as me,Th as he,Vy as ge,Xy as _e,Yo as ve,bh as ye,bl as be,c_ as xe,cb as Se,ds as h,eT as g,es as Ce,gb as we,gh as Te,hh as Ee,iS as De,iT as _,ib as Oe,jc as ke,kh as Ae,ks as je,l_ as Me,lb as Ne,lh as Pe,nT as v,nb as Fe,oS as Ie,oh as Le,ph as Re,rs as y,s_ as ze,ts as Be,uh as Ve,yl as He,z_ as Ue,zb as We}from"./utils-hgbJ2TVM.js";import{At as Ge,E as Ke,I as qe,R as Je,Sn as Ye,T as Xe,W as Ze,_t as b}from"./runtime-Cj24N7je.js";import{Et as Qe,St as $e,T as et,t as tt}from"./runtime-CArTL2GH.js";import{i as x}from"./toast-B3hjhWRf.js";import{f as S,h as C,m as nt,u as rt}from"./server-Vynm5NwP.js";import{i as it,n as at,s as ot,t as st}from"./session-DyiiEN5g.js";import{t as ct}from"./use-atom-command-D34CFqu3.js";import{B as lt,C as ut,M as dt,N as ft,O as pt,P as mt,S as ht,_ as gt,b as _t,c as vt,i as w,n as T,o as yt,r as bt,y as xt,z as St}from"./themePalette-CLR_iiPi.js";var E=e(t(),1),D=fe();function Ct(e,t){if(e.size!==t.size)return!1;for(let[n,r]of e)if(t.get(n)!==r)return!1;return!0}function wt(e){let t=Be(t=>y(n=>{let r=n(e.catalogValueAtom).entries.get(t);if(r===void 0)return null;let i=ne(u(n(e.stateAtom(t))),()=>Ye);return{entry:r,connection:r.unsupportedReason===void 0?Qe(i):{phase:`unsupported`,error:r.unsupportedReason,traceId:null},serverConfig:n(e.serverConfigValueAtom(t))}}).pipe(h(`environment-presentation:${t}`))),n=new Map;return{presentationAtom:t,presentationsAtom:y(r=>{let i=new Map;for(let n of r(e.catalogValueAtom).entries.keys()){let e=r(t(n));e!==null&&i.set(n,e)}return Ct(n,i)||(n=i),n}).pipe(h(`environment-presentations`))}}function Tt(e,t){return{environmentId:e,environmentLabel:t.entry.target.label,displayUrl:$e(t.entry)??``,isRelayManaged:Ge(t.entry),isEnabled:t.entry.enabled,connectionState:t.connection.phase,connectionError:t.connection.error,connectionErrorTraceId:t.connection.traceId}}function Et(e){let t=y(t=>{let n=[...t(e.catalogValueAtom).entries.keys()],r=m(t.self());return r!==null&&r.length===n.length&&n.every((e,t)=>e===r[t])?r:n}),n=y(t=>{let n=[...t(e.catalogValueAtom).entries].map(([e,t])=>({environmentId:e,label:t.target.label})),r=m(t.self());return r!==null&&r.length===n.length&&n.every((e,t)=>e.environmentId===r[t]?.environmentId&&e.label===r[t]?.label)?r:n}),r=Be(t=>y(n=>{let r=n(e.presentationAtom(t));if(r===null)return null;let i=Tt(t,r),a=m(n.self());return a!==null&&a.environmentId===i.environmentId&&a.environmentLabel===i.environmentLabel&&a.displayUrl===i.displayUrl&&a.isRelayManaged===i.isRelayManaged&&a.isEnabled===i.isEnabled&&a.connectionState===i.connectionState&&a.connectionError===i.connectionError&&a.connectionErrorTraceId===i.connectionErrorTraceId?a:i})),i=y(t=>{let n=[];for(let i of t(e.catalogValueAtom).entries.keys()){let e=t(r(i));e!==null&&n.push(e)}let i=m(t.self());return i!==null&&i.length===n.length&&n.every((e,t)=>e===i[t])?i:n}).pipe(h(`environment-connection-summaries`));return{environmentIdsAtom:t,connectedEnvironmentIdsAtom:y(e=>{let n=e(t).filter(t=>e(r(t))?.connectionState===`connected`),i=m(e.self());return i!==null&&i.length===n.length&&n.every((e,t)=>e===i[t])?i:n}),identitiesAtom:n,environmentsAtom:i,machineByIdAtom:y(n=>{let r=new Map(n(t).map(t=>[t,me(n(e.presentationAtom(t))?.serverConfig??null)])),i=m(n.self());return i!==null&&Ct(i,r)?i:r}),pullRequestsSupportedAtom:y(n=>n(t).some(t=>n(e.presentationAtom(t))?.serverConfig?.environment.capabilities.pullRequests===!0))}}var Dt=wt({catalogValueAtom:C.catalogValueAtom,stateAtom:C.stateAtom,serverConfigValueAtom:S.configValueAtom}),Ot=Et({catalogValueAtom:C.catalogValueAtom,presentationAtom:Dt.presentationAtom}),kt=y(null).pipe(h(`web-environment-presentation:empty`));function At(e){let t=(0,D.c)(5),r=n(C.catalogValueAtom),i;t[0]===e?i=t[1]:(i=e===null?kt:Dt.presentationAtom(e),t[0]=e,t[1]=i);let a=n(i),o;return t[2]!==r.isReady||t[3]!==a?(o={isReady:r.isReady,presentation:a},t[2]=r.isReady,t[3]=a,t[4]=o):o=t[4],o}var jt={status:`idle`},O=jt,k=null,A=[],j=0,Mt=new Set;function M(e){O=e;for(let e of Mt)e()}function Nt(e){k?.resolve(e);for(let t of A)t.resolve(e);k=null,A=[]}function Pt(){return O}function Ft(e){return Mt.add(e),()=>{Mt.delete(e)}}function It(){j+=1;let e=!0;return()=>{e&&(e=!1,j=Math.max(0,j-1),j===0&&(Nt(!1),M(jt)))}}function Lt(e,t){if(j!==0)return new Promise(n=>{let r={message:e,variant:t?.variant??`default`,resolve:n};if(k||O.status===`closing`){A.push(r);return}k=r,M({status:`confirming`,message:e,variant:r.variant})})}function Rt(){return O.status!==`idle`||k!==null||A.length>0}function zt(e){if(O.status!==`confirming`||!k)return;let t=k;k=null,t.resolve(e),M({status:`closing`,message:O.message,variant:O.variant})}function Bt(){if(O.status!==`closing`)return;let e=A.shift();if(!e){M(jt);return}k=e,M({status:`confirming`,message:e.message,variant:e.variant})}var Vt={Ctrl:`⌃`,Alt:`⌥`,Shift:`⇧`,Super:`⌘`,CmdOrCtrl:`⌘`};function Ht(e,t=navigator.platform){let n=e.split(`+`),r=n.pop()??``;return ke(t)?`${n.map(e=>Vt[e]??e).join(``)}${r}`:[...n.map(e=>e===`CmdOrCtrl`?`Ctrl`:e===`Super`?`Meta`:e),r].join(`+`)}var Ut=`http://www.w3.org/2000/svg`,Wt={archive:[{tag:`rect`,attrs:{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`}},{tag:`path`,attrs:{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`}},{tag:`path`,attrs:{d:`M10 12h4`}}],check:[{tag:`path`,attrs:{d:`M20 6 9 17l-5-5`}}],timer:[{tag:`line`,attrs:{x1:`10`,x2:`14`,y1:`2`,y2:`2`}},{tag:`line`,attrs:{x1:`12`,x2:`15`,y1:`14`,y2:`11`}},{tag:`circle`,attrs:{cx:`12`,cy:`14`,r:`8`}}],"chevron-right":[{tag:`path`,attrs:{d:`m9 19 7-7-7-7`}}],"circle-check":[{tag:`circle`,attrs:{cx:`12`,cy:`12`,r:`10`}},{tag:`path`,attrs:{d:`m9 12 2 2 4-4`}}],clock:[{tag:`path`,attrs:{d:`M12 6v6l4 2`}},{tag:`circle`,attrs:{cx:`12`,cy:`12`,r:`10`}}],pencil:[{tag:`path`,attrs:{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`}},{tag:`path`,attrs:{d:`m15 5 4 4`}}],copy:[{tag:`rect`,attrs:{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}},{tag:`path`,attrs:{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`}}],folder:[{tag:`path`,attrs:{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`}}],"git-branch":[{tag:`line`,attrs:{x1:`6`,x2:`6`,y1:`3`,y2:`15`}},{tag:`circle`,attrs:{cx:`18`,cy:`6`,r:`3`}},{tag:`circle`,attrs:{cx:`6`,cy:`18`,r:`3`}},{tag:`path`,attrs:{d:`M18 9a9 9 0 0 1-9 9`}}],eye:[{tag:`path`,attrs:{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`}},{tag:`circle`,attrs:{cx:`12`,cy:`12`,r:`3`}}],"app-window":[{tag:`rect`,attrs:{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`}},{tag:`path`,attrs:{d:`M10 4v4`}},{tag:`path`,attrs:{d:`M2 8h20`}},{tag:`path`,attrs:{d:`M6 4v4`}}],"arrow-up-right":[{tag:`path`,attrs:{d:`M7 7h10v10`}},{tag:`path`,attrs:{d:`M7 17 17 7`}}],"external-link":[{tag:`path`,attrs:{d:`M15 3h6v6`}},{tag:`path`,attrs:{d:`M10 14 21 3`}},{tag:`path`,attrs:{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`}}],link:[{tag:`path`,attrs:{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`}},{tag:`path`,attrs:{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`}}],list:[{tag:`path`,attrs:{d:`M3 5h.01`}},{tag:`path`,attrs:{d:`M3 12h.01`}},{tag:`path`,attrs:{d:`M3 19h.01`}},{tag:`path`,attrs:{d:`M8 5h13`}},{tag:`path`,attrs:{d:`M8 12h13`}},{tag:`path`,attrs:{d:`M8 19h13`}}],share:[{tag:`path`,attrs:{d:`M12 2v13`}},{tag:`path`,attrs:{d:`m16 6-4-4-4 4`}},{tag:`path`,attrs:{d:`M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8`}}],x:[{tag:`path`,attrs:{d:`M18 6 6 18`}},{tag:`path`,attrs:{d:`m6 6 12 12`}}],hash:[{tag:`line`,attrs:{x1:`4`,x2:`20`,y1:`9`,y2:`9`}},{tag:`line`,attrs:{x1:`4`,x2:`20`,y1:`15`,y2:`15`}},{tag:`line`,attrs:{x1:`10`,x2:`8`,y1:`3`,y2:`21`}},{tag:`line`,attrs:{x1:`16`,x2:`14`,y1:`3`,y2:`21`}}],"mail-open":[{tag:`path`,attrs:{d:`M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z`}},{tag:`path`,attrs:{d:`m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10`}}],"message-square-plus":[{tag:`path`,attrs:{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`}},{tag:`path`,attrs:{d:`M12 8v6`}},{tag:`path`,attrs:{d:`M9 11h6`}}],pin:[{tag:`path`,attrs:{d:`M12 17v5`}},{tag:`path`,attrs:{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`}}],"pin-off":[{tag:`path`,attrs:{d:`M12 17v5`}},{tag:`path`,attrs:{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`}},{tag:`path`,attrs:{d:`m2 2 20 20`}},{tag:`path`,attrs:{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`}}],"refresh-cw":[{tag:`path`,attrs:{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`}},{tag:`path`,attrs:{d:`M21 3v5h-5`}},{tag:`path`,attrs:{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`}},{tag:`path`,attrs:{d:`M8 16H3v5`}}],settings:[{tag:`path`,attrs:{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.38a2 2 0 0 0-.73-2.73l-.15-.09a2 2 0 0 1-1-1.74v-.51a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`}},{tag:`circle`,attrs:{cx:`12`,cy:`12`,r:`3`}}],"folder-tree":[{tag:`path`,attrs:{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`}},{tag:`path`,attrs:{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`}},{tag:`path`,attrs:{d:`M3 5a2 2 0 0 0 2 2h3`}},{tag:`path`,attrs:{d:`M3 3v13a2 2 0 0 0 2 2h3`}}],trash:[{tag:`path`,attrs:{d:`M3 6h18`}},{tag:`path`,attrs:{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}},{tag:`path`,attrs:{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`}},{tag:`line`,attrs:{x1:`10`,x2:`10`,y1:`11`,y2:`17`}},{tag:`line`,attrs:{x1:`14`,x2:`14`,y1:`11`,y2:`17`}}]};function Gt(e,t){let n=Wt[e];if(!n||typeof document.createElementNS!=`function`)return null;let r=document.createElementNS(Ut,`svg`);r.setAttribute(`xmlns`,Ut),r.setAttribute(`viewBox`,`0 0 24 24`),r.setAttribute(`fill`,`none`),r.setAttribute(`stroke`,`currentColor`),r.setAttribute(`stroke-width`,`2`),r.setAttribute(`stroke-linecap`,`round`),r.setAttribute(`stroke-linejoin`,`round`),r.setAttribute(`class`,t===`destructive`?`size-4.5 shrink-0 sm:size-4`:`size-4.5 shrink-0 text-muted-foreground sm:size-4`);for(let e of n){let t=document.createElementNS(Ut,e.tag);for(let[n,r]of Object.entries(e.attrs))t.setAttribute(n,r);r.appendChild(t)}return r}function Kt(e,t,n){let r=e.getBoundingClientRect(),i=Math.min(Math.max(4,t),Math.max(4,window.innerWidth-r.width-4)),a=Math.min(Math.max(4,n),Math.max(4,window.innerHeight-r.height-4));e.style.left=`${i}px`,e.style.top=`${a}px`}function qt(e,t){if(typeof Node<`u`&&e instanceof Node)return t.some(t=>t.contains(e));if(!e||typeof e!=`object`)return!1;let n=e;for(;n&&typeof n==`object`;){if(t.includes(n))return!0;n=n.parent}return!1}var N=null;function Jt(){return N!==null}function Yt(){N?.(),N=null}function Xt(e,t){return new Promise(n=>{let r=document.activeElement instanceof HTMLElement?document.activeElement:null,i=[],a=[],o=!1,s=!1,c=()=>l(null),l=e=>{if(o)return;o=!0,N===c&&(N=null),document.removeEventListener(`keydown`,u),document.removeEventListener(`pointerdown`,d,!0),document.removeEventListener(`contextmenu`,f,!0);let t=qt(document.activeElement,i);for(let e of i)e.remove();t&&r?.isConnected&&r.focus({preventScroll:!0}),n(e)},u=e=>{e.key===`Escape`&&(e.preventDefault(),l(null))},d=e=>{s&&!qt(e.target,i)&&l(null)},f=e=>{s&&!qt(e.target,i)&&(e.preventDefault(),l(null))},p=e=>{for(;i.length>e;)a.pop()?.setAttribute(`aria-expanded`,`false`),i.pop()?.remove()},ee=(e,t,n,r,o)=>{p(r);let c=document.createElement(`div`);c.className=`dropdown-glass fixed z-[10000] min-w-56 max-w-sm overflow-hidden rounded-lg bg-clip-padding text-popover-foreground outline-none`,c.style.cssText=`position:fixed;z-index:10000;min-width:14rem;max-width:24rem;overflow:hidden;border-radius:var(--radius-lg);background-clip:padding-box;color:var(--contrast-popover-foreground);outline:none;pointer-events:auto;`,c.style.left=`${t}px`,c.style.top=`${n}px`,c.dataset.level=String(r);let u=document.createElement(`div`);u.className=`max-h-[calc(100vh-0.5rem)] min-w-0 max-w-sm overflow-y-auto overflow-x-hidden p-1`,u.style.cssText=`max-height:calc(100vh - 0.5rem);min-width:0;max-width:24rem;overflow-x:hidden;overflow-y:auto;padding:0.25rem;`;for(let t of e){if(t.separatorBefore===!0&&u.children.length>0){let e=document.createElement(`div`);e.className=`mx-2 my-1 h-px bg-border`,e.style.cssText=`height:1px;margin:0.25rem 0.5rem;background:var(--contrast-border);`,e.dataset.contextMenuSeparator=`true`,e.setAttribute(`role`,`separator`),u.appendChild(e)}if(t.header===!0){let e=document.createElement(`div`);e.className=`px-2 py-1.5 font-medium text-muted-foreground text-xs`,e.textContent=t.label,u.appendChild(e);continue}let e=Array.isArray(t.children)&&t.children.length>0,n=!e&&(t.destructive===!0||t.id===`delete`),a=document.createElement(`button`);a.type=`button`;let o=t.disabled===!0;a.disabled=o;let c=`flex w-full cursor-default select-none items-center gap-2 rounded-sm px-2 py-1 text-left outline-none transition-colors sm:min-h-7 sm:text-sm min-h-8 text-base`;if(a.className=o?`${c} pointer-events-none cursor-not-allowed text-muted-foreground opacity-64`:n?`${c} text-destructive-foreground hover:bg-destructive/10 hover:text-destructive-foreground`:`${c} text-foreground hover:bg-accent hover:text-accent-foreground`,a.style.cssText=`display:flex;width:100%;min-height:1.75rem;align-items:center;gap:0.5rem;border:0;border-radius:var(--radius-sm);background:transparent;padding:0.25rem 0.5rem;color:var(--contrast-foreground);font-family:var(--font-sans,system-ui,sans-serif);font-size:0.875rem;line-height:1.25rem;text-align:left;cursor:default;`,n&&(a.style.color=`var(--destructive-foreground)`),o&&(a.style.color=`var(--contrast-muted-foreground)`,a.style.opacity=`0.64`,a.style.pointerEvents=`none`),typeof t.checked==`boolean`){a.setAttribute(`role`,`menuitemradio`),a.setAttribute(`aria-checked`,t.checked?`true`:`false`);let e=t.checked?Gt(`check`,`neutral`):null;if(e)a.appendChild(e);else{let e=document.createElement(`span`);e.className=`size-4.5 shrink-0 sm:size-4`,e.style.cssText=`display:inline-block;width:1rem;height:1rem;flex-shrink:0;`,e.setAttribute(`aria-hidden`,`true`),a.appendChild(e)}}else if(typeof t.icon==`string`){let e=Gt(t.icon,n?`destructive`:`neutral`);e&&a.appendChild(e)}let d=document.createElement(`span`);if(d.className=`min-w-0 flex-1 truncate`,d.textContent=t.label,a.appendChild(d),typeof t.accelerator==`string`){let e=document.createElement(`span`);e.className=`ms-6 shrink-0 text-muted-foreground text-xs tracking-widest`,e.style.cssText=`margin-inline-start:1.5rem;flex-shrink:0;color:var(--contrast-muted-foreground);font-size:0.75rem;letter-spacing:0.1em;`,e.textContent=Ht(t.accelerator),e.setAttribute(`aria-hidden`,`true`),a.setAttribute(`aria-keyshortcuts`,t.accelerator.replace(`CmdOrCtrl`,ke(navigator.platform)?`Meta`:`Control`)),a.appendChild(e)}if(e){a.setAttribute(`aria-haspopup`,`menu`),a.setAttribute(`aria-expanded`,`false`);let e=Gt(`chevron-right`,`neutral`);e&&(e.setAttribute(`class`,`-me-0.5 ms-auto size-4.5 shrink-0 text-muted-foreground opacity-80 sm:size-4`),e.setAttribute(`aria-hidden`,`true`),e.dataset.contextMenuChevron=`true`,a.appendChild(e))}if(!o){let o=!1,c=!1,u=()=>{let e=o||c;a.style.background=e?n?`color-mix(in srgb, var(--destructive) 10%, transparent)`:`var(--accent)`:`transparent`,a.style.color=e?n?`var(--destructive-foreground)`:`var(--contrast-accent-foreground)`:n?`var(--destructive-foreground)`:`var(--contrast-foreground)`};if(a.addEventListener(`mouseenter`,()=>{a.focus({preventScroll:!0}),o=!0,u()}),a.addEventListener(`mouseleave`,()=>{o=!1,u()}),a.addEventListener(`focus`,()=>{c=!0,u()}),a.addEventListener(`blur`,()=>{c=!1,u()}),e){let e=(e=!1)=>{let n=a.getBoundingClientRect(),o=n.right+4,s=n.top;ee(t.children,o,s,r+1,a),a.setAttribute(`aria-expanded`,`true`);let c=i[r+1];if(!c)return;let l=c.getBoundingClientRect();l.right>window.innerWidth&&Kt(c,n.left-l.width-4,n.top),e&&[...c.querySelectorAll(`button`)].find(e=>!e.disabled)?.focus()};a.addEventListener(`mouseenter`,()=>{e()}),a.addEventListener(`click`,t=>{t.preventDefault(),e(!0)})}else a.addEventListener(`mouseenter`,()=>{p(r+1)}),a.addEventListener(`click`,()=>{s&&l(t.id)})}u.appendChild(a)}c.appendChild(u),c.addEventListener(`mouseenter`,()=>{p(r+1)}),document.body.appendChild(c),i[r]=c,a[r]=o,requestAnimationFrame(()=>{Kt(c,t,n)})};document.addEventListener(`keydown`,u),document.addEventListener(`pointerdown`,d,!0),document.addEventListener(`contextmenu`,f,!0),ee(e,t?.x??0,t?.y??0,0),N&&N(),N=c,requestAnimationFrame(()=>{s=!0})})}var Zt=`p4code:client-settings:v1`;function Qt(){return typeof window<`u`}function $t(){return Qt()?c(Zt,Le):null}function en(e){Qt()&&je(Zt,e,Le)}var tn;function nn(){return{dialogs:{pickFolder:async e=>window.desktopBridge?window.desktopBridge.pickFolder(e):null,confirm:async(e,t)=>Lt(e,t)??!1},shell:{openExternal:async e=>{if(window.desktopBridge){if(!await window.desktopBridge.openExternal(e))throw Error(`Unable to open link.`);return}window.open(e,`_blank`,`noopener,noreferrer`)},openSystemSettings:async e=>{if(!window.desktopBridge?.openSystemSettings||!await window.desktopBridge.openSystemSettings(e))throw Error(`Unable to open System Settings.`)}},contextMenu:{show:async(e,t)=>window.desktopBridge?window.desktopBridge.showContextMenu(e,t):Xt(e,t),close:async()=>{window.desktopBridge||Yt()}},persistence:{getClientSettings:async()=>window.desktopBridge?window.desktopBridge.getClientSettings():$t(),setClientSettings:async e=>{if(window.desktopBridge)return window.desktopBridge.setClientSettings(e);en(e)}}}}function rn(){return nn()}function an(){if(typeof window<`u`)return tn||(tn=rn(),tn)}function on(){let e=an();if(!e)throw Error(`Local API not found`);return e}var P=`p4code:theme`,sn=`(prefers-color-scheme: dark)`,F={theme:`system`,resolvedTheme:`light`,systemDark:!1,followSystem:!0,appearanceMode:`system`,themeHalves:null};function cn(){return I()}function ln(){return typeof window>`u`?{}:un()}function I(){if(typeof window>`u`)return null;try{return pt(window.localStorage.getItem(w))}catch{return null}}function un(){try{let e=JSON.parse(window.localStorage.getItem(`p4code:theme-halves:v1`)??`null`);if(typeof e!=`object`||!e)return{};let t={};for(let n of[`light`,`dark`]){let r=e[n];typeof r==`string`&&(t[n]=r)}return t}catch{return{}}}function dn(e){return`${e?.light??``}|${e?.dark??``}`}var fn=`theme-color`,pn=`meta[name="${fn}"][data-dynamic-theme-color="true"]`,L=class extends d()(`ThemeStorageError`,{operation:ae([`read`,`write`]),storageKey:ge,theme:we(yt),cause:ce()}){get message(){return`Failed to ${this.operation} theme preference for ${this.storageKey}.`}},mn=Ne(L),hn=class extends d()(`DesktopThemeSyncError`,{theme:yt,cause:ce()}){get message(){return`Failed to sync the ${this.theme} theme to the desktop shell.`}},gn=Ne(hn),R=[],z=null,_n=!0,vn=null,B=null,V=null;function H(){_n=!0;for(let e of R)e()}function yn(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(sn).matches}function bn(e){if(typeof window>`u`)return e===`system`;try{let e=window.localStorage.getItem(bt);if(e===`true`)return!0;if(e===`false`)return!1}catch{}return e===`system`}function xn(e){return e===`light`||e===`dark`||e===`system`}function U(e){if(typeof window<`u`)try{let e=window.localStorage.getItem(T);if(xn(e))return e}catch{}return bn(e)?`system`:xt(e)??`light`}function Sn(e){if(typeof window<`u`)try{window.localStorage.setItem(T,e)}catch(e){throw new L({operation:`write`,storageKey:T,cause:e})}}function Cn(){if(typeof window>`u`)return F.theme;let e;try{e=window.localStorage.getItem(P)}catch(e){throw new L({operation:`read`,storageKey:P,cause:e})}return e!==null&&ut(e)?e:F.theme}function wn(e){if(typeof window<`u`)try{window.localStorage.setItem(P,e),V=null}catch(t){throw new L({operation:`write`,storageKey:P,theme:e,cause:t})}}function W(){if(V!==null)return F.theme;try{return Cn()}catch(e){let t=mn(e)?e:new L({operation:`read`,storageKey:P,cause:e});return V=t,console.error(t.message,{operation:t.operation,storageKey:t.storageKey,...b(t)}),F.theme}}function Tn(){let e=document.querySelector(pn);return e||(e=document.createElement(`meta`),e.name=fn,e.setAttribute(`data-dynamic-theme-color`,`true`),document.head.append(e),e)}function En(e){let t=e?.trim().toLowerCase();return!t||t===`transparent`||t===`rgba(0, 0, 0, 0)`||t===`rgba(0 0 0 / 0)`?null:e?.trim()??null}function Dn(){return document.querySelector(`main[data-slot='sidebar-inset']`)??document.querySelector(`[data-slot='sidebar-inner']`)??document.body}function On(){if(typeof document>`u`||typeof getComputedStyle>`u`)return;let e=getComputedStyle(document.documentElement),t=document.documentElement.dataset.themeId?En(e.getPropertyValue(`--app-chrome-background`)):null,n=En(getComputedStyle(Dn()).backgroundColor),r=En(getComputedStyle(document.body).backgroundColor),i=t??n??r;if(!i)return;document.documentElement.style.backgroundColor=i,document.body.style.backgroundColor=i;let a=document.querySelectorAll(`meta[name="${fn}"]`);if(a.length===0){Tn().setAttribute(`content`,i);return}for(let e of a)e.setAttribute(`content`,i)}function G(e,{suppressTransitions:t=!1,preservePreview:n=!0}={}){if(typeof document>`u`||typeof window>`u`||n&&document.documentElement.dataset?.themeId===`__preview`)return;let r=U(e),i=r===`system`,a=i?yn():!1,o=I();if(B?.theme===e&&B.systemDark===a&&B.followSystem===i&&B.appearanceMode===r&&dn(B.themeHalves)===dn(o)){An(e,i,r);return}t&&document.documentElement.classList.add(`no-transitions`);let s=ft(e,a,i,r,o);vt(mt(e,o,s),s),document.documentElement.classList.toggle(`dark`,s===`dark`),B={theme:e,systemDark:a,followSystem:i,appearanceMode:r,themeHalves:o},On(),An(e,i,r),t&&(document.documentElement.offsetHeight,requestAnimationFrame(()=>{document.documentElement.classList.remove(`no-transitions`)}))}async function kn(e,t,n,r,i=I()){try{await e.setTheme(dt(t,n,r,i))}catch(e){throw new hn({theme:t,cause:e})}}function An(e,t,n){if(typeof window>`u`)return;let r=window.desktopBridge,i=I(),a=dt(e,t,n,i);r&&typeof r.setTheme==`function`&&vn!==a&&(vn=a,kn(r,e,t,n,i).catch(t=>{let n=gn(t)?t:new hn({theme:e,cause:t});console.error(n.message,{theme:n.theme,...b(n)}),vn===a&&(vn=null)}))}typeof document<`u`&&typeof window<`u`&&G(W());function jn(){if(typeof window>`u`)return F;if(!_n&&z)return z;_n=!1;let e=W(),t=U(e),n=t===`system`,r=n?yn():!1,i=I(),a=ft(e,r,n,t,i);return z&&z.theme===e&&z.resolvedTheme===a&&z.systemDark===r&&z.followSystem===n&&z.appearanceMode===t&&dn(z.themeHalves)===dn(i)||(z={theme:e,resolvedTheme:a,systemDark:r,followSystem:n,appearanceMode:t,themeHalves:i}),z}function Mn(){return F}function Nn(){let e=W();U(e)===`system`&&G(e,{suppressTransitions:!0}),H()}function Pn(e){e.key===P?(V=null,G(W(),{suppressTransitions:!0}),H()):e.key===`p4code:theme-follow-system`||e.key===`p4code:theme-appearance-mode`||e.key===`p4code:theme-halves:v1`?(G(W(),{suppressTransitions:!0}),H()):(e.key===`p4code:themes:v1`||e.key===null)&&(e.key===null&&(V=null),ht(),B=null,G(W(),{suppressTransitions:!0}),H())}var Fn=null;function In(e){if(typeof window>`u`)return()=>{};if(R.push(e),!Fn){let e=typeof window.matchMedia==`function`?window.matchMedia(sn):null;e?.addEventListener(`change`,Nn),window.addEventListener(`storage`,Pn),Fn=()=>{e?.removeEventListener(`change`,Nn),window.removeEventListener(`storage`,Pn)}}return()=>{R=R.filter(t=>t!==e),R.length===0&&(Fn?.(),Fn=null)}}function Ln(){let e=(0,E.useSyncExternalStore)(In,jn,Mn),{theme:t,resolvedTheme:n}=e,r=(0,E.useCallback)(e=>{if(typeof window>`u`)return!1;try{Sn(U(W()));let t=window.localStorage.getItem(w);window.localStorage.removeItem(w);try{wn(e)}catch(e){if(t!==null)try{window.localStorage.setItem(w,t)}catch{}throw e}}catch(t){let n=mn(t)?t:new L({operation:`write`,storageKey:P,theme:e,cause:t});return console.error(n.message,{operation:n.operation,storageKey:n.storageKey,theme:e,...b(n)}),!1}return G(e,{suppressTransitions:!0}),H(),!0},[]),i=(0,E.useCallback)(e=>{if(typeof window>`u`)return!1;try{Sn(e)}catch(e){let t=mn(e)?e:new L({operation:`write`,storageKey:T,cause:e});return console.error(t.message,{operation:t.operation,storageKey:t.storageKey,...b(t)}),!1}return V=null,G(W(),{suppressTransitions:!0}),H(),!0},[]),a=(0,E.useCallback)(e=>{let n=U(t),r=e?`system`:n===`system`?xt(t)??`light`:n;return i(r)},[i,t]),o=(0,E.useCallback)((e,t)=>{if(typeof window>`u`)return!1;try{let n={...un()};t===null?delete n[e]:n[e]=t,n.light===void 0&&n.dark===void 0?window.localStorage.removeItem(w):window.localStorage.setItem(w,JSON.stringify(n))}catch(e){let t=new L({operation:`write`,storageKey:w,cause:e});return console.error(t.message,{operation:t.operation,storageKey:t.storageKey,...b(t)}),!1}return G(W(),{suppressTransitions:!0}),H(),!0},[]),s=(0,E.useCallback)(()=>{if(typeof window>`u`)return!1;try{window.localStorage.removeItem(w)}catch(e){let t=new L({operation:`write`,storageKey:w,cause:e});return console.error(t.message,{operation:t.operation,storageKey:t.storageKey,...b(t)}),!1}return G(W(),{suppressTransitions:!0}),H(),!0},[]),c=(0,E.useCallback)(({preservePreview:e=!1}={})=>{typeof window<`u`&&(B=null,G(W(),{suppressTransitions:!0,preservePreview:e}),H())},[]);return(0,E.useEffect)(()=>{G(t)},[e.appearanceMode,t]),{theme:t,setTheme:r,setAppearanceMode:i,setFollowSystem:a,setThemeHalf:o,clearThemeHalves:s,refreshTheme:c,followSystem:e.followSystem,appearanceMode:e.appearanceMode,resolvedTheme:n,themeHalves:e.themeHalves}}var Rn=de(Se(_e)),zn=i(e=>{let t=e.replace(/("(?:[^"\\]|\\.)*")|\/\/[^\n]*/g,(e,t)=>t?e:``);return t=t.replace(/("(?:[^"\\]|\\.)*")|\/\*[\s\S]*?\*\//g,(e,t)=>t?e:``),t=t.replace(/("(?:[^"\\]|\\.)*")|,(\s*[}\]])/g,(e,t,n)=>t?e:n??``),Rn(t).pipe(Ie(e=>e.issue))}),Bn=new le(zn,We());re().pipe(te(We({space:2})));var Vn=e=>ge.pipe(Fe(e,Bn)),Hn={performance:{profile:`performance`,automaticGitFetchInterval:v(15),providerHealthRefreshInterval:g(1),hostPowerMonitorActiveInterval:v(30),hostPowerMonitorIdleInterval:g(2),idleClientTtl:v(45),pauseWhenHostLocked:!0,pauseWhenHostLowPower:!1,pauseWhenClientLowPower:!1,pauseWhenOnBattery:!1},balanced:{profile:`balanced`,automaticGitFetchInterval:Pe,providerHealthRefreshInterval:Ee,hostPowerMonitorActiveInterval:v(30),hostPowerMonitorIdleInterval:g(5),idleClientTtl:v(45),pauseWhenHostLocked:!0,pauseWhenHostLowPower:!0,pauseWhenClientLowPower:!0,pauseWhenOnBattery:!1},"battery-saver":{profile:`battery-saver`,automaticGitFetchInterval:v(0),providerHealthRefreshInterval:g(15),hostPowerMonitorActiveInterval:g(1),hostPowerMonitorIdleInterval:g(10),idleClientTtl:v(45),pauseWhenHostLocked:!0,pauseWhenHostLowPower:!0,pauseWhenClientLowPower:!0,pauseWhenOnBattery:!0}};function K(e){return Hn[e]}function Un(e){return e.profile===`custom`?e.baseProfile??`balanced`:e.profile}function Wn(e){let t=Un(e),n=Hn[t],r=e.profile===`custom`?e.overrides:{};return{profile:t,automaticGitFetchInterval:r.automaticGitFetchInterval??n.automaticGitFetchInterval,providerHealthRefreshInterval:r.providerHealthRefreshInterval??n.providerHealthRefreshInterval,hostPowerMonitorActiveInterval:r.hostPowerMonitorActiveInterval??n.hostPowerMonitorActiveInterval,hostPowerMonitorIdleInterval:r.hostPowerMonitorIdleInterval??n.hostPowerMonitorIdleInterval,idleClientTtl:r.idleClientTtl??n.idleClientTtl,pauseWhenHostLocked:r.pauseWhenHostLocked??n.pauseWhenHostLocked,pauseWhenHostLowPower:r.pauseWhenHostLowPower??n.pauseWhenHostLowPower,pauseWhenClientLowPower:r.pauseWhenClientLowPower??n.pauseWhenClientLowPower,pauseWhenOnBattery:r.pauseWhenOnBattery??n.pauseWhenOnBattery}}function q(e,t){return _(e)===_(t)}function Gn(e,t){return q(e.automaticGitFetchInterval,t.automaticGitFetchInterval)&&q(e.providerHealthRefreshInterval,t.providerHealthRefreshInterval)&&q(e.hostPowerMonitorActiveInterval,t.hostPowerMonitorActiveInterval)&&q(e.hostPowerMonitorIdleInterval,t.hostPowerMonitorIdleInterval)&&q(e.idleClientTtl,t.idleClientTtl)&&e.pauseWhenHostLocked===t.pauseWhenHostLocked&&e.pauseWhenHostLowPower===t.pauseWhenHostLowPower&&e.pauseWhenClientLowPower===t.pauseWhenClientLowPower&&e.pauseWhenOnBattery===t.pauseWhenOnBattery}function Kn(e){if(e.profile!==`custom`)return{schemaVersion:1,profile:e.profile,overrides:{}};let t=Wn(e),n=[Un(e),`balanced`,`performance`,`battery-saver`];for(let e of n)if(Gn(t,Hn[e]))return{schemaVersion:1,profile:e,overrides:{}};let r=Un(e),i=Hn[r];return{schemaVersion:1,profile:`custom`,baseProfile:r,overrides:{...q(t.automaticGitFetchInterval,i.automaticGitFetchInterval)?{}:{automaticGitFetchInterval:t.automaticGitFetchInterval},...q(t.providerHealthRefreshInterval,i.providerHealthRefreshInterval)?{}:{providerHealthRefreshInterval:t.providerHealthRefreshInterval},...q(t.hostPowerMonitorActiveInterval,i.hostPowerMonitorActiveInterval)?{}:{hostPowerMonitorActiveInterval:t.hostPowerMonitorActiveInterval},...q(t.hostPowerMonitorIdleInterval,i.hostPowerMonitorIdleInterval)?{}:{hostPowerMonitorIdleInterval:t.hostPowerMonitorIdleInterval},...q(t.idleClientTtl,i.idleClientTtl)?{}:{idleClientTtl:t.idleClientTtl},...t.pauseWhenHostLocked===i.pauseWhenHostLocked?{}:{pauseWhenHostLocked:t.pauseWhenHostLocked},...t.pauseWhenHostLowPower===i.pauseWhenHostLowPower?{}:{pauseWhenHostLowPower:t.pauseWhenHostLowPower},...t.pauseWhenClientLowPower===i.pauseWhenClientLowPower?{}:{pauseWhenClientLowPower:t.pauseWhenClientLowPower},...t.pauseWhenOnBattery===i.pauseWhenOnBattery?{}:{pauseWhenOnBattery:t.pauseWhenOnBattery}}}}function qn(e){let t={schemaVersion:1,profile:Ve,overrides:{}},n=e.backgroundActivity.profile===t.profile&&e.backgroundActivity.baseProfile===void 0&&Object.keys(e.backgroundActivity.overrides).length===0,r=e.backgroundActivityProfile,i=r!==`balanced`||_(e.automaticGitFetchInterval)!==_(Pe)||_(e.providerHealthRefreshInterval)!==_(Ee);return Wn(n&&i?{schemaVersion:1,profile:_(e.automaticGitFetchInterval)===_(K(r).automaticGitFetchInterval)&&_(e.providerHealthRefreshInterval)===_(K(r).providerHealthRefreshInterval)?r:`custom`,baseProfile:r,overrides:{..._(e.automaticGitFetchInterval)===_(K(r).automaticGitFetchInterval)?{}:{automaticGitFetchInterval:e.automaticGitFetchInterval},..._(e.providerHealthRefreshInterval)===_(K(r).providerHealthRefreshInterval)?{}:{providerHealthRefreshInterval:e.providerHealthRefreshInterval}}}:e.backgroundActivity)}function Jn(e){let t=qn(e);return Kn({schemaVersion:1,profile:`custom`,baseProfile:t.profile,overrides:{automaticGitFetchInterval:t.automaticGitFetchInterval,providerHealthRefreshInterval:t.providerHealthRefreshInterval,hostPowerMonitorActiveInterval:t.hostPowerMonitorActiveInterval,hostPowerMonitorIdleInterval:t.hostPowerMonitorIdleInterval,idleClientTtl:t.idleClientTtl,pauseWhenHostLocked:t.pauseWhenHostLocked,pauseWhenHostLowPower:t.pauseWhenHostLowPower,pauseWhenClientLowPower:t.pauseWhenClientLowPower,pauseWhenOnBattery:t.pauseWhenOnBattery}})}var Yn=Vn(ye);Oe(Yn);function Xn(e,t){let n=e.providerInstances[t.instanceId];return n===void 0?he(t.instanceId):r(n)}var Zn=[`codex`,`claudeAgent`,`cursor`,`grok`,`muse`,`pi`,`opencode`,`antigravity`].map(e=>ze.make(e));function Qn(e,t,n){let r=[...Zn.map(e=>[Me(e),e]),...n?.includeConfiguredInstances===!0?Object.entries(e).flatMap(([e,t])=>Zn.includes(t.driver)?[[xe.make(e),t.driver]]:[]):[]].find(([e,n])=>t(e,n));if(r===void 0)return null;let[i,o]=r,s=n?.defaultModelSelection,c=e[i]?.config;return s?.instanceId===i&&p(c?.customModels).some(e=>e.slug===s.model)?s:{instanceId:i,model:a[o]??pe[o]??`gpt-6-luna`}}function $n(e,t,n){let r=e.sourceControlWriterModelSelection;if(!r||!Ae(e,n,r.instanceId))return e.textGenerationModelSelection;if(t===void 0)return r;let i=t.find(e=>e.instanceId===r.instanceId);return i?.enabled===!0&&He(i)&&be(i)?r:e.textGenerationModelSelection}function er(e,t,n){let r=e.reviewGuideModelSelection;if(r&&Ae(e,n,r.instanceId)){let e=t?.find(e=>e.instanceId===r.instanceId);if(t===void 0||e?.enabled===!0&&He(e)&&be(e))return r}return $n(e,t,n)}function tr(e,t={}){return{favorites:e.favorites??t.favorites??[],providerModelPreferences:e.providerModelPreferences??t.providerModelPreferences??{}}}function nr(e,t){let n=e.favorites===null&&(t.favorites?.length??0)>0?t.favorites:void 0,r=e.providerModelPreferences===null&&Object.keys(t.providerModelPreferences??{}).length>0?t.providerModelPreferences:void 0;return n===void 0&&r===void 0?null:{migrateModelPreferences:{...n===void 0?{}:{favorites:n},...r===void 0?{}:{providerModelPreferences:r}}}}var rr=new Set([`continueThreadsAfterServerUpdate`,`sidebarAutoSettleAfterDays`,`sidebarAutoSettleOnMerge`,`autoResumeLimitedThreads`,`snoozeLimitedThreads`,`newWorktreesStartFromOrigin`,`sourceControlWritingStyle`,`textGenerationModelSelection`]);function ir(e){let t={},n={};for(let[r,i]of Object.entries(e))rr.has(r)?t[r]=i:n[r]=i;return{sharedPatch:t,localPatch:n}}function ar(e,t,n,r=n,i=!1){let a=e.textGenerationModelSelection?.instanceId??r?.textGenerationModelSelection.instanceId;return!i&&e.textGenerationModelSelection&&(!n||a!==void 0&&(r?.providerInstances[a]?.driver??a)!==(n.providerInstances[a]?.driver??a)||!Xn(n,{...n.textGenerationModelSelection,...e.textGenerationModelSelection}))&&(e=s(e,[`textGenerationModelSelection`])),t?.threadRestartContinuation===!0?e:s(e,[`continueThreadsAfterServerUpdate`])}function or(e){return e.connection.phase===`connected`&&e.serverConfig?.environment.capabilities.threadAutoSettlement===!0}function sr(e){let t=e.atom(ue(Ke.pipe(De(e=>Ue(e.state)))),{initialValue:Xe});return{stateAtom:t,stateValueAtom:y(e=>ne(u(e(t)),()=>Xe)).pipe(h(`relay-environment-discovery-value`)),refresh:qe(e,{label:`relay-environment-discovery:refresh`,concurrency:{mode:`singleFlight`,key:()=>`refresh`},execute:e=>Ke.pipe(ie(e=>e.refresh))})}}var cr=sr(tt);function lr(e,t){return{...t,environmentId:e,label:t.entry.target.label,displayUrl:$e(t.entry),relayManaged:Ge(t.entry)}}function ur(){let e=(0,D.c)(7),t=n(C.catalogValueAtom),r=n(C.networkStatusValueAtom),i=n(Dt.presentationsAtom),a;e[0]===i?a=e[1]:(a=[...i.entries()].map(dr),e[0]=i,e[1]=a);let o=a,s;return e[2]!==t.isReady||e[3]!==o||e[4]!==r||e[5]!==i?(s={isReady:t.isReady,networkStatus:r,environments:o,presentationById:i},e[2]=t.isReady,e[3]=o,e[4]=r,e[5]=i,e[6]=s):s=e[6],s}function dr(e){let[t,n]=e;return lr(t,n)}function fr(){return n(nt)}function pr(e){let t=(0,D.c)(3),{presentation:n}=At(e),r;return t[0]!==e||t[1]!==n?(r=e===null||n===null?null:lr(e,n),t[0]=e,t[1]=n,t[2]=r):r=t[2],r}function mr(){return pr(fr())}function hr(e){let t=(0,D.c)(2),n=ot(e),r;return t[0]===n?r=t[1]:(r=f(n)?n.value.httpBaseUrl:null,t[0]=n,t[1]=r),r}function gr(){return n(cr.stateValueAtom)}function _r(){return n(Ot.environmentIdsAtom)}function vr(){return n(Ot.identitiesAtom)}function yr(){return n(Ot.pullRequestsSupportedAtom)}var br=`[CLIENT_SETTINGS]`,xr=new Set,Sr=new Set,Cr=Re,J=`pending`,Y=null,wr=0,Tr=Promise.resolve(),Er=0;function Dr(){for(let e of xr)e()}function Or(){for(let e of Sr)e()}function X(){return Cr}function kr(e){Cr=e,Dr()}function Ar(e){J!==e&&(J=e,Or())}function jr(e){return xr.add(e),Z().catch(()=>void 0),()=>{xr.delete(e)}}function Mr(){return J===`ready`}function Nr(){return J}function Pr(e){return Sr.add(e),Z().catch(()=>void 0),()=>{Sr.delete(e)}}async function Z(){if(J===`ready`)return;if(Y)return Y;let e=wr;Ar(J===`failed`||J===`retrying`?`retrying`:`pending`);let t=(async()=>{try{let t=await on().persistence.getClientSettings();if(e!==wr)return;t&&kr({...Re,...t}),Ar(`ready`)}catch(t){throw e===wr&&Ar(`failed`),console.error(`${br} hydrate failed`,{operation:`hydrate`,...b(t)}),t}})().finally(()=>{Y===t&&(Y=null)});return Y=t,Y}var Fr=e=>on().persistence.setClientSettings(e);function Ir(e){let t=Tr.then(e);return Tr=t.then(()=>void 0,()=>void 0),t}function Lr(e,t=Fr){let n=J!==`ready`||Er>0;return n?Er+=1:kr({...X(),...e}),Ir(async()=>{if(n)try{J!==`ready`&&await Z(),kr({...X(),...e})}finally{--Er}await t(X())}).catch(e=>{console.error(`${br} persist failed`,{operation:`persist`,...b(e)})})}async function Rr(e,t=Fr){return Ir(async()=>{for(J!==`ready`&&await Z();;){let n=X(),r=e(n);if(await t(r),X()===n)return kr(r),r}})}var zr=new Set(l(ye.fields));function Br(e){let t={},n={};for(let[r,i]of Object.entries(e))zr.has(r)?t[r]=i:n[r]=i;return{serverPatch:t,clientPatch:n}}function Vr(){return X()}function Hr(){return Z()}function Ur(){return(0,E.useSyncExternalStore)(Pr,Mr,Wr)}function Wr(){return!1}function Gr(){return(0,E.useSyncExternalStore)(Pr,Nr,Kr)}function Kr(){return`pending`}function Q(){return(0,E.useSyncExternalStore)(jr,X,qr)}function qr(){return Re}function Jr(e,t){return{...t,...e,...tr(e,t)}}var Yr=new Set;function $(e,t){let n=(0,D.c)(8),r=Q(),i=Ur(),a;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={reportFailure:!1},n[0]=a):a=n[0];let o=ct(S.updateSettings,a),s,c;n[1]!==r||n[2]!==e||n[3]!==i||n[4]!==o||n[5]!==t?(s=()=>{if(!e||!t||!i||Yr.has(e))return;let n=nr(t,r);n&&(Yr.add(e),o({environmentId:e,input:{patch:n}}).finally(()=>Yr.delete(e)))},c=[r,e,i,o,t],n[1]=r,n[2]=e,n[3]=i,n[4]=o,n[5]=t,n[6]=s,n[7]=c):(s=n[6],c=n[7]),(0,E.useEffect)(s,c)}function Xr(e,t){let n=(0,D.c)(6),r=Q(),i;n[0]!==r||n[1]!==e?(i=Jr(e,r),n[0]=r,n[1]=e,n[2]=i):i=n[2];let a=i,o;return n[3]!==a||n[4]!==t?(o=t?t(a):a,n[3]=a,n[4]=t,n[5]=o):o=n[5],o}function Zr(e){let t=(0,D.c)(3),n=Q(),r;return t[0]!==e||t[1]!==n?(r=e?e(n):n,t[0]=e,t[1]=n,t[2]=r):r=t[2],r}function Qr(e){return e.settingsHydrated?e.paletteThemeActive&&!e.paletteThemeAllowsArtwork&&e.mode===`artwork`?`pill`:e.mode:`none`}function $r(){let e=(0,D.c)(7),t=Ur(),n=Q().environmentIdentificationMode,{resolvedTheme:r,theme:i,themeHalves:a}=Ln(),o=(0,E.useSyncExternalStore)(St,_t,ei),s;if(e[0]!==n||e[1]!==o||e[2]!==r||e[3]!==t||e[4]!==i||e[5]!==a){let c=mt(i,a,r),l=gt(c);s=Qr({mode:n,settingsHydrated:t,paletteThemeActive:o!==null||l!==null,paletteThemeAllowsArtwork:o??lt(c)}),e[0]=n,e[1]=o,e[2]=r,e[3]=t,e[4]=i,e[5]=a,e[6]=s}else s=e[6];return s}function ei(){return null}async function ti(e,t){return(e.favorites===null||e.providerModelPreferences===null)&&await Hr(),{...nr(e,Vr()),...t}}function ni(e){let t=(0,D.c)(6),r;t[0]===e?r=t[1]:(r=e?S.settingsValueAtom(e):ii,t[0]=e,t[1]=r);let i=n(r),a=ct(S.updateSettings,`model preferences update`),o;return t[2]!==e||t[3]!==a||t[4]!==i?(o=async t=>{if(!e||!i)return;let n;try{n=await ti(i,t)}catch{x.add({type:`error`,title:`Model preferences not saved`,description:`Could not load saved model preferences. Try again.`});return}return a({environmentId:e,input:{patch:n}})},t[2]=e,t[3]=a,t[4]=i,t[5]=o):o=t[5],o}function ri(e){let t=(0,E.use)(Ce),n=(0,E.useRef)(new Map),r=ni(e);return(0,E.useCallback)(async(i,a)=>{if(!e)return;let s=S.settingsValueAtom(e),c=t.get(s);if(!c)return;if(c.favorites===null)try{await Hr()}catch{x.add({type:`error`,title:`Favorites not saved`,description:`Could not load saved model preferences. Try again.`});return}let l=t.get(s)??c,u=tr(l,Vr()).favorites,d=JSON.stringify([e,i,a]),f=n.current.get(d),p={favorite:!(f&&(f.pending||f.settings.favorites===l.favorites)?f.favorite:u.some(e=>e.provider===i&&e.model===a)),settings:l,pending:!0};n.current.set(d,p);try{let e=await r({setModelFavorites:[{provider:i,model:a,favorite:p.favorite}]});e&&o(e)&&t.get(s)?.favorites===l.favorites&&(p.pending=!1)}finally{p.pending&&n.current.get(d)===p&&(f&&!f.pending&&t.get(s)?.favorites===f.settings.favorites?n.current.set(d,f):n.current.delete(d))}},[e,t,r])}var ii=y(null);function ai(e){let t=(0,D.c)(5),r;t[0]===e?r=t[1]:(r=e?S.settingsValueAtom(e):ii,t[0]=e,t[1]=r);let i=n(r),a=Q();$(e,i);let o=i??Te,s;return t[2]!==a||t[3]!==o?(s=tr(o,a),t[2]=a,t[3]=o,t[4]=s):s=t[4],s}function oi(e,t){let r=(0,D.c)(2),i;r[0]===e?i=r[1]:(i=S.settingsValueAtom(e),r[0]=e,r[1]=i);let a=n(i);return $(e,a),Xr(a??Te,t)}function si(e){let t=(0,D.c)(4),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},t[0]=n):n=t[0];let r=ct(S.mutateProviderInstance,n),i;return t[1]!==e||t[2]!==r?(i=(t,n)=>r({environmentId:e,input:{patch:n===void 0?{}:n,providerInstanceMutation:t}}),t[1]=e,t[2]=r,t[3]=i):i=t[3],i}function ci(e){let t=mr(),r=n(rt);return $(t?.environmentId??null,t?.serverConfig?.settings??null),Xr(r,e)}var li=`This setting is saved on a server, and the hosted app is not anchored to one. Change it from the desktop app or from the server's own address.`;function ui(){let e=(0,D.c)(2),t=mr(),n;return e[0]===t?n=e[1]:(n=t!==null||!et(),e[0]=t,e[1]=n),n}function di(e){let t=(0,D.c)(3),r=e!==void 0&&e,{environments:i}=ur(),a;return t[0]!==i||t[1]!==r?(a=y(e=>i.filter(or).flatMap(t=>{let n=e(st.sessionStateAtom(t.environmentId));if(r&&n._tag===`Initial`)return[t.environmentId];let i=n._tag===`Failure`?null:m(u(n));return i!==null&&ee(i,`settings:write`)?[t.environmentId]:[]})),t[0]=i,t[1]=r,t[2]=a):a=t[2],n(a)}function fi(e){let t=(0,D.c)(10);it(e,oe);let n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={label:`server settings update`,reportFailure:!1},t[0]=n):n=t[0];let r=ct(S.updateSettings,n),{environments:i}=ur(),a;t[1]!==i||t[2]!==r?(a=async e=>{let t=await r(e);if(t._tag===`Failure`&&!Je(t)){let n=i.find(t=>t.environmentId===e.environmentId)?.label??e.environmentId,r=Ze(t);x.add({type:`error`,title:`Setting not saved`,description:`Could not save on ${n}: ${r instanceof Error?r.message:`The save failed. Try reconnecting and saving again.`}`})}return t},t[1]=i,t[2]=r,t[3]=a):a=t[3];let o=a,s=di(!0),c;return t[4]!==e||t[5]!==i||t[6]!==r||t[7]!==o||t[8]!==s?(c=t=>{let{serverPatch:n,clientPatch:a}=Br(t),c=e===null||se(n).every(t=>at(e,t));if(Object.keys(n).length>0&&!c&&x.add({type:`warning`,title:`Setting not saved`,description:`This connection lacks permission to change settings on ${i.find(t=>t.environmentId===e)?.label??`the selected environment`}.`}),Object.keys(n).length>0&&c){let{sharedPatch:t,localPatch:a}=ir(n),c=_i;if(Object.keys(a).length>0&&(e?o({environmentId:e,input:{patch:a}}):c()),Object.keys(t).length>0){let n=i.find(t=>t.environmentId===e)?.serverConfig?.settings,a=new Set(s);e&&a.add(e);let o=[],l=[];for(let r of a){let a=i.find(e=>e.environmentId===r),s=ar(t,a?.serverConfig?.environment.capabilities,a?.serverConfig?.settings,n,r===e);if(Object.keys(s).length!==0){if(ve.get(st.sessionStateAtom(r))._tag!==`Initial`&&!se(t).every(e=>at(r,e))){l.push(a?.label??r);continue}o.push({environmentId:r,input:{patch:s}})}}o.length===0?c(l.length>0?`This connection lacks permission to change settings on ${l.join(`, `)}.`:a.size>0?`Update older servers to save this setting.`:void 0):Promise.all(o.map(async e=>({label:i.find(t=>t.environmentId===e.environmentId)?.label??e.environmentId,result:await r(e)}))).then(pi)}}Object.keys(a).length>0&&Lr(a)},t[4]=e,t[5]=i,t[6]=r,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function pi(e){let t=e.flatMap(gi);if(t.length===0)return;let n=e.filter(hi).map(mi);x.add({type:`error`,title:n.length>0?`Setting saved on some environments`:`Setting not saved`,description:[...t,...n.length>0?[`Saved on ${n.join(`, `)}.`]:[]].join(`
|
|
2
|
+
`)})}function mi(e){let{label:t}=e;return t}function hi(e){let{result:t}=e;return t._tag===`Success`}function gi(e){let{label:t,result:n}=e;if(n._tag!==`Failure`||Je(n))return[];let r=Ze(n);return[`Could not save on ${t}: ${r instanceof Error?r.message:`The save failed. Try reconnecting and saving again.`}`]}function _i(e){let t=e===void 0?li:e;return x.add({type:`warning`,title:`Setting not saved`,description:t})}function vi(e){return fi(e)}function yi(){return fi(mr()?.environmentId??null)}function bi(){return xi}function xi(e){return Lr(e)}export{It as $,gr as A,Vn as B,hr as C,mr as D,ur as E,Un as F,On as G,cn as H,K as I,an as J,Ln as K,Kn as L,Qn as M,er as N,fr as O,$n as P,Pt as Q,Jn as R,pr as S,_r as T,ln as U,U as V,Cn as W,Bt as X,Jt as Y,Rt as Z,ri as _,Lr as a,vi as b,Ur as c,ai as d,Lt as et,oi as f,ui as g,ci as h,Jr as i,At as it,cr as j,yr as k,Gr as l,si as m,Hr as n,Ft as nt,Rr as o,$ as p,on as q,Vr as r,Dt as rt,Zr as s,li as t,zt as tt,$r as u,bi as v,vr as w,yi as x,ni as y,qn as z};
|
|
3
|
+
//# sourceMappingURL=useSettings-BcmuuiTp.js.map
|