@openchamber/web 2.7.2 → 2.7.3-canary.20261115.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AboutDialog-l-zrh7nU.js → AboutDialog-gL1x0YFW.js} +1 -1
- package/dist/assets/{AboutLogo-K3wdJM69.js → AboutLogo-cbKkZDLU.js} +1 -1
- package/dist/assets/{ArchiveView-DjRZQdOo.js → ArchiveView-0QjF07oK.js} +1 -1
- package/dist/assets/{ChangeRequestDiffUnavailable-BtH6Ad8g.js → ChangeRequestDiffUnavailable-kfarKKvU.js} +1 -1
- package/dist/assets/{CommandPalette-C7Uc4nDE.js → CommandPalette-D4bXVkJf.js} +1 -1
- package/dist/assets/{DataFileArtifact-DtnZXuug.js → DataFileArtifact-DWC11mPC.js} +1 -1
- package/dist/assets/{DiffView-CS0gR_am.js → DiffView-CSSPNDYJ.js} +1 -1
- package/dist/assets/{FilesView-tcU8_bnh.js → FilesView-D0FOaLpo.js} +3 -3
- package/dist/assets/{GitView-Ccs7O5Rf.js → GitView-CJl97ZjN.js} +1 -1
- package/dist/assets/{GuestPanelContent-CJ_wlnNr.js → GuestPanelContent-BCxvKv4H.js} +1 -1
- package/dist/assets/{HelpDialog-iH44R9qu.js → HelpDialog-DjficTGt.js} +1 -1
- package/dist/assets/{IntegrationsCatalogView-D9icTaJt.js → IntegrationsCatalogView-BvS1pCRR.js} +1 -1
- package/dist/assets/{JsonTreeView-BjPbJlHc.js → JsonTreeView-DQ6XLAW4.js} +1 -1
- package/dist/assets/{MarkdownDiffPreview-gCh_8R1F.js → MarkdownDiffPreview-C8KpNQaC.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-fohUB8r2.js → MarkdownRendererImpl-B1SjhV-G.js} +4 -4
- package/dist/assets/{MemoryDebugPanel-fX9cD8th.js → MemoryDebugPanel-BWT5owg7.js} +1 -1
- package/dist/assets/{NoteEditor-CTPSChrc.js → NoteEditor-DfHpXxIN.js} +1 -1
- package/dist/assets/{OfficeArtifact-BRviGdkx.js → OfficeArtifact-BAYHzDft.js} +2 -2
- package/dist/assets/{OfficeDocumentDiff-Hp2baXgN.js → OfficeDocumentDiff-Csvxzve7.js} +1 -1
- package/dist/assets/{OnboardingScreen-CDhZHMEt.js → OnboardingScreen-NWWMu7OG.js} +1 -1
- package/dist/assets/{OpenCodeStatusDialog-CBiLhgh9.js → OpenCodeStatusDialog-DtnVfNI4.js} +1 -1
- package/dist/assets/{OverviewView-DmNAg498.js → OverviewView-BXMN0Z8_.js} +1 -1
- package/dist/assets/{PatchDiff-rhuT-3au.js → PatchDiff-DxGkHtIk.js} +1 -1
- package/dist/assets/{PlanView-VhIl4wzm.js → PlanView-DE4sxgkq.js} +1 -1
- package/dist/assets/{ProjectActionsDialog-B_jMMuJ0.js → ProjectActionsDialog-C5q25ipO.js} +1 -1
- package/dist/assets/{ReceivedPagePanel-CCDFxXT4.js → ReceivedPagePanel-CfXyzCii.js} +5 -5
- package/dist/assets/{ReplyCommand-CUHB1iPz.js → ReplyCommand-OczgxN8d.js} +1 -1
- package/dist/assets/{ReplyUiBlock-TNOJJ_HH.js → ReplyUiBlock-D1HJeVU_.js} +1 -1
- package/dist/assets/{ReviewCards-UN_E9jl0.js → ReviewCards-D7jBPhS_.js} +1 -1
- package/dist/assets/{RunOverview-C7FUT8DD.js → RunOverview-BDblAbDp.js} +1 -1
- package/dist/assets/{ScheduledTasksDialog-DdXypryy.js → ScheduledTasksDialog-NDtZLq5t.js} +1 -1
- package/dist/assets/{SettingsView-uSZDjIcc.js → SettingsView-UjifxDq7.js} +1 -1
- package/dist/assets/{SettingsWindow-CoijA05f.js → SettingsWindow-D2K9vSYk.js} +1 -1
- package/dist/assets/{SidebarSectionsManager-d6IaYpHW.js → SidebarSectionsManager-QqwIUOdu.js} +1 -1
- package/dist/assets/{SourceBoardView-BrQkCEgn.js → SourceBoardView-CKJDJ2f4.js} +1 -1
- package/dist/assets/{SpaceAccessDialog-CymnxxLO.js → SpaceAccessDialog-G331hiT_.js} +1 -1
- package/dist/assets/{SpaceApplyDialog-DVJkF4lG.js → SpaceApplyDialog-x0rDuJEc.js} +1 -1
- package/dist/assets/{SpaceRow-CJFX1Zsr.js → SpaceRow-CsS43yrt.js} +1 -1
- package/dist/assets/{SpaceSetupOutput-Btttdq6K.js → SpaceSetupOutput-BEXQGXPw.js} +1 -1
- package/dist/assets/{SpacesView-GxzOEIeI.js → SpacesView-DFcnInBv.js} +1 -1
- package/dist/assets/{SubmoduleDiffSummary-D0Nj5PJN.js → SubmoduleDiffSummary-CTqIH0Cp.js} +1 -1
- package/dist/assets/{TableArtifact-DiRnrtL5.js → TableArtifact-Beve8fiv.js} +1 -1
- package/dist/assets/{ToolOutputDialog-DnvhhdiH.js → ToolOutputDialog-Bn2g6tIX.js} +1 -1
- package/dist/assets/{ToolPartDiffPreview-CHdkL7BJ.js → ToolPartDiffPreview-mgtjJMMz.js} +1 -1
- package/dist/assets/{UiBlock-CvZ92eyw.js → UiBlock-DkgJyZVl.js} +2 -2
- package/dist/assets/{UsageStatsView-Dbo3dCgC.js → UsageStatsView-CLJFagDC.js} +1 -1
- package/dist/assets/{WalkthroughView-l9TMdlPB.js → WalkthroughView-Dm4-RaV3.js} +1 -1
- package/dist/assets/{WorktreesView-DNa5Soxq.js → WorktreesView-DyZy4OjB.js} +1 -1
- package/dist/assets/{appThemeRegistry-C3TUDJ7r.js → appThemeRegistry-C4Av1s90.js} +1 -1
- package/dist/assets/{codeHighlight-DyrRLTkb.js → codeHighlight-Bmb7zcc2.js} +1 -1
- package/dist/assets/{columnWidthMemory-D0i9Kdhi.js → columnWidthMemory-D8H-O0YE.js} +1 -1
- package/dist/assets/{computeVirtualFileMetrics-YMtW3BEg.js → computeVirtualFileMetrics-Bc_YiqAD.js} +2 -2
- package/dist/assets/{contextFileOpenGuard-USev-3h1.js → contextFileOpenGuard-D-HtBtn6.js} +1 -1
- package/dist/assets/{date-time-DSQbTMhf.js → date-time-DfmOsLQo.js} +1 -1
- package/dist/assets/{diffsHighlighter-DZ_8ZCaS.js → diffsHighlighter-CFc933Ip.js} +1 -1
- package/dist/assets/{documentClient-5O0az-Ma.js → documentClient-D-gfZAFK.js} +2 -2
- package/dist/assets/{documentHost-BqOqnqk5.js → documentHost-fBeQzdlp.js} +1 -1
- package/dist/assets/{editorCodeMetrics-a0NLS65y.js → editorCodeMetrics-CNBjOGNA.js} +1 -1
- package/dist/assets/{fileContentPoller-B8a010z5.js → fileContentPoller-DRoVO_sh.js} +1 -1
- package/dist/assets/{flexokiTheme-DJaL_u7G.js → flexokiTheme-CcqiI7j-.js} +1 -1
- package/dist/assets/{highlights-CSy_17b-.js → highlights-_5vZZ38i.js} +1 -1
- package/dist/assets/{index-CvHejcGo.js → index-BbbQXJ_t.js} +1 -1
- package/dist/assets/{initializeSharedPreferences-MLG8op-A.js → initializeSharedPreferences-B1ISDxLb.js} +1 -1
- package/dist/assets/{install-NTaAzPnj.js → install-DY6TBn2e.js} +1 -1
- package/dist/assets/{install-request-D5VhmtWC.js → install-request-CzRei4tp.js} +1 -1
- package/dist/assets/{isDiffPlainText-B6ZzF_T5.js → isDiffPlainText-Cx5SgKlQ.js} +1 -1
- package/dist/assets/{isFilePlainText-Bitg2337.js → isFilePlainText-Bcn3vV6J.js} +1 -1
- package/dist/assets/{katex.min-B3YMLLh4.js → katex.min-DklPh68d.js} +3 -3
- package/dist/assets/{main-Bqwtrv5m.js → main-D0ACoTpS.js} +2 -2
- package/dist/assets/{main-B61P9v4A.js → main-QZk4AKac.js} +4 -4
- package/dist/assets/{miniChat-CZx_2XHj.js → miniChat-DeYRMPYt.js} +2 -2
- package/dist/assets/{mobile-DiLdHL_W.js → mobile-DjT3KVMo.js} +2 -2
- package/dist/assets/{moveWorkspacePath-CpN2DOGn.js → moveWorkspacePath-DibtVw_Q.js} +1 -1
- package/dist/assets/{officeDocument-Ca0s-jYd.js → officeDocument-CBwDUdTr.js} +1 -1
- package/dist/assets/{parseDiffFromFile-CL7WjMrZ.js → parseDiffFromFile-D28_u-uC.js} +1 -1
- package/dist/assets/{pierreDiffTint-C4cPKKnP.js → pierreDiffTint-CLCzflgS.js} +1 -1
- package/dist/assets/{relocateRestoredSession-Bw3yb1_0.js → relocateRestoredSession-BPqdEuzx.js} +2 -2
- package/dist/assets/{renderElectronMiniChatApp-DB0hWKLa.js → renderElectronMiniChatApp-C0v7P53f.js} +2 -2
- package/dist/assets/{renderMarkdownForExport-CICPn_1e.js → renderMarkdownForExport-DvKl_kjS.js} +1 -1
- package/dist/assets/{renderMobileApp-CYhEWO14.js → renderMobileApp-EVllBWS5.js} +3 -3
- package/dist/assets/{resolveLanguages-gKOTFspE.js → resolveLanguages-DqxtADuz.js} +1 -1
- package/dist/assets/{scheduledTasksApi-C1TDMoZd.js → scheduledTasksApi-v463mt0u.js} +1 -1
- package/dist/assets/{shiki-B0-fz3dN.js → shiki-3oNYFbTw.js} +1 -1
- package/dist/assets/{space-apply-DnoCDzwj.js → space-apply-j71ap5Rs.js} +1 -1
- package/dist/assets/{space-close-Bqfdl7kv.js → space-close-Bj32J79L.js} +1 -1
- package/dist/assets/{spaceNetwork-D5Fcyb33.js → spaceNetwork-BV5W32NY.js} +1 -1
- package/dist/assets/{stream-tokenizer-FniCZxxb.js → stream-tokenizer-wGP5G2_C.js} +1 -1
- package/dist/assets/{useAppFontEffects-CpxtKEGw.js → useAppFontEffects-BDLOJuy5.js} +15 -15
- package/dist/assets/{useBranchPullRequestRequest-DVy6rEsu.js → useBranchPullRequestRequest-DMiPjfPQ.js} +1 -1
- package/dist/assets/{useCallableModelProviders-DngJbZnV.js → useCallableModelProviders-aGFpVUZL.js} +1 -1
- package/dist/assets/{useDiffFindSurface-DY6lBBpH.js → useDiffFindSurface-mA0rc6AR.js} +1 -1
- package/dist/assets/{useGitCleanLine-CxdK3EQ3.js → useGitCleanLine-BwAypcLn.js} +1 -1
- package/dist/assets/{useInlineCommentController-Z8ADSR8f.js → useInlineCommentController-Wnopn0Ar.js} +1 -1
- package/dist/assets/{useMarkdownLocalAssets-CZIMWgjn.js → useMarkdownLocalAssets-BjT607tF.js} +1 -1
- package/dist/assets/{useRootScrollLock-C9UIEqnb.js → useRootScrollLock-DPhGk2Eu.js} +1 -1
- package/dist/assets/{useWalkthroughReview-BWxwaV05.js → useWalkthroughReview-BrULG_dy.js} +1 -1
- package/dist/assets/{useWholeFileComment-zterYCFS.js → useWholeFileComment-CQj6q_QX.js} +1 -1
- package/dist/assets/{useWorktreeArchiveActions-CKnDdsvh.js → useWorktreeArchiveActions-CpegLYyZ.js} +1 -1
- package/dist/assets/{vendor-codemirror-language-data-BI6j-q9C.js → vendor-codemirror-language-data-CFvXza4M.js} +2 -2
- package/dist/index.html +3 -3
- package/dist/mini-chat.html +2 -2
- package/dist/mobile.html +2 -2
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilesView-tcU8_bnh.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-react--VO_rL_p.js","assets/vendor-scheduler-7OC5HNn7.js","assets/useAppFontEffects-CpxtKEGw.js","assets/katex.min-B3YMLLh4.js","assets/vendor-zustand-C9tWdk0j.js","assets/vendor-zod-DV_WH382.js","assets/vendor-opencode-client-NJGkA1Ku.js","assets/vendor-fuse.js-Dw8P0qyA.js","assets/vendor-streamdown-BbSYZ3NF.js","assets/vendor-markdown-BTUqNk6W.js","assets/vendor-mdast-util-from-markdown-CZHjOE75.js","assets/vendor-micromark-util-decode-numeric-character-reference-CNs1qBpV.js","assets/vendor-micromark-util-decode-string-fHsnqYdj.js","assets/vendor-decode-named-character-reference-C3-224fz.js","assets/vendor-micromark-util-normalize-identifier-C9ANKk3v.js","assets/vendor-micromark-AWM-NZXP.js","assets/vendor-micromark-util-combine-extensions-d8XJZrgA.js","assets/vendor-micromark-util-chunked-DrRIdSP-.js","assets/vendor-micromark-factory-space-PzSHLgmq.js","assets/vendor-micromark-util-character-CW3Cu1MS.js","assets/vendor-micromark-core-commonmark-kzTLNXAm.js","assets/vendor-micromark-util-classify-character-tcLuZZwM.js","assets/vendor-micromark-util-resolve-all-PQCKh0dx.js","assets/vendor-micromark-util-subtokenize-BF1Jf29a.js","assets/vendor-micromark-factory-destination-Sj0xfi0V.js","assets/vendor-micromark-factory-label-amyP0HdC.js","assets/vendor-micromark-factory-title-khnLkZK6.js","assets/vendor-micromark-factory-whitespace-eIB00uTl.js","assets/vendor-micromark-util-html-tag-name-DbKNfynz.js","assets/vendor-unist-util-stringify-position-Ch_qCilz.js","assets/vendor-mdast-util-to-string-C_aolqmU.js","assets/vendor-unist-util-visit-DhPeCsfG.js","assets/vendor-unist-util-visit-parents-DlviEg7Z.js","assets/vendor-unist-util-is-BPZGFiMU.js","assets/vendor-hast-util-raw-DvvLJg15.js","assets/vendor-ungap-structured-clone--gfxRhYI.js","assets/vendor-html-void-elements-CkdplsNl.js","assets/vendor-parse5-DwmzEj2o.js","assets/vendor-entities-wUUgTZDW.js","assets/vendor-web-namespaces-bsVAaBS1.js","assets/vendor-zwitch-C2o2j-tx.js","assets/vendor-unist-util-position-60F3QETU.js","assets/vendor-hast-util-from-parse5-Ba3T6RJI.js","assets/vendor-devlop-0Dp3JUBc.js","assets/vendor-property-information-Boo8Xpef.js","assets/vendor-hastscript-BrPNioaz.js","assets/vendor-comma-separated-tokens-CRUGqg4f.js","assets/vendor-space-separated-tokens-D7QSIrTI.js","assets/vendor-hast-util-parse-selector-TXfch5wI.js","assets/vendor-vfile-location-LfEFwJ2h.js","assets/vendor-hast-util-to-parse5-BoysVIPW.js","assets/vendor-hast-util-sanitize-2aGO5ay8.js","assets/vendor-micromark-extension-gfm-CsfPlnlB.js","assets/vendor-micromark-extension-gfm-autolink-literal-BYug7onl.js","assets/vendor-micromark-extension-gfm-footnote-OFl1FCH2.js","assets/vendor-micromark-extension-gfm-strikethrough-CyFiuwBf.js","assets/vendor-micromark-extension-gfm-table-dgw4LfUw.js","assets/vendor-micromark-extension-gfm-task-list-item-Dnadzr9U.js","assets/vendor-mdast-util-gfm-CroMDYLM.js","assets/vendor-mdast-util-gfm-autolink-literal-CTruMtvI.js","assets/vendor-ccount-c2V3InAJ.js","assets/vendor-mdast-util-find-and-replace-DB9iC-bx.js","assets/vendor-escape-string-regexp-BaJN9MlJ.js","assets/vendor-mdast-util-gfm-footnote-C-csI7OF.js","assets/vendor-mdast-util-gfm-strikethrough-BcskTdio.js","assets/vendor-mdast-util-gfm-table-DhPwQIyj.js","assets/vendor-markdown-table-DvhhVmnL.js","assets/vendor-mdast-util-to-markdown-Cl3qaiyc.js","assets/vendor-longest-streak-CtXnX3Xp.js","assets/vendor-mdast-util-phrasing-4oVbNLC3.js","assets/vendor-mdast-util-gfm-task-list-item-DMU5mK_M.js","assets/vendor-mdast-util-to-hast-CWnLaQSO.js","assets/vendor-micromark-util-sanitize-uri-BbwQ7CLk.js","assets/vendor-trim-lines-D8znQY54.js","assets/vendor-micromark-extension-cjk-friendly-BzZDGrF5.js","assets/vendor-micromark-extension-cjk-friendly-util-D5lVNoxW.js","assets/vendor-get-east-asian-width-CPhS2cOv.js","assets/vendor-micromark-util-symbol-JJPacVTp.js","assets/vendor-mdast-util-to-markdown-cjk-friendly-BZ3pe_qd.js","assets/vendor-micromark-extension-cjk-friendly-gfm-strikethrough-CqW-Ep4M.js","assets/vendor-mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-BdPDQFO7.js","assets/vendor-hast-util-from-html-isomorphic-B0Kn01s9.js","assets/vendor-hast-util-from-dom-DeNf9aYW.js","assets/vendor-katex-DBqql0K7.js","assets/vendor-hast-util-to-text-0GXLnBvt.js","assets/vendor-hast-util-is-element-CuOmiqQi.js","assets/vendor-unist-util-find-after-CMaZmLxc.js","assets/vendor-micromark-extension-math-BRFoDziv.js","assets/vendor-mdast-util-math-wB-IJCL0.js","assets/vendor-remend-r8cP_t-e.js","assets/vendor-clsx-B-dksMZM.js","assets/vendor-tailwind-merge-BKkUfl9q.js","assets/vendor-marked-DN3zOnEe.js","assets/vendor-hast-util-to-jsx-runtime-Bq6JeJCx.js","assets/vendor-style-to-js-CI2G4dgu.js","assets/vendor-style-to-object-BAv4SQXc.js","assets/vendor-inline-style-parser-BlqBsVO4.js","assets/vendor-hast-util-whitespace-D4Wp6AEg.js","assets/vendor-estree-util-is-identifier-name-BgBfM8ME.js","assets/vendor-vfile-message-DqhD22jI.js","assets/vendor-unified-1CQKw2_w.js","assets/vendor-bail-FqpXQuLt.js","assets/vendor-extend-B94qxKr5.js","assets/vendor-is-plain-obj-C1gvLhAf.js","assets/vendor-trough-B_b8ryxu.js","assets/vendor-vfile-BCWrK60u.js","assets/vendor-html-url-attributes-D46m5wfe.js","assets/vendor-capacitor-core-B4EWRrHz.js","assets/katex-BWbKx7qU.css","assets/vendor-base-ui-CHqK1aDI.js","assets/vendor-floating-ui-utils-BzXdqYpP.js","assets/vendor-floating-ui-dom-WyXykhNi.js","assets/vendor-floating-ui-core-CXmKXOXc.js","assets/vendor-floating-ui-react-dom-Cy8dRGoy.js","assets/vendor-use-sync-external-store-CfLJGVyr.js","assets/vendor-simplewebauthn-browser-VDA66rT_.js","assets/vendor-dnd-kit-core-Br1Cs7RV.js","assets/vendor-dnd-kit-utilities-DZ9KbT5S.js","assets/vendor-dnd-kit-accessibility-CYclfhtC.js","assets/vendor-dnd-kit-sortable-DpfLEOLv.js","assets/vendor-tanstack-react-virtual-Bw3q1rnq.js","assets/vendor-tanstack-virtual-core-B4TJYmIq.js","assets/vendor-framer-motion-C_wK4GIM.js","assets/vendor-motion-dom-HXPOMxb7.js","assets/vendor-motion-utils-BGh8QBgx.js","assets/vendor-codemirror-commands-CjjsURR-.js","assets/vendor-codemirror-state-Cd8udR5z.js","assets/vendor-marijn-find-cluster-break-DXwl3gUT.js","assets/vendor-codemirror-view-Ciie9ey-.js","assets/vendor-style-mod-NZ5MEPvj.js","assets/vendor-w3c-keyname-Vcq4gwWv.js","assets/vendor-crelt-C8TCjufn.js","assets/vendor-codemirror-language-8HZTPOnt.js","assets/vendor-lezer-common-B3-cUCR_.js","assets/vendor-lezer-highlight-CZEcqU6G.js","assets/vendor-codemirror-streamparser-CmlTsbN2.js","assets/vendor-codemirror-lang-javascript-DmqaSK_j.js","assets/vendor-lezer-javascript-CWSwshuO.js","assets/vendor-lezer-lr-bhwg1HMg.js","assets/vendor-codemirror-autocomplete-BGedy2gC.js","assets/vendor-codemirror-lang-json-DVAYKmoO.js","assets/vendor-lezer-json-Cn1mncjr.js","assets/vendor-codemirror-lang-css-BLpgXfL2.js","assets/vendor-lezer-css-B2Hx_Nps.js","assets/vendor-codemirror-lang-html-S3jxr3Mo.js","assets/vendor-lezer-html-Cr8K5DGw.js","assets/vendor-codemirror-lang-markdown-D1jveRI5.js","assets/vendor-lezer-markdown-TQKzBB8i.js","assets/vendor-codemirror-language-data-BI6j-q9C.js","assets/vendor-codemirror-lang-python-B-5UC9Ui.js","assets/vendor-lezer-python-BUoImtUb.js","assets/vendor-sonner-Dw26OnzC.js","assets/vendor-cmdk-BtSpU-Io.js","assets/vendor-radix-ui-react-dialog-OIW6VLWw.js","assets/vendor-radix-ui-primitive-Dc_FVRD7.js","assets/vendor-radix-ui-react-compose-refs-D4RvEbuR.js","assets/vendor-radix-ui-react-context-BbFoxCHu.js","assets/vendor-radix-ui-react-id-aGag8i_5.js","assets/vendor-radix-ui-react-use-layout-effect-B1oLzD-j.js","assets/vendor-radix-ui-react-use-controllable-state-BjnNPGHq.js","assets/vendor-radix-ui-react-dismissable-layer-DpT6mMbO.js","assets/vendor-radix-ui-react-primitive-CrN9dRDb.js","assets/vendor-radix-ui-react-slot-BjbalUfz.js","assets/vendor-radix-ui-react-use-callback-ref-CcC_buIU.js","assets/vendor-radix-ui-react-use-escape-keydown-Cp1WWKTC.js","assets/vendor-radix-ui-react-focus-scope-D1noLHmd.js","assets/vendor-radix-ui-react-portal-BlUEzfrF.js","assets/vendor-radix-ui-react-presence-BGqFfiW4.js","assets/vendor-radix-ui-react-focus-guards-CSS2IbZC.js","assets/vendor-react-remove-scroll-Der_cv-1.js","assets/vendor-tslib-De9GV7Vy.js","assets/vendor-react-remove-scroll-bar-Clwl9llp.js","assets/vendor-react-style-singleton-D_xJlTqU.js","assets/vendor-get-nonce-C-Z93AgS.js","assets/vendor-use-sidecar-BdLl6ZIw.js","assets/vendor-use-callback-ref-CXJF1lEr.js","assets/vendor-aria-hidden-DvXkyWUv.js","assets/vendor-legendapp-list-iLtL-MFj.js","assets/vendor-class-variance-authority-5VPnzWs2.js","assets/flexokiTheme-DJaL_u7G.js","assets/vendor-codemirror-search-CWqbGraJ.js","assets/vendor-replit-codemirror-vim-DTiXsOdM.js","assets/vendor-replit-codemirror-vim-core-FHzKdNUS.js","assets/editorCodeMetrics-a0NLS65y.js","assets/ReceivedPagePanel-CCDFxXT4.js","assets/space-apply-DnoCDzwj.js","assets/ReceivedPagePanel-uDNKGwhp.css","assets/useMarkdownLocalAssets-CZIMWgjn.js","assets/fileContentPoller-B8a010z5.js","assets/useInlineCommentController-Z8ADSR8f.js","assets/JsonTreeView-BjPbJlHc.js","assets/parseDiffFromFile-CL7WjMrZ.js","assets/computeVirtualFileMetrics-YMtW3BEg.js","assets/themeResolver-DjCwdtoe.js","assets/vendor-pierre-theming-Dn546TCS.js","assets/hastToHtml-BHV14OWE.js","assets/vendor-hast-util-to-html-Jw3IXh58.js","assets/vendor-stringify-entities-CsH1VEn9.js","assets/vendor-character-entities-legacy-BpoLgcEt.js","assets/vendor-character-entities-html4-D7taRCQ7.js","assets/vendor-diff-C3JhlQdm.js","assets/useNextRenderData-CVFf78p9.js","assets/getFiletypeFromFileName-BgI9McTw.js","assets/isFilePlainText-Bitg2337.js","assets/vendor-strip-json-comments-5dJlOkP1.js","assets/codeHighlight-DyrRLTkb.js","assets/appThemeRegistry-C3TUDJ7r.js","assets/ReviewCards-UN_E9jl0.js","assets/contextFileOpenGuard-USev-3h1.js","assets/vendor-react-drawio-C6TkEvnS.js","assets/vendor-codemirror-lint-aq8IpR1c.js","assets/moveWorkspacePath-CpN2DOGn.js","assets/vendor-fflate-DB4_FQr-.js","assets/useWholeFileComment-zterYCFS.js","assets/diffsHighlighter-DZ_8ZCaS.js","assets/scheduledTasksApi-C1TDMoZd.js","assets/GuestPanelContent-CJ_wlnNr.js","assets/vendor-capacitor-app-BrDJj9I_.js","assets/vendor-capacitor-push-notifications-KNe1zSBF.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{f as oe,r as Ai,j as n,R as p,a as cn,h as Ll}from"./vendor-react--VO_rL_p.js";import{W as xn,bt as Yi,bu as _r,bv as Tt,bw as Ar,bj as ps,bx as tn,bq as dn,j as qo,by as ni,bz as Jo,bA as Bl,bB as Yo,bC as Fl,bD as zl,bE as Wl,bF as $l,bG as Kl,u as qe,l as un,n as Zs,Q as Hl,R as Vl,at as Xo,E as Ul,aM as Xi,b as Gl,w as zt,bH as ql,ae as Qo,M as Ls,a2 as Jl,b6 as Yl,a1 as Xl,b2 as Ql,b3 as Dr,bf as Zl,aC as ec,bI as Un,af as xi,bJ as tc,bK as sc,bL as nc,bM as Or,Y as ic,a6 as Zo,bd as rc,bN as $n,v as Di,bO as Mr,bP as oc,aP as ea,bQ as vi,bR as ac}from"./katex.min-B3YMLLh4.js";import{Y as Ns,Z as qt,eP as ta,eQ as lc,fu as cc,b4 as sa,km as dc,cT as uc,a0 as dt,G as na,u as be,A as me,b0 as ia,I as X,gJ as fc,B as ze,n as bs,bb as Qi,bm as sn,ay as mc,a2 as de,kn as pc,dT as wi,k as Yn,ko as hc,kp as ra,kq as gc,gk as bc,V as ns,ck as yc,kr as ks,ks as xc,kt as Lr,ku as Br,kv as vc,kw as wc,eC as Zt,ht as Zi,gf as Sc,gg as oa,fW as jc,fZ as aa,f_ as la,f$ as ca,kx as da,c_ as kc,g0 as Cc,cY as er,cX as ua,ky as Oi,kz as Nc,bV as fa,bQ as ss,fA as ma,kA as Rc,bS as tr,kB as Ic,dG as Pc,kC as Ec,kD as Tc,kE as _c,cZ as Ac,kF as Dc,kG as Oc,kH as Mc,kI as Lc,h$ as Gn,iG as Mi,il as Ds,d1 as Bc,kJ as Fc,ac as zc,kK as Wc,bl as pa,cU as ha,fL as ga,fM as ba,y as $c,kL as Kc,kM as Hc,kN as Vc,kO as Uc,kP as ms,kQ as Gc,bo as sr,kR as qc,fi as ya,fk as Jc,fl as Yc,cB as Fr,kS as zr,kT as Xc,kU as Qc,kV as Zc,kW as ed,bf as td,bg as sd,be as nd,hf as nr,kX as id,f0 as rd,d3 as xa,e$ as od,bh as cs,bt as va,kY as ad,kZ as Li,d9 as ii,z as wa,b9 as ld,a4 as cd,dQ as dd,k_ as ud,gm as fd,k$ as md,eV as Wr,l0 as pd,l1 as hd,a5 as Bi,a6 as Fi,a7 as zi,bY as $r,ad as Si,a8 as an,l2 as Sa,ae as gd,af as bd,ag as yd,kh as xd,az as vd,aD as wd,er as Sd,eB as qs,l3 as jd,f2 as ja,f3 as ka,l4 as kd,bd as Cd,l5 as Nd,gD as Ca,da as Na,l6 as Rd,l7 as Id,l8 as ri,cM as Pd,io as Ra,ip as Ia,bO as ir,bL as Ed,bP as Td,l9 as _d,bR as Ad,hR as Dd,hH as Kn,hI as Od,cs as Wi,hJ as Md,hK as Ld,hS as Bd,h3 as Fd,hQ as zd,bT as Wd,im as $d,it as Kd,h8 as Hd,h4 as Pa,bn as Vd,h7 as Ud,la as Gd,lb as qd,lc as Jd,ld as Yd,iw as Kr,iy as ji,bU as Hn,bv as Xd,bZ as Qd,bW as Rn,hb as Zd,le as eu,hO as tu,hP as su,hM as nu,lf as iu,lg as ru,hY as ou,lh as au,dv as lu,bB as cu,bX as du,iC as uu,iD as fu,iF as mu,ix as pu,fb as Ea,d2 as hu,cn as St,dZ as gu,db as bu,li as yu,lj as xu,lk as vu,ll as wu,lm as Su,ln as ju,lo as Ta,lp as _a,lq as ku,lr as Hr,eu as Cu,ls as Nu,lt as Ru,lu as Iu,lv as Pu,lw as Eu,lx as Tu,gP as _u,f1 as Vr,ly as Au,lz as Du,lA as Ou,an as Mu,dN as Lu,lB as rr,lC as Bu,lD as Fu,gz as zu,gA as Wu,gB as $u,gC as Ku,lE as Hu,lF as Ur,lG as Vu,gF as Uu,gG as Gu,gH as qu,gI as Ju,gE as Yu,gK as Xu,gL as Qu,lH as Zu,lI as ef,lJ as tf,lK as sf,lL as nf,fN as Gr,lM as rf,lN as of,lO as qr,lP as af,lQ as lf,lR as cf,lS as df,dh as uf,gj as ff,gS as mf,lT as pf,al as hf,gU as gf,gV as bf,gW as yf}from"./useAppFontEffects-CpxtKEGw.js";import{aV as Vs,aW as $i,aX as xf,aY as vf,aZ as wf,a_ as Sf,a$ as Aa,b0 as Jr,b1 as jf,b2 as kf,b3 as Cf,b4 as Da,b5 as Nf,b6 as oi,b7 as Rf,b8 as If,b9 as Pf,ba as Ef,bb as Tf,ak as _f,bc as ai,bd as Af,be as Df,bf as Of,bg as Mf,bh as Lf,bi as Bf,bj as Ff,bk as Oa,bl as zf,bm as Wf,bn as $f,bo as Kf,bp as Hf,bq as Vf,br as Uf,bs as Gf,bt as qf,bu as Jf,bv as Yf,bw as Xf,v as Qf,m as Zf,y as em,S as tm,x as sm,o as nm,bx as im,aC as nn,aJ as rm,aK as om,G as Yr,H as am,I as lm,aO as cm,aP as dm,J as um,aD as fm,K as Xr,aQ as Qr,aN as Ma,N as mm,by as pm,bz as hm,aS as gm,bA as bm,bB as ym,bC as xm,bD as vm,bE as wm,bF as Sm,bG as jm,bH as km,bI as Cm,bJ as Nm,bK as Rm,bL as Im,bM as Pm,bN as Em,bO as Tm,bP as _m,bQ as Am,bR as Dm,bS as Om,bT as Mm,bU as Lm,bV as Bm,bW as Fm,bX as zm,bY as Wm,bZ as $m,b_ as Km,b$ as Hm,c0 as Vm}from"./ReceivedPagePanel-CCDFxXT4.js";import{i as Um}from"./initializeSharedPreferences-MLG8op-A.js";import{_ as Js}from"./vendor-vite-runtime-DD1OZmLC.js";import{S as Gm,A as qm}from"./SettingsView-uSZDjIcc.js";import{PlanView as Jm}from"./PlanView-VhIl4wzm.js";import{SpaceAccessDialog as Ym}from"./SpaceAccessDialog-CymnxxLO.js";import{SpaceApplyDialog as Xm}from"./SpaceApplyDialog-DVJkF4lG.js";import{SpaceSetupOutputDialog as Qm}from"./SpaceSetupOutput-Btttdq6K.js";import{RunOverview as Zm}from"./RunOverview-C7FUT8DD.js";import{o as or,s as fn,a as ep,_ as tp}from"./vendor-zod-DV_WH382.js";import{p as sp}from"./vendor-aparajita-capacitor-secure-storage-5IShChL0.js";import{Capacitor as ar,registerPlugin as lr}from"./vendor-capacitor-core-B4EWRrHz.js";import{h as np,i as Zr,j as ip,P as rp,D as op,f as ap}from"./vendor-dnd-kit-core-Br1Cs7RV.js";import{S as lp,v as cp,u as dp,s as up,a as fp}from"./vendor-dnd-kit-sortable-DpfLEOLv.js";import{C as mp}from"./vendor-dnd-kit-utilities-DZ9KbT5S.js";import{k as Ki,M as La,s as pp,d as hp,J as gp,a as bp,P as yp,K as xp,U as vp,Z as wp,Q as Sp,r as jp}from"./vendor-remixicon-react-CLUUbkY9.js";import{S as kp}from"./SpaceRow-CJFX1Zsr.js";import{toast as eo}from"./vendor-sonner-Dw26OnzC.js";import{c as Cp}from"./vendor-zustand-C9tWdk0j.js";import{UsageStatsView as Np}from"./UsageStatsView-Dbo3dCgC.js";import{ArchiveSessionsView as Rp}from"./ArchiveView-DjRZQdOo.js";import{MobileSourceBoard as Ip}from"./SourceBoardView-BrQkCEgn.js";import{OverviewPage as Pp}from"./OverviewView-DmNAg498.js";import{ScheduledTasksView as Ep}from"./ScheduledTasksDialog-DdXypryy.js";import{i as Tp,b as _p,u as Ap,c as Dp,d as Op,e as Mp,s as Lp,S as Bp}from"./SubmoduleDiffSummary-D0Nj5PJN.js";import{a as Fp,R as zp,I as Wp,C as $p,b as Kp,c as Hp,D as Vp,u as Up,d as Gp}from"./useGitCleanLine-CxdK3EQ3.js";import{u as qp,P as to,C as Jp}from"./useBranchPullRequestRequest-DVy6rEsu.js";import{u as Yp,W as Xp,c as Qp,d as Zp,g as eh,f as th,h as sh,l as nh,k as ih}from"./useWalkthroughReview-BWxwaV05.js";import{u as rh,a as oh,i as so,d as ki,B as ah,C as lh,P as ch,R as dh,b as uh}from"./ChangeRequestDiffUnavailable-BtH6Ad8g.js";import{p as fh}from"./parseDiffFromFile-CL7WjMrZ.js";import{i as Ba,O as mh}from"./OfficeDocumentDiff-Hp2baXgN.js";import{u as ph}from"./useWholeFileComment-zterYCFS.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-opencode-client-NJGkA1Ku.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./vendor-streamdown-BbSYZ3NF.js";import"./vendor-markdown-BTUqNk6W.js";import"./vendor-mdast-util-from-markdown-CZHjOE75.js";import"./vendor-micromark-util-decode-numeric-character-reference-CNs1qBpV.js";import"./vendor-micromark-util-decode-string-fHsnqYdj.js";import"./vendor-decode-named-character-reference-C3-224fz.js";import"./vendor-micromark-util-normalize-identifier-C9ANKk3v.js";import"./vendor-micromark-AWM-NZXP.js";import"./vendor-micromark-util-combine-extensions-d8XJZrgA.js";import"./vendor-micromark-util-chunked-DrRIdSP-.js";import"./vendor-micromark-factory-space-PzSHLgmq.js";import"./vendor-micromark-util-character-CW3Cu1MS.js";import"./vendor-micromark-core-commonmark-kzTLNXAm.js";import"./vendor-micromark-util-classify-character-tcLuZZwM.js";import"./vendor-micromark-util-resolve-all-PQCKh0dx.js";import"./vendor-micromark-util-subtokenize-BF1Jf29a.js";import"./vendor-micromark-factory-destination-Sj0xfi0V.js";import"./vendor-micromark-factory-label-amyP0HdC.js";import"./vendor-micromark-factory-title-khnLkZK6.js";import"./vendor-micromark-factory-whitespace-eIB00uTl.js";import"./vendor-micromark-util-html-tag-name-DbKNfynz.js";import"./vendor-unist-util-stringify-position-Ch_qCilz.js";import"./vendor-mdast-util-to-string-C_aolqmU.js";import"./vendor-unist-util-visit-DhPeCsfG.js";import"./vendor-unist-util-visit-parents-DlviEg7Z.js";import"./vendor-unist-util-is-BPZGFiMU.js";import"./vendor-hast-util-raw-DvvLJg15.js";import"./vendor-ungap-structured-clone--gfxRhYI.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-parse5-DwmzEj2o.js";import"./vendor-entities-wUUgTZDW.js";import"./vendor-web-namespaces-bsVAaBS1.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-unist-util-position-60F3QETU.js";import"./vendor-hast-util-from-parse5-Ba3T6RJI.js";import"./vendor-devlop-0Dp3JUBc.js";import"./vendor-property-information-Boo8Xpef.js";import"./vendor-hastscript-BrPNioaz.js";import"./vendor-comma-separated-tokens-CRUGqg4f.js";import"./vendor-space-separated-tokens-D7QSIrTI.js";import"./vendor-hast-util-parse-selector-TXfch5wI.js";import"./vendor-vfile-location-LfEFwJ2h.js";import"./vendor-hast-util-to-parse5-BoysVIPW.js";import"./vendor-hast-util-sanitize-2aGO5ay8.js";import"./vendor-micromark-extension-gfm-CsfPlnlB.js";import"./vendor-micromark-extension-gfm-autolink-literal-BYug7onl.js";import"./vendor-micromark-extension-gfm-footnote-OFl1FCH2.js";import"./vendor-micromark-extension-gfm-strikethrough-CyFiuwBf.js";import"./vendor-micromark-extension-gfm-table-dgw4LfUw.js";import"./vendor-micromark-extension-gfm-task-list-item-Dnadzr9U.js";import"./vendor-mdast-util-gfm-CroMDYLM.js";import"./vendor-mdast-util-gfm-autolink-literal-CTruMtvI.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-mdast-util-find-and-replace-DB9iC-bx.js";import"./vendor-escape-string-regexp-BaJN9MlJ.js";import"./vendor-mdast-util-gfm-footnote-C-csI7OF.js";import"./vendor-mdast-util-gfm-strikethrough-BcskTdio.js";import"./vendor-mdast-util-gfm-table-DhPwQIyj.js";import"./vendor-markdown-table-DvhhVmnL.js";import"./vendor-mdast-util-to-markdown-Cl3qaiyc.js";import"./vendor-longest-streak-CtXnX3Xp.js";import"./vendor-mdast-util-phrasing-4oVbNLC3.js";import"./vendor-mdast-util-gfm-task-list-item-DMU5mK_M.js";import"./vendor-mdast-util-to-hast-CWnLaQSO.js";import"./vendor-micromark-util-sanitize-uri-BbwQ7CLk.js";import"./vendor-trim-lines-D8znQY54.js";import"./vendor-micromark-extension-cjk-friendly-BzZDGrF5.js";import"./vendor-micromark-extension-cjk-friendly-util-D5lVNoxW.js";import"./vendor-get-east-asian-width-CPhS2cOv.js";import"./vendor-micromark-util-symbol-JJPacVTp.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-BZ3pe_qd.js";import"./vendor-micromark-extension-cjk-friendly-gfm-strikethrough-CqW-Ep4M.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-BdPDQFO7.js";import"./vendor-hast-util-from-html-isomorphic-B0Kn01s9.js";import"./vendor-hast-util-from-dom-DeNf9aYW.js";import"./vendor-katex-DBqql0K7.js";import"./vendor-hast-util-to-text-0GXLnBvt.js";import"./vendor-hast-util-is-element-CuOmiqQi.js";import"./vendor-unist-util-find-after-CMaZmLxc.js";import"./vendor-micromark-extension-math-BRFoDziv.js";import"./vendor-mdast-util-math-wB-IJCL0.js";import"./vendor-remend-r8cP_t-e.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-marked-DN3zOnEe.js";import"./vendor-hast-util-to-jsx-runtime-Bq6JeJCx.js";import"./vendor-style-to-js-CI2G4dgu.js";import"./vendor-style-to-object-BAv4SQXc.js";import"./vendor-inline-style-parser-BlqBsVO4.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";import"./vendor-estree-util-is-identifier-name-BgBfM8ME.js";import"./vendor-vfile-message-DqhD22jI.js";import"./vendor-unified-1CQKw2_w.js";import"./vendor-bail-FqpXQuLt.js";import"./vendor-extend-B94qxKr5.js";import"./vendor-is-plain-obj-C1gvLhAf.js";import"./vendor-trough-B_b8ryxu.js";import"./vendor-vfile-BCWrK60u.js";import"./vendor-html-url-attributes-D46m5wfe.js";import"./vendor-base-ui-CHqK1aDI.js";import"./vendor-floating-ui-utils-BzXdqYpP.js";import"./vendor-floating-ui-dom-WyXykhNi.js";import"./vendor-floating-ui-core-CXmKXOXc.js";import"./vendor-floating-ui-react-dom-Cy8dRGoy.js";import"./vendor-use-sync-external-store-CfLJGVyr.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-tanstack-react-virtual-Bw3q1rnq.js";import"./vendor-tanstack-virtual-core-B4TJYmIq.js";import"./vendor-framer-motion-C_wK4GIM.js";import"./vendor-motion-dom-HXPOMxb7.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-codemirror-commands-CjjsURR-.js";import"./vendor-codemirror-state-Cd8udR5z.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-Ciie9ey-.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-codemirror-language-8HZTPOnt.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CZEcqU6G.js";import"./vendor-codemirror-streamparser-CmlTsbN2.js";import"./vendor-codemirror-lang-javascript-DmqaSK_j.js";import"./vendor-lezer-javascript-CWSwshuO.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-BGedy2gC.js";import"./vendor-codemirror-lang-json-DVAYKmoO.js";import"./vendor-lezer-json-Cn1mncjr.js";import"./vendor-codemirror-lang-css-BLpgXfL2.js";import"./vendor-lezer-css-B2Hx_Nps.js";import"./vendor-codemirror-lang-html-S3jxr3Mo.js";import"./vendor-lezer-html-Cr8K5DGw.js";import"./vendor-codemirror-lang-markdown-D1jveRI5.js";import"./vendor-lezer-markdown-TQKzBB8i.js";import"./vendor-codemirror-language-data-BI6j-q9C.js";import"./vendor-codemirror-lang-python-B-5UC9Ui.js";import"./vendor-lezer-python-BUoImtUb.js";import"./vendor-cmdk-BtSpU-Io.js";import"./vendor-radix-ui-react-dialog-OIW6VLWw.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-D4RvEbuR.js";import"./vendor-radix-ui-react-context-BbFoxCHu.js";import"./vendor-radix-ui-react-id-aGag8i_5.js";import"./vendor-radix-ui-react-use-layout-effect-B1oLzD-j.js";import"./vendor-radix-ui-react-use-controllable-state-BjnNPGHq.js";import"./vendor-radix-ui-react-dismissable-layer-DpT6mMbO.js";import"./vendor-radix-ui-react-primitive-CrN9dRDb.js";import"./vendor-radix-ui-react-slot-BjbalUfz.js";import"./vendor-radix-ui-react-use-callback-ref-CcC_buIU.js";import"./vendor-radix-ui-react-use-escape-keydown-Cp1WWKTC.js";import"./vendor-radix-ui-react-focus-scope-D1noLHmd.js";import"./vendor-radix-ui-react-portal-BlUEzfrF.js";import"./vendor-radix-ui-react-presence-BGqFfiW4.js";import"./vendor-radix-ui-react-focus-guards-CSS2IbZC.js";import"./vendor-react-remove-scroll-Der_cv-1.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-Clwl9llp.js";import"./vendor-react-style-singleton-D_xJlTqU.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-BdLl6ZIw.js";import"./vendor-use-callback-ref-CXJF1lEr.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-legendapp-list-iLtL-MFj.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./space-apply-DnoCDzwj.js";import"./install-NTaAzPnj.js";import"./vendor-yaml-CE-D_49-.js";import"./flexokiTheme-DJaL_u7G.js";import"./vendor-codemirror-search-CWqbGraJ.js";import"./vendor-replit-codemirror-vim-DTiXsOdM.js";import"./vendor-replit-codemirror-vim-core-FHzKdNUS.js";import"./editorCodeMetrics-a0NLS65y.js";import"./codeHighlight-DyrRLTkb.js";import"./appThemeRegistry-C3TUDJ7r.js";import"./themeResolver-DjCwdtoe.js";import"./vendor-pierre-theming-Dn546TCS.js";import"./vendor-dnd-kit-accessibility-CYclfhtC.js";import"./vendor-qrcode-Cl8OheHW.js";import"./vendor-dijkstrajs-COg3n3zL.js";import"./install-request-D5VhmtWC.js";import"./vendor-strip-json-comments-5dJlOkP1.js";import"./useCallableModelProviders-DngJbZnV.js";import"./AboutLogo-K3wdJM69.js";import"./pageTitle-BT3-HFbv.js";import"./useInlineCommentController-Z8ADSR8f.js";import"./fileContentPoller-B8a010z5.js";import"./useMarkdownLocalAssets-CZIMWgjn.js";import"./spaceNetwork-D5Fcyb33.js";import"./useWorktreeArchiveActions-CKnDdsvh.js";import"./scheduledTasksApi-C1TDMoZd.js";import"./vendor-cron-parser-1X50-i0r.js";import"./vendor-luxon-BZ0puJYg.js";import"./date-time-DSQbTMhf.js";import"./isDiffPlainText-B6ZzF_T5.js";import"./computeVirtualFileMetrics-YMtW3BEg.js";import"./getFiletypeFromFileName-BgI9McTw.js";import"./vendor-diff-C3JhlQdm.js";import"./pierreDiffTint-C4cPKKnP.js";import"./hastToHtml-BHV14OWE.js";import"./vendor-hast-util-to-html-Jw3IXh58.js";import"./vendor-stringify-entities-CsH1VEn9.js";import"./vendor-character-entities-legacy-BpoLgcEt.js";import"./vendor-character-entities-html4-D7taRCQ7.js";import"./ReviewCards-UN_E9jl0.js";import"./diffsHighlighter-DZ_8ZCaS.js";import"./document-attachments-CIZjaOGe.js";import"./vendor-fflate-DB4_FQr-.js";import"./documentClient-5O0az-Ma.js";let Fa=null,no=false;const hh=new Promise(s=>{Fa=s});function gh(){no||(no=true,Fa?.())}const bh=10,yh=s=>s.parentID??null,Hi=s=>{const e=s.replace(/\/+$/,"");return e.slice(e.lastIndexOf("/")+1)||e},xh=(s,e)=>{if(!s)return"";const t=uc(e,dt.getState().availableWorktreesByProject,s);return t?t.label?.trim()||Hi(t.path):Hi(s)},vh=s=>{const e=na.getState();if(e.statusById.get(s)?.status.type==="retry")return"retrying";if(e.activeSessionIds.has(s))return"running";if(e.observedById.get(s)?.outcome==="failed")return"error"},za=()=>{const s=Ns.getState().activeSessions,e=qt.getState().projects,t=ta.getState().ids,i=lc.getState().rankById;let a=0;const r=[];for(const o of s){const d=cc(o);d&&(a+=1),yh(o)===null&&r.push({session:o,unread:d,project:xh(sa(o),e)})}r.sort((o,d)=>dc(o.session,d.session,t,i));const l=r.slice(0,bh).map(({session:o,unread:d,project:u})=>{const c={id:o.id,title:o.title??"",unread:d,project:u},f=vh(o.id);return f&&(c.status=f),c});return{runtimeKey:xn(),attentionCount:a,recentSessions:l,projects:e.map(o=>({id:o.id,label:o.label?.trim()||Hi(o.path)}))}},wh="__OPENCHAMBER_WIDGET_SNAPSHOT__",Sh=()=>{typeof window>"u"||(window[wh]=()=>{try{return JSON.stringify(za())}catch{return null}})},io="mobile-app-update-available",ro="mobile-app-update-toast-dismissed-version",jh=()=>{const s=oe.c(8),{t:e}=be(),t=Vs(kh),i=Vs(Ch),a=Vs(Nh),r=Vs(Rh);let l;s[0]===Symbol.for("react.memo_cache_sentinel")?(l=new Set,s[0]=l):l=s[0];const o=Ai.useRef(l);let d,u;return s[1]!==t||s[2]!==r||s[3]!==i||s[4]!==e||s[5]!==a?(d=()=>{if(Yi()!=="android"||i!=="mobile"||!t||!a||!r){me.dismiss(io);return}_r().getItem(ro)!==a&&(o.current.has(a)||(o.current.add(a),me.info(e("mobileUpdate.toast.available.title"),{id:io,description:e("mobileUpdate.toast.available.description",{version:a}),duration:1/0,icon:n.jsx(X,{name:"download",className:"h-4 w-4 text-muted-foreground"}),action:{label:e("mobileUpdate.toast.actions.download"),onClick:()=>{ia(r)}},onDismiss:()=>{const c=Vs.getState();c.available&&c.info?.version===a&&_r().setItem(ro,a)}})))},u=[t,r,i,e,a],s[1]=t,s[2]=r,s[3]=i,s[4]=e,s[5]=a,s[6]=d,s[7]=u):(d=s[6],u=s[7]),Ai.useEffect(d,u),null};function kh(s){return s.available}function Ch(s){return s.runtimeType}function Nh(s){return s.info?.version}function Rh(s){return s.info?.downloadUrl}const Wa="calc(var(--oc-safe-area-top, 0px) + var(--oc-visual-viewport-offset-top, 0px) + 16px)",Ih={top:Wa,left:"calc(var(--oc-safe-area-left, 0px) + 16px)",right:"calc(var(--oc-safe-area-right, 0px) + 16px)"};function Ph(s){const e=oe.c(3);let t,i;e[0]!==s?(t=()=>{const a=window.visualViewport,r=s.current;if(!a||!r)return;let l="";const o=()=>{const d=`${Math.max(0,Math.round(a.offsetTop))}px`;d!==l&&(l=d,r.style.setProperty("--oc-visual-viewport-offset-top",d))};return o(),a.addEventListener("scroll",o),a.addEventListener("resize",o),()=>{a.removeEventListener("scroll",o),a.removeEventListener("resize",o)}},i=[s],e[0]=s,e[1]=t,e[2]=i):(t=e[1],i=e[2]),p.useEffect(t,i)}function Eh(){const s=oe.c(1),e=p.useRef(null);Ph(e);let t;return s[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx("div",{ref:e,className:"contents",children:n.jsx(fc,{position:"top-center",layout:"banner",offset:Wa,mobileOffset:Ih})}),s[0]=t):t=s[0],t}const oo=300,Th="openchamber.mobile.connectLog.v1",rn=[];if(typeof window<"u")try{window.localStorage.removeItem(Th)}catch{}const li=(s,e)=>{rn.push({at:Date.now(),step:s,detail:e}),rn.length>oo&&rn.splice(0,rn.length-oo)};typeof window<"u"&&li("app:launch",JSON.stringify({sinceNavigationMs:Math.round(performance.now())}));const _h=3e4,Ah=150;if(typeof window<"u"&&Tt()){let s=0;Ar(({method:e,url:t,status:i,durationMs:a})=>{if(s>=Ah)return;s+=1;let r=t;try{r=new URL(t,window.location.origin).pathname}catch{r=t.split("?")[0]??t}li("request",JSON.stringify({method:e,path:r,status:i,ms:Math.round(a)}))}),window.setTimeout(()=>Ar(null),_h)}const Dh=()=>[...rn],Oh=s=>{const e=new Date(s),t=(i,a=2)=>String(i).padStart(a,"0");return`${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}.${t(e.getMilliseconds(),3)}`},$a=s=>`${Oh(s.at)} ${s.step}${s.detail&&s.detail!=="{}"?` ${s.detail}`:""}`,Mh=()=>rn.map($a).join(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilesView-D0FOaLpo.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-react--VO_rL_p.js","assets/vendor-scheduler-7OC5HNn7.js","assets/useAppFontEffects-BDLOJuy5.js","assets/katex.min-DklPh68d.js","assets/vendor-zustand-C9tWdk0j.js","assets/vendor-zod-DV_WH382.js","assets/vendor-opencode-client-NJGkA1Ku.js","assets/vendor-fuse.js-Dw8P0qyA.js","assets/vendor-streamdown-BbSYZ3NF.js","assets/vendor-markdown-BTUqNk6W.js","assets/vendor-mdast-util-from-markdown-CZHjOE75.js","assets/vendor-micromark-util-decode-numeric-character-reference-CNs1qBpV.js","assets/vendor-micromark-util-decode-string-fHsnqYdj.js","assets/vendor-decode-named-character-reference-C3-224fz.js","assets/vendor-micromark-util-normalize-identifier-C9ANKk3v.js","assets/vendor-micromark-AWM-NZXP.js","assets/vendor-micromark-util-combine-extensions-d8XJZrgA.js","assets/vendor-micromark-util-chunked-DrRIdSP-.js","assets/vendor-micromark-factory-space-PzSHLgmq.js","assets/vendor-micromark-util-character-CW3Cu1MS.js","assets/vendor-micromark-core-commonmark-kzTLNXAm.js","assets/vendor-micromark-util-classify-character-tcLuZZwM.js","assets/vendor-micromark-util-resolve-all-PQCKh0dx.js","assets/vendor-micromark-util-subtokenize-BF1Jf29a.js","assets/vendor-micromark-factory-destination-Sj0xfi0V.js","assets/vendor-micromark-factory-label-amyP0HdC.js","assets/vendor-micromark-factory-title-khnLkZK6.js","assets/vendor-micromark-factory-whitespace-eIB00uTl.js","assets/vendor-micromark-util-html-tag-name-DbKNfynz.js","assets/vendor-unist-util-stringify-position-Ch_qCilz.js","assets/vendor-mdast-util-to-string-C_aolqmU.js","assets/vendor-unist-util-visit-DhPeCsfG.js","assets/vendor-unist-util-visit-parents-DlviEg7Z.js","assets/vendor-unist-util-is-BPZGFiMU.js","assets/vendor-hast-util-raw-DvvLJg15.js","assets/vendor-ungap-structured-clone--gfxRhYI.js","assets/vendor-html-void-elements-CkdplsNl.js","assets/vendor-parse5-DwmzEj2o.js","assets/vendor-entities-wUUgTZDW.js","assets/vendor-web-namespaces-bsVAaBS1.js","assets/vendor-zwitch-C2o2j-tx.js","assets/vendor-unist-util-position-60F3QETU.js","assets/vendor-hast-util-from-parse5-Ba3T6RJI.js","assets/vendor-devlop-0Dp3JUBc.js","assets/vendor-property-information-Boo8Xpef.js","assets/vendor-hastscript-BrPNioaz.js","assets/vendor-comma-separated-tokens-CRUGqg4f.js","assets/vendor-space-separated-tokens-D7QSIrTI.js","assets/vendor-hast-util-parse-selector-TXfch5wI.js","assets/vendor-vfile-location-LfEFwJ2h.js","assets/vendor-hast-util-to-parse5-BoysVIPW.js","assets/vendor-hast-util-sanitize-2aGO5ay8.js","assets/vendor-micromark-extension-gfm-CsfPlnlB.js","assets/vendor-micromark-extension-gfm-autolink-literal-BYug7onl.js","assets/vendor-micromark-extension-gfm-footnote-OFl1FCH2.js","assets/vendor-micromark-extension-gfm-strikethrough-CyFiuwBf.js","assets/vendor-micromark-extension-gfm-table-dgw4LfUw.js","assets/vendor-micromark-extension-gfm-task-list-item-Dnadzr9U.js","assets/vendor-mdast-util-gfm-CroMDYLM.js","assets/vendor-mdast-util-gfm-autolink-literal-CTruMtvI.js","assets/vendor-ccount-c2V3InAJ.js","assets/vendor-mdast-util-find-and-replace-DB9iC-bx.js","assets/vendor-escape-string-regexp-BaJN9MlJ.js","assets/vendor-mdast-util-gfm-footnote-C-csI7OF.js","assets/vendor-mdast-util-gfm-strikethrough-BcskTdio.js","assets/vendor-mdast-util-gfm-table-DhPwQIyj.js","assets/vendor-markdown-table-DvhhVmnL.js","assets/vendor-mdast-util-to-markdown-Cl3qaiyc.js","assets/vendor-longest-streak-CtXnX3Xp.js","assets/vendor-mdast-util-phrasing-4oVbNLC3.js","assets/vendor-mdast-util-gfm-task-list-item-DMU5mK_M.js","assets/vendor-mdast-util-to-hast-CWnLaQSO.js","assets/vendor-micromark-util-sanitize-uri-BbwQ7CLk.js","assets/vendor-trim-lines-D8znQY54.js","assets/vendor-micromark-extension-cjk-friendly-BzZDGrF5.js","assets/vendor-micromark-extension-cjk-friendly-util-D5lVNoxW.js","assets/vendor-get-east-asian-width-CPhS2cOv.js","assets/vendor-micromark-util-symbol-JJPacVTp.js","assets/vendor-mdast-util-to-markdown-cjk-friendly-BZ3pe_qd.js","assets/vendor-micromark-extension-cjk-friendly-gfm-strikethrough-CqW-Ep4M.js","assets/vendor-mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-BdPDQFO7.js","assets/vendor-hast-util-from-html-isomorphic-B0Kn01s9.js","assets/vendor-hast-util-from-dom-DeNf9aYW.js","assets/vendor-katex-DBqql0K7.js","assets/vendor-hast-util-to-text-0GXLnBvt.js","assets/vendor-hast-util-is-element-CuOmiqQi.js","assets/vendor-unist-util-find-after-CMaZmLxc.js","assets/vendor-micromark-extension-math-BRFoDziv.js","assets/vendor-mdast-util-math-wB-IJCL0.js","assets/vendor-remend-r8cP_t-e.js","assets/vendor-clsx-B-dksMZM.js","assets/vendor-tailwind-merge-BKkUfl9q.js","assets/vendor-marked-DN3zOnEe.js","assets/vendor-hast-util-to-jsx-runtime-Bq6JeJCx.js","assets/vendor-style-to-js-CI2G4dgu.js","assets/vendor-style-to-object-BAv4SQXc.js","assets/vendor-inline-style-parser-BlqBsVO4.js","assets/vendor-hast-util-whitespace-D4Wp6AEg.js","assets/vendor-estree-util-is-identifier-name-BgBfM8ME.js","assets/vendor-vfile-message-DqhD22jI.js","assets/vendor-unified-1CQKw2_w.js","assets/vendor-bail-FqpXQuLt.js","assets/vendor-extend-B94qxKr5.js","assets/vendor-is-plain-obj-C1gvLhAf.js","assets/vendor-trough-B_b8ryxu.js","assets/vendor-vfile-BCWrK60u.js","assets/vendor-html-url-attributes-D46m5wfe.js","assets/vendor-capacitor-core-B4EWRrHz.js","assets/katex-BWbKx7qU.css","assets/vendor-base-ui-CHqK1aDI.js","assets/vendor-floating-ui-utils-BzXdqYpP.js","assets/vendor-floating-ui-dom-WyXykhNi.js","assets/vendor-floating-ui-core-CXmKXOXc.js","assets/vendor-floating-ui-react-dom-Cy8dRGoy.js","assets/vendor-use-sync-external-store-CfLJGVyr.js","assets/vendor-simplewebauthn-browser-VDA66rT_.js","assets/vendor-dnd-kit-core-Br1Cs7RV.js","assets/vendor-dnd-kit-utilities-DZ9KbT5S.js","assets/vendor-dnd-kit-accessibility-CYclfhtC.js","assets/vendor-dnd-kit-sortable-DpfLEOLv.js","assets/vendor-tanstack-react-virtual-Bw3q1rnq.js","assets/vendor-tanstack-virtual-core-B4TJYmIq.js","assets/vendor-framer-motion-C_wK4GIM.js","assets/vendor-motion-dom-HXPOMxb7.js","assets/vendor-motion-utils-BGh8QBgx.js","assets/vendor-codemirror-commands-CjjsURR-.js","assets/vendor-codemirror-state-Cd8udR5z.js","assets/vendor-marijn-find-cluster-break-DXwl3gUT.js","assets/vendor-codemirror-view-Ciie9ey-.js","assets/vendor-style-mod-NZ5MEPvj.js","assets/vendor-w3c-keyname-Vcq4gwWv.js","assets/vendor-crelt-C8TCjufn.js","assets/vendor-codemirror-language-8HZTPOnt.js","assets/vendor-lezer-common-B3-cUCR_.js","assets/vendor-lezer-highlight-CZEcqU6G.js","assets/vendor-codemirror-streamparser-CmlTsbN2.js","assets/vendor-codemirror-lang-javascript-DmqaSK_j.js","assets/vendor-lezer-javascript-CWSwshuO.js","assets/vendor-lezer-lr-bhwg1HMg.js","assets/vendor-codemirror-autocomplete-BGedy2gC.js","assets/vendor-codemirror-lang-json-DVAYKmoO.js","assets/vendor-lezer-json-Cn1mncjr.js","assets/vendor-codemirror-lang-css-BLpgXfL2.js","assets/vendor-lezer-css-B2Hx_Nps.js","assets/vendor-codemirror-lang-html-S3jxr3Mo.js","assets/vendor-lezer-html-Cr8K5DGw.js","assets/vendor-codemirror-lang-markdown-D1jveRI5.js","assets/vendor-lezer-markdown-TQKzBB8i.js","assets/vendor-codemirror-language-data-CFvXza4M.js","assets/vendor-codemirror-lang-python-B-5UC9Ui.js","assets/vendor-lezer-python-BUoImtUb.js","assets/vendor-sonner-Dw26OnzC.js","assets/vendor-cmdk-BtSpU-Io.js","assets/vendor-radix-ui-react-dialog-OIW6VLWw.js","assets/vendor-radix-ui-primitive-Dc_FVRD7.js","assets/vendor-radix-ui-react-compose-refs-D4RvEbuR.js","assets/vendor-radix-ui-react-context-BbFoxCHu.js","assets/vendor-radix-ui-react-id-aGag8i_5.js","assets/vendor-radix-ui-react-use-layout-effect-B1oLzD-j.js","assets/vendor-radix-ui-react-use-controllable-state-BjnNPGHq.js","assets/vendor-radix-ui-react-dismissable-layer-DpT6mMbO.js","assets/vendor-radix-ui-react-primitive-CrN9dRDb.js","assets/vendor-radix-ui-react-slot-BjbalUfz.js","assets/vendor-radix-ui-react-use-callback-ref-CcC_buIU.js","assets/vendor-radix-ui-react-use-escape-keydown-Cp1WWKTC.js","assets/vendor-radix-ui-react-focus-scope-D1noLHmd.js","assets/vendor-radix-ui-react-portal-BlUEzfrF.js","assets/vendor-radix-ui-react-presence-BGqFfiW4.js","assets/vendor-radix-ui-react-focus-guards-CSS2IbZC.js","assets/vendor-react-remove-scroll-Der_cv-1.js","assets/vendor-tslib-De9GV7Vy.js","assets/vendor-react-remove-scroll-bar-Clwl9llp.js","assets/vendor-react-style-singleton-D_xJlTqU.js","assets/vendor-get-nonce-C-Z93AgS.js","assets/vendor-use-sidecar-BdLl6ZIw.js","assets/vendor-use-callback-ref-CXJF1lEr.js","assets/vendor-aria-hidden-DvXkyWUv.js","assets/vendor-legendapp-list-iLtL-MFj.js","assets/vendor-class-variance-authority-5VPnzWs2.js","assets/flexokiTheme-CcqiI7j-.js","assets/vendor-codemirror-search-CWqbGraJ.js","assets/vendor-replit-codemirror-vim-DTiXsOdM.js","assets/vendor-replit-codemirror-vim-core-FHzKdNUS.js","assets/editorCodeMetrics-CNBjOGNA.js","assets/ReceivedPagePanel-CfXyzCii.js","assets/space-apply-j71ap5Rs.js","assets/ReceivedPagePanel-uDNKGwhp.css","assets/useMarkdownLocalAssets-BjT607tF.js","assets/fileContentPoller-DRoVO_sh.js","assets/useInlineCommentController-Wnopn0Ar.js","assets/JsonTreeView-DQ6XLAW4.js","assets/parseDiffFromFile-D28_u-uC.js","assets/computeVirtualFileMetrics-Bc_YiqAD.js","assets/themeResolver-DjCwdtoe.js","assets/vendor-pierre-theming-Dn546TCS.js","assets/hastToHtml-BHV14OWE.js","assets/vendor-hast-util-to-html-Jw3IXh58.js","assets/vendor-stringify-entities-CsH1VEn9.js","assets/vendor-character-entities-legacy-BpoLgcEt.js","assets/vendor-character-entities-html4-D7taRCQ7.js","assets/vendor-diff-C3JhlQdm.js","assets/useNextRenderData-CVFf78p9.js","assets/getFiletypeFromFileName-BgI9McTw.js","assets/isFilePlainText-Bcn3vV6J.js","assets/vendor-strip-json-comments-5dJlOkP1.js","assets/codeHighlight-Bmb7zcc2.js","assets/appThemeRegistry-C4Av1s90.js","assets/ReviewCards-D7jBPhS_.js","assets/contextFileOpenGuard-D-HtBtn6.js","assets/vendor-react-drawio-C6TkEvnS.js","assets/vendor-codemirror-lint-aq8IpR1c.js","assets/moveWorkspacePath-DibtVw_Q.js","assets/vendor-fflate-DB4_FQr-.js","assets/useWholeFileComment-CQj6q_QX.js","assets/diffsHighlighter-CFc933Ip.js","assets/scheduledTasksApi-v463mt0u.js","assets/GuestPanelContent-BCxvKv4H.js","assets/vendor-capacitor-app-BrDJj9I_.js","assets/vendor-capacitor-push-notifications-KNe1zSBF.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{f as oe,r as Ai,j as n,R as p,a as cn,h as Ll}from"./vendor-react--VO_rL_p.js";import{W as xn,bt as Yi,bu as _r,bv as Tt,bw as Ar,bj as ps,bx as tn,bq as dn,j as qo,by as ni,bz as Jo,bA as Bl,bB as Yo,bC as Fl,bD as zl,bE as Wl,bF as $l,bG as Kl,u as qe,l as un,n as Zs,Q as Hl,R as Vl,at as Xo,E as Ul,aM as Xi,b as Gl,w as zt,bH as ql,ae as Qo,M as Ls,a2 as Jl,b6 as Yl,a1 as Xl,b2 as Ql,b3 as Dr,bf as Zl,aC as ec,bI as Un,af as xi,bJ as tc,bK as sc,bL as nc,bM as Or,Y as ic,a6 as Zo,bd as rc,bN as $n,v as Di,bO as Mr,bP as oc,aP as ea,bQ as vi,bR as ac}from"./katex.min-DklPh68d.js";import{Y as Ns,Z as qt,eP as ta,eQ as lc,fu as cc,b4 as sa,km as dc,cT as uc,a0 as dt,G as na,u as be,A as me,b0 as ia,I as X,gJ as fc,B as ze,n as bs,bb as Qi,bm as sn,ay as mc,a2 as de,kn as pc,dT as wi,k as Yn,ko as hc,kp as ra,kq as gc,gk as bc,V as ns,ck as yc,kr as ks,ks as xc,kt as Lr,ku as Br,kv as vc,kw as wc,eC as Zt,ht as Zi,gf as Sc,gg as oa,fW as jc,fZ as aa,f_ as la,f$ as ca,kx as da,c_ as kc,g0 as Cc,cY as er,cX as ua,ky as Oi,kz as Nc,bV as fa,bQ as ss,fA as ma,kA as Rc,bS as tr,kB as Ic,dG as Pc,kC as Ec,kD as Tc,kE as _c,cZ as Ac,kF as Dc,kG as Oc,kH as Mc,kI as Lc,h$ as Gn,iG as Mi,il as Ds,d1 as Bc,kJ as Fc,ac as zc,kK as Wc,bl as pa,cU as ha,fL as ga,fM as ba,y as $c,kL as Kc,kM as Hc,kN as Vc,kO as Uc,kP as ms,kQ as Gc,bo as sr,kR as qc,fi as ya,fk as Jc,fl as Yc,cB as Fr,kS as zr,kT as Xc,kU as Qc,kV as Zc,kW as ed,bf as td,bg as sd,be as nd,hf as nr,kX as id,f0 as rd,d3 as xa,e$ as od,bh as cs,bt as va,kY as ad,kZ as Li,d9 as ii,z as wa,b9 as ld,a4 as cd,dQ as dd,k_ as ud,gm as fd,k$ as md,eV as Wr,l0 as pd,l1 as hd,a5 as Bi,a6 as Fi,a7 as zi,bY as $r,ad as Si,a8 as an,l2 as Sa,ae as gd,af as bd,ag as yd,kh as xd,az as vd,aD as wd,er as Sd,eB as qs,l3 as jd,f2 as ja,f3 as ka,l4 as kd,bd as Cd,l5 as Nd,gD as Ca,da as Na,l6 as Rd,l7 as Id,l8 as ri,cM as Pd,io as Ra,ip as Ia,bO as ir,bL as Ed,bP as Td,l9 as _d,bR as Ad,hR as Dd,hH as Kn,hI as Od,cs as Wi,hJ as Md,hK as Ld,hS as Bd,h3 as Fd,hQ as zd,bT as Wd,im as $d,it as Kd,h8 as Hd,h4 as Pa,bn as Vd,h7 as Ud,la as Gd,lb as qd,lc as Jd,ld as Yd,iw as Kr,iy as ji,bU as Hn,bv as Xd,bZ as Qd,bW as Rn,hb as Zd,le as eu,hO as tu,hP as su,hM as nu,lf as iu,lg as ru,hY as ou,lh as au,dv as lu,bB as cu,bX as du,iC as uu,iD as fu,iF as mu,ix as pu,fb as Ea,d2 as hu,cn as St,dZ as gu,db as bu,li as yu,lj as xu,lk as vu,ll as wu,lm as Su,ln as ju,lo as Ta,lp as _a,lq as ku,lr as Hr,eu as Cu,ls as Nu,lt as Ru,lu as Iu,lv as Pu,lw as Eu,lx as Tu,gP as _u,f1 as Vr,ly as Au,lz as Du,lA as Ou,an as Mu,dN as Lu,lB as rr,lC as Bu,lD as Fu,gz as zu,gA as Wu,gB as $u,gC as Ku,lE as Hu,lF as Ur,lG as Vu,gF as Uu,gG as Gu,gH as qu,gI as Ju,gE as Yu,gK as Xu,gL as Qu,lH as Zu,lI as ef,lJ as tf,lK as sf,lL as nf,fN as Gr,lM as rf,lN as of,lO as qr,lP as af,lQ as lf,lR as cf,lS as df,dh as uf,gj as ff,gS as mf,lT as pf,al as hf,gU as gf,gV as bf,gW as yf}from"./useAppFontEffects-BDLOJuy5.js";import{aV as Vs,aW as $i,aX as xf,aY as vf,aZ as wf,a_ as Sf,a$ as Aa,b0 as Jr,b1 as jf,b2 as kf,b3 as Cf,b4 as Da,b5 as Nf,b6 as oi,b7 as Rf,b8 as If,b9 as Pf,ba as Ef,bb as Tf,ak as _f,bc as ai,bd as Af,be as Df,bf as Of,bg as Mf,bh as Lf,bi as Bf,bj as Ff,bk as Oa,bl as zf,bm as Wf,bn as $f,bo as Kf,bp as Hf,bq as Vf,br as Uf,bs as Gf,bt as qf,bu as Jf,bv as Yf,bw as Xf,v as Qf,m as Zf,y as em,S as tm,x as sm,o as nm,bx as im,aC as nn,aJ as rm,aK as om,G as Yr,H as am,I as lm,aO as cm,aP as dm,J as um,aD as fm,K as Xr,aQ as Qr,aN as Ma,N as mm,by as pm,bz as hm,aS as gm,bA as bm,bB as ym,bC as xm,bD as vm,bE as wm,bF as Sm,bG as jm,bH as km,bI as Cm,bJ as Nm,bK as Rm,bL as Im,bM as Pm,bN as Em,bO as Tm,bP as _m,bQ as Am,bR as Dm,bS as Om,bT as Mm,bU as Lm,bV as Bm,bW as Fm,bX as zm,bY as Wm,bZ as $m,b_ as Km,b$ as Hm,c0 as Vm}from"./ReceivedPagePanel-CfXyzCii.js";import{i as Um}from"./initializeSharedPreferences-B1ISDxLb.js";import{_ as Js}from"./vendor-vite-runtime-DD1OZmLC.js";import{S as Gm,A as qm}from"./SettingsView-UjifxDq7.js";import{PlanView as Jm}from"./PlanView-DE4sxgkq.js";import{SpaceAccessDialog as Ym}from"./SpaceAccessDialog-G331hiT_.js";import{SpaceApplyDialog as Xm}from"./SpaceApplyDialog-x0rDuJEc.js";import{SpaceSetupOutputDialog as Qm}from"./SpaceSetupOutput-BEXQGXPw.js";import{RunOverview as Zm}from"./RunOverview-BDblAbDp.js";import{o as or,s as fn,a as ep,_ as tp}from"./vendor-zod-DV_WH382.js";import{p as sp}from"./vendor-aparajita-capacitor-secure-storage-5IShChL0.js";import{Capacitor as ar,registerPlugin as lr}from"./vendor-capacitor-core-B4EWRrHz.js";import{h as np,i as Zr,j as ip,P as rp,D as op,f as ap}from"./vendor-dnd-kit-core-Br1Cs7RV.js";import{S as lp,v as cp,u as dp,s as up,a as fp}from"./vendor-dnd-kit-sortable-DpfLEOLv.js";import{C as mp}from"./vendor-dnd-kit-utilities-DZ9KbT5S.js";import{k as Ki,M as La,s as pp,d as hp,J as gp,a as bp,P as yp,K as xp,U as vp,Z as wp,Q as Sp,r as jp}from"./vendor-remixicon-react-CLUUbkY9.js";import{S as kp}from"./SpaceRow-CsS43yrt.js";import{toast as eo}from"./vendor-sonner-Dw26OnzC.js";import{c as Cp}from"./vendor-zustand-C9tWdk0j.js";import{UsageStatsView as Np}from"./UsageStatsView-CLJFagDC.js";import{ArchiveSessionsView as Rp}from"./ArchiveView-0QjF07oK.js";import{MobileSourceBoard as Ip}from"./SourceBoardView-CKJDJ2f4.js";import{OverviewPage as Pp}from"./OverviewView-BXMN0Z8_.js";import{ScheduledTasksView as Ep}from"./ScheduledTasksDialog-NDtZLq5t.js";import{i as Tp,b as _p,u as Ap,c as Dp,d as Op,e as Mp,s as Lp,S as Bp}from"./SubmoduleDiffSummary-CTqIH0Cp.js";import{a as Fp,R as zp,I as Wp,C as $p,b as Kp,c as Hp,D as Vp,u as Up,d as Gp}from"./useGitCleanLine-BwAypcLn.js";import{u as qp,P as to,C as Jp}from"./useBranchPullRequestRequest-DMiPjfPQ.js";import{u as Yp,W as Xp,c as Qp,d as Zp,g as eh,f as th,h as sh,l as nh,k as ih}from"./useWalkthroughReview-BrULG_dy.js";import{u as rh,a as oh,i as so,d as ki,B as ah,C as lh,P as ch,R as dh,b as uh}from"./ChangeRequestDiffUnavailable-kfarKKvU.js";import{p as fh}from"./parseDiffFromFile-D28_u-uC.js";import{i as Ba,O as mh}from"./OfficeDocumentDiff-Csvxzve7.js";import{u as ph}from"./useWholeFileComment-CQj6q_QX.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-opencode-client-NJGkA1Ku.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./vendor-streamdown-BbSYZ3NF.js";import"./vendor-markdown-BTUqNk6W.js";import"./vendor-mdast-util-from-markdown-CZHjOE75.js";import"./vendor-micromark-util-decode-numeric-character-reference-CNs1qBpV.js";import"./vendor-micromark-util-decode-string-fHsnqYdj.js";import"./vendor-decode-named-character-reference-C3-224fz.js";import"./vendor-micromark-util-normalize-identifier-C9ANKk3v.js";import"./vendor-micromark-AWM-NZXP.js";import"./vendor-micromark-util-combine-extensions-d8XJZrgA.js";import"./vendor-micromark-util-chunked-DrRIdSP-.js";import"./vendor-micromark-factory-space-PzSHLgmq.js";import"./vendor-micromark-util-character-CW3Cu1MS.js";import"./vendor-micromark-core-commonmark-kzTLNXAm.js";import"./vendor-micromark-util-classify-character-tcLuZZwM.js";import"./vendor-micromark-util-resolve-all-PQCKh0dx.js";import"./vendor-micromark-util-subtokenize-BF1Jf29a.js";import"./vendor-micromark-factory-destination-Sj0xfi0V.js";import"./vendor-micromark-factory-label-amyP0HdC.js";import"./vendor-micromark-factory-title-khnLkZK6.js";import"./vendor-micromark-factory-whitespace-eIB00uTl.js";import"./vendor-micromark-util-html-tag-name-DbKNfynz.js";import"./vendor-unist-util-stringify-position-Ch_qCilz.js";import"./vendor-mdast-util-to-string-C_aolqmU.js";import"./vendor-unist-util-visit-DhPeCsfG.js";import"./vendor-unist-util-visit-parents-DlviEg7Z.js";import"./vendor-unist-util-is-BPZGFiMU.js";import"./vendor-hast-util-raw-DvvLJg15.js";import"./vendor-ungap-structured-clone--gfxRhYI.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-parse5-DwmzEj2o.js";import"./vendor-entities-wUUgTZDW.js";import"./vendor-web-namespaces-bsVAaBS1.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-unist-util-position-60F3QETU.js";import"./vendor-hast-util-from-parse5-Ba3T6RJI.js";import"./vendor-devlop-0Dp3JUBc.js";import"./vendor-property-information-Boo8Xpef.js";import"./vendor-hastscript-BrPNioaz.js";import"./vendor-comma-separated-tokens-CRUGqg4f.js";import"./vendor-space-separated-tokens-D7QSIrTI.js";import"./vendor-hast-util-parse-selector-TXfch5wI.js";import"./vendor-vfile-location-LfEFwJ2h.js";import"./vendor-hast-util-to-parse5-BoysVIPW.js";import"./vendor-hast-util-sanitize-2aGO5ay8.js";import"./vendor-micromark-extension-gfm-CsfPlnlB.js";import"./vendor-micromark-extension-gfm-autolink-literal-BYug7onl.js";import"./vendor-micromark-extension-gfm-footnote-OFl1FCH2.js";import"./vendor-micromark-extension-gfm-strikethrough-CyFiuwBf.js";import"./vendor-micromark-extension-gfm-table-dgw4LfUw.js";import"./vendor-micromark-extension-gfm-task-list-item-Dnadzr9U.js";import"./vendor-mdast-util-gfm-CroMDYLM.js";import"./vendor-mdast-util-gfm-autolink-literal-CTruMtvI.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-mdast-util-find-and-replace-DB9iC-bx.js";import"./vendor-escape-string-regexp-BaJN9MlJ.js";import"./vendor-mdast-util-gfm-footnote-C-csI7OF.js";import"./vendor-mdast-util-gfm-strikethrough-BcskTdio.js";import"./vendor-mdast-util-gfm-table-DhPwQIyj.js";import"./vendor-markdown-table-DvhhVmnL.js";import"./vendor-mdast-util-to-markdown-Cl3qaiyc.js";import"./vendor-longest-streak-CtXnX3Xp.js";import"./vendor-mdast-util-phrasing-4oVbNLC3.js";import"./vendor-mdast-util-gfm-task-list-item-DMU5mK_M.js";import"./vendor-mdast-util-to-hast-CWnLaQSO.js";import"./vendor-micromark-util-sanitize-uri-BbwQ7CLk.js";import"./vendor-trim-lines-D8znQY54.js";import"./vendor-micromark-extension-cjk-friendly-BzZDGrF5.js";import"./vendor-micromark-extension-cjk-friendly-util-D5lVNoxW.js";import"./vendor-get-east-asian-width-CPhS2cOv.js";import"./vendor-micromark-util-symbol-JJPacVTp.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-BZ3pe_qd.js";import"./vendor-micromark-extension-cjk-friendly-gfm-strikethrough-CqW-Ep4M.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-BdPDQFO7.js";import"./vendor-hast-util-from-html-isomorphic-B0Kn01s9.js";import"./vendor-hast-util-from-dom-DeNf9aYW.js";import"./vendor-katex-DBqql0K7.js";import"./vendor-hast-util-to-text-0GXLnBvt.js";import"./vendor-hast-util-is-element-CuOmiqQi.js";import"./vendor-unist-util-find-after-CMaZmLxc.js";import"./vendor-micromark-extension-math-BRFoDziv.js";import"./vendor-mdast-util-math-wB-IJCL0.js";import"./vendor-remend-r8cP_t-e.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-marked-DN3zOnEe.js";import"./vendor-hast-util-to-jsx-runtime-Bq6JeJCx.js";import"./vendor-style-to-js-CI2G4dgu.js";import"./vendor-style-to-object-BAv4SQXc.js";import"./vendor-inline-style-parser-BlqBsVO4.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";import"./vendor-estree-util-is-identifier-name-BgBfM8ME.js";import"./vendor-vfile-message-DqhD22jI.js";import"./vendor-unified-1CQKw2_w.js";import"./vendor-bail-FqpXQuLt.js";import"./vendor-extend-B94qxKr5.js";import"./vendor-is-plain-obj-C1gvLhAf.js";import"./vendor-trough-B_b8ryxu.js";import"./vendor-vfile-BCWrK60u.js";import"./vendor-html-url-attributes-D46m5wfe.js";import"./vendor-base-ui-CHqK1aDI.js";import"./vendor-floating-ui-utils-BzXdqYpP.js";import"./vendor-floating-ui-dom-WyXykhNi.js";import"./vendor-floating-ui-core-CXmKXOXc.js";import"./vendor-floating-ui-react-dom-Cy8dRGoy.js";import"./vendor-use-sync-external-store-CfLJGVyr.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-tanstack-react-virtual-Bw3q1rnq.js";import"./vendor-tanstack-virtual-core-B4TJYmIq.js";import"./vendor-framer-motion-C_wK4GIM.js";import"./vendor-motion-dom-HXPOMxb7.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-codemirror-commands-CjjsURR-.js";import"./vendor-codemirror-state-Cd8udR5z.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-Ciie9ey-.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-codemirror-language-8HZTPOnt.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CZEcqU6G.js";import"./vendor-codemirror-streamparser-CmlTsbN2.js";import"./vendor-codemirror-lang-javascript-DmqaSK_j.js";import"./vendor-lezer-javascript-CWSwshuO.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-BGedy2gC.js";import"./vendor-codemirror-lang-json-DVAYKmoO.js";import"./vendor-lezer-json-Cn1mncjr.js";import"./vendor-codemirror-lang-css-BLpgXfL2.js";import"./vendor-lezer-css-B2Hx_Nps.js";import"./vendor-codemirror-lang-html-S3jxr3Mo.js";import"./vendor-lezer-html-Cr8K5DGw.js";import"./vendor-codemirror-lang-markdown-D1jveRI5.js";import"./vendor-lezer-markdown-TQKzBB8i.js";import"./vendor-codemirror-language-data-CFvXza4M.js";import"./vendor-codemirror-lang-python-B-5UC9Ui.js";import"./vendor-lezer-python-BUoImtUb.js";import"./vendor-cmdk-BtSpU-Io.js";import"./vendor-radix-ui-react-dialog-OIW6VLWw.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-D4RvEbuR.js";import"./vendor-radix-ui-react-context-BbFoxCHu.js";import"./vendor-radix-ui-react-id-aGag8i_5.js";import"./vendor-radix-ui-react-use-layout-effect-B1oLzD-j.js";import"./vendor-radix-ui-react-use-controllable-state-BjnNPGHq.js";import"./vendor-radix-ui-react-dismissable-layer-DpT6mMbO.js";import"./vendor-radix-ui-react-primitive-CrN9dRDb.js";import"./vendor-radix-ui-react-slot-BjbalUfz.js";import"./vendor-radix-ui-react-use-callback-ref-CcC_buIU.js";import"./vendor-radix-ui-react-use-escape-keydown-Cp1WWKTC.js";import"./vendor-radix-ui-react-focus-scope-D1noLHmd.js";import"./vendor-radix-ui-react-portal-BlUEzfrF.js";import"./vendor-radix-ui-react-presence-BGqFfiW4.js";import"./vendor-radix-ui-react-focus-guards-CSS2IbZC.js";import"./vendor-react-remove-scroll-Der_cv-1.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-Clwl9llp.js";import"./vendor-react-style-singleton-D_xJlTqU.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-BdLl6ZIw.js";import"./vendor-use-callback-ref-CXJF1lEr.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-legendapp-list-iLtL-MFj.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./space-apply-j71ap5Rs.js";import"./install-DY6TBn2e.js";import"./vendor-yaml-CE-D_49-.js";import"./flexokiTheme-CcqiI7j-.js";import"./vendor-codemirror-search-CWqbGraJ.js";import"./vendor-replit-codemirror-vim-DTiXsOdM.js";import"./vendor-replit-codemirror-vim-core-FHzKdNUS.js";import"./editorCodeMetrics-CNBjOGNA.js";import"./codeHighlight-Bmb7zcc2.js";import"./appThemeRegistry-C4Av1s90.js";import"./themeResolver-DjCwdtoe.js";import"./vendor-pierre-theming-Dn546TCS.js";import"./vendor-dnd-kit-accessibility-CYclfhtC.js";import"./vendor-qrcode-Cl8OheHW.js";import"./vendor-dijkstrajs-COg3n3zL.js";import"./install-request-CzRei4tp.js";import"./vendor-strip-json-comments-5dJlOkP1.js";import"./useCallableModelProviders-aGFpVUZL.js";import"./AboutLogo-cbKkZDLU.js";import"./pageTitle-BT3-HFbv.js";import"./useInlineCommentController-Wnopn0Ar.js";import"./fileContentPoller-DRoVO_sh.js";import"./useMarkdownLocalAssets-BjT607tF.js";import"./spaceNetwork-BV5W32NY.js";import"./useWorktreeArchiveActions-CpegLYyZ.js";import"./scheduledTasksApi-v463mt0u.js";import"./vendor-cron-parser-1X50-i0r.js";import"./vendor-luxon-BZ0puJYg.js";import"./date-time-DfmOsLQo.js";import"./isDiffPlainText-Cx5SgKlQ.js";import"./computeVirtualFileMetrics-Bc_YiqAD.js";import"./getFiletypeFromFileName-BgI9McTw.js";import"./vendor-diff-C3JhlQdm.js";import"./pierreDiffTint-CLCzflgS.js";import"./hastToHtml-BHV14OWE.js";import"./vendor-hast-util-to-html-Jw3IXh58.js";import"./vendor-stringify-entities-CsH1VEn9.js";import"./vendor-character-entities-legacy-BpoLgcEt.js";import"./vendor-character-entities-html4-D7taRCQ7.js";import"./ReviewCards-D7jBPhS_.js";import"./diffsHighlighter-CFc933Ip.js";import"./document-attachments-CIZjaOGe.js";import"./vendor-fflate-DB4_FQr-.js";import"./documentClient-D-gfZAFK.js";let Fa=null,no=false;const hh=new Promise(s=>{Fa=s});function gh(){no||(no=true,Fa?.())}const bh=10,yh=s=>s.parentID??null,Hi=s=>{const e=s.replace(/\/+$/,"");return e.slice(e.lastIndexOf("/")+1)||e},xh=(s,e)=>{if(!s)return"";const t=uc(e,dt.getState().availableWorktreesByProject,s);return t?t.label?.trim()||Hi(t.path):Hi(s)},vh=s=>{const e=na.getState();if(e.statusById.get(s)?.status.type==="retry")return"retrying";if(e.activeSessionIds.has(s))return"running";if(e.observedById.get(s)?.outcome==="failed")return"error"},za=()=>{const s=Ns.getState().activeSessions,e=qt.getState().projects,t=ta.getState().ids,i=lc.getState().rankById;let a=0;const r=[];for(const o of s){const d=cc(o);d&&(a+=1),yh(o)===null&&r.push({session:o,unread:d,project:xh(sa(o),e)})}r.sort((o,d)=>dc(o.session,d.session,t,i));const l=r.slice(0,bh).map(({session:o,unread:d,project:u})=>{const c={id:o.id,title:o.title??"",unread:d,project:u},f=vh(o.id);return f&&(c.status=f),c});return{runtimeKey:xn(),attentionCount:a,recentSessions:l,projects:e.map(o=>({id:o.id,label:o.label?.trim()||Hi(o.path)}))}},wh="__OPENCHAMBER_WIDGET_SNAPSHOT__",Sh=()=>{typeof window>"u"||(window[wh]=()=>{try{return JSON.stringify(za())}catch{return null}})},io="mobile-app-update-available",ro="mobile-app-update-toast-dismissed-version",jh=()=>{const s=oe.c(8),{t:e}=be(),t=Vs(kh),i=Vs(Ch),a=Vs(Nh),r=Vs(Rh);let l;s[0]===Symbol.for("react.memo_cache_sentinel")?(l=new Set,s[0]=l):l=s[0];const o=Ai.useRef(l);let d,u;return s[1]!==t||s[2]!==r||s[3]!==i||s[4]!==e||s[5]!==a?(d=()=>{if(Yi()!=="android"||i!=="mobile"||!t||!a||!r){me.dismiss(io);return}_r().getItem(ro)!==a&&(o.current.has(a)||(o.current.add(a),me.info(e("mobileUpdate.toast.available.title"),{id:io,description:e("mobileUpdate.toast.available.description",{version:a}),duration:1/0,icon:n.jsx(X,{name:"download",className:"h-4 w-4 text-muted-foreground"}),action:{label:e("mobileUpdate.toast.actions.download"),onClick:()=>{ia(r)}},onDismiss:()=>{const c=Vs.getState();c.available&&c.info?.version===a&&_r().setItem(ro,a)}})))},u=[t,r,i,e,a],s[1]=t,s[2]=r,s[3]=i,s[4]=e,s[5]=a,s[6]=d,s[7]=u):(d=s[6],u=s[7]),Ai.useEffect(d,u),null};function kh(s){return s.available}function Ch(s){return s.runtimeType}function Nh(s){return s.info?.version}function Rh(s){return s.info?.downloadUrl}const Wa="calc(var(--oc-safe-area-top, 0px) + var(--oc-visual-viewport-offset-top, 0px) + 16px)",Ih={top:Wa,left:"calc(var(--oc-safe-area-left, 0px) + 16px)",right:"calc(var(--oc-safe-area-right, 0px) + 16px)"};function Ph(s){const e=oe.c(3);let t,i;e[0]!==s?(t=()=>{const a=window.visualViewport,r=s.current;if(!a||!r)return;let l="";const o=()=>{const d=`${Math.max(0,Math.round(a.offsetTop))}px`;d!==l&&(l=d,r.style.setProperty("--oc-visual-viewport-offset-top",d))};return o(),a.addEventListener("scroll",o),a.addEventListener("resize",o),()=>{a.removeEventListener("scroll",o),a.removeEventListener("resize",o)}},i=[s],e[0]=s,e[1]=t,e[2]=i):(t=e[1],i=e[2]),p.useEffect(t,i)}function Eh(){const s=oe.c(1),e=p.useRef(null);Ph(e);let t;return s[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx("div",{ref:e,className:"contents",children:n.jsx(fc,{position:"top-center",layout:"banner",offset:Wa,mobileOffset:Ih})}),s[0]=t):t=s[0],t}const oo=300,Th="openchamber.mobile.connectLog.v1",rn=[];if(typeof window<"u")try{window.localStorage.removeItem(Th)}catch{}const li=(s,e)=>{rn.push({at:Date.now(),step:s,detail:e}),rn.length>oo&&rn.splice(0,rn.length-oo)};typeof window<"u"&&li("app:launch",JSON.stringify({sinceNavigationMs:Math.round(performance.now())}));const _h=3e4,Ah=150;if(typeof window<"u"&&Tt()){let s=0;Ar(({method:e,url:t,status:i,durationMs:a})=>{if(s>=Ah)return;s+=1;let r=t;try{r=new URL(t,window.location.origin).pathname}catch{r=t.split("?")[0]??t}li("request",JSON.stringify({method:e,path:r,status:i,ms:Math.round(a)}))}),window.setTimeout(()=>Ar(null),_h)}const Dh=()=>[...rn],Oh=s=>{const e=new Date(s),t=(i,a=2)=>String(i).padStart(a,"0");return`${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}.${t(e.getMilliseconds(),3)}`},$a=s=>`${Oh(s.at)} ${s.step}${s.detail&&s.detail!=="{}"?` ${s.detail}`:""}`,Mh=()=>rn.map($a).join(`
|
|
3
3
|
`),Lh=(s,e)=>{const t=oe.c(10),i=700,a=p.useRef(null),r=p.useRef(null),l=p.useRef(false);let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{a.current!==null&&window.clearTimeout(a.current),a.current=null,r.current=null},t[0]=o):o=t[0];const d=o;let u,c;t[1]===Symbol.for("react.memo_cache_sentinel")?(u=()=>d,c=[d],t[1]=u,t[2]=c):(u=t[1],c=t[2]),p.useEffect(u,c);let f;t[3]!==i||t[4]!==s?(f=S=>{l.current=false,r.current={x:S.clientX,y:S.clientY},a.current!==null&&window.clearTimeout(a.current),a.current=window.setTimeout(()=>{a.current=null,l.current=true,s()},i)},t[3]=i,t[4]=s,t[5]=f):f=t[5];const y=f;let g;t[6]===Symbol.for("react.memo_cache_sentinel")?(g=S=>{const w=r.current;w&&(Math.abs(S.clientX-w.x)>10||Math.abs(S.clientY-w.y)>10)&&d()},t[6]=g):g=t[6];const m=g;let h;t[7]===Symbol.for("react.memo_cache_sentinel")?(h=S=>{l.current&&(l.current=false,S.preventDefault(),S.stopPropagation())},t[7]=h):h=t[7];const b=h;let v;return t[8]!==y?(v={onPointerDown:y,onPointerMove:m,onPointerUp:d,onPointerCancel:d,onClickCapture:b},t[8]=y,t[9]=v):v=t[9],v},Bh=s=>{const e=oe.c(31),{onClose:t}=s,{t:i}=be(),[a,r]=p.useState(false);let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=Dh(),e[0]=l):l=e[0];const o=l;let d;e[1]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{Qi(Mh()).then(j=>{j.ok&&(r(true),window.setTimeout(()=>r(false),2e3))})},e[1]=d):d=e[1];const u=d;let c;e[2]!==i?(c=i("mobile.connectionDebug.title"),e[2]=i,e[3]=c):c=e[3];let f;e[4]!==c?(f=n.jsx("h2",{className:"min-w-0 truncate typography-ui-label text-foreground",children:c}),e[4]=c,e[5]=f):f=e[5];const y=a?"check":"file-copy";let g;e[6]!==y?(g=n.jsx(X,{name:y,className:"size-4"}),e[6]=y,e[7]=g):g=e[7];let m;e[8]!==a||e[9]!==i?(m=i(a?"mobile.connectionDebug.copied":"mobile.connectionDebug.copy"),e[8]=a,e[9]=i,e[10]=m):m=e[10];let h;e[11]!==g||e[12]!==m?(h=n.jsxs(ze,{type:"button",variant:"outline",size:"sm",onClick:u,disabled:o.length===0,children:[g,m]}),e[11]=g,e[12]=m,e[13]=h):h=e[13];let b;e[14]!==i?(b=i("mobile.connectionDebug.close"),e[14]=i,e[15]=b):b=e[15];let v;e[16]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx(X,{name:"close",className:"size-[18px]"}),e[16]=v):v=e[16];let S;e[17]!==t||e[18]!==b?(S=n.jsx(ze,{type:"button",variant:"ghost",size:"icon","aria-label":b,onClick:t,children:v}),e[17]=t,e[18]=b,e[19]=S):S=e[19];let w;e[20]!==S||e[21]!==h?(w=n.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[h,S]}),e[20]=S,e[21]=h,e[22]=w):w=e[22];let N;e[23]!==w||e[24]!==f?(N=n.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-edge px-4 py-2.5",children:[f,w]}),e[23]=w,e[24]=f,e[25]=N):N=e[25];let R;e[26]!==i?(R=n.jsx(bs,{outerClassName:"min-h-0 flex-1",className:"px-4 py-3",disableHorizontal:true,children:o.length===0?n.jsx("p",{className:"typography-small text-muted-foreground",children:i("mobile.connectionDebug.empty")}):n.jsx("pre",{className:"whitespace-pre-wrap break-words typography-code text-muted-foreground",children:o.map($a).join(`
|
|
4
4
|
`)})}),e[26]=i,e[27]=R):R=e[27];let T;return e[28]!==N||e[29]!==R?(T=n.jsxs("div",{className:"fixed inset-0 z-[70] flex flex-col bg-background pb-[var(--safe-area-inset-bottom,env(safe-area-inset-bottom,0px))] pt-[var(--safe-area-inset-top,env(safe-area-inset-top,0px))] text-foreground",children:[N,R]}),e[28]=N,e[29]=R,e[30]=T):T=e[30],T},Fh=ep(fn(),fn()),Ka=or({url:fn(),values:Fh}),zh=(s={})=>Object.entries(s).map(([e,t])=>({id:crypto.randomUUID(),name:e,value:t})),Vi=s=>{const e=new Headers;for(const{name:t,value:i}of s){const a=t.trim();a&&i.trim()&&a.toLowerCase()!=="authorization"&&e.set(a,i.trim())}return Object.fromEntries(e)},Bs=(s,e)=>e&&s.replace(/\/+$/,"")===e.url.replace(/\/+$/,"")?Vi(Object.entries(e.values).map(([t,i])=>({name:t,value:i}))):{},_n={autoComplete:"off",autoCorrect:"off",spellCheck:false},on="oc-surface-elevated h-10 w-full oc-raised oc-field rounded-lg bg-surface-elevated px-3 text-[16px] text-foreground outline-none placeholder:text-muted-foreground",Wh=s=>{const e=oe.c(27),{value:t,onChange:i,disabled:a}=s,{t:r}=be();let l;e[0]!==r?(l=r("settings.remoteInstances.direct.headers.title"),e[0]=r,e[1]=l):l=e[1];let o;e[2]!==l?(o=n.jsx("legend",{className:"px-1 typography-ui-label text-foreground",children:l}),e[2]=l,e[3]=o):o=e[3];let d;e[4]!==r?(d=r("mobile.connect.headers.hint"),e[4]=r,e[5]=d):d=e[5];let u;e[6]!==d?(u=n.jsx("p",{className:"px-1 typography-micro text-muted-foreground",children:d}),e[6]=d,e[7]=u):u=e[7];let c;e[8]!==i||e[9]!==r||e[10]!==t?(c=t.map(b=>n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[n.jsx("input",{..._n,dir:"ltr",autoCapitalize:"none",className:on,value:b.name,onChange:v=>i(t.map(S=>S.id===b.id?{...S,name:v.target.value}:S)),placeholder:r("settings.remoteInstances.direct.headers.field.namePlaceholder"),"aria-label":r("settings.remoteInstances.direct.headers.field.namePlaceholder"),pattern:"[!#$%&'*+.^_`\\|~0-9A-Za-z\\-]+",required:!!b.value}),n.jsx("input",{..._n,dir:"ltr",autoCapitalize:"none",className:on,type:"password",pattern:"[\\x20-\\x7E\\xA0-\\xFF]*",value:b.value,onChange:v=>i(t.map(S=>S.id===b.id?{...S,value:v.target.value}:S)),placeholder:r("settings.remoteInstances.direct.headers.field.valuePlaceholder"),"aria-label":r("settings.remoteInstances.direct.headers.field.valuePlaceholder"),required:!!b.name})]}),n.jsx(ze,{type:"button",variant:"ghost",size:"icon",className:"size-10",onClick:()=>i(t.filter(v=>v.id!==b.id)),"aria-label":r("settings.remoteInstances.direct.headers.removeAria"),children:n.jsx(X,{name:"close",className:"size-4"})})]},b.id)),e[8]=i,e[9]=r,e[10]=t,e[11]=c):c=e[11];let f;e[12]!==i||e[13]!==t?(f=()=>i([...t,{id:crypto.randomUUID(),name:"",value:""}]),e[12]=i,e[13]=t,e[14]=f):f=e[14];let y;e[15]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(X,{name:"add",className:"size-4"}),e[15]=y):y=e[15];let g;e[16]!==r?(g=r("settings.remoteInstances.direct.headers.actions.add"),e[16]=r,e[17]=g):g=e[17];let m;e[18]!==f||e[19]!==g?(m=n.jsxs(ze,{type:"button",variant:"outline",onClick:f,children:[y,g]}),e[18]=f,e[19]=g,e[20]=m):m=e[20];let h;return e[21]!==a||e[22]!==o||e[23]!==u||e[24]!==c||e[25]!==m?(h=n.jsxs("fieldset",{className:"min-w-0 space-y-2",disabled:a,children:[o,u,c,m]}),e[21]=a,e[22]=o,e[23]=u,e[24]=c,e[25]=m,e[26]=h):h=e[26],h},$h=async(s,e)=>{let t;const i=new Promise(a=>{t=setTimeout(()=>a({response:null,failure:"timeout"}),s)});try{return await Promise.race([e.then(a=>({response:a,failure:null}),a=>({response:null,failure:a instanceof Error?a.message:String(a)})),i])}finally{t!==void 0&&clearTimeout(t)}},Kh=(s,e)=>new Promise(t=>{const i=o=>{clearTimeout(r),l(),t(o)},a=o=>{o.state==="connected"?i(true):(o.state==="idle"||o.terminal)&&i(false)},r=setTimeout(()=>i(false),e),l=s.subscribeStatus(a);a(s.getStatus())}),mn=(s,e,t,i)=>$h(i,s.fetch(e,t)),Ha=async(s,e,t,i)=>{const a=Date.now()+i;let r=await mn(s,e,t,i);for(;!r.response&&r.failure!=="timeout"&&s.getStatus().state!=="connected";){const l=a-Date.now();if(l<=0||!await Kh(s,l))return r;const o=a-Date.now();if(o<=0)return r;r=await mn(s,e,t,o)}return r},Xn="openchamber.mobile.connections.v1",cr="openchamber.mobile.",ao="openchamber.mobile.deviceId",Hh=fn().startsWith(`${cr}headers.`),Vh=()=>{try{const s=window.localStorage.getItem(ao);if(s&&s.trim())return s.trim();const e=crypto.randomUUID();return window.localStorage.setItem(ao,e),e}catch{return crypto.randomUUID()}},lo=()=>`mobile:${Vh()}`,co=()=>{try{const s=ar.getPlatform();return s==="ios"||s==="android"?s:void 0}catch{return}},Va=12,dr=8e3,Uh=2500,Gh=3e3,Qn=2500,qh=()=>{let s=0;return{begin:()=>(s+=1,s),cancel:()=>{s+=1},isCurrent:e=>e===s}},zs=s=>{const e=s.trim();if(!e)return"";const t=/^https?:\/\//i.test(e)?e:`http://${e}`,i=new URL(t);return i.hash="",i.search="",i.pathname=i.pathname.replace(/\/+$/,""),i.toString().replace(/\/+$/,"")},qn=s=>{try{return new URL(s).host}catch{return s}},pn=s=>{try{return zs(s)}catch{return s.trim().replace(/\/+$/g,"")}},Ua=(s,e)=>pn(s)===pn(e),Ga=s=>`relay:${s.serverId}@${s.relayUrl.trim()}`,Jh=s=>`relay://${s.serverId}`,On=s=>s.candidates.filter(e=>e.kind==="direct"),Fs=s=>{const e=s.candidates.find(t=>t.kind==="relay");return e&&e.kind==="relay"?e.relay:null},Ms=s=>{const e=On(s)[0];if(e)return e.url;const t=Fs(s);return t?Jh(t):""},uo=s=>s.serverId||Fs(s)?.serverId||null,Gt=s=>{const e=Fs(s);if(e)return Ga(e);if(s.serverId)return`server:${s.serverId}`;const t=On(s)[0];return t?pn(t.url):""},fo=(s,e)=>{const t=uo(s),i=uo(e);return t&&i?t===i:qa(s.candidates,e.candidates)},qa=(s,e)=>{const t=s.find(r=>r.kind==="relay"),i=t&&t.kind==="relay"?t.relay.serverId:null,a=new Set(s.filter(r=>r.kind==="direct").map(r=>pn(r.url)));return e.some(r=>r.kind==="relay"?i!==null&&r.relay.serverId===i:a.has(pn(r.url)))},ur=s=>{const e=(()=>{try{return zs(s)}catch{return""}})();return e?[{kind:"direct",url:e}]:[]},mo=s=>{if(s.candidates&&s.candidates.length>0)return s.candidates;const e=[];return typeof s.url=="string"&&s.url.trim()&&!/^relay:\/\//i.test(s.url.trim())&&e.push(...ur(s.url)),s.relay&&e.push({kind:"relay",relay:s.relay}),e},fr=s=>{if(!s||typeof s!="object"||Array.isArray(s))return null;const e=s;if(typeof e.relayUrl!="string"||!e.relayUrl.trim()||typeof e.serverId!="string"||!e.serverId.trim())return null;const t=e.hostEncPubJwk;if(!t||typeof t!="object"||Array.isArray(t))return null;const i=t;return i.kty!=="EC"||i.crv!=="P-256"||typeof i.x!="string"||!i.x||typeof i.y!="string"||!i.y?null:{relayUrl:e.relayUrl,serverId:e.serverId,hostEncPubJwk:{kty:"EC",crv:"P-256",x:i.x,y:i.y}}},Ja=s=>{try{return JSON.stringify(s)}catch{return String(s)}},Ge=(s,e={})=>{const t=Ja(e);console.info("[mobile-connect]",s,t),li(s,t)},In=(s,e={})=>{Ge(s,e)},hn=(s,e={})=>{const t=Ja(e);console.info("[mobile-storage]",s,t),li(s,t)},Yh=s=>{if(typeof s!="string")return s;try{return JSON.parse(s)}catch{return s}},Xh=s=>{if(typeof s!="string")return s??void 0;try{return JSON.parse(s)}catch{return s}},Qh=async(s,e)=>{if(!Tt())return null;try{const{CapacitorHttp:t}=await Js(async()=>{const{CapacitorHttp:r}=await import("./vendor-capacitor-core-B4EWRrHz.js");return{CapacitorHttp:r}},[]),i=Fl(s,new Headers(e?.headers)),a=await t.request({url:s,method:e?.method||"GET",headers:Object.fromEntries(i.entries()),data:Xh(e?.body),disableRedirects:e?.redirect==="error"});return{ok:a.status>=200&&a.status<300,status:a.status,source:"native-http",json:async()=>Yh(a.data)}}catch(t){return Ge("native-http:failed",{url:s,error:t instanceof Error?t.message:String(t)}),null}},Zh=async(s,e)=>{const t=await fetch(s,e).catch(i=>(Ge("browser-fetch:failed",{url:s,error:i instanceof Error?i.message:String(i)}),null));return t?{ok:t.ok,status:t.status,source:"browser-fetch",json:()=>t.json()}:null},Zn=async(s,e,t)=>{let i;const a=new Promise(r=>{i=window.setTimeout(()=>{t?.(),r(null)},s)});try{return await Promise.race([e,a])}catch{return null}finally{i!==void 0&&window.clearTimeout(i)}},Ys=async(s,e,t)=>{const i=t?.totalTimeoutMs??dr,a=Date.now(),r=await Zn(Math.min(Uh,i),Qh(s,e));if(r)return r;const l=new AbortController,o=Math.max(500,i-(Date.now()-a));return Zn(o,Zh(s,{...e,signal:l.signal}),()=>l.abort())},ci=async s=>{if(!s)return null;const e=await s.json().catch(()=>null);if(!e||typeof e!="object")return null;const t=e;return{authenticated:typeof t.authenticated=="boolean"?t.authenticated:void 0,disabled:typeof t.disabled=="boolean"?t.disabled:void 0,scope:typeof t.scope=="string"?t.scope:void 0}},Ya=async s=>{const e=await s.json().catch(()=>null),t=e&&typeof e=="object"?e.serverId:null;return typeof t=="string"&&t?t:void 0},gn=15e3,bn=s=>{s?.owned&&s.client.close()},po=async(s,e)=>{if(s.status===401)return e?"auth-failed":"needs-login";if(!s.ok&&s.status!==404)return"auth-failed";const t=await ci(s);return t&&t.disabled!==true&&t.authenticated===false?e?"auth-failed":"needs-login":"ok"},e1=async(s,e,t,i=gn,a)=>{const r=e?{Authorization:`Bearer ${e}`}:void 0,l=il(s);if(l){const{response:d,failure:u}=await mn(l,"/auth/session",{headers:r},i);if(Ge("relay:session",{shared:true,ok:d?.ok===true,status:d?.status??null,hasToken:!!e,error:u}),d){const c=await po(d,e);return c==="ok"&&a?.keepTunnel?{outcome:c,tunnel:{client:l,owned:false}}:{outcome:c}}}const o=Yo({relayUrl:s.relayUrl,serverId:s.serverId,hostEncPubJwk:s.hostEncPubJwk});try{const{response:d,failure:u}=await Ha(o,"/auth/session",{headers:r},i);Ge("relay:session",{shared:false,ok:d?.ok===true,status:d?.status??null,hasToken:!!e,error:u});const c=d?await po(d,e):ni(o.getStatus())?"relay-limit":"unreachable";return c==="ok"&&a?.keepTunnel?{outcome:c,tunnel:{client:o,owned:true}}:(o.close(),{outcome:c})}catch(d){throw o.close(),d}},t1=(s,e,t,i,a)=>{const r=typeof window<"u"?window.location.origin:"",l={relayUrl:s.relayUrl,serverId:s.serverId,hostEncPubJwk:s.hostEncPubJwk,...t?{grant:t}:{}};a&&Bl(l,a),tn({apiBaseUrl:r,clientToken:e,runtimeKey:i??Ga(s),relay:l})},s1=s=>{if(!s||typeof s!="object")return null;const e=s;if(e.kind==="direct")return typeof e.url=="string"&&e.url.trim()?{kind:"direct",url:e.url}:null;if(e.kind==="relay"){const t=fr(e.relay);return t?{kind:"relay",relay:t}:null}return null},n1=s=>{if(s.mode==="relay"){const e=fr(s.relay);return e?[{kind:"relay",relay:e}]:[]}return typeof s.url=="string"?ur(s.url):[]},Ws=()=>{if(typeof window>"u")return[];let s;try{s=JSON.parse(window.localStorage.getItem(Xn)||"[]")}catch{return[]}if(!Array.isArray(s))return[];const e=Tt();return s.flatMap(t=>{if(!t||typeof t!="object")return[];const i=t;if(typeof i.id!="string")return[];const a=Array.isArray(i.candidates)?i.candidates.map(s1).filter(d=>!!d):n1(i);if(a.length===0)return[];const r=typeof i.clientToken=="string"&&i.clientToken.trim()?i.clientToken:void 0,l=typeof i.label=="string"&&i.label.trim()?i.label:qn(Ms({candidates:a})),o={id:i.id,label:l,candidates:a,serverId:typeof i.serverId=="string"&&i.serverId.trim()?i.serverId:void 0,lastUsedAt:typeof i.lastUsedAt=="number"?i.lastUsedAt:0,requestHeadersKey:e?Hh.safeParse(i.requestHeadersKey).data:void 0,requestHeaders:e?void 0:Ka.safeParse(i.requestHeaders).data};return e?[{...o,hasToken:!!i.hasToken||!!r}]:[{...o,clientToken:r,hasToken:!!r}]}).sort((t,i)=>i.lastUsedAt-t.lastUsedAt)},Ui=s=>s.kind==="relay"?{kind:"relay",relay:{relayUrl:s.relay.relayUrl,serverId:s.relay.serverId,hostEncPubJwk:s.relay.hostEncPubJwk}}:{kind:"direct",url:s.url},Xa=s=>{if(typeof window>"u")return false;const e=Tt(),t=s.slice(0,Va).map(i=>{const a={id:i.id,label:i.label,candidates:i.candidates.map(Ui),serverId:i.serverId,lastUsedAt:i.lastUsedAt};return e?{...a,hasToken:!!(i.hasToken||i.clientToken),requestHeadersKey:i.requestHeadersKey}:{...a,clientToken:i.clientToken,requestHeaders:i.requestHeaders}});try{return window.localStorage.setItem(Xn,JSON.stringify(t)),true}catch(i){return console.warn("[mobile-storage] failed to persist connection metadata",i),false}},i1=(s,e)=>{const t=(e.id?s.find(r=>r.id===e.id):void 0)??s.find(r=>fo(r,e)),i=Tt(),a={id:e.id||t?.id||crypto.randomUUID(),label:e.label,candidates:e.candidates,serverId:e.serverId??t?.serverId,requestHeadersKey:t?.requestHeadersKey,requestHeaders:t?.requestHeaders,lastUsedAt:Date.now(),...i?{hasToken:e.hasToken??(!!e.clientToken||t?.hasToken||false)}:{clientToken:e.clientToken??t?.clientToken,hasToken:!!(e.clientToken??t?.clientToken)}};return[a,...s.filter(r=>r.id!==a.id&&!fo(r,a))].slice(0,Va)},vn=sp,Qa=0,mr=s=>`${cr}token.${encodeURIComponent(s)}`,di=async(s,e)=>{let t;const i=new Promise(a=>{t=window.setTimeout(()=>a(e),Gh)});try{return await Promise.race([s.catch(()=>e),i])}finally{t!==void 0&&window.clearTimeout(t)}},pr=async(s,e,t)=>Tt()?di(e().catch(i=>(console.warn(`[mobile-storage] ${s} failed`,i),t)),t):t,Mn=async s=>{hn("secure:read-start",{key:s});const e=await pr("secure:read",async()=>(await vn.internalGetItem({prefixedKey:mr(s),sync:false})).data,null),t=typeof e=="string"&&e.trim()?e:void 0;return hn("secure:read",{key:s,hasToken:!!t}),t},Us=async(s,e)=>{hn("secure:write-start",{key:s});const t=await pr("secure:write",async()=>(await vn.internalSetItem({prefixedKey:mr(s),data:e,sync:false,access:Qa}),true),false);return hn("secure:write",{key:s,ok:t}),t},r1=async s=>{await pr("secure:delete",async()=>(await vn.internalRemoveItem({prefixedKey:mr(s),sync:false}),true),false)};class Xs extends Error{constructor(){super("Mobile header storage unavailable")}}const ui=async s=>{if(!s)return;if(!Tt())return s.requestHeaders;const e=s.requestHeadersKey;if(!e)return;const t=await di(vn.internalGetItem({prefixedKey:e,sync:false}).then(i=>i.data),null);if(!t)throw new Xs;try{const i=Ka.parse(JSON.parse(t));return zs(i.url),Bs(i.url,i),i}catch{throw new Xs}},o1=async s=>ui(Ws().find(e=>e.id===s)),Gi=async s=>{await di(vn.internalRemoveItem({prefixedKey:s,sync:false}),null)},ho=async(s,e,t)=>{if(s.requestHeaders===void 0)return ui(t);const i=zs(s.url||Ms({candidates:e})),a=Bs(i,{url:i,values:s.requestHeaders});return Object.keys(a).length?{url:i,values:a}:void 0},a1=async(s,e)=>{let t=0,i=0;return{records:await Promise.all(s.map(async r=>{if(!r||typeof r!="object")return r;const l=r,o=typeof l.url=="string"?l.url:null,d=typeof l.clientToken=="string"?l.clientToken.trim():"";if(!o||!d)return r;if(!await e(o,d))return i+=1,r;t+=1;const{clientToken:u,...c}=l;return{...c,hasToken:true}})),migrated:t,failed:i}},Za=async()=>{if(typeof window>"u"||!Tt())return;let s;try{s=JSON.parse(window.localStorage.getItem(Xn)||"[]")}catch{return}if(!Array.isArray(s))return;const e=s.filter(i=>!!i&&typeof i=="object"&&typeof i.url=="string"&&typeof i.clientToken=="string"&&!!i.clientToken.trim());if(e.length===0)return;hn("secure:migrate-start",{count:e.length});const t=await a1(s,async(i,a)=>{const r=pn(i);return await Us(r,a)?await Mn(r)===a:false});if(t.migrated>0)try{window.localStorage.setItem(Xn,JSON.stringify(t.records))}catch(i){console.warn("[mobile-storage] failed to finalize secure token migration",i);return}hn("secure:migrate-done",{migrated:t.migrated,failed:t.failed})},l1=async()=>(await Za(),Ws()),el=async s=>{let e;if(Tt()&&s.requestHeaders){const a=`${cr}headers.${crypto.randomUUID()}`;if(!await di(vn.internalSetItem({prefixedKey:a,data:JSON.stringify(s.requestHeaders),sync:false,access:Qa}).then(()=>true),false))throw new Xs;e=a}const t=Ws(),i=i1(t,s);if(s.requestHeaders!==void 0&&(i[0].requestHeadersKey=e,i[0].requestHeaders=Tt()?void 0:s.requestHeaders??void 0),!Xa(i))throw e&&await Gi(e),new Xs;for(const a of t)a.requestHeadersKey&&!i.some(r=>r.requestHeadersKey===a.requestHeadersKey)&&await Gi(a.requestHeadersKey);return i},ei=async s=>{const e=await el(s);return Tt()&&s.clientToken&&await Us(Gt(e[0]),s.clientToken),e},c1=async s=>{const e=Ws(),t=e.find(a=>a.id===s)??null,i=e.filter(a=>a.id!==s);if(!Xa(i))throw new Xs;return t?.requestHeadersKey&&await Gi(t.requestHeadersKey),t&&Tt()&&await r1(Gt(t)),t&&nl(Gt(t),null),i},d1=1500,tl="openchamber.mobile.lastTransport.v1",u1=tp(["direct","relay"]),sl=()=>{const s=new Map;if(typeof window>"u")return s;try{const e=JSON.parse(window.localStorage.getItem(tl)||"{}");if(!e||typeof e!="object")return s;for(const[t,i]of Object.entries(e)){const a=u1.safeParse(i);a.success&&s.set(t,a.data)}}catch{}return s},nl=(s,e)=>{const t=sl();e?t.set(s,e):t.delete(s);try{window.localStorage.setItem(tl,JSON.stringify(Object.fromEntries(t)))}catch{}},ti=async(s,e,t)=>{const i=t?.fast?{totalTimeoutMs:Qn}:void 0,a=Fs({candidates:s})?.serverId??null,r=s.find(u=>u.kind==="relay")??null,l=s.filter(u=>u.kind==="direct"),o=async()=>{const u=l.map(c=>{const f=zs(c.url)||c.url,y=Bs(f,t?.requestHeaders),g=Object.keys(y).length?"error":void 0,m=Ys(`${f}/health`,{method:"GET",headers:Bs(f,t?.requestHeaders),redirect:g},i);return{url:f,headers:y,redirect:g,health:m}});for(const c of u){const{url:f,headers:y,redirect:g}=c;e&&(y.Authorization=`Bearer ${e}`);const m=await c.health;if(Ge("probe:direct:health",{url:f,ok:m?.ok===true,status:m?.status??null,source:m?.source??null}),!m?.ok)continue;if(a){const S=await Ya(m);if(S&&S!==a){Ge("probe:server-id-mismatch",{url:f});continue}}const h=await Ys(`${f}/auth/session`,{method:"GET",credentials:e?"omit":"include",headers:y,redirect:g},i);if(Ge("probe:direct:session",{url:f,ok:h?.ok===true,status:h?.status??null,source:h?.source??null,hasToken:!!e}),h?.status===401)return{status:"needs-login"};if(!h||!h.ok&&h.status!==404)continue;const b=await ci(h);if(b&&b.disabled!==true&&b.authenticated===false)return{status:"needs-login"};const v=b?.disabled===true;return!e&&Tt()&&!v&&b?.scope!=="client"?{status:"needs-login"}:{status:"ok",transport:{kind:"direct",url:f}}}return{status:"unreachable"}},d=async()=>{if(!r)return{status:"unreachable"};const{outcome:u,tunnel:c}=await e1(r.relay,e,void 0,t?.fast?Qn:dr,{keepTunnel:true});return u==="ok"?{status:"ok",transport:{kind:"relay",relay:r.relay,tunnel:c}}:u==="needs-login"||u==="auth-failed"?{status:"needs-login"}:u==="relay-limit"?{status:"relay-limit"}:{status:"unreachable"}};return r?l.length===0?d():new Promise(u=>{let c=false,f=false,y,g=null,m=null;const h=S=>{S?.status==="ok"&&S.transport.kind==="relay"&&bn(S.transport.tunnel)},b=S=>{c||(c=true,u(S))},v=()=>{f||c||(y!==void 0&&(window.clearTimeout(y),y=void 0),d().then(S=>{if(m=S,c||f){h(S);return}if(S.status==="ok"||S.status==="needs-login"){b(S);return}g&&b(S)}))};o().then(S=>{if(g=S,!c){if(S.status==="ok"||S.status==="needs-login"){f=true,y!==void 0&&window.clearTimeout(y),h(m),b(S);return}if(m){b(m);return}v()}}),t?.relayFirst?v():y=window.setTimeout(v,d1)}):o()},Os=(s,e,t)=>{hr=false,t?.runtimeKey&&nl(t.runtimeKey,s.kind),s.kind==="relay"?t1(s.relay,e,t?.grant,t?.runtimeKey,s.tunnel?.client):tn({apiBaseUrl:s.url,clientToken:e,runtimeKey:t?.runtimeKey,requestHeaders:Bs(s.url,t?.requestHeaders)}),ol()},Hs=()=>{const s=Ws()[0];return s?.label?.trim()?s.label:null};let hr=false;const f1=()=>{hr=true},Pn=async s=>{if(hr)return Ge("auto-connect:suppressed",{}),{status:"no-candidate"};const e=s?.fast!==false;await Za();const t=Ws()[0];if(Ge("auto-connect:start",{hasCandidate:!!t,fast:e}),!t)return{status:"no-candidate"};let i;if(Tt()){if(t.hasToken&&(i=await Mn(Gt(t)),!i))return{status:"no-candidate"}}else if(i=t.clientToken,!i&&t.hasToken)return{status:"no-candidate"};let a;try{a=await ui(t)}catch{return{status:"unreachable",label:t.label}}const r=sl().get(Gt(t))==="relay",l=await ti(t.candidates,i,{fast:e,requestHeaders:a,relayFirst:r});if(Ge("auto-connect:probe",{status:l.status,candidates:t.candidates.map(o=>o.kind),relayFirst:r}),l.status==="needs-login")return{status:"needs-login",label:t.label};if(l.status==="relay-limit")return{status:"relay-limit",label:t.label};if(l.status!=="ok")return{status:"unreachable",label:t.label};if(s?.skipIfConnected&&ps())return l.transport.kind==="relay"&&bn(l.transport.tunnel),Ge("auto-connect:superseded",{}),{status:"no-candidate"};try{await ei({id:t.id,label:t.label,candidates:t.candidates})}catch{return l.transport.kind==="relay"&&bn(l.transport.tunnel),{status:"unreachable",label:t.label}}return Os(l.transport,i??null,{runtimeKey:Gt(t),requestHeaders:a}),{status:"connected"}},m1=async(s,e)=>{let t="";try{t=zs(s.url)}catch{return false}if(!t)return false;const i=s.clientToken?.trim()||void 0,a=Bs(t,s.requestHeaders),r=Object.keys(a).length?"error":void 0;i&&(a.Authorization=`Bearer ${i}`);const l=e?.fast?{totalTimeoutMs:Qn}:void 0;if(!(await Ys(`${t}/health`,{method:"GET",headers:a,redirect:r},l))?.ok)return false;const d=await Ys(`${t}/auth/session`,{method:"GET",credentials:i?"omit":"include",headers:a,redirect:r},l);if(!d||!d.ok&&d.status!==404)return false;const u=await ci(d);return!(u&&u.disabled!==true&&u.authenticated===false)},go=(s,e)=>{s?.kind==="relay"&&s.owned&&!e&&s.tunnel.close()},p1=(s,e)=>s.kty===e.kty&&s.crv===e.crv&&s.x===e.x&&s.y===e.y,il=s=>{const e=Jo(),t=zl();return!e||!t||e.getStatus().state!=="connected"?null:t.relayUrl===s.relayUrl&&t.serverId===s.serverId&&p1(t.hostEncPubJwk,s.hostEncPubJwk)?e:null},h1=s=>[...s].sort((e,t)=>{const i=(e.priority??100)-(t.priority??100);if(i!==0)return i;const a=r=>r.type==="relay"?2:r.url.startsWith("https://")?0:1;return a(e)-a(t)}).flatMap(e=>{if(e.type==="relay"){const t=fr({relayUrl:e.relayUrl,serverId:e.serverId,hostEncPubJwk:e.hostEncPubJwk});return t?[{kind:"relay",relay:t}]:[]}return ur(e.url)}),bo=async(s,e)=>{let t=false;const i=Fs({candidates:s})?.serverId??null;for(const a of s){if(a.kind==="relay"){const u=il(a.relay);if(u){const g=await mn(u,"/health",void 0,dr);if(Ge("establish:relay:health",{shared:true,ok:g.response?.ok===true,status:g.response?.status??null,error:g.failure}),g.response?.ok)return{kind:"relay",relay:a.relay,tunnel:u,owned:false}}const c=Yo(a.relay),{response:f,failure:y}=await Ha(c,"/health",void 0,gn);if(Ge("establish:relay:health",{shared:false,ok:f?.ok===true,status:f?.status??null,error:y}),f?.ok)return{kind:"relay",relay:a.relay,tunnel:c,owned:true};t||=ni(c.getStatus()),c.close();continue}const r=zs(a.url)||a.url,l=Bs(r,e),o=await Ys(`${r}/health`,{method:"GET",headers:l,redirect:Object.keys(l).length?"error":void 0});if(Ge("establish:direct:health",{ok:o?.ok===true,status:o?.status??null}),!o?.ok)continue;const d=await Ya(o);if(i&&d&&d!==i){Ge("establish:server-id-mismatch",{url:r});continue}return{kind:"direct",url:r,serverId:d}}return t?"relay-limit":null},g1=async(s,e)=>{if(!dn())return await m1(s,e)?"valid":"invalid";const t=await Zn(e?.fast?Qn:gn,qo("/auth/session").then(a=>a).catch(()=>null));if(!t)return ni(Jo()?.getStatus())?"relay-limit":"valid";if(t.status===401)return"invalid";if(!t.ok&&t.status!==404)return"valid";const i=await ci(t);return i&&i.disabled!==true&&i.authenticated===false?"invalid":"valid"},b1=s=>s.kind==="relay"?dn():!dn()&&Ua(s.url,ps()),rl=()=>{const s=xn();return s?Ws().find(e=>Gt(e)===s)??null:null},qi=s=>{const e=xn();return!!e&&Gt(s)===e},Jn=async s=>{const e=s?.fast!==false,t=rl();if(!t)return Ge("reprobe:no-connection",{runtimeKey:!!xn()}),"no-connection";let i;if(Tt()?i=t.hasToken?await Mn(Gt(t)):void 0:i=t.clientToken,!i&&t.hasToken)return Ge("reprobe:no-token",{hasToken:true}),"unreachable";Ge("reprobe:start",{candidates:t.candidates.map(f=>f.kind),fast:e,hasToken:!!i});const a=t.candidates.findIndex(f=>b1(f.kind==="relay"?{kind:"relay",relay:f.relay}:{kind:"direct",url:f.url})),r=a>=0?t.candidates.slice(0,a):t.candidates;let l;try{l=await ui(t)}catch{return"unreachable"}const o=await ti(r,i,{fast:e,requestHeaders:l});if(Ge("reprobe:better",{status:o.status,probed:r.length}),o.status==="ok"){try{await ei({id:t.id,label:t.label,candidates:t.candidates})}catch{return o.transport.kind==="relay"&&bn(o.transport.tunnel),"unreachable"}return Os(o.transport,i??null,{runtimeKey:Gt(t),requestHeaders:l}),"switched"}if(o.status==="needs-login")return"needs-login";let d=null;if(a>=0&&(d=await g1({url:ps(),clientToken:i,requestHeaders:l},{fast:e}),Ge("reprobe:current",{current:d}),d==="valid"))return ol(),"unchanged";const u=a>=0?t.candidates.slice(a+1):[],c=await ti(u,i,{fast:e,requestHeaders:l});if(Ge("reprobe:fallback",{status:c.status,probed:u.length}),c.status==="ok"){try{await ei({id:t.id,label:t.label,candidates:t.candidates})}catch{return c.transport.kind==="relay"&&bn(c.transport.tunnel),"unreachable"}return Os(c.transport,i??null,{runtimeKey:Gt(t),requestHeaders:l}),"switched"}return c.status==="needs-login"?"needs-login":[o.status,c.status,d].includes("relay-limit")?"relay-limit":"unreachable"},y1=5e3;let Ci=false;const x1=async()=>{if(Ci)return"skipped";const s=rl();if(!s)return Ge("candidates:refresh-skip",{reason:"no-active-connection"}),"skipped";const e=Fs(s);if(!e)return Ge("candidates:refresh-skip",{reason:"no-relay-candidate"}),"skipped";Ci=true;try{const t=await Zn(gn,qo("/api/client-auth/connection/candidates").then(u=>u).catch(()=>null));if(!t?.ok)return Ge("candidates:refresh-skip",{reason:"fetch-failed",status:t?.status??null}),"skipped";const i=await t.json().catch(()=>null);if(!i||i.serverId!==e.serverId)return Ge("candidates:refresh-skip",{reason:"server-id-mismatch"}),"skipped";const a=Array.isArray(i.candidates)?i.candidates:[],r=[];for(const u of a){if(!u||typeof u!="object")continue;const c=u;if(!(c.type!=="lan"||typeof c.url!="string"))try{const f=zs(c.url);f&&!r.includes(f)&&r.push(f)}catch{}}if(r.length===0)return Ge("candidates:refresh-skip",{reason:"no-lan-reported"}),"skipped";const l=On(s).filter(u=>u.url.startsWith("https://")),o=[...r.map(u=>({kind:"direct",url:u})),...l,{kind:"relay",relay:e}];return JSON.stringify(s.candidates.map(Ui))===JSON.stringify(o.map(Ui))?"unchanged":(Ge("candidates:refreshed",{lanCount:r.length}),await ei({id:s.id,label:s.label,candidates:o}),"updated")}finally{Ci=false}},ol=()=>{typeof window>"u"||window.setTimeout(()=>{(async()=>{const s=await x1().catch(()=>"skipped");Ge("candidates:refresh-result",{result:s}),s==="updated"&&dn()&&await Jn().catch(()=>null)})()},y1)},v1=s=>{const{t:e}=be(),[t,i]=p.useState(()=>Ws()),[a,r]=p.useState(null),[l,o]=p.useState(null),[d,u]=p.useState(null),c=p.useRef(t),f=p.useRef(null),y=p.useRef(qh()),g=p.useCallback(j=>{c.current=j,i(j)},[]),m=p.useCallback(j=>{f.current=j,r(j)},[]),h=p.useCallback(j=>{f.current===j&&(f.current=null,r(null))},[]);p.useEffect(()=>{let j=false;return l1().then(C=>{j||g(C)}),()=>{j=true}},[g]);const b=p.useCallback(async j=>{const C=await el(j);return g(C),C},[g]),v=p.useCallback(async j=>{o(null),m("connect");let C;try{const k=mo(j);if(k.length===0){o(e("mobile.connect.error.urlRequired"));return}const I=j.id?c.current.find(H=>H.id===j.id):c.current.find(H=>qa(H.candidates,k)),E=j.label?.trim()||I?.label||qn(Ms({candidates:k})),z=await ho(j,k,I),P=j.requestHeaders===void 0?void 0:z??null,B=j.relayGrant,$=Gt({candidates:k,serverId:I?.serverId});let _=j.clientToken?.trim()||void 0;const D=!!_;_||(Tt()?I?.hasToken&&(_=await Mn($)):_=I?.clientToken),Ge("connect:start",{candidates:k.map(H=>H.kind),hasToken:!!_});const M=await ti(k,_,{requestHeaders:z});if(M.status==="ok"&&M.transport.kind==="relay"&&(C=M.transport.tunnel),Ge("connect:probe",{status:M.status}),M.status==="unreachable"){o(e("mobile.connect.error.unreachable"));return}if(M.status==="relay-limit"){o(e("mobile.connect.error.relayLimit"));return}if(M.status==="needs-login"){const H=await b({id:I?.id,label:E,candidates:k,requestHeaders:P});u({id:H[0].id,label:E,candidates:k,serverId:I?.serverId,relay:Fs({candidates:k})??void 0,relayGrant:B,requestHeaders:z});return}_&&D&&Tt()&&await Us($,_),await b({id:I?.id,label:E,candidates:k,clientToken:_,requestHeaders:P}),Os(M.transport,_??null,{runtimeKey:$,grant:B,requestHeaders:z}),C=void 0,s()}catch(k){console.warn("[mobile-connect] connect threw",k),o(e(k instanceof Xs?"mobile.connect.headers.error":"mobile.connect.error.invalidUrl"))}finally{bn(C),h("connect")}},[m,h,s,b,e]),S=p.useCallback(async j=>{if(f.current==="pairing")return;o(null),m("pairing");const C=h1(j.candidates);let k=null,I=false;try{const E=await bo(C);if(!E||E==="relay-limit"){o(e(E?"mobile.connect.error.relayLimit":"mobile.connect.error.unreachable"));return}k=E;const z=JSON.stringify({pairingId:j.pairingId,secret:j.secret,clientLabel:"OpenChamber Mobile",clientKind:"mobile",deviceName:"OpenChamber Mobile",devicePlatform:co(),dedupeKey:lo()}),P={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:z},B=k.kind==="relay"?await mn(k.tunnel,"/api/client-auth/pairing/redeem",P,gn):{response:await Ys(`${k.url}/api/client-auth/pairing/redeem`,P),failure:null},$=B.response;if(Ge("pairing:redeem",{transport:k.kind,ok:$?.ok===true,status:$?.status??null,error:B.failure}),!$?.ok){o(e("mobile.connect.error.authRequired"));return}const _=await $.json().catch(()=>null),D=typeof _?.clientToken=="string"?_.clientToken.trim():"";if(!D){o(e("mobile.connect.error.authRequired"));return}const M=typeof _?.server?.label=="string"?_.server.label:"",H=j.label||M||qn(Ms({candidates:C})),A=k.kind==="direct"?k.serverId:void 0,F=Gt({candidates:C,serverId:A});if(Tt()&&!await Us(F,D)){o(e("mobile.connect.error.authRequired"));return}await b({label:H,candidates:C,serverId:A,clientToken:D}),Os(k.kind==="relay"?{kind:"relay",relay:k.relay,tunnel:{client:k.tunnel,owned:k.owned}}:{kind:"direct",url:k.url},D,{runtimeKey:F}),I=k.kind==="relay",s()}catch(E){console.warn("[mobile-connect] pairing threw",E),o(e("mobile.connect.error.authRequired"))}finally{go(k,I),h("pairing")}},[m,h,s,b,e]),w=p.useCallback(async j=>{if(!d||!j.trim()||f.current==="password")return;o(null),m("password");const C=y.current.begin(),k=()=>y.current.isCurrent(C),{id:I,label:E,candidates:z,serverId:P,requestHeaders:B}=d,$=Gt({candidates:z,serverId:P});let _=null,D=false;try{const M=await bo(z,B);if(M!=="relay-limit"&&(_=M),!k())return;if(!_){o(e(M==="relay-limit"?"mobile.connect.error.relayLimit":"mobile.connect.error.unreachable"));return}const H={};_.kind==="direct"&&Object.assign(H,Bs(_.url,B));const A=Object.keys(H).length?"error":void 0;H["Content-Type"]="application/json",H.Accept="application/json";const F={method:"POST",credentials:"include",headers:H,redirect:A,body:JSON.stringify({password:j,trustDevice:true,issueClientToken:true,clientLabel:"OpenChamber Mobile",clientKind:"mobile",devicePlatform:co(),dedupeKey:lo()})};Ge("password:start",{transport:_.kind});const O=_.kind==="relay"?await mn(_.tunnel,"/auth/session",F,gn):{response:await Ys(`${_.url}/auth/session`,F),failure:null},K=O.response;if(!k())return;if(Ge("password:done",{ok:K?.ok===true,status:K?.status??null,error:O.failure}),!K?.ok){o(e("mobile.connect.error.passwordFailed"));return}const L=await K.json().catch(()=>null);if(!k())return;const V=typeof L?.clientToken=="string"?L.clientToken.trim():"";if(Ge("password:token",{issued:!!V}),!V){if(_.kind==="direct"&&!Tt()){if(await b({id:I,label:E,candidates:z}),!k())return;u(null),Os({kind:"direct",url:_.url},null,{runtimeKey:$,requestHeaders:B}),s();return}o(e("mobile.connect.error.authRequired"));return}if(Tt()&&(!k()||(await Us($,V),!k()))||!k()||(await b({id:I,label:E,candidates:z,clientToken:V}),!k())||(u(null),Os(_.kind==="relay"?{kind:"relay",relay:_.relay,tunnel:{client:_.tunnel,owned:_.owned}}:{kind:"direct",url:_.url},V,{runtimeKey:$,requestHeaders:B}),D=_.kind==="relay",!k()))return;s()}catch(M){if(!k())return;console.warn("[mobile-connect] password threw",M),o(e(M instanceof Xs?"mobile.connect.headers.error":"mobile.connect.error.passwordFailed"))}finally{go(_,D),k()&&h("password")}},[m,h,s,d,b,e]),N=p.useCallback(()=>{y.current.cancel(),h("password"),u(null),o(null)},[h]),R=p.useCallback(async j=>{o(null);let C=mo(j);const k=j.id?c.current.find(P=>P.id===j.id)??null:null;if(k){const P=C.filter(_=>_.kind==="direct"),B=On(k).filter(_=>_.url.startsWith("https://")&&!P.some(D=>Ua(D.url,_.url))),$=Fs(k);C=[...P,...B,...$?[{kind:"relay",relay:$}]:[]]}if(C.length===0)return o(e("mobile.connect.error.urlRequired")),null;const I=j.clientToken?.trim()||void 0,E=On({candidates:C}).length===0&&k?k.label:qn(Ms({candidates:C})),z=j.label?.trim()||E;if(Tt()){const P=Gt({candidates:C,serverId:k?.serverId});if(I)await Us(P,I);else if(k?.hasToken){const B=Gt(k);if(B&&P&&B!==P){const $=await Mn(B);$&&await Us(P,$)}}}try{const P=j.requestHeaders===void 0?void 0:await ho(j,C,k??void 0)??null,B=await b({id:j.id,label:z,candidates:C,clientToken:I,requestHeaders:P});return k&&qi(k)&&!dn()&&j.requestHeaders!==void 0&&Os({kind:"direct",url:ps()},Wl()||null,{runtimeKey:xn(),requestHeaders:P??void 0}),B[0]??null}catch{return o(e("mobile.connect.headers.error")),null}},[b,e]),T=p.useCallback(async j=>{const C=c.current.find(k=>k.id===j)??null;try{const k=await c1(j);return g(k),C}catch{return o(e("mobile.connect.headers.error")),null}},[g,e]);return{connections:t,isBusy:a!==null,isPasswordBusy:a==="password",error:l,pendingConnection:d,connect:v,redeemPairingConnection:S,submitPassword:w,cancelPassword:N,saveConnection:R,removeConnection:T,setError:o}},al=()=>{if(typeof window>"u")return null;const e=window.Capacitor?.Plugins?.BarcodeScanner;return e&&(typeof e.scan=="function"||typeof e.startScan=="function")?e:null},ll=()=>window.Capacitor?.getPlatform?.()==="android",w1=()=>ll(),cl=s=>{const e=s.trim();if(!e)return null;if(/^openchamber:\/\//i.test(e)){const t=$l(e)??Kl(e);return t?{pairing:t}:null}return/^https?:\/\//i.test(e)?{url:e}:null},dl=s=>{const e=cl(s);return e?"pairing"in e?{status:"pairing",...e}:{status:"ok",...e}:{status:"invalid"}},S1=async(s,e)=>{if(!s.startScan||!s.stopScan||!s.addListener)return{status:"unsupported"};if(e?.aborted)return{status:"cancelled"};let t,i,a=false,r=()=>{};const l=new Promise(u=>{r=u}),o=u=>{a||(a=true,r(u))},d=()=>o({status:"cancelled"});e?.addEventListener("abort",d,{once:true});try{return(await Promise.allSettled([Promise.resolve(s.addListener("barcodesScanned",({barcodes:c})=>{const f=c?.[0],y=(f?.rawValue??f?.displayValue??"").trim();y&&o(dl(y))})).then(c=>{t=c}),Promise.resolve(s.addListener("scanError",()=>o({status:"failed"}))).then(c=>{i=c})])).some(({status:c})=>c==="rejected")?o({status:"failed"}):a||s.startScan({formats:["QR_CODE"]}).catch(()=>o({status:"failed"})),await l}finally{e?.removeEventListener("abort",d),await Promise.allSettled([Promise.resolve(t?.remove()),Promise.resolve(i?.remove()),s.stopScan()])}},j1=()=>al()!==null,k1=async s=>{const e=al();if(!e)return{status:"unsupported"};try{if(e.requestPermissions){const l=(await e.requestPermissions())?.camera;if(l&&l!=="granted"&&l!=="limited")return{status:"permission-denied"}}if(s?.signal?.aborted)return{status:"cancelled"};if(ll())return S1(e,s?.signal);if(!e.scan)return{status:"unsupported"};const i=(await e.scan({formats:["QR_CODE"]}))?.barcodes?.[0],a=(i?.rawValue??i?.displayValue??"").trim();return a?dl(a):{status:"cancelled"}}catch{return{status:"failed"}}},C1=s=>{const e=oe.c(23),{onCancel:t}=s,{t:i}=be(),a=p.useRef(null);let r,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{const v={value:document.documentElement.style.getPropertyValue("background-color"),priority:document.documentElement.style.getPropertyPriority("background-color")},S={value:document.body.style.getPropertyValue("background-color"),priority:document.body.style.getPropertyPriority("background-color")};document.documentElement.style.setProperty("background-color","rgba(0, 0, 0, 0)","important"),document.body.style.setProperty("background-color","rgba(0, 0, 0, 0)","important");const w=new Map,N=T=>{!(T instanceof HTMLElement)||T===a.current||w.has(T)||(w.set(T,{opacity:T.style.opacity,pointerEvents:T.style.pointerEvents}),T.style.setProperty("opacity","0"),T.style.setProperty("pointer-events","none"))};Array.from(document.body.children).forEach(N);const R=new MutationObserver(T=>{T.forEach(j=>j.addedNodes.forEach(N))});return R.observe(document.body,{childList:true}),()=>{R.disconnect(),w.forEach(R1),v.value?document.documentElement.style.setProperty("background-color",v.value,v.priority):document.documentElement.style.removeProperty("background-color"),S.value?document.body.style.setProperty("background-color",S.value,S.priority):document.body.style.removeProperty("background-color")}},l=[],e[0]=r,e[1]=l):(r=e[0],l=e[1]),p.useLayoutEffect(r,l);let o,d;if(e[2]!==t?(o=()=>{const v=()=>{document.visibilityState==="hidden"&&t()};return document.addEventListener("visibilitychange",v),()=>document.removeEventListener("visibilitychange",v)},d=[t],e[2]=t,e[3]=o,e[4]=d):(o=e[3],d=e[4]),p.useEffect(o,d),!w1()){let v;return e[5]===Symbol.for("react.memo_cache_sentinel")?(v=cn.createPortal(n.jsx("div",{ref:a,className:"fixed inset-0 z-[1000] bg-background","aria-hidden":true}),document.body),e[5]=v):v=e[5],v}let u;e[6]!==i?(u=i("mobile.connect.scanQr"),e[6]=i,e[7]=u):u=e[7];let c;e[8]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx("div",{className:"aspect-square w-full max-w-72 rounded-[28px] border-2 border-foreground/90 shadow-[0_0_0_9999px_color-mix(in_srgb,var(--surface-background)_18%,transparent)]","aria-hidden":true}),e[8]=c):c=e[8];let f;e[9]!==i?(f=i("mobile.connect.welcome.scanHint"),e[9]=i,e[10]=f):f=e[10];let y;e[11]!==f?(y=n.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-6",children:[c,n.jsx("p",{className:"max-w-sm rounded-[16px] border border-edge bg-background px-4 py-3 text-center typography-markdown text-foreground shadow-sm",children:f})]}),e[11]=f,e[12]=y):y=e[12];let g;e[13]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(X,{name:"close",className:"size-[18px]"}),e[13]=g):g=e[13];let m;e[14]!==i?(m=i("mobile.instances.cancelEdit"),e[14]=i,e[15]=m):m=e[15];let h;e[16]!==t||e[17]!==m?(h=n.jsxs(ze,{type:"button",variant:"outline",size:"lg",className:"mx-auto min-h-12 w-full max-w-sm bg-background",onClick:t,children:[g,m]}),e[16]=t,e[17]=m,e[18]=h):h=e[18];let b;return e[19]!==h||e[20]!==u||e[21]!==y?(b=cn.createPortal(n.jsxs("div",{ref:a,role:"dialog","aria-modal":"true","aria-label":u,className:"fixed inset-0 z-[1000] flex flex-col bg-transparent px-6 pb-[calc(var(--safe-area-inset-bottom,env(safe-area-inset-bottom,0px))+24px)] pt-[calc(var(--safe-area-inset-top,env(safe-area-inset-top,0px))+24px)] text-foreground",children:[y,h]}),document.body),e[19]=h,e[20]=u,e[21]=y,e[22]=b):b=e[22],b},N1=()=>{const s=oe.c(6),{t:e}=be();let t;s[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx(sn,{width:96,height:96,isAnimated:true}),s[0]=t):t=s[0];let i;s[1]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(X,{name:"loader-4",className:"size-[18px] animate-spin"}),s[1]=i):i=s[1];let a;s[2]!==e?(a=e("mobile.connect.connecting"),s[2]=e,s[3]=a):a=s[3];let r;return s[4]!==a?(r=cn.createPortal(n.jsxs("div",{role:"status",className:"fixed inset-0 z-[1000] flex flex-col items-center justify-center gap-5 bg-background px-6 text-foreground",children:[t,n.jsxs("div",{className:"flex items-center gap-2 typography-ui-label text-muted-foreground",children:[i,n.jsx("span",{children:a})]})]}),document.body),s[4]=a,s[5]=r):r=s[5],r};function R1(s,e){e.style.opacity=s.opacity,e.style.pointerEvents=s.pointerEvents}const Vn=s=>!s.candidates.some(e=>e.kind==="direct"),I1=s=>s.some(({name:e,value:t})=>e.trim()||t.trim()),ul=s=>{const{mode:e,onConnected:t}=s,{t:i}=be(),a=v1(t),{connections:r,isBusy:l,isPasswordBusy:o,error:d,pendingConnection:u,connect:c,submitPassword:f,cancelPassword:y,saveConnection:g,removeConnection:m,setError:h}=a,[b,v]=p.useState(null),[S,w]=p.useState(""),[N,R]=p.useState(""),[T,j]=p.useState(""),[C,k]=p.useState([]),[I,E]=p.useState(false),z=p.useRef(0),[P,B]=p.useState(null),[$,_]=p.useState(false),D=P?r.find(ee=>ee.id===P)??null:null,M=b?.kind==="edit"?r.find(ee=>ee.id===b.id)??null:null,H=M?Vn(M):false,[A,F]=p.useState(null),[O,K]=p.useState(""),[L,V]=p.useState(false),J=mc(L),[G,q]=p.useState(false),U=p.useRef(null),Z=p.useMemo(()=>j1(),[]),[te,se]=p.useState(false),ie=Lh(p.useCallback(()=>se(true),[])),ne=p.useCallback(()=>{z.current+=1,v(null),w(""),R(""),j(""),k([]),h(null)},[h]),ue=()=>{z.current+=1,h(null),v({kind:"add"})},Q=ee=>{const ge=++z.current;B(null),o1(ee.id).then(st=>{ge===z.current&&(v({kind:"edit",id:ee.id}),w(Vn(ee)?"":st?.url||Ms(ee)),R(ee.label),j(ee.clientToken||""),k(zh(st?.values)),h(null))}).catch(()=>{ge===z.current&&h(i("mobile.connect.headers.error"))})},re=ee=>{if(e==="welcome"&&/^openchamber:\/\//i.test(ee.trim())){const ge=cl(ee);if(ge){if("pairing"in ge){a.redeemPairingConnection(ge.pairing);return}w(ge.url),ge.label&&R(ge.label),ge.clientToken&&j(ge.clientToken);return}}w(ee)},le=ee=>{if(ee.preventDefault(),e==="welcome"&&b?.kind==="add"){c({url:S,clientToken:T,label:N,requestHeaders:I1(C)?Vi(C):void 0});return}I||(E(true),g({id:M?.id,url:S,label:N,clientToken:T,requestHeaders:H?void 0:Vi(C)}).then(ge=>{ge&&ne()}).finally(()=>E(false)))},Ne=async()=>{if(U.current||l)return;h(null),V(true);const ee=new AbortController;U.current=ee;try{const ge=await k1({signal:ee.signal});switch(U.current===ee&&(U.current=null,V(false)),ge.status){case"ok":w(ge.url),ge.label&&R(ge.label),ge.clientToken&&j(ge.clientToken),e==="welcome"?(q(true),await c({url:ge.url,clientToken:ge.clientToken,label:ge.label})):v({kind:"add"});break;case"pairing":q(true),await a.redeemPairingConnection(ge.pairing);break;case"permission-denied":h(i("mobile.connect.scan.permissionDenied"));break;case"invalid":h(i("mobile.connect.scan.invalid"));break;case"unsupported":h(i("mobile.connect.scan.unsupported"));break;case"failed":h(i("mobile.connect.scan.failed"));break;default:break}}finally{q(false),U.current===ee&&(U.current=null,V(false))}};p.useEffect(()=>()=>{U.current?.abort(),z.current+=1},[]);const Le=ee=>{F(ee.id),c({id:ee.id,candidates:ee.candidates,clientToken:ee.clientToken,label:ee.label}).finally(()=>F(null))},we=()=>{B(null),_(false)},Re=ee=>{z.current+=1,we(),b?.kind==="edit"&&b.id===ee&&ne();const ge=r.length===1;m(ee).then(st=>{!st||e!=="instances"||(ge||qi(st))&&s.onActiveConnectionDeleted()})},ae=e==="instances"?r.find(qi)??null:null,ce=ae??r[0]??null,Ee=r.filter(ee=>ee!==ce),Ie=ee=>Vn(ee)?i("mobile.connect.relay.badge"):Ms(ee),ke=(ee,ge)=>n.jsx("button",{type:"button","aria-label":i("mobile.instances.actionsAria",{label:ee.label}),className:de("flex size-9 shrink-0 items-center justify-center rounded-full text-muted-foreground touch-manipulation focus:outline-none active:bg-interactive-hover",ge),onClick:()=>B(ee.id),children:n.jsx(X,{name:"more",className:"size-4"})}),Oe=e==="welcome"&&s.notice?n.jsxs("div",{role:"status",className:"flex items-center gap-2.5 rounded-lg bg-[var(--status-warning-background)] px-3 py-2.5",children:[n.jsx(X,{name:s.notice.kind==="auth-expired"?"lock":"cloud-off",className:"size-4 shrink-0 text-[var(--status-warning)]"}),n.jsx("p",{className:"min-w-0 flex-1 typography-meta text-foreground",children:s.notice.kind==="auth-expired"?i("mobile.connect.notice.authExpired",{label:s.notice.label}):s.notice.kind==="relay-limit"?i("mobile.connect.notice.relayLimit",{label:s.notice.label}):i("mobile.connect.notice.unreachable",{label:s.notice.label})})]}):null,Fe=d&&!b?n.jsx("p",{className:"px-1 text-center typography-meta text-[var(--status-error-text)]",children:d}):null,ut=ee=>n.jsx("span",{...ie,className:"inline-flex select-none",style:{touchAction:"manipulation"},children:n.jsx(sn,{width:ee,height:ee})}),Ke=n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[n.jsxs("div",{className:"flex flex-col gap-3 px-2 pt-[10vh]",children:[ut(44),n.jsx("h1",{className:"text-balance text-3xl font-normal tracking-tight text-foreground",children:i("mobile.connect.firstRun.title")}),n.jsx("p",{className:"typography-ui-label text-muted-foreground",children:i("mobile.connect.firstRun.description")})]}),n.jsxs("div",{className:"mt-auto flex flex-col gap-3 pt-6",children:[Oe,Fe,n.jsxs("div",{className:de("grid gap-2",Z&&"grid-cols-2"),children:[Z?n.jsxs("button",{type:"button",disabled:L||l,className:"oc-tile flex flex-col gap-6 rounded-xl p-3.5 text-start touch-manipulation focus:outline-none active:bg-interactive-hover disabled:opacity-60",onClick:()=>{Ne()},children:[n.jsx(X,{name:"scan-2",className:de("size-5 text-muted-foreground",J)}),n.jsxs("span",{className:"flex flex-col",children:[n.jsx("span",{className:"typography-ui-label font-medium text-foreground",children:i(l?"mobile.connect.connecting":"mobile.connect.scanQr")}),n.jsx("span",{className:"typography-micro text-muted-foreground",children:i("mobile.connect.firstRun.scanHint")})]})]}):null,n.jsxs("button",{type:"button",className:"oc-tile flex flex-col gap-6 rounded-xl p-3.5 text-start touch-manipulation focus:outline-none active:bg-interactive-hover",onClick:ue,children:[n.jsx(X,{name:"link",className:"size-5 text-muted-foreground"}),n.jsxs("span",{className:"flex flex-col",children:[n.jsx("span",{className:"typography-ui-label font-medium text-foreground",children:i("mobile.connect.manual.toggle")}),n.jsx("span",{className:"typography-micro text-muted-foreground",children:i("mobile.connect.firstRun.addressHint")})]})]})]})]})]}),Be=ce?n.jsxs("section",{...e==="instances"?ie:null,"aria-label":ce.label,className:"oc-tile relative flex flex-col rounded-xl p-4",children:[ke(ce,"absolute top-1.5 inset-e-1.5"),ae?null:n.jsx("span",{className:"pb-1 typography-micro text-muted-foreground",children:i("mobile.connect.lastConnected")}),n.jsx("h2",{dir:"auto",className:"oc-ui-start-align truncate pe-8 typography-ui-header font-semibold text-foreground",children:ce.label}),n.jsx("p",{dir:"ltr",className:"oc-ui-start-align truncate pe-8 typography-meta text-muted-foreground",children:Ie(ce)}),n.jsx("div",{className:"flex h-9 items-center pt-3",children:ae?n.jsxs("span",{className:"flex items-center gap-2 typography-meta text-foreground",children:[n.jsx("span",{className:"size-1.5 rounded-full bg-[var(--status-success)]","aria-hidden":true}),dn()?i("mobile.instances.status.connectedRelay"):i("mobile.instances.status.connectedDirect")]}):n.jsxs(ze,{type:"button",disabled:l,onClick:()=>Le(ce),children:[A===ce.id?n.jsx(X,{name:"loader-4",className:"size-4 animate-spin"}):null,A===ce.id?i("mobile.connect.connecting"):i("mobile.connect.connectButton")]})})]}):null,He=Ee.length>0?n.jsx(pc,{title:i("mobile.connect.saved.other"),children:Ee.map(ee=>{const ge=A===ee.id;return n.jsx(wi,{disabled:l,meta:ge?n.jsx(X,{name:"loader-4",className:"size-4 animate-spin"}):void 0,action:ke(ee),onClick:()=>Le(ee),children:n.jsxs("span",{className:"block py-1.5",children:[n.jsx("span",{dir:"auto",className:"oc-ui-start-align block truncate",children:ee.label}),n.jsx("span",{className:"block truncate typography-micro font-normal text-muted-foreground",children:ge?i("mobile.connect.connecting"):Ie(ee)})]})},ee.id)})}):null,Je=n.jsxs("div",{className:"flex shrink-0 flex-col items-center gap-1 pt-3",children:[Fe,Z?n.jsxs(n.Fragment,{children:[n.jsxs(ze,{type:"button",variant:"outline",disabled:L||l,onClick:()=>{Ne()},children:[n.jsx(X,{name:"scan-2",className:de("size-4",J)}),i("mobile.connect.scanQr")]}),n.jsx("button",{type:"button",className:"min-h-9 px-2 typography-meta text-muted-foreground touch-manipulation focus:outline-none active:text-foreground",onClick:ue,children:i(e==="welcome"?"mobile.connect.manual.toggle":"mobile.instances.addManual")})]}):n.jsxs(ze,{type:"button",variant:"outline",onClick:ue,children:[n.jsx(X,{name:"link",className:"size-4"}),i(e==="welcome"?"mobile.connect.manual.toggle":"mobile.instances.addManual")]})]}),it=(u?n.jsxs("form",{className:"flex w-full flex-col gap-3",onSubmit:ee=>{ee.preventDefault(),f(O)},children:[n.jsxs("div",{className:"oc-tile rounded-xl p-4",children:[n.jsx("p",{dir:"auto",className:"oc-ui-start-align truncate typography-ui-header font-semibold text-foreground",children:u.label}),n.jsx("p",{className:"truncate typography-meta text-muted-foreground",children:Vn(u)?i("mobile.connect.relay.badge"):Ms(u)})]}),n.jsx("input",{..._n,value:O,onChange:ee=>K(ee.target.value),placeholder:i("mobile.connect.password.placeholder"),"aria-label":i("mobile.connect.password.label"),type:"password",autoFocus:true,className:on}),d?n.jsx("p",{className:"px-1 typography-meta text-[var(--status-error-text)]",children:d}):null,n.jsxs("div",{className:"flex items-center justify-end gap-2",children:[n.jsx(ze,{type:"button",variant:"ghost",onClick:()=>{K(""),y()},children:i("mobile.connect.cancelPassword")}),n.jsx(ze,{type:"submit",disabled:o||!O.trim(),children:i(o?"mobile.connect.connecting":"mobile.connect.unlockButton")})]})]}):null)??(ce?n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-3",children:[Oe,Be,n.jsx("div",{className:"mt-auto",children:He})]}):Ke),tt=n.jsxs(n.Fragment,{children:[L?n.jsx(C1,{onCancel:()=>U.current?.abort()}):null,G?n.jsx(N1,{}):null,te?n.jsx(Bh,{onClose:()=>se(false)}):null,n.jsx(Yn,{open:D!==null,title:D?.label??"",onClose:we,children:D?n.jsxs(n.Fragment,{children:[n.jsx(wi,{icon:"edit",disabled:I,onClick:()=>Q(D),children:i("mobile.instances.edit")}),n.jsx(wi,{icon:"delete-bin",destructive:true,disabled:I,onClick:()=>{$?Re(D.id):_(true)},children:$?i("mobile.instances.confirmDeleteAria",{label:D.label}):i("mobile.instances.delete")})]}):null}),n.jsx(Yn,{open:b!==null&&!u,title:b?.kind==="edit"?i("mobile.instances.editTitle"):i(e==="welcome"?"mobile.connect.manual.toggle":"mobile.instances.addTitle"),onClose:ne,children:n.jsxs("form",{className:"flex flex-col gap-3 px-1 pb-1",onSubmit:le,children:[H?null:n.jsxs("label",{className:"flex flex-col gap-1.5",children:[n.jsx("span",{className:"px-1 typography-meta text-muted-foreground",children:i("mobile.connect.url.label")}),n.jsx("input",{..._n,value:S,onChange:ee=>re(ee.target.value),placeholder:i("mobile.connect.url.placeholder"),type:"url",inputMode:"url",autoCapitalize:"none",className:on})]}),n.jsxs("label",{className:"flex flex-col gap-1.5",children:[n.jsx("span",{className:"px-1 typography-meta text-muted-foreground",children:i("mobile.instances.label.label")}),n.jsx("input",{value:N,onChange:ee=>R(ee.target.value),placeholder:i("mobile.instances.label.placeholder"),autoComplete:"off",autoCapitalize:"words",autoCorrect:"off",spellCheck:false,className:on})]}),H?null:n.jsxs("label",{className:"flex flex-col gap-1.5",children:[n.jsx("span",{className:"px-1 typography-meta text-muted-foreground",children:i("mobile.connect.token.label")}),n.jsx("input",{..._n,value:T,onChange:ee=>j(ee.target.value),placeholder:i("mobile.connect.token.placeholder"),autoCapitalize:"none",className:on}),n.jsx("span",{className:"px-1 typography-micro text-muted-foreground",children:i("mobile.connect.token.hint")})]}),H?null:n.jsx(Wh,{value:C,onChange:k,disabled:I||l}),d?n.jsx("p",{className:"px-1 typography-meta text-[var(--status-error-text)]",children:d}):null,n.jsx("div",{className:"flex justify-end",children:e==="welcome"&&b?.kind==="add"?n.jsx(ze,{type:"submit",disabled:l||L||!S.trim(),children:i(l?"mobile.connect.connecting":"mobile.connect.connectButton")}):n.jsx(ze,{type:"submit",disabled:I,children:i(M?"mobile.instances.saveEdit":"mobile.instances.saveNew")})})]})})]});return e==="instances"?n.jsxs(n.Fragment,{children:[tt,n.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[n.jsx(bs,{outerClassName:"min-h-0 flex-1",className:"flex min-h-full flex-col px-3 py-3",disableHorizontal:true,children:it}),u||!ce?null:n.jsx("div",{className:"px-3 pb-3",children:Je})]})]}):n.jsxs(n.Fragment,{children:[tt,n.jsx("main",{className:"oc-keyboard-fill-screen flex min-h-dvh flex-col overflow-y-auto bg-background pb-[calc(var(--safe-area-inset-bottom,env(safe-area-inset-bottom,0px))+16px)] pt-[calc(var(--safe-area-inset-top,env(safe-area-inset-top,0px))+16px)] text-foreground",style:{paddingLeft:"calc(var(--oc-safe-area-left, 0px) + 1rem)",paddingRight:"calc(var(--oc-safe-area-right, 0px) + 1rem)"},children:n.jsxs("div",{className:"mx-auto flex w-full max-w-[380px] flex-1 flex-col",children:[ce||u?n.jsxs("header",{className:"flex items-center gap-2 px-1 pb-4 pt-2",children:[ut(24),n.jsx("span",{className:"typography-ui-label font-semibold",children:"OpenChamber"})]}):null,it,u||!ce?null:Je]})})]})},P1=s=>{const e=oe.c(3),{onConnected:t,notice:i}=s,a=i===void 0?null:i;let r;return e[0]!==a||e[1]!==t?(r=n.jsx(ul,{mode:"welcome",onConnected:t,notice:a}),e[0]=a,e[1]=t,e[2]=r):r=e[2],r},E1=s=>{const e=s.usedPercent;return typeof e!="number"||!Number.isFinite(e)?"text-foreground":e>=80?"text-[var(--status-error)]":e>=50?"text-[var(--status-warning)]":"text-foreground"},T1=s=>{const e=oe.c(14),{groups:t,displayMode:i,timeFormatPreference:a,className:r}=s,{t:l}=be();let o;e[0]!==r?(o=de("space-y-1.5",r),e[0]=r,e[1]=o):o=e[1];let d;if(e[2]!==i||e[3]!==t||e[4]!==l||e[5]!==a){let c;e[7]!==i||e[8]!==l||e[9]!==a?(c=f=>n.jsxs("div",{className:"min-w-0 rounded-xl bg-foreground/[0.03] p-2.5",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[n.jsx(hc,{providerId:f.providerId,className:"size-4 shrink-0"}),n.jsx("span",{className:"min-w-0 flex-1 truncate typography-ui-label font-medium text-foreground",children:f.providerName}),f.planLabel?n.jsx("span",{className:"shrink-0 typography-micro capitalize text-muted-foreground",children:f.planLabel}):null,f.accountLabel?n.jsx("span",{className:"min-w-0 truncate typography-micro text-muted-foreground",title:f.accountLabel,children:f.accountLabel}):null,f.status&&f.rows.length===0?n.jsx("span",{className:"shrink-0 truncate typography-micro text-muted-foreground",children:f.status}):null]}),f.rows.length>0?n.jsx("div",{className:"mt-1.5 space-y-1",children:f.rows.map(y=>{const g=i==="remaining"?y.window.remainingPercent:y.window.usedPercent,m=ra(y.window,g,l),h=gc(y.window.resetAt,y.window.resetAfterFormatted??y.window.resetAtFormatted,a);return n.jsxs("div",{className:"flex min-w-0 items-baseline justify-between gap-3",children:[n.jsxs("span",{className:"flex min-w-0 flex-1 items-baseline gap-1.5",children:[n.jsx("span",{className:"shrink-0 truncate typography-ui-label text-muted-foreground",children:y.subtitle?`${y.subtitle} \xB7 ${y.label}`:y.label}),h?n.jsx("span",{className:"min-w-0 truncate typography-micro text-muted-foreground",children:h}):null]}),n.jsx("span",{className:de("shrink-0 typography-ui-label font-semibold tabular-nums",E1(y.window)),children:m==="-"?"":m})]},y.key)})}):null,f.status&&f.rows.length>0?n.jsx("div",{className:"mt-1.5 typography-micro text-muted-foreground",children:f.status}):null]},f.providerId),e[7]=i,e[8]=l,e[9]=a,e[10]=c):c=e[10],d=t.map(c),e[2]=i,e[3]=t,e[4]=l,e[5]=a,e[6]=d}else d=e[6];let u;return e[11]!==o||e[12]!==d?(u=n.jsx("div",{className:o,children:d}),e[11]=o,e[12]=d,e[13]=u):u=e[13],u},yo=380,_1=(s,e)=>{if(!s||typeof s!="object")return;const t=s[e];return typeof t=="number"&&Number.isFinite(t)?t:void 0},Ni=s=>s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:String(s),A1="\u2014",fl=s=>{const e=oe.c(20),{percentage:t}=s;let i,a,r,l,o,d,u;if(e[0]!==t){r=Sc(t??0)??0;const g=oa(t??0);a=g==="critical"?"var(--status-error)":g==="warn"?"var(--status-warning)":"var(--status-success)",i=2*Math.PI*7.5,l="0 0 18 18",o="size-[18px] -rotate-90",d="progressbar",u=t===null?void 0:Math.round(r),e[0]=t,e[1]=i,e[2]=a,e[3]=r,e[4]=l,e[5]=o,e[6]=d,e[7]=u}else i=e[1],a=e[2],r=e[3],l=e[4],o=e[5],d=e[6],u=e[7];let c;e[8]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx("circle",{cx:9,cy:9,r:7.5,fill:"none",stroke:"var(--interactive-border)",strokeWidth:3}),e[8]=c):c=e[8];let f;e[9]!==i||e[10]!==t||e[11]!==a||e[12]!==r?(f=t===null?null:n.jsx("circle",{cx:9,cy:9,r:7.5,fill:"none",stroke:a,strokeWidth:3,strokeLinecap:"round",strokeDasharray:i,strokeDashoffset:i*(1-r/100),className:"transition-[stroke-dashoffset,stroke] duration-300"}),e[9]=i,e[10]=t,e[11]=a,e[12]=r,e[13]=f):f=e[13];let y;return e[14]!==l||e[15]!==o||e[16]!==d||e[17]!==u||e[18]!==f?(y=n.jsxs("svg",{viewBox:l,className:o,role:d,"aria-valuenow":u,"aria-valuemin":0,"aria-valuemax":100,children:[c,f]}),e[14]=l,e[15]=o,e[16]=d,e[17]=u,e[18]=f,e[19]=y):y=e[19],y},D1=s=>{const e=oe.c(13),{icon:t,iconNode:i,label:a,children:r}=s;let l;e[0]!==t||e[1]!==i?(l=i??(t?n.jsx(X,{name:t,className:"size-[18px]"}):null),e[0]=t,e[1]=i,e[2]=l):l=e[2];let o;e[3]!==l?(o=n.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center text-muted-foreground",children:l}),e[3]=l,e[4]=o):o=e[4];let d;e[5]!==a?(d=n.jsx("span",{className:"shrink-0 typography-ui-label text-muted-foreground",children:a}),e[5]=a,e[6]=d):d=e[6];let u;e[7]!==r?(u=n.jsx("span",{className:"min-w-0 flex-1 truncate text-end typography-ui-label font-medium text-foreground",children:r}),e[7]=r,e[8]=u):u=e[8];let c;return e[9]!==o||e[10]!==d||e[11]!==u?(c=n.jsxs("div",{className:"flex min-w-0 items-center gap-3 rounded-xl px-2.5 py-2.5",children:[o,d,u]}),e[9]=o,e[10]=d,e[11]=u,e[12]=c):c=e[12],c},O1=s=>{const e=oe.c(57),{open:t,onClose:i,anchorRef:a,contextDisplay:r,usageGroups:l,usageDisplayMode:o,isUsageLoading:d,timeFormatPreference:u}=s,{t:c}=be(),f=p.useRef(null),[y,g]=p.useState(t),[m,h]=p.useState(false),{enabled:b}=Zi(),v=p.useRef(null),[S,w]=p.useState(null);let N,R;e[0]!==a||e[1]!==b||e[2]!==t||e[3]!==y?(N=()=>{if(!t||!b||!y)return;const q=()=>{const te=a.current?.getBoundingClientRect(),se=v.current?.getBoundingClientRect();if(!te||!se){w(null);return}const ie=te.left-se.left,ne=Math.min(Math.max(ie,8),Math.max(8,se.width-yo-8));w(ne)};q();const U=v.current;if(typeof ResizeObserver>"u"||!U)return;const Z=new ResizeObserver(q);return Z.observe(U),()=>Z.disconnect()},R=[a,b,t,y],e[0]=a,e[1]=b,e[2]=t,e[3]=y,e[4]=N,e[5]=R):(N=e[4],R=e[5]),p.useLayoutEffect(N,R);const T=b&&S!==null;let j,C;e[6]!==t||e[7]!==y?(j=()=>{if(t){g(true),h(false);return}if(!y)return;h(true);const q=window.setTimeout(()=>{g(false),h(false)},140);return()=>window.clearTimeout(q)},C=[t,y],e[6]=t,e[7]=y,e[8]=j,e[9]=C):(j=e[8],C=e[9]),p.useEffect(j,C);let k,I;e[10]!==i||e[11]!==t?(k=()=>{if(!t)return;const q=U=>{U.key==="Escape"&&i()};return document.addEventListener("keydown",q),()=>document.removeEventListener("keydown",q)},I=[i,t],e[10]=i,e[11]=t,e[12]=k,e[13]=I):(k=e[12],I=e[13]),p.useEffect(k,I);let E,z;if(e[14]!==a||e[15]!==i||e[16]!==t?(E=()=>{if(!t)return;const q=U=>{const Z=U.target;if(!(Z instanceof Node)){i();return}f.current?.contains(Z)||a.current?.contains(Z)||i()};return document.addEventListener("pointerdown",q,true),document.addEventListener("wheel",q,true),()=>{document.removeEventListener("pointerdown",q,true),document.removeEventListener("wheel",q,true)}},z=[a,i,t],e[14]=a,e[15]=i,e[16]=t,e[17]=E,e[18]=z):(E=e[17],z=e[18]),p.useEffect(E,z),!y)return null;let P;e[19]!==c?(P=c("mobile.header.openMetadataAria"),e[19]=c,e[20]=P):P=e[20];const B=T?"absolute origin-top-left":"mx-3 mt-2",$=m?"pointer-events-none":"pointer-events-auto";let _;e[21]!==B||e[22]!==$?(_=de("oc-surface-elevated overflow-y-auto overscroll-contain rounded-[20px] border border-edge bg-surface-elevated p-2 shadow-[0_4px_12px_rgb(0_0_0_/_0.08)] will-change-transform",B,$),e[21]=B,e[22]=$,e[23]=_):_=e[23];const D=`${m?"session-metadata-out":"session-metadata-in"} ${m?140:170}ms cubic-bezier(0.32, 0.72, 0, 1) forwards`;let M;e[24]!==S||e[25]!==T?(M=T?{top:8,left:S??8,width:`min(${yo}px, calc(100% - 16px))`}:null,e[24]=S,e[25]=T,e[26]=M):M=e[26];let H;e[27]!==D||e[28]!==M?(H={animation:D,maxHeight:"min(72dvh, calc(100dvh - var(--oc-safe-area-top, 0px) - var(--oc-header-height, 56px) - 1rem))",...M},e[27]=D,e[28]=M,e[29]=H):H=e[29];let A;e[30]!==r||e[31]!==c?(A=r?n.jsx(D1,{iconNode:n.jsx(fl,{percentage:r.state==="measured"?r.percentage:null}),label:c("mobile.header.metadata.context"),children:r.state==="pending"?null:n.jsxs("span",{className:"inline-flex items-baseline gap-1.5 tabular-nums",children:[r.state==="measured"?n.jsxs("span",{className:de("font-semibold",r.colorClass),children:[r.percentage.toFixed(1),"%"]}):null,n.jsx("span",{className:"text-muted-foreground",children:r.tokens})]})}):null,e[30]=r,e[31]=c,e[32]=A):A=e[32];let F;e[33]!==r?.state||e[34]!==c?(F=r?.state==="compacted"?n.jsx("p",{className:"px-2.5 pb-1 typography-meta text-muted-foreground",children:c("contextUsage.compacted.description")}):null,e[33]=r?.state,e[34]=c,e[35]=F):F=e[35];let O;e[36]!==r?.state||e[37]!==c?(O=r?.state==="pending"?n.jsx("p",{className:"px-2.5 pb-1 typography-meta text-muted-foreground",children:c("mobile.header.metadata.contextPending")}):null,e[36]=r?.state,e[37]=c,e[38]=O):O=e[38];let K;e[39]!==d||e[40]!==u||e[41]!==o||e[42]!==l?(K=n.jsx(M1,{groups:l,displayMode:o,isLoading:d,timeFormatPreference:u}),e[39]=d,e[40]=u,e[41]=o,e[42]=l,e[43]=K):K=e[43];let L;e[44]!==A||e[45]!==F||e[46]!==O||e[47]!==K?(L=n.jsxs("div",{className:"space-y-1",children:[A,F,O,K]}),e[44]=A,e[45]=F,e[46]=O,e[47]=K,e[48]=L):L=e[48];let V;e[49]!==_||e[50]!==H||e[51]!==L||e[52]!==P?(V=n.jsx("div",{ref:f,role:"dialog","aria-label":P,className:_,style:H,children:L}),e[49]=_,e[50]=H,e[51]=L,e[52]=P,e[53]=V):V=e[53];let J;e[54]===Symbol.for("react.memo_cache_sentinel")?(J=n.jsx("style",{children:`
|
|
5
5
|
@keyframes session-metadata-in {
|
|
@@ -22,4 +22,4 @@ import{f as oe,r as Ai,j as n,R as p,a as cn,h as Ll}from"./vendor-react--VO_rL_
|
|
|
22
22
|
`}),e[48]=V):V=e[48];let J;return e[49]!==L?(J=n.jsxs("div",{ref:y,className:"oc-side-safe-area fixed inset-x-0 bottom-0 top-[calc(var(--oc-safe-area-top,0px)+var(--oc-header-height,56px))] z-20 pointer-events-none",children:[L,V]}),e[49]=L,e[50]=J):J=e[50],J};function $1(s){return s.currentSessionId}function K1(s){return s.setCurrentSession}function H1(s){return s.setActiveProjectIdOnly}const V1=s=>{const e=oe.c(81),{onOpenSessions:t,onOpenWorkspace:i,compactTitle:a}=s,r=a===void 0?false:a,{t:l}=be(),[o,d]=p.useState(false),[u,c]=p.useState(false),f=p.useRef(null),y=un(U1),g=dt(G1);let m;e[0]!==g?(m=ke=>g?ke.getDirectoryForSession(g):null,e[0]=g,e[1]=m):m=e[1];const b=dt(m)||y,v=Nc(g,b||void 0),S=dt(q1),w=fa(b||null);let N;e[2]!==b||e[3]!==w?(N=ke=>{if(!b||w!==true)return false;const Oe=ke.directories.get(b)?.status;return!!(Oe&&!Oe.isClean)},e[2]=b,e[3]=w,e[4]=N):N=e[4];const R=ss(N),T=qe(J1),j=xf(T);let C;e[5]!==v?.title?(C=v?.title?.trim(),e[5]=v?.title,e[6]=C):C=e[6];const k=C;let I;e[7]!==g||e[8]!==T||e[9]!==j||e[10]!==k||e[11]!==l?(I=(T?j:null)||k||l(g?"mobile.sessions.untitled":"sessions.switcher.draftTitle"),e[7]=g,e[8]=T,e[9]=j,e[10]=k,e[11]=l,e[12]=I):I=e[12];const E=I;let z;e[13]===Symbol.for("react.memo_cache_sentinel")?(z=()=>{d(false),c(false)},e[13]=z):z=e[13];let P;e[14]!==g||e[15]!==b?(P=[g,b],e[14]=g,e[15]=b,e[16]=P):P=e[16],p.useEffect(z,P);let B;e[17]!==t?(B=()=>{d(false),c(false),t()},e[17]=t,e[18]=B):B=e[18];const $=B;let _;e[19]===Symbol.for("react.memo_cache_sentinel")?(_=ke=>{d(Oe=>{const Fe=typeof ke=="function"?ke(Oe):ke;return Fe&&c(false),Fe})},e[19]=_):_=e[19];const D=_;let M;e[20]===Symbol.for("react.memo_cache_sentinel")?(M=()=>{c(ke=>{const Oe=!ke;return Oe&&d(false),Oe})},e[20]=M):M=e[20];const H=M;let A;e[21]===Symbol.for("react.memo_cache_sentinel")?(A={paddingTop:"var(--oc-safe-area-top, 0px)"},e[21]=A):A=e[21];let F;e[22]!==l?(F=l("mobile.sessions.openSheetAria"),e[22]=l,e[23]=F):F=e[23];let O,K;e[24]===Symbol.for("react.memo_cache_sentinel")?(O={touchAction:"manipulation"},K=n.jsx(X,{name:"list-unordered",className:"size-5"}),e[24]=O,e[25]=K):(O=e[24],K=e[25]);let L;e[26]!==$||e[27]!==F?(L=n.jsx("button",{type:"button",className:Zt,"aria-label":F,onClick:$,style:O,children:K}),e[26]=$,e[27]=F,e[28]=L):L=e[28];const V=r?"shrink":"flex-1";let J;e[29]!==V?(J=de("flex min-w-0 items-center rounded-lg px-2 py-1.5 text-start transition-colors active:bg-interactive-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",V),e[29]=V,e[30]=J):J=e[30];let G;e[31]!==l?(G=l("sessions.switcher.openAria"),e[31]=l,e[32]=G):G=e[32];let q;e[33]===Symbol.for("react.memo_cache_sentinel")?(q={touchAction:"manipulation"},e[33]=q):q=e[33];let U;e[34]!==E?(U=n.jsx("span",{dir:"auto",className:"block min-w-0 truncate oc-ui-start-align typography-ui-label font-medium text-foreground",children:E}),e[34]=E,e[35]=U):U=e[35];const Z=u&&"rotate-180";let te;e[36]!==Z?(te=de("size-4 shrink-0 text-muted-foreground transition-transform duration-150",Z),e[36]=Z,e[37]=te):te=e[37];let se;e[38]!==te?(se=n.jsx(X,{name:"arrow-down-s",className:te}),e[38]=te,e[39]=se):se=e[39];let ie;e[40]!==U||e[41]!==se?(ie=n.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[U,se]}),e[40]=U,e[41]=se,e[42]=ie):ie=e[42];let ne;e[43]!==u||e[44]!==J||e[45]!==G||e[46]!==ie?(ne=n.jsx("button",{ref:f,type:"button",className:J,"aria-label":G,"aria-haspopup":"dialog","aria-expanded":u,onClick:H,style:q,children:ie}),e[43]=u,e[44]=J,e[45]=G,e[46]=ie,e[47]=ne):ne=e[47];let ue;e[48]!==r?(ue=r?n.jsx("div",{className:"min-w-0 flex-1"}):null,e[48]=r,e[49]=ue):ue=e[49];let Q;e[50]!==g||e[51]!==b||e[52]!==S||e[53]!==o||e[54]!==T?(Q=T?null:n.jsx(L1,{open:o,onOpenChange:D,currentSessionId:g,effectiveDirectory:b,isNewSessionDraftOpen:S}),e[50]=g,e[51]=b,e[52]=S,e[53]=o,e[54]=T,e[55]=Q):Q=e[55];let re;e[56]!==R||e[57]!==l?(re=l(R?"mobile.header.openWorkspaceWithChangesAria":"mobile.header.openWorkspaceAria"),e[56]=R,e[57]=l,e[58]=re):re=e[58];let le;e[59]!==i?(le=()=>{d(false),c(false),i()},e[59]=i,e[60]=le):le=e[60];let Ne,Le;e[61]===Symbol.for("react.memo_cache_sentinel")?(Ne={touchAction:"manipulation"},Le=n.jsx(X,{name:"pencil-ruler-2",className:"size-5"}),e[61]=Ne,e[62]=Le):(Ne=e[61],Le=e[62]);let we;e[63]!==R?(we=R?n.jsx("span",{className:"absolute inset-e-1.5 top-1.5 size-2.5 rounded-full border-2 border-[var(--background)] bg-[var(--status-warning)]","aria-hidden":true}):null,e[63]=R,e[64]=we):we=e[64];let Re;e[65]!==re||e[66]!==le||e[67]!==we?(Re=n.jsxs("button",{type:"button",className:Zt,"aria-label":re,onClick:le,style:Ne,children:[Le,we]}),e[65]=re,e[66]=le,e[67]=we,e[68]=Re):Re=e[68];let ae;e[69]!==L||e[70]!==ne||e[71]!==ue||e[72]!==Q||e[73]!==Re?(ae=n.jsx("header",{className:"oc-mobile-header relative z-30 flex shrink-0 items-center gap-1 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80",style:A,children:n.jsxs("div",{className:"flex h-[var(--oc-header-height,56px)] w-full items-center gap-1 px-2",children:[L,ne,ue,Q,Re]})}),e[69]=L,e[70]=ne,e[71]=ue,e[72]=Q,e[73]=Re,e[74]=ae):ae=e[74];let ce;e[75]===Symbol.for("react.memo_cache_sentinel")?(ce=()=>c(false),e[75]=ce):ce=e[75];let Ee;e[76]!==u?(Ee=n.jsx(W1,{open:u,onClose:ce,anchorRef:f}),e[76]=u,e[77]=Ee):Ee=e[77];let Ie;return e[78]!==ae||e[79]!==Ee?(Ie=n.jsxs(n.Fragment,{children:[ae,Ee]}),e[78]=ae,e[79]=Ee,e[80]=Ie):Ie=e[80],Ie};function U1(s){return s.currentDirectory}function G1(s){return s.currentSessionId}function q1(s){return!!s.newSessionDraft?.open}function J1(s){return s.runOverviewKey}const Y1=s=>{const e=oe.c(3),{onActiveConnectionDeleted:t,onConnect:i}=s;let a;return e[0]!==t||e[1]!==i?(a=n.jsx(ul,{mode:"instances",onConnected:i,onActiveConnectionDeleted:t}),e[0]=t,e[1]=i,e[2]=a):a=e[2],a},En=s=>Zs(s)??"",X1=s=>{const e=s;return En(e.directory??e.project?.worktree??null)},ml=({open:s,project:e,worktree:t,onClose:i,onDeleted:a})=>{const{t:r}=be(),l=ma(),{childStores:o}=Rc(),d=Ns(A=>A.activeSessions),u=dt(A=>A.archiveSessions),c=dt(A=>A.unarchiveSessions),{git:f,sourceControl:y}=tr(),[g,m]=p.useState(false),[h,b]=p.useState(false),[v,S]=p.useState(false),[w,N]=p.useState(false),[R,T]=p.useState(null),[j,C]=p.useState(false),k=En(t?.path),[I,E]=p.useState(false),z=t?.branch??"";p.useEffect(()=>{if(E(false),!s||!k)return;let A=false;return Ic(e.path,{path:k,branch:z}).then(F=>{A||E(F)}),()=>{A=true}},[s,e.path,z,k]);const P=p.useMemo(()=>{if(!k)return[];const A=new Map;for(const F of[...d,...l]){const O=X1(F);O&&Pc(k,O)&&A.set(F.id,F)}return Array.from(A.values())},[d,l,k]),B=p.useCallback(A=>Ec(o,A),[o]);p.useEffect(()=>{if(!s){m(false),b(false),S(false),N(false),T(null),C(false);return}if(!t?.path)return;let A=false;return Tc(t.path).then(F=>{A||(N(!!F?.isDirty),T(F?.upstream?.split("/")[0]?.trim()||null))}).catch(()=>{A||N(!!t.status?.isDirty)}),()=>{A=true}},[s,t?.path,t?.status?.isDirty]);const $=p.useCallback(async(A,F)=>(await _c(e,A,{deleteRemoteBranch:I&&h,deleteLocalBranch:I&&g,remoteName:R??void 0,network:{git:f,sourceControl:y},skipTeardown:F}),En(un.getState().currentDirectory)===k&&En(e.path)&&un.getState().setDirectory(En(e.path),{showOverlay:false}),true),[g,h,f,I,e,R,y,k]),_=p.useCallback((A,F,O)=>{const K=Ac(A),L=async(V,J)=>{const G=me.loading(r("sessions.sidebar.sessionDialogs.worktree.removingTitle",{name:K}));Dc(A.path);try{if(O){if(!(await Oc({worktreePath:A.path,projectDirectory:e.path,readSessions:()=>B(A.path),removeWorktree:()=>$(A,V)})).removed){me.dismiss(G);return}me.success(r(I&&h?"sessions.sidebar.sessionDialogs.worktree.removedWithRemote":"sessions.sidebar.sessionDialogs.worktree.removed"),{id:G,description:K}),a?.();return}const q=await Mc({sessionIds:J,removeWorktree:()=>$(A,V),archiveSessions:u,restoreSessions:Z=>c(Z,{undo:true})});if(!q.removed){me.dismiss(G);return}const{failedIds:U}=q.archive;if(U.length>0){me.error(U.length===1?r("sessions.sidebar.bulkActions.failedArchiveSingle",{count:U.length}):r("sessions.sidebar.bulkActions.failedArchivePlural",{count:U.length}),{id:G,description:r("sessions.sidebar.dialogs.deleteResult.tryAgain")});return}me.success(r(I&&h?"sessions.sidebar.sessionDialogs.worktree.removedWithRemote":"sessions.sidebar.sessionDialogs.worktree.removed"),{id:G,description:K}),a?.()}catch(q){const U=(q instanceof Error?Lc(q,r):null)??(q instanceof Gn?q.message||r("sessions.sidebar.dialogs.deleteResult.tryAgain"):q instanceof Mi||q instanceof Ds&&!q.message.includes(" ")?r("gitView.publish.remoteNotGranted"):q instanceof Error?q.message:r("sessions.sidebar.dialogs.deleteResult.tryAgain"));me.error(r("sessions.sidebar.sessionDialogs.worktree.errorRemoveTitle"),{id:G,description:U,...q instanceof Error?Bc(q,r("sessions.sidebar.sessionDialogs.worktree.deleteWithoutTeardown"),()=>{L(true,Wc(J,A.path))}):void 0})}finally{Fc(A.path)}};L(false,F)},[u,h,I,a,e.path,B,$,r,c]),D=()=>{!t||j||(_(t,P.map(A=>A.id),v&&P.length>0),i())};if(!t)return null;const M=t.branch||t.label||t.path,H=(A,F,O,K)=>n.jsxs("label",{className:de("oc-tile flex min-h-11 items-center justify-between gap-3 rounded-lg px-3",K&&"opacity-50"),children:[n.jsx("span",{className:"typography-meta font-medium text-foreground",children:O}),n.jsx(zc,{checked:A,onCheckedChange:F,disabled:K})]});return n.jsx(Yn,{open:s,onClose:i,title:r("mobile.projectEdit.deleteWorktreeTitle"),footer:n.jsxs("div",{className:"flex gap-2",children:[n.jsx(ze,{variant:"ghost",className:"flex-1",onClick:i,disabled:j,children:r("projectEditDialog.actions.cancel")}),n.jsx(ze,{variant:"destructive",className:"flex-1",onClick:()=>{D()},disabled:j,children:r("mobile.projectEdit.deleteWorktreeConfirmButton")})]}),children:n.jsxs("div",{className:"flex flex-col gap-4 px-1 py-1",children:[n.jsx("p",{className:"typography-ui-body text-foreground",children:r("mobile.projectEdit.deleteWorktreeConfirm",{name:M})}),w?n.jsx("p",{className:"rounded-lg bg-[var(--status-warning-background)] px-3 py-2.5 typography-meta text-foreground",children:r("mobile.projectEdit.deleteWorktreeDirty")}):null,P.length>0?n.jsx("p",{className:"typography-meta text-muted-foreground",children:v?r("mobile.projectEdit.deleteWorktreeKeepNote",{count:P.length}):r("mobile.projectEdit.deleteWorktreeArchiveNote",{count:P.length})}):null,P.length>0||I?n.jsxs("div",{className:"flex flex-col gap-2",children:[P.length>0?H(v,S,r("sessions.sidebar.sessionDialogs.actions.keepSessions"),j):null,I?H(g,m,r("mobile.projectEdit.deleteLocalBranch"),j):null,I?H(h,b,r("mobile.projectEdit.deleteRemoteBranch"),j||!R):null]}):null]})})},Q1=[],Z1=s=>{const e=oe.c(8),{projectPath:t}=s,{t:i}=be(),{journey:a}=Hl();let r;if(e[0]!==a||e[1]!==t||e[2]!==i){const l=a?Vl(a,t):[];let o;e[4]!==i?(o=i("mobile.projectEdit.spacesTitle"),e[4]=i,e[5]=o):o=e[5];let d;e[6]!==o?(d=n.jsx("label",{className:"typography-ui-label font-medium text-foreground",children:o}),e[6]=o,e[7]=d):d=e[7],r=n.jsxs("div",{className:"flex flex-col gap-2",children:[d,a!==null&&l.length===0?n.jsx("p",{className:"typography-meta text-muted-foreground",children:i("spaces.page.empty")}):null,l.map(ng)]}),e[0]=a,e[1]=t,e[2]=i,e[3]=r}else r=e[3];return r},eg=s=>Zs(s)??"",tg=s=>{const e=oe.c(18),{worktree:t,onDelete:i}=s,{t:a}=be(),r=t.branch||t.label||t.path,l=Vc(t.path),o=l&&"opacity-60";let d;e[0]!==o?(d=de("flex items-center gap-2 rounded-2xl border border-edge bg-[var(--surface-elevated)] py-1.5 ps-3 pe-1.5 transition-colors",o),e[0]=o,e[1]=d):d=e[1];const u=l||void 0;let c;e[2]!==l||e[3]!==a?(c=l?n.jsx("span",{className:"inline-flex shrink-0 text-muted-foreground",role:"status","aria-label":a("sessions.sidebar.group.worktreeRemoving"),children:n.jsx(X,{name:"loader-4",className:"size-4 animate-spin"})}):n.jsx(X,{name:"git-branch",className:"size-4 shrink-0 text-muted-foreground"}),e[2]=l,e[3]=a,e[4]=c):c=e[4];let f;e[5]!==r?(f=n.jsx("span",{className:"block min-w-0 flex-1 truncate typography-ui-label text-foreground",children:r}),e[5]=r,e[6]=f):f=e[6];let y;e[7]!==r||e[8]!==i||e[9]!==l||e[10]!==a?(y=l?null:n.jsx("button",{type:"button",className:"flex size-9 shrink-0 items-center justify-center rounded-xl text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-destructive","aria-label":a("mobile.projectEdit.deleteWorktreeAria",{label:r}),onClick:i,style:{touchAction:"manipulation"},children:n.jsx(La,{className:"size-4"})}),e[7]=r,e[8]=i,e[9]=l,e[10]=a,e[11]=y):y=e[11];let g;return e[12]!==d||e[13]!==u||e[14]!==c||e[15]!==f||e[16]!==y?(g=n.jsxs("div",{className:d,"aria-busy":u,children:[c,f,y]}),e[12]=d,e[13]=u,e[14]=c,e[15]=f,e[16]=y,e[17]=g):g=e[17],g},sg=s=>{const e=oe.c(75),{open:t,project:i,onClose:a}=s,{t:r}=be(),{currentTheme:l}=pa(),o=qe(ig),d=qt(rg),u=qt(og),c=qt(ag);let f;e[0]!==i?(f=le=>i?le.projects.find(Ne=>Ne.id===i.id)?.iconImage??null:null,e[0]=i,e[1]=f):f=e[1];const y=qt(f),[g,m]=p.useState(""),[h,b]=p.useState(null),[v,S]=p.useState(null),[w,N]=p.useState(false),[R,T]=p.useState(null),j=i?.id??null;let C;e[2]!==t||e[3]!==i?(C=()=>{!t||!i||(m(i.label),b(i.icon??null),S(i.color??null))},e[2]=t,e[3]=i,e[4]=C):C=e[4];let k;e[5]!==t||e[6]!==j?(k=[t,j],e[5]=t,e[6]=j,e[7]=k):k=e[7],p.useEffect(C,k);const I=i?.path;let E;e[8]!==I?(E=eg(I),e[8]=I,e[9]=E):E=e[9];const z=E,P=dt(le=>z?le.availableWorktreesByProject.get(z):void 0)??Q1,B=ss(le=>z?le.directories.get(z)?.isGitRepo:void 0)??P.length>0;let $;e[10]!==v||e[11]!==h||e[12]!==g||e[13]!==a||e[14]!==i||e[15]!==d?($=()=>{if(!i)return;const Ne={label:g.trim()||i.label,icon:h,color:v};v!==(i.color??null)&&(Ne.iconBackground=Uc(v)),d(i.id,Ne),a()},e[10]=v,e[11]=h,e[12]=g,e[13]=a,e[14]=i,e[15]=d,e[16]=$):$=e[16];const _=$;let D;e[17]!==u||e[18]!==w||e[19]!==i||e[20]!==r?(D=()=>{!i||w||(N(true),u(i.id).then(le=>{if(!le.ok){me.error(le.error||r("projectEditDialog.toast.failedToDiscoverIcon"));return}if(le.skipped){me.success(r("projectEditDialog.toast.customIconAlreadySet"));return}me.success(r("projectEditDialog.toast.iconDiscovered"))}).finally(()=>N(false)))},e[17]=u,e[18]=w,e[19]=i,e[20]=r,e[21]=D):D=e[21];const M=D;let H;e[22]!==i||e[23]!==c||e[24]!==r?(H=()=>{i&&c(i.id).then(le=>{if(!le.ok){me.error(le.error||r("projectEditDialog.toast.failedToRemoveIcon"));return}me.success(r("projectEditDialog.toast.iconRemoved"))})},e[22]=i,e[23]=c,e[24]=r,e[25]=H):H=e[25];const A=H;let F;e[26]!==v?(F=ha(v),e[26]=v,e[27]=F):F=e[27];const O=F,K=h?ga[h]:null,L=!!y;let V;e[28]!==r?(V=r("projectEditDialog.title"),e[28]=r,e[29]=V):V=e[29];let J;e[30]!==r?(J=r("projectEditDialog.title"),e[30]=r,e[31]=J):J=e[31];let G;e[32]!==r?(G=r("projectEditDialog.actions.save"),e[32]=r,e[33]=G):G=e[33];let q;e[34]!==g?(q=g.trim(),e[34]=g,e[35]=q):q=e[35];const U=!q;let Z,te;e[36]===Symbol.for("react.memo_cache_sentinel")?(Z={touchAction:"manipulation"},te=n.jsx(pp,{className:"size-4"}),e[36]=Z,e[37]=te):(Z=e[36],te=e[37]);let se;e[38]!==r?(se=r("projectEditDialog.actions.save"),e[38]=r,e[39]=se):se=e[39];let ie;e[40]!==_||e[41]!==G||e[42]!==U||e[43]!==se?(ie=n.jsxs(ze,{type:"button",variant:"default",size:"sm","aria-label":G,onClick:_,disabled:U,style:Z,children:[te,se]}),e[40]=_,e[41]=G,e[42]=U,e[43]=se,e[44]=ie):ie=e[44];let ne;e[45]!==v||e[46]!==O||e[47]!==y||e[48]!==l||e[49]!==M||e[50]!==A||e[51]!==L||e[52]!==h||e[53]!==w||e[54]!==B||e[55]!==o||e[56]!==g||e[57]!==K||e[58]!==i||e[59]!==r||e[60]!==P?(ne=i?n.jsxs(bs,{outerClassName:"h-full",className:"space-y-6 px-4 pb-8 pt-2",disableHorizontal:true,children:[n.jsx("div",{className:"flex justify-center pt-2",children:n.jsx("span",{className:"flex size-16 items-center justify-center overflow-hidden rounded-2xl bg-[var(--surface-muted)] text-muted-foreground",style:L&&i.iconBackground?{backgroundColor:i.iconBackground}:void 0,children:L?n.jsx(ba,{project:{id:i.id,iconImage:y},options:{themeVariant:l.metadata.variant,iconColor:l.colors.surface.foreground},className:"size-full object-contain",fallback:n.jsx(Ki,{className:"size-7"})}):K?n.jsx(X,{name:K,className:"size-7",style:O?{color:O}:void 0}):n.jsx(Ki,{className:"size-7",style:O?{color:O}:void 0})})}),n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx("label",{className:"typography-ui-label font-medium text-foreground",children:r("projectEditDialog.field.name")}),n.jsx($c,{value:g,onChange:le=>m(le.target.value),placeholder:r("projectEditDialog.field.namePlaceholder"),className:"h-11"}),n.jsx("p",{className:"truncate typography-meta text-muted-foreground",title:i.path,children:i.path})]}),n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("label",{className:"typography-ui-label font-medium text-foreground",children:r("projectEditDialog.field.color")}),n.jsxs("div",{className:"flex flex-wrap gap-2.5",children:[n.jsx("button",{type:"button",onClick:()=>S(null),"aria-label":r("projectEditDialog.option.none"),className:de("flex size-9 items-center justify-center rounded-xl border-2 transition-all",v===null?"border-foreground":"border-edge hover:border-edge"),style:{touchAction:"manipulation"},children:n.jsx("span",{className:"h-0.5 w-4 rotate-45 rounded-full bg-muted-foreground/40"})}),Kc.map(le=>n.jsx("button",{type:"button",onClick:()=>S(le),"aria-label":r("settings.projects.appearance.colorSwatchAria",{color:le}),title:le,className:de("size-9 rounded-xl border-2 transition-all",v===le?"border-foreground":"border-transparent hover:border-edge"),style:{backgroundColor:le,touchAction:"manipulation"}},le))]})]}),n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("label",{className:"typography-ui-label font-medium text-foreground",children:r("projectEditDialog.field.icon")}),n.jsxs("div",{className:"flex flex-wrap gap-2.5",children:[n.jsx("button",{type:"button",onClick:()=>b(null),"aria-label":r("projectEditDialog.option.none"),className:de("flex size-9 items-center justify-center rounded-xl border-2 transition-all",h===null?"border-foreground bg-[var(--surface-elevated)]":"border-edge hover:border-edge"),style:{touchAction:"manipulation"},children:n.jsx("span",{className:"h-0.5 w-4 rotate-45 rounded-full bg-muted-foreground/40"})}),Hc.map(le=>n.jsx("button",{type:"button",onClick:()=>b(le.key),"aria-label":le.label,className:de("flex size-9 items-center justify-center rounded-xl border-2 transition-all",h===le.key?"border-foreground bg-[var(--surface-elevated)]":"border-edge hover:border-edge"),style:{touchAction:"manipulation"},children:n.jsx(X,{name:le.Icon,className:"size-4",style:O?{color:O}:void 0})},le.key))]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:[n.jsx(ze,{size:"sm",variant:"outline",onClick:M,disabled:w,children:r(w?"projectEditDialog.actions.discovering":"projectEditDialog.actions.discoverFavicon")}),L?n.jsx(ze,{size:"sm",variant:"outline",onClick:A,children:r("projectEditDialog.actions.removeProjectIcon")}):null]})]}),B?n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("label",{className:"typography-ui-label font-medium text-foreground",children:r("mobile.projectEdit.worktreesTitle")}),P.length===0?n.jsx("p",{className:"typography-meta text-muted-foreground",children:r("mobile.projectEdit.worktreesEmpty")}):n.jsx("div",{className:"flex flex-col gap-1.5",children:P.map(le=>n.jsx(tg,{worktree:le,onDelete:()=>T(le)},le.path))})]}):null,B&&o?n.jsx(Z1,{projectPath:i.path}):null]}):null,e[45]=v,e[46]=O,e[47]=y,e[48]=l,e[49]=M,e[50]=A,e[51]=L,e[52]=h,e[53]=w,e[54]=B,e[55]=o,e[56]=g,e[57]=K,e[58]=i,e[59]=r,e[60]=P,e[61]=ne):ne=e[61];let ue;e[62]!==a||e[63]!==t||e[64]!==V||e[65]!==J||e[66]!==ie||e[67]!==ne?(ue=n.jsx(ms,{open:t,onClose:a,title:V,ariaLabel:J,noHeaderBorder:true,trailing:ie,children:ne}),e[62]=a,e[63]=t,e[64]=V,e[65]=J,e[66]=ie,e[67]=ne,e[68]=ue):ue=e[68];let Q;e[69]!==i||e[70]!==R?(Q=i?n.jsx(ml,{open:!!R,project:{id:i.id,path:i.path},worktree:R,onClose:()=>T(null)}):null,e[69]=i,e[70]=R,e[71]=Q):Q=e[71];let re;return e[72]!==ue||e[73]!==Q?(re=n.jsxs(n.Fragment,{children:[ue,Q]}),e[72]=ue,e[73]=Q,e[74]=re):re=e[74],re};function ng(s){return n.jsx(kp,{entry:s,actions:"sheet"},s.id)}function ig(s){return s.isolatedSpacesEnabled}function rg(s){return s.updateProjectMeta}function og(s){return s.discoverProjectIcon}function ag(s){return s.removeProjectIcon}const wn=s=>{const e=oe.c(20),{project:t,size:i}=s,a=i===void 0?"md":i,{currentTheme:r}=pa(),l=t.icon?ga[t.icon]:null;let o;e[0]!==t.color?(o=ha(t.color),e[0]=t.color,e[1]=o):o=e[1];const d=o,u=a==="md"?"size-5":"size-3.5";let c;e[2]!==l||e[3]!==u||e[4]!==d?(c=l?n.jsx(X,{name:l,className:u,style:d?{color:d}:void 0}):n.jsx(Ki,{className:u,style:d?{color:d}:void 0}),e[2]=l,e[3]=u,e[4]=d,e[5]=c):c=e[5];const f=c;let y;e[6]!==r||e[7]!==f||e[8]!==t.iconImage||e[9]!==t.id?(y=t.iconImage?n.jsx(ba,{project:{id:t.id,iconImage:t.iconImage??null},options:{themeVariant:r.metadata.variant,iconColor:r.colors.surface.foreground},className:"size-full object-contain",fallback:f}):null,e[6]=r,e[7]=f,e[8]=t.iconImage,e[9]=t.id,e[10]=y):y=e[10];const g=y;let m;e[11]!==t.iconBackground?(m=t.iconBackground?{backgroundColor:t.iconBackground}:void 0,e[11]=t.iconBackground,e[12]=m):m=e[12];const h=m;if(a==="md"){let w;return e[13]!==f||e[14]!==g||e[15]!==h?(w=n.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center text-muted-foreground",children:g?n.jsx("span",{className:"flex size-6 items-center justify-center overflow-hidden rounded-md",style:h,children:g}):f}),e[13]=f,e[14]=g,e[15]=h,e[16]=w):w=e[16],w}const b=g?h:void 0,v=g??f;let S;return e[17]!==b||e[18]!==v?(S=n.jsx("span",{className:"flex size-3.5 shrink-0 items-center justify-center overflow-hidden rounded-[3px] text-muted-foreground",style:b,children:v}),e[17]=b,e[18]=v,e[19]=S):S=e[19],S},gr=s=>Zs(s)??"",lg=s=>{const e=gr(s);if(!e)return"";const t=e.split("/").filter(Boolean);return t[t.length-1]?.replace(/[-_]/g," ")||e},Gs=s=>{const e=s;return gr(e.directory??e.project?.worktree??null)},cg=s=>{if(!s.panel)return false;const e=sr.getState().guests.find(t=>t.id===s.guestId);return!!(e&&qc(e,"panel"))},pl=s=>{const e=oe.c(9),{marks:t,onOpenRow:i}=s,{t:a}=be();if(t.length===0)return null;let r;if(e[0]!==t||e[1]!==i||e[2]!==a){let o;e[4]!==i||e[5]!==a?(o=d=>{const u=a("sessions.sidebar.session.guestMark.label",{name:d.guestName,text:d.text});return n.jsx("span",{"data-guest-mark":d.guestId,role:"img","aria-label":u,className:"relative inline-flex shrink-0 items-center before:absolute before:-inset-2 before:content-['']",onClick:c=>{c.preventDefault(),c.stopPropagation(),!(cg(d)&&(i(),Gc({mode:Xo(d.guestId),directory:null,supported:true}).ok))&&(me.info(u),d.url&&ia(d.url))},children:n.jsx(wf,{mark:d})},d.guestId)},e[4]=i,e[5]=a,e[6]=o):o=e[6],r=t.slice(0,vf).map(o),e[0]=t,e[1]=i,e[2]=a,e[3]=r}else r=e[3];let l;return e[7]!==r?(l=n.jsx(n.Fragment,{children:r}),e[7]=r,e[8]=l):l=e[8],l},br=s=>{const e=oe.c(51),{initialTitle:t,indent:i,className:a,aiRename:r,placeholder:l,onSubmit:o,onCancel:d}=s,{t:u}=be(),[c,f]=p.useState(t),y=dg;let g;e[0]!==r||e[1]!==t||e[2]!==d||e[3]!==o||e[4]!==c?(g=()=>{const M=c.trim();if(!M&&r||M===t.trim()){d();return}o(M)},e[0]=r,e[1]=t,e[2]=d,e[3]=o,e[4]=c,e[5]=g):g=e[5];const m=g;let h;e[6]!==a?(h=de("flex h-9 min-w-0 flex-1 items-center gap-2 pe-2",a),e[6]=a,e[7]=h):h=e[7];let b;e[8]!==i?(b={paddingInlineStart:i},e[8]=i,e[9]=b):b=e[9];let v;e[10]!==m?(v=M=>{M.preventDefault(),m()},e[10]=m,e[11]=v):v=e[11];let S;e[12]===Symbol.for("react.memo_cache_sentinel")?(S=M=>f(M.target.value),e[12]=S):S=e[12];let w;e[13]!==d?(w=M=>Sf(M,d),e[13]=d,e[14]=w):w=e[14];let N;e[15]!==u?(N=u("sessions.sidebar.session.rename.save"),e[15]=u,e[16]=N):N=e[16];let R;e[17]!==l||e[18]!==u?(R=l??u("sessions.sidebar.session.menu.rename"),e[17]=l,e[18]=u,e[19]=R):R=e[19];let T;e[20]===Symbol.for("react.memo_cache_sentinel")?(T={minHeight:0},e[20]=T):T=e[20];let j;e[21]!==w||e[22]!==N||e[23]!==R||e[24]!==c?(j=n.jsx("input",{ref:y,value:c,onChange:S,onKeyDown:w,"aria-label":N,placeholder:R,className:"min-w-0 flex-1 bg-transparent text-[16px] typography-ui-label text-foreground outline-none placeholder:text-muted-foreground",style:T,enterKeyHint:"done"}),e[21]=w,e[22]=N,e[23]=R,e[24]=c,e[25]=j):j=e[25];let C;e[26]!==r||e[27]!==d||e[28]!==u?(C=r?n.jsx("button",{type:"button",disabled:r.disabled,onClick:()=>{r.run(),d()},"aria-label":u("sessions.aiRename.action"),"aria-description":r.hint,title:r.hint,className:"flex size-8 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:text-foreground disabled:opacity-40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",style:{touchAction:"manipulation",minHeight:0,minWidth:0},children:n.jsx(X,{name:"ai-generate-2",className:"size-4"})}):null,e[26]=r,e[27]=d,e[28]=u,e[29]=C):C=e[29];let k;e[30]!==u?(k=u("sessions.sidebar.session.rename.save"),e[30]=u,e[31]=k):k=e[31];let I,E;e[32]===Symbol.for("react.memo_cache_sentinel")?(I={touchAction:"manipulation",minHeight:0,minWidth:0},E=n.jsx(X,{name:"check",className:"size-4"}),e[32]=I,e[33]=E):(I=e[32],E=e[33]);let z;e[34]!==k?(z=n.jsx("button",{type:"submit","aria-label":k,className:"flex size-8 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",style:I,children:E}),e[34]=k,e[35]=z):z=e[35];let P;e[36]!==u?(P=u("sessions.sidebar.session.rename.cancel"),e[36]=u,e[37]=P):P=e[37];let B,$;e[38]===Symbol.for("react.memo_cache_sentinel")?(B={touchAction:"manipulation",minHeight:0,minWidth:0},$=n.jsx(X,{name:"close",className:"size-4"}),e[38]=B,e[39]=$):(B=e[38],$=e[39]);let _;e[40]!==d||e[41]!==P?(_=n.jsx("button",{type:"button",onClick:d,"aria-label":P,className:"flex size-8 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",style:B,children:$}),e[40]=d,e[41]=P,e[42]=_):_=e[42];let D;return e[43]!==j||e[44]!==C||e[45]!==z||e[46]!==_||e[47]!==h||e[48]!==b||e[49]!==v?(D=n.jsxs("form",{className:h,style:b,onSubmit:v,children:[j,C,z,_]}),e[43]=j,e[44]=C,e[45]=z,e[46]=_,e[47]=h,e[48]=b,e[49]=v,e[50]=D):D=e[50],D};function dg(s){s&&(s.focus(),s.select())}const vo=s=>{const e=oe.c(8),{session:t}=s,{t:i}=be(),a=ya(t);if(!a)return null;const r=Jc[a.status];let l;e[0]!==i||e[1]!==r?(l=i(r),e[0]=i,e[1]=r,e[2]=l):l=e[2];const o=l,d=Yc[a.status];let u;e[3]!==d?(u={color:d},e[3]=d,e[4]=u):u=e[4];let c;return e[5]!==o||e[6]!==u?(c=n.jsx(X,{name:"target",className:"size-3.5 shrink-0",style:u,"aria-label":o}),e[5]=o,e[6]=u,e[7]=c):c=e[7],c},wo=s=>{const e=oe.c(9),{hasPermission:t,hasForm:i}=s,{t:a}=be();if(!t&&!i)return null;let r;e[0]!==t||e[1]!==a?(r=t?n.jsx("span",{className:"inline-flex shrink-0 items-center text-status-warning","aria-label":a("sessions.sidebar.session.status.permissionRequired"),children:n.jsx(X,{name:"shield",className:"size-3"})}):null,e[0]=t,e[1]=a,e[2]=r):r=e[2];let l;e[3]!==i||e[4]!==a?(l=i?n.jsx("span",{className:"inline-flex shrink-0 items-center text-status-warning","aria-label":a("sessions.sidebar.session.status.questionPending"),children:n.jsx(X,{name:"question",className:"size-3"})}):null,e[3]=i,e[4]=a,e[5]=l):l=e[5];let o;return e[6]!==r||e[7]!==l?(o=n.jsxs(n.Fragment,{children:[r,l]}),e[6]=r,e[7]=l,e[8]=o):o=e[8],o},Qs=48,ug=4*Qs,fg=180,So=(s,e)=>{s&&(s.style.visibility=e?"visible":"hidden")},Ln=s=>{const e=oe.c(33),{actionsWidth:t,actions:i,revealed:a,onRevealedChange:r,dataActiveSession:l,contentClassName:o,children:d}=s,u=o===void 0?"relative flex w-full items-center bg-background":o,{direction:c}=be(),f=c==="rtl"?-1:1,y=p.useRef(null),g=p.useRef(null),m=p.useRef(null),h=p.useRef(false),b=p.useRef(0),v=p.useRef(a);let S;e[0]!==f?(S=(O,K)=>{const L=y.current;L&&(So(g.current,O!==0||K&&O!==b.current),L.style.transition=K?`transform ${fg}ms ease-out`:"none",L.style.transform=O===0?"none":`translateX(${O*f}px)`,b.current=O)},e[0]=f,e[1]=S):S=e[1];const w=S;let N;e[2]===Symbol.for("react.memo_cache_sentinel")?(N=O=>{O.target===y.current&&O.propertyName==="transform"&&b.current===0&&So(g.current,false)},e[2]=N):N=e[2];const R=N;let T,j;e[3]!==t||e[4]!==w||e[5]!==a?(T=()=>{v.current=a,w(a?t:0,true)},j=[t,w,a],e[3]=t,e[4]=w,e[5]=a,e[6]=T,e[7]=j):(T=e[6],j=e[7]),p.useLayoutEffect(T,j);let C;e[8]===Symbol.for("react.memo_cache_sentinel")?(C=O=>{if(O.touches.length!==1)return;const K=O.touches[0];m.current={x:K.clientX,y:K.clientY},h.current=false},e[8]=C):C=e[8];const k=C;let I;e[9]!==t||e[10]!==w||e[11]!==f?(I=O=>{if(!m.current)return;const K=O.touches[0],L=(K.clientX-m.current.x)*f,V=K.clientY-m.current.y;if(!h.current){if(Math.abs(L)<8||Math.abs(L)<=Math.abs(V))return;h.current=true}const J=v.current?t:0;w(Math.max(0,Math.min(t,J+L)),false)},e[9]=t,e[10]=w,e[11]=f,e[12]=I):I=e[12];const E=I;let z;e[13]!==t||e[14]!==w||e[15]!==r?(z=()=>{if(m.current=null,!h.current)return;h.current=false;const O=b.current>t/2;w(O?t:0,true),O!==v.current&&r(O)},e[13]=t,e[14]=w,e[15]=r,e[16]=z):z=e[16];const P=z,B=l||void 0;let $;e[17]===Symbol.for("react.memo_cache_sentinel")?($={touchAction:"pan-y"},e[17]=$):$=e[17];let _;e[18]!==t?(_={width:t},e[18]=t,e[19]=_):_=e[19];const D=!a;let M;e[20]!==i||e[21]!==_||e[22]!==D?(M=n.jsx("div",{ref:g,className:"absolute inset-y-0 inset-s-0 flex items-stretch",style:_,"aria-hidden":D,children:i}),e[20]=i,e[21]=_,e[22]=D,e[23]=M):M=e[23];const H=`${u} rounded-[inherit]`;let A;e[24]!==d||e[25]!==H?(A=n.jsx("div",{ref:y,className:H,onTransitionEnd:R,onTransitionCancel:R,children:d}),e[24]=d,e[25]=H,e[26]=A):A=e[26];let F;return e[27]!==P||e[28]!==E||e[29]!==M||e[30]!==A||e[31]!==B?(F=n.jsxs("div",{"data-active-session":B,className:"relative overflow-hidden rounded-lg",onTouchStart:k,onTouchMove:E,onTouchEnd:P,onTouchCancel:P,style:$,children:[M,A]}),e[27]=P,e[28]=E,e[29]=M,e[30]=A,e[31]=B,e[32]=F):F=e[32],F},mg=s=>{const e=oe.c(62),{sessionId:t,title:i,revealed:a,confirmingDelete:r,onArchive:l,onRequestDelete:o,onConfirmDelete:d,onRequestRename:u,onRevealedChange:c,work:f,pin:y}=s,{t:g}=be(),m=a?0:-1;let h;e[0]!==c||e[1]!==t||e[2]!==g?(h=async()=>{if(!(await Qi(t).catch(pg))?.ok){eo.error(g("sessions.sidebar.session.copyId.error"));return}c?.(false),eo.success(g("sessions.sidebar.session.copyId.success"))},e[0]=c,e[1]=t,e[2]=g,e[3]=h):h=e[3];const b=h;let v;e[4]!==g||e[5]!==i?(v=g("mobile.sessions.archiveSessionAria",{title:i}),e[4]=g,e[5]=i,e[6]=v):v=e[6];let S,w;e[7]===Symbol.for("react.memo_cache_sentinel")?(S={touchAction:"manipulation"},w=n.jsx(hp,{className:"size-[18px]"}),e[7]=S,e[8]=w):(S=e[7],w=e[8]);let N;e[9]!==l||e[10]!==v||e[11]!==m?(N=n.jsx("button",{type:"button",tabIndex:m,className:"flex flex-1 items-center justify-center text-muted-foreground transition-colors active:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring","aria-label":v,onClick:l,style:S,children:w}),e[9]=l,e[10]=v,e[11]=m,e[12]=N):N=e[12];let R;e[13]!==c||e[14]!==y||e[15]!==g||e[16]!==m?(R=y?n.jsx("button",{type:"button",tabIndex:m,className:"flex flex-1 items-center justify-center text-muted-foreground transition-colors active:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring","aria-label":y.pinned?g("sessions.sidebar.session.menu.unpin"):g("sessions.sidebar.session.menu.pin"),onClick:()=>{y.onToggle(),c?.(false)},style:{touchAction:"manipulation"},children:n.jsx(X,{name:y.pinned?"unpin":"pushpin",className:"size-[18px]"})}):null,e[13]=c,e[14]=y,e[15]=g,e[16]=m,e[17]=R):R=e[17];let T;e[18]!==c||e[19]!==g||e[20]!==m||e[21]!==f?(T=f?n.jsx("button",{type:"button",tabIndex:m,className:de("flex flex-1 items-center justify-center transition-colors active:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",f.inWork?"text-status-success":"text-muted-foreground active:text-foreground"),"aria-label":f.inWork?g("sessions.sidebar.session.work.markDone"):g("sessions.sidebar.session.work.track"),onClick:()=>{f.onToggle(),c?.(false)},style:{touchAction:"manipulation"},children:n.jsx(X,{name:f.inWork?"check":"eye",className:f.inWork?"size-5":"size-[18px]"})}):null,e[18]=c,e[19]=g,e[20]=m,e[21]=f,e[22]=T):T=e[22];const j=r?"rounded-lg bg-destructive text-destructive-foreground":"text-[var(--status-error)] active:opacity-80";let C;e[23]!==j?(C=de("flex flex-1 items-center justify-center transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-destructive",j),e[23]=j,e[24]=C):C=e[24];let k;e[25]!==r||e[26]!==g||e[27]!==i?(k=r?g("mobile.sessions.confirmDeleteSessionAria",{title:i}):g("mobile.sessions.deleteSessionAria",{title:i}),e[25]=r,e[26]=g,e[27]=i,e[28]=k):k=e[28];const I=r?d:o;let E,z;e[29]===Symbol.for("react.memo_cache_sentinel")?(E={touchAction:"manipulation"},z=n.jsx(La,{className:"size-[18px]"}),e[29]=E,e[30]=z):(E=e[29],z=e[30]);let P;e[31]!==k||e[32]!==I||e[33]!==C||e[34]!==m?(P=n.jsx("button",{type:"button",tabIndex:m,className:C,"aria-label":k,onClick:I,style:E,children:z}),e[31]=k,e[32]=I,e[33]=C,e[34]=m,e[35]=P):P=e[35];let B;e[36]!==g||e[37]!==i?(B=g("mobile.sessions.renameSessionAria",{title:i}),e[36]=g,e[37]=i,e[38]=B):B=e[38];let $,_;e[39]===Symbol.for("react.memo_cache_sentinel")?($={touchAction:"manipulation"},_=n.jsx(gp,{className:"size-[18px]"}),e[39]=$,e[40]=_):($=e[39],_=e[40]);let D;e[41]!==u||e[42]!==B||e[43]!==m?(D=n.jsx("button",{type:"button",tabIndex:m,className:"flex flex-1 items-center justify-center text-muted-foreground transition-colors active:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring","aria-label":B,onClick:u,style:$,children:_}),e[41]=u,e[42]=B,e[43]=m,e[44]=D):D=e[44];let M;e[45]!==g?(M=g("sessions.sidebar.session.menu.copyId"),e[45]=g,e[46]=M):M=e[46];let H;e[47]!==b?(H=()=>{b()},e[47]=b,e[48]=H):H=e[48];let A,F;e[49]===Symbol.for("react.memo_cache_sentinel")?(A={touchAction:"manipulation"},F=n.jsx(X,{name:"file-copy",className:"size-[18px]"}),e[49]=A,e[50]=F):(A=e[49],F=e[50]);let O;e[51]!==M||e[52]!==H||e[53]!==m?(O=n.jsx("button",{type:"button",tabIndex:m,className:"flex flex-1 items-center justify-center text-muted-foreground transition-colors active:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring","aria-label":M,onClick:H,style:A,children:F}),e[51]=M,e[52]=H,e[53]=m,e[54]=O):O=e[54];let K;return e[55]!==P||e[56]!==D||e[57]!==O||e[58]!==N||e[59]!==R||e[60]!==T?(K=n.jsxs(n.Fragment,{children:[N,R,T,P,D,O]}),e[55]=P,e[56]=D,e[57]=O,e[58]=N,e[59]=R,e[60]=T,e[61]=K):K=e[61],K};function pg(){return null}const hg=({active:s,repeat:e=false,unread:t,running:i,pending:a})=>s?e?"text-foreground":"text-interactive-selection-foreground":t||a.hasPermission||a.hasForm?"font-semibold text-foreground":i?"text-foreground":"oc-title-rest",gg=s=>{const e=oe.c(7);let t;e[0]!==s?(t=o=>s.some(d=>!!o.bySession.get(d)?.permissions.length),e[0]=s,e[1]=t):t=e[1];const i=Fr(t);let a;e[2]!==s?(a=o=>s.some(d=>{const u=o.bySession.get(d);return!!(u?.forms.length||u?.pages.length)}),e[2]=s,e[3]=a):a=e[3];const r=Fr(a);let l;return e[4]!==r||e[5]!==i?(l={hasPermission:i,hasForm:r},e[4]=r,e[5]=i,e[6]=l):l=e[6],l},bg=()=>{const s=new Map;for(const e of Ns.getState().activeSessions)e.parentID&&s.set(e.parentID,[...s.get(e.parentID)??[],e]);return s},jo=(s,e,t)=>{qe.getState().closeMainSurfaces(),e&&qt.getState().setActiveProjectIdOnly(e),dt.getState().setCurrentSession(s.id,Gs(s)||null),t()},Ri=(s,e,t)=>{const i=dt.getState();return Qc(s,e,Zc(e.id,ed(bg(),e.id),s==="delete"),{archiveSession:i.archiveSession,archiveSessions:i.archiveSessions,deleteSession:i.deleteSession,deleteSessions:i.deleteSessions},t)},yg=async(s,e,t)=>{try{if(e.length===0){await zr(s.id,Gs(s)||null,"open");return}for(const i of e)await zr(i.id,Gs(i)||Gs(s)||null,"done")}catch{me.error(t("sessions.sidebar.session.work.updateFailed"))}},xg=(s,e,t)=>{const i=Gs(s);if(!i)return;const a={directory:i,sessionId:s.id};Aa({current:e?Xc(s)??Ul:null,pin:r=>{Jr(a,true,r).catch(()=>me.error(t("sessions.sidebar.session.pin.pinFailed")))},unpin:()=>{Jr(a,false,null).catch(()=>me.error(t("sessions.sidebar.session.pin.unpinFailed")))}})},vg=async(s,e,t)=>{try{await dt.getState().updateSessionTitle(s,e)}catch{me.error(t("mobile.sessions.renameError"))}},It=Cp()(s=>({revealedKey:null,armedKey:null,renamingKey:null,setRevealed:(e,t)=>s(i=>t?{revealedKey:e,armedKey:null}:i.revealedKey===e?{revealedKey:null,armedKey:null}:i),arm:e=>s({armedKey:e}),startRename:e=>s({renamingKey:e,revealedKey:null,armedKey:null}),stopRename:()=>s({renamingKey:null}),forgetUnlisted:e=>s(t=>{const i=t.revealedKey!==null&&!e(t.revealedKey),a=t.renamingKey!==null&&!e(t.renamingKey);return!i&&!a?t:{revealedKey:i?null:t.revealedKey,armedKey:i?null:t.armedKey,renamingKey:a?null:t.renamingKey}}),reset:()=>s({revealedKey:null,armedKey:null,renamingKey:null})})),Bn=s=>{const e=oe.c(10);let t;e[0]!==s?(t=u=>u.revealedKey===s,e[0]=s,e[1]=t):t=e[1];const i=It(t);let a;e[2]!==s?(a=u=>u.armedKey===s,e[2]=s,e[3]=a):a=e[3];const r=It(a);let l;e[4]!==s?(l=u=>u.renamingKey===s,e[4]=s,e[5]=l):l=e[5];const o=It(l);let d;return e[6]!==r||e[7]!==o||e[8]!==i?(d={revealed:i,armed:r,renaming:o},e[6]=r,e[7]=o,e[8]=i,e[9]=d):d=e[9],d},hl=p.createContext(null),wg=hl.Provider,Sn=()=>{const s=p.useContext(hl);if(!s)throw new Error("useMobileSidebarActions outside MobileSidebarActionsProvider");return s},yr=s=>{const e=oe.c(12),{disabled:t,menu:i,children:a}=s,r=t===void 0?false:t,l=p.useRef(false);let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=(m,h)=>{l.current=m&&h.event.type.startsWith("touch")},e[0]=o):o=e[0];let d,u,c;e[1]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx("div",{}),u=()=>{l.current=false},c=m=>{l.current&&(l.current=false,m.preventDefault(),m.stopPropagation())},e[1]=d,e[2]=u,e[3]=c):(d=e[1],u=e[2],c=e[3]);let f;e[4]!==a?(f=n.jsx(td,{render:d,onTouchStart:u,onClickCapture:c,children:a}),e[4]=a,e[5]=f):f=e[5];let y;e[6]!==i?(y=n.jsx(sd,{children:i}),e[6]=i,e[7]=y):y=e[7];let g;return e[8]!==r||e[9]!==f||e[10]!==y?(g=n.jsxs(nd,{disabled:r,onOpenChange:o,children:[f,y]}),e[8]=r,e[9]=f,e[10]=y,e[11]=g):g=e[11],g},fi="shadow-[inset_0_0_0_100vmax_var(--interactive-selection)]",xr="text-interactive-selection-foreground",Sg={touchAction:"manipulation",minHeight:0,minWidth:0},yn=s=>{const e=oe.c(14),{expanded:t,kind:i,label:a,onToggle:r}=s,{t:l}=be();let o;e[0]!==t||e[1]!==i||e[2]!==a||e[3]!==l?(o=i==="session"?l(t?"sessions.sidebar.session.subsessions.collapse":"sessions.sidebar.session.subsessions.expand"):i==="run"?l(t?"sessions.sidebar.run.collapse":"sessions.sidebar.run.expand"):t?l("sessions.sidebar.group.collapseAria",{label:a}):l("sessions.sidebar.group.expandAria",{label:a}),e[0]=t,e[1]=i,e[2]=a,e[3]=l,e[4]=o):o=e[4];const d=o;let u;e[5]!==r?(u=y=>{y.stopPropagation(),r()},e[5]=r,e[6]=u):u=e[6];let c;e[7]!==t?(c=n.jsx(nr,{expanded:t}),e[7]=t,e[8]=c):c=e[8];let f;return e[9]!==d||e[10]!==t||e[11]!==u||e[12]!==c?(f=n.jsx("button",{type:"button",className:"flex size-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",style:Sg,"aria-label":d,"aria-expanded":t,onClick:u,children:c}),e[9]=d,e[10]=t,e[11]=u,e[12]=c,e[13]=f):f=e[13],f},vr=s=>{const e=oe.c(5),{slotLeft:t,children:i}=s,a=t-9;let r;e[0]!==a?(r={insetInlineStart:a},e[0]=a,e[1]=r):r=e[1];let l;return e[2]!==i||e[3]!==r?(l=n.jsx("span",{className:"absolute inset-y-0 z-10 flex items-center",style:r,children:i}),e[2]=i,e[3]=r,e[4]=l):l=e[4],l},mi=s=>{const e=oe.c(19),{indent:t,onSelect:i,ariaLabel:a,chevron:r,firstLine:l,secondLine:o}=s;let d;e[0]!==l?(d=n.jsx("span",{className:"flex h-5 min-w-0 items-center gap-2",children:l}),e[0]=l,e[1]=d):d=e[1];let u;e[2]!==r||e[3]!==o?(u=o||r?n.jsxs("span",{className:"flex h-4 min-w-0 items-center gap-1.5 text-muted-foreground",children:[r?n.jsx("span",{"aria-hidden":true,className:"size-3.5 shrink-0"}):null,o]}):null,e[2]=r,e[3]=o,e[4]=u):u=e[4];let c;e[5]!==d||e[6]!==u?(c=n.jsxs(n.Fragment,{children:[d,u]}),e[5]=d,e[6]=u,e[7]=c):c=e[7];const f=c;let y;e[8]!==a||e[9]!==t||e[10]!==f||e[11]!==i?(y=i?n.jsx("button",{type:"button",className:de("flex min-h-9 min-w-0 flex-1 flex-col gap-1 py-1.5 pe-3 text-start","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring"),style:{paddingInlineStart:t,touchAction:"manipulation"},"aria-label":a,onClick:i,children:f}):n.jsx("div",{className:"flex min-h-9 min-w-0 flex-1 flex-col gap-1 py-1.5 pe-3 text-start",style:{paddingInlineStart:t},children:f}),e[8]=a,e[9]=t,e[10]=f,e[11]=i,e[12]=y):y=e[12];let g;e[13]!==r||e[14]!==t?(g=r?n.jsx("span",{className:"absolute z-10 flex h-8 items-center",style:{insetInlineStart:t-9,top:22},children:r}):null,e[13]=r,e[14]=t,e[15]=g):g=e[15];let m;return e[16]!==y||e[17]!==g?(m=n.jsxs("div",{className:"relative flex min-w-0 flex-1",children:[y,g]}),e[16]=y,e[17]=g,e[18]=m):m=e[18],m},ds=s=>{const e=oe.c(13),{icon:t,glyph:i,label:a,revealed:r,onClick:l,tone:o,armed:d,disabled:u}=s,c=o===void 0?"default":o,f=d===void 0?false:d,y=u===void 0?false:u,g=r?0:-1,m=c==="destructive"?f?"rounded-lg bg-destructive text-destructive-foreground focus-visible:ring-destructive":"text-[var(--status-error)] active:opacity-80 focus-visible:ring-destructive":c==="success"?"text-status-success active:opacity-80 focus-visible:ring-ring":"text-muted-foreground active:text-foreground focus-visible:ring-ring";let h;e[0]!==m?(h=de("flex flex-1 items-center justify-center transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset disabled:opacity-40",m),e[0]=m,e[1]=h):h=e[1];let b;e[2]===Symbol.for("react.memo_cache_sentinel")?(b={touchAction:"manipulation"},e[2]=b):b=e[2];let v;e[3]!==i||e[4]!==t?(v=i??n.jsx(X,{name:t,className:t==="check"?"size-5":"size-[18px]"}),e[3]=i,e[4]=t,e[5]=v):v=e[5];let S;return e[6]!==y||e[7]!==a||e[8]!==l||e[9]!==g||e[10]!==h||e[11]!==v?(S=n.jsx("button",{type:"button",tabIndex:g,disabled:y,className:h,"aria-label":a,onClick:l,style:b,children:v}),e[6]=y,e[7]=a,e[8]=l,e[9]=g,e[10]=h,e[11]=v,e[12]=S):S=e[12],S},jg=s=>{const e=oe.c(16),{more:t,fewer:i,hiddenNodes:a,indent:r,onShow:l}=s,{t:o}=be();let d;e[0]!==a||e[1]!==l||e[2]!==o?(d=m=>n.jsxs("button",{type:"button",className:"flex min-h-9 items-center gap-2 py-1 pe-3 text-start text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",style:{touchAction:"manipulation"},onClick:()=>l(m),children:[n.jsx(X,{name:m==="more"?"arrow-down-s":"arrow-up-s",className:"size-4"}),n.jsx("span",{className:"typography-micro",children:o(m==="more"?"sessions.sidebar.group.showMore":"sessions.sidebar.group.showFewer")}),m==="more"?n.jsx(jf,{nodes:a}):null]}),e[0]=a,e[1]=l,e[2]=o,e[3]=d):d=e[3];const u=d;let c;e[4]!==r?(c={paddingInlineStart:r},e[4]=r,e[5]=c):c=e[5];let f;e[6]!==u||e[7]!==t?(f=t?u("more"):null,e[6]=u,e[7]=t,e[8]=f):f=e[8];let y;e[9]!==u||e[10]!==i?(y=i?u("fewer"):null,e[9]=u,e[10]=i,e[11]=y):y=e[11];let g;return e[12]!==c||e[13]!==f||e[14]!==y?(g=n.jsxs("div",{className:"flex w-full items-center gap-2",style:c,children:[f,y]}),e[12]=c,e[13]=f,e[14]=y,e[15]=g):g=e[15],g},gl=s=>s.children.flatMap(e=>[e.session.id,...gl(e)]),kg=s=>{const e=oe.c(266),{row:t,geometry:i,toggleParent:a}=s,{t:r}=be(),l=Sn(),{node:o,depth:d}=t,u=o.session;let c;e[0]!==u?(c=Gs(u),e[0]=u,e[1]=c):c=e[1];const f=c,{revealed:y,armed:g,renaming:m}=Bn(t.key);let h;e[2]!==u.title||e[3]!==r?(h=u.title?.trim()||r("mobile.sessions.untitled"),e[2]=u.title,e[3]=r,e[4]=h):h=e[4];const b=h,v=kf(u.id,u.directory,y||m);let S;e[5]!==u.id?(S=Te=>Te.currentSessionId===u.id,e[5]=u.id,e[6]=S):S=e[6];const w=dt(S),N=qe(Cg),R=w&&!N,T=aa(u.id),j=la(u.id),C=ca(u.id),k=C!==null,I=!k&&T&&(!R||j),E=da(u.id,k),z=(k||I)&&E,P=o.children.length>0,B=t.expanded===true;let $;e[7]!==B||e[8]!==P||e[9]!==o||e[10]!==u.id?($=P&&!B?[u.id,...gl(o)]:[u.id],e[7]=B,e[8]=P,e[9]=o,e[10]=u.id,e[11]=$):$=e[11];const D=gg($),M=!u.parentID,H=qe(Ng);let A;e[12]!==f||e[13]!==u.id?(A=Te=>ad(Te.ids,f||null,u.id),e[12]=f,e[13]=u.id,e[14]=A):A=e[14];const F=ta(A);let O;e[15]!==f||e[16]!==F||e[17]!==t.ownsWork||e[18]!==H||e[19]!==M?(O=H&&t.ownsWork&&M&&!Xi(f)&&!F,e[15]=f,e[16]=F,e[17]=t.ownsWork,e[18]=H,e[19]=M,e[20]=O):O=e[20];const K=O;let L;e[21]!==o||e[22]!==K?(L=K?Cf(o):[],e[21]=o,e[22]=K,e[23]=L):L=e[23];const V=L;let J;e[24]!==K||e[25]!==u||e[26]!==V||e[27]!==r?(J=K?{inWork:V.length>0,onToggle:()=>{yg(u,V,r)}}:void 0,e[24]=K,e[25]=u,e[26]=V,e[27]=r,e[28]=J):J=e[28];const G=J;let q;e[29]!==f||e[30]!==F||e[31]!==u||e[32]!==r||e[33]!==M?(q=M&&f?{pinned:F,onToggle:()=>xg(u,F,r)}:void 0,e[29]=f,e[30]=F,e[31]=u,e[32]=r,e[33]=M,e[34]=q):q=e[34];const U=q;let Z;e[35]!==t.key?(Z=Da(t.key),e[35]=t.key,e[36]=Z):Z=e[36];const te=Z;let se;e[37]!==k||e[38]!==u||e[39]!==G?.inWork?(se=!!G?.inWork&&!k&&id(u),e[37]=k,e[38]=u,e[39]=G?.inWork,e[40]=se):se=e[40];const ie=se;let ne;e[41]!==t.detailed||e[42]!==t.renderContext?(ne=t.detailed===true||Nf(t.renderContext),e[41]=t.detailed,e[42]=t.renderContext,e[43]=ne):ne=e[43];const ue=ne;let Q;e[44]!==ue||e[45]!==t.projectId||e[46]!==t.renderContext?(Q=Te=>ue&&t.renderContext==="timeline-mixed"&&t.projectId?Te.projects.find(xe=>xe.id===t.projectId)??null:null,e[44]=ue,e[45]=t.projectId,e[46]=t.renderContext,e[47]=Q):Q=e[47];const re=qt(Q),le=oi(),Ne=o.worktree?.branch??null;let Le;e[48]!==t.secondaryMeta||e[49]!==Ne?(Le=Rf(t.secondaryMeta,Ne),e[48]=t.secondaryMeta,e[49]=Ne,e[50]=Le):Le=e[50];const we=Le,{refLines:Re}=If(u,o.worktree,false),ae=Re[0]??null,ce=Math.max(0,Re.length-1);let Ee;e[51]!==ce||e[52]!==ae||e[53]!==Re?(Ee=Te=>ae?n.jsxs("span",{role:"img","aria-label":Re.map(Rg).join(", "),className:"inline-flex shrink-0 items-center gap-0.5 typography-micro text-muted-foreground",children:[n.jsx(X,{name:ae.icon,className:de("size-3",ae.color&&"oc-ref-tint"),style:ae.color?Li(ae.color):void 0}),Te?n.jsx("span",{className:"leading-none tabular-nums",children:ae.label}):null,Te&&ce>0?n.jsxs("span",{className:"leading-none tabular-nums text-muted-foreground",children:["+",ce]}):null]}):null,e[51]=ce,e[52]=ae,e[53]=Re,e[54]=Ee):Ee=e[54];const Ie=Ee,ke=t.secondaryMeta?.inSpace===true;let Oe;e[55]!==t.projectId?(Oe=Te=>t.projectId?Te.projects.find(xe=>xe.id===t.projectId)?.path??null:null,e[55]=t.projectId,e[56]=Oe):Oe=e[56];const Fe=qt(Oe),ut=u.id,Ke=u.directory??null;let Be;e[57]!==Ke?(Be=Zs(Ke),e[57]=Ke,e[58]=Be):Be=e[58];const He=t.projectId??null,Je=t.renderContext==="project"&&!t.archived,$e=ke?null:t.secondaryMeta?.branchLabel??null;let it;e[59]!==o.worktree||e[60]!==Fe||e[61]!==u.id||e[62]!==Be||e[63]!==He||e[64]!==Je||e[65]!==$e?(it={shown:true,sessionId:ut,directory:Be,projectId:He,projectRoot:Fe,worktree:o.worktree,inProjectTree:Je,metaBranch:$e},e[59]=o.worktree,e[60]=Fe,e[61]=u.id,e[62]=Be,e[63]=He,e[64]=Je,e[65]=$e,e[66]=it):it=e[66];const tt=Pf(it);let ee;e[67]!==l.close||e[68]!==t.projectId||e[69]!==u?(ee=()=>jo(u,t.projectId,l.close),e[67]=l.close,e[68]=t.projectId,e[69]=u,e[70]=ee):ee=e[70];let ge;e[71]!==tt||e[72]!==ee?(ge=n.jsx(pl,{marks:tt,onOpenRow:ee}),e[71]=tt,e[72]=ee,e[73]=ge):ge=e[73];const st=ge;let jt;e[74]!==P||e[75]!==t.archived||e[76]!==t.renderContext||e[77]!==u.id||e[78]!==a?(jt=P?()=>a(Tf(t.renderContext,t.archived,u.id)):void 0,e[74]=P,e[75]=t.archived,e[76]=t.renderContext,e[77]=u.id,e[78]=a,e[79]=jt):jt=e[79];const Y=jt;let Pe;e[80]!==t.key?(Pe=Te=>It.getState().setRevealed(t.key,Te),e[80]=t.key,e[81]=Pe):Pe=e[81];const he=Pe;let Ve;e[82]!==l.close||e[83]!==y||e[84]!==t.projectId||e[85]!==u||e[86]!==he?(Ve=()=>{if(y){he(false);return}jo(u,t.projectId,l.close)},e[82]=l.close,e[83]=y,e[84]=t.projectId,e[85]=u,e[86]=he,e[87]=Ve):Ve=e[87];const ft=Ve,at=Ig,pt=rd(xa()),Qe=od();let Ye;e[88]!==f||e[89]!==Qe||e[90]!==u.id||e[91]!==u.title||e[92]!==r?(Ye=Te=>{_f({entry:Te,t:r,session:{id:u.id,title:u.title,directory:f},loadRecords:()=>f?Qe({directory:f,sessionID:u.id}).catch(Pg):Promise.resolve(null),onLoadFailed:()=>me.error(r("sessions.sidebar.session.export.failedLoadHistory"))})},e[88]=f,e[89]=Qe,e[90]=u.id,e[91]=u.title,e[92]=r,e[93]=Ye):Ye=e[93];const ht=Ye,rt=D.hasPermission||D.hasForm;let mt;e[94]!==v.pending||e[95]!==k||e[96]!==I||e[97]!==r||e[98]!==C||e[99]!==rt?(mt=v.pending?n.jsx(X,{name:"loader-4",className:"size-3 shrink-0 animate-spin text-status-info","aria-label":r("sessions.aiRename.generating")}):(k||I)&&!rt?n.jsx(ua,{state:C??"unread"}):null,e[94]=v.pending,e[95]=k,e[96]=I,e[97]=r,e[98]=C,e[99]=rt,e[100]=mt):mt=e[100];const Se=mt;let ot;e[101]!==k||e[102]!==u.id||e[103]!==z||e[104]!==rt?(ot=z&&!rt?n.jsx(er,{sessionId:u.id,running:k,className:"shrink-0 typography-micro"}):null,e[101]=k,e[102]=u.id,e[103]=z,e[104]=rt,e[105]=ot):ot=e[105];const Ze=ot;let xt;e[106]!==te||e[107]!==F||e[108]!==r?(xt=F&&!te?n.jsx(X,{name:"pushpin",className:"size-3 shrink-0 text-muted-foreground","aria-label":r("sessions.sidebar.session.status.pinned")}):null,e[106]=te,e[107]=F,e[108]=r,e[109]=xt):xt=e[109];const vt=xt;let lt;e[110]!==ie||e[111]!==r?(lt=ie?n.jsx(X,{name:"check",className:"size-3.5 shrink-0 text-muted-foreground","aria-label":r("sessions.sidebar.session.work.doneSuggested")}):null,e[110]=ie,e[111]=r,e[112]=lt):lt=e[112];const De=lt;let gt;e[113]!==R||e[114]!==k||e[115]!==D||e[116]!==t.repeat||e[117]!==I?(gt=de("block min-w-0 flex-1 truncate oc-ui-start-align typography-ui-label",hg({active:R,repeat:t.repeat,unread:I,running:k,pending:D})),e[113]=R,e[114]=k,e[115]=D,e[116]=t.repeat,e[117]=I,e[118]=gt):gt=e[118];let wt;e[119]!==gt||e[120]!==b?(wt=n.jsx("span",{dir:"auto",className:gt,children:b}),e[119]=gt,e[120]=b,e[121]=wt):wt=e[121];const We=wt;let ct;e[122]!==v||e[123]!==u.id||e[124]!==r||e[125]!==b?(ct=(Te,xe)=>n.jsx(br,{initialTitle:b,indent:Te,aiRename:v,className:xe,onSubmit:kt=>{at(),vg(u.id,kt,r)},onCancel:at}),e[122]=v,e[123]=u.id,e[124]=r,e[125]=b,e[126]=ct):ct=e[126];const Me=ct;let Dt;if(ue){let Te;e[127]!==re||e[128]!==le?(Te=re?n.jsxs(n.Fragment,{children:[n.jsx(wn,{project:re,size:"xs"}),le?n.jsx(ai,{project:re,separated:false}):null]}):null,e[127]=re,e[128]=le,e[129]=Te):Te=e[129];const xe=Te;let kt;e[130]!==we||e[131]!==ae||e[132]!==re||e[133]!==u||e[134]!==rt?(kt=re||we||ya(u)||ae||rt,e[130]=we,e[131]=ae,e[132]=re,e[133]=u,e[134]=rt,e[135]=kt):kt=e[135];const Ht=!!kt;let rs;e[136]!==d||e[137]!==i?(rs=i.detailedLeft(d),e[136]=d,e[137]=i,e[138]=rs):rs=e[138];const Vt=m?void 0:ft;let Et;e[139]!==B||e[140]!==b||e[141]!==Y?(Et=Y?n.jsx(yn,{expanded:B,label:b,kind:"session",onToggle:Y}):null,e[139]=B,e[140]=b,e[141]=Y,e[142]=Et):Et=e[142];let Xt;e[143]!==De||e[144]!==Ht||e[145]!==Se||e[146]!==st||e[147]!==vt||e[148]!==Me||e[149]!==m||e[150]!==Ze||e[151]!==We?(Xt=m?Me(0,"h-[1lh] pe-0 typography-ui-label [&_button]:size-6 [&_button>svg]:size-3.5"):n.jsxs(n.Fragment,{children:[We,Ht?null:st,vt,De,Se,Ze]}),e[143]=De,e[144]=Ht,e[145]=Se,e[146]=st,e[147]=vt,e[148]=Me,e[149]=m,e[150]=Ze,e[151]=We,e[152]=Xt):Xt=e[152];let Qt;e[153]!==we||e[154]!==Ht||e[155]!==ke||e[156]!==xe||e[157]!==st||e[158]!==D||e[159]!==Ie||e[160]!==u||e[161]!==r?(Qt=Ht?n.jsxs(n.Fragment,{children:[xe,we?n.jsxs(n.Fragment,{children:[ke?n.jsx(X,{name:"instance",className:"size-3.5 shrink-0","aria-hidden":false,role:"img","aria-label":r("sessions.sidebar.group.space")}):n.jsx(X,{name:"git-branch",className:"size-3.5 shrink-0"}),n.jsx("span",{className:"block min-w-0 truncate typography-micro",children:we})]}):null,n.jsxs("span",{className:"ms-auto flex shrink-0 items-center gap-1.5",children:[n.jsx(vo,{session:u}),Ie(true),st,n.jsx(wo,{...D})]})]}):null,e[153]=we,e[154]=Ht,e[155]=ke,e[156]=xe,e[157]=st,e[158]=D,e[159]=Ie,e[160]=u,e[161]=r,e[162]=Qt):Qt=e[162];let Ss;e[163]!==rs||e[164]!==Vt||e[165]!==Et||e[166]!==Xt||e[167]!==Qt?(Ss=n.jsx(mi,{indent:rs,onSelect:Vt,chevron:Et,firstLine:Xt,secondLine:Qt}),e[163]=rs,e[164]=Vt,e[165]=Et,e[166]=Xt,e[167]=Qt,e[168]=Ss):Ss=e[168],Dt=Ss}else{let Te;e[169]!==d||e[170]!==B||e[171]!==i||e[172]!==b||e[173]!==Y?(Te=Y?n.jsx(vr,{slotLeft:i.slotLeft(d),children:n.jsx(yn,{expanded:B,label:b,kind:"session",onToggle:Y})}):null,e[169]=d,e[170]=B,e[171]=i,e[172]=b,e[173]=Y,e[174]=Te):Te=e[174];let xe;e[175]!==d||e[176]!==De||e[177]!==i||e[178]!==Se||e[179]!==st||e[180]!==D||e[181]!==vt||e[182]!==Ie||e[183]!==Me||e[184]!==m||e[185]!==ft||e[186]!==u||e[187]!==Ze||e[188]!==We?(xe=m?Me(i.textLeft(d)):n.jsxs("button",{type:"button",className:"flex h-9 min-w-0 flex-1 items-center gap-2.5 pe-3.5 text-start focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",style:{paddingInlineStart:i.textLeft(d),touchAction:"manipulation"},onClick:ft,children:[We,n.jsx(vo,{session:u}),Ie(false),st,n.jsx(wo,{...D}),vt,De,Se,Ze]}),e[175]=d,e[176]=De,e[177]=i,e[178]=Se,e[179]=st,e[180]=D,e[181]=vt,e[182]=Ie,e[183]=Me,e[184]=m,e[185]=ft,e[186]=u,e[187]=Ze,e[188]=We,e[189]=xe):xe=e[189];let kt;e[190]!==Te||e[191]!==xe?(kt=n.jsxs(n.Fragment,{children:[Te,xe]}),e[190]=Te,e[191]=xe,e[192]=kt):kt=e[192],Dt=kt}let nt;e[193]!==u.id?(nt=n.jsx(Ef,{sessionId:u.id,Item:cs,showShortcut:false}),e[193]=u.id,e[194]=nt):nt=e[194];let pe;e[195]!==t.key?(pe=()=>It.getState().startRename(t.key),e[195]=t.key,e[196]=pe):pe=e[196];let ye;e[197]===Symbol.for("react.memo_cache_sentinel")?(ye=n.jsx(X,{name:"edit",className:"me-1 size-4"}),e[197]=ye):ye=e[197];let _e;e[198]!==r?(_e=r("sessions.sidebar.session.menu.rename"),e[198]=r,e[199]=_e):_e=e[199];let Ce;e[200]!==pe||e[201]!==_e?(Ce=n.jsxs(cs,{onClick:pe,children:[ye,_e]}),e[200]=pe,e[201]=_e,e[202]=Ce):Ce=e[202];let Ae;e[203]!==U||e[204]!==r?(Ae=U?n.jsxs(cs,{onClick:U.onToggle,children:[n.jsx(X,{name:U.pinned?"unpin":"pushpin",className:"me-1 size-4"}),U.pinned?r("sessions.sidebar.session.menu.unpin"):r("sessions.sidebar.session.menu.pin")]}):null,e[203]=U,e[204]=r,e[205]=Ae):Ae=e[205];let et;e[206]!==r||e[207]!==G?(et=G?n.jsxs(cs,{onClick:G.onToggle,children:[n.jsx(X,{name:G.inWork?"check":"eye",className:"me-1 size-4"}),G.inWork?r("sessions.sidebar.session.work.markDone"):r("sessions.sidebar.session.work.track")]}):null,e[206]=r,e[207]=G,e[208]=et):et=e[208];let Wt;e[209]!==u||e[210]!==r?(Wt=()=>{Ri("archive",u,r)},e[209]=u,e[210]=r,e[211]=Wt):Wt=e[211];let Ot;e[212]===Symbol.for("react.memo_cache_sentinel")?(Ot=n.jsx(X,{name:"archive",className:"me-1 size-4"}),e[212]=Ot):Ot=e[212];let Ue;e[213]!==r?(Ue=r("sessions.sidebar.bulkActions.archive"),e[213]=r,e[214]=Ue):Ue=e[214];let At;e[215]!==Wt||e[216]!==Ue?(At=n.jsxs(cs,{onClick:Wt,children:[Ot,Ue]}),e[215]=Wt,e[216]=Ue,e[217]=At):At=e[217];const bt=pt.length>0?n.jsx(va,{}):null;let Jt;e[218]!==ht?(Jt=Te=>n.jsxs(cs,{onClick:()=>ht(Te),children:[n.jsx(ii,{icon:Te.icon,iconSrc:Te.iconSrc,className:"me-1 size-4"}),Te.action.label]},`${Te.guest.id}:${Te.action.id}`),e[218]=ht,e[219]=Jt):Jt=e[219];const $t=pt.map(Jt);let ys;e[220]!==nt||e[221]!==Ce||e[222]!==Ae||e[223]!==et||e[224]!==At||e[225]!==bt||e[226]!==$t?(ys=n.jsxs(n.Fragment,{children:[nt,Ce,Ae,et,At,bt,$t]}),e[220]=nt,e[221]=Ce,e[222]=Ae,e[223]=et,e[224]=At,e[225]=bt,e[226]=$t,e[227]=ys):ys=e[227];const hs=ys,xs=m||y,vs=ug+(G?Qs:0)+(U?Qs:0),us=R&&!t.repeat&&fi;let _t;e[228]!==us?(_t=de("relative flex w-full items-center bg-background transition-colors",us),e[228]=us,e[229]=_t):_t=e[229];let ws;e[230]!==u||e[231]!==he||e[232]!==r?(ws=()=>{he(false),Ri("archive",u,r)},e[230]=u,e[231]=he,e[232]=r,e[233]=ws):ws=e[233];let Mt;e[234]!==t.key?(Mt=()=>It.getState().arm(t.key),e[234]=t.key,e[235]=Mt):Mt=e[235];let Pt;e[236]!==u||e[237]!==he||e[238]!==r?(Pt=()=>{he(false),Ri("delete",u,r)},e[236]=u,e[237]=he,e[238]=r,e[239]=Pt):Pt=e[239];let Lt;e[240]!==t.key?(Lt=()=>It.getState().startRename(t.key),e[240]=t.key,e[241]=Lt):Lt=e[241];let is;e[242]!==g||e[243]!==U||e[244]!==y||e[245]!==u.id||e[246]!==he||e[247]!==ws||e[248]!==Mt||e[249]!==Pt||e[250]!==Lt||e[251]!==b||e[252]!==G?(is=n.jsx(mg,{sessionId:u.id,title:b,revealed:y,confirmingDelete:g,onArchive:ws,onRequestDelete:Mt,onConfirmDelete:Pt,onRequestRename:Lt,onRevealedChange:he,work:G,pin:U}),e[242]=g,e[243]=U,e[244]=y,e[245]=u.id,e[246]=he,e[247]=ws,e[248]=Mt,e[249]=Pt,e[250]=Lt,e[251]=b,e[252]=G,e[253]=is):is=e[253];let Yt;e[254]!==R||e[255]!==Dt||e[256]!==y||e[257]!==he||e[258]!==vs||e[259]!==_t||e[260]!==is?(Yt=n.jsx(Ln,{actionsWidth:vs,revealed:y,onRevealedChange:he,dataActiveSession:R,contentClassName:_t,actions:is,children:Dt}),e[254]=R,e[255]=Dt,e[256]=y,e[257]=he,e[258]=vs,e[259]=_t,e[260]=is,e[261]=Yt):Yt=e[261];let Kt;return e[262]!==hs||e[263]!==xs||e[264]!==Yt?(Kt=n.jsx(yr,{disabled:xs,menu:hs,children:Yt}),e[262]=hs,e[263]=xs,e[264]=Yt,e[265]=Kt):Kt=e[265],Kt};function Cg(s){return s.runOverviewKey!==null}function Ng(s){return s.sessionWorkEnabled}function Rg(s){return s.text}function Ig(){return It.getState().stopRename()}function Pg(){return null}const bl="flex min-h-10 min-w-0 flex-1 items-center gap-1.5 ps-2 pe-3 py-1.5 text-start transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",pi=()=>{const s=It.getState();return s.revealedKey?(s.setRevealed(s.revealedKey,false),true):false},yl=s=>{const e=oe.c(18),{label:t,collapsed:i,onToggle:a}=s,{t:r}=be();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=de(bl,"w-full gap-1"),e[0]=l):l=e[0];let o;e[1]!==a?(o=()=>{pi()||a()},e[1]=a,e[2]=o):o=e[2];const d=!i;let u;e[3]!==i||e[4]!==t||e[5]!==r?(u=i?r("sessions.sidebar.group.expandAria",{label:t}):r("sessions.sidebar.group.collapseAria",{label:t}),e[3]=i,e[4]=t,e[5]=r,e[6]=u):u=e[6];let c;e[7]===Symbol.for("react.memo_cache_sentinel")?(c={touchAction:"manipulation"},e[7]=c):c=e[7];let f;e[8]!==t?(f=n.jsx("span",{className:"min-w-0 truncate typography-ui-label font-medium text-muted-foreground",children:t}),e[8]=t,e[9]=f):f=e[9];const y=i?"arrow-right-s":"arrow-down-s";let g;e[10]!==y?(g=n.jsx(X,{name:y,className:"size-4 shrink-0 text-muted-foreground"}),e[10]=y,e[11]=g):g=e[11];let m;return e[12]!==o||e[13]!==d||e[14]!==u||e[15]!==f||e[16]!==g?(m=n.jsxs("button",{type:"button",className:l,onClick:o,"aria-expanded":d,"aria-label":u,style:c,children:[f,g]}),e[12]=o,e[13]=d,e[14]=u,e[15]=f,e[16]=g,e[17]=m):m=e[17],m},Eg=s=>{const e=oe.c(8),{row:t,onToggle:i}=s,{t:a}=be();let r;e[0]!==t.activityKey||e[1]!==t.label||e[2]!==a?(r=t.label??(Af(t.activityKey)?a(Df[t.activityKey]):""),e[0]=t.activityKey,e[1]=t.label,e[2]=a,e[3]=r):r=e[3];let l;return e[4]!==i||e[5]!==t.collapsed||e[6]!==r?(l=n.jsx(yl,{label:r,collapsed:t.collapsed,onToggle:i}),e[4]=i,e[5]=t.collapsed,e[6]=r,e[7]=l):l=e[7],l},Tg=s=>{const e=oe.c(7),{row:t,onToggle:i}=s,{t:a}=be();let r;e[0]!==t.label||e[1]!==a?(r=t.label??a("sessions.sidebar.activity.projectsTitle"),e[0]=t.label,e[1]=a,e[2]=r):r=e[2];let l;return e[3]!==i||e[4]!==t.collapsed||e[5]!==r?(l=n.jsx(yl,{label:r,collapsed:t.collapsed,onToggle:i}),e[3]=i,e[4]=t.collapsed,e[5]=r,e[6]=l):l=e[6],l},ko=s=>{const e=oe.c(10),{icon:t,label:i,onClick:a}=s;let r;e[0]!==a?(r=c=>{c.stopPropagation(),a()},e[0]=a,e[1]=r):r=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l={touchAction:"manipulation"},e[2]=l):l=e[2];const o=t==="add"?"size-4":"size-3.5";let d;e[3]!==t||e[4]!==o?(d=n.jsx(X,{name:t,className:o}),e[3]=t,e[4]=o,e[5]=d):d=e[5];let u;return e[6]!==i||e[7]!==r||e[8]!==d?(u=n.jsx("button",{type:"button",className:"flex size-9 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":i,title:i,onClick:r,style:l,children:d}),e[6]=i,e[7]=r,e[8]=d,e[9]=u):u=e[9],u},_g=s=>{const e=oe.c(70),{row:t,label:i,isRepo:a,active:r,onToggle:l,onNewSession:o,onRemove:d}=s,{t:u}=be(),c=Sn(),f=t.section.project,{revealed:y,armed:g}=Bn(t.key);let m;e[0]!==t.key?(m=A=>It.getState().setRevealed(t.key,A),e[0]=t.key,e[1]=m):m=e[1];const h=m;let b;e[2]!==g||e[3]!==i||e[4]!==u?(b=g?u("mobile.sessions.confirmRemoveProjectAria",{label:i}):u("mobile.sessions.removeProjectAria",{label:i}),e[2]=g,e[3]=i,e[4]=u,e[5]=b):b=e[5];let v;e[6]!==g||e[7]!==i||e[8]!==d||e[9]!==t.key||e[10]!==h||e[11]!==u?(v=()=>{if(!g){It.getState().arm(t.key);return}h(false),d(),me.success(u("mobile.sessions.toast.projectRemoved",{label:i}))},e[6]=g,e[7]=i,e[8]=d,e[9]=t.key,e[10]=h,e[11]=u,e[12]=v):v=e[12];let S;e[13]!==g||e[14]!==y||e[15]!==b||e[16]!==v?(S=n.jsx(ds,{icon:"delete-bin",tone:"destructive",armed:g,label:b,revealed:y,onClick:v}),e[13]=g,e[14]=y,e[15]=b,e[16]=v,e[17]=S):S=e[17];let w;e[18]!==i||e[19]!==u?(w=u("mobile.sessions.editProjectAria",{label:i}),e[18]=i,e[19]=u,e[20]=w):w=e[20];let N;e[21]!==c||e[22]!==f.id||e[23]!==h?(N=()=>{h(false),c.openProjectEdit(f.id)},e[21]=c,e[22]=f.id,e[23]=h,e[24]=N):N=e[24];let R;e[25]!==y||e[26]!==w||e[27]!==N?(R=n.jsx(ds,{icon:"edit",label:w,revealed:y,onClick:N}),e[25]=y,e[26]=w,e[27]=N,e[28]=R):R=e[28];let T;e[29]!==S||e[30]!==R?(T=n.jsxs(n.Fragment,{children:[S,R]}),e[29]=S,e[30]=R,e[31]=T):T=e[31];const j=r||void 0;let C;e[32]!==l?(C=()=>{pi()||l()},e[32]=l,e[33]=C):C=e[33];const k=!t.collapsed;let I;e[34]!==i||e[35]!==t.collapsed||e[36]!==u?(I=t.collapsed?u("sessions.sidebar.group.expandAria",{label:i}):u("sessions.sidebar.group.collapseAria",{label:i}),e[34]=i,e[35]=t.collapsed,e[36]=u,e[37]=I):I=e[37];let E;e[38]===Symbol.for("react.memo_cache_sentinel")?(E={touchAction:"manipulation"},e[38]=E):E=e[38];let z;e[39]!==f?(z=n.jsx(wn,{project:f,size:"xs"}),e[39]=f,e[40]=z):z=e[40];let P;e[41]!==i?(P=n.jsx("span",{className:"block min-w-0 flex-1 truncate ps-1 typography-ui-label font-medium text-foreground",children:i}),e[41]=i,e[42]=P):P=e[42];let B;e[43]!==C||e[44]!==k||e[45]!==I||e[46]!==z||e[47]!==P?(B=n.jsxs("button",{type:"button",className:bl,onClick:C,"aria-expanded":k,"aria-label":I,style:E,children:[z,P]}),e[43]=C,e[44]=k,e[45]=I,e[46]=z,e[47]=P,e[48]=B):B=e[48];let $;e[49]!==c||e[50]!==a||e[51]!==f.id||e[52]!==u?($=a?n.jsx(ko,{icon:"git-branch",label:u("sessions.sidebar.project.actions.newWorktree"),onClick:()=>c.openNewWorktree(f.id)}):null,e[49]=c,e[50]=a,e[51]=f.id,e[52]=u,e[53]=$):$=e[53];let _;e[54]!==i||e[55]!==u?(_=u("mobile.sessions.newSessionInProjectAria",{label:i}),e[54]=i,e[55]=u,e[56]=_):_=e[56];let D;e[57]!==o||e[58]!==_?(D=n.jsx(ko,{icon:"add",label:_,onClick:o}),e[57]=o,e[58]=_,e[59]=D):D=e[59];let M;e[60]!==B||e[61]!==$||e[62]!==D||e[63]!==j?(M=n.jsxs("div",{"data-active-project":j,className:"flex min-h-10 w-full items-center",children:[B,$,D]}),e[60]=B,e[61]=$,e[62]=D,e[63]=j,e[64]=M):M=e[64];let H;return e[65]!==y||e[66]!==h||e[67]!==M||e[68]!==T?(H=n.jsx(Ln,{actionsWidth:2*Qs,revealed:y,onRevealedChange:h,actions:T,children:M}),e[65]=y,e[66]=h,e[67]=M,e[68]=T,e[69]=H):H=e[69],H},Ag=s=>{const e=oe.c(27),{row:t,geometry:i,onToggle:a}=s,{t:r}=be(),l=t.group.label,o=!t.collapsed;let d;e[0]!==a||e[1]!==t.empty||e[2]!==t.groupKey?(d=()=>{!pi()&&!t.empty&&a(t.groupKey)},e[0]=a,e[1]=t.empty,e[2]=t.groupKey,e[3]=d):d=e[3];const u=t.empty?void 0:o;let c;e[4]!==o||e[5]!==l||e[6]!==t.empty||e[7]!==r?(c=t.empty?l:o?r("sessions.sidebar.group.collapseAria",{label:l}):r("sessions.sidebar.group.expandAria",{label:l}),e[4]=o,e[5]=l,e[6]=t.empty,e[7]=r,e[8]=c):c=e[8];let f;e[9]!==i||e[10]!==t.depth?(f=i.slotLeft(t.depth),e[9]=i,e[10]=t.depth,e[11]=f):f=e[11];let y;e[12]!==f?(y={paddingInlineStart:f,touchAction:"manipulation"},e[12]=f,e[13]=y):y=e[13];let g;e[14]!==o||e[15]!==t.empty?(g=t.empty?n.jsx("span",{"aria-hidden":true,className:"size-3.5 shrink-0"}):n.jsx(nr,{expanded:o}),e[14]=o,e[15]=t.empty,e[16]=g):g=e[16];let m;e[17]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(X,{name:"folder",className:"mx-px size-3 shrink-0 text-muted-foreground"}),e[17]=m):m=e[17];let h;e[18]!==l?(h=n.jsx("span",{className:"block min-w-0 flex-1 truncate typography-ui-label font-medium oc-group-label",children:l}),e[18]=l,e[19]=h):h=e[19];let b;return e[20]!==d||e[21]!==u||e[22]!==c||e[23]!==y||e[24]!==g||e[25]!==h?(b=n.jsxs("button",{type:"button",className:"flex min-h-10 w-full items-center gap-0.5 py-1 pe-3 text-start focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",onClick:d,"aria-expanded":u,"aria-label":c,style:y,children:[g,m,h]}),e[20]=d,e[21]=u,e[22]=c,e[23]=y,e[24]=g,e[25]=h,e[26]=b):b=e[26],b},Dg=s=>{const e=oe.c(34),{row:t,geometry:i}=s,{t:a}=be(),r=!t.collapsed;let l;e[0]!==t.mixed||e[1]!==t.projectId?(l=w=>t.mixed?w.projects.find(N=>N.id===t.projectId):void 0,e[0]=t.mixed,e[1]=t.projectId,e[2]=l):l=e[2];const o=qt(l);let d;e[3]!==t.empty||e[4]!==t.folder?(d=()=>{!pi()&&!t.empty&&cd.getState().toggleFolderCollapse(t.folder.id)},e[3]=t.empty,e[4]=t.folder,e[5]=d):d=e[5];const u=t.empty?void 0:r;let c;e[6]!==r||e[7]!==t.displayName||e[8]!==t.empty||e[9]!==a?(c=t.empty?t.displayName:r?a("sessions.sidebar.folderItem.collapseAria",{folderName:t.displayName}):a("sessions.sidebar.folderItem.expandAria",{folderName:t.displayName}),e[6]=r,e[7]=t.displayName,e[8]=t.empty,e[9]=a,e[10]=c):c=e[10];let f;e[11]!==i||e[12]!==t.depth?(f=i.slotLeft(t.depth),e[11]=i,e[12]=t.depth,e[13]=f):f=e[13];let y;e[14]!==f?(y={paddingInlineStart:f,touchAction:"manipulation"},e[14]=f,e[15]=y):y=e[15];let g;e[16]!==r||e[17]!==t.empty?(g=t.empty?n.jsx("span",{"aria-hidden":true,className:"size-3.5 shrink-0"}):n.jsx(nr,{expanded:r}),e[16]=r,e[17]=t.empty,e[18]=g):g=e[18];const m=r&&!t.empty?"folder-open":"folder";let h;e[19]!==m?(h=n.jsx(X,{name:m,className:"mx-px size-3 shrink-0 text-muted-foreground"}),e[19]=m,e[20]=h):h=e[20];let b;e[21]!==t.displayName?(b=n.jsx("span",{className:"block min-w-0 flex-1 truncate typography-ui-label font-medium oc-group-label",children:t.displayName}),e[21]=t.displayName,e[22]=b):b=e[22];let v;e[23]!==o?(v=o?n.jsx("span",{className:"min-w-0 shrink-[2] truncate typography-micro text-muted-foreground",children:ld(o.label?.trim()||o.path)}):null,e[23]=o,e[24]=v):v=e[24];let S;return e[25]!==b||e[26]!==v||e[27]!==d||e[28]!==u||e[29]!==c||e[30]!==y||e[31]!==g||e[32]!==h?(S=n.jsxs("button",{type:"button",className:"flex min-h-10 w-full items-center gap-0.5 py-1 pe-3 text-start focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",onClick:d,"aria-expanded":u,"aria-label":c,style:y,children:[g,h,b,v]}),e[25]=b,e[26]=v,e[27]=d,e[28]=u,e[29]=c,e[30]=y,e[31]=g,e[32]=h,e[33]=S):S=e[33],S},Og=s=>{const e=oe.c(23),{row:t,indent:i,onRetry:a,onGrantAccess:r}=s,{t:l}=be();let o;e[0]!==t.status.state||e[1]!==l?(o=t.status.state==="permission-denied"?l("sessions.sidebar.group.empty.permissionDenied"):t.status.state==="load-failed"?l("sessions.sidebar.group.empty.loadFailed"):t.status.state==="initialization-failed"?l("sessions.sidebar.group.empty.initializationFailed"):l("sessions.sidebar.group.empty.loadingSessions"),e[0]=t.status.state,e[1]=l,e[2]=o):o=e[2];const d=o;let u;e[3]!==i?(u={paddingInlineStart:i},e[3]=i,e[4]=u):u=e[4];let c;e[5]!==t.status.state?(c=t.status.state==="loading"?n.jsx(wa,{className:"size-3"}):null,e[5]=t.status.state,e[6]=c):c=e[6];let f;e[7]!==d?(f=n.jsx("span",{children:d}),e[7]=d,e[8]=f):f=e[8];let y;e[9]!==r||e[10]!==t.status.canGrantAccess||e[11]!==l?(y=t.status.canGrantAccess?n.jsx(ze,{variant:"link",size:"xs",className:"h-auto p-0 typography-micro",onClick:r,children:l("sessions.sidebar.group.empty.grantAccess")}):null,e[9]=r,e[10]=t.status.canGrantAccess,e[11]=l,e[12]=y):y=e[12];let g;e[13]!==a||e[14]!==t.status.state||e[15]!==l?(g=t.status.state!=="loading"?n.jsx(ze,{variant:"link",size:"xs",className:"h-auto p-0 typography-micro",onClick:a,children:l("sessions.sidebar.group.empty.retry")}):null,e[13]=a,e[14]=t.status.state,e[15]=l,e[16]=g):g=e[16];let m;return e[17]!==u||e[18]!==c||e[19]!==f||e[20]!==y||e[21]!==g?(m=n.jsxs("div",{className:"flex min-h-9 flex-wrap items-center gap-2 py-1 pe-3 typography-micro text-muted-foreground",style:u,children:[c,f,y,g]}),e[17]=u,e[18]=c,e[19]=f,e[20]=y,e[21]=g,e[22]=m):m=e[22],m},Mg=4,Co=s=>{const e=oe.c(4),{providerIDs:t}=s;let i;e[0]!==t?(i=t.slice(0,Mg).map(Lg),e[0]=t,e[1]=i):i=e[1];let a;return e[2]!==i?(a=n.jsx("span",{className:"inline-flex shrink-0 items-center -space-x-1",children:i}),e[2]=i,e[3]=a):a=e[3],a};function Lg(s){return n.jsx("span",{className:"inline-flex size-4 items-center justify-center rounded-full bg-background ring-1 ring-background",children:n.jsx(dd,{providerId:s,className:"size-3 opacity-80"})},s)}const wr="flex h-9 min-w-0 flex-1 items-center gap-2.5 pe-3.5 text-start focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",Sr=(s,e)=>{const t=oe.c(3);let i;return t[0]!==s||t[1]!==e?(i=a=>e&&s?a.projects.find(r=>r.id===s)??null:null,t[0]=s,t[1]=e,t[2]=i):i=t[2],qt(i)},jr=s=>{const e=oe.c(5),{slotLeft:t,children:i}=s;let a;e[0]!==t?(a={insetInlineStart:t},e[0]=t,e[1]=a):a=e[1];let r;return e[2]!==i||e[3]!==a?(r=n.jsx("span",{className:"pointer-events-none absolute inset-y-0 z-10 flex w-3.5 items-center justify-center",style:a,children:i}),e[2]=i,e[3]=a,e[4]=r):r=e[4],r},Bg=s=>{const e=oe.c(232),{row:t,geometry:i,onToggle:a}=s,{t:r}=be(),l=Sn(),{revealed:o,renaming:d}=Bn(t.key);let u;e[0]!==l.close||e[1]!==t.collapsed||e[2]!==t.group||e[3]!==t.projectId?(u={group:t.group,projectId:t.projectId,collapsed:t.collapsed,onNavigate:l.close},e[0]=l.close,e[1]=t.collapsed,e[2]=t.group,e[3]=t.projectId,e[4]=u):u=e[4];const c=Lf(u),{worktree:f,space:y,spaceName:g,project:m,refs:h,label:b,secondName:v,branch:S,title:w,inWork:N,selected:R,finishing:T,worktreeRemoving:j,activityState:C}=c,k=!!y,I=m?.id??t.projectId??null;let E;e[5]!==S||e[6]!==k||e[7]!==I||e[8]!==c.directory?(E={space:k,projectId:I,directory:c.directory,branch:S},e[5]=S,e[6]=k,e[7]=I,e[8]=c.directory,e[9]=E):E=e[9];const z=Bf(E);let P;e[10]!==c?(P=()=>c.open(),e[10]=c,e[11]=P):P=e[11];let B;e[12]!==z||e[13]!==P?(B=n.jsx(pl,{marks:z,onOpenRow:P}),e[12]=z,e[13]=P,e[14]=B):B=e[14];const $=B,_=oi(),D=Sr(t.projectId,t.mixed&&t.detailed),M=!t.empty,H=!t.collapsed;let A;e[15]!==M||e[16]!==a||e[17]!==t.groupKey?(A=M?()=>a(t.groupKey):void 0,e[15]=M,e[16]=a,e[17]=t.groupKey,e[18]=A):A=e[18];const F=A;let O;e[19]!==t.key?(O=Se=>It.getState().setRevealed(t.key,Se),e[19]=t.key,e[20]=O):O=e[20];const K=O;let L;e[21]!==K?(L=Se=>()=>{K(false),Se()},e[21]=K,e[22]=L):L=e[22];const V=L;let J;e[23]!==o||e[24]!==K||e[25]!==c?(J=()=>{if(o){K(false);return}c.open()},e[23]=o,e[24]=K,e[25]=c,e[26]=J):J=e[26];const G=J,q=Wg;let U;e[27]!==C||e[28]!==T||e[29]!==j?(U=j||T?n.jsx(wa,{className:"size-3"}):C?n.jsx(Oa,{state:C}):null,e[27]=C,e[28]=T,e[29]=j,e[30]=U):U=e[30];const Z=U;let te;e[31]!==h.prColor||e[32]!==y||e[33]!==r?(te=y?n.jsx(X,{name:"instance",className:"size-3.5 shrink-0 text-muted-foreground","aria-hidden":false,role:"img","aria-label":r("sessions.sidebar.group.space")}):n.jsx(X,{name:"git-branch",className:de("size-3.5 shrink-0",h.prColor?"oc-ref-tint":"text-muted-foreground"),style:h.prColor?Li(h.prColor):void 0,"aria-hidden":false,role:"img","aria-label":r("sessions.sidebar.work.worktreeMark")}),e[31]=h.prColor,e[32]=y,e[33]=r,e[34]=te):te=e[34];const se=te;let ie;e[35]!==c.durationSessionId||e[36]!==c.runningSessionId?(ie=c.durationSessionId?n.jsx(er,{sessionId:c.durationSessionId,running:!!c.runningSessionId,className:"shrink-0 typography-micro"}):null,e[35]=c.durationSessionId,e[36]=c.runningSessionId,e[37]=ie):ie=e[37];const ne=ie;let ue;if(e[38]!==h.prColor||e[39]!==h.prReference||e[40]!==h.prSummary||e[41]!==h.primaryIssue||e[42]!==t.detailed){const Se=h.prSummary?{icon:"git-pull-request",color:h.prColor,text:h.prReference}:h.primaryIssue?{icon:h.primaryIssue.icon,color:h.primaryIssue.color,text:h.primaryIssue.label}:null;ue=Se?n.jsxs("span",{className:"inline-flex shrink-0 items-center gap-0.5 typography-micro text-muted-foreground",children:[n.jsx(X,{name:Se.icon,className:de("size-3",Se.color&&"oc-ref-tint"),style:Se.color?Li(Se.color):void 0}),t.detailed&&Se.text?n.jsx("span",{className:"leading-none tabular-nums",children:Se.text}):null]}):null,e[38]=h.prColor,e[39]=h.prReference,e[40]=h.prSummary,e[41]=h.primaryIssue,e[42]=t.detailed,e[43]=ue}else ue=e[43];const Q=ue,re=R?xr:C==="unread"||C==="permission"||C==="form"?"font-semibold text-foreground":C==="active"?"text-foreground":"oc-title-rest";let le;e[44]!==re?(le=de("block min-w-0 flex-1 truncate oc-ui-start-align typography-ui-label",re),e[44]=re,e[45]=le):le=e[45];let Ne;e[46]!==b||e[47]!==le?(Ne=n.jsx("span",{dir:"auto",className:le,children:b}),e[46]=b,e[47]=le,e[48]=Ne):Ne=e[48];const Le=Ne;let we;e[49]!==S||e[50]!==g||e[51]!==r||e[52]!==w||e[53]!==c?(we=(Se,ot)=>n.jsx(br,{initialTitle:w??"",indent:Se,className:ot,placeholder:S??g??r("sessions.sidebar.work.rename.placeholder"),onSubmit:Ze=>{q(),c.saveTitle(Ze)},onCancel:q}),e[49]=S,e[50]=g,e[51]=r,e[52]=w,e[53]=c,e[54]=we):we=e[54];const Re=we;let ae;e[55]!==y||e[56]!==r||e[57]!==f?.worktreeStatus?(ae=f?.worktreeStatus==="missing"?n.jsx("span",{className:"inline-flex shrink-0 items-center text-status-warning",role:"img","aria-label":r("sessions.sidebar.group.worktreeMissing"),children:n.jsx(X,{name:"alert",className:"size-3"})}):y?n.jsx(md,{spaceId:y.id}):null,e[55]=y,e[56]=r,e[57]=f?.worktreeStatus,e[58]=ae):ae=e[58];const ce=ae;let Ee;e[59]!==t.group.directory?(Ee=t.group.directory?n.jsx(Ff,{directory:t.group.directory}):null,e[59]=t.group.directory,e[60]=Ee):Ee=e[60];const Ie=Ee;let ke;e[61]!==t.key||e[62]!==r||e[63]!==c.pinned?(ke=c.pinned&&!Da(t.key)?n.jsx(X,{name:"pushpin",className:"size-3 shrink-0 text-muted-foreground","aria-label":r("sessions.sidebar.session.status.pinned")}):null,e[61]=t.key,e[62]=r,e[63]=c.pinned,e[64]=ke):ke=e[64];const Oe=ke;let Fe;if(t.detailed){let Se;e[65]!==i||e[66]!==t.depth?(Se=i.detailedLeft(t.depth),e[65]=i,e[66]=t.depth,e[67]=Se):Se=e[67];const ot=d?void 0:G;let Ze;e[68]!==b||e[69]!==r?(Ze=r("sessions.sidebar.work.openAria",{label:b}),e[68]=b,e[69]=r,e[70]=Ze):Ze=e[70];let xt;e[71]!==H||e[72]!==b||e[73]!==F?(xt=F?n.jsx(yn,{expanded:H,kind:"work",label:b,onToggle:F}):null,e[71]=H,e[72]=b,e[73]=F,e[74]=xt):xt=e[74];let vt;e[75]!==Ie||e[76]!==ne||e[77]!==ce||e[78]!==Oe||e[79]!==Re||e[80]!==d||e[81]!==Z||e[82]!==Le?(vt=d?Re(0,"h-[1lh] pe-0 typography-ui-label [&_button]:size-6 [&_button>svg]:size-3.5"):n.jsxs(n.Fragment,{children:[Le,ce,Oe,Ie,Z,ne]}),e[75]=Ie,e[76]=ne,e[77]=ce,e[78]=Oe,e[79]=Re,e[80]=d,e[81]=Z,e[82]=Le,e[83]=vt):vt=e[83];let lt;e[84]!==D?(lt=D?n.jsx(wn,{project:D,size:"xs"}):null,e[84]=D,e[85]=lt):lt=e[85];let De;e[86]!==D||e[87]!==_?(De=D&&_?n.jsx(ai,{project:D,separated:false}):null,e[86]=D,e[87]=_,e[88]=De):De=e[88];let gt;e[89]!==D||e[90]!==_||e[91]!==v||e[92]!==w?(gt=v&&!(D&&_&&v===w)?n.jsx("span",{dir:"auto",className:"block min-w-0 truncate typography-micro",children:v}):null,e[89]=D,e[90]=_,e[91]=v,e[92]=w,e[93]=gt):gt=e[93];let wt;e[94]!==$||e[95]!==Q?(wt=n.jsxs("span",{className:"ms-auto flex shrink-0 items-center gap-1.5",children:[Q,$]}),e[94]=$,e[95]=Q,e[96]=wt):wt=e[96];let We;e[97]!==se||e[98]!==lt||e[99]!==De||e[100]!==gt||e[101]!==wt?(We=n.jsxs(n.Fragment,{children:[lt,De,se,gt,wt]}),e[97]=se,e[98]=lt,e[99]=De,e[100]=gt,e[101]=wt,e[102]=We):We=e[102];let ct;e[103]!==Se||e[104]!==ot||e[105]!==Ze||e[106]!==xt||e[107]!==vt||e[108]!==We?(ct=n.jsx(mi,{indent:Se,onSelect:ot,ariaLabel:Ze,chevron:xt,firstLine:vt,secondLine:We}),e[103]=Se,e[104]=ot,e[105]=Ze,e[106]=xt,e[107]=vt,e[108]=We,e[109]=ct):ct=e[109],Fe=ct}else{let Se;e[110]!==se||e[111]!==H||e[112]!==i||e[113]!==b||e[114]!==t.depth||e[115]!==F?(Se=F?n.jsx(vr,{slotLeft:i.slotLeft(t.depth),children:n.jsx(yn,{expanded:H,kind:"work",label:b,onToggle:F})}):n.jsx(jr,{slotLeft:i.slotLeft(t.depth),children:se}),e[110]=se,e[111]=H,e[112]=i,e[113]=b,e[114]=t.depth,e[115]=F,e[116]=Se):Se=e[116];let ot;e[117]!==Ie||e[118]!==ne||e[119]!==i||e[120]!==b||e[121]!==$||e[122]!==ce||e[123]!==Oe||e[124]!==Q||e[125]!==Re||e[126]!==d||e[127]!==t.depth||e[128]!==G||e[129]!==Z||e[130]!==r||e[131]!==Le?(ot=d?Re(i.textLeft(t.depth)):n.jsxs("button",{type:"button",className:wr,style:{paddingInlineStart:i.textLeft(t.depth),touchAction:"manipulation"},"aria-label":r("sessions.sidebar.work.openAria",{label:b}),onClick:G,children:[Le,ce,Oe,Q,$,Ie,Z,ne]}),e[117]=Ie,e[118]=ne,e[119]=i,e[120]=b,e[121]=$,e[122]=ce,e[123]=Oe,e[124]=Q,e[125]=Re,e[126]=d,e[127]=t.depth,e[128]=G,e[129]=Z,e[130]=r,e[131]=Le,e[132]=ot):ot=e[132];let Ze;e[133]!==Se||e[134]!==ot?(Ze=n.jsxs(n.Fragment,{children:[Se,ot]}),e[133]=Se,e[134]=ot,e[135]=Ze):Ze=e[135],Fe=Ze}const ut=(c.workAction?1:0)+(c.canRename?1:0)+(y?1:0)+(c.canPin?1:0)+(c.canArchive?1:0)+(f&&!j?1:0);let Ke;e[136]!==c?(Ke=()=>Aa({current:c.pinList,pin:Se=>{c.setPin(true,Se)},unpin:()=>{c.setPin(false)}}),e[136]=c,e[137]=Ke):Ke=e[137];const Be=Ke;let He;e[138]!==r||e[139]!==c.canMarkUnread||e[140]!==c.hasUnread||e[141]!==c.toggleRead?(He=c.canMarkUnread?n.jsxs(cs,{onClick:c.toggleRead,children:[n.jsx(X,{name:c.hasUnread?"chat-check":"checkbox-circle",className:"me-1 size-4"}),c.hasUnread?r("sessions.sidebar.session.menu.markRead"):r("sessions.sidebar.session.menu.markUnread")]}):null,e[138]=r,e[139]=c.canMarkUnread,e[140]=c.hasUnread,e[141]=c.toggleRead,e[142]=He):He=e[142];let Je;e[143]!==T||e[144]!==N||e[145]!==r||e[146]!==c.toggleWork||e[147]!==c.workAction||e[148]!==j?(Je=c.workAction?n.jsxs(cs,{disabled:T||j,onClick:c.toggleWork,children:[n.jsx(X,{name:N?"check":"eye",className:"me-1 size-4"}),r(N?"sessions.sidebar.session.work.markDone":"sessions.sidebar.session.work.track")]}):null,e[143]=T,e[144]=N,e[145]=r,e[146]=c.toggleWork,e[147]=c.workAction,e[148]=j,e[149]=Je):Je=e[149];let $e;e[150]!==t.key||e[151]!==r||e[152]!==c.canRename?($e=c.canRename?n.jsxs(cs,{onClick:()=>It.getState().startRename(t.key),children:[n.jsx(X,{name:"edit",className:"me-1 size-4"}),r("sessions.sidebar.work.menu.rename")]}):null,e[150]=t.key,e[151]=r,e[152]=c.canRename,e[153]=$e):$e=e[153];let it;e[154]!==Be||e[155]!==r||e[156]!==c.canPin||e[157]!==c.pinned?(it=c.canPin?n.jsxs(cs,{onClick:Be,children:[n.jsx(X,{name:c.pinned?"unpin":"pushpin",className:"me-1 size-4"}),c.pinned?r("sessions.sidebar.work.menu.unpin"):r("sessions.sidebar.work.menu.pin")]}):null,e[154]=Be,e[155]=r,e[156]=c.canPin,e[157]=c.pinned,e[158]=it):it=e[158];let tt;e[159]!==T||e[160]!==r||e[161]!==c?(tt=c.canArchive?n.jsxs(cs,{disabled:T,onClick:()=>{c.finish(true)},children:[n.jsx(X,{name:"archive",className:"me-1 size-4"}),r("sessions.sidebar.work.menu.archive")]}):null,e[159]=T,e[160]=r,e[161]=c,e[162]=tt):tt=e[162];let ee;e[163]!==He||e[164]!==Je||e[165]!==$e||e[166]!==it||e[167]!==tt?(ee=n.jsxs(n.Fragment,{children:[He,Je,$e,it,tt]}),e[163]=He,e[164]=Je,e[165]=$e,e[166]=it,e[167]=tt,e[168]=ee):ee=e[168];const ge=ee,st=o||d||j,jt=ut*Qs,Y=R&&fi,Pe=j&&"opacity-60";let he;e[169]!==Y||e[170]!==Pe?(he=de("relative flex w-full items-center bg-background transition-colors",Y,Pe),e[169]=Y,e[170]=Pe,e[171]=he):he=e[171];let Ve;e[172]!==V||e[173]!==T||e[174]!==N||e[175]!==o||e[176]!==r||e[177]!==c.toggleWork||e[178]!==c.workAction||e[179]!==j?(Ve=c.workAction?n.jsx(ds,{icon:N?"check":"eye",tone:N?"success":"default",label:r(N?"sessions.sidebar.session.work.markDone":"sessions.sidebar.session.work.track"),revealed:o,disabled:T||j,onClick:V(c.toggleWork)}):null,e[172]=V,e[173]=T,e[174]=N,e[175]=o,e[176]=r,e[177]=c.toggleWork,e[178]=c.workAction,e[179]=j,e[180]=Ve):Ve=e[180];let ft;e[181]!==o||e[182]!==t.key||e[183]!==r||e[184]!==c.canRename?(ft=c.canRename?n.jsx(ds,{icon:"edit",label:r("sessions.sidebar.work.menu.rename"),revealed:o,onClick:()=>It.getState().startRename(t.key)}):null,e[181]=o,e[182]=t.key,e[183]=r,e[184]=c.canRename,e[185]=ft):ft=e[185];let at;e[186]!==V||e[187]!==b||e[188]!==o||e[189]!==y||e[190]!==r?(at=y?n.jsx(ds,{icon:"more",label:r("spaces.actions.menuAria",{label:b}),revealed:o,onClick:V(()=>Gl.getState().openActionsSheet(y.id))}):null,e[186]=V,e[187]=b,e[188]=o,e[189]=y,e[190]=r,e[191]=at):at=e[191];let pt;e[192]!==V||e[193]!==Be||e[194]!==o||e[195]!==r||e[196]!==c.canPin||e[197]!==c.pinned?(pt=c.canPin?n.jsx(ds,{icon:c.pinned?"unpin":"pushpin",label:c.pinned?r("sessions.sidebar.work.menu.unpin"):r("sessions.sidebar.work.menu.pin"),revealed:o,onClick:V(Be)}):null,e[192]=V,e[193]=Be,e[194]=o,e[195]=r,e[196]=c.canPin,e[197]=c.pinned,e[198]=pt):pt=e[198];let Qe;e[199]!==V||e[200]!==T||e[201]!==o||e[202]!==r||e[203]!==c?(Qe=c.canArchive?n.jsx(ds,{icon:"archive",label:r("sessions.sidebar.work.menu.archive"),revealed:o,disabled:T,onClick:V(()=>{c.finish(true)})}):null,e[199]=V,e[200]=T,e[201]=o,e[202]=r,e[203]=c,e[204]=Qe):Qe=e[204];let Ye;e[205]!==l||e[206]!==V||e[207]!==m||e[208]!==o||e[209]!==r||e[210]!==f||e[211]!==j?(Ye=f&&!j?n.jsx(ds,{icon:"delete-bin",tone:"destructive",label:r("sessions.sidebar.group.actions.deleteWorktree"),revealed:o,onClick:V(()=>{m&&l.requestWorktreeDelete({id:m.id,path:m.path},f)})}):null,e[205]=l,e[206]=V,e[207]=m,e[208]=o,e[209]=r,e[210]=f,e[211]=j,e[212]=Ye):Ye=e[212];let ht;e[213]!==Ve||e[214]!==ft||e[215]!==at||e[216]!==pt||e[217]!==Qe||e[218]!==Ye?(ht=n.jsxs(n.Fragment,{children:[Ve,ft,at,pt,Qe,Ye]}),e[213]=Ve,e[214]=ft,e[215]=at,e[216]=pt,e[217]=Qe,e[218]=Ye,e[219]=ht):ht=e[219];let rt;e[220]!==Fe||e[221]!==o||e[222]!==R||e[223]!==K||e[224]!==jt||e[225]!==he||e[226]!==ht?(rt=n.jsx(Ln,{actionsWidth:jt,revealed:o,onRevealedChange:K,dataActiveSession:R,contentClassName:he,actions:ht,children:Fe}),e[220]=Fe,e[221]=o,e[222]=R,e[223]=K,e[224]=jt,e[225]=he,e[226]=ht,e[227]=rt):rt=e[227];let mt;return e[228]!==ge||e[229]!==st||e[230]!==rt?(mt=n.jsx(yr,{disabled:st,menu:ge,children:rt}),e[228]=ge,e[229]=st,e[230]=rt,e[231]=mt):mt=e[231],mt},Fg=s=>{const e=oe.c(136),{row:t,geometry:i,toggleParent:a}=s,{t:r}=be(),l=Sn(),{run:o}=t,{revealed:d,renaming:u}=Bn(t.key),c=Of(o,t.laneNodes,l.close);let f;e[0]!==t.laneNodes?(f=[...t.laneNodes],e[0]=t.laneNodes,e[1]=f):f=e[1];const y=f;let g;e[2]!==y||e[3]!==t.blockingSessionIds?(g={nodes:y,blockingSessionIds:t.blockingSessionIds},e[2]=y,e[3]=t.blockingSessionIds,e[4]=g):g=e[4];const m=Mf(g);let h;e[5]!==m?(h=m?n.jsx(Oa,{state:m}):null,e[5]=m,e[6]=h):h=e[6];const b=h,v=oi(),S=Sr(t.projectId,t.detailed&&t.renderContext==="timeline-mixed"),w=t.expanded;let N;e[7]!==t.expansionKey||e[8]!==t.laneNodes.length||e[9]!==a?(N=t.laneNodes.length>0?()=>a(t.expansionKey):void 0,e[7]=t.expansionKey,e[8]=t.laneNodes.length,e[9]=a,e[10]=N):N=e[10];const R=N,T=o.lanes.length;let j;e[11]!==t.key?(j=ce=>It.getState().setRevealed(t.key,ce),e[11]=t.key,e[12]=j):j=e[12];const C=j;let k;e[13]!==C?(k=ce=>()=>{C(false),ce()},e[13]=C,e[14]=k):k=e[14];const I=k;let E;e[15]!==d||e[16]!==C||e[17]!==c?(E=()=>{if(d){C(false);return}c.open()},e[15]=d,e[16]=C,e[17]=c,e[18]=E):E=e[18];const z=E,P=$g;let B;e[19]===Symbol.for("react.memo_cache_sentinel")?(B=n.jsx(Wr,{className:"size-3.5 shrink-0 text-muted-foreground","aria-hidden":"true"}),e[19]=B):B=e[19];const $=B,_=c.isActive?xr:"oc-title-rest";let D;e[20]!==_?(D=de("block min-w-0 flex-1 truncate oc-ui-start-align typography-ui-label",_),e[20]=_,e[21]=D):D=e[21];let M;e[22]!==o.title||e[23]!==D?(M=n.jsx("span",{dir:"auto",className:D,children:o.title}),e[22]=o.title,e[23]=D,e[24]=M):M=e[24];const H=M;let A;e[25]!==o.title||e[26]!==c?(A=(ce,Ee)=>n.jsx(br,{initialTitle:o.title,indent:ce,className:Ee,onSubmit:Ie=>{P(),c.rename(Ie)},onCancel:P}),e[25]=o.title,e[26]=c,e[27]=A):A=e[27];const F=A;let O;e[28]!==o.title||e[29]!==r?(O=r("sessions.sidebar.run.openOverviewAria",{title:o.title}),e[28]=o.title,e[29]=r,e[30]=O):O=e[30];const K=O;let L;if(t.detailed){let ce;e[31]!==i||e[32]!==t.depth?(ce=i.detailedLeft(t.depth),e[31]=i,e[32]=t.depth,e[33]=ce):ce=e[33];const Ee=u?void 0:z;let Ie;e[34]!==w||e[35]!==o.title||e[36]!==R?(Ie=R?n.jsx(yn,{expanded:w,kind:"run",label:o.title,onToggle:R}):null,e[34]=w,e[35]=o.title,e[36]=R,e[37]=Ie):Ie=e[37];let ke;e[38]!==b||e[39]!==F||e[40]!==u||e[41]!==H?(ke=u?F(0,"h-[1lh] pe-0 typography-ui-label [&_button]:size-6 [&_button>svg]:size-3.5"):n.jsxs(n.Fragment,{children:[H,b]}),e[38]=b,e[39]=F,e[40]=u,e[41]=H,e[42]=ke):ke=e[42];let Oe;e[43]!==S?(Oe=S?n.jsx(wn,{project:S,size:"xs"}):null,e[43]=S,e[44]=Oe):Oe=e[44];let Fe;e[45]!==S||e[46]!==v?(Fe=S&&v?n.jsx(ai,{project:S,separated:false}):null,e[45]=S,e[46]=v,e[47]=Fe):Fe=e[47];let ut;e[48]!==T||e[49]!==r?(ut=T===1?r("sessions.sidebar.run.laneCountSingle",{count:T}):r("sessions.sidebar.run.laneCountPlural",{count:T}),e[48]=T,e[49]=r,e[50]=ut):ut=e[50];let Ke;e[51]!==ut?(Ke=n.jsx("span",{className:"block min-w-0 flex-auto truncate typography-micro",children:ut}),e[51]=ut,e[52]=Ke):Ke=e[52];let Be;e[53]!==o.providerIDs?(Be=n.jsx(Co,{providerIDs:o.providerIDs}),e[53]=o.providerIDs,e[54]=Be):Be=e[54];let He;e[55]!==Oe||e[56]!==Fe||e[57]!==Ke||e[58]!==Be?(He=n.jsxs(n.Fragment,{children:[Oe,Fe,$,Ke,Be]}),e[55]=Oe,e[56]=Fe,e[57]=Ke,e[58]=Be,e[59]=He):He=e[59];let Je;e[60]!==K||e[61]!==ce||e[62]!==Ee||e[63]!==Ie||e[64]!==ke||e[65]!==He?(Je=n.jsx(mi,{indent:ce,onSelect:Ee,ariaLabel:K,chevron:Ie,firstLine:ke,secondLine:He}),e[60]=K,e[61]=ce,e[62]=Ee,e[63]=Ie,e[64]=ke,e[65]=He,e[66]=Je):Je=e[66],L=Je}else{let ce;e[67]!==w||e[68]!==i||e[69]!==t.depth||e[70]!==o.title||e[71]!==R?(ce=R?n.jsx(vr,{slotLeft:i.slotLeft(t.depth),children:n.jsx(yn,{expanded:w,kind:"run",label:o.title,onToggle:R})}):n.jsx(jr,{slotLeft:i.slotLeft(t.depth),children:$}),e[67]=w,e[68]=i,e[69]=t.depth,e[70]=o.title,e[71]=R,e[72]=ce):ce=e[72];let Ee;e[73]!==b||e[74]!==K||e[75]!==i||e[76]!==F||e[77]!==u||e[78]!==t.depth||e[79]!==o.providerIDs||e[80]!==z||e[81]!==H?(Ee=u?F(i.textLeft(t.depth)):n.jsxs("button",{type:"button",className:wr,style:{paddingInlineStart:i.textLeft(t.depth),touchAction:"manipulation"},"aria-label":K,onClick:z,children:[H,n.jsx(Co,{providerIDs:o.providerIDs}),b]}),e[73]=b,e[74]=K,e[75]=i,e[76]=F,e[77]=u,e[78]=t.depth,e[79]=o.providerIDs,e[80]=z,e[81]=H,e[82]=Ee):Ee=e[82];let Ie;e[83]!==ce||e[84]!==Ee?(Ie=n.jsxs(n.Fragment,{children:[ce,Ee]}),e[83]=ce,e[84]=Ee,e[85]=Ie):Ie=e[85],L=Ie}const V=(c.sessionWorkEnabled?4:3)*Qs,J=c.isActive,G=c.isActive&&fi;let q;e[86]!==G?(q=de("relative flex w-full items-center bg-background transition-colors",G),e[86]=G,e[87]=q):q=e[87];let U;e[88]!==I||e[89]!==d||e[90]!==r||e[91]!==c?(U=c.sessionWorkEnabled?n.jsx(ds,{icon:c.inWork?"check":"eye",tone:c.inWork?"success":"default",label:c.inWork?r("sessions.sidebar.session.work.markDone"):r("sessions.sidebar.session.work.track"),revealed:d,disabled:c.busy,onClick:I(()=>{c.toggleWork()})}):null,e[88]=I,e[89]=d,e[90]=r,e[91]=c,e[92]=U):U=e[92];let Z;e[93]===Symbol.for("react.memo_cache_sentinel")?(Z=n.jsx(Wr,{className:"size-[18px]","aria-hidden":"true"}),e[93]=Z):Z=e[93];let te;e[94]!==r?(te=r("sessions.sidebar.run.menu.openOverview"),e[94]=r,e[95]=te):te=e[95];let se;e[96]!==I||e[97]!==c.openOverview?(se=I(c.openOverview),e[96]=I,e[97]=c.openOverview,e[98]=se):se=e[98];let ie;e[99]!==d||e[100]!==te||e[101]!==se?(ie=n.jsx(ds,{icon:"git-merge",glyph:Z,label:te,revealed:d,onClick:se}),e[99]=d,e[100]=te,e[101]=se,e[102]=ie):ie=e[102];let ne;e[103]!==r?(ne=r("multirun.overview.rename.aria"),e[103]=r,e[104]=ne):ne=e[104];let ue;e[105]!==t.key?(ue=()=>It.getState().startRename(t.key),e[105]=t.key,e[106]=ue):ue=e[106];let Q;e[107]!==d||e[108]!==ne||e[109]!==ue?(Q=n.jsx(ds,{icon:"edit",label:ne,revealed:d,onClick:ue}),e[107]=d,e[108]=ne,e[109]=ue,e[110]=Q):Q=e[110];let re;e[111]!==r?(re=r("multirun.overview.archive.action"),e[111]=r,e[112]=re):re=e[112];const le=c.busy;let Ne;e[113]!==c?(Ne=()=>{c.archive()},e[113]=c,e[114]=Ne):Ne=e[114];let Le;e[115]!==I||e[116]!==Ne?(Le=I(Ne),e[115]=I,e[116]=Ne,e[117]=Le):Le=e[117];let we;e[118]!==d||e[119]!==re||e[120]!==Le||e[121]!==c.busy?(we=n.jsx(ds,{icon:"archive",label:re,revealed:d,disabled:le,onClick:Le}),e[118]=d,e[119]=re,e[120]=Le,e[121]=c.busy,e[122]=we):we=e[122];let Re;e[123]!==U||e[124]!==ie||e[125]!==Q||e[126]!==we?(Re=n.jsxs(n.Fragment,{children:[U,ie,Q,we]}),e[123]=U,e[124]=ie,e[125]=Q,e[126]=we,e[127]=Re):Re=e[127];let ae;return e[128]!==L||e[129]!==d||e[130]!==C||e[131]!==V||e[132]!==q||e[133]!==Re||e[134]!==c.isActive?(ae=n.jsx(Ln,{actionsWidth:V,revealed:d,onRevealedChange:C,dataActiveSession:J,contentClassName:q,actions:Re,children:L}),e[128]=L,e[129]=d,e[130]=C,e[131]=V,e[132]=q,e[133]=Re,e[134]=c.isActive,e[135]=ae):ae=e[135],ae},zg=s=>{const e=oe.c(47),{row:t,geometry:i}=s,{t:a}=be(),r=Sn(),{draft:l}=t,{revealed:o}=Bn(t.key),{isOpen:d,firstLine:u,attachmentCount:c,label:f,open:y,discard:g}=ud(l,r.close),m=oi(),h=Sr(l.projectId??null,t.detailed&&t.mixed),b=fd(t.detailed?l.directory:null);let v;e[0]!==t.key?(v=K=>It.getState().setRevealed(t.key,K),e[0]=t.key,e[1]=v):v=e[1];const S=v;let w;e[2]!==y||e[3]!==o||e[4]!==S?(w=()=>{if(o){S(false);return}y()},e[2]=y,e[3]=o,e[4]=S,e[5]=w):w=e[5];const N=w;let R;e[6]===Symbol.for("react.memo_cache_sentinel")?(R=n.jsx(X,{name:"edit",className:"size-3 shrink-0 text-muted-foreground"}),e[6]=R):R=e[6];const T=R;let j;e[7]!==c||e[8]!==u?(j=u&&c>0?n.jsx(X,{name:"attachment-2",className:"size-3 shrink-0 text-muted-foreground"}):null,e[7]=c,e[8]=u,e[9]=j):j=e[9];const C=j,k=t.detailed&&!!(h||b||C),I=d?xr:"oc-title-rest";let E;e[10]!==I?(E=de("block min-w-0 flex-1 truncate oc-ui-start-align typography-ui-label italic",I),e[10]=I,e[11]=E):E=e[11];let z;e[12]!==f||e[13]!==E?(z=n.jsx("span",{dir:"auto",className:E,children:f}),e[12]=f,e[13]=E,e[14]=z):z=e[14];const P=z;let B;e[15]!==f||e[16]!==a?(B=a("sessions.sidebar.draft.openAria",{label:f}),e[15]=f,e[16]=a,e[17]=B):B=e[17];const $=B,_=d&&fi;let D;e[18]!==_?(D=de("relative flex w-full items-center bg-background transition-colors",_),e[18]=_,e[19]=D):D=e[19];let M;e[20]!==a?(M=a("sessions.sidebar.draft.discard"),e[20]=a,e[21]=M):M=e[21];let H;e[22]!==g||e[23]!==S?(H=()=>{S(false),g()},e[22]=g,e[23]=S,e[24]=H):H=e[24];let A;e[25]!==o||e[26]!==M||e[27]!==H?(A=n.jsx(ds,{icon:"close",tone:"destructive",label:M,revealed:o,onClick:H}),e[25]=o,e[26]=M,e[27]=H,e[28]=A):A=e[28];let F;e[29]!==$||e[30]!==C||e[31]!==b||e[32]!==k||e[33]!==i||e[34]!==h||e[35]!==m||e[36]!==t.depth||e[37]!==N||e[38]!==P?(F=k?n.jsx(mi,{indent:i.detailedLeft(t.depth),onSelect:N,ariaLabel:$,chevron:null,firstLine:P,secondLine:n.jsxs(n.Fragment,{children:[h?n.jsx(wn,{project:h,size:"xs"}):null,h&&m?n.jsx(ai,{project:h,separated:false}):null,T,b?n.jsx("span",{className:"block min-w-0 truncate typography-micro",children:b}):null,C?n.jsx("span",{className:"ms-auto flex shrink-0 items-center",children:C}):null]})}):n.jsxs(n.Fragment,{children:[n.jsx(jr,{slotLeft:i.slotLeft(t.depth),children:T}),n.jsxs("button",{type:"button",className:wr,style:{paddingInlineStart:i.textLeft(t.depth),touchAction:"manipulation"},"aria-label":$,onClick:N,children:[P,C]})]}),e[29]=$,e[30]=C,e[31]=b,e[32]=k,e[33]=i,e[34]=h,e[35]=m,e[36]=t.depth,e[37]=N,e[38]=P,e[39]=F):F=e[39];let O;return e[40]!==d||e[41]!==o||e[42]!==S||e[43]!==D||e[44]!==A||e[45]!==F?(O=n.jsx(Ln,{actionsWidth:Qs,revealed:o,onRevealedChange:S,dataActiveSession:d,contentClassName:D,actions:A,children:F}),e[40]=d,e[41]=o,e[42]=S,e[43]=D,e[44]=A,e[45]=F,e[46]=O):O=e[46],O};function Wg(){return It.getState().stopRename()}function $g(){return It.getState().stopRename()}const Kg=12,xl=8,Ii=s=>xl+s*Kg,Hg={base:xl,slotLeft:Ii,textLeft:s=>Ii(s)+20,detailedLeft:s=>Ii(s)+4},No=12,Vg=()=>{},vl=(s,e)=>s.some(t=>t.session.id===e||vl(t.children,e)),Ug=(s,e)=>{const{sessionId:t,runKey:i,projectId:a}=e;if(i){const r=s.findIndex(l=>l.kind==="run"&&l.run.key===i);if(r>=0)return r}if(t){const r=s.findIndex(l=>l.kind==="session"&&l.node.session.id===t||l.kind==="run"&&l.run.memberIds.includes(t)||l.kind==="group-header"&&vl(l.group.sessions,t));if(r>=0)return r}return a?s.findIndex(r=>r.kind==="project-header"&&r.section.project.id===a):-1},Gg=({model:s,view:e,actions:t})=>{const{t:i}=be(),a=Sn(),r=pd(),l=Hg,[o,d]=p.useState(null),u=s.rowModel.rows;p.useEffect(()=>{It.getState().forgetUnlisted(b=>s.rowModel.rowIndexByKey.has(b))},[s.rowModel.rowIndexByKey]);const c=It(b=>b.renamingKey),f=p.useMemo(()=>{const b=c?s.rowModel.rowIndexByKey.get(c):void 0;return new Set(b===void 0?[]:[b])},[s.rowModel.rowIndexByKey,c]),[y,g]=p.useState(null),m=p.useRef(u);m.current=u,p.useEffect(()=>{if(a.openId===0)return;const b=Ug(m.current,{sessionId:dt.getState().currentSessionId,runKey:qe.getState().runOverviewKey,projectId:s.groupProps.activeProjectId});b>=0&&g({index:b,id:a.openId})},[a.openId]);const h=p.useCallback(b=>{switch(b.kind){case"activity-header":return n.jsx(Eg,{row:b,onToggle:()=>Yf(b,{model:s,actions:t})});case"caption":return n.jsx(Tg,{row:b,onToggle:()=>Jf(b,{model:s})});case"project-header":{const v=b.section.project;return n.jsx(_g,{row:b,label:qf(v,e.homeDirectory),isRepo:!!s.projectRepoStatus.get(v.id),active:s.groupProps.activeProjectId===v.id,onToggle:()=>t.toggleProject(v.id),onNewSession:()=>{t.setActiveProjectIdOnly(v.id),t.openNewSessionDraft({selectedProjectId:v.id,directoryOverride:v.normalizedPath}),a.close()},onRemove:()=>t.removeProject(v.id)})}case"group-header":return Gf(b.group)?n.jsx(Bg,{row:b,geometry:l,onToggle:t.group.onToggleCollapsedGroup}):n.jsx(Ag,{row:b,geometry:l,onToggle:t.group.onToggleCollapsedGroup});case"folder-header":return n.jsx(Dg,{row:b,geometry:l});case"session":return n.jsx(kg,{row:b,geometry:l,toggleParent:s.groupProps.toggleParent});case"search-result":return n.jsx(Uf,{result:b.result,context:b.context,mobile:true,search:s.search,onOpened:a.close});case"search-archived-caption":return n.jsx(Vf,{});case"search-show-more":return n.jsx(Hf,{mobile:true,section:b.section,hidden:b.hidden,onShow:s.search?.showMore});case"search-more":return n.jsx(Kf,{mobile:true,onLoadMore:()=>s.search?.loadMore(b.section)});case"run":return n.jsx(Fg,{row:b,geometry:l,toggleParent:s.groupProps.toggleParent});case"draft":return n.jsx(zg,{row:b,geometry:l});case"show-control":return n.jsx(jg,{more:b.more,fewer:b.fewer,hiddenNodes:b.hiddenNodes,indent:b.flat?No:b.detailed?l.detailedLeft(b.depth??0):l.textLeft(b.depth??0),onShow:v=>$f(b,v,{model:s,actions:t})});case"status":return n.jsx(Og,{row:b,indent:b.flat?No:b.detailed?l.detailedLeft(b.depth??0):l.textLeft(b.depth??0),onRetry:()=>Wf(b,r),onGrantAccess:()=>{zf(b,r)}});case"empty":return b.emptyKind==="sidebar"?s.emptyState:b.emptyKind==="search"?s.searchEmptyState:n.jsx("div",{className:"py-1 typography-micro text-muted-foreground",style:{paddingInlineStart:l.textLeft(b.depth??0)},children:b.emptyKind==="section"?i("sessions.sidebar.sections.empty"):i("sessions.sidebar.group.empty.noArchivedSessions")})}},[t,r,l,s,a,i,e.homeDirectory]);return n.jsx(bs,{ref:d,outerClassName:"min-h-0 flex-1",className:"px-3 pb-4 [overflow-anchor:none]",useScrollShadow:true,disableHorizontal:true,children:n.jsx(Xf,{model:s.rowModel,scrollElement:o,pinnedRowIndexes:f,renderRow:h,onFirstVisibleIndexChange:Vg,guideSlotStartPx:l.base,scrollRequest:y})})},qg=32,Jg=80,Yg=64,Xg=.7,Qg=140,Zg=.4,eb=(s,e,t)=>{const i=e.ownerDocument.defaultView;if(!i)return"drawer";let a=false;for(let r=s instanceof i.Element?s:null;r&&r!==e;r=r.parentElement){const l=r.scrollWidth-r.clientWidth;if(l<=1)continue;const o=i.getComputedStyle(r);if(o.overflowX!=="auto"&&o.overflowX!=="scroll")continue;const d=o.direction==="rtl"?-l:0,u=d+l;if(t?r.scrollLeft>d+1:r.scrollLeft<u-1)return"content";a=true}return a?"content-end":"drawer"},kr=(s,e)=>{const t=p.useRef(e);t.current=e;const i=e.enabled??true;p.useEffect(()=>{if(!i)return;const a=s.current;if(!a)return;const l=window.Capacitor?.getPlatform?.()==="android"?Jg:qg,o=a.ownerDocument;let d=false,u=false,c="drawer",f=0,y=0;const g=()=>o.getSelection()?.isCollapsed===false,m=()=>{d=false},h=()=>{d&&g()&&m()},b=S=>{if(S.touches.length!==1||g()){d=false;return}const w=S.touches[0],N=a.clientWidth,R=w.clientX<=l,T=w.clientX>=N-l;u=R,c=R||T?eb(S.target,a,u):"drawer",d=(R||T)&&c!=="content",f=w.clientX,y=w.clientY},v=S=>{if(!d||(d=false,g()))return;const w=S.changedTouches[0];if(!w)return;const N=w.clientX-f,R=w.clientY-y,T=c==="content-end"?Qg:Yg,j=c==="content-end"?Zg:Xg;Math.abs(N)<T||Math.abs(R)>Math.abs(N)*j||u&&N<=0||!u&&N>=0||(u?t.current.onLeftEdgeSwipe?.():t.current.onRightEdgeSwipe?.())};return a.addEventListener("touchstart",b,{passive:true}),a.addEventListener("touchend",v,{passive:true}),a.addEventListener("touchcancel",m,{passive:true}),a.addEventListener("selectstart",m),o.addEventListener("selectionchange",h),()=>{a.removeEventListener("touchstart",b),a.removeEventListener("touchend",v),a.removeEventListener("touchcancel",m),a.removeEventListener("selectstart",m),o.removeEventListener("selectionchange",h)}},[i,s])},tb=[["manual","sessions.sidebar.header.projectSort.manual"],["a-z","sessions.sidebar.header.projectSort.aToZ"],["z-a","sessions.sidebar.header.projectSort.zToA"],["date-added","sessions.sidebar.header.projectSort.dateAdded"],["recent","sessions.sidebar.header.projectSort.recent"]],sb=[["project","sessions.sidebar.header.listGrouping.project"],["time","sessions.sidebar.header.listGrouping.time"]],ln="min-h-10 items-center justify-between";function nb(){const s=oe.c(8),{t:e}=be(),i=!jd();let a;s[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(X,{name:"check-double",className:"size-4"}),s[0]=a):a=s[0];let r;s[1]!==e?(r=e("sessions.sidebar.header.actions.markAllRead"),s[1]=e,s[2]=r):r=s[2];let l;s[3]!==r?(l=n.jsxs("span",{className:"flex items-center gap-2",children:[a,r]}),s[3]=r,s[4]=l):l=s[4];let o;return s[5]!==i||s[6]!==l?(o=n.jsx(an,{disabled:i,onClick:kd,className:ln,children:l}),s[5]=i,s[6]=l,s[7]=o):o=s[7],o}const ib={kind:"idle"},rb=s=>n.jsx(Gg,{...s}),ob=s=>{const e=oe.c(29),{project:t}=s,{t:i}=be();let a;e[0]!==t.id?(a={id:t.id},e[0]=t.id,e[1]=a):a=e[1];const{attributes:r,listeners:l,setNodeRef:o,transform:d,transition:u,isDragging:c}=dp(a);let f;e[2]!==d?(f=mp.Transform.toString(d),e[2]=d,e[3]=f):f=e[3];const y=c?10:1;let g;e[4]!==f||e[5]!==y||e[6]!==u?(g={transform:f,transition:u,zIndex:y},e[4]=f,e[5]=y,e[6]=u,e[7]=g):g=e[7];const m=c&&"shadow-lg shadow-black/20";let h;e[8]!==m?(h=de("flex items-center gap-1 rounded-2xl border border-edge bg-[var(--surface-elevated)] px-1.5 py-1.5 transition-colors",m),e[8]=m,e[9]=h):h=e[9];let b;e[10]!==t.label||e[11]!==i?(b=i("mobile.sessions.dragHandleAria",{label:t.label}),e[10]=t.label,e[11]=i,e[12]=b):b=e[12];let v;e[13]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx(X,{name:"drag-move-2",className:"size-4"}),e[13]=v):v=e[13];let S;e[14]!==r||e[15]!==l||e[16]!==b?(S=n.jsx("button",{type:"button",className:"flex size-9 shrink-0 cursor-grab touch-none items-center justify-center rounded-xl text-muted-foreground transition-colors hover:text-foreground active:cursor-grabbing","aria-label":b,...r,...l,children:v}),e[14]=r,e[15]=l,e[16]=b,e[17]=S):S=e[17];let w;e[18]!==t?(w=n.jsx(wn,{project:t}),e[18]=t,e[19]=w):w=e[19];let N;e[20]!==t.label?(N=n.jsx("span",{className:"block min-w-0 flex-1 truncate ps-1 typography-ui-label text-foreground",children:t.label}),e[20]=t.label,e[21]=N):N=e[21];let R;return e[22]!==o||e[23]!==w||e[24]!==N||e[25]!==g||e[26]!==h||e[27]!==S?(R=n.jsxs("div",{ref:o,style:g,className:h,children:[S,w,N]}),e[22]=o,e[23]=w,e[24]=N,e[25]=g,e[26]=h,e[27]=S,e[28]=R):R=e[28],R},Ro=s=>{const e=oe.c(205),{open:t,onOpenChange:i,variant:a,footer:r}=s,l=a===void 0?"drawer":a,{t:o}=be(),d=lb(t),u=ma(),c=qt(ub),f=qt(fb),y=qt(mb),g=dt(pb),m=zt(hb),h=zt(gb),b=zt(ql),v=zt(bb),S=zt(yb),w=zt(xb),N=zt(vb),R=zt(wb),T=zt(Sb),j=zt(jb),C=zt(kb),k=zt(Cb),I=zt(Nb),E=zt(Rb),z=zt(Ib),P=zt(Pb),B=qe(Eb),$=zt(Tb);let _;e[0]!==$?(_=$.filter(_b),e[0]=$,e[1]=_):_=e[1];const D=_,M=zt(Ab),H=qe(Db),A=Ns(Mb),[F,O]=p.useState(""),[K,L]=p.useState("everything"),[V,J]=p.useState(ib);let G;e[2]===Symbol.for("react.memo_cache_sentinel")?(G=ve=>{O(ve),ve===""&&L("everything")},e[2]=G):G=e[2];const q=G;let U;e[3]===Symbol.for("react.memo_cache_sentinel")?(U=()=>q(""),e[3]=U):U=e[3];const Z=U;let te;e[4]!==K?(te=nm(K),e[4]=K,e[5]=te):te=e[5];const se=Qf(V,te.searchIn==="messages"),[ie,ne]=p.useState(null),[ue,Q]=p.useState(null),[re,le]=p.useState(false),[Ne,Le]=p.useState(false),[we,Re]=p.useState(null),[ae,ce]=p.useState(false),[Ee,Ie]=p.useState(0),[ke,Oe]=p.useState(false),Fe=l==="drawer"||ke,ut=p.useRef(null);let Ke;e[6]!==ke?(Ke=()=>{ke&&Z(),Oe(!ke)},e[6]=ke,e[7]=Ke):Ke=e[7];const Be=Ke;let He,Je;e[8]!==ke||e[9]!==l?(He=()=>{ke&&l==="sidebar"&&ut.current?.focus()},Je=[ke,l],e[8]=ke,e[9]=l,e[10]=He,e[11]=Je):(He=e[10],Je=e[11]),p.useEffect(He,Je);let $e,it;e[12]===Symbol.for("react.memo_cache_sentinel")?(it=()=>Cd.onDirectoryRequest(()=>le(true)),$e=[],e[12]=$e,e[13]=it):($e=e[12],it=e[13]),p.useEffect(it,$e);let tt;e[14]!==d||e[15]!==u?(tt=()=>{if(!d){Z(),Oe(false),ce(false),ne(null),It.getState().reset();return}Ie(Lb),Oi($i,u).then(Bb)},e[14]=d,e[15]=u,e[16]=tt):tt=e[16];let ee;e[17]!==d?(ee=[d],e[17]=d,e[18]=ee):ee=e[18],p.useEffect(tt,ee);const ge=ns(Fb),st=p.useRef(ge);let jt;e[19]!==ge||e[20]!==d||e[21]!==u?(jt=()=>{const ve=st.current==="reconnecting"&&ge==="connected";st.current=ge,!(!ve||!d)&&Oi($i,u).then(zb)},e[19]=ge,e[20]=d,e[21]=u,e[22]=jt):jt=e[22];let Y;e[23]!==ge?(Y=[ge],e[23]=ge,e[24]=Y):Y=e[24],p.useEffect(jt,Y);let Pe;e[25]!==i?(Pe=()=>i(false),e[25]=i,e[26]=Pe):Pe=e[26];const he=Pe;let Ve,ft;e[27]===Symbol.for("react.memo_cache_sentinel")?(Ve=ve=>{Re(ve),Le(true)},ft=(ve,Ct)=>Q({project:ve,worktree:Ct}),e[27]=Ve,e[28]=ft):(Ve=e[27],ft=e[28]);let at;e[29]!==he||e[30]!==Ee?(at={close:he,openProjectEdit:ne,openNewWorktree:Ve,requestWorktreeDelete:ft,openId:Ee},e[29]=he,e[30]=Ee,e[31]=at):at=e[31];const pt=at,Qe=Fe?F:"";let Ye;e[32]!==K||e[33]!==Qe?(Ye={searchQuery:Qe,searchScope:K,clearSearch:Z,onSearchStatusChange:J,renderList:rb},e[32]=K,e[33]=Qe,e[34]=Ye):Ye=e[34];const ht=Ye;let rt;e[35]!==c?(rt=c.map(Wb),e[35]=c,e[36]=rt):rt=e[36];const mt=rt;let Se;e[37]!==mt||e[38]!==f?(Se=hd(mt,"manual",f),e[37]=mt,e[38]=f,e[39]=Se):Se=e[39];const ot=Se;let Ze;e[40]!==ie||e[41]!==mt?(Ze=mt.find(ve=>ve.id===ie)??null,e[40]=ie,e[41]=mt,e[42]=Ze):Ze=e[42];const xt=Ze,vt=mt.find(ve=>ve.id===we)??null;let lt;e[43]!==h?(lt=ve=>{h(ve),Ls({sidebarProjectSortOrder:ve}),ve!=="manual"&&ce(false)},e[43]=h,e[44]=lt):lt=e[44];const De=lt;let gt;e[45]!==v?(gt=ve=>{v(ve),Ls({sidebarGrouping:ve}),ve==="time"&&ce(false)},e[45]=v,e[46]=gt):gt=e[46];const wt=gt,We=$b;let ct;e[47]!==o?(ct=(ve,Ct,Ft,ts)=>n.jsxs(an,{onClick:ts,className:ln,children:[n.jsx("span",{children:o(Ct)}),Ft?n.jsx(X,{name:"check",className:"size-4 text-primary"}):null]},ve),e[47]=o,e[48]=ct):ct=e[48];const Me=ct;let Dt;e[49]===Symbol.for("react.memo_cache_sentinel")?(Dt={activationConstraint:{distance:8}},e[49]=Dt):Dt=e[49];let nt;e[50]===Symbol.for("react.memo_cache_sentinel")?(nt={coordinateGetter:up},e[50]=nt):nt=e[50];const pe=np(Zr(rp,Dt),Zr(ip,nt));let ye;e[51]!==c||e[52]!==y?(ye=ve=>{const{active:Ct,over:Ft}=ve;if(!Ft||Ct.id===Ft.id)return;const ts=c.findIndex(jn=>jn.id===Ct.id),Nt=c.findIndex(jn=>jn.id===Ft.id);ts<0||Nt<0||y(ts,Nt)},e[51]=c,e[52]=y,e[53]=ye):ye=e[53];const _e=ye,Ce=!F&&c.length>1&&m==="manual"&&b==="project";let Ae;e[54]!==Ce||e[55]!==D||e[56]!==I||e[57]!==ae||e[58]!==b||e[59]!==wt||e[60]!==De||e[61]!==M||e[62]!==C||e[63]!==T||e[64]!==m||e[65]!==c.length||e[66]!==Me||e[67]!==B||e[68]!==E||e[69]!==k||e[70]!==j||e[71]!==R||e[72]!==w||e[73]!==P||e[74]!==N||e[75]!==S||e[76]!==o||e[77]!==z?(Ae=!ae&&c.length>0?n.jsxs(Bi,{children:[n.jsx(Fi,{asChild:true,children:n.jsx(ze,{type:"button",variant:"chip",size:"sm","aria-label":o("sessions.sidebar.header.displayMode.label"),title:o("sessions.sidebar.header.displayMode.label"),style:{touchAction:"manipulation"},children:n.jsx(X,{name:"list-settings",className:"size-4"})})}),n.jsxs(zi,{align:"end",className:"w-64",children:[n.jsx($r,{children:o("sessions.sidebar.header.listGrouping.label")}),sb.map(ve=>{const[Ct,Ft]=ve;return Me(Ct,Ft,b===Ct,()=>wt(Ct))}),b==="project"?n.jsxs(n.Fragment,{children:[n.jsx(Si,{}),n.jsx($r,{children:o("sessions.sidebar.header.actions.sortProjects")}),tb.map(ve=>{const[Ct,Ft]=ve;return Me(Ct,Ft,m===Ct,()=>De(Ct))})]}):null,n.jsx(Si,{}),Me("pinned","sessions.sidebar.header.displayMode.showPinned",N,We(N,R,Kb)),B?Me("work","sessions.sidebar.header.displayMode.showWork",S,We(S,w,Hb)):null,D.map(ve=>n.jsxs(an,{onClick:()=>Zf(ve.id,!M.includes(ve.id)),className:ln,children:[n.jsx("span",{className:"min-w-0 truncate",dir:"auto",children:ve.name}),M.includes(ve.id)?null:n.jsx(X,{name:"check",className:"size-4 text-primary"})]},`section:${ve.id}`)),N?Me("pinned-in-place","sessions.sidebar.header.displayMode.keepPinnedInPlace",C,We(C,k,Vb)):null,B&&S?Me("in-place","sessions.sidebar.header.displayMode.keepWorkInPlace",T,We(T,j,Ub)):null,Me("detailed","sessions.sidebar.header.displayMode.detailedZoneRows",I,We(I,E,Gb)),Me("branch-names","sessions.sidebar.header.displayMode.worktreeNameByBranch",z,We(z,P,qb)),n.jsx(Si,{}),Ce?n.jsx(an,{onClick:()=>ce(true),className:ln,children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(X,{name:"drag-move-2",className:"size-4"}),o("mobile.sessions.editOrder")]})}):null,n.jsx(nb,{})]})]}):null,e[54]=Ce,e[55]=D,e[56]=I,e[57]=ae,e[58]=b,e[59]=wt,e[60]=De,e[61]=M,e[62]=C,e[63]=T,e[64]=m,e[65]=c.length,e[66]=Me,e[67]=B,e[68]=E,e[69]=k,e[70]=j,e[71]=R,e[72]=w,e[73]=P,e[74]=N,e[75]=S,e[76]=o,e[77]=z,e[78]=Ae):Ae=e[78];const et=Ae;let Wt;e[79]!==ae||e[80]!==o?(Wt=ae?n.jsx(ze,{type:"button",variant:"chip",size:"sm","aria-label":o("mobile.sessions.doneEditing"),"aria-pressed":true,onClick:()=>ce(false),style:{touchAction:"manipulation"},children:n.jsx(X,{name:"check",className:"size-4"})}):null,e[79]=ae,e[80]=o,e[81]=Wt):Wt=e[81];const Ot=Wt;let Ue;e[82]!==he||e[83]!==ae||e[84]!==g||e[85]!==o?(Ue=ae?null:n.jsxs(ze,{type:"button",variant:"default",size:"sm","aria-label":o("mobile.sessions.newChat"),onClick:()=>{g(),he()},style:{touchAction:"manipulation"},children:[n.jsx(X,{name:"add",className:"size-4"}),o("mobile.sessions.newChat")]}),e[82]=he,e[83]=ae,e[84]=g,e[85]=o,e[86]=Ue):Ue=e[86];const At=Ue;let bt;e[87]!==ae||e[88]!==o?(bt=ae?null:n.jsx(ze,{type:"button",variant:"chip",size:"sm","aria-label":o("sessions.sidebar.header.actions.addProject"),title:o("sessions.sidebar.header.actions.addProject"),onClick:()=>le(true),style:{touchAction:"manipulation"},children:n.jsx(X,{name:"folder-add",className:"size-4"})}),e[87]=ae,e[88]=o,e[89]=bt):bt=e[89];const Jt=bt,$t=Jb,ys=Sa();let hs;e[90]!==ae||e[91]!==r||e[92]!==ys||e[93]!==o?(hs=r&&!ae?n.jsxs(Bi,{children:[n.jsx(Fi,{asChild:true,children:n.jsx(ze,{type:"button",variant:"chip",size:"sm","aria-label":o("sessions.sidebar.header.actions.more"),title:o("sessions.sidebar.header.actions.more"),style:{touchAction:"manipulation"},children:n.jsx(X,{name:"more",className:"size-4"})})}),n.jsxs(zi,{align:"end",className:"w-56",children:[r.onOpenOverview?$t("compass-3",o("overview.title"),r.onOpenOverview):null,$t("git-pull-request",o("sourceBoard.title"),r.onOpenSourceBoard),$t("calendar-schedule",o("sessions.sidebar.header.actions.scheduledTasks"),r.onOpenScheduled),$t("archive",o("sessions.sidebar.nav.archive"),r.onOpenArchive),$t("bar-chart",o("usageStats.openAction"),r.onOpenUsage),ys.map(Yb)]})]}):null,e[90]=ae,e[91]=r,e[92]=ys,e[93]=o,e[94]=hs):hs=e[94];const xs=hs;let vs;e[95]!==Jt||e[96]!==et||e[97]!==Ot||e[98]!==xs||e[99]!==At?(vs=n.jsxs(n.Fragment,{children:[Jt,et,xs,Ot,At]}),e[95]=Jt,e[96]=et,e[97]=Ot,e[98]=xs,e[99]=At,e[100]=vs):vs=e[100];const us=vs,_t=c.length===0&&!A,ws="flex min-h-0 flex-1 flex-col";let Mt;e[101]!==ae||e[102]!==_t||e[103]!==t||e[104]!==se||e[105]!==K||e[106]!==Fe||e[107]!==V||e[108]!==F||e[109]!==o||e[110]!==Be||e[111]!==l?(Mt=!ae&&!_t&&Fe?n.jsxs("div",{className:de("shrink-0 px-2 pb-1",l==="sidebar"?"pt-2":"pt-1"),children:[n.jsx(em,{inputRef:ut,value:F,onSearch:q,onClose:l==="sidebar"?Be:void 0,active:t,mobile:true,placeholder:o("mobile.sessions.search.placeholder"),clearLabel:o("mobile.sessions.clearSearchAria"),trailing:F!==""?n.jsxs(n.Fragment,{children:[n.jsx(tm,{status:V,scope:K}),n.jsx(sm,{mobile:true,scope:K,onChange:L})]}):void 0}),F!==""&&se?n.jsx("p",{role:"status",className:"px-2.5 pt-1 typography-micro text-muted-foreground",children:se}):null]}):null,e[101]=ae,e[102]=_t,e[103]=t,e[104]=se,e[105]=K,e[106]=Fe,e[107]=V,e[108]=F,e[109]=o,e[110]=Be,e[111]=l,e[112]=Mt):Mt=e[112];let Pt;e[113]!==_t||e[114]!==o?(Pt=_t?n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(db,{title:o("mobile.sessions.empty.noProjectsTitle"),description:o("mobile.sessions.empty.noProjectsDescription"),action:n.jsxs("button",{type:"button",className:"flex items-center justify-center gap-2 rounded-2xl bg-primary px-5 py-3 typography-ui-label text-primary-foreground transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:()=>le(true),children:[n.jsx(X,{name:"folder-add",className:"size-4"}),o("sessions.sidebar.header.actions.addProject")]})})}):null,e[113]=_t,e[114]=o,e[115]=Pt):Pt=e[115];let Lt;e[116]!==pe||e[117]!==ae||e[118]!==_e||e[119]!==ot||e[120]!==o?(Lt=ae?n.jsx(bs,{outerClassName:"min-h-0 flex-1",className:"pb-4",useScrollShadow:true,disableHorizontal:true,children:n.jsxs("div",{className:"flex flex-col gap-2 px-3 py-2",children:[n.jsx("p",{className:"px-1 typography-micro text-muted-foreground",children:o("mobile.sessions.editOrderHint")}),n.jsx(op,{sensors:pe,collisionDetection:ap,onDragEnd:_e,children:n.jsx(lp,{items:ot.map(Xb),strategy:cp,children:n.jsx("div",{className:"flex flex-col gap-1.5",children:ot.map(Qb)})})})]})}):null,e[116]=pe,e[117]=ae,e[118]=_e,e[119]=ot,e[120]=o,e[121]=Lt):Lt=e[121];const is=(ae||_t)&&"hidden";let Yt;e[122]!==is?(Yt=de("flex min-h-0 flex-1 flex-col",is),e[122]=is,e[123]=Yt):Yt=e[123];let Kt;e[124]!==d||e[125]!==ht?(Kt=n.jsx(im,{mobileVariant:true,isVisible:d,phone:ht}),e[124]=d,e[125]=ht,e[126]=Kt):Kt=e[126];let Te;e[127]!==pt||e[128]!==Kt?(Te=n.jsx(wg,{value:pt,children:Kt}),e[127]=pt,e[128]=Kt,e[129]=Te):Te=e[129];let xe;e[130]!==Yt||e[131]!==Te?(xe=n.jsx("div",{className:Yt,children:Te}),e[130]=Yt,e[131]=Te,e[132]=xe):xe=e[132];let kt;e[133]!==r||e[134]!==H||e[135]!==o||e[136]!==l?(kt=r?n.jsxs("div",{"data-keyboard-rider":l==="drawer"?"":void 0,className:"oc-sessions-footer flex shrink-0 items-center justify-between gap-2 border-t border-edge bg-background px-3 pt-1.5",style:{paddingBottom:"calc(0.375rem + var(--oc-safe-area-bottom, 0px))"},children:[n.jsx("div",{className:"flex min-w-0 items-center",children:r.instanceLabel&&r.onOpenInstances?n.jsxs(ze,{type:"button",variant:"info",size:"lg",className:"min-w-0 shrink justify-start",onClick:r.onOpenInstances,"aria-label":o("mobile.menu.instances"),style:{touchAction:"manipulation"},children:[n.jsx(X,{name:"server",className:"size-[18px]"}),n.jsx("span",{className:"block min-w-0 truncate",children:r.instanceLabel})]}):null}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[r.onOpenUpdate?n.jsxs(ze,{type:"button",variant:"chip",size:"lg",className:"relative w-10 px-0",onClick:r.onOpenUpdate,"aria-label":o("mobile.menu.update"),title:o("mobile.menu.update"),style:{touchAction:"manipulation"},children:[n.jsx(X,{name:"download",className:"size-5"}),n.jsx("span",{className:"absolute inset-e-2 top-2 inline-flex size-2 rounded-full bg-primary","aria-hidden":true})]}):null,n.jsxs(gd,{children:[n.jsx(bd,{asChild:true,children:n.jsx(ze,{type:"button",variant:"default",size:"lg",className:"w-10 px-0",onClick:r.onOpenSettings,"aria-label":o("mobile.menu.settings"),style:{touchAction:"manipulation"},children:n.jsx(X,{name:"settings-3",className:"size-5"})})}),n.jsx(yd,{side:"top",children:n.jsx(xd,{label:o("mobile.menu.settings"),shortcut:vd(wd("open_settings",H),"")})})]})]})]}):null,e[133]=r,e[134]=H,e[135]=o,e[136]=l,e[137]=kt):kt=e[137];let Ht;e[138]!==re?(Ht=n.jsx(Nd,{open:re,onOpenChange:le}),e[138]=re,e[139]=Ht):Ht=e[139];const rs=Sd;let Vt;e[140]===Symbol.for("react.memo_cache_sentinel")?(Vt=ve=>{Le(ve),ve||Re(null)},e[140]=Vt):Vt=e[140];const Et=vt?{id:vt.id,path:gr(vt.path)}:void 0;let Xt;e[141]!==he||e[142]!==g||e[143]!==we?(Xt=ve=>{g({selectedProjectId:we,directoryOverride:ve,preserveDirectoryOverride:true}),he()},e[141]=he,e[142]=g,e[143]=we,e[144]=Xt):Xt=e[144];let Qt;e[145]!==rs||e[146]!==Ne||e[147]!==Vt||e[148]!==Et||e[149]!==Xt?(Qt=n.jsx(rs,{open:Ne,onOpenChange:Vt,project:Et,onWorktreeCreated:Xt}),e[145]=rs,e[146]=Ne,e[147]=Vt,e[148]=Et,e[149]=Xt,e[150]=Qt):Qt=e[150];const Ss=xt!==null;let en;e[151]===Symbol.for("react.memo_cache_sentinel")?(en=()=>ne(null),e[151]=en):en=e[151];let Ps;e[152]!==xt||e[153]!==Ss?(Ps=n.jsx(sg,{open:Ss,project:xt,onClose:en}),e[152]=xt,e[153]=Ss,e[154]=Ps):Ps=e[154];let Bt;e[155]!==ue?(Bt=ue?n.jsx(ml,{open:true,project:ue.project,worktree:ue.worktree,onClose:()=>Q(null)}):null,e[155]=ue,e[156]=Bt):Bt=e[156];let Es;e[157]!==Mt||e[158]!==Pt||e[159]!==Lt||e[160]!==xe||e[161]!==kt||e[162]!==Ht||e[163]!==Qt||e[164]!==Ps||e[165]!==Bt?(Es=n.jsxs("div",{className:ws,children:[Mt,Pt,Lt,xe,kt,Ht,Qt,Ps,Bt]}),e[157]=Mt,e[158]=Pt,e[159]=Lt,e[160]=xe,e[161]=kt,e[162]=Ht,e[163]=Qt,e[164]=Ps,e[165]=Bt,e[166]=Es):Es=e[166];const Rs=Es;if(l==="sidebar"){let ve;e[167]===Symbol.for("react.memo_cache_sentinel")?(ve=de(qs,"border-b border-edge"),e[167]=ve):ve=e[167];let Ct;e[168]!==ae||e[169]!==_t||e[170]!==ke||e[171]!==o||e[172]!==Be?(Ct=!ae&&!_t?n.jsx(ze,{type:"button",variant:"chip",size:"sm","aria-label":o("sessions.sidebar.header.actions.searchSessions"),title:o("sessions.sidebar.header.actions.searchSessions"),"aria-pressed":ke,onClick:Be,style:{touchAction:"manipulation"},children:n.jsx(X,{name:"search",className:"size-4"})}):null,e[168]=ae,e[169]=_t,e[170]=ke,e[171]=o,e[172]=Be,e[173]=Ct):Ct=e[173];let Ft;e[174]!==us?(Ft=n.jsx("div",{className:"ms-auto flex shrink-0 items-center gap-2",children:us}),e[174]=us,e[175]=Ft):Ft=e[175];let ts;e[176]!==Ct||e[177]!==Ft?(ts=n.jsxs("div",{className:ve,children:[Ct,Ft]}),e[176]=Ct,e[177]=Ft,e[178]=ts):ts=e[178];let Nt;return e[179]!==Rs||e[180]!==ts?(Nt=n.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[ts,Rs]}),e[179]=Rs,e[180]=ts,e[181]=Nt):Nt=e[181],Nt}let js;e[182]!==he?(js=()=>{const ve=It.getState();if(ve.revealedKey){ve.setRevealed(ve.revealedKey,false);return}he()},e[182]=he,e[183]=js):js=e[183];let Ts;e[184]!==o?(Ts=o("mobile.sessions.sheet.title"),e[184]=o,e[185]=Ts):Ts=e[185];let gs;e[186]!==o?(gs=o("mobile.surface.closeAria"),e[186]=o,e[187]=gs):gs=e[187];let Is,_s;e[188]===Symbol.for("react.memo_cache_sentinel")?(Is={touchAction:"manipulation"},_s=n.jsx(X,{name:"close",className:"size-5"}),e[188]=Is,e[189]=_s):(Is=e[188],_s=e[189]);let As;e[190]!==he||e[191]!==gs?(As=n.jsx("button",{type:"button",className:Zt,"aria-label":gs,onClick:he,style:Is,children:_s}),e[190]=he,e[191]=gs,e[192]=As):As=e[192];let yt;e[193]!==us?(yt=n.jsx("div",{className:"ms-auto flex shrink-0 items-center gap-2",children:us}),e[193]=us,e[194]=yt):yt=e[194];let fs;e[195]!==As||e[196]!==yt?(fs=n.jsxs("div",{className:qs,children:[As,yt]}),e[195]=As,e[196]=yt,e[197]=fs):fs=e[197];let es;return e[198]!==he||e[199]!==t||e[200]!==Rs||e[201]!==js||e[202]!==Ts||e[203]!==fs?(es=n.jsxs(cb,{open:t,onClose:he,onSwipeClose:js,ariaLabel:Ts,children:[fs,Rs]}),e[198]=he,e[199]=t,e[200]=Rs,e[201]=js,e[202]=Ts,e[203]=fs,e[204]=es):es=e[204],es},Io="mobile-surface-root",wl=16,Po=320,ab="cubic-bezier(0.22, 1, 0.36, 1)",lb=s=>{const e=oe.c(3),[t,i]=p.useState(s);let a,r;return e[0]!==s?(a=()=>{if(!s){i(false);return}let l=0;const o=window.setTimeout(()=>{l=window.requestAnimationFrame(()=>{l=window.requestAnimationFrame(()=>i(true))})},wl);return()=>{window.clearTimeout(o),window.cancelAnimationFrame(l)}},r=[s],e[0]=s,e[1]=a,e[2]=r):(a=e[1],r=e[2]),p.useEffect(a,r),t},cb=({open:s,onClose:e,onSwipeClose:t,ariaLabel:i,children:a})=>{const{direction:r}=be(),l=p.useRef(null),o=p.useRef(null),[d,u]=p.useState(false),[c,f]=p.useState(s),y=p.useRef(e);p.useEffect(()=>{y.current=e},[e]);const g=p.useRef(t);p.useEffect(()=>{g.current=t},[t]);const m=()=>(g.current??y.current)();if(kr(o,{enabled:s,...r==="rtl"?{onLeftEdgeSwipe:m}:{onRightEdgeSwipe:m}}),typeof document<"u"&&!l.current){let h=document.getElementById(Io);h||(h=document.createElement("div"),h.id=Io,document.body.appendChild(h)),l.current=h}return p.useEffect(()=>{if(s){f(true);const b=window.setTimeout(()=>u(true),wl);return()=>window.clearTimeout(b)}u(false);const h=window.setTimeout(()=>f(false),Po+40);return()=>window.clearTimeout(h)},[s]),p.useEffect(()=>{if(!s)return;const h=document.body.style.overflow;document.body.style.overflow="hidden";const b=v=>{v.key==="Escape"&&!Na(v)&&y.current()};return document.addEventListener("keydown",b),()=>{document.body.style.overflow=h,document.removeEventListener("keydown",b)}},[s]),l.current?cn.createPortal(n.jsx("section",{ref:o,role:"dialog","aria-modal":"true","aria-label":i,"aria-hidden":!s,className:"oc-keyboard-inset-surface oc-side-safe-area fixed inset-0 z-50 flex flex-col bg-background text-foreground",style:{paddingTop:"var(--oc-safe-area-top, 0px)",transform:d?"none":r==="rtl"?"translateX(100%)":"translateX(-100%)",transition:`transform ${Po}ms ${ab}`,visibility:c?"visible":"hidden",pointerEvents:s?"auto":"none"},children:n.jsx("div",{className:"flex h-full min-h-0 flex-col",children:a})}),l.current):null},db=s=>{const e=oe.c(10),{title:t,description:i,action:a}=s;let r;e[0]!==t?(r=n.jsx("p",{className:"typography-ui-label text-foreground",children:t}),e[0]=t,e[1]=r):r=e[1];let l;e[2]!==i?(l=i?n.jsx("p",{className:"typography-meta text-muted-foreground",children:i}):null,e[2]=i,e[3]=l):l=e[3];let o;e[4]!==a?(o=a?n.jsx("div",{className:"pt-2",children:a}):null,e[4]=a,e[5]=o):o=e[5];let d;return e[6]!==r||e[7]!==l||e[8]!==o?(d=n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 text-center",children:[r,l,o]}),e[6]=r,e[7]=l,e[8]=o,e[9]=d):d=e[9],d};function ub(s){return s.projects}function fb(s){return s.manualProjectOrder}function mb(s){return s.reorderProjects}function pb(s){return s.openNewSessionDraft}function hb(s){return s.projectSortOrder}function gb(s){return s.setProjectSortOrder}function bb(s){return s.setSidebarGrouping}function yb(s){return s.showWorkSection}function xb(s){return s.setShowWorkSection}function vb(s){return s.showPinnedSection}function wb(s){return s.setShowPinnedSection}function Sb(s){return s.keepWorkInPlace}function jb(s){return s.setKeepWorkInPlace}function kb(s){return s.keepPinnedInPlace}function Cb(s){return s.setKeepPinnedInPlace}function Nb(s){return s.detailedZoneRows}function Rb(s){return s.setDetailedZoneRows}function Ib(s){return s.worktreeNameByBranch}function Pb(s){return s.setWorktreeNameByBranch}function Eb(s){return s.sessionWorkEnabled}function Tb(s){return s.sections}function _b(s){return s.kind==="custom"}function Ab(s){return s.hiddenSections}function Db(s){return s.shortcutOverrides}function Ob(s){return Xi(Gs(s))}function Mb(s){return s.activeSessions.some(Ob)}function Lb(s){return s+1}function Bb(){return Ca()}function Fb(s){return s.connectionPhase}function zb(){return Ca()}function Wb(s){return{...s,label:s.label?.trim()||lg(s.path)}}function $b(s,e,t){return()=>{e(!s),t(!s)}}function Kb(s){Ls({sidebarShowPinnedSection:s})}function Hb(s){Ls({sidebarShowWorkSection:s})}function Vb(s){Ls({sidebarKeepPinnedInPlace:s})}function Ub(s){Ls({sidebarKeepWorkInPlace:s})}function Gb(s){Ls({sidebarDetailedZoneRows:s})}function qb(s){Ls({sidebarWorktreeNameByBranch:s})}function Jb(s,e,t){return n.jsx(an,{onClick:t,className:ln,children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(X,{name:s,className:"size-4"}),e]})})}function Yb(s){return n.jsx(an,{onClick:()=>qe.getState().setOpenGuestPage(s.id),className:ln,children:n.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[n.jsx(ii,{icon:ka(s.icon),iconSrc:ja(s.id,s.icon,Qo().authenticatedAsset),className:"size-4 shrink-0"}),n.jsx("span",{className:"truncate",children:s.pageTitle??s.name})]})},s.id)}function Xb(s){return s.id}function Qb(s){return n.jsx(ob,{project:s},s.id)}const Zb=async(s,e)=>{const t=[],i=new Set;let a=s;for(;a&&!i.has(a);){i.add(a);const r=await e(a);if(!r)break;t.push(r),a=r.parentID??Rd(r)}return t},ey=s=>s.split(/[\\/]/).filter(Boolean).pop()??s,ty=(s,e)=>{const t=()=>{const a=qe.getState();a.isSettingsDialogOpen&&(a.setSettingsDialogOpen(false),e(s.includes(Id(a.settingsPage))?"page-content":"nav"))},i=qe.subscribe((a,r)=>{a.isSettingsDialogOpen&&!r.isSettingsDialogOpen&&t()});return t(),i},sy=s=>{const e=oe.c(64),{directory:t,target:i,subtitle:a,revision:r,visible:l,onBack:o}=s,{t:d}=be();let u;e[0]!==t||e[1]!==r||e[2]!==i||e[3]!==l?(u={directory:t,target:i,visible:l,needsSourceSelection:false,revision:r},e[0]=t,e[1]=r,e[2]=i,e[3]=l,e[4]=u):u=e[4];const c=Yp(u),{view:f}=c;let y;e[5]!==i?(y=Jl(i),e[5]=i,e[6]=y):y=e[6];const g=y,[m,h]=p.useState(false),b=c.entry.result?.generatedAt??null,[v,S]=p.useState(null),w=f!==null&&v!==null&&v===b;let N;e[7]!==b||e[8]!==c?(N=q=>{c.handleSelectStop(q),S(b)},e[7]=b,e[8]=c,e[9]=N):N=e[9];const R=N;let T;e[10]!==o||e[11]!==w?(T=()=>{w?S(null):o()},e[10]=o,e[11]=w,e[12]=T):T=e[12];const j=T;let C;e[13]===Symbol.for("react.memo_cache_sentinel")?(C=de(qs,"border-b border-edge text-foreground"),e[13]=C):C=e[13];let k;e[14]!==d?(k=d("header.actions.backAria"),e[14]=d,e[15]=k):k=e[15];let I;e[16]===Symbol.for("react.memo_cache_sentinel")?(I=n.jsx(X,{name:"arrow-left",className:"size-5"}),e[16]=I):I=e[16];let E;e[17]!==j||e[18]!==k?(E=n.jsx("button",{type:"button",className:Zt,"aria-label":k,onClick:j,children:I}),e[17]=j,e[18]=k,e[19]=E):E=e[19];let z;e[20]===Symbol.for("react.memo_cache_sentinel")?(z=de("truncate",ri),e[20]=z):z=e[20];let P;e[21]!==d?(P=d("contextPanel.mode.walkthrough"),e[21]=d,e[22]=P):P=e[22];let B;e[23]!==P?(B=n.jsx("h2",{className:z,children:P}),e[23]=P,e[24]=B):B=e[24];let $;e[25]!==a?($=n.jsx("p",{className:"truncate typography-meta text-muted-foreground",children:a}),e[25]=a,e[26]=$):$=e[26];let _;e[27]!==B||e[28]!==$?(_=n.jsxs("div",{className:"min-w-0 flex-1 px-1",children:[B,$]}),e[27]=B,e[28]=$,e[29]=_):_=e[29];let D;e[30]!==w||e[31]!==c||e[32]!==d||e[33]!==f?(D=w&&f?n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",className:Zt,"aria-label":d("walkthrough.action.previous"),onClick:()=>c.step(-1),children:n.jsx(X,{name:"arrow-right-s",className:"size-5 rotate-180"})}),n.jsx(Xp,{review:c,view:f,size:"mobile"}),n.jsx("button",{type:"button",className:Zt,"aria-label":d("walkthrough.action.next"),onClick:()=>c.step(1),children:n.jsx(X,{name:"arrow-right-s",className:"size-5"})})]}):f||c.blocked||c.showStages?n.jsx("button",{type:"button",className:Zt,"aria-label":d("walkthrough.options.moreAria"),"aria-haspopup":"dialog",onClick:()=>h(true),children:n.jsx(X,{name:"more",className:"size-5"})}):null,e[30]=w,e[31]=c,e[32]=d,e[33]=f,e[34]=D):D=e[34];let M;e[35]!==_||e[36]!==D||e[37]!==E?(M=n.jsxs("header",{className:C,children:[E,_,D]}),e[35]=_,e[36]=D,e[37]=E,e[38]=M):M=e[38];let H;e[39]!==c||e[40]!==f?(H=n.jsx(nh,{review:c,view:f}),e[39]=c,e[40]=f,e[41]=H):H=e[41];let A;e[42]!==g||e[43]!==R||e[44]!==w||e[45]!==c||e[46]!==f?(A=n.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:c.blocked?n.jsx(Qp,{reason:c.blocked.reason,model:c.blocked.model,requiredChars:c.blocked.requiredChars,availableChars:c.blocked.availableChars,onRetry:c.retry}):c.showStages?n.jsx("div",{className:"flex flex-1 flex-col items-center justify-center gap-3 p-8",children:n.jsx(Zp,{progress:c.stageProgress})}):f&&w?n.jsx(eh,{view:f,activeStopId:c.activeStopId,scrollToStopId:c.scrollToStopId,onActiveStopChange:c.handleActiveStopChange,onScrollHandled:c.clearScrollRequest,renderSideBySide:false,wrapLines:true,commentOrigin:g}):f?n.jsx(th,{view:f,activeStopId:c.activeStopId,visitedStopIds:c.visitedStopIds,onSelectStop:R}):n.jsx(sh,{review:c,size:"mobile"})}),e[42]=g,e[43]=R,e[44]=w,e[45]=c,e[46]=f,e[47]=A):A=e[47];let F;e[48]===Symbol.for("react.memo_cache_sentinel")?(F=()=>h(false),e[48]=F):F=e[48];let O;e[49]!==d?(O=d("walkthrough.options.title"),e[49]=d,e[50]=O):O=e[50];const K=f!==null;let L;e[51]===Symbol.for("react.memo_cache_sentinel")?(L=()=>h(false),e[51]=L):L=e[51];let V;e[52]!==c||e[53]!==K?(V=n.jsx(ih,{review:c,hasView:K,size:"mobile",onActed:L}),e[52]=c,e[53]=K,e[54]=V):V=e[54];let J;e[55]!==m||e[56]!==O||e[57]!==V?(J=n.jsx(Yn,{open:m,onClose:F,title:O,children:V}),e[55]=m,e[56]=O,e[57]=V,e[58]=J):J=e[58];let G;return e[59]!==M||e[60]!==H||e[61]!==A||e[62]!==J?(G=n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[M,H,A,J]}),e[59]=M,e[60]=H,e[61]=A,e[62]=J,e[63]=G):G=e[63],G};async function ny(s,e,t=Number.POSITIVE_INFINITY){const i=Array.from(new Set(s)),a=[];return await Pd(i,t,async r=>{try{await e(r)}catch(l){a.push({path:r,error:l instanceof Error?l:null})}}),{paths:i,failures:a}}const iy=async(s,e,t)=>{const{targetBranch:i,directory:a,sourceBranch:r,git:l,publishChooser:o,toast:d,t:u}=t;if(!(!i||!a)){if(!l.createGitCommit)throw new Error("Git commit is unavailable on this runtime");if(await l.createGitCommit(a,s,{addAll:true}),e)try{await(await o.prepare("push"))()}catch{d.error(u("gitView.dirtySwitch.pushFailed")),await t.refreshStatusAndBranches(),t.closeDialog();return}d.success(r?e?u("gitView.publish.succeeded"):u("gitView.dirtySwitch.committedNotPushed",{branch:r}):u("gitView.toast.commitCreated")),await t.refreshStatusAndBranches(),t.closeDialog(),await t.performCheckout(i)}},si=s=>Zs(s)??s,ry=(s,e)=>{const t=si(s),i=si(e.directory);return t?i===t?t:i.startsWith(t.endsWith("/")?t:`${t}/`)?i:null:null},oy=(s,e)=>!!s&&si(s)===si(e.directory),Eo={status:"loading"},ay=1e6,as={type:"list"},ly=2,To=s=>{const e=s.index?.trim();return!!(e&&e!=="?")},_o=s=>{const e=s.working_dir?.trim(),t=s.index?.trim();return!!(e||t==="?")},Ao=(s,e)=>e?`${s}\0staged`:s,Pi=new WeakSet,Do=new WeakSet,Oo=new WeakSet,Mo=(s,e,t)=>t.filter(i=>au(s,e,i)).sort((i,a)=>i.length-a.length)[0],cy=s=>{const e=oe.c(16),t=Ra(),i=Zs(Ia(t,ir()))??"",a=s.visible??true;let r;e[0]!==a?(r={enabled:a,recheckOnOpen:true},e[0]=a,e[1]=r):r=e[1];const l=Ed(i||null,r);let o;e[2]!==i?(o=h=>i?h.changesRepositories.get(i):void 0,e[2]=i,e[3]=o):o=e[3];const d=nn(o);let u;e[4]!==l||e[5]!==d?(u=d&&l.repositoryOptions?.includes(d)?{...l,gitDirectory:d}:l,e[4]=l,e[5]=d,e[6]=u):u=e[6];const c=u,f=s.initialCommit;let y,g;if(e[7]!==f||e[8]!==i?(y=()=>{if(!f||!i||Do.has(f))return;Do.add(f);const h=ry(i,f);h&&(nn.getState().clearChangesRepository(i),ss.getState().selectNestedRepo(i,h))},g=[f,i],e[7]=f,e[8]=i,e[9]=y,e[10]=g):(y=e[9],g=e[10]),p.useEffect(y,g),t?.kind==="preparing"){let h;return e[11]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(Ma,{}),e[11]=h):h=e[11],h}let m;return e[12]!==s||e[13]!==c||e[14]!==i?(m=n.jsx(dy,{...s,rootDirectory:i,repository:c}),e[12]=s,e[13]=c,e[14]=i,e[15]=m):m=e[15],m},dy=({rootDirectory:s,repository:e,onClose:t,initialDiff:i,initialCommit:a,visible:r=true,onNavigatedToChat:l})=>{const{t:o}=be(),{git:d,sourceControl:u}=tr(),{rootIsGitRepo:c,gitDirectory:f,nestedRepos:y,repositoryOptions:g}=e,m=f??s,h=Td(m||null),b=_d(m),v=Ad(m||null),S=Dd(m||null),[w,N]=p.useState(false),[R,T]=p.useState(false),j=Kn(x=>x.profiles),C=Kn(x=>x.globalIdentity),k=Kn(x=>x.loadProfiles),I=Kn(x=>x.loadGlobalIdentity);p.useEffect(()=>{k(),I()},[k,I]);const E=Od(),z=Wi(x=>x.identities),P=p.useMemo(()=>Md(z),[z]),B=Wi(x=>x.refreshIdentityAccounts),$=p.useMemo(()=>Ld(j,C,x=>Yl(x)&&Bd(x,E)),[j,C,E]),_=async x=>{if(!(!m||R)){T(true);try{(await uu({directory:m,identity:x,remoteName:Ce||null},{git:d,sourceControl:u})).status==="failed"?me.error(o("gitView.toast.applyIdentityFailed")):me.success(o("gitView.toast.appliedIdentity",{name:fu(x,o)}))}finally{T(false)}}},D=fa(m||null),M=Fd(m||null),H=ss(x=>x.setActiveDirectory),A=ss(x=>x.ensureAll),F=ss(x=>x.ensureNestedRepos),O=ss(x=>x.selectNestedRepo),K=ss(x=>x.fetchStatus),L=ss(x=>x.fetchBranches),V=ss(x=>x.prefetchDiffs),J=ss(x=>x.getDiff),G=ss(x=>x.setDiff),q=ss(x=>x.runtimeKey),U=JSON.stringify([q,m]),Z=p.useRef(U);Z.current=U;const[te,se]=p.useState(()=>i?.scope==="turn"?{ownerKey:U,mode:Pi.has(i)?"working":"turn",route:as}:{ownerKey:U,mode:"working",route:i?.path?{type:"diff",path:i.path,staged:i.staged}:as}),[ie,ne]=p.useState(null),ue=ie?.step==="turn"?"turn":"working",Q=te.ownerKey===U?te.mode:ue,re=te.ownerKey===U?te.route:as,[le,Ne]=p.useState(false),Le=p.useCallback(x=>{se({ownerKey:U,mode:x,route:as}),Ne(false)},[U]),we=p.useCallback(x=>{se(W=>({ownerKey:U,mode:W.ownerKey===U?W.mode:"working",route:x}))},[U]);p.useEffect(()=>{se(x=>x.ownerKey===U?x:{ownerKey:U,mode:ue,route:as}),Ne(false)},[ue,U]),p.useEffect(()=>{r||Ne(false)},[r]);const Re=p.useRef(null);p.useEffect(()=>{if(i?.path){if(i.scope==="turn"){if(Pi.has(i))return;Pi.add(i),Re.current=null,ne({file:i.path,sessionId:dt.getState().currentSessionId,step:"turn",picked:false,statusReadFor:null}),se({ownerKey:Z.current,mode:"turn",route:as});return}ne(null),se({ownerKey:Z.current,mode:"working",route:{type:"diff",path:i.path,staged:i.staged}})}},[i]),p.useEffect(()=>{!a||Oo.has(a)||!oy(m,a)||(Oo.add(a),ne(null),se({ownerKey:Z.current,mode:"commit",route:as}))},[m,a]);const[ae,ce]=p.useState(null),[Ee,Ie]=p.useState(null),ke=Fp(),[Oe,Fe]=p.useState(""),[ut,Ke]=p.useState(new Set),[Be,He]=p.useState(false),[Je,$e]=p.useState(false),[it,tt]=p.useState([]),[ee,ge]=p.useState([]),[st,jt]=p.useState([]),[Y,Pe]=p.useState(null),[he,Ve]=p.useState(null),[ft,at]=p.useState(0),pt=rm(),Qe=om({directory:m,branch:h?.current,chooseContributor:pt.choose}),Ye=zd(m,d,u),[ht,rt]=p.useState(null),[mt,Se]=p.useState(false),[ot,Ze]=p.useState([]),[xt,vt]=p.useState("rebase"),lt=p.useCallback((x,W)=>{Ze(x),vt(W),Se(true)},[]),De=h?.current??null,gt=Yr(x=>x.setOverride),wt=Yr(x=>x.clearOverride),We=rh(m||null,De,r&&Q==="commit"&&D===true),ct=We.selectedCommit?.hash??null,Me=Wd(m||null,u),Dt=p.useMemo(()=>new Set(Me.read?.repository.remotes.map(x=>x.name)??[]),[Me.read]),nt=am(m||null,De,r&&D===true,{branches:v,remoteNames:Dt,primaryRemote:Me.contexts[0]?.primaryRemote,readContext:Me.contexts[0]??null}),pe=r&&D===true;qp(pe&&m||null,pe?De:null,Me);const ye=Tp(De,nt.base),_e=D===false||_p(De,nt.base,h!==null,nt.resolved),Ce=Me.read?.binding?.remotes[0]?.name??Me.read?.repository.remotes.find(x=>x.name==="origin")?.name??Me.read?.repository.remotes[0]?.name??"",Ae=Me.read?Me.read.binding?.providers.find(x=>x.readiness==="ready")?.accountId??null:void 0,et=p.useMemo(()=>$d(j,C,S,x=>({id:"local-config",name:x.userName,...x,color:"info",icon:"user"}),Ae),[Ae,S,j,C]),Wt=p.useMemo(()=>{const x=Me.read;return!x?.binding||Me.status!=="ready"||x.binding.state==="bound"?null:Kd(x.binding)?o("gitView.identity.configChanged"):o("gitView.context.needsAttention")},[Me.read,Me.status,o]),Ot=nn(x=>s?x.diffRequests.get(s):void 0);p.useEffect(()=>{Ot&&se({ownerKey:U,mode:"pr",route:as})},[U,Ot]);const Ue=oh(m||null,De,Me.contexts[0]??null,r&&Q==="pr"&&D===true,Ot),At=Xl(Ue.provider),bt=Ue.selectedSource;p.useEffect(()=>{!s||!Ot||!h||bt!==Ot||nn.getState().settleDiffRequest(s,Ot)},[Ot,s,bt,h]);const Jt=dt(x=>x.currentSessionId),{diffs:$t,loaded:ys,settled:hs,error:xs,retry:vs}=Ap(Jt,s||void 0,{enabled:r&&Q==="turn",live:true}),[us,_t]=p.useState(false),ws=p.useCallback(()=>{_t(false),l?.()},[l]),Mt=Hd(Jt,s,ws),Pt=p.useMemo(()=>Q==="pr"?Ue.diffUnavailable?null:bt:Q==="branch"&&De&&nt.base?{kind:"branch",baseRef:nt.base,headRef:De}:Q==="commit"&&ct?{kind:"commit",hash:ct}:null,[nt.base,De,Q,Ue.diffUnavailable,ct,bt]),Lt=Q==="branch"?nt.revision:"",is=bt?Ue.prs.find(x=>x.number===bt.number)?.headSha:void 0,Yt=p.useMemo(()=>Ql(Pt,{provider:Ue.provider,revision:is}),[Pt,Ue.provider,is]),{review:Kt,provider:Te}=lm(Ue,m,r&&Q==="pr"),xe=Dp(m||null,Pt,r&&D===true,Lt,Ue.readContext,Ue.provider),{fetchDiff:kt,fetchFullFile:Ht,fetchVersions:rs}=xe,Vt=p.useMemo(()=>xe.files?[...xe.files].sort((x,W)=>x.path.localeCompare(W.path)):null,[xe.files]),Et=re.type==="comparison"&&re.sourceKey===xe.key?re.path:null,[Xt,Qt]=p.useState(0),Ss=p.useCallback(async x=>{try{if(Pa(x)){const Xe=await rs(x);return{status:"ready",diff:Ba(Xe.original,Xe.modified)?Xe:{original:"",modified:"",isBinary:true}}}const{diff:W}=await kt(x),fe={original:"",modified:"",isBinary:so(W)};return fe.isBinary||(fe.fileDiff=ki(x,W)),{status:"ready",diff:fe}}catch(W){return{status:"error",message:W instanceof Error?W.message:o("diffView.state.failedToLoadDiff")}}},[kt,rs,o]),en=p.useMemo(()=>Q==="branch"?Op(xe.files,Lt):void 0,[xe.files,Lt,Q]),Ps=Mp(xe.files?Q==="pr"?JSON.stringify([xe.key,xe.revision]):xe.key:null,r&&Et?Et:"",r?Ss:null,Eo,JSON.stringify([Q==="pr"?xe.revision:0,Xt]),en),Bt=Et?Ps.get(Et)??Eo:null,[Es,Rs]=p.useState(null),[js,Ts]=p.useState(null),gs=Es&&Es.source===Bt?Es.request:null,Is=js&&js.source===Bt?js.diff:null;p.useEffect(()=>{const x=Bt;if(!gs||!Et||x?.status!=="ready"||Is)return;let W=false;const fe=Et,Xe=async()=>{if(Q==="pr"){const{original:os,modified:Rt}=await Ht(fe);return{original:os,modified:Rt,fileDiff:fh({name:fe,contents:os},{name:fe,contents:Rt})}}const{diff:je}=await kt(fe,ay);return{original:"",modified:"",fileDiff:ki(fe,je)}};return(async()=>{try{const je=await Xe();W||Ts({source:x,diff:je})}catch(je){if(W)return;me.error(je instanceof Error?je.message:o("diffView.state.failedToLoadDiff")),Rs(null)}})(),()=>{W=true}},[Bt,Et,Is,kt,Ht,Q,gs,o]),p.useEffect(()=>{Q==="branch"&&_e&&Le("working")},[_e,Le,Q]),p.useEffect(()=>{se(x=>x.ownerKey===U&&x.route.type==="comparison"&&x.route.sourceKey!==xe.key?{...x,route:as}:x)},[xe.key,U]);const _s=p.useMemo(()=>$t.map(x=>({path:x.file??"",status:Lp(x.status),insertions:x.additions??0,deletions:x.deletions??0})).filter(x=>x.path).sort((x,W)=>x.path.localeCompare(W.path)),[$t]),As=p.useMemo(()=>{const x=new Map;for(const W of $t)if(W.file){if(typeof W.patch=="string"){const fe=so(W.patch);x.set(W.file,{original:"",modified:"",isBinary:fe,fileDiff:fe?void 0:ki(W.file,W.patch)});continue}x.set(W.file,{original:W.before??"",modified:W.after??""})}return x},[$t]),yt=p.useMemo(()=>{const x=h?.files??[],W=new Map;for(const fe of x)W.set(fe.path,fe);return Array.from(W.values()).sort((fe,Xe)=>fe.path.localeCompare(Xe.path))},[h?.files]);p.useEffect(()=>{if(!ie||!r)return;if(ie.sessionId!==Jt||re.type!=="list"||Q!==(ie.step==="turn"?"turn":"working")){ne(null);return}const x=Vd(s,ie.file);if(ie.step==="turn"){if(!hs)return;const je=Mo(x,s,$t.map(os=>os.file));if(je){ne(null),se({ownerKey:U,mode:"turn",route:{type:"turn",path:je}});return}ne({...ie,step:"changes"}),se({ownerKey:U,mode:"working",route:as});return}if(!e.repositoriesKnown||!m)return;const W=Ud(x,[...c&&s?[s]:[],...g??[]]);if(W&&W!==m){if(ie.picked){ne(null);return}ne({...ie,picked:true}),nn.getState().clearChangesRepository(s),O(s,W);return}if(ie.statusReadFor!==m){if(Re.current===m)return;Re.current=m,K(m,d,{silent:true}).finally(()=>{ne(je=>je&&{...je,statusReadFor:m})});return}ne(null);const fe=Mo(x,m,yt.map(je=>je.path)),Xe=yt.find(je=>je.path===fe);Xe&&se({ownerKey:U,mode:"working",route:{type:"diff",path:Xe.path,staged:To(Xe)&&!_o(Xe)}})},[yt,m,Jt,K,d,$t,Q,U,e.repositoriesKnown,g,s,c,re.type,O,hs,ie,r]);const fs=p.useMemo(()=>Q==="working"?yt.length>0?{source:{kind:"working-tree",scope:"all"}}:null:!Pt||!Vt?.length?null:Pt.kind==="pr"?Ue.readContext?{source:Pt,context:Ue.readContext}:null:{source:Pt},[yt.length,Vt,Pt,Q,Ue.readContext]),es=p.useMemo(()=>yt.filter(To),[yt]),ve=p.useMemo(()=>yt.filter(_o),[yt]),Ct=st,Ft=ss(p.useCallback(x=>!m||re.type!=="diff"?null:x.directories.get(m)?.diffCache.get(Ao(re.path,re.staged))??null,[m,re])),ts=p.useMemo(()=>re.type!=="diff"?null:yt.find(x=>x.path===re.path)??null,[yt,re]),Nt=p.useCallback(async(x=true)=>{if(m)try{await Promise.all([K(m,d),L(m,d)])}catch(W){x&&me.error(W instanceof Error?W.message:o("gitView.toast.refreshRepositoryFailed"))}},[m,L,K,d,o]),jn=p.useMemo(()=>(v?.all??[]).filter(x=>!x.startsWith("remotes/")).sort(),[v]),Cl=p.useMemo(()=>(v?.all??[]).filter(x=>x.startsWith("remotes/")).map(x=>x.replace(/^remotes\//,"")).sort(),[v]),Fn=p.useCallback(async x=>{if(!m)return;const W=x.replace(/^remotes\//,"");try{if(!d.checkoutBranch)throw new Error("Branch checkout is unavailable on this runtime");const fe=await d.checkoutBranch(m,W);me.success(o("gitView.toast.checkedOut",{name:fe.branch||W})),await Nt()}catch(fe){me.error(fe instanceof Error?fe.message:o("gitView.toast.checkoutFailed",{name:W}))}},[m,d,Nt,o]),Nl=p.useCallback(x=>{const W=x.replace(/^remotes\//,"");if((h?.files?.length??0)>0){rt(W);return}Fn(W)},[Fn,h?.files]),Rl=p.useCallback(async x=>{if(m)try{if(await d.createBranch(m,x,De??"HEAD"),!d.checkoutBranch)throw new Error("Branch checkout is unavailable on this runtime");await d.checkoutBranch(m,x),await Nt()}catch(W){throw me.error(W instanceof Error?W.message:o("gitView.toast.createBranchFailed")),W}},[De,m,d,Nt,o]),zn=p.useCallback(async()=>{if(!m){jt([]);return}try{const x=await d.getRemotes(m);jt(x)}catch{jt([])}},[m,d]),$s=p.useCallback(async()=>{m&&(Promise.allSettled([L(m,d),zn()]),await K(m,d).catch(()=>{}))},[m,L,K,d,zn]);p.useEffect(()=>{!m||!r||(H(m),A(m,d))},[m,A,d,H,r]),p.useEffect(()=>{r&&zn()},[zn,r]),p.useEffect(()=>{if(!r||Q!=="working"||!m||yt.length===0)return;const x=Array.from(new Set([...es.map(fe=>fe.path),...ee,...yt.slice(0,20).map(fe=>fe.path)])).filter(Boolean);if(x.length===0)return;const W=window.setTimeout(()=>{V(m,d,x,{maxFiles:40})},120);return()=>window.clearTimeout(W)},[yt,m,d,Q,V,es,ee,r]),p.useEffect(()=>{if(!r)return;if(re.type!=="diff"){Pe(null);return}const x=Ao(re.path,re.staged);if(Ve(null),!m||J(m,x)){Pe(null);return}let W=false;const fe=xn();if(Pe(null),!d.getGitFileDiff){Pe("Diff is unavailable on this runtime");return}const Xe=yt.find(je=>je.path===re.path)?.previousPath;return d.getGitFileDiff(m,{path:re.path,staged:re.staged||void 0,previousPath:Xe}).then(je=>{W||G(m,x,{original:je.original??"",modified:je.modified??"",isBinary:je.isBinary,submodule:je.submodule},fe)}).catch(je=>{if(!W){if(je instanceof Dr&&je.reason!=="path_not_found"){Ve({key:`${m}\0${re.path}`,reason:je.reason});return}je instanceof Dr&&K(m,d,{force:true,silent:true}),Pe(je instanceof Error?je.message:String(je))}}),()=>{W=true}},[yt,m,ft,K,J,d,re,G,r]);const kn=async(x,W,fe=false)=>{if(!m)return;const Xe=Ye.start();if(!Xe)return;ce(x);const je=o(x==="fetch"?"gitView.sync.fetch":x==="pull"?"gitView.sync.pull":x==="publish"?"gitView.publish.title":"gitView.sync.syncChanges");let os=null;try{if(x==="sync"||x==="publish"){const Rt=await Qe.prepare(x==="publish"?"push":"sync",{forceChoose:fe,onOperation:Xe.onOperation});os=mu(await Rt())}else if(W&&h)await pu({action:x,directory:m,remoteName:W.name,status:h,sourceControl:u,git:d,onOperation:Xe.onOperation});else throw new Ds("tracking-required");if(!Xe.isCurrent())return;x==="fetch"&&W?me.success(o("gitView.toast.fetchedFromRemote",{name:W.name})):x==="pull"&&W?me.success(o("gitView.toast.pulledFromRemote",{name:W.name})):x==="sync"?me.success(os?.kind==="up-to-date"?o("gitView.toast.alreadyUpToDate"):os?.kind==="pulled"?o("gitView.toast.pulledFromRemote",{name:os.remoteName}):os?.kind==="pushed"?o("gitView.toast.pushedToUpstream",{name:os.remoteName}):o("gitView.toast.syncedChanges")):x==="publish"&&me.success(o("gitView.publish.succeeded")),await $s()}catch(Rt){if(Rt instanceof Gn||Rt instanceof Mi){if(Xe.isCurrent()&&await $s(),Xe.isCurrent()&&Rt instanceof Gn&&Rt.read.availability==="available"&&Rt.read.operation.state==="conflicted"&&Rt.read.operation.error.code==="CONFLICT"){const Tr=((await d.getGitStatus(m).catch(()=>null))?.files??[]).filter(ji).map(Ml=>Ml.path);Tr.length>0&<(Tr,"merge")}return}if(Rt instanceof Ds&&Rt.code==="stale-runtime")return;if(Rt instanceof Ds&&Qe.errorMessage(Rt)){me.info(Qe.errorMessage(Rt));return}await $s(),me.error(Rt instanceof Ds?Rt.code==="contributor-publish-cancelled-after-update"?o("gitView.toast.contributorPublishCancelledAfterUpdate"):Rt.code==="contributor-publish-cancelled"?o("gitView.toast.contributorPublishCancelled"):o("gitView.toast.syncActionFailed",{action:je}):Rt instanceof Error?Qr(Rt,o):o("gitView.toast.syncActionFailed",{action:je}))}finally{Xe.finish(),Xe.isCurrent()&&ce(null)}},Cn=p.useCallback(async(x,W)=>{if(!(!m||x.length===0))try{W==="stage"?x.length>1?await Gd(m,x):await qd(m,x[0]):x.length>1?await Jd(m,x):await Yd(m,x[0]),await Nt(false)}catch(fe){me.error(fe instanceof Error?fe.message:o(W==="stage"?"gitView.toast.stageFileFailed":"gitView.toast.unstageFileFailed"))}},[m,Nt,o]),hi=p.useCallback((x,W=false)=>{we({type:"diff",path:x,staged:W})},[we]),gi=p.useCallback(async x=>{if(m){Ke(W=>new Set(W).add(x));try{await d.revertGitFile(m,x),me.success(o("gitView.toast.revertedFile",{path:x})),await Nt(false)}catch(W){me.error(W instanceof Error?W.message:o("gitView.toast.revertFailed"))}finally{Ke(W=>{const fe=new Set(W);return fe.delete(x),fe})}}},[m,d,Nt,o]),Nr=p.useCallback(async x=>{if(!m||x.length===0||Be)return;const W=Array.from(new Set(x));He(true),Ke(new Set(W));try{const fe=await ny(W,Xe=>d.revertGitFile(m,Xe),ly);if(await Nt(false),fe.failures.length===0)me.success(W.length===1?o("gitView.toast.revertedFilesSingle",{count:W.length}):o("gitView.toast.revertedFilesPlural",{count:W.length}));else if(fe.failures.length===W.length)me.error(fe.failures[0]?.error?.message??o("gitView.toast.revertFailed"));else{const Xe=W.length-fe.failures.length;me.warning(Xe===1?o("gitView.toast.revertedSomeSingle",{success:Xe,failed:fe.failures.length}):o("gitView.toast.revertedSomePlural",{success:Xe,failed:fe.failures.length}))}}catch(fe){me.error(fe instanceof Error?fe.message:o("gitView.toast.revertFailed"))}finally{Ke(new Set),He(false)}},[m,d,Be,Nt,o]),Il=p.useCallback(x=>{const W=x.map(fe=>fe.trim()).filter(Boolean);if(W.length===0){tt([]);return}Fe(fe=>`${fe.trim()}${fe.trim()?`
|
|
23
23
|
|
|
24
24
|
`:""}${W.join(`
|
|
25
|
-
`)}`.trim()),tt([])},[]),Pl=p.useCallback(async()=>{if(!m)return;const x=es.map(W=>W.path).sort();if(x.length===0){me.error(o("gitView.toast.selectFileToDescribe"));return}$e(true);try{const{message:W}=await Kr(m,x);Fe(W.subject?.trim()??""),tt(Array.isArray(W.highlights)?W.highlights:[])}catch(W){me.error(W instanceof Error?W.message:o("gitView.toast.generateCommitMessageFailed"))}finally{$e(false)}},[m,es,o]),Rr=async(x={})=>{if(!m)return;if(!Oe.trim()){me.error(o("gitView.toast.enterCommitMessage"));return}const W=es.map(je=>je.path).sort();if(W.length===0){me.error(o("gitView.toast.selectFileToCommit"));return}Ie(x.pushAfter?"commitAndPush":"commit");let fe=null,Xe="pending";try{if(!d.createGitCommit)throw new Error("Git commit is unavailable on this runtime");const je=await d.createGitCommit(m,Oe.trim(),{files:W});Xe="local";const os=ke.committed(je.summary,x);if(Fe(""),tt([]),x.pushAfter){if(fe=Ye.start(),!fe){me.warning(o("gitView.publish.commitKept")),await $s();return}const Rt=await Qe.prepare("push",{onOperation:fe.onOperation});ce("publish"),await Rt(),Xe="published",ke.pushed({deletion:os,origin:x.origin})}await $s()}catch(je){if(x.pushAfter&&Xe==="local"&&me.warning(o("gitView.publish.commitKept")),je instanceof Gn||je instanceof Mi){await $s();return}if(je instanceof Ds&&je.code==="stale-runtime")return;if(je instanceof Ds&&Qe.errorMessage(je)){me.info(Qe.errorMessage(je));return}x.pushAfter&&await $s(),me.error(je instanceof Ds?je.code==="contributor-publish-cancelled-after-update"?o("gitView.toast.contributorPublishCancelledAfterUpdate"):je.code==="contributor-publish-cancelled"?o("gitView.toast.contributorPublishCancelled"):o("gitView.toast.syncActionFailed",{action:o("gitView.sync.syncChanges")}):je instanceof Error?Qr(je,o):o("gitView.toast.createCommitFailed"))}finally{fe?.finish(),Ie(null),x.pushAfter&&ce(null)}},El=p.useMemo(()=>(h?.files??[]).filter(ji).length,[h?.files]),Nn=!!h?.mergeInProgress?.head,Tl=p.useCallback(async()=>{if(m)try{if(Nn){if(!d.continueMerge)throw new Error("Git continue merge is unavailable on this runtime");const x=await d.continueMerge(m);x.conflict?(lt(x.conflictFiles??[],"merge"),me.error(o("gitView.toast.mergeConflictsDetected"))):me.success(o("gitView.toast.mergeCompleted"))}else{if(!d.continueRebase)throw new Error("Git continue rebase is unavailable on this runtime");const x=await d.continueRebase(m);x.conflict?(lt(x.conflictFiles??[],"rebase"),me.error(o("gitView.toast.rebaseConflictsDetected"))):me.success(o("gitView.toast.rebaseStepCompleted"))}await Nt(false)}catch(x){me.error(x instanceof Error?x.message:o("gitView.toast.continueOperationFailed"))}},[m,d,Nn,lt,Nt,o]),Ir=p.useCallback(async x=>{if(m)try{if(x==="merge"){if(!d.abortMerge)throw new Error("Git abort merge is unavailable on this runtime");await d.abortMerge(m),me.success(o("gitView.toast.mergeAborted"))}else{if(!d.abortRebase)throw new Error("Git abort rebase is unavailable on this runtime");await d.abortRebase(m),me.success(o("gitView.toast.rebaseAborted"))}await Nt(false)}catch(W){me.error(W instanceof Error?W.message:o("gitView.toast.abortOperationFailed"))}},[m,d,Nt,o]),_l=p.useCallback(()=>{const x=(h?.files??[]).filter(ji).map(W=>W.path);lt(x,Nn?"merge":"rebase")},[Nn,lt,h?.files]),Al=p.useMemo(()=>{const x=[];return es.length>0&&x.push({id:"staged",title:o("gitView.changes.stagedTitle"),entries:es,statsScope:"staged",actionSymbol:"-",actionAllLabel:o("gitView.changes.unstageAllAria"),getActionLabel:W=>o("gitView.changes.unstageFileAria",{path:W}),onActionFile:W=>{Cn([W],"unstage")},onActionAll:W=>{Cn(W,"unstage")},onViewDiff:W=>hi(W,true),onRevertFile:gi,showRevertActions:false,accent:true}),ve.length>0&&x.push({id:"unstaged",title:o("gitView.changes.title"),entries:ve,statsScope:"working",actionSymbol:"+",actionAllLabel:o("gitView.changes.stageAllAria"),getActionLabel:W=>o("gitView.changes.stageFileAria",{path:W}),onActionFile:W=>{Cn([W],"stage")},onActionAll:W=>{Cn(W,"stage")},onViewDiff:W=>hi(W,false),onRevertFile:gi}),x},[gi,hi,Cn,es,o,ve]),Pr=n.jsxs(n.Fragment,{children:[Qe.context?n.jsx(cm,{context:Qe.context,onSelect:Qe.settle}):null,Qe.confirmDialog,n.jsx(dm,{candidates:pt.candidates,onSelect:pt.settle})]}),Er=g?n.jsx(du,{repositories:g,selectedRepository:f??null,onSelectRepository:x=>{s&&(nn.getState().clearChangesRepository(s),O(s,x))},repositoryRoot:s??void 0}):null,Wn=x=>n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[Pr,n.jsxs("header",{className:de(qs,"text-foreground"),children:[t?n.jsx("button",{type:"button",className:Zt,"aria-label":o("mobile.surface.closeAria"),onClick:t,style:{touchAction:"manipulation"},children:n.jsx(X,{name:"close",className:"size-5"})}):null,n.jsxs("div",{className:"min-w-0 flex-1 px-1",children:[n.jsx("h2",{className:ri,children:o("mobile.nav.changes")}),n.jsx("p",{className:"truncate typography-micro text-muted-foreground",children:h?.current||m||""})]}),Er]}),n.jsx("div",{className:"min-h-0 flex-1",children:x})]});if(!m)return Wn(n.jsx(Ut,{message:o("gitView.empty.selectSessionOrDirectory")}));if(e.unreadable)return Wn(n.jsx(um,{directory:e.unreadable.directory,message:e.unreadable.message}));if(c===false&&D!==true)return Wn(n.jsx(mm,{root:s,rootIsGitRepo:c,resolvedIsGitRepo:D,nestedRepos:y,onRetryDiscovery:()=>{s&&F(s,{force:true})}}));if(M&&D===null)return Wn(n.jsx(Ut,{loading:true,message:o("gitView.loading.checkingRepository")}));if(re.type==="diff")return n.jsx(Ei,{path:re.path,previousPath:ts?.previousPath,diff:Ft,staged:re.staged,fileExists:!!ts,unavailableReason:he?.key===`${m}\0${re.path}`?he.reason:null,error:Y,onBack:()=>we({type:"list"}),onRetry:()=>at(x=>x+1)});if(re.type==="turn")return n.jsx(Ei,{path:re.path,subtitle:o("diffView.scope.lastTurn"),diff:As.get(re.path)??null,fileExists:_s.some(x=>x.path===re.path),onBack:()=>we(as)});const bi=o(Q==="pr"?Hn("session.githubIntegration.tabs.pullRequests",At):Q==="branch"?"diffView.scope.branch":Q==="commit"?"commitComparison.mode":Q==="turn"?"diffView.scope.lastTurn":"mobile.nav.changes"),yi=Q==="branch"&&nt.base?fm(nt.base):Q==="commit"?ct?.slice(0,8):Q==="pr"&&bt?`#${bt.number}`:null;if(re.type==="walkthrough"&&fs&&m)return n.jsx(Xr.Provider,{value:Kt,children:n.jsx(sy,{directory:m,target:fs,subtitle:[bi,yi].filter(Boolean).join(" \xB7 "),revision:JSON.stringify([Lt,Q==="pr"?xe.revision:0]),visible:r,onBack:()=>we(as)})});if(Et&&Bt)return n.jsx(Xr.Provider,{value:Kt,children:n.jsx(Ei,{path:Et,previousPath:xe.files?.find(x=>x.path===Et)?.previousPath,subtitle:[bi,yi].filter(Boolean).join(" \xB7 "),commentOrigin:Yt,diff:Is??(Bt.status==="ready"?Bt.diff:null),fileExists:!xe.files||xe.files.some(x=>x.path===Et),error:xe.error??(Bt.status==="error"?Bt.message:null),onBack:()=>we(as),onRetry:()=>{xe.error&&xe.refresh(),Qt(x=>x+1)},onExpandContextRequest:Bt.status==="ready"?x=>Rs({source:Bt,request:x}):void 0,pendingContextExpansion:gs,contextLoading:gs!==null&&!Is})});const Dl=()=>Q==="pr"&&Ue.diffUnavailable?n.jsx(uh,{provider:Ue.provider,className:"h-full"}):Q==="pr"&&!bt?n.jsx(Ut,{loading:Ue.loading,message:Ue.error??(Ue.loading?o(Hn("session.githubPrPicker.loading.pullRequests",At)):o(Hn("pullRequestComparison.select",At)))}):Q==="branch"&&!nt.base?n.jsx(Ut,{loading:!nt.resolved,message:nt.resolved?o("gitView.pr.toast.baseBranchRequired"):o("diffView.branch.resolvingBase")}):Q==="commit"&&!ct?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 text-center",children:[We.loading&&n.jsx(X,{name:"loader-4",className:"size-5 animate-spin text-muted-foreground"}),n.jsx("p",{className:"typography-ui-label text-muted-foreground",children:We.loading?o("diffView.state.loadingChanges"):We.error??o("commitComparison.noCommits")}),We.error&&n.jsx(ze,{variant:"outline",size:"lg",onClick:()=>{We.refresh()},children:o("diffView.actions.retry")})]}):xe.error?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 text-center",children:[n.jsx("p",{className:"typography-ui-label font-semibold",children:o("diffView.state.failedToLoadDiff")}),n.jsx("p",{className:"typography-meta text-muted-foreground",children:xe.error}),n.jsx(ze,{variant:"outline",size:"lg",onClick:()=>{xe.refresh()},children:o("diffView.actions.retry")})]}):Vt?Vt.length===0?n.jsx(Ut,{icon:Q==="branch",message:Q==="pr"?o("walkthrough.blocked.emptyDiff.description"):Q==="commit"?o("commitComparison.emptyDiff"):o("diffView.branch.empty",{base:yi??""})}):n.jsx(Lo,{files:Vt,onSelect:x=>{xe.key&&we({type:"comparison",path:x,sourceKey:xe.key})}}):n.jsx(Ut,{loading:true,message:o("diffView.state.loadingChanges")}),Ol=()=>xs?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 text-center",children:[n.jsx("p",{className:"typography-ui-label font-semibold",children:o("diffView.state.failedToLoadDiff")}),n.jsx("p",{className:"typography-meta text-muted-foreground",children:xs}),n.jsx(ze,{variant:"outline",size:"lg",onClick:vs,children:o("diffView.actions.retry")})]}):(!ys||ie)&&Jt?n.jsx(Ut,{loading:true,message:o("diffView.state.loadingChanges")}):_s.length===0?n.jsx(Ut,{message:o("diffView.state.noLastTurnChanges")}):n.jsx(Lo,{files:_s,onSelect:x=>we({type:"turn",path:x})});return n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[Pr,n.jsxs("header",{className:"flex shrink-0 flex-wrap items-center gap-2 border-b border-edge px-3 py-2",children:[t?n.jsx("button",{type:"button",className:Zt,"aria-label":o("mobile.surface.closeAria"),onClick:t,style:{touchAction:"manipulation"},children:n.jsx(X,{name:"close",className:"size-5"})}):null,n.jsxs(Bi,{open:le,onOpenChange:Ne,children:[n.jsx(Fi,{asChild:true,children:n.jsxs(ze,{variant:"ghost",className:Xd({size:"mobile"}),"data-mobile-comparison-trigger":true,"aria-label":o("diffView.scope.selectorAria"),children:[n.jsx("span",{children:Q==="pr"&&At==="pullRequest"?"PR":Q==="pr"&&At==="mergeRequest"?"MR":bi}),n.jsx(X,{name:"arrow-down-s",className:"size-4"})]})}),n.jsx(zi,{align:"start",children:n.jsxs(Qd,{value:Q,onValueChange:x=>{(x==="working"||x==="turn"||x==="branch"||x==="commit"||x==="pr")&&Le(x)},children:[n.jsx(Rn,{value:"working",className:"min-h-8 items-center",children:o("mobile.nav.changes")}),n.jsx(Rn,{value:"turn",className:"min-h-8 items-center",children:o("diffView.scope.lastTurn")}),ye&&n.jsx(Rn,{value:"branch",className:"min-h-8 items-center",children:o("diffView.scope.branch")}),n.jsx(Rn,{value:"commit",className:"min-h-8 items-center",children:o("commitComparison.mode")}),n.jsx(Rn,{value:"pr",className:"min-h-8 items-center",children:o(Hn("session.githubIntegration.tabs.pullRequests",At))})]})})]}),Er,r&&Q==="branch"&&n.jsx(ah,{mobile:true,branches:v?.all??[],currentBranch:De,base:nt.base,automatic:nt.source!=="chosen",onSelect:x=>{De&>(m,De,x)},onSelectAutomatic:()=>{De&&wt(m,De)}},JSON.stringify([U,De])),r&&Q==="commit"&&n.jsx(lh,{mobile:true,commits:We.commits,selectedHash:ct,loading:We.loading,error:We.error,onSelect:We.select,onRefresh:()=>{We.refresh()}},JSON.stringify([U,De])),r&&Q==="pr"&&n.jsxs(n.Fragment,{children:[n.jsx(ch,{mobile:true,comparison:Ue},JSON.stringify([U,De])),bt&&n.jsx(ze,{variant:"ghost",size:"sm",disabled:xe.loading,"aria-label":o("session.githubIssuePicker.actions.refresh"),onClick:()=>{xe.refresh()},children:n.jsx(X,{name:"refresh",className:"size-4"})})]}),fs&&n.jsx(ze,{variant:"ghost",size:"icon",className:"ms-auto shrink-0",onClick:()=>we({type:"walkthrough"}),"aria-label":o("walkthrough.action.open"),title:o("walkthrough.action.open"),style:{touchAction:"manipulation"},children:n.jsx(X,{name:"route",className:"size-5"})}),r&&Q==="pr"&&Kt&&Te?n.jsx(dh,{review:Kt,provider:Te,className:fs?void 0:"ms-auto"}):null,Q==="working"&&Jt&&(h?.files?.length??0)>0?n.jsxs(ze,{variant:"outline",className:de("shrink-0",!fs&&"ms-auto"),disabled:Mt.submitting,onClick:()=>_t(true),"aria-label":o("diffView.actions.reviewAria"),style:{touchAction:"manipulation"},children:[n.jsx(X,{name:Mt.submitting?"loader-4":"search-eye",className:de("size-4",Mt.submitting&&"animate-spin")}),o("chat.work.reviewHint.aiReview")]}):null]}),n.jsx(Zd,{open:us,onOpenChange:_t,projectDirectory:s||null,submitting:Mt.submitting,onConfirm:Mt.start}),Q==="working"&&n.jsxs("div",{className:"flex shrink-0 items-center gap-2 px-3 py-2",children:[n.jsx("div",{className:"min-w-0 flex-1",children:n.jsx(eu,{currentBranch:h?.current,localBranches:jn,remoteBranches:Cl,branchInfo:v?.branches,currentBranchAhead:h?.ahead,onCheckout:x=>{Nl(x)},onCreate:Rl,disabled:M,directory:m,switchBlockedNotice:(h?.files?.length??0)>0?o("gitView.branch.switchBlockedNotice"):null})}),n.jsx(tu,{activeProfile:et,quiet:true,identities:$,attention:Wt,triggerClassName:"max-w-[10rem] shrink [&_.git-identity-label]:hidden sm:[&_.git-identity-label]:inline",onOpen:()=>{B(u,j.map(x=>x.account))},onSelect:x=>{_(x)},isApplying:R,onConfigure:()=>N(true),applicability:x=>{const W=Me.read?.repository.remotes.find(fe=>fe.name===Ce);return W?su(x,nu(W.fetch.displayUrl),P):{applicable:true}}}),n.jsx(iu,{syncAction:Ye.entry?.executing?ae:null,remotes:Ct,onFetch:x=>{kn("fetch",x)},onPull:x=>{kn("pull",x)},onSync:x=>{kn("sync",x)},onPublish:()=>{kn("publish")},onChooseSyncTargets:()=>{kn("sync",void 0,true)},currentBranch:h?.current,hasTracking:!!h?.tracking,disabled:M||Ye.blocked,aheadCount:h?.ahead??0,behindCount:h?.behind??0,trackingRemoteName:h?.tracking?.split("/")[0],trackingBranch:h?.tracking,hasUncommittedChanges:ru(yt),choosesPushDestination:b})]}),n.jsx(zp,{open:w,onOpenChange:N,directory:m}),n.jsx(ou,{className:"mx-3 mt-3",entry:Ye.entry,onRefresh:()=>{Ye.refresh()},onCancel:()=>{Ye.cancel()}}),Q==="working"&&n.jsx(Wp,{mergeInProgress:h?.mergeInProgress,rebaseInProgress:h?.rebaseInProgress,onContinue:Tl,onAbort:()=>Ir(Nn?"merge":"rebase"),onResolveWithAI:_l,conflictCount:El,isLoading:ae!==null||Ee!==null}),Q==="turn"?n.jsx("div",{className:"min-h-0 flex-1",children:Ol()}):Q!=="working"?n.jsx("div",{className:"min-h-0 flex-1",children:Dl()}):yt.length>0?n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden px-2 pt-1",children:n.jsx($p,{groups:Al,diffStats:h?.diffStats,revertingPaths:ut,onRevertAll:Nr,isRevertingAll:Be,headerBackgroundClassName:"bg-transparent",onVisiblePathsChange:ge})}),n.jsx("div",{"data-keyboard-rider":"",className:"oc-mobile-commit-bar shrink-0 border-t border-edge-muted bg-background px-4 py-3",children:n.jsx(Kp,{stagedCount:es.length,commitMessage:Oe,onCommitMessageChange:Fe,generatedHighlights:it,onInsertHighlights:Il,onGenerateMessage:Pl,isGeneratingMessage:Je,onCommit:x=>{Rr({pushAfter:false,origin:x})},onCommitAndPush:x=>{Rr({pushAfter:true,origin:x})},commitAction:Ee,networkOperationBlocked:Ye.blocked,gitmojiEnabled:false,onOpenGitmojiPicker:()=>{}})})]}):n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(uy,{})}),m&&n.jsx(Hp,{open:mt,onOpenChange:Se,conflictFiles:ot,directory:m,operation:xt,onAbort:()=>{Ir(xt)},onNavigatedToChat:l}),n.jsx(Vp,{open:ht!==null,onOpenChange:x=>{x||rt(null)},targetBranch:ht??"",changedFileCount:h?.files?.length??0,onCommitAndSwitch:(x,W)=>iy(x,W,{targetBranch:ht,directory:m,sourceBranch:h?.current??null,git:d,publishChooser:Qe,toast:me,t:o,refreshStatusAndBranches:Nt,closeDialog:()=>rt(null),performCheckout:Fn}),onGenerateMessage:async()=>{if(!m)return"";const x=(h?.files??[]).map(fe=>fe.path).sort(),{message:W}=await Kr(m,x);return W.subject?.trim()??""},onRevertAndSwitch:async()=>{const x=ht;if(!x||!m)return;await Nr((h?.files??[]).map(fe=>fe.path));const W=await d.getGitStatus(m);if(!W.isClean&&(W.files?.length??0)>0){me.error(o("gitView.dirtySwitch.revertIncomplete"));return}rt(null),await Fn(x)}})]})},Ut=s=>{const e=oe.c(13),{message:t,description:i,loading:a,icon:r}=s,l=a===void 0?false:a,o=r===void 0?false:r;let d;e[0]!==l?(d=l?n.jsx(X,{name:"loader-4",className:"size-5 animate-spin text-muted-foreground"}):null,e[0]=l,e[1]=d):d=e[1];let u;e[2]!==o?(u=o?n.jsx(X,{name:"git-branch",className:"size-6 text-muted-foreground"}):null,e[2]=o,e[3]=u):u=e[3];let c;e[4]!==t?(c=n.jsx("p",{className:"typography-ui-label font-semibold text-foreground",children:t}),e[4]=t,e[5]=c):c=e[5];let f;e[6]!==i?(f=i?n.jsx("p",{className:"typography-meta text-muted-foreground",children:i}):null,e[6]=i,e[7]=f):f=e[7];let y;return e[8]!==d||e[9]!==u||e[10]!==c||e[11]!==f?(y=n.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center",children:n.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-2",children:[d,u,c,f]})}),e[8]=d,e[9]=u,e[10]=c,e[11]=f,e[12]=y):y=e[12],y},uy=()=>{const s=oe.c(7),{t:e}=be();let t;s[0]!==e?(t=e("mobile.changes.cleanDescription"),s[0]=e,s[1]=t):t=s[1];const i=Up(t);let a;s[2]!==e?(a=e("gitView.empty.cleanTitle"),s[2]=e,s[3]=a):a=s[3];let r;return s[4]!==i||s[5]!==a?(r=n.jsx(Ut,{icon:true,message:a,description:i}),s[4]=i,s[5]=a,s[6]=r):r=s[6],r},Ei=s=>{const e=oe.c(70),{path:t,previousPath:i,subtitle:a,diff:r,staged:l,fileExists:o,unavailableReason:d,error:u,onBack:c,onRetry:f,onExpandContextRequest:y,pendingContextExpansion:g,contextLoading:m,commentOrigin:h}=s,b=l===void 0?false:l,v=d===void 0?null:d,S=u===void 0?null:u,{t:w}=be();let N;e[0]!==t?(N=lu(t)||"text",e[0]=t,e[1]=N):N=e[1];const R=N;let T;e[2]!==h||e[3]!==t?(T={fileLabel:t,origin:h},e[2]=h,e[3]=t,e[4]=T):T=e[4];const j=ph(T);let C,k;if(e[5]!==t){const ne=t.replace(/\/$/,""),ue=ne.lastIndexOf("/");C=ne.slice(ue+1),k=ue>0?ne.slice(0,ue):null,e[5]=t,e[6]=C,e[7]=k}else C=e[6],k=e[7];const I=k,E=i?`${i} \u2192 ${I??C}`:I;let z;e[8]===Symbol.for("react.memo_cache_sentinel")?(z=de(qs,"border-b border-edge text-foreground"),e[8]=z):z=e[8];let P;e[9]!==w?(P=w("header.actions.backAria"),e[9]=w,e[10]=P):P=e[10];let B;e[11]===Symbol.for("react.memo_cache_sentinel")?(B=n.jsx(X,{name:"arrow-left",className:"size-5"}),e[11]=B):B=e[11];let $;e[12]!==c||e[13]!==P?($=n.jsx("button",{type:"button",className:Zt,"aria-label":P,onClick:c,children:B}),e[12]=c,e[13]=P,e[14]=$):$=e[14];const _=i?`${i} \u2192 ${t}`:t;let D;e[15]===Symbol.for("react.memo_cache_sentinel")?(D=de("oc-ui-start-align truncate",ri),e[15]=D):D=e[15];let M;e[16]!==C?(M=n.jsx("h2",{dir:"ltr",className:D,children:C}),e[16]=C,e[17]=M):M=e[17];let H;e[18]!==E?(H=E?n.jsx("span",{dir:"ltr",className:"oc-ui-start-align min-w-0 truncate",children:E}):null,e[18]=E,e[19]=H):H=e[19];let A;e[20]!==E||e[21]!==a?(A=E&&a?n.jsx("span",{"aria-hidden":true,className:"shrink-0 opacity-60",children:"\xB7"}):null,e[20]=E,e[21]=a,e[22]=A):A=e[22];let F;e[23]!==a?(F=a?n.jsx("span",{className:"min-w-0 max-w-full shrink-0 truncate",children:a}):null,e[23]=a,e[24]=F):F=e[24];let O;e[25]!==H||e[26]!==A||e[27]!==F?(O=n.jsxs("p",{className:"flex min-w-0 items-baseline gap-1.5 typography-micro text-muted-foreground",children:[H,A,F]}),e[25]=H,e[26]=A,e[27]=F,e[28]=O):O=e[28];let K;e[29]!==_||e[30]!==M||e[31]!==O?(K=n.jsxs("div",{className:"min-w-0 flex-1 px-1",title:_,children:[M,O]}),e[29]=_,e[30]=M,e[31]=O,e[32]=K):K=e[32];const L=j.isOpen?"text-foreground":"text-muted-foreground";let V;e[33]!==L?(V=de(Zt,L),e[33]=L,e[34]=V):V=e[34];let J;e[35]!==w?(J=w("inlineComment.actions.commentOnFile"),e[35]=w,e[36]=J):J=e[36];const G=j.isOpen;let q;e[37]!==w?(q=w("inlineComment.actions.commentOnFile"),e[37]=w,e[38]=q):q=e[38];let U;e[39]===Symbol.for("react.memo_cache_sentinel")?(U=n.jsx(X,{name:"chat-1",className:"size-5"}),e[39]=U):U=e[39];let Z;e[40]!==V||e[41]!==J||e[42]!==q||e[43]!==j.isOpen||e[44]!==j.toggle?(Z=n.jsx("button",{type:"button",className:V,"aria-label":J,"aria-pressed":G,title:q,onClick:j.toggle,children:U}),e[40]=V,e[41]=J,e[42]=q,e[43]=j.isOpen,e[44]=j.toggle,e[45]=Z):Z=e[45];let te;e[46]!==$||e[47]!==K||e[48]!==Z?(te=n.jsxs("header",{className:z,children:[$,K,Z]}),e[46]=$,e[47]=K,e[48]=Z,e[49]=te):te=e[49];let se;e[50]!==h||e[51]!==m||e[52]!==r||e[53]!==S||e[54]!==o||e[55]!==R||e[56]!==y||e[57]!==f||e[58]!==t||e[59]!==g||e[60]!==i||e[61]!==b||e[62]!==w||e[63]!==v?(se=n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:o?v==="nested_repository"?n.jsx(Ut,{icon:true,message:w("diffView.unavailable.nestedRepositoryTitle"),description:w("diffView.unavailable.nestedRepositoryDescription")}):v==="untracked_directory"?n.jsx(Ut,{icon:true,message:w("diffView.unavailable.untrackedDirectoryTitle"),description:w("diffView.unavailable.untrackedDirectoryDescription")}):S?n.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center",children:n.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-3",children:[n.jsx("p",{className:"typography-ui-label font-semibold text-foreground",children:w("mobile.changes.diffDetail.loadFailed")}),n.jsx("p",{className:"typography-meta text-muted-foreground",children:S}),n.jsx(ze,{type:"button",size:"sm",variant:"outline",onClick:()=>f?.(),children:w("diffView.actions.retry")})]})}):r?r.submodule?n.jsx("div",{className:"p-3",children:n.jsx(Bp,{state:r.submodule,staged:b})}):r.isBinary?n.jsx(Ut,{icon:true,message:w("diffView.binary.unavailable")}):Pa(t)&&Ba(r.original,r.modified)?n.jsx(bs,{outerClassName:"h-full",className:"p-3",disableHorizontal:true,"data-diff-virtual-root":true,"data-diff-virtual-content":true,children:n.jsx(mh,{filePath:t,original:r.original,modified:r.modified,renderText:ne=>n.jsx(to,{original:ne.original,modified:ne.modified,language:"text",fileName:t,commentOrigin:h,renderSideBySide:false,wrapLines:true,layout:"inline"})})}):i&&(r.fileDiff?r.fileDiff.hunks.length===0:r.original===r.modified)?n.jsx(Ut,{icon:true,message:w("diffView.change.renamedFrom",{from:i})}):cu(t)&&!r.fileDiff?n.jsx(Ut,{icon:true,message:w("mobile.changes.diffDetail.imageUnavailable")}):n.jsx(bs,{outerClassName:"h-full",className:"p-3",useScrollShadow:true,disableHorizontal:true,"data-diff-virtual-root":true,"data-diff-virtual-content":true,children:n.jsx(to,{original:r.original,modified:r.modified,fileDiff:r.fileDiff,language:R,fileName:t,commentOrigin:h,renderSideBySide:false,wrapLines:true,layout:"inline",onExpandContextRequest:y,pendingContextExpansion:g,contextLoading:m})}):n.jsx(Ut,{loading:true,message:w("diffView.state.loadingDiff")}):n.jsx(Ut,{icon:true,message:w("mobile.changes.diffDetail.missingTitle"),description:w("mobile.changes.diffDetail.missingDescription")})}),e[50]=h,e[51]=m,e[52]=r,e[53]=S,e[54]=o,e[55]=R,e[56]=y,e[57]=f,e[58]=t,e[59]=g,e[60]=i,e[61]=b,e[62]=w,e[63]=v,e[64]=se):se=e[64];let ie;return e[65]!==te||e[66]!==se||e[67]!==j.cards||e[68]!==j.editor?(ie=n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[te,j.cards,j.editor,se]}),e[65]=te,e[66]=se,e[67]=j.cards,e[68]=j.editor,e[69]=ie):ie=e[69],ie},Lo=s=>{const e=oe.c(12),{files:t,onSelect:i}=s,{t:a}=be();let r;e[0]!==a?(r=a("gitView.changes.changedFilesAria"),e[0]=a,e[1]=r):r=e[1];let l;if(e[2]!==t||e[3]!==i||e[4]!==a){let d;e[6]!==i||e[7]!==a?(d=u=>{const c=u.status==="A"?a("diffView.change.new"):u.status==="D"?a("diffView.change.deleted"):u.status==="R"?a("diffView.change.renamed"):u.status==="C"?a("diffView.change.copied"):a("diffView.change.modified"),f=u.status==="A"?"var(--status-success)":u.status==="D"?"var(--status-error)":u.status==="R"||u.status==="C"?"var(--status-info)":"var(--status-warning)";return n.jsx("li",{children:n.jsxs("button",{type:"button",className:"flex min-h-11 w-full items-center gap-2 rounded-md px-2 text-start touch-manipulation focus:outline-none active:bg-interactive-hover",onClick:()=>i(u.path),children:[n.jsx("span",{className:"w-4 shrink-0 text-center typography-micro font-semibold uppercase",style:{color:f},"aria-label":c,children:u.status}),n.jsx(Ea,{filePath:u.path,className:"size-3.5 shrink-0"}),n.jsx(Jp,{path:u.path,from:u.previousPath,nameFirst:true,className:"flex-1 typography-ui-label"}),(u.insertions>0||u.deletions>0)&&n.jsx(Gp,{insertions:u.insertions,deletions:u.deletions,hideZero:true})]})},u.path)},e[6]=i,e[7]=a,e[8]=d):d=e[8],l=t.map(d),e[2]=t,e[3]=i,e[4]=a,e[5]=l}else l=e[5];let o;return e[9]!==r||e[10]!==l?(o=n.jsx(bs,{outerClassName:"h-full",className:"px-2 py-1",useScrollShadow:true,disableHorizontal:true,children:n.jsx("ul",{"aria-label":r,className:"flex flex-col",children:l})}),e[9]=r,e[10]=l,e[11]=o):o=e[11],o},fy=p.lazy(()=>Js(()=>import("./FilesView-tcU8_bnh.js").then(s=>s.F),__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,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217])).then(s=>({default:s.FilesView}))),Cs=s=>Zs(s)??"",An=s=>{const e=Cs(s);return!e||e==="/"?e||"/":e.split("/").filter(Boolean).at(-1)??e},my=s=>{const e=Cs(s);if(!e||e==="/")return null;const t=e.lastIndexOf("/");return t<=0?e.startsWith("/")?"/":null:e.slice(0,t)},py=(s,e)=>{const t=Cs(s),i=Cs(e);return!i||t===i?An(t):t.startsWith(`${i}/`)?t.slice(i.length+1):t},hy=s=>{if(typeof s!="number"||!Number.isFinite(s)||s<0)return"";if(s<1024)return`${s} B`;const e=["KB","MB","GB"];let t=s/1024;for(const i of e){if(t<1024||i===e[e.length-1])return`${t.toFixed(t>=10?0:1)} ${i}`;t/=1024}return""},gy=s=>{const e=oe.c(5),{onClose:t,visible:i}=s,a=i===void 0?true:i,r=Ra(),l=Cs(Ia(r,ir()));if(r?.kind==="preparing"){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Ma,{}),e[0]=d):d=e[0],d}let o;return e[1]!==t||e[2]!==l||e[3]!==a?(o=n.jsx(by,{root:l,onClose:t,visible:a},l),e[1]=t,e[2]=l,e[3]=a,e[4]=o):o=e[4],o},by=({root:s,onClose:e,visible:t})=>{const{t:i}=be(),{files:a}=tr(),r=Zl(),l=ec(Z=>Z.setSelectedPath),[o,d]=p.useState(()=>({type:"browser",directory:s})),[u,c]=p.useState([]),[f,y]=p.useState(false),[g,m]=p.useState(null),[h,b]=p.useState(""),[v,S]=p.useState([]),[w,N]=p.useState(false),R=p.useRef(0),T=o.type==="browser"?o.directory:o.returnDirectory,j=p.useRef(T);j.current=T;const C=p.useCallback(async(Z,te)=>{if(!Z)return;const se=!r,ie=R.current+1;R.current=ie,y(true),te?.background||m(null);try{const ne=await a.listDirectory(Z,{respectGitignore:se});if(R.current!==ie)return;m(null),c(ne.entries.slice().sort((ue,Q)=>ue.isDirectory!==Q.isDirectory?ue.isDirectory?-1:1:ue.name.localeCompare(Q.name)))}catch(ne){if(R.current!==ie)return;if(te?.background){console.error("Failed to reload mobile directory:",ne);return}c([]),m(ne instanceof Error?ne.message:i("mobile.files.error.listFailed"))}finally{R.current===ie&&y(false)}},[a,r,i]);p.useEffect(()=>{o.type==="browser"&&C(o.directory)},[C,o]);const k=p.useRef(o);k.current=o;const I=p.useRef(u);I.current=u;const E=p.useCallback(({directories:Z})=>{const te=k.current;te.type==="browser"&&(Z&&!Z.some(se=>Cs(se)===Cs(te.directory))||I.current.length>pm||C(te.directory,{background:true}))},[C]);hm({root:s,active:t,whileInactive:"hold",onChanges:E});const z=p.useCallback(async Z=>{Cs(Z)===Cs(j.current)&&await C(j.current)},[C]),{canUpload:P,uploadingDirectory:B,pickFiles:$,uploadElements:_}=gm({root:s,refreshDirectory:z}),D=B!==null,M=xa(),H=p.useMemo(()=>({root:s,entries:hu(M,"file")}),[M,s]);p.useEffect(()=>{if(o.type!=="browser")return;const Z=h.trim();if(!Z){S([]),N(false);return}let te=false;const se=window.setTimeout(()=>{N(true),a.search({directory:o.directory,query:Z,maxResults:40}).then(ie=>{te||S(ie)}).catch(()=>{te||S([])}).finally(()=>{te||N(false)})},250);return()=>{te=true,window.clearTimeout(se)}},[a,h,o]);const A=Z=>{b(""),d({type:"browser",directory:Z})},F=Z=>{l(s,Z),d({type:"file",path:Z,returnDirectory:T||s})},O=qe(Z=>Z.pendingFileFocusPath),K=qe(Z=>Z.pendingFileNavigation);if(p.useEffect(()=>{const Z=Cs(K?.path??O??"");!Z||!s||(l(s,Z,{allowOutsideRoot:true}),d(te=>({type:"file",path:Z,returnDirectory:te.type==="file"?te.returnDirectory:s})),O&&qe.getState().setPendingFileFocusPath(null))},[O,K,s,l]),!s)return n.jsx(Dn,{message:i("mobile.files.empty.noDirectory")});if(o.type==="file")return n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[n.jsxs("header",{className:de(qs,"border-b border-edge text-foreground"),children:[n.jsx("button",{type:"button",className:Zt,"aria-label":i("header.actions.backAria"),onClick:()=>d({type:"browser",directory:o.returnDirectory}),style:{touchAction:"manipulation"},children:n.jsx(X,{name:"arrow-left",className:"size-5"})}),n.jsx("div",{className:"min-w-0 flex-1",children:n.jsx("h2",{className:de("truncate",ri),children:An(o.path)})})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:n.jsx(St,{children:n.jsx(p.Suspense,{fallback:n.jsx(Dn,{loading:true,message:i("filesView.state.loading")}),children:n.jsx(fy,{mode:"editor-only"})})})})]});const L=o.directory===s?i("mobile.files.rootDirectory"):An(o.directory),V=h.trim()?v:[],J=my(o.directory),G=o.directory!==s&&J!==null&&(J===s||J.startsWith(`${s}/`)),q=G&&!h.trim(),U=G?J:null;return n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[_,n.jsxs("div",{className:"shrink-0 px-2 pt-1",children:[n.jsx(gu,{value:h,onChange:b,placeholder:i("mobile.files.search.placeholder"),actions:n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",className:Ti,"aria-label":i("mobile.files.refreshAria"),onClick:()=>{C(o.directory)},children:n.jsx(bp,{className:de("size-4",f&&"animate-spin")})}),P?n.jsx("button",{type:"button",className:Ti,"aria-label":i("sidebarFilesTree.actions.uploadFilesTitle"),onClick:()=>$(o.directory),disabled:D,children:n.jsx(X,{name:D?"loader-4":"upload-2",className:de("size-4",D&&"animate-spin")})}):null,e?n.jsx("button",{type:"button",className:Ti,"aria-label":i("mobile.surface.closeAria"),onClick:e,children:n.jsx(yp,{className:"size-4"})}):null]})}),q&&U?n.jsxs("button",{type:"button",className:"flex min-h-11 w-full items-center gap-2.5 rounded-md px-2 text-start active:bg-interactive-hover focus:outline-none","aria-label":i("mobile.files.backToParentAria",{name:An(U)}),onClick:()=>A(U),children:[n.jsx(xp,{className:"size-4 shrink-0 text-muted-foreground"}),n.jsx("span",{className:"min-w-0 truncate typography-ui-label text-muted-foreground",children:L})]}):null]}),n.jsx(bs,{outerClassName:"min-h-0 flex-1",className:"px-2 pb-3 pt-1",useScrollShadow:true,disableHorizontal:true,children:g?n.jsx(Dn,{message:g}):h.trim()?n.jsx(yy,{root:s,results:V,isSearching:w,actions:H,onOpenFile:F}):n.jsxs(n.Fragment,{children:[u.length===0&&!f?n.jsx("div",{className:"px-4 py-8 text-center typography-ui-label text-muted-foreground",children:i("mobile.files.empty.directory")}):null,u.map(Z=>n.jsx(Sl,{name:Z.name,path:Z.path,directory:Z.isDirectory,meta:Z.isDirectory?void 0:hy(Z.size),actions:H,onClick:()=>Z.isDirectory?A(Z.path):F(Z.path)},Z.path))]})})]})},Ti="-my-1 flex size-9 shrink-0 items-center justify-center rounded-full text-muted-foreground touch-manipulation focus:outline-none active:bg-interactive-hover disabled:opacity-50",Sl=s=>{const e=oe.c(45),{name:t,path:i,directory:a,meta:r,actions:l,onClick:o}=s,{t:d}=be();let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u={touchAction:"manipulation"},e[0]=u):u=e[0];let c;e[1]!==a||e[2]!==i?(c=a?n.jsx(Sp,{className:"size-4 shrink-0 text-primary/80"}):n.jsx(Ea,{filePath:i,className:"size-4 shrink-0"}),e[1]=a,e[2]=i,e[3]=c):c=e[3];let f;e[4]!==t?(f=n.jsx("span",{className:"block min-w-0 flex-1 truncate typography-ui-label text-foreground",children:t}),e[4]=t,e[5]=f):f=e[5];let y;e[6]!==r?(y=r?n.jsx("span",{className:"min-w-0 max-w-[55%] shrink truncate typography-micro text-muted-foreground",dir:"auto",children:r}):null,e[6]=r,e[7]=y):y=e[7];let g;e[8]!==a?(g=a?n.jsx(jp,{className:"size-4 shrink-0 text-muted-foreground"}):null,e[8]=a,e[9]=g):g=e[9];let m;e[10]!==o||e[11]!==c||e[12]!==f||e[13]!==y||e[14]!==g?(m=n.jsxs("button",{type:"button",className:"flex min-h-11 w-full items-center gap-2.5 rounded-md px-2 text-start active:bg-interactive-hover focus:outline-none",onClick:o,style:u,children:[c,f,y,g]}),e[10]=o,e[11]=c,e[12]=f,e[13]=y,e[14]=g,e[15]=m):m=e[15];const h=m;let b;e[16]!==i||e[17]!==d?(b=()=>{Qi(i).then(k=>{if(k.ok){me.success(d("sidebarFilesTree.toast.pathCopied"));return}me.error(d("sidebarFilesTree.toast.copyFailed"))})},e[16]=i,e[17]=d,e[18]=b):b=e[18];const v=b;let S;e[19]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(X,{name:"link",className:"me-1 size-4"}),e[19]=S):S=e[19];let w;e[20]!==d?(w=d("sidebarFilesTree.menu.copyPath"),e[20]=d,e[21]=w):w=e[21];let N;e[22]!==v||e[23]!==w?(N=n.jsxs(cs,{onClick:v,children:[S,w]}),e[22]=v,e[23]=w,e[24]=N):N=e[24];let R;e[25]!==l.entries.length?(R=l.entries.length>0?n.jsx(va,{}):null,e[25]=l.entries.length,e[26]=R):R=e[26];let T;if(e[27]!==l.entries||e[28]!==l.root||e[29]!==a||e[30]!==i||e[31]!==d){let k;e[33]!==l.root||e[34]!==a||e[35]!==i||e[36]!==d?(k=I=>n.jsxs(cs,{onClick:()=>{bu(I,{kind:"file",action:I.action.id,directory:l.root||null,path:i,isDirectory:a},d)},children:[n.jsx(ii,{icon:I.icon,iconSrc:I.iconSrc,className:"me-1 size-4"}),I.action.label]},`${I.guest.id}:${I.action.id}`),e[33]=l.root,e[34]=a,e[35]=i,e[36]=d,e[37]=k):k=e[37],T=l.entries.map(k),e[27]=l.entries,e[28]=l.root,e[29]=a,e[30]=i,e[31]=d,e[32]=T}else T=e[32];let j;e[38]!==N||e[39]!==R||e[40]!==T?(j=n.jsxs(n.Fragment,{children:[N,R,T]}),e[38]=N,e[39]=R,e[40]=T,e[41]=j):j=e[41];let C;return e[42]!==h||e[43]!==j?(C=n.jsx(yr,{menu:j,children:h}),e[42]=h,e[43]=j,e[44]=C):C=e[44],C},yy=s=>{const e=oe.c(19),{root:t,results:i,isSearching:a,actions:r,onOpenFile:l}=s,{t:o}=be();if(a){let c;e[0]!==o?(c=o("common.loading"),e[0]=o,e[1]=c):c=e[1];let f;return e[2]!==c?(f=n.jsx(Dn,{loading:true,message:c}),e[2]=c,e[3]=f):f=e[3],f}if(i.length===0){let c;e[4]!==o?(c=o("mobile.files.search.empty"),e[4]=o,e[5]=c):c=e[5];let f;return e[6]!==c?(f=n.jsx(Dn,{message:c}),e[6]=c,e[7]=f):f=e[7],f}let d;if(e[8]!==r||e[9]!==l||e[10]!==i||e[11]!==t){let c;e[13]!==r||e[14]!==l||e[15]!==t?(c=f=>n.jsx(Sl,{name:An(f.path),path:f.path,directory:false,meta:py(f.path,t),actions:r,onClick:()=>l(f.path)},f.path),e[13]=r,e[14]=l,e[15]=t,e[16]=c):c=e[16],d=i.map(c),e[8]=r,e[9]=l,e[10]=i,e[11]=t,e[12]=d}else d=e[12];let u;return e[17]!==d?(u=n.jsx(n.Fragment,{children:d}),e[17]=d,e[18]=u):u=e[18],u},Dn=s=>{const e=oe.c(7),{message:t,loading:i}=s,a=i===void 0?false:i;let r;e[0]!==a?(r=a?n.jsx(vp,{className:"size-5 animate-spin text-muted-foreground"}):n.jsx(wp,{className:"size-6 text-muted-foreground"}),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==t?(l=n.jsx("p",{className:"typography-ui-label font-semibold text-foreground",children:t}),e[2]=t,e[3]=l):l=e[3];let o;return e[4]!==r||e[5]!==l?(o=n.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center",children:n.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-2",children:[r,l]})}),e[4]=r,e[5]=l,e[6]=o):o=e[6],o},xy=s=>{const e=oe.c(21),{visible:t,onLeave:i,sectionsDialogOpen:a,onSectionsDialogOpenChange:r}=s,{t:l}=be(),o=dt(vy),d=ir()??null,u=yu(),[c,f]=p.useState(1);let y,g;e[0]!==t?(y=()=>{t&&f(wy)},g=[t],e[0]=t,e[1]=y,e[2]=g):(y=e[1],g=e[2]),p.useEffect(y,g);const m=!u.allSectionsHidden&&c===0;let h;e[3]!==d||e[4]!==u||e[5]!==i||e[6]!==o||e[7]!==t?(h=t&&!u.allSectionsHidden?n.jsx(xu.Provider,{value:i,children:n.jsx(vu.Provider,{value:true,children:n.jsx(wu,{onChange:f,children:n.jsx(bs,{useScrollShadow:true,scrollShadowSize:24,outerClassName:"min-h-0 flex-1",className:"px-3 pb-4 pt-2",disableHorizontal:true,children:n.jsx(Su,{sessionId:o,directory:d,repositoryEnabled:!Xi(d),layout:u})})})})}):null,e[3]=d,e[4]=u,e[5]=i,e[6]=o,e[7]=t,e[8]=h):h=e[8];let b;e[9]!==u.allSectionsHidden||e[10]!==r||e[11]!==m||e[12]!==l?(b=u.allSectionsHidden||m?n.jsxs("div",{className:"absolute inset-x-0 top-16 flex flex-col items-center px-6 text-center",children:[n.jsx("span",{className:"typography-ui-label text-muted-foreground",children:u.allSectionsHidden?l("chat.workStatus.sections.allHidden"):l("chat.workStatus.mobileEmpty")}),u.allSectionsHidden?n.jsx(ze,{variant:"link",size:"sm",onClick:()=>r(true),className:"mt-2 normal-case text-muted-foreground hover:text-foreground",children:l("chat.workStatus.sections.open")}):null]}):null,e[9]=u.allSectionsHidden,e[10]=r,e[11]=m,e[12]=l,e[13]=b):b=e[13];let v;e[14]!==r||e[15]!==a?(v=n.jsx(ju,{open:a,onOpenChange:r}),e[14]=r,e[15]=a,e[16]=v):v=e[16];let S;return e[17]!==h||e[18]!==b||e[19]!==v?(S=n.jsxs("div",{className:"relative flex h-full min-h-0 flex-col",children:[h,b,v]}),e[17]=h,e[18]=b,e[19]=v,e[20]=S):S=e[20],S};function vy(s){return s.currentSessionId}function wy(s){return Math.max(s,1)}const Sy=p.lazy(()=>Js(()=>import("./GuestPanelContent-CJ_wlnNr.js"),__vite__mapDeps([218,2,3,5,1,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,104,105,106,107,108,109,110,4,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180])).then(s=>({default:s.GuestPanelContent}))),Bo="mobile-surface-root",jy=16,Fo=320,ky="cubic-bezier(0.22, 1, 0.36, 1)",Cy=({open:s,onClose:e,tab:t,onTabChange:i,pendingChangesDiff:a,pendingChangesCommit:r,onOpenPlan:l,onOpenReceivedPage:o,variant:d="drawer"})=>{const{t:u,direction:c}=be(),f=p.useRef(null),y=p.useRef(null),[g,m]=p.useState(false),[h,b]=p.useState(s),v=p.useRef(e);p.useEffect(()=>{v.current=e},[e]);const S=qe(L=>L.mobileWorkspaceTabOrder),w=qe(L=>L.mobileWorkspaceHiddenTabs),N=qe(L=>L.setMobileWorkspaceTabOrder),R=Ta(),T=_a(ku()),j=sr(L=>L.guests),C=Hr(L=>L.countByGuest),[k,I]=p.useState(false),E=p.useRef(t);p.useEffect(()=>{E.current=t},[t]);const z=()=>v.current();kr(y,{enabled:d==="drawer"&&s,...c==="rtl"?{onRightEdgeSwipe:z}:{onLeftEdgeSwipe:z}});const[P,B]=p.useState(()=>new Set);p.useEffect(()=>{s&&B(L=>{if(L.has(t))return L;const V=new Set(L);return V.add(t),V})},[s,t]),p.useEffect(()=>{B(L=>{const V=[...L].filter(J=>Un(J)&&!R.includes(J));return V.length===0?L:new Set([...L].filter(J=>!V.includes(J)))})},[R]);const $=Hr(L=>L.clearBadge);if(p.useEffect(()=>{s&&Un(t)&&$(xi(t))},[$,s,t]),typeof document<"u"&&!f.current){let L=document.getElementById(Bo);L||(L=document.createElement("div"),L.id=Bo,document.body.appendChild(L)),f.current=L}if(p.useEffect(()=>{if(s){b(true);const V=window.setTimeout(()=>m(true),jy);return()=>window.clearTimeout(V)}m(false);const L=window.setTimeout(()=>b(false),Fo+40);return()=>window.clearTimeout(L)},[s]),p.useEffect(()=>{if(!s)return;const L=document.body.style.overflow;d==="drawer"&&(document.body.style.overflow="hidden");const V=J=>{J.key!=="Escape"||E.current==="terminal"||Iu(J.target)||Na(J)||v.current()};return document.addEventListener("keydown",V),()=>{d==="drawer"&&(document.body.style.overflow=L),document.removeEventListener("keydown",V)}},[s,d]),d==="drawer"&&!f.current)return null;const _={status:{id:"status",label:u("chat.workStatus.ariaLabel"),icon:n.jsx(X,{name:"list-indefinite",className:"h-3.5 w-3.5"})},changes:{id:"changes",label:u("mobile.menu.git"),icon:n.jsx(X,{name:"git-branch",className:"h-3.5 w-3.5"})},files:{id:"files",label:u("mobile.menu.files"),icon:n.jsx(X,{name:"file-text",className:"h-3.5 w-3.5"})},terminal:{id:"terminal",label:u("mobile.menu.terminal"),icon:n.jsx(X,{name:"terminal",className:"h-3.5 w-3.5"})},notes:{id:"notes",label:u("contextRail.surface.notes"),icon:n.jsx(X,{name:"sticky-note",className:"h-3.5 w-3.5"})},pages:{id:"pages",label:u("contextPanel.mode.pages"),icon:n.jsx(X,{name:"pages",className:"h-3.5 w-3.5"})}},D=L=>{const V=xi(L),J=j.find(U=>U.id===V),G=J?.name??V,q=C[V]??0;return{id:L,label:G,title:q>0?u(q===1?"contextRail.surface.plugin.badgeAriaSingle":"contextRail.surface.plugin.badgeAriaPlural",{label:G,count:q}):G,icon:n.jsxs("span",{className:"relative flex",children:[n.jsx(ii,{icon:ka(J?.icon??""),iconSrc:J?ja(J.id,J.icon,Qo().authenticatedAsset):void 0,className:"h-3.5 w-3.5"}),q>0?n.jsx("span",{"aria-hidden":"true",className:"absolute -top-1.5 -end-1.5 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-[var(--status-info)] px-0.5 text-[0.5625rem] font-medium leading-none text-[var(--status-info-foreground)]",children:q>99?"99+":q}):null]})}},M=tc(S,w,t,R),H=T||t==="pages"?sc(M):M,A=H.map(L=>Un(L)?D(L):_[L]),F=A.length===1?A[0]:null,O=(L,V)=>{const J=nc(S,R),G=J.findIndex(U=>U===L),q=J.findIndex(U=>U===V);G<0||q<0||N(fp(J,G,q))},K=n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:qs,children:[n.jsx("div",{className:"flex h-9 min-w-0 flex-1 items-center",children:F?n.jsxs("h2",{className:"flex min-w-0 items-center gap-2 px-1 typography-ui-label font-medium text-foreground",children:[n.jsx("span",{className:"flex shrink-0 text-muted-foreground",children:F.icon}),n.jsx("span",{className:"truncate",children:F.label})]}):h?n.jsx(Cu,{items:A,activeId:t,onSelect:L=>{const V=H.find(J=>J===L);V&&i(V)},onReorder:O,layoutMode:A.length>5?"scrollable":"fit",variant:"active-pill",nonCompositedIndicator:true,inactiveTabsIconOnly:A.length>3,className:"h-full"}):null}),t==="status"?n.jsx("button",{type:"button",className:Zt,"aria-label":u("chat.workStatus.sections.open"),onClick:()=>I(true),style:{touchAction:"manipulation"},children:n.jsx(X,{name:"list-settings",className:"size-5"})}):null,n.jsx("button",{type:"button",className:Zt,"aria-label":u("mobile.surface.closeAria"),onClick:e,style:{touchAction:"manipulation"},children:n.jsx(X,{name:"close",className:"size-5"})})]}),n.jsxs("div",{className:"min-h-0 flex-1 overflow-hidden",children:[P.has("status")?n.jsx("div",{className:de("h-full",t!=="status"&&"hidden"),children:n.jsx(St,{children:n.jsx(xy,{visible:s&&t==="status",onLeave:e,sectionsDialogOpen:k,onSectionsDialogOpenChange:I})})}):null,P.has("changes")?n.jsx("div",{className:de("h-full",t!=="changes"&&"hidden"),children:n.jsx(St,{children:n.jsx(cy,{visible:s&&t==="changes",initialDiff:a,initialCommit:r,onNavigatedToChat:e})})},a?`changes:${a.path}:${a.staged}`:"changes"):null,P.has("files")?n.jsx("div",{className:de("h-full",t!=="files"&&"hidden"),children:n.jsx(St,{children:n.jsx(gy,{visible:s&&t==="files"})})}):null,P.has("terminal")?n.jsx("div",{className:de("h-full",t!=="terminal"&&"hidden"),children:n.jsx(St,{children:n.jsx(bm,{visible:s&&t==="terminal"})})}):null,P.has("notes")?n.jsx("div",{className:de("h-full",t!=="notes"&&"hidden"),children:n.jsx(St,{children:n.jsx(ym,{visible:s&&t==="notes",onActionComplete:e,onOpenPlan:l})})}):null,P.has("pages")?n.jsx("div",{className:de("h-full overflow-y-auto",t!=="pages"&&"hidden"),children:n.jsx(St,{children:n.jsx(xm,{onOpen:(L,V)=>o({receivedId:L.receivedId,title:V})})})}):null,R.map(L=>{if(!P.has(L))return null;const V=j.find(J=>J.id===xi(L));return V?n.jsx("div",{className:de("h-full",t!==L&&"hidden"),children:n.jsx(St,{children:n.jsx(p.Suspense,{fallback:null,children:n.jsx(Sy,{mode:L,sharedSurface:Ru(V),docking:Nu(V),surfaceMounted:s&&t===L})})})},L):null})]})]});return d==="panel"?n.jsx("div",{className:"flex h-full min-h-0 flex-col bg-background text-foreground",children:K}):cn.createPortal(n.jsx("section",{ref:y,role:"dialog","aria-modal":"true","aria-label":u("mobile.header.openWorkspaceAria"),"aria-hidden":!s,className:"oc-keyboard-inset-surface oc-bottom-safe-surface oc-side-safe-area fixed inset-0 z-50 flex flex-col bg-background text-foreground",style:{paddingTop:"var(--oc-safe-area-top, 0px)",transform:g?"none":c==="rtl"?"translateX(-100%)":"translateX(100%)",transition:`transform ${Fo}ms ${ky}`,visibility:h?"visible":"hidden",pointerEvents:s?"auto":"none"},children:K}),f.current)};function Ny(s){const e=oe.c(4),t=2500,{uiFont:i}=Pu(),[a,r]=p.useState(false);let l,o;return e[0]!==t||e[1]!==i?(l=()=>{let d=false;const u=()=>{d||r(true)},c=()=>{requestAnimationFrame(()=>requestAnimationFrame(u))},f=Promise.all([Eu(i).catch(Ty),document.fonts?.ready?.then(Ey).catch(Py)??Promise.resolve(),hh.catch(Iy)]).then(Ry),y=new Promise(g=>{window.setTimeout(g,t)});return Promise.race([f,y]).then(c),()=>{d=true}},o=[i,t],e[0]=t,e[1]=i,e[2]=l,e[3]=o):(l=e[2],o=e[3]),p.useEffect(l,o),a}function Ry(){}function Iy(){}function Py(){}function Ey(){}function Ty(){}const _y=or({projectId:fn().trim().min(1).optional(),text:fn().optional()}),Ay=or({request:_y.nullish()}),jl=lr("ShortcutRequests"),Dy=async()=>{const s=Ay.safeParse(await jl.takePending());return s.success?s.data.request??null:null},Oy=s=>{if(Yi()!=="ios")return()=>{};let e=false,t=null;const i=()=>{Dy().then(a=>{a&&s(a)}).catch(()=>{})};return jl.addListener("pending",i).then(a=>{if(e){a.remove();return}t=a}).catch(()=>{}),i(),()=>{e=true,t?.remove()}},My="openchamber",Ly=s=>s.replace(/^\/+|\/+$/g,""),By=s=>{const e=Ly(s.pathname).split("/").filter(Boolean);return s.host?[s.host,...e]:e};function Fy(s){if(typeof s!="string"||s.length===0)return null;let e;try{e=new URL(s)}catch{return null}if(e.protocol!==`${My}:`)return null;const t=By(e),i=(t[0]??"").toLowerCase(),a=t.slice(1),r=e.searchParams;switch(i){case"session":{const l=a[0]||r.get("id")||"";if(!l)return null;const o=r.get("message")?.trim()??"";return{type:"session",sessionId:l,directory:r.get("dir")??void 0,...Tu(o)?{messageId:o}:{}}}case"new":case"new-session":return{type:"new-session",directory:r.get("dir")??void 0,projectId:r.get("project")??void 0,agent:r.get("agent")??void 0,model:r.get("model")??void 0};case"sessions":{const l=r.get("filter");return{type:"sessions",filter:l==="attention"||l==="recent"||l==="all"?l:void 0}}case"status":return{type:"status"};case"settings":{const l=a[0]||r.get("section")||void 0,o=r.get("provider")?.trim(),d={type:"settings",section:l};return l==="usage"&&o&&/^[a-z0-9][a-z0-9-]{0,79}$/.test(o)&&(d.providerId=o),d}case"changes":return{type:"changes",path:a.join("/")||r.get("path")||void 0,staged:r.get("staged")==="true"};case"view":{const l=(a[0]||"").toLowerCase();return l==="changes"?{type:"changes"}:l==="files"||l==="mcp"||l==="instances"||l==="update"?{type:"view",target:l}:null}default:return null}}let ls={},kl=false,Tn=null,zo=false;const zy=s=>{const e=dt.getState(),t=s.projectId?qt.getState().projects.find(a=>a.id===s.projectId)??null:null;e.openNewSessionDraft(t?{selectedProjectId:t.id}:void 0);const i=s.text?.trim();if(i){if(s.projectId&&!t){Vr.getState().setPendingInputText(i,"append");return}Vr.getState().requestDraftSubmit(dt.getState().newSessionDraft.draftId,i)}},Wy=s=>{switch(s.type){case"shortcut-new-session":return zy(s),true;case"session":return _u(s.sessionId,{directory:s.directory??null,messageId:s.messageId??null}),true;case"new-session":{const e=dt.getState();return e.openNewSessionDraft(),(s.directory||s.projectId)&&e.setNewSessionDraftTarget({directoryOverride:s.directory??null,projectId:s.projectId??null,selectedProjectId:s.projectId??null}),true}case"sessions":return ls.openSessions?(ls.openSessions(s.filter),true):false;case"status":return ls.openSessions?(ls.openSessions(),true):false;case"view":return ls.openView?(ls.openView(s.target),true):false;case"changes":return ls.openChanges?(ls.openChanges({path:s.path,staged:s.staged}),true):false;case"settings":return ls.openSettings?(s.section==="usage"&&s.providerId&&ks.getState().setSelectedProvider(s.providerId),ls.openSettings(s.section),true):false}},Cr=()=>{if(!kl||!Tn)return;const s=Tn;Tn=null,Wy(s)||(Tn=s)},Ji=s=>{Tn=s,Cr()},_i=s=>{const e=Fy(s);e&&Ji(e)},$y=s=>{kl=s,Cr()},Ky=s=>{const e=oe.c(3);let t,i;e[0]!==s?(t=()=>(ls=s,Cr(),()=>{ls===s&&(ls={})}),i=[s],e[0]=s,e[1]=t,e[2]=i):(t=e[1],i=e[2]),p.useEffect(t,i)},Hy=s=>{const{ready:e}=s;p.useEffect(()=>{$y(e)},[e]),p.useEffect(()=>{if(!Tt())return;let t=false;const i=[];return Js(()=>import("./vendor-capacitor-app-BrDJj9I_.js"),__vite__mapDeps([219,1,109])).then(async({App:a})=>{if(t)return;const r=await a.addListener("appUrlOpen",l=>{_i(l?.url)});if(t){r.remove();return}if(i.push(()=>{r.remove()}),!zo&&ar.getPlatform()==="android"){zo=true;const l=await a.getLaunchUrl().catch(()=>null);!t&&l?.url&&_i(l.url)}}).catch(()=>{}),i.push(Oy(a=>{Ji({type:"shortcut-new-session",projectId:a.projectId,text:a.text})})),Js(()=>import("./vendor-capacitor-push-notifications-KNe1zSBF.js"),__vite__mapDeps([220,109])).then(async({PushNotifications:a})=>{if(t)return;const r=await a.addListener("pushNotificationActionPerformed",l=>{const o=l?.notification?.data,d=typeof o?.url=="string"?o.url:typeof o?.deeplink=="string"?o.deeplink:void 0;if(d){_i(d);return}const u=typeof o?.sessionId=="string"?o.sessionId:void 0;u&&Ji({type:"session",sessionId:u})});if(t){r.remove();return}i.push(()=>{r.remove()})}).catch(()=>{}),()=>{t=true,i.forEach(a=>a())}},[])},Vy=()=>{if(typeof window>"u")return;const s=window.__OPENCHAMBER_APNS_ENV__;if(s==="development")return"sandbox";if(s==="production")return"production"},Wo=/^[A-Za-z0-9+/]{43}=$/,Uy=lr("PushKey"),Gy=async()=>{const s=window.__OPENCHAMBER_PUSH_KEY__;if(s&&Wo.test(s))return s;const e=await Uy.get().then(t=>t.key).catch(()=>{});return e&&Wo.test(e)?e:void 0},qy=()=>{if(typeof window>"u")return false;const e=window.Capacitor?.getPlatform?.();return e==="ios"||e==="android"},Jy=s=>{const{enabled:e}=s,t=qe(a=>a.nativeNotificationsEnabled),i=p.useRef(null);p.useEffect(()=>{if(!e||!t||!qy())return;let a=false;const r=[];return Js(()=>import("./vendor-capacitor-push-notifications-KNe1zSBF.js"),__vite__mapDeps([220,109])).then(async({PushNotifications:l})=>{if(a)return;let o=await l.checkPermissions().catch(()=>null);if(o?.receive!=="granted"&&(o=await l.requestPermissions().catch(()=>null)),o?.receive!=="granted")return;const d=await l.addListener("registration",c=>{i.current=c.value,Gy().then(f=>{const y=Or(),g={token:c.value,platform:Yi(),environment:Vy()};f&&(g.pushKey=f),y?.push?.registerApnsToken?.(g)})}),u=await l.addListener("registrationError",c=>{console.warn("[Push] APNs registration error:",c)});if(await l.register().catch(()=>{}),a){d.remove(),u.remove();return}r.push(()=>{d.remove()},()=>{u.remove()})}).catch(()=>{}),()=>{a=true,r.forEach(l=>l())}},[e,t]),p.useEffect(()=>{if(t)return;const a=i.current;if(!a)return;i.current=null,Or()?.push?.unregisterApnsToken?.({token:a})},[t])},Yy=s=>s.includes(" \xB7 ")?s:Ou(s),$o=(s,e,t,i)=>{const a=t==="remaining"?e.remainingPercent:e.usedPercent,r=ra(e,a,i.t),l={label:Yy(s),value:r==="-"?"":Au(r),tone:oa(e.usedPercent)};a!==null&&Number.isFinite(a)&&(l.percent=Math.min(100,Math.max(0,a)));const o=Du(e.resetAt,e.resetAfterFormatted??e.resetAtFormatted,i.timeFormatPreference);return o&&(l.reset=i.t("settings.usage.card.resetsAt",{time:o})),l},Xy=(s,e)=>{const t=s.displayMode==="usage"?"used":"remaining",i=s.dropdownProviderIds.flatMap(a=>{const r=s.results.find(d=>d.providerId===a);if(!r?.configured||!r.usage)return[];const l=Object.entries(r.usage.windows??{}).map(([d,u])=>$o(d,u,t,e)),o=s.selectedModels[a];for(const[d,u]of Object.entries(r.usage.models??{}))if(!(o?.length&&!o.includes(d)))for(const[c,f]of Object.entries(u.windows??{}))l.push($o(`${d} \xB7 ${c}`,f,t,e));return l.length>0?[{id:a,name:r.providerName,windows:l}]:[]});return{mode:t,providers:i}},Ks=lr("WidgetBridge"),Qy=5*6e4,Zy=1e3,ex=s=>{const e=s?.colors;return{variant:s?.metadata.variant==="light"?"light":"dark",background:e?.surface.elevated??e?.surface.background,primary:e?.primary.base,foreground:e?.surface.foreground,muted:e?.surface.mutedForeground,info:e?.status.info,success:e?.status.success,warning:e?.status.warning,error:e?.status.error}},tx=({enabled:s})=>{const{t:e}=be(),t=Mu()?.currentTheme,i=qe(l=>l.timeFormatPreference),a=p.useMemo(()=>ex(t),[t]),r=p.useMemo(()=>({sessionsTitle:e("mobile.androidWidget.sessions.title"),sessionsEmpty:e("mobile.androidWidget.sessions.empty"),newSession:e("mobile.androidWidget.sessions.new"),untitled:e("mobile.sessions.untitled"),running:e("mobile.androidWidget.status.running"),retrying:e("mobile.androidWidget.status.retrying"),error:e("mobile.androidWidget.status.error"),usageTitle:e("mobile.androidWidget.usage.title"),usageEmpty:e("mobile.androidWidget.usage.empty"),remaining:e("mobile.androidWidget.usage.remaining"),used:e("mobile.androidWidget.usage.used"),updated:e("mobile.androidWidget.updated",{time:"%s"}),refreshing:e("mobile.androidWidget.refreshing"),queued:e("mobile.androidWidget.queued"),failed:e("mobile.androidWidget.failed"),refresh:e("mobile.androidWidget.refresh")}),[e]);p.useEffect(()=>{if(!s||ar.getPlatform()!=="android")return;let l=false,o={usage:false,sessions:false},d=null,u=false;const c=async()=>{const w=o.sessions&&Ns.getState().hasLoaded,N=ks.getState(),R=o.usage&&N.loadedRuntimeKey!==null;if(!w&&!R)return;const T=C=>Lu(C,i),j={};if(R){const C=N.lastUpdated===null?"":T(N.lastUpdated),k=Xy(N,{t:e,timeFormatPreference:i});j.usage=JSON.stringify({updated:C,labels:r,palette:a,...k})}w&&(j.sessions=JSON.stringify({updated:T(Date.now()),labels:r,palette:a,...za()})),await Ks.update(j)},f=()=>{l||d!==null||!o.usage&&!o.sessions||(d=setTimeout(()=>{d=null,l||c().catch(()=>{})},Zy))},y=w=>o.usage?ks.getState().ensureLoadedForRuntime({refresh:w}):Promise.resolve(),g=async()=>{const w=ks.getState().lastUpdated,[,N]=await Promise.allSettled([y(true),o.sessions?Ns.getState().refreshSessionHead():Promise.resolve(true)]),R=ks.getState().lastUpdated,T=N.status==="fulfilled"&&N.value,j=!o.usage||R!==null&&R!==w;return await c(),T&&j},m=async()=>{if(!(l||u)){u=true;try{for(;;){const w=await Ks.pendingRefresh();if(l||w.requested<=w.acknowledged)return;const N=await g().catch(()=>false);if(l)return;if(!N){await Ks.reportRefreshFailure({requested:w.requested});return}await Ks.acknowledgeRefresh({requested:w.requested})}}catch{}finally{u=false}}},h=async()=>{const w=await Ks.installed().catch(()=>o);if(l)return;const N=w.usage&&!o.usage;o=w,N&&y(false).finally(f);const R=Ns.getState();o.sessions&&!R.hasLoaded&&R.loadSessions().catch(()=>{}).finally(f),f()},b=()=>{document.visibilityState==="visible"&&h().then(()=>{const w=ks.getState().lastUpdated;o.usage&&(w===null||Date.now()-w>Qy)&&y(true).catch(()=>{}).finally(f),m()})},v=[ks.subscribe(f),Ns.subscribe(f),na.subscribe(f),dt.subscribe((w,N)=>{w.availableWorktreesByProject!==N.availableWorktreesByProject&&f()}),qt.subscribe(f)],S=[Ks.addListener("refreshRequested",()=>{m()}).catch(()=>null),Ks.addListener("widgetsChanged",()=>{h()}).catch(()=>null)];return document.addEventListener("visibilitychange",b),h().then(()=>m()),()=>{l=true,d!==null&&clearTimeout(d);for(const w of v)w();for(const w of S)w.then(N=>N?.remove());document.removeEventListener("visibilitychange",b)}},[s,r,a,e,i])},Ko=s=>{const e=oe.c(12),{side:t,isResizing:i,ariaLabel:a,handleProps:r}=s,l=t==="left"?"inset-e-0":"inset-s-0";let o;e[0]!==l?(o=de("absolute inset-y-0 z-50 w-6 cursor-col-resize touch-none",l),e[0]=l,e[1]=o):o=e[1];const d=t==="left"?"inset-e-0":"inset-s-0",u=i&&"bg-[var(--interactive-border)]";let c;e[2]!==d||e[3]!==u?(c=de("absolute inset-y-0 w-[3px] transition-colors",d,u),e[2]=d,e[3]=u,e[4]=c):c=e[4];let f;e[5]!==c?(f=n.jsx("div",{className:c}),e[5]=c,e[6]=f):f=e[6];let y;return e[7]!==a||e[8]!==r||e[9]!==o||e[10]!==f?(y=n.jsx("div",{className:o,role:"separator","aria-orientation":"vertical","aria-label":a,...r,children:f}),e[7]=a,e[8]=r,e[9]=o,e[10]=f,e[11]=y):y=e[11],y},sx=320,nx=380,Ho=280,ix=560,rx=900;function Vo(s,e,t,i){const a=oe.c(23),r=i===void 0?ix:i,l=p.useRef(null);let o;a[0]!==t||a[1]!==r||a[2]!==e?(o=()=>{if(typeof window>"u")return t;const P=Number.parseInt(window.localStorage.getItem(e)??"",10);return Number.isFinite(P)?Math.min(r,Math.max(Ho,P)):t},a[0]=t,a[1]=r,a[2]=e,a[3]=o):o=a[3];const[d,u]=p.useState(o),[c,f]=p.useState(false),y=p.useRef(0),g=p.useRef(d),m=p.useRef(null),h=p.useRef(null);let b;a[4]!==r?(b=P=>Math.min(r,Math.max(Ho,Math.round(P))),a[4]=r,a[5]=b):b=a[5];const v=b;let S;a[6]===Symbol.for("react.memo_cache_sentinel")?(S=P=>{const B=l.current;B&&(B.style.width=`${P}px`,B.style.minWidth=`${P}px`,B.style.maxWidth=`${P}px`,B.style.setProperty("--oc-ipad-sidebar-width",`${P}px`))},a[6]=S):S=a[6];const w=S;let N;a[7]!==d?(N=P=>{try{P.currentTarget.setPointerCapture(P.pointerId)}catch{}h.current=P.pointerId,y.current=P.clientX,g.current=d,m.current=d,f(true),P.preventDefault()},a[7]=d,a[8]=N):N=a[8];const R=N;let T;a[9]!==v||a[10]!==s?(T=P=>{if(h.current!==P.pointerId)return;const B=(s==="left"?1:-1)*(ic(P.currentTarget)?-1:1),$=v(g.current+(P.clientX-y.current)*B);m.current!==$&&(m.current=$,w($))},a[9]=v,a[10]=s,a[11]=T):T=a[11];const j=T;let C;a[12]!==v||a[13]!==e?(C=P=>{if(h.current!==P.pointerId)return;try{P.currentTarget.releasePointerCapture(P.pointerId)}catch{}const B=v(m.current??g.current);h.current=null,m.current=null,f(false),u(B);try{window.localStorage.setItem(e,String(B))}catch{}},a[12]=v,a[13]=e,a[14]=C):C=a[14];const k=C;let I;a[15]!==R||a[16]!==k||a[17]!==j?(I={onPointerDown:R,onPointerMove:j,onPointerUp:k,onPointerCancel:k},a[15]=R,a[16]=k,a[17]=j,a[18]=I):I=a[18];const E=I;let z;return a[19]!==E||a[20]!==c||a[21]!==d?(z={asideRef:l,width:d,isResizing:c,handleProps:E},a[19]=E,a[20]=c,a[21]=d,a[22]=z):z=a[22],z}const ox=()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===true,ax=200;function Uo(s){const e=oe.c(6),[t,i]=p.useState(false),[a,r]=p.useState(s);s!==a&&(r(s),i(!s&&!ox()));let l,o;e[0]!==t?(l=()=>{if(!t)return;const c=window.setTimeout(()=>i(false),ax);return()=>window.clearTimeout(c)},o=[t],e[0]=t,e[1]=l,e[2]=o):(l=e[1],o=e[2]),p.useEffect(l,o);const d=s||t;let u;return e[3]!==s||e[4]!==d?(u={placed:d,inPlace:s},e[3]=s,e[4]=d,e[5]=u):u=e[5],u}const Go=["general","isolated-spaces","appearance","chat","notifications","sessions","routing","projects","git","magic-prompts","snippets","behavior","agents","commands","mcp","plugins","skills.installed","skills.catalog","providers","web-search","usage","voice","integrations","extensions","about"],lx=1e3,cx=p.lazy(()=>Js(()=>import("./useAppFontEffects-CpxtKEGw.js").then(s=>s.v1),__vite__mapDeps([4,2,3,5,1,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,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180])).then(s=>({default:s.PluginPane}))),dx=({onActiveConnectionDeleted:s})=>{const{t:e,direction:t}=be();zm();const[i,a]=p.useState(false);p.useEffect(()=>dt.subscribe((Y,Pe)=>{Y.currentSessionId&&Y.currentSessionId!==Pe.currentSessionId&&qe.getState().setRunOverviewKey(null)}),[]);const r=qe(Y=>Y.runOverviewKey!==null);p.useEffect(()=>{r&&a(false)},[r]);const[l,o]=p.useState(null),[d,u]=p.useState(false),[c,f]=p.useState(()=>{const{mobileWorkspaceTabOrder:Y,mobileWorkspaceHiddenTabs:Pe}=qe.getState();return vi(Y,Pe)[0]}),y=p.useCallback(()=>{const{mobileWorkspaceTabOrder:Y,mobileWorkspaceHiddenTabs:Pe}=qe.getState(),he=Zu(sr.getState().guests),Ve=vi(Y,Pe,he),ft=_a(ef.getState());f(at=>Ve.some(pt=>pt===at)||at==="pages"&&ft?at:Ve[0]),u(true)},[]),[g,m]=p.useState(null),[h,b]=p.useState(null),[v,S]=p.useState("nav"),[w,N]=p.useState(null),R=w&&"diff"in w?w.diff:null,T=w&&"commit"in w?w.commit:null,j=Ta();p.useEffect(()=>{if(!Un(c)||j.includes(c))return;const{mobileWorkspaceTabOrder:Y,mobileWorkspaceHiddenTabs:Pe}=qe.getState();f(vi(Y,Pe,j)[0])},[j,c]);const C=qe(Y=>Y.openGuestPageId),I=Sa().find(Y=>Y.id===C)??null;p.useEffect(()=>{C&&!I&&qe.getState().setOpenGuestPage(null)},[I,C]);const E=p.useCallback(()=>qe.getState().setOpenGuestPage(null),[]),z=qe(Y=>Y.setSettingsPage),P=Vs(Y=>Y.available),B=Vs(Y=>Y.runtimeType),$=p.useMemo(()=>rr(),[]),_=p.useCallback(()=>{o(null),m(null)},[]),D=p.useCallback(Y=>{o(Y)},[]),M=p.useCallback(()=>{u(false)},[]),H=p.useCallback(Y=>{S(Y),D("settings")},[D]);p.useEffect(()=>ty(Go,H),[H]);const{enabled:A,roomyForPanels:F,roomyForOnePanel:O}=Zi(),K=F||O,V=tf()==="portrait",J=sf(),[G,q]=p.useState(()=>{const Y=nf();return Y.roomyForPanels||Y.roomyForOnePanel}),U=p.useCallback(()=>{q(Y=>!Y)},[]),Z=p.useRef(A);p.useEffect(()=>{A?!Z.current&&!d&&q(true):q(false),Z.current=A},[A,d]);const te=p.useCallback(()=>{N(null),f("files"),u(true)},[]);p.useEffect(()=>Gr(Y=>{if(Y.type!=="file-open-request")return;const Pe=Y.directory??un.getState().currentDirectory;if(!Pe)return;const he=()=>{qe.getState().openContextFile(Pe,Y.path),te()},{sessionId:Ve}=Y;if(!Ve){he();return}Zb(Ve,async at=>Ns.getState().entityById.get(at)??await Di.getSession(at).catch(()=>null)).then(at=>{const pt=()=>{const{currentSessionId:Ye}=dt.getState();return Ye===Ve||at.some(ht=>ht.id===Ye)};if(pt()){he();return}const Qe=at[0]?.title;me.info(ey(Y.path),{id:`file-open-${Ve}:${Y.path}`,description:Qe?e("chat.fileOpenRequest.toast.description",{session:Qe}):e("chat.fileOpenRequest.toast.descriptionUntitled"),action:{label:e("chat.fileOpenRequest.toast.openSession"),onClick:()=>{rf(Ve,Pe),_(),a(false),pt()&&he()}}})})}),[_,te,e]),p.useEffect(()=>Gr(Y=>{if(Y.type!=="plan-open-request")return;const Pe=of(Y.directory??un.getState().currentDirectory,Y.projectId);Pe&&m({id:Y.planId,title:Y.title,projectRef:Pe})}),[]);const se=p.useCallback((Y=null)=>{N(Y?{diff:Y}:null),f("changes"),u(true)},[]);p.useEffect(()=>ac(Y=>{qe.getState().setOpenGuestPage(null),Y.tab==="changes"&&Y.commit&&N({commit:{scope:"commit",directory:Y.commit.directory}}),f(Y.tab),u(true)}),[]);const ie=Vo("left","openchamber.ipad.leftSidebarWidth",sx),ne=Vo("right","openchamber.ipad.rightSidebarWidth",nx,rx),ue=F||O,Q=p.useRef(null),re=p.useRef({sidebarOpen:G,workspaceOpen:d});p.useLayoutEffect(()=>{const Y=re.current;if(re.current={sidebarOpen:G,workspaceOpen:d},!O){const Ve=Q.current;Q.current=null,F&&Ve==="sidebar"?q(true):F&&Ve==="workspace"&&u(true);return}const Pe=G&&!Y.sidebarOpen,he=d&&!Y.workspaceOpen;if(G&&d){Pe&&!he?(Q.current="workspace",u(false)):(Q.current="sidebar",q(false));return}!d&&Y.workspaceOpen&&Q.current==="sidebar"?(Q.current=null,q(true)):!G&&Y.sidebarOpen&&Q.current==="workspace"&&(Q.current=null,u(true))},[O,F,G,d]);const le=Uo(A&&G),Ne=Uo(ue&&d),Le=O&&G,we=O&&d,Re=ue&&Ne.placed&&!Le?ne.width:0,ae=A&&le.placed&&!we?ie.width:0,ce=t==="rtl"?"100%":"-100%",Ee=t==="rtl"?"-100%":"100%";p.useEffect(()=>(qr.setState({left:ae,right:Re}),()=>qr.setState({left:0,right:0})),[ae,Re]),Wm(),p.useEffect(()=>{if(typeof document>"u")return;const Y=A&&(V||J),Pe=document.documentElement;return Pe.classList.toggle("oc-keep-draft-starters",Y),()=>Pe.classList.remove("oc-keep-draft-starters")},[J,A,V]);const Ie=p.useMemo(()=>({openChanges:({diffPath:Y,staged:Pe,scope:he}={})=>{se(Y?{path:Y,staged:Pe===true,scope:he}:null)},openFiles:()=>te(),openSourceBoard:()=>D("board"),openPlan:m,openReceivedPage:b}),[se,te,D]),ke=p.useMemo(()=>({openSessions:()=>{A?q(true):a(true)},openView:Y=>{if(Y==="files"){te();return}if(Y==="mcp"){f("status"),u(true);return}D(Y)},openChanges:({path:Y,staged:Pe}={})=>{se(Y?{path:Y,staged:Pe===true}:null)},openSettings:Y=>{Y&&z(Y),H(Y?"page-content":"nav")}}),[A,se,te,H,D,z]);Ky(ke);const Oe=p.useRef(null),Fe=()=>{A?q(true):a(true)},ut=()=>y();kr(Oe,{onLeftEdgeSwipe:t==="rtl"?ut:Fe,onRightEdgeSwipe:t==="rtl"?Fe:ut});const Ke=p.useRef(null),Be=p.useCallback(Y=>{Ke.current=Y},[]),He=p.useCallback(()=>af()?true:h?(b(null),true):g?(m(null),true):I?(E(),true):l==="settings"&&Ke.current?.()?true:l?(_(),true):d?(M(),true):i?(a(false),true):false,[l,E,_,M,I,g,h,i,d]);lf(He),cf(He,!!(g||h||I||l||d||i));const Je=!$&&P&&(B==="desktop"||B==="web"),$e=A?"dialog":"fullscreen",it=qe(Y=>Y.overviewFeatureAvailable),tt=p.useMemo(()=>({instanceLabel:$?Hs():null,onOpenInstances:$?()=>D("instances"):void 0,onOpenSettings:()=>H("nav"),onOpenUsage:()=>D("usage"),onOpenScheduled:()=>D("scheduled"),onOpenArchive:()=>D("archive"),onOpenOverview:it?()=>D("overview"):void 0,onOpenSourceBoard:()=>D("board"),onOpenUpdate:Je?()=>D("update"):void 0}),[H,D,it,$,Je]),ee=p.useCallback(Y=>{_(),a(false),Y==="file"&&te()},[_,te]),ge=p.useCallback(()=>{_(),a(false)},[_]),st=p.useCallback(()=>{_(),a(false),A&&!K&&q(false)},[_,A,K]),jt=p.useCallback(()=>{_(),a(false),A&&!K&&q(false)},[_,A,K]);return n.jsx(df,{actions:Ie,children:n.jsxs("div",{className:"oc-mobile-app-shell main-content-safe-area oc-side-safe-area flex h-[100dvh] flex-row bg-background text-foreground","data-page-scroll-lock":"true",children:[A?n.jsxs("aside",{ref:ie.asideRef,className:de("oc-ipad-sidebar relative flex h-full shrink-0 flex-col overflow-hidden"),style:{width:ae,minWidth:ae,maxWidth:ae,"--oc-ipad-sidebar-width":`${ie.width}px`,overflowX:"clip"},"aria-hidden":!G,"data-page-scroll-lock":"true",children:[n.jsx("div",{className:de("flex h-full shrink-0 flex-col border-e border-edge bg-background transition-[translate] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none",ie.isResizing&&"pointer-events-none",!G&&"pointer-events-none select-none"),style:{width:"var(--oc-ipad-sidebar-width)",overflowX:"hidden",paddingTop:"var(--oc-safe-area-top, 0px)",translate:le.inPlace?void 0:ce},children:n.jsx(St,{children:n.jsx(Ro,{open:le.placed,variant:"sidebar",onOpenChange:Y=>{!Y&&!K&&q(false)},footer:tt})})}),G?n.jsx(Ko,{side:"left",isResizing:ie.isResizing,ariaLabel:e("sidebar.resize.leftPanelAria"),handleProps:ie.handleProps}):null]}):null,n.jsxs("div",{className:"flex h-full min-w-0 flex-1 flex-col","data-page-scroll-lock":"true",children:[n.jsx(V1,{onOpenSessions:()=>A?U():a(true),onOpenWorkspace:y,compactTitle:A}),n.jsxs("main",{ref:Oe,className:"relative min-h-0 flex-1 overflow-hidden","data-page-scroll-lock":"true",children:[n.jsx("div",{className:"h-full w-full",children:n.jsx(St,{children:n.jsx($m,{})})}),n.jsx(St,{children:n.jsx(Zm,{})})]})]}),A?null:n.jsx(Ro,{open:i,onOpenChange:a,footer:tt}),n.jsxs("aside",{ref:ne.asideRef,className:de("relative flex h-full shrink-0 flex-col overflow-hidden"),style:{width:Re,minWidth:Re,maxWidth:Re,"--oc-ipad-sidebar-width":`${ne.width}px`,overflowX:"clip"},"aria-hidden":!Re,"data-page-scroll-lock":"true",children:[n.jsx("div",{className:de("flex h-full min-h-0 shrink-0 flex-col transition-[translate] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none",ue&&"border-s border-edge bg-background",ne.isResizing&&"pointer-events-none",!Ne.inPlace&&"pointer-events-none select-none"),style:{width:"var(--oc-ipad-sidebar-width)",overflowX:"hidden",paddingTop:"var(--oc-safe-area-top, 0px)",translate:Ne.inPlace?void 0:Ee},children:n.jsx(St,{children:n.jsx(Cy,{open:ue?Ne.placed:d,onClose:M,tab:c,onTabChange:f,pendingChangesDiff:R,pendingChangesCommit:T,onOpenPlan:m,onOpenReceivedPage:b,variant:ue?"panel":"drawer"})})}),ue&&d?n.jsx(Ko,{side:"right",isResizing:ne.isResizing,ariaLabel:e("sidebar.resize.rightPanelAria"),handleProps:ne.handleProps}):null]}),g?n.jsx(ms,{open:true,variant:$e,onClose:()=>m(null),ariaLabel:g.title,title:g.title,children:n.jsx(St,{children:n.jsx(Jm,{savedProjectPlan:{projectRef:g.projectRef,planId:g.id},onClose:()=>m(null),onNavigatedToChat:()=>{_(),M()}})})}):null,h?n.jsx(ms,{open:true,variant:$e,onClose:()=>b(null),ariaLabel:h.title,title:h.title,children:n.jsx(St,{children:n.jsx(Km,{receivedId:h.receivedId,onAddedToChat:()=>{cn.flushSync(()=>{b(null),M()});const Y=document.querySelector('[data-composer-morph-prompt="true"]');Y?Y.click():uf()}})})}):null,I?n.jsx(ms,{open:true,variant:$e,dialogAlign:"app",onClose:E,ariaLabel:I.pageTitle??I.name,title:I.pageTitle??I.name,disableEscapeDismiss:true,children:n.jsx(St,{children:n.jsx(p.Suspense,{fallback:null,children:n.jsx(cx,{mode:Xo(I.id),surface:"page"},I.id)})})}):null,n.jsx(St,{children:n.jsx(ff,{})}),l==="instances"&&$?n.jsx(ms,{open:true,variant:$e,dialogAlign:"app",onClose:_,ariaLabel:e("mobile.menu.instances"),title:e("mobile.menu.instances"),children:n.jsx(Y1,{onConnect:_,onActiveConnectionDeleted:s})}):null,l==="settings"?n.jsx(ms,{open:true,variant:$e,dialogAlign:"app",onClose:_,ariaLabel:e("mobile.menu.settings"),headerless:true,children:n.jsx(St,{children:n.jsx(Gm,{forceMobile:true,isWindowed:true,initialMobileStage:v,registerBackHandler:Be,visiblePageSlugs:[...Go],onClose:_})})}):null,l==="usage"?n.jsx(ms,{open:true,variant:$e,dialogAlign:"app",onClose:_,ariaLabel:e("usageStats.title"),title:e("usageStats.title"),children:n.jsx(St,{children:n.jsx(Np,{})})}):null,l==="scheduled"?n.jsx(ms,{open:true,variant:$e,dialogAlign:"app",onClose:_,ariaLabel:e("sessions.scheduledTasks.dialog.title"),title:e("sessions.scheduledTasks.dialog.title"),children:n.jsx(St,{children:n.jsx(Ep,{layout:"mobile",onLeave:ee})})}):null,l==="board"?n.jsx(ms,{open:true,variant:$e,dialogAlign:"app",onClose:_,ariaLabel:e("sourceBoard.title"),headerless:true,children:n.jsx(St,{children:n.jsx(Ip,{onLeave:ge,onClose:_})})}):null,l==="overview"&&it?n.jsx(ms,{open:true,variant:$e,dialogAlign:"app",onClose:_,ariaLabel:e("overview.title"),title:e("overview.title"),children:n.jsx(St,{children:n.jsx(Pp,{layout:"mobile",onLeave:st})})}):null,l==="archive"?n.jsx(ms,{open:true,variant:$e,dialogAlign:"app",onClose:_,ariaLabel:e("sessions.archivePage.title"),title:e("sessions.archivePage.title"),children:n.jsx(St,{children:n.jsx(Rp,{layout:"mobile",onLeave:jt})})}):null,l==="update"?n.jsx(ms,{open:true,variant:$e,dialogAlign:"app",onClose:_,ariaLabel:e("mobile.menu.update"),title:e("mobile.menu.update"),children:n.jsx(St,{children:n.jsx(bs,{outerClassName:"h-full",className:"px-5 py-4",disableHorizontal:true,children:n.jsx(qm,{initialUpdateDialogOpen:true})})})}):null]})})};function ux(s){const e=oe.c(143),{apis:t}=s,i=qe(zx),{t:a}=be(),r=ns(Fx),l=ns(Bx),o=ns(Lx),d=ns(Mx),u=ns(Ox),c=ns(Dx),f=ns(Ax),y=ns(_x),g=un(Tx),m=dt(Ex),h=dt(Px),b=qe(Ix),v=Wi(Rx),S=rc(Nx),w=Ns(Cx);let N;e[0]!==w?(N=w??[],e[0]=w,e[1]=N):N=e[1];const R=N,T=w!=null;let j;e[2]!==R||e[3]!==T?(j={hasAuthoritativeGlobalSessions:T,sessions:R},e[2]=R,e[3]=T,e[4]=j):j=e[4],vm(j);const[C,k]=p.useState(0),[I,E]=p.useState(0),[z,P]=p.useState(false),[B,$]=p.useState("pending"),[_,D]=p.useState(null);let M;e[5]===Symbol.for("react.memo_cache_sentinel")?(M=Hs(),e[5]=M):M=e[5];const H=M,[,A]=p.useReducer(kx,0);let F;e[6]===Symbol.for("react.memo_cache_sentinel")?(F=rr(),e[6]=F):F=e[6];const O=F,K=p.useRef(0),L=p.useRef(0);let V;e[7]!==c||e[8]!==t.sourceControl||e[9]!==t.trackers||e[10]!==r||e[11]!==y||e[12]!==f||e[13]!==u||e[14]!==v||e[15]!==S?(V=()=>{const pe=ps(),ye=L.current+1;if(L.current=ye,!pe){In("resume:auto-connect",{}),Pn();return}In("resume:reprobe",{});const _e=()=>{r(),S(t.sourceControl),v(t.sourceControl,{force:true}),Ur(t.trackers),u===0&&f({source:"mobileApp:nativeResume"}),c===0&&y({source:"mobileApp:nativeResume"})},Ce=et=>{In("resume:disconnect",{reason:et}),tn({apiBaseUrl:"",clientToken:null,runtimeKey:$n}),k(jx)};Jn().then(et=>{if(L.current===ye){if(et==="no-connection"){Ce("no-connection");return}if(et==="needs-login"){D({kind:"auth-expired",label:Hs()??""}),Ce("needs-login");return}if(et==="relay-limit"){D({kind:"relay-limit",label:Hs()??""}),Ce("relay-limit");return}if(et==="unreachable"){const Wt=[4e3,1e4],Ot=Ue=>{window.setTimeout(()=>{if(L.current!==ye)return;const At=Ue===Wt.length-1;Jn({fast:!At}).then(bt=>{if(L.current===ye&&bt!=="switched"){if(bt==="unchanged"){_e();return}if(bt==="needs-login"){D({kind:"auth-expired",label:Hs()??""}),Ce("retry-needs-login");return}if(bt==="relay-limit"){D({kind:"relay-limit",label:Hs()??""}),Ce("retry-relay-limit");return}if(!At){Ot(Ue+1);return}Ce(`retry-${bt}`)}})},Wt[Ue])};Ot(0);return}et!=="switched"&&_e()}});const Ae=Date.now();Ae-K.current>=lx&&(K.current=Ae,window.dispatchEvent(new Event("openchamber:system-resume")))},e[7]=c,e[8]=t.sourceControl,e[9]=t.trackers,e[10]=r,e[11]=y,e[12]=f,e[13]=u,e[14]=v,e[15]=S,e[16]=V):V=e[16];const J=V;Bu(),Fu(J);let G,q;e[17]!==J?(G=()=>{if(!O)return;let pe;const ye=()=>{window.clearTimeout(pe),pe=window.setTimeout(()=>J(),1500)};return window.addEventListener("online",ye),()=>{window.removeEventListener("online",ye),window.clearTimeout(pe)}},q=[O,J],e[17]=J,e[18]=G,e[19]=q):(G=e[18],q=e[19]),p.useEffect(G,q);let U,Z;e[20]!==J?(Z=()=>{if(O)return Mr.subscribe((pe,ye)=>{pe.state==="expired"&&ye.state!=="expired"&&(J(),Mr.getState().markAuthenticated())})},U=[O,J],e[20]=J,e[21]=U,e[22]=Z):(U=e[21],Z=e[22]),p.useEffect(Z,U);let te,se;e[23]!==J?(te=()=>{if(O)return oc(pe=>{ni(pe)&&J()})},se=[O,J],e[23]=J,e[24]=te,e[25]=se):(te=e[24],se=e[25]),p.useEffect(te,se);let ie,ne;e[26]!==t?(ie=()=>(ea(t),Sx),ne=[t],e[26]=t,e[27]=ie,e[28]=ne):(ie=e[27],ne=e[28]),p.useEffect(ie,ne);let ue;e[29]!==A?(ue=()=>Zo(pe=>{if(In("endpoint:changed",{runtimeKey:pe.runtimeKey||"none",previousRuntimeKey:pe.previousRuntimeKey||"none",connected:!!pe.apiBaseUrl}),!!pe.runtimeKey&&pe.runtimeKey===pe.previousRuntimeKey){Tm(),A();return}_m(pe),E(wx),k(vx)}),e[29]=A,e[30]=ue):ue=e[30];let Q;e[31]===Symbol.for("react.memo_cache_sentinel")?(Q=[],e[31]=Q):Q=e[31],p.useEffect(ue,Q);let re;e[32]!==o?(re=()=>{if(!O||o||ps()){$("done");return}let pe=false;return $("attempting"),(async()=>{const ye=await Pn().catch(xx);pe||(ye.status==="unreachable"||ye.status==="relay-limit"?D({kind:ye.status,label:ye.label}):ye.status==="needs-login"&&D({kind:"auth-expired",label:ye.label}),$("done"),ye.status==="unreachable"&&Pn({fast:false,skipIfConnected:true}).catch(yx))})(),()=>{pe=true}},e[32]=o,e[33]=re):re=e[33];let le;e[34]===Symbol.for("react.memo_cache_sentinel")?(le=[],e[34]=le):le=e[34],p.useEffect(re,le);let Ne,Le;e[35]===Symbol.for("react.memo_cache_sentinel")?(Ne=()=>{if(!O||!ps())return;let pe=false;const ye=_e=>{In("cold-launch:drop",{kind:_e?.kind??"unknown"}),_e&&D(_e),tn({apiBaseUrl:"",clientToken:null,runtimeKey:$n}),k(bx)};return Jn().then(async _e=>{if(pe||_e==="switched"||_e==="unchanged")return;const Ce=Hs();if(_e==="needs-login"){ye({kind:"auth-expired",label:Ce??""});return}if(_e==="unreachable"){ye(Ce?{kind:"unreachable",label:Ce}:null),Pn({fast:false,skipIfConnected:true}).catch(gx);return}if(_e==="relay-limit"){ye({kind:"relay-limit",label:Ce??""});return}const Ae=await Pn().catch(hx);pe||Ae.status==="connected"||(Ae.status==="needs-login"?ye({kind:"auth-expired",label:Ae.label}):Ae.status==="unreachable"||Ae.status==="relay-limit"?ye({kind:Ae.status,label:Ae.label}):ye(null))}),()=>{pe=true}},Le=[],e[35]=Ne,e[36]=Le):(Ne=e[35],Le=e[36]),p.useEffect(Ne,Le);let we,Re;e[37]!==b?(we=()=>{b(true)},Re=[b],e[37]=b,e[38]=we,e[39]=Re):(we=e[38],Re=e[39]),p.useEffect(we,Re);let ae;e[40]!==r?(ae=()=>{O&&!ps()||r()},e[40]=r,e[41]=ae):ae=e[41];let ce;e[42]!==C||e[43]!==r?(ce=[C,r,O],e[42]=C,e[43]=r,e[44]=ce):ce=e[44],p.useEffect(ae,ce);let Ee,Ie;e[45]!==c||e[46]!==o||e[47]!==y||e[48]!==f||e[49]!==u?(Ee=()=>{o&&(u===0&&f({source:"mobileApp:recovery"}),c===0&&y({source:"mobileApp:recovery"}))},Ie=[c,o,y,f,u],e[45]=c,e[46]=o,e[47]=y,e[48]=f,e[49]=u,e[50]=Ee,e[51]=Ie):(Ee=e[50],Ie=e[51]),p.useEffect(Ee,Ie);const ke=p.useRef(false),[Oe,Fe]=p.useState(O);let ut;e[52]!==o?(ut=()=>{if(!O||!o||ke.current)return;let pe=false;const ye=window.setTimeout(()=>Fe(false),6e3),_e=Am({selectNow:true,refresh:true}),Ce=()=>{dt.getState().currentSessionId&&Fe(false)},Ae=dt.subscribe(Ce);return Ce(),(async()=>{const et=await _e();pe||(et!=="failed"&&(ke.current=true),Fe(false))})(),()=>{pe=true,Ae(),window.clearTimeout(ye)}},e[52]=o,e[53]=ut):ut=e[53];let Ke;e[54]!==C||e[55]!==o?(Ke=[C,o,O],e[54]=C,e[55]=o,e[56]=Ke):Ke=e[56],p.useEffect(ut,Ke);let Be,He;e[57]!==g||e[58]!==o?(Be=()=>{o&&Di.setDirectory(g)},He=[g,o],e[57]=g,e[58]=o,e[59]=Be,e[60]=He):(Be=e[59],He=e[60]),p.useEffect(Be,He);let Je,$e;e[61]!==t.sourceControl||e[62]!==t.trackers||e[63]!==o||e[64]!==v||e[65]!==S?(Je=()=>{o&&(S(t.sourceControl),v(t.sourceControl,{force:true}),Ur(t.trackers))},$e=[t.sourceControl,t.trackers,o,v,S],e[61]=t.sourceControl,e[62]=t.trackers,e[63]=o,e[64]=v,e[65]=S,e[66]=Je,e[67]=$e):(Je=e[66],$e=e[67]),p.useEffect(Je,$e);let it,tt;e[68]!==h||e[69]!==m?(it=()=>{if(!m)return;const pe=window.setTimeout(()=>h(),5e3);return()=>window.clearTimeout(pe)},tt=[h,m],e[68]=h,e[69]=m,e[70]=it,e[71]=tt):(it=e[70],tt=e[71]),p.useEffect(it,tt);let ee;e[72]!==o?(ee=()=>{if(!(!o&&(O?!!ps():true))){P(false);return}const ye=window.setTimeout(()=>{P(true)},O?4e3:8e3);return()=>window.clearTimeout(ye)},e[72]=o,e[73]=ee):ee=e[73];let ge;e[74]!==C||e[75]!==o||e[76]!==I?(ge=[o,O,C,I],e[74]=C,e[75]=o,e[76]=I,e[77]=ge):ge=e[77],p.useEffect(ee,ge),zu();let st;e[78]===Symbol.for("react.memo_cache_sentinel")?(st={enabled:true},e[78]=st):st=e[78],Wu(st),wm(),$u(),Ku(),Sm(),jm(t.sourceControl),km(t.trackers),Cm(),Nm(),Rm(),Im(),Pm(g||null),Em();const jt=O&&o;let Y;e[79]!==jt?(Y={enabled:jt},e[79]=jt,e[80]=Y):Y=e[80],Jy(Y);const Pe=O&&o&&l;let he;e[81]!==Pe?(he={enabled:Pe},e[81]=Pe,e[82]=he):he=e[82],tx(he);const Ve=O&&o&&l;let ft;e[83]!==Ve?(ft={ready:Ve},e[83]=Ve,e[84]=ft):ft=e[84],Hy(ft);const at=Ny(),pt=!o&&d==="reconnecting";if(!at){let pe;return e[85]===Symbol.for("react.memo_cache_sentinel")?(pe=n.jsx("main",{className:"flex min-h-dvh items-center justify-center bg-[var(--splash-background,var(--surface-background))] text-foreground",children:n.jsx(sn,{width:120,height:120,isAnimated:true,variant:"splash"})}),e[85]=pe):pe=e[85],pe}const Qe=!!ps();if(O&&(!Qe||!o&&!pt)){if(Qe){const _e=!z;let Ce;e[86]!==_e?(Ce=n.jsx(sn,{width:120,height:120,isAnimated:_e,variant:"splash"}),e[86]=_e,e[87]=Ce):Ce=e[87];let Ae;e[88]!==z||e[89]!==a?(Ae=z?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("h1",{className:"typography-h3 text-foreground",children:a("sessionAuth.error.networkTitle")}),n.jsx("p",{className:"typography-markdown text-muted-foreground",children:a("mobile.connect.recovery.description")})]}),n.jsx(ze,{type:"button",variant:"outline",onClick:()=>{tn({apiBaseUrl:"",clientToken:null,runtimeKey:$n}),k(px)},children:a("mobile.connect.cancelPassword")})]}):null,e[88]=z,e[89]=a,e[90]=Ae):Ae=e[90];let et;return e[91]!==Ce||e[92]!==Ae?(et=n.jsx("main",{className:"flex min-h-dvh items-center justify-center bg-[var(--splash-background,var(--surface-background))] px-6 text-center text-foreground",children:n.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-4",children:[Ce,Ae]})}),e[91]=Ce,e[92]=Ae,e[93]=et):et=e[93],et}if(B!=="done"){let _e;e[94]===Symbol.for("react.memo_cache_sentinel")?(_e=n.jsx(sn,{width:120,height:120,isAnimated:true,variant:"splash"}),e[94]=_e):_e=e[94];let Ce;e[95]!==a?(Ce=H?n.jsxs("div",{className:"absolute inset-x-0 top-[calc(50%+84px)] flex flex-col items-center gap-0.5 px-6 text-center",children:[n.jsx("p",{className:"typography-small text-muted-foreground",children:a("mobile.connect.splash.connectingTo")}),n.jsxs("p",{className:"typography-small text-foreground",children:[H,n.jsx(Hu,{})]})]}):null,e[95]=a,e[96]=Ce):Ce=e[96];let Ae;return e[97]!==Ce?(Ae=n.jsxs("main",{className:"relative flex min-h-dvh items-center justify-center bg-[var(--splash-background,var(--surface-background))] text-foreground",children:[_e,Ce]}),e[97]=Ce,e[98]=Ae):Ae=e[98],Ae}let pe;e[99]===Symbol.for("react.memo_cache_sentinel")?(pe=()=>k(mx),e[99]=pe):pe=e[99];let ye;return e[100]!==_?(ye=n.jsx(n.Fragment,{children:n.jsx(P1,{onConnected:pe,notice:_})}),e[100]=_,e[101]=ye):ye=e[101],ye}if(!o&&!pt){if(!z){let et;return e[102]===Symbol.for("react.memo_cache_sentinel")?(et=n.jsx("main",{className:"flex min-h-dvh items-center justify-center bg-[var(--splash-background,var(--surface-background))] text-foreground",children:n.jsx(sn,{width:120,height:120,isAnimated:true,variant:"splash"})}),e[102]=et):et=e[102],et}let pe;e[103]!==a?(pe=a("sessionAuth.error.networkTitle"),e[103]=a,e[104]=pe):pe=e[104];let ye;e[105]!==pe?(ye=n.jsx("h1",{className:"typography-h3 text-foreground",children:pe}),e[105]=pe,e[106]=ye):ye=e[106];let _e;e[107]!==a?(_e=a("sessionAuth.error.networkDescription"),e[107]=a,e[108]=_e):_e=e[108];let Ce;e[109]!==_e?(Ce=n.jsx("p",{className:"typography-markdown text-muted-foreground",children:_e}),e[109]=_e,e[110]=Ce):Ce=e[110];let Ae;return e[111]!==ye||e[112]!==Ce?(Ae=n.jsx("main",{className:"flex min-h-dvh items-center justify-center bg-background px-6 text-center text-foreground",children:n.jsxs("div",{className:"max-w-sm space-y-3",children:[ye,Ce]})}),e[111]=ye,e[112]=Ce,e[113]=Ae):Ae=e[113],Ae}let Ye;e[114]===Symbol.for("react.memo_cache_sentinel")?(Ye=Di.getSdkClient(),e[114]=Ye):Ye=e[114];const ht=g||"",rt=!O||!Oe;let mt;e[115]!==rt?(mt=n.jsx(Dm,{ready:rt,animated:true}),e[115]=rt,e[116]=mt):mt=e[116];let Se;e[117]!==l?(Se=n.jsx(Vu,{backgroundWorkEnabled:l}),e[117]=l,e[118]=Se):Se=e[118];let ot,Ze;e[119]===Symbol.for("react.memo_cache_sentinel")?(ot=n.jsx(Om,{}),Ze=n.jsx(jh,{}),e[119]=ot,e[120]=Ze):(ot=e[119],Ze=e[120]);let xt,vt,lt,De,gt;e[121]===Symbol.for("react.memo_cache_sentinel")?(xt=n.jsx(dx,{onActiveConnectionDeleted:()=>{f1(),tn({apiBaseUrl:"",clientToken:null,runtimeKey:$n}),k(fx)}}),vt=n.jsx(Uu,{}),lt=n.jsx(Gu,{}),De=n.jsx(qu,{}),gt=n.jsx(Ju,{}),e[121]=xt,e[122]=vt,e[123]=lt,e[124]=De,e[125]=gt):(xt=e[121],vt=e[122],lt=e[123],De=e[124],gt=e[125]);let wt;e[126]!==i?(wt=i?n.jsxs(n.Fragment,{children:[n.jsx(Ym,{}),n.jsx(Mm,{}),n.jsx(Xm,{}),n.jsx(Lm,{}),n.jsx(Qm,{})]}):null,e[126]=i,e[127]=wt):wt=e[127];let We;e[128]===Symbol.for("react.memo_cache_sentinel")?(We=n.jsx(Eh,{}),e[128]=We):We=e[128];let ct;e[129]!==l?(ct=l?n.jsx(Bm,{}):null,e[129]=l,e[130]=ct):ct=e[130];let Me;e[131]!==mt||e[132]!==Se||e[133]!==wt||e[134]!==ct?(Me=n.jsx(Yu,{delayDuration:300,skipDelayDuration:150,children:n.jsxs("div",{className:"h-full bg-background text-foreground",children:[mt,Se,ot,Ze,xt,vt,lt,De,gt,wt,We,ct]})}),e[131]=mt,e[132]=Se,e[133]=wt,e[134]=ct,e[135]=Me):Me=e[135];let Dt;e[136]!==t||e[137]!==Me?(Dt=n.jsx(Xu,{apis:t,children:Me}),e[136]=t,e[137]=Me,e[138]=Dt):Dt=e[138];let nt;return e[139]!==I||e[140]!==ht||e[141]!==Dt?(nt=n.jsx(St,{children:n.jsx(Qu,{sdk:Ye,directory:ht,children:Dt},I)}),e[139]=I,e[140]=ht,e[141]=Dt,e[142]=nt):nt=e[142],nt}function fx(s){return s+1}function mx(s){return s+1}function px(s){return s+1}function hx(){return{status:"no-candidate"}}function gx(){return null}function bx(s){return s+1}function yx(){return null}function xx(){return{status:"no-candidate"}}function vx(s){return s+1}function wx(s){return s+1}function Sx(){return ea(null)}function jx(s){return s+1}function kx(s){return s+1}function Cx(s){return s.authoritativeSessions}function Nx(s){return s.refresh}function Rx(s){return s.refreshAll}function Ix(s){return s.setIsMobile}function Px(s){return s.clearError}function Ex(s){return s.error}function Tx(s){return s.currentDirectory}function _x(s){return s.loadAgents}function Ax(s){return s.loadProviders}function Dx(s){return s.agents.length}function Ox(s){return s.providers.length}function Mx(s){return s.connectionPhase}function Lx(s){return s.isConnected}function Bx(s){return s.isInitialized}function Fx(s){return s.initializeApp}function zx(s){return s.isolatedSpacesEnabled}function Wx(s){const e=oe.c(7),t=p.useSyncExternalStore($x,ps,ps);let i;e[0]!==t?(i=!rr()||!!t,e[0]=t,e[1]=i):i=e[1];let a;e[2]!==s?(a=n.jsx(ux,{...s}),e[2]=s,e[3]=a):a=e[3];let r;return e[4]!==i||e[5]!==a?(r=n.jsx(Fm,{enabled:i,children:a}),e[4]=i,e[5]=a,e[6]=r):r=e[6],r}function $x(s){return Zo(()=>s())}function vS(s){window.__OPENCHAMBER_SURFACE__="mobile",mf(),Um({logLabel:"[mobile-main]",onAppearanceSettled:gh}),Sh(),pf();const e=document.getElementById("root");if(!e)throw new Error("Root element not found");const i=window.Capacitor?.isNativePlatform?.()===true||window.location.protocol==="capacitor:",a=i?{...s,notifications:{notifyAgentCompletion:async()=>false,canNotify:()=>false}}:s,r=n.jsx(Vm,{children:n.jsx(Wx,{apis:a})});Ll.createRoot(e).render(n.jsx(Ai.StrictMode,{children:n.jsx(hf,{children:n.jsx(gf,{children:n.jsx(bf,{children:n.jsx(Hm,{children:i?r:n.jsx(yf,{children:r})})})})})}))}export{vS as renderMobileApp};
|
|
25
|
+
`)}`.trim()),tt([])},[]),Pl=p.useCallback(async()=>{if(!m)return;const x=es.map(W=>W.path).sort();if(x.length===0){me.error(o("gitView.toast.selectFileToDescribe"));return}$e(true);try{const{message:W}=await Kr(m,x);Fe(W.subject?.trim()??""),tt(Array.isArray(W.highlights)?W.highlights:[])}catch(W){me.error(W instanceof Error?W.message:o("gitView.toast.generateCommitMessageFailed"))}finally{$e(false)}},[m,es,o]),Rr=async(x={})=>{if(!m)return;if(!Oe.trim()){me.error(o("gitView.toast.enterCommitMessage"));return}const W=es.map(je=>je.path).sort();if(W.length===0){me.error(o("gitView.toast.selectFileToCommit"));return}Ie(x.pushAfter?"commitAndPush":"commit");let fe=null,Xe="pending";try{if(!d.createGitCommit)throw new Error("Git commit is unavailable on this runtime");const je=await d.createGitCommit(m,Oe.trim(),{files:W});Xe="local";const os=ke.committed(je.summary,x);if(Fe(""),tt([]),x.pushAfter){if(fe=Ye.start(),!fe){me.warning(o("gitView.publish.commitKept")),await $s();return}const Rt=await Qe.prepare("push",{onOperation:fe.onOperation});ce("publish"),await Rt(),Xe="published",ke.pushed({deletion:os,origin:x.origin})}await $s()}catch(je){if(x.pushAfter&&Xe==="local"&&me.warning(o("gitView.publish.commitKept")),je instanceof Gn||je instanceof Mi){await $s();return}if(je instanceof Ds&&je.code==="stale-runtime")return;if(je instanceof Ds&&Qe.errorMessage(je)){me.info(Qe.errorMessage(je));return}x.pushAfter&&await $s(),me.error(je instanceof Ds?je.code==="contributor-publish-cancelled-after-update"?o("gitView.toast.contributorPublishCancelledAfterUpdate"):je.code==="contributor-publish-cancelled"?o("gitView.toast.contributorPublishCancelled"):o("gitView.toast.syncActionFailed",{action:o("gitView.sync.syncChanges")}):je instanceof Error?Qr(je,o):o("gitView.toast.createCommitFailed"))}finally{fe?.finish(),Ie(null),x.pushAfter&&ce(null)}},El=p.useMemo(()=>(h?.files??[]).filter(ji).length,[h?.files]),Nn=!!h?.mergeInProgress?.head,Tl=p.useCallback(async()=>{if(m)try{if(Nn){if(!d.continueMerge)throw new Error("Git continue merge is unavailable on this runtime");const x=await d.continueMerge(m);x.conflict?(lt(x.conflictFiles??[],"merge"),me.error(o("gitView.toast.mergeConflictsDetected"))):me.success(o("gitView.toast.mergeCompleted"))}else{if(!d.continueRebase)throw new Error("Git continue rebase is unavailable on this runtime");const x=await d.continueRebase(m);x.conflict?(lt(x.conflictFiles??[],"rebase"),me.error(o("gitView.toast.rebaseConflictsDetected"))):me.success(o("gitView.toast.rebaseStepCompleted"))}await Nt(false)}catch(x){me.error(x instanceof Error?x.message:o("gitView.toast.continueOperationFailed"))}},[m,d,Nn,lt,Nt,o]),Ir=p.useCallback(async x=>{if(m)try{if(x==="merge"){if(!d.abortMerge)throw new Error("Git abort merge is unavailable on this runtime");await d.abortMerge(m),me.success(o("gitView.toast.mergeAborted"))}else{if(!d.abortRebase)throw new Error("Git abort rebase is unavailable on this runtime");await d.abortRebase(m),me.success(o("gitView.toast.rebaseAborted"))}await Nt(false)}catch(W){me.error(W instanceof Error?W.message:o("gitView.toast.abortOperationFailed"))}},[m,d,Nt,o]),_l=p.useCallback(()=>{const x=(h?.files??[]).filter(ji).map(W=>W.path);lt(x,Nn?"merge":"rebase")},[Nn,lt,h?.files]),Al=p.useMemo(()=>{const x=[];return es.length>0&&x.push({id:"staged",title:o("gitView.changes.stagedTitle"),entries:es,statsScope:"staged",actionSymbol:"-",actionAllLabel:o("gitView.changes.unstageAllAria"),getActionLabel:W=>o("gitView.changes.unstageFileAria",{path:W}),onActionFile:W=>{Cn([W],"unstage")},onActionAll:W=>{Cn(W,"unstage")},onViewDiff:W=>hi(W,true),onRevertFile:gi,showRevertActions:false,accent:true}),ve.length>0&&x.push({id:"unstaged",title:o("gitView.changes.title"),entries:ve,statsScope:"working",actionSymbol:"+",actionAllLabel:o("gitView.changes.stageAllAria"),getActionLabel:W=>o("gitView.changes.stageFileAria",{path:W}),onActionFile:W=>{Cn([W],"stage")},onActionAll:W=>{Cn(W,"stage")},onViewDiff:W=>hi(W,false),onRevertFile:gi}),x},[gi,hi,Cn,es,o,ve]),Pr=n.jsxs(n.Fragment,{children:[Qe.context?n.jsx(cm,{context:Qe.context,onSelect:Qe.settle}):null,Qe.confirmDialog,n.jsx(dm,{candidates:pt.candidates,onSelect:pt.settle})]}),Er=g?n.jsx(du,{repositories:g,selectedRepository:f??null,onSelectRepository:x=>{s&&(nn.getState().clearChangesRepository(s),O(s,x))},repositoryRoot:s??void 0}):null,Wn=x=>n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[Pr,n.jsxs("header",{className:de(qs,"text-foreground"),children:[t?n.jsx("button",{type:"button",className:Zt,"aria-label":o("mobile.surface.closeAria"),onClick:t,style:{touchAction:"manipulation"},children:n.jsx(X,{name:"close",className:"size-5"})}):null,n.jsxs("div",{className:"min-w-0 flex-1 px-1",children:[n.jsx("h2",{className:ri,children:o("mobile.nav.changes")}),n.jsx("p",{className:"truncate typography-micro text-muted-foreground",children:h?.current||m||""})]}),Er]}),n.jsx("div",{className:"min-h-0 flex-1",children:x})]});if(!m)return Wn(n.jsx(Ut,{message:o("gitView.empty.selectSessionOrDirectory")}));if(e.unreadable)return Wn(n.jsx(um,{directory:e.unreadable.directory,message:e.unreadable.message}));if(c===false&&D!==true)return Wn(n.jsx(mm,{root:s,rootIsGitRepo:c,resolvedIsGitRepo:D,nestedRepos:y,onRetryDiscovery:()=>{s&&F(s,{force:true})}}));if(M&&D===null)return Wn(n.jsx(Ut,{loading:true,message:o("gitView.loading.checkingRepository")}));if(re.type==="diff")return n.jsx(Ei,{path:re.path,previousPath:ts?.previousPath,diff:Ft,staged:re.staged,fileExists:!!ts,unavailableReason:he?.key===`${m}\0${re.path}`?he.reason:null,error:Y,onBack:()=>we({type:"list"}),onRetry:()=>at(x=>x+1)});if(re.type==="turn")return n.jsx(Ei,{path:re.path,subtitle:o("diffView.scope.lastTurn"),diff:As.get(re.path)??null,fileExists:_s.some(x=>x.path===re.path),onBack:()=>we(as)});const bi=o(Q==="pr"?Hn("session.githubIntegration.tabs.pullRequests",At):Q==="branch"?"diffView.scope.branch":Q==="commit"?"commitComparison.mode":Q==="turn"?"diffView.scope.lastTurn":"mobile.nav.changes"),yi=Q==="branch"&&nt.base?fm(nt.base):Q==="commit"?ct?.slice(0,8):Q==="pr"&&bt?`#${bt.number}`:null;if(re.type==="walkthrough"&&fs&&m)return n.jsx(Xr.Provider,{value:Kt,children:n.jsx(sy,{directory:m,target:fs,subtitle:[bi,yi].filter(Boolean).join(" \xB7 "),revision:JSON.stringify([Lt,Q==="pr"?xe.revision:0]),visible:r,onBack:()=>we(as)})});if(Et&&Bt)return n.jsx(Xr.Provider,{value:Kt,children:n.jsx(Ei,{path:Et,previousPath:xe.files?.find(x=>x.path===Et)?.previousPath,subtitle:[bi,yi].filter(Boolean).join(" \xB7 "),commentOrigin:Yt,diff:Is??(Bt.status==="ready"?Bt.diff:null),fileExists:!xe.files||xe.files.some(x=>x.path===Et),error:xe.error??(Bt.status==="error"?Bt.message:null),onBack:()=>we(as),onRetry:()=>{xe.error&&xe.refresh(),Qt(x=>x+1)},onExpandContextRequest:Bt.status==="ready"?x=>Rs({source:Bt,request:x}):void 0,pendingContextExpansion:gs,contextLoading:gs!==null&&!Is})});const Dl=()=>Q==="pr"&&Ue.diffUnavailable?n.jsx(uh,{provider:Ue.provider,className:"h-full"}):Q==="pr"&&!bt?n.jsx(Ut,{loading:Ue.loading,message:Ue.error??(Ue.loading?o(Hn("session.githubPrPicker.loading.pullRequests",At)):o(Hn("pullRequestComparison.select",At)))}):Q==="branch"&&!nt.base?n.jsx(Ut,{loading:!nt.resolved,message:nt.resolved?o("gitView.pr.toast.baseBranchRequired"):o("diffView.branch.resolvingBase")}):Q==="commit"&&!ct?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 text-center",children:[We.loading&&n.jsx(X,{name:"loader-4",className:"size-5 animate-spin text-muted-foreground"}),n.jsx("p",{className:"typography-ui-label text-muted-foreground",children:We.loading?o("diffView.state.loadingChanges"):We.error??o("commitComparison.noCommits")}),We.error&&n.jsx(ze,{variant:"outline",size:"lg",onClick:()=>{We.refresh()},children:o("diffView.actions.retry")})]}):xe.error?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 text-center",children:[n.jsx("p",{className:"typography-ui-label font-semibold",children:o("diffView.state.failedToLoadDiff")}),n.jsx("p",{className:"typography-meta text-muted-foreground",children:xe.error}),n.jsx(ze,{variant:"outline",size:"lg",onClick:()=>{xe.refresh()},children:o("diffView.actions.retry")})]}):Vt?Vt.length===0?n.jsx(Ut,{icon:Q==="branch",message:Q==="pr"?o("walkthrough.blocked.emptyDiff.description"):Q==="commit"?o("commitComparison.emptyDiff"):o("diffView.branch.empty",{base:yi??""})}):n.jsx(Lo,{files:Vt,onSelect:x=>{xe.key&&we({type:"comparison",path:x,sourceKey:xe.key})}}):n.jsx(Ut,{loading:true,message:o("diffView.state.loadingChanges")}),Ol=()=>xs?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 text-center",children:[n.jsx("p",{className:"typography-ui-label font-semibold",children:o("diffView.state.failedToLoadDiff")}),n.jsx("p",{className:"typography-meta text-muted-foreground",children:xs}),n.jsx(ze,{variant:"outline",size:"lg",onClick:vs,children:o("diffView.actions.retry")})]}):(!ys||ie)&&Jt?n.jsx(Ut,{loading:true,message:o("diffView.state.loadingChanges")}):_s.length===0?n.jsx(Ut,{message:o("diffView.state.noLastTurnChanges")}):n.jsx(Lo,{files:_s,onSelect:x=>we({type:"turn",path:x})});return n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[Pr,n.jsxs("header",{className:"flex shrink-0 flex-wrap items-center gap-2 border-b border-edge px-3 py-2",children:[t?n.jsx("button",{type:"button",className:Zt,"aria-label":o("mobile.surface.closeAria"),onClick:t,style:{touchAction:"manipulation"},children:n.jsx(X,{name:"close",className:"size-5"})}):null,n.jsxs(Bi,{open:le,onOpenChange:Ne,children:[n.jsx(Fi,{asChild:true,children:n.jsxs(ze,{variant:"ghost",className:Xd({size:"mobile"}),"data-mobile-comparison-trigger":true,"aria-label":o("diffView.scope.selectorAria"),children:[n.jsx("span",{children:Q==="pr"&&At==="pullRequest"?"PR":Q==="pr"&&At==="mergeRequest"?"MR":bi}),n.jsx(X,{name:"arrow-down-s",className:"size-4"})]})}),n.jsx(zi,{align:"start",children:n.jsxs(Qd,{value:Q,onValueChange:x=>{(x==="working"||x==="turn"||x==="branch"||x==="commit"||x==="pr")&&Le(x)},children:[n.jsx(Rn,{value:"working",className:"min-h-8 items-center",children:o("mobile.nav.changes")}),n.jsx(Rn,{value:"turn",className:"min-h-8 items-center",children:o("diffView.scope.lastTurn")}),ye&&n.jsx(Rn,{value:"branch",className:"min-h-8 items-center",children:o("diffView.scope.branch")}),n.jsx(Rn,{value:"commit",className:"min-h-8 items-center",children:o("commitComparison.mode")}),n.jsx(Rn,{value:"pr",className:"min-h-8 items-center",children:o(Hn("session.githubIntegration.tabs.pullRequests",At))})]})})]}),Er,r&&Q==="branch"&&n.jsx(ah,{mobile:true,branches:v?.all??[],currentBranch:De,base:nt.base,automatic:nt.source!=="chosen",onSelect:x=>{De&>(m,De,x)},onSelectAutomatic:()=>{De&&wt(m,De)}},JSON.stringify([U,De])),r&&Q==="commit"&&n.jsx(lh,{mobile:true,commits:We.commits,selectedHash:ct,loading:We.loading,error:We.error,onSelect:We.select,onRefresh:()=>{We.refresh()}},JSON.stringify([U,De])),r&&Q==="pr"&&n.jsxs(n.Fragment,{children:[n.jsx(ch,{mobile:true,comparison:Ue},JSON.stringify([U,De])),bt&&n.jsx(ze,{variant:"ghost",size:"sm",disabled:xe.loading,"aria-label":o("session.githubIssuePicker.actions.refresh"),onClick:()=>{xe.refresh()},children:n.jsx(X,{name:"refresh",className:"size-4"})})]}),fs&&n.jsx(ze,{variant:"ghost",size:"icon",className:"ms-auto shrink-0",onClick:()=>we({type:"walkthrough"}),"aria-label":o("walkthrough.action.open"),title:o("walkthrough.action.open"),style:{touchAction:"manipulation"},children:n.jsx(X,{name:"route",className:"size-5"})}),r&&Q==="pr"&&Kt&&Te?n.jsx(dh,{review:Kt,provider:Te,className:fs?void 0:"ms-auto"}):null,Q==="working"&&Jt&&(h?.files?.length??0)>0?n.jsxs(ze,{variant:"outline",className:de("shrink-0",!fs&&"ms-auto"),disabled:Mt.submitting,onClick:()=>_t(true),"aria-label":o("diffView.actions.reviewAria"),style:{touchAction:"manipulation"},children:[n.jsx(X,{name:Mt.submitting?"loader-4":"search-eye",className:de("size-4",Mt.submitting&&"animate-spin")}),o("chat.work.reviewHint.aiReview")]}):null]}),n.jsx(Zd,{open:us,onOpenChange:_t,projectDirectory:s||null,submitting:Mt.submitting,onConfirm:Mt.start}),Q==="working"&&n.jsxs("div",{className:"flex shrink-0 items-center gap-2 px-3 py-2",children:[n.jsx("div",{className:"min-w-0 flex-1",children:n.jsx(eu,{currentBranch:h?.current,localBranches:jn,remoteBranches:Cl,branchInfo:v?.branches,currentBranchAhead:h?.ahead,onCheckout:x=>{Nl(x)},onCreate:Rl,disabled:M,directory:m,switchBlockedNotice:(h?.files?.length??0)>0?o("gitView.branch.switchBlockedNotice"):null})}),n.jsx(tu,{activeProfile:et,quiet:true,identities:$,attention:Wt,triggerClassName:"max-w-[10rem] shrink [&_.git-identity-label]:hidden sm:[&_.git-identity-label]:inline",onOpen:()=>{B(u,j.map(x=>x.account))},onSelect:x=>{_(x)},isApplying:R,onConfigure:()=>N(true),applicability:x=>{const W=Me.read?.repository.remotes.find(fe=>fe.name===Ce);return W?su(x,nu(W.fetch.displayUrl),P):{applicable:true}}}),n.jsx(iu,{syncAction:Ye.entry?.executing?ae:null,remotes:Ct,onFetch:x=>{kn("fetch",x)},onPull:x=>{kn("pull",x)},onSync:x=>{kn("sync",x)},onPublish:()=>{kn("publish")},onChooseSyncTargets:()=>{kn("sync",void 0,true)},currentBranch:h?.current,hasTracking:!!h?.tracking,disabled:M||Ye.blocked,aheadCount:h?.ahead??0,behindCount:h?.behind??0,trackingRemoteName:h?.tracking?.split("/")[0],trackingBranch:h?.tracking,hasUncommittedChanges:ru(yt),choosesPushDestination:b})]}),n.jsx(zp,{open:w,onOpenChange:N,directory:m}),n.jsx(ou,{className:"mx-3 mt-3",entry:Ye.entry,onRefresh:()=>{Ye.refresh()},onCancel:()=>{Ye.cancel()}}),Q==="working"&&n.jsx(Wp,{mergeInProgress:h?.mergeInProgress,rebaseInProgress:h?.rebaseInProgress,onContinue:Tl,onAbort:()=>Ir(Nn?"merge":"rebase"),onResolveWithAI:_l,conflictCount:El,isLoading:ae!==null||Ee!==null}),Q==="turn"?n.jsx("div",{className:"min-h-0 flex-1",children:Ol()}):Q!=="working"?n.jsx("div",{className:"min-h-0 flex-1",children:Dl()}):yt.length>0?n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden px-2 pt-1",children:n.jsx($p,{groups:Al,diffStats:h?.diffStats,revertingPaths:ut,onRevertAll:Nr,isRevertingAll:Be,headerBackgroundClassName:"bg-transparent",onVisiblePathsChange:ge})}),n.jsx("div",{"data-keyboard-rider":"",className:"oc-mobile-commit-bar shrink-0 border-t border-edge-muted bg-background px-4 py-3",children:n.jsx(Kp,{stagedCount:es.length,commitMessage:Oe,onCommitMessageChange:Fe,generatedHighlights:it,onInsertHighlights:Il,onGenerateMessage:Pl,isGeneratingMessage:Je,onCommit:x=>{Rr({pushAfter:false,origin:x})},onCommitAndPush:x=>{Rr({pushAfter:true,origin:x})},commitAction:Ee,networkOperationBlocked:Ye.blocked,gitmojiEnabled:false,onOpenGitmojiPicker:()=>{}})})]}):n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(uy,{})}),m&&n.jsx(Hp,{open:mt,onOpenChange:Se,conflictFiles:ot,directory:m,operation:xt,onAbort:()=>{Ir(xt)},onNavigatedToChat:l}),n.jsx(Vp,{open:ht!==null,onOpenChange:x=>{x||rt(null)},targetBranch:ht??"",changedFileCount:h?.files?.length??0,onCommitAndSwitch:(x,W)=>iy(x,W,{targetBranch:ht,directory:m,sourceBranch:h?.current??null,git:d,publishChooser:Qe,toast:me,t:o,refreshStatusAndBranches:Nt,closeDialog:()=>rt(null),performCheckout:Fn}),onGenerateMessage:async()=>{if(!m)return"";const x=(h?.files??[]).map(fe=>fe.path).sort(),{message:W}=await Kr(m,x);return W.subject?.trim()??""},onRevertAndSwitch:async()=>{const x=ht;if(!x||!m)return;await Nr((h?.files??[]).map(fe=>fe.path));const W=await d.getGitStatus(m);if(!W.isClean&&(W.files?.length??0)>0){me.error(o("gitView.dirtySwitch.revertIncomplete"));return}rt(null),await Fn(x)}})]})},Ut=s=>{const e=oe.c(13),{message:t,description:i,loading:a,icon:r}=s,l=a===void 0?false:a,o=r===void 0?false:r;let d;e[0]!==l?(d=l?n.jsx(X,{name:"loader-4",className:"size-5 animate-spin text-muted-foreground"}):null,e[0]=l,e[1]=d):d=e[1];let u;e[2]!==o?(u=o?n.jsx(X,{name:"git-branch",className:"size-6 text-muted-foreground"}):null,e[2]=o,e[3]=u):u=e[3];let c;e[4]!==t?(c=n.jsx("p",{className:"typography-ui-label font-semibold text-foreground",children:t}),e[4]=t,e[5]=c):c=e[5];let f;e[6]!==i?(f=i?n.jsx("p",{className:"typography-meta text-muted-foreground",children:i}):null,e[6]=i,e[7]=f):f=e[7];let y;return e[8]!==d||e[9]!==u||e[10]!==c||e[11]!==f?(y=n.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center",children:n.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-2",children:[d,u,c,f]})}),e[8]=d,e[9]=u,e[10]=c,e[11]=f,e[12]=y):y=e[12],y},uy=()=>{const s=oe.c(7),{t:e}=be();let t;s[0]!==e?(t=e("mobile.changes.cleanDescription"),s[0]=e,s[1]=t):t=s[1];const i=Up(t);let a;s[2]!==e?(a=e("gitView.empty.cleanTitle"),s[2]=e,s[3]=a):a=s[3];let r;return s[4]!==i||s[5]!==a?(r=n.jsx(Ut,{icon:true,message:a,description:i}),s[4]=i,s[5]=a,s[6]=r):r=s[6],r},Ei=s=>{const e=oe.c(70),{path:t,previousPath:i,subtitle:a,diff:r,staged:l,fileExists:o,unavailableReason:d,error:u,onBack:c,onRetry:f,onExpandContextRequest:y,pendingContextExpansion:g,contextLoading:m,commentOrigin:h}=s,b=l===void 0?false:l,v=d===void 0?null:d,S=u===void 0?null:u,{t:w}=be();let N;e[0]!==t?(N=lu(t)||"text",e[0]=t,e[1]=N):N=e[1];const R=N;let T;e[2]!==h||e[3]!==t?(T={fileLabel:t,origin:h},e[2]=h,e[3]=t,e[4]=T):T=e[4];const j=ph(T);let C,k;if(e[5]!==t){const ne=t.replace(/\/$/,""),ue=ne.lastIndexOf("/");C=ne.slice(ue+1),k=ue>0?ne.slice(0,ue):null,e[5]=t,e[6]=C,e[7]=k}else C=e[6],k=e[7];const I=k,E=i?`${i} \u2192 ${I??C}`:I;let z;e[8]===Symbol.for("react.memo_cache_sentinel")?(z=de(qs,"border-b border-edge text-foreground"),e[8]=z):z=e[8];let P;e[9]!==w?(P=w("header.actions.backAria"),e[9]=w,e[10]=P):P=e[10];let B;e[11]===Symbol.for("react.memo_cache_sentinel")?(B=n.jsx(X,{name:"arrow-left",className:"size-5"}),e[11]=B):B=e[11];let $;e[12]!==c||e[13]!==P?($=n.jsx("button",{type:"button",className:Zt,"aria-label":P,onClick:c,children:B}),e[12]=c,e[13]=P,e[14]=$):$=e[14];const _=i?`${i} \u2192 ${t}`:t;let D;e[15]===Symbol.for("react.memo_cache_sentinel")?(D=de("oc-ui-start-align truncate",ri),e[15]=D):D=e[15];let M;e[16]!==C?(M=n.jsx("h2",{dir:"ltr",className:D,children:C}),e[16]=C,e[17]=M):M=e[17];let H;e[18]!==E?(H=E?n.jsx("span",{dir:"ltr",className:"oc-ui-start-align min-w-0 truncate",children:E}):null,e[18]=E,e[19]=H):H=e[19];let A;e[20]!==E||e[21]!==a?(A=E&&a?n.jsx("span",{"aria-hidden":true,className:"shrink-0 opacity-60",children:"\xB7"}):null,e[20]=E,e[21]=a,e[22]=A):A=e[22];let F;e[23]!==a?(F=a?n.jsx("span",{className:"min-w-0 max-w-full shrink-0 truncate",children:a}):null,e[23]=a,e[24]=F):F=e[24];let O;e[25]!==H||e[26]!==A||e[27]!==F?(O=n.jsxs("p",{className:"flex min-w-0 items-baseline gap-1.5 typography-micro text-muted-foreground",children:[H,A,F]}),e[25]=H,e[26]=A,e[27]=F,e[28]=O):O=e[28];let K;e[29]!==_||e[30]!==M||e[31]!==O?(K=n.jsxs("div",{className:"min-w-0 flex-1 px-1",title:_,children:[M,O]}),e[29]=_,e[30]=M,e[31]=O,e[32]=K):K=e[32];const L=j.isOpen?"text-foreground":"text-muted-foreground";let V;e[33]!==L?(V=de(Zt,L),e[33]=L,e[34]=V):V=e[34];let J;e[35]!==w?(J=w("inlineComment.actions.commentOnFile"),e[35]=w,e[36]=J):J=e[36];const G=j.isOpen;let q;e[37]!==w?(q=w("inlineComment.actions.commentOnFile"),e[37]=w,e[38]=q):q=e[38];let U;e[39]===Symbol.for("react.memo_cache_sentinel")?(U=n.jsx(X,{name:"chat-1",className:"size-5"}),e[39]=U):U=e[39];let Z;e[40]!==V||e[41]!==J||e[42]!==q||e[43]!==j.isOpen||e[44]!==j.toggle?(Z=n.jsx("button",{type:"button",className:V,"aria-label":J,"aria-pressed":G,title:q,onClick:j.toggle,children:U}),e[40]=V,e[41]=J,e[42]=q,e[43]=j.isOpen,e[44]=j.toggle,e[45]=Z):Z=e[45];let te;e[46]!==$||e[47]!==K||e[48]!==Z?(te=n.jsxs("header",{className:z,children:[$,K,Z]}),e[46]=$,e[47]=K,e[48]=Z,e[49]=te):te=e[49];let se;e[50]!==h||e[51]!==m||e[52]!==r||e[53]!==S||e[54]!==o||e[55]!==R||e[56]!==y||e[57]!==f||e[58]!==t||e[59]!==g||e[60]!==i||e[61]!==b||e[62]!==w||e[63]!==v?(se=n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:o?v==="nested_repository"?n.jsx(Ut,{icon:true,message:w("diffView.unavailable.nestedRepositoryTitle"),description:w("diffView.unavailable.nestedRepositoryDescription")}):v==="untracked_directory"?n.jsx(Ut,{icon:true,message:w("diffView.unavailable.untrackedDirectoryTitle"),description:w("diffView.unavailable.untrackedDirectoryDescription")}):S?n.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center",children:n.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-3",children:[n.jsx("p",{className:"typography-ui-label font-semibold text-foreground",children:w("mobile.changes.diffDetail.loadFailed")}),n.jsx("p",{className:"typography-meta text-muted-foreground",children:S}),n.jsx(ze,{type:"button",size:"sm",variant:"outline",onClick:()=>f?.(),children:w("diffView.actions.retry")})]})}):r?r.submodule?n.jsx("div",{className:"p-3",children:n.jsx(Bp,{state:r.submodule,staged:b})}):r.isBinary?n.jsx(Ut,{icon:true,message:w("diffView.binary.unavailable")}):Pa(t)&&Ba(r.original,r.modified)?n.jsx(bs,{outerClassName:"h-full",className:"p-3",disableHorizontal:true,"data-diff-virtual-root":true,"data-diff-virtual-content":true,children:n.jsx(mh,{filePath:t,original:r.original,modified:r.modified,renderText:ne=>n.jsx(to,{original:ne.original,modified:ne.modified,language:"text",fileName:t,commentOrigin:h,renderSideBySide:false,wrapLines:true,layout:"inline"})})}):i&&(r.fileDiff?r.fileDiff.hunks.length===0:r.original===r.modified)?n.jsx(Ut,{icon:true,message:w("diffView.change.renamedFrom",{from:i})}):cu(t)&&!r.fileDiff?n.jsx(Ut,{icon:true,message:w("mobile.changes.diffDetail.imageUnavailable")}):n.jsx(bs,{outerClassName:"h-full",className:"p-3",useScrollShadow:true,disableHorizontal:true,"data-diff-virtual-root":true,"data-diff-virtual-content":true,children:n.jsx(to,{original:r.original,modified:r.modified,fileDiff:r.fileDiff,language:R,fileName:t,commentOrigin:h,renderSideBySide:false,wrapLines:true,layout:"inline",onExpandContextRequest:y,pendingContextExpansion:g,contextLoading:m})}):n.jsx(Ut,{loading:true,message:w("diffView.state.loadingDiff")}):n.jsx(Ut,{icon:true,message:w("mobile.changes.diffDetail.missingTitle"),description:w("mobile.changes.diffDetail.missingDescription")})}),e[50]=h,e[51]=m,e[52]=r,e[53]=S,e[54]=o,e[55]=R,e[56]=y,e[57]=f,e[58]=t,e[59]=g,e[60]=i,e[61]=b,e[62]=w,e[63]=v,e[64]=se):se=e[64];let ie;return e[65]!==te||e[66]!==se||e[67]!==j.cards||e[68]!==j.editor?(ie=n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[te,j.cards,j.editor,se]}),e[65]=te,e[66]=se,e[67]=j.cards,e[68]=j.editor,e[69]=ie):ie=e[69],ie},Lo=s=>{const e=oe.c(12),{files:t,onSelect:i}=s,{t:a}=be();let r;e[0]!==a?(r=a("gitView.changes.changedFilesAria"),e[0]=a,e[1]=r):r=e[1];let l;if(e[2]!==t||e[3]!==i||e[4]!==a){let d;e[6]!==i||e[7]!==a?(d=u=>{const c=u.status==="A"?a("diffView.change.new"):u.status==="D"?a("diffView.change.deleted"):u.status==="R"?a("diffView.change.renamed"):u.status==="C"?a("diffView.change.copied"):a("diffView.change.modified"),f=u.status==="A"?"var(--status-success)":u.status==="D"?"var(--status-error)":u.status==="R"||u.status==="C"?"var(--status-info)":"var(--status-warning)";return n.jsx("li",{children:n.jsxs("button",{type:"button",className:"flex min-h-11 w-full items-center gap-2 rounded-md px-2 text-start touch-manipulation focus:outline-none active:bg-interactive-hover",onClick:()=>i(u.path),children:[n.jsx("span",{className:"w-4 shrink-0 text-center typography-micro font-semibold uppercase",style:{color:f},"aria-label":c,children:u.status}),n.jsx(Ea,{filePath:u.path,className:"size-3.5 shrink-0"}),n.jsx(Jp,{path:u.path,from:u.previousPath,nameFirst:true,className:"flex-1 typography-ui-label"}),(u.insertions>0||u.deletions>0)&&n.jsx(Gp,{insertions:u.insertions,deletions:u.deletions,hideZero:true})]})},u.path)},e[6]=i,e[7]=a,e[8]=d):d=e[8],l=t.map(d),e[2]=t,e[3]=i,e[4]=a,e[5]=l}else l=e[5];let o;return e[9]!==r||e[10]!==l?(o=n.jsx(bs,{outerClassName:"h-full",className:"px-2 py-1",useScrollShadow:true,disableHorizontal:true,children:n.jsx("ul",{"aria-label":r,className:"flex flex-col",children:l})}),e[9]=r,e[10]=l,e[11]=o):o=e[11],o},fy=p.lazy(()=>Js(()=>import("./FilesView-D0FOaLpo.js").then(s=>s.F),__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,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217])).then(s=>({default:s.FilesView}))),Cs=s=>Zs(s)??"",An=s=>{const e=Cs(s);return!e||e==="/"?e||"/":e.split("/").filter(Boolean).at(-1)??e},my=s=>{const e=Cs(s);if(!e||e==="/")return null;const t=e.lastIndexOf("/");return t<=0?e.startsWith("/")?"/":null:e.slice(0,t)},py=(s,e)=>{const t=Cs(s),i=Cs(e);return!i||t===i?An(t):t.startsWith(`${i}/`)?t.slice(i.length+1):t},hy=s=>{if(typeof s!="number"||!Number.isFinite(s)||s<0)return"";if(s<1024)return`${s} B`;const e=["KB","MB","GB"];let t=s/1024;for(const i of e){if(t<1024||i===e[e.length-1])return`${t.toFixed(t>=10?0:1)} ${i}`;t/=1024}return""},gy=s=>{const e=oe.c(5),{onClose:t,visible:i}=s,a=i===void 0?true:i,r=Ra(),l=Cs(Ia(r,ir()));if(r?.kind==="preparing"){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Ma,{}),e[0]=d):d=e[0],d}let o;return e[1]!==t||e[2]!==l||e[3]!==a?(o=n.jsx(by,{root:l,onClose:t,visible:a},l),e[1]=t,e[2]=l,e[3]=a,e[4]=o):o=e[4],o},by=({root:s,onClose:e,visible:t})=>{const{t:i}=be(),{files:a}=tr(),r=Zl(),l=ec(Z=>Z.setSelectedPath),[o,d]=p.useState(()=>({type:"browser",directory:s})),[u,c]=p.useState([]),[f,y]=p.useState(false),[g,m]=p.useState(null),[h,b]=p.useState(""),[v,S]=p.useState([]),[w,N]=p.useState(false),R=p.useRef(0),T=o.type==="browser"?o.directory:o.returnDirectory,j=p.useRef(T);j.current=T;const C=p.useCallback(async(Z,te)=>{if(!Z)return;const se=!r,ie=R.current+1;R.current=ie,y(true),te?.background||m(null);try{const ne=await a.listDirectory(Z,{respectGitignore:se});if(R.current!==ie)return;m(null),c(ne.entries.slice().sort((ue,Q)=>ue.isDirectory!==Q.isDirectory?ue.isDirectory?-1:1:ue.name.localeCompare(Q.name)))}catch(ne){if(R.current!==ie)return;if(te?.background){console.error("Failed to reload mobile directory:",ne);return}c([]),m(ne instanceof Error?ne.message:i("mobile.files.error.listFailed"))}finally{R.current===ie&&y(false)}},[a,r,i]);p.useEffect(()=>{o.type==="browser"&&C(o.directory)},[C,o]);const k=p.useRef(o);k.current=o;const I=p.useRef(u);I.current=u;const E=p.useCallback(({directories:Z})=>{const te=k.current;te.type==="browser"&&(Z&&!Z.some(se=>Cs(se)===Cs(te.directory))||I.current.length>pm||C(te.directory,{background:true}))},[C]);hm({root:s,active:t,whileInactive:"hold",onChanges:E});const z=p.useCallback(async Z=>{Cs(Z)===Cs(j.current)&&await C(j.current)},[C]),{canUpload:P,uploadingDirectory:B,pickFiles:$,uploadElements:_}=gm({root:s,refreshDirectory:z}),D=B!==null,M=xa(),H=p.useMemo(()=>({root:s,entries:hu(M,"file")}),[M,s]);p.useEffect(()=>{if(o.type!=="browser")return;const Z=h.trim();if(!Z){S([]),N(false);return}let te=false;const se=window.setTimeout(()=>{N(true),a.search({directory:o.directory,query:Z,maxResults:40}).then(ie=>{te||S(ie)}).catch(()=>{te||S([])}).finally(()=>{te||N(false)})},250);return()=>{te=true,window.clearTimeout(se)}},[a,h,o]);const A=Z=>{b(""),d({type:"browser",directory:Z})},F=Z=>{l(s,Z),d({type:"file",path:Z,returnDirectory:T||s})},O=qe(Z=>Z.pendingFileFocusPath),K=qe(Z=>Z.pendingFileNavigation);if(p.useEffect(()=>{const Z=Cs(K?.path??O??"");!Z||!s||(l(s,Z,{allowOutsideRoot:true}),d(te=>({type:"file",path:Z,returnDirectory:te.type==="file"?te.returnDirectory:s})),O&&qe.getState().setPendingFileFocusPath(null))},[O,K,s,l]),!s)return n.jsx(Dn,{message:i("mobile.files.empty.noDirectory")});if(o.type==="file")return n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[n.jsxs("header",{className:de(qs,"border-b border-edge text-foreground"),children:[n.jsx("button",{type:"button",className:Zt,"aria-label":i("header.actions.backAria"),onClick:()=>d({type:"browser",directory:o.returnDirectory}),style:{touchAction:"manipulation"},children:n.jsx(X,{name:"arrow-left",className:"size-5"})}),n.jsx("div",{className:"min-w-0 flex-1",children:n.jsx("h2",{className:de("truncate",ri),children:An(o.path)})})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:n.jsx(St,{children:n.jsx(p.Suspense,{fallback:n.jsx(Dn,{loading:true,message:i("filesView.state.loading")}),children:n.jsx(fy,{mode:"editor-only"})})})})]});const L=o.directory===s?i("mobile.files.rootDirectory"):An(o.directory),V=h.trim()?v:[],J=my(o.directory),G=o.directory!==s&&J!==null&&(J===s||J.startsWith(`${s}/`)),q=G&&!h.trim(),U=G?J:null;return n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[_,n.jsxs("div",{className:"shrink-0 px-2 pt-1",children:[n.jsx(gu,{value:h,onChange:b,placeholder:i("mobile.files.search.placeholder"),actions:n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",className:Ti,"aria-label":i("mobile.files.refreshAria"),onClick:()=>{C(o.directory)},children:n.jsx(bp,{className:de("size-4",f&&"animate-spin")})}),P?n.jsx("button",{type:"button",className:Ti,"aria-label":i("sidebarFilesTree.actions.uploadFilesTitle"),onClick:()=>$(o.directory),disabled:D,children:n.jsx(X,{name:D?"loader-4":"upload-2",className:de("size-4",D&&"animate-spin")})}):null,e?n.jsx("button",{type:"button",className:Ti,"aria-label":i("mobile.surface.closeAria"),onClick:e,children:n.jsx(yp,{className:"size-4"})}):null]})}),q&&U?n.jsxs("button",{type:"button",className:"flex min-h-11 w-full items-center gap-2.5 rounded-md px-2 text-start active:bg-interactive-hover focus:outline-none","aria-label":i("mobile.files.backToParentAria",{name:An(U)}),onClick:()=>A(U),children:[n.jsx(xp,{className:"size-4 shrink-0 text-muted-foreground"}),n.jsx("span",{className:"min-w-0 truncate typography-ui-label text-muted-foreground",children:L})]}):null]}),n.jsx(bs,{outerClassName:"min-h-0 flex-1",className:"px-2 pb-3 pt-1",useScrollShadow:true,disableHorizontal:true,children:g?n.jsx(Dn,{message:g}):h.trim()?n.jsx(yy,{root:s,results:V,isSearching:w,actions:H,onOpenFile:F}):n.jsxs(n.Fragment,{children:[u.length===0&&!f?n.jsx("div",{className:"px-4 py-8 text-center typography-ui-label text-muted-foreground",children:i("mobile.files.empty.directory")}):null,u.map(Z=>n.jsx(Sl,{name:Z.name,path:Z.path,directory:Z.isDirectory,meta:Z.isDirectory?void 0:hy(Z.size),actions:H,onClick:()=>Z.isDirectory?A(Z.path):F(Z.path)},Z.path))]})})]})},Ti="-my-1 flex size-9 shrink-0 items-center justify-center rounded-full text-muted-foreground touch-manipulation focus:outline-none active:bg-interactive-hover disabled:opacity-50",Sl=s=>{const e=oe.c(45),{name:t,path:i,directory:a,meta:r,actions:l,onClick:o}=s,{t:d}=be();let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u={touchAction:"manipulation"},e[0]=u):u=e[0];let c;e[1]!==a||e[2]!==i?(c=a?n.jsx(Sp,{className:"size-4 shrink-0 text-primary/80"}):n.jsx(Ea,{filePath:i,className:"size-4 shrink-0"}),e[1]=a,e[2]=i,e[3]=c):c=e[3];let f;e[4]!==t?(f=n.jsx("span",{className:"block min-w-0 flex-1 truncate typography-ui-label text-foreground",children:t}),e[4]=t,e[5]=f):f=e[5];let y;e[6]!==r?(y=r?n.jsx("span",{className:"min-w-0 max-w-[55%] shrink truncate typography-micro text-muted-foreground",dir:"auto",children:r}):null,e[6]=r,e[7]=y):y=e[7];let g;e[8]!==a?(g=a?n.jsx(jp,{className:"size-4 shrink-0 text-muted-foreground"}):null,e[8]=a,e[9]=g):g=e[9];let m;e[10]!==o||e[11]!==c||e[12]!==f||e[13]!==y||e[14]!==g?(m=n.jsxs("button",{type:"button",className:"flex min-h-11 w-full items-center gap-2.5 rounded-md px-2 text-start active:bg-interactive-hover focus:outline-none",onClick:o,style:u,children:[c,f,y,g]}),e[10]=o,e[11]=c,e[12]=f,e[13]=y,e[14]=g,e[15]=m):m=e[15];const h=m;let b;e[16]!==i||e[17]!==d?(b=()=>{Qi(i).then(k=>{if(k.ok){me.success(d("sidebarFilesTree.toast.pathCopied"));return}me.error(d("sidebarFilesTree.toast.copyFailed"))})},e[16]=i,e[17]=d,e[18]=b):b=e[18];const v=b;let S;e[19]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(X,{name:"link",className:"me-1 size-4"}),e[19]=S):S=e[19];let w;e[20]!==d?(w=d("sidebarFilesTree.menu.copyPath"),e[20]=d,e[21]=w):w=e[21];let N;e[22]!==v||e[23]!==w?(N=n.jsxs(cs,{onClick:v,children:[S,w]}),e[22]=v,e[23]=w,e[24]=N):N=e[24];let R;e[25]!==l.entries.length?(R=l.entries.length>0?n.jsx(va,{}):null,e[25]=l.entries.length,e[26]=R):R=e[26];let T;if(e[27]!==l.entries||e[28]!==l.root||e[29]!==a||e[30]!==i||e[31]!==d){let k;e[33]!==l.root||e[34]!==a||e[35]!==i||e[36]!==d?(k=I=>n.jsxs(cs,{onClick:()=>{bu(I,{kind:"file",action:I.action.id,directory:l.root||null,path:i,isDirectory:a},d)},children:[n.jsx(ii,{icon:I.icon,iconSrc:I.iconSrc,className:"me-1 size-4"}),I.action.label]},`${I.guest.id}:${I.action.id}`),e[33]=l.root,e[34]=a,e[35]=i,e[36]=d,e[37]=k):k=e[37],T=l.entries.map(k),e[27]=l.entries,e[28]=l.root,e[29]=a,e[30]=i,e[31]=d,e[32]=T}else T=e[32];let j;e[38]!==N||e[39]!==R||e[40]!==T?(j=n.jsxs(n.Fragment,{children:[N,R,T]}),e[38]=N,e[39]=R,e[40]=T,e[41]=j):j=e[41];let C;return e[42]!==h||e[43]!==j?(C=n.jsx(yr,{menu:j,children:h}),e[42]=h,e[43]=j,e[44]=C):C=e[44],C},yy=s=>{const e=oe.c(19),{root:t,results:i,isSearching:a,actions:r,onOpenFile:l}=s,{t:o}=be();if(a){let c;e[0]!==o?(c=o("common.loading"),e[0]=o,e[1]=c):c=e[1];let f;return e[2]!==c?(f=n.jsx(Dn,{loading:true,message:c}),e[2]=c,e[3]=f):f=e[3],f}if(i.length===0){let c;e[4]!==o?(c=o("mobile.files.search.empty"),e[4]=o,e[5]=c):c=e[5];let f;return e[6]!==c?(f=n.jsx(Dn,{message:c}),e[6]=c,e[7]=f):f=e[7],f}let d;if(e[8]!==r||e[9]!==l||e[10]!==i||e[11]!==t){let c;e[13]!==r||e[14]!==l||e[15]!==t?(c=f=>n.jsx(Sl,{name:An(f.path),path:f.path,directory:false,meta:py(f.path,t),actions:r,onClick:()=>l(f.path)},f.path),e[13]=r,e[14]=l,e[15]=t,e[16]=c):c=e[16],d=i.map(c),e[8]=r,e[9]=l,e[10]=i,e[11]=t,e[12]=d}else d=e[12];let u;return e[17]!==d?(u=n.jsx(n.Fragment,{children:d}),e[17]=d,e[18]=u):u=e[18],u},Dn=s=>{const e=oe.c(7),{message:t,loading:i}=s,a=i===void 0?false:i;let r;e[0]!==a?(r=a?n.jsx(vp,{className:"size-5 animate-spin text-muted-foreground"}):n.jsx(wp,{className:"size-6 text-muted-foreground"}),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==t?(l=n.jsx("p",{className:"typography-ui-label font-semibold text-foreground",children:t}),e[2]=t,e[3]=l):l=e[3];let o;return e[4]!==r||e[5]!==l?(o=n.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center",children:n.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-2",children:[r,l]})}),e[4]=r,e[5]=l,e[6]=o):o=e[6],o},xy=s=>{const e=oe.c(21),{visible:t,onLeave:i,sectionsDialogOpen:a,onSectionsDialogOpenChange:r}=s,{t:l}=be(),o=dt(vy),d=ir()??null,u=yu(),[c,f]=p.useState(1);let y,g;e[0]!==t?(y=()=>{t&&f(wy)},g=[t],e[0]=t,e[1]=y,e[2]=g):(y=e[1],g=e[2]),p.useEffect(y,g);const m=!u.allSectionsHidden&&c===0;let h;e[3]!==d||e[4]!==u||e[5]!==i||e[6]!==o||e[7]!==t?(h=t&&!u.allSectionsHidden?n.jsx(xu.Provider,{value:i,children:n.jsx(vu.Provider,{value:true,children:n.jsx(wu,{onChange:f,children:n.jsx(bs,{useScrollShadow:true,scrollShadowSize:24,outerClassName:"min-h-0 flex-1",className:"px-3 pb-4 pt-2",disableHorizontal:true,children:n.jsx(Su,{sessionId:o,directory:d,repositoryEnabled:!Xi(d),layout:u})})})})}):null,e[3]=d,e[4]=u,e[5]=i,e[6]=o,e[7]=t,e[8]=h):h=e[8];let b;e[9]!==u.allSectionsHidden||e[10]!==r||e[11]!==m||e[12]!==l?(b=u.allSectionsHidden||m?n.jsxs("div",{className:"absolute inset-x-0 top-16 flex flex-col items-center px-6 text-center",children:[n.jsx("span",{className:"typography-ui-label text-muted-foreground",children:u.allSectionsHidden?l("chat.workStatus.sections.allHidden"):l("chat.workStatus.mobileEmpty")}),u.allSectionsHidden?n.jsx(ze,{variant:"link",size:"sm",onClick:()=>r(true),className:"mt-2 normal-case text-muted-foreground hover:text-foreground",children:l("chat.workStatus.sections.open")}):null]}):null,e[9]=u.allSectionsHidden,e[10]=r,e[11]=m,e[12]=l,e[13]=b):b=e[13];let v;e[14]!==r||e[15]!==a?(v=n.jsx(ju,{open:a,onOpenChange:r}),e[14]=r,e[15]=a,e[16]=v):v=e[16];let S;return e[17]!==h||e[18]!==b||e[19]!==v?(S=n.jsxs("div",{className:"relative flex h-full min-h-0 flex-col",children:[h,b,v]}),e[17]=h,e[18]=b,e[19]=v,e[20]=S):S=e[20],S};function vy(s){return s.currentSessionId}function wy(s){return Math.max(s,1)}const Sy=p.lazy(()=>Js(()=>import("./GuestPanelContent-BCxvKv4H.js"),__vite__mapDeps([218,2,3,5,1,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,104,105,106,107,108,109,110,4,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180])).then(s=>({default:s.GuestPanelContent}))),Bo="mobile-surface-root",jy=16,Fo=320,ky="cubic-bezier(0.22, 1, 0.36, 1)",Cy=({open:s,onClose:e,tab:t,onTabChange:i,pendingChangesDiff:a,pendingChangesCommit:r,onOpenPlan:l,onOpenReceivedPage:o,variant:d="drawer"})=>{const{t:u,direction:c}=be(),f=p.useRef(null),y=p.useRef(null),[g,m]=p.useState(false),[h,b]=p.useState(s),v=p.useRef(e);p.useEffect(()=>{v.current=e},[e]);const S=qe(L=>L.mobileWorkspaceTabOrder),w=qe(L=>L.mobileWorkspaceHiddenTabs),N=qe(L=>L.setMobileWorkspaceTabOrder),R=Ta(),T=_a(ku()),j=sr(L=>L.guests),C=Hr(L=>L.countByGuest),[k,I]=p.useState(false),E=p.useRef(t);p.useEffect(()=>{E.current=t},[t]);const z=()=>v.current();kr(y,{enabled:d==="drawer"&&s,...c==="rtl"?{onRightEdgeSwipe:z}:{onLeftEdgeSwipe:z}});const[P,B]=p.useState(()=>new Set);p.useEffect(()=>{s&&B(L=>{if(L.has(t))return L;const V=new Set(L);return V.add(t),V})},[s,t]),p.useEffect(()=>{B(L=>{const V=[...L].filter(J=>Un(J)&&!R.includes(J));return V.length===0?L:new Set([...L].filter(J=>!V.includes(J)))})},[R]);const $=Hr(L=>L.clearBadge);if(p.useEffect(()=>{s&&Un(t)&&$(xi(t))},[$,s,t]),typeof document<"u"&&!f.current){let L=document.getElementById(Bo);L||(L=document.createElement("div"),L.id=Bo,document.body.appendChild(L)),f.current=L}if(p.useEffect(()=>{if(s){b(true);const V=window.setTimeout(()=>m(true),jy);return()=>window.clearTimeout(V)}m(false);const L=window.setTimeout(()=>b(false),Fo+40);return()=>window.clearTimeout(L)},[s]),p.useEffect(()=>{if(!s)return;const L=document.body.style.overflow;d==="drawer"&&(document.body.style.overflow="hidden");const V=J=>{J.key!=="Escape"||E.current==="terminal"||Iu(J.target)||Na(J)||v.current()};return document.addEventListener("keydown",V),()=>{d==="drawer"&&(document.body.style.overflow=L),document.removeEventListener("keydown",V)}},[s,d]),d==="drawer"&&!f.current)return null;const _={status:{id:"status",label:u("chat.workStatus.ariaLabel"),icon:n.jsx(X,{name:"list-indefinite",className:"h-3.5 w-3.5"})},changes:{id:"changes",label:u("mobile.menu.git"),icon:n.jsx(X,{name:"git-branch",className:"h-3.5 w-3.5"})},files:{id:"files",label:u("mobile.menu.files"),icon:n.jsx(X,{name:"file-text",className:"h-3.5 w-3.5"})},terminal:{id:"terminal",label:u("mobile.menu.terminal"),icon:n.jsx(X,{name:"terminal",className:"h-3.5 w-3.5"})},notes:{id:"notes",label:u("contextRail.surface.notes"),icon:n.jsx(X,{name:"sticky-note",className:"h-3.5 w-3.5"})},pages:{id:"pages",label:u("contextPanel.mode.pages"),icon:n.jsx(X,{name:"pages",className:"h-3.5 w-3.5"})}},D=L=>{const V=xi(L),J=j.find(U=>U.id===V),G=J?.name??V,q=C[V]??0;return{id:L,label:G,title:q>0?u(q===1?"contextRail.surface.plugin.badgeAriaSingle":"contextRail.surface.plugin.badgeAriaPlural",{label:G,count:q}):G,icon:n.jsxs("span",{className:"relative flex",children:[n.jsx(ii,{icon:ka(J?.icon??""),iconSrc:J?ja(J.id,J.icon,Qo().authenticatedAsset):void 0,className:"h-3.5 w-3.5"}),q>0?n.jsx("span",{"aria-hidden":"true",className:"absolute -top-1.5 -end-1.5 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-[var(--status-info)] px-0.5 text-[0.5625rem] font-medium leading-none text-[var(--status-info-foreground)]",children:q>99?"99+":q}):null]})}},M=tc(S,w,t,R),H=T||t==="pages"?sc(M):M,A=H.map(L=>Un(L)?D(L):_[L]),F=A.length===1?A[0]:null,O=(L,V)=>{const J=nc(S,R),G=J.findIndex(U=>U===L),q=J.findIndex(U=>U===V);G<0||q<0||N(fp(J,G,q))},K=n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:qs,children:[n.jsx("div",{className:"flex h-9 min-w-0 flex-1 items-center",children:F?n.jsxs("h2",{className:"flex min-w-0 items-center gap-2 px-1 typography-ui-label font-medium text-foreground",children:[n.jsx("span",{className:"flex shrink-0 text-muted-foreground",children:F.icon}),n.jsx("span",{className:"truncate",children:F.label})]}):h?n.jsx(Cu,{items:A,activeId:t,onSelect:L=>{const V=H.find(J=>J===L);V&&i(V)},onReorder:O,layoutMode:A.length>5?"scrollable":"fit",variant:"active-pill",nonCompositedIndicator:true,inactiveTabsIconOnly:A.length>3,className:"h-full"}):null}),t==="status"?n.jsx("button",{type:"button",className:Zt,"aria-label":u("chat.workStatus.sections.open"),onClick:()=>I(true),style:{touchAction:"manipulation"},children:n.jsx(X,{name:"list-settings",className:"size-5"})}):null,n.jsx("button",{type:"button",className:Zt,"aria-label":u("mobile.surface.closeAria"),onClick:e,style:{touchAction:"manipulation"},children:n.jsx(X,{name:"close",className:"size-5"})})]}),n.jsxs("div",{className:"min-h-0 flex-1 overflow-hidden",children:[P.has("status")?n.jsx("div",{className:de("h-full",t!=="status"&&"hidden"),children:n.jsx(St,{children:n.jsx(xy,{visible:s&&t==="status",onLeave:e,sectionsDialogOpen:k,onSectionsDialogOpenChange:I})})}):null,P.has("changes")?n.jsx("div",{className:de("h-full",t!=="changes"&&"hidden"),children:n.jsx(St,{children:n.jsx(cy,{visible:s&&t==="changes",initialDiff:a,initialCommit:r,onNavigatedToChat:e})})},a?`changes:${a.path}:${a.staged}`:"changes"):null,P.has("files")?n.jsx("div",{className:de("h-full",t!=="files"&&"hidden"),children:n.jsx(St,{children:n.jsx(gy,{visible:s&&t==="files"})})}):null,P.has("terminal")?n.jsx("div",{className:de("h-full",t!=="terminal"&&"hidden"),children:n.jsx(St,{children:n.jsx(bm,{visible:s&&t==="terminal"})})}):null,P.has("notes")?n.jsx("div",{className:de("h-full",t!=="notes"&&"hidden"),children:n.jsx(St,{children:n.jsx(ym,{visible:s&&t==="notes",onActionComplete:e,onOpenPlan:l})})}):null,P.has("pages")?n.jsx("div",{className:de("h-full overflow-y-auto",t!=="pages"&&"hidden"),children:n.jsx(St,{children:n.jsx(xm,{onOpen:(L,V)=>o({receivedId:L.receivedId,title:V})})})}):null,R.map(L=>{if(!P.has(L))return null;const V=j.find(J=>J.id===xi(L));return V?n.jsx("div",{className:de("h-full",t!==L&&"hidden"),children:n.jsx(St,{children:n.jsx(p.Suspense,{fallback:null,children:n.jsx(Sy,{mode:L,sharedSurface:Ru(V),docking:Nu(V),surfaceMounted:s&&t===L})})})},L):null})]})]});return d==="panel"?n.jsx("div",{className:"flex h-full min-h-0 flex-col bg-background text-foreground",children:K}):cn.createPortal(n.jsx("section",{ref:y,role:"dialog","aria-modal":"true","aria-label":u("mobile.header.openWorkspaceAria"),"aria-hidden":!s,className:"oc-keyboard-inset-surface oc-bottom-safe-surface oc-side-safe-area fixed inset-0 z-50 flex flex-col bg-background text-foreground",style:{paddingTop:"var(--oc-safe-area-top, 0px)",transform:g?"none":c==="rtl"?"translateX(-100%)":"translateX(100%)",transition:`transform ${Fo}ms ${ky}`,visibility:h?"visible":"hidden",pointerEvents:s?"auto":"none"},children:K}),f.current)};function Ny(s){const e=oe.c(4),t=2500,{uiFont:i}=Pu(),[a,r]=p.useState(false);let l,o;return e[0]!==t||e[1]!==i?(l=()=>{let d=false;const u=()=>{d||r(true)},c=()=>{requestAnimationFrame(()=>requestAnimationFrame(u))},f=Promise.all([Eu(i).catch(Ty),document.fonts?.ready?.then(Ey).catch(Py)??Promise.resolve(),hh.catch(Iy)]).then(Ry),y=new Promise(g=>{window.setTimeout(g,t)});return Promise.race([f,y]).then(c),()=>{d=true}},o=[i,t],e[0]=t,e[1]=i,e[2]=l,e[3]=o):(l=e[2],o=e[3]),p.useEffect(l,o),a}function Ry(){}function Iy(){}function Py(){}function Ey(){}function Ty(){}const _y=or({projectId:fn().trim().min(1).optional(),text:fn().optional()}),Ay=or({request:_y.nullish()}),jl=lr("ShortcutRequests"),Dy=async()=>{const s=Ay.safeParse(await jl.takePending());return s.success?s.data.request??null:null},Oy=s=>{if(Yi()!=="ios")return()=>{};let e=false,t=null;const i=()=>{Dy().then(a=>{a&&s(a)}).catch(()=>{})};return jl.addListener("pending",i).then(a=>{if(e){a.remove();return}t=a}).catch(()=>{}),i(),()=>{e=true,t?.remove()}},My="openchamber",Ly=s=>s.replace(/^\/+|\/+$/g,""),By=s=>{const e=Ly(s.pathname).split("/").filter(Boolean);return s.host?[s.host,...e]:e};function Fy(s){if(typeof s!="string"||s.length===0)return null;let e;try{e=new URL(s)}catch{return null}if(e.protocol!==`${My}:`)return null;const t=By(e),i=(t[0]??"").toLowerCase(),a=t.slice(1),r=e.searchParams;switch(i){case"session":{const l=a[0]||r.get("id")||"";if(!l)return null;const o=r.get("message")?.trim()??"";return{type:"session",sessionId:l,directory:r.get("dir")??void 0,...Tu(o)?{messageId:o}:{}}}case"new":case"new-session":return{type:"new-session",directory:r.get("dir")??void 0,projectId:r.get("project")??void 0,agent:r.get("agent")??void 0,model:r.get("model")??void 0};case"sessions":{const l=r.get("filter");return{type:"sessions",filter:l==="attention"||l==="recent"||l==="all"?l:void 0}}case"status":return{type:"status"};case"settings":{const l=a[0]||r.get("section")||void 0,o=r.get("provider")?.trim(),d={type:"settings",section:l};return l==="usage"&&o&&/^[a-z0-9][a-z0-9-]{0,79}$/.test(o)&&(d.providerId=o),d}case"changes":return{type:"changes",path:a.join("/")||r.get("path")||void 0,staged:r.get("staged")==="true"};case"view":{const l=(a[0]||"").toLowerCase();return l==="changes"?{type:"changes"}:l==="files"||l==="mcp"||l==="instances"||l==="update"?{type:"view",target:l}:null}default:return null}}let ls={},kl=false,Tn=null,zo=false;const zy=s=>{const e=dt.getState(),t=s.projectId?qt.getState().projects.find(a=>a.id===s.projectId)??null:null;e.openNewSessionDraft(t?{selectedProjectId:t.id}:void 0);const i=s.text?.trim();if(i){if(s.projectId&&!t){Vr.getState().setPendingInputText(i,"append");return}Vr.getState().requestDraftSubmit(dt.getState().newSessionDraft.draftId,i)}},Wy=s=>{switch(s.type){case"shortcut-new-session":return zy(s),true;case"session":return _u(s.sessionId,{directory:s.directory??null,messageId:s.messageId??null}),true;case"new-session":{const e=dt.getState();return e.openNewSessionDraft(),(s.directory||s.projectId)&&e.setNewSessionDraftTarget({directoryOverride:s.directory??null,projectId:s.projectId??null,selectedProjectId:s.projectId??null}),true}case"sessions":return ls.openSessions?(ls.openSessions(s.filter),true):false;case"status":return ls.openSessions?(ls.openSessions(),true):false;case"view":return ls.openView?(ls.openView(s.target),true):false;case"changes":return ls.openChanges?(ls.openChanges({path:s.path,staged:s.staged}),true):false;case"settings":return ls.openSettings?(s.section==="usage"&&s.providerId&&ks.getState().setSelectedProvider(s.providerId),ls.openSettings(s.section),true):false}},Cr=()=>{if(!kl||!Tn)return;const s=Tn;Tn=null,Wy(s)||(Tn=s)},Ji=s=>{Tn=s,Cr()},_i=s=>{const e=Fy(s);e&&Ji(e)},$y=s=>{kl=s,Cr()},Ky=s=>{const e=oe.c(3);let t,i;e[0]!==s?(t=()=>(ls=s,Cr(),()=>{ls===s&&(ls={})}),i=[s],e[0]=s,e[1]=t,e[2]=i):(t=e[1],i=e[2]),p.useEffect(t,i)},Hy=s=>{const{ready:e}=s;p.useEffect(()=>{$y(e)},[e]),p.useEffect(()=>{if(!Tt())return;let t=false;const i=[];return Js(()=>import("./vendor-capacitor-app-BrDJj9I_.js"),__vite__mapDeps([219,1,109])).then(async({App:a})=>{if(t)return;const r=await a.addListener("appUrlOpen",l=>{_i(l?.url)});if(t){r.remove();return}if(i.push(()=>{r.remove()}),!zo&&ar.getPlatform()==="android"){zo=true;const l=await a.getLaunchUrl().catch(()=>null);!t&&l?.url&&_i(l.url)}}).catch(()=>{}),i.push(Oy(a=>{Ji({type:"shortcut-new-session",projectId:a.projectId,text:a.text})})),Js(()=>import("./vendor-capacitor-push-notifications-KNe1zSBF.js"),__vite__mapDeps([220,109])).then(async({PushNotifications:a})=>{if(t)return;const r=await a.addListener("pushNotificationActionPerformed",l=>{const o=l?.notification?.data,d=typeof o?.url=="string"?o.url:typeof o?.deeplink=="string"?o.deeplink:void 0;if(d){_i(d);return}const u=typeof o?.sessionId=="string"?o.sessionId:void 0;u&&Ji({type:"session",sessionId:u})});if(t){r.remove();return}i.push(()=>{r.remove()})}).catch(()=>{}),()=>{t=true,i.forEach(a=>a())}},[])},Vy=()=>{if(typeof window>"u")return;const s=window.__OPENCHAMBER_APNS_ENV__;if(s==="development")return"sandbox";if(s==="production")return"production"},Wo=/^[A-Za-z0-9+/]{43}=$/,Uy=lr("PushKey"),Gy=async()=>{const s=window.__OPENCHAMBER_PUSH_KEY__;if(s&&Wo.test(s))return s;const e=await Uy.get().then(t=>t.key).catch(()=>{});return e&&Wo.test(e)?e:void 0},qy=()=>{if(typeof window>"u")return false;const e=window.Capacitor?.getPlatform?.();return e==="ios"||e==="android"},Jy=s=>{const{enabled:e}=s,t=qe(a=>a.nativeNotificationsEnabled),i=p.useRef(null);p.useEffect(()=>{if(!e||!t||!qy())return;let a=false;const r=[];return Js(()=>import("./vendor-capacitor-push-notifications-KNe1zSBF.js"),__vite__mapDeps([220,109])).then(async({PushNotifications:l})=>{if(a)return;let o=await l.checkPermissions().catch(()=>null);if(o?.receive!=="granted"&&(o=await l.requestPermissions().catch(()=>null)),o?.receive!=="granted")return;const d=await l.addListener("registration",c=>{i.current=c.value,Gy().then(f=>{const y=Or(),g={token:c.value,platform:Yi(),environment:Vy()};f&&(g.pushKey=f),y?.push?.registerApnsToken?.(g)})}),u=await l.addListener("registrationError",c=>{console.warn("[Push] APNs registration error:",c)});if(await l.register().catch(()=>{}),a){d.remove(),u.remove();return}r.push(()=>{d.remove()},()=>{u.remove()})}).catch(()=>{}),()=>{a=true,r.forEach(l=>l())}},[e,t]),p.useEffect(()=>{if(t)return;const a=i.current;if(!a)return;i.current=null,Or()?.push?.unregisterApnsToken?.({token:a})},[t])},Yy=s=>s.includes(" \xB7 ")?s:Ou(s),$o=(s,e,t,i)=>{const a=t==="remaining"?e.remainingPercent:e.usedPercent,r=ra(e,a,i.t),l={label:Yy(s),value:r==="-"?"":Au(r),tone:oa(e.usedPercent)};a!==null&&Number.isFinite(a)&&(l.percent=Math.min(100,Math.max(0,a)));const o=Du(e.resetAt,e.resetAfterFormatted??e.resetAtFormatted,i.timeFormatPreference);return o&&(l.reset=i.t("settings.usage.card.resetsAt",{time:o})),l},Xy=(s,e)=>{const t=s.displayMode==="usage"?"used":"remaining",i=s.dropdownProviderIds.flatMap(a=>{const r=s.results.find(d=>d.providerId===a);if(!r?.configured||!r.usage)return[];const l=Object.entries(r.usage.windows??{}).map(([d,u])=>$o(d,u,t,e)),o=s.selectedModels[a];for(const[d,u]of Object.entries(r.usage.models??{}))if(!(o?.length&&!o.includes(d)))for(const[c,f]of Object.entries(u.windows??{}))l.push($o(`${d} \xB7 ${c}`,f,t,e));return l.length>0?[{id:a,name:r.providerName,windows:l}]:[]});return{mode:t,providers:i}},Ks=lr("WidgetBridge"),Qy=5*6e4,Zy=1e3,ex=s=>{const e=s?.colors;return{variant:s?.metadata.variant==="light"?"light":"dark",background:e?.surface.elevated??e?.surface.background,primary:e?.primary.base,foreground:e?.surface.foreground,muted:e?.surface.mutedForeground,info:e?.status.info,success:e?.status.success,warning:e?.status.warning,error:e?.status.error}},tx=({enabled:s})=>{const{t:e}=be(),t=Mu()?.currentTheme,i=qe(l=>l.timeFormatPreference),a=p.useMemo(()=>ex(t),[t]),r=p.useMemo(()=>({sessionsTitle:e("mobile.androidWidget.sessions.title"),sessionsEmpty:e("mobile.androidWidget.sessions.empty"),newSession:e("mobile.androidWidget.sessions.new"),untitled:e("mobile.sessions.untitled"),running:e("mobile.androidWidget.status.running"),retrying:e("mobile.androidWidget.status.retrying"),error:e("mobile.androidWidget.status.error"),usageTitle:e("mobile.androidWidget.usage.title"),usageEmpty:e("mobile.androidWidget.usage.empty"),remaining:e("mobile.androidWidget.usage.remaining"),used:e("mobile.androidWidget.usage.used"),updated:e("mobile.androidWidget.updated",{time:"%s"}),refreshing:e("mobile.androidWidget.refreshing"),queued:e("mobile.androidWidget.queued"),failed:e("mobile.androidWidget.failed"),refresh:e("mobile.androidWidget.refresh")}),[e]);p.useEffect(()=>{if(!s||ar.getPlatform()!=="android")return;let l=false,o={usage:false,sessions:false},d=null,u=false;const c=async()=>{const w=o.sessions&&Ns.getState().hasLoaded,N=ks.getState(),R=o.usage&&N.loadedRuntimeKey!==null;if(!w&&!R)return;const T=C=>Lu(C,i),j={};if(R){const C=N.lastUpdated===null?"":T(N.lastUpdated),k=Xy(N,{t:e,timeFormatPreference:i});j.usage=JSON.stringify({updated:C,labels:r,palette:a,...k})}w&&(j.sessions=JSON.stringify({updated:T(Date.now()),labels:r,palette:a,...za()})),await Ks.update(j)},f=()=>{l||d!==null||!o.usage&&!o.sessions||(d=setTimeout(()=>{d=null,l||c().catch(()=>{})},Zy))},y=w=>o.usage?ks.getState().ensureLoadedForRuntime({refresh:w}):Promise.resolve(),g=async()=>{const w=ks.getState().lastUpdated,[,N]=await Promise.allSettled([y(true),o.sessions?Ns.getState().refreshSessionHead():Promise.resolve(true)]),R=ks.getState().lastUpdated,T=N.status==="fulfilled"&&N.value,j=!o.usage||R!==null&&R!==w;return await c(),T&&j},m=async()=>{if(!(l||u)){u=true;try{for(;;){const w=await Ks.pendingRefresh();if(l||w.requested<=w.acknowledged)return;const N=await g().catch(()=>false);if(l)return;if(!N){await Ks.reportRefreshFailure({requested:w.requested});return}await Ks.acknowledgeRefresh({requested:w.requested})}}catch{}finally{u=false}}},h=async()=>{const w=await Ks.installed().catch(()=>o);if(l)return;const N=w.usage&&!o.usage;o=w,N&&y(false).finally(f);const R=Ns.getState();o.sessions&&!R.hasLoaded&&R.loadSessions().catch(()=>{}).finally(f),f()},b=()=>{document.visibilityState==="visible"&&h().then(()=>{const w=ks.getState().lastUpdated;o.usage&&(w===null||Date.now()-w>Qy)&&y(true).catch(()=>{}).finally(f),m()})},v=[ks.subscribe(f),Ns.subscribe(f),na.subscribe(f),dt.subscribe((w,N)=>{w.availableWorktreesByProject!==N.availableWorktreesByProject&&f()}),qt.subscribe(f)],S=[Ks.addListener("refreshRequested",()=>{m()}).catch(()=>null),Ks.addListener("widgetsChanged",()=>{h()}).catch(()=>null)];return document.addEventListener("visibilitychange",b),h().then(()=>m()),()=>{l=true,d!==null&&clearTimeout(d);for(const w of v)w();for(const w of S)w.then(N=>N?.remove());document.removeEventListener("visibilitychange",b)}},[s,r,a,e,i])},Ko=s=>{const e=oe.c(12),{side:t,isResizing:i,ariaLabel:a,handleProps:r}=s,l=t==="left"?"inset-e-0":"inset-s-0";let o;e[0]!==l?(o=de("absolute inset-y-0 z-50 w-6 cursor-col-resize touch-none",l),e[0]=l,e[1]=o):o=e[1];const d=t==="left"?"inset-e-0":"inset-s-0",u=i&&"bg-[var(--interactive-border)]";let c;e[2]!==d||e[3]!==u?(c=de("absolute inset-y-0 w-[3px] transition-colors",d,u),e[2]=d,e[3]=u,e[4]=c):c=e[4];let f;e[5]!==c?(f=n.jsx("div",{className:c}),e[5]=c,e[6]=f):f=e[6];let y;return e[7]!==a||e[8]!==r||e[9]!==o||e[10]!==f?(y=n.jsx("div",{className:o,role:"separator","aria-orientation":"vertical","aria-label":a,...r,children:f}),e[7]=a,e[8]=r,e[9]=o,e[10]=f,e[11]=y):y=e[11],y},sx=320,nx=380,Ho=280,ix=560,rx=900;function Vo(s,e,t,i){const a=oe.c(23),r=i===void 0?ix:i,l=p.useRef(null);let o;a[0]!==t||a[1]!==r||a[2]!==e?(o=()=>{if(typeof window>"u")return t;const P=Number.parseInt(window.localStorage.getItem(e)??"",10);return Number.isFinite(P)?Math.min(r,Math.max(Ho,P)):t},a[0]=t,a[1]=r,a[2]=e,a[3]=o):o=a[3];const[d,u]=p.useState(o),[c,f]=p.useState(false),y=p.useRef(0),g=p.useRef(d),m=p.useRef(null),h=p.useRef(null);let b;a[4]!==r?(b=P=>Math.min(r,Math.max(Ho,Math.round(P))),a[4]=r,a[5]=b):b=a[5];const v=b;let S;a[6]===Symbol.for("react.memo_cache_sentinel")?(S=P=>{const B=l.current;B&&(B.style.width=`${P}px`,B.style.minWidth=`${P}px`,B.style.maxWidth=`${P}px`,B.style.setProperty("--oc-ipad-sidebar-width",`${P}px`))},a[6]=S):S=a[6];const w=S;let N;a[7]!==d?(N=P=>{try{P.currentTarget.setPointerCapture(P.pointerId)}catch{}h.current=P.pointerId,y.current=P.clientX,g.current=d,m.current=d,f(true),P.preventDefault()},a[7]=d,a[8]=N):N=a[8];const R=N;let T;a[9]!==v||a[10]!==s?(T=P=>{if(h.current!==P.pointerId)return;const B=(s==="left"?1:-1)*(ic(P.currentTarget)?-1:1),$=v(g.current+(P.clientX-y.current)*B);m.current!==$&&(m.current=$,w($))},a[9]=v,a[10]=s,a[11]=T):T=a[11];const j=T;let C;a[12]!==v||a[13]!==e?(C=P=>{if(h.current!==P.pointerId)return;try{P.currentTarget.releasePointerCapture(P.pointerId)}catch{}const B=v(m.current??g.current);h.current=null,m.current=null,f(false),u(B);try{window.localStorage.setItem(e,String(B))}catch{}},a[12]=v,a[13]=e,a[14]=C):C=a[14];const k=C;let I;a[15]!==R||a[16]!==k||a[17]!==j?(I={onPointerDown:R,onPointerMove:j,onPointerUp:k,onPointerCancel:k},a[15]=R,a[16]=k,a[17]=j,a[18]=I):I=a[18];const E=I;let z;return a[19]!==E||a[20]!==c||a[21]!==d?(z={asideRef:l,width:d,isResizing:c,handleProps:E},a[19]=E,a[20]=c,a[21]=d,a[22]=z):z=a[22],z}const ox=()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===true,ax=200;function Uo(s){const e=oe.c(6),[t,i]=p.useState(false),[a,r]=p.useState(s);s!==a&&(r(s),i(!s&&!ox()));let l,o;e[0]!==t?(l=()=>{if(!t)return;const c=window.setTimeout(()=>i(false),ax);return()=>window.clearTimeout(c)},o=[t],e[0]=t,e[1]=l,e[2]=o):(l=e[1],o=e[2]),p.useEffect(l,o);const d=s||t;let u;return e[3]!==s||e[4]!==d?(u={placed:d,inPlace:s},e[3]=s,e[4]=d,e[5]=u):u=e[5],u}const Go=["general","isolated-spaces","appearance","chat","notifications","sessions","routing","projects","git","magic-prompts","snippets","behavior","agents","commands","mcp","plugins","skills.installed","skills.catalog","providers","web-search","usage","voice","integrations","extensions","about"],lx=1e3,cx=p.lazy(()=>Js(()=>import("./useAppFontEffects-BDLOJuy5.js").then(s=>s.v1),__vite__mapDeps([4,2,3,5,1,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,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180])).then(s=>({default:s.PluginPane}))),dx=({onActiveConnectionDeleted:s})=>{const{t:e,direction:t}=be();zm();const[i,a]=p.useState(false);p.useEffect(()=>dt.subscribe((Y,Pe)=>{Y.currentSessionId&&Y.currentSessionId!==Pe.currentSessionId&&qe.getState().setRunOverviewKey(null)}),[]);const r=qe(Y=>Y.runOverviewKey!==null);p.useEffect(()=>{r&&a(false)},[r]);const[l,o]=p.useState(null),[d,u]=p.useState(false),[c,f]=p.useState(()=>{const{mobileWorkspaceTabOrder:Y,mobileWorkspaceHiddenTabs:Pe}=qe.getState();return vi(Y,Pe)[0]}),y=p.useCallback(()=>{const{mobileWorkspaceTabOrder:Y,mobileWorkspaceHiddenTabs:Pe}=qe.getState(),he=Zu(sr.getState().guests),Ve=vi(Y,Pe,he),ft=_a(ef.getState());f(at=>Ve.some(pt=>pt===at)||at==="pages"&&ft?at:Ve[0]),u(true)},[]),[g,m]=p.useState(null),[h,b]=p.useState(null),[v,S]=p.useState("nav"),[w,N]=p.useState(null),R=w&&"diff"in w?w.diff:null,T=w&&"commit"in w?w.commit:null,j=Ta();p.useEffect(()=>{if(!Un(c)||j.includes(c))return;const{mobileWorkspaceTabOrder:Y,mobileWorkspaceHiddenTabs:Pe}=qe.getState();f(vi(Y,Pe,j)[0])},[j,c]);const C=qe(Y=>Y.openGuestPageId),I=Sa().find(Y=>Y.id===C)??null;p.useEffect(()=>{C&&!I&&qe.getState().setOpenGuestPage(null)},[I,C]);const E=p.useCallback(()=>qe.getState().setOpenGuestPage(null),[]),z=qe(Y=>Y.setSettingsPage),P=Vs(Y=>Y.available),B=Vs(Y=>Y.runtimeType),$=p.useMemo(()=>rr(),[]),_=p.useCallback(()=>{o(null),m(null)},[]),D=p.useCallback(Y=>{o(Y)},[]),M=p.useCallback(()=>{u(false)},[]),H=p.useCallback(Y=>{S(Y),D("settings")},[D]);p.useEffect(()=>ty(Go,H),[H]);const{enabled:A,roomyForPanels:F,roomyForOnePanel:O}=Zi(),K=F||O,V=tf()==="portrait",J=sf(),[G,q]=p.useState(()=>{const Y=nf();return Y.roomyForPanels||Y.roomyForOnePanel}),U=p.useCallback(()=>{q(Y=>!Y)},[]),Z=p.useRef(A);p.useEffect(()=>{A?!Z.current&&!d&&q(true):q(false),Z.current=A},[A,d]);const te=p.useCallback(()=>{N(null),f("files"),u(true)},[]);p.useEffect(()=>Gr(Y=>{if(Y.type!=="file-open-request")return;const Pe=Y.directory??un.getState().currentDirectory;if(!Pe)return;const he=()=>{qe.getState().openContextFile(Pe,Y.path),te()},{sessionId:Ve}=Y;if(!Ve){he();return}Zb(Ve,async at=>Ns.getState().entityById.get(at)??await Di.getSession(at).catch(()=>null)).then(at=>{const pt=()=>{const{currentSessionId:Ye}=dt.getState();return Ye===Ve||at.some(ht=>ht.id===Ye)};if(pt()){he();return}const Qe=at[0]?.title;me.info(ey(Y.path),{id:`file-open-${Ve}:${Y.path}`,description:Qe?e("chat.fileOpenRequest.toast.description",{session:Qe}):e("chat.fileOpenRequest.toast.descriptionUntitled"),action:{label:e("chat.fileOpenRequest.toast.openSession"),onClick:()=>{rf(Ve,Pe),_(),a(false),pt()&&he()}}})})}),[_,te,e]),p.useEffect(()=>Gr(Y=>{if(Y.type!=="plan-open-request")return;const Pe=of(Y.directory??un.getState().currentDirectory,Y.projectId);Pe&&m({id:Y.planId,title:Y.title,projectRef:Pe})}),[]);const se=p.useCallback((Y=null)=>{N(Y?{diff:Y}:null),f("changes"),u(true)},[]);p.useEffect(()=>ac(Y=>{qe.getState().setOpenGuestPage(null),Y.tab==="changes"&&Y.commit&&N({commit:{scope:"commit",directory:Y.commit.directory}}),f(Y.tab),u(true)}),[]);const ie=Vo("left","openchamber.ipad.leftSidebarWidth",sx),ne=Vo("right","openchamber.ipad.rightSidebarWidth",nx,rx),ue=F||O,Q=p.useRef(null),re=p.useRef({sidebarOpen:G,workspaceOpen:d});p.useLayoutEffect(()=>{const Y=re.current;if(re.current={sidebarOpen:G,workspaceOpen:d},!O){const Ve=Q.current;Q.current=null,F&&Ve==="sidebar"?q(true):F&&Ve==="workspace"&&u(true);return}const Pe=G&&!Y.sidebarOpen,he=d&&!Y.workspaceOpen;if(G&&d){Pe&&!he?(Q.current="workspace",u(false)):(Q.current="sidebar",q(false));return}!d&&Y.workspaceOpen&&Q.current==="sidebar"?(Q.current=null,q(true)):!G&&Y.sidebarOpen&&Q.current==="workspace"&&(Q.current=null,u(true))},[O,F,G,d]);const le=Uo(A&&G),Ne=Uo(ue&&d),Le=O&&G,we=O&&d,Re=ue&&Ne.placed&&!Le?ne.width:0,ae=A&&le.placed&&!we?ie.width:0,ce=t==="rtl"?"100%":"-100%",Ee=t==="rtl"?"-100%":"100%";p.useEffect(()=>(qr.setState({left:ae,right:Re}),()=>qr.setState({left:0,right:0})),[ae,Re]),Wm(),p.useEffect(()=>{if(typeof document>"u")return;const Y=A&&(V||J),Pe=document.documentElement;return Pe.classList.toggle("oc-keep-draft-starters",Y),()=>Pe.classList.remove("oc-keep-draft-starters")},[J,A,V]);const Ie=p.useMemo(()=>({openChanges:({diffPath:Y,staged:Pe,scope:he}={})=>{se(Y?{path:Y,staged:Pe===true,scope:he}:null)},openFiles:()=>te(),openSourceBoard:()=>D("board"),openPlan:m,openReceivedPage:b}),[se,te,D]),ke=p.useMemo(()=>({openSessions:()=>{A?q(true):a(true)},openView:Y=>{if(Y==="files"){te();return}if(Y==="mcp"){f("status"),u(true);return}D(Y)},openChanges:({path:Y,staged:Pe}={})=>{se(Y?{path:Y,staged:Pe===true}:null)},openSettings:Y=>{Y&&z(Y),H(Y?"page-content":"nav")}}),[A,se,te,H,D,z]);Ky(ke);const Oe=p.useRef(null),Fe=()=>{A?q(true):a(true)},ut=()=>y();kr(Oe,{onLeftEdgeSwipe:t==="rtl"?ut:Fe,onRightEdgeSwipe:t==="rtl"?Fe:ut});const Ke=p.useRef(null),Be=p.useCallback(Y=>{Ke.current=Y},[]),He=p.useCallback(()=>af()?true:h?(b(null),true):g?(m(null),true):I?(E(),true):l==="settings"&&Ke.current?.()?true:l?(_(),true):d?(M(),true):i?(a(false),true):false,[l,E,_,M,I,g,h,i,d]);lf(He),cf(He,!!(g||h||I||l||d||i));const Je=!$&&P&&(B==="desktop"||B==="web"),$e=A?"dialog":"fullscreen",it=qe(Y=>Y.overviewFeatureAvailable),tt=p.useMemo(()=>({instanceLabel:$?Hs():null,onOpenInstances:$?()=>D("instances"):void 0,onOpenSettings:()=>H("nav"),onOpenUsage:()=>D("usage"),onOpenScheduled:()=>D("scheduled"),onOpenArchive:()=>D("archive"),onOpenOverview:it?()=>D("overview"):void 0,onOpenSourceBoard:()=>D("board"),onOpenUpdate:Je?()=>D("update"):void 0}),[H,D,it,$,Je]),ee=p.useCallback(Y=>{_(),a(false),Y==="file"&&te()},[_,te]),ge=p.useCallback(()=>{_(),a(false)},[_]),st=p.useCallback(()=>{_(),a(false),A&&!K&&q(false)},[_,A,K]),jt=p.useCallback(()=>{_(),a(false),A&&!K&&q(false)},[_,A,K]);return n.jsx(df,{actions:Ie,children:n.jsxs("div",{className:"oc-mobile-app-shell main-content-safe-area oc-side-safe-area flex h-[100dvh] flex-row bg-background text-foreground","data-page-scroll-lock":"true",children:[A?n.jsxs("aside",{ref:ie.asideRef,className:de("oc-ipad-sidebar relative flex h-full shrink-0 flex-col overflow-hidden"),style:{width:ae,minWidth:ae,maxWidth:ae,"--oc-ipad-sidebar-width":`${ie.width}px`,overflowX:"clip"},"aria-hidden":!G,"data-page-scroll-lock":"true",children:[n.jsx("div",{className:de("flex h-full shrink-0 flex-col border-e border-edge bg-background transition-[translate] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none",ie.isResizing&&"pointer-events-none",!G&&"pointer-events-none select-none"),style:{width:"var(--oc-ipad-sidebar-width)",overflowX:"hidden",paddingTop:"var(--oc-safe-area-top, 0px)",translate:le.inPlace?void 0:ce},children:n.jsx(St,{children:n.jsx(Ro,{open:le.placed,variant:"sidebar",onOpenChange:Y=>{!Y&&!K&&q(false)},footer:tt})})}),G?n.jsx(Ko,{side:"left",isResizing:ie.isResizing,ariaLabel:e("sidebar.resize.leftPanelAria"),handleProps:ie.handleProps}):null]}):null,n.jsxs("div",{className:"flex h-full min-w-0 flex-1 flex-col","data-page-scroll-lock":"true",children:[n.jsx(V1,{onOpenSessions:()=>A?U():a(true),onOpenWorkspace:y,compactTitle:A}),n.jsxs("main",{ref:Oe,className:"relative min-h-0 flex-1 overflow-hidden","data-page-scroll-lock":"true",children:[n.jsx("div",{className:"h-full w-full",children:n.jsx(St,{children:n.jsx($m,{})})}),n.jsx(St,{children:n.jsx(Zm,{})})]})]}),A?null:n.jsx(Ro,{open:i,onOpenChange:a,footer:tt}),n.jsxs("aside",{ref:ne.asideRef,className:de("relative flex h-full shrink-0 flex-col overflow-hidden"),style:{width:Re,minWidth:Re,maxWidth:Re,"--oc-ipad-sidebar-width":`${ne.width}px`,overflowX:"clip"},"aria-hidden":!Re,"data-page-scroll-lock":"true",children:[n.jsx("div",{className:de("flex h-full min-h-0 shrink-0 flex-col transition-[translate] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none",ue&&"border-s border-edge bg-background",ne.isResizing&&"pointer-events-none",!Ne.inPlace&&"pointer-events-none select-none"),style:{width:"var(--oc-ipad-sidebar-width)",overflowX:"hidden",paddingTop:"var(--oc-safe-area-top, 0px)",translate:Ne.inPlace?void 0:Ee},children:n.jsx(St,{children:n.jsx(Cy,{open:ue?Ne.placed:d,onClose:M,tab:c,onTabChange:f,pendingChangesDiff:R,pendingChangesCommit:T,onOpenPlan:m,onOpenReceivedPage:b,variant:ue?"panel":"drawer"})})}),ue&&d?n.jsx(Ko,{side:"right",isResizing:ne.isResizing,ariaLabel:e("sidebar.resize.rightPanelAria"),handleProps:ne.handleProps}):null]}),g?n.jsx(ms,{open:true,variant:$e,onClose:()=>m(null),ariaLabel:g.title,title:g.title,children:n.jsx(St,{children:n.jsx(Jm,{savedProjectPlan:{projectRef:g.projectRef,planId:g.id},onClose:()=>m(null),onNavigatedToChat:()=>{_(),M()}})})}):null,h?n.jsx(ms,{open:true,variant:$e,onClose:()=>b(null),ariaLabel:h.title,title:h.title,children:n.jsx(St,{children:n.jsx(Km,{receivedId:h.receivedId,onAddedToChat:()=>{cn.flushSync(()=>{b(null),M()});const Y=document.querySelector('[data-composer-morph-prompt="true"]');Y?Y.click():uf()}})})}):null,I?n.jsx(ms,{open:true,variant:$e,dialogAlign:"app",onClose:E,ariaLabel:I.pageTitle??I.name,title:I.pageTitle??I.name,disableEscapeDismiss:true,children:n.jsx(St,{children:n.jsx(p.Suspense,{fallback:null,children:n.jsx(cx,{mode:Xo(I.id),surface:"page"},I.id)})})}):null,n.jsx(St,{children:n.jsx(ff,{})}),l==="instances"&&$?n.jsx(ms,{open:true,variant:$e,dialogAlign:"app",onClose:_,ariaLabel:e("mobile.menu.instances"),title:e("mobile.menu.instances"),children:n.jsx(Y1,{onConnect:_,onActiveConnectionDeleted:s})}):null,l==="settings"?n.jsx(ms,{open:true,variant:$e,dialogAlign:"app",onClose:_,ariaLabel:e("mobile.menu.settings"),headerless:true,children:n.jsx(St,{children:n.jsx(Gm,{forceMobile:true,isWindowed:true,initialMobileStage:v,registerBackHandler:Be,visiblePageSlugs:[...Go],onClose:_})})}):null,l==="usage"?n.jsx(ms,{open:true,variant:$e,dialogAlign:"app",onClose:_,ariaLabel:e("usageStats.title"),title:e("usageStats.title"),children:n.jsx(St,{children:n.jsx(Np,{})})}):null,l==="scheduled"?n.jsx(ms,{open:true,variant:$e,dialogAlign:"app",onClose:_,ariaLabel:e("sessions.scheduledTasks.dialog.title"),title:e("sessions.scheduledTasks.dialog.title"),children:n.jsx(St,{children:n.jsx(Ep,{layout:"mobile",onLeave:ee})})}):null,l==="board"?n.jsx(ms,{open:true,variant:$e,dialogAlign:"app",onClose:_,ariaLabel:e("sourceBoard.title"),headerless:true,children:n.jsx(St,{children:n.jsx(Ip,{onLeave:ge,onClose:_})})}):null,l==="overview"&&it?n.jsx(ms,{open:true,variant:$e,dialogAlign:"app",onClose:_,ariaLabel:e("overview.title"),title:e("overview.title"),children:n.jsx(St,{children:n.jsx(Pp,{layout:"mobile",onLeave:st})})}):null,l==="archive"?n.jsx(ms,{open:true,variant:$e,dialogAlign:"app",onClose:_,ariaLabel:e("sessions.archivePage.title"),title:e("sessions.archivePage.title"),children:n.jsx(St,{children:n.jsx(Rp,{layout:"mobile",onLeave:jt})})}):null,l==="update"?n.jsx(ms,{open:true,variant:$e,dialogAlign:"app",onClose:_,ariaLabel:e("mobile.menu.update"),title:e("mobile.menu.update"),children:n.jsx(St,{children:n.jsx(bs,{outerClassName:"h-full",className:"px-5 py-4",disableHorizontal:true,children:n.jsx(qm,{initialUpdateDialogOpen:true})})})}):null]})})};function ux(s){const e=oe.c(143),{apis:t}=s,i=qe(zx),{t:a}=be(),r=ns(Fx),l=ns(Bx),o=ns(Lx),d=ns(Mx),u=ns(Ox),c=ns(Dx),f=ns(Ax),y=ns(_x),g=un(Tx),m=dt(Ex),h=dt(Px),b=qe(Ix),v=Wi(Rx),S=rc(Nx),w=Ns(Cx);let N;e[0]!==w?(N=w??[],e[0]=w,e[1]=N):N=e[1];const R=N,T=w!=null;let j;e[2]!==R||e[3]!==T?(j={hasAuthoritativeGlobalSessions:T,sessions:R},e[2]=R,e[3]=T,e[4]=j):j=e[4],vm(j);const[C,k]=p.useState(0),[I,E]=p.useState(0),[z,P]=p.useState(false),[B,$]=p.useState("pending"),[_,D]=p.useState(null);let M;e[5]===Symbol.for("react.memo_cache_sentinel")?(M=Hs(),e[5]=M):M=e[5];const H=M,[,A]=p.useReducer(kx,0);let F;e[6]===Symbol.for("react.memo_cache_sentinel")?(F=rr(),e[6]=F):F=e[6];const O=F,K=p.useRef(0),L=p.useRef(0);let V;e[7]!==c||e[8]!==t.sourceControl||e[9]!==t.trackers||e[10]!==r||e[11]!==y||e[12]!==f||e[13]!==u||e[14]!==v||e[15]!==S?(V=()=>{const pe=ps(),ye=L.current+1;if(L.current=ye,!pe){In("resume:auto-connect",{}),Pn();return}In("resume:reprobe",{});const _e=()=>{r(),S(t.sourceControl),v(t.sourceControl,{force:true}),Ur(t.trackers),u===0&&f({source:"mobileApp:nativeResume"}),c===0&&y({source:"mobileApp:nativeResume"})},Ce=et=>{In("resume:disconnect",{reason:et}),tn({apiBaseUrl:"",clientToken:null,runtimeKey:$n}),k(jx)};Jn().then(et=>{if(L.current===ye){if(et==="no-connection"){Ce("no-connection");return}if(et==="needs-login"){D({kind:"auth-expired",label:Hs()??""}),Ce("needs-login");return}if(et==="relay-limit"){D({kind:"relay-limit",label:Hs()??""}),Ce("relay-limit");return}if(et==="unreachable"){const Wt=[4e3,1e4],Ot=Ue=>{window.setTimeout(()=>{if(L.current!==ye)return;const At=Ue===Wt.length-1;Jn({fast:!At}).then(bt=>{if(L.current===ye&&bt!=="switched"){if(bt==="unchanged"){_e();return}if(bt==="needs-login"){D({kind:"auth-expired",label:Hs()??""}),Ce("retry-needs-login");return}if(bt==="relay-limit"){D({kind:"relay-limit",label:Hs()??""}),Ce("retry-relay-limit");return}if(!At){Ot(Ue+1);return}Ce(`retry-${bt}`)}})},Wt[Ue])};Ot(0);return}et!=="switched"&&_e()}});const Ae=Date.now();Ae-K.current>=lx&&(K.current=Ae,window.dispatchEvent(new Event("openchamber:system-resume")))},e[7]=c,e[8]=t.sourceControl,e[9]=t.trackers,e[10]=r,e[11]=y,e[12]=f,e[13]=u,e[14]=v,e[15]=S,e[16]=V):V=e[16];const J=V;Bu(),Fu(J);let G,q;e[17]!==J?(G=()=>{if(!O)return;let pe;const ye=()=>{window.clearTimeout(pe),pe=window.setTimeout(()=>J(),1500)};return window.addEventListener("online",ye),()=>{window.removeEventListener("online",ye),window.clearTimeout(pe)}},q=[O,J],e[17]=J,e[18]=G,e[19]=q):(G=e[18],q=e[19]),p.useEffect(G,q);let U,Z;e[20]!==J?(Z=()=>{if(O)return Mr.subscribe((pe,ye)=>{pe.state==="expired"&&ye.state!=="expired"&&(J(),Mr.getState().markAuthenticated())})},U=[O,J],e[20]=J,e[21]=U,e[22]=Z):(U=e[21],Z=e[22]),p.useEffect(Z,U);let te,se;e[23]!==J?(te=()=>{if(O)return oc(pe=>{ni(pe)&&J()})},se=[O,J],e[23]=J,e[24]=te,e[25]=se):(te=e[24],se=e[25]),p.useEffect(te,se);let ie,ne;e[26]!==t?(ie=()=>(ea(t),Sx),ne=[t],e[26]=t,e[27]=ie,e[28]=ne):(ie=e[27],ne=e[28]),p.useEffect(ie,ne);let ue;e[29]!==A?(ue=()=>Zo(pe=>{if(In("endpoint:changed",{runtimeKey:pe.runtimeKey||"none",previousRuntimeKey:pe.previousRuntimeKey||"none",connected:!!pe.apiBaseUrl}),!!pe.runtimeKey&&pe.runtimeKey===pe.previousRuntimeKey){Tm(),A();return}_m(pe),E(wx),k(vx)}),e[29]=A,e[30]=ue):ue=e[30];let Q;e[31]===Symbol.for("react.memo_cache_sentinel")?(Q=[],e[31]=Q):Q=e[31],p.useEffect(ue,Q);let re;e[32]!==o?(re=()=>{if(!O||o||ps()){$("done");return}let pe=false;return $("attempting"),(async()=>{const ye=await Pn().catch(xx);pe||(ye.status==="unreachable"||ye.status==="relay-limit"?D({kind:ye.status,label:ye.label}):ye.status==="needs-login"&&D({kind:"auth-expired",label:ye.label}),$("done"),ye.status==="unreachable"&&Pn({fast:false,skipIfConnected:true}).catch(yx))})(),()=>{pe=true}},e[32]=o,e[33]=re):re=e[33];let le;e[34]===Symbol.for("react.memo_cache_sentinel")?(le=[],e[34]=le):le=e[34],p.useEffect(re,le);let Ne,Le;e[35]===Symbol.for("react.memo_cache_sentinel")?(Ne=()=>{if(!O||!ps())return;let pe=false;const ye=_e=>{In("cold-launch:drop",{kind:_e?.kind??"unknown"}),_e&&D(_e),tn({apiBaseUrl:"",clientToken:null,runtimeKey:$n}),k(bx)};return Jn().then(async _e=>{if(pe||_e==="switched"||_e==="unchanged")return;const Ce=Hs();if(_e==="needs-login"){ye({kind:"auth-expired",label:Ce??""});return}if(_e==="unreachable"){ye(Ce?{kind:"unreachable",label:Ce}:null),Pn({fast:false,skipIfConnected:true}).catch(gx);return}if(_e==="relay-limit"){ye({kind:"relay-limit",label:Ce??""});return}const Ae=await Pn().catch(hx);pe||Ae.status==="connected"||(Ae.status==="needs-login"?ye({kind:"auth-expired",label:Ae.label}):Ae.status==="unreachable"||Ae.status==="relay-limit"?ye({kind:Ae.status,label:Ae.label}):ye(null))}),()=>{pe=true}},Le=[],e[35]=Ne,e[36]=Le):(Ne=e[35],Le=e[36]),p.useEffect(Ne,Le);let we,Re;e[37]!==b?(we=()=>{b(true)},Re=[b],e[37]=b,e[38]=we,e[39]=Re):(we=e[38],Re=e[39]),p.useEffect(we,Re);let ae;e[40]!==r?(ae=()=>{O&&!ps()||r()},e[40]=r,e[41]=ae):ae=e[41];let ce;e[42]!==C||e[43]!==r?(ce=[C,r,O],e[42]=C,e[43]=r,e[44]=ce):ce=e[44],p.useEffect(ae,ce);let Ee,Ie;e[45]!==c||e[46]!==o||e[47]!==y||e[48]!==f||e[49]!==u?(Ee=()=>{o&&(u===0&&f({source:"mobileApp:recovery"}),c===0&&y({source:"mobileApp:recovery"}))},Ie=[c,o,y,f,u],e[45]=c,e[46]=o,e[47]=y,e[48]=f,e[49]=u,e[50]=Ee,e[51]=Ie):(Ee=e[50],Ie=e[51]),p.useEffect(Ee,Ie);const ke=p.useRef(false),[Oe,Fe]=p.useState(O);let ut;e[52]!==o?(ut=()=>{if(!O||!o||ke.current)return;let pe=false;const ye=window.setTimeout(()=>Fe(false),6e3),_e=Am({selectNow:true,refresh:true}),Ce=()=>{dt.getState().currentSessionId&&Fe(false)},Ae=dt.subscribe(Ce);return Ce(),(async()=>{const et=await _e();pe||(et!=="failed"&&(ke.current=true),Fe(false))})(),()=>{pe=true,Ae(),window.clearTimeout(ye)}},e[52]=o,e[53]=ut):ut=e[53];let Ke;e[54]!==C||e[55]!==o?(Ke=[C,o,O],e[54]=C,e[55]=o,e[56]=Ke):Ke=e[56],p.useEffect(ut,Ke);let Be,He;e[57]!==g||e[58]!==o?(Be=()=>{o&&Di.setDirectory(g)},He=[g,o],e[57]=g,e[58]=o,e[59]=Be,e[60]=He):(Be=e[59],He=e[60]),p.useEffect(Be,He);let Je,$e;e[61]!==t.sourceControl||e[62]!==t.trackers||e[63]!==o||e[64]!==v||e[65]!==S?(Je=()=>{o&&(S(t.sourceControl),v(t.sourceControl,{force:true}),Ur(t.trackers))},$e=[t.sourceControl,t.trackers,o,v,S],e[61]=t.sourceControl,e[62]=t.trackers,e[63]=o,e[64]=v,e[65]=S,e[66]=Je,e[67]=$e):(Je=e[66],$e=e[67]),p.useEffect(Je,$e);let it,tt;e[68]!==h||e[69]!==m?(it=()=>{if(!m)return;const pe=window.setTimeout(()=>h(),5e3);return()=>window.clearTimeout(pe)},tt=[h,m],e[68]=h,e[69]=m,e[70]=it,e[71]=tt):(it=e[70],tt=e[71]),p.useEffect(it,tt);let ee;e[72]!==o?(ee=()=>{if(!(!o&&(O?!!ps():true))){P(false);return}const ye=window.setTimeout(()=>{P(true)},O?4e3:8e3);return()=>window.clearTimeout(ye)},e[72]=o,e[73]=ee):ee=e[73];let ge;e[74]!==C||e[75]!==o||e[76]!==I?(ge=[o,O,C,I],e[74]=C,e[75]=o,e[76]=I,e[77]=ge):ge=e[77],p.useEffect(ee,ge),zu();let st;e[78]===Symbol.for("react.memo_cache_sentinel")?(st={enabled:true},e[78]=st):st=e[78],Wu(st),wm(),$u(),Ku(),Sm(),jm(t.sourceControl),km(t.trackers),Cm(),Nm(),Rm(),Im(),Pm(g||null),Em();const jt=O&&o;let Y;e[79]!==jt?(Y={enabled:jt},e[79]=jt,e[80]=Y):Y=e[80],Jy(Y);const Pe=O&&o&&l;let he;e[81]!==Pe?(he={enabled:Pe},e[81]=Pe,e[82]=he):he=e[82],tx(he);const Ve=O&&o&&l;let ft;e[83]!==Ve?(ft={ready:Ve},e[83]=Ve,e[84]=ft):ft=e[84],Hy(ft);const at=Ny(),pt=!o&&d==="reconnecting";if(!at){let pe;return e[85]===Symbol.for("react.memo_cache_sentinel")?(pe=n.jsx("main",{className:"flex min-h-dvh items-center justify-center bg-[var(--splash-background,var(--surface-background))] text-foreground",children:n.jsx(sn,{width:120,height:120,isAnimated:true,variant:"splash"})}),e[85]=pe):pe=e[85],pe}const Qe=!!ps();if(O&&(!Qe||!o&&!pt)){if(Qe){const _e=!z;let Ce;e[86]!==_e?(Ce=n.jsx(sn,{width:120,height:120,isAnimated:_e,variant:"splash"}),e[86]=_e,e[87]=Ce):Ce=e[87];let Ae;e[88]!==z||e[89]!==a?(Ae=z?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("h1",{className:"typography-h3 text-foreground",children:a("sessionAuth.error.networkTitle")}),n.jsx("p",{className:"typography-markdown text-muted-foreground",children:a("mobile.connect.recovery.description")})]}),n.jsx(ze,{type:"button",variant:"outline",onClick:()=>{tn({apiBaseUrl:"",clientToken:null,runtimeKey:$n}),k(px)},children:a("mobile.connect.cancelPassword")})]}):null,e[88]=z,e[89]=a,e[90]=Ae):Ae=e[90];let et;return e[91]!==Ce||e[92]!==Ae?(et=n.jsx("main",{className:"flex min-h-dvh items-center justify-center bg-[var(--splash-background,var(--surface-background))] px-6 text-center text-foreground",children:n.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-4",children:[Ce,Ae]})}),e[91]=Ce,e[92]=Ae,e[93]=et):et=e[93],et}if(B!=="done"){let _e;e[94]===Symbol.for("react.memo_cache_sentinel")?(_e=n.jsx(sn,{width:120,height:120,isAnimated:true,variant:"splash"}),e[94]=_e):_e=e[94];let Ce;e[95]!==a?(Ce=H?n.jsxs("div",{className:"absolute inset-x-0 top-[calc(50%+84px)] flex flex-col items-center gap-0.5 px-6 text-center",children:[n.jsx("p",{className:"typography-small text-muted-foreground",children:a("mobile.connect.splash.connectingTo")}),n.jsxs("p",{className:"typography-small text-foreground",children:[H,n.jsx(Hu,{})]})]}):null,e[95]=a,e[96]=Ce):Ce=e[96];let Ae;return e[97]!==Ce?(Ae=n.jsxs("main",{className:"relative flex min-h-dvh items-center justify-center bg-[var(--splash-background,var(--surface-background))] text-foreground",children:[_e,Ce]}),e[97]=Ce,e[98]=Ae):Ae=e[98],Ae}let pe;e[99]===Symbol.for("react.memo_cache_sentinel")?(pe=()=>k(mx),e[99]=pe):pe=e[99];let ye;return e[100]!==_?(ye=n.jsx(n.Fragment,{children:n.jsx(P1,{onConnected:pe,notice:_})}),e[100]=_,e[101]=ye):ye=e[101],ye}if(!o&&!pt){if(!z){let et;return e[102]===Symbol.for("react.memo_cache_sentinel")?(et=n.jsx("main",{className:"flex min-h-dvh items-center justify-center bg-[var(--splash-background,var(--surface-background))] text-foreground",children:n.jsx(sn,{width:120,height:120,isAnimated:true,variant:"splash"})}),e[102]=et):et=e[102],et}let pe;e[103]!==a?(pe=a("sessionAuth.error.networkTitle"),e[103]=a,e[104]=pe):pe=e[104];let ye;e[105]!==pe?(ye=n.jsx("h1",{className:"typography-h3 text-foreground",children:pe}),e[105]=pe,e[106]=ye):ye=e[106];let _e;e[107]!==a?(_e=a("sessionAuth.error.networkDescription"),e[107]=a,e[108]=_e):_e=e[108];let Ce;e[109]!==_e?(Ce=n.jsx("p",{className:"typography-markdown text-muted-foreground",children:_e}),e[109]=_e,e[110]=Ce):Ce=e[110];let Ae;return e[111]!==ye||e[112]!==Ce?(Ae=n.jsx("main",{className:"flex min-h-dvh items-center justify-center bg-background px-6 text-center text-foreground",children:n.jsxs("div",{className:"max-w-sm space-y-3",children:[ye,Ce]})}),e[111]=ye,e[112]=Ce,e[113]=Ae):Ae=e[113],Ae}let Ye;e[114]===Symbol.for("react.memo_cache_sentinel")?(Ye=Di.getSdkClient(),e[114]=Ye):Ye=e[114];const ht=g||"",rt=!O||!Oe;let mt;e[115]!==rt?(mt=n.jsx(Dm,{ready:rt,animated:true}),e[115]=rt,e[116]=mt):mt=e[116];let Se;e[117]!==l?(Se=n.jsx(Vu,{backgroundWorkEnabled:l}),e[117]=l,e[118]=Se):Se=e[118];let ot,Ze;e[119]===Symbol.for("react.memo_cache_sentinel")?(ot=n.jsx(Om,{}),Ze=n.jsx(jh,{}),e[119]=ot,e[120]=Ze):(ot=e[119],Ze=e[120]);let xt,vt,lt,De,gt;e[121]===Symbol.for("react.memo_cache_sentinel")?(xt=n.jsx(dx,{onActiveConnectionDeleted:()=>{f1(),tn({apiBaseUrl:"",clientToken:null,runtimeKey:$n}),k(fx)}}),vt=n.jsx(Uu,{}),lt=n.jsx(Gu,{}),De=n.jsx(qu,{}),gt=n.jsx(Ju,{}),e[121]=xt,e[122]=vt,e[123]=lt,e[124]=De,e[125]=gt):(xt=e[121],vt=e[122],lt=e[123],De=e[124],gt=e[125]);let wt;e[126]!==i?(wt=i?n.jsxs(n.Fragment,{children:[n.jsx(Ym,{}),n.jsx(Mm,{}),n.jsx(Xm,{}),n.jsx(Lm,{}),n.jsx(Qm,{})]}):null,e[126]=i,e[127]=wt):wt=e[127];let We;e[128]===Symbol.for("react.memo_cache_sentinel")?(We=n.jsx(Eh,{}),e[128]=We):We=e[128];let ct;e[129]!==l?(ct=l?n.jsx(Bm,{}):null,e[129]=l,e[130]=ct):ct=e[130];let Me;e[131]!==mt||e[132]!==Se||e[133]!==wt||e[134]!==ct?(Me=n.jsx(Yu,{delayDuration:300,skipDelayDuration:150,children:n.jsxs("div",{className:"h-full bg-background text-foreground",children:[mt,Se,ot,Ze,xt,vt,lt,De,gt,wt,We,ct]})}),e[131]=mt,e[132]=Se,e[133]=wt,e[134]=ct,e[135]=Me):Me=e[135];let Dt;e[136]!==t||e[137]!==Me?(Dt=n.jsx(Xu,{apis:t,children:Me}),e[136]=t,e[137]=Me,e[138]=Dt):Dt=e[138];let nt;return e[139]!==I||e[140]!==ht||e[141]!==Dt?(nt=n.jsx(St,{children:n.jsx(Qu,{sdk:Ye,directory:ht,children:Dt},I)}),e[139]=I,e[140]=ht,e[141]=Dt,e[142]=nt):nt=e[142],nt}function fx(s){return s+1}function mx(s){return s+1}function px(s){return s+1}function hx(){return{status:"no-candidate"}}function gx(){return null}function bx(s){return s+1}function yx(){return null}function xx(){return{status:"no-candidate"}}function vx(s){return s+1}function wx(s){return s+1}function Sx(){return ea(null)}function jx(s){return s+1}function kx(s){return s+1}function Cx(s){return s.authoritativeSessions}function Nx(s){return s.refresh}function Rx(s){return s.refreshAll}function Ix(s){return s.setIsMobile}function Px(s){return s.clearError}function Ex(s){return s.error}function Tx(s){return s.currentDirectory}function _x(s){return s.loadAgents}function Ax(s){return s.loadProviders}function Dx(s){return s.agents.length}function Ox(s){return s.providers.length}function Mx(s){return s.connectionPhase}function Lx(s){return s.isConnected}function Bx(s){return s.isInitialized}function Fx(s){return s.initializeApp}function zx(s){return s.isolatedSpacesEnabled}function Wx(s){const e=oe.c(7),t=p.useSyncExternalStore($x,ps,ps);let i;e[0]!==t?(i=!rr()||!!t,e[0]=t,e[1]=i):i=e[1];let a;e[2]!==s?(a=n.jsx(ux,{...s}),e[2]=s,e[3]=a):a=e[3];let r;return e[4]!==i||e[5]!==a?(r=n.jsx(Fm,{enabled:i,children:a}),e[4]=i,e[5]=a,e[6]=r):r=e[6],r}function $x(s){return Zo(()=>s())}function vS(s){window.__OPENCHAMBER_SURFACE__="mobile",mf(),Um({logLabel:"[mobile-main]",onAppearanceSettled:gh}),Sh(),pf();const e=document.getElementById("root");if(!e)throw new Error("Root element not found");const i=window.Capacitor?.isNativePlatform?.()===true||window.location.protocol==="capacitor:",a=i?{...s,notifications:{notifyAgentCompletion:async()=>false,canNotify:()=>false}}:s,r=n.jsx(Vm,{children:n.jsx(Wx,{apis:a})});Ll.createRoot(e).render(n.jsx(Ai.StrictMode,{children:n.jsx(hf,{children:n.jsx(gf,{children:n.jsx(bf,{children:n.jsx(Hm,{children:i?r:n.jsx(yf,{children:r})})})})})}))}export{vS as renderMobileApp};
|