@openchamber/web 2.7.0 → 2.7.1-canary.20261108.12

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.
Files changed (115) hide show
  1. package/dist/assets/{AboutDialog-Bbu8cDW8.js → AboutDialog-uNKjHvzl.js} +1 -1
  2. package/dist/assets/{AboutLogo-sAyRFbrm.js → AboutLogo-BhyG0ENm.js} +1 -1
  3. package/dist/assets/{ArchiveView-DvLmQllR.js → ArchiveView-Jt6Qj8Ry.js} +1 -1
  4. package/dist/assets/{ChangeRequestDiffUnavailable-Ctc-P6zi.js → ChangeRequestDiffUnavailable-CNIWdYRx.js} +1 -1
  5. package/dist/assets/{ChangedPathLabel-CQOXgkIF.js → ChangedPathLabel-CCsE-8p4.js} +1 -1
  6. package/dist/assets/{CommandPalette-DHk0MqYi.js → CommandPalette-DrsFSbmk.js} +1 -1
  7. package/dist/assets/{DiffView-DPpu52DA.js → DiffView-DwaJOPUe.js} +1 -1
  8. package/dist/assets/{FilesView-CPrroDyU.js → FilesView-Hvxe_KqA.js} +4 -4
  9. package/dist/assets/{GitView-wWoZ95Yt.js → GitView-ZI_EafL9.js} +1 -1
  10. package/dist/assets/{GuestSurfacePane-BsMH8QjU.js → GuestSurfacePane-Ds8luSO0.js} +1 -1
  11. package/dist/assets/{HelpDialog-BZtzVj6Z.js → HelpDialog-DtZKoPZE.js} +1 -1
  12. package/dist/assets/{IntegrationsCatalogView-DJAOTlcc.js → IntegrationsCatalogView-DgdYlI3Z.js} +1 -1
  13. package/dist/assets/{JsonTreeView-BXv2HzlC.js → JsonTreeView-zAv-pn0X.js} +1 -1
  14. package/dist/assets/{MarkdownDiffPreview-CseaChSt.js → MarkdownDiffPreview-Bf9-WPy9.js} +1 -1
  15. package/dist/assets/{MarkdownRendererImpl-CyXOMsMS.js → MarkdownRendererImpl-w7LnAwp_.js} +4 -4
  16. package/dist/assets/{MemoryDebugPanel-xYvjTjLG.js → MemoryDebugPanel-ylQytlyw.js} +1 -1
  17. package/dist/assets/{NoteEditor-Bbrtl8rq.js → NoteEditor-0HEW8KrY.js} +1 -1
  18. package/dist/assets/{OfficeDocumentDiff-DXsfJnFq.js → OfficeDocumentDiff-BFr4rAHy.js} +1 -1
  19. package/dist/assets/{OnboardingScreen-DuWvo16v.js → OnboardingScreen-Bpj6hpDe.js} +1 -1
  20. package/dist/assets/{OpenCodeStatusDialog-9WRgjgWL.js → OpenCodeStatusDialog-CX3oxFSb.js} +1 -1
  21. package/dist/assets/{OverviewView-BzA9rGEs.js → OverviewView-UfIFJ3mf.js} +1 -1
  22. package/dist/assets/{PatchDiff-DVcyjZVm.js → PatchDiff-DC4ydsOW.js} +1 -1
  23. package/dist/assets/{PlanView-BGdba90K.js → PlanView-CgoTn3HJ.js} +1 -1
  24. package/dist/assets/{ProjectActionsDialog-ByPMdwFG.js → ProjectActionsDialog-B16N4lqs.js} +1 -1
  25. package/dist/assets/{ReplyCommand-pviKPDT8.js → ReplyCommand-CnDNvFmd.js} +1 -1
  26. package/dist/assets/{ReplyUiBlock-D7HPBgmq.js → ReplyUiBlock-BsOTgv8M.js} +1 -1
  27. package/dist/assets/{ReviewCards-CU1YHZkQ.js → ReviewCards-BkpTYy_a.js} +1 -1
  28. package/dist/assets/{RunOverview-uFEfusCK.js → RunOverview-DsffX3fI.js} +1 -1
  29. package/dist/assets/{ScheduledTasksDialog-J8i_b433.js → ScheduledTasksDialog-DgrAfpeX.js} +1 -1
  30. package/dist/assets/{SettingsView-CaUgulkI.js → SettingsView-B804XZvl.js} +1 -1
  31. package/dist/assets/{SettingsWindow-BVEVntuV.js → SettingsWindow-k5FSMAzV.js} +1 -1
  32. package/dist/assets/{SidebarSectionsManager-CIXOcE0-.js → SidebarSectionsManager-DH61-mRe.js} +1 -1
  33. package/dist/assets/{SourceBoardView-BW1OSOo1.js → SourceBoardView-BvGoSNer.js} +1 -1
  34. package/dist/assets/{SpaceAccessDialog-6GhzlMD8.js → SpaceAccessDialog-DHNqUzKD.js} +1 -1
  35. package/dist/assets/{SpaceApplyDialog-zB4jAExK.js → SpaceApplyDialog-DEOTeEjy.js} +1 -1
  36. package/dist/assets/{SpaceRow-C6QD41XF.js → SpaceRow-CBva6ofM.js} +1 -1
  37. package/dist/assets/{SpaceSetupOutput-6GuKiRed.js → SpaceSetupOutput-C4NhRkjl.js} +1 -1
  38. package/dist/assets/{SpacesView-BgncMV45.js → SpacesView-BGevrpQp.js} +1 -1
  39. package/dist/assets/{SubmoduleDiffSummary-BwVdGw0c.js → SubmoduleDiffSummary-Bebhaz7n.js} +1 -1
  40. package/dist/assets/{ToolOutputDialog-CC9hcX2C.js → ToolOutputDialog-B1gU22Tz.js} +1 -1
  41. package/dist/assets/{ToolPartDiffPreview-D15Ja459.js → ToolPartDiffPreview-CVy_zn_m.js} +1 -1
  42. package/dist/assets/{UiBlock-pyLxOJr6.js → UiBlock-C11qZK5T.js} +2 -2
  43. package/dist/assets/{UsageStatsView-CMf29PeL.js → UsageStatsView-CNm8WPSk.js} +1 -1
  44. package/dist/assets/{WalkthroughView-DeuNxpZ7.js → WalkthroughView-Bbwyk6rg.js} +1 -1
  45. package/dist/assets/{WorktreesView-jHcQwWBH.js → WorktreesView-BGIfERNs.js} +1 -1
  46. package/dist/assets/{appThemeRegistry-BwyM6n38.js → appThemeRegistry-DYzVI9tX.js} +1 -1
  47. package/dist/assets/{ar-DnPStsLU.js → ar-CT3AuXVj.js} +1 -1
  48. package/dist/assets/{codeHighlight-C7ZRQ5-2.js → codeHighlight-BcDjh6yS.js} +1 -1
  49. package/dist/assets/{columnWidthMemory-Cbfh5HD5.js → columnWidthMemory-BA6h4J11.js} +1 -1
  50. package/dist/assets/{computeVirtualFileMetrics-DVynfSBh.js → computeVirtualFileMetrics-DVfKKHny.js} +2 -2
  51. package/dist/assets/{contextFileOpenGuard-CKnYjgFC.js → contextFileOpenGuard-BC79wuu1.js} +1 -1
  52. package/dist/assets/{date-time-qS8d5iiz.js → date-time-DhfjtTnp.js} +1 -1
  53. package/dist/assets/{de-SUU4F7Nt.js → de-BdVTH897.js} +1 -1
  54. package/dist/assets/{documentClient-B0iRikhq.js → documentClient-JcxJ7vyh.js} +2 -2
  55. package/dist/assets/{documentExport-Cf0gMwM0.js → documentExport-C830mU4N.js} +1 -1
  56. package/dist/assets/{documentHost-cOykm7qf.js → documentHost-DKm0U_q_.js} +1 -1
  57. package/dist/assets/{es-BWlkhnKy.js → es-BFk4dosu.js} +1 -1
  58. package/dist/assets/{fileContentPoller-CKcqqhzG.js → fileContentPoller-BmcApnk-.js} +1 -1
  59. package/dist/assets/{flexokiTheme-deI9tWCZ.js → flexokiTheme-BMYGLHbL.js} +1 -1
  60. package/dist/assets/{fr-DN3Tx1EV.js → fr-CeExWqT9.js} +1 -1
  61. package/dist/assets/{he-B-7jIB_R.js → he-C_O5IfNH.js} +1 -1
  62. package/dist/assets/{highlights-B2Re-VTM.js → highlights-CIuWBj_n.js} +1 -1
  63. package/dist/assets/{index-D5Ed7hon.js → index-bD6u6GDm.js} +1 -1
  64. package/dist/assets/{initializeSharedPreferences-D5FLPdpI.js → initializeSharedPreferences-BcnhlF3e.js} +1 -1
  65. package/dist/assets/{install-sOrZWWGd.js → install-CSoRI5iX.js} +1 -1
  66. package/dist/assets/{install-request-C-zhz88k.js → install-request-EHX4ORhb.js} +1 -1
  67. package/dist/assets/{isDiffPlainText-DpcjRlB-.js → isDiffPlainText-saKoOWJx.js} +1 -1
  68. package/dist/assets/{isFilePlainText-DJ_bXU7C.js → isFilePlainText-DOjSDWo3.js} +1 -1
  69. package/dist/assets/{ja-DE4Yf-rX.js → ja-BlUqUBMY.js} +1 -1
  70. package/dist/assets/{katex.min-g52ii4Gs.js → katex.min-Bs5OLoA1.js} +4 -4
  71. package/dist/assets/{ko-CETaCyB8.js → ko-CGv47dWq.js} +1 -1
  72. package/dist/assets/{main-QRYvDkRZ.js → main-064y5MQB.js} +4 -4
  73. package/dist/assets/{main-89VT8Kff.js → main-D8yzv2tL.js} +2 -2
  74. package/dist/assets/{miniChat-CgHPqY7Z.js → miniChat-X7g2IHQj.js} +2 -2
  75. package/dist/assets/{mobile-BQrjPA_e.js → mobile-B5efB3tI.js} +2 -2
  76. package/dist/assets/{moveWorkspacePath-C4_JgpNC.js → moveWorkspacePath-BaEfuU4S.js} +1 -1
  77. package/dist/assets/{nl-CL94_9kf.js → nl-CavtTtNf.js} +1 -1
  78. package/dist/assets/{officeDocument-COfYG-XF.js → officeDocument-CQScRmC1.js} +1 -1
  79. package/dist/assets/{parseDiffFromFile-CD1h9Yf5.js → parseDiffFromFile-By5H8w4y.js} +1 -1
  80. package/dist/assets/{pierreDiffTint-Cg024Eeg.js → pierreDiffTint-CVm_qZm-.js} +1 -1
  81. package/dist/assets/{pl-Bk1GuZBm.js → pl-BQZVI44N.js} +1 -1
  82. package/dist/assets/{pt-BR-Bfrsw-GS.js → pt-BR-iqkU-MRA.js} +1 -1
  83. package/dist/assets/{relocateRestoredSession-C79EVzC-.js → relocateRestoredSession-CsK2RUM_.js} +2 -2
  84. package/dist/assets/{renderElectronMiniChatApp-lMVP5gEt.js → renderElectronMiniChatApp-DzVezwky.js} +2 -2
  85. package/dist/assets/{renderMarkdownForExport-DTutihQz.js → renderMarkdownForExport-BM19JOji.js} +1 -1
  86. package/dist/assets/{renderMobileApp-CmYW0oos.js → renderMobileApp-CiTrtu6R.js} +3 -3
  87. package/dist/assets/{resolveLanguages-lTTkQHer.js → resolveLanguages-DQXSOQcc.js} +1 -1
  88. package/dist/assets/{runtimeEndpointReset-BJm_77m2.js → runtimeEndpointReset-DiTyBUwe.js} +5 -5
  89. package/dist/assets/{scheduledTasksApi-CKPLiwD-.js → scheduledTasksApi-Z7dc8sXS.js} +1 -1
  90. package/dist/assets/{shiki-CQYsk6Az.js → shiki-DW-V1SDr.js} +1 -1
  91. package/dist/assets/{space-apply-BT-PjBF5.js → space-apply-8YUOtYvk.js} +1 -1
  92. package/dist/assets/{space-close-C1Qs6EK6.js → space-close-D7zK_obq.js} +1 -1
  93. package/dist/assets/{spaceNetwork-C14OnxrT.js → spaceNetwork-XStNVwJo.js} +1 -1
  94. package/dist/assets/{stream-tokenizer-xdyY_PEd.js → stream-tokenizer-BfPOSMyw.js} +1 -1
  95. package/dist/assets/{textMateThemeFromAppTheme-CRhUx8P-.js → textMateThemeFromAppTheme-CVOJt2hL.js} +1 -1
  96. package/dist/assets/{tr-Cgg3eQb7.js → tr-CYfLfxAg.js} +1 -1
  97. package/dist/assets/{uk-zPAKOL1d.js → uk-Bm__l5YX.js} +1 -1
  98. package/dist/assets/{useAppFontEffects-D9nf8G19.js → useAppFontEffects-3RimJo4B.js} +15 -15
  99. package/dist/assets/{useBranchPullRequestRequest-CaGsp4wW.js → useBranchPullRequestRequest-CMvepZei.js} +1 -1
  100. package/dist/assets/{useCallableModelProviders-B1YBs2FN.js → useCallableModelProviders-DpMos2Hl.js} +1 -1
  101. package/dist/assets/{useDiffFindSurface-DiINVOLu.js → useDiffFindSurface-Dy5ZvPrH.js} +1 -1
  102. package/dist/assets/{useGitCleanLine-BK-o3SG6.js → useGitCleanLine-COG7MPwc.js} +1 -1
  103. package/dist/assets/{useInlineCommentController-CzeMiLCm.js → useInlineCommentController-_L6_JHZ6.js} +1 -1
  104. package/dist/assets/{useMarkdownLocalAssets-wPn7MXUN.js → useMarkdownLocalAssets-CH5Ekvbl.js} +1 -1
  105. package/dist/assets/{useRootScrollLock-BvsNFl90.js → useRootScrollLock-DdknBCBa.js} +2 -2
  106. package/dist/assets/{useWalkthroughReview-CEo_4ZLc.js → useWalkthroughReview-Bi8eB9_G.js} +1 -1
  107. package/dist/assets/{useWholeFileComment-BexRzYws.js → useWholeFileComment-CqHAJ2YU.js} +1 -1
  108. package/dist/assets/{useWorktreeArchiveActions-DaRx6tMV.js → useWorktreeArchiveActions-D1kaQEP9.js} +1 -1
  109. package/dist/assets/{vendor-codemirror-language-data-z3n6zAAT.js → vendor-codemirror-language-data-DRsX0PKK.js} +2 -2
  110. package/dist/assets/{zh-CN-BPcuR4-K.js → zh-CN-Db0Y0Ij-.js} +1 -1
  111. package/dist/assets/{zh-TW-CmPAjna9.js → zh-TW-CuzqmROB.js} +1 -1
  112. package/dist/index.html +2 -2
  113. package/dist/mini-chat.html +2 -2
  114. package/dist/mobile.html +2 -2
  115. package/package.json +3 -3
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilesView-CPrroDyU.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-react--VO_rL_p.js","assets/vendor-scheduler-7OC5HNn7.js","assets/useAppFontEffects-D9nf8G19.js","assets/katex.min-g52ii4Gs.js","assets/vendor-zustand-C9tWdk0j.js","assets/vendor-zod--raI7LhK.js","assets/vendor-opencode-client-CeybcDBQ.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-7f7Y525Q.css","assets/vendor-base-ui-CqKCZJyd.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-CqfECoM0.js","assets/vendor-tanstack-virtual-core-BdFnkr_2.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-z3n6zAAT.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-CEhBoV5L.js","assets/vendor-class-variance-authority-5VPnzWs2.js","assets/flexokiTheme-deI9tWCZ.js","assets/vendor-codemirror-search-CWqbGraJ.js","assets/vendor-replit-codemirror-vim-DTiXsOdM.js","assets/vendor-replit-codemirror-vim-core-FHzKdNUS.js","assets/runtimeEndpointReset-BJm_77m2.js","assets/space-apply-BT-PjBF5.js","assets/runtimeEndpointReset-uDNKGwhp.css","assets/useMarkdownLocalAssets-wPn7MXUN.js","assets/fileContentPoller-CKcqqhzG.js","assets/useInlineCommentController-CzeMiLCm.js","assets/JsonTreeView-BXv2HzlC.js","assets/parseDiffFromFile-CD1h9Yf5.js","assets/computeVirtualFileMetrics-DVynfSBh.js","assets/themeResolver-DXizngAV.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-DJ_bXU7C.js","assets/vendor-strip-json-comments-5dJlOkP1.js","assets/codeHighlight-C7ZRQ5-2.js","assets/appThemeRegistry-BwyM6n38.js","assets/textMateThemeFromAppTheme-CRhUx8P-.js","assets/ReviewCards-CU1YHZkQ.js","assets/contextFileOpenGuard-CKnYjgFC.js","assets/vendor-react-drawio-C6TkEvnS.js","assets/vendor-codemirror-lint-aq8IpR1c.js","assets/moveWorkspacePath-C4_JgpNC.js","assets/model-dyJJrKMm.js","assets/vendor-fflate-DB4_FQr-.js","assets/documentClient-B0iRikhq.js","assets/UiBlock-pyLxOJr6.js","assets/date-time-qS8d5iiz.js","assets/vendor-openuidev-lang-core-DF2LaCPS.js","assets/columnWidthMemory-Cbfh5HD5.js","assets/document-attachments-CIZjaOGe.js","assets/useWholeFileComment-BexRzYws.js","assets/diffsHighlighter-BsxkaI3Q.js","assets/scheduledTasksApi-CKPLiwD-.js","assets/vendor-capacitor-app-BrDJj9I_.js","assets/vendor-capacitor-push-notifications-KNe1zSBF.js"])))=>i.map(i=>d[i]);
2
- import{f as re,r as hr,j as n,R as m,a as Es,h as Za}from"./vendor-react--VO_rL_p.js";import{aX as Gs,cl as Tr,cm as ui,cn as ct,cb as Gt,co as Os,ci as zs,j as So,cp as Wn,cq as Co,cr as el,cs as No,ct as tl,cu as sl,cv as nl,cw as rl,cx as il,u as Xe,l as Fs,n as yn,N as ol,O as al,E as ll,bB as Ar,w as kt,b as cl,cy as dl,A as Is,b6 as ul,c4 as fl,b5 as ml,c0 as pl,c1 as fi,c9 as hl,bs as gl,cz as bl,cA as xl,cB as mi,b0 as yl,aZ as Ro,cC as vl,cD as En,v as gr,cE as pi,cF as wl,bE as Eo,cG as hi}from"./katex.min-g52ii4Gs.js";import{Y as Xs,Z as Mt,fc as Io,fd as jl,ey as kl,bb as _o,jU as Sl,u as be,A as he,dW as Cl,I as G,fS as Nl,B as Ae,n as Yt,b6 as To,bl as Ms,aw as Rl,Q as ae,jV as El,du as nr,k as Mn,jW as Il,jX as _l,jY as Tl,fy as Al,V as Kt,aZ as Pl,jZ as rr,j_ as Dl,j$ as gi,k0 as bi,k1 as Ol,k2 as Ml,h1 as Pr,fu as Ll,fv as Bl,a0 as nt,gg as zl,gi as Ao,gj as Po,k3 as Do,cK as Fl,gk as $l,cI as Dr,cH as Oo,eF as Mo,k4 as Wl,bU as Lo,aN as $t,eE as Bo,bR as Or,k5 as Kl,k6 as Vl,k7 as Hl,cJ as ql,k8 as Ul,k9 as Gl,hA as Pn,id as br,hV as ps,cN as Xl,ka as Jl,ab as Yl,kb as Ql,kc as xr,cY as Mr,aQ as zo,cE as Fo,eQ as $o,eR as Wo,y as Zl,kd as ec,ke as tc,kf as sc,kg as nc,en as Ko,eo as rc,ep as ic,cl as xi,kh as yi,ki as oc,kj as ac,kk as lc,kl as cc,gP as Lr,km as dc,kn as uc,ko as yr,z as Vo,bf as fc,a3 as mc,dr as pc,kp as hc,fA as gc,kq as bc,fi as vi,kr as xc,ks as yc,a4 as vr,a5 as wr,a6 as jr,bX as wi,af as ir,a7 as un,ac as vc,ad as wc,ae as jc,jP as kc,ax as Sc,aB as Cc,e3 as Nc,kt as Rc,ku as Ec,kv as Ic,gq as _c,kw as Tc,cw as Ac,hX as Ho,hY as qo,aO as Br,bM as Pc,bP as Dc,kx as Oc,bQ as Mc,hq as Lc,hg as In,hh as Bc,cd as kr,hi as zc,hj as Fc,hr as $c,gD as Wc,hp as Kc,bS as Vc,hW as Hc,i0 as qc,gI as Uc,gE as Uo,bm as Gc,gH as Xc,ky as Jc,kz as Yc,kA as Qc,kB as Zc,i3 as ji,i5 as or,bT as _n,br as ed,bY as td,bV as rn,gL as sd,kC as nd,hn as rd,ho as id,hl as od,kD as ad,kE as ld,hx as cd,kF as dd,d8 as ud,bD as fd,bW as md,i9 as pd,ia as hd,ic as gd,i4 as bd,fq as Go,b2 as bt,dA as xd,kG as yd,kH as vd,kI as wd,kJ as jd,kK as kd,kL as Sd,e6 as Cd,kM as Nd,kN as Rd,kO as Ed,kP as Id,fY as _d,he as ki,kQ as zr,kR as Td,kS as Ad,fJ as Pd,fK as Dd,fL as Od,fM as Md,kT as Ld,kU as Si,kV as Bd,fO as zd,fP as Fd,fQ as $d,fR as Wd,fN as Kd,fT as Vd,fU as Hd,kW as qd,kX as Ud,kY as Gd,eS as Ci,kZ as Xd,k_ as Jd,k$ as Yd,l0 as Qd,l1 as Zd,l2 as eu,l3 as tu,aj as su,f$ as nu,g0 as ru,g1 as iu}from"./useAppFontEffects-D9nf8G19.js";import{aE as Cs,aF as ou,aG as au,aH as Xo,aI as Ni,aJ as lu,aK as cu,aL as du,aM as uu,aN as fu,aO as mu,aP as pu,aQ as hu,aR as gu,aS as bu,aT as xu,aU as yu,aV as vu,aW as Jo,aX as wu,aY as ju,aZ as ku,a_ as Su,a$ as Cu,b0 as Nu,b1 as Ru,b2 as Eu,i as Iu,S as _u,b3 as Tu,b4 as Au,ak as ln,as as Pu,at as Du,w as Ri,x as Ou,y as Mu,ax as Lu,ay as Bu,G as zu,am as Fu,C as Ei,az as Ii,aw as Yo,N as $u,b5 as Wu,b6 as Ku,aB as Vu,b7 as Hu,b8 as qu,b9 as Uu,ba as Gu,bb as Xu,bc as Ju,bd as Yu,be as Qu,bf as Zu,bg as ef,bh as tf,bi as sf,bj as nf,bk as rf,bl as of,bm as af,bn as lf,bo as cf,bp as df,bq as uf,br as ff,bs as mf,bt as pf,bu as hf}from"./runtimeEndpointReset-BJm_77m2.js";import{i as gf}from"./initializeSharedPreferences-D5FLPdpI.js";import{S as bf,A as xf}from"./SettingsView-CaUgulkI.js";import{PlanView as yf}from"./PlanView-BGdba90K.js";import{SpaceAccessDialog as vf}from"./SpaceAccessDialog-6GhzlMD8.js";import{SpaceApplyDialog as wf}from"./SpaceApplyDialog-zB4jAExK.js";import{SpaceSetupOutputDialog as jf}from"./SpaceSetupOutput-6GuKiRed.js";import{RunOverview as kf}from"./RunOverview-uFEfusCK.js";import{o as Fr,s as $s,a as Sf}from"./vendor-zod--raI7LhK.js";import{_ as gn}from"./vendor-vite-runtime-DD1OZmLC.js";import{p as Cf}from"./vendor-aparajita-capacitor-secure-storage-5IShChL0.js";import{Capacitor as Nf,registerPlugin as Qo}from"./vendor-capacitor-core-B4EWRrHz.js";import{a as Nt,b as vn,M as bs}from"./mobileHeader-DaHAqQ0c.js";import{h as Rf,i as _i,j as Ef,P as If,D as _f,f as Tf}from"./vendor-dnd-kit-core-Br1Cs7RV.js";import{S as Af,v as Pf,u as Df,s as Of,a as Mf}from"./vendor-dnd-kit-sortable-DpfLEOLv.js";import{C as Lf}from"./vendor-dnd-kit-utilities-DZ9KbT5S.js";import{k as Sr,M as Zo,s as Bf,d as zf,J as Ff,a as $f,P as Wf,K as Kf,U as Vf,Z as Hf,Q as qf,r as Uf}from"./vendor-remixicon-react-CLUUbkY9.js";import{S as Gf}from"./SpaceRow-C6QD41XF.js";import{toast as Ti}from"./vendor-sonner-Dw26OnzC.js";import{c as Xf}from"./vendor-zustand-C9tWdk0j.js";import{UsageStatsView as Jf}from"./UsageStatsView-CMf29PeL.js";import{ArchiveSessionsView as Yf}from"./ArchiveView-DvLmQllR.js";import{MobileSourceBoard as Qf}from"./SourceBoardView-BW1OSOo1.js";import{OverviewPage as Zf}from"./OverviewView-BzA9rGEs.js";import{ScheduledTasksView as em}from"./ScheduledTasksDialog-J8i_b433.js";import{i as tm,b as sm,u as nm,c as rm,d as im,e as om,s as am,S as lm}from"./SubmoduleDiffSummary-BwVdGw0c.js";import{a as cm,R as dm,I as um,C as fm,b as mm,c as pm,D as hm,u as gm,d as bm}from"./useGitCleanLine-BK-o3SG6.js";import{C as xm}from"./ChangedPathLabel-CQOXgkIF.js";import{u as ym,W as vm,c as wm,d as jm,g as km,f as Sm,h as Cm,l as Nm,k as Rm}from"./useWalkthroughReview-CEo_4ZLc.js";import{u as Em,a as Im,i as Ai,d as ar,B as _m,C as Tm,P as Am,R as Pm,b as Dm}from"./ChangeRequestDiffUnavailable-Ctc-P6zi.js";import{u as Om,P as Pi}from"./useBranchPullRequestRequest-CaGsp4wW.js";import{p as Mm}from"./parseDiffFromFile-CD1h9Yf5.js";import{i as ea,O as Lm}from"./OfficeDocumentDiff-DXsfJnFq.js";import{u as Bm}from"./useWholeFileComment-BexRzYws.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-opencode-client-CeybcDBQ.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-CqKCZJyd.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-CqfECoM0.js";import"./vendor-tanstack-virtual-core-BdFnkr_2.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-z3n6zAAT.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-CEhBoV5L.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./space-apply-BT-PjBF5.js";import"./install-sOrZWWGd.js";import"./vendor-yaml-CE-D_49-.js";import"./flexokiTheme-deI9tWCZ.js";import"./vendor-codemirror-search-CWqbGraJ.js";import"./vendor-replit-codemirror-vim-DTiXsOdM.js";import"./vendor-replit-codemirror-vim-core-FHzKdNUS.js";import"./codeHighlight-C7ZRQ5-2.js";import"./appThemeRegistry-BwyM6n38.js";import"./themeResolver-DXizngAV.js";import"./vendor-pierre-theming-D_TRfu0q.js";import"./textMateThemeFromAppTheme-CRhUx8P-.js";import"./vendor-dnd-kit-accessibility-CYclfhtC.js";import"./vendor-qrcode-Cl8OheHW.js";import"./vendor-dijkstrajs-COg3n3zL.js";import"./install-request-C-zhz88k.js";import"./vendor-strip-json-comments-5dJlOkP1.js";import"./useCallableModelProviders-B1YBs2FN.js";import"./AboutLogo-sAyRFbrm.js";import"./pageTitle-BT3-HFbv.js";import"./useInlineCommentController-CzeMiLCm.js";import"./fileContentPoller-CKcqqhzG.js";import"./useMarkdownLocalAssets-wPn7MXUN.js";import"./spaceNetwork-C14OnxrT.js";import"./useWorktreeArchiveActions-DaRx6tMV.js";import"./scheduledTasksApi-CKPLiwD-.js";import"./vendor-cron-parser-1X50-i0r.js";import"./vendor-luxon-BZ0puJYg.js";import"./date-time-qS8d5iiz.js";import"./computeVirtualFileMetrics-DVynfSBh.js";import"./isDiffPlainText-DpcjRlB-.js";import"./getFiletypeFromFileName-BgI9McTw.js";import"./vendor-diff-C3JhlQdm.js";import"./pierreDiffTint-Cg024Eeg.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-CU1YHZkQ.js";import"./diffsHighlighter-BsxkaI3Q.js";import"./document-attachments-CIZjaOGe.js";import"./vendor-fflate-DB4_FQr-.js";import"./documentClient-B0iRikhq.js";let ta=null,Di=!1;const zm=new Promise(s=>{ta=s});function Fm(){Di||(Di=!0,ta?.())}const $m=6,Wm=s=>s.parentID??null,Cr=s=>{const e=s.replace(/\/+$/,"");return e.slice(e.lastIndexOf("/")+1)||e},Km=s=>s.replace(/\\/g,"/").replace(/\/+$/,""),Vm=(s,e)=>{if(!s)return"";let t=null,r=-1;for(const o of e){const i=Km(o.path);(s===i||s.startsWith(`${i}/`))&&i.length>r&&(t=o,r=i.length)}return t?t.label?.trim()||Cr(t.path):Cr(s)},Hm=()=>{const s=Xs.getState().activeSessions,e=Mt.getState().projects,t=Io.getState().ids,r=jl.getState().rankById;let o=0;const i=[];for(const l of s){const u=kl(l);u&&(o+=1),Wm(l)===null&&i.push({session:l,unread:u,project:Vm(_o(l),e)})}i.sort((l,u)=>Sl(l.session,u.session,t,r));const a=i.slice(0,$m).map(({session:l,unread:u,project:c})=>({id:l.id,title:l.title??"",unread:u,project:c}));return{runtimeKey:Gs(),attentionCount:o,recentSessions:a,projects:e.map(l=>({id:l.id,label:l.label?.trim()||Cr(l.path)}))}},qm="__OPENCHAMBER_WIDGET_SNAPSHOT__",Um=()=>{typeof window>"u"||(window[qm]=()=>{try{return JSON.stringify(Hm())}catch{return null}})},Oi="mobile-app-update-available",Mi="mobile-app-update-toast-dismissed-version",Gm=()=>{const s=re.c(8),{t:e}=be(),t=Cs(Xm),r=Cs(Jm),o=Cs(Ym),i=Cs(Qm);let a;s[0]===Symbol.for("react.memo_cache_sentinel")?(a=new Set,s[0]=a):a=s[0];const l=hr.useRef(a);let u,c;return s[1]!==t||s[2]!==i||s[3]!==r||s[4]!==e||s[5]!==o?(u=()=>{if(Tr()!=="android"||r!=="mobile"||!t||!o||!i){he.dismiss(Oi);return}ui().getItem(Mi)!==o&&(l.current.has(o)||(l.current.add(o),he.info(e("mobileUpdate.toast.available.title"),{id:Oi,description:e("mobileUpdate.toast.available.description",{version:o}),duration:1/0,icon:n.jsx(G,{name:"download",className:"h-4 w-4 text-muted-foreground"}),action:{label:e("mobileUpdate.toast.actions.download"),onClick:()=>{Cl(i)}},onDismiss:()=>{const d=Cs.getState();d.available&&d.info?.version===o&&ui().setItem(Mi,o)}})))},c=[t,i,r,e,o],s[1]=t,s[2]=i,s[3]=r,s[4]=e,s[5]=o,s[6]=u,s[7]=c):(u=s[6],c=s[7]),hr.useEffect(u,c),null};function Xm(s){return s.available}function Jm(s){return s.runtimeType}function Ym(s){return s.info?.version}function Qm(s){return s.info?.downloadUrl}const Li="calc(var(--oc-safe-area-top, 0px) + var(--oc-visual-viewport-offset-top, 0px) + 16px)";function Zm(s){const e=re.c(3);let t,r;e[0]!==s?(t=()=>{const o=window.visualViewport,i=s.current;if(!o||!i)return;let a="";const l=()=>{const u=`${Math.max(0,Math.round(o.offsetTop))}px`;u!==a&&(a=u,i.style.setProperty("--oc-visual-viewport-offset-top",u))};return l(),o.addEventListener("scroll",l),o.addEventListener("resize",l),()=>{o.removeEventListener("scroll",l),o.removeEventListener("resize",l)}},r=[s],e[0]=s,e[1]=t,e[2]=r):(t=e[1],r=e[2]),m.useEffect(t,r)}function ep(){const s=re.c(1),e=m.useRef(null);Zm(e);let t;return s[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx("div",{ref:e,className:"contents",children:n.jsx(Nl,{position:"top-center",layout:"banner",offset:Li,mobileOffset:{top:Li}})}),s[0]=t):t=s[0],t}const Bi=300,tp="openchamber.mobile.connectLog.v1",Ls=[];if(typeof window<"u")try{window.localStorage.removeItem(tp)}catch{}const $r=(s,e)=>{Ls.push({at:Date.now(),step:s,detail:e}),Ls.length>Bi&&Ls.splice(0,Ls.length-Bi)};typeof window<"u"&&$r("app:launch","{}");const sp=()=>[...Ls],np=s=>{const e=new Date(s),t=(r,o=2)=>String(r).padStart(o,"0");return`${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}.${t(e.getMilliseconds(),3)}`},sa=s=>`${np(s.at)} ${s.step}${s.detail&&s.detail!=="{}"?` ${s.detail}`:""}`,rp=()=>Ls.map(sa).join(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilesView-Hvxe_KqA.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-react--VO_rL_p.js","assets/vendor-scheduler-7OC5HNn7.js","assets/useAppFontEffects-3RimJo4B.js","assets/katex.min-Bs5OLoA1.js","assets/vendor-zustand-C9tWdk0j.js","assets/vendor-zod--raI7LhK.js","assets/vendor-opencode-client-CeybcDBQ.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-7f7Y525Q.css","assets/vendor-base-ui-CqKCZJyd.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-CqfECoM0.js","assets/vendor-tanstack-virtual-core-BdFnkr_2.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-DRsX0PKK.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-CEhBoV5L.js","assets/vendor-class-variance-authority-5VPnzWs2.js","assets/flexokiTheme-BMYGLHbL.js","assets/vendor-codemirror-search-CWqbGraJ.js","assets/vendor-replit-codemirror-vim-DTiXsOdM.js","assets/vendor-replit-codemirror-vim-core-FHzKdNUS.js","assets/runtimeEndpointReset-DiTyBUwe.js","assets/space-apply-8YUOtYvk.js","assets/runtimeEndpointReset-uDNKGwhp.css","assets/useMarkdownLocalAssets-CH5Ekvbl.js","assets/fileContentPoller-BmcApnk-.js","assets/useInlineCommentController-_L6_JHZ6.js","assets/JsonTreeView-zAv-pn0X.js","assets/parseDiffFromFile-By5H8w4y.js","assets/computeVirtualFileMetrics-DVfKKHny.js","assets/themeResolver-DXizngAV.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-DOjSDWo3.js","assets/vendor-strip-json-comments-5dJlOkP1.js","assets/codeHighlight-BcDjh6yS.js","assets/appThemeRegistry-DYzVI9tX.js","assets/textMateThemeFromAppTheme-CVOJt2hL.js","assets/ReviewCards-BkpTYy_a.js","assets/contextFileOpenGuard-BC79wuu1.js","assets/vendor-react-drawio-C6TkEvnS.js","assets/vendor-codemirror-lint-aq8IpR1c.js","assets/moveWorkspacePath-BaEfuU4S.js","assets/model-dyJJrKMm.js","assets/vendor-fflate-DB4_FQr-.js","assets/documentClient-JcxJ7vyh.js","assets/UiBlock-C11qZK5T.js","assets/date-time-DhfjtTnp.js","assets/vendor-openuidev-lang-core-DF2LaCPS.js","assets/columnWidthMemory-BA6h4J11.js","assets/document-attachments-CIZjaOGe.js","assets/useWholeFileComment-CqHAJ2YU.js","assets/diffsHighlighter-BsxkaI3Q.js","assets/scheduledTasksApi-Z7dc8sXS.js","assets/vendor-capacitor-app-BrDJj9I_.js","assets/vendor-capacitor-push-notifications-KNe1zSBF.js"])))=>i.map(i=>d[i]);
2
+ import{f as re,r as hr,j as n,R as m,a as Es,h as Za}from"./vendor-react--VO_rL_p.js";import{aX as Gs,cl as Tr,cm as ui,cn as ct,cb as Gt,co as Os,ci as zs,j as So,cp as Wn,cq as Co,cr as el,cs as No,ct as tl,cu as sl,cv as nl,cw as rl,cx as il,u as Xe,l as Fs,n as yn,N as ol,O as al,E as ll,bB as Ar,w as kt,b as cl,cy as dl,A as Is,b6 as ul,c4 as fl,b5 as ml,c0 as pl,c1 as fi,c9 as hl,bs as gl,cz as bl,cA as xl,cB as mi,b0 as yl,aZ as Ro,cC as vl,cD as En,v as gr,cE as pi,cF as wl,bE as Eo,cG as hi}from"./katex.min-Bs5OLoA1.js";import{Y as Xs,Z as Mt,fc as Io,fd as jl,ey as kl,bb as _o,jU as Sl,u as be,A as he,dW as Cl,I as G,fS as Nl,B as Ae,n as Yt,b6 as To,bl as Ms,aw as Rl,Q as ae,jV as El,du as nr,k as Mn,jW as Il,jX as _l,jY as Tl,fy as Al,V as Kt,aZ as Pl,jZ as rr,j_ as Dl,j$ as gi,k0 as bi,k1 as Ol,k2 as Ml,h1 as Pr,fu as Ll,fv as Bl,a0 as nt,gg as zl,gi as Ao,gj as Po,k3 as Do,cK as Fl,gk as $l,cI as Dr,cH as Oo,eF as Mo,k4 as Wl,bU as Lo,aN as $t,eE as Bo,bR as Or,k5 as Kl,k6 as Vl,k7 as Hl,cJ as ql,k8 as Ul,k9 as Gl,hA as Pn,id as br,hV as ps,cN as Xl,ka as Jl,ab as Yl,kb as Ql,kc as xr,cY as Mr,aQ as zo,cE as Fo,eQ as $o,eR as Wo,y as Zl,kd as ec,ke as tc,kf as sc,kg as nc,en as Ko,eo as rc,ep as ic,cl as xi,kh as yi,ki as oc,kj as ac,kk as lc,kl as cc,gP as Lr,km as dc,kn as uc,ko as yr,z as Vo,bf as fc,a3 as mc,dr as pc,kp as hc,fA as gc,kq as bc,fi as vi,kr as xc,ks as yc,a4 as vr,a5 as wr,a6 as jr,bX as wi,af as ir,a7 as un,ac as vc,ad as wc,ae as jc,jP as kc,ax as Sc,aB as Cc,e3 as Nc,kt as Rc,ku as Ec,kv as Ic,gq as _c,kw as Tc,cw as Ac,hX as Ho,hY as qo,aO as Br,bM as Pc,bP as Dc,kx as Oc,bQ as Mc,hq as Lc,hg as In,hh as Bc,cd as kr,hi as zc,hj as Fc,hr as $c,gD as Wc,hp as Kc,bS as Vc,hW as Hc,i0 as qc,gI as Uc,gE as Uo,bm as Gc,gH as Xc,ky as Jc,kz as Yc,kA as Qc,kB as Zc,i3 as ji,i5 as or,bT as _n,br as ed,bY as td,bV as rn,gL as sd,kC as nd,hn as rd,ho as id,hl as od,kD as ad,kE as ld,hx as cd,kF as dd,d8 as ud,bD as fd,bW as md,i9 as pd,ia as hd,ic as gd,i4 as bd,fq as Go,b2 as bt,dA as xd,kG as yd,kH as vd,kI as wd,kJ as jd,kK as kd,kL as Sd,e6 as Cd,kM as Nd,kN as Rd,kO as Ed,kP as Id,fY as _d,he as ki,kQ as zr,kR as Td,kS as Ad,fJ as Pd,fK as Dd,fL as Od,fM as Md,kT as Ld,kU as Si,kV as Bd,fO as zd,fP as Fd,fQ as $d,fR as Wd,fN as Kd,fT as Vd,fU as Hd,kW as qd,kX as Ud,kY as Gd,eS as Ci,kZ as Xd,k_ as Jd,k$ as Yd,l0 as Qd,l1 as Zd,l2 as eu,l3 as tu,aj as su,f$ as nu,g0 as ru,g1 as iu}from"./useAppFontEffects-3RimJo4B.js";import{aE as Cs,aF as ou,aG as au,aH as Xo,aI as Ni,aJ as lu,aK as cu,aL as du,aM as uu,aN as fu,aO as mu,aP as pu,aQ as hu,aR as gu,aS as bu,aT as xu,aU as yu,aV as vu,aW as Jo,aX as wu,aY as ju,aZ as ku,a_ as Su,a$ as Cu,b0 as Nu,b1 as Ru,b2 as Eu,i as Iu,S as _u,b3 as Tu,b4 as Au,ak as ln,as as Pu,at as Du,w as Ri,x as Ou,y as Mu,ax as Lu,ay as Bu,G as zu,am as Fu,C as Ei,az as Ii,aw as Yo,N as $u,b5 as Wu,b6 as Ku,aB as Vu,b7 as Hu,b8 as qu,b9 as Uu,ba as Gu,bb as Xu,bc as Ju,bd as Yu,be as Qu,bf as Zu,bg as ef,bh as tf,bi as sf,bj as nf,bk as rf,bl as of,bm as af,bn as lf,bo as cf,bp as df,bq as uf,br as ff,bs as mf,bt as pf,bu as hf}from"./runtimeEndpointReset-DiTyBUwe.js";import{i as gf}from"./initializeSharedPreferences-BcnhlF3e.js";import{S as bf,A as xf}from"./SettingsView-B804XZvl.js";import{PlanView as yf}from"./PlanView-CgoTn3HJ.js";import{SpaceAccessDialog as vf}from"./SpaceAccessDialog-DHNqUzKD.js";import{SpaceApplyDialog as wf}from"./SpaceApplyDialog-DEOTeEjy.js";import{SpaceSetupOutputDialog as jf}from"./SpaceSetupOutput-C4NhRkjl.js";import{RunOverview as kf}from"./RunOverview-DsffX3fI.js";import{o as Fr,s as $s,a as Sf}from"./vendor-zod--raI7LhK.js";import{_ as gn}from"./vendor-vite-runtime-DD1OZmLC.js";import{p as Cf}from"./vendor-aparajita-capacitor-secure-storage-5IShChL0.js";import{Capacitor as Nf,registerPlugin as Qo}from"./vendor-capacitor-core-B4EWRrHz.js";import{a as Nt,b as vn,M as bs}from"./mobileHeader-DaHAqQ0c.js";import{h as Rf,i as _i,j as Ef,P as If,D as _f,f as Tf}from"./vendor-dnd-kit-core-Br1Cs7RV.js";import{S as Af,v as Pf,u as Df,s as Of,a as Mf}from"./vendor-dnd-kit-sortable-DpfLEOLv.js";import{C as Lf}from"./vendor-dnd-kit-utilities-DZ9KbT5S.js";import{k as Sr,M as Zo,s as Bf,d as zf,J as Ff,a as $f,P as Wf,K as Kf,U as Vf,Z as Hf,Q as qf,r as Uf}from"./vendor-remixicon-react-CLUUbkY9.js";import{S as Gf}from"./SpaceRow-CBva6ofM.js";import{toast as Ti}from"./vendor-sonner-Dw26OnzC.js";import{c as Xf}from"./vendor-zustand-C9tWdk0j.js";import{UsageStatsView as Jf}from"./UsageStatsView-CNm8WPSk.js";import{ArchiveSessionsView as Yf}from"./ArchiveView-Jt6Qj8Ry.js";import{MobileSourceBoard as Qf}from"./SourceBoardView-BvGoSNer.js";import{OverviewPage as Zf}from"./OverviewView-UfIFJ3mf.js";import{ScheduledTasksView as em}from"./ScheduledTasksDialog-DgrAfpeX.js";import{i as tm,b as sm,u as nm,c as rm,d as im,e as om,s as am,S as lm}from"./SubmoduleDiffSummary-Bebhaz7n.js";import{a as cm,R as dm,I as um,C as fm,b as mm,c as pm,D as hm,u as gm,d as bm}from"./useGitCleanLine-COG7MPwc.js";import{C as xm}from"./ChangedPathLabel-CCsE-8p4.js";import{u as ym,W as vm,c as wm,d as jm,g as km,f as Sm,h as Cm,l as Nm,k as Rm}from"./useWalkthroughReview-Bi8eB9_G.js";import{u as Em,a as Im,i as Ai,d as ar,B as _m,C as Tm,P as Am,R as Pm,b as Dm}from"./ChangeRequestDiffUnavailable-CNIWdYRx.js";import{u as Om,P as Pi}from"./useBranchPullRequestRequest-CMvepZei.js";import{p as Mm}from"./parseDiffFromFile-By5H8w4y.js";import{i as ea,O as Lm}from"./OfficeDocumentDiff-BFr4rAHy.js";import{u as Bm}from"./useWholeFileComment-CqHAJ2YU.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-opencode-client-CeybcDBQ.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-CqKCZJyd.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-CqfECoM0.js";import"./vendor-tanstack-virtual-core-BdFnkr_2.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-DRsX0PKK.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-CEhBoV5L.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./space-apply-8YUOtYvk.js";import"./install-CSoRI5iX.js";import"./vendor-yaml-CE-D_49-.js";import"./flexokiTheme-BMYGLHbL.js";import"./vendor-codemirror-search-CWqbGraJ.js";import"./vendor-replit-codemirror-vim-DTiXsOdM.js";import"./vendor-replit-codemirror-vim-core-FHzKdNUS.js";import"./codeHighlight-BcDjh6yS.js";import"./appThemeRegistry-DYzVI9tX.js";import"./themeResolver-DXizngAV.js";import"./vendor-pierre-theming-D_TRfu0q.js";import"./textMateThemeFromAppTheme-CVOJt2hL.js";import"./vendor-dnd-kit-accessibility-CYclfhtC.js";import"./vendor-qrcode-Cl8OheHW.js";import"./vendor-dijkstrajs-COg3n3zL.js";import"./install-request-EHX4ORhb.js";import"./vendor-strip-json-comments-5dJlOkP1.js";import"./useCallableModelProviders-DpMos2Hl.js";import"./AboutLogo-BhyG0ENm.js";import"./pageTitle-BT3-HFbv.js";import"./useInlineCommentController-_L6_JHZ6.js";import"./fileContentPoller-BmcApnk-.js";import"./useMarkdownLocalAssets-CH5Ekvbl.js";import"./spaceNetwork-XStNVwJo.js";import"./useWorktreeArchiveActions-D1kaQEP9.js";import"./scheduledTasksApi-Z7dc8sXS.js";import"./vendor-cron-parser-1X50-i0r.js";import"./vendor-luxon-BZ0puJYg.js";import"./date-time-DhfjtTnp.js";import"./computeVirtualFileMetrics-DVfKKHny.js";import"./isDiffPlainText-saKoOWJx.js";import"./getFiletypeFromFileName-BgI9McTw.js";import"./vendor-diff-C3JhlQdm.js";import"./pierreDiffTint-CVm_qZm-.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-BkpTYy_a.js";import"./diffsHighlighter-BsxkaI3Q.js";import"./document-attachments-CIZjaOGe.js";import"./vendor-fflate-DB4_FQr-.js";import"./documentClient-JcxJ7vyh.js";let ta=null,Di=!1;const zm=new Promise(s=>{ta=s});function Fm(){Di||(Di=!0,ta?.())}const $m=6,Wm=s=>s.parentID??null,Cr=s=>{const e=s.replace(/\/+$/,"");return e.slice(e.lastIndexOf("/")+1)||e},Km=s=>s.replace(/\\/g,"/").replace(/\/+$/,""),Vm=(s,e)=>{if(!s)return"";let t=null,r=-1;for(const o of e){const i=Km(o.path);(s===i||s.startsWith(`${i}/`))&&i.length>r&&(t=o,r=i.length)}return t?t.label?.trim()||Cr(t.path):Cr(s)},Hm=()=>{const s=Xs.getState().activeSessions,e=Mt.getState().projects,t=Io.getState().ids,r=jl.getState().rankById;let o=0;const i=[];for(const l of s){const u=kl(l);u&&(o+=1),Wm(l)===null&&i.push({session:l,unread:u,project:Vm(_o(l),e)})}i.sort((l,u)=>Sl(l.session,u.session,t,r));const a=i.slice(0,$m).map(({session:l,unread:u,project:c})=>({id:l.id,title:l.title??"",unread:u,project:c}));return{runtimeKey:Gs(),attentionCount:o,recentSessions:a,projects:e.map(l=>({id:l.id,label:l.label?.trim()||Cr(l.path)}))}},qm="__OPENCHAMBER_WIDGET_SNAPSHOT__",Um=()=>{typeof window>"u"||(window[qm]=()=>{try{return JSON.stringify(Hm())}catch{return null}})},Oi="mobile-app-update-available",Mi="mobile-app-update-toast-dismissed-version",Gm=()=>{const s=re.c(8),{t:e}=be(),t=Cs(Xm),r=Cs(Jm),o=Cs(Ym),i=Cs(Qm);let a;s[0]===Symbol.for("react.memo_cache_sentinel")?(a=new Set,s[0]=a):a=s[0];const l=hr.useRef(a);let u,c;return s[1]!==t||s[2]!==i||s[3]!==r||s[4]!==e||s[5]!==o?(u=()=>{if(Tr()!=="android"||r!=="mobile"||!t||!o||!i){he.dismiss(Oi);return}ui().getItem(Mi)!==o&&(l.current.has(o)||(l.current.add(o),he.info(e("mobileUpdate.toast.available.title"),{id:Oi,description:e("mobileUpdate.toast.available.description",{version:o}),duration:1/0,icon:n.jsx(G,{name:"download",className:"h-4 w-4 text-muted-foreground"}),action:{label:e("mobileUpdate.toast.actions.download"),onClick:()=>{Cl(i)}},onDismiss:()=>{const d=Cs.getState();d.available&&d.info?.version===o&&ui().setItem(Mi,o)}})))},c=[t,i,r,e,o],s[1]=t,s[2]=i,s[3]=r,s[4]=e,s[5]=o,s[6]=u,s[7]=c):(u=s[6],c=s[7]),hr.useEffect(u,c),null};function Xm(s){return s.available}function Jm(s){return s.runtimeType}function Ym(s){return s.info?.version}function Qm(s){return s.info?.downloadUrl}const Li="calc(var(--oc-safe-area-top, 0px) + var(--oc-visual-viewport-offset-top, 0px) + 16px)";function Zm(s){const e=re.c(3);let t,r;e[0]!==s?(t=()=>{const o=window.visualViewport,i=s.current;if(!o||!i)return;let a="";const l=()=>{const u=`${Math.max(0,Math.round(o.offsetTop))}px`;u!==a&&(a=u,i.style.setProperty("--oc-visual-viewport-offset-top",u))};return l(),o.addEventListener("scroll",l),o.addEventListener("resize",l),()=>{o.removeEventListener("scroll",l),o.removeEventListener("resize",l)}},r=[s],e[0]=s,e[1]=t,e[2]=r):(t=e[1],r=e[2]),m.useEffect(t,r)}function ep(){const s=re.c(1),e=m.useRef(null);Zm(e);let t;return s[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx("div",{ref:e,className:"contents",children:n.jsx(Nl,{position:"top-center",layout:"banner",offset:Li,mobileOffset:{top:Li}})}),s[0]=t):t=s[0],t}const Bi=300,tp="openchamber.mobile.connectLog.v1",Ls=[];if(typeof window<"u")try{window.localStorage.removeItem(tp)}catch{}const $r=(s,e)=>{Ls.push({at:Date.now(),step:s,detail:e}),Ls.length>Bi&&Ls.splice(0,Ls.length-Bi)};typeof window<"u"&&$r("app:launch","{}");const sp=()=>[...Ls],np=s=>{const e=new Date(s),t=(r,o=2)=>String(r).padStart(o,"0");return`${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}.${t(e.getMilliseconds(),3)}`},sa=s=>`${np(s.at)} ${s.step}${s.detail&&s.detail!=="{}"?` ${s.detail}`:""}`,rp=()=>Ls.map(sa).join(`
3
3
  `),ip=(s,e)=>{const t=re.c(10),r=700,o=m.useRef(null),i=m.useRef(null),a=m.useRef(!1);let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{o.current!==null&&window.clearTimeout(o.current),o.current=null,i.current=null},t[0]=l):l=t[0];const u=l;let c,d;t[1]===Symbol.for("react.memo_cache_sentinel")?(c=()=>u,d=[u],t[1]=c,t[2]=d):(c=t[1],d=t[2]),m.useEffect(c,d);let p;t[3]!==r||t[4]!==s?(p=w=>{a.current=!1,i.current={x:w.clientX,y:w.clientY},o.current!==null&&window.clearTimeout(o.current),o.current=window.setTimeout(()=>{o.current=null,a.current=!0,s()},r)},t[3]=r,t[4]=s,t[5]=p):p=t[5];const g=p;let f;t[6]===Symbol.for("react.memo_cache_sentinel")?(f=w=>{const N=i.current;N&&(Math.abs(w.clientX-N.x)>10||Math.abs(w.clientY-N.y)>10)&&u()},t[6]=f):f=t[6];const b=f;let x;t[7]===Symbol.for("react.memo_cache_sentinel")?(x=w=>{a.current&&(a.current=!1,w.preventDefault(),w.stopPropagation())},t[7]=x):x=t[7];const h=x;let v;return t[8]!==g?(v={onPointerDown:g,onPointerMove:b,onPointerUp:u,onPointerCancel:u,onClickCapture:h},t[8]=g,t[9]=v):v=t[9],v},op=s=>{const e=re.c(31),{onClose:t}=s,{t:r}=be(),[o,i]=m.useState(!1);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=sp(),e[0]=a):a=e[0];const l=a;let u;e[1]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{To(rp()).then(j=>{j.ok&&(i(!0),window.setTimeout(()=>i(!1),2e3))})},e[1]=u):u=e[1];const c=u;let d;e[2]!==r?(d=r("mobile.connectionDebug.title"),e[2]=r,e[3]=d):d=e[3];let p;e[4]!==d?(p=n.jsx("h2",{className:"min-w-0 truncate typography-ui-label text-foreground",children:d}),e[4]=d,e[5]=p):p=e[5];const g=o?"check":"file-copy";let f;e[6]!==g?(f=n.jsx(G,{name:g,className:"size-4"}),e[6]=g,e[7]=f):f=e[7];let b;e[8]!==o||e[9]!==r?(b=r(o?"mobile.connectionDebug.copied":"mobile.connectionDebug.copy"),e[8]=o,e[9]=r,e[10]=b):b=e[10];let x;e[11]!==f||e[12]!==b?(x=n.jsxs(Ae,{type:"button",variant:"outline",size:"sm",onClick:c,disabled:l.length===0,children:[f,b]}),e[11]=f,e[12]=b,e[13]=x):x=e[13];let h;e[14]!==r?(h=r("mobile.connectionDebug.close"),e[14]=r,e[15]=h):h=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]!==h?(w=n.jsx(Ae,{type:"button",variant:"ghost",size:"icon","aria-label":h,onClick:t,children:v}),e[17]=t,e[18]=h,e[19]=w):w=e[19];let N;e[20]!==w||e[21]!==x?(N=n.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[x,w]}),e[20]=w,e[21]=x,e[22]=N):N=e[22];let _;e[23]!==N||e[24]!==p?(_=n.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-edge px-4 py-2.5",children:[p,N]}),e[23]=N,e[24]=p,e[25]=_):_=e[25];let M;e[26]!==r?(M=n.jsx(Yt,{outerClassName:"min-h-0 flex-1",className:"px-4 py-3",disableHorizontal:!0,children:l.length===0?n.jsx("p",{className:"typography-small text-muted-foreground",children:r("mobile.connectionDebug.empty")}):n.jsx("pre",{className:"whitespace-pre-wrap break-words typography-code text-muted-foreground",children:l.map(sa).join(`
4
4
  `)})}),e[26]=r,e[27]=M):M=e[27];let E;return e[28]!==_||e[29]!==M?(E=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:[_,M]}),e[28]=_,e[29]=M,e[30]=E):E=e[30],E},ap=Sf($s(),$s()),na=Fr({url:$s(),values:ap}),lp=(s={})=>Object.entries(s).map(([e,t])=>({id:crypto.randomUUID(),name:e,value:t})),Nr=s=>{const e=new Headers;for(const{name:t,value:r}of s){const o=t.trim();o&&r.trim()&&o.toLowerCase()!=="authorization"&&e.set(o,r.trim())}return Object.fromEntries(e)},xs=(s,e)=>e&&s.replace(/\/+$/,"")===e.url.replace(/\/+$/,"")?Nr(Object.entries(e.values).map(([t,r])=>({name:t,value:r}))):{},fn={autoComplete:"off",autoCorrect:"off",spellCheck:!1},Bs="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",cp=s=>{const e=re.c(27),{value:t,onChange:r,disabled:o}=s,{t:i}=be();let a;e[0]!==i?(a=i("settings.remoteInstances.direct.headers.title"),e[0]=i,e[1]=a):a=e[1];let l;e[2]!==a?(l=n.jsx("legend",{className:"px-1 typography-ui-label text-foreground",children:a}),e[2]=a,e[3]=l):l=e[3];let u;e[4]!==i?(u=i("mobile.connect.headers.hint"),e[4]=i,e[5]=u):u=e[5];let c;e[6]!==u?(c=n.jsx("p",{className:"px-1 typography-micro text-muted-foreground",children:u}),e[6]=u,e[7]=c):c=e[7];let d;e[8]!==r||e[9]!==i||e[10]!==t?(d=t.map(h=>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",{...fn,dir:"ltr",autoCapitalize:"none",className:Bs,value:h.name,onChange:v=>r(t.map(w=>w.id===h.id?{...w,name:v.target.value}:w)),placeholder:i("settings.remoteInstances.direct.headers.field.namePlaceholder"),"aria-label":i("settings.remoteInstances.direct.headers.field.namePlaceholder"),pattern:"[!#$%&'*+.^_`\\|~0-9A-Za-z\\-]+",required:!!h.value}),n.jsx("input",{...fn,dir:"ltr",autoCapitalize:"none",className:Bs,type:"password",pattern:"[\\x20-\\x7E\\xA0-\\xFF]*",value:h.value,onChange:v=>r(t.map(w=>w.id===h.id?{...w,value:v.target.value}:w)),placeholder:i("settings.remoteInstances.direct.headers.field.valuePlaceholder"),"aria-label":i("settings.remoteInstances.direct.headers.field.valuePlaceholder"),required:!!h.name})]}),n.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"size-10",onClick:()=>r(t.filter(v=>v.id!==h.id)),"aria-label":i("settings.remoteInstances.direct.headers.removeAria"),children:n.jsx(G,{name:"close",className:"size-4"})})]},h.id)),e[8]=r,e[9]=i,e[10]=t,e[11]=d):d=e[11];let p;e[12]!==r||e[13]!==t?(p=()=>r([...t,{id:crypto.randomUUID(),name:"",value:""}]),e[12]=r,e[13]=t,e[14]=p):p=e[14];let g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(G,{name:"add",className:"size-4"}),e[15]=g):g=e[15];let f;e[16]!==i?(f=i("settings.remoteInstances.direct.headers.actions.add"),e[16]=i,e[17]=f):f=e[17];let b;e[18]!==p||e[19]!==f?(b=n.jsxs(Ae,{type:"button",variant:"outline",onClick:p,children:[g,f]}),e[18]=p,e[19]=f,e[20]=b):b=e[20];let x;return e[21]!==o||e[22]!==l||e[23]!==c||e[24]!==d||e[25]!==b?(x=n.jsxs("fieldset",{className:"min-w-0 space-y-2",disabled:o,children:[l,c,d,b]}),e[21]=o,e[22]=l,e[23]=c,e[24]=d,e[25]=b,e[26]=x):x=e[26],x},dp=async(s,e)=>{let t;const r=new Promise(o=>{t=setTimeout(()=>o({response:null,failure:"timeout"}),s)});try{return await Promise.race([e.then(o=>({response:o,failure:null}),o=>({response:null,failure:o instanceof Error?o.message:String(o)})),r])}finally{t!==void 0&&clearTimeout(t)}},up=(s,e)=>new Promise(t=>{const r=l=>{clearTimeout(i),a(),t(l)},o=l=>{l.state==="connected"?r(!0):(l.state==="idle"||l.terminal)&&r(!1)},i=setTimeout(()=>r(!1),e),a=s.subscribeStatus(o);o(s.getStatus())}),Ws=(s,e,t,r)=>dp(r,s.fetch(e,t)),ra=async(s,e,t,r)=>{const o=Date.now()+r;let i=await Ws(s,e,t,r);for(;!i.response&&i.failure!=="timeout"&&s.getStatus().state!=="connected";){const a=o-Date.now();if(a<=0||!await up(s,a))return i;const l=o-Date.now();if(l<=0)return i;i=await Ws(s,e,t,l)}return i},Ln="openchamber.mobile.connections.v1",Wr="openchamber.mobile.",zi="openchamber.mobile.deviceId",fp=$s().startsWith(`${Wr}headers.`),mp=()=>{try{const s=window.localStorage.getItem(zi);if(s&&s.trim())return s.trim();const e=crypto.randomUUID();return window.localStorage.setItem(zi,e),e}catch{return crypto.randomUUID()}},Fi=()=>`mobile:${mp()}`,$i=()=>{try{const s=Nf.getPlatform();return s==="ios"||s==="android"?s:void 0}catch{return}},ia=12,Kr=8e3,pp=2500,hp=3e3,Bn=2500,gp=()=>{let s=0;return{begin:()=>(s+=1,s),cancel:()=>{s+=1},isCurrent:e=>e===s}},vs=s=>{const e=s.trim();if(!e)return"";const t=/^https?:\/\//i.test(e)?e:`http://${e}`,r=new URL(t);return r.hash="",r.search="",r.pathname=r.pathname.replace(/\/+$/,""),r.toString().replace(/\/+$/,"")},Dn=s=>{try{return new URL(s).host}catch{return s}},Ks=s=>{try{return vs(s)}catch{return s.trim().replace(/\/+$/g,"")}},oa=(s,e)=>Ks(s)===Ks(e),aa=s=>`relay:${s.serverId}@${s.relayUrl.trim()}`,bp=s=>`relay://${s.serverId}`,bn=s=>s.candidates.filter(e=>e.kind==="direct"),ys=s=>{const e=s.candidates.find(t=>t.kind==="relay");return e&&e.kind==="relay"?e.relay:null},gs=s=>{const e=bn(s)[0];if(e)return e.url;const t=ys(s);return t?bp(t):""},Wi=s=>s.serverId||ys(s)?.serverId||null,Ot=s=>{const e=ys(s);if(e)return aa(e);if(s.serverId)return`server:${s.serverId}`;const t=bn(s)[0];return t?Ks(t.url):""},Ki=(s,e)=>{const t=Wi(s),r=Wi(e);return t&&r?t===r:la(s.candidates,e.candidates)},la=(s,e)=>{const t=s.find(i=>i.kind==="relay"),r=t&&t.kind==="relay"?t.relay.serverId:null,o=new Set(s.filter(i=>i.kind==="direct").map(i=>Ks(i.url)));return e.some(i=>i.kind==="relay"?r!==null&&i.relay.serverId===r:o.has(Ks(i.url)))},Vr=s=>{const e=(()=>{try{return vs(s)}catch{return""}})();return e?[{kind:"direct",url:e}]:[]},Vi=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(...Vr(s.url)),s.relay&&e.push({kind:"relay",relay:s.relay}),e},Hr=s=>{if(!s||typeof s!="object"||Array.isArray(s))return null;const e=s;if(typeof e.relayUrl!="string"||!e.relayUrl.trim()||typeof e.serverId!="string"||!e.serverId.trim())return null;const t=e.hostEncPubJwk;if(!t||typeof t!="object"||Array.isArray(t))return null;const r=t;return r.kty!=="EC"||r.crv!=="P-256"||typeof r.x!="string"||!r.x||typeof r.y!="string"||!r.y?null:{relayUrl:e.relayUrl,serverId:e.serverId,hostEncPubJwk:{kty:"EC",crv:"P-256",x:r.x,y:r.y}}},ca=s=>{try{return JSON.stringify(s)}catch{return String(s)}},ze=(s,e={})=>{const t=ca(e);console.info("[mobile-connect]",s,t),$r(s,t)},on=(s,e={})=>{ze(s,e)},Vs=(s,e={})=>{const t=ca(e);console.info("[mobile-storage]",s,t),$r(s,t)},xp=s=>{if(typeof s!="string")return s;try{return JSON.parse(s)}catch{return s}},yp=s=>{if(typeof s!="string")return s??void 0;try{return JSON.parse(s)}catch{return s}},vp=async(s,e)=>{if(!ct())return null;try{const{CapacitorHttp:t}=await gn(async()=>{const{CapacitorHttp:i}=await import("./vendor-capacitor-core-B4EWRrHz.js");return{CapacitorHttp:i}},[]),r=tl(s,new Headers(e?.headers)),o=await t.request({url:s,method:e?.method||"GET",headers:Object.fromEntries(r.entries()),data:yp(e?.body),disableRedirects:e?.redirect==="error"});return{ok:o.status>=200&&o.status<300,status:o.status,source:"native-http",json:async()=>xp(o.data)}}catch(t){return ze("native-http:failed",{url:s,error:t instanceof Error?t.message:String(t)}),null}},wp=async(s,e)=>{const t=await fetch(s,e).catch(r=>(ze("browser-fetch:failed",{url:s,error:r instanceof Error?r.message:String(r)}),null));return t?{ok:t.ok,status:t.status,source:"browser-fetch",json:()=>t.json()}:null},zn=async(s,e,t)=>{let r;const o=new Promise(i=>{r=window.setTimeout(()=>{t?.(),i(null)},s)});try{return await Promise.race([e,o])}catch{return null}finally{r!==void 0&&window.clearTimeout(r)}},_s=async(s,e,t)=>{const r=t?.totalTimeoutMs??Kr,o=Date.now(),i=await zn(Math.min(pp,r),vp(s,e));if(i)return i;const a=new AbortController,l=Math.max(500,r-(Date.now()-o));return zn(l,wp(s,{...e,signal:a.signal}),()=>a.abort())},Kn=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}},da=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},Hs=15e3,qs=s=>{s?.owned&&s.client.close()},Hi=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 Kn(s);return t&&t.disabled!==!0&&t.authenticated===!1?e?"auth-failed":"needs-login":"ok"},jp=async(s,e,t,r=Hs,o)=>{const i=e?{Authorization:`Bearer ${e}`}:void 0,a=ha(s);if(a){const{response:u,failure:c}=await Ws(a,"/auth/session",{headers:i},r);if(ze("relay:session",{shared:!0,ok:u?.ok===!0,status:u?.status??null,hasToken:!!e,error:c}),u){const d=await Hi(u,e);return d==="ok"&&o?.keepTunnel?{outcome:d,tunnel:{client:a,owned:!1}}:{outcome:d}}}const l=No({relayUrl:s.relayUrl,serverId:s.serverId,hostEncPubJwk:s.hostEncPubJwk});try{const{response:u,failure:c}=await ra(l,"/auth/session",{headers:i},r);ze("relay:session",{shared:!1,ok:u?.ok===!0,status:u?.status??null,hasToken:!!e,error:c});const d=u?await Hi(u,e):Wn(l.getStatus())?"relay-limit":"unreachable";return d==="ok"&&o?.keepTunnel?{outcome:d,tunnel:{client:l,owned:!0}}:(l.close(),{outcome:d})}catch(u){throw l.close(),u}},kp=(s,e,t,r,o)=>{const i=typeof window<"u"?window.location.origin:"",a={relayUrl:s.relayUrl,serverId:s.serverId,hostEncPubJwk:s.hostEncPubJwk,...t?{grant:t}:{}};o&&el(a,o),Os({apiBaseUrl:i,clientToken:e,runtimeKey:r??aa(s),relay:a})},Sp=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=Hr(e.relay);return t?{kind:"relay",relay:t}:null}return null},Cp=s=>{if(s.mode==="relay"){const e=Hr(s.relay);return e?[{kind:"relay",relay:e}]:[]}return typeof s.url=="string"?Vr(s.url):[]},ws=()=>{if(typeof window>"u")return[];let s;try{s=JSON.parse(window.localStorage.getItem(Ln)||"[]")}catch{return[]}if(!Array.isArray(s))return[];const e=ct();return s.flatMap(t=>{if(!t||typeof t!="object")return[];const r=t;if(typeof r.id!="string")return[];const o=Array.isArray(r.candidates)?r.candidates.map(Sp).filter(u=>!!u):Cp(r);if(o.length===0)return[];const i=typeof r.clientToken=="string"&&r.clientToken.trim()?r.clientToken:void 0,a=typeof r.label=="string"&&r.label.trim()?r.label:Dn(gs({candidates:o})),l={id:r.id,label:a,candidates:o,serverId:typeof r.serverId=="string"&&r.serverId.trim()?r.serverId:void 0,lastUsedAt:typeof r.lastUsedAt=="number"?r.lastUsedAt:0,requestHeadersKey:e?fp.safeParse(r.requestHeadersKey).data:void 0,requestHeaders:e?void 0:na.safeParse(r.requestHeaders).data};return e?[{...l,hasToken:!!r.hasToken||!!i}]:[{...l,clientToken:i,hasToken:!!i}]}).sort((t,r)=>r.lastUsedAt-t.lastUsedAt)},Rr=s=>s.kind==="relay"?{kind:"relay",relay:{relayUrl:s.relay.relayUrl,serverId:s.relay.serverId,hostEncPubJwk:s.relay.hostEncPubJwk}}:{kind:"direct",url:s.url},ua=s=>{if(typeof window>"u")return!1;const e=ct(),t=s.slice(0,ia).map(r=>{const o={id:r.id,label:r.label,candidates:r.candidates.map(Rr),serverId:r.serverId,lastUsedAt:r.lastUsedAt};return e?{...o,hasToken:!!(r.hasToken||r.clientToken),requestHeadersKey:r.requestHeadersKey}:{...o,clientToken:r.clientToken,requestHeaders:r.requestHeaders}});try{return window.localStorage.setItem(Ln,JSON.stringify(t)),!0}catch(r){return console.warn("[mobile-storage] failed to persist connection metadata",r),!1}},Np=(s,e)=>{const t=(e.id?s.find(i=>i.id===e.id):void 0)??s.find(i=>Ki(i,e)),r=ct(),o={id:e.id||t?.id||crypto.randomUUID(),label:e.label,candidates:e.candidates,serverId:e.serverId??t?.serverId,requestHeadersKey:t?.requestHeadersKey,requestHeaders:t?.requestHeaders,lastUsedAt:Date.now(),...r?{hasToken:e.hasToken??(!!e.clientToken||t?.hasToken||!1)}:{clientToken:e.clientToken??t?.clientToken,hasToken:!!(e.clientToken??t?.clientToken)}};return[o,...s.filter(i=>i.id!==o.id&&!Ki(i,o))].slice(0,ia)},Js=Cf,fa=0,qr=s=>`${Wr}token.${encodeURIComponent(s)}`,Vn=async(s,e)=>{let t;const r=new Promise(o=>{t=window.setTimeout(()=>o(e),hp)});try{return await Promise.race([s.catch(()=>e),r])}finally{t!==void 0&&window.clearTimeout(t)}},Ur=async(s,e,t)=>ct()?Vn(e().catch(r=>(console.warn(`[mobile-storage] ${s} failed`,r),t)),t):t,xn=async s=>{Vs("secure:read-start",{key:s});const e=await Ur("secure:read",async()=>(await Js.internalGetItem({prefixedKey:qr(s),sync:!1})).data,null),t=typeof e=="string"&&e.trim()?e:void 0;return Vs("secure:read",{key:s,hasToken:!!t}),t},Ns=async(s,e)=>{Vs("secure:write-start",{key:s});const t=await Ur("secure:write",async()=>(await Js.internalSetItem({prefixedKey:qr(s),data:e,sync:!1,access:fa}),!0),!1);return Vs("secure:write",{key:s,ok:t}),t},Rp=async s=>{await Ur("secure:delete",async()=>(await Js.internalRemoveItem({prefixedKey:qr(s),sync:!1}),!0),!1)};class Ts extends Error{constructor(){super("Mobile header storage unavailable")}}const Hn=async s=>{if(!s)return;if(!ct())return s.requestHeaders;const e=s.requestHeadersKey;if(!e)return;const t=await Vn(Js.internalGetItem({prefixedKey:e,sync:!1}).then(r=>r.data),null);if(!t)throw new Ts;try{const r=na.parse(JSON.parse(t));return vs(r.url),xs(r.url,r),r}catch{throw new Ts}},Ep=async s=>Hn(ws().find(e=>e.id===s)),Er=async s=>{await Vn(Js.internalRemoveItem({prefixedKey:s,sync:!1}),null)},qi=async(s,e,t)=>{if(s.requestHeaders===void 0)return Hn(t);const r=vs(s.url||gs({candidates:e})),o=xs(r,{url:r,values:s.requestHeaders});return Object.keys(o).length?{url:r,values:o}:void 0},Ip=async(s,e)=>{let t=0,r=0;return{records:await Promise.all(s.map(async i=>{if(!i||typeof i!="object")return i;const a=i,l=typeof a.url=="string"?a.url:null,u=typeof a.clientToken=="string"?a.clientToken.trim():"";if(!l||!u)return i;if(!await e(l,u))return r+=1,i;t+=1;const{clientToken:c,...d}=a;return{...d,hasToken:!0}})),migrated:t,failed:r}},ma=async()=>{if(typeof window>"u"||!ct())return;let s;try{s=JSON.parse(window.localStorage.getItem(Ln)||"[]")}catch{return}if(!Array.isArray(s))return;const e=s.filter(r=>!!r&&typeof r=="object"&&typeof r.url=="string"&&typeof r.clientToken=="string"&&!!r.clientToken.trim());if(e.length===0)return;Vs("secure:migrate-start",{count:e.length});const t=await Ip(s,async(r,o)=>{const i=Ks(r);return await Ns(i,o)?await xn(i)===o:!1});if(t.migrated>0)try{window.localStorage.setItem(Ln,JSON.stringify(t.records))}catch(r){console.warn("[mobile-storage] failed to finalize secure token migration",r);return}Vs("secure:migrate-done",{migrated:t.migrated,failed:t.failed})},_p=async()=>(await ma(),ws()),pa=async s=>{let e;if(ct()&&s.requestHeaders){const o=`${Wr}headers.${crypto.randomUUID()}`;if(!await Vn(Js.internalSetItem({prefixedKey:o,data:JSON.stringify(s.requestHeaders),sync:!1,access:fa}).then(()=>!0),!1))throw new Ts;e=o}const t=ws(),r=Np(t,s);if(s.requestHeaders!==void 0&&(r[0].requestHeadersKey=e,r[0].requestHeaders=ct()?void 0:s.requestHeaders??void 0),!ua(r))throw e&&await Er(e),new Ts;for(const o of t)o.requestHeadersKey&&!r.some(i=>i.requestHeadersKey===o.requestHeadersKey)&&await Er(o.requestHeadersKey);return r},Fn=async s=>{const e=await pa(s);return ct()&&s.clientToken&&await Ns(Ot(e[0]),s.clientToken),e},Tp=async s=>{const e=ws(),t=e.find(o=>o.id===s)??null,r=e.filter(o=>o.id!==s);if(!ua(r))throw new Ts;return t?.requestHeadersKey&&await Er(t.requestHeadersKey),t&&ct()&&await Rp(Ot(t)),r},Ap=1500,$n=async(s,e,t)=>{const r=t?.fast?{totalTimeoutMs:Bn}:void 0,o=ys({candidates:s})?.serverId??null,i=s.find(c=>c.kind==="relay")??null,a=s.filter(c=>c.kind==="direct"),l=async()=>{for(const c of a){const d=vs(c.url)||c.url,p=xs(d,t?.requestHeaders),g=Object.keys(p).length?"error":void 0;e&&(p.Authorization=`Bearer ${e}`);const f=await _s(`${d}/health`,{method:"GET",headers:xs(d,t?.requestHeaders),redirect:g},r);if(ze("probe:direct:health",{url:d,ok:f?.ok===!0,status:f?.status??null,source:f?.source??null}),!f?.ok)continue;if(o){const v=await da(f);if(v&&v!==o){ze("probe:server-id-mismatch",{url:d});continue}}const b=await _s(`${d}/auth/session`,{method:"GET",credentials:e?"omit":"include",headers:p,redirect:g},r);if(ze("probe:direct:session",{url:d,ok:b?.ok===!0,status:b?.status??null,source:b?.source??null,hasToken:!!e}),b?.status===401)return{status:"needs-login"};if(!b||!b.ok&&b.status!==404)continue;const x=await Kn(b);if(x&&x.disabled!==!0&&x.authenticated===!1)return{status:"needs-login"};const h=x?.disabled===!0;return!e&&ct()&&!h&&x?.scope!=="client"?{status:"needs-login"}:{status:"ok",transport:{kind:"direct",url:d}}}return{status:"unreachable"}},u=async()=>{if(!i)return{status:"unreachable"};const{outcome:c,tunnel:d}=await jp(i.relay,e,void 0,t?.fast?Bn:Kr,{keepTunnel:!0});return c==="ok"?{status:"ok",transport:{kind:"relay",relay:i.relay,tunnel:d}}:c==="needs-login"||c==="auth-failed"?{status:"needs-login"}:c==="relay-limit"?{status:"relay-limit"}:{status:"unreachable"}};return i?a.length===0?u():new Promise(c=>{let d=!1,p=!1,g,f=null,b=null;const x=w=>{w?.status==="ok"&&w.transport.kind==="relay"&&qs(w.transport.tunnel)},h=w=>{d||(d=!0,c(w))},v=()=>{p||d||(g!==void 0&&(window.clearTimeout(g),g=void 0),u().then(w=>{if(b=w,d||p){x(w);return}if(w.status==="ok"||w.status==="needs-login"){h(w);return}f&&h(w)}))};l().then(w=>{if(f=w,!d){if(w.status==="ok"||w.status==="needs-login"){p=!0,g!==void 0&&window.clearTimeout(g),x(b),h(w);return}if(b){h(b);return}v()}}),g=window.setTimeout(v,Ap)}):l()},hs=(s,e,t)=>{Gr=!1,s.kind==="relay"?kp(s.relay,e,t?.grant,t?.runtimeKey,s.tunnel?.client):Os({apiBaseUrl:s.url,clientToken:e,runtimeKey:t?.runtimeKey,requestHeaders:xs(s.url,t?.requestHeaders)}),ba()},Ss=()=>{const s=ws()[0];return s?.label?.trim()?s.label:null};let Gr=!1;const Pp=()=>{Gr=!0},an=async s=>{if(Gr)return ze("auto-connect:suppressed",{}),{status:"no-candidate"};const e=s?.fast!==!1;await ma();const t=ws()[0];if(ze("auto-connect:start",{hasCandidate:!!t,fast:e}),!t)return{status:"no-candidate"};let r;if(ct()){if(t.hasToken&&(r=await xn(Ot(t)),!r))return{status:"no-candidate"}}else if(r=t.clientToken,!r&&t.hasToken)return{status:"no-candidate"};let o;try{o=await Hn(t)}catch{return{status:"unreachable",label:t.label}}const i=await $n(t.candidates,r,{fast:e,requestHeaders:o});if(ze("auto-connect:probe",{status:i.status,candidates:t.candidates.map(a=>a.kind)}),i.status==="needs-login")return{status:"needs-login",label:t.label};if(i.status==="relay-limit")return{status:"relay-limit",label:t.label};if(i.status!=="ok")return{status:"unreachable",label:t.label};if(s?.skipIfConnected&&Gt())return i.transport.kind==="relay"&&qs(i.transport.tunnel),ze("auto-connect:superseded",{}),{status:"no-candidate"};try{await Fn({id:t.id,label:t.label,candidates:t.candidates})}catch{return i.transport.kind==="relay"&&qs(i.transport.tunnel),{status:"unreachable",label:t.label}}return hs(i.transport,r??null,{runtimeKey:Ot(t),requestHeaders:o}),{status:"connected"}},Dp=async(s,e)=>{let t="";try{t=vs(s.url)}catch{return!1}if(!t)return!1;const r=s.clientToken?.trim()||void 0,o=xs(t,s.requestHeaders),i=Object.keys(o).length?"error":void 0;r&&(o.Authorization=`Bearer ${r}`);const a=e?.fast?{totalTimeoutMs:Bn}:void 0;if(!(await _s(`${t}/health`,{method:"GET",headers:o,redirect:i},a))?.ok)return!1;const u=await _s(`${t}/auth/session`,{method:"GET",credentials:r?"omit":"include",headers:o,redirect:i},a);if(!u||!u.ok&&u.status!==404)return!1;const c=await Kn(u);return!(c&&c.disabled!==!0&&c.authenticated===!1)},Ui=(s,e)=>{s?.kind==="relay"&&s.owned&&!e&&s.tunnel.close()},Op=(s,e)=>s.kty===e.kty&&s.crv===e.crv&&s.x===e.x&&s.y===e.y,ha=s=>{const e=Co(),t=sl();return!e||!t||e.getStatus().state!=="connected"?null:t.relayUrl===s.relayUrl&&t.serverId===s.serverId&&Op(t.hostEncPubJwk,s.hostEncPubJwk)?e:null},Mp=s=>[...s].sort((e,t)=>{const r=(e.priority??100)-(t.priority??100);if(r!==0)return r;const o=i=>i.type==="relay"?2:i.url.startsWith("https://")?0:1;return o(e)-o(t)}).flatMap(e=>{if(e.type==="relay"){const t=Hr({relayUrl:e.relayUrl,serverId:e.serverId,hostEncPubJwk:e.hostEncPubJwk});return t?[{kind:"relay",relay:t}]:[]}return Vr(e.url)}),Gi=async(s,e)=>{let t=!1;const r=ys({candidates:s})?.serverId??null;for(const o of s){if(o.kind==="relay"){const c=ha(o.relay);if(c){const f=await Ws(c,"/health",void 0,Kr);if(ze("establish:relay:health",{shared:!0,ok:f.response?.ok===!0,status:f.response?.status??null,error:f.failure}),f.response?.ok)return{kind:"relay",relay:o.relay,tunnel:c,owned:!1}}const d=No(o.relay),{response:p,failure:g}=await ra(d,"/health",void 0,Hs);if(ze("establish:relay:health",{shared:!1,ok:p?.ok===!0,status:p?.status??null,error:g}),p?.ok)return{kind:"relay",relay:o.relay,tunnel:d,owned:!0};t||=Wn(d.getStatus()),d.close();continue}const i=vs(o.url)||o.url,a=xs(i,e),l=await _s(`${i}/health`,{method:"GET",headers:a,redirect:Object.keys(a).length?"error":void 0});if(ze("establish:direct:health",{ok:l?.ok===!0,status:l?.status??null}),!l?.ok)continue;const u=await da(l);if(r&&u&&u!==r){ze("establish:server-id-mismatch",{url:i});continue}return{kind:"direct",url:i,serverId:u}}return t?"relay-limit":null},Lp=async(s,e)=>{if(!zs())return await Dp(s,e)?"valid":"invalid";const t=await zn(e?.fast?Bn:Hs,So("/auth/session").then(o=>o).catch(()=>null));if(!t)return Wn(Co()?.getStatus())?"relay-limit":"valid";if(t.status===401)return"invalid";if(!t.ok&&t.status!==404)return"valid";const r=await Kn(t);return r&&r.disabled!==!0&&r.authenticated===!1?"invalid":"valid"},Bp=s=>s.kind==="relay"?zs():!zs()&&oa(s.url,Gt()),ga=()=>{const s=Gs();return s?ws().find(e=>Ot(e)===s)??null:null},Ir=s=>{const e=Gs();return!!e&&Ot(s)===e},On=async s=>{const e=s?.fast!==!1,t=ga();if(!t)return ze("reprobe:no-connection",{runtimeKey:!!Gs()}),"no-connection";let r;if(ct()?r=t.hasToken?await xn(Ot(t)):void 0:r=t.clientToken,!r&&t.hasToken)return ze("reprobe:no-token",{hasToken:!0}),"unreachable";ze("reprobe:start",{candidates:t.candidates.map(p=>p.kind),fast:e,hasToken:!!r});const o=t.candidates.findIndex(p=>Bp(p.kind==="relay"?{kind:"relay",relay:p.relay}:{kind:"direct",url:p.url})),i=o>=0?t.candidates.slice(0,o):t.candidates;let a;try{a=await Hn(t)}catch{return"unreachable"}const l=await $n(i,r,{fast:e,requestHeaders:a});if(ze("reprobe:better",{status:l.status,probed:i.length}),l.status==="ok"){try{await Fn({id:t.id,label:t.label,candidates:t.candidates})}catch{return l.transport.kind==="relay"&&qs(l.transport.tunnel),"unreachable"}return hs(l.transport,r??null,{runtimeKey:Ot(t),requestHeaders:a}),"switched"}if(l.status==="needs-login")return"needs-login";let u=null;if(o>=0&&(u=await Lp({url:Gt(),clientToken:r,requestHeaders:a},{fast:e}),ze("reprobe:current",{current:u}),u==="valid"))return ba(),"unchanged";const c=o>=0?t.candidates.slice(o+1):[],d=await $n(c,r,{fast:e,requestHeaders:a});if(ze("reprobe:fallback",{status:d.status,probed:c.length}),d.status==="ok"){try{await Fn({id:t.id,label:t.label,candidates:t.candidates})}catch{return d.transport.kind==="relay"&&qs(d.transport.tunnel),"unreachable"}return hs(d.transport,r??null,{runtimeKey:Ot(t),requestHeaders:a}),"switched"}return d.status==="needs-login"?"needs-login":[l.status,d.status,u].includes("relay-limit")?"relay-limit":"unreachable"},zp=5e3;let lr=!1;const Fp=async()=>{if(lr)return"skipped";const s=ga();if(!s)return ze("candidates:refresh-skip",{reason:"no-active-connection"}),"skipped";const e=ys(s);if(!e)return ze("candidates:refresh-skip",{reason:"no-relay-candidate"}),"skipped";lr=!0;try{const t=await zn(Hs,So("/api/client-auth/connection/candidates").then(c=>c).catch(()=>null));if(!t?.ok)return ze("candidates:refresh-skip",{reason:"fetch-failed",status:t?.status??null}),"skipped";const r=await t.json().catch(()=>null);if(!r||r.serverId!==e.serverId)return ze("candidates:refresh-skip",{reason:"server-id-mismatch"}),"skipped";const o=Array.isArray(r.candidates)?r.candidates:[],i=[];for(const c of o){if(!c||typeof c!="object")continue;const d=c;if(!(d.type!=="lan"||typeof d.url!="string"))try{const p=vs(d.url);p&&!i.includes(p)&&i.push(p)}catch{}}if(i.length===0)return ze("candidates:refresh-skip",{reason:"no-lan-reported"}),"skipped";const a=bn(s).filter(c=>c.url.startsWith("https://")),l=[...i.map(c=>({kind:"direct",url:c})),...a,{kind:"relay",relay:e}];return JSON.stringify(s.candidates.map(Rr))===JSON.stringify(l.map(Rr))?"unchanged":(ze("candidates:refreshed",{lanCount:i.length}),await Fn({id:s.id,label:s.label,candidates:l}),"updated")}finally{lr=!1}},ba=()=>{typeof window>"u"||window.setTimeout(()=>{(async()=>{const s=await Fp().catch(()=>"skipped");ze("candidates:refresh-result",{result:s}),s==="updated"&&zs()&&await On().catch(()=>null)})()},zp)},$p=s=>{const{t:e}=be(),[t,r]=m.useState(()=>ws()),[o,i]=m.useState(null),[a,l]=m.useState(null),[u,c]=m.useState(null),d=m.useRef(t),p=m.useRef(null),g=m.useRef(gp()),f=m.useCallback(j=>{d.current=j,r(j)},[]),b=m.useCallback(j=>{p.current=j,i(j)},[]),x=m.useCallback(j=>{p.current===j&&(p.current=null,i(null))},[]);m.useEffect(()=>{let j=!1;return _p().then(C=>{j||f(C)}),()=>{j=!0}},[f]);const h=m.useCallback(async j=>{const C=await pa(j);return f(C),C},[f]),v=m.useCallback(async j=>{l(null),b("connect");let C;try{const k=Vi(j);if(k.length===0){l(e("mobile.connect.error.urlRequired"));return}const L=j.id?d.current.find($=>$.id===j.id):d.current.find($=>la($.candidates,k)),I=j.label?.trim()||L?.label||Dn(gs({candidates:k})),A=await qi(j,k,L),R=j.requestHeaders===void 0?void 0:A??null,F=j.relayGrant,T=Ot({candidates:k,serverId:L?.serverId});let S=j.clientToken?.trim()||void 0;const P=!!S;S||(ct()?L?.hasToken&&(S=await xn(T)):S=L?.clientToken),ze("connect:start",{candidates:k.map($=>$.kind),hasToken:!!S});const D=await $n(k,S,{requestHeaders:A});if(D.status==="ok"&&D.transport.kind==="relay"&&(C=D.transport.tunnel),ze("connect:probe",{status:D.status}),D.status==="unreachable"){l(e("mobile.connect.error.unreachable"));return}if(D.status==="relay-limit"){l(e("mobile.connect.error.relayLimit"));return}if(D.status==="needs-login"){const $=await h({id:L?.id,label:I,candidates:k,requestHeaders:R});c({id:$[0].id,label:I,candidates:k,serverId:L?.serverId,relay:ys({candidates:k})??void 0,relayGrant:F,requestHeaders:A});return}S&&P&&ct()&&await Ns(T,S),await h({id:L?.id,label:I,candidates:k,clientToken:S,requestHeaders:R}),hs(D.transport,S??null,{runtimeKey:T,grant:F,requestHeaders:A}),C=void 0,s()}catch(k){console.warn("[mobile-connect] connect threw",k),l(e(k instanceof Ts?"mobile.connect.headers.error":"mobile.connect.error.invalidUrl"))}finally{qs(C),x("connect")}},[b,x,s,h,e]),w=m.useCallback(async j=>{if(p.current==="pairing")return;l(null),b("pairing");const C=Mp(j.candidates);let k=null,L=!1;try{const I=await Gi(C);if(!I||I==="relay-limit"){l(e(I?"mobile.connect.error.relayLimit":"mobile.connect.error.unreachable"));return}k=I;const A=JSON.stringify({pairingId:j.pairingId,secret:j.secret,clientLabel:"OpenChamber Mobile",clientKind:"mobile",deviceName:"OpenChamber Mobile",devicePlatform:$i(),dedupeKey:Fi()}),R={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:A},F=k.kind==="relay"?await Ws(k.tunnel,"/api/client-auth/pairing/redeem",R,Hs):{response:await _s(`${k.url}/api/client-auth/pairing/redeem`,R),failure:null},T=F.response;if(ze("pairing:redeem",{transport:k.kind,ok:T?.ok===!0,status:T?.status??null,error:F.failure}),!T?.ok){l(e("mobile.connect.error.authRequired"));return}const S=await T.json().catch(()=>null),P=typeof S?.clientToken=="string"?S.clientToken.trim():"";if(!P){l(e("mobile.connect.error.authRequired"));return}const D=typeof S?.server?.label=="string"?S.server.label:"",$=j.label||D||Dn(gs({candidates:C})),K=k.kind==="direct"?k.serverId:void 0,U=Ot({candidates:C,serverId:K});if(ct()&&!await Ns(U,P)){l(e("mobile.connect.error.authRequired"));return}await h({label:$,candidates:C,serverId:K,clientToken:P}),hs(k.kind==="relay"?{kind:"relay",relay:k.relay,tunnel:{client:k.tunnel,owned:k.owned}}:{kind:"direct",url:k.url},P,{runtimeKey:U}),L=k.kind==="relay",s()}catch(I){console.warn("[mobile-connect] pairing threw",I),l(e("mobile.connect.error.authRequired"))}finally{Ui(k,L),x("pairing")}},[b,x,s,h,e]),N=m.useCallback(async j=>{if(!u||!j.trim()||p.current==="password")return;l(null),b("password");const C=g.current.begin(),k=()=>g.current.isCurrent(C),{id:L,label:I,candidates:A,serverId:R,requestHeaders:F}=u,T=Ot({candidates:A,serverId:R});let S=null,P=!1;try{const D=await Gi(A,F);if(D!=="relay-limit"&&(S=D),!k())return;if(!S){l(e(D==="relay-limit"?"mobile.connect.error.relayLimit":"mobile.connect.error.unreachable"));return}const $={};S.kind==="direct"&&Object.assign($,xs(S.url,F));const K=Object.keys($).length?"error":void 0;$["Content-Type"]="application/json",$.Accept="application/json";const U={method:"POST",credentials:"include",headers:$,redirect:K,body:JSON.stringify({password:j,trustDevice:!0,issueClientToken:!0,clientLabel:"OpenChamber Mobile",clientKind:"mobile",devicePlatform:$i(),dedupeKey:Fi()})};ze("password:start",{transport:S.kind});const O=S.kind==="relay"?await Ws(S.tunnel,"/auth/session",U,Hs):{response:await _s(`${S.url}/auth/session`,U),failure:null},V=O.response;if(!k())return;if(ze("password:done",{ok:V?.ok===!0,status:V?.status??null,error:O.failure}),!V?.ok){l(e("mobile.connect.error.passwordFailed"));return}const q=await V.json().catch(()=>null);if(!k())return;const ee=typeof q?.clientToken=="string"?q.clientToken.trim():"";if(ze("password:token",{issued:!!ee}),!ee){if(S.kind==="direct"&&!ct()){if(await h({id:L,label:I,candidates:A}),!k())return;c(null),hs({kind:"direct",url:S.url},null,{runtimeKey:T,requestHeaders:F}),s();return}l(e("mobile.connect.error.authRequired"));return}if(ct()&&(!k()||(await Ns(T,ee),!k()))||!k()||(await h({id:L,label:I,candidates:A,clientToken:ee}),!k())||(c(null),hs(S.kind==="relay"?{kind:"relay",relay:S.relay,tunnel:{client:S.tunnel,owned:S.owned}}:{kind:"direct",url:S.url},ee,{runtimeKey:T,requestHeaders:F}),P=S.kind==="relay",!k()))return;s()}catch(D){if(!k())return;console.warn("[mobile-connect] password threw",D),l(e(D instanceof Ts?"mobile.connect.headers.error":"mobile.connect.error.passwordFailed"))}finally{Ui(S,P),k()&&x("password")}},[b,x,s,u,h,e]),_=m.useCallback(()=>{g.current.cancel(),x("password"),c(null),l(null)},[x]),M=m.useCallback(async j=>{l(null);let C=Vi(j);const k=j.id?d.current.find(R=>R.id===j.id)??null:null;if(k){const R=C.filter(S=>S.kind==="direct"),F=bn(k).filter(S=>S.url.startsWith("https://")&&!R.some(P=>oa(P.url,S.url))),T=ys(k);C=[...R,...F,...T?[{kind:"relay",relay:T}]:[]]}if(C.length===0)return l(e("mobile.connect.error.urlRequired")),null;const L=j.clientToken?.trim()||void 0,I=bn({candidates:C}).length===0&&k?k.label:Dn(gs({candidates:C})),A=j.label?.trim()||I;if(ct()){const R=Ot({candidates:C,serverId:k?.serverId});if(L)await Ns(R,L);else if(k?.hasToken){const F=Ot(k);if(F&&R&&F!==R){const T=await xn(F);T&&await Ns(R,T)}}}try{const R=j.requestHeaders===void 0?void 0:await qi(j,C,k??void 0)??null,F=await h({id:j.id,label:A,candidates:C,clientToken:L,requestHeaders:R});return k&&Ir(k)&&!zs()&&j.requestHeaders!==void 0&&hs({kind:"direct",url:Gt()},nl()||null,{runtimeKey:Gs(),requestHeaders:R??void 0}),F[0]??null}catch{return l(e("mobile.connect.headers.error")),null}},[h,e]),E=m.useCallback(async j=>{const C=d.current.find(k=>k.id===j)??null;try{const k=await Tp(j);return f(k),C}catch{return l(e("mobile.connect.headers.error")),null}},[f,e]);return{connections:t,isBusy:o!==null,isPasswordBusy:o==="password",error:a,pendingConnection:u,connect:v,redeemPairingConnection:w,submitPassword:N,cancelPassword:_,saveConnection:M,removeConnection:E,setError:l}},xa=()=>{if(typeof window>"u")return null;const e=window.Capacitor?.Plugins?.BarcodeScanner;return e&&(typeof e.scan=="function"||typeof e.startScan=="function")?e:null},ya=()=>window.Capacitor?.getPlatform?.()==="android",Wp=()=>ya(),va=s=>{const e=s.trim();if(!e)return null;if(/^openchamber:\/\//i.test(e)){const t=rl(e)??il(e);return t?{pairing:t}:null}return/^https?:\/\//i.test(e)?{url:e}:null},wa=s=>{const e=va(s);return e?"pairing"in e?{status:"pairing",...e}:{status:"ok",...e}:{status:"invalid"}},Kp=async(s,e)=>{if(!s.startScan||!s.stopScan||!s.addListener)return{status:"unsupported"};if(e?.aborted)return{status:"cancelled"};let t,r,o=!1,i=()=>{};const a=new Promise(c=>{i=c}),l=c=>{o||(o=!0,i(c))},u=()=>l({status:"cancelled"});e?.addEventListener("abort",u,{once:!0});try{return(await Promise.allSettled([Promise.resolve(s.addListener("barcodesScanned",({barcodes:d})=>{const p=d?.[0],g=(p?.rawValue??p?.displayValue??"").trim();g&&l(wa(g))})).then(d=>{t=d}),Promise.resolve(s.addListener("scanError",()=>l({status:"failed"}))).then(d=>{r=d})])).some(({status:d})=>d==="rejected")?l({status:"failed"}):o||s.startScan({formats:["QR_CODE"]}).catch(()=>l({status:"failed"})),await a}finally{e?.removeEventListener("abort",u),await Promise.allSettled([Promise.resolve(t?.remove()),Promise.resolve(r?.remove()),s.stopScan()])}},Vp=()=>xa()!==null,Hp=async s=>{const e=xa();if(!e)return{status:"unsupported"};try{if(e.requestPermissions){const a=(await e.requestPermissions())?.camera;if(a&&a!=="granted"&&a!=="limited")return{status:"permission-denied"}}if(s?.signal?.aborted)return{status:"cancelled"};if(ya())return Kp(e,s?.signal);if(!e.scan)return{status:"unsupported"};const r=(await e.scan({formats:["QR_CODE"]}))?.barcodes?.[0],o=(r?.rawValue??r?.displayValue??"").trim();return o?wa(o):{status:"cancelled"}}catch{return{status:"failed"}}},qp=s=>{const e=re.c(23),{onCancel:t}=s,{t:r}=be(),o=m.useRef(null);let i,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=()=>{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 N=new Map,_=E=>{!(E instanceof HTMLElement)||E===o.current||N.has(E)||(N.set(E,{opacity:E.style.opacity,pointerEvents:E.style.pointerEvents}),E.style.setProperty("opacity","0"),E.style.setProperty("pointer-events","none"))};Array.from(document.body.children).forEach(_);const M=new MutationObserver(E=>{E.forEach(j=>j.addedNodes.forEach(_))});return M.observe(document.body,{childList:!0}),()=>{M.disconnect(),N.forEach(Gp),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")}},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),m.useLayoutEffect(i,a);let l,u;if(e[2]!==t?(l=()=>{const v=()=>{document.visibilityState==="hidden"&&t()};return document.addEventListener("visibilitychange",v),()=>document.removeEventListener("visibilitychange",v)},u=[t],e[2]=t,e[3]=l,e[4]=u):(l=e[3],u=e[4]),m.useEffect(l,u),!Wp()){let v;return e[5]===Symbol.for("react.memo_cache_sentinel")?(v=Es.createPortal(n.jsx("div",{ref:o,className:"fixed inset-0 z-[1000] bg-background","aria-hidden":!0}),document.body),e[5]=v):v=e[5],v}let c;e[6]!==r?(c=r("mobile.connect.scanQr"),e[6]=r,e[7]=c):c=e[7];let d;e[8]===Symbol.for("react.memo_cache_sentinel")?(d=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]=d):d=e[8];let p;e[9]!==r?(p=r("mobile.connect.welcome.scanHint"),e[9]=r,e[10]=p):p=e[10];let g;e[11]!==p?(g=n.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-6",children:[d,n.jsx("p",{className:"max-w-sm rounded-[16px] border border-edge bg-background px-4 py-3 text-center typography-markdown text-foreground shadow-sm",children:p})]}),e[11]=p,e[12]=g):g=e[12];let f;e[13]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(G,{name:"close",className:"size-[18px]"}),e[13]=f):f=e[13];let b;e[14]!==r?(b=r("mobile.instances.cancelEdit"),e[14]=r,e[15]=b):b=e[15];let x;e[16]!==t||e[17]!==b?(x=n.jsxs(Ae,{type:"button",variant:"outline",size:"lg",className:"mx-auto min-h-12 w-full max-w-sm bg-background",onClick:t,children:[f,b]}),e[16]=t,e[17]=b,e[18]=x):x=e[18];let h;return e[19]!==x||e[20]!==c||e[21]!==g?(h=Es.createPortal(n.jsxs("div",{ref:o,role:"dialog","aria-modal":"true","aria-label":c,className:"fixed inset-0 z-[1000] flex flex-col bg-transparent px-6 pb-[calc(var(--safe-area-inset-bottom,env(safe-area-inset-bottom,0px))+24px)] pt-[calc(var(--safe-area-inset-top,env(safe-area-inset-top,0px))+24px)] text-foreground",children:[g,x]}),document.body),e[19]=x,e[20]=c,e[21]=g,e[22]=h):h=e[22],h},Up=()=>{const s=re.c(6),{t:e}=be();let t;s[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx(Ms,{width:96,height:96,isAnimated:!0}),s[0]=t):t=s[0];let r;s[1]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx(G,{name:"loader-4",className:"size-[18px] animate-spin"}),s[1]=r):r=s[1];let o;s[2]!==e?(o=e("mobile.connect.connecting"),s[2]=e,s[3]=o):o=s[3];let i;return s[4]!==o?(i=Es.createPortal(n.jsxs("div",{role:"status",className:"fixed inset-0 z-[1000] flex flex-col items-center justify-center gap-5 bg-background px-6 text-foreground",children:[t,n.jsxs("div",{className:"flex items-center gap-2 typography-ui-label text-muted-foreground",children:[r,n.jsx("span",{children:o})]})]}),document.body),s[4]=o,s[5]=i):i=s[5],i};function Gp(s,e){e.style.opacity=s.opacity,e.style.pointerEvents=s.pointerEvents}const Tn=s=>!s.candidates.some(e=>e.kind==="direct"),Xp=s=>s.some(({name:e,value:t})=>e.trim()||t.trim()),ja=s=>{const{mode:e,onConnected:t}=s,{t:r}=be(),o=$p(t),{connections:i,isBusy:a,isPasswordBusy:l,error:u,pendingConnection:c,connect:d,submitPassword:p,cancelPassword:g,saveConnection:f,removeConnection:b,setError:x}=o,[h,v]=m.useState(null),[w,N]=m.useState(""),[_,M]=m.useState(""),[E,j]=m.useState(""),[C,k]=m.useState([]),[L,I]=m.useState(!1),A=m.useRef(0),[R,F]=m.useState(null),[T,S]=m.useState(!1),P=R?i.find(J=>J.id===R)??null:null,D=h?.kind==="edit"?i.find(J=>J.id===h.id)??null:null,$=D?Tn(D):!1,[K,U]=m.useState(null),[O,V]=m.useState(""),[q,ee]=m.useState(!1),Z=Rl(q),[Y,B]=m.useState(!1),Q=m.useRef(null),oe=m.useMemo(()=>Vp(),[]),[X,te]=m.useState(!1),ce=ip(m.useCallback(()=>te(!0),[])),ue=m.useCallback(()=>{A.current+=1,v(null),N(""),M(""),j(""),k([]),x(null)},[x]),H=()=>{A.current+=1,x(null),v({kind:"add"})},ne=J=>{const me=++A.current;F(null),Ep(J.id).then($e=>{me===A.current&&(v({kind:"edit",id:J.id}),N(Tn(J)?"":$e?.url||gs(J)),M(J.label),j(J.clientToken||""),k(lp($e?.values)),x(null))}).catch(()=>{me===A.current&&x(r("mobile.connect.headers.error"))})},Te=J=>{if(e==="welcome"&&/^openchamber:\/\//i.test(J.trim())){const me=va(J);if(me){if("pairing"in me){o.redeemPairingConnection(me.pairing);return}N(me.url),me.label&&M(me.label),me.clientToken&&j(me.clientToken);return}}N(J)},se=J=>{if(J.preventDefault(),e==="welcome"&&h?.kind==="add"){d({url:w,clientToken:E,label:_,requestHeaders:Xp(C)?Nr(C):void 0});return}L||(I(!0),f({id:D?.id,url:w,label:_,clientToken:E,requestHeaders:$?void 0:Nr(C)}).then(me=>{me&&ue()}).finally(()=>I(!1)))},xe=async()=>{if(Q.current||a)return;x(null),ee(!0);const J=new AbortController;Q.current=J;try{const me=await Hp({signal:J.signal});switch(Q.current===J&&(Q.current=null,ee(!1)),me.status){case"ok":N(me.url),me.label&&M(me.label),me.clientToken&&j(me.clientToken),e==="welcome"?(B(!0),await d({url:me.url,clientToken:me.clientToken,label:me.label})):v({kind:"add"});break;case"pairing":B(!0),await o.redeemPairingConnection(me.pairing);break;case"permission-denied":x(r("mobile.connect.scan.permissionDenied"));break;case"invalid":x(r("mobile.connect.scan.invalid"));break;case"unsupported":x(r("mobile.connect.scan.unsupported"));break;case"failed":x(r("mobile.connect.scan.failed"));break;default:break}}finally{B(!1),Q.current===J&&(Q.current=null,ee(!1))}};m.useEffect(()=>()=>{Q.current?.abort(),A.current+=1},[]);const pe=J=>{U(J.id),d({id:J.id,candidates:J.candidates,clientToken:J.clientToken,label:J.label}).finally(()=>U(null))},ke=()=>{F(null),S(!1)},Ee=J=>{A.current+=1,ke(),h?.kind==="edit"&&h.id===J&&ue();const me=i.length===1;b(J).then($e=>{!$e||e!=="instances"||(me||Ir($e))&&s.onActiveConnectionDeleted()})},ye=e==="instances"?i.find(Ir)??null:null,ge=ye??i[0]??null,we=i.filter(J=>J!==ge),ve=J=>Tn(J)?r("mobile.connect.relay.badge"):gs(J),W=(J,me)=>n.jsx("button",{type:"button","aria-label":r("mobile.instances.actionsAria",{label:J.label}),className:ae("flex size-9 shrink-0 items-center justify-center rounded-full text-muted-foreground touch-manipulation focus:outline-none active:bg-interactive-hover",me),onClick:()=>F(J.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"?r("mobile.connect.notice.authExpired",{label:s.notice.label}):s.notice.kind==="relay-limit"?r("mobile.connect.notice.relayLimit",{label:s.notice.label}):r("mobile.connect.notice.unreachable",{label:s.notice.label})})]}):null,Ne=u&&!h?n.jsx("p",{className:"px-1 text-center typography-meta text-[var(--status-error-text)]",children:u}):null,Ie=J=>n.jsx("span",{...ce,className:"inline-flex select-none",style:{touchAction:"manipulation"},children:n.jsx(Ms,{width:J,height:J})}),_e=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:[Ie(44),n.jsx("h1",{className:"text-balance text-3xl font-normal tracking-tight text-foreground",children:r("mobile.connect.firstRun.title")}),n.jsx("p",{className:"typography-ui-label text-muted-foreground",children:r("mobile.connect.firstRun.description")})]}),n.jsxs("div",{className:"mt-auto flex flex-col gap-3 pt-6",children:[de,Ne,n.jsxs("div",{className:ae("grid gap-2",oe&&"grid-cols-2"),children:[oe?n.jsxs("button",{type:"button",disabled:q||a,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:()=>{xe()},children:[n.jsx(G,{name:"scan-2",className:ae("size-5 text-muted-foreground",Z)}),n.jsxs("span",{className:"flex flex-col",children:[n.jsx("span",{className:"typography-ui-label font-medium text-foreground",children:r(a?"mobile.connect.connecting":"mobile.connect.scanQr")}),n.jsx("span",{className:"typography-micro text-muted-foreground",children:r("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:H,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:r("mobile.connect.manual.toggle")}),n.jsx("span",{className:"typography-micro text-muted-foreground",children:r("mobile.connect.firstRun.addressHint")})]})]})]})]})]}),Fe=ge?n.jsxs("section",{...e==="instances"?ce:null,"aria-label":ge.label,className:"oc-tile relative flex flex-col rounded-xl p-4",children:[W(ge,"absolute top-1.5 inset-e-1.5"),ye?null:n.jsx("span",{className:"pb-1 typography-micro text-muted-foreground",children:r("mobile.connect.lastConnected")}),n.jsx("h2",{className:"truncate pe-8 typography-ui-header font-semibold text-foreground",children:ge.label}),n.jsx("p",{className:"truncate pe-8 typography-meta text-muted-foreground",children:ve(ge)}),n.jsx("div",{className:"flex h-9 items-center pt-3",children:ye?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}),zs()?r("mobile.instances.status.connectedRelay"):r("mobile.instances.status.connectedDirect")]}):n.jsxs(Ae,{type:"button",disabled:a,onClick:()=>pe(ge),children:[K===ge.id?n.jsx(G,{name:"loader-4",className:"size-4 animate-spin"}):null,K===ge.id?r("mobile.connect.connecting"):r("mobile.connect.connectButton")]})})]}):null,Ve=we.length>0?n.jsx(El,{title:r("mobile.connect.saved.other"),children:we.map(J=>{const me=K===J.id;return n.jsx(nr,{disabled:a,meta:me?n.jsx(G,{name:"loader-4",className:"size-4 animate-spin"}):void 0,action:W(J),onClick:()=>pe(J),children:n.jsxs("span",{className:"block py-1.5",children:[n.jsx("span",{className:"block truncate",children:J.label}),n.jsx("span",{className:"block truncate typography-micro font-normal text-muted-foreground",children:me?r("mobile.connect.connecting"):ve(J)})]})},J.id)})}):null,He=n.jsxs("div",{className:"flex shrink-0 flex-col items-center gap-1 pt-3",children:[Ne,oe?n.jsxs(n.Fragment,{children:[n.jsxs(Ae,{type:"button",variant:"outline",disabled:q||a,onClick:()=>{xe()},children:[n.jsx(G,{name:"scan-2",className:ae("size-4",Z)}),r("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:H,children:r(e==="welcome"?"mobile.connect.manual.toggle":"mobile.instances.addManual")})]}):n.jsxs(Ae,{type:"button",variant:"outline",onClick:H,children:[n.jsx(G,{name:"link",className:"size-4"}),r(e==="welcome"?"mobile.connect.manual.toggle":"mobile.instances.addManual")]})]}),fe=(c?n.jsxs("form",{className:"flex w-full flex-col gap-3",onSubmit:J=>{J.preventDefault(),p(O)},children:[n.jsxs("div",{className:"oc-tile rounded-xl p-4",children:[n.jsx("p",{className:"truncate typography-ui-header font-semibold text-foreground",children:c.label}),n.jsx("p",{className:"truncate typography-meta text-muted-foreground",children:Tn(c)?r("mobile.connect.relay.badge"):gs(c)})]}),n.jsx("input",{...fn,value:O,onChange:J=>V(J.target.value),placeholder:r("mobile.connect.password.placeholder"),"aria-label":r("mobile.connect.password.label"),type:"password",autoFocus:!0,className:Bs}),u?n.jsx("p",{className:"px-1 typography-meta text-[var(--status-error-text)]",children:u}):null,n.jsxs("div",{className:"flex items-center justify-end gap-2",children:[n.jsx(Ae,{type:"button",variant:"ghost",onClick:()=>{V(""),g()},children:r("mobile.connect.cancelPassword")}),n.jsx(Ae,{type:"submit",disabled:l||!O.trim(),children:r(l?"mobile.connect.connecting":"mobile.connect.unlockButton")})]})]}):null)??(ge?n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-3",children:[de,Fe,n.jsx("div",{className:"mt-auto",children:Ve})]}):_e),Be=n.jsxs(n.Fragment,{children:[q?n.jsx(qp,{onCancel:()=>Q.current?.abort()}):null,Y?n.jsx(Up,{}):null,X?n.jsx(op,{onClose:()=>te(!1)}):null,n.jsx(Mn,{open:P!==null,title:P?.label??"",onClose:ke,children:P?n.jsxs(n.Fragment,{children:[n.jsx(nr,{icon:"edit",disabled:L,onClick:()=>ne(P),children:r("mobile.instances.edit")}),n.jsx(nr,{icon:"delete-bin",destructive:!0,disabled:L,onClick:()=>{T?Ee(P.id):S(!0)},children:T?r("mobile.instances.confirmDeleteAria",{label:P.label}):r("mobile.instances.delete")})]}):null}),n.jsx(Mn,{open:h!==null&&!c,title:h?.kind==="edit"?r("mobile.instances.editTitle"):r(e==="welcome"?"mobile.connect.manual.toggle":"mobile.instances.addTitle"),onClose:ue,children:n.jsxs("form",{className:"flex flex-col gap-3 px-1 pb-1",onSubmit:se,children:[$?null:n.jsxs("label",{className:"flex flex-col gap-1.5",children:[n.jsx("span",{className:"px-1 typography-meta text-muted-foreground",children:r("mobile.connect.url.label")}),n.jsx("input",{...fn,value:w,onChange:J=>Te(J.target.value),placeholder:r("mobile.connect.url.placeholder"),type:"url",inputMode:"url",autoCapitalize:"none",className:Bs})]}),n.jsxs("label",{className:"flex flex-col gap-1.5",children:[n.jsx("span",{className:"px-1 typography-meta text-muted-foreground",children:r("mobile.instances.label.label")}),n.jsx("input",{value:_,onChange:J=>M(J.target.value),placeholder:r("mobile.instances.label.placeholder"),autoComplete:"off",autoCapitalize:"words",autoCorrect:"off",spellCheck:!1,className:Bs})]}),$?null:n.jsxs("label",{className:"flex flex-col gap-1.5",children:[n.jsx("span",{className:"px-1 typography-meta text-muted-foreground",children:r("mobile.connect.token.label")}),n.jsx("input",{...fn,value:E,onChange:J=>j(J.target.value),placeholder:r("mobile.connect.token.placeholder"),autoCapitalize:"none",className:Bs}),n.jsx("span",{className:"px-1 typography-micro text-muted-foreground",children:r("mobile.connect.token.hint")})]}),$?null:n.jsx(cp,{value:C,onChange:k,disabled:L||a}),u?n.jsx("p",{className:"px-1 typography-meta text-[var(--status-error-text)]",children:u}):null,n.jsx("div",{className:"flex justify-end",children:e==="welcome"&&h?.kind==="add"?n.jsx(Ae,{type:"submit",disabled:a||q||!w.trim(),children:r(a?"mobile.connect.connecting":"mobile.connect.connectButton")}):n.jsx(Ae,{type:"submit",disabled:L,children:r(D?"mobile.instances.saveEdit":"mobile.instances.saveNew")})})]})})]});return e==="instances"?n.jsxs(n.Fragment,{children:[Be,n.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[n.jsx(Yt,{outerClassName:"min-h-0 flex-1",className:"flex min-h-full flex-col px-3 py-3",disableHorizontal:!0,children:fe}),c||!ge?null:n.jsx("div",{className:"px-3 pb-3",children:He})]})]}):n.jsxs(n.Fragment,{children:[Be,n.jsx("main",{className:"oc-keyboard-fill-screen flex min-h-dvh flex-col overflow-y-auto bg-background px-4 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",children:n.jsxs("div",{className:"mx-auto flex w-full max-w-[380px] flex-1 flex-col",children:[ge||c?n.jsxs("header",{className:"flex items-center gap-2 px-1 pb-4 pt-2",children:[Ie(24),n.jsx("span",{className:"typography-ui-label font-semibold",children:"OpenChamber"})]}):null,fe,c||!ge?null:He]})})]})},Jp=s=>{const e=re.c(3),{onConnected:t,notice:r}=s,o=r===void 0?null:r;let i;return e[0]!==o||e[1]!==t?(i=n.jsx(ja,{mode:"welcome",onConnected:t,notice:o}),e[0]=o,e[1]=t,e[2]=i):i=e[2],i},Yp=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"},Qp=s=>{const e=re.c(14),{groups:t,displayMode:r,timeFormatPreference:o,className:i}=s,{t:a}=be();let l;e[0]!==i?(l=ae("space-y-1.5",i),e[0]=i,e[1]=l):l=e[1];let u;if(e[2]!==r||e[3]!==t||e[4]!==a||e[5]!==o){let d;e[7]!==r||e[8]!==a||e[9]!==o?(d=p=>n.jsxs("div",{className:"min-w-0 rounded-xl bg-foreground/[0.03] p-2.5",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[n.jsx(Il,{providerId:p.providerId,className:"size-4 shrink-0"}),n.jsx("span",{className:"min-w-0 flex-1 truncate typography-ui-label font-medium text-foreground",children:p.providerName}),p.planLabel?n.jsx("span",{className:"shrink-0 typography-micro capitalize text-muted-foreground",children:p.planLabel}):null,p.accountLabel?n.jsx("span",{className:"min-w-0 truncate typography-micro text-muted-foreground",title:p.accountLabel,children:p.accountLabel}):null,p.status&&p.rows.length===0?n.jsx("span",{className:"shrink-0 truncate typography-micro text-muted-foreground",children:p.status}):null]}),p.rows.length>0?n.jsx("div",{className:"mt-1.5 space-y-1",children:p.rows.map(g=>{const f=r==="remaining"?g.window.remainingPercent:g.window.usedPercent,b=_l(g.window,f,a),x=Tl(g.window.resetAt,g.window.resetAfterFormatted??g.window.resetAtFormatted,o);return n.jsxs("div",{className:"flex min-w-0 items-baseline justify-between gap-3",children:[n.jsxs("span",{className:"flex min-w-0 flex-1 items-baseline gap-1.5",children:[n.jsx("span",{className:"shrink-0 truncate typography-ui-label text-muted-foreground",children:g.subtitle?`${g.subtitle} · ${g.label}`:g.label}),x?n.jsx("span",{className:"min-w-0 truncate typography-micro text-muted-foreground",children:x}):null]}),n.jsx("span",{className:ae("shrink-0 typography-ui-label font-semibold tabular-nums",Yp(g.window)),children:b==="-"?"":b})]},g.key)})}):null,p.status&&p.rows.length>0?n.jsx("div",{className:"mt-1.5 typography-micro text-muted-foreground",children:p.status}):null]},p.providerId),e[7]=r,e[8]=a,e[9]=o,e[10]=d):d=e[10],u=t.map(d),e[2]=r,e[3]=t,e[4]=a,e[5]=o,e[6]=u}else u=e[6];let c;return e[11]!==l||e[12]!==u?(c=n.jsx("div",{className:l,children:u}),e[11]=l,e[12]=u,e[13]=c):c=e[13],c},Xi=380,Zp=(s,e)=>{if(!s||typeof s!="object")return;const t=s[e];return typeof t=="number"&&Number.isFinite(t)?t:void 0},cr=s=>s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:String(s),eh="—",ka=s=>{const e=re.c(20),{percentage:t}=s;let r,o,i,a,l,u,c;if(e[0]!==t){i=Ll(t??0)??0;const f=Bl(t??0);o=f==="critical"?"var(--status-error)":f==="warn"?"var(--status-warning)":"var(--status-success)",r=2*Math.PI*7.5,a="0 0 18 18",l="size-[18px] -rotate-90",u="progressbar",c=t===null?void 0:Math.round(i),e[0]=t,e[1]=r,e[2]=o,e[3]=i,e[4]=a,e[5]=l,e[6]=u,e[7]=c}else r=e[1],o=e[2],i=e[3],a=e[4],l=e[5],u=e[6],c=e[7];let d;e[8]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx("circle",{cx:9,cy:9,r:7.5,fill:"none",stroke:"var(--interactive-border)",strokeWidth:3}),e[8]=d):d=e[8];let p;e[9]!==r||e[10]!==t||e[11]!==o||e[12]!==i?(p=t===null?null:n.jsx("circle",{cx:9,cy:9,r:7.5,fill:"none",stroke:o,strokeWidth:3,strokeLinecap:"round",strokeDasharray:r,strokeDashoffset:r*(1-i/100),className:"transition-[stroke-dashoffset,stroke] duration-300"}),e[9]=r,e[10]=t,e[11]=o,e[12]=i,e[13]=p):p=e[13];let g;return e[14]!==a||e[15]!==l||e[16]!==u||e[17]!==c||e[18]!==p?(g=n.jsxs("svg",{viewBox:a,className:l,role:u,"aria-valuenow":c,"aria-valuemin":0,"aria-valuemax":100,children:[d,p]}),e[14]=a,e[15]=l,e[16]=u,e[17]=c,e[18]=p,e[19]=g):g=e[19],g},th=s=>{const e=re.c(13),{icon:t,iconNode:r,label:o,children:i}=s;let a;e[0]!==t||e[1]!==r?(a=r??(t?n.jsx(G,{name:t,className:"size-[18px]"}):null),e[0]=t,e[1]=r,e[2]=a):a=e[2];let l;e[3]!==a?(l=n.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center text-muted-foreground",children:a}),e[3]=a,e[4]=l):l=e[4];let u;e[5]!==o?(u=n.jsx("span",{className:"shrink-0 typography-ui-label text-muted-foreground",children:o}),e[5]=o,e[6]=u):u=e[6];let c;e[7]!==i?(c=n.jsx("span",{className:"min-w-0 flex-1 truncate text-end typography-ui-label font-medium text-foreground",children:i}),e[7]=i,e[8]=c):c=e[8];let d;return e[9]!==l||e[10]!==u||e[11]!==c?(d=n.jsxs("div",{className:"flex min-w-0 items-center gap-3 rounded-xl px-2.5 py-2.5",children:[l,u,c]}),e[9]=l,e[10]=u,e[11]=c,e[12]=d):d=e[12],d},sh=s=>{const e=re.c(57),{open:t,onClose:r,anchorRef:o,contextDisplay:i,usageGroups:a,usageDisplayMode:l,isUsageLoading:u,timeFormatPreference:c}=s,{t:d}=be(),p=m.useRef(null),[g,f]=m.useState(t),[b,x]=m.useState(!1),{enabled:h}=Pr(),v=m.useRef(null),[w,N]=m.useState(null);let _,M;e[0]!==o||e[1]!==h||e[2]!==t||e[3]!==g?(_=()=>{if(!t||!h||!g)return;const B=()=>{const X=o.current?.getBoundingClientRect(),te=v.current?.getBoundingClientRect();if(!X||!te){N(null);return}const ce=X.left-te.left,ue=Math.min(Math.max(ce,8),Math.max(8,te.width-Xi-8));N(ue)};B();const Q=v.current;if(typeof ResizeObserver>"u"||!Q)return;const oe=new ResizeObserver(B);return oe.observe(Q),()=>oe.disconnect()},M=[o,h,t,g],e[0]=o,e[1]=h,e[2]=t,e[3]=g,e[4]=_,e[5]=M):(_=e[4],M=e[5]),m.useLayoutEffect(_,M);const E=h&&w!==null;let j,C;e[6]!==t||e[7]!==g?(j=()=>{if(t){f(!0),x(!1);return}if(!g)return;x(!0);const B=window.setTimeout(()=>{f(!1),x(!1)},140);return()=>window.clearTimeout(B)},C=[t,g],e[6]=t,e[7]=g,e[8]=j,e[9]=C):(j=e[8],C=e[9]),m.useEffect(j,C);let k,L;e[10]!==r||e[11]!==t?(k=()=>{if(!t)return;const B=Q=>{Q.key==="Escape"&&r()};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},L=[r,t],e[10]=r,e[11]=t,e[12]=k,e[13]=L):(k=e[12],L=e[13]),m.useEffect(k,L);let I,A;if(e[14]!==o||e[15]!==r||e[16]!==t?(I=()=>{if(!t)return;const B=Q=>{const oe=Q.target;if(!(oe instanceof Node)){r();return}p.current?.contains(oe)||o.current?.contains(oe)||r()};return document.addEventListener("pointerdown",B,!0),document.addEventListener("wheel",B,!0),()=>{document.removeEventListener("pointerdown",B,!0),document.removeEventListener("wheel",B,!0)}},A=[o,r,t],e[14]=o,e[15]=r,e[16]=t,e[17]=I,e[18]=A):(I=e[17],A=e[18]),m.useEffect(I,A),!g)return null;let R;e[19]!==d?(R=d("mobile.header.openMetadataAria"),e[19]=d,e[20]=R):R=e[20];const F=E?"absolute origin-top-left":"mx-3 mt-2",T=b?"pointer-events-none":"pointer-events-auto";let S;e[21]!==F||e[22]!==T?(S=ae("oc-surface-elevated overflow-y-auto overscroll-contain rounded-[20px] border border-edge bg-surface-elevated p-2 shadow-[0_12px_32px_rgb(0_0_0_/_0.2)] will-change-transform",F,T),e[21]=F,e[22]=T,e[23]=S):S=e[23];const P=`${b?"session-metadata-out":"session-metadata-in"} ${b?140:170}ms cubic-bezier(0.32, 0.72, 0, 1) forwards`;let D;e[24]!==w||e[25]!==E?(D=E?{top:8,left:w??8,width:`min(${Xi}px, calc(100% - 16px))`}:null,e[24]=w,e[25]=E,e[26]=D):D=e[26];let $;e[27]!==P||e[28]!==D?($={animation:P,maxHeight:"min(72dvh, calc(100dvh - var(--oc-safe-area-top, 0px) - var(--oc-header-height, 56px) - 1rem))",...D},e[27]=P,e[28]=D,e[29]=$):$=e[29];let K;e[30]!==i||e[31]!==d?(K=i?n.jsx(th,{iconNode:n.jsx(ka,{percentage:i.state==="measured"?i.percentage:null}),label:d("mobile.header.metadata.context"),children:i.state==="pending"?null:n.jsxs("span",{className:"inline-flex items-baseline gap-1.5 tabular-nums",children:[i.state==="measured"?n.jsxs("span",{className:ae("font-semibold",i.colorClass),children:[i.percentage.toFixed(1),"%"]}):null,n.jsx("span",{className:"text-muted-foreground",children:i.tokens})]})}):null,e[30]=i,e[31]=d,e[32]=K):K=e[32];let U;e[33]!==i?.state||e[34]!==d?(U=i?.state==="compacted"?n.jsx("p",{className:"px-2.5 pb-1 typography-meta text-muted-foreground",children:d("contextUsage.compacted.description")}):null,e[33]=i?.state,e[34]=d,e[35]=U):U=e[35];let O;e[36]!==i?.state||e[37]!==d?(O=i?.state==="pending"?n.jsx("p",{className:"px-2.5 pb-1 typography-meta text-muted-foreground",children:d("mobile.header.metadata.contextPending")}):null,e[36]=i?.state,e[37]=d,e[38]=O):O=e[38];let V;e[39]!==u||e[40]!==c||e[41]!==l||e[42]!==a?(V=n.jsx(nh,{groups:a,displayMode:l,isLoading:u,timeFormatPreference:c}),e[39]=u,e[40]=c,e[41]=l,e[42]=a,e[43]=V):V=e[43];let q;e[44]!==K||e[45]!==U||e[46]!==O||e[47]!==V?(q=n.jsxs("div",{className:"space-y-1",children:[K,U,O,V]}),e[44]=K,e[45]=U,e[46]=O,e[47]=V,e[48]=q):q=e[48];let ee;e[49]!==S||e[50]!==$||e[51]!==q||e[52]!==R?(ee=n.jsx("div",{ref:p,role:"dialog","aria-label":R,className:S,style:$,children:q}),e[49]=S,e[50]=$,e[51]=q,e[52]=R,e[53]=ee):ee=e[53];let Z;e[54]===Symbol.for("react.memo_cache_sentinel")?(Z=n.jsx("style",{children:`
5
5
  @keyframes session-metadata-in {
@@ -22,4 +22,4 @@ import{f as re,r as hr,j as n,R as m,a as Es,h as Za}from"./vendor-react--VO_rL_
22
22
  `}),e[48]=ee):ee=e[48];let Z;return e[49]!==q?(Z=n.jsxs("div",{ref:g,className:"fixed inset-x-0 bottom-0 top-[calc(var(--oc-safe-area-top,0px)+var(--oc-header-height,56px))] z-20 pointer-events-none",children:[q,ee]}),e[49]=q,e[50]=Z):Z=e[50],Z};function ch(s){return s.currentSessionId}function dh(s){return s.setCurrentSession}function uh(s){return s.setActiveProjectIdOnly}const fh=s=>{const e=re.c(81),{onOpenSessions:t,onOpenWorkspace:r,compactTitle:o}=s,i=o===void 0?!1:o,{t:a}=be(),[l,u]=m.useState(!1),[c,d]=m.useState(!1),p=m.useRef(null),g=Fs(mh),f=nt(ph);let b;e[0]!==f?(b=W=>f?W.getDirectoryForSession(f):null,e[0]=f,e[1]=b):b=e[1];const h=nt(b)||g,v=Wl(f,h||void 0),w=nt(hh),N=Lo(h||null);let _;e[2]!==h||e[3]!==N?(_=W=>{if(!h||N!==!0)return!1;const de=W.directories.get(h)?.status;return!!(de&&!de.isClean)},e[2]=h,e[3]=N,e[4]=_):_=e[4];const M=$t(_),E=Xe(gh),j=ou(E);let C;e[5]!==v?.title?(C=v?.title?.trim(),e[5]=v?.title,e[6]=C):C=e[6];const k=C;let L;e[7]!==f||e[8]!==E||e[9]!==j||e[10]!==k||e[11]!==a?(L=(E?j:null)||k||a(f?"mobile.sessions.untitled":"sessions.switcher.draftTitle"),e[7]=f,e[8]=E,e[9]=j,e[10]=k,e[11]=a,e[12]=L):L=e[12];const I=L;let A;e[13]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{u(!1),d(!1)},e[13]=A):A=e[13];let R;e[14]!==f||e[15]!==h?(R=[f,h],e[14]=f,e[15]=h,e[16]=R):R=e[16],m.useEffect(A,R);let F;e[17]!==t?(F=()=>{u(!1),d(!1),t()},e[17]=t,e[18]=F):F=e[18];const T=F;let S;e[19]===Symbol.for("react.memo_cache_sentinel")?(S=W=>{u(de=>{const Ne=typeof W=="function"?W(de):W;return Ne&&d(!1),Ne})},e[19]=S):S=e[19];const P=S;let D;e[20]===Symbol.for("react.memo_cache_sentinel")?(D=()=>{d(W=>{const de=!W;return de&&u(!1),de})},e[20]=D):D=e[20];const $=D;let K;e[21]===Symbol.for("react.memo_cache_sentinel")?(K={paddingTop:"var(--oc-safe-area-top, 0px)"},e[21]=K):K=e[21];let U;e[22]!==a?(U=a("mobile.sessions.openSheetAria"),e[22]=a,e[23]=U):U=e[23];let O,V;e[24]===Symbol.for("react.memo_cache_sentinel")?(O={touchAction:"manipulation"},V=n.jsx(G,{name:"list-unordered",className:"size-5"}),e[24]=O,e[25]=V):(O=e[24],V=e[25]);let q;e[26]!==T||e[27]!==U?(q=n.jsx("button",{type:"button",className:Nt,"aria-label":U,onClick:T,style:O,children:V}),e[26]=T,e[27]=U,e[28]=q):q=e[28];const ee=i?"shrink":"flex-1";let Z;e[29]!==ee?(Z=ae("flex min-w-0 items-center rounded-lg px-2 py-1.5 text-start transition-colors active:bg-interactive-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",ee),e[29]=ee,e[30]=Z):Z=e[30];let Y;e[31]!==a?(Y=a("sessions.switcher.openAria"),e[31]=a,e[32]=Y):Y=e[32];let B;e[33]===Symbol.for("react.memo_cache_sentinel")?(B={touchAction:"manipulation"},e[33]=B):B=e[33];let Q;e[34]!==I?(Q=n.jsx("span",{dir:"auto",className:"block min-w-0 truncate oc-ui-start-align typography-ui-label font-medium text-foreground",children:I}),e[34]=I,e[35]=Q):Q=e[35];const oe=c&&"rotate-180";let X;e[36]!==oe?(X=ae("size-4 shrink-0 text-muted-foreground transition-transform duration-150",oe),e[36]=oe,e[37]=X):X=e[37];let te;e[38]!==X?(te=n.jsx(G,{name:"arrow-down-s",className:X}),e[38]=X,e[39]=te):te=e[39];let ce;e[40]!==Q||e[41]!==te?(ce=n.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[Q,te]}),e[40]=Q,e[41]=te,e[42]=ce):ce=e[42];let ue;e[43]!==c||e[44]!==Z||e[45]!==Y||e[46]!==ce?(ue=n.jsx("button",{ref:p,type:"button",className:Z,"aria-label":Y,"aria-haspopup":"dialog","aria-expanded":c,onClick:$,style:B,children:ce}),e[43]=c,e[44]=Z,e[45]=Y,e[46]=ce,e[47]=ue):ue=e[47];let H;e[48]!==i?(H=i?n.jsx("div",{className:"min-w-0 flex-1"}):null,e[48]=i,e[49]=H):H=e[49];let ne;e[50]!==f||e[51]!==h||e[52]!==w||e[53]!==l||e[54]!==E?(ne=E?null:n.jsx(rh,{open:l,onOpenChange:P,currentSessionId:f,effectiveDirectory:h,isNewSessionDraftOpen:w}),e[50]=f,e[51]=h,e[52]=w,e[53]=l,e[54]=E,e[55]=ne):ne=e[55];let Te;e[56]!==M||e[57]!==a?(Te=a(M?"mobile.header.openWorkspaceWithChangesAria":"mobile.header.openWorkspaceAria"),e[56]=M,e[57]=a,e[58]=Te):Te=e[58];let se;e[59]!==r?(se=()=>{u(!1),d(!1),r()},e[59]=r,e[60]=se):se=e[60];let xe,pe;e[61]===Symbol.for("react.memo_cache_sentinel")?(xe={touchAction:"manipulation"},pe=n.jsx(G,{name:"pencil-ruler-2",className:"size-5"}),e[61]=xe,e[62]=pe):(xe=e[61],pe=e[62]);let ke;e[63]!==M?(ke=M?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]=M,e[64]=ke):ke=e[64];let Ee;e[65]!==Te||e[66]!==se||e[67]!==ke?(Ee=n.jsxs("button",{type:"button",className:Nt,"aria-label":Te,onClick:se,style:xe,children:[pe,ke]}),e[65]=Te,e[66]=se,e[67]=ke,e[68]=Ee):Ee=e[68];let ye;e[69]!==q||e[70]!==ue||e[71]!==H||e[72]!==ne||e[73]!==Ee?(ye=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:K,children:n.jsxs("div",{className:"flex h-[var(--oc-header-height,56px)] w-full items-center gap-1 px-2",children:[q,ue,H,ne,Ee]})}),e[69]=q,e[70]=ue,e[71]=H,e[72]=ne,e[73]=Ee,e[74]=ye):ye=e[74];let ge;e[75]===Symbol.for("react.memo_cache_sentinel")?(ge=()=>d(!1),e[75]=ge):ge=e[75];let we;e[76]!==c?(we=n.jsx(lh,{open:c,onClose:ge,anchorRef:p}),e[76]=c,e[77]=we):we=e[77];let ve;return e[78]!==ye||e[79]!==we?(ve=n.jsxs(n.Fragment,{children:[ye,we]}),e[78]=ye,e[79]=we,e[80]=ve):ve=e[80],ve};function mh(s){return s.currentDirectory}function ph(s){return s.currentSessionId}function hh(s){return!!s.newSessionDraft?.open}function gh(s){return s.runOverviewKey}const bh=s=>{const e=re.c(3),{onActiveConnectionDeleted:t,onConnect:r}=s;let o;return e[0]!==t||e[1]!==r?(o=n.jsx(ja,{mode:"instances",onConnected:r,onActiveConnectionDeleted:t}),e[0]=t,e[1]=r,e[2]=o):o=e[2],o},cn=s=>yn(s)??"",xh=s=>{const e=s;return cn(e.directory??e.project?.worktree??null)},Sa=({open:s,project:e,worktree:t,onClose:r,onDeleted:o})=>{const{t:i}=be(),a=Bo(),l=Xs(S=>S.activeSessions),u=nt(S=>S.archiveSessions),c=nt(S=>S.unarchiveSessions),{git:d,sourceControl:p}=Or(),[g,f]=m.useState(!1),[b,x]=m.useState(!1),[h,v]=m.useState(!1),[w,N]=m.useState(null),[_,M]=m.useState(!1),E=cn(t?.path),[j,C]=m.useState(!1),k=t?.branch??"";m.useEffect(()=>{if(C(!1),!s||!E)return;let S=!1;return Kl(e.path,{path:E,branch:k}).then(P=>{S||C(P)}),()=>{S=!0}},[s,e.path,k,E]);const L=m.useMemo(()=>{if(!E)return[];const S=new Map;for(const P of[...l,...a])xh(P)===E&&S.set(P.id,P);return Array.from(S.values())},[l,a,E]);m.useEffect(()=>{if(!s){f(!1),x(!1),v(!1),N(null),M(!1);return}if(!t?.path)return;let S=!1;return Vl(t.path).then(P=>{S||(v(!!P?.isDirty),N(P?.upstream?.split("/")[0]?.trim()||null))}).catch(()=>{S||v(!!t.status?.isDirty)}),()=>{S=!0}},[s,t?.path,t?.status?.isDirty]);const I=m.useCallback(async(S,P)=>(await Hl(e,S,{deleteRemoteBranch:j&&b,deleteLocalBranch:j&&g,remoteName:w??void 0,network:{git:d,sourceControl:p},skipTeardown:P}),cn(Fs.getState().currentDirectory)===E&&cn(e.path)&&Fs.getState().setDirectory(cn(e.path),{showOverlay:!1}),!0),[g,b,d,j,e,w,p,E]),A=m.useCallback((S,P)=>{const D=ql(S),$=async(K,U)=>{const O=he.loading(i("sessions.sidebar.sessionDialogs.worktree.removingTitle",{name:D}));Ul(S.path);try{const V=await Gl({sessionIds:U,removeWorktree:()=>I(S,K),archiveSessions:u,restoreSessions:ee=>c(ee,{undo:!0})});if(!V.removed){he.dismiss(O);return}const{failedIds:q}=V.archive;if(q.length>0){he.error(q.length===1?i("sessions.sidebar.bulkActions.failedArchiveSingle",{count:q.length}):i("sessions.sidebar.bulkActions.failedArchivePlural",{count:q.length}),{id:O,description:i("sessions.sidebar.dialogs.deleteResult.tryAgain")});return}he.success(i(j&&b?"sessions.sidebar.sessionDialogs.worktree.removedWithRemote":"sessions.sidebar.sessionDialogs.worktree.removed"),{id:O,description:D}),o?.()}catch(V){const q=V instanceof Pn?V.message||i("sessions.sidebar.dialogs.deleteResult.tryAgain"):V instanceof br||V instanceof ps&&!V.message.includes(" ")?i("gitView.publish.remoteNotGranted"):V instanceof Error?V.message:i("sessions.sidebar.dialogs.deleteResult.tryAgain");he.error(i("sessions.sidebar.sessionDialogs.worktree.errorRemoveTitle"),{id:O,description:q,...V instanceof Error?Xl(V,i("sessions.sidebar.sessionDialogs.worktree.deleteWithoutTeardown"),()=>{$(!0,Ql(U,S.path))}):void 0})}finally{Jl(S.path)}};$(!1,P)},[u,b,j,o,I,i,c]),R=()=>{!t||_||(A(t,L.map(S=>S.id)),r())};if(!t)return null;const F=t.branch||t.label||t.path,T=(S,P,D,$)=>n.jsxs("label",{className:ae("oc-tile flex min-h-11 items-center justify-between gap-3 rounded-lg px-3",$&&"opacity-50"),children:[n.jsx("span",{className:"typography-meta font-medium text-foreground",children:D}),n.jsx(Yl,{checked:S,onCheckedChange:P,disabled:$})]});return n.jsx(Mn,{open:s,onClose:r,title:i("mobile.projectEdit.deleteWorktreeTitle"),footer:n.jsxs("div",{className:"flex gap-2",children:[n.jsx(Ae,{variant:"ghost",className:"flex-1",onClick:r,disabled:_,children:i("projectEditDialog.actions.cancel")}),n.jsx(Ae,{variant:"destructive",className:"flex-1",onClick:()=>{R()},disabled:_,children:i("mobile.projectEdit.deleteWorktreeConfirmButton")})]}),children:n.jsxs("div",{className:"flex flex-col gap-4 px-1 py-1",children:[n.jsx("p",{className:"typography-ui-body text-foreground",children:i("mobile.projectEdit.deleteWorktreeConfirm",{name:F})}),h?n.jsx("p",{className:"rounded-lg bg-[var(--status-warning-background)] px-3 py-2.5 typography-meta text-foreground",children:i("mobile.projectEdit.deleteWorktreeDirty")}):null,L.length>0?n.jsx("p",{className:"typography-meta text-muted-foreground",children:i("mobile.projectEdit.deleteWorktreeArchiveNote",{count:L.length})}):null,j?n.jsxs("div",{className:"flex flex-col gap-2",children:[T(g,f,i("mobile.projectEdit.deleteLocalBranch"),_),T(b,x,i("mobile.projectEdit.deleteRemoteBranch"),_||!w)]}):null]})})},Yi="mobile-surface-root",dr=16,An=200,yh=()=>{if(typeof document>"u")return null;let s=document.getElementById(Yi);return s||(s=document.createElement("div"),s.id=Yi,document.body.appendChild(s)),s},Zt=({open:s,onClose:e,title:t,subtitle:r,trailing:o,disableEscapeDismiss:i=!1,headerless:a=!1,noHeaderBorder:l=!1,ariaLabel:u,variant:c="fullscreen",dialogAlign:d="chat",children:p})=>{const{t:g,direction:f}=be(),b=xr(),x=m.useRef(null),[h,v]=m.useState(!1),[w,N]=m.useState(!1),_=m.useRef(null),M=m.useRef(null),E=m.useRef(e);if(m.useEffect(()=>{E.current=e},[e]),typeof document<"u"&&!x.current&&(x.current=yh()),m.useEffect(()=>{if(!s){v(!1);return}const k=window.setTimeout(()=>v(!0),dr);return()=>window.clearTimeout(k)},[s]),m.useEffect(()=>{if(!s){N(!1);return}const k=window.setTimeout(()=>N(!0),dr+An+80);return()=>window.clearTimeout(k)},[s]),m.useEffect(()=>{if(!s)return;const k=document.body.style.overflow;M.current=document.activeElement instanceof HTMLElement?document.activeElement:null,document.body.style.overflow="hidden";const L=()=>{const R=_.current;if(!R)return;(R.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')??R).focus({preventScroll:!0})},I=window.setTimeout(L,dr),A=R=>{if(R.key==="Escape"&&!i){if(Mr(R))return;E.current();return}if(R.key!=="Tab")return;const F=_.current;if(!F)return;const T=Array.from(F.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')).filter($=>!$.hasAttribute("disabled")&&$.getAttribute("aria-hidden")!=="true");if(T.length===0){R.preventDefault(),F.focus({preventScroll:!0});return}const S=T[0],P=T[T.length-1],D=document.activeElement;R.shiftKey&&D===S?(R.preventDefault(),P.focus({preventScroll:!0})):!R.shiftKey&&D===P&&(R.preventDefault(),S.focus({preventScroll:!0}))};return document.addEventListener("keydown",A),()=>{window.clearTimeout(I),document.body.style.overflow=k,document.removeEventListener("keydown",A),M.current?.focus?.({preventScroll:!0}),M.current=null}},[i,s]),!s||!x.current)return null;const j=c==="dialog",C=n.jsxs("section",{ref:_,role:"dialog","aria-modal":"true","aria-label":u,tabIndex:-1,className:ae("flex flex-col bg-background text-foreground",j?"h-[min(88dvh,860px)] w-full max-w-[720px] overflow-hidden rounded-2xl border border-edge shadow-[0_24px_64px_rgb(0_0_0_/_0.32)]":"oc-keyboard-inset-surface oc-bottom-safe-surface fixed inset-0 z-50"),style:j?{opacity:h?1:0,transform:h?"none":"scale(0.97)",transition:`opacity ${An}ms ease-out, transform ${An}ms cubic-bezier(0.32, 0.72, 0, 1)`}:{paddingTop:"var(--oc-safe-area-top, 0px)",transform:h?"none":f==="rtl"?"translateX(-100%)":"translateX(100%)",transition:`transform ${An}ms cubic-bezier(0.32, 0.72, 0, 1)`},onTransitionEnd:k=>{h&&k.target===k.currentTarget&&k.propertyName==="transform"&&N(!0)},children:[a?null:n.jsxs("header",{className:ae(bs,!l&&"border-b border-edge"),children:[n.jsx("button",{type:"button",className:Nt,"aria-label":g("mobile.surface.closeAria"),onClick:e,style:{touchAction:"manipulation"},children:n.jsx(G,{name:"close",className:"size-5"})}),n.jsxs("div",{className:"min-w-0 flex-1 px-1",children:[t?typeof t=="string"?n.jsx("h2",{className:ae("truncate",vn),children:t}):t:null,r?typeof r=="string"?n.jsx("p",{className:"truncate typography-micro text-muted-foreground",children:r}):r:null]}),o?n.jsx("div",{className:"flex shrink-0 items-center gap-1.5",children:o}):null]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:w?n.jsx("div",{className:"h-full",style:{animation:"oc-surface-content-in 200ms ease-out"},children:p}):null}),n.jsx("style",{children:"@keyframes oc-surface-content-in { from { opacity: 0 } to { opacity: 1 } }"})]});return j?Es.createPortal(n.jsx("div",{className:"oc-keyboard-inset-surface oc-bottom-safe-surface fixed inset-0 z-50 flex items-center justify-center p-4 transition-opacity duration-200 ease-out",style:{background:"rgb(0 0 0 / 0.45)",opacity:h?1:0,paddingLeft:d==="chat"?`max(1rem, ${b.left}px)`:"1rem",paddingRight:d==="chat"?`max(1rem, ${b.right}px)`:"1rem",paddingTop:"max(1rem, var(--oc-safe-area-top, 0px))"},onClick:e,children:n.jsx("div",{"data-keyboard-rider":"0.5",className:"flex w-full max-w-[720px] justify-center",onClick:k=>k.stopPropagation(),children:C})}),x.current):Es.createPortal(C,x.current)},vh=[],wh=s=>{const e=re.c(8),{projectPath:t}=s,{t:r}=be(),{journey:o}=ol();let i;if(e[0]!==o||e[1]!==t||e[2]!==r){const a=o?al(o,t):[];let l;e[4]!==r?(l=r("mobile.projectEdit.spacesTitle"),e[4]=r,e[5]=l):l=e[5];let u;e[6]!==l?(u=n.jsx("label",{className:"typography-ui-label font-medium text-foreground",children:l}),e[6]=l,e[7]=u):u=e[7],i=n.jsxs("div",{className:"flex flex-col gap-2",children:[u,o!==null&&a.length===0?n.jsx("p",{className:"typography-meta text-muted-foreground",children:r("spaces.page.empty")}):null,a.map(Ch)]}),e[0]=o,e[1]=t,e[2]=r,e[3]=i}else i=e[3];return i},jh=s=>yn(s)??"",kh=s=>{const e=re.c(18),{worktree:t,onDelete:r}=s,{t:o}=be(),i=t.branch||t.label||t.path,a=sc(t.path),l=a&&"opacity-60";let u;e[0]!==l?(u=ae("flex items-center gap-2 rounded-2xl border border-edge bg-[var(--surface-elevated)] py-1.5 ps-3 pe-1.5 transition-colors",l),e[0]=l,e[1]=u):u=e[1];const c=a||void 0;let d;e[2]!==a||e[3]!==o?(d=a?n.jsx("span",{className:"inline-flex shrink-0 text-muted-foreground",role:"status","aria-label":o("sessions.sidebar.group.worktreeRemoving"),children:n.jsx(G,{name:"loader-4",className:"size-4 animate-spin"})}):n.jsx(G,{name:"git-branch",className:"size-4 shrink-0 text-muted-foreground"}),e[2]=a,e[3]=o,e[4]=d):d=e[4];let p;e[5]!==i?(p=n.jsx("span",{className:"block min-w-0 flex-1 truncate typography-ui-label text-foreground",children:i}),e[5]=i,e[6]=p):p=e[6];let g;e[7]!==i||e[8]!==r||e[9]!==a||e[10]!==o?(g=a?null:n.jsx("button",{type:"button",className:"flex size-9 shrink-0 items-center justify-center rounded-xl text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-destructive","aria-label":o("mobile.projectEdit.deleteWorktreeAria",{label:i}),onClick:r,style:{touchAction:"manipulation"},children:n.jsx(Zo,{className:"size-4"})}),e[7]=i,e[8]=r,e[9]=a,e[10]=o,e[11]=g):g=e[11];let f;return e[12]!==u||e[13]!==c||e[14]!==d||e[15]!==p||e[16]!==g?(f=n.jsxs("div",{className:u,"aria-busy":c,children:[d,p,g]}),e[12]=u,e[13]=c,e[14]=d,e[15]=p,e[16]=g,e[17]=f):f=e[17],f},Sh=s=>{const e=re.c(75),{open:t,project:r,onClose:o}=s,{t:i}=be(),{currentTheme:a}=zo(),l=Xe(Nh),u=Mt(Rh),c=Mt(Eh),d=Mt(Ih);let p;e[0]!==r?(p=se=>r?se.projects.find(xe=>xe.id===r.id)?.iconImage??null:null,e[0]=r,e[1]=p):p=e[1];const g=Mt(p),[f,b]=m.useState(""),[x,h]=m.useState(null),[v,w]=m.useState(null),[N,_]=m.useState(!1),[M,E]=m.useState(null),j=r?.id??null;let C;e[2]!==t||e[3]!==r?(C=()=>{!t||!r||(b(r.label),h(r.icon??null),w(r.color??null))},e[2]=t,e[3]=r,e[4]=C):C=e[4];let k;e[5]!==t||e[6]!==j?(k=[t,j],e[5]=t,e[6]=j,e[7]=k):k=e[7],m.useEffect(C,k);const L=r?.path;let I;e[8]!==L?(I=jh(L),e[8]=L,e[9]=I):I=e[9];const A=I,R=nt(se=>A?se.availableWorktreesByProject.get(A):void 0)??vh,F=$t(se=>A?se.directories.get(A)?.isGitRepo:void 0)??R.length>0;let T;e[10]!==v||e[11]!==x||e[12]!==f||e[13]!==o||e[14]!==r||e[15]!==u?(T=()=>{if(!r)return;const xe={label:f.trim()||r.label,icon:x,color:v};v!==(r.color??null)&&(xe.iconBackground=nc(v)),u(r.id,xe),o()},e[10]=v,e[11]=x,e[12]=f,e[13]=o,e[14]=r,e[15]=u,e[16]=T):T=e[16];const S=T;let P;e[17]!==c||e[18]!==N||e[19]!==r||e[20]!==i?(P=()=>{!r||N||(_(!0),c(r.id).then(se=>{if(!se.ok){he.error(se.error||i("projectEditDialog.toast.failedToDiscoverIcon"));return}if(se.skipped){he.success(i("projectEditDialog.toast.customIconAlreadySet"));return}he.success(i("projectEditDialog.toast.iconDiscovered"))}).finally(()=>_(!1)))},e[17]=c,e[18]=N,e[19]=r,e[20]=i,e[21]=P):P=e[21];const D=P;let $;e[22]!==r||e[23]!==d||e[24]!==i?($=()=>{r&&d(r.id).then(se=>{if(!se.ok){he.error(se.error||i("projectEditDialog.toast.failedToRemoveIcon"));return}he.success(i("projectEditDialog.toast.iconRemoved"))})},e[22]=r,e[23]=d,e[24]=i,e[25]=$):$=e[25];const K=$;let U;e[26]!==v?(U=Fo(v),e[26]=v,e[27]=U):U=e[27];const O=U,V=x?$o[x]:null,q=!!g;let ee;e[28]!==i?(ee=i("projectEditDialog.title"),e[28]=i,e[29]=ee):ee=e[29];let Z;e[30]!==i?(Z=i("projectEditDialog.title"),e[30]=i,e[31]=Z):Z=e[31];let Y;e[32]!==i?(Y=i("projectEditDialog.actions.save"),e[32]=i,e[33]=Y):Y=e[33];let B;e[34]!==f?(B=f.trim(),e[34]=f,e[35]=B):B=e[35];const Q=!B;let oe,X;e[36]===Symbol.for("react.memo_cache_sentinel")?(oe={touchAction:"manipulation"},X=n.jsx(Bf,{className:"size-4"}),e[36]=oe,e[37]=X):(oe=e[36],X=e[37]);let te;e[38]!==i?(te=i("projectEditDialog.actions.save"),e[38]=i,e[39]=te):te=e[39];let ce;e[40]!==S||e[41]!==Y||e[42]!==Q||e[43]!==te?(ce=n.jsxs(Ae,{type:"button",variant:"default",size:"sm","aria-label":Y,onClick:S,disabled:Q,style:oe,children:[X,te]}),e[40]=S,e[41]=Y,e[42]=Q,e[43]=te,e[44]=ce):ce=e[44];let ue;e[45]!==v||e[46]!==O||e[47]!==g||e[48]!==a||e[49]!==D||e[50]!==K||e[51]!==q||e[52]!==x||e[53]!==N||e[54]!==F||e[55]!==l||e[56]!==f||e[57]!==V||e[58]!==r||e[59]!==i||e[60]!==R?(ue=r?n.jsxs(Yt,{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&&r.iconBackground?{backgroundColor:r.iconBackground}:void 0,children:q?n.jsx(Wo,{project:{id:r.id,iconImage:g},options:{themeVariant:a.metadata.variant,iconColor:a.colors.surface.foreground},className:"size-full object-contain",fallback:n.jsx(Sr,{className:"size-7"})}):V?n.jsx(G,{name:V,className:"size-7",style:O?{color:O}:void 0}):n.jsx(Sr,{className:"size-7",style:O?{color:O}:void 0})})}),n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx("label",{className:"typography-ui-label font-medium text-foreground",children:i("projectEditDialog.field.name")}),n.jsx(Zl,{value:f,onChange:se=>b(se.target.value),placeholder:i("projectEditDialog.field.namePlaceholder"),className:"h-11"}),n.jsx("p",{className:"truncate typography-meta text-muted-foreground",title:r.path,children:r.path})]}),n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("label",{className:"typography-ui-label font-medium text-foreground",children:i("projectEditDialog.field.color")}),n.jsxs("div",{className:"flex flex-wrap gap-2.5",children:[n.jsx("button",{type:"button",onClick:()=>w(null),"aria-label":i("projectEditDialog.option.none"),className:ae("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(se=>n.jsx("button",{type:"button",onClick:()=>w(se),"aria-label":i("settings.projects.appearance.colorSwatchAria",{color:se}),title:se,className:ae("size-9 rounded-xl border-2 transition-all",v===se?"border-foreground":"border-transparent hover:border-edge"),style:{backgroundColor:se,touchAction:"manipulation"}},se))]})]}),n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("label",{className:"typography-ui-label font-medium text-foreground",children:i("projectEditDialog.field.icon")}),n.jsxs("div",{className:"flex flex-wrap gap-2.5",children:[n.jsx("button",{type:"button",onClick:()=>h(null),"aria-label":i("projectEditDialog.option.none"),className:ae("flex size-9 items-center justify-center rounded-xl border-2 transition-all",x===null?"border-foreground bg-[var(--surface-elevated)]":"border-edge hover:border-edge"),style:{touchAction:"manipulation"},children:n.jsx("span",{className:"h-0.5 w-4 rotate-45 rounded-full bg-muted-foreground/40"})}),tc.map(se=>n.jsx("button",{type:"button",onClick:()=>h(se.key),"aria-label":se.label,className:ae("flex size-9 items-center justify-center rounded-xl border-2 transition-all",x===se.key?"border-foreground bg-[var(--surface-elevated)]":"border-edge hover:border-edge"),style:{touchAction:"manipulation"},children:n.jsx(G,{name:se.Icon,className:"size-4",style:O?{color:O}:void 0})},se.key))]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:[n.jsx(Ae,{size:"sm",variant:"outline",onClick:D,disabled:N,children:i(N?"projectEditDialog.actions.discovering":"projectEditDialog.actions.discoverFavicon")}),q?n.jsx(Ae,{size:"sm",variant:"outline",onClick:K,children:i("projectEditDialog.actions.removeProjectIcon")}):null]})]}),F?n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("label",{className:"typography-ui-label font-medium text-foreground",children:i("mobile.projectEdit.worktreesTitle")}),R.length===0?n.jsx("p",{className:"typography-meta text-muted-foreground",children:i("mobile.projectEdit.worktreesEmpty")}):n.jsx("div",{className:"flex flex-col gap-1.5",children:R.map(se=>n.jsx(kh,{worktree:se,onDelete:()=>E(se)},se.path))})]}):null,F&&l?n.jsx(wh,{projectPath:r.path}):null]}):null,e[45]=v,e[46]=O,e[47]=g,e[48]=a,e[49]=D,e[50]=K,e[51]=q,e[52]=x,e[53]=N,e[54]=F,e[55]=l,e[56]=f,e[57]=V,e[58]=r,e[59]=i,e[60]=R,e[61]=ue):ue=e[61];let H;e[62]!==o||e[63]!==t||e[64]!==ee||e[65]!==Z||e[66]!==ce||e[67]!==ue?(H=n.jsx(Zt,{open:t,onClose:o,title:ee,ariaLabel:Z,noHeaderBorder:!0,trailing:ce,children:ue}),e[62]=o,e[63]=t,e[64]=ee,e[65]=Z,e[66]=ce,e[67]=ue,e[68]=H):H=e[68];let ne;e[69]!==r||e[70]!==M?(ne=r?n.jsx(Sa,{open:!!M,project:{id:r.id,path:r.path},worktree:M,onClose:()=>E(null)}):null,e[69]=r,e[70]=M,e[71]=ne):ne=e[71];let Te;return e[72]!==H||e[73]!==ne?(Te=n.jsxs(n.Fragment,{children:[H,ne]}),e[72]=H,e[73]=ne,e[74]=Te):Te=e[74],Te};function Ch(s){return n.jsx(Gf,{entry:s,actions:"sheet"},s.id)}function Nh(s){return s.isolatedSpacesEnabled}function Rh(s){return s.updateProjectMeta}function Eh(s){return s.discoverProjectIcon}function Ih(s){return s.removeProjectIcon}const Ys=s=>{const e=re.c(20),{project:t,size:r}=s,o=r===void 0?"md":r,{currentTheme:i}=zo(),a=t.icon?$o[t.icon]:null;let l;e[0]!==t.color?(l=Fo(t.color),e[0]=t.color,e[1]=l):l=e[1];const u=l,c=o==="md"?"size-5":"size-3.5";let d;e[2]!==a||e[3]!==c||e[4]!==u?(d=a?n.jsx(G,{name:a,className:c,style:u?{color:u}:void 0}):n.jsx(Sr,{className:c,style:u?{color:u}:void 0}),e[2]=a,e[3]=c,e[4]=u,e[5]=d):d=e[5];const p=d;let g;e[6]!==i||e[7]!==p||e[8]!==t.iconImage||e[9]!==t.id?(g=t.iconImage?n.jsx(Wo,{project:{id:t.id,iconImage:t.iconImage??null},options:{themeVariant:i.metadata.variant,iconColor:i.colors.surface.foreground},className:"size-full object-contain",fallback:p}):null,e[6]=i,e[7]=p,e[8]=t.iconImage,e[9]=t.id,e[10]=g):g=e[10];const f=g;let b;e[11]!==t.iconBackground?(b=t.iconBackground?{backgroundColor:t.iconBackground}:void 0,e[11]=t.iconBackground,e[12]=b):b=e[12];const x=b;if(o==="md"){let N;return e[13]!==p||e[14]!==f||e[15]!==x?(N=n.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center text-muted-foreground",children:f?n.jsx("span",{className:"flex size-6 items-center justify-center overflow-hidden rounded-md",style:x,children:f}):p}),e[13]=p,e[14]=f,e[15]=x,e[16]=N):N=e[16],N}const h=f?x:void 0,v=f??p;let w;return e[17]!==h||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:h,children:v}),e[17]=h,e[18]=v,e[19]=w):w=e[19],w},Xr=s=>yn(s)??"",_h=s=>{const e=Xr(s);if(!e)return"";const t=e.split("/").filter(Boolean);return t[t.length-1]?.replace(/[-_]/g," ")||e},Rs=s=>{const e=s;return Xr(e.directory??e.project?.worktree??null)},Jr=s=>{const e=re.c(51),{initialTitle:t,indent:r,className:o,aiRename:i,placeholder:a,onSubmit:l,onCancel:u}=s,{t:c}=be(),[d,p]=m.useState(t),g=Th;let f;e[0]!==i||e[1]!==t||e[2]!==u||e[3]!==l||e[4]!==d?(f=()=>{const D=d.trim();if(!D&&i||D===t.trim()){u();return}l(D)},e[0]=i,e[1]=t,e[2]=u,e[3]=l,e[4]=d,e[5]=f):f=e[5];const b=f;let x;e[6]!==o?(x=ae("flex h-9 min-w-0 flex-1 items-center gap-2 pe-2",o),e[6]=o,e[7]=x):x=e[7];let h;e[8]!==r?(h={paddingInlineStart:r},e[8]=r,e[9]=h):h=e[9];let v;e[10]!==b?(v=D=>{D.preventDefault(),b()},e[10]=b,e[11]=v):v=e[11];let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=D=>p(D.target.value),e[12]=w):w=e[12];let N;e[13]!==u?(N=D=>au(D,u),e[13]=u,e[14]=N):N=e[14];let _;e[15]!==c?(_=c("sessions.sidebar.session.rename.save"),e[15]=c,e[16]=_):_=e[16];let M;e[17]!==a||e[18]!==c?(M=a??c("sessions.sidebar.session.menu.rename"),e[17]=a,e[18]=c,e[19]=M):M=e[19];let E;e[20]===Symbol.for("react.memo_cache_sentinel")?(E={minHeight:0},e[20]=E):E=e[20];let j;e[21]!==N||e[22]!==_||e[23]!==M||e[24]!==d?(j=n.jsx("input",{ref:g,value:d,onChange:w,onKeyDown:N,"aria-label":_,placeholder:M,className:"min-w-0 flex-1 bg-transparent text-[16px] typography-ui-label text-foreground outline-none placeholder:text-muted-foreground",style:E,enterKeyHint:"done"}),e[21]=N,e[22]=_,e[23]=M,e[24]=d,e[25]=j):j=e[25];let C;e[26]!==i||e[27]!==u||e[28]!==c?(C=i?n.jsx("button",{type:"button",disabled:i.disabled,onClick:()=>{i.run(),u()},"aria-label":c("sessions.aiRename.action"),"aria-description":i.hint,title:i.hint,className:"flex size-8 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:text-foreground disabled:opacity-40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",style:{touchAction:"manipulation",minHeight:0,minWidth:0},children:n.jsx(G,{name:"ai-generate-2",className:"size-4"})}):null,e[26]=i,e[27]=u,e[28]=c,e[29]=C):C=e[29];let k;e[30]!==c?(k=c("sessions.sidebar.session.rename.save"),e[30]=c,e[31]=k):k=e[31];let L,I;e[32]===Symbol.for("react.memo_cache_sentinel")?(L={touchAction:"manipulation",minHeight:0,minWidth:0},I=n.jsx(G,{name:"check",className:"size-4"}),e[32]=L,e[33]=I):(L=e[32],I=e[33]);let A;e[34]!==k?(A=n.jsx("button",{type:"submit","aria-label":k,className:"flex size-8 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",style:L,children:I}),e[34]=k,e[35]=A):A=e[35];let R;e[36]!==c?(R=c("sessions.sidebar.session.rename.cancel"),e[36]=c,e[37]=R):R=e[37];let F,T;e[38]===Symbol.for("react.memo_cache_sentinel")?(F={touchAction:"manipulation",minHeight:0,minWidth:0},T=n.jsx(G,{name:"close",className:"size-4"}),e[38]=F,e[39]=T):(F=e[38],T=e[39]);let S;e[40]!==u||e[41]!==R?(S=n.jsx("button",{type:"button",onClick:u,"aria-label":R,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:F,children:T}),e[40]=u,e[41]=R,e[42]=S):S=e[42];let P;return e[43]!==j||e[44]!==C||e[45]!==A||e[46]!==S||e[47]!==x||e[48]!==h||e[49]!==v?(P=n.jsxs("form",{className:x,style:h,onSubmit:v,children:[j,C,A,S]}),e[43]=j,e[44]=C,e[45]=A,e[46]=S,e[47]=x,e[48]=h,e[49]=v,e[50]=P):P=e[50],P};function Th(s){s&&(s.focus(),s.select())}const Qi=s=>{const e=re.c(8),{session:t}=s,{t:r}=be(),o=Ko(t);if(!o)return null;const i=rc[o.status];let a;e[0]!==r||e[1]!==i?(a=r(i),e[0]=r,e[1]=i,e[2]=a):a=e[2];const l=a,u=ic[o.status];let c;e[3]!==u?(c={color:u},e[3]=u,e[4]=c):c=e[4];let d;return e[5]!==l||e[6]!==c?(d=n.jsx(G,{name:"target",className:"size-3.5 shrink-0",style:c,"aria-label":l}),e[5]=l,e[6]=c,e[7]=d):d=e[7],d},Zi=s=>{const e=re.c(9),{hasPermission:t,hasForm:r}=s,{t:o}=be();if(!t&&!r)return null;let i;e[0]!==t||e[1]!==o?(i=t?n.jsx("span",{className:"inline-flex shrink-0 items-center text-status-warning","aria-label":o("sessions.sidebar.session.status.permissionRequired"),children:n.jsx(G,{name:"shield",className:"size-3"})}):null,e[0]=t,e[1]=o,e[2]=i):i=e[2];let a;e[3]!==r||e[4]!==o?(a=r?n.jsx("span",{className:"inline-flex shrink-0 items-center text-status-warning","aria-label":o("sessions.sidebar.session.status.questionPending"),children:n.jsx(G,{name:"question",className:"size-3"})}):null,e[3]=r,e[4]=o,e[5]=a):a=e[5];let l;return e[6]!==i||e[7]!==a?(l=n.jsxs(n.Fragment,{children:[i,a]}),e[6]=i,e[7]=a,e[8]=l):l=e[8],l},As=48,Ah=4*As,Ph=180,eo=(s,e)=>{s&&(s.style.visibility=e?"visible":"hidden")},wn=s=>{const e=re.c(33),{actionsWidth:t,actions:r,revealed:o,onRevealedChange:i,dataActiveSession:a,contentClassName:l,children:u}=s,c=l===void 0?"relative flex w-full items-center bg-background":l,{direction:d}=be(),p=d==="rtl"?-1:1,g=m.useRef(null),f=m.useRef(null),b=m.useRef(null),x=m.useRef(!1),h=m.useRef(0),v=m.useRef(o);let w;e[0]!==p?(w=(O,V)=>{const q=g.current;q&&(eo(f.current,O!==0||V&&O!==h.current),q.style.transition=V?`transform ${Ph}ms ease-out`:"none",q.style.transform=O===0?"none":`translateX(${O*p}px)`,h.current=O)},e[0]=p,e[1]=w):w=e[1];const N=w;let _;e[2]===Symbol.for("react.memo_cache_sentinel")?(_=O=>{O.target===g.current&&O.propertyName==="transform"&&h.current===0&&eo(f.current,!1)},e[2]=_):_=e[2];const M=_;let E,j;e[3]!==t||e[4]!==N||e[5]!==o?(E=()=>{v.current=o,N(o?t:0,!0)},j=[t,N,o],e[3]=t,e[4]=N,e[5]=o,e[6]=E,e[7]=j):(E=e[6],j=e[7]),m.useLayoutEffect(E,j);let C;e[8]===Symbol.for("react.memo_cache_sentinel")?(C=O=>{if(O.touches.length!==1)return;const V=O.touches[0];b.current={x:V.clientX,y:V.clientY},x.current=!1},e[8]=C):C=e[8];const k=C;let L;e[9]!==t||e[10]!==N||e[11]!==p?(L=O=>{if(!b.current)return;const V=O.touches[0],q=(V.clientX-b.current.x)*p,ee=V.clientY-b.current.y;if(!x.current){if(Math.abs(q)<8||Math.abs(q)<=Math.abs(ee))return;x.current=!0}const Z=v.current?t:0;N(Math.max(0,Math.min(t,Z+q)),!1)},e[9]=t,e[10]=N,e[11]=p,e[12]=L):L=e[12];const I=L;let A;e[13]!==t||e[14]!==N||e[15]!==i?(A=()=>{if(b.current=null,!x.current)return;x.current=!1;const O=h.current>t/2;N(O?t:0,!0),O!==v.current&&i(O)},e[13]=t,e[14]=N,e[15]=i,e[16]=A):A=e[16];const R=A,F=a||void 0;let T;e[17]===Symbol.for("react.memo_cache_sentinel")?(T={touchAction:"pan-y"},e[17]=T):T=e[17];let S;e[18]!==t?(S={width:t},e[18]=t,e[19]=S):S=e[19];const P=!o;let D;e[20]!==r||e[21]!==S||e[22]!==P?(D=n.jsx("div",{ref:f,className:"absolute inset-y-0 inset-s-0 flex items-stretch",style:S,"aria-hidden":P,children:r}),e[20]=r,e[21]=S,e[22]=P,e[23]=D):D=e[23];const $=`${c} rounded-[inherit]`;let K;e[24]!==u||e[25]!==$?(K=n.jsx("div",{ref:g,className:$,onTransitionEnd:M,onTransitionCancel:M,children:u}),e[24]=u,e[25]=$,e[26]=K):K=e[26];let U;return e[27]!==R||e[28]!==I||e[29]!==D||e[30]!==K||e[31]!==F?(U=n.jsxs("div",{"data-active-session":F,className:"relative overflow-hidden rounded-lg",onTouchStart:k,onTouchMove:I,onTouchEnd:R,onTouchCancel:R,style:T,children:[D,K]}),e[27]=R,e[28]=I,e[29]=D,e[30]=K,e[31]=F,e[32]=U):U=e[32],U},Dh=s=>{const e=re.c(62),{sessionId:t,title:r,revealed:o,confirmingDelete:i,onArchive:a,onRequestDelete:l,onConfirmDelete:u,onRequestRename:c,onRevealedChange:d,work:p,pin:g}=s,{t:f}=be(),b=o?0:-1;let x;e[0]!==d||e[1]!==t||e[2]!==f?(x=async()=>{if(!(await To(t).catch(Oh))?.ok){Ti.error(f("sessions.sidebar.session.copyId.error"));return}d?.(!1),Ti.success(f("sessions.sidebar.session.copyId.success"))},e[0]=d,e[1]=t,e[2]=f,e[3]=x):x=e[3];const h=x;let v;e[4]!==f||e[5]!==r?(v=f("mobile.sessions.archiveSessionAria",{title:r}),e[4]=f,e[5]=r,e[6]=v):v=e[6];let w,N;e[7]===Symbol.for("react.memo_cache_sentinel")?(w={touchAction:"manipulation"},N=n.jsx(zf,{className:"size-[18px]"}),e[7]=w,e[8]=N):(w=e[7],N=e[8]);let _;e[9]!==a||e[10]!==v||e[11]!==b?(_=n.jsx("button",{type:"button",tabIndex:b,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:a,style:w,children:N}),e[9]=a,e[10]=v,e[11]=b,e[12]=_):_=e[12];let M;e[13]!==d||e[14]!==g||e[15]!==f||e[16]!==b?(M=g?n.jsx("button",{type:"button",tabIndex:b,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":g.pinned?f("sessions.sidebar.session.menu.unpin"):f("sessions.sidebar.session.menu.pin"),onClick:()=>{g.onToggle(),d?.(!1)},style:{touchAction:"manipulation"},children:n.jsx(G,{name:g.pinned?"unpin":"pushpin",className:"size-[18px]"})}):null,e[13]=d,e[14]=g,e[15]=f,e[16]=b,e[17]=M):M=e[17];let E;e[18]!==d||e[19]!==f||e[20]!==b||e[21]!==p?(E=p?n.jsx("button",{type:"button",tabIndex:b,className:ae("flex flex-1 items-center justify-center transition-colors active:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",p.inWork?"text-status-success":"text-muted-foreground active:text-foreground"),"aria-label":p.inWork?f("sessions.sidebar.session.work.markDone"):f("sessions.sidebar.session.work.track"),onClick:()=>{p.onToggle(),d?.(!1)},style:{touchAction:"manipulation"},children:n.jsx(G,{name:p.inWork?"check":"eye",className:p.inWork?"size-5":"size-[18px]"})}):null,e[18]=d,e[19]=f,e[20]=b,e[21]=p,e[22]=E):E=e[22];const j=i?"rounded-lg bg-destructive text-destructive-foreground":"text-[var(--status-error)] active:opacity-80";let C;e[23]!==j?(C=ae("flex flex-1 items-center justify-center transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-destructive",j),e[23]=j,e[24]=C):C=e[24];let k;e[25]!==i||e[26]!==f||e[27]!==r?(k=i?f("mobile.sessions.confirmDeleteSessionAria",{title:r}):f("mobile.sessions.deleteSessionAria",{title:r}),e[25]=i,e[26]=f,e[27]=r,e[28]=k):k=e[28];const L=i?u:l;let I,A;e[29]===Symbol.for("react.memo_cache_sentinel")?(I={touchAction:"manipulation"},A=n.jsx(Zo,{className:"size-[18px]"}),e[29]=I,e[30]=A):(I=e[29],A=e[30]);let R;e[31]!==k||e[32]!==L||e[33]!==C||e[34]!==b?(R=n.jsx("button",{type:"button",tabIndex:b,className:C,"aria-label":k,onClick:L,style:I,children:A}),e[31]=k,e[32]=L,e[33]=C,e[34]=b,e[35]=R):R=e[35];let F;e[36]!==f||e[37]!==r?(F=f("mobile.sessions.renameSessionAria",{title:r}),e[36]=f,e[37]=r,e[38]=F):F=e[38];let T,S;e[39]===Symbol.for("react.memo_cache_sentinel")?(T={touchAction:"manipulation"},S=n.jsx(Ff,{className:"size-[18px]"}),e[39]=T,e[40]=S):(T=e[39],S=e[40]);let P;e[41]!==c||e[42]!==F||e[43]!==b?(P=n.jsx("button",{type:"button",tabIndex:b,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":F,onClick:c,style:T,children:S}),e[41]=c,e[42]=F,e[43]=b,e[44]=P):P=e[44];let D;e[45]!==f?(D=f("sessions.sidebar.session.menu.copyId"),e[45]=f,e[46]=D):D=e[46];let $;e[47]!==h?($=()=>{h()},e[47]=h,e[48]=$):$=e[48];let K,U;e[49]===Symbol.for("react.memo_cache_sentinel")?(K={touchAction:"manipulation"},U=n.jsx(G,{name:"file-copy",className:"size-[18px]"}),e[49]=K,e[50]=U):(K=e[49],U=e[50]);let O;e[51]!==D||e[52]!==$||e[53]!==b?(O=n.jsx("button",{type:"button",tabIndex:b,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":D,onClick:$,style:K,children:U}),e[51]=D,e[52]=$,e[53]=b,e[54]=O):O=e[54];let V;return e[55]!==R||e[56]!==P||e[57]!==O||e[58]!==_||e[59]!==M||e[60]!==E?(V=n.jsxs(n.Fragment,{children:[_,M,E,R,P,O]}),e[55]=R,e[56]=P,e[57]=O,e[58]=_,e[59]=M,e[60]=E,e[61]=V):V=e[61],V};function Oh(){return null}const Mh=({active:s,unread:e,running:t,pending:r})=>s?"text-interactive-selection-foreground":e||r.hasPermission||r.hasForm?"font-semibold text-foreground":t?"text-foreground":"oc-title-rest",Lh=s=>{const e=re.c(7);let t;e[0]!==s?(t=l=>s.some(u=>!!l.bySession.get(u)?.permissions.length),e[0]=s,e[1]=t):t=e[1];const r=xi(t);let o;e[2]!==s?(o=l=>s.some(u=>{const c=l.bySession.get(u);return!!(c?.forms.length||c?.pages.length)}),e[2]=s,e[3]=o):o=e[3];const i=xi(o);let a;return e[4]!==i||e[5]!==r?(a={hasPermission:r,hasForm:i},e[4]=i,e[5]=r,e[6]=a):a=e[6],a},Bh=()=>{const s=new Map;for(const e of Xs.getState().activeSessions)e.parentID&&s.set(e.parentID,[...s.get(e.parentID)??[],e]);return s},zh=(s,e,t)=>{Xe.getState().closeMainSurfaces(),e&&Mt.getState().setActiveProjectIdOnly(e),nt.getState().setCurrentSession(s.id,Rs(s)||null),t()},to=(s,e,t)=>{const r=nt.getState();return ac(s,e,lc(e.id,cc(Bh(),e.id),s==="delete"),{archiveSession:r.archiveSession,archiveSessions:r.archiveSessions,deleteSession:r.deleteSession,deleteSessions:r.deleteSessions},t)},Fh=async(s,e,t)=>{try{if(e.length===0){await yi(s.id,Rs(s)||null,"open");return}for(const r of e)await yi(r.id,Rs(r)||Rs(s)||null,"done")}catch{he.error(t("sessions.sidebar.session.work.updateFailed"))}},$h=(s,e,t)=>{const r=Rs(s);if(!r)return;const o={directory:r,sessionId:s.id};Xo({current:e?oc(s)??ll:null,pin:i=>{Ni(o,!0,i).catch(()=>he.error(t("sessions.sidebar.session.pin.pinFailed")))},unpin:()=>{Ni(o,!1,null).catch(()=>he.error(t("sessions.sidebar.session.pin.unpinFailed")))}})},Wh=async(s,e,t)=>{try{await nt.getState().updateSessionTitle(s,e)}catch{he.error(t("mobile.sessions.renameError"))}},dt=Xf()(s=>({revealedKey:null,armedKey:null,renamingKey:null,setRevealed:(e,t)=>s(r=>t?{revealedKey:e,armedKey:null}:r.revealedKey===e?{revealedKey:null,armedKey:null}:r),arm:e=>s({armedKey:e}),startRename:e=>s({renamingKey:e,revealedKey:null,armedKey:null}),stopRename:()=>s({renamingKey:null}),forgetUnlisted:e=>s(t=>{const r=t.revealedKey!==null&&!e(t.revealedKey),o=t.renamingKey!==null&&!e(t.renamingKey);return!r&&!o?t:{revealedKey:r?null:t.revealedKey,armedKey:r?null:t.armedKey,renamingKey:o?null:t.renamingKey}}),reset:()=>s({revealedKey:null,armedKey:null,renamingKey:null})})),jn=s=>{const e=re.c(10);let t;e[0]!==s?(t=c=>c.revealedKey===s,e[0]=s,e[1]=t):t=e[1];const r=dt(t);let o;e[2]!==s?(o=c=>c.armedKey===s,e[2]=s,e[3]=o):o=e[3];const i=dt(o);let a;e[4]!==s?(a=c=>c.renamingKey===s,e[4]=s,e[5]=a):a=e[5];const l=dt(a);let u;return e[6]!==i||e[7]!==l||e[8]!==r?(u={revealed:r,armed:i,renaming:l},e[6]=i,e[7]=l,e[8]=r,e[9]=u):u=e[9],u},Ca=m.createContext(null),Kh=Ca.Provider,Qs=()=>{const s=m.useContext(Ca);if(!s)throw new Error("useMobileSidebarActions outside MobileSidebarActionsProvider");return s},qn="shadow-[inset_0_0_0_100vmax_color-mix(in_srgb,var(--interactive-selection)_70%,transparent)]",Yr="text-interactive-selection-foreground",Vh={touchAction:"manipulation",minHeight:0,minWidth:0},Us=s=>{const e=re.c(14),{expanded:t,kind:r,label:o,onToggle:i}=s,{t:a}=be();let l;e[0]!==t||e[1]!==r||e[2]!==o||e[3]!==a?(l=r==="session"?a(t?"sessions.sidebar.session.subsessions.collapse":"sessions.sidebar.session.subsessions.expand"):r==="run"?a(t?"sessions.sidebar.run.collapse":"sessions.sidebar.run.expand"):t?a("sessions.sidebar.group.collapseAria",{label:o}):a("sessions.sidebar.group.expandAria",{label:o}),e[0]=t,e[1]=r,e[2]=o,e[3]=a,e[4]=l):l=e[4];const u=l;let c;e[5]!==i?(c=g=>{g.stopPropagation(),i()},e[5]=i,e[6]=c):c=e[6];let d;e[7]!==t?(d=n.jsx(Lr,{expanded:t}),e[7]=t,e[8]=d):d=e[8];let p;return e[9]!==u||e[10]!==t||e[11]!==c||e[12]!==d?(p=n.jsx("button",{type:"button",className:"flex size-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",style:Vh,"aria-label":u,"aria-expanded":t,onClick:c,children:d}),e[9]=u,e[10]=t,e[11]=c,e[12]=d,e[13]=p):p=e[13],p},Qr=s=>{const e=re.c(5),{slotLeft:t,children:r}=s,o=t-9;let i;e[0]!==o?(i={insetInlineStart:o},e[0]=o,e[1]=i):i=e[1];let a;return e[2]!==r||e[3]!==i?(a=n.jsx("span",{className:"absolute inset-y-0 z-10 flex items-center",style:i,children:r}),e[2]=r,e[3]=i,e[4]=a):a=e[4],a},Un=s=>{const e=re.c(19),{indent:t,onSelect:r,ariaLabel:o,chevron:i,firstLine:a,secondLine:l}=s;let u;e[0]!==a?(u=n.jsx("span",{className:"flex h-5 min-w-0 items-center gap-2",children:a}),e[0]=a,e[1]=u):u=e[1];let c;e[2]!==i||e[3]!==l?(c=l||i?n.jsxs("span",{className:"flex h-4 min-w-0 items-center gap-1.5 text-muted-foreground",children:[i?n.jsx("span",{"aria-hidden":!0,className:"size-3.5 shrink-0"}):null,l]}):null,e[2]=i,e[3]=l,e[4]=c):c=e[4];let d;e[5]!==u||e[6]!==c?(d=n.jsxs(n.Fragment,{children:[u,c]}),e[5]=u,e[6]=c,e[7]=d):d=e[7];const p=d;let g;e[8]!==o||e[9]!==t||e[10]!==p||e[11]!==r?(g=r?n.jsx("button",{type:"button",className:ae("flex min-h-9 min-w-0 flex-1 flex-col gap-1 py-1.5 pe-3 text-start","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring"),style:{paddingInlineStart:t,touchAction:"manipulation"},"aria-label":o,onClick:r,children:p}):n.jsx("div",{className:"flex min-h-9 min-w-0 flex-1 flex-col gap-1 py-1.5 pe-3 text-start",style:{paddingInlineStart:t},children:p}),e[8]=o,e[9]=t,e[10]=p,e[11]=r,e[12]=g):g=e[12];let f;e[13]!==i||e[14]!==t?(f=i?n.jsx("span",{className:"absolute z-10 flex h-8 items-center",style:{insetInlineStart:t-9,top:22},children:i}):null,e[13]=i,e[14]=t,e[15]=f):f=e[15];let b;return e[16]!==g||e[17]!==f?(b=n.jsxs("div",{className:"relative flex min-w-0 flex-1",children:[g,f]}),e[16]=g,e[17]=f,e[18]=b):b=e[18],b},Vt=s=>{const e=re.c(13),{icon:t,glyph:r,label:o,revealed:i,onClick:a,tone:l,armed:u,disabled:c}=s,d=l===void 0?"default":l,p=u===void 0?!1:u,g=c===void 0?!1:c,f=i?0:-1,b=d==="destructive"?p?"rounded-lg bg-destructive text-destructive-foreground focus-visible:ring-destructive":"text-[var(--status-error)] active:opacity-80 focus-visible:ring-destructive":d==="success"?"text-status-success active:opacity-80 focus-visible:ring-ring":"text-muted-foreground active:text-foreground focus-visible:ring-ring";let x;e[0]!==b?(x=ae("flex flex-1 items-center justify-center transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset disabled:opacity-40",b),e[0]=b,e[1]=x):x=e[1];let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h={touchAction:"manipulation"},e[2]=h):h=e[2];let v;e[3]!==r||e[4]!==t?(v=r??n.jsx(G,{name:t,className:t==="check"?"size-5":"size-[18px]"}),e[3]=r,e[4]=t,e[5]=v):v=e[5];let w;return e[6]!==g||e[7]!==o||e[8]!==a||e[9]!==f||e[10]!==x||e[11]!==v?(w=n.jsx("button",{type:"button",tabIndex:f,disabled:g,className:x,"aria-label":o,onClick:a,style:h,children:v}),e[6]=g,e[7]=o,e[8]=a,e[9]=f,e[10]=x,e[11]=v,e[12]=w):w=e[12],w},Hh=s=>{const e=re.c(16),{more:t,fewer:r,hiddenNodes:o,indent:i,onShow:a}=s,{t:l}=be();let u;e[0]!==o||e[1]!==a||e[2]!==l?(u=b=>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:()=>a(b),children:[n.jsx(G,{name:b==="more"?"arrow-down-s":"arrow-up-s",className:"size-4"}),n.jsx("span",{className:"typography-micro",children:l(b==="more"?"sessions.sidebar.group.showMore":"sessions.sidebar.group.showFewer")}),b==="more"?n.jsx(lu,{nodes:o}):null]}),e[0]=o,e[1]=a,e[2]=l,e[3]=u):u=e[3];const c=u;let d;e[4]!==i?(d={paddingInlineStart:i},e[4]=i,e[5]=d):d=e[5];let p;e[6]!==c||e[7]!==t?(p=t?c("more"):null,e[6]=c,e[7]=t,e[8]=p):p=e[8];let g;e[9]!==c||e[10]!==r?(g=r?c("fewer"):null,e[9]=c,e[10]=r,e[11]=g):g=e[11];let f;return e[12]!==d||e[13]!==p||e[14]!==g?(f=n.jsxs("div",{className:"flex w-full items-center gap-2",style:d,children:[p,g]}),e[12]=d,e[13]=p,e[14]=g,e[15]=f):f=e[15],f},Na=s=>s.children.flatMap(e=>[e.session.id,...Na(e)]),qh=s=>{const e=re.c(183),{row:t,geometry:r,toggleParent:o}=s,{t:i}=be(),a=Qs(),{node:l,depth:u}=t,c=l.session,d=Rs(c),{revealed:p,armed:g,renaming:f}=jn(t.key);let b;e[0]!==c.title||e[1]!==i?(b=c.title?.trim()||i("mobile.sessions.untitled"),e[0]=c.title,e[1]=i,e[2]=b):b=e[2];const x=b,h=cu(c.id,c.directory,p||f);let v;e[3]!==c.id?(v=Oe=>Oe.currentSessionId===c.id,e[3]=c.id,e[4]=v):v=e[4];const w=nt(v),N=Xe(Uh),_=w&&!N,M=Ao(c.id),E=Po(c.id),j=E!==null,C=!j&&M&&!_,k=Do(c.id,j),L=(j||C)&&k,I=l.children.length>0,A=t.forceExpanded===!0||t.expanded===!0;let R;e[5]!==A||e[6]!==I||e[7]!==l||e[8]!==c.id?(R=I&&!A?[c.id,...Na(l)]:[c.id],e[5]=A,e[6]=I,e[7]=l,e[8]=c.id,e[9]=R):R=e[9];const T=Lh(R),S=!c.parentID,D=Xe(Gh)&&t.ownsWork&&S&&!Ar(d);let $;e[10]!==l||e[11]!==D?($=D?du(l):[],e[10]=l,e[11]=D,e[12]=$):$=e[12];const K=$;let U;e[13]!==D||e[14]!==c||e[15]!==K||e[16]!==i?(U=D?{inWork:K.length>0,onToggle:()=>{Fh(c,K,i)}}:void 0,e[13]=D,e[14]=c,e[15]=K,e[16]=i,e[17]=U):U=e[17];const O=U;let V;e[18]!==d||e[19]!==c.id?(V=Oe=>uc(Oe.ids,d||null,c.id),e[18]=d,e[19]=c.id,e[20]=V):V=e[20];const q=Io(V);let ee;e[21]!==d||e[22]!==q||e[23]!==c||e[24]!==i||e[25]!==S?(ee=S&&d?{pinned:q,onToggle:()=>$h(c,q,i)}:void 0,e[21]=d,e[22]=q,e[23]=c,e[24]=i,e[25]=S,e[26]=ee):ee=e[26];const Z=ee,Y=t.renderContext==="timeline-mixed"||t.renderContext==="mixed-compact",B=kt(Xh)&&Y;let Q;e[27]!==j||e[28]!==c||e[29]!==O?.inWork?(Q=!!O?.inWork&&!j&&dc(c),e[27]=j,e[28]=c,e[29]=O?.inWork,e[30]=Q):Q=e[30];const oe=Q;let X;e[31]!==t.detailed||e[32]!==t.renderContext?(X=t.detailed===!0||uu(t.renderContext),e[31]=t.detailed,e[32]=t.renderContext,e[33]=X):X=e[33];const te=X;let ce;e[34]!==te||e[35]!==t.projectId||e[36]!==t.renderContext?(ce=Oe=>te&&t.renderContext==="timeline-mixed"&&t.projectId?Oe.projects.find(et=>et.id===t.projectId)??null:null,e[34]=te,e[35]=t.projectId,e[36]=t.renderContext,e[37]=ce):ce=e[37];const ue=Mt(ce),H=l.worktree?.branch??null;let ne;e[38]!==t.secondaryMeta||e[39]!==H?(ne=fu(t.secondaryMeta,H),e[38]=t.secondaryMeta,e[39]=H,e[40]=ne):ne=e[40];const Te=ne,{refLines:se}=mu(c,l.worktree,!1),xe=se[0]??null,pe=Math.max(0,se.length-1);let ke;e[41]!==pe||e[42]!==xe||e[43]!==se?(ke=Oe=>xe?n.jsxs("span",{role:"img","aria-label":se.map(Jh).join(", "),className:"inline-flex shrink-0 items-center gap-0.5 typography-micro text-muted-foreground",children:[n.jsx(G,{name:xe.icon,className:ae("size-3",xe.color&&"oc-ref-tint"),style:xe.color?yr(xe.color):void 0}),Oe?n.jsx("span",{className:"leading-none tabular-nums",children:xe.label}):null,Oe&&pe>0?n.jsxs("span",{className:"leading-none tabular-nums text-muted-foreground",children:["+",pe]}):null]}):null,e[41]=pe,e[42]=xe,e[43]=se,e[44]=ke):ke=e[44];const Ee=ke,ye=t.secondaryMeta?.inSpace===!0;let ge;e[45]!==I||e[46]!==t.archived||e[47]!==t.forceExpanded||e[48]!==t.renderContext||e[49]!==c.id||e[50]!==o?(ge=I&&!t.forceExpanded?()=>o(pu(t.renderContext,t.archived,c.id)):void 0,e[45]=I,e[46]=t.archived,e[47]=t.forceExpanded,e[48]=t.renderContext,e[49]=c.id,e[50]=o,e[51]=ge):ge=e[51];const we=ge;let ve;e[52]!==t.key?(ve=Oe=>dt.getState().setRevealed(t.key,Oe),e[52]=t.key,e[53]=ve):ve=e[53];const W=ve;let de;e[54]!==a||e[55]!==p||e[56]!==t.projectId||e[57]!==c||e[58]!==W?(de=()=>{if(p){W(!1);return}zh(c,t.projectId,a.close)},e[54]=a,e[55]=p,e[56]=t.projectId,e[57]=c,e[58]=W,e[59]=de):de=e[59];const Ne=de,Ie=Yh,_e=T.hasPermission||T.hasForm;let Fe;e[60]!==h.pending||e[61]!==j||e[62]!==C||e[63]!==i||e[64]!==E||e[65]!==_e?(Fe=h.pending?n.jsx(G,{name:"loader-4",className:"size-3 shrink-0 animate-spin text-status-info","aria-label":i("sessions.aiRename.generating")}):(j||C)&&!_e?n.jsx(Oo,{state:E??"unread"}):null,e[60]=h.pending,e[61]=j,e[62]=C,e[63]=i,e[64]=E,e[65]=_e,e[66]=Fe):Fe=e[66];const Ve=Fe;let He;e[67]!==j||e[68]!==c.id||e[69]!==L||e[70]!==_e?(He=L&&!_e?n.jsx(Dr,{sessionId:c.id,running:j,className:"shrink-0 typography-micro"}):null,e[67]=j,e[68]=c.id,e[69]=L,e[70]=_e,e[71]=He):He=e[71];const Je=He;let fe;e[72]!==q||e[73]!==B||e[74]!==i?(fe=q&&!B?n.jsx(G,{name:"pushpin",className:"size-3 shrink-0 text-muted-foreground","aria-label":i("sessions.sidebar.session.status.pinned")}):null,e[72]=q,e[73]=B,e[74]=i,e[75]=fe):fe=e[75];const Be=fe;let J;e[76]!==oe||e[77]!==i?(J=oe?n.jsx(G,{name:"check",className:"size-3.5 shrink-0 text-muted-foreground","aria-label":i("sessions.sidebar.session.work.doneSuggested")}):null,e[76]=oe,e[77]=i,e[78]=J):J=e[78];const me=J;let $e;e[79]!==_||e[80]!==j||e[81]!==T||e[82]!==C?($e=ae("block min-w-0 flex-1 truncate oc-ui-start-align typography-ui-label",Mh({active:_,unread:C,running:j,pending:T})),e[79]=_,e[80]=j,e[81]=T,e[82]=C,e[83]=$e):$e=e[83];let lt;e[84]!==$e||e[85]!==x?(lt=n.jsx("span",{dir:"auto",className:$e,children:x}),e[84]=$e,e[85]=x,e[86]=lt):lt=e[86];const qe=lt;let ot;e[87]!==h||e[88]!==c.id||e[89]!==i||e[90]!==x?(ot=(Oe,et)=>n.jsx(Jr,{initialTitle:x,indent:Oe,aiRename:h,className:et,onSubmit:tt=>{Ie(),Wh(c.id,tt,i)},onCancel:Ie}),e[87]=h,e[88]=c.id,e[89]=i,e[90]=x,e[91]=ot):ot=e[91];const Ze=ot;let xt;if(te){let Oe;e[92]!==ue?(Oe=ue?n.jsx(Ys,{project:ue,size:"xs"}):null,e[92]=ue,e[93]=Oe):Oe=e[93];const et=Oe;let tt;e[94]!==u||e[95]!==r?(tt=r.detailedLeft(u),e[94]=u,e[95]=r,e[96]=tt):tt=e[96];const mt=f?void 0:Ne;let Me;e[97]!==A||e[98]!==x||e[99]!==we?(Me=we?n.jsx(Us,{expanded:A,label:x,kind:"session",onToggle:we}):null,e[97]=A,e[98]=x,e[99]=we,e[100]=Me):Me=e[100];let pt;e[101]!==me||e[102]!==Ve||e[103]!==Be||e[104]!==Ze||e[105]!==f||e[106]!==Je||e[107]!==qe?(pt=f?Ze(0,"h-[1lh] pe-0 typography-ui-label [&_button]:size-6 [&_button>svg]:size-3.5"):n.jsxs(n.Fragment,{children:[qe,Be,me,Ve,Je]}),e[101]=me,e[102]=Ve,e[103]=Be,e[104]=Ze,e[105]=f,e[106]=Je,e[107]=qe,e[108]=pt):pt=e[108];let vt;e[109]!==Te||e[110]!==ye||e[111]!==et||e[112]!==T||e[113]!==xe||e[114]!==ue||e[115]!==Ee||e[116]!==c||e[117]!==i||e[118]!==_e?(vt=ue||Te||Ko(c)||xe||_e?n.jsxs(n.Fragment,{children:[et,Te?n.jsxs(n.Fragment,{children:[ye?n.jsx(G,{name:"instance",className:"size-3.5 shrink-0","aria-hidden":!1,role:"img","aria-label":i("sessions.sidebar.group.space")}):n.jsx(G,{name:"git-branch",className:"size-3.5 shrink-0"}),n.jsx("span",{className:"block min-w-0 truncate typography-micro",children:Te})]}):null,n.jsxs("span",{className:"ms-auto flex shrink-0 items-center gap-1.5",children:[n.jsx(Qi,{session:c}),Ee(!0),n.jsx(Zi,{...T})]})]}):null,e[109]=Te,e[110]=ye,e[111]=et,e[112]=T,e[113]=xe,e[114]=ue,e[115]=Ee,e[116]=c,e[117]=i,e[118]=_e,e[119]=vt):vt=e[119];let Ye;e[120]!==tt||e[121]!==mt||e[122]!==Me||e[123]!==pt||e[124]!==vt?(Ye=n.jsx(Un,{indent:tt,onSelect:mt,chevron:Me,firstLine:pt,secondLine:vt}),e[120]=tt,e[121]=mt,e[122]=Me,e[123]=pt,e[124]=vt,e[125]=Ye):Ye=e[125],xt=Ye}else{let Oe;e[126]!==u||e[127]!==A||e[128]!==r||e[129]!==x||e[130]!==we?(Oe=we?n.jsx(Qr,{slotLeft:r.slotLeft(u),children:n.jsx(Us,{expanded:A,label:x,kind:"session",onToggle:we})}):null,e[126]=u,e[127]=A,e[128]=r,e[129]=x,e[130]=we,e[131]=Oe):Oe=e[131];let et;e[132]!==u||e[133]!==me||e[134]!==r||e[135]!==Ve||e[136]!==T||e[137]!==Be||e[138]!==Ee||e[139]!==Ze||e[140]!==f||e[141]!==Ne||e[142]!==c||e[143]!==Je||e[144]!==qe?(et=f?Ze(r.textLeft(u)):n.jsxs("button",{type:"button",className:"flex h-9 min-w-0 flex-1 items-center gap-2.5 pe-3.5 text-start focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",style:{paddingInlineStart:r.textLeft(u),touchAction:"manipulation"},onClick:Ne,children:[qe,n.jsx(Qi,{session:c}),Ee(!1),n.jsx(Zi,{...T}),Be,me,Ve,Je]}),e[132]=u,e[133]=me,e[134]=r,e[135]=Ve,e[136]=T,e[137]=Be,e[138]=Ee,e[139]=Ze,e[140]=f,e[141]=Ne,e[142]=c,e[143]=Je,e[144]=qe,e[145]=et):et=e[145];let tt;e[146]!==Oe||e[147]!==et?(tt=n.jsxs(n.Fragment,{children:[Oe,et]}),e[146]=Oe,e[147]=et,e[148]=tt):tt=e[148],xt=tt}const Dt=Ah+(O?As:0)+(Z?As:0),Rt=_&&qn;let We;e[149]!==Rt?(We=ae("relative flex w-full items-center bg-background transition-colors",Rt),e[149]=Rt,e[150]=We):We=e[150];let st;e[151]!==c||e[152]!==W||e[153]!==i?(st=()=>{W(!1),to("archive",c,i)},e[151]=c,e[152]=W,e[153]=i,e[154]=st):st=e[154];let ut;e[155]!==t.key?(ut=()=>dt.getState().arm(t.key),e[155]=t.key,e[156]=ut):ut=e[156];let at;e[157]!==c||e[158]!==W||e[159]!==i?(at=()=>{W(!1),to("delete",c,i)},e[157]=c,e[158]=W,e[159]=i,e[160]=at):at=e[160];let ft;e[161]!==t.key?(ft=()=>dt.getState().startRename(t.key),e[161]=t.key,e[162]=ft):ft=e[162];let yt;e[163]!==g||e[164]!==Z||e[165]!==p||e[166]!==c.id||e[167]!==W||e[168]!==st||e[169]!==ut||e[170]!==at||e[171]!==ft||e[172]!==x||e[173]!==O?(yt=n.jsx(Dh,{sessionId:c.id,title:x,revealed:p,confirmingDelete:g,onArchive:st,onRequestDelete:ut,onConfirmDelete:at,onRequestRename:ft,onRevealedChange:W,work:O,pin:Z}),e[163]=g,e[164]=Z,e[165]=p,e[166]=c.id,e[167]=W,e[168]=st,e[169]=ut,e[170]=at,e[171]=ft,e[172]=x,e[173]=O,e[174]=yt):yt=e[174];let Et;return e[175]!==_||e[176]!==xt||e[177]!==p||e[178]!==W||e[179]!==Dt||e[180]!==We||e[181]!==yt?(Et=n.jsx(wn,{actionsWidth:Dt,revealed:p,onRevealedChange:W,dataActiveSession:_,contentClassName:We,actions:yt,children:xt}),e[175]=_,e[176]=xt,e[177]=p,e[178]=W,e[179]=Dt,e[180]=We,e[181]=yt,e[182]=Et):Et=e[182],Et};function Uh(s){return s.runOverviewKey!==null}function Gh(s){return s.sessionWorkEnabled}function Xh(s){return s.showPinnedSection}function Jh(s){return s.text}function Yh(){return dt.getState().stopRename()}const Ra="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",Gn=()=>{const s=dt.getState();return s.revealedKey?(s.setRevealed(s.revealedKey,!1),!0):!1},Ea=s=>{const e=re.c(20),{label:t,collapsed:r,forceExpanded:o,onToggle:i}=s,{t:a}=be();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=ae(Ra,"w-full gap-1"),e[0]=l):l=e[0];let u;e[1]!==i?(u=()=>{Gn()||i()},e[1]=i,e[2]=u):u=e[2];const c=!r;let d;e[3]!==r||e[4]!==t||e[5]!==a?(d=r?a("sessions.sidebar.group.expandAria",{label:t}):a("sessions.sidebar.group.collapseAria",{label:t}),e[3]=r,e[4]=t,e[5]=a,e[6]=d):d=e[6];let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p={touchAction:"manipulation"},e[7]=p):p=e[7];let g;e[8]!==t?(g=n.jsx("span",{className:"min-w-0 truncate typography-ui-label font-medium text-muted-foreground",children:t}),e[8]=t,e[9]=g):g=e[9];let f;e[10]!==r||e[11]!==o?(f=o?null:n.jsx(G,{name:r?"arrow-right-s":"arrow-down-s",className:"size-4 shrink-0 text-muted-foreground"}),e[10]=r,e[11]=o,e[12]=f):f=e[12];let b;return e[13]!==o||e[14]!==u||e[15]!==c||e[16]!==d||e[17]!==g||e[18]!==f?(b=n.jsxs("button",{type:"button",className:l,disabled:o,onClick:u,"aria-expanded":c,"aria-label":d,style:p,children:[g,f]}),e[13]=o,e[14]=u,e[15]=c,e[16]=d,e[17]=g,e[18]=f,e[19]=b):b=e[19],b},Qh=s=>{const e=re.c(9),{row:t,onToggle:r}=s,{t:o}=be();let i;e[0]!==t.activityKey||e[1]!==t.label||e[2]!==o?(i=t.label??(hu(t.activityKey)?o(gu[t.activityKey]):""),e[0]=t.activityKey,e[1]=t.label,e[2]=o,e[3]=i):i=e[3];let a;return e[4]!==r||e[5]!==t.collapsed||e[6]!==t.forceExpanded||e[7]!==i?(a=n.jsx(Ea,{label:i,collapsed:t.collapsed,forceExpanded:t.forceExpanded,onToggle:r}),e[4]=r,e[5]=t.collapsed,e[6]=t.forceExpanded,e[7]=i,e[8]=a):a=e[8],a},Zh=s=>{const e=re.c(8),{row:t,onToggle:r}=s,{t:o}=be();let i;e[0]!==t.label||e[1]!==o?(i=t.label??o("sessions.sidebar.activity.projectsTitle"),e[0]=t.label,e[1]=o,e[2]=i):i=e[2];let a;return e[3]!==r||e[4]!==t.collapsed||e[5]!==t.forceExpanded||e[6]!==i?(a=n.jsx(Ea,{label:i,collapsed:t.collapsed,forceExpanded:t.forceExpanded,onToggle:r}),e[3]=r,e[4]=t.collapsed,e[5]=t.forceExpanded,e[6]=i,e[7]=a):a=e[7],a},so=s=>{const e=re.c(10),{icon:t,label:r,onClick:o}=s;let i;e[0]!==o?(i=d=>{d.stopPropagation(),o()},e[0]=o,e[1]=i):i=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a={touchAction:"manipulation"},e[2]=a):a=e[2];const l=t==="add"?"size-4":"size-3.5";let u;e[3]!==t||e[4]!==l?(u=n.jsx(G,{name:t,className:l}),e[3]=t,e[4]=l,e[5]=u):u=e[5];let c;return e[6]!==r||e[7]!==i||e[8]!==u?(c=n.jsx("button",{type:"button",className:"flex size-9 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":r,title:r,onClick:i,style:a,children:u}),e[6]=r,e[7]=i,e[8]=u,e[9]=c):c=e[9],c},e1=s=>{const e=re.c(71),{row:t,label:r,isRepo:o,active:i,onToggle:a,onNewSession:l,onRemove:u}=s,{t:c}=be(),d=Qs(),p=t.section.project,{revealed:g,armed:f}=jn(t.key);let b;e[0]!==t.key?(b=K=>dt.getState().setRevealed(t.key,K),e[0]=t.key,e[1]=b):b=e[1];const x=b;let h;e[2]!==f||e[3]!==r||e[4]!==c?(h=f?c("mobile.sessions.confirmRemoveProjectAria",{label:r}):c("mobile.sessions.removeProjectAria",{label:r}),e[2]=f,e[3]=r,e[4]=c,e[5]=h):h=e[5];let v;e[6]!==f||e[7]!==r||e[8]!==u||e[9]!==t.key||e[10]!==x||e[11]!==c?(v=()=>{if(!f){dt.getState().arm(t.key);return}x(!1),u(),he.success(c("mobile.sessions.toast.projectRemoved",{label:r}))},e[6]=f,e[7]=r,e[8]=u,e[9]=t.key,e[10]=x,e[11]=c,e[12]=v):v=e[12];let w;e[13]!==f||e[14]!==g||e[15]!==h||e[16]!==v?(w=n.jsx(Vt,{icon:"delete-bin",tone:"destructive",armed:f,label:h,revealed:g,onClick:v}),e[13]=f,e[14]=g,e[15]=h,e[16]=v,e[17]=w):w=e[17];let N;e[18]!==r||e[19]!==c?(N=c("mobile.sessions.editProjectAria",{label:r}),e[18]=r,e[19]=c,e[20]=N):N=e[20];let _;e[21]!==d||e[22]!==p.id||e[23]!==x?(_=()=>{x(!1),d.openProjectEdit(p.id)},e[21]=d,e[22]=p.id,e[23]=x,e[24]=_):_=e[24];let M;e[25]!==g||e[26]!==N||e[27]!==_?(M=n.jsx(Vt,{icon:"edit",label:N,revealed:g,onClick:_}),e[25]=g,e[26]=N,e[27]=_,e[28]=M):M=e[28];let E;e[29]!==w||e[30]!==M?(E=n.jsxs(n.Fragment,{children:[w,M]}),e[29]=w,e[30]=M,e[31]=E):E=e[31];const j=i||void 0;let C;e[32]!==a||e[33]!==t.forceExpanded?(C=()=>{!Gn()&&!t.forceExpanded&&a()},e[32]=a,e[33]=t.forceExpanded,e[34]=C):C=e[34];const k=!t.collapsed;let L;e[35]!==r||e[36]!==t.collapsed||e[37]!==c?(L=t.collapsed?c("sessions.sidebar.group.expandAria",{label:r}):c("sessions.sidebar.group.collapseAria",{label:r}),e[35]=r,e[36]=t.collapsed,e[37]=c,e[38]=L):L=e[38];let I;e[39]===Symbol.for("react.memo_cache_sentinel")?(I={touchAction:"manipulation"},e[39]=I):I=e[39];let A;e[40]!==p?(A=n.jsx(Ys,{project:p,size:"xs"}),e[40]=p,e[41]=A):A=e[41];let R;e[42]!==r?(R=n.jsx("span",{className:"block min-w-0 flex-1 truncate ps-1 typography-ui-label font-medium text-foreground",children:r}),e[42]=r,e[43]=R):R=e[43];let F;e[44]!==C||e[45]!==k||e[46]!==L||e[47]!==A||e[48]!==R?(F=n.jsxs("button",{type:"button",className:Ra,onClick:C,"aria-expanded":k,"aria-label":L,style:I,children:[A,R]}),e[44]=C,e[45]=k,e[46]=L,e[47]=A,e[48]=R,e[49]=F):F=e[49];let T;e[50]!==d||e[51]!==o||e[52]!==p.id||e[53]!==c?(T=o?n.jsx(so,{icon:"git-branch",label:c("sessions.sidebar.project.actions.newWorktree"),onClick:()=>d.openNewWorktree(p.id)}):null,e[50]=d,e[51]=o,e[52]=p.id,e[53]=c,e[54]=T):T=e[54];let S;e[55]!==r||e[56]!==c?(S=c("mobile.sessions.newSessionInProjectAria",{label:r}),e[55]=r,e[56]=c,e[57]=S):S=e[57];let P;e[58]!==l||e[59]!==S?(P=n.jsx(so,{icon:"add",label:S,onClick:l}),e[58]=l,e[59]=S,e[60]=P):P=e[60];let D;e[61]!==F||e[62]!==T||e[63]!==P||e[64]!==j?(D=n.jsxs("div",{"data-active-project":j,className:"flex min-h-10 w-full items-center",children:[F,T,P]}),e[61]=F,e[62]=T,e[63]=P,e[64]=j,e[65]=D):D=e[65];let $;return e[66]!==g||e[67]!==x||e[68]!==D||e[69]!==E?($=n.jsx(wn,{actionsWidth:2*As,revealed:g,onRevealedChange:x,actions:E,children:D}),e[66]=g,e[67]=x,e[68]=D,e[69]=E,e[70]=$):$=e[70],$},t1=s=>{const e=re.c(28),{row:t,geometry:r,onToggle:o}=s,{t:i}=be(),a=t.group.label,l=t.forceExpanded||!t.collapsed;let u;e[0]!==o||e[1]!==t.empty||e[2]!==t.forceExpanded||e[3]!==t.groupKey?(u=()=>{!Gn()&&!t.empty&&!t.forceExpanded&&o(t.groupKey)},e[0]=o,e[1]=t.empty,e[2]=t.forceExpanded,e[3]=t.groupKey,e[4]=u):u=e[4];const c=t.empty?void 0:l;let d;e[5]!==l||e[6]!==a||e[7]!==t.empty||e[8]!==i?(d=t.empty?a:l?i("sessions.sidebar.group.collapseAria",{label:a}):i("sessions.sidebar.group.expandAria",{label:a}),e[5]=l,e[6]=a,e[7]=t.empty,e[8]=i,e[9]=d):d=e[9];let p;e[10]!==r||e[11]!==t.depth?(p=r.slotLeft(t.depth),e[10]=r,e[11]=t.depth,e[12]=p):p=e[12];let g;e[13]!==p?(g={paddingInlineStart:p,touchAction:"manipulation"},e[13]=p,e[14]=g):g=e[14];let f;e[15]!==l||e[16]!==t.empty?(f=t.empty?n.jsx("span",{"aria-hidden":!0,className:"size-3.5 shrink-0"}):n.jsx(Lr,{expanded:l}),e[15]=l,e[16]=t.empty,e[17]=f):f=e[17];let b;e[18]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx(G,{name:"folder",className:"mx-px size-3 shrink-0 text-muted-foreground"}),e[18]=b):b=e[18];let x;e[19]!==a?(x=n.jsx("span",{className:"block min-w-0 flex-1 truncate typography-ui-label font-medium oc-group-label",children:a}),e[19]=a,e[20]=x):x=e[20];let h;return e[21]!==u||e[22]!==c||e[23]!==d||e[24]!==g||e[25]!==f||e[26]!==x?(h=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:u,"aria-expanded":c,"aria-label":d,style:g,children:[f,b,x]}),e[21]=u,e[22]=c,e[23]=d,e[24]=g,e[25]=f,e[26]=x,e[27]=h):h=e[27],h},s1=s=>{const e=re.c(35),{row:t,geometry:r}=s,{t:o}=be(),i=t.forceExpanded||!t.collapsed;let a;e[0]!==t.mixed||e[1]!==t.projectId?(a=N=>t.mixed?N.projects.find(_=>_.id===t.projectId):void 0,e[0]=t.mixed,e[1]=t.projectId,e[2]=a):a=e[2];const l=Mt(a);let u;e[3]!==t.empty||e[4]!==t.folder||e[5]!==t.forceExpanded?(u=()=>{!Gn()&&!t.empty&&!t.forceExpanded&&mc.getState().toggleFolderCollapse(t.folder.id)},e[3]=t.empty,e[4]=t.folder,e[5]=t.forceExpanded,e[6]=u):u=e[6];const c=t.empty?void 0:i;let d;e[7]!==i||e[8]!==t.displayName||e[9]!==t.empty||e[10]!==o?(d=t.empty?t.displayName:i?o("sessions.sidebar.folderItem.collapseAria",{folderName:t.displayName}):o("sessions.sidebar.folderItem.expandAria",{folderName:t.displayName}),e[7]=i,e[8]=t.displayName,e[9]=t.empty,e[10]=o,e[11]=d):d=e[11];let p;e[12]!==r||e[13]!==t.depth?(p=r.slotLeft(t.depth),e[12]=r,e[13]=t.depth,e[14]=p):p=e[14];let g;e[15]!==p?(g={paddingInlineStart:p,touchAction:"manipulation"},e[15]=p,e[16]=g):g=e[16];let f;e[17]!==i||e[18]!==t.empty?(f=t.empty?n.jsx("span",{"aria-hidden":!0,className:"size-3.5 shrink-0"}):n.jsx(Lr,{expanded:i}),e[17]=i,e[18]=t.empty,e[19]=f):f=e[19];const b=i&&!t.empty?"folder-open":"folder";let x;e[20]!==b?(x=n.jsx(G,{name:b,className:"mx-px size-3 shrink-0 text-muted-foreground"}),e[20]=b,e[21]=x):x=e[21];let h;e[22]!==t.displayName?(h=n.jsx("span",{className:"block min-w-0 flex-1 truncate typography-ui-label font-medium oc-group-label",children:t.displayName}),e[22]=t.displayName,e[23]=h):h=e[23];let v;e[24]!==l?(v=l?n.jsx("span",{className:"min-w-0 shrink-[2] truncate typography-micro text-muted-foreground",children:fc(l.label?.trim()||l.path)}):null,e[24]=l,e[25]=v):v=e[25];let w;return e[26]!==h||e[27]!==v||e[28]!==u||e[29]!==c||e[30]!==d||e[31]!==g||e[32]!==f||e[33]!==x?(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:u,"aria-expanded":c,"aria-label":d,style:g,children:[f,x,h,v]}),e[26]=h,e[27]=v,e[28]=u,e[29]=c,e[30]=d,e[31]=g,e[32]=f,e[33]=x,e[34]=w):w=e[34],w},n1=s=>{const e=re.c(23),{row:t,indent:r,onRetry:o,onGrantAccess:i}=s,{t:a}=be();let l;e[0]!==t.status.state||e[1]!==a?(l=t.status.state==="permission-denied"?a("sessions.sidebar.group.empty.permissionDenied"):t.status.state==="load-failed"?a("sessions.sidebar.group.empty.loadFailed"):t.status.state==="initialization-failed"?a("sessions.sidebar.group.empty.initializationFailed"):a("sessions.sidebar.group.empty.loadingSessions"),e[0]=t.status.state,e[1]=a,e[2]=l):l=e[2];const u=l;let c;e[3]!==r?(c={paddingInlineStart:r},e[3]=r,e[4]=c):c=e[4];let d;e[5]!==t.status.state?(d=t.status.state==="loading"?n.jsx(Vo,{className:"size-3"}):null,e[5]=t.status.state,e[6]=d):d=e[6];let p;e[7]!==u?(p=n.jsx("span",{children:u}),e[7]=u,e[8]=p):p=e[8];let g;e[9]!==i||e[10]!==t.status.canGrantAccess||e[11]!==a?(g=t.status.canGrantAccess?n.jsx(Ae,{variant:"link",size:"xs",className:"h-auto p-0 typography-micro",onClick:i,children:a("sessions.sidebar.group.empty.grantAccess")}):null,e[9]=i,e[10]=t.status.canGrantAccess,e[11]=a,e[12]=g):g=e[12];let f;e[13]!==o||e[14]!==t.status.state||e[15]!==a?(f=t.status.state!=="loading"?n.jsx(Ae,{variant:"link",size:"xs",className:"h-auto p-0 typography-micro",onClick:o,children:a("sessions.sidebar.group.empty.retry")}):null,e[13]=o,e[14]=t.status.state,e[15]=a,e[16]=f):f=e[16];let b;return e[17]!==c||e[18]!==d||e[19]!==p||e[20]!==g||e[21]!==f?(b=n.jsxs("div",{className:"flex min-h-9 flex-wrap items-center gap-2 py-1 pe-3 typography-micro text-muted-foreground",style:c,children:[d,p,g,f]}),e[17]=c,e[18]=d,e[19]=p,e[20]=g,e[21]=f,e[22]=b):b=e[22],b},r1=4,no=s=>{const e=re.c(4),{providerIDs:t}=s;let r;e[0]!==t?(r=t.slice(0,r1).map(i1),e[0]=t,e[1]=r):r=e[1];let o;return e[2]!==r?(o=n.jsx("span",{className:"inline-flex shrink-0 items-center -space-x-1",children:r}),e[2]=r,e[3]=o):o=e[3],o};function i1(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(pc,{providerId:s,className:"size-3 opacity-80"})},s)}const Zr="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",ei=(s,e)=>{const t=re.c(3);let r;return t[0]!==s||t[1]!==e?(r=o=>e&&s?o.projects.find(i=>i.id===s)??null:null,t[0]=s,t[1]=e,t[2]=r):r=t[2],Mt(r)},ti=s=>{const e=re.c(5),{slotLeft:t,children:r}=s;let o;e[0]!==t?(o={insetInlineStart:t},e[0]=t,e[1]=o):o=e[1];let i;return e[2]!==r||e[3]!==o?(i=n.jsx("span",{className:"pointer-events-none absolute inset-y-0 z-10 flex w-3.5 items-center justify-center",style:o,children:r}),e[2]=r,e[3]=o,e[4]=i):i=e[4],i},o1=s=>{const e=re.c(175),{row:t,geometry:r,onToggle:o}=s,{t:i}=be(),a=Qs(),{revealed:l,renaming:u}=jn(t.key);let c;e[0]!==a.close||e[1]!==t.collapsed||e[2]!==t.group||e[3]!==t.projectId?(c={group:t.group,projectId:t.projectId,collapsed:t.collapsed,onNavigate:a.close},e[0]=a.close,e[1]=t.collapsed,e[2]=t.group,e[3]=t.projectId,e[4]=c):c=e[4];const d=yu(c),{worktree:p,space:g,spaceName:f,project:b,refs:x,label:h,secondName:v,branch:w,title:N,inWork:_,selected:M,finishing:E,worktreeRemoving:j,activityState:C}=d,k=ei(t.projectId,t.mixed&&t.detailed),L=!t.empty,I=t.forceExpanded||!t.collapsed;let A;e[5]!==L||e[6]!==o||e[7]!==t.forceExpanded||e[8]!==t.groupKey?(A=L&&!t.forceExpanded?()=>o(t.groupKey):void 0,e[5]=L,e[6]=o,e[7]=t.forceExpanded,e[8]=t.groupKey,e[9]=A):A=e[9];const R=A;let F;e[10]!==t.key?(F=fe=>dt.getState().setRevealed(t.key,fe),e[10]=t.key,e[11]=F):F=e[11];const T=F;let S;e[12]!==T?(S=fe=>()=>{T(!1),fe()},e[12]=T,e[13]=S):S=e[13];const P=S;let D;e[14]!==l||e[15]!==T||e[16]!==d?(D=()=>{if(l){T(!1);return}d.open()},e[14]=l,e[15]=T,e[16]=d,e[17]=D):D=e[17];const $=D,K=c1;let U;e[18]!==C||e[19]!==E||e[20]!==j?(U=j||E?n.jsx(Vo,{className:"size-3"}):C?n.jsx(Jo,{state:C}):null,e[18]=C,e[19]=E,e[20]=j,e[21]=U):U=e[21];const O=U;let V;e[22]!==x.prColor||e[23]!==g||e[24]!==i?(V=g?n.jsx(G,{name:"instance",className:"size-3.5 shrink-0 text-muted-foreground","aria-hidden":!1,role:"img","aria-label":i("sessions.sidebar.group.space")}):n.jsx(G,{name:"git-branch",className:ae("size-3.5 shrink-0",x.prColor?"oc-ref-tint":"text-muted-foreground"),style:x.prColor?yr(x.prColor):void 0,"aria-hidden":!1,role:"img","aria-label":i("sessions.sidebar.work.worktreeMark")}),e[22]=x.prColor,e[23]=g,e[24]=i,e[25]=V):V=e[25];const q=V;let ee;e[26]!==d.durationSessionId||e[27]!==d.runningSessionId?(ee=d.durationSessionId?n.jsx(Dr,{sessionId:d.durationSessionId,running:!!d.runningSessionId,className:"shrink-0 typography-micro"}):null,e[26]=d.durationSessionId,e[27]=d.runningSessionId,e[28]=ee):ee=e[28];const Z=ee;let Y;if(e[29]!==x.prColor||e[30]!==x.prReference||e[31]!==x.prSummary||e[32]!==x.primaryIssue||e[33]!==t.detailed){const fe=x.prSummary?{icon:"git-pull-request",color:x.prColor,text:x.prReference}:x.primaryIssue?{icon:x.primaryIssue.icon,color:x.primaryIssue.color,text:x.primaryIssue.label}:null;Y=fe?n.jsxs("span",{className:"inline-flex shrink-0 items-center gap-0.5 typography-micro text-muted-foreground",children:[n.jsx(G,{name:fe.icon,className:ae("size-3",fe.color&&"oc-ref-tint"),style:fe.color?yr(fe.color):void 0}),t.detailed&&fe.text?n.jsx("span",{className:"leading-none tabular-nums",children:fe.text}):null]}):null,e[29]=x.prColor,e[30]=x.prReference,e[31]=x.prSummary,e[32]=x.primaryIssue,e[33]=t.detailed,e[34]=Y}else Y=e[34];const B=Y,Q=M?Yr:C==="unread"||C==="permission"||C==="form"?"font-semibold text-foreground":C==="active"?"text-foreground":"oc-title-rest";let oe;e[35]!==Q?(oe=ae("block min-w-0 flex-1 truncate oc-ui-start-align typography-ui-label",Q),e[35]=Q,e[36]=oe):oe=e[36];let X;e[37]!==h||e[38]!==oe?(X=n.jsx("span",{dir:"auto",className:oe,children:h}),e[37]=h,e[38]=oe,e[39]=X):X=e[39];const te=X;let ce;e[40]!==w||e[41]!==f||e[42]!==i||e[43]!==N||e[44]!==d?(ce=(fe,Be)=>n.jsx(Jr,{initialTitle:N??"",indent:fe,className:Be,placeholder:w??f??i("sessions.sidebar.work.rename.placeholder"),onSubmit:J=>{K(),d.saveTitle(J)},onCancel:K}),e[40]=w,e[41]=f,e[42]=i,e[43]=N,e[44]=d,e[45]=ce):ce=e[45];const ue=ce;let H;e[46]!==g||e[47]!==i||e[48]!==p?.worktreeStatus?(H=p?.worktreeStatus==="missing"?n.jsx("span",{className:"inline-flex shrink-0 items-center text-status-warning",role:"img","aria-label":i("sessions.sidebar.group.worktreeMissing"),children:n.jsx(G,{name:"alert",className:"size-3"})}):g?n.jsx(bc,{spaceId:g.id}):null,e[46]=g,e[47]=i,e[48]=p?.worktreeStatus,e[49]=H):H=e[49];const ne=H;let Te;e[50]!==t.group.directory?(Te=t.group.directory?n.jsx(vu,{directory:t.group.directory}):null,e[50]=t.group.directory,e[51]=Te):Te=e[51];const se=Te,xe=kt(d1);let pe;e[52]!==xe||e[53]!==i||e[54]!==d.pinned?(pe=d.pinned&&!xe?n.jsx(G,{name:"pushpin",className:"size-3 shrink-0 text-muted-foreground","aria-label":i("sessions.sidebar.session.status.pinned")}):null,e[52]=xe,e[53]=i,e[54]=d.pinned,e[55]=pe):pe=e[55];const ke=pe;let Ee;if(t.detailed){let fe;e[56]!==r||e[57]!==t.depth?(fe=r.detailedLeft(t.depth),e[56]=r,e[57]=t.depth,e[58]=fe):fe=e[58];const Be=u?void 0:$;let J;e[59]!==h||e[60]!==i?(J=i("sessions.sidebar.work.openAria",{label:h}),e[59]=h,e[60]=i,e[61]=J):J=e[61];let me;e[62]!==I||e[63]!==h||e[64]!==R?(me=R?n.jsx(Us,{expanded:I,kind:"work",label:h,onToggle:R}):null,e[62]=I,e[63]=h,e[64]=R,e[65]=me):me=e[65];let $e;e[66]!==se||e[67]!==Z||e[68]!==ne||e[69]!==ke||e[70]!==ue||e[71]!==u||e[72]!==O||e[73]!==te?($e=u?ue(0,"h-[1lh] pe-0 typography-ui-label [&_button]:size-6 [&_button>svg]:size-3.5"):n.jsxs(n.Fragment,{children:[te,ne,ke,se,O,Z]}),e[66]=se,e[67]=Z,e[68]=ne,e[69]=ke,e[70]=ue,e[71]=u,e[72]=O,e[73]=te,e[74]=$e):$e=e[74];let lt;e[75]!==k?(lt=k?n.jsx(Ys,{project:k,size:"xs"}):null,e[75]=k,e[76]=lt):lt=e[76];let qe;e[77]!==v?(qe=v?n.jsx("span",{dir:"auto",className:"block min-w-0 truncate typography-micro",children:v}):null,e[77]=v,e[78]=qe):qe=e[78];let ot;e[79]!==B?(ot=n.jsx("span",{className:"ms-auto flex shrink-0 items-center",children:B}),e[79]=B,e[80]=ot):ot=e[80];let Ze;e[81]!==q||e[82]!==lt||e[83]!==qe||e[84]!==ot?(Ze=n.jsxs(n.Fragment,{children:[lt,q,qe,ot]}),e[81]=q,e[82]=lt,e[83]=qe,e[84]=ot,e[85]=Ze):Ze=e[85];let xt;e[86]!==fe||e[87]!==Be||e[88]!==J||e[89]!==me||e[90]!==$e||e[91]!==Ze?(xt=n.jsx(Un,{indent:fe,onSelect:Be,ariaLabel:J,chevron:me,firstLine:$e,secondLine:Ze}),e[86]=fe,e[87]=Be,e[88]=J,e[89]=me,e[90]=$e,e[91]=Ze,e[92]=xt):xt=e[92],Ee=xt}else{let fe;e[93]!==q||e[94]!==I||e[95]!==r||e[96]!==h||e[97]!==t.depth||e[98]!==R?(fe=R?n.jsx(Qr,{slotLeft:r.slotLeft(t.depth),children:n.jsx(Us,{expanded:I,kind:"work",label:h,onToggle:R})}):n.jsx(ti,{slotLeft:r.slotLeft(t.depth),children:q}),e[93]=q,e[94]=I,e[95]=r,e[96]=h,e[97]=t.depth,e[98]=R,e[99]=fe):fe=e[99];let Be;e[100]!==se||e[101]!==Z||e[102]!==r||e[103]!==h||e[104]!==ne||e[105]!==ke||e[106]!==B||e[107]!==ue||e[108]!==u||e[109]!==t.depth||e[110]!==$||e[111]!==O||e[112]!==i||e[113]!==te?(Be=u?ue(r.textLeft(t.depth)):n.jsxs("button",{type:"button",className:Zr,style:{paddingInlineStart:r.textLeft(t.depth),touchAction:"manipulation"},"aria-label":i("sessions.sidebar.work.openAria",{label:h}),onClick:$,children:[te,ne,ke,B,se,O,Z]}),e[100]=se,e[101]=Z,e[102]=r,e[103]=h,e[104]=ne,e[105]=ke,e[106]=B,e[107]=ue,e[108]=u,e[109]=t.depth,e[110]=$,e[111]=O,e[112]=i,e[113]=te,e[114]=Be):Be=e[114];let J;e[115]!==fe||e[116]!==Be?(J=n.jsxs(n.Fragment,{children:[fe,Be]}),e[115]=fe,e[116]=Be,e[117]=J):J=e[117],Ee=J}const ge=((d.workAction?1:0)+(d.canRename?1:0)+(g?1:0)+(d.canPin?1:0)+(d.canArchive?1:0)+(p&&!j?1:0))*As,we=M&&qn,ve=j&&"opacity-60";let W;e[118]!==we||e[119]!==ve?(W=ae("relative flex w-full items-center bg-background transition-colors",we,ve),e[118]=we,e[119]=ve,e[120]=W):W=e[120];let de;e[121]!==P||e[122]!==E||e[123]!==_||e[124]!==l||e[125]!==i||e[126]!==d.toggleWork||e[127]!==d.workAction||e[128]!==j?(de=d.workAction?n.jsx(Vt,{icon:_?"check":"eye",tone:_?"success":"default",label:i(_?"sessions.sidebar.session.work.markDone":"sessions.sidebar.session.work.track"),revealed:l,disabled:E||j,onClick:P(d.toggleWork)}):null,e[121]=P,e[122]=E,e[123]=_,e[124]=l,e[125]=i,e[126]=d.toggleWork,e[127]=d.workAction,e[128]=j,e[129]=de):de=e[129];let Ne;e[130]!==l||e[131]!==t.key||e[132]!==i||e[133]!==d.canRename?(Ne=d.canRename?n.jsx(Vt,{icon:"edit",label:i("sessions.sidebar.work.menu.rename"),revealed:l,onClick:()=>dt.getState().startRename(t.key)}):null,e[130]=l,e[131]=t.key,e[132]=i,e[133]=d.canRename,e[134]=Ne):Ne=e[134];let Ie;e[135]!==P||e[136]!==h||e[137]!==l||e[138]!==g||e[139]!==i?(Ie=g?n.jsx(Vt,{icon:"more",label:i("spaces.actions.menuAria",{label:h}),revealed:l,onClick:P(()=>cl.getState().openActionsSheet(g.id))}):null,e[135]=P,e[136]=h,e[137]=l,e[138]=g,e[139]=i,e[140]=Ie):Ie=e[140];let _e;e[141]!==P||e[142]!==l||e[143]!==i||e[144]!==d?(_e=d.canPin?n.jsx(Vt,{icon:d.pinned?"unpin":"pushpin",label:d.pinned?i("sessions.sidebar.work.menu.unpin"):i("sessions.sidebar.work.menu.pin"),revealed:l,onClick:P(()=>Xo({current:d.pinList,pin:fe=>{d.setPin(!0,fe)},unpin:()=>{d.setPin(!1)}}))}):null,e[141]=P,e[142]=l,e[143]=i,e[144]=d,e[145]=_e):_e=e[145];let Fe;e[146]!==P||e[147]!==E||e[148]!==l||e[149]!==i||e[150]!==d?(Fe=d.canArchive?n.jsx(Vt,{icon:"archive",label:i("sessions.sidebar.work.menu.archive"),revealed:l,disabled:E,onClick:P(()=>{d.finish(!0)})}):null,e[146]=P,e[147]=E,e[148]=l,e[149]=i,e[150]=d,e[151]=Fe):Fe=e[151];let Ve;e[152]!==a||e[153]!==P||e[154]!==b||e[155]!==l||e[156]!==i||e[157]!==p||e[158]!==j?(Ve=p&&!j?n.jsx(Vt,{icon:"delete-bin",tone:"destructive",label:i("sessions.sidebar.group.actions.deleteWorktree"),revealed:l,onClick:P(()=>{b&&a.requestWorktreeDelete({id:b.id,path:b.path},p)})}):null,e[152]=a,e[153]=P,e[154]=b,e[155]=l,e[156]=i,e[157]=p,e[158]=j,e[159]=Ve):Ve=e[159];let He;e[160]!==de||e[161]!==Ne||e[162]!==Ie||e[163]!==_e||e[164]!==Fe||e[165]!==Ve?(He=n.jsxs(n.Fragment,{children:[de,Ne,Ie,_e,Fe,Ve]}),e[160]=de,e[161]=Ne,e[162]=Ie,e[163]=_e,e[164]=Fe,e[165]=Ve,e[166]=He):He=e[166];let Je;return e[167]!==Ee||e[168]!==l||e[169]!==M||e[170]!==T||e[171]!==ge||e[172]!==W||e[173]!==He?(Je=n.jsx(wn,{actionsWidth:ge,revealed:l,onRevealedChange:T,dataActiveSession:M,contentClassName:W,actions:He,children:Ee}),e[167]=Ee,e[168]=l,e[169]=M,e[170]=T,e[171]=ge,e[172]=W,e[173]=He,e[174]=Je):Je=e[174],Je},a1=s=>{const e=re.c(133),{row:t,geometry:r,toggleParent:o}=s,{t:i}=be(),a=Qs(),{run:l}=t,{revealed:u,renaming:c}=jn(t.key),d=bu(l,t.laneNodes,a.close);let p;e[0]!==t.laneNodes?(p=[...t.laneNodes],e[0]=t.laneNodes,e[1]=p):p=e[1];const g=p;let f;e[2]!==g||e[3]!==t.blockingSessionIds?(f={nodes:g,blockingSessionIds:t.blockingSessionIds},e[2]=g,e[3]=t.blockingSessionIds,e[4]=f):f=e[4];const b=xu(f);let x;e[5]!==b?(x=b?n.jsx(Jo,{state:b}):null,e[5]=b,e[6]=x):x=e[6];const h=x,v=ei(t.projectId,t.detailed&&t.renderContext==="timeline-mixed"),w=t.forceExpanded||t.expanded;let N;e[7]!==t.expansionKey||e[8]!==t.forceExpanded||e[9]!==t.laneNodes.length||e[10]!==o?(N=t.laneNodes.length>0&&!t.forceExpanded?()=>o(t.expansionKey):void 0,e[7]=t.expansionKey,e[8]=t.forceExpanded,e[9]=t.laneNodes.length,e[10]=o,e[11]=N):N=e[11];const _=N,M=l.lanes.length;let E;e[12]!==t.key?(E=ye=>dt.getState().setRevealed(t.key,ye),e[12]=t.key,e[13]=E):E=e[13];const j=E;let C;e[14]!==j?(C=ye=>()=>{j(!1),ye()},e[14]=j,e[15]=C):C=e[15];const k=C;let L;e[16]!==u||e[17]!==j||e[18]!==d?(L=()=>{if(u){j(!1);return}d.open()},e[16]=u,e[17]=j,e[18]=d,e[19]=L):L=e[19];const I=L,A=u1;let R;e[20]===Symbol.for("react.memo_cache_sentinel")?(R=n.jsx(vi,{className:"size-3.5 shrink-0 text-muted-foreground","aria-hidden":"true"}),e[20]=R):R=e[20];const F=R,T=d.isActive?Yr:"oc-title-rest";let S;e[21]!==T?(S=ae("block min-w-0 flex-1 truncate oc-ui-start-align typography-ui-label",T),e[21]=T,e[22]=S):S=e[22];let P;e[23]!==l.title||e[24]!==S?(P=n.jsx("span",{dir:"auto",className:S,children:l.title}),e[23]=l.title,e[24]=S,e[25]=P):P=e[25];const D=P;let $;e[26]!==l.title||e[27]!==d?($=(ye,ge)=>n.jsx(Jr,{initialTitle:l.title,indent:ye,className:ge,onSubmit:we=>{A(),d.rename(we)},onCancel:A}),e[26]=l.title,e[27]=d,e[28]=$):$=e[28];const K=$;let U;e[29]!==l.title||e[30]!==i?(U=i("sessions.sidebar.run.openOverviewAria",{title:l.title}),e[29]=l.title,e[30]=i,e[31]=U):U=e[31];const O=U;let V;if(t.detailed){let ye;e[32]!==r||e[33]!==t.depth?(ye=r.detailedLeft(t.depth),e[32]=r,e[33]=t.depth,e[34]=ye):ye=e[34];const ge=c?void 0:I;let we;e[35]!==w||e[36]!==l.title||e[37]!==_?(we=_?n.jsx(Us,{expanded:w,kind:"run",label:l.title,onToggle:_}):null,e[35]=w,e[36]=l.title,e[37]=_,e[38]=we):we=e[38];let ve;e[39]!==h||e[40]!==K||e[41]!==c||e[42]!==D?(ve=c?K(0,"h-[1lh] pe-0 typography-ui-label [&_button]:size-6 [&_button>svg]:size-3.5"):n.jsxs(n.Fragment,{children:[D,h]}),e[39]=h,e[40]=K,e[41]=c,e[42]=D,e[43]=ve):ve=e[43];let W;e[44]!==v?(W=v?n.jsx(Ys,{project:v,size:"xs"}):null,e[44]=v,e[45]=W):W=e[45];let de;e[46]!==M||e[47]!==i?(de=M===1?i("sessions.sidebar.run.laneCountSingle",{count:M}):i("sessions.sidebar.run.laneCountPlural",{count:M}),e[46]=M,e[47]=i,e[48]=de):de=e[48];let Ne;e[49]!==de?(Ne=n.jsx("span",{className:"block min-w-0 flex-1 truncate typography-micro",children:de}),e[49]=de,e[50]=Ne):Ne=e[50];let Ie;e[51]!==l.providerIDs?(Ie=n.jsx(no,{providerIDs:l.providerIDs}),e[51]=l.providerIDs,e[52]=Ie):Ie=e[52];let _e;e[53]!==W||e[54]!==Ne||e[55]!==Ie?(_e=n.jsxs(n.Fragment,{children:[W,F,Ne,Ie]}),e[53]=W,e[54]=Ne,e[55]=Ie,e[56]=_e):_e=e[56];let Fe;e[57]!==O||e[58]!==ye||e[59]!==ge||e[60]!==we||e[61]!==ve||e[62]!==_e?(Fe=n.jsx(Un,{indent:ye,onSelect:ge,ariaLabel:O,chevron:we,firstLine:ve,secondLine:_e}),e[57]=O,e[58]=ye,e[59]=ge,e[60]=we,e[61]=ve,e[62]=_e,e[63]=Fe):Fe=e[63],V=Fe}else{let ye;e[64]!==w||e[65]!==r||e[66]!==t.depth||e[67]!==l.title||e[68]!==_?(ye=_?n.jsx(Qr,{slotLeft:r.slotLeft(t.depth),children:n.jsx(Us,{expanded:w,kind:"run",label:l.title,onToggle:_})}):n.jsx(ti,{slotLeft:r.slotLeft(t.depth),children:F}),e[64]=w,e[65]=r,e[66]=t.depth,e[67]=l.title,e[68]=_,e[69]=ye):ye=e[69];let ge;e[70]!==h||e[71]!==O||e[72]!==r||e[73]!==K||e[74]!==c||e[75]!==t.depth||e[76]!==l.providerIDs||e[77]!==I||e[78]!==D?(ge=c?K(r.textLeft(t.depth)):n.jsxs("button",{type:"button",className:Zr,style:{paddingInlineStart:r.textLeft(t.depth),touchAction:"manipulation"},"aria-label":O,onClick:I,children:[D,n.jsx(no,{providerIDs:l.providerIDs}),h]}),e[70]=h,e[71]=O,e[72]=r,e[73]=K,e[74]=c,e[75]=t.depth,e[76]=l.providerIDs,e[77]=I,e[78]=D,e[79]=ge):ge=e[79];let we;e[80]!==ye||e[81]!==ge?(we=n.jsxs(n.Fragment,{children:[ye,ge]}),e[80]=ye,e[81]=ge,e[82]=we):we=e[82],V=we}const q=(d.sessionWorkEnabled?4:3)*As,ee=d.isActive,Z=d.isActive&&qn;let Y;e[83]!==Z?(Y=ae("relative flex w-full items-center bg-background transition-colors",Z),e[83]=Z,e[84]=Y):Y=e[84];let B;e[85]!==k||e[86]!==u||e[87]!==i||e[88]!==d?(B=d.sessionWorkEnabled?n.jsx(Vt,{icon:d.inWork?"check":"eye",tone:d.inWork?"success":"default",label:d.inWork?i("sessions.sidebar.session.work.markDone"):i("sessions.sidebar.session.work.track"),revealed:u,disabled:d.busy,onClick:k(()=>{d.toggleWork()})}):null,e[85]=k,e[86]=u,e[87]=i,e[88]=d,e[89]=B):B=e[89];let Q;e[90]===Symbol.for("react.memo_cache_sentinel")?(Q=n.jsx(vi,{className:"size-[18px]","aria-hidden":"true"}),e[90]=Q):Q=e[90];let oe;e[91]!==i?(oe=i("sessions.sidebar.run.menu.openOverview"),e[91]=i,e[92]=oe):oe=e[92];let X;e[93]!==k||e[94]!==d.openOverview?(X=k(d.openOverview),e[93]=k,e[94]=d.openOverview,e[95]=X):X=e[95];let te;e[96]!==u||e[97]!==oe||e[98]!==X?(te=n.jsx(Vt,{icon:"git-merge",glyph:Q,label:oe,revealed:u,onClick:X}),e[96]=u,e[97]=oe,e[98]=X,e[99]=te):te=e[99];let ce;e[100]!==i?(ce=i("multirun.overview.rename.aria"),e[100]=i,e[101]=ce):ce=e[101];let ue;e[102]!==t.key?(ue=()=>dt.getState().startRename(t.key),e[102]=t.key,e[103]=ue):ue=e[103];let H;e[104]!==u||e[105]!==ce||e[106]!==ue?(H=n.jsx(Vt,{icon:"edit",label:ce,revealed:u,onClick:ue}),e[104]=u,e[105]=ce,e[106]=ue,e[107]=H):H=e[107];let ne;e[108]!==i?(ne=i("multirun.overview.archive.action"),e[108]=i,e[109]=ne):ne=e[109];const Te=d.busy;let se;e[110]!==d?(se=()=>{d.archive()},e[110]=d,e[111]=se):se=e[111];let xe;e[112]!==k||e[113]!==se?(xe=k(se),e[112]=k,e[113]=se,e[114]=xe):xe=e[114];let pe;e[115]!==u||e[116]!==ne||e[117]!==xe||e[118]!==d.busy?(pe=n.jsx(Vt,{icon:"archive",label:ne,revealed:u,disabled:Te,onClick:xe}),e[115]=u,e[116]=ne,e[117]=xe,e[118]=d.busy,e[119]=pe):pe=e[119];let ke;e[120]!==B||e[121]!==te||e[122]!==H||e[123]!==pe?(ke=n.jsxs(n.Fragment,{children:[B,te,H,pe]}),e[120]=B,e[121]=te,e[122]=H,e[123]=pe,e[124]=ke):ke=e[124];let Ee;return e[125]!==V||e[126]!==u||e[127]!==j||e[128]!==q||e[129]!==Y||e[130]!==ke||e[131]!==d.isActive?(Ee=n.jsx(wn,{actionsWidth:q,revealed:u,onRevealedChange:j,dataActiveSession:ee,contentClassName:Y,actions:ke,children:V}),e[125]=V,e[126]=u,e[127]=j,e[128]=q,e[129]=Y,e[130]=ke,e[131]=d.isActive,e[132]=Ee):Ee=e[132],Ee},l1=s=>{const e=re.c(46),{row:t,geometry:r}=s,{t:o}=be(),i=Qs(),{draft:a}=t,{revealed:l}=jn(t.key),{isOpen:u,firstLine:c,attachmentCount:d,label:p,open:g,discard:f}=hc(a,i.close),b=ei(a.projectId??null,t.detailed&&t.mixed),x=gc(t.detailed?a.directory:null);let h;e[0]!==t.key?(h=O=>dt.getState().setRevealed(t.key,O),e[0]=t.key,e[1]=h):h=e[1];const v=h;let w;e[2]!==g||e[3]!==l||e[4]!==v?(w=()=>{if(l){v(!1);return}g()},e[2]=g,e[3]=l,e[4]=v,e[5]=w):w=e[5];const N=w;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 M=_;let E;e[7]!==d||e[8]!==c?(E=c&&d>0?n.jsx(G,{name:"attachment-2",className:"size-3 shrink-0 text-muted-foreground"}):null,e[7]=d,e[8]=c,e[9]=E):E=e[9];const j=E,C=t.detailed&&!!(b||x||j),k=u?Yr:"oc-title-rest";let L;e[10]!==k?(L=ae("block min-w-0 flex-1 truncate oc-ui-start-align typography-ui-label italic",k),e[10]=k,e[11]=L):L=e[11];let I;e[12]!==p||e[13]!==L?(I=n.jsx("span",{dir:"auto",className:L,children:p}),e[12]=p,e[13]=L,e[14]=I):I=e[14];const A=I;let R;e[15]!==p||e[16]!==o?(R=o("sessions.sidebar.draft.openAria",{label:p}),e[15]=p,e[16]=o,e[17]=R):R=e[17];const F=R,T=u&&qn;let S;e[18]!==T?(S=ae("relative flex w-full items-center bg-background transition-colors",T),e[18]=T,e[19]=S):S=e[19];let P;e[20]!==o?(P=o("sessions.sidebar.draft.discard"),e[20]=o,e[21]=P):P=e[21];let D;e[22]!==f||e[23]!==v?(D=()=>{v(!1),f()},e[22]=f,e[23]=v,e[24]=D):D=e[24];let $;e[25]!==l||e[26]!==P||e[27]!==D?($=n.jsx(Vt,{icon:"close",tone:"destructive",label:P,revealed:l,onClick:D}),e[25]=l,e[26]=P,e[27]=D,e[28]=$):$=e[28];let K;e[29]!==F||e[30]!==j||e[31]!==x||e[32]!==C||e[33]!==r||e[34]!==b||e[35]!==t.depth||e[36]!==N||e[37]!==A?(K=C?n.jsx(Un,{indent:r.detailedLeft(t.depth),onSelect:N,ariaLabel:F,chevron:null,firstLine:A,secondLine:n.jsxs(n.Fragment,{children:[b?n.jsx(Ys,{project:b,size:"xs"}):null,M,x?n.jsx("span",{className:"block min-w-0 truncate typography-micro",children:x}):null,j?n.jsx("span",{className:"ms-auto flex shrink-0 items-center",children:j}):null]})}):n.jsxs(n.Fragment,{children:[n.jsx(ti,{slotLeft:r.slotLeft(t.depth),children:M}),n.jsxs("button",{type:"button",className:Zr,style:{paddingInlineStart:r.textLeft(t.depth),touchAction:"manipulation"},"aria-label":F,onClick:N,children:[A,j]})]}),e[29]=F,e[30]=j,e[31]=x,e[32]=C,e[33]=r,e[34]=b,e[35]=t.depth,e[36]=N,e[37]=A,e[38]=K):K=e[38];let U;return e[39]!==u||e[40]!==l||e[41]!==v||e[42]!==S||e[43]!==$||e[44]!==K?(U=n.jsx(wn,{actionsWidth:As,revealed:l,onRevealedChange:v,dataActiveSession:u,contentClassName:S,actions:$,children:K}),e[39]=u,e[40]=l,e[41]=v,e[42]=S,e[43]=$,e[44]=K,e[45]=U):U=e[45],U};function c1(){return dt.getState().stopRename()}function d1(s){return s.showPinnedSection}function u1(){return dt.getState().stopRename()}const f1=12,Ia=8,ur=s=>Ia+s*f1,m1={base:Ia,slotLeft:ur,textLeft:s=>ur(s)+20,detailedLeft:s=>ur(s)+4},ro=12,p1=()=>{},_a=(s,e)=>s.some(t=>t.session.id===e||_a(t.children,e)),h1=(s,e)=>{const{sessionId:t,runKey:r,projectId:o}=e;if(r){const i=s.findIndex(a=>a.kind==="run"&&a.run.key===r);if(i>=0)return i}if(t){const i=s.findIndex(a=>a.kind==="session"&&a.node.session.id===t||a.kind==="run"&&a.run.memberIds.includes(t)||a.kind==="group-header"&&_a(a.group.sessions,t));if(i>=0)return i}return o?s.findIndex(i=>i.kind==="project-header"&&i.section.project.id===o):-1},g1=({model:s,view:e,actions:t})=>{const{t:r}=be(),o=Qs(),i=xc(),a=m1,[l,u]=m.useState(null),c=s.rowModel.rows;m.useEffect(()=>{dt.getState().forgetUnlisted(h=>s.rowModel.rowIndexByKey.has(h))},[s.rowModel.rowIndexByKey]);const d=dt(h=>h.renamingKey),p=m.useMemo(()=>{const h=d?s.rowModel.rowIndexByKey.get(d):void 0;return new Set(h===void 0?[]:[h])},[s.rowModel.rowIndexByKey,d]),[g,f]=m.useState(null),b=m.useRef(c);b.current=c,m.useEffect(()=>{if(o.openId===0)return;const h=h1(b.current,{sessionId:nt.getState().currentSessionId,runKey:Xe.getState().runOverviewKey,projectId:s.groupProps.activeProjectId});h>=0&&f({index:h,id:o.openId})},[o.openId]);const x=m.useCallback(h=>{switch(h.kind){case"activity-header":return n.jsx(Qh,{row:h,onToggle:()=>Ru(h,{model:s,actions:t})});case"caption":return n.jsx(Zh,{row:h,onToggle:()=>Nu(h,{model:s})});case"project-header":{const v=h.section.project;return n.jsx(e1,{row:h,label:Cu(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}),o.close()},onRemove:()=>t.removeProject(v.id)})}case"group-header":return Su(h.group)?n.jsx(o1,{row:h,geometry:a,onToggle:t.group.onToggleCollapsedGroup}):n.jsx(t1,{row:h,geometry:a,onToggle:t.group.onToggleCollapsedGroup});case"folder-header":return n.jsx(s1,{row:h,geometry:a});case"session":return n.jsx(qh,{row:h,geometry:a,toggleParent:s.groupProps.toggleParent});case"run":return n.jsx(a1,{row:h,geometry:a,toggleParent:s.groupProps.toggleParent});case"draft":return n.jsx(l1,{row:h,geometry:a});case"show-control":return n.jsx(Hh,{more:h.more,fewer:h.fewer,hiddenNodes:h.hiddenNodes,indent:h.flat?ro:h.detailed?a.detailedLeft(h.depth??0):a.textLeft(h.depth??0),onShow:v=>ku(h,v,{model:s,actions:t})});case"status":return n.jsx(n1,{row:h,indent:h.flat?ro:h.detailed?a.detailedLeft(h.depth??0):a.textLeft(h.depth??0),onRetry:()=>ju(h,i),onGrantAccess:()=>{wu(h,i)}});case"empty":return h.emptyKind==="sidebar"?s.emptyState:h.emptyKind==="search"?s.searchEmptyState:n.jsx("div",{className:"py-1 typography-micro text-muted-foreground",style:{paddingInlineStart:a.textLeft(h.depth??0)},children:h.emptyKind==="section"?r("sessions.sidebar.sections.empty"):r("sessions.sidebar.group.empty.noArchivedSessions")})}},[t,i,a,s,o,r,e.homeDirectory]);return n.jsx(Yt,{ref:u,outerClassName:"min-h-0 flex-1",className:"px-3 pb-4 [overflow-anchor:none]",useScrollShadow:!0,disableHorizontal:!0,children:n.jsx(Eu,{model:s.rowModel,scrollElement:l,pinnedRowIndexes:p,renderRow:x,onFirstVisibleIndexChange:p1,guideSlotStartPx:a.base,scrollRequest:g})})},b1=32,x1=80,y1=64,v1=.7,w1=140,j1=.4,k1=(s,e,t)=>{const r=e.ownerDocument.defaultView;if(!r)return"drawer";let o=!1;for(let i=s instanceof r.Element?s:null;i&&i!==e;i=i.parentElement){const a=i.scrollWidth-i.clientWidth;if(a<=1)continue;const l=r.getComputedStyle(i);if(l.overflowX!=="auto"&&l.overflowX!=="scroll")continue;const u=l.direction==="rtl"?-a:0,c=u+a;if(t?i.scrollLeft>u+1:i.scrollLeft<c-1)return"content";o=!0}return o?"content-end":"drawer"},si=(s,e)=>{const t=m.useRef(e);t.current=e;const r=e.enabled??!0;m.useEffect(()=>{if(!r)return;const o=s.current;if(!o)return;const a=window.Capacitor?.getPlatform?.()==="android"?x1:b1,l=o.ownerDocument;let u=!1,c=!1,d="drawer",p=0,g=0;const f=()=>l.getSelection()?.isCollapsed===!1,b=()=>{u=!1},x=()=>{u&&f()&&b()},h=w=>{if(w.touches.length!==1||f()){u=!1;return}const N=w.touches[0],_=o.clientWidth,M=N.clientX<=a,E=N.clientX>=_-a;c=M,d=M||E?k1(w.target,o,c):"drawer",u=(M||E)&&d!=="content",p=N.clientX,g=N.clientY},v=w=>{if(!u||(u=!1,f()))return;const N=w.changedTouches[0];if(!N)return;const _=N.clientX-p,M=N.clientY-g,E=d==="content-end"?w1:y1,j=d==="content-end"?j1:v1;Math.abs(_)<E||Math.abs(M)>Math.abs(_)*j||c&&_<=0||!c&&_>=0||(c?t.current.onLeftEdgeSwipe?.():t.current.onRightEdgeSwipe?.())};return o.addEventListener("touchstart",h,{passive:!0}),o.addEventListener("touchend",v,{passive:!0}),o.addEventListener("touchcancel",b,{passive:!0}),o.addEventListener("selectstart",b),l.addEventListener("selectionchange",x),()=>{o.removeEventListener("touchstart",h),o.removeEventListener("touchend",v),o.removeEventListener("touchcancel",b),o.removeEventListener("selectstart",b),l.removeEventListener("selectionchange",x)}},[r,s])},S1=[["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"]],C1=[["project","sessions.sidebar.header.listGrouping.project"],["time","sessions.sidebar.header.listGrouping.time"]],mn="min-h-10 items-center justify-between";function N1(){const s=re.c(8),{t:e}=be(),r=!Rc();let o;s[0]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(G,{name:"check-double",className:"size-4"}),s[0]=o):o=s[0];let i;s[1]!==e?(i=e("sessions.sidebar.header.actions.markAllRead"),s[1]=e,s[2]=i):i=s[2];let a;s[3]!==i?(a=n.jsxs("span",{className:"flex items-center gap-2",children:[o,i]}),s[3]=i,s[4]=a):a=s[4];let l;return s[5]!==r||s[6]!==a?(l=n.jsx(un,{disabled:r,onClick:Ec,className:mn,children:a}),s[5]=r,s[6]=a,s[7]=l):l=s[7],l}const R1=s=>n.jsx(g1,{...s}),E1=s=>{const e=re.c(29),{project:t}=s,{t:r}=be();let o;e[0]!==t.id?(o={id:t.id},e[0]=t.id,e[1]=o):o=e[1];const{attributes:i,listeners:a,setNodeRef:l,transform:u,transition:c,isDragging:d}=Df(o);let p;e[2]!==u?(p=Lf.Transform.toString(u),e[2]=u,e[3]=p):p=e[3];const g=d?10:1;let f;e[4]!==p||e[5]!==g||e[6]!==c?(f={transform:p,transition:c,zIndex:g},e[4]=p,e[5]=g,e[6]=c,e[7]=f):f=e[7];const b=d&&"shadow-lg shadow-black/20";let x;e[8]!==b?(x=ae("flex items-center gap-1 rounded-2xl border border-edge bg-[var(--surface-elevated)] px-1.5 py-1.5 transition-colors",b),e[8]=b,e[9]=x):x=e[9];let h;e[10]!==t.label||e[11]!==r?(h=r("mobile.sessions.dragHandleAria",{label:t.label}),e[10]=t.label,e[11]=r,e[12]=h):h=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]!==i||e[15]!==a||e[16]!==h?(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":h,...i,...a,children:v}),e[14]=i,e[15]=a,e[16]=h,e[17]=w):w=e[17];let N;e[18]!==t?(N=n.jsx(Ys,{project:t}),e[18]=t,e[19]=N):N=e[19];let _;e[20]!==t.label?(_=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[21];let M;return e[22]!==l||e[23]!==N||e[24]!==_||e[25]!==f||e[26]!==x||e[27]!==w?(M=n.jsxs("div",{ref:l,style:f,className:x,children:[w,N,_]}),e[22]=l,e[23]=N,e[24]=_,e[25]=f,e[26]=x,e[27]=w,e[28]=M):M=e[28],M},io=s=>{const e=re.c(187),{open:t,onOpenChange:r,variant:o,footer:i}=s,a=o===void 0?"drawer":o,{t:l}=be(),u=_1(t),c=Bo(),d=Mt(P1),p=Mt(D1),g=Mt(O1),f=nt(M1),b=kt(L1),x=kt(B1),h=kt(dl),v=kt(z1),w=kt(F1),N=kt($1),_=kt(W1),M=kt(K1),E=kt(V1),j=kt(H1),C=kt(q1),k=kt(U1),L=kt(G1),I=kt(X1),A=Xe(J1),R=kt(Y1);let F;e[0]!==R?(F=R.filter(Q1),e[0]=R,e[1]=F):F=e[1];const T=F,S=kt(Z1),P=Xe(eg),D=Xs(sg),[$,K]=m.useState(""),[U,O]=m.useState(null),[V,q]=m.useState(null),[ee,Z]=m.useState(!1),[Y,B]=m.useState(!1),[Q,oe]=m.useState(null),[X,te]=m.useState(!1),[ce,ue]=m.useState(0),[H,ne]=m.useState(!1),Te=a==="drawer"||H,se=m.useRef(null);let xe;e[2]!==H?(xe=()=>{H&&K(""),ne(!H)},e[2]=H,e[3]=xe):xe=e[3];const pe=xe;let ke,Ee;e[4]!==H||e[5]!==a?(ke=()=>{H&&a==="sidebar"&&se.current?.focus()},Ee=[H,a],e[4]=H,e[5]=a,e[6]=ke,e[7]=Ee):(ke=e[6],Ee=e[7]),m.useEffect(ke,Ee);let ye;e[8]!==u||e[9]!==c?(ye=()=>{if(!u){K(""),ne(!1),te(!1),O(null),dt.getState().reset();return}ue(ng),Mo(c).then(rg)},e[8]=u,e[9]=c,e[10]=ye):ye=e[10];let ge;e[11]!==u?(ge=[u],e[11]=u,e[12]=ge):ge=e[12],m.useEffect(ye,ge);let we;e[13]!==r?(we=()=>r(!1),e[13]=r,e[14]=we):we=e[14];const ve=we;let W,de;e[15]===Symbol.for("react.memo_cache_sentinel")?(de=Se=>{oe(Se),B(!0)},W=(Se,rt)=>q({project:Se,worktree:rt}),e[15]=W,e[16]=de):(W=e[15],de=e[16]);let Ne;e[17]!==ve||e[18]!==ce?(Ne={close:ve,openProjectEdit:O,openNewWorktree:de,requestWorktreeDelete:W,openId:ce},e[17]=ve,e[18]=ce,e[19]=Ne):Ne=e[19];const Ie=Ne;let _e;e[20]===Symbol.for("react.memo_cache_sentinel")?(_e=()=>K(""),e[20]=_e):_e=e[20];const Fe=_e;let Ve;e[21]!==$?(Ve={searchQuery:$,clearSearch:Fe,renderList:R1},e[21]=$,e[22]=Ve):Ve=e[22];const He=Ve;let Je;e[23]!==d?(Je=d.map(ig),e[23]=d,e[24]=Je):Je=e[24];const fe=Je;let Be;e[25]!==fe||e[26]!==p?(Be=yc(fe,"manual",p),e[25]=fe,e[26]=p,e[27]=Be):Be=e[27];const J=Be;let me;e[28]!==U||e[29]!==fe?(me=fe.find(Se=>Se.id===U)??null,e[28]=U,e[29]=fe,e[30]=me):me=e[30];const $e=me,lt=fe.find(Se=>Se.id===Q)??null;let qe;e[31]!==x?(qe=Se=>{x(Se),Is({sidebarProjectSortOrder:Se}),Se!=="manual"&&te(!1)},e[31]=x,e[32]=qe):qe=e[32];const ot=qe;let Ze;e[33]!==v?(Ze=Se=>{v(Se),Is({sidebarGrouping:Se}),Se==="time"&&te(!1)},e[33]=v,e[34]=Ze):Ze=e[34];const xt=Ze,Dt=og;let Rt;e[35]!==l?(Rt=(Se,rt,jt,zt)=>n.jsxs(un,{onClick:zt,className:mn,children:[n.jsx("span",{children:l(rt)}),jt?n.jsx(G,{name:"check",className:"size-4 text-primary"}):null]},Se),e[35]=l,e[36]=Rt):Rt=e[36];const We=Rt;let st;e[37]===Symbol.for("react.memo_cache_sentinel")?(st={activationConstraint:{distance:8}},e[37]=st):st=e[37];let ut;e[38]===Symbol.for("react.memo_cache_sentinel")?(ut={coordinateGetter:Of},e[38]=ut):ut=e[38];const at=Rf(_i(If,st),_i(Ef,ut));let ft;e[39]!==d||e[40]!==g?(ft=Se=>{const{active:rt,over:jt}=Se;if(!jt||rt.id===jt.id)return;const zt=d.findIndex(Tt=>Tt.id===rt.id),ls=d.findIndex(Tt=>Tt.id===jt.id);zt<0||ls<0||g(zt,ls)},e[39]=d,e[40]=g,e[41]=ft):ft=e[41];const yt=ft,Et=!$&&d.length>1&&b==="manual"&&h==="project";let Oe;e[42]!==Et||e[43]!==T||e[44]!==C||e[45]!==X||e[46]!==h||e[47]!==xt||e[48]!==ot||e[49]!==S||e[50]!==E||e[51]!==b||e[52]!==d.length||e[53]!==We||e[54]!==A||e[55]!==k||e[56]!==j||e[57]!==M||e[58]!==N||e[59]!==I||e[60]!==_||e[61]!==w||e[62]!==l||e[63]!==L?(Oe=!X&&d.length>0?n.jsxs(vr,{children:[n.jsx(wr,{asChild:!0,children:n.jsx(Ae,{type:"button",variant:"chip",size:"sm","aria-label":l("sessions.sidebar.header.displayMode.label"),title:l("sessions.sidebar.header.displayMode.label"),style:{touchAction:"manipulation"},children:n.jsx(G,{name:"equalizer-2",className:"size-4"})})}),n.jsxs(jr,{align:"end",className:"w-64",children:[n.jsx(wi,{children:l("sessions.sidebar.header.listGrouping.label")}),C1.map(Se=>{const[rt,jt]=Se;return We(rt,jt,h===rt,()=>xt(rt))}),h==="project"?n.jsxs(n.Fragment,{children:[n.jsx(ir,{}),n.jsx(wi,{children:l("sessions.sidebar.header.actions.sortProjects")}),S1.map(Se=>{const[rt,jt]=Se;return We(rt,jt,b===rt,()=>ot(rt))})]}):null,n.jsx(ir,{}),We("pinned","sessions.sidebar.header.displayMode.showPinned",_,Dt(_,M,ag)),A?We("work","sessions.sidebar.header.displayMode.showWork",w,Dt(w,N,lg)):null,T.map(Se=>n.jsxs(un,{onClick:()=>Iu(Se.id,!S.includes(Se.id)),className:mn,children:[n.jsx("span",{className:"min-w-0 truncate",dir:"auto",children:Se.name}),S.includes(Se.id)?null:n.jsx(G,{name:"check",className:"size-4 text-primary"})]},`section:${Se.id}`)),A&&w?We("in-place","sessions.sidebar.header.displayMode.keepWorkInPlace",E,Dt(E,j,cg)):null,We("detailed","sessions.sidebar.header.displayMode.detailedZoneRows",C,Dt(C,k,dg)),We("branch-names","sessions.sidebar.header.displayMode.worktreeNameByBranch",L,Dt(L,I,ug)),n.jsx(ir,{}),Et?n.jsx(un,{onClick:()=>te(!0),className:mn,children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(G,{name:"drag-move-2",className:"size-4"}),l("mobile.sessions.editOrder")]})}):null,n.jsx(N1,{})]})]}):null,e[42]=Et,e[43]=T,e[44]=C,e[45]=X,e[46]=h,e[47]=xt,e[48]=ot,e[49]=S,e[50]=E,e[51]=b,e[52]=d.length,e[53]=We,e[54]=A,e[55]=k,e[56]=j,e[57]=M,e[58]=N,e[59]=I,e[60]=_,e[61]=w,e[62]=l,e[63]=L,e[64]=Oe):Oe=e[64];const et=Oe;let tt;e[65]!==X||e[66]!==l?(tt=X?n.jsx(Ae,{type:"button",variant:"chip",size:"sm","aria-label":l("mobile.sessions.doneEditing"),"aria-pressed":!0,onClick:()=>te(!1),style:{touchAction:"manipulation"},children:n.jsx(G,{name:"check",className:"size-4"})}):null,e[65]=X,e[66]=l,e[67]=tt):tt=e[67];const mt=tt;let Me;e[68]!==ve||e[69]!==X||e[70]!==f||e[71]!==l?(Me=X?null:n.jsxs(Ae,{type:"button",variant:"default",size:"sm","aria-label":l("mobile.sessions.newChat"),onClick:()=>{f(),ve()},style:{touchAction:"manipulation"},children:[n.jsx(G,{name:"add",className:"size-4"}),l("mobile.sessions.newChat")]}),e[68]=ve,e[69]=X,e[70]=f,e[71]=l,e[72]=Me):Me=e[72];const pt=Me;let vt;e[73]!==X||e[74]!==l?(vt=X?null:n.jsx(Ae,{type:"button",variant:"chip",size:"sm","aria-label":l("sessions.sidebar.header.actions.addProject"),title:l("sessions.sidebar.header.actions.addProject"),onClick:()=>Z(!0),style:{touchAction:"manipulation"},children:n.jsx(G,{name:"folder-add",className:"size-4"})}),e[73]=X,e[74]=l,e[75]=vt):vt=e[75];const Ye=vt,ht=fg;let Ge;e[76]!==X||e[77]!==i||e[78]!==l?(Ge=i&&!X?n.jsxs(vr,{children:[n.jsx(wr,{asChild:!0,children:n.jsx(Ae,{type:"button",variant:"chip",size:"sm","aria-label":l("sessions.sidebar.header.actions.more"),title:l("sessions.sidebar.header.actions.more"),style:{touchAction:"manipulation"},children:n.jsx(G,{name:"more",className:"size-4"})})}),n.jsxs(jr,{align:"end",className:"w-56",children:[i.onOpenOverview?ht("compass-3",l("overview.title"),i.onOpenOverview):null,ht("git-pull-request",l("sourceBoard.title"),i.onOpenSourceBoard),ht("calendar-schedule",l("sessions.sidebar.header.actions.scheduledTasks"),i.onOpenScheduled),ht("archive",l("sessions.sidebar.nav.archive"),i.onOpenArchive),ht("bar-chart",l("usageStats.openAction"),i.onOpenUsage)]})]}):null,e[76]=X,e[77]=i,e[78]=l,e[79]=Ge):Ge=e[79];const Qt=Ge;let ie;e[80]!==Ye||e[81]!==et||e[82]!==mt||e[83]!==Qt||e[84]!==pt?(ie=n.jsxs(n.Fragment,{children:[Ye,et,Qt,mt,pt]}),e[80]=Ye,e[81]=et,e[82]=mt,e[83]=Qt,e[84]=pt,e[85]=ie):ie=e[85];const je=ie,Re=d.length===0&&!D,Pe="flex min-h-0 flex-1 flex-col";let De;e[86]!==X||e[87]!==Re||e[88]!==t||e[89]!==$||e[90]!==Te||e[91]!==l||e[92]!==pe||e[93]!==a?(De=!X&&!Re&&Te?n.jsx("div",{className:ae("shrink-0 px-2 pb-1",a==="sidebar"?"pt-2":"pt-1"),children:n.jsx(_u,{inputRef:se,value:$,onSearch:K,onClose:a==="sidebar"?pe:void 0,active:t,mobile:!0,placeholder:l("mobile.sessions.search.placeholder"),clearLabel:l("mobile.sessions.clearSearchAria")})}):null,e[86]=X,e[87]=Re,e[88]=t,e[89]=$,e[90]=Te,e[91]=l,e[92]=pe,e[93]=a,e[94]=De):De=e[94];let Qe;e[95]!==Re||e[96]!==l?(Qe=Re?n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(A1,{title:l("mobile.sessions.empty.noProjectsTitle"),description:l("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:()=>Z(!0),children:[n.jsx(G,{name:"folder-add",className:"size-4"}),l("sessions.sidebar.header.actions.addProject")]})})}):null,e[95]=Re,e[96]=l,e[97]=Qe):Qe=e[97];let Xt;e[98]!==at||e[99]!==X||e[100]!==yt||e[101]!==J||e[102]!==l?(Xt=X?n.jsx(Yt,{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:l("mobile.sessions.editOrderHint")}),n.jsx(_f,{sensors:at,collisionDetection:Tf,onDragEnd:yt,children:n.jsx(Af,{items:J.map(mg),strategy:Pf,children:n.jsx("div",{className:"flex flex-col gap-1.5",children:J.map(pg)})})})]})}):null,e[98]=at,e[99]=X,e[100]=yt,e[101]=J,e[102]=l,e[103]=Xt):Xt=e[103];const ds=(X||Re)&&"hidden";let wt;e[104]!==ds?(wt=ae("flex min-h-0 flex-1 flex-col",ds),e[104]=ds,e[105]=wt):wt=e[105];let Ue;e[106]!==u||e[107]!==He?(Ue=n.jsx(Tu,{mobileVariant:!0,isVisible:u,phone:He}),e[106]=u,e[107]=He,e[108]=Ue):Ue=e[108];let gt;e[109]!==Ie||e[110]!==Ue?(gt=n.jsx(Kh,{value:Ie,children:Ue}),e[109]=Ie,e[110]=Ue,e[111]=gt):gt=e[111];let St;e[112]!==wt||e[113]!==gt?(St=n.jsx("div",{className:wt,children:gt}),e[112]=wt,e[113]=gt,e[114]=St):St=e[114];let Lt;e[115]!==i||e[116]!==P||e[117]!==l||e[118]!==a?(Lt=i?n.jsxs("div",{"data-keyboard-rider":a==="drawer"?"":void 0,className:"flex shrink-0 items-center justify-between gap-2 border-t border-edge bg-background px-3 pt-1.5",style:{paddingBottom:"calc(0.375rem + var(--oc-safe-area-bottom, 0px))"},children:[n.jsx("div",{className:"flex min-w-0 items-center",children:i.instanceLabel&&i.onOpenInstances?n.jsxs(Ae,{type:"button",variant:"info",size:"lg",className:"min-w-0 shrink justify-start",onClick:i.onOpenInstances,"aria-label":l("mobile.menu.instances"),style:{touchAction:"manipulation"},children:[n.jsx(G,{name:"server",className:"size-[18px]"}),n.jsx("span",{className:"block min-w-0 truncate",children:i.instanceLabel})]}):null}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[i.onOpenUpdate?n.jsxs(Ae,{type:"button",variant:"chip",size:"lg",className:"relative w-10 px-0",onClick:i.onOpenUpdate,"aria-label":l("mobile.menu.update"),title:l("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(vc,{children:[n.jsx(wc,{asChild:!0,children:n.jsx(Ae,{type:"button",variant:"default",size:"lg",className:"w-10 px-0",onClick:i.onOpenSettings,"aria-label":l("mobile.menu.settings"),style:{touchAction:"manipulation"},children:n.jsx(G,{name:"settings-3",className:"size-5"})})}),n.jsx(jc,{side:"top",children:n.jsx(kc,{label:l("mobile.menu.settings"),shortcut:Sc(Cc("open_settings",P),"")})})]})]})]}):null,e[115]=i,e[116]=P,e[117]=l,e[118]=a,e[119]=Lt):Lt=e[119];let Bt;e[120]!==ee?(Bt=n.jsx(Ic,{open:ee,onOpenChange:Z}),e[120]=ee,e[121]=Bt):Bt=e[121];const Zs=Nc;let ts;e[122]===Symbol.for("react.memo_cache_sentinel")?(ts=Se=>{B(Se),Se||oe(null)},e[122]=ts):ts=e[122];const Ps=lt?{id:lt.id,path:Xr(lt.path)}:void 0;let us;e[123]!==ve||e[124]!==f||e[125]!==Q?(us=Se=>{f({selectedProjectId:Q,directoryOverride:Se,preserveDirectoryOverride:!0}),ve()},e[123]=ve,e[124]=f,e[125]=Q,e[126]=us):us=e[126];let fs;e[127]!==Zs||e[128]!==Y||e[129]!==ts||e[130]!==Ps||e[131]!==us?(fs=n.jsx(Zs,{open:Y,onOpenChange:ts,project:Ps,onWorktreeCreated:us}),e[127]=Zs,e[128]=Y,e[129]=ts,e[130]=Ps,e[131]=us,e[132]=fs):fs=e[132];const js=$e!==null;let Ds;e[133]===Symbol.for("react.memo_cache_sentinel")?(Ds=()=>O(null),e[133]=Ds):Ds=e[133];let Ht;e[134]!==$e||e[135]!==js?(Ht=n.jsx(Sh,{open:js,project:$e,onClose:Ds}),e[134]=$e,e[135]=js,e[136]=Ht):Ht=e[136];let It;e[137]!==V?(It=V?n.jsx(Sa,{open:!0,project:V.project,worktree:V.worktree,onClose:()=>q(null)}):null,e[137]=V,e[138]=It):It=e[138];let ss;e[139]!==De||e[140]!==Qe||e[141]!==Xt||e[142]!==St||e[143]!==Lt||e[144]!==Bt||e[145]!==fs||e[146]!==Ht||e[147]!==It?(ss=n.jsxs("div",{className:Pe,children:[De,Qe,Xt,St,Lt,Bt,fs,Ht,It]}),e[139]=De,e[140]=Qe,e[141]=Xt,e[142]=St,e[143]=Lt,e[144]=Bt,e[145]=fs,e[146]=Ht,e[147]=It,e[148]=ss):ss=e[148];const ns=ss;if(a==="sidebar"){let Se;e[149]===Symbol.for("react.memo_cache_sentinel")?(Se=ae(bs,"border-b border-edge"),e[149]=Se):Se=e[149];let rt;e[150]!==X||e[151]!==Re||e[152]!==H||e[153]!==l||e[154]!==pe?(rt=!X&&!Re?n.jsx(Ae,{type:"button",variant:"chip",size:"sm","aria-label":l("sessions.sidebar.header.actions.searchSessions"),title:l("sessions.sidebar.header.actions.searchSessions"),"aria-pressed":H,onClick:pe,style:{touchAction:"manipulation"},children:n.jsx(G,{name:"search",className:"size-4"})}):null,e[150]=X,e[151]=Re,e[152]=H,e[153]=l,e[154]=pe,e[155]=rt):rt=e[155];let jt;e[156]!==je?(jt=n.jsx("div",{className:"ms-auto flex shrink-0 items-center gap-2",children:je}),e[156]=je,e[157]=jt):jt=e[157];let zt;e[158]!==rt||e[159]!==jt?(zt=n.jsxs("div",{className:Se,children:[rt,jt]}),e[158]=rt,e[159]=jt,e[160]=zt):zt=e[160];let ls;return e[161]!==ns||e[162]!==zt?(ls=n.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[zt,ns]}),e[161]=ns,e[162]=zt,e[163]=ls):ls=e[163],ls}let ms;e[164]!==ve?(ms=()=>{const Se=dt.getState();if(Se.revealedKey){Se.setRevealed(Se.revealedKey,!1);return}ve()},e[164]=ve,e[165]=ms):ms=e[165];let Jt;e[166]!==l?(Jt=l("mobile.sessions.sheet.title"),e[166]=l,e[167]=Jt):Jt=e[167];let rs;e[168]!==l?(rs=l("mobile.surface.closeAria"),e[168]=l,e[169]=rs):rs=e[169];let Ke,is;e[170]===Symbol.for("react.memo_cache_sentinel")?(Ke={touchAction:"manipulation"},is=n.jsx(G,{name:"close",className:"size-5"}),e[170]=Ke,e[171]=is):(Ke=e[170],is=e[171]);let os;e[172]!==ve||e[173]!==rs?(os=n.jsx("button",{type:"button",className:Nt,"aria-label":rs,onClick:ve,style:Ke,children:is}),e[172]=ve,e[173]=rs,e[174]=os):os=e[174];let as;e[175]!==je?(as=n.jsx("div",{className:"ms-auto flex shrink-0 items-center gap-2",children:je}),e[175]=je,e[176]=as):as=e[176];let qt;e[177]!==os||e[178]!==as?(qt=n.jsxs("div",{className:bs,children:[os,as]}),e[177]=os,e[178]=as,e[179]=qt):qt=e[179];let _t;return e[180]!==ve||e[181]!==t||e[182]!==ns||e[183]!==ms||e[184]!==Jt||e[185]!==qt?(_t=n.jsxs(T1,{open:t,onClose:ve,onSwipeClose:ms,ariaLabel:Jt,children:[qt,ns]}),e[180]=ve,e[181]=t,e[182]=ns,e[183]=ms,e[184]=Jt,e[185]=qt,e[186]=_t):_t=e[186],_t},oo="mobile-surface-root",Ta=16,ao=320,I1="cubic-bezier(0.22, 1, 0.36, 1)",_1=s=>{const e=re.c(3),[t,r]=m.useState(s);let o,i;return e[0]!==s?(o=()=>{if(!s){r(!1);return}let a=0;const l=window.setTimeout(()=>{a=window.requestAnimationFrame(()=>{a=window.requestAnimationFrame(()=>r(!0))})},Ta);return()=>{window.clearTimeout(l),window.cancelAnimationFrame(a)}},i=[s],e[0]=s,e[1]=o,e[2]=i):(o=e[1],i=e[2]),m.useEffect(o,i),t},T1=({open:s,onClose:e,onSwipeClose:t,ariaLabel:r,children:o})=>{const{direction:i}=be(),a=m.useRef(null),l=m.useRef(null),[u,c]=m.useState(!1),[d,p]=m.useState(s),g=m.useRef(e);m.useEffect(()=>{g.current=e},[e]);const f=m.useRef(t);m.useEffect(()=>{f.current=t},[t]);const b=()=>(f.current??g.current)();if(si(l,{enabled:s,...i==="rtl"?{onLeftEdgeSwipe:b}:{onRightEdgeSwipe:b}}),typeof document<"u"&&!a.current){let x=document.getElementById(oo);x||(x=document.createElement("div"),x.id=oo,document.body.appendChild(x)),a.current=x}return m.useEffect(()=>{if(s){p(!0);const h=window.setTimeout(()=>c(!0),Ta);return()=>window.clearTimeout(h)}c(!1);const x=window.setTimeout(()=>p(!1),ao+40);return()=>window.clearTimeout(x)},[s]),m.useEffect(()=>{if(!s)return;const x=document.body.style.overflow;document.body.style.overflow="hidden";const h=v=>{v.key==="Escape"&&!Mr(v)&&g.current()};return document.addEventListener("keydown",h),()=>{document.body.style.overflow=x,document.removeEventListener("keydown",h)}},[s]),a.current?Es.createPortal(n.jsx("section",{ref:l,role:"dialog","aria-modal":"true","aria-label":r,"aria-hidden":!s,className:"oc-keyboard-inset-surface fixed inset-0 z-50 flex flex-col bg-background text-foreground",style:{paddingTop:"var(--oc-safe-area-top, 0px)",transform:u?"none":i==="rtl"?"translateX(100%)":"translateX(-100%)",transition:`transform ${ao}ms ${I1}`,visibility:d?"visible":"hidden",pointerEvents:s?"auto":"none"},children:n.jsx("div",{className:"flex h-full min-h-0 flex-col",children:o})}),a.current):null},A1=s=>{const e=re.c(10),{title:t,description:r,action:o}=s;let i;e[0]!==t?(i=n.jsx("p",{className:"typography-ui-label text-foreground",children:t}),e[0]=t,e[1]=i):i=e[1];let a;e[2]!==r?(a=r?n.jsx("p",{className:"typography-meta text-muted-foreground",children:r}):null,e[2]=r,e[3]=a):a=e[3];let l;e[4]!==o?(l=o?n.jsx("div",{className:"pt-2",children:o}):null,e[4]=o,e[5]=l):l=e[5];let u;return e[6]!==i||e[7]!==a||e[8]!==l?(u=n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 text-center",children:[i,a,l]}),e[6]=i,e[7]=a,e[8]=l,e[9]=u):u=e[9],u};function P1(s){return s.projects}function D1(s){return s.manualProjectOrder}function O1(s){return s.reorderProjects}function M1(s){return s.openNewSessionDraft}function L1(s){return s.projectSortOrder}function B1(s){return s.setProjectSortOrder}function z1(s){return s.setSidebarGrouping}function F1(s){return s.showWorkSection}function $1(s){return s.setShowWorkSection}function W1(s){return s.showPinnedSection}function K1(s){return s.setShowPinnedSection}function V1(s){return s.keepWorkInPlace}function H1(s){return s.setKeepWorkInPlace}function q1(s){return s.detailedZoneRows}function U1(s){return s.setDetailedZoneRows}function G1(s){return s.worktreeNameByBranch}function X1(s){return s.setWorktreeNameByBranch}function J1(s){return s.sessionWorkEnabled}function Y1(s){return s.sections}function Q1(s){return s.kind==="custom"}function Z1(s){return s.hiddenSections}function eg(s){return s.shortcutOverrides}function tg(s){return Ar(Rs(s))}function sg(s){return s.activeSessions.some(tg)}function ng(s){return s+1}function rg(){return _c()}function ig(s){return{...s,label:s.label?.trim()||_h(s.path)}}function og(s,e,t){return()=>{e(!s),t(!s)}}function ag(s){Is({sidebarShowPinnedSection:s})}function lg(s){Is({sidebarShowWorkSection:s})}function cg(s){Is({sidebarKeepWorkInPlace:s})}function dg(s){Is({sidebarDetailedZoneRows:s})}function ug(s){Is({sidebarWorktreeNameByBranch:s})}function fg(s,e,t){return n.jsx(un,{onClick:t,className:mn,children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(G,{name:s,className:"size-4"}),e]})})}function mg(s){return s.id}function pg(s){return n.jsx(E1,{project:s},s.id)}const hg=async(s,e)=>{const t=[],r=new Set;let o=s;for(;o&&!r.has(o);){r.add(o);const i=await e(o);if(!i)break;t.push(i),o=i.parentID??Tc(i)}return t},gg=s=>s.split(/[\\/]/).filter(Boolean).pop()??s,bg=(s,e)=>{const t=()=>{const o=Xe.getState();o.isSettingsDialogOpen&&(o.setSettingsDialogOpen(!1),e(s.includes(Au(o.settingsPage))?"page-content":"nav"))},r=Xe.subscribe((o,i)=>{o.isSettingsDialogOpen&&!i.isSettingsDialogOpen&&t()});return t(),r},xg=s=>{const e=re.c(64),{directory:t,target:r,subtitle:o,revision:i,visible:a,onBack:l}=s,{t:u}=be();let c;e[0]!==t||e[1]!==i||e[2]!==r||e[3]!==a?(c={directory:t,target:r,visible:a,needsSourceSelection:!1,revision:i},e[0]=t,e[1]=i,e[2]=r,e[3]=a,e[4]=c):c=e[4];const d=ym(c),{view:p}=d;let g;e[5]!==r?(g=ul(r),e[5]=r,e[6]=g):g=e[6];const f=g,[b,x]=m.useState(!1),h=d.entry.result?.generatedAt??null,[v,w]=m.useState(null),N=p!==null&&v!==null&&v===h;let _;e[7]!==h||e[8]!==d?(_=B=>{d.handleSelectStop(B),w(h)},e[7]=h,e[8]=d,e[9]=_):_=e[9];const M=_;let E;e[10]!==l||e[11]!==N?(E=()=>{N?w(null):l()},e[10]=l,e[11]=N,e[12]=E):E=e[12];const j=E;let C;e[13]===Symbol.for("react.memo_cache_sentinel")?(C=ae(bs,"border-b border-edge text-foreground"),e[13]=C):C=e[13];let k;e[14]!==u?(k=u("header.actions.backAria"),e[14]=u,e[15]=k):k=e[15];let L;e[16]===Symbol.for("react.memo_cache_sentinel")?(L=n.jsx(G,{name:"arrow-left",className:"size-5"}),e[16]=L):L=e[16];let I;e[17]!==j||e[18]!==k?(I=n.jsx("button",{type:"button",className:Nt,"aria-label":k,onClick:j,children:L}),e[17]=j,e[18]=k,e[19]=I):I=e[19];let A;e[20]===Symbol.for("react.memo_cache_sentinel")?(A=ae("truncate",vn),e[20]=A):A=e[20];let R;e[21]!==u?(R=u("contextPanel.mode.walkthrough"),e[21]=u,e[22]=R):R=e[22];let F;e[23]!==R?(F=n.jsx("h2",{className:A,children:R}),e[23]=R,e[24]=F):F=e[24];let T;e[25]!==o?(T=n.jsx("p",{className:"truncate typography-meta text-muted-foreground",children:o}),e[25]=o,e[26]=T):T=e[26];let S;e[27]!==F||e[28]!==T?(S=n.jsxs("div",{className:"min-w-0 flex-1 px-1",children:[F,T]}),e[27]=F,e[28]=T,e[29]=S):S=e[29];let P;e[30]!==N||e[31]!==d||e[32]!==u||e[33]!==p?(P=N&&p?n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",className:Nt,"aria-label":u("walkthrough.action.previous"),onClick:()=>d.step(-1),children:n.jsx(G,{name:"arrow-right-s",className:"size-5 rotate-180"})}),n.jsx(vm,{review:d,view:p,size:"mobile"}),n.jsx("button",{type:"button",className:Nt,"aria-label":u("walkthrough.action.next"),onClick:()=>d.step(1),children:n.jsx(G,{name:"arrow-right-s",className:"size-5"})})]}):p||d.blocked||d.showStages?n.jsx("button",{type:"button",className:Nt,"aria-label":u("walkthrough.options.moreAria"),"aria-haspopup":"dialog",onClick:()=>x(!0),children:n.jsx(G,{name:"more",className:"size-5"})}):null,e[30]=N,e[31]=d,e[32]=u,e[33]=p,e[34]=P):P=e[34];let D;e[35]!==S||e[36]!==P||e[37]!==I?(D=n.jsxs("header",{className:C,children:[I,S,P]}),e[35]=S,e[36]=P,e[37]=I,e[38]=D):D=e[38];let $;e[39]!==d||e[40]!==p?($=n.jsx(Nm,{review:d,view:p}),e[39]=d,e[40]=p,e[41]=$):$=e[41];let K;e[42]!==f||e[43]!==M||e[44]!==N||e[45]!==d||e[46]!==p?(K=n.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:d.blocked?n.jsx(wm,{reason:d.blocked.reason,model:d.blocked.model,requiredChars:d.blocked.requiredChars,availableChars:d.blocked.availableChars,onRetry:d.retry}):d.showStages?n.jsx("div",{className:"flex flex-1 flex-col items-center justify-center gap-3 p-8",children:n.jsx(jm,{progress:d.stageProgress})}):p&&N?n.jsx(km,{view:p,activeStopId:d.activeStopId,scrollToStopId:d.scrollToStopId,onActiveStopChange:d.handleActiveStopChange,onScrollHandled:d.clearScrollRequest,renderSideBySide:!1,wrapLines:!0,commentOrigin:f}):p?n.jsx(Sm,{view:p,activeStopId:d.activeStopId,visitedStopIds:d.visitedStopIds,onSelectStop:M}):n.jsx(Cm,{review:d,size:"mobile"})}),e[42]=f,e[43]=M,e[44]=N,e[45]=d,e[46]=p,e[47]=K):K=e[47];let U;e[48]===Symbol.for("react.memo_cache_sentinel")?(U=()=>x(!1),e[48]=U):U=e[48];let O;e[49]!==u?(O=u("walkthrough.options.title"),e[49]=u,e[50]=O):O=e[50];const V=p!==null;let q;e[51]===Symbol.for("react.memo_cache_sentinel")?(q=()=>x(!1),e[51]=q):q=e[51];let ee;e[52]!==d||e[53]!==V?(ee=n.jsx(Rm,{review:d,hasView:V,size:"mobile",onActed:q}),e[52]=d,e[53]=V,e[54]=ee):ee=e[54];let Z;e[55]!==b||e[56]!==O||e[57]!==ee?(Z=n.jsx(Mn,{open:b,onClose:U,title:O,children:ee}),e[55]=b,e[56]=O,e[57]=ee,e[58]=Z):Z=e[58];let Y;return e[59]!==D||e[60]!==$||e[61]!==K||e[62]!==Z?(Y=n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[D,$,K,Z]}),e[59]=D,e[60]=$,e[61]=K,e[62]=Z,e[63]=Y):Y=e[63],Y};async function yg(s,e,t=Number.POSITIVE_INFINITY){const r=Array.from(new Set(s)),o=[];return await Ac(r,t,async i=>{try{await e(i)}catch(a){o.push({path:i,error:a instanceof Error?a:null})}}),{paths:r,failures:o}}const vg=async(s,e,t)=>{const{targetBranch:r,directory:o,sourceBranch:i,git:a,publishChooser:l,toast:u,t:c}=t;if(!(!r||!o)){if(!a.createGitCommit)throw new Error("Git commit is unavailable on this runtime");if(await a.createGitCommit(o,s,{addAll:!0}),e)try{await(await l.prepare("push"))()}catch{u.error(c("gitView.dirtySwitch.pushFailed")),await t.refreshStatusAndBranches(),t.closeDialog();return}u.success(i?e?c("gitView.publish.succeeded"):c("gitView.dirtySwitch.committedNotPushed",{branch:i}):c("gitView.toast.commitCreated")),await t.refreshStatusAndBranches(),t.closeDialog(),await t.performCheckout(r)}},lo={status:"loading"},wg=1e6,Ut={type:"list"},jg=2,co=s=>{const e=s.index?.trim();return!!(e&&e!=="?")},uo=s=>{const e=s.working_dir?.trim(),t=s.index?.trim();return!!(e||t==="?")},fo=(s,e)=>e?`${s}\0staged`:s,fr=new WeakSet,mo=(s,e,t)=>t.filter(r=>dd(s,e,r)).sort((r,o)=>r.length-o.length)[0],kg=s=>{const e=re.c(12),t=Ho(),r=yn(qo(t,Br()))??"",o=s.visible??!0;let i;e[0]!==o?(i={enabled:o,recheckOnOpen:!0},e[0]=o,e[1]=i):i=e[1];const a=Pc(r||null,i);let l;e[2]!==r?(l=g=>r?g.changesRepositories.get(r):void 0,e[2]=r,e[3]=l):l=e[3];const u=ln(l);let c;e[4]!==a||e[5]!==u?(c=u&&a.repositoryOptions?.includes(u)?{...a,gitDirectory:u}:a,e[4]=a,e[5]=u,e[6]=c):c=e[6];const d=c;if(t?.kind==="preparing"){let g;return e[7]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(Yo,{}),e[7]=g):g=e[7],g}let p;return e[8]!==s||e[9]!==d||e[10]!==r?(p=n.jsx(Sg,{...s,rootDirectory:r,repository:d}),e[8]=s,e[9]=d,e[10]=r,e[11]=p):p=e[11],p},Sg=({rootDirectory:s,repository:e,onClose:t,initialDiff:r,visible:o=!0,onNavigatedToChat:i})=>{const{t:a}=be(),{git:l,sourceControl:u}=Or(),{rootIsGitRepo:c,gitDirectory:d,nestedRepos:p,repositoryOptions:g}=e,f=d??s,b=Dc(f||null),x=Oc(f),h=Mc(f||null),v=Lc(f||null),[w,N]=m.useState(!1),[_,M]=m.useState(!1),E=In(y=>y.profiles),j=In(y=>y.globalIdentity),C=In(y=>y.loadProfiles),k=In(y=>y.loadGlobalIdentity);m.useEffect(()=>{C(),k()},[C,k]);const L=Bc(),I=kr(y=>y.identities),A=m.useMemo(()=>zc(I),[I]),R=kr(y=>y.refreshIdentityAccounts),F=m.useMemo(()=>Fc(E,j,y=>fl(y)&&$c(y,L)),[E,j,L]),T=async y=>{if(!(!f||_)){M(!0);try{(await pd({directory:f,identity:y,remoteName:De||null},{git:l,sourceControl:u})).status==="failed"?he.error(a("gitView.toast.applyIdentityFailed")):he.success(a("gitView.toast.appliedIdentity",{name:hd(y,a)}))}finally{M(!1)}}},S=Lo(f||null),P=Wc(f||null),D=$t(y=>y.setActiveDirectory),$=$t(y=>y.ensureAll),K=$t(y=>y.ensureNestedRepos),U=$t(y=>y.selectNestedRepo),O=$t(y=>y.fetchStatus),V=$t(y=>y.fetchBranches),q=$t(y=>y.prefetchDiffs),ee=$t(y=>y.getDiff),Z=$t(y=>y.setDiff),Y=$t(y=>y.runtimeKey),B=JSON.stringify([Y,f]),Q=m.useRef(B);Q.current=B;const[oe,X]=m.useState(()=>r?.scope==="turn"?{ownerKey:B,mode:fr.has(r)?"working":"turn",route:Ut}:{ownerKey:B,mode:"working",route:r?.path?{type:"diff",path:r.path,staged:r.staged}:Ut}),[te,ce]=m.useState(null),ue=te?.step==="turn"?"turn":"working",H=oe.ownerKey===B?oe.mode:ue,ne=oe.ownerKey===B?oe.route:Ut,[Te,se]=m.useState(!1),xe=m.useCallback(y=>{X({ownerKey:B,mode:y,route:Ut}),se(!1)},[B]),pe=m.useCallback(y=>{X(z=>({ownerKey:B,mode:z.ownerKey===B?z.mode:"working",route:y}))},[B]);m.useEffect(()=>{X(y=>y.ownerKey===B?y:{ownerKey:B,mode:ue,route:Ut}),se(!1)},[ue,B]),m.useEffect(()=>{o||se(!1)},[o]);const ke=m.useRef(null);m.useEffect(()=>{if(r?.path){if(r.scope==="turn"){if(fr.has(r))return;fr.add(r),ke.current=null,ce({file:r.path,sessionId:nt.getState().currentSessionId,step:"turn",picked:!1,statusReadFor:null}),X({ownerKey:Q.current,mode:"turn",route:Ut});return}ce(null),X({ownerKey:Q.current,mode:"working",route:{type:"diff",path:r.path,staged:r.staged}})}},[r]);const[Ee,ye]=m.useState(null),[ge,we]=m.useState(null),ve=cm(),[W,de]=m.useState(""),[Ne,Ie]=m.useState(new Set),[_e,Fe]=m.useState(!1),[Ve,He]=m.useState(!1),[Je,fe]=m.useState([]),[Be,J]=m.useState([]),[me,$e]=m.useState([]),[lt,qe]=m.useState(null),[ot,Ze]=m.useState(null),[xt,Dt]=m.useState(0),Rt=Pu(),We=Du({directory:f,branch:b?.current,chooseContributor:Rt.choose}),st=Kc(f,l,u),[ut,at]=m.useState(null),[ft,yt]=m.useState(!1),[Et,Oe]=m.useState([]),[et,tt]=m.useState("rebase"),mt=m.useCallback((y,z)=>{Oe(y),tt(z),yt(!0)},[]),Me=b?.current??null,pt=Ri(y=>y.setOverride),vt=Ri(y=>y.clearOverride),Ye=Em(f||null,Me,o&&H==="commit"&&S===!0),ht=Ye.selectedCommit?.hash??null,Ge=Vc(f||null,u),Qt=m.useMemo(()=>new Set(Ge.read?.repository.remotes.map(y=>y.name)??[]),[Ge.read]),ie=Ou(f||null,Me,o&&S===!0,{branches:h,remoteNames:Qt,primaryRemote:Ge.contexts[0]?.primaryRemote,readContext:Ge.contexts[0]??null}),je=o&&S===!0;Om(je&&f||null,je?Me:null,Ge);const Re=tm(Me,ie.base),Pe=S===!1||sm(Me,ie.base,b!==null,ie.resolved),De=Ge.read?.binding?.remotes[0]?.name??Ge.read?.repository.remotes.find(y=>y.name==="origin")?.name??Ge.read?.repository.remotes[0]?.name??"",Qe=Ge.read?Ge.read.binding?.providers.find(y=>y.readiness==="ready")?.accountId??null:void 0,Xt=m.useMemo(()=>Hc(E,j,v,y=>({id:"local-config",name:y.userName,...y,color:"info",icon:"user"}),Qe),[Qe,v,E,j]),ds=m.useMemo(()=>{const y=Ge.read;return!y?.binding||Ge.status!=="ready"||y.binding.state==="bound"?null:qc(y.binding)?a("gitView.identity.configChanged"):a("gitView.context.needsAttention")},[Ge.read,Ge.status,a]),wt=ln(y=>s?y.diffRequests.get(s):void 0);m.useEffect(()=>{wt&&X({ownerKey:B,mode:"pr",route:Ut})},[B,wt]);const Ue=Im(f||null,Me,Ge.contexts[0]??null,o&&H==="pr"&&S===!0,wt),gt=ml(Ue.provider),St=Ue.selectedSource;m.useEffect(()=>{!s||!wt||!b||St!==wt||ln.getState().settleDiffRequest(s,wt)},[wt,s,St,b]);const Lt=nt(y=>y.currentSessionId),{diffs:Bt,loaded:Zs,settled:ts,error:Ps,retry:us}=nm(Lt,s||void 0,{enabled:o&&H==="turn",live:!0}),[fs,js]=m.useState(!1),Ds=m.useCallback(()=>{js(!1),i?.()},[i]),Ht=Uc(Lt,s,Ds),It=m.useMemo(()=>H==="pr"?Ue.diffUnavailable?null:St:H==="branch"&&Me&&ie.base?{kind:"branch",baseRef:ie.base,headRef:Me}:H==="commit"&&ht?{kind:"commit",hash:ht}:null,[ie.base,Me,H,Ue.diffUnavailable,ht,St]),ss=H==="branch"?ie.revision:"",ns=St?Ue.prs.find(y=>y.number===St.number)?.headSha:void 0,ms=m.useMemo(()=>pl(It,{provider:Ue.provider,revision:ns}),[It,Ue.provider,ns]),{review:Jt,provider:rs}=Mu(Ue,f,o&&H==="pr"),Ke=rm(f||null,It,o&&S===!0,ss,Ue.readContext,Ue.provider),{fetchDiff:is,fetchFullFile:os,fetchVersions:as}=Ke,qt=m.useMemo(()=>Ke.files?[...Ke.files].sort((y,z)=>y.path.localeCompare(z.path)):null,[Ke.files]),_t=ne.type==="comparison"&&ne.sourceKey===Ke.key?ne.path:null,[Se,rt]=m.useState(0),jt=m.useCallback(async y=>{try{if(Uo(y)){const Ce=await as(y);return{status:"ready",diff:ea(Ce.original,Ce.modified)?Ce:{original:"",modified:"",isBinary:!0}}}const{diff:z}=await is(y),le={original:"",modified:"",isBinary:Ai(z)};return le.isBinary||(le.fileDiff=ar(y,z)),{status:"ready",diff:le}}catch(z){return{status:"error",message:z instanceof Error?z.message:a("diffView.state.failedToLoadDiff")}}},[is,as,a]),zt=m.useMemo(()=>H==="branch"?im(Ke.files,ss):void 0,[Ke.files,ss,H]),ls=om(Ke.files?H==="pr"?JSON.stringify([Ke.key,Ke.revision]):Ke.key:null,o&&_t?_t:"",o?jt:null,lo,JSON.stringify([H==="pr"?Ke.revision:0,Se]),zt),Tt=_t?ls.get(_t)??lo:null,[Xn,ri]=m.useState(null),[Jn,Oa]=m.useState(null),kn=Xn&&Xn.source===Tt?Xn.request:null,Sn=Jn&&Jn.source===Tt?Jn.diff:null;m.useEffect(()=>{const y=Tt;if(!kn||!_t||y?.status!=="ready"||Sn)return;let z=!1;const le=_t,Ce=async()=>{if(H==="pr"){const{original:Ft,modified:it}=await os(le);return{original:Ft,modified:it,fileDiff:Mm({name:le,contents:Ft},{name:le,contents:it})}}const{diff:Le}=await is(le,wg);return{original:"",modified:"",fileDiff:ar(le,Le)}};return(async()=>{try{const Le=await Ce();z||Oa({source:y,diff:Le})}catch(Le){if(z)return;he.error(Le instanceof Error?Le.message:a("diffView.state.failedToLoadDiff")),ri(null)}})(),()=>{z=!0}},[Tt,_t,Sn,is,os,H,kn,a]),m.useEffect(()=>{H==="branch"&&Pe&&xe("working")},[Pe,xe,H]),m.useEffect(()=>{X(y=>y.ownerKey===B&&y.route.type==="comparison"&&y.route.sourceKey!==Ke.key?{...y,route:Ut}:y)},[Ke.key,B]);const Yn=m.useMemo(()=>Bt.map(y=>({path:y.file??"",status:am(y.status),insertions:y.additions??0,deletions:y.deletions??0})).filter(y=>y.path).sort((y,z)=>y.path.localeCompare(z.path)),[Bt]),Ma=m.useMemo(()=>{const y=new Map;for(const z of Bt)if(z.file){if(typeof z.patch=="string"){const le=Ai(z.patch);y.set(z.file,{original:"",modified:"",isBinary:le,fileDiff:le?void 0:ar(z.file,z.patch)});continue}y.set(z.file,{original:z.before??"",modified:z.after??""})}return y},[Bt]),Ct=m.useMemo(()=>{const y=b?.files??[],z=new Map;for(const le of y)z.set(le.path,le);return Array.from(z.values()).sort((le,Ce)=>le.path.localeCompare(Ce.path))},[b?.files]);m.useEffect(()=>{if(!te||!o)return;if(te.sessionId!==Lt||ne.type!=="list"||H!==(te.step==="turn"?"turn":"working")){ce(null);return}const y=Gc(s,te.file);if(te.step==="turn"){if(!ts)return;const Le=mo(y,s,Bt.map(Ft=>Ft.file));if(Le){ce(null),X({ownerKey:B,mode:"turn",route:{type:"turn",path:Le}});return}ce({...te,step:"changes"}),X({ownerKey:B,mode:"working",route:Ut});return}if(!e.repositoriesKnown||!f)return;const z=Xc(y,[...c&&s?[s]:[],...g??[]]);if(z&&z!==f){if(te.picked){ce(null);return}ce({...te,picked:!0}),ln.getState().clearChangesRepository(s),U(s,z);return}if(te.statusReadFor!==f){if(ke.current===f)return;ke.current=f,O(f,l,{silent:!0}).finally(()=>{ce(Le=>Le&&{...Le,statusReadFor:f})});return}ce(null);const le=mo(y,f,Ct.map(Le=>Le.path)),Ce=Ct.find(Le=>Le.path===le);Ce&&X({ownerKey:B,mode:"working",route:{type:"diff",path:Ce.path,staged:co(Ce)&&!uo(Ce)}})},[Ct,f,Lt,O,l,Bt,H,B,e.repositoriesKnown,g,s,c,ne.type,U,ts,te,o]);const en=m.useMemo(()=>H==="working"?Ct.length>0?{source:{kind:"working-tree",scope:"all"}}:null:!It||!qt?.length?null:It.kind==="pr"?Ue.readContext?{source:It,context:Ue.readContext}:null:{source:It},[Ct.length,qt,It,H,Ue.readContext]),cs=m.useMemo(()=>Ct.filter(co),[Ct]),Qn=m.useMemo(()=>Ct.filter(uo),[Ct]),La=me,Ba=$t(m.useCallback(y=>!f||ne.type!=="diff"?null:y.directories.get(f)?.diffCache.get(fo(ne.path,ne.staged))??null,[f,ne])),za=m.useMemo(()=>ne.type!=="diff"?null:Ct.find(y=>y.path===ne.path)??null,[Ct,ne]),At=m.useCallback(async(y=!0)=>{if(f)try{await Promise.all([O(f,l),V(f,l)])}catch(z){y&&he.error(z instanceof Error?z.message:a("gitView.toast.refreshRepositoryFailed"))}},[f,V,O,l,a]),Fa=m.useMemo(()=>(h?.all??[]).filter(y=>!y.startsWith("remotes/")).sort(),[h]),$a=m.useMemo(()=>(h?.all??[]).filter(y=>y.startsWith("remotes/")).map(y=>y.replace(/^remotes\//,"")).sort(),[h]),Cn=m.useCallback(async y=>{if(!f)return;const z=y.replace(/^remotes\//,"");try{if(!l.checkoutBranch)throw new Error("Branch checkout is unavailable on this runtime");const le=await l.checkoutBranch(f,z);he.success(a("gitView.toast.checkedOut",{name:le.branch||z})),await At()}catch(le){he.error(le instanceof Error?le.message:a("gitView.toast.checkoutFailed",{name:z}))}},[f,l,At,a]),Wa=m.useCallback(y=>{const z=y.replace(/^remotes\//,"");if((b?.files?.length??0)>0){at(z);return}Cn(z)},[Cn,b?.files]),Ka=m.useCallback(async y=>{if(f)try{if(await l.createBranch(f,y,Me??"HEAD"),!l.checkoutBranch)throw new Error("Branch checkout is unavailable on this runtime");await l.checkoutBranch(f,y),await At()}catch(z){throw he.error(z instanceof Error?z.message:a("gitView.toast.createBranchFailed")),z}},[Me,f,l,At,a]),Nn=m.useCallback(async()=>{if(!f){$e([]);return}try{const y=await l.getRemotes(f);$e(y)}catch{$e([])}},[f,l]),ks=m.useCallback(async()=>{f&&(Promise.allSettled([V(f,l),Nn()]),await O(f,l).catch(()=>{}))},[f,V,O,l,Nn]);m.useEffect(()=>{!f||!o||(D(f),$(f,l))},[f,$,l,D,o]),m.useEffect(()=>{o&&Nn()},[Nn,o]),m.useEffect(()=>{if(!o||H!=="working"||!f||Ct.length===0)return;const y=Array.from(new Set([...cs.map(le=>le.path),...Be,...Ct.slice(0,20).map(le=>le.path)])).filter(Boolean);if(y.length===0)return;const z=window.setTimeout(()=>{q(f,l,y,{maxFiles:40})},120);return()=>window.clearTimeout(z)},[Ct,f,l,H,q,cs,Be,o]),m.useEffect(()=>{if(!o)return;if(ne.type!=="diff"){qe(null);return}const y=fo(ne.path,ne.staged);if(Ze(null),!f||ee(f,y)){qe(null);return}let z=!1;const le=Gs();if(qe(null),!l.getGitFileDiff){qe("Diff is unavailable on this runtime");return}return l.getGitFileDiff(f,{path:ne.path,staged:ne.staged||void 0}).then(Ce=>{z||Z(f,y,{original:Ce.original??"",modified:Ce.modified??"",isBinary:Ce.isBinary,submodule:Ce.submodule},le)}).catch(Ce=>{if(!z){if(Ce instanceof fi&&Ce.reason!=="path_not_found"){Ze({key:`${f}\0${ne.path}`,reason:Ce.reason});return}Ce instanceof fi&&O(f,l,{force:!0,silent:!0}),qe(Ce instanceof Error?Ce.message:String(Ce))}}),()=>{z=!0}},[f,xt,O,ee,l,ne,Z,o]);const tn=async(y,z,le=!1)=>{if(!f)return;const Ce=st.start();if(!Ce)return;ye(y);const Le=a(y==="fetch"?"gitView.sync.fetch":y==="pull"?"gitView.sync.pull":y==="publish"?"gitView.publish.title":"gitView.sync.syncChanges");let Ft=null;try{if(y==="sync"||y==="publish"){const it=await We.prepare(y==="publish"?"push":"sync",{forceChoose:le,onOperation:Ce.onOperation});Ft=gd(await it())}else if(z&&b)await bd({action:y,directory:f,remoteName:z.name,status:b,sourceControl:u,git:l,onOperation:Ce.onOperation});else throw new ps("tracking-required");if(!Ce.isCurrent())return;y==="fetch"&&z?he.success(a("gitView.toast.fetchedFromRemote",{name:z.name})):y==="pull"&&z?he.success(a("gitView.toast.pulledFromRemote",{name:z.name})):y==="sync"?he.success(Ft?.kind==="up-to-date"?a("gitView.toast.alreadyUpToDate"):Ft?.kind==="pulled"?a("gitView.toast.pulledFromRemote",{name:Ft.remoteName}):Ft?.kind==="pushed"?a("gitView.toast.pushedToUpstream",{name:Ft.remoteName}):a("gitView.toast.syncedChanges")):y==="publish"&&he.success(a("gitView.publish.succeeded")),await ks()}catch(it){if(it instanceof Pn||it instanceof br){if(Ce.isCurrent()&&await ks(),Ce.isCurrent()&&it instanceof Pn&&it.read.availability==="available"&&it.read.operation.state==="conflicted"&&it.read.operation.error.code==="CONFLICT"){const di=((await l.getGitStatus(f).catch(()=>null))?.files??[]).filter(or).map(Qa=>Qa.path);di.length>0&&mt(di,"merge")}return}if(it instanceof ps&&it.code==="stale-runtime")return;if(it instanceof ps&&We.errorMessage(it)){he.info(We.errorMessage(it));return}await ks(),he.error(it instanceof ps?it.code==="contributor-publish-cancelled-after-update"?a("gitView.toast.contributorPublishCancelledAfterUpdate"):it.code==="contributor-publish-cancelled"?a("gitView.toast.contributorPublishCancelled"):a("gitView.toast.syncActionFailed",{action:Le}):it instanceof Error?Ii(it,a):a("gitView.toast.syncActionFailed",{action:Le}))}finally{Ce.finish(),Ce.isCurrent()&&ye(null)}},sn=m.useCallback(async(y,z)=>{if(!(!f||y.length===0))try{z==="stage"?y.length>1?await Jc(f,y):await Yc(f,y[0]):y.length>1?await Qc(f,y):await Zc(f,y[0]),await At(!1)}catch(le){he.error(le instanceof Error?le.message:a(z==="stage"?"gitView.toast.stageFileFailed":"gitView.toast.unstageFileFailed"))}},[f,At,a]),Zn=m.useCallback((y,z=!1)=>{pe({type:"diff",path:y,staged:z})},[pe]),er=m.useCallback(async y=>{if(f){Ie(z=>new Set(z).add(y));try{await l.revertGitFile(f,y),he.success(a("gitView.toast.revertedFile",{path:y})),await At(!1)}catch(z){he.error(z instanceof Error?z.message:a("gitView.toast.revertFailed"))}finally{Ie(z=>{const le=new Set(z);return le.delete(y),le})}}},[f,l,At,a]),ii=m.useCallback(async y=>{if(!f||y.length===0||_e)return;const z=Array.from(new Set(y));Fe(!0),Ie(new Set(z));try{const le=await yg(z,Ce=>l.revertGitFile(f,Ce),jg);if(await At(!1),le.failures.length===0)he.success(z.length===1?a("gitView.toast.revertedFilesSingle",{count:z.length}):a("gitView.toast.revertedFilesPlural",{count:z.length}));else if(le.failures.length===z.length)he.error(le.failures[0]?.error?.message??a("gitView.toast.revertFailed"));else{const Ce=z.length-le.failures.length;he.warning(Ce===1?a("gitView.toast.revertedSomeSingle",{success:Ce,failed:le.failures.length}):a("gitView.toast.revertedSomePlural",{success:Ce,failed:le.failures.length}))}}catch(le){he.error(le instanceof Error?le.message:a("gitView.toast.revertFailed"))}finally{Ie(new Set),Fe(!1)}},[f,l,_e,At,a]),Va=m.useCallback(y=>{const z=y.map(le=>le.trim()).filter(Boolean);if(z.length===0){fe([]);return}de(le=>`${le.trim()}${le.trim()?`
23
23
 
24
24
  `:""}${z.join(`
25
- `)}`.trim()),fe([])},[]),Ha=m.useCallback(async()=>{if(!f)return;const y=cs.map(z=>z.path).sort();if(y.length===0){he.error(a("gitView.toast.selectFileToDescribe"));return}He(!0);try{const{message:z}=await ji(f,y);de(z.subject?.trim()??""),fe(Array.isArray(z.highlights)?z.highlights:[])}catch(z){he.error(z instanceof Error?z.message:a("gitView.toast.generateCommitMessageFailed"))}finally{He(!1)}},[f,cs,a]),oi=async(y={})=>{if(!f)return;if(!W.trim()){he.error(a("gitView.toast.enterCommitMessage"));return}const z=cs.map(Le=>Le.path).sort();if(z.length===0){he.error(a("gitView.toast.selectFileToCommit"));return}we(y.pushAfter?"commitAndPush":"commit");let le=null,Ce="pending";try{if(!l.createGitCommit)throw new Error("Git commit is unavailable on this runtime");const Le=await l.createGitCommit(f,W.trim(),{files:z});Ce="local";const Ft=ve.committed(Le.summary,y);if(de(""),fe([]),y.pushAfter){if(le=st.start(),!le){he.warning(a("gitView.publish.commitKept")),await ks();return}const it=await We.prepare("push",{onOperation:le.onOperation});ye("publish"),await it(),Ce="published",ve.pushed({deletion:Ft,origin:y.origin})}await ks()}catch(Le){if(y.pushAfter&&Ce==="local"&&he.warning(a("gitView.publish.commitKept")),Le instanceof Pn||Le instanceof br){await ks();return}if(Le instanceof ps&&Le.code==="stale-runtime")return;if(Le instanceof ps&&We.errorMessage(Le)){he.info(We.errorMessage(Le));return}y.pushAfter&&await ks(),he.error(Le instanceof ps?Le.code==="contributor-publish-cancelled-after-update"?a("gitView.toast.contributorPublishCancelledAfterUpdate"):Le.code==="contributor-publish-cancelled"?a("gitView.toast.contributorPublishCancelled"):a("gitView.toast.syncActionFailed",{action:a("gitView.sync.syncChanges")}):Le instanceof Error?Ii(Le,a):a("gitView.toast.createCommitFailed"))}finally{le?.finish(),we(null),y.pushAfter&&ye(null)}},qa=m.useMemo(()=>(b?.files??[]).filter(or).length,[b?.files]),nn=!!b?.mergeInProgress?.head,Ua=m.useCallback(async()=>{if(f)try{if(nn){if(!l.continueMerge)throw new Error("Git continue merge is unavailable on this runtime");const y=await l.continueMerge(f);y.conflict?(mt(y.conflictFiles??[],"merge"),he.error(a("gitView.toast.mergeConflictsDetected"))):he.success(a("gitView.toast.mergeCompleted"))}else{if(!l.continueRebase)throw new Error("Git continue rebase is unavailable on this runtime");const y=await l.continueRebase(f);y.conflict?(mt(y.conflictFiles??[],"rebase"),he.error(a("gitView.toast.rebaseConflictsDetected"))):he.success(a("gitView.toast.rebaseStepCompleted"))}await At(!1)}catch(y){he.error(y instanceof Error?y.message:a("gitView.toast.continueOperationFailed"))}},[f,l,nn,mt,At,a]),ai=m.useCallback(async y=>{if(f)try{if(y==="merge"){if(!l.abortMerge)throw new Error("Git abort merge is unavailable on this runtime");await l.abortMerge(f),he.success(a("gitView.toast.mergeAborted"))}else{if(!l.abortRebase)throw new Error("Git abort rebase is unavailable on this runtime");await l.abortRebase(f),he.success(a("gitView.toast.rebaseAborted"))}await At(!1)}catch(z){he.error(z instanceof Error?z.message:a("gitView.toast.abortOperationFailed"))}},[f,l,At,a]),Ga=m.useCallback(()=>{const y=(b?.files??[]).filter(or).map(z=>z.path);mt(y,nn?"merge":"rebase")},[nn,mt,b?.files]),Xa=m.useMemo(()=>{const y=[];return cs.length>0&&y.push({id:"staged",title:a("gitView.changes.stagedTitle"),entries:cs,statsScope:"staged",actionSymbol:"-",actionAllLabel:a("gitView.changes.unstageAllAria"),getActionLabel:z=>a("gitView.changes.unstageFileAria",{path:z}),onActionFile:z=>{sn([z],"unstage")},onActionAll:z=>{sn(z,"unstage")},onViewDiff:z=>Zn(z,!0),onRevertFile:er,showRevertActions:!1,accent:!0}),Qn.length>0&&y.push({id:"unstaged",title:a("gitView.changes.title"),entries:Qn,statsScope:"working",actionSymbol:"+",actionAllLabel:a("gitView.changes.stageAllAria"),getActionLabel:z=>a("gitView.changes.stageFileAria",{path:z}),onActionFile:z=>{sn([z],"stage")},onActionAll:z=>{sn(z,"stage")},onViewDiff:z=>Zn(z,!1),onRevertFile:er}),y},[er,Zn,sn,cs,a,Qn]),li=n.jsxs(n.Fragment,{children:[We.context?n.jsx(Lu,{context:We.context,onSelect:We.settle}):null,We.confirmDialog,n.jsx(Bu,{candidates:Rt.candidates,onSelect:Rt.settle})]}),ci=g?n.jsx(md,{repositories:g,selectedRepository:d??null,onSelectRepository:y=>{s&&(ln.getState().clearChangesRepository(s),U(s,y))},repositoryRoot:s??void 0}):null,Rn=y=>n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[li,n.jsxs("header",{className:ae(bs,"text-foreground"),children:[t?n.jsx("button",{type:"button",className:Nt,"aria-label":a("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:vn,children:a("mobile.nav.changes")}),n.jsx("p",{className:"truncate typography-micro text-muted-foreground",children:b?.current||f||""})]}),ci]}),n.jsx("div",{className:"min-h-0 flex-1",children:y})]});if(!f)return Rn(n.jsx(Pt,{message:a("gitView.empty.selectSessionOrDirectory")}));if(e.unreadable)return Rn(n.jsx(zu,{directory:e.unreadable.directory,message:e.unreadable.message}));if(c===!1&&S!==!0)return Rn(n.jsx($u,{root:s,rootIsGitRepo:c,resolvedIsGitRepo:S,nestedRepos:p,onRetryDiscovery:()=>{s&&K(s,{force:!0})}}));if(P&&S===null)return Rn(n.jsx(Pt,{loading:!0,message:a("gitView.loading.checkingRepository")}));if(ne.type==="diff")return n.jsx(mr,{path:ne.path,diff:Ba,staged:ne.staged,fileExists:!!za,unavailableReason:ot?.key===`${f}\0${ne.path}`?ot.reason:null,error:lt,onBack:()=>pe({type:"list"}),onRetry:()=>Dt(y=>y+1)});if(ne.type==="turn")return n.jsx(mr,{path:ne.path,subtitle:a("diffView.scope.lastTurn"),diff:Ma.get(ne.path)??null,fileExists:Yn.some(y=>y.path===ne.path),onBack:()=>pe(Ut)});const tr=a(H==="pr"?_n("session.githubIntegration.tabs.pullRequests",gt):H==="branch"?"diffView.scope.branch":H==="commit"?"commitComparison.mode":H==="turn"?"diffView.scope.lastTurn":"mobile.nav.changes"),sr=H==="branch"&&ie.base?Fu(ie.base):H==="commit"?ht?.slice(0,8):H==="pr"&&St?`#${St.number}`:null;if(ne.type==="walkthrough"&&en&&f)return n.jsx(Ei.Provider,{value:Jt,children:n.jsx(xg,{directory:f,target:en,subtitle:[tr,sr].filter(Boolean).join(" · "),revision:JSON.stringify([ss,H==="pr"?Ke.revision:0]),visible:o,onBack:()=>pe(Ut)})});if(_t&&Tt)return n.jsx(Ei.Provider,{value:Jt,children:n.jsx(mr,{path:_t,subtitle:[tr,sr].filter(Boolean).join(" · "),commentOrigin:ms,diff:Sn??(Tt.status==="ready"?Tt.diff:null),fileExists:!Ke.files||Ke.files.some(y=>y.path===_t),error:Ke.error??(Tt.status==="error"?Tt.message:null),onBack:()=>pe(Ut),onRetry:()=>{Ke.error&&Ke.refresh(),rt(y=>y+1)},onExpandContextRequest:Tt.status==="ready"?y=>ri({source:Tt,request:y}):void 0,pendingContextExpansion:kn,contextLoading:kn!==null&&!Sn})});const Ja=()=>H==="pr"&&Ue.diffUnavailable?n.jsx(Dm,{provider:Ue.provider,className:"h-full"}):H==="pr"&&!St?n.jsx(Pt,{loading:Ue.loading,message:Ue.error??(Ue.loading?a(_n("session.githubPrPicker.loading.pullRequests",gt)):a(_n("pullRequestComparison.select",gt)))}):H==="branch"&&!ie.base?n.jsx(Pt,{loading:!ie.resolved,message:ie.resolved?a("gitView.pr.toast.baseBranchRequired"):a("diffView.branch.resolvingBase")}):H==="commit"&&!ht?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 text-center",children:[Ye.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:Ye.loading?a("diffView.state.loadingChanges"):Ye.error??a("commitComparison.noCommits")}),Ye.error&&n.jsx(Ae,{variant:"outline",size:"lg",onClick:()=>{Ye.refresh()},children:a("diffView.actions.retry")})]}):Ke.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:a("diffView.state.failedToLoadDiff")}),n.jsx("p",{className:"typography-meta text-muted-foreground",children:Ke.error}),n.jsx(Ae,{variant:"outline",size:"lg",onClick:()=>{Ke.refresh()},children:a("diffView.actions.retry")})]}):qt?qt.length===0?n.jsx(Pt,{icon:H==="branch",message:H==="pr"?a("walkthrough.blocked.emptyDiff.description"):H==="commit"?a("commitComparison.emptyDiff"):a("diffView.branch.empty",{base:sr??""})}):n.jsx(po,{files:qt,onSelect:y=>{Ke.key&&pe({type:"comparison",path:y,sourceKey:Ke.key})}}):n.jsx(Pt,{loading:!0,message:a("diffView.state.loadingChanges")}),Ya=()=>Ps?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:a("diffView.state.failedToLoadDiff")}),n.jsx("p",{className:"typography-meta text-muted-foreground",children:Ps}),n.jsx(Ae,{variant:"outline",size:"lg",onClick:us,children:a("diffView.actions.retry")})]}):(!Zs||te)&&Lt?n.jsx(Pt,{loading:!0,message:a("diffView.state.loadingChanges")}):Yn.length===0?n.jsx(Pt,{message:a("diffView.state.noLastTurnChanges")}):n.jsx(po,{files:Yn,onSelect:y=>pe({type:"turn",path:y})});return n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[li,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:Nt,"aria-label":a("mobile.surface.closeAria"),onClick:t,style:{touchAction:"manipulation"},children:n.jsx(G,{name:"close",className:"size-5"})}):null,n.jsxs(vr,{open:Te,onOpenChange:se,children:[n.jsx(wr,{asChild:!0,children:n.jsxs(Ae,{variant:"ghost",className:ed({size:"mobile"}),"data-mobile-comparison-trigger":!0,"aria-label":a("diffView.scope.selectorAria"),children:[n.jsx("span",{children:H==="pr"&&gt==="pullRequest"?"PR":H==="pr"&&gt==="mergeRequest"?"MR":tr}),n.jsx(G,{name:"arrow-down-s",className:"size-4"})]})}),n.jsx(jr,{align:"start",children:n.jsxs(td,{value:H,onValueChange:y=>{(y==="working"||y==="turn"||y==="branch"||y==="commit"||y==="pr")&&xe(y)},children:[n.jsx(rn,{value:"working",className:"min-h-8 items-center",children:a("mobile.nav.changes")}),n.jsx(rn,{value:"turn",className:"min-h-8 items-center",children:a("diffView.scope.lastTurn")}),Re&&n.jsx(rn,{value:"branch",className:"min-h-8 items-center",children:a("diffView.scope.branch")}),n.jsx(rn,{value:"commit",className:"min-h-8 items-center",children:a("commitComparison.mode")}),n.jsx(rn,{value:"pr",className:"min-h-8 items-center",children:a(_n("session.githubIntegration.tabs.pullRequests",gt))})]})})]}),ci,o&&H==="branch"&&n.jsx(_m,{mobile:!0,branches:h?.all??[],currentBranch:Me,base:ie.base,automatic:ie.source!=="chosen",onSelect:y=>{Me&&pt(f,Me,y)},onSelectAutomatic:()=>{Me&&vt(f,Me)}},JSON.stringify([B,Me])),o&&H==="commit"&&n.jsx(Tm,{mobile:!0,commits:Ye.commits,selectedHash:ht,loading:Ye.loading,error:Ye.error,onSelect:Ye.select,onRefresh:()=>{Ye.refresh()}},JSON.stringify([B,Me])),o&&H==="pr"&&n.jsxs(n.Fragment,{children:[n.jsx(Am,{mobile:!0,comparison:Ue},JSON.stringify([B,Me])),St&&n.jsx(Ae,{variant:"ghost",size:"sm",disabled:Ke.loading,"aria-label":a("session.githubIssuePicker.actions.refresh"),onClick:()=>{Ke.refresh()},children:n.jsx(G,{name:"refresh",className:"size-4"})})]}),en&&n.jsx(Ae,{variant:"ghost",size:"icon",className:"ms-auto shrink-0",onClick:()=>pe({type:"walkthrough"}),"aria-label":a("walkthrough.action.open"),title:a("walkthrough.action.open"),style:{touchAction:"manipulation"},children:n.jsx(G,{name:"route",className:"size-5"})}),o&&H==="pr"&&Jt&&rs?n.jsx(Pm,{review:Jt,provider:rs,className:en?void 0:"ms-auto"}):null,H==="working"&&Lt&&(b?.files?.length??0)>0?n.jsxs(Ae,{variant:"outline",className:ae("shrink-0",!en&&"ms-auto"),disabled:Ht.submitting,onClick:()=>js(!0),"aria-label":a("diffView.actions.reviewAria"),style:{touchAction:"manipulation"},children:[n.jsx(G,{name:Ht.submitting?"loader-4":"search-eye",className:ae("size-4",Ht.submitting&&"animate-spin")}),a("chat.work.reviewHint.aiReview")]}):null]}),n.jsx(sd,{open:fs,onOpenChange:js,projectDirectory:s||null,submitting:Ht.submitting,onConfirm:Ht.start}),H==="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(nd,{currentBranch:b?.current,localBranches:Fa,remoteBranches:$a,branchInfo:h?.branches,currentBranchAhead:b?.ahead,onCheckout:y=>{Wa(y)},onCreate:Ka,disabled:P,directory:f,switchBlockedNotice:(b?.files?.length??0)>0?a("gitView.branch.switchBlockedNotice"):null})}),n.jsx(rd,{activeProfile:Xt,quiet:!0,identities:F,attention:ds,triggerClassName:"max-w-[10rem] shrink [&_.git-identity-label]:hidden sm:[&_.git-identity-label]:inline",onOpen:()=>{R(u,E.map(y=>y.account))},onSelect:y=>{T(y)},isApplying:_,onConfigure:()=>N(!0),applicability:y=>{const z=Ge.read?.repository.remotes.find(le=>le.name===De);return z?id(y,od(z.fetch.displayUrl),A):{applicable:!0}}}),n.jsx(ad,{syncAction:st.entry?.executing?Ee:null,remotes:La,onFetch:y=>{tn("fetch",y)},onPull:y=>{tn("pull",y)},onSync:y=>{tn("sync",y)},onPublish:()=>{tn("publish")},onChooseSyncTargets:()=>{tn("sync",void 0,!0)},currentBranch:b?.current,hasTracking:!!b?.tracking,disabled:P||st.blocked,aheadCount:b?.ahead??0,behindCount:b?.behind??0,trackingRemoteName:b?.tracking?.split("/")[0],trackingBranch:b?.tracking,hasUncommittedChanges:ld(Ct),choosesPushDestination:x})]}),n.jsx(dm,{open:w,onOpenChange:N,directory:f}),n.jsx(cd,{className:"mx-3 mt-3",entry:st.entry,onRefresh:()=>{st.refresh()},onCancel:()=>{st.cancel()}}),H==="working"&&n.jsx(um,{mergeInProgress:b?.mergeInProgress,rebaseInProgress:b?.rebaseInProgress,onContinue:Ua,onAbort:()=>ai(nn?"merge":"rebase"),onResolveWithAI:Ga,conflictCount:qa,isLoading:Ee!==null||ge!==null}),H==="turn"?n.jsx("div",{className:"min-h-0 flex-1",children:Ya()}):H!=="working"?n.jsx("div",{className:"min-h-0 flex-1",children:Ja()}):Ct.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(fm,{groups:Xa,diffStats:b?.diffStats,revertingPaths:Ne,onRevertAll:ii,isRevertingAll:_e,headerBackgroundClassName:"bg-transparent",onVisiblePathsChange:J})}),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(mm,{stagedCount:cs.length,commitMessage:W,onCommitMessageChange:de,generatedHighlights:Je,onInsertHighlights:Va,onGenerateMessage:Ha,isGeneratingMessage:Ve,onCommit:y=>{oi({pushAfter:!1,origin:y})},onCommitAndPush:y=>{oi({pushAfter:!0,origin:y})},commitAction:ge,networkOperationBlocked:st.blocked,gitmojiEnabled:!1,onOpenGitmojiPicker:()=>{}})})]}):n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(Cg,{})}),f&&n.jsx(pm,{open:ft,onOpenChange:yt,conflictFiles:Et,directory:f,operation:et,onAbort:()=>{ai(et)},onNavigatedToChat:i}),n.jsx(hm,{open:ut!==null,onOpenChange:y=>{y||at(null)},targetBranch:ut??"",changedFileCount:b?.files?.length??0,onCommitAndSwitch:(y,z)=>vg(y,z,{targetBranch:ut,directory:f,sourceBranch:b?.current??null,git:l,publishChooser:We,toast:he,t:a,refreshStatusAndBranches:At,closeDialog:()=>at(null),performCheckout:Cn}),onGenerateMessage:async()=>{if(!f)return"";const y=(b?.files??[]).map(le=>le.path).sort(),{message:z}=await ji(f,y);return z.subject?.trim()??""},onRevertAndSwitch:async()=>{const y=ut;if(!y||!f)return;await ii((b?.files??[]).map(le=>le.path));const z=await l.getGitStatus(f);if(!z.isClean&&(z.files?.length??0)>0){he.error(a("gitView.dirtySwitch.revertIncomplete"));return}at(null),await Cn(y)}})]})},Pt=s=>{const e=re.c(13),{message:t,description:r,loading:o,icon:i}=s,a=o===void 0?!1:o,l=i===void 0?!1:i;let u;e[0]!==a?(u=a?n.jsx(G,{name:"loader-4",className:"size-5 animate-spin text-muted-foreground"}):null,e[0]=a,e[1]=u):u=e[1];let c;e[2]!==l?(c=l?n.jsx(G,{name:"git-branch",className:"size-6 text-muted-foreground"}):null,e[2]=l,e[3]=c):c=e[3];let d;e[4]!==t?(d=n.jsx("p",{className:"typography-ui-label font-semibold text-foreground",children:t}),e[4]=t,e[5]=d):d=e[5];let p;e[6]!==r?(p=r?n.jsx("p",{className:"typography-meta text-muted-foreground",children:r}):null,e[6]=r,e[7]=p):p=e[7];let g;return e[8]!==u||e[9]!==c||e[10]!==d||e[11]!==p?(g=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:[u,c,d,p]})}),e[8]=u,e[9]=c,e[10]=d,e[11]=p,e[12]=g):g=e[12],g},Cg=()=>{const s=re.c(7),{t:e}=be();let t;s[0]!==e?(t=e("mobile.changes.cleanDescription"),s[0]=e,s[1]=t):t=s[1];const r=gm(t);let o;s[2]!==e?(o=e("gitView.empty.cleanTitle"),s[2]=e,s[3]=o):o=s[3];let i;return s[4]!==r||s[5]!==o?(i=n.jsx(Pt,{icon:!0,message:o,description:r}),s[4]=r,s[5]=o,s[6]=i):i=s[6],i},mr=s=>{const e=re.c(69),{path:t,subtitle:r,diff:o,staged:i,fileExists:a,unavailableReason:l,error:u,onBack:c,onRetry:d,onExpandContextRequest:p,pendingContextExpansion:g,contextLoading:f,commentOrigin:b}=s,x=i===void 0?!1:i,h=l===void 0?null:l,v=u===void 0?null:u,{t:w}=be();let N;e[0]!==t?(N=ud(t)||"text",e[0]=t,e[1]=N):N=e[1];const _=N;let M;e[2]!==b||e[3]!==t?(M={fileLabel:t,origin:b},e[2]=b,e[3]=t,e[4]=M):M=e[4];const E=Bm(M);let j,C;if(e[5]!==t){const X=t.replace(/\/$/,""),te=X.lastIndexOf("/");j=X.slice(te+1),C=te>0?X.slice(0,te):null,e[5]=t,e[6]=j,e[7]=C}else j=e[6],C=e[7];const k=C;let L;e[8]===Symbol.for("react.memo_cache_sentinel")?(L=ae(bs,"border-b border-edge text-foreground"),e[8]=L):L=e[8];let I;e[9]!==w?(I=w("header.actions.backAria"),e[9]=w,e[10]=I):I=e[10];let A;e[11]===Symbol.for("react.memo_cache_sentinel")?(A=n.jsx(G,{name:"arrow-left",className:"size-5"}),e[11]=A):A=e[11];let R;e[12]!==c||e[13]!==I?(R=n.jsx("button",{type:"button",className:Nt,"aria-label":I,onClick:c,children:A}),e[12]=c,e[13]=I,e[14]=R):R=e[14];let F;e[15]===Symbol.for("react.memo_cache_sentinel")?(F=ae("oc-ui-start-align truncate",vn),e[15]=F):F=e[15];let T;e[16]!==j?(T=n.jsx("h2",{dir:"ltr",className:F,children:j}),e[16]=j,e[17]=T):T=e[17];let S;e[18]!==k?(S=k?n.jsx("span",{dir:"ltr",className:"oc-ui-start-align min-w-0 truncate",children:k}):null,e[18]=k,e[19]=S):S=e[19];let P;e[20]!==k||e[21]!==r?(P=k&&r?n.jsx("span",{"aria-hidden":!0,className:"shrink-0 opacity-60",children:"·"}):null,e[20]=k,e[21]=r,e[22]=P):P=e[22];let D;e[23]!==r?(D=r?n.jsx("span",{className:"min-w-0 max-w-full shrink-0 truncate",children:r}):null,e[23]=r,e[24]=D):D=e[24];let $;e[25]!==S||e[26]!==P||e[27]!==D?($=n.jsxs("p",{className:"flex min-w-0 items-baseline gap-1.5 typography-micro text-muted-foreground",children:[S,P,D]}),e[25]=S,e[26]=P,e[27]=D,e[28]=$):$=e[28];let K;e[29]!==t||e[30]!==T||e[31]!==$?(K=n.jsxs("div",{className:"min-w-0 flex-1 px-1",title:t,children:[T,$]}),e[29]=t,e[30]=T,e[31]=$,e[32]=K):K=e[32];const U=E.isOpen?"text-foreground":"text-muted-foreground";let O;e[33]!==U?(O=ae(Nt,U),e[33]=U,e[34]=O):O=e[34];let V;e[35]!==w?(V=w("inlineComment.actions.commentOnFile"),e[35]=w,e[36]=V):V=e[36];const q=E.isOpen;let ee;e[37]!==w?(ee=w("inlineComment.actions.commentOnFile"),e[37]=w,e[38]=ee):ee=e[38];let Z;e[39]===Symbol.for("react.memo_cache_sentinel")?(Z=n.jsx(G,{name:"chat-1",className:"size-5"}),e[39]=Z):Z=e[39];let Y;e[40]!==O||e[41]!==V||e[42]!==ee||e[43]!==E.isOpen||e[44]!==E.toggle?(Y=n.jsx("button",{type:"button",className:O,"aria-label":V,"aria-pressed":q,title:ee,onClick:E.toggle,children:Z}),e[40]=O,e[41]=V,e[42]=ee,e[43]=E.isOpen,e[44]=E.toggle,e[45]=Y):Y=e[45];let B;e[46]!==R||e[47]!==K||e[48]!==Y?(B=n.jsxs("header",{className:L,children:[R,K,Y]}),e[46]=R,e[47]=K,e[48]=Y,e[49]=B):B=e[49];let Q;e[50]!==b||e[51]!==f||e[52]!==o||e[53]!==v||e[54]!==a||e[55]!==_||e[56]!==p||e[57]!==d||e[58]!==t||e[59]!==g||e[60]!==x||e[61]!==w||e[62]!==h?(Q=n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:a?h==="nested_repository"?n.jsx(Pt,{icon:!0,message:w("diffView.unavailable.nestedRepositoryTitle"),description:w("diffView.unavailable.nestedRepositoryDescription")}):h==="untracked_directory"?n.jsx(Pt,{icon:!0,message:w("diffView.unavailable.untrackedDirectoryTitle"),description:w("diffView.unavailable.untrackedDirectoryDescription")}):v?n.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center",children:n.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-3",children:[n.jsx("p",{className:"typography-ui-label font-semibold text-foreground",children:w("mobile.changes.diffDetail.loadFailed")}),n.jsx("p",{className:"typography-meta text-muted-foreground",children:v}),n.jsx(Ae,{type:"button",size:"sm",variant:"outline",onClick:()=>d?.(),children:w("diffView.actions.retry")})]})}):o?o.submodule?n.jsx("div",{className:"p-3",children:n.jsx(lm,{state:o.submodule,staged:x})}):o.isBinary?n.jsx(Pt,{icon:!0,message:w("diffView.binary.unavailable")}):Uo(t)&&ea(o.original,o.modified)?n.jsx(Yt,{outerClassName:"h-full",className:"p-3",disableHorizontal:!0,"data-diff-virtual-root":!0,"data-diff-virtual-content":!0,children:n.jsx(Lm,{filePath:t,original:o.original,modified:o.modified,renderText:X=>n.jsx(Pi,{original:X.original,modified:X.modified,language:"text",fileName:t,commentOrigin:b,renderSideBySide:!1,wrapLines:!0,layout:"inline"})})}):fd(t)&&!o.fileDiff?n.jsx(Pt,{icon:!0,message:w("mobile.changes.diffDetail.imageUnavailable")}):n.jsx(Yt,{outerClassName:"h-full",className:"p-3",useScrollShadow:!0,disableHorizontal:!0,"data-diff-virtual-root":!0,"data-diff-virtual-content":!0,children:n.jsx(Pi,{original:o.original,modified:o.modified,fileDiff:o.fileDiff,language:_,fileName:t,commentOrigin:b,renderSideBySide:!1,wrapLines:!0,layout:"inline",onExpandContextRequest:p,pendingContextExpansion:g,contextLoading:f})}):n.jsx(Pt,{loading:!0,message:w("diffView.state.loadingDiff")}):n.jsx(Pt,{icon:!0,message:w("mobile.changes.diffDetail.missingTitle"),description:w("mobile.changes.diffDetail.missingDescription")})}),e[50]=b,e[51]=f,e[52]=o,e[53]=v,e[54]=a,e[55]=_,e[56]=p,e[57]=d,e[58]=t,e[59]=g,e[60]=x,e[61]=w,e[62]=h,e[63]=Q):Q=e[63];let oe;return e[64]!==B||e[65]!==Q||e[66]!==E.cards||e[67]!==E.editor?(oe=n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[B,E.cards,E.editor,Q]}),e[64]=B,e[65]=Q,e[66]=E.cards,e[67]=E.editor,e[68]=oe):oe=e[68],oe},po=s=>{const e=re.c(12),{files:t,onSelect:r}=s,{t:o}=be();let i;e[0]!==o?(i=o("gitView.changes.changedFilesAria"),e[0]=o,e[1]=i):i=e[1];let a;if(e[2]!==t||e[3]!==r||e[4]!==o){let u;e[6]!==r||e[7]!==o?(u=c=>{const d=c.status==="A"?o("diffView.change.new"):c.status==="D"?o("diffView.change.deleted"):c.status==="R"?o("diffView.change.renamed"):c.status==="C"?o("diffView.change.copied"):o("diffView.change.modified"),p=c.status==="A"?"var(--status-success)":c.status==="D"?"var(--status-error)":c.status==="R"||c.status==="C"?"var(--status-info)":"var(--status-warning)";return n.jsx("li",{children:n.jsxs("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:()=>r(c.path),children:[n.jsx("span",{className:"w-4 shrink-0 text-center typography-micro font-semibold uppercase",style:{color:p},"aria-label":d,children:c.status}),n.jsx(Go,{filePath:c.path,className:"size-3.5 shrink-0"}),n.jsx(xm,{path:c.path,nameFirst:!0,className:"flex-1 typography-ui-label"}),(c.insertions>0||c.deletions>0)&&n.jsx(bm,{insertions:c.insertions,deletions:c.deletions,hideZero:!0})]})},c.path)},e[6]=r,e[7]=o,e[8]=u):u=e[8],a=t.map(u),e[2]=t,e[3]=r,e[4]=o,e[5]=a}else a=e[5];let l;return e[9]!==i||e[10]!==a?(l=n.jsx(Yt,{outerClassName:"h-full",className:"px-2 py-1",useScrollShadow:!0,disableHorizontal:!0,children:n.jsx("ul",{"aria-label":i,className:"flex flex-col",children:a})}),e[9]=i,e[10]=a,e[11]=l):l=e[11],l},Ng=m.lazy(()=>gn(()=>import("./FilesView-CPrroDyU.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,219,220,221,222,223,224])).then(s=>({default:s.FilesView}))),es=s=>yn(s)??"",pn=s=>{const e=es(s);return!e||e==="/"?e||"/":e.split("/").filter(Boolean).at(-1)??e},Rg=s=>{const e=es(s);if(!e||e==="/")return null;const t=e.lastIndexOf("/");return t<=0?e.startsWith("/")?"/":null:e.slice(0,t)},Eg=(s,e)=>{const t=es(s),r=es(e);return!r||t===r?pn(t):t.startsWith(`${r}/`)?t.slice(r.length+1):t},Ig=s=>{if(typeof s!="number"||!Number.isFinite(s)||s<0)return"";if(s<1024)return`${s} B`;const e=["KB","MB","GB"];let t=s/1024;for(const r of e){if(t<1024||r===e[e.length-1])return`${t.toFixed(t>=10?0:1)} ${r}`;t/=1024}return""},_g=s=>{const e=re.c(5),{onClose:t,visible:r}=s,o=r===void 0?!0:r,i=Ho(),a=es(qo(i,Br()));if(i?.kind==="preparing"){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Yo,{}),e[0]=u):u=e[0],u}let l;return e[1]!==t||e[2]!==a||e[3]!==o?(l=n.jsx(Tg,{root:a,onClose:t,visible:o},a),e[1]=t,e[2]=a,e[3]=o,e[4]=l):l=e[4],l},Tg=({root:s,onClose:e,visible:t})=>{const{t:r}=be(),{files:o}=Or(),i=hl(),a=gl(B=>B.setSelectedPath),[l,u]=m.useState(()=>({type:"browser",directory:s})),[c,d]=m.useState([]),[p,g]=m.useState(!1),[f,b]=m.useState(null),[x,h]=m.useState(""),[v,w]=m.useState([]),[N,_]=m.useState(!1),M=m.useRef(0),E=l.type==="browser"?l.directory:l.returnDirectory,j=m.useRef(E);j.current=E;const C=m.useCallback(async(B,Q)=>{if(!B)return;const oe=!i,X=M.current+1;M.current=X,g(!0),Q?.background||b(null);try{const te=await o.listDirectory(B,{respectGitignore:oe});if(M.current!==X)return;b(null),d(te.entries.slice().sort((ce,ue)=>ce.isDirectory!==ue.isDirectory?ce.isDirectory?-1:1:ce.name.localeCompare(ue.name)))}catch(te){if(M.current!==X)return;if(Q?.background){console.error("Failed to reload mobile directory:",te);return}d([]),b(te instanceof Error?te.message:r("mobile.files.error.listFailed"))}finally{M.current===X&&g(!1)}},[o,i,r]);m.useEffect(()=>{l.type==="browser"&&C(l.directory)},[C,l]);const k=m.useRef(l);k.current=l;const L=m.useRef(c);L.current=c;const I=m.useCallback(({directories:B})=>{const Q=k.current;Q.type==="browser"&&(B&&!B.some(oe=>es(oe)===es(Q.directory))||L.current.length>Wu||C(Q.directory,{background:!0}))},[C]);Ku({root:s,active:t,whileInactive:"hold",onChanges:I});const A=m.useCallback(async B=>{es(B)===es(j.current)&&await C(j.current)},[C]),{canUpload:R,uploadingDirectory:F,pickFiles:T,uploadElements:S}=Vu({root:s,refreshDirectory:A}),P=F!==null;m.useEffect(()=>{if(l.type!=="browser")return;const B=x.trim();if(!B){w([]),_(!1);return}let Q=!1;const oe=window.setTimeout(()=>{_(!0),o.search({directory:l.directory,query:B,maxResults:40}).then(X=>{Q||w(X)}).catch(()=>{Q||w([])}).finally(()=>{Q||_(!1)})},250);return()=>{Q=!0,window.clearTimeout(oe)}},[o,x,l]);const D=B=>{h(""),u({type:"browser",directory:B})},$=B=>{a(s,B),u({type:"file",path:B,returnDirectory:E||s})},K=Xe(B=>B.pendingFileFocusPath),U=Xe(B=>B.pendingFileNavigation);if(m.useEffect(()=>{const B=es(U?.path??K??"");!B||!s||(a(s,B,{allowOutsideRoot:!0}),u(Q=>({type:"file",path:B,returnDirectory:Q.type==="file"?Q.returnDirectory:s})),K&&Xe.getState().setPendingFileFocusPath(null))},[K,U,s,a]),!s)return n.jsx(hn,{message:r("mobile.files.empty.noDirectory")});if(l.type==="file")return n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[n.jsxs("header",{className:ae(bs,"border-b border-edge text-foreground"),children:[n.jsx("button",{type:"button",className:Nt,"aria-label":r("header.actions.backAria"),onClick:()=>u({type:"browser",directory:l.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:ae("truncate",vn),children:pn(l.path)})})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:n.jsx(bt,{children:n.jsx(m.Suspense,{fallback:n.jsx(hn,{loading:!0,message:r("filesView.state.loading")}),children:n.jsx(Ng,{mode:"editor-only"})})})})]});const O=l.directory===s?r("mobile.files.rootDirectory"):pn(l.directory),V=x.trim()?v:[],q=Rg(l.directory),ee=l.directory!==s&&q!==null&&(q===s||q.startsWith(`${s}/`)),Z=ee&&!x.trim(),Y=ee?q:null;return n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[S,n.jsxs("div",{className:"shrink-0 px-2 pt-1",children:[n.jsx(xd,{value:x,onChange:h,placeholder:r("mobile.files.search.placeholder"),actions:n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",className:pr,"aria-label":r("mobile.files.refreshAria"),onClick:()=>{C(l.directory)},children:n.jsx($f,{className:ae("size-4",p&&"animate-spin")})}),R?n.jsx("button",{type:"button",className:pr,"aria-label":r("sidebarFilesTree.actions.uploadFilesTitle"),onClick:()=>T(l.directory),disabled:P,children:n.jsx(G,{name:P?"loader-4":"upload-2",className:ae("size-4",P&&"animate-spin")})}):null,e?n.jsx("button",{type:"button",className:pr,"aria-label":r("mobile.surface.closeAria"),onClick:e,children:n.jsx(Wf,{className:"size-4"})}):null]})}),Z&&Y?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":r("mobile.files.backToParentAria",{name:pn(Y)}),onClick:()=>D(Y),children:[n.jsx(Kf,{className:"size-4 shrink-0 text-muted-foreground"}),n.jsx("span",{className:"min-w-0 truncate typography-ui-label text-muted-foreground",children:O})]}):null]}),n.jsx(Yt,{outerClassName:"min-h-0 flex-1",className:"px-2 pb-3 pt-1",useScrollShadow:!0,disableHorizontal:!0,children:f?n.jsx(hn,{message:f}):x.trim()?n.jsx(Ag,{root:s,results:V,isSearching:N,onOpenFile:$}):n.jsxs(n.Fragment,{children:[c.length===0&&!p?n.jsx("div",{className:"px-4 py-8 text-center typography-ui-label text-muted-foreground",children:r("mobile.files.empty.directory")}):null,c.map(B=>n.jsx(Aa,{name:B.name,path:B.path,directory:B.isDirectory,meta:B.isDirectory?void 0:Ig(B.size),onClick:()=>B.isDirectory?D(B.path):$(B.path)},B.path))]})})]})},pr="-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",Aa=s=>{const e=re.c(16),{name:t,path:r,directory:o,meta:i,onClick:a}=s;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={touchAction:"manipulation"},e[0]=l):l=e[0];let u;e[1]!==o||e[2]!==r?(u=o?n.jsx(qf,{className:"size-4 shrink-0 text-primary/80"}):n.jsx(Go,{filePath:r,className:"size-4 shrink-0"}),e[1]=o,e[2]=r,e[3]=u):u=e[3];let c;e[4]!==t?(c=n.jsx("span",{className:"block min-w-0 flex-1 truncate typography-ui-label text-foreground",children:t}),e[4]=t,e[5]=c):c=e[5];let d;e[6]!==i?(d=i?n.jsx("span",{className:"min-w-0 max-w-[55%] shrink truncate typography-micro text-muted-foreground",dir:"auto",children:i}):null,e[6]=i,e[7]=d):d=e[7];let p;e[8]!==o?(p=o?n.jsx(Uf,{className:"size-4 shrink-0 text-muted-foreground"}):null,e[8]=o,e[9]=p):p=e[9];let g;return e[10]!==a||e[11]!==u||e[12]!==c||e[13]!==d||e[14]!==p?(g=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:a,style:l,children:[u,c,d,p]}),e[10]=a,e[11]=u,e[12]=c,e[13]=d,e[14]=p,e[15]=g):g=e[15],g},Ag=s=>{const e=re.c(17),{root:t,results:r,isSearching:o,onOpenFile:i}=s,{t:a}=be();if(o){let c;e[0]!==a?(c=a("common.loading"),e[0]=a,e[1]=c):c=e[1];let d;return e[2]!==c?(d=n.jsx(hn,{loading:!0,message:c}),e[2]=c,e[3]=d):d=e[3],d}if(r.length===0){let c;e[4]!==a?(c=a("mobile.files.search.empty"),e[4]=a,e[5]=c):c=e[5];let d;return e[6]!==c?(d=n.jsx(hn,{message:c}),e[6]=c,e[7]=d):d=e[7],d}let l;if(e[8]!==i||e[9]!==r||e[10]!==t){let c;e[12]!==i||e[13]!==t?(c=d=>n.jsx(Aa,{name:pn(d.path),path:d.path,directory:!1,meta:Eg(d.path,t),onClick:()=>i(d.path)},d.path),e[12]=i,e[13]=t,e[14]=c):c=e[14],l=r.map(c),e[8]=i,e[9]=r,e[10]=t,e[11]=l}else l=e[11];let u;return e[15]!==l?(u=n.jsx(n.Fragment,{children:l}),e[15]=l,e[16]=u):u=e[16],u},hn=s=>{const e=re.c(7),{message:t,loading:r}=s,o=r===void 0?!1:r;let i;e[0]!==o?(i=o?n.jsx(Vf,{className:"size-5 animate-spin text-muted-foreground"}):n.jsx(Hf,{className:"size-6 text-muted-foreground"}),e[0]=o,e[1]=i):i=e[1];let a;e[2]!==t?(a=n.jsx("p",{className:"typography-ui-label font-semibold text-foreground",children:t}),e[2]=t,e[3]=a):a=e[3];let l;return e[4]!==i||e[5]!==a?(l=n.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center",children:n.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-2",children:[i,a]})}),e[4]=i,e[5]=a,e[6]=l):l=e[6],l},Pg=s=>{const e=re.c(21),{visible:t,onLeave:r,sectionsDialogOpen:o,onSectionsDialogOpenChange:i}=s,{t:a}=be(),l=nt(Dg),u=Br()??null,c=yd(),[d,p]=m.useState(1);let g,f;e[0]!==t?(g=()=>{t&&p(Og)},f=[t],e[0]=t,e[1]=g,e[2]=f):(g=e[1],f=e[2]),m.useEffect(g,f);const b=!c.allSectionsHidden&&d===0;let x;e[3]!==u||e[4]!==c||e[5]!==r||e[6]!==l||e[7]!==t?(x=t&&!c.allSectionsHidden?n.jsx(vd.Provider,{value:r,children:n.jsx(wd.Provider,{value:!0,children:n.jsx(jd,{onChange:p,children:n.jsx(Yt,{useScrollShadow:!0,scrollShadowSize:24,outerClassName:"min-h-0 flex-1",className:"px-3 pb-4 pt-2",disableHorizontal:!0,children:n.jsx(kd,{sessionId:l,directory:u,repositoryEnabled:!Ar(u),layout:c})})})})}):null,e[3]=u,e[4]=c,e[5]=r,e[6]=l,e[7]=t,e[8]=x):x=e[8];let h;e[9]!==c.allSectionsHidden||e[10]!==i||e[11]!==b||e[12]!==a?(h=c.allSectionsHidden||b?n.jsxs("div",{className:"absolute inset-x-0 top-16 flex flex-col items-center px-6 text-center",children:[n.jsx("span",{className:"typography-ui-label text-muted-foreground",children:c.allSectionsHidden?a("chat.workStatus.sections.allHidden"):a("chat.workStatus.mobileEmpty")}),c.allSectionsHidden?n.jsx(Ae,{variant:"link",size:"sm",onClick:()=>i(!0),className:"mt-2 normal-case text-muted-foreground hover:text-foreground",children:a("chat.workStatus.sections.open")}):null]}):null,e[9]=c.allSectionsHidden,e[10]=i,e[11]=b,e[12]=a,e[13]=h):h=e[13];let v;e[14]!==i||e[15]!==o?(v=n.jsx(Sd,{open:o,onOpenChange:i}),e[14]=i,e[15]=o,e[16]=v):v=e[16];let w;return e[17]!==x||e[18]!==h||e[19]!==v?(w=n.jsxs("div",{className:"relative flex h-full min-h-0 flex-col",children:[x,h,v]}),e[17]=x,e[18]=h,e[19]=v,e[20]=w):w=e[20],w};function Dg(s){return s.currentSessionId}function Og(s){return Math.max(s,1)}const ho="mobile-surface-root",Mg=16,go=320,Lg="cubic-bezier(0.22, 1, 0.36, 1)",Bg=({open:s,onClose:e,tab:t,onTabChange:r,pendingChangesDiff:o,onOpenPlan:i,variant:a="drawer"})=>{const{t:l,direction:u}=be(),c=m.useRef(null),d=m.useRef(null),[p,g]=m.useState(!1),[f,b]=m.useState(s),x=m.useRef(e);m.useEffect(()=>{x.current=e},[e]);const h=Xe(T=>T.mobileWorkspaceTabOrder),v=Xe(T=>T.mobileWorkspaceHiddenTabs),w=Xe(T=>T.setMobileWorkspaceTabOrder),[N,_]=m.useState(!1),M=m.useRef(t);m.useEffect(()=>{M.current=t},[t]);const E=()=>x.current();si(d,{enabled:a==="drawer"&&s,...u==="rtl"?{onRightEdgeSwipe:E}:{onLeftEdgeSwipe:E}});const[j,C]=m.useState(()=>new Set);if(m.useEffect(()=>{s&&C(T=>{if(T.has(t))return T;const S=new Set(T);return S.add(t),S})},[s,t]),typeof document<"u"&&!c.current){let T=document.getElementById(ho);T||(T=document.createElement("div"),T.id=ho,document.body.appendChild(T)),c.current=T}if(m.useEffect(()=>{if(s){b(!0);const S=window.setTimeout(()=>g(!0),Mg);return()=>window.clearTimeout(S)}g(!1);const T=window.setTimeout(()=>b(!1),go+40);return()=>window.clearTimeout(T)},[s]),m.useEffect(()=>{if(!s)return;const T=document.body.style.overflow;a==="drawer"&&(document.body.style.overflow="hidden");const S=P=>{P.key!=="Escape"||M.current==="terminal"||Nd(P.target)||Mr(P)||x.current()};return document.addEventListener("keydown",S),()=>{a==="drawer"&&(document.body.style.overflow=T),document.removeEventListener("keydown",S)}},[s,a]),a==="drawer"&&!c.current)return null;const k={status:{id:"status",label:l("chat.workStatus.ariaLabel"),icon:n.jsx(G,{name:"list-indefinite",className:"h-3.5 w-3.5"})},changes:{id:"changes",label:l("mobile.menu.git"),icon:n.jsx(G,{name:"git-branch",className:"h-3.5 w-3.5"})},files:{id:"files",label:l("mobile.menu.files"),icon:n.jsx(G,{name:"file-text",className:"h-3.5 w-3.5"})},terminal:{id:"terminal",label:l("mobile.menu.terminal"),icon:n.jsx(G,{name:"terminal",className:"h-3.5 w-3.5"})},notes:{id:"notes",label:l("contextRail.surface.notes"),icon:n.jsx(G,{name:"sticky-note",className:"h-3.5 w-3.5"})}},L=bl(h,v,t),I=L.map(T=>k[T]),A=I.length===1?I[0]:null,R=(T,S)=>{const P=xl(h),D=P.findIndex(K=>K===T),$=P.findIndex(K=>K===S);D<0||$<0||w(Mf(P,D,$))},F=n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:bs,children:[n.jsx("div",{className:"flex h-9 min-w-0 flex-1 items-center",children:A?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:A.icon}),n.jsx("span",{className:"truncate",children:A.label})]}):f?n.jsx(Cd,{items:I,activeId:t,onSelect:T=>{const S=L.find(P=>P===T);S&&r(S)},onReorder:R,layoutMode:"fit",variant:"active-pill",nonCompositedIndicator:!0,inactiveTabsIconOnly:I.length>3,className:"h-full"}):null}),t==="status"?n.jsx("button",{type:"button",className:Nt,"aria-label":l("chat.workStatus.sections.open"),onClick:()=>_(!0),style:{touchAction:"manipulation"},children:n.jsx(G,{name:"equalizer-2",className:"size-5"})}):null,n.jsx("button",{type:"button",className:Nt,"aria-label":l("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:[j.has("status")?n.jsx("div",{className:ae("h-full",t!=="status"&&"hidden"),children:n.jsx(bt,{children:n.jsx(Pg,{visible:s&&t==="status",onLeave:e,sectionsDialogOpen:N,onSectionsDialogOpenChange:_})})}):null,j.has("changes")?n.jsx("div",{className:ae("h-full",t!=="changes"&&"hidden"),children:n.jsx(bt,{children:n.jsx(kg,{visible:s&&t==="changes",initialDiff:o,onNavigatedToChat:e})})},o?`changes:${o.path}:${o.staged}`:"changes"):null,j.has("files")?n.jsx("div",{className:ae("h-full",t!=="files"&&"hidden"),children:n.jsx(bt,{children:n.jsx(_g,{visible:s&&t==="files"})})}):null,j.has("terminal")?n.jsx("div",{className:ae("h-full",t!=="terminal"&&"hidden"),children:n.jsx(bt,{children:n.jsx(Hu,{visible:s&&t==="terminal"})})}):null,j.has("notes")?n.jsx("div",{className:ae("h-full",t!=="notes"&&"hidden"),children:n.jsx(bt,{children:n.jsx(qu,{visible:s&&t==="notes",onActionComplete:e,onOpenPlan:i})})}):null]})]});return a==="panel"?n.jsx("div",{className:"flex h-full min-h-0 flex-col bg-background text-foreground",children:F}):Es.createPortal(n.jsx("section",{ref:d,role:"dialog","aria-modal":"true","aria-label":l("mobile.header.openWorkspaceAria"),"aria-hidden":!s,className:"oc-keyboard-inset-surface oc-bottom-safe-surface fixed inset-0 z-50 flex flex-col bg-background text-foreground",style:{paddingTop:"var(--oc-safe-area-top, 0px)",transform:p?"none":u==="rtl"?"translateX(-100%)":"translateX(100%)",transition:`transform ${go}ms ${Lg}`,visibility:f?"visible":"hidden",pointerEvents:s?"auto":"none"},children:F}),c.current)};function zg(s){const e=re.c(4),t=2500,{uiFont:r}=Rd(),[o,i]=m.useState(!1);let a,l;return e[0]!==t||e[1]!==r?(a=()=>{let u=!1;const c=()=>{u||i(!0)},d=()=>{requestAnimationFrame(()=>requestAnimationFrame(c))},p=Promise.all([Ed(r).catch(Vg),document.fonts?.ready?.then(Kg).catch(Wg)??Promise.resolve(),zm.catch($g)]).then(Fg),g=new Promise(f=>{window.setTimeout(f,t)});return Promise.race([p,g]).then(d),()=>{u=!0}},l=[r,t],e[0]=t,e[1]=r,e[2]=a,e[3]=l):(a=e[2],l=e[3]),m.useEffect(a,l),o}function Fg(){}function $g(){}function Wg(){}function Kg(){}function Vg(){}const Hg=Fr({projectId:$s().trim().min(1).optional(),text:$s().optional()}),qg=Fr({request:Hg.nullish()}),Pa=Qo("ShortcutRequests"),Ug=async()=>{const s=qg.safeParse(await Pa.takePending());return s.success?s.data.request??null:null},Gg=s=>{if(Tr()!=="ios")return()=>{};let e=!1,t=null;const r=()=>{Ug().then(o=>{o&&s(o)}).catch(()=>{})};return Pa.addListener("pending",r).then(o=>{if(e){o.remove();return}t=o}).catch(()=>{}),r(),()=>{e=!0,t?.remove()}},Xg="openchamber",Jg=s=>s.replace(/^\/+|\/+$/g,""),Yg=s=>{const e=Jg(s.pathname).split("/").filter(Boolean);return s.host?[s.host,...e]:e};function Qg(s){if(typeof s!="string"||s.length===0)return null;let e;try{e=new URL(s)}catch{return null}if(e.protocol!==`${Xg}:`)return null;const t=Yg(e),r=(t[0]??"").toLowerCase(),o=t.slice(1),i=e.searchParams;switch(r){case"session":{const a=o[0]||i.get("id")||"";if(!a)return null;const l=i.get("message")?.trim()??"";return{type:"session",sessionId:a,directory:i.get("dir")??void 0,...Id(l)?{messageId:l}:{}}}case"new":case"new-session":return{type:"new-session",directory:i.get("dir")??void 0,projectId:i.get("project")??void 0,agent:i.get("agent")??void 0,model:i.get("model")??void 0};case"sessions":{const a=i.get("filter");return{type:"sessions",filter:a==="attention"||a==="recent"||a==="all"?a:void 0}}case"status":return{type:"status"};case"settings":return{type:"settings",section:o[0]||i.get("section")||void 0};case"changes":return{type:"changes",path:o.join("/")||i.get("path")||void 0,staged:i.get("staged")==="true"};case"view":{const a=(o[0]||"").toLowerCase();return a==="changes"?{type:"changes"}:a==="files"||a==="mcp"||a==="instances"||a==="update"?{type:"view",target:a}:null}default:return null}}let Wt={},Da=!1,dn=null;const Zg=s=>{const e=nt.getState(),t=s.projectId?Mt.getState().projects.find(o=>o.id===s.projectId)??null:null;e.openNewSessionDraft(t?{selectedProjectId:t.id}:void 0);const r=s.text?.trim();if(r){if(s.projectId&&!t){ki.getState().setPendingInputText(r,"append");return}ki.getState().requestDraftSubmit(nt.getState().newSessionDraft.draftId,r)}},eb=s=>{switch(s.type){case"shortcut-new-session":return Zg(s),!0;case"session":return _d(s.sessionId,{directory:s.directory??null,messageId:s.messageId??null}),!0;case"new-session":{const e=nt.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 Wt.openSessions?(Wt.openSessions(s.filter),!0):!1;case"status":return Wt.openSessions?(Wt.openSessions(),!0):!1;case"view":return Wt.openView?(Wt.openView(s.target),!0):!1;case"changes":return Wt.openChanges?(Wt.openChanges({path:s.path,staged:s.staged}),!0):!1;case"settings":return Wt.openSettings?(Wt.openSettings(s.section),!0):!1}},ni=()=>{if(!Da||!dn)return;const s=dn;dn=null,eb(s)||(dn=s)},_r=s=>{dn=s,ni()},bo=s=>{const e=Qg(s);e&&_r(e)},tb=s=>{Da=s,ni()},sb=s=>{const e=re.c(3);let t,r;e[0]!==s?(t=()=>(Wt=s,ni(),()=>{Wt===s&&(Wt={})}),r=[s],e[0]=s,e[1]=t,e[2]=r):(t=e[1],r=e[2]),m.useEffect(t,r)},nb=s=>{const{ready:e}=s;m.useEffect(()=>{tb(e)},[e]),m.useEffect(()=>{if(!ct())return;let t=!1;const r=[];return gn(()=>import("./vendor-capacitor-app-BrDJj9I_.js"),__vite__mapDeps([225,1,109])).then(async({App:o})=>{if(t)return;const i=await o.addListener("appUrlOpen",a=>{bo(a?.url)});if(t){i.remove();return}r.push(()=>{i.remove()})}).catch(()=>{}),r.push(Gg(o=>{_r({type:"shortcut-new-session",projectId:o.projectId,text:o.text})})),gn(()=>import("./vendor-capacitor-push-notifications-KNe1zSBF.js"),__vite__mapDeps([226,109])).then(async({PushNotifications:o})=>{if(t)return;const i=await o.addListener("pushNotificationActionPerformed",a=>{const l=a?.notification?.data,u=typeof l?.url=="string"?l.url:typeof l?.deeplink=="string"?l.deeplink:void 0;if(u){bo(u);return}const c=typeof l?.sessionId=="string"?l.sessionId:void 0;c&&_r({type:"session",sessionId:c})});if(t){i.remove();return}r.push(()=>{i.remove()})}).catch(()=>{}),()=>{t=!0,r.forEach(o=>o())}},[])},rb=()=>{if(typeof window>"u")return;const s=window.__OPENCHAMBER_APNS_ENV__;if(s==="development")return"sandbox";if(s==="production")return"production"},xo=/^[A-Za-z0-9+/]{43}=$/,ib=Qo("PushKey"),ob=async()=>{const s=window.__OPENCHAMBER_PUSH_KEY__;if(s&&xo.test(s))return s;const e=await ib.get().then(t=>t.key).catch(()=>{});return e&&xo.test(e)?e:void 0},ab=()=>{if(typeof window>"u")return!1;const e=window.Capacitor?.getPlatform?.();return e==="ios"||e==="android"},lb=s=>{const{enabled:e}=s,t=Xe(o=>o.nativeNotificationsEnabled),r=m.useRef(null);m.useEffect(()=>{if(!e||!t||!ab())return;let o=!1;const i=[];return gn(()=>import("./vendor-capacitor-push-notifications-KNe1zSBF.js"),__vite__mapDeps([226,109])).then(async({PushNotifications:a})=>{if(o)return;let l=await a.checkPermissions().catch(()=>null);if(l?.receive!=="granted"&&(l=await a.requestPermissions().catch(()=>null)),l?.receive!=="granted")return;const u=await a.addListener("registration",d=>{r.current=d.value,ob().then(p=>{const g=mi(),f={token:d.value,platform:Tr(),environment:rb()};p&&(f.pushKey=p),g?.push?.registerApnsToken?.(f)})}),c=await a.addListener("registrationError",d=>{console.warn("[Push] APNs registration error:",d)});if(await a.register().catch(()=>{}),o){u.remove(),c.remove();return}i.push(()=>{u.remove()},()=>{c.remove()})}).catch(()=>{}),()=>{o=!0,i.forEach(a=>a())}},[e,t]),m.useEffect(()=>{if(t)return;const o=r.current;if(!o)return;r.current=null,mi()?.push?.unregisterApnsToken?.({token:o})},[t])},yo=s=>{const e=re.c(12),{side:t,isResizing:r,ariaLabel:o,handleProps:i}=s,a=t==="left"?"inset-e-0":"inset-s-0";let l;e[0]!==a?(l=ae("absolute inset-y-0 z-50 w-6 cursor-col-resize touch-none",a),e[0]=a,e[1]=l):l=e[1];const u=t==="left"?"inset-e-0":"inset-s-0",c=r&&"bg-[var(--interactive-border)]";let d;e[2]!==u||e[3]!==c?(d=ae("absolute inset-y-0 w-[3px] transition-colors",u,c),e[2]=u,e[3]=c,e[4]=d):d=e[4];let p;e[5]!==d?(p=n.jsx("div",{className:d}),e[5]=d,e[6]=p):p=e[6];let g;return e[7]!==o||e[8]!==i||e[9]!==l||e[10]!==p?(g=n.jsx("div",{className:l,role:"separator","aria-orientation":"vertical","aria-label":o,...i,children:p}),e[7]=o,e[8]=i,e[9]=l,e[10]=p,e[11]=g):g=e[11],g},cb=320,db=380,vo=280,ub=560,fb=900;function wo(s,e,t,r){const o=re.c(23),i=r===void 0?ub:r,a=m.useRef(null);let l;o[0]!==t||o[1]!==i||o[2]!==e?(l=()=>{if(typeof window>"u")return t;const R=Number.parseInt(window.localStorage.getItem(e)??"",10);return Number.isFinite(R)?Math.min(i,Math.max(vo,R)):t},o[0]=t,o[1]=i,o[2]=e,o[3]=l):l=o[3];const[u,c]=m.useState(l),[d,p]=m.useState(!1),g=m.useRef(0),f=m.useRef(u),b=m.useRef(null),x=m.useRef(null);let h;o[4]!==i?(h=R=>Math.min(i,Math.max(vo,Math.round(R))),o[4]=i,o[5]=h):h=o[5];const v=h;let w;o[6]===Symbol.for("react.memo_cache_sentinel")?(w=R=>{const F=a.current;F&&(F.style.width=`${R}px`,F.style.minWidth=`${R}px`,F.style.maxWidth=`${R}px`,F.style.setProperty("--oc-ipad-sidebar-width",`${R}px`))},o[6]=w):w=o[6];const N=w;let _;o[7]!==u?(_=R=>{try{R.currentTarget.setPointerCapture(R.pointerId)}catch{}x.current=R.pointerId,g.current=R.clientX,f.current=u,b.current=u,p(!0),R.preventDefault()},o[7]=u,o[8]=_):_=o[8];const M=_;let E;o[9]!==v||o[10]!==s?(E=R=>{if(x.current!==R.pointerId)return;const F=(s==="left"?1:-1)*(yl(R.currentTarget)?-1:1),T=v(f.current+(R.clientX-g.current)*F);b.current!==T&&(b.current=T,N(T))},o[9]=v,o[10]=s,o[11]=E):E=o[11];const j=E;let C;o[12]!==v||o[13]!==e?(C=R=>{if(x.current!==R.pointerId)return;try{R.currentTarget.releasePointerCapture(R.pointerId)}catch{}const F=v(b.current??f.current);x.current=null,b.current=null,p(!1),c(F);try{window.localStorage.setItem(e,String(F))}catch{}},o[12]=v,o[13]=e,o[14]=C):C=o[14];const k=C;let L;o[15]!==M||o[16]!==k||o[17]!==j?(L={onPointerDown:M,onPointerMove:j,onPointerUp:k,onPointerCancel:k},o[15]=M,o[16]=k,o[17]=j,o[18]=L):L=o[18];const I=L;let A;return o[19]!==I||o[20]!==d||o[21]!==u?(A={asideRef:a,width:u,isResizing:d,handleProps:I},o[19]=I,o[20]=d,o[21]=u,o[22]=A):A=o[22],A}const mb=()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,pb=200;function jo(s){const e=re.c(6),[t,r]=m.useState(!1),[o,i]=m.useState(s);s!==o&&(i(s),r(!s&&!mb()));let a,l;e[0]!==t?(a=()=>{if(!t)return;const d=window.setTimeout(()=>r(!1),pb);return()=>window.clearTimeout(d)},l=[t],e[0]=t,e[1]=a,e[2]=l):(a=e[1],l=e[2]),m.useEffect(a,l);const u=s||t;let c;return e[3]!==s||e[4]!==u?(c={placed:u,inPlace:s},e[3]=s,e[4]=u,e[5]=c):c=e[5],c}const ko=["general","isolated-spaces","appearance","chat","notifications","sessions","routing","git","magic-prompts","snippets","behavior","agents","commands","mcp","plugins","skills.installed","skills.catalog","providers","web-search","usage","voice","integrations","about"],hb=1e3,gb=({onActiveConnectionDeleted:s})=>{const{t:e,direction:t}=be();uf();const[r,o]=m.useState(!1);m.useEffect(()=>nt.subscribe((W,de)=>{W.currentSessionId&&W.currentSessionId!==de.currentSessionId&&Xe.getState().setRunOverviewKey(null)}),[]);const i=Xe(W=>W.runOverviewKey!==null);m.useEffect(()=>{i&&o(!1)},[i]);const[a,l]=m.useState(null),[u,c]=m.useState(!1),[d,p]=m.useState(()=>{const{mobileWorkspaceTabOrder:W,mobileWorkspaceHiddenTabs:de}=Xe.getState();return hi(W,de)[0]}),g=m.useCallback(()=>{const{mobileWorkspaceTabOrder:W,mobileWorkspaceHiddenTabs:de}=Xe.getState(),Ne=hi(W,de);p(Ie=>Ne.includes(Ie)?Ie:Ne[0]),c(!0)},[]),[f,b]=m.useState(null),[x,h]=m.useState("nav"),[v,w]=m.useState(null),N=Xe(W=>W.setSettingsPage),_=Xe(W=>W.wideChatLayoutEnabled),M=Cs(W=>W.available),E=Cs(W=>W.runtimeType),j=m.useMemo(()=>zr(),[]),C=m.useCallback(()=>{l(null),b(null)},[]),k=m.useCallback(W=>{l(W)},[]),L=m.useCallback(()=>{c(!1)},[]),I=m.useCallback(W=>{h(W),k("settings")},[k]);m.useEffect(()=>bg(ko,I),[I]);const{enabled:A,roomyForPanels:R}=Pr(),T=qd()==="portrait",S=Ud(),[P,D]=m.useState(()=>Gd().roomyForPanels),$=m.useCallback(()=>{D(W=>!W)},[]);m.useEffect(()=>{A||D(!1)},[A]);const K=m.useCallback(()=>{w(null),p("files"),c(!0)},[]);m.useEffect(()=>Ci(W=>{if(W.type!=="file-open-request")return;const de=W.directory??Fs.getState().currentDirectory;if(!de)return;const Ne=()=>{Xe.getState().openContextFile(de,W.path),K()},{sessionId:Ie}=W;if(!Ie){Ne();return}hg(Ie,async Fe=>Xs.getState().entityById.get(Fe)??await gr.getSession(Fe).catch(()=>null)).then(Fe=>{const Ve=()=>{const{currentSessionId:Je}=nt.getState();return Je===Ie||Fe.some(fe=>fe.id===Je)};if(Ve()){Ne();return}const He=Fe[0]?.title;he.info(gg(W.path),{id:`file-open-${Ie}:${W.path}`,description:He?e("chat.fileOpenRequest.toast.description",{session:He}):e("chat.fileOpenRequest.toast.descriptionUntitled"),action:{label:e("chat.fileOpenRequest.toast.openSession"),onClick:()=>{Xd(Ie,de),C(),o(!1),Ve()&&Ne()}}})})}),[C,K,e]),m.useEffect(()=>Ci(W=>{if(W.type!=="plan-open-request")return;const de=ff(W.directory??Fs.getState().currentDirectory,W.projectId);de&&b({id:W.planId,title:W.title,projectRef:de})}),[]);const U=m.useCallback((W=null)=>{w(W),p("changes"),c(!0)},[]),O=wo("left","openchamber.ipad.leftSidebarWidth",cb),V=wo("right","openchamber.ipad.rightSidebarWidth",db,fb),q=R,ee=jo(A&&P),Z=jo(q&&u),Y=q&&Z.placed?V.width:0,B=A&&ee.placed?O.width:0,Q=t==="rtl"?"100%":"-100%",oe=t==="rtl"?"-100%":"100%";m.useEffect(()=>(xr.setState({left:B,right:Y}),()=>xr.setState({left:0,right:0})),[B,Y]),m.useEffect(()=>{if(typeof document>"u")return;const W=document.documentElement;return W.classList.toggle("wide-chat-layout",_),()=>W.classList.remove("wide-chat-layout")},[_]),m.useEffect(()=>{if(typeof document>"u")return;const W=A&&(T||S),de=document.documentElement;return de.classList.toggle("oc-keep-draft-starters",W),()=>de.classList.remove("oc-keep-draft-starters")},[S,A,T]);const X=m.useMemo(()=>({openChanges:({diffPath:W,staged:de,scope:Ne}={})=>{U(W?{path:W,staged:de===!0,scope:Ne}:null)},openFiles:()=>K(),openSourceBoard:()=>k("board")}),[U,K,k]),te=m.useMemo(()=>({openSessions:()=>{A?D(!0):o(!0)},openView:W=>{if(W==="files"){K();return}if(W==="mcp"){p("status"),c(!0);return}k(W)},openChanges:({path:W,staged:de}={})=>{U(W?{path:W,staged:de===!0}:null)},openSettings:W=>{W&&N(W),I(W?"page-content":"nav")}}),[A,U,K,I,k,N]);sb(te);const ce=m.useRef(null),ue=()=>{A?D(!0):o(!0)},H=()=>g();si(ce,{onLeftEdgeSwipe:t==="rtl"?H:ue,onRightEdgeSwipe:t==="rtl"?ue:H});const ne=m.useRef(null),Te=m.useCallback(W=>{ne.current=W},[]),se=m.useCallback(()=>Jd()?!0:f?(b(null),!0):a==="settings"&&ne.current?.()?!0:a?(C(),!0):u?(L(),!0):r?(o(!1),!0):!1,[a,C,L,f,r,u]);Yd(se),Qd(se,!!(f||a||u||r));const xe=!j&&M&&(E==="desktop"||E==="web"),pe=A?"dialog":"fullscreen",ke=Xe(W=>W.overviewFeatureAvailable),Ee=m.useMemo(()=>({instanceLabel:j?Ss():null,onOpenInstances:j?()=>k("instances"):void 0,onOpenSettings:()=>I("nav"),onOpenUsage:()=>k("usage"),onOpenScheduled:()=>k("scheduled"),onOpenArchive:()=>k("archive"),onOpenOverview:ke?()=>k("overview"):void 0,onOpenSourceBoard:()=>k("board"),onOpenUpdate:xe?()=>k("update"):void 0}),[I,k,ke,j,xe]),ye=m.useCallback(W=>{C(),o(!1),W==="file"&&K()},[C,K]),ge=m.useCallback(()=>{C(),o(!1)},[C]),we=m.useCallback(()=>{C(),o(!1),A&&!R&&D(!1)},[C,A,R]),ve=m.useCallback(()=>{C(),o(!1),A&&!R&&D(!1)},[C,A,R]);return n.jsx(Zd,{actions:X,children:n.jsxs("div",{className:"oc-mobile-app-shell main-content-safe-area flex h-[100dvh] flex-row bg-background text-foreground","data-page-scroll-lock":"true",children:[A?n.jsxs("aside",{ref:O.asideRef,className:ae("oc-ipad-sidebar relative flex h-full shrink-0 flex-col overflow-hidden"),style:{width:B,minWidth:B,maxWidth:B,"--oc-ipad-sidebar-width":`${O.width}px`,overflowX:"clip"},"aria-hidden":!P,"data-page-scroll-lock":"true",children:[n.jsx("div",{className:ae("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",O.isResizing&&"pointer-events-none",!P&&"pointer-events-none select-none"),style:{width:"var(--oc-ipad-sidebar-width)",overflowX:"hidden",paddingTop:"var(--oc-safe-area-top, 0px)",translate:ee.inPlace?void 0:Q},children:n.jsx(bt,{children:n.jsx(io,{open:ee.placed,variant:"sidebar",onOpenChange:W=>{!W&&!R&&D(!1)},footer:Ee})})}),P?n.jsx(yo,{side:"left",isResizing:O.isResizing,ariaLabel:e("sidebar.resize.leftPanelAria"),handleProps:O.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(fh,{onOpenSessions:()=>A?$():o(!0),onOpenWorkspace:g,compactTitle:A}),n.jsxs("main",{ref:ce,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(bt,{children:n.jsx(mf,{})})}),n.jsx(bt,{children:n.jsx(kf,{})})]})]}),A?null:n.jsx(io,{open:r,onOpenChange:o,footer:Ee}),n.jsxs("aside",{ref:V.asideRef,className:ae("relative flex h-full shrink-0 flex-col overflow-hidden"),style:{width:Y,minWidth:Y,maxWidth:Y,"--oc-ipad-sidebar-width":`${V.width}px`,overflowX:"clip"},"aria-hidden":!Y,"data-page-scroll-lock":"true",children:[n.jsx("div",{className:ae("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",q&&"border-s border-edge bg-background",V.isResizing&&"pointer-events-none",!Z.inPlace&&"pointer-events-none select-none"),style:{width:"var(--oc-ipad-sidebar-width)",overflowX:"hidden",paddingTop:"var(--oc-safe-area-top, 0px)",translate:Z.inPlace?void 0:oe},children:n.jsx(bt,{children:n.jsx(Bg,{open:q?Z.placed:u,onClose:L,tab:d,onTabChange:p,pendingChangesDiff:v,onOpenPlan:b,variant:q?"panel":"drawer"})})}),q&&u?n.jsx(yo,{side:"right",isResizing:V.isResizing,ariaLabel:e("sidebar.resize.rightPanelAria"),handleProps:V.handleProps}):null]}),f?n.jsx(Zt,{open:!0,variant:pe,onClose:()=>b(null),ariaLabel:f.title,title:f.title,children:n.jsx(bt,{children:n.jsx(yf,{savedProjectPlan:{projectRef:f.projectRef,planId:f.id},onNavigatedToChat:()=>{C(),L()}})})}):null,a==="instances"&&j?n.jsx(Zt,{open:!0,variant:pe,dialogAlign:"app",onClose:C,ariaLabel:e("mobile.menu.instances"),title:e("mobile.menu.instances"),children:n.jsx(bh,{onConnect:C,onActiveConnectionDeleted:s})}):null,a==="settings"?n.jsx(Zt,{open:!0,variant:pe,dialogAlign:"app",onClose:C,ariaLabel:e("mobile.menu.settings"),headerless:!0,children:n.jsx(bt,{children:n.jsx(bf,{forceMobile:!0,isWindowed:!0,initialMobileStage:x,registerBackHandler:Te,visiblePageSlugs:[...ko],onClose:C})})}):null,a==="usage"?n.jsx(Zt,{open:!0,variant:pe,dialogAlign:"app",onClose:C,ariaLabel:e("usageStats.title"),title:e("usageStats.title"),children:n.jsx(bt,{children:n.jsx(Jf,{})})}):null,a==="scheduled"?n.jsx(Zt,{open:!0,variant:pe,dialogAlign:"app",onClose:C,ariaLabel:e("sessions.scheduledTasks.dialog.title"),title:e("sessions.scheduledTasks.dialog.title"),children:n.jsx(bt,{children:n.jsx(em,{layout:"mobile",onLeave:ye})})}):null,a==="board"?n.jsx(Zt,{open:!0,variant:pe,dialogAlign:"app",onClose:C,ariaLabel:e("sourceBoard.title"),headerless:!0,children:n.jsx(bt,{children:n.jsx(Qf,{onLeave:ge,onClose:C})})}):null,a==="overview"&&ke?n.jsx(Zt,{open:!0,variant:pe,dialogAlign:"app",onClose:C,ariaLabel:e("overview.title"),title:e("overview.title"),children:n.jsx(bt,{children:n.jsx(Zf,{layout:"mobile",onLeave:we})})}):null,a==="archive"?n.jsx(Zt,{open:!0,variant:pe,dialogAlign:"app",onClose:C,ariaLabel:e("sessions.archivePage.title"),title:e("sessions.archivePage.title"),children:n.jsx(bt,{children:n.jsx(Yf,{layout:"mobile",onLeave:ve})})}):null,a==="update"?n.jsx(Zt,{open:!0,variant:pe,dialogAlign:"app",onClose:C,ariaLabel:e("mobile.menu.update"),title:e("mobile.menu.update"),children:n.jsx(bt,{children:n.jsx(Yt,{outerClassName:"h-full",className:"px-5 py-4",disableHorizontal:!0,children:n.jsx(xf,{initialUpdateDialogOpen:!0})})})}):null]})})};function bb(s){const e=re.c(141),{apis:t}=s,r=Xe(qb),{t:o}=be(),i=Kt(Hb),a=Kt(Vb),l=Kt(Kb),u=Kt(Wb),c=Kt($b),d=Kt(Fb),p=Kt(zb),g=Kt(Bb),f=Fs(Lb),b=nt(Mb),x=nt(Ob),h=Xe(Db),v=kr(Pb),w=vl(Ab),N=Xs(Tb);let _;e[0]!==N?(_=N??[],e[0]=N,e[1]=_):_=e[1];const M=_,E=N!=null;let j;e[2]!==M||e[3]!==E?(j={hasAuthoritativeGlobalSessions:E,sessions:M},e[2]=M,e[3]=E,e[4]=j):j=e[4],Uu(j);const[C,k]=m.useState(0),[L,I]=m.useState(0),[A,R]=m.useState(!1),[F,T]=m.useState("pending"),[S,P]=m.useState(null);let D;e[5]===Symbol.for("react.memo_cache_sentinel")?(D=Ss(),e[5]=D):D=e[5];const $=D,[,K]=m.useReducer(_b,0);let U;e[6]===Symbol.for("react.memo_cache_sentinel")?(U=zr(),e[6]=U):U=e[6];const O=U,V=m.useRef(0),q=m.useRef(0);let ee;e[7]!==d||e[8]!==t.sourceControl||e[9]!==t.trackers||e[10]!==i||e[11]!==g||e[12]!==p||e[13]!==c||e[14]!==v||e[15]!==w?(ee=()=>{const ie=Gt(),je=q.current+1;if(q.current=je,!ie){on("resume:auto-connect",{}),an();return}on("resume:reprobe",{});const Re=()=>{i(),w(t.sourceControl),v(t.sourceControl,{force:!0}),Si(t.trackers),c===0&&p({source:"mobileApp:nativeResume"}),d===0&&g({source:"mobileApp:nativeResume"})},Pe=Qe=>{on("resume:disconnect",{reason:Qe}),Os({apiBaseUrl:"",clientToken:null,runtimeKey:En}),k(Ib)};On().then(Qe=>{if(q.current===je){if(Qe==="no-connection"){Pe("no-connection");return}if(Qe==="needs-login"){P({kind:"auth-expired",label:Ss()??""}),Pe("needs-login");return}if(Qe==="relay-limit"){P({kind:"relay-limit",label:Ss()??""}),Pe("relay-limit");return}if(Qe==="unreachable"){const Xt=[4e3,1e4],ds=wt=>{window.setTimeout(()=>{if(q.current!==je)return;const Ue=wt===Xt.length-1;On({fast:!Ue}).then(gt=>{if(q.current===je&&gt!=="switched"){if(gt==="unchanged"){Re();return}if(gt==="needs-login"){P({kind:"auth-expired",label:Ss()??""}),Pe("retry-needs-login");return}if(gt==="relay-limit"){P({kind:"relay-limit",label:Ss()??""}),Pe("retry-relay-limit");return}if(!Ue){ds(wt+1);return}Pe(`retry-${gt}`)}})},Xt[wt])};ds(0);return}Qe!=="switched"&&Re()}});const De=Date.now();De-V.current>=hb&&(V.current=De,window.dispatchEvent(new Event("openchamber:system-resume")))},e[7]=d,e[8]=t.sourceControl,e[9]=t.trackers,e[10]=i,e[11]=g,e[12]=p,e[13]=c,e[14]=v,e[15]=w,e[16]=ee):ee=e[16];const Z=ee;Td(),Ad(Z);let Y,B;e[17]!==Z?(Y=()=>{if(!O)return;let ie;const je=()=>{window.clearTimeout(ie),ie=window.setTimeout(()=>Z(),1500)};return window.addEventListener("online",je),()=>{window.removeEventListener("online",je),window.clearTimeout(ie)}},B=[O,Z],e[17]=Z,e[18]=Y,e[19]=B):(Y=e[18],B=e[19]),m.useEffect(Y,B);let Q,oe;e[20]!==Z?(oe=()=>{if(O)return pi.subscribe((ie,je)=>{ie.state==="expired"&&je.state!=="expired"&&(Z(),pi.getState().markAuthenticated())})},Q=[O,Z],e[20]=Z,e[21]=Q,e[22]=oe):(Q=e[21],oe=e[22]),m.useEffect(oe,Q);let X,te;e[23]!==Z?(X=()=>{if(O)return wl(ie=>{Wn(ie)&&Z()})},te=[O,Z],e[23]=Z,e[24]=X,e[25]=te):(X=e[24],te=e[25]),m.useEffect(X,te);let ce,ue;e[26]!==t?(ce=()=>(Eo(t),Eb),ue=[t],e[26]=t,e[27]=ce,e[28]=ue):(ce=e[27],ue=e[28]),m.useEffect(ce,ue);let H;e[29]!==K?(H=()=>Ro(ie=>{if(on("endpoint:changed",{runtimeKey:ie.runtimeKey||"none",previousRuntimeKey:ie.previousRuntimeKey||"none",connected:!!ie.apiBaseUrl}),!!ie.runtimeKey&&ie.runtimeKey===ie.previousRuntimeKey){tf(),K();return}sf(ie),I(Rb),k(Nb)}),e[29]=K,e[30]=H):H=e[30];let ne;e[31]===Symbol.for("react.memo_cache_sentinel")?(ne=[],e[31]=ne):ne=e[31],m.useEffect(H,ne);let Te;e[32]!==l?(Te=()=>{if(!O||l||Gt()){T("done");return}let ie=!1;return T("attempting"),(async()=>{const je=await an().catch(Cb);ie||(je.status==="unreachable"||je.status==="relay-limit"?P({kind:je.status,label:je.label}):je.status==="needs-login"&&P({kind:"auth-expired",label:je.label}),T("done"),je.status==="unreachable"&&an({fast:!1,skipIfConnected:!0}).catch(Sb))})(),()=>{ie=!0}},e[32]=l,e[33]=Te):Te=e[33];let se;e[34]===Symbol.for("react.memo_cache_sentinel")?(se=[],e[34]=se):se=e[34],m.useEffect(Te,se);let xe,pe;e[35]===Symbol.for("react.memo_cache_sentinel")?(xe=()=>{if(!O||!Gt())return;let ie=!1;const je=Re=>{on("cold-launch:drop",{kind:Re?.kind??"unknown"}),Re&&P(Re),Os({apiBaseUrl:"",clientToken:null,runtimeKey:En}),k(kb)};return On().then(async Re=>{if(ie||Re==="switched"||Re==="unchanged")return;const Pe=Ss();if(Re==="needs-login"){je({kind:"auth-expired",label:Pe??""});return}if(Re==="unreachable"){je(Pe?{kind:"unreachable",label:Pe}:null),an({fast:!1,skipIfConnected:!0}).catch(jb);return}if(Re==="relay-limit"){je({kind:"relay-limit",label:Pe??""});return}const De=await an().catch(wb);ie||De.status==="connected"||(De.status==="needs-login"?je({kind:"auth-expired",label:De.label}):De.status==="unreachable"||De.status==="relay-limit"?je({kind:De.status,label:De.label}):je(null))}),()=>{ie=!0}},pe=[],e[35]=xe,e[36]=pe):(xe=e[35],pe=e[36]),m.useEffect(xe,pe);let ke,Ee;e[37]!==h?(ke=()=>{h(!0)},Ee=[h],e[37]=h,e[38]=ke,e[39]=Ee):(ke=e[38],Ee=e[39]),m.useEffect(ke,Ee);let ye;e[40]!==i?(ye=()=>{O&&!Gt()||i()},e[40]=i,e[41]=ye):ye=e[41];let ge;e[42]!==C||e[43]!==i?(ge=[C,i,O],e[42]=C,e[43]=i,e[44]=ge):ge=e[44],m.useEffect(ye,ge);let we,ve;e[45]!==d||e[46]!==l||e[47]!==g||e[48]!==p||e[49]!==c?(we=()=>{l&&(c===0&&p({source:"mobileApp:recovery"}),d===0&&g({source:"mobileApp:recovery"}))},ve=[d,l,g,p,c],e[45]=d,e[46]=l,e[47]=g,e[48]=p,e[49]=c,e[50]=we,e[51]=ve):(we=e[50],ve=e[51]),m.useEffect(we,ve);const W=m.useRef(!1),[de,Ne]=m.useState(O);let Ie;e[52]!==l?(Ie=()=>{if(!O||!l||W.current)return;let ie=!1;const je=window.setTimeout(()=>Ne(!1),6e3);return(async()=>{const Re=await nf({refresh:!0});ie||(Re!=="failed"&&(W.current=!0),Ne(!1))})(),()=>{ie=!0,window.clearTimeout(je)}},e[52]=l,e[53]=Ie):Ie=e[53];let _e;e[54]!==C||e[55]!==l?(_e=[C,l,O],e[54]=C,e[55]=l,e[56]=_e):_e=e[56],m.useEffect(Ie,_e);let Fe,Ve;e[57]!==f||e[58]!==l?(Fe=()=>{l&&gr.setDirectory(f)},Ve=[f,l],e[57]=f,e[58]=l,e[59]=Fe,e[60]=Ve):(Fe=e[59],Ve=e[60]),m.useEffect(Fe,Ve);let He,Je;e[61]!==t.sourceControl||e[62]!==t.trackers||e[63]!==l||e[64]!==v||e[65]!==w?(He=()=>{l&&(w(t.sourceControl),v(t.sourceControl,{force:!0}),Si(t.trackers))},Je=[t.sourceControl,t.trackers,l,v,w],e[61]=t.sourceControl,e[62]=t.trackers,e[63]=l,e[64]=v,e[65]=w,e[66]=He,e[67]=Je):(He=e[66],Je=e[67]),m.useEffect(He,Je);let fe,Be;e[68]!==x||e[69]!==b?(fe=()=>{if(!b)return;const ie=window.setTimeout(()=>x(),5e3);return()=>window.clearTimeout(ie)},Be=[x,b],e[68]=x,e[69]=b,e[70]=fe,e[71]=Be):(fe=e[70],Be=e[71]),m.useEffect(fe,Be);let J;e[72]!==l?(J=()=>{if(!(!l&&(O?!!Gt():!0))){R(!1);return}const je=window.setTimeout(()=>{R(!0)},O?4e3:8e3);return()=>window.clearTimeout(je)},e[72]=l,e[73]=J):J=e[73];let me;e[74]!==C||e[75]!==l||e[76]!==L?(me=[l,O,C,L],e[74]=C,e[75]=l,e[76]=L,e[77]=me):me=e[77],m.useEffect(J,me),Pd();let $e;e[78]===Symbol.for("react.memo_cache_sentinel")?($e={enabled:!0},e[78]=$e):$e=e[78],Dd($e),Gu(),Od(),Md(),Xu(),Ju(t.sourceControl),Yu(t.trackers),Qu(),Zu(f||null),ef();const lt=O&&l;let qe;e[79]!==lt?(qe={enabled:lt},e[79]=lt,e[80]=qe):qe=e[80],lb(qe);const ot=O&&l&&a;let Ze;e[81]!==ot?(Ze={ready:ot},e[81]=ot,e[82]=Ze):Ze=e[82],nb(Ze);const xt=zg(),Dt=!l&&u==="reconnecting";if(!xt){let ie;return e[83]===Symbol.for("react.memo_cache_sentinel")?(ie=n.jsx("main",{className:"flex min-h-dvh items-center justify-center bg-[var(--splash-background,var(--surface-background))] text-foreground",children:n.jsx(Ms,{width:120,height:120,isAnimated:!0,variant:"splash"})}),e[83]=ie):ie=e[83],ie}const Rt=!!Gt();if(O&&(!Rt||!l&&!Dt)){if(Rt){const Re=!A;let Pe;e[84]!==Re?(Pe=n.jsx(Ms,{width:120,height:120,isAnimated:Re,variant:"splash"}),e[84]=Re,e[85]=Pe):Pe=e[85];let De;e[86]!==A||e[87]!==o?(De=A?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("h1",{className:"typography-h3 text-foreground",children:o("sessionAuth.error.networkTitle")}),n.jsx("p",{className:"typography-markdown text-muted-foreground",children:o("mobile.connect.recovery.description")})]}),n.jsx(Ae,{type:"button",variant:"outline",onClick:()=>{Os({apiBaseUrl:"",clientToken:null,runtimeKey:En}),k(vb)},children:o("mobile.connect.cancelPassword")})]}):null,e[86]=A,e[87]=o,e[88]=De):De=e[88];let Qe;return e[89]!==Pe||e[90]!==De?(Qe=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:[Pe,De]})}),e[89]=Pe,e[90]=De,e[91]=Qe):Qe=e[91],Qe}if(F!=="done"){let Re;e[92]===Symbol.for("react.memo_cache_sentinel")?(Re=n.jsx(Ms,{width:120,height:120,isAnimated:!0,variant:"splash"}),e[92]=Re):Re=e[92];let Pe;e[93]!==o?(Pe=$?n.jsxs("div",{className:"absolute inset-x-0 top-[calc(50%+84px)] flex flex-col items-center gap-0.5 px-6 text-center",children:[n.jsx("p",{className:"typography-small text-muted-foreground",children:o("mobile.connect.splash.connectingTo")}),n.jsxs("p",{className:"typography-small text-foreground",children:[$,n.jsx(Ld,{})]})]}):null,e[93]=o,e[94]=Pe):Pe=e[94];let De;return e[95]!==Pe?(De=n.jsxs("main",{className:"relative flex min-h-dvh items-center justify-center bg-[var(--splash-background,var(--surface-background))] text-foreground",children:[Re,Pe]}),e[95]=Pe,e[96]=De):De=e[96],De}let ie;e[97]===Symbol.for("react.memo_cache_sentinel")?(ie=()=>k(yb),e[97]=ie):ie=e[97];let je;return e[98]!==S?(je=n.jsx(n.Fragment,{children:n.jsx(Jp,{onConnected:ie,notice:S})}),e[98]=S,e[99]=je):je=e[99],je}if(!l&&!Dt){if(!A){let Qe;return e[100]===Symbol.for("react.memo_cache_sentinel")?(Qe=n.jsx("main",{className:"flex min-h-dvh items-center justify-center bg-[var(--splash-background,var(--surface-background))] text-foreground",children:n.jsx(Ms,{width:120,height:120,isAnimated:!0,variant:"splash"})}),e[100]=Qe):Qe=e[100],Qe}let ie;e[101]!==o?(ie=o("sessionAuth.error.networkTitle"),e[101]=o,e[102]=ie):ie=e[102];let je;e[103]!==ie?(je=n.jsx("h1",{className:"typography-h3 text-foreground",children:ie}),e[103]=ie,e[104]=je):je=e[104];let Re;e[105]!==o?(Re=o("sessionAuth.error.networkDescription"),e[105]=o,e[106]=Re):Re=e[106];let Pe;e[107]!==Re?(Pe=n.jsx("p",{className:"typography-markdown text-muted-foreground",children:Re}),e[107]=Re,e[108]=Pe):Pe=e[108];let De;return e[109]!==je||e[110]!==Pe?(De=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:[je,Pe]})}),e[109]=je,e[110]=Pe,e[111]=De):De=e[111],De}let We;e[112]===Symbol.for("react.memo_cache_sentinel")?(We=gr.getSdkClient(),e[112]=We):We=e[112];const st=f||"",ut=!O||!de;let at;e[113]!==ut?(at=n.jsx(rf,{ready:ut,animated:!0}),e[113]=ut,e[114]=at):at=e[114];let ft;e[115]!==a?(ft=n.jsx(Bd,{backgroundWorkEnabled:a}),e[115]=a,e[116]=ft):ft=e[116];let yt,Et;e[117]===Symbol.for("react.memo_cache_sentinel")?(yt=n.jsx(of,{}),Et=n.jsx(Gm,{}),e[117]=yt,e[118]=Et):(yt=e[117],Et=e[118]);let Oe,et,tt,mt,Me;e[119]===Symbol.for("react.memo_cache_sentinel")?(Oe=n.jsx(gb,{onActiveConnectionDeleted:()=>{Pp(),Os({apiBaseUrl:"",clientToken:null,runtimeKey:En}),k(xb)}}),et=n.jsx(zd,{}),tt=n.jsx(Fd,{}),mt=n.jsx($d,{}),Me=n.jsx(Wd,{}),e[119]=Oe,e[120]=et,e[121]=tt,e[122]=mt,e[123]=Me):(Oe=e[119],et=e[120],tt=e[121],mt=e[122],Me=e[123]);let pt;e[124]!==r?(pt=r?n.jsxs(n.Fragment,{children:[n.jsx(vf,{}),n.jsx(af,{}),n.jsx(wf,{}),n.jsx(lf,{}),n.jsx(jf,{})]}):null,e[124]=r,e[125]=pt):pt=e[125];let vt;e[126]===Symbol.for("react.memo_cache_sentinel")?(vt=n.jsx(ep,{}),e[126]=vt):vt=e[126];let Ye;e[127]!==a?(Ye=a?n.jsx(cf,{}):null,e[127]=a,e[128]=Ye):Ye=e[128];let ht;e[129]!==at||e[130]!==ft||e[131]!==pt||e[132]!==Ye?(ht=n.jsx(Kd,{delayDuration:300,skipDelayDuration:150,children:n.jsxs("div",{className:"h-full bg-background text-foreground",children:[at,ft,yt,Et,Oe,et,tt,mt,Me,pt,vt,Ye]})}),e[129]=at,e[130]=ft,e[131]=pt,e[132]=Ye,e[133]=ht):ht=e[133];let Ge;e[134]!==t||e[135]!==ht?(Ge=n.jsx(Vd,{apis:t,children:ht}),e[134]=t,e[135]=ht,e[136]=Ge):Ge=e[136];let Qt;return e[137]!==L||e[138]!==st||e[139]!==Ge?(Qt=n.jsx(bt,{children:n.jsx(Hd,{sdk:We,directory:st,children:Ge},L)}),e[137]=L,e[138]=st,e[139]=Ge,e[140]=Qt):Qt=e[140],Qt}function xb(s){return s+1}function yb(s){return s+1}function vb(s){return s+1}function wb(){return{status:"no-candidate"}}function jb(){return null}function kb(s){return s+1}function Sb(){return null}function Cb(){return{status:"no-candidate"}}function Nb(s){return s+1}function Rb(s){return s+1}function Eb(){return Eo(null)}function Ib(s){return s+1}function _b(s){return s+1}function Tb(s){return s.authoritativeSessions}function Ab(s){return s.refresh}function Pb(s){return s.refreshAll}function Db(s){return s.setIsMobile}function Ob(s){return s.clearError}function Mb(s){return s.error}function Lb(s){return s.currentDirectory}function Bb(s){return s.loadAgents}function zb(s){return s.loadProviders}function Fb(s){return s.agents.length}function $b(s){return s.providers.length}function Wb(s){return s.connectionPhase}function Kb(s){return s.isConnected}function Vb(s){return s.isInitialized}function Hb(s){return s.initializeApp}function qb(s){return s.isolatedSpacesEnabled}function Ub(s){const e=re.c(7),t=m.useSyncExternalStore(Gb,Gt,Gt);let r;e[0]!==t?(r=!zr()||!!t,e[0]=t,e[1]=r):r=e[1];let o;e[2]!==s?(o=n.jsx(bb,{...s}),e[2]=s,e[3]=o):o=e[3];let i;return e[4]!==r||e[5]!==o?(i=n.jsx(df,{enabled:r,children:o}),e[4]=r,e[5]=o,e[6]=i):i=e[6],i}function Gb(s){return Ro(()=>s())}function E0(s){window.__OPENCHAMBER_SURFACE__="mobile",eu(),gf({logLabel:"[mobile-main]",onAppearanceSettled:Fm}),Um(),tu();const e=document.getElementById("root");if(!e)throw new Error("Root element not found");const r=window.Capacitor?.isNativePlatform?.()===!0||window.location.protocol==="capacitor:",o=r?{...s,notifications:{notifyAgentCompletion:async()=>!1,canNotify:()=>!1}}:s,i=n.jsx(hf,{children:n.jsx(Ub,{apis:o})});Za.createRoot(e).render(n.jsx(hr.StrictMode,{children:n.jsx(su,{children:n.jsx(nu,{children:n.jsx(ru,{children:n.jsx(pf,{children:r?i:n.jsx(iu,{children:i})})})})})}))}export{E0 as renderMobileApp};
25
+ `)}`.trim()),fe([])},[]),Ha=m.useCallback(async()=>{if(!f)return;const y=cs.map(z=>z.path).sort();if(y.length===0){he.error(a("gitView.toast.selectFileToDescribe"));return}He(!0);try{const{message:z}=await ji(f,y);de(z.subject?.trim()??""),fe(Array.isArray(z.highlights)?z.highlights:[])}catch(z){he.error(z instanceof Error?z.message:a("gitView.toast.generateCommitMessageFailed"))}finally{He(!1)}},[f,cs,a]),oi=async(y={})=>{if(!f)return;if(!W.trim()){he.error(a("gitView.toast.enterCommitMessage"));return}const z=cs.map(Le=>Le.path).sort();if(z.length===0){he.error(a("gitView.toast.selectFileToCommit"));return}we(y.pushAfter?"commitAndPush":"commit");let le=null,Ce="pending";try{if(!l.createGitCommit)throw new Error("Git commit is unavailable on this runtime");const Le=await l.createGitCommit(f,W.trim(),{files:z});Ce="local";const Ft=ve.committed(Le.summary,y);if(de(""),fe([]),y.pushAfter){if(le=st.start(),!le){he.warning(a("gitView.publish.commitKept")),await ks();return}const it=await We.prepare("push",{onOperation:le.onOperation});ye("publish"),await it(),Ce="published",ve.pushed({deletion:Ft,origin:y.origin})}await ks()}catch(Le){if(y.pushAfter&&Ce==="local"&&he.warning(a("gitView.publish.commitKept")),Le instanceof Pn||Le instanceof br){await ks();return}if(Le instanceof ps&&Le.code==="stale-runtime")return;if(Le instanceof ps&&We.errorMessage(Le)){he.info(We.errorMessage(Le));return}y.pushAfter&&await ks(),he.error(Le instanceof ps?Le.code==="contributor-publish-cancelled-after-update"?a("gitView.toast.contributorPublishCancelledAfterUpdate"):Le.code==="contributor-publish-cancelled"?a("gitView.toast.contributorPublishCancelled"):a("gitView.toast.syncActionFailed",{action:a("gitView.sync.syncChanges")}):Le instanceof Error?Ii(Le,a):a("gitView.toast.createCommitFailed"))}finally{le?.finish(),we(null),y.pushAfter&&ye(null)}},qa=m.useMemo(()=>(b?.files??[]).filter(or).length,[b?.files]),nn=!!b?.mergeInProgress?.head,Ua=m.useCallback(async()=>{if(f)try{if(nn){if(!l.continueMerge)throw new Error("Git continue merge is unavailable on this runtime");const y=await l.continueMerge(f);y.conflict?(mt(y.conflictFiles??[],"merge"),he.error(a("gitView.toast.mergeConflictsDetected"))):he.success(a("gitView.toast.mergeCompleted"))}else{if(!l.continueRebase)throw new Error("Git continue rebase is unavailable on this runtime");const y=await l.continueRebase(f);y.conflict?(mt(y.conflictFiles??[],"rebase"),he.error(a("gitView.toast.rebaseConflictsDetected"))):he.success(a("gitView.toast.rebaseStepCompleted"))}await At(!1)}catch(y){he.error(y instanceof Error?y.message:a("gitView.toast.continueOperationFailed"))}},[f,l,nn,mt,At,a]),ai=m.useCallback(async y=>{if(f)try{if(y==="merge"){if(!l.abortMerge)throw new Error("Git abort merge is unavailable on this runtime");await l.abortMerge(f),he.success(a("gitView.toast.mergeAborted"))}else{if(!l.abortRebase)throw new Error("Git abort rebase is unavailable on this runtime");await l.abortRebase(f),he.success(a("gitView.toast.rebaseAborted"))}await At(!1)}catch(z){he.error(z instanceof Error?z.message:a("gitView.toast.abortOperationFailed"))}},[f,l,At,a]),Ga=m.useCallback(()=>{const y=(b?.files??[]).filter(or).map(z=>z.path);mt(y,nn?"merge":"rebase")},[nn,mt,b?.files]),Xa=m.useMemo(()=>{const y=[];return cs.length>0&&y.push({id:"staged",title:a("gitView.changes.stagedTitle"),entries:cs,statsScope:"staged",actionSymbol:"-",actionAllLabel:a("gitView.changes.unstageAllAria"),getActionLabel:z=>a("gitView.changes.unstageFileAria",{path:z}),onActionFile:z=>{sn([z],"unstage")},onActionAll:z=>{sn(z,"unstage")},onViewDiff:z=>Zn(z,!0),onRevertFile:er,showRevertActions:!1,accent:!0}),Qn.length>0&&y.push({id:"unstaged",title:a("gitView.changes.title"),entries:Qn,statsScope:"working",actionSymbol:"+",actionAllLabel:a("gitView.changes.stageAllAria"),getActionLabel:z=>a("gitView.changes.stageFileAria",{path:z}),onActionFile:z=>{sn([z],"stage")},onActionAll:z=>{sn(z,"stage")},onViewDiff:z=>Zn(z,!1),onRevertFile:er}),y},[er,Zn,sn,cs,a,Qn]),li=n.jsxs(n.Fragment,{children:[We.context?n.jsx(Lu,{context:We.context,onSelect:We.settle}):null,We.confirmDialog,n.jsx(Bu,{candidates:Rt.candidates,onSelect:Rt.settle})]}),ci=g?n.jsx(md,{repositories:g,selectedRepository:d??null,onSelectRepository:y=>{s&&(ln.getState().clearChangesRepository(s),U(s,y))},repositoryRoot:s??void 0}):null,Rn=y=>n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[li,n.jsxs("header",{className:ae(bs,"text-foreground"),children:[t?n.jsx("button",{type:"button",className:Nt,"aria-label":a("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:vn,children:a("mobile.nav.changes")}),n.jsx("p",{className:"truncate typography-micro text-muted-foreground",children:b?.current||f||""})]}),ci]}),n.jsx("div",{className:"min-h-0 flex-1",children:y})]});if(!f)return Rn(n.jsx(Pt,{message:a("gitView.empty.selectSessionOrDirectory")}));if(e.unreadable)return Rn(n.jsx(zu,{directory:e.unreadable.directory,message:e.unreadable.message}));if(c===!1&&S!==!0)return Rn(n.jsx($u,{root:s,rootIsGitRepo:c,resolvedIsGitRepo:S,nestedRepos:p,onRetryDiscovery:()=>{s&&K(s,{force:!0})}}));if(P&&S===null)return Rn(n.jsx(Pt,{loading:!0,message:a("gitView.loading.checkingRepository")}));if(ne.type==="diff")return n.jsx(mr,{path:ne.path,diff:Ba,staged:ne.staged,fileExists:!!za,unavailableReason:ot?.key===`${f}\0${ne.path}`?ot.reason:null,error:lt,onBack:()=>pe({type:"list"}),onRetry:()=>Dt(y=>y+1)});if(ne.type==="turn")return n.jsx(mr,{path:ne.path,subtitle:a("diffView.scope.lastTurn"),diff:Ma.get(ne.path)??null,fileExists:Yn.some(y=>y.path===ne.path),onBack:()=>pe(Ut)});const tr=a(H==="pr"?_n("session.githubIntegration.tabs.pullRequests",gt):H==="branch"?"diffView.scope.branch":H==="commit"?"commitComparison.mode":H==="turn"?"diffView.scope.lastTurn":"mobile.nav.changes"),sr=H==="branch"&&ie.base?Fu(ie.base):H==="commit"?ht?.slice(0,8):H==="pr"&&St?`#${St.number}`:null;if(ne.type==="walkthrough"&&en&&f)return n.jsx(Ei.Provider,{value:Jt,children:n.jsx(xg,{directory:f,target:en,subtitle:[tr,sr].filter(Boolean).join(" · "),revision:JSON.stringify([ss,H==="pr"?Ke.revision:0]),visible:o,onBack:()=>pe(Ut)})});if(_t&&Tt)return n.jsx(Ei.Provider,{value:Jt,children:n.jsx(mr,{path:_t,subtitle:[tr,sr].filter(Boolean).join(" · "),commentOrigin:ms,diff:Sn??(Tt.status==="ready"?Tt.diff:null),fileExists:!Ke.files||Ke.files.some(y=>y.path===_t),error:Ke.error??(Tt.status==="error"?Tt.message:null),onBack:()=>pe(Ut),onRetry:()=>{Ke.error&&Ke.refresh(),rt(y=>y+1)},onExpandContextRequest:Tt.status==="ready"?y=>ri({source:Tt,request:y}):void 0,pendingContextExpansion:kn,contextLoading:kn!==null&&!Sn})});const Ja=()=>H==="pr"&&Ue.diffUnavailable?n.jsx(Dm,{provider:Ue.provider,className:"h-full"}):H==="pr"&&!St?n.jsx(Pt,{loading:Ue.loading,message:Ue.error??(Ue.loading?a(_n("session.githubPrPicker.loading.pullRequests",gt)):a(_n("pullRequestComparison.select",gt)))}):H==="branch"&&!ie.base?n.jsx(Pt,{loading:!ie.resolved,message:ie.resolved?a("gitView.pr.toast.baseBranchRequired"):a("diffView.branch.resolvingBase")}):H==="commit"&&!ht?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 text-center",children:[Ye.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:Ye.loading?a("diffView.state.loadingChanges"):Ye.error??a("commitComparison.noCommits")}),Ye.error&&n.jsx(Ae,{variant:"outline",size:"lg",onClick:()=>{Ye.refresh()},children:a("diffView.actions.retry")})]}):Ke.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:a("diffView.state.failedToLoadDiff")}),n.jsx("p",{className:"typography-meta text-muted-foreground",children:Ke.error}),n.jsx(Ae,{variant:"outline",size:"lg",onClick:()=>{Ke.refresh()},children:a("diffView.actions.retry")})]}):qt?qt.length===0?n.jsx(Pt,{icon:H==="branch",message:H==="pr"?a("walkthrough.blocked.emptyDiff.description"):H==="commit"?a("commitComparison.emptyDiff"):a("diffView.branch.empty",{base:sr??""})}):n.jsx(po,{files:qt,onSelect:y=>{Ke.key&&pe({type:"comparison",path:y,sourceKey:Ke.key})}}):n.jsx(Pt,{loading:!0,message:a("diffView.state.loadingChanges")}),Ya=()=>Ps?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:a("diffView.state.failedToLoadDiff")}),n.jsx("p",{className:"typography-meta text-muted-foreground",children:Ps}),n.jsx(Ae,{variant:"outline",size:"lg",onClick:us,children:a("diffView.actions.retry")})]}):(!Zs||te)&&Lt?n.jsx(Pt,{loading:!0,message:a("diffView.state.loadingChanges")}):Yn.length===0?n.jsx(Pt,{message:a("diffView.state.noLastTurnChanges")}):n.jsx(po,{files:Yn,onSelect:y=>pe({type:"turn",path:y})});return n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[li,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:Nt,"aria-label":a("mobile.surface.closeAria"),onClick:t,style:{touchAction:"manipulation"},children:n.jsx(G,{name:"close",className:"size-5"})}):null,n.jsxs(vr,{open:Te,onOpenChange:se,children:[n.jsx(wr,{asChild:!0,children:n.jsxs(Ae,{variant:"ghost",className:ed({size:"mobile"}),"data-mobile-comparison-trigger":!0,"aria-label":a("diffView.scope.selectorAria"),children:[n.jsx("span",{children:H==="pr"&&gt==="pullRequest"?"PR":H==="pr"&&gt==="mergeRequest"?"MR":tr}),n.jsx(G,{name:"arrow-down-s",className:"size-4"})]})}),n.jsx(jr,{align:"start",children:n.jsxs(td,{value:H,onValueChange:y=>{(y==="working"||y==="turn"||y==="branch"||y==="commit"||y==="pr")&&xe(y)},children:[n.jsx(rn,{value:"working",className:"min-h-8 items-center",children:a("mobile.nav.changes")}),n.jsx(rn,{value:"turn",className:"min-h-8 items-center",children:a("diffView.scope.lastTurn")}),Re&&n.jsx(rn,{value:"branch",className:"min-h-8 items-center",children:a("diffView.scope.branch")}),n.jsx(rn,{value:"commit",className:"min-h-8 items-center",children:a("commitComparison.mode")}),n.jsx(rn,{value:"pr",className:"min-h-8 items-center",children:a(_n("session.githubIntegration.tabs.pullRequests",gt))})]})})]}),ci,o&&H==="branch"&&n.jsx(_m,{mobile:!0,branches:h?.all??[],currentBranch:Me,base:ie.base,automatic:ie.source!=="chosen",onSelect:y=>{Me&&pt(f,Me,y)},onSelectAutomatic:()=>{Me&&vt(f,Me)}},JSON.stringify([B,Me])),o&&H==="commit"&&n.jsx(Tm,{mobile:!0,commits:Ye.commits,selectedHash:ht,loading:Ye.loading,error:Ye.error,onSelect:Ye.select,onRefresh:()=>{Ye.refresh()}},JSON.stringify([B,Me])),o&&H==="pr"&&n.jsxs(n.Fragment,{children:[n.jsx(Am,{mobile:!0,comparison:Ue},JSON.stringify([B,Me])),St&&n.jsx(Ae,{variant:"ghost",size:"sm",disabled:Ke.loading,"aria-label":a("session.githubIssuePicker.actions.refresh"),onClick:()=>{Ke.refresh()},children:n.jsx(G,{name:"refresh",className:"size-4"})})]}),en&&n.jsx(Ae,{variant:"ghost",size:"icon",className:"ms-auto shrink-0",onClick:()=>pe({type:"walkthrough"}),"aria-label":a("walkthrough.action.open"),title:a("walkthrough.action.open"),style:{touchAction:"manipulation"},children:n.jsx(G,{name:"route",className:"size-5"})}),o&&H==="pr"&&Jt&&rs?n.jsx(Pm,{review:Jt,provider:rs,className:en?void 0:"ms-auto"}):null,H==="working"&&Lt&&(b?.files?.length??0)>0?n.jsxs(Ae,{variant:"outline",className:ae("shrink-0",!en&&"ms-auto"),disabled:Ht.submitting,onClick:()=>js(!0),"aria-label":a("diffView.actions.reviewAria"),style:{touchAction:"manipulation"},children:[n.jsx(G,{name:Ht.submitting?"loader-4":"search-eye",className:ae("size-4",Ht.submitting&&"animate-spin")}),a("chat.work.reviewHint.aiReview")]}):null]}),n.jsx(sd,{open:fs,onOpenChange:js,projectDirectory:s||null,submitting:Ht.submitting,onConfirm:Ht.start}),H==="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(nd,{currentBranch:b?.current,localBranches:Fa,remoteBranches:$a,branchInfo:h?.branches,currentBranchAhead:b?.ahead,onCheckout:y=>{Wa(y)},onCreate:Ka,disabled:P,directory:f,switchBlockedNotice:(b?.files?.length??0)>0?a("gitView.branch.switchBlockedNotice"):null})}),n.jsx(rd,{activeProfile:Xt,quiet:!0,identities:F,attention:ds,triggerClassName:"max-w-[10rem] shrink [&_.git-identity-label]:hidden sm:[&_.git-identity-label]:inline",onOpen:()=>{R(u,E.map(y=>y.account))},onSelect:y=>{T(y)},isApplying:_,onConfigure:()=>N(!0),applicability:y=>{const z=Ge.read?.repository.remotes.find(le=>le.name===De);return z?id(y,od(z.fetch.displayUrl),A):{applicable:!0}}}),n.jsx(ad,{syncAction:st.entry?.executing?Ee:null,remotes:La,onFetch:y=>{tn("fetch",y)},onPull:y=>{tn("pull",y)},onSync:y=>{tn("sync",y)},onPublish:()=>{tn("publish")},onChooseSyncTargets:()=>{tn("sync",void 0,!0)},currentBranch:b?.current,hasTracking:!!b?.tracking,disabled:P||st.blocked,aheadCount:b?.ahead??0,behindCount:b?.behind??0,trackingRemoteName:b?.tracking?.split("/")[0],trackingBranch:b?.tracking,hasUncommittedChanges:ld(Ct),choosesPushDestination:x})]}),n.jsx(dm,{open:w,onOpenChange:N,directory:f}),n.jsx(cd,{className:"mx-3 mt-3",entry:st.entry,onRefresh:()=>{st.refresh()},onCancel:()=>{st.cancel()}}),H==="working"&&n.jsx(um,{mergeInProgress:b?.mergeInProgress,rebaseInProgress:b?.rebaseInProgress,onContinue:Ua,onAbort:()=>ai(nn?"merge":"rebase"),onResolveWithAI:Ga,conflictCount:qa,isLoading:Ee!==null||ge!==null}),H==="turn"?n.jsx("div",{className:"min-h-0 flex-1",children:Ya()}):H!=="working"?n.jsx("div",{className:"min-h-0 flex-1",children:Ja()}):Ct.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(fm,{groups:Xa,diffStats:b?.diffStats,revertingPaths:Ne,onRevertAll:ii,isRevertingAll:_e,headerBackgroundClassName:"bg-transparent",onVisiblePathsChange:J})}),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(mm,{stagedCount:cs.length,commitMessage:W,onCommitMessageChange:de,generatedHighlights:Je,onInsertHighlights:Va,onGenerateMessage:Ha,isGeneratingMessage:Ve,onCommit:y=>{oi({pushAfter:!1,origin:y})},onCommitAndPush:y=>{oi({pushAfter:!0,origin:y})},commitAction:ge,networkOperationBlocked:st.blocked,gitmojiEnabled:!1,onOpenGitmojiPicker:()=>{}})})]}):n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(Cg,{})}),f&&n.jsx(pm,{open:ft,onOpenChange:yt,conflictFiles:Et,directory:f,operation:et,onAbort:()=>{ai(et)},onNavigatedToChat:i}),n.jsx(hm,{open:ut!==null,onOpenChange:y=>{y||at(null)},targetBranch:ut??"",changedFileCount:b?.files?.length??0,onCommitAndSwitch:(y,z)=>vg(y,z,{targetBranch:ut,directory:f,sourceBranch:b?.current??null,git:l,publishChooser:We,toast:he,t:a,refreshStatusAndBranches:At,closeDialog:()=>at(null),performCheckout:Cn}),onGenerateMessage:async()=>{if(!f)return"";const y=(b?.files??[]).map(le=>le.path).sort(),{message:z}=await ji(f,y);return z.subject?.trim()??""},onRevertAndSwitch:async()=>{const y=ut;if(!y||!f)return;await ii((b?.files??[]).map(le=>le.path));const z=await l.getGitStatus(f);if(!z.isClean&&(z.files?.length??0)>0){he.error(a("gitView.dirtySwitch.revertIncomplete"));return}at(null),await Cn(y)}})]})},Pt=s=>{const e=re.c(13),{message:t,description:r,loading:o,icon:i}=s,a=o===void 0?!1:o,l=i===void 0?!1:i;let u;e[0]!==a?(u=a?n.jsx(G,{name:"loader-4",className:"size-5 animate-spin text-muted-foreground"}):null,e[0]=a,e[1]=u):u=e[1];let c;e[2]!==l?(c=l?n.jsx(G,{name:"git-branch",className:"size-6 text-muted-foreground"}):null,e[2]=l,e[3]=c):c=e[3];let d;e[4]!==t?(d=n.jsx("p",{className:"typography-ui-label font-semibold text-foreground",children:t}),e[4]=t,e[5]=d):d=e[5];let p;e[6]!==r?(p=r?n.jsx("p",{className:"typography-meta text-muted-foreground",children:r}):null,e[6]=r,e[7]=p):p=e[7];let g;return e[8]!==u||e[9]!==c||e[10]!==d||e[11]!==p?(g=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:[u,c,d,p]})}),e[8]=u,e[9]=c,e[10]=d,e[11]=p,e[12]=g):g=e[12],g},Cg=()=>{const s=re.c(7),{t:e}=be();let t;s[0]!==e?(t=e("mobile.changes.cleanDescription"),s[0]=e,s[1]=t):t=s[1];const r=gm(t);let o;s[2]!==e?(o=e("gitView.empty.cleanTitle"),s[2]=e,s[3]=o):o=s[3];let i;return s[4]!==r||s[5]!==o?(i=n.jsx(Pt,{icon:!0,message:o,description:r}),s[4]=r,s[5]=o,s[6]=i):i=s[6],i},mr=s=>{const e=re.c(69),{path:t,subtitle:r,diff:o,staged:i,fileExists:a,unavailableReason:l,error:u,onBack:c,onRetry:d,onExpandContextRequest:p,pendingContextExpansion:g,contextLoading:f,commentOrigin:b}=s,x=i===void 0?!1:i,h=l===void 0?null:l,v=u===void 0?null:u,{t:w}=be();let N;e[0]!==t?(N=ud(t)||"text",e[0]=t,e[1]=N):N=e[1];const _=N;let M;e[2]!==b||e[3]!==t?(M={fileLabel:t,origin:b},e[2]=b,e[3]=t,e[4]=M):M=e[4];const E=Bm(M);let j,C;if(e[5]!==t){const X=t.replace(/\/$/,""),te=X.lastIndexOf("/");j=X.slice(te+1),C=te>0?X.slice(0,te):null,e[5]=t,e[6]=j,e[7]=C}else j=e[6],C=e[7];const k=C;let L;e[8]===Symbol.for("react.memo_cache_sentinel")?(L=ae(bs,"border-b border-edge text-foreground"),e[8]=L):L=e[8];let I;e[9]!==w?(I=w("header.actions.backAria"),e[9]=w,e[10]=I):I=e[10];let A;e[11]===Symbol.for("react.memo_cache_sentinel")?(A=n.jsx(G,{name:"arrow-left",className:"size-5"}),e[11]=A):A=e[11];let R;e[12]!==c||e[13]!==I?(R=n.jsx("button",{type:"button",className:Nt,"aria-label":I,onClick:c,children:A}),e[12]=c,e[13]=I,e[14]=R):R=e[14];let F;e[15]===Symbol.for("react.memo_cache_sentinel")?(F=ae("oc-ui-start-align truncate",vn),e[15]=F):F=e[15];let T;e[16]!==j?(T=n.jsx("h2",{dir:"ltr",className:F,children:j}),e[16]=j,e[17]=T):T=e[17];let S;e[18]!==k?(S=k?n.jsx("span",{dir:"ltr",className:"oc-ui-start-align min-w-0 truncate",children:k}):null,e[18]=k,e[19]=S):S=e[19];let P;e[20]!==k||e[21]!==r?(P=k&&r?n.jsx("span",{"aria-hidden":!0,className:"shrink-0 opacity-60",children:"·"}):null,e[20]=k,e[21]=r,e[22]=P):P=e[22];let D;e[23]!==r?(D=r?n.jsx("span",{className:"min-w-0 max-w-full shrink-0 truncate",children:r}):null,e[23]=r,e[24]=D):D=e[24];let $;e[25]!==S||e[26]!==P||e[27]!==D?($=n.jsxs("p",{className:"flex min-w-0 items-baseline gap-1.5 typography-micro text-muted-foreground",children:[S,P,D]}),e[25]=S,e[26]=P,e[27]=D,e[28]=$):$=e[28];let K;e[29]!==t||e[30]!==T||e[31]!==$?(K=n.jsxs("div",{className:"min-w-0 flex-1 px-1",title:t,children:[T,$]}),e[29]=t,e[30]=T,e[31]=$,e[32]=K):K=e[32];const U=E.isOpen?"text-foreground":"text-muted-foreground";let O;e[33]!==U?(O=ae(Nt,U),e[33]=U,e[34]=O):O=e[34];let V;e[35]!==w?(V=w("inlineComment.actions.commentOnFile"),e[35]=w,e[36]=V):V=e[36];const q=E.isOpen;let ee;e[37]!==w?(ee=w("inlineComment.actions.commentOnFile"),e[37]=w,e[38]=ee):ee=e[38];let Z;e[39]===Symbol.for("react.memo_cache_sentinel")?(Z=n.jsx(G,{name:"chat-1",className:"size-5"}),e[39]=Z):Z=e[39];let Y;e[40]!==O||e[41]!==V||e[42]!==ee||e[43]!==E.isOpen||e[44]!==E.toggle?(Y=n.jsx("button",{type:"button",className:O,"aria-label":V,"aria-pressed":q,title:ee,onClick:E.toggle,children:Z}),e[40]=O,e[41]=V,e[42]=ee,e[43]=E.isOpen,e[44]=E.toggle,e[45]=Y):Y=e[45];let B;e[46]!==R||e[47]!==K||e[48]!==Y?(B=n.jsxs("header",{className:L,children:[R,K,Y]}),e[46]=R,e[47]=K,e[48]=Y,e[49]=B):B=e[49];let Q;e[50]!==b||e[51]!==f||e[52]!==o||e[53]!==v||e[54]!==a||e[55]!==_||e[56]!==p||e[57]!==d||e[58]!==t||e[59]!==g||e[60]!==x||e[61]!==w||e[62]!==h?(Q=n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:a?h==="nested_repository"?n.jsx(Pt,{icon:!0,message:w("diffView.unavailable.nestedRepositoryTitle"),description:w("diffView.unavailable.nestedRepositoryDescription")}):h==="untracked_directory"?n.jsx(Pt,{icon:!0,message:w("diffView.unavailable.untrackedDirectoryTitle"),description:w("diffView.unavailable.untrackedDirectoryDescription")}):v?n.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center",children:n.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-3",children:[n.jsx("p",{className:"typography-ui-label font-semibold text-foreground",children:w("mobile.changes.diffDetail.loadFailed")}),n.jsx("p",{className:"typography-meta text-muted-foreground",children:v}),n.jsx(Ae,{type:"button",size:"sm",variant:"outline",onClick:()=>d?.(),children:w("diffView.actions.retry")})]})}):o?o.submodule?n.jsx("div",{className:"p-3",children:n.jsx(lm,{state:o.submodule,staged:x})}):o.isBinary?n.jsx(Pt,{icon:!0,message:w("diffView.binary.unavailable")}):Uo(t)&&ea(o.original,o.modified)?n.jsx(Yt,{outerClassName:"h-full",className:"p-3",disableHorizontal:!0,"data-diff-virtual-root":!0,"data-diff-virtual-content":!0,children:n.jsx(Lm,{filePath:t,original:o.original,modified:o.modified,renderText:X=>n.jsx(Pi,{original:X.original,modified:X.modified,language:"text",fileName:t,commentOrigin:b,renderSideBySide:!1,wrapLines:!0,layout:"inline"})})}):fd(t)&&!o.fileDiff?n.jsx(Pt,{icon:!0,message:w("mobile.changes.diffDetail.imageUnavailable")}):n.jsx(Yt,{outerClassName:"h-full",className:"p-3",useScrollShadow:!0,disableHorizontal:!0,"data-diff-virtual-root":!0,"data-diff-virtual-content":!0,children:n.jsx(Pi,{original:o.original,modified:o.modified,fileDiff:o.fileDiff,language:_,fileName:t,commentOrigin:b,renderSideBySide:!1,wrapLines:!0,layout:"inline",onExpandContextRequest:p,pendingContextExpansion:g,contextLoading:f})}):n.jsx(Pt,{loading:!0,message:w("diffView.state.loadingDiff")}):n.jsx(Pt,{icon:!0,message:w("mobile.changes.diffDetail.missingTitle"),description:w("mobile.changes.diffDetail.missingDescription")})}),e[50]=b,e[51]=f,e[52]=o,e[53]=v,e[54]=a,e[55]=_,e[56]=p,e[57]=d,e[58]=t,e[59]=g,e[60]=x,e[61]=w,e[62]=h,e[63]=Q):Q=e[63];let oe;return e[64]!==B||e[65]!==Q||e[66]!==E.cards||e[67]!==E.editor?(oe=n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[B,E.cards,E.editor,Q]}),e[64]=B,e[65]=Q,e[66]=E.cards,e[67]=E.editor,e[68]=oe):oe=e[68],oe},po=s=>{const e=re.c(12),{files:t,onSelect:r}=s,{t:o}=be();let i;e[0]!==o?(i=o("gitView.changes.changedFilesAria"),e[0]=o,e[1]=i):i=e[1];let a;if(e[2]!==t||e[3]!==r||e[4]!==o){let u;e[6]!==r||e[7]!==o?(u=c=>{const d=c.status==="A"?o("diffView.change.new"):c.status==="D"?o("diffView.change.deleted"):c.status==="R"?o("diffView.change.renamed"):c.status==="C"?o("diffView.change.copied"):o("diffView.change.modified"),p=c.status==="A"?"var(--status-success)":c.status==="D"?"var(--status-error)":c.status==="R"||c.status==="C"?"var(--status-info)":"var(--status-warning)";return n.jsx("li",{children:n.jsxs("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:()=>r(c.path),children:[n.jsx("span",{className:"w-4 shrink-0 text-center typography-micro font-semibold uppercase",style:{color:p},"aria-label":d,children:c.status}),n.jsx(Go,{filePath:c.path,className:"size-3.5 shrink-0"}),n.jsx(xm,{path:c.path,nameFirst:!0,className:"flex-1 typography-ui-label"}),(c.insertions>0||c.deletions>0)&&n.jsx(bm,{insertions:c.insertions,deletions:c.deletions,hideZero:!0})]})},c.path)},e[6]=r,e[7]=o,e[8]=u):u=e[8],a=t.map(u),e[2]=t,e[3]=r,e[4]=o,e[5]=a}else a=e[5];let l;return e[9]!==i||e[10]!==a?(l=n.jsx(Yt,{outerClassName:"h-full",className:"px-2 py-1",useScrollShadow:!0,disableHorizontal:!0,children:n.jsx("ul",{"aria-label":i,className:"flex flex-col",children:a})}),e[9]=i,e[10]=a,e[11]=l):l=e[11],l},Ng=m.lazy(()=>gn(()=>import("./FilesView-Hvxe_KqA.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,219,220,221,222,223,224])).then(s=>({default:s.FilesView}))),es=s=>yn(s)??"",pn=s=>{const e=es(s);return!e||e==="/"?e||"/":e.split("/").filter(Boolean).at(-1)??e},Rg=s=>{const e=es(s);if(!e||e==="/")return null;const t=e.lastIndexOf("/");return t<=0?e.startsWith("/")?"/":null:e.slice(0,t)},Eg=(s,e)=>{const t=es(s),r=es(e);return!r||t===r?pn(t):t.startsWith(`${r}/`)?t.slice(r.length+1):t},Ig=s=>{if(typeof s!="number"||!Number.isFinite(s)||s<0)return"";if(s<1024)return`${s} B`;const e=["KB","MB","GB"];let t=s/1024;for(const r of e){if(t<1024||r===e[e.length-1])return`${t.toFixed(t>=10?0:1)} ${r}`;t/=1024}return""},_g=s=>{const e=re.c(5),{onClose:t,visible:r}=s,o=r===void 0?!0:r,i=Ho(),a=es(qo(i,Br()));if(i?.kind==="preparing"){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Yo,{}),e[0]=u):u=e[0],u}let l;return e[1]!==t||e[2]!==a||e[3]!==o?(l=n.jsx(Tg,{root:a,onClose:t,visible:o},a),e[1]=t,e[2]=a,e[3]=o,e[4]=l):l=e[4],l},Tg=({root:s,onClose:e,visible:t})=>{const{t:r}=be(),{files:o}=Or(),i=hl(),a=gl(B=>B.setSelectedPath),[l,u]=m.useState(()=>({type:"browser",directory:s})),[c,d]=m.useState([]),[p,g]=m.useState(!1),[f,b]=m.useState(null),[x,h]=m.useState(""),[v,w]=m.useState([]),[N,_]=m.useState(!1),M=m.useRef(0),E=l.type==="browser"?l.directory:l.returnDirectory,j=m.useRef(E);j.current=E;const C=m.useCallback(async(B,Q)=>{if(!B)return;const oe=!i,X=M.current+1;M.current=X,g(!0),Q?.background||b(null);try{const te=await o.listDirectory(B,{respectGitignore:oe});if(M.current!==X)return;b(null),d(te.entries.slice().sort((ce,ue)=>ce.isDirectory!==ue.isDirectory?ce.isDirectory?-1:1:ce.name.localeCompare(ue.name)))}catch(te){if(M.current!==X)return;if(Q?.background){console.error("Failed to reload mobile directory:",te);return}d([]),b(te instanceof Error?te.message:r("mobile.files.error.listFailed"))}finally{M.current===X&&g(!1)}},[o,i,r]);m.useEffect(()=>{l.type==="browser"&&C(l.directory)},[C,l]);const k=m.useRef(l);k.current=l;const L=m.useRef(c);L.current=c;const I=m.useCallback(({directories:B})=>{const Q=k.current;Q.type==="browser"&&(B&&!B.some(oe=>es(oe)===es(Q.directory))||L.current.length>Wu||C(Q.directory,{background:!0}))},[C]);Ku({root:s,active:t,whileInactive:"hold",onChanges:I});const A=m.useCallback(async B=>{es(B)===es(j.current)&&await C(j.current)},[C]),{canUpload:R,uploadingDirectory:F,pickFiles:T,uploadElements:S}=Vu({root:s,refreshDirectory:A}),P=F!==null;m.useEffect(()=>{if(l.type!=="browser")return;const B=x.trim();if(!B){w([]),_(!1);return}let Q=!1;const oe=window.setTimeout(()=>{_(!0),o.search({directory:l.directory,query:B,maxResults:40}).then(X=>{Q||w(X)}).catch(()=>{Q||w([])}).finally(()=>{Q||_(!1)})},250);return()=>{Q=!0,window.clearTimeout(oe)}},[o,x,l]);const D=B=>{h(""),u({type:"browser",directory:B})},$=B=>{a(s,B),u({type:"file",path:B,returnDirectory:E||s})},K=Xe(B=>B.pendingFileFocusPath),U=Xe(B=>B.pendingFileNavigation);if(m.useEffect(()=>{const B=es(U?.path??K??"");!B||!s||(a(s,B,{allowOutsideRoot:!0}),u(Q=>({type:"file",path:B,returnDirectory:Q.type==="file"?Q.returnDirectory:s})),K&&Xe.getState().setPendingFileFocusPath(null))},[K,U,s,a]),!s)return n.jsx(hn,{message:r("mobile.files.empty.noDirectory")});if(l.type==="file")return n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[n.jsxs("header",{className:ae(bs,"border-b border-edge text-foreground"),children:[n.jsx("button",{type:"button",className:Nt,"aria-label":r("header.actions.backAria"),onClick:()=>u({type:"browser",directory:l.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:ae("truncate",vn),children:pn(l.path)})})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:n.jsx(bt,{children:n.jsx(m.Suspense,{fallback:n.jsx(hn,{loading:!0,message:r("filesView.state.loading")}),children:n.jsx(Ng,{mode:"editor-only"})})})})]});const O=l.directory===s?r("mobile.files.rootDirectory"):pn(l.directory),V=x.trim()?v:[],q=Rg(l.directory),ee=l.directory!==s&&q!==null&&(q===s||q.startsWith(`${s}/`)),Z=ee&&!x.trim(),Y=ee?q:null;return n.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[S,n.jsxs("div",{className:"shrink-0 px-2 pt-1",children:[n.jsx(xd,{value:x,onChange:h,placeholder:r("mobile.files.search.placeholder"),actions:n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",className:pr,"aria-label":r("mobile.files.refreshAria"),onClick:()=>{C(l.directory)},children:n.jsx($f,{className:ae("size-4",p&&"animate-spin")})}),R?n.jsx("button",{type:"button",className:pr,"aria-label":r("sidebarFilesTree.actions.uploadFilesTitle"),onClick:()=>T(l.directory),disabled:P,children:n.jsx(G,{name:P?"loader-4":"upload-2",className:ae("size-4",P&&"animate-spin")})}):null,e?n.jsx("button",{type:"button",className:pr,"aria-label":r("mobile.surface.closeAria"),onClick:e,children:n.jsx(Wf,{className:"size-4"})}):null]})}),Z&&Y?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":r("mobile.files.backToParentAria",{name:pn(Y)}),onClick:()=>D(Y),children:[n.jsx(Kf,{className:"size-4 shrink-0 text-muted-foreground"}),n.jsx("span",{className:"min-w-0 truncate typography-ui-label text-muted-foreground",children:O})]}):null]}),n.jsx(Yt,{outerClassName:"min-h-0 flex-1",className:"px-2 pb-3 pt-1",useScrollShadow:!0,disableHorizontal:!0,children:f?n.jsx(hn,{message:f}):x.trim()?n.jsx(Ag,{root:s,results:V,isSearching:N,onOpenFile:$}):n.jsxs(n.Fragment,{children:[c.length===0&&!p?n.jsx("div",{className:"px-4 py-8 text-center typography-ui-label text-muted-foreground",children:r("mobile.files.empty.directory")}):null,c.map(B=>n.jsx(Aa,{name:B.name,path:B.path,directory:B.isDirectory,meta:B.isDirectory?void 0:Ig(B.size),onClick:()=>B.isDirectory?D(B.path):$(B.path)},B.path))]})})]})},pr="-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",Aa=s=>{const e=re.c(16),{name:t,path:r,directory:o,meta:i,onClick:a}=s;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={touchAction:"manipulation"},e[0]=l):l=e[0];let u;e[1]!==o||e[2]!==r?(u=o?n.jsx(qf,{className:"size-4 shrink-0 text-primary/80"}):n.jsx(Go,{filePath:r,className:"size-4 shrink-0"}),e[1]=o,e[2]=r,e[3]=u):u=e[3];let c;e[4]!==t?(c=n.jsx("span",{className:"block min-w-0 flex-1 truncate typography-ui-label text-foreground",children:t}),e[4]=t,e[5]=c):c=e[5];let d;e[6]!==i?(d=i?n.jsx("span",{className:"min-w-0 max-w-[55%] shrink truncate typography-micro text-muted-foreground",dir:"auto",children:i}):null,e[6]=i,e[7]=d):d=e[7];let p;e[8]!==o?(p=o?n.jsx(Uf,{className:"size-4 shrink-0 text-muted-foreground"}):null,e[8]=o,e[9]=p):p=e[9];let g;return e[10]!==a||e[11]!==u||e[12]!==c||e[13]!==d||e[14]!==p?(g=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:a,style:l,children:[u,c,d,p]}),e[10]=a,e[11]=u,e[12]=c,e[13]=d,e[14]=p,e[15]=g):g=e[15],g},Ag=s=>{const e=re.c(17),{root:t,results:r,isSearching:o,onOpenFile:i}=s,{t:a}=be();if(o){let c;e[0]!==a?(c=a("common.loading"),e[0]=a,e[1]=c):c=e[1];let d;return e[2]!==c?(d=n.jsx(hn,{loading:!0,message:c}),e[2]=c,e[3]=d):d=e[3],d}if(r.length===0){let c;e[4]!==a?(c=a("mobile.files.search.empty"),e[4]=a,e[5]=c):c=e[5];let d;return e[6]!==c?(d=n.jsx(hn,{message:c}),e[6]=c,e[7]=d):d=e[7],d}let l;if(e[8]!==i||e[9]!==r||e[10]!==t){let c;e[12]!==i||e[13]!==t?(c=d=>n.jsx(Aa,{name:pn(d.path),path:d.path,directory:!1,meta:Eg(d.path,t),onClick:()=>i(d.path)},d.path),e[12]=i,e[13]=t,e[14]=c):c=e[14],l=r.map(c),e[8]=i,e[9]=r,e[10]=t,e[11]=l}else l=e[11];let u;return e[15]!==l?(u=n.jsx(n.Fragment,{children:l}),e[15]=l,e[16]=u):u=e[16],u},hn=s=>{const e=re.c(7),{message:t,loading:r}=s,o=r===void 0?!1:r;let i;e[0]!==o?(i=o?n.jsx(Vf,{className:"size-5 animate-spin text-muted-foreground"}):n.jsx(Hf,{className:"size-6 text-muted-foreground"}),e[0]=o,e[1]=i):i=e[1];let a;e[2]!==t?(a=n.jsx("p",{className:"typography-ui-label font-semibold text-foreground",children:t}),e[2]=t,e[3]=a):a=e[3];let l;return e[4]!==i||e[5]!==a?(l=n.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center",children:n.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-2",children:[i,a]})}),e[4]=i,e[5]=a,e[6]=l):l=e[6],l},Pg=s=>{const e=re.c(21),{visible:t,onLeave:r,sectionsDialogOpen:o,onSectionsDialogOpenChange:i}=s,{t:a}=be(),l=nt(Dg),u=Br()??null,c=yd(),[d,p]=m.useState(1);let g,f;e[0]!==t?(g=()=>{t&&p(Og)},f=[t],e[0]=t,e[1]=g,e[2]=f):(g=e[1],f=e[2]),m.useEffect(g,f);const b=!c.allSectionsHidden&&d===0;let x;e[3]!==u||e[4]!==c||e[5]!==r||e[6]!==l||e[7]!==t?(x=t&&!c.allSectionsHidden?n.jsx(vd.Provider,{value:r,children:n.jsx(wd.Provider,{value:!0,children:n.jsx(jd,{onChange:p,children:n.jsx(Yt,{useScrollShadow:!0,scrollShadowSize:24,outerClassName:"min-h-0 flex-1",className:"px-3 pb-4 pt-2",disableHorizontal:!0,children:n.jsx(kd,{sessionId:l,directory:u,repositoryEnabled:!Ar(u),layout:c})})})})}):null,e[3]=u,e[4]=c,e[5]=r,e[6]=l,e[7]=t,e[8]=x):x=e[8];let h;e[9]!==c.allSectionsHidden||e[10]!==i||e[11]!==b||e[12]!==a?(h=c.allSectionsHidden||b?n.jsxs("div",{className:"absolute inset-x-0 top-16 flex flex-col items-center px-6 text-center",children:[n.jsx("span",{className:"typography-ui-label text-muted-foreground",children:c.allSectionsHidden?a("chat.workStatus.sections.allHidden"):a("chat.workStatus.mobileEmpty")}),c.allSectionsHidden?n.jsx(Ae,{variant:"link",size:"sm",onClick:()=>i(!0),className:"mt-2 normal-case text-muted-foreground hover:text-foreground",children:a("chat.workStatus.sections.open")}):null]}):null,e[9]=c.allSectionsHidden,e[10]=i,e[11]=b,e[12]=a,e[13]=h):h=e[13];let v;e[14]!==i||e[15]!==o?(v=n.jsx(Sd,{open:o,onOpenChange:i}),e[14]=i,e[15]=o,e[16]=v):v=e[16];let w;return e[17]!==x||e[18]!==h||e[19]!==v?(w=n.jsxs("div",{className:"relative flex h-full min-h-0 flex-col",children:[x,h,v]}),e[17]=x,e[18]=h,e[19]=v,e[20]=w):w=e[20],w};function Dg(s){return s.currentSessionId}function Og(s){return Math.max(s,1)}const ho="mobile-surface-root",Mg=16,go=320,Lg="cubic-bezier(0.22, 1, 0.36, 1)",Bg=({open:s,onClose:e,tab:t,onTabChange:r,pendingChangesDiff:o,onOpenPlan:i,variant:a="drawer"})=>{const{t:l,direction:u}=be(),c=m.useRef(null),d=m.useRef(null),[p,g]=m.useState(!1),[f,b]=m.useState(s),x=m.useRef(e);m.useEffect(()=>{x.current=e},[e]);const h=Xe(T=>T.mobileWorkspaceTabOrder),v=Xe(T=>T.mobileWorkspaceHiddenTabs),w=Xe(T=>T.setMobileWorkspaceTabOrder),[N,_]=m.useState(!1),M=m.useRef(t);m.useEffect(()=>{M.current=t},[t]);const E=()=>x.current();si(d,{enabled:a==="drawer"&&s,...u==="rtl"?{onRightEdgeSwipe:E}:{onLeftEdgeSwipe:E}});const[j,C]=m.useState(()=>new Set);if(m.useEffect(()=>{s&&C(T=>{if(T.has(t))return T;const S=new Set(T);return S.add(t),S})},[s,t]),typeof document<"u"&&!c.current){let T=document.getElementById(ho);T||(T=document.createElement("div"),T.id=ho,document.body.appendChild(T)),c.current=T}if(m.useEffect(()=>{if(s){b(!0);const S=window.setTimeout(()=>g(!0),Mg);return()=>window.clearTimeout(S)}g(!1);const T=window.setTimeout(()=>b(!1),go+40);return()=>window.clearTimeout(T)},[s]),m.useEffect(()=>{if(!s)return;const T=document.body.style.overflow;a==="drawer"&&(document.body.style.overflow="hidden");const S=P=>{P.key!=="Escape"||M.current==="terminal"||Nd(P.target)||Mr(P)||x.current()};return document.addEventListener("keydown",S),()=>{a==="drawer"&&(document.body.style.overflow=T),document.removeEventListener("keydown",S)}},[s,a]),a==="drawer"&&!c.current)return null;const k={status:{id:"status",label:l("chat.workStatus.ariaLabel"),icon:n.jsx(G,{name:"list-indefinite",className:"h-3.5 w-3.5"})},changes:{id:"changes",label:l("mobile.menu.git"),icon:n.jsx(G,{name:"git-branch",className:"h-3.5 w-3.5"})},files:{id:"files",label:l("mobile.menu.files"),icon:n.jsx(G,{name:"file-text",className:"h-3.5 w-3.5"})},terminal:{id:"terminal",label:l("mobile.menu.terminal"),icon:n.jsx(G,{name:"terminal",className:"h-3.5 w-3.5"})},notes:{id:"notes",label:l("contextRail.surface.notes"),icon:n.jsx(G,{name:"sticky-note",className:"h-3.5 w-3.5"})}},L=bl(h,v,t),I=L.map(T=>k[T]),A=I.length===1?I[0]:null,R=(T,S)=>{const P=xl(h),D=P.findIndex(K=>K===T),$=P.findIndex(K=>K===S);D<0||$<0||w(Mf(P,D,$))},F=n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:bs,children:[n.jsx("div",{className:"flex h-9 min-w-0 flex-1 items-center",children:A?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:A.icon}),n.jsx("span",{className:"truncate",children:A.label})]}):f?n.jsx(Cd,{items:I,activeId:t,onSelect:T=>{const S=L.find(P=>P===T);S&&r(S)},onReorder:R,layoutMode:"fit",variant:"active-pill",nonCompositedIndicator:!0,inactiveTabsIconOnly:I.length>3,className:"h-full"}):null}),t==="status"?n.jsx("button",{type:"button",className:Nt,"aria-label":l("chat.workStatus.sections.open"),onClick:()=>_(!0),style:{touchAction:"manipulation"},children:n.jsx(G,{name:"equalizer-2",className:"size-5"})}):null,n.jsx("button",{type:"button",className:Nt,"aria-label":l("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:[j.has("status")?n.jsx("div",{className:ae("h-full",t!=="status"&&"hidden"),children:n.jsx(bt,{children:n.jsx(Pg,{visible:s&&t==="status",onLeave:e,sectionsDialogOpen:N,onSectionsDialogOpenChange:_})})}):null,j.has("changes")?n.jsx("div",{className:ae("h-full",t!=="changes"&&"hidden"),children:n.jsx(bt,{children:n.jsx(kg,{visible:s&&t==="changes",initialDiff:o,onNavigatedToChat:e})})},o?`changes:${o.path}:${o.staged}`:"changes"):null,j.has("files")?n.jsx("div",{className:ae("h-full",t!=="files"&&"hidden"),children:n.jsx(bt,{children:n.jsx(_g,{visible:s&&t==="files"})})}):null,j.has("terminal")?n.jsx("div",{className:ae("h-full",t!=="terminal"&&"hidden"),children:n.jsx(bt,{children:n.jsx(Hu,{visible:s&&t==="terminal"})})}):null,j.has("notes")?n.jsx("div",{className:ae("h-full",t!=="notes"&&"hidden"),children:n.jsx(bt,{children:n.jsx(qu,{visible:s&&t==="notes",onActionComplete:e,onOpenPlan:i})})}):null]})]});return a==="panel"?n.jsx("div",{className:"flex h-full min-h-0 flex-col bg-background text-foreground",children:F}):Es.createPortal(n.jsx("section",{ref:d,role:"dialog","aria-modal":"true","aria-label":l("mobile.header.openWorkspaceAria"),"aria-hidden":!s,className:"oc-keyboard-inset-surface oc-bottom-safe-surface fixed inset-0 z-50 flex flex-col bg-background text-foreground",style:{paddingTop:"var(--oc-safe-area-top, 0px)",transform:p?"none":u==="rtl"?"translateX(-100%)":"translateX(100%)",transition:`transform ${go}ms ${Lg}`,visibility:f?"visible":"hidden",pointerEvents:s?"auto":"none"},children:F}),c.current)};function zg(s){const e=re.c(4),t=2500,{uiFont:r}=Rd(),[o,i]=m.useState(!1);let a,l;return e[0]!==t||e[1]!==r?(a=()=>{let u=!1;const c=()=>{u||i(!0)},d=()=>{requestAnimationFrame(()=>requestAnimationFrame(c))},p=Promise.all([Ed(r).catch(Vg),document.fonts?.ready?.then(Kg).catch(Wg)??Promise.resolve(),zm.catch($g)]).then(Fg),g=new Promise(f=>{window.setTimeout(f,t)});return Promise.race([p,g]).then(d),()=>{u=!0}},l=[r,t],e[0]=t,e[1]=r,e[2]=a,e[3]=l):(a=e[2],l=e[3]),m.useEffect(a,l),o}function Fg(){}function $g(){}function Wg(){}function Kg(){}function Vg(){}const Hg=Fr({projectId:$s().trim().min(1).optional(),text:$s().optional()}),qg=Fr({request:Hg.nullish()}),Pa=Qo("ShortcutRequests"),Ug=async()=>{const s=qg.safeParse(await Pa.takePending());return s.success?s.data.request??null:null},Gg=s=>{if(Tr()!=="ios")return()=>{};let e=!1,t=null;const r=()=>{Ug().then(o=>{o&&s(o)}).catch(()=>{})};return Pa.addListener("pending",r).then(o=>{if(e){o.remove();return}t=o}).catch(()=>{}),r(),()=>{e=!0,t?.remove()}},Xg="openchamber",Jg=s=>s.replace(/^\/+|\/+$/g,""),Yg=s=>{const e=Jg(s.pathname).split("/").filter(Boolean);return s.host?[s.host,...e]:e};function Qg(s){if(typeof s!="string"||s.length===0)return null;let e;try{e=new URL(s)}catch{return null}if(e.protocol!==`${Xg}:`)return null;const t=Yg(e),r=(t[0]??"").toLowerCase(),o=t.slice(1),i=e.searchParams;switch(r){case"session":{const a=o[0]||i.get("id")||"";if(!a)return null;const l=i.get("message")?.trim()??"";return{type:"session",sessionId:a,directory:i.get("dir")??void 0,...Id(l)?{messageId:l}:{}}}case"new":case"new-session":return{type:"new-session",directory:i.get("dir")??void 0,projectId:i.get("project")??void 0,agent:i.get("agent")??void 0,model:i.get("model")??void 0};case"sessions":{const a=i.get("filter");return{type:"sessions",filter:a==="attention"||a==="recent"||a==="all"?a:void 0}}case"status":return{type:"status"};case"settings":return{type:"settings",section:o[0]||i.get("section")||void 0};case"changes":return{type:"changes",path:o.join("/")||i.get("path")||void 0,staged:i.get("staged")==="true"};case"view":{const a=(o[0]||"").toLowerCase();return a==="changes"?{type:"changes"}:a==="files"||a==="mcp"||a==="instances"||a==="update"?{type:"view",target:a}:null}default:return null}}let Wt={},Da=!1,dn=null;const Zg=s=>{const e=nt.getState(),t=s.projectId?Mt.getState().projects.find(o=>o.id===s.projectId)??null:null;e.openNewSessionDraft(t?{selectedProjectId:t.id}:void 0);const r=s.text?.trim();if(r){if(s.projectId&&!t){ki.getState().setPendingInputText(r,"append");return}ki.getState().requestDraftSubmit(nt.getState().newSessionDraft.draftId,r)}},eb=s=>{switch(s.type){case"shortcut-new-session":return Zg(s),!0;case"session":return _d(s.sessionId,{directory:s.directory??null,messageId:s.messageId??null}),!0;case"new-session":{const e=nt.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 Wt.openSessions?(Wt.openSessions(s.filter),!0):!1;case"status":return Wt.openSessions?(Wt.openSessions(),!0):!1;case"view":return Wt.openView?(Wt.openView(s.target),!0):!1;case"changes":return Wt.openChanges?(Wt.openChanges({path:s.path,staged:s.staged}),!0):!1;case"settings":return Wt.openSettings?(Wt.openSettings(s.section),!0):!1}},ni=()=>{if(!Da||!dn)return;const s=dn;dn=null,eb(s)||(dn=s)},_r=s=>{dn=s,ni()},bo=s=>{const e=Qg(s);e&&_r(e)},tb=s=>{Da=s,ni()},sb=s=>{const e=re.c(3);let t,r;e[0]!==s?(t=()=>(Wt=s,ni(),()=>{Wt===s&&(Wt={})}),r=[s],e[0]=s,e[1]=t,e[2]=r):(t=e[1],r=e[2]),m.useEffect(t,r)},nb=s=>{const{ready:e}=s;m.useEffect(()=>{tb(e)},[e]),m.useEffect(()=>{if(!ct())return;let t=!1;const r=[];return gn(()=>import("./vendor-capacitor-app-BrDJj9I_.js"),__vite__mapDeps([225,1,109])).then(async({App:o})=>{if(t)return;const i=await o.addListener("appUrlOpen",a=>{bo(a?.url)});if(t){i.remove();return}r.push(()=>{i.remove()})}).catch(()=>{}),r.push(Gg(o=>{_r({type:"shortcut-new-session",projectId:o.projectId,text:o.text})})),gn(()=>import("./vendor-capacitor-push-notifications-KNe1zSBF.js"),__vite__mapDeps([226,109])).then(async({PushNotifications:o})=>{if(t)return;const i=await o.addListener("pushNotificationActionPerformed",a=>{const l=a?.notification?.data,u=typeof l?.url=="string"?l.url:typeof l?.deeplink=="string"?l.deeplink:void 0;if(u){bo(u);return}const c=typeof l?.sessionId=="string"?l.sessionId:void 0;c&&_r({type:"session",sessionId:c})});if(t){i.remove();return}r.push(()=>{i.remove()})}).catch(()=>{}),()=>{t=!0,r.forEach(o=>o())}},[])},rb=()=>{if(typeof window>"u")return;const s=window.__OPENCHAMBER_APNS_ENV__;if(s==="development")return"sandbox";if(s==="production")return"production"},xo=/^[A-Za-z0-9+/]{43}=$/,ib=Qo("PushKey"),ob=async()=>{const s=window.__OPENCHAMBER_PUSH_KEY__;if(s&&xo.test(s))return s;const e=await ib.get().then(t=>t.key).catch(()=>{});return e&&xo.test(e)?e:void 0},ab=()=>{if(typeof window>"u")return!1;const e=window.Capacitor?.getPlatform?.();return e==="ios"||e==="android"},lb=s=>{const{enabled:e}=s,t=Xe(o=>o.nativeNotificationsEnabled),r=m.useRef(null);m.useEffect(()=>{if(!e||!t||!ab())return;let o=!1;const i=[];return gn(()=>import("./vendor-capacitor-push-notifications-KNe1zSBF.js"),__vite__mapDeps([226,109])).then(async({PushNotifications:a})=>{if(o)return;let l=await a.checkPermissions().catch(()=>null);if(l?.receive!=="granted"&&(l=await a.requestPermissions().catch(()=>null)),l?.receive!=="granted")return;const u=await a.addListener("registration",d=>{r.current=d.value,ob().then(p=>{const g=mi(),f={token:d.value,platform:Tr(),environment:rb()};p&&(f.pushKey=p),g?.push?.registerApnsToken?.(f)})}),c=await a.addListener("registrationError",d=>{console.warn("[Push] APNs registration error:",d)});if(await a.register().catch(()=>{}),o){u.remove(),c.remove();return}i.push(()=>{u.remove()},()=>{c.remove()})}).catch(()=>{}),()=>{o=!0,i.forEach(a=>a())}},[e,t]),m.useEffect(()=>{if(t)return;const o=r.current;if(!o)return;r.current=null,mi()?.push?.unregisterApnsToken?.({token:o})},[t])},yo=s=>{const e=re.c(12),{side:t,isResizing:r,ariaLabel:o,handleProps:i}=s,a=t==="left"?"inset-e-0":"inset-s-0";let l;e[0]!==a?(l=ae("absolute inset-y-0 z-50 w-6 cursor-col-resize touch-none",a),e[0]=a,e[1]=l):l=e[1];const u=t==="left"?"inset-e-0":"inset-s-0",c=r&&"bg-[var(--interactive-border)]";let d;e[2]!==u||e[3]!==c?(d=ae("absolute inset-y-0 w-[3px] transition-colors",u,c),e[2]=u,e[3]=c,e[4]=d):d=e[4];let p;e[5]!==d?(p=n.jsx("div",{className:d}),e[5]=d,e[6]=p):p=e[6];let g;return e[7]!==o||e[8]!==i||e[9]!==l||e[10]!==p?(g=n.jsx("div",{className:l,role:"separator","aria-orientation":"vertical","aria-label":o,...i,children:p}),e[7]=o,e[8]=i,e[9]=l,e[10]=p,e[11]=g):g=e[11],g},cb=320,db=380,vo=280,ub=560,fb=900;function wo(s,e,t,r){const o=re.c(23),i=r===void 0?ub:r,a=m.useRef(null);let l;o[0]!==t||o[1]!==i||o[2]!==e?(l=()=>{if(typeof window>"u")return t;const R=Number.parseInt(window.localStorage.getItem(e)??"",10);return Number.isFinite(R)?Math.min(i,Math.max(vo,R)):t},o[0]=t,o[1]=i,o[2]=e,o[3]=l):l=o[3];const[u,c]=m.useState(l),[d,p]=m.useState(!1),g=m.useRef(0),f=m.useRef(u),b=m.useRef(null),x=m.useRef(null);let h;o[4]!==i?(h=R=>Math.min(i,Math.max(vo,Math.round(R))),o[4]=i,o[5]=h):h=o[5];const v=h;let w;o[6]===Symbol.for("react.memo_cache_sentinel")?(w=R=>{const F=a.current;F&&(F.style.width=`${R}px`,F.style.minWidth=`${R}px`,F.style.maxWidth=`${R}px`,F.style.setProperty("--oc-ipad-sidebar-width",`${R}px`))},o[6]=w):w=o[6];const N=w;let _;o[7]!==u?(_=R=>{try{R.currentTarget.setPointerCapture(R.pointerId)}catch{}x.current=R.pointerId,g.current=R.clientX,f.current=u,b.current=u,p(!0),R.preventDefault()},o[7]=u,o[8]=_):_=o[8];const M=_;let E;o[9]!==v||o[10]!==s?(E=R=>{if(x.current!==R.pointerId)return;const F=(s==="left"?1:-1)*(yl(R.currentTarget)?-1:1),T=v(f.current+(R.clientX-g.current)*F);b.current!==T&&(b.current=T,N(T))},o[9]=v,o[10]=s,o[11]=E):E=o[11];const j=E;let C;o[12]!==v||o[13]!==e?(C=R=>{if(x.current!==R.pointerId)return;try{R.currentTarget.releasePointerCapture(R.pointerId)}catch{}const F=v(b.current??f.current);x.current=null,b.current=null,p(!1),c(F);try{window.localStorage.setItem(e,String(F))}catch{}},o[12]=v,o[13]=e,o[14]=C):C=o[14];const k=C;let L;o[15]!==M||o[16]!==k||o[17]!==j?(L={onPointerDown:M,onPointerMove:j,onPointerUp:k,onPointerCancel:k},o[15]=M,o[16]=k,o[17]=j,o[18]=L):L=o[18];const I=L;let A;return o[19]!==I||o[20]!==d||o[21]!==u?(A={asideRef:a,width:u,isResizing:d,handleProps:I},o[19]=I,o[20]=d,o[21]=u,o[22]=A):A=o[22],A}const mb=()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,pb=200;function jo(s){const e=re.c(6),[t,r]=m.useState(!1),[o,i]=m.useState(s);s!==o&&(i(s),r(!s&&!mb()));let a,l;e[0]!==t?(a=()=>{if(!t)return;const d=window.setTimeout(()=>r(!1),pb);return()=>window.clearTimeout(d)},l=[t],e[0]=t,e[1]=a,e[2]=l):(a=e[1],l=e[2]),m.useEffect(a,l);const u=s||t;let c;return e[3]!==s||e[4]!==u?(c={placed:u,inPlace:s},e[3]=s,e[4]=u,e[5]=c):c=e[5],c}const ko=["general","isolated-spaces","appearance","chat","notifications","sessions","routing","git","magic-prompts","snippets","behavior","agents","commands","mcp","plugins","skills.installed","skills.catalog","providers","web-search","usage","voice","integrations","about"],hb=1e3,gb=({onActiveConnectionDeleted:s})=>{const{t:e,direction:t}=be();uf();const[r,o]=m.useState(!1);m.useEffect(()=>nt.subscribe((W,de)=>{W.currentSessionId&&W.currentSessionId!==de.currentSessionId&&Xe.getState().setRunOverviewKey(null)}),[]);const i=Xe(W=>W.runOverviewKey!==null);m.useEffect(()=>{i&&o(!1)},[i]);const[a,l]=m.useState(null),[u,c]=m.useState(!1),[d,p]=m.useState(()=>{const{mobileWorkspaceTabOrder:W,mobileWorkspaceHiddenTabs:de}=Xe.getState();return hi(W,de)[0]}),g=m.useCallback(()=>{const{mobileWorkspaceTabOrder:W,mobileWorkspaceHiddenTabs:de}=Xe.getState(),Ne=hi(W,de);p(Ie=>Ne.includes(Ie)?Ie:Ne[0]),c(!0)},[]),[f,b]=m.useState(null),[x,h]=m.useState("nav"),[v,w]=m.useState(null),N=Xe(W=>W.setSettingsPage),_=Xe(W=>W.wideChatLayoutEnabled),M=Cs(W=>W.available),E=Cs(W=>W.runtimeType),j=m.useMemo(()=>zr(),[]),C=m.useCallback(()=>{l(null),b(null)},[]),k=m.useCallback(W=>{l(W)},[]),L=m.useCallback(()=>{c(!1)},[]),I=m.useCallback(W=>{h(W),k("settings")},[k]);m.useEffect(()=>bg(ko,I),[I]);const{enabled:A,roomyForPanels:R}=Pr(),T=qd()==="portrait",S=Ud(),[P,D]=m.useState(()=>Gd().roomyForPanels),$=m.useCallback(()=>{D(W=>!W)},[]);m.useEffect(()=>{A||D(!1)},[A]);const K=m.useCallback(()=>{w(null),p("files"),c(!0)},[]);m.useEffect(()=>Ci(W=>{if(W.type!=="file-open-request")return;const de=W.directory??Fs.getState().currentDirectory;if(!de)return;const Ne=()=>{Xe.getState().openContextFile(de,W.path),K()},{sessionId:Ie}=W;if(!Ie){Ne();return}hg(Ie,async Fe=>Xs.getState().entityById.get(Fe)??await gr.getSession(Fe).catch(()=>null)).then(Fe=>{const Ve=()=>{const{currentSessionId:Je}=nt.getState();return Je===Ie||Fe.some(fe=>fe.id===Je)};if(Ve()){Ne();return}const He=Fe[0]?.title;he.info(gg(W.path),{id:`file-open-${Ie}:${W.path}`,description:He?e("chat.fileOpenRequest.toast.description",{session:He}):e("chat.fileOpenRequest.toast.descriptionUntitled"),action:{label:e("chat.fileOpenRequest.toast.openSession"),onClick:()=>{Xd(Ie,de),C(),o(!1),Ve()&&Ne()}}})})}),[C,K,e]),m.useEffect(()=>Ci(W=>{if(W.type!=="plan-open-request")return;const de=ff(W.directory??Fs.getState().currentDirectory,W.projectId);de&&b({id:W.planId,title:W.title,projectRef:de})}),[]);const U=m.useCallback((W=null)=>{w(W),p("changes"),c(!0)},[]),O=wo("left","openchamber.ipad.leftSidebarWidth",cb),V=wo("right","openchamber.ipad.rightSidebarWidth",db,fb),q=R,ee=jo(A&&P),Z=jo(q&&u),Y=q&&Z.placed?V.width:0,B=A&&ee.placed?O.width:0,Q=t==="rtl"?"100%":"-100%",oe=t==="rtl"?"-100%":"100%";m.useEffect(()=>(xr.setState({left:B,right:Y}),()=>xr.setState({left:0,right:0})),[B,Y]),m.useEffect(()=>{if(typeof document>"u")return;const W=document.documentElement;return W.classList.toggle("wide-chat-layout",_),()=>W.classList.remove("wide-chat-layout")},[_]),m.useEffect(()=>{if(typeof document>"u")return;const W=A&&(T||S),de=document.documentElement;return de.classList.toggle("oc-keep-draft-starters",W),()=>de.classList.remove("oc-keep-draft-starters")},[S,A,T]);const X=m.useMemo(()=>({openChanges:({diffPath:W,staged:de,scope:Ne}={})=>{U(W?{path:W,staged:de===!0,scope:Ne}:null)},openFiles:()=>K(),openSourceBoard:()=>k("board")}),[U,K,k]),te=m.useMemo(()=>({openSessions:()=>{A?D(!0):o(!0)},openView:W=>{if(W==="files"){K();return}if(W==="mcp"){p("status"),c(!0);return}k(W)},openChanges:({path:W,staged:de}={})=>{U(W?{path:W,staged:de===!0}:null)},openSettings:W=>{W&&N(W),I(W?"page-content":"nav")}}),[A,U,K,I,k,N]);sb(te);const ce=m.useRef(null),ue=()=>{A?D(!0):o(!0)},H=()=>g();si(ce,{onLeftEdgeSwipe:t==="rtl"?H:ue,onRightEdgeSwipe:t==="rtl"?ue:H});const ne=m.useRef(null),Te=m.useCallback(W=>{ne.current=W},[]),se=m.useCallback(()=>Jd()?!0:f?(b(null),!0):a==="settings"&&ne.current?.()?!0:a?(C(),!0):u?(L(),!0):r?(o(!1),!0):!1,[a,C,L,f,r,u]);Yd(se),Qd(se,!!(f||a||u||r));const xe=!j&&M&&(E==="desktop"||E==="web"),pe=A?"dialog":"fullscreen",ke=Xe(W=>W.overviewFeatureAvailable),Ee=m.useMemo(()=>({instanceLabel:j?Ss():null,onOpenInstances:j?()=>k("instances"):void 0,onOpenSettings:()=>I("nav"),onOpenUsage:()=>k("usage"),onOpenScheduled:()=>k("scheduled"),onOpenArchive:()=>k("archive"),onOpenOverview:ke?()=>k("overview"):void 0,onOpenSourceBoard:()=>k("board"),onOpenUpdate:xe?()=>k("update"):void 0}),[I,k,ke,j,xe]),ye=m.useCallback(W=>{C(),o(!1),W==="file"&&K()},[C,K]),ge=m.useCallback(()=>{C(),o(!1)},[C]),we=m.useCallback(()=>{C(),o(!1),A&&!R&&D(!1)},[C,A,R]),ve=m.useCallback(()=>{C(),o(!1),A&&!R&&D(!1)},[C,A,R]);return n.jsx(Zd,{actions:X,children:n.jsxs("div",{className:"oc-mobile-app-shell main-content-safe-area flex h-[100dvh] flex-row bg-background text-foreground","data-page-scroll-lock":"true",children:[A?n.jsxs("aside",{ref:O.asideRef,className:ae("oc-ipad-sidebar relative flex h-full shrink-0 flex-col overflow-hidden"),style:{width:B,minWidth:B,maxWidth:B,"--oc-ipad-sidebar-width":`${O.width}px`,overflowX:"clip"},"aria-hidden":!P,"data-page-scroll-lock":"true",children:[n.jsx("div",{className:ae("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",O.isResizing&&"pointer-events-none",!P&&"pointer-events-none select-none"),style:{width:"var(--oc-ipad-sidebar-width)",overflowX:"hidden",paddingTop:"var(--oc-safe-area-top, 0px)",translate:ee.inPlace?void 0:Q},children:n.jsx(bt,{children:n.jsx(io,{open:ee.placed,variant:"sidebar",onOpenChange:W=>{!W&&!R&&D(!1)},footer:Ee})})}),P?n.jsx(yo,{side:"left",isResizing:O.isResizing,ariaLabel:e("sidebar.resize.leftPanelAria"),handleProps:O.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(fh,{onOpenSessions:()=>A?$():o(!0),onOpenWorkspace:g,compactTitle:A}),n.jsxs("main",{ref:ce,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(bt,{children:n.jsx(mf,{})})}),n.jsx(bt,{children:n.jsx(kf,{})})]})]}),A?null:n.jsx(io,{open:r,onOpenChange:o,footer:Ee}),n.jsxs("aside",{ref:V.asideRef,className:ae("relative flex h-full shrink-0 flex-col overflow-hidden"),style:{width:Y,minWidth:Y,maxWidth:Y,"--oc-ipad-sidebar-width":`${V.width}px`,overflowX:"clip"},"aria-hidden":!Y,"data-page-scroll-lock":"true",children:[n.jsx("div",{className:ae("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",q&&"border-s border-edge bg-background",V.isResizing&&"pointer-events-none",!Z.inPlace&&"pointer-events-none select-none"),style:{width:"var(--oc-ipad-sidebar-width)",overflowX:"hidden",paddingTop:"var(--oc-safe-area-top, 0px)",translate:Z.inPlace?void 0:oe},children:n.jsx(bt,{children:n.jsx(Bg,{open:q?Z.placed:u,onClose:L,tab:d,onTabChange:p,pendingChangesDiff:v,onOpenPlan:b,variant:q?"panel":"drawer"})})}),q&&u?n.jsx(yo,{side:"right",isResizing:V.isResizing,ariaLabel:e("sidebar.resize.rightPanelAria"),handleProps:V.handleProps}):null]}),f?n.jsx(Zt,{open:!0,variant:pe,onClose:()=>b(null),ariaLabel:f.title,title:f.title,children:n.jsx(bt,{children:n.jsx(yf,{savedProjectPlan:{projectRef:f.projectRef,planId:f.id},onNavigatedToChat:()=>{C(),L()}})})}):null,a==="instances"&&j?n.jsx(Zt,{open:!0,variant:pe,dialogAlign:"app",onClose:C,ariaLabel:e("mobile.menu.instances"),title:e("mobile.menu.instances"),children:n.jsx(bh,{onConnect:C,onActiveConnectionDeleted:s})}):null,a==="settings"?n.jsx(Zt,{open:!0,variant:pe,dialogAlign:"app",onClose:C,ariaLabel:e("mobile.menu.settings"),headerless:!0,children:n.jsx(bt,{children:n.jsx(bf,{forceMobile:!0,isWindowed:!0,initialMobileStage:x,registerBackHandler:Te,visiblePageSlugs:[...ko],onClose:C})})}):null,a==="usage"?n.jsx(Zt,{open:!0,variant:pe,dialogAlign:"app",onClose:C,ariaLabel:e("usageStats.title"),title:e("usageStats.title"),children:n.jsx(bt,{children:n.jsx(Jf,{})})}):null,a==="scheduled"?n.jsx(Zt,{open:!0,variant:pe,dialogAlign:"app",onClose:C,ariaLabel:e("sessions.scheduledTasks.dialog.title"),title:e("sessions.scheduledTasks.dialog.title"),children:n.jsx(bt,{children:n.jsx(em,{layout:"mobile",onLeave:ye})})}):null,a==="board"?n.jsx(Zt,{open:!0,variant:pe,dialogAlign:"app",onClose:C,ariaLabel:e("sourceBoard.title"),headerless:!0,children:n.jsx(bt,{children:n.jsx(Qf,{onLeave:ge,onClose:C})})}):null,a==="overview"&&ke?n.jsx(Zt,{open:!0,variant:pe,dialogAlign:"app",onClose:C,ariaLabel:e("overview.title"),title:e("overview.title"),children:n.jsx(bt,{children:n.jsx(Zf,{layout:"mobile",onLeave:we})})}):null,a==="archive"?n.jsx(Zt,{open:!0,variant:pe,dialogAlign:"app",onClose:C,ariaLabel:e("sessions.archivePage.title"),title:e("sessions.archivePage.title"),children:n.jsx(bt,{children:n.jsx(Yf,{layout:"mobile",onLeave:ve})})}):null,a==="update"?n.jsx(Zt,{open:!0,variant:pe,dialogAlign:"app",onClose:C,ariaLabel:e("mobile.menu.update"),title:e("mobile.menu.update"),children:n.jsx(bt,{children:n.jsx(Yt,{outerClassName:"h-full",className:"px-5 py-4",disableHorizontal:!0,children:n.jsx(xf,{initialUpdateDialogOpen:!0})})})}):null]})})};function bb(s){const e=re.c(141),{apis:t}=s,r=Xe(qb),{t:o}=be(),i=Kt(Hb),a=Kt(Vb),l=Kt(Kb),u=Kt(Wb),c=Kt($b),d=Kt(Fb),p=Kt(zb),g=Kt(Bb),f=Fs(Lb),b=nt(Mb),x=nt(Ob),h=Xe(Db),v=kr(Pb),w=vl(Ab),N=Xs(Tb);let _;e[0]!==N?(_=N??[],e[0]=N,e[1]=_):_=e[1];const M=_,E=N!=null;let j;e[2]!==M||e[3]!==E?(j={hasAuthoritativeGlobalSessions:E,sessions:M},e[2]=M,e[3]=E,e[4]=j):j=e[4],Uu(j);const[C,k]=m.useState(0),[L,I]=m.useState(0),[A,R]=m.useState(!1),[F,T]=m.useState("pending"),[S,P]=m.useState(null);let D;e[5]===Symbol.for("react.memo_cache_sentinel")?(D=Ss(),e[5]=D):D=e[5];const $=D,[,K]=m.useReducer(_b,0);let U;e[6]===Symbol.for("react.memo_cache_sentinel")?(U=zr(),e[6]=U):U=e[6];const O=U,V=m.useRef(0),q=m.useRef(0);let ee;e[7]!==d||e[8]!==t.sourceControl||e[9]!==t.trackers||e[10]!==i||e[11]!==g||e[12]!==p||e[13]!==c||e[14]!==v||e[15]!==w?(ee=()=>{const ie=Gt(),je=q.current+1;if(q.current=je,!ie){on("resume:auto-connect",{}),an();return}on("resume:reprobe",{});const Re=()=>{i(),w(t.sourceControl),v(t.sourceControl,{force:!0}),Si(t.trackers),c===0&&p({source:"mobileApp:nativeResume"}),d===0&&g({source:"mobileApp:nativeResume"})},Pe=Qe=>{on("resume:disconnect",{reason:Qe}),Os({apiBaseUrl:"",clientToken:null,runtimeKey:En}),k(Ib)};On().then(Qe=>{if(q.current===je){if(Qe==="no-connection"){Pe("no-connection");return}if(Qe==="needs-login"){P({kind:"auth-expired",label:Ss()??""}),Pe("needs-login");return}if(Qe==="relay-limit"){P({kind:"relay-limit",label:Ss()??""}),Pe("relay-limit");return}if(Qe==="unreachable"){const Xt=[4e3,1e4],ds=wt=>{window.setTimeout(()=>{if(q.current!==je)return;const Ue=wt===Xt.length-1;On({fast:!Ue}).then(gt=>{if(q.current===je&&gt!=="switched"){if(gt==="unchanged"){Re();return}if(gt==="needs-login"){P({kind:"auth-expired",label:Ss()??""}),Pe("retry-needs-login");return}if(gt==="relay-limit"){P({kind:"relay-limit",label:Ss()??""}),Pe("retry-relay-limit");return}if(!Ue){ds(wt+1);return}Pe(`retry-${gt}`)}})},Xt[wt])};ds(0);return}Qe!=="switched"&&Re()}});const De=Date.now();De-V.current>=hb&&(V.current=De,window.dispatchEvent(new Event("openchamber:system-resume")))},e[7]=d,e[8]=t.sourceControl,e[9]=t.trackers,e[10]=i,e[11]=g,e[12]=p,e[13]=c,e[14]=v,e[15]=w,e[16]=ee):ee=e[16];const Z=ee;Td(),Ad(Z);let Y,B;e[17]!==Z?(Y=()=>{if(!O)return;let ie;const je=()=>{window.clearTimeout(ie),ie=window.setTimeout(()=>Z(),1500)};return window.addEventListener("online",je),()=>{window.removeEventListener("online",je),window.clearTimeout(ie)}},B=[O,Z],e[17]=Z,e[18]=Y,e[19]=B):(Y=e[18],B=e[19]),m.useEffect(Y,B);let Q,oe;e[20]!==Z?(oe=()=>{if(O)return pi.subscribe((ie,je)=>{ie.state==="expired"&&je.state!=="expired"&&(Z(),pi.getState().markAuthenticated())})},Q=[O,Z],e[20]=Z,e[21]=Q,e[22]=oe):(Q=e[21],oe=e[22]),m.useEffect(oe,Q);let X,te;e[23]!==Z?(X=()=>{if(O)return wl(ie=>{Wn(ie)&&Z()})},te=[O,Z],e[23]=Z,e[24]=X,e[25]=te):(X=e[24],te=e[25]),m.useEffect(X,te);let ce,ue;e[26]!==t?(ce=()=>(Eo(t),Eb),ue=[t],e[26]=t,e[27]=ce,e[28]=ue):(ce=e[27],ue=e[28]),m.useEffect(ce,ue);let H;e[29]!==K?(H=()=>Ro(ie=>{if(on("endpoint:changed",{runtimeKey:ie.runtimeKey||"none",previousRuntimeKey:ie.previousRuntimeKey||"none",connected:!!ie.apiBaseUrl}),!!ie.runtimeKey&&ie.runtimeKey===ie.previousRuntimeKey){tf(),K();return}sf(ie),I(Rb),k(Nb)}),e[29]=K,e[30]=H):H=e[30];let ne;e[31]===Symbol.for("react.memo_cache_sentinel")?(ne=[],e[31]=ne):ne=e[31],m.useEffect(H,ne);let Te;e[32]!==l?(Te=()=>{if(!O||l||Gt()){T("done");return}let ie=!1;return T("attempting"),(async()=>{const je=await an().catch(Cb);ie||(je.status==="unreachable"||je.status==="relay-limit"?P({kind:je.status,label:je.label}):je.status==="needs-login"&&P({kind:"auth-expired",label:je.label}),T("done"),je.status==="unreachable"&&an({fast:!1,skipIfConnected:!0}).catch(Sb))})(),()=>{ie=!0}},e[32]=l,e[33]=Te):Te=e[33];let se;e[34]===Symbol.for("react.memo_cache_sentinel")?(se=[],e[34]=se):se=e[34],m.useEffect(Te,se);let xe,pe;e[35]===Symbol.for("react.memo_cache_sentinel")?(xe=()=>{if(!O||!Gt())return;let ie=!1;const je=Re=>{on("cold-launch:drop",{kind:Re?.kind??"unknown"}),Re&&P(Re),Os({apiBaseUrl:"",clientToken:null,runtimeKey:En}),k(kb)};return On().then(async Re=>{if(ie||Re==="switched"||Re==="unchanged")return;const Pe=Ss();if(Re==="needs-login"){je({kind:"auth-expired",label:Pe??""});return}if(Re==="unreachable"){je(Pe?{kind:"unreachable",label:Pe}:null),an({fast:!1,skipIfConnected:!0}).catch(jb);return}if(Re==="relay-limit"){je({kind:"relay-limit",label:Pe??""});return}const De=await an().catch(wb);ie||De.status==="connected"||(De.status==="needs-login"?je({kind:"auth-expired",label:De.label}):De.status==="unreachable"||De.status==="relay-limit"?je({kind:De.status,label:De.label}):je(null))}),()=>{ie=!0}},pe=[],e[35]=xe,e[36]=pe):(xe=e[35],pe=e[36]),m.useEffect(xe,pe);let ke,Ee;e[37]!==h?(ke=()=>{h(!0)},Ee=[h],e[37]=h,e[38]=ke,e[39]=Ee):(ke=e[38],Ee=e[39]),m.useEffect(ke,Ee);let ye;e[40]!==i?(ye=()=>{O&&!Gt()||i()},e[40]=i,e[41]=ye):ye=e[41];let ge;e[42]!==C||e[43]!==i?(ge=[C,i,O],e[42]=C,e[43]=i,e[44]=ge):ge=e[44],m.useEffect(ye,ge);let we,ve;e[45]!==d||e[46]!==l||e[47]!==g||e[48]!==p||e[49]!==c?(we=()=>{l&&(c===0&&p({source:"mobileApp:recovery"}),d===0&&g({source:"mobileApp:recovery"}))},ve=[d,l,g,p,c],e[45]=d,e[46]=l,e[47]=g,e[48]=p,e[49]=c,e[50]=we,e[51]=ve):(we=e[50],ve=e[51]),m.useEffect(we,ve);const W=m.useRef(!1),[de,Ne]=m.useState(O);let Ie;e[52]!==l?(Ie=()=>{if(!O||!l||W.current)return;let ie=!1;const je=window.setTimeout(()=>Ne(!1),6e3);return(async()=>{const Re=await nf({refresh:!0});ie||(Re!=="failed"&&(W.current=!0),Ne(!1))})(),()=>{ie=!0,window.clearTimeout(je)}},e[52]=l,e[53]=Ie):Ie=e[53];let _e;e[54]!==C||e[55]!==l?(_e=[C,l,O],e[54]=C,e[55]=l,e[56]=_e):_e=e[56],m.useEffect(Ie,_e);let Fe,Ve;e[57]!==f||e[58]!==l?(Fe=()=>{l&&gr.setDirectory(f)},Ve=[f,l],e[57]=f,e[58]=l,e[59]=Fe,e[60]=Ve):(Fe=e[59],Ve=e[60]),m.useEffect(Fe,Ve);let He,Je;e[61]!==t.sourceControl||e[62]!==t.trackers||e[63]!==l||e[64]!==v||e[65]!==w?(He=()=>{l&&(w(t.sourceControl),v(t.sourceControl,{force:!0}),Si(t.trackers))},Je=[t.sourceControl,t.trackers,l,v,w],e[61]=t.sourceControl,e[62]=t.trackers,e[63]=l,e[64]=v,e[65]=w,e[66]=He,e[67]=Je):(He=e[66],Je=e[67]),m.useEffect(He,Je);let fe,Be;e[68]!==x||e[69]!==b?(fe=()=>{if(!b)return;const ie=window.setTimeout(()=>x(),5e3);return()=>window.clearTimeout(ie)},Be=[x,b],e[68]=x,e[69]=b,e[70]=fe,e[71]=Be):(fe=e[70],Be=e[71]),m.useEffect(fe,Be);let J;e[72]!==l?(J=()=>{if(!(!l&&(O?!!Gt():!0))){R(!1);return}const je=window.setTimeout(()=>{R(!0)},O?4e3:8e3);return()=>window.clearTimeout(je)},e[72]=l,e[73]=J):J=e[73];let me;e[74]!==C||e[75]!==l||e[76]!==L?(me=[l,O,C,L],e[74]=C,e[75]=l,e[76]=L,e[77]=me):me=e[77],m.useEffect(J,me),Pd();let $e;e[78]===Symbol.for("react.memo_cache_sentinel")?($e={enabled:!0},e[78]=$e):$e=e[78],Dd($e),Gu(),Od(),Md(),Xu(),Ju(t.sourceControl),Yu(t.trackers),Qu(),Zu(f||null),ef();const lt=O&&l;let qe;e[79]!==lt?(qe={enabled:lt},e[79]=lt,e[80]=qe):qe=e[80],lb(qe);const ot=O&&l&&a;let Ze;e[81]!==ot?(Ze={ready:ot},e[81]=ot,e[82]=Ze):Ze=e[82],nb(Ze);const xt=zg(),Dt=!l&&u==="reconnecting";if(!xt){let ie;return e[83]===Symbol.for("react.memo_cache_sentinel")?(ie=n.jsx("main",{className:"flex min-h-dvh items-center justify-center bg-[var(--splash-background,var(--surface-background))] text-foreground",children:n.jsx(Ms,{width:120,height:120,isAnimated:!0,variant:"splash"})}),e[83]=ie):ie=e[83],ie}const Rt=!!Gt();if(O&&(!Rt||!l&&!Dt)){if(Rt){const Re=!A;let Pe;e[84]!==Re?(Pe=n.jsx(Ms,{width:120,height:120,isAnimated:Re,variant:"splash"}),e[84]=Re,e[85]=Pe):Pe=e[85];let De;e[86]!==A||e[87]!==o?(De=A?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("h1",{className:"typography-h3 text-foreground",children:o("sessionAuth.error.networkTitle")}),n.jsx("p",{className:"typography-markdown text-muted-foreground",children:o("mobile.connect.recovery.description")})]}),n.jsx(Ae,{type:"button",variant:"outline",onClick:()=>{Os({apiBaseUrl:"",clientToken:null,runtimeKey:En}),k(vb)},children:o("mobile.connect.cancelPassword")})]}):null,e[86]=A,e[87]=o,e[88]=De):De=e[88];let Qe;return e[89]!==Pe||e[90]!==De?(Qe=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:[Pe,De]})}),e[89]=Pe,e[90]=De,e[91]=Qe):Qe=e[91],Qe}if(F!=="done"){let Re;e[92]===Symbol.for("react.memo_cache_sentinel")?(Re=n.jsx(Ms,{width:120,height:120,isAnimated:!0,variant:"splash"}),e[92]=Re):Re=e[92];let Pe;e[93]!==o?(Pe=$?n.jsxs("div",{className:"absolute inset-x-0 top-[calc(50%+84px)] flex flex-col items-center gap-0.5 px-6 text-center",children:[n.jsx("p",{className:"typography-small text-muted-foreground",children:o("mobile.connect.splash.connectingTo")}),n.jsxs("p",{className:"typography-small text-foreground",children:[$,n.jsx(Ld,{})]})]}):null,e[93]=o,e[94]=Pe):Pe=e[94];let De;return e[95]!==Pe?(De=n.jsxs("main",{className:"relative flex min-h-dvh items-center justify-center bg-[var(--splash-background,var(--surface-background))] text-foreground",children:[Re,Pe]}),e[95]=Pe,e[96]=De):De=e[96],De}let ie;e[97]===Symbol.for("react.memo_cache_sentinel")?(ie=()=>k(yb),e[97]=ie):ie=e[97];let je;return e[98]!==S?(je=n.jsx(n.Fragment,{children:n.jsx(Jp,{onConnected:ie,notice:S})}),e[98]=S,e[99]=je):je=e[99],je}if(!l&&!Dt){if(!A){let Qe;return e[100]===Symbol.for("react.memo_cache_sentinel")?(Qe=n.jsx("main",{className:"flex min-h-dvh items-center justify-center bg-[var(--splash-background,var(--surface-background))] text-foreground",children:n.jsx(Ms,{width:120,height:120,isAnimated:!0,variant:"splash"})}),e[100]=Qe):Qe=e[100],Qe}let ie;e[101]!==o?(ie=o("sessionAuth.error.networkTitle"),e[101]=o,e[102]=ie):ie=e[102];let je;e[103]!==ie?(je=n.jsx("h1",{className:"typography-h3 text-foreground",children:ie}),e[103]=ie,e[104]=je):je=e[104];let Re;e[105]!==o?(Re=o("sessionAuth.error.networkDescription"),e[105]=o,e[106]=Re):Re=e[106];let Pe;e[107]!==Re?(Pe=n.jsx("p",{className:"typography-markdown text-muted-foreground",children:Re}),e[107]=Re,e[108]=Pe):Pe=e[108];let De;return e[109]!==je||e[110]!==Pe?(De=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:[je,Pe]})}),e[109]=je,e[110]=Pe,e[111]=De):De=e[111],De}let We;e[112]===Symbol.for("react.memo_cache_sentinel")?(We=gr.getSdkClient(),e[112]=We):We=e[112];const st=f||"",ut=!O||!de;let at;e[113]!==ut?(at=n.jsx(rf,{ready:ut,animated:!0}),e[113]=ut,e[114]=at):at=e[114];let ft;e[115]!==a?(ft=n.jsx(Bd,{backgroundWorkEnabled:a}),e[115]=a,e[116]=ft):ft=e[116];let yt,Et;e[117]===Symbol.for("react.memo_cache_sentinel")?(yt=n.jsx(of,{}),Et=n.jsx(Gm,{}),e[117]=yt,e[118]=Et):(yt=e[117],Et=e[118]);let Oe,et,tt,mt,Me;e[119]===Symbol.for("react.memo_cache_sentinel")?(Oe=n.jsx(gb,{onActiveConnectionDeleted:()=>{Pp(),Os({apiBaseUrl:"",clientToken:null,runtimeKey:En}),k(xb)}}),et=n.jsx(zd,{}),tt=n.jsx(Fd,{}),mt=n.jsx($d,{}),Me=n.jsx(Wd,{}),e[119]=Oe,e[120]=et,e[121]=tt,e[122]=mt,e[123]=Me):(Oe=e[119],et=e[120],tt=e[121],mt=e[122],Me=e[123]);let pt;e[124]!==r?(pt=r?n.jsxs(n.Fragment,{children:[n.jsx(vf,{}),n.jsx(af,{}),n.jsx(wf,{}),n.jsx(lf,{}),n.jsx(jf,{})]}):null,e[124]=r,e[125]=pt):pt=e[125];let vt;e[126]===Symbol.for("react.memo_cache_sentinel")?(vt=n.jsx(ep,{}),e[126]=vt):vt=e[126];let Ye;e[127]!==a?(Ye=a?n.jsx(cf,{}):null,e[127]=a,e[128]=Ye):Ye=e[128];let ht;e[129]!==at||e[130]!==ft||e[131]!==pt||e[132]!==Ye?(ht=n.jsx(Kd,{delayDuration:300,skipDelayDuration:150,children:n.jsxs("div",{className:"h-full bg-background text-foreground",children:[at,ft,yt,Et,Oe,et,tt,mt,Me,pt,vt,Ye]})}),e[129]=at,e[130]=ft,e[131]=pt,e[132]=Ye,e[133]=ht):ht=e[133];let Ge;e[134]!==t||e[135]!==ht?(Ge=n.jsx(Vd,{apis:t,children:ht}),e[134]=t,e[135]=ht,e[136]=Ge):Ge=e[136];let Qt;return e[137]!==L||e[138]!==st||e[139]!==Ge?(Qt=n.jsx(bt,{children:n.jsx(Hd,{sdk:We,directory:st,children:Ge},L)}),e[137]=L,e[138]=st,e[139]=Ge,e[140]=Qt):Qt=e[140],Qt}function xb(s){return s+1}function yb(s){return s+1}function vb(s){return s+1}function wb(){return{status:"no-candidate"}}function jb(){return null}function kb(s){return s+1}function Sb(){return null}function Cb(){return{status:"no-candidate"}}function Nb(s){return s+1}function Rb(s){return s+1}function Eb(){return Eo(null)}function Ib(s){return s+1}function _b(s){return s+1}function Tb(s){return s.authoritativeSessions}function Ab(s){return s.refresh}function Pb(s){return s.refreshAll}function Db(s){return s.setIsMobile}function Ob(s){return s.clearError}function Mb(s){return s.error}function Lb(s){return s.currentDirectory}function Bb(s){return s.loadAgents}function zb(s){return s.loadProviders}function Fb(s){return s.agents.length}function $b(s){return s.providers.length}function Wb(s){return s.connectionPhase}function Kb(s){return s.isConnected}function Vb(s){return s.isInitialized}function Hb(s){return s.initializeApp}function qb(s){return s.isolatedSpacesEnabled}function Ub(s){const e=re.c(7),t=m.useSyncExternalStore(Gb,Gt,Gt);let r;e[0]!==t?(r=!zr()||!!t,e[0]=t,e[1]=r):r=e[1];let o;e[2]!==s?(o=n.jsx(bb,{...s}),e[2]=s,e[3]=o):o=e[3];let i;return e[4]!==r||e[5]!==o?(i=n.jsx(df,{enabled:r,children:o}),e[4]=r,e[5]=o,e[6]=i):i=e[6],i}function Gb(s){return Ro(()=>s())}function E0(s){window.__OPENCHAMBER_SURFACE__="mobile",eu(),gf({logLabel:"[mobile-main]",onAppearanceSettled:Fm}),Um(),tu();const e=document.getElementById("root");if(!e)throw new Error("Root element not found");const r=window.Capacitor?.isNativePlatform?.()===!0||window.location.protocol==="capacitor:",o=r?{...s,notifications:{notifyAgentCompletion:async()=>!1,canNotify:()=>!1}}:s,i=n.jsx(hf,{children:n.jsx(Ub,{apis:o})});Za.createRoot(e).render(n.jsx(hr.StrictMode,{children:n.jsx(su,{children:n.jsx(nu,{children:n.jsx(ru,{children:n.jsx(pf,{children:r?i:n.jsx(iu,{children:i})})})})})}))}export{E0 as renderMobileApp};