@openchamber/web 2.6.0 → 2.6.1-canary.20261102.3
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-DBDN-gwQ.js → AboutDialog-BTYnMXM0.js} +1 -1
- package/dist/assets/{AboutLogo-BP87552a.js → AboutLogo-BwyB9sbV.js} +1 -1
- package/dist/assets/{ArchiveView-GN7gU2qK.js → ArchiveView-BsWIv-C4.js} +1 -1
- package/dist/assets/{ChangeRequestDiffUnavailable-B28oeUds.js → ChangeRequestDiffUnavailable-ED92kmXz.js} +1 -1
- package/dist/assets/{ChangedPathLabel-DV4XTf6K.js → ChangedPathLabel-7Zbbq-FE.js} +1 -1
- package/dist/assets/{CommandPalette-Dvsy8IHV.js → CommandPalette-CLlDfj5e.js} +1 -1
- package/dist/assets/{DiffView-BXm5iGeW.js → DiffView-CQOHl1hv.js} +1 -1
- package/dist/assets/{FilesView-CAXuJLle.js → FilesView-D00Dnc8i.js} +1 -1
- package/dist/assets/{GitView-D29soKpK.js → GitView-Z4zWCBn1.js} +1 -1
- package/dist/assets/{GuestSurfacePane-Dw0Um8RG.js → GuestSurfacePane-OM2GGOiX.js} +1 -1
- package/dist/assets/{HelpDialog-DuO4UnZT.js → HelpDialog-DNqqtAW-.js} +1 -1
- package/dist/assets/{IntegrationsCatalogView-BrLbP8hQ.js → IntegrationsCatalogView-C4-oLIEz.js} +1 -1
- package/dist/assets/{JsonTreeView-ZZKmvRSL.js → JsonTreeView-Bw8E9Koo.js} +1 -1
- package/dist/assets/{MarkdownDiffPreview-DuH8ODuS.js → MarkdownDiffPreview-CaG-F6-b.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-DNGYmQPH.js → MarkdownRendererImpl-Cd3zotqp.js} +3 -3
- package/dist/assets/{MemoryDebugPanel-C7shSvtT.js → MemoryDebugPanel-DzMnnl_P.js} +1 -1
- package/dist/assets/{NoteEditor-Ba3KW2rV.js → NoteEditor-DWNlP4dC.js} +1 -1
- package/dist/assets/{OnboardingScreen-CIyOLCq2.js → OnboardingScreen-DZVhaQUC.js} +1 -1
- package/dist/assets/{OpenCodeStatusDialog-ByN8gJ51.js → OpenCodeStatusDialog-BgseXyBy.js} +1 -1
- package/dist/assets/{OverviewView-B6SMyBTp.js → OverviewView-CohMMobq.js} +1 -1
- package/dist/assets/{PatchDiff-C8jKkgEf.js → PatchDiff-DGB_PTLK.js} +1 -1
- package/dist/assets/{PlanView-NMKJpsCH.js → PlanView-pwTIoUJK.js} +1 -1
- package/dist/assets/{ProjectActionsDialog-Ctr7-_lb.js → ProjectActionsDialog-C3rXp1WV.js} +1 -1
- package/dist/assets/{ReplyUiBlock-C-C95eJ_.js → ReplyUiBlock-B1NgzCEP.js} +1 -1
- package/dist/assets/{RunOverview-DNSvGB7-.js → RunOverview-BqmEhK3a.js} +1 -1
- package/dist/assets/{ScheduledTasksDialog-BNXOjpPY.js → ScheduledTasksDialog-CXyiyIDe.js} +1 -1
- package/dist/assets/{SettingsView-ug8Oinyr.js → SettingsView-D7mytSZv.js} +1 -1
- package/dist/assets/{SettingsWindow-CKUU5T8p.js → SettingsWindow-CnjurTti.js} +1 -1
- package/dist/assets/{SidebarSectionsManager-DWJwQwVi.js → SidebarSectionsManager-D1hsBI-4.js} +1 -1
- package/dist/assets/{SourceBoardView-BQittQF3.js → SourceBoardView-BoMdMgmW.js} +1 -1
- package/dist/assets/{SpaceAccessDialog-CeZrOBod.js → SpaceAccessDialog-q5blJXG5.js} +1 -1
- package/dist/assets/{SpaceApplyDialog-DurN0_0Z.js → SpaceApplyDialog-Csq1Z7zY.js} +1 -1
- package/dist/assets/{SpaceRow-BkgNrW0R.js → SpaceRow-BvJCw88e.js} +1 -1
- package/dist/assets/{SpaceSetupOutput-BDkJcYrl.js → SpaceSetupOutput-Bzeasxqg.js} +1 -1
- package/dist/assets/{SpacesView-D6UCwVZp.js → SpacesView-DNI1yLAG.js} +1 -1
- package/dist/assets/{SubmoduleDiffSummary-BK5RTTC4.js → SubmoduleDiffSummary-B3CnCMwZ.js} +1 -1
- package/dist/assets/{ToolOutputDialog-CAenoFSA.js → ToolOutputDialog-inRAtLLn.js} +1 -1
- package/dist/assets/{ToolPartDiffPreview-CdjYwDyA.js → ToolPartDiffPreview-CJneViW_.js} +1 -1
- package/dist/assets/{UiBlock-t2ea_iLd.js → UiBlock-ChJiwt5R.js} +1 -1
- package/dist/assets/{UsageStatsView-D2AXngeb.js → UsageStatsView-CWV-BYPI.js} +1 -1
- package/dist/assets/{Virtualizer-V759EvEY.js → Virtualizer-BOHERqLh.js} +1 -1
- package/dist/assets/{WalkthroughView-CiQk4Tg_.js → WalkthroughView-BnT4-pMh.js} +1 -1
- package/dist/assets/{WorktreesView-Bmnk7eXM.js → WorktreesView-D_VUAXdo.js} +1 -1
- package/dist/assets/{appThemeRegistry-D4EuLaGF.js → appThemeRegistry-BBiQjAje.js} +1 -1
- package/dist/assets/{ar-9I6l4EAU.js → ar-BXROvDU9.js} +1 -1
- package/dist/assets/{codeHighlight-DD239VMc.js → codeHighlight-CJBps6zM.js} +1 -1
- package/dist/assets/{computeVirtualFileMetrics-BhVDZ-oP.js → computeVirtualFileMetrics-CXGHe7T5.js} +2 -2
- package/dist/assets/{contextFileOpenGuard-D9Z0ay-I.js → contextFileOpenGuard-Cp662aS-.js} +1 -1
- package/dist/assets/{date-time-DlgUVVwY.js → date-time-C4F_nWqa.js} +1 -1
- package/dist/assets/{de-CPlTX8kA.js → de-nCDq_bQg.js} +1 -1
- package/dist/assets/{es-BMaNboo9.js → es-CvZecQ0j.js} +1 -1
- package/dist/assets/{fileContentPoller-paKtimZt.js → fileContentPoller-D0GhYhQ3.js} +1 -1
- package/dist/assets/{flexokiTheme-Bv37aHkq.js → flexokiTheme-Df4MxCkn.js} +1 -1
- package/dist/assets/{fr-onOdSl19.js → fr-DzrngSh8.js} +1 -1
- package/dist/assets/{he-CgCCGzpX.js → he-uZ2JD0ys.js} +1 -1
- package/dist/assets/{highlights-ByNnuo4t.js → highlights-gD3Zrhb_.js} +1 -1
- package/dist/assets/{index-BKnb59RH.js → index-BNAoU1SB.js} +1 -1
- package/dist/assets/{initializeSharedPreferences-CFrNmgg0.js → initializeSharedPreferences-Cb-QZ9nO.js} +1 -1
- package/dist/assets/{install-EEjacdUD.js → install-BjzS6Z-p.js} +1 -1
- package/dist/assets/{isDiffPlainText-DUd8YJX0.js → isDiffPlainText-SBv5bM8c.js} +1 -1
- package/dist/assets/{isFilePlainText-BqR4iT-Y.js → isFilePlainText-QNmxHtqN.js} +1 -1
- package/dist/assets/{ja-CYYy1_I8.js → ja-CADF0HeI.js} +1 -1
- package/dist/assets/{katex.min-BBVkbKQY.js → katex.min-BCtkGOiC.js} +4 -4
- package/dist/assets/{ko-CupS3Elm.js → ko-BLGJMTce.js} +1 -1
- package/dist/assets/{main-B3MbWk_e.js → main-BAWvOAbS.js} +2 -2
- package/dist/assets/{main-Kwo8IqqZ.js → main-my1cVcab.js} +4 -4
- package/dist/assets/{miniChat-DelNi_yP.js → miniChat-C80tea9b.js} +2 -2
- package/dist/assets/{mobile-BIso4MdY.js → mobile-Bw86MtWV.js} +2 -2
- package/dist/assets/{nl-Di3GhSHB.js → nl-ClP-S61w.js} +1 -1
- package/dist/assets/{pageTitle-BL2yQcTV.js → pageTitle-Cph9nb1O.js} +1 -1
- package/dist/assets/{parseDiffFromFile-31PZ3lnE.js → parseDiffFromFile-Yp9eHLcj.js} +1 -1
- package/dist/assets/{pierreDiffTint-igvBfgMB.js → pierreDiffTint-CFyG2F44.js} +1 -1
- package/dist/assets/{pl-DEy-fwio.js → pl-LChBHlUo.js} +1 -1
- package/dist/assets/{pt-BR-Cqzgn2Hs.js → pt-BR-CV84EAxr.js} +1 -1
- package/dist/assets/{relocateRestoredSession-CGvQdGRX.js → relocateRestoredSession-gkROUapx.js} +2 -2
- package/dist/assets/{renderElectronMiniChatApp-hBJHkIHQ.js → renderElectronMiniChatApp-CJN6HCUs.js} +2 -2
- package/dist/assets/{renderMarkdownForExport-DWj11Yob.js → renderMarkdownForExport-BPMLtJlQ.js} +1 -1
- package/dist/assets/{renderMobileApp-Bzps4LvM.js → renderMobileApp-Cuc-A8vm.js} +3 -3
- package/dist/assets/{resolveLanguages-DHAaVkki.js → resolveLanguages-UhQ_Qm0O.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-BPYbd6uu.js → runtimeEndpointReset-CMO7G_Ff.js} +5 -5
- package/dist/assets/{scheduledTasksApi-D6FhT0TU.js → scheduledTasksApi-Mn2aZ7Rl.js} +1 -1
- package/dist/assets/{shiki-y7boL955.js → shiki-B7QfMAec.js} +1 -1
- package/dist/assets/{space-apply-9idN6j4k.js → space-apply-CNISDYMA.js} +1 -1
- package/dist/assets/{space-close-CjDS5mSo.js → space-close-C4pr8Kt0.js} +1 -1
- package/dist/assets/{spaceNetwork-DeZE7V6c.js → spaceNetwork-DUg5u0h8.js} +1 -1
- package/dist/assets/{stream-tokenizer-UaU7yP0V.js → stream-tokenizer-CSMIYyXj.js} +1 -1
- package/dist/assets/{textMateThemeFromAppTheme-fsNcE7v2.js → textMateThemeFromAppTheme-CbTfkuJp.js} +1 -1
- package/dist/assets/{tr-DL0uHNVd.js → tr-BXliZ8MC.js} +1 -1
- package/dist/assets/{uk-qdUsCGYW.js → uk-CxABjNd2.js} +1 -1
- package/dist/assets/{useAppFontEffects-DpDiWkkc.js → useAppFontEffects-C_TEX3sk.js} +16 -16
- package/dist/assets/{useBranchPullRequestRequest-Cbky4ZeH.js → useBranchPullRequestRequest-CLTracub.js} +1 -1
- package/dist/assets/{useCallableModelProviders-Y8rZzgJF.js → useCallableModelProviders-CcETbnHf.js} +1 -1
- package/dist/assets/{useDiffFindSurface-B7KQR8iQ.js → useDiffFindSurface-BY6KBx38.js} +1 -1
- package/dist/assets/{useGitCleanLine-D6E5eJm2.js → useGitCleanLine-KstI02a0.js} +1 -1
- package/dist/assets/{useInlineCommentController-CF8aQO6-.js → useInlineCommentController-ByiCLJwx.js} +1 -1
- package/dist/assets/{useMarkdownLocalAssets-BXBlTj-y.js → useMarkdownLocalAssets-DG5IJM9Y.js} +1 -1
- package/dist/assets/{useRootScrollLock-3qp1KaTm.js → useRootScrollLock-ClFa_ezf.js} +2 -2
- package/dist/assets/{useWalkthroughReview-BNHJ06yD.js → useWalkthroughReview-BjhHwuOR.js} +1 -1
- package/dist/assets/{useWholeFileComment-CisbVgb0.js → useWholeFileComment-Dbr3Y7Ga.js} +1 -1
- package/dist/assets/{useWorktreeArchiveActions-03WxbHUV.js → useWorktreeArchiveActions-jkcvj4mj.js} +1 -1
- package/dist/assets/{vendor-codemirror-language-data-C6MZftZF.js → vendor-codemirror-language-data-Cy549AYN.js} +2 -2
- package/dist/assets/{zh-CN-B3B6hhd4.js → zh-CN-Cj8b8iKH.js} +1 -1
- package/dist/assets/{zh-TW-CBU98qnu.js → zh-TW-CyjD8MXO.js} +1 -1
- package/dist/index.html +2 -2
- 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-CAXuJLle.js","assets/vendor-react--VO_rL_p.js","assets/vendor-scheduler-7OC5HNn7.js","assets/katex.min-BBVkbKQY.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-zustand-C9tWdk0j.js","assets/vendor-zod-Csf1sqWl.js","assets/vendor-opencode-client-CqFY51gT.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-arxpHWv8.css","assets/useAppFontEffects-DpDiWkkc.js","assets/vendor-base-ui-zhBy6TEG.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-C_IilPt1.js","assets/vendor-tanstack-virtual-core-DsQgKrou.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-C6MZftZF.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-DAdshx9l.js","assets/vendor-class-variance-authority-5VPnzWs2.js","assets/flexokiTheme-Bv37aHkq.js","assets/vendor-codemirror-search-Bk6iB2TM.js","assets/vendor-replit-codemirror-vim-BpSlt2iY.js","assets/vendor-replit-codemirror-vim-core-FHzKdNUS.js","assets/runtimeEndpointReset-BPYbd6uu.js","assets/space-apply-9idN6j4k.js","assets/runtimeEndpointReset-uDNKGwhp.css","assets/useMarkdownLocalAssets-BXBlTj-y.js","assets/fileContentPoller-paKtimZt.js","assets/useInlineCommentController-CF8aQO6-.js","assets/JsonTreeView-ZZKmvRSL.js","assets/parseDiffFromFile-31PZ3lnE.js","assets/computeVirtualFileMetrics-BhVDZ-oP.js","assets/themeResolver-4dbEkEN5.js","assets/vendor-pierre-theming-D_TRfu0q.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-BqR4iT-Y.js","assets/vendor-strip-json-comments-5dJlOkP1.js","assets/codeHighlight-DD239VMc.js","assets/appThemeRegistry-D4EuLaGF.js","assets/textMateThemeFromAppTheme-fsNcE7v2.js","assets/Virtualizer-V759EvEY.js","assets/contextFileOpenGuard-D9Z0ay-I.js","assets/vendor-react-drawio-C6TkEvnS.js","assets/vendor-codemirror-lint-aq8IpR1c.js","assets/useWholeFileComment-CisbVgb0.js","assets/diffsHighlighter-BsxkaI3Q.js","assets/scheduledTasksApi-D6FhT0TU.js","assets/vendor-capacitor-app-BrDJj9I_.js","assets/vendor-capacitor-push-notifications-KNe1zSBF.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{f as ne,r as ar,j as n,R as m,a as Ls,h as Ga}from"./vendor-react--VO_rL_p.js";import{aG as qs,c4 as jr,c5 as si,c6 as ct,bX as Ft,c7 as Ds,c8 as zs,j as co,c9 as zn,ca as uo,cb as Ja,cc as Xa,cd as fo,ce as Ya,cf as Qa,cg as Za,ch as el,u as He,k as Bs,n as pn,L as tl,M as sl,D as nl,bi as kr,v as gt,b as rl,ci as il,z as Es,aQ as ol,aP as al,bo as ll,t as lr,bp as ni,bP as cl,bV as ul,bn as dl,cj as fl,ck as ml,cl as ri,aR as pl,aI as mo,cm as hl,cn as jn,co as ii,cp as gl,bl as po,cq as oi}from"./katex.min-BBVkbKQY.js";import{X as Cs,Y as Lt,dT as ho,dU as bl,e$ as xl,b5 as go,iB as yl,u as ge,A as me,dl as vl,I as G,eA as wl,B as Ee,n as Ut,b0 as bo,bf as Os,au as xo,Q as ie,c$ as yo,iC as jl,iD as kl,eg as vo,V as Ot,aU as Sl,iE as ws,iF as Nl,iG as ai,iH as Cl,iI as Rl,g7 as Sr,ec as El,ed as Il,$ as ot,fA as Tl,fC as wo,fD as jo,iJ as ko,cg as _l,fE as Al,ce as Nr,cd as So,f5 as No,iK as Pl,bE as Co,aI as Pt,f4 as Ro,bB as Cr,iL as Dl,iM as Ol,iN as Ml,cf as Ll,iO as zl,iP as Bl,gw as Rn,h6 as cr,gR as fs,iQ as Fl,k as Eo,iR as ur,cn as Rr,aL as Io,ca as To,fg as _o,fh as Ao,y as Po,iS as $l,iT as Wl,iU as Kl,iV as Vl,iW as Do,iX as Hl,iY as Ul,bU as li,iZ as ci,i_ as ql,i$ as Gl,fw as Er,j0 as Jl,d_ as Xl,j1 as dr,z as Oo,j2 as Yl,j3 as Ql,ei as Zl,j4 as ec,e0 as ui,j5 as tc,j6 as sc,a2 as fr,a3 as mr,a4 as pr,bG as di,ad as Qn,a5 as En,aa as nc,ab as rc,ac as ic,ir as oc,av as ac,ay as lc,dw as cc,fK as uc,c3 as dc,gT as Mo,gU as Lo,aJ as Ir,bx as fc,bz as mc,bA as pc,gp as hc,gk as gc,bO as zo,gl as bc,fp as xc,bC as yc,gS as vc,gY as wc,fq as jc,j7 as kc,j8 as Sc,j9 as Nc,ja as Cc,g$ as fi,bD as kn,bm as Rc,bH as Ec,bF as nn,ft as Ic,gn as Tc,cB as _c,fr as Ac,gq as Pc,h3 as Dc,h5 as Oc,h0 as Mc,e8 as Bo,aY as ft,jb as Lc,jc as zc,jd as Bc,je as Fc,jf as $c,jg as Wc,cP as Kc,jh as Vc,ji as Hc,jj as Uc,jk as qc,eH as Gc,gi as mi,jl as Tr,jm as Jc,jn as Xc,er as Yc,es as Qc,et as Zc,eu,jo as tu,jp as pi,jq as su,ew as nu,ex as ru,ey as iu,ez as ou,ev as au,eB as lu,eC as cu,jr as uu,js as du,jt as fu,eF as hi,ju as mu,jv as pu,jw as hu,jx as gu,jy as bu,ah as xu,eK as yu,eL as vu,eM as wu}from"./useAppFontEffects-DpDiWkkc.js";import{aP as ks,aQ as ju,aR as ku,aS as Fo,aT as gi,aU as Su,aV as Nu,aW as Cu,aX as Ru,aY as Eu,aZ as Iu,a_ as Tu,a$ as _u,b0 as Au,b1 as Pu,b2 as Du,b3 as Ou,b4 as Mu,b5 as Lu,b6 as $o,b7 as zu,b8 as Bu,b9 as Fu,ba as $u,bb as Wu,bc as Ku,bd as Vu,be as Hu,h as Uu,S as qu,bf as Gu,bg as Ju,bh as Xu,aj as In,bi as Yu,at as Sn,aB as Qu,aC as Zu,aw as ed,x as bi,y as td,aF as Zn,aI as sd,aJ as nd,am as rd,bj as id,au as od,av as ad,bk as ld,bl as cd,ax as ud,z as dd,aK as fd,aG as Wo,N as md,bm as pd,bn as hd,aM as gd,bo as bd,bp as xd,bq as yd,br as vd,bs as wd,bt as jd,bu as kd,bv as Sd,bw as Nd,bx as Cd,by as Rd,bz as Ed,bA as Id,bB as Td,bC as _d,bD as Ad,bE as Pd,bF as Dd,bG as Od,bH as Md,bI as Ld,bJ as zd,bK as Bd}from"./runtimeEndpointReset-BPYbd6uu.js";import{i as Fd}from"./initializeSharedPreferences-CFrNmgg0.js";import{S as $d,A as Wd}from"./SettingsView-ug8Oinyr.js";import{PlanView as Kd}from"./PlanView-NMKJpsCH.js";import{SpaceAccessDialog as Vd}from"./SpaceAccessDialog-CeZrOBod.js";import{SpaceApplyDialog as Hd}from"./SpaceApplyDialog-DurN0_0Z.js";import{SpaceSetupOutputDialog as Ud}from"./SpaceSetupOutput-BDkJcYrl.js";import{RunOverview as qd}from"./RunOverview-DNSvGB7-.js";import{_ as dn}from"./vendor-vite-runtime-DD1OZmLC.js";import{p as Gd}from"./vendor-aparajita-capacitor-secure-storage-5IShChL0.js";import{Capacitor as Jd,registerPlugin as Ko}from"./vendor-capacitor-core-B4EWRrHz.js";import{o as _r,s as Fs,a as Xd}from"./vendor-zod-Csf1sqWl.js";import{h as Yd,i as xi,j as Qd,P as Zd,D as ef,f as tf}from"./vendor-dnd-kit-core-Br1Cs7RV.js";import{S as sf,v as nf,u as rf,s as of,a as af}from"./vendor-dnd-kit-sortable-DpfLEOLv.js";import{C as lf}from"./vendor-dnd-kit-utilities-DZ9KbT5S.js";import{k as hr,M as Vo,s as cf,d as uf,J as df,K as yi,P as ff,a as mf,p as pf,U as hf,Z as gf,Q as bf,r as xf}from"./vendor-remixicon-react-2PADFbzF.js";import{S as yf}from"./SpaceRow-BkgNrW0R.js";import{toast as vi}from"./vendor-sonner-Dw26OnzC.js";import{c as vf}from"./vendor-zustand-C9tWdk0j.js";import{UsageStatsView as wf}from"./UsageStatsView-D2AXngeb.js";import{ArchiveSessionsView as jf}from"./ArchiveView-GN7gU2qK.js";import{MobileSourceBoard as kf}from"./SourceBoardView-BQittQF3.js";import{OverviewPage as Sf}from"./OverviewView-B6SMyBTp.js";import{ScheduledTasksView as Nf}from"./ScheduledTasksDialog-BNXOjpPY.js";import{i as Cf,a as Rf,b as Ef,c as If,d as Tf,s as _f,S as Af}from"./SubmoduleDiffSummary-BK5RTTC4.js";import{a as Pf,R as Df,I as Of,C as Mf,b as Lf,c as zf,D as Bf,u as Ff}from"./useGitCleanLine-D6E5eJm2.js";import{C as Ho}from"./ChangedPathLabel-DV4XTf6K.js";import{u as $f,W as Wf,c as Kf,d as Vf,g as Hf,f as Uf,h as qf,l as Gf,k as Jf}from"./useWalkthroughReview-BNHJ06yD.js";import{u as Xf,a as Yf,i as wi,d as er,B as Qf,C as Zf,P as ji,b as em}from"./ChangeRequestDiffUnavailable-B28oeUds.js";import{u as tm,P as sm}from"./useBranchPullRequestRequest-Cbky4ZeH.js";import{p as nm}from"./parseDiffFromFile-31PZ3lnE.js";import{u as rm}from"./useWholeFileComment-CisbVgb0.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-opencode-client-CqFY51gT.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-zhBy6TEG.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-C_IilPt1.js";import"./vendor-tanstack-virtual-core-DsQgKrou.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-C6MZftZF.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-DAdshx9l.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./space-apply-9idN6j4k.js";import"./install-EEjacdUD.js";import"./vendor-yaml-CE-D_49-.js";import"./flexokiTheme-Bv37aHkq.js";import"./vendor-codemirror-search-Bk6iB2TM.js";import"./vendor-replit-codemirror-vim-BpSlt2iY.js";import"./vendor-replit-codemirror-vim-core-FHzKdNUS.js";import"./codeHighlight-DD239VMc.js";import"./appThemeRegistry-D4EuLaGF.js";import"./themeResolver-4dbEkEN5.js";import"./vendor-pierre-theming-D_TRfu0q.js";import"./textMateThemeFromAppTheme-fsNcE7v2.js";import"./vendor-dnd-kit-accessibility-CYclfhtC.js";import"./vendor-qrcode-Cl8OheHW.js";import"./vendor-dijkstrajs-COg3n3zL.js";import"./vendor-strip-json-comments-5dJlOkP1.js";import"./useCallableModelProviders-Y8rZzgJF.js";import"./pageTitle-BL2yQcTV.js";import"./AboutLogo-BP87552a.js";import"./useInlineCommentController-CF8aQO6-.js";import"./fileContentPoller-paKtimZt.js";import"./useMarkdownLocalAssets-BXBlTj-y.js";import"./spaceNetwork-DeZE7V6c.js";import"./useWorktreeArchiveActions-03WxbHUV.js";import"./scheduledTasksApi-D6FhT0TU.js";import"./vendor-cron-parser-1X50-i0r.js";import"./vendor-luxon-BZ0puJYg.js";import"./date-time-DlgUVVwY.js";import"./computeVirtualFileMetrics-BhVDZ-oP.js";import"./isDiffPlainText-DUd8YJX0.js";import"./getFiletypeFromFileName-BgI9McTw.js";import"./vendor-diff-C3JhlQdm.js";import"./pierreDiffTint-igvBfgMB.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"./Virtualizer-V759EvEY.js";import"./diffsHighlighter-BsxkaI3Q.js";let Uo=null,ki=!1;const im=new Promise(s=>{Uo=s});function om(){ki||(ki=!0,Uo?.())}const am=6,lm=s=>s.parentID??null,gr=s=>{const e=s.replace(/\/+$/,"");return e.slice(e.lastIndexOf("/")+1)||e},cm=s=>s.replace(/\\/g,"/").replace(/\/+$/,""),um=(s,e)=>{if(!s)return"";let t=null,r=-1;for(const o of e){const i=cm(o.path);(s===i||s.startsWith(`${i}/`))&&i.length>r&&(t=o,r=i.length)}return t?t.label?.trim()||gr(t.path):gr(s)},dm=()=>{const s=Cs.getState().activeSessions,e=Lt.getState().projects,t=ho.getState().ids,r=bl.getState().rankById;let o=0;const i=[];for(const a of s){const d=xl(a);d&&(o+=1),lm(a)===null&&i.push({session:a,unread:d,project:um(go(a),e)})}i.sort((a,d)=>yl(a.session,d.session,t,r));const l=i.slice(0,am).map(({session:a,unread:d,project:c})=>({id:a.id,title:a.title??"",unread:d,project:c}));return{runtimeKey:qs(),attentionCount:o,recentSessions:l,projects:e.map(a=>({id:a.id,label:a.label?.trim()||gr(a.path)}))}},fm="__OPENCHAMBER_WIDGET_SNAPSHOT__",mm=()=>{typeof window>"u"||(window[fm]=()=>{try{return JSON.stringify(dm())}catch{return null}})},Si="mobile-app-update-available",Ni="mobile-app-update-toast-dismissed-version",pm=()=>{const s=ne.c(8),{t:e}=ge(),t=ks(hm),r=ks(gm),o=ks(bm),i=ks(xm);let l;s[0]===Symbol.for("react.memo_cache_sentinel")?(l=new Set,s[0]=l):l=s[0];const a=ar.useRef(l);let d,c;return s[1]!==t||s[2]!==i||s[3]!==r||s[4]!==e||s[5]!==o?(d=()=>{if(jr()!=="android"||r!=="mobile"||!t||!o||!i){me.dismiss(Si);return}si().getItem(Ni)!==o&&(a.current.has(o)||(a.current.add(o),me.info(e("mobileUpdate.toast.available.title"),{id:Si,description:e("mobileUpdate.toast.available.description",{version:o}),duration:1/0,icon:n.jsx(G,{name:"download",className:"h-4 w-4 text-muted-foreground"}),action:{label:e("mobileUpdate.toast.actions.download"),onClick:()=>{vl(i)}},onDismiss:()=>{const u=ks.getState();u.available&&u.info?.version===o&&si().setItem(Ni,o)}})))},c=[t,i,r,e,o],s[1]=t,s[2]=i,s[3]=r,s[4]=e,s[5]=o,s[6]=d,s[7]=c):(d=s[6],c=s[7]),ar.useEffect(d,c),null};function hm(s){return s.available}function gm(s){return s.runtimeType}function bm(s){return s.info?.version}function xm(s){return s.info?.downloadUrl}const Ci="calc(var(--oc-safe-area-top, 0px) + var(--oc-visual-viewport-offset-top, 0px) + 16px)";function ym(s){const e=ne.c(3);let t,r;e[0]!==s?(t=()=>{const o=window.visualViewport,i=s.current;if(!o||!i)return;let l="";const a=()=>{const d=`${Math.max(0,Math.round(o.offsetTop))}px`;d!==l&&(l=d,i.style.setProperty("--oc-visual-viewport-offset-top",d))};return a(),o.addEventListener("scroll",a),o.addEventListener("resize",a),()=>{o.removeEventListener("scroll",a),o.removeEventListener("resize",a)}},r=[s],e[0]=s,e[1]=t,e[2]=r):(t=e[1],r=e[2]),m.useEffect(t,r)}function vm(){const s=ne.c(1),e=m.useRef(null);ym(e);let t;return s[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx("div",{ref:e,className:"contents",children:n.jsx(wl,{position:"top-center",layout:"banner",offset:Ci,mobileOffset:{top:Ci}})}),s[0]=t):t=s[0],t}const Ri=300,wm="openchamber.mobile.connectLog.v1",Ms=[];if(typeof window<"u")try{window.localStorage.removeItem(wm)}catch{}const Ar=(s,e)=>{Ms.push({at:Date.now(),step:s,detail:e}),Ms.length>Ri&&Ms.splice(0,Ms.length-Ri)};typeof window<"u"&&Ar("app:launch","{}");const jm=()=>[...Ms],km=s=>{const e=new Date(s),t=(r,o=2)=>String(r).padStart(o,"0");return`${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}.${t(e.getMilliseconds(),3)}`},qo=s=>`${km(s.at)} ${s.step}${s.detail&&s.detail!=="{}"?` ${s.detail}`:""}`,Sm=()=>Ms.map(qo).join(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilesView-D00Dnc8i.js","assets/vendor-react--VO_rL_p.js","assets/vendor-scheduler-7OC5HNn7.js","assets/katex.min-BCtkGOiC.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-zustand-C9tWdk0j.js","assets/vendor-zod-Csf1sqWl.js","assets/vendor-opencode-client-CqFY51gT.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-arxpHWv8.css","assets/useAppFontEffects-C_TEX3sk.js","assets/vendor-base-ui-zhBy6TEG.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-C_IilPt1.js","assets/vendor-tanstack-virtual-core-DsQgKrou.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-Cy549AYN.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-DAdshx9l.js","assets/vendor-class-variance-authority-5VPnzWs2.js","assets/flexokiTheme-Df4MxCkn.js","assets/vendor-codemirror-search-Bk6iB2TM.js","assets/vendor-replit-codemirror-vim-BpSlt2iY.js","assets/vendor-replit-codemirror-vim-core-FHzKdNUS.js","assets/runtimeEndpointReset-CMO7G_Ff.js","assets/space-apply-CNISDYMA.js","assets/runtimeEndpointReset-uDNKGwhp.css","assets/useMarkdownLocalAssets-DG5IJM9Y.js","assets/fileContentPoller-D0GhYhQ3.js","assets/useInlineCommentController-ByiCLJwx.js","assets/JsonTreeView-Bw8E9Koo.js","assets/parseDiffFromFile-Yp9eHLcj.js","assets/computeVirtualFileMetrics-CXGHe7T5.js","assets/themeResolver-4dbEkEN5.js","assets/vendor-pierre-theming-D_TRfu0q.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-QNmxHtqN.js","assets/vendor-strip-json-comments-5dJlOkP1.js","assets/codeHighlight-CJBps6zM.js","assets/appThemeRegistry-BBiQjAje.js","assets/textMateThemeFromAppTheme-CbTfkuJp.js","assets/Virtualizer-BOHERqLh.js","assets/contextFileOpenGuard-Cp662aS-.js","assets/vendor-react-drawio-C6TkEvnS.js","assets/vendor-codemirror-lint-aq8IpR1c.js","assets/useWholeFileComment-Dbr3Y7Ga.js","assets/diffsHighlighter-BsxkaI3Q.js","assets/scheduledTasksApi-Mn2aZ7Rl.js","assets/vendor-capacitor-app-BrDJj9I_.js","assets/vendor-capacitor-push-notifications-KNe1zSBF.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{f as ne,r as ar,j as n,R as m,a as Ls,h as Ga}from"./vendor-react--VO_rL_p.js";import{aG as qs,c4 as jr,c5 as si,c6 as ct,bX as Ft,c7 as Ds,c8 as zs,j as co,c9 as zn,ca as uo,cb as Ja,cc as Xa,cd as fo,ce as Ya,cf as Qa,cg as Za,ch as el,u as He,k as Bs,n as pn,L as tl,M as sl,D as nl,bi as kr,v as gt,b as rl,ci as il,z as Es,aQ as ol,aP as al,bo as ll,t as lr,bp as ni,bP as cl,bV as ul,bn as dl,cj as fl,ck as ml,cl as ri,aR as pl,aI as mo,cm as hl,cn as jn,co as ii,cp as gl,bl as po,cq as oi}from"./katex.min-BCtkGOiC.js";import{X as Cs,Y as Lt,dT as ho,dU as bl,e$ as xl,b5 as go,iB as yl,u as ge,A as me,dl as vl,I as G,eA as wl,B as Ee,n as Ut,b0 as bo,bf as Os,au as xo,Q as ie,c$ as yo,iC as jl,iD as kl,eg as vo,V as Ot,aU as Sl,iE as ws,iF as Nl,iG as ai,iH as Cl,iI as Rl,g7 as Sr,ec as El,ed as Il,$ as ot,fA as Tl,fC as wo,fD as jo,iJ as ko,cg as _l,fE as Al,ce as Nr,cd as So,f5 as No,iK as Pl,bE as Co,aI as Pt,f4 as Ro,bB as Cr,iL as Dl,iM as Ol,iN as Ml,cf as Ll,iO as zl,iP as Bl,gw as Rn,h6 as cr,gR as fs,iQ as Fl,k as Eo,iR as ur,cn as Rr,aL as Io,ca as To,fg as _o,fh as Ao,y as Po,iS as $l,iT as Wl,iU as Kl,iV as Vl,iW as Do,iX as Hl,iY as Ul,bU as li,iZ as ci,i_ as ql,i$ as Gl,fw as Er,j0 as Jl,d_ as Xl,j1 as dr,z as Oo,j2 as Yl,j3 as Ql,ei as Zl,j4 as ec,e0 as ui,j5 as tc,j6 as sc,a2 as fr,a3 as mr,a4 as pr,bG as di,ad as Qn,a5 as En,aa as nc,ab as rc,ac as ic,ir as oc,av as ac,ay as lc,dw as cc,fK as uc,c3 as dc,gT as Mo,gU as Lo,aJ as Ir,bx as fc,bz as mc,bA as pc,gp as hc,gk as gc,bO as zo,gl as bc,fp as xc,bC as yc,gS as vc,gY as wc,fq as jc,j7 as kc,j8 as Sc,j9 as Nc,ja as Cc,g$ as fi,bD as kn,bm as Rc,bH as Ec,bF as nn,ft as Ic,gn as Tc,cB as _c,fr as Ac,gq as Pc,h3 as Dc,h5 as Oc,h0 as Mc,e8 as Bo,aY as ft,jb as Lc,jc as zc,jd as Bc,je as Fc,jf as $c,jg as Wc,cP as Kc,jh as Vc,ji as Hc,jj as Uc,jk as qc,eH as Gc,gi as mi,jl as Tr,jm as Jc,jn as Xc,er as Yc,es as Qc,et as Zc,eu,jo as tu,jp as pi,jq as su,ew as nu,ex as ru,ey as iu,ez as ou,ev as au,eB as lu,eC as cu,jr as uu,js as du,jt as fu,eF as hi,ju as mu,jv as pu,jw as hu,jx as gu,jy as bu,ah as xu,eK as yu,eL as vu,eM as wu}from"./useAppFontEffects-C_TEX3sk.js";import{aP as ks,aQ as ju,aR as ku,aS as Fo,aT as gi,aU as Su,aV as Nu,aW as Cu,aX as Ru,aY as Eu,aZ as Iu,a_ as Tu,a$ as _u,b0 as Au,b1 as Pu,b2 as Du,b3 as Ou,b4 as Mu,b5 as Lu,b6 as $o,b7 as zu,b8 as Bu,b9 as Fu,ba as $u,bb as Wu,bc as Ku,bd as Vu,be as Hu,h as Uu,S as qu,bf as Gu,bg as Ju,bh as Xu,aj as In,bi as Yu,at as Sn,aB as Qu,aC as Zu,aw as ed,x as bi,y as td,aF as Zn,aI as sd,aJ as nd,am as rd,bj as id,au as od,av as ad,bk as ld,bl as cd,ax as ud,z as dd,aK as fd,aG as Wo,N as md,bm as pd,bn as hd,aM as gd,bo as bd,bp as xd,bq as yd,br as vd,bs as wd,bt as jd,bu as kd,bv as Sd,bw as Nd,bx as Cd,by as Rd,bz as Ed,bA as Id,bB as Td,bC as _d,bD as Ad,bE as Pd,bF as Dd,bG as Od,bH as Md,bI as Ld,bJ as zd,bK as Bd}from"./runtimeEndpointReset-CMO7G_Ff.js";import{i as Fd}from"./initializeSharedPreferences-Cb-QZ9nO.js";import{S as $d,A as Wd}from"./SettingsView-D7mytSZv.js";import{PlanView as Kd}from"./PlanView-pwTIoUJK.js";import{SpaceAccessDialog as Vd}from"./SpaceAccessDialog-q5blJXG5.js";import{SpaceApplyDialog as Hd}from"./SpaceApplyDialog-Csq1Z7zY.js";import{SpaceSetupOutputDialog as Ud}from"./SpaceSetupOutput-Bzeasxqg.js";import{RunOverview as qd}from"./RunOverview-BqmEhK3a.js";import{_ as dn}from"./vendor-vite-runtime-DD1OZmLC.js";import{p as Gd}from"./vendor-aparajita-capacitor-secure-storage-5IShChL0.js";import{Capacitor as Jd,registerPlugin as Ko}from"./vendor-capacitor-core-B4EWRrHz.js";import{o as _r,s as Fs,a as Xd}from"./vendor-zod-Csf1sqWl.js";import{h as Yd,i as xi,j as Qd,P as Zd,D as ef,f as tf}from"./vendor-dnd-kit-core-Br1Cs7RV.js";import{S as sf,v as nf,u as rf,s as of,a as af}from"./vendor-dnd-kit-sortable-DpfLEOLv.js";import{C as lf}from"./vendor-dnd-kit-utilities-DZ9KbT5S.js";import{k as hr,M as Vo,s as cf,d as uf,J as df,K as yi,P as ff,a as mf,p as pf,U as hf,Z as gf,Q as bf,r as xf}from"./vendor-remixicon-react-2PADFbzF.js";import{S as yf}from"./SpaceRow-BvJCw88e.js";import{toast as vi}from"./vendor-sonner-Dw26OnzC.js";import{c as vf}from"./vendor-zustand-C9tWdk0j.js";import{UsageStatsView as wf}from"./UsageStatsView-CWV-BYPI.js";import{ArchiveSessionsView as jf}from"./ArchiveView-BsWIv-C4.js";import{MobileSourceBoard as kf}from"./SourceBoardView-BoMdMgmW.js";import{OverviewPage as Sf}from"./OverviewView-CohMMobq.js";import{ScheduledTasksView as Nf}from"./ScheduledTasksDialog-CXyiyIDe.js";import{i as Cf,a as Rf,b as Ef,c as If,d as Tf,s as _f,S as Af}from"./SubmoduleDiffSummary-B3CnCMwZ.js";import{a as Pf,R as Df,I as Of,C as Mf,b as Lf,c as zf,D as Bf,u as Ff}from"./useGitCleanLine-KstI02a0.js";import{C as Ho}from"./ChangedPathLabel-7Zbbq-FE.js";import{u as $f,W as Wf,c as Kf,d as Vf,g as Hf,f as Uf,h as qf,l as Gf,k as Jf}from"./useWalkthroughReview-BjhHwuOR.js";import{u as Xf,a as Yf,i as wi,d as er,B as Qf,C as Zf,P as ji,b as em}from"./ChangeRequestDiffUnavailable-ED92kmXz.js";import{u as tm,P as sm}from"./useBranchPullRequestRequest-CLTracub.js";import{p as nm}from"./parseDiffFromFile-Yp9eHLcj.js";import{u as rm}from"./useWholeFileComment-Dbr3Y7Ga.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-opencode-client-CqFY51gT.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-zhBy6TEG.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-C_IilPt1.js";import"./vendor-tanstack-virtual-core-DsQgKrou.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-Cy549AYN.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-DAdshx9l.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./space-apply-CNISDYMA.js";import"./install-BjzS6Z-p.js";import"./vendor-yaml-CE-D_49-.js";import"./flexokiTheme-Df4MxCkn.js";import"./vendor-codemirror-search-Bk6iB2TM.js";import"./vendor-replit-codemirror-vim-BpSlt2iY.js";import"./vendor-replit-codemirror-vim-core-FHzKdNUS.js";import"./codeHighlight-CJBps6zM.js";import"./appThemeRegistry-BBiQjAje.js";import"./themeResolver-4dbEkEN5.js";import"./vendor-pierre-theming-D_TRfu0q.js";import"./textMateThemeFromAppTheme-CbTfkuJp.js";import"./vendor-dnd-kit-accessibility-CYclfhtC.js";import"./vendor-qrcode-Cl8OheHW.js";import"./vendor-dijkstrajs-COg3n3zL.js";import"./vendor-strip-json-comments-5dJlOkP1.js";import"./useCallableModelProviders-CcETbnHf.js";import"./pageTitle-Cph9nb1O.js";import"./AboutLogo-BwyB9sbV.js";import"./useInlineCommentController-ByiCLJwx.js";import"./fileContentPoller-D0GhYhQ3.js";import"./useMarkdownLocalAssets-DG5IJM9Y.js";import"./spaceNetwork-DUg5u0h8.js";import"./useWorktreeArchiveActions-jkcvj4mj.js";import"./scheduledTasksApi-Mn2aZ7Rl.js";import"./vendor-cron-parser-1X50-i0r.js";import"./vendor-luxon-BZ0puJYg.js";import"./date-time-C4F_nWqa.js";import"./computeVirtualFileMetrics-CXGHe7T5.js";import"./isDiffPlainText-SBv5bM8c.js";import"./getFiletypeFromFileName-BgI9McTw.js";import"./vendor-diff-C3JhlQdm.js";import"./pierreDiffTint-CFyG2F44.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"./Virtualizer-BOHERqLh.js";import"./diffsHighlighter-BsxkaI3Q.js";let Uo=null,ki=!1;const im=new Promise(s=>{Uo=s});function om(){ki||(ki=!0,Uo?.())}const am=6,lm=s=>s.parentID??null,gr=s=>{const e=s.replace(/\/+$/,"");return e.slice(e.lastIndexOf("/")+1)||e},cm=s=>s.replace(/\\/g,"/").replace(/\/+$/,""),um=(s,e)=>{if(!s)return"";let t=null,r=-1;for(const o of e){const i=cm(o.path);(s===i||s.startsWith(`${i}/`))&&i.length>r&&(t=o,r=i.length)}return t?t.label?.trim()||gr(t.path):gr(s)},dm=()=>{const s=Cs.getState().activeSessions,e=Lt.getState().projects,t=ho.getState().ids,r=bl.getState().rankById;let o=0;const i=[];for(const a of s){const d=xl(a);d&&(o+=1),lm(a)===null&&i.push({session:a,unread:d,project:um(go(a),e)})}i.sort((a,d)=>yl(a.session,d.session,t,r));const l=i.slice(0,am).map(({session:a,unread:d,project:c})=>({id:a.id,title:a.title??"",unread:d,project:c}));return{runtimeKey:qs(),attentionCount:o,recentSessions:l,projects:e.map(a=>({id:a.id,label:a.label?.trim()||gr(a.path)}))}},fm="__OPENCHAMBER_WIDGET_SNAPSHOT__",mm=()=>{typeof window>"u"||(window[fm]=()=>{try{return JSON.stringify(dm())}catch{return null}})},Si="mobile-app-update-available",Ni="mobile-app-update-toast-dismissed-version",pm=()=>{const s=ne.c(8),{t:e}=ge(),t=ks(hm),r=ks(gm),o=ks(bm),i=ks(xm);let l;s[0]===Symbol.for("react.memo_cache_sentinel")?(l=new Set,s[0]=l):l=s[0];const a=ar.useRef(l);let d,c;return s[1]!==t||s[2]!==i||s[3]!==r||s[4]!==e||s[5]!==o?(d=()=>{if(jr()!=="android"||r!=="mobile"||!t||!o||!i){me.dismiss(Si);return}si().getItem(Ni)!==o&&(a.current.has(o)||(a.current.add(o),me.info(e("mobileUpdate.toast.available.title"),{id:Si,description:e("mobileUpdate.toast.available.description",{version:o}),duration:1/0,icon:n.jsx(G,{name:"download",className:"h-4 w-4 text-muted-foreground"}),action:{label:e("mobileUpdate.toast.actions.download"),onClick:()=>{vl(i)}},onDismiss:()=>{const u=ks.getState();u.available&&u.info?.version===o&&si().setItem(Ni,o)}})))},c=[t,i,r,e,o],s[1]=t,s[2]=i,s[3]=r,s[4]=e,s[5]=o,s[6]=d,s[7]=c):(d=s[6],c=s[7]),ar.useEffect(d,c),null};function hm(s){return s.available}function gm(s){return s.runtimeType}function bm(s){return s.info?.version}function xm(s){return s.info?.downloadUrl}const Ci="calc(var(--oc-safe-area-top, 0px) + var(--oc-visual-viewport-offset-top, 0px) + 16px)";function ym(s){const e=ne.c(3);let t,r;e[0]!==s?(t=()=>{const o=window.visualViewport,i=s.current;if(!o||!i)return;let l="";const a=()=>{const d=`${Math.max(0,Math.round(o.offsetTop))}px`;d!==l&&(l=d,i.style.setProperty("--oc-visual-viewport-offset-top",d))};return a(),o.addEventListener("scroll",a),o.addEventListener("resize",a),()=>{o.removeEventListener("scroll",a),o.removeEventListener("resize",a)}},r=[s],e[0]=s,e[1]=t,e[2]=r):(t=e[1],r=e[2]),m.useEffect(t,r)}function vm(){const s=ne.c(1),e=m.useRef(null);ym(e);let t;return s[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx("div",{ref:e,className:"contents",children:n.jsx(wl,{position:"top-center",layout:"banner",offset:Ci,mobileOffset:{top:Ci}})}),s[0]=t):t=s[0],t}const Ri=300,wm="openchamber.mobile.connectLog.v1",Ms=[];if(typeof window<"u")try{window.localStorage.removeItem(wm)}catch{}const Ar=(s,e)=>{Ms.push({at:Date.now(),step:s,detail:e}),Ms.length>Ri&&Ms.splice(0,Ms.length-Ri)};typeof window<"u"&&Ar("app:launch","{}");const jm=()=>[...Ms],km=s=>{const e=new Date(s),t=(r,o=2)=>String(r).padStart(o,"0");return`${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}.${t(e.getMilliseconds(),3)}`},qo=s=>`${km(s.at)} ${s.step}${s.detail&&s.detail!=="{}"?` ${s.detail}`:""}`,Sm=()=>Ms.map(qo).join(`
|
|
3
3
|
`),Go=(s,e)=>{const t=ne.c(10),r=700,o=m.useRef(null),i=m.useRef(null),l=m.useRef(!1);let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=()=>{o.current!==null&&window.clearTimeout(o.current),o.current=null,i.current=null},t[0]=a):a=t[0];const d=a;let c,u;t[1]===Symbol.for("react.memo_cache_sentinel")?(c=()=>d,u=[d],t[1]=c,t[2]=u):(c=t[1],u=t[2]),m.useEffect(c,u);let p;t[3]!==r||t[4]!==s?(p=v=>{l.current=!1,i.current={x:v.clientX,y:v.clientY},o.current!==null&&window.clearTimeout(o.current),o.current=window.setTimeout(()=>{o.current=null,l.current=!0,s()},r)},t[3]=r,t[4]=s,t[5]=p):p=t[5];const h=p;let f;t[6]===Symbol.for("react.memo_cache_sentinel")?(f=v=>{const E=i.current;E&&(Math.abs(v.clientX-E.x)>10||Math.abs(v.clientY-E.y)>10)&&d()},t[6]=f):f=t[6];const g=f;let x;t[7]===Symbol.for("react.memo_cache_sentinel")?(x=v=>{l.current&&(l.current=!1,v.preventDefault(),v.stopPropagation())},t[7]=x):x=t[7];const b=x;let w;return t[8]!==h?(w={onPointerDown:h,onPointerMove:g,onPointerUp:d,onPointerCancel:d,onClickCapture:b},t[8]=h,t[9]=w):w=t[9],w},Nm=async(s,e)=>{let t;const r=new Promise(o=>{t=setTimeout(()=>o({response:null,failure:"timeout"}),s)});try{return await Promise.race([e.then(o=>({response:o,failure:null}),o=>({response:null,failure:o instanceof Error?o.message:String(o)})),r])}finally{t!==void 0&&clearTimeout(t)}},Cm=(s,e)=>new Promise(t=>{const r=a=>{clearTimeout(i),l(),t(a)},o=a=>{a.state==="connected"?r(!0):(a.state==="idle"||a.terminal)&&r(!1)},i=setTimeout(()=>r(!1),e),l=s.subscribeStatus(o);o(s.getStatus())}),$s=(s,e,t,r)=>Nm(r,s.fetch(e,t)),Jo=async(s,e,t,r)=>{const o=Date.now()+r;let i=await $s(s,e,t,r);for(;!i.response&&i.failure!=="timeout"&&s.getStatus().state!=="connected";){const l=o-Date.now();if(l<=0||!await Cm(s,l))return i;const a=o-Date.now();if(a<=0)return i;i=await $s(s,e,t,a)}return i},Rm=Xd(Fs(),Fs()),Xo=_r({url:Fs(),values:Rm}),Em=(s={})=>Object.entries(s).map(([e,t])=>({id:crypto.randomUUID(),name:e,value:t})),Pr=s=>{const e=new Headers;for(const{name:t,value:r}of s){const o=t.trim();o&&r.trim()&&o.toLowerCase()!=="authorization"&&e.set(o,r.trim())}return Object.fromEntries(e)},hs=(s,e)=>e&&s.replace(/\/+$/,"")===e.url.replace(/\/+$/,"")?Pr(Object.entries(e.values).map(([t,r])=>({name:t,value:r}))):{},Pn="openchamber.mobile.connections.v1",Dr="openchamber.mobile.",Ei="openchamber.mobile.deviceId",Im=Fs().startsWith(`${Dr}headers.`),Tm=()=>{try{const s=window.localStorage.getItem(Ei);if(s&&s.trim())return s.trim();const e=crypto.randomUUID();return window.localStorage.setItem(Ei,e),e}catch{return crypto.randomUUID()}},Ii=()=>`mobile:${Tm()}`,Ti=()=>{try{const s=Jd.getPlatform();return s==="ios"||s==="android"?s:void 0}catch{return}},Yo=12,Or=8e3,_m=2500,Am=3e3,Dn=2500,Pm=()=>{let s=0;return{begin:()=>(s+=1,s),cancel:()=>{s+=1},isCurrent:e=>e===s}},bs=s=>{const e=s.trim();if(!e)return"";const t=/^https?:\/\//i.test(e)?e:`http://${e}`,r=new URL(t);return r.hash="",r.search="",r.pathname=r.pathname.replace(/\/+$/,""),r.toString().replace(/\/+$/,"")},Tn=s=>{try{return new URL(s).host}catch{return s}},Ws=s=>{try{return bs(s)}catch{return s.trim().replace(/\/+$/g,"")}},Qo=(s,e)=>Ws(s)===Ws(e),Zo=s=>`relay:${s.serverId}@${s.relayUrl.trim()}`,Dm=s=>`relay://${s.serverId}`,fn=s=>s.candidates.filter(e=>e.kind==="direct"),gs=s=>{const e=s.candidates.find(t=>t.kind==="relay");return e&&e.kind==="relay"?e.relay:null},Zt=s=>{const e=fn(s)[0];if(e)return e.url;const t=gs(s);return t?Dm(t):""},_i=s=>s.serverId||gs(s)?.serverId||null,It=s=>{const e=gs(s);if(e)return Zo(e);if(s.serverId)return`server:${s.serverId}`;const t=fn(s)[0];return t?Ws(t.url):""},Ai=(s,e)=>{const t=_i(s),r=_i(e);return t&&r?t===r:ea(s.candidates,e.candidates)},ea=(s,e)=>{const t=s.find(i=>i.kind==="relay"),r=t&&t.kind==="relay"?t.relay.serverId:null,o=new Set(s.filter(i=>i.kind==="direct").map(i=>Ws(i.url)));return e.some(i=>i.kind==="relay"?r!==null&&i.relay.serverId===r:o.has(Ws(i.url)))},Mr=s=>{const e=(()=>{try{return bs(s)}catch{return""}})();return e?[{kind:"direct",url:e}]:[]},Pi=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(...Mr(s.url)),s.relay&&e.push({kind:"relay",relay:s.relay}),e},Lr=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 r=t;return r.kty!=="EC"||r.crv!=="P-256"||typeof r.x!="string"||!r.x||typeof r.y!="string"||!r.y?null:{relayUrl:e.relayUrl,serverId:e.serverId,hostEncPubJwk:{kty:"EC",crv:"P-256",x:r.x,y:r.y}}},ta=s=>{try{return JSON.stringify(s)}catch{return String(s)}},De=(s,e={})=>{const t=ta(e);console.info("[mobile-connect]",s,t),Ar(s,t)},rn=(s,e={})=>{De(s,e)},Ks=(s,e={})=>{const t=ta(e);console.info("[mobile-storage]",s,t),Ar(s,t)},Om=s=>{if(typeof s!="string")return s;try{return JSON.parse(s)}catch{return s}},Mm=s=>{if(typeof s!="string")return s??void 0;try{return JSON.parse(s)}catch{return s}},Lm=async(s,e)=>{if(!ct())return null;try{const{CapacitorHttp:t}=await dn(async()=>{const{CapacitorHttp:i}=await import("./vendor-capacitor-core-B4EWRrHz.js");return{CapacitorHttp:i}},[]),r=Qa(s,new Headers(e?.headers)),o=await t.request({url:s,method:e?.method||"GET",headers:Object.fromEntries(r.entries()),data:Mm(e?.body),disableRedirects:e?.redirect==="error"});return{ok:o.status>=200&&o.status<300,status:o.status,source:"native-http",json:async()=>Om(o.data)}}catch(t){return De("native-http:failed",{url:s,error:t instanceof Error?t.message:String(t)}),null}},zm=async(s,e)=>{const t=await fetch(s,e).catch(r=>(De("browser-fetch:failed",{url:s,error:r instanceof Error?r.message:String(r)}),null));return t?{ok:t.ok,status:t.status,source:"browser-fetch",json:()=>t.json()}:null},On=async(s,e,t)=>{let r;const o=new Promise(i=>{r=window.setTimeout(()=>{t?.(),i(null)},s)});try{return await Promise.race([e,o])}catch{return null}finally{r!==void 0&&window.clearTimeout(r)}},Is=async(s,e,t)=>{const r=t?.totalTimeoutMs??Or,o=Date.now(),i=await On(Math.min(_m,r),Lm(s,e));if(i)return i;const l=new AbortController,a=Math.max(500,r-(Date.now()-o));return On(a,zm(s,{...e,signal:l.signal}),()=>l.abort())},Bn=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}},sa=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},Vs=15e3,Hs=s=>{s?.owned&&s.client.close()},Di=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 Bn(s);return t&&t.disabled!==!0&&t.authenticated===!1?e?"auth-failed":"needs-login":"ok"},Bm=async(s,e,t,r=Vs,o)=>{const i=e?{Authorization:`Bearer ${e}`}:void 0,l=aa(s);if(l){const{response:d,failure:c}=await $s(l,"/auth/session",{headers:i},r);if(De("relay:session",{shared:!0,ok:d?.ok===!0,status:d?.status??null,hasToken:!!e,error:c}),d){const u=await Di(d,e);return u==="ok"&&o?.keepTunnel?{outcome:u,tunnel:{client:l,owned:!1}}:{outcome:u}}}const a=fo({relayUrl:s.relayUrl,serverId:s.serverId,hostEncPubJwk:s.hostEncPubJwk});try{const{response:d,failure:c}=await Jo(a,"/auth/session",{headers:i},r);De("relay:session",{shared:!1,ok:d?.ok===!0,status:d?.status??null,hasToken:!!e,error:c});const u=d?await Di(d,e):zn(a.getStatus())?"relay-limit":"unreachable";return u==="ok"&&o?.keepTunnel?{outcome:u,tunnel:{client:a,owned:!0}}:(a.close(),{outcome:u})}catch(d){throw a.close(),d}},Fm=(s,e,t,r,o)=>{const i=typeof window<"u"?window.location.origin:"",l={relayUrl:s.relayUrl,serverId:s.serverId,hostEncPubJwk:s.hostEncPubJwk,...t?{grant:t}:{}};o&&Xa(l,o),Ds({apiBaseUrl:i,clientToken:e,runtimeKey:r??Zo(s),relay:l})},$m=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=Lr(e.relay);return t?{kind:"relay",relay:t}:null}return null},Wm=s=>{if(s.mode==="relay"){const e=Lr(s.relay);return e?[{kind:"relay",relay:e}]:[]}return typeof s.url=="string"?Mr(s.url):[]},xs=()=>{if(typeof window>"u")return[];let s;try{s=JSON.parse(window.localStorage.getItem(Pn)||"[]")}catch{return[]}if(!Array.isArray(s))return[];const e=ct();return s.flatMap(t=>{if(!t||typeof t!="object")return[];const r=t;if(typeof r.id!="string")return[];const o=Array.isArray(r.candidates)?r.candidates.map($m).filter(d=>!!d):Wm(r);if(o.length===0)return[];const i=typeof r.clientToken=="string"&&r.clientToken.trim()?r.clientToken:void 0,l=typeof r.label=="string"&&r.label.trim()?r.label:Tn(Zt({candidates:o})),a={id:r.id,label:l,candidates:o,serverId:typeof r.serverId=="string"&&r.serverId.trim()?r.serverId:void 0,lastUsedAt:typeof r.lastUsedAt=="number"?r.lastUsedAt:0,requestHeadersKey:e?Im.safeParse(r.requestHeadersKey).data:void 0,requestHeaders:e?void 0:Xo.safeParse(r.requestHeaders).data};return e?[{...a,hasToken:!!r.hasToken||!!i}]:[{...a,clientToken:i,hasToken:!!i}]}).sort((t,r)=>r.lastUsedAt-t.lastUsedAt)},br=s=>s.kind==="relay"?{kind:"relay",relay:{relayUrl:s.relay.relayUrl,serverId:s.relay.serverId,hostEncPubJwk:s.relay.hostEncPubJwk}}:{kind:"direct",url:s.url},na=s=>{if(typeof window>"u")return!1;const e=ct(),t=s.slice(0,Yo).map(r=>{const o={id:r.id,label:r.label,candidates:r.candidates.map(br),serverId:r.serverId,lastUsedAt:r.lastUsedAt};return e?{...o,hasToken:!!(r.hasToken||r.clientToken),requestHeadersKey:r.requestHeadersKey}:{...o,clientToken:r.clientToken,requestHeaders:r.requestHeaders}});try{return window.localStorage.setItem(Pn,JSON.stringify(t)),!0}catch(r){return console.warn("[mobile-storage] failed to persist connection metadata",r),!1}},Km=(s,e)=>{const t=(e.id?s.find(i=>i.id===e.id):void 0)??s.find(i=>Ai(i,e)),r=ct(),o={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(),...r?{hasToken:e.hasToken??(!!e.clientToken||t?.hasToken||!1)}:{clientToken:e.clientToken??t?.clientToken,hasToken:!!(e.clientToken??t?.clientToken)}};return[o,...s.filter(i=>i.id!==o.id&&!Ai(i,o))].slice(0,Yo)},Gs=Gd,ra=0,zr=s=>`${Dr}token.${encodeURIComponent(s)}`,Fn=async(s,e)=>{let t;const r=new Promise(o=>{t=window.setTimeout(()=>o(e),Am)});try{return await Promise.race([s.catch(()=>e),r])}finally{t!==void 0&&window.clearTimeout(t)}},Br=async(s,e,t)=>ct()?Fn(e().catch(r=>(console.warn(`[mobile-storage] ${s} failed`,r),t)),t):t,mn=async s=>{Ks("secure:read-start",{key:s});const e=await Br("secure:read",async()=>(await Gs.internalGetItem({prefixedKey:zr(s),sync:!1})).data,null),t=typeof e=="string"&&e.trim()?e:void 0;return Ks("secure:read",{key:s,hasToken:!!t}),t},Ss=async(s,e)=>{Ks("secure:write-start",{key:s});const t=await Br("secure:write",async()=>(await Gs.internalSetItem({prefixedKey:zr(s),data:e,sync:!1,access:ra}),!0),!1);return Ks("secure:write",{key:s,ok:t}),t},Vm=async s=>{await Br("secure:delete",async()=>(await Gs.internalRemoveItem({prefixedKey:zr(s),sync:!1}),!0),!1)};class Ts extends Error{constructor(){super("Mobile header storage unavailable")}}const $n=async s=>{if(!s)return;if(!ct())return s.requestHeaders;const e=s.requestHeadersKey;if(!e)return;const t=await Fn(Gs.internalGetItem({prefixedKey:e,sync:!1}).then(r=>r.data),null);if(!t)throw new Ts;try{const r=Xo.parse(JSON.parse(t));return bs(r.url),hs(r.url,r),r}catch{throw new Ts}},Hm=async s=>$n(xs().find(e=>e.id===s)),xr=async s=>{await Fn(Gs.internalRemoveItem({prefixedKey:s,sync:!1}),null)},Oi=async(s,e,t)=>{if(s.requestHeaders===void 0)return $n(t);const r=bs(s.url||Zt({candidates:e})),o=hs(r,{url:r,values:s.requestHeaders});return Object.keys(o).length?{url:r,values:o}:void 0},Um=async(s,e)=>{let t=0,r=0;return{records:await Promise.all(s.map(async i=>{if(!i||typeof i!="object")return i;const l=i,a=typeof l.url=="string"?l.url:null,d=typeof l.clientToken=="string"?l.clientToken.trim():"";if(!a||!d)return i;if(!await e(a,d))return r+=1,i;t+=1;const{clientToken:c,...u}=l;return{...u,hasToken:!0}})),migrated:t,failed:r}},ia=async()=>{if(typeof window>"u"||!ct())return;let s;try{s=JSON.parse(window.localStorage.getItem(Pn)||"[]")}catch{return}if(!Array.isArray(s))return;const e=s.filter(r=>!!r&&typeof r=="object"&&typeof r.url=="string"&&typeof r.clientToken=="string"&&!!r.clientToken.trim());if(e.length===0)return;Ks("secure:migrate-start",{count:e.length});const t=await Um(s,async(r,o)=>{const i=Ws(r);return await Ss(i,o)?await mn(i)===o:!1});if(t.migrated>0)try{window.localStorage.setItem(Pn,JSON.stringify(t.records))}catch(r){console.warn("[mobile-storage] failed to finalize secure token migration",r);return}Ks("secure:migrate-done",{migrated:t.migrated,failed:t.failed})},qm=async()=>(await ia(),xs()),oa=async s=>{let e;if(ct()&&s.requestHeaders){const o=`${Dr}headers.${crypto.randomUUID()}`;if(!await Fn(Gs.internalSetItem({prefixedKey:o,data:JSON.stringify(s.requestHeaders),sync:!1,access:ra}).then(()=>!0),!1))throw new Ts;e=o}const t=xs(),r=Km(t,s);if(s.requestHeaders!==void 0&&(r[0].requestHeadersKey=e,r[0].requestHeaders=ct()?void 0:s.requestHeaders??void 0),!na(r))throw e&&await xr(e),new Ts;for(const o of t)o.requestHeadersKey&&!r.some(i=>i.requestHeadersKey===o.requestHeadersKey)&&await xr(o.requestHeadersKey);return r},Mn=async s=>{const e=await oa(s);return ct()&&s.clientToken&&await Ss(It(e[0]),s.clientToken),e},Gm=async s=>{const e=xs(),t=e.find(o=>o.id===s)??null,r=e.filter(o=>o.id!==s);if(!na(r))throw new Ts;return t?.requestHeadersKey&&await xr(t.requestHeadersKey),t&&ct()&&await Vm(It(t)),r},Jm=1500,Ln=async(s,e,t)=>{const r=t?.fast?{totalTimeoutMs:Dn}:void 0,o=gs({candidates:s})?.serverId??null,i=s.find(c=>c.kind==="relay")??null,l=s.filter(c=>c.kind==="direct"),a=async()=>{for(const c of l){const u=bs(c.url)||c.url,p=hs(u,t?.requestHeaders),h=Object.keys(p).length?"error":void 0;e&&(p.Authorization=`Bearer ${e}`);const f=await Is(`${u}/health`,{method:"GET",headers:hs(u,t?.requestHeaders),redirect:h},r);if(De("probe:direct:health",{url:u,ok:f?.ok===!0,status:f?.status??null,source:f?.source??null}),!f?.ok)continue;if(o){const w=await sa(f);if(w&&w!==o){De("probe:server-id-mismatch",{url:u});continue}}const g=await Is(`${u}/auth/session`,{method:"GET",credentials:e?"omit":"include",headers:p,redirect:h},r);if(De("probe:direct:session",{url:u,ok:g?.ok===!0,status:g?.status??null,source:g?.source??null,hasToken:!!e}),g?.status===401)return{status:"needs-login"};if(!g||!g.ok&&g.status!==404)continue;const x=await Bn(g);if(x&&x.disabled!==!0&&x.authenticated===!1)return{status:"needs-login"};const b=x?.disabled===!0;return!e&&ct()&&!b&&x?.scope!=="client"?{status:"needs-login"}:{status:"ok",transport:{kind:"direct",url:u}}}return{status:"unreachable"}},d=async()=>{if(!i)return{status:"unreachable"};const{outcome:c,tunnel:u}=await Bm(i.relay,e,void 0,t?.fast?Dn:Or,{keepTunnel:!0});return c==="ok"?{status:"ok",transport:{kind:"relay",relay:i.relay,tunnel:u}}:c==="needs-login"||c==="auth-failed"?{status:"needs-login"}:c==="relay-limit"?{status:"relay-limit"}:{status:"unreachable"}};return i?l.length===0?d():new Promise(c=>{let u=!1,p=!1,h,f=null,g=null;const x=v=>{v?.status==="ok"&&v.transport.kind==="relay"&&Hs(v.transport.tunnel)},b=v=>{u||(u=!0,c(v))},w=()=>{p||u||(h!==void 0&&(window.clearTimeout(h),h=void 0),d().then(v=>{if(g=v,u||p){x(v);return}if(v.status==="ok"||v.status==="needs-login"){b(v);return}f&&b(v)}))};a().then(v=>{if(f=v,!u){if(v.status==="ok"||v.status==="needs-login"){p=!0,h!==void 0&&window.clearTimeout(h),x(g),b(v);return}if(g){b(g);return}w()}}),h=window.setTimeout(w,Jm)}):a()},ms=(s,e,t)=>{Fr=!1,s.kind==="relay"?Fm(s.relay,e,t?.grant,t?.runtimeKey,s.tunnel?.client):Ds({apiBaseUrl:s.url,clientToken:e,runtimeKey:t?.runtimeKey,requestHeaders:hs(s.url,t?.requestHeaders)}),ca()},js=()=>{const s=xs()[0];return s?.label?.trim()?s.label:null};let Fr=!1;const Xm=()=>{Fr=!0},on=async s=>{if(Fr)return De("auto-connect:suppressed",{}),{status:"no-candidate"};const e=s?.fast!==!1;await ia();const t=xs()[0];if(De("auto-connect:start",{hasCandidate:!!t,fast:e}),!t)return{status:"no-candidate"};let r;if(ct()){if(t.hasToken&&(r=await mn(It(t)),!r))return{status:"no-candidate"}}else if(r=t.clientToken,!r&&t.hasToken)return{status:"no-candidate"};let o;try{o=await $n(t)}catch{return{status:"unreachable",label:t.label}}const i=await Ln(t.candidates,r,{fast:e,requestHeaders:o});if(De("auto-connect:probe",{status:i.status,candidates:t.candidates.map(l=>l.kind)}),i.status==="needs-login")return{status:"needs-login",label:t.label};if(i.status==="relay-limit")return{status:"relay-limit",label:t.label};if(i.status!=="ok")return{status:"unreachable",label:t.label};if(s?.skipIfConnected&&Ft())return i.transport.kind==="relay"&&Hs(i.transport.tunnel),De("auto-connect:superseded",{}),{status:"no-candidate"};try{await Mn({id:t.id,label:t.label,candidates:t.candidates})}catch{return i.transport.kind==="relay"&&Hs(i.transport.tunnel),{status:"unreachable",label:t.label}}return ms(i.transport,r??null,{runtimeKey:It(t),requestHeaders:o}),{status:"connected"}},Ym=async(s,e)=>{let t="";try{t=bs(s.url)}catch{return!1}if(!t)return!1;const r=s.clientToken?.trim()||void 0,o=hs(t,s.requestHeaders),i=Object.keys(o).length?"error":void 0;r&&(o.Authorization=`Bearer ${r}`);const l=e?.fast?{totalTimeoutMs:Dn}:void 0;if(!(await Is(`${t}/health`,{method:"GET",headers:o,redirect:i},l))?.ok)return!1;const d=await Is(`${t}/auth/session`,{method:"GET",credentials:r?"omit":"include",headers:o,redirect:i},l);if(!d||!d.ok&&d.status!==404)return!1;const c=await Bn(d);return!(c&&c.disabled!==!0&&c.authenticated===!1)},Mi=(s,e)=>{s?.kind==="relay"&&s.owned&&!e&&s.tunnel.close()},Qm=(s,e)=>s.kty===e.kty&&s.crv===e.crv&&s.x===e.x&&s.y===e.y,aa=s=>{const e=uo(),t=Ya();return!e||!t||e.getStatus().state!=="connected"?null:t.relayUrl===s.relayUrl&&t.serverId===s.serverId&&Qm(t.hostEncPubJwk,s.hostEncPubJwk)?e:null},Zm=s=>[...s].sort((e,t)=>{const r=(e.priority??100)-(t.priority??100);if(r!==0)return r;const o=i=>i.type==="relay"?2:i.url.startsWith("https://")?0:1;return o(e)-o(t)}).flatMap(e=>{if(e.type==="relay"){const t=Lr({relayUrl:e.relayUrl,serverId:e.serverId,hostEncPubJwk:e.hostEncPubJwk});return t?[{kind:"relay",relay:t}]:[]}return Mr(e.url)}),Li=async(s,e)=>{let t=!1;const r=gs({candidates:s})?.serverId??null;for(const o of s){if(o.kind==="relay"){const c=aa(o.relay);if(c){const f=await $s(c,"/health",void 0,Or);if(De("establish:relay:health",{shared:!0,ok:f.response?.ok===!0,status:f.response?.status??null,error:f.failure}),f.response?.ok)return{kind:"relay",relay:o.relay,tunnel:c,owned:!1}}const u=fo(o.relay),{response:p,failure:h}=await Jo(u,"/health",void 0,Vs);if(De("establish:relay:health",{shared:!1,ok:p?.ok===!0,status:p?.status??null,error:h}),p?.ok)return{kind:"relay",relay:o.relay,tunnel:u,owned:!0};t||=zn(u.getStatus()),u.close();continue}const i=bs(o.url)||o.url,l=hs(i,e),a=await Is(`${i}/health`,{method:"GET",headers:l,redirect:Object.keys(l).length?"error":void 0});if(De("establish:direct:health",{ok:a?.ok===!0,status:a?.status??null}),!a?.ok)continue;const d=await sa(a);if(r&&d&&d!==r){De("establish:server-id-mismatch",{url:i});continue}return{kind:"direct",url:i,serverId:d}}return t?"relay-limit":null},ep=async(s,e)=>{if(!zs())return await Ym(s,e)?"valid":"invalid";const t=await On(e?.fast?Dn:Vs,co("/auth/session").then(o=>o).catch(()=>null));if(!t)return zn(uo()?.getStatus())?"relay-limit":"valid";if(t.status===401)return"invalid";if(!t.ok&&t.status!==404)return"valid";const r=await Bn(t);return r&&r.disabled!==!0&&r.authenticated===!1?"invalid":"valid"},tp=s=>s.kind==="relay"?zs():!zs()&&Qo(s.url,Ft()),la=()=>{const s=qs();return s?xs().find(e=>It(e)===s)??null:null},yr=s=>{const e=qs();return!!e&&It(s)===e},_n=async s=>{const e=s?.fast!==!1,t=la();if(!t)return De("reprobe:no-connection",{runtimeKey:!!qs()}),"no-connection";let r;if(ct()?r=t.hasToken?await mn(It(t)):void 0:r=t.clientToken,!r&&t.hasToken)return De("reprobe:no-token",{hasToken:!0}),"unreachable";De("reprobe:start",{candidates:t.candidates.map(p=>p.kind),fast:e,hasToken:!!r});const o=t.candidates.findIndex(p=>tp(p.kind==="relay"?{kind:"relay",relay:p.relay}:{kind:"direct",url:p.url})),i=o>=0?t.candidates.slice(0,o):t.candidates;let l;try{l=await $n(t)}catch{return"unreachable"}const a=await Ln(i,r,{fast:e,requestHeaders:l});if(De("reprobe:better",{status:a.status,probed:i.length}),a.status==="ok"){try{await Mn({id:t.id,label:t.label,candidates:t.candidates})}catch{return a.transport.kind==="relay"&&Hs(a.transport.tunnel),"unreachable"}return ms(a.transport,r??null,{runtimeKey:It(t),requestHeaders:l}),"switched"}if(a.status==="needs-login")return"needs-login";let d=null;if(o>=0&&(d=await ep({url:Ft(),clientToken:r,requestHeaders:l},{fast:e}),De("reprobe:current",{current:d}),d==="valid"))return ca(),"unchanged";const c=o>=0?t.candidates.slice(o+1):[],u=await Ln(c,r,{fast:e,requestHeaders:l});if(De("reprobe:fallback",{status:u.status,probed:c.length}),u.status==="ok"){try{await Mn({id:t.id,label:t.label,candidates:t.candidates})}catch{return u.transport.kind==="relay"&&Hs(u.transport.tunnel),"unreachable"}return ms(u.transport,r??null,{runtimeKey:It(t),requestHeaders:l}),"switched"}return u.status==="needs-login"?"needs-login":[a.status,u.status,d].includes("relay-limit")?"relay-limit":"unreachable"},sp=5e3;let tr=!1;const np=async()=>{if(tr)return"skipped";const s=la();if(!s)return De("candidates:refresh-skip",{reason:"no-active-connection"}),"skipped";const e=gs(s);if(!e)return De("candidates:refresh-skip",{reason:"no-relay-candidate"}),"skipped";tr=!0;try{const t=await On(Vs,co("/api/client-auth/connection/candidates").then(c=>c).catch(()=>null));if(!t?.ok)return De("candidates:refresh-skip",{reason:"fetch-failed",status:t?.status??null}),"skipped";const r=await t.json().catch(()=>null);if(!r||r.serverId!==e.serverId)return De("candidates:refresh-skip",{reason:"server-id-mismatch"}),"skipped";const o=Array.isArray(r.candidates)?r.candidates:[],i=[];for(const c of o){if(!c||typeof c!="object")continue;const u=c;if(!(u.type!=="lan"||typeof u.url!="string"))try{const p=bs(u.url);p&&!i.includes(p)&&i.push(p)}catch{}}if(i.length===0)return De("candidates:refresh-skip",{reason:"no-lan-reported"}),"skipped";const l=fn(s).filter(c=>c.url.startsWith("https://")),a=[...i.map(c=>({kind:"direct",url:c})),...l,{kind:"relay",relay:e}];return JSON.stringify(s.candidates.map(br))===JSON.stringify(a.map(br))?"unchanged":(De("candidates:refreshed",{lanCount:i.length}),await Mn({id:s.id,label:s.label,candidates:a}),"updated")}finally{tr=!1}},ca=()=>{typeof window>"u"||window.setTimeout(()=>{(async()=>{const s=await np().catch(()=>"skipped");De("candidates:refresh-result",{result:s}),s==="updated"&&zs()&&await _n().catch(()=>null)})()},sp)},ua=s=>{const{t:e}=ge(),[t,r]=m.useState(()=>xs()),[o,i]=m.useState(null),[l,a]=m.useState(null),[d,c]=m.useState(null),u=m.useRef(t),p=m.useRef(null),h=m.useRef(Pm()),f=m.useCallback(k=>{u.current=k,r(k)},[]),g=m.useCallback(k=>{p.current=k,i(k)},[]),x=m.useCallback(k=>{p.current===k&&(p.current=null,i(null))},[]);m.useEffect(()=>{let k=!1;return qm().then(S=>{k||f(S)}),()=>{k=!0}},[f]);const b=m.useCallback(async k=>{const S=await oa(k);return f(S),S},[f]),w=m.useCallback(async k=>{a(null),g("connect");let S;try{const N=Pi(k);if(N.length===0){a(e("mobile.connect.error.urlRequired"));return}const M=k.id?u.current.find($=>$.id===k.id):u.current.find($=>ea($.candidates,N)),B=k.label?.trim()||M?.label||Tn(Zt({candidates:N})),O=await Oi(k,N,M),C=k.requestHeaders===void 0?void 0:O??null,L=k.relayGrant,I=It({candidates:N,serverId:M?.serverId});let j=k.clientToken?.trim()||void 0;const R=!!j;j||(ct()?M?.hasToken&&(j=await mn(I)):j=M?.clientToken),De("connect:start",{candidates:N.map($=>$.kind),hasToken:!!j});const T=await Ln(N,j,{requestHeaders:O});if(T.status==="ok"&&T.transport.kind==="relay"&&(S=T.transport.tunnel),De("connect:probe",{status:T.status}),T.status==="unreachable"){a(e("mobile.connect.error.unreachable"));return}if(T.status==="relay-limit"){a(e("mobile.connect.error.relayLimit"));return}if(T.status==="needs-login"){const $=await b({id:M?.id,label:B,candidates:N,requestHeaders:C});c({id:$[0].id,label:B,candidates:N,serverId:M?.serverId,relay:gs({candidates:N})??void 0,relayGrant:L,requestHeaders:O});return}j&&R&&ct()&&await Ss(I,j),await b({id:M?.id,label:B,candidates:N,clientToken:j,requestHeaders:C}),ms(T.transport,j??null,{runtimeKey:I,grant:L,requestHeaders:O}),S=void 0,s()}catch(N){console.warn("[mobile-connect] connect threw",N),a(e(N instanceof Ts?"mobile.connect.headers.error":"mobile.connect.error.invalidUrl"))}finally{Hs(S),x("connect")}},[g,x,s,b,e]),v=m.useCallback(async k=>{if(p.current==="pairing")return;a(null),g("pairing");const S=Zm(k.candidates);let N=null,M=!1;try{const B=await Li(S);if(!B||B==="relay-limit"){a(e(B?"mobile.connect.error.relayLimit":"mobile.connect.error.unreachable"));return}N=B;const O=JSON.stringify({pairingId:k.pairingId,secret:k.secret,clientLabel:"OpenChamber Mobile",clientKind:"mobile",deviceName:"OpenChamber Mobile",devicePlatform:Ti(),dedupeKey:Ii()}),C={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:O},L=N.kind==="relay"?await $s(N.tunnel,"/api/client-auth/pairing/redeem",C,Vs):{response:await Is(`${N.url}/api/client-auth/pairing/redeem`,C),failure:null},I=L.response;if(De("pairing:redeem",{transport:N.kind,ok:I?.ok===!0,status:I?.status??null,error:L.failure}),!I?.ok){a(e("mobile.connect.error.authRequired"));return}const j=await I.json().catch(()=>null),R=typeof j?.clientToken=="string"?j.clientToken.trim():"";if(!R){a(e("mobile.connect.error.authRequired"));return}const T=typeof j?.server?.label=="string"?j.server.label:"",$=k.label||T||Tn(Zt({candidates:S})),W=N.kind==="direct"?N.serverId:void 0,q=It({candidates:S,serverId:W});if(ct()&&!await Ss(q,R)){a(e("mobile.connect.error.authRequired"));return}await b({label:$,candidates:S,serverId:W,clientToken:R}),ms(N.kind==="relay"?{kind:"relay",relay:N.relay,tunnel:{client:N.tunnel,owned:N.owned}}:{kind:"direct",url:N.url},R,{runtimeKey:q}),M=N.kind==="relay",s()}catch(B){console.warn("[mobile-connect] pairing threw",B),a(e("mobile.connect.error.authRequired"))}finally{Mi(N,M),x("pairing")}},[g,x,s,b,e]),E=m.useCallback(async k=>{if(!d||!k.trim()||p.current==="password")return;a(null),g("password");const S=h.current.begin(),N=()=>h.current.isCurrent(S),{id:M,label:B,candidates:O,serverId:C,requestHeaders:L}=d,I=It({candidates:O,serverId:C});let j=null,R=!1;try{const T=await Li(O,L);if(T!=="relay-limit"&&(j=T),!N())return;if(!j){a(e(T==="relay-limit"?"mobile.connect.error.relayLimit":"mobile.connect.error.unreachable"));return}const $={};j.kind==="direct"&&Object.assign($,hs(j.url,L));const W=Object.keys($).length?"error":void 0;$["Content-Type"]="application/json",$.Accept="application/json";const q={method:"POST",credentials:"include",headers:$,redirect:W,body:JSON.stringify({password:k,trustDevice:!0,issueClientToken:!0,clientLabel:"OpenChamber Mobile",clientKind:"mobile",devicePlatform:Ti(),dedupeKey:Ii()})};De("password:start",{transport:j.kind});const D=j.kind==="relay"?await $s(j.tunnel,"/auth/session",q,Vs):{response:await Is(`${j.url}/auth/session`,q),failure:null},z=D.response;if(!N())return;if(De("password:done",{ok:z?.ok===!0,status:z?.status??null,error:D.failure}),!z?.ok){a(e("mobile.connect.error.passwordFailed"));return}const J=await z.json().catch(()=>null);if(!N())return;const ee=typeof J?.clientToken=="string"?J.clientToken.trim():"";if(De("password:token",{issued:!!ee}),!ee){if(j.kind==="direct"&&!ct()){if(await b({id:M,label:B,candidates:O}),!N())return;c(null),ms({kind:"direct",url:j.url},null,{runtimeKey:I,requestHeaders:L}),s();return}a(e("mobile.connect.error.authRequired"));return}if(ct()&&(!N()||(await Ss(I,ee),!N()))||!N()||(await b({id:M,label:B,candidates:O,clientToken:ee}),!N())||(c(null),ms(j.kind==="relay"?{kind:"relay",relay:j.relay,tunnel:{client:j.tunnel,owned:j.owned}}:{kind:"direct",url:j.url},ee,{runtimeKey:I,requestHeaders:L}),R=j.kind==="relay",!N()))return;s()}catch(T){if(!N())return;console.warn("[mobile-connect] password threw",T),a(e(T instanceof Ts?"mobile.connect.headers.error":"mobile.connect.error.passwordFailed"))}finally{Mi(j,R),N()&&x("password")}},[g,x,s,d,b,e]),P=m.useCallback(()=>{h.current.cancel(),x("password"),c(null),a(null)},[x]),_=m.useCallback(async k=>{a(null);let S=Pi(k);const N=k.id?u.current.find(C=>C.id===k.id)??null:null;if(N){const C=S.filter(j=>j.kind==="direct"),L=fn(N).filter(j=>j.url.startsWith("https://")&&!C.some(R=>Qo(R.url,j.url))),I=gs(N);S=[...C,...L,...I?[{kind:"relay",relay:I}]:[]]}if(S.length===0)return a(e("mobile.connect.error.urlRequired")),null;const M=k.clientToken?.trim()||void 0,B=fn({candidates:S}).length===0&&N?N.label:Tn(Zt({candidates:S})),O=k.label?.trim()||B;if(ct()){const C=It({candidates:S,serverId:N?.serverId});if(M)await Ss(C,M);else if(N?.hasToken){const L=It(N);if(L&&C&&L!==C){const I=await mn(L);I&&await Ss(C,I)}}}try{const C=k.requestHeaders===void 0?void 0:await Oi(k,S,N??void 0)??null,L=await b({id:k.id,label:O,candidates:S,clientToken:M,requestHeaders:C});return N&&yr(N)&&!zs()&&k.requestHeaders!==void 0&&ms({kind:"direct",url:Ft()},Ja()||null,{runtimeKey:qs(),requestHeaders:C??void 0}),L[0]??null}catch{return a(e("mobile.connect.headers.error")),null}},[b,e]),A=m.useCallback(async k=>{const S=u.current.find(N=>N.id===k)??null;try{const N=await Gm(k);return f(N),S}catch{return a(e("mobile.connect.headers.error")),null}},[f,e]);return{connections:t,isBusy:o!==null,isPasswordBusy:o==="password",error:l,pendingConnection:d,connect:w,redeemPairingConnection:v,submitPassword:E,cancelPassword:P,saveConnection:_,removeConnection:A,setError:a}},da=s=>{const e=ne.c(31),{onClose:t}=s,{t:r}=ge(),[o,i]=m.useState(!1);let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=jm(),e[0]=l):l=e[0];const a=l;let d;e[1]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{bo(Sm()).then(k=>{k.ok&&(i(!0),window.setTimeout(()=>i(!1),2e3))})},e[1]=d):d=e[1];const c=d;let u;e[2]!==r?(u=r("mobile.connectionDebug.title"),e[2]=r,e[3]=u):u=e[3];let p;e[4]!==u?(p=n.jsx("h2",{className:"min-w-0 truncate typography-ui-label text-foreground",children:u}),e[4]=u,e[5]=p):p=e[5];const h=o?"check":"file-copy";let f;e[6]!==h?(f=n.jsx(G,{name:h,className:"size-4"}),e[6]=h,e[7]=f):f=e[7];let g;e[8]!==o||e[9]!==r?(g=r(o?"mobile.connectionDebug.copied":"mobile.connectionDebug.copy"),e[8]=o,e[9]=r,e[10]=g):g=e[10];let x;e[11]!==f||e[12]!==g?(x=n.jsxs(Ee,{type:"button",variant:"outline",size:"sm",onClick:c,disabled:a.length===0,children:[f,g]}),e[11]=f,e[12]=g,e[13]=x):x=e[13];let b;e[14]!==r?(b=r("mobile.connectionDebug.close"),e[14]=r,e[15]=b):b=e[15];let w;e[16]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx(G,{name:"close",className:"size-[18px]"}),e[16]=w):w=e[16];let v;e[17]!==t||e[18]!==b?(v=n.jsx(Ee,{type:"button",variant:"ghost",size:"icon","aria-label":b,onClick:t,children:w}),e[17]=t,e[18]=b,e[19]=v):v=e[19];let E;e[20]!==v||e[21]!==x?(E=n.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[x,v]}),e[20]=v,e[21]=x,e[22]=E):E=e[22];let P;e[23]!==E||e[24]!==p?(P=n.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-edge px-4 py-2.5",children:[p,E]}),e[23]=E,e[24]=p,e[25]=P):P=e[25];let _;e[26]!==r?(_=n.jsx(Ut,{outerClassName:"min-h-0 flex-1",className:"px-4 py-3",disableHorizontal:!0,children:a.length===0?n.jsx("p",{className:"typography-small text-muted-foreground",children:r("mobile.connectionDebug.empty")}):n.jsx("pre",{className:"whitespace-pre-wrap break-words typography-code text-muted-foreground",children:a.map(qo).join(`
|
|
4
4
|
`)})}),e[26]=r,e[27]=_):_=e[27];let A;return e[28]!==P||e[29]!==_?(A=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:[P,_]}),e[28]=P,e[29]=_,e[30]=A):A=e[30],A},fa=()=>{if(typeof window>"u")return null;const e=window.Capacitor?.Plugins?.BarcodeScanner;return e&&(typeof e.scan=="function"||typeof e.startScan=="function")?e:null},rp=()=>window.Capacitor?.getPlatform?.()==="android",ma=s=>{const e=s.trim();if(!e)return null;if(/^openchamber:\/\//i.test(e)){const t=Za(e);return t?{pairing:t}:null}return/^https?:\/\//i.test(e)?{url:e}:null},pa=(s,e)=>{const t=ma(s);if(!t&&e?.pairingStringFallback){const r=el(s);if(r)return{status:"pairing",pairing:r}}return t?"pairing"in t?{status:"pairing",...t}:{status:"ok",...t}:{status:"invalid"}},ip=async(s,e)=>{if(!s.startScan||!s.stopScan||!s.addListener)return{status:"unsupported"};if(e?.aborted)return{status:"cancelled"};let t,r,o=!1,i=()=>{};const l=new Promise(c=>{i=c}),a=c=>{o||(o=!0,i(c))},d=()=>a({status:"cancelled"});e?.addEventListener("abort",d,{once:!0});try{return(await Promise.allSettled([Promise.resolve(s.addListener("barcodesScanned",({barcodes:u})=>{const p=u?.[0],h=(p?.rawValue??p?.displayValue??"").trim();h&&a(pa(h,{pairingStringFallback:!0}))})).then(u=>{t=u}),Promise.resolve(s.addListener("scanError",()=>a({status:"failed"}))).then(u=>{r=u})])).some(({status:u})=>u==="rejected")?a({status:"failed"}):o||s.startScan({formats:["QR_CODE"]}).catch(()=>a({status:"failed"})),await l}finally{e?.removeEventListener("abort",d),await Promise.allSettled([Promise.resolve(t?.remove()),Promise.resolve(r?.remove()),s.stopScan()])}},vr=()=>fa()!==null,ha=async s=>{const e=fa();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(rp())return ip(e,s?.signal);if(!e.scan)return{status:"unsupported"};const r=(await e.scan({formats:["QR_CODE"]}))?.barcodes?.[0],o=(r?.rawValue??r?.displayValue??"").trim();return o?pa(o):{status:"cancelled"}}catch{return{status:"failed"}}},ps={autoComplete:"off",autoCorrect:"off",spellCheck:!1},Ns="oc-surface-elevated h-12 w-full oc-raised oc-field rounded-[16px] bg-surface-elevated px-4 text-[16px] text-foreground outline-none placeholder:text-muted-foreground",ga=s=>{const e=ne.c(22),{onCancel:t}=s,{t:r}=ge(),o=m.useRef(null);let i,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=()=>{const w={value:document.documentElement.style.getPropertyValue("background-color"),priority:document.documentElement.style.getPropertyPriority("background-color")},v={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 E=new Map,P=A=>{!(A instanceof HTMLElement)||A===o.current||E.has(A)||(E.set(A,{opacity:A.style.opacity,pointerEvents:A.style.pointerEvents}),A.style.setProperty("opacity","0"),A.style.setProperty("pointer-events","none"))};Array.from(document.body.children).forEach(P);const _=new MutationObserver(A=>{A.forEach(k=>k.addedNodes.forEach(P))});return _.observe(document.body,{childList:!0}),()=>{_.disconnect(),E.forEach(op),w.value?document.documentElement.style.setProperty("background-color",w.value,w.priority):document.documentElement.style.removeProperty("background-color"),v.value?document.body.style.setProperty("background-color",v.value,v.priority):document.body.style.removeProperty("background-color")}},l=[],e[0]=i,e[1]=l):(i=e[0],l=e[1]),m.useLayoutEffect(i,l);let a,d;e[2]!==t?(a=()=>{const w=()=>{document.visibilityState==="hidden"&&t()};return document.addEventListener("visibilitychange",w),()=>document.removeEventListener("visibilitychange",w)},d=[t],e[2]=t,e[3]=a,e[4]=d):(a=e[3],d=e[4]),m.useEffect(a,d);let c;e[5]!==r?(c=r("mobile.connect.scanQr"),e[5]=r,e[6]=c):c=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=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":!0}),e[7]=u):u=e[7];let p;e[8]!==r?(p=r("mobile.connect.welcome.scanHint"),e[8]=r,e[9]=p):p=e[9];let h;e[10]!==p?(h=n.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-6",children:[u,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:p})]}),e[10]=p,e[11]=h):h=e[11];let f;e[12]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(G,{name:"close",className:"size-[18px]"}),e[12]=f):f=e[12];let g;e[13]!==r?(g=r("mobile.instances.cancelEdit"),e[13]=r,e[14]=g):g=e[14];let x;e[15]!==t||e[16]!==g?(x=n.jsxs(Ee,{type:"button",variant:"outline",size:"lg",className:"mx-auto min-h-12 w-full max-w-sm bg-background",onClick:t,children:[f,g]}),e[15]=t,e[16]=g,e[17]=x):x=e[17];let b;return e[18]!==x||e[19]!==c||e[20]!==h?(b=Ls.createPortal(n.jsxs("div",{ref:o,role:"dialog","aria-modal":"true","aria-label":c,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:[h,x]}),document.body),e[18]=x,e[19]=c,e[20]=h,e[21]=b):b=e[21],b},ba=()=>{const s=ne.c(6),{t:e}=ge();let t;s[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx(Os,{width:96,height:96,isAnimated:!0}),s[0]=t):t=s[0];let r;s[1]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx(G,{name:"loader-4",className:"size-[18px] animate-spin"}),s[1]=r):r=s[1];let o;s[2]!==e?(o=e("mobile.connect.connecting"),s[2]=e,s[3]=o):o=s[3];let i;return s[4]!==o?(i=Ls.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:[r,n.jsx("span",{children:o})]})]}),document.body),s[4]=o,s[5]=i):i=s[5],i};function op(s,e){e.style.opacity=s.opacity,e.style.pointerEvents=s.pointerEvents}const xa=s=>{const e=ne.c(27),{value:t,onChange:r,disabled:o}=s,{t:i}=ge();let l;e[0]!==i?(l=i("settings.remoteInstances.direct.headers.title"),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==l?(a=n.jsx("legend",{className:"px-1 typography-ui-label text-foreground",children:l}),e[2]=l,e[3]=a):a=e[3];let d;e[4]!==i?(d=i("mobile.connect.headers.hint"),e[4]=i,e[5]=d):d=e[5];let c;e[6]!==d?(c=n.jsx("p",{className:"px-1 typography-micro text-muted-foreground",children:d}),e[6]=d,e[7]=c):c=e[7];let u;e[8]!==r||e[9]!==i||e[10]!==t?(u=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",{...ps,dir:"ltr",autoCapitalize:"none",className:Ns,value:b.name,onChange:w=>r(t.map(v=>v.id===b.id?{...v,name:w.target.value}:v)),placeholder:i("settings.remoteInstances.direct.headers.field.namePlaceholder"),"aria-label":i("settings.remoteInstances.direct.headers.field.namePlaceholder"),pattern:"[!#$%&'*+.^_`\\|~0-9A-Za-z\\-]+",required:!!b.value}),n.jsx("input",{...ps,dir:"ltr",autoCapitalize:"none",className:Ns,type:"password",pattern:"[\\x20-\\x7E\\xA0-\\xFF]*",value:b.value,onChange:w=>r(t.map(v=>v.id===b.id?{...v,value:w.target.value}:v)),placeholder:i("settings.remoteInstances.direct.headers.field.valuePlaceholder"),"aria-label":i("settings.remoteInstances.direct.headers.field.valuePlaceholder"),required:!!b.name})]}),n.jsx(Ee,{type:"button",variant:"ghost",size:"lg",className:"min-h-11",onClick:()=>r(t.filter(w=>w.id!==b.id)),"aria-label":i("settings.remoteInstances.direct.headers.removeAria"),children:n.jsx(G,{name:"close",className:"size-5"})})]},b.id)),e[8]=r,e[9]=i,e[10]=t,e[11]=u):u=e[11];let p;e[12]!==r||e[13]!==t?(p=()=>r([...t,{id:crypto.randomUUID(),name:"",value:""}]),e[12]=r,e[13]=t,e[14]=p):p=e[14];let h;e[15]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(G,{name:"add",className:"size-5"}),e[15]=h):h=e[15];let f;e[16]!==i?(f=i("settings.remoteInstances.direct.headers.actions.add"),e[16]=i,e[17]=f):f=e[17];let g;e[18]!==p||e[19]!==f?(g=n.jsxs(Ee,{type:"button",variant:"outline",size:"lg",className:"min-h-11",onClick:p,children:[h,f]}),e[18]=p,e[19]=f,e[20]=g):g=e[20];let x;return e[21]!==o||e[22]!==a||e[23]!==c||e[24]!==u||e[25]!==g?(x=n.jsxs("fieldset",{className:"min-w-0 space-y-2",disabled:o,children:[a,c,u,g]}),e[21]=o,e[22]=a,e[23]=c,e[24]=u,e[25]=g,e[26]=x):x=e[26],x},ap=({onConnected:s,notice:e=null})=>{const{t}=ge(),r=ua(s),{connections:o,isBusy:i,isPasswordBusy:l,error:a,pendingConnection:d}=r,[c,u]=m.useState(""),[p,h]=m.useState(""),[f,g]=m.useState(""),[x,b]=m.useState([]),[w,v]=m.useState(!1),E=xo(w),[P,_]=m.useState(!1),A=m.useRef(null),k=m.useMemo(()=>vr(),[]),[S,N]=m.useState(()=>!vr()),[M,B]=m.useState(null),[O,C]=m.useState(""),[L,I]=m.useState(!1),j=Go(m.useCallback(()=>I(!0),[])),R=m.useCallback(D=>{D.preventDefault();const z=x.some(({name:J,value:ee})=>J.trim()||ee.trim())?Pr(x):void 0;r.connect({url:c,clientToken:f,label:p,requestHeaders:z})},[f,r,p,x,c]),T=m.useCallback(D=>{if(/^openchamber:\/\//i.test(D.trim())){const z=ma(D);if(z){if("pairing"in z){r.redeemPairingConnection(z.pairing);return}u(z.url),z.label&&h(z.label),z.clientToken&&g(z.clientToken);return}}u(D)},[r]),$=m.useCallback(async()=>{if(A.current||i)return;r.setError(null),v(!0);const D=new AbortController;A.current=D;try{const z=await ha({signal:D.signal});switch(A.current===D&&(A.current=null,v(!1)),z.status){case"ok":_(!0),u(z.url),z.label&&h(z.label),z.clientToken&&g(z.clientToken),await r.connect({url:z.url,clientToken:z.clientToken,label:z.label});break;case"pairing":_(!0),await r.redeemPairingConnection(z.pairing);break;case"permission-denied":r.setError(t("mobile.connect.scan.permissionDenied"));break;case"invalid":r.setError(t("mobile.connect.scan.invalid"));break;case"unsupported":r.setError(t("mobile.connect.scan.unsupported"));break;case"failed":r.setError(t("mobile.connect.scan.failed"));break;default:break}}finally{_(!1),A.current===D&&(A.current=null,v(!1))}},[r,i,t]);m.useEffect(()=>()=>A.current?.abort(),[]);const W=m.useCallback(D=>{D.preventDefault(),r.submitPassword(O)},[r,O]),q=m.useCallback(()=>{C(""),r.cancelPassword()},[r]);return n.jsxs(n.Fragment,{children:[w?n.jsx(ga,{onCancel:()=>A.current?.abort()}):null,P?n.jsx(ba,{}):null,L?n.jsx(da,{onClose:()=>I(!1)}):null,n.jsx("main",{className:"oc-keyboard-fill-screen flex min-h-dvh flex-col overflow-y-auto bg-background px-6 pb-[calc(var(--safe-area-inset-bottom,env(safe-area-inset-bottom,0px))+28px)] pt-[calc(var(--safe-area-inset-top,env(safe-area-inset-top,0px))+28px)] text-foreground",children:n.jsxs("div",{className:"m-auto flex w-full max-w-[360px] shrink-0 flex-col items-center gap-9 py-8",children:[n.jsxs("div",{className:"flex flex-col items-center gap-5 text-center",children:[n.jsx("span",{...j,className:"select-none",style:{touchAction:"manipulation"},children:n.jsx(Os,{width:72,height:72,className:"size-[72px]"})}),n.jsx("h1",{className:"typography-h2 text-foreground",children:t("mobile.connect.welcome.title")})]}),e?n.jsxs("div",{role:"status",className:"flex w-full items-center gap-3 rounded-[18px] border border-[color-mix(in_srgb,var(--status-warning)_35%,transparent)] bg-[color-mix(in_srgb,var(--status-warning)_10%,transparent)] px-3.5 py-3",children:[n.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-[12px] bg-[color-mix(in_srgb,var(--status-warning)_16%,transparent)] text-[var(--status-warning)]",children:n.jsx(G,{name:e.kind==="auth-expired"?"lock":"cloud-off",className:"size-[18px]"})}),n.jsx("p",{className:"min-w-0 flex-1 typography-small text-foreground",children:e.kind==="auth-expired"?t("mobile.connect.notice.authExpired",{label:e.label}):e.kind==="relay-limit"?t("mobile.connect.notice.relayLimit",{label:e.label}):t("mobile.connect.notice.unreachable",{label:e.label})})]}):null,d?n.jsxs("form",{className:"flex w-full flex-col gap-3",onSubmit:W,children:[n.jsxs("div",{className:"flex items-center gap-3 rounded-[18px] border border-edge bg-surface-elevated px-3.5 py-3",children:[n.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-[12px] bg-interactive-hover text-foreground",children:n.jsx(G,{name:"lock",className:"size-[18px]"})}),n.jsxs("div",{className:"min-w-0 text-start",children:[n.jsx("p",{className:"truncate typography-ui-label text-foreground",children:d.label}),n.jsx("p",{className:"truncate typography-small text-muted-foreground",children:d.candidates.some(D=>D.kind==="direct")?Zt(d):t("mobile.connect.relay.badge")})]})]}),n.jsx("input",{...ps,value:O,onChange:D=>C(D.target.value),placeholder:t("mobile.connect.password.placeholder"),"aria-label":t("mobile.connect.password.label"),type:"password",autoFocus:!0,className:Ns}),a?n.jsx("p",{className:"px-1 text-center typography-small text-[var(--status-error)]",children:a}):null,n.jsx(Ee,{type:"submit",size:"lg",className:"mt-1 h-12 w-full",disabled:l||!O.trim(),children:t(l?"mobile.connect.connecting":"mobile.connect.unlockButton")}),n.jsx(Ee,{type:"button",variant:"ghost",size:"sm",className:"w-full",onClick:q,children:t("mobile.connect.cancelPassword")})]}):n.jsxs("div",{className:"flex w-full flex-col gap-6",children:[k?n.jsxs("div",{className:"flex w-full flex-col gap-2",children:[n.jsxs(Ee,{type:"button",size:"lg",className:"h-12 w-full",onClick:()=>{$()},disabled:w||i,children:[n.jsx(G,{name:"scan-2",className:ie("size-[18px]",E)}),t(i?"mobile.connect.connecting":"mobile.connect.scanQr")]}),n.jsx("p",{className:"px-2 text-center typography-small text-muted-foreground",children:t("mobile.connect.welcome.scanHint")})]}):null,a&&!S?n.jsx("p",{className:"px-1 text-center typography-small text-[var(--status-error)]",children:a}):null,o.length>0?n.jsxs("section",{className:"flex w-full flex-col gap-2.5",children:[n.jsx("h2",{className:"text-center typography-micro uppercase tracking-[0.14em] text-muted-foreground",children:t("mobile.connect.saved.title")}),n.jsx("div",{className:"overflow-hidden rounded-[18px] border border-edge bg-surface-elevated",children:o.map(D=>{const z=M===D.id;return n.jsxs("button",{type:"button",disabled:i,className:"flex min-h-14 w-full items-center gap-3 border-b border-edge px-3.5 py-2.5 text-start last:border-b-0 hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring disabled:opacity-70",onClick:()=>{B(D.id),r.connect({id:D.id,candidates:D.candidates,clientToken:D.clientToken,label:D.label}).finally(()=>B(null))},children:[n.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-[12px] bg-interactive-hover text-foreground",children:n.jsx(G,{name:"server",className:"size-[18px]"})}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate typography-ui-label text-foreground",children:D.label}),n.jsx("span",{className:ie("block truncate typography-small",z?"text-foreground":"text-muted-foreground"),children:z?t("mobile.connect.connecting"):D.candidates.some(J=>J.kind==="direct")?Zt(D):t("mobile.connect.relay.badge")})]}),z?n.jsx(G,{name:"loader-4",className:"size-5 animate-spin text-muted-foreground"}):n.jsx(G,{name:"arrow-right-s",className:"size-5 text-muted-foreground"})]},D.id)})})]}):null,n.jsxs("div",{className:"flex w-full flex-col",children:[k?n.jsxs("button",{type:"button",onClick:()=>N(D=>!D),"aria-expanded":S,className:"mx-auto flex items-center gap-1 rounded-full px-2 py-1 typography-small text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[n.jsx("span",{children:t("mobile.connect.manual.toggle")}),n.jsx(G,{name:"arrow-down-s",className:ie("size-4 transition-transform duration-200",S&&"rotate-180")})]}):null,n.jsx("div",{className:"grid transition-[grid-template-rows] duration-200 ease-out",style:{gridTemplateRows:S?"1fr":"0fr"},children:n.jsx("div",{className:"min-h-0 overflow-hidden",children:n.jsxs("form",{className:"flex w-full flex-col gap-3 pt-3",onSubmit:R,children:[n.jsx("input",{...ps,value:c,onChange:D=>T(D.target.value),placeholder:t("mobile.connect.url.placeholder"),"aria-label":t("mobile.connect.url.label"),type:"url",inputMode:"url",autoCapitalize:"none",tabIndex:S?void 0:-1,className:ie(Ns,"text-center")}),n.jsx("input",{value:p,onChange:D=>h(D.target.value),placeholder:t("mobile.instances.label.placeholder"),"aria-label":t("mobile.instances.label.label"),autoComplete:"off",autoCapitalize:"words",autoCorrect:"off",spellCheck:!1,tabIndex:S?void 0:-1,className:ie(Ns,"text-center")}),n.jsx("input",{...ps,value:f,onChange:D=>g(D.target.value),placeholder:t("mobile.connect.token.placeholder"),"aria-label":t("mobile.connect.token.label"),tabIndex:S?void 0:-1,autoCapitalize:"none",className:ie(Ns,"text-center")}),n.jsx("p",{className:"px-1 text-center typography-micro text-muted-foreground",children:t("mobile.connect.token.hint")}),n.jsx(xa,{value:x,onChange:b,disabled:!S||i}),a?n.jsx("p",{className:"px-1 text-center typography-small text-[var(--status-error)]",children:a}):null,n.jsx(Ee,{type:"submit",variant:k?"outline":"default",size:"lg",className:"h-12 w-full",disabled:i||w||!c.trim(),children:t(i?"mobile.connect.connecting":"mobile.connect.connectButton")})]})})})]})]})]})})]})},lp=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"},cp=s=>{const e=ne.c(14),{groups:t,displayMode:r,timeFormatPreference:o,className:i}=s,{t:l}=ge();let a;e[0]!==i?(a=ie("space-y-1.5",i),e[0]=i,e[1]=a):a=e[1];let d;if(e[2]!==r||e[3]!==t||e[4]!==l||e[5]!==o){let u;e[7]!==r||e[8]!==l||e[9]!==o?(u=p=>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(yo,{providerId:p.providerId,className:"size-4 shrink-0"}),n.jsx("span",{className:"min-w-0 flex-1 truncate typography-ui-label font-medium text-foreground",children:p.providerName}),p.planLabel?n.jsx("span",{className:"shrink-0 typography-micro capitalize text-muted-foreground",children:p.planLabel}):null,p.status&&p.rows.length===0?n.jsx("span",{className:"shrink-0 truncate typography-micro text-muted-foreground",children:p.status}):null]}),p.rows.length>0?n.jsx("div",{className:"mt-1.5 space-y-1",children:p.rows.map(h=>{const f=r==="remaining"?h.window.remainingPercent:h.window.usedPercent,g=jl(h.window,f,l),x=kl(h.window.resetAt,h.window.resetAfterFormatted??h.window.resetAtFormatted,o);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:h.subtitle?`${h.subtitle} · ${h.label}`:h.label}),x?n.jsx("span",{className:"min-w-0 truncate typography-micro text-muted-foreground",children:x}):null]}),n.jsx("span",{className:ie("shrink-0 typography-ui-label font-semibold tabular-nums",lp(h.window)),children:g==="-"?"":g})]},h.key)})}):null,p.status&&p.rows.length>0?n.jsx("div",{className:"mt-1.5 typography-micro text-muted-foreground",children:p.status}):null]},p.providerId),e[7]=r,e[8]=l,e[9]=o,e[10]=u):u=e[10],d=t.map(u),e[2]=r,e[3]=t,e[4]=l,e[5]=o,e[6]=d}else d=e[6];let c;return e[11]!==a||e[12]!==d?(c=n.jsx("div",{className:a,children:d}),e[11]=a,e[12]=d,e[13]=c):c=e[13],c},zi=380,up=(s,e)=>{if(!s||typeof s!="object")return;const t=s[e];return typeof t=="number"&&Number.isFinite(t)?t:void 0},sr=s=>s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:String(s),dp="—",ya=s=>{const e=ne.c(20),{percentage:t}=s;let r,o,i,l,a,d,c;if(e[0]!==t){i=El(t??0)??0;const f=Il(t??0);o=f==="critical"?"var(--status-error)":f==="warn"?"var(--status-warning)":"var(--status-success)",r=2*Math.PI*7.5,l="0 0 18 18",a="size-[18px] -rotate-90",d="progressbar",c=t===null?void 0:Math.round(i),e[0]=t,e[1]=r,e[2]=o,e[3]=i,e[4]=l,e[5]=a,e[6]=d,e[7]=c}else r=e[1],o=e[2],i=e[3],l=e[4],a=e[5],d=e[6],c=e[7];let u;e[8]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx("circle",{cx:9,cy:9,r:7.5,fill:"none",stroke:"var(--interactive-border)",strokeWidth:3}),e[8]=u):u=e[8];let p;e[9]!==r||e[10]!==t||e[11]!==o||e[12]!==i?(p=t===null?null:n.jsx("circle",{cx:9,cy:9,r:7.5,fill:"none",stroke:o,strokeWidth:3,strokeLinecap:"round",strokeDasharray:r,strokeDashoffset:r*(1-i/100),className:"transition-[stroke-dashoffset,stroke] duration-300"}),e[9]=r,e[10]=t,e[11]=o,e[12]=i,e[13]=p):p=e[13];let h;return e[14]!==l||e[15]!==a||e[16]!==d||e[17]!==c||e[18]!==p?(h=n.jsxs("svg",{viewBox:l,className:a,role:d,"aria-valuenow":c,"aria-valuemin":0,"aria-valuemax":100,children:[u,p]}),e[14]=l,e[15]=a,e[16]=d,e[17]=c,e[18]=p,e[19]=h):h=e[19],h},fp=s=>{const e=ne.c(13),{icon:t,iconNode:r,label:o,children:i}=s;let l;e[0]!==t||e[1]!==r?(l=r??(t?n.jsx(G,{name:t,className:"size-[18px]"}):null),e[0]=t,e[1]=r,e[2]=l):l=e[2];let a;e[3]!==l?(a=n.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center text-muted-foreground",children:l}),e[3]=l,e[4]=a):a=e[4];let d;e[5]!==o?(d=n.jsx("span",{className:"shrink-0 typography-ui-label text-muted-foreground",children:o}),e[5]=o,e[6]=d):d=e[6];let c;e[7]!==i?(c=n.jsx("span",{className:"min-w-0 flex-1 truncate text-end typography-ui-label font-medium text-foreground",children:i}),e[7]=i,e[8]=c):c=e[8];let u;return e[9]!==a||e[10]!==d||e[11]!==c?(u=n.jsxs("div",{className:"flex min-w-0 items-center gap-3 rounded-xl px-2.5 py-2.5",children:[a,d,c]}),e[9]=a,e[10]=d,e[11]=c,e[12]=u):u=e[12],u},mp=s=>{const e=ne.c(57),{open:t,onClose:r,anchorRef:o,contextDisplay:i,usageGroups:l,usageDisplayMode:a,isUsageLoading:d,timeFormatPreference:c}=s,{t:u}=ge(),p=m.useRef(null),[h,f]=m.useState(t),[g,x]=m.useState(!1),{enabled:b}=Sr(),w=m.useRef(null),[v,E]=m.useState(null);let P,_;e[0]!==o||e[1]!==b||e[2]!==t||e[3]!==h?(P=()=>{if(!t||!b||!h)return;const K=()=>{const H=o.current?.getBoundingClientRect(),se=w.current?.getBoundingClientRect();if(!H||!se){E(null);return}const fe=H.left-se.left,ce=Math.min(Math.max(fe,8),Math.max(8,se.width-zi-8));E(ce)};K();const Z=w.current;if(typeof ResizeObserver>"u"||!Z)return;const U=new ResizeObserver(K);return U.observe(Z),()=>U.disconnect()},_=[o,b,t,h],e[0]=o,e[1]=b,e[2]=t,e[3]=h,e[4]=P,e[5]=_):(P=e[4],_=e[5]),m.useLayoutEffect(P,_);const A=b&&v!==null;let k,S;e[6]!==t||e[7]!==h?(k=()=>{if(t){f(!0),x(!1);return}if(!h)return;x(!0);const K=window.setTimeout(()=>{f(!1),x(!1)},140);return()=>window.clearTimeout(K)},S=[t,h],e[6]=t,e[7]=h,e[8]=k,e[9]=S):(k=e[8],S=e[9]),m.useEffect(k,S);let N,M;e[10]!==r||e[11]!==t?(N=()=>{if(!t)return;const K=Z=>{Z.key==="Escape"&&r()};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},M=[r,t],e[10]=r,e[11]=t,e[12]=N,e[13]=M):(N=e[12],M=e[13]),m.useEffect(N,M);let B,O;if(e[14]!==o||e[15]!==r||e[16]!==t?(B=()=>{if(!t)return;const K=Z=>{const U=Z.target;if(!(U instanceof Node)){r();return}p.current?.contains(U)||o.current?.contains(U)||r()};return document.addEventListener("pointerdown",K,!0),document.addEventListener("wheel",K,!0),()=>{document.removeEventListener("pointerdown",K,!0),document.removeEventListener("wheel",K,!0)}},O=[o,r,t],e[14]=o,e[15]=r,e[16]=t,e[17]=B,e[18]=O):(B=e[17],O=e[18]),m.useEffect(B,O),!h)return null;let C;e[19]!==u?(C=u("mobile.header.openMetadataAria"),e[19]=u,e[20]=C):C=e[20];const L=A?"absolute origin-top-left":"mx-3 mt-2",I=g?"pointer-events-none":"pointer-events-auto";let j;e[21]!==L||e[22]!==I?(j=ie("oc-surface-elevated overflow-y-auto overscroll-contain rounded-[20px] border border-edge bg-surface-elevated p-2 shadow-[0_12px_32px_rgb(0_0_0_/_0.2)] will-change-transform",L,I),e[21]=L,e[22]=I,e[23]=j):j=e[23];const R=`${g?"session-metadata-out":"session-metadata-in"} ${g?140:170}ms cubic-bezier(0.32, 0.72, 0, 1) forwards`;let T;e[24]!==v||e[25]!==A?(T=A?{top:8,left:v??8,width:`min(${zi}px, calc(100% - 16px))`}:null,e[24]=v,e[25]=A,e[26]=T):T=e[26];let $;e[27]!==R||e[28]!==T?($={animation:R,maxHeight:"min(72dvh, calc(100dvh - var(--oc-safe-area-top, 0px) - var(--oc-header-height, 56px) - 1rem))",...T},e[27]=R,e[28]=T,e[29]=$):$=e[29];let W;e[30]!==i||e[31]!==u?(W=i?n.jsx(fp,{iconNode:n.jsx(ya,{percentage:i.state==="measured"?i.percentage:null}),label:u("mobile.header.metadata.context"),children:i.state==="pending"?null:n.jsxs("span",{className:"inline-flex items-baseline gap-1.5 tabular-nums",children:[i.state==="measured"?n.jsxs("span",{className:ie("font-semibold",i.colorClass),children:[i.percentage.toFixed(1),"%"]}):null,n.jsx("span",{className:"text-muted-foreground",children:i.tokens})]})}):null,e[30]=i,e[31]=u,e[32]=W):W=e[32];let q;e[33]!==i?.state||e[34]!==u?(q=i?.state==="compacted"?n.jsx("p",{className:"px-2.5 pb-1 typography-meta text-muted-foreground",children:u("contextUsage.compacted.description")}):null,e[33]=i?.state,e[34]=u,e[35]=q):q=e[35];let D;e[36]!==i?.state||e[37]!==u?(D=i?.state==="pending"?n.jsx("p",{className:"px-2.5 pb-1 typography-meta text-muted-foreground",children:u("mobile.header.metadata.contextPending")}):null,e[36]=i?.state,e[37]=u,e[38]=D):D=e[38];let z;e[39]!==d||e[40]!==c||e[41]!==a||e[42]!==l?(z=n.jsx(pp,{groups:l,displayMode:a,isLoading:d,timeFormatPreference:c}),e[39]=d,e[40]=c,e[41]=a,e[42]=l,e[43]=z):z=e[43];let J;e[44]!==W||e[45]!==q||e[46]!==D||e[47]!==z?(J=n.jsxs("div",{className:"space-y-1",children:[W,q,D,z]}),e[44]=W,e[45]=q,e[46]=D,e[47]=z,e[48]=J):J=e[48];let ee;e[49]!==j||e[50]!==$||e[51]!==J||e[52]!==C?(ee=n.jsx("div",{ref:p,role:"dialog","aria-label":C,className:j,style:$,children:J}),e[49]=j,e[50]=$,e[51]=J,e[52]=C,e[53]=ee):ee=e[53];let Q;e[54]===Symbol.for("react.memo_cache_sentinel")?(Q=n.jsx("style",{children:`
|
|
5
5
|
@keyframes session-metadata-in {
|
|
@@ -22,4 +22,4 @@ import{f as ne,r as ar,j as n,R as m,a as Ls,h as Ga}from"./vendor-react--VO_rL_
|
|
|
22
22
|
`}),e[47]=ee):ee=e[47];let Q;return e[48]!==J?(Q=n.jsxs("div",{ref:h,className:"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:[J,ee]}),e[48]=J,e[49]=Q):Q=e[49],Q};function vp(s){return s.currentSessionId}function wp(s){return s.setCurrentSession}function jp(s){return s.setActiveProjectIdOnly}const kp=s=>{const e=ne.c(81),{onOpenSessions:t,onOpenWorkspace:r,compactTitle:o}=s,i=o===void 0?!1:o,{t:l}=ge(),[a,d]=m.useState(!1),[c,u]=m.useState(!1),p=m.useRef(null),h=Bs(Sp),f=ot(Np);let g;e[0]!==f?(g=V=>f?V.getDirectoryForSession(f):null,e[0]=f,e[1]=g):g=e[1];const b=ot(g)||h,w=Pl(f,b||void 0),v=ot(Cp),E=Co(b||null);let P;e[2]!==b||e[3]!==E?(P=V=>{if(!b||E!==!0)return!1;const ue=V.directories.get(b)?.status;return!!(ue&&!ue.isClean)},e[2]=b,e[3]=E,e[4]=P):P=e[4];const _=Pt(P),A=He(Rp),k=ju(A);let S;e[5]!==w?.title?(S=w?.title?.trim(),e[5]=w?.title,e[6]=S):S=e[6];const N=S;let M;e[7]!==f||e[8]!==A||e[9]!==k||e[10]!==N||e[11]!==l?(M=(A?k:null)||N||l(f?"mobile.sessions.untitled":"sessions.switcher.draftTitle"),e[7]=f,e[8]=A,e[9]=k,e[10]=N,e[11]=l,e[12]=M):M=e[12];const B=M;let O;e[13]===Symbol.for("react.memo_cache_sentinel")?(O=()=>{d(!1),u(!1)},e[13]=O):O=e[13];let C;e[14]!==f||e[15]!==b?(C=[f,b],e[14]=f,e[15]=b,e[16]=C):C=e[16],m.useEffect(O,C);let L;e[17]!==t?(L=()=>{d(!1),u(!1),t()},e[17]=t,e[18]=L):L=e[18];const I=L;let j;e[19]===Symbol.for("react.memo_cache_sentinel")?(j=V=>{d(ue=>{const Le=typeof V=="function"?V(ue):V;return Le&&u(!1),Le})},e[19]=j):j=e[19];const R=j;let T;e[20]===Symbol.for("react.memo_cache_sentinel")?(T=()=>{u(V=>{const ue=!V;return ue&&d(!1),ue})},e[20]=T):T=e[20];const $=T;let W;e[21]===Symbol.for("react.memo_cache_sentinel")?(W={paddingTop:"var(--oc-safe-area-top, 0px)"},e[21]=W):W=e[21];let q;e[22]!==l?(q=l("mobile.sessions.openSheetAria"),e[22]=l,e[23]=q):q=e[23];let D,z;e[24]===Symbol.for("react.memo_cache_sentinel")?(D={touchAction:"manipulation"},z=n.jsx(G,{name:"list-unordered",className:"size-5"}),e[24]=D,e[25]=z):(D=e[24],z=e[25]);let J;e[26]!==I||e[27]!==q?(J=n.jsx("button",{type:"button",className:"flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":q,onClick:I,style:D,children:z}),e[26]=I,e[27]=q,e[28]=J):J=e[28];const ee=i?"shrink":"flex-1";let Q;e[29]!==ee?(Q=ie("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",ee),e[29]=ee,e[30]=Q):Q=e[30];let Y;e[31]!==l?(Y=l("sessions.switcher.openAria"),e[31]=l,e[32]=Y):Y=e[32];let K;e[33]===Symbol.for("react.memo_cache_sentinel")?(K={touchAction:"manipulation"},e[33]=K):K=e[33];let Z;e[34]!==B?(Z=n.jsx("span",{dir:"auto",className:"block min-w-0 truncate oc-ui-start-align typography-ui-label text-foreground",children:B}),e[34]=B,e[35]=Z):Z=e[35];const U=c&&"rotate-180";let H;e[36]!==U?(H=ie("size-4 shrink-0 text-muted-foreground transition-transform duration-150",U),e[36]=U,e[37]=H):H=e[37];let se;e[38]!==H?(se=n.jsx(G,{name:"arrow-down-s",className:H}),e[38]=H,e[39]=se):se=e[39];let fe;e[40]!==Z||e[41]!==se?(fe=n.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[Z,se]}),e[40]=Z,e[41]=se,e[42]=fe):fe=e[42];let ce;e[43]!==c||e[44]!==Q||e[45]!==Y||e[46]!==fe?(ce=n.jsx("button",{ref:p,type:"button",className:Q,"aria-label":Y,"aria-haspopup":"dialog","aria-expanded":c,onClick:$,style:K,children:fe}),e[43]=c,e[44]=Q,e[45]=Y,e[46]=fe,e[47]=ce):ce=e[47];let ae;e[48]!==i?(ae=i?n.jsx("div",{className:"min-w-0 flex-1"}):null,e[48]=i,e[49]=ae):ae=e[49];let je;e[50]!==f||e[51]!==b||e[52]!==v||e[53]!==a||e[54]!==A?(je=A?null:n.jsx(hp,{open:a,onOpenChange:R,currentSessionId:f,effectiveDirectory:b,isNewSessionDraftOpen:v}),e[50]=f,e[51]=b,e[52]=v,e[53]=a,e[54]=A,e[55]=je):je=e[55];let Re;e[56]!==_||e[57]!==l?(Re=l(_?"mobile.header.openWorkspaceWithChangesAria":"mobile.header.openWorkspaceAria"),e[56]=_,e[57]=l,e[58]=Re):Re=e[58];let te;e[59]!==r?(te=()=>{d(!1),u(!1),r()},e[59]=r,e[60]=te):te=e[60];let pe,X;e[61]===Symbol.for("react.memo_cache_sentinel")?(pe={touchAction:"manipulation"},X=n.jsx(G,{name:"pencil-ruler-2",className:"size-5"}),e[61]=pe,e[62]=X):(pe=e[61],X=e[62]);let oe;e[63]!==_?(oe=_?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":!0}):null,e[63]=_,e[64]=oe):oe=e[64];let ve;e[65]!==Re||e[66]!==te||e[67]!==oe?(ve=n.jsxs("button",{type:"button",className:"relative flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":Re,onClick:te,style:pe,children:[X,oe]}),e[65]=Re,e[66]=te,e[67]=oe,e[68]=ve):ve=e[68];let we;e[69]!==J||e[70]!==ce||e[71]!==ae||e[72]!==je||e[73]!==ve?(we=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:W,children:n.jsxs("div",{className:"flex h-[var(--oc-header-height,56px)] w-full items-center gap-1 px-2",children:[J,ce,ae,je,ve]})}),e[69]=J,e[70]=ce,e[71]=ae,e[72]=je,e[73]=ve,e[74]=we):we=e[74];let Se;e[75]===Symbol.for("react.memo_cache_sentinel")?(Se=()=>u(!1),e[75]=Se):Se=e[75];let be;e[76]!==c?(be=n.jsx(yp,{open:c,onClose:Se,anchorRef:p}),e[76]=c,e[77]=be):be=e[77];let xe;return e[78]!==we||e[79]!==be?(xe=n.jsxs(n.Fragment,{children:[we,be]}),e[78]=we,e[79]=be,e[80]=xe):xe=e[80],xe};function Sp(s){return s.currentDirectory}function Np(s){return s.currentSessionId}function Cp(s){return!!s.newSessionDraft?.open}function Rp(s){return s.runOverviewKey}const nr=s=>!s.candidates.some(e=>e.kind==="direct"),Ep=({onActiveConnectionDeleted:s,onConnect:e})=>{const{t}=ge(),r=ua(e),{connections:o,isBusy:i,isPasswordBusy:l,error:a,pendingConnection:d,connect:c,submitPassword:u,cancelPassword:p,saveConnection:h,removeConnection:f,setError:g}=r,[x,b]=m.useState(null),w=x?o.find(X=>X.id===x)??null:null,v=w?nr(w):!1,[E,P]=m.useState(null),[_,A]=m.useState(""),[k,S]=m.useState(""),[N,M]=m.useState(""),[B,O]=m.useState([]),C=m.useRef(0),[L,I]=m.useState(!1),[j,R]=m.useState(""),[T,$]=m.useState(!1),W=xo(T),[q,D]=m.useState(!1),z=m.useRef(null),J=m.useMemo(()=>vr(),[]),[ee,Q]=m.useState(!1),[Y,K]=m.useState(null),[Z,U]=m.useState(!1),H=Go(m.useCallback(()=>U(!0),[])),se=m.useCallback(()=>{C.current+=1,b(null),A(""),S(""),M(""),O([]),g(null),Q(!1)},[g]),fe=m.useCallback(X=>{X.preventDefault(),!L&&(I(!0),h({id:x??void 0,url:_,label:k,clientToken:N,requestHeaders:v?void 0:Pr(B)}).then(oe=>{oe&&se()}).finally(()=>I(!1)))},[N,x,v,B,L,k,se,h,_]),ce=m.useCallback(async()=>{if(z.current)return;g(null),$(!0);const X=new AbortController;z.current=X;try{const oe=await ha({signal:X.signal});switch(z.current===X&&(z.current=null,$(!1)),oe.status){case"ok":A(oe.url),oe.label&&S(oe.label),oe.clientToken&&M(oe.clientToken),Q(!0);break;case"pairing":D(!0),await r.redeemPairingConnection(oe.pairing);break;case"permission-denied":g(t("mobile.connect.scan.permissionDenied"));break;case"invalid":g(t("mobile.connect.scan.invalid"));break;case"unsupported":g(t("mobile.connect.scan.unsupported"));break;case"failed":g(t("mobile.connect.scan.failed"));break;default:break}}finally{D(!1),z.current===X&&(z.current=null,$(!1))}},[r,g,t]);m.useEffect(()=>()=>{z.current?.abort(),C.current+=1},[]);const ae=m.useCallback(X=>{X.preventDefault(),u(j)},[j,u]),je=m.useCallback(()=>{R(""),p()},[p]),Re=m.useCallback(X=>{P(oe=>oe===X?null:X)},[]),te=m.useCallback(X=>{C.current+=1,P(null),x===X&&se();const oe=o.length===1;f(X).then(ve=>{ve&&(oe||yr(ve))&&s()})},[o.length,x,s,f,se]),pe=Ns;return d?n.jsx("div",{className:"flex h-full flex-col overflow-hidden",children:n.jsx(Ut,{as:"form",outerClassName:"flex-1 min-h-0",className:"px-5 py-4",onSubmit:ae,disableHorizontal:!0,children:n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsxs("div",{className:"flex items-center gap-3 rounded-[18px] border border-edge bg-surface-elevated px-3.5 py-3",children:[n.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-[12px] bg-interactive-hover text-foreground",children:n.jsx(G,{name:"lock",className:"size-[18px]"})}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("p",{className:"truncate typography-ui-label text-foreground",children:d.label}),n.jsx("p",{className:"truncate typography-small text-muted-foreground",children:d.candidates.some(X=>X.kind==="direct")?Zt(d):t("mobile.connect.relay.badge")})]})]}),n.jsx("input",{...ps,value:j,onChange:X=>R(X.target.value),placeholder:t("mobile.connect.password.placeholder"),"aria-label":t("mobile.connect.password.label"),type:"password",autoFocus:!0,className:pe}),a?n.jsx("p",{className:"px-1 typography-small text-[var(--status-error)]",children:a}):null,n.jsx(Ee,{type:"submit",size:"lg",className:"mt-1 h-12 w-full",disabled:l||!j.trim(),children:t(l?"mobile.connect.connecting":"mobile.connect.unlockButton")}),n.jsx(Ee,{type:"button",variant:"ghost",size:"sm",className:"w-full",onClick:je,children:t("mobile.connect.cancelPassword")})]})})}):n.jsxs(n.Fragment,{children:[T?n.jsx(ga,{onCancel:()=>z.current?.abort()}):null,q?n.jsx(ba,{}):null,Z?n.jsx(da,{onClose:()=>U(!1)}):null,n.jsx("div",{className:"flex h-full flex-col overflow-hidden",children:n.jsx(Ut,{outerClassName:"flex-1 min-h-0",className:"px-5 py-4",disableHorizontal:!0,children:n.jsxs("div",{className:"space-y-6",children:[o.length>0?n.jsx("div",{...H,className:"overflow-hidden rounded-[18px] border border-edge bg-surface-elevated",children:o.map(X=>{const oe=E===X.id,ve=yr(X),we=Y===X.id,Se=we?t("mobile.connect.connecting"):ve?zs()?t("mobile.instances.status.connectedRelay"):t("mobile.instances.status.connectedDirect"):nr(X)?t("mobile.connect.relay.badge"):Zt(X);return n.jsxs("div",{className:ie("flex items-center border-b border-edge transition-colors last:border-b-0",oe&&"bg-[color-mix(in_srgb,var(--destructive)_8%,transparent)]"),children:[n.jsxs("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-3 px-3.5 py-3 text-start transition-colors active:bg-interactive-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring disabled:opacity-60",onClick:()=>{ve||(K(X.id),c({id:X.id,candidates:X.candidates,clientToken:X.clientToken,label:X.label}).finally(()=>K(null)))},disabled:i&&!we||oe,children:[n.jsxs("span",{className:"relative flex size-9 shrink-0 items-center justify-center rounded-[12px] bg-interactive-hover text-foreground",children:[n.jsx(G,{name:"server",className:"size-[18px]"}),ve?n.jsx("span",{className:"absolute -inset-e-0.5 -top-0.5 size-2.5 rounded-full border-2 border-[var(--surface-elevated)] bg-[var(--status-success)]","aria-hidden":!0}):null]}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate typography-ui-label text-foreground",children:X.label}),n.jsx("span",{className:ie("block truncate typography-small",ve&&!we?"text-[var(--status-success)]":"text-muted-foreground"),children:Se})]}),we?n.jsx(G,{name:"loader-4",className:"size-5 shrink-0 animate-spin text-muted-foreground"}):null]}),n.jsxs("div",{className:"flex items-center gap-0.5 pe-2",children:[oe?n.jsxs("button",{type:"button","aria-label":t("mobile.instances.confirmDeleteAria",{label:X.label}),className:"flex h-9 shrink-0 items-center gap-1.5 rounded-full bg-destructive px-3 text-destructive-foreground transition-opacity active:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-destructive",onClick:()=>te(X.id),disabled:L,style:{touchAction:"manipulation"},children:[n.jsx(G,{name:"delete-bin",className:"size-[18px]"}),n.jsx("span",{className:"typography-ui-label",children:t("mobile.instances.delete")})]}):n.jsx("button",{type:"button","aria-label":t("mobile.instances.edit"),className:"flex size-9 items-center justify-center rounded-full text-muted-foreground transition-colors active:bg-interactive-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",disabled:L,onClick:()=>{const be=++C.current;Hm(X.id).then(xe=>{be===C.current&&(b(X.id),A(nr(X)?"":xe?.url||Zt(X)),S(X.label),M(X.clientToken||""),O(Em(xe?.values)),g(null))}).catch(()=>{be===C.current&&g(t("mobile.connect.headers.error"))})},style:{touchAction:"manipulation"},children:n.jsx(G,{name:"edit",className:"size-[18px]"})}),n.jsx("button",{type:"button","aria-label":oe?t("mobile.instances.cancelDeleteAria",{label:X.label}):t("mobile.instances.deleteAria",{label:X.label}),className:"flex size-9 items-center justify-center rounded-full text-muted-foreground transition-colors active:bg-interactive-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:()=>Re(X.id),disabled:L,style:{touchAction:"manipulation"},children:n.jsx(G,{name:oe?"close":"delete-bin",className:"size-[18px]"})})]})]},X.id)})}):n.jsx("p",{...H,className:"rounded-[18px] border border-dashed border-edge px-4 py-6 text-center typography-small text-muted-foreground",children:t("mobile.connect.saved.empty")}),!ee&&!w?n.jsxs("div",{className:"space-y-2",children:[J?n.jsxs(Ee,{type:"button",size:"lg",className:"h-12 w-full",onClick:()=>{ce()},disabled:T,children:[n.jsx(G,{name:"scan-2",className:ie("size-[18px]",W)}),t("mobile.connect.scanQr")]}):null,n.jsxs(Ee,{type:"button",variant:J?"ghost":"outline",size:"lg",className:"h-12 w-full",onClick:()=>{C.current+=1,g(null),Q(!0)},children:[n.jsx(G,{name:"add",className:"size-[18px]"}),t("mobile.instances.addManual")]}),a?n.jsx("p",{className:"px-1 text-center typography-small text-[var(--status-error)]",children:a}):null]}):n.jsxs("form",{className:"space-y-3",onSubmit:fe,children:[n.jsxs("div",{className:"flex h-8 items-center justify-between gap-3 px-1",children:[n.jsx("h3",{className:"typography-ui-label text-foreground",children:t(w?"mobile.instances.editTitle":"mobile.instances.addTitle")}),n.jsx(Ee,{type:"button",variant:"ghost",size:"xs",onClick:se,disabled:L,children:t("mobile.instances.cancelEdit")})]}),v?null:n.jsxs("label",{className:"block space-y-1.5",children:[n.jsx("span",{className:"block px-1 typography-ui-label text-foreground",children:t("mobile.connect.url.label")}),n.jsx("input",{...ps,value:_,onChange:X=>A(X.target.value),placeholder:t("mobile.connect.url.placeholder"),type:"url",inputMode:"url",autoCapitalize:"none",className:pe})]}),n.jsxs("label",{className:"block space-y-1.5",children:[n.jsx("span",{className:"block px-1 typography-ui-label text-foreground",children:t("mobile.instances.label.label")}),n.jsx("input",{value:k,onChange:X=>S(X.target.value),placeholder:t("mobile.instances.label.placeholder"),autoComplete:"off",autoCapitalize:"words",autoCorrect:"off",spellCheck:!1,className:pe})]}),v?null:n.jsxs("label",{className:"block space-y-1.5",children:[n.jsx("span",{className:"block px-1 typography-ui-label text-foreground",children:t("mobile.connect.token.label")}),n.jsx("input",{...ps,value:N,onChange:X=>M(X.target.value),placeholder:t("mobile.connect.token.placeholder"),autoCapitalize:"none",className:pe}),n.jsx("p",{className:"px-1 typography-micro text-muted-foreground",children:t("mobile.connect.token.hint")})]}),v?null:n.jsx(xa,{value:B,onChange:O,disabled:L}),a?n.jsx("p",{className:"px-1 typography-small text-[var(--status-error)]",children:a}):null,n.jsx(Ee,{type:"submit",size:"lg",className:"mt-1 h-12 w-full",disabled:L,children:t(w?"mobile.instances.saveEdit":"mobile.instances.saveNew")})]})]})})})]})},an=s=>pn(s)??"",Ip=s=>{const e=s;return an(e.directory??e.project?.worktree??null)},va=({open:s,project:e,worktree:t,onClose:r,onDeleted:o})=>{const{t:i}=ge(),l=Ro(),a=Cs(R=>R.activeSessions),d=ot(R=>R.archiveSessions),c=ot(R=>R.unarchiveSessions),u=Bs(R=>R.currentDirectory),{git:p,sourceControl:h}=Cr(),[f,g]=m.useState(!1),[x,b]=m.useState(!1),[w,v]=m.useState(!1),[E,P]=m.useState(null),[_,A]=m.useState(!1),k=an(t?.path),[S,N]=m.useState(!1),M=t?.branch??"";m.useEffect(()=>{if(N(!1),!s||!k)return;let R=!1;return Dl(e.path,{path:k,branch:M}).then(T=>{R||N(T)}),()=>{R=!0}},[s,e.path,M,k]);const B=m.useMemo(()=>{if(!k)return[];const R=new Map;for(const T of[...a,...l])Ip(T)===k&&R.set(T.id,T);return Array.from(R.values())},[a,l,k]);m.useEffect(()=>{if(!s){g(!1),b(!1),v(!1),P(null),A(!1);return}if(!t?.path)return;let R=!1;return Ol(t.path).then(T=>{R||(v(!!T?.isDirty),P(T?.upstream?.split("/")[0]?.trim()||null))}).catch(()=>{R||v(!!t.status?.isDirty)}),()=>{R=!0}},[s,t?.path,t?.status?.isDirty]);const O=m.useCallback(async R=>(await Ml(e,R,{deleteRemoteBranch:S&&x,deleteLocalBranch:S&&f,remoteName:E??void 0,network:{git:p,sourceControl:h}}),an(u)===k&&an(e.path)&&Bs.getState().setDirectory(an(e.path),{showOverlay:!1}),!0),[u,f,x,p,S,e,E,h,k]),C=m.useCallback((R,T)=>{const $=Ll(R),W=me.loading(i("sessions.sidebar.sessionDialogs.worktree.removingTitle",{name:$}));zl(R.path),(async()=>{try{const q=await Bl({sessionIds:T,removeWorktree:()=>O(R),archiveSessions:d,restoreSessions:z=>c(z,{undo:!0})});if(!q.removed){me.dismiss(W);return}const{failedIds:D}=q.archive;if(D.length>0){me.error(D.length===1?i("sessions.sidebar.bulkActions.failedArchiveSingle",{count:D.length}):i("sessions.sidebar.bulkActions.failedArchivePlural",{count:D.length}),{id:W,description:i("sessions.sidebar.dialogs.deleteResult.tryAgain")});return}me.success(i(S&&x?"sessions.sidebar.sessionDialogs.worktree.removedWithRemote":"sessions.sidebar.sessionDialogs.worktree.removed"),{id:W,description:$}),o?.()}catch(q){const D=q instanceof Rn?q.message||i("sessions.sidebar.dialogs.deleteResult.tryAgain"):q instanceof cr||q instanceof fs&&!q.message.includes(" ")?i("gitView.publish.remoteNotGranted"):q instanceof Error?q.message:i("sessions.sidebar.dialogs.deleteResult.tryAgain");me.error(i("sessions.sidebar.sessionDialogs.worktree.errorRemoveTitle"),{id:W,description:D})}finally{Fl(R.path)}})()},[d,x,S,o,O,i,c]),L=()=>{!t||_||(C(t,B.map(R=>R.id)),r())};if(!t)return null;const I=t.branch||t.label||t.path,j=(R,T,$,W)=>n.jsxs("button",{type:"button",role:"switch","aria-checked":R,disabled:W,onClick:()=>T(!R),className:ie("flex w-full items-center justify-between gap-3 rounded-xl border border-edge px-3.5 py-3 text-start transition-colors","hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",W&&"pointer-events-none opacity-40"),style:{touchAction:"manipulation"},children:[n.jsx("span",{className:"typography-ui-label text-foreground",children:$}),n.jsx("span",{className:ie("relative h-6 w-10 shrink-0 rounded-full transition-colors",R?"bg-primary":"bg-muted-foreground/30"),children:n.jsx("span",{className:ie("absolute top-0.5 size-5 rounded-full bg-white transition-transform",R?"translate-x-[1.125rem] rtl:-translate-x-[1.125rem]":"translate-x-0.5 rtl:-translate-x-0.5")})})]});return n.jsx(Eo,{open:s,onClose:r,title:i("mobile.projectEdit.deleteWorktreeTitle"),footer:n.jsxs("div",{className:"flex gap-2",children:[n.jsx(Ee,{variant:"ghost",className:"flex-1",onClick:r,disabled:_,children:i("projectEditDialog.actions.cancel")}),n.jsx(Ee,{variant:"destructive",className:"flex-1",onClick:()=>{L()},disabled:_,children:i("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:i("mobile.projectEdit.deleteWorktreeConfirm",{name:I})}),w?n.jsx("p",{className:"rounded-xl border border-[var(--warning)]/40 bg-[color-mix(in_srgb,var(--warning)_10%,transparent)] px-3.5 py-3 typography-meta text-foreground",children:i("mobile.projectEdit.deleteWorktreeDirty")}):null,B.length>0?n.jsx("p",{className:"typography-meta text-muted-foreground",children:i("mobile.projectEdit.deleteWorktreeArchiveNote",{count:B.length})}):null,S?n.jsxs("div",{className:"flex flex-col gap-2",children:[j(f,g,i("mobile.projectEdit.deleteLocalBranch"),_),j(x,b,i("mobile.projectEdit.deleteRemoteBranch"),_||!E)]}):null]})})},Fi="mobile-surface-root",rr=16,Nn=200,Tp=()=>{if(typeof document>"u")return null;let s=document.getElementById(Fi);return s||(s=document.createElement("div"),s.id=Fi,document.body.appendChild(s)),s},Yt=({open:s,onClose:e,title:t,subtitle:r,trailing:o,disableEscapeDismiss:i=!1,headerless:l=!1,noHeaderBorder:a=!1,ariaLabel:d,variant:c="fullscreen",dialogAlign:u="chat",children:p})=>{const{t:h,direction:f}=ge(),g=ur(),x=m.useRef(null),[b,w]=m.useState(!1),[v,E]=m.useState(!1),P=m.useRef(null),_=m.useRef(null),A=m.useRef(e);if(m.useEffect(()=>{A.current=e},[e]),typeof document<"u"&&!x.current&&(x.current=Tp()),m.useEffect(()=>{if(!s){w(!1);return}const N=window.setTimeout(()=>w(!0),rr);return()=>window.clearTimeout(N)},[s]),m.useEffect(()=>{if(!s){E(!1);return}const N=window.setTimeout(()=>E(!0),rr+Nn+80);return()=>window.clearTimeout(N)},[s]),m.useEffect(()=>{if(!s)return;const N=document.body.style.overflow;_.current=document.activeElement instanceof HTMLElement?document.activeElement:null,document.body.style.overflow="hidden";const M=()=>{const C=P.current;if(!C)return;(C.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')??C).focus({preventScroll:!0})},B=window.setTimeout(M,rr),O=C=>{if(C.key==="Escape"&&!i){if(Rr(C))return;A.current();return}if(C.key!=="Tab")return;const L=P.current;if(!L)return;const I=Array.from(L.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')).filter($=>!$.hasAttribute("disabled")&&$.getAttribute("aria-hidden")!=="true");if(I.length===0){C.preventDefault(),L.focus({preventScroll:!0});return}const j=I[0],R=I[I.length-1],T=document.activeElement;C.shiftKey&&T===j?(C.preventDefault(),R.focus({preventScroll:!0})):!C.shiftKey&&T===R&&(C.preventDefault(),j.focus({preventScroll:!0}))};return document.addEventListener("keydown",O),()=>{window.clearTimeout(B),document.body.style.overflow=N,document.removeEventListener("keydown",O),_.current?.focus?.({preventScroll:!0}),_.current=null}},[i,s]),!s||!x.current)return null;const k=c==="dialog",S=n.jsxs("section",{ref:P,role:"dialog","aria-modal":"true","aria-label":d,tabIndex:-1,className:ie("flex flex-col bg-background text-foreground",k?"h-[min(88dvh,860px)] w-full max-w-[720px] overflow-hidden rounded-2xl border border-edge shadow-[0_24px_64px_rgb(0_0_0_/_0.32)]":"oc-keyboard-inset-surface oc-bottom-safe-surface fixed inset-0 z-50"),style:k?{opacity:b?1:0,transform:b?"none":"scale(0.97)",transition:`opacity ${Nn}ms ease-out, transform ${Nn}ms cubic-bezier(0.32, 0.72, 0, 1)`}:{paddingTop:"var(--oc-safe-area-top, 0px)",transform:b?"none":f==="rtl"?"translateX(-100%)":"translateX(100%)",transition:`transform ${Nn}ms cubic-bezier(0.32, 0.72, 0, 1)`},onTransitionEnd:N=>{b&&N.target===N.currentTarget&&N.propertyName==="transform"&&E(!0)},children:[l?null:n.jsxs("header",{className:ie("flex h-[var(--oc-header-height,56px)] shrink-0 items-center gap-2 px-3",!a&&"border-b border-edge"),children:[n.jsx("button",{type:"button",className:"-ms-1 flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":h("mobile.surface.closeAria"),onClick:e,style:{touchAction:"manipulation"},children:n.jsx(G,{name:"close",className:"size-5"})}),n.jsxs("div",{className:"min-w-0 flex-1 px-1",children:[t?typeof t=="string"?n.jsx("h2",{className:"truncate typography-ui-label text-foreground",children:t}):t:null,r?typeof r=="string"?n.jsx("p",{className:"truncate typography-micro text-muted-foreground",children:r}):r:null]}),o?n.jsx("div",{className:"flex shrink-0 items-center gap-1.5",children:o}):null]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:v?n.jsx("div",{className:"h-full",style:{animation:"oc-surface-content-in 200ms ease-out"},children:p}):null}),n.jsx("style",{children:"@keyframes oc-surface-content-in { from { opacity: 0 } to { opacity: 1 } }"})]});return k?Ls.createPortal(n.jsx("div",{className:"oc-keyboard-inset-surface oc-bottom-safe-surface fixed inset-0 z-50 flex items-center justify-center p-4 transition-opacity duration-200 ease-out",style:{background:"rgb(0 0 0 / 0.45)",opacity:b?1:0,paddingLeft:u==="chat"?`max(1rem, ${g.left}px)`:"1rem",paddingRight:u==="chat"?`max(1rem, ${g.right}px)`:"1rem",paddingTop:"max(1rem, var(--oc-safe-area-top, 0px))"},onClick:e,children:n.jsx("div",{"data-keyboard-rider":"0.5",className:"flex w-full max-w-[720px] justify-center",onClick:N=>N.stopPropagation(),children:S})}),x.current):Ls.createPortal(S,x.current)},_p=[],Ap=s=>{const e=ne.c(8),{projectPath:t}=s,{t:r}=ge(),{journey:o}=tl();let i;if(e[0]!==o||e[1]!==t||e[2]!==r){const l=o?sl(o,t):[];let a;e[4]!==r?(a=r("mobile.projectEdit.spacesTitle"),e[4]=r,e[5]=a):a=e[5];let d;e[6]!==a?(d=n.jsx("label",{className:"typography-ui-label font-medium text-foreground",children:a}),e[6]=a,e[7]=d):d=e[7],i=n.jsxs("div",{className:"flex flex-col gap-2",children:[d,o!==null&&l.length===0?n.jsx("p",{className:"typography-meta text-muted-foreground",children:r("spaces.page.empty")}):null,l.map(Mp)]}),e[0]=o,e[1]=t,e[2]=r,e[3]=i}else i=e[3];return i},Pp=s=>pn(s)??"",Dp=s=>{const e=ne.c(18),{worktree:t,onDelete:r}=s,{t:o}=ge(),i=t.branch||t.label||t.path,l=Kl(t.path),a=l&&"opacity-60";let d;e[0]!==a?(d=ie("flex items-center gap-2 rounded-2xl border border-edge bg-[var(--surface-elevated)] py-1.5 ps-3 pe-1.5 transition-colors",a),e[0]=a,e[1]=d):d=e[1];const c=l||void 0;let u;e[2]!==l||e[3]!==o?(u=l?n.jsx("span",{className:"inline-flex shrink-0 text-muted-foreground",role:"status","aria-label":o("sessions.sidebar.group.worktreeRemoving"),children:n.jsx(G,{name:"loader-4",className:"size-4 animate-spin"})}):n.jsx(G,{name:"git-branch",className:"size-4 shrink-0 text-muted-foreground"}),e[2]=l,e[3]=o,e[4]=u):u=e[4];let p;e[5]!==i?(p=n.jsx("span",{className:"block min-w-0 flex-1 truncate typography-ui-label text-foreground",children:i}),e[5]=i,e[6]=p):p=e[6];let h;e[7]!==i||e[8]!==r||e[9]!==l||e[10]!==o?(h=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":o("mobile.projectEdit.deleteWorktreeAria",{label:i}),onClick:r,style:{touchAction:"manipulation"},children:n.jsx(Vo,{className:"size-4"})}),e[7]=i,e[8]=r,e[9]=l,e[10]=o,e[11]=h):h=e[11];let f;return e[12]!==d||e[13]!==c||e[14]!==u||e[15]!==p||e[16]!==h?(f=n.jsxs("div",{className:d,"aria-busy":c,children:[u,p,h]}),e[12]=d,e[13]=c,e[14]=u,e[15]=p,e[16]=h,e[17]=f):f=e[17],f},Op=s=>{const e=ne.c(75),{open:t,project:r,onClose:o}=s,{t:i}=ge(),{currentTheme:l}=Io(),a=He(Lp),d=Lt(zp),c=Lt(Bp),u=Lt(Fp);let p;e[0]!==r?(p=te=>r?te.projects.find(pe=>pe.id===r.id)?.iconImage??null:null,e[0]=r,e[1]=p):p=e[1];const h=Lt(p),[f,g]=m.useState(""),[x,b]=m.useState(null),[w,v]=m.useState(null),[E,P]=m.useState(!1),[_,A]=m.useState(null),k=r?.id??null;let S;e[2]!==t||e[3]!==r?(S=()=>{!t||!r||(g(r.label),b(r.icon??null),v(r.color??null))},e[2]=t,e[3]=r,e[4]=S):S=e[4];let N;e[5]!==t||e[6]!==k?(N=[t,k],e[5]=t,e[6]=k,e[7]=N):N=e[7],m.useEffect(S,N);const M=r?.path;let B;e[8]!==M?(B=Pp(M),e[8]=M,e[9]=B):B=e[9];const O=B,C=ot(te=>O?te.availableWorktreesByProject.get(O):void 0)??_p,L=Pt(te=>O?te.directories.get(O)?.isGitRepo:void 0)??C.length>0;let I;e[10]!==w||e[11]!==x||e[12]!==f||e[13]!==o||e[14]!==r||e[15]!==d?(I=()=>{if(!r)return;const pe={label:f.trim()||r.label,icon:x,color:w};w!==(r.color??null)&&(pe.iconBackground=Vl(w)),d(r.id,pe),o()},e[10]=w,e[11]=x,e[12]=f,e[13]=o,e[14]=r,e[15]=d,e[16]=I):I=e[16];const j=I;let R;e[17]!==c||e[18]!==E||e[19]!==r||e[20]!==i?(R=()=>{!r||E||(P(!0),c(r.id).then(te=>{if(!te.ok){me.error(te.error||i("projectEditDialog.toast.failedToDiscoverIcon"));return}if(te.skipped){me.success(i("projectEditDialog.toast.customIconAlreadySet"));return}me.success(i("projectEditDialog.toast.iconDiscovered"))}).finally(()=>P(!1)))},e[17]=c,e[18]=E,e[19]=r,e[20]=i,e[21]=R):R=e[21];const T=R;let $;e[22]!==r||e[23]!==u||e[24]!==i?($=()=>{r&&u(r.id).then(te=>{if(!te.ok){me.error(te.error||i("projectEditDialog.toast.failedToRemoveIcon"));return}me.success(i("projectEditDialog.toast.iconRemoved"))})},e[22]=r,e[23]=u,e[24]=i,e[25]=$):$=e[25];const W=$;let q;e[26]!==w?(q=To(w),e[26]=w,e[27]=q):q=e[27];const D=q,z=x?_o[x]:null,J=!!h;let ee;e[28]!==i?(ee=i("projectEditDialog.title"),e[28]=i,e[29]=ee):ee=e[29];let Q;e[30]!==i?(Q=i("projectEditDialog.title"),e[30]=i,e[31]=Q):Q=e[31];let Y;e[32]!==i?(Y=i("projectEditDialog.actions.save"),e[32]=i,e[33]=Y):Y=e[33];let K;e[34]!==f?(K=f.trim(),e[34]=f,e[35]=K):K=e[35];const Z=!K;let U,H;e[36]===Symbol.for("react.memo_cache_sentinel")?(U={touchAction:"manipulation"},H=n.jsx(cf,{className:"size-4"}),e[36]=U,e[37]=H):(U=e[36],H=e[37]);let se;e[38]!==i?(se=i("projectEditDialog.actions.save"),e[38]=i,e[39]=se):se=e[39];let fe;e[40]!==j||e[41]!==Y||e[42]!==Z||e[43]!==se?(fe=n.jsxs(Ee,{type:"button",variant:"default",size:"sm","aria-label":Y,onClick:j,disabled:Z,style:U,children:[H,se]}),e[40]=j,e[41]=Y,e[42]=Z,e[43]=se,e[44]=fe):fe=e[44];let ce;e[45]!==w||e[46]!==D||e[47]!==h||e[48]!==l||e[49]!==T||e[50]!==W||e[51]!==J||e[52]!==x||e[53]!==E||e[54]!==L||e[55]!==a||e[56]!==f||e[57]!==z||e[58]!==r||e[59]!==i||e[60]!==C?(ce=r?n.jsxs(Ut,{outerClassName:"h-full",className:"space-y-6 px-4 pb-8 pt-2",disableHorizontal:!0,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:J&&r.iconBackground?{backgroundColor:r.iconBackground}:void 0,children:J?n.jsx(Ao,{project:{id:r.id,iconImage:h},options:{themeVariant:l.metadata.variant,iconColor:l.colors.surface.foreground},className:"size-full object-contain",fallback:n.jsx(hr,{className:"size-7"})}):z?n.jsx(G,{name:z,className:"size-7",style:D?{color:D}:void 0}):n.jsx(hr,{className:"size-7",style:D?{color:D}: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:i("projectEditDialog.field.name")}),n.jsx(Po,{value:f,onChange:te=>g(te.target.value),placeholder:i("projectEditDialog.field.namePlaceholder"),className:"h-11"}),n.jsx("p",{className:"truncate typography-meta text-muted-foreground",title:r.path,children:r.path})]}),n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("label",{className:"typography-ui-label font-medium text-foreground",children:i("projectEditDialog.field.color")}),n.jsxs("div",{className:"flex flex-wrap gap-2.5",children:[n.jsx("button",{type:"button",onClick:()=>v(null),"aria-label":i("projectEditDialog.option.none"),className:ie("flex size-9 items-center justify-center rounded-xl border-2 transition-all",w===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"})}),$l.map(te=>n.jsx("button",{type:"button",onClick:()=>v(te),"aria-label":i("settings.projects.appearance.colorSwatchAria",{color:te}),title:te,className:ie("size-9 rounded-xl border-2 transition-all",w===te?"border-foreground":"border-transparent hover:border-edge"),style:{backgroundColor:te,touchAction:"manipulation"}},te))]})]}),n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("label",{className:"typography-ui-label font-medium text-foreground",children:i("projectEditDialog.field.icon")}),n.jsxs("div",{className:"flex flex-wrap gap-2.5",children:[n.jsx("button",{type:"button",onClick:()=>b(null),"aria-label":i("projectEditDialog.option.none"),className:ie("flex size-9 items-center justify-center rounded-xl border-2 transition-all",x===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"})}),Wl.map(te=>n.jsx("button",{type:"button",onClick:()=>b(te.key),"aria-label":te.label,className:ie("flex size-9 items-center justify-center rounded-xl border-2 transition-all",x===te.key?"border-foreground bg-[var(--surface-elevated)]":"border-edge hover:border-edge"),style:{touchAction:"manipulation"},children:n.jsx(G,{name:te.Icon,className:"size-4",style:D?{color:D}:void 0})},te.key))]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:[n.jsx(Ee,{size:"sm",variant:"outline",onClick:T,disabled:E,children:i(E?"projectEditDialog.actions.discovering":"projectEditDialog.actions.discoverFavicon")}),J?n.jsx(Ee,{size:"sm",variant:"outline",onClick:W,children:i("projectEditDialog.actions.removeProjectIcon")}):null]})]}),L?n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("label",{className:"typography-ui-label font-medium text-foreground",children:i("mobile.projectEdit.worktreesTitle")}),C.length===0?n.jsx("p",{className:"typography-meta text-muted-foreground",children:i("mobile.projectEdit.worktreesEmpty")}):n.jsx("div",{className:"flex flex-col gap-1.5",children:C.map(te=>n.jsx(Dp,{worktree:te,onDelete:()=>A(te)},te.path))})]}):null,L&&a?n.jsx(Ap,{projectPath:r.path}):null]}):null,e[45]=w,e[46]=D,e[47]=h,e[48]=l,e[49]=T,e[50]=W,e[51]=J,e[52]=x,e[53]=E,e[54]=L,e[55]=a,e[56]=f,e[57]=z,e[58]=r,e[59]=i,e[60]=C,e[61]=ce):ce=e[61];let ae;e[62]!==o||e[63]!==t||e[64]!==ee||e[65]!==Q||e[66]!==fe||e[67]!==ce?(ae=n.jsx(Yt,{open:t,onClose:o,title:ee,ariaLabel:Q,noHeaderBorder:!0,trailing:fe,children:ce}),e[62]=o,e[63]=t,e[64]=ee,e[65]=Q,e[66]=fe,e[67]=ce,e[68]=ae):ae=e[68];let je;e[69]!==r||e[70]!==_?(je=r?n.jsx(va,{open:!!_,project:{id:r.id,path:r.path},worktree:_,onClose:()=>A(null)}):null,e[69]=r,e[70]=_,e[71]=je):je=e[71];let Re;return e[72]!==ae||e[73]!==je?(Re=n.jsxs(n.Fragment,{children:[ae,je]}),e[72]=ae,e[73]=je,e[74]=Re):Re=e[74],Re};function Mp(s){return n.jsx(yf,{entry:s,actions:"sheet"},s.id)}function Lp(s){return s.isolatedSpacesEnabled}function zp(s){return s.updateProjectMeta}function Bp(s){return s.discoverProjectIcon}function Fp(s){return s.removeProjectIcon}const Js=s=>{const e=ne.c(20),{project:t,size:r}=s,o=r===void 0?"md":r,{currentTheme:i}=Io(),l=t.icon?_o[t.icon]:null;let a;e[0]!==t.color?(a=To(t.color),e[0]=t.color,e[1]=a):a=e[1];const d=a,c=o==="md"?"size-5":"size-3.5";let u;e[2]!==l||e[3]!==c||e[4]!==d?(u=l?n.jsx(G,{name:l,className:c,style:d?{color:d}:void 0}):n.jsx(hr,{className:c,style:d?{color:d}:void 0}),e[2]=l,e[3]=c,e[4]=d,e[5]=u):u=e[5];const p=u;let h;e[6]!==i||e[7]!==p||e[8]!==t.iconImage||e[9]!==t.id?(h=t.iconImage?n.jsx(Ao,{project:{id:t.id,iconImage:t.iconImage??null},options:{themeVariant:i.metadata.variant,iconColor:i.colors.surface.foreground},className:"size-full object-contain",fallback:p}):null,e[6]=i,e[7]=p,e[8]=t.iconImage,e[9]=t.id,e[10]=h):h=e[10];const f=h;let g;e[11]!==t.iconBackground?(g=t.iconBackground?{backgroundColor:t.iconBackground}:void 0,e[11]=t.iconBackground,e[12]=g):g=e[12];const x=g;if(o==="md"){let E;return e[13]!==p||e[14]!==f||e[15]!==x?(E=n.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center text-muted-foreground",children:f?n.jsx("span",{className:"flex size-6 items-center justify-center overflow-hidden rounded-md",style:x,children:f}):p}),e[13]=p,e[14]=f,e[15]=x,e[16]=E):E=e[16],E}const b=f?x:void 0,w=f??p;let v;return e[17]!==b||e[18]!==w?(v=n.jsx("span",{className:"flex size-3.5 shrink-0 items-center justify-center overflow-hidden rounded-[3px] text-muted-foreground",style:b,children:w}),e[17]=b,e[18]=w,e[19]=v):v=e[19],v},$r=s=>pn(s)??"",$p=s=>{const e=$r(s);if(!e)return"";const t=e.split("/").filter(Boolean);return t[t.length-1]?.replace(/[-_]/g," ")||e},Rs=s=>{const e=s;return $r(e.directory??e.project?.worktree??null)},Wr=s=>{const e=ne.c(51),{initialTitle:t,indent:r,className:o,aiRename:i,placeholder:l,onSubmit:a,onCancel:d}=s,{t:c}=ge(),[u,p]=m.useState(t),h=Wp;let f;e[0]!==i||e[1]!==t||e[2]!==d||e[3]!==a||e[4]!==u?(f=()=>{const T=u.trim();if(!T&&i||T===t.trim()){d();return}a(T)},e[0]=i,e[1]=t,e[2]=d,e[3]=a,e[4]=u,e[5]=f):f=e[5];const g=f;let x;e[6]!==o?(x=ie("flex h-9 min-w-0 flex-1 items-center gap-2 pe-2",o),e[6]=o,e[7]=x):x=e[7];let b;e[8]!==r?(b={paddingInlineStart:r},e[8]=r,e[9]=b):b=e[9];let w;e[10]!==g?(w=T=>{T.preventDefault(),g()},e[10]=g,e[11]=w):w=e[11];let v;e[12]===Symbol.for("react.memo_cache_sentinel")?(v=T=>p(T.target.value),e[12]=v):v=e[12];let E;e[13]!==d?(E=T=>ku(T,d),e[13]=d,e[14]=E):E=e[14];let P;e[15]!==c?(P=c("sessions.sidebar.session.rename.save"),e[15]=c,e[16]=P):P=e[16];let _;e[17]!==l||e[18]!==c?(_=l??c("sessions.sidebar.session.menu.rename"),e[17]=l,e[18]=c,e[19]=_):_=e[19];let A;e[20]===Symbol.for("react.memo_cache_sentinel")?(A={minHeight:0},e[20]=A):A=e[20];let k;e[21]!==E||e[22]!==P||e[23]!==_||e[24]!==u?(k=n.jsx("input",{ref:h,value:u,onChange:v,onKeyDown:E,"aria-label":P,placeholder:_,className:"min-w-0 flex-1 bg-transparent text-[16px] typography-ui-label text-foreground outline-none placeholder:text-muted-foreground",style:A,enterKeyHint:"done"}),e[21]=E,e[22]=P,e[23]=_,e[24]=u,e[25]=k):k=e[25];let S;e[26]!==i||e[27]!==d||e[28]!==c?(S=i?n.jsx("button",{type:"button",disabled:i.disabled,onClick:()=>{i.run(),d()},"aria-label":c("sessions.aiRename.action"),"aria-description":i.hint,title:i.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(G,{name:"ai-generate-2",className:"size-4"})}):null,e[26]=i,e[27]=d,e[28]=c,e[29]=S):S=e[29];let N;e[30]!==c?(N=c("sessions.sidebar.session.rename.save"),e[30]=c,e[31]=N):N=e[31];let M,B;e[32]===Symbol.for("react.memo_cache_sentinel")?(M={touchAction:"manipulation",minHeight:0,minWidth:0},B=n.jsx(G,{name:"check",className:"size-4"}),e[32]=M,e[33]=B):(M=e[32],B=e[33]);let O;e[34]!==N?(O=n.jsx("button",{type:"submit","aria-label":N,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:M,children:B}),e[34]=N,e[35]=O):O=e[35];let C;e[36]!==c?(C=c("sessions.sidebar.session.rename.cancel"),e[36]=c,e[37]=C):C=e[37];let L,I;e[38]===Symbol.for("react.memo_cache_sentinel")?(L={touchAction:"manipulation",minHeight:0,minWidth:0},I=n.jsx(G,{name:"close",className:"size-4"}),e[38]=L,e[39]=I):(L=e[38],I=e[39]);let j;e[40]!==d||e[41]!==C?(j=n.jsx("button",{type:"button",onClick:d,"aria-label":C,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:L,children:I}),e[40]=d,e[41]=C,e[42]=j):j=e[42];let R;return e[43]!==k||e[44]!==S||e[45]!==O||e[46]!==j||e[47]!==x||e[48]!==b||e[49]!==w?(R=n.jsxs("form",{className:x,style:b,onSubmit:w,children:[k,S,O,j]}),e[43]=k,e[44]=S,e[45]=O,e[46]=j,e[47]=x,e[48]=b,e[49]=w,e[50]=R):R=e[50],R};function Wp(s){s&&(s.focus(),s.select())}const $i=s=>{const e=ne.c(8),{session:t}=s,{t:r}=ge(),o=Do(t);if(!o)return null;const i=Hl[o.status];let l;e[0]!==r||e[1]!==i?(l=r(i),e[0]=r,e[1]=i,e[2]=l):l=e[2];const a=l,d=Ul[o.status];let c;e[3]!==d?(c={color:d},e[3]=d,e[4]=c):c=e[4];let u;return e[5]!==a||e[6]!==c?(u=n.jsx(G,{name:"target",className:"size-3.5 shrink-0",style:c,"aria-label":a}),e[5]=a,e[6]=c,e[7]=u):u=e[7],u},Wi=s=>{const e=ne.c(9),{hasPermission:t,hasForm:r}=s,{t:o}=ge();if(!t&&!r)return null;let i;e[0]!==t||e[1]!==o?(i=t?n.jsx("span",{className:"inline-flex shrink-0 items-center text-status-warning","aria-label":o("sessions.sidebar.session.status.permissionRequired"),children:n.jsx(G,{name:"shield",className:"size-3"})}):null,e[0]=t,e[1]=o,e[2]=i):i=e[2];let l;e[3]!==r||e[4]!==o?(l=r?n.jsx("span",{className:"inline-flex shrink-0 items-center text-status-warning","aria-label":o("sessions.sidebar.session.status.questionPending"),children:n.jsx(G,{name:"question",className:"size-3"})}):null,e[3]=r,e[4]=o,e[5]=l):l=e[5];let a;return e[6]!==i||e[7]!==l?(a=n.jsxs(n.Fragment,{children:[i,l]}),e[6]=i,e[7]=l,e[8]=a):a=e[8],a},_s=48,Kp=4*_s,Vp=180,Ki=(s,e)=>{s&&(s.style.visibility=e?"visible":"hidden")},hn=s=>{const e=ne.c(33),{actionsWidth:t,actions:r,revealed:o,onRevealedChange:i,dataActiveSession:l,contentClassName:a,children:d}=s,c=a===void 0?"relative flex w-full items-center bg-background":a,{direction:u}=ge(),p=u==="rtl"?-1:1,h=m.useRef(null),f=m.useRef(null),g=m.useRef(null),x=m.useRef(!1),b=m.useRef(0),w=m.useRef(o);let v;e[0]!==p?(v=(D,z)=>{const J=h.current;J&&(Ki(f.current,D!==0||z&&D!==b.current),J.style.transition=z?`transform ${Vp}ms ease-out`:"none",J.style.transform=D===0?"none":`translateX(${D*p}px)`,b.current=D)},e[0]=p,e[1]=v):v=e[1];const E=v;let P;e[2]===Symbol.for("react.memo_cache_sentinel")?(P=D=>{D.target===h.current&&D.propertyName==="transform"&&b.current===0&&Ki(f.current,!1)},e[2]=P):P=e[2];const _=P;let A,k;e[3]!==t||e[4]!==E||e[5]!==o?(A=()=>{w.current=o,E(o?t:0,!0)},k=[t,E,o],e[3]=t,e[4]=E,e[5]=o,e[6]=A,e[7]=k):(A=e[6],k=e[7]),m.useLayoutEffect(A,k);let S;e[8]===Symbol.for("react.memo_cache_sentinel")?(S=D=>{if(D.touches.length!==1)return;const z=D.touches[0];g.current={x:z.clientX,y:z.clientY},x.current=!1},e[8]=S):S=e[8];const N=S;let M;e[9]!==t||e[10]!==E||e[11]!==p?(M=D=>{if(!g.current)return;const z=D.touches[0],J=(z.clientX-g.current.x)*p,ee=z.clientY-g.current.y;if(!x.current){if(Math.abs(J)<8||Math.abs(J)<=Math.abs(ee))return;x.current=!0}const Q=w.current?t:0;E(Math.max(0,Math.min(t,Q+J)),!1)},e[9]=t,e[10]=E,e[11]=p,e[12]=M):M=e[12];const B=M;let O;e[13]!==t||e[14]!==E||e[15]!==i?(O=()=>{if(g.current=null,!x.current)return;x.current=!1;const D=b.current>t/2;E(D?t:0,!0),D!==w.current&&i(D)},e[13]=t,e[14]=E,e[15]=i,e[16]=O):O=e[16];const C=O,L=l||void 0;let I;e[17]===Symbol.for("react.memo_cache_sentinel")?(I={touchAction:"pan-y"},e[17]=I):I=e[17];let j;e[18]!==t?(j={width:t},e[18]=t,e[19]=j):j=e[19];const R=!o;let T;e[20]!==r||e[21]!==j||e[22]!==R?(T=n.jsx("div",{ref:f,className:"absolute inset-y-0 inset-s-0 flex items-stretch",style:j,"aria-hidden":R,children:r}),e[20]=r,e[21]=j,e[22]=R,e[23]=T):T=e[23];const $=`${c} rounded-[inherit]`;let W;e[24]!==d||e[25]!==$?(W=n.jsx("div",{ref:h,className:$,onTransitionEnd:_,onTransitionCancel:_,children:d}),e[24]=d,e[25]=$,e[26]=W):W=e[26];let q;return e[27]!==C||e[28]!==B||e[29]!==T||e[30]!==W||e[31]!==L?(q=n.jsxs("div",{"data-active-session":L,className:"relative overflow-hidden rounded-lg",onTouchStart:N,onTouchMove:B,onTouchEnd:C,onTouchCancel:C,style:I,children:[T,W]}),e[27]=C,e[28]=B,e[29]=T,e[30]=W,e[31]=L,e[32]=q):q=e[32],q},Hp=s=>{const e=ne.c(62),{sessionId:t,title:r,revealed:o,confirmingDelete:i,onArchive:l,onRequestDelete:a,onConfirmDelete:d,onRequestRename:c,onRevealedChange:u,work:p,pin:h}=s,{t:f}=ge(),g=o?0:-1;let x;e[0]!==u||e[1]!==t||e[2]!==f?(x=async()=>{if(!(await bo(t).catch(Up))?.ok){vi.error(f("sessions.sidebar.session.copyId.error"));return}u?.(!1),vi.success(f("sessions.sidebar.session.copyId.success"))},e[0]=u,e[1]=t,e[2]=f,e[3]=x):x=e[3];const b=x;let w;e[4]!==f||e[5]!==r?(w=f("mobile.sessions.archiveSessionAria",{title:r}),e[4]=f,e[5]=r,e[6]=w):w=e[6];let v,E;e[7]===Symbol.for("react.memo_cache_sentinel")?(v={touchAction:"manipulation"},E=n.jsx(uf,{className:"size-[18px]"}),e[7]=v,e[8]=E):(v=e[7],E=e[8]);let P;e[9]!==l||e[10]!==w||e[11]!==g?(P=n.jsx("button",{type:"button",tabIndex:g,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":w,onClick:l,style:v,children:E}),e[9]=l,e[10]=w,e[11]=g,e[12]=P):P=e[12];let _;e[13]!==u||e[14]!==h||e[15]!==f||e[16]!==g?(_=h?n.jsx("button",{type:"button",tabIndex:g,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":h.pinned?f("sessions.sidebar.session.menu.unpin"):f("sessions.sidebar.session.menu.pin"),onClick:()=>{h.onToggle(),u?.(!1)},style:{touchAction:"manipulation"},children:n.jsx(G,{name:h.pinned?"unpin":"pushpin",className:"size-[18px]"})}):null,e[13]=u,e[14]=h,e[15]=f,e[16]=g,e[17]=_):_=e[17];let A;e[18]!==u||e[19]!==f||e[20]!==g||e[21]!==p?(A=p?n.jsx("button",{type:"button",tabIndex:g,className:ie("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",p.inWork?"text-status-success":"text-muted-foreground active:text-foreground"),"aria-label":p.inWork?f("sessions.sidebar.session.work.markDone"):f("sessions.sidebar.session.work.track"),onClick:()=>{p.onToggle(),u?.(!1)},style:{touchAction:"manipulation"},children:n.jsx(G,{name:p.inWork?"check":"eye",className:p.inWork?"size-5":"size-[18px]"})}):null,e[18]=u,e[19]=f,e[20]=g,e[21]=p,e[22]=A):A=e[22];const k=i?"rounded-lg bg-destructive text-destructive-foreground":"text-[var(--status-error)] active:opacity-80";let S;e[23]!==k?(S=ie("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",k),e[23]=k,e[24]=S):S=e[24];let N;e[25]!==i||e[26]!==f||e[27]!==r?(N=i?f("mobile.sessions.confirmDeleteSessionAria",{title:r}):f("mobile.sessions.deleteSessionAria",{title:r}),e[25]=i,e[26]=f,e[27]=r,e[28]=N):N=e[28];const M=i?d:a;let B,O;e[29]===Symbol.for("react.memo_cache_sentinel")?(B={touchAction:"manipulation"},O=n.jsx(Vo,{className:"size-[18px]"}),e[29]=B,e[30]=O):(B=e[29],O=e[30]);let C;e[31]!==N||e[32]!==M||e[33]!==S||e[34]!==g?(C=n.jsx("button",{type:"button",tabIndex:g,className:S,"aria-label":N,onClick:M,style:B,children:O}),e[31]=N,e[32]=M,e[33]=S,e[34]=g,e[35]=C):C=e[35];let L;e[36]!==f||e[37]!==r?(L=f("mobile.sessions.renameSessionAria",{title:r}),e[36]=f,e[37]=r,e[38]=L):L=e[38];let I,j;e[39]===Symbol.for("react.memo_cache_sentinel")?(I={touchAction:"manipulation"},j=n.jsx(df,{className:"size-[18px]"}),e[39]=I,e[40]=j):(I=e[39],j=e[40]);let R;e[41]!==c||e[42]!==L||e[43]!==g?(R=n.jsx("button",{type:"button",tabIndex:g,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":L,onClick:c,style:I,children:j}),e[41]=c,e[42]=L,e[43]=g,e[44]=R):R=e[44];let T;e[45]!==f?(T=f("sessions.sidebar.session.menu.copyId"),e[45]=f,e[46]=T):T=e[46];let $;e[47]!==b?($=()=>{b()},e[47]=b,e[48]=$):$=e[48];let W,q;e[49]===Symbol.for("react.memo_cache_sentinel")?(W={touchAction:"manipulation"},q=n.jsx(G,{name:"file-copy",className:"size-[18px]"}),e[49]=W,e[50]=q):(W=e[49],q=e[50]);let D;e[51]!==T||e[52]!==$||e[53]!==g?(D=n.jsx("button",{type:"button",tabIndex:g,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":T,onClick:$,style:W,children:q}),e[51]=T,e[52]=$,e[53]=g,e[54]=D):D=e[54];let z;return e[55]!==C||e[56]!==R||e[57]!==D||e[58]!==P||e[59]!==_||e[60]!==A?(z=n.jsxs(n.Fragment,{children:[P,_,A,C,R,D]}),e[55]=C,e[56]=R,e[57]=D,e[58]=P,e[59]=_,e[60]=A,e[61]=z):z=e[61],z};function Up(){return null}const qp=({active:s,unread:e,running:t,pending:r})=>s?"text-interactive-selection-foreground":e||r.hasPermission||r.hasForm?"font-semibold text-foreground":t?"text-foreground":"oc-title-rest",Gp=s=>{const e=ne.c(7);let t;e[0]!==s?(t=a=>s.some(d=>!!a.bySession.get(d)?.permissions.length),e[0]=s,e[1]=t):t=e[1];const r=li(t);let o;e[2]!==s?(o=a=>s.some(d=>{const c=a.bySession.get(d);return!!(c?.forms.length||c?.pages.length)}),e[2]=s,e[3]=o):o=e[3];const i=li(o);let l;return e[4]!==i||e[5]!==r?(l={hasPermission:r,hasForm:i},e[4]=i,e[5]=r,e[6]=l):l=e[6],l},Jp=()=>{const s=new Map;for(const e of Cs.getState().activeSessions)e.parentID&&s.set(e.parentID,[...s.get(e.parentID)??[],e]);return s},Xp=(s,e,t)=>{He.getState().closeMainSurfaces(),e&&Lt.getState().setActiveProjectIdOnly(e),ot.getState().setCurrentSession(s.id,Rs(s)||null),t()},Vi=(s,e,t)=>{const r=ot.getState();return Su(s,e,Nu(e.id,Gl(Jp(),e.id),s==="delete"),{archiveSession:r.archiveSession,archiveSessions:r.archiveSessions,deleteSession:r.deleteSession,deleteSessions:r.deleteSessions},t)},Yp=async(s,e,t)=>{try{if(e.length===0){await ci(s.id,Rs(s)||null,"open");return}for(const r of e)await ci(r.id,Rs(r)||Rs(s)||null,"done")}catch{me.error(t("sessions.sidebar.session.work.updateFailed"))}},Qp=(s,e,t)=>{const r=Rs(s);if(!r)return;const o={directory:r,sessionId:s.id};Fo({current:e?ql(s)??nl:null,pin:i=>{gi(o,!0,i).catch(()=>me.error(t("sessions.sidebar.session.pin.pinFailed")))},unpin:()=>{gi(o,!1,null).catch(()=>me.error(t("sessions.sidebar.session.pin.unpinFailed")))}})},Zp=async(s,e,t)=>{try{await ot.getState().updateSessionTitle(s,e)}catch{me.error(t("mobile.sessions.renameError"))}},ut=vf()(s=>({revealedKey:null,armedKey:null,renamingKey:null,setRevealed:(e,t)=>s(r=>t?{revealedKey:e,armedKey:null}:r.revealedKey===e?{revealedKey:null,armedKey:null}:r),arm:e=>s({armedKey:e}),startRename:e=>s({renamingKey:e,revealedKey:null,armedKey:null}),stopRename:()=>s({renamingKey:null}),forgetUnlisted:e=>s(t=>{const r=t.revealedKey!==null&&!e(t.revealedKey),o=t.renamingKey!==null&&!e(t.renamingKey);return!r&&!o?t:{revealedKey:r?null:t.revealedKey,armedKey:r?null:t.armedKey,renamingKey:o?null:t.renamingKey}}),reset:()=>s({revealedKey:null,armedKey:null,renamingKey:null})})),gn=s=>{const e=ne.c(10);let t;e[0]!==s?(t=c=>c.revealedKey===s,e[0]=s,e[1]=t):t=e[1];const r=ut(t);let o;e[2]!==s?(o=c=>c.armedKey===s,e[2]=s,e[3]=o):o=e[3];const i=ut(o);let l;e[4]!==s?(l=c=>c.renamingKey===s,e[4]=s,e[5]=l):l=e[5];const a=ut(l);let d;return e[6]!==i||e[7]!==a||e[8]!==r?(d={revealed:r,armed:i,renaming:a},e[6]=i,e[7]=a,e[8]=r,e[9]=d):d=e[9],d},wa=m.createContext(null),eh=wa.Provider,Xs=()=>{const s=m.useContext(wa);if(!s)throw new Error("useMobileSidebarActions outside MobileSidebarActionsProvider");return s},Wn="shadow-[inset_0_0_0_100vmax_color-mix(in_srgb,var(--interactive-selection)_70%,transparent)]",Kr="text-interactive-selection-foreground",th={touchAction:"manipulation",minHeight:0,minWidth:0},Us=s=>{const e=ne.c(14),{expanded:t,kind:r,label:o,onToggle:i}=s,{t:l}=ge();let a;e[0]!==t||e[1]!==r||e[2]!==o||e[3]!==l?(a=r==="session"?l(t?"sessions.sidebar.session.subsessions.collapse":"sessions.sidebar.session.subsessions.expand"):r==="run"?l(t?"sessions.sidebar.run.collapse":"sessions.sidebar.run.expand"):t?l("sessions.sidebar.group.collapseAria",{label:o}):l("sessions.sidebar.group.expandAria",{label:o}),e[0]=t,e[1]=r,e[2]=o,e[3]=l,e[4]=a):a=e[4];const d=a;let c;e[5]!==i?(c=h=>{h.stopPropagation(),i()},e[5]=i,e[6]=c):c=e[6];let u;e[7]!==t?(u=n.jsx(Er,{expanded:t}),e[7]=t,e[8]=u):u=e[8];let p;return e[9]!==d||e[10]!==t||e[11]!==c||e[12]!==u?(p=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:th,"aria-label":d,"aria-expanded":t,onClick:c,children:u}),e[9]=d,e[10]=t,e[11]=c,e[12]=u,e[13]=p):p=e[13],p},Vr=s=>{const e=ne.c(5),{slotLeft:t,children:r}=s,o=t-9;let i;e[0]!==o?(i={insetInlineStart:o},e[0]=o,e[1]=i):i=e[1];let l;return e[2]!==r||e[3]!==i?(l=n.jsx("span",{className:"absolute inset-y-0 z-10 flex items-center",style:i,children:r}),e[2]=r,e[3]=i,e[4]=l):l=e[4],l},Kn=s=>{const e=ne.c(19),{indent:t,onSelect:r,ariaLabel:o,chevron:i,firstLine:l,secondLine:a}=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 c;e[2]!==i||e[3]!==a?(c=a||i?n.jsxs("span",{className:"flex h-4 min-w-0 items-center gap-1.5 text-muted-foreground",children:[i?n.jsx("span",{"aria-hidden":!0,className:"size-3.5 shrink-0"}):null,a]}):null,e[2]=i,e[3]=a,e[4]=c):c=e[4];let u;e[5]!==d||e[6]!==c?(u=n.jsxs(n.Fragment,{children:[d,c]}),e[5]=d,e[6]=c,e[7]=u):u=e[7];const p=u;let h;e[8]!==o||e[9]!==t||e[10]!==p||e[11]!==r?(h=r?n.jsx("button",{type:"button",className:ie("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":o,onClick:r,children:p}):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:p}),e[8]=o,e[9]=t,e[10]=p,e[11]=r,e[12]=h):h=e[12];let f;e[13]!==i||e[14]!==t?(f=i?n.jsx("span",{className:"absolute z-10 flex h-8 items-center",style:{insetInlineStart:t-9,top:22},children:i}):null,e[13]=i,e[14]=t,e[15]=f):f=e[15];let g;return e[16]!==h||e[17]!==f?(g=n.jsxs("div",{className:"relative flex min-w-0 flex-1",children:[h,f]}),e[16]=h,e[17]=f,e[18]=g):g=e[18],g},Mt=s=>{const e=ne.c(13),{icon:t,glyph:r,label:o,revealed:i,onClick:l,tone:a,armed:d,disabled:c}=s,u=a===void 0?"default":a,p=d===void 0?!1:d,h=c===void 0?!1:c,f=i?0:-1,g=u==="destructive"?p?"rounded-lg bg-destructive text-destructive-foreground focus-visible:ring-destructive":"text-[var(--status-error)] active:opacity-80 focus-visible:ring-destructive":u==="success"?"text-status-success active:opacity-80 focus-visible:ring-ring":"text-muted-foreground active:text-foreground focus-visible:ring-ring";let x;e[0]!==g?(x=ie("flex flex-1 items-center justify-center transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset disabled:opacity-40",g),e[0]=g,e[1]=x):x=e[1];let b;e[2]===Symbol.for("react.memo_cache_sentinel")?(b={touchAction:"manipulation"},e[2]=b):b=e[2];let w;e[3]!==r||e[4]!==t?(w=r??n.jsx(G,{name:t,className:t==="check"?"size-5":"size-[18px]"}),e[3]=r,e[4]=t,e[5]=w):w=e[5];let v;return e[6]!==h||e[7]!==o||e[8]!==l||e[9]!==f||e[10]!==x||e[11]!==w?(v=n.jsx("button",{type:"button",tabIndex:f,disabled:h,className:x,"aria-label":o,onClick:l,style:b,children:w}),e[6]=h,e[7]=o,e[8]=l,e[9]=f,e[10]=x,e[11]=w,e[12]=v):v=e[12],v},sh=s=>{const e=ne.c(15),{more:t,fewer:r,indent:o,onShow:i}=s,{t:l}=ge();let a;e[0]!==i||e[1]!==l?(a=f=>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:()=>i(f),children:[n.jsx(G,{name:f==="more"?"arrow-down-s":"arrow-up-s",className:"size-4"}),n.jsx("span",{className:"typography-micro",children:l(f==="more"?"sessions.sidebar.group.showMore":"sessions.sidebar.group.showFewer")})]}),e[0]=i,e[1]=l,e[2]=a):a=e[2];const d=a;let c;e[3]!==o?(c={paddingInlineStart:o},e[3]=o,e[4]=c):c=e[4];let u;e[5]!==d||e[6]!==t?(u=t?d("more"):null,e[5]=d,e[6]=t,e[7]=u):u=e[7];let p;e[8]!==d||e[9]!==r?(p=r?d("fewer"):null,e[8]=d,e[9]=r,e[10]=p):p=e[10];let h;return e[11]!==c||e[12]!==u||e[13]!==p?(h=n.jsxs("div",{className:"flex w-full items-center gap-2",style:c,children:[u,p]}),e[11]=c,e[12]=u,e[13]=p,e[14]=h):h=e[14],h},ja=s=>s.children.flatMap(e=>[e.session.id,...ja(e)]),nh=s=>{const e=ne.c(183),{row:t,geometry:r,toggleParent:o}=s,{t:i}=ge(),l=Xs(),{node:a,depth:d}=t,c=a.session,u=Rs(c),{revealed:p,armed:h,renaming:f}=gn(t.key);let g;e[0]!==c.title||e[1]!==i?(g=c.title?.trim()||i("mobile.sessions.untitled"),e[0]=c.title,e[1]=i,e[2]=g):g=e[2];const x=g,b=Cu(c.id,c.directory,p||f);let w;e[3]!==c.id?(w=_e=>_e.currentSessionId===c.id,e[3]=c.id,e[4]=w):w=e[4];const v=ot(w),E=He(rh),P=v&&!E,_=wo(c.id),A=jo(c.id),k=A!==null,S=!k&&_&&!P,N=ko(c.id,k),M=(k||S)&&N,B=a.children.length>0,O=t.forceExpanded===!0||t.expanded===!0;let C;e[5]!==O||e[6]!==B||e[7]!==a||e[8]!==c.id?(C=B&&!O?[c.id,...ja(a)]:[c.id],e[5]=O,e[6]=B,e[7]=a,e[8]=c.id,e[9]=C):C=e[9];const I=Gp(C),j=!c.parentID,T=He(ih)&&t.ownsWork&&j&&!kr(u);let $;e[10]!==a||e[11]!==T?($=T?Ru(a):[],e[10]=a,e[11]=T,e[12]=$):$=e[12];const W=$;let q;e[13]!==T||e[14]!==c||e[15]!==W||e[16]!==i?(q=T?{inWork:W.length>0,onToggle:()=>{Yp(c,W,i)}}:void 0,e[13]=T,e[14]=c,e[15]=W,e[16]=i,e[17]=q):q=e[17];const D=q;let z;e[18]!==u||e[19]!==c.id?(z=_e=>Xl(_e.ids,u||null,c.id),e[18]=u,e[19]=c.id,e[20]=z):z=e[20];const J=ho(z);let ee;e[21]!==u||e[22]!==J||e[23]!==c||e[24]!==i||e[25]!==j?(ee=j&&u?{pinned:J,onToggle:()=>Qp(c,J,i)}:void 0,e[21]=u,e[22]=J,e[23]=c,e[24]=i,e[25]=j,e[26]=ee):ee=e[26];const Q=ee,Y=t.renderContext==="timeline-mixed"||t.renderContext==="mixed-compact",K=gt(oh)&&Y;let Z;e[27]!==k||e[28]!==c||e[29]!==D?.inWork?(Z=!!D?.inWork&&!k&&Jl(c),e[27]=k,e[28]=c,e[29]=D?.inWork,e[30]=Z):Z=e[30];const U=Z;let H;e[31]!==t.detailed||e[32]!==t.renderContext?(H=t.detailed===!0||Eu(t.renderContext),e[31]=t.detailed,e[32]=t.renderContext,e[33]=H):H=e[33];const se=H;let fe;e[34]!==se||e[35]!==t.projectId||e[36]!==t.renderContext?(fe=_e=>se&&t.renderContext==="timeline-mixed"&&t.projectId?_e.projects.find(Ae=>Ae.id===t.projectId)??null:null,e[34]=se,e[35]=t.projectId,e[36]=t.renderContext,e[37]=fe):fe=e[37];const ce=Lt(fe),ae=a.worktree?.branch??null;let je;e[38]!==t.secondaryMeta||e[39]!==ae?(je=Iu(t.secondaryMeta,ae),e[38]=t.secondaryMeta,e[39]=ae,e[40]=je):je=e[40];const Re=je,{refLines:te}=Tu(c,a.worktree,!1),pe=te[0]??null,X=Math.max(0,te.length-1);let oe;e[41]!==X||e[42]!==pe||e[43]!==te?(oe=_e=>pe?n.jsxs("span",{role:"img","aria-label":te.map(ah).join(", "),className:"inline-flex shrink-0 items-center gap-0.5 typography-micro text-muted-foreground",children:[n.jsx(G,{name:pe.icon,className:ie("size-3",pe.color&&"oc-ref-tint"),style:pe.color?dr(pe.color):void 0}),_e?n.jsx("span",{className:"leading-none tabular-nums",children:pe.label}):null,_e&&X>0?n.jsxs("span",{className:"leading-none tabular-nums text-muted-foreground",children:["+",X]}):null]}):null,e[41]=X,e[42]=pe,e[43]=te,e[44]=oe):oe=e[44];const ve=oe,we=t.secondaryMeta?.inSpace===!0;let Se;e[45]!==B||e[46]!==t.archived||e[47]!==t.forceExpanded||e[48]!==t.renderContext||e[49]!==c.id||e[50]!==o?(Se=B&&!t.forceExpanded?()=>o(_u(t.renderContext,t.archived,c.id)):void 0,e[45]=B,e[46]=t.archived,e[47]=t.forceExpanded,e[48]=t.renderContext,e[49]=c.id,e[50]=o,e[51]=Se):Se=e[51];const be=Se;let xe;e[52]!==t.key?(xe=_e=>ut.getState().setRevealed(t.key,_e),e[52]=t.key,e[53]=xe):xe=e[53];const V=xe;let ue;e[54]!==l||e[55]!==p||e[56]!==t.projectId||e[57]!==c||e[58]!==V?(ue=()=>{if(p){V(!1);return}Xp(c,t.projectId,l.close)},e[54]=l,e[55]=p,e[56]=t.projectId,e[57]=c,e[58]=V,e[59]=ue):ue=e[59];const Le=ue,$e=lh,Te=I.hasPermission||I.hasForm;let Xe;e[60]!==b.pending||e[61]!==k||e[62]!==S||e[63]!==i||e[64]!==A||e[65]!==Te?(Xe=b.pending?n.jsx(G,{name:"loader-4",className:"size-3 shrink-0 animate-spin text-status-info","aria-label":i("sessions.aiRename.generating")}):(k||S)&&!Te?n.jsx(So,{state:A??"unread"}):null,e[60]=b.pending,e[61]=k,e[62]=S,e[63]=i,e[64]=A,e[65]=Te,e[66]=Xe):Xe=e[66];const Ye=Xe;let tt;e[67]!==k||e[68]!==c.id||e[69]!==M||e[70]!==Te?(tt=M&&!Te?n.jsx(Nr,{sessionId:c.id,running:k,className:"shrink-0 typography-micro"}):null,e[67]=k,e[68]=c.id,e[69]=M,e[70]=Te,e[71]=tt):tt=e[71];const rt=tt;let ye;e[72]!==J||e[73]!==K||e[74]!==i?(ye=J&&!K?n.jsx(G,{name:"pushpin",className:"size-3 shrink-0 text-muted-foreground","aria-label":i("sessions.sidebar.session.status.pinned")}):null,e[72]=J,e[73]=K,e[74]=i,e[75]=ye):ye=e[75];const Fe=ye;let We;e[76]!==U||e[77]!==i?(We=U?n.jsx(G,{name:"check",className:"size-3.5 shrink-0 text-muted-foreground","aria-label":i("sessions.sidebar.session.work.doneSuggested")}):null,e[76]=U,e[77]=i,e[78]=We):We=e[78];const Qe=We;let Ze;e[79]!==P||e[80]!==k||e[81]!==I||e[82]!==S?(Ze=ie("block min-w-0 flex-1 truncate oc-ui-start-align typography-ui-label",qp({active:P,unread:S,running:k,pending:I})),e[79]=P,e[80]=k,e[81]=I,e[82]=S,e[83]=Ze):Ze=e[83];let st;e[84]!==Ze||e[85]!==x?(st=n.jsx("span",{dir:"auto",className:Ze,children:x}),e[84]=Ze,e[85]=x,e[86]=st):st=e[86];const Oe=st;let Ue;e[87]!==b||e[88]!==c.id||e[89]!==i||e[90]!==x?(Ue=(_e,Ae)=>n.jsx(Wr,{initialTitle:x,indent:_e,aiRename:b,className:Ae,onSubmit:Ke=>{$e(),Zp(c.id,Ke,i)},onCancel:$e}),e[87]=b,e[88]=c.id,e[89]=i,e[90]=x,e[91]=Ue):Ue=e[91];const Ge=Ue;let nt;if(se){let _e;e[92]!==ce?(_e=ce?n.jsx(Js,{project:ce,size:"xs"}):null,e[92]=ce,e[93]=_e):_e=e[93];const Ae=_e;let Ke;e[94]!==d||e[95]!==r?(Ke=r.detailedLeft(d),e[94]=d,e[95]=r,e[96]=Ke):Ke=e[96];const qe=f?void 0:Le;let ht;e[97]!==O||e[98]!==x||e[99]!==be?(ht=be?n.jsx(Us,{expanded:O,label:x,kind:"session",onToggle:be}):null,e[97]=O,e[98]=x,e[99]=be,e[100]=ht):ht=e[100];let Ve;e[101]!==Qe||e[102]!==Ye||e[103]!==Fe||e[104]!==Ge||e[105]!==f||e[106]!==rt||e[107]!==Oe?(Ve=f?Ge(0,"h-[1lh] pe-0 typography-ui-label [&_button]:size-6 [&_button>svg]:size-3.5"):n.jsxs(n.Fragment,{children:[Oe,Fe,Qe,Ye,rt]}),e[101]=Qe,e[102]=Ye,e[103]=Fe,e[104]=Ge,e[105]=f,e[106]=rt,e[107]=Oe,e[108]=Ve):Ve=e[108];let lt;e[109]!==Re||e[110]!==we||e[111]!==Ae||e[112]!==I||e[113]!==pe||e[114]!==ce||e[115]!==ve||e[116]!==c||e[117]!==i||e[118]!==Te?(lt=ce||Re||Do(c)||pe||Te?n.jsxs(n.Fragment,{children:[Ae,Re?n.jsxs(n.Fragment,{children:[we?n.jsx(G,{name:"instance",className:"size-3.5 shrink-0","aria-hidden":!1,role:"img","aria-label":i("sessions.sidebar.group.space")}):n.jsx(G,{name:"git-branch",className:"size-3.5 shrink-0"}),n.jsx("span",{className:"block min-w-0 truncate typography-micro",children:Re})]}):null,n.jsxs("span",{className:"ms-auto flex shrink-0 items-center gap-1.5",children:[n.jsx($i,{session:c}),ve(!0),n.jsx(Wi,{...I})]})]}):null,e[109]=Re,e[110]=we,e[111]=Ae,e[112]=I,e[113]=pe,e[114]=ce,e[115]=ve,e[116]=c,e[117]=i,e[118]=Te,e[119]=lt):lt=e[119];let yt;e[120]!==Ke||e[121]!==qe||e[122]!==ht||e[123]!==Ve||e[124]!==lt?(yt=n.jsx(Kn,{indent:Ke,onSelect:qe,chevron:ht,firstLine:Ve,secondLine:lt}),e[120]=Ke,e[121]=qe,e[122]=ht,e[123]=Ve,e[124]=lt,e[125]=yt):yt=e[125],nt=yt}else{let _e;e[126]!==d||e[127]!==O||e[128]!==r||e[129]!==x||e[130]!==be?(_e=be?n.jsx(Vr,{slotLeft:r.slotLeft(d),children:n.jsx(Us,{expanded:O,label:x,kind:"session",onToggle:be})}):null,e[126]=d,e[127]=O,e[128]=r,e[129]=x,e[130]=be,e[131]=_e):_e=e[131];let Ae;e[132]!==d||e[133]!==Qe||e[134]!==r||e[135]!==Ye||e[136]!==I||e[137]!==Fe||e[138]!==ve||e[139]!==Ge||e[140]!==f||e[141]!==Le||e[142]!==c||e[143]!==rt||e[144]!==Oe?(Ae=f?Ge(r.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:r.textLeft(d),touchAction:"manipulation"},onClick:Le,children:[Oe,n.jsx($i,{session:c}),ve(!1),n.jsx(Wi,{...I}),Fe,Qe,Ye,rt]}),e[132]=d,e[133]=Qe,e[134]=r,e[135]=Ye,e[136]=I,e[137]=Fe,e[138]=ve,e[139]=Ge,e[140]=f,e[141]=Le,e[142]=c,e[143]=rt,e[144]=Oe,e[145]=Ae):Ae=e[145];let Ke;e[146]!==_e||e[147]!==Ae?(Ke=n.jsxs(n.Fragment,{children:[_e,Ae]}),e[146]=_e,e[147]=Ae,e[148]=Ke):Ke=e[148],nt=Ke}const Tt=Kp+(D?_s:0)+(Q?_s:0),Ct=P&&Wn;let at;e[149]!==Ct?(at=ie("relative flex w-full items-center bg-background transition-colors",Ct),e[149]=Ct,e[150]=at):at=e[150];let mt;e[151]!==c||e[152]!==V||e[153]!==i?(mt=()=>{V(!1),Vi("archive",c,i)},e[151]=c,e[152]=V,e[153]=i,e[154]=mt):mt=e[154];let pt;e[155]!==t.key?(pt=()=>ut.getState().arm(t.key),e[155]=t.key,e[156]=pt):pt=e[156];let bt;e[157]!==c||e[158]!==V||e[159]!==i?(bt=()=>{V(!1),Vi("delete",c,i)},e[157]=c,e[158]=V,e[159]=i,e[160]=bt):bt=e[160];let et;e[161]!==t.key?(et=()=>ut.getState().startRename(t.key),e[161]=t.key,e[162]=et):et=e[162];let Ie;e[163]!==h||e[164]!==Q||e[165]!==p||e[166]!==c.id||e[167]!==V||e[168]!==mt||e[169]!==pt||e[170]!==bt||e[171]!==et||e[172]!==x||e[173]!==D?(Ie=n.jsx(Hp,{sessionId:c.id,title:x,revealed:p,confirmingDelete:h,onArchive:mt,onRequestDelete:pt,onConfirmDelete:bt,onRequestRename:et,onRevealedChange:V,work:D,pin:Q}),e[163]=h,e[164]=Q,e[165]=p,e[166]=c.id,e[167]=V,e[168]=mt,e[169]=pt,e[170]=bt,e[171]=et,e[172]=x,e[173]=D,e[174]=Ie):Ie=e[174];let xt;return e[175]!==P||e[176]!==nt||e[177]!==p||e[178]!==V||e[179]!==Tt||e[180]!==at||e[181]!==Ie?(xt=n.jsx(hn,{actionsWidth:Tt,revealed:p,onRevealedChange:V,dataActiveSession:P,contentClassName:at,actions:Ie,children:nt}),e[175]=P,e[176]=nt,e[177]=p,e[178]=V,e[179]=Tt,e[180]=at,e[181]=Ie,e[182]=xt):xt=e[182],xt};function rh(s){return s.runOverviewKey!==null}function ih(s){return s.sessionWorkEnabled}function oh(s){return s.showPinnedSection}function ah(s){return s.text}function lh(){return ut.getState().stopRename()}const ka="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",Vn=()=>{const s=ut.getState();return s.revealedKey?(s.setRevealed(s.revealedKey,!1),!0):!1},Sa=s=>{const e=ne.c(20),{label:t,collapsed:r,forceExpanded:o,onToggle:i}=s,{t:l}=ge();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=ie(ka,"w-full gap-1"),e[0]=a):a=e[0];let d;e[1]!==i?(d=()=>{Vn()||i()},e[1]=i,e[2]=d):d=e[2];const c=!r;let u;e[3]!==r||e[4]!==t||e[5]!==l?(u=r?l("sessions.sidebar.group.expandAria",{label:t}):l("sessions.sidebar.group.collapseAria",{label:t}),e[3]=r,e[4]=t,e[5]=l,e[6]=u):u=e[6];let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p={touchAction:"manipulation"},e[7]=p):p=e[7];let h;e[8]!==t?(h=n.jsx("span",{className:"min-w-0 truncate typography-ui-label font-medium text-muted-foreground",children:t}),e[8]=t,e[9]=h):h=e[9];let f;e[10]!==r||e[11]!==o?(f=o?null:n.jsx(G,{name:r?"arrow-right-s":"arrow-down-s",className:"size-4 shrink-0 text-muted-foreground"}),e[10]=r,e[11]=o,e[12]=f):f=e[12];let g;return e[13]!==o||e[14]!==d||e[15]!==c||e[16]!==u||e[17]!==h||e[18]!==f?(g=n.jsxs("button",{type:"button",className:a,disabled:o,onClick:d,"aria-expanded":c,"aria-label":u,style:p,children:[h,f]}),e[13]=o,e[14]=d,e[15]=c,e[16]=u,e[17]=h,e[18]=f,e[19]=g):g=e[19],g},ch=s=>{const e=ne.c(9),{row:t,onToggle:r}=s,{t:o}=ge();let i;e[0]!==t.activityKey||e[1]!==t.label||e[2]!==o?(i=t.label??(Au(t.activityKey)?o(Pu[t.activityKey]):""),e[0]=t.activityKey,e[1]=t.label,e[2]=o,e[3]=i):i=e[3];let l;return e[4]!==r||e[5]!==t.collapsed||e[6]!==t.forceExpanded||e[7]!==i?(l=n.jsx(Sa,{label:i,collapsed:t.collapsed,forceExpanded:t.forceExpanded,onToggle:r}),e[4]=r,e[5]=t.collapsed,e[6]=t.forceExpanded,e[7]=i,e[8]=l):l=e[8],l},uh=s=>{const e=ne.c(8),{row:t,onToggle:r}=s,{t:o}=ge();let i;e[0]!==t.label||e[1]!==o?(i=t.label??o("sessions.sidebar.activity.projectsTitle"),e[0]=t.label,e[1]=o,e[2]=i):i=e[2];let l;return e[3]!==r||e[4]!==t.collapsed||e[5]!==t.forceExpanded||e[6]!==i?(l=n.jsx(Sa,{label:i,collapsed:t.collapsed,forceExpanded:t.forceExpanded,onToggle:r}),e[3]=r,e[4]=t.collapsed,e[5]=t.forceExpanded,e[6]=i,e[7]=l):l=e[7],l},Hi=s=>{const e=ne.c(10),{icon:t,label:r,onClick:o}=s;let i;e[0]!==o?(i=u=>{u.stopPropagation(),o()},e[0]=o,e[1]=i):i=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l={touchAction:"manipulation"},e[2]=l):l=e[2];const a=t==="add"?"size-4":"size-3.5";let d;e[3]!==t||e[4]!==a?(d=n.jsx(G,{name:t,className:a}),e[3]=t,e[4]=a,e[5]=d):d=e[5];let c;return e[6]!==r||e[7]!==i||e[8]!==d?(c=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":r,title:r,onClick:i,style:l,children:d}),e[6]=r,e[7]=i,e[8]=d,e[9]=c):c=e[9],c},dh=s=>{const e=ne.c(71),{row:t,label:r,isRepo:o,active:i,onToggle:l,onNewSession:a,onRemove:d}=s,{t:c}=ge(),u=Xs(),p=t.section.project,{revealed:h,armed:f}=gn(t.key);let g;e[0]!==t.key?(g=W=>ut.getState().setRevealed(t.key,W),e[0]=t.key,e[1]=g):g=e[1];const x=g;let b;e[2]!==f||e[3]!==r||e[4]!==c?(b=f?c("mobile.sessions.confirmRemoveProjectAria",{label:r}):c("mobile.sessions.removeProjectAria",{label:r}),e[2]=f,e[3]=r,e[4]=c,e[5]=b):b=e[5];let w;e[6]!==f||e[7]!==r||e[8]!==d||e[9]!==t.key||e[10]!==x||e[11]!==c?(w=()=>{if(!f){ut.getState().arm(t.key);return}x(!1),d(),me.success(c("mobile.sessions.toast.projectRemoved",{label:r}))},e[6]=f,e[7]=r,e[8]=d,e[9]=t.key,e[10]=x,e[11]=c,e[12]=w):w=e[12];let v;e[13]!==f||e[14]!==h||e[15]!==b||e[16]!==w?(v=n.jsx(Mt,{icon:"delete-bin",tone:"destructive",armed:f,label:b,revealed:h,onClick:w}),e[13]=f,e[14]=h,e[15]=b,e[16]=w,e[17]=v):v=e[17];let E;e[18]!==r||e[19]!==c?(E=c("mobile.sessions.editProjectAria",{label:r}),e[18]=r,e[19]=c,e[20]=E):E=e[20];let P;e[21]!==u||e[22]!==p.id||e[23]!==x?(P=()=>{x(!1),u.openProjectEdit(p.id)},e[21]=u,e[22]=p.id,e[23]=x,e[24]=P):P=e[24];let _;e[25]!==h||e[26]!==E||e[27]!==P?(_=n.jsx(Mt,{icon:"edit",label:E,revealed:h,onClick:P}),e[25]=h,e[26]=E,e[27]=P,e[28]=_):_=e[28];let A;e[29]!==v||e[30]!==_?(A=n.jsxs(n.Fragment,{children:[v,_]}),e[29]=v,e[30]=_,e[31]=A):A=e[31];const k=i||void 0;let S;e[32]!==l||e[33]!==t.forceExpanded?(S=()=>{!Vn()&&!t.forceExpanded&&l()},e[32]=l,e[33]=t.forceExpanded,e[34]=S):S=e[34];const N=!t.collapsed;let M;e[35]!==r||e[36]!==t.collapsed||e[37]!==c?(M=t.collapsed?c("sessions.sidebar.group.expandAria",{label:r}):c("sessions.sidebar.group.collapseAria",{label:r}),e[35]=r,e[36]=t.collapsed,e[37]=c,e[38]=M):M=e[38];let B;e[39]===Symbol.for("react.memo_cache_sentinel")?(B={touchAction:"manipulation"},e[39]=B):B=e[39];let O;e[40]!==p?(O=n.jsx(Js,{project:p,size:"xs"}),e[40]=p,e[41]=O):O=e[41];let C;e[42]!==r?(C=n.jsx("span",{className:"block min-w-0 flex-1 truncate ps-1 typography-ui-label font-medium text-foreground",children:r}),e[42]=r,e[43]=C):C=e[43];let L;e[44]!==S||e[45]!==N||e[46]!==M||e[47]!==O||e[48]!==C?(L=n.jsxs("button",{type:"button",className:ka,onClick:S,"aria-expanded":N,"aria-label":M,style:B,children:[O,C]}),e[44]=S,e[45]=N,e[46]=M,e[47]=O,e[48]=C,e[49]=L):L=e[49];let I;e[50]!==u||e[51]!==o||e[52]!==p.id||e[53]!==c?(I=o?n.jsx(Hi,{icon:"git-branch",label:c("sessions.sidebar.project.actions.newWorktree"),onClick:()=>u.openNewWorktree(p.id)}):null,e[50]=u,e[51]=o,e[52]=p.id,e[53]=c,e[54]=I):I=e[54];let j;e[55]!==r||e[56]!==c?(j=c("mobile.sessions.newSessionInProjectAria",{label:r}),e[55]=r,e[56]=c,e[57]=j):j=e[57];let R;e[58]!==a||e[59]!==j?(R=n.jsx(Hi,{icon:"add",label:j,onClick:a}),e[58]=a,e[59]=j,e[60]=R):R=e[60];let T;e[61]!==L||e[62]!==I||e[63]!==R||e[64]!==k?(T=n.jsxs("div",{"data-active-project":k,className:"flex min-h-10 w-full items-center",children:[L,I,R]}),e[61]=L,e[62]=I,e[63]=R,e[64]=k,e[65]=T):T=e[65];let $;return e[66]!==h||e[67]!==x||e[68]!==T||e[69]!==A?($=n.jsx(hn,{actionsWidth:2*_s,revealed:h,onRevealedChange:x,actions:A,children:T}),e[66]=h,e[67]=x,e[68]=T,e[69]=A,e[70]=$):$=e[70],$},fh=s=>{const e=ne.c(28),{row:t,geometry:r,onToggle:o}=s,{t:i}=ge(),l=t.group.label,a=t.forceExpanded||!t.collapsed;let d;e[0]!==o||e[1]!==t.empty||e[2]!==t.forceExpanded||e[3]!==t.groupKey?(d=()=>{!Vn()&&!t.empty&&!t.forceExpanded&&o(t.groupKey)},e[0]=o,e[1]=t.empty,e[2]=t.forceExpanded,e[3]=t.groupKey,e[4]=d):d=e[4];const c=t.empty?void 0:a;let u;e[5]!==a||e[6]!==l||e[7]!==t.empty||e[8]!==i?(u=t.empty?l:a?i("sessions.sidebar.group.collapseAria",{label:l}):i("sessions.sidebar.group.expandAria",{label:l}),e[5]=a,e[6]=l,e[7]=t.empty,e[8]=i,e[9]=u):u=e[9];let p;e[10]!==r||e[11]!==t.depth?(p=r.slotLeft(t.depth),e[10]=r,e[11]=t.depth,e[12]=p):p=e[12];let h;e[13]!==p?(h={paddingInlineStart:p,touchAction:"manipulation"},e[13]=p,e[14]=h):h=e[14];let f;e[15]!==a||e[16]!==t.empty?(f=t.empty?n.jsx("span",{"aria-hidden":!0,className:"size-3.5 shrink-0"}):n.jsx(Er,{expanded:a}),e[15]=a,e[16]=t.empty,e[17]=f):f=e[17];let g;e[18]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(G,{name:"folder",className:"mx-px size-3 shrink-0 text-muted-foreground"}),e[18]=g):g=e[18];let x;e[19]!==l?(x=n.jsx("span",{className:"block min-w-0 flex-1 truncate typography-ui-label font-medium oc-group-label",children:l}),e[19]=l,e[20]=x):x=e[20];let b;return e[21]!==d||e[22]!==c||e[23]!==u||e[24]!==h||e[25]!==f||e[26]!==x?(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":c,"aria-label":u,style:h,children:[f,g,x]}),e[21]=d,e[22]=c,e[23]=u,e[24]=h,e[25]=f,e[26]=x,e[27]=b):b=e[27],b},mh=s=>{const e=ne.c(29),{row:t,geometry:r}=s,{t:o}=ge(),i=t.forceExpanded||!t.collapsed;let l;e[0]!==t.empty||e[1]!==t.folder||e[2]!==t.forceExpanded?(l=()=>{!Vn()&&!t.empty&&!t.forceExpanded&&Yl.getState().toggleFolderCollapse(t.folder.id)},e[0]=t.empty,e[1]=t.folder,e[2]=t.forceExpanded,e[3]=l):l=e[3];const a=t.empty?void 0:i;let d;e[4]!==i||e[5]!==t.displayName||e[6]!==t.empty||e[7]!==o?(d=t.empty?t.displayName:i?o("sessions.sidebar.folderItem.collapseAria",{folderName:t.displayName}):o("sessions.sidebar.folderItem.expandAria",{folderName:t.displayName}),e[4]=i,e[5]=t.displayName,e[6]=t.empty,e[7]=o,e[8]=d):d=e[8];let c;e[9]!==r||e[10]!==t.depth?(c=r.slotLeft(t.depth),e[9]=r,e[10]=t.depth,e[11]=c):c=e[11];let u;e[12]!==c?(u={paddingInlineStart:c,touchAction:"manipulation"},e[12]=c,e[13]=u):u=e[13];let p;e[14]!==i||e[15]!==t.empty?(p=t.empty?n.jsx("span",{"aria-hidden":!0,className:"size-3.5 shrink-0"}):n.jsx(Er,{expanded:i}),e[14]=i,e[15]=t.empty,e[16]=p):p=e[16];const h=i&&!t.empty?"folder-open":"folder";let f;e[17]!==h?(f=n.jsx(G,{name:h,className:"mx-px size-3 shrink-0 text-muted-foreground"}),e[17]=h,e[18]=f):f=e[18];let g;e[19]!==t.displayName?(g=n.jsx("span",{className:"block min-w-0 flex-1 truncate typography-ui-label font-medium oc-group-label",children:t.displayName}),e[19]=t.displayName,e[20]=g):g=e[20];let x;return e[21]!==l||e[22]!==a||e[23]!==d||e[24]!==u||e[25]!==p||e[26]!==f||e[27]!==g?(x=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:l,"aria-expanded":a,"aria-label":d,style:u,children:[p,f,g]}),e[21]=l,e[22]=a,e[23]=d,e[24]=u,e[25]=p,e[26]=f,e[27]=g,e[28]=x):x=e[28],x},ph=s=>{const e=ne.c(23),{row:t,indent:r,onRetry:o,onGrantAccess:i}=s,{t:l}=ge();let a;e[0]!==t.status.state||e[1]!==l?(a=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]=a):a=e[2];const d=a;let c;e[3]!==r?(c={paddingInlineStart:r},e[3]=r,e[4]=c):c=e[4];let u;e[5]!==t.status.state?(u=t.status.state==="loading"?n.jsx(Oo,{className:"size-3"}):null,e[5]=t.status.state,e[6]=u):u=e[6];let p;e[7]!==d?(p=n.jsx("span",{children:d}),e[7]=d,e[8]=p):p=e[8];let h;e[9]!==i||e[10]!==t.status.canGrantAccess||e[11]!==l?(h=t.status.canGrantAccess?n.jsx(Ee,{variant:"link",size:"xs",className:"h-auto p-0 typography-micro",onClick:i,children:l("sessions.sidebar.group.empty.grantAccess")}):null,e[9]=i,e[10]=t.status.canGrantAccess,e[11]=l,e[12]=h):h=e[12];let f;e[13]!==o||e[14]!==t.status.state||e[15]!==l?(f=t.status.state!=="loading"?n.jsx(Ee,{variant:"link",size:"xs",className:"h-auto p-0 typography-micro",onClick:o,children:l("sessions.sidebar.group.empty.retry")}):null,e[13]=o,e[14]=t.status.state,e[15]=l,e[16]=f):f=e[16];let g;return e[17]!==c||e[18]!==u||e[19]!==p||e[20]!==h||e[21]!==f?(g=n.jsxs("div",{className:"flex min-h-9 flex-wrap items-center gap-2 py-1 pe-3 typography-micro text-muted-foreground",style:c,children:[u,p,h,f]}),e[17]=c,e[18]=u,e[19]=p,e[20]=h,e[21]=f,e[22]=g):g=e[22],g},hh=4,Ui=s=>{const e=ne.c(4),{providerIDs:t}=s;let r;e[0]!==t?(r=t.slice(0,hh).map(gh),e[0]=t,e[1]=r):r=e[1];let o;return e[2]!==r?(o=n.jsx("span",{className:"inline-flex shrink-0 items-center -space-x-1",children:r}),e[2]=r,e[3]=o):o=e[3],o};function gh(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(yo,{providerId:s,className:"size-3 opacity-80"})},s)}const Hr="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",Ur=(s,e)=>{const t=ne.c(3);let r;return t[0]!==s||t[1]!==e?(r=o=>e&&s?o.projects.find(i=>i.id===s)??null:null,t[0]=s,t[1]=e,t[2]=r):r=t[2],Lt(r)},qr=s=>{const e=ne.c(5),{slotLeft:t,children:r}=s;let o;e[0]!==t?(o={insetInlineStart:t},e[0]=t,e[1]=o):o=e[1];let i;return e[2]!==r||e[3]!==o?(i=n.jsx("span",{className:"pointer-events-none absolute inset-y-0 z-10 flex w-3.5 items-center justify-center",style:o,children:r}),e[2]=r,e[3]=o,e[4]=i):i=e[4],i},bh=s=>{const e=ne.c(175),{row:t,geometry:r,onToggle:o}=s,{t:i}=ge(),l=Xs(),{revealed:a,renaming:d}=gn(t.key);let c;e[0]!==l.close||e[1]!==t.collapsed||e[2]!==t.group||e[3]!==t.projectId?(c={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]=c):c=e[4];const u=Mu(c),{worktree:p,space:h,spaceName:f,project:g,refs:x,label:b,secondName:w,branch:v,title:E,inWork:P,selected:_,finishing:A,worktreeRemoving:k,activityState:S}=u,N=Ur(t.projectId,t.mixed&&t.detailed),M=!t.empty,B=t.forceExpanded||!t.collapsed;let O;e[5]!==M||e[6]!==o||e[7]!==t.forceExpanded||e[8]!==t.groupKey?(O=M&&!t.forceExpanded?()=>o(t.groupKey):void 0,e[5]=M,e[6]=o,e[7]=t.forceExpanded,e[8]=t.groupKey,e[9]=O):O=e[9];const C=O;let L;e[10]!==t.key?(L=ye=>ut.getState().setRevealed(t.key,ye),e[10]=t.key,e[11]=L):L=e[11];const I=L;let j;e[12]!==I?(j=ye=>()=>{I(!1),ye()},e[12]=I,e[13]=j):j=e[13];const R=j;let T;e[14]!==a||e[15]!==I||e[16]!==u?(T=()=>{if(a){I(!1);return}u.open()},e[14]=a,e[15]=I,e[16]=u,e[17]=T):T=e[17];const $=T,W=vh;let q;e[18]!==S||e[19]!==A||e[20]!==k?(q=k||A?n.jsx(Oo,{className:"size-3"}):S?n.jsx($o,{state:S}):null,e[18]=S,e[19]=A,e[20]=k,e[21]=q):q=e[21];const D=q;let z;e[22]!==x.prColor||e[23]!==h||e[24]!==i?(z=h?n.jsx(G,{name:"instance",className:"size-3.5 shrink-0 text-muted-foreground","aria-hidden":!1,role:"img","aria-label":i("sessions.sidebar.group.space")}):n.jsx(G,{name:"git-branch",className:ie("size-3.5 shrink-0",x.prColor?"oc-ref-tint":"text-muted-foreground"),style:x.prColor?dr(x.prColor):void 0,"aria-hidden":!1,role:"img","aria-label":i("sessions.sidebar.work.worktreeMark")}),e[22]=x.prColor,e[23]=h,e[24]=i,e[25]=z):z=e[25];const J=z;let ee;e[26]!==u.durationSessionId||e[27]!==u.runningSessionId?(ee=u.durationSessionId?n.jsx(Nr,{sessionId:u.durationSessionId,running:!!u.runningSessionId,className:"shrink-0 typography-micro"}):null,e[26]=u.durationSessionId,e[27]=u.runningSessionId,e[28]=ee):ee=e[28];const Q=ee;let Y;if(e[29]!==x.prColor||e[30]!==x.prReference||e[31]!==x.prSummary||e[32]!==x.primaryIssue||e[33]!==t.detailed){const ye=x.prSummary?{icon:"git-pull-request",color:x.prColor,text:x.prReference}:x.primaryIssue?{icon:x.primaryIssue.icon,color:x.primaryIssue.color,text:x.primaryIssue.label}:null;Y=ye?n.jsxs("span",{className:"inline-flex shrink-0 items-center gap-0.5 typography-micro text-muted-foreground",children:[n.jsx(G,{name:ye.icon,className:ie("size-3",ye.color&&"oc-ref-tint"),style:ye.color?dr(ye.color):void 0}),t.detailed&&ye.text?n.jsx("span",{className:"leading-none tabular-nums",children:ye.text}):null]}):null,e[29]=x.prColor,e[30]=x.prReference,e[31]=x.prSummary,e[32]=x.primaryIssue,e[33]=t.detailed,e[34]=Y}else Y=e[34];const K=Y,Z=_?Kr:S==="unread"||S==="permission"||S==="form"?"font-semibold text-foreground":S==="active"?"text-foreground":"oc-title-rest";let U;e[35]!==Z?(U=ie("block min-w-0 flex-1 truncate oc-ui-start-align typography-ui-label",Z),e[35]=Z,e[36]=U):U=e[36];let H;e[37]!==b||e[38]!==U?(H=n.jsx("span",{dir:"auto",className:U,children:b}),e[37]=b,e[38]=U,e[39]=H):H=e[39];const se=H;let fe;e[40]!==v||e[41]!==f||e[42]!==i||e[43]!==E||e[44]!==u?(fe=(ye,Fe)=>n.jsx(Wr,{initialTitle:E??"",indent:ye,className:Fe,placeholder:v??f??i("sessions.sidebar.work.rename.placeholder"),onSubmit:We=>{W(),u.saveTitle(We)},onCancel:W}),e[40]=v,e[41]=f,e[42]=i,e[43]=E,e[44]=u,e[45]=fe):fe=e[45];const ce=fe;let ae;e[46]!==h||e[47]!==i||e[48]!==p?.worktreeStatus?(ae=p?.worktreeStatus==="missing"?n.jsx("span",{className:"inline-flex shrink-0 items-center text-status-warning",role:"img","aria-label":i("sessions.sidebar.group.worktreeMissing"),children:n.jsx(G,{name:"alert",className:"size-3"})}):h?n.jsx(ec,{spaceId:h.id}):null,e[46]=h,e[47]=i,e[48]=p?.worktreeStatus,e[49]=ae):ae=e[49];const je=ae;let Re;e[50]!==t.group.directory?(Re=t.group.directory?n.jsx(Lu,{directory:t.group.directory}):null,e[50]=t.group.directory,e[51]=Re):Re=e[51];const te=Re,pe=gt(wh);let X;e[52]!==pe||e[53]!==i||e[54]!==u.pinned?(X=u.pinned&&!pe?n.jsx(G,{name:"pushpin",className:"size-3 shrink-0 text-muted-foreground","aria-label":i("sessions.sidebar.session.status.pinned")}):null,e[52]=pe,e[53]=i,e[54]=u.pinned,e[55]=X):X=e[55];const oe=X;let ve;if(t.detailed){let ye;e[56]!==r||e[57]!==t.depth?(ye=r.detailedLeft(t.depth),e[56]=r,e[57]=t.depth,e[58]=ye):ye=e[58];const Fe=d?void 0:$;let We;e[59]!==b||e[60]!==i?(We=i("sessions.sidebar.work.openAria",{label:b}),e[59]=b,e[60]=i,e[61]=We):We=e[61];let Qe;e[62]!==B||e[63]!==b||e[64]!==C?(Qe=C?n.jsx(Us,{expanded:B,kind:"work",label:b,onToggle:C}):null,e[62]=B,e[63]=b,e[64]=C,e[65]=Qe):Qe=e[65];let Ze;e[66]!==te||e[67]!==Q||e[68]!==je||e[69]!==oe||e[70]!==ce||e[71]!==d||e[72]!==D||e[73]!==se?(Ze=d?ce(0,"h-[1lh] pe-0 typography-ui-label [&_button]:size-6 [&_button>svg]:size-3.5"):n.jsxs(n.Fragment,{children:[se,je,oe,te,D,Q]}),e[66]=te,e[67]=Q,e[68]=je,e[69]=oe,e[70]=ce,e[71]=d,e[72]=D,e[73]=se,e[74]=Ze):Ze=e[74];let st;e[75]!==N?(st=N?n.jsx(Js,{project:N,size:"xs"}):null,e[75]=N,e[76]=st):st=e[76];let Oe;e[77]!==w?(Oe=w?n.jsx("span",{dir:"auto",className:"block min-w-0 truncate typography-micro",children:w}):null,e[77]=w,e[78]=Oe):Oe=e[78];let Ue;e[79]!==K?(Ue=n.jsx("span",{className:"ms-auto flex shrink-0 items-center",children:K}),e[79]=K,e[80]=Ue):Ue=e[80];let Ge;e[81]!==J||e[82]!==st||e[83]!==Oe||e[84]!==Ue?(Ge=n.jsxs(n.Fragment,{children:[st,J,Oe,Ue]}),e[81]=J,e[82]=st,e[83]=Oe,e[84]=Ue,e[85]=Ge):Ge=e[85];let nt;e[86]!==ye||e[87]!==Fe||e[88]!==We||e[89]!==Qe||e[90]!==Ze||e[91]!==Ge?(nt=n.jsx(Kn,{indent:ye,onSelect:Fe,ariaLabel:We,chevron:Qe,firstLine:Ze,secondLine:Ge}),e[86]=ye,e[87]=Fe,e[88]=We,e[89]=Qe,e[90]=Ze,e[91]=Ge,e[92]=nt):nt=e[92],ve=nt}else{let ye;e[93]!==J||e[94]!==B||e[95]!==r||e[96]!==b||e[97]!==t.depth||e[98]!==C?(ye=C?n.jsx(Vr,{slotLeft:r.slotLeft(t.depth),children:n.jsx(Us,{expanded:B,kind:"work",label:b,onToggle:C})}):n.jsx(qr,{slotLeft:r.slotLeft(t.depth),children:J}),e[93]=J,e[94]=B,e[95]=r,e[96]=b,e[97]=t.depth,e[98]=C,e[99]=ye):ye=e[99];let Fe;e[100]!==te||e[101]!==Q||e[102]!==r||e[103]!==b||e[104]!==je||e[105]!==oe||e[106]!==K||e[107]!==ce||e[108]!==d||e[109]!==t.depth||e[110]!==$||e[111]!==D||e[112]!==i||e[113]!==se?(Fe=d?ce(r.textLeft(t.depth)):n.jsxs("button",{type:"button",className:Hr,style:{paddingInlineStart:r.textLeft(t.depth),touchAction:"manipulation"},"aria-label":i("sessions.sidebar.work.openAria",{label:b}),onClick:$,children:[se,je,oe,K,te,D,Q]}),e[100]=te,e[101]=Q,e[102]=r,e[103]=b,e[104]=je,e[105]=oe,e[106]=K,e[107]=ce,e[108]=d,e[109]=t.depth,e[110]=$,e[111]=D,e[112]=i,e[113]=se,e[114]=Fe):Fe=e[114];let We;e[115]!==ye||e[116]!==Fe?(We=n.jsxs(n.Fragment,{children:[ye,Fe]}),e[115]=ye,e[116]=Fe,e[117]=We):We=e[117],ve=We}const Se=((u.workAction?1:0)+(u.canRename?1:0)+(h?1:0)+(u.canPin?1:0)+(u.canArchive?1:0)+(p&&!k?1:0))*_s,be=_&&Wn,xe=k&&"opacity-60";let V;e[118]!==be||e[119]!==xe?(V=ie("relative flex w-full items-center bg-background transition-colors",be,xe),e[118]=be,e[119]=xe,e[120]=V):V=e[120];let ue;e[121]!==R||e[122]!==A||e[123]!==P||e[124]!==a||e[125]!==i||e[126]!==u.toggleWork||e[127]!==u.workAction||e[128]!==k?(ue=u.workAction?n.jsx(Mt,{icon:P?"check":"eye",tone:P?"success":"default",label:i(P?"sessions.sidebar.session.work.markDone":"sessions.sidebar.session.work.track"),revealed:a,disabled:A||k,onClick:R(u.toggleWork)}):null,e[121]=R,e[122]=A,e[123]=P,e[124]=a,e[125]=i,e[126]=u.toggleWork,e[127]=u.workAction,e[128]=k,e[129]=ue):ue=e[129];let Le;e[130]!==a||e[131]!==t.key||e[132]!==i||e[133]!==u.canRename?(Le=u.canRename?n.jsx(Mt,{icon:"edit",label:i("sessions.sidebar.work.menu.rename"),revealed:a,onClick:()=>ut.getState().startRename(t.key)}):null,e[130]=a,e[131]=t.key,e[132]=i,e[133]=u.canRename,e[134]=Le):Le=e[134];let $e;e[135]!==R||e[136]!==b||e[137]!==a||e[138]!==h||e[139]!==i?($e=h?n.jsx(Mt,{icon:"more-2",label:i("spaces.actions.menuAria",{label:b}),revealed:a,onClick:R(()=>rl.getState().openActionsSheet(h.id))}):null,e[135]=R,e[136]=b,e[137]=a,e[138]=h,e[139]=i,e[140]=$e):$e=e[140];let Te;e[141]!==R||e[142]!==a||e[143]!==i||e[144]!==u?(Te=u.canPin?n.jsx(Mt,{icon:u.pinned?"unpin":"pushpin",label:u.pinned?i("sessions.sidebar.work.menu.unpin"):i("sessions.sidebar.work.menu.pin"),revealed:a,onClick:R(()=>Fo({current:u.pinList,pin:ye=>{u.setPin(!0,ye)},unpin:()=>{u.setPin(!1)}}))}):null,e[141]=R,e[142]=a,e[143]=i,e[144]=u,e[145]=Te):Te=e[145];let Xe;e[146]!==R||e[147]!==A||e[148]!==a||e[149]!==i||e[150]!==u?(Xe=u.canArchive?n.jsx(Mt,{icon:"archive",label:i("sessions.sidebar.work.menu.archive"),revealed:a,disabled:A,onClick:R(()=>{u.finish(!0)})}):null,e[146]=R,e[147]=A,e[148]=a,e[149]=i,e[150]=u,e[151]=Xe):Xe=e[151];let Ye;e[152]!==l||e[153]!==R||e[154]!==g||e[155]!==a||e[156]!==i||e[157]!==p||e[158]!==k?(Ye=p&&!k?n.jsx(Mt,{icon:"delete-bin",tone:"destructive",label:i("sessions.sidebar.group.actions.deleteWorktree"),revealed:a,onClick:R(()=>{g&&l.requestWorktreeDelete({id:g.id,path:g.path},p)})}):null,e[152]=l,e[153]=R,e[154]=g,e[155]=a,e[156]=i,e[157]=p,e[158]=k,e[159]=Ye):Ye=e[159];let tt;e[160]!==ue||e[161]!==Le||e[162]!==$e||e[163]!==Te||e[164]!==Xe||e[165]!==Ye?(tt=n.jsxs(n.Fragment,{children:[ue,Le,$e,Te,Xe,Ye]}),e[160]=ue,e[161]=Le,e[162]=$e,e[163]=Te,e[164]=Xe,e[165]=Ye,e[166]=tt):tt=e[166];let rt;return e[167]!==ve||e[168]!==a||e[169]!==_||e[170]!==I||e[171]!==Se||e[172]!==V||e[173]!==tt?(rt=n.jsx(hn,{actionsWidth:Se,revealed:a,onRevealedChange:I,dataActiveSession:_,contentClassName:V,actions:tt,children:ve}),e[167]=ve,e[168]=a,e[169]=_,e[170]=I,e[171]=Se,e[172]=V,e[173]=tt,e[174]=rt):rt=e[174],rt},xh=s=>{const e=ne.c(133),{row:t,geometry:r,toggleParent:o}=s,{t:i}=ge(),l=Xs(),{run:a}=t,{revealed:d,renaming:c}=gn(t.key),u=Du(a,t.laneNodes,l.close);let p;e[0]!==t.laneNodes?(p=[...t.laneNodes],e[0]=t.laneNodes,e[1]=p):p=e[1];const h=p;let f;e[2]!==h||e[3]!==t.blockingSessionIds?(f={nodes:h,blockingSessionIds:t.blockingSessionIds},e[2]=h,e[3]=t.blockingSessionIds,e[4]=f):f=e[4];const g=Ou(f);let x;e[5]!==g?(x=g?n.jsx($o,{state:g}):null,e[5]=g,e[6]=x):x=e[6];const b=x,w=Ur(t.projectId,t.detailed&&t.renderContext==="timeline-mixed"),v=t.forceExpanded||t.expanded;let E;e[7]!==t.expansionKey||e[8]!==t.forceExpanded||e[9]!==t.laneNodes.length||e[10]!==o?(E=t.laneNodes.length>0&&!t.forceExpanded?()=>o(t.expansionKey):void 0,e[7]=t.expansionKey,e[8]=t.forceExpanded,e[9]=t.laneNodes.length,e[10]=o,e[11]=E):E=e[11];const P=E,_=a.lanes.length;let A;e[12]!==t.key?(A=we=>ut.getState().setRevealed(t.key,we),e[12]=t.key,e[13]=A):A=e[13];const k=A;let S;e[14]!==k?(S=we=>()=>{k(!1),we()},e[14]=k,e[15]=S):S=e[15];const N=S;let M;e[16]!==d||e[17]!==k||e[18]!==u?(M=()=>{if(d){k(!1);return}u.open()},e[16]=d,e[17]=k,e[18]=u,e[19]=M):M=e[19];const B=M,O=jh;let C;e[20]===Symbol.for("react.memo_cache_sentinel")?(C=n.jsx(ui,{className:"size-3.5 shrink-0 text-muted-foreground","aria-hidden":"true"}),e[20]=C):C=e[20];const L=C,I=u.isActive?Kr:"oc-title-rest";let j;e[21]!==I?(j=ie("block min-w-0 flex-1 truncate oc-ui-start-align typography-ui-label",I),e[21]=I,e[22]=j):j=e[22];let R;e[23]!==a.title||e[24]!==j?(R=n.jsx("span",{dir:"auto",className:j,children:a.title}),e[23]=a.title,e[24]=j,e[25]=R):R=e[25];const T=R;let $;e[26]!==a.title||e[27]!==u?($=(we,Se)=>n.jsx(Wr,{initialTitle:a.title,indent:we,className:Se,onSubmit:be=>{O(),u.rename(be)},onCancel:O}),e[26]=a.title,e[27]=u,e[28]=$):$=e[28];const W=$;let q;e[29]!==a.title||e[30]!==i?(q=i("sessions.sidebar.run.openOverviewAria",{title:a.title}),e[29]=a.title,e[30]=i,e[31]=q):q=e[31];const D=q;let z;if(t.detailed){let we;e[32]!==r||e[33]!==t.depth?(we=r.detailedLeft(t.depth),e[32]=r,e[33]=t.depth,e[34]=we):we=e[34];const Se=c?void 0:B;let be;e[35]!==v||e[36]!==a.title||e[37]!==P?(be=P?n.jsx(Us,{expanded:v,kind:"run",label:a.title,onToggle:P}):null,e[35]=v,e[36]=a.title,e[37]=P,e[38]=be):be=e[38];let xe;e[39]!==b||e[40]!==W||e[41]!==c||e[42]!==T?(xe=c?W(0,"h-[1lh] pe-0 typography-ui-label [&_button]:size-6 [&_button>svg]:size-3.5"):n.jsxs(n.Fragment,{children:[T,b]}),e[39]=b,e[40]=W,e[41]=c,e[42]=T,e[43]=xe):xe=e[43];let V;e[44]!==w?(V=w?n.jsx(Js,{project:w,size:"xs"}):null,e[44]=w,e[45]=V):V=e[45];let ue;e[46]!==_||e[47]!==i?(ue=_===1?i("sessions.sidebar.run.laneCountSingle",{count:_}):i("sessions.sidebar.run.laneCountPlural",{count:_}),e[46]=_,e[47]=i,e[48]=ue):ue=e[48];let Le;e[49]!==ue?(Le=n.jsx("span",{className:"block min-w-0 flex-1 truncate typography-micro",children:ue}),e[49]=ue,e[50]=Le):Le=e[50];let $e;e[51]!==a.providerIDs?($e=n.jsx(Ui,{providerIDs:a.providerIDs}),e[51]=a.providerIDs,e[52]=$e):$e=e[52];let Te;e[53]!==V||e[54]!==Le||e[55]!==$e?(Te=n.jsxs(n.Fragment,{children:[V,L,Le,$e]}),e[53]=V,e[54]=Le,e[55]=$e,e[56]=Te):Te=e[56];let Xe;e[57]!==D||e[58]!==we||e[59]!==Se||e[60]!==be||e[61]!==xe||e[62]!==Te?(Xe=n.jsx(Kn,{indent:we,onSelect:Se,ariaLabel:D,chevron:be,firstLine:xe,secondLine:Te}),e[57]=D,e[58]=we,e[59]=Se,e[60]=be,e[61]=xe,e[62]=Te,e[63]=Xe):Xe=e[63],z=Xe}else{let we;e[64]!==v||e[65]!==r||e[66]!==t.depth||e[67]!==a.title||e[68]!==P?(we=P?n.jsx(Vr,{slotLeft:r.slotLeft(t.depth),children:n.jsx(Us,{expanded:v,kind:"run",label:a.title,onToggle:P})}):n.jsx(qr,{slotLeft:r.slotLeft(t.depth),children:L}),e[64]=v,e[65]=r,e[66]=t.depth,e[67]=a.title,e[68]=P,e[69]=we):we=e[69];let Se;e[70]!==b||e[71]!==D||e[72]!==r||e[73]!==W||e[74]!==c||e[75]!==t.depth||e[76]!==a.providerIDs||e[77]!==B||e[78]!==T?(Se=c?W(r.textLeft(t.depth)):n.jsxs("button",{type:"button",className:Hr,style:{paddingInlineStart:r.textLeft(t.depth),touchAction:"manipulation"},"aria-label":D,onClick:B,children:[T,n.jsx(Ui,{providerIDs:a.providerIDs}),b]}),e[70]=b,e[71]=D,e[72]=r,e[73]=W,e[74]=c,e[75]=t.depth,e[76]=a.providerIDs,e[77]=B,e[78]=T,e[79]=Se):Se=e[79];let be;e[80]!==we||e[81]!==Se?(be=n.jsxs(n.Fragment,{children:[we,Se]}),e[80]=we,e[81]=Se,e[82]=be):be=e[82],z=be}const J=(u.sessionWorkEnabled?4:3)*_s,ee=u.isActive,Q=u.isActive&&Wn;let Y;e[83]!==Q?(Y=ie("relative flex w-full items-center bg-background transition-colors",Q),e[83]=Q,e[84]=Y):Y=e[84];let K;e[85]!==N||e[86]!==d||e[87]!==i||e[88]!==u?(K=u.sessionWorkEnabled?n.jsx(Mt,{icon:u.inWork?"check":"eye",tone:u.inWork?"success":"default",label:u.inWork?i("sessions.sidebar.session.work.markDone"):i("sessions.sidebar.session.work.track"),revealed:d,disabled:u.busy,onClick:N(()=>{u.toggleWork()})}):null,e[85]=N,e[86]=d,e[87]=i,e[88]=u,e[89]=K):K=e[89];let Z;e[90]===Symbol.for("react.memo_cache_sentinel")?(Z=n.jsx(ui,{className:"size-[18px]","aria-hidden":"true"}),e[90]=Z):Z=e[90];let U;e[91]!==i?(U=i("sessions.sidebar.run.menu.openOverview"),e[91]=i,e[92]=U):U=e[92];let H;e[93]!==N||e[94]!==u.openOverview?(H=N(u.openOverview),e[93]=N,e[94]=u.openOverview,e[95]=H):H=e[95];let se;e[96]!==d||e[97]!==U||e[98]!==H?(se=n.jsx(Mt,{icon:"git-merge",glyph:Z,label:U,revealed:d,onClick:H}),e[96]=d,e[97]=U,e[98]=H,e[99]=se):se=e[99];let fe;e[100]!==i?(fe=i("multirun.overview.rename.aria"),e[100]=i,e[101]=fe):fe=e[101];let ce;e[102]!==t.key?(ce=()=>ut.getState().startRename(t.key),e[102]=t.key,e[103]=ce):ce=e[103];let ae;e[104]!==d||e[105]!==fe||e[106]!==ce?(ae=n.jsx(Mt,{icon:"edit",label:fe,revealed:d,onClick:ce}),e[104]=d,e[105]=fe,e[106]=ce,e[107]=ae):ae=e[107];let je;e[108]!==i?(je=i("multirun.overview.archive.action"),e[108]=i,e[109]=je):je=e[109];const Re=u.busy;let te;e[110]!==u?(te=()=>{u.archive()},e[110]=u,e[111]=te):te=e[111];let pe;e[112]!==N||e[113]!==te?(pe=N(te),e[112]=N,e[113]=te,e[114]=pe):pe=e[114];let X;e[115]!==d||e[116]!==je||e[117]!==pe||e[118]!==u.busy?(X=n.jsx(Mt,{icon:"archive",label:je,revealed:d,disabled:Re,onClick:pe}),e[115]=d,e[116]=je,e[117]=pe,e[118]=u.busy,e[119]=X):X=e[119];let oe;e[120]!==K||e[121]!==se||e[122]!==ae||e[123]!==X?(oe=n.jsxs(n.Fragment,{children:[K,se,ae,X]}),e[120]=K,e[121]=se,e[122]=ae,e[123]=X,e[124]=oe):oe=e[124];let ve;return e[125]!==z||e[126]!==d||e[127]!==k||e[128]!==J||e[129]!==Y||e[130]!==oe||e[131]!==u.isActive?(ve=n.jsx(hn,{actionsWidth:J,revealed:d,onRevealedChange:k,dataActiveSession:ee,contentClassName:Y,actions:oe,children:z}),e[125]=z,e[126]=d,e[127]=k,e[128]=J,e[129]=Y,e[130]=oe,e[131]=u.isActive,e[132]=ve):ve=e[132],ve},yh=s=>{const e=ne.c(46),{row:t,geometry:r}=s,{t:o}=ge(),i=Xs(),{draft:l}=t,{revealed:a}=gn(t.key),{isOpen:d,firstLine:c,attachmentCount:u,label:p,open:h,discard:f}=Ql(l,i.close),g=Ur(l.projectId??null,t.detailed&&t.mixed),x=Zl(t.detailed?l.directory:null);let b;e[0]!==t.key?(b=D=>ut.getState().setRevealed(t.key,D),e[0]=t.key,e[1]=b):b=e[1];const w=b;let v;e[2]!==h||e[3]!==a||e[4]!==w?(v=()=>{if(a){w(!1);return}h()},e[2]=h,e[3]=a,e[4]=w,e[5]=v):v=e[5];const E=v;let P;e[6]===Symbol.for("react.memo_cache_sentinel")?(P=n.jsx(G,{name:"edit",className:"size-3 shrink-0 text-muted-foreground"}),e[6]=P):P=e[6];const _=P;let A;e[7]!==u||e[8]!==c?(A=c&&u>0?n.jsx(G,{name:"attachment-2",className:"size-3 shrink-0 text-muted-foreground"}):null,e[7]=u,e[8]=c,e[9]=A):A=e[9];const k=A,S=t.detailed&&!!(g||x||k),N=d?Kr:"oc-title-rest";let M;e[10]!==N?(M=ie("block min-w-0 flex-1 truncate oc-ui-start-align typography-ui-label italic",N),e[10]=N,e[11]=M):M=e[11];let B;e[12]!==p||e[13]!==M?(B=n.jsx("span",{dir:"auto",className:M,children:p}),e[12]=p,e[13]=M,e[14]=B):B=e[14];const O=B;let C;e[15]!==p||e[16]!==o?(C=o("sessions.sidebar.draft.openAria",{label:p}),e[15]=p,e[16]=o,e[17]=C):C=e[17];const L=C,I=d&&Wn;let j;e[18]!==I?(j=ie("relative flex w-full items-center bg-background transition-colors",I),e[18]=I,e[19]=j):j=e[19];let R;e[20]!==o?(R=o("sessions.sidebar.draft.discard"),e[20]=o,e[21]=R):R=e[21];let T;e[22]!==f||e[23]!==w?(T=()=>{w(!1),f()},e[22]=f,e[23]=w,e[24]=T):T=e[24];let $;e[25]!==a||e[26]!==R||e[27]!==T?($=n.jsx(Mt,{icon:"close",tone:"destructive",label:R,revealed:a,onClick:T}),e[25]=a,e[26]=R,e[27]=T,e[28]=$):$=e[28];let W;e[29]!==L||e[30]!==k||e[31]!==x||e[32]!==S||e[33]!==r||e[34]!==g||e[35]!==t.depth||e[36]!==E||e[37]!==O?(W=S?n.jsx(Kn,{indent:r.detailedLeft(t.depth),onSelect:E,ariaLabel:L,chevron:null,firstLine:O,secondLine:n.jsxs(n.Fragment,{children:[g?n.jsx(Js,{project:g,size:"xs"}):null,_,x?n.jsx("span",{className:"block min-w-0 truncate typography-micro",children:x}):null,k?n.jsx("span",{className:"ms-auto flex shrink-0 items-center",children:k}):null]})}):n.jsxs(n.Fragment,{children:[n.jsx(qr,{slotLeft:r.slotLeft(t.depth),children:_}),n.jsxs("button",{type:"button",className:Hr,style:{paddingInlineStart:r.textLeft(t.depth),touchAction:"manipulation"},"aria-label":L,onClick:E,children:[O,k]})]}),e[29]=L,e[30]=k,e[31]=x,e[32]=S,e[33]=r,e[34]=g,e[35]=t.depth,e[36]=E,e[37]=O,e[38]=W):W=e[38];let q;return e[39]!==d||e[40]!==a||e[41]!==w||e[42]!==j||e[43]!==$||e[44]!==W?(q=n.jsx(hn,{actionsWidth:_s,revealed:a,onRevealedChange:w,dataActiveSession:d,contentClassName:j,actions:$,children:W}),e[39]=d,e[40]=a,e[41]=w,e[42]=j,e[43]=$,e[44]=W,e[45]=q):q=e[45],q};function vh(){return ut.getState().stopRename()}function wh(s){return s.showPinnedSection}function jh(){return ut.getState().stopRename()}const kh=12,Na=8,ir=s=>Na+s*kh,Sh={base:Na,slotLeft:ir,textLeft:s=>ir(s)+20,detailedLeft:s=>ir(s)+4},qi=12,Nh=()=>{},Ca=(s,e)=>s.some(t=>t.session.id===e||Ca(t.children,e)),Ch=(s,e)=>{const{sessionId:t,runKey:r,projectId:o}=e;if(r){const i=s.findIndex(l=>l.kind==="run"&&l.run.key===r);if(i>=0)return i}if(t){const i=s.findIndex(l=>l.kind==="session"&&l.node.session.id===t||l.kind==="run"&&l.run.memberIds.includes(t)||l.kind==="group-header"&&Ca(l.group.sessions,t));if(i>=0)return i}return o?s.findIndex(i=>i.kind==="project-header"&&i.section.project.id===o):-1},Rh=({model:s,view:e,actions:t})=>{const{t:r}=ge(),o=Xs(),i=tc(),l=Sh,[a,d]=m.useState(null),c=s.rowModel.rows;m.useEffect(()=>{ut.getState().forgetUnlisted(b=>s.rowModel.rowIndexByKey.has(b))},[s.rowModel.rowIndexByKey]);const u=ut(b=>b.renamingKey),p=m.useMemo(()=>{const b=u?s.rowModel.rowIndexByKey.get(u):void 0;return new Set(b===void 0?[]:[b])},[s.rowModel.rowIndexByKey,u]),[h,f]=m.useState(null),g=m.useRef(c);g.current=c,m.useEffect(()=>{if(o.openId===0)return;const b=Ch(g.current,{sessionId:ot.getState().currentSessionId,runKey:He.getState().runOverviewKey,projectId:s.groupProps.activeProjectId});b>=0&&f({index:b,id:o.openId})},[o.openId]);const x=m.useCallback(b=>{switch(b.kind){case"activity-header":return n.jsx(ch,{row:b,onToggle:()=>Vu(b,{model:s,actions:t})});case"caption":return n.jsx(uh,{row:b,onToggle:()=>Ku(b,{model:s})});case"project-header":{const w=b.section.project;return n.jsx(dh,{row:b,label:Wu(w,e.homeDirectory),isRepo:!!s.projectRepoStatus.get(w.id),active:s.groupProps.activeProjectId===w.id,onToggle:()=>t.toggleProject(w.id),onNewSession:()=>{t.setActiveProjectIdOnly(w.id),t.openNewSessionDraft({selectedProjectId:w.id,directoryOverride:w.normalizedPath}),o.close()},onRemove:()=>t.removeProject(w.id)})}case"group-header":return $u(b.group)?n.jsx(bh,{row:b,geometry:l,onToggle:t.group.onToggleCollapsedGroup}):n.jsx(fh,{row:b,geometry:l,onToggle:t.group.onToggleCollapsedGroup});case"folder-header":return n.jsx(mh,{row:b,geometry:l});case"session":return n.jsx(nh,{row:b,geometry:l,toggleParent:s.groupProps.toggleParent});case"run":return n.jsx(xh,{row:b,geometry:l,toggleParent:s.groupProps.toggleParent});case"draft":return n.jsx(yh,{row:b,geometry:l});case"show-control":return n.jsx(sh,{more:b.more,fewer:b.fewer,indent:b.flat?qi:l.textLeft(b.depth??0),onShow:w=>Fu(b,w,{model:s,actions:t})});case"status":return n.jsx(ph,{row:b,indent:b.flat?qi:l.textLeft(b.depth??0),onRetry:()=>Bu(b,i),onGrantAccess:()=>{zu(b,i)}});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"?r("sessions.sidebar.sections.empty"):r("sessions.sidebar.group.empty.noArchivedSessions")})}},[t,i,l,s,o,r,e.homeDirectory]);return n.jsx(Ut,{ref:d,outerClassName:"min-h-0 flex-1",className:"px-3 pb-4 [overflow-anchor:none]",useScrollShadow:!0,disableHorizontal:!0,children:n.jsx(Hu,{model:s.rowModel,scrollElement:a,pinnedRowIndexes:p,renderRow:x,onFirstVisibleIndexChange:Nh,guideSlotStartPx:l.base,scrollRequest:h})})},Eh=32,Ih=80,Th=64,_h=.7,Ah=140,Ph=.4,Dh=(s,e,t)=>{const r=e.ownerDocument.defaultView;if(!r)return"drawer";let o=!1;for(let i=s instanceof r.Element?s:null;i&&i!==e;i=i.parentElement){const l=i.scrollWidth-i.clientWidth;if(l<=1)continue;const a=r.getComputedStyle(i);if(a.overflowX!=="auto"&&a.overflowX!=="scroll")continue;const d=a.direction==="rtl"?-l:0,c=d+l;if(t?i.scrollLeft>d+1:i.scrollLeft<c-1)return"content";o=!0}return o?"content-end":"drawer"},Gr=(s,e)=>{const t=m.useRef(e);t.current=e;const r=e.enabled??!0;m.useEffect(()=>{if(!r)return;const o=s.current;if(!o)return;const l=window.Capacitor?.getPlatform?.()==="android"?Ih:Eh,a=o.ownerDocument;let d=!1,c=!1,u="drawer",p=0,h=0;const f=()=>a.getSelection()?.isCollapsed===!1,g=()=>{d=!1},x=()=>{d&&f()&&g()},b=v=>{if(v.touches.length!==1||f()){d=!1;return}const E=v.touches[0],P=o.clientWidth,_=E.clientX<=l,A=E.clientX>=P-l;c=_,u=_||A?Dh(v.target,o,c):"drawer",d=(_||A)&&u!=="content",p=E.clientX,h=E.clientY},w=v=>{if(!d||(d=!1,f()))return;const E=v.changedTouches[0];if(!E)return;const P=E.clientX-p,_=E.clientY-h,A=u==="content-end"?Ah:Th,k=u==="content-end"?Ph:_h;Math.abs(P)<A||Math.abs(_)>Math.abs(P)*k||c&&P<=0||!c&&P>=0||(c?t.current.onLeftEdgeSwipe?.():t.current.onRightEdgeSwipe?.())};return o.addEventListener("touchstart",b,{passive:!0}),o.addEventListener("touchend",w,{passive:!0}),o.addEventListener("touchcancel",g,{passive:!0}),o.addEventListener("selectstart",g),a.addEventListener("selectionchange",x),()=>{o.removeEventListener("touchstart",b),o.removeEventListener("touchend",w),o.removeEventListener("touchcancel",g),o.removeEventListener("selectstart",g),a.removeEventListener("selectionchange",x)}},[r,s])},Oh=[["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"]],Mh=[["project","sessions.sidebar.header.listGrouping.project"],["time","sessions.sidebar.header.listGrouping.time"]],An="min-h-10 items-center justify-between",Lh=s=>n.jsx(Rh,{...s}),zh=s=>{const e=ne.c(29),{project:t}=s,{t:r}=ge();let o;e[0]!==t.id?(o={id:t.id},e[0]=t.id,e[1]=o):o=e[1];const{attributes:i,listeners:l,setNodeRef:a,transform:d,transition:c,isDragging:u}=rf(o);let p;e[2]!==d?(p=lf.Transform.toString(d),e[2]=d,e[3]=p):p=e[3];const h=u?10:1;let f;e[4]!==p||e[5]!==h||e[6]!==c?(f={transform:p,transition:c,zIndex:h},e[4]=p,e[5]=h,e[6]=c,e[7]=f):f=e[7];const g=u&&"shadow-lg shadow-black/20";let x;e[8]!==g?(x=ie("flex items-center gap-1 rounded-2xl border border-edge bg-[var(--surface-elevated)] px-1.5 py-1.5 transition-colors",g),e[8]=g,e[9]=x):x=e[9];let b;e[10]!==t.label||e[11]!==r?(b=r("mobile.sessions.dragHandleAria",{label:t.label}),e[10]=t.label,e[11]=r,e[12]=b):b=e[12];let w;e[13]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx(G,{name:"drag-move-2",className:"size-4"}),e[13]=w):w=e[13];let v;e[14]!==i||e[15]!==l||e[16]!==b?(v=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,...i,...l,children:w}),e[14]=i,e[15]=l,e[16]=b,e[17]=v):v=e[17];let E;e[18]!==t?(E=n.jsx(Js,{project:t}),e[18]=t,e[19]=E):E=e[19];let P;e[20]!==t.label?(P=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]=P):P=e[21];let _;return e[22]!==a||e[23]!==E||e[24]!==P||e[25]!==f||e[26]!==x||e[27]!==v?(_=n.jsxs("div",{ref:a,style:f,className:x,children:[v,E,P]}),e[22]=a,e[23]=E,e[24]=P,e[25]=f,e[26]=x,e[27]=v,e[28]=_):_=e[28],_},Gi=s=>{const e=ne.c(186),{open:t,onOpenChange:r,variant:o,footer:i}=s,l=o===void 0?"drawer":o,{t:a}=ge(),d=Fh(t),c=Ro(),u=Lt(Kh),p=Lt(Vh),h=Lt(Hh),f=ot(Uh),g=gt(qh),x=gt(Gh),b=gt(il),w=gt(Jh),v=gt(Xh),E=gt(Yh),P=gt(Qh),_=gt(Zh),A=gt(e1),k=gt(t1),S=gt(s1),N=gt(n1),M=gt(r1),B=gt(i1),O=He(o1),C=gt(a1);let L;e[0]!==C?(L=C.filter(l1),e[0]=C,e[1]=L):L=e[1];const I=L,j=gt(c1),R=He(u1),T=Cs(f1),[$,W]=m.useState(""),[q,D]=m.useState(null),[z,J]=m.useState(null),[ee,Q]=m.useState(!1),[Y,K]=m.useState(!1),[Z,U]=m.useState(null),[H,se]=m.useState(!1),[fe,ce]=m.useState(0),[ae,je]=m.useState(!1),Re=l==="drawer"||ae,te=m.useRef(null);let pe;e[2]!==ae?(pe=()=>{ae&&W(""),je(!ae)},e[2]=ae,e[3]=pe):pe=e[3];const X=pe;let oe,ve;e[4]!==ae||e[5]!==l?(oe=()=>{ae&&l==="sidebar"&&te.current?.focus()},ve=[ae,l],e[4]=ae,e[5]=l,e[6]=oe,e[7]=ve):(oe=e[6],ve=e[7]),m.useEffect(oe,ve);let we;e[8]!==d||e[9]!==c?(we=()=>{if(!d){W(""),je(!1),se(!1),D(null),ut.getState().reset();return}ce(m1),No(c).then(p1)},e[8]=d,e[9]=c,e[10]=we):we=e[10];let Se;e[11]!==d?(Se=[d],e[11]=d,e[12]=Se):Se=e[12],m.useEffect(we,Se);let be;e[13]!==r?(be=()=>r(!1),e[13]=r,e[14]=be):be=e[14];const xe=be;let V,ue;e[15]===Symbol.for("react.memo_cache_sentinel")?(ue=ke=>{U(ke),K(!0)},V=(ke,Be)=>J({project:ke,worktree:Be}),e[15]=V,e[16]=ue):(V=e[15],ue=e[16]);let Le;e[17]!==xe||e[18]!==fe?(Le={close:xe,openProjectEdit:D,openNewWorktree:ue,requestWorktreeDelete:V,openId:fe},e[17]=xe,e[18]=fe,e[19]=Le):Le=e[19];const $e=Le;let Te;e[20]===Symbol.for("react.memo_cache_sentinel")?(Te=()=>W(""),e[20]=Te):Te=e[20];const Xe=Te;let Ye;e[21]!==$?(Ye={searchQuery:$,clearSearch:Xe,renderList:Lh},e[21]=$,e[22]=Ye):Ye=e[22];const tt=Ye;let rt;e[23]!==u?(rt=u.map(h1),e[23]=u,e[24]=rt):rt=e[24];const ye=rt;let Fe;e[25]!==ye||e[26]!==p?(Fe=sc(ye,"manual",p),e[25]=ye,e[26]=p,e[27]=Fe):Fe=e[27];const We=Fe;let Qe;e[28]!==q||e[29]!==ye?(Qe=ye.find(ke=>ke.id===q)??null,e[28]=q,e[29]=ye,e[30]=Qe):Qe=e[30];const Ze=Qe,st=ye.find(ke=>ke.id===Z)??null;let Oe;e[31]!==x?(Oe=ke=>{x(ke),Es({sidebarProjectSortOrder:ke}),ke!=="manual"&&se(!1)},e[31]=x,e[32]=Oe):Oe=e[32];const Ue=Oe;let Ge;e[33]!==w?(Ge=ke=>{w(ke),Es({sidebarGrouping:ke}),ke==="time"&&se(!1)},e[33]=w,e[34]=Ge):Ge=e[34];const nt=Ge,Tt=g1;let Ct;e[35]!==a?(Ct=(ke,Be,dt,Bt)=>n.jsxs(En,{onClick:Bt,className:An,children:[n.jsx("span",{children:a(Be)}),dt?n.jsx(G,{name:"check",className:"size-4 text-primary"}):null]},ke),e[35]=a,e[36]=Ct):Ct=e[36];const at=Ct;let mt;e[37]===Symbol.for("react.memo_cache_sentinel")?(mt={activationConstraint:{distance:8}},e[37]=mt):mt=e[37];let pt;e[38]===Symbol.for("react.memo_cache_sentinel")?(pt={coordinateGetter:of},e[38]=pt):pt=e[38];const bt=Yd(xi(Zd,mt),xi(Qd,pt));let et;e[39]!==u||e[40]!==h?(et=ke=>{const{active:Be,over:dt}=ke;if(!dt||Be.id===dt.id)return;const Bt=u.findIndex(Zs=>Zs.id===Be.id),Ps=u.findIndex(Zs=>Zs.id===dt.id);Bt<0||Ps<0||h(Bt,Ps)},e[39]=u,e[40]=h,e[41]=et):et=e[41];const Ie=et,xt=!$&&u.length>1&&g==="manual"&&b==="project";let _e;e[42]!==xt||e[43]!==I||e[44]!==S||e[45]!==H||e[46]!==b||e[47]!==nt||e[48]!==Ue||e[49]!==j||e[50]!==A||e[51]!==g||e[52]!==u.length||e[53]!==at||e[54]!==O||e[55]!==N||e[56]!==k||e[57]!==_||e[58]!==E||e[59]!==B||e[60]!==P||e[61]!==v||e[62]!==a||e[63]!==M?(_e=!H&&u.length>0?n.jsxs(fr,{children:[n.jsx(mr,{asChild:!0,children:n.jsx(Ee,{type:"button",variant:"chip",size:"sm","aria-label":a("sessions.sidebar.header.displayMode.label"),title:a("sessions.sidebar.header.displayMode.label"),style:{touchAction:"manipulation"},children:n.jsx(G,{name:"equalizer-2",className:"size-4"})})}),n.jsxs(pr,{align:"end",className:"w-64",children:[n.jsx(di,{children:a("sessions.sidebar.header.listGrouping.label")}),Mh.map(ke=>{const[Be,dt]=ke;return at(Be,dt,b===Be,()=>nt(Be))}),b==="project"?n.jsxs(n.Fragment,{children:[n.jsx(Qn,{}),n.jsx(di,{children:a("sessions.sidebar.header.actions.sortProjects")}),Oh.map(ke=>{const[Be,dt]=ke;return at(Be,dt,g===Be,()=>Ue(Be))})]}):null,n.jsx(Qn,{}),at("pinned","sessions.sidebar.header.displayMode.showPinned",P,Tt(P,_,b1)),O?at("work","sessions.sidebar.header.displayMode.showWork",v,Tt(v,E,x1)):null,I.map(ke=>n.jsxs(En,{onClick:()=>Uu(ke.id,!j.includes(ke.id)),className:An,children:[n.jsx("span",{className:"min-w-0 truncate",dir:"auto",children:ke.name}),j.includes(ke.id)?null:n.jsx(G,{name:"check",className:"size-4 text-primary"})]},`section:${ke.id}`)),O&&v?at("in-place","sessions.sidebar.header.displayMode.keepWorkInPlace",A,Tt(A,k,y1)):null,at("detailed","sessions.sidebar.header.displayMode.detailedZoneRows",S,Tt(S,N,v1)),at("branch-names","sessions.sidebar.header.displayMode.worktreeNameByBranch",M,Tt(M,B,w1)),xt?n.jsxs(n.Fragment,{children:[n.jsx(Qn,{}),n.jsx(En,{onClick:()=>se(!0),className:An,children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(G,{name:"drag-move-2",className:"size-4"}),a("mobile.sessions.editOrder")]})})]}):null]})]}):null,e[42]=xt,e[43]=I,e[44]=S,e[45]=H,e[46]=b,e[47]=nt,e[48]=Ue,e[49]=j,e[50]=A,e[51]=g,e[52]=u.length,e[53]=at,e[54]=O,e[55]=N,e[56]=k,e[57]=_,e[58]=E,e[59]=B,e[60]=P,e[61]=v,e[62]=a,e[63]=M,e[64]=_e):_e=e[64];const Ae=_e;let Ke;e[65]!==H||e[66]!==a?(Ke=H?n.jsx(Ee,{type:"button",variant:"chip",size:"sm","aria-label":a("mobile.sessions.doneEditing"),"aria-pressed":!0,onClick:()=>se(!1),style:{touchAction:"manipulation"},children:n.jsx(G,{name:"check",className:"size-4"})}):null,e[65]=H,e[66]=a,e[67]=Ke):Ke=e[67];const qe=Ke;let ht;e[68]!==xe||e[69]!==H||e[70]!==f||e[71]!==a?(ht=H?null:n.jsxs(Ee,{type:"button",variant:"default",size:"sm","aria-label":a("mobile.sessions.newChat"),onClick:()=>{f(),xe()},style:{touchAction:"manipulation"},children:[n.jsx(G,{name:"add",className:"size-4"}),a("mobile.sessions.newChat")]}),e[68]=xe,e[69]=H,e[70]=f,e[71]=a,e[72]=ht):ht=e[72];const Ve=ht;let lt;e[73]!==H||e[74]!==a?(lt=H?null:n.jsx(Ee,{type:"button",variant:"chip",size:"sm","aria-label":a("sessions.sidebar.header.actions.addProject"),title:a("sessions.sidebar.header.actions.addProject"),onClick:()=>Q(!0),style:{touchAction:"manipulation"},children:n.jsx(G,{name:"folder-add",className:"size-4"})}),e[73]=H,e[74]=a,e[75]=lt):lt=e[75];const yt=lt,vt=j1;let Rt;e[76]!==H||e[77]!==i||e[78]!==a?(Rt=i&&!H?n.jsxs(fr,{children:[n.jsx(mr,{asChild:!0,children:n.jsx(Ee,{type:"button",variant:"chip",size:"sm","aria-label":a("sessions.sidebar.header.actions.more"),title:a("sessions.sidebar.header.actions.more"),style:{touchAction:"manipulation"},children:n.jsx(G,{name:"more",className:"size-4"})})}),n.jsxs(pr,{align:"end",className:"w-56",children:[i.onOpenOverview?vt("compass-3",a("overview.title"),i.onOpenOverview):null,vt("git-pull-request",a("sourceBoard.title"),i.onOpenSourceBoard),vt("calendar-schedule",a("sessions.sidebar.header.actions.scheduledTasks"),i.onOpenScheduled),vt("archive",a("sessions.sidebar.nav.archive"),i.onOpenArchive),vt("bar-chart",a("usageStats.openAction"),i.onOpenUsage)]})]}):null,e[76]=H,e[77]=i,e[78]=a,e[79]=Rt):Rt=e[79];const _t=Rt;let $t;e[80]!==yt||e[81]!==Ae||e[82]!==qe||e[83]!==_t||e[84]!==Ve?($t=n.jsxs(n.Fragment,{children:[yt,Ae,_t,qe,Ve]}),e[80]=yt,e[81]=Ae,e[82]=qe,e[83]=_t,e[84]=Ve,e[85]=$t):$t=e[85];const de=$t,le=u.length===0&&!T,he="flex min-h-0 flex-1 flex-col";let Ce;e[86]!==H||e[87]!==le||e[88]!==t||e[89]!==$||e[90]!==Re||e[91]!==a||e[92]!==X||e[93]!==l?(Ce=!H&&!le&&Re?n.jsx("div",{className:ie("shrink-0 px-3 pb-2",l==="sidebar"?"pt-2":"pt-1"),children:n.jsx(qu,{inputRef:te,value:$,onSearch:W,onClose:l==="sidebar"?X:void 0,active:t,mobile:!0,placeholder:a("mobile.sessions.search.placeholder"),clearLabel:a("mobile.sessions.clearSearchAria")})}):null,e[86]=H,e[87]=le,e[88]=t,e[89]=$,e[90]=Re,e[91]=a,e[92]=X,e[93]=l,e[94]=Ce):Ce=e[94];let Ne;e[95]!==le||e[96]!==a?(Ne=le?n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(Wh,{title:a("mobile.sessions.empty.noProjectsTitle"),description:a("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:()=>Q(!0),children:[n.jsx(G,{name:"folder-add",className:"size-4"}),a("sessions.sidebar.header.actions.addProject")]})})}):null,e[95]=le,e[96]=a,e[97]=Ne):Ne=e[97];let ze;e[98]!==bt||e[99]!==H||e[100]!==Ie||e[101]!==We||e[102]!==a?(ze=H?n.jsx(Ut,{outerClassName:"min-h-0 flex-1",className:"pb-4",useScrollShadow:!0,disableHorizontal:!0,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:a("mobile.sessions.editOrderHint")}),n.jsx(ef,{sensors:bt,collisionDetection:tf,onDragEnd:Ie,children:n.jsx(sf,{items:We.map(k1),strategy:nf,children:n.jsx("div",{className:"flex flex-col gap-1.5",children:We.map(S1)})})})]})}):null,e[98]=bt,e[99]=H,e[100]=Ie,e[101]=We,e[102]=a,e[103]=ze):ze=e[103];const qt=(H||le)&&"hidden";let Wt;e[104]!==qt?(Wt=ie("flex min-h-0 flex-1 flex-col",qt),e[104]=qt,e[105]=Wt):Wt=e[105];let wt;e[106]!==d||e[107]!==tt?(wt=n.jsx(Gu,{mobileVariant:!0,isVisible:d,phone:tt}),e[106]=d,e[107]=tt,e[108]=wt):wt=e[108];let zt;e[109]!==$e||e[110]!==wt?(zt=n.jsx(eh,{value:$e,children:wt}),e[109]=$e,e[110]=wt,e[111]=zt):zt=e[111];let Et;e[112]!==Wt||e[113]!==zt?(Et=n.jsx("div",{className:Wt,children:zt}),e[112]=Wt,e[113]=zt,e[114]=Et):Et=e[114];let es;e[115]!==i||e[116]!==R||e[117]!==a||e[118]!==l?(es=i?n.jsxs("div",{"data-keyboard-rider":l==="drawer"?"":void 0,className:"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:i.instanceLabel&&i.onOpenInstances?n.jsxs(Ee,{type:"button",variant:"info",size:"lg",className:"min-w-0 shrink justify-start",onClick:i.onOpenInstances,"aria-label":a("mobile.menu.instances"),style:{touchAction:"manipulation"},children:[n.jsx(G,{name:"server",className:"size-[18px]"}),n.jsx("span",{className:"block min-w-0 truncate",children:i.instanceLabel})]}):null}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[i.onOpenUpdate?n.jsxs(Ee,{type:"button",variant:"chip",size:"lg",className:"relative w-10 px-0",onClick:i.onOpenUpdate,"aria-label":a("mobile.menu.update"),title:a("mobile.menu.update"),style:{touchAction:"manipulation"},children:[n.jsx(G,{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":!0})]}):null,n.jsxs(nc,{children:[n.jsx(rc,{asChild:!0,children:n.jsx(Ee,{type:"button",variant:"default",size:"lg",className:"w-10 px-0",onClick:i.onOpenSettings,"aria-label":a("mobile.menu.settings"),style:{touchAction:"manipulation"},children:n.jsx(G,{name:"settings-3",className:"size-5"})})}),n.jsx(ic,{side:"top",children:n.jsx(oc,{label:a("mobile.menu.settings"),shortcut:ac(lc("open_settings",R),"")})})]})]})]}):null,e[115]=i,e[116]=R,e[117]=a,e[118]=l,e[119]=es):es=e[119];let ts;e[120]!==ee?(ts=n.jsx(Ju,{open:ee,onOpenChange:Q}),e[120]=ee,e[121]=ts):ts=e[121];const is=cc;let os;e[122]===Symbol.for("react.memo_cache_sentinel")?(os=ke=>{K(ke),ke||U(null)},e[122]=os):os=e[122];const Ys=st?{id:st.id,path:$r(st.path)}:void 0;let as;e[123]!==xe||e[124]!==f||e[125]!==Z?(as=ke=>{f({selectedProjectId:Z,directoryOverride:ke,preserveDirectoryOverride:!0}),xe()},e[123]=xe,e[124]=f,e[125]=Z,e[126]=as):as=e[126];let Gt;e[127]!==is||e[128]!==Y||e[129]!==os||e[130]!==Ys||e[131]!==as?(Gt=n.jsx(is,{open:Y,onOpenChange:os,project:Ys,onWorktreeCreated:as}),e[127]=is,e[128]=Y,e[129]=os,e[130]=Ys,e[131]=as,e[132]=Gt):Gt=e[132];const Qs=Ze!==null;let Jt;e[133]===Symbol.for("react.memo_cache_sentinel")?(Jt=()=>D(null),e[133]=Jt):Jt=e[133];let jt;e[134]!==Ze||e[135]!==Qs?(jt=n.jsx(Op,{open:Qs,project:Ze,onClose:Jt}),e[134]=Ze,e[135]=Qs,e[136]=jt):jt=e[136];let Kt;e[137]!==z?(Kt=z?n.jsx(va,{open:!0,project:z.project,worktree:z.worktree,onClose:()=>J(null)}):null,e[137]=z,e[138]=Kt):Kt=e[138];let ys;e[139]!==Ce||e[140]!==Ne||e[141]!==ze||e[142]!==Et||e[143]!==es||e[144]!==ts||e[145]!==Gt||e[146]!==jt||e[147]!==Kt?(ys=n.jsxs("div",{className:he,children:[Ce,Ne,ze,Et,es,ts,Gt,jt,Kt]}),e[139]=Ce,e[140]=Ne,e[141]=ze,e[142]=Et,e[143]=es,e[144]=ts,e[145]=Gt,e[146]=jt,e[147]=Kt,e[148]=ys):ys=e[148];const ls=ys;if(l==="sidebar"){let ke;e[149]!==H||e[150]!==le||e[151]!==ae||e[152]!==a||e[153]!==X?(ke=!H&&!le?n.jsx(Ee,{type:"button",variant:"chip",size:"sm","aria-label":a("sessions.sidebar.header.actions.searchSessions"),title:a("sessions.sidebar.header.actions.searchSessions"),"aria-pressed":ae,onClick:X,style:{touchAction:"manipulation"},children:n.jsx(G,{name:"search",className:"size-4"})}):null,e[149]=H,e[150]=le,e[151]=ae,e[152]=a,e[153]=X,e[154]=ke):ke=e[154];let Be;e[155]!==de?(Be=n.jsx("div",{className:"ms-auto flex shrink-0 items-center gap-2",children:de}),e[155]=de,e[156]=Be):Be=e[156];let dt;e[157]!==ke||e[158]!==Be?(dt=n.jsxs("div",{className:"flex h-[var(--oc-header-height,56px)] shrink-0 items-center gap-2 border-b border-edge px-3",children:[ke,Be]}),e[157]=ke,e[158]=Be,e[159]=dt):dt=e[159];let Bt;return e[160]!==ls||e[161]!==dt?(Bt=n.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[dt,ls]}),e[160]=ls,e[161]=dt,e[162]=Bt):Bt=e[162],Bt}let Me;e[163]!==xe?(Me=()=>{const ke=ut.getState();if(ke.revealedKey){ke.setRevealed(ke.revealedKey,!1);return}xe()},e[163]=xe,e[164]=Me):Me=e[164];let Vt;e[165]!==a?(Vt=a("mobile.sessions.sheet.title"),e[165]=a,e[166]=Vt):Vt=e[166];let ss;e[167]!==a?(ss=a("mobile.surface.closeAria"),e[167]=a,e[168]=ss):ss=e[168];let Xt,kt;e[169]===Symbol.for("react.memo_cache_sentinel")?(Xt={touchAction:"manipulation"},kt=n.jsx(G,{name:"close",className:"size-5"}),e[169]=Xt,e[170]=kt):(Xt=e[169],kt=e[170]);let cs;e[171]!==xe||e[172]!==ss?(cs=n.jsx("button",{type:"button",className:"flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":ss,onClick:xe,style:Xt,children:kt}),e[171]=xe,e[172]=ss,e[173]=cs):cs=e[173];let us;e[174]!==de?(us=n.jsx("div",{className:"ms-auto flex shrink-0 items-center gap-2",children:de}),e[174]=de,e[175]=us):us=e[175];let ds;e[176]!==cs||e[177]!==us?(ds=n.jsxs("div",{className:"flex h-[var(--oc-header-height,56px)] shrink-0 items-center gap-2 px-3",children:[cs,us]}),e[176]=cs,e[177]=us,e[178]=ds):ds=e[178];let As;return e[179]!==xe||e[180]!==t||e[181]!==ls||e[182]!==Me||e[183]!==Vt||e[184]!==ds?(As=n.jsxs($h,{open:t,onClose:xe,onSwipeClose:Me,ariaLabel:Vt,children:[ds,ls]}),e[179]=xe,e[180]=t,e[181]=ls,e[182]=Me,e[183]=Vt,e[184]=ds,e[185]=As):As=e[185],As},Ji="mobile-surface-root",Ra=16,Xi=320,Bh="cubic-bezier(0.22, 1, 0.36, 1)",Fh=s=>{const e=ne.c(3),[t,r]=m.useState(s);let o,i;return e[0]!==s?(o=()=>{if(!s){r(!1);return}let l=0;const a=window.setTimeout(()=>{l=window.requestAnimationFrame(()=>{l=window.requestAnimationFrame(()=>r(!0))})},Ra);return()=>{window.clearTimeout(a),window.cancelAnimationFrame(l)}},i=[s],e[0]=s,e[1]=o,e[2]=i):(o=e[1],i=e[2]),m.useEffect(o,i),t},$h=({open:s,onClose:e,onSwipeClose:t,ariaLabel:r,children:o})=>{const{direction:i}=ge(),l=m.useRef(null),a=m.useRef(null),[d,c]=m.useState(!1),[u,p]=m.useState(s),h=m.useRef(e);m.useEffect(()=>{h.current=e},[e]);const f=m.useRef(t);m.useEffect(()=>{f.current=t},[t]);const g=()=>(f.current??h.current)();if(Gr(a,{enabled:s,...i==="rtl"?{onLeftEdgeSwipe:g}:{onRightEdgeSwipe:g}}),typeof document<"u"&&!l.current){let x=document.getElementById(Ji);x||(x=document.createElement("div"),x.id=Ji,document.body.appendChild(x)),l.current=x}return m.useEffect(()=>{if(s){p(!0);const b=window.setTimeout(()=>c(!0),Ra);return()=>window.clearTimeout(b)}c(!1);const x=window.setTimeout(()=>p(!1),Xi+40);return()=>window.clearTimeout(x)},[s]),m.useEffect(()=>{if(!s)return;const x=document.body.style.overflow;document.body.style.overflow="hidden";const b=w=>{w.key==="Escape"&&!Rr(w)&&h.current()};return document.addEventListener("keydown",b),()=>{document.body.style.overflow=x,document.removeEventListener("keydown",b)}},[s]),l.current?Ls.createPortal(n.jsx("section",{ref:a,role:"dialog","aria-modal":"true","aria-label":r,"aria-hidden":!s,className:"oc-keyboard-inset-surface fixed inset-0 z-50 flex flex-col bg-background text-foreground",style:{paddingTop:"var(--oc-safe-area-top, 0px)",transform:d?"none":i==="rtl"?"translateX(100%)":"translateX(-100%)",transition:`transform ${Xi}ms ${Bh}`,visibility:u?"visible":"hidden",pointerEvents:s?"auto":"none"},children:n.jsx("div",{className:"flex h-full min-h-0 flex-col",children:o})}),l.current):null},Wh=s=>{const e=ne.c(10),{title:t,description:r,action:o}=s;let i;e[0]!==t?(i=n.jsx("p",{className:"typography-ui-label text-foreground",children:t}),e[0]=t,e[1]=i):i=e[1];let l;e[2]!==r?(l=r?n.jsx("p",{className:"typography-meta text-muted-foreground",children:r}):null,e[2]=r,e[3]=l):l=e[3];let a;e[4]!==o?(a=o?n.jsx("div",{className:"pt-2",children:o}):null,e[4]=o,e[5]=a):a=e[5];let d;return e[6]!==i||e[7]!==l||e[8]!==a?(d=n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 text-center",children:[i,l,a]}),e[6]=i,e[7]=l,e[8]=a,e[9]=d):d=e[9],d};function Kh(s){return s.projects}function Vh(s){return s.manualProjectOrder}function Hh(s){return s.reorderProjects}function Uh(s){return s.openNewSessionDraft}function qh(s){return s.projectSortOrder}function Gh(s){return s.setProjectSortOrder}function Jh(s){return s.setSidebarGrouping}function Xh(s){return s.showWorkSection}function Yh(s){return s.setShowWorkSection}function Qh(s){return s.showPinnedSection}function Zh(s){return s.setShowPinnedSection}function e1(s){return s.keepWorkInPlace}function t1(s){return s.setKeepWorkInPlace}function s1(s){return s.detailedZoneRows}function n1(s){return s.setDetailedZoneRows}function r1(s){return s.worktreeNameByBranch}function i1(s){return s.setWorktreeNameByBranch}function o1(s){return s.sessionWorkEnabled}function a1(s){return s.sections}function l1(s){return s.kind==="custom"}function c1(s){return s.hiddenSections}function u1(s){return s.shortcutOverrides}function d1(s){return kr(Rs(s))}function f1(s){return s.activeSessions.some(d1)}function m1(s){return s+1}function p1(){return uc()}function h1(s){return{...s,label:s.label?.trim()||$p(s.path)}}function g1(s,e,t){return()=>{e(!s),t(!s)}}function b1(s){Es({sidebarShowPinnedSection:s})}function x1(s){Es({sidebarShowWorkSection:s})}function y1(s){Es({sidebarKeepWorkInPlace:s})}function v1(s){Es({sidebarDetailedZoneRows:s})}function w1(s){Es({sidebarWorktreeNameByBranch:s})}function j1(s,e,t){return n.jsx(En,{onClick:t,className:An,children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(G,{name:s,className:"size-4"}),e]})})}function k1(s){return s.id}function S1(s){return n.jsx(zh,{project:s},s.id)}const N1=(s,e)=>{const t=()=>{const o=He.getState();o.isSettingsDialogOpen&&(o.setSettingsDialogOpen(!1),e(s.includes(Xu(o.settingsPage))?"page-content":"nav"))},r=He.subscribe((o,i)=>{o.isSettingsDialogOpen&&!i.isSettingsDialogOpen&&t()});return t(),r},C1=s=>{const e=ne.c(8),{hidden:t,className:r}=s;let o;e[0]!==r?(o=ie("relative inline-flex",r),e[0]=r,e[1]=o):o=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(G,{name:"space",className:"size-full"}),e[2]=i):i=e[2];let l;e[3]!==t?(l=t?n.jsx("span",{className:"absolute left-1/2 top-1/2 h-[1.5px] w-[130%] -translate-x-1/2 -translate-y-1/2 -rotate-45 rounded-full bg-current"}):null,e[3]=t,e[4]=l):l=e[4];let a;return e[5]!==o||e[6]!==l?(a=n.jsxs("span",{className:o,"aria-hidden":"true",children:[i,l]}),e[5]=o,e[6]=l,e[7]=a):a=e[7],a},Cn="flex size-9 shrink-0 items-center justify-center rounded-lg text-muted-foreground hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none",R1=s=>{const e=ne.c(62),{directory:t,target:r,subtitle:o,revision:i,visible:l,onBack:a}=s,{t:d}=ge();let c;e[0]!==t||e[1]!==i||e[2]!==r||e[3]!==l?(c={directory:t,target:r,visible:l,needsSourceSelection:!1,revision:i},e[0]=t,e[1]=i,e[2]=r,e[3]=l,e[4]=c):c=e[4];const u=$f(c),{view:p}=u;let h;e[5]!==r?(h=ol(r),e[5]=r,e[6]=h):h=e[6];const f=h,[g,x]=m.useState(!1),b=u.entry.result?.generatedAt??null,[w,v]=m.useState(null),E=p!==null&&w!==null&&w===b;let P;e[7]!==b||e[8]!==u?(P=Q=>{u.handleSelectStop(Q),v(b)},e[7]=b,e[8]=u,e[9]=P):P=e[9];const _=P;let A;e[10]!==a||e[11]!==E?(A=()=>{E?v(null):a()},e[10]=a,e[11]=E,e[12]=A):A=e[12];const k=A;let S;e[13]!==d?(S=d("header.actions.backAria"),e[13]=d,e[14]=S):S=e[14];let N;e[15]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(G,{name:"arrow-left",className:"size-5"}),e[15]=N):N=e[15];let M;e[16]!==k||e[17]!==S?(M=n.jsx("button",{type:"button",className:Cn,"aria-label":S,onClick:k,children:N}),e[16]=k,e[17]=S,e[18]=M):M=e[18];let B;e[19]!==d?(B=d("contextPanel.mode.walkthrough"),e[19]=d,e[20]=B):B=e[20];let O;e[21]!==B?(O=n.jsx("h2",{className:"truncate typography-ui-header text-foreground",children:B}),e[21]=B,e[22]=O):O=e[22];let C;e[23]!==o?(C=n.jsx("p",{className:"truncate typography-meta text-muted-foreground",children:o}),e[23]=o,e[24]=C):C=e[24];let L;e[25]!==C||e[26]!==O?(L=n.jsxs("div",{className:"min-w-0 flex-1 px-1",children:[O,C]}),e[25]=C,e[26]=O,e[27]=L):L=e[27];let I;e[28]!==E||e[29]!==u||e[30]!==d||e[31]!==p?(I=E&&p?n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",className:Cn,"aria-label":d("walkthrough.action.previous"),onClick:()=>u.step(-1),children:n.jsx(G,{name:"arrow-right-s",className:"size-5 rotate-180"})}),n.jsx(Wf,{review:u,view:p,size:"mobile"}),n.jsx("button",{type:"button",className:Cn,"aria-label":d("walkthrough.action.next"),onClick:()=>u.step(1),children:n.jsx(G,{name:"arrow-right-s",className:"size-5"})})]}):n.jsx("button",{type:"button",className:Cn,"aria-label":d("walkthrough.options.moreAria"),"aria-haspopup":"dialog",onClick:()=>x(!0),children:n.jsx(G,{name:"more",className:"size-5"})}),e[28]=E,e[29]=u,e[30]=d,e[31]=p,e[32]=I):I=e[32];let j;e[33]!==L||e[34]!==I||e[35]!==M?(j=n.jsxs("header",{className:"flex h-[var(--oc-header-height,56px)] shrink-0 items-center gap-1.5 border-b border-edge px-3 text-foreground",children:[M,L,I]}),e[33]=L,e[34]=I,e[35]=M,e[36]=j):j=e[36];let R;e[37]!==u||e[38]!==p?(R=n.jsx(Gf,{review:u,view:p}),e[37]=u,e[38]=p,e[39]=R):R=e[39];let T;e[40]!==f||e[41]!==_||e[42]!==E||e[43]!==u||e[44]!==p?(T=n.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:u.blocked?n.jsx(Kf,{reason:u.blocked.reason,model:u.blocked.model,requiredChars:u.blocked.requiredChars,availableChars:u.blocked.availableChars,onRetry:u.retry}):u.showStages?n.jsx("div",{className:"flex flex-1 flex-col items-center justify-center gap-3 p-8",children:n.jsx(Vf,{progress:u.stageProgress})}):p&&E?n.jsx(Hf,{view:p,activeStopId:u.activeStopId,scrollToStopId:u.scrollToStopId,onActiveStopChange:u.handleActiveStopChange,onScrollHandled:u.clearScrollRequest,renderSideBySide:!1,wrapLines:!0,commentOrigin:f}):p?n.jsx(Uf,{view:p,activeStopId:u.activeStopId,visitedStopIds:u.visitedStopIds,onSelectStop:_}):n.jsx(qf,{review:u,size:"mobile"})}),e[40]=f,e[41]=_,e[42]=E,e[43]=u,e[44]=p,e[45]=T):T=e[45];let $;e[46]===Symbol.for("react.memo_cache_sentinel")?($=()=>x(!1),e[46]=$):$=e[46];let W;e[47]!==d?(W=d("walkthrough.options.title"),e[47]=d,e[48]=W):W=e[48];const q=p!==null;let D;e[49]===Symbol.for("react.memo_cache_sentinel")?(D=()=>x(!1),e[49]=D):D=e[49];let z;e[50]!==u||e[51]!==q?(z=n.jsx("div",{className:"px-2 py-2",children:n.jsx(Jf,{review:u,hasView:q,size:"mobile",onActed:D})}),e[50]=u,e[51]=q,e[52]=z):z=e[52];let J;e[53]!==g||e[54]!==W||e[55]!==z?(J=n.jsx(Eo,{open:g,onClose:$,title:W,children:z}),e[53]=g,e[54]=W,e[55]=z,e[56]=J):J=e[56];let ee;return e[57]!==j||e[58]!==R||e[59]!==T||e[60]!==J?(ee=n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[j,R,T,J]}),e[57]=j,e[58]=R,e[59]=T,e[60]=J,e[61]=ee):ee=e[61],ee};async function E1(s,e,t=Number.POSITIVE_INFINITY){const r=Array.from(new Set(s)),o=[];return await dc(r,t,async i=>{try{await e(i)}catch(l){o.push({path:i,error:l instanceof Error?l:null})}}),{paths:r,failures:o}}const I1=async(s,e,t)=>{const{targetBranch:r,directory:o,sourceBranch:i,git:l,publishChooser:a,toast:d,t:c}=t;if(!(!r||!o)){if(await l.createGitCommit(o,s,{addAll:!0}),e)try{await(await a.prepare("push"))()}catch{d.error(c("gitView.dirtySwitch.pushFailed")),await t.refreshStatusAndBranches(),t.closeDialog();return}d.success(i?e?c("gitView.publish.succeeded"):c("gitView.dirtySwitch.committedNotPushed",{branch:i}):c("gitView.toast.commitCreated")),await t.refreshStatusAndBranches(),t.closeDialog(),await t.performCheckout(r)}},Yi={status:"loading"},T1=1e6,rs={type:"list"},_1=2,A1=s=>{const e=s.index?.trim();return!!(e&&e!=="?")},P1=s=>{const e=s.working_dir?.trim(),t=s.index?.trim();return!!(e||t==="?")},Qi=(s,e)=>e?`${s}\0staged`:s,D1=s=>{const e=ne.c(12),t=Mo(),r=pn(Lo(t,Ir()))??"",o=s.visible??!0;let i;e[0]!==o?(i={enabled:o,recheckOnOpen:!0},e[0]=o,e[1]=i):i=e[1];const l=fc(r||null,i);let a;e[2]!==r?(a=h=>r?h.changesRepositories.get(r):void 0,e[2]=r,e[3]=a):a=e[3];const d=In(a);let c;e[4]!==l||e[5]!==d?(c=d&&l.repositoryOptions?.includes(d)?{...l,gitDirectory:d}:l,e[4]=l,e[5]=d,e[6]=c):c=e[6];const u=c;if(t?.kind==="preparing"){let h;return e[7]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(Wo,{}),e[7]=h):h=e[7],h}let p;return e[8]!==s||e[9]!==u||e[10]!==r?(p=n.jsx(O1,{...s,rootDirectory:r,repository:u}),e[8]=s,e[9]=u,e[10]=r,e[11]=p):p=e[11],p},O1=({rootDirectory:s,repository:e,onClose:t,initialDiff:r,visible:o=!0,onNavigatedToChat:i})=>{const{t:l}=ge(),{git:a,sourceControl:d}=Cr(),{rootIsGitRepo:c,gitDirectory:u,nestedRepos:p,repositoryOptions:h}=e,f=u??s,g=mc(f||null),x=Yu(f),b=pc(f||null),w=hc(f||null),[v,E]=m.useState(!1),[P,_]=m.useState(!1),A=Sn(y=>y.profiles),k=Sn(y=>y.globalIdentity),S=Sn(y=>y.loadProfiles),N=Sn(y=>y.loadGlobalIdentity);m.useEffect(()=>{S(),N()},[S,N]);const M=gc(),B=zo(y=>y.refreshIdentityAccounts),O=m.useMemo(()=>bc(A,k,y=>cl(y)&&Pc(y,M)),[A,k,M]),C=async y=>{if(!(!f||P)){_(!0);try{(await fd({directory:f,identity:y,remoteName:Rt||null},{git:a,sourceControl:d})).status==="failed"?me.error(l("gitView.toast.applyIdentityFailed")):me.success(l("gitView.toast.appliedIdentity",{name:Dc(y,l)}))}finally{_(!1)}}},L=Co(f||null),I=xc(f||null),j=Pt(y=>y.setActiveDirectory),R=Pt(y=>y.ensureAll),T=Pt(y=>y.ensureNestedRepos),$=Pt(y=>y.selectNestedRepo),W=Pt(y=>y.fetchStatus),q=Pt(y=>y.fetchBranches),D=Pt(y=>y.prefetchDiffs),z=Pt(y=>y.getDiff),J=Pt(y=>y.setDiff),ee=Pt(y=>y.runtimeKey),Q=JSON.stringify([ee,f]),Y=m.useRef(Q);Y.current=Q;const[K,Z]=m.useState(()=>({ownerKey:Q,mode:"working",route:r?.path?{type:"diff",path:r.path,staged:r.staged}:rs})),U=K.ownerKey===Q?K.mode:"working",H=K.ownerKey===Q?K.route:rs,[se,fe]=m.useState(!1),ce=m.useCallback(y=>{Z({ownerKey:Q,mode:y,route:rs}),fe(!1)},[Q]),ae=m.useCallback(y=>{Z(F=>({ownerKey:Q,mode:F.ownerKey===Q?F.mode:"working",route:y}))},[Q]);m.useEffect(()=>{Z(y=>y.ownerKey===Q?y:{ownerKey:Q,mode:"working",route:rs}),fe(!1)},[Q]),m.useEffect(()=>{o||fe(!1)},[o]),m.useEffect(()=>{r?.path&&Z({ownerKey:Y.current,mode:"working",route:{type:"diff",path:r.path,staged:r.staged}})},[r]);const[je,Re]=m.useState(null),[te,pe]=m.useState(null),X=Pf(),[oe,ve]=m.useState(""),[we,Se]=m.useState(new Set),[be,xe]=m.useState(!1),[V,ue]=m.useState(!1),[Le,$e]=m.useState([]),[Te,Xe]=m.useState([]),[Ye,tt]=m.useState([]),[rt,ye]=m.useState(null),[Fe,We]=m.useState(null),[Qe,Ze]=m.useState(0),st=Qu(),Oe=Zu({directory:f,branch:g?.current,chooseContributor:st.choose}),Ue=ed(f,a,d),[Ge,nt]=m.useState(null),[Tt,Ct]=m.useState(!1),[at,mt]=m.useState([]),[pt,bt]=m.useState("rebase"),et=m.useCallback((y,F)=>{mt(y),bt(F),Ct(!0)},[]),Ie=g?.current??null,xt=bi(y=>y.setOverride),_e=bi(y=>y.clearOverride),Ae=Xf(f||null,Ie,o&&U==="commit"&&L===!0),Ke=Ae.selectedCommit?.hash??null,qe=yc(f||null,d),ht=m.useMemo(()=>new Set(qe.read?.repository.remotes.map(y=>y.name)??[]),[qe.read]),Ve=td(f||null,Ie,o&&L===!0,{branches:b,remoteNames:ht,primaryRemote:qe.contexts[0]?.primaryRemote,readContext:qe.contexts[0]??null}),lt=o&&L===!0;tm(lt&&f||null,lt?Ie:null,qe);const yt=Cf(Ie,Ve.base),vt=L===!1||Rf(Ie,Ve.base,g!==null,Ve.resolved),Rt=qe.read?.binding?.remotes[0]?.name??qe.read?.repository.remotes.find(y=>y.name==="origin")?.name??qe.read?.repository.remotes[0]?.name??"",_t=qe.read?qe.read.binding?.providers.find(y=>y.readiness==="ready")?.accountId??null:void 0,$t=m.useMemo(()=>vc(A,k,w,y=>({id:"local-config",name:y.userName,...y,color:"info",icon:"user"}),_t),[_t,w,A,k]),de=m.useMemo(()=>{const y=qe.read;return!y?.binding||qe.status!=="ready"||y.binding.state==="bound"?null:wc(y.binding)?l("gitView.identity.configChanged"):l("gitView.context.needsAttention")},[qe.read,qe.status,l]),le=In(y=>s?y.diffRequests.get(s):void 0);m.useEffect(()=>{le&&Z({ownerKey:Q,mode:"pr",route:rs})},[Q,le]);const he=Yf(f||null,Ie,qe.contexts[0]??null,o&&U==="pr"&&L===!0,le),Ce=al(he.provider),Ne=he.selectedSource;m.useEffect(()=>{!s||!le||!g||Ne!==le||In.getState().settleDiffRequest(s,le)},[le,s,Ne,g]);const ze=ot(y=>y.currentSessionId),qt=vo(U==="turn"?ze??"":"",s||void 0),Wt=qt.length>0?qt[qt.length-1].id:"",[wt,zt]=m.useState([]),[Et,es]=m.useState(!1),[ts,is]=m.useState(null),[os,Ys]=m.useReducer(y=>y+1,0),[as,Gt]=m.useState(!1),Qs=m.useCallback(()=>{Gt(!1),i?.()},[i]),Jt=jc(ze,s,Qs),jt=m.useMemo(()=>U==="pr"?he.diffUnavailable?null:Ne:U==="branch"&&Ie&&Ve.base?{kind:"branch",baseRef:Ve.base,headRef:Ie}:U==="commit"&&Ke?{kind:"commit",hash:Ke}:null,[Ve.base,Ie,U,he.diffUnavailable,Ke,Ne]),Kt=U==="branch"?Ve.revision:"",ys=Ne?he.prs.find(y=>y.number===Ne.number)?.headSha:void 0,ls=m.useMemo(()=>ll(jt,{provider:he.provider,revision:ys}),[jt,he.provider,ys]),Me=Ef(f||null,jt,o&&L===!0,Kt,he.readContext,he.provider),{fetchDiff:Vt,fetchFullFile:ss}=Me,Xt=m.useMemo(()=>Me.files?[...Me.files].sort((y,F)=>y.path.localeCompare(F.path)):null,[Me.files]),kt=H.type==="comparison"&&H.sourceKey===Me.key?H.path:null,[cs,us]=m.useState(0),ds=m.useCallback(async y=>{try{const{diff:F}=await Vt(y),re={original:"",modified:"",isBinary:wi(F)};return re.isBinary||(re.fileDiff=er(y,F)),{status:"ready",diff:re}}catch(F){return{status:"error",message:F instanceof Error?F.message:l("diffView.state.failedToLoadDiff")}}},[Vt,l]),As=m.useMemo(()=>U==="branch"?If(Me.files,Kt):void 0,[Me.files,Kt,U]),ke=Tf(Me.files?U==="pr"?JSON.stringify([Me.key,Me.revision]):Me.key:null,o&&kt?kt:"",o?ds:null,Yi,JSON.stringify([U==="pr"?Me.revision:0,cs]),As),Be=kt?ke.get(kt)??Yi:null,[dt,Bt]=m.useState(null),[Ps,Zs]=m.useState(null),bn=dt&&dt.source===Be?dt.request:null,xn=Ps&&Ps.source===Be?Ps.diff:null;m.useEffect(()=>{const y=Be;if(!bn||!kt||y?.status!=="ready"||xn)return;let F=!1;const re=kt,Pe=async()=>{if(U==="pr"){const{original:Ht,modified:it}=await ss(re);return{original:Ht,modified:it,fileDiff:nm({name:re,contents:Ht},{name:re,contents:it})}}const{diff:Je}=await Vt(re,T1);return{original:"",modified:"",fileDiff:er(re,Je)}};return(async()=>{try{const Je=await Pe();F||Zs({source:y,diff:Je})}catch(Je){if(F)return;me.error(Je instanceof Error?Je.message:l("diffView.state.failedToLoadDiff")),Bt(null)}})(),()=>{F=!0}},[Be,kt,xn,Vt,ss,U,bn,l]),m.useEffect(()=>{U==="branch"&&vt&&ce("working")},[vt,ce,U]),m.useEffect(()=>{Z(y=>y.ownerKey===Q&&y.route.type==="comparison"&&y.route.sourceKey!==Me.key?{...y,route:rs}:y)},[Me.key,Q]),m.useEffect(()=>{zt([]),es(!1),is(null)},[ze]),m.useEffect(()=>{if(U!=="turn"||!ze||!o)return;let y=!1;return lr.getSessionTurnDiff(ze,{directory:s||void 0}).then(F=>{y||(zt(F.map(re=>({file:re.file,patch:re.patch,status:re.status,additions:re.additions,deletions:re.deletions}))),es(!0),is(null))}).catch(F=>{y||(console.warn("[mobile-changes] turn diff unavailable:",F instanceof Error?F.message:F),is(F instanceof Error?F.message:l("diffView.state.failedToLoadDiff")))}),()=>{y=!0}},[ze,Wt,U,s,l,os,o]);const Hn=m.useMemo(()=>wt.map(y=>({path:y.file??"",status:_f(y.status),insertions:y.additions??0,deletions:y.deletions??0})).filter(y=>y.path).sort((y,F)=>y.path.localeCompare(F.path)),[wt]),_a=m.useMemo(()=>{const y=new Map;for(const F of wt)if(F.file){if(typeof F.patch=="string"){const re=wi(F.patch);y.set(F.file,{original:"",modified:"",isBinary:re,fileDiff:re?void 0:er(F.file,F.patch)});continue}y.set(F.file,{original:F.before??"",modified:F.after??""})}return y},[wt]),At=m.useMemo(()=>{const y=g?.files??[],F=new Map;for(const re of y)F.set(re.path,re);return Array.from(F.values()).sort((re,Pe)=>re.path.localeCompare(Pe.path))},[g?.files]),yn=m.useMemo(()=>U==="working"?At.length>0?{source:{kind:"working-tree",scope:"all"}}:null:!jt||!Xt?.length?null:jt.kind==="pr"?he.readContext?{source:jt,context:he.readContext}:null:{source:jt},[At.length,Xt,jt,U,he.readContext]),ns=m.useMemo(()=>At.filter(A1),[At]),Un=m.useMemo(()=>At.filter(P1),[At]),Aa=Ye,Pa=Pt(m.useCallback(y=>!f||H.type!=="diff"?null:y.directories.get(f)?.diffCache.get(Qi(H.path,H.staged))??null,[f,H])),Da=m.useMemo(()=>H.type!=="diff"?null:At.find(y=>y.path===H.path)??null,[At,H]),St=m.useCallback(async(y=!0)=>{if(f)try{await Promise.all([W(f,a),q(f,a)])}catch(F){y&&me.error(F instanceof Error?F.message:l("gitView.toast.refreshRepositoryFailed"))}},[f,q,W,a,l]),Oa=m.useMemo(()=>(b?.all??[]).filter(y=>!y.startsWith("remotes/")).sort(),[b]),Ma=m.useMemo(()=>(b?.all??[]).filter(y=>y.startsWith("remotes/")).map(y=>y.replace(/^remotes\//,"")).sort(),[b]),vn=m.useCallback(async y=>{if(!f)return;const F=y.replace(/^remotes\//,"");try{const re=await a.checkoutBranch(f,F);me.success(l("gitView.toast.checkedOut",{name:re.branch||F})),await St()}catch(re){me.error(re instanceof Error?re.message:l("gitView.toast.checkoutFailed",{name:F}))}},[f,a,St,l]),La=m.useCallback(y=>{const F=y.replace(/^remotes\//,"");if((g?.files?.length??0)>0){nt(F);return}vn(F)},[vn,g?.files]),za=m.useCallback(async y=>{if(f)try{await a.createBranch(f,y,Ie??"HEAD"),await a.checkoutBranch(f,y),await St()}catch(F){throw me.error(F instanceof Error?F.message:l("gitView.toast.createBranchFailed")),F}},[Ie,f,a,St,l]),wn=m.useCallback(async()=>{if(!f){tt([]);return}try{const y=await a.getRemotes(f);tt(y)}catch{tt([])}},[f,a]),vs=m.useCallback(async()=>{f&&(Promise.allSettled([q(f,a),wn()]),await W(f,a).catch(()=>{}))},[f,q,W,a,wn]);m.useEffect(()=>{!f||!o||(j(f),R(f,a))},[f,R,a,j,o]),m.useEffect(()=>{o&&wn()},[wn,o]),m.useEffect(()=>{if(!o||U!=="working"||!f||At.length===0)return;const y=Array.from(new Set([...ns.map(re=>re.path),...Te,...At.slice(0,20).map(re=>re.path)])).filter(Boolean);if(y.length===0)return;const F=window.setTimeout(()=>{D(f,a,y,{maxFiles:40})},120);return()=>window.clearTimeout(F)},[At,f,a,U,D,ns,Te,o]),m.useEffect(()=>{if(!o)return;if(H.type!=="diff"){ye(null);return}const y=Qi(H.path,H.staged);if(We(null),!f||z(f,y)){ye(null);return}let F=!1;const re=qs();return ye(null),a.getGitFileDiff(f,{path:H.path,staged:H.staged||void 0}).then(Pe=>{F||J(f,y,{original:Pe.original??"",modified:Pe.modified??"",isBinary:Pe.isBinary,submodule:Pe.submodule},re)}).catch(Pe=>{if(!F){if(Pe instanceof ni&&Pe.reason!=="path_not_found"){We({key:`${f}\0${H.path}`,reason:Pe.reason});return}Pe instanceof ni&&W(f,a,{force:!0,silent:!0}),ye(Pe instanceof Error?Pe.message:String(Pe))}}),()=>{F=!0}},[f,Qe,W,z,a,H,J,o]);const en=async(y,F,re=!1)=>{if(!f)return;const Pe=Ue.start();if(!Pe)return;Re(y);const Je=l(y==="fetch"?"gitView.sync.fetch":y==="pull"?"gitView.sync.pull":y==="publish"?"gitView.publish.title":"gitView.sync.syncChanges");let Ht=null;try{if(y==="sync"||y==="publish"){const it=await Oe.prepare(y==="publish"?"push":"sync",{forceChoose:re,onOperation:Pe.onOperation});Ht=Oc(await it())}else if(F&&g)await Mc({action:y,directory:f,remoteName:F.name,status:g,sourceControl:d,git:a,onOperation:Pe.onOperation});else throw new fs("tracking-required");if(!Pe.isCurrent())return;y==="fetch"&&F?me.success(l("gitView.toast.fetchedFromRemote",{name:F.name})):y==="pull"&&F?me.success(l("gitView.toast.pulledFromRemote",{name:F.name})):y==="sync"?me.success(Ht?.kind==="up-to-date"?l("gitView.toast.alreadyUpToDate"):Ht?.kind==="pulled"?l("gitView.toast.pulledFromRemote",{name:Ht.remoteName}):Ht?.kind==="pushed"?l("gitView.toast.pushedToUpstream",{name:Ht.remoteName}):l("gitView.toast.syncedChanges")):y==="publish"&&me.success(l("gitView.publish.succeeded")),await vs()}catch(it){if(it instanceof Rn||it instanceof cr){if(Pe.isCurrent()&&await vs(),Pe.isCurrent()&&it instanceof Rn&&it.read.availability==="available"&&it.read.operation.state==="conflicted"&&it.read.operation.error.code==="CONFLICT"){const ti=((await a.getGitStatus(f).catch(()=>null))?.files??[]).filter(Zn).map(qa=>qa.path);ti.length>0&&et(ti,"merge")}return}if(it instanceof fs&&it.code==="stale-runtime")return;if(it instanceof fs&&Oe.errorMessage(it)){me.info(Oe.errorMessage(it));return}await vs(),me.error(it instanceof fs?it.code==="contributor-publish-cancelled-after-update"?l("gitView.toast.contributorPublishCancelledAfterUpdate"):it.code==="contributor-publish-cancelled"?l("gitView.toast.contributorPublishCancelled"):l("gitView.toast.syncActionFailed",{action:Je}):it instanceof Error?it.message:l("gitView.toast.syncActionFailed",{action:Je}))}finally{Pe.finish(),Pe.isCurrent()&&Re(null)}},tn=m.useCallback(async(y,F)=>{if(!(!f||y.length===0))try{F==="stage"?y.length>1?await kc(f,y):await Sc(f,y[0]):y.length>1?await Nc(f,y):await Cc(f,y[0]),await St(!1)}catch(re){me.error(re instanceof Error?re.message:l(F==="stage"?"gitView.toast.stageFileFailed":"gitView.toast.unstageFileFailed"))}},[f,St,l]),qn=m.useCallback((y,F=!1)=>{ae({type:"diff",path:y,staged:F})},[ae]),Gn=m.useCallback(async y=>{if(f){Se(F=>new Set(F).add(y));try{await a.revertGitFile(f,y),me.success(l("gitView.toast.revertedFile",{path:y})),await St(!1)}catch(F){me.error(F instanceof Error?F.message:l("gitView.toast.revertFailed"))}finally{Se(F=>{const re=new Set(F);return re.delete(y),re})}}},[f,a,St,l]),Xr=m.useCallback(async y=>{if(!f||y.length===0||be)return;const F=Array.from(new Set(y));xe(!0),Se(new Set(F));try{const re=await E1(F,Pe=>a.revertGitFile(f,Pe),_1);if(await St(!1),re.failures.length===0)me.success(F.length===1?l("gitView.toast.revertedFilesSingle",{count:F.length}):l("gitView.toast.revertedFilesPlural",{count:F.length}));else if(re.failures.length===F.length)me.error(re.failures[0]?.error?.message??l("gitView.toast.revertFailed"));else{const Pe=F.length-re.failures.length;me.warning(Pe===1?l("gitView.toast.revertedSomeSingle",{success:Pe,failed:re.failures.length}):l("gitView.toast.revertedSomePlural",{success:Pe,failed:re.failures.length}))}}catch(re){me.error(re instanceof Error?re.message:l("gitView.toast.revertFailed"))}finally{Se(new Set),xe(!1)}},[f,a,be,St,l]),Ba=m.useCallback(y=>{const F=y.map(re=>re.trim()).filter(Boolean);if(F.length===0){$e([]);return}ve(re=>`${re.trim()}${re.trim()?`
|
|
23
23
|
|
|
24
24
|
`:""}${F.join(`
|
|
25
|
-
`)}`.trim()),$e([])},[]),Fa=m.useCallback(async()=>{if(!f)return;const y=ns.map(F=>F.path).sort();if(y.length===0){me.error(l("gitView.toast.selectFileToDescribe"));return}ue(!0);try{const{message:F}=await fi(f,y);ve(F.subject?.trim()??""),$e(Array.isArray(F.highlights)?F.highlights:[])}catch(F){me.error(F instanceof Error?F.message:l("gitView.toast.generateCommitMessageFailed"))}finally{ue(!1)}},[f,ns,l]),Yr=async(y={})=>{if(!f)return;if(!oe.trim()){me.error(l("gitView.toast.enterCommitMessage"));return}const F=ns.map(Je=>Je.path).sort();if(F.length===0){me.error(l("gitView.toast.selectFileToCommit"));return}pe(y.pushAfter?"commitAndPush":"commit");let re=null,Pe="pending";try{const Je=await a.createGitCommit(f,oe.trim(),{files:F});Pe="local";const Ht=X.committed(Je.summary,y);if(ve(""),$e([]),y.pushAfter){if(re=Ue.start(),!re){me.warning(l("gitView.publish.commitKept")),await vs();return}const it=await Oe.prepare("push",{onOperation:re.onOperation});Re("publish"),await it(),Pe="published",X.pushed({deletion:Ht,origin:y.origin})}await vs()}catch(Je){if(y.pushAfter&&Pe==="local"&&me.warning(l("gitView.publish.commitKept")),Je instanceof Rn||Je instanceof cr){await vs();return}if(Je instanceof fs&&Je.code==="stale-runtime")return;if(Je instanceof fs&&Oe.errorMessage(Je)){me.info(Oe.errorMessage(Je));return}y.pushAfter&&await vs(),me.error(Je instanceof fs?Je.code==="contributor-publish-cancelled-after-update"?l("gitView.toast.contributorPublishCancelledAfterUpdate"):Je.code==="contributor-publish-cancelled"?l("gitView.toast.contributorPublishCancelled"):l("gitView.toast.syncActionFailed",{action:l("gitView.sync.syncChanges")}):Je instanceof Error?Je.message:l("gitView.toast.createCommitFailed"))}finally{re?.finish(),pe(null),y.pushAfter&&Re(null)}},$a=m.useMemo(()=>(g?.files??[]).filter(Zn).length,[g?.files]),sn=!!g?.mergeInProgress?.head,Wa=m.useCallback(async()=>{if(f)try{if(sn){const y=await a.continueMerge(f);y.conflict?(et(y.conflictFiles??[],"merge"),me.error(l("gitView.toast.mergeConflictsDetected"))):me.success(l("gitView.toast.mergeCompleted"))}else{const y=await a.continueRebase(f);y.conflict?(et(y.conflictFiles??[],"rebase"),me.error(l("gitView.toast.rebaseConflictsDetected"))):me.success(l("gitView.toast.rebaseStepCompleted"))}await St(!1)}catch(y){me.error(y instanceof Error?y.message:l("gitView.toast.continueOperationFailed"))}},[f,a,sn,et,St,l]),Qr=m.useCallback(async y=>{if(f)try{y==="merge"?(await a.abortMerge(f),me.success(l("gitView.toast.mergeAborted"))):(await a.abortRebase(f),me.success(l("gitView.toast.rebaseAborted"))),await St(!1)}catch(F){me.error(F instanceof Error?F.message:l("gitView.toast.abortOperationFailed"))}},[f,a,St,l]),Ka=m.useCallback(()=>{const y=(g?.files??[]).filter(Zn).map(F=>F.path);et(y,sn?"merge":"rebase")},[sn,et,g?.files]),Va=m.useMemo(()=>{const y=[];return ns.length>0&&y.push({id:"staged",title:l("gitView.changes.stagedTitle"),entries:ns,statsScope:"staged",actionSymbol:"-",actionAllLabel:l("gitView.changes.unstageAllAria"),getActionLabel:F=>l("gitView.changes.unstageFileAria",{path:F}),onActionFile:F=>{tn([F],"unstage")},onActionAll:F=>{tn(F,"unstage")},onViewDiff:F=>qn(F,!0),onRevertFile:Gn,showRevertActions:!1,accent:!0}),Un.length>0&&y.push({id:"unstaged",title:l("gitView.changes.title"),entries:Un,statsScope:"working",actionSymbol:"+",actionAllLabel:l("gitView.changes.stageAllAria"),getActionLabel:F=>l("gitView.changes.stageFileAria",{path:F}),onActionFile:F=>{tn([F],"stage")},onActionAll:F=>{tn(F,"stage")},onViewDiff:F=>qn(F,!1),onRevertFile:Gn}),y},[Gn,qn,tn,ns,l,Un]),Zr=n.jsxs(n.Fragment,{children:[Oe.context?n.jsx(sd,{context:Oe.context,onSelect:Oe.settle}):null,Oe.confirmDialog,n.jsx(nd,{candidates:st.candidates,onSelect:st.settle})]}),ei=h?n.jsx(dd,{repositories:h,selectedRepository:u??null,onSelectRepository:y=>{s&&(In.getState().clearChangesRepository(s),$(s,y))},repositoryRoot:s??void 0}):null,Jn=y=>n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[Zr,n.jsxs("header",{className:"flex h-[var(--oc-header-height,56px)] shrink-0 items-center gap-2 px-3 text-foreground",children:[t?n.jsx("button",{type:"button",className:"-ms-1 flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":l("mobile.surface.closeAria"),onClick:t,style:{touchAction:"manipulation"},children:n.jsx(G,{name:"close",className:"size-5"})}):null,n.jsxs("div",{className:"min-w-0 flex-1 px-1",children:[n.jsx("h2",{className:"typography-ui-label text-foreground",children:l("mobile.nav.changes")}),n.jsx("p",{className:"truncate typography-micro text-muted-foreground",children:g?.current||f||""})]}),ei]}),n.jsx("div",{className:"min-h-0 flex-1",children:y})]});if(!f)return Jn(n.jsx(Nt,{message:l("gitView.empty.selectSessionOrDirectory")}));if(c===!1&&L!==!0)return Jn(n.jsx(md,{root:s,rootIsGitRepo:c,resolvedIsGitRepo:L,nestedRepos:p,onRetryDiscovery:()=>{s&&T(s,{force:!0})}}));if(I&&L===null)return Jn(n.jsx(Nt,{loading:!0,message:l("gitView.loading.checkingRepository")}));if(H.type==="diff")return n.jsx(or,{path:H.path,diff:Pa,staged:H.staged,fileExists:!!Da,unavailableReason:Fe?.key===`${f}\0${H.path}`?Fe.reason:null,error:rt,onBack:()=>ae({type:"list"}),onRetry:()=>Ze(y=>y+1)});if(H.type==="turn")return n.jsx(or,{path:H.path,subtitle:l("diffView.scope.lastTurn"),diff:_a.get(H.path)??null,fileExists:Hn.some(y=>y.path===H.path),onBack:()=>ae(rs)});const Xn=l(U==="pr"?kn("session.githubIntegration.tabs.pullRequests",Ce):U==="branch"?"diffView.scope.branch":U==="commit"?"commitComparison.mode":U==="turn"?"diffView.scope.lastTurn":"mobile.nav.changes"),Yn=U==="branch"&&Ve.base?rd(Ve.base):U==="commit"?Ke?.slice(0,8):U==="pr"&&Ne?`#${Ne.number}`:null;if(H.type==="walkthrough"&&yn&&f)return n.jsx(R1,{directory:f,target:yn,subtitle:[Xn,Yn].filter(Boolean).join(" · "),revision:JSON.stringify([Kt,U==="pr"?Me.revision:0]),visible:o,onBack:()=>ae(rs)});if(kt&&Be)return n.jsx(or,{path:kt,subtitle:[Xn,Yn].filter(Boolean).join(" · "),commentOrigin:ls,diff:xn??(Be.status==="ready"?Be.diff:null),fileExists:!Me.files||Me.files.some(y=>y.path===kt),error:Me.error??(Be.status==="error"?Be.message:null),onBack:()=>ae(rs),onRetry:()=>{Me.error&&Me.refresh(),us(y=>y+1)},onExpandContextRequest:Be.status==="ready"?y=>Bt({source:Be,request:y}):void 0,pendingContextExpansion:bn,contextLoading:bn!==null&&!xn});const Ha=()=>U==="pr"&&he.diffUnavailable?n.jsx(em,{provider:he.provider,className:"h-full"}):U==="pr"&&!Ne?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 text-center",children:[n.jsx(Nt,{loading:he.loading,message:he.error??(he.loading?l(kn("session.githubPrPicker.loading.pullRequests",Ce)):l(kn("pullRequestComparison.select",Ce)))}),!he.loading&&n.jsx(ji,{mobile:!0,comparison:he})]}):U==="branch"&&!Ve.base?n.jsx(Nt,{loading:!Ve.resolved,message:Ve.resolved?l("gitView.pr.toast.baseBranchRequired"):l("diffView.branch.resolvingBase")}):U==="commit"&&!Ke?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 text-center",children:[Ae.loading&&n.jsx(G,{name:"loader-4",className:"size-5 animate-spin text-muted-foreground"}),n.jsx("p",{className:"typography-ui-label text-muted-foreground",children:Ae.loading?l("diffView.state.loadingChanges"):Ae.error??l("commitComparison.noCommits")}),Ae.error&&n.jsx(Ee,{variant:"outline",size:"lg",onClick:()=>{Ae.refresh()},children:l("diffView.actions.retry")})]}):Me.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:l("diffView.state.failedToLoadDiff")}),n.jsx("p",{className:"typography-meta text-muted-foreground",children:Me.error}),n.jsx(Ee,{variant:"outline",size:"lg",onClick:()=>{Me.refresh()},children:l("diffView.actions.retry")})]}):Xt?Xt.length===0?n.jsx(Nt,{icon:U==="branch",message:U==="pr"?l("walkthrough.blocked.emptyDiff.description"):U==="commit"?l("commitComparison.emptyDiff"):l("diffView.branch.empty",{base:Yn??""})}):n.jsx(Zi,{files:Xt,onSelect:y=>{Me.key&&ae({type:"comparison",path:y,sourceKey:Me.key})}}):n.jsx(Nt,{loading:!0,message:l("diffView.state.loadingChanges")}),Ua=()=>ts?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:l("diffView.state.failedToLoadDiff")}),n.jsx("p",{className:"typography-meta text-muted-foreground",children:ts}),n.jsx(Ee,{variant:"outline",size:"lg",onClick:()=>{is(null),Ys()},children:l("diffView.actions.retry")})]}):!Et&&ze?n.jsx(Nt,{loading:!0,message:l("diffView.state.loadingChanges")}):Hn.length===0?n.jsx(Nt,{message:l("diffView.state.noLastTurnChanges")}):n.jsx(Zi,{files:Hn,onSelect:y=>ae({type:"turn",path:y})});return n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[Zr,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:"-ms-1 flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":l("mobile.surface.closeAria"),onClick:t,style:{touchAction:"manipulation"},children:n.jsx(G,{name:"close",className:"size-5"})}):null,n.jsxs(fr,{open:se,onOpenChange:fe,children:[n.jsx(mr,{asChild:!0,children:n.jsxs(Ee,{variant:"ghost",className:Rc({size:"mobile"}),"data-mobile-comparison-trigger":!0,"aria-label":l("diffView.scope.selectorAria"),children:[n.jsx("span",{children:Xn}),n.jsx(G,{name:"arrow-down-s",className:"size-4"})]})}),n.jsx(pr,{align:"start",children:n.jsxs(Ec,{value:U,onValueChange:y=>{(y==="working"||y==="turn"||y==="branch"||y==="commit"||y==="pr")&&ce(y)},children:[n.jsx(nn,{value:"working",className:"min-h-8 items-center",children:l("mobile.nav.changes")}),n.jsx(nn,{value:"turn",className:"min-h-8 items-center",children:l("diffView.scope.lastTurn")}),yt&&n.jsx(nn,{value:"branch",className:"min-h-8 items-center",children:l("diffView.scope.branch")}),n.jsx(nn,{value:"commit",className:"min-h-8 items-center",children:l("commitComparison.mode")}),n.jsx(nn,{value:"pr",className:"min-h-8 items-center",children:l(kn("session.githubIntegration.tabs.pullRequests",Ce))})]})})]}),ei,o&&U==="branch"&&n.jsx(Qf,{mobile:!0,branches:b?.all??[],currentBranch:Ie,base:Ve.base,automatic:Ve.source!=="chosen",onSelect:y=>{Ie&&xt(f,Ie,y)},onSelectAutomatic:()=>{Ie&&_e(f,Ie)}},JSON.stringify([Q,Ie])),o&&U==="commit"&&n.jsx(Zf,{mobile:!0,commits:Ae.commits,selectedHash:Ke,loading:Ae.loading,error:Ae.error,onSelect:Ae.select,onRefresh:()=>{Ae.refresh()}},JSON.stringify([Q,Ie])),o&&U==="pr"&&n.jsxs(n.Fragment,{children:[n.jsx(ji,{mobile:!0,comparison:he},JSON.stringify([Q,Ie])),Ne&&n.jsx(Ee,{variant:"ghost",size:"sm",disabled:Me.loading,"aria-label":l("session.githubIssuePicker.actions.refresh"),onClick:()=>{Me.refresh()},children:n.jsx(G,{name:"refresh",className:"size-4"})})]}),yn&&n.jsx(Ee,{variant:"ghost",size:"icon",className:"ms-auto shrink-0",onClick:()=>ae({type:"walkthrough"}),"aria-label":l("walkthrough.action.open"),title:l("walkthrough.action.open"),style:{touchAction:"manipulation"},children:n.jsx(G,{name:"route",className:"size-5"})}),U==="working"&&ze&&(g?.files?.length??0)>0?n.jsxs(Ee,{variant:"default",className:ie("shrink-0",!yn&&"ms-auto"),disabled:Jt.submitting,onClick:()=>Gt(!0),"aria-label":l("diffView.actions.reviewAria"),style:{touchAction:"manipulation"},children:[n.jsx(G,{name:Jt.submitting?"loader-4":"search-eye",className:ie("size-4",Jt.submitting&&"animate-spin")}),l("diffView.actions.review")]}):null]}),n.jsx(Ic,{open:as,onOpenChange:Gt,projectDirectory:s||null,submitting:Jt.submitting,onConfirm:Jt.start}),U==="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(id,{currentBranch:g?.current,localBranches:Oa,remoteBranches:Ma,branchInfo:b?.branches,currentBranchAhead:g?.ahead,onCheckout:y=>{La(y)},onCreate:za,disabled:I,directory:f,switchBlockedNotice:(g?.files?.length??0)>0?l("gitView.branch.switchBlockedNotice"):null})}),n.jsx(od,{activeProfile:$t,identities:O,attention:de,triggerClassName:"max-w-[10rem] shrink [&_.git-identity-label]:hidden sm:[&_.git-identity-label]:inline",onOpen:()=>{B(d,A.map(y=>y.account))},onSelect:y=>{C(y)},isApplying:P,onConfigure:()=>E(!0),applicability:y=>{const F=qe.read?.repository.remotes.find(re=>re.name===Rt);return F?ad(y,Tc(F.fetch.displayUrl)):{applicable:!0}}}),n.jsx(ld,{syncAction:Ue.entry?.executing?je:null,remotes:Aa,onFetch:y=>{en("fetch",y)},onPull:y=>{en("pull",y)},onSync:y=>{en("sync",y)},onPublish:()=>{en("publish")},onChooseSyncTargets:()=>{en("sync",void 0,!0)},currentBranch:g?.current,hasTracking:!!g?.tracking,disabled:I||Ue.blocked,aheadCount:g?.ahead??0,behindCount:g?.behind??0,trackingRemoteName:g?.tracking?.split("/")[0],trackingBranch:g?.tracking,hasUncommittedChanges:cd(At),choosesPushDestination:x})]}),n.jsx(Df,{open:v,onOpenChange:E,directory:f}),n.jsx(ud,{className:"mx-3 mt-3",entry:Ue.entry,onRefresh:()=>{Ue.refresh()},onCancel:()=>{Ue.cancel()}}),U==="working"&&n.jsx(Of,{mergeInProgress:g?.mergeInProgress,rebaseInProgress:g?.rebaseInProgress,onContinue:Wa,onAbort:()=>Qr(sn?"merge":"rebase"),onResolveWithAI:Ka,conflictCount:$a,isLoading:je!==null||te!==null}),U==="turn"?n.jsx("div",{className:"min-h-0 flex-1",children:Ua()}):U!=="working"?n.jsx("div",{className:"min-h-0 flex-1",children:Ha()}):At.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-4 pt-4",children:n.jsx(Mf,{groups:Va,diffStats:g?.diffStats,revertingPaths:we,onRevertAll:Xr,isRevertingAll:be,headerBackgroundClassName:"bg-transparent",onVisiblePathsChange:Xe})}),n.jsx("div",{"data-keyboard-rider":"",className:"shrink-0 border-t border-edge bg-background px-4 pb-4 pt-3",children:n.jsx(Lf,{stagedCount:ns.length,commitMessage:oe,onCommitMessageChange:ve,generatedHighlights:Le,onInsertHighlights:Ba,onGenerateMessage:Fa,isGeneratingMessage:V,onCommit:y=>{Yr({pushAfter:!1,origin:y})},onCommitAndPush:y=>{Yr({pushAfter:!0,origin:y})},commitAction:te,networkOperationBlocked:Ue.blocked,gitmojiEnabled:!1,onOpenGitmojiPicker:()=>{}})})]}):n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(M1,{})}),f&&n.jsx(zf,{open:Tt,onOpenChange:Ct,conflictFiles:at,directory:f,operation:pt,onAbort:()=>{Qr(pt)},onNavigatedToChat:i}),n.jsx(Bf,{open:Ge!==null,onOpenChange:y=>{y||nt(null)},targetBranch:Ge??"",changedFileCount:g?.files?.length??0,onCommitAndSwitch:(y,F)=>I1(y,F,{targetBranch:Ge,directory:f,sourceBranch:g?.current??null,git:a,publishChooser:Oe,toast:me,t:l,refreshStatusAndBranches:St,closeDialog:()=>nt(null),performCheckout:vn}),onGenerateMessage:async()=>{if(!f)return"";const y=(g?.files??[]).map(re=>re.path).sort(),{message:F}=await fi(f,y);return F.subject?.trim()??""},onRevertAndSwitch:async()=>{const y=Ge;if(!y||!f)return;await Xr((g?.files??[]).map(re=>re.path));const F=await a.getGitStatus(f);if(!F.isClean&&(F.files?.length??0)>0){me.error(l("gitView.dirtySwitch.revertIncomplete"));return}nt(null),await vn(y)}})]})},Nt=s=>{const e=ne.c(13),{message:t,description:r,loading:o,icon:i}=s,l=o===void 0?!1:o,a=i===void 0?!1:i;let d;e[0]!==l?(d=l?n.jsx(G,{name:"loader-4",className:"size-5 animate-spin text-muted-foreground"}):null,e[0]=l,e[1]=d):d=e[1];let c;e[2]!==a?(c=a?n.jsx(G,{name:"git-branch",className:"size-6 text-muted-foreground"}):null,e[2]=a,e[3]=c):c=e[3];let u;e[4]!==t?(u=n.jsx("p",{className:"typography-ui-label font-semibold text-foreground",children:t}),e[4]=t,e[5]=u):u=e[5];let p;e[6]!==r?(p=r?n.jsx("p",{className:"typography-meta text-muted-foreground",children:r}):null,e[6]=r,e[7]=p):p=e[7];let h;return e[8]!==d||e[9]!==c||e[10]!==u||e[11]!==p?(h=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,c,u,p]})}),e[8]=d,e[9]=c,e[10]=u,e[11]=p,e[12]=h):h=e[12],h},M1=()=>{const s=ne.c(7),{t:e}=ge();let t;s[0]!==e?(t=e("mobile.changes.cleanDescription"),s[0]=e,s[1]=t):t=s[1];const r=Ff(t);let o;s[2]!==e?(o=e("gitView.empty.cleanTitle"),s[2]=e,s[3]=o):o=s[3];let i;return s[4]!==r||s[5]!==o?(i=n.jsx(Nt,{icon:!0,message:o,description:r}),s[4]=r,s[5]=o,s[6]=i):i=s[6],i},or=s=>{const e=ne.c(75),{path:t,subtitle:r,diff:o,staged:i,fileExists:l,unavailableReason:a,error:d,onBack:c,onRetry:u,onExpandContextRequest:p,pendingContextExpansion:h,contextLoading:f,commentOrigin:g}=s,x=i===void 0?!1:i,b=a===void 0?null:a,w=d===void 0?null:d,{t:v}=ge();let E;e[0]!==t?(E=_c(t)||"text",e[0]=t,e[1]=E):E=e[1];const P=E,_=He(L1),A=He(z1);let k;e[2]!==_||e[3]!==v?(k=v(_?"diffView.whitespace.hidden":"diffView.whitespace.shown"),e[2]=_,e[3]=v,e[4]=k):k=e[4];const S=k;let N;e[5]!==g||e[6]!==t?(N={fileLabel:t,origin:g},e[5]=g,e[6]=t,e[7]=N):N=e[7];const M=rm(N);let B;e[8]!==v?(B=v("header.actions.backAria"),e[8]=v,e[9]=B):B=e[9];let O;e[10]===Symbol.for("react.memo_cache_sentinel")?(O=n.jsx(G,{name:"arrow-left",className:"size-5"}),e[10]=O):O=e[10];let C;e[11]!==c||e[12]!==B?(C=n.jsx("button",{type:"button",className:"flex size-9 shrink-0 items-center justify-center rounded-lg text-muted-foreground hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":B,onClick:c,children:O}),e[11]=c,e[12]=B,e[13]=C):C=e[13];let L;e[14]!==t?(L=n.jsx("h2",{className:"typography-ui-header",children:n.jsx(Ho,{path:t})}),e[14]=t,e[15]=L):L=e[15];let I;e[16]!==r?(I=r&&n.jsx("p",{className:"truncate typography-meta text-muted-foreground",children:r}),e[16]=r,e[17]=I):I=e[17];let j;e[18]!==L||e[19]!==I?(j=n.jsxs("div",{className:"min-w-0 flex-1 px-2",children:[L,I]}),e[18]=L,e[19]=I,e[20]=j):j=e[20];const R=_?"text-foreground":"text-muted-foreground";let T;e[21]!==R?(T=ie("flex size-9 shrink-0 items-center justify-center rounded-lg hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",R),e[21]=R,e[22]=T):T=e[22];let $;e[23]!==v?($=v("diffView.actions.hideWhitespace"),e[23]=v,e[24]=$):$=e[24];let W;e[25]!==_||e[26]!==A?(W=()=>A(!_),e[25]=_,e[26]=A,e[27]=W):W=e[27];let q;e[28]!==_?(q=n.jsx(C1,{hidden:_,className:"size-5"}),e[28]=_,e[29]=q):q=e[29];let D;e[30]!==_||e[31]!==T||e[32]!==$||e[33]!==W||e[34]!==q||e[35]!==S?(D=n.jsx("button",{type:"button",className:T,"aria-label":$,"aria-pressed":_,title:S,onClick:W,children:q}),e[30]=_,e[31]=T,e[32]=$,e[33]=W,e[34]=q,e[35]=S,e[36]=D):D=e[36];const z=M.isOpen?"text-foreground":"text-muted-foreground";let J;e[37]!==z?(J=ie("flex size-9 shrink-0 items-center justify-center rounded-lg hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",z),e[37]=z,e[38]=J):J=e[38];let ee;e[39]!==v?(ee=v("inlineComment.actions.commentOnFile"),e[39]=v,e[40]=ee):ee=e[40];const Q=M.isOpen;let Y;e[41]!==v?(Y=v("inlineComment.actions.commentOnFile"),e[41]=v,e[42]=Y):Y=e[42];let K;e[43]===Symbol.for("react.memo_cache_sentinel")?(K=n.jsx(G,{name:"chat-1",className:"size-5"}),e[43]=K):K=e[43];let Z;e[44]!==J||e[45]!==ee||e[46]!==Y||e[47]!==M.isOpen||e[48]!==M.toggle?(Z=n.jsx("button",{type:"button",className:J,"aria-label":ee,"aria-pressed":Q,title:Y,onClick:M.toggle,children:K}),e[44]=J,e[45]=ee,e[46]=Y,e[47]=M.isOpen,e[48]=M.toggle,e[49]=Z):Z=e[49];let U;e[50]!==j||e[51]!==D||e[52]!==Z||e[53]!==C?(U=n.jsxs("header",{className:"flex h-[var(--oc-header-height,56px)] shrink-0 items-center gap-3 border-b border-edge px-3 text-foreground",children:[C,j,D,Z]}),e[50]=j,e[51]=D,e[52]=Z,e[53]=C,e[54]=U):U=e[54];let H;e[55]!==g||e[56]!==f||e[57]!==o||e[58]!==w||e[59]!==l||e[60]!==_||e[61]!==P||e[62]!==p||e[63]!==u||e[64]!==t||e[65]!==h||e[66]!==x||e[67]!==v||e[68]!==b?(H=n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:l?b==="nested_repository"?n.jsx(Nt,{icon:!0,message:v("diffView.unavailable.nestedRepositoryTitle"),description:v("diffView.unavailable.nestedRepositoryDescription")}):b==="untracked_directory"?n.jsx(Nt,{icon:!0,message:v("diffView.unavailable.untrackedDirectoryTitle"),description:v("diffView.unavailable.untrackedDirectoryDescription")}):w?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:v("mobile.changes.diffDetail.loadFailed")}),n.jsx("p",{className:"typography-meta text-muted-foreground",children:w}),n.jsx(Ee,{type:"button",size:"sm",variant:"outline",onClick:()=>u?.(),children:v("diffView.actions.retry")})]})}):o?o.submodule?n.jsx("div",{className:"p-3",children:n.jsx(Af,{state:o.submodule,staged:x})}):o.isBinary?n.jsx(Nt,{icon:!0,message:v("diffView.binary.unavailable")}):Ac(t)&&!o.fileDiff?n.jsx(Nt,{icon:!0,message:v("mobile.changes.diffDetail.imageUnavailable")}):n.jsx(Ut,{outerClassName:"h-full",className:"p-3",useScrollShadow:!0,disableHorizontal:!0,"data-diff-virtual-root":!0,"data-diff-virtual-content":!0,children:n.jsx(sm,{original:o.original,modified:o.modified,fileDiff:o.fileDiff,language:P,fileName:t,commentOrigin:g,renderSideBySide:!1,wrapLines:!0,hideWhitespace:_,layout:"inline",onExpandContextRequest:p,pendingContextExpansion:h,contextLoading:f})}):n.jsx(Nt,{loading:!0,message:v("diffView.state.loadingDiff")}):n.jsx(Nt,{icon:!0,message:v("mobile.changes.diffDetail.missingTitle"),description:v("mobile.changes.diffDetail.missingDescription")})}),e[55]=g,e[56]=f,e[57]=o,e[58]=w,e[59]=l,e[60]=_,e[61]=P,e[62]=p,e[63]=u,e[64]=t,e[65]=h,e[66]=x,e[67]=v,e[68]=b,e[69]=H):H=e[69];let se;return e[70]!==U||e[71]!==H||e[72]!==M.cards||e[73]!==M.editor?(se=n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[U,M.cards,M.editor,H]}),e[70]=U,e[71]=H,e[72]=M.cards,e[73]=M.editor,e[74]=se):se=e[74],se},Zi=s=>{const e=ne.c(12),{files:t,onSelect:r}=s,{t:o}=ge();let i;e[0]!==o?(i=o("gitView.changes.changedFilesAria"),e[0]=o,e[1]=i):i=e[1];let l;if(e[2]!==t||e[3]!==r||e[4]!==o){let d;e[6]!==r||e[7]!==o?(d=c=>{const u=c.status==="A"?o("diffView.change.new"):c.status==="D"?o("diffView.change.deleted"):c.status==="R"?o("diffView.change.renamed"):c.status==="C"?o("diffView.change.copied"):o("diffView.change.modified"),p=c.status==="A"?"var(--status-success)":c.status==="D"?"var(--status-error)":c.status==="R"||c.status==="C"?"var(--status-info)":"var(--status-warning)";return n.jsx("li",{children:n.jsxs(Ee,{variant:"ghost",size:"lg",className:"w-full justify-start gap-2.5 text-start normal-case",onClick:()=>r(c.path),children:[n.jsx("span",{className:"w-4 shrink-0 text-center typography-meta font-semibold uppercase",style:{color:p},"aria-label":u,children:c.status}),n.jsx(Bo,{filePath:c.path,className:"size-4 shrink-0"}),n.jsx(Ho,{path:c.path,className:"flex-1 typography-ui-label"}),(c.insertions>0||c.deletions>0)&&n.jsxs("span",{className:"shrink-0 typography-meta text-muted-foreground",children:["+",c.insertions," -",c.deletions]}),n.jsx(G,{name:"arrow-right-s",className:"size-4 shrink-0 text-muted-foreground"})]})},c.path)},e[6]=r,e[7]=o,e[8]=d):d=e[8],l=t.map(d),e[2]=t,e[3]=r,e[4]=o,e[5]=l}else l=e[5];let a;return e[9]!==i||e[10]!==l?(a=n.jsx(Ut,{outerClassName:"h-full",className:"px-3 py-2",useScrollShadow:!0,disableHorizontal:!0,children:n.jsx("ul",{"aria-label":i,className:"flex flex-col gap-1",children:l})}),e[9]=i,e[10]=l,e[11]=a):a=e[11],a};function L1(s){return s.diffHideWhitespace}function z1(s){return s.setDiffHideWhitespace}const B1=m.lazy(()=>dn(()=>import("./FilesView-CAXuJLle.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,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])).then(s=>({default:s.FilesView}))),Qt=s=>pn(s)??"",cn=s=>{const e=Qt(s);return!e||e==="/"?e||"/":e.split("/").filter(Boolean).at(-1)??e},F1=s=>{const e=Qt(s);if(!e||e==="/")return null;const t=e.lastIndexOf("/");return t<=0?e.startsWith("/")?"/":null:e.slice(0,t)},$1=(s,e)=>{const t=Qt(s),r=Qt(e);return!r||t===r?cn(t):t.startsWith(`${r}/`)?t.slice(r.length+1):t},W1=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 r of e){if(t<1024||r===e[e.length-1])return`${t.toFixed(t>=10?0:1)} ${r}`;t/=1024}return""},K1=s=>{const e=ne.c(5),{onClose:t,visible:r}=s,o=r===void 0?!0:r,i=Mo(),l=Qt(Lo(i,Ir()));if(i?.kind==="preparing"){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Wo,{}),e[0]=d):d=e[0],d}let a;return e[1]!==t||e[2]!==l||e[3]!==o?(a=n.jsx(V1,{root:l,onClose:t,visible:o},l),e[1]=t,e[2]=l,e[3]=o,e[4]=a):a=e[4],a},V1=({root:s,onClose:e,visible:t})=>{const{t:r}=ge(),{files:o}=Cr(),i=ul(),l=dl(K=>K.setSelectedPath),[a,d]=m.useState(()=>({type:"browser",directory:s})),[c,u]=m.useState([]),[p,h]=m.useState(!1),[f,g]=m.useState(null),[x,b]=m.useState(""),[w,v]=m.useState([]),[E,P]=m.useState(!1),_=m.useRef(0),A=a.type==="browser"?a.directory:a.returnDirectory,k=m.useRef(A);k.current=A;const S=m.useCallback(async(K,Z)=>{if(!K)return;const U=!i,H=_.current+1;_.current=H,h(!0),Z?.background||g(null);try{const se=await o.listDirectory(K,{respectGitignore:U});if(_.current!==H)return;g(null),u(se.entries.slice().sort((fe,ce)=>fe.isDirectory!==ce.isDirectory?fe.isDirectory?-1:1:fe.name.localeCompare(ce.name)))}catch(se){if(_.current!==H)return;if(Z?.background){console.error("Failed to reload mobile directory:",se);return}u([]),g(se instanceof Error?se.message:r("mobile.files.error.listFailed"))}finally{_.current===H&&h(!1)}},[o,i,r]);m.useEffect(()=>{a.type==="browser"&&S(a.directory)},[S,a]);const N=m.useRef(a);N.current=a;const M=m.useRef(c);M.current=c;const B=m.useCallback(({directories:K})=>{const Z=N.current;Z.type==="browser"&&(K&&!K.some(U=>Qt(U)===Qt(Z.directory))||M.current.length>pd||S(Z.directory,{background:!0}))},[S]);hd({root:s,active:t,whileInactive:"hold",onChanges:B});const O=m.useCallback(async K=>{Qt(K)===Qt(k.current)&&await S(k.current)},[S]),{canUpload:C,uploadingDirectory:L,pickFiles:I,uploadElements:j}=gd({root:s,refreshDirectory:O}),R=L!==null;m.useEffect(()=>{if(a.type!=="browser")return;const K=x.trim();if(!K){v([]),P(!1);return}let Z=!1;const U=window.setTimeout(()=>{P(!0),o.search({directory:a.directory,query:K,maxResults:40}).then(H=>{Z||v(H)}).catch(()=>{Z||v([])}).finally(()=>{Z||P(!1)})},250);return()=>{Z=!0,window.clearTimeout(U)}},[o,x,a]);const T=K=>{b(""),d({type:"browser",directory:K})},$=K=>{l(s,K),d({type:"file",path:K,returnDirectory:A||s})},W=He(K=>K.pendingFileFocusPath),q=He(K=>K.pendingFileNavigation);if(m.useEffect(()=>{const K=Qt(q?.path??W??"");!K||!s||(l(s,K,{allowOutsideRoot:!0}),d(Z=>({type:"file",path:K,returnDirectory:Z.type==="file"?Z.returnDirectory:s})),W&&He.getState().setPendingFileFocusPath(null))},[W,q,s,l]),!s)return n.jsx(un,{message:r("mobile.files.empty.noDirectory")});if(a.type==="file")return n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[n.jsxs("header",{className:"flex h-[var(--oc-header-height,56px)] shrink-0 items-center gap-2 border-b border-edge px-3 text-foreground",children:[n.jsx("button",{type:"button",className:"-ms-1 flex size-10 shrink-0 items-center justify-center rounded-lg text-muted-foreground hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":r("header.actions.backAria"),onClick:()=>d({type:"browser",directory:a.returnDirectory}),style:{touchAction:"manipulation"},children:n.jsx(yi,{className:"size-5"})}),n.jsx("div",{className:"min-w-0 flex-1",children:n.jsx("h2",{className:"truncate typography-ui-header text-foreground",children:cn(a.path)})})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:n.jsx(ft,{children:n.jsx(m.Suspense,{fallback:n.jsx(un,{loading:!0,message:r("filesView.state.loading")}),children:n.jsx(B1,{mode:"editor-only"})})})})]});const D=a.directory===s?r("mobile.files.rootDirectory"):cn(a.directory),z=x.trim()?w:[],J=F1(a.directory),ee=a.directory!==s&&J!==null&&(J===s||J.startsWith(`${s}/`)),Q=ee&&!x.trim(),Y=ee?J:null;return n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[j,n.jsxs("header",{className:"flex h-[var(--oc-header-height,56px)] shrink-0 items-center gap-2 px-3 text-foreground",children:[e?n.jsx("button",{type:"button",className:"-ms-1 flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":r("mobile.surface.closeAria"),onClick:e,style:{touchAction:"manipulation"},children:n.jsx(ff,{className:"size-5"})}):null,Q&&Y?n.jsx("button",{type:"button",className:"flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":r("mobile.files.backToParentAria",{name:cn(Y)}),onClick:()=>T(Y),style:{touchAction:"manipulation"},children:n.jsx(yi,{className:"size-5"})}):null,n.jsx("div",{className:"min-w-0 flex-1 px-1",children:n.jsx("h2",{className:"truncate typography-ui-label text-foreground",children:D})}),n.jsx("button",{type:"button",className:"flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":r("mobile.files.refreshAria"),onClick:()=>{S(a.directory)},style:{touchAction:"manipulation"},children:n.jsx(mf,{className:ie("size-5",p&&"animate-spin")})}),C?n.jsx("button",{type:"button",className:"flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50","aria-label":r("sidebarFilesTree.actions.uploadFilesTitle"),onClick:()=>I(a.directory),disabled:R,style:{touchAction:"manipulation"},children:n.jsx(G,{name:R?"loader-4":"upload-2",className:ie("size-5",R&&"animate-spin")})}):null]}),n.jsx("div",{className:"shrink-0 px-4 pb-2 pt-1",children:n.jsxs("div",{className:"relative",children:[n.jsx(pf,{className:"pointer-events-none absolute inset-s-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),n.jsx(Po,{value:x,onChange:K=>b(K.target.value),placeholder:r("mobile.files.search.placeholder"),className:"h-11 ps-9"})]})}),n.jsx(Ut,{outerClassName:"min-h-0 flex-1",className:"px-4 pb-3",useScrollShadow:!0,disableHorizontal:!0,children:f?n.jsx(un,{message:f}):x.trim()?n.jsx(H1,{root:s,results:z,isSearching:E,onOpenFile:$}):n.jsxs("div",{className:"overflow-hidden rounded-2xl border border-edge bg-[var(--surface-elevated)]",children:[c.length===0&&!p?n.jsx("div",{className:"px-4 py-8 text-center typography-ui-label text-muted-foreground",children:r("mobile.files.empty.directory")}):null,c.map(K=>n.jsx(Ea,{name:K.name,path:K.path,directory:K.isDirectory,meta:K.isDirectory?void 0:W1(K.size),onClick:()=>K.isDirectory?T(K.path):$(K.path)},K.path))]})})]})},Ea=s=>{const e=ne.c(16),{name:t,path:r,directory:o,meta:i,onClick:l}=s;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={touchAction:"manipulation"},e[0]=a):a=e[0];let d;e[1]!==o||e[2]!==r?(d=o?n.jsx(bf,{className:"size-5 shrink-0 text-primary/80"}):n.jsx(Bo,{filePath:r,className:"size-5 shrink-0"}),e[1]=o,e[2]=r,e[3]=d):d=e[3];let c;e[4]!==t?(c=n.jsx("span",{className:"block min-w-0 flex-1 truncate typography-ui-label text-foreground",children:t}),e[4]=t,e[5]=c):c=e[5];let u;e[6]!==i?(u=i?n.jsx("span",{className:"shrink-0 typography-micro text-muted-foreground",children:i}):null,e[6]=i,e[7]=u):u=e[7];let p;e[8]!==o?(p=o?n.jsx(xf,{className:"size-4 shrink-0 text-muted-foreground"}):null,e[8]=o,e[9]=p):p=e[9];let h;return e[10]!==l||e[11]!==d||e[12]!==c||e[13]!==u||e[14]!==p?(h=n.jsxs("button",{type:"button",className:"flex min-h-14 w-full items-center gap-3 border-b border-edge px-3 py-2.5 text-start transition-colors last:border-b-0 hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",onClick:l,style:a,children:[d,c,u,p]}),e[10]=l,e[11]=d,e[12]=c,e[13]=u,e[14]=p,e[15]=h):h=e[15],h},H1=s=>{const e=ne.c(17),{root:t,results:r,isSearching:o,onOpenFile:i}=s,{t:l}=ge();if(o){let c;e[0]!==l?(c=l("common.loading"),e[0]=l,e[1]=c):c=e[1];let u;return e[2]!==c?(u=n.jsx(un,{loading:!0,message:c}),e[2]=c,e[3]=u):u=e[3],u}if(r.length===0){let c;e[4]!==l?(c=l("mobile.files.search.empty"),e[4]=l,e[5]=c):c=e[5];let u;return e[6]!==c?(u=n.jsx(un,{message:c}),e[6]=c,e[7]=u):u=e[7],u}let a;if(e[8]!==i||e[9]!==r||e[10]!==t){let c;e[12]!==i||e[13]!==t?(c=u=>n.jsx(Ea,{name:cn(u.path),path:u.path,directory:!1,meta:$1(u.path,t),onClick:()=>i(u.path)},u.path),e[12]=i,e[13]=t,e[14]=c):c=e[14],a=r.map(c),e[8]=i,e[9]=r,e[10]=t,e[11]=a}else a=e[11];let d;return e[15]!==a?(d=n.jsx("div",{className:"overflow-hidden rounded-2xl border border-edge bg-[var(--surface-elevated)]",children:a}),e[15]=a,e[16]=d):d=e[16],d},un=s=>{const e=ne.c(7),{message:t,loading:r}=s,o=r===void 0?!1:r;let i;e[0]!==o?(i=o?n.jsx(hf,{className:"size-5 animate-spin text-muted-foreground"}):n.jsx(gf,{className:"size-6 text-muted-foreground"}),e[0]=o,e[1]=i):i=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 a;return e[4]!==i||e[5]!==l?(a=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:[i,l]})}),e[4]=i,e[5]=l,e[6]=a):a=e[6],a},U1=s=>{const e=ne.c(21),{visible:t,onLeave:r,sectionsDialogOpen:o,onSectionsDialogOpenChange:i}=s,{t:l}=ge(),a=ot(q1),d=Ir()??null,c=Lc(),[u,p]=m.useState(1);let h,f;e[0]!==t?(h=()=>{t&&p(G1)},f=[t],e[0]=t,e[1]=h,e[2]=f):(h=e[1],f=e[2]),m.useEffect(h,f);const g=!c.allSectionsHidden&&u===0;let x;e[3]!==d||e[4]!==c||e[5]!==r||e[6]!==a||e[7]!==t?(x=t&&!c.allSectionsHidden?n.jsx(zc.Provider,{value:r,children:n.jsx(Bc.Provider,{value:!0,children:n.jsx(Fc,{onChange:p,children:n.jsx(Ut,{useScrollShadow:!0,scrollShadowSize:24,outerClassName:"min-h-0 flex-1",className:"px-3 pb-4 pt-2",disableHorizontal:!0,children:n.jsx($c,{sessionId:a,directory:d,repositoryEnabled:!kr(d),layout:c})})})})}):null,e[3]=d,e[4]=c,e[5]=r,e[6]=a,e[7]=t,e[8]=x):x=e[8];let b;e[9]!==c.allSectionsHidden||e[10]!==i||e[11]!==g||e[12]!==l?(b=c.allSectionsHidden||g?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:c.allSectionsHidden?l("chat.workStatus.sections.allHidden"):l("chat.workStatus.mobileEmpty")}),c.allSectionsHidden?n.jsx(Ee,{variant:"link",size:"sm",onClick:()=>i(!0),className:"mt-2 normal-case text-muted-foreground hover:text-foreground",children:l("chat.workStatus.sections.open")}):null]}):null,e[9]=c.allSectionsHidden,e[10]=i,e[11]=g,e[12]=l,e[13]=b):b=e[13];let w;e[14]!==i||e[15]!==o?(w=n.jsx(Wc,{open:o,onOpenChange:i}),e[14]=i,e[15]=o,e[16]=w):w=e[16];let v;return e[17]!==x||e[18]!==b||e[19]!==w?(v=n.jsxs("div",{className:"relative flex h-full min-h-0 flex-col",children:[x,b,w]}),e[17]=x,e[18]=b,e[19]=w,e[20]=v):v=e[20],v};function q1(s){return s.currentSessionId}function G1(s){return Math.max(s,1)}const eo="mobile-surface-root",J1=16,to=320,X1="cubic-bezier(0.22, 1, 0.36, 1)",Y1=({open:s,onClose:e,tab:t,onTabChange:r,pendingChangesDiff:o,onOpenPlan:i,variant:l="drawer"})=>{const{t:a,direction:d}=ge(),c=m.useRef(null),u=m.useRef(null),[p,h]=m.useState(!1),[f,g]=m.useState(s),x=m.useRef(e);m.useEffect(()=>{x.current=e},[e]);const b=He(I=>I.mobileWorkspaceTabOrder),w=He(I=>I.mobileWorkspaceHiddenTabs),v=He(I=>I.setMobileWorkspaceTabOrder),[E,P]=m.useState(!1),_=m.useRef(t);m.useEffect(()=>{_.current=t},[t]);const A=()=>x.current();Gr(u,{enabled:l==="drawer"&&s,...d==="rtl"?{onRightEdgeSwipe:A}:{onLeftEdgeSwipe:A}});const[k,S]=m.useState(()=>new Set);if(m.useEffect(()=>{s&&S(I=>{if(I.has(t))return I;const j=new Set(I);return j.add(t),j})},[s,t]),typeof document<"u"&&!c.current){let I=document.getElementById(eo);I||(I=document.createElement("div"),I.id=eo,document.body.appendChild(I)),c.current=I}if(m.useEffect(()=>{if(s){g(!0);const j=window.setTimeout(()=>h(!0),J1);return()=>window.clearTimeout(j)}h(!1);const I=window.setTimeout(()=>g(!1),to+40);return()=>window.clearTimeout(I)},[s]),m.useEffect(()=>{if(!s)return;const I=document.body.style.overflow;l==="drawer"&&(document.body.style.overflow="hidden");const j=R=>{R.key!=="Escape"||_.current==="terminal"||Vc(R.target)||Rr(R)||x.current()};return document.addEventListener("keydown",j),()=>{l==="drawer"&&(document.body.style.overflow=I),document.removeEventListener("keydown",j)}},[s,l]),l==="drawer"&&!c.current)return null;const N={status:{id:"status",label:a("chat.workStatus.ariaLabel"),icon:n.jsx(G,{name:"list-indefinite",className:"h-3.5 w-3.5"})},changes:{id:"changes",label:a("mobile.menu.git"),icon:n.jsx(G,{name:"git-branch",className:"h-3.5 w-3.5"})},files:{id:"files",label:a("mobile.menu.files"),icon:n.jsx(G,{name:"file-text",className:"h-3.5 w-3.5"})},terminal:{id:"terminal",label:a("mobile.menu.terminal"),icon:n.jsx(G,{name:"terminal",className:"h-3.5 w-3.5"})},notes:{id:"notes",label:a("contextRail.surface.notes"),icon:n.jsx(G,{name:"sticky-note",className:"h-3.5 w-3.5"})}},M=fl(b,w,t),B=M.map(I=>N[I]),O=B.length===1?B[0]:null,C=(I,j)=>{const R=ml(b),T=R.findIndex(W=>W===I),$=R.findIndex(W=>W===j);T<0||$<0||v(af(R,T,$))},L=n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex h-[var(--oc-header-height,56px)] shrink-0 items-center gap-2 px-3",children:[n.jsx("div",{className:"flex h-9 min-w-0 flex-1 items-center",children:O?n.jsxs("h2",{className:"flex min-w-0 items-center gap-2 px-1 typography-ui-header font-semibold text-foreground",children:[n.jsx("span",{className:"flex shrink-0 text-muted-foreground",children:O.icon}),n.jsx("span",{className:"truncate",children:O.label})]}):f?n.jsx(Kc,{items:B,activeId:t,onSelect:I=>{const j=M.find(R=>R===I);j&&r(j)},onReorder:C,layoutMode:"fit",variant:"active-pill",nonCompositedIndicator:!0,inactiveTabsIconOnly:B.length>3,className:"h-full"}):null}),t==="status"?n.jsx("button",{type:"button",className:"flex size-10 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":a("chat.workStatus.sections.open"),onClick:()=>P(!0),style:{touchAction:"manipulation"},children:n.jsx(G,{name:"equalizer-2",className:"size-5"})}):null,n.jsx("button",{type:"button",className:"-me-1 flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":a("mobile.surface.closeAria"),onClick:e,style:{touchAction:"manipulation"},children:n.jsx(G,{name:"close",className:"size-5"})})]}),n.jsxs("div",{className:"min-h-0 flex-1 overflow-hidden",children:[k.has("status")?n.jsx("div",{className:ie("h-full",t!=="status"&&"hidden"),children:n.jsx(ft,{children:n.jsx(U1,{visible:s&&t==="status",onLeave:e,sectionsDialogOpen:E,onSectionsDialogOpenChange:P})})}):null,k.has("changes")?n.jsx("div",{className:ie("h-full",t!=="changes"&&"hidden"),children:n.jsx(ft,{children:n.jsx(D1,{visible:s&&t==="changes",initialDiff:o,onNavigatedToChat:e})})},o?`changes:${o.path}:${o.staged}`:"changes"):null,k.has("files")?n.jsx("div",{className:ie("h-full",t!=="files"&&"hidden"),children:n.jsx(ft,{children:n.jsx(K1,{visible:s&&t==="files"})})}):null,k.has("terminal")?n.jsx("div",{className:ie("h-full",t!=="terminal"&&"hidden"),children:n.jsx(ft,{children:n.jsx(bd,{visible:s&&t==="terminal"})})}):null,k.has("notes")?n.jsx("div",{className:ie("h-full",t!=="notes"&&"hidden"),children:n.jsx(ft,{children:n.jsx(xd,{visible:s&&t==="notes",onActionComplete:e,onOpenPlan:i})})}):null]})]});return l==="panel"?n.jsx("div",{className:"flex h-full min-h-0 flex-col bg-background text-foreground",children:L}):Ls.createPortal(n.jsx("section",{ref:u,role:"dialog","aria-modal":"true","aria-label":a("mobile.header.openWorkspaceAria"),"aria-hidden":!s,className:"oc-keyboard-inset-surface oc-bottom-safe-surface fixed inset-0 z-50 flex flex-col bg-background text-foreground",style:{paddingTop:"var(--oc-safe-area-top, 0px)",transform:p?"none":d==="rtl"?"translateX(-100%)":"translateX(100%)",transition:`transform ${to}ms ${X1}`,visibility:f?"visible":"hidden",pointerEvents:s?"auto":"none"},children:L}),c.current)};function Q1(s){const e=ne.c(4),t=2500,{uiFont:r}=Hc(),[o,i]=m.useState(!1);let l,a;return e[0]!==t||e[1]!==r?(l=()=>{let d=!1;const c=()=>{d||i(!0)},u=()=>{requestAnimationFrame(()=>requestAnimationFrame(c))},p=Promise.all([Uc(r).catch(ng),document.fonts?.ready?.then(sg).catch(tg)??Promise.resolve(),im.catch(eg)]).then(Z1),h=new Promise(f=>{window.setTimeout(f,t)});return Promise.race([p,h]).then(u),()=>{d=!0}},a=[r,t],e[0]=t,e[1]=r,e[2]=l,e[3]=a):(l=e[2],a=e[3]),m.useEffect(l,a),o}function Z1(){}function eg(){}function tg(){}function sg(){}function ng(){}const rg=_r({projectId:Fs().trim().min(1).optional(),text:Fs().optional()}),ig=_r({request:rg.nullish()}),Ia=Ko("ShortcutRequests"),og=async()=>{const s=ig.safeParse(await Ia.takePending());return s.success?s.data.request??null:null},ag=s=>{if(jr()!=="ios")return()=>{};let e=!1,t=null;const r=()=>{og().then(o=>{o&&s(o)}).catch(()=>{})};return Ia.addListener("pending",r).then(o=>{if(e){o.remove();return}t=o}).catch(()=>{}),r(),()=>{e=!0,t?.remove()}},lg="openchamber",cg=s=>s.replace(/^\/+|\/+$/g,""),ug=s=>{const e=cg(s.pathname).split("/").filter(Boolean);return s.host?[s.host,...e]:e};function dg(s){if(typeof s!="string"||s.length===0)return null;let e;try{e=new URL(s)}catch{return null}if(e.protocol!==`${lg}:`)return null;const t=ug(e),r=(t[0]??"").toLowerCase(),o=t.slice(1),i=e.searchParams;switch(r){case"session":{const l=o[0]||i.get("id")||"";if(!l)return null;const a=i.get("message")?.trim()??"";return{type:"session",sessionId:l,directory:i.get("dir")??void 0,...qc(a)?{messageId:a}:{}}}case"new":case"new-session":return{type:"new-session",directory:i.get("dir")??void 0,projectId:i.get("project")??void 0,agent:i.get("agent")??void 0,model:i.get("model")??void 0};case"sessions":{const l=i.get("filter");return{type:"sessions",filter:l==="attention"||l==="recent"||l==="all"?l:void 0}}case"status":return{type:"status"};case"settings":return{type:"settings",section:o[0]||i.get("section")||void 0};case"changes":return{type:"changes",path:o.join("/")||i.get("path")||void 0,staged:i.get("staged")==="true"};case"view":{const l=(o[0]||"").toLowerCase();return l==="changes"?{type:"changes"}:l==="files"||l==="mcp"||l==="instances"||l==="update"?{type:"view",target:l}:null}default:return null}}let Dt={},Ta=!1,ln=null;const fg=s=>{const e=ot.getState(),t=s.projectId?Lt.getState().projects.find(o=>o.id===s.projectId)??null:null;e.openNewSessionDraft(t?{selectedProjectId:t.id}:void 0);const r=s.text?.trim();if(r){if(s.projectId&&!t){mi.getState().setPendingInputText(r,"append");return}mi.getState().requestDraftSubmit(ot.getState().newSessionDraft.draftId,r)}},mg=s=>{switch(s.type){case"shortcut-new-session":return fg(s),!0;case"session":return Gc(s.sessionId,{directory:s.directory??null,messageId:s.messageId??null}),!0;case"new-session":{const e=ot.getState();return e.openNewSessionDraft(),(s.directory||s.projectId)&&e.setNewSessionDraftTarget({directoryOverride:s.directory??null,projectId:s.projectId??null,selectedProjectId:s.projectId??null}),!0}case"sessions":return Dt.openSessions?(Dt.openSessions(s.filter),!0):!1;case"status":return Dt.openSessions?(Dt.openSessions(),!0):!1;case"view":return Dt.openView?(Dt.openView(s.target),!0):!1;case"changes":return Dt.openChanges?(Dt.openChanges({path:s.path,staged:s.staged}),!0):!1;case"settings":return Dt.openSettings?(Dt.openSettings(s.section),!0):!1}},Jr=()=>{if(!Ta||!ln)return;const s=ln;ln=null,mg(s)||(ln=s)},wr=s=>{ln=s,Jr()},so=s=>{const e=dg(s);e&&wr(e)},pg=s=>{Ta=s,Jr()},hg=s=>{const e=ne.c(3);let t,r;e[0]!==s?(t=()=>(Dt=s,Jr(),()=>{Dt===s&&(Dt={})}),r=[s],e[0]=s,e[1]=t,e[2]=r):(t=e[1],r=e[2]),m.useEffect(t,r)},gg=s=>{const{ready:e}=s;m.useEffect(()=>{pg(e)},[e]),m.useEffect(()=>{if(!ct())return;let t=!1;const r=[];return dn(()=>import("./vendor-capacitor-app-BrDJj9I_.js"),__vite__mapDeps([216,4,108])).then(async({App:o})=>{if(t)return;const i=await o.addListener("appUrlOpen",l=>{so(l?.url)});if(t){i.remove();return}r.push(()=>{i.remove()})}).catch(()=>{}),r.push(ag(o=>{wr({type:"shortcut-new-session",projectId:o.projectId,text:o.text})})),dn(()=>import("./vendor-capacitor-push-notifications-KNe1zSBF.js"),__vite__mapDeps([217,108])).then(async({PushNotifications:o})=>{if(t)return;const i=await o.addListener("pushNotificationActionPerformed",l=>{const a=l?.notification?.data,d=typeof a?.url=="string"?a.url:typeof a?.deeplink=="string"?a.deeplink:void 0;if(d){so(d);return}const c=typeof a?.sessionId=="string"?a.sessionId:void 0;c&&wr({type:"session",sessionId:c})});if(t){i.remove();return}r.push(()=>{i.remove()})}).catch(()=>{}),()=>{t=!0,r.forEach(o=>o())}},[])},bg=()=>{if(typeof window>"u")return;const s=window.__OPENCHAMBER_APNS_ENV__;if(s==="development")return"sandbox";if(s==="production")return"production"},no=/^[A-Za-z0-9+/]{43}=$/,xg=Ko("PushKey"),yg=async()=>{const s=window.__OPENCHAMBER_PUSH_KEY__;if(s&&no.test(s))return s;const e=await xg.get().then(t=>t.key).catch(()=>{});return e&&no.test(e)?e:void 0},vg=()=>{if(typeof window>"u")return!1;const e=window.Capacitor?.getPlatform?.();return e==="ios"||e==="android"},wg=s=>{const{enabled:e}=s,t=He(o=>o.nativeNotificationsEnabled),r=m.useRef(null);m.useEffect(()=>{if(!e||!t||!vg())return;let o=!1;const i=[];return dn(()=>import("./vendor-capacitor-push-notifications-KNe1zSBF.js"),__vite__mapDeps([217,108])).then(async({PushNotifications:l})=>{if(o)return;let a=await l.checkPermissions().catch(()=>null);if(a?.receive!=="granted"&&(a=await l.requestPermissions().catch(()=>null)),a?.receive!=="granted")return;const d=await l.addListener("registration",u=>{r.current=u.value,yg().then(p=>{const h=ri(),f={token:u.value,platform:jr(),environment:bg()};p&&(f.pushKey=p),h?.push?.registerApnsToken?.(f)})}),c=await l.addListener("registrationError",u=>{console.warn("[Push] APNs registration error:",u)});if(await l.register().catch(()=>{}),o){d.remove(),c.remove();return}i.push(()=>{d.remove()},()=>{c.remove()})}).catch(()=>{}),()=>{o=!0,i.forEach(l=>l())}},[e,t]),m.useEffect(()=>{if(t)return;const o=r.current;if(!o)return;r.current=null,ri()?.push?.unregisterApnsToken?.({token:o})},[t])},ro=s=>{const e=ne.c(12),{side:t,isResizing:r,ariaLabel:o,handleProps:i}=s,l=t==="left"?"inset-e-0":"inset-s-0";let a;e[0]!==l?(a=ie("absolute inset-y-0 z-50 w-6 cursor-col-resize touch-none",l),e[0]=l,e[1]=a):a=e[1];const d=t==="left"?"inset-e-0":"inset-s-0",c=r&&"bg-[var(--interactive-border)]";let u;e[2]!==d||e[3]!==c?(u=ie("absolute inset-y-0 w-[3px] transition-colors",d,c),e[2]=d,e[3]=c,e[4]=u):u=e[4];let p;e[5]!==u?(p=n.jsx("div",{className:u}),e[5]=u,e[6]=p):p=e[6];let h;return e[7]!==o||e[8]!==i||e[9]!==a||e[10]!==p?(h=n.jsx("div",{className:a,role:"separator","aria-orientation":"vertical","aria-label":o,...i,children:p}),e[7]=o,e[8]=i,e[9]=a,e[10]=p,e[11]=h):h=e[11],h},jg=320,kg=380,io=280,Sg=560,Ng=900;function oo(s,e,t,r){const o=ne.c(23),i=r===void 0?Sg:r,l=m.useRef(null);let a;o[0]!==t||o[1]!==i||o[2]!==e?(a=()=>{if(typeof window>"u")return t;const C=Number.parseInt(window.localStorage.getItem(e)??"",10);return Number.isFinite(C)?Math.min(i,Math.max(io,C)):t},o[0]=t,o[1]=i,o[2]=e,o[3]=a):a=o[3];const[d,c]=m.useState(a),[u,p]=m.useState(!1),h=m.useRef(0),f=m.useRef(d),g=m.useRef(null),x=m.useRef(null);let b;o[4]!==i?(b=C=>Math.min(i,Math.max(io,Math.round(C))),o[4]=i,o[5]=b):b=o[5];const w=b;let v;o[6]===Symbol.for("react.memo_cache_sentinel")?(v=C=>{const L=l.current;L&&(L.style.width=`${C}px`,L.style.minWidth=`${C}px`,L.style.maxWidth=`${C}px`,L.style.setProperty("--oc-ipad-sidebar-width",`${C}px`))},o[6]=v):v=o[6];const E=v;let P;o[7]!==d?(P=C=>{try{C.currentTarget.setPointerCapture(C.pointerId)}catch{}x.current=C.pointerId,h.current=C.clientX,f.current=d,g.current=d,p(!0),C.preventDefault()},o[7]=d,o[8]=P):P=o[8];const _=P;let A;o[9]!==w||o[10]!==s?(A=C=>{if(x.current!==C.pointerId)return;const L=(s==="left"?1:-1)*(pl(C.currentTarget)?-1:1),I=w(f.current+(C.clientX-h.current)*L);g.current!==I&&(g.current=I,E(I))},o[9]=w,o[10]=s,o[11]=A):A=o[11];const k=A;let S;o[12]!==w||o[13]!==e?(S=C=>{if(x.current!==C.pointerId)return;try{C.currentTarget.releasePointerCapture(C.pointerId)}catch{}const L=w(g.current??f.current);x.current=null,g.current=null,p(!1),c(L);try{window.localStorage.setItem(e,String(L))}catch{}},o[12]=w,o[13]=e,o[14]=S):S=o[14];const N=S;let M;o[15]!==_||o[16]!==N||o[17]!==k?(M={onPointerDown:_,onPointerMove:k,onPointerUp:N,onPointerCancel:N},o[15]=_,o[16]=N,o[17]=k,o[18]=M):M=o[18];const B=M;let O;return o[19]!==B||o[20]!==u||o[21]!==d?(O={asideRef:l,width:d,isResizing:u,handleProps:B},o[19]=B,o[20]=u,o[21]=d,o[22]=O):O=o[22],O}const Cg=()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,Rg=200;function ao(s){const e=ne.c(6),[t,r]=m.useState(!1),[o,i]=m.useState(s);s!==o&&(i(s),r(!s&&!Cg()));let l,a;e[0]!==t?(l=()=>{if(!t)return;const u=window.setTimeout(()=>r(!1),Rg);return()=>window.clearTimeout(u)},a=[t],e[0]=t,e[1]=l,e[2]=a):(l=e[1],a=e[2]),m.useEffect(l,a);const d=s||t;let c;return e[3]!==s||e[4]!==d?(c={placed:d,inPlace:s},e[3]=s,e[4]=d,e[5]=c):c=e[5],c}const lo=["general","isolated-spaces","appearance","chat","notifications","sessions","routing","git","magic-prompts","snippets","behavior","agents","commands","mcp","plugins","skills.installed","skills.catalog","providers","web-search","usage","voice","integrations","about"],Eg=1e3,Ig=({onActiveConnectionDeleted:s})=>{const{t:e,direction:t}=ge();Od();const[r,o]=m.useState(!1);m.useEffect(()=>ot.subscribe((V,ue)=>{V.currentSessionId&&V.currentSessionId!==ue.currentSessionId&&He.getState().setRunOverviewKey(null)}),[]);const i=He(V=>V.runOverviewKey!==null);m.useEffect(()=>{i&&o(!1)},[i]);const[l,a]=m.useState(null),[d,c]=m.useState(!1),[u,p]=m.useState(()=>{const{mobileWorkspaceTabOrder:V,mobileWorkspaceHiddenTabs:ue}=He.getState();return oi(V,ue)[0]}),h=m.useCallback(()=>{const{mobileWorkspaceTabOrder:V,mobileWorkspaceHiddenTabs:ue}=He.getState(),Le=oi(V,ue);p($e=>Le.includes($e)?$e:Le[0]),c(!0)},[]),[f,g]=m.useState(null),[x,b]=m.useState("nav"),[w,v]=m.useState(null),E=He(V=>V.setSettingsPage),P=He(V=>V.wideChatLayoutEnabled),_=ks(V=>V.available),A=ks(V=>V.runtimeType),k=m.useMemo(()=>Tr(),[]),S=m.useCallback(()=>{a(null),g(null)},[]),N=m.useCallback(V=>{a(V)},[]),M=m.useCallback(()=>{c(!1)},[]),B=m.useCallback(V=>{b(V),N("settings")},[N]);m.useEffect(()=>N1(lo,B),[B]);const{enabled:O,roomyForPanels:C}=Sr(),I=uu()==="portrait",j=du(),[R,T]=m.useState(()=>fu().roomyForPanels),$=m.useCallback(()=>{T(V=>!V)},[]);m.useEffect(()=>{O||T(!1)},[O]);const W=m.useCallback(()=>{v(null),p("files"),c(!0)},[]);m.useEffect(()=>hi(V=>{if(V.type!=="file-open-request")return;const ue=V.directory??Bs.getState().currentDirectory;ue&&(He.getState().openContextFile(ue,V.path),W())}),[W]),m.useEffect(()=>hi(V=>{if(V.type!=="plan-open-request")return;const ue=Md(V.directory??Bs.getState().currentDirectory,V.projectId);ue&&g({id:V.planId,title:V.title,projectRef:ue})}),[]);const q=m.useCallback((V=null)=>{v(V),p("changes"),c(!0)},[]),D=oo("left","openchamber.ipad.leftSidebarWidth",jg),z=oo("right","openchamber.ipad.rightSidebarWidth",kg,Ng),J=C,ee=ao(O&&R),Q=ao(J&&d),Y=J&&Q.placed?z.width:0,K=O&&ee.placed?D.width:0,Z=t==="rtl"?"100%":"-100%",U=t==="rtl"?"-100%":"100%";m.useEffect(()=>(ur.setState({left:K,right:Y}),()=>ur.setState({left:0,right:0})),[K,Y]),m.useEffect(()=>{if(typeof document>"u")return;const V=document.documentElement;return V.classList.toggle("wide-chat-layout",P),()=>V.classList.remove("wide-chat-layout")},[P]),m.useEffect(()=>{if(typeof document>"u")return;const V=O&&(I||j),ue=document.documentElement;return ue.classList.toggle("oc-keep-draft-starters",V),()=>ue.classList.remove("oc-keep-draft-starters")},[j,O,I]);const H=m.useMemo(()=>({openChanges:({diffPath:V,staged:ue}={})=>{q(V?{path:V,staged:ue===!0}:null)},openFiles:()=>W(),openSourceBoard:()=>N("board")}),[q,W,N]),se=m.useMemo(()=>({openSessions:()=>{O?T(!0):o(!0)},openView:V=>{if(V==="files"){W();return}if(V==="mcp"){p("status"),c(!0);return}N(V)},openChanges:({path:V,staged:ue}={})=>{q(V?{path:V,staged:ue===!0}:null)},openSettings:V=>{V&&E(V),B(V?"page-content":"nav")}}),[O,q,W,B,N,E]);hg(se);const fe=m.useRef(null),ce=()=>{O?T(!0):o(!0)},ae=()=>h();Gr(fe,{onLeftEdgeSwipe:t==="rtl"?ae:ce,onRightEdgeSwipe:t==="rtl"?ce:ae});const je=m.useRef(null),Re=m.useCallback(V=>{je.current=V},[]),te=m.useCallback(()=>mu()?!0:f?(g(null),!0):l==="settings"&&je.current?.()?!0:l?(S(),!0):d?(M(),!0):r?(o(!1),!0):!1,[l,S,M,f,r,d]);pu(te);const pe=!k&&_&&(A==="desktop"||A==="web"),X=O?"dialog":"fullscreen",oe=He(V=>V.overviewFeatureAvailable),ve=m.useMemo(()=>({instanceLabel:k?js():null,onOpenInstances:k?()=>N("instances"):void 0,onOpenSettings:()=>B("nav"),onOpenUsage:()=>N("usage"),onOpenScheduled:()=>N("scheduled"),onOpenArchive:()=>N("archive"),onOpenOverview:oe?()=>N("overview"):void 0,onOpenSourceBoard:()=>N("board"),onOpenUpdate:pe?()=>N("update"):void 0}),[B,N,oe,k,pe]),we=m.useCallback(V=>{S(),o(!1),V==="file"&&W()},[S,W]),Se=m.useCallback(()=>{S(),o(!1)},[S]),be=m.useCallback(()=>{S(),o(!1),O&&!C&&T(!1)},[S,O,C]),xe=m.useCallback(()=>{S(),o(!1),O&&!C&&T(!1)},[S,O,C]);return n.jsx(hu,{actions:H,children:n.jsxs("div",{className:"oc-mobile-app-shell main-content-safe-area flex h-[100dvh] flex-row bg-background text-foreground","data-page-scroll-lock":"true",children:[O?n.jsxs("aside",{ref:D.asideRef,className:ie("oc-ipad-sidebar relative flex h-full shrink-0 flex-col overflow-hidden"),style:{width:K,minWidth:K,maxWidth:K,"--oc-ipad-sidebar-width":`${D.width}px`,overflowX:"clip"},"aria-hidden":!R,"data-page-scroll-lock":"true",children:[n.jsx("div",{className:ie("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",D.isResizing&&"pointer-events-none",!R&&"pointer-events-none select-none"),style:{width:"var(--oc-ipad-sidebar-width)",overflowX:"hidden",paddingTop:"var(--oc-safe-area-top, 0px)",translate:ee.inPlace?void 0:Z},children:n.jsx(ft,{children:n.jsx(Gi,{open:ee.placed,variant:"sidebar",onOpenChange:V=>{!V&&!C&&T(!1)},footer:ve})})}),R?n.jsx(ro,{side:"left",isResizing:D.isResizing,ariaLabel:e("sidebar.resize.leftPanelAria"),handleProps:D.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(kp,{onOpenSessions:()=>O?$():o(!0),onOpenWorkspace:h,compactTitle:O}),n.jsxs("main",{ref:fe,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(ft,{children:n.jsx(Ld,{})})}),n.jsx(ft,{children:n.jsx(qd,{})})]})]}),O?null:n.jsx(Gi,{open:r,onOpenChange:o,footer:ve}),n.jsxs("aside",{ref:z.asideRef,className:ie("relative flex h-full shrink-0 flex-col overflow-hidden"),style:{width:Y,minWidth:Y,maxWidth:Y,"--oc-ipad-sidebar-width":`${z.width}px`,overflowX:"clip"},"aria-hidden":!Y,"data-page-scroll-lock":"true",children:[n.jsx("div",{className:ie("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",J&&"border-s border-edge bg-background",z.isResizing&&"pointer-events-none",!Q.inPlace&&"pointer-events-none select-none"),style:{width:"var(--oc-ipad-sidebar-width)",overflowX:"hidden",paddingTop:"var(--oc-safe-area-top, 0px)",translate:Q.inPlace?void 0:U},children:n.jsx(ft,{children:n.jsx(Y1,{open:J?Q.placed:d,onClose:M,tab:u,onTabChange:p,pendingChangesDiff:w,onOpenPlan:g,variant:J?"panel":"drawer"})})}),J&&d?n.jsx(ro,{side:"right",isResizing:z.isResizing,ariaLabel:e("sidebar.resize.rightPanelAria"),handleProps:z.handleProps}):null]}),f?n.jsx(Yt,{open:!0,variant:X,onClose:()=>g(null),ariaLabel:f.title,title:f.title,children:n.jsx(ft,{children:n.jsx(Kd,{savedProjectPlan:{projectRef:f.projectRef,planId:f.id},onNavigatedToChat:()=>{S(),M()}})})}):null,l==="instances"&&k?n.jsx(Yt,{open:!0,variant:X,dialogAlign:"app",onClose:S,ariaLabel:e("mobile.menu.instances"),title:e("mobile.menu.instances"),children:n.jsx(Ep,{onConnect:S,onActiveConnectionDeleted:s})}):null,l==="settings"?n.jsx(Yt,{open:!0,variant:X,dialogAlign:"app",onClose:S,ariaLabel:e("mobile.menu.settings"),headerless:!0,children:n.jsx(ft,{children:n.jsx($d,{forceMobile:!0,isWindowed:!0,initialMobileStage:x,registerBackHandler:Re,visiblePageSlugs:[...lo],onClose:S})})}):null,l==="usage"?n.jsx(Yt,{open:!0,variant:X,dialogAlign:"app",onClose:S,ariaLabel:e("usageStats.title"),title:e("usageStats.title"),children:n.jsx(ft,{children:n.jsx(wf,{})})}):null,l==="scheduled"?n.jsx(Yt,{open:!0,variant:X,dialogAlign:"app",onClose:S,ariaLabel:e("sessions.scheduledTasks.dialog.title"),title:e("sessions.scheduledTasks.dialog.title"),children:n.jsx(ft,{children:n.jsx(Nf,{layout:"mobile",onLeave:we})})}):null,l==="board"?n.jsx(Yt,{open:!0,variant:X,dialogAlign:"app",onClose:S,ariaLabel:e("sourceBoard.title"),headerless:!0,children:n.jsx(ft,{children:n.jsx(kf,{onLeave:Se,onClose:S})})}):null,l==="overview"&&oe?n.jsx(Yt,{open:!0,variant:X,dialogAlign:"app",onClose:S,ariaLabel:e("overview.title"),title:e("overview.title"),children:n.jsx(ft,{children:n.jsx(Sf,{layout:"mobile",onLeave:be})})}):null,l==="archive"?n.jsx(Yt,{open:!0,variant:X,dialogAlign:"app",onClose:S,ariaLabel:e("sessions.archivePage.title"),title:e("sessions.archivePage.title"),children:n.jsx(ft,{children:n.jsx(jf,{layout:"mobile",onLeave:xe})})}):null,l==="update"?n.jsx(Yt,{open:!0,variant:X,dialogAlign:"app",onClose:S,ariaLabel:e("mobile.menu.update"),title:e("mobile.menu.update"),children:n.jsx(ft,{children:n.jsx(Ut,{outerClassName:"h-full",className:"px-5 py-4",disableHorizontal:!0,children:n.jsx(Wd,{initialUpdateDialogOpen:!0})})})}):null]})})};function Tg(s){const e=ne.c(142),{apis:t}=s,r=He(ab),{t:o}=ge(),i=Ot(ob),l=Ot(ib),a=Ot(rb),d=Ot(nb),c=Ot(sb),u=Ot(tb),p=Ot(eb),h=Ot(Zg),f=Bs(Qg),g=ot(Yg),x=ot(Xg),b=He(Jg),w=zo(Gg),v=hl(qg),E=Cs(Ug),P=Cs(Hg),_=Cs(Vg);let A;e[0]!==E||e[1]!==P?(A=[...E,...P],e[0]=E,e[1]=P,e[2]=A):A=e[2];const k=A;let S;e[3]!==k||e[4]!==_?(S={hasAuthoritativeGlobalSessions:_,sessions:k},e[3]=k,e[4]=_,e[5]=S):S=e[5],yd(S);const[N,M]=m.useState(0),[B,O]=m.useState(0),[C,L]=m.useState(!1),[I,j]=m.useState("pending"),[R,T]=m.useState(null);let $;e[6]===Symbol.for("react.memo_cache_sentinel")?($=js(),e[6]=$):$=e[6];const W=$,[,q]=m.useReducer(Kg,0);let D;e[7]===Symbol.for("react.memo_cache_sentinel")?(D=Tr(),e[7]=D):D=e[7];const z=D,J=m.useRef(0),ee=m.useRef(0);let Q;e[8]!==u||e[9]!==t.sourceControl||e[10]!==t.trackers||e[11]!==i||e[12]!==h||e[13]!==p||e[14]!==c||e[15]!==w||e[16]!==v?(Q=()=>{const de=Ft(),le=ee.current+1;if(ee.current=le,!de){rn("resume:auto-connect",{}),on();return}rn("resume:reprobe",{});const he=()=>{i(),v(t.sourceControl),w(t.sourceControl,{force:!0}),pi(t.trackers),c===0&&p({source:"mobileApp:nativeResume"}),u===0&&h({source:"mobileApp:nativeResume"})},Ce=ze=>{rn("resume:disconnect",{reason:ze}),Ds({apiBaseUrl:"",clientToken:null,runtimeKey:jn}),M(Wg)};_n().then(ze=>{if(ee.current===le){if(ze==="no-connection"){Ce("no-connection");return}if(ze==="needs-login"){T({kind:"auth-expired",label:js()??""}),Ce("needs-login");return}if(ze==="relay-limit"){T({kind:"relay-limit",label:js()??""}),Ce("relay-limit");return}if(ze==="unreachable"){const qt=[4e3,1e4],Wt=wt=>{window.setTimeout(()=>{if(ee.current!==le)return;const zt=wt===qt.length-1;_n({fast:!zt}).then(Et=>{if(ee.current===le&&Et!=="switched"){if(Et==="unchanged"){he();return}if(Et==="needs-login"){T({kind:"auth-expired",label:js()??""}),Ce("retry-needs-login");return}if(Et==="relay-limit"){T({kind:"relay-limit",label:js()??""}),Ce("retry-relay-limit");return}if(!zt){Wt(wt+1);return}Ce(`retry-${Et}`)}})},qt[wt])};Wt(0);return}ze!=="switched"&&he()}});const Ne=Date.now();Ne-J.current>=Eg&&(J.current=Ne,window.dispatchEvent(new Event("openchamber:system-resume")))},e[8]=u,e[9]=t.sourceControl,e[10]=t.trackers,e[11]=i,e[12]=h,e[13]=p,e[14]=c,e[15]=w,e[16]=v,e[17]=Q):Q=e[17];const Y=Q;Jc(),Xc(Y);let K,Z;e[18]!==Y?(K=()=>{if(!z)return;let de;const le=()=>{window.clearTimeout(de),de=window.setTimeout(()=>Y(),1500)};return window.addEventListener("online",le),()=>{window.removeEventListener("online",le),window.clearTimeout(de)}},Z=[z,Y],e[18]=Y,e[19]=K,e[20]=Z):(K=e[19],Z=e[20]),m.useEffect(K,Z);let U,H;e[21]!==Y?(U=()=>{if(z)return ii.subscribe((de,le)=>{de.state==="expired"&&le.state!=="expired"&&(Y(),ii.getState().markAuthenticated())})},H=[z,Y],e[21]=Y,e[22]=U,e[23]=H):(U=e[22],H=e[23]),m.useEffect(U,H);let se,fe;e[24]!==Y?(se=()=>{if(z)return gl(de=>{zn(de)&&Y()})},fe=[z,Y],e[24]=Y,e[25]=se,e[26]=fe):(se=e[25],fe=e[26]),m.useEffect(se,fe);let ce,ae;e[27]!==t?(ce=()=>(po(t),$g),ae=[t],e[27]=t,e[28]=ce,e[29]=ae):(ce=e[28],ae=e[29]),m.useEffect(ce,ae);let je;e[30]!==q?(je=()=>mo(de=>{if(rn("endpoint:changed",{runtimeKey:de.runtimeKey||"none",previousRuntimeKey:de.previousRuntimeKey||"none",connected:!!de.apiBaseUrl}),!!de.runtimeKey&&de.runtimeKey===de.previousRuntimeKey){Cd(),q();return}Rd(de),O(Fg),M(Bg)}),e[30]=q,e[31]=je):je=e[31];let Re;e[32]===Symbol.for("react.memo_cache_sentinel")?(Re=[],e[32]=Re):Re=e[32],m.useEffect(je,Re);let te;e[33]!==a?(te=()=>{if(!z||a||Ft()){j("done");return}let de=!1;return j("attempting"),(async()=>{const le=await on().catch(zg);de||(le.status==="unreachable"||le.status==="relay-limit"?T({kind:le.status,label:le.label}):le.status==="needs-login"&&T({kind:"auth-expired",label:le.label}),j("done"),le.status==="unreachable"&&on({fast:!1,skipIfConnected:!0}).catch(Lg))})(),()=>{de=!0}},e[33]=a,e[34]=te):te=e[34];let pe;e[35]===Symbol.for("react.memo_cache_sentinel")?(pe=[],e[35]=pe):pe=e[35],m.useEffect(te,pe);let X,oe;e[36]===Symbol.for("react.memo_cache_sentinel")?(X=()=>{if(!z||!Ft())return;let de=!1;const le=he=>{rn("cold-launch:drop",{kind:he?.kind??"unknown"}),he&&T(he),Ds({apiBaseUrl:"",clientToken:null,runtimeKey:jn}),M(Mg)};return _n().then(async he=>{if(de||he==="switched"||he==="unchanged")return;const Ce=js();if(he==="needs-login"){le({kind:"auth-expired",label:Ce??""});return}if(he==="unreachable"){le(Ce?{kind:"unreachable",label:Ce}:null),on({fast:!1,skipIfConnected:!0}).catch(Og);return}if(he==="relay-limit"){le({kind:"relay-limit",label:Ce??""});return}const Ne=await on().catch(Dg);de||Ne.status==="connected"||(Ne.status==="needs-login"?le({kind:"auth-expired",label:Ne.label}):Ne.status==="unreachable"||Ne.status==="relay-limit"?le({kind:Ne.status,label:Ne.label}):le(null))}),()=>{de=!0}},oe=[],e[36]=X,e[37]=oe):(X=e[36],oe=e[37]),m.useEffect(X,oe);let ve,we;e[38]!==b?(ve=()=>{b(!0)},we=[b],e[38]=b,e[39]=ve,e[40]=we):(ve=e[39],we=e[40]),m.useEffect(ve,we);let Se;e[41]!==i?(Se=()=>{z&&!Ft()||i()},e[41]=i,e[42]=Se):Se=e[42];let be;e[43]!==N||e[44]!==i?(be=[N,i,z],e[43]=N,e[44]=i,e[45]=be):be=e[45],m.useEffect(Se,be);let xe,V;e[46]!==u||e[47]!==a||e[48]!==h||e[49]!==p||e[50]!==c?(xe=()=>{a&&(c===0&&p({source:"mobileApp:recovery"}),u===0&&h({source:"mobileApp:recovery"}))},V=[u,a,h,p,c],e[46]=u,e[47]=a,e[48]=h,e[49]=p,e[50]=c,e[51]=xe,e[52]=V):(xe=e[51],V=e[52]),m.useEffect(xe,V);const ue=m.useRef(!1),[Le,$e]=m.useState(z);let Te;e[53]!==a?(Te=()=>{if(!z||!a||ue.current)return;let de=!1;const le=window.setTimeout(()=>$e(!1),6e3);return(async()=>{const he=await Ed({refresh:!0});de||(he!=="failed"&&(ue.current=!0),$e(!1))})(),()=>{de=!0,window.clearTimeout(le)}},e[53]=a,e[54]=Te):Te=e[54];let Xe;e[55]!==N||e[56]!==a?(Xe=[N,a,z],e[55]=N,e[56]=a,e[57]=Xe):Xe=e[57],m.useEffect(Te,Xe);let Ye,tt;e[58]!==f||e[59]!==a?(Ye=()=>{a&&lr.setDirectory(f)},tt=[f,a],e[58]=f,e[59]=a,e[60]=Ye,e[61]=tt):(Ye=e[60],tt=e[61]),m.useEffect(Ye,tt);let rt,ye;e[62]!==t.sourceControl||e[63]!==t.trackers||e[64]!==a||e[65]!==w||e[66]!==v?(rt=()=>{a&&(v(t.sourceControl),w(t.sourceControl,{force:!0}),pi(t.trackers))},ye=[t.sourceControl,t.trackers,a,w,v],e[62]=t.sourceControl,e[63]=t.trackers,e[64]=a,e[65]=w,e[66]=v,e[67]=rt,e[68]=ye):(rt=e[67],ye=e[68]),m.useEffect(rt,ye);let Fe,We;e[69]!==x||e[70]!==g?(Fe=()=>{if(!g)return;const de=window.setTimeout(()=>x(),5e3);return()=>window.clearTimeout(de)},We=[x,g],e[69]=x,e[70]=g,e[71]=Fe,e[72]=We):(Fe=e[71],We=e[72]),m.useEffect(Fe,We);let Qe;e[73]!==a?(Qe=()=>{if(!(!a&&(z?!!Ft():!0))){L(!1);return}const le=window.setTimeout(()=>{L(!0)},z?4e3:8e3);return()=>window.clearTimeout(le)},e[73]=a,e[74]=Qe):Qe=e[74];let Ze;e[75]!==N||e[76]!==a||e[77]!==B?(Ze=[a,z,N,B],e[75]=N,e[76]=a,e[77]=B,e[78]=Ze):Ze=e[78],m.useEffect(Qe,Ze),Yc();let st;e[79]===Symbol.for("react.memo_cache_sentinel")?(st={enabled:!0},e[79]=st):st=e[79],Qc(st),vd(),Zc(),eu(),wd(),jd(t.sourceControl),kd(t.trackers),Sd(f||null),Nd();const Oe=z&&a;let Ue;e[80]!==Oe?(Ue={enabled:Oe},e[80]=Oe,e[81]=Ue):Ue=e[81],wg(Ue);const Ge=z&&a&&l;let nt;e[82]!==Ge?(nt={ready:Ge},e[82]=Ge,e[83]=nt):nt=e[83],gg(nt);const Tt=Q1(),Ct=!a&&d==="reconnecting";if(!Tt){let de;return e[84]===Symbol.for("react.memo_cache_sentinel")?(de=n.jsx("main",{className:"flex min-h-dvh items-center justify-center bg-[var(--splash-background,var(--surface-background))] text-foreground",children:n.jsx(Os,{width:120,height:120,isAnimated:!0,variant:"splash"})}),e[84]=de):de=e[84],de}const at=!!Ft();if(z&&(!at||!a&&!Ct)){if(at){const he=!C;let Ce;e[85]!==he?(Ce=n.jsx(Os,{width:120,height:120,isAnimated:he,variant:"splash"}),e[85]=he,e[86]=Ce):Ce=e[86];let Ne;e[87]!==C||e[88]!==o?(Ne=C?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("h1",{className:"typography-h3 text-foreground",children:o("sessionAuth.error.networkTitle")}),n.jsx("p",{className:"typography-markdown text-muted-foreground",children:o("mobile.connect.recovery.description")})]}),n.jsx(Ee,{type:"button",variant:"outline",onClick:()=>{Ds({apiBaseUrl:"",clientToken:null,runtimeKey:jn}),M(Pg)},children:o("mobile.connect.cancelPassword")})]}):null,e[87]=C,e[88]=o,e[89]=Ne):Ne=e[89];let ze;return e[90]!==Ce||e[91]!==Ne?(ze=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,Ne]})}),e[90]=Ce,e[91]=Ne,e[92]=ze):ze=e[92],ze}if(I!=="done"){let he;e[93]===Symbol.for("react.memo_cache_sentinel")?(he=n.jsx(Os,{width:120,height:120,isAnimated:!0,variant:"splash"}),e[93]=he):he=e[93];let Ce;e[94]!==o?(Ce=W?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:o("mobile.connect.splash.connectingTo")}),n.jsxs("p",{className:"typography-small text-foreground",children:[W,n.jsx(tu,{})]})]}):null,e[94]=o,e[95]=Ce):Ce=e[95];let Ne;return e[96]!==Ce?(Ne=n.jsxs("main",{className:"relative flex min-h-dvh items-center justify-center bg-[var(--splash-background,var(--surface-background))] text-foreground",children:[he,Ce]}),e[96]=Ce,e[97]=Ne):Ne=e[97],Ne}let de;e[98]===Symbol.for("react.memo_cache_sentinel")?(de=()=>M(Ag),e[98]=de):de=e[98];let le;return e[99]!==R?(le=n.jsx(n.Fragment,{children:n.jsx(ap,{onConnected:de,notice:R})}),e[99]=R,e[100]=le):le=e[100],le}if(!a&&!Ct){if(!C){let ze;return e[101]===Symbol.for("react.memo_cache_sentinel")?(ze=n.jsx("main",{className:"flex min-h-dvh items-center justify-center bg-[var(--splash-background,var(--surface-background))] text-foreground",children:n.jsx(Os,{width:120,height:120,isAnimated:!0,variant:"splash"})}),e[101]=ze):ze=e[101],ze}let de;e[102]!==o?(de=o("sessionAuth.error.networkTitle"),e[102]=o,e[103]=de):de=e[103];let le;e[104]!==de?(le=n.jsx("h1",{className:"typography-h3 text-foreground",children:de}),e[104]=de,e[105]=le):le=e[105];let he;e[106]!==o?(he=o("sessionAuth.error.networkDescription"),e[106]=o,e[107]=he):he=e[107];let Ce;e[108]!==he?(Ce=n.jsx("p",{className:"typography-markdown text-muted-foreground",children:he}),e[108]=he,e[109]=Ce):Ce=e[109];let Ne;return e[110]!==le||e[111]!==Ce?(Ne=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:[le,Ce]})}),e[110]=le,e[111]=Ce,e[112]=Ne):Ne=e[112],Ne}let mt;e[113]===Symbol.for("react.memo_cache_sentinel")?(mt=lr.getSdkClient(),e[113]=mt):mt=e[113];const pt=f||"",bt=!z||!Le;let et;e[114]!==bt?(et=n.jsx(Id,{ready:bt,animated:!0}),e[114]=bt,e[115]=et):et=e[115];let Ie;e[116]!==l?(Ie=n.jsx(su,{backgroundWorkEnabled:l}),e[116]=l,e[117]=Ie):Ie=e[117];let xt,_e;e[118]===Symbol.for("react.memo_cache_sentinel")?(xt=n.jsx(Td,{}),_e=n.jsx(pm,{}),e[118]=xt,e[119]=_e):(xt=e[118],_e=e[119]);let Ae,Ke,qe,ht,Ve;e[120]===Symbol.for("react.memo_cache_sentinel")?(Ae=n.jsx(Ig,{onActiveConnectionDeleted:()=>{Xm(),Ds({apiBaseUrl:"",clientToken:null,runtimeKey:jn}),M(_g)}}),Ke=n.jsx(nu,{}),qe=n.jsx(ru,{}),ht=n.jsx(iu,{}),Ve=n.jsx(ou,{}),e[120]=Ae,e[121]=Ke,e[122]=qe,e[123]=ht,e[124]=Ve):(Ae=e[120],Ke=e[121],qe=e[122],ht=e[123],Ve=e[124]);let lt;e[125]!==r?(lt=r?n.jsxs(n.Fragment,{children:[n.jsx(Vd,{}),n.jsx(_d,{}),n.jsx(Hd,{}),n.jsx(Ad,{}),n.jsx(Ud,{})]}):null,e[125]=r,e[126]=lt):lt=e[126];let yt;e[127]===Symbol.for("react.memo_cache_sentinel")?(yt=n.jsx(vm,{}),e[127]=yt):yt=e[127];let vt;e[128]!==l?(vt=l?n.jsx(Pd,{}):null,e[128]=l,e[129]=vt):vt=e[129];let Rt;e[130]!==et||e[131]!==Ie||e[132]!==lt||e[133]!==vt?(Rt=n.jsx(au,{delayDuration:300,skipDelayDuration:150,children:n.jsxs("div",{className:"h-full bg-background text-foreground",children:[et,Ie,xt,_e,Ae,Ke,qe,ht,Ve,lt,yt,vt]})}),e[130]=et,e[131]=Ie,e[132]=lt,e[133]=vt,e[134]=Rt):Rt=e[134];let _t;e[135]!==t||e[136]!==Rt?(_t=n.jsx(lu,{apis:t,children:Rt}),e[135]=t,e[136]=Rt,e[137]=_t):_t=e[137];let $t;return e[138]!==B||e[139]!==pt||e[140]!==_t?($t=n.jsx(ft,{children:n.jsx(cu,{sdk:mt,directory:pt,children:_t},B)}),e[138]=B,e[139]=pt,e[140]=_t,e[141]=$t):$t=e[141],$t}function _g(s){return s+1}function Ag(s){return s+1}function Pg(s){return s+1}function Dg(){return{status:"no-candidate"}}function Og(){return null}function Mg(s){return s+1}function Lg(){return null}function zg(){return{status:"no-candidate"}}function Bg(s){return s+1}function Fg(s){return s+1}function $g(){return po(null)}function Wg(s){return s+1}function Kg(s){return s+1}function Vg(s){return s.status==="ready"}function Hg(s){return s.archivedSessions}function Ug(s){return s.activeSessions}function qg(s){return s.refresh}function Gg(s){return s.refreshAll}function Jg(s){return s.setIsMobile}function Xg(s){return s.clearError}function Yg(s){return s.error}function Qg(s){return s.currentDirectory}function Zg(s){return s.loadAgents}function eb(s){return s.loadProviders}function tb(s){return s.agents.length}function sb(s){return s.providers.length}function nb(s){return s.connectionPhase}function rb(s){return s.isConnected}function ib(s){return s.isInitialized}function ob(s){return s.initializeApp}function ab(s){return s.isolatedSpacesEnabled}function lb(s){const e=ne.c(7),t=m.useSyncExternalStore(cb,Ft,Ft);let r;e[0]!==t?(r=!Tr()||!!t,e[0]=t,e[1]=r):r=e[1];let o;e[2]!==s?(o=n.jsx(Tg,{...s}),e[2]=s,e[3]=o):o=e[3];let i;return e[4]!==r||e[5]!==o?(i=n.jsx(Dd,{enabled:r,children:o}),e[4]=r,e[5]=o,e[6]=i):i=e[6],i}function cb(s){return mo(()=>s())}function L2(s){window.__OPENCHAMBER_SURFACE__="mobile",gu(),Fd({logLabel:"[mobile-main]",onAppearanceSettled:om}),mm(),bu();const e=document.getElementById("root");if(!e)throw new Error("Root element not found");const r=window.Capacitor?.isNativePlatform?.()===!0||window.location.protocol==="capacitor:",o=r?{...s,notifications:{notifyAgentCompletion:async()=>!1,canNotify:()=>!1}}:s,i=n.jsx(Bd,{children:n.jsx(lb,{apis:o})});Ga.createRoot(e).render(n.jsx(ar.StrictMode,{children:n.jsx(xu,{children:n.jsx(yu,{children:n.jsx(vu,{children:n.jsx(zd,{children:r?i:n.jsx(wu,{children:i})})})})})}))}export{L2 as renderMobileApp};
|
|
25
|
+
`)}`.trim()),$e([])},[]),Fa=m.useCallback(async()=>{if(!f)return;const y=ns.map(F=>F.path).sort();if(y.length===0){me.error(l("gitView.toast.selectFileToDescribe"));return}ue(!0);try{const{message:F}=await fi(f,y);ve(F.subject?.trim()??""),$e(Array.isArray(F.highlights)?F.highlights:[])}catch(F){me.error(F instanceof Error?F.message:l("gitView.toast.generateCommitMessageFailed"))}finally{ue(!1)}},[f,ns,l]),Yr=async(y={})=>{if(!f)return;if(!oe.trim()){me.error(l("gitView.toast.enterCommitMessage"));return}const F=ns.map(Je=>Je.path).sort();if(F.length===0){me.error(l("gitView.toast.selectFileToCommit"));return}pe(y.pushAfter?"commitAndPush":"commit");let re=null,Pe="pending";try{const Je=await a.createGitCommit(f,oe.trim(),{files:F});Pe="local";const Ht=X.committed(Je.summary,y);if(ve(""),$e([]),y.pushAfter){if(re=Ue.start(),!re){me.warning(l("gitView.publish.commitKept")),await vs();return}const it=await Oe.prepare("push",{onOperation:re.onOperation});Re("publish"),await it(),Pe="published",X.pushed({deletion:Ht,origin:y.origin})}await vs()}catch(Je){if(y.pushAfter&&Pe==="local"&&me.warning(l("gitView.publish.commitKept")),Je instanceof Rn||Je instanceof cr){await vs();return}if(Je instanceof fs&&Je.code==="stale-runtime")return;if(Je instanceof fs&&Oe.errorMessage(Je)){me.info(Oe.errorMessage(Je));return}y.pushAfter&&await vs(),me.error(Je instanceof fs?Je.code==="contributor-publish-cancelled-after-update"?l("gitView.toast.contributorPublishCancelledAfterUpdate"):Je.code==="contributor-publish-cancelled"?l("gitView.toast.contributorPublishCancelled"):l("gitView.toast.syncActionFailed",{action:l("gitView.sync.syncChanges")}):Je instanceof Error?Je.message:l("gitView.toast.createCommitFailed"))}finally{re?.finish(),pe(null),y.pushAfter&&Re(null)}},$a=m.useMemo(()=>(g?.files??[]).filter(Zn).length,[g?.files]),sn=!!g?.mergeInProgress?.head,Wa=m.useCallback(async()=>{if(f)try{if(sn){const y=await a.continueMerge(f);y.conflict?(et(y.conflictFiles??[],"merge"),me.error(l("gitView.toast.mergeConflictsDetected"))):me.success(l("gitView.toast.mergeCompleted"))}else{const y=await a.continueRebase(f);y.conflict?(et(y.conflictFiles??[],"rebase"),me.error(l("gitView.toast.rebaseConflictsDetected"))):me.success(l("gitView.toast.rebaseStepCompleted"))}await St(!1)}catch(y){me.error(y instanceof Error?y.message:l("gitView.toast.continueOperationFailed"))}},[f,a,sn,et,St,l]),Qr=m.useCallback(async y=>{if(f)try{y==="merge"?(await a.abortMerge(f),me.success(l("gitView.toast.mergeAborted"))):(await a.abortRebase(f),me.success(l("gitView.toast.rebaseAborted"))),await St(!1)}catch(F){me.error(F instanceof Error?F.message:l("gitView.toast.abortOperationFailed"))}},[f,a,St,l]),Ka=m.useCallback(()=>{const y=(g?.files??[]).filter(Zn).map(F=>F.path);et(y,sn?"merge":"rebase")},[sn,et,g?.files]),Va=m.useMemo(()=>{const y=[];return ns.length>0&&y.push({id:"staged",title:l("gitView.changes.stagedTitle"),entries:ns,statsScope:"staged",actionSymbol:"-",actionAllLabel:l("gitView.changes.unstageAllAria"),getActionLabel:F=>l("gitView.changes.unstageFileAria",{path:F}),onActionFile:F=>{tn([F],"unstage")},onActionAll:F=>{tn(F,"unstage")},onViewDiff:F=>qn(F,!0),onRevertFile:Gn,showRevertActions:!1,accent:!0}),Un.length>0&&y.push({id:"unstaged",title:l("gitView.changes.title"),entries:Un,statsScope:"working",actionSymbol:"+",actionAllLabel:l("gitView.changes.stageAllAria"),getActionLabel:F=>l("gitView.changes.stageFileAria",{path:F}),onActionFile:F=>{tn([F],"stage")},onActionAll:F=>{tn(F,"stage")},onViewDiff:F=>qn(F,!1),onRevertFile:Gn}),y},[Gn,qn,tn,ns,l,Un]),Zr=n.jsxs(n.Fragment,{children:[Oe.context?n.jsx(sd,{context:Oe.context,onSelect:Oe.settle}):null,Oe.confirmDialog,n.jsx(nd,{candidates:st.candidates,onSelect:st.settle})]}),ei=h?n.jsx(dd,{repositories:h,selectedRepository:u??null,onSelectRepository:y=>{s&&(In.getState().clearChangesRepository(s),$(s,y))},repositoryRoot:s??void 0}):null,Jn=y=>n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[Zr,n.jsxs("header",{className:"flex h-[var(--oc-header-height,56px)] shrink-0 items-center gap-2 px-3 text-foreground",children:[t?n.jsx("button",{type:"button",className:"-ms-1 flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":l("mobile.surface.closeAria"),onClick:t,style:{touchAction:"manipulation"},children:n.jsx(G,{name:"close",className:"size-5"})}):null,n.jsxs("div",{className:"min-w-0 flex-1 px-1",children:[n.jsx("h2",{className:"typography-ui-label text-foreground",children:l("mobile.nav.changes")}),n.jsx("p",{className:"truncate typography-micro text-muted-foreground",children:g?.current||f||""})]}),ei]}),n.jsx("div",{className:"min-h-0 flex-1",children:y})]});if(!f)return Jn(n.jsx(Nt,{message:l("gitView.empty.selectSessionOrDirectory")}));if(c===!1&&L!==!0)return Jn(n.jsx(md,{root:s,rootIsGitRepo:c,resolvedIsGitRepo:L,nestedRepos:p,onRetryDiscovery:()=>{s&&T(s,{force:!0})}}));if(I&&L===null)return Jn(n.jsx(Nt,{loading:!0,message:l("gitView.loading.checkingRepository")}));if(H.type==="diff")return n.jsx(or,{path:H.path,diff:Pa,staged:H.staged,fileExists:!!Da,unavailableReason:Fe?.key===`${f}\0${H.path}`?Fe.reason:null,error:rt,onBack:()=>ae({type:"list"}),onRetry:()=>Ze(y=>y+1)});if(H.type==="turn")return n.jsx(or,{path:H.path,subtitle:l("diffView.scope.lastTurn"),diff:_a.get(H.path)??null,fileExists:Hn.some(y=>y.path===H.path),onBack:()=>ae(rs)});const Xn=l(U==="pr"?kn("session.githubIntegration.tabs.pullRequests",Ce):U==="branch"?"diffView.scope.branch":U==="commit"?"commitComparison.mode":U==="turn"?"diffView.scope.lastTurn":"mobile.nav.changes"),Yn=U==="branch"&&Ve.base?rd(Ve.base):U==="commit"?Ke?.slice(0,8):U==="pr"&&Ne?`#${Ne.number}`:null;if(H.type==="walkthrough"&&yn&&f)return n.jsx(R1,{directory:f,target:yn,subtitle:[Xn,Yn].filter(Boolean).join(" · "),revision:JSON.stringify([Kt,U==="pr"?Me.revision:0]),visible:o,onBack:()=>ae(rs)});if(kt&&Be)return n.jsx(or,{path:kt,subtitle:[Xn,Yn].filter(Boolean).join(" · "),commentOrigin:ls,diff:xn??(Be.status==="ready"?Be.diff:null),fileExists:!Me.files||Me.files.some(y=>y.path===kt),error:Me.error??(Be.status==="error"?Be.message:null),onBack:()=>ae(rs),onRetry:()=>{Me.error&&Me.refresh(),us(y=>y+1)},onExpandContextRequest:Be.status==="ready"?y=>Bt({source:Be,request:y}):void 0,pendingContextExpansion:bn,contextLoading:bn!==null&&!xn});const Ha=()=>U==="pr"&&he.diffUnavailable?n.jsx(em,{provider:he.provider,className:"h-full"}):U==="pr"&&!Ne?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 text-center",children:[n.jsx(Nt,{loading:he.loading,message:he.error??(he.loading?l(kn("session.githubPrPicker.loading.pullRequests",Ce)):l(kn("pullRequestComparison.select",Ce)))}),!he.loading&&n.jsx(ji,{mobile:!0,comparison:he})]}):U==="branch"&&!Ve.base?n.jsx(Nt,{loading:!Ve.resolved,message:Ve.resolved?l("gitView.pr.toast.baseBranchRequired"):l("diffView.branch.resolvingBase")}):U==="commit"&&!Ke?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 text-center",children:[Ae.loading&&n.jsx(G,{name:"loader-4",className:"size-5 animate-spin text-muted-foreground"}),n.jsx("p",{className:"typography-ui-label text-muted-foreground",children:Ae.loading?l("diffView.state.loadingChanges"):Ae.error??l("commitComparison.noCommits")}),Ae.error&&n.jsx(Ee,{variant:"outline",size:"lg",onClick:()=>{Ae.refresh()},children:l("diffView.actions.retry")})]}):Me.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:l("diffView.state.failedToLoadDiff")}),n.jsx("p",{className:"typography-meta text-muted-foreground",children:Me.error}),n.jsx(Ee,{variant:"outline",size:"lg",onClick:()=>{Me.refresh()},children:l("diffView.actions.retry")})]}):Xt?Xt.length===0?n.jsx(Nt,{icon:U==="branch",message:U==="pr"?l("walkthrough.blocked.emptyDiff.description"):U==="commit"?l("commitComparison.emptyDiff"):l("diffView.branch.empty",{base:Yn??""})}):n.jsx(Zi,{files:Xt,onSelect:y=>{Me.key&&ae({type:"comparison",path:y,sourceKey:Me.key})}}):n.jsx(Nt,{loading:!0,message:l("diffView.state.loadingChanges")}),Ua=()=>ts?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:l("diffView.state.failedToLoadDiff")}),n.jsx("p",{className:"typography-meta text-muted-foreground",children:ts}),n.jsx(Ee,{variant:"outline",size:"lg",onClick:()=>{is(null),Ys()},children:l("diffView.actions.retry")})]}):!Et&&ze?n.jsx(Nt,{loading:!0,message:l("diffView.state.loadingChanges")}):Hn.length===0?n.jsx(Nt,{message:l("diffView.state.noLastTurnChanges")}):n.jsx(Zi,{files:Hn,onSelect:y=>ae({type:"turn",path:y})});return n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[Zr,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:"-ms-1 flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":l("mobile.surface.closeAria"),onClick:t,style:{touchAction:"manipulation"},children:n.jsx(G,{name:"close",className:"size-5"})}):null,n.jsxs(fr,{open:se,onOpenChange:fe,children:[n.jsx(mr,{asChild:!0,children:n.jsxs(Ee,{variant:"ghost",className:Rc({size:"mobile"}),"data-mobile-comparison-trigger":!0,"aria-label":l("diffView.scope.selectorAria"),children:[n.jsx("span",{children:Xn}),n.jsx(G,{name:"arrow-down-s",className:"size-4"})]})}),n.jsx(pr,{align:"start",children:n.jsxs(Ec,{value:U,onValueChange:y=>{(y==="working"||y==="turn"||y==="branch"||y==="commit"||y==="pr")&&ce(y)},children:[n.jsx(nn,{value:"working",className:"min-h-8 items-center",children:l("mobile.nav.changes")}),n.jsx(nn,{value:"turn",className:"min-h-8 items-center",children:l("diffView.scope.lastTurn")}),yt&&n.jsx(nn,{value:"branch",className:"min-h-8 items-center",children:l("diffView.scope.branch")}),n.jsx(nn,{value:"commit",className:"min-h-8 items-center",children:l("commitComparison.mode")}),n.jsx(nn,{value:"pr",className:"min-h-8 items-center",children:l(kn("session.githubIntegration.tabs.pullRequests",Ce))})]})})]}),ei,o&&U==="branch"&&n.jsx(Qf,{mobile:!0,branches:b?.all??[],currentBranch:Ie,base:Ve.base,automatic:Ve.source!=="chosen",onSelect:y=>{Ie&&xt(f,Ie,y)},onSelectAutomatic:()=>{Ie&&_e(f,Ie)}},JSON.stringify([Q,Ie])),o&&U==="commit"&&n.jsx(Zf,{mobile:!0,commits:Ae.commits,selectedHash:Ke,loading:Ae.loading,error:Ae.error,onSelect:Ae.select,onRefresh:()=>{Ae.refresh()}},JSON.stringify([Q,Ie])),o&&U==="pr"&&n.jsxs(n.Fragment,{children:[n.jsx(ji,{mobile:!0,comparison:he},JSON.stringify([Q,Ie])),Ne&&n.jsx(Ee,{variant:"ghost",size:"sm",disabled:Me.loading,"aria-label":l("session.githubIssuePicker.actions.refresh"),onClick:()=>{Me.refresh()},children:n.jsx(G,{name:"refresh",className:"size-4"})})]}),yn&&n.jsx(Ee,{variant:"ghost",size:"icon",className:"ms-auto shrink-0",onClick:()=>ae({type:"walkthrough"}),"aria-label":l("walkthrough.action.open"),title:l("walkthrough.action.open"),style:{touchAction:"manipulation"},children:n.jsx(G,{name:"route",className:"size-5"})}),U==="working"&&ze&&(g?.files?.length??0)>0?n.jsxs(Ee,{variant:"default",className:ie("shrink-0",!yn&&"ms-auto"),disabled:Jt.submitting,onClick:()=>Gt(!0),"aria-label":l("diffView.actions.reviewAria"),style:{touchAction:"manipulation"},children:[n.jsx(G,{name:Jt.submitting?"loader-4":"search-eye",className:ie("size-4",Jt.submitting&&"animate-spin")}),l("diffView.actions.review")]}):null]}),n.jsx(Ic,{open:as,onOpenChange:Gt,projectDirectory:s||null,submitting:Jt.submitting,onConfirm:Jt.start}),U==="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(id,{currentBranch:g?.current,localBranches:Oa,remoteBranches:Ma,branchInfo:b?.branches,currentBranchAhead:g?.ahead,onCheckout:y=>{La(y)},onCreate:za,disabled:I,directory:f,switchBlockedNotice:(g?.files?.length??0)>0?l("gitView.branch.switchBlockedNotice"):null})}),n.jsx(od,{activeProfile:$t,identities:O,attention:de,triggerClassName:"max-w-[10rem] shrink [&_.git-identity-label]:hidden sm:[&_.git-identity-label]:inline",onOpen:()=>{B(d,A.map(y=>y.account))},onSelect:y=>{C(y)},isApplying:P,onConfigure:()=>E(!0),applicability:y=>{const F=qe.read?.repository.remotes.find(re=>re.name===Rt);return F?ad(y,Tc(F.fetch.displayUrl)):{applicable:!0}}}),n.jsx(ld,{syncAction:Ue.entry?.executing?je:null,remotes:Aa,onFetch:y=>{en("fetch",y)},onPull:y=>{en("pull",y)},onSync:y=>{en("sync",y)},onPublish:()=>{en("publish")},onChooseSyncTargets:()=>{en("sync",void 0,!0)},currentBranch:g?.current,hasTracking:!!g?.tracking,disabled:I||Ue.blocked,aheadCount:g?.ahead??0,behindCount:g?.behind??0,trackingRemoteName:g?.tracking?.split("/")[0],trackingBranch:g?.tracking,hasUncommittedChanges:cd(At),choosesPushDestination:x})]}),n.jsx(Df,{open:v,onOpenChange:E,directory:f}),n.jsx(ud,{className:"mx-3 mt-3",entry:Ue.entry,onRefresh:()=>{Ue.refresh()},onCancel:()=>{Ue.cancel()}}),U==="working"&&n.jsx(Of,{mergeInProgress:g?.mergeInProgress,rebaseInProgress:g?.rebaseInProgress,onContinue:Wa,onAbort:()=>Qr(sn?"merge":"rebase"),onResolveWithAI:Ka,conflictCount:$a,isLoading:je!==null||te!==null}),U==="turn"?n.jsx("div",{className:"min-h-0 flex-1",children:Ua()}):U!=="working"?n.jsx("div",{className:"min-h-0 flex-1",children:Ha()}):At.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-4 pt-4",children:n.jsx(Mf,{groups:Va,diffStats:g?.diffStats,revertingPaths:we,onRevertAll:Xr,isRevertingAll:be,headerBackgroundClassName:"bg-transparent",onVisiblePathsChange:Xe})}),n.jsx("div",{"data-keyboard-rider":"",className:"shrink-0 border-t border-edge bg-background px-4 pb-4 pt-3",children:n.jsx(Lf,{stagedCount:ns.length,commitMessage:oe,onCommitMessageChange:ve,generatedHighlights:Le,onInsertHighlights:Ba,onGenerateMessage:Fa,isGeneratingMessage:V,onCommit:y=>{Yr({pushAfter:!1,origin:y})},onCommitAndPush:y=>{Yr({pushAfter:!0,origin:y})},commitAction:te,networkOperationBlocked:Ue.blocked,gitmojiEnabled:!1,onOpenGitmojiPicker:()=>{}})})]}):n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(M1,{})}),f&&n.jsx(zf,{open:Tt,onOpenChange:Ct,conflictFiles:at,directory:f,operation:pt,onAbort:()=>{Qr(pt)},onNavigatedToChat:i}),n.jsx(Bf,{open:Ge!==null,onOpenChange:y=>{y||nt(null)},targetBranch:Ge??"",changedFileCount:g?.files?.length??0,onCommitAndSwitch:(y,F)=>I1(y,F,{targetBranch:Ge,directory:f,sourceBranch:g?.current??null,git:a,publishChooser:Oe,toast:me,t:l,refreshStatusAndBranches:St,closeDialog:()=>nt(null),performCheckout:vn}),onGenerateMessage:async()=>{if(!f)return"";const y=(g?.files??[]).map(re=>re.path).sort(),{message:F}=await fi(f,y);return F.subject?.trim()??""},onRevertAndSwitch:async()=>{const y=Ge;if(!y||!f)return;await Xr((g?.files??[]).map(re=>re.path));const F=await a.getGitStatus(f);if(!F.isClean&&(F.files?.length??0)>0){me.error(l("gitView.dirtySwitch.revertIncomplete"));return}nt(null),await vn(y)}})]})},Nt=s=>{const e=ne.c(13),{message:t,description:r,loading:o,icon:i}=s,l=o===void 0?!1:o,a=i===void 0?!1:i;let d;e[0]!==l?(d=l?n.jsx(G,{name:"loader-4",className:"size-5 animate-spin text-muted-foreground"}):null,e[0]=l,e[1]=d):d=e[1];let c;e[2]!==a?(c=a?n.jsx(G,{name:"git-branch",className:"size-6 text-muted-foreground"}):null,e[2]=a,e[3]=c):c=e[3];let u;e[4]!==t?(u=n.jsx("p",{className:"typography-ui-label font-semibold text-foreground",children:t}),e[4]=t,e[5]=u):u=e[5];let p;e[6]!==r?(p=r?n.jsx("p",{className:"typography-meta text-muted-foreground",children:r}):null,e[6]=r,e[7]=p):p=e[7];let h;return e[8]!==d||e[9]!==c||e[10]!==u||e[11]!==p?(h=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,c,u,p]})}),e[8]=d,e[9]=c,e[10]=u,e[11]=p,e[12]=h):h=e[12],h},M1=()=>{const s=ne.c(7),{t:e}=ge();let t;s[0]!==e?(t=e("mobile.changes.cleanDescription"),s[0]=e,s[1]=t):t=s[1];const r=Ff(t);let o;s[2]!==e?(o=e("gitView.empty.cleanTitle"),s[2]=e,s[3]=o):o=s[3];let i;return s[4]!==r||s[5]!==o?(i=n.jsx(Nt,{icon:!0,message:o,description:r}),s[4]=r,s[5]=o,s[6]=i):i=s[6],i},or=s=>{const e=ne.c(75),{path:t,subtitle:r,diff:o,staged:i,fileExists:l,unavailableReason:a,error:d,onBack:c,onRetry:u,onExpandContextRequest:p,pendingContextExpansion:h,contextLoading:f,commentOrigin:g}=s,x=i===void 0?!1:i,b=a===void 0?null:a,w=d===void 0?null:d,{t:v}=ge();let E;e[0]!==t?(E=_c(t)||"text",e[0]=t,e[1]=E):E=e[1];const P=E,_=He(L1),A=He(z1);let k;e[2]!==_||e[3]!==v?(k=v(_?"diffView.whitespace.hidden":"diffView.whitespace.shown"),e[2]=_,e[3]=v,e[4]=k):k=e[4];const S=k;let N;e[5]!==g||e[6]!==t?(N={fileLabel:t,origin:g},e[5]=g,e[6]=t,e[7]=N):N=e[7];const M=rm(N);let B;e[8]!==v?(B=v("header.actions.backAria"),e[8]=v,e[9]=B):B=e[9];let O;e[10]===Symbol.for("react.memo_cache_sentinel")?(O=n.jsx(G,{name:"arrow-left",className:"size-5"}),e[10]=O):O=e[10];let C;e[11]!==c||e[12]!==B?(C=n.jsx("button",{type:"button",className:"flex size-9 shrink-0 items-center justify-center rounded-lg text-muted-foreground hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":B,onClick:c,children:O}),e[11]=c,e[12]=B,e[13]=C):C=e[13];let L;e[14]!==t?(L=n.jsx("h2",{className:"typography-ui-header",children:n.jsx(Ho,{path:t})}),e[14]=t,e[15]=L):L=e[15];let I;e[16]!==r?(I=r&&n.jsx("p",{className:"truncate typography-meta text-muted-foreground",children:r}),e[16]=r,e[17]=I):I=e[17];let j;e[18]!==L||e[19]!==I?(j=n.jsxs("div",{className:"min-w-0 flex-1 px-2",children:[L,I]}),e[18]=L,e[19]=I,e[20]=j):j=e[20];const R=_?"text-foreground":"text-muted-foreground";let T;e[21]!==R?(T=ie("flex size-9 shrink-0 items-center justify-center rounded-lg hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",R),e[21]=R,e[22]=T):T=e[22];let $;e[23]!==v?($=v("diffView.actions.hideWhitespace"),e[23]=v,e[24]=$):$=e[24];let W;e[25]!==_||e[26]!==A?(W=()=>A(!_),e[25]=_,e[26]=A,e[27]=W):W=e[27];let q;e[28]!==_?(q=n.jsx(C1,{hidden:_,className:"size-5"}),e[28]=_,e[29]=q):q=e[29];let D;e[30]!==_||e[31]!==T||e[32]!==$||e[33]!==W||e[34]!==q||e[35]!==S?(D=n.jsx("button",{type:"button",className:T,"aria-label":$,"aria-pressed":_,title:S,onClick:W,children:q}),e[30]=_,e[31]=T,e[32]=$,e[33]=W,e[34]=q,e[35]=S,e[36]=D):D=e[36];const z=M.isOpen?"text-foreground":"text-muted-foreground";let J;e[37]!==z?(J=ie("flex size-9 shrink-0 items-center justify-center rounded-lg hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",z),e[37]=z,e[38]=J):J=e[38];let ee;e[39]!==v?(ee=v("inlineComment.actions.commentOnFile"),e[39]=v,e[40]=ee):ee=e[40];const Q=M.isOpen;let Y;e[41]!==v?(Y=v("inlineComment.actions.commentOnFile"),e[41]=v,e[42]=Y):Y=e[42];let K;e[43]===Symbol.for("react.memo_cache_sentinel")?(K=n.jsx(G,{name:"chat-1",className:"size-5"}),e[43]=K):K=e[43];let Z;e[44]!==J||e[45]!==ee||e[46]!==Y||e[47]!==M.isOpen||e[48]!==M.toggle?(Z=n.jsx("button",{type:"button",className:J,"aria-label":ee,"aria-pressed":Q,title:Y,onClick:M.toggle,children:K}),e[44]=J,e[45]=ee,e[46]=Y,e[47]=M.isOpen,e[48]=M.toggle,e[49]=Z):Z=e[49];let U;e[50]!==j||e[51]!==D||e[52]!==Z||e[53]!==C?(U=n.jsxs("header",{className:"flex h-[var(--oc-header-height,56px)] shrink-0 items-center gap-3 border-b border-edge px-3 text-foreground",children:[C,j,D,Z]}),e[50]=j,e[51]=D,e[52]=Z,e[53]=C,e[54]=U):U=e[54];let H;e[55]!==g||e[56]!==f||e[57]!==o||e[58]!==w||e[59]!==l||e[60]!==_||e[61]!==P||e[62]!==p||e[63]!==u||e[64]!==t||e[65]!==h||e[66]!==x||e[67]!==v||e[68]!==b?(H=n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:l?b==="nested_repository"?n.jsx(Nt,{icon:!0,message:v("diffView.unavailable.nestedRepositoryTitle"),description:v("diffView.unavailable.nestedRepositoryDescription")}):b==="untracked_directory"?n.jsx(Nt,{icon:!0,message:v("diffView.unavailable.untrackedDirectoryTitle"),description:v("diffView.unavailable.untrackedDirectoryDescription")}):w?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:v("mobile.changes.diffDetail.loadFailed")}),n.jsx("p",{className:"typography-meta text-muted-foreground",children:w}),n.jsx(Ee,{type:"button",size:"sm",variant:"outline",onClick:()=>u?.(),children:v("diffView.actions.retry")})]})}):o?o.submodule?n.jsx("div",{className:"p-3",children:n.jsx(Af,{state:o.submodule,staged:x})}):o.isBinary?n.jsx(Nt,{icon:!0,message:v("diffView.binary.unavailable")}):Ac(t)&&!o.fileDiff?n.jsx(Nt,{icon:!0,message:v("mobile.changes.diffDetail.imageUnavailable")}):n.jsx(Ut,{outerClassName:"h-full",className:"p-3",useScrollShadow:!0,disableHorizontal:!0,"data-diff-virtual-root":!0,"data-diff-virtual-content":!0,children:n.jsx(sm,{original:o.original,modified:o.modified,fileDiff:o.fileDiff,language:P,fileName:t,commentOrigin:g,renderSideBySide:!1,wrapLines:!0,hideWhitespace:_,layout:"inline",onExpandContextRequest:p,pendingContextExpansion:h,contextLoading:f})}):n.jsx(Nt,{loading:!0,message:v("diffView.state.loadingDiff")}):n.jsx(Nt,{icon:!0,message:v("mobile.changes.diffDetail.missingTitle"),description:v("mobile.changes.diffDetail.missingDescription")})}),e[55]=g,e[56]=f,e[57]=o,e[58]=w,e[59]=l,e[60]=_,e[61]=P,e[62]=p,e[63]=u,e[64]=t,e[65]=h,e[66]=x,e[67]=v,e[68]=b,e[69]=H):H=e[69];let se;return e[70]!==U||e[71]!==H||e[72]!==M.cards||e[73]!==M.editor?(se=n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[U,M.cards,M.editor,H]}),e[70]=U,e[71]=H,e[72]=M.cards,e[73]=M.editor,e[74]=se):se=e[74],se},Zi=s=>{const e=ne.c(12),{files:t,onSelect:r}=s,{t:o}=ge();let i;e[0]!==o?(i=o("gitView.changes.changedFilesAria"),e[0]=o,e[1]=i):i=e[1];let l;if(e[2]!==t||e[3]!==r||e[4]!==o){let d;e[6]!==r||e[7]!==o?(d=c=>{const u=c.status==="A"?o("diffView.change.new"):c.status==="D"?o("diffView.change.deleted"):c.status==="R"?o("diffView.change.renamed"):c.status==="C"?o("diffView.change.copied"):o("diffView.change.modified"),p=c.status==="A"?"var(--status-success)":c.status==="D"?"var(--status-error)":c.status==="R"||c.status==="C"?"var(--status-info)":"var(--status-warning)";return n.jsx("li",{children:n.jsxs(Ee,{variant:"ghost",size:"lg",className:"w-full justify-start gap-2.5 text-start normal-case",onClick:()=>r(c.path),children:[n.jsx("span",{className:"w-4 shrink-0 text-center typography-meta font-semibold uppercase",style:{color:p},"aria-label":u,children:c.status}),n.jsx(Bo,{filePath:c.path,className:"size-4 shrink-0"}),n.jsx(Ho,{path:c.path,className:"flex-1 typography-ui-label"}),(c.insertions>0||c.deletions>0)&&n.jsxs("span",{className:"shrink-0 typography-meta text-muted-foreground",children:["+",c.insertions," -",c.deletions]}),n.jsx(G,{name:"arrow-right-s",className:"size-4 shrink-0 text-muted-foreground"})]})},c.path)},e[6]=r,e[7]=o,e[8]=d):d=e[8],l=t.map(d),e[2]=t,e[3]=r,e[4]=o,e[5]=l}else l=e[5];let a;return e[9]!==i||e[10]!==l?(a=n.jsx(Ut,{outerClassName:"h-full",className:"px-3 py-2",useScrollShadow:!0,disableHorizontal:!0,children:n.jsx("ul",{"aria-label":i,className:"flex flex-col gap-1",children:l})}),e[9]=i,e[10]=l,e[11]=a):a=e[11],a};function L1(s){return s.diffHideWhitespace}function z1(s){return s.setDiffHideWhitespace}const B1=m.lazy(()=>dn(()=>import("./FilesView-D00Dnc8i.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,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])).then(s=>({default:s.FilesView}))),Qt=s=>pn(s)??"",cn=s=>{const e=Qt(s);return!e||e==="/"?e||"/":e.split("/").filter(Boolean).at(-1)??e},F1=s=>{const e=Qt(s);if(!e||e==="/")return null;const t=e.lastIndexOf("/");return t<=0?e.startsWith("/")?"/":null:e.slice(0,t)},$1=(s,e)=>{const t=Qt(s),r=Qt(e);return!r||t===r?cn(t):t.startsWith(`${r}/`)?t.slice(r.length+1):t},W1=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 r of e){if(t<1024||r===e[e.length-1])return`${t.toFixed(t>=10?0:1)} ${r}`;t/=1024}return""},K1=s=>{const e=ne.c(5),{onClose:t,visible:r}=s,o=r===void 0?!0:r,i=Mo(),l=Qt(Lo(i,Ir()));if(i?.kind==="preparing"){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Wo,{}),e[0]=d):d=e[0],d}let a;return e[1]!==t||e[2]!==l||e[3]!==o?(a=n.jsx(V1,{root:l,onClose:t,visible:o},l),e[1]=t,e[2]=l,e[3]=o,e[4]=a):a=e[4],a},V1=({root:s,onClose:e,visible:t})=>{const{t:r}=ge(),{files:o}=Cr(),i=ul(),l=dl(K=>K.setSelectedPath),[a,d]=m.useState(()=>({type:"browser",directory:s})),[c,u]=m.useState([]),[p,h]=m.useState(!1),[f,g]=m.useState(null),[x,b]=m.useState(""),[w,v]=m.useState([]),[E,P]=m.useState(!1),_=m.useRef(0),A=a.type==="browser"?a.directory:a.returnDirectory,k=m.useRef(A);k.current=A;const S=m.useCallback(async(K,Z)=>{if(!K)return;const U=!i,H=_.current+1;_.current=H,h(!0),Z?.background||g(null);try{const se=await o.listDirectory(K,{respectGitignore:U});if(_.current!==H)return;g(null),u(se.entries.slice().sort((fe,ce)=>fe.isDirectory!==ce.isDirectory?fe.isDirectory?-1:1:fe.name.localeCompare(ce.name)))}catch(se){if(_.current!==H)return;if(Z?.background){console.error("Failed to reload mobile directory:",se);return}u([]),g(se instanceof Error?se.message:r("mobile.files.error.listFailed"))}finally{_.current===H&&h(!1)}},[o,i,r]);m.useEffect(()=>{a.type==="browser"&&S(a.directory)},[S,a]);const N=m.useRef(a);N.current=a;const M=m.useRef(c);M.current=c;const B=m.useCallback(({directories:K})=>{const Z=N.current;Z.type==="browser"&&(K&&!K.some(U=>Qt(U)===Qt(Z.directory))||M.current.length>pd||S(Z.directory,{background:!0}))},[S]);hd({root:s,active:t,whileInactive:"hold",onChanges:B});const O=m.useCallback(async K=>{Qt(K)===Qt(k.current)&&await S(k.current)},[S]),{canUpload:C,uploadingDirectory:L,pickFiles:I,uploadElements:j}=gd({root:s,refreshDirectory:O}),R=L!==null;m.useEffect(()=>{if(a.type!=="browser")return;const K=x.trim();if(!K){v([]),P(!1);return}let Z=!1;const U=window.setTimeout(()=>{P(!0),o.search({directory:a.directory,query:K,maxResults:40}).then(H=>{Z||v(H)}).catch(()=>{Z||v([])}).finally(()=>{Z||P(!1)})},250);return()=>{Z=!0,window.clearTimeout(U)}},[o,x,a]);const T=K=>{b(""),d({type:"browser",directory:K})},$=K=>{l(s,K),d({type:"file",path:K,returnDirectory:A||s})},W=He(K=>K.pendingFileFocusPath),q=He(K=>K.pendingFileNavigation);if(m.useEffect(()=>{const K=Qt(q?.path??W??"");!K||!s||(l(s,K,{allowOutsideRoot:!0}),d(Z=>({type:"file",path:K,returnDirectory:Z.type==="file"?Z.returnDirectory:s})),W&&He.getState().setPendingFileFocusPath(null))},[W,q,s,l]),!s)return n.jsx(un,{message:r("mobile.files.empty.noDirectory")});if(a.type==="file")return n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[n.jsxs("header",{className:"flex h-[var(--oc-header-height,56px)] shrink-0 items-center gap-2 border-b border-edge px-3 text-foreground",children:[n.jsx("button",{type:"button",className:"-ms-1 flex size-10 shrink-0 items-center justify-center rounded-lg text-muted-foreground hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":r("header.actions.backAria"),onClick:()=>d({type:"browser",directory:a.returnDirectory}),style:{touchAction:"manipulation"},children:n.jsx(yi,{className:"size-5"})}),n.jsx("div",{className:"min-w-0 flex-1",children:n.jsx("h2",{className:"truncate typography-ui-header text-foreground",children:cn(a.path)})})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:n.jsx(ft,{children:n.jsx(m.Suspense,{fallback:n.jsx(un,{loading:!0,message:r("filesView.state.loading")}),children:n.jsx(B1,{mode:"editor-only"})})})})]});const D=a.directory===s?r("mobile.files.rootDirectory"):cn(a.directory),z=x.trim()?w:[],J=F1(a.directory),ee=a.directory!==s&&J!==null&&(J===s||J.startsWith(`${s}/`)),Q=ee&&!x.trim(),Y=ee?J:null;return n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[j,n.jsxs("header",{className:"flex h-[var(--oc-header-height,56px)] shrink-0 items-center gap-2 px-3 text-foreground",children:[e?n.jsx("button",{type:"button",className:"-ms-1 flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":r("mobile.surface.closeAria"),onClick:e,style:{touchAction:"manipulation"},children:n.jsx(ff,{className:"size-5"})}):null,Q&&Y?n.jsx("button",{type:"button",className:"flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":r("mobile.files.backToParentAria",{name:cn(Y)}),onClick:()=>T(Y),style:{touchAction:"manipulation"},children:n.jsx(yi,{className:"size-5"})}):null,n.jsx("div",{className:"min-w-0 flex-1 px-1",children:n.jsx("h2",{className:"truncate typography-ui-label text-foreground",children:D})}),n.jsx("button",{type:"button",className:"flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":r("mobile.files.refreshAria"),onClick:()=>{S(a.directory)},style:{touchAction:"manipulation"},children:n.jsx(mf,{className:ie("size-5",p&&"animate-spin")})}),C?n.jsx("button",{type:"button",className:"flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50","aria-label":r("sidebarFilesTree.actions.uploadFilesTitle"),onClick:()=>I(a.directory),disabled:R,style:{touchAction:"manipulation"},children:n.jsx(G,{name:R?"loader-4":"upload-2",className:ie("size-5",R&&"animate-spin")})}):null]}),n.jsx("div",{className:"shrink-0 px-4 pb-2 pt-1",children:n.jsxs("div",{className:"relative",children:[n.jsx(pf,{className:"pointer-events-none absolute inset-s-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),n.jsx(Po,{value:x,onChange:K=>b(K.target.value),placeholder:r("mobile.files.search.placeholder"),className:"h-11 ps-9"})]})}),n.jsx(Ut,{outerClassName:"min-h-0 flex-1",className:"px-4 pb-3",useScrollShadow:!0,disableHorizontal:!0,children:f?n.jsx(un,{message:f}):x.trim()?n.jsx(H1,{root:s,results:z,isSearching:E,onOpenFile:$}):n.jsxs("div",{className:"overflow-hidden rounded-2xl border border-edge bg-[var(--surface-elevated)]",children:[c.length===0&&!p?n.jsx("div",{className:"px-4 py-8 text-center typography-ui-label text-muted-foreground",children:r("mobile.files.empty.directory")}):null,c.map(K=>n.jsx(Ea,{name:K.name,path:K.path,directory:K.isDirectory,meta:K.isDirectory?void 0:W1(K.size),onClick:()=>K.isDirectory?T(K.path):$(K.path)},K.path))]})})]})},Ea=s=>{const e=ne.c(16),{name:t,path:r,directory:o,meta:i,onClick:l}=s;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={touchAction:"manipulation"},e[0]=a):a=e[0];let d;e[1]!==o||e[2]!==r?(d=o?n.jsx(bf,{className:"size-5 shrink-0 text-primary/80"}):n.jsx(Bo,{filePath:r,className:"size-5 shrink-0"}),e[1]=o,e[2]=r,e[3]=d):d=e[3];let c;e[4]!==t?(c=n.jsx("span",{className:"block min-w-0 flex-1 truncate typography-ui-label text-foreground",children:t}),e[4]=t,e[5]=c):c=e[5];let u;e[6]!==i?(u=i?n.jsx("span",{className:"shrink-0 typography-micro text-muted-foreground",children:i}):null,e[6]=i,e[7]=u):u=e[7];let p;e[8]!==o?(p=o?n.jsx(xf,{className:"size-4 shrink-0 text-muted-foreground"}):null,e[8]=o,e[9]=p):p=e[9];let h;return e[10]!==l||e[11]!==d||e[12]!==c||e[13]!==u||e[14]!==p?(h=n.jsxs("button",{type:"button",className:"flex min-h-14 w-full items-center gap-3 border-b border-edge px-3 py-2.5 text-start transition-colors last:border-b-0 hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",onClick:l,style:a,children:[d,c,u,p]}),e[10]=l,e[11]=d,e[12]=c,e[13]=u,e[14]=p,e[15]=h):h=e[15],h},H1=s=>{const e=ne.c(17),{root:t,results:r,isSearching:o,onOpenFile:i}=s,{t:l}=ge();if(o){let c;e[0]!==l?(c=l("common.loading"),e[0]=l,e[1]=c):c=e[1];let u;return e[2]!==c?(u=n.jsx(un,{loading:!0,message:c}),e[2]=c,e[3]=u):u=e[3],u}if(r.length===0){let c;e[4]!==l?(c=l("mobile.files.search.empty"),e[4]=l,e[5]=c):c=e[5];let u;return e[6]!==c?(u=n.jsx(un,{message:c}),e[6]=c,e[7]=u):u=e[7],u}let a;if(e[8]!==i||e[9]!==r||e[10]!==t){let c;e[12]!==i||e[13]!==t?(c=u=>n.jsx(Ea,{name:cn(u.path),path:u.path,directory:!1,meta:$1(u.path,t),onClick:()=>i(u.path)},u.path),e[12]=i,e[13]=t,e[14]=c):c=e[14],a=r.map(c),e[8]=i,e[9]=r,e[10]=t,e[11]=a}else a=e[11];let d;return e[15]!==a?(d=n.jsx("div",{className:"overflow-hidden rounded-2xl border border-edge bg-[var(--surface-elevated)]",children:a}),e[15]=a,e[16]=d):d=e[16],d},un=s=>{const e=ne.c(7),{message:t,loading:r}=s,o=r===void 0?!1:r;let i;e[0]!==o?(i=o?n.jsx(hf,{className:"size-5 animate-spin text-muted-foreground"}):n.jsx(gf,{className:"size-6 text-muted-foreground"}),e[0]=o,e[1]=i):i=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 a;return e[4]!==i||e[5]!==l?(a=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:[i,l]})}),e[4]=i,e[5]=l,e[6]=a):a=e[6],a},U1=s=>{const e=ne.c(21),{visible:t,onLeave:r,sectionsDialogOpen:o,onSectionsDialogOpenChange:i}=s,{t:l}=ge(),a=ot(q1),d=Ir()??null,c=Lc(),[u,p]=m.useState(1);let h,f;e[0]!==t?(h=()=>{t&&p(G1)},f=[t],e[0]=t,e[1]=h,e[2]=f):(h=e[1],f=e[2]),m.useEffect(h,f);const g=!c.allSectionsHidden&&u===0;let x;e[3]!==d||e[4]!==c||e[5]!==r||e[6]!==a||e[7]!==t?(x=t&&!c.allSectionsHidden?n.jsx(zc.Provider,{value:r,children:n.jsx(Bc.Provider,{value:!0,children:n.jsx(Fc,{onChange:p,children:n.jsx(Ut,{useScrollShadow:!0,scrollShadowSize:24,outerClassName:"min-h-0 flex-1",className:"px-3 pb-4 pt-2",disableHorizontal:!0,children:n.jsx($c,{sessionId:a,directory:d,repositoryEnabled:!kr(d),layout:c})})})})}):null,e[3]=d,e[4]=c,e[5]=r,e[6]=a,e[7]=t,e[8]=x):x=e[8];let b;e[9]!==c.allSectionsHidden||e[10]!==i||e[11]!==g||e[12]!==l?(b=c.allSectionsHidden||g?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:c.allSectionsHidden?l("chat.workStatus.sections.allHidden"):l("chat.workStatus.mobileEmpty")}),c.allSectionsHidden?n.jsx(Ee,{variant:"link",size:"sm",onClick:()=>i(!0),className:"mt-2 normal-case text-muted-foreground hover:text-foreground",children:l("chat.workStatus.sections.open")}):null]}):null,e[9]=c.allSectionsHidden,e[10]=i,e[11]=g,e[12]=l,e[13]=b):b=e[13];let w;e[14]!==i||e[15]!==o?(w=n.jsx(Wc,{open:o,onOpenChange:i}),e[14]=i,e[15]=o,e[16]=w):w=e[16];let v;return e[17]!==x||e[18]!==b||e[19]!==w?(v=n.jsxs("div",{className:"relative flex h-full min-h-0 flex-col",children:[x,b,w]}),e[17]=x,e[18]=b,e[19]=w,e[20]=v):v=e[20],v};function q1(s){return s.currentSessionId}function G1(s){return Math.max(s,1)}const eo="mobile-surface-root",J1=16,to=320,X1="cubic-bezier(0.22, 1, 0.36, 1)",Y1=({open:s,onClose:e,tab:t,onTabChange:r,pendingChangesDiff:o,onOpenPlan:i,variant:l="drawer"})=>{const{t:a,direction:d}=ge(),c=m.useRef(null),u=m.useRef(null),[p,h]=m.useState(!1),[f,g]=m.useState(s),x=m.useRef(e);m.useEffect(()=>{x.current=e},[e]);const b=He(I=>I.mobileWorkspaceTabOrder),w=He(I=>I.mobileWorkspaceHiddenTabs),v=He(I=>I.setMobileWorkspaceTabOrder),[E,P]=m.useState(!1),_=m.useRef(t);m.useEffect(()=>{_.current=t},[t]);const A=()=>x.current();Gr(u,{enabled:l==="drawer"&&s,...d==="rtl"?{onRightEdgeSwipe:A}:{onLeftEdgeSwipe:A}});const[k,S]=m.useState(()=>new Set);if(m.useEffect(()=>{s&&S(I=>{if(I.has(t))return I;const j=new Set(I);return j.add(t),j})},[s,t]),typeof document<"u"&&!c.current){let I=document.getElementById(eo);I||(I=document.createElement("div"),I.id=eo,document.body.appendChild(I)),c.current=I}if(m.useEffect(()=>{if(s){g(!0);const j=window.setTimeout(()=>h(!0),J1);return()=>window.clearTimeout(j)}h(!1);const I=window.setTimeout(()=>g(!1),to+40);return()=>window.clearTimeout(I)},[s]),m.useEffect(()=>{if(!s)return;const I=document.body.style.overflow;l==="drawer"&&(document.body.style.overflow="hidden");const j=R=>{R.key!=="Escape"||_.current==="terminal"||Vc(R.target)||Rr(R)||x.current()};return document.addEventListener("keydown",j),()=>{l==="drawer"&&(document.body.style.overflow=I),document.removeEventListener("keydown",j)}},[s,l]),l==="drawer"&&!c.current)return null;const N={status:{id:"status",label:a("chat.workStatus.ariaLabel"),icon:n.jsx(G,{name:"list-indefinite",className:"h-3.5 w-3.5"})},changes:{id:"changes",label:a("mobile.menu.git"),icon:n.jsx(G,{name:"git-branch",className:"h-3.5 w-3.5"})},files:{id:"files",label:a("mobile.menu.files"),icon:n.jsx(G,{name:"file-text",className:"h-3.5 w-3.5"})},terminal:{id:"terminal",label:a("mobile.menu.terminal"),icon:n.jsx(G,{name:"terminal",className:"h-3.5 w-3.5"})},notes:{id:"notes",label:a("contextRail.surface.notes"),icon:n.jsx(G,{name:"sticky-note",className:"h-3.5 w-3.5"})}},M=fl(b,w,t),B=M.map(I=>N[I]),O=B.length===1?B[0]:null,C=(I,j)=>{const R=ml(b),T=R.findIndex(W=>W===I),$=R.findIndex(W=>W===j);T<0||$<0||v(af(R,T,$))},L=n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex h-[var(--oc-header-height,56px)] shrink-0 items-center gap-2 px-3",children:[n.jsx("div",{className:"flex h-9 min-w-0 flex-1 items-center",children:O?n.jsxs("h2",{className:"flex min-w-0 items-center gap-2 px-1 typography-ui-header font-semibold text-foreground",children:[n.jsx("span",{className:"flex shrink-0 text-muted-foreground",children:O.icon}),n.jsx("span",{className:"truncate",children:O.label})]}):f?n.jsx(Kc,{items:B,activeId:t,onSelect:I=>{const j=M.find(R=>R===I);j&&r(j)},onReorder:C,layoutMode:"fit",variant:"active-pill",nonCompositedIndicator:!0,inactiveTabsIconOnly:B.length>3,className:"h-full"}):null}),t==="status"?n.jsx("button",{type:"button",className:"flex size-10 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":a("chat.workStatus.sections.open"),onClick:()=>P(!0),style:{touchAction:"manipulation"},children:n.jsx(G,{name:"equalizer-2",className:"size-5"})}):null,n.jsx("button",{type:"button",className:"-me-1 flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":a("mobile.surface.closeAria"),onClick:e,style:{touchAction:"manipulation"},children:n.jsx(G,{name:"close",className:"size-5"})})]}),n.jsxs("div",{className:"min-h-0 flex-1 overflow-hidden",children:[k.has("status")?n.jsx("div",{className:ie("h-full",t!=="status"&&"hidden"),children:n.jsx(ft,{children:n.jsx(U1,{visible:s&&t==="status",onLeave:e,sectionsDialogOpen:E,onSectionsDialogOpenChange:P})})}):null,k.has("changes")?n.jsx("div",{className:ie("h-full",t!=="changes"&&"hidden"),children:n.jsx(ft,{children:n.jsx(D1,{visible:s&&t==="changes",initialDiff:o,onNavigatedToChat:e})})},o?`changes:${o.path}:${o.staged}`:"changes"):null,k.has("files")?n.jsx("div",{className:ie("h-full",t!=="files"&&"hidden"),children:n.jsx(ft,{children:n.jsx(K1,{visible:s&&t==="files"})})}):null,k.has("terminal")?n.jsx("div",{className:ie("h-full",t!=="terminal"&&"hidden"),children:n.jsx(ft,{children:n.jsx(bd,{visible:s&&t==="terminal"})})}):null,k.has("notes")?n.jsx("div",{className:ie("h-full",t!=="notes"&&"hidden"),children:n.jsx(ft,{children:n.jsx(xd,{visible:s&&t==="notes",onActionComplete:e,onOpenPlan:i})})}):null]})]});return l==="panel"?n.jsx("div",{className:"flex h-full min-h-0 flex-col bg-background text-foreground",children:L}):Ls.createPortal(n.jsx("section",{ref:u,role:"dialog","aria-modal":"true","aria-label":a("mobile.header.openWorkspaceAria"),"aria-hidden":!s,className:"oc-keyboard-inset-surface oc-bottom-safe-surface fixed inset-0 z-50 flex flex-col bg-background text-foreground",style:{paddingTop:"var(--oc-safe-area-top, 0px)",transform:p?"none":d==="rtl"?"translateX(-100%)":"translateX(100%)",transition:`transform ${to}ms ${X1}`,visibility:f?"visible":"hidden",pointerEvents:s?"auto":"none"},children:L}),c.current)};function Q1(s){const e=ne.c(4),t=2500,{uiFont:r}=Hc(),[o,i]=m.useState(!1);let l,a;return e[0]!==t||e[1]!==r?(l=()=>{let d=!1;const c=()=>{d||i(!0)},u=()=>{requestAnimationFrame(()=>requestAnimationFrame(c))},p=Promise.all([Uc(r).catch(ng),document.fonts?.ready?.then(sg).catch(tg)??Promise.resolve(),im.catch(eg)]).then(Z1),h=new Promise(f=>{window.setTimeout(f,t)});return Promise.race([p,h]).then(u),()=>{d=!0}},a=[r,t],e[0]=t,e[1]=r,e[2]=l,e[3]=a):(l=e[2],a=e[3]),m.useEffect(l,a),o}function Z1(){}function eg(){}function tg(){}function sg(){}function ng(){}const rg=_r({projectId:Fs().trim().min(1).optional(),text:Fs().optional()}),ig=_r({request:rg.nullish()}),Ia=Ko("ShortcutRequests"),og=async()=>{const s=ig.safeParse(await Ia.takePending());return s.success?s.data.request??null:null},ag=s=>{if(jr()!=="ios")return()=>{};let e=!1,t=null;const r=()=>{og().then(o=>{o&&s(o)}).catch(()=>{})};return Ia.addListener("pending",r).then(o=>{if(e){o.remove();return}t=o}).catch(()=>{}),r(),()=>{e=!0,t?.remove()}},lg="openchamber",cg=s=>s.replace(/^\/+|\/+$/g,""),ug=s=>{const e=cg(s.pathname).split("/").filter(Boolean);return s.host?[s.host,...e]:e};function dg(s){if(typeof s!="string"||s.length===0)return null;let e;try{e=new URL(s)}catch{return null}if(e.protocol!==`${lg}:`)return null;const t=ug(e),r=(t[0]??"").toLowerCase(),o=t.slice(1),i=e.searchParams;switch(r){case"session":{const l=o[0]||i.get("id")||"";if(!l)return null;const a=i.get("message")?.trim()??"";return{type:"session",sessionId:l,directory:i.get("dir")??void 0,...qc(a)?{messageId:a}:{}}}case"new":case"new-session":return{type:"new-session",directory:i.get("dir")??void 0,projectId:i.get("project")??void 0,agent:i.get("agent")??void 0,model:i.get("model")??void 0};case"sessions":{const l=i.get("filter");return{type:"sessions",filter:l==="attention"||l==="recent"||l==="all"?l:void 0}}case"status":return{type:"status"};case"settings":return{type:"settings",section:o[0]||i.get("section")||void 0};case"changes":return{type:"changes",path:o.join("/")||i.get("path")||void 0,staged:i.get("staged")==="true"};case"view":{const l=(o[0]||"").toLowerCase();return l==="changes"?{type:"changes"}:l==="files"||l==="mcp"||l==="instances"||l==="update"?{type:"view",target:l}:null}default:return null}}let Dt={},Ta=!1,ln=null;const fg=s=>{const e=ot.getState(),t=s.projectId?Lt.getState().projects.find(o=>o.id===s.projectId)??null:null;e.openNewSessionDraft(t?{selectedProjectId:t.id}:void 0);const r=s.text?.trim();if(r){if(s.projectId&&!t){mi.getState().setPendingInputText(r,"append");return}mi.getState().requestDraftSubmit(ot.getState().newSessionDraft.draftId,r)}},mg=s=>{switch(s.type){case"shortcut-new-session":return fg(s),!0;case"session":return Gc(s.sessionId,{directory:s.directory??null,messageId:s.messageId??null}),!0;case"new-session":{const e=ot.getState();return e.openNewSessionDraft(),(s.directory||s.projectId)&&e.setNewSessionDraftTarget({directoryOverride:s.directory??null,projectId:s.projectId??null,selectedProjectId:s.projectId??null}),!0}case"sessions":return Dt.openSessions?(Dt.openSessions(s.filter),!0):!1;case"status":return Dt.openSessions?(Dt.openSessions(),!0):!1;case"view":return Dt.openView?(Dt.openView(s.target),!0):!1;case"changes":return Dt.openChanges?(Dt.openChanges({path:s.path,staged:s.staged}),!0):!1;case"settings":return Dt.openSettings?(Dt.openSettings(s.section),!0):!1}},Jr=()=>{if(!Ta||!ln)return;const s=ln;ln=null,mg(s)||(ln=s)},wr=s=>{ln=s,Jr()},so=s=>{const e=dg(s);e&&wr(e)},pg=s=>{Ta=s,Jr()},hg=s=>{const e=ne.c(3);let t,r;e[0]!==s?(t=()=>(Dt=s,Jr(),()=>{Dt===s&&(Dt={})}),r=[s],e[0]=s,e[1]=t,e[2]=r):(t=e[1],r=e[2]),m.useEffect(t,r)},gg=s=>{const{ready:e}=s;m.useEffect(()=>{pg(e)},[e]),m.useEffect(()=>{if(!ct())return;let t=!1;const r=[];return dn(()=>import("./vendor-capacitor-app-BrDJj9I_.js"),__vite__mapDeps([216,4,108])).then(async({App:o})=>{if(t)return;const i=await o.addListener("appUrlOpen",l=>{so(l?.url)});if(t){i.remove();return}r.push(()=>{i.remove()})}).catch(()=>{}),r.push(ag(o=>{wr({type:"shortcut-new-session",projectId:o.projectId,text:o.text})})),dn(()=>import("./vendor-capacitor-push-notifications-KNe1zSBF.js"),__vite__mapDeps([217,108])).then(async({PushNotifications:o})=>{if(t)return;const i=await o.addListener("pushNotificationActionPerformed",l=>{const a=l?.notification?.data,d=typeof a?.url=="string"?a.url:typeof a?.deeplink=="string"?a.deeplink:void 0;if(d){so(d);return}const c=typeof a?.sessionId=="string"?a.sessionId:void 0;c&&wr({type:"session",sessionId:c})});if(t){i.remove();return}r.push(()=>{i.remove()})}).catch(()=>{}),()=>{t=!0,r.forEach(o=>o())}},[])},bg=()=>{if(typeof window>"u")return;const s=window.__OPENCHAMBER_APNS_ENV__;if(s==="development")return"sandbox";if(s==="production")return"production"},no=/^[A-Za-z0-9+/]{43}=$/,xg=Ko("PushKey"),yg=async()=>{const s=window.__OPENCHAMBER_PUSH_KEY__;if(s&&no.test(s))return s;const e=await xg.get().then(t=>t.key).catch(()=>{});return e&&no.test(e)?e:void 0},vg=()=>{if(typeof window>"u")return!1;const e=window.Capacitor?.getPlatform?.();return e==="ios"||e==="android"},wg=s=>{const{enabled:e}=s,t=He(o=>o.nativeNotificationsEnabled),r=m.useRef(null);m.useEffect(()=>{if(!e||!t||!vg())return;let o=!1;const i=[];return dn(()=>import("./vendor-capacitor-push-notifications-KNe1zSBF.js"),__vite__mapDeps([217,108])).then(async({PushNotifications:l})=>{if(o)return;let a=await l.checkPermissions().catch(()=>null);if(a?.receive!=="granted"&&(a=await l.requestPermissions().catch(()=>null)),a?.receive!=="granted")return;const d=await l.addListener("registration",u=>{r.current=u.value,yg().then(p=>{const h=ri(),f={token:u.value,platform:jr(),environment:bg()};p&&(f.pushKey=p),h?.push?.registerApnsToken?.(f)})}),c=await l.addListener("registrationError",u=>{console.warn("[Push] APNs registration error:",u)});if(await l.register().catch(()=>{}),o){d.remove(),c.remove();return}i.push(()=>{d.remove()},()=>{c.remove()})}).catch(()=>{}),()=>{o=!0,i.forEach(l=>l())}},[e,t]),m.useEffect(()=>{if(t)return;const o=r.current;if(!o)return;r.current=null,ri()?.push?.unregisterApnsToken?.({token:o})},[t])},ro=s=>{const e=ne.c(12),{side:t,isResizing:r,ariaLabel:o,handleProps:i}=s,l=t==="left"?"inset-e-0":"inset-s-0";let a;e[0]!==l?(a=ie("absolute inset-y-0 z-50 w-6 cursor-col-resize touch-none",l),e[0]=l,e[1]=a):a=e[1];const d=t==="left"?"inset-e-0":"inset-s-0",c=r&&"bg-[var(--interactive-border)]";let u;e[2]!==d||e[3]!==c?(u=ie("absolute inset-y-0 w-[3px] transition-colors",d,c),e[2]=d,e[3]=c,e[4]=u):u=e[4];let p;e[5]!==u?(p=n.jsx("div",{className:u}),e[5]=u,e[6]=p):p=e[6];let h;return e[7]!==o||e[8]!==i||e[9]!==a||e[10]!==p?(h=n.jsx("div",{className:a,role:"separator","aria-orientation":"vertical","aria-label":o,...i,children:p}),e[7]=o,e[8]=i,e[9]=a,e[10]=p,e[11]=h):h=e[11],h},jg=320,kg=380,io=280,Sg=560,Ng=900;function oo(s,e,t,r){const o=ne.c(23),i=r===void 0?Sg:r,l=m.useRef(null);let a;o[0]!==t||o[1]!==i||o[2]!==e?(a=()=>{if(typeof window>"u")return t;const C=Number.parseInt(window.localStorage.getItem(e)??"",10);return Number.isFinite(C)?Math.min(i,Math.max(io,C)):t},o[0]=t,o[1]=i,o[2]=e,o[3]=a):a=o[3];const[d,c]=m.useState(a),[u,p]=m.useState(!1),h=m.useRef(0),f=m.useRef(d),g=m.useRef(null),x=m.useRef(null);let b;o[4]!==i?(b=C=>Math.min(i,Math.max(io,Math.round(C))),o[4]=i,o[5]=b):b=o[5];const w=b;let v;o[6]===Symbol.for("react.memo_cache_sentinel")?(v=C=>{const L=l.current;L&&(L.style.width=`${C}px`,L.style.minWidth=`${C}px`,L.style.maxWidth=`${C}px`,L.style.setProperty("--oc-ipad-sidebar-width",`${C}px`))},o[6]=v):v=o[6];const E=v;let P;o[7]!==d?(P=C=>{try{C.currentTarget.setPointerCapture(C.pointerId)}catch{}x.current=C.pointerId,h.current=C.clientX,f.current=d,g.current=d,p(!0),C.preventDefault()},o[7]=d,o[8]=P):P=o[8];const _=P;let A;o[9]!==w||o[10]!==s?(A=C=>{if(x.current!==C.pointerId)return;const L=(s==="left"?1:-1)*(pl(C.currentTarget)?-1:1),I=w(f.current+(C.clientX-h.current)*L);g.current!==I&&(g.current=I,E(I))},o[9]=w,o[10]=s,o[11]=A):A=o[11];const k=A;let S;o[12]!==w||o[13]!==e?(S=C=>{if(x.current!==C.pointerId)return;try{C.currentTarget.releasePointerCapture(C.pointerId)}catch{}const L=w(g.current??f.current);x.current=null,g.current=null,p(!1),c(L);try{window.localStorage.setItem(e,String(L))}catch{}},o[12]=w,o[13]=e,o[14]=S):S=o[14];const N=S;let M;o[15]!==_||o[16]!==N||o[17]!==k?(M={onPointerDown:_,onPointerMove:k,onPointerUp:N,onPointerCancel:N},o[15]=_,o[16]=N,o[17]=k,o[18]=M):M=o[18];const B=M;let O;return o[19]!==B||o[20]!==u||o[21]!==d?(O={asideRef:l,width:d,isResizing:u,handleProps:B},o[19]=B,o[20]=u,o[21]=d,o[22]=O):O=o[22],O}const Cg=()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,Rg=200;function ao(s){const e=ne.c(6),[t,r]=m.useState(!1),[o,i]=m.useState(s);s!==o&&(i(s),r(!s&&!Cg()));let l,a;e[0]!==t?(l=()=>{if(!t)return;const u=window.setTimeout(()=>r(!1),Rg);return()=>window.clearTimeout(u)},a=[t],e[0]=t,e[1]=l,e[2]=a):(l=e[1],a=e[2]),m.useEffect(l,a);const d=s||t;let c;return e[3]!==s||e[4]!==d?(c={placed:d,inPlace:s},e[3]=s,e[4]=d,e[5]=c):c=e[5],c}const lo=["general","isolated-spaces","appearance","chat","notifications","sessions","routing","git","magic-prompts","snippets","behavior","agents","commands","mcp","plugins","skills.installed","skills.catalog","providers","web-search","usage","voice","integrations","about"],Eg=1e3,Ig=({onActiveConnectionDeleted:s})=>{const{t:e,direction:t}=ge();Od();const[r,o]=m.useState(!1);m.useEffect(()=>ot.subscribe((V,ue)=>{V.currentSessionId&&V.currentSessionId!==ue.currentSessionId&&He.getState().setRunOverviewKey(null)}),[]);const i=He(V=>V.runOverviewKey!==null);m.useEffect(()=>{i&&o(!1)},[i]);const[l,a]=m.useState(null),[d,c]=m.useState(!1),[u,p]=m.useState(()=>{const{mobileWorkspaceTabOrder:V,mobileWorkspaceHiddenTabs:ue}=He.getState();return oi(V,ue)[0]}),h=m.useCallback(()=>{const{mobileWorkspaceTabOrder:V,mobileWorkspaceHiddenTabs:ue}=He.getState(),Le=oi(V,ue);p($e=>Le.includes($e)?$e:Le[0]),c(!0)},[]),[f,g]=m.useState(null),[x,b]=m.useState("nav"),[w,v]=m.useState(null),E=He(V=>V.setSettingsPage),P=He(V=>V.wideChatLayoutEnabled),_=ks(V=>V.available),A=ks(V=>V.runtimeType),k=m.useMemo(()=>Tr(),[]),S=m.useCallback(()=>{a(null),g(null)},[]),N=m.useCallback(V=>{a(V)},[]),M=m.useCallback(()=>{c(!1)},[]),B=m.useCallback(V=>{b(V),N("settings")},[N]);m.useEffect(()=>N1(lo,B),[B]);const{enabled:O,roomyForPanels:C}=Sr(),I=uu()==="portrait",j=du(),[R,T]=m.useState(()=>fu().roomyForPanels),$=m.useCallback(()=>{T(V=>!V)},[]);m.useEffect(()=>{O||T(!1)},[O]);const W=m.useCallback(()=>{v(null),p("files"),c(!0)},[]);m.useEffect(()=>hi(V=>{if(V.type!=="file-open-request")return;const ue=V.directory??Bs.getState().currentDirectory;ue&&(He.getState().openContextFile(ue,V.path),W())}),[W]),m.useEffect(()=>hi(V=>{if(V.type!=="plan-open-request")return;const ue=Md(V.directory??Bs.getState().currentDirectory,V.projectId);ue&&g({id:V.planId,title:V.title,projectRef:ue})}),[]);const q=m.useCallback((V=null)=>{v(V),p("changes"),c(!0)},[]),D=oo("left","openchamber.ipad.leftSidebarWidth",jg),z=oo("right","openchamber.ipad.rightSidebarWidth",kg,Ng),J=C,ee=ao(O&&R),Q=ao(J&&d),Y=J&&Q.placed?z.width:0,K=O&&ee.placed?D.width:0,Z=t==="rtl"?"100%":"-100%",U=t==="rtl"?"-100%":"100%";m.useEffect(()=>(ur.setState({left:K,right:Y}),()=>ur.setState({left:0,right:0})),[K,Y]),m.useEffect(()=>{if(typeof document>"u")return;const V=document.documentElement;return V.classList.toggle("wide-chat-layout",P),()=>V.classList.remove("wide-chat-layout")},[P]),m.useEffect(()=>{if(typeof document>"u")return;const V=O&&(I||j),ue=document.documentElement;return ue.classList.toggle("oc-keep-draft-starters",V),()=>ue.classList.remove("oc-keep-draft-starters")},[j,O,I]);const H=m.useMemo(()=>({openChanges:({diffPath:V,staged:ue}={})=>{q(V?{path:V,staged:ue===!0}:null)},openFiles:()=>W(),openSourceBoard:()=>N("board")}),[q,W,N]),se=m.useMemo(()=>({openSessions:()=>{O?T(!0):o(!0)},openView:V=>{if(V==="files"){W();return}if(V==="mcp"){p("status"),c(!0);return}N(V)},openChanges:({path:V,staged:ue}={})=>{q(V?{path:V,staged:ue===!0}:null)},openSettings:V=>{V&&E(V),B(V?"page-content":"nav")}}),[O,q,W,B,N,E]);hg(se);const fe=m.useRef(null),ce=()=>{O?T(!0):o(!0)},ae=()=>h();Gr(fe,{onLeftEdgeSwipe:t==="rtl"?ae:ce,onRightEdgeSwipe:t==="rtl"?ce:ae});const je=m.useRef(null),Re=m.useCallback(V=>{je.current=V},[]),te=m.useCallback(()=>mu()?!0:f?(g(null),!0):l==="settings"&&je.current?.()?!0:l?(S(),!0):d?(M(),!0):r?(o(!1),!0):!1,[l,S,M,f,r,d]);pu(te);const pe=!k&&_&&(A==="desktop"||A==="web"),X=O?"dialog":"fullscreen",oe=He(V=>V.overviewFeatureAvailable),ve=m.useMemo(()=>({instanceLabel:k?js():null,onOpenInstances:k?()=>N("instances"):void 0,onOpenSettings:()=>B("nav"),onOpenUsage:()=>N("usage"),onOpenScheduled:()=>N("scheduled"),onOpenArchive:()=>N("archive"),onOpenOverview:oe?()=>N("overview"):void 0,onOpenSourceBoard:()=>N("board"),onOpenUpdate:pe?()=>N("update"):void 0}),[B,N,oe,k,pe]),we=m.useCallback(V=>{S(),o(!1),V==="file"&&W()},[S,W]),Se=m.useCallback(()=>{S(),o(!1)},[S]),be=m.useCallback(()=>{S(),o(!1),O&&!C&&T(!1)},[S,O,C]),xe=m.useCallback(()=>{S(),o(!1),O&&!C&&T(!1)},[S,O,C]);return n.jsx(hu,{actions:H,children:n.jsxs("div",{className:"oc-mobile-app-shell main-content-safe-area flex h-[100dvh] flex-row bg-background text-foreground","data-page-scroll-lock":"true",children:[O?n.jsxs("aside",{ref:D.asideRef,className:ie("oc-ipad-sidebar relative flex h-full shrink-0 flex-col overflow-hidden"),style:{width:K,minWidth:K,maxWidth:K,"--oc-ipad-sidebar-width":`${D.width}px`,overflowX:"clip"},"aria-hidden":!R,"data-page-scroll-lock":"true",children:[n.jsx("div",{className:ie("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",D.isResizing&&"pointer-events-none",!R&&"pointer-events-none select-none"),style:{width:"var(--oc-ipad-sidebar-width)",overflowX:"hidden",paddingTop:"var(--oc-safe-area-top, 0px)",translate:ee.inPlace?void 0:Z},children:n.jsx(ft,{children:n.jsx(Gi,{open:ee.placed,variant:"sidebar",onOpenChange:V=>{!V&&!C&&T(!1)},footer:ve})})}),R?n.jsx(ro,{side:"left",isResizing:D.isResizing,ariaLabel:e("sidebar.resize.leftPanelAria"),handleProps:D.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(kp,{onOpenSessions:()=>O?$():o(!0),onOpenWorkspace:h,compactTitle:O}),n.jsxs("main",{ref:fe,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(ft,{children:n.jsx(Ld,{})})}),n.jsx(ft,{children:n.jsx(qd,{})})]})]}),O?null:n.jsx(Gi,{open:r,onOpenChange:o,footer:ve}),n.jsxs("aside",{ref:z.asideRef,className:ie("relative flex h-full shrink-0 flex-col overflow-hidden"),style:{width:Y,minWidth:Y,maxWidth:Y,"--oc-ipad-sidebar-width":`${z.width}px`,overflowX:"clip"},"aria-hidden":!Y,"data-page-scroll-lock":"true",children:[n.jsx("div",{className:ie("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",J&&"border-s border-edge bg-background",z.isResizing&&"pointer-events-none",!Q.inPlace&&"pointer-events-none select-none"),style:{width:"var(--oc-ipad-sidebar-width)",overflowX:"hidden",paddingTop:"var(--oc-safe-area-top, 0px)",translate:Q.inPlace?void 0:U},children:n.jsx(ft,{children:n.jsx(Y1,{open:J?Q.placed:d,onClose:M,tab:u,onTabChange:p,pendingChangesDiff:w,onOpenPlan:g,variant:J?"panel":"drawer"})})}),J&&d?n.jsx(ro,{side:"right",isResizing:z.isResizing,ariaLabel:e("sidebar.resize.rightPanelAria"),handleProps:z.handleProps}):null]}),f?n.jsx(Yt,{open:!0,variant:X,onClose:()=>g(null),ariaLabel:f.title,title:f.title,children:n.jsx(ft,{children:n.jsx(Kd,{savedProjectPlan:{projectRef:f.projectRef,planId:f.id},onNavigatedToChat:()=>{S(),M()}})})}):null,l==="instances"&&k?n.jsx(Yt,{open:!0,variant:X,dialogAlign:"app",onClose:S,ariaLabel:e("mobile.menu.instances"),title:e("mobile.menu.instances"),children:n.jsx(Ep,{onConnect:S,onActiveConnectionDeleted:s})}):null,l==="settings"?n.jsx(Yt,{open:!0,variant:X,dialogAlign:"app",onClose:S,ariaLabel:e("mobile.menu.settings"),headerless:!0,children:n.jsx(ft,{children:n.jsx($d,{forceMobile:!0,isWindowed:!0,initialMobileStage:x,registerBackHandler:Re,visiblePageSlugs:[...lo],onClose:S})})}):null,l==="usage"?n.jsx(Yt,{open:!0,variant:X,dialogAlign:"app",onClose:S,ariaLabel:e("usageStats.title"),title:e("usageStats.title"),children:n.jsx(ft,{children:n.jsx(wf,{})})}):null,l==="scheduled"?n.jsx(Yt,{open:!0,variant:X,dialogAlign:"app",onClose:S,ariaLabel:e("sessions.scheduledTasks.dialog.title"),title:e("sessions.scheduledTasks.dialog.title"),children:n.jsx(ft,{children:n.jsx(Nf,{layout:"mobile",onLeave:we})})}):null,l==="board"?n.jsx(Yt,{open:!0,variant:X,dialogAlign:"app",onClose:S,ariaLabel:e("sourceBoard.title"),headerless:!0,children:n.jsx(ft,{children:n.jsx(kf,{onLeave:Se,onClose:S})})}):null,l==="overview"&&oe?n.jsx(Yt,{open:!0,variant:X,dialogAlign:"app",onClose:S,ariaLabel:e("overview.title"),title:e("overview.title"),children:n.jsx(ft,{children:n.jsx(Sf,{layout:"mobile",onLeave:be})})}):null,l==="archive"?n.jsx(Yt,{open:!0,variant:X,dialogAlign:"app",onClose:S,ariaLabel:e("sessions.archivePage.title"),title:e("sessions.archivePage.title"),children:n.jsx(ft,{children:n.jsx(jf,{layout:"mobile",onLeave:xe})})}):null,l==="update"?n.jsx(Yt,{open:!0,variant:X,dialogAlign:"app",onClose:S,ariaLabel:e("mobile.menu.update"),title:e("mobile.menu.update"),children:n.jsx(ft,{children:n.jsx(Ut,{outerClassName:"h-full",className:"px-5 py-4",disableHorizontal:!0,children:n.jsx(Wd,{initialUpdateDialogOpen:!0})})})}):null]})})};function Tg(s){const e=ne.c(142),{apis:t}=s,r=He(ab),{t:o}=ge(),i=Ot(ob),l=Ot(ib),a=Ot(rb),d=Ot(nb),c=Ot(sb),u=Ot(tb),p=Ot(eb),h=Ot(Zg),f=Bs(Qg),g=ot(Yg),x=ot(Xg),b=He(Jg),w=zo(Gg),v=hl(qg),E=Cs(Ug),P=Cs(Hg),_=Cs(Vg);let A;e[0]!==E||e[1]!==P?(A=[...E,...P],e[0]=E,e[1]=P,e[2]=A):A=e[2];const k=A;let S;e[3]!==k||e[4]!==_?(S={hasAuthoritativeGlobalSessions:_,sessions:k},e[3]=k,e[4]=_,e[5]=S):S=e[5],yd(S);const[N,M]=m.useState(0),[B,O]=m.useState(0),[C,L]=m.useState(!1),[I,j]=m.useState("pending"),[R,T]=m.useState(null);let $;e[6]===Symbol.for("react.memo_cache_sentinel")?($=js(),e[6]=$):$=e[6];const W=$,[,q]=m.useReducer(Kg,0);let D;e[7]===Symbol.for("react.memo_cache_sentinel")?(D=Tr(),e[7]=D):D=e[7];const z=D,J=m.useRef(0),ee=m.useRef(0);let Q;e[8]!==u||e[9]!==t.sourceControl||e[10]!==t.trackers||e[11]!==i||e[12]!==h||e[13]!==p||e[14]!==c||e[15]!==w||e[16]!==v?(Q=()=>{const de=Ft(),le=ee.current+1;if(ee.current=le,!de){rn("resume:auto-connect",{}),on();return}rn("resume:reprobe",{});const he=()=>{i(),v(t.sourceControl),w(t.sourceControl,{force:!0}),pi(t.trackers),c===0&&p({source:"mobileApp:nativeResume"}),u===0&&h({source:"mobileApp:nativeResume"})},Ce=ze=>{rn("resume:disconnect",{reason:ze}),Ds({apiBaseUrl:"",clientToken:null,runtimeKey:jn}),M(Wg)};_n().then(ze=>{if(ee.current===le){if(ze==="no-connection"){Ce("no-connection");return}if(ze==="needs-login"){T({kind:"auth-expired",label:js()??""}),Ce("needs-login");return}if(ze==="relay-limit"){T({kind:"relay-limit",label:js()??""}),Ce("relay-limit");return}if(ze==="unreachable"){const qt=[4e3,1e4],Wt=wt=>{window.setTimeout(()=>{if(ee.current!==le)return;const zt=wt===qt.length-1;_n({fast:!zt}).then(Et=>{if(ee.current===le&&Et!=="switched"){if(Et==="unchanged"){he();return}if(Et==="needs-login"){T({kind:"auth-expired",label:js()??""}),Ce("retry-needs-login");return}if(Et==="relay-limit"){T({kind:"relay-limit",label:js()??""}),Ce("retry-relay-limit");return}if(!zt){Wt(wt+1);return}Ce(`retry-${Et}`)}})},qt[wt])};Wt(0);return}ze!=="switched"&&he()}});const Ne=Date.now();Ne-J.current>=Eg&&(J.current=Ne,window.dispatchEvent(new Event("openchamber:system-resume")))},e[8]=u,e[9]=t.sourceControl,e[10]=t.trackers,e[11]=i,e[12]=h,e[13]=p,e[14]=c,e[15]=w,e[16]=v,e[17]=Q):Q=e[17];const Y=Q;Jc(),Xc(Y);let K,Z;e[18]!==Y?(K=()=>{if(!z)return;let de;const le=()=>{window.clearTimeout(de),de=window.setTimeout(()=>Y(),1500)};return window.addEventListener("online",le),()=>{window.removeEventListener("online",le),window.clearTimeout(de)}},Z=[z,Y],e[18]=Y,e[19]=K,e[20]=Z):(K=e[19],Z=e[20]),m.useEffect(K,Z);let U,H;e[21]!==Y?(U=()=>{if(z)return ii.subscribe((de,le)=>{de.state==="expired"&&le.state!=="expired"&&(Y(),ii.getState().markAuthenticated())})},H=[z,Y],e[21]=Y,e[22]=U,e[23]=H):(U=e[22],H=e[23]),m.useEffect(U,H);let se,fe;e[24]!==Y?(se=()=>{if(z)return gl(de=>{zn(de)&&Y()})},fe=[z,Y],e[24]=Y,e[25]=se,e[26]=fe):(se=e[25],fe=e[26]),m.useEffect(se,fe);let ce,ae;e[27]!==t?(ce=()=>(po(t),$g),ae=[t],e[27]=t,e[28]=ce,e[29]=ae):(ce=e[28],ae=e[29]),m.useEffect(ce,ae);let je;e[30]!==q?(je=()=>mo(de=>{if(rn("endpoint:changed",{runtimeKey:de.runtimeKey||"none",previousRuntimeKey:de.previousRuntimeKey||"none",connected:!!de.apiBaseUrl}),!!de.runtimeKey&&de.runtimeKey===de.previousRuntimeKey){Cd(),q();return}Rd(de),O(Fg),M(Bg)}),e[30]=q,e[31]=je):je=e[31];let Re;e[32]===Symbol.for("react.memo_cache_sentinel")?(Re=[],e[32]=Re):Re=e[32],m.useEffect(je,Re);let te;e[33]!==a?(te=()=>{if(!z||a||Ft()){j("done");return}let de=!1;return j("attempting"),(async()=>{const le=await on().catch(zg);de||(le.status==="unreachable"||le.status==="relay-limit"?T({kind:le.status,label:le.label}):le.status==="needs-login"&&T({kind:"auth-expired",label:le.label}),j("done"),le.status==="unreachable"&&on({fast:!1,skipIfConnected:!0}).catch(Lg))})(),()=>{de=!0}},e[33]=a,e[34]=te):te=e[34];let pe;e[35]===Symbol.for("react.memo_cache_sentinel")?(pe=[],e[35]=pe):pe=e[35],m.useEffect(te,pe);let X,oe;e[36]===Symbol.for("react.memo_cache_sentinel")?(X=()=>{if(!z||!Ft())return;let de=!1;const le=he=>{rn("cold-launch:drop",{kind:he?.kind??"unknown"}),he&&T(he),Ds({apiBaseUrl:"",clientToken:null,runtimeKey:jn}),M(Mg)};return _n().then(async he=>{if(de||he==="switched"||he==="unchanged")return;const Ce=js();if(he==="needs-login"){le({kind:"auth-expired",label:Ce??""});return}if(he==="unreachable"){le(Ce?{kind:"unreachable",label:Ce}:null),on({fast:!1,skipIfConnected:!0}).catch(Og);return}if(he==="relay-limit"){le({kind:"relay-limit",label:Ce??""});return}const Ne=await on().catch(Dg);de||Ne.status==="connected"||(Ne.status==="needs-login"?le({kind:"auth-expired",label:Ne.label}):Ne.status==="unreachable"||Ne.status==="relay-limit"?le({kind:Ne.status,label:Ne.label}):le(null))}),()=>{de=!0}},oe=[],e[36]=X,e[37]=oe):(X=e[36],oe=e[37]),m.useEffect(X,oe);let ve,we;e[38]!==b?(ve=()=>{b(!0)},we=[b],e[38]=b,e[39]=ve,e[40]=we):(ve=e[39],we=e[40]),m.useEffect(ve,we);let Se;e[41]!==i?(Se=()=>{z&&!Ft()||i()},e[41]=i,e[42]=Se):Se=e[42];let be;e[43]!==N||e[44]!==i?(be=[N,i,z],e[43]=N,e[44]=i,e[45]=be):be=e[45],m.useEffect(Se,be);let xe,V;e[46]!==u||e[47]!==a||e[48]!==h||e[49]!==p||e[50]!==c?(xe=()=>{a&&(c===0&&p({source:"mobileApp:recovery"}),u===0&&h({source:"mobileApp:recovery"}))},V=[u,a,h,p,c],e[46]=u,e[47]=a,e[48]=h,e[49]=p,e[50]=c,e[51]=xe,e[52]=V):(xe=e[51],V=e[52]),m.useEffect(xe,V);const ue=m.useRef(!1),[Le,$e]=m.useState(z);let Te;e[53]!==a?(Te=()=>{if(!z||!a||ue.current)return;let de=!1;const le=window.setTimeout(()=>$e(!1),6e3);return(async()=>{const he=await Ed({refresh:!0});de||(he!=="failed"&&(ue.current=!0),$e(!1))})(),()=>{de=!0,window.clearTimeout(le)}},e[53]=a,e[54]=Te):Te=e[54];let Xe;e[55]!==N||e[56]!==a?(Xe=[N,a,z],e[55]=N,e[56]=a,e[57]=Xe):Xe=e[57],m.useEffect(Te,Xe);let Ye,tt;e[58]!==f||e[59]!==a?(Ye=()=>{a&&lr.setDirectory(f)},tt=[f,a],e[58]=f,e[59]=a,e[60]=Ye,e[61]=tt):(Ye=e[60],tt=e[61]),m.useEffect(Ye,tt);let rt,ye;e[62]!==t.sourceControl||e[63]!==t.trackers||e[64]!==a||e[65]!==w||e[66]!==v?(rt=()=>{a&&(v(t.sourceControl),w(t.sourceControl,{force:!0}),pi(t.trackers))},ye=[t.sourceControl,t.trackers,a,w,v],e[62]=t.sourceControl,e[63]=t.trackers,e[64]=a,e[65]=w,e[66]=v,e[67]=rt,e[68]=ye):(rt=e[67],ye=e[68]),m.useEffect(rt,ye);let Fe,We;e[69]!==x||e[70]!==g?(Fe=()=>{if(!g)return;const de=window.setTimeout(()=>x(),5e3);return()=>window.clearTimeout(de)},We=[x,g],e[69]=x,e[70]=g,e[71]=Fe,e[72]=We):(Fe=e[71],We=e[72]),m.useEffect(Fe,We);let Qe;e[73]!==a?(Qe=()=>{if(!(!a&&(z?!!Ft():!0))){L(!1);return}const le=window.setTimeout(()=>{L(!0)},z?4e3:8e3);return()=>window.clearTimeout(le)},e[73]=a,e[74]=Qe):Qe=e[74];let Ze;e[75]!==N||e[76]!==a||e[77]!==B?(Ze=[a,z,N,B],e[75]=N,e[76]=a,e[77]=B,e[78]=Ze):Ze=e[78],m.useEffect(Qe,Ze),Yc();let st;e[79]===Symbol.for("react.memo_cache_sentinel")?(st={enabled:!0},e[79]=st):st=e[79],Qc(st),vd(),Zc(),eu(),wd(),jd(t.sourceControl),kd(t.trackers),Sd(f||null),Nd();const Oe=z&&a;let Ue;e[80]!==Oe?(Ue={enabled:Oe},e[80]=Oe,e[81]=Ue):Ue=e[81],wg(Ue);const Ge=z&&a&&l;let nt;e[82]!==Ge?(nt={ready:Ge},e[82]=Ge,e[83]=nt):nt=e[83],gg(nt);const Tt=Q1(),Ct=!a&&d==="reconnecting";if(!Tt){let de;return e[84]===Symbol.for("react.memo_cache_sentinel")?(de=n.jsx("main",{className:"flex min-h-dvh items-center justify-center bg-[var(--splash-background,var(--surface-background))] text-foreground",children:n.jsx(Os,{width:120,height:120,isAnimated:!0,variant:"splash"})}),e[84]=de):de=e[84],de}const at=!!Ft();if(z&&(!at||!a&&!Ct)){if(at){const he=!C;let Ce;e[85]!==he?(Ce=n.jsx(Os,{width:120,height:120,isAnimated:he,variant:"splash"}),e[85]=he,e[86]=Ce):Ce=e[86];let Ne;e[87]!==C||e[88]!==o?(Ne=C?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("h1",{className:"typography-h3 text-foreground",children:o("sessionAuth.error.networkTitle")}),n.jsx("p",{className:"typography-markdown text-muted-foreground",children:o("mobile.connect.recovery.description")})]}),n.jsx(Ee,{type:"button",variant:"outline",onClick:()=>{Ds({apiBaseUrl:"",clientToken:null,runtimeKey:jn}),M(Pg)},children:o("mobile.connect.cancelPassword")})]}):null,e[87]=C,e[88]=o,e[89]=Ne):Ne=e[89];let ze;return e[90]!==Ce||e[91]!==Ne?(ze=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,Ne]})}),e[90]=Ce,e[91]=Ne,e[92]=ze):ze=e[92],ze}if(I!=="done"){let he;e[93]===Symbol.for("react.memo_cache_sentinel")?(he=n.jsx(Os,{width:120,height:120,isAnimated:!0,variant:"splash"}),e[93]=he):he=e[93];let Ce;e[94]!==o?(Ce=W?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:o("mobile.connect.splash.connectingTo")}),n.jsxs("p",{className:"typography-small text-foreground",children:[W,n.jsx(tu,{})]})]}):null,e[94]=o,e[95]=Ce):Ce=e[95];let Ne;return e[96]!==Ce?(Ne=n.jsxs("main",{className:"relative flex min-h-dvh items-center justify-center bg-[var(--splash-background,var(--surface-background))] text-foreground",children:[he,Ce]}),e[96]=Ce,e[97]=Ne):Ne=e[97],Ne}let de;e[98]===Symbol.for("react.memo_cache_sentinel")?(de=()=>M(Ag),e[98]=de):de=e[98];let le;return e[99]!==R?(le=n.jsx(n.Fragment,{children:n.jsx(ap,{onConnected:de,notice:R})}),e[99]=R,e[100]=le):le=e[100],le}if(!a&&!Ct){if(!C){let ze;return e[101]===Symbol.for("react.memo_cache_sentinel")?(ze=n.jsx("main",{className:"flex min-h-dvh items-center justify-center bg-[var(--splash-background,var(--surface-background))] text-foreground",children:n.jsx(Os,{width:120,height:120,isAnimated:!0,variant:"splash"})}),e[101]=ze):ze=e[101],ze}let de;e[102]!==o?(de=o("sessionAuth.error.networkTitle"),e[102]=o,e[103]=de):de=e[103];let le;e[104]!==de?(le=n.jsx("h1",{className:"typography-h3 text-foreground",children:de}),e[104]=de,e[105]=le):le=e[105];let he;e[106]!==o?(he=o("sessionAuth.error.networkDescription"),e[106]=o,e[107]=he):he=e[107];let Ce;e[108]!==he?(Ce=n.jsx("p",{className:"typography-markdown text-muted-foreground",children:he}),e[108]=he,e[109]=Ce):Ce=e[109];let Ne;return e[110]!==le||e[111]!==Ce?(Ne=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:[le,Ce]})}),e[110]=le,e[111]=Ce,e[112]=Ne):Ne=e[112],Ne}let mt;e[113]===Symbol.for("react.memo_cache_sentinel")?(mt=lr.getSdkClient(),e[113]=mt):mt=e[113];const pt=f||"",bt=!z||!Le;let et;e[114]!==bt?(et=n.jsx(Id,{ready:bt,animated:!0}),e[114]=bt,e[115]=et):et=e[115];let Ie;e[116]!==l?(Ie=n.jsx(su,{backgroundWorkEnabled:l}),e[116]=l,e[117]=Ie):Ie=e[117];let xt,_e;e[118]===Symbol.for("react.memo_cache_sentinel")?(xt=n.jsx(Td,{}),_e=n.jsx(pm,{}),e[118]=xt,e[119]=_e):(xt=e[118],_e=e[119]);let Ae,Ke,qe,ht,Ve;e[120]===Symbol.for("react.memo_cache_sentinel")?(Ae=n.jsx(Ig,{onActiveConnectionDeleted:()=>{Xm(),Ds({apiBaseUrl:"",clientToken:null,runtimeKey:jn}),M(_g)}}),Ke=n.jsx(nu,{}),qe=n.jsx(ru,{}),ht=n.jsx(iu,{}),Ve=n.jsx(ou,{}),e[120]=Ae,e[121]=Ke,e[122]=qe,e[123]=ht,e[124]=Ve):(Ae=e[120],Ke=e[121],qe=e[122],ht=e[123],Ve=e[124]);let lt;e[125]!==r?(lt=r?n.jsxs(n.Fragment,{children:[n.jsx(Vd,{}),n.jsx(_d,{}),n.jsx(Hd,{}),n.jsx(Ad,{}),n.jsx(Ud,{})]}):null,e[125]=r,e[126]=lt):lt=e[126];let yt;e[127]===Symbol.for("react.memo_cache_sentinel")?(yt=n.jsx(vm,{}),e[127]=yt):yt=e[127];let vt;e[128]!==l?(vt=l?n.jsx(Pd,{}):null,e[128]=l,e[129]=vt):vt=e[129];let Rt;e[130]!==et||e[131]!==Ie||e[132]!==lt||e[133]!==vt?(Rt=n.jsx(au,{delayDuration:300,skipDelayDuration:150,children:n.jsxs("div",{className:"h-full bg-background text-foreground",children:[et,Ie,xt,_e,Ae,Ke,qe,ht,Ve,lt,yt,vt]})}),e[130]=et,e[131]=Ie,e[132]=lt,e[133]=vt,e[134]=Rt):Rt=e[134];let _t;e[135]!==t||e[136]!==Rt?(_t=n.jsx(lu,{apis:t,children:Rt}),e[135]=t,e[136]=Rt,e[137]=_t):_t=e[137];let $t;return e[138]!==B||e[139]!==pt||e[140]!==_t?($t=n.jsx(ft,{children:n.jsx(cu,{sdk:mt,directory:pt,children:_t},B)}),e[138]=B,e[139]=pt,e[140]=_t,e[141]=$t):$t=e[141],$t}function _g(s){return s+1}function Ag(s){return s+1}function Pg(s){return s+1}function Dg(){return{status:"no-candidate"}}function Og(){return null}function Mg(s){return s+1}function Lg(){return null}function zg(){return{status:"no-candidate"}}function Bg(s){return s+1}function Fg(s){return s+1}function $g(){return po(null)}function Wg(s){return s+1}function Kg(s){return s+1}function Vg(s){return s.status==="ready"}function Hg(s){return s.archivedSessions}function Ug(s){return s.activeSessions}function qg(s){return s.refresh}function Gg(s){return s.refreshAll}function Jg(s){return s.setIsMobile}function Xg(s){return s.clearError}function Yg(s){return s.error}function Qg(s){return s.currentDirectory}function Zg(s){return s.loadAgents}function eb(s){return s.loadProviders}function tb(s){return s.agents.length}function sb(s){return s.providers.length}function nb(s){return s.connectionPhase}function rb(s){return s.isConnected}function ib(s){return s.isInitialized}function ob(s){return s.initializeApp}function ab(s){return s.isolatedSpacesEnabled}function lb(s){const e=ne.c(7),t=m.useSyncExternalStore(cb,Ft,Ft);let r;e[0]!==t?(r=!Tr()||!!t,e[0]=t,e[1]=r):r=e[1];let o;e[2]!==s?(o=n.jsx(Tg,{...s}),e[2]=s,e[3]=o):o=e[3];let i;return e[4]!==r||e[5]!==o?(i=n.jsx(Dd,{enabled:r,children:o}),e[4]=r,e[5]=o,e[6]=i):i=e[6],i}function cb(s){return mo(()=>s())}function L2(s){window.__OPENCHAMBER_SURFACE__="mobile",gu(),Fd({logLabel:"[mobile-main]",onAppearanceSettled:om}),mm(),bu();const e=document.getElementById("root");if(!e)throw new Error("Root element not found");const r=window.Capacitor?.isNativePlatform?.()===!0||window.location.protocol==="capacitor:",o=r?{...s,notifications:{notifyAgentCompletion:async()=>!1,canNotify:()=>!1}}:s,i=n.jsx(Bd,{children:n.jsx(lb,{apis:o})});Ga.createRoot(e).render(n.jsx(ar.StrictMode,{children:n.jsx(xu,{children:n.jsx(yu,{children:n.jsx(vu,{children:n.jsx(zd,{children:r?i:n.jsx(wu,{children:i})})})})})}))}export{L2 as renderMobileApp};
|