@p4code/cli 0.8.35 → 0.9.0
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-26z5sNBT.mjs → binCli-k72_SR2Z.mjs} +2556 -2301
- package/dist/client/.vite/manifest.json +2004 -2044
- package/dist/client/assets/{2NI2N5EU-BLnY4aCF.js → 2NI2N5EU-DPAxyySd.js} +2 -2
- package/dist/client/assets/{4UO7MD6I-BApNVkfU.js → 4UO7MD6I-C0aflwpw.js} +2 -2
- package/dist/client/assets/{5B3SVYGG-Y7V7NdZO.js → 5B3SVYGG-hhn6T1ru.js} +2 -2
- package/dist/client/assets/{5GK6JWQ2-BSIhKcw-.js → 5GK6JWQ2-BQ0OdoZ6.js} +2 -2
- package/dist/client/assets/{5N7A7DKN-CNUCnWLs.js → 5N7A7DKN-BR8rdHwZ.js} +2 -2
- package/dist/client/assets/{5OC2THR4-Bne-pf_A.js → 5OC2THR4-DVDBlcjJ.js} +2 -2
- package/dist/client/assets/{5S6HY5KT-7d4UMONz.js → 5S6HY5KT-CjtOXys8.js} +2 -2
- package/dist/client/assets/{6IMQ5BUJ-BWW19n-D.js → 6IMQ5BUJ-Bpy1Geo9.js} +2 -2
- package/dist/client/assets/{6OLKWJ4F-CxTUuvA6.js → 6OLKWJ4F-D2naWV4i.js} +2 -2
- package/dist/client/assets/{74OO7NKP-DByVTRKE.js → 74OO7NKP-CceNos-7.js} +2 -2
- package/dist/client/assets/{75O6YZUN-CZanyedf.js → 75O6YZUN-CnXm_L8w.js} +2 -2
- package/dist/client/assets/{77XECAW3-TL2w7pHK.js → 77XECAW3-ECBcD47O.js} +2 -2
- package/dist/client/assets/{ABYRPUBD-CJboH7Uz.js → ABYRPUBD-B4F4wZam.js} +2 -2
- package/dist/client/assets/AlertDialogRoot-D5eL1YFA.js +2 -0
- package/dist/client/assets/{AnimatedHeight-OxEbW01v.js → AnimatedHeight-BZhIfVtA.js} +2 -2
- package/dist/client/assets/AuthSurfaceShell-DR9yRrzS.js +2 -0
- package/dist/client/assets/{BB2UYUI2-BxW-R2h1.js → BB2UYUI2-Cae7rC8c.js} +2 -2
- package/dist/client/assets/{BUM34MOA-ngG-irUy.js → BUM34MOA-DBDboDOb.js} +2 -2
- package/dist/client/assets/{CEQABKGZ-C-u-W0bS.js → CEQABKGZ-C6UutqUy.js} +2 -2
- package/dist/client/assets/{CXAC5362-DfFRkI7L.js → CXAC5362-BnZlf1Fg.js} +2 -2
- package/dist/client/assets/{ChatGptUsageButton-C3KgGt4z.js → ChatGptUsageButton-3K5PpaVk.js} +2 -2
- package/dist/client/assets/{ChatMarkdown-9gWM0ED9.js → ChatMarkdown-EK5C8Dje.js} +7 -7
- package/dist/client/assets/{CheckboxIndicator-DbU3csPQ.js → CheckboxIndicator-DZ8vBLEv.js} +2 -2
- package/dist/client/assets/{ClippedText-CS_BYNco.js → ClippedText-Dswe5Mb4.js} +2 -2
- package/dist/client/assets/CodexSetupSection.logic-BepCZ25p.js +2 -0
- package/dist/client/assets/{ComboboxClear-Bn_kslrf.js → ComboboxClear-By718biy.js} +2 -2
- package/dist/client/assets/{ComboboxGroupLabel-fL8lMA25.js → ComboboxGroupLabel-DjWIIS5_.js} +2 -2
- package/dist/client/assets/{CommandBlock-DcQXu_lq.js → CommandBlock-C967hvdK.js} +2 -2
- package/dist/client/assets/{ComposerPromptEditor-DQ9wFfKn.js → ComposerPromptEditor-kPs79YCA.js} +10 -10
- package/dist/client/assets/{CompositeRoot-BuwzXGHT.js → CompositeRoot-BFPe8O0M.js} +2 -2
- package/dist/client/assets/{ConnectionDiagnosisDetails-DGbJY7Hw.js → ConnectionDiagnosisDetails-B5VXf5lv.js} +2 -2
- package/dist/client/assets/{ConnectionStatusDot-CixsTBXI.js → ConnectionStatusDot-wmgCjAfF.js} +2 -2
- package/dist/client/assets/{DRLTVNUE-Cbb71R0Y.js → DRLTVNUE-Du8kYl_L.js} +2 -2
- package/dist/client/assets/{DYY6UVD2-BZn5fuF5.js → DYY6UVD2-DxjEuWNy.js} +2 -2
- package/dist/client/assets/{DevicePanel-JP__PY1s.js → DevicePanel-YEBH-Vqd.js} +2 -2
- package/dist/client/assets/DeviceSetup-CAlj40rJ.js +2 -0
- package/dist/client/assets/{DialogTitle-B_9LEmy3.js → DialogTitle-DNp9zThp.js} +2 -2
- package/dist/client/assets/{DiffCommentAnnotation-WMKzOwCh.js → DiffCommentAnnotation-BOk2MTlv.js} +2 -2
- package/dist/client/assets/{DiffFileTree-BSbsOOmA.js → DiffFileTree-Dg3cvfi5.js} +2 -2
- package/dist/client/assets/{DiffPanel-BWFuiHvv.js → DiffPanel-fTHMPAQJ.js} +2 -2
- package/dist/client/assets/{DiffWorkerPoolProvider-BBk0lIX3.js → DiffWorkerPoolProvider-CqmToECA.js} +3 -3
- package/dist/client/assets/{EmbeddedDesign-D5YUndkh.js → EmbeddedDesign-BXKBSCcw.js} +2 -2
- package/dist/client/assets/{EnvironmentMachineIcon-Dpgx67FY.js → EnvironmentMachineIcon-DBWK6C8T.js} +2 -2
- package/dist/client/assets/{ExpandableText-Cpm1gOKG.js → ExpandableText-B9cfY7p2.js} +2 -2
- package/dist/client/assets/{FNOVOB4O-BkEIrB0k.js → FNOVOB4O-BeMBYVRF.js} +2 -2
- package/dist/client/assets/{FieldControl-BHe6unoZ.js → FieldControl-BOrs67_f.js} +2 -2
- package/dist/client/assets/{FileDiff-C1vAOUga.js → FileDiff-DW1zPAn5.js} +2 -2
- package/dist/client/assets/{FilePreviewPanel-CbpNevZP.js → FilePreviewPanel-CTTCKfik.js} +10 -10
- package/dist/client/assets/{FoldedSettingsSection-DySTg20x.js → FoldedSettingsSection-ClboCRR4.js} +2 -2
- package/dist/client/assets/{FormContext-CmvUzTS-.js → FormContext-DcLeIpxJ.js} +2 -2
- package/dist/client/assets/{HDGCDEEZ-CN-ckGDk.js → HDGCDEEZ-DtsLNbcM.js} +2 -2
- package/dist/client/assets/{HSJLKHB7-B0BvmnZE.js → HSJLKHB7-Cj1_K-Mg.js} +2 -2
- package/dist/client/assets/{Icons-B4l3TqYa.js → Icons-B1qw9fnR.js} +2 -2
- package/dist/client/assets/Input-DQflEYBs.js +2 -0
- package/dist/client/assets/JZOYTAAL-BrzaFmLe.js +1 -0
- package/dist/client/assets/{K3MD6TGW-IS0rWO1U.js → K3MD6TGW-SNOidZ8r.js} +2 -2
- package/dist/client/assets/{K7RP3OMA-DcqjCOJO.js → K7RP3OMA-CpajkG5B.js} +2 -2
- package/dist/client/assets/{KeybindingsSettings.logic-mF9mJWrc.js → KeybindingsSettings.logic-BA5WG7V2.js} +2 -2
- package/dist/client/assets/{LHDIQX7Q-CLMgIt4Y.js → LHDIQX7Q-CAyO0Nv9.js} +2 -2
- package/dist/client/assets/{LUXOKEGN-B1dkmN_M.js → LUXOKEGN-Dp60gO-M.js} +2 -2
- package/dist/client/assets/{MathTypeset-qeRVy_bc.js → MathTypeset-DG9QDH3a.js} +2 -2
- package/dist/client/assets/{N3JZAHOW-C6sq5aqx.js → N3JZAHOW-CPZZhC9o.js} +2 -2
- package/dist/client/assets/{NUIALGQ3-BG7xJ_qe.js → NUIALGQ3-Bapg3pv1.js} +2 -2
- package/dist/client/assets/{NoProjectsHero-B0KzU91d.js → NoProjectsHero-DunzHVd0.js} +2 -2
- package/dist/client/assets/{O65XPQGZ-BEfVfDlS.js → O65XPQGZ-BmLVfB2-.js} +2 -2
- package/dist/client/assets/{O7XIQ6OM-BUiRjV87.js → O7XIQ6OM-BzZlSmaP.js} +2 -2
- package/dist/client/assets/{OFQON5FD-DTgVPbd-.js → OFQON5FD-Ciy1Dfj8.js} +2 -2
- package/dist/client/assets/{P4ConnectAccountPages-C4KYM5XU.js → P4ConnectAccountPages-DO-fCpTN.js} +2 -2
- package/dist/client/assets/{P4ConnectSidebarSignIn-DNPUNJl_.js → P4ConnectSidebarSignIn-7hkM7xr7.js} +2 -2
- package/dist/client/assets/{PJQHF43J-QRnhQpHu.js → PJQHF43J-CTTmTIhc.js} +2 -2
- package/dist/client/assets/{PanelLayoutControls-4VFKEoHg.js → PanelLayoutControls-clP6N7xc.js} +7 -7
- package/dist/client/assets/{PierreEntryIcon-DeI-j_7w.js → PierreEntryIcon-wm-IkF2y.js} +2 -2
- package/dist/client/assets/{PopoverHandle-DMB4QSp6.js → PopoverHandle-CqjlXffy.js} +2 -2
- package/dist/client/assets/PreviewPanel-fTwWXayK.js +2 -0
- package/dist/client/assets/{ProjectDefaultsSettings-BF-iyQ8T.js → ProjectDefaultsSettings-DABlQCRQ.js} +2 -2
- package/dist/client/assets/{ProjectFavicon-_6hkSNzm.js → ProjectFavicon-zExdjKgc.js} +3 -3
- package/dist/client/assets/{ProjectIconPickerDialog-DeL1rZxy.js → ProjectIconPickerDialog-D4Br81iW.js} +2 -2
- package/dist/client/assets/{ProjectMonogram-Cn4l-YGU.js → ProjectMonogram-Ba70a8_s.js} +2 -2
- package/dist/client/assets/{ProviderAuthTerminal-qGeMxZDy.js → ProviderAuthTerminal-Gf_5AaPE.js} +2 -2
- package/dist/client/assets/{ProviderModelPicker-DJQYH_Pp.js → ProviderModelPicker-DrfK42fH.js} +2 -2
- package/dist/client/assets/{ProviderSettingsForm-BSVuPnR0.js → ProviderSettingsForm-CXVYrIzw.js} +2 -2
- package/dist/client/assets/{PullRequestCodeTab-0OaJE6XS.js → PullRequestCodeTab-DaXxo4Bs.js} +3 -3
- package/dist/client/assets/{RHNBAITX-ChqB7inB.js → RHNBAITX-DKMeuR6R.js} +2 -2
- package/dist/client/assets/{ReadOnlySourcePreview-B08Wms4m.js → ReadOnlySourcePreview-DPJWK3HJ.js} +2 -2
- package/dist/client/assets/{RenderErrorBoundary-BsOuLEci.js → RenderErrorBoundary-BI5KBtsb.js} +2 -2
- package/dist/client/assets/{SLD4V6NK-IkYRGtTH.js → SLD4V6NK-CR4aIcpx.js} +2 -2
- package/dist/client/assets/ScheduledTasksSettings-CTHyd4UX.js +4 -0
- package/dist/client/assets/{ScopedSwitch-Bhp6-hCj.js → ScopedSwitch-De6GoQiO.js} +2 -2
- package/dist/client/assets/{ScrollAreaCorner-BPMuWLbs.js → ScrollAreaCorner-DF4GCx0d.js} +2 -2
- package/dist/client/assets/{SecretInput-RlOzrLKL.js → SecretInput-Dg6ZsU9p.js} +2 -2
- package/dist/client/assets/{SelectScrollUpArrow-6kh66YCd.js → SelectScrollUpArrow-DeRXucOo.js} +2 -2
- package/dist/client/assets/{SettingsPanels-BfBUSBAG.js → SettingsPanels-D6e2byZQ.js} +8 -8
- package/dist/client/assets/{SettingsPanels.logic-BsFZYDgm.js → SettingsPanels.logic-BSXSdFru.js} +2 -2
- package/dist/client/assets/{SettingsScopeNotice-H7UzC9bb.js → SettingsScopeNotice-MbxDDMZ9.js} +2 -2
- package/dist/client/assets/SidebarStageBackdrop-B0F--sat.js +2 -0
- package/dist/client/assets/{T3PCR2KE-BxaunvVy.js → T3PCR2KE-C0_7R2Oa.js} +2 -2
- package/dist/client/assets/{TKWO2OVW-DFURsfqA.js → TKWO2OVW-DqJmzuhq.js} +2 -2
- package/dist/client/assets/{TSHNXIZL-CIukdyLy.js → TSHNXIZL-CmCl4WMk.js} +2 -2
- package/dist/client/assets/ThemeEditorPanel-IhSXPcO9.js +5 -0
- package/dist/client/assets/{ThreadTerminalDrawer-BQKZCFAC.js → ThreadTerminalDrawer-DnOstFPr.js} +4 -4
- package/dist/client/assets/TooltipViewport-DJXNIjFt.js +2 -0
- package/dist/client/assets/{UQJE5E4I-CfqCotH2.js → UQJE5E4I-U1f_Qxq0.js} +2 -2
- package/dist/client/assets/{USNYFO5S-CctAAheU.js → USNYFO5S-BFU1s0-x.js} +2 -2
- package/dist/client/assets/{Virtualizer-CImHNxBq.js → Virtualizer-CI2uidEs.js} +2 -2
- package/dist/client/assets/{WEVWDWVA-DS9YO9IT.js → WEVWDWVA-DVuH1I8D.js} +2 -2
- package/dist/client/assets/{WorkspaceBreadcrumb-BW_omYU1.js → WorkspaceBreadcrumb-Dr-p0Dtn.js} +2 -2
- package/dist/client/assets/{WorkspacePageContainer-BS8FWt_4.js → WorkspacePageContainer-MDWEFwmu.js} +2 -2
- package/dist/client/assets/{WorkspacePageHeader-CE_94tTR.js → WorkspacePageHeader-CNcKDaqG.js} +2 -2
- package/dist/client/assets/{X5RFHQXM-B0KbwoE1.js → X5RFHQXM-DhiPjZ2I.js} +2 -2
- package/dist/client/assets/{X62E3GBT-wpz8X9Yh.js → X62E3GBT-BoEmDIYA.js} +2 -2
- package/dist/client/assets/{XBNEOJTC-DFRK5c6Y.js → XBNEOJTC-ACchb7zJ.js} +2 -2
- package/dist/client/assets/{YHV2MVVZ-1NnqTTZ2.js → YHV2MVVZ-WIW1NclZ.js} +2 -2
- package/dist/client/assets/{YURCZMG2-rnzWY5ij.js → YURCZMG2-D8PyipKA.js} +2 -2
- package/dist/client/assets/{YVG2LODB-Dxuuk2M-.js → YVG2LODB-BQvBC9bF.js} +2 -2
- package/dist/client/assets/_chat-DDGjgFMR.js +45 -0
- package/dist/client/assets/{_chat.design-z2pu_9A5.js → _chat.design-DjIqnlVZ.js} +2 -2
- package/dist/client/assets/{_chat.index-D8X9o5jY.js → _chat.index-Dku1iZH1.js} +2 -2
- package/dist/client/assets/{_chat.new-CGJw8cpo.js → _chat.new-8-cjg5K7.js} +3 -3
- package/dist/client/assets/_chat.pull-requests-DVfSewSZ.js +2 -0
- package/dist/client/assets/{alert-DO06etEs.js → alert-DpVw79VA.js} +2 -2
- package/dist/client/assets/{assetUrls-CmOUMX2M.js → assetUrls-BOJMUK_1.js} +2 -2
- package/dist/client/assets/{assets-aBpLf8r4.js → assets-6zZLBDZw.js} +2 -2
- package/dist/client/assets/{browserHistoryStore-tYgeZygn.js → browserHistoryStore-TJXTYA-V.js} +2 -2
- package/dist/client/assets/{browserLinkTarget-CQFfJKWJ.js → browserLinkTarget-DRbX4L_9.js} +2 -2
- package/dist/client/assets/{checkbox-BEQFb7GO.js → checkbox-4yBjrqWQ.js} +2 -2
- package/dist/client/assets/{color-picker-CXfnfmuH.js → color-picker-B6JEgpDa.js} +2 -2
- package/dist/client/assets/{combobox--XoXA5uu.js → combobox-CKWbcPIR.js} +2 -2
- package/dist/client/assets/{command-E2aLhsct.js → command-D8XZec1r.js} +2 -2
- package/dist/client/assets/{connect-CU9dNvTt.js → connect-Dp9BB7ev.js} +2 -2
- package/dist/client/assets/{connect-agent-Byc9PCdW.js → connect-agent-DkbIqI-8.js} +2 -2
- package/dist/client/assets/{design-CoGbXd61.js → design-Dn5DzqF2.js} +2 -2
- package/dist/client/assets/{device-DmH6IHQ4.js → device-dylO5xoO.js} +2 -2
- package/dist/client/assets/{dialog-CBBxT1gk.js → dialog-_vbB7RKH.js} +2 -2
- package/dist/client/assets/{diffRendering-BOVFJuWd.js → diffRendering-MXukhqw1.js} +2 -2
- package/dist/client/assets/{dist-B2P3f-0Q.js → dist-ceTe_mn7.js} +3 -3
- package/dist/client/assets/{draft-input-CSOOVntS.js → draft-input-C-u_3cDw.js} +2 -2
- package/dist/client/assets/{duoViewer-BhHYrurM.js → duoViewer-C0aL6Kyr.js} +2 -2
- package/dist/client/assets/{dynamic-BhzrutAo.js → dynamic-DTzzXo3L.js} +2 -2
- package/dist/client/assets/{embeddedScripts-43_R83vp.js → embeddedScripts-DcWCyBxX.js} +2 -2
- package/dist/client/assets/{empty-FOL5U4KY.js → empty-BlKDGTzb.js} +2 -2
- package/dist/client/assets/{entities-Bqo0n1Pb.js → entities-eRiwvW2F.js} +2 -2
- package/dist/client/assets/{fileLinks-D4GSqJYj.js → fileLinks-CYejoXPq.js} +2 -2
- package/dist/client/assets/{fileTreeExpansion-BBT5F8P1.js → fileTreeExpansion-wG1G7D6R.js} +2 -2
- package/dist/client/assets/{getDiffFileInput-CGw09SPI.js → getDiffFileInput-CzeweGHs.js} +2 -2
- package/dist/client/assets/{guideRunStore-DvIkVECt.js → guideRunStore-DAYN2Zd7.js} +2 -2
- package/dist/client/assets/{htmlRender-CmEeFzCo.js → htmlRender-C3rZ0xgC.js} +2 -2
- package/dist/client/assets/{index-B1djVqM4.js → index-DA9og9YW.js} +3 -3
- package/dist/client/assets/{input-ekYqAkUx.js → input-DXGWoa4O.js} +2 -2
- package/dist/client/assets/{input-group-C3pxk97H.js → input-group-De0xZXfc.js} +2 -2
- package/dist/client/assets/{kbd-3FPzNikV.js → kbd-WWNLIkTn.js} +2 -2
- package/dist/client/assets/{keybindings-B3oDRRkK.js → keybindings-DAHl8jIl.js} +2 -2
- package/dist/client/assets/{lazy-DyNR0b0B.js → lazy-Ccs3klKO.js} +4 -4
- package/dist/client/assets/{lazyRouteComponent-BPxq_G_s.js → lazyRouteComponent-BU0ER5FO.js} +2 -2
- package/dist/client/assets/{link-B3B5a5Ju.js → link-C3TbL1do.js} +2 -2
- package/dist/client/assets/{linkedPrompt-BsCPMHxQ.js → linkedPrompt-BJh0Yqud.js} +2 -2
- package/dist/client/assets/main-DjrB0l0D.css +2 -0
- package/dist/client/assets/main-DleJeMZO.js +37 -0
- package/dist/client/assets/{mediaReference-Bb8H-qbI.js → mediaReference-BbSbhpkR.js} +2 -2
- package/dist/client/assets/{mediaSource-C2MsZgy8.js → mediaSource-B_75uvyp.js} +2 -2
- package/dist/client/assets/{number-field-SoHEiP55.js → number-field-qEfih146.js} +2 -2
- package/dist/client/assets/{observeResize-3Vj9DYOV.js → observeResize-DzSkewug.js} +2 -2
- package/dist/client/assets/{onboarding-CPgiVEVK.js → onboarding-1Zg3fM0A.js} +2 -2
- package/dist/client/assets/{openFileInPreview-BBWCOLh_.js → openFileInPreview-CiPuDrfB.js} +2 -2
- package/dist/client/assets/{p4ProjectFile-qmvlbzKv.js → p4ProjectFile-BVKW5TIA.js} +2 -2
- package/dist/client/assets/{pair-CZnRGdd8.js → pair-DUv1mY4i.js} +2 -2
- package/dist/client/assets/{pendingSendStore-L5KquCDf.js → pendingSendStore-BFVsboDn.js} +2 -2
- package/dist/client/assets/{phoneViewer-D-8v-sMf.js → phoneViewer-CStYy_tX.js} +2 -2
- package/dist/client/assets/{pierre-icons-jwqMPUxD.js → pierre-icons-D3vWvKqU.js} +2 -2
- package/dist/client/assets/{popover-OfG3wVsl.js → popover-CogH2zM4.js} +2 -2
- package/dist/client/assets/{preview-DGdQ5Ycc.js → preview-O1ZL8Awg.js} +2 -2
- package/dist/client/assets/{preview-BYnEURcB.js → preview-ipLyyv_l.js} +2 -2
- package/dist/client/assets/{previewMiniPlayerStore-Dlbj5KrZ.js → previewMiniPlayerStore-C5z1mN8S.js} +2 -2
- package/dist/client/assets/{primary-B47ivN3o.js → primary-CMBPxKMH.js} +2 -2
- package/dist/client/assets/{primaryCloudLinkState-CreqR0gU.js → primaryCloudLinkState-CER468V5.js} +2 -2
- package/dist/client/assets/{projectFilesQueryState-CanWrACx.js → projectFilesQueryState-D4FdR3Xm.js} +2 -2
- package/dist/client/assets/{projectScriptEditor-gWuw6vwd.js → projectScriptEditor-4wQTbXvz.js} +2 -2
- package/dist/client/assets/{providerSkills-C_Rxqah9.js → providerSkills-D3rxPB_g.js} +2 -2
- package/dist/client/assets/{pullRequestDetail.logic-RASi2EgP.js → pullRequestDetail.logic-Bkh57WzV.js} +2 -2
- package/dist/client/assets/{pullRequestIcons-ucGaXXG7.js → pullRequestIcons-DPbMXqGp.js} +2 -2
- package/dist/client/assets/{pullRequestReviewStore-CEr41DEl.js → pullRequestReviewStore-BAxwf6rl.js} +2 -2
- package/dist/client/assets/{pullRequests-Bw3Ui6hK.js → pullRequests-DggtcbhA.js} +2 -2
- package/dist/client/assets/{queries-EslKFJTV.js → queries-DJfKGsHe.js} +2 -2
- package/dist/client/assets/{query-d1pQlqP0.js → query-B3Zo1YOE.js} +2 -2
- package/dist/client/assets/{radio-group-Ciy_K5uE.js → radio-group-l1Zl-3hQ.js} +2 -2
- package/dist/client/assets/{renderScheduler-CP-JkmKx.js → renderScheduler-BgGYA97h.js} +2 -2
- package/dist/client/assets/{rightPanelStore-D3KOmuPa.js → rightPanelStore-Cv1U3yrU.js} +2 -2
- package/dist/client/assets/{runtime-d6B1vJeH.js → runtime-BOlBBevr.js} +3 -3
- package/dist/client/assets/{runtime-DR7JxgbQ.js → runtime-CeFhsGnm.js} +3 -3
- package/dist/client/assets/{runtimeModeConfig-Rxeb1uGg.js → runtimeModeConfig-BQ0QCQhj.js} +2 -2
- package/dist/client/assets/{scheduledTasksSettings.logic-CVIC4Kpr.js → scheduledTasksSettings.logic-BpOBCcOk.js} +2 -2
- package/dist/client/assets/{scroll-area-yyfi3ycu.js → scroll-area-CQNIjQ8U.js} +2 -2
- package/dist/client/assets/{select-DaYjjw1q.js → select-Cbpdz6n3.js} +2 -2
- package/dist/client/assets/{selfImproveFindings-1XIHD-7i.js → selfImproveFindings-CT79AgdK.js} +2 -2
- package/dist/client/assets/{server-sXApTCjZ.js → server-DvWrfyUO.js} +2 -2
- package/dist/client/assets/{session-C949OsEI.js → session-D3gY-tOR.js} +2 -2
- package/dist/client/assets/{session-logic-DkSfwnHl.js → session-logic-OeNFZd_V.js} +3 -3
- package/dist/client/assets/{settings-B0O54Q3P.js → settings-C6gUwixG.js} +2 -2
- package/dist/client/assets/{settings.appearance-BesXhA1a.js → settings.appearance-BdGq8dkT.js} +2 -2
- package/dist/client/assets/settings.archived-DobN7ZtC.js +2 -0
- package/dist/client/assets/{settings.computer-use-BeKmLbNe.js → settings.computer-use-DTAvnNqQ.js} +2 -2
- package/dist/client/assets/settings.connections-CZD-0BNX.js +2 -0
- package/dist/client/assets/settings.data-controls-CTVHY8Rd.js +2 -0
- package/dist/client/assets/{settings.decisions-D97jIUyr.js → settings.decisions-D3zMITNw.js} +2 -2
- package/dist/client/assets/{settings.designs-B473PRvt.js → settings.designs-DWeI1d2s.js} +2 -2
- package/dist/client/assets/{settings.diagnostics-DDOaOIDg.js → settings.diagnostics-CqC6fhz6.js} +2 -2
- package/dist/client/assets/{settings.general-qzEOE2zF.js → settings.general-BDEcQVI4.js} +2 -2
- package/dist/client/assets/{settings.integrations-D6ctQ9WI.js → settings.integrations-BmqNoylk.js} +2 -2
- package/dist/client/assets/{settings.keybindings-BL57H4sD.js → settings.keybindings-Mt7J5TKC.js} +2 -2
- package/dist/client/assets/{settings.open-source-licenses-DaS82UhN.js → settings.open-source-licenses-Dvex7Jce.js} +2 -2
- package/dist/client/assets/{settings.plugins-DnS3RrT2.js → settings.plugins-BAFed2wY.js} +4 -4
- package/dist/client/assets/settings.projects-DhuXD_vx.js +4 -0
- package/dist/client/assets/settings.providers-D_-kNRqH.js +3 -0
- package/dist/client/assets/{settings.scheduled-tasks-IEAC3STn.js → settings.scheduled-tasks-Z4aprmEO.js} +2 -2
- package/dist/client/assets/settings.snap-shot-o0bdbS5t.js +2 -0
- package/dist/client/assets/settings.source-control-CwJzBnSu.js +2 -0
- package/dist/client/assets/{settings.storage-D4vBYBRP.js → settings.storage-B4ahmlhx.js} +2 -2
- package/dist/client/assets/{settingsLayout-CFQx1XDM.js → settingsLayout-DrhqvTJ8.js} +3 -3
- package/dist/client/assets/{sidebar-C1E4GqL6.js → sidebar-BhJqncti.js} +2 -2
- package/dist/client/assets/{sidebarProjectGrouping-9cUrCOXH.js → sidebarProjectGrouping-DDt6qTcu.js} +2 -2
- package/dist/client/assets/{skeleton-BCpBrYxh.js → skeleton-CFtayHTe.js} +2 -2
- package/dist/client/assets/{sourceControl-DwJWPP0h.js → sourceControl-Dqo9EYNC.js} +2 -2
- package/dist/client/assets/{sourceControlClients-BBJW7ra4.js → sourceControlClients-DGnHi6Rd.js} +2 -2
- package/dist/client/assets/{spinner-CSTrcxhP.js → spinner-BZh9P0sD.js} +2 -2
- package/dist/client/assets/{terminal-links-D18LpQ1T.js → terminal-links-CFKe0iu0.js} +2 -2
- package/dist/client/assets/{terminalSessions-C2NUFncF.js → terminalSessions-BykgTNwT.js} +2 -2
- package/dist/client/assets/{textarea-R4UQ47Ns.js → textarea-hXQFbdrS.js} +2 -2
- package/dist/client/assets/themePalette-MbAn2gqj.js +5 -0
- package/dist/client/assets/{toast-B84QdqqM.js → toast-C61oyZY1.js} +2 -2
- package/dist/client/assets/{toggle-BH5BGBcD.js → toggle-B03MQDgB.js} +2 -2
- package/dist/client/assets/{toggle-group-Di3SFV73.js → toggle-group-yF5GZ53o.js} +2 -2
- package/dist/client/assets/{tooltip-D-GRl-oZ.js → tooltip-ChmjT8Ns.js} +2 -2
- package/dist/client/assets/uiStateStore-DL8OsPjd.js +2 -0
- package/dist/client/assets/{usage-DUdXloVo.js → usage-DATBL2Du.js} +2 -2
- package/dist/client/assets/{usageAccess-DSLF-sRE.js → usageAccess-kgUHYKOw.js} +2 -2
- package/dist/client/assets/{usageFormat-Bzyvr9m4.js → usageFormat-D5Mz5ugL.js} +2 -2
- package/dist/client/assets/{usageShortcuts-D6nQeRtx.js → usageShortcuts-mAekk3eG.js} +2 -2
- package/dist/client/assets/{use-atom-command-DA6OG-Qk.js → use-atom-command-Bt7x9oO0.js} +2 -2
- package/dist/client/assets/{useAriaLabelledBy-PLuOxvFb.js → useAriaLabelledBy-DjNn9irU.js} +2 -2
- package/dist/client/assets/useHandleNewThread-BOKOo2wA.js +2 -0
- package/dist/client/assets/{useLocation-Bqc94klS.js → useLocation-Cwv1HZ3K.js} +2 -2
- package/dist/client/assets/{useNavigate-DdjG4MB_.js → useNavigate-Cdrlv-yJ.js} +2 -2
- package/dist/client/assets/{useNavigateBack-sP0LsL3p.js → useNavigateBack-CwjQ4iuL.js} +2 -2
- package/dist/client/assets/{useP4ConnectAuthPrompt-C9d7n33S.js → useP4ConnectAuthPrompt-D63n-MFC.js} +2 -2
- package/dist/client/assets/{useParams-DZQvRQLJ.js → useParams-C5D_t-0u.js} +2 -2
- package/dist/client/assets/{usePermissionStatus-BzfAUU9X.js → usePermissionStatus-CKmeNk61.js} +2 -2
- package/dist/client/assets/{usePullRequestActions-DIjGLg1E.js → usePullRequestActions-D53oZord.js} +2 -2
- package/dist/client/assets/{useRegisterFieldControl-CyBVe0G0.js → useRegisterFieldControl-DUs9w2Me.js} +2 -2
- package/dist/client/assets/{useScopedModelAvailability-D4n22Nmm.js → useScopedModelAvailability-CeAUx0qZ.js} +2 -2
- package/dist/client/assets/useSettings-VTow9ZEM.js +3 -0
- package/dist/client/assets/utils-CBe1bHL7.js +37 -0
- package/dist/client/assets/{vcsRefInvalidation-w_CQ3i43.js → vcsRefInvalidation-B2f3qDSR.js} +2 -2
- package/dist/client/assets/{welcome-BIKH3rbU.js → welcome-CQgOocvj.js} +2 -2
- package/dist/client/index.html +1 -1
- package/dist/{renderer-CveKT929.mjs → renderer-BBWgEvuE.mjs} +2 -2
- package/dist/{runtime-DGGSjC6Q.mjs → runtime-DNjlpJkJ.mjs} +288 -242
- package/package.json +2 -2
- package/dist/client/assets/AlertDialogRoot-9jRALQXL.js +0 -2
- package/dist/client/assets/AuthSurfaceShell-KQXgPV4i.js +0 -2
- package/dist/client/assets/CodexSetupSection.logic-CNbTXxKb.js +0 -2
- package/dist/client/assets/DeviceSetup-D8qb_qBj.js +0 -2
- package/dist/client/assets/Input-Cv-TKh6s.js +0 -2
- package/dist/client/assets/JZOYTAAL-CB_B_Rei.js +0 -1
- package/dist/client/assets/PreviewPanel-CO66mekh.js +0 -2
- package/dist/client/assets/ScheduledTasksSettings-1UDkELZo.js +0 -4
- package/dist/client/assets/ThemeEditorPanel-otrA-nTg.js +0 -5
- package/dist/client/assets/TooltipViewport-ZmVCer7P.js +0 -2
- package/dist/client/assets/_chat-1QGQLbCc.js +0 -45
- package/dist/client/assets/_chat.pull-requests-BfW9qMU1.js +0 -2
- package/dist/client/assets/composer-logic-BPTz1APL.js +0 -6
- package/dist/client/assets/composerDraftUploads-b_0oxKs9.js +0 -2
- package/dist/client/assets/main-BWh6jqG2.js +0 -29
- package/dist/client/assets/main-DdVSHl80.css +0 -2
- package/dist/client/assets/settings.archived-FtcZf_Ug.js +0 -2
- package/dist/client/assets/settings.connections-D1UxckE0.js +0 -2
- package/dist/client/assets/settings.data-controls-lPiIwMgc.js +0 -2
- package/dist/client/assets/settings.projects-D-ZICXey.js +0 -4
- package/dist/client/assets/settings.providers-CFpCmv0o.js +0 -3
- package/dist/client/assets/settings.snap-shot-BaOFk9WR.js +0 -2
- package/dist/client/assets/settings.source-control-BW16AA5z.js +0 -2
- package/dist/client/assets/themePalette-neUNWCzK.js +0 -5
- package/dist/client/assets/uiStateStore-xSkh4_PU.js +0 -6
- package/dist/client/assets/useHandleNewThread-Dm0SCq59.js +0 -2
- package/dist/client/assets/useSettings-CaJMqrvF.js +0 -3
- package/dist/client/assets/utils-BoMYW9A3.js +0 -37
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@p4code/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "P4 Code coding agent server and command-line client",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@cursor/sdk": "1.0.35",
|
|
27
27
|
"@ff-labs/fff-node": "0.11.0",
|
|
28
28
|
"@napi-rs/keyring": "^1.3.0",
|
|
29
|
-
"node-pty": "
|
|
29
|
+
"node-pty": "1.2.0-beta.15",
|
|
30
30
|
"playwright-core": "1.60.0",
|
|
31
31
|
"skia-canvas": "3.0.8"
|
|
32
32
|
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./react-DH3P2YXY.js";import{n as t,t as n}from"./jsx-runtime-BnjsACtP.js";import{N as r,P as i}from"./runtime-d6B1vJeH.js";import{t as a}from"./standalone-page-3TM7ZX16.js";import{Hr as o,Wr as s}from"./main-BWh6jqG2.js";var c=t(),l=e(n(),1);function u(e){let t=(0,c.c)(6),{children:n}=e,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=s(i),t[0]=u):u=t[0];let d=u,f,p;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(f=d?(0,l.jsx)(`div`,{className:`absolute inset-0`,"aria-hidden":!0,children:(0,l.jsx)(o,{variant:d})}):(0,l.jsx)(`div`,{"aria-hidden":!0,className:`absolute inset-0 bg-[radial-gradient(circle_at_75%_25%,rgba(136,204,255,0.5),transparent_38%),linear-gradient(135deg,#2468df,#172f82)]`}),p=(0,l.jsx)(`div`,{className:`absolute inset-0 bg-[linear-gradient(to_bottom,transparent_20%,rgba(7,18,55,0.46)_100%)]`}),t[1]=f,t[2]=p):(f=t[1],p=t[2]);let m;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,l.jsxs)(`header`,{className:`relative h-24 overflow-hidden bg-[linear-gradient(135deg,#1e61de,#17348e)] text-white`,children:[f,p,(0,l.jsx)(`div`,{className:`relative h-full p-5 sm:p-6`,children:(0,l.jsx)(`p`,{className:`text-3xs font-semibold tracking-widest text-white/80 uppercase`,children:r})})]}),t[3]=m):m=t[3];let h;return t[4]===n?h=t[5]:(h=(0,l.jsx)(a,{tone:`brand`,masthead:m,children:n}),t[4]=n,t[5]=h),h}export{u as t};
|
|
2
|
-
//# sourceMappingURL=AuthSurfaceShell-KQXgPV4i.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as e,t}from"./react-DH3P2YXY.js";import{n,t as r}from"./jsx-runtime-BnjsACtP.js";import{M_ as i,Md as a,N_ as o,X_ as s,aE as c,dr as l,gh as u,kd as d,l as f,of as p,t as m,ts as h,vh as g,xb as _}from"./utils-BoMYW9A3.js";import{R as v,W as y}from"./runtime-DR7JxgbQ.js";import{C as b,O as x,S as ee,f as te,q as S}from"./useSettings-CaJMqrvF.js";import{f as C}from"./server-sXApTCjZ.js";import{i as w,n as ne}from"./session-C949OsEI.js";import{n as re}from"./query-d1pQlqP0.js";import{t as T}from"./use-atom-command-DA6OG-Qk.js";import{n as E,t as D}from"./radio-group-Ciy_K5uE.js";import{t as ie}from"./input-ekYqAkUx.js";import{a as ae,c as O,i as oe,r as se,s as ce,t as le}from"./dialog-CBBxT1gk.js";import{x as k}from"./Icons-B4l3TqYa.js";import{t as ue}from"./preview-DGdQ5Ycc.js";import{S as A,t as de}from"./ChatGptUsageButton-C3KgGt4z.js";import{a as fe}from"./settingsLayout-CFQx1XDM.js";import{Di as j,Oi as pe,da as M,fa as me,fr as he,ga as N,ha as P,pa as ge,ua as F}from"./main-BWh6jqG2.js";var I=e(t(),1),L=n(),R=e(r(),1);function z(e){let t=(0,L.c)(7),n,r;t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,R.jsx)(k,{className:`size-4 shrink-0`,"aria-hidden":`true`}),t[3]=i):i=t[3];let a=n??`Continue with ChatGPT`,o;return t[4]!==r||t[5]!==a?(o=(0,R.jsxs)(l,{...r,children:[i,a]}),t[4]=r,t[5]=a,t[6]=o):o=t[6],o}function _e(e){let t=(0,L.c)(23),{open:n,methods:r,onClose:i,onSelect:a}=e,o=r.filter(ye),[s,c]=(0,I.useState)(null),l=s===`chatgpt-change-account`?s:o.find(e=>e.id===s)?.id??o[0]?.id??`chatgpt-change-account`,u=le,d;t[0]===i?d=t[1]:(d=e=>{e||i()},t[0]=i,t[1]=d);let f=ce,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,R.jsxs)(ae,{children:[(0,R.jsx)(O,{children:`Reconnect ChatGPT`}),(0,R.jsx)(se,{children:`On OpenAI, sign in with the account you choose here.`})]}),t[2]=p):p=t[2];let m=E,h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>c(e),t[3]=h):h=t[3];let g=o.map(ve),_;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,R.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-3 rounded-lg border px-3 py-3 text-sm`,children:[(0,R.jsx)(D,{value:`chatgpt-change-account`}),(0,R.jsx)(`span`,{className:`font-medium`,children:`Use a different account`})]}),t[4]=_):_=t[4];let v;t[5]!==m||t[6]!==l||t[7]!==h||t[8]!==g?(v=(0,R.jsx)(`div`,{className:`px-6 pb-6`,children:(0,R.jsxs)(m,{"aria-label":`ChatGPT account to connect`,value:l,onValueChange:h,children:[g,_]})}),t[5]=m,t[6]=l,t[7]=h,t[8]=g,t[9]=v):v=t[9];let y;t[10]!==a||t[11]!==l?(y=(0,R.jsx)(oe,{children:(0,R.jsx)(z,{onClick:()=>a(l)})}),t[10]=a,t[11]=l,t[12]=y):y=t[12];let b;t[13]!==f||t[14]!==p||t[15]!==v||t[16]!==y?(b=(0,R.jsxs)(f,{children:[p,v,y]}),t[13]=f,t[14]=p,t[15]=v,t[16]=y,t[17]=b):b=t[17];let x;return t[18]!==u||t[19]!==n||t[20]!==d||t[21]!==b?(x=(0,R.jsx)(u,{open:n,onOpenChange:d,children:b}),t[18]=u,t[19]=n,t[20]=d,t[21]=b,t[22]=x):x=t[22],x}function ve(e){return(0,R.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-3 rounded-lg border px-3 py-3 text-sm`,children:[(0,R.jsx)(D,{value:e.id}),(0,R.jsx)(`span`,{className:`min-w-0 break-all font-medium`,children:e.name})]},e.id)}function ye(e){return e.id.startsWith(`chatgpt-profile:`)}function be(e){let t=(0,L.c)(36),{environmentId:n,onClose:r,renderSetup:a,onAccountCreated:c}=e,u=w(n,s),d=te(n),p;t[0]===n?p=t[1]:(p=C.providersValueAtom(n),t[0]=n,t[1]=p);let m=h(p),g=T(C.updateSettings,`Add ChatGPT account`),[_,v]=(0,I.useState)(`Personal`),y;t[2]===_?y=t[3]:(y=_.trim(),t[2]=_,t[3]=y);let b=`ChatGPT - ${y}`,[x,ee]=(0,I.useState)(null),[S,re]=(0,I.useState)(!1),E=m?.find(e=>e.instanceId===x),D=A(E),ae=(0,I.useEffectEvent)(r);(0,I.useEffect)(()=>{D&&ae()},[D]);let O;t[4]!==b||t[5]!==n||t[6]!==_||t[7]!==c||t[8]!==r||t[9]!==S||t[10]!==d||t[11]!==g?(O=async()=>{if(S||!_.trim()||!ne(n,`providers:manage`))return;re(!0);let e=o.make(`codex_${f()}`);(await g({environmentId:n,input:{patch:{providerInstances:{...d.providerInstances,[e]:{driver:i.make(`codex`),displayName:b,enabled:!0,config:{enabled:!0,setupMode:`managed`}}}}}}))._tag===`Success`&&(c?(c(e,b),r()):ee(e)),re(!1)},t[4]=b,t[5]=n,t[6]=_,t[7]=c,t[8]=r,t[9]=S,t[10]=d,t[11]=g,t[12]=O):O=t[12];let oe=O,se=le,ce=!D,k;t[13]===r?k=t[14]:(k=e=>{e||r()},t[13]=r,t[14]=k);let ue=ge,de=x?b:`Add ChatGPT account`,j;t[15]===de?j=t[16]:(j=(0,R.jsx)(M,{title:de,description:`Each account has its own Codex instance and sign-in. Choose the other account on the sign-in page.`}),t[15]=de,t[16]=j);let pe=me,he=x?E?.setup?a(x,E):(0,R.jsx)(fe,{title:`Codex runtime`,description:`Preparing managed setup.`}):(0,R.jsx)(`form`,{id:`add-codex-account`,onSubmit:e=>{e.preventDefault(),oe()},children:(0,R.jsx)(fe,{title:`Account name`,description:`Shown in the provider list and model picker.`,control:(0,R.jsx)(ie,{"aria-label":`Account name`,value:_,disabled:S,onChange:e=>v(e.target.value),placeholder:`e.g. Personal or Work`})})}),N;t[17]!==pe||t[18]!==he?(N=(0,R.jsx)(pe,{children:he}),t[17]=pe,t[18]=he,t[19]=N):N=t[19];let P;t[20]!==u||t[21]!==x||t[22]!==_||t[23]!==r||t[24]!==S?(P=(0,R.jsx)(F,{children:x?(0,R.jsx)(l,{variant:`outline`,onClick:r,children:`Finish later`}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(l,{variant:`outline`,disabled:S,onClick:r,children:`Cancel`}),(0,R.jsx)(l,{type:`submit`,form:`add-codex-account`,disabled:S||!_.trim()||!u,children:S?`Adding account…`:`Continue`})]})}),t[20]=u,t[21]=x,t[22]=_,t[23]=r,t[24]=S,t[25]=P):P=t[25];let z;t[26]!==ue||t[27]!==N||t[28]!==P||t[29]!==j?(z=(0,R.jsxs)(ue,{size:`wide`,children:[j,N,P]}),t[26]=ue,t[27]=N,t[28]=P,t[29]=j,t[30]=z):z=t[30];let _e;return t[31]!==se||t[32]!==z||t[33]!==ce||t[34]!==k?(_e=(0,R.jsx)(se,{open:ce,onOpenChange:k,children:z}),t[31]=se,t[32]=z,t[33]=ce,t[34]=k,t[35]=_e):_e=t[35],_e}var xe=_(u),Se=_(g),Ce=/^[A-Za-z0-9_./:\\-]+$/;function we(e,t,n){return Ce.test(e)&&(n===`windows`||!e.includes(`\\`))?e:n===`windows`?`& '${e.replaceAll(`'`,`''`)}'`:n===`darwin`||n===`linux`?e.startsWith(`~/`)||e.startsWith(`~\\`)?`~/'${e.slice(2).replaceAll(`'`,`'"'"'`)}'`:`'${e.replaceAll(`'`,`'"'"'`)}'`:t}function Te(e){return e===void 0?`checking`:!e.enabled||e.status===`disabled`?`disabled`:!e.installed&&e.status===`warning`&&e.auth.status===`unknown`?`checking`:e.installed?e.auth.status===`unauthenticated`?`signIn`:e.status===`ready`?`ready`:`attention`:`install`}var B={checking:0,disabled:1,install:2,attention:3,signIn:4,ready:5};function V(e){let t=new Map;for(let n of e??[]){let e=t.get(n.driver);(e===void 0||B[Te(n)]>B[Te(e)])&&t.set(n.driver,n)}return t}var Ee={claudeAgent:{windows:`irm https://claude.ai/install.ps1 | iex`,posix:`curl -fsSL https://claude.ai/install.sh | bash`},codex:{windows:`irm https://chatgpt.com/codex/install.ps1 | iex`,posix:`curl -fsSL https://chatgpt.com/codex/install.sh | sh`}};function De(e,t){let n=Ee[e];return t===`windows`?n.windows:n.posix}function Oe(e,t,n){let r=t.providerInstances[e.instanceId];if(e.driver===`claudeAgent`){let e=xe(r?.config??{});return`${we(c(e)?e.value.binaryPath:`claude`,`claude`,n)} auth login`}if(e.driver===`codex`){let e=Se(r?.config??{});return`${we(c(e)?e.value.binaryPath:`codex`,`codex`,n)} login`}return e.driver}var ke={disabled:{dot:`bg-muted-foreground/50`},error:{dot:`bg-destructive`},ready:{dot:`bg-success`},warning:{dot:`bg-warning`}};function H(e){if(!e)return{headline:`Checking provider status`,detail:`Waiting for the server to report installation and authentication details.`};if(!e.enabled||e.status===`disabled`)return{headline:`Disabled`,detail:e.message??`This provider is installed but disabled for new sessions in P4 Code.`};if(!e.installed)return{headline:`Not found`,detail:e.message??`CLI not detected on PATH.`};if(e.auth.status===`unauthenticated`){let t=e.auth.label??e.auth.type;return{headline:t?`Not authenticated · ${t}`:`Not authenticated`,detail:e.message??null}}if(e.status===`warning`)return{headline:`Needs attention`,detail:e.message??`The provider is installed, but the server could not fully verify it.`};if(e.status===`error`)return{headline:`Unavailable`,detail:e.message??`The provider failed its startup checks.`};if(e.auth.status===`authenticated`){let t=e.auth.label??e.auth.type;return{headline:t?`Authenticated · ${t}`:`Authenticated`,detail:e.message??null}}return{headline:`Available`,detail:e.message??null}}function U(e){if(!e)return null;let t=/^agy_acp_server_(\d{4})(\d{2})(\d{2})_\d+(?:_(\w+))?$/.exec(e);if(t){let[,e,n,r,i]=t;return`${e}-${n}-${r}${i?` ${i}`:``}`}return/^\d/.test(e)?`v${e}`:e}var Ae={graceful:`Limited support`,unsupported:`Unsupported version`,broken:`Known broken version`};function je(e,t,n=!0){let r=t?.latestVersionStatus===`broken`||t?.latestVersionStatus===`unsupported`;if(n&&t&&(t.status===`graceful`||t.status===`unsupported`||t.status===`broken`)){let n=t.recommendedVersion,i=U(n)??t.recommendedRange;return{title:Ae[t.status],detail:t.message??(i?`Use ${i} for full support.`:`Update for full support.`),updateCommand:n||r?null:e?.updateCommand??null,emphasis:t.status===`graceful`?`normal`:`strong`,targetVersion:n}}if(!e||e.status===`current`||e.status===`unknown`||r)return null;let i=`Update available`,a=e.latestVersion,o=U(a);return{title:i,detail:e.message??(o?`${i}: install ${o}.`:`${i}: install the latest provider version.`),updateCommand:e.updateCommand,emphasis:`normal`,targetVersion:null}}var Me=()=>void 0;function Ne(e){let t=(0,L.c)(11),[n,r]=(0,I.useState)(!1),i;t[0]===e.provider?i=t[1]:(i=Te(e.provider),t[0]=e.provider,t[1]=i);let a=i,o=e.enabled&&a===`ready`,s=e.provider?.auth.status===`authenticated`,c=a===`checking`,u;t[2]===e.provider?u=t[3]:(u=H(e.provider),t[2]=e.provider,t[3]=u);let f=u,p;return t[4]!==s||t[5]!==c||t[6]!==o||t[7]!==f||t[8]!==e||t[9]!==n?(p=e.mode===`existing`&&e.presentation===`onboarding`?(0,R.jsx)(Le,{title:e.displayName||e.provider?.displayName||`Codex`,description:o?e.provider?.auth.email?.trim()?(0,R.jsxs)(R.Fragment,{children:[`Signed in as`,` `,(0,R.jsx)(he,{value:e.provider.auth.email.trim(),ariaLabel:`Toggle account email visibility`,revealTooltip:`Click to reveal email`,hideTooltip:`Click to hide email`,className:`break-all`}),`.`]}):`Connected with your Codex CLI.`:c?`Checking your Codex CLI...`:e.provider?.installed?f.headline:`Code with your ChatGPT subscription.`,control:o?(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs font-medium text-success-foreground`,children:[(0,R.jsx)(d,{className:`size-3.5`}),`Ready`]}):c?(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Checking...`}):s?(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:f.headline}):(0,R.jsx)(z,{size:`sm`,disabled:e.readOnly,onClick:()=>{r(!0),e.onModeChange(`managed`)},children:`Continue with ChatGPT`}),secondaryControl:!s&&!o&&!c?(0,R.jsx)(l,{size:`sm`,variant:`ghost-muted`,onClick:()=>e.onModeChange(`existing`),children:`Use existing CLI`}):null}):e.mode===`existing`?null:e.provider?.setup===void 0?e.presentation===`onboarding`?(0,R.jsx)(Le,{title:e.displayName||e.provider?.displayName||`Codex`,description:(0,R.jsx)(Ie,{}),control:(0,R.jsx)(l,{size:`sm`,variant:`outline`,className:`min-w-44`,disabled:!0,children:`Open sign-in page`}),secondaryControl:(0,R.jsx)(l,{size:`sm`,variant:`ghost-muted`,disabled:!0,children:`Cancel`})}):(0,R.jsx)(fe,{title:`ChatGPT account`,description:`Preparing sign-in.`}):(0,R.jsx)(Fe,{...e,autoStart:n||e.autoStart===!0,onAutoStartConsumed:()=>{r(!1),e.onAutoStartConsumed?.()}},`${e.environmentId}:${e.instanceId}`),t[4]=s,t[5]=c,t[6]=o,t[7]=f,t[8]=e,t[9]=n,t[10]=p):p=t[10],p}function Pe(e){let t=(0,L.c)(9),{environmentId:n,onClose:r,onAccountCreated:i}=e,a=w(n,s),o;t[0]!==a||t[1]!==n||t[2]!==r?(o=(e,t)=>(0,R.jsx)(Fe,{environmentId:n,instanceId:e,provider:t,mode:`managed`,enabled:!0,readOnly:!a,autoStart:!0,onAutoStartConsumed:Me,onModeChange:Me,onSignInCancelled:r,allowExistingCli:!1},e),t[0]=a,t[1]=n,t[2]=r,t[3]=o):o=t[3];let c;return t[4]!==n||t[5]!==i||t[6]!==r||t[7]!==o?(c=(0,R.jsx)(be,{environmentId:n,onClose:r,onAccountCreated:i,renderSetup:o}),t[4]=n,t[5]=i,t[6]=r,t[7]=o,t[8]=c):c=t[8],c}function Fe({environmentId:e,instanceId:t,provider:n,enabled:r,readOnly:i,onModeChange:a,autoStart:o,onAutoStartConsumed:s,allowExistingCli:c=!0,presentation:u,displayName:f,onSignInCancelled:h}){let g={environmentId:e,input:{instanceId:t}},_=re(C.providerAuthState(g)),te=re(C.providerInstallState(g)),[w,ne]=(0,I.useState)(null),E=re(w?C.chatGptHandoffState(w):null),D=E.data?.phase===`auth`?E.data.state:_.data,[ae,O]=(0,I.useState)(!1),[oe,se]=(0,I.useState)(`chatgpt`),ce=D?.methods?.find(e=>e.id===`chatgpt`)?.accountEmail,le=D?.methods?.find(e=>e.id===oe)?.accountEmail,k=D?.methods?.some(e=>e.id.startsWith(`chatgpt-profile:`)),A=D?.interaction?.type===`browser`?D.interaction.url:D?.authorizationUrl,M=te.data,me=b(e),ge=me!==null&&ue(new URL(me).hostname),F={reportFailure:!1,reportDefect:!1},L=T(C.startProviderAuth,F),ve=T(C.refreshProviders,F),ye=T(C.completeProviderAuth,F),be=T(C.cancelProviderAuth,F),xe=T(C.logoutProviderAuth,F),Se=T(C.startProviderInstall,F),Ce=T(C.cancelProviderInstall,F),we=T(C.chatGptReconnectProfile,F),Te=T(C.chatGptImportProfile,F),B=!w&&(!ge||window.desktopBridge?.receiveProviderAuthCallback!==void 0),V=B&&!window.desktopBridge?.receiveProviderAuthCallback,Ee=x(),De=ee(Ee),Oe=b(Ee),ke=!ge&&Ee&&De?.connection.phase===`connected`&&Oe&&ue(new URL(Oe).hostname)&&(window.desktopBridge!==void 0||ue(window.location.hostname))?Ee:null,H=new URL(window.location.href);H.pathname===`/welcome`&&(H.hash=`agents:${e}`),H.pathname===`/settings/providers`&&H.searchParams.set(`instanceId`,t);let U=V,Ae=(0,I.useId)(),[je,Me]=(0,I.useState)(!1),[Ne,Pe]=(0,I.useState)({flowId:``,value:``}),Fe=Ne.flowId===D?.flowId?Ne.value:``,[W,Re]=(0,I.useState)(!1),[ze,Be]=(0,I.useState)(null),Ve=(0,I.useRef)(!1),[He,Ue]=(0,I.useState)(null),G=(0,I.useRef)(null),K=(0,I.useRef)(!1),We=(0,I.useRef)(null),[Ge,Ke]=(0,I.useState)(!1),q=M?.installedVersion!=null,J=n?.auth.status===`authenticated`,qe=q&&M?.source!==`local`&&M?.version!=null&&M.version!==M.installedVersion,Je=ze!==null&&!J&&(D?.phase===`succeeded`||ze===`handoff`);(0,I.useEffect)(()=>{(J||D?.phase===`failed`||D?.phase===`cancelled`)&&Be(null)},[J,D?.phase]),(0,I.useEffect)(()=>{ze&&D?.phase===`succeeded`&&ve({environmentId:e,input:{instanceId:t}})},[ze,D?.phase,ve,e,t]);let Ye=o&&!Ge,Xe=ze===`sign-in`&&!J&&(D===null||D.phase===`idle`),Ze=Je||Xe||w!==null||D?.phase===`starting`||D?.phase===`waiting`||D?.phase===`verifying`,Y=M?.phase===`downloading`||M?.phase===`extracting`||M?.phase===`verifying`,X=Ye||Ze||W&&!Y,Z=i||!r||W||_.error!==null||te.error!==null,Q=W||Ze||Y,$=(0,I.useCallback)(async(e,t)=>{if(Ve.current)return!1;Ve.current=!0,Re(!0),Ue(null);let n=!1;try{let r=await e();if(r._tag===`Failure`){if(!v(r)){let e=y(r);Ue(e instanceof Error?e.message:`Codex setup failed. Try again.`)}}else n=!0,t?.(r.value)}catch{Ue(`Codex setup failed. Try again.`)}return Ve.current=!1,Re(!1),n},[]),Qe=(0,I.useId)(),$e=(0,I.useRef)(0),et=(0,I.useRef)(null),[tt,nt]=(0,I.useState)(!1),rt=(0,I.useCallback)(async n=>{let r=await $(()=>Te({environmentId:e,input:{instanceId:t,profile:n}}));r&&(Be(`handoff`),ne(null)),nt(!r)},[$,Te,e,t]);(0,I.useEffect)(()=>{if(!w||E.data?.phase!==`finished`)return;let e=w.input.attemptId;et.current!==e&&(et.current=e,rt(E.data.profile))},[w,E.data,rt]),(0,I.useEffect)(()=>{w&&(E.error||E.data?.phase===`auth`&&[`failed`,`cancelled`].includes(E.data.state.phase))&&(Ue(E.data?.phase===`auth`?E.data.state.message??`ChatGPT sign-in could not finish. Try again.`:`ChatGPT sign-in on the primary environment was interrupted. Try again.`),ne(null))},[w,E.data,E.error]);let it=(0,I.useCallback)(()=>(Be(null),w?(ne(null),Promise.resolve()):$(()=>be({environmentId:e,input:{instanceId:t,flowId:D.flowId}}))),[w,$,be,e,t,D]),at=(0,I.useCallback)(async(n=`chatgpt`)=>{if(Ve.current)return;K.current=!0,nt(!1),se(n);let r=new URL(window.location.href);if(r.pathname===`/welcome`&&(r.hash=`agents:${e}`),r.pathname===`/settings/providers`&&r.searchParams.set(`instanceId`,t),ke){let i=`${Qe}:${++$e.current}`;await $(()=>we({environmentId:e,input:{instanceId:t,methodId:n}}),n=>ne({environmentId:ke,input:{instanceId:t,environmentId:e,attemptId:i,returnUrl:r.toString(),profile:n}}))||(K.current=!1);return}await $(()=>L({environmentId:e,input:{instanceId:t,methodId:n,returnUrl:r.toString(),callbackMode:B?`client`:`server`}}),()=>Be(`sign-in`))||(K.current=!1)},[e,t,$,L,B,ke,we,Qe]),ot=(0,I.useCallback)(async(n=`chatgpt`)=>{Z||Q||(q&&!qe?await at(n):(G.current=n,await $(()=>Se({environmentId:e,input:{instanceId:t}}))||(G.current=null)))},[Z,Q,q,qe,at,$,Se,e,t]);(0,I.useEffect)(()=>{!o||Ge||Z||Q||M===null||!n?.setup?.canInstall||(Ke(!0),s(),ot())},[o,Ge,Z,Q,M,n?.setup?.canInstall,s,ot]),(0,I.useEffect)(()=>{if(!(!G.current||W||Y)){if(M?.phase===`failed`||M?.phase===`cancelled`)G.current=null;else if(q){let e=G.current;G.current=null,at(e)}}},[W,Y,M?.phase,q,at]);let st=(0,I.useRef)(null),ct=D?.flowId,lt=(0,I.useCallback)(async n=>{try{let r=window.desktopBridge?.receiveProviderAuthCallback;if(r&&B&&ct){if(st.current===n){await S().shell.openExternal(n);return}st.current=n;let i=await r(n);if(st.current!==n)return;st.current=null,await $(()=>ye({environmentId:e,input:{instanceId:t,flowId:ct,callbackUrl:i}}))}else await S().shell.openExternal(n)}catch{Ue(`Could not finish sign-in on this computer. Try again or paste the redirect URL below.`)}},[B,ct,$,ye,e,t]);(0,I.useEffect)(()=>{if(B&&A&&window.desktopBridge?.cancelProviderAuthCallback)return()=>{st.current===A&&(st.current=null),window.desktopBridge?.cancelProviderAuthCallback?.(A).catch(()=>void 0)}},[B,A]),(0,I.useEffect)(()=>{K.current&&D?.phase===`waiting`&&D.flowId&&A&&We.current!==D.flowId&&(We.current=D.flowId,K.current=!1,V||lt(A))},[D?.phase,D?.flowId,A,lt,V]);let ut=M?.phase===`downloading`?`Downloading ${(M.downloadedBytes/1e6).toFixed(1)}${M.totalBytes===null?``:` of ${(M.totalBytes/1e6).toFixed(1)}`} MB.`:M?.phase===`extracting`?`Installing Codex.`:M?.phase===`verifying`?`Checking Codex.`:q?`${M?.source===`local`?`Using your installed Codex`:`Managed by P4 Code`}${M?.installedVersion?` · v${M.installedVersion}`:``}.`:M?.message??`P4 Code downloads and manages Codex for you.`,dt=Je?`Finishing sign-in...`:Y?ut:X||D?.phase===`failed`||D?.phase===`cancelled`?D?.phase===`waiting`&&le?`Continue as ${le} on OpenAI.`:D?.message??`Finish signing in in your browser.`:J?n?.auth.email?.trim()?(0,R.jsxs)(R.Fragment,{children:[`Signed in as`,` `,(0,R.jsx)(he,{value:n.auth.email.trim(),ariaLabel:`Toggle account email visibility`,revealTooltip:`Click to reveal email`,hideTooltip:`Click to hide email`}),`.`]}):`Signed in with ChatGPT.`:ce??`Use your ChatGPT subscription.`,ft=U&&A&&D?.flowId&&pe(H.toString())?j({authorizationUrl:A,returnUrl:H.toString(),environmentId:e,instanceId:t,flowId:D.flowId},!1):null,pt=(0,R.jsx)(l,{size:`sm`,variant:V?`default`:`outline`,className:u===`onboarding`?`min-w-44`:void 0,disabled:E.data?.phase===`finished`?W||!tt:!A||D?.phase!==`waiting`,onClick:()=>{E.data?.phase===`finished`?rt(E.data.profile):A&<(A)},children:Je?`Finishing sign-in...`:E.data?.phase===`finished`?tt?`Retry connection`:`Finishing sign-in...`:D?.phase===`waiting`?V?`Open ChatGPT sign-in`:`Open sign-in page`:u===`onboarding`?`Open sign-in page`:`Signing in...`}),mt=!w&&D?.phase===`waiting`&&A?(0,R.jsxs)(`div`,{className:`flex w-full flex-col gap-3 text-xs leading-relaxed text-muted-foreground`,children:[(0,R.jsx)(`p`,{children:`If sign-in doesn't return to P4 Code, paste the URL from the final localhost page.`}),(0,R.jsxs)(`form`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,onSubmit:n=>{if(n.preventDefault(),!D.flowId||!Fe.trim())return;let r=Fe.trim(),i=D.flowId;$(()=>ye({environmentId:e,input:{instanceId:t,flowId:i,callbackUrl:r}})).then(e=>{e&&Pe({flowId:i,value:``})})},children:[(0,R.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,R.jsx)(ie,{"aria-label":`ChatGPT sign-in redirect URL`,type:`password`,autoComplete:`off`,placeholder:`Paste the URL from the sign-in tab`,value:Fe,maxLength:16384,disabled:W||i,onChange:e=>Pe({flowId:D.flowId??``,value:e.target.value})})}),(0,R.jsx)(l,{variant:`outline`,type:`submit`,disabled:W||i||!Fe.trim(),children:`Connect`})]}),V?null:(0,R.jsx)(`div`,{children:(0,R.jsxs)(l,{size:`xs`,variant:`ghost-muted`,onClick:()=>void S().shell.openExternal(A),children:[`Try sign-in in your browser`,(0,R.jsx)(p,{className:`size-3.5`})]})}),ft?(0,R.jsxs)(`details`,{children:[(0,R.jsx)(`summary`,{className:`cursor-pointer`,children:`Other ways to connect`}),(0,R.jsx)(l,{className:`mt-2`,size:`sm`,variant:`outline`,render:(0,R.jsx)(`a`,{href:ft}),children:`Use P4 Code desktop for automatic return`})]}):null]}):null,ht=e=>mt?(0,R.jsx)(P,{open:je,children:(0,R.jsx)(N,{children:(0,R.jsx)(`div`,{id:Ae,className:m(`w-full border-t border-border/50 pt-3`,e),children:mt})})}):null,gt=U?mt:mt?(0,R.jsxs)(`div`,{className:`text-xs leading-relaxed text-muted-foreground`,children:[(0,R.jsx)(Ie,{label:`Having trouble signing in?`,expanded:je,controls:Ae,onToggle:()=>Me(e=>!e)}),ht(`mt-3`)]}):null,_t=(0,R.jsx)(_e,{open:ae,methods:D?.methods??[],onClose:()=>O(!1),onSelect:e=>{O(!1),ot(D?.methods?.some(t=>t.id===e)?e:`chatgpt-change-account`)}}),vt=D?.phase===`idle`&&D.message?.startsWith(`Signed out locally.`)?D.message:null;if(u===`onboarding`){let r=vt??He??(_.error||te.error?`Could not read setup status. Reconnect and try again.`:M?.phase===`failed`?M.message:null);return(0,R.jsxs)(R.Fragment,{children:[_t,(0,R.jsxs)(Le,{title:f||n?.displayName||`Codex`,description:Y?ut:J?n?.auth.email?.trim()?(0,R.jsxs)(R.Fragment,{children:[`Signed in as`,` `,(0,R.jsx)(he,{value:n.auth.email.trim(),ariaLabel:`Toggle account email visibility`,revealTooltip:`Click to reveal email`,hideTooltip:`Click to hide email`,className:`break-all`}),`.`]}):`Connected to ChatGPT.`:mt&&!U?(0,R.jsx)(Ie,{expanded:je,controls:Ae,onToggle:()=>Me(e=>!e)}):Ye||Xe||D?.phase===`starting`||D?.phase===`waiting`||W&&!Y?(0,R.jsx)(Ie,{}):X||D?.phase===`failed`||D?.phase===`cancelled`?dt:`Code with your ChatGPT subscription.`,control:J&&!Q?(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs font-medium text-success-foreground`,children:[(0,R.jsx)(d,{className:`size-3.5`}),`Ready`]}):X?pt:(0,R.jsx)(z,{size:`sm`,disabled:Z||Q||(q?!n?.setup?.canAuthenticate:!n?.setup?.canInstall),onClick:()=>{k?O(!0):ot()},children:Y||W?`Setting up...`:k?`Reconnect account`:`Continue with ChatGPT`}),secondaryControl:X&&!Je||Y?(0,R.jsx)(l,{size:`sm`,variant:`ghost-muted`,disabled:W||i,onClick:()=>{K.current=!1,G.current=null,w||X&&D?.flowId?it():M?.operationId&&$(()=>Ce({environmentId:e,input:{instanceId:t,operationId:M.operationId}}))},children:`Cancel`}):!X&&!J&&k?(0,R.jsx)(l,{size:`sm`,variant:`ghost-muted`,disabled:Z||Q,onClick:()=>void ot(`chatgpt-change-account`),children:`Use a different account`}):!X&&!J&&c?(0,R.jsx)(l,{size:`sm`,variant:`ghost-muted`,disabled:i||Q,onClick:()=>a(`existing`),children:`Use existing CLI`}):null,children:[U?gt:ht(),r?(0,R.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:r}):null]})]})}return(0,R.jsxs)(`section`,{"aria-label":`Codex setup`,className:`divide-y divide-border/50`,children:[_t,(0,R.jsx)(fe,{title:`ChatGPT account`,description:dt,control:(0,R.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:X?(0,R.jsxs)(R.Fragment,{children:[pt,!Je&&(0,R.jsx)(l,{size:`sm`,variant:`ghost`,disabled:W||i,onClick:()=>{(w||D?.flowId)&&(K.current=!1,it(),h?.())},children:`Cancel`})]}):Y?(0,R.jsx)(l,{size:`sm`,variant:`ghost`,disabled:W||i,onClick:()=>{M?.operationId&&(G.current=null,$(()=>Ce({environmentId:e,input:{instanceId:t,operationId:M.operationId}})))},children:`Cancel`}):J?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(l,{size:`sm`,variant:`outline`,disabled:Z||Q,onClick:()=>O(!0),children:`Change account`}),(0,R.jsx)(l,{size:`sm`,variant:`ghost`,disabled:Z||Q,onClick:()=>void $(()=>xe(g)),children:`Disconnect`})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(z,{size:`sm`,disabled:Z||Q||(q?!n?.setup?.canAuthenticate:!n?.setup?.canInstall),onClick:()=>{k?O(!0):ot()},children:W?`Setting up...`:k?`Reconnect account`:`Continue with ChatGPT`}),k?(0,R.jsx)(l,{size:`sm`,variant:`ghost`,disabled:Z||Q,onClick:()=>void ot(`chatgpt-change-account`),children:`Use a different account`}):null]})})}),J?(0,R.jsx)(`div`,{className:`flex justify-end px-3 py-1 sm:px-4`,children:(0,R.jsx)(de,{})}):null,vt?(0,R.jsx)(`p`,{role:`alert`,className:`px-3 py-2 text-xs text-muted-foreground sm:px-4`,children:vt}):null,gt?(0,R.jsx)(`div`,{className:`px-3 py-3 sm:px-4`,children:gt}):null,He||_.error||te.error||M?.phase===`failed`?(0,R.jsx)(`p`,{role:`alert`,className:`px-3 py-2 text-xs text-destructive sm:px-4`,children:He??(M?.phase===`failed`?M.message:`Could not read Codex setup status. Reconnect and try again.`)}):null]})}function W(e){let t=(0,L.c)(20),{environmentId:n,instanceId:r,provider:i}=e,a;t[0]!==n||t[1]!==r?(a=C.providerInstallState({environmentId:n,input:{instanceId:r}}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=re(a),s=o.data?.executablePath??``,c=o.error?`Could not read runtime path`:`Not installed`,l;t[3]!==s||t[4]!==c?(l=(0,R.jsx)(fe,{title:`Binary path`,description:`Selected by P4 Code.`,control:(0,R.jsx)(`div`,{className:`w-full sm:w-80`,children:(0,R.jsx)(ie,{"aria-label":`Codex binary path`,value:s,title:s,placeholder:c,disabled:!0})})}),t[3]=s,t[4]=c,t[5]=l):l=t[5];let u=i?.runtimePaths?.homePath??``,d=i?.runtimePaths?.homePath,f;t[6]!==u||t[7]!==d?(f=(0,R.jsx)(fe,{title:`CODEX_HOME path`,description:`Shared Codex config, sessions, and state.`,control:(0,R.jsx)(`div`,{className:`w-full sm:w-80`,children:(0,R.jsx)(ie,{"aria-label":`Codex home path`,value:u,title:d,placeholder:`Unavailable`,disabled:!0})})}),t[6]=u,t[7]=d,t[8]=f):f=t[8];let p=i?.runtimePaths?.shadowHomePath?`Account-specific home sharing the Codex state above.`:`This instance uses the shared Codex home directly.`,m=i?.runtimePaths?.shadowHomePath??``,h=i?.runtimePaths?.shadowHomePath??void 0,g=i?.runtimePaths?`Not used`:`Unavailable`,_;t[9]!==g||t[10]!==m||t[11]!==h?(_=(0,R.jsx)(`div`,{className:`w-full sm:w-80`,children:(0,R.jsx)(ie,{"aria-label":`Codex shadow home path`,value:m,title:h,placeholder:g,disabled:!0})}),t[9]=g,t[10]=m,t[11]=h,t[12]=_):_=t[12];let v;t[13]!==_||t[14]!==p?(v=(0,R.jsx)(fe,{title:`Shadow home path`,description:p,control:_}),t[13]=_,t[14]=p,t[15]=v):v=t[15];let y;return t[16]!==v||t[17]!==l||t[18]!==f?(y=(0,R.jsxs)(R.Fragment,{children:[l,f,v]}),t[16]=v,t[17]=l,t[18]=f,t[19]=y):y=t[19],y}function Ie(e){let t=(0,L.c)(10),{label:n,expanded:r,controls:i,onToggle:o}=e,s=n===void 0?`Complete sign-in in your browser.`:n,c=r!==void 0&&r;if(!o){let e;return t[0]===s?e=t[1]:(e=(0,R.jsx)(`div`,{className:`leading-relaxed`,children:s}),t[0]=s,t[1]=e),e}let l=`size-3 shrink-0 ${c?`rotate-90`:``}`,u;t[2]===l?u=t[3]:(u=(0,R.jsx)(a,{"aria-hidden":!0,className:l}),t[2]=l,t[3]=u);let d;return t[4]!==i||t[5]!==c||t[6]!==s||t[7]!==o||t[8]!==u?(d=(0,R.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded-sm text-left leading-relaxed outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,"aria-label":`Having trouble signing in?`,"aria-expanded":c,"aria-controls":i,onClick:o,children:[s,u]}),t[4]=i,t[5]=c,t[6]=s,t[7]=o,t[8]=u,t[9]=d):d=t[9],d}function Le(e){let t=(0,L.c)(21),{title:n,description:r,control:i,secondaryControl:a,children:o}=e,s;t[0]===o?s=t[1]:(s=I.Children.toArray(o),t[0]=o,t[1]=s);let c=s,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,R.jsx)(k,{className:`size-5 shrink-0 fill-foreground`}),t[2]=l):l=t[2];let u;t[3]===n?u=t[4]:(u=(0,R.jsx)(`h3`,{className:`text-sm font-medium`,children:n}),t[3]=n,t[4]=u);let d;t[5]===r?d=t[6]:(d=(0,R.jsx)(`div`,{className:`mt-0.5 text-xs leading-relaxed text-muted-foreground`,children:r}),t[5]=r,t[6]=d);let f;t[7]!==u||t[8]!==d?(f=(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[u,d]}),t[7]=u,t[8]=d,t[9]=f):f=t[9];let p;t[10]!==i||t[11]!==a?(p=i||a?(0,R.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 has-[button]:w-full has-[button]:flex-col-reverse has-[button]:items-end sm:has-[button]:w-auto sm:has-[button]:flex-row sm:has-[button]:items-center`,children:[a,i]}):null,t[10]=i,t[11]=a,t[12]=p):p=t[12];let m;t[13]!==f||t[14]!==p?(m=(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[l,f,p]}),t[13]=f,t[14]=p,t[15]=m):m=t[15];let h;t[16]===c?h=t[17]:(h=c.length>0?(0,R.jsx)(`div`,{className:`ml-8 mt-2 flex flex-wrap items-center gap-2`,children:c}):null,t[16]=c,t[17]=h);let g;return t[18]!==m||t[19]!==h?(g=(0,R.jsxs)(`div`,{className:`rounded-lg border border-border bg-background px-4 py-4`,children:[m,h]}),t[18]=m,t[19]=h,t[20]=g):g=t[20],g}function Re(e){return typeof e==`object`&&e&&`setupMode`in e&&e.setupMode===`managed`?`managed`:`existing`}export{ke as a,U as c,Oe as d,V as f,Ne as i,Te as l,Pe as n,H as o,z as p,W as r,je as s,Re as t,De as u};
|
|
2
|
-
//# sourceMappingURL=CodexSetupSection.logic-CNbTXxKb.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as e,t}from"./react-DH3P2YXY.js";import{n,t as r}from"./jsx-runtime-BnjsACtP.js";import{$_ as i,dr as a,kd as o,t as s}from"./utils-BoMYW9A3.js";import{d as c,l,v as u}from"./TooltipViewport-ZmVCer7P.js";import{t as d}from"./spinner-CSTrcxhP.js";import{i as f,n as p}from"./session-C949OsEI.js";import{t as m}from"./use-atom-command-DA6OG-Qk.js";import{n as h}from"./dialog-CBBxT1gk.js";import{t as g}from"./device-DmH6IHQ4.js";import{da as _,fa as v,ma as ee,ua as te,va as y}from"./main-BWh6jqG2.js";var b=n(),x=e(t(),1),S=e(r(),1);function C(e){let t=(0,b.c)(15),{state:n,environmentId:r}=e,i=m(g.list),[o,s]=(0,x.useState)(null);if(n.hostStatus===`disabled`)return null;let c;if(t[0]!==r||t[1]!==o||t[2]!==i||t[3]!==n.hostStatuses||t[4]!==n.hosts||t[5]!==n.supportsHostRetry){let e;t[7]!==r||t[8]!==o||t[9]!==i||t[10]!==n.hostStatuses||t[11]!==n.supportsHostRetry?(e=e=>{let t=n.hostStatuses[e.id];if(!t||![`installing`,`starting`,`failed`].includes(t.status))return null;let c=t.status===`failed`;return(0,S.jsxs)(`div`,{role:c?`alert`:`status`,className:`flex items-start gap-3 rounded-md border border-border/60 px-3 py-2 text-xs`,children:[(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`p`,{className:`font-medium`,children:e.label}),(0,S.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-muted-foreground`,children:t.detail??(c?`Device support could not start.`:t.status===`installing`?`Installing device tools…`:`Starting device tools…`)}),c?(0,S.jsx)(`p`,{className:`mt-1 text-muted-foreground`,children:`Check the host connection and network access, then retry. Your device settings are saved.`}):null]}),c&&n.supportsHostRetry?(0,S.jsx)(a,{size:`compact`,variant:`outline`,disabled:o!==null,onClick:()=>{s(e.id),i({environmentId:r,input:{retryHostId:e.id}}).finally(()=>s(null))},children:o===e.id?`Retrying…`:`Retry`}):null]},e.id)},t[7]=r,t[8]=o,t[9]=i,t[10]=n.hostStatuses,t[11]=n.supportsHostRetry,t[12]=e):e=t[12],c=n.hosts.map(e),t[0]=r,t[1]=o,t[2]=i,t[3]=n.hostStatuses,t[4]=n.hosts,t[5]=n.supportsHostRetry,t[6]=c}else c=t[6];let l;return t[13]===c?l=t[14]:(l=(0,S.jsx)(`div`,{className:`space-y-2`,children:c}),t[13]=c,t[14]=l),l}var w=e=>e===`ios`?`iOS`:`Android`,T=`Enable this environment to open simulators and emulators, whether they run here or on a remote device host.`,E=`Allow new agent sessions in this environment to start and control local and remote devices, with required tools set up automatically.`,D=e=>Object.values(e.hostStatuses).some(e=>e.status===`ready`&&e.androidDiscoveryIncomplete);function O(e){let t=Object.values(e.hostStatuses).map(e=>e.status),n=e.hostStatus===`ready`||t.includes(`ready`);return{ready:n,busy:!n&&[e.hostStatus,...t].some(e=>e===`installing`||e===`starting`)}}function k(e,t){let n=e.devices.some(e=>e.platform===t);if(t===`android`&&!n&&D(e))return{ready:!1,message:`The Android device list may be incomplete. Check the device host and try again.`};let r=e.hosts.flatMap(e=>e.platforms.filter(e=>e.platform===t).map(t=>({...t,host:e}))),i=r.filter(e=>e.available).map(e=>e.host);if(i.length===0)return{ready:!1,message:r[0]?.reason??`${w(t)} support was not detected.`};if(i.filter(t=>e.hostStatuses[t.id]?.status===`ready`||t.kind===`local`&&e.hostStatus===`ready`).length>0&&!n)return{ready:!1,message:t===`ios`?`Xcode is installed, but no iOS Simulator is available. Install a runtime in Xcode Settings → Components.`:`The Android SDK is installed, but no virtual device exists. Create one in Android Studio → Device Manager.`};let a=i.every(e=>e.kind!==`local`)?i[0]:void 0,o=a?` on ${a.label}`:``;return{ready:!0,message:a?.kind===`eas`?`${a.label} starts iOS Simulators in the cloud with EAS Simulator.`:t===`ios`?`Xcode and iOS Simulator are available${o}.`:`The Android SDK and Emulator are available${o}.`}}function A(e){let t=(0,b.c)(75),n=f(e.environmentId,i),r=m(g.configure),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={reportFailure:!1},t[0]=o):o=t[0];let c=m(g.list,o),[l,u]=(0,x.useState)(null),[d,w]=(0,x.useState)(0),D=e.state.hostStatus!==`disabled`,k;t[1]===e.state?k=t[2]:(k=O(e.state),t[1]=e.state,t[2]=k);let{ready:A,busy:j}=k,F;t[3]===e.state.hosts?F=t[4]:(F=e.state.hosts.some(ne),t[3]=e.state.hosts,t[4]=F);let I=F,L,R;t[5]!==D||t[6]!==c||t[7]!==e.environmentId?(L=()=>{D&&c({environmentId:e.environmentId,input:{}})},R=[D,c,e.environmentId],t[5]=D,t[6]=c,t[7]=e.environmentId,t[8]=L,t[9]=R):(L=t[8],R=t[9]),(0,x.useEffect)(L,R);let z;t[10]!==r||t[11]!==e?(z=async(t,n)=>{if(!p(e.environmentId,`settings:write`))return;u(t);let i=await r({environmentId:e.environmentId,input:n});u(null),t===`complete`&&i._tag===`Success`&&e.onComplete?.()},t[10]=r,t[11]=e,t[12]=z):z=t[12];let B=z,V;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(V=[`Device hub`,`Simulators`,`Agent access`],t[13]=V):V=t[13];let H;t[14]!==j||t[15]!==l||t[16]!==d?(H=e=>j||l!==null||e>d,t[14]=j,t[15]=l,t[16]=d,t[17]=H):H=t[17];let U;t[18]!==d||t[19]!==H?(U=(0,S.jsx)(_,{title:`Set up devices`,description:`Review what runs on this environment before using simulators and emulators.`,children:(0,S.jsx)(ee,{steps:V,currentStep:d,onStepChange:w,isStepDisabled:H})}),t[18]=d,t[19]=H,t[20]=U):U=t[20];let W;t[21]!==e.environmentId||t[22]!==e.state?(W=(0,S.jsx)(C,{state:e.state,environmentId:e.environmentId}),t[21]=e.environmentId,t[22]=e.state,t[23]=W):W=t[23];let G;t[24]!==j||t[25]!==n||t[26]!==D||t[27]!==l||t[28]!==e.state||t[29]!==d||t[30]!==B?(G=d===0?(0,S.jsxs)(`section`,{className:`space-y-3 text-sm`,children:[(0,S.jsx)(`h3`,{className:`font-medium`,children:`Enable the device hub`}),(0,S.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,S.jsx)(`p`,{className:`text-muted-foreground`,children:T}),(0,S.jsx)(y,{checked:D,disabled:!n||j||l!==null,"aria-label":`Enable device hub`,onCheckedChange:e=>void B(`hub`,{enabled:!!e,...e?{}:{agentAccessEnabled:!1}})})]}),(0,S.jsx)(M,{state:e.state,pending:l===`hub`||j&&l!==`agent`})]}):null,t[24]=j,t[25]=n,t[26]=D,t[27]=l,t[28]=e.state,t[29]=d,t[30]=B,t[31]=G):G=t[31];let K;t[32]!==j||t[33]!==D||t[34]!==c||t[35]!==I||t[36]!==l||t[37]!==e.environmentId||t[38]!==e.state||t[39]!==d?(K=d===1||d===0&&D&&I?(0,S.jsxs)(`section`,{className:s(`space-y-3 text-sm`,d===0&&`mt-4`),children:[(0,S.jsx)(`h3`,{className:`font-medium`,children:`Check simulator support`}),(0,S.jsx)(N,{state:e.state,checking:l===`check`,disabled:!D||j||l!==null,onCheck:()=>{u(`check`),c({environmentId:e.environmentId,input:{}}).finally(()=>u(null))}})]}):null,t[32]=j,t[33]=D,t[34]=c,t[35]=I,t[36]=l,t[37]=e.environmentId,t[38]=e.state,t[39]=d,t[40]=K):K=t[40];let q;t[41]!==j||t[42]!==n||t[43]!==D||t[44]!==l||t[45]!==e.state||t[46]!==d||t[47]!==B?(q=d===2?(0,S.jsxs)(`section`,{className:`space-y-3 text-sm`,children:[(0,S.jsx)(`h3`,{className:`font-medium`,children:`Allow agent control`}),(0,S.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,S.jsx)(`p`,{className:`text-muted-foreground`,children:E}),(0,S.jsx)(y,{checked:e.state.agentAccessEnabled,disabled:!n||!D||j||l!==null,"aria-label":`Allow agents to control devices`,onCheckedChange:e=>void B(`agent`,{agentAccessEnabled:!!e})})]}),(0,S.jsx)(P,{state:e.state,pending:l===`agent`}),(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Leave this off to keep manual device controls without giving agents access.`})]}):null,t[41]=j,t[42]=n,t[43]=D,t[44]=l,t[45]=e.state,t[46]=d,t[47]=B,t[48]=q):q=t[48];let J;t[49]!==e.state.hostStatus||t[50]!==e.state.hostStatusDetail?(J=e.state.hostStatus===`failed`&&e.state.hostStatusDetail?(0,S.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs text-destructive`,children:e.state.hostStatusDetail}):null,t[49]=e.state.hostStatus,t[50]=e.state.hostStatusDetail,t[51]=J):J=t[51];let Y;t[52]!==G||t[53]!==K||t[54]!==q||t[55]!==J||t[56]!==W?(Y=(0,S.jsxs)(v,{children:[W,G,K,q,J]}),t[52]=G,t[53]=K,t[54]=q,t[55]=J,t[56]=W,t[57]=Y):Y=t[57];let X;t[58]!==j||t[59]!==l||t[60]!==d?(X=d===0?(0,S.jsx)(h,{render:(0,S.jsx)(a,{variant:`outline`}),children:`Cancel`}):(0,S.jsx)(a,{variant:`outline`,disabled:j||l!==null,onClick:()=>w(d-1),children:`Back`}),t[58]=j,t[59]=l,t[60]=d,t[61]=X):X=t[61];let Z;t[62]!==n||t[63]!==l||t[64]!==A||t[65]!==d||t[66]!==B?(Z=d<2?(0,S.jsx)(a,{disabled:!A||l!==null,onClick:()=>w(d+1),children:`Continue`}):(0,S.jsx)(a,{disabled:!n||!A||l!==null,onClick:()=>void B(`complete`,{onboardingCompleted:!0}),children:l===`complete`?`Saving…`:`Done`}),t[62]=n,t[63]=l,t[64]=A,t[65]=d,t[66]=B,t[67]=Z):Z=t[67];let Q;t[68]!==X||t[69]!==Z?(Q=(0,S.jsxs)(te,{children:[X,Z]}),t[68]=X,t[69]=Z,t[70]=Q):Q=t[70];let $;return t[71]!==Y||t[72]!==Q||t[73]!==U?($=(0,S.jsxs)(S.Fragment,{children:[U,Y,Q]}),t[71]=Y,t[72]=Q,t[73]=U,t[74]=$):$=t[74],$}function ne(e){return e.kind===`local`&&!e.platforms.some(j)}function j(e){return e.available}function M(e){let t=(0,b.c)(5),{state:n,pending:r,compact:i}=e,a=i!==void 0&&i;if(!r&&!O(n).ready)return null;let s;t[0]===r?s=t[1]:(s=r?(0,S.jsx)(d,{size:`xs`}):(0,S.jsx)(o,{className:`size-3 text-success`}),t[0]=r,t[1]=s);let c=r?n.hostStatus===`installing`?a?`Installing…`:`Installing device hub…`:n.hostStatus===`starting`?a?`Starting…`:`Starting device hub…`:a?`Updating…`:`Updating device hub…`:`Device hub is ready.`,l;return t[2]!==s||t[3]!==c?(l=(0,S.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[s,c]}),t[2]=s,t[3]=c,t[4]=l):l=t[4],l}function N(e){let t=(0,b.c)(20),n;t[0]===e.state?n=t[1]:(n=k(e.state,`ios`),t[0]=e.state,t[1]=n);let r;t[2]===n?r=t[3]:(r=(0,S.jsx)(I,{platform:`iOS`,status:n}),t[2]=n,t[3]=r);let i;t[4]===e.state?i=t[5]:(i=k(e.state,`android`),t[4]=e.state,t[5]=i);let o;t[6]===i?o=t[7]:(o=(0,S.jsx)(I,{platform:`Android`,status:i}),t[6]=i,t[7]=o);let s;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`You can use either platform. Fixing a missing platform does not block the other one.`}),t[8]=s):s=t[8];let c;t[9]===e.checking?c=t[10]:(c=e.checking?(0,S.jsx)(d,{size:`xs`}):null,t[9]=e.checking,t[10]=c);let l=e.checking?`Checking…`:`Check again`,u;t[11]!==e.disabled||t[12]!==e.onCheck||t[13]!==c||t[14]!==l?(u=(0,S.jsxs)(a,{size:`compact`,variant:`outline`,disabled:e.disabled,onClick:e.onCheck,children:[c,l]}),t[11]=e.disabled,t[12]=e.onCheck,t[13]=c,t[14]=l,t[15]=u):u=t[15];let f;return t[16]!==r||t[17]!==o||t[18]!==u?(f=(0,S.jsxs)(`div`,{className:`space-y-3`,children:[r,o,s,u]}),t[16]=r,t[17]=o,t[18]=u,t[19]=f):f=t[19],f}function P(e){let t=(0,b.c)(4);if(e.pending){let n=e.state.hostStatus===`installing`?e.compact?`Installing…`:`Installing agent tools…`:e.state.hostStatus===`starting`?e.compact?`Starting…`:`Starting agent tools…`:e.compact?`Updating…`:`Updating agent access…`,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,S.jsx)(d,{size:`xs`}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,S.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[r,n]}),t[1]=n,t[2]=i),i}if(e.state.agentAccessEnabled&&O(e.state).ready&&e.state.hosts.some(F)){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,S.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,S.jsx)(o,{className:`size-3 text-success`}),`Agent tools are ready.`]}),t[3]=e):e=t[3],e}return null}function F(e){return e.agentDeviceInstalled}function I(e){let t=(0,b.c)(21),n=!e.compact&&`rounded-md border border-border/60 px-3 py-2`,r;t[0]===n?r=t[1]:(r=s(`flex gap-2`,n),t[0]=n,t[1]=r);let i=e.status.ready?`text-success`:`text-muted-foreground`,a;t[2]===i?a=t[3]:(a=s(`mt-0.5 size-4 shrink-0`,i),t[2]=i,t[3]=a);let o=e.status.ready?c:u,d;t[4]!==a||t[5]!==o?(d=(0,S.jsx)(l,{className:a,icon:o}),t[4]=a,t[5]=o,t[6]=d):d=t[6];let f=e.compact&&e.status.ready&&`flex items-center gap-2`,p;t[7]===f?p=t[8]:(p=s(f),t[7]=f,t[8]=p);let m;t[9]===e.platform?m=t[10]:(m=(0,S.jsx)(`p`,{className:`font-medium`,children:e.platform}),t[9]=e.platform,t[10]=m);let h=e.compact&&e.status.ready?`Ready`:e.status.message,g;t[11]===h?g=t[12]:(g=(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:h}),t[11]=h,t[12]=g);let _;t[13]!==g||t[14]!==p||t[15]!==m?(_=(0,S.jsxs)(`div`,{className:p,children:[m,g]}),t[13]=g,t[14]=p,t[15]=m,t[16]=_):_=t[16];let v;return t[17]!==r||t[18]!==_||t[19]!==d?(v=(0,S.jsxs)(`div`,{className:r,children:[d,_]}),t[17]=r,t[18]=_,t[19]=d,t[20]=v):v=t[20],v}export{E as a,D as c,I as i,k as l,M as n,T as o,A as r,O as s,P as t,C as u};
|
|
2
|
-
//# sourceMappingURL=DeviceSetup-D8qb_qBj.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as e,t}from"./react-DH3P2YXY.js";import{t as n}from"./jsx-runtime-BnjsACtP.js";import{t as r}from"./FieldControl-BHe6unoZ.js";var i=e(t()),a=e(n()),o=i.forwardRef(function(e,t){return(0,a.jsx)(r,{ref:t,...e})});export{o as t};
|
|
2
|
-
//# sourceMappingURL=Input-Cv-TKh6s.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./O65XPQGZ-BEfVfDlS.js";export{e as flowchart};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as e,t}from"./react-DH3P2YXY.js";import{n,t as r}from"./jsx-runtime-BnjsACtP.js";import{$n as i,D as a,Ed as o,Fg as s,Hf as c,Jn as l,Jo as u,Ko as d,Op as f,Qn as p,Qo as m,Rf as h,Sp as g,Tp as _,Uf as v,Wo as y,Y_ as b,Yn as x,Yp as S,Zn as C,ar as w,cr as T,dr as E,ec as D,im as ee,kg as O,lr as k,nd as A,nr as j,od as M,of as N,rh as P,rr as te,sd as F,sr as I,t as ne,tm as L,tr as R,ur as z}from"./utils-BoMYW9A3.js";import{R as re,W as B}from"./runtime-DR7JxgbQ.js";import{b as ie}from"./entities-Bqo0n1Pb.js";import{it as V}from"./ChatMarkdown-9gWM0ED9.js";import{i as H}from"./toast-B84QdqqM.js";import{C as ae,O as oe,S as U,q as W,r as se}from"./useSettings-CaJMqrvF.js";import{i as ce,n as G}from"./session-C949OsEI.js";import{t as le}from"./use-atom-command-DA6OG-Qk.js";import{u as ue}from"./rightPanelStore-D3KOmuPa.js";import{t as de}from"./toastHelpers-DxXYm50b.js";import{M as K,j as q}from"./PanelLayoutControls-4VFKEoHg.js";import{o as fe}from"./timestampFormat-wac2e_Jz.js";import{a as pe,n as me,t as he}from"./tooltip-D-GRl-oZ.js";import{a as ge,o as _e,r as ve,t as ye}from"./empty-FOL5U4KY.js";import{n as be,t as xe}from"./discovery-list-CrJrW6_m.js";import{t as Se}from"./observeResize-3Vj9DYOV.js";import{T as Ce,a as we,b as Te,f as Ee,i as De,n as Oe,o as ke,r as Ae,t as je,u as Me,w as Ne}from"./browserHistoryStore-tYgeZygn.js";import{n as Pe}from"./openFileInPreview-BBWCOLh_.js";import{t as Fe}from"./preview-BYnEURcB.js";import{a as Ie,i as Le,r as Re,t as ze}from"./preview-DGdQ5Ycc.js";import{Ai as Be,Hi as Ve,Ii as He,Ki as Ue,Li as We,Mi as Ge,Ni as Ke,Oa as qe,Ri as Je,Ui as J,Vi as Ye,Xi as Y,ga as Xe,ha as Ze,ji as Qe,ki as $e,qi as X}from"./main-BWh6jqG2.js";import{a as et,c as tt,d as nt,f as rt,i as it,l as at,n as ot,o as st,r as ct,s as lt,u as ut}from"./_chat-1QGQLbCc.js";var Z=e(t(),1),Q=n(),dt=`data:image/png;base64,`;function ft(e){if(!e.screenshot)return{status:`none`};try{let{dataUrl:t}=e.screenshot;if(!t.startsWith(dt))return{status:`failed`};let n=Y(t,`preview-annotation-${e.id}.png`,`image/png`);return n.size>0?{status:`captured`,file:n}:{status:`failed`}}catch{return{status:`failed`}}}var $=e(r(),1),pt=()=>{};function mt(e){let t=(0,Q.c)(79),{url:n,loading:r,canGoBack:i,canGoForward:a,refreshDisabled:s,inputDisabled:c,focusUrlNonce:l,onBack:u,onForward:d,onRefresh:p,onSubmit:m,onOpenInBrowser:h,onCapture:g,captureDisabled:_,recording:v,onSeparateWindow:y,separateWindow:b,separateWindowDisabled:x,onPickElement:S,pickActive:C,pickDisabled:w,pickDisabledReason:T,trailingActions:D,leadingActions:ee}=e,O=(0,Z.useRef)(null),[k,j]=(0,Z.useState)(n),[P,te]=(0,Z.useState)(!1),I,L;t[0]===l?(I=t[1],L=t[2]):(I=()=>{if(l==null)return;let e=O.current;e&&e.focus()},L=[l],t[0]=l,t[1]=I,t[2]=L),(0,Z.useEffect)(I,L);let R;t[3]!==k||t[4]!==m?(R=e=>{e?.preventDefault();let t=k.trim();t.length!==0&&(m(t),O.current?.blur())},t[3]=k,t[4]=m,t[5]=R):R=t[5];let z=R,re=i?u:pt,B=!i,ie;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsx)(M,{}),t[6]=ie):ie=t[6];let V;t[7]!==re||t[8]!==B?(V=(0,$.jsx)(E,{variant:`ghost`,size:`icon-xs`,onClick:re,disabled:B,"aria-label":`Back`,type:`button`,children:ie}),t[7]=re,t[8]=B,t[9]=V):V=t[9];let H=a?d:pt,ae=!a,oe;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(F,{}),t[10]=oe):oe=t[10];let U;t[11]!==H||t[12]!==ae?(U=(0,$.jsx)(E,{variant:`ghost`,size:`icon-xs`,onClick:H,disabled:ae,"aria-label":`Forward`,type:`button`,children:oe}),t[11]=H,t[12]=ae,t[13]=U):U=t[13];let W;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,$.jsx)(`span`,{"aria-hidden":!0,className:`mx-0.5 h-4 w-px bg-border`}),t[14]=W):W=t[14];let se=s?pt:p,ce=r?`Stop`:`Refresh`,G;t[15]!==s||t[16]!==se||t[17]!==ce?(G=(0,$.jsx)(E,{variant:`ghost`,size:`icon-xs`,onClick:se,disabled:s,"aria-label":ce,type:`button`}),t[15]=s,t[16]=se,t[17]=ce,t[18]=G):G=t[18];let le;t[19]===r?le=t[20]:(le=(0,$.jsx)(qe,{refreshing:r}),t[19]=r,t[20]=le);let ue;t[21]!==G||t[22]!==le?(ue=(0,$.jsx)(pe,{render:G,children:le}),t[21]=G,t[22]=le,t[23]=ue):ue=t[23];let de=r?`Loading…`:`Refresh`,K;t[24]===de?K=t[25]:(K=(0,$.jsx)(me,{children:de}),t[24]=de,t[25]=K);let q;t[26]!==ue||t[27]!==K?(q=(0,$.jsxs)(he,{children:[ue,K]}),t[26]=ue,t[27]=K,t[28]=q):q=t[28];let fe;t[29]!==U||t[30]!==q||t[31]!==V?(fe=(0,$.jsxs)(`div`,{className:`surface-glass flex h-8 shrink-0 items-center gap-0.5 rounded-full border border-border/60 px-1 shadow-sm [&_button]:rounded-full`,role:`group`,"aria-label":`Navigation`,children:[V,U,W,q]}),t[29]=U,t[30]=q,t[31]=V,t[32]=fe):fe=t[32];let ge=P?k:n,_e;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(_e=e=>j(e.target.value),t[33]=_e):_e=t[33];let ve;t[34]===n?ve=t[35]:(ve=()=>{j(n),te(!0),queueMicrotask(()=>O.current?.select())},t[34]=n,t[35]=ve);let ye;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(ye=()=>{te(!1)},t[36]=ye):ye=t[36];let be;t[37]!==z||t[38]!==n?(be=e=>{e.key===`Enter`&&z(e),e.key===`Escape`&&(e.preventDefault(),j(n),O.current?.blur())},t[37]=z,t[38]=n,t[39]=be):be=t[39];let xe;t[40]!==c||t[41]!==ge||t[42]!==ve||t[43]!==be?(xe=(0,$.jsx)(`input`,{ref:O,value:ge,onChange:_e,onFocus:ve,onBlur:ye,onKeyDown:be,"aria-label":`Address`,placeholder:`Search or enter URL`,spellCheck:!1,disabled:c,"data-preview-url-input":!0,className:`w-full min-w-0 truncate bg-transparent text-center text-sm text-foreground outline-none placeholder:text-muted-foreground focus:text-left`}),t[40]=c,t[41]=ge,t[42]=ve,t[43]=be,t[44]=xe):xe=t[44];let Se;t[45]!==P||t[46]!==h?(Se=h&&!P?(0,$.jsx)(`span`,{className:`pointer-events-none absolute right-1 flex opacity-0 transition-opacity focus-within:pointer-events-auto focus-within:opacity-100 group-hover/address:pointer-events-auto group-hover/address:opacity-100 [&_button]:rounded-full`,children:(0,$.jsxs)(he,{children:[(0,$.jsx)(pe,{render:(0,$.jsx)(E,{variant:`ghost`,size:`icon-xs`,onClick:h,"aria-label":`Open in system browser`,type:`button`}),children:(0,$.jsx)(N,{})}),(0,$.jsx)(me,{children:`Open in system browser`})]})}):null,t[45]=P,t[46]=h,t[47]=Se):Se=t[47];let Ce;t[48]!==xe||t[49]!==Se?(Ce=(0,$.jsxs)(`div`,{className:`surface-glass group/address relative flex h-8 min-w-0 flex-1 items-center rounded-full border border-border/60 px-8 shadow-sm transition-colors focus-within:border-ring has-disabled:opacity-64`,children:[xe,Se]}),t[48]=xe,t[49]=Se,t[50]=Ce):Ce=t[50];let we;t[51]!==S||t[52]!==C||t[53]!==w||t[54]!==T?(we=S?(0,$.jsxs)(he,{children:[(0,$.jsx)(pe,{render:(0,$.jsx)(E,{variant:`glass`,size:`icon`,onClick:S,disabled:w,"aria-label":C?`Cancel annotation`:`Annotate preview`,"aria-pressed":C?`true`:`false`,type:`button`}),children:(0,$.jsx)(f,{className:ne(C&&`text-primary`)})}),(0,$.jsx)(me,{children:w&&T?T:C?`Cancel annotation (Esc)`:`Annotate elements, regions, and drawings`})]}):null,t[51]=S,t[52]=C,t[53]=w,t[54]=T,t[55]=we):we=t[55];let Te;t[56]!==_||t[57]!==g||t[58]!==v?(Te=g?(0,$.jsxs)(he,{children:[(0,$.jsxs)(pe,{render:(0,$.jsx)(E,{variant:`glass`,size:`icon`,onClick:e=>g(e.shiftKey),"aria-label":v?`Stop recording`:`Capture screenshot`,type:`button`,className:`relative`,disabled:_}),children:[(0,$.jsx)(o,{className:ne(v&&`text-destructive`)}),v?(0,$.jsx)(`span`,{className:`absolute right-0.5 top-0.5 size-1.5 animate-status-pulse rounded-full bg-destructive`}):null]}),(0,$.jsx)(me,{children:v?`Stop recording`:`Screenshot · Shift-click to record`})]}):null,t[56]=_,t[57]=g,t[58]=v,t[59]=Te):Te=t[59];let Ee;t[60]!==y||t[61]!==b||t[62]!==x?(Ee=y?(0,$.jsxs)(he,{children:[(0,$.jsx)(pe,{render:(0,$.jsx)(E,{variant:`glass`,size:`icon`,onClick:y,"aria-label":b?`Bring preview back from its window`:`Open preview in a window`,"aria-pressed":b?`true`:`false`,type:`button`,disabled:x}),children:(0,$.jsx)(A,{className:ne(b&&`text-primary`)})}),(0,$.jsx)(me,{children:b?`Bring back`:`Open in separate window`})]}):null,t[60]=y,t[61]=b,t[62]=x,t[63]=Ee):Ee=t[63];let De;t[64]!==ee||t[65]!==z||t[66]!==fe||t[67]!==Ce||t[68]!==we||t[69]!==Te||t[70]!==Ee||t[71]!==D?(De=(0,$.jsxs)(`form`,{onSubmit:z,className:`flex h-12 min-h-12 shrink-0 items-center gap-2 border-b border-border/60 bg-background px-2.5 in-data-[preview-panel-mode=inline]:border-b-transparent`,"data-surface-subheader":!0,children:[fe,ee,Ce,we,Te,Ee,D]}),t[64]=ee,t[65]=z,t[66]=fe,t[67]=Ce,t[68]=we,t[69]=Te,t[70]=Ee,t[71]=D,t[72]=De):De=t[72];let Oe;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(Oe={boxShadow:`0 0 6px 1px var(--color-ring)`},t[73]=Oe):Oe=t[73];let ke;t[74]===r?ke=t[75]:(ke=(0,$.jsx)(`div`,{"aria-hidden":!0,"data-loading":r,className:`preview-loading-progress pointer-events-none absolute bottom-0 left-0 z-10 h-0.5 w-full origin-left rounded-r-full bg-primary`,style:Oe}),t[74]=r,t[75]=ke);let Ae;return t[76]!==De||t[77]!==ke?(Ae=(0,$.jsxs)(`div`,{className:`relative`,children:[De,ke]}),t[76]=De,t[77]=ke,t[78]=Ae):Ae=t[78],Ae}function ht(e){let t=(0,Q.c)(10),{threadRef:n,server:r,onOpen:i}=e,a;t[0]===r?a=t[1]:(a=gt(r),t[0]=r,t[1]=a);let o=a,s;t[2]!==r.requestedUrl||t[3]!==n?(s=(0,$.jsx)(q,{threadRef:n,url:r.requestedUrl}),t[2]=r.requestedUrl,t[3]=n,t[4]=s):s=t[4];let c=`${r.host}:${r.port}`,l;return t[5]!==i||t[6]!==o||t[7]!==s||t[8]!==c?(l=(0,$.jsx)(be,{onClick:i,icon:s,title:o,description:c}),t[5]=i,t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9],l}function gt(e){return e.processName?e.processName:`Listening`}function _t(e){let t=(0,Q.c)(26),{threadRef:n,entry:r,onOpen:i,onRemove:a}=e,o;t[0]===r.url?o=t[1]:(o=new URL(r.url),t[0]=r.url,t[1]=o);let s=o,c=s.pathname===`/`?``:s.pathname,l=`${s.host}${c}${s.search}${s.hash}`,u;t[2]===r.lastVisitedAt?u=t[3]:(u=je(r.lastVisitedAt)?fe(new Date(r.lastVisitedAt).toISOString()):``,t[2]=r.lastVisitedAt,t[3]=u);let d=u;lt();let f;t[4]!==r.url||t[5]!==n?(f=(0,$.jsx)(q,{threadRef:n,url:r.url}),t[4]=r.url,t[5]=n,t[6]=f):f=t[6];let p=r.title??l,m;t[7]===p?m=t[8]:(m=(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:p}),t[7]=p,t[8]=m);let h=r.title?`${l} · `:``,g;t[9]!==h||t[10]!==d?(g=(0,$.jsxs)(`span`,{className:`truncate text-xs text-muted-foreground`,children:[h,d]}),t[9]=h,t[10]=d,t[11]=g):g=t[11];let _;t[12]!==m||t[13]!==g?(_=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[m,g]}),t[12]=m,t[13]=g,t[14]=_):_=t[14];let v;t[15]!==i||t[16]!==f||t[17]!==_?(v=(0,$.jsxs)(`button`,{type:`button`,onClick:i,className:`flex w-full items-center gap-3 px-3 py-3 pr-10 text-left hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,children:[f,_]}),t[15]=i,t[16]=f,t[17]=_,t[18]=v):v=t[18];let y=`Remove ${l} from history`,b;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(P,{className:`size-3.5`}),t[19]=b):b=t[19];let x;t[20]!==a||t[21]!==y?(x=(0,$.jsx)(`button`,{type:`button`,"aria-label":y,onClick:a,className:`absolute right-3 rounded p-1 text-muted-foreground opacity-0 hover:bg-accent hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring group-hover:opacity-100`,children:b}),t[20]=a,t[21]=y,t[22]=x):x=t[22];let S;return t[23]!==x||t[24]!==v?(S=(0,$.jsxs)(`div`,{className:`group relative flex w-full items-center`,children:[v,x]}),t[23]=x,t[24]=v,t[25]=S):S=t[25],S}function vt(e){let t=(0,Q.c)(7),n=J(e.environmentId,e.configuredUrls),r;if(t[0]!==e.configuredUrls||t[1]!==e.environmentId||t[2]!==n.configuredUrlProbing||t[3]!==n.servers){let i;t[5]===e.environmentId?i=t[6]:(i=t=>({...t,url:ke(e.environmentId,t.url),requestedUrl:t.url}),t[5]=e.environmentId,t[6]=i),r=yt({scanner:n.servers.map(i),configuredUrls:e.configuredUrls??[],configuredUrlProbing:n.configuredUrlProbing}),t[0]=e.configuredUrls,t[1]=e.environmentId,t[2]=n.configuredUrlProbing,t[3]=n.servers,t[4]=r}else r=t[4];return r}function yt(e){let t=new Map;for(let n of e.configuredUrls){let e=xt(n);if(!e)continue;let r=bt(e.host,e.port);t.has(r)||t.set(r,e)}let n=[];for(let r of e.scanner){let i=bt(r.host,r.port),a=t.get(i);n.push({...r,requestedUrl:a&&e.configuredUrlProbing===!1?a.url:r.requestedUrl,source:a?`configured`:`scanner`})}return n.toSorted((e,t)=>{let n={configured:0,scanner:1};return n[e.source]===n[t.source]?e.port-t.port:n[e.source]-n[t.source]})}function bt(e,t){let n=e.toLowerCase();return`${ze(n)?`loopback`:n}:${t}`}function xt(e){try{let t=new URL(e);if(t.protocol!==`http:`&&t.protocol!==`https:`||!ze(t.hostname))return null;let n=t.port?Number.parseInt(t.port,10):t.protocol===`http:`?80:443;return!Number.isFinite(n)||n<=0?null:{host:t.hostname,port:n,url:t.href}}catch{return null}}function St(e){let t=(0,Q.c)(24),{threadRef:n,environmentId:r,configuredUrls:i,recentEntries:a,onRemoveRecent:o,onOpenUrl:s}=e,c;t[0]!==i||t[1]!==r?(c={environmentId:r,configuredUrls:i},t[0]=i,t[1]=r,t[2]=c):c=t[2];let l=vt(c),u,d,f,p;if(t[3]!==s||t[4]!==o||t[5]!==a||t[6]!==l.length||t[7]!==n){p=Symbol.for(`react.early_return_sentinel`);bb0:{let e=a.filter(Ct).slice(0,8);if(l.length===0&&e.length===0){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(ye,{children:[(0,$.jsx)(ge,{variant:`icon`,children:(0,$.jsx)(h,{className:`size-4.5 text-muted-foreground`})}),(0,$.jsx)(_e,{children:`No preview yet`}),(0,$.jsx)(ve,{children:`Type a URL above, or run a dev script. Browser-ready localhost servers will show up here automatically.`})]}),t[12]=e):e=t[12],p=e;break bb0}f=`scrollbar-gutter-both flex h-full min-h-0 overflow-y-auto px-5 py-8`,u=`mx-auto flex w-full max-w-xl flex-col gap-6`,d=e.length>0?(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,$.jsx)(v,{className:`size-4 shrink-0`}),(0,$.jsx)(`h2`,{className:`font-medium`,children:`Recently used`})]}),(0,$.jsx)(xe,{children:e.map(e=>(0,$.jsx)(_t,{threadRef:n,entry:e,onOpen:()=>s(e.url),onRemove:()=>o(e.url)},e.url))})]}):null}t[3]=s,t[4]=o,t[5]=a,t[6]=l.length,t[7]=n,t[8]=u,t[9]=d,t[10]=f,t[11]=p}else u=t[8],d=t[9],f=t[10],p=t[11];if(p!==Symbol.for(`react.early_return_sentinel`))return p;let m;t[13]!==s||t[14]!==l||t[15]!==n?(m=l.length>0?(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,$.jsx)(L,{className:`size-4 shrink-0`}),(0,$.jsx)(`h2`,{className:`font-medium`,children:`Local servers`})]}),(0,$.jsx)(xe,{children:l.map(e=>(0,$.jsx)(ht,{threadRef:n,server:e,onOpen:()=>s(e.requestedUrl)},`${e.host}:${e.port}`))}),(0,$.jsx)(`p`,{className:`px-1 text-xs text-muted-foreground`,children:`Select a live local server to open it in this browser tab.`})]}):null,t[13]=s,t[14]=l,t[15]=n,t[16]=m):m=t[16];let g;t[17]!==u||t[18]!==d||t[19]!==m?(g=(0,$.jsxs)(`div`,{className:u,children:[d,m]}),t[17]=u,t[18]=d,t[19]=m,t[20]=g):g=t[20];let _;return t[21]!==f||t[22]!==g?(_=(0,$.jsx)(`div`,{className:f,children:g}),t[21]=f,t[22]=g,t[23]=_):_=t[23],_}function Ct(e){return URL.canParse(e.url)}var wt=[{value:`system`,label:`System`},{value:`light`,label:`Light`},{value:`dark`,label:`Dark`}],Tt=()=>{let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(he,{children:[(0,$.jsx)(pe,{render:(0,$.jsx)(z,{render:(0,$.jsx)(E,{variant:`glass`,size:`icon`,type:`button`,"aria-label":`Preview menu`})}),children:(0,$.jsx)(_,{})}),(0,$.jsx)(me,{children:`More`})]}),e[0]=t):t=e[0],t};function Et(e){let t=(0,Q.c)(69),{enabled:n,actions:r,zoomFactor:a,colorScheme:o,deviceToolbarVisible:s,onToggleDeviceToolbar:c,profileName:l,move:u}=e,d;t[0]===a?d=t[1]:(d=Math.round(a*100),t[0]=a,t[1]=d);let f=`${d}%`,m=!n,h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(Tt,{}),t[2]=h):h=t[2];let _;t[3]!==r.hardReload||t[4]!==m?(_=(0,$.jsx)(i,{onClick:r.hardReload,disabled:m,children:`Hard reload`}),t[3]=r.hardReload,t[4]=m,t[5]=_):_=t[5];let v;t[6]!==r.openDevTools||t[7]!==m?(v=r.openDevTools?(0,$.jsx)(i,{onClick:r.openDevTools,disabled:m,children:`Open DevTools`}):null,t[6]=r.openDevTools,t[7]=m,t[8]=v):v=t[8];let y;t[9]===u?y=t[10]:(y=u?(0,$.jsx)(i,{onClick:u.onMove,children:u.label}):null,t[9]=u,t[10]=y);let b=s?`Hide device toolbar`:`Show device toolbar`,D;t[11]!==m||t[12]!==c||t[13]!==b?(D=(0,$.jsx)(i,{onClick:c,disabled:m,children:b}),t[11]=m,t[12]=c,t[13]=b,t[14]=D):D=t[14];let O;t[15]===m?O=t[16]:(O=(0,$.jsx)(k,{disabled:m,children:`Appearance`}),t[15]=m,t[16]=O);let A;t[17]===r?A=t[18]:(A=e=>r.setColorScheme(e),t[17]=r,t[18]=A);let M;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(M=wt.map(Ot),t[19]=M):M=t[19];let N;t[20]!==o||t[21]!==A?(N=(0,$.jsx)(T,{children:(0,$.jsx)(j,{value:o,onValueChange:A,children:M})}),t[20]=o,t[21]=A,t[22]=N):N=t[22];let P;t[23]!==N||t[24]!==O?(P=(0,$.jsxs)(I,{children:[O,N]}),t[23]=N,t[24]=O,t[25]=P):P=t[25];let te;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsx)(w,{}),t[26]=te):te=t[26];let F;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(`span`,{children:`Zoom`}),t[27]=F):F=t[27];let ne;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsx)(g,{}),t[28]=ne):ne=t[28];let L;t[29]!==r.zoomOut||t[30]!==m?(L=(0,$.jsx)(E,{variant:`outline`,size:`icon-xs`,type:`button`,onClick:r.zoomOut,"aria-label":`Zoom out`,disabled:m,children:ne}),t[29]=r.zoomOut,t[30]=m,t[31]=L):L=t[31];let z;t[32]===f?z=t[33]:(z=(0,$.jsx)(`span`,{className:`min-w-12 text-center text-xs tabular-nums text-muted-foreground`,children:f}),t[32]=f,t[33]=z);let re;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,$.jsx)(S,{}),t[34]=re):re=t[34];let B;t[35]!==r.zoomIn||t[36]!==m?(B=(0,$.jsx)(E,{variant:`outline`,size:`icon-xs`,type:`button`,onClick:r.zoomIn,"aria-label":`Zoom in`,disabled:m,children:re}),t[35]=r.zoomIn,t[36]=m,t[37]=B):B=t[37];let ie;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsx)(ee,{}),t[38]=ie):ie=t[38];let V;t[39]!==r.resetZoom||t[40]!==m?(V=(0,$.jsx)(E,{variant:`ghost`,size:`icon-xs`,type:`button`,onClick:r.resetZoom,"aria-label":`Reset zoom`,disabled:m,children:ie}),t[39]=r.resetZoom,t[40]=m,t[41]=V):V=t[41];let H;t[42]!==L||t[43]!==z||t[44]!==B||t[45]!==V?(H=(0,$.jsxs)(`span`,{className:`flex items-center gap-1`,children:[L,z,B,V]}),t[42]=L,t[43]=z,t[44]=B,t[45]=V,t[46]=H):H=t[46];let ae;t[47]!==m||t[48]!==H?(ae=(0,$.jsxs)(i,{closeOnClick:!1,onClick:Dt,className:`justify-between`,disabled:m,children:[F,H]}),t[47]=m,t[48]=H,t[49]=ae):ae=t[49];let oe;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(w,{}),t[50]=oe):oe=t[50];let U;t[51]===l?U=t[52]:(U=l?(0,$.jsx)(p,{className:`max-w-64`,children:(0,$.jsxs)(`span`,{className:`block truncate`,children:[`Profile: `,l]})}):null,t[51]=l,t[52]=U);let W;t[53]===r.clearCookies?W=t[54]:(W=(0,$.jsx)(i,{onClick:r.clearCookies,children:`Clear cookies`}),t[53]=r.clearCookies,t[54]=W);let se;t[55]===r.clearCache?se=t[56]:(se=(0,$.jsx)(i,{onClick:r.clearCache,children:`Clear cache`}),t[55]=r.clearCache,t[56]=se);let ce;t[57]!==U||t[58]!==W||t[59]!==se?(ce=(0,$.jsxs)(C,{children:[U,W,se]}),t[57]=U,t[58]=W,t[59]=se,t[60]=ce):ce=t[60];let G;return t[61]!==P||t[62]!==ae||t[63]!==ce||t[64]!==_||t[65]!==v||t[66]!==y||t[67]!==D?(G=(0,$.jsxs)(x,{children:[h,(0,$.jsxs)(R,{align:`end`,sideOffset:6,children:[_,v,y,D,P,te,ae,oe,ce]})]}),t[61]=P,t[62]=ae,t[63]=ce,t[64]=_,t[65]=v,t[66]=y,t[67]=D,t[68]=G):G=t[68],G}function Dt(e){return e.preventDefault()}function Ot(e){return(0,$.jsx)(te,{value:e.value,children:e.label},e.value)}function kt(e){return m[e]||(e.length>0?e:`Network error`)}function At(e){let t=(0,Q.c)(21),{url:n,fileName:r,downloadUrl:i,onOpen:a}=e,o;t[0]===n?o=t[1]:(o=Pt(n)??n,t[0]=n,t[1]=o);let s=o,c,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(Nt,{className:`mb-6 size-12 text-muted-foreground/70`}),l=(0,$.jsx)(`h1`,{className:`mb-3 text-2xl font-semibold leading-tight text-foreground`,children:`This file can’t be shown here`}),t[2]=c,t[3]=l):(c=t[2],l=t[3]);let u;t[4]===r?u=t[5]:(u=(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:r}),t[4]=r,t[5]=u);let d;t[6]!==s||t[7]!==u?(d=(0,$.jsxs)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:[u,` from `,s,` was downloaded instead.`]}),t[6]=s,t[7]=u,t[8]=d):d=t[8];let f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`div`,{className:`flex-1`}),t[9]=f):f=t[9];let p;t[10]===a?p=t[11]:(p=(0,$.jsx)(E,{type:`button`,variant:`outline`,size:`sm`,onClick:a,children:`Open in browser`}),t[10]=a,t[11]=p);let m;t[12]!==i||t[13]!==r?(m=i?(0,$.jsx)(E,{type:`button`,size:`sm`,render:(0,$.jsx)(`a`,{href:i,download:r}),children:`Download`}):null,t[12]=i,t[13]=r,t[14]=m):m=t[14];let h;t[15]!==p||t[16]!==m?(h=(0,$.jsxs)(`div`,{className:`mt-auto flex items-center gap-2 pt-8`,children:[f,p,m]}),t[15]=p,t[16]=m,t[17]=h):h=t[17];let g;return t[18]!==d||t[19]!==h?(g=(0,$.jsx)(`div`,{className:`scrollbar-gutter-both relative flex h-full min-h-0 w-full overflow-y-auto bg-background`,children:(0,$.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-1 flex-col px-8 py-12 sm:py-16`,children:[c,l,d,h]})}),t[18]=d,t[19]=h,t[20]=g):g=t[20],g}function jt(e){let t=(0,Q.c)(44),{url:n,code:r,description:i,onReload:a,move:o}=e,[s,c]=(0,Z.useState)(!1),l;t[0]===n?l=t[1]:(l=Pt(n)??n,t[0]=n,t[1]=l);let u=l,d;t[2]===i?d=t[3]:(d=kt(i),t[2]=i,t[3]=d);let f=d,p;t[4]!==r||t[5]!==i?(p=i.length>0?i:`ERR_${Math.abs(r)||`FAILED`}`,t[4]=r,t[5]=i,t[6]=p):p=t[6];let m=p,h,g;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(Nt,{className:`mb-6 size-12 text-muted-foreground/70`}),g=(0,$.jsx)(`h1`,{className:`mb-3 text-2xl font-semibold leading-tight text-foreground`,children:`This site can’t be reached`}),t[7]=h,t[8]=g):(h=t[7],g=t[8]);let _;t[9]===u?_=t[10]:(_=(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:u}),t[9]=u,t[10]=_);let v;t[11]!==f||t[12]!==_?(v=(0,$.jsxs)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:[_,`: `,f,`.`]}),t[11]=f,t[12]=_,t[13]=v):v=t[13];let y;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(`p`,{className:`mb-2 font-medium text-foreground`,children:`Try:`}),t[14]=y):y=t[14];let b,x;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(`li`,{children:`Checking your connection`}),b=(0,$.jsx)(`li`,{children:`Confirming the dev server is running`}),t[15]=b,t[16]=x):(b=t[15],x=t[16]);let S;t[17]===o?S=t[18]:(S=o?(0,$.jsx)(`li`,{children:`Opening it in the environment’s browser, which reaches its network`}):null,t[17]=o,t[18]=S);let C;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(`li`,{children:`Checking the proxy and the firewall`}),t[19]=C):C=t[19];let w;t[20]===S?w=t[21]:(w=(0,$.jsx)(Xe,{children:(0,$.jsxs)(`div`,{className:`mt-6 rounded-lg border border-border bg-muted/40 p-4 text-sm`,children:[y,(0,$.jsxs)(`ul`,{className:`list-disc space-y-1 pl-5 text-muted-foreground`,children:[x,b,S,C]})]})}),t[20]=S,t[21]=w);let T;t[22]!==s||t[23]!==w?(T=(0,$.jsx)(Ze,{open:s,children:w}),t[22]=s,t[23]=w,t[24]=T):T=t[24];let D;t[25]===m?D=t[26]:(D=(0,$.jsx)(`div`,{className:`mt-8 text-xs uppercase tracking-wide text-muted-foreground/70`,children:m}),t[25]=m,t[26]=D);let ee;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ee=()=>c(Mt),t[27]=ee):ee=t[27];let O=s?`Hide details`:`Details`,k;t[28]===O?k=t[29]:(k=(0,$.jsx)(E,{type:`button`,variant:`outline`,size:`sm`,onClick:ee,children:O}),t[28]=O,t[29]=k);let A;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(`div`,{className:`flex-1`}),t[30]=A):A=t[30];let j;t[31]===o?j=t[32]:(j=o?(0,$.jsx)(E,{type:`button`,variant:`outline`,size:`sm`,onClick:o.onMove,children:o.label}):null,t[31]=o,t[32]=j);let M;t[33]===a?M=t[34]:(M=(0,$.jsx)(E,{type:`button`,size:`sm`,onClick:a,children:`Reload`}),t[33]=a,t[34]=M);let N;t[35]!==k||t[36]!==j||t[37]!==M?(N=(0,$.jsxs)(`div`,{className:`mt-auto flex items-center gap-2 pt-8`,children:[k,A,j,M]}),t[35]=k,t[36]=j,t[37]=M,t[38]=N):N=t[38];let P;return t[39]!==T||t[40]!==D||t[41]!==N||t[42]!==v?(P=(0,$.jsx)(`div`,{className:`scrollbar-gutter-both relative flex h-full min-h-0 w-full overflow-y-auto bg-background`,children:(0,$.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-1 flex-col px-8 py-12 sm:py-16`,children:[h,g,v,T,D,N]})}),t[39]=T,t[40]=D,t[41]=N,t[42]=v,t[43]=P):P=t[43],P}function Mt(e){return!e}function Nt(e){let t=(0,Q.c)(5),{className:n}=e,r,i,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`path`,{d:`M16 12 L48 12 L48 52 L16 52 Z`}),i=(0,$.jsx)(`path`,{d:`M22 22 L42 22 M22 30 L36 30 M22 38 L40 38`,strokeLinecap:`round`}),a=(0,$.jsx)(`path`,{d:`M52 8 L12 56`,strokeLinecap:`round`}),t[0]=r,t[1]=i,t[2]=a):(r=t[0],i=t[1],a=t[2]);let o;return t[3]===n?o=t[4]:(o=(0,$.jsxs)(`svg`,{viewBox:`0 0 64 64`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,className:n,children:[r,i,a]}),t[3]=n,t[4]=o),o}function Pt(e){try{return new URL(e).host}catch{return null}}var Ft=1500,It=.001;function Lt(e){let t=(0,Q.c)(11),{zoomFactor:n}=e,[r,i]=(0,Z.useState)(!1),a=(0,Z.useRef)(n),o=(0,Z.useRef)(null),s,c;t[0]===n?(s=t[1],c=t[2]):(s=()=>{if(!(Math.abs(a.current-n)<It))return a.current=n,i(!0),o.current!==null&&window.clearTimeout(o.current),o.current=window.setTimeout(()=>{i(!1),o.current=null},Ft),()=>{o.current!==null&&(window.clearTimeout(o.current),o.current=null)}},c=[n],t[0]=n,t[1]=s,t[2]=c),(0,Z.useEffect)(s,c);let l;t[3]===n?l=t[4]:(l=Math.round(n*100),t[3]=n,t[4]=l);let u=`${l}%`,d=!r,f=r?`opacity-100 translate-y-0`:`opacity-0 -translate-y-1`,p;t[5]===f?p=t[6]:(p=ne(`pointer-events-none absolute top-3 right-3 z-20 select-none rounded-full border border-border/70 bg-popover/95 px-2.5 py-1 text-xs font-medium text-foreground shadow-md/10 backdrop-blur transition-all duration-200 ease-out`,f),t[5]=f,t[6]=p);let m;return t[7]!==u||t[8]!==d||t[9]!==p?(m=(0,$.jsx)(`div`,{"aria-hidden":d,className:p,children:u}),t[7]=u,t[8]=d,t[9]=p,t[10]=m):m=t[10],m}function Rt(e,t){return e.find(e=>e.id===t)?.name??`Removed profile`}var zt=typeof window>`u`?null:W();function Bt(e){let t=(0,Q.c)(12),n=nt(e.threadRef.environmentId),r;t[0]!==n||t[1]!==e.download.id||t[2]!==e.tabId||t[3]!==e.threadRef.threadId?(r=n?rt({access:n,threadId:e.threadRef.threadId,tabId:e.tabId},e.download.id):null,t[0]=n,t[1]=e.download.id,t[2]=e.tabId,t[3]=e.threadRef.threadId,t[4]=r):r=t[4];let i;t[5]===e.url?i=t[6]:(i=()=>void zt?.shell.openExternal(e.url).catch(Vt),t[5]=e.url,t[6]=i);let a;return t[7]!==e.download.fileName||t[8]!==e.url||t[9]!==r||t[10]!==i?(a=(0,$.jsx)(At,{url:e.url,fileName:e.download.fileName,downloadUrl:r,onOpen:i}),t[7]=e.download.fileName,t[8]=e.url,t[9]=r,t[10]=i,t[11]=a):a=t[11],a}function Vt(){}function Ht({threadRef:e,tabId:t,configuredUrls:n,visible:r,onSendAnnotation:i}){let[o,f]=(0,Z.useState)(void 0),[p,m]=(0,Z.useState)(!1),h=ce(e.environmentId,`orchestration:operate`)&&!!i,g=Ke(),_=(0,Z.useRef)(null),v=(0,Z.useRef)(!0),b=(0,Z.useRef)(e);b.current=e;let x=u(e),S=we(e,50),C=a(e=>e.addPreviewAnnotation),w=a(e=>e.addImage),T=ae(e.environmentId),ee=T?new URL(T).hostname:null,k=le(Fe.open),A=le(Fe.close,`preview close`),j=U(e.environmentId)?.label??`the environment`,M=oe(),N=ie(e.environmentId),P=le(Fe.resize,`preview viewport resize`),te=le(Fe.adjust,`preview appearance or zoom`);ot(e),(0,Z.useEffect)(()=>(v.current=!0,()=>{v.current=!1}),[]);let F=t??x.activeTabId,I=F?We(e,x.serverEpoch,F):null,L=F&&I?g.has(I)?I:$e(e,F):null,R=F?x.sessions[F]??null:null,z=Ce(e.environmentId,R),W=R?.runtime===`server`&&!z,K=R?.runtime===`server`,q=(0,Z.useRef)(null),[fe,ge]=(0,Z.useState)(!1),_e=(0,Z.useRef)(null),[ve,ye]=(0,Z.useState)(0),be=R?.runtime===`server`&&(R.viewport??O)._tag!==`fill`;(0,Z.useEffect)(()=>{let e=_e.current;if(e&&be)return Se(e,([e])=>ye(Math.max(1,Math.round(e?.contentRect.width??0))))},[be]);let[xe,je]=(0,Z.useState)(null),Ne=W&&xe!==I,[ze,qe]=(0,Z.useState)(null),J=F?x.desktopByTabId[F]??null:null,Y=R?.navStatus??{_tag:`Idle`},Xe=Y._tag===`Idle`?``:Y.url,Ze=J?.loading??Y._tag===`Loading`,nt=J?.canGoBack??R?.canGoBack??!1,rt=J?.canGoForward??R?.canGoForward??!1,lt=Y._tag===`Idle`,Q=Y._tag===`LoadFailed`,dt=st(R),pt=W&&!dt&&!Q&&ze!==I,ht=J?.controller??`none`,gt=R?.viewport??O,_t=Ee(),vt=R?.profileId??`default`,yt=Rt(_t.profiles,vt),bt=He(e=>I?e.byTabId[I]?.rect??null:null),xt=Y._tag===`Success`?Y.url:null,Ct=Y._tag===`Success`?Y.title:null,wt=S[0]?.url,Tt=D(e);(0,Z.useEffect)(()=>{xt&&Ct&&wt&&De(b.current,xt,Ct,ee)},[ee,wt,Ct,xt,Tt]);let Dt=(0,Z.useCallback)(async t=>{if(W&&q.current)return!Ne&&(q.current.navigate(t),y(e,t),!0);if(I&&X)return await X.navigate(I,t),y(e,t),!0;let n=await Ue({openPreview:k,threadRef:e,url:t});if(n._tag===`Failure`&&!re(n)){let e=B(n);e instanceof Pe&&H.add({type:`error`,title:`Unable to open browser`,description:e.message})}return n._tag===`Success`},[W,k,I,Ne,e]),Ot=(0,Z.useCallback)(async t=>{try{let n=Le(t,Ie(se()));await Dt(n)&&Oe(e,n)}catch{}},[Dt,e]),kt=(0,Z.useCallback)(async t=>{try{let n=W||!X?Re(t):ke(e.environmentId,t);await Dt(n)&&Oe(e,t)}catch{}},[W,Dt,e]),At=(0,Z.useCallback)(()=>{W?q.current?.reload():X&&I&&X.refresh(I)},[W,I]),Mt=(0,Z.useCallback)(async t=>{if(!F)return;let n=await te({environmentId:e.environmentId,input:{threadId:e.threadId,tabId:F,...t}});if(n._tag===`Failure`){let e=B(n);H.add({type:`error`,title:`Unable to change the browser tab`,description:e instanceof Error?e.message:`An error occurred.`});return}d(e,n.value)},[te,F,e]),Nt=R?.zoomFactor??1,Pt=(0,Z.useCallback)(e=>{let t=s.indexOf(Nt),n=e===0?1:s[Math.min(Math.max((t<0?7:t)+e,0),s.length-1)];n!==Nt&&Mt({zoomFactor:n})},[Mt,Nt]),Ft=(0,Z.useCallback)(()=>{K?Pt(1):X&&I&&X.zoomIn(I)},[I,K,Pt]),It=(0,Z.useCallback)(()=>{K?Pt(-1):X&&I&&X.zoomOut(I)},[I,K,Pt]),Vt=(0,Z.useCallback)(()=>{K?Pt(0):X&&I&&X.resetZoom(I)},[I,K,Pt]),Ht=(0,Z.useCallback)(async t=>{if(!F)return;let n=await P({environmentId:e.environmentId,input:{threadId:e.threadId,tabId:F,viewport:t}});if(n._tag===`Failure`){let e=B(n);throw H.add({type:`error`,title:`Unable to resize browser viewport`,description:e instanceof Error?e.message:`An error occurred.`}),e}d(e,n.value)},[P,F,e]),Ut=()=>{if(I){if(gt._tag!==`fill`){Ye(I,O).catch(()=>void 0);return}Ye(I,Me({defaults:_t,panelRect:bt,zoomFactor:K?Nt:J?.zoomFactor})).catch(()=>void 0)}};(0,Z.useEffect)(()=>{if(I)return Ve(I,Ht)},[Ht,I]);let Wt=(0,Z.useCallback)(()=>{W?q.current?.history(-1):X&&I&&X.goBack(I)},[W,I]),Gt=(0,Z.useCallback)(()=>{W?q.current?.history(1):X&&I&&X.goForward(I)},[W,I]),Kt=(0,Z.useCallback)(()=>{zt&&Xe&&zt.shell.openExternal(Xe).catch(()=>void 0)},[Xe]),qt=Te(e.environmentId,M,N,R),Jt=qt===`server`?`Open in ${j}'s browser`:`Open on this computer`,Yt=(0,Z.useCallback)(async()=>{if(!qt||!F||!R)return;let t=await Ue({openPreview:k,threadRef:e,...Xe?{url:qt===`desktop`?ke(e.environmentId,Xe):Xe}:{},viewport:gt,...R.profileId===void 0?{}:{profileId:R.profileId},runtime:qt});if(t._tag===`Failure`){if(re(t))return;let e=B(t);H.add({type:`error`,title:`Unable to move the browser tab`,description:e instanceof Error?e.message:`An error occurred.`});return}ue.getState().openBrowser(e,t.value.tabId),await at({closePreview:A,snapshot:R,tabId:F,threadRef:e})},[A,qt,k,R,F,e,Xe,gt]),Xt=e=>()=>{e&&I&&e(I).catch(()=>void 0)},Zt=K?{hardReload:()=>void Mt({hardReload:!0}),setColorScheme:e=>void Mt({colorScheme:e}),zoomIn:Ft,zoomOut:It,resetZoom:Vt,clearCookies:()=>void Mt({clear:`cookies`}),clearCache:()=>void Mt({clear:`cache`}),...z&&X?{openDevTools:Xt(X.openDevTools)}:{}}:X?{hardReload:Xt(X.hardReload),setColorScheme:e=>{I&&X?.setColorScheme(I,e).catch(()=>void 0)},zoomIn:Ft,zoomOut:It,resetZoom:Vt,clearCookies:()=>void X?.clearCookies(e.environmentId,vt).catch(()=>void 0),clearCache:()=>void X?.clearCache(e.environmentId,vt).catch(()=>void 0),openDevTools:Xt(X.openDevTools)}:null,Qt=(0,Z.useCallback)(()=>{X&&I&&(J?.pictureInPicture?X.pictureInPicture.close:X.pictureInPicture.open)(I).catch(e=>{H.add({type:`error`,title:`Unable to update popped-out preview`,description:e instanceof Error?e.message:`An error occurred.`})})},[J?.pictureInPicture,I]),$t=(0,Z.useCallback)(t=>{if(!X||!I||!F)return;let n=X;if(L){Ge(L).then(e=>{if(!e)return;let t=!1,r,i=()=>{if(!navigator.clipboard?.writeText){H.update(r,de({type:`error`,title:`Unable to copy recording path`,description:`Clipboard API unavailable.`,actionProps:a}));return}navigator.clipboard.writeText(e.path).then(()=>{t=!0,o(),window.setTimeout(()=>{t=!1,o()},2e3)},e=>{H.update(r,de({type:`error`,title:`Unable to copy recording path`,description:e instanceof Error?e.message:`An error occurred.`,actionProps:a}))})},a={children:V(navigator.platform),onClick:()=>void n.revealArtifact(e.path)},o=()=>{H.update(r,de({type:`success`,title:`Recording saved`,actionProps:a,data:{secondaryActionProps:{children:t?`Copied!`:`Copy path`,disabled:t,onClick:i}}}))};r=H.add(de({type:`success`,title:`Recording saved`,actionProps:a,data:{secondaryActionProps:{children:`Copy path`,onClick:i}}}))},e=>{H.add({type:`error`,title:`Unable to stop recording`,description:e instanceof Error?e.message:`An error occurred.`})});return}if(t){Qe(I,e,F).catch(e=>{let t=e instanceof Error?e.message:`An error occurred.`;Be(e)||H.add({type:`error`,title:`Unable to start recording`,description:t})});return}n.captureScreenshot(I).then(e=>{let t={children:V(navigator.platform),onClick:()=>void n.revealArtifact(e.path)},r=!1,i=!1,a,o=(e=`success`,n=`Screenshot saved`,o)=>{H.update(a,de({type:e,title:n,description:o,actionProps:{children:i?`Copied!`:`Copy image`,disabled:i,onClick:c},data:{additionalActions:[{id:`copy-path`,props:{children:r?`Copied!`:`Copy path`,disabled:r,onClick:s}}],secondaryActionProps:{...t}}}))},s=()=>{if(!navigator.clipboard?.writeText){o(`error`,`Unable to copy screenshot path`,`Clipboard API unavailable.`);return}navigator.clipboard.writeText(e.path).then(()=>{r=!0,o(),window.setTimeout(()=>{r=!1,o()},2e3)},e=>{o(`error`,`Unable to copy screenshot path`,e instanceof Error?e.message:`An error occurred.`)})},c=()=>{n.copyArtifactToClipboard(e.path).then(()=>{i=!0,o(),window.setTimeout(()=>{i=!1,o()},2e3)},e=>{o(`error`,`Unable to copy screenshot`,e instanceof Error?e.message:`An error occurred.`)})};a=H.add(de({type:`success`,title:`Screenshot saved`,actionProps:{children:`Copy image`,onClick:c},data:{additionalActions:[{id:`copy-path`,props:{children:`Copy path`,onClick:s}}],secondaryActionProps:{...t}}}))},e=>{H.add({type:`error`,title:`Unable to capture screenshot`,description:e instanceof Error?e.message:`An error occurred.`})})},[L,I,F,e]),en=(0,Z.useCallback)(()=>{if(!X||!I)return;if(_.current){_.current.cancelled=!0,X.cancelPickElement(I).catch(()=>void 0);return}let t=typeof document<`u`?document.activeElement:null,n={cancelled:!1},r=!1;_.current=n,m(!0),(async()=>{try{if(await X.setAnnotationSendEnabled?.(I,!!i&&G(e.environmentId,`orchestration:operate`)),n.cancelled)return;let t=await X.pickElement(I);if(!t||n.cancelled)return;_.current===n&&(_.current=null,v.current&&m(!1),r=!0);let{annotation:a,submission:o,screenshotFailed:s=!1}=t,c=ft(a),l=s||c.status===`failed`,u=c.status===`failed`?{...a,screenshot:null}:a;C(e,u),l&&H.add(de({type:`error`,title:`Could not capture the picked element`,description:`The annotation was kept without the screenshot.`}));let d=c.status===`captured`?c.file:null,f=d&&u.screenshot?{type:`image`,id:u.id,name:d.name,mimeType:d.type,sizeBytes:d.size,previewUrl:u.screenshot.dataUrl,file:d}:null;f&&w(e,f),o===`send`&&G(e.environmentId,`orchestration:operate`)&&i?.(u,f)}catch{}finally{let e=_.current===n;if(e&&(_.current=null,v.current&&m(!1)),(e||r)&&t&&t.isConnected&&typeof t.focus==`function`)try{t.focus({preventScroll:!0})}catch{}}})()},[w,C,i,I,e]);return(0,Z.useEffect)(()=>{p&&X&&I&&X.setAnnotationSendEnabled?.(I,h).catch(()=>void 0)},[h,p,I]),(0,Z.useEffect)(()=>()=>{_.current&&(_.current.cancelled=!0,_.current=null,X&&I&&X.cancelPickElement(I).catch(()=>void 0),v.current&&m(!1))},[I]),(0,Z.useEffect)(()=>{if(r)return ut(e=>{switch(e){case`refresh`:At();return;case`focus-url`:f(e=>(e??0)+1);return;case`zoom-in`:Ft();return;case`zoom-out`:It();return;case`reset-zoom`:Vt();return;case`toggle-panel`:return}})},[At,Vt,Ft,It,r]),(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-background`,"data-thread-key":D(e),children:[(0,$.jsx)(mt,{url:Xe,loading:Ze||pt,canGoBack:nt&&!Ne,canGoForward:rt&&!Ne,refreshDisabled:lt||Ne,inputDisabled:Ne,focusUrlNonce:o,onBack:Wt,onForward:Gt,onRefresh:At,onSubmit:e=>void Ot(e),onOpenInBrowser:F?Kt:void 0,onCapture:X&&F&&!W?$t:void 0,captureDisabled:!J||Q||J.pictureInPicture,recording:L!==null,onSeparateWindow:X&&F&&(!K||z)?Qt:void 0,separateWindow:J?.pictureInPicture??!1,separateWindowDisabled:I===null||!K&&!(J?.hasWebContents??!1),onPickElement:X&&F&&!W?en:void 0,pickActive:p,pickDisabled:!F||Q,pickDisabledReason:Q?`Page didn't load — pick unavailable until the page renders`:void 0,leadingActions:vt===_t.profileId?null:(0,$.jsxs)(he,{children:[vt===`incognito`?(0,$.jsx)(pe,{render:(0,$.jsx)(`span`,{role:`img`,"aria-label":yt,className:`flex shrink-0 text-muted-foreground`}),children:(0,$.jsx)(c,{className:`size-4`})}):(0,$.jsx)(pe,{render:(0,$.jsx)(l,{variant:`outline`,className:`max-w-28 shrink-0`}),children:(0,$.jsx)(`span`,{className:`truncate`,children:yt})}),(0,$.jsx)(me,{side:`top`,children:yt})]}),trailingActions:Zt?(0,$.jsx)(Et,{enabled:I!==null&&(K||(J?.hasWebContents??!1)),actions:Zt,...qt?{move:{label:Jt,onMove:()=>void Yt()}}:{},profileName:yt,zoomFactor:K?Nt:J?.zoomFactor??1,colorScheme:K?R?.colorScheme??`system`:J?.colorScheme??`system`,deviceToolbarVisible:gt._tag!==`fill`,onToggleDeviceToolbar:Ut}):null}),(0,$.jsxs)(`div`,{ref:_e,className:`relative min-h-0 flex-1 overflow-hidden`,children:[I&&R&&W?(0,$.jsxs)($.Fragment,{children:[gt._tag!==`fill`&&!dt&&!Q?(0,$.jsx)(`div`,{className:`absolute inset-x-0 top-0 z-10`,children:(0,$.jsx)(Je,{setting:gt,width:ve,aspectRatio:fe?gt.width/gt.height:null,onAspectRatioChange:e=>ge(e!==null),onChange:e=>Ye(I,e)})}):null,(0,$.jsx)(`div`,{className:`absolute inset-x-0 bottom-0`,style:{top:gt._tag===`fill`?0:38},children:(0,$.jsx)(ct,{ref:q,environmentId:e.environmentId,threadId:e.threadId,tabId:R.tabId,visible:r,onFirstFrame:()=>qe(I),onControl:e=>je(e?.controller===`you`?I:null),onPopup:t=>tt(e,t,`panel`),className:ne(`absolute inset-0 h-full w-full`,(dt||Q)&&`invisible`)},I)})]}):I&&R&&!dt?X&&J?.pictureInPicture?(0,$.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,$.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:`Showing in a separate window.`}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(E,{size:`sm`,variant:`outline`,onClick:Qt,children:`Bring back`}),(0,$.jsx)(E,{size:`sm`,variant:`ghost`,onClick:()=>void X?.pictureInPicture.open(I),children:`Show window`})]})]}):X?(0,$.jsx)(et,{tabId:I,visible:r&&!Q,className:`absolute inset-0 h-full w-full`},I):(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center p-8 text-center`,children:(0,$.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:`This tab is open in the P4 Code desktop app.`})}):null,dt?(0,$.jsx)(St,{threadRef:e,environmentId:e.environmentId,configuredUrls:n,recentEntries:S,onRemoveRecent:t=>Ae(e,t),onOpenUrl:e=>void kt(e)}):null,R&&J?(0,$.jsx)(Lt,{zoomFactor:J.zoomFactor}):null,I&&J&&!dt&&!Q&&!g.has(I)?(0,$.jsx)(it,{tabId:I,zoomFactor:J.zoomFactor,controller:ht}):null,Y._tag===`LoadFailed`&&Y.download?(0,$.jsx)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:(0,$.jsx)(Bt,{threadRef:e,tabId:R?.tabId??``,url:Y.url,download:Y.download})}):Y._tag===`LoadFailed`?(0,$.jsx)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:(0,$.jsx)(jt,{url:Y.url,code:Y.code,description:Y.description,onReload:At,...qt===`server`?{move:{label:Jt,onMove:()=>void Yt()}}:{}})}):null]})]})}function Ut(e){let t=(0,Q.c)(18),{mode:n,threadRef:r,tabId:i,configuredUrls:a,visible:o,onSendAnnotation:s}=e,c=Ne(r.environmentId),l=ce(r.environmentId,b);if(!l||!c){let e=l?`Preview is only available in the P4 Code desktop app.`:`Pair this client again with preview access to control browser previews.`,r;t[0]===e?r=t[1]:(r=(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:(0,$.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:e})}),t[0]=e,t[1]=r);let i;return t[2]!==n||t[3]!==r?(i=(0,$.jsx)(K,{mode:n,children:r}),t[2]=n,t[3]=r,t[4]=i):i=t[4],i}let u;t[5]===i?u=t[6]:(u=i===void 0?{}:{tabId:i},t[5]=i,t[6]=u);let d;t[7]===s?d=t[8]:(d=s?{onSendAnnotation:s}:{},t[7]=s,t[8]=d);let f;t[9]!==a||t[10]!==u||t[11]!==d||t[12]!==r||t[13]!==o?(f=(0,$.jsx)(Ht,{threadRef:r,...u,configuredUrls:a,visible:o,...d}),t[9]=a,t[10]=u,t[11]=d,t[12]=r,t[13]=o,t[14]=f):f=t[14];let p;return t[15]!==n||t[16]!==f?(p=(0,$.jsx)(K,{mode:n,children:f}),t[15]=n,t[16]=f,t[17]=p):p=t[17],p}export{Ut as PreviewPanel};
|
|
2
|
-
//# sourceMappingURL=PreviewPanel-CO66mekh.js.map
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{a as e,t}from"./react-DH3P2YXY.js";import{n,t as r}from"./jsx-runtime-BnjsACtP.js";import{$d as i,$n as a,Ad as o,Dl as s,Gd as c,Ht as l,Jn as u,Jt as d,Kf as f,Kp as p,Lm as m,N_ as h,Nt as g,Of as _,Tp as v,Vp as y,Vt as b,Yn as x,Yp as S,ar as C,dl as w,dr as T,t as E,tr as D,ts as ee,ur as O}from"./utils-BoMYW9A3.js";import{Ft as k,R as te,W as ne}from"./runtime-DR7JxgbQ.js";import{w as A}from"./entities-Bqo0n1Pb.js";import{a as j,c as M,o as N,s as P,t as F}from"./select-DaYjjw1q.js";import{t as I}from"./link-B3B5a5Ju.js";import{i as re,p as L}from"./toast-B84QdqqM.js";import{C as R,S as z,et as B,f as ie}from"./useSettings-CaJMqrvF.js";import{f as V,t as H}from"./server-sXApTCjZ.js";import{n as ae}from"./session-C949OsEI.js";import{n as U}from"./query-d1pQlqP0.js";import{t as oe}from"./use-atom-command-DA6OG-Qk.js";import{t as W}from"./toastHelpers-DxXYm50b.js";import{h as se,i as ce,m as G,u as K}from"./queries-EslKFJTV.js";import{a as q}from"./timestampFormat-wac2e_Jz.js";import{a as J,n as le,t as Y}from"./tooltip-D-GRl-oZ.js";import{t as ue}from"./textarea-R4UQ47Ns.js";import{n as de,t as fe}from"./toggle-group-Di3SFV73.js";import{a as pe,c as X,l as me,n as he,o as ge,r as _e,s as ve,t as ye}from"./combobox--XoXA5uu.js";import{t as be}from"./input-ekYqAkUx.js";import{n as xe}from"./scroll-area-yyfi3ycu.js";import{a as Se,c as Ce,i as we,n as Te,o as Ee,r as De,s as Oe,t as ke}from"./dialog-CBBxT1gk.js";import{a as Ae,i as je,o as Me,r as Ne,t as Pe}from"./empty-FOL5U4KY.js";import{n as Fe}from"./EnvironmentMachineIcon-Dpgx67FY.js";import{V as Ie,a as Le,i as Re,n as ze,s as Be,u as Ve,v as He}from"./settingsLayout-CFQx1XDM.js";import{n as Ue}from"./primaryCloudLinkState-CreqR0gU.js";import{a as We,c as Ge,d as Ke,f as qe,i as Je,l as Ye,n as Xe,p as Ze,r as Qe,s as $e,t as et,u as tt}from"./scheduledTasksSettings.logic-CVIC4Kpr.js";import{$t as nt,Oa as rt,fn as it,va as at,vi as ot}from"./main-BWh6jqG2.js";import{t as st}from"./ProviderModelPicker-DJQYH_Pp.js";var ct=n(),Z=e(t(),1),Q=e(r(),1);function lt(e){let t=(0,ct.c)(69),{items:n,filteredItems:r,value:i,query:a,resultsQuery:o,onQueryChange:s,open:c,onOpenChange:l,onSelectItem:u,hasNextPage:d,isFetchingNextPage:f,onLoadNext:p,statusText:m,originControl:h,popupProps:g,renderItem:_,getItemType:v,children:y}=e,b=(0,Z.useRef)(null),x=(0,Z.useId)(),S=(0,Z.useRef)(null),C=(0,Z.useRef)(null),w;t[0]===l?w=t[1]:(w=e=>{C.current=null,e||(b.current=null),l(e)},t[0]=l,t[1]=w);let T=w,[D,ee]=(0,Z.useState)(!1),[O,k]=(0,Z.useState)(!1),te;t[2]!==d||t[3]!==f||t[4]!==p?(te=()=>{d&&!f&&p()},t[2]=d,t[3]=f,t[4]=p,t[5]=te):te=t[5];let ne=te,A;t[6]!==ne||t[7]!==d||t[8]!==f||t[9]!==c?(A=()=>{let e=S.current;if(!e)return;let t=C.current;C.current=e.scrollTop,c&&d&&!f&&se({previousScrollTop:t,scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight})&&ne()},t[6]=ne,t[7]=d,t[8]=f,t[9]=c,t[10]=A):A=t[10];let j=A,M=(0,Z.useRef)(null),N;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(N=()=>{let e=M.current?.getScrollableNode?.();if(!(e instanceof HTMLElement))return;S.current=e;let t=Math.max(0,e.scrollHeight-e.clientHeight);ee(e.scrollTop>1),k(t-e.scrollTop>1)},t[11]=N):N=t[11];let P=N,F,I;t[12]===c?(F=t[13],I=t[14]):(F=()=>{if(!c)return;let e=0,t=requestAnimationFrame(()=>{P(),e=requestAnimationFrame(P)});return()=>{cancelAnimationFrame(t),cancelAnimationFrame(e)}},I=[c,P],t[12]=c,t[13]=F,t[14]=I),(0,Z.useLayoutEffect)(F,I);let re=(0,Z.useRef)(null),L,R;t[15]!==c||t[16]!==o?(L=()=>{if(!c){re.current=null;return}re.current!==o&&(re.current=o,M.current?.scrollToOffset?.({offset:0,animated:!1}))},R=[o,c],t[15]=c,t[16]=o,t[17]=L,t[18]=R):(L=t[17],R=t[18]),(0,Z.useEffect)(L,R);let z;t[19]===c?z=t[20]:(z=(e,t)=>{b.current=typeof e==`string`?e:null,!(!c||t.index<0||t.reason!==`keyboard`)&&M.current?.scrollIndexIntoView?.({index:t.index,animated:!1})},t[19]=c,t[20]=z);let B;t[21]===s?B=t[22]:(B=e=>s(e.target.value),t[21]=s,t[22]=B);let ie;t[23]!==r||t[24]!==u?(ie=e=>{if(e.key!==`Enter`||e.nativeEvent.isComposing||e.keyCode===229)return;let t=b.current;t!==null&&r.includes(t)&&(e.preventBaseUIHandler?.(),e.preventDefault(),e.stopPropagation(),b.current=null,u(t))},t[23]=r,t[24]=u,t[25]=ie):ie=t[25];let V;t[26]!==a||t[27]!==B||t[28]!==ie?(V=(0,Q.jsx)(ve,{placeholder:`Search refs...`,value:a,onChange:B,onKeyDown:ie}),t[26]=a,t[27]=B,t[28]=ie,t[29]=V):V=t[29];let H;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Q.jsx)(he,{children:`No refs found.`}),t[30]=H):H=t[30];let ae;t[31]===v?ae=t[32]:(ae=v?{getItemType:v}:{},t[31]=v,t[32]=ae);let U;t[33]===_?U=t[34]:(U=e=>{let{item:t,index:n}=e;return _(t,n)},t[33]=_,t[34]=U);let oe;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>{P(),C.current=S.current?.scrollTop??null},t[35]=oe):oe=t[35];let W;t[36]===j?W=t[37]:(W=()=>{P(),j()},t[36]=j,t[37]=W);let ce;t[38]!==O||t[39]!==D?(ce=E(`max-h-56 scrollbar-gutter-stable overflow-x-hidden overscroll-y-contain ps-1 pe-0 pt-2 pb-1`,xe({top:D,bottom:O})),t[38]=O,t[39]=D,t[40]=ce):ce=t[40];let G;t[41]!==r||t[42]!==ae||t[43]!==U||t[44]!==W||t[45]!==ce?(G=(0,Q.jsx)(`div`,{className:`relative min-h-0 w-full max-h-56 flex-1 overflow-hidden`,children:(0,Q.jsx)(pe,{className:`size-full min-w-0`,children:(0,Q.jsx)(it,{ref:M,data:r,keyExtractor:ut,...ae,renderItem:U,estimatedItemSize:28,drawDistance:336,onLayout:oe,onScroll:W,className:ce})})}),t[41]=r,t[42]=ae,t[43]=U,t[44]=W,t[45]=ce,t[46]=G):G=t[46];let K;t[47]!==h||t[48]!==x?(K=h?(0,Q.jsxs)(Y,{children:[(0,Q.jsx)(J,{render:(0,Q.jsxs)(`label`,{htmlFor:x,className:`flex cursor-pointer items-center justify-between gap-3 border-t border-border/60 px-3 py-2 text-xs`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 font-medium text-muted-foreground`,children:[(0,Q.jsx)(rt,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,Q.jsx)(`span`,{className:`truncate`,children:`Start from origin`})]}),(0,Q.jsx)(at,{id:x,checked:h.checked,size:`sm`,"aria-label":`Start worktree from origin`,onCheckedChange:e=>h.onCheckedChange(!!e)})]})}),(0,Q.jsx)(le,{side:`top`,className:`max-w-72 whitespace-normal`,children:`Creates the worktree from the latest matching branch on origin instead of your local branch.`})]}):null,t[47]=h,t[48]=x,t[49]=K):K=t[49];let q;t[50]===m?q=t[51]:(q=m?(0,Q.jsx)(X,{children:m}):null,t[50]=m,t[51]=q);let ue;t[52]!==G||t[53]!==K||t[54]!==q?(ue=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[H,G,K,q]}),t[52]=G,t[53]=K,t[54]=q,t[55]=ue):ue=t[55];let de;t[56]!==g||t[57]!==V||t[58]!==ue?(de=(0,Q.jsxs)(ge,{...g,children:[V,ue]}),t[56]=g,t[57]=V,t[58]=ue,t[59]=de):de=t[59];let fe;return t[60]!==y||t[61]!==r||t[62]!==T||t[63]!==n||t[64]!==c||t[65]!==de||t[66]!==z||t[67]!==i?(fe=(0,Q.jsxs)(ye,{items:n,filteredItems:r,autoHighlight:!0,virtualized:!0,onItemHighlighted:z,onOpenChange:T,open:c,value:i,children:[y,de]}),t[60]=y,t[61]=r,t[62]=T,t[63]=n,t[64]=c,t[65]=de,t[66]=z,t[67]=i,t[68]=fe):fe=t[68],fe}function ut(e){return e}function dt(e){let t=(0,ct.c)(15),{branch:n,projectCwd:r,index:i,value:a,disabled:o,onClick:s,onContextMenu:c}=e,l=n.name,u=n.worktreePath&&r&&n.worktreePath!==r,d=n.current?`current`:u?`worktree`:n.isRemote?`remote`:n.isDefault?`default`:null,f=a??l,p;t[0]===l?p=t[1]:(p=(0,Q.jsx)(nt,{value:l,className:`flex-1`}),t[0]=l,t[1]=p);let m;t[2]===d?m=t[3]:(m=d&&(0,Q.jsx)(`span`,{className:`shrink-0 text-3xs text-muted-foreground/45`,children:d}),t[2]=d,t[3]=m);let h;t[4]!==p||t[5]!==m?(h=(0,Q.jsxs)(`div`,{className:`flex w-full min-w-0 items-center justify-between gap-2`,children:[p,m]}),t[4]=p,t[5]=m,t[6]=h):h=t[6];let g;return t[7]!==o||t[8]!==i||t[9]!==l||t[10]!==s||t[11]!==c||t[12]!==f||t[13]!==h?(g=(0,Q.jsx)(_e,{disabled:o,hideIndicator:!0,index:i,value:f,onClick:s,onContextMenu:c,children:h},l),t[7]=o,t[8]=i,t[9]=l,t[10]=s,t[11]=c,t[12]=f,t[13]=h,t[14]=g):g=t[14],g}function ft(e,t){if(e.url!==null)return{address:e.url,copyable:!0,note:null};if(t===null)return{address:e.path,copyable:!1,note:`Link this environment to P4 Connect for a public URL.`};let n=new URL(e.path,t);return{address:n.href,copyable:!0,note:k(n.hostname)?`Only this computer can call this address. Link P4 Connect for a public URL.`:`Works wherever this environment's address is reachable, for example over Tailscale or your own proxy. Link P4 Connect for a public URL.`}}function pt(e){let t=(0,ct.c)(58),{environmentId:n,cwd:r,value:i,onValueChange:a,startFromOrigin:s,onStartFromOriginChange:c,disabled:l,id:u}=e,d=l!==void 0&&l,[f,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(``),g;t[0]===m?g=t[1]:(g=m.trim(),t[0]=m,t[1]=g);let v=(0,Z.useDeferredValue)(g),y;t[2]===v?y=t[3]:(y=G(v),t[2]=v,t[3]=y);let b;t[4]!==r||t[5]!==n||t[6]!==y?(b={environmentId:n,cwd:r,query:y},t[4]=r,t[5]=n,t[6]=y,t[7]=b):b=t[7];let x=ce(b),S;t[8]!==r||t[9]!==n||t[10]!==i?(S=r&&i?K.listRefs({environmentId:n,input:{cwd:r,query:i,limit:10}}):null,t[8]=r,t[9]=n,t[10]=i,t[11]=S):S=t[11];let C=U(S),w;t[12]!==x.refs||t[13]!==C||t[14]!==i?(w=x.refs.find(e=>e.name===i)??C.data?.refs.find(e=>e.name===i),t[12]=x.refs,t[13]=C,t[14]=i,t[15]=w):w=t[15];let E=w,D=i||null,ee=E?E.isRemote===!0:null,O;t[16]!==s||t[17]!==D||t[18]!==ee?(O=He({activeWorktreePath:null,effectiveEnvMode:`worktree`,resolvedActiveBranch:D,resolvedActiveBranchIsRemote:ee,startFromOrigin:s}),t[16]=s,t[17]=D,t[18]=ee,t[19]=O):O=t[19];let k=O,te;t[20]===x.refs?te=t[21]:(te=new Map(x.refs.map(mt)),t[20]=x.refs,t[21]=te);let ne=te,A;t[22]===ne?A=t[23]:(A=[...ne.keys()],t[22]=ne,t[23]=A);let j=A,M=x.data?.nextCursor!=null,N=x.error??(x.isPending&&x.data===null?`Loading refs...`:x.isFetchingNextPage?`Loading more refs...`:M?`Showing ${x.refs.length} of ${x.data?.totalCount} refs`:null),P;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(P=e=>{p(e),e||h(``)},t[24]=P):P=t[24];let F=P,I=i||null,re=f&&!d,L;t[25]===a?L=t[26]:(L=e=>{a(e),F(!1)},t[25]=a,t[26]=L);let R;t[27]!==c||t[28]!==s?(R={checked:s,onCheckedChange:c},t[27]=c,t[28]=s,t[29]=R):R=t[29];let z;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(z={align:`start`,side:`bottom`,className:`flex w-80 flex-col`},t[30]=z):z=t[30];let B;t[31]!==ne||t[32]!==r||t[33]!==a?(B=(e,t)=>{let n=ne.get(e);return n?(0,Q.jsx)(dt,{branch:n,projectCwd:r,index:t,onClick:()=>{a(n.name),F(!1)}}):null},t[31]=ne,t[32]=r,t[33]=a,t[34]=B):B=t[34];let ie=d||!r,V;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Q.jsx)(T,{variant:`outline`,size:`sm`}),t[35]=V):V=t[35];let H;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Q.jsx)(_,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[36]=H):H=t[36];let ae;t[37]===k?ae=t[38]:(ae=(0,Q.jsx)(nt,{value:k,className:`flex-1 text-left`}),t[37]=k,t[38]=ae);let oe;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Q.jsx)(o,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[39]=oe):oe=t[39];let W;t[40]!==u||t[41]!==ie||t[42]!==ae?(W=(0,Q.jsxs)(me,{id:u,disabled:ie,render:V,className:`w-full justify-between `,children:[H,ae,oe]}),t[40]=u,t[41]=ie,t[42]=ae,t[43]=W):W=t[43];let se;return t[44]!==x.isFetchingNextPage||t[45]!==x.loadNext||t[46]!==v||t[47]!==M||t[48]!==j||t[49]!==m||t[50]!==N||t[51]!==I||t[52]!==re||t[53]!==L||t[54]!==R||t[55]!==B||t[56]!==W?(se=(0,Q.jsx)(lt,{items:j,filteredItems:j,value:I,query:m,resultsQuery:v,onQueryChange:h,open:re,onOpenChange:F,onSelectItem:L,hasNextPage:M,isFetchingNextPage:x.isFetchingNextPage,onLoadNext:x.loadNext,statusText:N,originControl:R,popupProps:z,renderItem:B,children:W}),t[44]=x.isFetchingNextPage,t[45]=x.loadNext,t[46]=v,t[47]=M,t[48]=j,t[49]=m,t[50]=N,t[51]=I,t[52]=re,t[53]=L,t[54]=R,t[55]=B,t[56]=W,t[57]=se):se=t[57],se}function mt(e){return[e.name,e]}var ht=[1,2,3,4,5,6,0],gt=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],_t=[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],vt={auto:`Choose automatically`,worktree:`Create a new worktree`,root:`Use the project checkout`,existing_worktree:`Use a specific checkout`},yt={editingId:null,title:``,prompt:``,enabled:!0,scheduleMode:`fixed`,intervalMinutes:`15`,timeOfDay:`09:00`,weekdays:new Set([1,2,3,4,5]),projectId:``,threadId:``,workspaceMode:`worktree`,baseRef:`main`,startFromOrigin:!0,existingWorktreePath:``,modelKey:``,runtimeMode:`full-access`,interactionMode:`default`,baseModelSelection:null,signatureEnabled:!1,...et,signatureSecret:``,maxDeliveryAgeMinutes:``,replayKey:``,coalesceKey:``,coalesceWindowSeconds:``,filters:[],savedFilters:[]};function bt(e){let t=(0,ct.c)(18),{filters:n,onChange:r}=e,i;t[0]!==n||t[1]!==r?(i=(e,t)=>r(n.map((n,r)=>r===e?{...n,...t}:n)),t[0]=n,t[1]=r,t[2]=i):i=t[2];let a=i,o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,Q.jsx)(ot,{children:`Filters`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Run only when every filter matches. Other requests are logged as filtered. Separate “is one of” values with commas; a value can't contain a comma.`})]}),t[3]=o):o=t[3];let s=n.length>=16,c;t[4]!==n||t[5]!==r?(c=()=>r([...n,Ke()]),t[4]=n,t[5]=r,t[6]=c):c=t[6];let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(S,{}),t[7]=l):l=t[7];let u;t[8]!==s||t[9]!==c?(u=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[o,(0,Q.jsxs)(T,{className:`shrink-0`,variant:`outline`,size:`sm`,disabled:s,onClick:c,children:[l,`Add filter`]})]}),t[8]=s,t[9]=c,t[10]=u):u=t[10];let d;t[11]!==n||t[12]!==r||t[13]!==a?(d=n.map((e,t)=>(0,Q.jsxs)(`div`,{className:`space-y-2 pt-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`div`,{className:`grid min-w-0 flex-1 grid-cols-1`,children:(0,Q.jsx)(be,{"aria-label":`Filter ${t+1} path`,placeholder:`body.action`,value:e.path,onChange:e=>a(t,{path:e.target.value})})}),(0,Q.jsx)(T,{variant:`ghost`,size:`icon-sm`,"aria-label":`Remove filter ${t+1}`,onClick:()=>r(Ze(n,e.id)),children:(0,Q.jsx)(m,{})})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(F,{value:e.op,onValueChange:e=>{let n=tt.find(t=>t.op===e);n&&a(t,{op:n.op})},children:[(0,Q.jsx)(`div`,{className:`grid w-44 shrink-0 grid-cols-1`,children:(0,Q.jsx)(P,{size:`sm`,"aria-label":`Filter ${t+1} test`,children:(0,Q.jsx)(M,{children:tt.find(t=>t.op===e.op)?.label})})}),(0,Q.jsx)(N,{children:tt.map(xt)})]}),e.op===`exists`?null:(0,Q.jsx)(`div`,{className:`grid min-w-0 flex-1 grid-cols-1`,children:(0,Q.jsx)(be,{"aria-label":`Filter ${t+1} value`,placeholder:e.op===`in`?`opened, reopened`:`opened`,value:e.value,onChange:e=>a(t,{value:e.target.value})})})]})]},e.id)),t[11]=n,t[12]=r,t[13]=a,t[14]=d):d=t[14];let f;return t[15]!==u||t[16]!==d?(f=(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[u,d]}),t[15]=u,t[16]=d,t[17]=f):f=t[17],f}function xt(e){return(0,Q.jsx)(j,{value:e.op,children:e.label},e.op)}function $(e){let t=(0,ct.c)(11),{label:n,hint:r,htmlFor:i,children:a}=e,o;t[0]===n?o=t[1]:(o=(0,Q.jsx)(`span`,{children:n}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=r?(0,Q.jsx)(`span`,{className:`font-normal text-2xs text-muted-foreground/80`,children:r}):null,t[2]=r,t[3]=s);let c;t[4]!==i||t[5]!==o||t[6]!==s?(c=(0,Q.jsxs)(ot,{className:`flex items-baseline justify-between`,htmlFor:i,children:[o,s]}),t[4]=i,t[5]=o,t[6]=s,t[7]=c):c=t[7];let l;return t[8]!==a||t[9]!==c?(l=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[c,a]}),t[8]=a,t[9]=c,t[10]=l):l=t[10],l}function St(e){let t=e.indexOf(`:`);return t<=0||t===e.length-1?null:{instanceId:h.make(e.slice(0,t)),model:e.slice(t+1)}}function Ct(e){if(e.type===`webhook`)return`On webhook`;if(e.type===`interval`){let t=e.everyMs/6e4;return Number.isInteger(t)?`Every ${t} min`:`Every ${Math.round(e.everyMs/1e3)} sec`}let t=e.weekdays??[];return`${t.length===0?`Daily`:t.length===5&&t.every(e=>e>=1&&e<=5)?`Weekdays`:t.map(e=>gt[e]).join(`, `)} at ${e.timeOfDay}`}function wt(e){if(!e)return`Not scheduled`;let t=new Date(e).getTime()-Date.now();if(t<=0){let t=q(e);return t?t.suffix?`${t.value} ${t.suffix}`:t.value:`Not scheduled`}let n=Math.ceil(t/6e4);if(n<2)return`in under a minute`;if(n<60)return`in ${n}m`;let r=Math.round(n/60);return r<24?`in ${r}h`:`in ${Math.round(r/24)}d`}function Tt(e){return e===`accepted`?`success`:e===`duplicate`||e===`coalesced`||e===`disabled`||e===`rate_limited`||e===`expired`?`warning`:e===`dispatch_failed`||e===`rejected_signature`?`error`:`outline`}function Et(e){return e===`failed`?`error`:e===`succeeded`?`success`:e===`running`?`info`:`outline`}function Dt(e){let t=(0,ct.c)(29),{scope:n,environments:r,connectedEnvironments:i,environment:a}=Ie(),o;t[0]!==e.environmentId||t[1]!==e.threadId?(o=()=>e.threadId&&e.environmentId?{environmentId:e.environmentId,task:null}:null,t[0]=e.environmentId,t[1]=e.threadId,t[2]=o):o=t[2];let[s,l]=(0,Z.useState)(o),u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(e,t)=>{l({environmentId:e,task:t})},t[3]=u):u=t[3];let d=u,f=a??i[0],p;t[4]===f?.environmentId?p=t[5]:(p=V.upsertScheduledTask.permissionAtom(f?.environmentId??null),t[4]=f?.environmentId,t[5]=p);let m=ee(p),h=!f||!m,g;t[6]===f?g=t[7]:(g=()=>f&&l({environmentId:f.environmentId,task:null}),t[6]=f,t[7]=g);let _;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(S,{className:`size-3`}),t[8]=_):_=t[8];let v;t[9]!==h||t[10]!==g?(v=(0,Q.jsxs)(T,{size:`xs`,variant:`ghost-muted`,disabled:h,onClick:g,children:[_,`New task`]}),t[9]=h,t[10]=g,t[11]=v):v=t[11];let y;t[12]!==f?.environmentId||t[13]!==r||t[14]!==n.kind||t[15]!==n.message||t[16]!==e.environmentId||t[17]!==e.taskId?(y=n.kind===`unavailable`?(0,Q.jsx)(Be,{title:`Unavailable selection`,children:(0,Q.jsx)(Le,{title:n.message})}):r.length===0?(0,Q.jsx)(Pe,{children:(0,Q.jsxs)(je,{children:[(0,Q.jsx)(Ae,{variant:`icon`,children:(0,Q.jsx)(c,{})}),(0,Q.jsx)(Me,{children:`No environments available`}),(0,Q.jsx)(Ne,{children:`Connect an environment to manage scheduled tasks.`})]})}):(0,Q.jsx)(`div`,{className:`space-y-8`,children:r.map(t=>(0,Q.jsx)(Ot,{environment:t,showEnvironmentHeading:r.length>1,taskId:(e.environmentId??f?.environmentId)===t.environmentId?e.taskId:void 0,onEdit:d},`${t.environmentId}:${e.taskId??``}`))}),t[12]=f?.environmentId,t[13]=r,t[14]=n.kind,t[15]=n.message,t[16]=e.environmentId,t[17]=e.taskId,t[18]=y):y=t[18];let b;t[19]!==v||t[20]!==y?(b=(0,Q.jsx)(Be,{title:`Scheduled tasks`,variant:`plain`,headerAction:v,children:y}),t[19]=v,t[20]=y,t[21]=b):b=t[21];let x;t[22]!==s||t[23]!==e.projectId||t[24]!==e.threadId?(x=s?(0,Q.jsx)(It,{initialThreadId:e.threadId,initialProjectId:e.projectId,initialEnvironmentId:s.environmentId,task:s.task,onClose:()=>l(null)},`${s.environmentId}:${s.task?.id??`new`}`):null,t[22]=s,t[23]=e.projectId,t[24]=e.threadId,t[25]=x):x=t[25];let C;return t[26]!==b||t[27]!==x?(C=(0,Q.jsxs)(Re,{children:[b,x]}),t[26]=b,t[27]=x,t[28]=C):C=t[28],C}function Ot(e){let t=(0,ct.c)(13),{environment:n,showEnvironmentHeading:r,taskId:i,onEdit:a}=e,{scope:o}=Ie(),c=n.connection.phase===`connected`&&n.serverConfig!==null,l;t[0]!==c||t[1]!==n.environmentId?(l=c?V.scheduledTasksLive({environmentId:n.environmentId,input:{}}):null,t[0]=c,t[1]=n.environmentId,t[2]=l):l=t[2];let u=U(l),d=u.data?.tasks.filter(e=>Xe(o,n.environmentId,e.projectId)),f=d?.find(e=>e.id===i),p=(0,Z.useRef)(!1);(0,Z.useEffect)(()=>{!p.current&&f&&(p.current=!0,a(n.environmentId,f))},[n.environmentId,f,a]),Ve(6e4);let m=Be,h=n.label,g=!r,_;t[3]===n.serverConfig?_=t[4]:(_=s(n.serverConfig),t[3]=n.serverConfig,t[4]=_);let v;t[5]===_?v=t[6]:(v=(0,Q.jsx)(Fe,{kind:_,className:`size-3.5`}),t[5]=_,t[6]=v);let y=c?u.error?(0,Q.jsx)(Le,{title:`Could not load scheduled tasks`,description:u.error}):d?(0,Q.jsxs)(Q.Fragment,{children:[i&&!f?(0,Q.jsx)(Le,{title:`Task unavailable`,description:`This task no longer exists or is outside the selected project scope.`,role:`status`}):null,d.length===0?(0,Q.jsx)(Le,{title:`No scheduled tasks`,description:`No tasks match this environment and project selection.`}):d.map(e=>(0,Q.jsx)(kt,{environmentId:n.environmentId,task:e,onEdit:()=>a(n.environmentId,e)},e.id))]}):(0,Q.jsx)(Le,{title:`Loading scheduled tasks…`,role:`status`}):(0,Q.jsx)(Le,{title:`Environment disconnected`,description:`Reconnect ${n.label} to view its scheduled tasks.`}),b;return t[7]!==m||t[8]!==n.label||t[9]!==g||t[10]!==v||t[11]!==y?(b=(0,Q.jsx)(m,{title:h,hideTitle:g,icon:v,children:y}),t[7]=m,t[8]=n.label,t[9]=g,t[10]=v,t[11]=y,t[12]=b):b=t[12],b}function kt(e){let t=(0,ct.c)(77),{environmentId:n,task:r,onEdit:i}=e,o;t[0]===n?o=t[1]:(o=V.upsertScheduledTask.permissionAtom(n),t[0]=n,t[1]=o);let s=ee(o),[c,l]=(0,Z.useState)(!1),[d,h]=(0,Z.useState)(!1),g=r.schedule.type===`webhook`,_;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(_={label:`scheduled task enabled`},t[2]=_):_=t[2];let b=oe(V.setScheduledTaskEnabled,_),S;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(S={label:`scheduled task run now`},t[3]=S):S=t[3];let w=oe(V.runScheduledTaskNow,S),E;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(E={label:`scheduled task delete`},t[4]=E):E=t[4];let k=oe(V.deleteScheduledTask,E),A;t[5]!==c||t[6]!==n||t[7]!==k||t[8]!==w||t[9]!==r.enabled||t[10]!==r.id||t[11]!==b?(A=async e=>{if(c||!ae(n,`orchestration:operate`))return;l(!0);let t=e===`toggle`?await b({environmentId:n,input:{id:r.id,enabled:!r.enabled}}):e===`run`?await w({environmentId:n,input:{id:r.id}}):await k({environmentId:n,input:{id:r.id}});l(!1),t._tag===`Failure`&&!te(t)&&re.add(W({type:`error`,title:`Could not update scheduled task`,description:String(ne(t))}))},t[5]=c,t[6]=n,t[7]=k,t[8]=w,t[9]=r.enabled,t[10]=r.id,t[11]=b,t[12]=A):A=t[12];let j=A,M=r.title,N;t[13]===r.prompt?N=t[14]:(N=(0,Q.jsx)(`span`,{className:`line-clamp-2`,children:r.prompt}),t[13]=r.prompt,t[14]=N);let P;t[15]===r.schedule?P=t[16]:(P=Ct(r.schedule),t[15]=r.schedule,t[16]=P);let F;t[17]!==g||t[18]!==r.enabled||t[19]!==r.nextRunAt?(F=r.enabled?g?`Listening`:r.nextRunAt?`Next run ${wt(r.nextRunAt)}`:`Not scheduled`:`Paused`,t[17]=g,t[18]=r.enabled,t[19]=r.nextRunAt,t[20]=F):F=t[20];let I;t[21]!==P||t[22]!==F?(I=(0,Q.jsxs)(`span`,{children:[P,` ·`,` `,F]}),t[21]=P,t[22]=F,t[23]=I):I=t[23];let L;t[24]===r.lastRunStatus?L=t[25]:(L=r.lastRunStatus===`never`?null:(0,Q.jsx)(u,{variant:Et(r.lastRunStatus),children:r.lastRunStatus}),t[24]=r.lastRunStatus,t[25]=L);let R;t[26]===r.lastRunError?R=t[27]:(R=r.lastRunError?(0,Q.jsx)(`span`,{className:`text-destructive`,children:r.lastRunError}):null,t[26]=r.lastRunError,t[27]=R);let z;t[28]!==I||t[29]!==L||t[30]!==R?(z=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[I,L,R]}),t[28]=I,t[29]=L,t[30]=R,t[31]=z):z=t[31];let B=c||!s,ie=`Enable ${r.title}`,H;t[32]===j?H=t[33]:(H=()=>void j(`toggle`),t[32]=j,t[33]=H);let U;t[34]!==B||t[35]!==ie||t[36]!==H||t[37]!==r.enabled?(U=(0,Q.jsx)(at,{checked:r.enabled,disabled:B,"aria-label":ie,onCheckedChange:H}),t[34]=B,t[35]=ie,t[36]=H,t[37]=r.enabled,t[38]=U):U=t[38];let se=c||!s,ce=`Actions for ${r.title}`,G;t[39]!==se||t[40]!==ce?(G=(0,Q.jsx)(T,{size:`icon-sm`,variant:`ghost`,disabled:se,"aria-label":ce}),t[39]=se,t[40]=ce,t[41]=G):G=t[41];let K;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(v,{className:`size-4`}),t[42]=K):K=t[42];let q;t[43]===G?q=t[44]:(q=(0,Q.jsx)(O,{render:G,children:K}),t[43]=G,t[44]=q);let J;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Q.jsx)(y,{}),t[45]=J):J=t[45];let le;t[46]===i?le=t[47]:(le=(0,Q.jsxs)(a,{onClick:i,children:[J,`Edit`]}),t[46]=i,t[47]=le);let Y;t[48]!==j||t[49]!==g?(Y=g?(0,Q.jsxs)(a,{onClick:()=>h(!0),children:[(0,Q.jsx)(f,{}),`Deliveries`]}):(0,Q.jsxs)(a,{onClick:()=>void j(`run`),children:[(0,Q.jsx)(p,{}),`Run now`]}),t[48]=j,t[49]=g,t[50]=Y):Y=t[50];let ue;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Q.jsx)(C,{}),t[51]=ue):ue=t[51];let de;t[52]===j?de=t[53]:(de=()=>void j(`delete`),t[52]=j,t[53]=de);let fe;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Q.jsx)(m,{}),t[54]=fe):fe=t[54];let pe;t[55]===de?pe=t[56]:(pe=(0,Q.jsxs)(a,{onClick:de,children:[fe,`Delete`]}),t[55]=de,t[56]=pe);let X;t[57]!==le||t[58]!==Y||t[59]!==pe?(X=(0,Q.jsxs)(D,{align:`end`,children:[le,Y,ue,pe]}),t[57]=le,t[58]=Y,t[59]=pe,t[60]=X):X=t[60];let me;t[61]!==q||t[62]!==X?(me=(0,Q.jsxs)(x,{children:[q,X]}),t[61]=q,t[62]=X,t[63]=me):me=t[63];let he;t[64]!==d||t[65]!==n||t[66]!==r?(he=d?(0,Q.jsx)(At,{environmentId:n,task:r,onClose:()=>h(!1)}):null,t[64]=d,t[65]=n,t[66]=r,t[67]=he):he=t[67];let ge;t[68]!==U||t[69]!==me||t[70]!==he?(ge=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[U,me,he]}),t[68]=U,t[69]=me,t[70]=he,t[71]=ge):ge=t[71];let _e;return t[72]!==z||t[73]!==ge||t[74]!==N||t[75]!==r.title?(_e=(0,Q.jsx)(Le,{title:M,description:N,status:z,control:ge}),t[72]=z,t[73]=ge,t[74]=N,t[75]=r.title,t[76]=_e):_e=t[76],_e}function At(e){let t=(0,ct.c)(38),{environmentId:n,task:r,onClose:i}=e,a;t[0]!==n||t[1]!==r.id?(a=V.scheduledTaskWebhookDeliveries({environmentId:n,input:{id:r.id,acceptAnyOutcome:!0}}),t[0]=n,t[1]=r.id,t[2]=a):a=t[2];let o=U(a),[s,c]=(0,Z.useState)(null),l;t[3]!==n||t[4]!==s||t[5]!==r.id?(l=s===null?null:V.scheduledTaskWebhookDelivery({environmentId:n,input:{id:r.id,deliveryId:s,acceptAnyOutcome:!0}}),t[3]=n,t[4]=s,t[5]=r.id,t[6]=l):l=t[6];let d=U(l),f=o.data?.deliveries??null,p=d.data?.delivery??null,m=s===null?o.error:d.error,h;t[7]===i?h=t[8]:(h=e=>{e||i()},t[7]=i,t[8]=h);let g;t[9]===r.title?g=t[10]:(g=(0,Q.jsxs)(Ce,{children:[`Deliveries · `,r.title]}),t[9]=r.title,t[10]=g);let _;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(De,{children:`Recent requests to this task's webhook URL.`}),t[11]=_):_=t[11];let v;t[12]===g?v=t[13]:(v=(0,Q.jsxs)(Se,{children:[g,_]}),t[12]=g,t[13]=v);let y;t[14]===m?y=t[15]:(y=m?(0,Q.jsx)(`p`,{className:`text-sm text-destructive`,children:m}):null,t[14]=m,t[15]=y);let b;t[16]!==f||t[17]!==p||t[18]!==s||t[19]!==d.error?(b=s!==null&&p===null&&d.error===null?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,role:`status`,children:`Loading delivery…`}):p?(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,Q.jsx)(u,{variant:Tt(p.pendingWindow?`coalesced`:p.outcome),children:$e(p)}),(0,Q.jsxs)(`span`,{children:[p.method,` · `,wt(p.receivedAt)]}),p.signatureVerified?(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`Signature verified`}):null]}),p.error?(0,Q.jsx)(`p`,{className:p.outcome===`filtered`?`text-sm text-muted-foreground`:`text-sm text-destructive`,children:p.error}):null,(0,Q.jsx)(Mt,{title:p.pendingWindow?`Scheduled run`:`Prompt sent to the agent`,children:p.renderedPrompt??(p.pendingWindow?`Run scheduled when the window closes; no run started yet.`:`No run was started for this request.`)}),p.missingFields.length>0?(0,Q.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Empty placeholders: `,p.missingFields.join(`, `)]}):null,(0,Q.jsx)(Mt,{title:`Headers`,children:Object.entries(p.headers).map(jt).join(`
|
|
2
|
-
`)}),p.query?(0,Q.jsx)(Mt,{title:`Query`,children:p.query}):null,(0,Q.jsx)(Mt,{title:p.bodyTruncated?`Body (truncated)`:`Body`,children:p.body||`(empty)`})]}):s===null?f===null?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,role:`status`,children:`Loading deliveries…`}):f.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No requests yet.`}):(0,Q.jsx)(`ul`,{className:`divide-y divide-border`,children:f.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`button`,{type:`button`,className:`flex w-full flex-wrap items-center gap-2 py-2 text-left text-sm hover:bg-accent/40`,onClick:()=>c(e.id),children:[(0,Q.jsx)(u,{variant:Tt(e.pendingWindow?`coalesced`:e.outcome),children:$e(e)}),(0,Q.jsx)(`span`,{children:e.method}),(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:wt(e.receivedAt)}),e.outcome===`filtered`&&e.error?(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:e.error}):null,e.missingFields.length>0?(0,Q.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.missingFields.length,` empty placeholder`,e.missingFields.length===1?``:`s`]}):null]})},e.id))}):null,t[16]=f,t[17]=p,t[18]=s,t[19]=d.error,t[20]=b):b=t[20];let x;t[21]!==y||t[22]!==b?(x=(0,Q.jsxs)(Ee,{children:[y,b]}),t[21]=y,t[22]=b,t[23]=x):x=t[23];let S;t[24]!==o.isPending||t[25]!==o.refresh||t[26]!==s?(S=s===null?(0,Q.jsx)(T,{variant:`outline`,size:`sm`,disabled:o.isPending,onClick:o.refresh,children:`Refresh`}):(0,Q.jsx)(T,{variant:`outline`,size:`sm`,onClick:()=>c(null),children:`Back`}),t[24]=o.isPending,t[25]=o.refresh,t[26]=s,t[27]=S):S=t[27];let C;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(Te,{render:(0,Q.jsx)(T,{size:`sm`}),children:`Done`}),t[28]=C):C=t[28];let w;t[29]===S?w=t[30]:(w=(0,Q.jsxs)(we,{children:[S,C]}),t[29]=S,t[30]=w);let E;t[31]!==w||t[32]!==v||t[33]!==x?(E=(0,Q.jsxs)(Oe,{className:`max-w-2xl`,children:[v,x,w]}),t[31]=w,t[32]=v,t[33]=x,t[34]=E):E=t[34];let D;return t[35]!==E||t[36]!==h?(D=(0,Q.jsx)(ke,{open:!0,onOpenChange:h,children:E}),t[35]=E,t[36]=h,t[37]=D):D=t[37],D}function jt(e){let[t,n]=e;return`${t}: ${n}`}function Mt(e){let t=(0,ct.c)(7),{title:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,Q.jsx)(ot,{children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Q.jsx)(`pre`,{className:`max-h-64 overflow-auto rounded-md bg-muted p-2 text-xs whitespace-pre-wrap break-all`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Nt(e){let t=(0,ct.c)(40),{environmentId:n,task:r}=e,a;t[0]===n?a=t[1]:(a=V.rotateScheduledTaskWebhookToken.permissionAtom(n),t[0]=n,t[1]=a);let o=ee(a),s=R(n),c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c={target:`webhook URL`},t[2]=c):c=t[2];let{copyToClipboard:l,isCopied:u}=L(c),d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d={label:`scheduled task rotate webhook token`},t[3]=d):d=t[3];let f=oe(V.rotateScheduledTaskWebhookToken,d),[p,m]=(0,Z.useState)(!1),h=r?.webhook;if(!r||!h){let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`The URL appears after you save.`}),t[4]=e):e=t[4],e}let g;t[5]!==h||t[6]!==s?(g=ft(h,s),t[5]=h,t[6]=s,t[7]=g):g=t[7];let{address:_,copyable:v,note:y}=g,b;t[8]!==n||t[9]!==f||t[10]!==r?(b=async()=>{if(!(await B(`Rotate this webhook URL?
|
|
3
|
-
The current URL stops working.`,{variant:`destructive`})??window.confirm(`Rotate this webhook URL? The current URL stops working.`)))return;m(!0);let e=await f({environmentId:n,input:{id:r.id}});m(!1),e._tag===`Failure`&&!te(e)&&re.add(W({type:`error`,title:`Could not rotate webhook URL`,description:String(ne(e))}))},t[8]=n,t[9]=f,t[10]=r,t[11]=b):b=t[11];let x=b,S;t[12]===_?S=t[13]:(S=(0,Q.jsx)(be,{readOnly:!0,"aria-label":`Webhook URL`,value:_,onFocus:Pt}),t[12]=_,t[13]=S);let C=!v,w;t[14]!==l||t[15]!==_?(w=()=>l(_,void 0),t[14]=l,t[15]=_,t[16]=w):w=t[16];let E;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(i,{}),t[17]=E):E=t[17];let D=u?`Copied`:`Copy`,O;t[18]!==D||t[19]!==C||t[20]!==w?(O=(0,Q.jsxs)(T,{size:`sm`,variant:`outline`,type:`button`,disabled:C,onClick:w,children:[E,D]}),t[18]=D,t[19]=C,t[20]=w,t[21]=O):O=t[21];let k=p||!o,A;t[22]===x?A=t[23]:(A=()=>void x(),t[22]=x,t[23]=A);let j;t[24]!==k||t[25]!==A?(j=(0,Q.jsx)(T,{size:`sm`,variant:`outline`,type:`button`,disabled:k,onClick:A,children:`Rotate`}),t[24]=k,t[25]=A,t[26]=j):j=t[26];let M;t[27]!==O||t[28]!==j||t[29]!==S?(M=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[S,O,j]}),t[27]=O,t[28]=j,t[29]=S,t[30]=M):M=t[30];let N;t[31]===y?N=t[32]:(N=y===null?null:(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:y}),t[31]=y,t[32]=N);let P;t[33]!==h.url||t[34]!==n?(P=h.url===null?null:(0,Q.jsx)(Ft,{environmentId:n}),t[33]=h.url,t[34]=n,t[35]=P):P=t[35];let F;return t[36]!==M||t[37]!==N||t[38]!==P?(F=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[M,N,P]}),t[36]=M,t[37]=N,t[38]=P,t[39]=F):F=t[39],F}function Pt(e){return e.currentTarget.select()}function Ft(e){let t=(0,ct.c)(3),{environmentId:n}=e,r=Ue();if(r.target?.environmentId!==n||r.data===null)return null;let i=r.data.holdWebhooksWhileOffline?`Held for up to 24 hours while this environment is offline. `:`Forwarded live. Requests fail while this environment is offline. `,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(I,{to:`/settings/connections`,className:`underline underline-offset-2`,children:`Change in Connections`}),t[0]=a):a=t[0];let o;return t[1]===i?o=t[2]:(o=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[i,a]}),t[1]=i,t[2]=o),o}function It(e){let t=(0,ct.c)(207),{initialEnvironmentId:n,initialThreadId:r,initialProjectId:i,task:a,onClose:o}=e,{scope:c,connectedEnvironments:u}=Ie(),[f,p]=(0,Z.useState)(n),m=z(f),h=m?.connection.phase===`connected`&&m.serverConfig!==null,_;t[0]!==h||t[1]!==f?(_=h?V.scheduledTasksLive({environmentId:f,input:{}}):null,t[0]=h,t[1]=f,t[2]=_):_=t[2];let v=U(_),y=A(),x;if(t[3]!==y||t[4]!==f||t[5]!==c){let e;t[7]!==f||t[8]!==c?(e=e=>e.environmentId===f&&Xe(c,f,e.id),t[7]=f,t[8]=c,t[9]=e):e=t[9],x=y.filter(e),t[3]=y,t[4]=f,t[5]=c,t[6]=x}else x=t[6];let S=x,C=ie(f),E=ee(V.providersValueAtom(f))??H,D;t[10]===f?D=t[11]:(D=V.upsertScheduledTask.permissionAtom(f),t[10]=f,t[11]=D);let O=ee(D),k;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(k={label:`scheduled task upsert`},t[12]=k):k=t[12];let I=oe(V.upsertScheduledTask,k),re;t[13]!==i||t[14]!==r||t[15]!==S[0]?.id||t[16]!==a?(re=()=>a?We(a):{...yt,projectId:i??S[0]?.id??``,threadId:r??``},t[13]=i,t[14]=r,t[15]=S[0]?.id,t[16]=a,t[17]=re):re=t[17];let[L,R]=(0,Z.useState)(re),[B,W]=(0,Z.useState)(!1),se=(0,Z.useRef)(!1),ce;t[18]!==L.editingId||t[19]!==v.data?(ce=L.editingId!==null&&v.data!==null&&!v.data.tasks.some(e=>e.id===L.editingId),t[18]=L.editingId,t[19]=v.data,t[20]=ce):ce=t[20];let G=ce,K;t[21]!==L.editingId||t[22]!==a||t[23]!==v.data?(K=v.data?v.data.tasks.find(e=>e.id===L.editingId)??null:a,t[21]=L.editingId,t[22]=a,t[23]=v.data,t[24]=K):K=t[24];let q=K,J=L.projectId||S[0]?.id||``,le;if(t[25]!==S||t[26]!==J){let e;t[28]===J?e=t[29]:(e=e=>e.id===J,t[28]=J,t[29]=e),le=S.find(e),t[25]=S,t[26]=J,t[27]=le}else le=t[27];let Y=le;Y?.id;let pe;t[30]!==E||t[31]!==Y?.id||t[32]!==C?(pe=d(b(l(E),C,Y?.id??null)),t[30]=E,t[31]=Y?.id,t[32]=C,t[33]=pe):pe=t[33];let X=pe,me=X[0],he;t[34]===L.modelKey?he=t[35]:(he=L.modelKey?St(L.modelKey):null,t[34]=L.modelKey,t[35]=he);let ge=he,_e;t[36]!==ge||t[37]!==X||t[38]!==Y||t[39]!==C?(_e=ge&&X.some(e=>e.instanceId===ge.instanceId&&e.enabled)?ge:Je(C,Y??null,X),t[36]=ge,t[37]=X,t[38]=Y,t[39]=C,t[40]=_e):_e=t[40];let ve=_e,ye=ve?.instanceId??me?.instanceId??``,xe=ve?.model??``,Ae;t[41]!==ye||t[42]!==xe||t[43]!==E||t[44]!==C?(Ae=g(C,E,ye,xe),t[41]=ye,t[42]=xe,t[43]=E,t[44]=C,t[45]=Ae):Ae=t[45];let je=Ae,Me=Vt,Ne;t[46]!==ve||t[47]!==h||t[48]!==L||t[49]!==G||t[50]!==f||t[51]!==q||t[52]!==o||t[53]!==S||t[54]!==B||t[55]!==J||t[56]!==v.data||t[57]!==I?(Ne=async()=>{if(!ae(f,`orchestration:operate`)||se.current||B||G||!h||v.data===null)return;let e=ve;if(!L.title.trim()||!L.prompt.trim()||!S.some(e=>e.id===J)||e===null){Me(`Scheduled task is incomplete`,`Add a title, prompt, project, and model.`);return}let t=qe(L.filters);if(L.scheduleMode===`webhook`&&`error`in t){Me(`Invalid filter`,t.error);return}let n=Qe(L);if(n===null){for(let e of Ge(L))Me(e.title,e.description);return}if(n.type===`webhook`&&n.signature&&(!n.signature.header||!n.signature.secret&&!(q?.schedule.type===`webhook`&&q.webhook?.hasSecret))){Me(`Signing secret is required`,`Enter the signature header and secret.`);return}if(n.type===`interval`&&(!Number.isSafeInteger(n.everyMs)||n.everyMs<6e4)){Me(`Invalid interval`,`Enter an interval of at least one minute.`);return}if(L.workspaceMode===`existing_worktree`&&!L.existingWorktreePath.trim()){Me(`Checkout path is required`,`Enter the path of the checkout to run in.`);return}let r=L.baseModelSelection!==null&&L.baseModelSelection.instanceId===e.instanceId&&L.baseModelSelection.model===e.model?L.baseModelSelection:e,i=L.workspaceMode===`root`?{type:`root`}:L.workspaceMode===`existing_worktree`?{type:`existing_worktree`,worktreePath:L.existingWorktreePath.trim()}:{type:L.workspaceMode,baseRef:L.baseRef.trim()||`main`,startFromOrigin:L.startFromOrigin},a={...L.editingId?{id:L.editingId,requireExisting:!0}:{},title:L.title.trim(),prompt:L.prompt.trim(),enabled:L.enabled,schedule:n,projectId:J,threadId:L.threadId?L.threadId:null,workspaceStrategy:i,modelSelection:r,runtimeMode:L.runtimeMode,interactionMode:L.interactionMode,creationSource:`web`};se.current=!0,W(!0);let s=await I({environmentId:f,input:a});if(W(!1),s._tag===`Failure`){se.current=!1,te(s)||Me(`Could not save scheduled task`,ne(s));return}o()},t[46]=ve,t[47]=h,t[48]=L,t[49]=G,t[50]=f,t[51]=q,t[52]=o,t[53]=S,t[54]=B,t[55]=J,t[56]=v.data,t[57]=I,t[58]=Ne):Ne=t[58];let Pe=Ne,Le;t[59]!==o||t[60]!==B?(Le=e=>{!e&&!B&&o()},t[59]=o,t[60]=B,t[61]=Le):Le=t[61];let Re=L.editingId?`Edit task`:`New task`,Be;t[62]===Re?Be=t[63]:(Be=(0,Q.jsx)(Ce,{children:Re}),t[62]=Re,t[63]=Be);let Ve;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=(0,Q.jsx)(De,{children:`Run a prompt automatically — on an interval, at a fixed time, or when a webhook is called.`}),t[64]=Ve):Ve=t[64];let He;t[65]===Be?He=t[66]:(He=(0,Q.jsxs)(Se,{children:[Be,Ve]}),t[65]=Be,t[66]=He);let Ue;t[67]===h?Ue=t[68]:(Ue=h?null:(0,Q.jsx)(`p`,{className:`text-sm text-destructive`,children:`Reconnect this environment before saving.`}),t[67]=h,t[68]=Ue);let Ke=a!==null||B,Ze;t[69]===u?Ze=t[70]:(Ze=e=>{let t=u.find(t=>t.environmentId===e);t&&(p(t.environmentId),R(Bt))},t[69]=u,t[70]=Ze);let $e=m?.serverConfig??null,et;t[71]===$e?et=t[72]:(et=s($e),t[71]=$e,t[72]=et);let tt;t[73]===et?tt=t[74]:(tt=(0,Q.jsx)(Fe,{kind:et,className:`size-4`}),t[73]=et,t[74]=tt);let nt=m?.label??`Unavailable environment`,rt;t[75]!==tt||t[76]!==nt?(rt=(0,Q.jsx)(P,{id:`scheduled-task-environment`,size:`sm`,children:(0,Q.jsx)(M,{children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[tt,nt]})})}),t[75]=tt,t[76]=nt,t[77]=rt):rt=t[77];let it;t[78]===u?it=t[79]:(it=u.map(zt),t[78]=u,t[79]=it);let lt;t[80]===it?lt=t[81]:(lt=(0,Q.jsx)(N,{children:it}),t[80]=it,t[81]=lt);let ut;t[82]!==f||t[83]!==Ke||t[84]!==Ze||t[85]!==rt||t[86]!==lt?(ut=(0,Q.jsx)($,{label:`Runs on`,htmlFor:`scheduled-task-environment`,children:(0,Q.jsxs)(F,{value:f,disabled:Ke,onValueChange:Ze,children:[rt,lt]})}),t[82]=f,t[83]=Ke,t[84]=Ze,t[85]=rt,t[86]=lt,t[87]=ut):ut=t[87];let dt;t[88]===v.error?dt=t[89]:(dt=v.error?(0,Q.jsx)(`p`,{className:`text-sm text-destructive`,role:`status`,children:v.error}):null,t[88]=v.error,t[89]=dt);let ft;t[90]===G?ft=t[91]:(ft=G?(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,role:`status`,children:`This scheduled task no longer exists.`}):null,t[90]=G,t[91]=ft);let mt;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(mt=e=>R(t=>({...t,title:e.target.value})),t[92]=mt):mt=t[92];let gt;t[93]===L.title?gt=t[94]:(gt=(0,Q.jsx)($,{label:`Name`,htmlFor:`scheduled-task-title`,children:(0,Q.jsx)(be,{id:`scheduled-task-title`,placeholder:`e.g. Check for Sentry issues`,value:L.title,onChange:mt})}),t[93]=L.title,t[94]=gt);let _t;t[95]===Symbol.for(`react.memo_cache_sentinel`)?(_t=e=>R(t=>({...t,projectId:e??``})),t[95]=_t):_t=t[95];let xt=Y?.title,Ct;t[96]===xt?Ct=t[97]:(Ct=(0,Q.jsx)(P,{size:`sm`,id:`scheduled-task-project`,children:(0,Q.jsx)(M,{placeholder:`Select a project`,children:xt})}),t[96]=xt,t[97]=Ct);let wt;t[98]===S?wt=t[99]:(wt=S.map(Rt),t[98]=S,t[99]=wt);let Tt;t[100]===wt?Tt=t[101]:(Tt=(0,Q.jsx)(N,{children:wt}),t[100]=wt,t[101]=Tt);let Et;t[102]!==J||t[103]!==Ct||t[104]!==Tt?(Et=(0,Q.jsx)($,{label:`Project`,htmlFor:`scheduled-task-project`,children:(0,Q.jsxs)(F,{value:J,onValueChange:_t,children:[Ct,Tt]})}),t[102]=J,t[103]=Ct,t[104]=Tt,t[105]=Et):Et=t[105];let Dt;t[106]===Symbol.for(`react.memo_cache_sentinel`)?(Dt=e=>R(t=>({...t,workspaceMode:e})),t[106]=Dt):Dt=t[106];let Ot=vt[L.workspaceMode],kt;t[107]===Ot?kt=t[108]:(kt=(0,Q.jsx)(P,{size:`sm`,id:`scheduled-task-workspace`,children:(0,Q.jsx)(M,{children:Ot})}),t[107]=Ot,t[108]=kt);let At;t[109]===Symbol.for(`react.memo_cache_sentinel`)?(At=(0,Q.jsxs)(N,{children:[(0,Q.jsx)(j,{value:`auto`,children:`Choose automatically`}),(0,Q.jsx)(j,{value:`worktree`,children:`Create a new worktree`}),(0,Q.jsx)(j,{value:`root`,children:`Use the project checkout`}),(0,Q.jsx)(j,{value:`existing_worktree`,children:`Use a specific checkout`})]}),t[109]=At):At=t[109];let jt;t[110]!==L.workspaceMode||t[111]!==kt?(jt=(0,Q.jsx)($,{label:`Workspace`,htmlFor:`scheduled-task-workspace`,children:(0,Q.jsxs)(F,{value:L.workspaceMode,onValueChange:Dt,children:[kt,At]})}),t[110]=L.workspaceMode,t[111]=kt,t[112]=jt):jt=t[112];let Mt;t[113]!==Et||t[114]!==jt?(Mt=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[Et,jt]}),t[113]=Et,t[114]=jt,t[115]=Mt):Mt=t[115];let Pt;t[116]!==h||t[117]!==L.baseRef||t[118]!==L.startFromOrigin||t[119]!==L.workspaceMode||t[120]!==f||t[121]!==B||t[122]!==Y?.workspaceRoot||t[123]!==J?(Pt=L.workspaceMode===`worktree`||L.workspaceMode===`auto`?(0,Q.jsx)($,{label:`Base branch`,htmlFor:`scheduled-task-base-ref`,children:(0,Q.jsx)(pt,{id:`scheduled-task-base-ref`,environmentId:f,cwd:Y?.workspaceRoot??null,value:L.baseRef,onValueChange:e=>R(t=>({...t,baseRef:e})),startFromOrigin:L.startFromOrigin,onStartFromOriginChange:e=>R(t=>({...t,startFromOrigin:e})),disabled:B||!h},`${f}:${J}`)}):null,t[116]=h,t[117]=L.baseRef,t[118]=L.startFromOrigin,t[119]=L.workspaceMode,t[120]=f,t[121]=B,t[122]=Y?.workspaceRoot,t[123]=J,t[124]=Pt):Pt=t[124];let Ft;t[125]!==L.existingWorktreePath||t[126]!==L.workspaceMode?(Ft=L.workspaceMode===`existing_worktree`?(0,Q.jsx)($,{label:`Checkout path`,htmlFor:`scheduled-task-checkout`,children:(0,Q.jsx)(be,{id:`scheduled-task-checkout`,value:L.existingWorktreePath,placeholder:`/path/to/checkout`,onChange:e=>R(t=>({...t,existingWorktreePath:e.target.value}))})}):null,t[125]=L.existingWorktreePath,t[126]=L.workspaceMode,t[127]=Ft):Ft=t[127];let It;t[128]===Symbol.for(`react.memo_cache_sentinel`)?(It=e=>R(t=>({...t,prompt:e.target.value})),t[128]=It):It=t[128];let Ht;t[129]===L.prompt?Ht=t[130]:(Ht=(0,Q.jsx)($,{label:`Prompt`,htmlFor:`scheduled-task-prompt`,children:(0,Q.jsx)(ue,{id:`scheduled-task-prompt`,className:`max-h-64 overflow-y-auto`,placeholder:`What should the agent do each time this runs?`,value:L.prompt,onChange:It})}),t[129]=L.prompt,t[130]=Ht);let Ut=B||!h,Wt;t[131]===Symbol.for(`react.memo_cache_sentinel`)?(Wt=(e,t)=>R(n=>({...n,modelKey:`${e}:${t}`})),t[131]=Wt):Wt=t[131];let Gt;t[132]!==ye||t[133]!==xe||t[134]!==f||t[135]!==X||t[136]!==je||t[137]!==Ut?(Gt=(0,Q.jsx)($,{label:`Model`,children:(0,Q.jsx)(`div`,{children:(0,Q.jsx)(st,{environmentId:f,disabled:Ut,activeInstanceId:ye,model:xe,lockedProvider:null,instanceEntries:X,modelOptionsByInstance:je,isComposerOwned:!1,triggerClassName:ze,onInstanceModelChange:Wt})})}),t[132]=ye,t[133]=xe,t[134]=f,t[135]=X,t[136]=je,t[137]=Ut,t[138]=Gt):Gt=t[138];let Kt;t[139]===a?Kt=t[140]:(Kt=a?.schedule.type===`interval`&&a.schedule.everyMs<6e4?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,role:`status`,children:`This task uses a legacy interval below one minute. Saving updates it to at least one minute.`}):null,t[139]=a,t[140]=Kt);let qt;t[141]===Symbol.for(`react.memo_cache_sentinel`)?(qt=(0,Q.jsx)(ot,{children:`Schedule`}),t[141]=qt):qt=t[141];let Jt;t[142]===L.scheduleMode?Jt=t[143]:(Jt=[L.scheduleMode],t[142]=L.scheduleMode,t[143]=Jt);let Yt,Xt,Zt,Qt;t[144]===Symbol.for(`react.memo_cache_sentinel`)?(Yt=e=>{let t=e[0];(t===`fixed`||t===`interval`||t===`webhook`)&&R(e=>({...e,scheduleMode:t,prompt:t===`webhook`&&!e.prompt.trim()?Ye:e.prompt}))},Xt=(0,Q.jsx)(fe,{value:`fixed`,children:`At a time`}),Zt=(0,Q.jsx)(fe,{value:`interval`,children:`Every interval`}),Qt=(0,Q.jsx)(fe,{value:`webhook`,children:`On webhook`}),t[144]=Yt,t[145]=Xt,t[146]=Zt,t[147]=Qt):(Yt=t[144],Xt=t[145],Zt=t[146],Qt=t[147]);let $t;t[148]===Jt?$t=t[149]:($t=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[qt,(0,Q.jsxs)(de,{"aria-label":`Schedule type`,value:Jt,onValueChange:Yt,children:[Xt,Zt,Qt]})]}),t[148]=Jt,t[149]=$t);let en;t[150]!==L.coalesceKey||t[151]!==L.coalesceWindowSeconds||t[152]!==L.filters||t[153]!==L.intervalMinutes||t[154]!==L.maxDeliveryAgeMinutes||t[155]!==L.replayKey||t[156]!==L.scheduleMode||t[157]!==L.signatureEnabled||t[158]!==L.signatureEncoding||t[159]!==L.signatureHeader||t[160]!==L.signaturePrefix||t[161]!==L.signatureSecret||t[162]!==L.timeOfDay||t[163]!==L.weekdays||t[164]!==f||t[165]!==q?(en=L.scheduleMode===`webhook`?(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(Nt,{environmentId:f,task:q}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Each request runs the prompt. Use {{body.path}}, {{headers.name}}, {{query.name}}, {{body}} or {{request}} in the prompt; only what it names reaches the agent.`}),(0,Q.jsx)($,{label:`Skip requests older than`,hint:`minutes, optional`,htmlFor:`scheduled-task-max-age`,children:(0,Q.jsx)(be,{id:`scheduled-task-max-age`,type:`number`,nativeInput:!0,min:1,max:w,placeholder:`Run every request`,value:L.maxDeliveryAgeMinutes,onChange:e=>R(t=>({...t,maxDeliveryAgeMinutes:e.target.value}))})}),(0,Q.jsx)(bt,{filters:L.filters,onChange:e=>R(t=>({...t,filters:e}))}),(0,Q.jsx)($,{label:`Replay key`,hint:`template, optional`,htmlFor:`scheduled-task-replay-key`,children:(0,Q.jsx)(be,{id:`scheduled-task-replay-key`,placeholder:`{{headers.delivery-id}}`,value:L.replayKey,onChange:e=>R(t=>({...t,replayKey:e.target.value}))})}),(0,Q.jsx)($,{label:`Coalesce key`,hint:`template, optional`,htmlFor:`scheduled-task-coalesce-key`,children:(0,Q.jsx)(be,{id:`scheduled-task-coalesce-key`,placeholder:`{{body.id}}`,value:L.coalesceKey,onChange:e=>R(t=>({...t,coalesceKey:e.target.value}))})}),(0,Q.jsx)($,{label:`Coalesce window`,hint:`seconds, 10–3600`,htmlFor:`scheduled-task-coalesce-window`,children:(0,Q.jsx)(be,{id:`scheduled-task-coalesce-window`,type:`number`,nativeInput:!0,min:10,max:3600,placeholder:`120`,value:L.coalesceWindowSeconds,onChange:e=>R(t=>({...t,coalesceWindowSeconds:e.target.value}))})}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Replay keys suppress repeat deliveries for 7 days. Coalescing runs the latest payload once when the window from the first delivery closes. Empty keys run normally.`}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,Q.jsx)(ot,{htmlFor:`scheduled-task-signature`,children:`Require signature`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Reject requests without a valid HMAC-SHA256 signature of the body.`})]}),(0,Q.jsx)(at,{id:`scheduled-task-signature`,checked:L.signatureEnabled,onCheckedChange:e=>R(t=>({...t,signatureEnabled:e}))})]}),L.signatureEnabled?(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Q.jsx)($,{label:`Header`,htmlFor:`scheduled-task-signature-header`,children:(0,Q.jsx)(be,{id:`scheduled-task-signature-header`,value:L.signatureHeader,onChange:e=>R(t=>({...t,signatureHeader:e.target.value}))})}),(0,Q.jsx)($,{label:`Prefix`,htmlFor:`scheduled-task-signature-prefix`,children:(0,Q.jsx)(be,{id:`scheduled-task-signature-prefix`,value:L.signaturePrefix,placeholder:`None`,onChange:e=>R(t=>({...t,signaturePrefix:e.target.value}))})}),(0,Q.jsx)($,{label:`Encoding`,htmlFor:`scheduled-task-signature-encoding`,children:(0,Q.jsxs)(F,{value:L.signatureEncoding,onValueChange:e=>R(t=>({...t,signatureEncoding:e===`base64`?`base64`:`hex`})),children:[(0,Q.jsx)(P,{size:`sm`,id:`scheduled-task-signature-encoding`,children:(0,Q.jsx)(M,{children:L.signatureEncoding})}),(0,Q.jsxs)(N,{children:[(0,Q.jsx)(j,{value:`hex`,children:`hex`}),(0,Q.jsx)(j,{value:`base64`,children:`base64`})]})]})}),(0,Q.jsx)($,{label:`Secret`,htmlFor:`scheduled-task-signature-secret`,children:(0,Q.jsx)(be,{id:`scheduled-task-signature-secret`,type:`password`,autoComplete:`off`,value:L.signatureSecret,placeholder:q?.schedule.type===`webhook`&&q.webhook?.hasSecret?`Unchanged`:`Shared secret`,onChange:e=>R(t=>({...t,signatureSecret:e.target.value}))})})]}):null]}):L.scheduleMode===`fixed`?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(ot,{htmlFor:`scheduled-task-time`,children:`Run at`}),(0,Q.jsx)(be,{type:`time`,id:`scheduled-task-time`,nativeInput:!0,className:`w-32`,value:L.timeOfDay,onChange:e=>R(t=>({...t,timeOfDay:e.target.value}))}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`on`})]}),(0,Q.jsx)(de,{multiple:!0,variant:`outline`,size:`sm`,"aria-label":`Days to run`,value:[...L.weekdays].map(String),onValueChange:e=>{e.length!==0&&R(t=>({...t,weekdays:new Set(e.map(Number))}))},children:ht.map(Lt)})]}):(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(ot,{htmlFor:`scheduled-task-interval`,children:`Run every`}),(0,Q.jsx)(be,{type:`number`,id:`scheduled-task-interval`,nativeInput:!0,min:1,step:`any`,className:`w-24`,value:L.intervalMinutes,onChange:e=>R(t=>({...t,intervalMinutes:e.target.value}))}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`minutes`})]}),t[150]=L.coalesceKey,t[151]=L.coalesceWindowSeconds,t[152]=L.filters,t[153]=L.intervalMinutes,t[154]=L.maxDeliveryAgeMinutes,t[155]=L.replayKey,t[156]=L.scheduleMode,t[157]=L.signatureEnabled,t[158]=L.signatureEncoding,t[159]=L.signatureHeader,t[160]=L.signaturePrefix,t[161]=L.signatureSecret,t[162]=L.timeOfDay,t[163]=L.weekdays,t[164]=f,t[165]=q,t[166]=en):en=t[166];let tn;t[167]!==Kt||t[168]!==$t||t[169]!==en?(tn=(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[Kt,$t,en]}),t[167]=Kt,t[168]=$t,t[169]=en,t[170]=tn):tn=t[170];let nn;t[171]===Symbol.for(`react.memo_cache_sentinel`)?(nn=(0,Q.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,Q.jsx)(ot,{htmlFor:`scheduled-task-enabled`,children:`Enabled`}),(0,Q.jsx)(`p`,{id:`scheduled-task-enabled-description`,className:`text-sm text-muted-foreground`,children:`Disabled tasks stay saved but do not run.`})]}),t[171]=nn):nn=t[171];let rn;t[172]===Symbol.for(`react.memo_cache_sentinel`)?(rn=e=>R(t=>({...t,enabled:e})),t[172]=rn):rn=t[172];let an;t[173]===L.enabled?an=t[174]:(an=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[nn,(0,Q.jsx)(at,{id:`scheduled-task-enabled`,"aria-describedby":`scheduled-task-enabled-description`,checked:L.enabled,onCheckedChange:rn})]}),t[173]=L.enabled,t[174]=an);let on;t[175]!==B||t[176]!==Ue||t[177]!==ut||t[178]!==dt||t[179]!==ft||t[180]!==gt||t[181]!==Mt||t[182]!==Pt||t[183]!==Ft||t[184]!==Ht||t[185]!==Gt||t[186]!==tn||t[187]!==an?(on=(0,Q.jsx)(Ee,{children:(0,Q.jsxs)(`fieldset`,{disabled:B,className:`space-y-5`,children:[Ue,ut,dt,ft,gt,Mt,Pt,Ft,Ht,Gt,tn,an]})}),t[175]=B,t[176]=Ue,t[177]=ut,t[178]=dt,t[179]=ft,t[180]=gt,t[181]=Mt,t[182]=Pt,t[183]=Ft,t[184]=Ht,t[185]=Gt,t[186]=tn,t[187]=an,t[188]=on):on=t[188];let sn;t[189]===B?sn=t[190]:(sn=(0,Q.jsx)(Te,{render:(0,Q.jsx)(T,{variant:`outline`,size:`sm`,disabled:B}),children:`Cancel`}),t[189]=B,t[190]=sn);let cn=!O||B||G||!h||!v.data,ln;t[191]===Pe?ln=t[192]:(ln=()=>void Pe(),t[191]=Pe,t[192]=ln);let un=L.editingId?`Save task`:`Create task`,dn;t[193]!==cn||t[194]!==ln||t[195]!==un?(dn=(0,Q.jsx)(T,{size:`sm`,disabled:cn,onClick:ln,children:un}),t[193]=cn,t[194]=ln,t[195]=un,t[196]=dn):dn=t[196];let fn;t[197]!==sn||t[198]!==dn?(fn=(0,Q.jsxs)(we,{children:[sn,dn]}),t[197]=sn,t[198]=dn,t[199]=fn):fn=t[199];let pn;t[200]!==He||t[201]!==on||t[202]!==fn?(pn=(0,Q.jsxs)(Oe,{className:`max-w-xl`,children:[He,on,fn]}),t[200]=He,t[201]=on,t[202]=fn,t[203]=pn):pn=t[203];let mn;return t[204]!==Le||t[205]!==pn?(mn=(0,Q.jsx)(ke,{open:!0,onOpenChange:Le,children:pn}),t[204]=Le,t[205]=pn,t[206]=mn):mn=t[206],mn}function Lt(e){return(0,Q.jsx)(fe,{value:String(e),"aria-label":gt[e],children:_t[e]},e)}function Rt(e){return(0,Q.jsx)(j,{value:e.id,children:e.title},e.id)}function zt(e){return(0,Q.jsxs)(j,{value:e.environmentId,children:[(0,Q.jsx)(Fe,{kind:s(e.serverConfig),className:`size-4`}),e.label]},e.environmentId)}function Bt(e){return{...e,projectId:``,modelKey:``,baseModelSelection:null,baseRef:`main`,startFromOrigin:!0,existingWorktreePath:``}}function Vt(e,t){re.add(W({type:`error`,title:e,description:t instanceof Error?t.message:String(t)}))}export{dt as a,lt as i,wt as n,Ct as r,Dt as t};
|
|
4
|
-
//# sourceMappingURL=ScheduledTasksSettings-1UDkELZo.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{a as e,t}from"./react-DH3P2YXY.js";import{n,t as r}from"./jsx-runtime-BnjsACtP.js";import{Dp as i,Np as a,Yp as o,dr as s,rh as c,t as l}from"./utils-BoMYW9A3.js";import{f as u,l as d,m as f}from"./TooltipViewport-ZmVCer7P.js";import{A as p,D as m,G as h,H as g,T as _,U as v,W as y,et as b,g as x,h as S,l as C,p as w,s as T,u as ee,v as E,x as D}from"./themePalette-neUNWCzK.js";import{a as te,n as ne,t as re}from"./tooltip-D-GRl-oZ.js";import{n as O,t as k}from"./toggle-group-Di3SFV73.js";import{t as ie}from"./input-ekYqAkUx.js";import{i as A,o as j,t as M}from"./popover-OfG3wVsl.js";import{i as N,n as P,r as F,t as I}from"./color-picker-CXfnfmuH.js";import{va as L}from"./main-BWh6jqG2.js";var ae=n(),R=e(t(),1),z=e(r(),1);function B(e){return{canvas:`Background`,toolbar:`Toolbar background`,toolbarForeground:`Toolbar text`,toolbarBorder:`Toolbar border`,toolbarControl:`Toolbar control`,toolbarControlForeground:`Toolbar control text`,toolbarControlHover:`Toolbar control hover`,accent:`Accent color`,errorForeground:`Error text`,errorSurface:`Error background`,warningForeground:`Warning text`,warningSurface:`Warning background`,updateForeground:`Update text`,updateSurface:`Update background`}[e]||e.replace(/([A-Z])/g,` $1`).replace(/^./,e=>e.toUpperCase())}function V(e){let t=g(e)??``,n=t.length===9?t.slice(7):``;return n===`ff`?``:n}function oe(e){return(g(e)??`#000000`).slice(0,7)}function se(e){let t=Number.parseInt(oe(e).slice(1),16);return[t>>16,t>>8&255,t&255]}function ce(e){let t=e.trim().replace(/^rgb\(\s*/i,``).replace(/\s*\)$/,``).split(/[,\s]+/).filter(Boolean).map(Number);return t.length!==3||t.some(e=>!Number.isInteger(e)||e<0||e>255)?null:`#${t.map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}function H(e){return se(e).join(`, `)}function U({label:e,value:t,onChange:n}){let r=oe(t),i=V(t),[a,o]=(0,R.useState)(()=>F(r)),[s,c]=(0,R.useState)(r),[l,u]=(0,R.useState)(()=>H(r)),d=(0,R.useRef)(!1),f=N(a.h,a.s,a.v),p=H(f);(0,R.useEffect)(()=>{d.current||(c(r),u(H(r))),o(e=>N(e.h,e.s,e.v)===r?e:F(r))},[r]);let m=(0,R.useRef)(n);m.current=n;let h=(0,R.useRef)(null),g=(0,R.useRef)(null),_=(0,R.useCallback)(()=>{g.current!==null&&(cancelAnimationFrame(g.current),g.current=null);let e=h.current;h.current=null,e!==null&&m.current(e)},[]);(0,R.useEffect)(()=>()=>_(),[_]);let v=(0,R.useCallback)(e=>{h.current=e,g.current??=requestAnimationFrame(()=>{g.current=null;let e=h.current;h.current=null,e!==null&&m.current(e)})},[]),y=(0,R.useCallback)(e=>{o(e);let t=N(e.h,e.s,e.v);c(t),u(H(t)),v(t+i)},[i,v]),b=e=>{if(c(e),!/^#[0-9a-f]{6}$/i.test(e))return;let t=F(e);o(t),u(H(e)),n(e.toLowerCase())},x=e=>{u(e);let t=ce(e);t&&(o(F(t)),c(t),n(t+i))};return(0,z.jsxs)(`div`,{className:`w-72 bg-popover`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/70 px-4 py-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:`truncate text-xs font-semibold text-foreground`,children:e}),(0,z.jsx)(`p`,{className:`text-2xs text-muted-foreground`,children:`Choose a color`})]}),(0,z.jsx)(`span`,{className:`size-7 shrink-0 rounded-full shadow-sm`,style:{backgroundColor:f}})]}),(0,z.jsxs)(`div`,{className:`grid gap-3 px-3 pb-3 pt-3`,children:[(0,z.jsx)(P,{label:e,value:a,onChange:y,onInteractionEnd:_}),(0,z.jsx)(I,{label:`${e} hue`,value:a.h,onChange:e=>y({...a,h:e}),onInteractionEnd:_}),(0,z.jsxs)(`div`,{className:`grid grid-cols-[1fr_1.2fr] gap-2`,children:[(0,z.jsxs)(`label`,{className:`grid min-w-0 gap-1`,children:[(0,z.jsx)(`span`,{className:`px-1 text-3xs font-semibold uppercase tracking-widest text-muted-foreground`,children:`HEX`}),(0,z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 rounded-lg border border-input bg-background px-2 focus-within:border-ring`,children:[(0,z.jsx)(`span`,{className:`size-3.5 shrink-0 rounded-full`,style:{backgroundColor:f}}),(0,z.jsx)(`input`,{"aria-label":`${e} picker hex value`,className:`h-8 min-w-0 flex-1 bg-transparent font-mono text-xs text-foreground outline-none`,onBlur:()=>{d.current=!1,c(f),u(p)},onChange:e=>b(e.currentTarget.value),onFocus:()=>{d.current=!0},spellCheck:!1,value:s})]})]}),(0,z.jsxs)(`label`,{className:`grid min-w-0 gap-1`,children:[(0,z.jsx)(`span`,{className:`px-1 text-3xs font-semibold uppercase tracking-widest text-muted-foreground`,children:`RGB`}),(0,z.jsx)(`span`,{className:`flex min-w-0 items-center rounded-lg border border-input bg-background px-2 focus-within:border-ring`,children:(0,z.jsx)(`input`,{"aria-label":`${e} picker RGB value`,className:`h-8 min-w-0 flex-1 bg-transparent font-mono text-xs text-foreground outline-none`,onBlur:()=>{d.current=!1,c(f),u(p)},onChange:e=>x(e.currentTarget.value),onFocus:()=>{d.current=!0},spellCheck:!1,value:l})})]})]})]})]})}function W(e){let t=(0,ae.c)(13),{label:n,value:r,onChange:i,onInteract:a}=e,o=`Choose ${n} color`,s;t[0]===r?s=t[1]:(s=(0,z.jsx)(`span`,{className:`absolute inset-0 rounded-full shadow-sm`,style:{backgroundColor:r}}),t[0]=r,t[1]=s);let c;t[2]!==a||t[3]!==o||t[4]!==s?(c=(0,z.jsx)(j,{render:(0,z.jsx)(`button`,{"aria-label":o,className:`relative flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-full border border-foreground/30 transition-transform hover:scale-105 focus-visible:outline-2 focus-visible:outline-solid focus-visible:-outline-offset-2 focus-visible:outline-ring`,onFocus:a,onPointerDown:a,type:`button`,children:s})}),t[2]=a,t[3]=o,t[4]=s,t[5]=c):c=t[5];let l;t[6]!==n||t[7]!==i||t[8]!==r?(l=(0,z.jsx)(A,{align:`end`,padding:`none`,"data-theme-editor-panel":``,side:`bottom`,sideOffset:10,children:(0,z.jsx)(U,{label:n,onChange:i,value:r})}),t[6]=n,t[7]=i,t[8]=r,t[9]=l):l=t[9];let u;return t[10]!==c||t[11]!==l?(u=(0,z.jsxs)(M,{children:[c,l]}),t[10]=c,t[11]=l,t[12]=u):u=t[12],u}var le=(0,R.memo)(function(e){let t=(0,ae.c)(58),{role:n,value:r,onChange:i,onSelect:a,onToggleSelected:o,selected:s,label:c}=e,u=s!==void 0&&s,d;t[0]!==c||t[1]!==n?(d=c??B(n),t[0]=c,t[1]=n,t[2]=d):d=t[2];let f=d,p;t[3]===r?p=t[4]:(p=_(r),t[3]=r,t[4]=p);let m=p,h=m?r:`#000000`,v;t[5]===r?v=t[6]:(v=r.trim().toLowerCase().startsWith(`oklch(`)?g(r)??r:r,t[5]=r,t[6]=v);let y=v,b=u&&`bg-accent/60 inset-ring inset-ring-ring`,x;t[7]===b?x=t[8]:(x=l(`flex min-h-11 min-w-0 items-center gap-2 rounded-lg px-2 py-1.5 transition-[background-color,box-shadow]`,b),t[7]=b,t[8]=x);let S=`${u?`Hide`:`Show`} ${f} usage`,C;t[9]!==o||t[10]!==n?(C=()=>o?.(n),t[9]=o,t[10]=n,t[11]=C):C=t[11];let w;t[12]===f?w=t[13]:(w=(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:f}),t[12]=f,t[13]=w);let T;t[14]!==u||t[15]!==S||t[16]!==C||t[17]!==w?(T=(0,z.jsx)(te,{render:(0,z.jsx)(`button`,{"aria-label":S,"aria-pressed":u,className:`flex min-w-0 flex-1 cursor-pointer items-center rounded-md text-left text-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,onClick:C,type:`button`,children:w})}),t[14]=u,t[15]=S,t[16]=C,t[17]=w,t[18]=T):T=t[18];let ee=`${u?`Hide`:`Show`} where ${f} is used`,E;t[19]===ee?E=t[20]:(E=(0,z.jsx)(ne,{side:`top`,children:ee}),t[19]=ee,t[20]=E);let D;t[21]!==T||t[22]!==E?(D=(0,z.jsxs)(re,{children:[T,E]}),t[21]=T,t[22]=E,t[23]=D):D=t[23];let O;t[24]!==i||t[25]!==n?(O=e=>i(n,e),t[24]=i,t[25]=n,t[26]=O):O=t[26];let k;t[27]!==a||t[28]!==n?(k=()=>a?.(n),t[27]=a,t[28]=n,t[29]=k):k=t[29];let A;t[30]!==f||t[31]!==h||t[32]!==O||t[33]!==k?(A=(0,z.jsx)(W,{label:f,onChange:O,onInteract:k,value:h}),t[30]=f,t[31]=h,t[32]=O,t[33]=k,t[34]=A):A=t[34];let j=!m,M=`${f} hex value`,N=`${n}-hex`,P;t[35]!==i||t[36]!==n?(P=e=>i(n,e.currentTarget.value),t[35]=i,t[36]=n,t[37]=P):P=t[37];let F,I;t[38]!==a||t[39]!==n?(F=()=>a?.(n),I=()=>a?.(n),t[38]=a,t[39]=n,t[40]=F,t[41]=I):(F=t[40],I=t[41]);let L;t[42]!==y||t[43]!==j||t[44]!==M||t[45]!==N||t[46]!==P||t[47]!==F||t[48]!==I?(L=(0,z.jsx)(ie,{"aria-invalid":j,"aria-label":M,className:`w-28 shrink-0`,font:`mono`,id:N,nativeInput:!0,onChange:P,onFocus:F,onPointerDown:I,size:`compact`,value:y}),t[42]=y,t[43]=j,t[44]=M,t[45]=N,t[46]=P,t[47]=F,t[48]=I,t[49]=L):L=t[49];let R;t[50]!==A||t[51]!==L?(R=(0,z.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[A,L]}),t[50]=A,t[51]=L,t[52]=R):R=t[52];let V;return t[53]!==n||t[54]!==D||t[55]!==R||t[56]!==x?(V=(0,z.jsxs)(`div`,{className:x,"data-theme-color-role":n,children:[D,R]}),t[53]=n,t[54]=D,t[55]=R,t[56]=x,t[57]=V):V=t[57],V}),ue=[`background`,`border`,`foreground`],G=`data-theme-inspector-match`,de=`data-theme-token-probe`,K=`#01fea7`,fe=`#fe01a7`,q=`theme-inspector-spotlight`,J=`theme-inspector-spotlight-mask`,pe=`theme-inspector-spotlight-glow`,Y=`theme-inspector-hover`,X=`http://www.w3.org/2000/svg`,me={background:`canvas`,foreground:`text`,card:`surface`,"card-foreground":`text`,popover:`surfaceOverlay`,"popover-foreground":`text`,"surface-raised":`surfaceRaised`,primary:`messageAction`,"primary-foreground":`messageActionForeground`,secondary:`secondary`,"secondary-foreground":`secondaryForeground`,muted:`muted`,"muted-foreground":`mutedForeground`,placeholder:`placeholder`,"secondary-label":`secondaryLabel`,"icon-muted":`iconMuted`,accent:`accentSurface`,"accent-foreground":`accentSurfaceForeground`,destructive:`error`,"destructive-foreground":`errorForeground`,error:`error`,"error-foreground":`errorForeground`,"error-surface":`errorSurface`,warning:`warning`,"warning-foreground":`warningForeground`,"warning-surface":`warningSurface`,update:`update`,"update-foreground":`updateForeground`,"update-surface":`updateSurface`,message:`messageSurface`,"message-foreground":`messageForeground`,"message-action":`messageAction`,"message-action-foreground":`messageActionForeground`,"message-action-hover":`messageActionHover`,sidebar:`sidebar`,"sidebar-foreground":`sidebarForeground`,"sidebar-muted-foreground":`sidebarMutedForeground`,"sidebar-control-surface":`sidebarControlSurface`,"sidebar-row-hover":`sidebarRowHover`,"sidebar-row-active":`sidebarRowActive`,"sidebar-row-selected":`sidebarRowSelected`,"sidebar-border":`sidebarBorder`,border:`border`,input:`input`,ring:`focus`},he={background:[`bg-`],border:[`border-`,`outline-`,`ring-`],foreground:[`text-`,`caret-`,`fill-`,`stroke-`]};function ge(e){document.querySelectorAll(`[${e}]`).forEach(t=>t.removeAttribute(e))}function _e(){ge(G),document.getElementById(q)?.remove()}function ve(){document.getElementById(Y)?.remove()}function Z(e){return document.createElementNS(X,e)}function ye(e){let t=e.getBoundingClientRect();if(t.width<=0||t.height<=0||t.right<0||t.bottom<0||t.left>window.innerWidth||t.top>window.innerHeight)return null;let n=t.left-5,r=t.top-5,i=Number.parseFloat(window.getComputedStyle(e).borderTopLeftRadius)||0;return{x:n,y:r,width:t.width+10,height:t.height+10,radius:Math.min(18,Math.max(7,i+5))}}function be(e,t){let n=ye(e.element);if(!n){ve();return}let r=document.getElementById(Y);if(!r){r=document.createElement(`div`),r.id=Y,r.setAttribute(`aria-hidden`,`true`);let e=document.createElement(`span`);e.dataset.themeInspectorHoverLabel=``,r.append(e),document.body.append(r)}r.style.left=`${n.x}px`,r.style.top=`${n.y}px`,r.style.width=`${n.width}px`,r.style.height=`${n.height}px`,r.style.borderRadius=`${n.radius}px`,r.dataset.placement=n.y<32?`below`:`above`;let i=r.querySelector(`[data-theme-inspector-hover-label]`);i&&(i.textContent=t)}function xe(e){let t=new Map;for(let n of e){let e=ye(n);if(!e)continue;let r=[e.x,e.y,e.width,e.height].map(e=>Math.round(e)).join(`:`);t.set(r,e)}if(t.size===0){document.getElementById(q)?.remove();return}let n=document.getElementById(q);n||(n=Z(`svg`),n.id=q,n.setAttribute(`aria-hidden`,`true`),n.setAttribute(`focusable`,`false`),document.body.append(n)),n.setAttribute(`viewBox`,`0 0 ${window.innerWidth} ${window.innerHeight}`);let r=Z(`defs`),i=Z(`mask`);i.id=J,i.setAttribute(`maskUnits`,`userSpaceOnUse`);let a=Z(`rect`);a.setAttribute(`width`,String(window.innerWidth)),a.setAttribute(`height`,String(window.innerHeight)),a.setAttribute(`fill`,`white`),i.append(a);let o=Z(`filter`);o.id=pe,o.setAttribute(`x`,`-50%`),o.setAttribute(`y`,`-50%`),o.setAttribute(`width`,`200%`),o.setAttribute(`height`,`200%`);let s=Z(`feGaussianBlur`);s.setAttribute(`stdDeviation`,`5`),s.setAttribute(`result`,`blur`);let c=Z(`feMerge`),l=Z(`feMergeNode`);l.setAttribute(`in`,`blur`);let u=Z(`feMergeNode`);u.setAttribute(`in`,`SourceGraphic`),c.append(l,u),o.append(s,c),r.append(i,o);let d=Z(`g`);for(let e of t.values()){let t=Z(`rect`);t.setAttribute(`x`,String(e.x)),t.setAttribute(`y`,String(e.y)),t.setAttribute(`width`,String(e.width)),t.setAttribute(`height`,String(e.height)),t.setAttribute(`rx`,String(e.radius)),t.setAttribute(`fill`,`black`),i.append(t);let n=t.cloneNode(!1);n.removeAttribute(`fill`),n.setAttribute(`class`,`theme-inspector-spotlight-glow`),n.setAttribute(`filter`,`url(#${pe})`),d.append(n)}let f=Z(`rect`);f.setAttribute(`class`,`theme-inspector-spotlight-dimmer`),f.setAttribute(`width`,String(window.innerWidth)),f.setAttribute(`height`,String(window.innerHeight)),f.setAttribute(`mask`,`url(#${J})`),n.replaceChildren(r,f,d)}function Se(){xe([...document.querySelectorAll(`[${G}]`)])}function Ce(e){return e.matches(`input, textarea, select, option`)?!0:Array.from(e.childNodes).some(e=>e.nodeType===Node.TEXT_NODE&&!!e.textContent?.trim())}function Q(e,{forHitTest:t=!1}={}){let n=window.getComputedStyle(e);if(n.display===`none`||n.visibility===`hidden`||Number(n.opacity)===0)return null;let r=[];for(let[e,t,i]of[[n.borderTopColor,n.borderTopStyle,n.borderTopWidth],[n.borderRightColor,n.borderRightStyle,n.borderRightWidth],[n.borderBottomColor,n.borderBottomStyle,n.borderBottomWidth],[n.borderLeftColor,n.borderLeftStyle,n.borderLeftWidth]])t!==`none`&&Number.parseFloat(i)>0&&r.push(e);n.outlineStyle!==`none`&&Number.parseFloat(n.outlineWidth)>0&&r.push(n.outlineColor),n.borderImageSource!==`none`&&r.push(n.borderImageSource),n.boxShadow!==`none`&&r.push(n.boxShadow);let i=[];return(t||Ce(e))&&i.push(n.color),e instanceof SVGElement&&i.push(n.fill,n.stroke),e.matches(`input, textarea`)&&i.push(n.caretColor),n.textDecorationLine!==`none`&&i.push(n.textDecorationColor),n.textShadow!==`none`&&i.push(n.textShadow),{background:[n.backgroundColor,n.backgroundImage].join(`
|
|
2
|
-
`),border:r.join(`
|
|
3
|
-
`),foreground:i.join(`
|
|
4
|
-
`)}}function we(e,t){return ue.filter(n=>e[n]!==t[n])}function Te(e){let t=document.documentElement,n=t.hasAttribute(de);n||t.setAttribute(de,``);try{return e()}finally{window.getComputedStyle(t).color,n||t.removeAttribute(de)}}function Ee(e){let t=document.documentElement,n=S(e),r=t.style.getPropertyValue(n),i=t.style.getPropertyPriority(n),a=r.trim().toLowerCase()===K?fe:K;return t.style.setProperty(n,a,`important`),()=>{r?t.style.setProperty(n,r,i):t.style.removeProperty(n)}}function $(e){let t=e.map(Ee);return()=>{for(let e of t.toReversed())e()}}function De(){return[document.body,...document.body.querySelectorAll(`*`)].filter(e=>!e.closest(`[data-theme-editor-panel]`)&&!e.closest(`#${q}, #${Y}`))}function Oe(e,t){if(e.includes(`:`))return null;for(let n of he[t])if(e.startsWith(n))return me[e.slice(n.length).split(`/`,1)[0]??``]??null;return null}function ke(e){for(let t of ue)for(let n of e.classList){let e=Oe(n,t);if(e)return e}return null}function Ae(e){let t=[],n=e;for(;n&&n!==document.documentElement;)n.closest(`[data-theme-editor-panel]`)||t.push(n),n=n.parentElement;return t}function je(e){if(e.closest(`[data-theme-editor-panel]`))return null;for(let t of Ae(e)){let e=ke(t);if(e)return{element:t,role:e}}return null}function Me(e){performance.now(),ge(G);let t=De(),n=performance.now(),r=Te(()=>{let n=new Map;for(let e of t){let t=Q(e);t&&n.set(e,t)}let r=$(e),i=new Set;try{for(let[e,t]of n){let n=Q(e);n&&we(t,n).length>0&&i.add(e)}}finally{r()}return i});performance.now()-n;let i=new Set;for(let e of r)i.add(e instanceof SVGElement?e.closest(`svg`)??e:e);for(let e of i)e.setAttribute(G,``);return xe([...i]),i.size}function Ne(e){if(e.closest(`[data-theme-editor-panel]`))return null;let t=Ae(e),n=je(e);if(n)return n;let r=Te(()=>{let e=new Map,n=new Map;for(let n of t){let t=Q(n,{forHitTest:!0});t&&e.set(n,t)}for(let t of b){let r=Ee(t);try{for(let[r,i]of e){let e=Q(r,{forHitTest:!0});if(!e)continue;let a=n.get(r)??{};for(let n of we(i,e))a[n]??=t;n.set(r,a)}}finally{r()}}return n});for(let e of t){let t=r.get(e);if(t)for(let n of ue){let r=t[n];if(r)return{element:e,role:r}}}return null}var Pe=[`canvas`,`accent`],Fe=[{id:`foundation`,title:`Foundation`,families:[{id:`background`,label:`Background`,role:`canvas`,roles:[`canvas`,`chrome`,`toolbar`]},{id:`surface`,label:`Surface`,role:`surface`,roles:[`surface`]},{id:`raised-surface`,label:`Raised surface`,role:`surfaceRaised`,roles:[`surfaceRaised`]},{id:`overlay`,label:`Overlay`,role:`surfaceOverlay`,roles:[`surfaceOverlay`]},{id:`text`,label:`Text`,role:`text`,roles:[`text`,`toolbarForeground`,`toolbarControlForeground`]},{id:`muted-text`,label:`Muted text`,role:`mutedForeground`,roles:[`textMuted`,`mutedForeground`,`placeholder`,`secondaryLabel`,`iconMuted`,`sidebarMutedForeground`]},{id:`border`,label:`Border`,role:`border`,roles:[`border`,`toolbarBorder`,`sidebarBorder`]},{id:`input`,label:`Input`,role:`input`,roles:[`input`]}]},{id:`brand-content`,title:`Brand & content`,families:[{id:`subtle-surface`,label:`Subtle surface`,role:`secondary`,roles:[`secondary`,`secondaryForeground`,`muted`,`toolbarControl`]},{id:`highlight-surface`,label:`Highlight surface`,role:`accentSurface`,roles:[`accentSurface`,`accentSurfaceForeground`,`toolbarControlHover`]},{id:`accent`,label:`Accent`,role:`accent`,roles:[`accent`,`accentForeground`,`focus`,`update`,`updateForeground`,`updateSurface`,`terminalCursor`]},{id:`action`,label:`Action`,role:`messageAction`,roles:[`messageAction`,`messageActionForeground`,`messageActionHover`]},{id:`message-surface`,label:`Message surface`,role:`messageSurface`,roles:[`messageSurface`,`messageForeground`]},{id:`code-surface`,label:`Code surface`,role:`codeBackground`,roles:[`codeBackground`,`codeForeground`]}]},{id:`search`,title:`Search`,families:[{id:`search-matches`,label:`Search matches`,role:`searchMatchBackground`,roles:[`searchMatchBackground`,`searchMatchForeground`]},{id:`current-match`,label:`Current match`,role:`searchMatchActiveBackground`,roles:[`searchMatchActiveBackground`,`searchMatchActiveForeground`]}]},{id:`context`,title:`Context`,families:[{id:`sidebar-background`,label:`Sidebar background`,role:`sidebar`,roles:[`sidebar`,`sidebarForeground`]},{id:`sidebar-controls`,label:`Sidebar controls`,role:`sidebarControlSurface`,roles:[`sidebarControlSurface`]},{id:`sidebar-selection`,label:`Sidebar selection`,role:`sidebarRowSelected`,roles:[`sidebarRowHover`,`sidebarRowActive`,`sidebarRowSelected`]},{id:`terminal-background`,label:`Terminal background`,role:`terminalBackground`,roles:[`terminalBackground`,`terminalForeground`,`terminalSelection`,`terminalScrollbar`,`terminalScrollbarHover`]}]},{id:`status`,title:`Status`,families:[{id:`error`,label:`Error`,role:`error`,roles:[`error`,`errorForeground`,`errorSurface`]},{id:`warning`,label:`Warning`,role:`warning`,roles:[`warning`,`warningForeground`,`warningSurface`]}]}],Ie=Fe.flatMap(e=>e.families),Le=new Map(Ie.flatMap(e=>e.roles.map(t=>[t,e])));function Re(e){return Le.get(e)??null}function ze(e){return{...w(e)}}function Be(){return{light:ze(`light`),dark:ze(`dark`)}}function Ve(e){return _(e.trim())}function He(e,t){let n=w(e);return C(e,Ve(t.canvas)?t.canvas:n.canvas,Ve(t.accent)?t.accent:n.accent)}function Ue({open:e,onOpenChange:t,onSaved:n,editingTheme:r,initialAppearance:g,seedTheme:_,seedName:S,restoreTheme:C}){let w=r!==null,[A,j]=(0,R.useState)(``),[M,N]=(0,R.useState)(g),[P,F]=(0,R.useState)(!1),[I,ae]=(0,R.useState)(()=>Be()),[V,oe]=(0,R.useState)({light:!1,dark:!1}),[se,ce]=(0,R.useState)(!1),[H,U]=(0,R.useState)(null),[W,ue]=(0,R.useState)(!1),[G,de]=(0,R.useState)(``),[K,fe]=(0,R.useState)(!1),[q,J]=(0,R.useState)(null),[pe,Y]=(0,R.useState)(null),[X,me]=(0,R.useState)(null),[he,ge]=(0,R.useState)(null),Z=(0,R.useRef)(null),ye=(0,R.useRef)(null),xe=(0,R.useRef)(null);(0,R.useEffect)(()=>{if(!e)return;let t=()=>{let e,t;ge(n=>n&&(e=Math.max(280,Math.min(n.width,window.innerWidth-16)),t=Math.max(220,Math.min(n.height,window.innerHeight-16)),{width:e,height:t})),me(n=>{if(!n)return n;let r=et(n.x,n.y,e),i=W?Z.current?.offsetHeight??0:t??Z.current?.offsetHeight??0,a=Math.max(8,window.innerHeight-i-8);return{x:r.x,y:Math.min(r.y,a)}})};return window.addEventListener(`resize`,t),()=>window.removeEventListener(`resize`,t)},[W,e]);let[Ce,Q]=(0,R.useState)(!1),we=(0,R.useRef)(!1);(0,R.useEffect)(()=>{if(e&&!we.current){let e=r??_??null,t=Be(),n=e?x(e,g)?g:e.appearance:g;if(e){t[e.appearance]={...e.colors};for(let n of[`light`,`dark`]){let r=e.variants?.[n];r&&(t[n]={...r})}}j(r?.label??S??``),N(n),F(e!==null&&e.managed!==!0),oe({light:!1,dark:!1}),ce(e!==null&&e.managed!==!0),ae(t),J(null),Y(null),fe(!1),U(null),Q(!0)}!e&&Ce&&Q(!1),we.current=e},[r,g,Ce,e,S,_]);let Te=v(A),Ee=A.trim().toLowerCase(),$=Ee===``?null:ee().find(e=>e.id!==r?.id&&(e.id===Te||e.label.trim().toLowerCase()===Ee))??null,De=$?E($):[],Oe=r?E(r):null,ke=e=>Oe&&!Oe.includes(e)?`“${r?.label}” has no ${e} palette. Create a theme with the same name to add one.`:!w&&De.includes(e)?`“${$?.label}” already has a ${e} palette.`:null,Ae=$?.id??null,Ie=De.join(`,`);(0,R.useEffect)(()=>{if(w||Ae===null)return;let e=Ie.split(`,`).filter(Boolean);e.length===1&&N(t=>e.includes(t)?e[0]===`light`?`dark`:`light`:t)},[w,Ae,Ie]),(0,R.useEffect)(()=>{e&&Ce&&T(I[M],M)},[M,I,Ce,e]),(0,R.useEffect)(()=>{if(e)return()=>{C()}},[e,C]);let Le=(0,R.useCallback)((e,t)=>{ae(n=>{let r={...n[M],[e]:t},i=!P&&Pe.includes(e)&&Ve(t);return{...n,[M]:P?h(M,n[M],e,t):i?He(M,r):r}}),!P&&Pe.includes(e)&&Ve(t)&&oe(e=>({...e,[M]:!0})),P&&ce(!0)},[M,P]),ze=(0,R.useCallback)((e,t=!1)=>{let n=Re(e)?.role??e;J(n),Pe.includes(n)||(F(!0),de(``)),t&&requestAnimationFrame(()=>{Z.current?.querySelector(`[data-theme-color-role="${n}"]`)?.scrollIntoView({behavior:`smooth`,block:`nearest`})})},[]),Ue=(0,R.useCallback)(e=>{J(t=>t===e?null:e)},[]),We=(0,R.useCallback)(()=>{J(null),Y(null),fe(!1)},[]),Ge=(q?P?Re(q)?.roles??[q]:Pe.includes(q)?b.filter(e=>I[M][e].trim().toLowerCase()===I[M][q].trim().toLowerCase()):[q]:[]).join(`,`);(0,R.useEffect)(()=>{if(_e(),!e||q===null){Y(null);return}if(K)return;let t=Ge.split(`,`),n=()=>Y(Me(t));n();let r=null,i=null,a=performance.now(),o=()=>{if(r!==null||i!==null)return;let e=Math.max(0,500-(performance.now()-a)),t=()=>{r=null,i=null,a=performance.now(),n()};e===0?r=requestAnimationFrame(t):i=setTimeout(t,e)},s=new MutationObserver(e=>{e.every(e=>e.target instanceof Element&&(e.target.closest(`#theme-inspector-spotlight`)||e.target.closest(`[data-theme-editor-panel]`)))||o()});s.observe(document.body,{childList:!0,subtree:!0});let c=null,l=()=>{c??=requestAnimationFrame(()=>{c=null,Se()})};return window.addEventListener(`resize`,l),window.addEventListener(`scroll`,l,!0),()=>{s.disconnect(),r!==null&&cancelAnimationFrame(r),i!==null&&clearTimeout(i),c!==null&&cancelAnimationFrame(c),window.removeEventListener(`resize`,l),window.removeEventListener(`scroll`,l,!0),_e()}},[K,e,Ge,q]),(0,R.useEffect)(()=>{if(!e||!K){ve();return}let t=!1,n=null,r=null,i=null,a=null,o=()=>{i!==null&&(window.clearTimeout(i),i=null)},s=()=>{o(),n=null,r=null,ve()},c=e=>{r=e,be(e,Re(e.role)?.label??B(e.role))},l=e=>{let t=e.target;if(!(t instanceof Element)||t.closest(`[data-theme-editor-panel]`)){s();return}o(),n=t,r=null;let a=je(t);if(a){c(a);return}ve(),i=window.setTimeout(()=>{if(i=null,n!==t||!t.isConnected)return;let e=Ne(t);e&&c(e)},140)},u=e=>{e.relatedTarget===null&&s()},d=e=>{let i=e.target;if(!(i instanceof Element)||i.closest(`[data-theme-editor-panel]`))return;e.preventDefault(),e.stopPropagation(),o();let a=n===i&&r?r:Ne(i);a&&(s(),ze(a.role,!0),t=!0)},f=e=>{let n=e.target;n instanceof Element&&!n.closest(`[data-theme-editor-panel]`)&&(e.preventDefault(),e.stopPropagation(),t&&fe(!1),t=!1)},p=e=>{e.key===`Escape`&&(e.preventDefault(),s(),We())},m=()=>{r&&(a??=requestAnimationFrame(()=>{a=null,r&&be(r,Re(r.role)?.label??B(r.role))}))},h=()=>s();return document.addEventListener(`pointerover`,l,!0),document.addEventListener(`pointerout`,u,!0),document.addEventListener(`pointerdown`,d,!0),document.addEventListener(`click`,f,!0),document.addEventListener(`keydown`,p,!0),window.addEventListener(`resize`,m),window.addEventListener(`scroll`,h,!0),()=>{document.removeEventListener(`pointerover`,l,!0),document.removeEventListener(`pointerout`,u,!0),document.removeEventListener(`pointerdown`,d,!0),document.removeEventListener(`click`,f,!0),document.removeEventListener(`keydown`,p,!0),window.removeEventListener(`resize`,m),window.removeEventListener(`scroll`,h,!0),o(),a!==null&&cancelAnimationFrame(a),ve()}},[We,K,e,ze]);let Ke=(0,R.useCallback)(e=>{if(F(e),e||(q&&!Pe.includes(q)&&J(null),!se))return;let t=r&&E(r).length>1?[`light`,`dark`]:[M];oe(e=>{let n={...e};for(let e of t)n[e]=!0;return n}),ae(e=>{let n={...e};for(let r of t)n[r]=He(r,e[r]);return n}),ce(!1)},[M,r,q,se]),qe=()=>{if(!A.trim()){U(`Name your theme first.`);return}try{let e=P?I:{light:V.light?He(`light`,I.light):I.light,dark:V.dark?He(`dark`,I.dark):I.dark},i,a=null,o=null;if(r&&$){let t=E(r),n=t.find(e=>De.includes(e));if(n){U(`“${$.label}” already has a ${n} palette. Pick another name.`);return}a=t[0]??null,i=y({...m({version:1,id:$.id,name:$.label,appearance:$.appearance,colors:$.colors,variants:{...$.variants,...Object.fromEntries(t.map(t=>[t,e[t]]))},...$.managed===!0&&!P?{managed:!0}:{}}),...$.collection?{collection:$.collection}:{}}),o=r;try{p(r.id)}catch(e){try{y($)}catch{}throw e}}else if(r){let t=r.appearance,n=t===`light`?`dark`:`light`;i=y({...m({version:1,id:r.id,name:A,appearance:t,colors:e[t],...E(r).length>1?{variants:{[n]:e[n]}}:{},...P?{}:{managed:!0}}),...r.collection?{collection:r.collection}:{}})}else if($){if(De.includes(M)){U(`“${$.label}” already has light and dark palettes. Pick another name.`);return}a=M,i=y({...m({version:1,id:$.id,name:$.label,appearance:$.appearance,colors:$.colors,variants:{...$.variants,[M]:e[M]},...$.managed===!0&&!P?{managed:!0}:{}}),...$.collection?{collection:$.collection}:{}})}else i=D(m({version:1,name:A,appearance:M,colors:e[M],...P?{}:{managed:!0}}));if(!n(i,{created:r===null&&a===null,...a?{mergedAppearance:a}:{}})){if(!r&&a===null)try{p(i.id)}catch{}else if($&&a!==null)try{y($),o&&D(o)}catch{}U(`Theme saved, but it could not be made active. Try again.`);return}t(!1)}catch(e){U(e instanceof Error?e.message:w?`Could not save the theme.`:`Could not create the theme.`)}},Je=()=>(0,z.jsxs)(`label`,{className:`grid grid-cols-[minmax(0,1fr)_minmax(0,2fr)] items-center gap-3`,children:[(0,z.jsx)(`span`,{className:`text-sm font-medium`,children:`Theme name`}),(0,z.jsx)(ie,{autoFocus:!0,size:`sm`,onChange:e=>{j(e.currentTarget.value),U(null)},placeholder:w?`Theme name`:`e.g. Aurora`,value:A})]}),Ye=e=>{let t=ke(e),n=(0,z.jsx)(k,{"aria-disabled":t!==null,value:e,children:e===`light`?`Light`:`Dark`});return t===null?n:(0,z.jsxs)(re,{children:[(0,z.jsx)(te,{render:n}),(0,z.jsx)(ne,{children:t})]})},Xe=()=>(0,z.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_minmax(0,2fr)] items-center gap-3`,children:[(0,z.jsx)(`span`,{className:`text-sm font-medium`,children:`Appearance`}),(0,z.jsxs)(O,{"aria-label":`Theme appearance`,variant:`segmented`,value:[M],onValueChange:e=>{let t=e[0];(t===`light`||t===`dark`)&&ke(t)===null&&N(t)},children:[Ye(`light`),Ye(`dark`)]})]}),Ze=()=>(0,z.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_minmax(0,2fr)] items-start gap-3`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h3`,{className:`text-sm font-medium`,children:`Colors`}),P?null:(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Two colors, rest derived`})]}),(0,z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[P?(0,z.jsx)(ie,{"aria-label":`Filter colors`,className:`min-w-0 flex-1`,onChange:e=>de(e.currentTarget.value),placeholder:`Filter colors`,size:`sm`,value:G}):null,(0,z.jsxs)(`label`,{className:`ml-auto flex shrink-0 cursor-pointer items-center gap-2 pt-0.5 text-sm font-medium`,children:[(0,z.jsx)(`span`,{children:`Advanced`}),(0,z.jsx)(L,{"aria-label":`Use advanced theme colors`,checked:P,onCheckedChange:e=>Ke(!!e)})]})]})]}),Qe=(e,t=`grid gap-2 sm:grid-cols-2`)=>(0,z.jsx)(`div`,{className:t,children:e.map(e=>(0,z.jsx)(le,{label:e.label,onChange:Le,onSelect:ze,onToggleSelected:Ue,role:e.role,selected:q===e.role,value:I[M][e.role]},e.id))}),$e=()=>{let e=G.trim().toLowerCase(),t=Fe.map(t=>({...t,families:t.families.filter(t=>!e||[t.label,...t.roles.map(e=>B(e))].join(` `).toLowerCase().includes(e))})).filter(e=>e.families.length>0);return P?(0,z.jsxs)(`div`,{className:`space-y-5`,children:[t.map(e=>(0,z.jsxs)(`section`,{className:`space-y-2`,children:[(0,z.jsx)(`h4`,{className:`text-sm font-medium text-foreground`,children:e.title}),Qe(e.families,`grid gap-1`)]},e.id)),t.length===0?(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No matches.`}):null]}):(0,z.jsx)(`div`,{className:`grid gap-1`,children:Pe.map(e=>(0,z.jsx)(le,{onChange:Le,onSelect:ze,onToggleSelected:Ue,role:e,label:e===`canvas`?`Background`:`Accent`,selected:q===e,value:I[M][e]},e))})},et=(e,t,n)=>{let r=Z.current,i=n??r?.offsetWidth??0;return{x:Math.min(Math.max(e,8),Math.max(8,window.innerWidth-i-8)),y:Math.min(Math.max(t,8),Math.max(8,window.innerHeight-48))}},tt=e=>{if(e.target.closest(`button, input, a`))return;let t=Z.current?.getBoundingClientRect();t&&(ye.current={dx:e.clientX-t.x,dy:e.clientY-t.y},e.currentTarget.setPointerCapture(e.pointerId))},nt=e=>{let t=ye.current;t&&me(et(e.clientX-t.dx,e.clientY-t.dy))},rt=()=>{ye.current=null},it=e=>{let t=Z.current?.getBoundingClientRect();t&&(e.preventDefault(),X===null&&me(et(t.x,t.y)),xe.current={pointerX:e.clientX,pointerY:e.clientY,left:t.x,top:t.y,width:t.width,height:t.height},e.currentTarget.setPointerCapture(e.pointerId))},at=e=>{let t=xe.current;if(!t)return;let n=Math.max(280,window.innerWidth-8-t.left),r=Math.max(220,window.innerHeight-8-t.top);ge({width:Math.min(Math.max(t.width+e.clientX-t.pointerX,280),n),height:Math.min(Math.max(t.height+e.clientY-t.pointerY,220),r)})},ot=()=>{xe.current=null};return(0,z.jsxs)(`div`,{"aria-label":w?`Edit theme`:`Create theme`,className:l(`dialog-glass fixed z-[110] flex max-h-[min(42rem,calc(100dvh-6rem))] w-[min(26rem,calc(100vw-2rem))] flex-col overflow-hidden rounded-xl border text-popover-foreground`,X===null&&`bottom-4 right-4`,W&&`max-h-none`),"data-theme-editor-panel":!0,ref:Z,role:`dialog`,style:{...X?{left:X.x,top:X.y}:{},...he?{width:he.width}:{},...he&&!W?{height:he.height,maxHeight:`calc(100dvh - 1rem)`}:{}},children:[(0,z.jsxs)(`div`,{className:`flex cursor-grab touch-none select-none items-center gap-1 border-b border-border/70 px-3 py-2 active:cursor-grabbing`,onPointerCancel:rt,onPointerDown:tt,onPointerMove:nt,onPointerUp:rt,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[(0,z.jsx)(`h2`,{className:`shrink-0 truncate text-sm font-medium`,children:w?`Edit theme`:`Create theme`}),W?null:(0,z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:K?`Select an element · Esc to cancel`:q?`${P?Re(q)?.label??B(q):B(q)} · ${pe??0} ${pe===1?`use`:`uses`}`:`Select a color below`})]}),(0,z.jsxs)(re,{children:[(0,z.jsx)(te,{render:(0,z.jsxs)(s,{"aria-label":K?`Cancel inspecting app colors`:`Inspect app colors`,"aria-pressed":K,size:`xs`,variant:K?`secondary`:`ghost`,onClick:()=>{if(K){We();return}fe(!0)},children:[(0,z.jsx)(i,{}),K?`Cancel`:`Inspect`]})}),(0,z.jsx)(ne,{"data-theme-editor-panel":``,children:K?`Cancel and clear the selection`:`Pick a color from the app`})]}),(0,z.jsx)(s,{"aria-label":W?`Expand the theme editor`:`Minimize the theme editor`,size:`icon-xs`,variant:`ghost`,onClick:()=>ue(!W),children:(0,z.jsx)(d,{icon:W?f:u})}),(0,z.jsx)(s,{"aria-label":`Close the theme editor`,size:`icon-xs`,variant:`ghost`,onClick:()=>t(!1),children:(0,z.jsx)(c,{})})]}),W?null:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto py-3 pl-3 pr-1.5`,children:[Je(),H?(0,z.jsx)(`p`,{"aria-live":`polite`,className:`text-sm text-destructive`,children:H}):null,Xe(),(0,z.jsxs)(`div`,{className:`space-y-3`,children:[Ze(),$e()]})]}),(0,z.jsxs)(`div`,{className:`flex items-center justify-end gap-2 border-t border-border/70 px-3 py-2`,children:[(0,z.jsx)(s,{size:`sm`,variant:`ghost`,onClick:()=>t(!1),children:`Cancel`}),(0,z.jsx)(s,{disabled:!A.trim(),size:`sm`,onClick:qe,children:w?$?`Merge into “${$.label}”`:`Save changes`:$?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(o,{}),`Add ${M} palette`]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(a,{}),`Create theme`]})})]}),(0,z.jsx)(`div`,{"aria-hidden":!0,className:`absolute bottom-0 right-0 z-10 flex size-5 cursor-se-resize touch-none select-none items-end justify-end p-1 text-muted-foreground/70`,onPointerCancel:ot,onPointerDown:it,onPointerMove:at,onPointerUp:ot,children:(0,z.jsx)(`svg`,{className:`size-2.5`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.2`,viewBox:`0 0 8 8`,children:(0,z.jsx)(`path`,{d:`M7 1 1 7M7 4.5 4.5 7`})})})]})]})}export{Ue as ThemeEditorPanel};
|
|
5
|
-
//# sourceMappingURL=ThemeEditorPanel-otrA-nTg.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./react-DH3P2YXY.js";import{n as r,t as i}from"./jsx-runtime-BnjsACtP.js";import{$E as a,BE as o,Br as s,Ca as c,Ci as l,Co as u,Da as d,Di as f,Dr as p,FE as m,Fr as h,GE as g,Ga as _,HE as v,Ha as y,IE as b,Ir as x,JE as S,KE as C,Ka as w,Ki as T,LE as E,Lr as D,ME as O,Mo as k,NE as A,Ni as j,Oi as M,Oo as N,PE as P,Pr as F,QE as I,RE as L,Sa as R,Si as ee,To as z,UE as te,Ua as ne,VE as re,Va as B,Vi as ie,WE as ae,Wa as oe,XE as se,YE as ce,ZE as le,Za as ue,_i as de,ba as fe,bi as pe,ca as me,ci as he,da as ge,eD as _e,eo as ve,fi as ye,ga as be,gi as xe,ha as Se,hi as Ce,ho as we,ii as Te,jE as Ee,ja as De,ji as V,jr as Oe,ka as H,ko as U,lh as ke,li as Ae,ma as je,mi as Me,mo as Ne,oh as W,pi as Pe,qE as Fe,ra as Ie,sa as Le,sh as Re,si as ze,tD as Be,ua as Ve,ui as He,uo as Ue,vi as We,vo as Ge,wa as Ke,wi as qe,wo as Je,xo as Ye,ya as Xe,yi as Ze,yo as Qe,zE as $e}from"./utils-BoMYW9A3.js";var G=e(n()),K=e(i()),et=G.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Xe,currentIdRef:{current:null},currentContextRef:{current:null}});function tt(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=G.useRef(n),a=G.useRef(n),o=G.useRef(null),s=G.useRef(null),c=fe();return(0,K.jsx)(et.Provider,{value:G.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function nt(e,t={open:!1}){let{open:n}=t,r=`rootStore`in e?e.rootStore:e,i=r.useState(`floatingId`),{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:l,hasProvider:u,timeout:d}=G.useContext(et),[f,p]=G.useState(!1);return B(()=>{function e(){p(!1),l.current?.setIsInstantPhase(!1),a.current=null,l.current=null,o.current=c.current}if(a.current&&!n&&a.current===i){if(p(!1),s){let t=i;return d.start(s,()=>{r.select(`open`)||a.current&&a.current!==t||e()}),()=>{d.clear()}}e()}},[n,i,a,o,s,c,l,d,r]),B(()=>{if(!n)return;let e=l.current,t=a.current;d.clear(),l.current={onOpenChange:r.setOpen,setIsInstantPhase:p},a.current=i,o.current={open:0,close:ge(c.current,`close`)},t!==null&&t!==i?(p(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,H(Ue))):(p(!1),e?.setIsInstantPhase(!1))},[n,i,r,a,o,c,l,d]),B(()=>()=>{l.current=null},[l]),G.useMemo(()=>({hasProvider:u,delayRef:o,isInstantPhase:f}),[u,o,f])}function rt(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function it(e){return e!=null&&e.clientX!=null}function at(e,t={}){let{enabled:n=!0,axis:r=`both`}=t,i=`rootStore`in e?e.rootStore:e,a=i.useState(`open`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.context.dataRef,l=G.useRef(!1),u=G.useRef(null),[d,f]=G.useState(),[p,m]=G.useState([]),h=y(e=>{i.set(`positionReference`,e)}),g=y((e,t,n)=>{l.current||(!c.current.openEvent||it(c.current.openEvent))&&i.set(`positionReference`,rt(n??s,{x:e,y:t,axis:r,dataRef:c,pointerType:d}))}),_=y(e=>{a?u.current||(g(e.clientX,e.clientY,e.currentTarget),m([])):g(e.clientX,e.clientY,e.currentTarget)}),v=be(d)?o:a;G.useEffect(()=>{if(!n){h(s);return}if(!v)return;function e(){u.current?.(),u.current=null}let t=oe(o);function r(t){let n=Se(t);je(o,n)?e():g(t.clientX,t.clientY)}return!c.current.openEvent||it(c.current.openEvent)?u.current=Ve(t,`mousemove`,r):h(s),e},[v,n,o,c,s,i,g,h,p]),G.useEffect(()=>()=>{i.set(`positionReference`,null)},[i]),G.useEffect(()=>{n&&!o&&(l.current=!1)},[n,o]),G.useEffect(()=>{!n&&a&&(l.current=!0)},[n,a]);let b=G.useMemo(()=>{function e(e){f(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:_,onMouseEnter:_}},[_]);return G.useMemo(()=>n?{reference:b,trigger:b}:{},[n,b])}var ot=r(),st=e(Ke());function ct(e){let[t,n]=G.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}function lt(e){let t=ne(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=w(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r;return(Ie(n)!==a||Ie(r)!==o)&&(n=a,r=o),{width:n,height:r}}var ut=()=>!0;function dt(e){let{popupElement:t,positionerElement:n,content:r,mounted:i,enabled:a=ut,onMeasureLayout:o,onMeasureLayoutComplete:s,side:l,direction:u}=e,f=c(t,!0,!1),p=d(),m=G.useRef(null),h=G.useRef(null),g=G.useRef(!0),_=G.useRef(U),v=y(o),b=y(s),x=G.useMemo(()=>{let e=l===`top`,t=l===`left`;return u===`rtl`?(e||=l===`inline-end`,t||=l===`inline-end`):(e||=l===`inline-start`,t||=l===`inline-start`),e?{position:`absolute`,[l===`top`?`bottom`:`top`]:`0`,[t?`right`:`left`]:`0`}:N},[l,u]);B(()=>{if(!i||!a()||typeof ResizeObserver!=`function`){_.current=U,g.current=!0,m.current=null,h.current=null;return}if(!t||!n)return;_.current=pt(t,x);let e=new ResizeObserver(e=>{let t=e[0];t&&(h.current={width:Math.ceil(t.borderBoxSize[0].inlineSize),height:Math.ceil(t.borderBoxSize[0].blockSize)})});e.observe(t),mt(t,`auto`);let r=ft(t,`position`,`static`),o=ft(t,`transform`,`none`),s=ft(t,`scale`,`1`),c=pt(n,{"--available-width":`max-content`,"--available-height":`max-content`});function l(){r(),o(),c()}function u(){l(),s()}if(v?.(),g.current||m.current===null){ht(n,`max-content`);let r=lt(t);return m.current=r,ht(n,r),u(),b?.(null,r),g.current=!1,()=>{e.disconnect(),_.current(),_.current=U}}mt(t,`auto`),ht(n,`max-content`);let d=m.current??h.current,y=lt(t);if(m.current=y,!d)return ht(n,y),u(),b?.(null,y),()=>{e.disconnect(),p.cancel(),_.current(),_.current=U};mt(t,d),u(),b?.(d,y),ht(n,y);let S=new AbortController;return p.request(()=>{mt(t,y),f(()=>{t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`)},S.signal)}),()=>{e.disconnect(),S.abort(),p.cancel(),_.current(),_.current=U}},[r,t,n,f,p,a,i,v,b,x])}function ft(e,t,n){let r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}function pt(e,t){let n=[];for(let[r,i]of Object.entries(t))n.push(ft(e,r,i));return n.length?()=>{n.forEach(e=>e())}:U}function mt(e,t){let n=t===`auto`?`auto`:`${t.width}px`,r=t===`auto`?`auto`:`${t.height}px`;e.style.setProperty(`--popup-width`,n),e.style.setProperty(`--popup-height`,r)}function ht(e,t){let n=t===`max-content`?`max-content`:`${t.width}px`,r=t===`max-content`?`max-content`:`${t.height}px`;e.style.setProperty(`--positioner-width`,n),e.style.setProperty(`--positioner-height`,r)}function gt(e){let{store:t,side:n,cssVars:r,children:i}=e,a=x(),o=t.useState(`activeTriggerElement`),s=t.useState(`activeTriggerId`),l=t.useState(`open`),u=t.useState(`payload`),f=t.useState(`mounted`),p=t.useState(`popupElement`),m=t.useState(`positionerElement`),h=ct(l?o:null),g=bt(s,u),_=G.useRef(null),[v,b]=G.useState(null),[S,C]=G.useState(null),w=G.useRef(null),T=G.useRef(null),E=c(w,!0,!1),O=d(),[k,A]=G.useState(null),[j,M]=G.useState(!1);B(()=>(t.set(`hasViewport`,!0),()=>{t.set(`hasViewport`,!1)}),[t]);let N=y(()=>{w.current?.style.setProperty(`animation`,`none`),w.current?.style.setProperty(`transition`,`none`),T.current?.style.setProperty(`display`,`none`)}),P=y(e=>{w.current?.style.removeProperty(`animation`),w.current?.style.removeProperty(`transition`),T.current?.style.removeProperty(`display`),e&&A(e)}),F=G.useRef(null);B(()=>{if(o&&h&&o!==h&&F.current!==o&&_.current){b(_.current),M(!0);let e=yt(h,o);C(e),O.request(()=>{st.flushSync(()=>{M(!1)}),E(()=>{b(null),A(null),_.current=null})}),F.current=o}},[o,h,v,E,O]),B(()=>{let e=w.current;if(!e)return;let t=Le(e).createElement(`div`);for(let n of Array.from(e.childNodes))t.appendChild(n.cloneNode(!0));_.current=t});let I=v!=null,L;L=I?(0,K.jsxs)(G.Fragment,{children:[(0,K.jsx)(`div`,{"data-previous":!0,inert:D(!0),ref:T,style:{...k?{[r.popupWidth]:`${k.width}px`,[r.popupHeight]:`${k.height}px`}:null,position:`absolute`},"data-ending-style":j?void 0:``},`previous`),(0,K.jsx)(`div`,{"data-current":!0,ref:w,"data-starting-style":j?``:void 0,children:i},g)]}):(0,K.jsx)(`div`,{"data-current":!0,ref:w,children:i},g),B(()=>{let e=T.current;e&&v&&e.replaceChildren(...Array.from(v.childNodes))},[v]),dt({popupElement:p,positionerElement:m,mounted:f,content:u,onMeasureLayout:N,onMeasureLayoutComplete:P,side:n,direction:a});let R={activationDirection:_t(S),transitioning:I};return{children:L,state:R}}function _t(e){if(e)return`${vt(e.horizontal,5,`right`,`left`)} ${vt(e.vertical,5,`down`,`up`)}`}function vt(e,t,n,r){return e>t?n:e<-t?r:``}function yt(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i={x:n.left+n.width/2,y:n.top+n.height/2},a={x:r.left+r.width/2,y:r.top+r.height/2};return{horizontal:a.x-i.x,vertical:a.y-i.y}}function bt(e,t){let[n,r]=G.useState(0),i=G.useRef(e),a=G.useRef(t),o=G.useRef(!1);return B(()=>{let n=i.current,s=a.current,c=e!==n,l=t!==s;c?(r(e=>e+1),o.current=!l):o.current&&l&&(r(e=>e+1),o.current=!1),i.current=e,a.current=t},[e,t]),`${e??`current`}-${n}`}var q=e(t((e=>{e.Check=[[`path`,{d:`M20 6 9 17l-5-5`}]],e.ChevronDown=[[`path`,{d:`m6 9 6 6 6-6`}]],e.ChevronRight=[[`path`,{d:`m9 18 6-6-6-6`}]],e.ChevronUp=[[`path`,{d:`m18 15-6-6-6 6`}]],e.ChevronsDownUp=[[`path`,{d:`m7 20 5-5 5 5`}],[`path`,{d:`m7 4 5 5 5-5`}]],e.ChevronsUpDown=[[`path`,{d:`m7 15 5 5 5-5`}],[`path`,{d:`m7 9 5-5 5 5`}]],e.Circle=[[`circle`,{cx:`12`,cy:`12`,r:`10`}]],e.CircleAlert=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`}]],e.CircleCheck=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`m9 12 2 2 4-4`}]],e.Code2=[[`path`,{d:`m18 16 4-4-4-4`}],[`path`,{d:`m6 8-4 4 4 4`}],[`path`,{d:`m14.5 4-5 16`}]],e.Columns2=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M12 3v18`}]],e.Copy=[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`}]],e.CornerUpRight=[[`path`,{d:`m15 14 5-5-5-5`}],[`path`,{d:`M4 20v-7a4 4 0 0 1 4-4h12`}]],e.Eye=[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`}]],e.FoldVertical=[[`path`,{d:`M12 22v-6`}],[`path`,{d:`M12 8V2`}],[`path`,{d:`M4 12H2`}],[`path`,{d:`M10 12H8`}],[`path`,{d:`M16 12h-2`}],[`path`,{d:`M22 12h-2`}],[`path`,{d:`m15 19-3-3-3 3`}],[`path`,{d:`m15 5-3 3-3-3`}]],e.Folder=[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`}]],e.FolderClosed=[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`}],[`path`,{d:`M2 10h20`}]],e.FolderOpen=[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`}]],e.Image=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`}],[`circle`,{cx:`9`,cy:`9`,r:`2`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`}]],e.Link=[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`}]],e.ListPlus=[[`path`,{d:`M16 5H3`}],[`path`,{d:`M11 12H3`}],[`path`,{d:`M16 19H3`}],[`path`,{d:`M18 9v6`}],[`path`,{d:`M21 12h-6`}]],e.Lock=[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`}]],e.LockOpen=[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`}],[`path`,{d:`M7 11V7a5 5 0 0 1 9.9-1`}]],e.Maximize2=[[`path`,{d:`M15 3h6v6`}],[`path`,{d:`m21 3-7 7`}],[`path`,{d:`m3 21 7-7`}],[`path`,{d:`M9 21H3v-6`}]],e.Minimize2=[[`path`,{d:`m14 10 7-7`}],[`path`,{d:`M20 10h-6V4`}],[`path`,{d:`m3 21 7-7`}],[`path`,{d:`M4 14h6v6`}]],e.Minus=[[`path`,{d:`M5 12h14`}]],e.Moon=[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`}]],e.PanelLeft=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M9 3v18`}]],e.PanelLeftClose=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M9 3v18`}],[`path`,{d:`m16 15-3-3 3-3`}]],e.Plus=[[`path`,{d:`M5 12h14`}],[`path`,{d:`M12 5v14`}]],e.SquarePlus=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M8 12h8`}],[`path`,{d:`M12 8v8`}]],e.Sun=[[`circle`,{cx:`12`,cy:`12`,r:`4`}],[`path`,{d:`M12 2v2`}],[`path`,{d:`M12 20v2`}],[`path`,{d:`m4.93 4.93 1.41 1.41`}],[`path`,{d:`m17.66 17.66 1.41 1.41`}],[`path`,{d:`M2 12h2`}],[`path`,{d:`M20 12h2`}],[`path`,{d:`m6.34 17.66-1.41 1.41`}],[`path`,{d:`m19.07 4.93-1.41 1.41`}]],e.Table2=[[`path`,{d:`M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18`}]],e.Text=[[`path`,{d:`M21 5H3`}],[`path`,{d:`M15 12H3`}],[`path`,{d:`M17 19H3`}]],e.UnfoldVertical=[[`path`,{d:`M12 22v-6`}],[`path`,{d:`M12 8V2`}],[`path`,{d:`M4 12H2`}],[`path`,{d:`M10 12H8`}],[`path`,{d:`M16 12h-2`}],[`path`,{d:`M22 12h-2`}],[`path`,{d:`m15 19-3 3-3-3`}],[`path`,{d:`m15 5-3-3-3 3`}]],e.Volume2=[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`}]],e.VolumeOff=[[`path`,{d:`M16 9a5 5 0 0 1 .95 2.293`}],[`path`,{d:`M19.364 5.636a9 9 0 0 1 1.889 9.96`}],[`path`,{d:`m2 2 20 20`}],[`path`,{d:`m7 7-.587.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298V11`}],[`path`,{d:`M9.828 4.172A.686.686 0 0 1 11 4.657v.686`}]]}))(),1),xt=W(q.Check,P),St=W(q.ChevronDown,m),Ct=W(q.ChevronRight,b),wt=W(q.ChevronUp,E),Tt=W(q.ChevronsDownUp,null),Et=W(q.ChevronsUpDown,null),Dt=W(q.Circle,L),Ot=W(q.CircleAlert,A),kt=W(q.CircleCheck,a),At=W(q.Code2,$e),jt=W(q.Columns2,o),Mt=W(q.Copy,re),Nt=W(q.CornerUpRight,null),Pt=W(q.Eye,null),Ft=W(q.FoldVertical,null),It=W(q.Folder,v),Lt=W(q.FolderClosed,v),Rt=W(q.FolderOpen,te),zt=W(q.Image,ae),Bt=W(q.Link,g),Vt=W(q.ListPlus,null),Ht=W(q.Lock,null),Ut=W(q.LockOpen,null),Wt=W(q.Maximize2,C),Gt=W(q.Minimize2,null),Kt=W(q.Minus,Fe),qt=W(q.Moon,S),Jt=W(q.PanelLeft,ce),Yt=W(q.PanelLeftClose,null),Xt=W(q.Plus,Ee),Zt=W(q.SquarePlus,O),Qt=W(q.Sun,se),$t=W(q.Table2,le),en=W(q.Text,I),tn=W(q.UnfoldVertical,null),nn=W(q.Volume2,_e),rn=W(q.VolumeOff,Be),an=G.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{portalNode:c,portalSubtree:l}=ie({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,K.jsxs)(G.Fragment,{children:[l,c&&st.createPortal(n,c)]})}),on=`MmLlHhVvCcSsQqTtAaZz`;function sn(e){let t=[],n=e.length,r=0,i=0,a=0,o=0,s=0,c=null,l=``,u=0,d=0,f=``,p=!1,m=e=>{throw Error(`morphicons: ${e} at d[${r}]`)},h=e=>e>=48&&e<=57,g=()=>{for(;r<n;){let t=e.charCodeAt(r);if(t===32||t===9||t===10||t===13||t===12||t===44)r++;else break}},_=()=>{g();let t=r;r<n&&(e[r]===`+`||e[r]===`-`)&&r++;let i=!1;for(;r<n&&h(e.charCodeAt(r));)r++,i=!0;if(r<n&&e[r]===`.`)for(r++;r<n&&h(e.charCodeAt(r));)r++,i=!0;if(i||m(`expected number`),r<n&&(e[r]===`e`||e[r]===`E`)){let t=r;r++,r<n&&(e[r]===`+`||e[r]===`-`)&&r++;let i=!1;for(;r<n&&h(e.charCodeAt(r));)r++,i=!0;i||(r=t)}return Number(e.slice(t,r))},v=()=>{g();let t=e[r];return t===`0`||t===`1`?(r++,+(t===`1`)):m(`expected arc flag (0|1)`)},y=()=>(p||m(`path must start with M/m`),c||(c={x0:i,y0:a,segs:[],closed:!1},t.push(c)),c),b=!1,x=()=>_()+(b?i:0),S=()=>_()+(b?a:0);for(;g(),!(r>=n);){let n=e[r];switch(on.includes(n)?(l=n,r++):l===``?m(`path must start with M/m`):l===`M`?l=`L`:l===`m`?l=`l`:(l===`Z`||l===`z`)&&m(`stray data after Z`),b=l>=`a`,b?l.toUpperCase():l){case`M`:{p=!0;let e=x(),n=S();i=e,a=n,o=e,s=n,c={x0:e,y0:n,segs:[],closed:!1},t.push(c),f=``;break}case`L`:{let e=x(),t=S();y().segs.push([`L`,e,t]),i=e,a=t,f=``;break}case`H`:{let e=x();y().segs.push([`L`,e,a]),i=e,f=``;break}case`V`:{let e=S();y().segs.push([`L`,i,e]),a=e,f=``;break}case`C`:case`S`:{let e,t;l===`C`||l===`c`?(e=x(),t=S()):(e=f===`C`?2*i-u:i,t=f===`C`?2*a-d:a);let n=x(),r=S(),o=x(),s=S();y().segs.push([`C`,e,t,n,r,o,s]),u=n,d=r,i=o,a=s,f=`C`;break}case`Q`:case`T`:{let e,t;l===`Q`||l===`q`?(e=x(),t=S()):(e=f===`Q`?2*i-u:i,t=f===`Q`?2*a-d:a);let n=x(),r=S();y().segs.push([`Q`,e,t,n,r]),u=e,d=t,i=n,a=r,f=`Q`;break}case`A`:{let e=_(),t=_(),n=_(),r=v(),o=v(),s=x(),c=S();y().segs.push([`A`,e,t,n,r,o,s,c]),i=s,a=c,f=``;break}case`Z`:c&&=(c.closed=!0,null),i=o,a=s,f=``;break;default:m(`unsupported command "${l}"`)}}return t.filter(e=>e.segs.length>0)}function cn(e){return String(Math.round(e*100)/100)}function ln(e,t){let n=``;for(let r=0;r<e.length;r++){let i=e[r],a=i.length/2;n+=`M${cn(i[0])} ${cn(i[1])}`;for(let e=1;e<a;e++)n+=`L${cn(i[2*e])} ${cn(i[2*e+1])}`;t?.[r]&&(n+=`Z`)}return n}function J(e){return String(Math.round(e*1e4)/1e4)}function un(e){let t=``;for(let{pts:n,closed:r}of e){t+=`M${J(n[0])} ${J(n[1])}`;for(let e=2;e<n.length;e+=6)t+=`C${J(n[e])} ${J(n[e+1])} ${J(n[e+2])} ${J(n[e+3])} ${J(n[e+4])} ${J(n[e+5])}`;r&&(t+=`Z`)}return t}var dn=4/3*Math.tan(Math.PI/8),fn=2*Math.PI;function pn(e,t){let n=[e,t],r=e,i=t,a=(e,t,a,o,s,c)=>{n.push(e,t,a,o,s,c),r=s,i=c},o=(e,t)=>{Math.abs(e-r)<1e-12&&Math.abs(t-i)<1e-12||a(r+(e-r)/3,i+(t-i)/3,r+2*(e-r)/3,i+2*(t-i)/3,e,t)};return[a,o,(e,t,n,o)=>{a(r+2/3*(e-r),i+2/3*(t-i),n+2/3*(e-n),o+2/3*(t-o),n,o)},(e,t,n,s,c,l,u)=>{let d=r,f=i;if(Math.abs(l-d)<1e-12&&Math.abs(u-f)<1e-12)return;let p=Math.abs(e),m=Math.abs(t);if(p<1e-12||m<1e-12){o(l,u);return}let h=n*Math.PI/180,g=Math.cos(h),_=Math.sin(h),v=(d-l)/2,y=(f-u)/2,b=g*v+_*y,x=-_*v+g*y,S=b*b/(p*p)+x*x/(m*m);if(S>1){let e=Math.sqrt(S);p*=e,m*=e}let C=p*p,w=m*m,T=b*b,E=x*x,D=(C*w-C*E-w*T)/(C*E+w*T);D<0&&(D=0);let O=(s===c?-1:1)*Math.sqrt(D),k=O*p*x/m,A=-O*m*b/p,j=g*k-_*A+(d+l)/2,M=_*k+g*A+(f+u)/2,N=Math.atan2((x-A)/m,(b-k)/p),P=Math.atan2((-x-A)/m,(-b-k)/p)-N;c===0&&P>0?P-=fn:c===1&&P<0&&(P+=fn);let F=Math.max(1,Math.ceil(Math.abs(P)/(Math.PI/2)-1e-9)),I=P/F,L=4/3*Math.tan(I/4),R=e=>j+p*Math.cos(e)*g-m*Math.sin(e)*_,ee=e=>M+p*Math.cos(e)*_+m*Math.sin(e)*g,z=e=>-p*Math.sin(e)*g-m*Math.cos(e)*_,te=e=>-p*Math.sin(e)*_+m*Math.cos(e)*g,ne=N,re=d,B=f;for(let e=1;e<=F;e++){let t=N+I*e,n=e===F?l:R(t),r=e===F?u:ee(t);a(re+L*z(ne),B+L*te(ne),n-L*z(t),r-L*te(t),n,r),ne=t,re=n,B=r}},e=>(e&&o(n[0],n[1]),n.length<8?null:{pts:Float64Array.from(n),closed:e})]}function mn(e){let[t,n,r,i,a]=pn(e.x0,e.y0);for(let a of e.segs)switch(a[0]){case`L`:n(a[1],a[2]);break;case`C`:t(a[1],a[2],a[3],a[4],a[5],a[6]);break;case`Q`:r(a[1],a[2],a[3],a[4]);break;case`A`:i(a[1],a[2],a[3],a[4],a[5],a[6],a[7])}return a(e.closed)}function Y(e,t,n=0){let r=e[t];if(r===void 0)return n;let i=typeof r==`number`?r:Number(r);return Number.isFinite(i)?i:n}function hn(e){let t=String(e??``).trim();if(!t)return[];let n=t.split(/[\s,]+/).map(Number);if(n.some(e=>!Number.isFinite(e)))throw Error(`morphicons: invalid points: "${t}"`);return n}function gn(e,t){if(e.length<4)return null;let[,n,,,r]=pn(e[0],e[1]);for(let t=2;t+1<e.length;t+=2)n(e[t],e[t+1]);return r(t)}function _n(e,t,n,r){if(n<1e-12||r<1e-12)return null;let i=dn*n,a=dn*r,o=e+n,s=e-n,c=t+r,l=t-r,[u,,,,d]=pn(o,t);return u(o,t+a,e+i,c,e,c),u(e-i,c,s,t+a,s,t),u(s,t-a,e-i,l,e,l),u(e+i,l,o,t-a,o,t),d(!0)}function vn(e){let t=Y(e,`x`),n=Y(e,`y`),r=Y(e,`width`),i=Y(e,`height`);if(r<1e-12||i<1e-12)return null;let a=Y(e,`rx`,NaN),o=Y(e,`ry`,NaN);if(Number.isNaN(a)&&(a=Number.isNaN(o)?0:o),Number.isNaN(o)&&(o=a),a=Math.min(Math.max(a,0),r/2),o=Math.min(Math.max(o,0),i/2),a<1e-12||o<1e-12)return gn([t,n,t+r,n,t+r,n+i,t,n+i],!0);let s=t+a,c=t+r-a,l=t+r,u=n+o,d=n+i-o,f=n+i,p=dn*a,m=dn*o,[h,g,,,_]=pn(s,n);return g(c,n),h(c+p,n,l,u-m,l,u),g(l,d),h(l,d+m,c+p,f,c,f),g(s,f),h(s-p,f,t,d+m,t,d),g(t,u),h(t,u-m,s-p,n,s,n),_(!0)}function yn(e){let t=[],n=e=>{e&&t.push(e)};if(typeof e==`string`){for(let t of sn(e))n(mn(t));return t}for(let[t,r]of e)switch(t){case`path`:for(let e of sn(String(r.d??``)))n(mn(e));break;case`line`:{let[,e,,,t]=pn(Y(r,`x1`),Y(r,`y1`));e(Y(r,`x2`),Y(r,`y2`)),n(t(!1));break}case`circle`:{let e=Y(r,`r`);n(_n(Y(r,`cx`),Y(r,`cy`),e,e));break}case`ellipse`:n(_n(Y(r,`cx`),Y(r,`cy`),Y(r,`rx`),Y(r,`ry`)));break;case`rect`:n(vn(r));break;case`polyline`:n(gn(hn(r.points),!1));break;case`polygon`:n(gn(hn(r.points),!0));break;default:throw Error(`morphicons: unsupported tag <${t}>`)}return t}function bn(e){return e.items.map(()=>new Float64Array(2*e.n))}function xn(e,t,n){for(let r=0;r<e.items.length;r++){let i=e.items[r],a=n[r],o=e.n,s=Math.exp(i.lnSigma*t),c=i.theta*t,l=Math.cos(c)*s,u=Math.sin(c)*s,d,f;if(i.block){let[e,n]=i.block.off,[r,a]=i.block.drift;d=i.ca[0]+r*t+(e*l-n*u-e),f=i.ca[1]+a*t+(e*u+n*l-n)}else d=i.ca[0]+(i.cb[0]-i.ca[0])*t,f=i.ca[1]+(i.cb[1]-i.ca[1])*t;for(let e=0;e<o;e++){let n=i.aC[2*e]+(i.bT[2*e]-i.aC[2*e])*t,r=i.aC[2*e+1]+(i.bT[2*e+1]-i.aC[2*e+1])*t;a[2*e]=d+n*l-r*u,a[2*e+1]=f+n*u+r*l}}}var Sn=.35,Cn=.05,wn=.005,Tn=8,En=1e5;function X(e){let t=e.length/2,n=0,r=0;for(let i=0;i<t;i++)n+=e[2*i],r+=e[2*i+1];return[n/t,r/t]}function Dn(e){let t=e.length/2,n=0;for(let r=1;r<t;r++)n+=Math.hypot(e[2*r]-e[2*r-2],e[2*r+1]-e[2*r-1]);return n}function On(e){let t=e.length/2,n=new Float64Array(2*t);for(let r=0;r<t;r++)n[2*r]=e[2*(t-1-r)],n[2*r+1]=e[2*(t-1-r)+1];return n}function kn(e,t){let n=e.length/2,r=new Float64Array(2*n);for(let i=0;i<n;i++){let a=(i+t)%n;r[2*i]=e[2*a],r[2*i+1]=e[2*a+1]}return r}function An(e,t,n,r){let i=e.length/2,a=0,o=0,s=0,c=0,l=0,u=0;for(let d=0;d<i;d++){let i=e[2*d]-n[0],f=e[2*d+1]-n[1],p=t[2*d]-r[0],m=t[2*d+1]-r[1];a+=i*p,c+=f*m,o+=i*m,s+=f*p,l+=i*i+f*f,u+=p*p+m*m}let d=Math.atan2(o-s,a+c),f=Math.cos(d)*(a+c)+Math.sin(d)*(o-s),p=l>1e-12?f/l:1;p>1e-6||(p=1e-6);let m=Math.max(0,p*p*l-2*p*f+u),h=u>1e-12?Math.sqrt(m/u):0;return{theta:d,sigma:p,res:h}}function jn(e,t,n=!1,r=!1){let i=X(e),a=X(t),o=n&&!r,s=o?e:t,c=n||r?s.length/2:1,l=1/0,u=s,d={theta:0,sigma:1,res:0};for(let n=0;n<2;n++){let r=n?On(s):s;for(let n=0;n<c;n++){let s=n?kn(r,n):r,c=o?An(s,t,i,a):An(e,s,i,a),f=c.res+Cn*Math.abs(c.theta)/Math.PI;f<l&&(l=f,u=s,d=c)}}return o?{ca:i,cb:a,a:u,b:t,...d}:{ca:i,cb:a,a:e,b:u,...d}}function Mn(e,t){let n=t.map(X),r=t.map(Dn);return e.map(e=>{let t=X(e),i=Dn(e);return n.map((e,n)=>Math.hypot(t[0]-e[0],t[1]-e[1])+Sn*Math.abs(i-r[n]))})}function Nn(e){let t=e.length;if(t>Tn){let n=[];for(let r=0;r<t;r++)for(let i=0;i<t;i++)n.push([e[r][i],r,i]);n.sort((e,t)=>e[0]-t[0]);let r=Array(t).fill(-1),i=Array(t).fill(!1);for(let[,e,t]of n)r[e]<0&&!i[t]&&(r[e]=t,i[t]=!0);return r}let n=Array.from({length:t},(e,t)=>t),r=n.slice(),i=1/0,a=(n,o,s)=>{if(!(s>=i)){if(o===t){i=s,r=n.slice();return}for(let r=o;r<t;r++)[n[o],n[r]]=[n[r],n[o]],a(n,o+1,s+e[o][n[o]]),[n[o],n[r]]=[n[r],n[o]]}};return a(n,0,0),r}function Pn(e){let t=e.length,n=e[0].length;if(n**t>En){let r=e.map(e=>{let t=0;for(let n=1;n<e.length;n++)e[n]<e[t]&&(t=n);return t}),i=Array(n).fill(0);for(let e of r)i[e]++;for(let a=0;a<n;a++){if(i[a]>0)continue;let n=-1,o=1/0;for(let s=0;s<t;s++){if(i[r[s]]<2)continue;let t=e[s][a]-e[s][r[s]];t<o&&(o=t,n=s)}i[r[n]]--,r[n]=a,i[a]++}return r}let r=null,i=1/0,a=Array(t),o=Array(n).fill(0),s=(c,l,u)=>{if(!(l>=i||n-u>t-c)){if(c===t){i=l,r=a.slice();return}for(let t=0;t<n;t++)a[c]=t,o[t]++,s(c+1,l+e[c][t],u+ +(o[t]===1)),o[t]--}};if(s(0,0,0),!r)throw Error(`morphicons: no valid surjection (B < S)`);return r}function Fn(e,t){let n=e.length*t,r=new Float64Array(2*n),i=new Float64Array(2*n);e.forEach((e,n)=>{r.set(e.a,2*t*n),i.set(e.bO,2*t*n)});let a=X(r),o=An(r,i,a,X(i));if(o.res>=wn)return;let s=Math.cos(-o.theta),c=Math.sin(-o.theta),l=Math.cos(o.theta),u=Math.sin(o.theta);for(let n of e){let e=0,r=0;for(let i=0;i<t;i++){let t=n.bO[2*i]-n.cb[0],a=n.bO[2*i+1]-n.cb[1];n.bT[2*i]=(t*s-a*c)/o.sigma,n.bT[2*i+1]=(t*c+a*s)/o.sigma;let d=o.sigma*(l*n.aC[2*i]-u*n.aC[2*i+1])-t,f=o.sigma*(u*n.aC[2*i]+l*n.aC[2*i+1])-a;e+=d*d+f*f,r+=t*t+a*a}n.theta=o.theta,n.lnSigma=Math.log(o.sigma),n.res=r>1e-12?Math.sqrt(e/r):0;let i=Math.exp(n.lnSigma),d=Math.cos(n.theta)*i,f=Math.sin(n.theta)*i,p=n.ca[0]-a[0],m=n.ca[1]-a[1],h=p*d-m*f-p,g=p*f+m*d-m;n.block={off:[p,m],drift:[n.cb[0]-n.ca[0]-h,n.cb[1]-n.ca[1]-g]}}}function In(e,t){let n=e.length,r=t.length;if(n===0||r===0)throw Error(`morphicons: icon has no subpaths`);let i=e.map(e=>e.pts),a=t.map(e=>e.pts),o=[];if(n===r){let e=Nn(Mn(i,a));for(let t=0;t<n;t++)o.push([t,e[t]])}else if(n<r){let e=Pn(Mn(a,i));for(let t=0;t<r;t++)o.push([e[t],t])}else{let e=Pn(Mn(i,a));for(let t=0;t<n;t++)o.push([t,e[t]])}let s=i[0].length/2,c=o.map(([n,r])=>{let o=jn(i[n],a[r],e[n].closed,t[r].closed),c=o.a,l=new Float64Array(2*s),u=new Float64Array(2*s),d=new Float64Array(2*s),f=Math.cos(-o.theta),p=Math.sin(-o.theta);for(let e=0;e<s;e++){l[2*e]=c[2*e]-o.ca[0],l[2*e+1]=c[2*e+1]-o.ca[1];let t=o.b[2*e]-o.cb[0],n=o.b[2*e+1]-o.cb[1];u[2*e]=(t*f-n*p)/o.sigma,u[2*e+1]=(t*p+n*f)/o.sigma,d[2*e]=o.b[2*e],d[2*e+1]=o.b[2*e+1]}return{a:c,aC:l,bT:u,bO:d,ca:o.ca,cb:o.cb,theta:o.theta,lnSigma:Math.log(o.sigma),res:o.res,closed:e[n].closed&&t[r].closed,block:null}});return c.length>1&&Fn(c,s),{items:c,n:s}}var Ln=Math.PI/8,Rn=[.18343464249564978,.525532409916329,.7966664774136267,.9602898564975363],zn=[.362683783378362,.31370664587788727,.22238103445337448,.10122853629037626];function Bn(e,t,n){let r=6*t,i=1-n,a=3*i*i,o=6*i*n,s=3*n*n,c=a*(e[r+2]-e[r])+o*(e[r+4]-e[r+2])+s*(e[r+6]-e[r+4]),l=a*(e[r+3]-e[r+1])+o*(e[r+5]-e[r+3])+s*(e[r+7]-e[r+5]);return Math.hypot(c,l)}function Vn(e,t,n=1){let r=n/2,i=0;for(let n=0;n<4;n++)i+=zn[n]*(Bn(e,t,r+r*Rn[n])+Bn(e,t,r-r*Rn[n]));return i*r}function Hn(e,t,n,r,i){let a=6*t,o=1-n,s=o*o*o,c=3*o*o*n,l=3*o*n*n,u=n*n*n;r[i]=s*e[a]+c*e[a+2]+l*e[a+4]+u*e[a+6],r[i+1]=s*e[a+1]+c*e[a+3]+l*e[a+5]+u*e[a+7]}function Un(e,t,n){let r=6*t,i=n?r+6:r,a=n?-1:1;for(let t of n?[4,2,0]:[2,4,6]){let n=a*(e[r+t]-e[i]),o=a*(e[r+t+1]-e[i+1]);if(n*n+o*o>1e-18)return[n,o]}return null}function Wn(e,t=Ln){let n=e.pts,r=(n.length/2-1)/3,i=[];for(let e=0;e<r;e++)Vn(n,e)>1e-9&&i.push(e);if(i.length===0)return[];let a=new Set,o=(e,r)=>{let i=Un(n,e,!0),o=Un(n,r,!1);i&&o&&Math.abs(Math.atan2(i[0]*o[1]-i[1]*o[0],i[0]*o[0]+i[1]*o[1]))>t&&a.add(r)};for(let e=0;e+1<i.length;e++)o(i[e],i[e+1]);return e.closed&&i.length>1&&o(i[i.length-1],i[0]),[...a].sort((e,t)=>e-t)}function Gn(e,t,n,r){if(n<=0)return 0;if(n>=r)return 1;let i=0,a=1,o=n/r;for(let s=0;s<12;s++){let s=Vn(e,t,o)-n;if(Math.abs(s)<1e-10*r+1e-14)break;s>0?a=o:i=o;let c=Bn(e,t,o),l=c>1e-12?o-s/c:(i+a)/2;l>i&&l<a||(l=(i+a)/2),o=l}return o}function Kn(e,t=64,n=Ln){let r=e.pts,i=(r.length/2-1)/3,a=new Float64Array(2*t),o=()=>{for(let e=0;e<t;e++)a[2*e]=r[0],a[2*e+1]=r[1];return a};if(i<1)return o();let s=Array(i),c=0;for(let e=0;e<i;e++)s[e]=Vn(r,e),c+=s[e];if(c<1e-12)return o();let l=Wn(e,n),u=e.closed?l.length>0?l:[0]:[...new Set([0,...l,i])].sort((e,t)=>e-t),d=[];if(e.closed)for(let e=0;e<u.length;e++){let t=u[e],n=e+1<u.length?u[e+1]:u[0]+i;d.push([t,n])}else for(let e=0;e+1<u.length;e++)d.push([u[e],u[e+1]]);let f=d.map(([e,t])=>{let n=0;for(let r=e;r<t;r++)n+=s[r%i];return n}),p=e.closed?t:t-1;if(d.length>p)throw Error(`morphicons: N=${t} too small (${d.length} runs)`);let m=f.reduce((e,t)=>e+t,0)||1,h=f.map(e=>p*e/m),g=h.map(e=>Math.max(1,Math.floor(e))),_=p-g.reduce((e,t)=>e+t,0);if(_>0){let e=h.map((e,t)=>[Math.round((e-Math.floor(e))*1e9),t]).sort((e,t)=>t[0]-e[0]||e[1]-t[1]);for(let t=0;t<_;t++)g[e[t%g.length][1]]++}for(;_<0;){let e=0;for(let t=1;t<g.length;t++)g[t]>g[e]&&(e=t);if(g[e]<=1)break;g[e]--,_++}let v=0;for(let e=0;e<d.length;e++){let[t,n]=d[e],o=g[e],c=f[e],l=t%i*6;a[2*v]=r[l],a[2*v+1]=r[l+1],v++;let u=t,p=0;for(let e=1;e<o;e++){let t=c*e/o;for(;u<n-1&&p+s[u%i]<t;)p+=s[u%i],u++;let l=u%i,d=s[l];Hn(r,l,d>1e-12?Gn(r,l,t-p,d):0,a,2*v),v++}}if(!e.closed){let e=6*i;a[2*v]=r[e],a[2*v+1]=r[e+1]}return a}function qn(e,t=64){return yn(e).map(e=>({pts:Kn(e,t),closed:e.closed}))}var Jn=class{x=1;v=0;k=250;c=24;config(e,t){this.k=e,this.c=t}start(){this.x=0,this.v>14&&(this.v=14),this.v<-14&&(this.v=-14)}step(e){let t=Math.max(1,Math.min(16,Math.ceil(e/(1/240)))),n=e/t;for(let e=0;e<t;e++){let e=this.k*(1-this.x)-this.c*this.v;this.v+=e*n,this.x+=this.v*n}return Math.abs(1-this.x)<.001&&Math.abs(this.v)<.02}},Yn={smooth:{k:170,c:26},snappy:{k:420,c:30},bouncy:{k:300,c:14}},Xn=new Set,Z=0,Q=-1;function Zn(e){let t=Q<0?0:Math.min(Math.max((e-Q)/1e3,0),.1);Q=e;for(let e of[...Xn])e(t);Xn.size>0?Z=requestAnimationFrame(Zn):(Z=0,Q=-1)}function Qn(e){Xn.add(e),Z===0&&(Q=-1,Z=requestAnimationFrame(Zn))}function $n(e){Xn.delete(e),Xn.size===0&&Z!==0&&(cancelAnimationFrame(Z),Z=0,Q=-1)}var er=new WeakMap,tr=new WeakMap,nr=new WeakMap;function $(e){if(typeof e==`string`)return qn(e);let t=er.get(e);return t||(t=qn(e),er.set(e,t)),t}function rr(e){if(typeof e==`string`)return e;let t=tr.get(e);return t||(t=un(yn(e)),tr.set(e,t)),t}function ir(e,t){if(typeof e==`string`||typeof t==`string`)return In($(e),$(t));let n=nr.get(e);n||(n=new WeakMap,nr.set(e,n));let r=n.get(t);return r||(r=In($(e),$(t)),n.set(t,r)),r}function ar(e){if(typeof e==`string`)return Yn[e];let t=Yn.snappy;return{k:e?.stiffness??t.k,c:e?.damping??t.c}}function or(e,t,n){let r=new Jn,i=n?.reducedMotion??`never`,a=t,o=!0,s=null,c=null,l=null,u=1,d=!1,f=!1;e.setAttribute(`d`,rr(t));let p=t=>{let n=s,r=c,i=l;n&&r&&i&&(u=t,xn(n,t,r),e.setAttribute(`d`,ln(r,i)))},m=()=>{d&&(d=!1,$n(h))},h=e=>{let t=r.step(e);p(r.x),t&&(m(),g())},g=()=>{o=!0,s=null,c=null,l=null,u=1,r.x=1,r.v=0,e.setAttribute(`d`,rr(a))},_=()=>{let e=s,t=c;return o||!e||!t?$(a):t.map((t,n)=>({pts:Float64Array.from(t),closed:e.items[n].closed}))},v=e=>{s=o?ir(a,e):In(_(),$(e)),c=bn(s),l=s.items.map(e=>e.closed),a=e,o=!1},y=e=>{m(),a=e,g()},b=()=>i===`always`?!0:i!==`user`||typeof matchMedia>`u`?!1:matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1,x=(e,t)=>{if(f)return;let n=!o&&s!==null&&e===a;m(),r.v=0,n||v(e),p(t)};return{morphTo(e,t){if(f||e===a&&(o||d))return;if(b()){y(e);return}let{k:n,c:i}=ar(t);r.config(n,i),v(e),r.start(),d||(d=!0,Qn(h))},set(e){f||y(e)},seek:x,get progress(){return o?1:u},set progress(e){f||x(a,e)},get reducedMotion(){return i},set reducedMotion(e){i=e},destroy(){m(),f=!0,s=null,c=null,l=null}}}var sr=typeof document>`u`?G.useEffect:G.useLayoutEffect;function cr(e,t,n){if(n<=0)return rr(e);if(n>=1)return rr(t);let r=In(qn(e),qn(t)),i=bn(r);return xn(r,n,i),ln(i,r.items.map(e=>e.closed))}var lr=(0,G.forwardRef)(function(e,t){let{icon:n,from:r,to:i,progress:a,spring:o,reducedMotion:s,size:c=24,color:l=`currentColor`,strokeWidth:u=2,absoluteStrokeWidth:d,label:f,...p}=e,m=r!==void 0&&i!==void 0,h=n??r??i,[g]=(0,G.useState)(()=>m?cr(r,i,a??0):h===void 0?``:rr(h)),_=(0,G.useRef)(null),v=(0,G.useRef)(null),y=(0,G.useRef)(o);y.current=o;let b=(0,G.useRef)(s);b.current=s;let x=(0,G.useRef)(n),S=(0,G.useRef)(m),C=(0,G.useRef)(!1),w=(0,G.useRef)(!1),T=(0,G.useRef)(null),E=(0,G.useCallback)(e=>{if(v.current)return v.current;let t=_.current;return C.current||!t?null:(v.current=or(t,e,{reducedMotion:b.current}),v.current)},[]);sr(()=>{C.current=!1;let e=_.current;if(e&&h!==void 0){let t=or(e,m?r:h,{reducedMotion:b.current});if(v.current=t,m){T.current=[r,i];let e=a??0;e<=0?t.set(r):e>=1?t.set(i):(t.seek(i,e),w.current=!0)}}return()=>{C.current=!0,v.current?.destroy(),v.current=null,w.current=!1,T.current=null}},[]),(0,G.useEffect)(()=>{let e=v.current;e&&(e.reducedMotion=s??`never`)},[s]),(0,G.useEffect)(()=>{let e=S.current&&!m;S.current=m;let t=n!==x.current;if(x.current=n,m||n===void 0||!t&&!e)return;T.current=null,w.current=!1;let r=v.current;r?r.morphTo(n,y.current):E(n)},[n,m,E]),(0,G.useEffect)(()=>{if(!m)return;let e=v.current??E(r);if(!e)return;let t=a??0;(!T.current||T.current[0]!==r||T.current[1]!==i)&&(T.current=[r,i],w.current=!1),t<=0?(e.set(r),w.current=!1):t>=1?(e.set(i),w.current=!1):(w.current||=(e.set(r),!0),e.seek(i,t))},[m,r,i,a,E]),(0,G.useImperativeHandle)(t,()=>({morphTo:(e,t)=>{T.current=null,w.current=!1;let n=v.current;n?n.morphTo(e,t??y.current):E(e)},set:e=>{T.current=null,w.current=!1;let t=v.current;t?t.set(e):E(e)}}),[E]);let D=d?Number(u)*24/Number(c):u;return(0,K.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:c,height:c,viewBox:`0 0 24 24`,fill:`none`,stroke:l,strokeWidth:D,strokeLinecap:`round`,strokeLinejoin:`round`,role:f?`img`:void 0,"aria-hidden":!f||void 0,...p,children:[f?(0,K.jsx)(`title`,{children:f}):null,(0,K.jsx)(`path`,{ref:_,d:g})]})});function ur(e){return typeof e==`object`&&!!e&&`lucide`in e}function dr(e){let t=(0,ot.c)(17),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({reducedMotion:a,icon:n,strokeWidth:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`user`:a,s=ke(),c=ur(n)?s===`p4`?n.p4??n.lucide:n.lucide:n,l;t[5]!==s||t[6]!==i?(l=s===`p4`?Re(i):i,t[5]=s,t[6]=i,t[7]=l):l=t[7];let u=l,d;t[8]===c?d=t[9]:(d=c===void 0?{}:{icon:c},t[8]=c,t[9]=d);let f;t[10]===u?f=t[11]:(f=u===void 0?{}:{strokeWidth:u},t[10]=u,t[11]=f);let p;return t[12]!==r||t[13]!==o||t[14]!==d||t[15]!==f?(p=(0,K.jsx)(lr,{reducedMotion:o,...d,...f,...r}),t[12]=r,t[13]=o,t[14]=d,t[15]=f,t[16]=p):p=t[16],p}var fr=G.createContext(void 0);function pr(e){let t=G.useContext(fr);if(t===void 0&&!e)throw Error(k(72));return t}var mr={...Me,disabled:V(e=>e.disabled),instantType:V(e=>e.instantType),isInstantPhase:V(e=>e.isInstantPhase),trackCursorAxis:V(e=>e.trackCursorAxis),disableHoverablePopup:V(e=>e.disableHoverablePopup),lastOpenChangeReason:V(e=>e.openChangeReason),closeOnClick:V(e=>e.closeOnClick),closeDelay:V(e=>e.closeDelay),hasViewport:V(e=>e.hasViewport)},hr=class e extends qe{constructor(e,t,n=!1){let r=new Ce,i={...gr(),...e};i.floatingRootContext=Pe(r,t,n),super(i,{popupRef:G.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:r},mr)}setOpen=(e,t)=>{let n=t.reason,r=n===Ne,i=e&&n===`trigger-focus`,a=!e&&(n===`trigger-press`||n===`escape-key`);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let o=()=>{let r={open:e,openChangeReason:n};i?r.instantType=`focus`:a?r.instantType=`dismiss`:n===`trigger-hover`&&(r.instantType=void 0),de(r,e,t.trigger),this.update(r)};r?st.flushSync(o):o()};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,H(we,e))}static useStore(t,n){return ee(t,(t,r)=>new e(n,t,r)).store}};function gr(){return{...ye(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}var _r=f(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,m=hr.useStore(l?.store,{open:n,openProp:r,activeTriggerId:d,triggerIdProp:u});p(()=>{r===void 0&&m.state.open===!1&&n===!0&&m.update({open:!0,activeTriggerId:d})}),m.useControlledProp(`openProp`,r),m.useControlledProp(`triggerIdProp`,u),m.useContextCallback(`onOpenChange`,s),m.useContextCallback(`onOpenChangeComplete`,c);let h=m.useState(`open`),g=!t&&h,_=m.useState(`activeTriggerId`),v=m.useState(`mounted`),y=m.useState(`payload`);m.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i}),m.useSyncedValue(`disabled`,t),We(m);let{forceUnmount:b,transitionStatus:x}=Ze(g,m),S=m.useState(`isInstantPhase`),C=m.useState(`instantType`),w=m.useState(`lastOpenChangeReason`),T=G.useRef(null);B(()=>{h&&t&&m.setOpen(!1,H(ue))},[h,t,m]),B(()=>{x===`ending`&&w===`none`||x!==`ending`&&S?(C!==`delay`&&(T.current=C),m.set(`instantType`,`delay`)):T.current!==null&&(m.set(`instantType`,T.current),T.current=null)},[x,S,w,C,m]),B(()=>{g&&(_??m.set(`payload`,void 0))},[m,_,g]);let E=G.useCallback(()=>{m.setOpen(!1,H(ve))},[m]);G.useImperativeHandle(o,()=>({unmount:b,close:E}),[b,E]);let D=g||v||!t&&a!==`none`;return(0,K.jsxs)(fr.Provider,{value:m,children:[D&&(0,K.jsx)(vr,{store:m,disabled:t,trackCursorAxis:a}),typeof f==`function`?f({payload:y}):f]})});function vr({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=j(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=at(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n}),o=G.useMemo(()=>z(a.reference,i.reference),[a.reference,i.reference]),s=G.useMemo(()=>z(a.trigger,i.trigger),[a.trigger,i.trigger]),c=G.useMemo(()=>z(xe,a.floating,i.floating),[a.floating,i.floating]);return pe(e,{activeTriggerProps:o,inactiveTriggerProps:s,popupProps:c}),null}var yr=G.createContext(void 0);function br(){return G.useContext(yr)}var xr=function(e){return e[e.popupOpen=Ge.popupOpen]=`popupOpen`,e.triggerDisabled=`data-trigger-disabled`,e}({}),Sr=`data-base-ui-tooltip-trigger`;function Cr(e){if(`composedPath`in e){let t=e.composedPath();for(let e=0;e<t.length;e+=1){let n=t[e];if(_(n))return n}}let t=e.target;return _(t)?t:null}function wr(e){let t=e;for(;t;){if(t.hasAttribute(Sr))return t;let e=t.parentElement;if(e){t=e;continue}let n=t.getRootNode();t=`host`in n&&_(n.host)?n.host:null}return null}var Tr=M(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:c,closeOnClick:u=!0,closeDelay:d,id:f,...p}=e,m=pr(!0),h=a?.store??m;if(!h)throw Error(k(82));let g=De(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`isOpenedByTrigger`,g),y=h.useState(`floatingRootContext`),b=G.useRef(null),x=c??600,S=d??0,{registerTrigger:C,isMountedByThisTrigger:w}=l(g,b,h,{payload:o,closeOnClick:u,closeDelay:S}),T=br(),{delayRef:E,isInstantPhase:D,hasProvider:O}=nt(y,{open:v}),A=Ae(y);h.useSyncedValue(`isInstantPhase`,D);let j=h.useState(`disabled`),M=s??j,N=me(M),P=h.useState(`trackCursorAxis`),F=h.useState(`disableHoverablePopup`),I=G.useRef(!1),L=fe(),R=G.useRef(void 0);function ee(){let e=T?.delay,t=typeof E.current==`object`?E.current.open:void 0,n=x;return O&&(n=t===0?0:c??e??x),n}function z(e){let t=b.current;if(!t||!e)return!1;let n=wr(e);return n!==null&&n!==t&&je(t,n)}function te(e){let t=z(e);return I.current=t,t&&(A.openChangeTimeout.clear(),A.restTimeout.clear(),A.restTimeoutPending=!1,L.clear()),t}let ne=ze(y,{enabled:!M,mouseOnly:!0,move:!1,handleClose:!F&&P!==`both`?Te():null,restMs:ee,delay(){let e=typeof E.current==`object`?E.current.close:void 0,t=S;return d==null&&O&&(t=e),{close:t}},triggerElementRef:b,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`,shouldOpen(){return!I.current}}),re=He(y,{enabled:!M}).reference,B=e=>{let t=I.current,n=Cr(e),r=te(n),i=b.current,a=i&&n&&je(i,n);if(r&&h.select(`open`)&&h.select(`lastOpenChangeReason`)===`trigger-hover`){h.setOpen(!1,H(Ne,e));return}if(t&&!r&&a&&!N.current&&!h.select(`open`)&&i&&be(R.current)){let t=()=>{!I.current&&!N.current&&!h.select(`open`)&&h.setOpen(!0,H(Ne,e,i))},n=ee();n===0?(L.clear(),t()):L.start(n,t)}},ie=h.useState(`triggerProps`,w);return Je(`button`,e,{state:{open:v},ref:[t,C,b],props:[ne,re,w||P!==`none`?ie:void 0,{onMouseOver(e){B(e.nativeEvent)},onFocus(e){z(Cr(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){I.current=!1,L.clear(),R.current=void 0},onPointerEnter(e){R.current=e.pointerType},onPointerDown(e){R.current=e.pointerType,h.set(`closeOnClick`,u),u&&!h.select(`open`)&&h.cancelPendingOpen(e.nativeEvent)},onClick(e){u&&!h.select(`open`)&&h.cancelPendingOpen(e.nativeEvent)},id:g,[xr.triggerDisabled]:M?``:void 0,[Sr]:M?void 0:``},p],stateAttributesMapping:Ye})}),Er=G.createContext(void 0);function Dr(){let e=G.useContext(Er);if(e===void 0)throw Error(k(70));return e}var Or=G.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return pr().useState(`mounted`)||n?(0,K.jsx)(Er.Provider,{value:n,children:(0,K.jsx)(an,{ref:t,...r})}):null}),kr=G.createContext(void 0);function Ar(){let e=G.useContext(kr);if(e===void 0)throw Error(k(71));return e}var jr=G.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:g=T,style:_,...v}=e,y=pr(),b=Dr(),x=y.useState(`open`),S=y.useState(`mounted`),C=y.useState(`trackCursorAxis`),w=y.useState(`disableHoverablePopup`),E=y.useState(`floatingRootContext`),D=y.useState(`instantType`),O=y.useState(`transitionStatus`),k=y.useState(`hasViewport`),A=F({anchor:i,positionMethod:a,floatingRootContext:E,mounted:S,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:b,collisionAvoidance:g,adaptiveOrigin:k?h:void 0}),j=G.useMemo(()=>({open:x,side:A.side,align:A.align,anchorHidden:A.anchorHidden,instant:C===`none`?D:`tracking-cursor`}),[x,A.side,A.align,A.anchorHidden,C,D]),M=Oe(e,j,{styles:A.positionerStyles,transitionStatus:O,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!S,inert:!x||C===`both`||w});return(0,K.jsx)(kr.Provider,{value:A,children:M})}),Mr={...Qe,...u},Nr=G.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=pr(),{side:c,align:l}=Ar(),u=o.useState(`open`),d=o.useState(`instantType`),f=o.useState(`transitionStatus`),p=o.useState(`popupProps`),m=o.useState(`floatingRootContext`),h=o.useState(`disabled`),g=o.useState(`closeDelay`);R({open:u,ref:o.context.popupRef,onComplete(){u&&o.context.onOpenChangeComplete?.(!0)}}),he(m,{enabled:!h,closeDelay:g});let _=o.useStateSetter(`popupElement`);return Je(`div`,e,{state:{open:u,side:c,align:l,instant:d,transitionStatus:f},ref:[t,o.context.popupRef,_],props:[p,s(f),a],stateAttributesMapping:Mr})}),Pr=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=G.useMemo(()=>({delay:t,closeDelay:n}),[t,n]),a=G.useMemo(()=>({open:t,close:n}),[t,n]);return(0,K.jsx)(yr.Provider,{value:i,children:(0,K.jsx)(tt,{delay:a,timeoutMs:r,children:e.children})})},Fr=function(e){return e.popupWidth=`--popup-width`,e.popupHeight=`--popup-height`,e}({}),Ir={activationDirection:e=>e?{"data-activation-direction":e}:null},Lr=G.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,s=pr(),c=Ar(),l=s.useState(`instantType`),{children:u,state:d}=gt({store:s,side:c.side,cssVars:Fr,children:a}),f={activationDirection:d.activationDirection,transitioning:d.transitioning,instant:l};return Je(`div`,e,{state:f,ref:t,props:[o,{children:u}],stateAttributesMapping:Ir})});export{Bt as A,Xt as B,Nt as C,Lt as D,It as E,Gt as F,tn as G,Qt as H,Kt as I,gt as J,nn as K,qt as L,Ht as M,Ut as N,Rt as O,Wt as P,Jt as R,Mt as S,Ft as T,$t as U,Zt as V,en as W,ct as Y,Dt as _,Or as a,At as b,hr as c,xt as d,St as f,Et as g,Tt as h,jr as i,Vt as j,zt as k,dr as l,wt as m,Pr as n,Tr as o,Ct as p,rn as q,Nr as r,_r as s,Lr as t,an as u,Ot as v,Pt as w,jt as x,kt as y,Yt as z};
|
|
2
|
-
//# sourceMappingURL=TooltipViewport-ZmVCer7P.js.map
|