pisper 0.6.35 → 0.6.36
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/lib/executor-node.mjs +31 -7
- package/package.json +6 -6
- package/web/.vite/manifest.json +1018 -826
- package/web/assets/{AppDialog-BIc2uEZh.js → AppDialog-C79lPTAo.js} +1 -1
- package/web/assets/{AppOverlays-BlJ0uL_P.js → AppOverlays-CcLTlcPI.js} +1 -1
- package/web/assets/AssetsPage-DItvQcTv.js +1 -0
- package/web/assets/AttachmentTray-DT4tuA-0.js +1 -0
- package/web/assets/BoardPage-BS2Mn5BB.js +3 -0
- package/web/assets/BotAvatar-DfRTuJjC.js +1 -0
- package/web/assets/{ChannelsPage-DgzuzmFL.js → ChannelsPage-HLl1Exdg.js} +1 -1
- package/web/assets/{ChatAppearancePage-98Sa8ZQW.js → ChatAppearancePage-COu9kuXs.js} +1 -1
- package/web/assets/ChatHistoryPage-DW7tD7eq.js +1 -0
- package/web/assets/ChatMessage-BA6Yf2bc.js +5 -0
- package/web/assets/ChatPage-Cz50Wq-F.js +553 -0
- package/web/assets/ConfigPage-BBU5Rrn1.js +7 -0
- package/web/assets/{DesktopWindowControls-BQ0OvDZ8.js → DesktopWindowControls-BJa4zqE2.js} +1 -1
- package/web/assets/{FeaturePage-C0bAQ4el.js → FeaturePage-D2NZ4cLC.js} +1 -1
- package/web/assets/{FileAttachmentPreview-BdMgsecO.js → FileAttachmentPreview-CFAdIi3l.js} +1 -1
- package/web/assets/{FloatingWidgets-DjMCcqln.js → FloatingWidgets-BzwWhwvZ.js} +1 -1
- package/web/assets/FocusRuntimeControls-eXxgJIFt.js +2 -0
- package/web/assets/{GitDiffViewer-hHSTzUJk.js → GitDiffViewer-DDd2yMvx.js} +3 -3
- package/web/assets/ManageProjectsDialog-Sf4KX5NQ.js +1 -0
- package/web/assets/{MarkdownMessage-CktdHgKM.js → MarkdownMessage-CggW-dCt.js} +1 -1
- package/web/assets/McpPage-CSaBHKz7.js +1 -0
- package/web/assets/{MemoryEvolution-DBjU-Nr7.js → MemoryEvolution-DV0LMrEd.js} +1 -1
- package/web/assets/MemoryPage-G0tvVhJb.js +2 -0
- package/web/assets/{MobileNavigation-B2NKM8rj.js → MobileNavigation-B1XfXR2s.js} +1 -1
- package/web/assets/{MorePage-xB2zBRtU.js → MorePage-DGYxdHLm.js} +1 -1
- package/web/assets/NewFolderDialog-CzgCnqfC.js +1 -0
- package/web/assets/{PageHeader-BN-qcxte.js → PageHeader-CQ4qg6wC.js} +1 -1
- package/web/assets/{PhoneDrawer-utEXi-yp.js → PhoneDrawer-CjUjF454.js} +1 -1
- package/web/assets/{PhoneMenuButton-uG_T93KL.js → PhoneMenuButton-DbsLKxdG.js} +1 -1
- package/web/assets/PhoneTopBar-DMMlJYcd.js +1 -0
- package/web/assets/PluginsPage-BnNOlT_w.js +1 -0
- package/web/assets/{SafeModePrompt-jV-PRvrW.js → SafeModePrompt-DpzPKu3D.js} +1 -1
- package/web/assets/{SchedulesPage-Diethe4H.js → SchedulesPage-Ds4Q6aNP.js} +1 -1
- package/web/assets/SessionBrowserPane-C0P_zk8r.js +2 -0
- package/web/assets/SessionContextPanel-CHOeF4Yg.js +2 -0
- package/web/assets/SessionHome-BVB1DziO.js +1 -0
- package/web/assets/SessionInspector-CI0yM7hn.js +1 -0
- package/web/assets/SessionShell-kd6S4sjr.js +1 -0
- package/web/assets/SettingsRow-CT0AZ7re.js +1 -0
- package/web/assets/{SettingsSidebar-CpAD5iSt.js → SettingsSidebar-Tef3Nnew.js} +1 -1
- package/web/assets/{ShortcutHelpDialog-C2QbSvui.js → ShortcutHelpDialog-C8XduaKQ.js} +1 -1
- package/web/assets/{ShortcutKeys-Dl4Suwhz.js → ShortcutKeys-CHOVA_5P.js} +1 -1
- package/web/assets/{SidebarUpdateStatus-DrS7u_v_.js → SidebarUpdateStatus-BNFx2j6q.js} +1 -1
- package/web/assets/{SkillsPage-CDoMtK-E.js → SkillsPage-TBWU04ie.js} +1 -1
- package/web/assets/{TaskProcessesPane-Z_9HeVX5.js → TaskProcessesPane-BHe6CquN.js} +1 -1
- package/web/assets/{TaskTerminalView-BTCVpAHF.js → TaskTerminalView-ByuB7q2B.js} +1 -1
- package/web/assets/{TerminalPanel-DuUtaPyf.js → TerminalPanel-FXsJQMsq.js} +1 -1
- package/web/assets/{WebDesktopPet-CWviMnct.js → WebDesktopPet-Bw-jipEg.js} +1 -1
- package/web/assets/{WorkflowsPage-CHvyXwCg.js → WorkflowsPage-COT3iS5m.js} +1 -1
- package/web/assets/{WorkspacePicker-D6FLo7O1.js → WorkspacePicker-DjW-sAP5.js} +1 -1
- package/web/assets/activity-BCxvXCG3.js +1 -0
- package/web/assets/alert-dialog-DiUitBB0.js +1 -0
- package/web/assets/{api-Cm58F7OP.js → api-BET28sp7.js} +1 -1
- package/web/assets/{app-primitives-Drz_SjnR.js → app-primitives-BskZ4ZJj.js} +1 -1
- package/web/assets/{app-update-KLjtuCDT.js → app-update-7n8nXaPd.js} +1 -1
- package/web/assets/{approval-confirm-BrorOUHg.js → approval-confirm-SBeU3s_9.js} +1 -1
- package/web/assets/assets-api-DOGSXB2A.js +1 -0
- package/web/assets/board-messages-DDVcGLQp.js +1 -0
- package/web/assets/board-projects-31Kch8Or.js +1 -0
- package/web/assets/bots-store-CgzHr2dN.js +1 -0
- package/web/assets/card-presentation-zU6WKfgu.js +2 -0
- package/web/assets/chat-api-DwR_1yAu.js +1 -0
- package/web/assets/chip-ZhnvFlFg.js +1 -0
- package/web/assets/{client-store-4G-xfNKc.js → client-store-Bv5fkPKC.js} +1 -1
- package/web/assets/{dist-DUSSw9eQ.js → collapsible-B-fc7n0u.js} +1 -1
- package/web/assets/command-DQJks9Cg.js +1 -0
- package/web/assets/{config-search-1BIdouae.js → config-search-1R0m2Dxn.js} +1 -1
- package/web/assets/corner-down-left-DalpwXuX.js +1 -0
- package/web/assets/{desktop-hosts-uMG7lFRY.js → desktop-hosts-DMZi66Qp.js} +2 -2
- package/web/assets/{dialog-D23yIdOZ.js → dialog-C6pJ93kY.js} +1 -1
- package/web/assets/{event-stream-BrDcABQx.js → event-stream-DujJnWl2.js} +1 -1
- package/web/assets/{events-BgEZwyTb.js → events-BrkEbuk_.js} +1 -1
- package/web/assets/folder-minus-BhfTnypT.js +1 -0
- package/web/assets/folder-paths-C8UCsQpi.js +1 -0
- package/web/assets/folder-plus-OPHZsJho.js +1 -0
- package/web/assets/{hosts-DljHKUSO.js → hosts-DCtZi0Vu.js} +1 -1
- package/web/assets/{http-DtkTCrZ4.js → http-Da7z8Zhw.js} +1 -1
- package/web/assets/http-response-DHqWBecB.js +1 -0
- package/web/assets/i18n-CYOV8NO5.js +1 -0
- package/web/assets/index-B446sLQy.js +2 -0
- package/web/assets/index-Fb-GT4ka.css +2 -0
- package/web/assets/list-todo-hpikYm6Q.js +1 -0
- package/web/assets/machine-messages-P6rRT5_Y.js +1 -0
- package/web/assets/machines-api-Cww34Att.js +1 -0
- package/web/assets/mcp-Cnn5t8jD.js +1 -0
- package/web/assets/mcp-DKnh78Cw.js +1 -0
- package/web/assets/{memory-api-DHLgFXzZ.js → memory-api-Bl58uVxS.js} +1 -1
- package/web/assets/mount-app-Dz4ohBAB.js +9 -0
- package/web/assets/{palette-navigation-BcPK8UF5.js → palette-navigation-DbWf-z0P.js} +1 -1
- package/web/assets/permission-rules-api-DKvt9Ijn.js +1 -0
- package/web/assets/{pick-system-directory-DS_-qn8W.js → pick-system-directory-BRdpqAVu.js} +1 -1
- package/web/assets/placements-DueXe1Zp.js +2 -0
- package/web/assets/popover-Bz5EGqVg.js +1 -0
- package/web/assets/public-CL4QGDNW.js +9 -0
- package/web/assets/public-C_3jqJ-h.js +2 -0
- package/web/assets/{public-B8mbf50i.js → public-WgIAq7m6.js} +1 -1
- package/web/assets/public-bzVRS_Ps.js +2 -0
- package/web/assets/{public-components-CMbKXCZU.js → public-components-CNnORHGF.js} +1 -1
- package/web/assets/public-diff-BiBx9iwa.js +1 -0
- package/web/assets/public-events-CUnBp7HK.js +1 -0
- package/web/assets/{public-flags-D8CxujmF.js → public-flags-ItOVvu41.js} +1 -1
- package/web/assets/{public-folder-dialog-Dnmn6DIU.js → public-folder-dialog-CooqqcGn.js} +1 -1
- package/web/assets/{public-greeting-Cs-sacVq.js → public-greeting-C9UC30cx.js} +1 -1
- package/web/assets/{public-session-DSLmbBcw.js → public-session-Cb2rGpEN.js} +1 -1
- package/web/assets/public-sidebar-DT8uieIs.js +1 -0
- package/web/assets/room-changes-DMfb5VNn.js +1 -0
- package/web/assets/{routes-DIeaqWVc.js → routes-BYsK6aeM.js} +1 -1
- package/web/assets/runtime-capabilities-CxyszNkG.js +1 -0
- package/web/assets/{runtime-capabilities-store-Y9MaywP8.js → runtime-capabilities-store-1qxTCxHV.js} +1 -1
- package/web/assets/{safe-mode-instance-CYIRMY5i.js → safe-mode-instance-DlkQOfml.js} +1 -1
- package/web/assets/safe-mode-sentinel-MZiIHVDW.js +1 -0
- package/web/assets/session-board-status-D_Tz3HJm.js +1 -0
- package/web/assets/{session-change-summary-api-Dp9vVPv_.js → session-change-summary-api-5OOAmNzo.js} +1 -1
- package/web/assets/{session-home-DqEkX19H.js → session-home-fCQ4eKhT.js} +1 -1
- package/web/assets/session-inspector-store-Dk8BXrxC.js +1 -0
- package/web/assets/session-questions-COno7uhe.js +1 -0
- package/web/assets/{session-scope-BJIZo6ty.js → session-scope-B13jJaQq.js} +1 -1
- package/web/assets/{session-tree-actions-B8GDKcGe.js → session-tree-actions-CS9J4Eer.js} +1 -1
- package/web/assets/session-tree-summary-_F4a4OX7.js +1 -0
- package/web/assets/session-web-preview-NBd9P7Kp.js +1 -0
- package/web/assets/{settings-navigation-C-nsUyew.js → settings-navigation-BEoTeOkB.js} +1 -1
- package/web/assets/{shortcuts-DRfz9B_B.js → shortcuts-CctXrljf.js} +1 -1
- package/web/assets/side-chat-context-oyi3ytlS.js +4 -0
- package/web/assets/{sidebar-DrzZKq2i.js → sidebar-B1PDwCql.js} +1 -1
- package/web/assets/{sidebar-store-BvZAgxJg.js → sidebar-store-D3ZnQB3e.js} +1 -1
- package/web/assets/{speech-session-DGkMojp3.js → speech-session-BwcPoFaK.js} +1 -1
- package/web/assets/{startup-queries-BjjeYiQ8.js → startup-queries-CNUOrW7A.js} +1 -1
- package/web/assets/subagent-view-store-BUvI8piR.js +1 -0
- package/web/assets/undo-2-ChaURM4t.js +1 -0
- package/web/assets/{use-i18n-8V6eRMcE.js → use-i18n-CbqEZb3r.js} +1 -1
- package/web/assets/use-open-bot-Dv66YK0n.js +1 -0
- package/web/assets/{use-studio-actions-BsdfCptK.js → use-studio-actions-GplOMwz9.js} +3 -3
- package/web/assets/useCatalogProjects-CtZwq4VJ.js +1 -0
- package/web/assets/{useMachines-BBeg2uOZ.js → useMachines-DHK5FVXC.js} +1 -1
- package/web/assets/useNewProjectPicker-Dum2z5eb.js +2 -0
- package/web/assets/useNow-Cm86munt.js +1 -0
- package/web/assets/{usePhoneShell-DRZTDDgZ.js → usePhoneShell-BDH8-EY7.js} +1 -1
- package/web/assets/useSessionListQuery-D8hWYbAp.js +2 -0
- package/web/assets/{useSessionRowActions-DBqnVodk.js → useSessionRowActions-D3-sAs-h.js} +1 -1
- package/web/assets/{useSidebarModel-DBH3JLQ1.js → useSidebarModel-CR0sLO4j.js} +1 -1
- package/web/assets/{workspace-folders-Bu3t-gEw.js → workspace-folders-DWoX16M_.js} +1 -1
- package/web/assets/workspace-order-store-CI03povy.js +1 -0
- package/web/index.html +2 -2
- package/web/assets/AssetsPage-B9lqKmXy.js +0 -1
- package/web/assets/BoardPage-BB_xAnQV.js +0 -3
- package/web/assets/BotAvatar-CNL-APwP.js +0 -1
- package/web/assets/ChatHistoryPage-BHsZFF4a.js +0 -1
- package/web/assets/ChatPage-C3NC9LNG.js +0 -553
- package/web/assets/ConfigPage-D3SyAsIs.js +0 -7
- package/web/assets/FocusRuntimeControls-DeSe12wJ.js +0 -2
- package/web/assets/ManageProjectsDialog-DVLX4ZBu.js +0 -1
- package/web/assets/McpPage-7wR_N0eS.js +0 -1
- package/web/assets/MemoryPage-DiO4GHc7.js +0 -2
- package/web/assets/NewFolderDialog-CjWMsY2Q.js +0 -1
- package/web/assets/PhoneTopBar-DuLewk2J.js +0 -1
- package/web/assets/PluginsPage-D0hAMgQ_.js +0 -1
- package/web/assets/SessionBrowserPane-y7gPArTV.js +0 -2
- package/web/assets/SessionContextPanel-Ckca3NrN.js +0 -2
- package/web/assets/SessionHome-CcjiU1fU.js +0 -1
- package/web/assets/SessionInspector-CNSyVYK6.js +0 -1
- package/web/assets/SessionShell-wOw-rTQD.js +0 -1
- package/web/assets/accordion-CiJMkjqX.js +0 -1
- package/web/assets/board-messages-3qT8nGsd.js +0 -1
- package/web/assets/board-projects-CeL6PPiY.js +0 -1
- package/web/assets/bots-store-CRGayU4z.js +0 -1
- package/web/assets/card-presentation-1oph2b8P.js +0 -2
- package/web/assets/chat-api-DQyHZl-V.js +0 -1
- package/web/assets/collapsible-Dcoy-qnz.js +0 -1
- package/web/assets/folder-paths-D0-7xV2n.js +0 -1
- package/web/assets/http-response-B2n7HFQ4.js +0 -1
- package/web/assets/i18n-B7QmqfvO.js +0 -1
- package/web/assets/index-79gEOxmD.js +0 -2
- package/web/assets/index-XwGsScbB.css +0 -2
- package/web/assets/machine-messages-Bd6JwiOe.js +0 -1
- package/web/assets/machines-api-Kg457H3y.js +0 -1
- package/web/assets/mcp-BcCwwm4p.js +0 -1
- package/web/assets/mcp-ZCMDzpoJ.js +0 -1
- package/web/assets/mount-app-BlaI2VZs.js +0 -9
- package/web/assets/permission-rules-api-BZn4yp-J.js +0 -1
- package/web/assets/placements-BMxzzGTX.js +0 -2
- package/web/assets/popover-C5U02alK.js +0 -1
- package/web/assets/public-Be05c5M9.js +0 -2
- package/web/assets/public-Bq1VrNr8.js +0 -2
- package/web/assets/public-DsjuTTt0.js +0 -3
- package/web/assets/public-diff-4sBkfeo8.js +0 -1
- package/web/assets/public-events-D2kHUhG2.js +0 -1
- package/web/assets/public-sidebar-UNJ9_fD1.js +0 -1
- package/web/assets/run-activity-CwfO0cui.js +0 -1
- package/web/assets/runtime-capabilities-CPDBo3tu.js +0 -1
- package/web/assets/safe-mode-sentinel-Bq9lNJoA.js +0 -1
- package/web/assets/session-board-status-D2lpFPiI.js +0 -1
- package/web/assets/session-inspector-store-D_mwa4K7.js +0 -1
- package/web/assets/session-organization-api-ibzfB8fg.js +0 -1
- package/web/assets/session-questions-94KACguh.js +0 -1
- package/web/assets/session-tree-summary-BTcPaCgY.js +0 -1
- package/web/assets/session-web-preview-guvsmkWE.js +0 -1
- package/web/assets/side-chat-context-CRQ33Q0D.js +0 -7
- package/web/assets/undo-2-C-xQ0UVT.js +0 -1
- package/web/assets/use-open-bot-BEhRmhru.js +0 -1
- package/web/assets/useCatalogProjects-DKjmAJ2x.js +0 -1
- package/web/assets/useNewProjectPicker-Cmw2SOhW.js +0 -2
- package/web/assets/useNow-D-gM4IXU.js +0 -1
- package/web/assets/useSessionListQuery-DtpEX8a5.js +0 -2
- package/web/assets/workspace-order-store-DmEFuNUL.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as e}from"./i18n-B7QmqfvO.js";e.addResourceBundle(`zh-CN`,`machines`,{title:`远程机器`,description:`让 Agent 直接在别的机器上工作,对方不用安装 Pisper。模型和 API Key 留在这台电脑上。`,addSsh:`添加 SSH 机器`,addNode:`让对方连过来`,unnamed:`未命名机器`,recheck:`重新测试 {name}`,remove:`移除 {name}`,removeDescription:`移除后,这台机器上的会话不能再运行工具。对方机器上的文件不受影响。`,"status.checking":`正在连接…`,"status.online":`在线`,"status.offline":`离线`,"status.unchecked":`未测试`,"status.reachable":`能连接`,"status.unreachable":`连不上`,"form.target":`地址`,"form.targetPlaceholder":`user@host 或 SSH 配置里的别名`,"form.port":`端口`,"form.name":`名称`,"form.namePlaceholder":`可选,比如“生产服务器”`,"form.defaultCwd":`默认目录`,"form.keyHint":`用这台电脑现有的 SSH 配置和密钥登录,Pisper 不保存密码和私钥。`,"form.test":`测试连接`,"form.testing":`正在连接…`,"form.testOk":`连接正常:{platform},家目录 {home}`,"form.save":`保存`,"form.cancel":`取消`,"pair.description":`适合没有 SSH 服务的机器:对方主动连到这台电脑,不用开放端口,也不用安装 Pisper,只需要 Node.js 20 以上。`,"pair.remoteOff":`远程访问还没打开,对方连不上这台电脑。请先打开上面的远程访问,再重新生成命令。`,"pair.openRemote":`去打开远程访问`,"pair.code":`配对码`,"pair.codeHint":`10 分钟内有效,只能用一次`,"pair.runThere":`在对方机器上依次运行:`,"pair.rootHint":`把目录换成允许操作的位置,可以写多个 --root。Agent 只能在这些目录里工作。`,"pair.brainPlaceholder":`<这台电脑的地址>`,"pair.rootPlaceholder":`<目录>`,"pair.copy":`复制命令`,"pair.copied":`已复制`,"pair.done":`完成`,"failure.refused":`连接被拒绝:对方可能没有运行 SSH 服务,或者端口不对。没有 SSH 服务的机器可以用“让对方连过来”。`,"failure.unreachable":`连不上对方机器:请检查地址、网络和防火墙。`,"failure.auth":`对方有 SSH 服务,但拒绝了登录。Pisper 只用密钥登录,请先把这台电脑的公钥加到对方的 authorized_keys。`,"failure.hostKey":`对方的主机指纹变了,为了安全已拒绝连接。如果确认机器重装过,请先更新这台电脑的 known_hosts。`,"failure.clientMissing":`这台电脑上找不到 ssh 命令,请先安装 OpenSSH 客户端。`,"failure.timeout":`对方机器太久没有响应。`,"failure.invalidTarget":`地址只能是 user@host、host 或 SSH 配置里的别名。`,"failure.invalidPort":`端口必须是 1 到 65535 之间的整数。`,"failure.folderMissing":`对方机器上没有这个目录。`,"failure.outsideRoots":`这个目录不在对方允许的范围内。`,"failure.offline":`这台机器现在不在线:请在对方机器上运行 npx pisper executor。`,"failure.notFound":`这台机器已被移除。`,"failure.generic":`和对方机器的连接失败。`}),e.addResourceBundle(`en-US`,`machines`,{title:`Remote machines`,description:`Let the agent work directly on another machine, without installing Pisper there. Models and API keys stay on this computer.`,addSsh:`Add SSH machine`,addNode:`Let a machine connect here`,unnamed:`Unnamed machine`,recheck:`Test {name} again`,remove:`Remove {name}`,removeDescription:`Sessions on this machine will no longer be able to run tools. Files on that machine are not affected.`,"status.checking":`Connecting…`,"status.online":`Online`,"status.offline":`Offline`,"status.unchecked":`Not tested`,"status.reachable":`Reachable`,"status.unreachable":`Unreachable`,"form.target":`Address`,"form.targetPlaceholder":`user@host or an SSH config alias`,"form.port":`Port`,"form.name":`Name`,"form.namePlaceholder":`Optional, like "Production"`,"form.defaultCwd":`Default folder`,"form.keyHint":`Signs in with this computer's existing SSH config and keys. Pisper stores no passwords or private keys.`,"form.test":`Test connection`,"form.testing":`Connecting…`,"form.testOk":`Connected: {platform}, home folder {home}`,"form.save":`Save`,"form.cancel":`Cancel`,"pair.description":`For machines without an SSH service: that machine connects to this computer, so no open port and no Pisper install. It only needs Node.js 20 or later.`,"pair.remoteOff":`Remote access is off, so that machine can't reach this computer. Turn on remote access above, then generate the commands again.`,"pair.openRemote":`Open remote access`,"pair.code":`Pairing code`,"pair.codeHint":`valid for 10 minutes, single use`,"pair.runThere":`Run these on that machine:`,"pair.rootHint":`Replace the folder with where work is allowed. You can pass --root several times. The agent can only work inside these folders.`,"pair.brainPlaceholder":`<this computer's address>`,"pair.rootPlaceholder":`<folder>`,"pair.copy":`Copy commands`,"pair.copied":`Copied`,"pair.done":`Done`,"failure.refused":`Connection refused: that machine may not be running an SSH service, or the port is wrong. For machines without SSH, use "Let a machine connect here".`,"failure.unreachable":`Can't reach that machine. Check the address, network and firewall.`,"failure.auth":`That machine has an SSH service but refused the sign-in. Pisper only signs in with keys, so add this computer's public key to authorized_keys there.`,"failure.hostKey":`That machine's host key changed, so the connection was refused for safety. If it was reinstalled, update known_hosts on this computer first.`,"failure.clientMissing":`The ssh command isn't available on this computer. Install the OpenSSH client first.`,"failure.timeout":`That machine took too long to respond.`,"failure.invalidTarget":`The address must be user@host, host, or an SSH config alias.`,"failure.invalidPort":`The port must be a whole number from 1 to 65535.`,"failure.folderMissing":`That folder doesn't exist on the other machine.`,"failure.outsideRoots":`That folder is outside what the other machine allows.`,"failure.offline":`This machine is offline. Run npx pisper executor on it.`,"failure.notFound":`This machine was removed.`,"failure.generic":`The connection to that machine failed.`});function t(e,t,n=``){switch(t){case`connection_refused`:return e(`machines:failure.refused`);case`unreachable`:return e(`machines:failure.unreachable`);case`auth_failed`:return e(`machines:failure.auth`);case`host_key_changed`:return e(`machines:failure.hostKey`);case`ssh_client_missing`:return e(`machines:failure.clientMissing`);case`ssh_timeout`:return e(`machines:failure.timeout`);case`invalid_target`:return e(`machines:failure.invalidTarget`);case`invalid_port`:return e(`machines:failure.invalidPort`);case`machine_folder_missing`:return e(`machines:failure.folderMissing`);case`machine_folder_outside_roots`:return e(`machines:failure.outsideRoots`);case`machine_offline`:return e(`machines:failure.offline`);case`machine_not_found`:return e(`machines:failure.notFound`);default:return n||e(`machines:failure.generic`)}}function n(e,t){return[`npx pisper executor pair --brain ${e.remote.endpoints[0]||t.brain} --fingerprint ${e.remote.fingerprint||t.fingerprint} --code ${e.code} --root ${t.root}`,`npx pisper executor`]}export{t as n,n as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./http-response-B2n7HFQ4.js";import{n as t}from"./http-DtkTCrZ4.js";function n(e){return typeof e==`string`?e:``}function r(e){return e&&typeof e==`object`?e:{}}function i(e){let t=r(e),i=t.lastCheck?r(t.lastCheck):null;return{id:n(t.id),kind:t.kind===`node`?`node`:`ssh`,name:n(t.name),target:n(t.target),port:typeof t.port==`number`?t.port:null,defaultCwd:n(t.defaultCwd),online:t.online===!0,lastCheck:i?{ok:i.ok===!0,at:n(i.at),code:n(i.code),platform:n(i.platform)}:null,roots:Array.isArray(t.roots)?t.roots.map(n).filter(Boolean):[]}}function a(e){let t=r(e);return{enabled:t.enabled===!0,endpoints:Array.isArray(t.endpoints)?t.endpoints.map(n).filter(Boolean):[],fingerprint:n(t.fingerprint)||null}}function o(e){return t(`/api/machines`,{signal:e,parse:e=>{let t=r(e);return{machines:(Array.isArray(t.machines)?t.machines:[]).map(i).filter(e=>e.id),remote:a(t.remote)}}})}function s(e){return t(`/api/machines/ssh`,{method:`POST`,data:e,parse:i})}function c(e){let t=r(e);return t.ok===!0?{ok:!0,platform:n(t.platform),home:n(t.home)}:{ok:!1,code:n(t.code),message:n(t.message)}}function l(e){return t(`/api/machines/ssh/test`,{method:`POST`,data:e,timeout:4e4,parse:c})}function u(e){return t(`/api/machines/${encodeURIComponent(e)}/check`,{method:`POST`,timeout:4e4,parse:c})}function d(e){return t(`/api/machines/${encodeURIComponent(e)}`,{method:`DELETE`})}function f(){return t(`/api/machines/pairing`,{method:`POST`,parse:e=>{let t=r(e),i=r(t.pairing);return{code:n(i.code),expiresAt:n(i.expiresAt),remote:a(t.remote)}}})}function p(e,i,a){return t(`/api/machines/${encodeURIComponent(e)}/folder`,{method:`POST`,data:{cwd:i},timeout:4e4,signal:a,parse:e=>n(r(e).cwd)})}function m(t){return t instanceof e?n(r(t.data).code):``}export{m as a,l as c,o as i,f as n,d as o,s as r,p as s,u as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=`Add MCP service`,t=`After deletion, tools from this server will be removed from subsequent agent runs.`,n=`Online`,r=`Connecting`,i=`Unauthorized`,a=`Disabled`,o=`Offline`,s=`Low risk`,c=`Medium risk`,l=`High risk`,u=`Transport`,d=`Latency`,f=`Last ping`,p=`Authentication`,m=`Configured environment variables`,h=`Connect`,g=`Connect MCP server`,_=`{count} request headers`,v=`Delete MCP server`,y=`Enter a Streamable HTTP URL, a stdio command, or JSON containing headers/env.`,b=`Executable`,x=`Local process`,S=`MCP connection test passed`,C=`MCP server added`,w=`MCP server deleted`,T=`MCP server disabled`,E=`MCP server enabled`,D=`MCP servers can expose tools that perform external actions. Connect only to servers you trust.`,O=`None`,k=`No server configured`,A=`Recent calls`,j=`Server address`,M=`Server configuration`,N=`Services`,P=`Test connection`,F=`This server exposes tools through a standard MCP transport. Enabled tools are registered in new agent runtimes.`,I=`Toggle tool {name}`,L=`Tool capabilities`,R=`Use “Add MCP service” to connect a Streamable HTTP or stdio MCP server.`,z=`Working directory`,B=`No tools available`,V=`No recent calls`,H=`Loading MCP status…`,U=`Couldn’t load MCP status`,W=`Reload`,G=`Succeeded`,K=`Failed`,q=`Pisper MCP server`,J=`Let local agents use Pisper's sessions, memory, and tasks through MCP.`,Y=`Allow local agents`,X=`Ready`,Z=`Could not start`,Q=`Pisper MCP server enabled`,$=`Pisper MCP server disabled`,ee=`Could not update MCP server`,te=`View connection config`,ne=`Connect to Pisper`,re=`Paste into a Streamable HTTP MCP client. Keep the token private.`,ie=`Loading connection config…`,ae=`Could not load connection config`,oe=`Copy config`,se=`Connection config copied`,ce=`Copy failed. Select and copy the config manually.`,le=`Rotate token`,ue=`Rotate the MCP token?`,de=`Clients need the new token to reconnect.`,fe=`Connection token rotated`,pe=`Could not rotate the connection token`,me=`Connect external MCP servers and hand their tools to agents. Connect only servers you trust.`,he=`Expand or collapse details for {name}`,ge=`{online}/{total} online · 24h error rate {rate}%`,_e=`{count} restricted`,ve=`Toggle MCP server {name}`,ye={addMCPService:e,afterDeletionToolsFromThisServerWillBeRemovedFromSubsequentAgentRuns:t,online:n,connecting:r,unauthorized:i,disabled:a,offline:o,lowRisk:s,mediumRisk:c,highRisk:l,transport:u,latency:d,lastPing:f,authentication:p,configuredEnvironmentVariables:m,connect:h,connectMCPServer:g,continue:`Continue`,countRequestHeaders:_,delete:`Delete`,deleteMCPServer:v,enterAStreamableHTTPURLAStdioCommandOrJSONContainingHeadersEnv:y,executable:b,localProcess:x,mcpConnectionTestPassed:S,mcpServerAdded:C,mcpServerDeleted:w,mcpServerDisabled:T,mcpServerEnabled:E,mcpServersCanExposeToolsThatPerformExternalActionsConnectOnlyToServersYouTrust:D,none:O,noServerConfigured:k,recentCalls:A,serverAddress:j,serverConfiguration:M,services:N,testConnection:P,thisServerExposesToolsThroughAStandardMCPTransportEnabledToolsAreRegisteredInNewAgentRuntimes:F,toggleToolName:I,toolCapabilities:L,emptyAddHint:R,workingDirectory:z,noToolsAvailable:B,noRecentCalls:V,loading:H,loadFailed:U,retry:W,callSucceeded:G,callFailed:K,hostTitle:q,hostDescription:J,hostEnabled:Y,hostReady:X,hostUnavailable:Z,hostEnabledNotice:Q,hostDisabledNotice:$,hostUpdateFailed:ee,hostShowConfig:te,hostConfigTitle:ne,hostConfigDescription:re,hostLoadingConfig:ie,hostLoadFailed:ae,hostCopyConfig:oe,hostCopied:se,hostCopyManually:ce,hostRotate:le,hostRotateTitle:ue,hostRotateWarning:de,hostRotatedNotice:fe,hostRotateFailed:pe,lede:me,toggleServiceDetails:he,serviceSummary:ge,toolSummary:_e,toggleServiceName:ve};export{e as addMCPService,t as afterDeletionToolsFromThisServerWillBeRemovedFromSubsequentAgentRuns,p as authentication,K as callFailed,G as callSucceeded,m as configuredEnvironmentVariables,h as connect,g as connectMCPServer,r as connecting,_ as countRequestHeaders,ye as default,v as deleteMCPServer,a as disabled,R as emptyAddHint,y as enterAStreamableHTTPURLAStdioCommandOrJSONContainingHeadersEnv,b as executable,l as highRisk,re as hostConfigDescription,ne as hostConfigTitle,se as hostCopied,oe as hostCopyConfig,ce as hostCopyManually,J as hostDescription,$ as hostDisabledNotice,Y as hostEnabled,Q as hostEnabledNotice,ae as hostLoadFailed,ie as hostLoadingConfig,X as hostReady,le as hostRotate,pe as hostRotateFailed,ue as hostRotateTitle,de as hostRotateWarning,fe as hostRotatedNotice,te as hostShowConfig,q as hostTitle,Z as hostUnavailable,ee as hostUpdateFailed,f as lastPing,d as latency,me as lede,U as loadFailed,H as loading,x as localProcess,s as lowRisk,S as mcpConnectionTestPassed,C as mcpServerAdded,w as mcpServerDeleted,T as mcpServerDisabled,E as mcpServerEnabled,D as mcpServersCanExposeToolsThatPerformExternalActionsConnectOnlyToServersYouTrust,c as mediumRisk,V as noRecentCalls,k as noServerConfigured,B as noToolsAvailable,O as none,o as offline,n as online,A as recentCalls,W as retry,j as serverAddress,M as serverConfiguration,ge as serviceSummary,N as services,P as testConnection,F as thisServerExposesToolsThroughAStandardMCPTransportEnabledToolsAreRegisteredInNewAgentRuntimes,he as toggleServiceDetails,ve as toggleServiceName,I as toggleToolName,L as toolCapabilities,_e as toolSummary,u as transport,i as unauthorized,z as workingDirectory};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=`添加 MCP 服务`,t=`删除后,该服务提供的工具会从后续 Agent 运行中移除。`,n=`在线`,r=`连接中`,i=`未授权`,a=`已禁用`,o=`离线`,s=`低风险`,c=`中风险`,l=`高风险`,u=`传输方式`,d=`延迟`,f=`最后探测`,p=`认证`,m=`已配置环境变量`,h=`连接`,g=`连接 MCP 服务`,_=`{count} 个请求头`,v=`删除 MCP 服务`,y=`输入 Streamable HTTP URL、stdio 命令,或包含 headers/env 的 JSON 配置。`,b=`可执行文件`,x=`本地进程`,S=`MCP 连接测试通过`,C=`MCP 服务已添加`,w=`MCP 服务已删除`,T=`MCP 服务已禁用`,E=`MCP 服务已启用`,D=`MCP 服务可以提供会执行外部操作的工具。仅连接你信任的服务。`,ee=`无`,O=`尚未配置服务`,k=`最近调用`,A=`服务地址`,j=`服务配置`,M=`服务`,N=`测试连接`,P=`该服务已通过标准 MCP transport 暴露工具,启用的工具会在新 Agent Runtime 中注册。`,F=`切换工具 {name}`,I=`工具能力`,L=`点“添加 MCP 服务”接入 Streamable HTTP 或 stdio MCP 服务。`,R=`工作目录`,z=`暂无可用工具`,te=`暂无调用记录`,B=`正在读取 MCP 状态…`,V=`MCP 状态读取失败`,H=`重新读取`,U=`成功`,W=`失败`,G=`Pisper 内置 MCP 服务`,K=`开启后,本机其他 Agent 可调用 Pisper 的会话、记忆和任务。`,q=`允许本机 Agent 连接`,J=`可连接`,Y=`未能启动`,X=`Pisper MCP 服务已开启`,Z=`Pisper MCP 服务已关闭`,Q=`更新 MCP 服务失败`,$=`查看连接配置`,ne=`连接 Pisper`,re=`将配置加入支持 Streamable HTTP 的 MCP 客户端。请保管好令牌。`,ie=`正在读取连接配置…`,ae=`读取连接配置失败`,oe=`复制配置`,se=`连接配置已复制`,ce=`复制失败,请手动选中配置复制`,le=`更换令牌`,ue=`更换 MCP 连接令牌?`,de=`已连接的 Agent 需要新令牌才能重新连接。`,fe=`连接令牌已更换`,pe=`更换连接令牌失败`,me=`连接外部 MCP 服务,把它们的工具交给代理;只连接你信任的服务。`,he=`展开或收起 {name} 的详情`,ge=`{online}/{total} 在线 · 24h 错误率 {rate}%`,_e=`{count} 个受限`,ve=`切换 MCP 服务 {name}`,ye={addMCPService:e,afterDeletionToolsFromThisServerWillBeRemovedFromSubsequentAgentRuns:t,online:n,connecting:r,unauthorized:i,disabled:a,offline:o,lowRisk:s,mediumRisk:c,highRisk:l,transport:u,latency:d,lastPing:f,authentication:p,configuredEnvironmentVariables:m,connect:h,connectMCPServer:g,continue:`继续`,countRequestHeaders:_,delete:`删除`,deleteMCPServer:v,enterAStreamableHTTPURLAStdioCommandOrJSONContainingHeadersEnv:y,executable:b,localProcess:x,mcpConnectionTestPassed:S,mcpServerAdded:C,mcpServerDeleted:w,mcpServerDisabled:T,mcpServerEnabled:E,mcpServersCanExposeToolsThatPerformExternalActionsConnectOnlyToServersYouTrust:D,none:`无`,noServerConfigured:O,recentCalls:k,serverAddress:A,serverConfiguration:j,services:M,testConnection:N,thisServerExposesToolsThroughAStandardMCPTransportEnabledToolsAreRegisteredInNewAgentRuntimes:P,toggleToolName:F,toolCapabilities:I,emptyAddHint:L,workingDirectory:R,noToolsAvailable:z,noRecentCalls:te,loading:B,loadFailed:V,retry:H,callSucceeded:U,callFailed:W,hostTitle:G,hostDescription:K,hostEnabled:q,hostReady:J,hostUnavailable:Y,hostEnabledNotice:X,hostDisabledNotice:Z,hostUpdateFailed:Q,hostShowConfig:$,hostConfigTitle:ne,hostConfigDescription:re,hostLoadingConfig:ie,hostLoadFailed:ae,hostCopyConfig:oe,hostCopied:se,hostCopyManually:ce,hostRotate:le,hostRotateTitle:ue,hostRotateWarning:de,hostRotatedNotice:fe,hostRotateFailed:pe,lede:me,toggleServiceDetails:he,serviceSummary:ge,toolSummary:_e,toggleServiceName:ve};export{e as addMCPService,t as afterDeletionToolsFromThisServerWillBeRemovedFromSubsequentAgentRuns,p as authentication,W as callFailed,U as callSucceeded,m as configuredEnvironmentVariables,h as connect,g as connectMCPServer,r as connecting,_ as countRequestHeaders,ye as default,v as deleteMCPServer,a as disabled,L as emptyAddHint,y as enterAStreamableHTTPURLAStdioCommandOrJSONContainingHeadersEnv,b as executable,l as highRisk,re as hostConfigDescription,ne as hostConfigTitle,se as hostCopied,oe as hostCopyConfig,ce as hostCopyManually,K as hostDescription,Z as hostDisabledNotice,q as hostEnabled,X as hostEnabledNotice,ae as hostLoadFailed,ie as hostLoadingConfig,J as hostReady,le as hostRotate,pe as hostRotateFailed,ue as hostRotateTitle,de as hostRotateWarning,fe as hostRotatedNotice,$ as hostShowConfig,G as hostTitle,Y as hostUnavailable,Q as hostUpdateFailed,f as lastPing,d as latency,me as lede,V as loadFailed,B as loading,x as localProcess,s as lowRisk,S as mcpConnectionTestPassed,C as mcpServerAdded,w as mcpServerDeleted,T as mcpServerDisabled,E as mcpServerEnabled,D as mcpServersCanExposeToolsThatPerformExternalActionsConnectOnlyToServersYouTrust,c as mediumRisk,te as noRecentCalls,O as noServerConfigured,z as noToolsAvailable,ee as none,o as offline,n as online,k as recentCalls,H as retry,A as serverAddress,j as serverConfiguration,ge as serviceSummary,M as services,N as testConnection,P as thisServerExposesToolsThroughAStandardMCPTransportEnabledToolsAreRegisteredInNewAgentRuntimes,he as toggleServiceDetails,ve as toggleServiceName,F as toggleToolName,I as toolCapabilities,_e as toolSummary,u as transport,i as unauthorized,R as workingDirectory};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/desktop-hosts-uMG7lFRY.js","assets/event-stream-BrDcABQx.js","assets/http-response-B2n7HFQ4.js","assets/i18n-B7QmqfvO.js","assets/vendor-router-CSN_DGvx.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/index-79gEOxmD.js","assets/index-XwGsScbB.css","assets/storage-DtvZ_lEu.js","assets/session-web-preview-guvsmkWE.js","assets/vendor-state-GkUciC5H.js","assets/web-preview-C7DdG9JP.js","assets/useNativeBrowser-C0j3zafh.js","assets/MobileNavigation-B2NKM8rj.js","assets/use-i18n-8V6eRMcE.js","assets/runtime-capabilities-store-Y9MaywP8.js","assets/api-Cm58F7OP.js","assets/abort-signal-f4JsiYKX.js","assets/http-DtkTCrZ4.js","assets/runtime-capabilities-CPDBo3tu.js","assets/chevron-left-BAtyp3_6.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/chevron-right-C3t2Rckj.js","assets/settings-navigation-C-nsUyew.js","assets/bell-BjONAtgH.js","assets/bot-B3TaBp_T.js","assets/info-DATxy0fb.js","assets/monitor-ORxecA9m.js","assets/refresh-cw-TbWxTY4K.js","assets/DesktopWindowControls-BQ0OvDZ8.js","assets/minus-BuutOHSj.js","assets/square-bHHVTT3G.js","assets/x-07u4-129.js","assets/FloatingWidgets-DjMCcqln.js","assets/routes-DIeaqWVc.js","assets/placements-BMxzzGTX.js","assets/useQuery-DfOU-27z.js","assets/query-DFQayLF5.js","assets/component-changes-Q9Bf64Ob.js","assets/session-scope-BJIZo6ty.js","assets/session-board-status-D2lpFPiI.js","assets/safe-mode-sentinel-Bq9lNJoA.js","assets/usePhoneShell-DRZTDDgZ.js","assets/use-mobile-C2tPBAza.js","assets/client-store-4G-xfNKc.js","assets/AppOverlays-BlJ0uL_P.js","assets/startup-queries-BjjeYiQ8.js","assets/mutation-b4pPvB7p.js","assets/circle-alert-DCChabnT.js","assets/loader-circle-BOwQzHB-.js","assets/message-square-SKjZyY3v.js","assets/plus-fQbSqB1n.js","assets/search-D0mqDaf_.js","assets/square-terminal-BVG6cUT1.js","assets/tag-CqkeJlBf.js","assets/utils-C8uzG5AZ.js","assets/vendor-ui-DvrYggeS.js","assets/kbd-CAufZTkl.js","assets/events-BgEZwyTb.js","assets/shortcuts-DRfz9B_B.js","assets/chat-api-DQyHZl-V.js","assets/format-DMJQzoZ7.js","assets/dialog-D23yIdOZ.js","assets/dist-BHkR6BLP.js","assets/dist-41X0pdUs.js","assets/dist-BsRXXcSL.js","assets/es2015-DTZdOI9P.js","assets/button-CCcCN8tE.js","assets/useOverlayFocusReturn-NkxBSSjb.js","assets/palette-navigation-BcPK8UF5.js","assets/blocks-Olsdp5Lp.js","assets/brain-qxhnKqYP.js","assets/calendar-clock-VIxTaqqy.js","assets/folder-open-FIShC5Qk.js","assets/list-T5PqlpS2.js","assets/plug-BsIeHRwC.js","assets/radio-tower-jGQwrFWB.js","assets/rotate-ccw-clock-CO6Bw-sF.js","assets/server-BgNvmqwJ.js","assets/settings-QX0oWnVK.js","assets/sparkles-S_eeuqn9.js","assets/workflow-Bg94dy8I.js","assets/AppDialog-BIc2uEZh.js","assets/label-CVWjEcfV.js","assets/input-CPw-zkYh.js","assets/WebDesktopPet-CWviMnct.js","assets/public-components-CMbKXCZU.js","assets/arrow-right-DqLOhpA2.js","assets/download-BCfIiuaL.js","assets/key-round-C29uZbsf.js","assets/config-search-1BIdouae.js","assets/BrandLogo-k3CvJjd4.js","assets/sidebar-DrzZKq2i.js","assets/pin-CU0FG0lI.js","assets/sidebar-store-BvZAgxJg.js","assets/useSessionListQuery-DtpEX8a5.js","assets/session-organization-api-ibzfB8fg.js","assets/session-questions-94KACguh.js","assets/session-workspaces-Brm-8lHh.js","assets/useNow-D-gM4IXU.js","assets/card-presentation-1oph2b8P.js","assets/useSidebarModel-DBH3JLQ1.js","assets/StatusGlyph-1KgitlUg.js","assets/useSessionRowActions-DBqnVodk.js","assets/ellipsis-CfGKfbq6.js","assets/dropdown-menu-Ds0gD8S8.js","assets/check-2vYc6QaP.js","assets/dist-DzGQ7sLi.js","assets/dist-BRjj4UeB.js","assets/dist-OB2r6Xsr.js","assets/dist-BaBySQmo.js","assets/session-home-DqEkX19H.js","assets/motion-DTR4ZVle.js","assets/BotAvatar-CNL-APwP.js","assets/shortcut-aria-jHRmld9z.js","assets/sidebar-commands-ZA1UOA_F.js","assets/public-sidebar-UNJ9_fD1.js","assets/use-open-bot-BEhRmhru.js","assets/WorkspacePicker-D6FLo7O1.js","assets/arrow-up-DST6-qVQ.js","assets/folder-DPM8D8cf.js","assets/triangle-alert-CE1q54ci.js","assets/PageState-Cz6vFMXv.js","assets/alert-DRIrgNI4.js","assets/workspace-folders-Bu3t-gEw.js","assets/textarea-DmATpOqT.js","assets/pick-system-directory-DS_-qn8W.js","assets/field-DoLEb0np.js","assets/separator-BPh_qxvc.js","assets/bots-store-CRGayU4z.js","assets/public-flags-D8CxujmF.js","assets/public-events-D2kHUhG2.js","assets/PhoneTopBar-DuLewk2J.js","assets/PhoneMenuButton-uG_T93KL.js","assets/public-Be05c5M9.js","assets/chevron-down-CxtxIjiP.js","assets/FocusRuntimeControls-DeSe12wJ.js","assets/braces-DQcXLGFF.js","assets/chevrons-up-down-C2sEPdAh.js","assets/message-square-text-C5MJw0FL.js","assets/pencil-U08v_vV9.js","assets/users-CCtFZzwl.js","assets/wrench-6pg6_bqI.js","assets/popover-C5U02alK.js","assets/slider-De8rWVNs.js","assets/dist-BS3ekNDj.js","assets/sheet-BTaIEX4w.js","assets/run-activity-CwfO0cui.js","assets/input-group-h8z63MzW.js","assets/model-display-kDwvtxrW.js","assets/workspace-order-store-DmEFuNUL.js","assets/useMachines-BBeg2uOZ.js","assets/machines-api-Kg457H3y.js","assets/useNewProjectPicker-Cmw2SOhW.js","assets/session-change-summary-api-Dp9vVPv_.js","assets/folder-paths-D0-7xV2n.js","assets/board-projects-CeL6PPiY.js","assets/square-pen-hYbjKh6A.js","assets/PhoneDrawer-utEXi-yp.js","assets/SidebarUpdateStatus-DrS7u_v_.js","assets/external-link-CEQqPcqc.js","assets/rocket-BgLSjoHY.js","assets/SettingsSidebar-CpAD5iSt.js","assets/arrow-left-B8oVrQ2S.js","assets/back-navigation-CK7X_5Bc.js","assets/ShortcutHelpDialog-C2QbSvui.js","assets/ShortcutKeys-Dl4Suwhz.js","assets/PageHeader-BN-qcxte.js","assets/more-pages-D_PnxLN0.js","assets/TerminalPanel-DuUtaPyf.js","assets/terminal-context-aIsIJPn8.js","assets/TaskTerminalView-BTCVpAHF.js","assets/AppSelect-DQYKUW5E.js","assets/select-Bbk9bmXO.js","assets/chevron-up-D_ZcXjqr.js","assets/dist-BiRPwy4W.js","assets/TaskTerminalView-BrP-ENHg.css","assets/MobileViewportStabilizer-uKI4Zp7f.js","assets/browser-notifications-CvHO-BlP.js","assets/session-tree-actions-B8GDKcGe.js","assets/session-tree-summary-BTcPaCgY.js","assets/BoardPage-BB_xAnQV.js","assets/arrow-down-CDGua-ue.js","assets/corner-down-right--hxi-Ihy.js","assets/useCatalogProjects-DKjmAJ2x.js","assets/rotate-ccw-C0v8V77_.js","assets/trash-2-CNrPOoPR.js","assets/brand-DIEc3fK8.js","assets/segmented-control-xkrEOP_d.js","assets/tooltip-D4MFbqcG.js","assets/esm-DCV8yILT.js","assets/new-task-DG4I6cda.js","assets/ChatPage-C3NC9LNG.js","assets/permission-rules-api-BZn4yp-J.js","assets/archive-ojKJT7Fp.js","assets/book-open-BuHHD9os.js","assets/circle-check-iEdCm3Pw.js","assets/image-plus-D7bzZog0.js","assets/GitDiffViewer-hHSTzUJk.js","assets/file-Bllajneu.js","assets/side-chat-context-CRQ33Q0D.js","assets/copy-DHmIFc52.js","assets/eye-uWAPXNzJ.js","assets/undo-2-C-xQ0UVT.js","assets/shield-alert-oZqX6MNu.js","assets/shield-check-Gvek4RJ7.js","assets/vendor-motion-DSW3wzXK.js","assets/MarkdownMessage-CktdHgKM.js","assets/vendor-markdown-plugins-CT5L3KA9.js","assets/vendor-shiki-runtime-DM7fm4Bl.js","assets/vendor-markdown-plugins-DEcVZfaU.css","assets/vendor-markdown-CT6Z4fh8.js","assets/route-context-DvWDul4T.js","assets/HoldToConfirmButton-BxdJ7icc.js","assets/card-C3A0b5KR.js","assets/collapsible-Dcoy-qnz.js","assets/dist-DUSSw9eQ.js","assets/FileAttachmentPreview-BdMgsecO.js","assets/tabs-DsgBuvJv.js","assets/git-branch-N7LGjtzt.js","assets/link-2-mgasYn21.js","assets/panel-right-BSUtqUd8.js","assets/paperclip-BCXrwYpb.js","assets/play-DNDjDNGn.js","assets/checkbox-BrEHgFV0.js","assets/progress-5odAz3B9.js","assets/switch-D_G8wFhs.js","assets/app-primitives-Drz_SjnR.js","assets/badge-CWB3lj2H.js","assets/session-list-BRMu9JWa.js","assets/public-B8mbf50i.js","assets/session-inspector-store-D_mwa4K7.js","assets/tool-labels-D-3gybP7.js","assets/speech-session-DGkMojp3.js","assets/web-preview-events-D7F0Z-Hy.js","assets/SessionShell-wOw-rTQD.js","assets/SessionHome-CcjiU1fU.js","assets/MorePage-xB2zBRtU.js","assets/app-window-CPNdvYNt.js","assets/image-BY_c3FYU.js","assets/monitor-smartphone-B1gIjItA.js","assets/ChatHistoryPage-BHsZFF4a.js","assets/pin-off-BpRu_vrC.js","assets/FeaturePage-C0bAQ4el.js","assets/AssetsPage-B9lqKmXy.js","assets/queryOptions-Dfvzj6n2.js","assets/mobile-runtime-recovery-tbTyacip.js","assets/ChannelsPage-DgzuzmFL.js","assets/message-circle-D-XrK6Ft.js","assets/send-Cj-W03w_.js","assets/public-DsjuTTt0.js","assets/accordion-CiJMkjqX.js","assets/SchedulesPage-Diethe4H.js","assets/ConfigPage-D3SyAsIs.js","assets/arrow-up-right-B6l8qFZz.js","assets/code-xml-BrUXrBax.js","assets/zap-DZHw5afO.js","assets/sliders-horizontal-Dryf1XyC.js","assets/machine-messages-Bd6JwiOe.js","assets/app-update-KLjtuCDT.js","assets/ChatAppearancePage-98Sa8ZQW.js","assets/PluginsPage-D0hAMgQ_.js","assets/earth-Ddy13fHh.js","assets/file-code-corner-BnE1ljT0.js","assets/package-BOmkLaKS.js","assets/save-CHBB52P8.js","assets/MemoryPage-DiO4GHc7.js","assets/memory-api-DHLgFXzZ.js","assets/McpPage-7wR_N0eS.js","assets/SkillsPage-CDoMtK-E.js","assets/public-Bq1VrNr8.js","assets/settings-2-CXJjXJS9.js","assets/use-studio-actions-BsdfCptK.js","assets/safe-mode-instance-CYIRMY5i.js","assets/PageFrame-DNwGZ-Dz.js","assets/WorkflowsPage-CHvyXwCg.js","assets/grip-vertical-B__LYT0s.js","assets/pause-CYWpPg1R.js","assets/vendor-xyflow-hxQFvEHK.js","assets/vendor-xyflow-DLioOiRN.css","assets/navigation-DkcKi1_5.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{a as t,d as n,f as r,h as i,i as a,l as o,o as s,p as c,r as l,s as u,t as d,u as f}from"./vendor-router-CSN_DGvx.js";import{t as p}from"./index-79gEOxmD.js";import{i as m,n as h,r as g,t as _}from"./vendor-react-DwNgTV1j.js";import{t as v}from"./vendor-ui-DvrYggeS.js";import{a as y,c as b,d as x,f as S,i as ee,l as C,n as w,o as te,r as T,s as ne,t as re,u as ie}from"./routes-DIeaqWVc.js";import{a as E,c as ae,d as oe,i as se,l as ce,o as le,r as D,s as O,t as ue,u as k}from"./i18n-B7QmqfvO.js";import{n as de,r as fe,t as A}from"./use-i18n-8V6eRMcE.js";import{t as j}from"./storage-DtvZ_lEu.js";import{n as pe,t as me}from"./useQuery-DfOU-27z.js";import{a as he,i as ge,n as _e,o as ve,r as ye,s as be,t as M}from"./startup-queries-BjjeYiQ8.js";import{i as xe}from"./http-response-B2n7HFQ4.js";import{i as Se,n as Ce}from"./http-DtkTCrZ4.js";import{t as we}from"./api-Cm58F7OP.js";import{a as Te,i as Ee,r as De}from"./runtime-capabilities-CPDBo3tu.js";import{t as Oe}from"./runtime-capabilities-store-Y9MaywP8.js";import{i as ke,n as Ae,r as je}from"./use-mobile-C2tPBAza.js";import{t as Me}from"./client-store-4G-xfNKc.js";import{t as Ne}from"./createLucideIcon-Cd-3GVxJ.js";import{t as Pe}from"./circle-check-iEdCm3Pw.js";import{a as Fe,i as Ie,n as Le,o as Re,t as ze}from"./settings-navigation-C-nsUyew.js";import{t as Be}from"./info-DATxy0fb.js";import{n as Ve,t as He}from"./list-T5PqlpS2.js";import{t as Ue}from"./search-D0mqDaf_.js";import{t as We}from"./settings-QX0oWnVK.js";import{t as Ge}from"./square-pen-hYbjKh6A.js";import{t as Ke}from"./triangle-alert-CE1q54ci.js";import{t as qe}from"./x-07u4-129.js";import{i as Je,n as Ye,r as Xe,t as Ze}from"./more-pages-D_PnxLN0.js";import{a as Qe}from"./dist-41X0pdUs.js";import{a as N,c as P,i as $e,l as et,o as F,r as tt,s as nt,t as rt}from"./dist-BsRXXcSL.js";import{r as it}from"./dist-BiRPwy4W.js";import{n as at}from"./dist-DzGQ7sLi.js";import{c as ot,i as st,o as ct}from"./es2015-DTZdOI9P.js";import{r as lt}from"./tooltip-D4MFbqcG.js";import{t as I}from"./utils-C8uzG5AZ.js";import{n as ut,t as dt}from"./button-CCcCN8tE.js";import{t as ft}from"./kbd-CAufZTkl.js";import{_ as pt,h as mt,n as ht,t as gt,v as _t,y as vt}from"./events-BgEZwyTb.js";import{a as yt,c as L,i as bt,n as xt,r as R,s as z}from"./shortcuts-DRfz9B_B.js";import{t as B}from"./sidebar-store-BvZAgxJg.js";import{a as St,i as Ct,l as V,o as H,s as U,t as wt}from"./dialog-D23yIdOZ.js";import{n as Tt}from"./PageState-Cz6vFMXv.js";import{i as Et,t as Dt}from"./back-navigation-CK7X_5Bc.js";import{n as Ot,r as kt,t as At}from"./alert-DRIrgNI4.js";import{t as jt}from"./route-context-DvWDul4T.js";import{t as Mt}from"./new-task-DG4I6cda.js";import{t as W}from"./shortcut-aria-jHRmld9z.js";import{n as Nt}from"./sidebar-commands-ZA1UOA_F.js";import{r as Pt}from"./app-primitives-Drz_SjnR.js";import{t as Ft}from"./public-B8mbf50i.js";import{t as It}from"./BrandLogo-k3CvJjd4.js";import{a as G}from"./web-preview-C7DdG9JP.js";import{r as K}from"./web-preview-events-D7F0Z-Hy.js";import{C as q,S as Lt,_ as J,a as Rt,b as zt,c as Bt,d as Vt,f as Ht,h as Y,m as Ut,n as Wt,p as Gt,r as Kt,u as qt}from"./app-update-KLjtuCDT.js";import{n as Jt,t as Yt}from"./navigation-DkcKi1_5.js";var X=e(m());function Xt({i18n:e,defaultNS:t,children:n}){let r=(0,X.useMemo)(()=>({i18n:e,defaultNS:t}),[e,t]);return(0,X.createElement)(fe.Provider,{value:r},n)}var Zt=Ne(`panel-left-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),Qt=Ne(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),$t=e(h(),1),Z=g(),en=Object.defineProperty,Q=(e,t)=>en(e,`name`,{value:t,configurable:!0}),tn=`ToastProvider`,[nn,rn,an]=at(`Toast`),[on,sn]=nt(`Toast`,[an]),[cn,ln]=on(tn),un=Q(e=>{let{__scopeToast:t,label:n=`Notification`,duration:r=5e3,swipeDirection:i=`right`,swipeThreshold:a=50,announcerContainer:o,children:s}=e,[c,l]=X.useState(null),[u,d]=X.useState(0),f=X.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${tn}\`. Expected non-empty \`string\`.`),(0,Z.jsx)(nn.Provider,{scope:t,children:(0,Z.jsx)(cn,{scope:t,label:n,duration:r,swipeDirection:i,swipeThreshold:a,toastCount:u,viewport:c,onViewportChange:l,onToastAdd:X.useCallback(()=>d(e=>e+1),[]),onToastRemove:X.useCallback(()=>d(e=>e-1),[]),isClosePausedRef:f,announcerContainer:o,children:s})})},`ToastProvider`),dn=`ToastViewport`,fn=[`F8`],pn=`toast.viewportPause`,mn=`toast.viewportResume`,hn=X.forwardRef(Q(function(e,t){let{__scopeToast:n,hotkey:r=fn,label:i=`Notifications ({hotkey})`,...a}=e,o=ln(dn,n),s=rn(n),c=X.useRef(null),l=X.useRef(null),u=X.useRef(null),d=X.useRef(null),f=Qe(t,d,o.onViewportChange),p=r.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),m=o.toastCount>0;X.useEffect(()=>{let e=Q(e=>{r.length!==0&&r.every(t=>e[t]||e.code===t)&&d.current?.focus()},`handleKeyDown`);return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[r]),X.useEffect(()=>{let e=c.current,t=d.current;if(m&&e&&t){let n=Q(()=>{if(!o.isClosePausedRef.current){let e=new CustomEvent(pn);t.dispatchEvent(e),o.isClosePausedRef.current=!0}},`handlePause`),r=Q(()=>{if(o.isClosePausedRef.current){let e=new CustomEvent(mn);t.dispatchEvent(e),o.isClosePausedRef.current=!1}},`handleResume`),i=Q(t=>{e.contains(t.relatedTarget)||r()},`handleFocusOutResume`),a=Q(()=>{e.contains(document.activeElement)||r()},`handlePointerLeaveResume`);return e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,i),e.addEventListener(`pointermove`,n),e.addEventListener(`pointerleave`,a),window.addEventListener(`blur`,n),window.addEventListener(`focus`,r),()=>{e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,i),e.removeEventListener(`pointermove`,n),e.removeEventListener(`pointerleave`,a),window.removeEventListener(`blur`,n),window.removeEventListener(`focus`,r)}}},[m,o.isClosePausedRef]);let h=X.useCallback(({tabbingDirection:e})=>{let t=s().map(t=>{let n=t.ref.current,r=[n,...zn(n)];return e===`forwards`?r:r.reverse()});return(e===`forwards`?t.reverse():t).flat()},[s]);return X.useEffect(()=>{let e=d.current;if(e){let t=Q(t=>{let n=t.altKey||t.ctrlKey||t.metaKey;if(t.key===`Tab`&&!n){let n=document.activeElement,r=t.shiftKey;if(t.target===e&&r){l.current?.focus();return}let i=h({tabbingDirection:r?`backwards`:`forwards`}),a=i.findIndex(e=>e===n);Bn(i.slice(a+1))?t.preventDefault():r?l.current?.focus():u.current?.focus()}},`handleKeyDown`);return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)}},[s,h]),(0,Z.jsxs)(ct,{ref:c,role:`region`,"aria-label":i.replace(`{hotkey}`,p),tabIndex:-1,style:{pointerEvents:m?void 0:`none`},children:[m&&(0,Z.jsx)(_n,{ref:l,onFocusFromOutsideViewport:()=>{Bn(h({tabbingDirection:`forwards`}))}}),(0,Z.jsx)(nn.Slot,{scope:n,children:(0,Z.jsx)(P.ol,{tabIndex:-1,...a,ref:f})}),m&&(0,Z.jsx)(_n,{ref:u,onFocusFromOutsideViewport:()=>{Bn(h({tabbingDirection:`backwards`}))}})]})},`ToastViewport`)),gn=`ToastFocusProxy`,_n=X.forwardRef(Q(function(e,t){let{__scopeToast:n,onFocusFromOutsideViewport:r,...i}=e,a=ln(gn,n);return(0,Z.jsx)(it,{tabIndex:0,...i,ref:t,style:{position:`fixed`},onFocus:e=>{let t=e.relatedTarget;a.viewport?.contains(t)||r()}})},`ToastFocusProxy`)),vn=`Toast`,yn=`toast.swipeStart`,bn=`toast.swipeMove`,xn=`toast.swipeCancel`,Sn=`toast.swipeEnd`,Cn=X.forwardRef(Q(function(e,t){let{forceMount:n,open:r,defaultOpen:i,onOpenChange:a,...o}=e,[s,c]=$e({prop:r,defaultProp:i??!0,onChange:a,caller:vn});return(0,Z.jsx)(tt,{present:n||s,children:(0,Z.jsx)(En,{open:s,...o,ref:t,onClose:()=>c(!1),onPause:rt(e.onPause),onResume:rt(e.onResume),onSwipeStart:F(e.onSwipeStart,e=>{e.currentTarget.setAttribute(`data-swipe`,`start`)}),onSwipeMove:F(e.onSwipeMove,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`move`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-y`,`${n}px`)}),onSwipeCancel:F(e.onSwipeCancel,e=>{e.currentTarget.setAttribute(`data-swipe`,`cancel`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-y`)}),onSwipeEnd:F(e.onSwipeEnd,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`end`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-y`,`${n}px`),c(!1)})})})},`Toast`)),[wn,Tn]=on(vn,{onClose(){}}),En=X.forwardRef(Q(function(e,t){let{__scopeToast:n,type:r=`foreground`,duration:i,open:a,onClose:o,onEscapeKeyDown:s,onPause:c,onResume:l,onSwipeStart:u,onSwipeMove:d,onSwipeCancel:f,onSwipeEnd:p,...m}=e,h=ln(vn,n),g=rn(n),[_,v]=X.useState(null),y=Qe(t,v),b=X.useRef(null),x=X.useRef(null),S=i||h.duration,ee=X.useRef(0),C=X.useRef(S),w=X.useRef(0),{onToastAdd:te,onToastRemove:T}=h,ne=rt(()=>{_?.contains(document.activeElement)&&h.viewport?.focus(),o()}),re=X.useCallback(e=>{!e||e===1/0||(window.clearTimeout(w.current),ee.current=new Date().getTime(),w.current=window.setTimeout(ne,e))},[ne]);X.useEffect(()=>{let e=h.viewport;if(e){let t=Q(()=>{re(C.current),l?.()},`handleResume`),n=Q(()=>{let e=new Date().getTime()-ee.current;C.current-=e,window.clearTimeout(w.current),c?.()},`handlePause`);return e.addEventListener(pn,n),e.addEventListener(mn,t),()=>{e.removeEventListener(pn,n),e.removeEventListener(mn,t)}}},[h.viewport,S,c,l,re]),X.useEffect(()=>{a&&!h.isClosePausedRef.current&&re(S)},[a,S,h.isClosePausedRef,re]),X.useEffect(()=>()=>{window.clearTimeout(w.current)},[]),X.useEffect(()=>(te(),()=>T()),[te,T]);let ie=X.useMemo(()=>_?Pn(_):null,[_]);return h.viewport?(0,Z.jsxs)(Z.Fragment,{children:[ie&&(0,Z.jsx)(Dn,{__scopeToast:n,role:`status`,"aria-live":r===`foreground`?`assertive`:`polite`,children:ie}),(0,Z.jsx)(wn,{scope:n,onClose:ne,children:$t.createPortal((0,Z.jsx)(nn.ItemSlot,{scope:n,children:(0,Z.jsx)(ot,{asChild:!0,onEscapeKeyDown:F(s,e=>{g().some(t=>t.ref.current?.contains(e.target))||ne()}),children:(0,Z.jsx)(P.li,{tabIndex:0,"data-state":a?`open`:`closed`,"data-swipe-direction":h.swipeDirection,...m,ref:y,style:{userSelect:`none`,touchAction:`none`,...e.style},onKeyDown:F(e.onKeyDown,e=>{e.key===`Escape`&&(s?.(e.nativeEvent),e.nativeEvent.defaultPrevented||ne())}),onPointerDown:F(e.onPointerDown,e=>{e.button===0&&(b.current={x:e.clientX,y:e.clientY})}),onPointerMove:F(e.onPointerMove,e=>{if(!b.current)return;let t=e.clientX-b.current.x,n=e.clientY-b.current.y,r=!!x.current,i=[`left`,`right`].includes(h.swipeDirection),a=[`left`,`up`].includes(h.swipeDirection)?Math.min:Math.max,o=i?a(0,t):0,s=i?0:a(0,n),c=e.pointerType===`touch`?10:2,l={x:o,y:s},f={originalEvent:e,delta:l};r?(x.current=l,Fn(bn,d,f,{discrete:!1})):In(l,h.swipeDirection,c)?(x.current=l,Fn(yn,u,f,{discrete:!1}),e.target.setPointerCapture(e.pointerId)):(Math.abs(t)>c||Math.abs(n)>c)&&(b.current=null)}),onPointerUp:F(e.onPointerUp,e=>{let t=x.current,n=e.target;if(n.hasPointerCapture(e.pointerId)&&n.releasePointerCapture(e.pointerId),x.current=null,b.current=null,t){let n=e.currentTarget,r={originalEvent:e,delta:t};In(t,h.swipeDirection,h.swipeThreshold)?Fn(Sn,p,r,{discrete:!0}):Fn(xn,f,r,{discrete:!0}),n.addEventListener(`click`,e=>e.preventDefault(),{once:!0})}})})})}),h.viewport)})]}):null},`ToastImpl`)),Dn=Q(e=>{let{__scopeToast:t,children:n,...r}=e,i=ln(vn,t),[a,o]=X.useState(!1),[s,c]=X.useState(!1);return Ln(()=>o(!0)),X.useEffect(()=>{let e=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(e)},[]),s?null:(0,Z.jsx)(st,{asChild:!0,container:i.announcerContainer||void 0,children:(0,Z.jsx)(it,{...r,children:a&&(0,Z.jsxs)(Z.Fragment,{children:[i.label,` `,n]})})})},`ToastAnnounce`),On=X.forwardRef(Q(function(e,t){let{__scopeToast:n,...r}=e;return(0,Z.jsx)(P.div,{...r,ref:t})},`ToastDescription`)),kn=`ToastAction`,An=X.forwardRef(Q(function(e,t){let{altText:n,...r}=e;return n.trim()?(0,Z.jsx)(Nn,{altText:n,asChild:!0,children:(0,Z.jsx)(Mn,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${kn}\`. Expected non-empty \`string\`.`),null)},`ToastAction`)),jn=`ToastClose`,Mn=X.forwardRef(Q(function(e,t){let{__scopeToast:n,...r}=e,i=Tn(jn,n);return(0,Z.jsx)(Nn,{asChild:!0,children:(0,Z.jsx)(P.button,{type:`button`,...r,ref:t,onClick:F(e.onClick,i.onClose)})})},`ToastClose`)),Nn=X.forwardRef(Q(function(e,t){let{__scopeToast:n,altText:r,...i}=e;return(0,Z.jsx)(P.div,{"data-radix-toast-announce-exclude":``,"data-radix-toast-announce-alt":r||void 0,...i,ref:t})},`ToastAnnounceExclude`));function Pn(e){let t=[];return Array.from(e.childNodes).forEach(e=>{if(e.nodeType===e.TEXT_NODE&&e.textContent&&t.push(e.textContent),Rn(e)){let n=e.ariaHidden||e.hidden||e.style.display===`none`,r=e.dataset.radixToastAnnounceExclude===``;if(!n){if(r){let n=e.dataset.radixToastAnnounceAlt;n&&t.push(n)}else t.push(...Pn(e))}}}),t}Q(Pn,`getAnnounceTextContent`);function Fn(e,t,n,{discrete:r}){let i=n.originalEvent.currentTarget,a=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?et(i,a):i.dispatchEvent(a)}Q(Fn,`handleAndDispatchCustomEvent`);var In=Q((e,t,n=0)=>{let r=Math.abs(e.x),i=Math.abs(e.y),a=r>i;return t===`left`||t===`right`?a&&r>n:!a&&i>n},`isDeltaInDirection`);function Ln(e=()=>{}){let t=rt(e);N(()=>{let e=0,n=0;return e=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(n)}},[t])}Q(Ln,`useNextFrame`);function Rn(e){return e.nodeType===e.ELEMENT_NODE}Q(Rn,`isHTMLElement`);function zn(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:Q(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}Q(zn,`getTabbableCandidates`);function Bn(e){let t=document.activeElement;return e.some(e=>e===t||(e.focus(),document.activeElement!==t))}Q(Bn,`focusFirst`);var Vn=un,Hn=hn,Un=Cn,Wn=On,Gn=An,Kn=Mn,qn=_();function Jn({children:e}){let{i18n:t}=de(),n=oe(t.resolvedLanguage)?t.resolvedLanguage:ue;return(0,X.useEffect)(()=>{document.documentElement.lang=n;try{p.setItem(j.language,n)}catch{}window.pisperDesktop?.setLanguage?.(n)},[n]),e}function Yn({children:e}){return(0,Z.jsx)(Xt,{i18n:k,children:(0,Z.jsx)(Jn,{children:e})})}function Xn({children:e}){return(0,X.useEffect)(()=>ye(window),[]),(0,Z.jsx)(pe,{client:he,children:(0,Z.jsx)(Yn,{children:(0,Z.jsx)(lt,{delayDuration:200,children:e})})})}function Zn(e){return typeof e==`string`?e:``}function Qn(e,t){return Array.isArray(e)?e.map(e=>Zn(e?.[t])).filter(Boolean):[]}function $n(e){let t=e&&typeof e==`object`?e:{},n=t.failure;return{state:t.state===`ready`||t.state===`failed`?t.state:`pending`,failure:n?{code:Zn(n.code),message:Zn(n.message)}:null,setAsideFiles:Qn(t.setAside,`file`),failedServices:Qn(t.failed,`service`)}}async function er(e){try{return await Ce(`/api/startup-status`,{signal:e,parse:$n})}catch(e){if(e instanceof xe&&e.status===404)return null;throw e}}var tr=1e3,nr=6e5;function rr(){let{t:e}=A(),[t,n]=(0,X.useState)(null),[r,i]=(0,X.useState)(!1);if((0,X.useEffect)(()=>{let e=new AbortController,t=Date.now()+nr,r,i=async()=>{let a=!1;try{let t=await er(e.signal);if(e.signal.aborted)return;t&&n(t),a=!t||t.state!==`pending`}catch{}!a&&!e.signal.aborted&&Date.now()<t&&(r=window.setTimeout(()=>void i(),tr))};return i(),()=>{e.abort(),window.clearTimeout(r)}},[]),t?.state===`failed`){let n=t.failure;return(0,Z.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-background`,children:(0,Z.jsx)(Tt,{kind:`error`,title:e(`common:runtimeStartup.failedTitle`),description:(0,Z.jsxs)(Z.Fragment,{children:[e(`common:runtimeStartup.failedHint`),n&&(0,Z.jsx)(`code`,{className:`mt-2 block font-mono select-text`,children:n.message.startsWith(n.code)?n.message:`${n.code}: ${n.message}`})]})})})}if(r||!t)return null;let{setAsideFiles:a,failedServices:o}=t;return!a.length&&!o.length?null:(0,Z.jsxs)(At,{className:`fixed right-4 bottom-[calc(1rem+var(--pisper-safe-area-bottom,0px))] z-50 w-[min(26rem,calc(100vw-2rem))] shadow-lg`,"data-runtime-startup-notice":!0,children:[(0,Z.jsx)(kt,{children:e(`common:runtimeStartup.noticeTitle`)}),(0,Z.jsxs)(Ot,{className:`grid gap-1`,children:[a.length>0&&(0,Z.jsx)(`p`,{children:e(`common:runtimeStartup.setAside`,{files:a.join(`、`)})}),o.length>0&&(0,Z.jsx)(`p`,{children:e(`common:runtimeStartup.failedServices`,{services:o.join(`、`)})}),(0,Z.jsx)(dt,{type:`button`,variant:`outline`,className:`mt-1 justify-self-end`,onClick:()=>i(!0),children:e(`common:runtimeStartup.dismiss`)})]})]})}function ir(){return[...document.querySelectorAll(`[role="dialog"], [role="alertdialog"], [role="menu"], [data-slot="popover-content"]`)].some(e=>e.dataset.state!==`closed`&&e.getAttribute(`aria-hidden`)!==`true`&&e.getClientRects().length>0)}function ar({onRouteBack:e}){let t=(0,X.useRef)(e);return t.current=e,(0,X.useEffect)(()=>{let e=new WeakSet,n=t=>{t.key===`Escape`&&ir()&&e.add(t)},r=t=>{t.key!==`Escape`||t.defaultPrevented||t.isComposing||e.has(t)||Dt.dismiss()&&t.preventDefault()},i=()=>{let e=ir(),n=new KeyboardEvent(`keydown`,{key:`Escape`,bubbles:!0,cancelable:!0});return Et(n),(document.activeElement||document.body).dispatchEvent(n),e||n.defaultPrevented?!0:t.current?.()??!1},a=window;return a.__pisperRequestBack=i,window.addEventListener(`keydown`,n,!0),window.addEventListener(`keydown`,r),()=>{a.__pisperRequestBack===i&&delete a.__pisperRequestBack,window.removeEventListener(`keydown`,n,!0),window.removeEventListener(`keydown`,r)}},[]),null}function or(){let e=null,t=!1;return{register(n){return e=n,t&&(t=!1,n()),()=>{e===n&&(e=null)}},invoke(){if(e)return e();t=!0},clear(){e=null}}}Object.freeze([`session`,`board`,`more`,`settings`]);var sr=Object.freeze({board:`board`,more:`more`,settings:`config`});function cr(e,t){return t?`settings`:e===`session`||e===`chat`?`session`:e===`board`?`board`:e===`components`||e===`more`||e===`config`||Xe.has(e)?`more`:null}function lr({location:e,navigation:t}){return t.state!==`idle`&&t.location?.pathname||e.pathname}function ur({location:e,navigation:t}){return C(lr({location:e,navigation:t}))===`session`?null:t.state!==`idle`&&C(e.pathname)===`session`?{to:e.pathname+(e.search||``),replace:!0,state:e.state}:{to:`/`}}var dr=/^\/components\/([^/]+)\/?$/;function fr(e,t,n,{phone:r=!1,homeEntry:i=!1,canGoBack:a=!1}={}){return e===`session`?i||t===`/`||t===``?null:a?-1:null:e===`components`&&dr.test(t)?`/components`:r&&n&&/^\/config\/[^/]+/.test(t)?ee:cr(e,n)===`more`&&e!==`more`?`/more`:`/`}var pr=`flex w-full min-w-0 items-center gap-2.5 rounded-[var(--r-md)] px-2.5 text-base text-content transition-colors duration-(--d-fast) hover:bg-surface-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,mr=`grid size-8 flex-none place-items-center rounded-[var(--r-sm)] text-content-secondary transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus pointer-coarse:size-11`,hr=`grid size-10 place-items-center rounded-[var(--r-md)] text-content-secondary transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus pointer-coarse:size-11`,gr=`(max-width: 899px)`;function _r(e){let t=e.takeover,n=B(e=>e.collapsed)&&!t,r=B(e=>e.peeking),i=B(e=>e.setPeeking),a=(0,X.useRef)(null),o=(0,X.useRef)(null),s=ke(gr),c=B(e=>e.enterNarrowRail),l=B(e=>e.leaveNarrowRail);(0,X.useEffect)(()=>{s?c():l()},[s,c,l]);let u=(0,X.useRef)(!1);return(0,X.useLayoutEffect)(()=>{if(!u.current)return;let e=document.activeElement;e&&e!==document.body&&o.current?.contains(e)||o.current?.querySelector(`[data-sidebar-toggle]`)?.focus()},[n]),(0,X.useEffect)(()=>{t&&r&&i(!1)},[r,i,t]),(0,X.useEffect)(()=>{if(!n||!r)return;let e=e=>e instanceof Element&&!!(a.current?.contains(e)||e.closest(`[role="menu"], [role="dialog"], [data-radix-popper-content-wrapper]`)),t=t=>{e(t.target)||i(!1)},o=t=>{e(t.target)||i(!1)},s=t=>{t.key!==`Escape`||t.defaultPrevented||!e(t.target)||(t.preventDefault(),i(!1))};return document.addEventListener(`focusin`,t),document.addEventListener(`pointerdown`,o),document.addEventListener(`keydown`,s),()=>{document.removeEventListener(`focusin`,t),document.removeEventListener(`pointerdown`,o),document.removeEventListener(`keydown`,s)}},[n,r,i]),(0,Z.jsxs)(`div`,{ref:o,"data-shell-sidebar":t?`settings`:n?`rail`:`expanded`,"data-focus-region":`sidebar`,onFocus:()=>{u.current=!0},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(u.current=!1)},className:I(`relative z-20 flex h-full flex-none flex-col bg-sidebar transition-[width] duration-(--d-base) ease-out motion-reduce:transition-none`,n?`w-[60px]`:`w-[268px]`,`dark:border-r dark:border-stroke-soft`),children:[t??(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col animate-in fade-in duration-(--d-fast) motion-reduce:animate-none`,children:n?(0,Z.jsx)(xr,{...e}):(0,Z.jsx)(br,{...e})},n?`rail`:`expanded`),n&&r&&(0,Z.jsx)(`div`,{ref:a,"data-shell-sidebar-peek":!0,className:`absolute inset-y-0 left-0 z-40 flex w-[268px] flex-col bg-sidebar shadow-float`,children:(0,Z.jsx)(br,{...e,peek:!0})})]})}var vr={newTask:`primaryAction`,search:`commandPalette`,board:`openBoard`,features:`openMore`,settings:`openSettings`};function yr(){let{t:e}=A();return{newTask:e(`navigation:shell.newTask`),search:e(`navigation:sidebar.search`),board:e(`navigation:sidebar.allAgents`),features:e(`navigation:sidebar.features`),settings:e(`navigation:navigation.settings`)}}function br({active:e,onNewTask:t,onSearch:n,onOpenBoard:r,onOpenFeatures:i,onOpenSettings:a,content:o,update:s,peek:c=!1}){let{t:l}=A(),u=yr(),d=B(e=>e.toggleCollapsed),f=B(e=>e.setPeeking),p=L(e=>e.bindings),m=p.toggleSidebar,h=z(`toggleSidebar`),g={newTask:z(`primaryAction`),search:z(`commandPalette`),board:z(`openBoard`),features:z(`openMore`),settings:z(`openSettings`)},_=l(c?`navigation:sidebar.expand`:`navigation:sidebar.collapse`),v=(t,n,r)=>{let i=t===`board`?u.board:t===`features`?u.features:u[t],a=g[t],o=t===e;return(0,Z.jsxs)(`button`,{type:`button`,"data-sidebar-entry":t,"aria-current":o?`page`:void 0,"aria-keyshortcuts":W(p[vr[t]]),className:I(pr,`group/entry h-9 pointer-coarse:h-11`,o&&`bg-surface-active font-medium hover:bg-surface-active`),onClick:r,children:[(0,Z.jsx)(n,{className:`size-[18px] flex-none text-content-secondary`,strokeWidth:1.75,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:i}),a&&(0,Z.jsx)(ft,{"aria-hidden":`true`,className:`border-transparent bg-transparent text-content-faint opacity-0 shadow-none transition-opacity duration-(--d-fast) group-hover/entry:opacity-100 group-focus-visible/entry:opacity-100 pointer-coarse:hidden`,children:a})]})};return(0,Z.jsxs)(`nav`,{"aria-label":l(`navigation:sidebar.label`),className:`flex min-h-0 flex-1 flex-col`,children:[(0,Z.jsxs)(`div`,{"data-window-drag-region":!0,className:`flex h-[52px] flex-none items-center gap-2 pr-2.5 pl-4`,children:[(0,Z.jsx)(It,{size:22}),(0,Z.jsx)(`span`,{className:`text-[15px] font-semibold tracking-[-.01em] text-content`,children:`Pisper`}),(0,Z.jsx)(`span`,{className:`flex-1`}),(0,Z.jsx)(`button`,{type:`button`,"data-sidebar-toggle":c?void 0:`collapse`,"aria-expanded":!c||void 0,className:mr,"aria-label":_,"aria-keyshortcuts":c?void 0:W(m),title:!c&&h?`${_} (${h})`:_,onClick:()=>c?f(!1):d(),children:c?(0,Z.jsx)(Qt,{className:`size-[18px]`,strokeWidth:1.75,"aria-hidden":`true`}):(0,Z.jsx)(Zt,{className:`size-[18px]`,strokeWidth:1.75,"aria-hidden":`true`})})]}),(0,Z.jsxs)(`div`,{className:`flex flex-none flex-col gap-px px-2 pt-0.5 pb-1.5`,children:[v(`newTask`,Ge,t),v(`search`,Ue,n),v(`board`,He,r),v(`features`,Ve,i)]}),(0,Z.jsx)(`div`,{"data-sidebar-scroll":!0,className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain px-2 pt-1.5`,children:o}),(0,Z.jsxs)(`div`,{className:`flex flex-none items-center gap-1 p-2`,children:[(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:v(`settings`,We,a)}),s]})]})}function xr({active:e,onNewTask:t,onSearch:n,onOpenBoard:r,onOpenFeatures:i,onOpenSettings:a,railCounts:o,update:s}){let{t:c}=A(),l=yr(),u=B(e=>e.toggleCollapsed),d=L(e=>e.bindings),f=d.toggleSidebar,p=z(`toggleSidebar`),m=c(`navigation:sidebar.expand`),h=(t,n,r)=>{let i=t===`board`?l.board:t===`features`?l.features:l[t],a=t===e;return(0,Z.jsx)(`button`,{type:`button`,"data-sidebar-entry":t,"aria-keyshortcuts":W(d[vr[t]]),"aria-label":i,"aria-current":a?`page`:void 0,title:i,className:I(hr,a&&`bg-surface-active text-content`),onClick:r,children:(0,Z.jsx)(n,{className:`size-[18px]`,strokeWidth:1.75,"aria-hidden":`true`})})};return(0,Z.jsxs)(`nav`,{"aria-label":c(`navigation:sidebar.labelCollapsed`),className:`flex min-h-0 flex-1 flex-col items-center gap-1 pb-2`,children:[(0,Z.jsx)(`div`,{"data-window-drag-region":!0,className:`flex h-[52px] flex-none items-center`,children:(0,Z.jsx)(`button`,{type:`button`,"data-sidebar-toggle":`expand`,"aria-expanded":!1,className:hr,"aria-label":m,"aria-keyshortcuts":W(f),title:p?`${m} (${p})`:m,onClick:u,children:(0,Z.jsx)(Qt,{className:`size-[18px]`,strokeWidth:1.75,"aria-hidden":`true`})})}),h(`newTask`,Ge,t),h(`search`,Ue,n),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`my-1.5 h-px w-6 bg-stroke-strong`}),o,(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`my-1.5 h-px w-6 bg-stroke-strong`}),h(`board`,He,r),h(`features`,Ve,i),(0,Z.jsx)(`span`,{className:`flex-1`}),s,h(`settings`,We,a)]})}function Sr({collapsed:e=!1}){let{t}=A();return e?(0,Z.jsxs)(`div`,{"aria-hidden":`true`,className:`flex flex-col items-center gap-1`,children:[(0,Z.jsx)(`span`,{className:`size-10 rounded-[var(--r-md)] bg-surface-hover`}),(0,Z.jsx)(`span`,{className:`size-10 rounded-[var(--r-md)] bg-surface-hover`})]}):(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,"aria-label":t(`navigation:sidebar.loading`),children:[60,44,70].map(e=>(0,Z.jsxs)(`div`,{"aria-hidden":`true`,className:`flex h-9 items-center gap-2.5 px-2.5`,children:[(0,Z.jsx)(`span`,{className:`size-4 rounded-full bg-surface-hover`}),(0,Z.jsx)(`span`,{className:`h-3 rounded-sm bg-surface-hover`,style:{width:`${e}%`}})]},e))})}var Cr=`pisper-custom-accent-style`,wr=[`xs`,`sm`,`base`,`lg`,`xl`,`2xl`,`3xl`],Tr=[12,13,14,16,20,24,28];function Er(e){let{uiFontSize:t}=zt(typeof e==`number`?{uiFontSize:e}:{fontScale:e});return Tr.map(e=>Math.round(e*t/14))}function Dr(e,t,n=new Date().getHours()){return e===`dark`?!0:e===`light`?!1:e===`system`?t:n>=18||n<8}function Or(e){let t=document.documentElement;t.dataset.accent=e.accent,t.dataset.density=e.density,t.dataset.fontScale=e.fontScale,t.dataset.motion=e.motion,t.dataset.radius=e.radius;let n=zt(e.uiFontSize===void 0?{fontScale:e.fontScale,codeFontSize:e.codeFontSize}:e);t.style.setProperty(`--ui-font-size`,`${n.uiFontSize}px`),t.style.setProperty(`--font-code-size`,`${n.codeFontSize}px`),Er(n.uiFontSize).forEach((e,n)=>{t.style.setProperty(`--font-ui-${wr[n]}`,`${e}px`)});let r=e.accent===`custom`?q(e.customAccent||``):null,i=document.getElementById(Cr);r?(i||(i=document.createElement(`style`),i.id=Cr,document.head.append(i)),i.textContent=Lt(r)):i?.remove()}function kr(e,t){if(!e)return``;let n=t?.sessions?.find(t=>t?.id===e);return n&&n.archived!==!0?e:``}function Ar(){let e=o(),t=f(),{t:n}=A(),r=(0,X.useRef)(n);return r.current=n,(0,X.useEffect)(()=>{if(!window.pisperDesktop)return;let e=!1,t=()=>{};return i(async()=>{let{startDesktopHosts:e}=await import(`./desktop-hosts-uMG7lFRY.js`);return{startDesktopHosts:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(({startDesktopHosts:n})=>{e||(t=n(e=>r.current(e)))}),()=>{e=!0,t()}},[]),(0,X.useEffect)(()=>{let n=n=>{if(n.defaultPrevented)return;let r=(n.target instanceof Element?n.target:null)?.closest(`a[href]`);if(!r)return;let i=G({href:r.href,baseUrl:window.location.href,button:n.button,download:r.hasAttribute(`download`),altKey:n.altKey,ctrlKey:n.ctrlKey,metaKey:n.metaKey,shiftKey:n.shiftKey,behavior:r.dataset.webPreview});if(!i)return;if(n.preventDefault(),n.stopPropagation(),x(e.pathname)){K(i);return}let a=kr(p.getItem(j.activeSession),he.getQueryData(M));if(!a){window.open(i,`_blank`,`noopener,noreferrer`);return}K(i),t(S(a))};return document.addEventListener(`click`,n,!0),()=>document.removeEventListener(`click`,n,!0)},[e.pathname,t]),null}function jr({blocked:e,onCommandPalette:t,onPrimary:n,onSearch:r,onToggleTerminal:i,onToggleSidebar:a,onAgentPanel:o,onPreviousAgent:s,onNextAgent:c,onSettings:l,onOpenSession:u,onOpenBoard:d,onOpenComponents:f,onOpenMore:p,onJumpToAttention:m,onSessionTree:h,onSideChat:g,onCycleFocusRegion:_,onShortcutHelp:v}){let y=L(e=>e.bindings);return(0,X.useLayoutEffect)(()=>{let b=b=>{if(e||yt(b)||bt(b)&&!b.key.startsWith(`Arrow`))return;let x;R(b,y.commandPalette)?x=t:R(b,y.primaryAction)?x=n:R(b,y.openSession)?x=u:R(b,y.openBoard)?x=d:R(b,y.openComponents)?x=f:R(b,y.openMore)?x=p:R(b,y.jumpToAttention)?x=m:R(b,y.sessionTree)?x=h:R(b,y.sideChat)?x=g:R(b,y.cycleFocusRegion)?x=_:R(b,y.toggleSidebar)?x=a:R(b,y.agentPanel)?x=o:R(b,y.previousAgent)?x=s:R(b,y.nextAgent)?x=c:R(b,y.toggleTerminal)?x=i:R(b,y.openSettings)?x=l:R(b,y.shortcutHelp)?x=v:!xt(b.target)&&R(b,y.focusSearch)&&(x=r),x&&(b.preventDefault(),x())};return window.addEventListener(`keydown`,b),()=>window.removeEventListener(`keydown`,b)},[y,e,o,t,_,m,c,d,f,p,u,s,n,r,h,l,v,g,i,a]),null}var Mr=v(`group pointer-events-auto relative flex min-h-11 w-full items-center gap-2 overflow-hidden rounded-md border px-3.5 py-2.5 pr-10 text-[13px] leading-5 font-medium tracking-[0] shadow-float transition data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-right-full data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none`,{variants:{tone:{success:`border-success-border bg-success-soft text-success-strong`,error:`border-danger-border bg-danger-soft text-danger`,info:`border-stroke bg-popover text-foreground`}},defaultVariants:{tone:`success`}});function Nr({className:e,tone:t,...n}){return(0,Z.jsx)(Un,{"data-slot":`toast`,className:I(Mr({tone:t}),e),...n})}function Pr({...e}){return(0,Z.jsx)(Vn,{"data-slot":`toast-provider`,...e})}function Fr({className:e,...t}){return(0,Z.jsx)(Hn,{"data-slot":`toast-viewport`,className:I(`fixed right-5 bottom-5 z-[80] flex w-[min(420px,calc(100vw-40px))] max-w-full flex-col gap-2 outline-none max-sm:right-3 max-sm:bottom-3 max-sm:left-3 max-sm:w-auto`,e),...t})}function Ir({className:e,...t}){return(0,Z.jsx)(Wn,{"data-slot":`toast-description`,className:I(`min-w-0 flex-1 [overflow-wrap:anywhere]`,e),...t})}function Lr({className:e,...t}){return(0,Z.jsx)(Kn,{"data-slot":`toast-close`,className:I(`absolute top-1/2 right-1.5 grid size-7 -translate-y-1/2 place-items-center rounded-sm text-current opacity-70 transition hover:bg-black/5 hover:opacity-100 dark:hover:bg-white/10`,e),...t})}var Rr={success:Pe,error:Ke,info:Be};function zr({message:e,tone:t,closeLabel:n,action:r,...i}){let a=Rr[t];return(0,Z.jsxs)(Nr,{tone:t,type:t===`error`?`foreground`:`background`,...i,children:[(0,Z.jsx)(a,{className:`size-[18px] shrink-0`}),(0,Z.jsx)(Ir,{children:e}),r&&(0,Z.jsx)(Gn,{altText:r.label,asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,className:`h-7 shrink-0 rounded-sm border border-current/30 px-2 text-xs font-semibold hover:bg-current/10`,onClick:r.onAction,children:r.label})}),(0,Z.jsx)(Lr,{"aria-label":n,title:n,children:(0,Z.jsx)(qe,{className:`size-4`})})]})}function Br(){let{t:e}=A(),[t,n]=(0,X.useState)(null),r=(0,X.useRef)(null),i=(0,X.useCallback)(e=>{r.current?.(e),r.current=null,n(null)},[]),a=(0,X.useCallback)(e=>new Promise(t=>{r.current?.(null),r.current=t,n(e)}),[]),o=(0,X.useCallback)((t={})=>a({type:`confirm`,title:e(`common:useAppDialog.confirmAction`),confirmLabel:e(`common:useAppDialog.confirm`),tone:`danger`,...t}).then(e=>e===!0),[a,e]),s=(0,X.useCallback)((t={})=>a({type:`prompt`,title:e(`common:useAppDialog.enterContent`),confirmLabel:e(`common:useAppDialog.save`),tone:`primary`,value:``,...t}).then(e=>typeof e==`string`?e:null),[a,e]),c=(0,X.useCallback)(()=>i(null),[i]);return(0,X.useEffect)(()=>()=>r.current?.(null),[]),{dialog:t,confirm:o,prompt:s,close:c,finish:i}}var Vr=15e3,Hr=216e5,Ur=new Set([`checking`,`downloading`,`downloaded`]);function Wr(e){return!Ur.has(e)}function Gr(e,t=window){let n=!1,r=!1,i=()=>{n||r||(n=!0,Promise.resolve().then(e).catch(()=>{}).finally(()=>{n=!1}))},a=t.setTimeout(i,Vr),o=t.setInterval(i,Hr);return()=>{r=!0,t.clearTimeout(a),t.clearInterval(o)}}var Kr=new Set([`available`,`downloading`,`installed`,`error`]),qr=/\b(?:403|429)\b[\s\S]*api\.github\.com/;function Jr(e){return e.retryAt!=null||qr.test(e.message)}function Yr(e){return e.length>1&&e.every(t=>t.message===e[0].message)?e[0].message:e.map(e=>`${e.component}: ${e.message}`).join(`
|
|
3
|
-
`)}function Xr(e,t){return t?.find(e=>e.component===`desktop`)?.currentVersion.trim()||e}function Zr(e){return e.filter(e=>e.size>0&&(Kr.has(e.state)||e.canInstall))}function Qr(e){return e.replace(/\r/g,``).split(`
|
|
4
|
-
`).filter(e=>!/^\s*#{1,6}\s+Pisper\s+(?:Desktop|TUI|Runtime)\s+v?\d+\.\d+\.\d+\s*$/i.test(e)&&!/^\s*#{1,6}\s+What['’]?s Changed\s*$/i.test(e)&&!/^\s*(?:\*\*)?(?:Full Changelog|完整变更)(?:\*\*)?\s*[::].*$/i.test(e)).join(`
|
|
5
|
-
`).replace(/\n{3,}/g,`
|
|
6
|
-
|
|
7
|
-
`).trim()}function $r(e){let t=e.filter(e=>e.state===`available`||e.state===`downloading`).map(e=>Qr(e.notes)).filter((e,t,n)=>e&&n.indexOf(e)===t);return t.length?`## What's Changed\n\n${t.join(`
|
|
8
|
-
|
|
9
|
-
`)}`:``}function ei(e,t=new Date().toISOString()){let n=e.filter(e=>e.state===`error`),r=e.filter(e=>e.state===`available`),i=e.some(e=>e.state===`checking`),a=e.filter(e=>e.state===`downloading`),o=e.some(e=>e.state===`installed`),s=a[0]||r[0]||n[0]||e[0],c=n.flatMap(e=>e.retryAt==null?[]:[e.retryAt]),l=$r(e),u=Zr(e),d=u.reduce((e,t)=>e+t.size,0),f=u.reduce((e,t)=>t.state===`installed`?e+t.size:t.state===`downloading`?e+Math.min(t.size,Math.max(0,t.transferred||0)):e,0);return{state:a.length?`downloading`:i?`checking`:n.length?`error`:r.length?`available`:o?`installed`:e.length?`current`:`idle`,checkedAt:t,message:Yr(n),rateLimited:n.length>0&&n.every(Jr),retryAt:c.length?Math.max(...c):void 0,releaseUrl:s?.releaseUrl,canDownload:r.length>0,availableVersion:s?.availableVersion,notes:l,total:d,transferred:f,percent:d>0?Math.min(100,f/d*100):0}}async function ti({refresh:e=!1,fetcher:t=fetch}={}){let n=await t(`/api/app-update${e?`?refresh=1`:``}`,{cache:`no-store`}),r=await n.json().catch(()=>null);if(!n.ok){let e=r&&`error`in r&&typeof r.error==`string`?r.error.trim():``;throw Error(e||`更新检查失败:HTTP ${n.status}`)}return r}var ni=Object.freeze({desktop:!1,packaged:!1,version:`0.6.32`,platform:`browser`,arch:``,releasesUrl:Wt});function ri(){let e=window.pisperDesktop,t=e?void 0:window.__TAURI__?.core?.invoke??window.__TAURI_INTERNALS__?.invoke,[n,r]=(0,X.useState)(ni),[i,a]=(0,X.useState)({state:`idle`,checkedAt:null}),[o,s]=(0,X.useState)([]),c=(0,X.useRef)(i),l=(0,X.useRef)(null),u=(0,X.useRef)(!1),d=(0,X.useRef)(!1),f=(0,X.useCallback)(e=>{c.current=e,a(e)},[]),p=(0,X.useCallback)(({refresh:n=!0}={})=>{if(l.current)return l.current;f({...c.current,state:`checking`,message:``});let r=(async()=>{try{if(u.current=!1,e?.checkForUpdates)try{let t=await e.checkForUpdates();if(t.state===`available`&&t.canDownload)return u.current=!0,f(t),t}catch{}if(e?.checkComponentUpdates){let t=await e.checkComponentUpdates();s(t);let n=ei(t);return f(n),!t.some(e=>e.state===`error`||e.state===`available`)&&t.some(e=>e.restartRequired)&&await e.restartForComponentUpdate?.(),n}if(d.current&&t){let e=await t(`mobile_check_app_update`,{refresh:n});return f(e),e}let r=await ti({refresh:n});return f(r),r}catch(e){let t={state:`error`,message:e instanceof Error?e.message:String(e),checkedAt:new Date().toISOString()};return f(t),t}})();return l.current=r,r.finally(()=>{l.current===r&&(l.current=null)}),r},[f,e,t]);(0,X.useEffect)(()=>{let n=!0,i=()=>{},a=()=>{},o=()=>{i=Gr(()=>{if(Wr(c.current.state))return p({refresh:!1})})};if(!e){let e=()=>{n&&p({refresh:!1})};return t?(t(`mobile_app_info`).then(t=>{if(!n)return;if(!t.mobile){e();return}d.current=!0,r(t),s([]),t.update&&f(t.update),p({refresh:!1}),o();let i=()=>{document.visibilityState===`visible`&&Wr(c.current.state)&&p({refresh:!1})};document.addEventListener(`visibilitychange`,i),a=()=>document.removeEventListener(`visibilitychange`,i)}).catch(e),()=>{n=!1,i(),a()}):(e(),()=>{n=!1})}return e.getAppInfo().then(t=>{n&&(r({...t,hostVersion:t.version}),e.componentUpdateStatus?.().then(e=>{n&&(s(e),f(ei(e)))}).catch(()=>{}),t.packaged&&o())}).catch(()=>{}),()=>{n=!1,i()}},[f,e,p,t]);let m=(0,X.useCallback)(async()=>{if(u.current&&e?.downloadUpdate){f({...c.current,state:`downloading`,message:``,transferred:0,percent:0});let t=e.onUpdateStatus?.(f);try{let t=await e.downloadUpdate();f(t),t.state===`downloaded`&&t.canInstall&&await e.installUpdate?.()}finally{t?.()}return[]}if(!e?.installComponentUpdates)return[];f({...c.current,state:`downloading`,message:``,transferred:0,percent:0});let t=!1,n=!1,r=async()=>{if(!(n||t||!e.componentUpdateStatus)){t=!0;try{let t=await e.componentUpdateStatus();if(n)return;s(t);let r=ei(t);r.state!==`available`&&f(r)}catch{}finally{t=!1}}},i=window.setInterval(()=>void r(),250);try{let t=await e.installComponentUpdates();return n=!0,s(t),f(ei(t)),!t.some(e=>e.state===`error`)&&t.some(e=>e.restartRequired)&&await e.restartForComponentUpdate?.(),t}finally{n=!0,window.clearInterval(i)}},[f,e]),h=(0,X.useCallback)(async()=>{if(e)return e.openReleases();let r=i.releaseUrl||n.releasesUrl||`https://github.com/ling-kong-ran/pisper/releases`;return d.current&&t?t(`mobile_open_app_update`,{url:r}):(window.open(r,`_blank`,`noopener,noreferrer`),!0)},[e,n.releasesUrl,t,i.releaseUrl]),g=(0,X.useCallback)(()=>e?.openUpdateLog?.(),[e]),_=(0,X.useCallback)(()=>d.current&&t&&i.downloadUrl?t(`mobile_open_app_update`,{url:i.downloadUrl}):h(),[t,h,i.downloadUrl]),v=(0,X.useCallback)(()=>_(),[_]);return{info:(0,X.useMemo)(()=>({...n,version:n.desktop?Xr(n.hostVersion||n.version,o):n.version}),[o,n]),status:i,components:o,check:p,installComponents:m,download:_,install:v,openReleases:h,openUpdateLog:g}}function ii(e){return!!e.providers?.some(e=>e.configured&&e.models?.some(e=>e.kind===`chat`))}function ai(e,t){return!t&&!ii(e)}function oi(){try{return JSON.parse(p.getItem(j.terminalPanel)||`{}`)}catch{return{}}}var si=()=>i(()=>import(`./MobileNavigation-B2NKM8rj.js`),__vite__mapDeps([14,5,6,15,3,4,7,8,9,11,16,17,18,2,1,19,20,21,22,23,24,25,26,27,28,29])),ci=(0,X.lazy)(()=>si().then(e=>({default:e.MobileSettingsBack}))),li=(0,X.lazy)(()=>si().then(e=>({default:e.MobileSettingsList}))),ui=(0,X.lazy)(()=>i(()=>import(`./DesktopWindowControls-BQ0OvDZ8.js`).then(e=>({default:e.DesktopWindowControls})),__vite__mapDeps([30,5,6,15,3,4,7,8,9,11,31,22,32,33]))),di=(0,X.lazy)(()=>i(()=>import(`./FloatingWidgets-DjMCcqln.js`).then(e=>({default:e.FloatingWidgets})),__vite__mapDeps([34,5,4,6,7,8,35,36,3,9,15,11,37,38,39,16,17,18,2,1,19,20,40,41,42,43,44,45]))),fi=(0,X.lazy)(async()=>{let[{CommandPalette:e},{getNavigation:t}]=await Promise.all([i(()=>import(`./AppOverlays-BlJ0uL_P.js`),__vite__mapDeps([46,5,6,15,3,4,7,8,9,11,37,38,47,48,17,18,2,1,19,20,16,22,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,33,64,65,66,67,68,69])),i(()=>import(`./palette-navigation-BcPK8UF5.js`),__vite__mapDeps([70,20,71,22,5,6,72,73,74,75,51,76,77,78,79,80,81,82]))]);function n(n){let{t:r}=A(),i=Oe(e=>e.capabilities),a=(0,X.useMemo)(()=>t(r,i),[i,r]);return(0,Z.jsx)(e,{...n,navigation:a})}return{default:n}}),pi=(0,X.lazy)(()=>i(()=>import(`./AppDialog-BIc2uEZh.js`).then(e=>({default:e.AppDialog})),__vite__mapDeps([83,5,6,15,3,4,7,8,9,11,33,22,84,66,65,56,57,68,63,64,67,85]))),mi=(0,X.lazy)(()=>i(()=>import(`./WebDesktopPet-CWviMnct.js`).then(e=>({default:e.WebDesktopPet})),__vite__mapDeps([86,5,7,4,6,8,15,3,9,11,17,18,2,1,19]))),hi=(0,X.lazy)(()=>i(()=>import(`./public-components-CMbKXCZU.js`).then(e=>({default:e.ConfigSearchBox})),__vite__mapDeps([87,5,6,15,3,4,7,8,9,11,16,17,18,2,1,19,20,88,22,89,90,53,79,33,56,57,68,65,58,91,60,63,64,66,67,85,92]))),gi=(0,X.lazy)(()=>i(()=>import(`./public-components-CMbKXCZU.js`).then(e=>({default:e.ModelOnboardingDialog})),__vite__mapDeps([87,5,6,15,3,4,7,8,9,11,16,17,18,2,1,19,20,88,22,89,90,53,79,33,56,57,68,65,58,91,60,63,64,66,67,85,92]))),_i=()=>Promise.all([i(()=>import(`./sidebar-DrzZKq2i.js`),__vite__mapDeps([93,5,4,6,35,15,3,7,8,9,11,23,22,94,78,56,57,60,95,96,38,37,47,48,17,18,2,1,19,39,16,20,41,61,97,59,98,99,100,101,102,103,104,105,106,107,65,66,108,67,109,110,111,112,113,114,115,116])),D()]).then(([e])=>e),vi=(0,X.lazy)(()=>i(()=>import(`./public-sidebar-UNJ9_fD1.js`),__vite__mapDeps([117,5,4,6,35,15,3,7,8,9,11,52,22,118,119,2,16,17,18,1,19,20,120,107,23,74,121,122,68,57,65,56,63,33,64,66,67,85,123,124,125,126,127,128,84,129,114,113,130,47,38,48,131,59,132]))),yi=(0,X.lazy)(()=>_i().then(e=>({default:e.SidebarSessions}))),bi=(0,X.lazy)(()=>_i().then(e=>({default:e.SidebarRailCounts}))),xi=(0,X.lazy)(()=>_i().then(e=>({default:e.SidebarCommands}))),Si=(0,X.lazy)(()=>_i().then(e=>({default:e.SidebarFleetLine}))),Ci=(0,X.lazy)(()=>Promise.all([i(()=>import(`./PhoneTopBar-DuLewk2J.js`),__vite__mapDeps([133,6,5,15,3,4,7,8,9,11,134,22,56,57,95,102,100,47,38,48,17,18,2,1,19,16,20,41,59,61,96,37,39,97,98,99,101,135,136,137,120,138,107,23,139,140,141,29,53,32,142,143,33,65,66,64,67,144,109,110,63,68,145,108,146,58,60,147,62,103,148,149,85,126,150,74,151,121,152,153,52,79,106,111,154,155,156,127,157,158])),D()]).then(([e])=>({default:e.PhoneTopBar}))),wi=(0,X.lazy)(()=>i(()=>import(`./PhoneDrawer-utEXi-yp.js`).then(e=>({default:e.PhoneDrawer})),__vite__mapDeps([159,6,5,15,3,4,7,8,9,11,75,22,53,80,158,56,57,147,33,64,65,66,67,68,95]))),Ti=(0,X.lazy)(()=>i(()=>import(`./SidebarUpdateStatus-DrS7u_v_.js`),__vite__mapDeps([160,6,5,15,3,4,7,8,9,11,89,22,161,29,162]))),Ei=(0,X.lazy)(()=>i(()=>import(`./SettingsSidebar-CpAD5iSt.js`).then(e=>({default:e.SettingsSidebar})),__vite__mapDeps([163,5,6,15,3,4,7,8,9,11,16,17,18,2,1,19,20,164,22,88,24,25,26,27,28,29,56,57,58,60,165]))),Di=(0,X.lazy)(async()=>{let[{ShortcutHelpDialog:e}]=await Promise.all([i(()=>import(`./ShortcutHelpDialog-C2QbSvui.js`),__vite__mapDeps([166,5,6,15,3,4,7,8,9,11,80,22,68,57,65,56,60,63,33,64,66,67,167,58])),D()]);return{default:e}}),Oi=(0,X.lazy)(()=>i(()=>import(`./PageHeader-BN-qcxte.js`).then(e=>({default:e.PageHeader})),__vite__mapDeps([168,6,5,15,3,4,7,8,9,11,21,22,54,169,56,57,68,65,60]))),ki=(0,X.lazy)(()=>i(()=>import(`./TerminalPanel-DuUtaPyf.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([170,5,6,15,3,4,7,8,9,11,22,31,52,54,33,68,57,65,56,171,172,32,123,173,44,174,107,136,175,139,66,176,108,67,109,110,146,177]))),Ai=(0,X.lazy)(()=>i(()=>import(`./MobileViewportStabilizer-uKI4Zp7f.js`).then(e=>({default:e.MobileViewportStabilizer})),__vite__mapDeps([178,5,6])));function ji(e,t){return String(e||``).replace(/\{\{\s*([\w.]+)\s*\}\}/g,(e,n)=>{let r=n.split(`.`).reduce((e,t)=>{if(!(!e||typeof e!=`object`))return e[t]},t);return r==null?`{{${n}}}`:String(r)})}function Mi(e){try{return decodeURIComponent(e)}catch{return``}}function Ni(e,t){let n=window.__TAURI__?.core?.invoke??window.__TAURI_INTERNALS__?.invoke;return n?n(e,t):Promise.reject(Error(`native bridge unavailable`))}function Pi({routerState:e}){let{t}=A();(0,X.useEffect)(()=>be(`react-app-mounted`),[]);let n=o(),r=f(),s=(0,X.useCallback)(()=>e?.()??{location:n,navigation:{state:`idle`}},[n,e]),c=Oe(e=>e.capabilities),l=Oe(e=>e.loaded),u=Oe(e=>e.load),d=(0,X.useMemo)(()=>Yt(t),[t]),m=C(n.pathname)||`board`,h=!!x(n.pathname),g=m===`config`?Mi(n.pathname.split(`/`)[2]||`models`):`models`,_=ze.has(g)&&De(c,g)?g:`models`,v=Fe(m,_),b=(0,X.useRef)(m),[te,E]=(0,X.useState)(``),[ae,oe]=(0,X.useState)(()=>p.getItem(j.activeSession)||``),se=y(n.pathname,ae),ce=Me(e=>e.client===`mobile-app`),le=Me(e=>e.loaded),D=Ae(),O=ce||D,ue=je()&&ce,k=O&&!window.pisperDesktop&&!ue,de=cr(m,v),fe=de===`board`?`board`:de===`more`?`features`:de===`settings`?`settings`:null,pe=B(e=>e.toggleCollapsed);(0,X.useEffect)(()=>{document.documentElement.toggleAttribute(`data-phone-shell`,k)},[k]),(0,X.useEffect)(()=>{B.getState().setDrawerOpen(!1)},[n.pathname,k]);let[ye,M]=(0,X.useState)(!1),[xe,Se]=(0,X.useState)(!1),Ce=J(e=>e.theme),ke=J(e=>e.cycleTheme),Ne=J(e=>e.density),Pe=J(e=>e.accent),Be=J(e=>e.customAccent),Ve=J(e=>e.fontScale),He=J(e=>e.uiFontSize),Ue=J(e=>e.codeFontSize),We=J(e=>e.radius),Ge=J(e=>e.motion),[Ke,qe]=(0,X.useState)([]),[Xe,Qe]=(0,X.useState)(!1),N=Xe?void 0:Ke[0],P=(0,X.useRef)(N);P.current=N;let[$e,et]=(0,X.useState)(!1),[F,tt]=(0,X.useState)(null),{data:nt,isPending:rt,isSuccess:it}=me(ve(`config`)),{data:at}=me(ve(`notification-settings`)),[ot,st]=(0,X.useState)(!1),[ct,lt]=(0,X.useState)({browser:{enabled:!1},connections:{},scopes:[],templates:[]}),[I,ut]=(0,X.useState)(null),dt=(0,X.useMemo)(()=>({terminal:t(`terminal:terminalPanel.terminal`),resizeTerminal:t(`terminal:terminalPanel.resizeTerminal`),hideTerminal:t(`terminal:terminalPanel.hideTerminal`),showTerminal:t(`terminal:terminalPanel.showTerminal`),newTerminal:t(`terminal:terminalPanel.newTerminal`),closeTerminal:t(`terminal:terminalPanel.closeTerminal`),maximizeTerminal:t(`terminal:terminalPanel.maximizeTerminal`),openTerminal:t(`terminal:terminalPanel.openTerminal`),usesActiveSessionWorkspace:t(`terminal:terminalPanel.usesActiveSessionWorkspace`),orphanedTerminal:t(`terminal:terminalPanel.orphanedTerminal`),starting:t(`terminal:terminalPanel.starting`),processExited:e=>t(`terminal:terminalPanel.processExited`,{code:e??`-`})}),[t]),[ft,yt]=(0,X.useState)(()=>!!oi().open),[L,bt]=(0,X.useState)(()=>Math.max(180,Math.min(640,Number(oi().height)||300)));(0,X.useEffect)(()=>{let e=()=>{window.pisperDesktop?.terminalProfiles&&Ee(c,`terminal`)&&yt(e=>!e)};return window.addEventListener(`pisper:toggle-terminal`,e),()=>window.removeEventListener(`pisper:toggle-terminal`,e)},[c]);let xt=(0,X.useRef)(``),[R]=(0,X.useState)(or),z=(0,X.useRef)(null),St=(0,X.useRef)(null),Ct=(0,X.useRef)(0),V=Br(),H=ri();(0,X.useEffect)(()=>{Or({accent:Pe,density:Ne,fontScale:Ve,motion:Ge,radius:We,customAccent:Be,uiFontSize:He,codeFontSize:Ue})},[Pe,Ne,Ve,Ge,We,Be,He,Ue]),(0,X.useEffect)(()=>{p.setItem(j.terminalPanel,JSON.stringify({open:ft,height:L}))},[L,ft]),(0,X.useEffect)(()=>{let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>{let t=Dr(Ce,e.matches);document.documentElement.dataset.theme=t?`dark`:`light`,document.documentElement.classList.toggle(`dark`,t)};if(t(),Ce===`system`)return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t);if(Ce===`scheduled`){let e=window.setInterval(t,6e4);return()=>window.clearInterval(e)}},[Ce]);let U=(0,X.useCallback)((e,t=`success`,n)=>{Ct.current+=1;let r={id:Ct.current,message:e,tone:t,action:n?.action};qe(e=>[...e,r])},[]);(0,X.useEffect)(()=>{let e=e=>{let t=P.current;if(e.key!==`Escape`||!e.isTrusted||!t||!document.querySelector(`[data-radix-popper-content-wrapper], [role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]`))return;e.stopImmediatePropagation(),e.preventDefault();let n=document.activeElement instanceof HTMLElement?document.activeElement:document.body;Qe(!0),qe(e=>e.filter(e=>e.id!==t.id)),requestAnimationFrame(()=>requestAnimationFrame(()=>{n.dispatchEvent(new KeyboardEvent(`keydown`,{key:`Escape`,code:`Escape`,bubbles:!0,cancelable:!0})),Qe(!1)}))};return document.addEventListener(`keydown`,e,{capture:!0}),()=>document.removeEventListener(`keydown`,e,{capture:!0})},[]),(0,X.useEffect)(()=>{let e=e=>{let t=e.detail?.id;oe(t??p.getItem(j.activeSession)??``)};window.addEventListener(gt,e);let t=e=>{let t=e.detail;t?.message&&U(t.message,t.tone===`error`?`error`:`info`)};return window.addEventListener(jt,t),Me.getState().load({refresh:!1}).then(()=>be(`client-info-loaded`)),u({refresh:!1}).then(()=>be(`capabilities-loaded`)),()=>{window.removeEventListener(gt,e),window.removeEventListener(jt,t)}},[u,U]);let wt=(0,X.useRef)(!1);(0,X.useEffect)(()=>{!le||!ce||wt.current||(wt.current=!0,(async()=>{await Ni(`mobile_ensure_local_network_permission`).catch(()=>void 0)})())},[le,ce]);let Tt=(0,X.useCallback)((e,t,{force:n=!1}={})=>{if(ct.browser?.enabled&&!(!n&&document.visibilityState===`visible`&&document.hasFocus())){if(window.pisperDesktop?.showNotification){window.pisperDesktop.showNotification({title:e,body:t}).catch(()=>{});return}if(Kt()){Rt(e,t).catch(()=>{});return}i(async()=>{let{showBrowserSystemNotification:e}=await import(`./browser-notifications-CvHO-BlP.js`).then(e=>e.t);return{showBrowserSystemNotification:e}},__vite__mapDeps([179,5])).then(({showBrowserSystemNotification:n})=>n({title:e,body:t,tag:`pisper-${e}`,url:window.location.href})).catch(()=>{})}},[ct.browser?.enabled]);(0,X.useEffect)(()=>qt(),[]);let Et=(0,X.useCallback)(e=>{let t=Bt.getState();if(!t.enabled||!t.whileFocused&&document.visibilityState===`visible`&&document.hasFocus())return;let n=[`waiting`,`failed`,`finished`].find(n=>e.some(e=>e.kind===n&&t.sounds[n]!==`none`)),r=n?t.sounds[n]:`none`;r!==`none`&&Vt(r,t.volume)},[]),Dt=(0,X.useCallback)((e,t,n)=>{let r=ct.templates?.find(t=>t.id===e),i=r?.channels?.browser?.content;!r?.enabled||r.channels?.browser?.enabled===!1||!i||Tt(r.name,ji(i,t||{}),n)},[ct.templates,Tt]),Ot=(0,X.useCallback)(e=>R.register(e),[R]),kt=(0,X.useCallback)(()=>{R.invoke()},[R]),At=(0,X.useCallback)(e=>(ut(e),()=>ut(t=>t===e?null:t)),[]),W=(0,X.useCallback)((e,t)=>{if(!(!w.has(e)||!Te(c,e))){if(e===`chat`){if(!h){let e=mt();r(e?S(e.sessionId):`/`,t)}}else r(ie(e),t);E(``)}},[c,r,h]),Pt=(0,X.useCallback)((e,t=``)=>{e&&(vt(e,`open`,t),h||r(S(e)),E(``))},[r,h]),G=(0,X.useCallback)(()=>{E(``),pt(),x(n.pathname)!==`new`&&r(S())},[n.pathname,r]);(0,X.useEffect)(()=>{if(l&&!Te(c,m)){r(`/`,{replace:!0});return}l&&m===`config`&&g!==_&&r(`/config/${_}`,{replace:!0})},[c,l,_,m,g,r]);let K=(0,X.useCallback)((e,t)=>{let n=ze.has(e)&&De(c,e)?e:`models`;r(n===`interface`&&t===`widgets`?T.components:`/config/${n}`),E(``)},[c,r]),q=(0,X.useCallback)(e=>{if(e===`session`){let e=ur(s());e&&r(e.to,{replace:e.replace,state:e.state}),E(``)}else e===`settings`?k?r(ee):K(`models`):W(sr[e])},[W,k,s,r,K]),Lt=(0,X.useCallback)(()=>x(lr(s())),[s]),zt=(0,X.useCallback)(e=>{if(!e)return;let t=s(),n=lr(t);if(x(n)===e)return;if(E(``),C(n)!==`session`){r(S(e));return}let i=n===`/`?re:t.location.state;r(S(e),{replace:!0,state:i})},[s,r]),Ht=(0,X.useCallback)(e=>{Lt()===e&&r(`/`,{replace:!0})},[Lt,r]),Y=(0,X.useCallback)(()=>{try{p.setItem(j.modelOnboardingDismissed,`1`)}catch{}et(!1)},[]),Ut=(0,X.useCallback)(()=>{Y(),R.clear(),R.invoke(),K(`models`)},[Y,R,K]),Wt=(0,X.useCallback)(()=>{Y(),r(`/config/models?import=1`),E(``)},[Y,r]),Gt=(0,X.useCallback)(()=>K(`updates`),[K]),Xt=(0,X.useCallback)(()=>K(`notifications`),[K]),Zt=(0,X.useRef)(null);(0,X.useEffect)(()=>{if(!v){Zt.current=null;return}if(Zt.current!==null)return;let e=window.history.state?.idx;Zt.current=typeof e==`number`?e:0},[n.key,v]);let Qt=(0,X.useCallback)(()=>{let e=Zt.current,t=window.history.state?.idx;r(e!==null&&e>0&&typeof t==`number`&&t>=e?-(t-e+1):`/`)},[r]),$t=(0,X.useCallback)(async e=>e&&(await _e(`sessions`)).sessions?.find(t=>t.id===e)?.cwd||``,[]),en=(0,X.useCallback)(e=>{let t=p.getItem(j.activeSession)||``;tt({asset:e,targetSessionId:t}),t?Pt(t):r(`/`)},[Pt,r]);(0,X.useEffect)(()=>{let e=()=>{!V.dialog&&!$e&&M(!0)},t=e=>{if(!(e.defaultPrevented||e.isComposing||e.keyCode===229)&&e.key===`Escape`&&!V.dialog){ye&&(M(!1),e.preventDefault());return}};return window.addEventListener(`keydown`,t),window.addEventListener(ht,e),()=>{window.removeEventListener(`keydown`,t),window.removeEventListener(ht,e)}},[V.dialog,$e,ye]);let Q=(0,X.useRef)(!1);(0,X.useEffect)(()=>{if(rt||Q.current||(Q.current=!0,st(!0),!it||!nt))return;be(`config-loaded`);let e=!1;try{e=p.getItem(j.modelOnboardingDismissed)===`1`}catch{}b.current!==`config`&&ai(nt,e)&&et(!0)},[nt,rt,it]),(0,X.useEffect)(()=>{ot&&l&&(m===`board`||m===`session`)&&be(`chat-shell-ready`)},[l,m,ot]);let tn=(0,X.useRef)(m);(0,X.useLayoutEffect)(()=>{tn.current===`config`&&m!==`config`&&(ge(`config`),ge(`notification-settings`)),tn.current=m},[m]),(0,X.useEffect)(()=>{at&<(at)},[at]),(0,X.useEffect)(()=>{let e=!0,t=async()=>{try{let t=xt.current,n=await he.fetchQuery({queryKey:[`browser-notification-events`,t],queryFn:()=>we(`/api/settings/notifications/browser/events?after=${encodeURIComponent(t)}`),staleTime:0,retry:!1});if(!e)return;for(let e of n.events||[])Tt(e.title,e.body,{force:!0});xt.current=n.latestId||xt.current}catch{}};t();let n=window.setInterval(t,3e3);return()=>{e=!1,window.clearInterval(n)}},[Tt]);let nn=m===`chat`?[t(`common:app.sessions`),O?``:t(`common:app.dragTabsOrSplitChatsInAnyDirectionFromTheSessionList`)]:m===`config`?[v&&Ie(_)?Re(t,_):Le(t,_),``]:m===`workflowCreate`?Jt(t,I?I.editing:Mi(n.pathname.split(`/`)[2]||`new`)!==`new`):d[m]||[t(`common:app.sessions`),``],rn=(0,X.useCallback)(e=>{he.cancelQueries({queryKey:[`notification-settings`],exact:!0}),he.setQueryData([`notification-settings`],e),lt(e)},[]),an=de===`more`&&m!==`more`,on=(0,X.useCallback)(()=>r(T.more),[r]),sn={activeSessionId:se,navigate:W,notify:U,browserNotify:Dt,registerPrimaryAction:Ot,invokePrimaryAction:kt,pendingAsset:F,onAssetConsumed:()=>tt(null),onUseAsset:en,requestText:V.prompt,requestConfirm:V.confirm,openNotificationSettings:Xt,configSection:_,setConfigSection:K,setNotificationSettings:rn,appUpdate:H,registerWorkflowActions:At,startNewTask:G,onBackToFeatures:an?on:void 0},cn=(0,X.useCallback)(()=>{let e=window.history.state?.idx,t=fr(m,n.pathname,v,{phone:k,homeEntry:ne(n.state),canGoBack:typeof e==`number`&&e>0});return t===-1?r(-1):t&&r(t),t!==null},[n.pathname,n.state,m,k,r,v]),ln=(0,X.useCallback)(()=>{m===`more`?document.getElementById(Je)?.focus():Ye.has(m)?document.getElementById(Ze)?.focus():m===`board`?document.getElementById(Mt)?.querySelector(`[data-state="on"]`)?.focus():z.current?.focus()},[m]),un=k&&m!==`session`,dn=k&&v&&/^\/config\/?$/.test(n.pathname),fn=![`board`,`session`,`more`,`chat`,`workflowCreate`,`config`,`bots`].includes(m)&&!Ye.has(m),pn=v&&!k;if(!ot||!l)return(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,className:`app-startup flex min-h-[100vh] w-full items-center justify-center gap-2.5 bg-chrome text-[13px] text-content-muted`,children:[(0,Z.jsx)(It,{size:30,className:`startup-logo`}),(0,Z.jsx)(`strong`,{className:`font-medium`,children:t(`common:app.wakingPisper`)})]});let mn=e=>(0,Z.jsx)(X.Suspense,{fallback:null,children:(0,Z.jsx)(hi,{query:te,onQueryChange:E,onSelect:K,inputRef:z,placement:e})});return(0,Z.jsx)(Pr,{duration:2800,swipeDirection:`right`,children:(0,Z.jsx)(Ft,{bridge:window.pisperDesktop,children:(0,Z.jsxs)(`div`,{ref:St,className:`app-shell flex w-full h-full min-h-0 flex-col overflow-hidden bg-chrome text-content [&[data-phone-shell]]:bg-panel [&[data-phone-shell][data-shell-canvas]]:bg-background pt-[var(--pisper-safe-area-top)] pr-[var(--pisper-safe-area-right)] pb-[var(--pisper-safe-area-bottom)] pl-[var(--pisper-safe-area-left)] [&[data-mobile-app]]:h-[100dvh] [&[data-mobile-app]]:min-h-0 [&[data-mobile-app]]:overflow-hidden [&[data-mobile-keyboard='open']]:pb-0 [&[data-phone-shell]]:pb-0`,"data-mobile-app":O||void 0,"data-phone-shell":k||void 0,"data-shell-canvas":m===`board`||m===`more`||void 0,"data-custom-titlebar":window.pisperDesktop?.customTitlebar||void 0,children:[window.pisperDesktop?.customTitlebar&&(0,Z.jsx)(X.Suspense,{fallback:null,children:(0,Z.jsx)(ui,{})}),(0,Z.jsx)(Ar,{}),O&&(0,Z.jsx)(X.Suspense,{fallback:null,children:(0,Z.jsx)(Ai,{enabled:le&&ot,shellRef:St})}),Ee(c,`desktopPet`)&&(0,Z.jsx)(X.Suspense,{fallback:null,children:(0,Z.jsx)(mi,{})}),(0,Z.jsx)(ar,{onRouteBack:O?cn:void 0}),(0,Z.jsx)(jr,{blocked:!!(V.dialog||$e||ye),onCommandPalette:()=>M(!0),onPrimary:()=>G(),onSearch:ln,onToggleTerminal:window.pisperDesktop?.terminalProfiles&&Ee(c,`terminal`)?()=>yt(e=>!e):void 0,onSettings:()=>q(`settings`),onOpenSession:()=>q(`session`),onOpenBoard:()=>q(`board`),onOpenComponents:()=>W(`components`),onOpenMore:()=>q(`more`),onToggleSidebar:k?void 0:pe,onAgentPanel:()=>Nt({kind:`focus-list`}),onPreviousAgent:()=>Nt({kind:`adjacent`,direction:-1}),onNextAgent:()=>Nt({kind:`adjacent`,direction:1}),onJumpToAttention:()=>Nt({kind:`focus-attention`}),onSessionTree:m===`session`?()=>_t(`tree`):void 0,onSideChat:m===`session`?()=>_t(`side-chat`):void 0,onCycleFocusRegion:()=>void i(()=>import(`./focus-regions-B9MkPSKC.js`).then(e=>e.cycleFocusRegion()),[]),onShortcutHelp:()=>Se(!0)}),(0,Z.jsxs)(`div`,{className:`app-body flex min-h-0 flex-1 overflow-hidden`,"data-mobile-app":O||void 0,children:[!k&&(0,Z.jsx)(_r,{active:fe,onNewTask:()=>G(),onSearch:()=>M(!0),onOpenBoard:()=>q(`board`),onOpenFeatures:()=>q(`more`),onOpenSettings:()=>q(`settings`),content:(0,Z.jsxs)(X.Suspense,{fallback:(0,Z.jsx)(Sr,{}),children:[(0,Z.jsx)(vi,{}),(0,Z.jsx)(yi,{currentId:x(n.pathname),notify:U,requestText:V.prompt,onOpenSession:zt,onOpenBoard:()=>q(`board`),onOpenHistory:()=>W(`chatHistory`),onArchived:Ht})]}),takeover:pn?(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(`nav`,{"aria-busy":`true`,"aria-label":t(`config:settingsShell.settingsNavigation`),className:`flex-1`}),children:(0,Z.jsx)(Ei,{configSection:_,onSelectSection:K,onBack:Qt,onOpenFeatures:()=>q(`more`),search:mn(`sidebar`),version:H.info?.version,footer:(0,Z.jsx)(X.Suspense,{fallback:null,children:(0,Z.jsx)(Si,{onOpenBoard:()=>q(`board`)})})})}):void 0,railCounts:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(Sr,{collapsed:!0}),children:(0,Z.jsx)(bi,{onOpenBoard:()=>q(`board`)})}),update:H.status&&[`available`,`downloading`,`downloaded`].includes(H.status.state)?(0,Z.jsx)(X.Suspense,{fallback:null,children:(0,Z.jsx)(`div`,{className:`flex-none [&>button]:size-8 [&>button]:min-h-0 pointer-coarse:[&>button]:size-11`,children:(0,Z.jsx)(Ti,{update:H,collapsed:!0,onOpen:Gt})})}):void 0}),(0,Z.jsx)(X.Suspense,{fallback:null,children:(0,Z.jsx)(xi,{resolveCurrentId:Lt,renderedSessionId:m===`session`?x(n.pathname):null,onOpenSession:zt,onWaiting:({title:e,reason:t})=>Dt(`chat.waiting`,{chat:{title:e,tool:t,reason:t}}),onAlerts:Et})}),(0,Z.jsxs)(`main`,{"data-focus-region":`main`,className:`main-surface relative flex min-w-0 flex-1 flex-col overflow-hidden bg-panel`,children:[un&&(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(`div`,{className:`h-14 flex-none bg-panel`,"aria-hidden":`true`}),children:(0,Z.jsx)(Ci,{title:dn?t(`navigation:navigation.settings`):nn[0],onNewTask:()=>G(),onSearch:m===`board`?()=>M(!0):void 0})}),k&&v&&!dn&&(0,Z.jsxs)(X.Suspense,{fallback:null,children:[(0,Z.jsx)(ci,{onBack:()=>r(`/config`)}),(0,Z.jsx)(`div`,{"data-mobile-settings-search":!0,className:`flex-none px-4 pb-1`,children:mn()})]}),fn&&(0,Z.jsx)(X.Suspense,{fallback:null,children:(0,Z.jsx)(Oi,{meta:nn,page:m,desktopPlatform:window.pisperDesktop?.platform||``,terminalOpen:ft,onToggleTerminal:()=>yt(e=>!e),onBackToMore:an?on:void 0,phoneShell:k})}),(0,Z.jsx)(`div`,{className:`page-content flex-1 min-h-0 overflow-auto ${m===`session`||m===`chat`?`page-chat flex overflow-hidden p-0`:w.has(m)?`page-${m} overflow-hidden p-0`:`page-${m} px-6 pt-5 pb-5 max-[650px]:px-3 max-[650px]:pt-0`}`,children:dn?(0,Z.jsx)(X.Suspense,{fallback:null,children:(0,Z.jsx)(li,{onNavigate:K,onOpenFeatures:()=>q(`more`)})}):(0,Z.jsx)(a,{context:sn})},m),window.pisperDesktop?.terminalProfiles&&Ee(c,`terminal`)&&(0,Z.jsx)(X.Suspense,{fallback:null,children:(0,Z.jsx)(ki,{open:ft,height:L,labels:dt,activeSessionId:se,resolveSessionCwd:$t,onOpenChange:yt,onHeightChange:bt})})]})]}),k&&(0,Z.jsx)(X.Suspense,{fallback:null,children:(0,Z.jsx)(wi,{active:fe,onSearch:()=>M(!0),onNewTask:()=>G(),onOpenBoard:()=>q(`board`),onOpenFeatures:()=>q(`more`),onOpenSettings:()=>q(`settings`),content:(0,Z.jsxs)(X.Suspense,{fallback:(0,Z.jsx)(Sr,{}),children:[(0,Z.jsx)(vi,{}),(0,Z.jsx)(yi,{drawer:!0,currentId:x(n.pathname),notify:U,requestText:V.prompt,onOpenSession:zt,onOpenBoard:()=>q(`board`),onOpenHistory:()=>W(`chatHistory`),onArchived:Ht})]}),update:H.status&&[`available`,`downloading`,`downloaded`].includes(H.status.state)?(0,Z.jsx)(X.Suspense,{fallback:null,children:(0,Z.jsx)(`div`,{className:`flex-none [&>button]:size-11 [&>button]:min-h-0`,children:(0,Z.jsx)(Ti,{update:H,collapsed:!0,onOpen:Gt})})}):void 0})}),(0,Z.jsx)(X.Suspense,{fallback:null,children:(0,Z.jsx)(di,{activeSessionId:se,notify:U})}),N&&(0,Z.jsx)(zr,{open:!0,message:N.message,tone:N.tone,action:N.action,duration:N.action?1e4:void 0,closeLabel:t(`common:ui.closeDialog`),onOpenChange:e=>!e&&qe(e=>e.filter(e=>e.id!==N.id))},N.id),(0,Z.jsx)(Fr,{hotkey:[],label:t(`common:ui.notifications`)}),V.dialog&&(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(`span`,{role:`status`,className:`sr-only`,children:t(`common:pageTemplate.loading`)}),children:(0,Z.jsx)(pi,{dialog:V.dialog,onClose:V.close,onFinish:V.finish})}),(0,Z.jsx)(X.Suspense,{fallback:null,children:$e&&(0,Z.jsx)(gi,{open:!0,onDismiss:Y,onOpenImport:Wt,onOpenSettings:Ut})}),(0,Z.jsxs)(X.Suspense,{fallback:null,children:[ye&&(0,Z.jsx)(fi,{onClose:()=>M(!1),onNavigate:W,onOpenSession:async(e,n,r)=>{try{if(n&&!r){let{switchToTurnOnOtherBranch:r}=await i(async()=>{let{switchToTurnOnOtherBranch:e}=await import(`./session-tree-actions-B8GDKcGe.js`);return{switchToTurnOnOtherBranch:e}},__vite__mapDeps([180,59,7,4,5,6,8,9,61,47,38,48,17,18,2,3,1,19,181,37]));await r({sessionId:e,entryId:n,confirm:V.confirm,open:Pt,notify:U,t});return}Pt(e,n)}catch(e){throw U(t(`navigation:appOverlays.openLabeledTurnFailed`),`error`),e}},onNewChat:()=>G(),onToggleTheme:ke}),xe&&(0,Z.jsx)(Di,{open:!0,onOpenChange:Se,onCustomize:()=>r(`/config/shortcuts`)})]})]})})})}function Fi({children:e}){let{t}=A(),n=f(),r=o(),i=(0,X.useRef)(new Map),a=(0,X.useRef)(new Map),s=(0,X.useRef)(0),[c,l]=(0,X.useState)(0),[d,p]=(0,X.useState)(null),m=(0,X.useRef)(null),[h,g]=(0,X.useState)(!1),_=u(({currentLocation:e,nextLocation:t})=>Ut(e,t)&&Object.values(Y(i.current.values())).some(Boolean)),v=(0,X.useRef)(_);v.current=_;let y=(0,X.useCallback)(e=>{m.current=e,p(e)},[]),b=(0,X.useCallback)(e=>{let t=i.current.get(e.id);i.current.set(e.id,e),(!t||t.dirty!==e.dirty||t.saving!==e.saving)&&l(e=>e+1)},[]),x=(0,X.useCallback)(e=>{i.current.delete(e)&&l(e=>e+1)},[]),S=(0,X.useCallback)(()=>{y(null),a.current.clear(),v.current.state===`blocked`&&v.current.reset()},[y]),ee=(0,X.useCallback)((e,t,r)=>{a.current.clear();let i=`navigation-${++s.current}`;r&&a.current.set(i,r),n(e,{...t,state:{...t?.state,[Ht]:i}})},[n]),C=(0,X.useCallback)((e,t)=>{let n=i.current.get(e);if(n?.saving){S(),g(!0);return}if(v.current.state===`blocked`&&v.current.reset(),a.current.clear(),!n?.dirty){y(null),t();return}g(!1),y({kind:`close`,id:e,close:t})},[S,y]);(0,X.useLayoutEffect)(()=>{let e=Y(i.current.values());if(_.state===`blocked`)e.saving||!e.dirty?(S(),g(e.saving)):(g(!1),y({kind:`route`}));else if(m.current?.kind===`close`){let e=i.current.get(m.current.id);(!e||e.saving||!e.dirty)&&(y(null),g(!!e?.saving))}},[_,c,S,y]),(0,X.useLayoutEffect)(()=>{let e=r.state?.[Ht],t=typeof e==`string`?a.current.get(e):void 0;t&&(a.current.delete(e),t())},[r]);let w=Y(i.current.values());(0,X.useEffect)(()=>{if(!w.dirty&&!w.saving)return;let e=e=>{e.preventDefault(),e.returnValue=``};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[w.dirty,w.saving]);let te=()=>{let e=m.current;if(!e)return;let t=e.kind===`close`?[i.current.get(e.id)].filter(e=>!!e):[...i.current.values()];if(t.some(e=>e.saving)){S(),g(!0);return}y(null);for(let e of t)e.dirty&&e.discard();e.kind===`close`?e.close():v.current.state===`blocked`&&v.current.proceed()},T=(0,X.useMemo)(()=>({update:b,remove:x,requestClose:C,navigate:ee}),[b,x,C,ee]);return(0,Z.jsxs)(Gt.Provider,{value:T,children:[e,h&&(0,Z.jsx)(`p`,{role:`status`,className:`fixed right-4 bottom-4 z-[300] rounded-lg border bg-popover p-3 text-sm text-popover-foreground shadow-md`,children:t(`common:unsaved.saving`)}),(0,Z.jsx)(wt,{open:!!d,onOpenChange:e=>{e||S()},children:(0,Z.jsxs)(Ct,{size:`compact`,surface:`confirmation`,showCloseButton:!1,className:`z-[400]`,overlayClassName:`z-[400]`,children:[(0,Z.jsxs)(U,{children:[(0,Z.jsx)(V,{children:t(`common:unsaved.title`)}),(0,Z.jsx)(St,{children:t(`common:unsaved.description`)})]}),(0,Z.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),te()},children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(dt,{type:`button`,variant:`outline`,size:`dialogAction`,onClick:S,autoFocus:!0,children:t(`common:unsaved.keepEditing`)}),(0,Z.jsx)(dt,{type:`submit`,variant:`destructive`,size:`dialogAction`,children:t(`common:unsaved.discard`)})]})})]})})]})}function Ii(){let{t:e}=A();return(0,Z.jsxs)(Pt,{children:[(0,Z.jsx)(`span`,{className:`grid place-items-center`,children:(0,Z.jsx)(ut,{className:`size-6`})}),(0,Z.jsx)(`h2`,{children:e(`navigation:pageLoader.lightingUpThisPage`)}),(0,Z.jsx)(`p`,{children:e(`navigation:pageLoader.bringingTheNeededCapabilitiesIntoPlace`)})]})}async function Li(){window.__PISPER_MOBILE_APP__&&await Se().catch(()=>void 0);let e=new URL(window.location.href);window.__PISPER_MOBILE_APP__&&e.protocol===`http:`&&e.hostname===`127.0.0.1`&&e.searchParams.set(`_pisper_recovery`,String(Date.now())),window.location.replace(e.href)}function Ri(){let e=c(),t=s(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:`页面加载失败`;return(0,Z.jsxs)(`main`,{className:`app-startup flex min-h-[100vh] w-full items-center justify-center gap-2.5 bg-chrome text-[13px] text-content-muted`,role:`alert`,children:[(0,Z.jsx)(`strong`,{className:`font-medium`,children:t}),(0,Z.jsx)(dt,{variant:`secondary`,type:`button`,onClick:()=>void Li(),children:`重新加载`})]})}function $(){return n()}async function zi(){let[{BoardPage:e}]=await Promise.all([i(()=>import(`./BoardPage-BB_xAnQV.js`),__vite__mapDeps([182,5,4,6,15,3,7,8,9,11,37,38,36,39,16,17,18,2,1,19,20,40,41,42,44,43,45,22,183,88,120,136,23,184,105,185,151,99,96,47,48,61,97,59,98,157,101,121,94,52,186,158,187,33,188,106,107,65,66,108,67,109,110,111,56,57,189,190,176,68,58,60,100,154,137,138,139,140,141,29,53,32,142,143,64,144,63,145,146,147,62,103,148,149,85,126,150,155,156,127,123,191,104,35,112,113,114,173,174,175,192])),D()]);function t(e){let{origin:t,pathname:n,search:r,hash:i}=window.location;return i.startsWith(`#/`)?`${t}${n}${r}#${S(e)}`:`${t}${S(e)}`}function n(){let n=$(),r=f();return(0,Z.jsx)(e,{activeSessionId:n.activeSessionId,onOpenSession:e=>r(S(e)),onOpenHistory:()=>n.navigate(`chatHistory`),onConfigureModels:()=>r(`/config/models`),sessionHref:t,notify:n.notify,requestConfirm:n.requestConfirm,requestText:n.requestText,onNewTask:n.startNewTask})}return{Component:n}}async function Bi(){let[{ChatPage:e},{SessionShell:t}]=await Promise.all([i(()=>import(`./ChatPage-C3NC9LNG.js`),__vite__mapDeps([193,5,4,6,7,8,15,3,9,11,38,37,47,48,17,18,2,1,19,20,16,44,45,22,194,195,196,26,138,107,136,21,23,197,198,137,120,139,140,141,29,53,32,142,143,33,65,66,64,67,144,109,110,56,57,63,68,145,108,146,58,60,147,61,62,103,148,149,85,126,150,184,89,199,59,191,200,201,35,41,43,183,175,202,105,203,74,27,204,50,78,186,205,206,55,187,106,111,190,176,123,124,207,208,209,210,211,212,213,113,214,215,10,92,216,217,181,218,219,119,121,122,125,220,221,51,222,223,224,52,80,158,54,82,188,225,226,227,189,97,98,99,155,127,165,115,228,229,230,231,132,171,232,233,180,234,235,12])),i(()=>import(`./SessionShell-wOw-rTQD.js`),__vite__mapDeps([236,5,4,6,35,15,3,7,8,9,11,36,37,38,39,16,17,18,2,1,19,20,40,41,42,45,43,44,134,22,56,57,95,102,100,47,48,59,61,96,97,98,99,101,135,136,137,120,138,107,23,139,140,141,29,53,32,142,143,33,65,66,64,67,144,109,110,63,68,145,108,146,58,60,147,62,103,148,149,85,126,150,74,151,121,152,153,52,79,106,111,154,155,156,127,157,112])),D()]);function n(){return(0,Z.jsx)(t,{context:$(),ChatPage:e})}return{Component:n}}async function Vi(){Bi().catch(()=>void 0);let[{SessionHome:e}]=await Promise.all([i(()=>import(`./SessionHome-CcjiU1fU.js`),__vite__mapDeps([237,5,4,6,35,15,3,7,8,9,11,43,44,45,17,18,2,1,19,134,22,56,57,95,102,100,47,38,48,16,20,41,59,61,96,37,39,97,98,99,101,135,136,137,120,138,107,23,139,140,141,29,53,32,142,143,33,65,66,64,67,144,109,110,63,68,145,108,146,58,60,147,62,103,148,149,85,126,150,74,151,121,152,153,52,79,106,111,154,155,156,127,157,123,112])),D()]);function t(){return(0,Z.jsx)(e,{context:$()})}return{Component:t}}async function Hi(){let{MorePage:e}=await i(async()=>{let{MorePage:e}=await import(`./MorePage-xB2zBRtU.js`);return{MorePage:e}},__vite__mapDeps([238,5,6,15,3,4,7,8,9,11,37,38,2,19,18,20,16,17,1,36,39,40,41,42,45,43,44,22,239,71,26,72,73,23,240,241,76,52,77,78,53,79,81,82,33,188,169,56,57,68,65,58,59,91,60]));function t(){let t=$(),n=f();return(0,Z.jsx)(e,{onOpen:e=>{e.type===`page`?n(ie(e.id)):e.type===`config`?t.setConfigSection(e.id):n(`/tools/components/${encodeURIComponent(e.id)}`)}})}return{Component:t}}async function Ui(){let{ChatHistoryPage:e}=await i(async()=>{let{ChatHistoryPage:e}=await import(`./ChatHistoryPage-BHsZFF4a.js`);return{ChatHistoryPage:e}},__vite__mapDeps([242,5,7,4,6,8,15,3,9,11,37,38,47,48,17,18,2,1,19,43,44,45,22,195,105,141,243,94,29,158,187,188,169,106,107,23,65,66,108,67,109,110,111,56,57,68,59,60,97,62,103,155,123,244,136,21,53,122,33,58,229,230]));function t(){let t=$();return(0,Z.jsx)(e,{navigate:t.navigate,onBack:t.onBackToFeatures,onNewTask:t.startNewTask,notify:t.notify,requestConfirm:t.requestConfirm,requestText:t.requestText})}return{Component:t}}async function Wi(){let{AssetsPage:e}=await i(async()=>{let{AssetsPage:e}=await import(`./AssetsPage-B9lqKmXy.js`);return{AssetsPage:e}},__vite__mapDeps([245,5,6,3,4,7,8,9,15,11,37,38,246,2,19,18,22,89,161,200,221,223,52,29,187,122,33,169,106,107,23,65,66,108,67,109,110,111,56,57,68,60,62,63,64,85,123,244,43,44,45,17,1,136,21,53,58,247,128,84,129,208,209,210,211,212,202,213]));function t(){let t=$();return(0,Z.jsx)(e,{activeSessionId:t.activeSessionId,onBack:t.onBackToFeatures,notify:t.notify,requestConfirm:t.requestConfirm,onUse:t.onUseAsset})}return{Component:t}}async function Gi(){let[{ChannelsPage:e}]=await Promise.all([i(()=>import(`./ChannelsPage-DgzuzmFL.js`),__vite__mapDeps([248,5,6,15,3,4,7,8,9,11,17,18,2,1,19,22,26,161,74,249,51,52,29,250,206,187,122,33,188,169,56,57,68,65,60,62,103,85,149,126,123,244,43,44,45,136,21,53,58,128,84,66,129,173,174,107,175,139,176,108,67,109,110,146,228,227,219,111,229,215])),se()]);function t(){let t=$();return(0,Z.jsx)(e,{notify:t.notify,onBack:t.onBackToFeatures,requestConfirm:t.requestConfirm})}return{Component:t}}async function Ki(){let{BotsPage:e}=await i(async()=>{let{BotsPage:e}=await import(`./public-DsjuTTt0.js`);return{BotsPage:e}},__vite__mapDeps([251,5,4,6,35,15,3,7,8,9,11,2,19,18,183,22,120,73,136,21,23,202,119,16,17,1,20,107,74,121,122,68,57,65,56,63,33,64,66,67,85,123,124,125,249,28,141,52,118,126,127,128,84,129,114,113,130,47,38,48,187,142,252,175,108,217,227,110,189,111,150,173,44,174,139,176,109,146,131,59,132]));function t(){let t=$();return(0,Z.jsx)(e,{notify:t.notify})}return{Component:t}}async function qi(){let[{SchedulesPage:e}]=await Promise.all([i(()=>import(`./SchedulesPage-Diethe4H.js`),__vite__mapDeps([253,5,4,6,15,3,7,8,9,11,17,18,2,1,19,25,22,26,73,197,119,16,20,120,107,23,74,121,122,68,57,65,56,63,33,64,66,67,85,123,124,125,249,224,52,250,187,169,227,110,60,62,103,126,127,244,43,44,45,136,21,53,58,128,84,129,173,174,175,139,176,108,109,146,228,219,111,229,215])),O()]);function t(){let t=$();return(0,Z.jsx)(e,{notify:t.notify,onBack:t.onBackToFeatures,requestConfirm:t.requestConfirm,openNotificationSettings:t.openNotificationSettings})}return{Component:t}}async function Ji(){let[{ConfigPage:e},{ChatAppearancePage:t}]=await Promise.all([i(()=>import(`./ConfigPage-D3SyAsIs.js`),__vite__mapDeps([254,5,4,6,7,8,3,9,15,11,2,19,18,17,1,20,16,45,22,194,164,88,255,25,26,72,107,136,21,49,197,256,202,89,105,161,24,27,28,29,240,152,153,50,51,241,257,224,52,162,186,53,79,206,258,81,54,187,122,143,33,188,65,66,108,252,175,217,56,57,110,111,106,23,67,109,144,63,64,68,174,139,176,146,129,145,227,58,91,60,62,103,85,126,150,123,69,244,43,44,128,84,208,209,210,211,212,213,173,131,59,132,229,228,219,215,232,92,216,259,260,167,179])),i(()=>import(`./ChatAppearancePage-98Sa8ZQW.js`),__vite__mapDeps([261,4,5,6,35,15,3,7,8,9,11])),D(),E()]);function n(){let n=$();return(0,Z.jsx)(e,{notify:n.notify,registerPrimaryAction:n.registerPrimaryAction,invokePrimaryAction:n.invokePrimaryAction,section:n.configSection,onBackToFeatures:n.onBackToFeatures,onBrowserNotificationChange:n.setNotificationSettings,requestConfirm:n.requestConfirm,update:n.appUpdate,renderInterfaceSettings:e=>(0,Z.jsx)(t,{appearance:e})})}return{Component:n}}async function Yi(){let{PluginsPage:e}=await i(async()=>{let{PluginsPage:e}=await import(`./PluginsPage-D0hAMgQ_.js`);return{PluginsPage:e}},__vite__mapDeps([262,5,6,15,3,4,7,8,9,11,17,18,2,1,19,20,16,22,197,263,161,203,264,74,240,265,76,266,53,79,205,187,122,169,65,66,64,67,56,57,68,60,63,33,85,127,123,244,43,44,45,136,21,58,173,174,107,175,139,176,108,109,110,146,228,227,219,111,229,215,233]));function t(){let t=$();return(0,Z.jsx)(e,{notify:t.notify,onBack:t.onBackToFeatures,requestText:t.requestText,requestConfirm:t.requestConfirm})}return{Component:t}}async function Xi(){let{MemoryPage:e}=await i(async()=>{let{MemoryPage:e}=await import(`./MemoryPage-DiO4GHc7.js`);return{MemoryPage:e}},__vite__mapDeps([267,5,4,6,7,8,35,15,3,9,11,2,19,18,22,195,196,105,264,204,140,141,243,94,52,29,78,186,258,187,122,33,169,106,107,23,65,66,108,67,109,110,111,56,57,219,189,68,60,63,64,85,126,123,244,43,44,45,17,1,136,21,53,58,128,84,129,173,174,175,139,176,146,229,228,227,215,268]));function t(){let t=$();return(0,Z.jsx)(e,{onBack:t.onBackToFeatures,notify:t.notify,requestConfirm:t.requestConfirm})}return{Component:t}}async function Zi(){let[{McpPage:e}]=await Promise.all([i(()=>import(`./McpPage-7wR_N0eS.js`),__vite__mapDeps([269,5,6,15,3,4,7,8,9,11,38,37,48,246,2,19,18,107,22,202,90,52,29,78,79,187,143,33,169,227,65,66,110,56,57,68,60,62,63,64,67,126,123,124,244,43,44,45,17,1,136,21,53,122,58])),le()]);function t(){let t=$();return(0,Z.jsx)(e,{notify:t.notify,onBack:t.onBackToFeatures,requestText:t.requestText,requestConfirm:t.requestConfirm})}return{Component:t}}async function Qi(){let[{SkillsPage:e}]=await Promise.all([i(()=>import(`./SkillsPage-CDoMtK-E.js`),__vite__mapDeps([270,5,6,15,3,4,7,8,9,11,17,18,2,1,19,264,22,240,265,52,266,81,187,143,169,225,107,65,66,110,56,57,68,60,123,244,43,44,45,136,21,53,122,33,58,228,227,219,108,111,229,215])),ae()]);function t(){let t=$();return(0,Z.jsx)(e,{activeSessionId:t.activeSessionId,notify:t.notify,onBack:t.onBackToFeatures,requestText:t.requestText,requestConfirm:t.requestConfirm})}return{Component:t}}var $i=Object.freeze({componentFromList:!0});function ea(e){return typeof e==`object`&&!!e&&e.componentFromList===!0}async function ta(){let[{CustomUiPage:e}]=await Promise.all([i(()=>import(`./public-Bq1VrNr8.js`),__vite__mapDeps([271,5,4,6,35,15,3,7,8,9,11,37,38,39,40,2,19,18,41,36,16,17,1,20,42,43,44,45,22,239,255,71,107,136,21,23,256,202,89,105,222,52,78,53,272,205,81,187,33,225,65,66,110,56,57,106,108,67,109,111,84,174,175,139,176,146,227,189,68,58,60,147,64,95,154,137,120,138,140,141,29,32,142,143,144,63,145,61,47,48,62,103,148,149,85,126,150,151,99,96,97,59,98,100,101,155,156,127,135,74,121,152,153,79,102,157,123,69,229,273,226,129,190,274,275])),E()]);function t(){let t=$(),n=f(),i=o(),{componentId:a=``}=r();return(0,Z.jsx)(e,{activeSessionId:t.activeSessionId,notify:t.notify,selectedId:a,onSelect:(e,t)=>{!e&&!t&&ea(i.state)?n(-1):n(te(e),{replace:t||!e,state:e&&!t?$i:void 0})}})}return{Component:t}}async function na(){let[{CustomUiToolPage:e}]=await Promise.all([i(()=>import(`./public-Bq1VrNr8.js`),__vite__mapDeps([271,5,4,6,35,15,3,7,8,9,11,37,38,39,40,2,19,18,41,36,16,17,1,20,42,43,44,45,22,239,255,71,107,136,21,23,256,202,89,105,222,52,78,53,272,205,81,187,33,225,65,66,110,56,57,106,108,67,109,111,84,174,175,139,176,146,227,189,68,58,60,147,64,95,154,137,120,138,140,141,29,32,142,143,144,63,145,61,47,48,62,103,148,149,85,126,150,151,99,96,97,59,98,100,101,155,156,127,135,74,121,152,153,79,102,157,123,69,229,273,226,129,190,274,275])),E()]);function t(){let t=$(),{componentId:n=``}=r();return(0,Z.jsx)(e,{componentId:n,activeSessionId:t.activeSessionId,notify:t.notify})}return{Component:t}}async function ra(){let[{WorkflowsPage:e}]=await Promise.all([i(()=>import(`./WorkflowsPage-CHvyXwCg.js`),__vite__mapDeps([276,5,4,6,35,3,7,8,9,15,11,37,38,2,19,18,17,1,43,44,45,22,183,120,25,26,138,107,136,21,23,197,198,256,202,89,105,264,200,220,277,240,50,249,257,222,223,278,141,224,52,29,162,266,53,250,79,272,32,187,122,82,33,169,106,65,66,108,67,109,110,111,56,57,84,144,63,64,68,226,145,146,227,219,60,147,62,103,85,126,123,124,244,58,128,129,173,174,175,139,176,216,217,179,275,279,280,281])),ce()]);function t(){let t=$();return(0,Z.jsx)(e,{notify:t.notify,onBack:t.onBackToFeatures,requestConfirm:t.requestConfirm})}return{Component:t}}async function ia(){let[{WorkflowBuilder:e}]=await Promise.all([i(()=>import(`./WorkflowsPage-CHvyXwCg.js`),__vite__mapDeps([276,5,4,6,35,3,7,8,9,15,11,37,38,2,19,18,17,1,43,44,45,22,183,120,25,26,138,107,136,21,23,197,198,256,202,89,105,264,200,220,277,240,50,249,257,222,223,278,141,224,52,29,162,266,53,250,79,272,32,187,122,82,33,169,106,65,66,108,67,109,110,111,56,57,84,144,63,64,68,226,145,146,227,219,60,147,62,103,85,126,123,124,244,58,128,129,173,174,175,139,176,216,217,179,275,279,280,281])),ce()]);function t(){let t=$();return(0,Z.jsx)(e,{notify:t.notify,registerWorkflowActions:t.registerWorkflowActions})}return{Component:t}}var aa=t([{element:(0,Z.jsx)(Fi,{children:(0,Z.jsx)(Pi,{routerState:()=>aa.state})}),errorElement:(0,Z.jsx)(Ri,{}),hydrateFallbackElement:(0,Z.jsx)(Ii,{}),children:[{index:!0,lazy:Vi},{path:T.board,lazy:zi},{path:`/board/:sessionId`,lazy:Bi},{path:T.more,lazy:Hi},{path:T.chat,element:(0,Z.jsx)(l,{to:`/`,replace:!0})},{path:T.chatHistory,lazy:Ui},{path:T.assets,lazy:Wi},{path:T.channels,lazy:Gi},{path:T.schedules,lazy:qi},{path:`/bots/:botId?`,lazy:Ki},{path:T.config,lazy:Ji},{path:`/config/:configSection`,lazy:Ji},{path:`/config`,element:(0,Z.jsx)(l,{to:T.config,replace:!0})},{path:T.plugins,lazy:Yi},{path:T.memory,lazy:Xi},{path:T.mcp,lazy:Zi},{path:T.skills,lazy:Qi},{path:`/components/:componentId?`,lazy:ta},{path:`/tools/components/:componentId`,lazy:na},{path:T.workflows,lazy:ra},{path:T.workflowCreate,lazy:ia},{path:`/workflows/:workflowId`,lazy:ia},{path:`*`,element:(0,Z.jsx)(l,{to:`/`,replace:!0})}]}]),oa=()=>{document.documentElement.dataset.pageVisibility=document.visibilityState};oa(),document.addEventListener(`visibilitychange`,oa);var sa=b(window.location.hash);sa&&window.history.replaceState(null,``,`${window.location.pathname}${window.location.search}#${sa}`);var ca=document.getElementById(`root`);if(!ca)throw Error(`Missing #root application mount point`);(0,qn.createRoot)(ca).render((0,Z.jsx)(X.StrictMode,{children:(0,Z.jsxs)(Xn,{children:[(0,Z.jsx)(d,{router:aa}),(0,Z.jsx)(rr,{})]})}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./api-Cm58F7OP.js";import{t}from"./createLucideIcon-Cd-3GVxJ.js";var n=t(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),r={list(){return e(`/api/permission-rules`)},add(t){return e(`/api/permission-rules`,{method:`POST`,body:JSON.stringify(t)})},remove(t){return e(`/api/permission-rules/`+encodeURIComponent(t),{method:`DELETE`})}},i=/[;&|`$<>\n\r\\(){}]/;function a(e){let t=e.trim().replace(/[ \t]+/g,` `);if(!t||i.test(t))return``;let[n,r]=t.split(` `);return n?r&&/^[a-z][\w:-]*$/i.test(r)?`${n} ${r}`:n:``}export{a as n,n as r,r as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/hosts-DljHKUSO.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-router-CSN_DGvx.js","assets/vendor-react-DwNgTV1j.js","assets/index-79gEOxmD.js","assets/index-XwGsScbB.css","assets/routes-DIeaqWVc.js","assets/use-i18n-8V6eRMcE.js","assets/i18n-B7QmqfvO.js","assets/storage-DtvZ_lEu.js","assets/vendor-state-GkUciC5H.js","assets/useQuery-DfOU-27z.js","assets/query-DFQayLF5.js","assets/session-scope-BJIZo6ty.js","assets/http-response-B2n7HFQ4.js","assets/http-DtkTCrZ4.js","assets/abort-signal-f4JsiYKX.js","assets/session-board-status-D2lpFPiI.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/ellipsis-CfGKfbq6.js","assets/grip-vertical-B__LYT0s.js","assets/plus-fQbSqB1n.js","assets/rotate-ccw-C0v8V77_.js","assets/settings-2-CXJjXJS9.js","assets/x-07u4-129.js","assets/dropdown-menu-Ds0gD8S8.js","assets/check-2vYc6QaP.js","assets/chevron-right-C3t2Rckj.js","assets/dist-41X0pdUs.js","assets/dist-BsRXXcSL.js","assets/dist-DzGQ7sLi.js","assets/es2015-DTZdOI9P.js","assets/dist-BRjj4UeB.js","assets/dist-OB2r6Xsr.js","assets/dist-BaBySQmo.js","assets/utils-C8uzG5AZ.js","assets/vendor-ui-DvrYggeS.js","assets/popover-C5U02alK.js","assets/dialog-D23yIdOZ.js","assets/dist-BHkR6BLP.js","assets/button-CCcCN8tE.js","assets/use-studio-actions-BsdfCptK.js","assets/checkbox-BrEHgFV0.js","assets/progress-5odAz3B9.js","assets/separator-BPh_qxvc.js","assets/switch-D_G8wFhs.js","assets/segmented-control-xkrEOP_d.js","assets/tooltip-D4MFbqcG.js","assets/dist-BiRPwy4W.js","assets/kbd-CAufZTkl.js","assets/useSessionListQuery-DtpEX8a5.js","assets/startup-queries-BjjeYiQ8.js","assets/mutation-b4pPvB7p.js","assets/api-Cm58F7OP.js","assets/event-stream-BrDcABQx.js","assets/component-changes-Q9Bf64Ob.js","assets/runtime-capabilities-store-Y9MaywP8.js","assets/runtime-capabilities-CPDBo3tu.js","assets/chat-api-DQyHZl-V.js","assets/session-organization-api-ibzfB8fg.js","assets/events-BgEZwyTb.js","assets/session-questions-94KACguh.js","assets/session-workspaces-Brm-8lHh.js","assets/useNewProjectPicker-Cmw2SOhW.js","assets/FocusRuntimeControls-DeSe12wJ.js","assets/arrow-up-DST6-qVQ.js","assets/braces-DQcXLGFF.js","assets/chevrons-up-down-C2sEPdAh.js","assets/message-square-text-C5MJw0FL.js","assets/pencil-U08v_vV9.js","assets/refresh-cw-TbWxTY4K.js","assets/search-D0mqDaf_.js","assets/square-bHHVTT3G.js","assets/users-CCtFZzwl.js","assets/wrench-6pg6_bqI.js","assets/slider-De8rWVNs.js","assets/dist-BS3ekNDj.js","assets/shortcuts-DRfz9B_B.js","assets/sheet-BTaIEX4w.js","assets/format-DMJQzoZ7.js","assets/StatusGlyph-1KgitlUg.js","assets/run-activity-CwfO0cui.js","assets/input-group-h8z63MzW.js","assets/input-CPw-zkYh.js","assets/textarea-DmATpOqT.js","assets/model-display-kDwvtxrW.js","assets/workspace-order-store-DmEFuNUL.js","assets/useNow-D-gM4IXU.js","assets/card-presentation-1oph2b8P.js","assets/session-change-summary-api-Dp9vVPv_.js","assets/folder-paths-D0-7xV2n.js","assets/pick-system-directory-DS_-qn8W.js","assets/public-Be05c5M9.js","assets/chevron-down-CxtxIjiP.js","assets/folder-open-FIShC5Qk.js","assets/folder-DPM8D8cf.js","assets/useMachines-BBeg2uOZ.js","assets/machines-api-Kg457H3y.js","assets/server-BgNvmqwJ.js","assets/useSidebarModel-DBH3JLQ1.js","assets/board-projects-CeL6PPiY.js","assets/badge-CWB3lj2H.js","assets/safe-mode-instance-CYIRMY5i.js","assets/safe-mode-sentinel-Bq9lNJoA.js","assets/SafeModePrompt-jV-PRvrW.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t}from"./vendor-router-CSN_DGvx.js";import{i as n}from"./vendor-react-DwNgTV1j.js";import{a as r}from"./i18n-B7QmqfvO.js";import{t as i}from"./use-i18n-8V6eRMcE.js";import{r as a,t as o}from"./useQuery-DfOU-27z.js";import{n as s}from"./component-changes-Q9Bf64Ob.js";import{t as c}from"./runtime-capabilities-store-Y9MaywP8.js";import{_ as l,j as u,k as d,n as f,r as p,t as m}from"./session-scope-BJIZo6ty.js";import"./safe-mode-sentinel-Bq9lNJoA.js";var h=e(n(),1);function g(e){return e.id===`*`?[u.all]:e.reason===`instances`?[u.instances()]:[u.catalog(),u.describe(e.id),u.errors(e.id),u.versions(e.id),u.trash(),u.instances()]}function _(e){let t=0,n=null,r=null;return{retain(i){r=i,t+=1,n??=e(e=>{for(let t of g(e))Promise.resolve(r?.invalidateQueries({queryKey:t})).catch(()=>void 0)});let a=!1;return()=>{a||(a=!0,--t,!(t>0)&&(n?.(),n=null,r=null))}},users:()=>t}}var v=_(s);function y(e){let t=a();(0,h.useEffect)(()=>e?v.retain(t):void 0,[t,e])}function b(){return c(e=>e.capabilities.features[`components.native`])}function x(){let e=b();return y(e),o(f(e))}function S(e){return y(e),o(p(e))}function C(){return S(b())}function w(e){let t=b(),n=S(t),r=(0,h.useMemo)(()=>(n.data?.instances??[]).filter(t=>t.surface===e&&t.enabled),[n.data,e]),i=o(f(t&&r.length>0));return{available:t,placed:(0,h.useMemo)(()=>{if(!i.data)return[];let e=new Map(i.data.components.map(e=>[e.id,e])),t=[];for(let n of r){let r=e.get(n.componentId);r?.kind===`native`&&r.status===`ready`&&r.enabled&&t.push({instance:n,component:r})}return t},[r,i.data]),revision:n.data?.revision??null,isLoading:t&&(n.isPending||r.length>0&&i.isPending),error:n.error??i.error??null,refetch:()=>{n.refetch(),r.length&&i.refetch()}}}function T(e,t,n){return e.filter(({instance:e})=>m(e.scope,t)).map(({instance:e,component:t})=>({id:e.instanceId,label:e.title||t.manifest?.i18n[n]?.name||t.name}))}function E(){let e=S(b());return(0,h.useMemo)(()=>(e.data?.instances??[]).filter(e=>e.enabled).length,[e.data])}function D(){let{language:e}=i(),t=w(`feature-page`),n=(0,h.useMemo)(()=>t.placed.map(({instance:t,component:n})=>({instanceId:t.instanceId,componentId:n.id,name:n.manifest?.i18n[e]?.name||n.name,description:n.manifest?.i18n[e]?.description||n.description,icon:n.manifest?.icon||``})),[e,t.placed]);return{...t,items:n}}var O=()=>Promise.all([t(()=>import(`./hosts-DljHKUSO.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103])),r()]).then(([e])=>e),k=(0,h.lazy)(()=>O().then(e=>({default:e.ComponentHost}))),A=(0,h.lazy)(()=>O().then(e=>({default:e.FloatingComponents}))),j=(0,h.lazy)(()=>Promise.all([t(()=>import(`./SafeModePrompt-jV-PRvrW.js`),__vite__mapDeps([104,1,3,7,8,2,4,5,9,10,40,36,28,35,38,24,18,39,29,31,102,103])),r()]).then(([e])=>({default:e.SafeModePrompt})));function M(){let e=a();return async()=>{let t=(await l()).components.filter(e=>e.kind===`native`&&e.enabled),n=await Promise.allSettled(t.map(e=>d(e.id,!1)));return e.invalidateQueries({queryKey:u.all}),n.every(e=>e.status===`fulfilled`)}}var N=(0,h.lazy)(()=>O().then(e=>({default:e.OverviewComponents}))),P=(0,h.lazy)(()=>O().then(e=>({default:e.SessionPanelComponent}))),F=(0,h.lazy)(()=>O().then(e=>({default:e.SessionComponentAddMenu})));export{F as a,x as c,b as d,M as f,j as i,C as l,D as m,A as n,P as o,E as p,N as r,T as s,k as t,w as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{a as r,n as i}from"./dist-41X0pdUs.js";import{c as a,i as o,n as s,o as c,r as l,s as u}from"./dist-BsRXXcSL.js";import{a as d,i as f,n as p,r as m,s as h,t as g}from"./es2015-DTZdOI9P.js";import{a as _,i as v,r as y,t as b}from"./dist-BRjj4UeB.js";import{t as x}from"./utils-C8uzG5AZ.js";import{c as S}from"./dialog-D23yIdOZ.js";var C=e(t(),1),w=n(),T=Object.defineProperty,E=(e,t)=>T(e,`name`,{value:t,configurable:!0}),D=`Popover`,[O,ee]=u(D,[_]),k=_(),[A,j]=O(D),M=E(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:c=!1}=e,l=k(t),u=C.useRef(null),[d,f]=C.useState(!1),[p,m]=o({prop:r,defaultProp:i??!1,onChange:a,caller:D});return(0,w.jsx)(v,{...l,children:(0,w.jsx)(A,{scope:t,contentId:s(),triggerRef:u,open:p,onOpenChange:m,onOpenToggle:C.useCallback(()=>m(e=>!e),[m]),hasCustomAnchor:d,onCustomAnchorAdd:C.useCallback(()=>f(!0),[]),onCustomAnchorRemove:C.useCallback(()=>f(!1),[]),modal:c,children:n})})},`Popover`),N=`PopoverTrigger`,P=C.forwardRef(E(function(e,t){let{__scopePopover:n,...i}=e,o=j(N,n),s=k(n),l=r(t,o.triggerRef),u=(0,w.jsx)(a.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":G(o.open),...i,ref:l,onClick:c(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?u:(0,w.jsx)(b,{asChild:!0,...s,children:u})},`PopoverTrigger`)),F=`PopoverPortal`,[I,L]=O(F,{forceMount:void 0}),R=E(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=j(F,t);return(0,w.jsx)(I,{scope:t,forceMount:n,children:(0,w.jsx)(l,{present:n||a.open,children:(0,w.jsx)(f,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),z=`PopoverContent`,B=C.forwardRef(E(function(e,t){let n=L(z,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=j(z,e.__scopePopover);return(0,w.jsx)(l,{present:r||a.open,children:a.modal?(0,w.jsx)(H,{...i,ref:t}):(0,w.jsx)(U,{...i,ref:t})})},`PopoverContent`)),V=i(`PopoverContent.RemoveScroll`),H=C.forwardRef(E(function(e,t){let n=j(z,e.__scopePopover),i=C.useRef(null),a=r(t,i),o=C.useRef(!1);return C.useEffect(()=>{let e=i.current;if(e)return g(e)},[]),(0,w.jsx)(p,{as:V,allowPinchZoom:!0,children:(0,w.jsx)(W,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:c(e.onCloseAutoFocus,e=>{e.preventDefault(),o.current||n.triggerRef.current?.focus()}),onPointerDownOutside:c(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;o.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:c(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),U=C.forwardRef(E(function(e,t){let n=j(z,e.__scopePopover),r=C.useRef(!1),i=C.useRef(!1);return(0,w.jsx)(W,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),W=C.forwardRef(E(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...f}=e,p=j(z,n),g=k(n);return m(),(0,w.jsx)(d,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,w.jsx)(h,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>p.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,w.jsx)(y,{"data-state":G(p.open),role:`dialog`,id:p.contentId,...g,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})},`PopoverContentImpl`));function G(e){return e?`open`:`closed`}E(G,`getState`);var K=M,q=P,J=R,Y=B;function X({modal:e=!1,...t}){return(0,w.jsx)(K,{"data-slot":`popover`,modal:e,...t})}function Z({...e}){return(0,w.jsx)(q,{"data-slot":`popover-trigger`,...e})}function Q({className:e,align:t=`center`,sideOffset:n=8,alignOffset:r=t===`center`?0:-5,collisionPadding:i=20,portalContainer:a,...o}){let s=C.useContext(S);return(0,w.jsx)(J,{container:a===void 0?s??void 0:a,children:(0,w.jsx)(Y,{"data-slot":`popover-content`,align:t,sideOffset:n,alignOffset:r,collisionPadding:i,className:x(`z-[200] flex max-h-(--radix-popover-content-available-height) w-72 max-w-[calc(100vw-40px)] origin-(--radix-popover-content-transform-origin) flex-col gap-2.5 overflow-y-auto overscroll-contain rounded-md bg-popover p-2.5 text-sm text-popover-foreground shadow-float outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...o})})}function $({className:e,...t}){return(0,w.jsx)(`div`,{"data-slot":`popover-title`,className:x(`font-medium`,e),...t})}export{Z as i,Q as n,$ as r,X as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/public-folder-dialog-Dnmn6DIU.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-8V6eRMcE.js","assets/i18n-B7QmqfvO.js","assets/vendor-router-CSN_DGvx.js","assets/index-79gEOxmD.js","assets/index-XwGsScbB.css","assets/storage-DtvZ_lEu.js","assets/vendor-state-GkUciC5H.js","assets/server-BgNvmqwJ.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/triangle-alert-CE1q54ci.js","assets/button-CCcCN8tE.js","assets/vendor-ui-DvrYggeS.js","assets/dist-41X0pdUs.js","assets/utils-C8uzG5AZ.js","assets/dialog-D23yIdOZ.js","assets/x-07u4-129.js","assets/dist-BHkR6BLP.js","assets/dist-BsRXXcSL.js","assets/es2015-DTZdOI9P.js","assets/input-CPw-zkYh.js","assets/machines-api-Kg457H3y.js","assets/http-response-B2n7HFQ4.js","assets/http-DtkTCrZ4.js","assets/abort-signal-f4JsiYKX.js","assets/alert-DRIrgNI4.js","assets/field-DoLEb0np.js","assets/label-CVWjEcfV.js","assets/separator-BPh_qxvc.js","assets/machine-messages-Bd6JwiOe.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t,u as n}from"./vendor-router-CSN_DGvx.js";import{i as r,r as i}from"./vendor-react-DwNgTV1j.js";import{t as a}from"./use-i18n-8V6eRMcE.js";import{t as o}from"./useQuery-DfOU-27z.js";import{a as s,i as c,o as l}from"./startup-queries-BjjeYiQ8.js";import{i as u}from"./http-response-B2n7HFQ4.js";import{n as d}from"./http-DtkTCrZ4.js";import{t as f}from"./runtime-capabilities-store-Y9MaywP8.js";import{t as ee}from"./chevron-down-CxtxIjiP.js";import{o as p}from"./FocusRuntimeControls-DeSe12wJ.js";import{t as m}from"./folder-open-FIShC5Qk.js";import{i as h,n as g,t as _}from"./workspace-order-store-DmEFuNUL.js";import{t as v}from"./folder-DPM8D8cf.js";import{n as y,t as te}from"./useMachines-BBeg2uOZ.js";import{t as b}from"./plus-fQbSqB1n.js";import{t as x}from"./server-BgNvmqwJ.js";import{a as S,c as C,i as w,o as ne,p as re,r as ie,s as T,t as ae}from"./dropdown-menu-Ds0gD8S8.js";import{t as E}from"./utils-C8uzG5AZ.js";import{u as D}from"./events-BgEZwyTb.js";import{t as O}from"./chat-api-DQyHZl-V.js";import{_ as k,d as A,l as j,t as M,u as N,v as P,x as F,y as I}from"./useSessionListQuery-DtpEX8a5.js";import"./useNow-D-gM4IXU.js";import{a as oe,i as se,n as L,t as ce}from"./useNewProjectPicker-Cmw2SOhW.js";import{a as le}from"./card-presentation-1oph2b8P.js";import"./useSidebarModel-DBH3JLQ1.js";import{o as R}from"./format-DMJQzoZ7.js";import{r as z,t as B}from"./board-projects-CeL6PPiY.js";var V=e(r(),1),H=class extends Error{stage;cause;sessionId;code=`board_launch_failed`;constructor(e,t,n=``){super(t instanceof Error?t.message:String(t||`launch failed`)),this.stage=e,this.cause=t,this.sessionId=n}},U=1e5,W=5e3;function G(e){if(!e||typeof e!=`object`)return!1;let t=e;return Array.isArray(t.messages)&&t.messages.length===0&&t.streaming===!1&&t.configurationBusy!==!0&&(t.queuedInputs===void 0||Array.isArray(t.queuedInputs)&&t.queuedInputs.length===0)}function K(e){return e instanceof u?`${e.kind||`error`}:${e.status??`-`}`:`error`}async function q(e){let t=`/api/sessions/${encodeURIComponent(e)}`;try{if(!G(await O.getLiveSession(e,{timeout:W})))return!1;await d(t,{method:`DELETE`,timeout:W})}catch(e){return console.warn(`[board] 派发失败后未能清理空会话(${K(e)})`),!1}return s.setQueryData(j,t=>t&&{...t,sessions:t.sessions.filter(t=>t.id!==e)}),D({deletedIds:[e]}),!0}function J(e){s.setQueryData(j,t=>t&&!t.sessions.some(t=>t.id===e.id)?{...t,sessions:[e,...t.sessions]}:t),c(`sessions`)}function ue(e){let t=e.indexOf(`/`);return t>0?{provider:e.slice(0,t),modelId:e.slice(t+1)}:null}async function de(e,t,n){let r=ue(n.model);r&&n.model!==t.model&&await O.updateModel(e,r.provider,r.modelId),n.thinkingLevel&&n.thinkingLevel!==t.thinkingLevel&&await O.setThinkingLevel(e,n.thinkingLevel),n.executionMode&&n.executionMode!==t.executionMode&&await O.updateExecutionMode(e,n.executionMode),n.runMode!==`plan`&&n.runMode!==t.runMode&&await O.updateRunMode(e,n.runMode)}async function fe(e){if(!e.prompt.trim().slice(0,U))throw new H(`create`,Error(`empty prompt`));let t;try{t=await O.createSession(``,e.cwd,{projectless:e.projectless===!0,machine:e.machine??null})}catch(e){throw new H(`create`,e)}let n=t.id;try{await de(n,t,e)}catch(e){throw await q(n),new H(`configure`,e,n)}return{session:t}}var pe=/^\/[a-z][a-z0-9:-]{0,63}$/;async function me(e){let{sessionId:t}=e,n=e.prompt.trim().slice(0,U);if(!t||!n)throw new H(`send`,Error(`empty prompt`),t);let r=e.commandWhenEmpty?.trim()??``;if(r&&!pe.test(r))throw new H(`send`,Error(`invalid command`),t);let i;try{i=await O.getLiveSession(t)}catch(e){throw new H(`send`,e,t)}let a=i&&typeof i==`object`?i:{},o=Array.isArray(a.messages)&&a.messages.length===0&&r?`${r} ${n}`:n,l=async()=>{try{await O.queueInput(t,o,[],`followUp`)}catch(e){throw new H(`send`,e,t)}return{sessionId:t,queued:!0}};if(a.streaming===!0)return l();e.created?.id===t?J({...e.created,firstMessage:n,messageCount:1}):s.getQueryData(j)?.sessions.some(e=>e.id===t)||c(`sessions`);let u=A(t,{streaming:!0});try{await F(t,`launch`,(e,n)=>O.openStream({sessionId:t,message:o,attachments:[],goalMode:!1,teamMode:!1},e,{signal:n}))}catch(e){if(k(t,u),e instanceof N)return l();throw I().catch(()=>void 0),new H(`send`,e,t)}return P(t,e=>!!e).catch(()=>void 0).finally(()=>k(t,u)),{sessionId:t,queued:!1}}function Y(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function X(e){return typeof e==`string`?e:``}function he(e){return(Array.isArray(Y(e).providers)?Y(e).providers:[]).flatMap(e=>{let t=Y(e),n=X(t.id);return!n||t.configured!==!0||t.enabled===!1?[]:(Array.isArray(t.models)?t.models:[]).flatMap(e=>{let r=Y(e),i=X(r.id);return!i||r.kind!==`chat`?[]:[{key:`${n}/${i}`,label:X(r.name)||i,providerName:X(t.name)||n,thinkingLevels:Array.isArray(r.thinkingLevels)?r.thinkingLevels.filter(e=>typeof e==`string`):[]}]})})}function Z(){let e=o(l(`config`)),t=M(),n=_(e=>e.names),r=g(e=>e.projects),i=f(e=>e.capabilities.features),a=(0,V.useMemo)(()=>he(e.data),[e.data]),s=e.data?.provider&&e.data?.model?`${e.data.provider}/${e.data.model}`:``,c=t.data?.sessions,u=(0,V.useMemo)(()=>z(c??[],r,n),[c,n,r]),d=(0,V.useMemo)(()=>B(c??[],u),[c,u]);return{models:a,defaultModel:s,defaultThinkingLevel:X(e.data?.thinkingLevel)||`medium`,projects:u,defaultCwd:d,goalsAvailable:i.goals!==!1,teamAvailable:i.goals!==!1&&i.multiAgent!==!1,loading:e.isPending,error:e.error??null}}var Q=i(),ge=(0,V.lazy)(()=>t(()=>import(`./public-folder-dialog-Dnmn6DIU.js`).then(e=>({default:e.MachineFolderDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]))),$=`\0no-project`;function _e(e){return e===`full-access`||L.includes(e)}function ve(e){return e===`plan`||e===`goal`||e===`team`}function ye({onError:e}){let{t,language:r}=a(),i=n(),o=Z(),s=te(),[c,l]=(0,V.useState)(null),u=se(),[d,g]=(0,V.useState)(!1),_=(0,V.useRef)(null),D=ce({onProjectChosen:()=>void 0,onError:e}),O=f(e=>e.capabilities.features.workspaceFolders),k=o.models.some(e=>e.key===u.model),A=k?u.model:o.defaultModel,j=o.models.find(e=>e.key===A)?.thinkingLevels??[],M=j.includes(u.thinkingLevel)?u.thinkingLevel:``,N=M||(j.includes(o.defaultThinkingLevel)?o.defaultThinkingLevel:``),P=d?`full-access`:u.executionMode||`approval-required`,F=u.runMode===`team`&&!o.teamAvailable||u.runMode===`goal`&&!o.goalsAvailable?`plan`:u.runMode,I=(0,V.useMemo)(()=>{if(!u.cwd||o.projects.some(e=>e.cwd===u.cwd))return o.projects;let e=u.cwd.replace(/[\\/]+$/,``).split(/[\\/]/).pop()||u.cwd;return[{key:u.cwd,cwd:u.cwd,label:e},...o.projects]},[u.cwd,o.projects]),L=(0,V.useMemo)(()=>le(I),[I]),z=u.projectless,B=!!u.machineId,H=s.machines.find(e=>e.id===u.machineId),{rememberLaunch:U}=u;(0,V.useEffect)(()=>{B&&s.loaded&&!H&&U({machineId:``,machineCwd:``})},[H,B,s.loaded,U]);let W=B||z?``:u.cwd||o.defaultCwd||I[0]?.cwd||``,G=B||z?void 0:I.find(e=>e.cwd===W),K=`${H?.name??``}:${R(u.machineCwd,r)}`,q=B?K:G?.label||t(z?`board:launch.noProject`:`board:launch.defaultProject`),J=t(`board:launch.projectLabel`,{project:G?L.get(G.key)?`${G.label} (${L.get(G.key)})`:G.label:q});return{cwd:W,model:A,thinkingLevel:N,availableThinkingLevels:j,executionMode:P,runMode:F,onModelChange:e=>u.rememberLaunch({model:e,thinkingLevel:``}),onThinkingLevelChange:e=>u.rememberLaunch({thinkingLevel:e}),onExecutionModeChange:e=>_e(e)?(g(e===`full-access`),e!==`full-access`&&u.rememberLaunch({executionMode:e}),!0):!1,onRunModeChange:e=>ve(e)?(u.rememberLaunch({runMode:e}),!0):!1,renderProjectControl:e=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(ae,{children:[(0,Q.jsx)(re,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:e===`header`?`relative inline-flex h-6 max-w-full min-w-0 cursor-pointer items-center gap-1 rounded-full px-2 text-xs leading-4 text-content-muted outline-none after:absolute after:-inset-x-1 after:-inset-y-2.5 after:content-[""] focus-visible:outline-2 focus-visible:outline-focus active:bg-surface-hover aria-expanded:bg-surface-hover`:E(p,`max-w-[24ch] max-[650px]:max-w-[14ch]`),title:B?`${H?.name??``}:${u.machineCwd}`:G?.cwd||void 0,"aria-label":J,"data-new-task-project":B?`machine:${u.machineId}`:z?`none`:W||`default`,children:[B?(0,Q.jsx)(x,{size:e===`header`?12:14,className:`shrink-0`,"aria-hidden":`true`}):(0,Q.jsx)(v,{size:e===`header`?12:14,className:`shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:E(`min-w-0 truncate`,(G?.label||B)&&`font-mono`),children:q}),(0,Q.jsx)(ee,{size:e===`header`?12:14,className:E(`shrink-0 opacity-70`,e===`chip`&&`max-[650px]:hidden`),"aria-hidden":`true`})]})}),(0,Q.jsxs)(ie,{align:e===`header`?`center`:`start`,side:e===`header`?`bottom`:`top`,className:`max-h-[min(24rem,var(--radix-dropdown-menu-content-available-height))] w-64 overflow-y-auto`,onCloseAutoFocus:e=>{let t=_.current;t&&(_.current=null,e.preventDefault(),t())},children:[(0,Q.jsxs)(ne,{value:B?``:z?$:W,onValueChange:e=>u.rememberLaunch(e===$?{projectless:!0}:{cwd:e}),children:[(0,Q.jsx)(T,{value:$,children:(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t(`board:launch.noProject`)})}),(0,Q.jsx)(C,{}),(0,Q.jsx)(S,{children:t(`board:launch.projects`)}),I.length===0&&(0,Q.jsx)(T,{value:``,children:t(`board:launch.defaultProject`)}),I.map(e=>(0,Q.jsxs)(T,{value:e.cwd,title:e.cwd,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e.label}),L.get(e.key)&&(0,Q.jsx)(`span`,{className:`ml-auto min-w-0 truncate pl-2 font-mono text-xs text-content-muted`,children:L.get(e.key)})]},e.key))]}),(0,Q.jsx)(C,{}),(0,Q.jsxs)(w,{disabled:D.picking,"data-launch-new-project":!0,onSelect:()=>_.current=()=>void D.newProject(),children:[(0,Q.jsx)(m,{"aria-hidden":`true`}),t(`board:launch.chooseFolder`)]}),O&&(0,Q.jsxs)(w,{"data-launch-new-folder":!0,onSelect:()=>_.current=()=>D.newFolder(W||o.defaultCwd),children:[(0,Q.jsx)(h,{"aria-hidden":`true`}),t(`board:launch.newFolder`)]}),s.available&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(C,{}),(0,Q.jsx)(S,{children:t(`board:launch.machines`)}),s.machines.map(e=>(0,Q.jsxs)(w,{"data-launch-machine":e.id,onSelect:()=>_.current=()=>l(e),children:[e.kind===`ssh`?(0,Q.jsx)(x,{"aria-hidden":`true`}):(0,Q.jsx)(y,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:E(`ml-auto size-2 flex-none rounded-full`,e.online?`bg-success`:`bg-content-faint`)})]},e.id)),(0,Q.jsxs)(w,{"data-launch-add-machine":!0,onSelect:()=>i(`/config/remote-access`),children:[(0,Q.jsx)(b,{"aria-hidden":`true`}),t(`board:launch.addMachine`)]})]})]})]}),(0,Q.jsx)(oe,{picker:D.picker,folderDialog:D.folderDialog}),c&&(0,Q.jsx)(V.Suspense,{fallback:null,children:(0,Q.jsx)(ge,{machine:c,initialCwd:c?.id===u.machineId?u.machineCwd:c?.defaultCwd??``,onOpenChange:e=>{e||l(null)},onChosen:(e,t)=>{U({machineId:e.id,machineCwd:t}),l(null)}})})]}),prepare:e=>fe({prompt:e,cwd:W,projectless:z,machine:B?{id:u.machineId,cwd:u.machineCwd}:null,model:k?A:``,thinkingLevel:M,executionMode:P,runMode:F}),onSent:()=>{g(!1)}}}export{me as n,ye as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/public-diff-4sBkfeo8.js","assets/GitDiffViewer-hHSTzUJk.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-8V6eRMcE.js","assets/i18n-B7QmqfvO.js","assets/vendor-router-CSN_DGvx.js","assets/index-79gEOxmD.js","assets/index-XwGsScbB.css","assets/storage-DtvZ_lEu.js","assets/vendor-state-GkUciC5H.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/x-07u4-129.js","assets/utils-C8uzG5AZ.js","assets/vendor-ui-DvrYggeS.js","assets/button-CCcCN8tE.js","assets/dist-41X0pdUs.js","assets/events-BgEZwyTb.js","assets/esm-DCV8yILT.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t,l as n,n as r,u as i}from"./vendor-router-CSN_DGvx.js";import{i as a,r as o}from"./vendor-react-DwNgTV1j.js";import{f as s,o as c,r as l}from"./routes-DIeaqWVc.js";import{t as u}from"./use-i18n-8V6eRMcE.js";import{r as d,t as f}from"./useQuery-DfOU-27z.js";import{n as p}from"./component-changes-Q9Bf64Ob.js";import{T as m,g as h,i as g,j as _,n as v,o as y,v as b}from"./session-scope-BJIZo6ty.js";import{c as x,d as S,l as C,t as w,u as T}from"./placements-BMxzzGTX.js";import{t as ee}from"./usePhoneShell-DRZTDDgZ.js";import{t as E}from"./createLucideIcon-Cd-3GVxJ.js";import{t as te}from"./app-window-CPNdvYNt.js";import{t as D}from"./arrow-up-right-B6l8qFZz.js";import{t as O}from"./blocks-Olsdp5Lp.js";import{t as ne}from"./check-2vYc6QaP.js";import{t as re}from"./chevron-down-CxtxIjiP.js";import{t as ie}from"./chevron-left-BAtyp3_6.js";import{t as ae}from"./chevron-right-C3t2Rckj.js";import{t as k}from"./code-xml-BrUXrBax.js";import{t as oe}from"./copy-DHmIFc52.js";import{t as se}from"./download-BCfIiuaL.js";import{t as ce}from"./ellipsis-CfGKfbq6.js";import{t as le}from"./panel-right-BSUtqUd8.js";import{t as ue}from"./plus-fQbSqB1n.js";import{t as de}from"./rotate-ccw-clock-CO6Bw-sF.js";import{t as fe}from"./search-D0mqDaf_.js";import{t as A}from"./settings-2-CXJjXJS9.js";import{t as pe}from"./shield-alert-oZqX6MNu.js";import{t as me}from"./sparkles-S_eeuqn9.js";import{t as j}from"./trash-2-CNrPOoPR.js";import{t as he}from"./x-07u4-129.js";import{t as ge}from"./checkbox-BrEHgFV0.js";import{a as _e,c as ve,i as M,p as ye,r as be,t as xe}from"./dropdown-menu-Ds0gD8S8.js";import{t as Se}from"./label-CVWjEcfV.js";import{a as N,i as Ce,n as we,r as Te,t as Ee}from"./select-Bbk9bmXO.js";import{t as De}from"./switch-D_G8wFhs.js";import{t as P}from"./segmented-control-xkrEOP_d.js";import{t as F}from"./utils-C8uzG5AZ.js";import{r as Oe,t as I}from"./button-CCcCN8tE.js";import{t as ke}from"./kbd-CAufZTkl.js";import{t as Ae}from"./shortcuts-DRfz9B_B.js";import{a as je,i as Me,n as Ne,o as Pe,r as Fe,t as Ie}from"./sheet-BTaIEX4w.js";import{t as Le}from"./sidebar-store-BvZAgxJg.js";import{s as Re}from"./useNewProjectPicker-Cmw2SOhW.js";import{a as ze,n as Be}from"./format-DMJQzoZ7.js";import{a as L,i as R,l as z,n as Ve,o as B,s as V,t as H}from"./dialog-D23yIdOZ.js";import{t as U}from"./input-CPw-zkYh.js";import{t as He}from"./textarea-DmATpOqT.js";import"./public-Be05c5M9.js";import{n as W,t as G}from"./PageState-Cz6vFMXv.js";import{t as K}from"./useOverlayFocusReturn-NkxBSSjb.js";import{t as Ue}from"./badge-CWB3lj2H.js";import{A as We,B as Ge,C as Ke,F as qe,G as Je,H as Ye,J as Xe,K as Ze,L as Qe,M as $e,N as et,P as tt,Q as nt,R as q,S as rt,T as it,U as at,V as ot,W as st,X as ct,Y as lt,Z as ut,_ as dt,a as ft,b as pt,c as mt,f as ht,g as gt,h as _t,i as J,j as vt,k as yt,l as bt,m as xt,n as St,o as Ct,p as Y,q as wt,r as Tt,s as Et,t as Dt,u as Ot,v as kt,w as At,x as jt,y as Mt,z as Nt}from"./use-studio-actions-BsdfCptK.js";import{t as X}from"./PageFrame-DNwGZ-Dz.js";var Pt=E(`file-archive`,[[`path`,{d:`M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5`,key:`4pqfef`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 12v-1`,key:`1ej8lb`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`path`,{d:`M8 7V6`,key:`1nbb54`}],[`circle`,{cx:`8`,cy:`20`,r:`2`,key:`ckkr5m`}]]),Ft=E(`git-compare`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`path`,{d:`M11 18H8a2 2 0 0 1-2-2V9`,key:`19pyzm`}]]),It=E(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),Z=e(a(),1);function Lt(){let e=null,t=new Set;return{set(n){let r=Math.round(n*10)/10;if(r!==e){e=r;for(let e of[...t])e()}},get:()=>e,subscribe(e){return t.add(e),()=>{t.delete(e)}}}}var Q=o();function Rt({manifest:e,target:t,window:n,phone:r=!1,onTarget:i,onWindow:a}){let{t:o}=u(),s=Mt(e);return(0,Q.jsxs)(`div`,{"data-studio-preview-bar":!0,className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2 text-xs text-content-muted`,children:[(0,Q.jsx)(`span`,{className:F(r&&`sr-only`),children:o(`custom-ui:studio.previewPlacement`)}),(0,Q.jsx)(P,{size:`sm`,"aria-label":o(`custom-ui:studio.previewPlacement`),value:t,onValueChange:i,className:F(`max-w-full overflow-x-auto`,r&&`w-full`),options:s.map(e=>({value:e,label:ft(e,o)}))}),!r&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`ml-auto`,children:o(`custom-ui:studio.previewWindow`)}),(0,Q.jsx)(P,{size:`sm`,"aria-label":o(`custom-ui:studio.previewWindow`),value:n,onValueChange:a,options:[{value:`standard`,label:o(`custom-ui:studio.windowStandard`)},{value:`min`,label:o(`custom-ui:studio.windowMin`)}]}),(0,Q.jsx)(`span`,{className:`rounded-sm border border-stroke px-2 py-1 text-content-secondary`,title:o(`custom-ui:studio.themeFollowHint`),children:o(`custom-ui:studio.themeFollow`)})]})]})}function zt({activeSessionId:e=``,row:t,target:n,window:r,instanceId:i,title:a,props:o,phone:s=!1,notify:c,commits:l}){let{t:d}=u(),f=Ot(t,c),p=kt(n,t.manifest,s?`standard`:r),m=At(n),h=p.width===`fill`||s?`100%`:p.width,g=p.width===`fill`||s&&m===`overview-card`?`100%`:p.width,_=p.height===`fill`;return(0,Q.jsxs)(`div`,{"data-component-preview":!0,"data-component-preview-target":n,className:F(`flex min-h-0 min-w-0 flex-1 flex-col gap-2 overflow-auto rounded-[var(--r-lg)] border border-stroke bg-surface-subtle bg-[radial-gradient(var(--stroke-strong)_1px,transparent_1px)] [background-size:16px_16px]`,s?`min-h-[min(420px,55dvh)] p-3`:`p-5`),children:[(0,Q.jsxs)(`p`,{className:`flex flex-none items-baseline gap-2 text-xs text-content-muted`,children:[(0,Q.jsx)(`span`,{className:`text-content-secondary`,children:J(m,d)}),p.label&&(0,Q.jsx)(`span`,{"data-component-preview-size":!0,className:`font-mono tabular-nums`,children:s&&m===`overview-card`?p.label.split(` · `)[0]:p.label})]}),(0,Q.jsx)(`div`,{"data-component-preview-frame":!0,className:F(`flex min-w-0 flex-col overflow-hidden rounded-[var(--r-lg)] bg-panel shadow-edge ring-1 ring-stroke`,_?`min-h-[320px] flex-1`:`flex-none`),style:{width:h,maxWidth:g,minWidth:s||p.width===`fill`?void 0:p.width,height:_?void 0:p.height},children:(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(We,{component:t,instance:{instanceId:i??`preview:${t.id}`,surface:m,title:a,props:o,size:Ke(n)},preview:!0,session:e?{id:e,title:``,cwd:``,status:`idle`}:void 0,notify:e=>c(e),onRequestFix:f,onCommitSample:e=>l.set(e),className:`h-full animate-[fade-in_120ms_var(--ease-enter)] [:root[data-motion=reduced]_&]:animate-none motion-reduce:[:root:not([data-motion=full])_&]:animate-none`},`${t.id}@${t.rev}:${n}:${i??``}`)})})]})}function Bt({componentId:e,errors:t,commits:n}){let{t:r}=u(),i=(0,Z.useSyncExternalStore)(n.subscribe,n.get,n.get),a=qe(),o=(0,Z.useSyncExternalStore)(a.subscribe,()=>a.reloadRecommended(e),()=>!1),s=(0,Z.useMemo)(()=>t?.entries.filter(e=>e.level===`error`).length??0,[t]),c=Object.keys(t?.network.hosts??{});return(0,Q.jsxs)(`p`,{"data-studio-status":!0,className:`flex min-w-0 flex-none flex-wrap items-center gap-x-3 gap-y-1 text-xs text-content-muted`,children:[(0,Q.jsx)(`span`,{"data-studio-status-errors":!0,className:F(s>0&&`text-content`),children:r(`custom-ui:studio.statusErrors`,{count:s})}),(0,Q.jsx)(`span`,{className:`font-mono tabular-nums`,children:i===null?r(`custom-ui:studio.statusRenderNone`):r(`custom-ui:studio.statusRender`,{ms:i})}),(0,Q.jsxs)(`span`,{className:`min-w-0 truncate`,children:[r(`custom-ui:studio.statusNetwork`,{count:t?.network.count??0}),c.length>0&&(0,Q.jsxs)(`span`,{className:`font-mono`,children:[` · `,c.slice(0,3).join(`, `)]})]}),o&&(0,Q.jsx)(`span`,{className:`text-content`,children:r(`custom-ui:studio.reloadRecommended`)}),(0,Q.jsx)(`span`,{className:`ml-auto`,children:r(`custom-ui:studio.statusHotReload`)})]})}function Vt({onCreate:e,phone:t=!1,className:n}){let{t:r}=u(),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(``),[d,f]=(0,Z.useState)(!1),p=(0,Z.useRef)(null),m=K(i,p),h=(0,Z.useId)(),g=(0,Z.useId)(),_=async(t,n,r)=>{f(!0);try{await e(t,n,r)&&(a(!1),s(``),l(``))}finally{f(!1)}},v=o.trim(),y=c.trim(),b=()=>{v&&_(`blank`,v,y||void 0)},x=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Se,{htmlFor:h,className:`-mb-1.5 text-xs text-content-secondary`,children:r(`custom-ui:studio.componentName`)}),(0,Q.jsx)(U,{id:h,autoFocus:!0,value:o,maxLength:120,placeholder:r(`custom-ui:studio.componentNamePlaceholder`),"data-component-new-name":!0,className:t?`min-h-11`:void 0,onChange:e=>s(e.target.value)}),(0,Q.jsx)(Se,{htmlFor:g,className:`-mb-1.5 text-xs text-content-secondary`,children:r(`custom-ui:agent.newPromptLabel`)}),(0,Q.jsx)(He,{id:g,rows:3,value:c,maxLength:Et,placeholder:r(`custom-ui:agent.newPromptPlaceholder`),"data-component-new-prompt":!0,className:`max-h-48 resize-none`,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key!==`Enter`||!(e.metaKey||e.ctrlKey)||e.nativeEvent.isComposing||(e.preventDefault(),b())}})]}),S=r(y?`custom-ui:agent.createAndGenerate`:`custom-ui:studio.create`);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(xe,{children:[(0,Q.jsx)(ye,{asChild:!0,children:(0,Q.jsxs)(I,{ref:p,size:`sm`,variant:`secondary`,disabled:d,"data-component-new":!0,className:F(n),children:[(0,Q.jsx)(ue,{}),r(`custom-ui:studio.new`),(0,Q.jsx)(re,{className:`text-content-muted`})]})}),(0,Q.jsxs)(be,{align:`end`,className:`w-56`,children:[(0,Q.jsx)(M,{"data-component-new-blank":!0,onSelect:()=>a(!0),children:r(`custom-ui:studio.newBlank`)}),(0,Q.jsx)(ve,{}),(0,Q.jsx)(_e,{className:`text-xs font-normal text-content-muted`,children:r(`custom-ui:studio.fromTemplate`)}),(0,Q.jsx)(M,{"data-component-new-template":`usage-today`,onSelect:()=>void _(`usage-today`),children:r(`custom-ui:studio.templateUsageToday`)}),(0,Q.jsx)(M,{"data-component-new-template":`notes`,onSelect:()=>void _(`notes`),children:r(`custom-ui:studio.templateNotes`)})]})]}),t?(0,Q.jsx)(Ie,{open:i,onOpenChange:e=>!d&&a(e),children:(0,Q.jsx)(Ne,{side:`bottom`,onCloseAutoFocus:m,"data-component-new-sheet":!0,className:`gap-0 rounded-t-[var(--r-lg)] p-0`,children:(0,Q.jsxs)(`form`,{className:`flex flex-col gap-3 px-4 pt-4 pb-[max(16px,env(safe-area-inset-bottom))]`,onSubmit:e=>{e.preventDefault(),b()},children:[(0,Q.jsxs)(je,{className:`p-0`,children:[(0,Q.jsx)(Pe,{children:r(`custom-ui:studio.newBlankTitle`)}),(0,Q.jsx)(Fe,{children:r(`custom-ui:studio.newBlankHint`)})]}),x,(0,Q.jsxs)(Me,{className:`flex-row p-0`,children:[(0,Q.jsx)(I,{type:`button`,variant:`outline`,className:`min-h-11 flex-1`,disabled:d,onClick:()=>a(!1),children:r(`custom-ui:studio.cancel`)}),(0,Q.jsx)(I,{type:`submit`,className:`min-h-11 flex-1`,disabled:d||!v,children:S})]})]})})}):(0,Q.jsx)(H,{open:i,onOpenChange:e=>!d&&a(e),children:(0,Q.jsx)(R,{onCloseAutoFocus:m,children:(0,Q.jsxs)(`form`,{className:`contents`,onSubmit:e=>{e.preventDefault(),b()},children:[(0,Q.jsxs)(V,{children:[(0,Q.jsx)(z,{children:r(`custom-ui:studio.newBlankTitle`)}),(0,Q.jsx)(L,{children:r(`custom-ui:studio.newBlankHint`)})]}),x,(0,Q.jsxs)(B,{children:[(0,Q.jsx)(I,{type:`button`,variant:`outline`,disabled:d,onClick:()=>a(!1),children:r(`custom-ui:studio.cancel`)}),(0,Q.jsx)(I,{type:`submit`,disabled:d||!v,children:S})]})]})})})]})}function Ht(e,t){return e.length?e.map(e=>{let n=J(e.surface,t);if(e.surface!==`overview-card`)return n;let r=e.sizes.join(`/`),i=r?`${n} ${r}`:n;return e.count>1?`${i} ×${e.count}`:i}).join(` · `):t(`custom-ui:studio.notPlaced`)}function Ut(e,t,n){if(e.kind===`broken`||e.status!==`ready`){let t=e.errors[0];return t?q(t.code,n,t.params):n(`custom-ui:studio.statusInvalid`)}return Ht(dt(e.id,t),n)}function Wt(e,t){return e.kind===`broken`?t(`custom-ui:studio.statusBroken`):e.status===`ready`?e.enabled?null:t(`custom-ui:studio.statusDisabled`):t(`custom-ui:studio.statusInvalid`)}function Gt({row:e,instances:t,active:n,phone:r=!1,onSelect:i}){let{t:a,language:o}=u(),s=Wt(e,a);return(0,Q.jsxs)(`button`,{type:`button`,"data-component-row":e.id,"data-component-kind":e.kind,"aria-current":n||void 0,onClick:i,className:F(`flex w-full min-w-0 items-center gap-3 text-left transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,r?`min-h-14 px-3.5 py-2 hover:bg-surface-hover active:bg-surface-hover`:F(`rounded-[var(--r-md)] px-2.5 py-2`,n?`bg-surface-active`:`hover:bg-surface-hover`)),children:[(0,Q.jsx)(`span`,{className:F(`grid flex-none place-items-center rounded-[var(--r-md)] border border-stroke bg-solid text-content-secondary`,r?`size-9`:`size-8`),children:(0,Q.jsx)(O,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Q.jsx)(`strong`,{className:`min-w-0 truncate text-sm font-medium text-content`,children:Y(e,o)}),e.version&&(0,Q.jsxs)(`span`,{className:`flex-none font-mono text-xs text-content-muted tabular-nums`,children:[`v`,e.version]}),s&&(0,Q.jsx)(Ue,{className:`ml-auto flex-none text-content-secondary`,children:s})]}),(0,Q.jsx)(`small`,{className:`truncate text-xs text-content-muted`,"data-component-row-detail":!0,children:Ut(e,t,a)})]}),r&&(0,Q.jsx)(ae,{className:`size-4 flex-none text-content-muted`,"aria-hidden":`true`})]})}function Kt({componentId:e,onOpenLogs:t,onReload:n,onRequestFix:r}){let{t:i}=u(),a=tt(),o=(0,Z.useSyncExternalStore)(e=>a.subscribe(e),()=>{let t=a.read(e);for(let e=t.length-1;e>=0;--e)if(t[e].level===`error`)return t[e];return null}),s=o?.message??``;return(0,Q.jsxs)(`div`,{role:`status`,"data-component-crash":e,className:`mx-1 mt-1 mb-1.5 flex flex-col gap-1.5 rounded-[var(--r-md)] border border-stroke bg-surface-subtle px-2.5 py-2`,children:[(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs font-medium text-st-fail`,children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full bg-st-fail`}),i(`custom-ui:host.renderErrorTitle`)]}),s&&(0,Q.jsx)(`p`,{className:`truncate font-mono text-xs text-content-secondary`,title:s,children:s}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[(0,Q.jsx)(I,{size:`xs`,variant:`ghost`,onClick:t,children:i(`custom-ui:host.viewError`)}),(0,Q.jsx)(I,{size:`xs`,variant:`secondary`,onClick:n,children:i(`custom-ui:host.reload`)}),r&&s&&(0,Q.jsx)(I,{size:`xs`,variant:`ghost`,"data-component-crash-fix":e,onClick:()=>r(Qe(s,o?.stack)),children:i(`custom-ui:host.askAgentFix`)})]})]})}function qt({rows:e,allCount:t,counts:n,instances:r,selectedId:i,troubled:a,filter:o,query:s,root:c,onFilter:l,onQuery:d,onSelect:f,onCreate:p,onOpenLogs:m,onReload:h,onRequestFix:g,importButton:_,staged:v,footer:y}){let{t:b}=u();return(0,Q.jsxs)(`section`,{"data-studio-library":!0,"aria-label":b(`custom-ui:studio.library`),className:`flex min-h-0 min-w-0 flex-col border-r border-stroke`,children:[(0,Q.jsxs)(`header`,{className:`flex flex-col gap-2.5 px-3 pt-3.5 pb-2.5`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Q.jsxs)(`h2`,{className:`mr-auto flex min-w-0 items-baseline gap-1.5 truncate text-base font-semibold`,children:[b(`custom-ui:studio.libraryTitle`),(0,Q.jsx)(`span`,{className:`text-sm font-normal text-content-muted tabular-nums`,children:t})]}),_,(0,Q.jsx)(Vt,{onCreate:p})]}),(0,Q.jsxs)(`label`,{className:`relative block`,children:[(0,Q.jsx)(fe,{"aria-hidden":!0,className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-content-muted`}),(0,Q.jsx)(U,{type:`search`,value:s,placeholder:b(`custom-ui:studio.search`),"aria-label":b(`custom-ui:studio.search`),className:`pl-8`,onChange:e=>d(e.target.value)})]}),(0,Q.jsx)(P,{size:`sm`,"aria-label":b(`custom-ui:studio.filter`),value:o,onValueChange:l,className:`w-full [&>*]:flex-1`,options:[{value:`all`,label:b(`custom-ui:studio.filterAll`)},{value:`enabled`,label:b(`custom-ui:studio.filterEnabled`),count:n.enabled},{value:`attention`,label:b(`custom-ui:studio.filterAttention`),count:n.attention}]})]}),(0,Q.jsxs)(`ul`,{className:`flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto px-2 pb-2`,children:[v&&(0,Q.jsx)(`li`,{className:`flex flex-col gap-1.5 pb-1`,children:v}),e.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(Gt,{row:e,instances:r,active:e.id===i,onSelect:()=>f(e.id)}),a.has(e.id)&&(0,Q.jsx)(Kt,{componentId:e.id,onOpenLogs:()=>m(e.id),onReload:()=>h(e.id),onRequestFix:g&&(t=>g(e,t))})]},e.id)),!e.length&&!v&&(0,Q.jsx)(`li`,{className:`px-2.5 py-6 text-center text-sm text-content-muted`,children:b(`custom-ui:studio.noMatches`)})]}),y,(0,Q.jsxs)(`p`,{"data-studio-hot-reload":!0,className:`flex flex-none flex-col gap-0.5 border-t border-stroke px-3.5 py-2.5 text-xs text-content-muted`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5 text-content-secondary`,children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full bg-content-muted`}),b(`custom-ui:studio.hotReloadOn`)]}),(0,Q.jsx)(`span`,{className:`break-all`,children:b(`custom-ui:studio.directory`,{path:c})})]})]})}function Jt(e,t,n){let r=e.i18n?.[n];return{label:r?.title||e.title||t,description:r?.description||e.description||``}}function Yt(e,t){if(!e||typeof e.properties!=`object`||!e.properties)return[];let n=new Set(Array.isArray(e.required)?e.required:[]),r=[];for(let[i,a]of Object.entries(e.properties)){if(!a||typeof a!=`object`)continue;let e={key:i,...Jt(a,i,t),required:n.has(i)};switch(a.type){case`string`:Array.isArray(a.enum)&&a.enum.length?r.push({...e,kind:a.enum.length<=4?`segmented`:`select`,options:[...a.enum],...a.default===void 0?{}:{defaultValue:a.default}}):r.push({...e,kind:a.format===`textarea`||a.format===`url`||a.format===`color`?a.format:`text`,maxLength:a.maxLength,...a.default===void 0?{}:{defaultValue:a.default}});break;case`number`:case`integer`:r.push({...e,kind:`number`,integer:a.type===`integer`,...a.minimum===void 0?{}:{min:a.minimum},...a.maximum===void 0?{}:{max:a.maximum},...a.step===void 0?{}:{step:a.step},unit:a.unit||``,...a.default===void 0?{}:{defaultValue:a.default}});break;case`boolean`:r.push({...e,kind:`switch`,...a.default===void 0?{}:{defaultValue:a.default}});break;case`array`:r.push({...e,kind:`tags`,maxItems:a.maxItems,itemMaxLength:a.itemMaxLength,...a.default===void 0?{}:{defaultValue:[...a.default]}})}}return r}function Xt(e,t){let n={};for(let r of e){let e=t&&Object.hasOwn(t,r.key)?t[r.key]:r.defaultValue;switch(r.kind){case`switch`:n[r.key]=e===!0;break;case`tags`:n[r.key]=Array.isArray(e)?e.filter(e=>typeof e==`string`):[];break;case`number`:n[r.key]=typeof e==`number`&&Number.isFinite(e)?String(e):``;break;default:n[r.key]=typeof e==`string`?e:``}}return n}function Zt(e,t){let n={};for(let r of e){let e=t[r.key];switch(r.kind){case`switch`:n[r.key]=e===!0;break;case`tags`:Array.isArray(e)&&e.length&&(n[r.key]=[...e]);break;case`number`:{let t=typeof e==`string`?e.trim():``;if(!t)break;let i=Number(t);n[r.key]=Number.isFinite(i)?i:t;break}case`segmented`:case`select`:typeof e==`string`&&e&&(n[r.key]=e);break;default:typeof e==`string`&&e&&(n[r.key]=e)}}return n}function Qt(e,t){let n=[...e];for(let e of t.split(/[,,\n]/)){let t=e.trim();t&&!n.includes(t)&&n.push(t)}return n}function $t(e){let t={};for(let n of e){let e=/^props(?:\.([^.]+))?/.exec(n.path||``),r=e?e[1]??``:``;Object.hasOwn(t,r)||(t[r]=n.params?{code:n.code,params:n.params}:{code:n.code})}return t}function en(e,t){let n=new Set([...Object.keys(e),...Object.keys(t)]);for(let r of n){let n=e[r],i=t[r];if(Array.isArray(n)||Array.isArray(i)){if(!Array.isArray(n)||!Array.isArray(i)||n.length!==i.length||n.some((e,t)=>e!==i[t]))return!1}else if(n!==i)return!1}return!0}function tn({id:e,label:t,description:n,error:r,required:i,children:a,inline:o=!1}){return(0,Q.jsxs)(`div`,{className:F(`flex min-w-0 gap-1.5`,o?`items-center justify-between`:`flex-col`),"data-props-field":e,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,Q.jsxs)(`label`,{htmlFor:e,className:`text-sm text-content`,children:[t,i&&(0,Q.jsx)(`span`,{className:`ml-0.5 text-content-muted`,children:`*`})]}),n&&(0,Q.jsx)(`span`,{id:`${e}-hint`,className:`text-xs text-content-muted`,children:n})]}),a,r&&(0,Q.jsx)(`p`,{id:`${e}-error`,role:`alert`,"data-props-error":!0,className:`text-xs text-danger`,children:r})]})}function nn({id:e,value:t,invalid:n,disabled:r,describedBy:i,onChange:a}){let{t:o}=u(),[s,c]=(0,Z.useState)(``),l=()=>{s.trim()&&(a(Qt(t,s)),c(``))};return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[t.length>0&&(0,Q.jsx)(`ul`,{className:`flex flex-wrap gap-1`,children:t.map(e=>(0,Q.jsxs)(`li`,{className:`inline-flex max-w-full items-center gap-1 rounded-sm border border-stroke-strong bg-solid py-0.5 pr-0.5 pl-2 text-xs`,children:[(0,Q.jsx)(`span`,{className:`truncate`,children:e}),(0,Q.jsx)(`button`,{type:`button`,disabled:r,"aria-label":o(`custom-ui:studio.removeTag`,{tag:e}),className:`grid size-5 place-items-center rounded-xs text-content-muted hover:bg-surface-hover hover:text-content`,onClick:()=>a(t.filter(t=>t!==e)),children:(0,Q.jsx)(he,{className:`size-3`})})]},e))}),(0,Q.jsx)(U,{id:e,value:s,disabled:r,"aria-invalid":n||void 0,"aria-describedby":i,placeholder:o(`custom-ui:studio.tagsPlaceholder`),onChange:e=>c(e.target.value),onBlur:l,onKeyDown:e=>{e.key===`Enter`||e.key===`,`?(e.preventDefault(),l()):e.key===`Backspace`&&!s&&t.length&&a(t.slice(0,-1))}})]})}function rn({field:e,id:t,value:n,error:r,disabled:i,onChange:a}){let{t:o}=u(),s=[e.description?`${t}-hint`:``,r?`${t}-error`:``].filter(Boolean).join(` `)||void 0,c={id:t,disabled:i,"aria-invalid":r?!0:void 0,"aria-describedby":s};switch(e.kind){case`switch`:return(0,Q.jsx)(De,{...c,checked:n===!0,onCheckedChange:e=>a(e)});case`segmented`:return(0,Q.jsx)(P,{size:`sm`,"aria-label":e.label,disabled:i,value:typeof n==`string`&&n?n:e.defaultValue??``,onValueChange:e=>a(e),options:e.options.map(e=>({value:e,label:e}))});case`select`:return(0,Q.jsxs)(Ee,{value:typeof n==`string`&&n?n:void 0,disabled:i,onValueChange:e=>a(e),children:[(0,Q.jsx)(Ce,{...c,className:`w-full`,children:(0,Q.jsx)(N,{placeholder:o(`custom-ui:studio.selectPlaceholder`)})}),(0,Q.jsx)(we,{children:e.options.map(e=>(0,Q.jsx)(Te,{value:e,children:e},e))})]});case`tags`:return(0,Q.jsx)(nn,{id:t,value:Array.isArray(n)?n:[],invalid:!!r,disabled:i,describedBy:s,onChange:a});case`textarea`:return(0,Q.jsx)(He,{...c,rows:3,maxLength:e.maxLength,value:typeof n==`string`?n:``,onChange:e=>a(e.target.value)});case`number`:return(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(U,{...c,inputMode:e.integer?`numeric`:`decimal`,value:typeof n==`string`?n:``,placeholder:e.defaultValue===void 0?void 0:String(e.defaultValue),className:`font-mono tabular-nums`,onChange:e=>a(e.target.value)}),e.unit&&(0,Q.jsx)(`span`,{className:`flex-none text-xs text-content-muted`,children:e.unit})]});case`color`:return(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`size-6 flex-none rounded-sm border border-stroke-strong`,style:{background:typeof n==`string`&&n?n:`transparent`}}),(0,Q.jsx)(U,{...c,maxLength:e.maxLength,value:typeof n==`string`?n:``,placeholder:`#RRGGBB`,className:`font-mono`,onChange:e=>a(e.target.value)})]});default:return(0,Q.jsx)(U,{...c,type:e.kind===`url`?`url`:`text`,maxLength:e.maxLength,value:typeof n==`string`?n:``,className:F(e.kind===`url`&&`font-mono`),onChange:e=>a(e.target.value)})}}function an({row:e,instance:t,notify:n,onPreview:r,onSave:i}){let{t:a,language:o}=u(),s=(0,Z.useId)(),c=e.manifest?.props,l=(0,Z.useMemo)(()=>Yt(c,o),[o,c]),d=(0,Z.useMemo)(()=>Xt(l,t?.props),[l,t]),[f,p]=(0,Z.useState)(d),[m,h]=(0,Z.useState)(t?.title??``),[_,v]=(0,Z.useState)({}),[b,x]=(0,Z.useState)(``),[S,C]=(0,Z.useState)(!1),w=!en(f,d)||m!==(t?.title??``);(0,Z.useEffect)(()=>{let e=yt(c,Zt(l,f));e.errors.length||r({title:m,props:e.value})},[l,r,c,m,f]);let T=(e,t)=>{p(n=>({...n,[e]:t})),v(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},ee=async()=>{if(t){C(!0),v({}),x(``);try{await i(t,{title:m.trim(),props:Zt(l,f)}),n(a(`custom-ui:studio.propsSaved`))}catch(e){let t=g(e);if(t===`component_props_invalid`){let t=$t(y(e));v(t);let n=l.find(e=>Object.hasOwn(t,e.key));n&&document.getElementById(`${s}-${n.key}`)?.focus()}else t===`component_title_invalid`?x(q(t,a)):n(t?`${a(`custom-ui:studio.saveFailed`)} ${q(t,a)}`:a(`custom-ui:studio.saveFailed`))}finally{C(!1)}}},E=e=>{let t=_[e];return t?q(t.code,a,t.params):void 0},te=l.some(e=>e.kind===`url`||e.kind===`textarea`),D=`${s}-title`;return(0,Q.jsxs)(`form`,{"data-props-form":t?.instanceId??`preview`,className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),ee()},children:[!t&&(0,Q.jsx)(`p`,{className:`text-xs text-content-muted`,children:a(`custom-ui:studio.previewPropsHint`)}),(0,Q.jsx)(tn,{id:D,label:a(`custom-ui:studio.cardTitle`),error:b,children:(0,Q.jsx)(U,{id:D,value:m,maxLength:80,disabled:S,"aria-invalid":b?!0:void 0,placeholder:a(`custom-ui:studio.cardTitlePlaceholder`),onChange:e=>{h(e.target.value),x(``)}})}),l.map(e=>{let t=`${s}-${e.key}`,n=E(e.key);return(0,Q.jsx)(tn,{id:t,label:e.label,description:e.description,required:e.required,error:n,inline:e.kind===`switch`,children:(0,Q.jsx)(rn,{field:e,id:t,value:f[e.key]??``,error:n,disabled:S,onChange:t=>T(e.key,t)})},e.key)}),_[``]&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:q(_[``].code,a,_[``].params)}),te&&(0,Q.jsx)(`p`,{className:`text-xs text-content-muted`,children:a(`custom-ui:studio.propsPlaintext`)}),t&&(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Q.jsx)(I,{type:`button`,size:`sm`,variant:`ghost`,disabled:S||!w,onClick:()=>{p(d),h(t.title),v({}),x(``)},children:a(`custom-ui:studio.propsReset`)}),(0,Q.jsx)(I,{type:`submit`,size:`sm`,disabled:S||!w,"data-props-save":!0,children:a(`custom-ui:studio.propsSave`)})]})]})}function on({title:e,aside:t,children:n,className:r}){return(0,Q.jsxs)(`section`,{className:F(`flex flex-col gap-2.5`,r),children:[(0,Q.jsxs)(`header`,{className:`flex items-baseline justify-between gap-2`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-content`,children:e}),t&&(0,Q.jsx)(`span`,{className:`text-xs text-content-muted`,children:t})]}),n]})}function sn(e,t){return f({queryKey:_.versions(e),queryFn:({signal:t})=>Je(e,t),enabled:t&&!!e,retry:!1,staleTime:1e4,refetchOnWindowFocus:!1})}function cn(e,t){return f({queryKey:_.usage(e),queryFn:({signal:t})=>Ye(e,t),enabled:t&&!!e,retry:!1,refetchInterval:15e3,refetchOnWindowFocus:!1})}function ln(e){return f({queryKey:_.trash(),queryFn:({signal:e})=>st(e),enabled:e,retry:!1,refetchOnWindowFocus:!1})}function un(e){return f({queryKey:_.staged(e),queryFn:({signal:t})=>at(e,t),enabled:!!e,retry:!1,refetchOnWindowFocus:!1,staleTime:1/0})}function dn(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,r.click(),window.setTimeout(()=>URL.revokeObjectURL(n),1e3)}function fn(e){let t=d(),{t:n}=u();return(0,Z.useMemo)(()=>{let r=()=>t.invalidateQueries({queryKey:_.all}),i=async(t,i)=>{try{let e=await t();return await r(),e}catch(t){let r=g(t);return e(r?`${i} ${q(r,n)}`:i),null}};return{notify:e,restoreVersion:async(t,r)=>{let a=await i(()=>Xe(t.id,r),n(`custom-ui:versions.restoreFailed`));return a&&e(n(`custom-ui:versions.restored`,{n:r})),a},exportZip:async t=>{try{dn(await ot(t.id),`${t.id}.zip`),e(n(`custom-ui:exporting.done`,{name:t.name}))}catch(t){let r=g(t);e(r?`${n(`custom-ui:exporting.failed`)} ${q(r,n)}`:n(`custom-ui:exporting.failed`))}},stageImport:e=>i(()=>ut(e),n(`custom-ui:importing.stageFailed`)),trust:async t=>{let r=await i(()=>nt(t),n(`custom-ui:importing.trustFailed`));return r&&e(r.replaced?n(`custom-ui:importing.replaced`,{name:r.component.name}):n(`custom-ui:importing.trusted`,{name:r.component.name})),r},discard:async t=>{let r=await i(()=>Ge(t).then(()=>!0),n(`custom-ui:importing.discardFailed`));return r&&e(n(`custom-ui:importing.discarded`)),r},restoreTrash:async t=>{let r=await i(()=>lt(t.entry),n(`custom-ui:trash.restoreFailed`));return r&&e(n(`custom-ui:trash.restored`,{name:t.name})),r},purgeTrash:async t=>{let r=await i(()=>Ze(t.entry).then(()=>!0),n(`custom-ui:trash.purgeFailed`));return r&&e(n(`custom-ui:trash.purged`,{name:t.name})),r},setRevoked:(e,t)=>i(()=>ct(e.id,t),n(`custom-ui:usage.revokeFailed`))}},[t,e,n])}var pn=(0,Z.lazy)(()=>t(()=>import(`./public-diff-4sBkfeo8.js`).then(e=>({default:e.InlineGitDiff})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18])));function mn({version:e}){let{t}=u();return!e.files.length&&!e.deleted.length?null:(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-wrap gap-1`,"data-version-files":!0,children:[e.files.map(e=>(0,Q.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1 rounded-sm border border-stroke bg-surface-subtle px-1.5 font-mono text-[11px] text-content-secondary`,children:[(0,Q.jsx)(`span`,{className:`truncate`,children:e.path}),e.added>0&&(0,Q.jsxs)(`span`,{className:`text-st-done tabular-nums`,children:[`+`,e.added]}),e.removed>0&&(0,Q.jsxs)(`span`,{className:`text-st-fail tabular-nums`,children:[`−`,e.removed]})]},e.path)),e.deleted.map(e=>(0,Q.jsx)(`span`,{className:`inline-flex max-w-full items-center gap-1 rounded-sm border border-stroke px-1.5 font-mono text-[11px] text-content-muted line-through`,title:t(`custom-ui:versions.deletedFile`),children:e},`deleted:${e}`))]})}function hn(e,t,n){return[Ct(e,t),e.summary,e.at?ze(e.at,n):``].filter(Boolean).join(` · `)}function gn({row:e,enabled:t,notify:n,actions:r}){let{t:i,language:a}=u(),o=sn(e.id,t),[s,c]=(0,Z.useState)(null),[l,d]=(0,Z.useState)(0),[f,p]=(0,Z.useState)(null),[m,h]=(0,Z.useState)(!1),_=(0,Z.useRef)(null),v=K(!!f);if(!t)return null;let y=o.data,b=async(t,r)=>{_.current=r,d(t.n);try{c({...await Nt(e.id,t.n),n:t.n})}catch(e){let t=g(e);n(t?`${i(`custom-ui:versions.diffFailed`)} ${q(t,i)}`:i(`custom-ui:versions.diffFailed`))}finally{d(0)}},x=async()=>{if(!f)return;h(!0);let t=await r.restoreVersion(e,f.n);h(!1),t&&p(null)};return(0,Q.jsxs)(on,{title:i(`custom-ui:versions.title`),aside:y?i(`custom-ui:versions.keep`,{count:y.max}):void 0,children:[o.isPending?(0,Q.jsx)(`p`,{className:`text-xs text-content-muted`,children:i(`custom-ui:versions.loading`)}):o.error||!y?(0,Q.jsx)(`p`,{className:`text-xs text-content-muted`,children:i(`custom-ui:versions.failed`)}):(0,Q.jsxs)(`ol`,{"data-component-versions":!0,className:`overflow-hidden rounded-[var(--r-md)] border border-stroke`,children:[(0,Q.jsxs)(`li`,{"data-component-version":y.current.n,"data-version-current":!0,className:`flex min-w-0 flex-col gap-1 border-b border-stroke px-3 py-2 last:border-b-0`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2 text-sm`,children:[(0,Q.jsxs)(`strong`,{className:`font-mono font-medium tabular-nums`,children:[`v`,y.current.n]}),(0,Q.jsx)(`span`,{className:`text-xs text-content-secondary`,children:i(`custom-ui:versions.current`)}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs text-content-muted`,children:hn(y.current,i,a)})]}),(0,Q.jsx)(mn,{version:y.current})]}),y.versions.map(e=>(0,Q.jsxs)(`li`,{"data-component-version":e.n,className:`flex min-w-0 items-center gap-2 border-b border-stroke px-3 py-1.5 last:border-b-0`,children:[(0,Q.jsxs)(`strong`,{className:`flex-none font-mono text-sm font-medium tabular-nums`,children:[`v`,e.n]}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-content-muted`,children:hn(e,i,a)||i(`custom-ui:versions.noSummary`)}),(0,Q.jsxs)(I,{size:`xs`,variant:`ghost`,disabled:l===e.n,"data-version-compare":e.n,onClick:t=>void b(e,t.currentTarget),children:[(0,Q.jsx)(Ft,{}),i(`custom-ui:versions.compare`)]}),(0,Q.jsxs)(I,{size:`xs`,variant:`ghost`,"data-version-restore":e.n,onClick:t=>{_.current=t.currentTarget,p(e)},children:[(0,Q.jsx)(de,{}),i(`custom-ui:versions.restore`)]})]},e.n)),!y.versions.length&&(0,Q.jsx)(`li`,{className:`px-3 py-2 text-xs text-content-muted`,children:i(`custom-ui:versions.onlyCurrent`)})]}),(0,Q.jsx)(H,{open:!!f,onOpenChange:e=>!e&&!m&&p(null),children:(0,Q.jsxs)(R,{onCloseAutoFocus:v,children:[(0,Q.jsxs)(V,{children:[(0,Q.jsx)(z,{children:i(`custom-ui:versions.restoreTitle`,{n:f?.n??0})}),(0,Q.jsx)(L,{children:i(`custom-ui:versions.restoreHint`,{n:f?.n??0,next:(y?.current.n??0)+1,current:y?.current.n??0})})]}),(0,Q.jsxs)(B,{children:[(0,Q.jsx)(I,{variant:`outline`,disabled:m,onClick:()=>p(null),children:i(`custom-ui:studio.cancel`)}),(0,Q.jsx)(I,{disabled:m,"data-version-restore-confirm":!0,onClick:()=>void x(),children:i(`custom-ui:versions.restoreConfirm`,{n:f?.n??0})})]})]})}),(0,Q.jsx)(H,{open:!!s,onOpenChange:e=>!e&&c(null),children:(0,Q.jsxs)(R,{"data-version-diff":s?.n,scrollMode:`body`,className:`h-[min(760px,calc(100dvh-2rem))] max-w-[min(960px,calc(100vw-2rem))]`,onCloseAutoFocus:e=>{e.preventDefault(),_.current?.focus()},children:[(0,Q.jsxs)(V,{children:[(0,Q.jsx)(z,{children:i(`custom-ui:versions.diffTitle`,{n:s?.n??0,current:y?.current.n??0})}),(0,Q.jsx)(L,{children:s?.files.length?s.files.map(e=>e.path).join(` · `):i(`custom-ui:versions.noDiff`)})]}),(0,Q.jsx)(Ve,{className:`-mx-4 border-t border-stroke`,children:s&&s.files.length>0&&(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(pn,{diff:s.diff,truncated:s.truncated,mode:`unified`})})})]})})]})}var _n=[`overview-card`,`session-panel`,`feature-page`,`floating`],vn={"overview-card":It,"session-panel":le,"feature-page":te,floating:O};function yn(e,t){return e.source===`agent`?t(`custom-ui:studio.sourceAgent`):e.source===`template`?t(`custom-ui:studio.sourceTemplate`):e.source===`import`?t(`custom-ui:studio.sourceImport`):t(`custom-ui:studio.sourceLocal`)}function bn(e,t){let n=J(e.surface,t),r=e.size?`${n} ${e.size}`:n;return e.title?`${r} · ${e.title}`:r}function xn(e){let t=e.replace(/[\\/]+$/,``).split(/[\\/]/);return t[t.length-1]||e}function Sn({row:e,actions:t}){let{t:n,language:r}=u(),[i,a]=(0,Z.useState)(!1);return(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Q.jsx)(`span`,{className:`grid size-10 flex-none place-items-center rounded-[var(--r-md)] border border-stroke bg-solid text-content-secondary`,children:(0,Q.jsx)(O,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Q.jsx)(`strong`,{className:`truncate text-[15px] font-semibold`,children:Y(e,r)}),(0,Q.jsx)(`span`,{className:`truncate text-xs text-content-muted`,children:[e.version?`v${e.version}`:``,e.kind===`broken`?n(`custom-ui:studio.statusBroken`):n(`custom-ui:studio.nativeComponent`),e.kind===`native`?yn(e,n):``].filter(Boolean).join(` · `)})]}),e.kind===`native`&&(0,Q.jsxs)(`label`,{className:`inline-flex flex-none items-center gap-2 text-xs text-content-secondary`,children:[n(`custom-ui:studio.enable`),(0,Q.jsx)(De,{checked:e.enabled,disabled:i,"aria-label":n(`custom-ui:studio.enable`),"data-component-enable":!0,onCheckedChange:async n=>{a(!0),await t.setEnabled(e,n),a(!1)}})]})]})}function Cn({row:e}){let{t}=u();return e.errors.length?(0,Q.jsx)(`ul`,{"data-component-errors":!0,className:`flex flex-col gap-1 rounded-[var(--r-md)] border border-stroke bg-surface-subtle px-3 py-2 text-xs text-content-secondary`,children:e.errors.map(e=>(0,Q.jsxs)(`li`,{className:`min-w-0 break-all`,children:[e.path&&(0,Q.jsx)(`code`,{className:`mr-1.5 font-mono`,children:e.path}),q(e.code,t,e.params)]},`${e.path}:${e.code}`))}):null}function wn({row:e,instances:t,selectedInstanceId:n,notify:r,actions:i,onSelectInstance:a,onPreview:o}){let{t:s}=u(),c=t.filter(t=>t.componentId===e.id),l=c.find(e=>e.instanceId===n)??null;return(0,Q.jsxs)(on,{title:s(`custom-ui:studio.props`),aside:s(`custom-ui:studio.propsPerInstance`),children:[c.length>0&&(0,Q.jsxs)(Ee,{value:l?.instanceId??`preview`,onValueChange:e=>a(e===`preview`?null:e),children:[(0,Q.jsx)(Ce,{className:`w-full`,"aria-label":s(`custom-ui:studio.editingInstance`),"data-props-instance":!0,children:(0,Q.jsx)(N,{})}),(0,Q.jsxs)(we,{children:[(0,Q.jsx)(Te,{value:`preview`,children:s(`custom-ui:studio.previewProps`)}),c.map(e=>(0,Q.jsxs)(Te,{value:e.instanceId,children:[bn(e,s),!e.enabled&&` · ${s(`custom-ui:studio.instanceClosed`)}`]},e.instanceId))]})]}),(0,Q.jsx)(an,{row:e,instance:l,notify:r,onPreview:o,onSave:i.saveProps},l?.instanceId??`preview:${e.id}`)]})}function Tn({row:e,usageEnabled:t=!1,canRevoke:n=!1,lifecycle:r}){let{t:i,language:a}=u(),o=e.manifest?.capabilities??{},s=cn(e.id,t),[c,l]=(0,Z.useState)(``),d=[`network`,`notify`,`sessions.read`,`sessions.open`,`storage`,`provider.request`].filter(e=>o[e]),f=[`sessions.read`,`notify`,`network`,`storage`,`provider.request`].filter(e=>!o[e]).map(e=>St(e,i)),p=r?.notify??(()=>void 0),m=async(t,n)=>{if(!r)return;l(t);let a=n?[...new Set([...e.revoked,t])]:e.revoked.filter(e=>e!==t),o=await r.setRevoked(e,a);l(``),o&&p(i(n?`custom-ui:usage.revoked`:`custom-ui:usage.unrevoked`,{capability:St(t,i)}))};return(0,Q.jsxs)(on,{title:i(`custom-ui:studio.capabilities`),children:[d.length?(0,Q.jsx)(`ul`,{"data-component-capabilities":!0,className:`overflow-hidden rounded-[var(--r-md)] border border-stroke`,children:d.map(l=>{let u=o[l],d=e.revoked.includes(l),f=s.data?.usage[l],p=l===`network`?Tt(o.network):l===`storage`?i(`custom-ui:studio.capStorageQuota`,{kb:o.storage?.quotaKb??0}):l===`provider.request`?`${o[`provider.request`]?.methods.join(`/`)} ${o[`provider.request`]?.paths.join(`, `)}`:``;return(0,Q.jsxs)(`li`,{"data-component-capability":l,"data-capability-revoked":d||void 0,className:`flex min-w-0 items-start gap-2 border-b border-stroke px-3 py-2 last:border-b-0`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2 text-sm`,children:[(0,Q.jsx)(`span`,{className:F(d&&`text-content-muted line-through`),children:St(l,i)}),p&&(0,Q.jsx)(`code`,{title:p,className:`min-w-0 truncate font-mono text-xs text-content-secondary`,children:p}),l===`network`&&o.network?.privateOrigins?.length?(0,Q.jsx)(Ue,{className:`flex-none text-content-secondary`,children:i(`custom-ui:studio.capNetworkPrivate`)}):null,d&&(0,Q.jsx)(Ue,{className:`flex-none text-content-secondary`,children:i(`custom-ui:usage.revokedBadge`)})]}),u?.reason&&(0,Q.jsx)(`span`,{className:`text-xs text-content-muted`,children:u.reason}),t&&(0,Q.jsx)(`span`,{className:`text-xs text-content-muted`,"data-capability-usage":!0,children:f?[i(`custom-ui:usage.last`,{time:ze(f.lastAt,a)}),f.target,i(`custom-ui:usage.today`,{count:f.today})].filter(Boolean).join(` · `):i(`custom-ui:usage.never`)})]}),n&&r&&(0,Q.jsx)(I,{size:`xs`,variant:`ghost`,disabled:c===l,"data-capability-toggle":l,className:`flex-none`,onClick:()=>void m(l,!d),children:i(d?`custom-ui:usage.restore`:`custom-ui:usage.revoke`)})]},l)})}):(0,Q.jsx)(`p`,{className:`text-xs text-content-muted`,children:i(`custom-ui:studio.capNone`)}),(0,Q.jsx)(`p`,{className:`text-xs text-content-muted`,children:i(`custom-ui:studio.capUndeclared`,{list:[...f,i(`custom-ui:studio.capFiles`),i(`custom-ui:studio.capClipboard`)].join(` · `)})}),(0,Q.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:i(`custom-ui:studio.capExplainer`)})]})}function En({value:e,disabled:t,onChange:n}){let{t:r}=u(),{projects:i}=Re(),a=i.filter(e=>e.cwd),o=e.type===`project`?e.cwd:`*`;return e.type===`project`&&!a.some(t=>t.cwd===e.cwd)&&a.push({key:e.cwd,cwd:e.cwd,count:0}),(0,Q.jsxs)(Ee,{value:o,disabled:t,onValueChange:e=>n(e===`*`?{type:`all`}:{type:`project`,cwd:e}),children:[(0,Q.jsx)(Ce,{size:`sm`,className:`w-full min-w-0`,"aria-label":r(`custom-ui:studio.scope`),"data-placement-scope":!0,children:(0,Q.jsx)(N,{})}),(0,Q.jsxs)(we,{children:[(0,Q.jsx)(Te,{value:`*`,children:r(`custom-ui:studio.scopeAll`)}),a.map(e=>(0,Q.jsx)(Te,{value:e.cwd,children:r(`custom-ui:studio.scopeProject`,{name:xn(e.cwd)})},e.cwd))]})]})}function Dn({row:e,instances:t,actions:n}){let{t:r}=u(),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(xt(e.manifest)),[c,l]=(0,Z.useState)({type:`all`}),[d,f]=(0,Z.useState)(null),p=K(d!==null),m=ht(e),h=t.filter(t=>t.componentId===e.id),g=e.manifest?.placements.find(e=>e.surface===`overview-card`)?.sizes??[`S`,`M`],_=async e=>{a(!0);try{await e()}finally{a(!1)}};return(0,Q.jsxs)(on,{title:r(`custom-ui:studio.placements`),aside:!m&&e.kind===`native`?r(`custom-ui:studio.placeNeedsEnable`):void 0,children:[(0,Q.jsx)(`ul`,{className:`grid grid-cols-1 gap-2 min-[360px]:grid-cols-2`,"data-component-placements":!0,children:_n.map(a=>{let u=vn[a],d=h.filter(e=>e.surface===a),p=d.filter(e=>e.enabled),v=p.length>0,y=rt(e.manifest,a),b=i||!m||!y,x=a===`overview-card`&&p.length===1?p[0]:null,S=()=>{v?p.length>1?f(p):_(()=>n.unplace(p[0])):_(()=>n.place(e,t,{surface:a,...a===`overview-card`?{size:o}:{},...a===`session-panel`?{scope:c}:{}}))},C=d[0];return(0,Q.jsxs)(`li`,{"data-placement-tile":a,"data-placement-checked":v||void 0,className:F(`flex min-w-0 flex-col gap-2 rounded-[var(--r-md)] border px-2.5 py-2`,v?`border-stroke-strong bg-surface-subtle`:`border-stroke`,!y&&`opacity-60`),children:[(0,Q.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-sm pointer-coarse:min-h-11`,children:[(0,Q.jsx)(ge,{checked:v,disabled:b,"aria-describedby":y?void 0:`placement-${a}-hint`,onCheckedChange:S}),(0,Q.jsx)(u,{className:`size-3.5 flex-none text-content-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:J(a,r)}),a===`overview-card`&&p.length>1&&(0,Q.jsxs)(Ue,{className:`flex-none`,children:[`×`,p.length]})]}),!y&&(0,Q.jsx)(`span`,{id:`placement-${a}-hint`,className:`text-xs text-content-muted`,children:r(`custom-ui:studio.placeUndeclared`)}),y&&a===`overview-card`&&(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[g.length>1&&(0,Q.jsx)(P,{size:`sm`,"aria-label":r(`custom-ui:studio.cardSize`),disabled:b,value:x?.size??o,onValueChange:e=>{s(e),x&&_(()=>n.patchInstance(x,{size:e}))},options:g.map(e=>({value:e,label:e}))}),v&&(0,Q.jsx)(I,{size:`xs`,variant:`ghost`,disabled:b,title:r(`custom-ui:studio.addCard`),"aria-label":r(`custom-ui:studio.addCard`),onClick:()=>void _(()=>n.place(e,t,{surface:a,size:o})),children:(0,Q.jsx)(ue,{})})]}),y&&a===`session-panel`&&(0,Q.jsx)(En,{value:C?.scope??c,disabled:b,onChange:e=>{l(e),C&&_(()=>n.patchInstance(C,{scope:e}))}}),y&&a===`floating`&&(0,Q.jsx)(`span`,{className:`text-xs text-content-muted`,children:r(`custom-ui:studio.floatingPhoneHint`)})]},a)})}),(0,Q.jsx)(H,{open:d!==null,onOpenChange:e=>!e&&f(null),children:(0,Q.jsxs)(R,{onCloseAutoFocus:p,children:[(0,Q.jsxs)(V,{children:[(0,Q.jsx)(z,{children:r(`custom-ui:studio.unplaceAllTitle`,{count:d?.length??0})}),(0,Q.jsx)(L,{children:r(`custom-ui:studio.unplaceAllHint`)})]}),(0,Q.jsxs)(B,{children:[(0,Q.jsx)(I,{variant:`outline`,onClick:()=>f(null),children:r(`custom-ui:studio.cancel`)}),(0,Q.jsx)(I,{variant:`destructive`,disabled:i,onClick:()=>{let e=d??[];f(null),_(async()=>{for(let t of e)await n.unplace(t)})},children:r(`custom-ui:studio.unplaceAll`)})]})]})})]})}function On({row:e,instances:t,actions:n,className:r}){let{t:i}=u(),a=ht(e);return(0,Q.jsxs)(xe,{children:[(0,Q.jsx)(ye,{asChild:!0,children:(0,Q.jsxs)(I,{size:`sm`,disabled:!a,"data-component-place":!0,className:r,children:[i(`custom-ui:studio.placeTo`),(0,Q.jsx)(re,{})]})}),(0,Q.jsx)(be,{align:`start`,className:`w-56`,children:_n.map(r=>{let a=rt(e.manifest,r),o=r!==`overview-card`&&t.some(t=>t.componentId===e.id&&t.surface===r&&t.enabled);return(0,Q.jsxs)(M,{disabled:!a||o,"data-component-place-item":r,onSelect:()=>void n.place(e,t,{surface:r,...r===`overview-card`?{size:xt(e.manifest)}:{}}),children:[J(r,i),(0,Q.jsx)(`span`,{className:`ml-auto text-xs text-content-muted`,children:a?o?i(`custom-ui:studio.placed`):``:i(`custom-ui:studio.placeUndeclaredShort`)})]},r)})})]})}function kn({row:e,actions:t,onDeleted:n,variant:r=`menu`}){let{t:i,language:a}=u(),[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(!1),d=(0,Z.useRef)(null),f=K(o,d),p=Y(e,a),m=async()=>{l(!0);let r=await t.remove(e);l(!1),r&&(s(!1),n())};return(0,Q.jsxs)(Q.Fragment,{children:[r===`menu`?(0,Q.jsxs)(xe,{children:[(0,Q.jsx)(ye,{asChild:!0,children:(0,Q.jsx)(I,{ref:d,size:`icon-sm`,variant:`ghost`,"aria-label":i(`custom-ui:studio.more`),"data-component-more":!0,children:(0,Q.jsx)(ce,{})})}),(0,Q.jsx)(be,{align:`end`,children:(0,Q.jsxs)(M,{variant:`destructive`,"data-component-delete":!0,onSelect:()=>s(!0),children:[(0,Q.jsx)(j,{}),i(`custom-ui:studio.deleteComponent`)]})})]}):(0,Q.jsxs)(I,{variant:`ghost`,size:`sm`,className:`text-danger`,"data-component-delete":!0,onClick:()=>s(!0),children:[(0,Q.jsx)(j,{}),i(`custom-ui:studio.deleteComponent`)]}),(0,Q.jsx)(H,{open:o,onOpenChange:e=>!e&&!c&&s(!1),children:(0,Q.jsxs)(R,{onCloseAutoFocus:f,children:[(0,Q.jsxs)(V,{children:[(0,Q.jsx)(z,{children:i(`custom-ui:studio.deleteTitle`,{name:p})}),(0,Q.jsx)(L,{children:i(`custom-ui:studio.deleteHint`)})]}),(0,Q.jsxs)(B,{children:[(0,Q.jsx)(I,{variant:`outline`,disabled:c,onClick:()=>s(!1),children:i(`custom-ui:studio.cancel`)}),(0,Q.jsx)(I,{variant:`destructive`,disabled:c,"data-component-delete-confirm":!0,onClick:()=>void m(),children:i(`custom-ui:studio.delete`)})]})]})})]})}function An({row:e,lifecycle:t,className:n}){let{t:r}=u(),[i,a]=(0,Z.useState)(!1);return(0,Q.jsxs)(I,{size:`sm`,variant:`secondary`,disabled:i,"data-component-export":!0,className:n,onClick:async()=>{a(!0),await t.exportZip(e),a(!1)},children:[(0,Q.jsx)(se,{}),r(`custom-ui:exporting.button`)]})}function jn({row:e,instances:t,selectedInstanceId:n,canDelete:r,features:i,notify:a,actions:o,lifecycle:s,onSelectInstance:c,onPreview:l,onViewSource:d,onDeleted:f}){let{t:p}=u(),m=e.kind===`native`&&e.status===`ready`&&!!e.manifest;return(0,Q.jsxs)(`div`,{"data-studio-settings":!0,className:`flex h-full min-h-0 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto px-4 pt-4 pb-5`,children:[(0,Q.jsx)(Sn,{row:e,actions:o}),(0,Q.jsx)(Cn,{row:e}),m&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(wn,{row:e,instances:t,selectedInstanceId:n,notify:a,actions:o,onSelectInstance:c,onPreview:l}),(0,Q.jsx)(Tn,{row:e,usageEnabled:i.usage,canRevoke:i.revoke,lifecycle:s}),(0,Q.jsx)(Dn,{row:e,instances:t,actions:o})]}),e.kind===`native`&&(0,Q.jsx)(gn,{row:e,enabled:i.versions,notify:a,actions:s})]}),(0,Q.jsxs)(`footer`,{className:`flex flex-none items-center gap-2 border-t border-stroke bg-panel px-4 py-2.5`,children:[m&&(0,Q.jsx)(On,{row:e,instances:t,actions:o}),(0,Q.jsxs)(I,{size:`sm`,variant:`secondary`,onClick:d,"data-component-view-source":!0,children:[(0,Q.jsx)(k,{}),p(`custom-ui:studio.viewSource`)]}),i.export&&e.kind===`native`&&(0,Q.jsx)(An,{row:e,lifecycle:s}),r&&(0,Q.jsx)(`span`,{className:`ml-auto`,children:(0,Q.jsx)(kn,{row:e,actions:o,onDeleted:f})})]})]})}var Mn=(0,Z.createContext)({code:``}),Nn=({code:e,language:t,className:n,showLineNumbers:r=!1,children:i,...a})=>{let o={code:e};return(0,Q.jsx)(Mn.Provider,{value:o,children:(0,Q.jsxs)(`div`,{className:F(`group relative w-full overflow-hidden rounded-md border bg-background text-foreground`,n),"data-language":t,...a,children:[(0,Q.jsx)(`div`,{className:`relative overflow-auto`,children:(0,Q.jsx)(`pre`,{className:`m-0 p-4 text-sm leading-relaxed`,children:(0,Q.jsx)(`code`,{className:`font-mono whitespace-pre`,children:e})})}),i]})})},Pn=({onCopy:e,onError:t,timeout:n=2e3,children:r,className:i,...a})=>{let[o,s]=(0,Z.useState)(!1),{code:c}=(0,Z.useContext)(Mn),l=async()=>{if(typeof window>`u`||!navigator?.clipboard?.writeText){t?.(Error(`Clipboard API not available`));return}try{await navigator.clipboard.writeText(c),s(!0),e?.(),setTimeout(()=>s(!1),n)}catch(e){t?.(e)}},u=o?ne:oe;return(0,Q.jsx)(I,{className:F(`shrink-0`,i),onClick:l,size:`icon`,variant:`ghost`,...a,children:r??(0,Q.jsx)(u,{size:14})})},Fn=(0,Z.lazy)(()=>t(()=>import(`./public-diff-4sBkfeo8.js`).then(e=>({default:e.InlineGitDiff})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]))),In=/\.(?:m?js|css|json|svg|md|txt)$/i;function Ln(e){return/\.m?js$/i.test(e)?`javascript`:/\.css$/i.test(e)?`css`:/\.json$/i.test(e)?`json`:/\.svg$/i.test(e)?`xml`:`text`}function Rn({enabled:e,lifecycle:t,onStaged:n,className:r}){let{t:i}=u(),a=(0,Z.useRef)(null),[o,s]=(0,Z.useState)(!1);return!e||!t?(0,Q.jsxs)(I,{size:`sm`,variant:`ghost`,"aria-disabled":`true`,title:i(`custom-ui:importing.unsupported`),"aria-label":`${i(`custom-ui:studio.importZip`)} · ${i(`custom-ui:importing.unsupported`)}`,"data-component-import":!0,className:r,onClick:e=>e.preventDefault(),children:[(0,Q.jsx)(Pt,{}),i(`custom-ui:studio.importZip`)]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(I,{size:`sm`,variant:`ghost`,disabled:o,"data-component-import":!0,className:r,onClick:()=>a.current?.click(),children:[(0,Q.jsx)(Pt,{}),i(o?`custom-ui:importing.staging`:`custom-ui:studio.importZip`)]}),(0,Q.jsx)(`input`,{ref:a,type:`file`,accept:`.zip,application/zip`,hidden:!0,"data-component-import-input":!0,onChange:async e=>{let r=e.target.files?.[0];if(e.target.value=``,!r)return;s(!0);let i=await t.stageImport(r);s(!1),i&&n?.(i)}})]})}function zn({staged:e,phone:t=!1,onReview:n}){let{t:r}=u();return(0,Q.jsxs)(`div`,{"data-staged-row":e.stageId,className:F(`flex flex-col gap-1.5 rounded-[var(--r-md)] border border-dashed border-st-attn-border bg-st-attn-soft px-2.5 py-2`,t&&`px-3.5 py-3`),children:[(0,Q.jsxs)(`p`,{className:`flex min-w-0 items-center gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 flex-none rounded-full bg-st-attn-fill`}),(0,Q.jsx)(`strong`,{className:`min-w-0 truncate font-medium`,children:e.fileName}),(0,Q.jsx)(`span`,{className:`flex-none text-xs text-content-muted`,children:r(`custom-ui:importing.shared`)})]}),(0,Q.jsx)(`p`,{className:`text-xs text-content-secondary`,children:r(`custom-ui:importing.needsReview`)}),(0,Q.jsxs)(I,{size:t?`sm`:`xs`,variant:`secondary`,className:F(`w-fit`,t&&`min-h-11`),"data-staged-review":e.stageId,onClick:n,children:[(0,Q.jsx)(pe,{}),r(`custom-ui:importing.review`)]})]})}function Bn(e){return e===`danger`?`text-st-fail`:`text-content-secondary`}function Vn(e,t){switch(e){case`fetch`:return t(`custom-ui:scan.ruleFetch`);case`xhr`:return t(`custom-ui:scan.ruleXhr`);case`websocket`:return t(`custom-ui:scan.ruleWebsocket`);case`eval`:return t(`custom-ui:scan.ruleEval`);case`function`:return t(`custom-ui:scan.ruleFunction`);case`cookie`:return t(`custom-ui:scan.ruleCookie`);case`local-storage`:return t(`custom-ui:scan.ruleLocalStorage`);case`app-api`:return t(`custom-ui:scan.ruleAppApi`);case`dynamic-import`:return t(`custom-ui:scan.ruleDynamicImport`);default:return e}}function Hn({scan:e}){let{t}=u();if(e.status!==`ok`)return(0,Q.jsx)(`p`,{className:`text-xs text-content-muted`,children:t(`custom-ui:scan.unsupported`)});let n=!e.findings.length&&!e.summary.undeclaredHosts;return(0,Q.jsxs)(`div`,{"data-component-scan":!0,className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`p`,{className:F(`text-xs`,e.summary.danger||e.summary.undeclaredHosts?`text-st-fail`:`text-content-secondary`),"data-scan-summary":!0,children:n?t(`custom-ui:scan.clean`):t(`custom-ui:scan.summary`,{danger:e.summary.danger,warn:e.summary.warn+e.summary.info,hosts:e.summary.undeclaredHosts})}),e.hosts.length>0&&(0,Q.jsx)(`ul`,{className:`flex flex-col gap-0.5 text-xs`,"data-scan-hosts":!0,children:e.hosts.map(e=>(0,Q.jsxs)(`li`,{"data-scan-host":e.host,"data-declared":e.declared,className:`flex min-w-0 items-baseline gap-2`,children:[(0,Q.jsx)(`code`,{className:F(`min-w-0 truncate font-mono`,e.declared?`text-content-secondary`:`text-st-fail`),children:e.host}),(0,Q.jsx)(`span`,{className:e.declared?`text-content-muted`:`text-st-fail`,children:e.declared?t(`custom-ui:scan.hostDeclared`):t(`custom-ui:scan.hostUndeclared`)})]},e.host))}),e.findings.length>0&&(0,Q.jsx)(`ul`,{className:`flex flex-col gap-1.5`,"data-scan-findings":!0,children:e.findings.map((e,n)=>(0,Q.jsxs)(`li`,{"data-scan-finding":e.rule,"data-severity":e.severity,className:`flex min-w-0 flex-col gap-0.5 text-xs`,children:[(0,Q.jsxs)(`span`,{className:F(`flex items-center gap-1.5`,Bn(e.severity)),children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:F(`size-1.5 flex-none rounded-full`,e.severity===`danger`?`bg-st-fail`:`bg-content-muted`)}),Vn(e.rule,t),(0,Q.jsxs)(`code`,{className:`ml-auto flex-none font-mono text-content-muted`,children:[e.file,`:`,e.line]})]}),e.excerpt&&(0,Q.jsx)(`code`,{className:`block truncate rounded-sm bg-surface-subtle px-1.5 py-0.5 font-mono text-[11px] text-content-secondary`,children:e.excerpt})]},`${e.file}:${e.line}:${e.rule}:${n}`))}),e.truncated&&(0,Q.jsx)(`p`,{className:`text-xs text-content-muted`,children:t(`custom-ui:scan.truncated`)})]})}function Un({title:e,children:t}){return(0,Q.jsxs)(`section`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsx)(`h3`,{className:`text-xs font-semibold text-content-secondary`,children:e}),t]})}function Wn({stageId:e,lifecycle:t,onClose:n,onTrusted:r}){let{t:i}=u(),a=un(e),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(``),[d,p]=(0,Z.useState)(!1),m=(0,Z.useId)(),h=a.data,g=(h?.files??[]).filter(e=>In.test(e.path)),v=h?.manifest?.entry??``,y=g.find(e=>e.path===o)?.path??g.find(e=>e.path===v)?.path??g[0]?.path??``;(0,Z.useEffect)(()=>{s(``),p(!1)},[e]);let b=f({queryKey:[..._.staged(e),`file`,y],queryFn:({signal:t})=>wt(e,y,t),enabled:!!(e&&y),retry:!1,staleTime:1/0,refetchOnWindowFocus:!1}),x=h?.staged,S=h?.manifest?.capabilities??{},C=[`network`,`notify`,`sessions.read`,`sessions.open`,`storage`,`provider.request`].filter(e=>S[e]),w=async()=>{l(`trust`);let n=await t.trust(e);l(``),n&&r(n.component)},T=async()=>{l(`discard`);let r=await t.discard(e);l(``),r&&n()};return(0,Q.jsx)(H,{open:!!e,onOpenChange:e=>!e&&!c&&n(),children:(0,Q.jsxs)(R,{"data-trust-dialog":e,scrollMode:`body`,className:`h-[min(820px,calc(100dvh-2rem))] max-w-[min(1040px,calc(100vw-2rem))]`,children:[(0,Q.jsxs)(V,{children:[(0,Q.jsx)(z,{children:x?i(`custom-ui:importing.reviewTitle`,{name:h?.manifest?.name||x.name,version:x.version?` v${x.version}`:``}):i(`custom-ui:importing.reviewLoading`)}),(0,Q.jsx)(L,{className:`flex flex-wrap gap-x-2 gap-y-0.5 font-mono text-xs`,children:x&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{children:x.fileName}),(0,Q.jsx)(`span`,{children:Be(x.bytes)}),(0,Q.jsxs)(`span`,{className:`break-all`,"data-trust-sha256":!0,children:[`sha256 `,x.sha256]})]})})]}),(0,Q.jsx)(Ve,{className:`-mx-4 border-y border-stroke`,children:a.isPending?(0,Q.jsx)(`p`,{className:`p-4 text-sm text-content-muted`,children:i(`custom-ui:importing.reviewLoading`)}):a.error||!h?(0,Q.jsx)(`p`,{className:`p-4 text-sm text-content-muted`,children:i(`custom-ui:importing.reviewFailed`)}):(0,Q.jsxs)(`div`,{className:`grid min-h-full grid-cols-1 md:grid-cols-[minmax(0,1fr)_320px]`,children:[(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col gap-2 p-4 md:border-r md:border-stroke`,children:[(0,Q.jsx)(`div`,{role:`group`,id:m,"aria-label":i(`custom-ui:importing.files`),className:`flex flex-wrap gap-1`,"data-trust-files":!0,children:h.files.map(e=>In.test(e.path)?(0,Q.jsxs)(vt,{size:`sm`,"aria-pressed":e.path===y,"data-trust-file":e.path,className:`font-mono`,onClick:()=>{p(!1),s(e.path)},children:[e.path,(0,Q.jsx)(`span`,{className:`text-content-muted`,children:Be(e.size)})]},e.path):(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-1.5 font-mono text-xs text-content-muted`,children:[e.path,` · `,Be(e.size)]},e.path))}),d&&h.diff?(0,Q.jsx)(`div`,{"data-trust-diff-view":!0,className:`min-h-[240px] flex-1 overflow-auto rounded-[var(--r-md)] border border-stroke`,children:(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(Fn,{diff:h.diff.diff,truncated:h.diff.truncated,mode:`unified`})})}):y&&b.data?(0,Q.jsx)(Nn,{code:b.data.content,language:Ln(y),"data-trust-source":y,className:`min-h-[240px] flex-1 overflow-auto bg-code [&>div]:h-full`}):(0,Q.jsx)(`p`,{className:`text-xs text-content-muted`,children:b.isPending&&y?i(`custom-ui:studio.sourceLoading`):i(`custom-ui:studio.sourceUnavailable`)}),b.data?.truncated&&(0,Q.jsx)(`p`,{className:`text-xs text-content-muted`,children:i(`custom-ui:importing.truncated`)})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4 p-4`,children:[h.installed&&(0,Q.jsxs)(`div`,{"data-trust-replaces":!0,className:`flex flex-col gap-1.5 rounded-[var(--r-md)] border border-stroke bg-surface-subtle px-3 py-2 text-xs text-content-secondary`,children:[(0,Q.jsx)(`p`,{children:i(`custom-ui:importing.replaces`,{version:h.installed.version?`v${h.installed.version}`:``})}),h.diff&&h.diff.files.length>0&&(0,Q.jsxs)(I,{size:`xs`,variant:`secondary`,className:`w-fit`,"data-trust-diff":!0,"aria-pressed":d,onClick:()=>p(e=>!e),children:[(0,Q.jsx)(Ft,{}),d?i(`custom-ui:importing.hideDiff`):i(`custom-ui:importing.viewDiff`,{count:h.diff.files.length})]})]}),(0,Q.jsx)(Un,{title:i(`custom-ui:importing.manifest`),children:h.manifest?(0,Q.jsxs)(`dl`,{className:`grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-0.5 text-xs`,children:[(0,Q.jsx)(`dt`,{className:`text-content-muted`,children:`id`}),(0,Q.jsx)(`dd`,{className:`truncate font-mono`,children:h.manifest.id}),(0,Q.jsx)(`dt`,{className:`text-content-muted`,children:i(`custom-ui:importing.entry`)}),(0,Q.jsx)(`dd`,{className:`truncate font-mono`,children:h.manifest.entry}),(0,Q.jsx)(`dt`,{className:`text-content-muted`,children:i(`custom-ui:studio.placements`)}),(0,Q.jsx)(`dd`,{children:h.manifest.placements.map(e=>J(e.surface,i)).join(` · `)||`—`})]}):(0,Q.jsx)(`p`,{className:`text-xs text-st-fail`,children:i(`custom-ui:importing.manifestInvalid`)})}),(0,Q.jsx)(Un,{title:i(`custom-ui:importing.capabilities`),children:C.length?(0,Q.jsx)(`ul`,{className:`flex flex-col gap-1 text-xs`,"data-trust-capabilities":!0,children:C.map(e=>(0,Q.jsxs)(`li`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsxs)(`span`,{children:[St(e,i),e===`provider.request`&&(0,Q.jsxs)(`code`,{className:`ml-1 break-all font-mono text-content-secondary`,children:[S[`provider.request`]?.methods.join(`/`),` `,S[`provider.request`]?.paths.join(`, `)]}),e===`network`&&(0,Q.jsx)(`code`,{className:`ml-1.5 break-all font-mono text-content-secondary`,children:Tt(S.network)})]}),e===`network`&&(S.network?.privateOrigins?.length??0)>0&&(0,Q.jsx)(`span`,{className:`text-content-secondary`,"data-trust-private-network":!0,children:i(`custom-ui:importing.privateNetwork`)}),S[e]?.reason&&(0,Q.jsx)(`span`,{className:`text-content-muted`,children:S[e]?.reason})]},e))}):(0,Q.jsx)(`p`,{className:`text-xs text-content-muted`,children:i(`custom-ui:studio.capNone`)})}),(0,Q.jsx)(Un,{title:i(`custom-ui:importing.scan`),children:(0,Q.jsx)(Hn,{scan:h.scan})}),(0,Q.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:i(`custom-ui:importing.explainer`)})]})]})}),(0,Q.jsxs)(B,{className:`flex-row flex-wrap items-center gap-2 sm:justify-between`,children:[(0,Q.jsx)(I,{variant:`ghost`,size:`sm`,className:`text-danger`,disabled:!!c,"data-trust-discard":!0,onClick:()=>void T(),children:i(`custom-ui:importing.discard`)}),(0,Q.jsxs)(`span`,{className:`ml-auto flex gap-2`,children:[(0,Q.jsx)(I,{variant:`outline`,size:`sm`,disabled:!!c,onClick:n,children:i(`custom-ui:studio.cancel`)}),(0,Q.jsx)(I,{size:`sm`,disabled:!!c||!h?.manifest,"data-trust-confirm":!0,onClick:()=>void w(),children:i(`custom-ui:importing.trust`)})]})]})]})})}var Gn=864e5;function Kn({enabled:e,lifecycle:t,onRestored:n,className:r}){let{t:i,language:a}=u(),o=ln(e),[s,c]=(0,Z.useState)(!1),[l,d]=(0,Z.useState)(``),[f,p]=(0,Z.useState)(null);if(!e)return null;let m=o.data?.entries??[],h=async e=>{d(e.entry);let r=await t.restoreTrash(e);d(``),r&&(c(!1),n?.(r.component))},g=async()=>{if(!f)return;d(f.entry);let e=await t.purgeTrash(f);d(``),e&&p(null)},_=e=>{if(!e.expiresAt)return i(`custom-ui:trash.keptLegacy`);let t=Math.max(0,Math.ceil((Date.parse(e.expiresAt)-Date.now())/Gn));return i(`custom-ui:trash.expiresIn`,{count:t})};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(I,{size:`xs`,variant:`ghost`,"data-component-trash":!0,className:r,onClick:()=>c(!0),children:[(0,Q.jsx)(j,{}),i(`custom-ui:trash.button`),m.length>0&&(0,Q.jsx)(`span`,{className:`tabular-nums`,children:m.length})]}),(0,Q.jsx)(H,{open:s,onOpenChange:e=>!l&&c(e),children:(0,Q.jsxs)(R,{size:`wide`,scrollMode:`body`,"data-trash-dialog":!0,children:[(0,Q.jsxs)(V,{children:[(0,Q.jsx)(z,{children:i(`custom-ui:trash.title`)}),(0,Q.jsx)(L,{children:i(`custom-ui:trash.hint`,{days:o.data?.retentionDays??7})})]}),(0,Q.jsx)(Ve,{className:`-mx-4 border-t border-stroke`,children:o.isPending?(0,Q.jsx)(`p`,{className:`p-4 text-sm text-content-muted`,children:i(`custom-ui:trash.loading`)}):o.error?(0,Q.jsx)(`p`,{className:`p-4 text-sm text-content-muted`,children:i(`custom-ui:trash.failed`)}):m.length?(0,Q.jsx)(`ul`,{className:`flex flex-col`,children:m.map(e=>(0,Q.jsxs)(`li`,{"data-trash-entry":e.entry,className:`flex min-w-0 items-center gap-3 border-b border-stroke px-4 py-2.5 last:border-b-0`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-1.5 text-sm`,children:[(0,Q.jsx)(`strong`,{className:`min-w-0 truncate font-medium`,children:e.name}),e.version&&(0,Q.jsxs)(`span`,{className:`flex-none font-mono text-xs text-content-muted`,children:[`v`,e.version]})]}),(0,Q.jsx)(`span`,{className:`truncate text-xs text-content-muted`,children:[e.reason===`legacy-retired`?i(`custom-ui:trash.legacyRetired`):i(`custom-ui:trash.deletedAt`,{time:ze(e.deletedAt,a)}),e.instances?i(`custom-ui:trash.instances`,{count:e.instances}):``,_(e)].filter(Boolean).join(` · `)})]}),e.kind===`native`&&(0,Q.jsx)(I,{size:`xs`,variant:`secondary`,disabled:!!l,"data-trash-restore":e.entry,onClick:()=>void h(e),children:i(`custom-ui:trash.restore`)}),(0,Q.jsx)(I,{size:`xs`,variant:`ghost`,className:`text-danger`,disabled:!!l,"data-trash-purge":e.entry,onClick:()=>p(e),children:i(`custom-ui:trash.purge`)})]},e.entry))}):(0,Q.jsx)(`p`,{className:`p-4 text-sm text-content-muted`,children:i(`custom-ui:trash.empty`)})})]})}),(0,Q.jsx)(H,{open:!!f,onOpenChange:e=>!e&&!l&&p(null),children:(0,Q.jsxs)(R,{size:`compact`,surface:`confirmation`,children:[(0,Q.jsxs)(V,{children:[(0,Q.jsx)(z,{children:i(`custom-ui:trash.purgeTitle`,{name:f?.name??``})}),(0,Q.jsx)(L,{children:i(`custom-ui:trash.purgeHint`)})]}),(0,Q.jsxs)(B,{children:[(0,Q.jsx)(I,{variant:`outline`,disabled:!!l,onClick:()=>p(null),children:i(`custom-ui:studio.cancel`)}),(0,Q.jsx)(I,{variant:`destructive`,disabled:!!l,"data-trash-purge-confirm":!0,onClick:()=>void g(),children:i(`custom-ui:trash.purgeConfirm`)})]})]})})]})}function qn(e){let t=tt(),[n,r]=(0,Z.useState)(()=>t.read(e));return(0,Z.useEffect)(()=>(r(t.read(e)),t.subscribe(n=>{n===e&&r(t.read(e))})),[t,e]),n}function Jn(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleTimeString(void 0,{hour12:!1})}function Yn({at:e,level:t,kind:n,message:r,stack:i}){return(0,Q.jsxs)(`li`,{className:`flex min-w-0 flex-col gap-0.5 border-b border-stroke px-3 py-2 last:border-b-0`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2 font-mono text-xs`,children:[(0,Q.jsx)(`span`,{className:`flex-none text-content-muted tabular-nums`,children:Jn(e)}),(0,Q.jsx)(`span`,{className:F(`flex-none uppercase`,t===`error`?`text-st-fail font-medium`:`text-content-muted`),children:t}),(0,Q.jsx)(`span`,{className:`flex-none text-content-muted`,children:n}),(0,Q.jsx)(`span`,{className:`min-w-0 break-all text-content`,children:r})]}),i&&(0,Q.jsx)(`pre`,{className:`max-h-28 overflow-auto font-mono text-xs whitespace-pre-wrap text-content-muted`,children:i})]})}function Xn({componentId:e,errors:t,errorsFailed:n}){let{t:r}=u(),i=tt(),a=qn(e),o=t?.entries??[];return(0,Q.jsxs)(`div`,{"data-studio-logs":!0,className:`flex min-h-0 min-w-0 flex-1 flex-col gap-3 overflow-y-auto`,children:[(0,Q.jsxs)(`section`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsxs)(`header`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`h3`,{className:`text-xs font-medium text-content-secondary`,children:r(`custom-ui:studio.logsLocal`)}),a.length>0&&(0,Q.jsx)(I,{size:`xs`,variant:`ghost`,onClick:()=>i.clear(e),children:r(`custom-ui:studio.logsClear`)})]}),a.length?(0,Q.jsx)(`ul`,{className:`overflow-hidden rounded-[var(--r-md)] border border-stroke bg-panel`,children:[...a].reverse().map((e,t)=>(0,Q.jsx)(Yn,{...e},`${e.at}:${t}`))}):(0,Q.jsx)(`p`,{className:`text-xs text-content-muted`,children:r(`custom-ui:studio.logsLocalEmpty`)})]}),(0,Q.jsxs)(`section`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsxs)(`h3`,{className:`text-xs font-medium text-content-secondary`,children:[r(`custom-ui:studio.logsRuntime`),t&&t.dropped>0&&(0,Q.jsx)(`span`,{className:`ml-2 font-normal text-content-muted`,children:r(`custom-ui:studio.logsDropped`,{count:t.dropped})})]}),n?(0,Q.jsx)(`p`,{className:`text-xs text-content-muted`,children:r(`custom-ui:studio.logsRuntimeFailed`)}):o.length?(0,Q.jsx)(`ul`,{"data-studio-runtime-logs":!0,className:`overflow-hidden rounded-[var(--r-md)] border border-stroke bg-panel`,children:[...o].reverse().map((e,t)=>(0,Q.jsx)(Yn,{...e},`${e.at}:${t}`))}):(0,Q.jsx)(`p`,{className:`text-xs text-content-muted`,children:r(`custom-ui:studio.logsRuntimeEmpty`)})]})]})}function Zn(e,t){let n=d(),r=f({queryKey:_.errors(e),queryFn:({signal:t})=>b(e,t),enabled:t,retry:!1,refetchInterval:15e3,refetchOnWindowFocus:!1});return(0,Z.useEffect)(()=>{if(!t)return;let r=null,i=tt().subscribe(t=>{t===e&&r===null&&(r=window.setTimeout(()=>{r=null,n.invalidateQueries({queryKey:_.errors(e)})},800))});return()=>{i(),r!==null&&window.clearTimeout(r)}},[n,e,t]),r}var Qn=new Map;function $n({sessionId:e,onOpen:t}){let{t:n}=u(),r=Re({doneWindow:`today`}).all.find(t=>t.id===e)?.lane,i=n(r===`running`?`custom-ui:agent.statusRunning`:r===`attention`?`custom-ui:agent.statusAttention`:r===`queued`?`custom-ui:agent.statusQueued`:r===`done`?`custom-ui:agent.statusDone`:`custom-ui:agent.statusSent`);return(0,Q.jsxs)(`span`,{"data-component-agent-status":r??`sent`,className:`flex min-w-0 items-center gap-1.5 text-xs text-content-muted`,children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:F(`size-1.5 flex-none rounded-full`,r===`attention`?`bg-st-attn`:r===`running`?`bg-st-run`:`bg-st-done`)}),(0,Q.jsx)(`span`,{className:`truncate`,children:i}),(0,Q.jsxs)(I,{size:`xs`,variant:`ghost`,"data-component-agent-open":e,className:`flex-none`,onClick:t,children:[n(`custom-ui:agent.openSession`),(0,Q.jsx)(D,{})]})]})}function er({row:e,notify:t,autoFocus:n=!1,onSent:r,className:a}){let{t:o,language:c}=u(),l=i(),d=(0,Z.useId)(),p=f(v()),m=sn(e.id,p.data?.features.versions===!0).data?.current,h=m?.source===`agent`?m:null,g=mt(t),{pending:_,sessionId:y}=bt(e.id),[b,x]=(0,Z.useState)(()=>Qn.get(e.id)??``),S=t=>{t?Qn.set(e.id,t):Qn.delete(e.id),x(t)},C=b.trim(),w=async()=>{if(!C||_)return;let t=await g.generate(e,C);t&&(S(``),r?.(t))};return(0,Q.jsxs)(`form`,{"data-component-prompt":e.id,className:F(`flex flex-col gap-2 rounded-[var(--r-lg)] border border-stroke bg-panel p-3`,a),onSubmit:e=>{e.preventDefault(),w()},children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`label`,{htmlFor:d,className:`mr-auto text-xs font-medium text-content-secondary`,children:o(`custom-ui:agent.promptTitle`)}),m&&(0,Q.jsx)(vt,{asChild:!0,size:`sm`,className:`hover:bg-solid hover:text-content-secondary`,children:(0,Q.jsx)(`span`,{"data-prompt-base":m.n,children:o(`custom-ui:agent.basedOn`,{n:m.n})})})]}),(0,Q.jsx)(He,{id:d,autoFocus:n,rows:2,value:b,maxLength:Et,placeholder:o(`custom-ui:agent.promptPlaceholder`),"aria-keyshortcuts":`Meta+Enter Control+Enter`,"data-component-prompt-input":!0,className:`max-h-40 min-h-14 resize-none`,onChange:e=>S(e.target.value),onKeyDown:e=>{e.key!==`Enter`||!(e.metaKey||e.ctrlKey)||e.nativeEvent.isComposing||(e.preventDefault(),w())}}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[y?(0,Q.jsx)($n,{sessionId:y,onOpen:()=>l(s(y))}):(0,Q.jsx)(`span`,{className:`text-xs text-content-muted`,children:o(`custom-ui:agent.promptHint`)}),(0,Q.jsxs)(I,{type:`submit`,size:`sm`,disabled:!C||_,"aria-keyshortcuts":`Meta+Enter Control+Enter`,"data-component-generate":!0,className:`ml-auto`,children:[_&&(0,Q.jsx)(Oe,{}),o(_?`custom-ui:agent.sending`:`custom-ui:agent.generate`),!_&&(0,Q.jsx)(ke,{className:`bg-transparent text-current`,children:Ae(`Mod+Enter`)})]})]}),h&&(0,Q.jsxs)(`div`,{"data-prompt-result":h.n,className:`flex min-w-0 flex-col gap-1`,children:[(0,Q.jsx)(`p`,{className:`truncate text-xs text-content-muted`,children:[o(`custom-ui:agent.generatedVersion`,{n:h.n}),h.files.length?o(`custom-ui:agent.wrote`,{files:h.files.map(e=>e.path).join(` `)}):``,o(`custom-ui:versions.sourceAgent`),h.at?ze(h.at,c):``].filter(Boolean).join(` · `)}),(0,Q.jsx)(mn,{version:h})]})]})}var $=`manifest.json`,tr=/\.(?:m?js|css|json|svg|txt|md)$/i;function nr(e){return/\.m?js$/i.test(e)?`javascript`:/\.css$/i.test(e)?`css`:/\.json$/i.test(e)?`json`:/\.svg$/i.test(e)?`xml`:`text`}function rr({row:e}){let{t}=u(),n=f({queryKey:_.describe(e.id),queryFn:({signal:t})=>h(e.id,t),retry:!1,refetchOnWindowFocus:!1}),r=(n.data?.files??[]).map(e=>e.path).filter(e=>e===$||tr.test(e)&&e.split(`/`).length<=3),i=[...r.filter(t=>t===e.entry),...r.filter(t=>t!==e.entry)],[a,o]=(0,Z.useState)(``),s=i.includes(a)?a:i[0]??``;(0,Z.useEffect)(()=>o(``),[e.id]);let c=f({queryKey:[..._.describe(e.id),`source`,e.rev??``,s],queryFn:({signal:t})=>m(e.id,e.rev??``,s,t),enabled:!!(s&&s!==$&&e.rev),retry:!1,refetchOnWindowFocus:!1,staleTime:1/0});if(n.isPending)return(0,Q.jsx)(`p`,{className:`p-4 text-sm text-content-muted`,children:t(`custom-ui:studio.sourceLoading`)});if(n.error||!i.length)return(0,Q.jsx)(G,{className:`flex-1`,title:t(`custom-ui:studio.sourceUnavailable`)});let l=JSON.stringify(e.manifest??{errors:e.errors},null,2),d=s===$?l:c.data===void 0?``:c.data;return(0,Q.jsxs)(`div`,{"data-studio-source":!0,className:`flex min-h-0 min-w-0 flex-1 flex-col gap-2`,children:[(0,Q.jsx)(`div`,{role:`group`,"aria-label":t(`custom-ui:studio.sourceFiles`),className:`flex flex-none flex-wrap gap-1`,children:i.map(e=>(0,Q.jsx)(vt,{size:`sm`,"aria-pressed":e===s,"data-studio-source-file":e,className:`font-mono`,onClick:()=>o(e),children:e},e))}),s===$&&(0,Q.jsx)(`p`,{className:`text-xs text-content-muted`,children:t(`custom-ui:studio.sourceManifestHint`)}),s!==$&&!e.rev?(0,Q.jsx)(G,{className:`flex-1`,title:t(`custom-ui:studio.sourceNotReady`)}):c.error&&s!==$?(0,Q.jsx)(G,{className:`flex-1`,title:t(`custom-ui:studio.sourceUnavailable`)}):(0,Q.jsx)(Nn,{code:d,language:nr(s),"data-studio-source-code":s,className:`min-h-0 flex-1 overflow-auto bg-code [&>div]:h-full`,children:(0,Q.jsx)(Pn,{"aria-label":t(`custom-ui:studio.copySource`),title:t(`custom-ui:studio.copySource`),className:`absolute top-1.5 right-1.5`})})]})}function ir(e){let[t,n]=(0,Z.useState)(null);return(0,Z.useEffect)(()=>(n(null),p(t=>{t.id===e&&t.reason===`files`&&n(Date.now())})),[e]),t}function ar({at:e}){let{t}=u(),[n,r]=(0,Z.useState)(()=>Date.now());(0,Z.useEffect)(()=>{let e=window.setInterval(()=>r(Date.now()),1e3);return()=>window.clearInterval(e)},[]);let i=Math.max(0,Math.round((n-e)/1e3));return(0,Q.jsxs)(`span`,{"data-studio-reloaded":!0,className:`flex items-center gap-1.5 text-xs text-content-muted`,children:[(0,Q.jsxs)(`span`,{"aria-hidden":!0,className:`relative flex size-1.5 flex-none`,children:[(0,Q.jsx)(`span`,{className:`absolute inset-0 rounded-full bg-content-muted animate-[ping_700ms_cubic-bezier(0,0,0.2,1)_1] [:root[data-motion=reduced]_&]:animate-none motion-reduce:[:root:not([data-motion=full])_&]:animate-none`},e),(0,Q.jsx)(`span`,{className:`relative size-1.5 rounded-full bg-content-muted`})]}),(0,Q.jsx)(`span`,{children:i<60?t(`custom-ui:studio.reloadedSeconds`,{count:i}):t(`custom-ui:studio.reloadedMinutes`,{count:Math.floor(i/60)})})]})}function or({activeSessionId:e=``,row:t,tab:n,target:r,window:i,instanceId:a,draft:o,notify:s,commits:c,settingsButton:l,onTab:d,onTarget:f,onWindow:p}){let{t:m,language:h}=u(),g=t.kind===`native`&&t.status===`ready`&&!!(t.manifest&&t.rev),_=ir(t.id),v=Zn(t.id,t.kind===`native`);return(0,Q.jsxs)(`section`,{"data-studio-workbench":!0,"data-component-stage":t.id,"data-component-kind":t.kind,"aria-label":m(`custom-ui:studio.workbench`),className:`flex min-h-0 min-w-0 flex-col`,children:[(0,Q.jsxs)(`header`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2 border-b border-stroke px-5 py-3`,children:[(0,Q.jsxs)(`h2`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,Q.jsx)(`span`,{className:`truncate text-base font-semibold`,children:Y(t,h)}),t.version&&(0,Q.jsxs)(`span`,{className:`flex-none font-mono text-xs text-content-muted tabular-nums`,children:[`v`,t.version]})]}),_!==null&&(0,Q.jsx)(ar,{at:_}),(0,Q.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[(0,Q.jsx)(P,{size:`sm`,"aria-label":m(`custom-ui:studio.workbenchView`),value:n,onValueChange:d,options:[{value:`preview`,label:m(`custom-ui:studio.tabPreview`)},{value:`source`,label:m(`custom-ui:studio.tabSource`)},{value:`logs`,label:m(`custom-ui:studio.tabLogs`)}]}),l]})]}),(0,Q.jsxs)(`div`,{className:F(`flex min-h-0 flex-1 flex-col gap-3 px-5 pt-4 pb-3`),children:[t.kind===`native`&&(0,Q.jsx)(er,{row:t,notify:s,className:`flex-none`}),n===`source`?(0,Q.jsx)(rr,{row:t}):n===`logs`?(0,Q.jsx)(Xn,{componentId:t.id,errors:v.data,errorsFailed:!!v.error}):g?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Rt,{manifest:t.manifest,target:r,window:i,onTarget:f,onWindow:p}),(0,Q.jsx)(zt,{activeSessionId:e,row:t,target:r,window:i,instanceId:a,title:o.title,props:o.props,notify:s,commits:c}),(0,Q.jsx)(Bt,{componentId:t.id,errors:v.data,commits:c})]}):(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto`,children:[(0,Q.jsx)(Cn,{row:t}),(0,Q.jsx)(G,{className:`flex-1`,title:t.kind===`broken`?m(`custom-ui:studio.brokenTitle`):m(`custom-ui:studio.invalidTitle`),description:t.kind===`broken`?m(`custom-ui:studio.brokenHint`):m(`custom-ui:studio.invalidHint`)})]})]})]})}function sr({onOpen:e}){let{t}=u();return(0,Q.jsxs)(I,{size:`sm`,variant:`secondary`,"data-studio-settings-open":!0,"aria-label":t(`custom-ui:studio.openSettings`),onClick:e,children:[(0,Q.jsx)(A,{}),t(`custom-ui:studio.settings`)]})}var cr=``,lr=[],ur=[],dr={import:!1,versions:!1,export:!1,trash:`none`,trashRestore:!1,usage:!1,revoke:!1};function fr({children:e}){let t=(0,Z.useRef)(null),n=$e(t),r=n.measured&&n.width>=1360;return(0,Q.jsx)(X,{variant:`workbench`,children:(0,Q.jsx)(`div`,{ref:t,"data-component-studio":!0,"data-studio-settings-mode":r?`inline`:`drawer`,className:`h-full min-h-0`,children:e(r)})})}function pr(e){(0,Z.useLayoutEffect)(()=>{if(e)return Le.getState().enterRouteRail(),()=>Le.getState().leaveRouteRail()},[e])}function mr(e,t){let n=et(),[r,i]=(0,Z.useState)(()=>n.version());(0,Z.useEffect)(()=>n.subscribe(()=>i(n.version())),[n]);let a=(0,Z.useRef)(new Map);return(0,Z.useEffect)(()=>{for(let t of e){let e=a.current.get(t.id);e&&t.rev&&e!==t.rev&&n.resume(`preview:${t.id}`),t.rev&&a.current.set(t.id,t.rev)}},[n,e]),(0,Z.useMemo)(()=>{let r=new Set;for(let i of e)(n.hasTrouble(`preview:${i.id}`,i.rev)||t.some(e=>e.componentId===i.id&&n.hasTrouble(e.instanceId,i.rev)))&&r.add(i.id);return r},[n,t,e,r])}function hr(e){if(typeof e!=`object`||!e)return``;let t=e.componentInstanceId;return typeof t==`string`&&t.length<=64?t:``}function gr(e,t,n){let[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)({id:``,instanceId:null}),[s,c]=(0,Z.useState)(`standard`),l=e?.id??``;(0,Z.useEffect)(()=>{!l||!n||(o({id:l,instanceId:n}),i(null))},[n,l]);let u=Mt(e?.manifest),d=e?t.filter(t=>t.componentId===e.id):[],f=e&&a.id===e.id?a.instanceId:void 0,p=f===null?null:f&&d.some(e=>e.instanceId===f)?f:d[0]?.instanceId??null,m=d.find(e=>e.instanceId===p)??null,h=e&&r?.id===e.id&&u.includes(r.target)?r.target:m&&u.includes(gt(m))?gt(m):u[0]??`feature-page`,g=`${e?.id??``}:${p??`preview`}`,[_,v]=(0,Z.useState)({key:``,title:``,props:{}}),y=(0,Z.useCallback)(e=>v({key:g,...e}),[g]);return{target:h,window:s,instanceId:p,draft:_.key===g?_:{title:m?.title??``,props:m?.props??{}},onPreview:y,setWindow:c,setTarget:t=>e&&i({id:e.id,target:t}),selectInstance:t=>{if(!e)return;o({id:e.id,instanceId:t});let n=d.find(e=>e.instanceId===t);n&&u.includes(gt(n))&&i({id:e.id,target:gt(n)})}}}function _r({activeSessionId:e=``,notify:t,selectedId:r=``,onSelect:i}){let{t:a,language:o}=u(),s=ee(),c=S(),l=x(),d=C().data?.instances??lr,f=Dt(t),p=fn(t),m=mt(t),[h,g]=(0,Z.useState)(``),[_,v]=(0,Z.useState)(!1),y=K(_),b=(0,Z.useMemo)(()=>it(l.data?.components??[]),[l.data]),w=l.data?.root||``,T=l.data?.features??dr,E=T.trash===`move`,te=l.data?.staged??ur,[D,O]=(0,Z.useState)(`all`),[ne,re]=(0,Z.useState)(``),[ae,k]=(0,Z.useState)(`preview`),[oe,se]=(0,Z.useState)(!1),ce=K(oe),[le,ue]=(0,Z.useState)(0),[de]=(0,Z.useState)(Lt),fe=mr(b,d),A=s?b.find(e=>e.id===r)??null:pt(b,r,cr),pe=A?.id??``;(0,Z.useEffect)(()=>{pe&&(cr=pe)},[pe]);let j=gr(A,d,hr(n().state));pr(!s&&c&&!l.data?.legacyShape);let ge=e=>{k(`preview`),i(e,!0)},_e=async(e,n,r)=>{let c=await f.createFromTemplate(e,n);return c&&(O(`all`),re(``),i(c.id,!s),r?.trim()?m.generate(c,r):t(a(`custom-ui:studio.created`,{name:Y(c,o)}))),c};if(!c||l.data?.legacyShape)return(0,Q.jsx)(X,{variant:`collection`,children:(0,Q.jsx)(W,{kind:`empty`,title:a(`custom-ui:studio.unsupportedTitle`),description:a(`custom-ui:studio.unsupportedHint`)})});if(l.isPending)return(0,Q.jsx)(W,{kind:`loading`,title:a(`custom-ui:customUiPage.loading`)});if(l.error&&!l.data)return(0,Q.jsx)(X,{variant:`collection`,children:(0,Q.jsx)(W,{kind:`error`,title:a(`custom-ui:widget.catalogFailed`),action:(0,Q.jsx)(I,{variant:`secondary`,size:`sm`,onClick:()=>void l.refetch(),children:a(`custom-ui:widget.retry`)})})});let ve=jt(b,fe),M={...ve,attention:ve.attention+te.length},ye=_t(b,{filter:D,query:ne,language:o,troubled:fe}),be=te.length>0&&D!==`enabled`,xe=e=>be?te.map(t=>(0,Q.jsx)(zn,{staged:t,phone:e,onReview:()=>g(t.stageId)},t.stageId)):null,Se=e=>(0,Q.jsx)(Rn,{enabled:T.import,lifecycle:p,className:e,onStaged:e=>g(e.stageId)}),N=(0,Q.jsx)(Wn,{stageId:h,lifecycle:p,onClose:()=>g(``),onTrusted:e=>{g(``),O(`all`),re(``),i(e.id,!s)}}),Ce=(0,Q.jsxs)(Q.Fragment,{children:[a(`custom-ui:customUiPage.emptyHint`),w&&(0,Q.jsx)(`code`,{className:`mx-auto mt-2 block max-w-full rounded-xs bg-inline-code px-2 py-1 font-mono text-xs break-all text-content-secondary`,children:w}),(0,Q.jsx)(`span`,{className:`mt-2 block`,children:a(`custom-ui:customUiPage.directoryLocationHint`)})]});if(s){let n=()=>i(``,!1);return r?(0,Q.jsx)(X,{variant:`collection`,children:(0,Q.jsxs)(`div`,{"data-components-phone":`detail`,className:`flex min-w-0 flex-col gap-4`,children:[(0,Q.jsxs)(I,{variant:`ghost`,className:`-ml-2 min-h-11 w-fit px-2 text-content-secondary`,onClick:n,children:[(0,Q.jsx)(ie,{"aria-hidden":`true`}),a(`custom-ui:phone.allComponents`)]}),A?(0,Q.jsxs)(`div`,{"data-component-stage":A.id,"data-component-kind":A.kind,className:`flex min-w-0 flex-col gap-5`,children:[(0,Q.jsx)(Sn,{row:A,actions:f}),(0,Q.jsx)(Cn,{row:A}),A.kind===`native`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(I,{variant:`secondary`,"data-component-prompt-open":!0,className:`min-h-11 w-full`,onClick:()=>v(!0),children:[(0,Q.jsx)(me,{}),a(`custom-ui:agent.editWithPrompt`)]}),(0,Q.jsx)(Ie,{open:_,onOpenChange:v,children:(0,Q.jsxs)(Ne,{side:`bottom`,onCloseAutoFocus:y,"data-component-prompt-sheet":!0,className:`gap-0 rounded-t-[var(--r-lg)] p-0`,children:[(0,Q.jsxs)(je,{className:`px-4 pt-4 pb-0`,children:[(0,Q.jsx)(Pe,{children:Y(A,o)}),(0,Q.jsx)(Fe,{className:`sr-only`,children:a(`custom-ui:agent.promptTitle`)})]}),(0,Q.jsx)(`div`,{className:`px-4 pt-3 pb-[max(16px,env(safe-area-inset-bottom))]`,children:(0,Q.jsx)(er,{row:A,notify:t,autoFocus:!0,className:`border-0 bg-transparent p-0`,onSent:()=>v(!1)})})]})})]}),A.kind===`native`&&A.status===`ready`&&A.manifest&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(Rt,{manifest:A.manifest,target:j.target,window:`standard`,phone:!0,onTarget:j.setTarget,onWindow:j.setWindow}),(0,Q.jsx)(zt,{activeSessionId:e,row:A,target:j.target,window:`standard`,instanceId:j.instanceId,title:j.draft.title,props:j.draft.props,phone:!0,notify:t,commits:de},le)]}),(0,Q.jsx)(wn,{row:A,instances:d,selectedInstanceId:j.instanceId,notify:t,actions:f,onSelectInstance:j.selectInstance,onPreview:j.onPreview}),(0,Q.jsx)(Tn,{row:A,usageEnabled:T.usage,canRevoke:T.revoke,lifecycle:p}),(0,Q.jsx)(Dn,{row:A,instances:d,actions:f})]}),A.kind===`native`&&(0,Q.jsx)(gn,{row:A,enabled:T.versions,notify:t,actions:p}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[T.export&&A.kind===`native`&&(0,Q.jsx)(An,{row:A,lifecycle:p,className:`min-h-11`}),E&&(0,Q.jsx)(kn,{row:A,actions:f,variant:`button`,onDeleted:n})]})]}):(0,Q.jsx)(W,{kind:`empty`,title:a(`custom-ui:phone.missingTitle`),description:a(`custom-ui:phone.missingHint`),action:(0,Q.jsx)(I,{variant:`secondary`,className:`min-h-11`,onClick:n,children:a(`custom-ui:phone.allComponents`)})})]})}):(0,Q.jsxs)(X,{variant:`collection`,children:[(0,Q.jsxs)(`div`,{"data-components-phone":`list`,className:`flex min-w-0 flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`mr-auto text-sm font-medium text-content-secondary tabular-nums`,children:a(`custom-ui:customUiPage.installedComponents`,{count:b.length})}),Se(`min-h-11`),(0,Q.jsx)(Vt,{onCreate:_e,phone:!0,className:`min-h-11`})]}),be&&(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:xe(!0)}),b.length?(0,Q.jsx)(`ul`,{className:`flex flex-col divide-y divide-stroke overflow-hidden rounded-[var(--r-lg)] border border-stroke bg-panel`,children:b.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(Gt,{row:e,instances:d,active:!1,phone:!0,onSelect:()=>i(e.id,!1)})},e.id))}):(0,Q.jsx)(G,{title:a(`custom-ui:customUiPage.emptyTitle`),description:Ce}),(0,Q.jsx)(Kn,{enabled:T.trashRestore,lifecycle:p,className:`min-h-11 w-fit`,onRestored:e=>i(e.id,!1)}),(0,Q.jsx)(`p`,{className:`text-xs leading-relaxed break-all text-content-muted`,children:a(`custom-ui:customUiPage.directoryHint`,{path:w})})]}),N]})}let we=A&&(0,Q.jsx)(jn,{row:A,instances:d,selectedInstanceId:j.instanceId,canDelete:E,features:T,notify:t,actions:f,lifecycle:p,onSelectInstance:j.selectInstance,onPreview:j.onPreview,onViewSource:()=>{k(`source`),se(!1)},onDeleted:()=>i(``,!0)},A.id);return(0,Q.jsx)(fr,{children:n=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{"data-studio-columns":!0,className:n?`grid h-full min-h-0 grid-cols-[284px_minmax(0,1fr)_372px]`:`grid h-full min-h-0 grid-cols-[284px_minmax(0,1fr)]`,children:[(0,Q.jsx)(qt,{rows:ye,allCount:b.length,counts:M,instances:d,selectedId:A?.id??``,troubled:fe,filter:D,query:ne,root:w,onFilter:O,onQuery:re,onSelect:ge,onCreate:_e,importButton:Se(),staged:xe(!1),footer:T.trashRestore?(0,Q.jsx)(`div`,{className:`flex flex-none border-t border-stroke px-2 py-1.5`,children:(0,Q.jsx)(Kn,{enabled:!0,lifecycle:p,onRestored:e=>i(e.id,!0)})}):void 0,onOpenLogs:e=>{i(e,!0),k(`logs`)},onRequestFix:(e,t)=>void m.fix(e,t),onReload:e=>{et().resume(`preview:${e}`),ue(e=>e+1),k(`preview`),i(e,!0)}}),A?(0,Q.jsx)(or,{activeSessionId:e,row:A,tab:ae,target:j.target,window:j.window,instanceId:j.instanceId,draft:j.draft,notify:t,commits:de,settingsButton:!n&&(0,Q.jsx)(sr,{onOpen:()=>se(!0)}),onTab:k,onTarget:j.setTarget,onWindow:j.setWindow},`${A.id}#${le}`):(0,Q.jsx)(G,{className:`min-h-0`,title:b.length?a(`custom-ui:phone.missingTitle`):a(`custom-ui:customUiPage.emptyTitle`),description:b.length?a(`custom-ui:phone.missingHint`):Ce}),n&&A&&(0,Q.jsx)(`aside`,{"aria-label":a(`custom-ui:studio.settings`),className:`flex min-h-0 min-w-0 flex-col border-l border-stroke`,children:we})]}),!n&&(0,Q.jsx)(Ie,{open:oe&&!!A,onOpenChange:se,children:(0,Q.jsxs)(Ne,{side:`right`,showCloseButton:!1,onCloseAutoFocus:ce,"data-studio-settings-drawer":!0,className:`w-[372px] max-w-[calc(100vw-48px)] gap-0 p-0 sm:max-w-[372px]`,children:[(0,Q.jsxs)(je,{className:`flex-row items-center justify-between border-b border-stroke px-4 py-2.5`,children:[(0,Q.jsx)(Pe,{className:`text-sm`,children:a(`custom-ui:studio.settings`)}),(0,Q.jsx)(Fe,{className:`sr-only`,children:a(`custom-ui:studio.settingsHint`)}),(0,Q.jsx)(I,{size:`icon-sm`,variant:`ghost`,"aria-label":a(`custom-ui:studio.closeSettings`),onClick:()=>se(!1),children:(0,Q.jsx)(he,{})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1`,children:we})]})}),N]})})}function vr({activeSessionId:e,component:t,instance:n,notify:r}){let i=Ot(t,r);return(0,Q.jsx)(w,{component:t,instance:{instanceId:n.instanceId,surface:`feature-page`,title:n.title,props:n.props},session:e?{id:e,title:``,cwd:``,status:`idle`}:void 0,notify:e=>r(e),onRequestFix:i,className:`h-full`})}function yr({componentId:e,activeSessionId:t=``,notify:n}){let{t:i}=u(),a=T(`feature-page`),o=a.placed.find(t=>t.component.id===e),s=c(e);return(0,Q.jsx)(X,{variant:`workbench`,children:(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex min-h-11 shrink-0 flex-wrap items-center gap-1 border-b border-stroke-soft px-2 py-1.5`,children:[o&&(0,Q.jsx)(`strong`,{className:`min-w-0 flex-1 truncate px-1 text-sm font-medium`,children:o.instance.title||o.component.manifest?.name||o.component.name}),(0,Q.jsx)(I,{variant:`ghost`,size:`sm`,className:`ml-auto max-[650px]:h-11`,asChild:!0,children:(0,Q.jsxs)(r,{to:l.components,children:[(0,Q.jsx)(A,{}),i(`custom-ui:tool.openSettings`)]})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-hidden`,"data-feature-page-host":e,children:o?(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(W,{kind:`loading`,title:i(`custom-ui:customUiPage.loading`)}),children:(0,Q.jsx)(vr,{activeSessionId:t,component:o.component,instance:o.instance,notify:n},o.instance.instanceId)}):a.isLoading?(0,Q.jsx)(W,{kind:`loading`,title:i(`custom-ui:customUiPage.loading`)}):a.error?(0,Q.jsx)(W,{kind:`error`,title:i(`custom-ui:widget.catalogFailed`),action:(0,Q.jsx)(I,{variant:`secondary`,onClick:a.refetch,children:i(`custom-ui:widget.retry`)})}):(0,Q.jsx)(W,{kind:`empty`,title:i(`custom-ui:tool.notPlacedTitle`),description:i(`custom-ui:tool.notPlacedHint`),action:(0,Q.jsx)(I,{variant:`secondary`,asChild:!0,children:(0,Q.jsx)(r,{to:s,children:i(`custom-ui:tool.openInStudio`)})})})})]})})}export{_r as CustomUiPage,yr as CustomUiToolPage};
|