@openchamber/web 2.7.1 → 2.7.2-canary.20261113.19
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-Byc63m0u.js → AboutDialog-DZBVspvU.js} +1 -1
- package/dist/assets/{AboutLogo-BwwjES_b.js → AboutLogo-ChxCGRUm.js} +1 -1
- package/dist/assets/{ArchiveView-DIg8Bq5r.js → ArchiveView-BZJ26vYO.js} +1 -1
- package/dist/assets/{ChangeRequestDiffUnavailable-DtCWp1bf.js → ChangeRequestDiffUnavailable-DWvRZnAG.js} +1 -1
- package/dist/assets/{CommandPalette-D1G7W43z.js → CommandPalette-ynDRBNPC.js} +1 -1
- package/dist/assets/{DataFileArtifact-BPwh4rIZ.js → DataFileArtifact-z9fPrgyu.js} +1 -1
- package/dist/assets/{DiffView-B9-zXR21.js → DiffView-BZ72jtft.js} +1 -1
- package/dist/assets/{FilesView-CTKhKCjC.js → FilesView-C6unlf1o.js} +3 -3
- package/dist/assets/{GitView-2p131yFW.js → GitView-C5sudp8H.js} +1 -1
- package/dist/assets/{GuestPanelContent-BY7I-Y-o.js → GuestPanelContent-VypuCChp.js} +1 -1
- package/dist/assets/{HelpDialog-BfDxlsKj.js → HelpDialog-BCLY1SdQ.js} +1 -1
- package/dist/assets/{IntegrationsCatalogView-DX9AlNKS.js → IntegrationsCatalogView-CCC5vFCc.js} +1 -1
- package/dist/assets/{JsonTreeView-Ghbn2jaO.js → JsonTreeView-B1jPqBE_.js} +1 -1
- package/dist/assets/{MarkdownDiffPreview-CcER_eYB.js → MarkdownDiffPreview-BRsvVmm6.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-DjBAwXof.js → MarkdownRendererImpl-Bja7xPRh.js} +4 -4
- package/dist/assets/{MemoryDebugPanel-MrH6vI6i.js → MemoryDebugPanel-BiidelAZ.js} +1 -1
- package/dist/assets/{NoteEditor-DnaXw3v6.js → NoteEditor-CDhrox_N.js} +1 -1
- package/dist/assets/{OfficeArtifact-av3so80I.js → OfficeArtifact-CSzZ3l3x.js} +2 -2
- package/dist/assets/{OfficeDocumentDiff-C-XvqPYx.js → OfficeDocumentDiff-DIZPU2-t.js} +1 -1
- package/dist/assets/{OnboardingScreen-Dlbi5e0G.js → OnboardingScreen-BNELvFqK.js} +1 -1
- package/dist/assets/{OpenCodeStatusDialog-BZzdMaVU.js → OpenCodeStatusDialog-riJvcyNM.js} +1 -1
- package/dist/assets/{OverviewView-CQ82APO2.js → OverviewView-DrjJJdxp.js} +1 -1
- package/dist/assets/{PatchDiff-EZ_WbikC.js → PatchDiff-CbSen5Gt.js} +1 -1
- package/dist/assets/{PlanView-jUry4bXu.js → PlanView-Bi7nN60G.js} +1 -1
- package/dist/assets/{ProjectActionsDialog-Bt6OXdLD.js → ProjectActionsDialog-5SwtkdoL.js} +1 -1
- package/dist/assets/{ReplyCommand-CLNJlG5f.js → ReplyCommand-B-b5HiGJ.js} +1 -1
- package/dist/assets/{ReplyUiBlock-DthlzVWC.js → ReplyUiBlock-SITDS2N8.js} +1 -1
- package/dist/assets/{ReviewCards-qePUMD-z.js → ReviewCards-ClKfTGPh.js} +1 -1
- package/dist/assets/{RunOverview-CvD2Q7KM.js → RunOverview-Zx7ypz3K.js} +1 -1
- package/dist/assets/{ScheduledTasksDialog-Dtdb6owf.js → ScheduledTasksDialog-BqkQPZwR.js} +1 -1
- package/dist/assets/{SettingsView-JBCXhydZ.js → SettingsView-CcxtXPxF.js} +1 -1
- package/dist/assets/{SettingsWindow-RJIA1rl5.js → SettingsWindow-rjA8cpzb.js} +1 -1
- package/dist/assets/{SidebarSectionsManager-4i4NcHs0.js → SidebarSectionsManager-DFbc8Xwd.js} +1 -1
- package/dist/assets/{SourceBoardView-BuYJw-Sp.js → SourceBoardView-ClskEpR_.js} +1 -1
- package/dist/assets/{SpaceAccessDialog-B4-bPo9e.js → SpaceAccessDialog-VIsmK3Lq.js} +1 -1
- package/dist/assets/{SpaceApplyDialog-DjTQ5PZT.js → SpaceApplyDialog-CE4GGYR-.js} +1 -1
- package/dist/assets/{SpaceRow-CYk17vzn.js → SpaceRow-DoksNK04.js} +1 -1
- package/dist/assets/{SpaceSetupOutput-DRDEgMzx.js → SpaceSetupOutput-CCkZT6Bi.js} +1 -1
- package/dist/assets/{SpacesView-BSt0xE6N.js → SpacesView-BBtBwQ17.js} +1 -1
- package/dist/assets/{SubmoduleDiffSummary-CTwpN0TO.js → SubmoduleDiffSummary-DoIUrBdP.js} +1 -1
- package/dist/assets/{TableArtifact-BGTFUrHC.js → TableArtifact-CxUbqjYv.js} +1 -1
- package/dist/assets/{ToolOutputDialog-DcQ4eDvb.js → ToolOutputDialog-DPLjXvqn.js} +1 -1
- package/dist/assets/{ToolPartDiffPreview-idv0MY3G.js → ToolPartDiffPreview-B2wDDrfp.js} +1 -1
- package/dist/assets/{UiBlock-CVYWc3Px.js → UiBlock-DwXhgpqK.js} +2 -2
- package/dist/assets/{UsageStatsView-Cgo61IDa.js → UsageStatsView-BqLNssJZ.js} +1 -1
- package/dist/assets/{WalkthroughView-CYr8y2pi.js → WalkthroughView-B7KbSsAT.js} +1 -1
- package/dist/assets/{WorktreesView-Duwvqggr.js → WorktreesView-C-AdzkFm.js} +1 -1
- package/dist/assets/{appThemeRegistry-DgyhfFpu.js → appThemeRegistry-3vWr61EA.js} +1 -1
- package/dist/assets/{ar-zwtOisVI.js → ar-D4S57MOa.js} +1 -1
- package/dist/assets/{codeHighlight-DQ8KOMKI.js → codeHighlight-vTDDxBjH.js} +1 -1
- package/dist/assets/{columnWidthMemory-Ol4D51DU.js → columnWidthMemory-CaG5_n8B.js} +1 -1
- package/dist/assets/{computeVirtualFileMetrics-P_6wH9ys.js → computeVirtualFileMetrics-oAeWRt0Z.js} +2 -2
- package/dist/assets/{contextFileOpenGuard-9zXH1DLm.js → contextFileOpenGuard-BTdwRRDI.js} +1 -1
- package/dist/assets/{date-time-CRucRasX.js → date-time-De4cJmG-.js} +1 -1
- package/dist/assets/{de-5cm4El6N.js → de-YPT7BRkX.js} +1 -1
- package/dist/assets/{documentClient-BbTBnbCU.js → documentClient-ByzYQ2D3.js} +2 -2
- package/dist/assets/{documentHost-Dxv6OV6h.js → documentHost-DaJ0XQTx.js} +1 -1
- package/dist/assets/{editorCodeMetrics-BzYZ4PzQ.js → editorCodeMetrics-CkrWYimB.js} +1 -1
- package/dist/assets/{es-CYh9u5rf.js → es-BqIzbLh0.js} +1 -1
- package/dist/assets/{fileContentPoller-p6RiDNz7.js → fileContentPoller-BXbgYIo0.js} +1 -1
- package/dist/assets/{flexokiTheme-BNUmLj3l.js → flexokiTheme-Yh7J7UaE.js} +1 -1
- package/dist/assets/{fr-gZGCwYzk.js → fr-Bm6tuRAq.js} +1 -1
- package/dist/assets/{he-DWb3dvEl.js → he-B2vIErcj.js} +1 -1
- package/dist/assets/{highlights-DWR6MS75.js → highlights-B2QjzKD7.js} +1 -1
- package/dist/assets/{index-BcEWRtz8.js → index-CsjRKzmq.js} +1 -1
- package/dist/assets/{initializeSharedPreferences-u4U22OVN.js → initializeSharedPreferences-vJOU8q9Y.js} +1 -1
- package/dist/assets/{install-CkKsKExH.js → install-BXZHlgVP.js} +1 -1
- package/dist/assets/{install-request-C0o_6GEa.js → install-request-e6fA_Hb1.js} +1 -1
- package/dist/assets/{isDiffPlainText-B70cjgtm.js → isDiffPlainText-CBdbdXoZ.js} +1 -1
- package/dist/assets/{isFilePlainText-DNNat5m3.js → isFilePlainText-DTR6Yek4.js} +1 -1
- package/dist/assets/{ja-CAeb9wyo.js → ja-D6qPQWDj.js} +1 -1
- package/dist/assets/{katex.min-2cmqKX7p.js → katex.min-BRXXWH9j.js} +4 -4
- package/dist/assets/{ko-DuYqVIuP.js → ko-CISJffvx.js} +1 -1
- package/dist/assets/{main-D9Ri_lHo.js → main-C4tbgFgt.js} +2 -2
- package/dist/assets/{main-kUMMbMdC.js → main-Dhneuvk9.js} +4 -4
- package/dist/assets/{miniChat-HoE2mQuK.js → miniChat-BjuV8rx7.js} +2 -2
- package/dist/assets/{mobile-BFQ0eaJT.js → mobile-iSTV6yUg.js} +2 -2
- package/dist/assets/{moveWorkspacePath-BkzUq9fV.js → moveWorkspacePath-BEX7mjeu.js} +1 -1
- package/dist/assets/{nl-BPlUOQoY.js → nl-B61i4I1-.js} +1 -1
- package/dist/assets/{officeDocument-C74tIqpD.js → officeDocument-CaOOikR3.js} +1 -1
- package/dist/assets/{parseDiffFromFile-COnIA377.js → parseDiffFromFile-BSeCTEcW.js} +1 -1
- package/dist/assets/{pierreDiffTint-9AmpxGGB.js → pierreDiffTint-BKAarfyR.js} +1 -1
- package/dist/assets/{pl-DZRSuGdV.js → pl-B7tMuoTp.js} +1 -1
- package/dist/assets/{pt-BR-fU-ttTba.js → pt-BR-DM4sowqf.js} +1 -1
- package/dist/assets/{relocateRestoredSession-DawfZWX6.js → relocateRestoredSession-B9bwH9_3.js} +2 -2
- package/dist/assets/{renderElectronMiniChatApp-q30Gq6wf.js → renderElectronMiniChatApp-Ds-rupUf.js} +2 -2
- package/dist/assets/{renderMarkdownForExport-0rL6OK8T.js → renderMarkdownForExport-CO6kiTFz.js} +1 -1
- package/dist/assets/{renderMobileApp-B_PjVgBu.js → renderMobileApp-vACiOPun.js} +3 -3
- package/dist/assets/{resolveLanguages-dF0QdGAX.js → resolveLanguages-DwXFSp4e.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-BsAAA4Nf.js → runtimeEndpointReset-0CHuG78d.js} +5 -5
- package/dist/assets/{scheduledTasksApi-CB-Xtp2P.js → scheduledTasksApi-B5hRhk34.js} +1 -1
- package/dist/assets/{shiki-CVNu2J2E.js → shiki-BNrvceeX.js} +1 -1
- package/dist/assets/{space-apply-BmOleF8W.js → space-apply-DlPRGjzD.js} +1 -1
- package/dist/assets/{space-close-DqG3RGoP.js → space-close-DP8YXlG0.js} +1 -1
- package/dist/assets/{spaceNetwork-DUGLrihG.js → spaceNetwork-DBQETFXl.js} +1 -1
- package/dist/assets/{stream-tokenizer-Bzos6Fhy.js → stream-tokenizer-DTPG8KqC.js} +1 -1
- package/dist/assets/{textMateThemeFromAppTheme-BRUbLAuj.js → textMateThemeFromAppTheme-OzgrN6CB.js} +1 -1
- package/dist/assets/{tr-CD93vntx.js → tr-yjYoCwBy.js} +1 -1
- package/dist/assets/{uk-DTqcJvdn.js → uk-5yOoSRye.js} +1 -1
- package/dist/assets/{useAppFontEffects-xaAfmUwn.js → useAppFontEffects-BkjZnJsc.js} +15 -15
- package/dist/assets/{useBranchPullRequestRequest-CIftwmmA.js → useBranchPullRequestRequest-FtZEfVLl.js} +1 -1
- package/dist/assets/{useCallableModelProviders-DYpBJMqj.js → useCallableModelProviders-CiB4Z_LE.js} +1 -1
- package/dist/assets/{useDiffFindSurface-CqxU53Ed.js → useDiffFindSurface-CwoUylJl.js} +1 -1
- package/dist/assets/{useGitCleanLine-CmVX9s9E.js → useGitCleanLine-e7HoRw02.js} +1 -1
- package/dist/assets/{useInlineCommentController-C-V8vqSj.js → useInlineCommentController-CJmX7RR7.js} +1 -1
- package/dist/assets/{useMarkdownLocalAssets-BfOLz9Xm.js → useMarkdownLocalAssets-Cqxh_vbH.js} +1 -1
- package/dist/assets/{useRootScrollLock-Ciuj2iZ_.js → useRootScrollLock-BDtmtwPT.js} +1 -1
- package/dist/assets/{useWalkthroughReview-BdjnKO7o.js → useWalkthroughReview-CeQ95bk7.js} +1 -1
- package/dist/assets/{useWholeFileComment-DkYtu1tm.js → useWholeFileComment-CHOMIHNo.js} +1 -1
- package/dist/assets/{useWorktreeArchiveActions-DGzuZU_x.js → useWorktreeArchiveActions-BhGDka1f.js} +1 -1
- package/dist/assets/{vendor-codemirror-language-data-CSQf665k.js → vendor-codemirror-language-data-ClBHCVu_.js} +2 -2
- package/dist/assets/{zh-CN-BJ4oeBCY.js → zh-CN-CCV5QMTb.js} +1 -1
- package/dist/assets/{zh-TW-BMW1G3F_.js → zh-TW-CKda-uV0.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-CTKhKCjC.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-react--VO_rL_p.js","assets/vendor-scheduler-7OC5HNn7.js","assets/useAppFontEffects-xaAfmUwn.js","assets/katex.min-2cmqKX7p.js","assets/vendor-zustand-C9tWdk0j.js","assets/vendor-zod-B_hXR7jf.js","assets/vendor-opencode-client-NJGkA1Ku.js","assets/vendor-fuse.js-Dw8P0qyA.js","assets/vendor-streamdown-BbSYZ3NF.js","assets/vendor-markdown-BTUqNk6W.js","assets/vendor-mdast-util-from-markdown-CZHjOE75.js","assets/vendor-micromark-util-decode-numeric-character-reference-CNs1qBpV.js","assets/vendor-micromark-util-decode-string-fHsnqYdj.js","assets/vendor-decode-named-character-reference-C3-224fz.js","assets/vendor-micromark-util-normalize-identifier-C9ANKk3v.js","assets/vendor-micromark-AWM-NZXP.js","assets/vendor-micromark-util-combine-extensions-d8XJZrgA.js","assets/vendor-micromark-util-chunked-DrRIdSP-.js","assets/vendor-micromark-factory-space-PzSHLgmq.js","assets/vendor-micromark-util-character-CW3Cu1MS.js","assets/vendor-micromark-core-commonmark-kzTLNXAm.js","assets/vendor-micromark-util-classify-character-tcLuZZwM.js","assets/vendor-micromark-util-resolve-all-PQCKh0dx.js","assets/vendor-micromark-util-subtokenize-BF1Jf29a.js","assets/vendor-micromark-factory-destination-Sj0xfi0V.js","assets/vendor-micromark-factory-label-amyP0HdC.js","assets/vendor-micromark-factory-title-khnLkZK6.js","assets/vendor-micromark-factory-whitespace-eIB00uTl.js","assets/vendor-micromark-util-html-tag-name-DbKNfynz.js","assets/vendor-unist-util-stringify-position-Ch_qCilz.js","assets/vendor-mdast-util-to-string-C_aolqmU.js","assets/vendor-unist-util-visit-DhPeCsfG.js","assets/vendor-unist-util-visit-parents-DlviEg7Z.js","assets/vendor-unist-util-is-BPZGFiMU.js","assets/vendor-hast-util-raw-DvvLJg15.js","assets/vendor-ungap-structured-clone--gfxRhYI.js","assets/vendor-html-void-elements-CkdplsNl.js","assets/vendor-parse5-DwmzEj2o.js","assets/vendor-entities-wUUgTZDW.js","assets/vendor-web-namespaces-bsVAaBS1.js","assets/vendor-zwitch-C2o2j-tx.js","assets/vendor-unist-util-position-60F3QETU.js","assets/vendor-hast-util-from-parse5-Ba3T6RJI.js","assets/vendor-devlop-0Dp3JUBc.js","assets/vendor-property-information-Boo8Xpef.js","assets/vendor-hastscript-BrPNioaz.js","assets/vendor-comma-separated-tokens-CRUGqg4f.js","assets/vendor-space-separated-tokens-D7QSIrTI.js","assets/vendor-hast-util-parse-selector-TXfch5wI.js","assets/vendor-vfile-location-LfEFwJ2h.js","assets/vendor-hast-util-to-parse5-BoysVIPW.js","assets/vendor-hast-util-sanitize-2aGO5ay8.js","assets/vendor-micromark-extension-gfm-CsfPlnlB.js","assets/vendor-micromark-extension-gfm-autolink-literal-BYug7onl.js","assets/vendor-micromark-extension-gfm-footnote-OFl1FCH2.js","assets/vendor-micromark-extension-gfm-strikethrough-CyFiuwBf.js","assets/vendor-micromark-extension-gfm-table-dgw4LfUw.js","assets/vendor-micromark-extension-gfm-task-list-item-Dnadzr9U.js","assets/vendor-mdast-util-gfm-CroMDYLM.js","assets/vendor-mdast-util-gfm-autolink-literal-CTruMtvI.js","assets/vendor-ccount-c2V3InAJ.js","assets/vendor-mdast-util-find-and-replace-DB9iC-bx.js","assets/vendor-escape-string-regexp-BaJN9MlJ.js","assets/vendor-mdast-util-gfm-footnote-C-csI7OF.js","assets/vendor-mdast-util-gfm-strikethrough-BcskTdio.js","assets/vendor-mdast-util-gfm-table-DhPwQIyj.js","assets/vendor-markdown-table-DvhhVmnL.js","assets/vendor-mdast-util-to-markdown-Cl3qaiyc.js","assets/vendor-longest-streak-CtXnX3Xp.js","assets/vendor-mdast-util-phrasing-4oVbNLC3.js","assets/vendor-mdast-util-gfm-task-list-item-DMU5mK_M.js","assets/vendor-mdast-util-to-hast-CWnLaQSO.js","assets/vendor-micromark-util-sanitize-uri-BbwQ7CLk.js","assets/vendor-trim-lines-D8znQY54.js","assets/vendor-micromark-extension-cjk-friendly-BzZDGrF5.js","assets/vendor-micromark-extension-cjk-friendly-util-D5lVNoxW.js","assets/vendor-get-east-asian-width-CPhS2cOv.js","assets/vendor-micromark-util-symbol-JJPacVTp.js","assets/vendor-mdast-util-to-markdown-cjk-friendly-BZ3pe_qd.js","assets/vendor-micromark-extension-cjk-friendly-gfm-strikethrough-CqW-Ep4M.js","assets/vendor-mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-BdPDQFO7.js","assets/vendor-hast-util-from-html-isomorphic-B0Kn01s9.js","assets/vendor-hast-util-from-dom-DeNf9aYW.js","assets/vendor-katex-DBqql0K7.js","assets/vendor-hast-util-to-text-0GXLnBvt.js","assets/vendor-hast-util-is-element-CuOmiqQi.js","assets/vendor-unist-util-find-after-CMaZmLxc.js","assets/vendor-micromark-extension-math-BRFoDziv.js","assets/vendor-mdast-util-math-wB-IJCL0.js","assets/vendor-remend-r8cP_t-e.js","assets/vendor-clsx-B-dksMZM.js","assets/vendor-tailwind-merge-BKkUfl9q.js","assets/vendor-marked-DN3zOnEe.js","assets/vendor-hast-util-to-jsx-runtime-Bq6JeJCx.js","assets/vendor-style-to-js-CI2G4dgu.js","assets/vendor-style-to-object-BAv4SQXc.js","assets/vendor-inline-style-parser-BlqBsVO4.js","assets/vendor-hast-util-whitespace-D4Wp6AEg.js","assets/vendor-estree-util-is-identifier-name-BgBfM8ME.js","assets/vendor-vfile-message-DqhD22jI.js","assets/vendor-unified-1CQKw2_w.js","assets/vendor-bail-FqpXQuLt.js","assets/vendor-extend-B94qxKr5.js","assets/vendor-is-plain-obj-C1gvLhAf.js","assets/vendor-trough-B_b8ryxu.js","assets/vendor-vfile-BCWrK60u.js","assets/vendor-html-url-attributes-D46m5wfe.js","assets/vendor-capacitor-core-B4EWRrHz.js","assets/katex-DKWxHuRR.css","assets/vendor-base-ui-CHqK1aDI.js","assets/vendor-floating-ui-utils-BzXdqYpP.js","assets/vendor-floating-ui-dom-WyXykhNi.js","assets/vendor-floating-ui-core-CXmKXOXc.js","assets/vendor-floating-ui-react-dom-Cy8dRGoy.js","assets/vendor-use-sync-external-store-CfLJGVyr.js","assets/vendor-simplewebauthn-browser-VDA66rT_.js","assets/vendor-dnd-kit-core-Br1Cs7RV.js","assets/vendor-dnd-kit-utilities-DZ9KbT5S.js","assets/vendor-dnd-kit-accessibility-CYclfhtC.js","assets/vendor-dnd-kit-sortable-DpfLEOLv.js","assets/vendor-tanstack-react-virtual-Bw3q1rnq.js","assets/vendor-tanstack-virtual-core-B4TJYmIq.js","assets/vendor-framer-motion-C_wK4GIM.js","assets/vendor-motion-dom-HXPOMxb7.js","assets/vendor-motion-utils-BGh8QBgx.js","assets/vendor-codemirror-commands-CjjsURR-.js","assets/vendor-codemirror-state-Cd8udR5z.js","assets/vendor-marijn-find-cluster-break-DXwl3gUT.js","assets/vendor-codemirror-view-Ciie9ey-.js","assets/vendor-style-mod-NZ5MEPvj.js","assets/vendor-w3c-keyname-Vcq4gwWv.js","assets/vendor-crelt-C8TCjufn.js","assets/vendor-codemirror-language-8HZTPOnt.js","assets/vendor-lezer-common-B3-cUCR_.js","assets/vendor-lezer-highlight-CZEcqU6G.js","assets/vendor-codemirror-streamparser-CmlTsbN2.js","assets/vendor-codemirror-lang-javascript-DmqaSK_j.js","assets/vendor-lezer-javascript-CWSwshuO.js","assets/vendor-lezer-lr-bhwg1HMg.js","assets/vendor-codemirror-autocomplete-BGedy2gC.js","assets/vendor-codemirror-lang-json-DVAYKmoO.js","assets/vendor-lezer-json-Cn1mncjr.js","assets/vendor-codemirror-lang-css-BLpgXfL2.js","assets/vendor-lezer-css-B2Hx_Nps.js","assets/vendor-codemirror-lang-html-S3jxr3Mo.js","assets/vendor-lezer-html-Cr8K5DGw.js","assets/vendor-codemirror-lang-markdown-D1jveRI5.js","assets/vendor-lezer-markdown-TQKzBB8i.js","assets/vendor-codemirror-language-data-CSQf665k.js","assets/vendor-codemirror-lang-python-B-5UC9Ui.js","assets/vendor-lezer-python-BUoImtUb.js","assets/vendor-sonner-Dw26OnzC.js","assets/vendor-cmdk-BtSpU-Io.js","assets/vendor-radix-ui-react-dialog-OIW6VLWw.js","assets/vendor-radix-ui-primitive-Dc_FVRD7.js","assets/vendor-radix-ui-react-compose-refs-D4RvEbuR.js","assets/vendor-radix-ui-react-context-BbFoxCHu.js","assets/vendor-radix-ui-react-id-aGag8i_5.js","assets/vendor-radix-ui-react-use-layout-effect-B1oLzD-j.js","assets/vendor-radix-ui-react-use-controllable-state-BjnNPGHq.js","assets/vendor-radix-ui-react-dismissable-layer-DpT6mMbO.js","assets/vendor-radix-ui-react-primitive-CrN9dRDb.js","assets/vendor-radix-ui-react-slot-BjbalUfz.js","assets/vendor-radix-ui-react-use-callback-ref-CcC_buIU.js","assets/vendor-radix-ui-react-use-escape-keydown-Cp1WWKTC.js","assets/vendor-radix-ui-react-focus-scope-D1noLHmd.js","assets/vendor-radix-ui-react-portal-BlUEzfrF.js","assets/vendor-radix-ui-react-presence-BGqFfiW4.js","assets/vendor-radix-ui-react-focus-guards-CSS2IbZC.js","assets/vendor-react-remove-scroll-Der_cv-1.js","assets/vendor-tslib-De9GV7Vy.js","assets/vendor-react-remove-scroll-bar-Clwl9llp.js","assets/vendor-react-style-singleton-D_xJlTqU.js","assets/vendor-get-nonce-C-Z93AgS.js","assets/vendor-use-sidecar-BdLl6ZIw.js","assets/vendor-use-callback-ref-CXJF1lEr.js","assets/vendor-aria-hidden-DvXkyWUv.js","assets/vendor-legendapp-list-iLtL-MFj.js","assets/vendor-class-variance-authority-5VPnzWs2.js","assets/flexokiTheme-BNUmLj3l.js","assets/vendor-codemirror-search-CWqbGraJ.js","assets/vendor-replit-codemirror-vim-DTiXsOdM.js","assets/vendor-replit-codemirror-vim-core-FHzKdNUS.js","assets/editorCodeMetrics-BzYZ4PzQ.js","assets/runtimeEndpointReset-BsAAA4Nf.js","assets/space-apply-BmOleF8W.js","assets/runtimeEndpointReset-uDNKGwhp.css","assets/useMarkdownLocalAssets-BfOLz9Xm.js","assets/fileContentPoller-p6RiDNz7.js","assets/useInlineCommentController-C-V8vqSj.js","assets/JsonTreeView-Ghbn2jaO.js","assets/parseDiffFromFile-COnIA377.js","assets/computeVirtualFileMetrics-P_6wH9ys.js","assets/themeResolver-Dybtoo13.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-DNNat5m3.js","assets/vendor-strip-json-comments-5dJlOkP1.js","assets/codeHighlight-DQ8KOMKI.js","assets/appThemeRegistry-DgyhfFpu.js","assets/textMateThemeFromAppTheme-BRUbLAuj.js","assets/ReviewCards-qePUMD-z.js","assets/contextFileOpenGuard-9zXH1DLm.js","assets/vendor-react-drawio-C6TkEvnS.js","assets/vendor-codemirror-lint-aq8IpR1c.js","assets/moveWorkspacePath-BkzUq9fV.js","assets/vendor-fflate-DB4_FQr-.js","assets/useWholeFileComment-DkYtu1tm.js","assets/diffsHighlighter-BsxkaI3Q.js","assets/scheduledTasksApi-CB-Xtp2P.js","assets/GuestPanelContent-BY7I-Y-o.js","assets/vendor-capacitor-app-BrDJj9I_.js","assets/vendor-capacitor-push-notifications-KNe1zSBF.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{f as oe,r as Pi,j as n,R as p,a as Tn,h as kl}from"./vendor-react--VO_rL_p.js";import{b3 as hn,cC as Ui,cD as Rr,cE as Pt,cs as ms,cF as Qs,cz as on,j as Wo,cG as ti,cH as $o,cI as Sl,cJ as Ko,cK as Cl,cL as Nl,cM as Rl,cN as Il,cO as El,u as Ge,l as an,n as Xs,N as Pl,O as _l,bJ as Ho,D as Tl,bM as Gi,b as Al,w as Lt,cP as Dl,bn as Vo,J as Ms,bb as Ml,cf as Ol,ba as Ll,cb as Bl,cc as Ir,co as zl,bI as Fl,cQ as Hn,bo as gi,cR as Wl,cS as $l,cT as Er,b5 as Kl,bf as Uo,cm as Hl,cU as Fn,v as _i,cV as Pr,cW as Vl,bP as Go,cX as bi,cY as Ul}from"./katex.min-2cmqKX7p.js";import{Z as gn,_ as Yt,eC as qo,eD as Gl,fh as ql,b1 as Jo,ki as Jl,u as ye,A as pe,aZ as Xo,I as G,gi as Xl,B as $e,n as bs,b8 as qi,bj as Zs,ay as Yl,a3 as me,kj as Ql,dO as xi,k as qn,kk as Zl,kl as ec,km as tc,fW as sc,W as ss,ch as nc,kn as yi,ko as ic,kp as _r,kq as Tr,kr as rc,ks as oc,ex as Qt,ho as Ji,fR as ac,fS as lc,a1 as yt,gI as cc,gK as Yo,gL as Qo,gM as Zo,kt as ea,cX as dc,gN as uc,cV as Xi,cU as ta,fo as Ti,ku as fc,bS as sa,bN as ts,fn as na,kv as mc,bP as Yi,kw as pc,dB as hc,kx as gc,ky as bc,kz as xc,cW as yc,kA as vc,kB as wc,kC as jc,kD as kc,hV as Vn,iA as Ai,ie as Ts,c_ as Sc,kE as Cc,ad as Nc,kF as Rc,bi as ia,cR as ra,fz as oa,fA as aa,y as Ic,kG as Ec,kH as Pc,kI as _c,kJ as Tc,kK as gs,kL as Ac,bl as Qi,kM as Dc,f5 as la,f7 as Mc,f8 as Oc,cy as Ar,kN as Dr,kO as Lc,kP as Bc,kQ as zc,kR as Fc,bc as Wc,bd as $c,bb as Kc,ha as Zi,kS as Hc,eP as Vc,d0 as ca,eO as Uc,be as cs,br as da,kT as Gc,kU as Di,d6 as si,z as ua,b6 as qc,a5 as Jc,dL as Xc,kV as Yc,fY as Qc,kW as Zc,eI as Mr,kX as ed,kY as td,a6 as Mi,a7 as Oi,a8 as Li,bV as Or,ae as vi,a9 as nn,kZ as fa,af as sd,ag as nd,ah as id,kd as rd,az as od,aD as ad,em as ld,ew as Vs,k_ as cd,eR as ma,eS as pa,k$ as dd,ba as ud,l0 as fd,gQ as ha,d7 as ga,l1 as md,l2 as pd,l3 as ni,cJ as hd,ih as ba,ii as xa,bL as er,bI as gd,bM as bd,l4 as xd,bO as yd,hL as vd,hB as Wn,hC as wd,cp as Bi,hD as jd,hE as kd,hM as Sd,g_ as Cd,hK as Nd,bQ as Rd,ig as Id,im as Ed,h3 as Pd,g$ as ya,bk as _d,h2 as Td,l5 as Ad,l6 as Dd,l7 as Md,l8 as Od,iq as Lr,is as wi,bR as $n,bt as Ld,bW as Bd,bT as Sn,h6 as zd,l9 as Fd,hI as Wd,hJ as $d,hG as Kd,la as Hd,lb as Vd,hS as Ud,lc as Gd,dq as qd,by as Jd,bU as Xd,iw as Yd,ix as Qd,iz as Zd,ir as eu,e_ as va,c$ as tu,ck as It,dU as su,d8 as nu,ld as iu,le as ru,lf as ou,lg as au,lh as lu,li as cu,lj as wa,lk as Br,ep as du,ll as uu,lm as fu,ln as mu,lo as pu,lp as hu,lq as gu,go as bu,eQ as zr,lr as tr,ls as xu,lt as yu,g9 as vu,ga as wu,gb as ju,gc as ku,lu as Su,lv as Fr,lw as Cu,ge as Nu,gf as Ru,gg as Iu,gh as Eu,gd as Pu,gj as _u,gk as Tu,lx as Au,ly as Du,lz as Mu,lA as Ou,fB as Wr,lB as Lu,lC as Bu,lD as $r,lE as zu,lF as Fu,lG as Wu,lH as $u,fV as Ku,lI as Hu,lJ as Vu,al as Uu,gr as Gu,gs as qu,gt as Ju}from"./useAppFontEffects-xaAfmUwn.js";import{aV as $s,aW as Xu,aX as Yu,aY as Qu,aZ as Zu,a_ as ja,a$ as Kr,b0 as ef,b1 as tf,b2 as sf,b3 as ka,b4 as nf,b5 as ii,b6 as rf,b7 as of,b8 as af,b9 as lf,ba as cf,al as df,bb as ri,bc as uf,bd as ff,be as mf,bf as pf,bg as hf,bh as gf,bi as bf,bj as Sa,bk as xf,bl as yf,bm as vf,bn as wf,bo as jf,bp as kf,bq as Sf,br as Cf,bs as Nf,bt as Rf,bu as If,bv as Ef,w as Pf,m as _f,z as Tf,S as Af,y as Df,p as Mf,bw as Of,aD as en,aK as Lf,aL as Bf,H as Hr,I as zf,J as Ff,aP as Wf,aQ as $f,K as Kf,aE as Hf,L as Vr,aR as Ur,aO as Ca,N as Vf,bx as Uf,by as Gf,aT as qf,bz as Jf,bA as Xf,bB as Yf,bC as Qf,bD as Zf,bE as em,bF as tm,bG as sm,bH as nm,bI as im,bJ as rm,bK as om,bL as am,bM as lm,bN as cm,bO as dm,bP as um,bQ as fm,bR as mm,bS as pm,bT as hm,bU as gm,bV as bm,bW as xm,bX as ym,bY as vm}from"./runtimeEndpointReset-BsAAA4Nf.js";import{i as wm}from"./initializeSharedPreferences-u4U22OVN.js";import{_ as Us}from"./vendor-vite-runtime-DD1OZmLC.js";import{S as jm,A as km}from"./SettingsView-JBCXhydZ.js";import{PlanView as Sm}from"./PlanView-jUry4bXu.js";import{SpaceAccessDialog as Cm}from"./SpaceAccessDialog-B4-bPo9e.js";import{SpaceApplyDialog as Nm}from"./SpaceApplyDialog-DjTQ5PZT.js";import{SpaceSetupOutputDialog as Rm}from"./SpaceSetupOutput-DRDEgMzx.js";import{RunOverview as Im}from"./RunOverview-CvD2Q7KM.js";import{o as sr,s as ln,a as Em}from"./vendor-zod-B_hXR7jf.js";import{p as Pm}from"./vendor-aparajita-capacitor-secure-storage-5IShChL0.js";import{Capacitor as _m,registerPlugin as Na}from"./vendor-capacitor-core-B4EWRrHz.js";import{h as Tm,i as Gr,j as Am,P as Dm,D as Mm,f as Om}from"./vendor-dnd-kit-core-Br1Cs7RV.js";import{S as Lm,v as Bm,u as zm,s as Fm,a as Wm}from"./vendor-dnd-kit-sortable-DpfLEOLv.js";import{C as $m}from"./vendor-dnd-kit-utilities-DZ9KbT5S.js";import{k as zi,M as Ra,s as Km,d as Hm,J as Vm,a as Um,P as Gm,K as qm,U as Jm,Z as Xm,Q as Ym,r as Qm}from"./vendor-remixicon-react-CLUUbkY9.js";import{S as Zm}from"./SpaceRow-CYk17vzn.js";import{toast as qr}from"./vendor-sonner-Dw26OnzC.js";import{c as ep}from"./vendor-zustand-C9tWdk0j.js";import{UsageStatsView as tp}from"./UsageStatsView-Cgo61IDa.js";import{ArchiveSessionsView as sp}from"./ArchiveView-DIg8Bq5r.js";import{MobileSourceBoard as np}from"./SourceBoardView-BuYJw-Sp.js";import{OverviewPage as ip}from"./OverviewView-CQ82APO2.js";import{ScheduledTasksView as rp}from"./ScheduledTasksDialog-Dtdb6owf.js";import{i as op,b as ap,u as lp,c as cp,d as dp,e as up,s as fp,S as mp}from"./SubmoduleDiffSummary-CTwpN0TO.js";import{a as pp,R as hp,I as gp,C as bp,b as xp,c as yp,D as vp,u as wp,d as jp}from"./useGitCleanLine-CmVX9s9E.js";import{u as kp,P as Jr,C as Sp}from"./useBranchPullRequestRequest-CIftwmmA.js";import{u as Cp,W as Np,c as Rp,d as Ip,g as Ep,f as Pp,h as _p,l as Tp,k as Ap}from"./useWalkthroughReview-BdjnKO7o.js";import{u as Dp,a as Mp,i as Xr,d as ji,B as Op,C as Lp,P as Bp,R as zp,b as Fp}from"./ChangeRequestDiffUnavailable-DtCWp1bf.js";import{p as Wp}from"./parseDiffFromFile-COnIA377.js";import{i as Ia,O as $p}from"./OfficeDocumentDiff-C-XvqPYx.js";import{u as Kp}from"./useWholeFileComment-DkYtu1tm.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-opencode-client-NJGkA1Ku.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./vendor-streamdown-BbSYZ3NF.js";import"./vendor-markdown-BTUqNk6W.js";import"./vendor-mdast-util-from-markdown-CZHjOE75.js";import"./vendor-micromark-util-decode-numeric-character-reference-CNs1qBpV.js";import"./vendor-micromark-util-decode-string-fHsnqYdj.js";import"./vendor-decode-named-character-reference-C3-224fz.js";import"./vendor-micromark-util-normalize-identifier-C9ANKk3v.js";import"./vendor-micromark-AWM-NZXP.js";import"./vendor-micromark-util-combine-extensions-d8XJZrgA.js";import"./vendor-micromark-util-chunked-DrRIdSP-.js";import"./vendor-micromark-factory-space-PzSHLgmq.js";import"./vendor-micromark-util-character-CW3Cu1MS.js";import"./vendor-micromark-core-commonmark-kzTLNXAm.js";import"./vendor-micromark-util-classify-character-tcLuZZwM.js";import"./vendor-micromark-util-resolve-all-PQCKh0dx.js";import"./vendor-micromark-util-subtokenize-BF1Jf29a.js";import"./vendor-micromark-factory-destination-Sj0xfi0V.js";import"./vendor-micromark-factory-label-amyP0HdC.js";import"./vendor-micromark-factory-title-khnLkZK6.js";import"./vendor-micromark-factory-whitespace-eIB00uTl.js";import"./vendor-micromark-util-html-tag-name-DbKNfynz.js";import"./vendor-unist-util-stringify-position-Ch_qCilz.js";import"./vendor-mdast-util-to-string-C_aolqmU.js";import"./vendor-unist-util-visit-DhPeCsfG.js";import"./vendor-unist-util-visit-parents-DlviEg7Z.js";import"./vendor-unist-util-is-BPZGFiMU.js";import"./vendor-hast-util-raw-DvvLJg15.js";import"./vendor-ungap-structured-clone--gfxRhYI.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-parse5-DwmzEj2o.js";import"./vendor-entities-wUUgTZDW.js";import"./vendor-web-namespaces-bsVAaBS1.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-unist-util-position-60F3QETU.js";import"./vendor-hast-util-from-parse5-Ba3T6RJI.js";import"./vendor-devlop-0Dp3JUBc.js";import"./vendor-property-information-Boo8Xpef.js";import"./vendor-hastscript-BrPNioaz.js";import"./vendor-comma-separated-tokens-CRUGqg4f.js";import"./vendor-space-separated-tokens-D7QSIrTI.js";import"./vendor-hast-util-parse-selector-TXfch5wI.js";import"./vendor-vfile-location-LfEFwJ2h.js";import"./vendor-hast-util-to-parse5-BoysVIPW.js";import"./vendor-hast-util-sanitize-2aGO5ay8.js";import"./vendor-micromark-extension-gfm-CsfPlnlB.js";import"./vendor-micromark-extension-gfm-autolink-literal-BYug7onl.js";import"./vendor-micromark-extension-gfm-footnote-OFl1FCH2.js";import"./vendor-micromark-extension-gfm-strikethrough-CyFiuwBf.js";import"./vendor-micromark-extension-gfm-table-dgw4LfUw.js";import"./vendor-micromark-extension-gfm-task-list-item-Dnadzr9U.js";import"./vendor-mdast-util-gfm-CroMDYLM.js";import"./vendor-mdast-util-gfm-autolink-literal-CTruMtvI.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-mdast-util-find-and-replace-DB9iC-bx.js";import"./vendor-escape-string-regexp-BaJN9MlJ.js";import"./vendor-mdast-util-gfm-footnote-C-csI7OF.js";import"./vendor-mdast-util-gfm-strikethrough-BcskTdio.js";import"./vendor-mdast-util-gfm-table-DhPwQIyj.js";import"./vendor-markdown-table-DvhhVmnL.js";import"./vendor-mdast-util-to-markdown-Cl3qaiyc.js";import"./vendor-longest-streak-CtXnX3Xp.js";import"./vendor-mdast-util-phrasing-4oVbNLC3.js";import"./vendor-mdast-util-gfm-task-list-item-DMU5mK_M.js";import"./vendor-mdast-util-to-hast-CWnLaQSO.js";import"./vendor-micromark-util-sanitize-uri-BbwQ7CLk.js";import"./vendor-trim-lines-D8znQY54.js";import"./vendor-micromark-extension-cjk-friendly-BzZDGrF5.js";import"./vendor-micromark-extension-cjk-friendly-util-D5lVNoxW.js";import"./vendor-get-east-asian-width-CPhS2cOv.js";import"./vendor-micromark-util-symbol-JJPacVTp.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-BZ3pe_qd.js";import"./vendor-micromark-extension-cjk-friendly-gfm-strikethrough-CqW-Ep4M.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-BdPDQFO7.js";import"./vendor-hast-util-from-html-isomorphic-B0Kn01s9.js";import"./vendor-hast-util-from-dom-DeNf9aYW.js";import"./vendor-katex-DBqql0K7.js";import"./vendor-hast-util-to-text-0GXLnBvt.js";import"./vendor-hast-util-is-element-CuOmiqQi.js";import"./vendor-unist-util-find-after-CMaZmLxc.js";import"./vendor-micromark-extension-math-BRFoDziv.js";import"./vendor-mdast-util-math-wB-IJCL0.js";import"./vendor-remend-r8cP_t-e.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-marked-DN3zOnEe.js";import"./vendor-hast-util-to-jsx-runtime-Bq6JeJCx.js";import"./vendor-style-to-js-CI2G4dgu.js";import"./vendor-style-to-object-BAv4SQXc.js";import"./vendor-inline-style-parser-BlqBsVO4.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";import"./vendor-estree-util-is-identifier-name-BgBfM8ME.js";import"./vendor-vfile-message-DqhD22jI.js";import"./vendor-unified-1CQKw2_w.js";import"./vendor-bail-FqpXQuLt.js";import"./vendor-extend-B94qxKr5.js";import"./vendor-is-plain-obj-C1gvLhAf.js";import"./vendor-trough-B_b8ryxu.js";import"./vendor-vfile-BCWrK60u.js";import"./vendor-html-url-attributes-D46m5wfe.js";import"./vendor-base-ui-CHqK1aDI.js";import"./vendor-floating-ui-utils-BzXdqYpP.js";import"./vendor-floating-ui-dom-WyXykhNi.js";import"./vendor-floating-ui-core-CXmKXOXc.js";import"./vendor-floating-ui-react-dom-Cy8dRGoy.js";import"./vendor-use-sync-external-store-CfLJGVyr.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-tanstack-react-virtual-Bw3q1rnq.js";import"./vendor-tanstack-virtual-core-B4TJYmIq.js";import"./vendor-framer-motion-C_wK4GIM.js";import"./vendor-motion-dom-HXPOMxb7.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-codemirror-commands-CjjsURR-.js";import"./vendor-codemirror-state-Cd8udR5z.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-Ciie9ey-.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-codemirror-language-8HZTPOnt.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CZEcqU6G.js";import"./vendor-codemirror-streamparser-CmlTsbN2.js";import"./vendor-codemirror-lang-javascript-DmqaSK_j.js";import"./vendor-lezer-javascript-CWSwshuO.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-BGedy2gC.js";import"./vendor-codemirror-lang-json-DVAYKmoO.js";import"./vendor-lezer-json-Cn1mncjr.js";import"./vendor-codemirror-lang-css-BLpgXfL2.js";import"./vendor-lezer-css-B2Hx_Nps.js";import"./vendor-codemirror-lang-html-S3jxr3Mo.js";import"./vendor-lezer-html-Cr8K5DGw.js";import"./vendor-codemirror-lang-markdown-D1jveRI5.js";import"./vendor-lezer-markdown-TQKzBB8i.js";import"./vendor-codemirror-language-data-CSQf665k.js";import"./vendor-codemirror-lang-python-B-5UC9Ui.js";import"./vendor-lezer-python-BUoImtUb.js";import"./vendor-cmdk-BtSpU-Io.js";import"./vendor-radix-ui-react-dialog-OIW6VLWw.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-D4RvEbuR.js";import"./vendor-radix-ui-react-context-BbFoxCHu.js";import"./vendor-radix-ui-react-id-aGag8i_5.js";import"./vendor-radix-ui-react-use-layout-effect-B1oLzD-j.js";import"./vendor-radix-ui-react-use-controllable-state-BjnNPGHq.js";import"./vendor-radix-ui-react-dismissable-layer-DpT6mMbO.js";import"./vendor-radix-ui-react-primitive-CrN9dRDb.js";import"./vendor-radix-ui-react-slot-BjbalUfz.js";import"./vendor-radix-ui-react-use-callback-ref-CcC_buIU.js";import"./vendor-radix-ui-react-use-escape-keydown-Cp1WWKTC.js";import"./vendor-radix-ui-react-focus-scope-D1noLHmd.js";import"./vendor-radix-ui-react-portal-BlUEzfrF.js";import"./vendor-radix-ui-react-presence-BGqFfiW4.js";import"./vendor-radix-ui-react-focus-guards-CSS2IbZC.js";import"./vendor-react-remove-scroll-Der_cv-1.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-Clwl9llp.js";import"./vendor-react-style-singleton-D_xJlTqU.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-BdLl6ZIw.js";import"./vendor-use-callback-ref-CXJF1lEr.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-legendapp-list-iLtL-MFj.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./space-apply-BmOleF8W.js";import"./install-CkKsKExH.js";import"./vendor-yaml-CE-D_49-.js";import"./flexokiTheme-BNUmLj3l.js";import"./vendor-codemirror-search-CWqbGraJ.js";import"./vendor-replit-codemirror-vim-DTiXsOdM.js";import"./vendor-replit-codemirror-vim-core-FHzKdNUS.js";import"./editorCodeMetrics-BzYZ4PzQ.js";import"./codeHighlight-DQ8KOMKI.js";import"./appThemeRegistry-DgyhfFpu.js";import"./themeResolver-Dybtoo13.js";import"./vendor-pierre-theming-D_TRfu0q.js";import"./textMateThemeFromAppTheme-BRUbLAuj.js";import"./vendor-dnd-kit-accessibility-CYclfhtC.js";import"./vendor-qrcode-Cl8OheHW.js";import"./vendor-dijkstrajs-COg3n3zL.js";import"./install-request-C0o_6GEa.js";import"./vendor-strip-json-comments-5dJlOkP1.js";import"./useCallableModelProviders-DYpBJMqj.js";import"./AboutLogo-BwwjES_b.js";import"./pageTitle-BT3-HFbv.js";import"./useInlineCommentController-C-V8vqSj.js";import"./fileContentPoller-p6RiDNz7.js";import"./useMarkdownLocalAssets-BfOLz9Xm.js";import"./spaceNetwork-DUGLrihG.js";import"./useWorktreeArchiveActions-DGzuZU_x.js";import"./scheduledTasksApi-CB-Xtp2P.js";import"./vendor-cron-parser-1X50-i0r.js";import"./vendor-luxon-BZ0puJYg.js";import"./date-time-CRucRasX.js";import"./isDiffPlainText-B70cjgtm.js";import"./computeVirtualFileMetrics-P_6wH9ys.js";import"./getFiletypeFromFileName-BgI9McTw.js";import"./vendor-diff-C3JhlQdm.js";import"./pierreDiffTint-9AmpxGGB.js";import"./hastToHtml-BHV14OWE.js";import"./vendor-hast-util-to-html-Jw3IXh58.js";import"./vendor-stringify-entities-CsH1VEn9.js";import"./vendor-character-entities-legacy-BpoLgcEt.js";import"./vendor-character-entities-html4-D7taRCQ7.js";import"./ReviewCards-qePUMD-z.js";import"./diffsHighlighter-BsxkaI3Q.js";import"./document-attachments-CIZjaOGe.js";import"./vendor-fflate-DB4_FQr-.js";import"./documentClient-BbTBnbCU.js";let Ea=null,Yr=!1;const Hp=new Promise(s=>{Ea=s});function Vp(){Yr||(Yr=!0,Ea?.())}const Up=6,Gp=s=>s.parentID??null,Fi=s=>{const e=s.replace(/\/+$/,"");return e.slice(e.lastIndexOf("/")+1)||e},qp=s=>s.replace(/\\/g,"/").replace(/\/+$/,""),Jp=(s,e)=>{if(!s)return"";let t=null,i=-1;for(const a of e){const r=qp(a.path);(s===r||s.startsWith(`${r}/`))&&r.length>i&&(t=a,i=r.length)}return t?t.label?.trim()||Fi(t.path):Fi(s)},Xp=()=>{const s=gn.getState().activeSessions,e=Yt.getState().projects,t=qo.getState().ids,i=Gl.getState().rankById;let a=0;const r=[];for(const o of s){const d=ql(o);d&&(a+=1),Gp(o)===null&&r.push({session:o,unread:d,project:Jp(Jo(o),e)})}r.sort((o,d)=>Jl(o.session,d.session,t,i));const c=r.slice(0,Up).map(({session:o,unread:d,project:u})=>({id:o.id,title:o.title??"",unread:d,project:u}));return{runtimeKey:hn(),attentionCount:a,recentSessions:c,projects:e.map(o=>({id:o.id,label:o.label?.trim()||Fi(o.path)}))}},Yp="__OPENCHAMBER_WIDGET_SNAPSHOT__",Qp=()=>{typeof window>"u"||(window[Yp]=()=>{try{return JSON.stringify(Xp())}catch{return null}})},Qr="mobile-app-update-available",Zr="mobile-app-update-toast-dismissed-version",Zp=()=>{const s=oe.c(8),{t:e}=ye(),t=$s(eh),i=$s(th),a=$s(sh),r=$s(nh);let c;s[0]===Symbol.for("react.memo_cache_sentinel")?(c=new Set,s[0]=c):c=s[0];const o=Pi.useRef(c);let d,u;return s[1]!==t||s[2]!==r||s[3]!==i||s[4]!==e||s[5]!==a?(d=()=>{if(Ui()!=="android"||i!=="mobile"||!t||!a||!r){pe.dismiss(Qr);return}Rr().getItem(Zr)!==a&&(o.current.has(a)||(o.current.add(a),pe.info(e("mobileUpdate.toast.available.title"),{id:Qr,description:e("mobileUpdate.toast.available.description",{version:a}),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:()=>{Xo(r)}},onDismiss:()=>{const l=$s.getState();l.available&&l.info?.version===a&&Rr().setItem(Zr,a)}})))},u=[t,r,i,e,a],s[1]=t,s[2]=r,s[3]=i,s[4]=e,s[5]=a,s[6]=d,s[7]=u):(d=s[6],u=s[7]),Pi.useEffect(d,u),null};function eh(s){return s.available}function th(s){return s.runtimeType}function sh(s){return s.info?.version}function nh(s){return s.info?.downloadUrl}const Pa="calc(var(--oc-safe-area-top, 0px) + var(--oc-visual-viewport-offset-top, 0px) + 16px)",ih={top:Pa,left:"calc(var(--oc-safe-area-left, 0px) + 16px)",right:"calc(var(--oc-safe-area-right, 0px) + 16px)"};function rh(s){const e=oe.c(3);let t,i;e[0]!==s?(t=()=>{const a=window.visualViewport,r=s.current;if(!a||!r)return;let c="";const o=()=>{const d=`${Math.max(0,Math.round(a.offsetTop))}px`;d!==c&&(c=d,r.style.setProperty("--oc-visual-viewport-offset-top",d))};return o(),a.addEventListener("scroll",o),a.addEventListener("resize",o),()=>{a.removeEventListener("scroll",o),a.removeEventListener("resize",o)}},i=[s],e[0]=s,e[1]=t,e[2]=i):(t=e[1],i=e[2]),p.useEffect(t,i)}function oh(){const s=oe.c(1),e=p.useRef(null);rh(e);let t;return s[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx("div",{ref:e,className:"contents",children:n.jsx(Xl,{position:"top-center",layout:"banner",offset:Pa,mobileOffset:ih})}),s[0]=t):t=s[0],t}const eo=300,ah="openchamber.mobile.connectLog.v1",tn=[];if(typeof window<"u")try{window.localStorage.removeItem(ah)}catch{}const nr=(s,e)=>{tn.push({at:Date.now(),step:s,detail:e}),tn.length>eo&&tn.splice(0,tn.length-eo)};typeof window<"u"&&nr("app:launch","{}");const lh=()=>[...tn],ch=s=>{const e=new Date(s),t=(i,a=2)=>String(i).padStart(a,"0");return`${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}.${t(e.getMilliseconds(),3)}`},_a=s=>`${ch(s.at)} ${s.step}${s.detail&&s.detail!=="{}"?` ${s.detail}`:""}`,dh=()=>tn.map(_a).join(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilesView-C6unlf1o.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-react--VO_rL_p.js","assets/vendor-scheduler-7OC5HNn7.js","assets/useAppFontEffects-BkjZnJsc.js","assets/katex.min-BRXXWH9j.js","assets/vendor-zustand-C9tWdk0j.js","assets/vendor-zod-B_hXR7jf.js","assets/vendor-opencode-client-NJGkA1Ku.js","assets/vendor-fuse.js-Dw8P0qyA.js","assets/vendor-streamdown-BbSYZ3NF.js","assets/vendor-markdown-BTUqNk6W.js","assets/vendor-mdast-util-from-markdown-CZHjOE75.js","assets/vendor-micromark-util-decode-numeric-character-reference-CNs1qBpV.js","assets/vendor-micromark-util-decode-string-fHsnqYdj.js","assets/vendor-decode-named-character-reference-C3-224fz.js","assets/vendor-micromark-util-normalize-identifier-C9ANKk3v.js","assets/vendor-micromark-AWM-NZXP.js","assets/vendor-micromark-util-combine-extensions-d8XJZrgA.js","assets/vendor-micromark-util-chunked-DrRIdSP-.js","assets/vendor-micromark-factory-space-PzSHLgmq.js","assets/vendor-micromark-util-character-CW3Cu1MS.js","assets/vendor-micromark-core-commonmark-kzTLNXAm.js","assets/vendor-micromark-util-classify-character-tcLuZZwM.js","assets/vendor-micromark-util-resolve-all-PQCKh0dx.js","assets/vendor-micromark-util-subtokenize-BF1Jf29a.js","assets/vendor-micromark-factory-destination-Sj0xfi0V.js","assets/vendor-micromark-factory-label-amyP0HdC.js","assets/vendor-micromark-factory-title-khnLkZK6.js","assets/vendor-micromark-factory-whitespace-eIB00uTl.js","assets/vendor-micromark-util-html-tag-name-DbKNfynz.js","assets/vendor-unist-util-stringify-position-Ch_qCilz.js","assets/vendor-mdast-util-to-string-C_aolqmU.js","assets/vendor-unist-util-visit-DhPeCsfG.js","assets/vendor-unist-util-visit-parents-DlviEg7Z.js","assets/vendor-unist-util-is-BPZGFiMU.js","assets/vendor-hast-util-raw-DvvLJg15.js","assets/vendor-ungap-structured-clone--gfxRhYI.js","assets/vendor-html-void-elements-CkdplsNl.js","assets/vendor-parse5-DwmzEj2o.js","assets/vendor-entities-wUUgTZDW.js","assets/vendor-web-namespaces-bsVAaBS1.js","assets/vendor-zwitch-C2o2j-tx.js","assets/vendor-unist-util-position-60F3QETU.js","assets/vendor-hast-util-from-parse5-Ba3T6RJI.js","assets/vendor-devlop-0Dp3JUBc.js","assets/vendor-property-information-Boo8Xpef.js","assets/vendor-hastscript-BrPNioaz.js","assets/vendor-comma-separated-tokens-CRUGqg4f.js","assets/vendor-space-separated-tokens-D7QSIrTI.js","assets/vendor-hast-util-parse-selector-TXfch5wI.js","assets/vendor-vfile-location-LfEFwJ2h.js","assets/vendor-hast-util-to-parse5-BoysVIPW.js","assets/vendor-hast-util-sanitize-2aGO5ay8.js","assets/vendor-micromark-extension-gfm-CsfPlnlB.js","assets/vendor-micromark-extension-gfm-autolink-literal-BYug7onl.js","assets/vendor-micromark-extension-gfm-footnote-OFl1FCH2.js","assets/vendor-micromark-extension-gfm-strikethrough-CyFiuwBf.js","assets/vendor-micromark-extension-gfm-table-dgw4LfUw.js","assets/vendor-micromark-extension-gfm-task-list-item-Dnadzr9U.js","assets/vendor-mdast-util-gfm-CroMDYLM.js","assets/vendor-mdast-util-gfm-autolink-literal-CTruMtvI.js","assets/vendor-ccount-c2V3InAJ.js","assets/vendor-mdast-util-find-and-replace-DB9iC-bx.js","assets/vendor-escape-string-regexp-BaJN9MlJ.js","assets/vendor-mdast-util-gfm-footnote-C-csI7OF.js","assets/vendor-mdast-util-gfm-strikethrough-BcskTdio.js","assets/vendor-mdast-util-gfm-table-DhPwQIyj.js","assets/vendor-markdown-table-DvhhVmnL.js","assets/vendor-mdast-util-to-markdown-Cl3qaiyc.js","assets/vendor-longest-streak-CtXnX3Xp.js","assets/vendor-mdast-util-phrasing-4oVbNLC3.js","assets/vendor-mdast-util-gfm-task-list-item-DMU5mK_M.js","assets/vendor-mdast-util-to-hast-CWnLaQSO.js","assets/vendor-micromark-util-sanitize-uri-BbwQ7CLk.js","assets/vendor-trim-lines-D8znQY54.js","assets/vendor-micromark-extension-cjk-friendly-BzZDGrF5.js","assets/vendor-micromark-extension-cjk-friendly-util-D5lVNoxW.js","assets/vendor-get-east-asian-width-CPhS2cOv.js","assets/vendor-micromark-util-symbol-JJPacVTp.js","assets/vendor-mdast-util-to-markdown-cjk-friendly-BZ3pe_qd.js","assets/vendor-micromark-extension-cjk-friendly-gfm-strikethrough-CqW-Ep4M.js","assets/vendor-mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-BdPDQFO7.js","assets/vendor-hast-util-from-html-isomorphic-B0Kn01s9.js","assets/vendor-hast-util-from-dom-DeNf9aYW.js","assets/vendor-katex-DBqql0K7.js","assets/vendor-hast-util-to-text-0GXLnBvt.js","assets/vendor-hast-util-is-element-CuOmiqQi.js","assets/vendor-unist-util-find-after-CMaZmLxc.js","assets/vendor-micromark-extension-math-BRFoDziv.js","assets/vendor-mdast-util-math-wB-IJCL0.js","assets/vendor-remend-r8cP_t-e.js","assets/vendor-clsx-B-dksMZM.js","assets/vendor-tailwind-merge-BKkUfl9q.js","assets/vendor-marked-DN3zOnEe.js","assets/vendor-hast-util-to-jsx-runtime-Bq6JeJCx.js","assets/vendor-style-to-js-CI2G4dgu.js","assets/vendor-style-to-object-BAv4SQXc.js","assets/vendor-inline-style-parser-BlqBsVO4.js","assets/vendor-hast-util-whitespace-D4Wp6AEg.js","assets/vendor-estree-util-is-identifier-name-BgBfM8ME.js","assets/vendor-vfile-message-DqhD22jI.js","assets/vendor-unified-1CQKw2_w.js","assets/vendor-bail-FqpXQuLt.js","assets/vendor-extend-B94qxKr5.js","assets/vendor-is-plain-obj-C1gvLhAf.js","assets/vendor-trough-B_b8ryxu.js","assets/vendor-vfile-BCWrK60u.js","assets/vendor-html-url-attributes-D46m5wfe.js","assets/vendor-capacitor-core-B4EWRrHz.js","assets/katex-DKWxHuRR.css","assets/vendor-base-ui-CHqK1aDI.js","assets/vendor-floating-ui-utils-BzXdqYpP.js","assets/vendor-floating-ui-dom-WyXykhNi.js","assets/vendor-floating-ui-core-CXmKXOXc.js","assets/vendor-floating-ui-react-dom-Cy8dRGoy.js","assets/vendor-use-sync-external-store-CfLJGVyr.js","assets/vendor-simplewebauthn-browser-VDA66rT_.js","assets/vendor-dnd-kit-core-Br1Cs7RV.js","assets/vendor-dnd-kit-utilities-DZ9KbT5S.js","assets/vendor-dnd-kit-accessibility-CYclfhtC.js","assets/vendor-dnd-kit-sortable-DpfLEOLv.js","assets/vendor-tanstack-react-virtual-Bw3q1rnq.js","assets/vendor-tanstack-virtual-core-B4TJYmIq.js","assets/vendor-framer-motion-C_wK4GIM.js","assets/vendor-motion-dom-HXPOMxb7.js","assets/vendor-motion-utils-BGh8QBgx.js","assets/vendor-codemirror-commands-CjjsURR-.js","assets/vendor-codemirror-state-Cd8udR5z.js","assets/vendor-marijn-find-cluster-break-DXwl3gUT.js","assets/vendor-codemirror-view-Ciie9ey-.js","assets/vendor-style-mod-NZ5MEPvj.js","assets/vendor-w3c-keyname-Vcq4gwWv.js","assets/vendor-crelt-C8TCjufn.js","assets/vendor-codemirror-language-8HZTPOnt.js","assets/vendor-lezer-common-B3-cUCR_.js","assets/vendor-lezer-highlight-CZEcqU6G.js","assets/vendor-codemirror-streamparser-CmlTsbN2.js","assets/vendor-codemirror-lang-javascript-DmqaSK_j.js","assets/vendor-lezer-javascript-CWSwshuO.js","assets/vendor-lezer-lr-bhwg1HMg.js","assets/vendor-codemirror-autocomplete-BGedy2gC.js","assets/vendor-codemirror-lang-json-DVAYKmoO.js","assets/vendor-lezer-json-Cn1mncjr.js","assets/vendor-codemirror-lang-css-BLpgXfL2.js","assets/vendor-lezer-css-B2Hx_Nps.js","assets/vendor-codemirror-lang-html-S3jxr3Mo.js","assets/vendor-lezer-html-Cr8K5DGw.js","assets/vendor-codemirror-lang-markdown-D1jveRI5.js","assets/vendor-lezer-markdown-TQKzBB8i.js","assets/vendor-codemirror-language-data-ClBHCVu_.js","assets/vendor-codemirror-lang-python-B-5UC9Ui.js","assets/vendor-lezer-python-BUoImtUb.js","assets/vendor-sonner-Dw26OnzC.js","assets/vendor-cmdk-BtSpU-Io.js","assets/vendor-radix-ui-react-dialog-OIW6VLWw.js","assets/vendor-radix-ui-primitive-Dc_FVRD7.js","assets/vendor-radix-ui-react-compose-refs-D4RvEbuR.js","assets/vendor-radix-ui-react-context-BbFoxCHu.js","assets/vendor-radix-ui-react-id-aGag8i_5.js","assets/vendor-radix-ui-react-use-layout-effect-B1oLzD-j.js","assets/vendor-radix-ui-react-use-controllable-state-BjnNPGHq.js","assets/vendor-radix-ui-react-dismissable-layer-DpT6mMbO.js","assets/vendor-radix-ui-react-primitive-CrN9dRDb.js","assets/vendor-radix-ui-react-slot-BjbalUfz.js","assets/vendor-radix-ui-react-use-callback-ref-CcC_buIU.js","assets/vendor-radix-ui-react-use-escape-keydown-Cp1WWKTC.js","assets/vendor-radix-ui-react-focus-scope-D1noLHmd.js","assets/vendor-radix-ui-react-portal-BlUEzfrF.js","assets/vendor-radix-ui-react-presence-BGqFfiW4.js","assets/vendor-radix-ui-react-focus-guards-CSS2IbZC.js","assets/vendor-react-remove-scroll-Der_cv-1.js","assets/vendor-tslib-De9GV7Vy.js","assets/vendor-react-remove-scroll-bar-Clwl9llp.js","assets/vendor-react-style-singleton-D_xJlTqU.js","assets/vendor-get-nonce-C-Z93AgS.js","assets/vendor-use-sidecar-BdLl6ZIw.js","assets/vendor-use-callback-ref-CXJF1lEr.js","assets/vendor-aria-hidden-DvXkyWUv.js","assets/vendor-legendapp-list-iLtL-MFj.js","assets/vendor-class-variance-authority-5VPnzWs2.js","assets/flexokiTheme-Yh7J7UaE.js","assets/vendor-codemirror-search-CWqbGraJ.js","assets/vendor-replit-codemirror-vim-DTiXsOdM.js","assets/vendor-replit-codemirror-vim-core-FHzKdNUS.js","assets/editorCodeMetrics-CkrWYimB.js","assets/runtimeEndpointReset-0CHuG78d.js","assets/space-apply-DlPRGjzD.js","assets/runtimeEndpointReset-uDNKGwhp.css","assets/useMarkdownLocalAssets-Cqxh_vbH.js","assets/fileContentPoller-BXbgYIo0.js","assets/useInlineCommentController-CJmX7RR7.js","assets/JsonTreeView-B1jPqBE_.js","assets/parseDiffFromFile-BSeCTEcW.js","assets/computeVirtualFileMetrics-oAeWRt0Z.js","assets/themeResolver-Dybtoo13.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-DTR6Yek4.js","assets/vendor-strip-json-comments-5dJlOkP1.js","assets/codeHighlight-vTDDxBjH.js","assets/appThemeRegistry-3vWr61EA.js","assets/textMateThemeFromAppTheme-OzgrN6CB.js","assets/ReviewCards-ClKfTGPh.js","assets/contextFileOpenGuard-BTdwRRDI.js","assets/vendor-react-drawio-C6TkEvnS.js","assets/vendor-codemirror-lint-aq8IpR1c.js","assets/moveWorkspacePath-BEX7mjeu.js","assets/vendor-fflate-DB4_FQr-.js","assets/useWholeFileComment-CHOMIHNo.js","assets/diffsHighlighter-BsxkaI3Q.js","assets/scheduledTasksApi-B5hRhk34.js","assets/GuestPanelContent-VypuCChp.js","assets/vendor-capacitor-app-BrDJj9I_.js","assets/vendor-capacitor-push-notifications-KNe1zSBF.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{f as oe,r as Pi,j as n,R as p,a as Tn,h as kl}from"./vendor-react--VO_rL_p.js";import{b3 as hn,cC as Ui,cD as Rr,cE as Pt,cs as ms,cF as Qs,cz as on,j as Wo,cG as ti,cH as $o,cI as Sl,cJ as Ko,cK as Cl,cL as Nl,cM as Rl,cN as Il,cO as El,u as Ge,l as an,n as Xs,N as Pl,O as _l,bJ as Ho,D as Tl,bM as Gi,b as Al,w as Lt,cP as Dl,bn as Vo,J as Ms,bb as Ml,cf as Ol,ba as Ll,cb as Bl,cc as Ir,co as zl,bI as Fl,cQ as Hn,bo as gi,cR as Wl,cS as $l,cT as Er,b5 as Kl,bf as Uo,cm as Hl,cU as Fn,v as _i,cV as Pr,cW as Vl,bP as Go,cX as bi,cY as Ul}from"./katex.min-BRXXWH9j.js";import{Z as gn,_ as Yt,eC as qo,eD as Gl,fh as ql,b1 as Jo,ki as Jl,u as ye,A as pe,aZ as Xo,I as G,gi as Xl,B as $e,n as bs,b8 as qi,bj as Zs,ay as Yl,a3 as me,kj as Ql,dO as xi,k as qn,kk as Zl,kl as ec,km as tc,fW as sc,W as ss,ch as nc,kn as yi,ko as ic,kp as _r,kq as Tr,kr as rc,ks as oc,ex as Qt,ho as Ji,fR as ac,fS as lc,a1 as yt,gI as cc,gK as Yo,gL as Qo,gM as Zo,kt as ea,cX as dc,gN as uc,cV as Xi,cU as ta,fo as Ti,ku as fc,bS as sa,bN as ts,fn as na,kv as mc,bP as Yi,kw as pc,dB as hc,kx as gc,ky as bc,kz as xc,cW as yc,kA as vc,kB as wc,kC as jc,kD as kc,hV as Vn,iA as Ai,ie as Ts,c_ as Sc,kE as Cc,ad as Nc,kF as Rc,bi as ia,cR as ra,fz as oa,fA as aa,y as Ic,kG as Ec,kH as Pc,kI as _c,kJ as Tc,kK as gs,kL as Ac,bl as Qi,kM as Dc,f5 as la,f7 as Mc,f8 as Oc,cy as Ar,kN as Dr,kO as Lc,kP as Bc,kQ as zc,kR as Fc,bc as Wc,bd as $c,bb as Kc,ha as Zi,kS as Hc,eP as Vc,d0 as ca,eO as Uc,be as cs,br as da,kT as Gc,kU as Di,d6 as si,z as ua,b6 as qc,a5 as Jc,dL as Xc,kV as Yc,fY as Qc,kW as Zc,eI as Mr,kX as ed,kY as td,a6 as Mi,a7 as Oi,a8 as Li,bV as Or,ae as vi,a9 as nn,kZ as fa,af as sd,ag as nd,ah as id,kd as rd,az as od,aD as ad,em as ld,ew as Vs,k_ as cd,eR as ma,eS as pa,k$ as dd,ba as ud,l0 as fd,gQ as ha,d7 as ga,l1 as md,l2 as pd,l3 as ni,cJ as hd,ih as ba,ii as xa,bL as er,bI as gd,bM as bd,l4 as xd,bO as yd,hL as vd,hB as Wn,hC as wd,cp as Bi,hD as jd,hE as kd,hM as Sd,g_ as Cd,hK as Nd,bQ as Rd,ig as Id,im as Ed,h3 as Pd,g$ as ya,bk as _d,h2 as Td,l5 as Ad,l6 as Dd,l7 as Md,l8 as Od,iq as Lr,is as wi,bR as $n,bt as Ld,bW as Bd,bT as Sn,h6 as zd,l9 as Fd,hI as Wd,hJ as $d,hG as Kd,la as Hd,lb as Vd,hS as Ud,lc as Gd,dq as qd,by as Jd,bU as Xd,iw as Yd,ix as Qd,iz as Zd,ir as eu,e_ as va,c$ as tu,ck as It,dU as su,d8 as nu,ld as iu,le as ru,lf as ou,lg as au,lh as lu,li as cu,lj as wa,lk as Br,ep as du,ll as uu,lm as fu,ln as mu,lo as pu,lp as hu,lq as gu,go as bu,eQ as zr,lr as tr,ls as xu,lt as yu,g9 as vu,ga as wu,gb as ju,gc as ku,lu as Su,lv as Fr,lw as Cu,ge as Nu,gf as Ru,gg as Iu,gh as Eu,gd as Pu,gj as _u,gk as Tu,lx as Au,ly as Du,lz as Mu,lA as Ou,fB as Wr,lB as Lu,lC as Bu,lD as $r,lE as zu,lF as Fu,lG as Wu,lH as $u,fV as Ku,lI as Hu,lJ as Vu,al as Uu,gr as Gu,gs as qu,gt as Ju}from"./useAppFontEffects-BkjZnJsc.js";import{aV as $s,aW as Xu,aX as Yu,aY as Qu,aZ as Zu,a_ as ja,a$ as Kr,b0 as ef,b1 as tf,b2 as sf,b3 as ka,b4 as nf,b5 as ii,b6 as rf,b7 as of,b8 as af,b9 as lf,ba as cf,al as df,bb as ri,bc as uf,bd as ff,be as mf,bf as pf,bg as hf,bh as gf,bi as bf,bj as Sa,bk as xf,bl as yf,bm as vf,bn as wf,bo as jf,bp as kf,bq as Sf,br as Cf,bs as Nf,bt as Rf,bu as If,bv as Ef,w as Pf,m as _f,z as Tf,S as Af,y as Df,p as Mf,bw as Of,aD as en,aK as Lf,aL as Bf,H as Hr,I as zf,J as Ff,aP as Wf,aQ as $f,K as Kf,aE as Hf,L as Vr,aR as Ur,aO as Ca,N as Vf,bx as Uf,by as Gf,aT as qf,bz as Jf,bA as Xf,bB as Yf,bC as Qf,bD as Zf,bE as em,bF as tm,bG as sm,bH as nm,bI as im,bJ as rm,bK as om,bL as am,bM as lm,bN as cm,bO as dm,bP as um,bQ as fm,bR as mm,bS as pm,bT as hm,bU as gm,bV as bm,bW as xm,bX as ym,bY as vm}from"./runtimeEndpointReset-0CHuG78d.js";import{i as wm}from"./initializeSharedPreferences-vJOU8q9Y.js";import{_ as Us}from"./vendor-vite-runtime-DD1OZmLC.js";import{S as jm,A as km}from"./SettingsView-CcxtXPxF.js";import{PlanView as Sm}from"./PlanView-Bi7nN60G.js";import{SpaceAccessDialog as Cm}from"./SpaceAccessDialog-VIsmK3Lq.js";import{SpaceApplyDialog as Nm}from"./SpaceApplyDialog-CE4GGYR-.js";import{SpaceSetupOutputDialog as Rm}from"./SpaceSetupOutput-CCkZT6Bi.js";import{RunOverview as Im}from"./RunOverview-Zx7ypz3K.js";import{o as sr,s as ln,a as Em}from"./vendor-zod-B_hXR7jf.js";import{p as Pm}from"./vendor-aparajita-capacitor-secure-storage-5IShChL0.js";import{Capacitor as _m,registerPlugin as Na}from"./vendor-capacitor-core-B4EWRrHz.js";import{h as Tm,i as Gr,j as Am,P as Dm,D as Mm,f as Om}from"./vendor-dnd-kit-core-Br1Cs7RV.js";import{S as Lm,v as Bm,u as zm,s as Fm,a as Wm}from"./vendor-dnd-kit-sortable-DpfLEOLv.js";import{C as $m}from"./vendor-dnd-kit-utilities-DZ9KbT5S.js";import{k as zi,M as Ra,s as Km,d as Hm,J as Vm,a as Um,P as Gm,K as qm,U as Jm,Z as Xm,Q as Ym,r as Qm}from"./vendor-remixicon-react-CLUUbkY9.js";import{S as Zm}from"./SpaceRow-DoksNK04.js";import{toast as qr}from"./vendor-sonner-Dw26OnzC.js";import{c as ep}from"./vendor-zustand-C9tWdk0j.js";import{UsageStatsView as tp}from"./UsageStatsView-BqLNssJZ.js";import{ArchiveSessionsView as sp}from"./ArchiveView-BZJ26vYO.js";import{MobileSourceBoard as np}from"./SourceBoardView-ClskEpR_.js";import{OverviewPage as ip}from"./OverviewView-DrjJJdxp.js";import{ScheduledTasksView as rp}from"./ScheduledTasksDialog-BqkQPZwR.js";import{i as op,b as ap,u as lp,c as cp,d as dp,e as up,s as fp,S as mp}from"./SubmoduleDiffSummary-DoIUrBdP.js";import{a as pp,R as hp,I as gp,C as bp,b as xp,c as yp,D as vp,u as wp,d as jp}from"./useGitCleanLine-e7HoRw02.js";import{u as kp,P as Jr,C as Sp}from"./useBranchPullRequestRequest-FtZEfVLl.js";import{u as Cp,W as Np,c as Rp,d as Ip,g as Ep,f as Pp,h as _p,l as Tp,k as Ap}from"./useWalkthroughReview-CeQ95bk7.js";import{u as Dp,a as Mp,i as Xr,d as ji,B as Op,C as Lp,P as Bp,R as zp,b as Fp}from"./ChangeRequestDiffUnavailable-DWvRZnAG.js";import{p as Wp}from"./parseDiffFromFile-BSeCTEcW.js";import{i as Ia,O as $p}from"./OfficeDocumentDiff-DIZPU2-t.js";import{u as Kp}from"./useWholeFileComment-CHOMIHNo.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-opencode-client-NJGkA1Ku.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./vendor-streamdown-BbSYZ3NF.js";import"./vendor-markdown-BTUqNk6W.js";import"./vendor-mdast-util-from-markdown-CZHjOE75.js";import"./vendor-micromark-util-decode-numeric-character-reference-CNs1qBpV.js";import"./vendor-micromark-util-decode-string-fHsnqYdj.js";import"./vendor-decode-named-character-reference-C3-224fz.js";import"./vendor-micromark-util-normalize-identifier-C9ANKk3v.js";import"./vendor-micromark-AWM-NZXP.js";import"./vendor-micromark-util-combine-extensions-d8XJZrgA.js";import"./vendor-micromark-util-chunked-DrRIdSP-.js";import"./vendor-micromark-factory-space-PzSHLgmq.js";import"./vendor-micromark-util-character-CW3Cu1MS.js";import"./vendor-micromark-core-commonmark-kzTLNXAm.js";import"./vendor-micromark-util-classify-character-tcLuZZwM.js";import"./vendor-micromark-util-resolve-all-PQCKh0dx.js";import"./vendor-micromark-util-subtokenize-BF1Jf29a.js";import"./vendor-micromark-factory-destination-Sj0xfi0V.js";import"./vendor-micromark-factory-label-amyP0HdC.js";import"./vendor-micromark-factory-title-khnLkZK6.js";import"./vendor-micromark-factory-whitespace-eIB00uTl.js";import"./vendor-micromark-util-html-tag-name-DbKNfynz.js";import"./vendor-unist-util-stringify-position-Ch_qCilz.js";import"./vendor-mdast-util-to-string-C_aolqmU.js";import"./vendor-unist-util-visit-DhPeCsfG.js";import"./vendor-unist-util-visit-parents-DlviEg7Z.js";import"./vendor-unist-util-is-BPZGFiMU.js";import"./vendor-hast-util-raw-DvvLJg15.js";import"./vendor-ungap-structured-clone--gfxRhYI.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-parse5-DwmzEj2o.js";import"./vendor-entities-wUUgTZDW.js";import"./vendor-web-namespaces-bsVAaBS1.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-unist-util-position-60F3QETU.js";import"./vendor-hast-util-from-parse5-Ba3T6RJI.js";import"./vendor-devlop-0Dp3JUBc.js";import"./vendor-property-information-Boo8Xpef.js";import"./vendor-hastscript-BrPNioaz.js";import"./vendor-comma-separated-tokens-CRUGqg4f.js";import"./vendor-space-separated-tokens-D7QSIrTI.js";import"./vendor-hast-util-parse-selector-TXfch5wI.js";import"./vendor-vfile-location-LfEFwJ2h.js";import"./vendor-hast-util-to-parse5-BoysVIPW.js";import"./vendor-hast-util-sanitize-2aGO5ay8.js";import"./vendor-micromark-extension-gfm-CsfPlnlB.js";import"./vendor-micromark-extension-gfm-autolink-literal-BYug7onl.js";import"./vendor-micromark-extension-gfm-footnote-OFl1FCH2.js";import"./vendor-micromark-extension-gfm-strikethrough-CyFiuwBf.js";import"./vendor-micromark-extension-gfm-table-dgw4LfUw.js";import"./vendor-micromark-extension-gfm-task-list-item-Dnadzr9U.js";import"./vendor-mdast-util-gfm-CroMDYLM.js";import"./vendor-mdast-util-gfm-autolink-literal-CTruMtvI.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-mdast-util-find-and-replace-DB9iC-bx.js";import"./vendor-escape-string-regexp-BaJN9MlJ.js";import"./vendor-mdast-util-gfm-footnote-C-csI7OF.js";import"./vendor-mdast-util-gfm-strikethrough-BcskTdio.js";import"./vendor-mdast-util-gfm-table-DhPwQIyj.js";import"./vendor-markdown-table-DvhhVmnL.js";import"./vendor-mdast-util-to-markdown-Cl3qaiyc.js";import"./vendor-longest-streak-CtXnX3Xp.js";import"./vendor-mdast-util-phrasing-4oVbNLC3.js";import"./vendor-mdast-util-gfm-task-list-item-DMU5mK_M.js";import"./vendor-mdast-util-to-hast-CWnLaQSO.js";import"./vendor-micromark-util-sanitize-uri-BbwQ7CLk.js";import"./vendor-trim-lines-D8znQY54.js";import"./vendor-micromark-extension-cjk-friendly-BzZDGrF5.js";import"./vendor-micromark-extension-cjk-friendly-util-D5lVNoxW.js";import"./vendor-get-east-asian-width-CPhS2cOv.js";import"./vendor-micromark-util-symbol-JJPacVTp.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-BZ3pe_qd.js";import"./vendor-micromark-extension-cjk-friendly-gfm-strikethrough-CqW-Ep4M.js";import"./vendor-mdast-util-to-markdown-cjk-friendly-gfm-strikethrough-BdPDQFO7.js";import"./vendor-hast-util-from-html-isomorphic-B0Kn01s9.js";import"./vendor-hast-util-from-dom-DeNf9aYW.js";import"./vendor-katex-DBqql0K7.js";import"./vendor-hast-util-to-text-0GXLnBvt.js";import"./vendor-hast-util-is-element-CuOmiqQi.js";import"./vendor-unist-util-find-after-CMaZmLxc.js";import"./vendor-micromark-extension-math-BRFoDziv.js";import"./vendor-mdast-util-math-wB-IJCL0.js";import"./vendor-remend-r8cP_t-e.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-marked-DN3zOnEe.js";import"./vendor-hast-util-to-jsx-runtime-Bq6JeJCx.js";import"./vendor-style-to-js-CI2G4dgu.js";import"./vendor-style-to-object-BAv4SQXc.js";import"./vendor-inline-style-parser-BlqBsVO4.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";import"./vendor-estree-util-is-identifier-name-BgBfM8ME.js";import"./vendor-vfile-message-DqhD22jI.js";import"./vendor-unified-1CQKw2_w.js";import"./vendor-bail-FqpXQuLt.js";import"./vendor-extend-B94qxKr5.js";import"./vendor-is-plain-obj-C1gvLhAf.js";import"./vendor-trough-B_b8ryxu.js";import"./vendor-vfile-BCWrK60u.js";import"./vendor-html-url-attributes-D46m5wfe.js";import"./vendor-base-ui-CHqK1aDI.js";import"./vendor-floating-ui-utils-BzXdqYpP.js";import"./vendor-floating-ui-dom-WyXykhNi.js";import"./vendor-floating-ui-core-CXmKXOXc.js";import"./vendor-floating-ui-react-dom-Cy8dRGoy.js";import"./vendor-use-sync-external-store-CfLJGVyr.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-tanstack-react-virtual-Bw3q1rnq.js";import"./vendor-tanstack-virtual-core-B4TJYmIq.js";import"./vendor-framer-motion-C_wK4GIM.js";import"./vendor-motion-dom-HXPOMxb7.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-codemirror-commands-CjjsURR-.js";import"./vendor-codemirror-state-Cd8udR5z.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-Ciie9ey-.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-codemirror-language-8HZTPOnt.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CZEcqU6G.js";import"./vendor-codemirror-streamparser-CmlTsbN2.js";import"./vendor-codemirror-lang-javascript-DmqaSK_j.js";import"./vendor-lezer-javascript-CWSwshuO.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-BGedy2gC.js";import"./vendor-codemirror-lang-json-DVAYKmoO.js";import"./vendor-lezer-json-Cn1mncjr.js";import"./vendor-codemirror-lang-css-BLpgXfL2.js";import"./vendor-lezer-css-B2Hx_Nps.js";import"./vendor-codemirror-lang-html-S3jxr3Mo.js";import"./vendor-lezer-html-Cr8K5DGw.js";import"./vendor-codemirror-lang-markdown-D1jveRI5.js";import"./vendor-lezer-markdown-TQKzBB8i.js";import"./vendor-codemirror-language-data-ClBHCVu_.js";import"./vendor-codemirror-lang-python-B-5UC9Ui.js";import"./vendor-lezer-python-BUoImtUb.js";import"./vendor-cmdk-BtSpU-Io.js";import"./vendor-radix-ui-react-dialog-OIW6VLWw.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-D4RvEbuR.js";import"./vendor-radix-ui-react-context-BbFoxCHu.js";import"./vendor-radix-ui-react-id-aGag8i_5.js";import"./vendor-radix-ui-react-use-layout-effect-B1oLzD-j.js";import"./vendor-radix-ui-react-use-controllable-state-BjnNPGHq.js";import"./vendor-radix-ui-react-dismissable-layer-DpT6mMbO.js";import"./vendor-radix-ui-react-primitive-CrN9dRDb.js";import"./vendor-radix-ui-react-slot-BjbalUfz.js";import"./vendor-radix-ui-react-use-callback-ref-CcC_buIU.js";import"./vendor-radix-ui-react-use-escape-keydown-Cp1WWKTC.js";import"./vendor-radix-ui-react-focus-scope-D1noLHmd.js";import"./vendor-radix-ui-react-portal-BlUEzfrF.js";import"./vendor-radix-ui-react-presence-BGqFfiW4.js";import"./vendor-radix-ui-react-focus-guards-CSS2IbZC.js";import"./vendor-react-remove-scroll-Der_cv-1.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-Clwl9llp.js";import"./vendor-react-style-singleton-D_xJlTqU.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-BdLl6ZIw.js";import"./vendor-use-callback-ref-CXJF1lEr.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-legendapp-list-iLtL-MFj.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./space-apply-DlPRGjzD.js";import"./install-BXZHlgVP.js";import"./vendor-yaml-CE-D_49-.js";import"./flexokiTheme-Yh7J7UaE.js";import"./vendor-codemirror-search-CWqbGraJ.js";import"./vendor-replit-codemirror-vim-DTiXsOdM.js";import"./vendor-replit-codemirror-vim-core-FHzKdNUS.js";import"./editorCodeMetrics-CkrWYimB.js";import"./codeHighlight-vTDDxBjH.js";import"./appThemeRegistry-3vWr61EA.js";import"./themeResolver-Dybtoo13.js";import"./vendor-pierre-theming-D_TRfu0q.js";import"./textMateThemeFromAppTheme-OzgrN6CB.js";import"./vendor-dnd-kit-accessibility-CYclfhtC.js";import"./vendor-qrcode-Cl8OheHW.js";import"./vendor-dijkstrajs-COg3n3zL.js";import"./install-request-e6fA_Hb1.js";import"./vendor-strip-json-comments-5dJlOkP1.js";import"./useCallableModelProviders-CiB4Z_LE.js";import"./AboutLogo-ChxCGRUm.js";import"./pageTitle-BT3-HFbv.js";import"./useInlineCommentController-CJmX7RR7.js";import"./fileContentPoller-BXbgYIo0.js";import"./useMarkdownLocalAssets-Cqxh_vbH.js";import"./spaceNetwork-DBQETFXl.js";import"./useWorktreeArchiveActions-BhGDka1f.js";import"./scheduledTasksApi-B5hRhk34.js";import"./vendor-cron-parser-1X50-i0r.js";import"./vendor-luxon-BZ0puJYg.js";import"./date-time-De4cJmG-.js";import"./isDiffPlainText-CBdbdXoZ.js";import"./computeVirtualFileMetrics-oAeWRt0Z.js";import"./getFiletypeFromFileName-BgI9McTw.js";import"./vendor-diff-C3JhlQdm.js";import"./pierreDiffTint-BKAarfyR.js";import"./hastToHtml-BHV14OWE.js";import"./vendor-hast-util-to-html-Jw3IXh58.js";import"./vendor-stringify-entities-CsH1VEn9.js";import"./vendor-character-entities-legacy-BpoLgcEt.js";import"./vendor-character-entities-html4-D7taRCQ7.js";import"./ReviewCards-ClKfTGPh.js";import"./diffsHighlighter-BsxkaI3Q.js";import"./document-attachments-CIZjaOGe.js";import"./vendor-fflate-DB4_FQr-.js";import"./documentClient-ByzYQ2D3.js";let Ea=null,Yr=!1;const Hp=new Promise(s=>{Ea=s});function Vp(){Yr||(Yr=!0,Ea?.())}const Up=6,Gp=s=>s.parentID??null,Fi=s=>{const e=s.replace(/\/+$/,"");return e.slice(e.lastIndexOf("/")+1)||e},qp=s=>s.replace(/\\/g,"/").replace(/\/+$/,""),Jp=(s,e)=>{if(!s)return"";let t=null,i=-1;for(const a of e){const r=qp(a.path);(s===r||s.startsWith(`${r}/`))&&r.length>i&&(t=a,i=r.length)}return t?t.label?.trim()||Fi(t.path):Fi(s)},Xp=()=>{const s=gn.getState().activeSessions,e=Yt.getState().projects,t=qo.getState().ids,i=Gl.getState().rankById;let a=0;const r=[];for(const o of s){const d=ql(o);d&&(a+=1),Gp(o)===null&&r.push({session:o,unread:d,project:Jp(Jo(o),e)})}r.sort((o,d)=>Jl(o.session,d.session,t,i));const c=r.slice(0,Up).map(({session:o,unread:d,project:u})=>({id:o.id,title:o.title??"",unread:d,project:u}));return{runtimeKey:hn(),attentionCount:a,recentSessions:c,projects:e.map(o=>({id:o.id,label:o.label?.trim()||Fi(o.path)}))}},Yp="__OPENCHAMBER_WIDGET_SNAPSHOT__",Qp=()=>{typeof window>"u"||(window[Yp]=()=>{try{return JSON.stringify(Xp())}catch{return null}})},Qr="mobile-app-update-available",Zr="mobile-app-update-toast-dismissed-version",Zp=()=>{const s=oe.c(8),{t:e}=ye(),t=$s(eh),i=$s(th),a=$s(sh),r=$s(nh);let c;s[0]===Symbol.for("react.memo_cache_sentinel")?(c=new Set,s[0]=c):c=s[0];const o=Pi.useRef(c);let d,u;return s[1]!==t||s[2]!==r||s[3]!==i||s[4]!==e||s[5]!==a?(d=()=>{if(Ui()!=="android"||i!=="mobile"||!t||!a||!r){pe.dismiss(Qr);return}Rr().getItem(Zr)!==a&&(o.current.has(a)||(o.current.add(a),pe.info(e("mobileUpdate.toast.available.title"),{id:Qr,description:e("mobileUpdate.toast.available.description",{version:a}),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:()=>{Xo(r)}},onDismiss:()=>{const l=$s.getState();l.available&&l.info?.version===a&&Rr().setItem(Zr,a)}})))},u=[t,r,i,e,a],s[1]=t,s[2]=r,s[3]=i,s[4]=e,s[5]=a,s[6]=d,s[7]=u):(d=s[6],u=s[7]),Pi.useEffect(d,u),null};function eh(s){return s.available}function th(s){return s.runtimeType}function sh(s){return s.info?.version}function nh(s){return s.info?.downloadUrl}const Pa="calc(var(--oc-safe-area-top, 0px) + var(--oc-visual-viewport-offset-top, 0px) + 16px)",ih={top:Pa,left:"calc(var(--oc-safe-area-left, 0px) + 16px)",right:"calc(var(--oc-safe-area-right, 0px) + 16px)"};function rh(s){const e=oe.c(3);let t,i;e[0]!==s?(t=()=>{const a=window.visualViewport,r=s.current;if(!a||!r)return;let c="";const o=()=>{const d=`${Math.max(0,Math.round(a.offsetTop))}px`;d!==c&&(c=d,r.style.setProperty("--oc-visual-viewport-offset-top",d))};return o(),a.addEventListener("scroll",o),a.addEventListener("resize",o),()=>{a.removeEventListener("scroll",o),a.removeEventListener("resize",o)}},i=[s],e[0]=s,e[1]=t,e[2]=i):(t=e[1],i=e[2]),p.useEffect(t,i)}function oh(){const s=oe.c(1),e=p.useRef(null);rh(e);let t;return s[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx("div",{ref:e,className:"contents",children:n.jsx(Xl,{position:"top-center",layout:"banner",offset:Pa,mobileOffset:ih})}),s[0]=t):t=s[0],t}const eo=300,ah="openchamber.mobile.connectLog.v1",tn=[];if(typeof window<"u")try{window.localStorage.removeItem(ah)}catch{}const nr=(s,e)=>{tn.push({at:Date.now(),step:s,detail:e}),tn.length>eo&&tn.splice(0,tn.length-eo)};typeof window<"u"&&nr("app:launch","{}");const lh=()=>[...tn],ch=s=>{const e=new Date(s),t=(i,a=2)=>String(i).padStart(a,"0");return`${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}.${t(e.getMilliseconds(),3)}`},_a=s=>`${ch(s.at)} ${s.step}${s.detail&&s.detail!=="{}"?` ${s.detail}`:""}`,dh=()=>tn.map(_a).join(`
|
|
3
3
|
`),uh=(s,e)=>{const t=oe.c(10),i=700,a=p.useRef(null),r=p.useRef(null),c=p.useRef(!1);let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{a.current!==null&&window.clearTimeout(a.current),a.current=null,r.current=null},t[0]=o):o=t[0];const d=o;let u,l;t[1]===Symbol.for("react.memo_cache_sentinel")?(u=()=>d,l=[d],t[1]=u,t[2]=l):(u=t[1],l=t[2]),p.useEffect(u,l);let f;t[3]!==i||t[4]!==s?(f=w=>{c.current=!1,r.current={x:w.clientX,y:w.clientY},a.current!==null&&window.clearTimeout(a.current),a.current=window.setTimeout(()=>{a.current=null,c.current=!0,s()},i)},t[3]=i,t[4]=s,t[5]=f):f=t[5];const x=f;let h;t[6]===Symbol.for("react.memo_cache_sentinel")?(h=w=>{const k=r.current;k&&(Math.abs(w.clientX-k.x)>10||Math.abs(w.clientY-k.y)>10)&&d()},t[6]=h):h=t[6];const m=h;let g;t[7]===Symbol.for("react.memo_cache_sentinel")?(g=w=>{c.current&&(c.current=!1,w.preventDefault(),w.stopPropagation())},t[7]=g):g=t[7];const b=g;let v;return t[8]!==x?(v={onPointerDown:x,onPointerMove:m,onPointerUp:d,onPointerCancel:d,onClickCapture:b},t[8]=x,t[9]=v):v=t[9],v},fh=s=>{const e=oe.c(31),{onClose:t}=s,{t:i}=ye(),[a,r]=p.useState(!1);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=lh(),e[0]=c):c=e[0];const o=c;let d;e[1]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{qi(dh()).then(S=>{S.ok&&(r(!0),window.setTimeout(()=>r(!1),2e3))})},e[1]=d):d=e[1];const u=d;let l;e[2]!==i?(l=i("mobile.connectionDebug.title"),e[2]=i,e[3]=l):l=e[3];let f;e[4]!==l?(f=n.jsx("h2",{className:"min-w-0 truncate typography-ui-label text-foreground",children:l}),e[4]=l,e[5]=f):f=e[5];const x=a?"check":"file-copy";let h;e[6]!==x?(h=n.jsx(G,{name:x,className:"size-4"}),e[6]=x,e[7]=h):h=e[7];let m;e[8]!==a||e[9]!==i?(m=i(a?"mobile.connectionDebug.copied":"mobile.connectionDebug.copy"),e[8]=a,e[9]=i,e[10]=m):m=e[10];let g;e[11]!==h||e[12]!==m?(g=n.jsxs($e,{type:"button",variant:"outline",size:"sm",onClick:u,disabled:o.length===0,children:[h,m]}),e[11]=h,e[12]=m,e[13]=g):g=e[13];let b;e[14]!==i?(b=i("mobile.connectionDebug.close"),e[14]=i,e[15]=b):b=e[15];let v;e[16]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx(G,{name:"close",className:"size-[18px]"}),e[16]=v):v=e[16];let w;e[17]!==t||e[18]!==b?(w=n.jsx($e,{type:"button",variant:"ghost",size:"icon","aria-label":b,onClick:t,children:v}),e[17]=t,e[18]=b,e[19]=w):w=e[19];let k;e[20]!==w||e[21]!==g?(k=n.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[g,w]}),e[20]=w,e[21]=g,e[22]=k):k=e[22];let E;e[23]!==k||e[24]!==f?(E=n.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-edge px-4 py-2.5",children:[f,k]}),e[23]=k,e[24]=f,e[25]=E):E=e[25];let _;e[26]!==i?(_=n.jsx(bs,{outerClassName:"min-h-0 flex-1",className:"px-4 py-3",disableHorizontal:!0,children:o.length===0?n.jsx("p",{className:"typography-small text-muted-foreground",children:i("mobile.connectionDebug.empty")}):n.jsx("pre",{className:"whitespace-pre-wrap break-words typography-code text-muted-foreground",children:o.map(_a).join(`
|
|
4
4
|
`)})}),e[26]=i,e[27]=_):_=e[27];let A;return e[28]!==E||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:[E,_]}),e[28]=E,e[29]=_,e[30]=A):A=e[30],A},mh=Em(ln(),ln()),Ta=sr({url:ln(),values:mh}),ph=(s={})=>Object.entries(s).map(([e,t])=>({id:crypto.randomUUID(),name:e,value:t})),Wi=s=>{const e=new Headers;for(const{name:t,value:i}of s){const a=t.trim();a&&i.trim()&&a.toLowerCase()!=="authorization"&&e.set(a,i.trim())}return Object.fromEntries(e)},Os=(s,e)=>e&&s.replace(/\/+$/,"")===e.url.replace(/\/+$/,"")?Wi(Object.entries(e.values).map(([t,i])=>({name:t,value:i}))):{},En={autoComplete:"off",autoCorrect:"off",spellCheck:!1},sn="oc-surface-elevated h-10 w-full oc-raised oc-field rounded-lg bg-surface-elevated px-3 text-[16px] text-foreground outline-none placeholder:text-muted-foreground",hh=s=>{const e=oe.c(27),{value:t,onChange:i,disabled:a}=s,{t:r}=ye();let c;e[0]!==r?(c=r("settings.remoteInstances.direct.headers.title"),e[0]=r,e[1]=c):c=e[1];let o;e[2]!==c?(o=n.jsx("legend",{className:"px-1 typography-ui-label text-foreground",children:c}),e[2]=c,e[3]=o):o=e[3];let d;e[4]!==r?(d=r("mobile.connect.headers.hint"),e[4]=r,e[5]=d):d=e[5];let u;e[6]!==d?(u=n.jsx("p",{className:"px-1 typography-micro text-muted-foreground",children:d}),e[6]=d,e[7]=u):u=e[7];let l;e[8]!==i||e[9]!==r||e[10]!==t?(l=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",{...En,dir:"ltr",autoCapitalize:"none",className:sn,value:b.name,onChange:v=>i(t.map(w=>w.id===b.id?{...w,name:v.target.value}:w)),placeholder:r("settings.remoteInstances.direct.headers.field.namePlaceholder"),"aria-label":r("settings.remoteInstances.direct.headers.field.namePlaceholder"),pattern:"[!#$%&'*+.^_`\\|~0-9A-Za-z\\-]+",required:!!b.value}),n.jsx("input",{...En,dir:"ltr",autoCapitalize:"none",className:sn,type:"password",pattern:"[\\x20-\\x7E\\xA0-\\xFF]*",value:b.value,onChange:v=>i(t.map(w=>w.id===b.id?{...w,value:v.target.value}:w)),placeholder:r("settings.remoteInstances.direct.headers.field.valuePlaceholder"),"aria-label":r("settings.remoteInstances.direct.headers.field.valuePlaceholder"),required:!!b.name})]}),n.jsx($e,{type:"button",variant:"ghost",size:"icon",className:"size-10",onClick:()=>i(t.filter(v=>v.id!==b.id)),"aria-label":r("settings.remoteInstances.direct.headers.removeAria"),children:n.jsx(G,{name:"close",className:"size-4"})})]},b.id)),e[8]=i,e[9]=r,e[10]=t,e[11]=l):l=e[11];let f;e[12]!==i||e[13]!==t?(f=()=>i([...t,{id:crypto.randomUUID(),name:"",value:""}]),e[12]=i,e[13]=t,e[14]=f):f=e[14];let x;e[15]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(G,{name:"add",className:"size-4"}),e[15]=x):x=e[15];let h;e[16]!==r?(h=r("settings.remoteInstances.direct.headers.actions.add"),e[16]=r,e[17]=h):h=e[17];let m;e[18]!==f||e[19]!==h?(m=n.jsxs($e,{type:"button",variant:"outline",onClick:f,children:[x,h]}),e[18]=f,e[19]=h,e[20]=m):m=e[20];let g;return e[21]!==a||e[22]!==o||e[23]!==u||e[24]!==l||e[25]!==m?(g=n.jsxs("fieldset",{className:"min-w-0 space-y-2",disabled:a,children:[o,u,l,m]}),e[21]=a,e[22]=o,e[23]=u,e[24]=l,e[25]=m,e[26]=g):g=e[26],g},gh=async(s,e)=>{let t;const i=new Promise(a=>{t=setTimeout(()=>a({response:null,failure:"timeout"}),s)});try{return await Promise.race([e.then(a=>({response:a,failure:null}),a=>({response:null,failure:a instanceof Error?a.message:String(a)})),i])}finally{t!==void 0&&clearTimeout(t)}},bh=(s,e)=>new Promise(t=>{const i=o=>{clearTimeout(r),c(),t(o)},a=o=>{o.state==="connected"?i(!0):(o.state==="idle"||o.terminal)&&i(!1)},r=setTimeout(()=>i(!1),e),c=s.subscribeStatus(a);a(s.getStatus())}),cn=(s,e,t,i)=>gh(i,s.fetch(e,t)),Aa=async(s,e,t,i)=>{const a=Date.now()+i;let r=await cn(s,e,t,i);for(;!r.response&&r.failure!=="timeout"&&s.getStatus().state!=="connected";){const c=a-Date.now();if(c<=0||!await bh(s,c))return r;const o=a-Date.now();if(o<=0)return r;r=await cn(s,e,t,o)}return r},Jn="openchamber.mobile.connections.v1",ir="openchamber.mobile.",to="openchamber.mobile.deviceId",xh=ln().startsWith(`${ir}headers.`),yh=()=>{try{const s=window.localStorage.getItem(to);if(s&&s.trim())return s.trim();const e=crypto.randomUUID();return window.localStorage.setItem(to,e),e}catch{return crypto.randomUUID()}},so=()=>`mobile:${yh()}`,no=()=>{try{const s=_m.getPlatform();return s==="ios"||s==="android"?s:void 0}catch{return}},Da=12,rr=8e3,vh=2500,wh=3e3,Xn=2500,jh=()=>{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}`,i=new URL(t);return i.hash="",i.search="",i.pathname=i.pathname.replace(/\/+$/,""),i.toString().replace(/\/+$/,"")},Un=s=>{try{return new URL(s).host}catch{return s}},dn=s=>{try{return Bs(s)}catch{return s.trim().replace(/\/+$/g,"")}},Ma=(s,e)=>dn(s)===dn(e),Oa=s=>`relay:${s.serverId}@${s.relayUrl.trim()}`,kh=s=>`relay://${s.serverId}`,An=s=>s.candidates.filter(e=>e.kind==="direct"),Ls=s=>{const e=s.candidates.find(t=>t.kind==="relay");return e&&e.kind==="relay"?e.relay:null},Ds=s=>{const e=An(s)[0];if(e)return e.url;const t=Ls(s);return t?kh(t):""},io=s=>s.serverId||Ls(s)?.serverId||null,ns=s=>{const e=Ls(s);if(e)return Oa(e);if(s.serverId)return`server:${s.serverId}`;const t=An(s)[0];return t?dn(t.url):""},ro=(s,e)=>{const t=io(s),i=io(e);return t&&i?t===i:La(s.candidates,e.candidates)},La=(s,e)=>{const t=s.find(r=>r.kind==="relay"),i=t&&t.kind==="relay"?t.relay.serverId:null,a=new Set(s.filter(r=>r.kind==="direct").map(r=>dn(r.url)));return e.some(r=>r.kind==="relay"?i!==null&&r.relay.serverId===i:a.has(dn(r.url)))},or=s=>{const e=(()=>{try{return Bs(s)}catch{return""}})();return e?[{kind:"direct",url:e}]:[]},oo=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(...or(s.url)),s.relay&&e.push({kind:"relay",relay:s.relay}),e},ar=s=>{if(!s||typeof s!="object"||Array.isArray(s))return null;const e=s;if(typeof e.relayUrl!="string"||!e.relayUrl.trim()||typeof e.serverId!="string"||!e.serverId.trim())return null;const t=e.hostEncPubJwk;if(!t||typeof t!="object"||Array.isArray(t))return null;const i=t;return i.kty!=="EC"||i.crv!=="P-256"||typeof i.x!="string"||!i.x||typeof i.y!="string"||!i.y?null:{relayUrl:e.relayUrl,serverId:e.serverId,hostEncPubJwk:{kty:"EC",crv:"P-256",x:i.x,y:i.y}}},Ba=s=>{try{return JSON.stringify(s)}catch{return String(s)}},Ve=(s,e={})=>{const t=Ba(e);console.info("[mobile-connect]",s,t),nr(s,t)},Cn=(s,e={})=>{Ve(s,e)},un=(s,e={})=>{const t=Ba(e);console.info("[mobile-storage]",s,t),nr(s,t)},Sh=s=>{if(typeof s!="string")return s;try{return JSON.parse(s)}catch{return s}},Ch=s=>{if(typeof s!="string")return s??void 0;try{return JSON.parse(s)}catch{return s}},Nh=async(s,e)=>{if(!Pt())return null;try{const{CapacitorHttp:t}=await Us(async()=>{const{CapacitorHttp:r}=await import("./vendor-capacitor-core-B4EWRrHz.js");return{CapacitorHttp:r}},[]),i=Cl(s,new Headers(e?.headers)),a=await t.request({url:s,method:e?.method||"GET",headers:Object.fromEntries(i.entries()),data:Ch(e?.body),disableRedirects:e?.redirect==="error"});return{ok:a.status>=200&&a.status<300,status:a.status,source:"native-http",json:async()=>Sh(a.data)}}catch(t){return Ve("native-http:failed",{url:s,error:t instanceof Error?t.message:String(t)}),null}},Rh=async(s,e)=>{const t=await fetch(s,e).catch(i=>(Ve("browser-fetch:failed",{url:s,error:i instanceof Error?i.message:String(i)}),null));return t?{ok:t.ok,status:t.status,source:"browser-fetch",json:()=>t.json()}:null},Yn=async(s,e,t)=>{let i;const a=new Promise(r=>{i=window.setTimeout(()=>{t?.(),r(null)},s)});try{return await Promise.race([e,a])}catch{return null}finally{i!==void 0&&window.clearTimeout(i)}},Gs=async(s,e,t)=>{const i=t?.totalTimeoutMs??rr,a=Date.now(),r=await Yn(Math.min(vh,i),Nh(s,e));if(r)return r;const c=new AbortController,o=Math.max(500,i-(Date.now()-a));return Yn(o,Rh(s,{...e,signal:c.signal}),()=>c.abort())},oi=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}},za=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},fn=15e3,mn=s=>{s?.owned&&s.client.close()},ao=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 oi(s);return t&&t.disabled!==!0&&t.authenticated===!1?e?"auth-failed":"needs-login":"ok"},Ih=async(s,e,t,i=fn,a)=>{const r=e?{Authorization:`Bearer ${e}`}:void 0,c=Ha(s);if(c){const{response:d,failure:u}=await cn(c,"/auth/session",{headers:r},i);if(Ve("relay:session",{shared:!0,ok:d?.ok===!0,status:d?.status??null,hasToken:!!e,error:u}),d){const l=await ao(d,e);return l==="ok"&&a?.keepTunnel?{outcome:l,tunnel:{client:c,owned:!1}}:{outcome:l}}}const o=Ko({relayUrl:s.relayUrl,serverId:s.serverId,hostEncPubJwk:s.hostEncPubJwk});try{const{response:d,failure:u}=await Aa(o,"/auth/session",{headers:r},i);Ve("relay:session",{shared:!1,ok:d?.ok===!0,status:d?.status??null,hasToken:!!e,error:u});const l=d?await ao(d,e):ti(o.getStatus())?"relay-limit":"unreachable";return l==="ok"&&a?.keepTunnel?{outcome:l,tunnel:{client:o,owned:!0}}:(o.close(),{outcome:l})}catch(d){throw o.close(),d}},Eh=(s,e,t,i,a)=>{const r=typeof window<"u"?window.location.origin:"",c={relayUrl:s.relayUrl,serverId:s.serverId,hostEncPubJwk:s.hostEncPubJwk,...t?{grant:t}:{}};a&&Sl(c,a),Qs({apiBaseUrl:r,clientToken:e,runtimeKey:i??Oa(s),relay:c})},Ph=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=ar(e.relay);return t?{kind:"relay",relay:t}:null}return null},_h=s=>{if(s.mode==="relay"){const e=ar(s.relay);return e?[{kind:"relay",relay:e}]:[]}return typeof s.url=="string"?or(s.url):[]},zs=()=>{if(typeof window>"u")return[];let s;try{s=JSON.parse(window.localStorage.getItem(Jn)||"[]")}catch{return[]}if(!Array.isArray(s))return[];const e=Pt();return s.flatMap(t=>{if(!t||typeof t!="object")return[];const i=t;if(typeof i.id!="string")return[];const a=Array.isArray(i.candidates)?i.candidates.map(Ph).filter(d=>!!d):_h(i);if(a.length===0)return[];const r=typeof i.clientToken=="string"&&i.clientToken.trim()?i.clientToken:void 0,c=typeof i.label=="string"&&i.label.trim()?i.label:Un(Ds({candidates:a})),o={id:i.id,label:c,candidates:a,serverId:typeof i.serverId=="string"&&i.serverId.trim()?i.serverId:void 0,lastUsedAt:typeof i.lastUsedAt=="number"?i.lastUsedAt:0,requestHeadersKey:e?xh.safeParse(i.requestHeadersKey).data:void 0,requestHeaders:e?void 0:Ta.safeParse(i.requestHeaders).data};return e?[{...o,hasToken:!!i.hasToken||!!r}]:[{...o,clientToken:r,hasToken:!!r}]}).sort((t,i)=>i.lastUsedAt-t.lastUsedAt)},$i=s=>s.kind==="relay"?{kind:"relay",relay:{relayUrl:s.relay.relayUrl,serverId:s.relay.serverId,hostEncPubJwk:s.relay.hostEncPubJwk}}:{kind:"direct",url:s.url},Fa=s=>{if(typeof window>"u")return!1;const e=Pt(),t=s.slice(0,Da).map(i=>{const a={id:i.id,label:i.label,candidates:i.candidates.map($i),serverId:i.serverId,lastUsedAt:i.lastUsedAt};return e?{...a,hasToken:!!(i.hasToken||i.clientToken),requestHeadersKey:i.requestHeadersKey}:{...a,clientToken:i.clientToken,requestHeaders:i.requestHeaders}});try{return window.localStorage.setItem(Jn,JSON.stringify(t)),!0}catch(i){return console.warn("[mobile-storage] failed to persist connection metadata",i),!1}},Th=(s,e)=>{const t=(e.id?s.find(r=>r.id===e.id):void 0)??s.find(r=>ro(r,e)),i=Pt(),a={id:e.id||t?.id||crypto.randomUUID(),label:e.label,candidates:e.candidates,serverId:e.serverId??t?.serverId,requestHeadersKey:t?.requestHeadersKey,requestHeaders:t?.requestHeaders,lastUsedAt:Date.now(),...i?{hasToken:e.hasToken??(!!e.clientToken||t?.hasToken||!1)}:{clientToken:e.clientToken??t?.clientToken,hasToken:!!(e.clientToken??t?.clientToken)}};return[a,...s.filter(r=>r.id!==a.id&&!ro(r,a))].slice(0,Da)},bn=Pm,Wa=0,lr=s=>`${ir}token.${encodeURIComponent(s)}`,ai=async(s,e)=>{let t;const i=new Promise(a=>{t=window.setTimeout(()=>a(e),wh)});try{return await Promise.race([s.catch(()=>e),i])}finally{t!==void 0&&window.clearTimeout(t)}},cr=async(s,e,t)=>Pt()?ai(e().catch(i=>(console.warn(`[mobile-storage] ${s} failed`,i),t)),t):t,Dn=async s=>{un("secure:read-start",{key:s});const e=await cr("secure:read",async()=>(await bn.internalGetItem({prefixedKey:lr(s),sync:!1})).data,null),t=typeof e=="string"&&e.trim()?e:void 0;return un("secure:read",{key:s,hasToken:!!t}),t},Ks=async(s,e)=>{un("secure:write-start",{key:s});const t=await cr("secure:write",async()=>(await bn.internalSetItem({prefixedKey:lr(s),data:e,sync:!1,access:Wa}),!0),!1);return un("secure:write",{key:s,ok:t}),t},Ah=async s=>{await cr("secure:delete",async()=>(await bn.internalRemoveItem({prefixedKey:lr(s),sync:!1}),!0),!1)};class qs extends Error{constructor(){super("Mobile header storage unavailable")}}const li=async s=>{if(!s)return;if(!Pt())return s.requestHeaders;const e=s.requestHeadersKey;if(!e)return;const t=await ai(bn.internalGetItem({prefixedKey:e,sync:!1}).then(i=>i.data),null);if(!t)throw new qs;try{const i=Ta.parse(JSON.parse(t));return Bs(i.url),Os(i.url,i),i}catch{throw new qs}},Dh=async s=>li(zs().find(e=>e.id===s)),Ki=async s=>{await ai(bn.internalRemoveItem({prefixedKey:s,sync:!1}),null)},lo=async(s,e,t)=>{if(s.requestHeaders===void 0)return li(t);const i=Bs(s.url||Ds({candidates:e})),a=Os(i,{url:i,values:s.requestHeaders});return Object.keys(a).length?{url:i,values:a}:void 0},Mh=async(s,e)=>{let t=0,i=0;return{records:await Promise.all(s.map(async r=>{if(!r||typeof r!="object")return r;const c=r,o=typeof c.url=="string"?c.url:null,d=typeof c.clientToken=="string"?c.clientToken.trim():"";if(!o||!d)return r;if(!await e(o,d))return i+=1,r;t+=1;const{clientToken:u,...l}=c;return{...l,hasToken:!0}})),migrated:t,failed:i}},$a=async()=>{if(typeof window>"u"||!Pt())return;let s;try{s=JSON.parse(window.localStorage.getItem(Jn)||"[]")}catch{return}if(!Array.isArray(s))return;const e=s.filter(i=>!!i&&typeof i=="object"&&typeof i.url=="string"&&typeof i.clientToken=="string"&&!!i.clientToken.trim());if(e.length===0)return;un("secure:migrate-start",{count:e.length});const t=await Mh(s,async(i,a)=>{const r=dn(i);return await Ks(r,a)?await Dn(r)===a:!1});if(t.migrated>0)try{window.localStorage.setItem(Jn,JSON.stringify(t.records))}catch(i){console.warn("[mobile-storage] failed to finalize secure token migration",i);return}un("secure:migrate-done",{migrated:t.migrated,failed:t.failed})},Oh=async()=>(await $a(),zs()),Ka=async s=>{let e;if(Pt()&&s.requestHeaders){const a=`${ir}headers.${crypto.randomUUID()}`;if(!await ai(bn.internalSetItem({prefixedKey:a,data:JSON.stringify(s.requestHeaders),sync:!1,access:Wa}).then(()=>!0),!1))throw new qs;e=a}const t=zs(),i=Th(t,s);if(s.requestHeaders!==void 0&&(i[0].requestHeadersKey=e,i[0].requestHeaders=Pt()?void 0:s.requestHeaders??void 0),!Fa(i))throw e&&await Ki(e),new qs;for(const a of t)a.requestHeadersKey&&!i.some(r=>r.requestHeadersKey===a.requestHeadersKey)&&await Ki(a.requestHeadersKey);return i},Qn=async s=>{const e=await Ka(s);return Pt()&&s.clientToken&&await Ks(ns(e[0]),s.clientToken),e},Lh=async s=>{const e=zs(),t=e.find(a=>a.id===s)??null,i=e.filter(a=>a.id!==s);if(!Fa(i))throw new qs;return t?.requestHeadersKey&&await Ki(t.requestHeadersKey),t&&Pt()&&await Ah(ns(t)),i},Bh=1500,Zn=async(s,e,t)=>{const i=t?.fast?{totalTimeoutMs:Xn}:void 0,a=Ls({candidates:s})?.serverId??null,r=s.find(u=>u.kind==="relay")??null,c=s.filter(u=>u.kind==="direct"),o=async()=>{for(const u of c){const l=Bs(u.url)||u.url,f=Os(l,t?.requestHeaders),x=Object.keys(f).length?"error":void 0;e&&(f.Authorization=`Bearer ${e}`);const h=await Gs(`${l}/health`,{method:"GET",headers:Os(l,t?.requestHeaders),redirect:x},i);if(Ve("probe:direct:health",{url:l,ok:h?.ok===!0,status:h?.status??null,source:h?.source??null}),!h?.ok)continue;if(a){const v=await za(h);if(v&&v!==a){Ve("probe:server-id-mismatch",{url:l});continue}}const m=await Gs(`${l}/auth/session`,{method:"GET",credentials:e?"omit":"include",headers:f,redirect:x},i);if(Ve("probe:direct:session",{url:l,ok:m?.ok===!0,status:m?.status??null,source:m?.source??null,hasToken:!!e}),m?.status===401)return{status:"needs-login"};if(!m||!m.ok&&m.status!==404)continue;const g=await oi(m);if(g&&g.disabled!==!0&&g.authenticated===!1)return{status:"needs-login"};const b=g?.disabled===!0;return!e&&Pt()&&!b&&g?.scope!=="client"?{status:"needs-login"}:{status:"ok",transport:{kind:"direct",url:l}}}return{status:"unreachable"}},d=async()=>{if(!r)return{status:"unreachable"};const{outcome:u,tunnel:l}=await Ih(r.relay,e,void 0,t?.fast?Xn:rr,{keepTunnel:!0});return u==="ok"?{status:"ok",transport:{kind:"relay",relay:r.relay,tunnel:l}}:u==="needs-login"||u==="auth-failed"?{status:"needs-login"}:u==="relay-limit"?{status:"relay-limit"}:{status:"unreachable"}};return r?c.length===0?d():new Promise(u=>{let l=!1,f=!1,x,h=null,m=null;const g=w=>{w?.status==="ok"&&w.transport.kind==="relay"&&mn(w.transport.tunnel)},b=w=>{l||(l=!0,u(w))},v=()=>{f||l||(x!==void 0&&(window.clearTimeout(x),x=void 0),d().then(w=>{if(m=w,l||f){g(w);return}if(w.status==="ok"||w.status==="needs-login"){b(w);return}h&&b(w)}))};o().then(w=>{if(h=w,!l){if(w.status==="ok"||w.status==="needs-login"){f=!0,x!==void 0&&window.clearTimeout(x),g(m),b(w);return}if(m){b(m);return}v()}}),x=window.setTimeout(v,Bh)}):o()},As=(s,e,t)=>{dr=!1,s.kind==="relay"?Eh(s.relay,e,t?.grant,t?.runtimeKey,s.tunnel?.client):Qs({apiBaseUrl:s.url,clientToken:e,runtimeKey:t?.runtimeKey,requestHeaders:Os(s.url,t?.requestHeaders)}),Ua()},Ws=()=>{const s=zs()[0];return s?.label?.trim()?s.label:null};let dr=!1;const zh=()=>{dr=!0},Nn=async s=>{if(dr)return Ve("auto-connect:suppressed",{}),{status:"no-candidate"};const e=s?.fast!==!1;await $a();const t=zs()[0];if(Ve("auto-connect:start",{hasCandidate:!!t,fast:e}),!t)return{status:"no-candidate"};let i;if(Pt()){if(t.hasToken&&(i=await Dn(ns(t)),!i))return{status:"no-candidate"}}else if(i=t.clientToken,!i&&t.hasToken)return{status:"no-candidate"};let a;try{a=await li(t)}catch{return{status:"unreachable",label:t.label}}const r=await Zn(t.candidates,i,{fast:e,requestHeaders:a});if(Ve("auto-connect:probe",{status:r.status,candidates:t.candidates.map(c=>c.kind)}),r.status==="needs-login")return{status:"needs-login",label:t.label};if(r.status==="relay-limit")return{status:"relay-limit",label:t.label};if(r.status!=="ok")return{status:"unreachable",label:t.label};if(s?.skipIfConnected&&ms())return r.transport.kind==="relay"&&mn(r.transport.tunnel),Ve("auto-connect:superseded",{}),{status:"no-candidate"};try{await Qn({id:t.id,label:t.label,candidates:t.candidates})}catch{return r.transport.kind==="relay"&&mn(r.transport.tunnel),{status:"unreachable",label:t.label}}return As(r.transport,i??null,{runtimeKey:ns(t),requestHeaders:a}),{status:"connected"}},Fh=async(s,e)=>{let t="";try{t=Bs(s.url)}catch{return!1}if(!t)return!1;const i=s.clientToken?.trim()||void 0,a=Os(t,s.requestHeaders),r=Object.keys(a).length?"error":void 0;i&&(a.Authorization=`Bearer ${i}`);const c=e?.fast?{totalTimeoutMs:Xn}:void 0;if(!(await Gs(`${t}/health`,{method:"GET",headers:a,redirect:r},c))?.ok)return!1;const d=await Gs(`${t}/auth/session`,{method:"GET",credentials:i?"omit":"include",headers:a,redirect:r},c);if(!d||!d.ok&&d.status!==404)return!1;const u=await oi(d);return!(u&&u.disabled!==!0&&u.authenticated===!1)},co=(s,e)=>{s?.kind==="relay"&&s.owned&&!e&&s.tunnel.close()},Wh=(s,e)=>s.kty===e.kty&&s.crv===e.crv&&s.x===e.x&&s.y===e.y,Ha=s=>{const e=$o(),t=Nl();return!e||!t||e.getStatus().state!=="connected"?null:t.relayUrl===s.relayUrl&&t.serverId===s.serverId&&Wh(t.hostEncPubJwk,s.hostEncPubJwk)?e:null},$h=s=>[...s].sort((e,t)=>{const i=(e.priority??100)-(t.priority??100);if(i!==0)return i;const a=r=>r.type==="relay"?2:r.url.startsWith("https://")?0:1;return a(e)-a(t)}).flatMap(e=>{if(e.type==="relay"){const t=ar({relayUrl:e.relayUrl,serverId:e.serverId,hostEncPubJwk:e.hostEncPubJwk});return t?[{kind:"relay",relay:t}]:[]}return or(e.url)}),uo=async(s,e)=>{let t=!1;const i=Ls({candidates:s})?.serverId??null;for(const a of s){if(a.kind==="relay"){const u=Ha(a.relay);if(u){const h=await cn(u,"/health",void 0,rr);if(Ve("establish:relay:health",{shared:!0,ok:h.response?.ok===!0,status:h.response?.status??null,error:h.failure}),h.response?.ok)return{kind:"relay",relay:a.relay,tunnel:u,owned:!1}}const l=Ko(a.relay),{response:f,failure:x}=await Aa(l,"/health",void 0,fn);if(Ve("establish:relay:health",{shared:!1,ok:f?.ok===!0,status:f?.status??null,error:x}),f?.ok)return{kind:"relay",relay:a.relay,tunnel:l,owned:!0};t||=ti(l.getStatus()),l.close();continue}const r=Bs(a.url)||a.url,c=Os(r,e),o=await Gs(`${r}/health`,{method:"GET",headers:c,redirect:Object.keys(c).length?"error":void 0});if(Ve("establish:direct:health",{ok:o?.ok===!0,status:o?.status??null}),!o?.ok)continue;const d=await za(o);if(i&&d&&d!==i){Ve("establish:server-id-mismatch",{url:r});continue}return{kind:"direct",url:r,serverId:d}}return t?"relay-limit":null},Kh=async(s,e)=>{if(!on())return await Fh(s,e)?"valid":"invalid";const t=await Yn(e?.fast?Xn:fn,Wo("/auth/session").then(a=>a).catch(()=>null));if(!t)return ti($o()?.getStatus())?"relay-limit":"valid";if(t.status===401)return"invalid";if(!t.ok&&t.status!==404)return"valid";const i=await oi(t);return i&&i.disabled!==!0&&i.authenticated===!1?"invalid":"valid"},Hh=s=>s.kind==="relay"?on():!on()&&Ma(s.url,ms()),Va=()=>{const s=hn();return s?zs().find(e=>ns(e)===s)??null:null},Hi=s=>{const e=hn();return!!e&&ns(s)===e},Gn=async s=>{const e=s?.fast!==!1,t=Va();if(!t)return Ve("reprobe:no-connection",{runtimeKey:!!hn()}),"no-connection";let i;if(Pt()?i=t.hasToken?await Dn(ns(t)):void 0:i=t.clientToken,!i&&t.hasToken)return Ve("reprobe:no-token",{hasToken:!0}),"unreachable";Ve("reprobe:start",{candidates:t.candidates.map(f=>f.kind),fast:e,hasToken:!!i});const a=t.candidates.findIndex(f=>Hh(f.kind==="relay"?{kind:"relay",relay:f.relay}:{kind:"direct",url:f.url})),r=a>=0?t.candidates.slice(0,a):t.candidates;let c;try{c=await li(t)}catch{return"unreachable"}const o=await Zn(r,i,{fast:e,requestHeaders:c});if(Ve("reprobe:better",{status:o.status,probed:r.length}),o.status==="ok"){try{await Qn({id:t.id,label:t.label,candidates:t.candidates})}catch{return o.transport.kind==="relay"&&mn(o.transport.tunnel),"unreachable"}return As(o.transport,i??null,{runtimeKey:ns(t),requestHeaders:c}),"switched"}if(o.status==="needs-login")return"needs-login";let d=null;if(a>=0&&(d=await Kh({url:ms(),clientToken:i,requestHeaders:c},{fast:e}),Ve("reprobe:current",{current:d}),d==="valid"))return Ua(),"unchanged";const u=a>=0?t.candidates.slice(a+1):[],l=await Zn(u,i,{fast:e,requestHeaders:c});if(Ve("reprobe:fallback",{status:l.status,probed:u.length}),l.status==="ok"){try{await Qn({id:t.id,label:t.label,candidates:t.candidates})}catch{return l.transport.kind==="relay"&&mn(l.transport.tunnel),"unreachable"}return As(l.transport,i??null,{runtimeKey:ns(t),requestHeaders:c}),"switched"}return l.status==="needs-login"?"needs-login":[o.status,l.status,d].includes("relay-limit")?"relay-limit":"unreachable"},Vh=5e3;let ki=!1;const Uh=async()=>{if(ki)return"skipped";const s=Va();if(!s)return Ve("candidates:refresh-skip",{reason:"no-active-connection"}),"skipped";const e=Ls(s);if(!e)return Ve("candidates:refresh-skip",{reason:"no-relay-candidate"}),"skipped";ki=!0;try{const t=await Yn(fn,Wo("/api/client-auth/connection/candidates").then(u=>u).catch(()=>null));if(!t?.ok)return Ve("candidates:refresh-skip",{reason:"fetch-failed",status:t?.status??null}),"skipped";const i=await t.json().catch(()=>null);if(!i||i.serverId!==e.serverId)return Ve("candidates:refresh-skip",{reason:"server-id-mismatch"}),"skipped";const a=Array.isArray(i.candidates)?i.candidates:[],r=[];for(const u of a){if(!u||typeof u!="object")continue;const l=u;if(!(l.type!=="lan"||typeof l.url!="string"))try{const f=Bs(l.url);f&&!r.includes(f)&&r.push(f)}catch{}}if(r.length===0)return Ve("candidates:refresh-skip",{reason:"no-lan-reported"}),"skipped";const c=An(s).filter(u=>u.url.startsWith("https://")),o=[...r.map(u=>({kind:"direct",url:u})),...c,{kind:"relay",relay:e}];return JSON.stringify(s.candidates.map($i))===JSON.stringify(o.map($i))?"unchanged":(Ve("candidates:refreshed",{lanCount:r.length}),await Qn({id:s.id,label:s.label,candidates:o}),"updated")}finally{ki=!1}},Ua=()=>{typeof window>"u"||window.setTimeout(()=>{(async()=>{const s=await Uh().catch(()=>"skipped");Ve("candidates:refresh-result",{result:s}),s==="updated"&&on()&&await Gn().catch(()=>null)})()},Vh)},Gh=s=>{const{t:e}=ye(),[t,i]=p.useState(()=>zs()),[a,r]=p.useState(null),[c,o]=p.useState(null),[d,u]=p.useState(null),l=p.useRef(t),f=p.useRef(null),x=p.useRef(jh()),h=p.useCallback(S=>{l.current=S,i(S)},[]),m=p.useCallback(S=>{f.current=S,r(S)},[]),g=p.useCallback(S=>{f.current===S&&(f.current=null,r(null))},[]);p.useEffect(()=>{let S=!1;return Oh().then(C=>{S||h(C)}),()=>{S=!0}},[h]);const b=p.useCallback(async S=>{const C=await Ka(S);return h(C),C},[h]),v=p.useCallback(async S=>{o(null),m("connect");let C;try{const j=oo(S);if(j.length===0){o(e("mobile.connect.error.urlRequired"));return}const T=S.id?l.current.find(W=>W.id===S.id):l.current.find(W=>La(W.candidates,j)),R=S.label?.trim()||T?.label||Un(Ds({candidates:j})),K=await lo(S,j,T),P=S.requestHeaders===void 0?void 0:K??null,z=S.relayGrant,O=ns({candidates:j,serverId:T?.serverId});let D=S.clientToken?.trim()||void 0;const M=!!D;D||(Pt()?T?.hasToken&&(D=await Dn(O)):D=T?.clientToken),Ve("connect:start",{candidates:j.map(W=>W.kind),hasToken:!!D});const L=await Zn(j,D,{requestHeaders:K});if(L.status==="ok"&&L.transport.kind==="relay"&&(C=L.transport.tunnel),Ve("connect:probe",{status:L.status}),L.status==="unreachable"){o(e("mobile.connect.error.unreachable"));return}if(L.status==="relay-limit"){o(e("mobile.connect.error.relayLimit"));return}if(L.status==="needs-login"){const W=await b({id:T?.id,label:R,candidates:j,requestHeaders:P});u({id:W[0].id,label:R,candidates:j,serverId:T?.serverId,relay:Ls({candidates:j})??void 0,relayGrant:z,requestHeaders:K});return}D&&M&&Pt()&&await Ks(O,D),await b({id:T?.id,label:R,candidates:j,clientToken:D,requestHeaders:P}),As(L.transport,D??null,{runtimeKey:O,grant:z,requestHeaders:K}),C=void 0,s()}catch(j){console.warn("[mobile-connect] connect threw",j),o(e(j instanceof qs?"mobile.connect.headers.error":"mobile.connect.error.invalidUrl"))}finally{mn(C),g("connect")}},[m,g,s,b,e]),w=p.useCallback(async S=>{if(f.current==="pairing")return;o(null),m("pairing");const C=$h(S.candidates);let j=null,T=!1;try{const R=await uo(C);if(!R||R==="relay-limit"){o(e(R?"mobile.connect.error.relayLimit":"mobile.connect.error.unreachable"));return}j=R;const K=JSON.stringify({pairingId:S.pairingId,secret:S.secret,clientLabel:"OpenChamber Mobile",clientKind:"mobile",deviceName:"OpenChamber Mobile",devicePlatform:no(),dedupeKey:so()}),P={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:K},z=j.kind==="relay"?await cn(j.tunnel,"/api/client-auth/pairing/redeem",P,fn):{response:await Gs(`${j.url}/api/client-auth/pairing/redeem`,P),failure:null},O=z.response;if(Ve("pairing:redeem",{transport:j.kind,ok:O?.ok===!0,status:O?.status??null,error:z.failure}),!O?.ok){o(e("mobile.connect.error.authRequired"));return}const D=await O.json().catch(()=>null),M=typeof D?.clientToken=="string"?D.clientToken.trim():"";if(!M){o(e("mobile.connect.error.authRequired"));return}const L=typeof D?.server?.label=="string"?D.server.label:"",W=S.label||L||Un(Ds({candidates:C})),F=j.kind==="direct"?j.serverId:void 0,N=ns({candidates:C,serverId:F});if(Pt()&&!await Ks(N,M)){o(e("mobile.connect.error.authRequired"));return}await b({label:W,candidates:C,serverId:F,clientToken:M}),As(j.kind==="relay"?{kind:"relay",relay:j.relay,tunnel:{client:j.tunnel,owned:j.owned}}:{kind:"direct",url:j.url},M,{runtimeKey:N}),T=j.kind==="relay",s()}catch(R){console.warn("[mobile-connect] pairing threw",R),o(e("mobile.connect.error.authRequired"))}finally{co(j,T),g("pairing")}},[m,g,s,b,e]),k=p.useCallback(async S=>{if(!d||!S.trim()||f.current==="password")return;o(null),m("password");const C=x.current.begin(),j=()=>x.current.isCurrent(C),{id:T,label:R,candidates:K,serverId:P,requestHeaders:z}=d,O=ns({candidates:K,serverId:P});let D=null,M=!1;try{const L=await uo(K,z);if(L!=="relay-limit"&&(D=L),!j())return;if(!D){o(e(L==="relay-limit"?"mobile.connect.error.relayLimit":"mobile.connect.error.unreachable"));return}const W={};D.kind==="direct"&&Object.assign(W,Os(D.url,z));const F=Object.keys(W).length?"error":void 0;W["Content-Type"]="application/json",W.Accept="application/json";const N={method:"POST",credentials:"include",headers:W,redirect:F,body:JSON.stringify({password:S,trustDevice:!0,issueClientToken:!0,clientLabel:"OpenChamber Mobile",clientKind:"mobile",devicePlatform:no(),dedupeKey:so()})};Ve("password:start",{transport:D.kind});const I=D.kind==="relay"?await cn(D.tunnel,"/auth/session",N,fn):{response:await Gs(`${D.url}/auth/session`,N),failure:null},B=I.response;if(!j())return;if(Ve("password:done",{ok:B?.ok===!0,status:B?.status??null,error:I.failure}),!B?.ok){o(e("mobile.connect.error.passwordFailed"));return}const Q=await B.json().catch(()=>null);if(!j())return;const J=typeof Q?.clientToken=="string"?Q.clientToken.trim():"";if(Ve("password:token",{issued:!!J}),!J){if(D.kind==="direct"&&!Pt()){if(await b({id:T,label:R,candidates:K}),!j())return;u(null),As({kind:"direct",url:D.url},null,{runtimeKey:O,requestHeaders:z}),s();return}o(e("mobile.connect.error.authRequired"));return}if(Pt()&&(!j()||(await Ks(O,J),!j()))||!j()||(await b({id:T,label:R,candidates:K,clientToken:J}),!j())||(u(null),As(D.kind==="relay"?{kind:"relay",relay:D.relay,tunnel:{client:D.tunnel,owned:D.owned}}:{kind:"direct",url:D.url},J,{runtimeKey:O,requestHeaders:z}),M=D.kind==="relay",!j()))return;s()}catch(L){if(!j())return;console.warn("[mobile-connect] password threw",L),o(e(L instanceof qs?"mobile.connect.headers.error":"mobile.connect.error.passwordFailed"))}finally{co(D,M),j()&&g("password")}},[m,g,s,d,b,e]),E=p.useCallback(()=>{x.current.cancel(),g("password"),u(null),o(null)},[g]),_=p.useCallback(async S=>{o(null);let C=oo(S);const j=S.id?l.current.find(P=>P.id===S.id)??null:null;if(j){const P=C.filter(D=>D.kind==="direct"),z=An(j).filter(D=>D.url.startsWith("https://")&&!P.some(M=>Ma(M.url,D.url))),O=Ls(j);C=[...P,...z,...O?[{kind:"relay",relay:O}]:[]]}if(C.length===0)return o(e("mobile.connect.error.urlRequired")),null;const T=S.clientToken?.trim()||void 0,R=An({candidates:C}).length===0&&j?j.label:Un(Ds({candidates:C})),K=S.label?.trim()||R;if(Pt()){const P=ns({candidates:C,serverId:j?.serverId});if(T)await Ks(P,T);else if(j?.hasToken){const z=ns(j);if(z&&P&&z!==P){const O=await Dn(z);O&&await Ks(P,O)}}}try{const P=S.requestHeaders===void 0?void 0:await lo(S,C,j??void 0)??null,z=await b({id:S.id,label:K,candidates:C,clientToken:T,requestHeaders:P});return j&&Hi(j)&&!on()&&S.requestHeaders!==void 0&&As({kind:"direct",url:ms()},Rl()||null,{runtimeKey:hn(),requestHeaders:P??void 0}),z[0]??null}catch{return o(e("mobile.connect.headers.error")),null}},[b,e]),A=p.useCallback(async S=>{const C=l.current.find(j=>j.id===S)??null;try{const j=await Lh(S);return h(j),C}catch{return o(e("mobile.connect.headers.error")),null}},[h,e]);return{connections:t,isBusy:a!==null,isPasswordBusy:a==="password",error:c,pendingConnection:d,connect:v,redeemPairingConnection:w,submitPassword:k,cancelPassword:E,saveConnection:_,removeConnection:A,setError:o}},Ga=()=>{if(typeof window>"u")return null;const e=window.Capacitor?.Plugins?.BarcodeScanner;return e&&(typeof e.scan=="function"||typeof e.startScan=="function")?e:null},qa=()=>window.Capacitor?.getPlatform?.()==="android",qh=()=>qa(),Ja=s=>{const e=s.trim();if(!e)return null;if(/^openchamber:\/\//i.test(e)){const t=Il(e)??El(e);return t?{pairing:t}:null}return/^https?:\/\//i.test(e)?{url:e}:null},Xa=s=>{const e=Ja(s);return e?"pairing"in e?{status:"pairing",...e}:{status:"ok",...e}:{status:"invalid"}},Jh=async(s,e)=>{if(!s.startScan||!s.stopScan||!s.addListener)return{status:"unsupported"};if(e?.aborted)return{status:"cancelled"};let t,i,a=!1,r=()=>{};const c=new Promise(u=>{r=u}),o=u=>{a||(a=!0,r(u))},d=()=>o({status:"cancelled"});e?.addEventListener("abort",d,{once:!0});try{return(await Promise.allSettled([Promise.resolve(s.addListener("barcodesScanned",({barcodes:l})=>{const f=l?.[0],x=(f?.rawValue??f?.displayValue??"").trim();x&&o(Xa(x))})).then(l=>{t=l}),Promise.resolve(s.addListener("scanError",()=>o({status:"failed"}))).then(l=>{i=l})])).some(({status:l})=>l==="rejected")?o({status:"failed"}):a||s.startScan({formats:["QR_CODE"]}).catch(()=>o({status:"failed"})),await c}finally{e?.removeEventListener("abort",d),await Promise.allSettled([Promise.resolve(t?.remove()),Promise.resolve(i?.remove()),s.stopScan()])}},Xh=()=>Ga()!==null,Yh=async s=>{const e=Ga();if(!e)return{status:"unsupported"};try{if(e.requestPermissions){const c=(await e.requestPermissions())?.camera;if(c&&c!=="granted"&&c!=="limited")return{status:"permission-denied"}}if(s?.signal?.aborted)return{status:"cancelled"};if(qa())return Jh(e,s?.signal);if(!e.scan)return{status:"unsupported"};const i=(await e.scan({formats:["QR_CODE"]}))?.barcodes?.[0],a=(i?.rawValue??i?.displayValue??"").trim();return a?Xa(a):{status:"cancelled"}}catch{return{status:"failed"}}},Qh=s=>{const e=oe.c(23),{onCancel:t}=s,{t:i}=ye(),a=p.useRef(null);let r,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{const v={value:document.documentElement.style.getPropertyValue("background-color"),priority:document.documentElement.style.getPropertyPriority("background-color")},w={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 k=new Map,E=A=>{!(A instanceof HTMLElement)||A===a.current||k.has(A)||(k.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(E);const _=new MutationObserver(A=>{A.forEach(S=>S.addedNodes.forEach(E))});return _.observe(document.body,{childList:!0}),()=>{_.disconnect(),k.forEach(e1),v.value?document.documentElement.style.setProperty("background-color",v.value,v.priority):document.documentElement.style.removeProperty("background-color"),w.value?document.body.style.setProperty("background-color",w.value,w.priority):document.body.style.removeProperty("background-color")}},c=[],e[0]=r,e[1]=c):(r=e[0],c=e[1]),p.useLayoutEffect(r,c);let o,d;if(e[2]!==t?(o=()=>{const v=()=>{document.visibilityState==="hidden"&&t()};return document.addEventListener("visibilitychange",v),()=>document.removeEventListener("visibilitychange",v)},d=[t],e[2]=t,e[3]=o,e[4]=d):(o=e[3],d=e[4]),p.useEffect(o,d),!qh()){let v;return e[5]===Symbol.for("react.memo_cache_sentinel")?(v=Tn.createPortal(n.jsx("div",{ref:a,className:"fixed inset-0 z-[1000] bg-background","aria-hidden":!0}),document.body),e[5]=v):v=e[5],v}let u;e[6]!==i?(u=i("mobile.connect.scanQr"),e[6]=i,e[7]=u):u=e[7];let l;e[8]===Symbol.for("react.memo_cache_sentinel")?(l=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[8]=l):l=e[8];let f;e[9]!==i?(f=i("mobile.connect.welcome.scanHint"),e[9]=i,e[10]=f):f=e[10];let x;e[11]!==f?(x=n.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-6",children:[l,n.jsx("p",{className:"max-w-sm rounded-[16px] border border-edge bg-background px-4 py-3 text-center typography-markdown text-foreground shadow-sm",children:f})]}),e[11]=f,e[12]=x):x=e[12];let h;e[13]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(G,{name:"close",className:"size-[18px]"}),e[13]=h):h=e[13];let m;e[14]!==i?(m=i("mobile.instances.cancelEdit"),e[14]=i,e[15]=m):m=e[15];let g;e[16]!==t||e[17]!==m?(g=n.jsxs($e,{type:"button",variant:"outline",size:"lg",className:"mx-auto min-h-12 w-full max-w-sm bg-background",onClick:t,children:[h,m]}),e[16]=t,e[17]=m,e[18]=g):g=e[18];let b;return e[19]!==g||e[20]!==u||e[21]!==x?(b=Tn.createPortal(n.jsxs("div",{ref:a,role:"dialog","aria-modal":"true","aria-label":u,className:"fixed inset-0 z-[1000] flex flex-col bg-transparent px-6 pb-[calc(var(--safe-area-inset-bottom,env(safe-area-inset-bottom,0px))+24px)] pt-[calc(var(--safe-area-inset-top,env(safe-area-inset-top,0px))+24px)] text-foreground",children:[x,g]}),document.body),e[19]=g,e[20]=u,e[21]=x,e[22]=b):b=e[22],b},Zh=()=>{const s=oe.c(6),{t:e}=ye();let t;s[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx(Zs,{width:96,height:96,isAnimated:!0}),s[0]=t):t=s[0];let i;s[1]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(G,{name:"loader-4",className:"size-[18px] animate-spin"}),s[1]=i):i=s[1];let a;s[2]!==e?(a=e("mobile.connect.connecting"),s[2]=e,s[3]=a):a=s[3];let r;return s[4]!==a?(r=Tn.createPortal(n.jsxs("div",{role:"status",className:"fixed inset-0 z-[1000] flex flex-col items-center justify-center gap-5 bg-background px-6 text-foreground",children:[t,n.jsxs("div",{className:"flex items-center gap-2 typography-ui-label text-muted-foreground",children:[i,n.jsx("span",{children:a})]})]}),document.body),s[4]=a,s[5]=r):r=s[5],r};function e1(s,e){e.style.opacity=s.opacity,e.style.pointerEvents=s.pointerEvents}const Kn=s=>!s.candidates.some(e=>e.kind==="direct"),t1=s=>s.some(({name:e,value:t})=>e.trim()||t.trim()),Ya=s=>{const{mode:e,onConnected:t}=s,{t:i}=ye(),a=Gh(t),{connections:r,isBusy:c,isPasswordBusy:o,error:d,pendingConnection:u,connect:l,submitPassword:f,cancelPassword:x,saveConnection:h,removeConnection:m,setError:g}=a,[b,v]=p.useState(null),[w,k]=p.useState(""),[E,_]=p.useState(""),[A,S]=p.useState(""),[C,j]=p.useState([]),[T,R]=p.useState(!1),K=p.useRef(0),[P,z]=p.useState(null),[O,D]=p.useState(!1),M=P?r.find(ee=>ee.id===P)??null:null,L=b?.kind==="edit"?r.find(ee=>ee.id===b.id)??null:null,W=L?Kn(L):!1,[F,N]=p.useState(null),[I,B]=p.useState(""),[Q,J]=p.useState(!1),X=Yl(Q),[q,Z]=p.useState(!1),H=p.useRef(null),V=p.useMemo(()=>Xh(),[]),[se,te]=p.useState(!1),re=uh(p.useCallback(()=>te(!0),[])),ne=p.useCallback(()=>{K.current+=1,v(null),k(""),_(""),S(""),j([]),g(null)},[g]),ue=()=>{K.current+=1,g(null),v({kind:"add"})},Y=ee=>{const be=++K.current;z(null),Dh(ee.id).then(Ze=>{be===K.current&&(v({kind:"edit",id:ee.id}),k(Kn(ee)?"":Ze?.url||Ds(ee)),_(ee.label),S(ee.clientToken||""),j(ph(Ze?.values)),g(null))}).catch(()=>{be===K.current&&g(i("mobile.connect.headers.error"))})},ie=ee=>{if(e==="welcome"&&/^openchamber:\/\//i.test(ee.trim())){const be=Ja(ee);if(be){if("pairing"in be){a.redeemPairingConnection(be.pairing);return}k(be.url),be.label&&_(be.label),be.clientToken&&S(be.clientToken);return}}k(ee)},ae=ee=>{if(ee.preventDefault(),e==="welcome"&&b?.kind==="add"){l({url:w,clientToken:A,label:E,requestHeaders:t1(C)?Wi(C):void 0});return}T||(R(!0),h({id:L?.id,url:w,label:E,clientToken:A,requestHeaders:W?void 0:Wi(C)}).then(be=>{be&&ne()}).finally(()=>R(!1)))},Pe=async()=>{if(H.current||c)return;g(null),J(!0);const ee=new AbortController;H.current=ee;try{const be=await Yh({signal:ee.signal});switch(H.current===ee&&(H.current=null,J(!1)),be.status){case"ok":k(be.url),be.label&&_(be.label),be.clientToken&&S(be.clientToken),e==="welcome"?(Z(!0),await l({url:be.url,clientToken:be.clientToken,label:be.label})):v({kind:"add"});break;case"pairing":Z(!0),await a.redeemPairingConnection(be.pairing);break;case"permission-denied":g(i("mobile.connect.scan.permissionDenied"));break;case"invalid":g(i("mobile.connect.scan.invalid"));break;case"unsupported":g(i("mobile.connect.scan.unsupported"));break;case"failed":g(i("mobile.connect.scan.failed"));break;default:break}}finally{Z(!1),H.current===ee&&(H.current=null,J(!1))}};p.useEffect(()=>()=>{H.current?.abort(),K.current+=1},[]);const Be=ee=>{N(ee.id),l({id:ee.id,candidates:ee.candidates,clientToken:ee.clientToken,label:ee.label}).finally(()=>N(null))},xe=()=>{z(null),D(!1)},Re=ee=>{K.current+=1,xe(),b?.kind==="edit"&&b.id===ee&&ne();const be=r.length===1;m(ee).then(Ze=>{!Ze||e!=="instances"||(be||Hi(Ze))&&s.onActiveConnectionDeleted()})},le=e==="instances"?r.find(Hi)??null:null,ce=le??r[0]??null,Ie=r.filter(ee=>ee!==ce),Ne=ee=>Kn(ee)?i("mobile.connect.relay.badge"):Ds(ee),je=(ee,be)=>n.jsx("button",{type:"button","aria-label":i("mobile.instances.actionsAria",{label:ee.label}),className:me("flex size-9 shrink-0 items-center justify-center rounded-full text-muted-foreground touch-manipulation focus:outline-none active:bg-interactive-hover",be),onClick:()=>z(ee.id),children:n.jsx(G,{name:"more",className:"size-4"})}),De=e==="welcome"&&s.notice?n.jsxs("div",{role:"status",className:"flex items-center gap-2.5 rounded-lg bg-[var(--status-warning-background)] px-3 py-2.5",children:[n.jsx(G,{name:s.notice.kind==="auth-expired"?"lock":"cloud-off",className:"size-4 shrink-0 text-[var(--status-warning)]"}),n.jsx("p",{className:"min-w-0 flex-1 typography-meta text-foreground",children:s.notice.kind==="auth-expired"?i("mobile.connect.notice.authExpired",{label:s.notice.label}):s.notice.kind==="relay-limit"?i("mobile.connect.notice.relayLimit",{label:s.notice.label}):i("mobile.connect.notice.unreachable",{label:s.notice.label})})]}):null,We=d&&!b?n.jsx("p",{className:"px-1 text-center typography-meta text-[var(--status-error-text)]",children:d}):null,ct=ee=>n.jsx("span",{...re,className:"inline-flex select-none",style:{touchAction:"manipulation"},children:n.jsx(Zs,{width:ee,height:ee})}),Ue=n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[n.jsxs("div",{className:"flex flex-col gap-3 px-2 pt-[10vh]",children:[ct(44),n.jsx("h1",{className:"text-balance text-3xl font-normal tracking-tight text-foreground",children:i("mobile.connect.firstRun.title")}),n.jsx("p",{className:"typography-ui-label text-muted-foreground",children:i("mobile.connect.firstRun.description")})]}),n.jsxs("div",{className:"mt-auto flex flex-col gap-3 pt-6",children:[De,We,n.jsxs("div",{className:me("grid gap-2",V&&"grid-cols-2"),children:[V?n.jsxs("button",{type:"button",disabled:Q||c,className:"oc-tile flex flex-col gap-6 rounded-xl p-3.5 text-start touch-manipulation focus:outline-none active:bg-interactive-hover disabled:opacity-60",onClick:()=>{Pe()},children:[n.jsx(G,{name:"scan-2",className:me("size-5 text-muted-foreground",X)}),n.jsxs("span",{className:"flex flex-col",children:[n.jsx("span",{className:"typography-ui-label font-medium text-foreground",children:i(c?"mobile.connect.connecting":"mobile.connect.scanQr")}),n.jsx("span",{className:"typography-micro text-muted-foreground",children:i("mobile.connect.firstRun.scanHint")})]})]}):null,n.jsxs("button",{type:"button",className:"oc-tile flex flex-col gap-6 rounded-xl p-3.5 text-start touch-manipulation focus:outline-none active:bg-interactive-hover",onClick:ue,children:[n.jsx(G,{name:"link",className:"size-5 text-muted-foreground"}),n.jsxs("span",{className:"flex flex-col",children:[n.jsx("span",{className:"typography-ui-label font-medium text-foreground",children:i("mobile.connect.manual.toggle")}),n.jsx("span",{className:"typography-micro text-muted-foreground",children:i("mobile.connect.firstRun.addressHint")})]})]})]})]})]}),Me=ce?n.jsxs("section",{...e==="instances"?re:null,"aria-label":ce.label,className:"oc-tile relative flex flex-col rounded-xl p-4",children:[je(ce,"absolute top-1.5 inset-e-1.5"),le?null:n.jsx("span",{className:"pb-1 typography-micro text-muted-foreground",children:i("mobile.connect.lastConnected")}),n.jsx("h2",{dir:"auto",className:"oc-ui-start-align truncate pe-8 typography-ui-header font-semibold text-foreground",children:ce.label}),n.jsx("p",{dir:"ltr",className:"oc-ui-start-align truncate pe-8 typography-meta text-muted-foreground",children:Ne(ce)}),n.jsx("div",{className:"flex h-9 items-center pt-3",children:le?n.jsxs("span",{className:"flex items-center gap-2 typography-meta text-foreground",children:[n.jsx("span",{className:"size-1.5 rounded-full bg-[var(--status-success)]","aria-hidden":!0}),on()?i("mobile.instances.status.connectedRelay"):i("mobile.instances.status.connectedDirect")]}):n.jsxs($e,{type:"button",disabled:c,onClick:()=>Be(ce),children:[F===ce.id?n.jsx(G,{name:"loader-4",className:"size-4 animate-spin"}):null,F===ce.id?i("mobile.connect.connecting"):i("mobile.connect.connectButton")]})})]}):null,He=Ie.length>0?n.jsx(Ql,{title:i("mobile.connect.saved.other"),children:Ie.map(ee=>{const be=F===ee.id;return n.jsx(xi,{disabled:c,meta:be?n.jsx(G,{name:"loader-4",className:"size-4 animate-spin"}):void 0,action:je(ee),onClick:()=>Be(ee),children:n.jsxs("span",{className:"block py-1.5",children:[n.jsx("span",{dir:"auto",className:"oc-ui-start-align block truncate",children:ee.label}),n.jsx("span",{className:"block truncate typography-micro font-normal text-muted-foreground",children:be?i("mobile.connect.connecting"):Ne(ee)})]})},ee.id)})}):null,Oe=n.jsxs("div",{className:"flex shrink-0 flex-col items-center gap-1 pt-3",children:[We,V?n.jsxs(n.Fragment,{children:[n.jsxs($e,{type:"button",variant:"outline",disabled:Q||c,onClick:()=>{Pe()},children:[n.jsx(G,{name:"scan-2",className:me("size-4",X)}),i("mobile.connect.scanQr")]}),n.jsx("button",{type:"button",className:"min-h-9 px-2 typography-meta text-muted-foreground touch-manipulation focus:outline-none active:text-foreground",onClick:ue,children:i(e==="welcome"?"mobile.connect.manual.toggle":"mobile.instances.addManual")})]}):n.jsxs($e,{type:"button",variant:"outline",onClick:ue,children:[n.jsx(G,{name:"link",className:"size-4"}),i(e==="welcome"?"mobile.connect.manual.toggle":"mobile.instances.addManual")]})]}),nt=(u?n.jsxs("form",{className:"flex w-full flex-col gap-3",onSubmit:ee=>{ee.preventDefault(),f(I)},children:[n.jsxs("div",{className:"oc-tile rounded-xl p-4",children:[n.jsx("p",{dir:"auto",className:"oc-ui-start-align truncate typography-ui-header font-semibold text-foreground",children:u.label}),n.jsx("p",{className:"truncate typography-meta text-muted-foreground",children:Kn(u)?i("mobile.connect.relay.badge"):Ds(u)})]}),n.jsx("input",{...En,value:I,onChange:ee=>B(ee.target.value),placeholder:i("mobile.connect.password.placeholder"),"aria-label":i("mobile.connect.password.label"),type:"password",autoFocus:!0,className:sn}),d?n.jsx("p",{className:"px-1 typography-meta text-[var(--status-error-text)]",children:d}):null,n.jsxs("div",{className:"flex items-center justify-end gap-2",children:[n.jsx($e,{type:"button",variant:"ghost",onClick:()=>{B(""),x()},children:i("mobile.connect.cancelPassword")}),n.jsx($e,{type:"submit",disabled:o||!I.trim(),children:i(o?"mobile.connect.connecting":"mobile.connect.unlockButton")})]})]}):null)??(ce?n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-3",children:[De,Me,n.jsx("div",{className:"mt-auto",children:He})]}):Ue),st=n.jsxs(n.Fragment,{children:[Q?n.jsx(Qh,{onCancel:()=>H.current?.abort()}):null,q?n.jsx(Zh,{}):null,se?n.jsx(fh,{onClose:()=>te(!1)}):null,n.jsx(qn,{open:M!==null,title:M?.label??"",onClose:xe,children:M?n.jsxs(n.Fragment,{children:[n.jsx(xi,{icon:"edit",disabled:T,onClick:()=>Y(M),children:i("mobile.instances.edit")}),n.jsx(xi,{icon:"delete-bin",destructive:!0,disabled:T,onClick:()=>{O?Re(M.id):D(!0)},children:O?i("mobile.instances.confirmDeleteAria",{label:M.label}):i("mobile.instances.delete")})]}):null}),n.jsx(qn,{open:b!==null&&!u,title:b?.kind==="edit"?i("mobile.instances.editTitle"):i(e==="welcome"?"mobile.connect.manual.toggle":"mobile.instances.addTitle"),onClose:ne,children:n.jsxs("form",{className:"flex flex-col gap-3 px-1 pb-1",onSubmit:ae,children:[W?null:n.jsxs("label",{className:"flex flex-col gap-1.5",children:[n.jsx("span",{className:"px-1 typography-meta text-muted-foreground",children:i("mobile.connect.url.label")}),n.jsx("input",{...En,value:w,onChange:ee=>ie(ee.target.value),placeholder:i("mobile.connect.url.placeholder"),type:"url",inputMode:"url",autoCapitalize:"none",className:sn})]}),n.jsxs("label",{className:"flex flex-col gap-1.5",children:[n.jsx("span",{className:"px-1 typography-meta text-muted-foreground",children:i("mobile.instances.label.label")}),n.jsx("input",{value:E,onChange:ee=>_(ee.target.value),placeholder:i("mobile.instances.label.placeholder"),autoComplete:"off",autoCapitalize:"words",autoCorrect:"off",spellCheck:!1,className:sn})]}),W?null:n.jsxs("label",{className:"flex flex-col gap-1.5",children:[n.jsx("span",{className:"px-1 typography-meta text-muted-foreground",children:i("mobile.connect.token.label")}),n.jsx("input",{...En,value:A,onChange:ee=>S(ee.target.value),placeholder:i("mobile.connect.token.placeholder"),autoCapitalize:"none",className:sn}),n.jsx("span",{className:"px-1 typography-micro text-muted-foreground",children:i("mobile.connect.token.hint")})]}),W?null:n.jsx(hh,{value:C,onChange:j,disabled:T||c}),d?n.jsx("p",{className:"px-1 typography-meta text-[var(--status-error-text)]",children:d}):null,n.jsx("div",{className:"flex justify-end",children:e==="welcome"&&b?.kind==="add"?n.jsx($e,{type:"submit",disabled:c||Q||!w.trim(),children:i(c?"mobile.connect.connecting":"mobile.connect.connectButton")}):n.jsx($e,{type:"submit",disabled:T,children:i(L?"mobile.instances.saveEdit":"mobile.instances.saveNew")})})]})})]});return e==="instances"?n.jsxs(n.Fragment,{children:[st,n.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[n.jsx(bs,{outerClassName:"min-h-0 flex-1",className:"flex min-h-full flex-col px-3 py-3",disableHorizontal:!0,children:nt}),u||!ce?null:n.jsx("div",{className:"px-3 pb-3",children:Oe})]})]}):n.jsxs(n.Fragment,{children:[st,n.jsx("main",{className:"oc-keyboard-fill-screen flex min-h-dvh flex-col overflow-y-auto bg-background pb-[calc(var(--safe-area-inset-bottom,env(safe-area-inset-bottom,0px))+16px)] pt-[calc(var(--safe-area-inset-top,env(safe-area-inset-top,0px))+16px)] text-foreground",style:{paddingLeft:"calc(var(--oc-safe-area-left, 0px) + 1rem)",paddingRight:"calc(var(--oc-safe-area-right, 0px) + 1rem)"},children:n.jsxs("div",{className:"mx-auto flex w-full max-w-[380px] flex-1 flex-col",children:[ce||u?n.jsxs("header",{className:"flex items-center gap-2 px-1 pb-4 pt-2",children:[ct(24),n.jsx("span",{className:"typography-ui-label font-semibold",children:"OpenChamber"})]}):null,nt,u||!ce?null:Oe]})})]})},s1=s=>{const e=oe.c(3),{onConnected:t,notice:i}=s,a=i===void 0?null:i;let r;return e[0]!==a||e[1]!==t?(r=n.jsx(Ya,{mode:"welcome",onConnected:t,notice:a}),e[0]=a,e[1]=t,e[2]=r):r=e[2],r},n1=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"},i1=s=>{const e=oe.c(14),{groups:t,displayMode:i,timeFormatPreference:a,className:r}=s,{t:c}=ye();let o;e[0]!==r?(o=me("space-y-1.5",r),e[0]=r,e[1]=o):o=e[1];let d;if(e[2]!==i||e[3]!==t||e[4]!==c||e[5]!==a){let l;e[7]!==i||e[8]!==c||e[9]!==a?(l=f=>n.jsxs("div",{className:"min-w-0 rounded-xl bg-foreground/[0.03] p-2.5",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[n.jsx(Zl,{providerId:f.providerId,className:"size-4 shrink-0"}),n.jsx("span",{className:"min-w-0 flex-1 truncate typography-ui-label font-medium text-foreground",children:f.providerName}),f.planLabel?n.jsx("span",{className:"shrink-0 typography-micro capitalize text-muted-foreground",children:f.planLabel}):null,f.accountLabel?n.jsx("span",{className:"min-w-0 truncate typography-micro text-muted-foreground",title:f.accountLabel,children:f.accountLabel}):null,f.status&&f.rows.length===0?n.jsx("span",{className:"shrink-0 truncate typography-micro text-muted-foreground",children:f.status}):null]}),f.rows.length>0?n.jsx("div",{className:"mt-1.5 space-y-1",children:f.rows.map(x=>{const h=i==="remaining"?x.window.remainingPercent:x.window.usedPercent,m=ec(x.window,h,c),g=tc(x.window.resetAt,x.window.resetAfterFormatted??x.window.resetAtFormatted,a);return n.jsxs("div",{className:"flex min-w-0 items-baseline justify-between gap-3",children:[n.jsxs("span",{className:"flex min-w-0 flex-1 items-baseline gap-1.5",children:[n.jsx("span",{className:"shrink-0 truncate typography-ui-label text-muted-foreground",children:x.subtitle?`${x.subtitle} · ${x.label}`:x.label}),g?n.jsx("span",{className:"min-w-0 truncate typography-micro text-muted-foreground",children:g}):null]}),n.jsx("span",{className:me("shrink-0 typography-ui-label font-semibold tabular-nums",n1(x.window)),children:m==="-"?"":m})]},x.key)})}):null,f.status&&f.rows.length>0?n.jsx("div",{className:"mt-1.5 typography-micro text-muted-foreground",children:f.status}):null]},f.providerId),e[7]=i,e[8]=c,e[9]=a,e[10]=l):l=e[10],d=t.map(l),e[2]=i,e[3]=t,e[4]=c,e[5]=a,e[6]=d}else d=e[6];let u;return e[11]!==o||e[12]!==d?(u=n.jsx("div",{className:o,children:d}),e[11]=o,e[12]=d,e[13]=u):u=e[13],u},fo=380,r1=(s,e)=>{if(!s||typeof s!="object")return;const t=s[e];return typeof t=="number"&&Number.isFinite(t)?t:void 0},Si=s=>s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:String(s),o1="—",Qa=s=>{const e=oe.c(20),{percentage:t}=s;let i,a,r,c,o,d,u;if(e[0]!==t){r=ac(t??0)??0;const h=lc(t??0);a=h==="critical"?"var(--status-error)":h==="warn"?"var(--status-warning)":"var(--status-success)",i=2*Math.PI*7.5,c="0 0 18 18",o="size-[18px] -rotate-90",d="progressbar",u=t===null?void 0:Math.round(r),e[0]=t,e[1]=i,e[2]=a,e[3]=r,e[4]=c,e[5]=o,e[6]=d,e[7]=u}else i=e[1],a=e[2],r=e[3],c=e[4],o=e[5],d=e[6],u=e[7];let l;e[8]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx("circle",{cx:9,cy:9,r:7.5,fill:"none",stroke:"var(--interactive-border)",strokeWidth:3}),e[8]=l):l=e[8];let f;e[9]!==i||e[10]!==t||e[11]!==a||e[12]!==r?(f=t===null?null:n.jsx("circle",{cx:9,cy:9,r:7.5,fill:"none",stroke:a,strokeWidth:3,strokeLinecap:"round",strokeDasharray:i,strokeDashoffset:i*(1-r/100),className:"transition-[stroke-dashoffset,stroke] duration-300"}),e[9]=i,e[10]=t,e[11]=a,e[12]=r,e[13]=f):f=e[13];let x;return e[14]!==c||e[15]!==o||e[16]!==d||e[17]!==u||e[18]!==f?(x=n.jsxs("svg",{viewBox:c,className:o,role:d,"aria-valuenow":u,"aria-valuemin":0,"aria-valuemax":100,children:[l,f]}),e[14]=c,e[15]=o,e[16]=d,e[17]=u,e[18]=f,e[19]=x):x=e[19],x},a1=s=>{const e=oe.c(13),{icon:t,iconNode:i,label:a,children:r}=s;let c;e[0]!==t||e[1]!==i?(c=i??(t?n.jsx(G,{name:t,className:"size-[18px]"}):null),e[0]=t,e[1]=i,e[2]=c):c=e[2];let o;e[3]!==c?(o=n.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center text-muted-foreground",children:c}),e[3]=c,e[4]=o):o=e[4];let d;e[5]!==a?(d=n.jsx("span",{className:"shrink-0 typography-ui-label text-muted-foreground",children:a}),e[5]=a,e[6]=d):d=e[6];let u;e[7]!==r?(u=n.jsx("span",{className:"min-w-0 flex-1 truncate text-end typography-ui-label font-medium text-foreground",children:r}),e[7]=r,e[8]=u):u=e[8];let l;return e[9]!==o||e[10]!==d||e[11]!==u?(l=n.jsxs("div",{className:"flex min-w-0 items-center gap-3 rounded-xl px-2.5 py-2.5",children:[o,d,u]}),e[9]=o,e[10]=d,e[11]=u,e[12]=l):l=e[12],l},l1=s=>{const e=oe.c(57),{open:t,onClose:i,anchorRef:a,contextDisplay:r,usageGroups:c,usageDisplayMode:o,isUsageLoading:d,timeFormatPreference:u}=s,{t:l}=ye(),f=p.useRef(null),[x,h]=p.useState(t),[m,g]=p.useState(!1),{enabled:b}=Ji(),v=p.useRef(null),[w,k]=p.useState(null);let E,_;e[0]!==a||e[1]!==b||e[2]!==t||e[3]!==x?(E=()=>{if(!t||!b||!x)return;const Z=()=>{const se=a.current?.getBoundingClientRect(),te=v.current?.getBoundingClientRect();if(!se||!te){k(null);return}const re=se.left-te.left,ne=Math.min(Math.max(re,8),Math.max(8,te.width-fo-8));k(ne)};Z();const H=v.current;if(typeof ResizeObserver>"u"||!H)return;const V=new ResizeObserver(Z);return V.observe(H),()=>V.disconnect()},_=[a,b,t,x],e[0]=a,e[1]=b,e[2]=t,e[3]=x,e[4]=E,e[5]=_):(E=e[4],_=e[5]),p.useLayoutEffect(E,_);const A=b&&w!==null;let S,C;e[6]!==t||e[7]!==x?(S=()=>{if(t){h(!0),g(!1);return}if(!x)return;g(!0);const Z=window.setTimeout(()=>{h(!1),g(!1)},140);return()=>window.clearTimeout(Z)},C=[t,x],e[6]=t,e[7]=x,e[8]=S,e[9]=C):(S=e[8],C=e[9]),p.useEffect(S,C);let j,T;e[10]!==i||e[11]!==t?(j=()=>{if(!t)return;const Z=H=>{H.key==="Escape"&&i()};return document.addEventListener("keydown",Z),()=>document.removeEventListener("keydown",Z)},T=[i,t],e[10]=i,e[11]=t,e[12]=j,e[13]=T):(j=e[12],T=e[13]),p.useEffect(j,T);let R,K;if(e[14]!==a||e[15]!==i||e[16]!==t?(R=()=>{if(!t)return;const Z=H=>{const V=H.target;if(!(V instanceof Node)){i();return}f.current?.contains(V)||a.current?.contains(V)||i()};return document.addEventListener("pointerdown",Z,!0),document.addEventListener("wheel",Z,!0),()=>{document.removeEventListener("pointerdown",Z,!0),document.removeEventListener("wheel",Z,!0)}},K=[a,i,t],e[14]=a,e[15]=i,e[16]=t,e[17]=R,e[18]=K):(R=e[17],K=e[18]),p.useEffect(R,K),!x)return null;let P;e[19]!==l?(P=l("mobile.header.openMetadataAria"),e[19]=l,e[20]=P):P=e[20];const z=A?"absolute origin-top-left":"mx-3 mt-2",O=m?"pointer-events-none":"pointer-events-auto";let D;e[21]!==z||e[22]!==O?(D=me("oc-surface-elevated overflow-y-auto overscroll-contain rounded-[20px] border border-edge bg-surface-elevated p-2 shadow-[0_4px_12px_rgb(0_0_0_/_0.08)] will-change-transform",z,O),e[21]=z,e[22]=O,e[23]=D):D=e[23];const M=`${m?"session-metadata-out":"session-metadata-in"} ${m?140:170}ms cubic-bezier(0.32, 0.72, 0, 1) forwards`;let L;e[24]!==w||e[25]!==A?(L=A?{top:8,left:w??8,width:`min(${fo}px, calc(100% - 16px))`}:null,e[24]=w,e[25]=A,e[26]=L):L=e[26];let W;e[27]!==M||e[28]!==L?(W={animation:M,maxHeight:"min(72dvh, calc(100dvh - var(--oc-safe-area-top, 0px) - var(--oc-header-height, 56px) - 1rem))",...L},e[27]=M,e[28]=L,e[29]=W):W=e[29];let F;e[30]!==r||e[31]!==l?(F=r?n.jsx(a1,{iconNode:n.jsx(Qa,{percentage:r.state==="measured"?r.percentage:null}),label:l("mobile.header.metadata.context"),children:r.state==="pending"?null:n.jsxs("span",{className:"inline-flex items-baseline gap-1.5 tabular-nums",children:[r.state==="measured"?n.jsxs("span",{className:me("font-semibold",r.colorClass),children:[r.percentage.toFixed(1),"%"]}):null,n.jsx("span",{className:"text-muted-foreground",children:r.tokens})]})}):null,e[30]=r,e[31]=l,e[32]=F):F=e[32];let N;e[33]!==r?.state||e[34]!==l?(N=r?.state==="compacted"?n.jsx("p",{className:"px-2.5 pb-1 typography-meta text-muted-foreground",children:l("contextUsage.compacted.description")}):null,e[33]=r?.state,e[34]=l,e[35]=N):N=e[35];let I;e[36]!==r?.state||e[37]!==l?(I=r?.state==="pending"?n.jsx("p",{className:"px-2.5 pb-1 typography-meta text-muted-foreground",children:l("mobile.header.metadata.contextPending")}):null,e[36]=r?.state,e[37]=l,e[38]=I):I=e[38];let B;e[39]!==d||e[40]!==u||e[41]!==o||e[42]!==c?(B=n.jsx(c1,{groups:c,displayMode:o,isLoading:d,timeFormatPreference:u}),e[39]=d,e[40]=u,e[41]=o,e[42]=c,e[43]=B):B=e[43];let Q;e[44]!==F||e[45]!==N||e[46]!==I||e[47]!==B?(Q=n.jsxs("div",{className:"space-y-1",children:[F,N,I,B]}),e[44]=F,e[45]=N,e[46]=I,e[47]=B,e[48]=Q):Q=e[48];let J;e[49]!==D||e[50]!==W||e[51]!==Q||e[52]!==P?(J=n.jsx("div",{ref:f,role:"dialog","aria-label":P,className:D,style:W,children:Q}),e[49]=D,e[50]=W,e[51]=Q,e[52]=P,e[53]=J):J=e[53];let X;e[54]===Symbol.for("react.memo_cache_sentinel")?(X=n.jsx("style",{children:`
|
|
5
5
|
@keyframes session-metadata-in {
|
|
@@ -22,4 +22,4 @@ import{f as oe,r as Pi,j as n,R as p,a as Tn,h as kl}from"./vendor-react--VO_rL_
|
|
|
22
22
|
`}),e[48]=J):J=e[48];let X;return e[49]!==Q?(X=n.jsxs("div",{ref:x,className:"oc-side-safe-area fixed inset-x-0 bottom-0 top-[calc(var(--oc-safe-area-top,0px)+var(--oc-header-height,56px))] z-20 pointer-events-none",children:[Q,J]}),e[49]=Q,e[50]=X):X=e[50],X};function h1(s){return s.currentSessionId}function g1(s){return s.setCurrentSession}function b1(s){return s.setActiveProjectIdOnly}const x1=s=>{const e=oe.c(81),{onOpenSessions:t,onOpenWorkspace:i,compactTitle:a}=s,r=a===void 0?!1:a,{t:c}=ye(),[o,d]=p.useState(!1),[u,l]=p.useState(!1),f=p.useRef(null),x=an(y1),h=yt(v1);let m;e[0]!==h?(m=je=>h?je.getDirectoryForSession(h):null,e[0]=h,e[1]=m):m=e[1];const b=yt(m)||x,v=fc(h,b||void 0),w=yt(w1),k=sa(b||null);let E;e[2]!==b||e[3]!==k?(E=je=>{if(!b||k!==!0)return!1;const De=je.directories.get(b)?.status;return!!(De&&!De.isClean)},e[2]=b,e[3]=k,e[4]=E):E=e[4];const _=ts(E),A=Ge(j1),S=Xu(A);let C;e[5]!==v?.title?(C=v?.title?.trim(),e[5]=v?.title,e[6]=C):C=e[6];const j=C;let T;e[7]!==h||e[8]!==A||e[9]!==S||e[10]!==j||e[11]!==c?(T=(A?S:null)||j||c(h?"mobile.sessions.untitled":"sessions.switcher.draftTitle"),e[7]=h,e[8]=A,e[9]=S,e[10]=j,e[11]=c,e[12]=T):T=e[12];const R=T;let K;e[13]===Symbol.for("react.memo_cache_sentinel")?(K=()=>{d(!1),l(!1)},e[13]=K):K=e[13];let P;e[14]!==h||e[15]!==b?(P=[h,b],e[14]=h,e[15]=b,e[16]=P):P=e[16],p.useEffect(K,P);let z;e[17]!==t?(z=()=>{d(!1),l(!1),t()},e[17]=t,e[18]=z):z=e[18];const O=z;let D;e[19]===Symbol.for("react.memo_cache_sentinel")?(D=je=>{d(De=>{const We=typeof je=="function"?je(De):je;return We&&l(!1),We})},e[19]=D):D=e[19];const M=D;let L;e[20]===Symbol.for("react.memo_cache_sentinel")?(L=()=>{l(je=>{const De=!je;return De&&d(!1),De})},e[20]=L):L=e[20];const W=L;let F;e[21]===Symbol.for("react.memo_cache_sentinel")?(F={paddingTop:"var(--oc-safe-area-top, 0px)"},e[21]=F):F=e[21];let N;e[22]!==c?(N=c("mobile.sessions.openSheetAria"),e[22]=c,e[23]=N):N=e[23];let I,B;e[24]===Symbol.for("react.memo_cache_sentinel")?(I={touchAction:"manipulation"},B=n.jsx(G,{name:"list-unordered",className:"size-5"}),e[24]=I,e[25]=B):(I=e[24],B=e[25]);let Q;e[26]!==O||e[27]!==N?(Q=n.jsx("button",{type:"button",className:Qt,"aria-label":N,onClick:O,style:I,children:B}),e[26]=O,e[27]=N,e[28]=Q):Q=e[28];const J=r?"shrink":"flex-1";let X;e[29]!==J?(X=me("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",J),e[29]=J,e[30]=X):X=e[30];let q;e[31]!==c?(q=c("sessions.switcher.openAria"),e[31]=c,e[32]=q):q=e[32];let Z;e[33]===Symbol.for("react.memo_cache_sentinel")?(Z={touchAction:"manipulation"},e[33]=Z):Z=e[33];let H;e[34]!==R?(H=n.jsx("span",{dir:"auto",className:"block min-w-0 truncate oc-ui-start-align typography-ui-label font-medium text-foreground",children:R}),e[34]=R,e[35]=H):H=e[35];const V=u&&"rotate-180";let se;e[36]!==V?(se=me("size-4 shrink-0 text-muted-foreground transition-transform duration-150",V),e[36]=V,e[37]=se):se=e[37];let te;e[38]!==se?(te=n.jsx(G,{name:"arrow-down-s",className:se}),e[38]=se,e[39]=te):te=e[39];let re;e[40]!==H||e[41]!==te?(re=n.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[H,te]}),e[40]=H,e[41]=te,e[42]=re):re=e[42];let ne;e[43]!==u||e[44]!==X||e[45]!==q||e[46]!==re?(ne=n.jsx("button",{ref:f,type:"button",className:X,"aria-label":q,"aria-haspopup":"dialog","aria-expanded":u,onClick:W,style:Z,children:re}),e[43]=u,e[44]=X,e[45]=q,e[46]=re,e[47]=ne):ne=e[47];let ue;e[48]!==r?(ue=r?n.jsx("div",{className:"min-w-0 flex-1"}):null,e[48]=r,e[49]=ue):ue=e[49];let Y;e[50]!==h||e[51]!==b||e[52]!==w||e[53]!==o||e[54]!==A?(Y=A?null:n.jsx(d1,{open:o,onOpenChange:M,currentSessionId:h,effectiveDirectory:b,isNewSessionDraftOpen:w}),e[50]=h,e[51]=b,e[52]=w,e[53]=o,e[54]=A,e[55]=Y):Y=e[55];let ie;e[56]!==_||e[57]!==c?(ie=c(_?"mobile.header.openWorkspaceWithChangesAria":"mobile.header.openWorkspaceAria"),e[56]=_,e[57]=c,e[58]=ie):ie=e[58];let ae;e[59]!==i?(ae=()=>{d(!1),l(!1),i()},e[59]=i,e[60]=ae):ae=e[60];let Pe,Be;e[61]===Symbol.for("react.memo_cache_sentinel")?(Pe={touchAction:"manipulation"},Be=n.jsx(G,{name:"pencil-ruler-2",className:"size-5"}),e[61]=Pe,e[62]=Be):(Pe=e[61],Be=e[62]);let xe;e[63]!==_?(xe=_?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]=xe):xe=e[64];let Re;e[65]!==ie||e[66]!==ae||e[67]!==xe?(Re=n.jsxs("button",{type:"button",className:Qt,"aria-label":ie,onClick:ae,style:Pe,children:[Be,xe]}),e[65]=ie,e[66]=ae,e[67]=xe,e[68]=Re):Re=e[68];let le;e[69]!==Q||e[70]!==ne||e[71]!==ue||e[72]!==Y||e[73]!==Re?(le=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:F,children:n.jsxs("div",{className:"flex h-[var(--oc-header-height,56px)] w-full items-center gap-1 px-2",children:[Q,ne,ue,Y,Re]})}),e[69]=Q,e[70]=ne,e[71]=ue,e[72]=Y,e[73]=Re,e[74]=le):le=e[74];let ce;e[75]===Symbol.for("react.memo_cache_sentinel")?(ce=()=>l(!1),e[75]=ce):ce=e[75];let Ie;e[76]!==u?(Ie=n.jsx(p1,{open:u,onClose:ce,anchorRef:f}),e[76]=u,e[77]=Ie):Ie=e[77];let Ne;return e[78]!==le||e[79]!==Ie?(Ne=n.jsxs(n.Fragment,{children:[le,Ie]}),e[78]=le,e[79]=Ie,e[80]=Ne):Ne=e[80],Ne};function y1(s){return s.currentDirectory}function v1(s){return s.currentSessionId}function w1(s){return!!s.newSessionDraft?.open}function j1(s){return s.runOverviewKey}const k1=s=>{const e=oe.c(3),{onActiveConnectionDeleted:t,onConnect:i}=s;let a;return e[0]!==t||e[1]!==i?(a=n.jsx(Ya,{mode:"instances",onConnected:i,onActiveConnectionDeleted:t}),e[0]=t,e[1]=i,e[2]=a):a=e[2],a},Rn=s=>Xs(s)??"",S1=s=>{const e=s;return Rn(e.directory??e.project?.worktree??null)},Za=({open:s,project:e,worktree:t,onClose:i,onDeleted:a})=>{const{t:r}=ye(),c=na(),{childStores:o}=mc(),d=gn(F=>F.activeSessions),u=yt(F=>F.archiveSessions),l=yt(F=>F.unarchiveSessions),{git:f,sourceControl:x}=Yi(),[h,m]=p.useState(!1),[g,b]=p.useState(!1),[v,w]=p.useState(!1),[k,E]=p.useState(!1),[_,A]=p.useState(null),[S,C]=p.useState(!1),j=Rn(t?.path),[T,R]=p.useState(!1),K=t?.branch??"";p.useEffect(()=>{if(R(!1),!s||!j)return;let F=!1;return pc(e.path,{path:j,branch:K}).then(N=>{F||R(N)}),()=>{F=!0}},[s,e.path,K,j]);const P=p.useMemo(()=>{if(!j)return[];const F=new Map;for(const N of[...d,...c]){const I=S1(N);I&&hc(j,I)&&F.set(N.id,N)}return Array.from(F.values())},[d,c,j]),z=p.useCallback(F=>gc(o,F),[o]);p.useEffect(()=>{if(!s){m(!1),b(!1),w(!1),E(!1),A(null),C(!1);return}if(!t?.path)return;let F=!1;return bc(t.path).then(N=>{F||(E(!!N?.isDirty),A(N?.upstream?.split("/")[0]?.trim()||null))}).catch(()=>{F||E(!!t.status?.isDirty)}),()=>{F=!0}},[s,t?.path,t?.status?.isDirty]);const O=p.useCallback(async(F,N)=>(await xc(e,F,{deleteRemoteBranch:T&&g,deleteLocalBranch:T&&h,remoteName:_??void 0,network:{git:f,sourceControl:x},skipTeardown:N}),Rn(an.getState().currentDirectory)===j&&Rn(e.path)&&an.getState().setDirectory(Rn(e.path),{showOverlay:!1}),!0),[h,g,f,T,e,_,x,j]),D=p.useCallback((F,N,I)=>{const B=yc(F),Q=async(J,X)=>{const q=pe.loading(r("sessions.sidebar.sessionDialogs.worktree.removingTitle",{name:B}));vc(F.path);try{if(I){if(!(await wc({worktreePath:F.path,projectDirectory:e.path,readSessions:()=>z(F.path),removeWorktree:()=>O(F,J)})).removed){pe.dismiss(q);return}pe.success(r(T&&g?"sessions.sidebar.sessionDialogs.worktree.removedWithRemote":"sessions.sidebar.sessionDialogs.worktree.removed"),{id:q,description:B}),a?.();return}const Z=await jc({sessionIds:X,removeWorktree:()=>O(F,J),archiveSessions:u,restoreSessions:V=>l(V,{undo:!0})});if(!Z.removed){pe.dismiss(q);return}const{failedIds:H}=Z.archive;if(H.length>0){pe.error(H.length===1?r("sessions.sidebar.bulkActions.failedArchiveSingle",{count:H.length}):r("sessions.sidebar.bulkActions.failedArchivePlural",{count:H.length}),{id:q,description:r("sessions.sidebar.dialogs.deleteResult.tryAgain")});return}pe.success(r(T&&g?"sessions.sidebar.sessionDialogs.worktree.removedWithRemote":"sessions.sidebar.sessionDialogs.worktree.removed"),{id:q,description:B}),a?.()}catch(Z){const H=(Z instanceof Error?kc(Z,r):null)??(Z instanceof Vn?Z.message||r("sessions.sidebar.dialogs.deleteResult.tryAgain"):Z instanceof Ai||Z instanceof Ts&&!Z.message.includes(" ")?r("gitView.publish.remoteNotGranted"):Z instanceof Error?Z.message:r("sessions.sidebar.dialogs.deleteResult.tryAgain"));pe.error(r("sessions.sidebar.sessionDialogs.worktree.errorRemoveTitle"),{id:q,description:H,...Z instanceof Error?Sc(Z,r("sessions.sidebar.sessionDialogs.worktree.deleteWithoutTeardown"),()=>{Q(!0,Rc(X,F.path))}):void 0})}finally{Cc(F.path)}};Q(!1,N)},[u,g,T,a,e.path,z,O,r,l]),M=()=>{!t||S||(D(t,P.map(F=>F.id),v&&P.length>0),i())};if(!t)return null;const L=t.branch||t.label||t.path,W=(F,N,I,B)=>n.jsxs("label",{className:me("oc-tile flex min-h-11 items-center justify-between gap-3 rounded-lg px-3",B&&"opacity-50"),children:[n.jsx("span",{className:"typography-meta font-medium text-foreground",children:I}),n.jsx(Nc,{checked:F,onCheckedChange:N,disabled:B})]});return n.jsx(qn,{open:s,onClose:i,title:r("mobile.projectEdit.deleteWorktreeTitle"),footer:n.jsxs("div",{className:"flex gap-2",children:[n.jsx($e,{variant:"ghost",className:"flex-1",onClick:i,disabled:S,children:r("projectEditDialog.actions.cancel")}),n.jsx($e,{variant:"destructive",className:"flex-1",onClick:()=>{M()},disabled:S,children:r("mobile.projectEdit.deleteWorktreeConfirmButton")})]}),children:n.jsxs("div",{className:"flex flex-col gap-4 px-1 py-1",children:[n.jsx("p",{className:"typography-ui-body text-foreground",children:r("mobile.projectEdit.deleteWorktreeConfirm",{name:L})}),k?n.jsx("p",{className:"rounded-lg bg-[var(--status-warning-background)] px-3 py-2.5 typography-meta text-foreground",children:r("mobile.projectEdit.deleteWorktreeDirty")}):null,P.length>0?n.jsx("p",{className:"typography-meta text-muted-foreground",children:v?r("mobile.projectEdit.deleteWorktreeKeepNote",{count:P.length}):r("mobile.projectEdit.deleteWorktreeArchiveNote",{count:P.length})}):null,P.length>0||T?n.jsxs("div",{className:"flex flex-col gap-2",children:[P.length>0?W(v,w,r("sessions.sidebar.sessionDialogs.actions.keepSessions"),S):null,T?W(h,m,r("mobile.projectEdit.deleteLocalBranch"),S):null,T?W(g,b,r("mobile.projectEdit.deleteRemoteBranch"),S||!_):null]}):null]})})},C1=[],N1=s=>{const e=oe.c(8),{projectPath:t}=s,{t:i}=ye(),{journey:a}=Pl();let r;if(e[0]!==a||e[1]!==t||e[2]!==i){const c=a?_l(a,t):[];let o;e[4]!==i?(o=i("mobile.projectEdit.spacesTitle"),e[4]=i,e[5]=o):o=e[5];let d;e[6]!==o?(d=n.jsx("label",{className:"typography-ui-label font-medium text-foreground",children:o}),e[6]=o,e[7]=d):d=e[7],r=n.jsxs("div",{className:"flex flex-col gap-2",children:[d,a!==null&&c.length===0?n.jsx("p",{className:"typography-meta text-muted-foreground",children:i("spaces.page.empty")}):null,c.map(P1)]}),e[0]=a,e[1]=t,e[2]=i,e[3]=r}else r=e[3];return r},R1=s=>Xs(s)??"",I1=s=>{const e=oe.c(18),{worktree:t,onDelete:i}=s,{t:a}=ye(),r=t.branch||t.label||t.path,c=_c(t.path),o=c&&"opacity-60";let d;e[0]!==o?(d=me("flex items-center gap-2 rounded-2xl border border-edge bg-[var(--surface-elevated)] py-1.5 ps-3 pe-1.5 transition-colors",o),e[0]=o,e[1]=d):d=e[1];const u=c||void 0;let l;e[2]!==c||e[3]!==a?(l=c?n.jsx("span",{className:"inline-flex shrink-0 text-muted-foreground",role:"status","aria-label":a("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]=c,e[3]=a,e[4]=l):l=e[4];let f;e[5]!==r?(f=n.jsx("span",{className:"block min-w-0 flex-1 truncate typography-ui-label text-foreground",children:r}),e[5]=r,e[6]=f):f=e[6];let x;e[7]!==r||e[8]!==i||e[9]!==c||e[10]!==a?(x=c?null:n.jsx("button",{type:"button",className:"flex size-9 shrink-0 items-center justify-center rounded-xl text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-destructive","aria-label":a("mobile.projectEdit.deleteWorktreeAria",{label:r}),onClick:i,style:{touchAction:"manipulation"},children:n.jsx(Ra,{className:"size-4"})}),e[7]=r,e[8]=i,e[9]=c,e[10]=a,e[11]=x):x=e[11];let h;return e[12]!==d||e[13]!==u||e[14]!==l||e[15]!==f||e[16]!==x?(h=n.jsxs("div",{className:d,"aria-busy":u,children:[l,f,x]}),e[12]=d,e[13]=u,e[14]=l,e[15]=f,e[16]=x,e[17]=h):h=e[17],h},E1=s=>{const e=oe.c(75),{open:t,project:i,onClose:a}=s,{t:r}=ye(),{currentTheme:c}=ia(),o=Ge(_1),d=Yt(T1),u=Yt(A1),l=Yt(D1);let f;e[0]!==i?(f=ae=>i?ae.projects.find(Pe=>Pe.id===i.id)?.iconImage??null:null,e[0]=i,e[1]=f):f=e[1];const x=Yt(f),[h,m]=p.useState(""),[g,b]=p.useState(null),[v,w]=p.useState(null),[k,E]=p.useState(!1),[_,A]=p.useState(null),S=i?.id??null;let C;e[2]!==t||e[3]!==i?(C=()=>{!t||!i||(m(i.label),b(i.icon??null),w(i.color??null))},e[2]=t,e[3]=i,e[4]=C):C=e[4];let j;e[5]!==t||e[6]!==S?(j=[t,S],e[5]=t,e[6]=S,e[7]=j):j=e[7],p.useEffect(C,j);const T=i?.path;let R;e[8]!==T?(R=R1(T),e[8]=T,e[9]=R):R=e[9];const K=R,P=yt(ae=>K?ae.availableWorktreesByProject.get(K):void 0)??C1,z=ts(ae=>K?ae.directories.get(K)?.isGitRepo:void 0)??P.length>0;let O;e[10]!==v||e[11]!==g||e[12]!==h||e[13]!==a||e[14]!==i||e[15]!==d?(O=()=>{if(!i)return;const Pe={label:h.trim()||i.label,icon:g,color:v};v!==(i.color??null)&&(Pe.iconBackground=Tc(v)),d(i.id,Pe),a()},e[10]=v,e[11]=g,e[12]=h,e[13]=a,e[14]=i,e[15]=d,e[16]=O):O=e[16];const D=O;let M;e[17]!==u||e[18]!==k||e[19]!==i||e[20]!==r?(M=()=>{!i||k||(E(!0),u(i.id).then(ae=>{if(!ae.ok){pe.error(ae.error||r("projectEditDialog.toast.failedToDiscoverIcon"));return}if(ae.skipped){pe.success(r("projectEditDialog.toast.customIconAlreadySet"));return}pe.success(r("projectEditDialog.toast.iconDiscovered"))}).finally(()=>E(!1)))},e[17]=u,e[18]=k,e[19]=i,e[20]=r,e[21]=M):M=e[21];const L=M;let W;e[22]!==i||e[23]!==l||e[24]!==r?(W=()=>{i&&l(i.id).then(ae=>{if(!ae.ok){pe.error(ae.error||r("projectEditDialog.toast.failedToRemoveIcon"));return}pe.success(r("projectEditDialog.toast.iconRemoved"))})},e[22]=i,e[23]=l,e[24]=r,e[25]=W):W=e[25];const F=W;let N;e[26]!==v?(N=ra(v),e[26]=v,e[27]=N):N=e[27];const I=N,B=g?oa[g]:null,Q=!!x;let J;e[28]!==r?(J=r("projectEditDialog.title"),e[28]=r,e[29]=J):J=e[29];let X;e[30]!==r?(X=r("projectEditDialog.title"),e[30]=r,e[31]=X):X=e[31];let q;e[32]!==r?(q=r("projectEditDialog.actions.save"),e[32]=r,e[33]=q):q=e[33];let Z;e[34]!==h?(Z=h.trim(),e[34]=h,e[35]=Z):Z=e[35];const H=!Z;let V,se;e[36]===Symbol.for("react.memo_cache_sentinel")?(V={touchAction:"manipulation"},se=n.jsx(Km,{className:"size-4"}),e[36]=V,e[37]=se):(V=e[36],se=e[37]);let te;e[38]!==r?(te=r("projectEditDialog.actions.save"),e[38]=r,e[39]=te):te=e[39];let re;e[40]!==D||e[41]!==q||e[42]!==H||e[43]!==te?(re=n.jsxs($e,{type:"button",variant:"default",size:"sm","aria-label":q,onClick:D,disabled:H,style:V,children:[se,te]}),e[40]=D,e[41]=q,e[42]=H,e[43]=te,e[44]=re):re=e[44];let ne;e[45]!==v||e[46]!==I||e[47]!==x||e[48]!==c||e[49]!==L||e[50]!==F||e[51]!==Q||e[52]!==g||e[53]!==k||e[54]!==z||e[55]!==o||e[56]!==h||e[57]!==B||e[58]!==i||e[59]!==r||e[60]!==P?(ne=i?n.jsxs(bs,{outerClassName:"h-full",className:"space-y-6 px-4 pb-8 pt-2",disableHorizontal:!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:Q&&i.iconBackground?{backgroundColor:i.iconBackground}:void 0,children:Q?n.jsx(aa,{project:{id:i.id,iconImage:x},options:{themeVariant:c.metadata.variant,iconColor:c.colors.surface.foreground},className:"size-full object-contain",fallback:n.jsx(zi,{className:"size-7"})}):B?n.jsx(G,{name:B,className:"size-7",style:I?{color:I}:void 0}):n.jsx(zi,{className:"size-7",style:I?{color:I}:void 0})})}),n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx("label",{className:"typography-ui-label font-medium text-foreground",children:r("projectEditDialog.field.name")}),n.jsx(Ic,{value:h,onChange:ae=>m(ae.target.value),placeholder:r("projectEditDialog.field.namePlaceholder"),className:"h-11"}),n.jsx("p",{className:"truncate typography-meta text-muted-foreground",title:i.path,children:i.path})]}),n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("label",{className:"typography-ui-label font-medium text-foreground",children:r("projectEditDialog.field.color")}),n.jsxs("div",{className:"flex flex-wrap gap-2.5",children:[n.jsx("button",{type:"button",onClick:()=>w(null),"aria-label":r("projectEditDialog.option.none"),className:me("flex size-9 items-center justify-center rounded-xl border-2 transition-all",v===null?"border-foreground":"border-edge hover:border-edge"),style:{touchAction:"manipulation"},children:n.jsx("span",{className:"h-0.5 w-4 rotate-45 rounded-full bg-muted-foreground/40"})}),Ec.map(ae=>n.jsx("button",{type:"button",onClick:()=>w(ae),"aria-label":r("settings.projects.appearance.colorSwatchAria",{color:ae}),title:ae,className:me("size-9 rounded-xl border-2 transition-all",v===ae?"border-foreground":"border-transparent hover:border-edge"),style:{backgroundColor:ae,touchAction:"manipulation"}},ae))]})]}),n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("label",{className:"typography-ui-label font-medium text-foreground",children:r("projectEditDialog.field.icon")}),n.jsxs("div",{className:"flex flex-wrap gap-2.5",children:[n.jsx("button",{type:"button",onClick:()=>b(null),"aria-label":r("projectEditDialog.option.none"),className:me("flex size-9 items-center justify-center rounded-xl border-2 transition-all",g===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"})}),Pc.map(ae=>n.jsx("button",{type:"button",onClick:()=>b(ae.key),"aria-label":ae.label,className:me("flex size-9 items-center justify-center rounded-xl border-2 transition-all",g===ae.key?"border-foreground bg-[var(--surface-elevated)]":"border-edge hover:border-edge"),style:{touchAction:"manipulation"},children:n.jsx(G,{name:ae.Icon,className:"size-4",style:I?{color:I}:void 0})},ae.key))]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:[n.jsx($e,{size:"sm",variant:"outline",onClick:L,disabled:k,children:r(k?"projectEditDialog.actions.discovering":"projectEditDialog.actions.discoverFavicon")}),Q?n.jsx($e,{size:"sm",variant:"outline",onClick:F,children:r("projectEditDialog.actions.removeProjectIcon")}):null]})]}),z?n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("label",{className:"typography-ui-label font-medium text-foreground",children:r("mobile.projectEdit.worktreesTitle")}),P.length===0?n.jsx("p",{className:"typography-meta text-muted-foreground",children:r("mobile.projectEdit.worktreesEmpty")}):n.jsx("div",{className:"flex flex-col gap-1.5",children:P.map(ae=>n.jsx(I1,{worktree:ae,onDelete:()=>A(ae)},ae.path))})]}):null,z&&o?n.jsx(N1,{projectPath:i.path}):null]}):null,e[45]=v,e[46]=I,e[47]=x,e[48]=c,e[49]=L,e[50]=F,e[51]=Q,e[52]=g,e[53]=k,e[54]=z,e[55]=o,e[56]=h,e[57]=B,e[58]=i,e[59]=r,e[60]=P,e[61]=ne):ne=e[61];let ue;e[62]!==a||e[63]!==t||e[64]!==J||e[65]!==X||e[66]!==re||e[67]!==ne?(ue=n.jsx(gs,{open:t,onClose:a,title:J,ariaLabel:X,noHeaderBorder:!0,trailing:re,children:ne}),e[62]=a,e[63]=t,e[64]=J,e[65]=X,e[66]=re,e[67]=ne,e[68]=ue):ue=e[68];let Y;e[69]!==i||e[70]!==_?(Y=i?n.jsx(Za,{open:!!_,project:{id:i.id,path:i.path},worktree:_,onClose:()=>A(null)}):null,e[69]=i,e[70]=_,e[71]=Y):Y=e[71];let ie;return e[72]!==ue||e[73]!==Y?(ie=n.jsxs(n.Fragment,{children:[ue,Y]}),e[72]=ue,e[73]=Y,e[74]=ie):ie=e[74],ie};function P1(s){return n.jsx(Zm,{entry:s,actions:"sheet"},s.id)}function _1(s){return s.isolatedSpacesEnabled}function T1(s){return s.updateProjectMeta}function A1(s){return s.discoverProjectIcon}function D1(s){return s.removeProjectIcon}const xn=s=>{const e=oe.c(20),{project:t,size:i}=s,a=i===void 0?"md":i,{currentTheme:r}=ia(),c=t.icon?oa[t.icon]:null;let o;e[0]!==t.color?(o=ra(t.color),e[0]=t.color,e[1]=o):o=e[1];const d=o,u=a==="md"?"size-5":"size-3.5";let l;e[2]!==c||e[3]!==u||e[4]!==d?(l=c?n.jsx(G,{name:c,className:u,style:d?{color:d}:void 0}):n.jsx(zi,{className:u,style:d?{color:d}:void 0}),e[2]=c,e[3]=u,e[4]=d,e[5]=l):l=e[5];const f=l;let x;e[6]!==r||e[7]!==f||e[8]!==t.iconImage||e[9]!==t.id?(x=t.iconImage?n.jsx(aa,{project:{id:t.id,iconImage:t.iconImage??null},options:{themeVariant:r.metadata.variant,iconColor:r.colors.surface.foreground},className:"size-full object-contain",fallback:f}):null,e[6]=r,e[7]=f,e[8]=t.iconImage,e[9]=t.id,e[10]=x):x=e[10];const h=x;let m;e[11]!==t.iconBackground?(m=t.iconBackground?{backgroundColor:t.iconBackground}:void 0,e[11]=t.iconBackground,e[12]=m):m=e[12];const g=m;if(a==="md"){let k;return e[13]!==f||e[14]!==h||e[15]!==g?(k=n.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center text-muted-foreground",children:h?n.jsx("span",{className:"flex size-6 items-center justify-center overflow-hidden rounded-md",style:g,children:h}):f}),e[13]=f,e[14]=h,e[15]=g,e[16]=k):k=e[16],k}const b=h?g:void 0,v=h??f;let w;return e[17]!==b||e[18]!==v?(w=n.jsx("span",{className:"flex size-3.5 shrink-0 items-center justify-center overflow-hidden rounded-[3px] text-muted-foreground",style:b,children:v}),e[17]=b,e[18]=v,e[19]=w):w=e[19],w},ur=s=>Xs(s)??"",M1=s=>{const e=ur(s);if(!e)return"";const t=e.split("/").filter(Boolean);return t[t.length-1]?.replace(/[-_]/g," ")||e},Hs=s=>{const e=s;return ur(e.directory??e.project?.worktree??null)},O1=s=>{if(!s.panel)return!1;const e=Qi.getState().guests.find(t=>t.id===s.guestId);return!!(e&&Dc(e,"panel"))},el=s=>{const e=oe.c(9),{marks:t,onOpenRow:i}=s,{t:a}=ye();if(t.length===0)return null;let r;if(e[0]!==t||e[1]!==i||e[2]!==a){let o;e[4]!==i||e[5]!==a?(o=d=>{const u=a("sessions.sidebar.session.guestMark.label",{name:d.guestName,text:d.text});return n.jsx("span",{"data-guest-mark":d.guestId,role:"img","aria-label":u,className:"relative inline-flex shrink-0 items-center before:absolute before:-inset-2 before:content-['']",onClick:l=>{l.preventDefault(),l.stopPropagation(),!(O1(d)&&(i(),Ac({mode:Ho(d.guestId),directory:null,supported:!0}).ok))&&(pe.info(u),d.url&&Xo(d.url))},children:n.jsx(Qu,{mark:d})},d.guestId)},e[4]=i,e[5]=a,e[6]=o):o=e[6],r=t.slice(0,Yu).map(o),e[0]=t,e[1]=i,e[2]=a,e[3]=r}else r=e[3];let c;return e[7]!==r?(c=n.jsx(n.Fragment,{children:r}),e[7]=r,e[8]=c):c=e[8],c},fr=s=>{const e=oe.c(51),{initialTitle:t,indent:i,className:a,aiRename:r,placeholder:c,onSubmit:o,onCancel:d}=s,{t:u}=ye(),[l,f]=p.useState(t),x=L1;let h;e[0]!==r||e[1]!==t||e[2]!==d||e[3]!==o||e[4]!==l?(h=()=>{const L=l.trim();if(!L&&r||L===t.trim()){d();return}o(L)},e[0]=r,e[1]=t,e[2]=d,e[3]=o,e[4]=l,e[5]=h):h=e[5];const m=h;let g;e[6]!==a?(g=me("flex h-9 min-w-0 flex-1 items-center gap-2 pe-2",a),e[6]=a,e[7]=g):g=e[7];let b;e[8]!==i?(b={paddingInlineStart:i},e[8]=i,e[9]=b):b=e[9];let v;e[10]!==m?(v=L=>{L.preventDefault(),m()},e[10]=m,e[11]=v):v=e[11];let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=L=>f(L.target.value),e[12]=w):w=e[12];let k;e[13]!==d?(k=L=>Zu(L,d),e[13]=d,e[14]=k):k=e[14];let E;e[15]!==u?(E=u("sessions.sidebar.session.rename.save"),e[15]=u,e[16]=E):E=e[16];let _;e[17]!==c||e[18]!==u?(_=c??u("sessions.sidebar.session.menu.rename"),e[17]=c,e[18]=u,e[19]=_):_=e[19];let A;e[20]===Symbol.for("react.memo_cache_sentinel")?(A={minHeight:0},e[20]=A):A=e[20];let S;e[21]!==k||e[22]!==E||e[23]!==_||e[24]!==l?(S=n.jsx("input",{ref:x,value:l,onChange:w,onKeyDown:k,"aria-label":E,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]=k,e[22]=E,e[23]=_,e[24]=l,e[25]=S):S=e[25];let C;e[26]!==r||e[27]!==d||e[28]!==u?(C=r?n.jsx("button",{type:"button",disabled:r.disabled,onClick:()=>{r.run(),d()},"aria-label":u("sessions.aiRename.action"),"aria-description":r.hint,title:r.hint,className:"flex size-8 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:text-foreground disabled:opacity-40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",style:{touchAction:"manipulation",minHeight:0,minWidth:0},children:n.jsx(G,{name:"ai-generate-2",className:"size-4"})}):null,e[26]=r,e[27]=d,e[28]=u,e[29]=C):C=e[29];let j;e[30]!==u?(j=u("sessions.sidebar.session.rename.save"),e[30]=u,e[31]=j):j=e[31];let T,R;e[32]===Symbol.for("react.memo_cache_sentinel")?(T={touchAction:"manipulation",minHeight:0,minWidth:0},R=n.jsx(G,{name:"check",className:"size-4"}),e[32]=T,e[33]=R):(T=e[32],R=e[33]);let K;e[34]!==j?(K=n.jsx("button",{type:"submit","aria-label":j,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:T,children:R}),e[34]=j,e[35]=K):K=e[35];let P;e[36]!==u?(P=u("sessions.sidebar.session.rename.cancel"),e[36]=u,e[37]=P):P=e[37];let z,O;e[38]===Symbol.for("react.memo_cache_sentinel")?(z={touchAction:"manipulation",minHeight:0,minWidth:0},O=n.jsx(G,{name:"close",className:"size-4"}),e[38]=z,e[39]=O):(z=e[38],O=e[39]);let D;e[40]!==d||e[41]!==P?(D=n.jsx("button",{type:"button",onClick:d,"aria-label":P,className:"flex size-8 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",style:z,children:O}),e[40]=d,e[41]=P,e[42]=D):D=e[42];let M;return e[43]!==S||e[44]!==C||e[45]!==K||e[46]!==D||e[47]!==g||e[48]!==b||e[49]!==v?(M=n.jsxs("form",{className:g,style:b,onSubmit:v,children:[S,C,K,D]}),e[43]=S,e[44]=C,e[45]=K,e[46]=D,e[47]=g,e[48]=b,e[49]=v,e[50]=M):M=e[50],M};function L1(s){s&&(s.focus(),s.select())}const po=s=>{const e=oe.c(8),{session:t}=s,{t:i}=ye(),a=la(t);if(!a)return null;const r=Mc[a.status];let c;e[0]!==i||e[1]!==r?(c=i(r),e[0]=i,e[1]=r,e[2]=c):c=e[2];const o=c,d=Oc[a.status];let u;e[3]!==d?(u={color:d},e[3]=d,e[4]=u):u=e[4];let l;return e[5]!==o||e[6]!==u?(l=n.jsx(G,{name:"target",className:"size-3.5 shrink-0",style:u,"aria-label":o}),e[5]=o,e[6]=u,e[7]=l):l=e[7],l},ho=s=>{const e=oe.c(9),{hasPermission:t,hasForm:i}=s,{t:a}=ye();if(!t&&!i)return null;let r;e[0]!==t||e[1]!==a?(r=t?n.jsx("span",{className:"inline-flex shrink-0 items-center text-status-warning","aria-label":a("sessions.sidebar.session.status.permissionRequired"),children:n.jsx(G,{name:"shield",className:"size-3"})}):null,e[0]=t,e[1]=a,e[2]=r):r=e[2];let c;e[3]!==i||e[4]!==a?(c=i?n.jsx("span",{className:"inline-flex shrink-0 items-center text-status-warning","aria-label":a("sessions.sidebar.session.status.questionPending"),children:n.jsx(G,{name:"question",className:"size-3"})}):null,e[3]=i,e[4]=a,e[5]=c):c=e[5];let o;return e[6]!==r||e[7]!==c?(o=n.jsxs(n.Fragment,{children:[r,c]}),e[6]=r,e[7]=c,e[8]=o):o=e[8],o},Js=48,B1=4*Js,z1=180,go=(s,e)=>{s&&(s.style.visibility=e?"visible":"hidden")},Mn=s=>{const e=oe.c(33),{actionsWidth:t,actions:i,revealed:a,onRevealedChange:r,dataActiveSession:c,contentClassName:o,children:d}=s,u=o===void 0?"relative flex w-full items-center bg-background":o,{direction:l}=ye(),f=l==="rtl"?-1:1,x=p.useRef(null),h=p.useRef(null),m=p.useRef(null),g=p.useRef(!1),b=p.useRef(0),v=p.useRef(a);let w;e[0]!==f?(w=(I,B)=>{const Q=x.current;Q&&(go(h.current,I!==0||B&&I!==b.current),Q.style.transition=B?`transform ${z1}ms ease-out`:"none",Q.style.transform=I===0?"none":`translateX(${I*f}px)`,b.current=I)},e[0]=f,e[1]=w):w=e[1];const k=w;let E;e[2]===Symbol.for("react.memo_cache_sentinel")?(E=I=>{I.target===x.current&&I.propertyName==="transform"&&b.current===0&&go(h.current,!1)},e[2]=E):E=e[2];const _=E;let A,S;e[3]!==t||e[4]!==k||e[5]!==a?(A=()=>{v.current=a,k(a?t:0,!0)},S=[t,k,a],e[3]=t,e[4]=k,e[5]=a,e[6]=A,e[7]=S):(A=e[6],S=e[7]),p.useLayoutEffect(A,S);let C;e[8]===Symbol.for("react.memo_cache_sentinel")?(C=I=>{if(I.touches.length!==1)return;const B=I.touches[0];m.current={x:B.clientX,y:B.clientY},g.current=!1},e[8]=C):C=e[8];const j=C;let T;e[9]!==t||e[10]!==k||e[11]!==f?(T=I=>{if(!m.current)return;const B=I.touches[0],Q=(B.clientX-m.current.x)*f,J=B.clientY-m.current.y;if(!g.current){if(Math.abs(Q)<8||Math.abs(Q)<=Math.abs(J))return;g.current=!0}const X=v.current?t:0;k(Math.max(0,Math.min(t,X+Q)),!1)},e[9]=t,e[10]=k,e[11]=f,e[12]=T):T=e[12];const R=T;let K;e[13]!==t||e[14]!==k||e[15]!==r?(K=()=>{if(m.current=null,!g.current)return;g.current=!1;const I=b.current>t/2;k(I?t:0,!0),I!==v.current&&r(I)},e[13]=t,e[14]=k,e[15]=r,e[16]=K):K=e[16];const P=K,z=c||void 0;let O;e[17]===Symbol.for("react.memo_cache_sentinel")?(O={touchAction:"pan-y"},e[17]=O):O=e[17];let D;e[18]!==t?(D={width:t},e[18]=t,e[19]=D):D=e[19];const M=!a;let L;e[20]!==i||e[21]!==D||e[22]!==M?(L=n.jsx("div",{ref:h,className:"absolute inset-y-0 inset-s-0 flex items-stretch",style:D,"aria-hidden":M,children:i}),e[20]=i,e[21]=D,e[22]=M,e[23]=L):L=e[23];const W=`${u} rounded-[inherit]`;let F;e[24]!==d||e[25]!==W?(F=n.jsx("div",{ref:x,className:W,onTransitionEnd:_,onTransitionCancel:_,children:d}),e[24]=d,e[25]=W,e[26]=F):F=e[26];let N;return e[27]!==P||e[28]!==R||e[29]!==L||e[30]!==F||e[31]!==z?(N=n.jsxs("div",{"data-active-session":z,className:"relative overflow-hidden rounded-lg",onTouchStart:j,onTouchMove:R,onTouchEnd:P,onTouchCancel:P,style:O,children:[L,F]}),e[27]=P,e[28]=R,e[29]=L,e[30]=F,e[31]=z,e[32]=N):N=e[32],N},F1=s=>{const e=oe.c(62),{sessionId:t,title:i,revealed:a,confirmingDelete:r,onArchive:c,onRequestDelete:o,onConfirmDelete:d,onRequestRename:u,onRevealedChange:l,work:f,pin:x}=s,{t:h}=ye(),m=a?0:-1;let g;e[0]!==l||e[1]!==t||e[2]!==h?(g=async()=>{if(!(await qi(t).catch(W1))?.ok){qr.error(h("sessions.sidebar.session.copyId.error"));return}l?.(!1),qr.success(h("sessions.sidebar.session.copyId.success"))},e[0]=l,e[1]=t,e[2]=h,e[3]=g):g=e[3];const b=g;let v;e[4]!==h||e[5]!==i?(v=h("mobile.sessions.archiveSessionAria",{title:i}),e[4]=h,e[5]=i,e[6]=v):v=e[6];let w,k;e[7]===Symbol.for("react.memo_cache_sentinel")?(w={touchAction:"manipulation"},k=n.jsx(Hm,{className:"size-[18px]"}),e[7]=w,e[8]=k):(w=e[7],k=e[8]);let E;e[9]!==c||e[10]!==v||e[11]!==m?(E=n.jsx("button",{type:"button",tabIndex:m,className:"flex flex-1 items-center justify-center text-muted-foreground transition-colors active:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring","aria-label":v,onClick:c,style:w,children:k}),e[9]=c,e[10]=v,e[11]=m,e[12]=E):E=e[12];let _;e[13]!==l||e[14]!==x||e[15]!==h||e[16]!==m?(_=x?n.jsx("button",{type:"button",tabIndex:m,className:"flex flex-1 items-center justify-center text-muted-foreground transition-colors active:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring","aria-label":x.pinned?h("sessions.sidebar.session.menu.unpin"):h("sessions.sidebar.session.menu.pin"),onClick:()=>{x.onToggle(),l?.(!1)},style:{touchAction:"manipulation"},children:n.jsx(G,{name:x.pinned?"unpin":"pushpin",className:"size-[18px]"})}):null,e[13]=l,e[14]=x,e[15]=h,e[16]=m,e[17]=_):_=e[17];let A;e[18]!==l||e[19]!==h||e[20]!==m||e[21]!==f?(A=f?n.jsx("button",{type:"button",tabIndex:m,className:me("flex flex-1 items-center justify-center transition-colors active:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",f.inWork?"text-status-success":"text-muted-foreground active:text-foreground"),"aria-label":f.inWork?h("sessions.sidebar.session.work.markDone"):h("sessions.sidebar.session.work.track"),onClick:()=>{f.onToggle(),l?.(!1)},style:{touchAction:"manipulation"},children:n.jsx(G,{name:f.inWork?"check":"eye",className:f.inWork?"size-5":"size-[18px]"})}):null,e[18]=l,e[19]=h,e[20]=m,e[21]=f,e[22]=A):A=e[22];const S=r?"rounded-lg bg-destructive text-destructive-foreground":"text-[var(--status-error)] active:opacity-80";let C;e[23]!==S?(C=me("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",S),e[23]=S,e[24]=C):C=e[24];let j;e[25]!==r||e[26]!==h||e[27]!==i?(j=r?h("mobile.sessions.confirmDeleteSessionAria",{title:i}):h("mobile.sessions.deleteSessionAria",{title:i}),e[25]=r,e[26]=h,e[27]=i,e[28]=j):j=e[28];const T=r?d:o;let R,K;e[29]===Symbol.for("react.memo_cache_sentinel")?(R={touchAction:"manipulation"},K=n.jsx(Ra,{className:"size-[18px]"}),e[29]=R,e[30]=K):(R=e[29],K=e[30]);let P;e[31]!==j||e[32]!==T||e[33]!==C||e[34]!==m?(P=n.jsx("button",{type:"button",tabIndex:m,className:C,"aria-label":j,onClick:T,style:R,children:K}),e[31]=j,e[32]=T,e[33]=C,e[34]=m,e[35]=P):P=e[35];let z;e[36]!==h||e[37]!==i?(z=h("mobile.sessions.renameSessionAria",{title:i}),e[36]=h,e[37]=i,e[38]=z):z=e[38];let O,D;e[39]===Symbol.for("react.memo_cache_sentinel")?(O={touchAction:"manipulation"},D=n.jsx(Vm,{className:"size-[18px]"}),e[39]=O,e[40]=D):(O=e[39],D=e[40]);let M;e[41]!==u||e[42]!==z||e[43]!==m?(M=n.jsx("button",{type:"button",tabIndex:m,className:"flex flex-1 items-center justify-center text-muted-foreground transition-colors active:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring","aria-label":z,onClick:u,style:O,children:D}),e[41]=u,e[42]=z,e[43]=m,e[44]=M):M=e[44];let L;e[45]!==h?(L=h("sessions.sidebar.session.menu.copyId"),e[45]=h,e[46]=L):L=e[46];let W;e[47]!==b?(W=()=>{b()},e[47]=b,e[48]=W):W=e[48];let F,N;e[49]===Symbol.for("react.memo_cache_sentinel")?(F={touchAction:"manipulation"},N=n.jsx(G,{name:"file-copy",className:"size-[18px]"}),e[49]=F,e[50]=N):(F=e[49],N=e[50]);let I;e[51]!==L||e[52]!==W||e[53]!==m?(I=n.jsx("button",{type:"button",tabIndex:m,className:"flex flex-1 items-center justify-center text-muted-foreground transition-colors active:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring","aria-label":L,onClick:W,style:F,children:N}),e[51]=L,e[52]=W,e[53]=m,e[54]=I):I=e[54];let B;return e[55]!==P||e[56]!==M||e[57]!==I||e[58]!==E||e[59]!==_||e[60]!==A?(B=n.jsxs(n.Fragment,{children:[E,_,A,P,M,I]}),e[55]=P,e[56]=M,e[57]=I,e[58]=E,e[59]=_,e[60]=A,e[61]=B):B=e[61],B};function W1(){return null}const $1=({active:s,repeat:e=!1,unread:t,running:i,pending:a})=>s?e?"text-foreground":"text-interactive-selection-foreground":t||a.hasPermission||a.hasForm?"font-semibold text-foreground":i?"text-foreground":"oc-title-rest",K1=s=>{const e=oe.c(7);let t;e[0]!==s?(t=o=>s.some(d=>!!o.bySession.get(d)?.permissions.length),e[0]=s,e[1]=t):t=e[1];const i=Ar(t);let a;e[2]!==s?(a=o=>s.some(d=>{const u=o.bySession.get(d);return!!(u?.forms.length||u?.pages.length)}),e[2]=s,e[3]=a):a=e[3];const r=Ar(a);let c;return e[4]!==r||e[5]!==i?(c={hasPermission:i,hasForm:r},e[4]=r,e[5]=i,e[6]=c):c=e[6],c},H1=()=>{const s=new Map;for(const e of gn.getState().activeSessions)e.parentID&&s.set(e.parentID,[...s.get(e.parentID)??[],e]);return s},bo=(s,e,t)=>{Ge.getState().closeMainSurfaces(),e&&Yt.getState().setActiveProjectIdOnly(e),yt.getState().setCurrentSession(s.id,Hs(s)||null),t()},Ci=(s,e,t)=>{const i=yt.getState();return Bc(s,e,zc(e.id,Fc(H1(),e.id),s==="delete"),{archiveSession:i.archiveSession,archiveSessions:i.archiveSessions,deleteSession:i.deleteSession,deleteSessions:i.deleteSessions},t)},V1=async(s,e,t)=>{try{if(e.length===0){await Dr(s.id,Hs(s)||null,"open");return}for(const i of e)await Dr(i.id,Hs(i)||Hs(s)||null,"done")}catch{pe.error(t("sessions.sidebar.session.work.updateFailed"))}},U1=(s,e,t)=>{const i=Hs(s);if(!i)return;const a={directory:i,sessionId:s.id};ja({current:e?Lc(s)??Tl:null,pin:r=>{Kr(a,!0,r).catch(()=>pe.error(t("sessions.sidebar.session.pin.pinFailed")))},unpin:()=>{Kr(a,!1,null).catch(()=>pe.error(t("sessions.sidebar.session.pin.unpinFailed")))}})},G1=async(s,e,t)=>{try{await yt.getState().updateSessionTitle(s,e)}catch{pe.error(t("mobile.sessions.renameError"))}},St=ep()(s=>({revealedKey:null,armedKey:null,renamingKey:null,setRevealed:(e,t)=>s(i=>t?{revealedKey:e,armedKey:null}:i.revealedKey===e?{revealedKey:null,armedKey:null}:i),arm:e=>s({armedKey:e}),startRename:e=>s({renamingKey:e,revealedKey:null,armedKey:null}),stopRename:()=>s({renamingKey:null}),forgetUnlisted:e=>s(t=>{const i=t.revealedKey!==null&&!e(t.revealedKey),a=t.renamingKey!==null&&!e(t.renamingKey);return!i&&!a?t:{revealedKey:i?null:t.revealedKey,armedKey:i?null:t.armedKey,renamingKey:a?null:t.renamingKey}}),reset:()=>s({revealedKey:null,armedKey:null,renamingKey:null})})),On=s=>{const e=oe.c(10);let t;e[0]!==s?(t=u=>u.revealedKey===s,e[0]=s,e[1]=t):t=e[1];const i=St(t);let a;e[2]!==s?(a=u=>u.armedKey===s,e[2]=s,e[3]=a):a=e[3];const r=St(a);let c;e[4]!==s?(c=u=>u.renamingKey===s,e[4]=s,e[5]=c):c=e[5];const o=St(c);let d;return e[6]!==r||e[7]!==o||e[8]!==i?(d={revealed:i,armed:r,renaming:o},e[6]=r,e[7]=o,e[8]=i,e[9]=d):d=e[9],d},tl=p.createContext(null),q1=tl.Provider,yn=()=>{const s=p.useContext(tl);if(!s)throw new Error("useMobileSidebarActions outside MobileSidebarActionsProvider");return s},mr=s=>{const e=oe.c(12),{disabled:t,menu:i,children:a}=s,r=t===void 0?!1:t,c=p.useRef(!1);let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=(m,g)=>{c.current=m&&g.event.type.startsWith("touch")},e[0]=o):o=e[0];let d,u,l;e[1]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx("div",{}),u=()=>{c.current=!1},l=m=>{c.current&&(c.current=!1,m.preventDefault(),m.stopPropagation())},e[1]=d,e[2]=u,e[3]=l):(d=e[1],u=e[2],l=e[3]);let f;e[4]!==a?(f=n.jsx(Wc,{render:d,onTouchStart:u,onClickCapture:l,children:a}),e[4]=a,e[5]=f):f=e[5];let x;e[6]!==i?(x=n.jsx($c,{children:i}),e[6]=i,e[7]=x):x=e[7];let h;return e[8]!==r||e[9]!==f||e[10]!==x?(h=n.jsxs(Kc,{disabled:r,onOpenChange:o,children:[f,x]}),e[8]=r,e[9]=f,e[10]=x,e[11]=h):h=e[11],h},ci="shadow-[inset_0_0_0_100vmax_var(--interactive-selection)]",pr="text-interactive-selection-foreground",J1={touchAction:"manipulation",minHeight:0,minWidth:0},pn=s=>{const e=oe.c(14),{expanded:t,kind:i,label:a,onToggle:r}=s,{t:c}=ye();let o;e[0]!==t||e[1]!==i||e[2]!==a||e[3]!==c?(o=i==="session"?c(t?"sessions.sidebar.session.subsessions.collapse":"sessions.sidebar.session.subsessions.expand"):i==="run"?c(t?"sessions.sidebar.run.collapse":"sessions.sidebar.run.expand"):t?c("sessions.sidebar.group.collapseAria",{label:a}):c("sessions.sidebar.group.expandAria",{label:a}),e[0]=t,e[1]=i,e[2]=a,e[3]=c,e[4]=o):o=e[4];const d=o;let u;e[5]!==r?(u=x=>{x.stopPropagation(),r()},e[5]=r,e[6]=u):u=e[6];let l;e[7]!==t?(l=n.jsx(Zi,{expanded:t}),e[7]=t,e[8]=l):l=e[8];let f;return e[9]!==d||e[10]!==t||e[11]!==u||e[12]!==l?(f=n.jsx("button",{type:"button",className:"flex size-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",style:J1,"aria-label":d,"aria-expanded":t,onClick:u,children:l}),e[9]=d,e[10]=t,e[11]=u,e[12]=l,e[13]=f):f=e[13],f},hr=s=>{const e=oe.c(5),{slotLeft:t,children:i}=s,a=t-9;let r;e[0]!==a?(r={insetInlineStart:a},e[0]=a,e[1]=r):r=e[1];let c;return e[2]!==i||e[3]!==r?(c=n.jsx("span",{className:"absolute inset-y-0 z-10 flex items-center",style:r,children:i}),e[2]=i,e[3]=r,e[4]=c):c=e[4],c},di=s=>{const e=oe.c(19),{indent:t,onSelect:i,ariaLabel:a,chevron:r,firstLine:c,secondLine:o}=s;let d;e[0]!==c?(d=n.jsx("span",{className:"flex h-5 min-w-0 items-center gap-2",children:c}),e[0]=c,e[1]=d):d=e[1];let u;e[2]!==r||e[3]!==o?(u=o||r?n.jsxs("span",{className:"flex h-4 min-w-0 items-center gap-1.5 text-muted-foreground",children:[r?n.jsx("span",{"aria-hidden":!0,className:"size-3.5 shrink-0"}):null,o]}):null,e[2]=r,e[3]=o,e[4]=u):u=e[4];let l;e[5]!==d||e[6]!==u?(l=n.jsxs(n.Fragment,{children:[d,u]}),e[5]=d,e[6]=u,e[7]=l):l=e[7];const f=l;let x;e[8]!==a||e[9]!==t||e[10]!==f||e[11]!==i?(x=i?n.jsx("button",{type:"button",className:me("flex min-h-9 min-w-0 flex-1 flex-col gap-1 py-1.5 pe-3 text-start","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring"),style:{paddingInlineStart:t,touchAction:"manipulation"},"aria-label":a,onClick:i,children:f}):n.jsx("div",{className:"flex min-h-9 min-w-0 flex-1 flex-col gap-1 py-1.5 pe-3 text-start",style:{paddingInlineStart:t},children:f}),e[8]=a,e[9]=t,e[10]=f,e[11]=i,e[12]=x):x=e[12];let h;e[13]!==r||e[14]!==t?(h=r?n.jsx("span",{className:"absolute z-10 flex h-8 items-center",style:{insetInlineStart:t-9,top:22},children:r}):null,e[13]=r,e[14]=t,e[15]=h):h=e[15];let m;return e[16]!==x||e[17]!==h?(m=n.jsxs("div",{className:"relative flex min-w-0 flex-1",children:[x,h]}),e[16]=x,e[17]=h,e[18]=m):m=e[18],m},ds=s=>{const e=oe.c(13),{icon:t,glyph:i,label:a,revealed:r,onClick:c,tone:o,armed:d,disabled:u}=s,l=o===void 0?"default":o,f=d===void 0?!1:d,x=u===void 0?!1:u,h=r?0:-1,m=l==="destructive"?f?"rounded-lg bg-destructive text-destructive-foreground focus-visible:ring-destructive":"text-[var(--status-error)] active:opacity-80 focus-visible:ring-destructive":l==="success"?"text-status-success active:opacity-80 focus-visible:ring-ring":"text-muted-foreground active:text-foreground focus-visible:ring-ring";let g;e[0]!==m?(g=me("flex flex-1 items-center justify-center transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset disabled:opacity-40",m),e[0]=m,e[1]=g):g=e[1];let b;e[2]===Symbol.for("react.memo_cache_sentinel")?(b={touchAction:"manipulation"},e[2]=b):b=e[2];let v;e[3]!==i||e[4]!==t?(v=i??n.jsx(G,{name:t,className:t==="check"?"size-5":"size-[18px]"}),e[3]=i,e[4]=t,e[5]=v):v=e[5];let w;return e[6]!==x||e[7]!==a||e[8]!==c||e[9]!==h||e[10]!==g||e[11]!==v?(w=n.jsx("button",{type:"button",tabIndex:h,disabled:x,className:g,"aria-label":a,onClick:c,style:b,children:v}),e[6]=x,e[7]=a,e[8]=c,e[9]=h,e[10]=g,e[11]=v,e[12]=w):w=e[12],w},X1=s=>{const e=oe.c(16),{more:t,fewer:i,hiddenNodes:a,indent:r,onShow:c}=s,{t:o}=ye();let d;e[0]!==a||e[1]!==c||e[2]!==o?(d=m=>n.jsxs("button",{type:"button",className:"flex min-h-9 items-center gap-2 py-1 pe-3 text-start text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",style:{touchAction:"manipulation"},onClick:()=>c(m),children:[n.jsx(G,{name:m==="more"?"arrow-down-s":"arrow-up-s",className:"size-4"}),n.jsx("span",{className:"typography-micro",children:o(m==="more"?"sessions.sidebar.group.showMore":"sessions.sidebar.group.showFewer")}),m==="more"?n.jsx(ef,{nodes:a}):null]}),e[0]=a,e[1]=c,e[2]=o,e[3]=d):d=e[3];const u=d;let l;e[4]!==r?(l={paddingInlineStart:r},e[4]=r,e[5]=l):l=e[5];let f;e[6]!==u||e[7]!==t?(f=t?u("more"):null,e[6]=u,e[7]=t,e[8]=f):f=e[8];let x;e[9]!==u||e[10]!==i?(x=i?u("fewer"):null,e[9]=u,e[10]=i,e[11]=x):x=e[11];let h;return e[12]!==l||e[13]!==f||e[14]!==x?(h=n.jsxs("div",{className:"flex w-full items-center gap-2",style:l,children:[f,x]}),e[12]=l,e[13]=f,e[14]=x,e[15]=h):h=e[15],h},sl=s=>s.children.flatMap(e=>[e.session.id,...sl(e)]),Y1=s=>{const e=oe.c(266),{row:t,geometry:i,toggleParent:a}=s,{t:r}=ye(),c=yn(),{node:o,depth:d}=t,u=o.session;let l;e[0]!==u?(l=Hs(u),e[0]=u,e[1]=l):l=e[1];const f=l,{revealed:x,armed:h,renaming:m}=On(t.key);let g;e[2]!==u.title||e[3]!==r?(g=u.title?.trim()||r("mobile.sessions.untitled"),e[2]=u.title,e[3]=r,e[4]=g):g=e[4];const b=g,v=tf(u.id,u.directory,x||m);let w;e[5]!==u.id?(w=Ee=>Ee.currentSessionId===u.id,e[5]=u.id,e[6]=w):w=e[6];const k=yt(w),E=Ge(Q1),_=k&&!E,A=Yo(u.id),S=Qo(u.id),C=Zo(u.id),j=C!==null,T=!j&&A&&(!_||S),R=ea(u.id,j),K=(j||T)&&R,P=o.children.length>0,z=t.expanded===!0;let O;e[7]!==z||e[8]!==P||e[9]!==o||e[10]!==u.id?(O=P&&!z?[u.id,...sl(o)]:[u.id],e[7]=z,e[8]=P,e[9]=o,e[10]=u.id,e[11]=O):O=e[11];const M=K1(O),L=!u.parentID,W=Ge(Z1);let F;e[12]!==f||e[13]!==u.id?(F=Ee=>Gc(Ee.ids,f||null,u.id),e[12]=f,e[13]=u.id,e[14]=F):F=e[14];const N=qo(F);let I;e[15]!==f||e[16]!==N||e[17]!==t.ownsWork||e[18]!==W||e[19]!==L?(I=W&&t.ownsWork&&L&&!Gi(f)&&!N,e[15]=f,e[16]=N,e[17]=t.ownsWork,e[18]=W,e[19]=L,e[20]=I):I=e[20];const B=I;let Q;e[21]!==o||e[22]!==B?(Q=B?sf(o):[],e[21]=o,e[22]=B,e[23]=Q):Q=e[23];const J=Q;let X;e[24]!==B||e[25]!==u||e[26]!==J||e[27]!==r?(X=B?{inWork:J.length>0,onToggle:()=>{V1(u,J,r)}}:void 0,e[24]=B,e[25]=u,e[26]=J,e[27]=r,e[28]=X):X=e[28];const q=X;let Z;e[29]!==f||e[30]!==N||e[31]!==u||e[32]!==r||e[33]!==L?(Z=L&&f?{pinned:N,onToggle:()=>U1(u,N,r)}:void 0,e[29]=f,e[30]=N,e[31]=u,e[32]=r,e[33]=L,e[34]=Z):Z=e[34];const H=Z;let V;e[35]!==t.key?(V=ka(t.key),e[35]=t.key,e[36]=V):V=e[36];const se=V;let te;e[37]!==j||e[38]!==u||e[39]!==q?.inWork?(te=!!q?.inWork&&!j&&Hc(u),e[37]=j,e[38]=u,e[39]=q?.inWork,e[40]=te):te=e[40];const re=te;let ne;e[41]!==t.detailed||e[42]!==t.renderContext?(ne=t.detailed===!0||nf(t.renderContext),e[41]=t.detailed,e[42]=t.renderContext,e[43]=ne):ne=e[43];const ue=ne;let Y;e[44]!==ue||e[45]!==t.projectId||e[46]!==t.renderContext?(Y=Ee=>ue&&t.renderContext==="timeline-mixed"&&t.projectId?Ee.projects.find(ve=>ve.id===t.projectId)??null:null,e[44]=ue,e[45]=t.projectId,e[46]=t.renderContext,e[47]=Y):Y=e[47];const ie=Yt(Y),ae=ii(),Pe=o.worktree?.branch??null;let Be;e[48]!==t.secondaryMeta||e[49]!==Pe?(Be=rf(t.secondaryMeta,Pe),e[48]=t.secondaryMeta,e[49]=Pe,e[50]=Be):Be=e[50];const xe=Be,{refLines:Re}=of(u,o.worktree,!1),le=Re[0]??null,ce=Math.max(0,Re.length-1);let Ie;e[51]!==ce||e[52]!==le||e[53]!==Re?(Ie=Ee=>le?n.jsxs("span",{role:"img","aria-label":Re.map(eg).join(", "),className:"inline-flex shrink-0 items-center gap-0.5 typography-micro text-muted-foreground",children:[n.jsx(G,{name:le.icon,className:me("size-3",le.color&&"oc-ref-tint"),style:le.color?Di(le.color):void 0}),Ee?n.jsx("span",{className:"leading-none tabular-nums",children:le.label}):null,Ee&&ce>0?n.jsxs("span",{className:"leading-none tabular-nums text-muted-foreground",children:["+",ce]}):null]}):null,e[51]=ce,e[52]=le,e[53]=Re,e[54]=Ie):Ie=e[54];const Ne=Ie,je=t.secondaryMeta?.inSpace===!0;let De;e[55]!==t.projectId?(De=Ee=>t.projectId?Ee.projects.find(ve=>ve.id===t.projectId)?.path??null:null,e[55]=t.projectId,e[56]=De):De=e[56];const We=Yt(De),ct=u.id,Ue=u.directory??null;let Me;e[57]!==Ue?(Me=Xs(Ue),e[57]=Ue,e[58]=Me):Me=e[58];const He=t.projectId??null,Oe=t.renderContext==="project"&&!t.archived,rt=je?null:t.secondaryMeta?.branchLabel??null;let nt;e[59]!==o.worktree||e[60]!==We||e[61]!==u.id||e[62]!==Me||e[63]!==He||e[64]!==Oe||e[65]!==rt?(nt={shown:!0,sessionId:ct,directory:Me,projectId:He,projectRoot:We,worktree:o.worktree,inProjectTree:Oe,metaBranch:rt},e[59]=o.worktree,e[60]=We,e[61]=u.id,e[62]=Me,e[63]=He,e[64]=Oe,e[65]=rt,e[66]=nt):nt=e[66];const st=af(nt);let ee;e[67]!==c.close||e[68]!==t.projectId||e[69]!==u?(ee=()=>bo(u,t.projectId,c.close),e[67]=c.close,e[68]=t.projectId,e[69]=u,e[70]=ee):ee=e[70];let be;e[71]!==st||e[72]!==ee?(be=n.jsx(el,{marks:st,onOpenRow:ee}),e[71]=st,e[72]=ee,e[73]=be):be=e[73];const Ze=be;let U;e[74]!==P||e[75]!==t.archived||e[76]!==t.renderContext||e[77]!==u.id||e[78]!==a?(U=P?()=>a(cf(t.renderContext,t.archived,u.id)):void 0,e[74]=P,e[75]=t.archived,e[76]=t.renderContext,e[77]=u.id,e[78]=a,e[79]=U):U=e[79];const Ce=U;let qe;e[80]!==t.key?(qe=Ee=>St.getState().setRevealed(t.key,Ee),e[80]=t.key,e[81]=qe):qe=e[81];const he=qe;let ut;e[82]!==c.close||e[83]!==x||e[84]!==t.projectId||e[85]!==u||e[86]!==he?(ut=()=>{if(x){he(!1);return}bo(u,t.projectId,c.close)},e[82]=c.close,e[83]=x,e[84]=t.projectId,e[85]=u,e[86]=he,e[87]=ut):ut=e[87];const lt=ut,Ct=tg,ft=Vc(ca()),Je=Uc();let et;e[88]!==f||e[89]!==Je||e[90]!==u.id||e[91]!==u.title||e[92]!==r?(et=Ee=>{df({entry:Ee,t:r,session:{id:u.id,title:u.title,directory:f},loadRecords:()=>f?Je({directory:f,sessionID:u.id}).catch(sg):Promise.resolve(null),onLoadFailed:()=>pe.error(r("sessions.sidebar.session.export.failedLoadHistory"))})},e[88]=f,e[89]=Je,e[90]=u.id,e[91]=u.title,e[92]=r,e[93]=et):et=e[93];const dt=et,Xe=M.hasPermission||M.hasForm;let ht;e[94]!==v.pending||e[95]!==j||e[96]!==T||e[97]!==r||e[98]!==C||e[99]!==Xe?(ht=v.pending?n.jsx(G,{name:"loader-4",className:"size-3 shrink-0 animate-spin text-status-info","aria-label":r("sessions.aiRename.generating")}):(j||T)&&!Xe?n.jsx(ta,{state:C??"unread"}):null,e[94]=v.pending,e[95]=j,e[96]=T,e[97]=r,e[98]=C,e[99]=Xe,e[100]=ht):ht=e[100];const Se=ht;let it;e[101]!==j||e[102]!==u.id||e[103]!==K||e[104]!==Xe?(it=K&&!Xe?n.jsx(Xi,{sessionId:u.id,running:j,className:"shrink-0 typography-micro"}):null,e[101]=j,e[102]=u.id,e[103]=K,e[104]=Xe,e[105]=it):it=e[105];const Qe=it;let gt;e[106]!==se||e[107]!==N||e[108]!==r?(gt=N&&!se?n.jsx(G,{name:"pushpin",className:"size-3 shrink-0 text-muted-foreground","aria-label":r("sessions.sidebar.session.status.pinned")}):null,e[106]=se,e[107]=N,e[108]=r,e[109]=gt):gt=e[109];const bt=gt;let ot;e[110]!==re||e[111]!==r?(ot=re?n.jsx(G,{name:"check",className:"size-3.5 shrink-0 text-muted-foreground","aria-label":r("sessions.sidebar.session.work.doneSuggested")}):null,e[110]=re,e[111]=r,e[112]=ot):ot=e[112];const _e=ot;let mt;e[113]!==_||e[114]!==j||e[115]!==M||e[116]!==t.repeat||e[117]!==T?(mt=me("block min-w-0 flex-1 truncate oc-ui-start-align typography-ui-label",$1({active:_,repeat:t.repeat,unread:T,running:j,pending:M})),e[113]=_,e[114]=j,e[115]=M,e[116]=t.repeat,e[117]=T,e[118]=mt):mt=e[118];let xt;e[119]!==mt||e[120]!==b?(xt=n.jsx("span",{dir:"auto",className:mt,children:b}),e[119]=mt,e[120]=b,e[121]=xt):xt=e[121];const ze=xt;let at;e[122]!==v||e[123]!==u.id||e[124]!==r||e[125]!==b?(at=(Ee,ve)=>n.jsx(fr,{initialTitle:b,indent:Ee,aiRename:v,className:ve,onSubmit:vt=>{Ct(),G1(u.id,vt,r)},onCancel:Ct}),e[122]=v,e[123]=u.id,e[124]=r,e[125]=b,e[126]=at):at=e[126];const Fe=at;let ge;if(ue){let Ee;e[127]!==ie||e[128]!==ae?(Ee=ie?n.jsxs(n.Fragment,{children:[n.jsx(xn,{project:ie,size:"xs"}),ae?n.jsx(ri,{project:ie,separated:!1}):null]}):null,e[127]=ie,e[128]=ae,e[129]=Ee):Ee=e[129];const ve=Ee;let vt;e[130]!==xe||e[131]!==le||e[132]!==ie||e[133]!==u||e[134]!==Xe?(vt=ie||xe||la(u)||le||Xe,e[130]=xe,e[131]=le,e[132]=ie,e[133]=u,e[134]=Xe,e[135]=vt):vt=e[135];const Kt=!!vt;let rs;e[136]!==d||e[137]!==i?(rs=i.detailedLeft(d),e[136]=d,e[137]=i,e[138]=rs):rs=e[138];const Ht=m?void 0:lt;let Rt;e[139]!==z||e[140]!==b||e[141]!==Ce?(Rt=Ce?n.jsx(pn,{expanded:z,label:b,kind:"session",onToggle:Ce}):null,e[139]=z,e[140]=b,e[141]=Ce,e[142]=Rt):Rt=e[142];let Jt;e[143]!==_e||e[144]!==Kt||e[145]!==Se||e[146]!==Ze||e[147]!==bt||e[148]!==Fe||e[149]!==m||e[150]!==Qe||e[151]!==ze?(Jt=m?Fe(0,"h-[1lh] pe-0 typography-ui-label [&_button]:size-6 [&_button>svg]:size-3.5"):n.jsxs(n.Fragment,{children:[ze,Kt?null:Ze,bt,_e,Se,Qe]}),e[143]=_e,e[144]=Kt,e[145]=Se,e[146]=Ze,e[147]=bt,e[148]=Fe,e[149]=m,e[150]=Qe,e[151]=ze,e[152]=Jt):Jt=e[152];let Xt;e[153]!==xe||e[154]!==Kt||e[155]!==je||e[156]!==ve||e[157]!==Ze||e[158]!==M||e[159]!==Ne||e[160]!==u||e[161]!==r?(Xt=Kt?n.jsxs(n.Fragment,{children:[ve,xe?n.jsxs(n.Fragment,{children:[je?n.jsx(G,{name:"instance",className:"size-3.5 shrink-0","aria-hidden":!1,role:"img","aria-label":r("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:xe})]}):null,n.jsxs("span",{className:"ms-auto flex shrink-0 items-center gap-1.5",children:[n.jsx(po,{session:u}),Ne(!0),Ze,n.jsx(ho,{...M})]})]}):null,e[153]=xe,e[154]=Kt,e[155]=je,e[156]=ve,e[157]=Ze,e[158]=M,e[159]=Ne,e[160]=u,e[161]=r,e[162]=Xt):Xt=e[162];let js;e[163]!==rs||e[164]!==Ht||e[165]!==Rt||e[166]!==Jt||e[167]!==Xt?(js=n.jsx(di,{indent:rs,onSelect:Ht,chevron:Rt,firstLine:Jt,secondLine:Xt}),e[163]=rs,e[164]=Ht,e[165]=Rt,e[166]=Jt,e[167]=Xt,e[168]=js):js=e[168],ge=js}else{let Ee;e[169]!==d||e[170]!==z||e[171]!==i||e[172]!==b||e[173]!==Ce?(Ee=Ce?n.jsx(hr,{slotLeft:i.slotLeft(d),children:n.jsx(pn,{expanded:z,label:b,kind:"session",onToggle:Ce})}):null,e[169]=d,e[170]=z,e[171]=i,e[172]=b,e[173]=Ce,e[174]=Ee):Ee=e[174];let ve;e[175]!==d||e[176]!==_e||e[177]!==i||e[178]!==Se||e[179]!==Ze||e[180]!==M||e[181]!==bt||e[182]!==Ne||e[183]!==Fe||e[184]!==m||e[185]!==lt||e[186]!==u||e[187]!==Qe||e[188]!==ze?(ve=m?Fe(i.textLeft(d)):n.jsxs("button",{type:"button",className:"flex h-9 min-w-0 flex-1 items-center gap-2.5 pe-3.5 text-start focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",style:{paddingInlineStart:i.textLeft(d),touchAction:"manipulation"},onClick:lt,children:[ze,n.jsx(po,{session:u}),Ne(!1),Ze,n.jsx(ho,{...M}),bt,_e,Se,Qe]}),e[175]=d,e[176]=_e,e[177]=i,e[178]=Se,e[179]=Ze,e[180]=M,e[181]=bt,e[182]=Ne,e[183]=Fe,e[184]=m,e[185]=lt,e[186]=u,e[187]=Qe,e[188]=ze,e[189]=ve):ve=e[189];let vt;e[190]!==Ee||e[191]!==ve?(vt=n.jsxs(n.Fragment,{children:[Ee,ve]}),e[190]=Ee,e[191]=ve,e[192]=vt):vt=e[192],ge=vt}let de;e[193]!==u.id?(de=n.jsx(lf,{sessionId:u.id,Item:cs,showShortcut:!1}),e[193]=u.id,e[194]=de):de=e[194];let Te;e[195]!==t.key?(Te=()=>St.getState().startRename(t.key),e[195]=t.key,e[196]=Te):Te=e[196];let Ae;e[197]===Symbol.for("react.memo_cache_sentinel")?(Ae=n.jsx(G,{name:"edit",className:"me-1 size-4"}),e[197]=Ae):Ae=e[197];let Le;e[198]!==r?(Le=r("sessions.sidebar.session.menu.rename"),e[198]=r,e[199]=Le):Le=e[199];let tt;e[200]!==Te||e[201]!==Le?(tt=n.jsxs(cs,{onClick:Te,children:[Ae,Le]}),e[200]=Te,e[201]=Le,e[202]=tt):tt=e[202];let Bt;e[203]!==H||e[204]!==r?(Bt=H?n.jsxs(cs,{onClick:H.onToggle,children:[n.jsx(G,{name:H.pinned?"unpin":"pushpin",className:"me-1 size-4"}),H.pinned?r("sessions.sidebar.session.menu.unpin"):r("sessions.sidebar.session.menu.pin")]}):null,e[203]=H,e[204]=r,e[205]=Bt):Bt=e[205];let Ut;e[206]!==r||e[207]!==q?(Ut=q?n.jsxs(cs,{onClick:q.onToggle,children:[n.jsx(G,{name:q.inWork?"check":"eye",className:"me-1 size-4"}),q.inWork?r("sessions.sidebar.session.work.markDone"):r("sessions.sidebar.session.work.track")]}):null,e[206]=r,e[207]=q,e[208]=Ut):Ut=e[208];let zt;e[209]!==u||e[210]!==r?(zt=()=>{Ci("archive",u,r)},e[209]=u,e[210]=r,e[211]=zt):zt=e[211];let _t;e[212]===Symbol.for("react.memo_cache_sentinel")?(_t=n.jsx(G,{name:"archive",className:"me-1 size-4"}),e[212]=_t):_t=e[212];let Ke;e[213]!==r?(Ke=r("sessions.sidebar.bulkActions.archive"),e[213]=r,e[214]=Ke):Ke=e[214];let Ft;e[215]!==zt||e[216]!==Ke?(Ft=n.jsxs(cs,{onClick:zt,children:[_t,Ke]}),e[215]=zt,e[216]=Ke,e[217]=Ft):Ft=e[217];const Tt=ft.length>0?n.jsx(da,{}):null;let Gt;e[218]!==dt?(Gt=Ee=>n.jsxs(cs,{onClick:()=>dt(Ee),children:[n.jsx(si,{icon:Ee.icon,iconSrc:Ee.iconSrc,className:"me-1 size-4"}),Ee.action.label]},`${Ee.guest.id}:${Ee.action.id}`),e[218]=dt,e[219]=Gt):Gt=e[219];const Wt=ft.map(Gt);let xs;e[220]!==de||e[221]!==tt||e[222]!==Bt||e[223]!==Ut||e[224]!==Ft||e[225]!==Tt||e[226]!==Wt?(xs=n.jsxs(n.Fragment,{children:[de,tt,Bt,Ut,Ft,Tt,Wt]}),e[220]=de,e[221]=tt,e[222]=Bt,e[223]=Ut,e[224]=Ft,e[225]=Tt,e[226]=Wt,e[227]=xs):xs=e[227];const ps=xs,ys=m||x,vs=B1+(q?Js:0)+(H?Js:0),us=_&&!t.repeat&&ci;let Et;e[228]!==us?(Et=me("relative flex w-full items-center bg-background transition-colors",us),e[228]=us,e[229]=Et):Et=e[229];let ws;e[230]!==u||e[231]!==he||e[232]!==r?(ws=()=>{he(!1),Ci("archive",u,r)},e[230]=u,e[231]=he,e[232]=r,e[233]=ws):ws=e[233];let At;e[234]!==t.key?(At=()=>St.getState().arm(t.key),e[234]=t.key,e[235]=At):At=e[235];let Nt;e[236]!==u||e[237]!==he||e[238]!==r?(Nt=()=>{he(!1),Ci("delete",u,r)},e[236]=u,e[237]=he,e[238]=r,e[239]=Nt):Nt=e[239];let Dt;e[240]!==t.key?(Dt=()=>St.getState().startRename(t.key),e[240]=t.key,e[241]=Dt):Dt=e[241];let is;e[242]!==h||e[243]!==H||e[244]!==x||e[245]!==u.id||e[246]!==he||e[247]!==ws||e[248]!==At||e[249]!==Nt||e[250]!==Dt||e[251]!==b||e[252]!==q?(is=n.jsx(F1,{sessionId:u.id,title:b,revealed:x,confirmingDelete:h,onArchive:ws,onRequestDelete:At,onConfirmDelete:Nt,onRequestRename:Dt,onRevealedChange:he,work:q,pin:H}),e[242]=h,e[243]=H,e[244]=x,e[245]=u.id,e[246]=he,e[247]=ws,e[248]=At,e[249]=Nt,e[250]=Dt,e[251]=b,e[252]=q,e[253]=is):is=e[253];let qt;e[254]!==_||e[255]!==ge||e[256]!==x||e[257]!==he||e[258]!==vs||e[259]!==Et||e[260]!==is?(qt=n.jsx(Mn,{actionsWidth:vs,revealed:x,onRevealedChange:he,dataActiveSession:_,contentClassName:Et,actions:is,children:ge}),e[254]=_,e[255]=ge,e[256]=x,e[257]=he,e[258]=vs,e[259]=Et,e[260]=is,e[261]=qt):qt=e[261];let $t;return e[262]!==ps||e[263]!==ys||e[264]!==qt?($t=n.jsx(mr,{disabled:ys,menu:ps,children:qt}),e[262]=ps,e[263]=ys,e[264]=qt,e[265]=$t):$t=e[265],$t};function Q1(s){return s.runOverviewKey!==null}function Z1(s){return s.sessionWorkEnabled}function eg(s){return s.text}function tg(){return St.getState().stopRename()}function sg(){return null}const nl="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",ui=()=>{const s=St.getState();return s.revealedKey?(s.setRevealed(s.revealedKey,!1),!0):!1},il=s=>{const e=oe.c(18),{label:t,collapsed:i,onToggle:a}=s,{t:r}=ye();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=me(nl,"w-full gap-1"),e[0]=c):c=e[0];let o;e[1]!==a?(o=()=>{ui()||a()},e[1]=a,e[2]=o):o=e[2];const d=!i;let u;e[3]!==i||e[4]!==t||e[5]!==r?(u=i?r("sessions.sidebar.group.expandAria",{label:t}):r("sessions.sidebar.group.collapseAria",{label:t}),e[3]=i,e[4]=t,e[5]=r,e[6]=u):u=e[6];let l;e[7]===Symbol.for("react.memo_cache_sentinel")?(l={touchAction:"manipulation"},e[7]=l):l=e[7];let f;e[8]!==t?(f=n.jsx("span",{className:"min-w-0 truncate typography-ui-label font-medium text-muted-foreground",children:t}),e[8]=t,e[9]=f):f=e[9];const x=i?"arrow-right-s":"arrow-down-s";let h;e[10]!==x?(h=n.jsx(G,{name:x,className:"size-4 shrink-0 text-muted-foreground"}),e[10]=x,e[11]=h):h=e[11];let m;return e[12]!==o||e[13]!==d||e[14]!==u||e[15]!==f||e[16]!==h?(m=n.jsxs("button",{type:"button",className:c,onClick:o,"aria-expanded":d,"aria-label":u,style:l,children:[f,h]}),e[12]=o,e[13]=d,e[14]=u,e[15]=f,e[16]=h,e[17]=m):m=e[17],m},ng=s=>{const e=oe.c(8),{row:t,onToggle:i}=s,{t:a}=ye();let r;e[0]!==t.activityKey||e[1]!==t.label||e[2]!==a?(r=t.label??(uf(t.activityKey)?a(ff[t.activityKey]):""),e[0]=t.activityKey,e[1]=t.label,e[2]=a,e[3]=r):r=e[3];let c;return e[4]!==i||e[5]!==t.collapsed||e[6]!==r?(c=n.jsx(il,{label:r,collapsed:t.collapsed,onToggle:i}),e[4]=i,e[5]=t.collapsed,e[6]=r,e[7]=c):c=e[7],c},ig=s=>{const e=oe.c(7),{row:t,onToggle:i}=s,{t:a}=ye();let r;e[0]!==t.label||e[1]!==a?(r=t.label??a("sessions.sidebar.activity.projectsTitle"),e[0]=t.label,e[1]=a,e[2]=r):r=e[2];let c;return e[3]!==i||e[4]!==t.collapsed||e[5]!==r?(c=n.jsx(il,{label:r,collapsed:t.collapsed,onToggle:i}),e[3]=i,e[4]=t.collapsed,e[5]=r,e[6]=c):c=e[6],c},xo=s=>{const e=oe.c(10),{icon:t,label:i,onClick:a}=s;let r;e[0]!==a?(r=l=>{l.stopPropagation(),a()},e[0]=a,e[1]=r):r=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c={touchAction:"manipulation"},e[2]=c):c=e[2];const o=t==="add"?"size-4":"size-3.5";let d;e[3]!==t||e[4]!==o?(d=n.jsx(G,{name:t,className:o}),e[3]=t,e[4]=o,e[5]=d):d=e[5];let u;return e[6]!==i||e[7]!==r||e[8]!==d?(u=n.jsx("button",{type:"button",className:"flex size-9 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":i,title:i,onClick:r,style:c,children:d}),e[6]=i,e[7]=r,e[8]=d,e[9]=u):u=e[9],u},rg=s=>{const e=oe.c(70),{row:t,label:i,isRepo:a,active:r,onToggle:c,onNewSession:o,onRemove:d}=s,{t:u}=ye(),l=yn(),f=t.section.project,{revealed:x,armed:h}=On(t.key);let m;e[0]!==t.key?(m=F=>St.getState().setRevealed(t.key,F),e[0]=t.key,e[1]=m):m=e[1];const g=m;let b;e[2]!==h||e[3]!==i||e[4]!==u?(b=h?u("mobile.sessions.confirmRemoveProjectAria",{label:i}):u("mobile.sessions.removeProjectAria",{label:i}),e[2]=h,e[3]=i,e[4]=u,e[5]=b):b=e[5];let v;e[6]!==h||e[7]!==i||e[8]!==d||e[9]!==t.key||e[10]!==g||e[11]!==u?(v=()=>{if(!h){St.getState().arm(t.key);return}g(!1),d(),pe.success(u("mobile.sessions.toast.projectRemoved",{label:i}))},e[6]=h,e[7]=i,e[8]=d,e[9]=t.key,e[10]=g,e[11]=u,e[12]=v):v=e[12];let w;e[13]!==h||e[14]!==x||e[15]!==b||e[16]!==v?(w=n.jsx(ds,{icon:"delete-bin",tone:"destructive",armed:h,label:b,revealed:x,onClick:v}),e[13]=h,e[14]=x,e[15]=b,e[16]=v,e[17]=w):w=e[17];let k;e[18]!==i||e[19]!==u?(k=u("mobile.sessions.editProjectAria",{label:i}),e[18]=i,e[19]=u,e[20]=k):k=e[20];let E;e[21]!==l||e[22]!==f.id||e[23]!==g?(E=()=>{g(!1),l.openProjectEdit(f.id)},e[21]=l,e[22]=f.id,e[23]=g,e[24]=E):E=e[24];let _;e[25]!==x||e[26]!==k||e[27]!==E?(_=n.jsx(ds,{icon:"edit",label:k,revealed:x,onClick:E}),e[25]=x,e[26]=k,e[27]=E,e[28]=_):_=e[28];let A;e[29]!==w||e[30]!==_?(A=n.jsxs(n.Fragment,{children:[w,_]}),e[29]=w,e[30]=_,e[31]=A):A=e[31];const S=r||void 0;let C;e[32]!==c?(C=()=>{ui()||c()},e[32]=c,e[33]=C):C=e[33];const j=!t.collapsed;let T;e[34]!==i||e[35]!==t.collapsed||e[36]!==u?(T=t.collapsed?u("sessions.sidebar.group.expandAria",{label:i}):u("sessions.sidebar.group.collapseAria",{label:i}),e[34]=i,e[35]=t.collapsed,e[36]=u,e[37]=T):T=e[37];let R;e[38]===Symbol.for("react.memo_cache_sentinel")?(R={touchAction:"manipulation"},e[38]=R):R=e[38];let K;e[39]!==f?(K=n.jsx(xn,{project:f,size:"xs"}),e[39]=f,e[40]=K):K=e[40];let P;e[41]!==i?(P=n.jsx("span",{className:"block min-w-0 flex-1 truncate ps-1 typography-ui-label font-medium text-foreground",children:i}),e[41]=i,e[42]=P):P=e[42];let z;e[43]!==C||e[44]!==j||e[45]!==T||e[46]!==K||e[47]!==P?(z=n.jsxs("button",{type:"button",className:nl,onClick:C,"aria-expanded":j,"aria-label":T,style:R,children:[K,P]}),e[43]=C,e[44]=j,e[45]=T,e[46]=K,e[47]=P,e[48]=z):z=e[48];let O;e[49]!==l||e[50]!==a||e[51]!==f.id||e[52]!==u?(O=a?n.jsx(xo,{icon:"git-branch",label:u("sessions.sidebar.project.actions.newWorktree"),onClick:()=>l.openNewWorktree(f.id)}):null,e[49]=l,e[50]=a,e[51]=f.id,e[52]=u,e[53]=O):O=e[53];let D;e[54]!==i||e[55]!==u?(D=u("mobile.sessions.newSessionInProjectAria",{label:i}),e[54]=i,e[55]=u,e[56]=D):D=e[56];let M;e[57]!==o||e[58]!==D?(M=n.jsx(xo,{icon:"add",label:D,onClick:o}),e[57]=o,e[58]=D,e[59]=M):M=e[59];let L;e[60]!==z||e[61]!==O||e[62]!==M||e[63]!==S?(L=n.jsxs("div",{"data-active-project":S,className:"flex min-h-10 w-full items-center",children:[z,O,M]}),e[60]=z,e[61]=O,e[62]=M,e[63]=S,e[64]=L):L=e[64];let W;return e[65]!==x||e[66]!==g||e[67]!==L||e[68]!==A?(W=n.jsx(Mn,{actionsWidth:2*Js,revealed:x,onRevealedChange:g,actions:A,children:L}),e[65]=x,e[66]=g,e[67]=L,e[68]=A,e[69]=W):W=e[69],W},og=s=>{const e=oe.c(27),{row:t,geometry:i,onToggle:a}=s,{t:r}=ye(),c=t.group.label,o=!t.collapsed;let d;e[0]!==a||e[1]!==t.empty||e[2]!==t.groupKey?(d=()=>{!ui()&&!t.empty&&a(t.groupKey)},e[0]=a,e[1]=t.empty,e[2]=t.groupKey,e[3]=d):d=e[3];const u=t.empty?void 0:o;let l;e[4]!==o||e[5]!==c||e[6]!==t.empty||e[7]!==r?(l=t.empty?c:o?r("sessions.sidebar.group.collapseAria",{label:c}):r("sessions.sidebar.group.expandAria",{label:c}),e[4]=o,e[5]=c,e[6]=t.empty,e[7]=r,e[8]=l):l=e[8];let f;e[9]!==i||e[10]!==t.depth?(f=i.slotLeft(t.depth),e[9]=i,e[10]=t.depth,e[11]=f):f=e[11];let x;e[12]!==f?(x={paddingInlineStart:f,touchAction:"manipulation"},e[12]=f,e[13]=x):x=e[13];let h;e[14]!==o||e[15]!==t.empty?(h=t.empty?n.jsx("span",{"aria-hidden":!0,className:"size-3.5 shrink-0"}):n.jsx(Zi,{expanded:o}),e[14]=o,e[15]=t.empty,e[16]=h):h=e[16];let m;e[17]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(G,{name:"folder",className:"mx-px size-3 shrink-0 text-muted-foreground"}),e[17]=m):m=e[17];let g;e[18]!==c?(g=n.jsx("span",{className:"block min-w-0 flex-1 truncate typography-ui-label font-medium oc-group-label",children:c}),e[18]=c,e[19]=g):g=e[19];let b;return e[20]!==d||e[21]!==u||e[22]!==l||e[23]!==x||e[24]!==h||e[25]!==g?(b=n.jsxs("button",{type:"button",className:"flex min-h-10 w-full items-center gap-0.5 py-1 pe-3 text-start focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",onClick:d,"aria-expanded":u,"aria-label":l,style:x,children:[h,m,g]}),e[20]=d,e[21]=u,e[22]=l,e[23]=x,e[24]=h,e[25]=g,e[26]=b):b=e[26],b},ag=s=>{const e=oe.c(34),{row:t,geometry:i}=s,{t:a}=ye(),r=!t.collapsed;let c;e[0]!==t.mixed||e[1]!==t.projectId?(c=k=>t.mixed?k.projects.find(E=>E.id===t.projectId):void 0,e[0]=t.mixed,e[1]=t.projectId,e[2]=c):c=e[2];const o=Yt(c);let d;e[3]!==t.empty||e[4]!==t.folder?(d=()=>{!ui()&&!t.empty&&Jc.getState().toggleFolderCollapse(t.folder.id)},e[3]=t.empty,e[4]=t.folder,e[5]=d):d=e[5];const u=t.empty?void 0:r;let l;e[6]!==r||e[7]!==t.displayName||e[8]!==t.empty||e[9]!==a?(l=t.empty?t.displayName:r?a("sessions.sidebar.folderItem.collapseAria",{folderName:t.displayName}):a("sessions.sidebar.folderItem.expandAria",{folderName:t.displayName}),e[6]=r,e[7]=t.displayName,e[8]=t.empty,e[9]=a,e[10]=l):l=e[10];let f;e[11]!==i||e[12]!==t.depth?(f=i.slotLeft(t.depth),e[11]=i,e[12]=t.depth,e[13]=f):f=e[13];let x;e[14]!==f?(x={paddingInlineStart:f,touchAction:"manipulation"},e[14]=f,e[15]=x):x=e[15];let h;e[16]!==r||e[17]!==t.empty?(h=t.empty?n.jsx("span",{"aria-hidden":!0,className:"size-3.5 shrink-0"}):n.jsx(Zi,{expanded:r}),e[16]=r,e[17]=t.empty,e[18]=h):h=e[18];const m=r&&!t.empty?"folder-open":"folder";let g;e[19]!==m?(g=n.jsx(G,{name:m,className:"mx-px size-3 shrink-0 text-muted-foreground"}),e[19]=m,e[20]=g):g=e[20];let b;e[21]!==t.displayName?(b=n.jsx("span",{className:"block min-w-0 flex-1 truncate typography-ui-label font-medium oc-group-label",children:t.displayName}),e[21]=t.displayName,e[22]=b):b=e[22];let v;e[23]!==o?(v=o?n.jsx("span",{className:"min-w-0 shrink-[2] truncate typography-micro text-muted-foreground",children:qc(o.label?.trim()||o.path)}):null,e[23]=o,e[24]=v):v=e[24];let w;return e[25]!==b||e[26]!==v||e[27]!==d||e[28]!==u||e[29]!==l||e[30]!==x||e[31]!==h||e[32]!==g?(w=n.jsxs("button",{type:"button",className:"flex min-h-10 w-full items-center gap-0.5 py-1 pe-3 text-start focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",onClick:d,"aria-expanded":u,"aria-label":l,style:x,children:[h,g,b,v]}),e[25]=b,e[26]=v,e[27]=d,e[28]=u,e[29]=l,e[30]=x,e[31]=h,e[32]=g,e[33]=w):w=e[33],w},lg=s=>{const e=oe.c(23),{row:t,indent:i,onRetry:a,onGrantAccess:r}=s,{t:c}=ye();let o;e[0]!==t.status.state||e[1]!==c?(o=t.status.state==="permission-denied"?c("sessions.sidebar.group.empty.permissionDenied"):t.status.state==="load-failed"?c("sessions.sidebar.group.empty.loadFailed"):t.status.state==="initialization-failed"?c("sessions.sidebar.group.empty.initializationFailed"):c("sessions.sidebar.group.empty.loadingSessions"),e[0]=t.status.state,e[1]=c,e[2]=o):o=e[2];const d=o;let u;e[3]!==i?(u={paddingInlineStart:i},e[3]=i,e[4]=u):u=e[4];let l;e[5]!==t.status.state?(l=t.status.state==="loading"?n.jsx(ua,{className:"size-3"}):null,e[5]=t.status.state,e[6]=l):l=e[6];let f;e[7]!==d?(f=n.jsx("span",{children:d}),e[7]=d,e[8]=f):f=e[8];let x;e[9]!==r||e[10]!==t.status.canGrantAccess||e[11]!==c?(x=t.status.canGrantAccess?n.jsx($e,{variant:"link",size:"xs",className:"h-auto p-0 typography-micro",onClick:r,children:c("sessions.sidebar.group.empty.grantAccess")}):null,e[9]=r,e[10]=t.status.canGrantAccess,e[11]=c,e[12]=x):x=e[12];let h;e[13]!==a||e[14]!==t.status.state||e[15]!==c?(h=t.status.state!=="loading"?n.jsx($e,{variant:"link",size:"xs",className:"h-auto p-0 typography-micro",onClick:a,children:c("sessions.sidebar.group.empty.retry")}):null,e[13]=a,e[14]=t.status.state,e[15]=c,e[16]=h):h=e[16];let m;return e[17]!==u||e[18]!==l||e[19]!==f||e[20]!==x||e[21]!==h?(m=n.jsxs("div",{className:"flex min-h-9 flex-wrap items-center gap-2 py-1 pe-3 typography-micro text-muted-foreground",style:u,children:[l,f,x,h]}),e[17]=u,e[18]=l,e[19]=f,e[20]=x,e[21]=h,e[22]=m):m=e[22],m},cg=4,yo=s=>{const e=oe.c(4),{providerIDs:t}=s;let i;e[0]!==t?(i=t.slice(0,cg).map(dg),e[0]=t,e[1]=i):i=e[1];let a;return e[2]!==i?(a=n.jsx("span",{className:"inline-flex shrink-0 items-center -space-x-1",children:i}),e[2]=i,e[3]=a):a=e[3],a};function dg(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(Xc,{providerId:s,className:"size-3 opacity-80"})},s)}const gr="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",br=(s,e)=>{const t=oe.c(3);let i;return t[0]!==s||t[1]!==e?(i=a=>e&&s?a.projects.find(r=>r.id===s)??null:null,t[0]=s,t[1]=e,t[2]=i):i=t[2],Yt(i)},xr=s=>{const e=oe.c(5),{slotLeft:t,children:i}=s;let a;e[0]!==t?(a={insetInlineStart:t},e[0]=t,e[1]=a):a=e[1];let r;return e[2]!==i||e[3]!==a?(r=n.jsx("span",{className:"pointer-events-none absolute inset-y-0 z-10 flex w-3.5 items-center justify-center",style:a,children:i}),e[2]=i,e[3]=a,e[4]=r):r=e[4],r},ug=s=>{const e=oe.c(232),{row:t,geometry:i,onToggle:a}=s,{t:r}=ye(),c=yn(),{revealed:o,renaming:d}=On(t.key);let u;e[0]!==c.close||e[1]!==t.collapsed||e[2]!==t.group||e[3]!==t.projectId?(u={group:t.group,projectId:t.projectId,collapsed:t.collapsed,onNavigate:c.close},e[0]=c.close,e[1]=t.collapsed,e[2]=t.group,e[3]=t.projectId,e[4]=u):u=e[4];const l=hf(u),{worktree:f,space:x,spaceName:h,project:m,refs:g,label:b,secondName:v,branch:w,title:k,inWork:E,selected:_,finishing:A,worktreeRemoving:S,activityState:C}=l,j=!!x,T=m?.id??t.projectId??null;let R;e[5]!==w||e[6]!==j||e[7]!==T||e[8]!==l.directory?(R={space:j,projectId:T,directory:l.directory,branch:w},e[5]=w,e[6]=j,e[7]=T,e[8]=l.directory,e[9]=R):R=e[9];const K=gf(R);let P;e[10]!==l?(P=()=>l.open(),e[10]=l,e[11]=P):P=e[11];let z;e[12]!==K||e[13]!==P?(z=n.jsx(el,{marks:K,onOpenRow:P}),e[12]=K,e[13]=P,e[14]=z):z=e[14];const O=z,D=ii(),M=br(t.projectId,t.mixed&&t.detailed),L=!t.empty,W=!t.collapsed;let F;e[15]!==L||e[16]!==a||e[17]!==t.groupKey?(F=L?()=>a(t.groupKey):void 0,e[15]=L,e[16]=a,e[17]=t.groupKey,e[18]=F):F=e[18];const N=F;let I;e[19]!==t.key?(I=Se=>St.getState().setRevealed(t.key,Se),e[19]=t.key,e[20]=I):I=e[20];const B=I;let Q;e[21]!==B?(Q=Se=>()=>{B(!1),Se()},e[21]=B,e[22]=Q):Q=e[22];const J=Q;let X;e[23]!==o||e[24]!==B||e[25]!==l?(X=()=>{if(o){B(!1);return}l.open()},e[23]=o,e[24]=B,e[25]=l,e[26]=X):X=e[26];const q=X,Z=pg;let H;e[27]!==C||e[28]!==A||e[29]!==S?(H=S||A?n.jsx(ua,{className:"size-3"}):C?n.jsx(Sa,{state:C}):null,e[27]=C,e[28]=A,e[29]=S,e[30]=H):H=e[30];const V=H;let se;e[31]!==g.prColor||e[32]!==x||e[33]!==r?(se=x?n.jsx(G,{name:"instance",className:"size-3.5 shrink-0 text-muted-foreground","aria-hidden":!1,role:"img","aria-label":r("sessions.sidebar.group.space")}):n.jsx(G,{name:"git-branch",className:me("size-3.5 shrink-0",g.prColor?"oc-ref-tint":"text-muted-foreground"),style:g.prColor?Di(g.prColor):void 0,"aria-hidden":!1,role:"img","aria-label":r("sessions.sidebar.work.worktreeMark")}),e[31]=g.prColor,e[32]=x,e[33]=r,e[34]=se):se=e[34];const te=se;let re;e[35]!==l.durationSessionId||e[36]!==l.runningSessionId?(re=l.durationSessionId?n.jsx(Xi,{sessionId:l.durationSessionId,running:!!l.runningSessionId,className:"shrink-0 typography-micro"}):null,e[35]=l.durationSessionId,e[36]=l.runningSessionId,e[37]=re):re=e[37];const ne=re;let ue;if(e[38]!==g.prColor||e[39]!==g.prReference||e[40]!==g.prSummary||e[41]!==g.primaryIssue||e[42]!==t.detailed){const Se=g.prSummary?{icon:"git-pull-request",color:g.prColor,text:g.prReference}:g.primaryIssue?{icon:g.primaryIssue.icon,color:g.primaryIssue.color,text:g.primaryIssue.label}:null;ue=Se?n.jsxs("span",{className:"inline-flex shrink-0 items-center gap-0.5 typography-micro text-muted-foreground",children:[n.jsx(G,{name:Se.icon,className:me("size-3",Se.color&&"oc-ref-tint"),style:Se.color?Di(Se.color):void 0}),t.detailed&&Se.text?n.jsx("span",{className:"leading-none tabular-nums",children:Se.text}):null]}):null,e[38]=g.prColor,e[39]=g.prReference,e[40]=g.prSummary,e[41]=g.primaryIssue,e[42]=t.detailed,e[43]=ue}else ue=e[43];const Y=ue,ie=_?pr:C==="unread"||C==="permission"||C==="form"?"font-semibold text-foreground":C==="active"?"text-foreground":"oc-title-rest";let ae;e[44]!==ie?(ae=me("block min-w-0 flex-1 truncate oc-ui-start-align typography-ui-label",ie),e[44]=ie,e[45]=ae):ae=e[45];let Pe;e[46]!==b||e[47]!==ae?(Pe=n.jsx("span",{dir:"auto",className:ae,children:b}),e[46]=b,e[47]=ae,e[48]=Pe):Pe=e[48];const Be=Pe;let xe;e[49]!==w||e[50]!==h||e[51]!==r||e[52]!==k||e[53]!==l?(xe=(Se,it)=>n.jsx(fr,{initialTitle:k??"",indent:Se,className:it,placeholder:w??h??r("sessions.sidebar.work.rename.placeholder"),onSubmit:Qe=>{Z(),l.saveTitle(Qe)},onCancel:Z}),e[49]=w,e[50]=h,e[51]=r,e[52]=k,e[53]=l,e[54]=xe):xe=e[54];const Re=xe;let le;e[55]!==x||e[56]!==r||e[57]!==f?.worktreeStatus?(le=f?.worktreeStatus==="missing"?n.jsx("span",{className:"inline-flex shrink-0 items-center text-status-warning",role:"img","aria-label":r("sessions.sidebar.group.worktreeMissing"),children:n.jsx(G,{name:"alert",className:"size-3"})}):x?n.jsx(Zc,{spaceId:x.id}):null,e[55]=x,e[56]=r,e[57]=f?.worktreeStatus,e[58]=le):le=e[58];const ce=le;let Ie;e[59]!==t.group.directory?(Ie=t.group.directory?n.jsx(bf,{directory:t.group.directory}):null,e[59]=t.group.directory,e[60]=Ie):Ie=e[60];const Ne=Ie;let je;e[61]!==t.key||e[62]!==r||e[63]!==l.pinned?(je=l.pinned&&!ka(t.key)?n.jsx(G,{name:"pushpin",className:"size-3 shrink-0 text-muted-foreground","aria-label":r("sessions.sidebar.session.status.pinned")}):null,e[61]=t.key,e[62]=r,e[63]=l.pinned,e[64]=je):je=e[64];const De=je;let We;if(t.detailed){let Se;e[65]!==i||e[66]!==t.depth?(Se=i.detailedLeft(t.depth),e[65]=i,e[66]=t.depth,e[67]=Se):Se=e[67];const it=d?void 0:q;let Qe;e[68]!==b||e[69]!==r?(Qe=r("sessions.sidebar.work.openAria",{label:b}),e[68]=b,e[69]=r,e[70]=Qe):Qe=e[70];let gt;e[71]!==W||e[72]!==b||e[73]!==N?(gt=N?n.jsx(pn,{expanded:W,kind:"work",label:b,onToggle:N}):null,e[71]=W,e[72]=b,e[73]=N,e[74]=gt):gt=e[74];let bt;e[75]!==Ne||e[76]!==ne||e[77]!==ce||e[78]!==De||e[79]!==Re||e[80]!==d||e[81]!==V||e[82]!==Be?(bt=d?Re(0,"h-[1lh] pe-0 typography-ui-label [&_button]:size-6 [&_button>svg]:size-3.5"):n.jsxs(n.Fragment,{children:[Be,ce,De,Ne,V,ne]}),e[75]=Ne,e[76]=ne,e[77]=ce,e[78]=De,e[79]=Re,e[80]=d,e[81]=V,e[82]=Be,e[83]=bt):bt=e[83];let ot;e[84]!==M?(ot=M?n.jsx(xn,{project:M,size:"xs"}):null,e[84]=M,e[85]=ot):ot=e[85];let _e;e[86]!==M||e[87]!==D?(_e=M&&D?n.jsx(ri,{project:M,separated:!1}):null,e[86]=M,e[87]=D,e[88]=_e):_e=e[88];let mt;e[89]!==M||e[90]!==D||e[91]!==v||e[92]!==k?(mt=v&&!(M&&D&&v===k)?n.jsx("span",{dir:"auto",className:"block min-w-0 truncate typography-micro",children:v}):null,e[89]=M,e[90]=D,e[91]=v,e[92]=k,e[93]=mt):mt=e[93];let xt;e[94]!==O||e[95]!==Y?(xt=n.jsxs("span",{className:"ms-auto flex shrink-0 items-center gap-1.5",children:[Y,O]}),e[94]=O,e[95]=Y,e[96]=xt):xt=e[96];let ze;e[97]!==te||e[98]!==ot||e[99]!==_e||e[100]!==mt||e[101]!==xt?(ze=n.jsxs(n.Fragment,{children:[ot,_e,te,mt,xt]}),e[97]=te,e[98]=ot,e[99]=_e,e[100]=mt,e[101]=xt,e[102]=ze):ze=e[102];let at;e[103]!==Se||e[104]!==it||e[105]!==Qe||e[106]!==gt||e[107]!==bt||e[108]!==ze?(at=n.jsx(di,{indent:Se,onSelect:it,ariaLabel:Qe,chevron:gt,firstLine:bt,secondLine:ze}),e[103]=Se,e[104]=it,e[105]=Qe,e[106]=gt,e[107]=bt,e[108]=ze,e[109]=at):at=e[109],We=at}else{let Se;e[110]!==te||e[111]!==W||e[112]!==i||e[113]!==b||e[114]!==t.depth||e[115]!==N?(Se=N?n.jsx(hr,{slotLeft:i.slotLeft(t.depth),children:n.jsx(pn,{expanded:W,kind:"work",label:b,onToggle:N})}):n.jsx(xr,{slotLeft:i.slotLeft(t.depth),children:te}),e[110]=te,e[111]=W,e[112]=i,e[113]=b,e[114]=t.depth,e[115]=N,e[116]=Se):Se=e[116];let it;e[117]!==Ne||e[118]!==ne||e[119]!==i||e[120]!==b||e[121]!==O||e[122]!==ce||e[123]!==De||e[124]!==Y||e[125]!==Re||e[126]!==d||e[127]!==t.depth||e[128]!==q||e[129]!==V||e[130]!==r||e[131]!==Be?(it=d?Re(i.textLeft(t.depth)):n.jsxs("button",{type:"button",className:gr,style:{paddingInlineStart:i.textLeft(t.depth),touchAction:"manipulation"},"aria-label":r("sessions.sidebar.work.openAria",{label:b}),onClick:q,children:[Be,ce,De,Y,O,Ne,V,ne]}),e[117]=Ne,e[118]=ne,e[119]=i,e[120]=b,e[121]=O,e[122]=ce,e[123]=De,e[124]=Y,e[125]=Re,e[126]=d,e[127]=t.depth,e[128]=q,e[129]=V,e[130]=r,e[131]=Be,e[132]=it):it=e[132];let Qe;e[133]!==Se||e[134]!==it?(Qe=n.jsxs(n.Fragment,{children:[Se,it]}),e[133]=Se,e[134]=it,e[135]=Qe):Qe=e[135],We=Qe}const ct=(l.workAction?1:0)+(l.canRename?1:0)+(x?1:0)+(l.canPin?1:0)+(l.canArchive?1:0)+(f&&!S?1:0);let Ue;e[136]!==l?(Ue=()=>ja({current:l.pinList,pin:Se=>{l.setPin(!0,Se)},unpin:()=>{l.setPin(!1)}}),e[136]=l,e[137]=Ue):Ue=e[137];const Me=Ue;let He;e[138]!==r||e[139]!==l.canMarkUnread||e[140]!==l.hasUnread||e[141]!==l.toggleRead?(He=l.canMarkUnread?n.jsxs(cs,{onClick:l.toggleRead,children:[n.jsx(G,{name:l.hasUnread?"chat-check":"checkbox-circle",className:"me-1 size-4"}),l.hasUnread?r("sessions.sidebar.session.menu.markRead"):r("sessions.sidebar.session.menu.markUnread")]}):null,e[138]=r,e[139]=l.canMarkUnread,e[140]=l.hasUnread,e[141]=l.toggleRead,e[142]=He):He=e[142];let Oe;e[143]!==A||e[144]!==E||e[145]!==r||e[146]!==l.toggleWork||e[147]!==l.workAction||e[148]!==S?(Oe=l.workAction?n.jsxs(cs,{disabled:A||S,onClick:l.toggleWork,children:[n.jsx(G,{name:E?"check":"eye",className:"me-1 size-4"}),r(E?"sessions.sidebar.session.work.markDone":"sessions.sidebar.session.work.track")]}):null,e[143]=A,e[144]=E,e[145]=r,e[146]=l.toggleWork,e[147]=l.workAction,e[148]=S,e[149]=Oe):Oe=e[149];let rt;e[150]!==t.key||e[151]!==r||e[152]!==l.canRename?(rt=l.canRename?n.jsxs(cs,{onClick:()=>St.getState().startRename(t.key),children:[n.jsx(G,{name:"edit",className:"me-1 size-4"}),r("sessions.sidebar.work.menu.rename")]}):null,e[150]=t.key,e[151]=r,e[152]=l.canRename,e[153]=rt):rt=e[153];let nt;e[154]!==Me||e[155]!==r||e[156]!==l.canPin||e[157]!==l.pinned?(nt=l.canPin?n.jsxs(cs,{onClick:Me,children:[n.jsx(G,{name:l.pinned?"unpin":"pushpin",className:"me-1 size-4"}),l.pinned?r("sessions.sidebar.work.menu.unpin"):r("sessions.sidebar.work.menu.pin")]}):null,e[154]=Me,e[155]=r,e[156]=l.canPin,e[157]=l.pinned,e[158]=nt):nt=e[158];let st;e[159]!==A||e[160]!==r||e[161]!==l?(st=l.canArchive?n.jsxs(cs,{disabled:A,onClick:()=>{l.finish(!0)},children:[n.jsx(G,{name:"archive",className:"me-1 size-4"}),r("sessions.sidebar.work.menu.archive")]}):null,e[159]=A,e[160]=r,e[161]=l,e[162]=st):st=e[162];let ee;e[163]!==He||e[164]!==Oe||e[165]!==rt||e[166]!==nt||e[167]!==st?(ee=n.jsxs(n.Fragment,{children:[He,Oe,rt,nt,st]}),e[163]=He,e[164]=Oe,e[165]=rt,e[166]=nt,e[167]=st,e[168]=ee):ee=e[168];const be=ee,Ze=o||d||S,U=ct*Js,Ce=_&&ci,qe=S&&"opacity-60";let he;e[169]!==Ce||e[170]!==qe?(he=me("relative flex w-full items-center bg-background transition-colors",Ce,qe),e[169]=Ce,e[170]=qe,e[171]=he):he=e[171];let ut;e[172]!==J||e[173]!==A||e[174]!==E||e[175]!==o||e[176]!==r||e[177]!==l.toggleWork||e[178]!==l.workAction||e[179]!==S?(ut=l.workAction?n.jsx(ds,{icon:E?"check":"eye",tone:E?"success":"default",label:r(E?"sessions.sidebar.session.work.markDone":"sessions.sidebar.session.work.track"),revealed:o,disabled:A||S,onClick:J(l.toggleWork)}):null,e[172]=J,e[173]=A,e[174]=E,e[175]=o,e[176]=r,e[177]=l.toggleWork,e[178]=l.workAction,e[179]=S,e[180]=ut):ut=e[180];let lt;e[181]!==o||e[182]!==t.key||e[183]!==r||e[184]!==l.canRename?(lt=l.canRename?n.jsx(ds,{icon:"edit",label:r("sessions.sidebar.work.menu.rename"),revealed:o,onClick:()=>St.getState().startRename(t.key)}):null,e[181]=o,e[182]=t.key,e[183]=r,e[184]=l.canRename,e[185]=lt):lt=e[185];let Ct;e[186]!==J||e[187]!==b||e[188]!==o||e[189]!==x||e[190]!==r?(Ct=x?n.jsx(ds,{icon:"more",label:r("spaces.actions.menuAria",{label:b}),revealed:o,onClick:J(()=>Al.getState().openActionsSheet(x.id))}):null,e[186]=J,e[187]=b,e[188]=o,e[189]=x,e[190]=r,e[191]=Ct):Ct=e[191];let ft;e[192]!==J||e[193]!==Me||e[194]!==o||e[195]!==r||e[196]!==l.canPin||e[197]!==l.pinned?(ft=l.canPin?n.jsx(ds,{icon:l.pinned?"unpin":"pushpin",label:l.pinned?r("sessions.sidebar.work.menu.unpin"):r("sessions.sidebar.work.menu.pin"),revealed:o,onClick:J(Me)}):null,e[192]=J,e[193]=Me,e[194]=o,e[195]=r,e[196]=l.canPin,e[197]=l.pinned,e[198]=ft):ft=e[198];let Je;e[199]!==J||e[200]!==A||e[201]!==o||e[202]!==r||e[203]!==l?(Je=l.canArchive?n.jsx(ds,{icon:"archive",label:r("sessions.sidebar.work.menu.archive"),revealed:o,disabled:A,onClick:J(()=>{l.finish(!0)})}):null,e[199]=J,e[200]=A,e[201]=o,e[202]=r,e[203]=l,e[204]=Je):Je=e[204];let et;e[205]!==c||e[206]!==J||e[207]!==m||e[208]!==o||e[209]!==r||e[210]!==f||e[211]!==S?(et=f&&!S?n.jsx(ds,{icon:"delete-bin",tone:"destructive",label:r("sessions.sidebar.group.actions.deleteWorktree"),revealed:o,onClick:J(()=>{m&&c.requestWorktreeDelete({id:m.id,path:m.path},f)})}):null,e[205]=c,e[206]=J,e[207]=m,e[208]=o,e[209]=r,e[210]=f,e[211]=S,e[212]=et):et=e[212];let dt;e[213]!==ut||e[214]!==lt||e[215]!==Ct||e[216]!==ft||e[217]!==Je||e[218]!==et?(dt=n.jsxs(n.Fragment,{children:[ut,lt,Ct,ft,Je,et]}),e[213]=ut,e[214]=lt,e[215]=Ct,e[216]=ft,e[217]=Je,e[218]=et,e[219]=dt):dt=e[219];let Xe;e[220]!==We||e[221]!==o||e[222]!==_||e[223]!==B||e[224]!==U||e[225]!==he||e[226]!==dt?(Xe=n.jsx(Mn,{actionsWidth:U,revealed:o,onRevealedChange:B,dataActiveSession:_,contentClassName:he,actions:dt,children:We}),e[220]=We,e[221]=o,e[222]=_,e[223]=B,e[224]=U,e[225]=he,e[226]=dt,e[227]=Xe):Xe=e[227];let ht;return e[228]!==be||e[229]!==Ze||e[230]!==Xe?(ht=n.jsx(mr,{disabled:Ze,menu:be,children:Xe}),e[228]=be,e[229]=Ze,e[230]=Xe,e[231]=ht):ht=e[231],ht},fg=s=>{const e=oe.c(136),{row:t,geometry:i,toggleParent:a}=s,{t:r}=ye(),c=yn(),{run:o}=t,{revealed:d,renaming:u}=On(t.key),l=mf(o,t.laneNodes,c.close);let f;e[0]!==t.laneNodes?(f=[...t.laneNodes],e[0]=t.laneNodes,e[1]=f):f=e[1];const x=f;let h;e[2]!==x||e[3]!==t.blockingSessionIds?(h={nodes:x,blockingSessionIds:t.blockingSessionIds},e[2]=x,e[3]=t.blockingSessionIds,e[4]=h):h=e[4];const m=pf(h);let g;e[5]!==m?(g=m?n.jsx(Sa,{state:m}):null,e[5]=m,e[6]=g):g=e[6];const b=g,v=ii(),w=br(t.projectId,t.detailed&&t.renderContext==="timeline-mixed"),k=t.expanded;let E;e[7]!==t.expansionKey||e[8]!==t.laneNodes.length||e[9]!==a?(E=t.laneNodes.length>0?()=>a(t.expansionKey):void 0,e[7]=t.expansionKey,e[8]=t.laneNodes.length,e[9]=a,e[10]=E):E=e[10];const _=E,A=o.lanes.length;let S;e[11]!==t.key?(S=ce=>St.getState().setRevealed(t.key,ce),e[11]=t.key,e[12]=S):S=e[12];const C=S;let j;e[13]!==C?(j=ce=>()=>{C(!1),ce()},e[13]=C,e[14]=j):j=e[14];const T=j;let R;e[15]!==d||e[16]!==C||e[17]!==l?(R=()=>{if(d){C(!1);return}l.open()},e[15]=d,e[16]=C,e[17]=l,e[18]=R):R=e[18];const K=R,P=hg;let z;e[19]===Symbol.for("react.memo_cache_sentinel")?(z=n.jsx(Mr,{className:"size-3.5 shrink-0 text-muted-foreground","aria-hidden":"true"}),e[19]=z):z=e[19];const O=z,D=l.isActive?pr:"oc-title-rest";let M;e[20]!==D?(M=me("block min-w-0 flex-1 truncate oc-ui-start-align typography-ui-label",D),e[20]=D,e[21]=M):M=e[21];let L;e[22]!==o.title||e[23]!==M?(L=n.jsx("span",{dir:"auto",className:M,children:o.title}),e[22]=o.title,e[23]=M,e[24]=L):L=e[24];const W=L;let F;e[25]!==o.title||e[26]!==l?(F=(ce,Ie)=>n.jsx(fr,{initialTitle:o.title,indent:ce,className:Ie,onSubmit:Ne=>{P(),l.rename(Ne)},onCancel:P}),e[25]=o.title,e[26]=l,e[27]=F):F=e[27];const N=F;let I;e[28]!==o.title||e[29]!==r?(I=r("sessions.sidebar.run.openOverviewAria",{title:o.title}),e[28]=o.title,e[29]=r,e[30]=I):I=e[30];const B=I;let Q;if(t.detailed){let ce;e[31]!==i||e[32]!==t.depth?(ce=i.detailedLeft(t.depth),e[31]=i,e[32]=t.depth,e[33]=ce):ce=e[33];const Ie=u?void 0:K;let Ne;e[34]!==k||e[35]!==o.title||e[36]!==_?(Ne=_?n.jsx(pn,{expanded:k,kind:"run",label:o.title,onToggle:_}):null,e[34]=k,e[35]=o.title,e[36]=_,e[37]=Ne):Ne=e[37];let je;e[38]!==b||e[39]!==N||e[40]!==u||e[41]!==W?(je=u?N(0,"h-[1lh] pe-0 typography-ui-label [&_button]:size-6 [&_button>svg]:size-3.5"):n.jsxs(n.Fragment,{children:[W,b]}),e[38]=b,e[39]=N,e[40]=u,e[41]=W,e[42]=je):je=e[42];let De;e[43]!==w?(De=w?n.jsx(xn,{project:w,size:"xs"}):null,e[43]=w,e[44]=De):De=e[44];let We;e[45]!==w||e[46]!==v?(We=w&&v?n.jsx(ri,{project:w,separated:!1}):null,e[45]=w,e[46]=v,e[47]=We):We=e[47];let ct;e[48]!==A||e[49]!==r?(ct=A===1?r("sessions.sidebar.run.laneCountSingle",{count:A}):r("sessions.sidebar.run.laneCountPlural",{count:A}),e[48]=A,e[49]=r,e[50]=ct):ct=e[50];let Ue;e[51]!==ct?(Ue=n.jsx("span",{className:"block min-w-0 flex-auto truncate typography-micro",children:ct}),e[51]=ct,e[52]=Ue):Ue=e[52];let Me;e[53]!==o.providerIDs?(Me=n.jsx(yo,{providerIDs:o.providerIDs}),e[53]=o.providerIDs,e[54]=Me):Me=e[54];let He;e[55]!==De||e[56]!==We||e[57]!==Ue||e[58]!==Me?(He=n.jsxs(n.Fragment,{children:[De,We,O,Ue,Me]}),e[55]=De,e[56]=We,e[57]=Ue,e[58]=Me,e[59]=He):He=e[59];let Oe;e[60]!==B||e[61]!==ce||e[62]!==Ie||e[63]!==Ne||e[64]!==je||e[65]!==He?(Oe=n.jsx(di,{indent:ce,onSelect:Ie,ariaLabel:B,chevron:Ne,firstLine:je,secondLine:He}),e[60]=B,e[61]=ce,e[62]=Ie,e[63]=Ne,e[64]=je,e[65]=He,e[66]=Oe):Oe=e[66],Q=Oe}else{let ce;e[67]!==k||e[68]!==i||e[69]!==t.depth||e[70]!==o.title||e[71]!==_?(ce=_?n.jsx(hr,{slotLeft:i.slotLeft(t.depth),children:n.jsx(pn,{expanded:k,kind:"run",label:o.title,onToggle:_})}):n.jsx(xr,{slotLeft:i.slotLeft(t.depth),children:O}),e[67]=k,e[68]=i,e[69]=t.depth,e[70]=o.title,e[71]=_,e[72]=ce):ce=e[72];let Ie;e[73]!==b||e[74]!==B||e[75]!==i||e[76]!==N||e[77]!==u||e[78]!==t.depth||e[79]!==o.providerIDs||e[80]!==K||e[81]!==W?(Ie=u?N(i.textLeft(t.depth)):n.jsxs("button",{type:"button",className:gr,style:{paddingInlineStart:i.textLeft(t.depth),touchAction:"manipulation"},"aria-label":B,onClick:K,children:[W,n.jsx(yo,{providerIDs:o.providerIDs}),b]}),e[73]=b,e[74]=B,e[75]=i,e[76]=N,e[77]=u,e[78]=t.depth,e[79]=o.providerIDs,e[80]=K,e[81]=W,e[82]=Ie):Ie=e[82];let Ne;e[83]!==ce||e[84]!==Ie?(Ne=n.jsxs(n.Fragment,{children:[ce,Ie]}),e[83]=ce,e[84]=Ie,e[85]=Ne):Ne=e[85],Q=Ne}const J=(l.sessionWorkEnabled?4:3)*Js,X=l.isActive,q=l.isActive&&ci;let Z;e[86]!==q?(Z=me("relative flex w-full items-center bg-background transition-colors",q),e[86]=q,e[87]=Z):Z=e[87];let H;e[88]!==T||e[89]!==d||e[90]!==r||e[91]!==l?(H=l.sessionWorkEnabled?n.jsx(ds,{icon:l.inWork?"check":"eye",tone:l.inWork?"success":"default",label:l.inWork?r("sessions.sidebar.session.work.markDone"):r("sessions.sidebar.session.work.track"),revealed:d,disabled:l.busy,onClick:T(()=>{l.toggleWork()})}):null,e[88]=T,e[89]=d,e[90]=r,e[91]=l,e[92]=H):H=e[92];let V;e[93]===Symbol.for("react.memo_cache_sentinel")?(V=n.jsx(Mr,{className:"size-[18px]","aria-hidden":"true"}),e[93]=V):V=e[93];let se;e[94]!==r?(se=r("sessions.sidebar.run.menu.openOverview"),e[94]=r,e[95]=se):se=e[95];let te;e[96]!==T||e[97]!==l.openOverview?(te=T(l.openOverview),e[96]=T,e[97]=l.openOverview,e[98]=te):te=e[98];let re;e[99]!==d||e[100]!==se||e[101]!==te?(re=n.jsx(ds,{icon:"git-merge",glyph:V,label:se,revealed:d,onClick:te}),e[99]=d,e[100]=se,e[101]=te,e[102]=re):re=e[102];let ne;e[103]!==r?(ne=r("multirun.overview.rename.aria"),e[103]=r,e[104]=ne):ne=e[104];let ue;e[105]!==t.key?(ue=()=>St.getState().startRename(t.key),e[105]=t.key,e[106]=ue):ue=e[106];let Y;e[107]!==d||e[108]!==ne||e[109]!==ue?(Y=n.jsx(ds,{icon:"edit",label:ne,revealed:d,onClick:ue}),e[107]=d,e[108]=ne,e[109]=ue,e[110]=Y):Y=e[110];let ie;e[111]!==r?(ie=r("multirun.overview.archive.action"),e[111]=r,e[112]=ie):ie=e[112];const ae=l.busy;let Pe;e[113]!==l?(Pe=()=>{l.archive()},e[113]=l,e[114]=Pe):Pe=e[114];let Be;e[115]!==T||e[116]!==Pe?(Be=T(Pe),e[115]=T,e[116]=Pe,e[117]=Be):Be=e[117];let xe;e[118]!==d||e[119]!==ie||e[120]!==Be||e[121]!==l.busy?(xe=n.jsx(ds,{icon:"archive",label:ie,revealed:d,disabled:ae,onClick:Be}),e[118]=d,e[119]=ie,e[120]=Be,e[121]=l.busy,e[122]=xe):xe=e[122];let Re;e[123]!==H||e[124]!==re||e[125]!==Y||e[126]!==xe?(Re=n.jsxs(n.Fragment,{children:[H,re,Y,xe]}),e[123]=H,e[124]=re,e[125]=Y,e[126]=xe,e[127]=Re):Re=e[127];let le;return e[128]!==Q||e[129]!==d||e[130]!==C||e[131]!==J||e[132]!==Z||e[133]!==Re||e[134]!==l.isActive?(le=n.jsx(Mn,{actionsWidth:J,revealed:d,onRevealedChange:C,dataActiveSession:X,contentClassName:Z,actions:Re,children:Q}),e[128]=Q,e[129]=d,e[130]=C,e[131]=J,e[132]=Z,e[133]=Re,e[134]=l.isActive,e[135]=le):le=e[135],le},mg=s=>{const e=oe.c(47),{row:t,geometry:i}=s,{t:a}=ye(),r=yn(),{draft:c}=t,{revealed:o}=On(t.key),{isOpen:d,firstLine:u,attachmentCount:l,label:f,open:x,discard:h}=Yc(c,r.close),m=ii(),g=br(c.projectId??null,t.detailed&&t.mixed),b=Qc(t.detailed?c.directory:null);let v;e[0]!==t.key?(v=B=>St.getState().setRevealed(t.key,B),e[0]=t.key,e[1]=v):v=e[1];const w=v;let k;e[2]!==x||e[3]!==o||e[4]!==w?(k=()=>{if(o){w(!1);return}x()},e[2]=x,e[3]=o,e[4]=w,e[5]=k):k=e[5];const E=k;let _;e[6]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx(G,{name:"edit",className:"size-3 shrink-0 text-muted-foreground"}),e[6]=_):_=e[6];const A=_;let S;e[7]!==l||e[8]!==u?(S=u&&l>0?n.jsx(G,{name:"attachment-2",className:"size-3 shrink-0 text-muted-foreground"}):null,e[7]=l,e[8]=u,e[9]=S):S=e[9];const C=S,j=t.detailed&&!!(g||b||C),T=d?pr:"oc-title-rest";let R;e[10]!==T?(R=me("block min-w-0 flex-1 truncate oc-ui-start-align typography-ui-label italic",T),e[10]=T,e[11]=R):R=e[11];let K;e[12]!==f||e[13]!==R?(K=n.jsx("span",{dir:"auto",className:R,children:f}),e[12]=f,e[13]=R,e[14]=K):K=e[14];const P=K;let z;e[15]!==f||e[16]!==a?(z=a("sessions.sidebar.draft.openAria",{label:f}),e[15]=f,e[16]=a,e[17]=z):z=e[17];const O=z,D=d&&ci;let M;e[18]!==D?(M=me("relative flex w-full items-center bg-background transition-colors",D),e[18]=D,e[19]=M):M=e[19];let L;e[20]!==a?(L=a("sessions.sidebar.draft.discard"),e[20]=a,e[21]=L):L=e[21];let W;e[22]!==h||e[23]!==w?(W=()=>{w(!1),h()},e[22]=h,e[23]=w,e[24]=W):W=e[24];let F;e[25]!==o||e[26]!==L||e[27]!==W?(F=n.jsx(ds,{icon:"close",tone:"destructive",label:L,revealed:o,onClick:W}),e[25]=o,e[26]=L,e[27]=W,e[28]=F):F=e[28];let N;e[29]!==O||e[30]!==C||e[31]!==b||e[32]!==j||e[33]!==i||e[34]!==g||e[35]!==m||e[36]!==t.depth||e[37]!==E||e[38]!==P?(N=j?n.jsx(di,{indent:i.detailedLeft(t.depth),onSelect:E,ariaLabel:O,chevron:null,firstLine:P,secondLine:n.jsxs(n.Fragment,{children:[g?n.jsx(xn,{project:g,size:"xs"}):null,g&&m?n.jsx(ri,{project:g,separated:!1}):null,A,b?n.jsx("span",{className:"block min-w-0 truncate typography-micro",children:b}):null,C?n.jsx("span",{className:"ms-auto flex shrink-0 items-center",children:C}):null]})}):n.jsxs(n.Fragment,{children:[n.jsx(xr,{slotLeft:i.slotLeft(t.depth),children:A}),n.jsxs("button",{type:"button",className:gr,style:{paddingInlineStart:i.textLeft(t.depth),touchAction:"manipulation"},"aria-label":O,onClick:E,children:[P,C]})]}),e[29]=O,e[30]=C,e[31]=b,e[32]=j,e[33]=i,e[34]=g,e[35]=m,e[36]=t.depth,e[37]=E,e[38]=P,e[39]=N):N=e[39];let I;return e[40]!==d||e[41]!==o||e[42]!==w||e[43]!==M||e[44]!==F||e[45]!==N?(I=n.jsx(Mn,{actionsWidth:Js,revealed:o,onRevealedChange:w,dataActiveSession:d,contentClassName:M,actions:F,children:N}),e[40]=d,e[41]=o,e[42]=w,e[43]=M,e[44]=F,e[45]=N,e[46]=I):I=e[46],I};function pg(){return St.getState().stopRename()}function hg(){return St.getState().stopRename()}const gg=12,rl=8,Ni=s=>rl+s*gg,bg={base:rl,slotLeft:Ni,textLeft:s=>Ni(s)+20,detailedLeft:s=>Ni(s)+4},vo=12,xg=()=>{},ol=(s,e)=>s.some(t=>t.session.id===e||ol(t.children,e)),yg=(s,e)=>{const{sessionId:t,runKey:i,projectId:a}=e;if(i){const r=s.findIndex(c=>c.kind==="run"&&c.run.key===i);if(r>=0)return r}if(t){const r=s.findIndex(c=>c.kind==="session"&&c.node.session.id===t||c.kind==="run"&&c.run.memberIds.includes(t)||c.kind==="group-header"&&ol(c.group.sessions,t));if(r>=0)return r}return a?s.findIndex(r=>r.kind==="project-header"&&r.section.project.id===a):-1},vg=({model:s,view:e,actions:t})=>{const{t:i}=ye(),a=yn(),r=ed(),c=bg,[o,d]=p.useState(null),u=s.rowModel.rows;p.useEffect(()=>{St.getState().forgetUnlisted(b=>s.rowModel.rowIndexByKey.has(b))},[s.rowModel.rowIndexByKey]);const l=St(b=>b.renamingKey),f=p.useMemo(()=>{const b=l?s.rowModel.rowIndexByKey.get(l):void 0;return new Set(b===void 0?[]:[b])},[s.rowModel.rowIndexByKey,l]),[x,h]=p.useState(null),m=p.useRef(u);m.current=u,p.useEffect(()=>{if(a.openId===0)return;const b=yg(m.current,{sessionId:yt.getState().currentSessionId,runKey:Ge.getState().runOverviewKey,projectId:s.groupProps.activeProjectId});b>=0&&h({index:b,id:a.openId})},[a.openId]);const g=p.useCallback(b=>{switch(b.kind){case"activity-header":return n.jsx(ng,{row:b,onToggle:()=>If(b,{model:s,actions:t})});case"caption":return n.jsx(ig,{row:b,onToggle:()=>Rf(b,{model:s})});case"project-header":{const v=b.section.project;return n.jsx(rg,{row:b,label:Nf(v,e.homeDirectory),isRepo:!!s.projectRepoStatus.get(v.id),active:s.groupProps.activeProjectId===v.id,onToggle:()=>t.toggleProject(v.id),onNewSession:()=>{t.setActiveProjectIdOnly(v.id),t.openNewSessionDraft({selectedProjectId:v.id,directoryOverride:v.normalizedPath}),a.close()},onRemove:()=>t.removeProject(v.id)})}case"group-header":return Cf(b.group)?n.jsx(ug,{row:b,geometry:c,onToggle:t.group.onToggleCollapsedGroup}):n.jsx(og,{row:b,geometry:c,onToggle:t.group.onToggleCollapsedGroup});case"folder-header":return n.jsx(ag,{row:b,geometry:c});case"session":return n.jsx(Y1,{row:b,geometry:c,toggleParent:s.groupProps.toggleParent});case"search-result":return n.jsx(Sf,{result:b.result,context:b.context,mobile:!0,search:s.search,onOpened:a.close});case"search-archived-caption":return n.jsx(kf,{});case"search-show-more":return n.jsx(jf,{mobile:!0,section:b.section,hidden:b.hidden,onShow:s.search?.showMore});case"search-more":return n.jsx(wf,{mobile:!0,onLoadMore:()=>s.search?.loadMore(b.section)});case"run":return n.jsx(fg,{row:b,geometry:c,toggleParent:s.groupProps.toggleParent});case"draft":return n.jsx(mg,{row:b,geometry:c});case"show-control":return n.jsx(X1,{more:b.more,fewer:b.fewer,hiddenNodes:b.hiddenNodes,indent:b.flat?vo:b.detailed?c.detailedLeft(b.depth??0):c.textLeft(b.depth??0),onShow:v=>vf(b,v,{model:s,actions:t})});case"status":return n.jsx(lg,{row:b,indent:b.flat?vo:b.detailed?c.detailedLeft(b.depth??0):c.textLeft(b.depth??0),onRetry:()=>yf(b,r),onGrantAccess:()=>{xf(b,r)}});case"empty":return b.emptyKind==="sidebar"?s.emptyState:b.emptyKind==="search"?s.searchEmptyState:n.jsx("div",{className:"py-1 typography-micro text-muted-foreground",style:{paddingInlineStart:c.textLeft(b.depth??0)},children:b.emptyKind==="section"?i("sessions.sidebar.sections.empty"):i("sessions.sidebar.group.empty.noArchivedSessions")})}},[t,r,c,s,a,i,e.homeDirectory]);return n.jsx(bs,{ref:d,outerClassName:"min-h-0 flex-1",className:"px-3 pb-4 [overflow-anchor:none]",useScrollShadow:!0,disableHorizontal:!0,children:n.jsx(Ef,{model:s.rowModel,scrollElement:o,pinnedRowIndexes:f,renderRow:g,onFirstVisibleIndexChange:xg,guideSlotStartPx:c.base,scrollRequest:x})})},wg=32,jg=80,kg=64,Sg=.7,Cg=140,Ng=.4,Rg=(s,e,t)=>{const i=e.ownerDocument.defaultView;if(!i)return"drawer";let a=!1;for(let r=s instanceof i.Element?s:null;r&&r!==e;r=r.parentElement){const c=r.scrollWidth-r.clientWidth;if(c<=1)continue;const o=i.getComputedStyle(r);if(o.overflowX!=="auto"&&o.overflowX!=="scroll")continue;const d=o.direction==="rtl"?-c:0,u=d+c;if(t?r.scrollLeft>d+1:r.scrollLeft<u-1)return"content";a=!0}return a?"content-end":"drawer"},yr=(s,e)=>{const t=p.useRef(e);t.current=e;const i=e.enabled??!0;p.useEffect(()=>{if(!i)return;const a=s.current;if(!a)return;const c=window.Capacitor?.getPlatform?.()==="android"?jg:wg,o=a.ownerDocument;let d=!1,u=!1,l="drawer",f=0,x=0;const h=()=>o.getSelection()?.isCollapsed===!1,m=()=>{d=!1},g=()=>{d&&h()&&m()},b=w=>{if(w.touches.length!==1||h()){d=!1;return}const k=w.touches[0],E=a.clientWidth,_=k.clientX<=c,A=k.clientX>=E-c;u=_,l=_||A?Rg(w.target,a,u):"drawer",d=(_||A)&&l!=="content",f=k.clientX,x=k.clientY},v=w=>{if(!d||(d=!1,h()))return;const k=w.changedTouches[0];if(!k)return;const E=k.clientX-f,_=k.clientY-x,A=l==="content-end"?Cg:kg,S=l==="content-end"?Ng:Sg;Math.abs(E)<A||Math.abs(_)>Math.abs(E)*S||u&&E<=0||!u&&E>=0||(u?t.current.onLeftEdgeSwipe?.():t.current.onRightEdgeSwipe?.())};return a.addEventListener("touchstart",b,{passive:!0}),a.addEventListener("touchend",v,{passive:!0}),a.addEventListener("touchcancel",m,{passive:!0}),a.addEventListener("selectstart",m),o.addEventListener("selectionchange",g),()=>{a.removeEventListener("touchstart",b),a.removeEventListener("touchend",v),a.removeEventListener("touchcancel",m),a.removeEventListener("selectstart",m),o.removeEventListener("selectionchange",g)}},[i,s])},Ig=[["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"]],Eg=[["project","sessions.sidebar.header.listGrouping.project"],["time","sessions.sidebar.header.listGrouping.time"]],rn="min-h-10 items-center justify-between";function Pg(){const s=oe.c(8),{t:e}=ye(),i=!cd();let a;s[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(G,{name:"check-double",className:"size-4"}),s[0]=a):a=s[0];let r;s[1]!==e?(r=e("sessions.sidebar.header.actions.markAllRead"),s[1]=e,s[2]=r):r=s[2];let c;s[3]!==r?(c=n.jsxs("span",{className:"flex items-center gap-2",children:[a,r]}),s[3]=r,s[4]=c):c=s[4];let o;return s[5]!==i||s[6]!==c?(o=n.jsx(nn,{disabled:i,onClick:dd,className:rn,children:c}),s[5]=i,s[6]=c,s[7]=o):o=s[7],o}const _g={kind:"idle"},Tg=s=>n.jsx(vg,{...s}),Ag=s=>{const e=oe.c(29),{project:t}=s,{t:i}=ye();let a;e[0]!==t.id?(a={id:t.id},e[0]=t.id,e[1]=a):a=e[1];const{attributes:r,listeners:c,setNodeRef:o,transform:d,transition:u,isDragging:l}=zm(a);let f;e[2]!==d?(f=$m.Transform.toString(d),e[2]=d,e[3]=f):f=e[3];const x=l?10:1;let h;e[4]!==f||e[5]!==x||e[6]!==u?(h={transform:f,transition:u,zIndex:x},e[4]=f,e[5]=x,e[6]=u,e[7]=h):h=e[7];const m=l&&"shadow-lg shadow-black/20";let g;e[8]!==m?(g=me("flex items-center gap-1 rounded-2xl border border-edge bg-[var(--surface-elevated)] px-1.5 py-1.5 transition-colors",m),e[8]=m,e[9]=g):g=e[9];let b;e[10]!==t.label||e[11]!==i?(b=i("mobile.sessions.dragHandleAria",{label:t.label}),e[10]=t.label,e[11]=i,e[12]=b):b=e[12];let v;e[13]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx(G,{name:"drag-move-2",className:"size-4"}),e[13]=v):v=e[13];let w;e[14]!==r||e[15]!==c||e[16]!==b?(w=n.jsx("button",{type:"button",className:"flex size-9 shrink-0 cursor-grab touch-none items-center justify-center rounded-xl text-muted-foreground transition-colors hover:text-foreground active:cursor-grabbing","aria-label":b,...r,...c,children:v}),e[14]=r,e[15]=c,e[16]=b,e[17]=w):w=e[17];let k;e[18]!==t?(k=n.jsx(xn,{project:t}),e[18]=t,e[19]=k):k=e[19];let E;e[20]!==t.label?(E=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]=E):E=e[21];let _;return e[22]!==o||e[23]!==k||e[24]!==E||e[25]!==h||e[26]!==g||e[27]!==w?(_=n.jsxs("div",{ref:o,style:h,className:g,children:[w,k,E]}),e[22]=o,e[23]=k,e[24]=E,e[25]=h,e[26]=g,e[27]=w,e[28]=_):_=e[28],_},wo=s=>{const e=oe.c(205),{open:t,onOpenChange:i,variant:a,footer:r}=s,c=a===void 0?"drawer":a,{t:o}=ye(),d=Mg(t),u=na(),l=Yt(Bg),f=Yt(zg),x=Yt(Fg),h=yt(Wg),m=Lt($g),g=Lt(Kg),b=Lt(Dl),v=Lt(Hg),w=Lt(Vg),k=Lt(Ug),E=Lt(Gg),_=Lt(qg),A=Lt(Jg),S=Lt(Xg),C=Lt(Yg),j=Lt(Qg),T=Lt(Zg),R=Lt(eb),K=Lt(tb),P=Lt(sb),z=Ge(nb),O=Lt(ib);let D;e[0]!==O?(D=O.filter(rb),e[0]=O,e[1]=D):D=e[1];const M=D,L=Lt(ob),W=Ge(ab),F=gn(cb),[N,I]=p.useState(""),[B,Q]=p.useState("everything"),[J,X]=p.useState(_g);let q;e[2]===Symbol.for("react.memo_cache_sentinel")?(q=we=>{I(we),we===""&&Q("everything")},e[2]=q):q=e[2];const Z=q;let H;e[3]===Symbol.for("react.memo_cache_sentinel")?(H=()=>Z(""),e[3]=H):H=e[3];const V=H;let se;e[4]!==B?(se=Mf(B),e[4]=B,e[5]=se):se=e[5];const te=Pf(J,se.searchIn==="messages"),[re,ne]=p.useState(null),[ue,Y]=p.useState(null),[ie,ae]=p.useState(!1),[Pe,Be]=p.useState(!1),[xe,Re]=p.useState(null),[le,ce]=p.useState(!1),[Ie,Ne]=p.useState(0),[je,De]=p.useState(!1),We=c==="drawer"||je,ct=p.useRef(null);let Ue;e[6]!==je?(Ue=()=>{je&&V(),De(!je)},e[6]=je,e[7]=Ue):Ue=e[7];const Me=Ue;let He,Oe;e[8]!==je||e[9]!==c?(He=()=>{je&&c==="sidebar"&&ct.current?.focus()},Oe=[je,c],e[8]=je,e[9]=c,e[10]=He,e[11]=Oe):(He=e[10],Oe=e[11]),p.useEffect(He,Oe);let rt,nt;e[12]===Symbol.for("react.memo_cache_sentinel")?(nt=()=>ud.onDirectoryRequest(()=>ae(!0)),rt=[],e[12]=rt,e[13]=nt):(rt=e[12],nt=e[13]),p.useEffect(nt,rt);let st;e[14]!==d||e[15]!==u?(st=()=>{if(!d){V(),De(!1),ce(!1),ne(null),St.getState().reset();return}Ne(db),Ti(u).then(ub)},e[14]=d,e[15]=u,e[16]=st):st=e[16];let ee;e[17]!==d?(ee=[d],e[17]=d,e[18]=ee):ee=e[18],p.useEffect(st,ee);const be=ss(fb),Ze=p.useRef(be);let U;e[19]!==be||e[20]!==d||e[21]!==u?(U=()=>{const we=Ze.current==="reconnecting"&&be==="connected";Ze.current=be,!(!we||!d)&&Ti(u).then(mb)},e[19]=be,e[20]=d,e[21]=u,e[22]=U):U=e[22];let Ce;e[23]!==be?(Ce=[be],e[23]=be,e[24]=Ce):Ce=e[24],p.useEffect(U,Ce);let qe;e[25]!==i?(qe=()=>i(!1),e[25]=i,e[26]=qe):qe=e[26];const he=qe;let ut,lt;e[27]===Symbol.for("react.memo_cache_sentinel")?(ut=we=>{Re(we),Be(!0)},lt=(we,wt)=>Y({project:we,worktree:wt}),e[27]=ut,e[28]=lt):(ut=e[27],lt=e[28]);let Ct;e[29]!==he||e[30]!==Ie?(Ct={close:he,openProjectEdit:ne,openNewWorktree:ut,requestWorktreeDelete:lt,openId:Ie},e[29]=he,e[30]=Ie,e[31]=Ct):Ct=e[31];const ft=Ct,Je=We?N:"";let et;e[32]!==B||e[33]!==Je?(et={searchQuery:Je,searchScope:B,clearSearch:V,onSearchStatusChange:X,renderList:Tg},e[32]=B,e[33]=Je,e[34]=et):et=e[34];const dt=et;let Xe;e[35]!==l?(Xe=l.map(pb),e[35]=l,e[36]=Xe):Xe=e[36];const ht=Xe;let Se;e[37]!==ht||e[38]!==f?(Se=td(ht,"manual",f),e[37]=ht,e[38]=f,e[39]=Se):Se=e[39];const it=Se;let Qe;e[40]!==re||e[41]!==ht?(Qe=ht.find(we=>we.id===re)??null,e[40]=re,e[41]=ht,e[42]=Qe):Qe=e[42];const gt=Qe,bt=ht.find(we=>we.id===xe)??null;let ot;e[43]!==g?(ot=we=>{g(we),Ms({sidebarProjectSortOrder:we}),we!=="manual"&&ce(!1)},e[43]=g,e[44]=ot):ot=e[44];const _e=ot;let mt;e[45]!==v?(mt=we=>{v(we),Ms({sidebarGrouping:we}),we==="time"&&ce(!1)},e[45]=v,e[46]=mt):mt=e[46];const xt=mt,ze=hb;let at;e[47]!==o?(at=(we,wt,Ot,es)=>n.jsxs(nn,{onClick:es,className:rn,children:[n.jsx("span",{children:o(wt)}),Ot?n.jsx(G,{name:"check",className:"size-4 text-primary"}):null]},we),e[47]=o,e[48]=at):at=e[48];const Fe=at;let ge;e[49]===Symbol.for("react.memo_cache_sentinel")?(ge={activationConstraint:{distance:8}},e[49]=ge):ge=e[49];let de;e[50]===Symbol.for("react.memo_cache_sentinel")?(de={coordinateGetter:Fm},e[50]=de):de=e[50];const Te=Tm(Gr(Dm,ge),Gr(Am,de));let Ae;e[51]!==l||e[52]!==x?(Ae=we=>{const{active:wt,over:Ot}=we;if(!Ot||wt.id===Ot.id)return;const es=l.findIndex(vn=>vn.id===wt.id),jt=l.findIndex(vn=>vn.id===Ot.id);es<0||jt<0||x(es,jt)},e[51]=l,e[52]=x,e[53]=Ae):Ae=e[53];const Le=Ae,tt=!N&&l.length>1&&m==="manual"&&b==="project";let Bt;e[54]!==tt||e[55]!==M||e[56]!==T||e[57]!==le||e[58]!==b||e[59]!==xt||e[60]!==_e||e[61]!==L||e[62]!==C||e[63]!==A||e[64]!==m||e[65]!==l.length||e[66]!==Fe||e[67]!==z||e[68]!==R||e[69]!==j||e[70]!==S||e[71]!==_||e[72]!==k||e[73]!==P||e[74]!==E||e[75]!==w||e[76]!==o||e[77]!==K?(Bt=!le&&l.length>0?n.jsxs(Mi,{children:[n.jsx(Oi,{asChild:!0,children:n.jsx($e,{type:"button",variant:"chip",size:"sm","aria-label":o("sessions.sidebar.header.displayMode.label"),title:o("sessions.sidebar.header.displayMode.label"),style:{touchAction:"manipulation"},children:n.jsx(G,{name:"list-settings",className:"size-4"})})}),n.jsxs(Li,{align:"end",className:"w-64",children:[n.jsx(Or,{children:o("sessions.sidebar.header.listGrouping.label")}),Eg.map(we=>{const[wt,Ot]=we;return Fe(wt,Ot,b===wt,()=>xt(wt))}),b==="project"?n.jsxs(n.Fragment,{children:[n.jsx(vi,{}),n.jsx(Or,{children:o("sessions.sidebar.header.actions.sortProjects")}),Ig.map(we=>{const[wt,Ot]=we;return Fe(wt,Ot,m===wt,()=>_e(wt))})]}):null,n.jsx(vi,{}),Fe("pinned","sessions.sidebar.header.displayMode.showPinned",E,ze(E,_,gb)),z?Fe("work","sessions.sidebar.header.displayMode.showWork",w,ze(w,k,bb)):null,M.map(we=>n.jsxs(nn,{onClick:()=>_f(we.id,!L.includes(we.id)),className:rn,children:[n.jsx("span",{className:"min-w-0 truncate",dir:"auto",children:we.name}),L.includes(we.id)?null:n.jsx(G,{name:"check",className:"size-4 text-primary"})]},`section:${we.id}`)),E?Fe("pinned-in-place","sessions.sidebar.header.displayMode.keepPinnedInPlace",C,ze(C,j,xb)):null,z&&w?Fe("in-place","sessions.sidebar.header.displayMode.keepWorkInPlace",A,ze(A,S,yb)):null,Fe("detailed","sessions.sidebar.header.displayMode.detailedZoneRows",T,ze(T,R,vb)),Fe("branch-names","sessions.sidebar.header.displayMode.worktreeNameByBranch",K,ze(K,P,wb)),n.jsx(vi,{}),tt?n.jsx(nn,{onClick:()=>ce(!0),className:rn,children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(G,{name:"drag-move-2",className:"size-4"}),o("mobile.sessions.editOrder")]})}):null,n.jsx(Pg,{})]})]}):null,e[54]=tt,e[55]=M,e[56]=T,e[57]=le,e[58]=b,e[59]=xt,e[60]=_e,e[61]=L,e[62]=C,e[63]=A,e[64]=m,e[65]=l.length,e[66]=Fe,e[67]=z,e[68]=R,e[69]=j,e[70]=S,e[71]=_,e[72]=k,e[73]=P,e[74]=E,e[75]=w,e[76]=o,e[77]=K,e[78]=Bt):Bt=e[78];const Ut=Bt;let zt;e[79]!==le||e[80]!==o?(zt=le?n.jsx($e,{type:"button",variant:"chip",size:"sm","aria-label":o("mobile.sessions.doneEditing"),"aria-pressed":!0,onClick:()=>ce(!1),style:{touchAction:"manipulation"},children:n.jsx(G,{name:"check",className:"size-4"})}):null,e[79]=le,e[80]=o,e[81]=zt):zt=e[81];const _t=zt;let Ke;e[82]!==he||e[83]!==le||e[84]!==h||e[85]!==o?(Ke=le?null:n.jsxs($e,{type:"button",variant:"default",size:"sm","aria-label":o("mobile.sessions.newChat"),onClick:()=>{h(),he()},style:{touchAction:"manipulation"},children:[n.jsx(G,{name:"add",className:"size-4"}),o("mobile.sessions.newChat")]}),e[82]=he,e[83]=le,e[84]=h,e[85]=o,e[86]=Ke):Ke=e[86];const Ft=Ke;let Tt;e[87]!==le||e[88]!==o?(Tt=le?null:n.jsx($e,{type:"button",variant:"chip",size:"sm","aria-label":o("sessions.sidebar.header.actions.addProject"),title:o("sessions.sidebar.header.actions.addProject"),onClick:()=>ae(!0),style:{touchAction:"manipulation"},children:n.jsx(G,{name:"folder-add",className:"size-4"})}),e[87]=le,e[88]=o,e[89]=Tt):Tt=e[89];const Gt=Tt,Wt=jb,xs=fa();let ps;e[90]!==le||e[91]!==r||e[92]!==xs||e[93]!==o?(ps=r&&!le?n.jsxs(Mi,{children:[n.jsx(Oi,{asChild:!0,children:n.jsx($e,{type:"button",variant:"chip",size:"sm","aria-label":o("sessions.sidebar.header.actions.more"),title:o("sessions.sidebar.header.actions.more"),style:{touchAction:"manipulation"},children:n.jsx(G,{name:"more",className:"size-4"})})}),n.jsxs(Li,{align:"end",className:"w-56",children:[r.onOpenOverview?Wt("compass-3",o("overview.title"),r.onOpenOverview):null,Wt("git-pull-request",o("sourceBoard.title"),r.onOpenSourceBoard),Wt("calendar-schedule",o("sessions.sidebar.header.actions.scheduledTasks"),r.onOpenScheduled),Wt("archive",o("sessions.sidebar.nav.archive"),r.onOpenArchive),Wt("bar-chart",o("usageStats.openAction"),r.onOpenUsage),xs.map(kb)]})]}):null,e[90]=le,e[91]=r,e[92]=xs,e[93]=o,e[94]=ps):ps=e[94];const ys=ps;let vs;e[95]!==Gt||e[96]!==Ut||e[97]!==_t||e[98]!==ys||e[99]!==Ft?(vs=n.jsxs(n.Fragment,{children:[Gt,Ut,ys,_t,Ft]}),e[95]=Gt,e[96]=Ut,e[97]=_t,e[98]=ys,e[99]=Ft,e[100]=vs):vs=e[100];const us=vs,Et=l.length===0&&!F,ws="flex min-h-0 flex-1 flex-col";let At;e[101]!==le||e[102]!==Et||e[103]!==t||e[104]!==te||e[105]!==B||e[106]!==We||e[107]!==J||e[108]!==N||e[109]!==o||e[110]!==Me||e[111]!==c?(At=!le&&!Et&&We?n.jsxs("div",{className:me("shrink-0 px-2 pb-1",c==="sidebar"?"pt-2":"pt-1"),children:[n.jsx(Tf,{inputRef:ct,value:N,onSearch:Z,onClose:c==="sidebar"?Me:void 0,active:t,mobile:!0,placeholder:o("mobile.sessions.search.placeholder"),clearLabel:o("mobile.sessions.clearSearchAria"),trailing:N!==""?n.jsxs(n.Fragment,{children:[n.jsx(Af,{status:J,scope:B}),n.jsx(Df,{mobile:!0,scope:B,onChange:Q})]}):void 0}),N!==""&&te?n.jsx("p",{role:"status",className:"px-2.5 pt-1 typography-micro text-muted-foreground",children:te}):null]}):null,e[101]=le,e[102]=Et,e[103]=t,e[104]=te,e[105]=B,e[106]=We,e[107]=J,e[108]=N,e[109]=o,e[110]=Me,e[111]=c,e[112]=At):At=e[112];let Nt;e[113]!==Et||e[114]!==o?(Nt=Et?n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(Lg,{title:o("mobile.sessions.empty.noProjectsTitle"),description:o("mobile.sessions.empty.noProjectsDescription"),action:n.jsxs("button",{type:"button",className:"flex items-center justify-center gap-2 rounded-2xl bg-primary px-5 py-3 typography-ui-label text-primary-foreground transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:()=>ae(!0),children:[n.jsx(G,{name:"folder-add",className:"size-4"}),o("sessions.sidebar.header.actions.addProject")]})})}):null,e[113]=Et,e[114]=o,e[115]=Nt):Nt=e[115];let Dt;e[116]!==Te||e[117]!==le||e[118]!==Le||e[119]!==it||e[120]!==o?(Dt=le?n.jsx(bs,{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:o("mobile.sessions.editOrderHint")}),n.jsx(Mm,{sensors:Te,collisionDetection:Om,onDragEnd:Le,children:n.jsx(Lm,{items:it.map(Sb),strategy:Bm,children:n.jsx("div",{className:"flex flex-col gap-1.5",children:it.map(Cb)})})})]})}):null,e[116]=Te,e[117]=le,e[118]=Le,e[119]=it,e[120]=o,e[121]=Dt):Dt=e[121];const is=(le||Et)&&"hidden";let qt;e[122]!==is?(qt=me("flex min-h-0 flex-1 flex-col",is),e[122]=is,e[123]=qt):qt=e[123];let $t;e[124]!==d||e[125]!==dt?($t=n.jsx(Of,{mobileVariant:!0,isVisible:d,phone:dt}),e[124]=d,e[125]=dt,e[126]=$t):$t=e[126];let Ee;e[127]!==ft||e[128]!==$t?(Ee=n.jsx(q1,{value:ft,children:$t}),e[127]=ft,e[128]=$t,e[129]=Ee):Ee=e[129];let ve;e[130]!==qt||e[131]!==Ee?(ve=n.jsx("div",{className:qt,children:Ee}),e[130]=qt,e[131]=Ee,e[132]=ve):ve=e[132];let vt;e[133]!==r||e[134]!==W||e[135]!==o||e[136]!==c?(vt=r?n.jsxs("div",{"data-keyboard-rider":c==="drawer"?"":void 0,className:"oc-sessions-footer flex shrink-0 items-center justify-between gap-2 border-t border-edge bg-background px-3 pt-1.5",style:{paddingBottom:"calc(0.375rem + var(--oc-safe-area-bottom, 0px))"},children:[n.jsx("div",{className:"flex min-w-0 items-center",children:r.instanceLabel&&r.onOpenInstances?n.jsxs($e,{type:"button",variant:"info",size:"lg",className:"min-w-0 shrink justify-start",onClick:r.onOpenInstances,"aria-label":o("mobile.menu.instances"),style:{touchAction:"manipulation"},children:[n.jsx(G,{name:"server",className:"size-[18px]"}),n.jsx("span",{className:"block min-w-0 truncate",children:r.instanceLabel})]}):null}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[r.onOpenUpdate?n.jsxs($e,{type:"button",variant:"chip",size:"lg",className:"relative w-10 px-0",onClick:r.onOpenUpdate,"aria-label":o("mobile.menu.update"),title:o("mobile.menu.update"),style:{touchAction:"manipulation"},children:[n.jsx(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(sd,{children:[n.jsx(nd,{asChild:!0,children:n.jsx($e,{type:"button",variant:"default",size:"lg",className:"w-10 px-0",onClick:r.onOpenSettings,"aria-label":o("mobile.menu.settings"),style:{touchAction:"manipulation"},children:n.jsx(G,{name:"settings-3",className:"size-5"})})}),n.jsx(id,{side:"top",children:n.jsx(rd,{label:o("mobile.menu.settings"),shortcut:od(ad("open_settings",W),"")})})]})]})]}):null,e[133]=r,e[134]=W,e[135]=o,e[136]=c,e[137]=vt):vt=e[137];let Kt;e[138]!==ie?(Kt=n.jsx(fd,{open:ie,onOpenChange:ae}),e[138]=ie,e[139]=Kt):Kt=e[139];const rs=ld;let Ht;e[140]===Symbol.for("react.memo_cache_sentinel")?(Ht=we=>{Be(we),we||Re(null)},e[140]=Ht):Ht=e[140];const Rt=bt?{id:bt.id,path:ur(bt.path)}:void 0;let Jt;e[141]!==he||e[142]!==h||e[143]!==xe?(Jt=we=>{h({selectedProjectId:xe,directoryOverride:we,preserveDirectoryOverride:!0}),he()},e[141]=he,e[142]=h,e[143]=xe,e[144]=Jt):Jt=e[144];let Xt;e[145]!==rs||e[146]!==Pe||e[147]!==Ht||e[148]!==Rt||e[149]!==Jt?(Xt=n.jsx(rs,{open:Pe,onOpenChange:Ht,project:Rt,onWorktreeCreated:Jt}),e[145]=rs,e[146]=Pe,e[147]=Ht,e[148]=Rt,e[149]=Jt,e[150]=Xt):Xt=e[150];const js=gt!==null;let Ys;e[151]===Symbol.for("react.memo_cache_sentinel")?(Ys=()=>ne(null),e[151]=Ys):Ys=e[151];let Rs;e[152]!==gt||e[153]!==js?(Rs=n.jsx(E1,{open:js,project:gt,onClose:Ys}),e[152]=gt,e[153]=js,e[154]=Rs):Rs=e[154];let Mt;e[155]!==ue?(Mt=ue?n.jsx(Za,{open:!0,project:ue.project,worktree:ue.worktree,onClose:()=>Y(null)}):null,e[155]=ue,e[156]=Mt):Mt=e[156];let Is;e[157]!==At||e[158]!==Nt||e[159]!==Dt||e[160]!==ve||e[161]!==vt||e[162]!==Kt||e[163]!==Xt||e[164]!==Rs||e[165]!==Mt?(Is=n.jsxs("div",{className:ws,children:[At,Nt,Dt,ve,vt,Kt,Xt,Rs,Mt]}),e[157]=At,e[158]=Nt,e[159]=Dt,e[160]=ve,e[161]=vt,e[162]=Kt,e[163]=Xt,e[164]=Rs,e[165]=Mt,e[166]=Is):Is=e[166];const Cs=Is;if(c==="sidebar"){let we;e[167]===Symbol.for("react.memo_cache_sentinel")?(we=me(Vs,"border-b border-edge"),e[167]=we):we=e[167];let wt;e[168]!==le||e[169]!==Et||e[170]!==je||e[171]!==o||e[172]!==Me?(wt=!le&&!Et?n.jsx($e,{type:"button",variant:"chip",size:"sm","aria-label":o("sessions.sidebar.header.actions.searchSessions"),title:o("sessions.sidebar.header.actions.searchSessions"),"aria-pressed":je,onClick:Me,style:{touchAction:"manipulation"},children:n.jsx(G,{name:"search",className:"size-4"})}):null,e[168]=le,e[169]=Et,e[170]=je,e[171]=o,e[172]=Me,e[173]=wt):wt=e[173];let Ot;e[174]!==us?(Ot=n.jsx("div",{className:"ms-auto flex shrink-0 items-center gap-2",children:us}),e[174]=us,e[175]=Ot):Ot=e[175];let es;e[176]!==wt||e[177]!==Ot?(es=n.jsxs("div",{className:we,children:[wt,Ot]}),e[176]=wt,e[177]=Ot,e[178]=es):es=e[178];let jt;return e[179]!==Cs||e[180]!==es?(jt=n.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[es,Cs]}),e[179]=Cs,e[180]=es,e[181]=jt):jt=e[181],jt}let ks;e[182]!==he?(ks=()=>{const we=St.getState();if(we.revealedKey){we.setRevealed(we.revealedKey,!1);return}he()},e[182]=he,e[183]=ks):ks=e[183];let Es;e[184]!==o?(Es=o("mobile.sessions.sheet.title"),e[184]=o,e[185]=Es):Es=e[185];let hs;e[186]!==o?(hs=o("mobile.surface.closeAria"),e[186]=o,e[187]=hs):hs=e[187];let Ns,Ps;e[188]===Symbol.for("react.memo_cache_sentinel")?(Ns={touchAction:"manipulation"},Ps=n.jsx(G,{name:"close",className:"size-5"}),e[188]=Ns,e[189]=Ps):(Ns=e[188],Ps=e[189]);let _s;e[190]!==he||e[191]!==hs?(_s=n.jsx("button",{type:"button",className:Qt,"aria-label":hs,onClick:he,style:Ns,children:Ps}),e[190]=he,e[191]=hs,e[192]=_s):_s=e[192];let pt;e[193]!==us?(pt=n.jsx("div",{className:"ms-auto flex shrink-0 items-center gap-2",children:us}),e[193]=us,e[194]=pt):pt=e[194];let fs;e[195]!==_s||e[196]!==pt?(fs=n.jsxs("div",{className:Vs,children:[_s,pt]}),e[195]=_s,e[196]=pt,e[197]=fs):fs=e[197];let Zt;return e[198]!==he||e[199]!==t||e[200]!==Cs||e[201]!==ks||e[202]!==Es||e[203]!==fs?(Zt=n.jsxs(Og,{open:t,onClose:he,onSwipeClose:ks,ariaLabel:Es,children:[fs,Cs]}),e[198]=he,e[199]=t,e[200]=Cs,e[201]=ks,e[202]=Es,e[203]=fs,e[204]=Zt):Zt=e[204],Zt},jo="mobile-surface-root",al=16,ko=320,Dg="cubic-bezier(0.22, 1, 0.36, 1)",Mg=s=>{const e=oe.c(3),[t,i]=p.useState(s);let a,r;return e[0]!==s?(a=()=>{if(!s){i(!1);return}let c=0;const o=window.setTimeout(()=>{c=window.requestAnimationFrame(()=>{c=window.requestAnimationFrame(()=>i(!0))})},al);return()=>{window.clearTimeout(o),window.cancelAnimationFrame(c)}},r=[s],e[0]=s,e[1]=a,e[2]=r):(a=e[1],r=e[2]),p.useEffect(a,r),t},Og=({open:s,onClose:e,onSwipeClose:t,ariaLabel:i,children:a})=>{const{direction:r}=ye(),c=p.useRef(null),o=p.useRef(null),[d,u]=p.useState(!1),[l,f]=p.useState(s),x=p.useRef(e);p.useEffect(()=>{x.current=e},[e]);const h=p.useRef(t);p.useEffect(()=>{h.current=t},[t]);const m=()=>(h.current??x.current)();if(yr(o,{enabled:s,...r==="rtl"?{onLeftEdgeSwipe:m}:{onRightEdgeSwipe:m}}),typeof document<"u"&&!c.current){let g=document.getElementById(jo);g||(g=document.createElement("div"),g.id=jo,document.body.appendChild(g)),c.current=g}return p.useEffect(()=>{if(s){f(!0);const b=window.setTimeout(()=>u(!0),al);return()=>window.clearTimeout(b)}u(!1);const g=window.setTimeout(()=>f(!1),ko+40);return()=>window.clearTimeout(g)},[s]),p.useEffect(()=>{if(!s)return;const g=document.body.style.overflow;document.body.style.overflow="hidden";const b=v=>{v.key==="Escape"&&!ga(v)&&x.current()};return document.addEventListener("keydown",b),()=>{document.body.style.overflow=g,document.removeEventListener("keydown",b)}},[s]),c.current?Tn.createPortal(n.jsx("section",{ref:o,role:"dialog","aria-modal":"true","aria-label":i,"aria-hidden":!s,className:"oc-keyboard-inset-surface oc-side-safe-area fixed inset-0 z-50 flex flex-col bg-background text-foreground",style:{paddingTop:"var(--oc-safe-area-top, 0px)",transform:d?"none":r==="rtl"?"translateX(100%)":"translateX(-100%)",transition:`transform ${ko}ms ${Dg}`,visibility:l?"visible":"hidden",pointerEvents:s?"auto":"none"},children:n.jsx("div",{className:"flex h-full min-h-0 flex-col",children:a})}),c.current):null},Lg=s=>{const e=oe.c(10),{title:t,description:i,action:a}=s;let r;e[0]!==t?(r=n.jsx("p",{className:"typography-ui-label text-foreground",children:t}),e[0]=t,e[1]=r):r=e[1];let c;e[2]!==i?(c=i?n.jsx("p",{className:"typography-meta text-muted-foreground",children:i}):null,e[2]=i,e[3]=c):c=e[3];let o;e[4]!==a?(o=a?n.jsx("div",{className:"pt-2",children:a}):null,e[4]=a,e[5]=o):o=e[5];let d;return e[6]!==r||e[7]!==c||e[8]!==o?(d=n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 text-center",children:[r,c,o]}),e[6]=r,e[7]=c,e[8]=o,e[9]=d):d=e[9],d};function Bg(s){return s.projects}function zg(s){return s.manualProjectOrder}function Fg(s){return s.reorderProjects}function Wg(s){return s.openNewSessionDraft}function $g(s){return s.projectSortOrder}function Kg(s){return s.setProjectSortOrder}function Hg(s){return s.setSidebarGrouping}function Vg(s){return s.showWorkSection}function Ug(s){return s.setShowWorkSection}function Gg(s){return s.showPinnedSection}function qg(s){return s.setShowPinnedSection}function Jg(s){return s.keepWorkInPlace}function Xg(s){return s.setKeepWorkInPlace}function Yg(s){return s.keepPinnedInPlace}function Qg(s){return s.setKeepPinnedInPlace}function Zg(s){return s.detailedZoneRows}function eb(s){return s.setDetailedZoneRows}function tb(s){return s.worktreeNameByBranch}function sb(s){return s.setWorktreeNameByBranch}function nb(s){return s.sessionWorkEnabled}function ib(s){return s.sections}function rb(s){return s.kind==="custom"}function ob(s){return s.hiddenSections}function ab(s){return s.shortcutOverrides}function lb(s){return Gi(Hs(s))}function cb(s){return s.activeSessions.some(lb)}function db(s){return s+1}function ub(){return ha()}function fb(s){return s.connectionPhase}function mb(){return ha()}function pb(s){return{...s,label:s.label?.trim()||M1(s.path)}}function hb(s,e,t){return()=>{e(!s),t(!s)}}function gb(s){Ms({sidebarShowPinnedSection:s})}function bb(s){Ms({sidebarShowWorkSection:s})}function xb(s){Ms({sidebarKeepPinnedInPlace:s})}function yb(s){Ms({sidebarKeepWorkInPlace:s})}function vb(s){Ms({sidebarDetailedZoneRows:s})}function wb(s){Ms({sidebarWorktreeNameByBranch:s})}function jb(s,e,t){return n.jsx(nn,{onClick:t,className:rn,children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(G,{name:s,className:"size-4"}),e]})})}function kb(s){return n.jsx(nn,{onClick:()=>Ge.getState().setOpenGuestPage(s.id),className:rn,children:n.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[n.jsx(si,{icon:pa(s.icon),iconSrc:ma(s.id,s.icon,Vo().authenticatedAsset),className:"size-4 shrink-0"}),n.jsx("span",{className:"truncate",children:s.pageTitle??s.name})]})},s.id)}function Sb(s){return s.id}function Cb(s){return n.jsx(Ag,{project:s},s.id)}const Nb=async(s,e)=>{const t=[],i=new Set;let a=s;for(;a&&!i.has(a);){i.add(a);const r=await e(a);if(!r)break;t.push(r),a=r.parentID??md(r)}return t},Rb=s=>s.split(/[\\/]/).filter(Boolean).pop()??s,Ib=(s,e)=>{const t=()=>{const a=Ge.getState();a.isSettingsDialogOpen&&(a.setSettingsDialogOpen(!1),e(s.includes(pd(a.settingsPage))?"page-content":"nav"))},i=Ge.subscribe((a,r)=>{a.isSettingsDialogOpen&&!r.isSettingsDialogOpen&&t()});return t(),i},Eb=s=>{const e=oe.c(64),{directory:t,target:i,subtitle:a,revision:r,visible:c,onBack:o}=s,{t:d}=ye();let u;e[0]!==t||e[1]!==r||e[2]!==i||e[3]!==c?(u={directory:t,target:i,visible:c,needsSourceSelection:!1,revision:r},e[0]=t,e[1]=r,e[2]=i,e[3]=c,e[4]=u):u=e[4];const l=Cp(u),{view:f}=l;let x;e[5]!==i?(x=Ml(i),e[5]=i,e[6]=x):x=e[6];const h=x,[m,g]=p.useState(!1),b=l.entry.result?.generatedAt??null,[v,w]=p.useState(null),k=f!==null&&v!==null&&v===b;let E;e[7]!==b||e[8]!==l?(E=Z=>{l.handleSelectStop(Z),w(b)},e[7]=b,e[8]=l,e[9]=E):E=e[9];const _=E;let A;e[10]!==o||e[11]!==k?(A=()=>{k?w(null):o()},e[10]=o,e[11]=k,e[12]=A):A=e[12];const S=A;let C;e[13]===Symbol.for("react.memo_cache_sentinel")?(C=me(Vs,"border-b border-edge text-foreground"),e[13]=C):C=e[13];let j;e[14]!==d?(j=d("header.actions.backAria"),e[14]=d,e[15]=j):j=e[15];let T;e[16]===Symbol.for("react.memo_cache_sentinel")?(T=n.jsx(G,{name:"arrow-left",className:"size-5"}),e[16]=T):T=e[16];let R;e[17]!==S||e[18]!==j?(R=n.jsx("button",{type:"button",className:Qt,"aria-label":j,onClick:S,children:T}),e[17]=S,e[18]=j,e[19]=R):R=e[19];let K;e[20]===Symbol.for("react.memo_cache_sentinel")?(K=me("truncate",ni),e[20]=K):K=e[20];let P;e[21]!==d?(P=d("contextPanel.mode.walkthrough"),e[21]=d,e[22]=P):P=e[22];let z;e[23]!==P?(z=n.jsx("h2",{className:K,children:P}),e[23]=P,e[24]=z):z=e[24];let O;e[25]!==a?(O=n.jsx("p",{className:"truncate typography-meta text-muted-foreground",children:a}),e[25]=a,e[26]=O):O=e[26];let D;e[27]!==z||e[28]!==O?(D=n.jsxs("div",{className:"min-w-0 flex-1 px-1",children:[z,O]}),e[27]=z,e[28]=O,e[29]=D):D=e[29];let M;e[30]!==k||e[31]!==l||e[32]!==d||e[33]!==f?(M=k&&f?n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",className:Qt,"aria-label":d("walkthrough.action.previous"),onClick:()=>l.step(-1),children:n.jsx(G,{name:"arrow-right-s",className:"size-5 rotate-180"})}),n.jsx(Np,{review:l,view:f,size:"mobile"}),n.jsx("button",{type:"button",className:Qt,"aria-label":d("walkthrough.action.next"),onClick:()=>l.step(1),children:n.jsx(G,{name:"arrow-right-s",className:"size-5"})})]}):f||l.blocked||l.showStages?n.jsx("button",{type:"button",className:Qt,"aria-label":d("walkthrough.options.moreAria"),"aria-haspopup":"dialog",onClick:()=>g(!0),children:n.jsx(G,{name:"more",className:"size-5"})}):null,e[30]=k,e[31]=l,e[32]=d,e[33]=f,e[34]=M):M=e[34];let L;e[35]!==D||e[36]!==M||e[37]!==R?(L=n.jsxs("header",{className:C,children:[R,D,M]}),e[35]=D,e[36]=M,e[37]=R,e[38]=L):L=e[38];let W;e[39]!==l||e[40]!==f?(W=n.jsx(Tp,{review:l,view:f}),e[39]=l,e[40]=f,e[41]=W):W=e[41];let F;e[42]!==h||e[43]!==_||e[44]!==k||e[45]!==l||e[46]!==f?(F=n.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:l.blocked?n.jsx(Rp,{reason:l.blocked.reason,model:l.blocked.model,requiredChars:l.blocked.requiredChars,availableChars:l.blocked.availableChars,onRetry:l.retry}):l.showStages?n.jsx("div",{className:"flex flex-1 flex-col items-center justify-center gap-3 p-8",children:n.jsx(Ip,{progress:l.stageProgress})}):f&&k?n.jsx(Ep,{view:f,activeStopId:l.activeStopId,scrollToStopId:l.scrollToStopId,onActiveStopChange:l.handleActiveStopChange,onScrollHandled:l.clearScrollRequest,renderSideBySide:!1,wrapLines:!0,commentOrigin:h}):f?n.jsx(Pp,{view:f,activeStopId:l.activeStopId,visitedStopIds:l.visitedStopIds,onSelectStop:_}):n.jsx(_p,{review:l,size:"mobile"})}),e[42]=h,e[43]=_,e[44]=k,e[45]=l,e[46]=f,e[47]=F):F=e[47];let N;e[48]===Symbol.for("react.memo_cache_sentinel")?(N=()=>g(!1),e[48]=N):N=e[48];let I;e[49]!==d?(I=d("walkthrough.options.title"),e[49]=d,e[50]=I):I=e[50];const B=f!==null;let Q;e[51]===Symbol.for("react.memo_cache_sentinel")?(Q=()=>g(!1),e[51]=Q):Q=e[51];let J;e[52]!==l||e[53]!==B?(J=n.jsx(Ap,{review:l,hasView:B,size:"mobile",onActed:Q}),e[52]=l,e[53]=B,e[54]=J):J=e[54];let X;e[55]!==m||e[56]!==I||e[57]!==J?(X=n.jsx(qn,{open:m,onClose:N,title:I,children:J}),e[55]=m,e[56]=I,e[57]=J,e[58]=X):X=e[58];let q;return e[59]!==L||e[60]!==W||e[61]!==F||e[62]!==X?(q=n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[L,W,F,X]}),e[59]=L,e[60]=W,e[61]=F,e[62]=X,e[63]=q):q=e[63],q};async function Pb(s,e,t=Number.POSITIVE_INFINITY){const i=Array.from(new Set(s)),a=[];return await hd(i,t,async r=>{try{await e(r)}catch(c){a.push({path:r,error:c instanceof Error?c:null})}}),{paths:i,failures:a}}const _b=async(s,e,t)=>{const{targetBranch:i,directory:a,sourceBranch:r,git:c,publishChooser:o,toast:d,t:u}=t;if(!(!i||!a)){if(!c.createGitCommit)throw new Error("Git commit is unavailable on this runtime");if(await c.createGitCommit(a,s,{addAll:!0}),e)try{await(await o.prepare("push"))()}catch{d.error(u("gitView.dirtySwitch.pushFailed")),await t.refreshStatusAndBranches(),t.closeDialog();return}d.success(r?e?u("gitView.publish.succeeded"):u("gitView.dirtySwitch.committedNotPushed",{branch:r}):u("gitView.toast.commitCreated")),await t.refreshStatusAndBranches(),t.closeDialog(),await t.performCheckout(i)}},ei=s=>Xs(s)??s,Tb=(s,e)=>{const t=ei(s),i=ei(e.directory);return t?i===t?t:i.startsWith(t.endsWith("/")?t:`${t}/`)?i:null:null},Ab=(s,e)=>!!s&&ei(s)===ei(e.directory),So={status:"loading"},Db=1e6,as={type:"list"},Mb=2,Co=s=>{const e=s.index?.trim();return!!(e&&e!=="?")},No=s=>{const e=s.working_dir?.trim(),t=s.index?.trim();return!!(e||t==="?")},Ro=(s,e)=>e?`${s}\0staged`:s,Ri=new WeakSet,Io=new WeakSet,Eo=new WeakSet,Po=(s,e,t)=>t.filter(i=>Gd(s,e,i)).sort((i,a)=>i.length-a.length)[0],Ob=s=>{const e=oe.c(16),t=ba(),i=Xs(xa(t,er()))??"",a=s.visible??!0;let r;e[0]!==a?(r={enabled:a,recheckOnOpen:!0},e[0]=a,e[1]=r):r=e[1];const c=gd(i||null,r);let o;e[2]!==i?(o=g=>i?g.changesRepositories.get(i):void 0,e[2]=i,e[3]=o):o=e[3];const d=en(o);let u;e[4]!==c||e[5]!==d?(u=d&&c.repositoryOptions?.includes(d)?{...c,gitDirectory:d}:c,e[4]=c,e[5]=d,e[6]=u):u=e[6];const l=u,f=s.initialCommit;let x,h;if(e[7]!==f||e[8]!==i?(x=()=>{if(!f||!i||Io.has(f))return;Io.add(f);const g=Tb(i,f);g&&(en.getState().clearChangesRepository(i),ts.getState().selectNestedRepo(i,g))},h=[f,i],e[7]=f,e[8]=i,e[9]=x,e[10]=h):(x=e[9],h=e[10]),p.useEffect(x,h),t?.kind==="preparing"){let g;return e[11]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(Ca,{}),e[11]=g):g=e[11],g}let m;return e[12]!==s||e[13]!==l||e[14]!==i?(m=n.jsx(Lb,{...s,rootDirectory:i,repository:l}),e[12]=s,e[13]=l,e[14]=i,e[15]=m):m=e[15],m},Lb=({rootDirectory:s,repository:e,onClose:t,initialDiff:i,initialCommit:a,visible:r=!0,onNavigatedToChat:c})=>{const{t:o}=ye(),{git:d,sourceControl:u}=Yi(),{rootIsGitRepo:l,gitDirectory:f,nestedRepos:x,repositoryOptions:h}=e,m=f??s,g=bd(m||null),b=xd(m),v=yd(m||null),w=vd(m||null),[k,E]=p.useState(!1),[_,A]=p.useState(!1),S=Wn(y=>y.profiles),C=Wn(y=>y.globalIdentity),j=Wn(y=>y.loadProfiles),T=Wn(y=>y.loadGlobalIdentity);p.useEffect(()=>{j(),T()},[j,T]);const R=wd(),K=Bi(y=>y.identities),P=p.useMemo(()=>jd(K),[K]),z=Bi(y=>y.refreshIdentityAccounts),O=p.useMemo(()=>kd(S,C,y=>Ol(y)&&Sd(y,R)),[S,C,R]),D=async y=>{if(!(!m||_)){A(!0);try{(await Yd({directory:m,identity:y,remoteName:tt||null},{git:d,sourceControl:u})).status==="failed"?pe.error(o("gitView.toast.applyIdentityFailed")):pe.success(o("gitView.toast.appliedIdentity",{name:Qd(y,o)}))}finally{A(!1)}}},M=sa(m||null),L=Cd(m||null),W=ts(y=>y.setActiveDirectory),F=ts(y=>y.ensureAll),N=ts(y=>y.ensureNestedRepos),I=ts(y=>y.selectNestedRepo),B=ts(y=>y.fetchStatus),Q=ts(y=>y.fetchBranches),J=ts(y=>y.prefetchDiffs),X=ts(y=>y.getDiff),q=ts(y=>y.setDiff),Z=ts(y=>y.runtimeKey),H=JSON.stringify([Z,m]),V=p.useRef(H);V.current=H;const[se,te]=p.useState(()=>i?.scope==="turn"?{ownerKey:H,mode:Ri.has(i)?"working":"turn",route:as}:{ownerKey:H,mode:"working",route:i?.path?{type:"diff",path:i.path,staged:i.staged}:as}),[re,ne]=p.useState(null),ue=re?.step==="turn"?"turn":"working",Y=se.ownerKey===H?se.mode:ue,ie=se.ownerKey===H?se.route:as,[ae,Pe]=p.useState(!1),Be=p.useCallback(y=>{te({ownerKey:H,mode:y,route:as}),Pe(!1)},[H]),xe=p.useCallback(y=>{te($=>({ownerKey:H,mode:$.ownerKey===H?$.mode:"working",route:y}))},[H]);p.useEffect(()=>{te(y=>y.ownerKey===H?y:{ownerKey:H,mode:ue,route:as}),Pe(!1)},[ue,H]),p.useEffect(()=>{r||Pe(!1)},[r]);const Re=p.useRef(null);p.useEffect(()=>{if(i?.path){if(i.scope==="turn"){if(Ri.has(i))return;Ri.add(i),Re.current=null,ne({file:i.path,sessionId:yt.getState().currentSessionId,step:"turn",picked:!1,statusReadFor:null}),te({ownerKey:V.current,mode:"turn",route:as});return}ne(null),te({ownerKey:V.current,mode:"working",route:{type:"diff",path:i.path,staged:i.staged}})}},[i]),p.useEffect(()=>{!a||Eo.has(a)||!Ab(m,a)||(Eo.add(a),ne(null),te({ownerKey:V.current,mode:"commit",route:as}))},[m,a]);const[le,ce]=p.useState(null),[Ie,Ne]=p.useState(null),je=pp(),[De,We]=p.useState(""),[ct,Ue]=p.useState(new Set),[Me,He]=p.useState(!1),[Oe,rt]=p.useState(!1),[nt,st]=p.useState([]),[ee,be]=p.useState([]),[Ze,U]=p.useState([]),[Ce,qe]=p.useState(null),[he,ut]=p.useState(null),[lt,Ct]=p.useState(0),ft=Lf(),Je=Bf({directory:m,branch:g?.current,chooseContributor:ft.choose}),et=Nd(m,d,u),[dt,Xe]=p.useState(null),[ht,Se]=p.useState(!1),[it,Qe]=p.useState([]),[gt,bt]=p.useState("rebase"),ot=p.useCallback((y,$)=>{Qe(y),bt($),Se(!0)},[]),_e=g?.current??null,mt=Hr(y=>y.setOverride),xt=Hr(y=>y.clearOverride),ze=Dp(m||null,_e,r&&Y==="commit"&&M===!0),at=ze.selectedCommit?.hash??null,Fe=Rd(m||null,u),ge=p.useMemo(()=>new Set(Fe.read?.repository.remotes.map(y=>y.name)??[]),[Fe.read]),de=zf(m||null,_e,r&&M===!0,{branches:v,remoteNames:ge,primaryRemote:Fe.contexts[0]?.primaryRemote,readContext:Fe.contexts[0]??null}),Te=r&&M===!0;kp(Te&&m||null,Te?_e:null,Fe);const Ae=op(_e,de.base),Le=M===!1||ap(_e,de.base,g!==null,de.resolved),tt=Fe.read?.binding?.remotes[0]?.name??Fe.read?.repository.remotes.find(y=>y.name==="origin")?.name??Fe.read?.repository.remotes[0]?.name??"",Bt=Fe.read?Fe.read.binding?.providers.find(y=>y.readiness==="ready")?.accountId??null:void 0,Ut=p.useMemo(()=>Id(S,C,w,y=>({id:"local-config",name:y.userName,...y,color:"info",icon:"user"}),Bt),[Bt,w,S,C]),zt=p.useMemo(()=>{const y=Fe.read;return!y?.binding||Fe.status!=="ready"||y.binding.state==="bound"?null:Ed(y.binding)?o("gitView.identity.configChanged"):o("gitView.context.needsAttention")},[Fe.read,Fe.status,o]),_t=en(y=>s?y.diffRequests.get(s):void 0);p.useEffect(()=>{_t&&te({ownerKey:H,mode:"pr",route:as})},[H,_t]);const Ke=Mp(m||null,_e,Fe.contexts[0]??null,r&&Y==="pr"&&M===!0,_t),Ft=Ll(Ke.provider),Tt=Ke.selectedSource;p.useEffect(()=>{!s||!_t||!g||Tt!==_t||en.getState().settleDiffRequest(s,_t)},[_t,s,Tt,g]);const Gt=yt(y=>y.currentSessionId),{diffs:Wt,loaded:xs,settled:ps,error:ys,retry:vs}=lp(Gt,s||void 0,{enabled:r&&Y==="turn",live:!0}),[us,Et]=p.useState(!1),ws=p.useCallback(()=>{Et(!1),c?.()},[c]),At=Pd(Gt,s,ws),Nt=p.useMemo(()=>Y==="pr"?Ke.diffUnavailable?null:Tt:Y==="branch"&&_e&&de.base?{kind:"branch",baseRef:de.base,headRef:_e}:Y==="commit"&&at?{kind:"commit",hash:at}:null,[de.base,_e,Y,Ke.diffUnavailable,at,Tt]),Dt=Y==="branch"?de.revision:"",is=Tt?Ke.prs.find(y=>y.number===Tt.number)?.headSha:void 0,qt=p.useMemo(()=>Bl(Nt,{provider:Ke.provider,revision:is}),[Nt,Ke.provider,is]),{review:$t,provider:Ee}=Ff(Ke,m,r&&Y==="pr"),ve=cp(m||null,Nt,r&&M===!0,Dt,Ke.readContext,Ke.provider),{fetchDiff:vt,fetchFullFile:Kt,fetchVersions:rs}=ve,Ht=p.useMemo(()=>ve.files?[...ve.files].sort((y,$)=>y.path.localeCompare($.path)):null,[ve.files]),Rt=ie.type==="comparison"&&ie.sourceKey===ve.key?ie.path:null,[Jt,Xt]=p.useState(0),js=p.useCallback(async y=>{try{if(ya(y)){const Ye=await rs(y);return{status:"ready",diff:Ia(Ye.original,Ye.modified)?Ye:{original:"",modified:"",isBinary:!0}}}const{diff:$}=await vt(y),fe={original:"",modified:"",isBinary:Xr($)};return fe.isBinary||(fe.fileDiff=ji(y,$)),{status:"ready",diff:fe}}catch($){return{status:"error",message:$ instanceof Error?$.message:o("diffView.state.failedToLoadDiff")}}},[vt,rs,o]),Ys=p.useMemo(()=>Y==="branch"?dp(ve.files,Dt):void 0,[ve.files,Dt,Y]),Rs=up(ve.files?Y==="pr"?JSON.stringify([ve.key,ve.revision]):ve.key:null,r&&Rt?Rt:"",r?js:null,So,JSON.stringify([Y==="pr"?ve.revision:0,Jt]),Ys),Mt=Rt?Rs.get(Rt)??So:null,[Is,Cs]=p.useState(null),[ks,Es]=p.useState(null),hs=Is&&Is.source===Mt?Is.request:null,Ns=ks&&ks.source===Mt?ks.diff:null;p.useEffect(()=>{const y=Mt;if(!hs||!Rt||y?.status!=="ready"||Ns)return;let $=!1;const fe=Rt,Ye=async()=>{if(Y==="pr"){const{original:os,modified:kt}=await Kt(fe);return{original:os,modified:kt,fileDiff:Wp({name:fe,contents:os},{name:fe,contents:kt})}}const{diff:ke}=await vt(fe,Db);return{original:"",modified:"",fileDiff:ji(fe,ke)}};return(async()=>{try{const ke=await Ye();$||Es({source:y,diff:ke})}catch(ke){if($)return;pe.error(ke instanceof Error?ke.message:o("diffView.state.failedToLoadDiff")),Cs(null)}})(),()=>{$=!0}},[Mt,Rt,Ns,vt,Kt,Y,hs,o]),p.useEffect(()=>{Y==="branch"&&Le&&Be("working")},[Le,Be,Y]),p.useEffect(()=>{te(y=>y.ownerKey===H&&y.route.type==="comparison"&&y.route.sourceKey!==ve.key?{...y,route:as}:y)},[ve.key,H]);const Ps=p.useMemo(()=>Wt.map(y=>({path:y.file??"",status:fp(y.status),insertions:y.additions??0,deletions:y.deletions??0})).filter(y=>y.path).sort((y,$)=>y.path.localeCompare($.path)),[Wt]),_s=p.useMemo(()=>{const y=new Map;for(const $ of Wt)if($.file){if(typeof $.patch=="string"){const fe=Xr($.patch);y.set($.file,{original:"",modified:"",isBinary:fe,fileDiff:fe?void 0:ji($.file,$.patch)});continue}y.set($.file,{original:$.before??"",modified:$.after??""})}return y},[Wt]),pt=p.useMemo(()=>{const y=g?.files??[],$=new Map;for(const fe of y)$.set(fe.path,fe);return Array.from($.values()).sort((fe,Ye)=>fe.path.localeCompare(Ye.path))},[g?.files]);p.useEffect(()=>{if(!re||!r)return;if(re.sessionId!==Gt||ie.type!=="list"||Y!==(re.step==="turn"?"turn":"working")){ne(null);return}const y=_d(s,re.file);if(re.step==="turn"){if(!ps)return;const ke=Po(y,s,Wt.map(os=>os.file));if(ke){ne(null),te({ownerKey:H,mode:"turn",route:{type:"turn",path:ke}});return}ne({...re,step:"changes"}),te({ownerKey:H,mode:"working",route:as});return}if(!e.repositoriesKnown||!m)return;const $=Td(y,[...l&&s?[s]:[],...h??[]]);if($&&$!==m){if(re.picked){ne(null);return}ne({...re,picked:!0}),en.getState().clearChangesRepository(s),I(s,$);return}if(re.statusReadFor!==m){if(Re.current===m)return;Re.current=m,B(m,d,{silent:!0}).finally(()=>{ne(ke=>ke&&{...ke,statusReadFor:m})});return}ne(null);const fe=Po(y,m,pt.map(ke=>ke.path)),Ye=pt.find(ke=>ke.path===fe);Ye&&te({ownerKey:H,mode:"working",route:{type:"diff",path:Ye.path,staged:Co(Ye)&&!No(Ye)}})},[pt,m,Gt,B,d,Wt,Y,H,e.repositoriesKnown,h,s,l,ie.type,I,ps,re,r]);const fs=p.useMemo(()=>Y==="working"?pt.length>0?{source:{kind:"working-tree",scope:"all"}}:null:!Nt||!Ht?.length?null:Nt.kind==="pr"?Ke.readContext?{source:Nt,context:Ke.readContext}:null:{source:Nt},[pt.length,Ht,Nt,Y,Ke.readContext]),Zt=p.useMemo(()=>pt.filter(Co),[pt]),we=p.useMemo(()=>pt.filter(No),[pt]),wt=Ze,Ot=ts(p.useCallback(y=>!m||ie.type!=="diff"?null:y.directories.get(m)?.diffCache.get(Ro(ie.path,ie.staged))??null,[m,ie])),es=p.useMemo(()=>ie.type!=="diff"?null:pt.find(y=>y.path===ie.path)??null,[pt,ie]),jt=p.useCallback(async(y=!0)=>{if(m)try{await Promise.all([B(m,d),Q(m,d)])}catch($){y&&pe.error($ instanceof Error?$.message:o("gitView.toast.refreshRepositoryFailed"))}},[m,Q,B,d,o]),vn=p.useMemo(()=>(v?.all??[]).filter(y=>!y.startsWith("remotes/")).sort(),[v]),ul=p.useMemo(()=>(v?.all??[]).filter(y=>y.startsWith("remotes/")).map(y=>y.replace(/^remotes\//,"")).sort(),[v]),Ln=p.useCallback(async y=>{if(!m)return;const $=y.replace(/^remotes\//,"");try{if(!d.checkoutBranch)throw new Error("Branch checkout is unavailable on this runtime");const fe=await d.checkoutBranch(m,$);pe.success(o("gitView.toast.checkedOut",{name:fe.branch||$})),await jt()}catch(fe){pe.error(fe instanceof Error?fe.message:o("gitView.toast.checkoutFailed",{name:$}))}},[m,d,jt,o]),fl=p.useCallback(y=>{const $=y.replace(/^remotes\//,"");if((g?.files?.length??0)>0){Xe($);return}Ln($)},[Ln,g?.files]),ml=p.useCallback(async y=>{if(m)try{if(await d.createBranch(m,y,_e??"HEAD"),!d.checkoutBranch)throw new Error("Branch checkout is unavailable on this runtime");await d.checkoutBranch(m,y),await jt()}catch($){throw pe.error($ instanceof Error?$.message:o("gitView.toast.createBranchFailed")),$}},[_e,m,d,jt,o]),Bn=p.useCallback(async()=>{if(!m){U([]);return}try{const y=await d.getRemotes(m);U(y)}catch{U([])}},[m,d]),Fs=p.useCallback(async()=>{m&&(Promise.allSettled([Q(m,d),Bn()]),await B(m,d).catch(()=>{}))},[m,Q,B,d,Bn]);p.useEffect(()=>{!m||!r||(W(m),F(m,d))},[m,F,d,W,r]),p.useEffect(()=>{r&&Bn()},[Bn,r]),p.useEffect(()=>{if(!r||Y!=="working"||!m||pt.length===0)return;const y=Array.from(new Set([...Zt.map(fe=>fe.path),...ee,...pt.slice(0,20).map(fe=>fe.path)])).filter(Boolean);if(y.length===0)return;const $=window.setTimeout(()=>{J(m,d,y,{maxFiles:40})},120);return()=>window.clearTimeout($)},[pt,m,d,Y,J,Zt,ee,r]),p.useEffect(()=>{if(!r)return;if(ie.type!=="diff"){qe(null);return}const y=Ro(ie.path,ie.staged);if(ut(null),!m||X(m,y)){qe(null);return}let $=!1;const fe=hn();if(qe(null),!d.getGitFileDiff){qe("Diff is unavailable on this runtime");return}const Ye=pt.find(ke=>ke.path===ie.path)?.previousPath;return d.getGitFileDiff(m,{path:ie.path,staged:ie.staged||void 0,previousPath:Ye}).then(ke=>{$||q(m,y,{original:ke.original??"",modified:ke.modified??"",isBinary:ke.isBinary,submodule:ke.submodule},fe)}).catch(ke=>{if(!$){if(ke instanceof Ir&&ke.reason!=="path_not_found"){ut({key:`${m}\0${ie.path}`,reason:ke.reason});return}ke instanceof Ir&&B(m,d,{force:!0,silent:!0}),qe(ke instanceof Error?ke.message:String(ke))}}),()=>{$=!0}},[pt,m,lt,B,X,d,ie,q,r]);const wn=async(y,$,fe=!1)=>{if(!m)return;const Ye=et.start();if(!Ye)return;ce(y);const ke=o(y==="fetch"?"gitView.sync.fetch":y==="pull"?"gitView.sync.pull":y==="publish"?"gitView.publish.title":"gitView.sync.syncChanges");let os=null;try{if(y==="sync"||y==="publish"){const kt=await Je.prepare(y==="publish"?"push":"sync",{forceChoose:fe,onOperation:Ye.onOperation});os=Zd(await kt())}else if($&&g)await eu({action:y,directory:m,remoteName:$.name,status:g,sourceControl:u,git:d,onOperation:Ye.onOperation});else throw new Ts("tracking-required");if(!Ye.isCurrent())return;y==="fetch"&&$?pe.success(o("gitView.toast.fetchedFromRemote",{name:$.name})):y==="pull"&&$?pe.success(o("gitView.toast.pulledFromRemote",{name:$.name})):y==="sync"?pe.success(os?.kind==="up-to-date"?o("gitView.toast.alreadyUpToDate"):os?.kind==="pulled"?o("gitView.toast.pulledFromRemote",{name:os.remoteName}):os?.kind==="pushed"?o("gitView.toast.pushedToUpstream",{name:os.remoteName}):o("gitView.toast.syncedChanges")):y==="publish"&&pe.success(o("gitView.publish.succeeded")),await Fs()}catch(kt){if(kt instanceof Vn||kt instanceof Ai){if(Ye.isCurrent()&&await Fs(),Ye.isCurrent()&&kt instanceof Vn&&kt.read.availability==="available"&&kt.read.operation.state==="conflicted"&&kt.read.operation.error.code==="CONFLICT"){const Nr=((await d.getGitStatus(m).catch(()=>null))?.files??[]).filter(wi).map(jl=>jl.path);Nr.length>0&&ot(Nr,"merge")}return}if(kt instanceof Ts&&kt.code==="stale-runtime")return;if(kt instanceof Ts&&Je.errorMessage(kt)){pe.info(Je.errorMessage(kt));return}await Fs(),pe.error(kt instanceof Ts?kt.code==="contributor-publish-cancelled-after-update"?o("gitView.toast.contributorPublishCancelledAfterUpdate"):kt.code==="contributor-publish-cancelled"?o("gitView.toast.contributorPublishCancelled"):o("gitView.toast.syncActionFailed",{action:ke}):kt instanceof Error?Ur(kt,o):o("gitView.toast.syncActionFailed",{action:ke}))}finally{Ye.finish(),Ye.isCurrent()&&ce(null)}},jn=p.useCallback(async(y,$)=>{if(!(!m||y.length===0))try{$==="stage"?y.length>1?await Ad(m,y):await Dd(m,y[0]):y.length>1?await Md(m,y):await Od(m,y[0]),await jt(!1)}catch(fe){pe.error(fe instanceof Error?fe.message:o($==="stage"?"gitView.toast.stageFileFailed":"gitView.toast.unstageFileFailed"))}},[m,jt,o]),fi=p.useCallback((y,$=!1)=>{xe({type:"diff",path:y,staged:$})},[xe]),mi=p.useCallback(async y=>{if(m){Ue($=>new Set($).add(y));try{await d.revertGitFile(m,y),pe.success(o("gitView.toast.revertedFile",{path:y})),await jt(!1)}catch($){pe.error($ instanceof Error?$.message:o("gitView.toast.revertFailed"))}finally{Ue($=>{const fe=new Set($);return fe.delete(y),fe})}}},[m,d,jt,o]),wr=p.useCallback(async y=>{if(!m||y.length===0||Me)return;const $=Array.from(new Set(y));He(!0),Ue(new Set($));try{const fe=await Pb($,Ye=>d.revertGitFile(m,Ye),Mb);if(await jt(!1),fe.failures.length===0)pe.success($.length===1?o("gitView.toast.revertedFilesSingle",{count:$.length}):o("gitView.toast.revertedFilesPlural",{count:$.length}));else if(fe.failures.length===$.length)pe.error(fe.failures[0]?.error?.message??o("gitView.toast.revertFailed"));else{const Ye=$.length-fe.failures.length;pe.warning(Ye===1?o("gitView.toast.revertedSomeSingle",{success:Ye,failed:fe.failures.length}):o("gitView.toast.revertedSomePlural",{success:Ye,failed:fe.failures.length}))}}catch(fe){pe.error(fe instanceof Error?fe.message:o("gitView.toast.revertFailed"))}finally{Ue(new Set),He(!1)}},[m,d,Me,jt,o]),pl=p.useCallback(y=>{const $=y.map(fe=>fe.trim()).filter(Boolean);if($.length===0){st([]);return}We(fe=>`${fe.trim()}${fe.trim()?`
|
|
23
23
|
|
|
24
24
|
`:""}${$.join(`
|
|
25
|
-
`)}`.trim()),st([])},[]),hl=p.useCallback(async()=>{if(!m)return;const y=Zt.map($=>$.path).sort();if(y.length===0){pe.error(o("gitView.toast.selectFileToDescribe"));return}rt(!0);try{const{message:$}=await Lr(m,y);We($.subject?.trim()??""),st(Array.isArray($.highlights)?$.highlights:[])}catch($){pe.error($ instanceof Error?$.message:o("gitView.toast.generateCommitMessageFailed"))}finally{rt(!1)}},[m,Zt,o]),jr=async(y={})=>{if(!m)return;if(!De.trim()){pe.error(o("gitView.toast.enterCommitMessage"));return}const $=Zt.map(ke=>ke.path).sort();if($.length===0){pe.error(o("gitView.toast.selectFileToCommit"));return}Ne(y.pushAfter?"commitAndPush":"commit");let fe=null,Ye="pending";try{if(!d.createGitCommit)throw new Error("Git commit is unavailable on this runtime");const ke=await d.createGitCommit(m,De.trim(),{files:$});Ye="local";const os=je.committed(ke.summary,y);if(We(""),st([]),y.pushAfter){if(fe=et.start(),!fe){pe.warning(o("gitView.publish.commitKept")),await Fs();return}const kt=await Je.prepare("push",{onOperation:fe.onOperation});ce("publish"),await kt(),Ye="published",je.pushed({deletion:os,origin:y.origin})}await Fs()}catch(ke){if(y.pushAfter&&Ye==="local"&&pe.warning(o("gitView.publish.commitKept")),ke instanceof Vn||ke instanceof Ai){await Fs();return}if(ke instanceof Ts&&ke.code==="stale-runtime")return;if(ke instanceof Ts&&Je.errorMessage(ke)){pe.info(Je.errorMessage(ke));return}y.pushAfter&&await Fs(),pe.error(ke instanceof Ts?ke.code==="contributor-publish-cancelled-after-update"?o("gitView.toast.contributorPublishCancelledAfterUpdate"):ke.code==="contributor-publish-cancelled"?o("gitView.toast.contributorPublishCancelled"):o("gitView.toast.syncActionFailed",{action:o("gitView.sync.syncChanges")}):ke instanceof Error?Ur(ke,o):o("gitView.toast.createCommitFailed"))}finally{fe?.finish(),Ne(null),y.pushAfter&&ce(null)}},gl=p.useMemo(()=>(g?.files??[]).filter(wi).length,[g?.files]),kn=!!g?.mergeInProgress?.head,bl=p.useCallback(async()=>{if(m)try{if(kn){if(!d.continueMerge)throw new Error("Git continue merge is unavailable on this runtime");const y=await d.continueMerge(m);y.conflict?(ot(y.conflictFiles??[],"merge"),pe.error(o("gitView.toast.mergeConflictsDetected"))):pe.success(o("gitView.toast.mergeCompleted"))}else{if(!d.continueRebase)throw new Error("Git continue rebase is unavailable on this runtime");const y=await d.continueRebase(m);y.conflict?(ot(y.conflictFiles??[],"rebase"),pe.error(o("gitView.toast.rebaseConflictsDetected"))):pe.success(o("gitView.toast.rebaseStepCompleted"))}await jt(!1)}catch(y){pe.error(y instanceof Error?y.message:o("gitView.toast.continueOperationFailed"))}},[m,d,kn,ot,jt,o]),kr=p.useCallback(async y=>{if(m)try{if(y==="merge"){if(!d.abortMerge)throw new Error("Git abort merge is unavailable on this runtime");await d.abortMerge(m),pe.success(o("gitView.toast.mergeAborted"))}else{if(!d.abortRebase)throw new Error("Git abort rebase is unavailable on this runtime");await d.abortRebase(m),pe.success(o("gitView.toast.rebaseAborted"))}await jt(!1)}catch($){pe.error($ instanceof Error?$.message:o("gitView.toast.abortOperationFailed"))}},[m,d,jt,o]),xl=p.useCallback(()=>{const y=(g?.files??[]).filter(wi).map($=>$.path);ot(y,kn?"merge":"rebase")},[kn,ot,g?.files]),yl=p.useMemo(()=>{const y=[];return Zt.length>0&&y.push({id:"staged",title:o("gitView.changes.stagedTitle"),entries:Zt,statsScope:"staged",actionSymbol:"-",actionAllLabel:o("gitView.changes.unstageAllAria"),getActionLabel:$=>o("gitView.changes.unstageFileAria",{path:$}),onActionFile:$=>{jn([$],"unstage")},onActionAll:$=>{jn($,"unstage")},onViewDiff:$=>fi($,!0),onRevertFile:mi,showRevertActions:!1,accent:!0}),we.length>0&&y.push({id:"unstaged",title:o("gitView.changes.title"),entries:we,statsScope:"working",actionSymbol:"+",actionAllLabel:o("gitView.changes.stageAllAria"),getActionLabel:$=>o("gitView.changes.stageFileAria",{path:$}),onActionFile:$=>{jn([$],"stage")},onActionAll:$=>{jn($,"stage")},onViewDiff:$=>fi($,!1),onRevertFile:mi}),y},[mi,fi,jn,Zt,o,we]),Sr=n.jsxs(n.Fragment,{children:[Je.context?n.jsx(Wf,{context:Je.context,onSelect:Je.settle}):null,Je.confirmDialog,n.jsx($f,{candidates:ft.candidates,onSelect:ft.settle})]}),Cr=h?n.jsx(Xd,{repositories:h,selectedRepository:f??null,onSelectRepository:y=>{s&&(en.getState().clearChangesRepository(s),I(s,y))},repositoryRoot:s??void 0}):null,zn=y=>n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[Sr,n.jsxs("header",{className:me(Vs,"text-foreground"),children:[t?n.jsx("button",{type:"button",className:Qt,"aria-label":o("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:ni,children:o("mobile.nav.changes")}),n.jsx("p",{className:"truncate typography-micro text-muted-foreground",children:g?.current||m||""})]}),Cr]}),n.jsx("div",{className:"min-h-0 flex-1",children:y})]});if(!m)return zn(n.jsx(Vt,{message:o("gitView.empty.selectSessionOrDirectory")}));if(e.unreadable)return zn(n.jsx(Kf,{directory:e.unreadable.directory,message:e.unreadable.message}));if(l===!1&&M!==!0)return zn(n.jsx(Vf,{root:s,rootIsGitRepo:l,resolvedIsGitRepo:M,nestedRepos:x,onRetryDiscovery:()=>{s&&N(s,{force:!0})}}));if(L&&M===null)return zn(n.jsx(Vt,{loading:!0,message:o("gitView.loading.checkingRepository")}));if(ie.type==="diff")return n.jsx(Ii,{path:ie.path,previousPath:es?.previousPath,diff:Ot,staged:ie.staged,fileExists:!!es,unavailableReason:he?.key===`${m}\0${ie.path}`?he.reason:null,error:Ce,onBack:()=>xe({type:"list"}),onRetry:()=>Ct(y=>y+1)});if(ie.type==="turn")return n.jsx(Ii,{path:ie.path,subtitle:o("diffView.scope.lastTurn"),diff:_s.get(ie.path)??null,fileExists:Ps.some(y=>y.path===ie.path),onBack:()=>xe(as)});const pi=o(Y==="pr"?$n("session.githubIntegration.tabs.pullRequests",Ft):Y==="branch"?"diffView.scope.branch":Y==="commit"?"commitComparison.mode":Y==="turn"?"diffView.scope.lastTurn":"mobile.nav.changes"),hi=Y==="branch"&&de.base?Hf(de.base):Y==="commit"?at?.slice(0,8):Y==="pr"&&Tt?`#${Tt.number}`:null;if(ie.type==="walkthrough"&&fs&&m)return n.jsx(Vr.Provider,{value:$t,children:n.jsx(Eb,{directory:m,target:fs,subtitle:[pi,hi].filter(Boolean).join(" · "),revision:JSON.stringify([Dt,Y==="pr"?ve.revision:0]),visible:r,onBack:()=>xe(as)})});if(Rt&&Mt)return n.jsx(Vr.Provider,{value:$t,children:n.jsx(Ii,{path:Rt,previousPath:ve.files?.find(y=>y.path===Rt)?.previousPath,subtitle:[pi,hi].filter(Boolean).join(" · "),commentOrigin:qt,diff:Ns??(Mt.status==="ready"?Mt.diff:null),fileExists:!ve.files||ve.files.some(y=>y.path===Rt),error:ve.error??(Mt.status==="error"?Mt.message:null),onBack:()=>xe(as),onRetry:()=>{ve.error&&ve.refresh(),Xt(y=>y+1)},onExpandContextRequest:Mt.status==="ready"?y=>Cs({source:Mt,request:y}):void 0,pendingContextExpansion:hs,contextLoading:hs!==null&&!Ns})});const vl=()=>Y==="pr"&&Ke.diffUnavailable?n.jsx(Fp,{provider:Ke.provider,className:"h-full"}):Y==="pr"&&!Tt?n.jsx(Vt,{loading:Ke.loading,message:Ke.error??(Ke.loading?o($n("session.githubPrPicker.loading.pullRequests",Ft)):o($n("pullRequestComparison.select",Ft)))}):Y==="branch"&&!de.base?n.jsx(Vt,{loading:!de.resolved,message:de.resolved?o("gitView.pr.toast.baseBranchRequired"):o("diffView.branch.resolvingBase")}):Y==="commit"&&!at?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 text-center",children:[ze.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:ze.loading?o("diffView.state.loadingChanges"):ze.error??o("commitComparison.noCommits")}),ze.error&&n.jsx($e,{variant:"outline",size:"lg",onClick:()=>{ze.refresh()},children:o("diffView.actions.retry")})]}):ve.error?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 text-center",children:[n.jsx("p",{className:"typography-ui-label font-semibold",children:o("diffView.state.failedToLoadDiff")}),n.jsx("p",{className:"typography-meta text-muted-foreground",children:ve.error}),n.jsx($e,{variant:"outline",size:"lg",onClick:()=>{ve.refresh()},children:o("diffView.actions.retry")})]}):Ht?Ht.length===0?n.jsx(Vt,{icon:Y==="branch",message:Y==="pr"?o("walkthrough.blocked.emptyDiff.description"):Y==="commit"?o("commitComparison.emptyDiff"):o("diffView.branch.empty",{base:hi??""})}):n.jsx(_o,{files:Ht,onSelect:y=>{ve.key&&xe({type:"comparison",path:y,sourceKey:ve.key})}}):n.jsx(Vt,{loading:!0,message:o("diffView.state.loadingChanges")}),wl=()=>ys?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 text-center",children:[n.jsx("p",{className:"typography-ui-label font-semibold",children:o("diffView.state.failedToLoadDiff")}),n.jsx("p",{className:"typography-meta text-muted-foreground",children:ys}),n.jsx($e,{variant:"outline",size:"lg",onClick:vs,children:o("diffView.actions.retry")})]}):(!xs||re)&&Gt?n.jsx(Vt,{loading:!0,message:o("diffView.state.loadingChanges")}):Ps.length===0?n.jsx(Vt,{message:o("diffView.state.noLastTurnChanges")}):n.jsx(_o,{files:Ps,onSelect:y=>xe({type:"turn",path:y})});return n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[Sr,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:Qt,"aria-label":o("mobile.surface.closeAria"),onClick:t,style:{touchAction:"manipulation"},children:n.jsx(G,{name:"close",className:"size-5"})}):null,n.jsxs(Mi,{open:ae,onOpenChange:Pe,children:[n.jsx(Oi,{asChild:!0,children:n.jsxs($e,{variant:"ghost",className:Ld({size:"mobile"}),"data-mobile-comparison-trigger":!0,"aria-label":o("diffView.scope.selectorAria"),children:[n.jsx("span",{children:Y==="pr"&&Ft==="pullRequest"?"PR":Y==="pr"&&Ft==="mergeRequest"?"MR":pi}),n.jsx(G,{name:"arrow-down-s",className:"size-4"})]})}),n.jsx(Li,{align:"start",children:n.jsxs(Bd,{value:Y,onValueChange:y=>{(y==="working"||y==="turn"||y==="branch"||y==="commit"||y==="pr")&&Be(y)},children:[n.jsx(Sn,{value:"working",className:"min-h-8 items-center",children:o("mobile.nav.changes")}),n.jsx(Sn,{value:"turn",className:"min-h-8 items-center",children:o("diffView.scope.lastTurn")}),Ae&&n.jsx(Sn,{value:"branch",className:"min-h-8 items-center",children:o("diffView.scope.branch")}),n.jsx(Sn,{value:"commit",className:"min-h-8 items-center",children:o("commitComparison.mode")}),n.jsx(Sn,{value:"pr",className:"min-h-8 items-center",children:o($n("session.githubIntegration.tabs.pullRequests",Ft))})]})})]}),Cr,r&&Y==="branch"&&n.jsx(Op,{mobile:!0,branches:v?.all??[],currentBranch:_e,base:de.base,automatic:de.source!=="chosen",onSelect:y=>{_e&&mt(m,_e,y)},onSelectAutomatic:()=>{_e&&xt(m,_e)}},JSON.stringify([H,_e])),r&&Y==="commit"&&n.jsx(Lp,{mobile:!0,commits:ze.commits,selectedHash:at,loading:ze.loading,error:ze.error,onSelect:ze.select,onRefresh:()=>{ze.refresh()}},JSON.stringify([H,_e])),r&&Y==="pr"&&n.jsxs(n.Fragment,{children:[n.jsx(Bp,{mobile:!0,comparison:Ke},JSON.stringify([H,_e])),Tt&&n.jsx($e,{variant:"ghost",size:"sm",disabled:ve.loading,"aria-label":o("session.githubIssuePicker.actions.refresh"),onClick:()=>{ve.refresh()},children:n.jsx(G,{name:"refresh",className:"size-4"})})]}),fs&&n.jsx($e,{variant:"ghost",size:"icon",className:"ms-auto shrink-0",onClick:()=>xe({type:"walkthrough"}),"aria-label":o("walkthrough.action.open"),title:o("walkthrough.action.open"),style:{touchAction:"manipulation"},children:n.jsx(G,{name:"route",className:"size-5"})}),r&&Y==="pr"&&$t&&Ee?n.jsx(zp,{review:$t,provider:Ee,className:fs?void 0:"ms-auto"}):null,Y==="working"&&Gt&&(g?.files?.length??0)>0?n.jsxs($e,{variant:"outline",className:me("shrink-0",!fs&&"ms-auto"),disabled:At.submitting,onClick:()=>Et(!0),"aria-label":o("diffView.actions.reviewAria"),style:{touchAction:"manipulation"},children:[n.jsx(G,{name:At.submitting?"loader-4":"search-eye",className:me("size-4",At.submitting&&"animate-spin")}),o("chat.work.reviewHint.aiReview")]}):null]}),n.jsx(zd,{open:us,onOpenChange:Et,projectDirectory:s||null,submitting:At.submitting,onConfirm:At.start}),Y==="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(Fd,{currentBranch:g?.current,localBranches:vn,remoteBranches:ul,branchInfo:v?.branches,currentBranchAhead:g?.ahead,onCheckout:y=>{fl(y)},onCreate:ml,disabled:L,directory:m,switchBlockedNotice:(g?.files?.length??0)>0?o("gitView.branch.switchBlockedNotice"):null})}),n.jsx(Wd,{activeProfile:Ut,quiet:!0,identities:O,attention:zt,triggerClassName:"max-w-[10rem] shrink [&_.git-identity-label]:hidden sm:[&_.git-identity-label]:inline",onOpen:()=>{z(u,S.map(y=>y.account))},onSelect:y=>{D(y)},isApplying:_,onConfigure:()=>E(!0),applicability:y=>{const $=Fe.read?.repository.remotes.find(fe=>fe.name===tt);return $?$d(y,Kd($.fetch.displayUrl),P):{applicable:!0}}}),n.jsx(Hd,{syncAction:et.entry?.executing?le:null,remotes:wt,onFetch:y=>{wn("fetch",y)},onPull:y=>{wn("pull",y)},onSync:y=>{wn("sync",y)},onPublish:()=>{wn("publish")},onChooseSyncTargets:()=>{wn("sync",void 0,!0)},currentBranch:g?.current,hasTracking:!!g?.tracking,disabled:L||et.blocked,aheadCount:g?.ahead??0,behindCount:g?.behind??0,trackingRemoteName:g?.tracking?.split("/")[0],trackingBranch:g?.tracking,hasUncommittedChanges:Vd(pt),choosesPushDestination:b})]}),n.jsx(hp,{open:k,onOpenChange:E,directory:m}),n.jsx(Ud,{className:"mx-3 mt-3",entry:et.entry,onRefresh:()=>{et.refresh()},onCancel:()=>{et.cancel()}}),Y==="working"&&n.jsx(gp,{mergeInProgress:g?.mergeInProgress,rebaseInProgress:g?.rebaseInProgress,onContinue:bl,onAbort:()=>kr(kn?"merge":"rebase"),onResolveWithAI:xl,conflictCount:gl,isLoading:le!==null||Ie!==null}),Y==="turn"?n.jsx("div",{className:"min-h-0 flex-1",children:wl()}):Y!=="working"?n.jsx("div",{className:"min-h-0 flex-1",children:vl()}):pt.length>0?n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden px-2 pt-1",children:n.jsx(bp,{groups:yl,diffStats:g?.diffStats,revertingPaths:ct,onRevertAll:wr,isRevertingAll:Me,headerBackgroundClassName:"bg-transparent",onVisiblePathsChange:be})}),n.jsx("div",{"data-keyboard-rider":"",className:"oc-mobile-commit-bar shrink-0 border-t border-edge-muted bg-background px-4 py-3",children:n.jsx(xp,{stagedCount:Zt.length,commitMessage:De,onCommitMessageChange:We,generatedHighlights:nt,onInsertHighlights:pl,onGenerateMessage:hl,isGeneratingMessage:Oe,onCommit:y=>{jr({pushAfter:!1,origin:y})},onCommitAndPush:y=>{jr({pushAfter:!0,origin:y})},commitAction:Ie,networkOperationBlocked:et.blocked,gitmojiEnabled:!1,onOpenGitmojiPicker:()=>{}})})]}):n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(Bb,{})}),m&&n.jsx(yp,{open:ht,onOpenChange:Se,conflictFiles:it,directory:m,operation:gt,onAbort:()=>{kr(gt)},onNavigatedToChat:c}),n.jsx(vp,{open:dt!==null,onOpenChange:y=>{y||Xe(null)},targetBranch:dt??"",changedFileCount:g?.files?.length??0,onCommitAndSwitch:(y,$)=>_b(y,$,{targetBranch:dt,directory:m,sourceBranch:g?.current??null,git:d,publishChooser:Je,toast:pe,t:o,refreshStatusAndBranches:jt,closeDialog:()=>Xe(null),performCheckout:Ln}),onGenerateMessage:async()=>{if(!m)return"";const y=(g?.files??[]).map(fe=>fe.path).sort(),{message:$}=await Lr(m,y);return $.subject?.trim()??""},onRevertAndSwitch:async()=>{const y=dt;if(!y||!m)return;await wr((g?.files??[]).map(fe=>fe.path));const $=await d.getGitStatus(m);if(!$.isClean&&($.files?.length??0)>0){pe.error(o("gitView.dirtySwitch.revertIncomplete"));return}Xe(null),await Ln(y)}})]})},Vt=s=>{const e=oe.c(13),{message:t,description:i,loading:a,icon:r}=s,c=a===void 0?!1:a,o=r===void 0?!1:r;let d;e[0]!==c?(d=c?n.jsx(G,{name:"loader-4",className:"size-5 animate-spin text-muted-foreground"}):null,e[0]=c,e[1]=d):d=e[1];let u;e[2]!==o?(u=o?n.jsx(G,{name:"git-branch",className:"size-6 text-muted-foreground"}):null,e[2]=o,e[3]=u):u=e[3];let l;e[4]!==t?(l=n.jsx("p",{className:"typography-ui-label font-semibold text-foreground",children:t}),e[4]=t,e[5]=l):l=e[5];let f;e[6]!==i?(f=i?n.jsx("p",{className:"typography-meta text-muted-foreground",children:i}):null,e[6]=i,e[7]=f):f=e[7];let x;return e[8]!==d||e[9]!==u||e[10]!==l||e[11]!==f?(x=n.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center",children:n.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-2",children:[d,u,l,f]})}),e[8]=d,e[9]=u,e[10]=l,e[11]=f,e[12]=x):x=e[12],x},Bb=()=>{const s=oe.c(7),{t:e}=ye();let t;s[0]!==e?(t=e("mobile.changes.cleanDescription"),s[0]=e,s[1]=t):t=s[1];const i=wp(t);let a;s[2]!==e?(a=e("gitView.empty.cleanTitle"),s[2]=e,s[3]=a):a=s[3];let r;return s[4]!==i||s[5]!==a?(r=n.jsx(Vt,{icon:!0,message:a,description:i}),s[4]=i,s[5]=a,s[6]=r):r=s[6],r},Ii=s=>{const e=oe.c(70),{path:t,previousPath:i,subtitle:a,diff:r,staged:c,fileExists:o,unavailableReason:d,error:u,onBack:l,onRetry:f,onExpandContextRequest:x,pendingContextExpansion:h,contextLoading:m,commentOrigin:g}=s,b=c===void 0?!1:c,v=d===void 0?null:d,w=u===void 0?null:u,{t:k}=ye();let E;e[0]!==t?(E=qd(t)||"text",e[0]=t,e[1]=E):E=e[1];const _=E;let A;e[2]!==g||e[3]!==t?(A={fileLabel:t,origin:g},e[2]=g,e[3]=t,e[4]=A):A=e[4];const S=Kp(A);let C,j;if(e[5]!==t){const ne=t.replace(/\/$/,""),ue=ne.lastIndexOf("/");C=ne.slice(ue+1),j=ue>0?ne.slice(0,ue):null,e[5]=t,e[6]=C,e[7]=j}else C=e[6],j=e[7];const T=j,R=i?`${i} → ${T??C}`:T;let K;e[8]===Symbol.for("react.memo_cache_sentinel")?(K=me(Vs,"border-b border-edge text-foreground"),e[8]=K):K=e[8];let P;e[9]!==k?(P=k("header.actions.backAria"),e[9]=k,e[10]=P):P=e[10];let z;e[11]===Symbol.for("react.memo_cache_sentinel")?(z=n.jsx(G,{name:"arrow-left",className:"size-5"}),e[11]=z):z=e[11];let O;e[12]!==l||e[13]!==P?(O=n.jsx("button",{type:"button",className:Qt,"aria-label":P,onClick:l,children:z}),e[12]=l,e[13]=P,e[14]=O):O=e[14];const D=i?`${i} → ${t}`:t;let M;e[15]===Symbol.for("react.memo_cache_sentinel")?(M=me("oc-ui-start-align truncate",ni),e[15]=M):M=e[15];let L;e[16]!==C?(L=n.jsx("h2",{dir:"ltr",className:M,children:C}),e[16]=C,e[17]=L):L=e[17];let W;e[18]!==R?(W=R?n.jsx("span",{dir:"ltr",className:"oc-ui-start-align min-w-0 truncate",children:R}):null,e[18]=R,e[19]=W):W=e[19];let F;e[20]!==R||e[21]!==a?(F=R&&a?n.jsx("span",{"aria-hidden":!0,className:"shrink-0 opacity-60",children:"·"}):null,e[20]=R,e[21]=a,e[22]=F):F=e[22];let N;e[23]!==a?(N=a?n.jsx("span",{className:"min-w-0 max-w-full shrink-0 truncate",children:a}):null,e[23]=a,e[24]=N):N=e[24];let I;e[25]!==W||e[26]!==F||e[27]!==N?(I=n.jsxs("p",{className:"flex min-w-0 items-baseline gap-1.5 typography-micro text-muted-foreground",children:[W,F,N]}),e[25]=W,e[26]=F,e[27]=N,e[28]=I):I=e[28];let B;e[29]!==D||e[30]!==L||e[31]!==I?(B=n.jsxs("div",{className:"min-w-0 flex-1 px-1",title:D,children:[L,I]}),e[29]=D,e[30]=L,e[31]=I,e[32]=B):B=e[32];const Q=S.isOpen?"text-foreground":"text-muted-foreground";let J;e[33]!==Q?(J=me(Qt,Q),e[33]=Q,e[34]=J):J=e[34];let X;e[35]!==k?(X=k("inlineComment.actions.commentOnFile"),e[35]=k,e[36]=X):X=e[36];const q=S.isOpen;let Z;e[37]!==k?(Z=k("inlineComment.actions.commentOnFile"),e[37]=k,e[38]=Z):Z=e[38];let H;e[39]===Symbol.for("react.memo_cache_sentinel")?(H=n.jsx(G,{name:"chat-1",className:"size-5"}),e[39]=H):H=e[39];let V;e[40]!==J||e[41]!==X||e[42]!==Z||e[43]!==S.isOpen||e[44]!==S.toggle?(V=n.jsx("button",{type:"button",className:J,"aria-label":X,"aria-pressed":q,title:Z,onClick:S.toggle,children:H}),e[40]=J,e[41]=X,e[42]=Z,e[43]=S.isOpen,e[44]=S.toggle,e[45]=V):V=e[45];let se;e[46]!==O||e[47]!==B||e[48]!==V?(se=n.jsxs("header",{className:K,children:[O,B,V]}),e[46]=O,e[47]=B,e[48]=V,e[49]=se):se=e[49];let te;e[50]!==g||e[51]!==m||e[52]!==r||e[53]!==w||e[54]!==o||e[55]!==_||e[56]!==x||e[57]!==f||e[58]!==t||e[59]!==h||e[60]!==i||e[61]!==b||e[62]!==k||e[63]!==v?(te=n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:o?v==="nested_repository"?n.jsx(Vt,{icon:!0,message:k("diffView.unavailable.nestedRepositoryTitle"),description:k("diffView.unavailable.nestedRepositoryDescription")}):v==="untracked_directory"?n.jsx(Vt,{icon:!0,message:k("diffView.unavailable.untrackedDirectoryTitle"),description:k("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:k("mobile.changes.diffDetail.loadFailed")}),n.jsx("p",{className:"typography-meta text-muted-foreground",children:w}),n.jsx($e,{type:"button",size:"sm",variant:"outline",onClick:()=>f?.(),children:k("diffView.actions.retry")})]})}):r?r.submodule?n.jsx("div",{className:"p-3",children:n.jsx(mp,{state:r.submodule,staged:b})}):r.isBinary?n.jsx(Vt,{icon:!0,message:k("diffView.binary.unavailable")}):ya(t)&&Ia(r.original,r.modified)?n.jsx(bs,{outerClassName:"h-full",className:"p-3",disableHorizontal:!0,"data-diff-virtual-root":!0,"data-diff-virtual-content":!0,children:n.jsx($p,{filePath:t,original:r.original,modified:r.modified,renderText:ne=>n.jsx(Jr,{original:ne.original,modified:ne.modified,language:"text",fileName:t,commentOrigin:g,renderSideBySide:!1,wrapLines:!0,layout:"inline"})})}):i&&(r.fileDiff?r.fileDiff.hunks.length===0:r.original===r.modified)?n.jsx(Vt,{icon:!0,message:k("diffView.change.renamedFrom",{from:i})}):Jd(t)&&!r.fileDiff?n.jsx(Vt,{icon:!0,message:k("mobile.changes.diffDetail.imageUnavailable")}):n.jsx(bs,{outerClassName:"h-full",className:"p-3",useScrollShadow:!0,disableHorizontal:!0,"data-diff-virtual-root":!0,"data-diff-virtual-content":!0,children:n.jsx(Jr,{original:r.original,modified:r.modified,fileDiff:r.fileDiff,language:_,fileName:t,commentOrigin:g,renderSideBySide:!1,wrapLines:!0,layout:"inline",onExpandContextRequest:x,pendingContextExpansion:h,contextLoading:m})}):n.jsx(Vt,{loading:!0,message:k("diffView.state.loadingDiff")}):n.jsx(Vt,{icon:!0,message:k("mobile.changes.diffDetail.missingTitle"),description:k("mobile.changes.diffDetail.missingDescription")})}),e[50]=g,e[51]=m,e[52]=r,e[53]=w,e[54]=o,e[55]=_,e[56]=x,e[57]=f,e[58]=t,e[59]=h,e[60]=i,e[61]=b,e[62]=k,e[63]=v,e[64]=te):te=e[64];let re;return e[65]!==se||e[66]!==te||e[67]!==S.cards||e[68]!==S.editor?(re=n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[se,S.cards,S.editor,te]}),e[65]=se,e[66]=te,e[67]=S.cards,e[68]=S.editor,e[69]=re):re=e[69],re},_o=s=>{const e=oe.c(12),{files:t,onSelect:i}=s,{t:a}=ye();let r;e[0]!==a?(r=a("gitView.changes.changedFilesAria"),e[0]=a,e[1]=r):r=e[1];let c;if(e[2]!==t||e[3]!==i||e[4]!==a){let d;e[6]!==i||e[7]!==a?(d=u=>{const l=u.status==="A"?a("diffView.change.new"):u.status==="D"?a("diffView.change.deleted"):u.status==="R"?a("diffView.change.renamed"):u.status==="C"?a("diffView.change.copied"):a("diffView.change.modified"),f=u.status==="A"?"var(--status-success)":u.status==="D"?"var(--status-error)":u.status==="R"||u.status==="C"?"var(--status-info)":"var(--status-warning)";return n.jsx("li",{children:n.jsxs("button",{type:"button",className:"flex min-h-11 w-full items-center gap-2 rounded-md px-2 text-start touch-manipulation focus:outline-none active:bg-interactive-hover",onClick:()=>i(u.path),children:[n.jsx("span",{className:"w-4 shrink-0 text-center typography-micro font-semibold uppercase",style:{color:f},"aria-label":l,children:u.status}),n.jsx(va,{filePath:u.path,className:"size-3.5 shrink-0"}),n.jsx(Sp,{path:u.path,from:u.previousPath,nameFirst:!0,className:"flex-1 typography-ui-label"}),(u.insertions>0||u.deletions>0)&&n.jsx(jp,{insertions:u.insertions,deletions:u.deletions,hideZero:!0})]})},u.path)},e[6]=i,e[7]=a,e[8]=d):d=e[8],c=t.map(d),e[2]=t,e[3]=i,e[4]=a,e[5]=c}else c=e[5];let o;return e[9]!==r||e[10]!==c?(o=n.jsx(bs,{outerClassName:"h-full",className:"px-2 py-1",useScrollShadow:!0,disableHorizontal:!0,children:n.jsx("ul",{"aria-label":r,className:"flex flex-col",children:c})}),e[9]=r,e[10]=c,e[11]=o):o=e[11],o},zb=p.lazy(()=>Us(()=>import("./FilesView-CTKhKCjC.js").then(s=>s.F),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218])).then(s=>({default:s.FilesView}))),Ss=s=>Xs(s)??"",Pn=s=>{const e=Ss(s);return!e||e==="/"?e||"/":e.split("/").filter(Boolean).at(-1)??e},Fb=s=>{const e=Ss(s);if(!e||e==="/")return null;const t=e.lastIndexOf("/");return t<=0?e.startsWith("/")?"/":null:e.slice(0,t)},Wb=(s,e)=>{const t=Ss(s),i=Ss(e);return!i||t===i?Pn(t):t.startsWith(`${i}/`)?t.slice(i.length+1):t},$b=s=>{if(typeof s!="number"||!Number.isFinite(s)||s<0)return"";if(s<1024)return`${s} B`;const e=["KB","MB","GB"];let t=s/1024;for(const i of e){if(t<1024||i===e[e.length-1])return`${t.toFixed(t>=10?0:1)} ${i}`;t/=1024}return""},Kb=s=>{const e=oe.c(5),{onClose:t,visible:i}=s,a=i===void 0?!0:i,r=ba(),c=Ss(xa(r,er()));if(r?.kind==="preparing"){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Ca,{}),e[0]=d):d=e[0],d}let o;return e[1]!==t||e[2]!==c||e[3]!==a?(o=n.jsx(Hb,{root:c,onClose:t,visible:a},c),e[1]=t,e[2]=c,e[3]=a,e[4]=o):o=e[4],o},Hb=({root:s,onClose:e,visible:t})=>{const{t:i}=ye(),{files:a}=Yi(),r=zl(),c=Fl(V=>V.setSelectedPath),[o,d]=p.useState(()=>({type:"browser",directory:s})),[u,l]=p.useState([]),[f,x]=p.useState(!1),[h,m]=p.useState(null),[g,b]=p.useState(""),[v,w]=p.useState([]),[k,E]=p.useState(!1),_=p.useRef(0),A=o.type==="browser"?o.directory:o.returnDirectory,S=p.useRef(A);S.current=A;const C=p.useCallback(async(V,se)=>{if(!V)return;const te=!r,re=_.current+1;_.current=re,x(!0),se?.background||m(null);try{const ne=await a.listDirectory(V,{respectGitignore:te});if(_.current!==re)return;m(null),l(ne.entries.slice().sort((ue,Y)=>ue.isDirectory!==Y.isDirectory?ue.isDirectory?-1:1:ue.name.localeCompare(Y.name)))}catch(ne){if(_.current!==re)return;if(se?.background){console.error("Failed to reload mobile directory:",ne);return}l([]),m(ne instanceof Error?ne.message:i("mobile.files.error.listFailed"))}finally{_.current===re&&x(!1)}},[a,r,i]);p.useEffect(()=>{o.type==="browser"&&C(o.directory)},[C,o]);const j=p.useRef(o);j.current=o;const T=p.useRef(u);T.current=u;const R=p.useCallback(({directories:V})=>{const se=j.current;se.type==="browser"&&(V&&!V.some(te=>Ss(te)===Ss(se.directory))||T.current.length>Uf||C(se.directory,{background:!0}))},[C]);Gf({root:s,active:t,whileInactive:"hold",onChanges:R});const K=p.useCallback(async V=>{Ss(V)===Ss(S.current)&&await C(S.current)},[C]),{canUpload:P,uploadingDirectory:z,pickFiles:O,uploadElements:D}=qf({root:s,refreshDirectory:K}),M=z!==null,L=ca(),W=p.useMemo(()=>({root:s,entries:tu(L,"file")}),[L,s]);p.useEffect(()=>{if(o.type!=="browser")return;const V=g.trim();if(!V){w([]),E(!1);return}let se=!1;const te=window.setTimeout(()=>{E(!0),a.search({directory:o.directory,query:V,maxResults:40}).then(re=>{se||w(re)}).catch(()=>{se||w([])}).finally(()=>{se||E(!1)})},250);return()=>{se=!0,window.clearTimeout(te)}},[a,g,o]);const F=V=>{b(""),d({type:"browser",directory:V})},N=V=>{c(s,V),d({type:"file",path:V,returnDirectory:A||s})},I=Ge(V=>V.pendingFileFocusPath),B=Ge(V=>V.pendingFileNavigation);if(p.useEffect(()=>{const V=Ss(B?.path??I??"");!V||!s||(c(s,V,{allowOutsideRoot:!0}),d(se=>({type:"file",path:V,returnDirectory:se.type==="file"?se.returnDirectory:s})),I&&Ge.getState().setPendingFileFocusPath(null))},[I,B,s,c]),!s)return n.jsx(_n,{message:i("mobile.files.empty.noDirectory")});if(o.type==="file")return n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[n.jsxs("header",{className:me(Vs,"border-b border-edge text-foreground"),children:[n.jsx("button",{type:"button",className:Qt,"aria-label":i("header.actions.backAria"),onClick:()=>d({type:"browser",directory:o.returnDirectory}),style:{touchAction:"manipulation"},children:n.jsx(G,{name:"arrow-left",className:"size-5"})}),n.jsx("div",{className:"min-w-0 flex-1",children:n.jsx("h2",{className:me("truncate",ni),children:Pn(o.path)})})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:n.jsx(It,{children:n.jsx(p.Suspense,{fallback:n.jsx(_n,{loading:!0,message:i("filesView.state.loading")}),children:n.jsx(zb,{mode:"editor-only"})})})})]});const Q=o.directory===s?i("mobile.files.rootDirectory"):Pn(o.directory),J=g.trim()?v:[],X=Fb(o.directory),q=o.directory!==s&&X!==null&&(X===s||X.startsWith(`${s}/`)),Z=q&&!g.trim(),H=q?X:null;return n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[D,n.jsxs("div",{className:"shrink-0 px-2 pt-1",children:[n.jsx(su,{value:g,onChange:b,placeholder:i("mobile.files.search.placeholder"),actions:n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",className:Ei,"aria-label":i("mobile.files.refreshAria"),onClick:()=>{C(o.directory)},children:n.jsx(Um,{className:me("size-4",f&&"animate-spin")})}),P?n.jsx("button",{type:"button",className:Ei,"aria-label":i("sidebarFilesTree.actions.uploadFilesTitle"),onClick:()=>O(o.directory),disabled:M,children:n.jsx(G,{name:M?"loader-4":"upload-2",className:me("size-4",M&&"animate-spin")})}):null,e?n.jsx("button",{type:"button",className:Ei,"aria-label":i("mobile.surface.closeAria"),onClick:e,children:n.jsx(Gm,{className:"size-4"})}):null]})}),Z&&H?n.jsxs("button",{type:"button",className:"flex min-h-11 w-full items-center gap-2.5 rounded-md px-2 text-start active:bg-interactive-hover focus:outline-none","aria-label":i("mobile.files.backToParentAria",{name:Pn(H)}),onClick:()=>F(H),children:[n.jsx(qm,{className:"size-4 shrink-0 text-muted-foreground"}),n.jsx("span",{className:"min-w-0 truncate typography-ui-label text-muted-foreground",children:Q})]}):null]}),n.jsx(bs,{outerClassName:"min-h-0 flex-1",className:"px-2 pb-3 pt-1",useScrollShadow:!0,disableHorizontal:!0,children:h?n.jsx(_n,{message:h}):g.trim()?n.jsx(Vb,{root:s,results:J,isSearching:k,actions:W,onOpenFile:N}):n.jsxs(n.Fragment,{children:[u.length===0&&!f?n.jsx("div",{className:"px-4 py-8 text-center typography-ui-label text-muted-foreground",children:i("mobile.files.empty.directory")}):null,u.map(V=>n.jsx(ll,{name:V.name,path:V.path,directory:V.isDirectory,meta:V.isDirectory?void 0:$b(V.size),actions:W,onClick:()=>V.isDirectory?F(V.path):N(V.path)},V.path))]})})]})},Ei="-my-1 flex size-9 shrink-0 items-center justify-center rounded-full text-muted-foreground touch-manipulation focus:outline-none active:bg-interactive-hover disabled:opacity-50",ll=s=>{const e=oe.c(45),{name:t,path:i,directory:a,meta:r,actions:c,onClick:o}=s,{t:d}=ye();let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u={touchAction:"manipulation"},e[0]=u):u=e[0];let l;e[1]!==a||e[2]!==i?(l=a?n.jsx(Ym,{className:"size-4 shrink-0 text-primary/80"}):n.jsx(va,{filePath:i,className:"size-4 shrink-0"}),e[1]=a,e[2]=i,e[3]=l):l=e[3];let f;e[4]!==t?(f=n.jsx("span",{className:"block min-w-0 flex-1 truncate typography-ui-label text-foreground",children:t}),e[4]=t,e[5]=f):f=e[5];let x;e[6]!==r?(x=r?n.jsx("span",{className:"min-w-0 max-w-[55%] shrink truncate typography-micro text-muted-foreground",dir:"auto",children:r}):null,e[6]=r,e[7]=x):x=e[7];let h;e[8]!==a?(h=a?n.jsx(Qm,{className:"size-4 shrink-0 text-muted-foreground"}):null,e[8]=a,e[9]=h):h=e[9];let m;e[10]!==o||e[11]!==l||e[12]!==f||e[13]!==x||e[14]!==h?(m=n.jsxs("button",{type:"button",className:"flex min-h-11 w-full items-center gap-2.5 rounded-md px-2 text-start active:bg-interactive-hover focus:outline-none",onClick:o,style:u,children:[l,f,x,h]}),e[10]=o,e[11]=l,e[12]=f,e[13]=x,e[14]=h,e[15]=m):m=e[15];const g=m;let b;e[16]!==i||e[17]!==d?(b=()=>{qi(i).then(j=>{if(j.ok){pe.success(d("sidebarFilesTree.toast.pathCopied"));return}pe.error(d("sidebarFilesTree.toast.copyFailed"))})},e[16]=i,e[17]=d,e[18]=b):b=e[18];const v=b;let w;e[19]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx(G,{name:"link",className:"me-1 size-4"}),e[19]=w):w=e[19];let k;e[20]!==d?(k=d("sidebarFilesTree.menu.copyPath"),e[20]=d,e[21]=k):k=e[21];let E;e[22]!==v||e[23]!==k?(E=n.jsxs(cs,{onClick:v,children:[w,k]}),e[22]=v,e[23]=k,e[24]=E):E=e[24];let _;e[25]!==c.entries.length?(_=c.entries.length>0?n.jsx(da,{}):null,e[25]=c.entries.length,e[26]=_):_=e[26];let A;if(e[27]!==c.entries||e[28]!==c.root||e[29]!==a||e[30]!==i||e[31]!==d){let j;e[33]!==c.root||e[34]!==a||e[35]!==i||e[36]!==d?(j=T=>n.jsxs(cs,{onClick:()=>{nu(T,{kind:"file",action:T.action.id,directory:c.root||null,path:i,isDirectory:a},d)},children:[n.jsx(si,{icon:T.icon,iconSrc:T.iconSrc,className:"me-1 size-4"}),T.action.label]},`${T.guest.id}:${T.action.id}`),e[33]=c.root,e[34]=a,e[35]=i,e[36]=d,e[37]=j):j=e[37],A=c.entries.map(j),e[27]=c.entries,e[28]=c.root,e[29]=a,e[30]=i,e[31]=d,e[32]=A}else A=e[32];let S;e[38]!==E||e[39]!==_||e[40]!==A?(S=n.jsxs(n.Fragment,{children:[E,_,A]}),e[38]=E,e[39]=_,e[40]=A,e[41]=S):S=e[41];let C;return e[42]!==g||e[43]!==S?(C=n.jsx(mr,{menu:S,children:g}),e[42]=g,e[43]=S,e[44]=C):C=e[44],C},Vb=s=>{const e=oe.c(19),{root:t,results:i,isSearching:a,actions:r,onOpenFile:c}=s,{t:o}=ye();if(a){let l;e[0]!==o?(l=o("common.loading"),e[0]=o,e[1]=l):l=e[1];let f;return e[2]!==l?(f=n.jsx(_n,{loading:!0,message:l}),e[2]=l,e[3]=f):f=e[3],f}if(i.length===0){let l;e[4]!==o?(l=o("mobile.files.search.empty"),e[4]=o,e[5]=l):l=e[5];let f;return e[6]!==l?(f=n.jsx(_n,{message:l}),e[6]=l,e[7]=f):f=e[7],f}let d;if(e[8]!==r||e[9]!==c||e[10]!==i||e[11]!==t){let l;e[13]!==r||e[14]!==c||e[15]!==t?(l=f=>n.jsx(ll,{name:Pn(f.path),path:f.path,directory:!1,meta:Wb(f.path,t),actions:r,onClick:()=>c(f.path)},f.path),e[13]=r,e[14]=c,e[15]=t,e[16]=l):l=e[16],d=i.map(l),e[8]=r,e[9]=c,e[10]=i,e[11]=t,e[12]=d}else d=e[12];let u;return e[17]!==d?(u=n.jsx(n.Fragment,{children:d}),e[17]=d,e[18]=u):u=e[18],u},_n=s=>{const e=oe.c(7),{message:t,loading:i}=s,a=i===void 0?!1:i;let r;e[0]!==a?(r=a?n.jsx(Jm,{className:"size-5 animate-spin text-muted-foreground"}):n.jsx(Xm,{className:"size-6 text-muted-foreground"}),e[0]=a,e[1]=r):r=e[1];let c;e[2]!==t?(c=n.jsx("p",{className:"typography-ui-label font-semibold text-foreground",children:t}),e[2]=t,e[3]=c):c=e[3];let o;return e[4]!==r||e[5]!==c?(o=n.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center",children:n.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-2",children:[r,c]})}),e[4]=r,e[5]=c,e[6]=o):o=e[6],o},Ub=s=>{const e=oe.c(21),{visible:t,onLeave:i,sectionsDialogOpen:a,onSectionsDialogOpenChange:r}=s,{t:c}=ye(),o=yt(Gb),d=er()??null,u=iu(),[l,f]=p.useState(1);let x,h;e[0]!==t?(x=()=>{t&&f(qb)},h=[t],e[0]=t,e[1]=x,e[2]=h):(x=e[1],h=e[2]),p.useEffect(x,h);const m=!u.allSectionsHidden&&l===0;let g;e[3]!==d||e[4]!==u||e[5]!==i||e[6]!==o||e[7]!==t?(g=t&&!u.allSectionsHidden?n.jsx(ru.Provider,{value:i,children:n.jsx(ou.Provider,{value:!0,children:n.jsx(au,{onChange:f,children:n.jsx(bs,{useScrollShadow:!0,scrollShadowSize:24,outerClassName:"min-h-0 flex-1",className:"px-3 pb-4 pt-2",disableHorizontal:!0,children:n.jsx(lu,{sessionId:o,directory:d,repositoryEnabled:!Gi(d),layout:u})})})})}):null,e[3]=d,e[4]=u,e[5]=i,e[6]=o,e[7]=t,e[8]=g):g=e[8];let b;e[9]!==u.allSectionsHidden||e[10]!==r||e[11]!==m||e[12]!==c?(b=u.allSectionsHidden||m?n.jsxs("div",{className:"absolute inset-x-0 top-16 flex flex-col items-center px-6 text-center",children:[n.jsx("span",{className:"typography-ui-label text-muted-foreground",children:u.allSectionsHidden?c("chat.workStatus.sections.allHidden"):c("chat.workStatus.mobileEmpty")}),u.allSectionsHidden?n.jsx($e,{variant:"link",size:"sm",onClick:()=>r(!0),className:"mt-2 normal-case text-muted-foreground hover:text-foreground",children:c("chat.workStatus.sections.open")}):null]}):null,e[9]=u.allSectionsHidden,e[10]=r,e[11]=m,e[12]=c,e[13]=b):b=e[13];let v;e[14]!==r||e[15]!==a?(v=n.jsx(cu,{open:a,onOpenChange:r}),e[14]=r,e[15]=a,e[16]=v):v=e[16];let w;return e[17]!==g||e[18]!==b||e[19]!==v?(w=n.jsxs("div",{className:"relative flex h-full min-h-0 flex-col",children:[g,b,v]}),e[17]=g,e[18]=b,e[19]=v,e[20]=w):w=e[20],w};function Gb(s){return s.currentSessionId}function qb(s){return Math.max(s,1)}const Jb=p.lazy(()=>Us(()=>import("./GuestPanelContent-BY7I-Y-o.js"),__vite__mapDeps([219,2,3,5,1,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,4,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180])).then(s=>({default:s.GuestPanelContent}))),To="mobile-surface-root",Xb=16,Ao=320,Yb="cubic-bezier(0.22, 1, 0.36, 1)",Qb=({open:s,onClose:e,tab:t,onTabChange:i,pendingChangesDiff:a,pendingChangesCommit:r,onOpenPlan:c,variant:o="drawer"})=>{const{t:d,direction:u}=ye(),l=p.useRef(null),f=p.useRef(null),[x,h]=p.useState(!1),[m,g]=p.useState(s),b=p.useRef(e);p.useEffect(()=>{b.current=e},[e]);const v=Ge(N=>N.mobileWorkspaceTabOrder),w=Ge(N=>N.mobileWorkspaceHiddenTabs),k=Ge(N=>N.setMobileWorkspaceTabOrder),E=wa(),_=Qi(N=>N.guests),A=Br(N=>N.countByGuest),[S,C]=p.useState(!1),j=p.useRef(t);p.useEffect(()=>{j.current=t},[t]);const T=()=>b.current();yr(f,{enabled:o==="drawer"&&s,...u==="rtl"?{onRightEdgeSwipe:T}:{onLeftEdgeSwipe:T}});const[R,K]=p.useState(()=>new Set);p.useEffect(()=>{s&&K(N=>{if(N.has(t))return N;const I=new Set(N);return I.add(t),I})},[s,t]),p.useEffect(()=>{K(N=>{const I=[...N].filter(B=>Hn(B)&&!E.includes(B));return I.length===0?N:new Set([...N].filter(B=>!I.includes(B)))})},[E]);const P=Br(N=>N.clearBadge);if(p.useEffect(()=>{s&&Hn(t)&&P(gi(t))},[P,s,t]),typeof document<"u"&&!l.current){let N=document.getElementById(To);N||(N=document.createElement("div"),N.id=To,document.body.appendChild(N)),l.current=N}if(p.useEffect(()=>{if(s){g(!0);const I=window.setTimeout(()=>h(!0),Xb);return()=>window.clearTimeout(I)}h(!1);const N=window.setTimeout(()=>g(!1),Ao+40);return()=>window.clearTimeout(N)},[s]),p.useEffect(()=>{if(!s)return;const N=document.body.style.overflow;o==="drawer"&&(document.body.style.overflow="hidden");const I=B=>{B.key!=="Escape"||j.current==="terminal"||mu(B.target)||ga(B)||b.current()};return document.addEventListener("keydown",I),()=>{o==="drawer"&&(document.body.style.overflow=N),document.removeEventListener("keydown",I)}},[s,o]),o==="drawer"&&!l.current)return null;const z={status:{id:"status",label:d("chat.workStatus.ariaLabel"),icon:n.jsx(G,{name:"list-indefinite",className:"h-3.5 w-3.5"})},changes:{id:"changes",label:d("mobile.menu.git"),icon:n.jsx(G,{name:"git-branch",className:"h-3.5 w-3.5"})},files:{id:"files",label:d("mobile.menu.files"),icon:n.jsx(G,{name:"file-text",className:"h-3.5 w-3.5"})},terminal:{id:"terminal",label:d("mobile.menu.terminal"),icon:n.jsx(G,{name:"terminal",className:"h-3.5 w-3.5"})},notes:{id:"notes",label:d("contextRail.surface.notes"),icon:n.jsx(G,{name:"sticky-note",className:"h-3.5 w-3.5"})}},O=N=>{const I=gi(N),B=_.find(X=>X.id===I),Q=B?.name??I,J=A[I]??0;return{id:N,label:Q,title:J>0?d(J===1?"contextRail.surface.plugin.badgeAriaSingle":"contextRail.surface.plugin.badgeAriaPlural",{label:Q,count:J}):Q,icon:n.jsxs("span",{className:"relative flex",children:[n.jsx(si,{icon:pa(B?.icon??""),iconSrc:B?ma(B.id,B.icon,Vo().authenticatedAsset):void 0,className:"h-3.5 w-3.5"}),J>0?n.jsx("span",{"aria-hidden":"true",className:"absolute -top-1.5 -end-1.5 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-[var(--status-info)] px-0.5 text-[0.5625rem] font-medium leading-none text-[var(--status-info-foreground)]",children:J>99?"99+":J}):null]})}},D=Wl(v,w,t,E),M=D.map(N=>Hn(N)?O(N):z[N]),L=M.length===1?M[0]:null,W=(N,I)=>{const B=$l(v,E),Q=B.findIndex(X=>X===N),J=B.findIndex(X=>X===I);Q<0||J<0||k(Wm(B,Q,J))},F=n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:Vs,children:[n.jsx("div",{className:"flex h-9 min-w-0 flex-1 items-center",children:L?n.jsxs("h2",{className:"flex min-w-0 items-center gap-2 px-1 typography-ui-label font-medium text-foreground",children:[n.jsx("span",{className:"flex shrink-0 text-muted-foreground",children:L.icon}),n.jsx("span",{className:"truncate",children:L.label})]}):m?n.jsx(du,{items:M,activeId:t,onSelect:N=>{const I=D.find(B=>B===N);I&&i(I)},onReorder:W,layoutMode:M.length>5?"scrollable":"fit",variant:"active-pill",nonCompositedIndicator:!0,inactiveTabsIconOnly:M.length>3,className:"h-full"}):null}),t==="status"?n.jsx("button",{type:"button",className:Qt,"aria-label":d("chat.workStatus.sections.open"),onClick:()=>C(!0),style:{touchAction:"manipulation"},children:n.jsx(G,{name:"list-settings",className:"size-5"})}):null,n.jsx("button",{type:"button",className:Qt,"aria-label":d("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:[R.has("status")?n.jsx("div",{className:me("h-full",t!=="status"&&"hidden"),children:n.jsx(It,{children:n.jsx(Ub,{visible:s&&t==="status",onLeave:e,sectionsDialogOpen:S,onSectionsDialogOpenChange:C})})}):null,R.has("changes")?n.jsx("div",{className:me("h-full",t!=="changes"&&"hidden"),children:n.jsx(It,{children:n.jsx(Ob,{visible:s&&t==="changes",initialDiff:a,initialCommit:r,onNavigatedToChat:e})})},a?`changes:${a.path}:${a.staged}`:"changes"):null,R.has("files")?n.jsx("div",{className:me("h-full",t!=="files"&&"hidden"),children:n.jsx(It,{children:n.jsx(Kb,{visible:s&&t==="files"})})}):null,R.has("terminal")?n.jsx("div",{className:me("h-full",t!=="terminal"&&"hidden"),children:n.jsx(It,{children:n.jsx(Jf,{visible:s&&t==="terminal"})})}):null,R.has("notes")?n.jsx("div",{className:me("h-full",t!=="notes"&&"hidden"),children:n.jsx(It,{children:n.jsx(Xf,{visible:s&&t==="notes",onActionComplete:e,onOpenPlan:c})})}):null,E.map(N=>{if(!R.has(N))return null;const I=_.find(B=>B.id===gi(N));return I?n.jsx("div",{className:me("h-full",t!==N&&"hidden"),children:n.jsx(It,{children:n.jsx(p.Suspense,{fallback:null,children:n.jsx(Jb,{mode:N,sharedSurface:fu(I),docking:uu(I),surfaceMounted:s&&t===N})})})},N):null})]})]});return o==="panel"?n.jsx("div",{className:"flex h-full min-h-0 flex-col bg-background text-foreground",children:F}):Tn.createPortal(n.jsx("section",{ref:f,role:"dialog","aria-modal":"true","aria-label":d("mobile.header.openWorkspaceAria"),"aria-hidden":!s,className:"oc-keyboard-inset-surface oc-bottom-safe-surface oc-side-safe-area fixed inset-0 z-50 flex flex-col bg-background text-foreground",style:{paddingTop:"var(--oc-safe-area-top, 0px)",transform:x?"none":u==="rtl"?"translateX(-100%)":"translateX(100%)",transition:`transform ${Ao}ms ${Yb}`,visibility:m?"visible":"hidden",pointerEvents:s?"auto":"none"},children:F}),l.current)};function Zb(s){const e=oe.c(4),t=2500,{uiFont:i}=pu(),[a,r]=p.useState(!1);let c,o;return e[0]!==t||e[1]!==i?(c=()=>{let d=!1;const u=()=>{d||r(!0)},l=()=>{requestAnimationFrame(()=>requestAnimationFrame(u))},f=Promise.all([hu(i).catch(ix),document.fonts?.ready?.then(nx).catch(sx)??Promise.resolve(),Hp.catch(tx)]).then(ex),x=new Promise(h=>{window.setTimeout(h,t)});return Promise.race([f,x]).then(l),()=>{d=!0}},o=[i,t],e[0]=t,e[1]=i,e[2]=c,e[3]=o):(c=e[2],o=e[3]),p.useEffect(c,o),a}function ex(){}function tx(){}function sx(){}function nx(){}function ix(){}const rx=sr({projectId:ln().trim().min(1).optional(),text:ln().optional()}),ox=sr({request:rx.nullish()}),cl=Na("ShortcutRequests"),ax=async()=>{const s=ox.safeParse(await cl.takePending());return s.success?s.data.request??null:null},lx=s=>{if(Ui()!=="ios")return()=>{};let e=!1,t=null;const i=()=>{ax().then(a=>{a&&s(a)}).catch(()=>{})};return cl.addListener("pending",i).then(a=>{if(e){a.remove();return}t=a}).catch(()=>{}),i(),()=>{e=!0,t?.remove()}},cx="openchamber",dx=s=>s.replace(/^\/+|\/+$/g,""),ux=s=>{const e=dx(s.pathname).split("/").filter(Boolean);return s.host?[s.host,...e]:e};function fx(s){if(typeof s!="string"||s.length===0)return null;let e;try{e=new URL(s)}catch{return null}if(e.protocol!==`${cx}:`)return null;const t=ux(e),i=(t[0]??"").toLowerCase(),a=t.slice(1),r=e.searchParams;switch(i){case"session":{const c=a[0]||r.get("id")||"";if(!c)return null;const o=r.get("message")?.trim()??"";return{type:"session",sessionId:c,directory:r.get("dir")??void 0,...gu(o)?{messageId:o}:{}}}case"new":case"new-session":return{type:"new-session",directory:r.get("dir")??void 0,projectId:r.get("project")??void 0,agent:r.get("agent")??void 0,model:r.get("model")??void 0};case"sessions":{const c=r.get("filter");return{type:"sessions",filter:c==="attention"||c==="recent"||c==="all"?c:void 0}}case"status":return{type:"status"};case"settings":return{type:"settings",section:a[0]||r.get("section")||void 0};case"changes":return{type:"changes",path:a.join("/")||r.get("path")||void 0,staged:r.get("staged")==="true"};case"view":{const c=(a[0]||"").toLowerCase();return c==="changes"?{type:"changes"}:c==="files"||c==="mcp"||c==="instances"||c==="update"?{type:"view",target:c}:null}default:return null}}let ls={},dl=!1,In=null;const mx=s=>{const e=yt.getState(),t=s.projectId?Yt.getState().projects.find(a=>a.id===s.projectId)??null:null;e.openNewSessionDraft(t?{selectedProjectId:t.id}:void 0);const i=s.text?.trim();if(i){if(s.projectId&&!t){zr.getState().setPendingInputText(i,"append");return}zr.getState().requestDraftSubmit(yt.getState().newSessionDraft.draftId,i)}},px=s=>{switch(s.type){case"shortcut-new-session":return mx(s),!0;case"session":return bu(s.sessionId,{directory:s.directory??null,messageId:s.messageId??null}),!0;case"new-session":{const e=yt.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 ls.openSessions?(ls.openSessions(s.filter),!0):!1;case"status":return ls.openSessions?(ls.openSessions(),!0):!1;case"view":return ls.openView?(ls.openView(s.target),!0):!1;case"changes":return ls.openChanges?(ls.openChanges({path:s.path,staged:s.staged}),!0):!1;case"settings":return ls.openSettings?(ls.openSettings(s.section),!0):!1}},vr=()=>{if(!dl||!In)return;const s=In;In=null,px(s)||(In=s)},Vi=s=>{In=s,vr()},Do=s=>{const e=fx(s);e&&Vi(e)},hx=s=>{dl=s,vr()},gx=s=>{const e=oe.c(3);let t,i;e[0]!==s?(t=()=>(ls=s,vr(),()=>{ls===s&&(ls={})}),i=[s],e[0]=s,e[1]=t,e[2]=i):(t=e[1],i=e[2]),p.useEffect(t,i)},bx=s=>{const{ready:e}=s;p.useEffect(()=>{hx(e)},[e]),p.useEffect(()=>{if(!Pt())return;let t=!1;const i=[];return Us(()=>import("./vendor-capacitor-app-BrDJj9I_.js"),__vite__mapDeps([220,1,109])).then(async({App:a})=>{if(t)return;const r=await a.addListener("appUrlOpen",c=>{Do(c?.url)});if(t){r.remove();return}i.push(()=>{r.remove()})}).catch(()=>{}),i.push(lx(a=>{Vi({type:"shortcut-new-session",projectId:a.projectId,text:a.text})})),Us(()=>import("./vendor-capacitor-push-notifications-KNe1zSBF.js"),__vite__mapDeps([221,109])).then(async({PushNotifications:a})=>{if(t)return;const r=await a.addListener("pushNotificationActionPerformed",c=>{const o=c?.notification?.data,d=typeof o?.url=="string"?o.url:typeof o?.deeplink=="string"?o.deeplink:void 0;if(d){Do(d);return}const u=typeof o?.sessionId=="string"?o.sessionId:void 0;u&&Vi({type:"session",sessionId:u})});if(t){r.remove();return}i.push(()=>{r.remove()})}).catch(()=>{}),()=>{t=!0,i.forEach(a=>a())}},[])},xx=()=>{if(typeof window>"u")return;const s=window.__OPENCHAMBER_APNS_ENV__;if(s==="development")return"sandbox";if(s==="production")return"production"},Mo=/^[A-Za-z0-9+/]{43}=$/,yx=Na("PushKey"),vx=async()=>{const s=window.__OPENCHAMBER_PUSH_KEY__;if(s&&Mo.test(s))return s;const e=await yx.get().then(t=>t.key).catch(()=>{});return e&&Mo.test(e)?e:void 0},wx=()=>{if(typeof window>"u")return!1;const e=window.Capacitor?.getPlatform?.();return e==="ios"||e==="android"},jx=s=>{const{enabled:e}=s,t=Ge(a=>a.nativeNotificationsEnabled),i=p.useRef(null);p.useEffect(()=>{if(!e||!t||!wx())return;let a=!1;const r=[];return Us(()=>import("./vendor-capacitor-push-notifications-KNe1zSBF.js"),__vite__mapDeps([221,109])).then(async({PushNotifications:c})=>{if(a)return;let o=await c.checkPermissions().catch(()=>null);if(o?.receive!=="granted"&&(o=await c.requestPermissions().catch(()=>null)),o?.receive!=="granted")return;const d=await c.addListener("registration",l=>{i.current=l.value,vx().then(f=>{const x=Er(),h={token:l.value,platform:Ui(),environment:xx()};f&&(h.pushKey=f),x?.push?.registerApnsToken?.(h)})}),u=await c.addListener("registrationError",l=>{console.warn("[Push] APNs registration error:",l)});if(await c.register().catch(()=>{}),a){d.remove(),u.remove();return}r.push(()=>{d.remove()},()=>{u.remove()})}).catch(()=>{}),()=>{a=!0,r.forEach(c=>c())}},[e,t]),p.useEffect(()=>{if(t)return;const a=i.current;if(!a)return;i.current=null,Er()?.push?.unregisterApnsToken?.({token:a})},[t])},Oo=s=>{const e=oe.c(12),{side:t,isResizing:i,ariaLabel:a,handleProps:r}=s,c=t==="left"?"inset-e-0":"inset-s-0";let o;e[0]!==c?(o=me("absolute inset-y-0 z-50 w-6 cursor-col-resize touch-none",c),e[0]=c,e[1]=o):o=e[1];const d=t==="left"?"inset-e-0":"inset-s-0",u=i&&"bg-[var(--interactive-border)]";let l;e[2]!==d||e[3]!==u?(l=me("absolute inset-y-0 w-[3px] transition-colors",d,u),e[2]=d,e[3]=u,e[4]=l):l=e[4];let f;e[5]!==l?(f=n.jsx("div",{className:l}),e[5]=l,e[6]=f):f=e[6];let x;return e[7]!==a||e[8]!==r||e[9]!==o||e[10]!==f?(x=n.jsx("div",{className:o,role:"separator","aria-orientation":"vertical","aria-label":a,...r,children:f}),e[7]=a,e[8]=r,e[9]=o,e[10]=f,e[11]=x):x=e[11],x},kx=320,Sx=380,Lo=280,Cx=560,Nx=900;function Bo(s,e,t,i){const a=oe.c(23),r=i===void 0?Cx:i,c=p.useRef(null);let o;a[0]!==t||a[1]!==r||a[2]!==e?(o=()=>{if(typeof window>"u")return t;const P=Number.parseInt(window.localStorage.getItem(e)??"",10);return Number.isFinite(P)?Math.min(r,Math.max(Lo,P)):t},a[0]=t,a[1]=r,a[2]=e,a[3]=o):o=a[3];const[d,u]=p.useState(o),[l,f]=p.useState(!1),x=p.useRef(0),h=p.useRef(d),m=p.useRef(null),g=p.useRef(null);let b;a[4]!==r?(b=P=>Math.min(r,Math.max(Lo,Math.round(P))),a[4]=r,a[5]=b):b=a[5];const v=b;let w;a[6]===Symbol.for("react.memo_cache_sentinel")?(w=P=>{const z=c.current;z&&(z.style.width=`${P}px`,z.style.minWidth=`${P}px`,z.style.maxWidth=`${P}px`,z.style.setProperty("--oc-ipad-sidebar-width",`${P}px`))},a[6]=w):w=a[6];const k=w;let E;a[7]!==d?(E=P=>{try{P.currentTarget.setPointerCapture(P.pointerId)}catch{}g.current=P.pointerId,x.current=P.clientX,h.current=d,m.current=d,f(!0),P.preventDefault()},a[7]=d,a[8]=E):E=a[8];const _=E;let A;a[9]!==v||a[10]!==s?(A=P=>{if(g.current!==P.pointerId)return;const z=(s==="left"?1:-1)*(Kl(P.currentTarget)?-1:1),O=v(h.current+(P.clientX-x.current)*z);m.current!==O&&(m.current=O,k(O))},a[9]=v,a[10]=s,a[11]=A):A=a[11];const S=A;let C;a[12]!==v||a[13]!==e?(C=P=>{if(g.current!==P.pointerId)return;try{P.currentTarget.releasePointerCapture(P.pointerId)}catch{}const z=v(m.current??h.current);g.current=null,m.current=null,f(!1),u(z);try{window.localStorage.setItem(e,String(z))}catch{}},a[12]=v,a[13]=e,a[14]=C):C=a[14];const j=C;let T;a[15]!==_||a[16]!==j||a[17]!==S?(T={onPointerDown:_,onPointerMove:S,onPointerUp:j,onPointerCancel:j},a[15]=_,a[16]=j,a[17]=S,a[18]=T):T=a[18];const R=T;let K;return a[19]!==R||a[20]!==l||a[21]!==d?(K={asideRef:c,width:d,isResizing:l,handleProps:R},a[19]=R,a[20]=l,a[21]=d,a[22]=K):K=a[22],K}const Rx=()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,Ix=200;function zo(s){const e=oe.c(6),[t,i]=p.useState(!1),[a,r]=p.useState(s);s!==a&&(r(s),i(!s&&!Rx()));let c,o;e[0]!==t?(c=()=>{if(!t)return;const l=window.setTimeout(()=>i(!1),Ix);return()=>window.clearTimeout(l)},o=[t],e[0]=t,e[1]=c,e[2]=o):(c=e[1],o=e[2]),p.useEffect(c,o);const d=s||t;let u;return e[3]!==s||e[4]!==d?(u={placed:d,inPlace:s},e[3]=s,e[4]=d,e[5]=u):u=e[5],u}const Fo=["general","isolated-spaces","appearance","chat","notifications","sessions","routing","projects","git","magic-prompts","snippets","behavior","agents","commands","mcp","plugins","skills.installed","skills.catalog","providers","web-search","usage","voice","integrations","extensions","about"],Ex=1e3,Px=p.lazy(()=>Us(()=>import("./useAppFontEffects-xaAfmUwn.js").then(s=>s.ue),__vite__mapDeps([4,2,3,5,1,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180])).then(s=>({default:s.PluginPane}))),_x=({onActiveConnectionDeleted:s})=>{const{t:e,direction:t}=ye();bm();const[i,a]=p.useState(!1);p.useEffect(()=>yt.subscribe((U,Ce)=>{U.currentSessionId&&U.currentSessionId!==Ce.currentSessionId&&Ge.getState().setRunOverviewKey(null)}),[]);const r=Ge(U=>U.runOverviewKey!==null);p.useEffect(()=>{r&&a(!1)},[r]);const[c,o]=p.useState(null),[d,u]=p.useState(!1),[l,f]=p.useState(()=>{const{mobileWorkspaceTabOrder:U,mobileWorkspaceHiddenTabs:Ce}=Ge.getState();return bi(U,Ce)[0]}),x=p.useCallback(()=>{const{mobileWorkspaceTabOrder:U,mobileWorkspaceHiddenTabs:Ce}=Ge.getState(),qe=Au(Qi.getState().guests),he=bi(U,Ce,qe);f(ut=>he.includes(ut)?ut:he[0]),u(!0)},[]),[h,m]=p.useState(null),[g,b]=p.useState("nav"),[v,w]=p.useState(null),k=v&&"diff"in v?v.diff:null,E=v&&"commit"in v?v.commit:null,_=wa();p.useEffect(()=>{if(!Hn(l)||_.includes(l))return;const{mobileWorkspaceTabOrder:U,mobileWorkspaceHiddenTabs:Ce}=Ge.getState();f(bi(U,Ce,_)[0])},[_,l]);const A=Ge(U=>U.openGuestPageId),C=fa().find(U=>U.id===A)??null;p.useEffect(()=>{A&&!C&&Ge.getState().setOpenGuestPage(null)},[C,A]);const j=p.useCallback(()=>Ge.getState().setOpenGuestPage(null),[]),T=Ge(U=>U.setSettingsPage),R=Ge(U=>U.wideChatLayoutEnabled),K=$s(U=>U.available),P=$s(U=>U.runtimeType),z=p.useMemo(()=>tr(),[]),O=p.useCallback(()=>{o(null),m(null)},[]),D=p.useCallback(U=>{o(U)},[]),M=p.useCallback(()=>{u(!1)},[]),L=p.useCallback(U=>{b(U),D("settings")},[D]);p.useEffect(()=>Ib(Fo,L),[L]);const{enabled:W,roomyForPanels:F,roomyForOnePanel:N}=Ji(),I=F||N,Q=Du()==="portrait",J=Mu(),[X,q]=p.useState(()=>{const U=Ou();return U.roomyForPanels||U.roomyForOnePanel}),Z=p.useCallback(()=>{q(U=>!U)},[]),H=p.useRef(W);p.useEffect(()=>{W?!H.current&&!d&&q(!0):q(!1),H.current=W},[W,d]);const V=p.useCallback(()=>{w(null),f("files"),u(!0)},[]);p.useEffect(()=>Wr(U=>{if(U.type!=="file-open-request")return;const Ce=U.directory??an.getState().currentDirectory;if(!Ce)return;const qe=()=>{Ge.getState().openContextFile(Ce,U.path),V()},{sessionId:he}=U;if(!he){qe();return}Nb(he,async lt=>gn.getState().entityById.get(lt)??await _i.getSession(lt).catch(()=>null)).then(lt=>{const Ct=()=>{const{currentSessionId:Je}=yt.getState();return Je===he||lt.some(et=>et.id===Je)};if(Ct()){qe();return}const ft=lt[0]?.title;pe.info(Rb(U.path),{id:`file-open-${he}:${U.path}`,description:ft?e("chat.fileOpenRequest.toast.description",{session:ft}):e("chat.fileOpenRequest.toast.descriptionUntitled"),action:{label:e("chat.fileOpenRequest.toast.openSession"),onClick:()=>{Lu(he,Ce),O(),a(!1),Ct()&&qe()}}})})}),[O,V,e]),p.useEffect(()=>Wr(U=>{if(U.type!=="plan-open-request")return;const Ce=Bu(U.directory??an.getState().currentDirectory,U.projectId);Ce&&m({id:U.planId,title:U.title,projectRef:Ce})}),[]);const se=p.useCallback((U=null)=>{w(U?{diff:U}:null),f("changes"),u(!0)},[]);p.useEffect(()=>Ul(U=>{Ge.getState().setOpenGuestPage(null),U.tab==="changes"&&U.commit&&w({commit:{scope:"commit",directory:U.commit.directory}}),f(U.tab),u(!0)}),[]);const te=Bo("left","openchamber.ipad.leftSidebarWidth",kx),re=Bo("right","openchamber.ipad.rightSidebarWidth",Sx,Nx),ne=F||N,ue=p.useRef(null),Y=p.useRef({sidebarOpen:X,workspaceOpen:d});p.useLayoutEffect(()=>{const U=Y.current;if(Y.current={sidebarOpen:X,workspaceOpen:d},!N){const he=ue.current;ue.current=null,F&&he==="sidebar"?q(!0):F&&he==="workspace"&&u(!0);return}const Ce=X&&!U.sidebarOpen,qe=d&&!U.workspaceOpen;if(X&&d){Ce&&!qe?(ue.current="workspace",u(!1)):(ue.current="sidebar",q(!1));return}!d&&U.workspaceOpen&&ue.current==="sidebar"?(ue.current=null,q(!0)):!X&&U.sidebarOpen&&ue.current==="workspace"&&(ue.current=null,u(!0))},[N,F,X,d]);const ie=zo(W&&X),ae=zo(ne&&d),Pe=N&&X,Be=N&&d,xe=ne&&ae.placed&&!Pe?re.width:0,Re=W&&ie.placed&&!Be?te.width:0,le=t==="rtl"?"100%":"-100%",ce=t==="rtl"?"-100%":"100%";p.useEffect(()=>($r.setState({left:Re,right:xe}),()=>$r.setState({left:0,right:0})),[Re,xe]),p.useEffect(()=>{if(typeof document>"u")return;const U=document.documentElement;return U.classList.toggle("wide-chat-layout",R),()=>U.classList.remove("wide-chat-layout")},[R]),p.useEffect(()=>{if(typeof document>"u")return;const U=W&&(Q||J),Ce=document.documentElement;return Ce.classList.toggle("oc-keep-draft-starters",U),()=>Ce.classList.remove("oc-keep-draft-starters")},[J,W,Q]);const Ie=p.useMemo(()=>({openChanges:({diffPath:U,staged:Ce,scope:qe}={})=>{se(U?{path:U,staged:Ce===!0,scope:qe}:null)},openFiles:()=>V(),openSourceBoard:()=>D("board"),openPlan:m}),[se,V,D]),Ne=p.useMemo(()=>({openSessions:()=>{W?q(!0):a(!0)},openView:U=>{if(U==="files"){V();return}if(U==="mcp"){f("status"),u(!0);return}D(U)},openChanges:({path:U,staged:Ce}={})=>{se(U?{path:U,staged:Ce===!0}:null)},openSettings:U=>{U&&T(U),L(U?"page-content":"nav")}}),[W,se,V,L,D,T]);gx(Ne);const je=p.useRef(null),De=()=>{W?q(!0):a(!0)},We=()=>x();yr(je,{onLeftEdgeSwipe:t==="rtl"?We:De,onRightEdgeSwipe:t==="rtl"?De:We});const ct=p.useRef(null),Ue=p.useCallback(U=>{ct.current=U},[]),Me=p.useCallback(()=>zu()?!0:h?(m(null),!0):C?(j(),!0):c==="settings"&&ct.current?.()?!0:c?(O(),!0):d?(M(),!0):i?(a(!1),!0):!1,[c,j,O,M,C,h,i,d]);Fu(Me),Wu(Me,!!(h||C||c||d||i));const He=!z&&K&&(P==="desktop"||P==="web"),Oe=W?"dialog":"fullscreen",rt=Ge(U=>U.overviewFeatureAvailable),nt=p.useMemo(()=>({instanceLabel:z?Ws():null,onOpenInstances:z?()=>D("instances"):void 0,onOpenSettings:()=>L("nav"),onOpenUsage:()=>D("usage"),onOpenScheduled:()=>D("scheduled"),onOpenArchive:()=>D("archive"),onOpenOverview:rt?()=>D("overview"):void 0,onOpenSourceBoard:()=>D("board"),onOpenUpdate:He?()=>D("update"):void 0}),[L,D,rt,z,He]),st=p.useCallback(U=>{O(),a(!1),U==="file"&&V()},[O,V]),ee=p.useCallback(()=>{O(),a(!1)},[O]),be=p.useCallback(()=>{O(),a(!1),W&&!I&&q(!1)},[O,W,I]),Ze=p.useCallback(()=>{O(),a(!1),W&&!I&&q(!1)},[O,W,I]);return n.jsx($u,{actions:Ie,children:n.jsxs("div",{className:"oc-mobile-app-shell main-content-safe-area oc-side-safe-area flex h-[100dvh] flex-row bg-background text-foreground","data-page-scroll-lock":"true",children:[W?n.jsxs("aside",{ref:te.asideRef,className:me("oc-ipad-sidebar relative flex h-full shrink-0 flex-col overflow-hidden"),style:{width:Re,minWidth:Re,maxWidth:Re,"--oc-ipad-sidebar-width":`${te.width}px`,overflowX:"clip"},"aria-hidden":!X,"data-page-scroll-lock":"true",children:[n.jsx("div",{className:me("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",te.isResizing&&"pointer-events-none",!X&&"pointer-events-none select-none"),style:{width:"var(--oc-ipad-sidebar-width)",overflowX:"hidden",paddingTop:"var(--oc-safe-area-top, 0px)",translate:ie.inPlace?void 0:le},children:n.jsx(It,{children:n.jsx(wo,{open:ie.placed,variant:"sidebar",onOpenChange:U=>{!U&&!I&&q(!1)},footer:nt})})}),X?n.jsx(Oo,{side:"left",isResizing:te.isResizing,ariaLabel:e("sidebar.resize.leftPanelAria"),handleProps:te.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(x1,{onOpenSessions:()=>W?Z():a(!0),onOpenWorkspace:x,compactTitle:W}),n.jsxs("main",{ref:je,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(It,{children:n.jsx(xm,{})})}),n.jsx(It,{children:n.jsx(Im,{})})]})]}),W?null:n.jsx(wo,{open:i,onOpenChange:a,footer:nt}),n.jsxs("aside",{ref:re.asideRef,className:me("relative flex h-full shrink-0 flex-col overflow-hidden"),style:{width:xe,minWidth:xe,maxWidth:xe,"--oc-ipad-sidebar-width":`${re.width}px`,overflowX:"clip"},"aria-hidden":!xe,"data-page-scroll-lock":"true",children:[n.jsx("div",{className:me("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",ne&&"border-s border-edge bg-background",re.isResizing&&"pointer-events-none",!ae.inPlace&&"pointer-events-none select-none"),style:{width:"var(--oc-ipad-sidebar-width)",overflowX:"hidden",paddingTop:"var(--oc-safe-area-top, 0px)",translate:ae.inPlace?void 0:ce},children:n.jsx(It,{children:n.jsx(Qb,{open:ne?ae.placed:d,onClose:M,tab:l,onTabChange:f,pendingChangesDiff:k,pendingChangesCommit:E,onOpenPlan:m,variant:ne?"panel":"drawer"})})}),ne&&d?n.jsx(Oo,{side:"right",isResizing:re.isResizing,ariaLabel:e("sidebar.resize.rightPanelAria"),handleProps:re.handleProps}):null]}),h?n.jsx(gs,{open:!0,variant:Oe,onClose:()=>m(null),ariaLabel:h.title,title:h.title,children:n.jsx(It,{children:n.jsx(Sm,{savedProjectPlan:{projectRef:h.projectRef,planId:h.id},onClose:()=>m(null),onNavigatedToChat:()=>{O(),M()}})})}):null,C?n.jsx(gs,{open:!0,variant:Oe,dialogAlign:"app",onClose:j,ariaLabel:C.pageTitle??C.name,title:C.pageTitle??C.name,disableEscapeDismiss:!0,children:n.jsx(It,{children:n.jsx(p.Suspense,{fallback:null,children:n.jsx(Px,{mode:Ho(C.id),surface:"page"},C.id)})})}):null,n.jsx(It,{children:n.jsx(Ku,{})}),c==="instances"&&z?n.jsx(gs,{open:!0,variant:Oe,dialogAlign:"app",onClose:O,ariaLabel:e("mobile.menu.instances"),title:e("mobile.menu.instances"),children:n.jsx(k1,{onConnect:O,onActiveConnectionDeleted:s})}):null,c==="settings"?n.jsx(gs,{open:!0,variant:Oe,dialogAlign:"app",onClose:O,ariaLabel:e("mobile.menu.settings"),headerless:!0,children:n.jsx(It,{children:n.jsx(jm,{forceMobile:!0,isWindowed:!0,initialMobileStage:g,registerBackHandler:Ue,visiblePageSlugs:[...Fo],onClose:O})})}):null,c==="usage"?n.jsx(gs,{open:!0,variant:Oe,dialogAlign:"app",onClose:O,ariaLabel:e("usageStats.title"),title:e("usageStats.title"),children:n.jsx(It,{children:n.jsx(tp,{})})}):null,c==="scheduled"?n.jsx(gs,{open:!0,variant:Oe,dialogAlign:"app",onClose:O,ariaLabel:e("sessions.scheduledTasks.dialog.title"),title:e("sessions.scheduledTasks.dialog.title"),children:n.jsx(It,{children:n.jsx(rp,{layout:"mobile",onLeave:st})})}):null,c==="board"?n.jsx(gs,{open:!0,variant:Oe,dialogAlign:"app",onClose:O,ariaLabel:e("sourceBoard.title"),headerless:!0,children:n.jsx(It,{children:n.jsx(np,{onLeave:ee,onClose:O})})}):null,c==="overview"&&rt?n.jsx(gs,{open:!0,variant:Oe,dialogAlign:"app",onClose:O,ariaLabel:e("overview.title"),title:e("overview.title"),children:n.jsx(It,{children:n.jsx(ip,{layout:"mobile",onLeave:be})})}):null,c==="archive"?n.jsx(gs,{open:!0,variant:Oe,dialogAlign:"app",onClose:O,ariaLabel:e("sessions.archivePage.title"),title:e("sessions.archivePage.title"),children:n.jsx(It,{children:n.jsx(sp,{layout:"mobile",onLeave:Ze})})}):null,c==="update"?n.jsx(gs,{open:!0,variant:Oe,dialogAlign:"app",onClose:O,ariaLabel:e("mobile.menu.update"),title:e("mobile.menu.update"),children:n.jsx(It,{children:n.jsx(bs,{outerClassName:"h-full",className:"px-5 py-4",disableHorizontal:!0,children:n.jsx(km,{initialUpdateDialogOpen:!0})})})}):null]})})};function Tx(s){const e=oe.c(141),{apis:t}=s,i=Ge(ay),{t:a}=ye(),r=ss(oy),c=ss(ry),o=ss(iy),d=ss(ny),u=ss(sy),l=ss(ty),f=ss(ey),x=ss(Zx),h=an(Qx),m=yt(Yx),g=yt(Xx),b=Ge(Jx),v=Bi(qx),w=Hl(Gx),k=gn(Ux);let E;e[0]!==k?(E=k??[],e[0]=k,e[1]=E):E=e[1];const _=E,A=k!=null;let S;e[2]!==_||e[3]!==A?(S={hasAuthoritativeGlobalSessions:A,sessions:_},e[2]=_,e[3]=A,e[4]=S):S=e[4],Yf(S);const[C,j]=p.useState(0),[T,R]=p.useState(0),[K,P]=p.useState(!1),[z,O]=p.useState("pending"),[D,M]=p.useState(null);let L;e[5]===Symbol.for("react.memo_cache_sentinel")?(L=Ws(),e[5]=L):L=e[5];const W=L,[,F]=p.useReducer(Vx,0);let N;e[6]===Symbol.for("react.memo_cache_sentinel")?(N=tr(),e[6]=N):N=e[6];const I=N,B=p.useRef(0),Q=p.useRef(0);let J;e[7]!==l||e[8]!==t.sourceControl||e[9]!==t.trackers||e[10]!==r||e[11]!==x||e[12]!==f||e[13]!==u||e[14]!==v||e[15]!==w?(J=()=>{const ge=ms(),de=Q.current+1;if(Q.current=de,!ge){Cn("resume:auto-connect",{}),Nn();return}Cn("resume:reprobe",{});const Te=()=>{r(),w(t.sourceControl),v(t.sourceControl,{force:!0}),Fr(t.trackers),u===0&&f({source:"mobileApp:nativeResume"}),l===0&&x({source:"mobileApp:nativeResume"})},Ae=tt=>{Cn("resume:disconnect",{reason:tt}),Qs({apiBaseUrl:"",clientToken:null,runtimeKey:Fn}),j(Hx)};Gn().then(tt=>{if(Q.current===de){if(tt==="no-connection"){Ae("no-connection");return}if(tt==="needs-login"){M({kind:"auth-expired",label:Ws()??""}),Ae("needs-login");return}if(tt==="relay-limit"){M({kind:"relay-limit",label:Ws()??""}),Ae("relay-limit");return}if(tt==="unreachable"){const Bt=[4e3,1e4],Ut=zt=>{window.setTimeout(()=>{if(Q.current!==de)return;const _t=zt===Bt.length-1;Gn({fast:!_t}).then(Ke=>{if(Q.current===de&&Ke!=="switched"){if(Ke==="unchanged"){Te();return}if(Ke==="needs-login"){M({kind:"auth-expired",label:Ws()??""}),Ae("retry-needs-login");return}if(Ke==="relay-limit"){M({kind:"relay-limit",label:Ws()??""}),Ae("retry-relay-limit");return}if(!_t){Ut(zt+1);return}Ae(`retry-${Ke}`)}})},Bt[zt])};Ut(0);return}tt!=="switched"&&Te()}});const Le=Date.now();Le-B.current>=Ex&&(B.current=Le,window.dispatchEvent(new Event("openchamber:system-resume")))},e[7]=l,e[8]=t.sourceControl,e[9]=t.trackers,e[10]=r,e[11]=x,e[12]=f,e[13]=u,e[14]=v,e[15]=w,e[16]=J):J=e[16];const X=J;xu(),yu(X);let q,Z;e[17]!==X?(q=()=>{if(!I)return;let ge;const de=()=>{window.clearTimeout(ge),ge=window.setTimeout(()=>X(),1500)};return window.addEventListener("online",de),()=>{window.removeEventListener("online",de),window.clearTimeout(ge)}},Z=[I,X],e[17]=X,e[18]=q,e[19]=Z):(q=e[18],Z=e[19]),p.useEffect(q,Z);let H,V;e[20]!==X?(V=()=>{if(I)return Pr.subscribe((ge,de)=>{ge.state==="expired"&&de.state!=="expired"&&(X(),Pr.getState().markAuthenticated())})},H=[I,X],e[20]=X,e[21]=H,e[22]=V):(H=e[21],V=e[22]),p.useEffect(V,H);let se,te;e[23]!==X?(se=()=>{if(I)return Vl(ge=>{ti(ge)&&X()})},te=[I,X],e[23]=X,e[24]=se,e[25]=te):(se=e[24],te=e[25]),p.useEffect(se,te);let re,ne;e[26]!==t?(re=()=>(Go(t),Kx),ne=[t],e[26]=t,e[27]=re,e[28]=ne):(re=e[27],ne=e[28]),p.useEffect(re,ne);let ue;e[29]!==F?(ue=()=>Uo(ge=>{if(Cn("endpoint:changed",{runtimeKey:ge.runtimeKey||"none",previousRuntimeKey:ge.previousRuntimeKey||"none",connected:!!ge.apiBaseUrl}),!!ge.runtimeKey&&ge.runtimeKey===ge.previousRuntimeKey){lm(),F();return}cm(ge),R($x),j(Wx)}),e[29]=F,e[30]=ue):ue=e[30];let Y;e[31]===Symbol.for("react.memo_cache_sentinel")?(Y=[],e[31]=Y):Y=e[31],p.useEffect(ue,Y);let ie;e[32]!==o?(ie=()=>{if(!I||o||ms()){O("done");return}let ge=!1;return O("attempting"),(async()=>{const de=await Nn().catch(Fx);ge||(de.status==="unreachable"||de.status==="relay-limit"?M({kind:de.status,label:de.label}):de.status==="needs-login"&&M({kind:"auth-expired",label:de.label}),O("done"),de.status==="unreachable"&&Nn({fast:!1,skipIfConnected:!0}).catch(zx))})(),()=>{ge=!0}},e[32]=o,e[33]=ie):ie=e[33];let ae;e[34]===Symbol.for("react.memo_cache_sentinel")?(ae=[],e[34]=ae):ae=e[34],p.useEffect(ie,ae);let Pe,Be;e[35]===Symbol.for("react.memo_cache_sentinel")?(Pe=()=>{if(!I||!ms())return;let ge=!1;const de=Te=>{Cn("cold-launch:drop",{kind:Te?.kind??"unknown"}),Te&&M(Te),Qs({apiBaseUrl:"",clientToken:null,runtimeKey:Fn}),j(Bx)};return Gn().then(async Te=>{if(ge||Te==="switched"||Te==="unchanged")return;const Ae=Ws();if(Te==="needs-login"){de({kind:"auth-expired",label:Ae??""});return}if(Te==="unreachable"){de(Ae?{kind:"unreachable",label:Ae}:null),Nn({fast:!1,skipIfConnected:!0}).catch(Lx);return}if(Te==="relay-limit"){de({kind:"relay-limit",label:Ae??""});return}const Le=await Nn().catch(Ox);ge||Le.status==="connected"||(Le.status==="needs-login"?de({kind:"auth-expired",label:Le.label}):Le.status==="unreachable"||Le.status==="relay-limit"?de({kind:Le.status,label:Le.label}):de(null))}),()=>{ge=!0}},Be=[],e[35]=Pe,e[36]=Be):(Pe=e[35],Be=e[36]),p.useEffect(Pe,Be);let xe,Re;e[37]!==b?(xe=()=>{b(!0)},Re=[b],e[37]=b,e[38]=xe,e[39]=Re):(xe=e[38],Re=e[39]),p.useEffect(xe,Re);let le;e[40]!==r?(le=()=>{I&&!ms()||r()},e[40]=r,e[41]=le):le=e[41];let ce;e[42]!==C||e[43]!==r?(ce=[C,r,I],e[42]=C,e[43]=r,e[44]=ce):ce=e[44],p.useEffect(le,ce);let Ie,Ne;e[45]!==l||e[46]!==o||e[47]!==x||e[48]!==f||e[49]!==u?(Ie=()=>{o&&(u===0&&f({source:"mobileApp:recovery"}),l===0&&x({source:"mobileApp:recovery"}))},Ne=[l,o,x,f,u],e[45]=l,e[46]=o,e[47]=x,e[48]=f,e[49]=u,e[50]=Ie,e[51]=Ne):(Ie=e[50],Ne=e[51]),p.useEffect(Ie,Ne);const je=p.useRef(!1),[De,We]=p.useState(I);let ct;e[52]!==o?(ct=()=>{if(!I||!o||je.current)return;let ge=!1;const de=window.setTimeout(()=>We(!1),6e3);return(async()=>{const Te=await dm({refresh:!0});ge||(Te!=="failed"&&(je.current=!0),We(!1))})(),()=>{ge=!0,window.clearTimeout(de)}},e[52]=o,e[53]=ct):ct=e[53];let Ue;e[54]!==C||e[55]!==o?(Ue=[C,o,I],e[54]=C,e[55]=o,e[56]=Ue):Ue=e[56],p.useEffect(ct,Ue);let Me,He;e[57]!==h||e[58]!==o?(Me=()=>{o&&_i.setDirectory(h)},He=[h,o],e[57]=h,e[58]=o,e[59]=Me,e[60]=He):(Me=e[59],He=e[60]),p.useEffect(Me,He);let Oe,rt;e[61]!==t.sourceControl||e[62]!==t.trackers||e[63]!==o||e[64]!==v||e[65]!==w?(Oe=()=>{o&&(w(t.sourceControl),v(t.sourceControl,{force:!0}),Fr(t.trackers))},rt=[t.sourceControl,t.trackers,o,v,w],e[61]=t.sourceControl,e[62]=t.trackers,e[63]=o,e[64]=v,e[65]=w,e[66]=Oe,e[67]=rt):(Oe=e[66],rt=e[67]),p.useEffect(Oe,rt);let nt,st;e[68]!==g||e[69]!==m?(nt=()=>{if(!m)return;const ge=window.setTimeout(()=>g(),5e3);return()=>window.clearTimeout(ge)},st=[g,m],e[68]=g,e[69]=m,e[70]=nt,e[71]=st):(nt=e[70],st=e[71]),p.useEffect(nt,st);let ee;e[72]!==o?(ee=()=>{if(!(!o&&(I?!!ms():!0))){P(!1);return}const de=window.setTimeout(()=>{P(!0)},I?4e3:8e3);return()=>window.clearTimeout(de)},e[72]=o,e[73]=ee):ee=e[73];let be;e[74]!==C||e[75]!==o||e[76]!==T?(be=[o,I,C,T],e[74]=C,e[75]=o,e[76]=T,e[77]=be):be=e[77],p.useEffect(ee,be),vu();let Ze;e[78]===Symbol.for("react.memo_cache_sentinel")?(Ze={enabled:!0},e[78]=Ze):Ze=e[78],wu(Ze),Qf(),ju(),ku(),Zf(),em(t.sourceControl),tm(t.trackers),sm(),nm(),im(),rm(),om(h||null),am();const U=I&&o;let Ce;e[79]!==U?(Ce={enabled:U},e[79]=U,e[80]=Ce):Ce=e[80],jx(Ce);const qe=I&&o&&c;let he;e[81]!==qe?(he={ready:qe},e[81]=qe,e[82]=he):he=e[82],bx(he);const ut=Zb(),lt=!o&&d==="reconnecting";if(!ut){let ge;return e[83]===Symbol.for("react.memo_cache_sentinel")?(ge=n.jsx("main",{className:"flex min-h-dvh items-center justify-center bg-[var(--splash-background,var(--surface-background))] text-foreground",children:n.jsx(Zs,{width:120,height:120,isAnimated:!0,variant:"splash"})}),e[83]=ge):ge=e[83],ge}const Ct=!!ms();if(I&&(!Ct||!o&&!lt)){if(Ct){const Te=!K;let Ae;e[84]!==Te?(Ae=n.jsx(Zs,{width:120,height:120,isAnimated:Te,variant:"splash"}),e[84]=Te,e[85]=Ae):Ae=e[85];let Le;e[86]!==K||e[87]!==a?(Le=K?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("h1",{className:"typography-h3 text-foreground",children:a("sessionAuth.error.networkTitle")}),n.jsx("p",{className:"typography-markdown text-muted-foreground",children:a("mobile.connect.recovery.description")})]}),n.jsx($e,{type:"button",variant:"outline",onClick:()=>{Qs({apiBaseUrl:"",clientToken:null,runtimeKey:Fn}),j(Mx)},children:a("mobile.connect.cancelPassword")})]}):null,e[86]=K,e[87]=a,e[88]=Le):Le=e[88];let tt;return e[89]!==Ae||e[90]!==Le?(tt=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:[Ae,Le]})}),e[89]=Ae,e[90]=Le,e[91]=tt):tt=e[91],tt}if(z!=="done"){let Te;e[92]===Symbol.for("react.memo_cache_sentinel")?(Te=n.jsx(Zs,{width:120,height:120,isAnimated:!0,variant:"splash"}),e[92]=Te):Te=e[92];let Ae;e[93]!==a?(Ae=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:a("mobile.connect.splash.connectingTo")}),n.jsxs("p",{className:"typography-small text-foreground",children:[W,n.jsx(Su,{})]})]}):null,e[93]=a,e[94]=Ae):Ae=e[94];let Le;return e[95]!==Ae?(Le=n.jsxs("main",{className:"relative flex min-h-dvh items-center justify-center bg-[var(--splash-background,var(--surface-background))] text-foreground",children:[Te,Ae]}),e[95]=Ae,e[96]=Le):Le=e[96],Le}let ge;e[97]===Symbol.for("react.memo_cache_sentinel")?(ge=()=>j(Dx),e[97]=ge):ge=e[97];let de;return e[98]!==D?(de=n.jsx(n.Fragment,{children:n.jsx(s1,{onConnected:ge,notice:D})}),e[98]=D,e[99]=de):de=e[99],de}if(!o&&!lt){if(!K){let tt;return e[100]===Symbol.for("react.memo_cache_sentinel")?(tt=n.jsx("main",{className:"flex min-h-dvh items-center justify-center bg-[var(--splash-background,var(--surface-background))] text-foreground",children:n.jsx(Zs,{width:120,height:120,isAnimated:!0,variant:"splash"})}),e[100]=tt):tt=e[100],tt}let ge;e[101]!==a?(ge=a("sessionAuth.error.networkTitle"),e[101]=a,e[102]=ge):ge=e[102];let de;e[103]!==ge?(de=n.jsx("h1",{className:"typography-h3 text-foreground",children:ge}),e[103]=ge,e[104]=de):de=e[104];let Te;e[105]!==a?(Te=a("sessionAuth.error.networkDescription"),e[105]=a,e[106]=Te):Te=e[106];let Ae;e[107]!==Te?(Ae=n.jsx("p",{className:"typography-markdown text-muted-foreground",children:Te}),e[107]=Te,e[108]=Ae):Ae=e[108];let Le;return e[109]!==de||e[110]!==Ae?(Le=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:[de,Ae]})}),e[109]=de,e[110]=Ae,e[111]=Le):Le=e[111],Le}let ft;e[112]===Symbol.for("react.memo_cache_sentinel")?(ft=_i.getSdkClient(),e[112]=ft):ft=e[112];const Je=h||"",et=!I||!De;let dt;e[113]!==et?(dt=n.jsx(um,{ready:et,animated:!0}),e[113]=et,e[114]=dt):dt=e[114];let Xe;e[115]!==c?(Xe=n.jsx(Cu,{backgroundWorkEnabled:c}),e[115]=c,e[116]=Xe):Xe=e[116];let ht,Se;e[117]===Symbol.for("react.memo_cache_sentinel")?(ht=n.jsx(fm,{}),Se=n.jsx(Zp,{}),e[117]=ht,e[118]=Se):(ht=e[117],Se=e[118]);let it,Qe,gt,bt,ot;e[119]===Symbol.for("react.memo_cache_sentinel")?(it=n.jsx(_x,{onActiveConnectionDeleted:()=>{zh(),Qs({apiBaseUrl:"",clientToken:null,runtimeKey:Fn}),j(Ax)}}),Qe=n.jsx(Nu,{}),gt=n.jsx(Ru,{}),bt=n.jsx(Iu,{}),ot=n.jsx(Eu,{}),e[119]=it,e[120]=Qe,e[121]=gt,e[122]=bt,e[123]=ot):(it=e[119],Qe=e[120],gt=e[121],bt=e[122],ot=e[123]);let _e;e[124]!==i?(_e=i?n.jsxs(n.Fragment,{children:[n.jsx(Cm,{}),n.jsx(mm,{}),n.jsx(Nm,{}),n.jsx(pm,{}),n.jsx(Rm,{})]}):null,e[124]=i,e[125]=_e):_e=e[125];let mt;e[126]===Symbol.for("react.memo_cache_sentinel")?(mt=n.jsx(oh,{}),e[126]=mt):mt=e[126];let xt;e[127]!==c?(xt=c?n.jsx(hm,{}):null,e[127]=c,e[128]=xt):xt=e[128];let ze;e[129]!==dt||e[130]!==Xe||e[131]!==_e||e[132]!==xt?(ze=n.jsx(Pu,{delayDuration:300,skipDelayDuration:150,children:n.jsxs("div",{className:"h-full bg-background text-foreground",children:[dt,Xe,ht,Se,it,Qe,gt,bt,ot,_e,mt,xt]})}),e[129]=dt,e[130]=Xe,e[131]=_e,e[132]=xt,e[133]=ze):ze=e[133];let at;e[134]!==t||e[135]!==ze?(at=n.jsx(_u,{apis:t,children:ze}),e[134]=t,e[135]=ze,e[136]=at):at=e[136];let Fe;return e[137]!==T||e[138]!==Je||e[139]!==at?(Fe=n.jsx(It,{children:n.jsx(Tu,{sdk:ft,directory:Je,children:at},T)}),e[137]=T,e[138]=Je,e[139]=at,e[140]=Fe):Fe=e[140],Fe}function Ax(s){return s+1}function Dx(s){return s+1}function Mx(s){return s+1}function Ox(){return{status:"no-candidate"}}function Lx(){return null}function Bx(s){return s+1}function zx(){return null}function Fx(){return{status:"no-candidate"}}function Wx(s){return s+1}function $x(s){return s+1}function Kx(){return Go(null)}function Hx(s){return s+1}function Vx(s){return s+1}function Ux(s){return s.authoritativeSessions}function Gx(s){return s.refresh}function qx(s){return s.refreshAll}function Jx(s){return s.setIsMobile}function Xx(s){return s.clearError}function Yx(s){return s.error}function Qx(s){return s.currentDirectory}function Zx(s){return s.loadAgents}function ey(s){return s.loadProviders}function ty(s){return s.agents.length}function sy(s){return s.providers.length}function ny(s){return s.connectionPhase}function iy(s){return s.isConnected}function ry(s){return s.isInitialized}function oy(s){return s.initializeApp}function ay(s){return s.isolatedSpacesEnabled}function ly(s){const e=oe.c(7),t=p.useSyncExternalStore(cy,ms,ms);let i;e[0]!==t?(i=!tr()||!!t,e[0]=t,e[1]=i):i=e[1];let a;e[2]!==s?(a=n.jsx(Tx,{...s}),e[2]=s,e[3]=a):a=e[3];let r;return e[4]!==i||e[5]!==a?(r=n.jsx(gm,{enabled:i,children:a}),e[4]=i,e[5]=a,e[6]=r):r=e[6],r}function cy(s){return Uo(()=>s())}function $w(s){window.__OPENCHAMBER_SURFACE__="mobile",Hu(),wm({logLabel:"[mobile-main]",onAppearanceSettled:Vp}),Qp(),Vu();const e=document.getElementById("root");if(!e)throw new Error("Root element not found");const i=window.Capacitor?.isNativePlatform?.()===!0||window.location.protocol==="capacitor:",a=i?{...s,notifications:{notifyAgentCompletion:async()=>!1,canNotify:()=>!1}}:s,r=n.jsx(vm,{children:n.jsx(ly,{apis:a})});kl.createRoot(e).render(n.jsx(Pi.StrictMode,{children:n.jsx(Uu,{children:n.jsx(Gu,{children:n.jsx(qu,{children:n.jsx(ym,{children:i?r:n.jsx(Ju,{children:r})})})})})}))}export{$w as renderMobileApp};
|
|
25
|
+
`)}`.trim()),st([])},[]),hl=p.useCallback(async()=>{if(!m)return;const y=Zt.map($=>$.path).sort();if(y.length===0){pe.error(o("gitView.toast.selectFileToDescribe"));return}rt(!0);try{const{message:$}=await Lr(m,y);We($.subject?.trim()??""),st(Array.isArray($.highlights)?$.highlights:[])}catch($){pe.error($ instanceof Error?$.message:o("gitView.toast.generateCommitMessageFailed"))}finally{rt(!1)}},[m,Zt,o]),jr=async(y={})=>{if(!m)return;if(!De.trim()){pe.error(o("gitView.toast.enterCommitMessage"));return}const $=Zt.map(ke=>ke.path).sort();if($.length===0){pe.error(o("gitView.toast.selectFileToCommit"));return}Ne(y.pushAfter?"commitAndPush":"commit");let fe=null,Ye="pending";try{if(!d.createGitCommit)throw new Error("Git commit is unavailable on this runtime");const ke=await d.createGitCommit(m,De.trim(),{files:$});Ye="local";const os=je.committed(ke.summary,y);if(We(""),st([]),y.pushAfter){if(fe=et.start(),!fe){pe.warning(o("gitView.publish.commitKept")),await Fs();return}const kt=await Je.prepare("push",{onOperation:fe.onOperation});ce("publish"),await kt(),Ye="published",je.pushed({deletion:os,origin:y.origin})}await Fs()}catch(ke){if(y.pushAfter&&Ye==="local"&&pe.warning(o("gitView.publish.commitKept")),ke instanceof Vn||ke instanceof Ai){await Fs();return}if(ke instanceof Ts&&ke.code==="stale-runtime")return;if(ke instanceof Ts&&Je.errorMessage(ke)){pe.info(Je.errorMessage(ke));return}y.pushAfter&&await Fs(),pe.error(ke instanceof Ts?ke.code==="contributor-publish-cancelled-after-update"?o("gitView.toast.contributorPublishCancelledAfterUpdate"):ke.code==="contributor-publish-cancelled"?o("gitView.toast.contributorPublishCancelled"):o("gitView.toast.syncActionFailed",{action:o("gitView.sync.syncChanges")}):ke instanceof Error?Ur(ke,o):o("gitView.toast.createCommitFailed"))}finally{fe?.finish(),Ne(null),y.pushAfter&&ce(null)}},gl=p.useMemo(()=>(g?.files??[]).filter(wi).length,[g?.files]),kn=!!g?.mergeInProgress?.head,bl=p.useCallback(async()=>{if(m)try{if(kn){if(!d.continueMerge)throw new Error("Git continue merge is unavailable on this runtime");const y=await d.continueMerge(m);y.conflict?(ot(y.conflictFiles??[],"merge"),pe.error(o("gitView.toast.mergeConflictsDetected"))):pe.success(o("gitView.toast.mergeCompleted"))}else{if(!d.continueRebase)throw new Error("Git continue rebase is unavailable on this runtime");const y=await d.continueRebase(m);y.conflict?(ot(y.conflictFiles??[],"rebase"),pe.error(o("gitView.toast.rebaseConflictsDetected"))):pe.success(o("gitView.toast.rebaseStepCompleted"))}await jt(!1)}catch(y){pe.error(y instanceof Error?y.message:o("gitView.toast.continueOperationFailed"))}},[m,d,kn,ot,jt,o]),kr=p.useCallback(async y=>{if(m)try{if(y==="merge"){if(!d.abortMerge)throw new Error("Git abort merge is unavailable on this runtime");await d.abortMerge(m),pe.success(o("gitView.toast.mergeAborted"))}else{if(!d.abortRebase)throw new Error("Git abort rebase is unavailable on this runtime");await d.abortRebase(m),pe.success(o("gitView.toast.rebaseAborted"))}await jt(!1)}catch($){pe.error($ instanceof Error?$.message:o("gitView.toast.abortOperationFailed"))}},[m,d,jt,o]),xl=p.useCallback(()=>{const y=(g?.files??[]).filter(wi).map($=>$.path);ot(y,kn?"merge":"rebase")},[kn,ot,g?.files]),yl=p.useMemo(()=>{const y=[];return Zt.length>0&&y.push({id:"staged",title:o("gitView.changes.stagedTitle"),entries:Zt,statsScope:"staged",actionSymbol:"-",actionAllLabel:o("gitView.changes.unstageAllAria"),getActionLabel:$=>o("gitView.changes.unstageFileAria",{path:$}),onActionFile:$=>{jn([$],"unstage")},onActionAll:$=>{jn($,"unstage")},onViewDiff:$=>fi($,!0),onRevertFile:mi,showRevertActions:!1,accent:!0}),we.length>0&&y.push({id:"unstaged",title:o("gitView.changes.title"),entries:we,statsScope:"working",actionSymbol:"+",actionAllLabel:o("gitView.changes.stageAllAria"),getActionLabel:$=>o("gitView.changes.stageFileAria",{path:$}),onActionFile:$=>{jn([$],"stage")},onActionAll:$=>{jn($,"stage")},onViewDiff:$=>fi($,!1),onRevertFile:mi}),y},[mi,fi,jn,Zt,o,we]),Sr=n.jsxs(n.Fragment,{children:[Je.context?n.jsx(Wf,{context:Je.context,onSelect:Je.settle}):null,Je.confirmDialog,n.jsx($f,{candidates:ft.candidates,onSelect:ft.settle})]}),Cr=h?n.jsx(Xd,{repositories:h,selectedRepository:f??null,onSelectRepository:y=>{s&&(en.getState().clearChangesRepository(s),I(s,y))},repositoryRoot:s??void 0}):null,zn=y=>n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[Sr,n.jsxs("header",{className:me(Vs,"text-foreground"),children:[t?n.jsx("button",{type:"button",className:Qt,"aria-label":o("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:ni,children:o("mobile.nav.changes")}),n.jsx("p",{className:"truncate typography-micro text-muted-foreground",children:g?.current||m||""})]}),Cr]}),n.jsx("div",{className:"min-h-0 flex-1",children:y})]});if(!m)return zn(n.jsx(Vt,{message:o("gitView.empty.selectSessionOrDirectory")}));if(e.unreadable)return zn(n.jsx(Kf,{directory:e.unreadable.directory,message:e.unreadable.message}));if(l===!1&&M!==!0)return zn(n.jsx(Vf,{root:s,rootIsGitRepo:l,resolvedIsGitRepo:M,nestedRepos:x,onRetryDiscovery:()=>{s&&N(s,{force:!0})}}));if(L&&M===null)return zn(n.jsx(Vt,{loading:!0,message:o("gitView.loading.checkingRepository")}));if(ie.type==="diff")return n.jsx(Ii,{path:ie.path,previousPath:es?.previousPath,diff:Ot,staged:ie.staged,fileExists:!!es,unavailableReason:he?.key===`${m}\0${ie.path}`?he.reason:null,error:Ce,onBack:()=>xe({type:"list"}),onRetry:()=>Ct(y=>y+1)});if(ie.type==="turn")return n.jsx(Ii,{path:ie.path,subtitle:o("diffView.scope.lastTurn"),diff:_s.get(ie.path)??null,fileExists:Ps.some(y=>y.path===ie.path),onBack:()=>xe(as)});const pi=o(Y==="pr"?$n("session.githubIntegration.tabs.pullRequests",Ft):Y==="branch"?"diffView.scope.branch":Y==="commit"?"commitComparison.mode":Y==="turn"?"diffView.scope.lastTurn":"mobile.nav.changes"),hi=Y==="branch"&&de.base?Hf(de.base):Y==="commit"?at?.slice(0,8):Y==="pr"&&Tt?`#${Tt.number}`:null;if(ie.type==="walkthrough"&&fs&&m)return n.jsx(Vr.Provider,{value:$t,children:n.jsx(Eb,{directory:m,target:fs,subtitle:[pi,hi].filter(Boolean).join(" · "),revision:JSON.stringify([Dt,Y==="pr"?ve.revision:0]),visible:r,onBack:()=>xe(as)})});if(Rt&&Mt)return n.jsx(Vr.Provider,{value:$t,children:n.jsx(Ii,{path:Rt,previousPath:ve.files?.find(y=>y.path===Rt)?.previousPath,subtitle:[pi,hi].filter(Boolean).join(" · "),commentOrigin:qt,diff:Ns??(Mt.status==="ready"?Mt.diff:null),fileExists:!ve.files||ve.files.some(y=>y.path===Rt),error:ve.error??(Mt.status==="error"?Mt.message:null),onBack:()=>xe(as),onRetry:()=>{ve.error&&ve.refresh(),Xt(y=>y+1)},onExpandContextRequest:Mt.status==="ready"?y=>Cs({source:Mt,request:y}):void 0,pendingContextExpansion:hs,contextLoading:hs!==null&&!Ns})});const vl=()=>Y==="pr"&&Ke.diffUnavailable?n.jsx(Fp,{provider:Ke.provider,className:"h-full"}):Y==="pr"&&!Tt?n.jsx(Vt,{loading:Ke.loading,message:Ke.error??(Ke.loading?o($n("session.githubPrPicker.loading.pullRequests",Ft)):o($n("pullRequestComparison.select",Ft)))}):Y==="branch"&&!de.base?n.jsx(Vt,{loading:!de.resolved,message:de.resolved?o("gitView.pr.toast.baseBranchRequired"):o("diffView.branch.resolvingBase")}):Y==="commit"&&!at?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 text-center",children:[ze.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:ze.loading?o("diffView.state.loadingChanges"):ze.error??o("commitComparison.noCommits")}),ze.error&&n.jsx($e,{variant:"outline",size:"lg",onClick:()=>{ze.refresh()},children:o("diffView.actions.retry")})]}):ve.error?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 text-center",children:[n.jsx("p",{className:"typography-ui-label font-semibold",children:o("diffView.state.failedToLoadDiff")}),n.jsx("p",{className:"typography-meta text-muted-foreground",children:ve.error}),n.jsx($e,{variant:"outline",size:"lg",onClick:()=>{ve.refresh()},children:o("diffView.actions.retry")})]}):Ht?Ht.length===0?n.jsx(Vt,{icon:Y==="branch",message:Y==="pr"?o("walkthrough.blocked.emptyDiff.description"):Y==="commit"?o("commitComparison.emptyDiff"):o("diffView.branch.empty",{base:hi??""})}):n.jsx(_o,{files:Ht,onSelect:y=>{ve.key&&xe({type:"comparison",path:y,sourceKey:ve.key})}}):n.jsx(Vt,{loading:!0,message:o("diffView.state.loadingChanges")}),wl=()=>ys?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 text-center",children:[n.jsx("p",{className:"typography-ui-label font-semibold",children:o("diffView.state.failedToLoadDiff")}),n.jsx("p",{className:"typography-meta text-muted-foreground",children:ys}),n.jsx($e,{variant:"outline",size:"lg",onClick:vs,children:o("diffView.actions.retry")})]}):(!xs||re)&&Gt?n.jsx(Vt,{loading:!0,message:o("diffView.state.loadingChanges")}):Ps.length===0?n.jsx(Vt,{message:o("diffView.state.noLastTurnChanges")}):n.jsx(_o,{files:Ps,onSelect:y=>xe({type:"turn",path:y})});return n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[Sr,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:Qt,"aria-label":o("mobile.surface.closeAria"),onClick:t,style:{touchAction:"manipulation"},children:n.jsx(G,{name:"close",className:"size-5"})}):null,n.jsxs(Mi,{open:ae,onOpenChange:Pe,children:[n.jsx(Oi,{asChild:!0,children:n.jsxs($e,{variant:"ghost",className:Ld({size:"mobile"}),"data-mobile-comparison-trigger":!0,"aria-label":o("diffView.scope.selectorAria"),children:[n.jsx("span",{children:Y==="pr"&&Ft==="pullRequest"?"PR":Y==="pr"&&Ft==="mergeRequest"?"MR":pi}),n.jsx(G,{name:"arrow-down-s",className:"size-4"})]})}),n.jsx(Li,{align:"start",children:n.jsxs(Bd,{value:Y,onValueChange:y=>{(y==="working"||y==="turn"||y==="branch"||y==="commit"||y==="pr")&&Be(y)},children:[n.jsx(Sn,{value:"working",className:"min-h-8 items-center",children:o("mobile.nav.changes")}),n.jsx(Sn,{value:"turn",className:"min-h-8 items-center",children:o("diffView.scope.lastTurn")}),Ae&&n.jsx(Sn,{value:"branch",className:"min-h-8 items-center",children:o("diffView.scope.branch")}),n.jsx(Sn,{value:"commit",className:"min-h-8 items-center",children:o("commitComparison.mode")}),n.jsx(Sn,{value:"pr",className:"min-h-8 items-center",children:o($n("session.githubIntegration.tabs.pullRequests",Ft))})]})})]}),Cr,r&&Y==="branch"&&n.jsx(Op,{mobile:!0,branches:v?.all??[],currentBranch:_e,base:de.base,automatic:de.source!=="chosen",onSelect:y=>{_e&&mt(m,_e,y)},onSelectAutomatic:()=>{_e&&xt(m,_e)}},JSON.stringify([H,_e])),r&&Y==="commit"&&n.jsx(Lp,{mobile:!0,commits:ze.commits,selectedHash:at,loading:ze.loading,error:ze.error,onSelect:ze.select,onRefresh:()=>{ze.refresh()}},JSON.stringify([H,_e])),r&&Y==="pr"&&n.jsxs(n.Fragment,{children:[n.jsx(Bp,{mobile:!0,comparison:Ke},JSON.stringify([H,_e])),Tt&&n.jsx($e,{variant:"ghost",size:"sm",disabled:ve.loading,"aria-label":o("session.githubIssuePicker.actions.refresh"),onClick:()=>{ve.refresh()},children:n.jsx(G,{name:"refresh",className:"size-4"})})]}),fs&&n.jsx($e,{variant:"ghost",size:"icon",className:"ms-auto shrink-0",onClick:()=>xe({type:"walkthrough"}),"aria-label":o("walkthrough.action.open"),title:o("walkthrough.action.open"),style:{touchAction:"manipulation"},children:n.jsx(G,{name:"route",className:"size-5"})}),r&&Y==="pr"&&$t&&Ee?n.jsx(zp,{review:$t,provider:Ee,className:fs?void 0:"ms-auto"}):null,Y==="working"&&Gt&&(g?.files?.length??0)>0?n.jsxs($e,{variant:"outline",className:me("shrink-0",!fs&&"ms-auto"),disabled:At.submitting,onClick:()=>Et(!0),"aria-label":o("diffView.actions.reviewAria"),style:{touchAction:"manipulation"},children:[n.jsx(G,{name:At.submitting?"loader-4":"search-eye",className:me("size-4",At.submitting&&"animate-spin")}),o("chat.work.reviewHint.aiReview")]}):null]}),n.jsx(zd,{open:us,onOpenChange:Et,projectDirectory:s||null,submitting:At.submitting,onConfirm:At.start}),Y==="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(Fd,{currentBranch:g?.current,localBranches:vn,remoteBranches:ul,branchInfo:v?.branches,currentBranchAhead:g?.ahead,onCheckout:y=>{fl(y)},onCreate:ml,disabled:L,directory:m,switchBlockedNotice:(g?.files?.length??0)>0?o("gitView.branch.switchBlockedNotice"):null})}),n.jsx(Wd,{activeProfile:Ut,quiet:!0,identities:O,attention:zt,triggerClassName:"max-w-[10rem] shrink [&_.git-identity-label]:hidden sm:[&_.git-identity-label]:inline",onOpen:()=>{z(u,S.map(y=>y.account))},onSelect:y=>{D(y)},isApplying:_,onConfigure:()=>E(!0),applicability:y=>{const $=Fe.read?.repository.remotes.find(fe=>fe.name===tt);return $?$d(y,Kd($.fetch.displayUrl),P):{applicable:!0}}}),n.jsx(Hd,{syncAction:et.entry?.executing?le:null,remotes:wt,onFetch:y=>{wn("fetch",y)},onPull:y=>{wn("pull",y)},onSync:y=>{wn("sync",y)},onPublish:()=>{wn("publish")},onChooseSyncTargets:()=>{wn("sync",void 0,!0)},currentBranch:g?.current,hasTracking:!!g?.tracking,disabled:L||et.blocked,aheadCount:g?.ahead??0,behindCount:g?.behind??0,trackingRemoteName:g?.tracking?.split("/")[0],trackingBranch:g?.tracking,hasUncommittedChanges:Vd(pt),choosesPushDestination:b})]}),n.jsx(hp,{open:k,onOpenChange:E,directory:m}),n.jsx(Ud,{className:"mx-3 mt-3",entry:et.entry,onRefresh:()=>{et.refresh()},onCancel:()=>{et.cancel()}}),Y==="working"&&n.jsx(gp,{mergeInProgress:g?.mergeInProgress,rebaseInProgress:g?.rebaseInProgress,onContinue:bl,onAbort:()=>kr(kn?"merge":"rebase"),onResolveWithAI:xl,conflictCount:gl,isLoading:le!==null||Ie!==null}),Y==="turn"?n.jsx("div",{className:"min-h-0 flex-1",children:wl()}):Y!=="working"?n.jsx("div",{className:"min-h-0 flex-1",children:vl()}):pt.length>0?n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden px-2 pt-1",children:n.jsx(bp,{groups:yl,diffStats:g?.diffStats,revertingPaths:ct,onRevertAll:wr,isRevertingAll:Me,headerBackgroundClassName:"bg-transparent",onVisiblePathsChange:be})}),n.jsx("div",{"data-keyboard-rider":"",className:"oc-mobile-commit-bar shrink-0 border-t border-edge-muted bg-background px-4 py-3",children:n.jsx(xp,{stagedCount:Zt.length,commitMessage:De,onCommitMessageChange:We,generatedHighlights:nt,onInsertHighlights:pl,onGenerateMessage:hl,isGeneratingMessage:Oe,onCommit:y=>{jr({pushAfter:!1,origin:y})},onCommitAndPush:y=>{jr({pushAfter:!0,origin:y})},commitAction:Ie,networkOperationBlocked:et.blocked,gitmojiEnabled:!1,onOpenGitmojiPicker:()=>{}})})]}):n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(Bb,{})}),m&&n.jsx(yp,{open:ht,onOpenChange:Se,conflictFiles:it,directory:m,operation:gt,onAbort:()=>{kr(gt)},onNavigatedToChat:c}),n.jsx(vp,{open:dt!==null,onOpenChange:y=>{y||Xe(null)},targetBranch:dt??"",changedFileCount:g?.files?.length??0,onCommitAndSwitch:(y,$)=>_b(y,$,{targetBranch:dt,directory:m,sourceBranch:g?.current??null,git:d,publishChooser:Je,toast:pe,t:o,refreshStatusAndBranches:jt,closeDialog:()=>Xe(null),performCheckout:Ln}),onGenerateMessage:async()=>{if(!m)return"";const y=(g?.files??[]).map(fe=>fe.path).sort(),{message:$}=await Lr(m,y);return $.subject?.trim()??""},onRevertAndSwitch:async()=>{const y=dt;if(!y||!m)return;await wr((g?.files??[]).map(fe=>fe.path));const $=await d.getGitStatus(m);if(!$.isClean&&($.files?.length??0)>0){pe.error(o("gitView.dirtySwitch.revertIncomplete"));return}Xe(null),await Ln(y)}})]})},Vt=s=>{const e=oe.c(13),{message:t,description:i,loading:a,icon:r}=s,c=a===void 0?!1:a,o=r===void 0?!1:r;let d;e[0]!==c?(d=c?n.jsx(G,{name:"loader-4",className:"size-5 animate-spin text-muted-foreground"}):null,e[0]=c,e[1]=d):d=e[1];let u;e[2]!==o?(u=o?n.jsx(G,{name:"git-branch",className:"size-6 text-muted-foreground"}):null,e[2]=o,e[3]=u):u=e[3];let l;e[4]!==t?(l=n.jsx("p",{className:"typography-ui-label font-semibold text-foreground",children:t}),e[4]=t,e[5]=l):l=e[5];let f;e[6]!==i?(f=i?n.jsx("p",{className:"typography-meta text-muted-foreground",children:i}):null,e[6]=i,e[7]=f):f=e[7];let x;return e[8]!==d||e[9]!==u||e[10]!==l||e[11]!==f?(x=n.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center",children:n.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-2",children:[d,u,l,f]})}),e[8]=d,e[9]=u,e[10]=l,e[11]=f,e[12]=x):x=e[12],x},Bb=()=>{const s=oe.c(7),{t:e}=ye();let t;s[0]!==e?(t=e("mobile.changes.cleanDescription"),s[0]=e,s[1]=t):t=s[1];const i=wp(t);let a;s[2]!==e?(a=e("gitView.empty.cleanTitle"),s[2]=e,s[3]=a):a=s[3];let r;return s[4]!==i||s[5]!==a?(r=n.jsx(Vt,{icon:!0,message:a,description:i}),s[4]=i,s[5]=a,s[6]=r):r=s[6],r},Ii=s=>{const e=oe.c(70),{path:t,previousPath:i,subtitle:a,diff:r,staged:c,fileExists:o,unavailableReason:d,error:u,onBack:l,onRetry:f,onExpandContextRequest:x,pendingContextExpansion:h,contextLoading:m,commentOrigin:g}=s,b=c===void 0?!1:c,v=d===void 0?null:d,w=u===void 0?null:u,{t:k}=ye();let E;e[0]!==t?(E=qd(t)||"text",e[0]=t,e[1]=E):E=e[1];const _=E;let A;e[2]!==g||e[3]!==t?(A={fileLabel:t,origin:g},e[2]=g,e[3]=t,e[4]=A):A=e[4];const S=Kp(A);let C,j;if(e[5]!==t){const ne=t.replace(/\/$/,""),ue=ne.lastIndexOf("/");C=ne.slice(ue+1),j=ue>0?ne.slice(0,ue):null,e[5]=t,e[6]=C,e[7]=j}else C=e[6],j=e[7];const T=j,R=i?`${i} → ${T??C}`:T;let K;e[8]===Symbol.for("react.memo_cache_sentinel")?(K=me(Vs,"border-b border-edge text-foreground"),e[8]=K):K=e[8];let P;e[9]!==k?(P=k("header.actions.backAria"),e[9]=k,e[10]=P):P=e[10];let z;e[11]===Symbol.for("react.memo_cache_sentinel")?(z=n.jsx(G,{name:"arrow-left",className:"size-5"}),e[11]=z):z=e[11];let O;e[12]!==l||e[13]!==P?(O=n.jsx("button",{type:"button",className:Qt,"aria-label":P,onClick:l,children:z}),e[12]=l,e[13]=P,e[14]=O):O=e[14];const D=i?`${i} → ${t}`:t;let M;e[15]===Symbol.for("react.memo_cache_sentinel")?(M=me("oc-ui-start-align truncate",ni),e[15]=M):M=e[15];let L;e[16]!==C?(L=n.jsx("h2",{dir:"ltr",className:M,children:C}),e[16]=C,e[17]=L):L=e[17];let W;e[18]!==R?(W=R?n.jsx("span",{dir:"ltr",className:"oc-ui-start-align min-w-0 truncate",children:R}):null,e[18]=R,e[19]=W):W=e[19];let F;e[20]!==R||e[21]!==a?(F=R&&a?n.jsx("span",{"aria-hidden":!0,className:"shrink-0 opacity-60",children:"·"}):null,e[20]=R,e[21]=a,e[22]=F):F=e[22];let N;e[23]!==a?(N=a?n.jsx("span",{className:"min-w-0 max-w-full shrink-0 truncate",children:a}):null,e[23]=a,e[24]=N):N=e[24];let I;e[25]!==W||e[26]!==F||e[27]!==N?(I=n.jsxs("p",{className:"flex min-w-0 items-baseline gap-1.5 typography-micro text-muted-foreground",children:[W,F,N]}),e[25]=W,e[26]=F,e[27]=N,e[28]=I):I=e[28];let B;e[29]!==D||e[30]!==L||e[31]!==I?(B=n.jsxs("div",{className:"min-w-0 flex-1 px-1",title:D,children:[L,I]}),e[29]=D,e[30]=L,e[31]=I,e[32]=B):B=e[32];const Q=S.isOpen?"text-foreground":"text-muted-foreground";let J;e[33]!==Q?(J=me(Qt,Q),e[33]=Q,e[34]=J):J=e[34];let X;e[35]!==k?(X=k("inlineComment.actions.commentOnFile"),e[35]=k,e[36]=X):X=e[36];const q=S.isOpen;let Z;e[37]!==k?(Z=k("inlineComment.actions.commentOnFile"),e[37]=k,e[38]=Z):Z=e[38];let H;e[39]===Symbol.for("react.memo_cache_sentinel")?(H=n.jsx(G,{name:"chat-1",className:"size-5"}),e[39]=H):H=e[39];let V;e[40]!==J||e[41]!==X||e[42]!==Z||e[43]!==S.isOpen||e[44]!==S.toggle?(V=n.jsx("button",{type:"button",className:J,"aria-label":X,"aria-pressed":q,title:Z,onClick:S.toggle,children:H}),e[40]=J,e[41]=X,e[42]=Z,e[43]=S.isOpen,e[44]=S.toggle,e[45]=V):V=e[45];let se;e[46]!==O||e[47]!==B||e[48]!==V?(se=n.jsxs("header",{className:K,children:[O,B,V]}),e[46]=O,e[47]=B,e[48]=V,e[49]=se):se=e[49];let te;e[50]!==g||e[51]!==m||e[52]!==r||e[53]!==w||e[54]!==o||e[55]!==_||e[56]!==x||e[57]!==f||e[58]!==t||e[59]!==h||e[60]!==i||e[61]!==b||e[62]!==k||e[63]!==v?(te=n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:o?v==="nested_repository"?n.jsx(Vt,{icon:!0,message:k("diffView.unavailable.nestedRepositoryTitle"),description:k("diffView.unavailable.nestedRepositoryDescription")}):v==="untracked_directory"?n.jsx(Vt,{icon:!0,message:k("diffView.unavailable.untrackedDirectoryTitle"),description:k("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:k("mobile.changes.diffDetail.loadFailed")}),n.jsx("p",{className:"typography-meta text-muted-foreground",children:w}),n.jsx($e,{type:"button",size:"sm",variant:"outline",onClick:()=>f?.(),children:k("diffView.actions.retry")})]})}):r?r.submodule?n.jsx("div",{className:"p-3",children:n.jsx(mp,{state:r.submodule,staged:b})}):r.isBinary?n.jsx(Vt,{icon:!0,message:k("diffView.binary.unavailable")}):ya(t)&&Ia(r.original,r.modified)?n.jsx(bs,{outerClassName:"h-full",className:"p-3",disableHorizontal:!0,"data-diff-virtual-root":!0,"data-diff-virtual-content":!0,children:n.jsx($p,{filePath:t,original:r.original,modified:r.modified,renderText:ne=>n.jsx(Jr,{original:ne.original,modified:ne.modified,language:"text",fileName:t,commentOrigin:g,renderSideBySide:!1,wrapLines:!0,layout:"inline"})})}):i&&(r.fileDiff?r.fileDiff.hunks.length===0:r.original===r.modified)?n.jsx(Vt,{icon:!0,message:k("diffView.change.renamedFrom",{from:i})}):Jd(t)&&!r.fileDiff?n.jsx(Vt,{icon:!0,message:k("mobile.changes.diffDetail.imageUnavailable")}):n.jsx(bs,{outerClassName:"h-full",className:"p-3",useScrollShadow:!0,disableHorizontal:!0,"data-diff-virtual-root":!0,"data-diff-virtual-content":!0,children:n.jsx(Jr,{original:r.original,modified:r.modified,fileDiff:r.fileDiff,language:_,fileName:t,commentOrigin:g,renderSideBySide:!1,wrapLines:!0,layout:"inline",onExpandContextRequest:x,pendingContextExpansion:h,contextLoading:m})}):n.jsx(Vt,{loading:!0,message:k("diffView.state.loadingDiff")}):n.jsx(Vt,{icon:!0,message:k("mobile.changes.diffDetail.missingTitle"),description:k("mobile.changes.diffDetail.missingDescription")})}),e[50]=g,e[51]=m,e[52]=r,e[53]=w,e[54]=o,e[55]=_,e[56]=x,e[57]=f,e[58]=t,e[59]=h,e[60]=i,e[61]=b,e[62]=k,e[63]=v,e[64]=te):te=e[64];let re;return e[65]!==se||e[66]!==te||e[67]!==S.cards||e[68]!==S.editor?(re=n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[se,S.cards,S.editor,te]}),e[65]=se,e[66]=te,e[67]=S.cards,e[68]=S.editor,e[69]=re):re=e[69],re},_o=s=>{const e=oe.c(12),{files:t,onSelect:i}=s,{t:a}=ye();let r;e[0]!==a?(r=a("gitView.changes.changedFilesAria"),e[0]=a,e[1]=r):r=e[1];let c;if(e[2]!==t||e[3]!==i||e[4]!==a){let d;e[6]!==i||e[7]!==a?(d=u=>{const l=u.status==="A"?a("diffView.change.new"):u.status==="D"?a("diffView.change.deleted"):u.status==="R"?a("diffView.change.renamed"):u.status==="C"?a("diffView.change.copied"):a("diffView.change.modified"),f=u.status==="A"?"var(--status-success)":u.status==="D"?"var(--status-error)":u.status==="R"||u.status==="C"?"var(--status-info)":"var(--status-warning)";return n.jsx("li",{children:n.jsxs("button",{type:"button",className:"flex min-h-11 w-full items-center gap-2 rounded-md px-2 text-start touch-manipulation focus:outline-none active:bg-interactive-hover",onClick:()=>i(u.path),children:[n.jsx("span",{className:"w-4 shrink-0 text-center typography-micro font-semibold uppercase",style:{color:f},"aria-label":l,children:u.status}),n.jsx(va,{filePath:u.path,className:"size-3.5 shrink-0"}),n.jsx(Sp,{path:u.path,from:u.previousPath,nameFirst:!0,className:"flex-1 typography-ui-label"}),(u.insertions>0||u.deletions>0)&&n.jsx(jp,{insertions:u.insertions,deletions:u.deletions,hideZero:!0})]})},u.path)},e[6]=i,e[7]=a,e[8]=d):d=e[8],c=t.map(d),e[2]=t,e[3]=i,e[4]=a,e[5]=c}else c=e[5];let o;return e[9]!==r||e[10]!==c?(o=n.jsx(bs,{outerClassName:"h-full",className:"px-2 py-1",useScrollShadow:!0,disableHorizontal:!0,children:n.jsx("ul",{"aria-label":r,className:"flex flex-col",children:c})}),e[9]=r,e[10]=c,e[11]=o):o=e[11],o},zb=p.lazy(()=>Us(()=>import("./FilesView-C6unlf1o.js").then(s=>s.F),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218])).then(s=>({default:s.FilesView}))),Ss=s=>Xs(s)??"",Pn=s=>{const e=Ss(s);return!e||e==="/"?e||"/":e.split("/").filter(Boolean).at(-1)??e},Fb=s=>{const e=Ss(s);if(!e||e==="/")return null;const t=e.lastIndexOf("/");return t<=0?e.startsWith("/")?"/":null:e.slice(0,t)},Wb=(s,e)=>{const t=Ss(s),i=Ss(e);return!i||t===i?Pn(t):t.startsWith(`${i}/`)?t.slice(i.length+1):t},$b=s=>{if(typeof s!="number"||!Number.isFinite(s)||s<0)return"";if(s<1024)return`${s} B`;const e=["KB","MB","GB"];let t=s/1024;for(const i of e){if(t<1024||i===e[e.length-1])return`${t.toFixed(t>=10?0:1)} ${i}`;t/=1024}return""},Kb=s=>{const e=oe.c(5),{onClose:t,visible:i}=s,a=i===void 0?!0:i,r=ba(),c=Ss(xa(r,er()));if(r?.kind==="preparing"){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Ca,{}),e[0]=d):d=e[0],d}let o;return e[1]!==t||e[2]!==c||e[3]!==a?(o=n.jsx(Hb,{root:c,onClose:t,visible:a},c),e[1]=t,e[2]=c,e[3]=a,e[4]=o):o=e[4],o},Hb=({root:s,onClose:e,visible:t})=>{const{t:i}=ye(),{files:a}=Yi(),r=zl(),c=Fl(V=>V.setSelectedPath),[o,d]=p.useState(()=>({type:"browser",directory:s})),[u,l]=p.useState([]),[f,x]=p.useState(!1),[h,m]=p.useState(null),[g,b]=p.useState(""),[v,w]=p.useState([]),[k,E]=p.useState(!1),_=p.useRef(0),A=o.type==="browser"?o.directory:o.returnDirectory,S=p.useRef(A);S.current=A;const C=p.useCallback(async(V,se)=>{if(!V)return;const te=!r,re=_.current+1;_.current=re,x(!0),se?.background||m(null);try{const ne=await a.listDirectory(V,{respectGitignore:te});if(_.current!==re)return;m(null),l(ne.entries.slice().sort((ue,Y)=>ue.isDirectory!==Y.isDirectory?ue.isDirectory?-1:1:ue.name.localeCompare(Y.name)))}catch(ne){if(_.current!==re)return;if(se?.background){console.error("Failed to reload mobile directory:",ne);return}l([]),m(ne instanceof Error?ne.message:i("mobile.files.error.listFailed"))}finally{_.current===re&&x(!1)}},[a,r,i]);p.useEffect(()=>{o.type==="browser"&&C(o.directory)},[C,o]);const j=p.useRef(o);j.current=o;const T=p.useRef(u);T.current=u;const R=p.useCallback(({directories:V})=>{const se=j.current;se.type==="browser"&&(V&&!V.some(te=>Ss(te)===Ss(se.directory))||T.current.length>Uf||C(se.directory,{background:!0}))},[C]);Gf({root:s,active:t,whileInactive:"hold",onChanges:R});const K=p.useCallback(async V=>{Ss(V)===Ss(S.current)&&await C(S.current)},[C]),{canUpload:P,uploadingDirectory:z,pickFiles:O,uploadElements:D}=qf({root:s,refreshDirectory:K}),M=z!==null,L=ca(),W=p.useMemo(()=>({root:s,entries:tu(L,"file")}),[L,s]);p.useEffect(()=>{if(o.type!=="browser")return;const V=g.trim();if(!V){w([]),E(!1);return}let se=!1;const te=window.setTimeout(()=>{E(!0),a.search({directory:o.directory,query:V,maxResults:40}).then(re=>{se||w(re)}).catch(()=>{se||w([])}).finally(()=>{se||E(!1)})},250);return()=>{se=!0,window.clearTimeout(te)}},[a,g,o]);const F=V=>{b(""),d({type:"browser",directory:V})},N=V=>{c(s,V),d({type:"file",path:V,returnDirectory:A||s})},I=Ge(V=>V.pendingFileFocusPath),B=Ge(V=>V.pendingFileNavigation);if(p.useEffect(()=>{const V=Ss(B?.path??I??"");!V||!s||(c(s,V,{allowOutsideRoot:!0}),d(se=>({type:"file",path:V,returnDirectory:se.type==="file"?se.returnDirectory:s})),I&&Ge.getState().setPendingFileFocusPath(null))},[I,B,s,c]),!s)return n.jsx(_n,{message:i("mobile.files.empty.noDirectory")});if(o.type==="file")return n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[n.jsxs("header",{className:me(Vs,"border-b border-edge text-foreground"),children:[n.jsx("button",{type:"button",className:Qt,"aria-label":i("header.actions.backAria"),onClick:()=>d({type:"browser",directory:o.returnDirectory}),style:{touchAction:"manipulation"},children:n.jsx(G,{name:"arrow-left",className:"size-5"})}),n.jsx("div",{className:"min-w-0 flex-1",children:n.jsx("h2",{className:me("truncate",ni),children:Pn(o.path)})})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:n.jsx(It,{children:n.jsx(p.Suspense,{fallback:n.jsx(_n,{loading:!0,message:i("filesView.state.loading")}),children:n.jsx(zb,{mode:"editor-only"})})})})]});const Q=o.directory===s?i("mobile.files.rootDirectory"):Pn(o.directory),J=g.trim()?v:[],X=Fb(o.directory),q=o.directory!==s&&X!==null&&(X===s||X.startsWith(`${s}/`)),Z=q&&!g.trim(),H=q?X:null;return n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[D,n.jsxs("div",{className:"shrink-0 px-2 pt-1",children:[n.jsx(su,{value:g,onChange:b,placeholder:i("mobile.files.search.placeholder"),actions:n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",className:Ei,"aria-label":i("mobile.files.refreshAria"),onClick:()=>{C(o.directory)},children:n.jsx(Um,{className:me("size-4",f&&"animate-spin")})}),P?n.jsx("button",{type:"button",className:Ei,"aria-label":i("sidebarFilesTree.actions.uploadFilesTitle"),onClick:()=>O(o.directory),disabled:M,children:n.jsx(G,{name:M?"loader-4":"upload-2",className:me("size-4",M&&"animate-spin")})}):null,e?n.jsx("button",{type:"button",className:Ei,"aria-label":i("mobile.surface.closeAria"),onClick:e,children:n.jsx(Gm,{className:"size-4"})}):null]})}),Z&&H?n.jsxs("button",{type:"button",className:"flex min-h-11 w-full items-center gap-2.5 rounded-md px-2 text-start active:bg-interactive-hover focus:outline-none","aria-label":i("mobile.files.backToParentAria",{name:Pn(H)}),onClick:()=>F(H),children:[n.jsx(qm,{className:"size-4 shrink-0 text-muted-foreground"}),n.jsx("span",{className:"min-w-0 truncate typography-ui-label text-muted-foreground",children:Q})]}):null]}),n.jsx(bs,{outerClassName:"min-h-0 flex-1",className:"px-2 pb-3 pt-1",useScrollShadow:!0,disableHorizontal:!0,children:h?n.jsx(_n,{message:h}):g.trim()?n.jsx(Vb,{root:s,results:J,isSearching:k,actions:W,onOpenFile:N}):n.jsxs(n.Fragment,{children:[u.length===0&&!f?n.jsx("div",{className:"px-4 py-8 text-center typography-ui-label text-muted-foreground",children:i("mobile.files.empty.directory")}):null,u.map(V=>n.jsx(ll,{name:V.name,path:V.path,directory:V.isDirectory,meta:V.isDirectory?void 0:$b(V.size),actions:W,onClick:()=>V.isDirectory?F(V.path):N(V.path)},V.path))]})})]})},Ei="-my-1 flex size-9 shrink-0 items-center justify-center rounded-full text-muted-foreground touch-manipulation focus:outline-none active:bg-interactive-hover disabled:opacity-50",ll=s=>{const e=oe.c(45),{name:t,path:i,directory:a,meta:r,actions:c,onClick:o}=s,{t:d}=ye();let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u={touchAction:"manipulation"},e[0]=u):u=e[0];let l;e[1]!==a||e[2]!==i?(l=a?n.jsx(Ym,{className:"size-4 shrink-0 text-primary/80"}):n.jsx(va,{filePath:i,className:"size-4 shrink-0"}),e[1]=a,e[2]=i,e[3]=l):l=e[3];let f;e[4]!==t?(f=n.jsx("span",{className:"block min-w-0 flex-1 truncate typography-ui-label text-foreground",children:t}),e[4]=t,e[5]=f):f=e[5];let x;e[6]!==r?(x=r?n.jsx("span",{className:"min-w-0 max-w-[55%] shrink truncate typography-micro text-muted-foreground",dir:"auto",children:r}):null,e[6]=r,e[7]=x):x=e[7];let h;e[8]!==a?(h=a?n.jsx(Qm,{className:"size-4 shrink-0 text-muted-foreground"}):null,e[8]=a,e[9]=h):h=e[9];let m;e[10]!==o||e[11]!==l||e[12]!==f||e[13]!==x||e[14]!==h?(m=n.jsxs("button",{type:"button",className:"flex min-h-11 w-full items-center gap-2.5 rounded-md px-2 text-start active:bg-interactive-hover focus:outline-none",onClick:o,style:u,children:[l,f,x,h]}),e[10]=o,e[11]=l,e[12]=f,e[13]=x,e[14]=h,e[15]=m):m=e[15];const g=m;let b;e[16]!==i||e[17]!==d?(b=()=>{qi(i).then(j=>{if(j.ok){pe.success(d("sidebarFilesTree.toast.pathCopied"));return}pe.error(d("sidebarFilesTree.toast.copyFailed"))})},e[16]=i,e[17]=d,e[18]=b):b=e[18];const v=b;let w;e[19]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx(G,{name:"link",className:"me-1 size-4"}),e[19]=w):w=e[19];let k;e[20]!==d?(k=d("sidebarFilesTree.menu.copyPath"),e[20]=d,e[21]=k):k=e[21];let E;e[22]!==v||e[23]!==k?(E=n.jsxs(cs,{onClick:v,children:[w,k]}),e[22]=v,e[23]=k,e[24]=E):E=e[24];let _;e[25]!==c.entries.length?(_=c.entries.length>0?n.jsx(da,{}):null,e[25]=c.entries.length,e[26]=_):_=e[26];let A;if(e[27]!==c.entries||e[28]!==c.root||e[29]!==a||e[30]!==i||e[31]!==d){let j;e[33]!==c.root||e[34]!==a||e[35]!==i||e[36]!==d?(j=T=>n.jsxs(cs,{onClick:()=>{nu(T,{kind:"file",action:T.action.id,directory:c.root||null,path:i,isDirectory:a},d)},children:[n.jsx(si,{icon:T.icon,iconSrc:T.iconSrc,className:"me-1 size-4"}),T.action.label]},`${T.guest.id}:${T.action.id}`),e[33]=c.root,e[34]=a,e[35]=i,e[36]=d,e[37]=j):j=e[37],A=c.entries.map(j),e[27]=c.entries,e[28]=c.root,e[29]=a,e[30]=i,e[31]=d,e[32]=A}else A=e[32];let S;e[38]!==E||e[39]!==_||e[40]!==A?(S=n.jsxs(n.Fragment,{children:[E,_,A]}),e[38]=E,e[39]=_,e[40]=A,e[41]=S):S=e[41];let C;return e[42]!==g||e[43]!==S?(C=n.jsx(mr,{menu:S,children:g}),e[42]=g,e[43]=S,e[44]=C):C=e[44],C},Vb=s=>{const e=oe.c(19),{root:t,results:i,isSearching:a,actions:r,onOpenFile:c}=s,{t:o}=ye();if(a){let l;e[0]!==o?(l=o("common.loading"),e[0]=o,e[1]=l):l=e[1];let f;return e[2]!==l?(f=n.jsx(_n,{loading:!0,message:l}),e[2]=l,e[3]=f):f=e[3],f}if(i.length===0){let l;e[4]!==o?(l=o("mobile.files.search.empty"),e[4]=o,e[5]=l):l=e[5];let f;return e[6]!==l?(f=n.jsx(_n,{message:l}),e[6]=l,e[7]=f):f=e[7],f}let d;if(e[8]!==r||e[9]!==c||e[10]!==i||e[11]!==t){let l;e[13]!==r||e[14]!==c||e[15]!==t?(l=f=>n.jsx(ll,{name:Pn(f.path),path:f.path,directory:!1,meta:Wb(f.path,t),actions:r,onClick:()=>c(f.path)},f.path),e[13]=r,e[14]=c,e[15]=t,e[16]=l):l=e[16],d=i.map(l),e[8]=r,e[9]=c,e[10]=i,e[11]=t,e[12]=d}else d=e[12];let u;return e[17]!==d?(u=n.jsx(n.Fragment,{children:d}),e[17]=d,e[18]=u):u=e[18],u},_n=s=>{const e=oe.c(7),{message:t,loading:i}=s,a=i===void 0?!1:i;let r;e[0]!==a?(r=a?n.jsx(Jm,{className:"size-5 animate-spin text-muted-foreground"}):n.jsx(Xm,{className:"size-6 text-muted-foreground"}),e[0]=a,e[1]=r):r=e[1];let c;e[2]!==t?(c=n.jsx("p",{className:"typography-ui-label font-semibold text-foreground",children:t}),e[2]=t,e[3]=c):c=e[3];let o;return e[4]!==r||e[5]!==c?(o=n.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center",children:n.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-2",children:[r,c]})}),e[4]=r,e[5]=c,e[6]=o):o=e[6],o},Ub=s=>{const e=oe.c(21),{visible:t,onLeave:i,sectionsDialogOpen:a,onSectionsDialogOpenChange:r}=s,{t:c}=ye(),o=yt(Gb),d=er()??null,u=iu(),[l,f]=p.useState(1);let x,h;e[0]!==t?(x=()=>{t&&f(qb)},h=[t],e[0]=t,e[1]=x,e[2]=h):(x=e[1],h=e[2]),p.useEffect(x,h);const m=!u.allSectionsHidden&&l===0;let g;e[3]!==d||e[4]!==u||e[5]!==i||e[6]!==o||e[7]!==t?(g=t&&!u.allSectionsHidden?n.jsx(ru.Provider,{value:i,children:n.jsx(ou.Provider,{value:!0,children:n.jsx(au,{onChange:f,children:n.jsx(bs,{useScrollShadow:!0,scrollShadowSize:24,outerClassName:"min-h-0 flex-1",className:"px-3 pb-4 pt-2",disableHorizontal:!0,children:n.jsx(lu,{sessionId:o,directory:d,repositoryEnabled:!Gi(d),layout:u})})})})}):null,e[3]=d,e[4]=u,e[5]=i,e[6]=o,e[7]=t,e[8]=g):g=e[8];let b;e[9]!==u.allSectionsHidden||e[10]!==r||e[11]!==m||e[12]!==c?(b=u.allSectionsHidden||m?n.jsxs("div",{className:"absolute inset-x-0 top-16 flex flex-col items-center px-6 text-center",children:[n.jsx("span",{className:"typography-ui-label text-muted-foreground",children:u.allSectionsHidden?c("chat.workStatus.sections.allHidden"):c("chat.workStatus.mobileEmpty")}),u.allSectionsHidden?n.jsx($e,{variant:"link",size:"sm",onClick:()=>r(!0),className:"mt-2 normal-case text-muted-foreground hover:text-foreground",children:c("chat.workStatus.sections.open")}):null]}):null,e[9]=u.allSectionsHidden,e[10]=r,e[11]=m,e[12]=c,e[13]=b):b=e[13];let v;e[14]!==r||e[15]!==a?(v=n.jsx(cu,{open:a,onOpenChange:r}),e[14]=r,e[15]=a,e[16]=v):v=e[16];let w;return e[17]!==g||e[18]!==b||e[19]!==v?(w=n.jsxs("div",{className:"relative flex h-full min-h-0 flex-col",children:[g,b,v]}),e[17]=g,e[18]=b,e[19]=v,e[20]=w):w=e[20],w};function Gb(s){return s.currentSessionId}function qb(s){return Math.max(s,1)}const Jb=p.lazy(()=>Us(()=>import("./GuestPanelContent-VypuCChp.js"),__vite__mapDeps([219,2,3,5,1,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,4,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180])).then(s=>({default:s.GuestPanelContent}))),To="mobile-surface-root",Xb=16,Ao=320,Yb="cubic-bezier(0.22, 1, 0.36, 1)",Qb=({open:s,onClose:e,tab:t,onTabChange:i,pendingChangesDiff:a,pendingChangesCommit:r,onOpenPlan:c,variant:o="drawer"})=>{const{t:d,direction:u}=ye(),l=p.useRef(null),f=p.useRef(null),[x,h]=p.useState(!1),[m,g]=p.useState(s),b=p.useRef(e);p.useEffect(()=>{b.current=e},[e]);const v=Ge(N=>N.mobileWorkspaceTabOrder),w=Ge(N=>N.mobileWorkspaceHiddenTabs),k=Ge(N=>N.setMobileWorkspaceTabOrder),E=wa(),_=Qi(N=>N.guests),A=Br(N=>N.countByGuest),[S,C]=p.useState(!1),j=p.useRef(t);p.useEffect(()=>{j.current=t},[t]);const T=()=>b.current();yr(f,{enabled:o==="drawer"&&s,...u==="rtl"?{onRightEdgeSwipe:T}:{onLeftEdgeSwipe:T}});const[R,K]=p.useState(()=>new Set);p.useEffect(()=>{s&&K(N=>{if(N.has(t))return N;const I=new Set(N);return I.add(t),I})},[s,t]),p.useEffect(()=>{K(N=>{const I=[...N].filter(B=>Hn(B)&&!E.includes(B));return I.length===0?N:new Set([...N].filter(B=>!I.includes(B)))})},[E]);const P=Br(N=>N.clearBadge);if(p.useEffect(()=>{s&&Hn(t)&&P(gi(t))},[P,s,t]),typeof document<"u"&&!l.current){let N=document.getElementById(To);N||(N=document.createElement("div"),N.id=To,document.body.appendChild(N)),l.current=N}if(p.useEffect(()=>{if(s){g(!0);const I=window.setTimeout(()=>h(!0),Xb);return()=>window.clearTimeout(I)}h(!1);const N=window.setTimeout(()=>g(!1),Ao+40);return()=>window.clearTimeout(N)},[s]),p.useEffect(()=>{if(!s)return;const N=document.body.style.overflow;o==="drawer"&&(document.body.style.overflow="hidden");const I=B=>{B.key!=="Escape"||j.current==="terminal"||mu(B.target)||ga(B)||b.current()};return document.addEventListener("keydown",I),()=>{o==="drawer"&&(document.body.style.overflow=N),document.removeEventListener("keydown",I)}},[s,o]),o==="drawer"&&!l.current)return null;const z={status:{id:"status",label:d("chat.workStatus.ariaLabel"),icon:n.jsx(G,{name:"list-indefinite",className:"h-3.5 w-3.5"})},changes:{id:"changes",label:d("mobile.menu.git"),icon:n.jsx(G,{name:"git-branch",className:"h-3.5 w-3.5"})},files:{id:"files",label:d("mobile.menu.files"),icon:n.jsx(G,{name:"file-text",className:"h-3.5 w-3.5"})},terminal:{id:"terminal",label:d("mobile.menu.terminal"),icon:n.jsx(G,{name:"terminal",className:"h-3.5 w-3.5"})},notes:{id:"notes",label:d("contextRail.surface.notes"),icon:n.jsx(G,{name:"sticky-note",className:"h-3.5 w-3.5"})}},O=N=>{const I=gi(N),B=_.find(X=>X.id===I),Q=B?.name??I,J=A[I]??0;return{id:N,label:Q,title:J>0?d(J===1?"contextRail.surface.plugin.badgeAriaSingle":"contextRail.surface.plugin.badgeAriaPlural",{label:Q,count:J}):Q,icon:n.jsxs("span",{className:"relative flex",children:[n.jsx(si,{icon:pa(B?.icon??""),iconSrc:B?ma(B.id,B.icon,Vo().authenticatedAsset):void 0,className:"h-3.5 w-3.5"}),J>0?n.jsx("span",{"aria-hidden":"true",className:"absolute -top-1.5 -end-1.5 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-[var(--status-info)] px-0.5 text-[0.5625rem] font-medium leading-none text-[var(--status-info-foreground)]",children:J>99?"99+":J}):null]})}},D=Wl(v,w,t,E),M=D.map(N=>Hn(N)?O(N):z[N]),L=M.length===1?M[0]:null,W=(N,I)=>{const B=$l(v,E),Q=B.findIndex(X=>X===N),J=B.findIndex(X=>X===I);Q<0||J<0||k(Wm(B,Q,J))},F=n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:Vs,children:[n.jsx("div",{className:"flex h-9 min-w-0 flex-1 items-center",children:L?n.jsxs("h2",{className:"flex min-w-0 items-center gap-2 px-1 typography-ui-label font-medium text-foreground",children:[n.jsx("span",{className:"flex shrink-0 text-muted-foreground",children:L.icon}),n.jsx("span",{className:"truncate",children:L.label})]}):m?n.jsx(du,{items:M,activeId:t,onSelect:N=>{const I=D.find(B=>B===N);I&&i(I)},onReorder:W,layoutMode:M.length>5?"scrollable":"fit",variant:"active-pill",nonCompositedIndicator:!0,inactiveTabsIconOnly:M.length>3,className:"h-full"}):null}),t==="status"?n.jsx("button",{type:"button",className:Qt,"aria-label":d("chat.workStatus.sections.open"),onClick:()=>C(!0),style:{touchAction:"manipulation"},children:n.jsx(G,{name:"list-settings",className:"size-5"})}):null,n.jsx("button",{type:"button",className:Qt,"aria-label":d("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:[R.has("status")?n.jsx("div",{className:me("h-full",t!=="status"&&"hidden"),children:n.jsx(It,{children:n.jsx(Ub,{visible:s&&t==="status",onLeave:e,sectionsDialogOpen:S,onSectionsDialogOpenChange:C})})}):null,R.has("changes")?n.jsx("div",{className:me("h-full",t!=="changes"&&"hidden"),children:n.jsx(It,{children:n.jsx(Ob,{visible:s&&t==="changes",initialDiff:a,initialCommit:r,onNavigatedToChat:e})})},a?`changes:${a.path}:${a.staged}`:"changes"):null,R.has("files")?n.jsx("div",{className:me("h-full",t!=="files"&&"hidden"),children:n.jsx(It,{children:n.jsx(Kb,{visible:s&&t==="files"})})}):null,R.has("terminal")?n.jsx("div",{className:me("h-full",t!=="terminal"&&"hidden"),children:n.jsx(It,{children:n.jsx(Jf,{visible:s&&t==="terminal"})})}):null,R.has("notes")?n.jsx("div",{className:me("h-full",t!=="notes"&&"hidden"),children:n.jsx(It,{children:n.jsx(Xf,{visible:s&&t==="notes",onActionComplete:e,onOpenPlan:c})})}):null,E.map(N=>{if(!R.has(N))return null;const I=_.find(B=>B.id===gi(N));return I?n.jsx("div",{className:me("h-full",t!==N&&"hidden"),children:n.jsx(It,{children:n.jsx(p.Suspense,{fallback:null,children:n.jsx(Jb,{mode:N,sharedSurface:fu(I),docking:uu(I),surfaceMounted:s&&t===N})})})},N):null})]})]});return o==="panel"?n.jsx("div",{className:"flex h-full min-h-0 flex-col bg-background text-foreground",children:F}):Tn.createPortal(n.jsx("section",{ref:f,role:"dialog","aria-modal":"true","aria-label":d("mobile.header.openWorkspaceAria"),"aria-hidden":!s,className:"oc-keyboard-inset-surface oc-bottom-safe-surface oc-side-safe-area fixed inset-0 z-50 flex flex-col bg-background text-foreground",style:{paddingTop:"var(--oc-safe-area-top, 0px)",transform:x?"none":u==="rtl"?"translateX(-100%)":"translateX(100%)",transition:`transform ${Ao}ms ${Yb}`,visibility:m?"visible":"hidden",pointerEvents:s?"auto":"none"},children:F}),l.current)};function Zb(s){const e=oe.c(4),t=2500,{uiFont:i}=pu(),[a,r]=p.useState(!1);let c,o;return e[0]!==t||e[1]!==i?(c=()=>{let d=!1;const u=()=>{d||r(!0)},l=()=>{requestAnimationFrame(()=>requestAnimationFrame(u))},f=Promise.all([hu(i).catch(ix),document.fonts?.ready?.then(nx).catch(sx)??Promise.resolve(),Hp.catch(tx)]).then(ex),x=new Promise(h=>{window.setTimeout(h,t)});return Promise.race([f,x]).then(l),()=>{d=!0}},o=[i,t],e[0]=t,e[1]=i,e[2]=c,e[3]=o):(c=e[2],o=e[3]),p.useEffect(c,o),a}function ex(){}function tx(){}function sx(){}function nx(){}function ix(){}const rx=sr({projectId:ln().trim().min(1).optional(),text:ln().optional()}),ox=sr({request:rx.nullish()}),cl=Na("ShortcutRequests"),ax=async()=>{const s=ox.safeParse(await cl.takePending());return s.success?s.data.request??null:null},lx=s=>{if(Ui()!=="ios")return()=>{};let e=!1,t=null;const i=()=>{ax().then(a=>{a&&s(a)}).catch(()=>{})};return cl.addListener("pending",i).then(a=>{if(e){a.remove();return}t=a}).catch(()=>{}),i(),()=>{e=!0,t?.remove()}},cx="openchamber",dx=s=>s.replace(/^\/+|\/+$/g,""),ux=s=>{const e=dx(s.pathname).split("/").filter(Boolean);return s.host?[s.host,...e]:e};function fx(s){if(typeof s!="string"||s.length===0)return null;let e;try{e=new URL(s)}catch{return null}if(e.protocol!==`${cx}:`)return null;const t=ux(e),i=(t[0]??"").toLowerCase(),a=t.slice(1),r=e.searchParams;switch(i){case"session":{const c=a[0]||r.get("id")||"";if(!c)return null;const o=r.get("message")?.trim()??"";return{type:"session",sessionId:c,directory:r.get("dir")??void 0,...gu(o)?{messageId:o}:{}}}case"new":case"new-session":return{type:"new-session",directory:r.get("dir")??void 0,projectId:r.get("project")??void 0,agent:r.get("agent")??void 0,model:r.get("model")??void 0};case"sessions":{const c=r.get("filter");return{type:"sessions",filter:c==="attention"||c==="recent"||c==="all"?c:void 0}}case"status":return{type:"status"};case"settings":return{type:"settings",section:a[0]||r.get("section")||void 0};case"changes":return{type:"changes",path:a.join("/")||r.get("path")||void 0,staged:r.get("staged")==="true"};case"view":{const c=(a[0]||"").toLowerCase();return c==="changes"?{type:"changes"}:c==="files"||c==="mcp"||c==="instances"||c==="update"?{type:"view",target:c}:null}default:return null}}let ls={},dl=!1,In=null;const mx=s=>{const e=yt.getState(),t=s.projectId?Yt.getState().projects.find(a=>a.id===s.projectId)??null:null;e.openNewSessionDraft(t?{selectedProjectId:t.id}:void 0);const i=s.text?.trim();if(i){if(s.projectId&&!t){zr.getState().setPendingInputText(i,"append");return}zr.getState().requestDraftSubmit(yt.getState().newSessionDraft.draftId,i)}},px=s=>{switch(s.type){case"shortcut-new-session":return mx(s),!0;case"session":return bu(s.sessionId,{directory:s.directory??null,messageId:s.messageId??null}),!0;case"new-session":{const e=yt.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 ls.openSessions?(ls.openSessions(s.filter),!0):!1;case"status":return ls.openSessions?(ls.openSessions(),!0):!1;case"view":return ls.openView?(ls.openView(s.target),!0):!1;case"changes":return ls.openChanges?(ls.openChanges({path:s.path,staged:s.staged}),!0):!1;case"settings":return ls.openSettings?(ls.openSettings(s.section),!0):!1}},vr=()=>{if(!dl||!In)return;const s=In;In=null,px(s)||(In=s)},Vi=s=>{In=s,vr()},Do=s=>{const e=fx(s);e&&Vi(e)},hx=s=>{dl=s,vr()},gx=s=>{const e=oe.c(3);let t,i;e[0]!==s?(t=()=>(ls=s,vr(),()=>{ls===s&&(ls={})}),i=[s],e[0]=s,e[1]=t,e[2]=i):(t=e[1],i=e[2]),p.useEffect(t,i)},bx=s=>{const{ready:e}=s;p.useEffect(()=>{hx(e)},[e]),p.useEffect(()=>{if(!Pt())return;let t=!1;const i=[];return Us(()=>import("./vendor-capacitor-app-BrDJj9I_.js"),__vite__mapDeps([220,1,109])).then(async({App:a})=>{if(t)return;const r=await a.addListener("appUrlOpen",c=>{Do(c?.url)});if(t){r.remove();return}i.push(()=>{r.remove()})}).catch(()=>{}),i.push(lx(a=>{Vi({type:"shortcut-new-session",projectId:a.projectId,text:a.text})})),Us(()=>import("./vendor-capacitor-push-notifications-KNe1zSBF.js"),__vite__mapDeps([221,109])).then(async({PushNotifications:a})=>{if(t)return;const r=await a.addListener("pushNotificationActionPerformed",c=>{const o=c?.notification?.data,d=typeof o?.url=="string"?o.url:typeof o?.deeplink=="string"?o.deeplink:void 0;if(d){Do(d);return}const u=typeof o?.sessionId=="string"?o.sessionId:void 0;u&&Vi({type:"session",sessionId:u})});if(t){r.remove();return}i.push(()=>{r.remove()})}).catch(()=>{}),()=>{t=!0,i.forEach(a=>a())}},[])},xx=()=>{if(typeof window>"u")return;const s=window.__OPENCHAMBER_APNS_ENV__;if(s==="development")return"sandbox";if(s==="production")return"production"},Mo=/^[A-Za-z0-9+/]{43}=$/,yx=Na("PushKey"),vx=async()=>{const s=window.__OPENCHAMBER_PUSH_KEY__;if(s&&Mo.test(s))return s;const e=await yx.get().then(t=>t.key).catch(()=>{});return e&&Mo.test(e)?e:void 0},wx=()=>{if(typeof window>"u")return!1;const e=window.Capacitor?.getPlatform?.();return e==="ios"||e==="android"},jx=s=>{const{enabled:e}=s,t=Ge(a=>a.nativeNotificationsEnabled),i=p.useRef(null);p.useEffect(()=>{if(!e||!t||!wx())return;let a=!1;const r=[];return Us(()=>import("./vendor-capacitor-push-notifications-KNe1zSBF.js"),__vite__mapDeps([221,109])).then(async({PushNotifications:c})=>{if(a)return;let o=await c.checkPermissions().catch(()=>null);if(o?.receive!=="granted"&&(o=await c.requestPermissions().catch(()=>null)),o?.receive!=="granted")return;const d=await c.addListener("registration",l=>{i.current=l.value,vx().then(f=>{const x=Er(),h={token:l.value,platform:Ui(),environment:xx()};f&&(h.pushKey=f),x?.push?.registerApnsToken?.(h)})}),u=await c.addListener("registrationError",l=>{console.warn("[Push] APNs registration error:",l)});if(await c.register().catch(()=>{}),a){d.remove(),u.remove();return}r.push(()=>{d.remove()},()=>{u.remove()})}).catch(()=>{}),()=>{a=!0,r.forEach(c=>c())}},[e,t]),p.useEffect(()=>{if(t)return;const a=i.current;if(!a)return;i.current=null,Er()?.push?.unregisterApnsToken?.({token:a})},[t])},Oo=s=>{const e=oe.c(12),{side:t,isResizing:i,ariaLabel:a,handleProps:r}=s,c=t==="left"?"inset-e-0":"inset-s-0";let o;e[0]!==c?(o=me("absolute inset-y-0 z-50 w-6 cursor-col-resize touch-none",c),e[0]=c,e[1]=o):o=e[1];const d=t==="left"?"inset-e-0":"inset-s-0",u=i&&"bg-[var(--interactive-border)]";let l;e[2]!==d||e[3]!==u?(l=me("absolute inset-y-0 w-[3px] transition-colors",d,u),e[2]=d,e[3]=u,e[4]=l):l=e[4];let f;e[5]!==l?(f=n.jsx("div",{className:l}),e[5]=l,e[6]=f):f=e[6];let x;return e[7]!==a||e[8]!==r||e[9]!==o||e[10]!==f?(x=n.jsx("div",{className:o,role:"separator","aria-orientation":"vertical","aria-label":a,...r,children:f}),e[7]=a,e[8]=r,e[9]=o,e[10]=f,e[11]=x):x=e[11],x},kx=320,Sx=380,Lo=280,Cx=560,Nx=900;function Bo(s,e,t,i){const a=oe.c(23),r=i===void 0?Cx:i,c=p.useRef(null);let o;a[0]!==t||a[1]!==r||a[2]!==e?(o=()=>{if(typeof window>"u")return t;const P=Number.parseInt(window.localStorage.getItem(e)??"",10);return Number.isFinite(P)?Math.min(r,Math.max(Lo,P)):t},a[0]=t,a[1]=r,a[2]=e,a[3]=o):o=a[3];const[d,u]=p.useState(o),[l,f]=p.useState(!1),x=p.useRef(0),h=p.useRef(d),m=p.useRef(null),g=p.useRef(null);let b;a[4]!==r?(b=P=>Math.min(r,Math.max(Lo,Math.round(P))),a[4]=r,a[5]=b):b=a[5];const v=b;let w;a[6]===Symbol.for("react.memo_cache_sentinel")?(w=P=>{const z=c.current;z&&(z.style.width=`${P}px`,z.style.minWidth=`${P}px`,z.style.maxWidth=`${P}px`,z.style.setProperty("--oc-ipad-sidebar-width",`${P}px`))},a[6]=w):w=a[6];const k=w;let E;a[7]!==d?(E=P=>{try{P.currentTarget.setPointerCapture(P.pointerId)}catch{}g.current=P.pointerId,x.current=P.clientX,h.current=d,m.current=d,f(!0),P.preventDefault()},a[7]=d,a[8]=E):E=a[8];const _=E;let A;a[9]!==v||a[10]!==s?(A=P=>{if(g.current!==P.pointerId)return;const z=(s==="left"?1:-1)*(Kl(P.currentTarget)?-1:1),O=v(h.current+(P.clientX-x.current)*z);m.current!==O&&(m.current=O,k(O))},a[9]=v,a[10]=s,a[11]=A):A=a[11];const S=A;let C;a[12]!==v||a[13]!==e?(C=P=>{if(g.current!==P.pointerId)return;try{P.currentTarget.releasePointerCapture(P.pointerId)}catch{}const z=v(m.current??h.current);g.current=null,m.current=null,f(!1),u(z);try{window.localStorage.setItem(e,String(z))}catch{}},a[12]=v,a[13]=e,a[14]=C):C=a[14];const j=C;let T;a[15]!==_||a[16]!==j||a[17]!==S?(T={onPointerDown:_,onPointerMove:S,onPointerUp:j,onPointerCancel:j},a[15]=_,a[16]=j,a[17]=S,a[18]=T):T=a[18];const R=T;let K;return a[19]!==R||a[20]!==l||a[21]!==d?(K={asideRef:c,width:d,isResizing:l,handleProps:R},a[19]=R,a[20]=l,a[21]=d,a[22]=K):K=a[22],K}const Rx=()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,Ix=200;function zo(s){const e=oe.c(6),[t,i]=p.useState(!1),[a,r]=p.useState(s);s!==a&&(r(s),i(!s&&!Rx()));let c,o;e[0]!==t?(c=()=>{if(!t)return;const l=window.setTimeout(()=>i(!1),Ix);return()=>window.clearTimeout(l)},o=[t],e[0]=t,e[1]=c,e[2]=o):(c=e[1],o=e[2]),p.useEffect(c,o);const d=s||t;let u;return e[3]!==s||e[4]!==d?(u={placed:d,inPlace:s},e[3]=s,e[4]=d,e[5]=u):u=e[5],u}const Fo=["general","isolated-spaces","appearance","chat","notifications","sessions","routing","projects","git","magic-prompts","snippets","behavior","agents","commands","mcp","plugins","skills.installed","skills.catalog","providers","web-search","usage","voice","integrations","extensions","about"],Ex=1e3,Px=p.lazy(()=>Us(()=>import("./useAppFontEffects-BkjZnJsc.js").then(s=>s.ue),__vite__mapDeps([4,2,3,5,1,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180])).then(s=>({default:s.PluginPane}))),_x=({onActiveConnectionDeleted:s})=>{const{t:e,direction:t}=ye();bm();const[i,a]=p.useState(!1);p.useEffect(()=>yt.subscribe((U,Ce)=>{U.currentSessionId&&U.currentSessionId!==Ce.currentSessionId&&Ge.getState().setRunOverviewKey(null)}),[]);const r=Ge(U=>U.runOverviewKey!==null);p.useEffect(()=>{r&&a(!1)},[r]);const[c,o]=p.useState(null),[d,u]=p.useState(!1),[l,f]=p.useState(()=>{const{mobileWorkspaceTabOrder:U,mobileWorkspaceHiddenTabs:Ce}=Ge.getState();return bi(U,Ce)[0]}),x=p.useCallback(()=>{const{mobileWorkspaceTabOrder:U,mobileWorkspaceHiddenTabs:Ce}=Ge.getState(),qe=Au(Qi.getState().guests),he=bi(U,Ce,qe);f(ut=>he.includes(ut)?ut:he[0]),u(!0)},[]),[h,m]=p.useState(null),[g,b]=p.useState("nav"),[v,w]=p.useState(null),k=v&&"diff"in v?v.diff:null,E=v&&"commit"in v?v.commit:null,_=wa();p.useEffect(()=>{if(!Hn(l)||_.includes(l))return;const{mobileWorkspaceTabOrder:U,mobileWorkspaceHiddenTabs:Ce}=Ge.getState();f(bi(U,Ce,_)[0])},[_,l]);const A=Ge(U=>U.openGuestPageId),C=fa().find(U=>U.id===A)??null;p.useEffect(()=>{A&&!C&&Ge.getState().setOpenGuestPage(null)},[C,A]);const j=p.useCallback(()=>Ge.getState().setOpenGuestPage(null),[]),T=Ge(U=>U.setSettingsPage),R=Ge(U=>U.wideChatLayoutEnabled),K=$s(U=>U.available),P=$s(U=>U.runtimeType),z=p.useMemo(()=>tr(),[]),O=p.useCallback(()=>{o(null),m(null)},[]),D=p.useCallback(U=>{o(U)},[]),M=p.useCallback(()=>{u(!1)},[]),L=p.useCallback(U=>{b(U),D("settings")},[D]);p.useEffect(()=>Ib(Fo,L),[L]);const{enabled:W,roomyForPanels:F,roomyForOnePanel:N}=Ji(),I=F||N,Q=Du()==="portrait",J=Mu(),[X,q]=p.useState(()=>{const U=Ou();return U.roomyForPanels||U.roomyForOnePanel}),Z=p.useCallback(()=>{q(U=>!U)},[]),H=p.useRef(W);p.useEffect(()=>{W?!H.current&&!d&&q(!0):q(!1),H.current=W},[W,d]);const V=p.useCallback(()=>{w(null),f("files"),u(!0)},[]);p.useEffect(()=>Wr(U=>{if(U.type!=="file-open-request")return;const Ce=U.directory??an.getState().currentDirectory;if(!Ce)return;const qe=()=>{Ge.getState().openContextFile(Ce,U.path),V()},{sessionId:he}=U;if(!he){qe();return}Nb(he,async lt=>gn.getState().entityById.get(lt)??await _i.getSession(lt).catch(()=>null)).then(lt=>{const Ct=()=>{const{currentSessionId:Je}=yt.getState();return Je===he||lt.some(et=>et.id===Je)};if(Ct()){qe();return}const ft=lt[0]?.title;pe.info(Rb(U.path),{id:`file-open-${he}:${U.path}`,description:ft?e("chat.fileOpenRequest.toast.description",{session:ft}):e("chat.fileOpenRequest.toast.descriptionUntitled"),action:{label:e("chat.fileOpenRequest.toast.openSession"),onClick:()=>{Lu(he,Ce),O(),a(!1),Ct()&&qe()}}})})}),[O,V,e]),p.useEffect(()=>Wr(U=>{if(U.type!=="plan-open-request")return;const Ce=Bu(U.directory??an.getState().currentDirectory,U.projectId);Ce&&m({id:U.planId,title:U.title,projectRef:Ce})}),[]);const se=p.useCallback((U=null)=>{w(U?{diff:U}:null),f("changes"),u(!0)},[]);p.useEffect(()=>Ul(U=>{Ge.getState().setOpenGuestPage(null),U.tab==="changes"&&U.commit&&w({commit:{scope:"commit",directory:U.commit.directory}}),f(U.tab),u(!0)}),[]);const te=Bo("left","openchamber.ipad.leftSidebarWidth",kx),re=Bo("right","openchamber.ipad.rightSidebarWidth",Sx,Nx),ne=F||N,ue=p.useRef(null),Y=p.useRef({sidebarOpen:X,workspaceOpen:d});p.useLayoutEffect(()=>{const U=Y.current;if(Y.current={sidebarOpen:X,workspaceOpen:d},!N){const he=ue.current;ue.current=null,F&&he==="sidebar"?q(!0):F&&he==="workspace"&&u(!0);return}const Ce=X&&!U.sidebarOpen,qe=d&&!U.workspaceOpen;if(X&&d){Ce&&!qe?(ue.current="workspace",u(!1)):(ue.current="sidebar",q(!1));return}!d&&U.workspaceOpen&&ue.current==="sidebar"?(ue.current=null,q(!0)):!X&&U.sidebarOpen&&ue.current==="workspace"&&(ue.current=null,u(!0))},[N,F,X,d]);const ie=zo(W&&X),ae=zo(ne&&d),Pe=N&&X,Be=N&&d,xe=ne&&ae.placed&&!Pe?re.width:0,Re=W&&ie.placed&&!Be?te.width:0,le=t==="rtl"?"100%":"-100%",ce=t==="rtl"?"-100%":"100%";p.useEffect(()=>($r.setState({left:Re,right:xe}),()=>$r.setState({left:0,right:0})),[Re,xe]),p.useEffect(()=>{if(typeof document>"u")return;const U=document.documentElement;return U.classList.toggle("wide-chat-layout",R),()=>U.classList.remove("wide-chat-layout")},[R]),p.useEffect(()=>{if(typeof document>"u")return;const U=W&&(Q||J),Ce=document.documentElement;return Ce.classList.toggle("oc-keep-draft-starters",U),()=>Ce.classList.remove("oc-keep-draft-starters")},[J,W,Q]);const Ie=p.useMemo(()=>({openChanges:({diffPath:U,staged:Ce,scope:qe}={})=>{se(U?{path:U,staged:Ce===!0,scope:qe}:null)},openFiles:()=>V(),openSourceBoard:()=>D("board"),openPlan:m}),[se,V,D]),Ne=p.useMemo(()=>({openSessions:()=>{W?q(!0):a(!0)},openView:U=>{if(U==="files"){V();return}if(U==="mcp"){f("status"),u(!0);return}D(U)},openChanges:({path:U,staged:Ce}={})=>{se(U?{path:U,staged:Ce===!0}:null)},openSettings:U=>{U&&T(U),L(U?"page-content":"nav")}}),[W,se,V,L,D,T]);gx(Ne);const je=p.useRef(null),De=()=>{W?q(!0):a(!0)},We=()=>x();yr(je,{onLeftEdgeSwipe:t==="rtl"?We:De,onRightEdgeSwipe:t==="rtl"?De:We});const ct=p.useRef(null),Ue=p.useCallback(U=>{ct.current=U},[]),Me=p.useCallback(()=>zu()?!0:h?(m(null),!0):C?(j(),!0):c==="settings"&&ct.current?.()?!0:c?(O(),!0):d?(M(),!0):i?(a(!1),!0):!1,[c,j,O,M,C,h,i,d]);Fu(Me),Wu(Me,!!(h||C||c||d||i));const He=!z&&K&&(P==="desktop"||P==="web"),Oe=W?"dialog":"fullscreen",rt=Ge(U=>U.overviewFeatureAvailable),nt=p.useMemo(()=>({instanceLabel:z?Ws():null,onOpenInstances:z?()=>D("instances"):void 0,onOpenSettings:()=>L("nav"),onOpenUsage:()=>D("usage"),onOpenScheduled:()=>D("scheduled"),onOpenArchive:()=>D("archive"),onOpenOverview:rt?()=>D("overview"):void 0,onOpenSourceBoard:()=>D("board"),onOpenUpdate:He?()=>D("update"):void 0}),[L,D,rt,z,He]),st=p.useCallback(U=>{O(),a(!1),U==="file"&&V()},[O,V]),ee=p.useCallback(()=>{O(),a(!1)},[O]),be=p.useCallback(()=>{O(),a(!1),W&&!I&&q(!1)},[O,W,I]),Ze=p.useCallback(()=>{O(),a(!1),W&&!I&&q(!1)},[O,W,I]);return n.jsx($u,{actions:Ie,children:n.jsxs("div",{className:"oc-mobile-app-shell main-content-safe-area oc-side-safe-area flex h-[100dvh] flex-row bg-background text-foreground","data-page-scroll-lock":"true",children:[W?n.jsxs("aside",{ref:te.asideRef,className:me("oc-ipad-sidebar relative flex h-full shrink-0 flex-col overflow-hidden"),style:{width:Re,minWidth:Re,maxWidth:Re,"--oc-ipad-sidebar-width":`${te.width}px`,overflowX:"clip"},"aria-hidden":!X,"data-page-scroll-lock":"true",children:[n.jsx("div",{className:me("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",te.isResizing&&"pointer-events-none",!X&&"pointer-events-none select-none"),style:{width:"var(--oc-ipad-sidebar-width)",overflowX:"hidden",paddingTop:"var(--oc-safe-area-top, 0px)",translate:ie.inPlace?void 0:le},children:n.jsx(It,{children:n.jsx(wo,{open:ie.placed,variant:"sidebar",onOpenChange:U=>{!U&&!I&&q(!1)},footer:nt})})}),X?n.jsx(Oo,{side:"left",isResizing:te.isResizing,ariaLabel:e("sidebar.resize.leftPanelAria"),handleProps:te.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(x1,{onOpenSessions:()=>W?Z():a(!0),onOpenWorkspace:x,compactTitle:W}),n.jsxs("main",{ref:je,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(It,{children:n.jsx(xm,{})})}),n.jsx(It,{children:n.jsx(Im,{})})]})]}),W?null:n.jsx(wo,{open:i,onOpenChange:a,footer:nt}),n.jsxs("aside",{ref:re.asideRef,className:me("relative flex h-full shrink-0 flex-col overflow-hidden"),style:{width:xe,minWidth:xe,maxWidth:xe,"--oc-ipad-sidebar-width":`${re.width}px`,overflowX:"clip"},"aria-hidden":!xe,"data-page-scroll-lock":"true",children:[n.jsx("div",{className:me("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",ne&&"border-s border-edge bg-background",re.isResizing&&"pointer-events-none",!ae.inPlace&&"pointer-events-none select-none"),style:{width:"var(--oc-ipad-sidebar-width)",overflowX:"hidden",paddingTop:"var(--oc-safe-area-top, 0px)",translate:ae.inPlace?void 0:ce},children:n.jsx(It,{children:n.jsx(Qb,{open:ne?ae.placed:d,onClose:M,tab:l,onTabChange:f,pendingChangesDiff:k,pendingChangesCommit:E,onOpenPlan:m,variant:ne?"panel":"drawer"})})}),ne&&d?n.jsx(Oo,{side:"right",isResizing:re.isResizing,ariaLabel:e("sidebar.resize.rightPanelAria"),handleProps:re.handleProps}):null]}),h?n.jsx(gs,{open:!0,variant:Oe,onClose:()=>m(null),ariaLabel:h.title,title:h.title,children:n.jsx(It,{children:n.jsx(Sm,{savedProjectPlan:{projectRef:h.projectRef,planId:h.id},onClose:()=>m(null),onNavigatedToChat:()=>{O(),M()}})})}):null,C?n.jsx(gs,{open:!0,variant:Oe,dialogAlign:"app",onClose:j,ariaLabel:C.pageTitle??C.name,title:C.pageTitle??C.name,disableEscapeDismiss:!0,children:n.jsx(It,{children:n.jsx(p.Suspense,{fallback:null,children:n.jsx(Px,{mode:Ho(C.id),surface:"page"},C.id)})})}):null,n.jsx(It,{children:n.jsx(Ku,{})}),c==="instances"&&z?n.jsx(gs,{open:!0,variant:Oe,dialogAlign:"app",onClose:O,ariaLabel:e("mobile.menu.instances"),title:e("mobile.menu.instances"),children:n.jsx(k1,{onConnect:O,onActiveConnectionDeleted:s})}):null,c==="settings"?n.jsx(gs,{open:!0,variant:Oe,dialogAlign:"app",onClose:O,ariaLabel:e("mobile.menu.settings"),headerless:!0,children:n.jsx(It,{children:n.jsx(jm,{forceMobile:!0,isWindowed:!0,initialMobileStage:g,registerBackHandler:Ue,visiblePageSlugs:[...Fo],onClose:O})})}):null,c==="usage"?n.jsx(gs,{open:!0,variant:Oe,dialogAlign:"app",onClose:O,ariaLabel:e("usageStats.title"),title:e("usageStats.title"),children:n.jsx(It,{children:n.jsx(tp,{})})}):null,c==="scheduled"?n.jsx(gs,{open:!0,variant:Oe,dialogAlign:"app",onClose:O,ariaLabel:e("sessions.scheduledTasks.dialog.title"),title:e("sessions.scheduledTasks.dialog.title"),children:n.jsx(It,{children:n.jsx(rp,{layout:"mobile",onLeave:st})})}):null,c==="board"?n.jsx(gs,{open:!0,variant:Oe,dialogAlign:"app",onClose:O,ariaLabel:e("sourceBoard.title"),headerless:!0,children:n.jsx(It,{children:n.jsx(np,{onLeave:ee,onClose:O})})}):null,c==="overview"&&rt?n.jsx(gs,{open:!0,variant:Oe,dialogAlign:"app",onClose:O,ariaLabel:e("overview.title"),title:e("overview.title"),children:n.jsx(It,{children:n.jsx(ip,{layout:"mobile",onLeave:be})})}):null,c==="archive"?n.jsx(gs,{open:!0,variant:Oe,dialogAlign:"app",onClose:O,ariaLabel:e("sessions.archivePage.title"),title:e("sessions.archivePage.title"),children:n.jsx(It,{children:n.jsx(sp,{layout:"mobile",onLeave:Ze})})}):null,c==="update"?n.jsx(gs,{open:!0,variant:Oe,dialogAlign:"app",onClose:O,ariaLabel:e("mobile.menu.update"),title:e("mobile.menu.update"),children:n.jsx(It,{children:n.jsx(bs,{outerClassName:"h-full",className:"px-5 py-4",disableHorizontal:!0,children:n.jsx(km,{initialUpdateDialogOpen:!0})})})}):null]})})};function Tx(s){const e=oe.c(141),{apis:t}=s,i=Ge(ay),{t:a}=ye(),r=ss(oy),c=ss(ry),o=ss(iy),d=ss(ny),u=ss(sy),l=ss(ty),f=ss(ey),x=ss(Zx),h=an(Qx),m=yt(Yx),g=yt(Xx),b=Ge(Jx),v=Bi(qx),w=Hl(Gx),k=gn(Ux);let E;e[0]!==k?(E=k??[],e[0]=k,e[1]=E):E=e[1];const _=E,A=k!=null;let S;e[2]!==_||e[3]!==A?(S={hasAuthoritativeGlobalSessions:A,sessions:_},e[2]=_,e[3]=A,e[4]=S):S=e[4],Yf(S);const[C,j]=p.useState(0),[T,R]=p.useState(0),[K,P]=p.useState(!1),[z,O]=p.useState("pending"),[D,M]=p.useState(null);let L;e[5]===Symbol.for("react.memo_cache_sentinel")?(L=Ws(),e[5]=L):L=e[5];const W=L,[,F]=p.useReducer(Vx,0);let N;e[6]===Symbol.for("react.memo_cache_sentinel")?(N=tr(),e[6]=N):N=e[6];const I=N,B=p.useRef(0),Q=p.useRef(0);let J;e[7]!==l||e[8]!==t.sourceControl||e[9]!==t.trackers||e[10]!==r||e[11]!==x||e[12]!==f||e[13]!==u||e[14]!==v||e[15]!==w?(J=()=>{const ge=ms(),de=Q.current+1;if(Q.current=de,!ge){Cn("resume:auto-connect",{}),Nn();return}Cn("resume:reprobe",{});const Te=()=>{r(),w(t.sourceControl),v(t.sourceControl,{force:!0}),Fr(t.trackers),u===0&&f({source:"mobileApp:nativeResume"}),l===0&&x({source:"mobileApp:nativeResume"})},Ae=tt=>{Cn("resume:disconnect",{reason:tt}),Qs({apiBaseUrl:"",clientToken:null,runtimeKey:Fn}),j(Hx)};Gn().then(tt=>{if(Q.current===de){if(tt==="no-connection"){Ae("no-connection");return}if(tt==="needs-login"){M({kind:"auth-expired",label:Ws()??""}),Ae("needs-login");return}if(tt==="relay-limit"){M({kind:"relay-limit",label:Ws()??""}),Ae("relay-limit");return}if(tt==="unreachable"){const Bt=[4e3,1e4],Ut=zt=>{window.setTimeout(()=>{if(Q.current!==de)return;const _t=zt===Bt.length-1;Gn({fast:!_t}).then(Ke=>{if(Q.current===de&&Ke!=="switched"){if(Ke==="unchanged"){Te();return}if(Ke==="needs-login"){M({kind:"auth-expired",label:Ws()??""}),Ae("retry-needs-login");return}if(Ke==="relay-limit"){M({kind:"relay-limit",label:Ws()??""}),Ae("retry-relay-limit");return}if(!_t){Ut(zt+1);return}Ae(`retry-${Ke}`)}})},Bt[zt])};Ut(0);return}tt!=="switched"&&Te()}});const Le=Date.now();Le-B.current>=Ex&&(B.current=Le,window.dispatchEvent(new Event("openchamber:system-resume")))},e[7]=l,e[8]=t.sourceControl,e[9]=t.trackers,e[10]=r,e[11]=x,e[12]=f,e[13]=u,e[14]=v,e[15]=w,e[16]=J):J=e[16];const X=J;xu(),yu(X);let q,Z;e[17]!==X?(q=()=>{if(!I)return;let ge;const de=()=>{window.clearTimeout(ge),ge=window.setTimeout(()=>X(),1500)};return window.addEventListener("online",de),()=>{window.removeEventListener("online",de),window.clearTimeout(ge)}},Z=[I,X],e[17]=X,e[18]=q,e[19]=Z):(q=e[18],Z=e[19]),p.useEffect(q,Z);let H,V;e[20]!==X?(V=()=>{if(I)return Pr.subscribe((ge,de)=>{ge.state==="expired"&&de.state!=="expired"&&(X(),Pr.getState().markAuthenticated())})},H=[I,X],e[20]=X,e[21]=H,e[22]=V):(H=e[21],V=e[22]),p.useEffect(V,H);let se,te;e[23]!==X?(se=()=>{if(I)return Vl(ge=>{ti(ge)&&X()})},te=[I,X],e[23]=X,e[24]=se,e[25]=te):(se=e[24],te=e[25]),p.useEffect(se,te);let re,ne;e[26]!==t?(re=()=>(Go(t),Kx),ne=[t],e[26]=t,e[27]=re,e[28]=ne):(re=e[27],ne=e[28]),p.useEffect(re,ne);let ue;e[29]!==F?(ue=()=>Uo(ge=>{if(Cn("endpoint:changed",{runtimeKey:ge.runtimeKey||"none",previousRuntimeKey:ge.previousRuntimeKey||"none",connected:!!ge.apiBaseUrl}),!!ge.runtimeKey&&ge.runtimeKey===ge.previousRuntimeKey){lm(),F();return}cm(ge),R($x),j(Wx)}),e[29]=F,e[30]=ue):ue=e[30];let Y;e[31]===Symbol.for("react.memo_cache_sentinel")?(Y=[],e[31]=Y):Y=e[31],p.useEffect(ue,Y);let ie;e[32]!==o?(ie=()=>{if(!I||o||ms()){O("done");return}let ge=!1;return O("attempting"),(async()=>{const de=await Nn().catch(Fx);ge||(de.status==="unreachable"||de.status==="relay-limit"?M({kind:de.status,label:de.label}):de.status==="needs-login"&&M({kind:"auth-expired",label:de.label}),O("done"),de.status==="unreachable"&&Nn({fast:!1,skipIfConnected:!0}).catch(zx))})(),()=>{ge=!0}},e[32]=o,e[33]=ie):ie=e[33];let ae;e[34]===Symbol.for("react.memo_cache_sentinel")?(ae=[],e[34]=ae):ae=e[34],p.useEffect(ie,ae);let Pe,Be;e[35]===Symbol.for("react.memo_cache_sentinel")?(Pe=()=>{if(!I||!ms())return;let ge=!1;const de=Te=>{Cn("cold-launch:drop",{kind:Te?.kind??"unknown"}),Te&&M(Te),Qs({apiBaseUrl:"",clientToken:null,runtimeKey:Fn}),j(Bx)};return Gn().then(async Te=>{if(ge||Te==="switched"||Te==="unchanged")return;const Ae=Ws();if(Te==="needs-login"){de({kind:"auth-expired",label:Ae??""});return}if(Te==="unreachable"){de(Ae?{kind:"unreachable",label:Ae}:null),Nn({fast:!1,skipIfConnected:!0}).catch(Lx);return}if(Te==="relay-limit"){de({kind:"relay-limit",label:Ae??""});return}const Le=await Nn().catch(Ox);ge||Le.status==="connected"||(Le.status==="needs-login"?de({kind:"auth-expired",label:Le.label}):Le.status==="unreachable"||Le.status==="relay-limit"?de({kind:Le.status,label:Le.label}):de(null))}),()=>{ge=!0}},Be=[],e[35]=Pe,e[36]=Be):(Pe=e[35],Be=e[36]),p.useEffect(Pe,Be);let xe,Re;e[37]!==b?(xe=()=>{b(!0)},Re=[b],e[37]=b,e[38]=xe,e[39]=Re):(xe=e[38],Re=e[39]),p.useEffect(xe,Re);let le;e[40]!==r?(le=()=>{I&&!ms()||r()},e[40]=r,e[41]=le):le=e[41];let ce;e[42]!==C||e[43]!==r?(ce=[C,r,I],e[42]=C,e[43]=r,e[44]=ce):ce=e[44],p.useEffect(le,ce);let Ie,Ne;e[45]!==l||e[46]!==o||e[47]!==x||e[48]!==f||e[49]!==u?(Ie=()=>{o&&(u===0&&f({source:"mobileApp:recovery"}),l===0&&x({source:"mobileApp:recovery"}))},Ne=[l,o,x,f,u],e[45]=l,e[46]=o,e[47]=x,e[48]=f,e[49]=u,e[50]=Ie,e[51]=Ne):(Ie=e[50],Ne=e[51]),p.useEffect(Ie,Ne);const je=p.useRef(!1),[De,We]=p.useState(I);let ct;e[52]!==o?(ct=()=>{if(!I||!o||je.current)return;let ge=!1;const de=window.setTimeout(()=>We(!1),6e3);return(async()=>{const Te=await dm({refresh:!0});ge||(Te!=="failed"&&(je.current=!0),We(!1))})(),()=>{ge=!0,window.clearTimeout(de)}},e[52]=o,e[53]=ct):ct=e[53];let Ue;e[54]!==C||e[55]!==o?(Ue=[C,o,I],e[54]=C,e[55]=o,e[56]=Ue):Ue=e[56],p.useEffect(ct,Ue);let Me,He;e[57]!==h||e[58]!==o?(Me=()=>{o&&_i.setDirectory(h)},He=[h,o],e[57]=h,e[58]=o,e[59]=Me,e[60]=He):(Me=e[59],He=e[60]),p.useEffect(Me,He);let Oe,rt;e[61]!==t.sourceControl||e[62]!==t.trackers||e[63]!==o||e[64]!==v||e[65]!==w?(Oe=()=>{o&&(w(t.sourceControl),v(t.sourceControl,{force:!0}),Fr(t.trackers))},rt=[t.sourceControl,t.trackers,o,v,w],e[61]=t.sourceControl,e[62]=t.trackers,e[63]=o,e[64]=v,e[65]=w,e[66]=Oe,e[67]=rt):(Oe=e[66],rt=e[67]),p.useEffect(Oe,rt);let nt,st;e[68]!==g||e[69]!==m?(nt=()=>{if(!m)return;const ge=window.setTimeout(()=>g(),5e3);return()=>window.clearTimeout(ge)},st=[g,m],e[68]=g,e[69]=m,e[70]=nt,e[71]=st):(nt=e[70],st=e[71]),p.useEffect(nt,st);let ee;e[72]!==o?(ee=()=>{if(!(!o&&(I?!!ms():!0))){P(!1);return}const de=window.setTimeout(()=>{P(!0)},I?4e3:8e3);return()=>window.clearTimeout(de)},e[72]=o,e[73]=ee):ee=e[73];let be;e[74]!==C||e[75]!==o||e[76]!==T?(be=[o,I,C,T],e[74]=C,e[75]=o,e[76]=T,e[77]=be):be=e[77],p.useEffect(ee,be),vu();let Ze;e[78]===Symbol.for("react.memo_cache_sentinel")?(Ze={enabled:!0},e[78]=Ze):Ze=e[78],wu(Ze),Qf(),ju(),ku(),Zf(),em(t.sourceControl),tm(t.trackers),sm(),nm(),im(),rm(),om(h||null),am();const U=I&&o;let Ce;e[79]!==U?(Ce={enabled:U},e[79]=U,e[80]=Ce):Ce=e[80],jx(Ce);const qe=I&&o&&c;let he;e[81]!==qe?(he={ready:qe},e[81]=qe,e[82]=he):he=e[82],bx(he);const ut=Zb(),lt=!o&&d==="reconnecting";if(!ut){let ge;return e[83]===Symbol.for("react.memo_cache_sentinel")?(ge=n.jsx("main",{className:"flex min-h-dvh items-center justify-center bg-[var(--splash-background,var(--surface-background))] text-foreground",children:n.jsx(Zs,{width:120,height:120,isAnimated:!0,variant:"splash"})}),e[83]=ge):ge=e[83],ge}const Ct=!!ms();if(I&&(!Ct||!o&&!lt)){if(Ct){const Te=!K;let Ae;e[84]!==Te?(Ae=n.jsx(Zs,{width:120,height:120,isAnimated:Te,variant:"splash"}),e[84]=Te,e[85]=Ae):Ae=e[85];let Le;e[86]!==K||e[87]!==a?(Le=K?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("h1",{className:"typography-h3 text-foreground",children:a("sessionAuth.error.networkTitle")}),n.jsx("p",{className:"typography-markdown text-muted-foreground",children:a("mobile.connect.recovery.description")})]}),n.jsx($e,{type:"button",variant:"outline",onClick:()=>{Qs({apiBaseUrl:"",clientToken:null,runtimeKey:Fn}),j(Mx)},children:a("mobile.connect.cancelPassword")})]}):null,e[86]=K,e[87]=a,e[88]=Le):Le=e[88];let tt;return e[89]!==Ae||e[90]!==Le?(tt=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:[Ae,Le]})}),e[89]=Ae,e[90]=Le,e[91]=tt):tt=e[91],tt}if(z!=="done"){let Te;e[92]===Symbol.for("react.memo_cache_sentinel")?(Te=n.jsx(Zs,{width:120,height:120,isAnimated:!0,variant:"splash"}),e[92]=Te):Te=e[92];let Ae;e[93]!==a?(Ae=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:a("mobile.connect.splash.connectingTo")}),n.jsxs("p",{className:"typography-small text-foreground",children:[W,n.jsx(Su,{})]})]}):null,e[93]=a,e[94]=Ae):Ae=e[94];let Le;return e[95]!==Ae?(Le=n.jsxs("main",{className:"relative flex min-h-dvh items-center justify-center bg-[var(--splash-background,var(--surface-background))] text-foreground",children:[Te,Ae]}),e[95]=Ae,e[96]=Le):Le=e[96],Le}let ge;e[97]===Symbol.for("react.memo_cache_sentinel")?(ge=()=>j(Dx),e[97]=ge):ge=e[97];let de;return e[98]!==D?(de=n.jsx(n.Fragment,{children:n.jsx(s1,{onConnected:ge,notice:D})}),e[98]=D,e[99]=de):de=e[99],de}if(!o&&!lt){if(!K){let tt;return e[100]===Symbol.for("react.memo_cache_sentinel")?(tt=n.jsx("main",{className:"flex min-h-dvh items-center justify-center bg-[var(--splash-background,var(--surface-background))] text-foreground",children:n.jsx(Zs,{width:120,height:120,isAnimated:!0,variant:"splash"})}),e[100]=tt):tt=e[100],tt}let ge;e[101]!==a?(ge=a("sessionAuth.error.networkTitle"),e[101]=a,e[102]=ge):ge=e[102];let de;e[103]!==ge?(de=n.jsx("h1",{className:"typography-h3 text-foreground",children:ge}),e[103]=ge,e[104]=de):de=e[104];let Te;e[105]!==a?(Te=a("sessionAuth.error.networkDescription"),e[105]=a,e[106]=Te):Te=e[106];let Ae;e[107]!==Te?(Ae=n.jsx("p",{className:"typography-markdown text-muted-foreground",children:Te}),e[107]=Te,e[108]=Ae):Ae=e[108];let Le;return e[109]!==de||e[110]!==Ae?(Le=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:[de,Ae]})}),e[109]=de,e[110]=Ae,e[111]=Le):Le=e[111],Le}let ft;e[112]===Symbol.for("react.memo_cache_sentinel")?(ft=_i.getSdkClient(),e[112]=ft):ft=e[112];const Je=h||"",et=!I||!De;let dt;e[113]!==et?(dt=n.jsx(um,{ready:et,animated:!0}),e[113]=et,e[114]=dt):dt=e[114];let Xe;e[115]!==c?(Xe=n.jsx(Cu,{backgroundWorkEnabled:c}),e[115]=c,e[116]=Xe):Xe=e[116];let ht,Se;e[117]===Symbol.for("react.memo_cache_sentinel")?(ht=n.jsx(fm,{}),Se=n.jsx(Zp,{}),e[117]=ht,e[118]=Se):(ht=e[117],Se=e[118]);let it,Qe,gt,bt,ot;e[119]===Symbol.for("react.memo_cache_sentinel")?(it=n.jsx(_x,{onActiveConnectionDeleted:()=>{zh(),Qs({apiBaseUrl:"",clientToken:null,runtimeKey:Fn}),j(Ax)}}),Qe=n.jsx(Nu,{}),gt=n.jsx(Ru,{}),bt=n.jsx(Iu,{}),ot=n.jsx(Eu,{}),e[119]=it,e[120]=Qe,e[121]=gt,e[122]=bt,e[123]=ot):(it=e[119],Qe=e[120],gt=e[121],bt=e[122],ot=e[123]);let _e;e[124]!==i?(_e=i?n.jsxs(n.Fragment,{children:[n.jsx(Cm,{}),n.jsx(mm,{}),n.jsx(Nm,{}),n.jsx(pm,{}),n.jsx(Rm,{})]}):null,e[124]=i,e[125]=_e):_e=e[125];let mt;e[126]===Symbol.for("react.memo_cache_sentinel")?(mt=n.jsx(oh,{}),e[126]=mt):mt=e[126];let xt;e[127]!==c?(xt=c?n.jsx(hm,{}):null,e[127]=c,e[128]=xt):xt=e[128];let ze;e[129]!==dt||e[130]!==Xe||e[131]!==_e||e[132]!==xt?(ze=n.jsx(Pu,{delayDuration:300,skipDelayDuration:150,children:n.jsxs("div",{className:"h-full bg-background text-foreground",children:[dt,Xe,ht,Se,it,Qe,gt,bt,ot,_e,mt,xt]})}),e[129]=dt,e[130]=Xe,e[131]=_e,e[132]=xt,e[133]=ze):ze=e[133];let at;e[134]!==t||e[135]!==ze?(at=n.jsx(_u,{apis:t,children:ze}),e[134]=t,e[135]=ze,e[136]=at):at=e[136];let Fe;return e[137]!==T||e[138]!==Je||e[139]!==at?(Fe=n.jsx(It,{children:n.jsx(Tu,{sdk:ft,directory:Je,children:at},T)}),e[137]=T,e[138]=Je,e[139]=at,e[140]=Fe):Fe=e[140],Fe}function Ax(s){return s+1}function Dx(s){return s+1}function Mx(s){return s+1}function Ox(){return{status:"no-candidate"}}function Lx(){return null}function Bx(s){return s+1}function zx(){return null}function Fx(){return{status:"no-candidate"}}function Wx(s){return s+1}function $x(s){return s+1}function Kx(){return Go(null)}function Hx(s){return s+1}function Vx(s){return s+1}function Ux(s){return s.authoritativeSessions}function Gx(s){return s.refresh}function qx(s){return s.refreshAll}function Jx(s){return s.setIsMobile}function Xx(s){return s.clearError}function Yx(s){return s.error}function Qx(s){return s.currentDirectory}function Zx(s){return s.loadAgents}function ey(s){return s.loadProviders}function ty(s){return s.agents.length}function sy(s){return s.providers.length}function ny(s){return s.connectionPhase}function iy(s){return s.isConnected}function ry(s){return s.isInitialized}function oy(s){return s.initializeApp}function ay(s){return s.isolatedSpacesEnabled}function ly(s){const e=oe.c(7),t=p.useSyncExternalStore(cy,ms,ms);let i;e[0]!==t?(i=!tr()||!!t,e[0]=t,e[1]=i):i=e[1];let a;e[2]!==s?(a=n.jsx(Tx,{...s}),e[2]=s,e[3]=a):a=e[3];let r;return e[4]!==i||e[5]!==a?(r=n.jsx(gm,{enabled:i,children:a}),e[4]=i,e[5]=a,e[6]=r):r=e[6],r}function cy(s){return Uo(()=>s())}function $w(s){window.__OPENCHAMBER_SURFACE__="mobile",Hu(),wm({logLabel:"[mobile-main]",onAppearanceSettled:Vp}),Qp(),Vu();const e=document.getElementById("root");if(!e)throw new Error("Root element not found");const i=window.Capacitor?.isNativePlatform?.()===!0||window.location.protocol==="capacitor:",a=i?{...s,notifications:{notifyAgentCompletion:async()=>!1,canNotify:()=>!1}}:s,r=n.jsx(vm,{children:n.jsx(ly,{apis:a})});kl.createRoot(e).render(n.jsx(Pi.StrictMode,{children:n.jsx(Uu,{children:n.jsx(Gu,{children:n.jsx(qu,{children:n.jsx(ym,{children:i?r:n.jsx(Ju,{children:r})})})})})}))}export{$w as renderMobileApp};
|