@inkeep/open-knowledge 0.66.1 → 0.66.2

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 (132) hide show
  1. package/dist/{acp-harness-probe-Bk3Dz297.mjs → acp-harness-probe-C-bmwKC0.mjs} +2 -2
  2. package/dist/cli.mjs +6 -6
  3. package/dist/constants-m3Xu5_Pm.mjs +2 -0
  4. package/dist/{git-handle-C9RPCwJN.mjs → git-handle-CehgIzoK.mjs} +2 -2
  5. package/dist/git-handle-DEJ8aYeH.mjs +1 -0
  6. package/dist/index.mjs +2 -2
  7. package/dist/init-CkmKaAE9.mjs +1 -0
  8. package/dist/{init-DNQN84w4.mjs → init-DwE-82L_.mjs} +3 -3
  9. package/dist/{launch-json-removal-CsfA7Q9t.mjs → launch-json-removal-C5njpRMR.mjs} +2 -2
  10. package/dist/{loader-DOE8T0bD.mjs → loader-Da9QChC_.mjs} +2 -2
  11. package/dist/loader-Dt_OoEGe.mjs +1 -0
  12. package/dist/md-manager-BZCd3Vha.mjs +2 -0
  13. package/dist/{open-browser-Bzfc84xQ.mjs → open-browser-DIMVmm0o.mjs} +2 -2
  14. package/dist/parse-worker.mjs +1 -1
  15. package/dist/{preview-Doha4cmP.mjs → preview-BBdR6vmw.mjs} +2 -2
  16. package/dist/preview-oAaqMEbf.mjs +1 -0
  17. package/dist/public/assets/{ActivityModeContent-xON2KhOz.js → ActivityModeContent-B37XJHxx.js} +1 -1
  18. package/dist/public/assets/{AddPropertiesButton-CC1Bimpt.js → AddPropertiesButton-eMa8eBGf.js} +1 -1
  19. package/dist/public/assets/{AgentDiffPane-BPGzdN_g.js → AgentDiffPane-DHlBPg3c.js} +1 -1
  20. package/dist/public/assets/{AgentThreadClientBinder-Sg80UfOQ.js → AgentThreadClientBinder-lpLw9XDN.js} +1 -1
  21. package/dist/public/assets/{BugReportHistory-BOcChnxP.js → BugReportHistory-CuN8iDlA.js} +1 -1
  22. package/dist/public/assets/{BugReportHistoryDialog-BgcEcCCO.js → BugReportHistoryDialog-DGj_pTZf.js} +1 -1
  23. package/dist/public/assets/{CodeMirrorPropInput-Dp0ghtC3.js → CodeMirrorPropInput-Be4UuxHJ.js} +1 -1
  24. package/dist/public/assets/{ConsentDialogBody-DQlUb8Vu.js → ConsentDialogBody-XPmv8PGk.js} +1 -1
  25. package/dist/public/assets/{DocumentContext-Ak51fAXi.js → DocumentContext-CZ1LyjXH.js} +1 -1
  26. package/dist/public/assets/{EditorModeToggle-DpkS50Z0.js → EditorModeToggle-jAYPDv4d.js} +1 -1
  27. package/dist/public/assets/{EnableSyncConfirmDialog-DyPeGiVT.js → EnableSyncConfirmDialog-DGwynRzU.js} +1 -1
  28. package/dist/public/assets/{ExcalidrawDocEditor-BKndnS9g.js → ExcalidrawDocEditor-BWNQPfhq.js} +1 -1
  29. package/dist/public/assets/FeedbackForm-BAO3lafp.js +1 -0
  30. package/dist/public/assets/{GraphPanel-BdWJsnt-.js → GraphPanel-DDKxNmOr.js} +1 -1
  31. package/dist/public/assets/{ImportSkillDialog-C5f6Lj0b.js → ImportSkillDialog-D_3ApyBv.js} +1 -1
  32. package/dist/public/assets/{LintConfigEditor-C21DnP0H.js → LintConfigEditor-B3Gj07cI.js} +1 -1
  33. package/dist/public/assets/ManagedArtifactProperties-CV1Prpoj.js +1 -0
  34. package/dist/public/assets/{ManagedArtifactProperties-Dd9YEu9g.js → ManagedArtifactProperties-DeYta-00.js} +1 -1
  35. package/dist/public/assets/{MermaidDocEditor-CftOutDD.js → MermaidDocEditor-CiHzMRN9.js} +1 -1
  36. package/dist/public/assets/{PropertyDisplayRow-B3tLCY9W.js → PropertyDisplayRow-sm9qwuBw.js} +1 -1
  37. package/dist/public/assets/{ReportBugDialogBody-DRDozPGc.js → ReportBugDialogBody-DZA9GXnC.js} +1 -1
  38. package/dist/public/assets/{ReportBugMenuTrigger-Sbn4B06b.js → ReportBugMenuTrigger-D4qlc7zz.js} +2 -2
  39. package/dist/public/assets/{SchemaConfigEditor-DXhpWbEp.js → SchemaConfigEditor-D17w4XxC.js} +1 -1
  40. package/dist/public/assets/{SessionsHost-CGbrz5ge.js → SessionsHost-Cl-gIFYH.js} +2 -2
  41. package/dist/public/assets/{SettingsDialogBody-GRqpQyOX.js → SettingsDialogBody-Cqc-yl4k.js} +1 -1
  42. package/dist/public/assets/{ShareBranchSwitchDialog-DgKD1FWp.js → ShareBranchSwitchDialog-Ct4sBRfQ.js} +1 -1
  43. package/dist/public/assets/{ShareReceiveDialog-BsGWPO5t.js → ShareReceiveDialog-B92aqQEx.js} +1 -1
  44. package/dist/public/assets/{ShareReceiveMissDialog-DX4YDzpC.js → ShareReceiveMissDialog-C9VJyG_D.js} +1 -1
  45. package/dist/public/assets/{SkillCostValue-B4D7Ysdc.js → SkillCostValue-DLUxO68c.js} +1 -1
  46. package/dist/public/assets/{SkillEditBanner-BruoXTh-.js → SkillEditBanner-b0gL75iO.js} +1 -1
  47. package/dist/public/assets/{SkillInstallMenu-QBcuRLjh.js → SkillInstallMenu-BwbbztKY.js} +1 -1
  48. package/dist/public/assets/{SkillOriginInline-Dshp1Rdi.js → SkillOriginInline-DpPKdpar.js} +1 -1
  49. package/dist/public/assets/{SkillToolbarControls-BCXxl3_M.js → SkillToolbarControls-Bap6lIv8.js} +1 -1
  50. package/dist/public/assets/{SlidesToolbarControls-CJxgVynH.js → SlidesToolbarControls-BNqlGZ8e.js} +1 -1
  51. package/dist/public/assets/{SourceEditor-D9_q6g5_.js → SourceEditor-RCKX4Ohe.js} +1 -1
  52. package/dist/public/assets/{TerminalPanel-Lt1-XHX1.js → TerminalPanel-Zo-UDi-u.js} +1 -1
  53. package/dist/public/assets/{TerminalWindowApp-VUZguLdJ.js → TerminalWindowApp-DjRpidld.js} +1 -1
  54. package/dist/public/assets/{TextDocEditor-Cb7BPpJA.js → TextDocEditor--IKVxg88.js} +1 -1
  55. package/dist/public/assets/{ThreadView-Bf53-ggV.js → ThreadView-CUArcRSL.js} +1 -1
  56. package/dist/public/assets/{TimelineDiffPane-B1HLCcW9.js → TimelineDiffPane-D8HcBg2n.js} +1 -1
  57. package/dist/public/assets/{agent-diff-store-XWhp_hqN.js → agent-diff-store-DgFkR0kV.js} +1 -1
  58. package/dist/public/assets/{auth-state-cache-D22yWCCz.js → auth-state-cache-DNrEadrI.js} +1 -1
  59. package/dist/public/assets/{bug-report-send-manager-BBNXam8A.js → bug-report-send-manager-5nrn8Psu.js} +1 -1
  60. package/dist/public/assets/{client-version-B_H8duw7.js → client-version-DewpIoVp.js} +1 -1
  61. package/dist/public/assets/{comment-chips-D0prCEAx.js → comment-chips-mYvhrkxj.js} +1 -1
  62. package/dist/public/assets/{config-provider-D-Y4Wg0x.js → config-provider-DWieljqa.js} +1 -1
  63. package/dist/public/assets/{dist-D1GzYuCD.js → dist-As2x8uCt.js} +1 -1
  64. package/dist/public/assets/{doc-paths-ByyIE836.js → doc-paths-BkNaaTOB.js} +1 -1
  65. package/dist/public/assets/{documents-events-DPqTvBXn.js → documents-events-2g_OBjKU.js} +1 -1
  66. package/dist/public/assets/{file-tree-adapter-Ccbih42A.js → file-tree-adapter-Q4uvZiQM.js} +1 -1
  67. package/dist/public/assets/{file-tree-utils-Jz2v-e9t.js → file-tree-utils-Cy2QEG_5.js} +1 -1
  68. package/dist/public/assets/{folder-config-api-BddKQIga.js → folder-config-api-DhiWnWlS.js} +1 -1
  69. package/dist/public/assets/i18n-CpxzRV_v.js +1 -0
  70. package/dist/public/assets/{index-nJnxhQRq.js → index-DrzqbmWI.js} +7 -7
  71. package/dist/public/assets/{launcher-selection-CUAKUPGW.js → launcher-selection-DTBWt8s2.js} +1 -1
  72. package/dist/public/assets/{lint-config-client-DeGP10La.js → lint-config-client-CQNYXMfG.js} +1 -1
  73. package/dist/public/assets/{markdownlint-rule-browser-Bir8KkrK.js → markdownlint-rule-browser-BTovNATK.js} +1 -1
  74. package/dist/public/assets/{page-list-cache-D2OX_WDU.js → page-list-cache-AR7XhC2q.js} +1 -1
  75. package/dist/public/assets/{pending-receive-nav-store-sErL2uzl.js → pending-receive-nav-store-DXWRYoc_.js} +1 -1
  76. package/dist/public/assets/{progress-DfDRMpm4.js → progress-YLRB2n7w.js} +1 -1
  77. package/dist/public/assets/{project-paths-DX_YsFET.js → project-paths-BmMTa57i.js} +1 -1
  78. package/dist/public/assets/{prop-types-NHOECtyl.js → prop-types-CTZ-Zcfm.js} +1 -1
  79. package/dist/public/assets/{receive-store-6Dih24L8.js → receive-store-RexqPtVU.js} +1 -1
  80. package/dist/public/assets/{selection-context-C95IJZrT.js → selection-context-BcWEVrAI.js} +1 -1
  81. package/dist/public/assets/{skill-scope-4RF9DbEf.js → skill-scope-CauFSzAn.js} +1 -1
  82. package/dist/public/assets/{skills-api-D5W0J2dk.js → skills-api-KE9J-94z.js} +1 -1
  83. package/dist/public/assets/{src-qGi8ucyG.js → src-B5LNuYlK.js} +1 -1
  84. package/dist/public/assets/{startup-marks-Bvho0uc6.js → startup-marks-CUyZjhyC.js} +1 -1
  85. package/dist/public/assets/{tag-pill-input-CtA1wFQO.js → tag-pill-input-CcAyDLGe.js} +1 -1
  86. package/dist/public/assets/{target-navigation-intent-BFUFQkcA.js → target-navigation-intent-D6pgYTG-.js} +1 -1
  87. package/dist/public/assets/{telemetry-startup-C_zn8gFF.js → telemetry-startup-BFCbpnFp.js} +1 -1
  88. package/dist/public/assets/{terminal-cli-display-ZGFW9kw3.js → terminal-cli-display-C2L3vHWw.js} +1 -1
  89. package/dist/public/assets/{typing-burst-detector-B0lg7vla.js → typing-burst-detector-BO09cycJ.js} +1 -1
  90. package/dist/public/assets/{uninstall-BkDWS7iv.js → uninstall-DJhzaTa1.js} +1 -1
  91. package/dist/public/assets/{use-activity-panel-CuqTH-mx.js → use-activity-panel-BCJavN8T.js} +1 -1
  92. package/dist/public/assets/{use-apply-config-color-theme-Ba8Smkdy.js → use-apply-config-color-theme-CwClEWrd.js} +1 -1
  93. package/dist/public/assets/{use-collab-url-DFpuF-wX.js → use-collab-url-DHOOSaDb.js} +1 -1
  94. package/dist/public/assets/{use-live-xterm-theme-c1fyCaal.js → use-live-xterm-theme-_zomIp7z.js} +1 -1
  95. package/dist/public/assets/{use-open-skill-DJmjKHgr.js → use-open-skill-DzG96lKz.js} +1 -1
  96. package/dist/public/assets/{use-settings-route-BQW0aTo0.js → use-settings-route-Dq3eM_ye.js} +1 -1
  97. package/dist/public/assets/{use-skill-origin-WyyVjfzt.js → use-skill-origin-uUY8unvE.js} +1 -1
  98. package/dist/public/assets/{use-skills-BOMFaoLg.js → use-skills-RpG-BeVz.js} +1 -1
  99. package/dist/public/assets/{use-terminal-enabled-T9hbZCmo.js → use-terminal-enabled-DIQ4qqYj.js} +1 -1
  100. package/dist/public/assets/{use-timeline-entry-diff-Blkn7mx5.js → use-timeline-entry-diff-_fLA4Pt0.js} +1 -1
  101. package/dist/public/assets/{use-workspace-BeSzHXgL.js → use-workspace-DRylP9vX.js} +1 -1
  102. package/dist/public/index.html +47 -47
  103. package/dist/public/uninstall.html +3 -3
  104. package/dist/{repair-launch-json-AsKV5LiF.mjs → repair-launch-json-DO_3ABvq.mjs} +2 -2
  105. package/dist/{repair-mcp-configs-BYASBYNt.mjs → repair-mcp-configs-Bmw9_91L.mjs} +2 -2
  106. package/dist/{repair-skills-AGXJVKE-.mjs → repair-skills-BftHPTbX.mjs} +2 -2
  107. package/dist/repair-skills-CPy4iDny.mjs +1 -0
  108. package/dist/{resolve-project-root-XrNPFGNY.mjs → resolve-project-root-BCdGoKNz.mjs} +2 -2
  109. package/dist/{server-lock-DaOXwt6C.mjs → server-lock-CBDjdfxH.mjs} +2 -2
  110. package/dist/server-lock-xg5Njzvf.mjs +1 -0
  111. package/dist/{skill-teardown-BEnDXQv2.mjs → skill-teardown-Bxy5NV-V.mjs} +2 -2
  112. package/dist/src-B13TeG7U.mjs +1 -0
  113. package/dist/{src-BUfAkcnU.mjs → src-CP2xsmg5.mjs} +2 -2
  114. package/dist/{src-Gpb82U0M.mjs → src-D4A03H49.mjs} +2 -2
  115. package/dist/{src-D79M3x9g.mjs → src-DXJo3hyx.mjs} +1 -1
  116. package/dist/{src-Dyk9iCzv.mjs → src-HFlqeGnA.mjs} +4 -4
  117. package/dist/{start-hZ8_kSuC.mjs → start-7t3OZSc5.mjs} +3 -3
  118. package/dist/start-C1hXUjiR.mjs +1 -0
  119. package/package.json +4 -4
  120. package/dist/constants-DXEhJ197.mjs +0 -2
  121. package/dist/git-handle-pDdbSsMj.mjs +0 -1
  122. package/dist/init-D9KKXAfB.mjs +0 -1
  123. package/dist/loader-hcc6a20d.mjs +0 -1
  124. package/dist/md-manager-BUn7RZOJ.mjs +0 -2
  125. package/dist/preview-CHdEIdwL.mjs +0 -1
  126. package/dist/public/assets/FeedbackForm-BNeQXmJD.js +0 -1
  127. package/dist/public/assets/ManagedArtifactProperties-AGHZbLhh.js +0 -1
  128. package/dist/public/assets/i18n-BFtoQNCd.js +0 -1
  129. package/dist/repair-skills-DUxV_xLI.mjs +0 -1
  130. package/dist/server-lock-VtTnds5h.mjs +0 -1
  131. package/dist/src-s7hpfSip.mjs +0 -1
  132. package/dist/start-ky9sRyOI.mjs +0 -1
@@ -1,11 +1,11 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-BQYAUKok.js","./chunk-CYidjpOJ.js","./preload-helper-Chd9yIcd.js","./trace-api-BP9dN1Hz.js","./propagation-api-DC5404fy.js","./context-api-dUnlgSJr.js","./BugReportHistoryDialog-BgcEcCCO.js","./dist-Nvb76hAm.js","./jsx-runtime-BUgB2tll.js","./react-f2sANaYj.js","./dialog-CTNat3T_.js","./dist-BcvirUWL.js","./dist-BHv-mziD.js","./react-dom-DPxgxlDT.js","./dist-DRO03ovd.js","./es2015-B9_uRFGw.js","./button-Cym3gapE.js","./bundle-mjs-SHeFpKGC.js","./compiler-runtime-BfE3aGVn.js","./utils-CPqDy6Hr.js","./x-DbShSCr5.js","./createLucideIcon-BulbvLvN.js","./BugReportHistory-BOcChnxP.js","./collapsible-DYySK8La.js","./chevron-down-DNO3PgI_.js","./folder-open-BWpLO6wT.js","./spinner-t7GahFcQ.js","./bug-report-send-manager-BBNXam8A.js","./dist-D1GzYuCD.js","./lib-vOz_s3tj.js","./html-void-elements-zEl0KGqf.js","./lib-DmueaA5E.js","./markdownit-CugClK-K.js","./w3c-keyname-C7Rznu6R.js","./trash-2-DSqYvaPJ.js","./badge-BWfmbBoh.js","./platform-labels-DWuGftrI.js","./dist-Cr4-nBVI.js","./GraphPanel-BdWJsnt-.js","./toggle-group-C2_37kV5.js","./dist-Bn0BEeMP.js","./dist-Dhtu02232.js","./tooltip-DttaCTqz.js","./dist-CMrReMig.js","./floating-ui.dom-BcZPrP06.js","./dist-BDna-dOq.js","./useQuery-ZeEDLtxh.js","./min-B6fjqEav.js","./src-we-4-j9S.js","./colors-6O6-4xPx.js","./ordinal-DJL8o-kw.js","./init-X_ANAGxw.js","./isObject-2-KdVTyV.js","./now-eUYS5OsE.js","./arrow-up-right-BTi7mHwL.js","./prop-types-NHOECtyl.js","./page-list-cache-D2OX_WDU.js","./file-tree-utils-Jz2v-e9t.js","./doc-paths-ByyIE836.js","./startup-marks-Bvho0uc6.js","./documents-events-DPqTvBXn.js","./documents-fetch-UmC9duIp.js","./parse-api-error-Dd8VI2eu.js","./target-navigation-intent-BFUFQkcA.js","./maximize-2-D91zEy2V.js","./triangle-alert-GeclLtDN.js","./dist-PQ5KMVDh.js","./panel-DNPki55m.js","./external-link-B0bVg1hn.js","./overlay-layers-Bj-TVfKw.js","./ActivityModeContent-xON2KhOz.js","./DocumentContext-Ak51fAXi.js","./cm-theme-MqTIJzgL.js","./dist-nQee1FU7.js","./dist-CIM44Ta6.js","./dist-ClB1bacr.js","./dist-Cn5Ah8iR.js","./dist-CnaP_OyG.js","./dist-CWdEDKHh.js","./dist-DMctVxBR.js","./dist-DGNSX3J0.js","./dist-C6BEjIPY.js","./stex-C-5D68LN.js","./config-provider-D-Y4Wg0x.js","./dist-CJhtNlOm2.js","./client-version-B_H8duw7.js","./use-apply-config-color-theme-Ba8Smkdy.js","./use-apply-config-theme-CBmHKD_B.js","./i18n-BFtoQNCd.js","./messages-B2mYVhA4.js","./select-XEGYznMI.js","./dist-Bd_yyADX.js","./check-Dut4Aov8.js","./switch-iwBsEWej.js","./CodeMirrorPropInput-Dp0ghtC3.js","./asset-dispatch-KsnhYIM1.js","./note-window-mode-CsmLTxU_.js","./git-branch-3CSRgL0o.js","./Mermaid-B4Oa2diB.js","./chevron-right-4mYNnAZZ.js","./circle-alert-b-E0_BIP.js","./eye-7pio2q9G.js","./hash-3VQG5UJ7.js","./info-SlzbpjOb.js","./minus-CmrkEJ8b.js","./paperclip-CrupYCX8.js","./local-menu-action-bus-BLEUyEvu.js","./file-tree-rename-validation-B5TvPsC_.js","./input-DJ1c1x-M.js","./popover-BE6X9rKr.js","./dist-GoOli512.js","./use-collab-url-DFpuF-wX.js","./skills-api-D5W0J2dk.js","./skill-scope-4RF9DbEf.js","./use-workspace-BeSzHXgL.js","./DocumentContext-B0sQn39F.css","./undo-2-XcI_wHcs.js","./agent-diff-store-XWhp_hqN.js","./cursor-2VSK5BUh.js","./copilot-DMpTxujg.js","./timeline-diff-store-ym5Oz1UF.js","./use-activity-panel-CuqTH-mx.js","./agent-presence-3JajMNAq.js","./lru-string-cache-Cc7rikda.js","./SettingsDialogBody-GRqpQyOX.js","./sortable.esm-DK-jMveF.js","./alert-dialog-D9BtoYXB.js","./checkbox-LVDa5cS9.js","./terminal-cli-display-ZGFW9kw3.js","./dropdown-menu-CRvS0_4-.js","./dist-wcXwpuqG.js","./label-D-K3fWtj.js","./radio-group-npdxiS6E.js","./separator-C6x7j8mC.js","./EnableSyncConfirmDialog-DyPeGiVT.js","./RegisteredAgentIcon-CDl1h-4U.js","./lint-plugin-meta-LEBWvINg.js","./auth-state-cache-D22yWCCz.js","./terminal-D4HSnHXf.js","./SkillInstallMenu-QBcuRLjh.js","./use-open-skill-DJmjKHgr.js","./use-skills-BOMFaoLg.js","./clipboard-adapter-815RzzoI.js","./folder-config-api-BddKQIga.js","./refresh-cw-BFSYd-XR.js","./terminal-command-events-D0gJ8NJs.js","./field-Di3yPBdO.js","./textarea-BoMa_3jF.js","./use-settings-route-BQW0aTo0.js","./ThemePicker-DH1tY5im.js","./square-pen-CBGVrQUa.js","./form-Bz-LEGU-.js","./ConfigSharingInfoTooltip-BzRIZ5Ed.js","./markdownlint-rule-browser-Bir8KkrK.js","./skeleton-BZIHOzZH.js","./tag-pill-input-CtA1wFQO.js","./lint-config-client-DeGP10La.js","./input-group-eVl8FXAc.js","./use-terminal-enabled-T9hbZCmo.js","./terminal-telemetry-DI0bolzP.js","./schema-fields-view-intent-DCUTojNw.js","./tool-list-format-DRi3JW8x.js","./ManagedArtifactProperties-AGHZbLhh.js","./ManagedArtifactProperties-Dd9YEu9g.js","./PropertyDisplayRow-B3tLCY9W.js","./format-CyaLi0or.js","./braces-Bzye844v.js","./comment-chips-D0prCEAx.js","./SkillCostValue-B4D7Ysdc.js","./selection-context-C95IJZrT.js","./MermaidDocEditor-CftOutDD.js","./dist-Drn6e5ml2.js","./dist-D9xNKL3I2.js","./src-qGi8ucyG.js","./ExcalidrawDocEditor-BKndnS9g.js","./chunk-K2UTITRG-BJBPIYUX.js","./chunk-SRAX5OIU-BEvWJO3c.js","./chunk-ZUYEQ4TG-CQSwzpWR.js","./chunk-6U3AYISY-C-nplzwN.js","./chunk-Z3N5DIM6-2xVL_dId.js","./dist-BY_vnlVW2.js","./ExcalidrawDocEditor-D_O2bRP1.css","./TextDocEditor-Cb7BPpJA.js","./text-viewer-languages-Cc4U6Lc5.js","./SourceEditor-D9_q6g5_.js","./typing-burst-detector-B0lg7vla.js","./wrench-DcVBYiNl.js","./SkillToolbarControls-BCXxl3_M.js","./AddPropertiesButton-CC1Bimpt.js","./DiffView-DS16M3wC.js","./list-plus-nPRgk4Qi.js","./workspace-paths-CAsMig07.js","./SkillOriginInline-Dshp1Rdi.js","./use-skill-origin-WyyVjfzt.js","./SlidesToolbarControls-CJxgVynH.js","./SkillEditBanner-BruoXTh-.js","./SkillModeBanner-Cfij5biF.js","./LintConfigEditor-C21DnP0H.js","./EditorModeToggle-DpkS50Z0.js","./useLintConfigViewMode-BvPSErDD.js","./SchemaConfigEditor-DXhpWbEp.js","./case-sensitive-BwklrMJw.js","./TimelineDiffPane-B1HLCcW9.js","./use-timeline-entry-diff-Blkn7mx5.js","./libesm-mBLacfDP.js","./panel-right-open-2VYfauQI.js","./AgentDiffPane-BPGzdN_g.js","./AppMenubar-DS-GyfEA.js","./app-menubar-gate-q1nJIutw.js","./AgentThreadClientBinder-Sg80UfOQ.js","./thread-client-C32zww5K.js","./SessionsHost-CGbrz5ge.js","./launcher-selection-CUAKUPGW.js","./terminal-launch-events-rC-SK1H0.js","./TerminalStartingNotice-DFapfn5h.js","./tabs-DmGV_6HP.js","./launch-agent-thread-Cb_G0uH0.js","./ImportSkillDialog-C5f6Lj0b.js","./package-Bo0V5xFD.js","./McpConsentDialogBody-CTSqWNk2.js","./RowDisclosure-DDH_M2cK.js","./ok-CtJ8JyHz.js","./ShareBranchSwitchDialog-DgKD1FWp.js","./miss-dialog-store-DVpIaq34.js","./share-metadata-rows-DPgPU-ev.js","./auth-prompt-store-3WR-Jv7J.js","./desktop-bridge-types-oYPdTDmz.js","./receive-store-6Dih24L8.js","./ShareReceiveMissDialog-DX4YDzpC.js","./pending-receive-nav-store-sErL2uzl.js","./ConsentDialogBody-DQlUb8Vu.js","./project-paths-DX_YsFET.js","./ShareReceiveDialog-BsGWPO5t.js","./TerminalWindowApp-VUZguLdJ.js","./ReportBugMenuTrigger-Sbn4B06b.js","./use-live-xterm-theme-c1fyCaal.js","./telemetry-startup-C_zn8gFF.js"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./globals-Bezfr5us.js";import{t as n}from"./preload-helper-Chd9yIcd.js";import{t as r}from"./jsx-runtime-BUgB2tll.js";import{$ as i,$n as a,$r as o,$t as s,A as c,Ar as l,At as u,B as d,Bn as f,Br as p,Bt as m,C as h,Cn as g,Cr as _,Ct as v,D as y,Dt as b,E as x,Er as S,Et as C,F as w,Fr as T,Ft as E,G as D,Gn as O,Gr as k,Gt as A,H as j,Hn as M,Hr as N,I as P,In as F,Ir as I,J as L,Jn as R,Jr as z,Jt as B,K as V,Kn as ee,Kr as H,Kt as U,Ln as W,Lr as G,Lt as te,M as ne,Mn as re,N as K,Nn as ie,Nr as q,Nt as ae,On as oe,Or as se,Ot as ce,Pn as le,Pr as ue,Q as de,Qn as fe,Qr as pe,Qt as J,Rn as me,Rr as he,Rt as ge,S as _e,Sn as ve,St as ye,Tn as be,Tr as xe,Tt as Se,Un as Ce,Ur as we,Ut as Te,V as Ee,Vn as De,Vr as Oe,Vt as ke,W as Ae,Wn as je,Wr as Me,Wt as Ne,Xr as Pe,Xt as Fe,Y as Ie,Yn as Le,Yr as Re,Yt as ze,Z as Be,Zn as Ve,Zr as He,Zt as Ue,_ as We,_r as Ge,_t as Ke,a as qe,ai as Je,an as Ye,ar as Xe,at as Ze,b as Qe,bn as $e,br as et,c as tt,ci as nt,cn as rt,cr as it,ct as at,d as ot,di as st,dn as ct,dr as lt,dt as ut,ei as dt,en as ft,er as pt,et as mt,f as ht,fi as gt,fn as _t,fr as vt,ft as yt,g as bt,gr as xt,gt as St,h as Ct,hr as wt,ht as Tt,i as Et,ii as Dt,in as Ot,ir as kt,it as At,j as jt,jn as Mt,jr as Nt,k as Pt,kn as Ft,kr as It,kt as Lt,l as Rt,li as zt,ln as Bt,lr as Vt,m as Ht,mn as Ut,mr as Wt,mt as Gt,n as Kt,ni as qt,nt as Jt,o as Yt,oi as Xt,or as Zt,ot as Qt,p as $t,pi as en,pn as tn,pr as nn,pt as rn,q as an,qn as on,qr as sn,qt as cn,r as ln,ri as un,rn as dn,rt as fn,s as pn,sn as mn,sr as hn,t as gn,ti as _n,tt as vn,u as yn,ui as bn,un as xn,ur as Sn,v as Cn,vt as wn,w as Tn,wn as En,wr as Dn,wt as On,x as kn,xn as An,xr as jn,xt as Mn,y as Nn,yn as Pn,yr as Fn,z as In,zn as Ln,zt as Rn}from"./DocumentContext-Ak51fAXi.js";import{t as zn}from"./react-f2sANaYj.js";import{n as Y,r as Bn,t as Vn}from"./dist-Nvb76hAm.js";import{_ as Hn,a as Un,c as Wn,d as Gn,f as Kn,g as qn,h as Jn,i as Yn,l as Xn,m as Zn,n as Qn,o as $n,p as er,r as tr,s as nr,t as rr,u as ir,v as ar,y as or}from"./useQuery-ZeEDLtxh.js";import{n as sr,t as cr}from"./dist-PQ5KMVDh.js";import{t as lr}from"./react-dom-DPxgxlDT.js";import{t as ur}from"./compiler-runtime-BfE3aGVn.js";import{i as dr,n as fr,o as pr,r as mr,t as hr}from"./local-menu-action-bus-BLEUyEvu.js";import{t as gr}from"./utils-CPqDy6Hr.js";import{n as _r}from"./clipboard-adapter-815RzzoI.js";import{C as vr,S as yr,_ as br,a as xr,b as Sr,i as Cr,m as wr,n as Tr,r as Er,t as Dr,v as Or,w as kr,x as Ar,y as jr}from"./SkillInstallMenu-QBcuRLjh.js";import{t as Mr}from"./overlay-layers-Bj-TVfKw.js";import{i as Nr,n as Pr,r as Fr,t as Ir}from"./ReportBugMenuTrigger-Sbn4B06b.js";import{n as Lr,r as Rr,t as X}from"./button-Cym3gapE.js";import{t as zr}from"./dist-BHv-mziD.js";import{i as Br,n as Vr,r as Hr,t as Ur}from"./tooltip-DttaCTqz.js";import{n as Wr,r as Gr,t as Kr}from"./collapsible-DYySK8La.js";import{a as qr,c as Jr,i as Yr,n as Xr,o as Zr,r as Qr,s as $r,t as ei,u as ti}from"./dialog-CTNat3T_.js";import{a as ni,c as ri,i as ii,l as ai,o as oi,r as si,s as ci,t as li}from"./alert-dialog-D9BtoYXB.js";import{B as ui,Ct as di,Et as fi,F as pi,G as mi,H as hi,M as gi,O as _i,Q as vi,R as yi,T as bi,Tt as xi,U as Si,V as Ci,Y as wi,Z as Ti,_ as Ei,b as Di,ct as Oi,et as ki,gt as Ai,j as ji,mt as Mi,st as Ni,tt as Pi,ut as Fi,v as Ii,xt as Li,y as Ri}from"./CodeMirrorPropInput-Dp0ghtC3.js";import{t as zi}from"./checkbox-LVDa5cS9.js";import{a as Bi,d as Vi,i as Hi,l as Ui,n as Wi,o as Gi,r as Ki,s as qi,t as Ji,u as Yi}from"./floating-ui.dom-BcZPrP06.js";import{a as Xi,c as Zi,d as Qi,f as $i,i as ea,m as ta,n as na,o as ra,p as ia,r as aa,s as oa,u as sa}from"./terminal-cli-display-ZGFW9kw3.js";import{a as ca,d as la,f as ua,i as da,m as fa,n as pa,o as ma,p as ha,r as ga,s as _a,t as va,u as ya}from"./dropdown-menu-CRvS0_4-.js";import{t as ba}from"./label-D-K3fWtj.js";import{c as xa,l as Sa}from"./select-XEGYznMI.js";import{_ as Ca,d as wa,f as Ta,g as Ea,h as Da,m as Oa,o as ka,p as Aa,t as ja,v as Ma,y as Na}from"./progress-DfDRMpm4.js";import{n as Pa,t as Fa}from"./radio-group-npdxiS6E.js";import{n as Ia,t as La}from"./separator-C6x7j8mC.js";import{n as Ra,r as za,t as Ba}from"./toggle-group-C2_37kV5.js";import{_ as Va,a as Ha,b as Ua,d as Wa,h as Ga,i as Ka,p as qa,r as Ja,t as Ya,v as Xa,y as Za}from"./RegisteredAgentIcon-CDl1h-4U.js";import{i as Qa,n as $a,r as eo,s as to}from"./terminal-telemetry-DI0bolzP.js";import{$i as no,$n as ro,$s as io,$t as ao,Aa as oo,Ai as so,Ao as co,At as lo,B as uo,Ba as fo,Bi as po,Bo as mo,Br as ho,C as go,Cr as _o,Do as vo,Ds as yo,E as bo,Ei as xo,Eo as So,Er as Co,F as wo,Fo as To,Fs as Eo,Ga as Do,Gn as Oo,Go as ko,Ha as Ao,Ht as jo,Ia as Mo,In as No,Ji as Po,Jn as Fo,Js as Io,Ka as Lo,Ko as Ro,Kr as zo,Li as Bo,Ln as Vo,M as Ho,Mo as Uo,No as Wo,Ns as Go,Nt as Ko,O as qo,Oi as Jo,Oo as Yo,Os as Xo,P as Zo,Pa as Qo,Pt as $o,Qr as es,R as ts,Ro as ns,Si as rs,Sr as is,Ti as as,To as os,Ts as ss,Uo as cs,Va as ls,Vo as us,Wa as ds,Wi as fs,Wo as ps,Wr as ms,Ws as hs,Xi as gs,Xo as _s,Xs as vs,Ya as ys,Yo as bs,Yr as xs,Ys as Ss,Zs as Cs,_ as ws,_t as Ts,ar as Es,at as Ds,ca as Os,co as ks,cr as As,dr as js,ec as Ms,fa as Ns,fn as Ps,fr as Fs,ft as Is,gr as Ls,ha as Rs,hi as zs,in as Bs,it as Vs,j as Hs,jr as Us,js as Ws,ka as Gs,ki as Ks,kr as qs,ks as Js,la as Ys,ma as Xs,n as Zs,nc as Qs,oi as $s,or as ec,pi as tc,po as nc,pr as rc,qn as ic,qo as ac,qs as oc,ra as sc,rc as cc,ri as lc,rt as uc,s as dc,sn as fc,so as pc,sr as mc,t as hc,tc as gc,v as _c,vi as vc,w as yc,wr as bc,wt as xc,yi as Sc,yn as Cc,yr as wc,zi as Tc,zn as Ec}from"./dist-D1GzYuCD.js";import{n as Dc,t as Oc}from"./dist-CJhtNlOm2.js";import{S as kc,_ as Ac,a as jc,b as Mc,g as Nc,h as Pc,i as Fc,l as Ic,m as Lc,r as Rc,t as zc,u as Bc,y as Vc}from"./use-settings-route-BQW0aTo0.js";import{t as Hc}from"./dist-Cr4-nBVI.js";import{_ as Uc,a as Wc,b as Gc,c as Kc,f as qc,g as Jc,o as Yc,v as Xc,x as Zc,y as Qc}from"./documents-events-DPqTvBXn.js";import{t as $c}from"./note-window-mode-CsmLTxU_.js";import{C as el,E as tl,O as nl,T as rl,a as il,b as al,c as ol,d as sl,f as cl,g as ll,h as ul,l as dl,m as fl,n as pl,o as ml,p as hl,r as gl,t as _l,u as vl,v as yl,w as bl,x as xl}from"./terminal-launch-events-rC-SK1H0.js";import{a as Sl,f as Cl,i as wl,l as Tl,m as El,n as Dl,o as Ol,p as kl,r as Al,s as jl,t as Ml,u as Nl}from"./launcher-selection-CUAKUPGW.js";import{a as Pl,i as Fl}from"./use-apply-config-theme-CBmHKD_B.js";import{t as Il}from"./parse-api-error-Dd8VI2eu.js";import{A as Ll,C as Rl,D as zl,E as Bl,M as Vl,O as Hl,S as Ul,T as Wl,_ as Gl,a as Kl,b as ql,c as Jl,d as Yl,f as Xl,g as Zl,h as Ql,i as $l,j as eu,k as tu,m as nu,n as ru,o as iu,p as au,r as ou,s as su,t as cu,u as lu,v as uu,w as du,x as fu,y as pu}from"./AddPropertiesButton-CC1Bimpt.js";import{n as mu,t as hu}from"./workspace-paths-CAsMig07.js";import{n as gu}from"./use-workspace-BeSzHXgL.js";import{t as _u}from"./createLucideIcon-BulbvLvN.js";import{t as vu}from"./git-branch-3CSRgL0o.js";import{_ as yu,d as bu,h as xu,l as Su,m as Cu,u as wu}from"./EnableSyncConfirmDialog-DyPeGiVT.js";import{c as Tu,d as Eu,l as Du,n as Ou,r as ku,u as Au}from"./Mermaid-B4Oa2diB.js";import{t as ju}from"./arrow-up-right-BTi7mHwL.js";import{_ as Mu,a as Nu,f as Pu,g as Fu,i as Iu,l as Lu,m as Ru,n as zu,t as Bu,v as Vu}from"./PropertyDisplayRow-B3tLCY9W.js";import{t as Hu}from"./case-sensitive-BwklrMJw.js";import{t as Uu}from"./check-Dut4Aov8.js";import{t as Wu}from"./chevron-left-Dhf0Sw0W.js";import{t as Gu}from"./chevron-down-DNO3PgI_.js";import{t as Ku}from"./chevron-right-4mYNnAZZ.js";import{A as qu,C as Ju,E as Yu,H as Xu,I as Zu,L as Qu,M as $u,N as ed,O as td,P as nd,R as rd,U as id,V as ad,W as od,_ as sd,a as cd,b as ld,c as ud,d as dd,f as fd,g as pd,h as md,k as hd,l as gd,n as _d,o as vd,p as yd,r as bd,s as xd,t as Sd,u as Cd,v as wd,w as Td,x as Ed,y as Dd,z as Od}from"./typing-burst-detector-B0lg7vla.js";import{n as kd,t as Ad}from"./lint-plugin-meta-LEBWvINg.js";import{t as jd}from"./circle-alert-b-E0_BIP.js";import{a as Md,i as Nd,n as Pd,o as Fd,r as Id,s as Ld}from"./prop-types-NHOECtyl.js";import{$ as Rd,B as zd,C as Bd,D as Vd,E as Hd,F as Ud,G as eee,H as Wd,I as Gd,J as Kd,K as qd,P as Jd,Q as Yd,T as Xd,U as Zd,V as Qd,X as $d,Y as ef,Z as tf,a as nf,c as rf,et as af,f as of,h as sf,j as cf,n as lf,nt as uf,q as df,r as ff,rt as pf,t as mf,tt as hf,u as gf,w as _f,z as vf}from"./auth-state-cache-D22yWCCz.js";import{n as yf}from"./terminal-D4HSnHXf.js";import{t as bf}from"./eye-7pio2q9G.js";import{a as xf,c as Sf,i as Cf,n as wf,o as Tf,r as Ef,s as Df,t as Of}from"./pending-receive-nav-store-sErL2uzl.js";import{_ as kf,a as Af,c as jf,d as Mf,f as Nf,g as Pf,h as Ff,i as If,l as Lf,m as Rf,o as zf,p as Bf,s as Vf,u as Hf,v as Uf}from"./ManagedArtifactProperties-Dd9YEu9g.js";import{t as Wf}from"./folder-open-BWpLO6wT.js";import{a as Gf,c as Kf,i as qf,n as Jf,o as Yf,r as Xf,t as Zf}from"./use-open-skill-DJmjKHgr.js";import{i as Qf,n as $f}from"./folder-config-api-BddKQIga.js";import{t as ep}from"./hash-3VQG5UJ7.js";import{n as tp,t as np}from"./target-navigation-intent-BFUFQkcA.js";import{t as rp}from"./info-SlzbpjOb.js";import{t as ip}from"./spinner-t7GahFcQ.js";import{o as ap,r as op,t as sp}from"./bug-report-send-manager-BBNXam8A.js";import{n as cp,t as lp}from"./miss-dialog-store-DVpIaq34.js";import{_ as up,a as dp,b as fp,c as pp,d as mp,f as hp,g as gp,i as _p,l as vp,m as yp,n as bp,o as xp,p as Sp,r as Cp,s as wp,t as Tp,u as Ep,v as Dp,y as Op}from"./comment-chips-D0prCEAx.js";import{n as kp,t as Ap}from"./package-Bo0V5xFD.js";import{n as jp,t as Mp}from"./panel-right-open-2VYfauQI.js";import{t as Np}from"./paperclip-CrupYCX8.js";import{t as Pp}from"./refresh-cw-BFSYd-XR.js";import{t as Fp}from"./square-pen-CBGVrQUa.js";import{t as Ip}from"./trash-2-DSqYvaPJ.js";import{t as Lp}from"./triangle-alert-GeclLtDN.js";import{t as Rp}from"./undo-2-XcI_wHcs.js";import{t as zp}from"./x-DbShSCr5.js";import{C as Bp,S as Vp,_ as Hp,a as Up,b as Wp,c as Gp,d as Kp,f as qp,g as Jp,h as Yp,i as Xp,m as Zp,p as Qp,s as $p,u as em,v as tm,w as nm,x as rm,y as im}from"./doc-paths-ByyIE836.js";import{a as am,i as om,o as sm,s as cm}from"./startup-marks-Bvho0uc6.js";import{c as lm,d as um,f as dm,l as fm,m as pm,o as mm,p as hm,s as gm,u as _m}from"./page-list-cache-D2OX_WDU.js";import{a as vm,c as ym,d as bm,i as xm,l as Sm,n as Cm,o as wm,s as Tm,u as Em}from"./file-tree-utils-Jz2v-e9t.js";import{c as Dm,f as Om,i as km,n as Am,o as jm,r as Mm,t as Nm}from"./config-provider-D-Y4Wg0x.js";import{i as Pm,r as Fm,t as Im}from"./use-collab-url-DFpuF-wX.js";import{M as Lm,_ as Rm,b as zm,d as Bm,f as Vm,g as Hm,h as Um,i as Wm,k as Gm,l as Km,n as qm,o as Jm,u as Ym,v as Xm,x as Zm}from"./skills-api-D5W0J2dk.js";import{a as Qm,c as $m,d as eh,f as th,l as nh,o as rh,p as ih,s as ah,t as oh,u as sh}from"./skill-scope-4RF9DbEf.js";import{n as ch,t as lh}from"./client-version-B_H8duw7.js";import{t as uh}from"./documents-fetch-UmC9duIp.js";import{t as dh}from"./input-DJ1c1x-M.js";import{a as fh,i as ph,n as mh,t as hh}from"./popover-BE6X9rKr.js";import"./i18n-BFtoQNCd.js";import{n as gh,t as _h}from"./external-link-B0bVg1hn.js";import{t as vh}from"./asset-dispatch-KsnhYIM1.js";import{n as yh,r as bh,t as xh}from"./file-tree-rename-validation-B5TvPsC_.js";import{t as Sh}from"./badge-BWfmbBoh.js";import{a as Ch,i as wh,n as Th,o as Eh,r as Dh,s as Oh}from"./project-paths-DX_YsFET.js";import{a as kh,n as Ah,o as jh,r as Mh,s as Nh,t as Ph}from"./field-Di3yPBdO.js";import{t as Fh}from"./use-skills-BOMFaoLg.js";import{i as Ih,n as Lh,r as Rh,t as zh}from"./auth-prompt-store-3WR-Jv7J.js";import{c as Bh,i as Vh,l as Hh,n as Uh,r as Wh,s as Gh,t as Kh}from"./selection-context-C95IJZrT.js";import{a as qh,c as Jh,i as Yh,n as Xh,o as Zh,r as Qh,s as $h,t as eg}from"./panel-DNPki55m.js";import{t as tg}from"./skeleton-BZIHOzZH.js";import{c as ng,i as rg,l as ig,r as ag}from"./lint-config-client-DeGP10La.js";import{a as og,o as sg,t as cg}from"./agent-diff-store-XWhp_hqN.js";import{n as lg,r as ug,t as dg}from"./timeline-diff-store-ym5Oz1UF.js";import{a as fg,c as pg,i as mg,n as hg,o as gg,r as _g,s as vg,t as yg}from"./EditorModeToggle-DpkS50Z0.js";import{a as bg,c as xg,d as Sg,g as Cg,h as wg,i as Tg,m as Eg,n as Dg,p as Og,r as kg,s as Ag,t as jg,u as Mg}from"./sortable.esm-DK-jMveF.js";import{t as Ng}from"./textarea-BoMa_3jF.js";import{t as Pg}from"./SkillCostValue-B4D7Ysdc.js";import{t as Fg}from"./SkillModeBanner-Cfij5biF.js";import{n as Ig,t as Lg}from"./DiffView-DS16M3wC.js";import{n as Rg,r as zg}from"./platform-labels-DWuGftrI.js";import{t as Bg}from"./use-skill-origin-WyyVjfzt.js";import{n as Vg,r as Hg,t as Ug}from"./input-group-eVl8FXAc.js";import{A as Wg,C as Gg,D as Kg,E as qg,O as Jg,S as Yg,T as Xg,_ as Zg,a as Qg,b as $g,c as e_,d as t_,f as n_,g as r_,h as i_,i as a_,j as o_,k as s_,l as c_,m as l_,n as u_,o as d_,p as f_,r as p_,s as m_,t as h_,u as g_,v as __,w as v_,x as y_,y as b_}from"./file-tree-adapter-Ccbih42A.js";import{t as x_}from"./use-live-xterm-theme-c1fyCaal.js";import{t as S_}from"./app-menubar-gate-q1nJIutw.js";import{n as C_,r as w_}from"./agent-presence-3JajMNAq.js";import{a as T_,c as E_,d as D_,f as O_,i as k_,l as A_,m as j_,n as M_,o as N_,s as P_,t as F_,u as I_}from"./form-Bz-LEGU-.js";import{n as L_}from"./terminal-command-events-D0gJ8NJs.js";import{n as R_,r as z_,t as B_}from"./ok-CtJ8JyHz.js";import{a as V_,t as H_}from"./receive-store-6Dih24L8.js";function U_(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.64.0`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-BQYAUKok.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)}var tee=class extends Un{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||W_(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=$n({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}})(this.state),Wn.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function W_(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var G_=class extends or{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new tee({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=K_(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=K_(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=K_(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=K_(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Wn.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Kn(t,e))}findAll(e={}){return this.getAll().filter(t=>Kn(e,t))}notify(e){Wn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Wn.batch(()=>Promise.all(e.map(e=>e.continue().catch(Zn))))}};function K_(e){return e.options.scope?.id}var q_=class extends or{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??Gn(r,t),a=this.get(i);return a||(a=new Yn({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Wn.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>er(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>er(e,t)):t}notify(e){Wn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Wn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Wn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},J_=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new q_,this.#t=e.mutationCache||new G_,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=ar.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=nr.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(qn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Xn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Wn.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;Wn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Wn.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=Wn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Zn).catch(Zn)}invalidateQueries(e,t={}){return Wn.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=Wn.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(Zn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Zn)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(qn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Zn).catch(Zn)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Zn).catch(Zn)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return nr.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(ir(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Jn(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(ir(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Jn(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Gn(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Hn&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Z=r(),Q=e(zn(),1),Y_=t(),$=ur(),X_=`button, a[href], input, textarea, select, [contenteditable="true"], [role="button"], [role="menuitem"]`;function Z_(){if(typeof document>`u`)return!1;let e=document.activeElement;return!e||e===document.body?!1:e instanceof Element&&e.matches(X_)}function Q_(e={}){return Mr()?!1:e.allowWhileFocused?!0:!Z_()}var $_=e(lr(),1),ev=`ok-blob-mascot`;function tv(e){if(typeof document>`u`){e();return}let t=document.startViewTransition,n=typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;if(typeof t!=`function`||n){e();return}t.call(document,()=>{(0,$_.flushSync)(e)})}var nv=64*.055,rv=.1875,iv=2400,av=310;av**2/(2*iv);var ov=580**2/(2*iv),sv=2*580/iv,cv=.09,lv=sv+.1,uv=.5,dv=1.3,fv=3200,pv=14,mv=sv*2.4,hv=sv*1.35,gv=.9,_v=.3,vv=14e3;function yv(e,t,n){return e+(t-e)*n}function bv(e){return Math.min(1,Math.max(0,e/vv))}function xv(e){return yv(mv,hv,bv(e))}function Sv(e){return e<=Pv?0:yv(Mv,Nv,bv(e))}var Cv=38,wv=52,Tv=12,Ev=20,Dv=34,Ov=14,kv=18,Av=22,jv=30,Mv=.15,Nv=.45,Pv=900,Fv=240,Iv=.05,Lv=1/120,Rv=12;function zv(){return{phase:`idle`,y:0,vy:0,dwell:0,jumpBuffer:0,jumping:!1,ducking:!1,speed:260,distance:0,obstacles:[],spawnCountdown:260*xv(0),nextObstacleId:0}}function Bv(e){Object.assign(e,zv(),{phase:`running`})}function Vv(e){return e.phase===`running`?e.jumping?(e.jumpBuffer=lv,!1):(e.vy=580,e.dwell=0,e.jumpBuffer=0,e.jumping=!0,!0):!1}function Hv(e,t){e.phase===`running`&&(e.ducking=t)}function Uv(e){return e.ducking&&e.y===0}function Wv(e){return Math.floor(e.distance/Rv)}function Gv(e){if(Uv(e))return{scaleX:dv,scaleY:uv};if(e.y===0&&e.dwell>0){let t=.28*(1-(1-e.dwell/cv));return{scaleX:1+t*.8,scaleY:1-t}}let t=.22*Math.min(Math.abs(e.vy)/580,1);return{scaleX:1-t*.7,scaleY:1+t}}function Kv(e){let t=Uv(e),n=64*(t?dv:1),r=64*(t?uv:1),i=n*rv,a=r*rv,o=28-(n-64)/2;return{left:o+i,right:o+n-i,bottom:e.y+a,top:e.y+r-a}}function qv(e,t){let n=Kv(e);return n.left<t.x+t.width&&n.right>t.x&&n.bottom<t.y+t.height&&n.top>t.y}function Jv(e,t,n){let r=n()<Sv(e.distance),[i,a,o,s,c]=r?[Av,jv,Ov,kv,Dv]:[Tv,Ev,Cv,wv,0];e.obstacles.push({id:e.nextObstacleId,kind:r?`overhead`:`ground`,x:t,y:c,width:i+n()*(a-i),height:o+n()*(s-o)}),e.nextObstacleId+=1;let l=yv(gv,_v,bv(e.distance));e.spawnCountdown=e.speed*(xv(e.distance)+n()*l)}function Yv(e,t,n,r){if(e.jumpBuffer=Math.max(0,e.jumpBuffer-t),e.y>0||e.vy>0){let n=e.ducking?iv+fv:iv;e.vy-=n*t,e.y+=e.vy*t,e.y<=0&&(e.y=0,e.vy=0,e.jumping=!1,e.jumpBuffer>0?(e.vy=580,e.jumpBuffer=0,e.jumping=!0):e.dwell=cv)}else e.ducking?e.dwell=0:(e.dwell-=t,e.dwell<=0&&(e.dwell=0,e.vy=av));e.speed=Math.min(620,e.speed+pv*t);let i=e.speed*t;e.distance+=i;for(let t of e.obstacles)t.x-=i;e.obstacles=e.obstacles.filter(e=>e.x+e.width>0),e.spawnCountdown-=i,e.spawnCountdown<=0&&Jv(e,n,r);for(let t of e.obstacles)if(qv(e,t)){e.phase=`over`;return}}function Xv(e,t,n,r=Math.random){if(e.phase!==`running`)return e;let i=Math.max(n,Fv),a=Math.min(Math.max(t,0),Iv);for(;a>0;){let t=Math.min(a,Lv);if(a-=t,Yv(e,t,i,r),e.phase!==`running`)break}return e}var Zv=`ok-blob-runner-best`;function Qv(){try{return typeof localStorage>`u`?null:localStorage}catch{return null}}function $v(e=Qv()){if(!e)return 0;try{let t=Number(e.getItem(Zv));return Number.isFinite(t)&&t>0?Math.floor(t):0}catch{return 0}}function ey(e,t=Qv()){if(!(!t||!Number.isFinite(e)||e<=0))try{t.setItem(Zv,String(Math.floor(e)))}catch{}}function ty(e,t,n){let r=n?.windowMs??4e3;return e<=0||t>=r?1:e+1}var ny=Math.ceil(ov+64+8),ry=Array.from({length:24},(e,t)=>`obstacle-slot-${t}`),iy=300,ay=4,oy=.45;function sy(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(en,{className:`h-4 min-w-4 px-1.5 align-middle text-[10px]`,children:n}),t[0]=n,t[1]=r),r}function cy(e){let t=(0,$.c)(48),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{autoStart:r}=n,i=r===void 0?!1:r,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=zv(),t[2]=a):a=t[2];let o=(0,Q.useRef)(a),s=(0,Q.useRef)(null),c=(0,Q.useRef)(null),l=(0,Q.useRef)(null),u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],t[3]=u):u=t[3];let d=(0,Q.useRef)(u),[f,p]=(0,Q.useState)(`idle`),[m,h]=(0,Q.useState)(0),[g,_]=(0,Q.useState)(dy),v=(0,Q.useRef)(g),[y,b]=(0,Q.useState)(0),[x,S]=(0,Q.useState)(!1),[C]=(0,Q.useState)(uy),w,T;t[4]!==i||t[5]!==C?(w=()=>{if(!i||C)return;let e=setTimeout(()=>{Bv(o.current),p(`running`)},iy);return()=>clearTimeout(e)},T=[i,C],t[4]=i,t[5]=C,t[6]=w,t[7]=T):(w=t[6],T=t[7]),(0,Q.useEffect)(w,T);let E,D;t[8]===f?(E=t[9],D=t[10]):(E=()=>{if(f!==`running`)return;let e=0,t=performance.now(),n=function(){let e=o.current;if(c.current){let{scaleX:t,scaleY:n}=Gv(e);c.current.style.transform=`translateY(${nv-e.y}px) scale(${t.toFixed(4)}, ${n.toFixed(4)})`}for(let t=0;t<24;t++){let n=d.current[t];if(!n)continue;let r=e.obstacles[t];if(!r){n.style.opacity=`0`;continue}n.style.opacity=`1`,n.style.width=`${r.width}px`,n.style.height=`${r.height}px`,n.style.bottom=`${r.y}px`,n.style.borderRadius=r.kind===`overhead`?`9999px`:`3px`,n.style.transform=`translateX(${r.x}px)`}l.current&&(l.current.textContent=String(Wv(e)).padStart(ay,`0`))};function r(i){let a=o.current;if(Xv(a,(i-t)/1e3,s.current?.clientWidth??0),t=i,n(),a.phase===`over`){let e=Wv(a),t=e>v.current;h(e),t&&(v.current=e,ey(e),_(e),S(!0),b(ly)),p(`over`);return}e=requestAnimationFrame(r)}return e=requestAnimationFrame(r),()=>cancelAnimationFrame(e)},D=[f],t[8]=f,t[9]=E,t[10]=D),(0,Q.useEffect)(E,D);let O,k;t[11]===C?(O=t[12],k=t[13]):(k=()=>{if(C)return;let e=function(){Bv(o.current),S(!1),p(`running`)},t=function(t){let n=o.current;if(t.key===`ArrowDown`){if(!Q_({allowWhileFocused:!0}))return;t.preventDefault(),Hv(n,!0);return}t.key!==` `&&t.key!==`ArrowUp`||Q_({allowWhileFocused:t.key===`ArrowUp`})&&(t.preventDefault(),n.phase===`running`?Vv(n):e())},n=function(e){e.key===`ArrowDown`&&Hv(o.current,!1)};return window.addEventListener(`keydown`,t),window.addEventListener(`keyup`,n),()=>{window.removeEventListener(`keydown`,t),window.removeEventListener(`keyup`,n)}},O=[C],t[11]=C,t[12]=O,t[13]=k),(0,Q.useEffect)(k,O);let A;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){Z_()&&document.activeElement.blur();let t=o.current;if(t.phase!==`running`){Bv(t),S(!1),p(`running`);return}let n=e.currentTarget.getBoundingClientRect();if(e.clientY-n.top>n.height*(1-oy)){Hv(t,!0),e.currentTarget.setPointerCapture?.(e.pointerId);return}Vv(t)},t[14]=A):A=t[14];let j=A,M;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=function(){Hv(o.current,!1)},t[15]=M):M=t[15];let N=M;if(C){let e;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(kr,{size:64,variant:`sleeping`}),t[16]=e):e=t[16],e}let P=f!==`running`&&!x,F;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(F={height:ny},t[17]=F):F=t[17];let I;t[18]===i?I=t[19]:(I={left:28,transform:`translateY(${nv}px)`,...i?{viewTransitionName:ev}:{}},t[18]=i,t[19]=I);let L=P?`sleeping`:`default`,R;t[20]!==y||t[21]!==L?(R=(0,Z.jsx)(kr,{size:64,trackMouse:!1,variant:L,celebrateSignal:y}),t[20]=y,t[21]=L,t[22]=R):R=t[22];let z;t[23]!==I||t[24]!==R?(z=(0,Z.jsx)(`div`,{ref:c,className:`absolute bottom-0 flex origin-bottom will-change-transform`,style:I,children:R}),t[23]=I,t[24]=R,t[25]=z):z=t[25];let B;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(B=ry.map((e,t)=>(0,Z.jsx)(`div`,{"data-slot":`ok-blob-runner-obstacle`,ref:e=>{d.current[t]=e},className:`absolute bottom-0 left-0 rounded-sm bg-muted-foreground/70 will-change-transform`,style:{opacity:0}},e)),t[26]=B):B=t[26];let V;t[27]!==z||t[28]!==B?(V=(0,Z.jsxs)(`div`,{ref:s,"data-slot":`ok-blob-runner-track`,className:`relative w-full cursor-pointer overflow-hidden border-b border-dashed border-border`,style:F,onPointerDown:j,onPointerUp:N,onPointerCancel:N,onPointerLeave:N,children:[z,B]}),t[27]=z,t[28]=B,t[29]=V):V=t[29];let ee;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(ee={left:28},t[30]=ee):ee=t[30];let H;t[31]!==x||t[32]!==g?(H=g>0?(0,Z.jsxs)(`span`,{className:x?`text-muted-foreground`:void 0,children:[(0,Z.jsx)(Y,{id:`9GbR5F`}),` `,String(g).padStart(ay,`0`)]}):null,t[31]=x,t[32]=g,t[33]=H):H=t[33];let U=String(m),W;t[34]===U?W=t[35]:(W=U.padStart(ay,`0`),t[34]=U,t[35]=W);let G;t[36]===W?G=t[37]:(G=(0,Z.jsx)(`span`,{ref:l,children:W}),t[36]=W,t[37]=G);let te;t[38]!==H||t[39]!==G?(te=(0,Z.jsx)(`div`,{className:`relative mt-1.5 h-5`,children:(0,Z.jsxs)(`div`,{"data-slot":`ok-blob-runner-score`,className:`absolute top-0 flex gap-3 font-mono text-xs tabular-nums text-muted-foreground/60`,style:ee,children:[H,G]})}),t[38]=H,t[39]=G,t[40]=te):te=t[40];let ne;t[41]!==x||t[42]!==f?(ne=(0,Z.jsx)(`p`,{"data-slot":`ok-blob-runner-hint`,className:`mt-2 text-center font-mono text-[11px] uppercase tracking-wide text-muted-foreground/60`,children:f===`over`?x?(0,Z.jsx)(Y,{id:`ai40UJ`,components:{0:(0,Z.jsx)(sy,{})}}):(0,Z.jsx)(Y,{id:`uY5Z7P`,components:{0:(0,Z.jsx)(sy,{})}}):f===`running`?(0,Z.jsx)(Y,{id:`pI_bKs`,components:{0:(0,Z.jsx)(sy,{}),1:(0,Z.jsx)(sy,{})}}):(0,Z.jsx)(Y,{id:`7a0YcF`,components:{0:(0,Z.jsx)(sy,{})}})}),t[41]=x,t[42]=f,t[43]=ne):ne=t[43];let re;return t[44]!==V||t[45]!==te||t[46]!==ne?(re=(0,Z.jsxs)(`div`,{"aria-hidden":`true`,"data-slot":`ok-blob-runner`,className:`w-full select-none animate-in fade-in-0 slide-in-from-bottom-2 duration-300 motion-reduce:animate-none`,children:[V,te,ne]}),t[44]=V,t[45]=te,t[46]=ne,t[47]=re):re=t[47],re}function ly(e){return e+1}function uy(){return typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function dy(){return $v()}var fy=80;function py(e){let t=(0,$.c)(9),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{keyboard:r}=n,i=r===void 0?!0:r,[a,o]=(0,Q.useState)(!1),s=(0,Q.useRef)(!1),[c]=(0,Q.useState)(my),l,u;if(t[2]!==i||t[3]!==c?(l=()=>{if(c||!i)return;let e=function(e){s.current||e.key!==` `&&e.key!==`ArrowUp`||Q_({allowWhileFocused:e.key===`ArrowUp`})&&(e.preventDefault(),s.current=!0,tv(()=>o(!0)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},u=[c,i],t[2]=i,t[3]=c,t[4]=l,t[5]=u):(l=t[4],u=t[5]),(0,Q.useEffect)(l,u),a){let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(cy,{autoStart:!0}),t[6]=e):e=t[6],e}if(c){let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(kr,{size:fy,variant:`sleeping`}),t[7]=e):e=t[7],e}let d;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-slot":`ok-blob-runner-easter-egg`,className:`cursor-pointer select-none transition-opacity duration-200`,style:{viewTransitionName:ev},onPointerDown:()=>{Z_()&&document.activeElement.blur(),s.current=!0,tv(()=>o(!0))},children:(0,Z.jsx)(kr,{size:fy,variant:`sleeping`})}),t[8]=d):d=t[8],d}function my(){return typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var hy=new WeakMap;function gy(e,t){typeof e!=`object`||!e||typeof t!=`string`||t.trim()===``||hy.set(e,t)}function _y(e){if(!(typeof e!=`object`||!e))return hy.get(e)}function vy(e){let t=(0,$.c)(24),{error:n,resetErrorBoundary:r}=e,{_:i}=Bn(),[a,o]=(0,Q.useState)(!1),s=(0,Q.useRef)(null),c=typeof window<`u`?window.okDesktop:void 0,l;t[0]!==i||t[1]!==n?(l=n instanceof Error&&n.message?n.message:i({id:`W5A0Ly`}),t[0]=i,t[1]=n,t[2]=l):l=t[2];let u=l,d,f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{s.current?.focus()},f=[],t[3]=d,t[4]=f):(d=t[3],f=t[4]),(0,Q.useEffect)(d,f);let p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(py,{keyboard:!1}),t[5]=p):p=t[5];let m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`h1`,{id:`app-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:(0,Z.jsx)(Y,{id:`nwtY4N`})}),t[6]=m):m=t[6];let h;t[7]===u?h=t[8]:(h=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[m,(0,Z.jsx)(`p`,{className:`max-w-sm text-sm break-words text-muted-foreground`,children:u})]}),t[7]=u,t[8]=h);let g;t[9]===r?g=t[10]:(g=()=>r(),t[9]=r,t[10]=g);let _;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(Y,{id:`KDw4GX`}),t[11]=_):_=t[11];let v;t[12]===g?v=t[13]:(v=(0,Z.jsx)(X,{ref:s,variant:`default`,onClick:g,children:_}),t[12]=g,t[13]=v);let y;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=c?(0,Z.jsx)(X,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>o(!0),children:(0,Z.jsx)(Y,{id:`ii5mVn`})}):null,t[14]=y):y=t[14];let b;t[15]===v?b=t[16]:(b=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[v,y]}),t[15]=v,t[16]=b);let x;t[17]!==n||t[18]!==a?(x=c?(0,Z.jsx)(xy,{children:(0,Z.jsx)(Fr,{open:a,onOpenChange:o,systemWide:c.config.mode===`navigator`,crashContext:{source:`app shell`,errorMessage:n instanceof Error&&n.message?n.message:String(n),componentStack:_y(n)}})}):null,t[17]=n,t[18]=a,t[19]=x):x=t[19];let S;return t[20]!==b||t[21]!==x||t[22]!==h?(S=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`app-error-title`,"data-slot":`app-error-boundary`,className:`flex h-screen flex-col items-center justify-center gap-8 p-8 text-center`,children:[p,h,b,x]}),t[20]=b,t[21]=x,t[22]=h,t[23]=S):S=t[23],S}function yy(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(pr,{FallbackComponent:vy,onError:by,children:n}),t[0]=n,t[1]=r),r}function by(e,t){gy(e,t.componentStack),gt(e),console.error(`[AppErrorBoundary] app-shell render crash`,e,t.componentStack??``)}function xy(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(pr,{fallback:null,onError:Sy,children:n}),t[0]=n,t[1]=r),r}function Sy(e){console.error(`[CrashReportingBoundary] crash-reporting UI render crash`,e)}function Cy(){let e=(0,$.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={queryKey:[`acp-catalog`],queryFn:Ey,staleTime:3e5},e[0]=t):t=e[0];let n=rr(t),r;e[1]===n.data?.agents?r=e[2]:(r=()=>(Xa(eo(n.data?.agents??[]).map(Ty)),wy),e[1]=n.data?.agents,e[2]=r);let i;return e[3]===n.data?i=e[4]:(i=[n.data],e[3]=n.data,e[4]=i),(0,Q.useEffect)(r,i),null}function wy(){return Xa([])}function Ty(e){return{source:e.source,id:e.id,name:e.name,featured:e.featured,...e.iconUrl===void 0?{}:{iconUrl:e.iconUrl}}}function Ey(e){let{signal:t}=e;return Qa(t)}var Dy=_u(`arrow-up-down`,[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]),Oy=_u(`bird`,[[`path`,{d:`M16 7h.01`,key:`1kdx03`}],[`path`,{d:`M3.4 18H12a8 8 0 0 0 8-8V7a4 4 0 0 0-7.28-2.3L2 20`,key:`oj1oa8`}],[`path`,{d:`m20 7 2 .5-2 .5`,key:`12nv4d`}],[`path`,{d:`M10 18v3`,key:`1yea0a`}],[`path`,{d:`M14 17.75V21`,key:`1pymcb`}],[`path`,{d:`M7 18a6 6 0 0 0 3.84-10.61`,key:`1npnn0`}]]),ky=_u(`blocks`,[[`path`,{d:`M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2`,key:`1ah6g2`}],[`rect`,{x:`14`,y:`2`,width:`8`,height:`8`,rx:`1`,key:`88lufb`}]]),Ay=_u(`bold`,[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]),jy=_u(`book-marked`,[[`path`,{d:`M10 2v8l3-3 3 3V2`,key:`sqw3rj`}],[`path`,{d:`M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20`,key:`k3hazp`}]]),My=_u(`cat`,[[`path`,{d:`M12 5c.67 0 1.35.09 2 .26 1.78-2 5.03-2.84 6.42-2.26 1.4.58-.42 7-.42 7 .57 1.07 1 2.24 1 3.44C21 17.9 16.97 21 12 21s-9-3-9-7.56c0-1.25.5-2.4 1-3.44 0 0-1.89-6.42-.5-7 1.39-.58 4.72.23 6.5 2.23A9.04 9.04 0 0 1 12 5Z`,key:`x6xyqk`}],[`path`,{d:`M8 14v.5`,key:`1nzgdb`}],[`path`,{d:`M16 14v.5`,key:`1lajdz`}],[`path`,{d:`M11.25 16.25h1.5L12 17l-.75-.75Z`,key:`12kq1m`}]]),Ny=_u(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),Py=_u(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),Fy=_u(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Iy=_u(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),Ly=_u(`compass`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}]]),Ry=_u(`copy-x`,[[`line`,{x1:`12`,x2:`18`,y1:`12`,y2:`18`,key:`1rg63v`}],[`line`,{x1:`12`,x2:`18`,y1:`18`,y2:`12`,key:`ebkxgr`}],[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),zy=_u(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),By=_u(`dog`,[[`path`,{d:`M11.25 16.25h1.5L12 17z`,key:`w7jh35`}],[`path`,{d:`M16 14v.5`,key:`1lajdz`}],[`path`,{d:`M4.42 11.247A13.152 13.152 0 0 0 4 14.556C4 18.728 7.582 21 12 21s8-2.272 8-6.444a11.702 11.702 0 0 0-.493-3.309`,key:`u7s9ue`}],[`path`,{d:`M8 14v.5`,key:`1nzgdb`}],[`path`,{d:`M8.5 8.5c-.384 1.05-1.083 2.028-2.344 2.5-1.931.722-3.576-.297-3.656-1-.113-.994 1.177-6.53 4-7 1.923-.321 3.651.845 3.651 2.235A7.497 7.497 0 0 1 14 5.277c0-1.39 1.844-2.598 3.767-2.277 2.823.47 4.113 6.006 4 7-.08.703-1.725 1.722-3.656 1-1.261-.472-1.855-1.45-2.239-2.5`,key:`v8hric`}]]),Vy=_u(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Hy=_u(`file-check`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m9 15 2 2 4-4`,key:`1grp1n`}]]),Uy=_u(`file-code-corner`,[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]]),Wy=_u(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Gy=_u(`file-key`,[[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M4 12v6`,key:`bg1pfk`}],[`path`,{d:`M4 14h2`,key:`1sf9f8`}],[`path`,{d:`M9.65 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v4`,key:`d56i0q`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),Ky=_u(`fish`,[[`path`,{d:`M6.5 12c.94-3.46 4.94-6 8.5-6 3.56 0 6.06 2.54 7 6-.94 3.47-3.44 6-7 6s-7.56-2.53-8.5-6Z`,key:`15baut`}],[`path`,{d:`M18 12v.5`,key:`18hhni`}],[`path`,{d:`M16 17.93a9.77 9.77 0 0 1 0-11.86`,key:`16dt7o`}],[`path`,{d:`M7 10.67C7 8 5.58 5.97 2.73 5.5c-1 1.5-1 5 .23 6.5-1.24 1.5-1.24 5-.23 6.5C5.58 18.03 7 16 7 13.33`,key:`l9di03`}],[`path`,{d:`M10.46 7.26C10.2 5.88 9.17 4.24 8 3h5.8a2 2 0 0 1 1.98 1.67l.23 1.4`,key:`1kjonw`}],[`path`,{d:`m16.01 17.93-.23 1.4A2 2 0 0 1 13.8 21H9.5a5.96 5.96 0 0 0 1.49-3.98`,key:`1zlm23`}]]),qy=_u(`fold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3-3-3 3`,key:`e37ymu`}],[`path`,{d:`m15 5-3 3-3-3`,key:`19d6lf`}]]),Jy=_u(`folder-cog`,[[`path`,{d:`M10.3 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.98a2 2 0 0 1 1.69.9l.66 1.2A2 2 0 0 0 12 6h8a2 2 0 0 1 2 2v3.3`,key:`128dxu`}],[`path`,{d:`m14.305 19.53.923-.382`,key:`3m78fa`}],[`path`,{d:`m15.228 16.852-.923-.383`,key:`npixar`}],[`path`,{d:`m16.852 15.228-.383-.923`,key:`5xggr7`}],[`path`,{d:`m16.852 20.772-.383.924`,key:`dpfhf9`}],[`path`,{d:`m19.148 15.228.383-.923`,key:`1reyyz`}],[`path`,{d:`m19.53 21.696-.382-.924`,key:`1goivc`}],[`path`,{d:`m20.772 16.852.924-.383`,key:`htqkph`}],[`path`,{d:`m20.772 19.148.924.383`,key:`9w9pjp`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]),Yy=_u(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Xy=_u(`gamepad-2`,[[`line`,{x1:`6`,x2:`10`,y1:`11`,y2:`11`,key:`1gktln`}],[`line`,{x1:`8`,x2:`8`,y1:`9`,y2:`13`,key:`qnk9ow`}],[`line`,{x1:`15`,x2:`15.01`,y1:`12`,y2:`12`,key:`krot7o`}],[`line`,{x1:`18`,x2:`18.01`,y1:`10`,y2:`10`,key:`1lcuu1`}],[`path`,{d:`M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z`,key:`mfqc10`}]]),Zy=_u(`grid-2x2-x`,[[`path`,{d:`M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3`,key:`11za1p`}],[`path`,{d:`m16 16 5 5`,key:`8tpb07`}],[`path`,{d:`m16 21 5-5`,key:`193jll`}]]),Qy=_u(`hard-drive`,[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]),$y=_u(`highlighter`,[[`path`,{d:`m9 11-6 6v3h9l3-3`,key:`1a3l36`}],[`path`,{d:`m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4`,key:`14a9rk`}]]),eb=_u(`italic`,[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]),tb=_u(`library-big`,[[`rect`,{width:`8`,height:`18`,x:`3`,y:`3`,rx:`1`,key:`oynpb5`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M20.4 18.9c.2.5-.1 1.1-.6 1.3l-1.9.7c-.5.2-1.1-.1-1.3-.6L11.1 5.1c-.2-.5.1-1.1.6-1.3l1.9-.7c.5-.2 1.1.1 1.3.6Z`,key:`1qboyk`}]]),nb=_u(`library`,[[`path`,{d:`m16 6 4 14`,key:`ji33uf`}],[`path`,{d:`M12 6v14`,key:`1n7gus`}],[`path`,{d:`M8 8v12`,key:`1gg7y9`}],[`path`,{d:`M4 4v16`,key:`6qkkli`}]]),rb=_u(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),ib=_u(`list-collapse`,[[`path`,{d:`M10 5h11`,key:`1hkqpe`}],[`path`,{d:`M10 12h11`,key:`6m4ad9`}],[`path`,{d:`M10 19h11`,key:`14g2nv`}],[`path`,{d:`m3 10 3-3-3-3`,key:`i7pm08`}],[`path`,{d:`m3 20 3-3-3-3`,key:`20gx1n`}]]),ab=_u(`list-tree`,[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]),ob=_u(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),sb=_u(`megaphone`,[[`path`,{d:`M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z`,key:`q8bfy3`}],[`path`,{d:`M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14`,key:`1853fq`}],[`path`,{d:`M8 6v8`,key:`15ugcq`}]]),cb=_u(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),lb=_u(`octagon-x`,[[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),ub=_u(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),db=_u(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),fb=_u(`pilcrow`,[[`path`,{d:`M13 4v16`,key:`8vvj80`}],[`path`,{d:`M17 4v16`,key:`7dpous`}],[`path`,{d:`M19 4H9.5a4.5 4.5 0 0 0 0 9H13`,key:`sh4n9v`}]]),pb=_u(`pin-off`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),mb=_u(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),hb=_u(`puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),gb=_u(`rabbit`,[[`path`,{d:`M13 16a3 3 0 0 1 2.24 5`,key:`1epib5`}],[`path`,{d:`M18 12h.01`,key:`yjnet6`}],[`path`,{d:`M18 21h-8a4 4 0 0 1-4-4 7 7 0 0 1 7-7h.2L9.6 6.4a1 1 0 1 1 2.8-2.8L15.8 7h.2c3.3 0 6 2.7 6 6v1a2 2 0 0 1-2 2h-1a3 3 0 0 0-3 3`,key:`ue9ozu`}],[`path`,{d:`M20 8.54V4a2 2 0 1 0-4 0v3`,key:`49iql8`}],[`path`,{d:`M7.612 12.524a3 3 0 1 0-1.6 4.3`,key:`1e33i0`}]]),_b=_u(`rat`,[[`path`,{d:`M13 22H4a2 2 0 0 1 0-4h12`,key:`bt3f23`}],[`path`,{d:`M13.236 18a3 3 0 0 0-2.2-5`,key:`1tbvmo`}],[`path`,{d:`M16 9h.01`,key:`1bdo4e`}],[`path`,{d:`M16.82 3.94a3 3 0 1 1 3.237 4.868l1.815 2.587a1.5 1.5 0 0 1-1.5 2.1l-2.872-.453a3 3 0 0 0-3.5 3`,key:`9ch7kn`}],[`path`,{d:`M17 4.988a3 3 0 1 0-5.2 2.052A7 7 0 0 0 4 14.015 4 4 0 0 0 8 18`,key:`3s7e9i`}]]),vb=_u(`replace-all`,[[`path`,{d:`M14 14a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1`,key:`zg1ipl`}],[`path`,{d:`M14 4a1 1 0 0 1 1-1`,key:`dhj8ez`}],[`path`,{d:`M15 10a1 1 0 0 1-1-1`,key:`1mnyi5`}],[`path`,{d:`M19 14a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1`,key:`txt6k4`}],[`path`,{d:`M21 4a1 1 0 0 0-1-1`,key:`sfs9ap`}],[`path`,{d:`M21 9a1 1 0 0 1-1 1`,key:`mp6qeo`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a2 2 0 0 1 2-2h2`,key:`15xut4`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}]]),yb=_u(`replace`,[[`path`,{d:`M14 4a1 1 0 0 1 1-1`,key:`dhj8ez`}],[`path`,{d:`M15 10a1 1 0 0 1-1-1`,key:`1mnyi5`}],[`path`,{d:`M21 4a1 1 0 0 0-1-1`,key:`sfs9ap`}],[`path`,{d:`M21 9a1 1 0 0 1-1 1`,key:`mp6qeo`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a2 2 0 0 1 2-2h2`,key:`15xut4`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}]]),bb=_u(`shrimp`,[[`path`,{d:`M11 12h.01`,key:`1lr4k6`}],[`path`,{d:`M13 22c.5-.5 1.12-1 2.5-1-1.38 0-2-.5-2.5-1`,key:`fatpdi`}],[`path`,{d:`M14 2a3.28 3.28 0 0 1-3.227 1.798l-6.17-.561A2.387 2.387 0 1 0 4.387 8H15.5a1 1 0 0 1 0 13 1 1 0 0 0 0-5H12a7 7 0 0 1-7-7V8`,key:`kehrqe`}],[`path`,{d:`M14 8a8.5 8.5 0 0 1 0 8`,key:`1imjx2`}],[`path`,{d:`M16 16c2 0 4.5-4 4-6`,key:`z0nejz`}]]),xb=_u(`snail`,[[`path`,{d:`M2 13a6 6 0 1 0 12 0 4 4 0 1 0-8 0 2 2 0 0 0 4 0`,key:`hneq2s`}],[`circle`,{cx:`10`,cy:`13`,r:`8`,key:`194lz3`}],[`path`,{d:`M2 21h12c4.4 0 8-3.6 8-8V7a2 2 0 1 0-4 0v6`,key:`ixqyt7`}],[`path`,{d:`M18 3 19.1 5.2`,key:`9tjm43`}],[`path`,{d:`M22 3 20.9 5.2`,key:`j3odrs`}]]),Sb=_u(`spell-check`,[[`path`,{d:`m6 16 6-12 6 12`,key:`1b4byz`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`m16 20 2 2 4-4`,key:`13tcca`}]]),Cb=_u(`square-arrow-out-up-right`,[[`path`,{d:`M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6`,key:`y09zxi`}],[`path`,{d:`m21 3-9 9`,key:`mpx6sq`}],[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}]]),wb=_u(`square-code`,[[`path`,{d:`m10 9-3 3 3 3`,key:`1oro0q`}],[`path`,{d:`m14 15 3-3-3-3`,key:`bz13h7`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),Tb=_u(`squirrel`,[[`path`,{d:`M15.236 22a3 3 0 0 0-2.2-5`,key:`21bitc`}],[`path`,{d:`M16 20a3 3 0 0 1 3-3h1a2 2 0 0 0 2-2v-2a4 4 0 0 0-4-4V4`,key:`oh0fg0`}],[`path`,{d:`M18 13h.01`,key:`9veqaj`}],[`path`,{d:`M18 6a4 4 0 0 0-4 4 7 7 0 0 0-7 7c0-5 4-5 4-10.5a4.5 4.5 0 1 0-9 0 2.5 2.5 0 0 0 5 0C7 10 3 11 3 17c0 2.8 2.2 5 5 5h10`,key:`980v8a`}]]),Eb=_u(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),Db=_u(`sticky-note`,[[`path`,{d:`M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z`,key:`1dfntj`}],[`path`,{d:`M15 3v5a1 1 0 0 0 1 1h5`,key:`6s6qgf`}]]),Ob=_u(`strikethrough`,[[`path`,{d:`M16 4H9a3 3 0 0 0-2.83 4`,key:`43sutm`}],[`path`,{d:`M14 12a4 4 0 0 1 0 8H6`,key:`nlfj13`}],[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}]]),kb=_u(`table-properties`,[[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]]),Ab=_u(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),jb=_u(`telescope`,[[`path`,{d:`m10.065 12.493-6.18 1.318a.934.934 0 0 1-1.108-.702l-.537-2.15a1.07 1.07 0 0 1 .691-1.265l13.504-4.44`,key:`k4qptu`}],[`path`,{d:`m13.56 11.747 4.332-.924`,key:`19l80z`}],[`path`,{d:`m16 21-3.105-6.21`,key:`7oh9d`}],[`path`,{d:`M16.485 5.94a2 2 0 0 1 1.455-2.425l1.09-.272a1 1 0 0 1 1.212.727l1.515 6.06a1 1 0 0 1-.727 1.213l-1.09.272a2 2 0 0 1-2.425-1.455z`,key:`m7xp4m`}],[`path`,{d:`m6.158 8.633 1.114 4.456`,key:`74o979`}],[`path`,{d:`m8 21 3.105-6.21`,key:`1fvxut`}],[`circle`,{cx:`12`,cy:`13`,r:`2`,key:`1c1ljs`}]]),Mb=_u(`text-align-center`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M17 12H7`,key:`16if0g`}],[`path`,{d:`M19 19H5`,key:`vjpgq2`}]]),Nb=_u(`text-align-end`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M21 19H7`,key:`4cu937`}]]),Pb=_u(`text-align-start`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]]),Fb=_u(`text-quote`,[[`path`,{d:`M17 5H3`,key:`1cn7zz`}],[`path`,{d:`M21 12H8`,key:`scolzb`}],[`path`,{d:`M21 19H8`,key:`13qgcb`}],[`path`,{d:`M3 12v7`,key:`1ri8j3`}]]),Ib=_u(`thumbs-down`,[[`path`,{d:`M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z`,key:`m61m77`}],[`path`,{d:`M17 14V2`,key:`8ymqnk`}]]),Lb=_u(`thumbs-up`,[[`path`,{d:`M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z`,key:`emmmcr`}],[`path`,{d:`M7 10v12`,key:`1qc93n`}]]),Rb=_u(`turtle`,[[`path`,{d:`m12 10 2 4v3a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-3a8 8 0 1 0-16 0v3a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-3l2-4h4Z`,key:`1lbbv7`}],[`path`,{d:`M4.82 7.9 8 10`,key:`m9wose`}],[`path`,{d:`M15.18 7.9 12 10`,key:`p8dp2u`}],[`path`,{d:`M16.93 10H20a2 2 0 0 1 0 4H2`,key:`12nsm7`}]]),zb=_u(`underline`,[[`path`,{d:`M6 4v6a6 6 0 0 0 12 0V4`,key:`9kb039`}],[`line`,{x1:`4`,x2:`20`,y1:`20`,y2:`20`,key:`nun2al`}]]),Bb=_u(`unfold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3 3-3-3`,key:`11eu04`}],[`path`,{d:`m15 5-3-3-3 3`,key:`itvq4r`}]]),Vb=_u(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),Hb=_u(`whole-word`,[[`circle`,{cx:`7`,cy:`12`,r:`3`,key:`12clwm`}],[`path`,{d:`M10 9v6`,key:`17i7lo`}],[`circle`,{cx:`17`,cy:`12`,r:`3`,key:`gl7c2s`}],[`path`,{d:`M14 7v8`,key:`dl84cr`}],[`path`,{d:`M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1`,key:`lt2kga`}]]);function Ub(e){return bp(e.map(xp),``)}function Wb(){let e=(0,$.c)(9),t=gu(),n=Wa(),r=Ua(),i=Za(),a;if(e[0]!==i||e[1]!==n||e[2]!==r){let t;e[4]===n?t=e[5]:(t=e=>Ha(n,e.source,e.id,!0,e.supported),e[4]=n,e[5]=t),a=Ga(r.filter(t),i),e[0]=i,e[1]=n,e[2]=r,e[3]=a}else a=e[3];let o=a,s;return e[6]!==o||e[7]!==t?(s=async e=>{let n=e.map(Kb);if(n.length===0)return!1;let r=ql({docName:null,workspace:t,instruction:Ub(n),mentions:[...new Set(n.map(Gb))]});return r===null?(Dc.error(Hc._({id:`3V94ia`})),!1):o===null?(Dc.info(Hc._({id:`8YymuQ`})),jc(),!1):(tu(r,{agent:{source:o.source,id:o.id}}),!0)},e[6]=o,e[7]=t,e[8]=s):s=e[8],s}function Gb(e){return hu(e.docName)}function Kb(e){return e.payload}function qb(){let e=(0,$.c)(3),t=Wb(),n=nl(),r=n?.kind===`thread`?n:null,i;return e[0]!==t||e[1]!==r?(i=e=>{if(r===null){l({compose:t,threadIds:e});return}El(e)},e[0]=t,e[1]=r,e[2]=i):i=e[2],i}var Jb=null;function Yb(e){Jb=e}function Xb(){return Jb}function Zb(){let e=(0,$.c)(3),t=qb(),n,r;return e[0]===t?(n=e[1],r=e[2]):(n=()=>{let e=function(e){if(!Mc(e,`send-comment-queue`)||Mr())return;let n=Xb();if(n===null)return;let r=n.scope===`doc`?he(n.docName):G();r.length!==0&&(e.preventDefault(),t(r))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},r=[t],e[0]=t,e[1]=n,e[2]=r),(0,Q.useEffect)(n,r),null}function Qb(){let e=(0,$.c)(21),{contentRecycleNotice:t,dismissContentRecycleNotice:n}=Et(),[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(!1),s=typeof window<`u`?window.okDesktop:void 0,c,l;e[0]===t?(c=e[1],l=e[2]):(c=()=>{if(o(!1),t?.kind!==`branch-switch`)return;let e=Math.max(0,t.at+ve-Date.now()),n=setTimeout(()=>o(!0),e);return()=>clearTimeout(n)},l=[t],e[0]=t,e[1]=c,e[2]=l),(0,Q.useEffect)(c,l);let u=g(t,a);if(u===`hidden`)return null;if(u===`switch`){let n=t?.kind===`branch-switch`?t.branch:``,r;e[3]===n?r=e[4]:(r={branch:n},e[3]=n,e[4]=r);let i;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(i={0:(0,Z.jsx)(`code`,{className:`bg-amber-100/60 px-1 rounded`})},e[5]=i):i=e[5];let a;return e[6]===r?a=e[7]:(a=(0,Z.jsx)(`div`,{role:`status`,"data-testid":`branch-recycle-banner-switch`,className:`fixed top-0 inset-x-0 z-50 bg-amber-500/95 text-amber-950 text-sm text-center py-2 px-4 ps-[var(--ok-titlebar-reserve-left,1rem)] shadow-md`,children:(0,Z.jsx)(Y,{id:`vVQlxV`,values:r,components:i})}),e[6]=r,e[7]=a),a}let d;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=async()=>{if(s){i(!0);try{(await uf(s)).ok||i(!1)}catch{i(!1)}}},e[8]=d):d=e[8];let f=d,p;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`F-1xhe`})}),e[9]=p):p=e[9];let m;e[10]===r?m=e[11]:(m=s?(0,Z.jsx)(X,{size:`sm`,onClick:f,disabled:r,className:`h-6 bg-red-950 text-red-50 px-2 text-xs font-medium hover:bg-red-900`,children:r?(0,Z.jsx)(Y,{id:`0Er6-M`}):(0,Z.jsx)(Y,{id:`uaUc6t`})}):null,e[10]=r,e[11]=m);let h;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(X,{size:`sm`,onClick:$b,className:`h-6 bg-red-950 text-red-50 px-2 text-xs font-medium hover:bg-red-900`,children:(0,Z.jsx)(Y,{id:`HpK_8d`})}),e[12]=h):h=e[12];let _;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(_=Hc._({id:`1QfxQT`}),e[13]=_):_=e[13];let v;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(Y,{id:`1QfxQT`}),e[14]=v):v=e[14];let y;e[15]!==n||e[16]!==_?(y=(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,onClick:n,"aria-label":_,className:`h-6 px-2 text-xs text-red-950 hover:bg-red-400/40`,children:v}),e[15]=n,e[16]=_,e[17]=y):y=e[17];let b;return e[18]!==m||e[19]!==y?(b=(0,Z.jsxs)(`div`,{role:`alert`,"data-testid":`branch-recycle-banner-refused`,className:`fixed top-0 inset-x-0 z-50 bg-red-500/95 text-red-950 text-sm text-center py-2 px-4 ps-[var(--ok-titlebar-reserve-left,1rem)] shadow-md flex items-center justify-center gap-3 flex-wrap`,children:[p,m,h,y]}),e[18]=m,e[19]=y,e[20]=b):b=e[20],b}function $b(){return window.location.reload()}function ex(e){return e.split(`/`).pop()??e}function tx(e){let t=(0,$.c)(7),{rowCount:n}=e,{_:r}=Bn(),i;t[0]===r?i=t[1]:(i=r({id:`--T3kB`}),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=(0,Z.jsx)(`ul`,{className:`space-y-2`,children:Array.from({length:n},rx).map(nx)}),t[2]=n,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Z.jsx)(`section`,{role:`status`,"aria-busy":`true`,"aria-label":i,children:a}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function nx(e){return(0,Z.jsxs)(`li`,{"aria-hidden":`true`,className:`flex items-center gap-3`,children:[(0,Z.jsx)(`div`,{className:`size-8 shrink-0 animate-pulse rounded-lg bg-muted`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 py-0.5`,children:[(0,Z.jsx)(`span`,{className:`block h-3.5 w-28 animate-pulse rounded bg-muted`}),(0,Z.jsx)(`span`,{className:`mt-2 block h-3 w-4/5 animate-pulse rounded bg-muted`})]})]},`seed-skeleton-${e}`)}function rx(e,t){return t}function ix(e,t){let n=[];for(let r of t?.folders??[]){let t=`${r.path}/.ok/templates/`,i=e.created.filter(e=>e.kind===`file`&&(e.path.startsWith(t)||e.path.includes(`/${t}`))).map(e=>ex(e.path)),a=i.length,o=e.created.some(e=>e.kind===`folder`&&(e.path===r.path||e.path.endsWith(`/${r.path}`)));(a>0||o)&&n.push({path:r.path,summary:r.summary,templateCount:a,templates:i})}return n}function ax(e){return e.created.filter(e=>e.kind===`file`&&!e.path.split(`/`).includes(`.ok`)).map(e=>({path:e.path,name:ex(e.path)}))}function ox(e){let t=(0,$.c)(17),{plan:n,selectedPack:r}=e,{_:i}=Bn(),a,o,s,c;if(t[0]!==i||t[1]!==n||t[2]!==r){let e=ix(n,r),l=ax(n),u=(n.packSkills??[]).filter(hx),d=(n.requiredPlugins??[]).filter(mx),f=e.length,p=l.length,m=e.reduce(px,0),h=u.length,g=d.length,_={"log.md":i({id:`EoaQyO`}),"USER.md":i({id:`bV6DJA`}),"SOUL.md":i({id:`Waiy-j`}),"ACCESS_POLICY.md":i({id:`6ZhdPI`}),"HEARTBEAT.md":i({id:`MDZSJe`}),"OVERVIEW.md":i({id:`dMsx3p`}),"welcome.md":i({id:`WWcqsG`}),"index.md":i({id:`uFQbYd`})},v=[f>0?{key:`folders`,n:f,label:i({id:`VsaI0G`,values:{folderCount:f}})}:null,p>0?{key:`files`,n:p,label:i({id:`DgcGrb`,values:{fileCount:p}})}:null,m>0?{key:`templates`,n:m,label:i({id:`ba3vIW`,values:{templateCount:m}})}:null,h>0?{key:`skills`,n:h,label:i({id:`HAvRAI`,values:{skillCount:h}})}:null,g>0?{key:`plugins`,n:g,label:i({id:`llXHHh`,values:{pluginCount:g}})}:null].filter(fx),y=e.map(e=>({key:`folder:${e.path}`,icon:Kf,name:`${ex(e.path)}/`,pill:e.templateCount>0?i({id:`-5jISU`,values:{0:e.templateCount}}):void 0,pillTooltip:e.templateCount>0?e.templates:void 0,description:e.summary||void 0})),b=l.map(e=>({key:`file:${e.path}`,icon:Ge,name:e.name,title:e.name,description:_[e.name]})),x=u.map(e=>({key:`skill:${e.name}`,icon:tp,name:ah(e.name),title:e.name,description:i({id:`FEqWFL`})})),S={okf:i({id:`uK2peg`})},C=d.map(e=>({key:`plugin:${e.id}`,icon:hb,name:Ad.find(t=>t.id===e.id)?.label??e.id,title:e.id,description:S[e.id]??i({id:`1ZXkqM`})})),w=[{key:`folders`,label:i({id:`pcqlQu`,values:{0:y.length}}),rows:y},{key:`files`,label:i({id:`ZgGuA4`,values:{0:b.length}}),rows:b},{key:`skill`,label:i({id:`yK1m_z`,values:{0:x.length}}),rows:x},{key:`plugin`,label:i({id:`7wogIQ`,values:{0:C.length}}),rows:C}].filter(dx);s=`space-y-5`;let T;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(`h3`,{className:`flex items-center gap-1.5 text-xs font-medium uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`xSVO3J`})}),t[7]=T):T=t[7];let E=v.length>0?(0,Z.jsx)(`div`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-0.5 text-xs`,children:v.map(ux)}):null;t[8]===E?c=t[9]:(c=(0,Z.jsxs)(`div`,{className:`flex flex-wrap justify-between items-baseline gap-x-2 gap-y-0.5`,children:[T,E]}),t[8]=E,t[9]=c),a=`space-y-5`,o=w.map(sx),t[0]=i,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s,t[6]=c}else a=t[3],o=t[4],s=t[5],c=t[6];let l;t[10]!==a||t[11]!==o?(l=(0,Z.jsx)(`div`,{className:a,children:o}),t[10]=a,t[11]=o,t[12]=l):l=t[12];let u;return t[13]!==s||t[14]!==c||t[15]!==l?(u=(0,Z.jsxs)(`section`,{className:s,children:[c,l]}),t[13]=s,t[14]=c,t[15]=l,t[16]=u):u=t[16],u}function sx(e){return(0,Z.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,Z.jsxs)(`h4`,{className:`flex items-baseline gap-2 text-xs font-medium uppercase font-mono tracking-wider text-muted-foreground`,children:[(0,Z.jsx)(`span`,{children:e.label}),(0,Z.jsx)(`span`,{className:`text-muted-foreground/50`,children:e.rows.length})]}),(0,Z.jsx)(`ul`,{className:`space-y-4`,children:e.rows.map(cx)})]},e.key)}function cx(e){let t=e.icon;return(0,Z.jsxs)(`li`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`div`,{"aria-hidden":`true`,className:`flex size-8 shrink-0 items-center justify-center rounded-lg border border-border/60`,children:(0,Z.jsx)(t,{className:`size-4 text-muted-foreground`})}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 py-0.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-1sm text-foreground/90`,title:e.title,children:e.name}),e.pill?e.pillTooltip&&e.pillTooltip.length>0?(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(Br,{className:`shrink-0 cursor-help rounded bg-transparent p-0 font-mono text-2xs uppercase tracking-wide text-muted-foreground transition-colors hover:text-foreground/70 focus-visible:text-foreground/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,children:e.pill}),(0,Z.jsx)(Vr,{children:(0,Z.jsx)(`ul`,{className:`space-y-0.5 text-left font-mono`,children:e.pillTooltip.map(lx)})})]}):(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-2xs uppercase tracking-wide text-muted-foreground`,children:e.pill}):null]}),e.description?(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-muted-foreground`,children:e.description}):null]})]},e.key)}function lx(e){return(0,Z.jsx)(`li`,{children:e},e)}function ux(e,t){return(0,Z.jsxs)(Q.Fragment,{children:[t>0?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground/50`,children:`·`}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`text-foreground/80`,children:e.n}),` `,(0,Z.jsx)(`span`,{className:`text-muted-foreground/80`,children:e.label})]})]},e.key)}function dx(e){return e.rows.length>0}function fx(e){return e!==null}function px(e,t){return e+t.templateCount}function mx(e){return e.pending}function hx(e){return e.pending}async function gx(e){let t=await e.json().catch(()=>null),n=xc.safeParse(t);if(!n.success)return{kind:`internal`,message:`HTTP ${e.status}`};let r=n.data.detail??n.data.title,i=n.data.type;return i===`urn:ok:error:seed-prerequisite-missing`?{kind:`prerequisite-missing`,message:r}:i===`urn:ok:error:seed-invalid-root`?{kind:`invalid-root`,message:r}:i===`urn:ok:error:no-project-dir`?{kind:`no-project`,message:r}:{kind:`internal`,message:r}}function _x(){let e=typeof window<`u`?window.okDesktop:void 0;if(e?.seed){let t=e.seed.apply;return{plan:e.seed.plan,apply:async(e,n)=>{let r=await t(e,n);return r.ok&&Kc(),r},listPacks:e.seed.listPacks}}return{plan:async e=>{let t=new URLSearchParams;e?.rootDir&&t.set(`rootDir`,e.rootDir),e?.packId&&t.set(`packId`,e.packId);let n=t.toString(),r=await fetch(`/api/seed/plan${n?`?${n}`:``}`);if(!r.ok)return{ok:!1,error:await gx(r)};let i=await r.json().catch(()=>null);return i?.plan?{ok:!0,plan:i.plan}:{ok:!1,error:{kind:`internal`,message:Hc._({id:`5YWCV_`})}}},apply:async(e,t)=>{let n=await fetch(`/api/seed/apply`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({plan:e,packId:t?.packId})});if(!n.ok)return{ok:!1,error:await gx(n)};let r=await n.json().catch(()=>null);return r?.result?(Kc(),{ok:!0,result:r.result}):{ok:!1,error:{kind:`internal`,message:Hc._({id:`aXkLuE`})}}},listPacks:async()=>{let e=await fetch(`/api/seed/packs`);if(!e.ok)return{ok:!1,error:{kind:`internal`,message:`HTTP ${e.status}`}};let t=await e.json().catch(()=>null);return!t||!Array.isArray(t.packs)?{ok:!1,error:{kind:`internal`,message:Hc._({id:`q-QUC7`})}}:{ok:!0,packs:t.packs}}}}var vx={"knowledge-base":nb,"software-lifecycle":vu,"codebase-wiki":jy,"plain-notes":Db,worldbuilding:Ly,"writing-pipeline":db,"entity-vault":cb,okf:Hy};function yx(e){return vx[e]??nb}function bx(e){let t=(0,$.c)(69),{onPackSelect:n,onCreateBlankFile:r,collapsedPackIds:i,className:a,packs:o}=e,{_:s}=Bn(),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(!1),m=o===void 0,h,g;t[0]===m?(h=t[1],g=t[2]):(h=()=>{if(!m)return;let e=!1;return(async()=>{try{let t=await _x().listPacks();if(e)return;t.ok?l(t.packs):d(t.error.message)}catch(t){let n=t;if(e)return;d(n instanceof Error?n.message:String(n))}})(),()=>{e=!0}},g=[m],t[0]=m,t[1]=h,t[2]=g),(0,Q.useEffect)(h,g);let _=m?c:o;if(u!==null){let e;t[3]===a?e=t[4]:(e=gr(`rounded-md bg-destructive/10 p-4 text-sm text-destructive`,a),t[3]=a,t[4]=e);let n;t[5]===u?n=t[6]:(n=(0,Z.jsx)(Y,{id:`56WWtu`,values:{error:u}}),t[5]=u,t[6]=n);let r;return t[7]!==e||t[8]!==n?(r=(0,Z.jsx)(`div`,{role:`alert`,className:e,children:n}),t[7]=e,t[8]=n,t[9]=r):r=t[9],r}if(_===null){let e;t[10]===a?e=t[11]:(e=gr(`@container/packgrid w-full max-w-5xl`,a),t[10]=a,t[11]=e);let n;t[12]===s?n=t[13]:(n=s({id:`BeWTQy`}),t[12]=s,t[13]=n);let r;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(`div`,{className:`grid gap-4 @sm/packgrid:grid-cols-2 @2xl/packgrid:grid-cols-3`,children:Array.from({length:Object.keys(vx).length},Sx).map(xx)}),t[14]=r):r=t[14];let i;return t[15]!==e||t[16]!==n||t[17]!==r?(i=(0,Z.jsx)(`div`,{role:`status`,className:e,"aria-busy":`true`,"aria-label":n,children:r}),t[15]=e,t[16]=n,t[17]=r,t[18]=i):i=t[18],i}if(_.length===0){let e;t[19]===a?e=t[20]:(e=gr(`flex w-full max-w-5xl items-center justify-center rounded-2xl border border-dashed border-border/60 bg-muted/20 p-8 text-sm text-muted-foreground`,a),t[19]=a,t[20]=e);let n;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(Y,{id:`zLGXna`}),t[21]=n):n=t[21];let r;return t[22]===e?r=t[23]:(r=(0,Z.jsx)(`div`,{role:`status`,className:e,children:n}),t[22]=e,t[23]=r),r}let v;t[24]===i?v=t[25]:(v=i??[],t[24]=i,t[25]=v);let y;t[26]===v?y=t[27]:(y=new Set(v),t[26]=v,t[27]=y);let b=y,x,S,C,w,T,E,D,O,k;if(t[28]!==a||t[29]!==b||t[30]!==f||t[31]!==r||t[32]!==n||t[33]!==_){let e;t[43]===b?e=t[44]:(e=e=>!b.has(e.id),t[43]=b,t[44]=e);let i=_.filter(e),o;t[45]===b?o=t[46]:(o=e=>b.has(e.id),t[45]=b,t[46]=o),C=_.filter(o),S=C.length>0,w=S||r!=null,t[47]===a?k=t[48]:(k=gr(`@container/packgrid w-full max-w-5xl`,a),t[47]=a,t[48]=k),x=Kr,T=f,E=p;let s;t[49]===n?s=t[50]:(s=e=>(0,Z.jsx)(Cx,{pack:e,onSelect:()=>n(e.id)},e.id),t[49]=n,t[50]=s);let c=i.map(s);t[51]===c?D=t[52]:(D=(0,Z.jsx)(`div`,{className:`grid gap-4 @sm/packgrid:grid-cols-2 @2xl/packgrid:grid-cols-3`,children:c}),t[51]=c,t[52]=D),O=S?(0,Z.jsx)(Wr,{className:`-mx-1 -mb-1 overflow-hidden px-1 pb-1 data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,children:(0,Z.jsx)(`div`,{className:gr(`grid gap-4 @sm/packgrid:grid-cols-2 @2xl/packgrid:grid-cols-3`,`pt-4`),children:C.map(e=>(0,Z.jsx)(Cx,{pack:e,onSelect:()=>n(e.id)},e.id))})}):null,t[28]=a,t[29]=b,t[30]=f,t[31]=r,t[32]=n,t[33]=_,t[34]=x,t[35]=S,t[36]=C,t[37]=w,t[38]=T,t[39]=E,t[40]=D,t[41]=O,t[42]=k}else x=t[34],S=t[35],C=t[36],w=t[37],T=t[38],E=t[39],D=t[40],O=t[41],k=t[42];let A;t[53]!==f||t[54]!==S||t[55]!==C||t[56]!==r||t[57]!==w?(A=w?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-2`,children:[S?(0,Z.jsx)(Gr,{asChild:!0,children:(0,Z.jsxs)(X,{type:`button`,variant:`link-muted`,size:`sm`,children:[f?(0,Z.jsx)(Y,{id:`6lGV3K`}):(0,Z.jsx)(Y,{id:`ymWJLd`,values:{0:C.length}}),(0,Z.jsx)(Gu,{"aria-hidden":`true`,className:gr(`size-3.5 transition-transform`,f&&`rotate-180`)})]})}):(0,Z.jsx)(`span`,{}),r?(0,Z.jsx)(X,{type:`button`,variant:`link-muted`,size:`sm`,onClick:r,children:(0,Z.jsx)(Y,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(Du,{"aria-hidden":`true`,className:`size-3.5`})}})}):null]}):null,t[53]=f,t[54]=S,t[55]=C,t[56]=r,t[57]=w,t[58]=A):A=t[58];let j;t[59]!==x||t[60]!==A||t[61]!==T||t[62]!==E||t[63]!==D||t[64]!==O?(j=(0,Z.jsxs)(x,{open:T,onOpenChange:E,children:[D,O,A]}),t[59]=x,t[60]=A,t[61]=T,t[62]=E,t[63]=D,t[64]=O,t[65]=j):j=t[65];let M;return t[66]!==j||t[67]!==k?(M=(0,Z.jsx)(`div`,{className:k,children:j}),t[66]=j,t[67]=k,t[68]=M):M=t[68],M}function xx(e){return(0,Z.jsx)(Tx,{},`skeleton-${e}`)}function Sx(e,t){return t}function Cx(e){let t=(0,$.c)(27),{pack:n,onSelect:r}=e,i;t[0]===n.id?i=t[1]:(i=yx(n.id),t[0]=n.id,t[1]=i);let a=i,o;t[2]===a?o=t[3]:(o=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`mt-0.5 shrink-0 text-muted-foreground`,children:(0,Z.jsx)(a,{className:`size-3.5`})}),t[2]=a,t[3]=o);let s;t[4]===n.name?s=t[5]:(s=(0,Z.jsx)(`h3`,{className:`min-w-0 wrap-break-word text-sm font-medium leading-tight`,children:n.name}),t[4]=n.name,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-row items-start gap-2`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;t[9]===n.description?l=t[10]:(l=(0,Z.jsx)(`p`,{className:`line-clamp-2 text-1sm leading-relaxed text-muted-foreground`,children:n.description}),t[9]=n.description,t[10]=l);let u;t[11]!==c||t[12]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col gap-2`,children:[c,l]}),t[11]=c,t[12]=l,t[13]=u):u=t[13];let d;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`span`,{"data-slot":`pack-card-reveal`,className:`pointer-events-none absolute inset-0 flex items-center justify-center gap-1.5 rounded-[inherit] bg-card/85 text-sm font-medium text-muted-foreground opacity-0 transition-opacity duration-200 ease-out-strong group-hover:opacity-100 group-focus-visible:opacity-100 supports-backdrop-filter:bg-card/35 supports-backdrop-filter:backdrop-blur-md reduced-transparency:bg-card`,children:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 motion-safe:translate-y-1 motion-safe:transition-[translate] motion-safe:duration-200 motion-safe:ease-out-strong motion-safe:group-hover:translate-y-0 motion-safe:group-focus-visible:translate-y-0`,children:[(0,Z.jsx)(Y,{id:`UIjjFa`}),(0,Z.jsx)(Du,{"aria-hidden":`true`,className:`size-3.5`})]})}),t[14]=d):d=t[14];let f;t[15]!==r||t[16]!==u?(f=(0,Z.jsxs)(`button`,{type:`button`,onClick:r,"data-slot":`pack-card`,className:`group relative flex h-full min-w-0 flex-col items-start overflow-hidden rounded-2xl border border-border/60 bg-card p-5 text-left transition-[border-color,box-shadow,transform] hover:border-border hover:shadow-sm focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px`,children:[u,d]}),t[15]=r,t[16]=u,t[17]=f):f=t[17];let p=f;if(n.folders.length===0)return p;let m;t[18]===p?m=t[19]:(m=(0,Z.jsx)(Br,{asChild:!0,children:p}),t[18]=p,t[19]=m);let h;t[20]===n.folders?h=t[21]:(h=n.folders.map(wx),t[20]=n.folders,t[21]=h);let g;t[22]===h?g=t[23]:(g=(0,Z.jsx)(Vr,{className:`flex-col items-start gap-1.5`,children:(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1.5 text-left`,children:h})}),t[22]=h,t[23]=g);let _;return t[24]!==g||t[25]!==m?(_=(0,Z.jsxs)(Ur,{children:[m,g]}),t[24]=g,t[25]=m,t[26]=_):_=t[26],_}function wx(e){return(0,Z.jsxs)(`li`,{className:`flex flex-col`,children:[(0,Z.jsx)(`span`,{className:`font-mono`,children:e.path}),(0,Z.jsx)(`span`,{className:`opacity-75`,children:e.summary})]},e.path)}function Tx(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`span`,{className:`size-10 animate-pulse rounded-lg bg-muted`,"aria-hidden":`true`,children:(0,Z.jsx)(ip,{"aria-hidden":`true`,className:`size-5 text-muted-foreground opacity-0`})}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-[200px] flex-col items-start gap-4 rounded-xl border border-border/60 bg-card p-6`,children:[t,(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,children:[(0,Z.jsx)(`div`,{className:`h-4 w-1/2 animate-pulse rounded bg-muted`}),(0,Z.jsx)(`div`,{className:`h-3 w-full animate-pulse rounded bg-muted`}),(0,Z.jsx)(`div`,{className:`h-3 w-4/5 animate-pulse rounded bg-muted`})]})]}),e[1]=n):n=e[1],n}function Ex(e){let t=(0,$.c)(39),{choice:n,subfolder:r,placeholder:i,idPrefix:a,onChoiceChange:o,onSubfolderChange:s}=e,c=a===void 0?`seed-root`:a,{_:l}=Bn(),u=`${c}-project-root`,d=`${c}-subfolder`,f=`${c}-group-label`,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Y,{id:`3wiBAs`}),t[0]=p):p=t[0];let m;t[1]===f?m=t[2]:(m=(0,Z.jsx)(`p`,{id:f,className:`text-sm font-medium`,children:p}),t[1]=f,t[2]=m);let h;t[3]===o?h=t[4]:(h=e=>o(e),t[3]=o,t[4]=h);let g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(Nh,{children:(0,Z.jsx)(Y,{id:`RSqaSd`})}),t[5]=g):g=t[5];let _;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsxs)(Ah,{children:[g,(0,Z.jsx)(Mh,{className:`text-1sm`,children:(0,Z.jsx)(Y,{id:`ZvzbDF`})})]}),t[6]=_):_=t[6];let v;t[7]===u?v=t[8]:(v=(0,Z.jsxs)(Ph,{orientation:`horizontal`,children:[_,(0,Z.jsx)(Pa,{value:`project-root`,id:u})]}),t[7]=u,t[8]=v);let y;t[9]!==u||t[10]!==v?(y=(0,Z.jsx)(jh,{htmlFor:u,children:v}),t[9]=u,t[10]=v,t[11]=y):y=t[11];let b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Nh,{children:(0,Z.jsx)(Y,{id:`ZWgr0b`})}),t[12]=b):b=t[12];let x;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(Mh,{className:`nth-last-2:mt-0 text-1sm`,children:(0,Z.jsx)(Y,{id:`KQGZuq`})}),t[13]=x):x=t[13];let S;t[14]!==l||t[15]!==n||t[16]!==s||t[17]!==i||t[18]!==r?(S=n===`subfolder`&&(0,Z.jsx)(dh,{value:r,onChange:e=>s(e.target.value),placeholder:i,"aria-label":l({id:`NYUhy5`}),spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,className:`mt-1.5 font-mono text-xs bg-background`}),t[14]=l,t[15]=n,t[16]=s,t[17]=i,t[18]=r,t[19]=S):S=t[19];let C;t[20]===S?C=t[21]:(C=(0,Z.jsxs)(Ah,{children:[b,x,S]}),t[20]=S,t[21]=C);let w;t[22]===d?w=t[23]:(w=(0,Z.jsx)(Pa,{value:`subfolder`,id:d}),t[22]=d,t[23]=w);let T;t[24]!==C||t[25]!==w?(T=(0,Z.jsxs)(Ph,{orientation:`horizontal`,children:[C,w]}),t[24]=C,t[25]=w,t[26]=T):T=t[26];let E;t[27]!==d||t[28]!==T?(E=(0,Z.jsx)(jh,{htmlFor:d,children:T}),t[27]=d,t[28]=T,t[29]=E):E=t[29];let D;t[30]!==n||t[31]!==f||t[32]!==E||t[33]!==h||t[34]!==y?(D=(0,Z.jsxs)(Fa,{"aria-labelledby":f,className:`sm:flex`,value:n,onValueChange:h,children:[y,E]}),t[30]=n,t[31]=f,t[32]=E,t[33]=h,t[34]=y,t[35]=D):D=t[35];let O;return t[36]!==D||t[37]!==m?(O=(0,Z.jsxs)(`div`,{className:`space-y-2 py-1`,children:[m,D]}),t[36]=D,t[37]=m,t[38]=O):O=t[38],O}var Dx={"knowledge-base":{id:`gvApb7`},"software-lifecycle":{id:`hCOLSd`},"codebase-wiki":{id:`Fy4GgU`},"plain-notes":{id:`Qw-7Ie`},okf:{id:`_ayOfA`},"writing-pipeline":{id:`Zf0w-R`},"entity-vault":{id:`hmYd9H`},worldbuilding:{id:`VBE2dw`}},Ox=180,kx=5e3,Ax=200;function jx(e,t){if(e===`review`){t.reviewContinueRef.current?.focus();return}if(e===`configure`){t.nameInputRef.current?.focus();return}t.packGridRef.current?.querySelector(`[data-slot="pack-card"]`)?.focus()}function Mx(e,t){if(e===``||t===``)return``;let n=e.includes(`\\`)&&!e.includes(`/`)?`\\`:`/`;return`${e.replace(/[/\\]+$/,``)}${n}${t}`}function Nx(e){if(e===``)return``;let t=e.split(/[/\\]/).filter(Boolean);return t.length>0?t[t.length-1]??e:e}function Px(e){let{parent:t,sanitizedName:n,enclosingProject:r,enclosingGit:i,targetState:a}=e;return t===``||n===``?{kind:`idle`}:r===null?i===null?a===`exists-nonempty`?{kind:`block-nonempty`}:{kind:`free`}:{kind:`confirm-git`,gitRoot:i.gitRoot}:{kind:`block-nested`,rootPath:r.rootPath}}function Fx(e){let t=e instanceof Error?e.message:String(e);for(let e of _c)if(t.startsWith(`${e}:`)||t.includes(`${e}: `))return e===`nested-project`||e===`target-not-empty`?{reason:e}:{reason:e,message:t};return{reason:`unknown`,message:t}}function Ix(e){switch(e.reason){case`nested-project`:return{id:`ScwcF2`};case`target-not-empty`:return{id:`e8L17t`};case`invalid-args`:return{id:`6bTTAN`};case`mkdir-failed`:return{id:`gJR87V`};case`git-init-failed`:return{id:`4CfgPM`};case`init-failed`:return{id:`l17ab4`};case`discovery-failed`:return{id:`ThmUrC`};case`unknown`:return{id:`AddR83`}}}function Lx(e){let t=(0,$.c)(205),{open:n,onOpenChange:r,bridge:i,initialPackId:a,packs:o}=e,{_:s}=Bn(),c=(0,Q.useId)(),l=(0,Q.useId)(),u=(0,Q.useId)(),d=(0,Q.useId)(),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(!0),[S,C]=(0,Q.useState)(Ch),[w,T]=(0,Q.useState)(a),[E,D]=(0,Q.useState)(`configure`),[O,k]=(0,Q.useState)(`project-root`),[A,j]=(0,Q.useState)(``),M;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(M={kind:`loading`},t[0]=M):M=t[0];let[N,P]=(0,Q.useState)(M),F=(o?.length??0)>0,I;t[1]!==a||t[2]!==o?(I=a!==void 0&&(o?.some(e=>e.id===a)??!1),t[1]=a,t[2]=o,t[3]=I):I=t[3];let L=I,R=E!==`pick`,z=N.kind===`plan`?N.plan.packSkills?.length??0:0,B;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(B={kind:`idle`},t[4]=B):B=t[4];let[V,ee]=(0,Q.useState)(B),[H,U]=(0,Q.useState)(`idle`),[W,G]=(0,Q.useState)(!1),[te,ne]=(0,Q.useState)(null),re;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(re={kind:`idle`},t[5]=re):re=t[5];let[K,ie]=(0,Q.useState)(re),[q,ae]=(0,Q.useState)(0),oe;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(oe=new Set,t[6]=oe):oe=t[6];let se=(0,Q.useRef)(oe),ce=(0,Q.useRef)(null),le=(0,Q.useRef)(null),ue=(0,Q.useRef)(null),de=(0,Q.useRef)(null),fe=(0,Q.useRef)(null),pe;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(pe=e=>{D(e),requestAnimationFrame(()=>jx(e,{reviewContinueRef:de,nameInputRef:ue,packGridRef:fe}))},t[7]=pe):pe=t[7];let J=pe,me=(0,Q.useRef)(0),he=(0,Q.useRef)(!0),ge,_e;t[8]!==i||t[9]!==F||t[10]!==a||t[11]!==L||t[12]!==n?(ge=()=>{if(!n)return;se.current.clear(),ne(null),ee({kind:`idle`}),U(`idle`),G(!1),_(``),y(null),x(!0),C(Ch),ie({kind:`idle`}),T(a);let e=L?`review`:F?`pick`:`configure`;D(e),k(`project-root`),P({kind:`loading`}),he.current=!0,me.current+=1;let t=!1;i.integrations.status().then(e=>{if(t)return;let n=new Set(e.editors.filter(Kx).map(Gx));y(e.detectedEditorIds.filter(e=>cs(e,{userMcpEntryInstalled:n.has(e)})))}).catch(e=>{console.warn(`[CreateProjectDialog] editor-detection probe failed:`,e),t||y([])}),p(``),h(!0),i.fs.defaultProjectsRoot().then(e=>{t||p(e)}).catch(Wx).finally(()=>{t||h(!1)});let r=requestAnimationFrame(()=>jx(e,{reviewContinueRef:de,nameInputRef:ue,packGridRef:fe}));return()=>{t=!0,cancelAnimationFrame(r)}},_e=[n,i,a,F,L],t[8]=i,t[9]=F,t[10]=a,t[11]=L,t[12]=n,t[13]=ge,t[14]=_e):(ge=t[13],_e=t[14]),(0,Q.useEffect)(ge,_e);let ve;t[15]!==w||t[16]!==o?(ve=o?.find(e=>e.id===w),t[15]=w,t[16]=o,t[17]=ve):ve=t[17];let ye=ve,be=ye?.defaultSubfolder??``,xe;t[18]!==w||t[19]!==be?(xe=()=>{w!==void 0&&j(be)},t[18]=w,t[19]=be,t[20]=xe):xe=t[20];let Se;t[21]!==n||t[22]!==w||t[23]!==be?(Se=[n,w,be],t[21]=n,t[22]=w,t[23]=be,t[24]=Se):Se=t[24],(0,Q.useEffect)(xe,Se);let Ce;t[25]===A?Ce=t[26]:(Ce=A.trim(),t[25]=A,t[26]=Ce);let we=Ce,Te=ye!==void 0&&O===`subfolder`&&we===``,Ee=O===`project-root`?void 0:we,De=b&&(v?.length??0)>0,Oe,ke;t[27]!==s||t[28]!==n||t[29]!==R||t[30]!==Ee||t[31]!==ye||t[32]!==De||t[33]!==Te?(Oe=()=>{if(!n||ye===void 0||!R)return;if(Te){P({kind:`error`,message:s({id:`Z8KDox`}),blocking:!0});return}let e=he.current?0:Ax;he.current=!1;let t=!1,r=setTimeout(()=>{t||(P(Ux),_x().plan({rootDir:Ee,packId:ye.id,preview:{skillsInstallable:De}}).then(e=>{if(t)return;if(e.ok){P({kind:`plan`,plan:e.plan});return}let n=e.error.kind===`invalid-root`;n||console.warn(`[CreateProjectDialog] pack preview unavailable:`,e.error),P({kind:`error`,message:n?e.error.message:s({id:`7vxWET`}),blocking:n})}).catch(e=>{t||(console.warn(`[CreateProjectDialog] pack preview plan failed:`,e),P({kind:`error`,message:s({id:`7vxWET`}),blocking:!1}))}))},e);return()=>{t=!0,clearTimeout(r)}},ke=[n,R,ye,Ee,Te,De,s],t[27]=s,t[28]=n,t[29]=R,t[30]=Ee,t[31]=ye,t[32]=De,t[33]=Te,t[34]=Oe,t[35]=ke):(Oe=t[34],ke=t[35]),(0,Q.useEffect)(Oe,ke);let Ae;t[36]!==i||t[37]!==f||t[38]!==g||t[39]!==n?(Ae=()=>{if(!n)return;le.current!==null&&clearTimeout(le.current),ce.current!==null&&ce.current.abort();let e=Bo(g);if(f===``||e===``){ee({kind:`idle`}),U(`idle`);return}let t=f,r=Mx(t,e),a=new AbortController;return ce.current=a,le.current=setTimeout(()=>{U(`in-flight`),Promise.all([i.fs.findEnclosingProjectRoot(t),i.fs.findEnclosingGitRoot(t),i.fs.folderState(r)]).then(n=>{let[r,i,o]=n;a.signal.aborted||(U(`idle`),ee(Px({parent:t,sanitizedName:e,enclosingProject:r,enclosingGit:i,targetState:o})))}).catch(e=>{a.signal.aborted||(console.warn(`[CreateProjectDialog] cascade probe failed:`,e),U(`idle`),ee({kind:`free`}))})},Ox),()=>{le.current!==null&&clearTimeout(le.current),a.abort()}},t[36]=i,t[37]=f,t[38]=g,t[39]=n,t[40]=Ae):Ae=t[40];let je;t[41]!==i||t[42]!==f||t[43]!==g||t[44]!==n||t[45]!==q?(je=[n,f,g,i,q],t[41]=i,t[42]=f,t[43]=g,t[44]=n,t[45]=q,t[46]=je):je=t[46],(0,Q.useEffect)(Ae,je);let Me,Ne;t[47]===n?(Me=t[48],Ne=t[49]):(Me=()=>{if(!n)return;let e=()=>ae(Hx);return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},Ne=[n],t[47]=n,t[48]=Me,t[49]=Ne),(0,Q.useEffect)(Me,Ne);let Pe=(0,Q.useRef)(`idle`),Fe,Ie;t[50]===H?(Fe=t[51],Ie=t[52]):(Fe=()=>{Pe.current=H},Ie=[H],t[50]=H,t[51]=Fe,t[52]=Ie),(0,Q.useEffect)(Fe,Ie);let Le,Re;t[53]!==V.kind||t[54]!==n?(Le=()=>{if(!n||V.kind!==`confirm-git`)return;let e=setInterval(()=>{Pe.current!==`in-flight`&&ae(Vx)},kx);return()=>clearInterval(e)},Re=[n,V.kind],t[53]=V.kind,t[54]=n,t[55]=Le,t[56]=Re):(Le=t[55],Re=t[56]),(0,Q.useEffect)(Le,Re);let ze;t[57]!==V.gitRoot||t[58]!==V.kind||t[59]!==K.gitRoot||t[60]!==K.kind?(ze=()=>{if(V.kind!==`confirm-git`){K.kind!==`idle`&&(me.current+=1,ie({kind:`idle`}));return}K.kind===`confirming`&&K.gitRoot!==V.gitRoot&&ie({kind:`idle`}),K.kind===`pending`&&K.gitRoot!==V.gitRoot&&(me.current+=1,ie({kind:`idle`}))},t[57]=V.gitRoot,t[58]=V.kind,t[59]=K.gitRoot,t[60]=K.kind,t[61]=ze):ze=t[61];let Be;t[62]!==V||t[63]!==K?(Be=[V,K],t[62]=V,t[63]=K,t[64]=Be):Be=t[64],(0,Q.useEffect)(ze,Be);let Ve;t[65]!==i||t[66]!==V.kind||t[67]!==n?(Ve=()=>{if(!n)return;let e=null;V.kind===`block-nested`?e=`nested`:V.kind===`block-nonempty`?e=`nonempty`:V.kind===`confirm-git`&&(e=`git-confirm`),e!==null&&(se.current.has(e)||(se.current.add(e),i.project.recordCreateNewBannerShown(e).catch(Bx)))},t[65]=i,t[66]=V.kind,t[67]=n,t[68]=Ve):Ve=t[68];let He;t[69]!==i||t[70]!==V||t[71]!==n?(He=[n,V,i],t[69]=i,t[70]=V,t[71]=n,t[72]=He):He=t[72],(0,Q.useEffect)(Ve,He);let Ue=g,We,Ge,Ke,qe,Je;t[73]!==V.kind||t[74]!==f||t[75]!==Ue?(qe=Ue===``?``:Bo(Ue),Ge=Ue!==``&&qe!==Ue&&qe!==``,Ke=Ue!==``&&qe===``,We=V.kind===`block-nonempty`,Je=f!==``&&qe!==``?Mx(f,qe):``,t[73]=V.kind,t[74]=f,t[75]=Ue,t[76]=We,t[77]=Ge,t[78]=Ke,t[79]=qe,t[80]=Je):(We=t[76],Ge=t[77],Ke=t[78],qe=t[79],Je=t[80]);let Ye=Je,Xe=!W&&f!==``&&Ue!==``&&qe!==``&&!Te&&(ye===void 0||N.kind!==`error`||!N.blocking)&&H===`idle`&&(V.kind===`free`||V.kind===`confirm-git`),Ze=W||b&&v===null||Ue!==``&&!Xe,Qe;t[81]!==i||t[82]!==f?(Qe=async function(){try{let e=await i.dialog.openFolder(f===``?void 0:{defaultPath:f});if(e===null)return;p(e),ae(zx),ne(null)}catch(e){console.warn(`[CreateProjectDialog] dialog.openFolder failed:`,e)}},t[81]=i,t[82]=f,t[83]=Qe):Qe=t[83];let $e=Qe,et;t[84]!==s||t[85]!==i||t[86]!==W||t[87]!==Xe||t[88]!==b||t[89]!==v||t[90]!==f||t[91]!==r||t[92]!==w||t[93]!==Ee||t[94]!==Ue||t[95]!==qe||t[96]!==S?(et=async function(e){if(e.preventDefault(),!W){if(Ue.trim()===``){Dc.error(s({id:`5OqaJi`})),ue.current?.focus();return}if(Xe){G(!0),ne(null);try{await i.project.createNew({parent:f,name:qe,editors:b?[...v??[]]:[],sharing:S,packId:w,rootDir:Ee}),r(!1)}catch(e){ne(Fx(e)),G(!1)}}}},t[84]=s,t[85]=i,t[86]=W,t[87]=Xe,t[88]=b,t[89]=v,t[90]=f,t[91]=r,t[92]=w,t[93]=Ee,t[94]=Ue,t[95]=qe,t[96]=S,t[97]=et):et=t[97];let tt=et,nt;t[98]!==W||t[99]!==r?(nt=function(e){W||r(e)},t[98]=W,t[99]=r,t[100]=nt):nt=t[100];let rt=nt,it;t[101]===Symbol.for(`react.memo_cache_sentinel`)?(it=async function(e){ie({kind:`confirming`,gitRoot:e})},t[101]=it):it=t[101];let at=it,ot;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(ot=async function(){ie({kind:`idle`})},t[102]=ot):ot=t[102];let st=ot,ct;t[103]===i?ct=t[104]:(ct=async function(e){let t=me.current+1;me.current=t,ie({kind:`pending`,gitRoot:e});try{if(await i.fs.removeGitFolder(e),me.current!==t)return;ae(Rx),ie({kind:`idle`})}catch(e){let n=e;if(me.current!==t)return;let r=n instanceof Error?n.message:String(n);console.error(`[CreateProjectDialog] bridge.fs.removeGitFolder failed:`,n),ie({kind:`error`,message:r})}},t[103]=i,t[104]=ct);let lt=ct,ut;t[105]!==i||t[106]!==r?(ut=async function(e){r(!1);try{await i.project.open({path:e,target:`new-window`,entryPoint:`create-new-nested-redirect`})}catch(e){console.warn(`[CreateProjectDialog] project.open failed:`,e)}},t[105]=i,t[106]=r,t[107]=ut):ut=t[107];let dt=ut,ft=Ke||We||Ge?`${u} ${d}`:u,pt=w!==void 0&&F,mt=ye?.name,ht=ye?Dx[ye.id]:void 0,gt;t[108]!==s||t[109]!==E?(gt=s(E===`pick`?{id:`tcjTlU`}:E===`review`?{id:`CPMLsP`}:{id:`tjbyOy`}),t[108]=s,t[109]=E,t[110]=gt):gt=t[110];let _t=gt,vt;t[111]!==s||t[112]!==mt?(vt=s(mt===void 0?{id:`wbv9xO`}:{id:`MPpSAg`,values:{selectedPackName:mt}}),t[111]=s,t[112]=mt,t[113]=vt):vt=t[113];let yt=vt,bt;t[114]!==s||t[115]!==ye||t[116]!==ht?(bt=ye===void 0?s({id:`O6yEPk`}):ht?s(ht):ye.description,t[114]=s,t[115]=ye,t[116]=ht,t[117]=bt):bt=t[117];let xt=bt,St=E===`pick`&&`sm:max-w-3xl`,Ct;t[118]===St?Ct=t[119]:(Ct=gr(`sm:max-w-lg`,St),t[118]=St,t[119]=Ct);let wt;t[120]===_t?wt=t[121]:(wt=(0,Z.jsx)(`span`,{"aria-live":`polite`,className:`sr-only`,"data-testid":`create-step-announcer`,children:_t}),t[120]=_t,t[121]=wt);let Tt;t[122]!==s||t[123]!==E||t[124]!==yt?(Tt=E===`pick`?s({id:`tcjTlU`}):yt,t[122]=s,t[123]=E,t[124]=yt,t[125]=Tt):Tt=t[125];let Et;t[126]===Tt?Et=t[127]:(Et=(0,Z.jsx)(Jr,{children:Tt}),t[126]=Tt,t[127]=Et);let Dt;t[128]!==s||t[129]!==xt||t[130]!==E?(Dt=E===`pick`?s({id:`b6Fgpe`}):E===`review`?s({id:`Z67Zlj`}):xt,t[128]=s,t[129]=xt,t[130]=E,t[131]=Dt):Dt=t[131];let Ot;t[132]===Dt?Ot=t[133]:(Ot=(0,Z.jsx)(qr,{children:Dt}),t[132]=Dt,t[133]=Ot);let kt;t[134]!==Et||t[135]!==Ot?(kt=(0,Z.jsxs)($r,{children:[Et,Ot]}),t[134]=Et,t[135]=Ot,t[136]=kt):kt=t[136];let At;t[137]!==s||t[138]!==W||t[139]!==u||t[140]!==V||t[141]!==b||t[142]!==v||t[143]!==c||t[144]!==f||t[145]!==m||t[146]!==g||t[147]!==ft||t[148]!==d||t[149]!==l||t[150]!==We||t[151]!==$e||t[152]!==lt||t[153]!==dt||t[154]!==tt||t[155]!==w||t[156]!==N.blocking||t[157]!==N.kind||t[158]!==N.message||t[159]!==N.plan||t[160]!==z||t[161]!==o||t[162]!==K||t[163]!==O||t[164]!==Ge||t[165]!==Ke||t[166]!==qe||t[167]!==ye||t[168]!==S||t[169]!==De||t[170]!==E||t[171]!==A||t[172]!==te||t[173]!==Ye?(At=E===`pick`?(0,Z.jsx)(Xr,{ref:fe,children:(0,Z.jsx)(bx,{packs:o??null,onPackSelect:e=>{T(e),e!==w&&k(`project-root`),he.current=!0,P({kind:`loading`}),J(`review`)}})}):E===`review`?ye===void 0?null:(0,Z.jsx)(Xr,{"data-testid":`create-review-body`,children:N.kind===`error`?(0,Z.jsx)(`div`,{role:`alert`,className:`rounded-md bg-destructive/10 p-3 text-sm text-destructive`,"data-testid":`create-pack-preview-error`,children:N.message}):N.kind===`plan`?(0,Z.jsx)(ox,{plan:N.plan,selectedPack:ye}):(0,Z.jsx)(tx,{rowCount:ye.folders.length})}):(0,Z.jsx)(Xr,{className:`space-y-6`,children:(0,Z.jsxs)(`form`,{id:c,onSubmit:tt,"data-testid":`create-project-form`,className:`space-y-6`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(ba,{htmlFor:l,children:(0,Z.jsx)(Y,{id:`OyIC0Q`})}),(0,Z.jsx)(dh,{id:l,ref:ue,value:g,placeholder:s({id:`cV7LOw`}),onChange:e=>_(e.target.value),disabled:W,autoComplete:`off`,"aria-invalid":Ke||We,"aria-describedby":ft,"data-testid":`create-name`}),Ke?(0,Z.jsx)(`p`,{id:d,role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-name-error-erased`,children:(0,Z.jsx)(Y,{id:`_PBJRl`})}):We?(0,Z.jsx)(`p`,{id:d,role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-name-error-taken`,children:(0,Z.jsx)(Y,{id:`7apDiJ`,values:{sanitized:qe},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):Ge?(0,Z.jsx)(`p`,{id:d,role:`status`,"aria-live":`polite`,className:`text-1sm text-muted-foreground`,"data-testid":`create-name-hint-diverged`,children:(0,Z.jsx)(Y,{id:`KnoB--`,values:{sanitized:qe},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):null]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(ba,{children:(0,Z.jsx)(Y,{id:`wJijgU`})}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`div`,{className:`min-w-0 flex-1 rounded-md border border-input bg-muted/50 px-2.5 py-1 text-sm text-foreground wrap-break-word`,"data-testid":`create-location-display`,children:f===``?m?(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`iHAJDj`})}):(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`8m8diM`})}):f}),(0,Z.jsx)(X,{type:`button`,variant:`outline`,className:`shrink-0`,disabled:W,onClick:()=>void $e(),"data-testid":`create-browse`,children:(0,Z.jsx)(Y,{id:`O2UpM1`})})]}),(0,Z.jsx)(`p`,{id:u,className:`text-1sm text-muted-foreground wrap-break-word`,"aria-live":`polite`,"data-testid":`create-target-caption`,children:Ye===``?null:(0,Z.jsx)(Y,{id:`k_yIIc`,values:{targetPreview:Ye},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})})]}),(0,Z.jsx)(qx,{cascade:V,onOpenNested:dt,removeGitState:K,onRequestRemoveGit:at,onCancelRemoveGit:st,onConfirmRemoveGit:lt}),ye?(0,Z.jsxs)(`div`,{className:`space-y-6`,"data-testid":`create-pack-section`,children:[(0,Z.jsx)(Ex,{choice:O,subfolder:A,placeholder:ye.defaultSubfolder??`subfolder`,idPrefix:`create-seed-root`,onChoiceChange:k,onSubfolderChange:j}),V.kind===`confirm-git`?(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`create-pack-promoted-note`,children:(0,Z.jsx)(Y,{id:`-ksoxk`,values:{sanitized:qe},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):null,N.kind===`error`&&N.blocking?(0,Z.jsx)(`div`,{role:`alert`,className:`rounded-md bg-destructive/10 p-3 text-sm text-destructive`,"data-testid":`create-pack-preview-error`,children:N.message}):null]}):null,(0,Z.jsx)(Oh,{detectedEditors:v,checked:b,onCheckedChange:x,disabled:W,testIdPrefix:`create-editors`,itemTestIdPrefix:`create-editor`}),z>0?(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`create-pack-skills-note`,children:De?(0,Z.jsx)(Y,{id:`VPwWZu`,values:{packSkillCount:z}}):(0,Z.jsx)(Y,{id:`vUP_HF`,values:{packSkillCount:z}})}):null,(0,Z.jsx)(Eh,{idPrefix:`create`,testIdPrefix:`create-sharing`,value:S,onValueChange:C,disabled:W}),te===null?null:(0,Z.jsx)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,"data-testid":`create-submit-error`,children:s(Ix(te))})]})}),t[137]=s,t[138]=W,t[139]=u,t[140]=V,t[141]=b,t[142]=v,t[143]=c,t[144]=f,t[145]=m,t[146]=g,t[147]=ft,t[148]=d,t[149]=l,t[150]=We,t[151]=$e,t[152]=lt,t[153]=dt,t[154]=tt,t[155]=w,t[156]=N.blocking,t[157]=N.kind,t[158]=N.message,t[159]=N.plan,t[160]=z,t[161]=o,t[162]=K,t[163]=O,t[164]=Ge,t[165]=Ke,t[166]=qe,t[167]=ye,t[168]=S,t[169]=De,t[170]=E,t[171]=A,t[172]=te,t[173]=Ye,t[174]=At):At=t[174];let jt;t[175]!==W||t[176]!==pt||t[177]!==E?(jt=(E===`configure`||E===`review`)&&pt?(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,className:`me-auto font-mono uppercase`,onClick:()=>J(`pick`),disabled:W,"data-testid":`create-change-pack`,children:[(0,Z.jsx)(Au,{"aria-hidden":`true`,className:`h-4 w-4`}),(0,Z.jsx)(Y,{id:`uLVNZL`})]}):null,t[175]=W,t[176]=pt,t[177]=E,t[178]=jt):jt=t[178];let Mt;t[179]!==W||t[180]!==r||t[181]!==E?(Mt=E===`review`?null:(0,Z.jsx)(X,{type:`button`,variant:`outline`,className:`font-mono uppercase`,onClick:()=>r(!1),disabled:W,"data-testid":`create-cancel`,children:(0,Z.jsx)(Y,{id:`dEgA5A`})}),t[179]=W,t[180]=r,t[181]=E,t[182]=Mt):Mt=t[182];let Nt;t[183]===E?Nt=t[184]:(Nt=E===`review`?(0,Z.jsx)(X,{type:`button`,ref:de,onClick:()=>J(`configure`),"data-testid":`create-review-continue`,children:(0,Z.jsx)(Y,{id:`m-1Z7o`})}):null,t[183]=E,t[184]=Nt);let Pt;t[185]!==W||t[186]!==c||t[187]!==E||t[188]!==Ze?(Pt=E===`configure`?(0,Z.jsx)(X,{type:`submit`,form:c,disabled:Ze,"data-testid":`create-submit`,children:W?(0,Z.jsx)(Y,{id:`E9bKSA`}):(0,Z.jsx)(Y,{id:`hYgDIe`})}):null,t[185]=W,t[186]=c,t[187]=E,t[188]=Ze,t[189]=Pt):Pt=t[189];let Ft;t[190]!==jt||t[191]!==Mt||t[192]!==Nt||t[193]!==Pt?(Ft=(0,Z.jsxs)(Zr,{children:[jt,Mt,Nt,Pt]}),t[190]=jt,t[191]=Mt,t[192]=Nt,t[193]=Pt,t[194]=Ft):Ft=t[194];let It;t[195]!==Ct||t[196]!==wt||t[197]!==kt||t[198]!==At||t[199]!==Ft?(It=(0,Z.jsxs)(Yr,{className:Ct,"data-testid":`create-project-dialog`,children:[wt,kt,At,Ft]}),t[195]=Ct,t[196]=wt,t[197]=kt,t[198]=At,t[199]=Ft,t[200]=It):It=t[200];let Lt;return t[201]!==rt||t[202]!==n||t[203]!==It?(Lt=(0,Z.jsx)(ei,{open:n,onOpenChange:rt,children:It}),t[201]=rt,t[202]=n,t[203]=It,t[204]=Lt):Lt=t[204],Lt}function Rx(e){return e+1}function zx(e){return e+1}function Bx(){}function Vx(e){return e+1}function Hx(e){return e+1}function Ux(e){return e.kind===`plan`?e:{kind:`loading`}}function Wx(e){console.warn(`[CreateProjectDialog] defaultProjectsRoot probe failed:`,e)}function Gx(e){return e.id}function Kx(e){return e.state===`installed`}function qx(e){let t=(0,$.c)(37),{cascade:n,onOpenNested:r,removeGitState:i,onRequestRemoveGit:a,onCancelRemoveGit:o,onConfirmRemoveGit:s}=e;if(n.kind===`idle`||n.kind===`free`||n.kind===`block-nonempty`)return null;if(n.kind===`block-nested`){let{rootPath:e}=n,i;t[0]===e?i=t[1]:(i=Nx(e),t[0]=e,t[1]=i);let a=i,o;t[2]===e?o=t[3]:(o={rootPath:e},t[2]=e,t[3]=o);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})},t[4]=s):s=t[4];let c;t[5]===o?c=t[6]:(c=(0,Z.jsx)(`p`,{className:`mb-2`,children:(0,Z.jsx)(Y,{id:`W7XJN4`,values:o,components:s})}),t[5]=o,t[6]=c);let l;t[7]!==r||t[8]!==e?(l=()=>r(e),t[7]=r,t[8]=e,t[9]=l):l=t[9];let u;t[10]===a?u=t[11]:(u=(0,Z.jsx)(Y,{id:`1Ta7Fd`,values:{basename:a}}),t[10]=a,t[11]=u);let d;t[12]!==l||t[13]!==u?(d=(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:l,"data-testid":`create-banner-nested-open`,children:u}),t[12]=l,t[13]=u,t[14]=d):d=t[14];let f;return t[15]!==c||t[16]!==d?(f=(0,Z.jsxs)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,"data-testid":`create-banner-nested`,children:[c,d]}),t[15]=c,t[16]=d,t[17]=f):f=t[17],f}if(n.kind===`confirm-git`){let{gitRoot:e}=n,r;if(t[18]!==e){let n;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(n=/\/+$/,t[20]=n):n=t[20],r=e.replace(n,``),t[18]=e,t[19]=r}else r=t[19];let c=`${r}/.git`,l=i.kind===`error`?i.message:null,u;t[21]===e?u=t[22]:(u={gitRoot:e},t[21]=e,t[22]=u);let d;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(d={0:(0,Z.jsx)(`code`,{}),1:(0,Z.jsx)(`code`,{})},t[23]=d):d=t[23];let f;t[24]===u?f=t[25]:(f=(0,Z.jsx)(`p`,{children:(0,Z.jsx)(Y,{id:`FEK4oC`,values:u,components:d})}),t[24]=u,t[25]=f);let p;t[26]!==e||t[27]!==o||t[28]!==s||t[29]!==a||t[30]!==l||t[31]!==i.kind||t[32]!==c?(p=i.kind===`idle`||i.kind===`error`?(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-col gap-1`,children:[(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>a(e),"data-testid":`create-banner-git-remove`,children:(0,Z.jsx)(Y,{id:`YTLmTM`,components:{0:(0,Z.jsx)(`code`,{})}})}),i.kind===`error`?(0,Z.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,"data-testid":`create-banner-git-remove-error`,children:(0,Z.jsx)(Y,{id:`SkMZlS`,values:{targetGitPath:c,removeGitError:l},components:{0:(0,Z.jsx)(`code`,{})}})}):null]}):(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-col gap-2 rounded border border-blue-400/60 bg-white/40 p-2 dark:border-blue-600/60 dark:bg-black/20`,"data-testid":`create-banner-git-remove-confirm`,children:[(0,Z.jsx)(`p`,{className:`text-xs`,children:(0,Z.jsx)(Y,{id:`WZ-vBy`,values:{targetGitPath:c},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsx)(X,{type:`button`,variant:`destructive`,size:`sm`,disabled:i.kind===`pending`,onClick:()=>s(e),"data-testid":`create-banner-git-remove-confirm-button`,children:i.kind===`pending`?(0,Z.jsx)(Y,{id:`0-31GV`}):(0,Z.jsx)(Y,{id:`v-h2hx`,values:{targetGitPath:c}})}),(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`sm`,disabled:i.kind===`pending`,onClick:o,"data-testid":`create-banner-git-remove-cancel`,children:(0,Z.jsx)(Y,{id:`dEgA5A`})})]})]}),t[26]=e,t[27]=o,t[28]=s,t[29]=a,t[30]=l,t[31]=i.kind,t[32]=c,t[33]=p):p=t[33];let m;return t[34]!==f||t[35]!==p?(m=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`rounded-md border border-blue-300 bg-blue-50 px-3 py-2 text-sm text-blue-900 dark:border-blue-700 dark:bg-blue-950 dark:text-blue-200`,"data-testid":`create-banner-git-confirm`,children:[f,p]}),t[34]=f,t[35]=p,t[36]=m):m=t[36],m}return null}function Jx(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`GitHub`}),r=(0,Z.jsx)(`path`,{d:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}async function Yx(e,t){let n=typeof window<`u`?window.okDesktop:void 0;if(n)try{if((await n.noteWindow.open(e,t)).ok)return;Dc.error(Hc._({id:`o1veZ6`}))}catch{Dc.error(Hc._({id:`o1veZ6`}))}}function Xx(e){if(e===null)return`none`;switch(e.kind){case`doc`:case`folder-index`:return`doc`;case`folder`:return`folder`;case`asset`:case`skill-file`:case`large-file`:return`asset`;case`missing`:case`skills`:case`skill-preview`:return`none`}}var Zx={blobRun:{id:`hgf5io`},back:{id:`iH8pgl`},forward:{id:`rxWGWX`},newFile:{id:`HdkSiO`},newFolder:{id:`96G6Re`},openGraph:{id:`3Fcb0I`},openInNewWindow:{id:`E91VZY`},initializeStarterPack:{id:`fWi7pn`},newSkill:{id:`MdpSC1`},newProject:{id:`gKi-a_`},openFolderOnDisk:{id:`WPwDin`},openFileOnDisk:{id:`ka6Eke`},switchProject:{id:`xaDWAI`},openSkills:{id:`PCSkw2`},settings:{id:`Tz0i8g`},installClaudeDesktop:{id:`62Pc08`},reportBug:{id:`cd5EXh`},bugReportHistory:{id:`QHCx0c`},sendFeedback:{id:`RoafuO`},newFromTemplate:{id:`Uuj_R4`},rename:{id:`2wxgft`},duplicate:{id:`euc6Ns`},moveToTrash:{id:`q3TWG7`},revealInFinder:{id:`LtSYdi`},copyFullPath:{id:`Up2_7p`},copyRelativePath:{id:`M6mvVi`},closeTab:{id:`r6ncaO`},newWorktree:{id:`DXd9LM`},switchWorktree:{id:`8Vq20-`},sidebarShow:{id:`151wvk`},sidebarHide:{id:`Q1mtyd`},docPanelShow:{id:`fSRzLo`},docPanelHide:{id:`GSYWCm`},terminalShow:{id:`xi9KGG`},terminalHide:{id:`9xCnv8`},terminalMoveRight:{id:`PrWQiT`},terminalMoveBottom:{id:`Tofsyo`},agentPanelShow:{id:`b4V4nU`},agentPanelHide:{id:`93LBnX`},agentPanelAskSelection:{id:`OlFVNr`},showHiddenFiles:{id:`XcGbim`},showOkFolders:{id:`GHsJb8`},showOnlyMarkdownFiles:{id:`WkTLN7`},showSkillsSection:{id:`WkyP2p`},expandAll:{id:`OlAl5i`},collapseAll:{id:`qvWGzP`},newTerminal:{id:`ZBxvV3`},killTerminal:{id:`5_j-DA`},checkForUpdates:{id:`WMCwmR`},setUpIntegrations:{id:`AhoGwP`},checkSpelling:{id:`ZgJVnp`},openOnGithub:{id:`LeGeTf`}},Qx={win32:{revealInFinder:{id:`qi1F96`},moveToTrash:{id:`o9yN4T`}},linux:{revealInFinder:{id:`e1Rn_k`}}};function $x(e,t){if(t===`win32`||t===`linux`){let n=Qx[t][e];if(n)return n}return Zx[e]}var eS={"open-blob-run":Xy,"navigate-back":Wu,"navigate-forward":Ku,"new-file":fi,"new-folder":Yy,"open-graph":cb,"open-in-new-window":Cb,"initialize-starter-pack":Ap,"new-skill":pt,"new-project":dr,"open-folder":Wf,"open-file":xi,"switch-project":nn,"open-skills":Ap,settings:Ar,"install-claude-desktop":yf,"report-bug":Dn,"bug-report-history":kl,"send-feedback":fp,"new-from-template":fi,rename:Zt,duplicate:Fn,"move-to-trash":Ip,"reveal-in-finder":Wf,"copy-full-path":Fn,"copy-relative-path":Fn,"close-tab":zp,"new-worktree":vu,"switch-worktree":vu,"toggle-sidebar":hn,"toggle-doc-panel":tl,"toggle-terminal":rl,"move-terminal":rl,"toggle-agent-panel":fp,"toggle-show-hidden-files":bf,"toggle-show-ok-folders":Kf,"toggle-show-only-markdown-files":xi,"toggle-show-skills-section":pt,"expand-all-tree":Bb,"collapse-all-tree":qy,"new-terminal":rl,"kill-terminal":rl,"check-for-updates":Pp,"set-up-integrations":ky,"toggle-spell-check":Sb,"open-github":Jx},tS={"open-blob-run":e=>e.openBlobRun(),"new-file":e=>{e.closePalette(),e.openNewItemDialog(`file`)},"new-folder":e=>{e.closePalette(),e.openNewItemDialog(`folder`)},"open-graph":e=>{e.closePalette(),zt(`graph`)},"open-in-new-window":e=>{e.closePalette(),e.activeDocName&&Yx(e.activeDocName,`palette`)},"initialize-starter-pack":e=>{e.closePalette(),e.openSeedDialog()},"new-skill":e=>{e.closePalette(),e.createBlankSkill()},"new-project":e=>{e.closePalette(),e.openCreateProjectDialog()},"open-folder":e=>{let t=e.bridge;t&&e.runAction(async()=>{let e=await t.dialog.openFolder();e&&await t.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})})},"open-file":e=>{let t=e.bridge;t&&e.runAction(()=>t.project.openFile())},"switch-project":e=>{let t=e.bridge;t&&e.runAction(()=>t.navigator.open(),Hc._({id:`jol95m`}))},"open-skills":e=>{e.closePalette(),Gt()},settings:e=>{e.closePalette(),window.location.hash!==`#settings`&&(window.location.hash=zc)},"install-claude-desktop":e=>{e.closePalette(),window.location.hash=`#install-claude-desktop`},"report-bug":e=>{e.closePalette(),e.openReportBugDialog()},"bug-report-history":e=>{e.closePalette(),e.openBugReportHistory()},"send-feedback":e=>{e.closePalette(),e.openFeedbackDialog()},"check-for-updates":e=>e.runAction(async()=>{await e.bridge?.update.checkNow()}),"set-up-integrations":e=>e.runAction(async()=>{await e.bridge?.mcpWiring.reconfigure()}),"toggle-spell-check":e=>e.runAction(async()=>{await e.bridge?.spellcheck.toggle()}),"open-github":e=>e.openExternalUrl(Is)};function nS(e){return{host:e.bridge===null?`web`:`desktop`,activeTargetKind:e.contextualTargetKind,singleFile:e.singleFile,terminalCapable:e.bridge!==null&&e.bridge.terminal!=null&&e.bridge.config.ptyAvailable===!0,terminalLive:e.viewMenuState.terminalLive===!0,canExpandAll:e.viewMenuState.canExpandAll!==!1,canCollapseAll:e.viewMenuState.canCollapseAll!==!1,hasActiveDoc:e.activeDocName!==null,showInstallSkill:!1}}function rS(e,t){let n=t.bridge?.platform;if(e.stateToggle){let{overrideKey:r,overrideField:i}=e.stateToggle;if(r!==void 0&&i!==void 0&&t.viewMenuState[i]===!0)return Hc._(Zx[r]);let a=t.viewMenuState[e.stateToggle.stateField]===!0?e.stateToggle.hideKey:e.stateToggle.showKey;return Hc._($x(a,n))}if(e.placementToggle){let r=t.viewMenuState.terminalPlacement===`right`?e.placementToggle.rightKey:e.placementToggle.bottomKey;return Hc._($x(r,n))}return Hc._($x(e.labelKey,n))}function iS(e){let t=e.menuActionId;return e=>e.emitMenuAction(t)}function aS(e){let t=e.palette;if(!t)throw Error(`command ${e.id} has no palette presence`);let n=eS[e.id];if(!n)throw Error(`command ${e.id} has no palette icon`);let r=e.checkField;return{id:e.id,menuActionId:e.menuActionId,label:t=>rS(e,t),keywords:e.keywords,icon:n,group:t.group,visibility:t.visibility,shortcutId:e.shortcutId,shortcutDesktopOnly:e.shortcutDesktopOnly,checked:r?e=>e.viewMenuState[r]===!0:void 0,available:t=>Fs(e.availability,nS(t)),dispatch:tS[e.id]??iS(e)}}var oS=ws.flatMap(e=>e.palette?[aS(e)]:[]),sS=`ok-omnibar-recents-v1`,cS=10;function lS(e){return typeof e==`object`&&!!e&&(e.kind===`file`||e.kind===`folder`)&&typeof e.path==`string`&&typeof e.lastOpenedAt==`string`}function uS(e){if(e)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function dS(e,t){return`${e}:${t}`}function fS(e){let t=uS(e);if(!t)return[];try{let e=t.getItem(sS);if(!e)return[];let n=JSON.parse(e);return Array.isArray(n)?n.filter(lS).slice(0,cS):[]}catch{return[]}}function pS(e,t){let n=uS(t);if(n)try{n.setItem(sS,JSON.stringify(e.slice(0,cS)))}catch(e){console.warn(`[omnibar] Failed to save recent entries:`,e)}}function mS(e,t){return[t,...e.filter(e=>e.kind!==t.kind||e.path!==t.path)].slice(0,cS)}function hS(e,t){return e.filter(e=>t.has(dS(e.kind,e.path)))}var gS=50,_S=50,vS=``,yS=null;function bS(e){return e.trim().toLowerCase()}function xS(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function SS(e){let t=e.trim();return t?[...new Set(t.split(/\s+/).filter(Boolean))].sort((e,t)=>t.length-e.length):[]}function CS(e,t,n=new Map,r=new Map,i=new Set){let a=[],o=new Set;for(let t of e){o.add(t);let e=r.get(t),i=e?.modified,s=n.get(t);a.push({kind:`file`,path:t,name:sc(t),...s&&{title:s},...e?.docExt&&{docExt:e.docExt},...i&&{modifiedTs:Date.parse(i)}})}for(let e of i)o.has(e)||(o.add(e),a.push({kind:`file`,path:e,name:sc(e),bodyIndexed:!1}));for(let e of t)a.push({kind:`folder`,path:e,name:sc(e)});return a.sort((e,t)=>{let n=e.path.localeCompare(t.path);return n===0?e.kind===t.kind?0:e.kind===`folder`?-1:1:n}),a}function wS(e){return ec({kind:e.kind===`folder`?`folder`:e.bodyIndexed===!1?`file`:`page`,path:e.path,title:e.title??e.name,modifiedTs:e.modifiedTs??0})}function TS(e){return{entries:e,byId:new Map(e.map(e=>[`${e.kind===`folder`?`folder`:e.bodyIndexed===!1?`file`:`page`}:${e.path}`,e])),corpus:Es(e.map(wS))}}function ES(e){return e.map(e=>`${e.kind}\u0000${e.path}\u0000${e.title??``}\u0000${e.docExt??``}\u0000${e.modifiedTs??0} ${e.bodyIndexed===!1?`0`:`1`}`).join(``)}function DS(e){let t=ES(e);return yS&&vS===t?yS:(vS=t,yS=TS(e),yS)}function OS(e,t,n=gS){return kS(DS(e),t,n)}function kS(e,t,n=gS){let r=bS(t);return r?po(e.corpus,r,{intent:`omnibar`,limit:n,scopes:[`page`,`folder`,`file`]}).map(t=>e.byId.get(t.document.id)).filter(e=>e!==void 0):e.entries.slice(0,20)}function AS(e,t){let n=SS(t);if(n.length===0||e.length===0)return[{text:e,match:!1,start:0}];let r=RegExp(`(${n.map(xS).join(`|`)})`,`gi`),i=[],a=0;for(let t of e.matchAll(r)){let n=t.index??0;n>a&&i.push({text:e.slice(a,n),match:!1,start:a}),i.push({text:t[0],match:!0,start:n}),a=n+t[0].length}return a<e.length&&i.push({text:e.slice(a),match:!1,start:a}),i.length>0?i:[{text:e,match:!1,start:0}]}function jS(e){if(e.kind!==`page`&&e.kind!==`folder`&&e.kind!==`file`||typeof e.path!=`string`)return null;let t=sc(e.path);return{kind:e.kind===`folder`?`folder`:`file`,path:e.path,name:t,...e.kind===`file`&&{bodyIndexed:!1},...e.title&&{title:e.title},...e.snippet&&{snippet:e.snippet},...typeof e.score==`number`&&{score:e.score}}}async function MS(e,t={}){let n=e.trim();if(!n)return{entries:[],truncated:!1,ready:!0};let r=await fetch(`/api/search`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({query:n,intent:`full_text`,ranking:t.semantic?`relevance`:`navigation`,scopes:[`page`,`folder`,`content`,`file`],limit:t.limit??_S,source:`omnibar`,...t.semantic?{semantic:!0}:{}}),signal:t.signal});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(Il(e)??`Search failed with status ${r.status}`)}let i=await r.json();return{entries:(i.results??[]).map(jS).filter(e=>!!e),truncated:i.truncated===!0,ready:i.ready!==!1}}function NS(e,t,n=[]){let r=bS(t);if(!r)return!0;let i=bS([e,...n].join(` `));return SS(r).every(e=>i.includes(e))}function PS(e,t,n={}){if(e.trim()===``)return`idle`;if(t.length===0)return`empty`;if(n.truncated)return`truncated`;for(let e of t)if(`snippet`in e&&typeof e.snippet==`string`&&e.snippet.length>0)return`content`;return`name-only`}function FS(e){let{query:t,firedQuery:n,status:r,resultCount:i}=e,a=i>0,o=t!==``&&t!==n,s=a&&(r===`loading`||t!==n),c=null;r===`error`&&t!==``?c={kind:`retry`,query:t}:o&&r!==`loading`&&(c={kind:`search`,query:t});let l=null;return r===`loading`?l=`searching`:t===``&&!a?l=`empty`:r===`success`&&!o&&!a&&(l=`no-results`),{submit:c,results:{show:a,dimmed:s,forQuery:a?n:null},notice:l}}var IS=`tag:`;function LS(e,t){if(!e.toLowerCase().startsWith(`tag:`))return{kind:`normal`,query:e};let n=e.slice(4).replace(/^\s+/,``).trim();return n&&t.has(n)?{kind:`tag-docs`,tagName:n}:{kind:`tag-list`,query:n}}function RS(e,t){return h(e,t)}var zS=_e;async function BS(e){let t=await fetch(`/api/tags/${encodeURIComponent(e)}`);if(!t.ok)throw Error(`/api/tags/${e} responded with ${t.status}`);let n=await t.json();return Array.isArray(n.docs)?n.docs:[]}var VS=(0,Q.lazy)(()=>n(()=>import(`./FeedbackForm-BNeQXmJD.js`).then(e=>({default:e.FeedbackForm})),[],import.meta.url)),HS=e=>{let t=(0,$.c)(11),{open:n,onOpenChange:r,source:i,onSuccess:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)($r,{children:(0,Z.jsx)(Jr,{children:(0,Z.jsx)(Y,{id:`SItQRc`})})}),t[0]=o):o=t[0];let s;t[1]!==r||t[2]!==a?(s=()=>{r(!1),a?.()},t[1]=r,t[2]=a,t[3]=s):s=t[3];let c;t[4]!==i||t[5]!==s?(c=(0,Z.jsxs)(Yr,{children:[o,(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(VS,{source:i,onSuccess:s})})]}),t[4]=i,t[5]=s,t[6]=c):c=t[6];let l;return t[7]!==r||t[8]!==n||t[9]!==c?(l=(0,Z.jsx)(ei,{open:n,onOpenChange:r,children:c}),t[7]=r,t[8]=n,t[9]=c,t[10]=l):l=t[10],l};async function US(e){let t={path:e.path};e.template!==void 0&&(t.template=e.template);try{let n=await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),r=n.status,i=await d(n,Hc._({id:`d2uTPx`,values:{status:r}}));if(!i.ok)return{ok:!1,error:i.title};let a=yc.safeParse(i.body);return a.success?{ok:!0,docName:a.data.docName}:{ok:!1,error:e.kind===`folder`?Hc._({id:`K1ckLX`}):Hc._({id:`fJgQHX`})}}catch(e){return console.warn(`[create-page-request] create failed:`,e),{ok:!1,error:Hc._({id:`HIb0vl`})}}}function WS(e,t){window.location.hash=qp(e),t(e),Yc([`files`,`backlinks`,`graph`])}function GS(e,t){let n=e?`${e}/`:``;for(let e=1;;e++){let r=`${n}untitled${e===1?``:`-${e}`}`;if(!t.has(r))return r}}var KS=[`.md`,`.mdx`];function qS(e){let t=e.toLowerCase();for(let e of KS)if(t.endsWith(e))return e;return null}var JS={local:0,inherited:1};function YS(e){return[...e].sort((e,t)=>{let n=JS[e.scope]-JS[t.scope];if(n!==0)return n;let r=(e.title??e.name).toLowerCase(),i=(t.title??t.name).toLowerCase();return r.localeCompare(i)})}var XS=`__blank__`;function ZS(e){return e.trim()?e.includes(`..`)?`dotdot`:e.startsWith(`/`)?`leading-slash`:e.includes(`\\`)?`backslash`:e.includes(`\0`)?`null-byte`:null:`empty`}function QS(e){switch(e){case`empty`:return{id:`hYDc6B`};case`dotdot`:return{id:`Wyxs0x`};case`leading-slash`:return{id:`OYnx7O`};case`backslash`:return{id:`qo4zCg`};case`null-byte`:return{id:`saYiIO`}}}function $S(e){let t=e.fileName.trim(),n=qS(t)?t:`${t}${e.fileExtension??`.md`}`;if(e.kind===`folder`){let t=(e.folderName??``).trim();return`${e.initialDir?`${e.initialDir}/${t}`:t}/${n}`}return e.initialDir?`${e.initialDir}/${n}`:n}function eC(e,t){return Vc(e.target)?!1:Mc(e,`new-item`,t)}function tC(e){let t=e.value.lastIndexOf(`.`);t>0?e.setSelectionRange(0,t):e.select()}function nC(e){let t=(0,$.c)(136),{open:n,onOpenChange:r,kind:i,initialDir:a,suggestedName:o,initialTemplate:s,defaultToTemplate:c,description:l,onCreated:u,folderConfig:d}=e,{_:f}=Bn(),{addPage:p}=Nd(),m=hf(d?null:a),h=d??m,[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(XS),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(null),A=(0,Q.useId)(),j=(0,Q.useId)(),M=(0,Q.useId)(),N=(0,Q.useId)(),P=(0,Q.useId)(),[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(null),R=(0,Q.useRef)(null),z,B;t[0]!==s||t[1]!==i||t[2]!==n||t[3]!==o?(z=()=>{n&&(T(null),k(null),D(!1),y(``),x(i===`file`&&s?s:XS),C(!1),I(!1),_(i===`file`?o??`untitled`:`index`))},B=[n,i,o,s],t[0]=s,t[1]=i,t[2]=n,t[3]=o,t[4]=z,t[5]=B):(z=t[4],B=t[5]),(0,Q.useEffect)(z,B);let V;t[6]!==h.state.data||t[7]!==h.state.status?(V=h.state.status===`ready`?YS(h.state.data.folder.templates_available??[]):[],t[6]=h.state.data,t[7]=h.state.status,t[8]=V):V=t[8];let ee=V,H;t[9]!==h.state.data||t[10]!==h.state.status||t[11]!==n||t[12]!==b?(H=()=>{n&&b!==XS&&h.state.status===`ready`&&((h.state.data.folder.templates_available??[]).some(e=>e.name===b)||x(XS))},t[9]=h.state.data,t[10]=h.state.status,t[11]=n,t[12]=b,t[13]=H):H=t[13];let U;t[14]!==h.state||t[15]!==n||t[16]!==b?(U=[n,b,h.state],t[14]=h.state,t[15]=n,t[16]=b,t[17]=U):U=t[17],(0,Q.useEffect)(H,U);let W;t[18]!==c||t[19]!==h.state.data||t[20]!==h.state.status||t[21]!==s||t[22]!==n||t[23]!==S?(W=()=>{if(!n||!c||s||S||h.state.status!==`ready`)return;let e=YS(h.state.data.folder.templates_available??[]);e.length>0&&x(e[0].name)},t[18]=c,t[19]=h.state.data,t[20]=h.state.status,t[21]=s,t[22]=n,t[23]=S,t[24]=W):W=t[24];let G;t[25]!==c||t[26]!==h.state||t[27]!==s||t[28]!==n||t[29]!==S?(G=[n,c,s,S,h.state],t[25]=c,t[26]=h.state,t[27]=s,t[28]=n,t[29]=S,t[30]=G):G=t[30],(0,Q.useEffect)(W,G);let te=h.state.status===`loading`||h.state.status===`idle`,ne=h.state.status===`error`?h.state.message:null,re=i===`file`&&(ee.length>0||!!ne),K;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(K=function(e){_(e),T(null)},t[31]=K):K=t[31];let ie=K,q;t[32]!==g||t[33]!==v||t[34]!==a||t[35]!==i?(q=function(){return $S({kind:i,initialDir:a,fileName:g,folderName:v})},t[32]=g,t[33]=v,t[34]=a,t[35]=i,t[36]=q):q=t[36];let ae=q,oe;t[37]!==f||t[38]!==g||t[39]!==v||t[40]!==i?(oe=function(){if(i===`folder`){let e=ZS(v.trim());if(e)return{message:f({id:`ODGGlj`,values:{detail:f(QS(e))}}),field:`folder`}}let e=ZS(g.trim());return e?{message:f(QS(e)),field:`file`}:null},t[37]=f,t[38]=g,t[39]=v,t[40]=i,t[41]=oe):oe=t[41];let se=oe,ce;t[42]!==E||t[43]!==g||t[44]!==v||t[45]!==i||t[46]!==te?(ce=E||!g.trim()||i===`folder`&&!v.trim()||i===`file`&&te,t[42]=E,t[43]=g,t[44]=v,t[45]=i,t[46]=te,t[47]=ce):ce=t[47];let le=ce,ue;t[48]!==p||t[49]!==ae||t[50]!==se||t[51]!==i||t[52]!==u||t[53]!==r||t[54]!==b?(ue=async function(){let e=se();if(e){T(e.message),k(e.field);return}D(!0),T(null),k(null);let t=await US({path:ae(),template:i===`file`&&b!==XS?b:void 0,kind:i});if(D(!1),!t.ok){T(t.error),k(`form`);return}r(!1),WS(t.docName,p),u?.(t.docName)},t[48]=p,t[49]=ae,t[50]=se,t[51]=i,t[52]=u,t[53]=r,t[54]=b,t[55]=ue):ue=t[55];let de=ue,fe;t[56]!==f||t[57]!==a?(fe=a||f({id:`L6Hhh6`}),t[56]=f,t[57]=a,t[58]=fe):fe=t[58];let pe=fe,J;t[59]===i?J=t[60]:(J=(0,Z.jsx)(Jr,{children:i===`file`?(0,Z.jsx)(Y,{id:`HdkSiO`}):(0,Z.jsx)(Y,{id:`96G6Re`})}),t[59]=i,t[60]=J);let me;t[61]!==l||t[62]!==pe?(me=l??(0,Z.jsx)(Y,{id:`NvOvTi`,values:{dirDisplay:pe},components:{0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})}}),t[61]=l,t[62]=pe,t[63]=me):me=t[63];let he;t[64]===me?he=t[65]:(he=(0,Z.jsx)(qr,{children:me}),t[64]=me,t[65]=he);let ge;t[66]!==J||t[67]!==he?(ge=(0,Z.jsxs)($r,{children:[J,he]}),t[66]=J,t[67]=he,t[68]=ge):ge=t[68];let _e;t[69]!==b||t[70]!==re||t[71]!==N||t[72]!==F||t[73]!==P||t[74]!==ee||t[75]!==ne||t[76]!==te?(_e=re&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{id:N,className:`text-sm font-medium`,children:(0,Z.jsx)(Y,{id:`f65AOQ`})}),ne?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,children:(0,Z.jsx)(Y,{id:`sE7R19`,values:{templatesError:ne}})}):null,(0,Z.jsx)(iC,{triggerId:P,labelledById:N,open:F,onOpenChange:I,value:b,onValueChange:e=>{x(e),C(!0)},templates:ee,loading:te})]}),t[69]=b,t[70]=re,t[71]=N,t[72]=F,t[73]=P,t[74]=ee,t[75]=ne,t[76]=te,t[77]=_e):_e=t[77];let ve;t[78]!==f||t[79]!==w||t[80]!==O||t[81]!==A||t[82]!==j||t[83]!==v||t[84]!==i?(ve=i===`folder`&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:j,children:(0,Z.jsx)(Y,{id:`cqQyPB`})}),(0,Z.jsx)(dh,{ref:R,id:j,value:v,onChange:e=>{y(e.target.value),T(null)},placeholder:`folder-name`,autoFocus:!0,"aria-describedby":w&&(O===`folder`||O===`form`)?A:void 0,"aria-invalid":w&&(O===`folder`||O===`form`)?!0:void 0,onKeyDown:e=>{if(e.key===`Enter`){e.preventDefault();let t=ZS(v.trim());if(t){T(f({id:`ODGGlj`,values:{detail:f(QS(t))}})),k(`folder`);return}L.current?.focus()}}})]}),t[78]=f,t[79]=w,t[80]=O,t[81]=A,t[82]=j,t[83]=v,t[84]=i,t[85]=ve):ve=t[85];let ye;t[86]===i?ye=t[87]:(ye=i===`folder`?(0,Z.jsx)(Y,{id:`jjtmV_`}):(0,Z.jsx)(Y,{id:`s-XOaI`}),t[86]=i,t[87]=ye);let be;t[88]!==M||t[89]!==ye?(be=(0,Z.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:M,children:ye}),t[88]=M,t[89]=ye,t[90]=be):be=t[90];let xe;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(xe=e=>ie(e.target.value),t[91]=xe):xe=t[91];let Se=i===`file`,Ce=w&&(O===`file`||O===`form`)?A:void 0,we=w&&(O===`file`||O===`form`)?!0:void 0,Te;t[92]!==de||t[93]!==le?(Te=e=>{e.key===`Enter`&&!le&&de()},t[92]=de,t[93]=le,t[94]=Te):Te=t[94];let Ee;t[95]!==M||t[96]!==g||t[97]!==Se||t[98]!==Ce||t[99]!==we||t[100]!==Te?(Ee=(0,Z.jsx)(dh,{ref:L,id:M,value:g,onChange:xe,placeholder:`my-note`,autoFocus:Se,"aria-describedby":Ce,"aria-invalid":we,onFocus:rC,onKeyDown:Te}),t[95]=M,t[96]=g,t[97]=Se,t[98]=Ce,t[99]=we,t[100]=Te,t[101]=Ee):Ee=t[101];let De;t[102]!==w||t[103]!==A?(De=w&&(0,Z.jsx)(`p`,{id:A,role:`alert`,className:`text-1sm text-destructive`,children:w}),t[102]=w,t[103]=A,t[104]=De):De=t[104];let Oe;t[105]!==be||t[106]!==Ee||t[107]!==De?(Oe=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[be,Ee,De]}),t[105]=be,t[106]=Ee,t[107]=De,t[108]=Oe):Oe=t[108];let ke;t[109]!==_e||t[110]!==ve||t[111]!==Oe?(ke=(0,Z.jsxs)(Xr,{className:`space-y-6 pb-1`,children:[_e,ve,Oe]}),t[109]=_e,t[110]=ve,t[111]=Oe,t[112]=ke):ke=t[112];let Ae;t[113]===r?Ae=t[114]:(Ae=()=>r(!1),t[113]=r,t[114]=Ae);let je;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(je=(0,Z.jsx)(Y,{id:`dEgA5A`}),t[115]=je):je=t[115];let Me;t[116]!==E||t[117]!==Ae?(Me=(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:Ae,disabled:E,children:je}),t[116]=E,t[117]=Ae,t[118]=Me):Me=t[118];let Ne;t[119]===E?Ne=t[120]:(Ne=E?(0,Z.jsx)(Y,{id:`E9bKSA`}):(0,Z.jsx)(Y,{id:`hYgDIe`}),t[119]=E,t[120]=Ne);let Pe;t[121]!==de||t[122]!==le||t[123]!==Ne?(Pe=(0,Z.jsx)(X,{onClick:de,disabled:le,children:Ne}),t[121]=de,t[122]=le,t[123]=Ne,t[124]=Pe):Pe=t[124];let Fe;t[125]!==Me||t[126]!==Pe?(Fe=(0,Z.jsxs)(Zr,{children:[Me,Pe]}),t[125]=Me,t[126]=Pe,t[127]=Fe):Fe=t[127];let Ie;t[128]!==ge||t[129]!==ke||t[130]!==Fe?(Ie=(0,Z.jsxs)(Yr,{className:`sm:max-w-md`,"data-ok-layer-spawned":``,children:[ge,ke,Fe]}),t[128]=ge,t[129]=ke,t[130]=Fe,t[131]=Ie):Ie=t[131];let Le;return t[132]!==r||t[133]!==n||t[134]!==Ie?(Le=(0,Z.jsx)(ei,{open:n,onOpenChange:r,children:Ie}),t[132]=r,t[133]=n,t[134]=Ie,t[135]=Le):Le=t[135],Le}function rC(e){return tC(e.currentTarget)}function iC(e){let t=(0,$.c)(66),{triggerId:n,labelledById:r,open:i,onOpenChange:a,value:o,onValueChange:s,templates:c,loading:l}=e,{_:u}=Bn(),d=(0,Q.useId)(),f;if(t[0]!==c||t[1]!==o){let e;t[3]===o?e=t[4]:(e=e=>e.name===o,t[3]=o,t[4]=e),f=c.find(e),t[0]=c,t[1]=o,t[2]=f}else f=t[2];let p=f,m=o===XS,h=i?d:void 0,g=`${r} ${n}`,_;t[5]!==m||t[6]!==l||t[7]!==p?.name||t[8]!==p?.title||t[9]!==o?(_=l?(0,Z.jsx)(Y,{id:`Hl89Qd`}):m?(0,Z.jsx)(Y,{id:`E7BhZn`}):p?.title??p?.name??o,t[5]=m,t[6]=l,t[7]=p?.name,t[8]=p?.title,t[9]=o,t[10]=_):_=t[10];let v;t[11]===_?v=t[12]:(v=(0,Z.jsx)(`span`,{className:`truncate`,children:_}),t[11]=_,t[12]=v);let y;t[13]!==m||t[14]!==l||t[15]!==p?(y=!l&&!m&&p?(0,Z.jsx)(cC,{entry:p}):null,t[13]=m,t[14]=l,t[15]=p,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==y?(b=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[v,y]}),t[17]=v,t[18]=y,t[19]=b):b=t[19];let x;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(kd,{className:`ml-2 size-4 shrink-0 opacity-50`,"aria-hidden":`true`}),t[20]=x):x=t[20];let S;t[21]!==l||t[22]!==i||t[23]!==h||t[24]!==g||t[25]!==b||t[26]!==n?(S=(0,Z.jsx)(fh,{asChild:!0,children:(0,Z.jsxs)(X,{id:n,type:`button`,variant:`outline`,role:`combobox`,"aria-expanded":i,"aria-haspopup":`listbox`,"aria-controls":h,"aria-labelledby":g,disabled:l,className:`w-full justify-between font-normal`,children:[b,x]})}),t[21]=l,t[22]=i,t[23]=h,t[24]=g,t[25]=b,t[26]=n,t[27]=S):S=t[27];let C;t[28]===u?C=t[29]:(C=u({id:`UQAp48`}),t[28]=u,t[29]=C);let w;t[30]===C?w=t[31]:(w=(0,Z.jsx)(Jt,{placeholder:C}),t[30]=C,t[31]=w);let T;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(mt,{children:(0,Z.jsx)(Y,{id:`c8iK2Y`})}),t[32]=T):T=t[32];let E;if(t[33]!==a||t[34]!==s||t[35]!==c||t[36]!==o){let e;t[38]!==a||t[39]!==s||t[40]!==o?(e=e=>{let t=e.title??e.name,n=e.title&&e.title!==e.name?e.name:void 0,r=`${e.scope}:${e.source_folder}:${e.name}`;return(0,Z.jsxs)(fn,{value:r,keywords:[t,e.name,e.description??``,e.scope,e.source_folder??``],onSelect:()=>{s(e.name),a(!1)},className:`items-start gap-3`,children:[(0,Z.jsx)(Uu,{className:gr(`mt-1 size-4 shrink-0`,o===e.name?`opacity-100`:`opacity-0`),"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium`,children:t}),n?(0,Z.jsx)(`code`,{className:`font-mono text-2xs text-muted-foreground shrink-0`,children:n}):null,(0,Z.jsx)(cC,{entry:e,className:`ml-auto`})]}),e.description?(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:e.description}):null]})]},r)},t[38]=a,t[39]=s,t[40]=o,t[41]=e):e=t[41],E=c.map(e),t[33]=a,t[34]=s,t[35]=c,t[36]=o,t[37]=E}else E=t[37];let D;t[42]!==a||t[43]!==s?(D=()=>{s(XS),a(!1)},t[42]=a,t[43]=s,t[44]=D):D=t[44];let O=o===XS?`opacity-100`:`opacity-0`,k;t[45]===O?k=t[46]:(k=gr(`mt-1 size-4 shrink-0`,O),t[45]=O,t[46]=k);let A;t[47]===k?A=t[48]:(A=(0,Z.jsx)(Uu,{className:k,"aria-hidden":`true`}),t[47]=k,t[48]=A);let j;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(`span`,{className:`text-sm font-medium`,children:(0,Z.jsx)(Y,{id:`E7BhZn`})}),t[49]=j):j=t[49];let M;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[j,(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`hZoBHK`})})]}),t[50]=M):M=t[50];let N;t[51]!==D||t[52]!==A?(N=(0,Z.jsxs)(fn,{value:`Blank note empty`,onSelect:D,className:`items-start gap-3`,children:[A,M]}),t[51]=D,t[52]=A,t[53]=N):N=t[53];let P;t[54]!==d||t[55]!==E||t[56]!==N?(P=(0,Z.jsxs)(At,{id:d,className:`subtle-scrollbar`,children:[T,E,N]}),t[54]=d,t[55]=E,t[56]=N,t[57]=P):P=t[57];let F;t[58]!==w||t[59]!==P?(F=(0,Z.jsx)(ph,{className:`w-[var(--radix-popover-trigger-width)] p-0`,align:`start`,onOpenAutoFocus:sC,onWheel:oC,onTouchMove:aC,children:(0,Z.jsxs)(de,{children:[w,P]})}),t[58]=w,t[59]=P,t[60]=F):F=t[60];let I;return t[61]!==a||t[62]!==i||t[63]!==F||t[64]!==S?(I=(0,Z.jsxs)(hh,{open:i,onOpenChange:a,children:[S,F]}),t[61]=a,t[62]=i,t[63]=F,t[64]=S,t[65]=I):I=t[65],I}function aC(e){e.stopPropagation()}function oC(e){e.stopPropagation()}function sC(e){e.preventDefault(),e.currentTarget.querySelector(`[cmdk-input]`)?.focus()}function cC(e){let t=(0,$.c)(7),{entry:n,className:r}=e;if(n.scope===`inherited`){let e;t[0]===r?e=t[1]:(e=gr(`shrink-0 text-2xs`,r),t[0]=r,t[1]=e);let i;t[2]===n.source_folder?i=t[3]:(i=n.source_folder||(0,Z.jsx)(Y,{id:`ZNK2Tq`}),t[2]=n.source_folder,t[3]=i);let a;return t[4]!==e||t[5]!==i?(a=(0,Z.jsx)(Sh,{variant:`gray`,className:e,children:i}),t[4]=e,t[5]=i,t[6]=a):a=t[6],a}return null}var lC=`knowledge-base`;function uC(e){let t=(0,$.c)(69),{open:n,onOpenChange:r,onSeedApplied:i,initialPackId:a}=e,{_:o}=Bn(),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={kind:`loading`},t[0]=s):s=t[0];let[c,l]=(0,Q.useState)(s),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(a??lC),[m,h]=(0,Q.useState)(`project-root`),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(a===void 0?`pick`:`configure`),b=(0,Q.useRef)(!0),x=u?.find(e=>e.id===f),S,C;t[1]!==n||t[2]!==u?(S=()=>{if(!n||u!==null)return;let e=!1;return(async()=>{try{let t=await _x().listPacks();if(e)return;t.ok?d(t.packs):(d([]),l({kind:`error`,message:t.error.message}))}catch(t){let n=t;if(e)return;d([]),l({kind:`error`,message:n instanceof Error?n.message:String(n)})}})(),()=>{e=!0}},C=[n,u],t[1]=n,t[2]=u,t[3]=S,t[4]=C):(S=t[3],C=t[4]),(0,Q.useEffect)(S,C);let w,T;t[5]!==a||t[6]!==n?(w=()=>{n&&(p(a??lC),h(`project-root`),_(``),y(a===void 0?`pick`:`configure`),l({kind:`loading`}),b.current=!0)},T=[n,a],t[5]=a,t[6]=n,t[7]=w,t[8]=T):(w=t[7],T=t[8]),(0,Q.useEffect)(w,T),(0,Q.useEffect)(()=>{x&&_(x.defaultSubfolder??``)},[x]);let E;t[9]===g?E=t[10]:(E=g.trim(),t[9]=g,t[10]=E);let D=E,O=m===`subfolder`&&D===``,k,A;t[11]!==o||t[12]!==n||t[13]!==u||t[14]!==m||t[15]!==f||t[16]!==v||t[17]!==O||t[18]!==D?(k=()=>{if(!n||v!==`configure`||u===null)return;if(O){l({kind:`error`,message:o({id:`Z8KDox`})});return}let e=m===`project-root`?void 0:D,t=b.current?0:200;b.current=!1;let r=!1,i=setTimeout(()=>{r||(l(fC),_x().plan({rootDir:e,packId:f}).then(e=>{if(!r){if(!e.ok){l({kind:`error`,message:e.error.message});return}l(as(e.plan)?{kind:`plan`,plan:e.plan}:{kind:`already-seeded`,plan:e.plan})}}).catch(e=>{r||l({kind:`error`,message:e instanceof Error?e.message:String(e)})}))},t);return()=>{r=!0,clearTimeout(i)}},A=[n,v,u,f,m,D,O,o],t[11]=o,t[12]=n,t[13]=u,t[14]=m,t[15]=f,t[16]=v,t[17]=O,t[18]=D,t[19]=k,t[20]=A):(k=t[19],A=t[20]),(0,Q.useEffect)(k,A);let j=async function(){if(c.kind!==`plan`)return;let e=c.plan;l({kind:`applying`,plan:e});let t;try{t=await _x().apply(e,{packId:f})}catch(t){let n=t,r=n instanceof Error?n.message:String(n);Dc.error(o({id:`iqugog`,values:{errorDetail:r}})),l({kind:`plan`,plan:e});return}if(t.ok){let n=x?.name??o({id:`W8vpBM`}),a=t.result.applied,s=e.packSkills?.some(dC)===!0,c=o(a>0?{id:`x3-2ta`,values:{packName:n,projectEntries:a}}:s?{id:`B2Srgd`,values:{packName:n}}:{id:`K6jjWB`,values:{packName:n}});Dc.success(c);for(let e of t.result.packSkillConflicts??[]){let t=e.name,n=e.hosts?.join(`, `);Dc.warning(o(n===void 0||n===``?{id:`GifIjR`,values:{conflictName:t}}:{id:`Mv2lM4`,values:{conflictName:t,conflictHosts:n}}))}i?.(),r(!1)}else{let n=t.error.message;Dc.error(o({id:`iqugog`,values:{errorDetail:n}})),l({kind:`plan`,plan:e})}},M=a!==void 0,N=x?.name,P=o(v===`configure`&&x?{id:`hxEUVJ`,values:{selectedPackName:N}}:{id:`RGkNeJ`}),F=x?Dx[x.id]:void 0,I;t[21]!==o||t[22]!==F||t[23]!==x||t[24]!==v?(I=v===`configure`&&x?F?o(F):x.description:o({id:`msqUNq`}),t[21]=o,t[22]=F,t[23]=x,t[24]=v,t[25]=I):I=t[25];let L=I,R;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){p(e),y(`configure`),b.current=!0},t[26]=R):R=t[26];let z=R,B;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(){y(`pick`),l({kind:`loading`}),b.current=!0},t[27]=B):B=t[27];let V=B,ee;t[28]===P?ee=t[29]:(ee=(0,Z.jsx)(Jr,{children:P}),t[28]=P,t[29]=ee);let H;t[30]===L?H=t[31]:(H=(0,Z.jsx)(qr,{children:L}),t[30]=L,t[31]=H);let U;t[32]!==ee||t[33]!==H?(U=(0,Z.jsxs)($r,{children:[ee,H]}),t[32]=ee,t[33]=H,t[34]=U):U=t[34];let W;t[35]!==u||t[36]!==c||t[37]!==m||t[38]!==x||t[39]!==v||t[40]!==g?(W=v===`pick`?(0,Z.jsx)(Xr,{children:(0,Z.jsx)(bx,{packs:u,onPackSelect:z})}):(0,Z.jsxs)(Xr,{className:`space-y-6`,children:[(0,Z.jsx)(Ex,{choice:m,subfolder:g,placeholder:x?.defaultSubfolder??`subfolder`,onChoiceChange:h,onSubfolderChange:_}),(0,Z.jsx)(pC,{phase:c,selectedPack:x})]}),t[35]=u,t[36]=c,t[37]=m,t[38]=x,t[39]=v,t[40]=g,t[41]=W):W=t[41];let G;t[42]!==M||t[43]!==v?(G=v===`configure`&&!M?(0,Z.jsxs)(X,{className:`me-auto uppercase font-mono`,variant:`ghost`,onClick:V,children:[(0,Z.jsx)(Au,{"aria-hidden":`true`,className:`h-4 w-4`}),(0,Z.jsx)(Y,{id:`iH8pgl`})]}):null,t[42]=M,t[43]=v,t[44]=G):G=t[44];let te;t[45]===r?te=t[46]:(te=()=>r(!1),t[45]=r,t[46]=te);let ne;t[47]===c.kind?ne=t[48]:(ne=c.kind===`already-seeded`||c.kind===`error`?(0,Z.jsx)(Y,{id:`yz7wBu`}):(0,Z.jsx)(Y,{id:`dEgA5A`}),t[47]=c.kind,t[48]=ne);let re;t[49]!==te||t[50]!==ne?(re=(0,Z.jsx)(X,{className:`uppercase font-mono`,variant:`outline`,onClick:te,children:ne}),t[49]=te,t[50]=ne,t[51]=re):re=t[51];let K;t[52]!==j||t[53]!==c.kind||t[54]!==v||t[55]!==O?(K=v===`configure`&&c.kind===`plan`?(0,Z.jsx)(X,{onClick:j,disabled:O,children:(0,Z.jsx)(Y,{id:`4TzU0n`})}):v===`configure`&&c.kind===`applying`?(0,Z.jsxs)(X,{disabled:!0,children:[(0,Z.jsx)(ip,{"aria-hidden":`true`,className:`h-4 w-4`}),(0,Z.jsx)(Y,{id:`XYlJJT`})]}):null,t[52]=j,t[53]=c.kind,t[54]=v,t[55]=O,t[56]=K):K=t[56];let ie;t[57]!==G||t[58]!==re||t[59]!==K?(ie=(0,Z.jsxs)(Zr,{children:[G,re,K]}),t[57]=G,t[58]=re,t[59]=K,t[60]=ie):ie=t[60];let q;t[61]!==U||t[62]!==W||t[63]!==ie?(q=(0,Z.jsxs)(Yr,{className:`sm:max-w-4xl`,"data-ok-layer-spawned":``,children:[U,W,ie]}),t[61]=U,t[62]=W,t[63]=ie,t[64]=q):q=t[64];let ae;return t[65]!==r||t[66]!==n||t[67]!==q?(ae=(0,Z.jsx)(ei,{open:n,onOpenChange:r,children:q}),t[65]=r,t[66]=n,t[67]=q,t[68]=ae):ae=t[68],ae}function dC(e){return e.pending}function fC(e){return e.kind===`plan`||e.kind===`already-seeded`?e:{kind:`loading`}}function pC(e){let t=(0,$.c)(19),{phase:n,selectedPack:r}=e;if(n.kind===`loading`){let e=r?.folders.length??6,n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(tx,{rowCount:e}),t[0]=e,t[1]=n),n}if(n.kind===`error`){let e;return t[2]===n.message?e=t[3]:(e=(0,Z.jsx)(`div`,{className:`rounded-md bg-destructive/10 p-3 text-sm text-destructive`,children:n.message}),t[2]=n.message,t[3]=e),e}if(n.kind===`already-seeded`){let e;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`p`,{className:`font-medium`,children:(0,Z.jsx)(Y,{id:`YwPUUP`})}),t[4]=e):e=t[4];let r;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`div`,{children:[e,(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`h-AdvS`})})]}),t[5]=r):r=t[5];let i;return t[6]===n.plan?i=t[7]:(i=(0,Z.jsxs)(`div`,{className:`space-y-3 py-2 text-sm`,children:[r,(0,Z.jsx)(hC,{plan:n.plan})]}),t[6]=n.plan,t[7]=i),i}let i;t[8]!==n.plan||t[9]!==r?(i=as(n.plan)?(0,Z.jsx)(ox,{plan:n.plan,selectedPack:r}):null,t[8]=n.plan,t[9]=r,t[10]=i):i=t[10];let a;t[11]===n.plan.warnings?a=t[12]:(a=n.plan.warnings.length>0?(0,Z.jsx)(`div`,{className:`rounded-md bg-warning/10 p-3 text-xs text-warning-foreground`,children:n.plan.warnings.map(mC)}):null,t[11]=n.plan.warnings,t[12]=a);let o;t[13]===n.plan?o=t[14]:(o=(0,Z.jsx)(hC,{plan:n.plan}),t[13]=n.plan,t[14]=o);let s;return t[15]!==i||t[16]!==a||t[17]!==o?(s=(0,Z.jsxs)(`div`,{className:`space-y-6 py-1 text-sm`,children:[i,a,o]}),t[15]=i,t[16]=a,t[17]=o,t[18]=s):s=t[18],s}function mC(e){return(0,Z.jsx)(`p`,{children:e},e)}function hC(e){let t=(0,$.c)(7),{plan:n}=e,r,i,a;if(t[0]!==n.packSkills){a=Symbol.for(`react.early_return_sentinel`);bb0:{let e=n.packSkills?.filter(_C)??[];if(e.length===0){a=null;break bb0}r=`rounded-md bg-warning/10 p-3 text-xs text-warning-foreground`,i=e.map(gC)}t[0]=n.packSkills,t[1]=r,t[2]=i,t[3]=a}else r=t[1],i=t[2],a=t[3];if(a!==Symbol.for(`react.early_return_sentinel`))return a;let o;return t[4]!==r||t[5]!==i?(o=(0,Z.jsx)(`div`,{className:r,children:i}),t[4]=r,t[5]=i,t[6]=o):o=t[6],o}function gC(e){return(0,Z.jsx)(`p`,{children:(0,Z.jsx)(Y,{id:`CtoghX`,values:{0:e.name}})},e.name)}function _C(e){return e.conflict}var vC=`Describe what this skill does and when to use it.`;function yC(){let e=(0,$.c)(8),{_:t}=Bn(),n=Fh(),r=Zf(),[i,a]=(0,Q.useState)(!1),o;e[0]!==t||e[1]!==i||e[2]!==r||e[3]!==n?(o=async function(e,o){let s=e===void 0?`project`:e;if(i)return;let c=o?.name?.trim()||`new-skill`;if(a(!0),!o?.name){let e=sh(n.status===`ready`?n.data:[])[s];if(n.status!==`ready`){let n=await Rm(s);if(!n.ok){a(!1),Dc.error(t({id:`xrVr_k`,values:{0:n.error}}));return}e=sh(n.skills)[s]}for(let t=2;e.has(c);t++)c=`new-skill-${t}`}let l=o?.description?.trim()||`Describe what this skill does and when to use it.`,u=await Gm({scope:s,name:c,frontmatter:{name:c,description:l},body:``});if(a(!1),!u.ok){Dc.error(t({id:`xrVr_k`,values:{0:u.error}}));return}Dc.success(t({id:`Yy90sM`,values:{name:c}})),r(s,c,u.path===void 0?void 0:{path:u.path})},e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=o):o=e[4];let s=o,c;return e[5]!==s||e[6]!==i?(c={createBlank:s,creating:i},e[5]=s,e[6]=i,e[7]=c):c=e[7],c}function bC(){return(0,Q.useSyncExternalStore)(Ih,Lh,Lh)}function xC(e,t){return e instanceof Error&&e.message?e.message:t}async function SC(e,t,n,r=`action`){try{n(null),await e()}catch(e){console.error(`[${r}] action failed:`,e),n(xC(e,t))}}async function CC(e,t,n=Dc,r=`action`){await SC(e,t,e=>{e!==null&&n.error(e)},r)}var wC=(0,Q.createContext)(!1);function TC(e){let t=(0,$.c)(5),{children:n}=e,[r,i]=(0,Q.useState)(DC),a,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{if(window.okDesktop)return;let e=new AbortController;return Pm(e.signal).then(t=>{e.signal.aborted||t.status!==`ok`||i(t.config.singleFile)}).catch(EC),()=>e.abort()},o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Q.useEffect)(a,o);let s;return t[2]!==n||t[3]!==r?(s=(0,Z.jsx)(wC,{value:r,children:n}),t[2]=n,t[3]=r,t[4]=s):s=t[4],s}function EC(){}function DC(){return typeof window<`u`?window.okDesktop?.config.singleFile??!1:!1}function OC(){return(0,Q.use)(wC)}function kC(e){return e.opened?e.isMain?`primary`:`worktree`:`none`}function AC(e,t,n){let r=[],i=new Set,a=new Set,o=t!==null&&t.mainRoot===e.project.mainRoot;e.projectSynthesized||(r.push({branch:e.project.branch??null,path:e.project.path,opened:!0,isMain:!0,isCurrent:e.project.path===n}),i.add(e.project.path),e.project.branch!=null&&a.add(e.project.branch));let s=[...e.worktrees].sort((e,t)=>t.lastOpenedAt.localeCompare(e.lastOpenedAt));for(let e of s)i.has(e.path)||(r.push({branch:e.branch??null,path:e.path,opened:!0,isMain:!1,isCurrent:e.path===n}),i.add(e.path),e.branch!=null&&a.add(e.branch));if(o){let e=t.entries.filter(e=>e.branch!==null&&!a.has(e.branch)&&(e.worktreePath===null||!i.has(e.worktreePath))).sort((e,t)=>(e.branch??``).localeCompare(t.branch??``));for(let t of e)r.push({branch:t.branch,path:t.worktreePath,opened:t.worktreePath!==null,isMain:t.isMain,isCurrent:t.isCurrent}),t.branch!=null&&a.add(t.branch),t.worktreePath!=null&&i.add(t.worktreePath)}return r.sort((e,t)=>jC(e)-jC(t))}function jC(e){return e.isMain?0:e.opened?1:2}function MC(e){let t=e.split(/[/\\]/).filter(e=>e.length>0);return t.length>0?t[t.length-1]??e:e}function NC(e){let t=[],n=new Map;for(let r of e){let e=r.gitCommonDir,i=r.mainRoot;if(e===void 0||i===void 0){t.push({project:r,mainRoot:r.path,worktrees:[]});continue}let a=n.get(e);a===void 0&&(a=t.length,n.set(e,a),t.push({project:null,mainRoot:i,worktrees:[]}));let o=t[a];o!==void 0&&(r.isLinkedWorktree?o.worktrees.push(r):o.project===null&&(o.project=r))}return t.map(e=>{let t=e.project===null;return{project:e.project??{path:e.mainRoot,name:MC(e.mainRoot),lastOpenedAt:``},worktrees:e.worktrees,projectSynthesized:t}})}function PC(e){let t=(0,$.c)(14),{path:n,name:r,onRemoveRecent:i,testIdPrefix:a}=e,{_:o}=Bn(),s;t[0]!==o||t[1]!==r?(s=o({id:`Y6PKd1`,values:{name:r}}),t[0]=o,t[1]=r,t[2]=s):s=t[2];let c;t[3]===o?c=t[4]:(c=o({id:`Es-eZU`}),t[3]=o,t[4]=c);let l;t[5]!==i||t[6]!==n?(l=e=>{e.stopPropagation(),i(n)},t[5]=i,t[6]=n,t[7]=l):l=t[7];let u=`${a}-remove-${n}`,d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(zp,{"aria-hidden":`true`,className:`size-3.5`}),t[8]=d):d=t[8];let f;return t[9]!==s||t[10]!==c||t[11]!==l||t[12]!==u?(f=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,tabIndex:-1,"aria-hidden":`true`,"aria-label":s,title:c,onClick:l,className:`absolute top-1/2 right-1 size-6 -translate-y-1/2 text-muted-foreground opacity-0 transition-opacity group-hover/recent:opacity-100 focus-visible:opacity-100`,"data-testid":u,children:d}),t[9]=s,t[10]=c,t[11]=l,t[12]=u,t[13]=f):f=t[13],f}function FC(e){let t=(0,$.c)(13),{path:n,onRemoveRecent:r,testIdPrefix:i,children:a}=e,o;t[0]===a?o=t[1]:(o=(0,Z.jsx)(ta,{asChild:!0,children:a}),t[0]=a,t[1]=o);let s;t[2]!==r||t[3]!==n?(s=()=>r(n),t[2]=r,t[3]=n,t[4]=s):s=t[4];let c=`${i}-context-remove-${n}`,l,u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(zp,{"aria-hidden":`true`}),u=(0,Z.jsx)(Y,{id:`Es-eZU`}),t[5]=l,t[6]=u):(l=t[5],u=t[6]);let d;t[7]!==s||t[8]!==c?(d=(0,Z.jsx)(ra,{children:(0,Z.jsxs)(Zi,{onSelect:s,"data-testid":c,children:[l,u]})}),t[7]=s,t[8]=c,t[9]=d):d=t[9];let f;return t[10]!==o||t[11]!==d?(f=(0,Z.jsxs)(ea,{children:[o,d]}),t[10]=o,t[11]=d,t[12]=f):f=t[12],f}var IC=(0,Q.lazy)(()=>n(()=>import(`./BugReportHistoryDialog-BgcEcCCO.js`),__vite__mapDeps([6,7,1,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,2,3,29,30,31,32,33,4,34,35,36,37]),import.meta.url)),LC=3e3,RC=600,zC=20,BC=(e,t,n)=>CC(e,t,n,`CommandPalette`);function VC(e){window.location.assign(qp(e))}function HC(e,t){return e?.kind===`folder`||e?.kind===`folder-index`?e.folderPath:xm(t)}function UC(e){let t=(0,$.c)(27),{entry:n,query:r,onSelect:i,disabled:a}=e,o=r===void 0?``:r,s=a===void 0?!1:a,c;t[0]===n?c=t[1]:(c=`title`in n&&n.title?n.title:n.path.split(`/`).pop()??n.path,t[0]=n,t[1]=c);let l=c,u=`snippet`in n?n.snippet:void 0,d=`docExt`in n?n.docExt:void 0,f=`bodyIndexed`in n?n.bodyIndexed:void 0,p=`${n.kind} ${n.path}`,m=`command-palette-nav-${n.kind}-${n.path}`,h;t[2]!==f||t[3]!==d||t[4]!==n.kind||t[5]!==n.path?(h=(0,Z.jsx)(K,{bodyIndexed:f,className:`mt-0.5 size-4`,docExt:d,kind:n.kind,path:n.path}),t[2]=f,t[3]=d,t[4]=n.kind,t[5]=n.path,t[6]=h):h=t[6];let g;t[7]!==o||t[8]!==l?(g=(0,Z.jsx)(Mu,{className:`truncate font-medium`,children:(0,Z.jsx)(GC,{query:o,text:l})}),t[7]=o,t[8]=l,t[9]=g):g=t[9];let _;t[10]!==n.path||t[11]!==o?(_=(0,Z.jsx)(Mu,{className:`truncate text-muted-foreground text-xs`,children:(0,Z.jsx)(GC,{query:o,text:n.path})}),t[10]=n.path,t[11]=o,t[12]=_):_=t[12];let v;t[13]!==o||t[14]!==u?(v=u?(0,Z.jsx)(Mu,{className:`max-h-10 overflow-hidden text-muted-foreground text-xs leading-relaxed`,children:(0,Z.jsx)(GC,{query:o,text:u})}):null,t[13]=o,t[14]=u,t[15]=v):v=t[15];let y;t[16]!==g||t[17]!==_||t[18]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[g,_,v]}),t[16]=g,t[17]=_,t[18]=v,t[19]=y):y=t[19];let b;return t[20]!==s||t[21]!==i||t[22]!==y||t[23]!==p||t[24]!==m||t[25]!==h?(b=(0,Z.jsxs)(fn,{value:p,onSelect:i,disabled:s,"data-testid":m,className:`items-start`,children:[h,y]}),t[20]=s,t[21]=i,t[22]=y,t[23]=p,t[24]=m,t[25]=h,t[26]=b):b=t[26],b}function WC(e){let t=(0,$.c)(5),{mode:n,inExclusiveMode:r,paletteModeKind:i}=e;if(r||i!==`normal`||n===`idle`||n===`content`)return null;let a=`command-palette-search-hint-${n}`,o;t[0]===n?o=t[1]:(o=n===`name-only`?(0,Z.jsx)(Y,{id:`GuLeuE`,values:{0:Lc(`find`)},components:{0:(0,Z.jsx)(en,{"aria-label":Ac(`find`)})}}):n===`truncated`?(0,Z.jsx)(Y,{id:`-q4abP`}):(0,Z.jsx)(Y,{id:`DbILZA`}),t[0]=n,t[1]=o);let s;return t[2]!==a||t[3]!==o?(s=(0,Z.jsx)(`div`,{"aria-live":`polite`,"data-testid":a,className:`border-t px-3 py-2 text-muted-foreground text-xs`,children:o}),t[2]=a,t[3]=o,t[4]=s):s=t[4],s}function GC(e){let t=(0,$.c)(5),{text:n,query:r}=e,i;t[0]!==r||t[1]!==n?(i=AS(n,r).map(KC),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a;return t[3]===i?a=t[4]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[3]=i,t[4]=a),a}function KC(e){let t=`${e.start}:${e.match?`match`:`plain`}`;return e.match?(0,Z.jsx)(`mark`,{className:`rounded-sm bg-primary/10 px-0.5 font-semibold text-primary`,children:e.text},t):(0,Z.jsx)(`span`,{children:e.text},t)}function qC({searchResults:e,fallbackSearchResults:t,searchStatus:n}){return e.length>0?e:n===`success`?[]:t}function JC(e){let t=(0,$.c)(150),{bridge:n,open:r,onOpenChange:a}=e,o=n===void 0?null:n,{_:s}=Bn(),c=OC(),[l,u]=(0,Q.useState)(``),d=(0,Q.useDeferredValue)(l),f=d.trim(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=[],t[0]=p):p=t[0];let[m,h]=(0,Q.useState)(p),[g,_]=(0,Q.useState)(`idle`),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(!1),w;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(w=[],t[1]=w):w=t[1];let[T,E]=(0,Q.useState)(w),[D,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(`idle`),j;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(j=[],t[2]=j):j=t[2];let[M,N]=(0,Q.useState)(j),P;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(P=[],t[3]=P):P=t[3];let[F,I]=(0,Q.useState)(P),[L,R]=(0,Q.useState)(null),[z,B]=(0,Q.useState)(!1),[V,ee]=(0,Q.useState)(!1),[H,U]=(0,Q.useState)(null),[W,G]=(0,Q.useState)(!1),[te,ne]=(0,Q.useState)(!1),[re,K]=(0,Q.useState)(!1),{createBlank:ie}=yC(),q=Yt(),ae;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(ae=[],t[4]=ae):ae=t[4];let[oe,se]=(0,Q.useState)(ae),[ce,le]=(0,Q.useState)(`idle`),ue;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(ue=[],t[5]=ue):ue=t[5];let[de,fe]=(0,Q.useState)(ue),[pe,J]=(0,Q.useState)(`idle`),me=(0,Q.useRef)(!1),he=(0,Q.useRef)(null),ge=(0,Q.useRef)(null),_e=(0,Q.useRef)(null),ve=(0,Q.useRef)(null),{activeDocName:ye,activeTarget:be}=Et(),{pages:xe,pageTitles:Se,pageMeta:Ce,folderPaths:we,filePaths:Te,loading:Ee}=Nd(),De=gu(),{states:Oe,refresh:ke}=Sr(),{dispatch:Ae}=Ll(),je;t[6]===r?je=t[7]:(je={enabled:r},t[6]=r,t[7]=je);let{status:Me,refresh:Ne}=Rd(je),Pe=(Me?.enabled??!1)&&(Me?.keyPresent??!1),Fe=Me?.embedded??0,Ie=Me?.total??0,Le=Pe&&Ie>0&&Fe<Ie,Re;t[8]!==S||t[9]!==r||t[10]!==Ne||t[11]!==Le?(Re=()=>{if(!r||!S||!Le)return;let e=window.setInterval(()=>Ne(),2500);return()=>window.clearInterval(e)},t[8]=S,t[9]=r,t[10]=Ne,t[11]=Le,t[12]=Re):Re=t[12];let ze;t[13]!==S||t[14]!==r||t[15]!==Le?(ze=[r,S,Le],t[13]=S,t[14]=r,t[15]=Le,t[16]=ze):ze=t[16],(0,Q.useEffect)(Re,ze);let Ve=Rl({docName:ye,workspace:De}),He=CS(xe,we,Se,Ce,Te),Ue=hS(F,new Set(He.map(QC))),We=o?.config.projectPath??null,Ge=o?M.filter(e=>e.path!==We):[],Ke=bC(),qe=o&&Ke?Ke.entries.filter(ZC):[],Je;t[17]!==ye||t[18]!==be?(Je=HC(be,ye),t[17]=ye,t[18]=be,t[19]=Je):Je=t[19];let Ye=Je,Xe=f===``?[]:OS(He,f,8),Qe,$e;t[20]!==a||t[21]!==r?(Qe=()=>{let e=function(e){Mc(e,`command-palette`)&&(e.preventDefault(),!(!r&&Mr())&&a(!r))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},$e=[a,r],t[20]=a,t[21]=r,t[22]=Qe,t[23]=$e):(Qe=t[22],$e=t[23]),(0,Q.useEffect)(Qe,$e);let et,tt;t[24]!==s||t[25]!==o||t[26]!==r||t[27]!==ke?(et=()=>{if(r){if(I(fS()),ke(),o){let e=!1;return BC(async()=>{let t=await o.project.listRecent();e||N(t)},s({id:`fYKgzG`})),()=>{e=!0}}return}u(``),se([]),le(`idle`),me.current=!1,fe([]),J(`idle`),C(!1),_e.current?.abort(),_e.current=null,ve.current!==null&&(window.clearTimeout(ve.current),ve.current=null),E([]),O(null),A(`idle`)},tt=[r,o,ke,s],t[24]=s,t[25]=o,t[26]=r,t[27]=ke,t[28]=et,t[29]=tt):(et=t[28],tt=t[29]),(0,Q.useEffect)(et,tt);let nt;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(nt=()=>{he.current&&(he.current.scrollTop=0)},t[30]=nt):nt=t[30];let rt;t[31]===l?rt=t[32]:(rt=[l],t[31]=l,t[32]=rt),(0,Q.useEffect)(nt,rt);let it=new Set(oe.map(XC)),at=S?{kind:`normal`,query:d}:LS(d,it),ot=at.kind!==`normal`,st=ot||S,ct=at.kind===`tag-list`?at.query:``,lt=at.kind===`tag-docs`?at.tagName:``,ut=l.trim(),dt=S?FS({query:ut,firedQuery:D,status:k,resultCount:T.length}):null,ft=dt?.submit?.query??``,ht=dt?.results.forQuery??``,gt,_t;t[33]!==ot||t[34]!==r?(gt=()=>{if(!r||!ot||me.current)return;me.current=!0,le(`loading`);let e=!1;return zS().then(t=>{e||(se(t),le(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tags failed`,t),se([]),le(`error`))}),()=>{e=!0}},_t=[r,ot],t[33]=ot,t[34]=r,t[35]=gt,t[36]=_t):(gt=t[35],_t=t[36]),(0,Q.useEffect)(gt,_t);let vt=at.kind===`tag-docs`?at.tagName:null;(0,Q.useEffect)(()=>{if(!r||vt===null){fe([]),J(`idle`);return}J(`loading`),fe([]);let e=!1;return BS(vt).then(t=>{e||(fe(t),J(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tag docs failed`,t),fe([]),J(`error`))}),()=>{e=!0}},[r,vt]),(0,Q.useEffect)(()=>{if(!r||!f||st||Ee){h([]),_(`idle`),y(!1),x(!1);return}let e=!1,t=!1,n=0,i=null,a,o;_(`loading`);let s=()=>e||n>=zC?!1:(n+=1,o=window.setTimeout(l,RC),!0),c=()=>{e||t&&s()||(h([]),_(`error`),y(!1),x(!1))};function l(){let n=new AbortController;i=n,a=window.setTimeout(()=>{n.abort(),c()},LC),MS(f,{signal:n.signal}).then(n=>{let{entries:r,truncated:i,ready:o}=n;if(window.clearTimeout(a),!e){if(!o){t||(t=!0,h([]),y(!1),x(!0),_(`success`)),s()||x(!1);return}h(r),y(i),x(!1),_(`success`)}}).catch(t=>{window.clearTimeout(a),!e&&(t instanceof Error&&t.name===`AbortError`||c())})}return l(),()=>{e=!0,window.clearTimeout(a),window.clearTimeout(o),i?.abort()}},[r,f,st,Ee]);let yt;t[37]!==s||t[38]!==a?(yt=(e,t)=>{let n=t===void 0?s({id:`uuoHOU`}):t;a(!1),BC(async()=>{await e()},n)},t[37]=s,t[38]=a,t[39]=yt):yt=t[39];let bt=yt,xt;t[40]!==s||t[41]!==o?(xt=e=>{o&&BC(async()=>{await o.project.removeRecent(e),N(t=>t.filter(t=>t.path!==e))},s({id:`viwC-K`}))},t[40]=s,t[41]=o,t[42]=xt):xt=t[42];let St=xt,Ct;t[43]!==s||t[44]!==o||t[45]!==bt?(Ct=e=>{if(!o)return;let t=e.worktreePath;if(t!==null){bt(()=>o.project.open({path:t,target:`new-window`,entryPoint:`worktree`}),s({id:`LwMxXg`}));return}let n=e.branch;n!==null&&bt(async()=>{let e=await o.worktree.create({branch:n,createBranch:!1});if(!e.ok)throw Error(e.reason);Rh(),await o.project.open({path:e.path,target:`new-window`,entryPoint:`worktree`})},s({id:`LwMxXg`}))},t[43]=s,t[44]=o,t[45]=bt,t[46]=Ct):Ct=t[46];let wt=Ct,Tt;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Tt=function(e){let t={kind:e.kind,path:e.path,lastOpenedAt:new Date().toISOString()},n=mS(fS(),t);pS(n),I(n)},t[47]=Tt):Tt=t[47];let Dt=Tt,Ot;t[48]===a?Ot=t[49]:(Ot=function(e){a(!1),Dt(e),VC(e.path)},t[48]=a,t[49]=Ot);let kt=Ot,jt=!st&&f===``&&Ue.length>0,Mt=qC({searchResults:m,fallbackSearchResults:Xe,searchStatus:g}),Nt=!st&&Mt.length>0,Pt=!st&&f!==``&&(Ee||b)&&!Nt,Ft=!st&&f!==``&&g===`loading`&&!Nt&&!Pt,It=!st&&o!==null&&Ge.length>0&&(f===``||Ge.some(e=>NS(`${e.name} ${e.path}`,d,[`open recent project`]))),Lt=qe.filter(e=>f===``||NS(e.branch??``,d,[`worktree branch`])),Rt=!st&&o!==null&&Lt.length>0,zt=Be(),Bt=!st&&!zt&&Ve!==null&&(f===``||qa.some(e=>{let t=e.displayName;return NS(s({id:`wHZ58m`,values:{displayName:t}}),d,[e.id,`agent handoff`,`open in`])})),Vt=at.kind===`tag-list`?RS(oe,at.query):[],Ht=at.kind===`tag-list`&&ce!==`loading`&&Vt.length===0,Ut=at.kind===`tag-docs`&&pe===`success`&&de.length===0,Wt=bl(),Gt;t[50]===a?Gt=t[51]:(Gt=e=>{a(!1),hr(e,{launcherBorne:!0})},t[50]=a,t[51]=Gt);let Kt=Gt,qt;t[52]!==o||t[53]!==a?(qt=e=>{a(!1),gh(e,o?{okDesktop:{shell:o.shell}}:{okDesktop:void 0})},t[52]=o,t[53]=a,t[54]=qt):qt=t[54];let Xt=qt,Zt;t[55]===a?Zt=t[56]:(Zt=()=>a(!1),t[55]=a,t[56]=Zt);let Qt;t[57]===R?Qt=t[58]:(Qt=e=>R(e),t[57]=R,t[58]=Qt);let $t;t[59]===B?$t=t[60]:($t=()=>B(!0),t[59]=B,t[60]=$t);let tn;t[61]===ee?tn=t[62]:(tn=()=>ee(!0),t[61]=ee,t[62]=tn);let nn;t[63]===U?nn=t[64]:(nn=()=>U({launcherBorne:!0}),t[63]=U,t[64]=nn);let rn;t[65]===G?rn=t[66]:(rn=()=>{ne(!0),G(!0)},t[65]=G,t[66]=rn);let an;t[67]===K?an=t[68]:(an=()=>K(!0),t[67]=K,t[68]=an);let on;t[69]===ie?on=t[70]:(on=()=>void ie(`project`),t[69]=ie,t[70]=on);let sn;t[71]===q?sn=t[72]:(sn=()=>q?.(),t[71]=q,t[72]=sn);let cn={bridge:o,singleFile:c,activeDocName:ye,contextualTargetKind:Xx(be),viewMenuState:Wt,emitMenuAction:Kt,runAction:bt,openExternalUrl:Xt,closePalette:Zt,openNewItemDialog:Qt,openSeedDialog:$t,openCreateProjectDialog:tn,openReportBugDialog:nn,openBugReportHistory:rn,openFeedbackDialog:an,createBlankSkill:on,openBlobRun:sn},ln=st?[]:oS.flatMap(e=>{if(!e.available(cn)||e.visibility===`search-only`&&f===``)return[];let t=e.label(cn);return NS(t,d,e.keywords)?[{cmd:e,label:t}]:[]}),un=ln.length>0,dn;t[73]===s?dn=t[74]:(dn=e=>{switch(e){case`commands`:return s({id:`45MZFs`});case`project`:return s({id:`e0NrBM`});case`file`:return s({id:`J2eKUI`});case`view`:return s({id:`jpctdh`});case`terminal`:return s({id:`ALhMYW`});case`app`:return s({id:`IrC12v`})}},t[73]=s,t[74]=dn);let pn=dn,mn=e=>{let t=ln.filter(t=>t.cmd.group===e);return t.length===0?null:(0,Z.jsx)(vn,{heading:pn(e),children:t.map(e=>{let{cmd:t,label:n}=e,r=t.shortcutId!==void 0&&(t.shortcutDesktopOnly!==!0||o!==null)?Lc(t.shortcutId):null;return(0,Z.jsxs)(fn,{value:`${n} ${t.keywords.join(` `)}`,onSelect:()=>t.dispatch(cn),"data-testid":`command-palette-${t.id}`,children:[(0,Z.jsx)(t.icon,{}),(0,Z.jsx)(`span`,{children:n}),t.checked?.(cn)?(0,Z.jsx)(Uu,{className:`ml-auto text-muted-foreground`,"aria-hidden":`true`}):null,r?(0,Z.jsx)(Ze,{children:r}):null]},t.id)})},e)},hn=st||jt||Nt||Ft||Pt||It||Bt||un,gn;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(gn=function(e){u(`${IS}${e}`)},t[75]=gn):gn=t[75];let _n=gn,yn;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(yn=function(){_e.current?.abort(),_e.current=null,ve.current!==null&&(window.clearTimeout(ve.current),ve.current=null),E([]),O(null),A(`idle`)},t[76]=yn):yn=t[76];let bn=yn,xn;t[77]===l?xn=t[78]:(xn=function(){C(!0),l.startsWith(`tag:`)&&u(l.slice(IS.length)),bn(),ge.current?.focus()},t[77]=l,t[78]=xn);let Sn=xn,Cn;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(Cn=function(){C(!1),u(``),bn(),ge.current?.focus()},t[79]=Cn):Cn=t[79];let wn=Cn,Tn=function(e){let t=e.trim();if(!t||Ee)return;_e.current?.abort(),ve.current!==null&&window.clearTimeout(ve.current);let n=new AbortController;_e.current=n,A(`loading`);let r=!1,i=window.setTimeout(()=>{r=!0,n.abort(),A(`error`)},LC);ve.current=i,MS(t,{signal:n.signal,semantic:!0,limit:30}).then(e=>{let{entries:r}=e;En(i,n),E(r),O(t),A(`success`)}).catch(e=>{En(i,n),!(e instanceof Error&&e.name===`AbortError`&&!r)&&(console.debug(`[semantic-search] fire failed`,{timedOut:r,error:e}),A(`error`))})};function En(e,t){window.clearTimeout(e),ve.current===e&&(ve.current=null),_e.current===t&&(_e.current=null)}let Dn=function(e){!S||e.key!==`Enter`||(dt?.submit?(e.preventDefault(),e.stopPropagation(),Tn(dt.submit.query)):k===`loading`&&(e.preventDefault(),e.stopPropagation()))},On;t[80]===S?On=t[81]:(On=function(e){S&&(e.preventDefault(),wn())},t[80]=S,t[81]=On);let kn=On,An;t[82]===s?An=t[83]:(An=s({id:`1bDVu5`}),t[82]=s,t[83]=An);let jn;t[84]===s?jn=t[85]:(jn=s({id:`5GRxoA`}),t[84]=s,t[85]=jn);let Mn;t[86]===Symbol.for(`react.memo_cache_sentinel`)?(Mn={shouldFilter:!1,vimBindings:!1,className:`[&_[cmdk-input-wrapper]_svg]:h-4 [&_[cmdk-input-wrapper]_svg]:w-4 [&_[cmdk-item]_svg]:h-4 [&_[cmdk-item]_svg]:w-4`},t[86]=Mn):Mn=t[86];let Nn;t[87]!==s||t[88]!==S?(Nn=s(S?{id:`zXj1rA`}:{id:`ggs9f8`}),t[87]=s,t[88]=S,t[89]=Nn):Nn=t[89];let Pn;t[90]!==S||t[91]!==ot?(Pn=()=>{S&&(C(!1),bn()),u(ot?``:IS),ge.current?.focus()},t[90]=S,t[91]=ot,t[92]=Pn):Pn=t[92];let Fn=ot?`border-primary/30 bg-primary/10 text-primary`:`border-border bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`,In;t[93]===Fn?In=t[94]:(In=gr(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors`,Fn),t[93]=Fn,t[94]=In);let Ln,Rn;t[95]===Symbol.for(`react.memo_cache_sentinel`)?(Ln=(0,Z.jsx)(ep,{className:`size-3.5`}),Rn=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`0rwwOn`})}),t[95]=Ln,t[96]=Rn):(Ln=t[95],Rn=t[96]);let zn;t[97]!==ot||t[98]!==Pn||t[99]!==In?(zn=(0,Z.jsxs)(`button`,{type:`button`,onClick:Pn,"data-testid":`command-palette-filter-tag`,"data-active":ot,"aria-pressed":ot,className:In,children:[Ln,Rn]}),t[97]=ot,t[98]=Pn,t[99]=In,t[100]=zn):zn=t[100];let Vn;t[101]!==Sn||t[102]!==S||t[103]!==Pe?(Vn=Pe?(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>S?wn():Sn(),"data-testid":`command-palette-filter-semantic`,"data-active":S,"aria-pressed":S,className:gr(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors`,S?`border-primary/30 bg-primary/10 text-primary`:`border-border bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`),children:[(0,Z.jsx)(pt,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`9tJX8r`})})]}):null,t[101]=Sn,t[102]=S,t[103]=Pe,t[104]=Vn):Vn=t[104];let Hn;t[105]!==zn||t[106]!==Vn?(Hn=(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 border-b px-3 py-2`,children:[zn,Vn]}),t[105]=zn,t[106]=Vn,t[107]=Hn):Hn=t[107];let Un;t[108]===Pt?Un=t[109]:(Un=Pt?(0,Z.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-6 text-muted-foreground text-sm`,role:`status`,"aria-live":`polite`,"data-testid":`command-palette-search-preparing`,children:[(0,Z.jsx)(ip,{"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(Y,{id:`yIPXut`})]}):null,t[108]=Pt,t[109]=Un);let Wn;t[110]!==Nt||t[111]!==Ft?(Wn=Ft&&!Nt?(0,Z.jsx)(mt,{children:(0,Z.jsx)(Y,{id:`WRNXKp`})}):null,t[110]=Nt,t[111]=Ft,t[112]=Wn):Wn=t[112];let Gn=WC,Kn=PS(f,Mt,{truncated:v}),qn;t[113]!==Gn||t[114]!==st||t[115]!==at.kind||t[116]!==Kn?(qn=(0,Z.jsx)(Gn,{mode:Kn,inExclusiveMode:st,paletteModeKind:at.kind}),t[113]=Gn,t[114]=st,t[115]=at.kind,t[116]=Kn,t[117]=qn):qn=t[117];let Jn=L===`file`,Yn;t[118]===R?Yn=t[119]:(Yn=e=>{e||R(null)},t[118]=R,t[119]=Yn);let Xn;t[120]!==Ye||t[121]!==Jn||t[122]!==Yn?(Xn=(0,Z.jsx)(nC,{open:Jn,onOpenChange:Yn,kind:`file`,initialDir:Ye}),t[120]=Ye,t[121]=Jn,t[122]=Yn,t[123]=Xn):Xn=t[123];let Zn=L===`folder`,Qn;t[124]===R?Qn=t[125]:(Qn=e=>{e||R(null)},t[124]=R,t[125]=Qn);let $n;t[126]!==Ye||t[127]!==Zn||t[128]!==Qn?($n=(0,Z.jsx)(nC,{open:Zn,onOpenChange:Qn,kind:`folder`,initialDir:Ye}),t[126]=Ye,t[127]=Zn,t[128]=Qn,t[129]=$n):$n=t[129];let er;t[130]!==z||t[131]!==B?(er=(0,Z.jsx)(uC,{open:z,onOpenChange:B}),t[130]=z,t[131]=B,t[132]=er):er=t[132];let tr;t[133]!==o||t[134]!==V||t[135]!==ee?(tr=o?(0,Z.jsx)(Lx,{open:V,onOpenChange:ee,bridge:o}):null,t[133]=o,t[134]=V,t[135]=ee,t[136]=tr):tr=t[136];let nr;t[137]!==o||t[138]!==H||t[139]!==U?(nr=o?(0,Z.jsx)(Fr,{open:H!==null,onOpenChange:e=>{e||U(null)},launcherBorne:H?.launcherBorne===!0}):null,t[137]=o,t[138]=H,t[139]=U,t[140]=nr):nr=t[140];let rr;t[141]!==o||t[142]!==te||t[143]!==W||t[144]!==G||t[145]!==U?(rr=o&&te?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(IC,{open:W,onOpenChange:G,onReportABug:()=>{G(!1),U({launcherBorne:!1})}})}):null,t[141]=o,t[142]=te,t[143]=W,t[144]=G,t[145]=U,t[146]=rr):rr=t[146];let ir;return t[147]!==re||t[148]!==K?(ir=(0,Z.jsx)(HS,{open:re,onOpenChange:K,source:`command_palette`}),t[147]=re,t[148]=K,t[149]=ir):ir=t[149],(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(i,{open:r,onOpenChange:a,title:An,description:jn,className:`sm:max-w-2xl`,commandProps:Mn,onEscapeKeyDown:kn,children:[(0,Z.jsx)(Jt,{ref:ge,value:l,onValueChange:u,onKeyDown:Dn,placeholder:Nn}),Hn,(0,Z.jsxs)(At,{ref:he,className:`subtle-scrollbar`,children:[S&&dt?(0,Z.jsxs)(Z.Fragment,{children:[Le?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,"data-testid":`command-palette-semantic-indexing`,children:[(0,Z.jsx)(ip,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`kCNU4q`,values:{semanticIndexedCount:Fe,semanticTotalCount:Ie}})]}):null,dt.submit?(0,Z.jsx)(vn,{children:(0,Z.jsx)(fn,{value:`semantic-submit`,onSelect:()=>Tn(ft),"data-testid":`command-palette-semantic-submit`,children:dt.submit.kind===`retry`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(pt,{}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-amber-700 dark:text-amber-400`,children:(0,Z.jsx)(Y,{id:`w4ZzmQ`})}),(0,Z.jsx)(Ze,{children:`↵`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(pt,{}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,Z.jsx)(Y,{id:`FNTx6u`,values:{semanticSubmitQuery:ft}})}),(0,Z.jsx)(Ze,{children:`↵`})]})})}):null,dt.notice===`empty`?(0,Z.jsx)(mt,{"data-testid":`command-palette-semantic-empty`,children:(0,Z.jsx)(Y,{id:`l5J_HM`,components:{0:(0,Z.jsx)(en,{"aria-label":s({id:`9Vnjc9`})})}})}):null,dt.notice===`searching`?(0,Z.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-6 text-muted-foreground text-sm`,role:`status`,"aria-live":`polite`,"data-testid":`command-palette-semantic-searching`,children:[(0,Z.jsx)(ip,{"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(Y,{id:`PBwmDJ`})]}):null,dt.notice===`no-results`?(0,Z.jsx)(mt,{"data-testid":`command-palette-semantic-no-results`,children:(0,Z.jsx)(Y,{id:`yFyZMJ`,values:{semanticQueryText:ut}})}):null,dt.results.show?(0,Z.jsx)(vn,{heading:dt.results.dimmed?s({id:`QlxHAH`,values:{semanticResultsLabel:ht}}):s({id:`9tJX8r`}),children:(0,Z.jsx)(`div`,{"data-testid":`command-palette-semantic-results`,"data-dimmed":dt.results.dimmed,children:T.map(e=>(0,Z.jsx)(UC,{entry:e,disabled:dt.results.dimmed,onSelect:()=>kt(e)},dS(e.kind,e.path)))})}):null]}):null,Un,Wn,hn?null:(0,Z.jsx)(mt,{children:g===`error`?(0,Z.jsx)(Y,{id:`pkAft1`}):(0,Z.jsx)(Y,{id:`i3f2kh`})}),at.kind===`tag-list`?(0,Z.jsxs)(vn,{heading:at.query?s({id:`evs0iw`,values:{tagListQuery:ct}}):s({id:`2QM24L`}),children:[ce===`loading`?(0,Z.jsx)(mt,{children:(0,Z.jsx)(Y,{id:`a_u4ck`})}):null,ce===`error`?(0,Z.jsx)(mt,{children:(0,Z.jsx)(Y,{id:`qTcZZu`,components:{0:(0,Z.jsx)(en,{"aria-label":s({id:`69KLIV`})})}})}):null,Ht?(0,Z.jsx)(mt,{children:at.query?s({id:`X0ttSN`,values:{tagListQuery:ct}}):s({id:`JLUTgi`})}):null,Vt.map(e=>(0,Z.jsxs)(fn,{value:`tag ${e.name}`,onSelect:()=>_n(e.name),"data-testid":`command-palette-tag-${e.name}`,children:[(0,Z.jsx)(ep,{}),(0,Z.jsx)(Mu,{className:`min-w-0 flex-1 truncate font-medium`,children:e.name}),(0,Z.jsx)(`span`,{className:`ml-auto shrink-0 text-[11px] text-muted-foreground tabular-nums`,children:(0,Z.jsx)(Y,{id:`fVcm9t`,values:{0:e.count}})})]},`tag:${e.name}`))]}):null,at.kind===`tag-docs`?(0,Z.jsxs)(vn,{heading:s({id:`hGmuTc`,values:{tagDocsName:lt}}),children:[pe===`loading`?(0,Z.jsx)(mt,{children:(0,Z.jsx)(Y,{id:`pWbsW6`})}):null,pe===`error`?(0,Z.jsx)(mt,{children:(0,Z.jsx)(Y,{id:`z_4xza`,components:{0:(0,Z.jsx)(en,{"aria-label":s({id:`69KLIV`})})}})}):null,Ut?(0,Z.jsx)(mt,{children:s({id:`NIWAux`,values:{tagDocsName:lt}})}):null,de.map(e=>{let t=e.title||e.docName.split(`/`).pop()||e.docName,n=e.matchingTags.filter(e=>e!==at.tagName).map(YC).join(`, `);return(0,Z.jsxs)(fn,{value:`tag-doc ${e.docName}`,onSelect:()=>{a(!1),VC(e.docName)},"data-testid":`command-palette-tag-doc-${e.docName}`,className:`items-start`,children:[(0,Z.jsx)(xi,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(Mu,{className:`truncate font-medium`,children:t}),(0,Z.jsx)(Mu,{className:`truncate text-muted-foreground text-xs`,children:e.docName}),e.matchingTags.length>0&&e.matchingTags.some(e=>e!==at.tagName)?(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-[11px]`,children:(0,Z.jsx)(Y,{id:`CvsD6Y`,values:{viaTags:n}})}):null]})]},`tag-doc:${e.docName}`)})]}):null,jt?(0,Z.jsx)(vn,{heading:s({id:`MmDDWK`}),children:Ue.map(e=>(0,Z.jsx)(UC,{entry:e,onSelect:()=>kt(e)},dS(e.kind,e.path)))}):null,mn(`commands`),Bt?(0,Z.jsx)(vn,{heading:s({id:`O7_W_a`}),children:qa.filter(e=>{let t=e.displayName;return NS(s({id:`wHZ58m`,values:{displayName:t}}),d,[e.id,`agent handoff`,`open in`])}).map(e=>{let t=Oe[e.id],n=t.installed===!0&&Ve!==null,r=e.displayName,i=t.installed===null?s({id:`IA6JW2`}):t.installed===!1?s({id:`5SwVv1`}):null,o=s(i?{id:`rl35Vz`,values:{displayName:r,hint:i}}:{id:`wHZ58m`,values:{displayName:r}});return(0,Z.jsxs)(fn,{value:`send to ai ${e.displayName} desktop ${e.id} agent open in`,disabled:!n,onSelect:()=>{!n||!Ve||(a(!1),Ae(e.id,Ve))},"data-testid":`command-palette-open-in-${e.id}`,"aria-label":o,children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`wHZ58m`,values:{displayName:r}})}),i?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-auto text-muted-foreground text-xs`,children:i}):null]},e.id)})}):null,mn(`project`),It&&o?(0,Z.jsx)(vn,{heading:s({id:`3iyGWF`}),children:Ge.filter(e=>NS(`${e.name} ${e.path}`,d,[`open recent project`])).slice(0,10).map(e=>{let t=e.isLinkedWorktree===!0,n=t?vu:Kf,r=t&&e.mainRoot!==void 0?MC(e.mainRoot):null;return(0,Z.jsx)(FC,{path:e.path,onRemoveRecent:St,testIdPrefix:`command-palette-recent`,children:(0,Z.jsxs)(`div`,{className:`group/recent relative flex items-center`,children:[(0,Z.jsxs)(fn,{value:`${e.name} ${e.path} recent project`,onSelect:()=>bt(()=>o.project.open({path:e.path,target:`new-window`,entryPoint:`recents`}),s({id:`SUOoXn`})),"data-testid":`command-palette-recent-${e.path}`,className:`flex-1 items-start pr-8`,children:[(0,Z.jsx)(n,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(Mu,{className:`truncate font-medium`,children:e.name}),r===null?null:(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`8Gzz2G`,values:{worktreeOf:r}})}),(0,Z.jsx)(Mu,{className:`truncate text-muted-foreground text-xs`,children:e.path})]})]}),(0,Z.jsx)(PC,{path:e.path,name:e.name,onRemoveRecent:St,testIdPrefix:`command-palette-recent`})]})},e.path)})}):null,Rt&&o?(0,Z.jsx)(vn,{heading:s({id:`sxjyRq`}),children:Lt.slice(0,10).map(e=>(0,Z.jsxs)(fn,{value:`${e.branch} worktree branch`,onSelect:()=>wt(e),"data-testid":`command-palette-worktree-${e.branch}`,className:`items-start`,children:[(0,Z.jsx)(vu,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(Mu,{className:`truncate font-medium`,children:e.branch}),e.worktreePath===null?(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:s({id:`iO8V-7`})}):(0,Z.jsx)(Mu,{className:`truncate text-muted-foreground text-xs`,children:e.worktreePath})]})]},e.branch))}):null,[`file`,`view`,`terminal`,`app`].map(e=>mn(e)),Nt?(0,Z.jsx)(vn,{heading:s({id:`A1taO8`}),children:Mt.map(e=>(0,Z.jsx)(UC,{entry:e,query:f,onSelect:()=>kt(e)},dS(e.kind,e.path)))}):null]}),qn]}),Xn,$n,er,tr,nr,rr,ir]})}function YC(e){return`#${e}`}function XC(e){return e.name}function ZC(e){return e.branch!==null&&!e.isCurrent}function QC(e){return dS(e.kind,e.path)}var $C=500;function ew(e,t,n){return t?`terminal`:e===null&&n?`retrying`:`hidden`}function tw(e){return e?.kind===`null-collab`}function nw(e){if(e===null)return Hc._({id:`Ua78MH`});if(e.kind===`null-collab`)return Hc._({id:`tz_FDV`});if(e.code===`network`)return Hc._({id:`2L8aeZ`});if(e.code===`invalid-body`)return Hc._({id:`FRYB1Q`});let t=e.code;return Hc._({id:`4nj6n8`,values:{code:t}})}function rw(){let e=(0,$.c)(21),t=Yt(),{collabUrl:n,collabTerminal:r,collabLastError:i,retryCollab:a}=Et(),[o,s]=(0,Q.useState)(!1),c,l;e[0]!==r||e[1]!==n?(c=()=>{if(n!==null||r){s(!1);return}let e=setTimeout(()=>s(!0),$C);return()=>clearTimeout(e)},l=[n,r],e[0]=r,e[1]=n,e[2]=c,e[3]=l):(c=e[2],l=e[3]),(0,Q.useEffect)(c,l);let u=ew(n,r,o);if(u===`hidden`)return null;if(u===`terminal`){let n;e[4]===i?n=e[5]:(n=tw(i),e[4]=i,e[5]=n);let r=n,o;e[6]===i?o=e[7]:(o=nw(i),e[6]=i,e[7]=o);let s=o,c;e[8]!==s||e[9]!==r?(c=(0,Z.jsx)(`span`,{children:r?(0,Z.jsx)(Y,{id:`AAlr5Y`,components:{0:(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`})}}):(0,Z.jsx)(Y,{id:`noH1JX`,values:{errorDetail:s},components:{0:(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`}),1:(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`})}})}),e[8]=s,e[9]=r,e[10]=c):c=e[10];let l;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Y,{id:`6gRgw8`}),e[11]=l):l=e[11];let u;e[12]===a?u=e[13]:(u=(0,Z.jsx)(`button`,{type:`button`,onClick:a,className:`bg-red-950 text-red-50 px-2 py-0.5 rounded text-xs font-medium hover:bg-red-900`,children:l}),e[12]=a,e[13]=u);let d;e[14]===t?d=e[15]:(d=t?(0,Z.jsx)(`button`,{type:`button`,onClick:t,"aria-label":Hc._({id:`MsARMw`}),title:Hc._({id:`MsARMw`}),className:`ml-1 flex items-center rounded bg-red-100/60 px-1.5 py-1 transition-colors hover:bg-red-100/90`,children:(0,Z.jsx)(kr,{size:22,trackMouse:!1,variant:`sleeping`})}):null,e[14]=t,e[15]=d);let f;return e[16]!==c||e[17]!==u||e[18]!==d?(f=(0,Z.jsxs)(`div`,{role:`alert`,"aria-live":`assertive`,className:`fixed top-0 inset-x-0 z-50 bg-red-500/95 text-red-950 text-sm text-center py-2 px-4 pl-[var(--ok-titlebar-reserve-left,1rem)] shadow-md flex items-center justify-center gap-3 flex-wrap`,children:[c,u,d]}),e[16]=c,e[17]=u,e[18]=d,e[19]=f):f=e[19],f}let d;return e[20]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`fixed top-0 inset-x-0 z-50 bg-amber-500/95 text-amber-950 text-sm text-center py-2 px-4 pl-[var(--ok-titlebar-reserve-left,1rem)] shadow-md`,children:(0,Z.jsx)(Y,{id:`UYcGIW`})}),e[20]=d):d=e[20],d}function iw(e){let t=(0,$.c)(5),{bridge:n}=e,[r,i]=(0,Q.useState)(!1),a,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>fr(e=>{e===`new-project`&&i(!0)}),o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Q.useEffect)(a,o);let s;return t[2]!==n||t[3]!==r?(s=(0,Z.jsx)(Lx,{open:r,onOpenChange:i,bridge:n}),t[2]=n,t[3]=r,t[4]=s):s=t[4],s}function aw(e,t){e.chain().focus().insertContent({type:`text`,text:t}).run()}function ow(e){if(e.isDestroyed)return null;try{let t=e.view.coordsAtPos(e.state.selection.from);return{left:t.left,top:t.top,bottom:t.bottom}}catch{return null}}function sw(){let e=(0,$.c)(29),{_:t}=Bn(),[n,r]=(0,Q.useState)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=function(e){let t=e.detail;if(!t?.editor||t.editor.isDestroyed)return;let n=ow(t.editor);n&&r({editor:t.editor,...n})};return document.addEventListener(Mn,e),()=>document.removeEventListener(Mn,e)},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),(0,Q.useEffect)(i,a);let o=n?.editor??null,s,c;if(e[2]===o?(s=e[3],c=e[4]):(s=()=>{if(!o)return;let e=function(){let e=o,t=ow(e);r(n=>!n||n.editor!==e?n:t?{...n,...t}:null)};return document.addEventListener(`scroll`,e,{capture:!0,passive:!0}),window.addEventListener(`resize`,e),()=>{document.removeEventListener(`scroll`,e,{capture:!0}),window.removeEventListener(`resize`,e)}},c=[o],e[2]=o,e[3]=s,e[4]=c),(0,Q.useEffect)(s,c),!n)return null;let l;e[5]===n?l=e[6]:(l=function(e){if(!n)return;let{editor:t}=n;r(null),e&&!t.isDestroyed&&t.commands.focus()},e[5]=n,e[6]=l);let u=l,d;e[7]===u?d=e[8]:(d=e=>{e||u(!1)},e[7]=u,e[8]=d);let f=n.bottom-n.top,p;e[9]!==n.left||e[10]!==n.top||e[11]!==f?(p=(0,Z.jsx)(mh,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":!0,"data-testid":`emoji-picker-anchor`,className:`pointer-events-none fixed`,style:{left:n.left,top:n.top,height:f}})}),e[9]=n.left,e[10]=n.top,e[11]=f,e[12]=p):p=e[12];let m;e[13]===t?m=e[14]:(m=t({id:`pFPzHA`}),e[13]=t,e[14]=m);let h,g;e[15]===u?(h=e[16],g=e[17]):(g=()=>u(!0),h=()=>u(!1),e[15]=u,e[16]=h,e[17]=g);let _;e[18]===n.editor?_=e[19]:(_=(0,Z.jsx)(kf,{onSelect:e=>{let t=n.editor;r(null),aw(t,e)}}),e[18]=n.editor,e[19]=_);let v;e[20]!==h||e[21]!==_||e[22]!==m||e[23]!==g?(v=(0,Z.jsx)(ph,{className:`w-auto p-0`,align:`start`,"aria-label":m,"data-testid":`emoji-picker-popover`,onEscapeKeyDown:g,onInteractOutside:h,children:_}),e[20]=h,e[21]=_,e[22]=m,e[23]=g,e[24]=v):v=e[24];let y;return e[25]!==v||e[26]!==d||e[27]!==p?(y=(0,Z.jsxs)(hh,{open:!0,onOpenChange:d,children:[p,v]}),e[25]=v,e[26]=d,e[27]=p,e[28]=y):y=e[28],y}async function cw(e){let t=await fetch(`/api/tags/${encodeURIComponent(e)}`);if(!t.ok){let e=await t.json().catch(()=>null),n=t.status,r=t.statusText;throw Error(Il(e)??Hc._({id:`lHwYMr`,values:{status:n,statusText:r}}))}return(await t.json()).docs??[]}function lw(){let e=(0,$.c)(18),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(null),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={kind:`idle`},e[0]=a):a=e[0];let[o,s]=(0,Q.useState)(a),c=(0,Q.useRef)(0),l,u;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{let e=function(e){let t=e.detail;if(!t||typeof t.value!=`string`)return;let r=c.current+=1;i(t.value),n(!0),s({kind:`loading`}),cw(t.value).then(e=>{c.current===r&&s({kind:`ready`,docs:e})}).catch(e=>{c.current===r&&s({kind:`error`,message:e instanceof Error?e.message:String(e)})})};return document.addEventListener(Tn,e),()=>document.removeEventListener(Tn,e)},u=[],e[1]=l,e[2]=u):(l=e[1],u=e[2]),(0,Q.useEffect)(l,u);let d;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=function(e){n(!1),window.location.assign(qp(e))},e[3]=d):d=e[3];let f=d,p=r??``,m;e[4]===p?m=e[5]:(m={tagName:p},e[4]=p,e[5]=m);let h;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(h={0:(0,Z.jsx)(`span`,{className:`font-mono break-all`})},e[6]=h):h=e[6];let g;e[7]===m?g=e[8]:(g=(0,Z.jsx)($r,{children:(0,Z.jsx)(Jr,{children:(0,Z.jsx)(Y,{id:`7H4UHD`,values:m,components:h})})}),e[7]=m,e[8]=g);let _=r??``,v;e[9]!==o||e[10]!==_?(v=(0,Z.jsx)(Xr,{children:(0,Z.jsx)(uw,{fetchState:o,tag:_,onSelectDoc:f})}),e[9]=o,e[10]=_,e[11]=v):v=e[11];let y;e[12]!==g||e[13]!==v?(y=(0,Z.jsxs)(Yr,{children:[g,v]}),e[12]=g,e[13]=v,e[14]=y):y=e[14];let b;return e[15]!==t||e[16]!==y?(b=(0,Z.jsx)(ei,{open:t,onOpenChange:n,children:y}),e[15]=t,e[16]=y,e[17]=b):b=e[17],b}function uw(e){let t=(0,$.c)(15),{fetchState:n,tag:r,onSelectDoc:i}=e;if(n.kind===`idle`||n.kind===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`tag-dialog-loading`,children:(0,Z.jsx)(Y,{id:`yQE2r9`})}),t[0]=e):e=t[0],e}if(n.kind===`error`){let e;return t[1]===n.message?e=t[2]:(e=(0,Z.jsx)(`p`,{className:`text-destructive text-sm`,"data-testid":`tag-dialog-error`,children:n.message}),t[1]=n.message,t[2]=e),e}if(n.docs.length===0){let e;t[3]===r?e=t[4]:(e={tag:r},t[3]=r,t[4]=e);let n;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(n={0:(0,Z.jsx)(`span`,{className:`font-mono`})},t[5]=n):n=t[5];let i;return t[6]===e?i=t[7]:(i=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`tag-dialog-empty`,children:(0,Z.jsx)(Y,{id:`lAiyU_`,values:e,components:n})}),t[6]=e,t[7]=i),i}let a;if(t[8]!==n.docs||t[9]!==i){let e;t[11]===i?e=t[12]:(e=e=>{let t=e.matchingTags??[];return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,className:`w-full rounded-md px-2 py-1.5 text-left text-sm hover:bg-muted focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring`,onClick:()=>i(e.docName),"data-testid":`tag-dialog-row`,children:[(0,Z.jsx)(`span`,{className:`block truncate font-medium`,children:e.title}),e.docName===e.title?null:(0,Z.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:e.docName}),t.length>0?(0,Z.jsx)(`span`,{className:`mt-1 flex flex-wrap items-center gap-1`,"data-testid":`tag-dialog-row-matches`,children:t.map(dw)}):null]})},e.docName)},t[11]=i,t[12]=e),a=n.docs.map(e),t[8]=n.docs,t[9]=i,t[10]=a}else a=t[10];let o;return t[13]===a?o=t[14]:(o=(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1`,"data-testid":`tag-dialog-list`,children:a}),t[13]=a,t[14]=o),o}function dw(e){return(0,Z.jsxs)(`span`,{"data-testid":`tag-dialog-row-match`,"data-tag":e,className:`tag pointer-events-none text-xs`,children:[`#`,e]},e)}var fw=`raw-mdx-nav`,pw=`ok-editor-mode-v1`,mw=[`wysiwyg`,`source`],hw=`wysiwyg`;function gw(e){return mw.includes(e)}function _w(e=localStorage){try{let t=e.getItem(pw);if(t===null)return hw;if(gw(t))return t;console.warn(`[editor-mode] invalid persisted value, falling back to default`,{raw:t})}catch{}return hw}function vw(e=window,t=localStorage){let n=e.__OK_EDITOR_MODE__;return gw(n)?n:_w(t)}function yw(e,t=localStorage){try{return t.setItem(pw,e),!0}catch(e){return console.warn(`[editor-mode] persist failed`,e),!1}}function bw(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(vw),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=function(e){n(e),yw(e)},e[0]=r):r=e[0];let i=r,a;return e[1]===t?a=e[2]:(a=[t,i],e[1]=t,e[2]=a),a}function xw(e){let t=(0,$.c)(4),{_:n}=Bn(),r=(0,Q.useRef)(!1),i,a;t[0]!==n||t[1]!==e?(i=()=>{e===`no-push-permission`&&!r.current&&(r.current=!0,Dc.info(n({id:`JkCD2u`})))},a=[e,n],t[0]=n,t[1]=e,t[2]=i,t[3]=a):(i=t[2],a=t[3]),(0,Q.useEffect)(i,a)}function Sw(e,t){return e===`follow`?(0,Z.jsx)(Y,{id:`2okwy4`,values:{project:t}}):e===`full`?(0,Z.jsx)(Y,{id:`wk_v1X`,values:{project:t}}):(0,Z.jsx)(Y,{id:`6xPJIj`,values:{project:t}})}function Cw(){let e=(0,$.c)(8),{projectLocalConfig:t,projectLocalSynced:n,projectLocalBinding:r}=Fl(),i=(0,Q.useRef)(!1),a;e[0]!==r||e[1]!==t?.autoSync||e[2]!==n?(a=()=>{if(!n||i.current||r===null)return;let e=t?.autoSync;if(e?.inheritedNoticePending!==!0)return;i.current=!0;let a=typeof e.inheritedFrom==`string`?e.inheritedFrom:``;Dc(Sw(hs({mode:e.mode,enabled:e.enabled}),a)),r.patch({autoSync:{inheritedNoticePending:null}})},e[0]=r,e[1]=t?.autoSync,e[2]=n,e[3]=a):a=e[3];let o;e[4]!==r||e[5]!==t||e[6]!==n?(o=[n,t,r],e[4]=r,e[5]=t,e[6]=n,e[7]=o):o=e[7],(0,Q.useEffect)(a,o)}var ww=`ok-terminal-placement-v1`;function Tw(e){try{return vc((e??localStorage).getItem(ww))}catch{return bo}}function Ew(e,t){try{(t??localStorage).setItem(ww,e)}catch{}}var Dw=`ok-terminal-right-width-v1`;function Ow(e){try{let t=(e??localStorage).getItem(Dw);if(t===null||t.trim()===``)return Ts;let n=Number(t);return Number.isFinite(n)?Sc(n):Ts}catch{return Ts}}function kw(e,t){try{(t??localStorage).setItem(Dw,String(Sc(e)))}catch{}}function Aw(e){let t=(0,$.c)(3),[n,r]=(0,Q.useState)(`connecting`),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e){r(`connecting`);return}let t=e.configuration.websocketProvider.status;e.isSynced?r(`synced`):r(t===`connected`?`connected`:t===`disconnected`?`disconnected`:`connecting`);let n=e=>{let{status:t}=e;r(t===`connected`?jw:t===`disconnected`?`disconnected`:`connecting`)},i=e=>{let{state:t}=e;r(t?`synced`:`connected`)},a=()=>r(`disconnected`);return e.on(`status`,n),e.on(`synced`,i),e.on(`disconnect`,a),()=>{e.off(`status`,n),e.off(`synced`,i),e.off(`disconnect`,a)}},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,Q.useEffect)(i,a),n}function jw(e){return e===`synced`?`synced`:`connected`}function Mw(e){let t=(0,$.c)(36),{open:n,variant:r,onResolved:i}=e,{_:a}=Bn(),o=Su(),s;t[0]!==a||t[1]!==i||t[2]!==r||t[3]!==o?(s=function(e){if(o===null){Dc.error(a({id:`fiMNLl`}));return}let t=o(e?r===`follow`?`follow`:`full`:`off`);if(!t.ok){let n=t.error;Dc.error(a(e?{id:`FUMerq`,values:{detail:n}}:{id:`0t0bbC`,values:{detail:n}}));return}i()},t[0]=a,t[1]=i,t[2]=r,t[3]=o,t[4]=s):s=t[4];let c=s,l;t[5]===r?l=t[6]:(l=(0,Z.jsx)($r,{children:(0,Z.jsx)(wu,{variant:r})}),t[5]=r,t[6]=l);let u;t[7]===r?u=t[8]:(u=(0,Z.jsx)(bu,{variant:r}),t[7]=r,t[8]=u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`QYTOaN`,components:{0:(0,Z.jsx)(`span`,{className:`font-medium`})}})}),t[9]=d):d=t[9];let f;t[10]===u?f=t[11]:(f=(0,Z.jsxs)(Xr,{children:[u,d]}),t[10]=u,t[11]=f);let p;t[12]===c?p=t[13]:(p=()=>c(!1),t[12]=c,t[13]=p);let m=o===null,h;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Y,{id:`IKoTAC`}),t[14]=h):h=t[14];let g;t[15]!==p||t[16]!==m?(g=(0,Z.jsx)(X,{variant:`outline`,className:`uppercase font-mono`,onClick:p,disabled:m,children:h}),t[15]=p,t[16]=m,t[17]=g):g=t[17];let _;t[18]===c?_=t[19]:(_=()=>c(!0),t[18]=c,t[19]=_);let v=o===null,y;t[20]===r?y=t[21]:(y=r===`follow`?(0,Z.jsx)(Y,{id:`jTUxaN`}):(0,Z.jsx)(Y,{id:`pPiV8s`}),t[20]=r,t[21]=y);let b;t[22]!==_||t[23]!==v||t[24]!==y?(b=(0,Z.jsx)(X,{onClick:_,disabled:v,children:y}),t[22]=_,t[23]=v,t[24]=y,t[25]=b):b=t[25];let x;t[26]!==b||t[27]!==g?(x=(0,Z.jsxs)(Zr,{children:[g,b]}),t[26]=b,t[27]=g,t[28]=x):x=t[28];let S;t[29]!==x||t[30]!==l||t[31]!==f?(S=(0,Z.jsxs)(Yr,{className:`sm:max-w-lg`,showCloseButton:!1,children:[l,f,x]}),t[29]=x,t[30]=l,t[31]=f,t[32]=S):S=t[32];let C;return t[33]!==n||t[34]!==S?(C=(0,Z.jsx)(ei,{open:n,onOpenChange:Nw,children:S}),t[33]=n,t[34]=S,t[35]=C):C=t[35],C}function Nw(){}function Pw(e){if(!(!e.autoSyncOnboardingDismissed&&e.hasRemote===!0&&e.projectLocalSynced===!0&&e.projectSynced===!0&&e.projectLocalConfig!==null&&hs(e.projectLocalConfig.autoSync??void 0)===null&&Eo(e.projectConfig?.autoSync?.default)===null))return null;switch(e.pushPermissionCheckStatus){case`allowed`:return`full`;case`denied`:return`follow`;default:return null}}function Fw(e){let t=(0,$.c)(57),{primary:n,onPrimary:r,primaryDisabled:i,enabledTargets:a,selectedTargetId:o,onSelectTarget:s,threadAgents:c,onOpenSettings:l,terminal:u,terminals:d,menuEmptyState:f,menuLeading:p,onMenuOpenChange:m,menuAlign:h,triggerAriaLabel:g,testIds:_}=e,v=i===void 0?!1:i,y=h===void 0?`end`:h,{_:b}=Bn(),x=a.length>0,S=d&&d.length>0?d:null,C=S!=null||u!=null,w=x||C,T=c!==void 0&&c.length>0,E;t[0]===_?E=t[1]:(E=e=>typeof _.terminal==`function`?_.terminal(e):_.terminal,t[0]=_,t[1]=E);let D=E,O;t[2]!==r||t[3]!==n||t[4]!==v||t[5]!==_.primary?(O=(0,Z.jsx)(X,{type:`button`,variant:`outline`,className:`gap-1.5`,disabled:v,onClick:r,"data-testid":_.primary,children:n}),t[2]=r,t[3]=n,t[4]=v,t[5]=_.primary,t[6]=O):O=t[6];let k;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(Gu,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),t[7]=k):k=t[7];let A;t[8]!==_.trigger||t[9]!==g?(A=(0,Z.jsx)(fa,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`icon`,"aria-label":g,"data-testid":_.trigger,children:k})}),t[8]=_.trigger,t[9]=g,t[10]=A):A=t[10];let j;t[11]!==w||t[12]!==p||t[13]!==T?(j=p?(0,Z.jsxs)(Z.Fragment,{children:[p,T||w?(0,Z.jsx)(ya,{}):null]}):null,t[11]=w,t[12]=p,t[13]=T,t[14]=j):j=t[14];let M;t[15]!==b||t[16]!==w||t[17]!==T||t[18]!==_||t[19]!==c?(M=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(da,{"aria-label":b({id:`RXEbZy`}),children:[(0,Z.jsx)(ma,{children:(0,Z.jsx)(Y,{id:`RXEbZy`})}),c?.map(e=>(0,Z.jsxs)(ca,{onSelect:e.onSelect,"data-testid":_.threadAgent?.(e.key),children:[(0,Z.jsx)(Ya,{agentId:e.id,iconUrl:e.iconUrl,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1 truncate`,children:e.name}),e.selected?(0,Z.jsx)(Uu,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.key))]}),w?(0,Z.jsx)(ya,{}):null]}):null,t[15]=b,t[16]=w,t[17]=T,t[18]=_,t[19]=c,t[20]=M):M=t[20];let N;t[21]!==b||t[22]!==S||t[23]!==a||t[24]!==w||t[25]!==s||t[26]!==o||t[27]!==x||t[28]!==C||t[29]!==u||t[30]!==D||t[31]!==_?(N=w?(0,Z.jsxs)(Z.Fragment,{children:[C?(0,Z.jsxs)(da,{"aria-label":b({id:`ALhMYW`}),children:[(0,Z.jsx)(ma,{children:(0,Z.jsx)(Y,{id:`ALhMYW`})}),S?S.map(e=>(0,Z.jsxs)(ca,{onSelect:e.onSelect,"data-testid":D(e.cli),"aria-label":e.ariaLabel,children:[(0,Z.jsx)(aa,{id:na(e.cli),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.label}),e.selected?(0,Z.jsx)(Uu,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.cli)):u?(0,Z.jsxs)(ca,{onSelect:u.onSelect,"data-testid":D(`claude`),"aria-label":b({id:`AcK_r0`}),children:[(0,Z.jsx)(aa,{id:na(`claude`),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`fcgvCA`})}),u.selected?(0,Z.jsx)(Uu,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]}):null]}):null,x?(0,Z.jsxs)(Z.Fragment,{children:[C?(0,Z.jsx)(ya,{}):null,(0,Z.jsxs)(da,{"aria-label":b({id:`BwKH4d`}),children:[(0,Z.jsxs)(ma,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(Y,{id:`BwKH4d`}),(0,Z.jsx)(ju,{"aria-hidden":`true`,className:`size-3`})]}),a.map(e=>(0,Z.jsxs)(ca,{onSelect:()=>s(e),"data-testid":_.option(e.id),children:[(0,Z.jsx)(aa,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Zl,{displayName:e.displayName})}),o===e.id?(0,Z.jsx)(Uu,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null]}):null,t[21]=b,t[22]=S,t[23]=a,t[24]=w,t[25]=s,t[26]=o,t[27]=x,t[28]=C,t[29]=u,t[30]=D,t[31]=_,t[32]=N):N=t[32];let P=!T&&!w?f:null,F;t[33]!==w||t[34]!==T?(F=T||w?(0,Z.jsx)(ya,{}):null,t[33]=w,t[34]=T,t[35]=F):F=t[35];let I;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(mr,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}),t[36]=I):I=t[36];let L;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`jRAGrQ`})}),t[37]=L):L=t[37];let R;t[38]!==l||t[39]!==_.settings?(R=(0,Z.jsxs)(ca,{onSelect:l,"data-testid":_.settings,children:[I,L]}),t[38]=l,t[39]=_.settings,t[40]=R):R=t[40];let z;t[41]!==y||t[42]!==P||t[43]!==F||t[44]!==R||t[45]!==j||t[46]!==M||t[47]!==N||t[48]!==_.menu?(z=(0,Z.jsxs)(ga,{align:y,className:`max-h-80 min-w-[200px]`,"data-testid":_.menu,children:[j,M,N,P,F,R]}),t[41]=y,t[42]=P,t[43]=F,t[44]=R,t[45]=j,t[46]=M,t[47]=N,t[48]=_.menu,t[49]=z):z=t[49];let B;t[50]!==m||t[51]!==z||t[52]!==A?(B=(0,Z.jsxs)(va,{modal:!1,onOpenChange:m,children:[A,z]}),t[50]=m,t[51]=z,t[52]=A,t[53]=B):B=t[53];let V;return t[54]!==B||t[55]!==O?(V=(0,Z.jsxs)(Ma,{children:[O,B]}),t[54]=B,t[55]=O,t[56]=V):V=t[56],V}function Iw(e){let t=(0,$.c)(9),{onStartNewChat:n}=e,{_:r}=Bn(),i;t[0]===r?i=t[1]:(i=r({id:`j15ZSH`}),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(dr,{className:`size-4`}),t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`span`,{className:`flex-1 truncate`,children:(0,Z.jsx)(Y,{id:`vPF04k`})}),t[3]=o):o=t[3];let s;t[4]===n?s=t[5]:(s=(0,Z.jsxs)(ca,{onSelect:n,className:`gap-2`,"data-testid":`comment-queue-send-new`,children:[a,o]}),t[4]=n,t[5]=s);let c;return t[6]!==i||t[7]!==s?(c=(0,Z.jsx)(da,{"aria-label":i,children:s}),t[6]=i,t[7]=s,t[8]=c):c=t[8],c}function Lw(){let e=(0,$.c)(12),t=Wa(),n=Ua(),r=Za(),i,a;if(e[0]!==r||e[1]!==t||e[2]!==n){let o;e[5]===t?o=e[6]:(o=e=>Ha(t,e.source,e.id,!0,e.supported),e[5]=t,e[6]=o);let s=n.filter(o),c=Ga(s,r);a=c,i=s.map(e=>({key:`${e.source}:${e.id}`,id:e.id,name:e.name,...e.iconUrl===void 0?{}:{iconUrl:e.iconUrl},selected:c!==null&&c.source===e.source&&c.id===e.id,onSelect:()=>{Va(e),Tl(Ol)}})),e[0]=r,e[1]=t,e[2]=n,e[3]=i,e[4]=a}else i=e[3],a=e[4];let o;e[7]===i?o=e[8]:(o={threadAgents:i},e[7]=i,e[8]=o);let s;return e[9]!==a||e[10]!==o?(s={threadAgent:a,rows:o},e[9]=a,e[10]=o,e[11]=s):s=e[11],s}function Rw(e){let t=(0,$.c)(49),{threadIds:n,testIdPrefix:r}=e,{_:i}=Bn(),a=Lw(),o=Wb(),s=nl(),c=s?.kind===`thread`?s:null,u=qb(),d;t[0]!==c||t[1]!==a.threadAgent?.iconUrl||t[2]!==a.threadAgent?.id?(d=c===null?(0,Z.jsx)(Ya,{agentId:a.threadAgent?.id??``,iconUrl:a.threadAgent?.iconUrl,className:`size-4`}):(0,Z.jsx)(Ya,{agentId:c.agentId,iconUrl:c.iconUrl,className:`size-4`}),t[0]=c,t[1]=a.threadAgent?.iconUrl,t[2]=a.threadAgent?.id,t[3]=d):d=t[3];let f=d,p;t[4]===i?p=t[5]:(p=i({id:`LaskKp`,values:{0:Ac(`send-comment-queue`)}}),t[4]=i,t[5]=p);let m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=Lc(`send-comment-queue`),t[6]=m):m=t[6];let h;t[7]===p?h=t[8]:(h=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 font-sans text-xs leading-none text-muted-foreground`,title:p,children:m}),t[7]=p,t[8]=h);let g;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=[],t[9]=g):g=t[9];let _;t[10]===c?_=t[11]:(_=(0,Z.jsx)(`span`,{className:`truncate`,children:c===null?(0,Z.jsx)(Y,{id:`vPF04k`}):(0,Z.jsx)(Y,{id:`sKEgGd`})}),t[10]=c,t[11]=_);let v;t[12]!==f||t[13]!==_?(v=(0,Z.jsxs)(Z.Fragment,{children:[f,_]}),t[12]=f,t[13]=_,t[14]=v):v=t[14];let y;t[15]!==u||t[16]!==n?(y=()=>u(n),t[15]=u,t[16]=n,t[17]=y):y=t[17];let b=n.length===0,x;t[18]!==o||t[19]!==c||t[20]!==n?(x=c===null?void 0:(0,Z.jsx)(Iw,{onStartNewChat:()=>void l({compose:o,threadIds:n})}),t[18]=o,t[19]=c,t[20]=n,t[21]=x):x=t[21];let S;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:(0,Z.jsx)(Y,{id:`t9Qn8y`})}),t[22]=S):S=t[22];let C;t[23]===i?C=t[24]:(C=i({id:`nbLQ_9`}),t[23]=i,t[24]=C);let w=`${r}-send`,T=`${r}-send-trigger`,E=`${r}-send-menu`,D,O;t[25]===r?(D=t[26],O=t[27]):(D=e=>`${r}-agent-option-${e}`,O=e=>`${r}-agent-option-thread-${e}`,t[25]=r,t[26]=D,t[27]=O);let k=`${r}-agent-option-settings`,A;t[28]===r?A=t[29]:(A=e=>`${r}-agent-option-terminal-${e}`,t[28]=r,t[29]=A);let j;t[30]!==w||t[31]!==T||t[32]!==E||t[33]!==D||t[34]!==O||t[35]!==k||t[36]!==A?(j={primary:w,trigger:T,menu:E,option:D,threadAgent:O,settings:k,terminal:A},t[30]=w,t[31]=T,t[32]=E,t[33]=D,t[34]=O,t[35]=k,t[36]=A,t[37]=j):j=t[37];let M;t[38]!==a.rows||t[39]!==x||t[40]!==C||t[41]!==j||t[42]!==v||t[43]!==y||t[44]!==b?(M=(0,Z.jsx)(Fw,{enabledTargets:g,selectedTargetId:null,onSelectTarget:zw,primary:v,onPrimary:y,primaryDisabled:b,menuLeading:x,onOpenSettings:jc,menuEmptyState:S,triggerAriaLabel:C,testIds:j,...a.rows}),t[38]=a.rows,t[39]=x,t[40]=C,t[41]=j,t[42]=v,t[43]=y,t[44]=b,t[45]=M):M=t[45];let N;return t[46]!==M||t[47]!==h?(N=(0,Z.jsx)(Zh,{className:`justify-end`,children:(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[h,M]})}),t[46]=M,t[47]=h,t[48]=N):N=t[48],N}function zw(){}function Bw(e){let t=new Map;for(let n of e){let e=t.get(n.docName);e?e.push(n):t.set(n.docName,[n])}return[...t].map(([e,t])=>({docName:e,threads:t}))}function Vw(e,t){let n=new Date(e),r=new Date(t),i=n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate(),a={hour:`numeric`,minute:`2-digit`};return i?n.toLocaleTimeString(void 0,a):n.getFullYear()===r.getFullYear()?n.toLocaleString(void 0,{month:`short`,day:`numeric`,...a}):n.toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,...a})}function Hw(e){let t=(0,$.c)(104),{thread:n,cardRef:r,focused:i,active:a,sending:o}=e,{_:s}=Bn(),[c]=(0,Q.useState)(Ww),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(!1),p=(0,Q.useRef)(null),m=n.status===`orphaned`,h=n.status===`resolved`,g=(0,Q.useRef)(n.body),_;t[0]===n.body?_=t[1]:(_=()=>{g.current=n.body},t[0]=n.body,t[1]=_),(0,Q.useEffect)(_);let v=(0,Q.useRef)(null),y=(0,Q.useRef)(!1),b,x;t[2]===l?(b=t[3],x=t[4]):(b=()=>{l&&(y.current=!1,v.current=null,p.current?.setText(g.current),p.current?.focusEnd())},x=[l],t[2]=l,t[3]=b,t[4]=x),(0,Q.useEffect)(b,x);let C;t[5]===n.id?C=t[6]:(C=function(e){if(y.current)return;y.current=!0,u(!1);let t=(e??``).trim();t.length===0||t===g.current||Nt(n.id,t)},t[5]=n.id,t[6]=C);let w=C,T;t[7]===w?T=t[8]:(T=function(){w(p.current?.getContent().instruction??null)},t[7]=w,t[8]=T);let E=T,D;t[9]===w?D=t[10]:(D=function(){w(null)},t[9]=w,t[10]=D);let O=D,k;t[11]!==O||t[12]!==n.id?(k=function(){O(),It(n.id)},t[11]=O,t[12]=n.id,t[13]=k):k=t[13];let A=k,j;t[14]!==l||t[15]!==w?(j=()=>{if(l)return()=>{w(v.current)}},t[14]=l,t[15]=w,t[16]=j):j=t[16];let M;t[17]===l?M=t[18]:(M=[l],t[17]=l,t[18]=M),(0,Q.useEffect)(j,M);let P;t[19]===n?P=t[20]:(P=function(e){if(n.anchor===null)return;if(ee(n.docName)===null){dp(n);return}if(n.target.kind===`property`){up({key:n.target.key,path:n.target.path,quote:e,start:n.anchor.start,end:n.anchor.end}),q(n.id);return}let t=ee(n.docName);if(!t)return;let r=yp(t.state.doc,e,n.anchor);r&&(Ep(t,r,n.docName),q(n.id))},t[19]=n,t[20]=P);let F=P,I;t[21]!==n.docName||t[22]!==n.id?(I=function(){let e=ee(n.docName);if(!e)return;let{from:t,to:r,empty:i}=e.state.selection;if(i)return;let a=e.state.doc.textBetween(t,r,` `).trim();a.length>0&&we(n.id,a,hp(e.state.doc,t,r))},t[21]=n.docName,t[22]=n.id,t[23]=I):I=t[23];let L=I,R=!l&&!h,z,B,V,H;t[24]===n.id?(z=t[25],B=t[26],V=t[27],H=t[28]):(z=()=>Me(n.id),B=()=>S(n.id),V=()=>Me(n.id),H=()=>S(n.id),t[24]=n.id,t[25]=z,t[26]=B,t[27]=V,t[28]=H);let U;t[29]!==R||t[30]!==n.id?(U=e=>{if(!R||e.target?.closest(`button, [role="checkbox"], [role="textbox"], a, input, textarea`))return;let t=window.getSelection();t!==null&&!t.isCollapsed&&t.anchorNode!==null&&e.currentTarget.contains(t.anchorNode)||pe(n.id)},t[29]=R,t[30]=n.id,t[31]=U):U=t[31];let W=R&&`cursor-pointer`,G=h&&`opacity-70`,te=a&&`bg-blue-600/10`,ne=i&&`ring-2 ring-primary`,re;t[32]!==W||t[33]!==G||t[34]!==te||t[35]!==ne?(re=gr(`flex flex-col gap-1.5 rounded-lg border p-2.5 transition-[box-shadow,border-color,background-color]`,W,G,te,ne),t[32]=W,t[33]=G,t[34]=te,t[35]=ne,t[36]=re):re=t[36];let K;t[37]!==s||t[38]!==h||t[39]!==o||t[40]!==n.id?(K=!h&&(0,Z.jsx)(zi,{checked:o,onCheckedChange:()=>pe(n.id),"aria-label":s(o?{id:`1jym2J`}:{id:`t7YoBO`})}),t[37]=s,t[38]=h,t[39]=o,t[40]=n.id,t[41]=K):K=t[41];let ie;t[42]===n.updatedAt?ie=t[43]:(ie=new Date(n.updatedAt).toLocaleString(),t[42]=n.updatedAt,t[43]=ie);let ae;t[44]!==c||t[45]!==n.updatedAt?(ae=Vw(n.updatedAt,c),t[44]=c,t[45]=n.updatedAt,t[46]=ae):ae=t[46];let oe;t[47]!==ie||t[48]!==ae?(oe=(0,Z.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground`,title:ie,children:ae}),t[47]=ie,t[48]=ae,t[49]=oe):oe=t[49];let se;t[50]!==K||t[51]!==oe?(se=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[K,oe]}),t[50]=K,t[51]=oe,t[52]=se):se=t[52];let ce;t[53]===h?ce=t[54]:(ce=h&&(0,Z.jsxs)(Sh,{variant:`outline`,className:`gap-1 border-green-600/40 text-green-700 dark:text-green-500`,children:[(0,Z.jsx)(Ny,{className:`size-2.5`}),(0,Z.jsx)(Y,{id:`O6H89R`})]}),t[53]=h,t[54]=ce);let le;t[55]!==s||t[56]!==l||t[57]!==h?(le=!h&&(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,"aria-label":s({id:`akmOT9`}),"aria-expanded":l,className:gr(`size-6 p-0`,l?`text-foreground`:`text-muted-foreground hover:text-foreground`),onClick:()=>u(Uw),children:(0,Z.jsx)(Zt,{className:`size-3.5`})})}),(0,Z.jsx)(Vr,{children:(0,Z.jsx)(Y,{id:`akmOT9`})})]}),t[55]=s,t[56]=l,t[57]=h,t[58]=le):le=t[58];let ue;t[59]===s?ue=t[60]:(ue=s({id:`X2zUS5`}),t[59]=s,t[60]=ue);let de;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Z.jsx)(Ip,{className:`size-3.5`}),t[61]=de):de=t[61];let fe;t[62]!==A||t[63]!==ue?(fe=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,className:`size-6 p-0 text-muted-foreground hover:text-destructive`,"aria-label":ue,onClick:A,children:de})}),t[62]=A,t[63]=ue,t[64]=fe):fe=t[64];let J;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(Vr,{children:(0,Z.jsx)(Y,{id:`X2zUS5`})}),t[65]=J):J=t[65];let me;t[66]===fe?me=t[67]:(me=(0,Z.jsxs)(Ur,{children:[fe,J]}),t[66]=fe,t[67]=me);let he;t[68]!==ce||t[69]!==le||t[70]!==me?(he=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[ce,le,me]}),t[68]=ce,t[69]=le,t[70]=me,t[71]=he):he=t[71];let ge;t[72]!==se||t[73]!==he?(ge=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[se,he]}),t[72]=se,t[73]=he,t[74]=ge):ge=t[74];let _e;t[75]!==m||t[76]!==F||t[77]!==n.anchor||t[78]!==n.target?(_e=m?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded border-l-2 border-muted-foreground/40 bg-muted/40 px-2 py-1`,children:[n.anchor!==null&&(0,Z.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground line-through`,title:n.anchor.quote,children:[`“`,n.anchor.quote,`”`]}),(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`05F1GY`})})]}):(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(`span`,{className:`w-full`,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,disabled:n.anchor===null,onClick:()=>F(n.anchor?.quote??``),className:`h-auto w-full justify-start truncate rounded border-l-2 border-muted-foreground/40 bg-muted/40 px-2 py-1 text-left text-xs font-normal text-muted-foreground hover:bg-muted/70 disabled:opacity-100`,children:(0,Z.jsx)(`span`,{className:`truncate`,children:n.target.kind===`property`?(0,Z.jsxs)(`span`,{className:`font-mono`,children:[_p(n.target.key,n.target.path),`:`,n.anchor===null?``:` “${n.anchor.quote}”`]}):(0,Z.jsxs)(Z.Fragment,{children:[`“`,n.anchor?.quote??``,`”`]})})})})}),(0,Z.jsx)(Vr,{children:n.anchor===null?(0,Z.jsx)(Y,{id:`aoT2xX`}):n.target.kind===`property`?(0,Z.jsx)(Y,{id:`FiyNln`}):(0,Z.jsx)(Y,{id:`DpjYd6`})})]}),t[75]=m,t[76]=F,t[77]=n.anchor,t[78]=n.target,t[79]=_e):_e=t[79];let ve;t[80]!==s||t[81]!==O||t[82]!==E||t[83]!==d||t[84]!==l||t[85]!==n.body?(ve=l?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(Aa,{ref:p,ariaLabel:s({id:`akmOT9`}),placeholder:s({id:`akmOT9`}),onEmptyChange:f,onContentChange:()=>{v.current=p.current?.getContent().instruction??null},onSubmit:E,onEscape:O,className:`max-h-40 overflow-y-auto rounded-md border px-2 py-1 text-sm`}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,onClick:O,children:(0,Z.jsx)(Y,{id:`dEgA5A`})}),(0,Z.jsx)(X,{size:`sm`,onClick:E,disabled:d,"aria-label":s({id:`3W5kYZ`}),children:(0,Z.jsx)(Y,{id:`tfDRzk`})})]})]}):(0,Z.jsx)(`p`,{"data-testid":`thread-comment-body`,className:`text-sm text-foreground/90`,children:n.body}),t[80]=s,t[81]=O,t[82]=E,t[83]=d,t[84]=l,t[85]=n.body,t[86]=ve):ve=t[86];let ye;t[87]!==m||t[88]!==h||t[89]!==L||t[90]!==n.id?(ye=m?(0,Z.jsxs)(X,{size:`sm`,variant:`outline`,className:`min-w-0`,onClick:L,children:[(0,Z.jsx)(cp,{className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:(0,Z.jsx)(Y,{id:`QlkiD5`})})]}):(0,Z.jsx)(Z.Fragment,{children:h&&(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-nowrap items-center justify-end gap-1.5`,children:(0,Z.jsxs)(X,{size:`sm`,variant:`outline`,className:`min-w-0`,onClick:()=>N(n.id),children:[(0,Z.jsx)(Ia,{className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:(0,Z.jsx)(Y,{id:`M7SqjM`})})]})})}),t[87]=m,t[88]=h,t[89]=L,t[90]=n.id,t[91]=ye):ye=t[91];let be;return t[92]!==r||t[93]!==z||t[94]!==B||t[95]!==V||t[96]!==H||t[97]!==U||t[98]!==re||t[99]!==ge||t[100]!==_e||t[101]!==ve||t[102]!==ye?(be=(0,Z.jsxs)(`article`,{ref:r,onPointerEnter:z,onPointerLeave:B,onFocusCapture:V,onBlurCapture:H,onClick:U,className:re,children:[ge,_e,ve,ye]}),t[92]=r,t[93]=z,t[94]=B,t[95]=V,t[96]=H,t[97]=U,t[98]=re,t[99]=ge,t[100]=_e,t[101]=ve,t[102]=ye,t[103]=be):be=t[103],be}function Uw(e){return!e}function Ww(){return Date.now()}var Gw=20,Kw=1600;function qw(e,t){let{cards:n,frame:r,ring:i,setFocusedId:a}=t;a(()=>e),r.current!==null&&cancelAnimationFrame(r.current);let o=0,s=()=>{r.current=null;let t=n.get(e);if(t){let e=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;t.scrollIntoView({block:`center`,behavior:e?`auto`:`smooth`});return}o+=1,!(o>=Gw)&&(r.current=requestAnimationFrame(s))};s(),i.current!==null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>{i.current=null,a(t=>t===e?null:t)},Kw)}function Jw(e){let t=(0,$.c)(52),{threads:n,groupByDocument:r,empty:i,testIdPrefix:a,scopeSwitch:o}=e,s=r===void 0?!1:r,{_:c}=Bn(),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=new Map,t[0]=p):p=t[0];let m=(0,Q.useRef)(p),[h,g]=(0,Q.useState)(rT),_=qt(),v=_n(),y;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(y=function(e,t){g(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r})},t[1]=y):y=t[1];let b=y,x=(0,Q.useRef)(null),S=(0,Q.useRef)(null),C;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>({cards:m.current,frame:S,ring:x,setFocusedId:f}),t[2]=C):C=t[2];let w=C,T,E;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{let e=e=>qw(e,w()),t=I();t!==null&&e(t);let n=Pe(t=>{t!==null&&e(t)}),r=Re(e);return()=>{n(),r(),x.current!==null&&window.clearTimeout(x.current),S.current!==null&&cancelAnimationFrame(S.current)}},E=[],t[3]=T,t[4]=E):(T=t[3],E=t[4]),(0,Q.useEffect)(T,E);let D,O,A,j,M,N,P,F,L;if(t[5]!==c||t[6]!==v||t[7]!==h||t[8]!==i||t[9]!==d||t[10]!==s||t[11]!==o||t[12]!==_||t[13]!==l||t[14]!==a||t[15]!==n){A=n.filter(nT);let e=n.filter(tT),r=l?n:A,f=s?Bw(r):[],p=f.length>0&&f.every(e=>h.has(e.docName)),y;t[25]===_?y=t[26]:(y=e=>_.includes(e.id),t[25]=_,t[26]=y),j=A.filter(y).map(eT);let x=A.map($w),S=x.length>0&&j.length===x.length,C;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(C=function(e){return e.threads.filter(Qw).map(Zw)},t[27]=C):C=t[27];let w=C,T;t[28]===_?T=t[29]:(T=function(e){let t=e.filter(e=>_.includes(e)).length;return t===0?!1:t===e.length?!0:`indeterminate`},t[28]=_,t[29]=T);let E=T,I=function(e){return(0,Z.jsx)(Hw,{thread:e,sending:_.includes(e.id),active:v===e.id,focused:d===e.id,cardRef:t=>{t?m.current.set(e.id,t):m.current.delete(e.id)}},e.id)};O=eg;let R;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(Jh,{children:(0,Z.jsx)(Y,{id:`VbyRUy`})}),t[30]=R):R=t[30];let z=e.length>0&&(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsxs)(X,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 gap-1 px-1.5 text-muted-foreground`,"aria-label":c(l?{id:`PHHEuH`,values:{0:e.length}}:{id:`gHb5bB`,values:{0:e.length}}),"aria-pressed":l,"data-testid":`${a}-resolved-toggle`,onClick:()=>u(Xw),children:[l?(0,Z.jsx)(Py,{"aria-hidden":`true`,className:`size-3.5`}):(0,Z.jsx)(Ny,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`text-[11px] tabular-nums`,children:e.length})]})}),(0,Z.jsx)(Vr,{children:l?(0,Z.jsx)(Y,{id:`LRLKnQ`}):(0,Z.jsx)(Y,{id:`o7AkQ0`})})]}),B=f.length>1&&(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{size:`icon`,variant:`ghost`,className:`size-6 shrink-0 text-muted-foreground`,"aria-label":c(p?{id:`QIrBIx`}:{id:`sR0I-f`}),"data-testid":`${a}-collapse-toggle`,onClick:()=>g(p?new Set:new Set(f.map(Yw))),children:p?(0,Z.jsx)(Bb,{"aria-hidden":`true`,className:`size-3.5`}):(0,Z.jsx)(qy,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsx)(Vr,{children:p?(0,Z.jsx)(Y,{id:`QIrBIx`}):(0,Z.jsx)(Y,{id:`sR0I-f`})})]}),V;t[31]===A.length?V=t[32]:(V=(0,Z.jsx)(Qh,{children:A.length}),t[31]=A.length,t[32]=V),t[33]!==z||t[34]!==B||t[35]!==V?(L=(0,Z.jsxs)($h,{children:[R,(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[z,B,V]})]}),t[33]=z,t[34]=B,t[35]=V,t[36]=L):L=t[36],M=o,N=A.length>0&&(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 px-4`,children:[(0,Z.jsx)(zi,{checked:S,onCheckedChange:()=>k(x,!S),"aria-label":c(S?{id:`Ns5f4J`}:{id:`8oWgty`}),"data-testid":`${a}-select-all`}),(0,Z.jsxs)(`span`,{className:`text-[11px] text-muted-foreground tabular-nums`,children:[j.length,`/`,x.length]})]}),D=Xh,P=`flex flex-col gap-3`,F=r.length===0?(0,Z.jsx)(Yh,{children:i}):s?f.map(e=>{let t=w(e),n=E(t);return(0,Z.jsx)(`section`,{"aria-label":e.docName,children:(0,Z.jsxs)(Kr,{open:!h.has(e.docName),onOpenChange:t=>b(e.docName,t),className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`div`,{className:`group/file flex items-center gap-1.5`,children:[(0,Z.jsx)(zi,{checked:n,disabled:t.length===0,onCheckedChange:()=>k(t,n!==!0),"aria-label":c(n===!0?{id:`T2fvhw`,values:{0:Cp(e.docName)}}:{id:`WkQ0Z_`,values:{0:Cp(e.docName)}}),"data-testid":`${a}-file-select-${e.docName}`,className:`opacity-0 transition-opacity focus-visible:opacity-100 group-hover/file:opacity-100`}),(0,Z.jsxs)(Gr,{title:e.docName,className:`group flex min-w-0 flex-1 cursor-pointer items-center gap-1.5 rounded text-left text-[11px] text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(xi,{className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:Cp(e.docName)}),(0,Z.jsx)(Sh,{variant:`outline`,className:`shrink-0 px-1 py-0 text-[10px] tabular-nums`,children:e.threads.length}),(0,Z.jsx)(Ku,{"aria-hidden":`true`,className:`size-3 shrink-0 transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`})]})]}),(0,Z.jsx)(Wr,{className:`flex flex-col gap-2 overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in] motion-reduce:animate-none`,children:e.threads.map(I)})]})},e.docName)}):r.map(I),t[5]=c,t[6]=v,t[7]=h,t[8]=i,t[9]=d,t[10]=s,t[11]=o,t[12]=_,t[13]=l,t[14]=a,t[15]=n,t[16]=D,t[17]=O,t[18]=A,t[19]=j,t[20]=M,t[21]=N,t[22]=P,t[23]=F,t[24]=L}else D=t[16],O=t[17],A=t[18],j=t[19],M=t[20],N=t[21],P=t[22],F=t[23],L=t[24];let R;t[37]!==D||t[38]!==P||t[39]!==F?(R=(0,Z.jsx)(D,{className:P,children:F}),t[37]=D,t[38]=P,t[39]=F,t[40]=R):R=t[40];let z;t[41]!==A.length||t[42]!==j||t[43]!==a?(z=A.length>0&&(0,Z.jsx)(Rw,{threadIds:j,testIdPrefix:a}),t[41]=A.length,t[42]=j,t[43]=a,t[44]=z):z=t[44];let B;return t[45]!==O||t[46]!==M||t[47]!==N||t[48]!==R||t[49]!==z||t[50]!==L?(B=(0,Z.jsxs)(O,{children:[L,M,N,R,z]}),t[45]=O,t[46]=M,t[47]=N,t[48]=R,t[49]=z,t[50]=L,t[51]=B):B=t[51],B}function Yw(e){return e.docName}function Xw(e){return!e}function Zw(e){return e.id}function Qw(e){return e.status!==`resolved`}function $w(e){return e.id}function eT(e){return e.id}function tT(e){return e.status===`resolved`}function nT(e){return e.status!==`resolved`}function rT(){return new Set}function iT(e){let t=(0,$.c)(4),{scopeSwitch:n}=e,r=o(),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Y,{id:`QzofTX`}),t[0]=i):i=t[0];let a;return t[1]!==n||t[2]!==r?(a=(0,Z.jsx)(Jw,{threads:r,groupByDocument:!0,empty:i,testIdPrefix:`comment-queue`,scopeSwitch:n}),t[1]=n,t[2]=r,t[3]=a):a=t[3],a}function aT(e){let t=(0,$.c)(7),{docName:n,scopeSwitch:r}=e,i=dt(n),a,o;t[0]===n?(a=t[1],o=t[2]):(a=()=>{Oe(n).catch(oT)},o=[n],t[0]=n,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o);let s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Y,{id:`zpfN9p`}),t[3]=s):s=t[3];let c;return t[4]!==r||t[5]!==i?(c=(0,Z.jsx)(Jw,{threads:i,empty:s,testIdPrefix:`comment-doc`,scopeSwitch:r}),t[4]=r,t[5]=i,t[6]=c):c=t[6],c}function oT(){}function sT(e){let t=(0,$.c)(3),{docName:n,scopeSwitch:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,Z.jsx)(om,{name:`comments-panel`,children:(0,Z.jsx)(aT,{docName:n,scopeSwitch:r})}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function cT(e){let t=(0,$.c)(13),{docName:n}=e,[r,i]=(0,Q.useState)(`doc`),a=OC(),o=a?`doc`:r,s,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=un();return e!==null&&i(e),Xt(i)},c=[],t[0]=s,t[1]=c):(s=t[0],c=t[1]),(0,Q.useEffect)(s,c);let l,u;t[2]!==n||t[3]!==o?(l=()=>(Yb({scope:o,docName:n}),lT),u=[o,n],t[2]=n,t[3]=o,t[4]=l,t[5]=u):(l=t[4],u=t[5]),(0,Q.useEffect)(l,u);let d;t[6]!==o||t[7]!==a?(d=a?void 0:(0,Z.jsx)(td,{scope:o,onScopeChange:i}),t[6]=o,t[7]=a,t[8]=d):d=t[8];let f=d,p;return t[9]!==n||t[10]!==o||t[11]!==f?(p=o===`doc`?(0,Z.jsx)(sT,{docName:n,scopeSwitch:f}):(0,Z.jsx)(iT,{scopeSwitch:f}),t[9]=n,t[10]=o,t[11]=f,t[12]=p):p=t[12],p}function lT(){return Yb(null)}var uT=!1,dT=new Set;function fT(e){if(e!==uT){uT=e;for(let e of dT)e()}}function pT(e){return dT.add(e),()=>{dT.delete(e)}}function mT(){return uT}function hT(){return(0,Q.useSyncExternalStore)(pT,mT,gT)}function gT(){return!1}var _T=new Map(uc.map(e=>[e.id,e.alias]));function vT(e){return e.source===`markdownlint`?_T.get(e.code):void 0}function yT(e,t,n){return ic({relativePath:hu(e),source:t.source,code:t.code,ruleAlias:vT(t),message:t.message,line:t.range.start.line+1,column:t.range.start.character+1,lineText:n})}function bT(e){return Oo(e===null?null:hu(e))}var xT=5;async function ST(e){let t=await fetch(`/api/backlinks?docName=${encodeURIComponent(e)}`),n=await t.json().catch(()=>null);if(!t.ok){let e=xc.safeParse(n),r=t.status;throw e.success?Error(e.data.title):new vi(Hc._({id:`XopE_I`,values:{status:r}}),{status:r})}let r=dc.safeParse(n);if(!r.success)throw new vi(Hc._({id:`lZAiSP`}),{status:t.status});return r.data.backlinks}async function CT(e){let t=await fetch(`/api/forward-links?docName=${encodeURIComponent(e)}`),n=await t.json().catch(()=>null);if(!t.ok){let e=xc.safeParse(n),r=t.status;throw e.success?Error(e.data.title):new vi(Hc._({id:`GemPfn`,values:{status:r}}),{status:r})}let r=ts.safeParse(n);if(!r.success)throw new vi(Hc._({id:`2YZwPB`}),{status:t.status});return r.data}function wT(e){let t=e.split(`/`);return t.length<=2?e:`…/${t.slice(-2).join(`/`)}`}function TT(e){window.location.hash=qp(e)}function ET(e){let t=(0,$.c)(9),{title:n,count:r,isLoading:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Gu,{className:`size-3.5 text-muted-foreground transition-transform group-data-[state=closed]:-rotate-90`}),t[0]=a):a=t[0];let o;t[1]===n?o=t[2]:(o=(0,Z.jsxs)(`span`,{className:`flex items-center gap-2.5`,children:[a,(0,Z.jsx)(Jh,{children:n})]}),t[1]=n,t[2]=o);let s;t[3]!==r||t[4]!==i?(s=!i&&(0,Z.jsx)(Qh,{children:r}),t[3]=r,t[4]=i,t[5]=s):s=t[5];let c;return t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(Gr,{className:`group flex w-full cursor-pointer items-center justify-between px-5 py-3 text-left transition-colors hover:bg-muted/40`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function DT(e){let t=(0,$.c)(10),{total:n,expanded:r,onToggle:i}=e;if(n<=xT)return null;let a=n-xT,o;t[0]===r?o=t[1]:(o=r?(0,Z.jsx)(Gu,{className:`size-3`}):(0,Z.jsx)(Ku,{className:`size-3`}),t[0]=r,t[1]=o);let s;t[2]!==r||t[3]!==a?(s=r?(0,Z.jsx)(Y,{id:`6fGjTz`}):(0,Z.jsx)(Y,{id:`ZptNUh`,values:{hidden:a}}),t[2]=r,t[3]=a,t[4]=s):s=t[4];let c;return t[5]!==r||t[6]!==i||t[7]!==o||t[8]!==s?(c=(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":r,className:`mt-2 inline-flex cursor-pointer items-center gap-1 px-3 text-xs text-muted-foreground transition-colors hover:text-foreground`,onClick:i,children:[o,s]}),t[5]=r,t[6]=i,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function OT(e){let t=(0,$.c)(38),{icon:n,iconColorClass:r,rowTooltip:i,title:a,path:o,anchor:s,snippet:c,titleHover:l,ariaLabel:u,href:d,external:f,disabled:p,onClick:m,trailing:h}=e,g=o!==void 0&&o!==a,_=r??`text-muted-foreground`,v;t[0]===_?v=t[1]:(v=gr(`mt-0.5 shrink-0`,_),t[0]=_,t[1]=v);let y;t[2]!==n||t[3]!==v?(y=(0,Z.jsx)(`span`,{className:v,children:n}),t[2]=n,t[3]=v,t[4]=y):y=t[4];let b=y,x;t[5]!==u||t[6]!==p||t[7]!==f||t[8]!==d||t[9]!==m||t[10]!==a||t[11]!==l?(x=d?(0,Z.jsxs)(`a`,{href:d,target:f?`_blank`:void 0,rel:f?`noopener noreferrer`:void 0,"aria-label":u,title:l,onClick:m,className:`block w-full truncate text-left font-medium text-foreground no-underline outline-none after:absolute after:inset-0 after:rounded-md focus-visible:after:ring-2 focus-visible:after:ring-ring`,children:[a,f?(0,Z.jsxs)(`span`,{className:`sr-only`,children:[` `,(0,Z.jsx)(Y,{id:`dbtjJh`})]}):null]}):(0,Z.jsx)(`button`,{type:`button`,"aria-label":u,title:l,disabled:p,onClick:m,className:gr(`block w-full truncate text-left font-medium text-foreground no-underline outline-none after:absolute after:inset-0 after:rounded-md focus-visible:after:ring-2 focus-visible:after:ring-ring`,`cursor-pointer bg-transparent p-0 disabled:cursor-not-allowed disabled:opacity-60`),children:a}),t[5]=u,t[6]=p,t[7]=f,t[8]=d,t[9]=m,t[10]=a,t[11]=l,t[12]=x):x=t[12];let S=x,C;t[13]===b?C=t[14]:(C=(0,Z.jsx)(`div`,{className:`mt-px flex items-center`,children:b}),t[13]=b,t[14]=C);let w;t[15]!==s||t[16]!==o||t[17]!==g?(w=g?(0,Z.jsxs)(`div`,{className:`truncate font-mono text-xs text-muted-foreground`,children:[o,s?(0,Z.jsxs)(`span`,{className:`ml-1`,children:[`· #`,s]}):null]}):null,t[15]=s,t[16]=o,t[17]=g,t[18]=w):w=t[18];let T;t[19]===c?T=t[20]:(T=c?(0,Z.jsx)(`p`,{className:`line-clamp-2 text-muted-foreground`,children:c}):null,t[19]=c,t[20]=T);let E;t[21]!==S||t[22]!==w||t[23]!==T?(E=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5 text-1sm`,children:[S,w,T]}),t[21]=S,t[22]=w,t[23]=T,t[24]=E):E=t[24];let D;t[25]===h?D=t[26]:(D=h?(0,Z.jsx)(`div`,{className:`mt-0.5 flex shrink-0 items-center`,children:h}):null,t[25]=h,t[26]=D);let O;t[27]!==C||t[28]!==E||t[29]!==D?(O=(0,Z.jsxs)(`div`,{className:`group relative flex items-start gap-2.5 rounded-md px-3 py-2.5 transition-colors hover:bg-muted/80`,children:[C,E,D]}),t[27]=C,t[28]=E,t[29]=D,t[30]=O):O=t[30];let k=O;if(i){let e;t[31]===k?e=t[32]:(e=(0,Z.jsx)(Br,{asChild:!0,children:k}),t[31]=k,t[32]=e);let n;t[33]===i?n=t[34]:(n=(0,Z.jsx)(Vr,{side:`top`,children:i}),t[33]=i,t[34]=n);let r;return t[35]!==e||t[36]!==n?(r=(0,Z.jsxs)(Ur,{children:[e,n]}),t[35]=e,t[36]=n,t[37]=r):r=t[37],r}return k}function kT(e){let t=(0,$.c)(39),{docName:n}=e,{_:r}=Bn(),{folderPaths:i,pages:a,pagesBySlug:o,pagesByBasename:s,loading:c}=Nd(),l,u;t[0]===n?(l=t[1],u=t[2]):(l=[`backlinks`,n],u=()=>ST(n),t[0]=n,t[1]=l,t[2]=u);let d;t[3]!==n||t[4]!==c||t[5]!==a?(d=!c&&(a.has(n)||Wo(n)),t[3]=n,t[4]=c,t[5]=a,t[6]=d):d=t[6];let f;t[7]!==l||t[8]!==u||t[9]!==d?(f={queryKey:l,queryFn:u,enabled:d},t[7]=l,t[8]=u,t[9]=d,t[10]=f):f=t[10];let{data:p,isLoading:m,error:h}=rr(f),g;t[11]===p?g=t[12]:(g=p===void 0?[]:p,t[11]=p,t[12]=g);let _=g,[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(n);b!==n&&(x(n),y(!1));let S;t[13]!==_||t[14]!==v?(S=v?_:_.slice(0,xT),t[13]=_,t[14]=v,t[15]=S):S=t[15];let C=S,w;t[16]===r?w=t[17]:(w=r({id:`9NJWgv`}),t[16]=r,t[17]=w);let T;t[18]!==_.length||t[19]!==m||t[20]!==w?(T=(0,Z.jsx)(ET,{title:w,count:_.length,isLoading:m}),t[18]=_.length,t[19]=m,t[20]=w,t[21]=T):T=t[21];let E;t[22]!==r||t[23]!==_.length||t[24]!==h||t[25]!==v||t[26]!==i||t[27]!==m||t[28]!==a||t[29]!==s||t[30]!==o||t[31]!==C?(E=h?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(qh,{children:h instanceof Error?h.message:r({id:`Xet9MX`})})}):_.length===0&&!m?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Yh,{children:(0,Z.jsx)(Y,{id:`rVxu1k`})})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:C.map((e,t)=>{let n=np(e.source,{pages:a,folderPaths:i,pagesBySlug:o,pagesByBasename:s});return(0,Z.jsx)(OT,{icon:(0,Z.jsx)(Ge,{className:`size-3.5`}),title:e.title,path:wT(e.source),titleHover:e.source,anchor:e.anchor,snippet:e.snippet,href:qp(n.hashDocName,e.anchor)},`${e.source}-${t}`)})}),(0,Z.jsx)(DT,{total:_.length,expanded:v,onToggle:()=>y(AT)})]}),t[22]=r,t[23]=_.length,t[24]=h,t[25]=v,t[26]=i,t[27]=m,t[28]=a,t[29]=s,t[30]=o,t[31]=C,t[32]=E):E=t[32];let D;t[33]!==m||t[34]!==E?(D=(0,Z.jsx)(Wr,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":m,children:E})}),t[33]=m,t[34]=E,t[35]=D):D=t[35];let O;return t[36]!==D||t[37]!==T?(O=(0,Z.jsxs)(Kr,{defaultOpen:!0,children:[T,D]}),t[36]=D,t[37]=T,t[38]=O):O=t[38],O}function AT(e){return!e}function jT(e){let t=(0,$.c)(49),{docName:n}=e,{_:r}=Bn(),{addPage:i,folderPaths:a,pages:o,pagesBySlug:s,pagesByBasename:c,loading:l}=Nd(),u,d;t[0]===n?(u=t[1],d=t[2]):(u=[`forward-links`,n],d=()=>CT(n),t[0]=n,t[1]=u,t[2]=d);let f;t[3]!==n||t[4]!==o||t[5]!==l?(f=!l&&(o.has(n)||Wo(n)),t[3]=n,t[4]=o,t[5]=l,t[6]=f):f=t[6];let p;t[7]!==u||t[8]!==d||t[9]!==f?(p={queryKey:u,queryFn:d,enabled:f},t[7]=u,t[8]=d,t[9]=f,t[10]=p):p=t[10];let{data:m,isLoading:h,error:g}=rr(p),_;t[11]===m?.forwardLinks?_=t[12]:(_=m?.forwardLinks??[],t[11]=m?.forwardLinks,t[12]=_);let v=_,[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(n);C!==n&&(w(n),S(!1),b(null));let T;t[13]!==x||t[14]!==v?(T=x?v:v.slice(0,xT),t[13]=x,t[14]=v,t[15]=T):T=t[15];let E=T,D;t[16]!==r||t[17]!==i||t[18]!==y?(D=async function(e,t){if(!y){b(t);try{await In(e,{addPage:i,onCreated:TT}),b(null)}catch(e){let t=e;Dc.error(t instanceof Error?t.message:r({id:`tfi40B`})),b(null)}}},t[16]=r,t[17]=i,t[18]=y,t[19]=D):D=t[19];let O=D,k;t[20]!==r||t[21]!==y||t[22]!==a||t[23]!==O||t[24]!==o||t[25]!==c||t[26]!==s||t[27]!==l?(k=function(e){let{title:t}=e;if(e.kind===`external`){let t=e.title===e.url;return(0,Z.jsx)(OT,{icon:(0,Z.jsx)(ju,{className:`size-3.5`}),rowTooltip:r({id:`XDzAnp`}),title:e.title,path:t?void 0:e.url,titleHover:e.url,snippet:e.snippet,href:e.url,external:!0},`ext:${e.url}`)}let n=Ti(e.docName,{pages:o,folderPaths:a,pagesBySlug:s,pagesByBasename:c}),i=!l&&n.kind===`create`,u=!l&&n.kind===`navigate`&&n.displayState===`folder`,d=wT(e.docName),f=e.title===e.docName?d:e.title,p=`doc:${e.docName}:${e.anchor??``}`,m=n.kind===`navigate`?n.hashDocName:e.docName,h=n.kind===`navigate`&&n.hash?n.hash:qp(m,e.anchor);if(i&&n.kind===`create`){let i={initialDir:n.initialDir,suggestedName:n.suggestedName};return(0,Z.jsx)(OT,{icon:(0,Z.jsx)(Lp,{className:`size-3.5`}),iconColorClass:`text-amber-600 dark:text-amber-400`,rowTooltip:r(y===p?{id:`kj9pAE`}:{id:`IQPyrD`}),ariaLabel:r(y===p?{id:`un8kBM`,values:{linkTitle:t}}:{id:`jEdF24`,values:{linkTitle:t}}),title:f,path:d,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,disabled:y!==null,onClick:()=>void O(i,p)},p)}return u&&n.kind===`navigate`?(0,Z.jsx)(OT,{icon:(0,Z.jsx)(Kf,{className:`size-3.5`}),iconColorClass:`text-sky-600 dark:text-sky-400`,ariaLabel:r({id:`P6lAT3`,values:{linkTitle:t}}),title:f,path:d,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,href:h},p):(0,Z.jsx)(OT,{icon:(0,Z.jsx)(Ge,{className:`size-3.5`}),title:f,path:d,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,href:h},p)},t[20]=r,t[21]=y,t[22]=a,t[23]=O,t[24]=o,t[25]=c,t[26]=s,t[27]=l,t[28]=k):k=t[28];let A=k,j;t[29]===r?j=t[30]:(j=r({id:`O0Z2Xr`}),t[29]=r,t[30]=j);let M;t[31]!==h||t[32]!==v.length||t[33]!==j?(M=(0,Z.jsx)(ET,{title:j,count:v.length,isLoading:h}),t[31]=h,t[32]=v.length,t[33]=j,t[34]=M):M=t[34];let N;t[35]!==r||t[36]!==g||t[37]!==x||t[38]!==h||t[39]!==v.length||t[40]!==A||t[41]!==E?(N=g?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(qh,{children:g instanceof Error?g.message:r({id:`pZAs1T`})})}):v.length===0&&!h?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Yh,{children:(0,Z.jsx)(Y,{id:`roiUQQ`})})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:E.map(A)}),(0,Z.jsx)(DT,{total:v.length,expanded:x,onToggle:()=>S(MT)})]}),t[35]=r,t[36]=g,t[37]=x,t[38]=h,t[39]=v.length,t[40]=A,t[41]=E,t[42]=N):N=t[42];let P;t[43]!==h||t[44]!==N?(P=(0,Z.jsx)(Wr,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":h,children:N})}),t[43]=h,t[44]=N,t[45]=P):P=t[45];let F;return t[46]!==M||t[47]!==P?(F=(0,Z.jsxs)(Kr,{defaultOpen:!0,children:[M,P]}),t[46]=M,t[47]=P,t[48]=F):F=t[48],F}function MT(e){return!e}function NT(e){let t=(0,$.c)(42),{docName:n}=e,{_:r}=Bn(),{pages:i,loading:a}=Nd(),o,s;t[0]===n?(o=t[1],s=t[2]):(o=[`forward-links`,n],s=()=>CT(n),t[0]=n,t[1]=o,t[2]=s);let c;t[3]!==n||t[4]!==i||t[5]!==a?(c=!a&&(i.has(n)||Wo(n)),t[3]=n,t[4]=i,t[5]=a,t[6]=c):c=t[6];let l;t[7]!==o||t[8]!==s||t[9]!==c?(l={queryKey:o,queryFn:s,enabled:c},t[7]=o,t[8]=s,t[9]=c,t[10]=l):l=t[10];let{data:u,isLoading:d,error:f}=rr(l),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(n);h!==n&&(g(n),m(!1));let _=u?.localTargets,v;t[11]===_?v=t[12]:(v=_??[],t[11]=_,t[12]=v);let y=v,b;t[13]!==p||t[14]!==y?(b=p?y:y.slice(0,xT),t[13]=p,t[14]=y,t[15]=b):b=t[15];let x=b,S;t[16]===n?S=t[17]:(S=function(e){let t={docName:n,line:e.line+1,column:e.column+1,source:`links`};Od(n,{kind:`lint`,detail:t}),window.dispatchEvent(new CustomEvent(md,{detail:t}))},t[16]=n,t[17]=S);let C=S,w;t[18]!==r||t[19]!==C?(w=function(e){let t=e.role===`image`,n=e.status===`exact`||e.status===`fallback`,i=e.resolvedTarget??e.href,a=e.status===`missing`?r({id:`VU3Nrn`}):r({id:`XYZ7tp`}),o=n?r(t?{id:`radOpL`,values:{identity:i}}:{id:`6LJJ1v`,values:{identity:i}}):e.status===`missing`?r(t?{id:`vPLUCm`,values:{identity:i}}:{id:`Lrsl_h`,values:{identity:i}}):r(t?{id:`y-LQPF`,values:{identity:i}}:{id:`Y_iImT`,values:{identity:i}});return(0,Z.jsx)(OT,{icon:t?(0,Z.jsx)(di,{className:`size-3.5`}):(0,Z.jsx)(Ge,{className:`size-3.5`}),iconColorClass:n?void 0:`text-amber-600 dark:text-amber-400`,title:wT(i),titleHover:i,ariaLabel:o,trailing:n?void 0:(0,Z.jsx)(Sh,{variant:`outline`,className:`font-normal text-muted-foreground`,children:a}),onClick:()=>C(e)},`lt:${e.range.start}-${e.range.end}`)},t[18]=r,t[19]=C,t[20]=w):w=t[20];let T=w,E;t[21]===r?E=t[22]:(E=r({id:`U3RIJu`}),t[21]=r,t[22]=E);let D;t[23]!==d||t[24]!==y.length||t[25]!==E?(D=(0,Z.jsx)(ET,{title:E,count:y.length,isLoading:d}),t[23]=d,t[24]=y.length,t[25]=E,t[26]=D):D=t[26];let O;t[27]!==r||t[28]!==f||t[29]!==p||t[30]!==d||t[31]!==_||t[32]!==T||t[33]!==y.length||t[34]!==x?(O=f?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(qh,{children:f instanceof Error?f.message:r({id:`1xui0Q`})})}):_===void 0&&!d?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Yh,{children:(0,Z.jsx)(Y,{id:`g-dkjJ`})})}):y.length===0&&!d?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Yh,{children:(0,Z.jsx)(Y,{id:`pJ7XCo`})})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:x.map(T)}),(0,Z.jsx)(DT,{total:y.length,expanded:p,onToggle:()=>m(PT)})]}),t[27]=r,t[28]=f,t[29]=p,t[30]=d,t[31]=_,t[32]=T,t[33]=y.length,t[34]=x,t[35]=O):O=t[35];let k;t[36]!==d||t[37]!==O?(k=(0,Z.jsx)(Wr,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":d,children:O})}),t[36]=d,t[37]=O,t[38]=k):k=t[38];let A;return t[39]!==D||t[40]!==k?(A=(0,Z.jsxs)(Kr,{defaultOpen:!0,children:[D,k]}),t[39]=D,t[40]=k,t[41]=A):A=t[41],A}function PT(e){return!e}function FT(e){let t=(0,$.c)(15),{docName:n,className:r}=e,i=r===void 0?``:r,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(jT,{docName:n}),t[0]=n,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(La,{}),t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Z.jsx)(NT,{docName:n}),t[3]=n,t[4]=s);let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(La,{}),t[5]=c):c=t[5];let l;t[6]===n?l=t[7]:(l=(0,Z.jsx)(kT,{docName:n}),t[6]=n,t[7]=l);let u;t[8]!==a||t[9]!==s||t[10]!==l?(u=(0,Z.jsxs)(Xh,{className:`px-0 py-0`,children:[a,o,s,c,l]}),t[8]=a,t[9]=s,t[10]=l,t[11]=u):u=t[11];let d;return t[12]!==i||t[13]!==u?(d=(0,Z.jsx)(eg,{className:i,children:u}),t[12]=i,t[13]=u,t[14]=d):d=t[14],d}function IT(e){let t=e.setTimer??((e,t)=>setTimeout(e,t)),n=e.clearTimer??(e=>clearTimeout(e)),r=!1,i=!1,a=null,o=null,s=e.baseMs,c=!1,l=n=>{if(!r){if(e.isPaused()){c=!0;return}a=t(u,n)}};async function u(){if(a=null,c=!1,r)return;if(e.isPaused()){c=!0;return}o=new AbortController;let t=o.signal;try{let n=await e.poll(t);if(r)return;n===`ok`?(s=e.baseMs,l(e.baseMs)):(s=Math.min(s*2,e.maxBackoffMs),l(s))}catch{if(r||t.aborted)return;s=Math.min(s*2,e.maxBackoffMs),l(s)}}return{start(){r||i||(i=!0,u())},resume(){r||!e.isPaused()&&c&&a===null&&(c=!1,u())},stop(){r=!0,a!==null&&(n(a),a=null),o?.abort()}}}var LT=1e4,RT=6e4;async function zT(e,t,n){try{let r=await fetch(`/api/history?docName=${encodeURIComponent(e)}&limit=100`,{signal:t});if(!r.ok)return n.setError(n.unavailableMessage),`error`;let i=await r.json();return n.setEntries((i.entries??[]).filter(BT)),n.setError(null),`ok`}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)throw e;return n.setError(n.unavailableMessage),console.error(`[timeline]`,e),`error`}finally{t.aborted||n.setLoading(!1)}}function BT(e){return e.type===`checkpoint`?e.checkpoint!==null&&pc(e.checkpoint.kind):!0}function VT(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return Hc._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return Hc._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return Hc._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return Hc._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?Hc._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function HT(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function UT(e){if(e.type===`checkpoint`)return{kind:`recovered`};if(e.type===`upstream`)return{kind:`upstream`};let t=e.message,n=/^rollback: .+ to ([0-9a-f]{7,40})$/.exec(t);if(n)return{kind:`restore`,targetSha7:n[1].slice(0,7)};let r=/^rename: (.+) -> (.+)$/.exec(t);return r?{kind:`rename`,from:r[1],to:r[2]}:t.startsWith(`reconcile: `)?{kind:`reconcile`}:t.startsWith(`import: `)?{kind:`upstream`}:{kind:`edit`}}function WT(e){return e.split(`/`).pop()??e}function GT(e){return e.type===`checkpoint`?Hc._({id:`C-twqs`}):e.type===`upstream`?Hc._({id:`K_vT1F`}):e.contributors.length===1?e.contributors[0].name:e.contributors.length>1?e.contributors.map(e=>e.name).join(`, `):e.author===`openknowledge-server`||e.author===`server`?Hc._({id:`B2DrPb`}):e.author}function KT(e){let t=$o;return e===t.fileSystem?`file-system`:e===t.service||e===t.gitUpstream?`upstream`:e===t.generator?`generated`:`person`}function qT(e){let t=(0,$.c)(19),{entry:n,isDark:r}=e;if(n.type===`checkpoint`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(kl,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),t[0]=e):e=t[0],e}if(n.type===`upstream`){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(vu,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[1]=e):e=t[1],e}if(n.contributors.length>0){let e=n.contributors[0],i=e.colorSeed??e.name,a;t[2]===i?a=t[3]:(a=Us(i),t[2]=i,t[3]=a);let o=a,s=r?Zs[o]??hc[o]:hc[o],c;t[4]!==s||t[5]!==i?(c=s??Vo(i),t[4]=s,t[5]=i,t[6]=c):c=t[6];let l=c;if(o!==`bot`){let e;t[7]===l?e=t[8]:(e={color:l},t[7]=l,t[8]=e);let n;return t[9]!==o||t[10]!==e?(n=(0,Z.jsx)(sg,{icon:o,width:14,height:14,className:`shrink-0`,style:e}),t[9]=o,t[10]=e,t[11]=n):n=t[11],n}switch(KT(e.name)){case`file-system`:{let e;return t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Qy,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[12]=e):e=t[12],e}case`upstream`:{let e;return t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(yu,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[13]=e):e=t[13],e}case`generated`:{let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(pt,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[14]=e):e=t[14],e}default:{let e;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Vb,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[15]=e):e=t[15],e}}}if(n.authorEmail.includes(`agent`)||n.author.includes(`agent`)||n.authorEmail.includes(`cursor`)||n.authorEmail.includes(`claude`)){let e;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(pt,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=e):e=t[16],e}if(n.author===`openknowledge-server`||n.author===`server`){let e;return t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(yu,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[17]=e):e=t[17],e}let i;return t[18]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Vb,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[18]=i):i=t[18],i}function JT(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function YT(e){let t=(0,$.c)(21),{summaries:n}=e,[r,i]=(0,Q.useState)(!1),a=(0,Q.useId)();if(n.length===0)return null;let o,s;t[0]===n?(o=t[1],s=t[2]):([o,...s]=n,t[0]=n,t[1]=o,t[2]=s);let c=s.length,l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),t[3]=l):l=t[3];let u;t[4]===o?u=t[5]:(u=(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[l,o]}),t[4]=o,t[5]=u);let d;t[6]!==r||t[7]!==s?(d=r&&s.map(ZT),t[6]=r,t[7]=s,t[8]=d):d=t[8];let f;t[9]!==a||t[10]!==u||t[11]!==d?(f=(0,Z.jsxs)(`ul`,{id:a,className:`list-none`,children:[u,d]}),t[9]=a,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p;t[13]!==r||t[14]!==c||t[15]!==a||t[16]!==s.length?(p=s.length>0&&(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":r,"aria-controls":a,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,onClick:e=>{e.stopPropagation(),i(XT)},children:[r?(0,Z.jsx)(Gu,{className:`size-3`}):(0,Z.jsx)(Ku,{className:`size-3`}),r?(0,Z.jsx)(Y,{id:`vLyv1R`}):(0,Z.jsx)(Y,{id:`ZptNUh`,values:{hidden:c}})]}),t[13]=r,t[14]=c,t[15]=a,t[16]=s.length,t[17]=p):p=t[17];let m;return t[18]!==f||t[19]!==p?(m=(0,Z.jsxs)(`div`,{className:`mt-0.5`,children:[f,p]}),t[18]=f,t[19]=p,t[20]=m):m=t[20],m}function XT(e){return!e}function ZT(e,t){return(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),e]},`${t}-${e}`)}function QT(e){let t=(0,$.c)(36),{descriptor:n,allDocs:r,versionBySha7:i,onJumpToVersion:a}=e,{_:o}=Bn();if(n.kind===`restore`){let e,r;t[0]!==o||t[1]!==n.targetSha7||t[2]!==i?(r=i.get(n.targetSha7),e=o(r?{id:`sICrVf`,values:{0:HT(r.timestamp)}}:{id:`i09An-`,values:{0:n.targetSha7}}),t[0]=o,t[1]=n.targetSha7,t[2]=i,t[3]=e,t[4]=r):(e=t[3],r=t[4]);let s=e,c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Ia,{className:`size-3 shrink-0`,"aria-hidden":!0}),t[5]=c):c=t[5];let l;return t[6]!==n.targetSha7||t[7]!==s||t[8]!==a||t[9]!==r?(l=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[c,r?(0,Z.jsx)(`button`,{type:`button`,className:`truncate text-left underline-offset-2 hover:text-foreground hover:underline`,title:s,onClick:e=>{e.stopPropagation(),a(n.targetSha7)},children:s}):(0,Z.jsx)(`span`,{className:`truncate`,title:s,children:s})]}),t[6]=n.targetSha7,t[7]=s,t[8]=a,t[9]=r,t[10]=l):l=t[10],l}if(n.kind===`rename`){let e=`${n.from} → ${n.to}`,r;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(pu,{className:`size-3 shrink-0`,"aria-hidden":!0}),t[11]=r):r=t[11];let i;t[12]!==o||t[13]!==n.from||t[14]!==n.to?(i=o({id:`GkYV_4`,values:{0:WT(n.from),1:WT(n.to)}}),t[12]=o,t[13]=n.from,t[14]=n.to,t[15]=i):i=t[15];let a;t[16]===i?a=t[17]:(a=(0,Z.jsx)(`span`,{className:`truncate`,children:i}),t[16]=i,t[17]=a);let s;return t[18]!==e||t[19]!==a?(s=(0,Z.jsxs)(`p`,{className:`flex items-center gap-1 truncate text-xs text-muted-foreground`,title:e,children:[r,a]}),t[18]=e,t[19]=a,t[20]=s):s=t[20],s}if(n.kind===`reconcile`){let e;t[21]===o?e=t[22]:(e=o({id:`0qyKG6`}),t[21]=o,t[22]=e);let n;return t[23]===e?n=t[24]:(n=(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e}),t[23]=e,t[24]=n),n}if(n.kind===`recovered`)return null;if(r.length>0){let e;t[25]===r?e=t[26]:(e=r.join(`, `),t[25]=r,t[26]=e);let n;t[27]===r?n=t[28]:(n=r.join(`, `),t[27]=r,t[28]=n);let i;return t[29]!==e||t[30]!==n?(i=(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:e,children:n}),t[29]=e,t[30]=n,t[31]=i):i=t[31],i}if(n.kind===`upstream`)return null;let s;t[32]===o?s=t[33]:(s=o({id:`MRZxAn`}),t[32]=o,t[33]=s);let c;return t[34]===s?c=t[35]:(c=(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:s}),t[34]=s,t[35]=c),c}function $T(e){let t=(0,$.c)(122),{entry:n,isDark:r,docName:i,laterEdits:a,onRestoreSuccess:o,versionBySha7:s,onJumpToVersion:c,registerRowRef:l,flashing:u}=e,{_:d}=Bn(),f;t[0]===n.timestamp?f=t[1]:(f=VT(n.timestamp),t[0]=n.timestamp,t[1]=f);let p=f,m;t[2]===n?m=t[3]:(m=GT(n),t[2]=n,t[3]=m);let h=m,g;t[4]===n.timestamp?g=t[5]:(g=HT(n.timestamp),t[4]=n.timestamp,t[5]=g);let _=g,v;t[6]===n.contributors?v=t[7]:(v=n.contributors.flatMap(eE),t[6]=n.contributors,t[7]=v);let y=v,b;t[8]===n?b=t[9]:(b=JT(n),t[8]=n,t[9]=b);let x=b,S;t[10]===n?S=t[11]:(S=UT(n),t[10]=n,t[11]=S);let C=S,[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(!1),O=(0,Q.useRef)(null),k=ug(),A=k?.docName===i&&k.sha===n.sha,j,M;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>()=>O.current?.abort(),M=[],t[12]=j,t[13]=M):(j=t[12],M=t[13]),(0,Q.useEffect)(j,M);let N;t[14]!==_||t[15]!==h||t[16]!==i||t[17]!==n.parentSha||t[18]!==n.sha||t[19]!==a||t[20]!==p?(N=()=>{cg(),lg({docName:i,sha:n.sha,parentSha:n.parentSha??null,laterEdits:a,authorName:h,relativeTime:p,absoluteTime:_})},t[14]=_,t[15]=h,t[16]=i,t[17]=n.parentSha,t[18]=n.sha,t[19]=a,t[20]=p,t[21]=N):N=t[21];let P=N,F;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(F=function(){O.current?.abort(),O.current=null,D(!1),T(!1)},t[22]=F):F=t[22];let I=F,L;t[23]!==d||t[24]!==i||t[25]!==n.sha||t[26]!==o?(L=async function(){D(!0);let e=new AbortController;O.current=e;let t=function(){e.signal.aborted||D(!1),O.current===e&&(O.current=null)},r;try{r=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:i,commitSha:n.sha}),signal:e.signal})}catch(r){let a=r;!e.signal.aborted&&!(a instanceof DOMException&&a.name===`AbortError`)&&(console.error(`[timeline] rollback fetch failed`,{docName:i,sha:n.sha,err:a}),Dc.error(d({id:`NkXEFS`}),{duration:4e3})),t();return}if(e.signal.aborted){t();return}if(r.ok)T(!1),o();else{let e=`HTTP ${r.status}`;try{let t=xc.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}console.error(`[timeline] rollback failed`,{docName:i,sha:n.sha,status:r.status,detail:e}),Dc.error(d({id:`uM6jnS`}),{description:e,duration:6e3})}t()},t[23]=d,t[24]=i,t[25]=n.sha,t[26]=o,t[27]=L):L=t[27];let R=L,z;t[28]!==n||t[29]!==r?(z=(0,Z.jsx)(qT,{entry:n,isDark:r}),t[28]=n,t[29]=r,t[30]=z):z=t[30];let B=z,V=u?`ring-2 ring-ring ring-offset-1 ring-offset-background`:``,ee;t[31]===V?ee=t[32]:(ee=[`flex flex-col rounded-lg transition-shadow`,V],t[31]=V,t[32]=ee);let H=ee.join(` `),U=A?`bg-muted`:`hover:bg-muted/80`,W;t[33]===U?W=t[34]:(W=[`group flex w-full items-start gap-2.5 rounded-lg px-3 py-2.5 text-left transition-colors cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring`,U],t[33]=U,t[34]=W);let G=W.join(` `),te;t[35]===P?te=t[36]:(te=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),P())},t[35]=P,t[36]=te);let ne;t[37]===B?ne=t[38]:(ne=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:B}),t[37]=B,t[38]=ne);let re;t[39]===h?re=t[40]:(re=(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:h}),t[39]=h,t[40]=re);let K;t[41]!==n.timestamp||t[42]!==p?(K=(0,Z.jsx)(`time`,{className:`ml-auto shrink-0 text-xs text-muted-foreground/80`,dateTime:n.timestamp,title:n.timestamp,children:p}),t[41]=n.timestamp,t[42]=p,t[43]=K):K=t[43];let ie;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[44]=ie):ie=t[44];let q;t[45]===d?q=t[46]:(q=d({id:`Yea-K5`}),t[45]=d,t[46]=q);let ae;t[47]!==R||t[48]!==a?(ae=e=>{e.stopPropagation(),a>0?T(!0):R()},t[47]=R,t[48]=a,t[49]=ae):ae=t[49];let oe;t[50]===E?oe=t[51]:(oe=E?(0,Z.jsx)(ip,{"aria-hidden":`true`,className:`size-3`}):(0,Z.jsx)(Rp,{className:`size-3`}),t[50]=E,t[51]=oe);let se;t[52]!==E||t[53]!==q||t[54]!==ae||t[55]!==oe?(se=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`timeline-entry-restore`,"aria-label":q,disabled:E,onClick:ae,children:oe})}),t[52]=E,t[53]=q,t[54]=ae,t[55]=oe,t[56]=se):se=t[56];let ce;t[57]===d?ce=t[58]:(ce=d({id:`Yea-K5`}),t[57]=d,t[58]=ce);let le;t[59]===ce?le=t[60]:(le=(0,Z.jsx)(Vr,{side:`top`,children:ce}),t[59]=ce,t[60]=le);let ue;t[61]!==se||t[62]!==le?(ue=(0,Z.jsxs)(Ur,{children:[se,le]}),t[61]=se,t[62]=le,t[63]=ue):ue=t[63];let de;t[64]!==re||t[65]!==K||t[66]!==ue?(de=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[re,K,ie,ue]}),t[64]=re,t[65]=K,t[66]=ue,t[67]=de):de=t[67];let fe;t[68]===x?fe=t[69]:(fe=x.length>0&&(0,Z.jsx)(YT,{summaries:x}),t[68]=x,t[69]=fe);let pe;t[70]!==y||t[71]!==C||t[72]!==c||t[73]!==s?(pe=(0,Z.jsx)(QT,{descriptor:C,allDocs:y,versionBySha7:s,onJumpToVersion:c}),t[70]=y,t[71]=C,t[72]=c,t[73]=s,t[74]=pe):pe=t[74];let J;t[75]!==de||t[76]!==fe||t[77]!==pe?(J=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[de,fe,pe]}),t[75]=de,t[76]=fe,t[77]=pe,t[78]=J):J=t[78];let me;t[79]!==P||t[80]!==A||t[81]!==G||t[82]!==te||t[83]!==ne||t[84]!==J?(me=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-pressed":A,"data-testid":`timeline-entry-open`,className:G,onClick:P,onKeyDown:te,children:[ne,J]}),t[79]=P,t[80]=A,t[81]=G,t[82]=te,t[83]=ne,t[84]=J,t[85]=me):me=t[85];let he;t[86]!==l||t[87]!==H||t[88]!==me?(he=(0,Z.jsx)(`div`,{ref:l,className:H,children:me}),t[86]=l,t[87]=H,t[88]=me,t[89]=he):he=t[89];let ge;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(ge=e=>{e?T(!0):I()},t[90]=ge):ge=t[90];let _e;t[91]===d?_e=t[92]:(_e=d({id:`n3wx1q`}),t[91]=d,t[92]=_e);let ve;t[93]===_e?ve=t[94]:(ve=(0,Z.jsx)(Jr,{children:_e}),t[93]=_e,t[94]=ve);let ye;t[95]===a?ye=t[96]:(ye=(0,Z.jsx)(Y,{id:`nfPccR`,values:{laterEdits:a}}),t[95]=a,t[96]=ye);let be;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(Y,{id:`5ZbJFS`}),t[97]=be):be=t[97];let xe;t[98]===ye?xe=t[99]:(xe=(0,Z.jsxs)(qr,{children:[ye,` `,be]}),t[98]=ye,t[99]=xe);let Se;t[100]!==ve||t[101]!==xe?(Se=(0,Z.jsxs)($r,{children:[ve,xe]}),t[100]=ve,t[101]=xe,t[102]=Se):Se=t[102];let Ce;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(X,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:I,children:(0,Z.jsx)(Y,{id:`dEgA5A`})}),t[103]=Ce):Ce=t[103];let we;t[104]===R?we=t[105]:(we=()=>R(),t[104]=R,t[105]=we);let Te;t[106]===E?Te=t[107]:(Te=E?(0,Z.jsx)(ip,{"aria-hidden":`true`,className:`mr-2 size-4`}):null,t[106]=E,t[107]=Te);let Ee;t[108]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Z.jsx)(Y,{id:`yKu_3Y`}),t[108]=Ee):Ee=t[108];let De;t[109]!==E||t[110]!==we||t[111]!==Te?(De=(0,Z.jsxs)(Zr,{children:[Ce,(0,Z.jsxs)(X,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:E,onClick:we,children:[Te,Ee]})]}),t[109]=E,t[110]=we,t[111]=Te,t[112]=De):De=t[112];let Oe;t[113]!==Se||t[114]!==De?(Oe=(0,Z.jsxs)(Yr,{children:[Se,De]}),t[113]=Se,t[114]=De,t[115]=Oe):Oe=t[115];let ke;t[116]!==w||t[117]!==Oe?(ke=(0,Z.jsx)(ei,{open:w,onOpenChange:ge,children:Oe}),t[116]=w,t[117]=Oe,t[118]=ke):ke=t[118];let Ae;return t[119]!==he||t[120]!==ke?(Ae=(0,Z.jsxs)(Z.Fragment,{children:[he,ke]}),t[119]=he,t[120]=ke,t[121]=Ae):Ae=t[121],Ae}function eE(e){return e.docs}function tE(e){let t=(0,$.c)(27),{docName:n}=e,{_:r}=Bn(),{resolvedTheme:i}=sr(),a=i===`dark`,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=[],t[0]=o):o=t[0];let[s,c]=(0,Q.useState)(o),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),p=(0,Q.useRef)(new Map),[m,h]=(0,Q.useState)(null),g=(0,Q.useRef)(null),_=new Map;for(let e of s)_.set(e.sha.slice(0,7),e);let v,y;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>()=>clearTimeout(g.current??void 0),y=[],t[1]=v,t[2]=y):(v=t[1],y=t[2]),(0,Q.useEffect)(v,y);let b=function(e){let t=_.get(e);t&&(p.current.get(t.sha)?.scrollIntoView({behavior:`smooth`,block:`center`}),h(t.sha),clearTimeout(g.current??void 0),g.current=setTimeout(()=>h(null),1600))},x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=function(){dg()},t[3]=x):x=t[3];let S=x,C,w;t[4]!==r||t[5]!==n?(C=()=>{if(!n){c([]);return}u(!0);let e=IT({baseMs:LT,maxBackoffMs:RT,isPaused:rE,poll:e=>zT(n,e,{setEntries:c,setError:f,setLoading:u,unavailableMessage:r({id:`brCtGB`})})});e.start();let t=()=>e.resume();return typeof document<`u`&&document.addEventListener(`visibilitychange`,t),()=>{e.stop(),typeof document<`u`&&document.removeEventListener(`visibilitychange`,t)}},w=[n,r],t[4]=r,t[5]=n,t[6]=C,t[7]=w):(C=t[6],w=t[7]),(0,Q.useEffect)(C,w);let T;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)($h,{children:(0,Z.jsx)(Jh,{children:(0,Z.jsx)(Y,{id:`cklVjM`})})}),t[8]=T):T=t[8];let E;t[9]!==r||t[10]!==l?(E=l&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,role:`status`,"aria-busy":`true`,"aria-label":r({id:`o49mDZ`}),children:[1,2,3].map(nE)}),t[9]=r,t[10]=l,t[11]=E):E=t[11];let D;t[12]!==d||t[13]!==l?(D=!l&&d&&(0,Z.jsx)(`div`,{className:`px-4 py-3`,children:(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:d})}),t[12]=d,t[13]=l,t[14]=D):D=t[14];let O;t[15]!==s||t[16]!==d||t[17]!==l?(O=!l&&!d&&s.length===0&&(0,Z.jsx)(`div`,{className:`px-4 py-8 text-center`,children:(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`Ta25TG`})})}),t[15]=s,t[16]=d,t[17]=l,t[18]=O):O=t[18];let k=!l&&!d&&s.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:s.map((e,t)=>(0,Z.jsx)($T,{entry:e,isDark:a,docName:n,laterEdits:t,onRestoreSuccess:S,versionBySha7:_,onJumpToVersion:b,registerRowRef:t=>{t?p.current.set(e.sha,t):p.current.delete(e.sha)},flashing:m===e.sha},e.sha))}),A;t[19]!==E||t[20]!==D||t[21]!==O||t[22]!==k?(A=(0,Z.jsxs)(`div`,{className:`flex-1 overflow-y-auto subtle-scrollbar scroll-fade-mask`,children:[E,D,O,k]}),t[19]=E,t[20]=D,t[21]=O,t[22]=k,t[23]=A):A=t[23];let j;return t[24]!==A||t[25]!==T?(j=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[T,A]}),t[24]=A,t[25]=T,t[26]=j):j=t[26],j}function nE(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(tg,{className:`size-3.5 rounded mt-0.5 shrink-0`}),(0,Z.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Z.jsx)(tg,{className:`h-3 w-28`}),(0,Z.jsx)(tg,{className:`h-3 w-40`})]})]},e)}function rE(){return typeof document<`u`&&document.visibilityState===`hidden`}var iE=`open-knowledge:lint-source-fixed`,aE=Object.freeze({source:`local`,skipStoreHooks:!1,context:Object.freeze({origin:`lint-fix`})});function oE(e,t){let n=e.split(`
3
- `),r=0;for(let e=0;e<t.line&&e<n.length;e+=1)r+=n[e].length+1;let i=n[Math.min(t.line,n.length-1)]?.length??0;return r+Math.min(Math.max(t.character,0),i)}function sE(e){return e.flatMap(e=>e.fixes??[])}function cE(e,t,n){if(t.length===0)return!1;let r=e.document.getText(`source`),i=r.toString(),a=t.map(e=>({from:oE(i,e.range.start),to:oE(i,e.range.end),insert:e.newText})).sort((e,t)=>t.to-e.to||t.from-e.from||e.insert.localeCompare(t.insert)),o=0;return e.document.transact(()=>{let e=1/0,t;for(let n of a){let i=t!==void 0&&n.from===t.from&&n.to===t.to&&n.insert===t.insert;t=n,!(i||n.to>e)&&(n.to>n.from&&r.delete(n.from,n.to-n.from),n.insert.length>0&&r.insert(n.from,n.insert),e=n.from,o+=1)}},aE),o>0&&ge(n),typeof window<`u`&&window.dispatchEvent(new CustomEvent(iE)),!0}var lE=[{id:`outline`,icon:ab},{id:`links`,icon:lt},{id:`graph`,icon:cb},{id:`timeline`,icon:Fy},{id:`problems`,icon:Lp},{id:`comments`,icon:fp}],uE=[`outline`,`problems`,`comments`];function dE(e){let t=0,n=0;for(let r of e)r.severity===`error`?t+=1:n+=1;return{errorCount:t,warningCount:n}}function fE(e){return e===`outline`?Hc._({id:`dD7NPy`}):e===`links`?Hc._({id:`Rj01Fz`}):e===`graph`?Hc._({id:`x2fr_j`}):e===`problems`?Hc._({id:`OXdGnd`}):e===`comments`?Hc._({id:`VbyRUy`}):Hc._({id:`cklVjM`})}function pE(){return n(()=>import(`./GraphPanel-BdWJsnt-.js`),__vite__mapDeps([38,1,28,2,3,29,30,31,32,33,37,7,8,9,39,11,12,13,40,41,16,17,18,19,42,43,44,45,14,46,47,48,49,50,51,52,53,21,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69]),import.meta.url)}var mE=(0,Q.lazy)(async()=>({default:(await pE()).GraphPanel})),hE=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-xON2KhOz.js`),__vite__mapDeps([70,1,37,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,42,43,44,45,71,2,72,73,33,74,75,76,77,78,79,80,81,82,28,3,29,30,31,32,83,66,84,85,86,87,88,89,4,5,90,40,91,92,24,23,93,94,25,34,56,57,58,95,68,61,96,97,98,64,65,99,100,55,59,60,62,101,102,103,26,104,105,106,107,35,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123]),import.meta.url)).ActivityModeContent}));function gE(e){let t=(0,$.c)(48),{docName:n,isSourceMode:r,activeTab:i,onActiveTabChange:a,mode:o,isCollapsed:s}=e,c=s===void 0?!1:s,{_:l}=Bn(),{activeProvider:u,activeDocName:d}=Et(),{data:f}=ig(n),p=d===n?u:null,m=Pf(p,f?.effective??null),h=Yu(n),g=h.findings,_;t[0]!==g||t[1]!==m?(_=[...m,...g],t[0]=g,t[1]=m,t[2]=_):_=t[2];let v=_,y,b;t[3]!==n||t[4]!==m||t[5]!==p?(y=()=>{p!==null&&Dd(n,`lint`,dE(m))},b=[n,p,m],t[3]=n,t[4]=m,t[5]=p,t[6]=y,t[7]=b):(y=t[6],b=t[7]),(0,Q.useEffect)(y,b);let x,S;t[8]!==n||t[9]!==g||t[10]!==h.status||t[11]!==p?(x=()=>{p===null||h.status!==`loaded`||Dd(n,`links`,dE(g))},S=[n,p,g,h.status],t[8]=n,t[9]=g,t[10]=h.status,t[11]=p,t[12]=x,t[13]=S):(x=t[12],S=t[13]),(0,Q.useEffect)(x,S);let C;t[14]!==n||t[15]!==p?(C=e=>{p!==null&&e.fixes&&e.fixes.length>0&&cE(p,e.fixes,n)},t[14]=n,t[15]=p,t[16]=C):C=t[16];let w=C,T;t[17]!==n||t[18]!==m||t[19]!==p?(T=()=>{p!==null&&cE(p,sE(m),n)},t[17]=n,t[18]=m,t[19]=p,t[20]=T):T=t[20];let E=T,D=jr(),O;t[21]!==n||t[22]!==p?(O=e=>{if(p===null)return;let t=p.document.getText(`source`).toString().split(`
4
- `)[e.range.start.line];xl(yT(n,e,t),{submit:!0})},t[21]=n,t[22]=p,t[23]=O):O=t[23];let k=O,A;t[24]===n?A=t[25]:(A=e=>{xl(bT(e===`doc`?n:null),{submit:!0})},t[24]=n,t[25]=A);let j=A,M=OC()?lE.filter(vE):lE,N=M.some(e=>e.id===i)?i:`outline`,P=o===`doc`&&M.length>1,F,I;t[26]!==N||t[27]!==c||t[28]!==o?(F=()=>(fT(!c&&o===`doc`&&N===`comments`),_E),I=[c,o,N],t[26]=N,t[27]=c,t[28]=o,t[29]=F,t[30]=I):(F=t[29],I=t[30]),(0,Q.useEffect)(F,I);let L=P?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(Ba,{type:`single`,variant:`outline`,value:N,onValueChange:e=>{e&&a(e)},"aria-label":l({id:`SrOuyg`}),children:M.map(e=>{let{id:t,icon:n}=e,r=fE(t),i=t===`problems`&&v.length>0;return(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(Ra,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":i?l({id:`2m_bmh`,values:{0:v.length,label:r}}):r,asChild:!0,children:(0,Z.jsxs)(Br,{className:`relative`,children:[(0,Z.jsx)(n,{}),i&&(0,Z.jsx)(Sh,{variant:`notification`,"aria-hidden":`true`,className:`pointer-events-none absolute -top-0.5 right-0.5 h-3.5 min-w-3.5 rounded-full px-1 font-sans text-[9px] leading-none tabular-nums`,children:v.length>99?`99+`:v.length})]})}),(0,Z.jsx)(Vr,{side:`bottom`,children:r})]},t)})})}):null,R;t[31]!==v||t[32]!==n||t[33]!==N||t[34]!==k||t[35]!==E||t[36]!==w||t[37]!==j||t[38]!==r||t[39]!==h.status||t[40]!==p||t[41]!==o||t[42]!==P||t[43]!==D?(R=o===`doc`?(0,Z.jsxs)(`div`,{...P?{role:`tabpanel`,id:`panel-${N}`,"aria-labelledby":`tab-${N}`}:{},className:`min-h-0 flex-1`,children:[N===`outline`&&(0,Z.jsx)(yd,{docName:n,isSourceMode:r}),N===`links`&&(0,Z.jsx)(FT,{docName:n}),N===`graph`&&(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`-lCAuQ`})}),children:(0,Z.jsx)(mE,{activeDocName:n})}),N===`timeline`&&(0,Z.jsx)(tE,{docName:n}),N===`comments`&&(0,Z.jsx)(cT,{docName:n}),N===`problems`&&(0,Z.jsx)(pd,{docName:n,diagnostics:v,linkFindingsStatus:h.status,onFix:p===null?void 0:w,onAutoFix:p===null?void 0:E,onAskAi:p!==null&&D!==null?k:void 0,onFixWithAi:D===null?void 0:j})]}):(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`ONPvOb`})}),children:(0,Z.jsx)(hE,{})})}),t[31]=v,t[32]=n,t[33]=N,t[34]=k,t[35]=E,t[36]=w,t[37]=j,t[38]=r,t[39]=h.status,t[40]=p,t[41]=o,t[42]=P,t[43]=D,t[44]=R):R=t[44];let z;return t[45]!==L||t[46]!==R?(z=(0,Z.jsxs)(Z.Fragment,{children:[L,R]}),t[45]=L,t[46]=R,t[47]=z):z=t[47],z}function _E(){return fT(!1)}function vE(e){return uE.includes(e.id)}function yE(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function bE(e,t){let n=getComputedStyle(e.ownerDocument.documentElement);return t*parseFloat(n.fontSize)}function xE(e){return e/100*window.innerHeight}function SE(e){return e/100*window.innerWidth}function CE(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function wE({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=CE(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=bE(t,i);break;case`em`:r=yE(t,i);break;case`vh`:r=xE(i);break;case`vw`:r=SE(i);break}return r}function TE(e){return parseFloat(e.toFixed(3))}function EE({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function DE(e){let{panels:t}=e,n=EE({group:e});return n===0?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=TE(wE({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=TE(wE({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=TE(wE({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=TE(wE({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function OE(e,t=`Assertion error`){if(!e)throw Error(t)}function kE(e,t){return Array.from(t).sort(e===`horizontal`?AE:jE)}function AE(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function jE(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function ME(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function NE(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function PE({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=NE(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return OE(i,`No rect found`),i}var FE;function IE(){return FE===void 0&&(FE=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),FE}function LE(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=kE(n,Array.from(t.children).filter(ME).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.hasAttribute(`data-disabled`)||(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,PE({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p;break}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=IE()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:EE({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var RE=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}},zE={cursorFlags:0,state:`inactive`},BE=new RE;function VE(){return zE}function HE(e){return BE.addListener(`change`,e)}function UE(e){let t=zE,n={...zE};n.cursorFlags=e,zE=n,BE.emit(`change`,{prev:t,next:n})}function WE(e){let t=zE;zE=e,BE.emit(`change`,{prev:t,next:e})}var GE=e=>e,KE=()=>{},qE=1,JE=2,YE=4,XE=8,ZE=3,QE=12,$E;function eD(){return $E===void 0&&($E=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&($E=!0)),$E}function tD({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++;break}})}if(!(r===0&&i===0)){switch(n){case`active`:if(e&&eD()){let t=(e&qE)!==0,n=(e&JE)!==0,r=(e&YE)!==0,i=(e&XE)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}break}return eD()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var nD=new WeakMap;function rD(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=nD.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));let r=VE();switch(r.state){case`active`:case`hover`:{let e=tD({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}nD.set(e,{prevStyle:t,styleSheet:n})}var iD=new Map,aD=new RE;function oD(e){iD=new Map(iD),iD.delete(e)}function sD(e,t){for(let[t]of iD)if(t.id===e)return t}function cD(e,t){for(let[t,n]of iD)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function lD(){return iD}function uD(e,t){return aD.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function dD(e,t,n){let r=iD.get(e);iD=new Map(iD),iD.set(e,t),aD.emit(`groupChange`,{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:r,next:t})}function fD(e){let t=VE(),n=!1;switch(t.state){case`active`:WE({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(rD(e),n=!0,t.hitRegions.forEach(e=>{let t=cD(e.group.id,!0);dD(e.group,t,{isUserInteraction:!0})}))}return n}function pD(e){e.defaultPrevented||fD(e.currentTarget)}function mD(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=NE(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t);break}}return r?{distance:i,hitRegion:r}:void 0}function hD(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function gD(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:SD(e),b:SD(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();OE(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:xD(bD(n.a)),b:xD(bD(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var _D=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function vD(e){let t=getComputedStyle(CD(e)??e).display;return t===`flex`||t===`inline-flex`}function yD(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||vD(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||_D.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function bD(e){let t=e.length;for(;t--;){let n=e[t];if(OE(n,`Missing node`),yD(n))return n}return null}function xD(e){return e&&Number(getComputedStyle(e).zIndex)||0}function SD(e){let t=[];for(;e;)t.push(e),e=CD(e);return t}function CD(e){let{parentNode:t}=e;return hD(t)?t.host:t}function wD(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function TD({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!ME(n)||n.contains(e)||e.contains(n))return!0;if(gD(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(wD(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function ED(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=LE(r),a=mD(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&TD({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function DD(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function OD(e,t,n=0){return Math.abs(TE(e)-TE(t))<=n}function kD(e,t){return OD(e,t)?0:e>t?1:-1}function AD({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(kD(r,c)<0)if(a){let e=(i+c)/2;r=kD(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=TE(r),r}function jD({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(OD(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;OE(u!=null,`Invalid first pivot index`),OE(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];OE(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(OE(n!=null,`Previous layout not found for panel index ${t}`),OD(n,i)){let t=o-n;kD(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];OE(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(OE(n!=null,`Previous layout not found for panel index ${t}`),OD(n,o)){let t=n-i;kD(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];OE(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&kD(i,c)<0)if(e>0){let t=c-o,n=t/2;kD(i+e,c)<0&&(e=kD(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;kD(i-e,c)<0&&(e=kD(100+e,n)>0?0:-t)}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];OE(e!=null,`Previous layout not found for panel index ${r}`);let a=AD({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];OE(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=AD({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!OD(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(DD(c,l))return i;{let t=e<0?d:u,r=s[t];OE(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=AD({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!OD(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];OE(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=AD({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(OD(i,s)||(t-=s-i,l[r]=s),OD(t,0))break;e>0?r--:r++}}}if(!OD(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function MD(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||kD(e[n],t[n])!==0)return!1;return!0}function ND({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n];r.length!==t.length&&(e=KD(t),n=Object.values(e),r=[...n]);let i=r.reduce((e,t)=>e+t,0);if(!OD(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];OE(t!=null,`No layout data found for index ${e}`);let n=100/i*t;r[e]=n}let a=0;for(let e=0;e<t.length;e++){let i=n[e];OE(i!=null,`No layout data found for index ${e}`);let o=r[e];OE(o!=null,`No layout data found for index ${e}`);let s=AD({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!OD(a,0))for(let e=0;e<t.length;e++){let n=r[e];OE(n!=null,`No layout data found for index ${e}`);let i=n+a,o=AD({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,OD(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function PD({groupId:e,panelId:t}){let n=()=>{let t=lD();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=({nextSize:e,panels:n,prevLayout:r,derivedPanelConstraints:i})=>{let o=a(),s=n.findIndex(e=>e.id===t),c=s===0,l=s===n.length-1;if(l&&e<o&&(c||n.slice(0,s).every((e,t)=>{let n=i[t];return n?.collapsible&&OD(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,s).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:TE(100-e)}}return jD({delta:l?o-e:e-o,initialLayout:r,panelConstraints:i,pivotIndices:l?[s-1,s]:[s,s+1],prevLayout:r,trigger:`imperative-api`})},s=e=>{if(e===a())return;let{defaultLayoutDeferred:t,derivedPanelConstraints:r,group:i,groupSize:s,layout:c,separatorToPanels:l}=n(),u=ND({layout:o({nextSize:e,panels:i.panels,prevLayout:c,derivedPanelConstraints:r}),panelConstraints:r});MD(c,u)||dD(i,{defaultLayoutDeferred:t,derivedPanelConstraints:r,groupSize:s,layout:u,separatorToPanels:l})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),o=a();e&&o!==t&&(n.expandToSize=o,s(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:o}=i(),c=a();if(e&&c===t){let e=o.expandToSize??n;e===0&&(e=1),s(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&OD(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=EE({group:t});s(TE(wE({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function FD(e){e.defaultPrevented||ED(e,lD()).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=PD({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function ID(e){let t=lD();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function LD({groupId:e}){let t=()=>{let t=lD();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:s}=t(),c=ND({layout:e,panelConstraints:r});return n?o:(MD(o,c)||dD(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function RD(e,t){let n=ID(e),r=cD(n.id,!0),i=n.separators.find(t=>t.element===e);OE(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);OE(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=LD({groupId:n.id}).getLayout(),c=ND({layout:jD({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});MD(s,c)||dD(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function zD(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=ID(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&RD(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&RD(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&RD(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&RD(t,-5);break;case`End`:e.preventDefault(),RD(t,100);break;case`Enter`:{e.preventDefault();let n=ID(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=cD(n.id,!0),o=n.separators.find(e=>e.element===t);OE(o,`Matching separator not found`);let s=a.get(o);OE(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(OE(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];RD(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=ID(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);OE(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus({preventScroll:!0});break}case`Home`:e.preventDefault(),RD(t,-100);break}}function BD(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=lD(),n=ED(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({focusVisible:!1,preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),WE({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}function VD({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:c,panels:l}=n,{disableCursor:u}=n.mutableState,d=0;d=a?c===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:c===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),p=i.get(n);if(!f||!p)return;let{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:_,separatorToPanels:v}=p;if(h&&_&&v){let t=jD({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(MD(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?qE:JE;break;case`vertical`:s|=d<0?YE:XE;break}}else dD(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&ZE:c|=s&ZE,t.movementY===0?c|=o&QE:c|=s&QE,UE(c),rD(e)}function HD(e){let t=lD(),n=VE();switch(n.state){case`active`:VD({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,pointerDownAtPoint:n.pointerDownAtPoint,prevCursorFlags:n.cursorFlags})}}function UD(e){if(e.defaultPrevented)return;let t=VE(),n=lD();switch(t.state){case`active`:if(e.buttons===0){WE({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=cD(e.group.id,!0);dD(e.group,t,{isUserInteraction:!0})});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}VD({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=ED(e,n);r.length===0?t.state!==`inactive`&&WE({cursorFlags:0,state:`inactive`}):WE({cursorFlags:0,hitRegions:r,state:`hover`}),rD(e.currentTarget);break}}}function WD(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(VE().state){case`hover`:WE({cursorFlags:0,state:`inactive`})}}function GD(e){e.defaultPrevented||e.pointerType===`mouse`&&e.button>0||fD(e.currentTarget)&&e.preventDefault()}function KD(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=TE(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=TE((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function qD(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=EE({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:TE(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function JD(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function YD({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,s=new Map,c=[];for(let l of e.panels){let e=r[l.id]??0;switch(l.panelConstraints.groupResizeBehavior){case`preserve-pixel-size`:{o=!0;let r=TE(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e;break}}if(!o||c.length===0)return r;let l=100-i,u={...r};if(s.forEach((e,t)=>{u[t]=e}),a>0)for(let e of c)u[e]=TE((r[e]??0)/a*l);else{let e=TE(l/c.length);for(let t of c)u[t]=e}return u}function XD(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var ZD=new Map;function QD(e){let t=!0;OE(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){let t=EE({group:e});if(t===0)return;let n=cD(e.id);if(!n)return;let r=DE(e),i=n.defaultLayoutDeferred?KD(r):n.layout,a=ND({layout:YD({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&MD(n.layout,a)&&JD(n.derivedPanelConstraints,r)&&n.groupSize===t)return;dD(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else qD(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{OE(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=EE({group:e}),s=DE(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(XD(e.panels,l)||(l=void 0));let u=ND({layout:e.mutableState.layouts[c]??l??KD(s),panelConstraints:s}),d=e.element.ownerDocument;ZD.set(d,(ZD.get(d)??0)+1);let f=new Map;return LE(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),dD(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{OE(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,zD)}),d.addEventListener(`contextmenu`,pD,!0),d.addEventListener(`dblclick`,FD,!0),d.addEventListener(`pointerdown`,BD,!0),d.addEventListener(`pointerleave`,HD),d.addEventListener(`pointermove`,UD),d.addEventListener(`pointerout`,WD),d.addEventListener(`pointerup`,GD,!0),function(){t=!1,ZD.set(d,Math.max(0,(ZD.get(d)??0)-1)),oD(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,zD)}),ZD.get(d)||(d.removeEventListener(`contextmenu`,pD,!0),d.removeEventListener(`dblclick`,FD,!0),d.removeEventListener(`pointerdown`,BD,!0),d.removeEventListener(`pointerleave`,HD),d.removeEventListener(`pointermove`,UD),d.removeEventListener(`pointerout`,WD),d.removeEventListener(`pointerup`,GD,!0)),a.disconnect()}}function $D(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function eO(e){let t=(0,Q.useId)();return`${e??t}`}var tO=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function nO(e){let t=(0,Q.useRef)(e);return tO(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function rO(...e){return nO(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function iO(e){let t=(0,Q.useRef)({...e});return tO(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var aO=(0,Q.createContext)(null);function oO(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:GE});(0,Q.useImperativeHandle)(t,()=>n.current,[]),tO(()=>{Object.assign(n.current,LD({groupId:e}))})}function sO({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,Q.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=nO(e=>{MD(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=nO((e,t)=>{MD(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e,{isUserInteraction:t}))}),_=eO(s),v=(0,Q.useRef)(null),[y,b]=$D(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=rO(v,a);oO(_,o);let C=nO((e,t)=>{let r=VE(),i=sD(e),a=cD(e);if(a){let e=!1;switch(r.state){case`active`:e=r.hitRegions.some(e=>e.group===i);break}return{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),w=iO({defaultLayout:n,disableCursor:r}),T=(0,Q.useMemo)(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:C,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=kE(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=kE(u,[...t.separators,e]),b(),()=>{t.separators=t.separators.filter(t=>t!==e),b()}},updatePanelProps:(e,{disabled:t})=>{let n=x.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=sD(_),i=cD(_);r&&i&&dD(r,{...i,derivedPanelConstraints:DE(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=x.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[C,_,b,u,w]),E=(0,Q.useRef)(null);return tO(()=>{let e=v.current;if(e===null)return;let t=x.current,n;if(w.defaultLayout!==void 0&&Object.keys(w.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=w.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={disabled:!!i,element:e,id:_,mutableState:{defaultLayout:n,disableCursor:!!w.disableCursor,expandedPanelSizes:x.current.lastExpandedPanelSizes,layouts:x.current.layouts},orientation:u,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};E.current=r;let a=QD(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=cD(r.id,!0);!o&&s.length>0&&(h(c),g(c,!1));let l=uD(_,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:i}=e.next;if(t||n.length===0)return;let a=r.panels.map(({id:e})=>e).join(`,`);r.mutableState.layouts[a]=i,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=OD(t.collapsedSize,i[t.panelId]),a=OD(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=VE().state!==`active`;h(i),o&&g(i,e.isUserInteraction)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,Q.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,Z.jsx)(aO.Provider,{value:T,children:(0,Z.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:S,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}sO.displayName=`Group`;function cO(){return(0,Q.useRef)(null)}function lO(){let e=(0,Q.useContext)(aO);return OE(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function uO(e,t){let{id:n}=lO(),r=(0,Q.useRef)({collapse:KE,expand:KE,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:KE});(0,Q.useImperativeHandle)(t,()=>r.current,[]),tO(()=>{Object.assign(r.current,PD({groupId:n,panelId:e}))})}function dO({children:e,className:t,collapsedSize:n=`0%`,collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:s=`preserve-relative-size`,id:c,maxSize:l=`100%`,minSize:u=`0%`,onResize:d,panelRef:f,style:p,...m}){let h=!!c,g=eO(c),_=iO({disabled:a}),v=(0,Q.useRef)(null),y=rO(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=lO(),T=d!==null,E=nO((e,t,n)=>{d?.(e,c,n)});tO(()=>{let e=v.current;if(e!==null)return C({element:e,id:g,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:T?E:void 0,panelConstraints:{groupResizeBehavior:s,collapsedSize:n,collapsible:r,defaultSize:i,disabled:_.disabled,maxSize:l,minSize:u}})},[s,n,r,i,T,g,h,l,u,E,C,_]),(0,Q.useEffect)(()=>{w(g,{disabled:a})},[a,g,w]),uO(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>uD(x,e),D,D),k;return k=O?JSON.parse(O):i===void 0?{flexGrow:1}:{flexGrow:void 0,flexShrink:void 0,flexBasis:i},(0,Z.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...fO,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...k},children:(0,Z.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}dO.displayName=`Panel`;var fO={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function pO(){return(0,Q.useRef)(null)}function mO({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=ND({layout:jD({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=ND({layout:jD({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function hO({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=eO(a),l=iO({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),[m,h]=(0,Q.useState)(!1),g=(0,Q.useRef)(null),_=rO(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=lO(),C=b===`horizontal`?`vertical`:`horizontal`;tO(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=HE(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=uD(y,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);d(mO({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[y,c,x,l]),(0,Q.useEffect)(()=>{S(c,{disabled:n,disableDoubleClick:r})},[n,r,c,S]);let w;n&&!v&&(w=`not-allowed`);let T;if(n)T=`disabled`;else switch(f){case`active`:T=`active`;break;default:T=m?`focus`:f}return(0,Z.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":C,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":T,"data-testid":c,id:c,onBlur:()=>h(!1),onFocus:()=>h(!0),ref:_,role:`separator`,style:{flexBasis:`auto`,cursor:w,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}hO.displayName=`Separator`;function gO(e){let t=(0,$.c)(55),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({fileName:r,extension:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{_:a}=Bn(),[o,s]=(0,Q.useState)(`diagram`),c=pg(i),l;t[4]===n?l=t[5]:(l={"data-mermaid-file-viewer-extension":n},t[4]=n,t[5]=l);let u=l;if(c.status===`loading`){let e;return t[6]!==u||t[7]!==r?(e=(0,Z.jsx)(vg,{fileName:r,dataAttr:`data-mermaid-file-viewer`,extraAttrs:u}),t[6]=u,t[7]=r,t[8]=e):e=t[8],e}if(c.status===`error`){let e=c.message,a;t[9]!==n||t[10]!==c.httpStatus||t[11]!==r||t[12]!==i.assetPath?(a=fg({assetPath:i.assetPath,fileName:r,extension:n,httpStatus:c.httpStatus}),t[9]=n,t[10]=c.httpStatus,t[11]=r,t[12]=i.assetPath,t[13]=a):a=t[13];let o;return t[14]!==u||t[15]!==c.message||t[16]!==r||t[17]!==a?(o=(0,Z.jsx)(gg,{fileName:r,dataAttr:`data-mermaid-file-viewer`,extraAttrs:u,message:e,openFile:a}),t[14]=u,t[15]=c.message,t[16]=r,t[17]=a,t[18]=o):o=t[18],o}let d=c.content,f;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>{e&&s(e)},t[19]=f):f=t[19];let p;t[20]===a?p=t[21]:(p=a({id:`72xhRD`}),t[20]=a,t[21]=p);let m;t[22]===a?m=t[23]:(m=a({id:`DEWDbv`}),t[22]=a,t[23]=m);let h;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Br,{children:(0,Z.jsx)(Ve,{className:`size-4`})}),t[24]=h):h=t[24];let g;t[25]===m?g=t[26]:(g=(0,Z.jsx)(Ra,{value:`diagram`,"aria-label":m,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:h}),t[25]=m,t[26]=g);let _;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(Vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`i-ShMB`})}),t[27]=_):_=t[27];let v;t[28]===g?v=t[29]:(v=(0,Z.jsxs)(Ur,{children:[g,_]}),t[28]=g,t[29]=v);let y;t[30]===a?y=t[31]:(y=a({id:`Y6SK9K`}),t[30]=a,t[31]=y);let b;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Br,{children:(0,Z.jsx)(jn,{className:`size-4`})}),t[32]=b):b=t[32];let x;t[33]===y?x=t[34]:(x=(0,Z.jsx)(Ra,{value:`source`,"aria-label":y,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:b}),t[33]=y,t[34]=x);let S;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`wdxz7K`})}),t[35]=S):S=t[35];let C;t[36]===x?C=t[37]:(C=(0,Z.jsxs)(Ur,{children:[x,S]}),t[36]=x,t[37]=C);let w;t[38]!==o||t[39]!==C||t[40]!==p||t[41]!==v?(w=(0,Z.jsx)(`div`,{className:`flex shrink-0 items-center justify-center border-b bg-background py-2`,children:(0,Z.jsxs)(Ba,{type:`single`,value:o,onValueChange:f,"aria-label":p,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 bg-muted p-0.5 data-[size=sm]:rounded-[10px]`,children:[v,C]})}),t[38]=o,t[39]=C,t[40]=p,t[41]=v,t[42]=w):w=t[42];let T;t[43]!==n||t[44]!==r||t[45]!==o||t[46]!==i||t[47]!==d?(T=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:o===`diagram`?(0,Z.jsx)(`div`,{className:`flex h-full min-h-0 flex-col p-3 [&_.mermaid-error-source]:hidden`,children:(0,Z.jsx)(Ou,{chart:d,className:`min-h-0 flex-1`})}):(0,Z.jsx)(mg,{...i,fileName:r,extension:n})}),t[43]=n,t[44]=r,t[45]=o,t[46]=i,t[47]=d,t[48]=T):T=t[48];let E;return t[49]!==u||t[50]!==r||t[51]!==o||t[52]!==w||t[53]!==T?(E=(0,Z.jsxs)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":r,"data-mermaid-file-viewer":``,"data-mermaid-file-viewer-state":`loaded`,"data-mermaid-file-viewer-mode":o,...u,children:[w,T]}),t[49]=u,t[50]=r,t[51]=o,t[52]=w,t[53]=T,t[54]=E):E=t[54],E}function _O(e){return gs(`/api/asset?path=${encodeURIComponent(e)}`)}function vO(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function yO(e){let t=(0,$.c)(8),{assetPath:n,mediaKind:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(_g,{entry:{kind:`asset`,path:n},className:`shrink-0 border-b bg-background px-3 py-1.5`}),t[0]=n,t[1]=i);let a;t[2]!==n||t[3]!==r?(a=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(bO,{assetPath:n,mediaKind:r})}),t[2]=n,t[3]=r,t[4]=a):a=t[4];let o;return t[5]!==i||t[6]!==a?(o=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[i,a]}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function bO(e){let t=(0,$.c)(33),{assetPath:n,mediaKind:r}=e,[i,a]=(0,Q.useState)(!1),o;t[0]===n?o=t[1]:(o=_O(n),t[0]=n,t[1]=o);let s=o,c;t[2]===n?c=t[3]:(c=n.split(`/`).pop()??n,t[2]=n,t[3]=c);let l=c,u,d,f,p;if(t[4]!==n||t[5]!==l||t[6]!==i||t[7]!==r||t[8]!==s){p=Symbol.for(`react.early_return_sentinel`);bb0:{if(f=l.includes(`.`)?l.split(`.`).pop()??``:``,d=f.length>0?f.toUpperCase():`FILE`,u=i?`text`:r,u===`pdf`){let e;t[13]!==l||t[14]!==s?(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(v,{src:s,title:l,fillContainer:!0})}),t[13]=l,t[14]=s,t[15]=e):e=t[15];let n;t[16]!==l||t[17]!==e?(n=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":l,children:e}),t[16]=l,t[17]=e,t[18]=n):n=t[18],p=n;break bb0}if(u===`text`){let e;t[19]===n?e=t[20]:(e=vO(n),t[19]=n,t[20]=e),p=(0,Z.jsx)(mg,{src:e,assetPath:n,fileName:l,extension:f.toLowerCase()},n);break bb0}if(u===`mermaid`){let e;t[21]===n?e=t[22]:(e=vO(n),t[21]=n,t[22]=e),p=(0,Z.jsx)(gO,{src:e,assetPath:n,fileName:l,extension:f.toLowerCase()},n);break bb0}}t[4]=n,t[5]=l,t[6]=i,t[7]=r,t[8]=s,t[9]=u,t[10]=d,t[11]=f,t[12]=p}else u=t[9],d=t[10],f=t[11],p=t[12];if(p!==Symbol.for(`react.early_return_sentinel`))return p;let m;t[23]!==n||t[24]!==u||t[25]!==d||t[26]!==l||t[27]!==f||t[28]!==s?(m=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:u===`image`?(0,Z.jsx)(Se,{src:s,alt:l,draggable:!1,targetExistence:`exists`,slotClassName:`flex h-full w-full items-center justify-center`,className:`max-h-full max-w-full`}):u===`video`?(0,Z.jsx)(`video`,{src:s,controls:!0,className:`max-h-full max-w-full`}):u===`audio`?(0,Z.jsx)(`audio`,{src:s,controls:!0,className:`w-full max-w-md`}):(0,Z.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-8 text-center`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,Z.jsx)(`div`,{className:`flex items-center justify-center tracking-wide text-muted-foreground/80 text-2xs font-mono`,children:d}),(0,Z.jsx)(`div`,{className:`max-w-full text-balance break-words tracking-tight font-light text-2xl`,children:l})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(X,{variant:`default`,size:`sm`,onClick:()=>a(!0),"data-testid":`asset-preview-open-as-text`,className:`font-mono uppercase`,children:(0,Z.jsx)(Y,{id:`qFWMl-`})}),(0,Z.jsx)(X,{variant:`outline`,size:`sm`,className:`font-mono uppercase`,onClick:()=>{vh({url:s,projectRelPath:n,ext:f.toLowerCase(),title:l,forceOsDelegation:!1})},children:(0,Z.jsx)(Y,{id:`9npOH9`})})]})]})}),t[23]=n,t[24]=u,t[25]=d,t[26]=l,t[27]=f,t[28]=s,t[29]=m):m=t[29];let h;return t[30]!==l||t[31]!==m?(h=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":l,children:m}),t[30]=l,t[31]=m,t[32]=h):h=t[32],h}function xO(){let e=(0,$.c)(5),{_:t}=Bn(),n;e[0]===t?n=e[1]:(n=t({id:`3VsNTI`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(tg,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(tg,{className:`h-4 w-full`}),(0,Z.jsx)(tg,{className:`h-4 w-3/4`})]}),e[2]=r):r=e[2];let i;return e[3]===n?i=e[4]:(i=(0,Z.jsx)(`div`,{className:`tiptap-editor pt-10`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=i),i}function SO(e){let{_:t}=Bn();return e===`existing-repo`?[{id:`draft-spec`,icon:Uy,label:t({id:`LdKIHS`}),prompt:t({id:`N_7kkF`})},{id:`organize-specs`,icon:ab,label:t({id:`cuA8QW`}),prompt:t({id:`mPy9lS`})},{id:`document-architecture`,icon:cb,label:t({id:`6eniID`}),prompt:t({id:`uDlyqd`})}]:[{id:`competitor-research`,icon:jb,label:t({id:`GUqTzn`}),prompt:t({id:`KOZud0`})},{id:`eng-specs`,icon:Uy,label:t({id:`Qvls7J`}),prompt:t({id:`6qMe0o`})},{id:`bird-wiki`,icon:Oy,label:t({id:`FqTpiN`}),prompt:t({id:`jtg_8-`})}]}function CO(e){let t=(0,$.c)(13),{scenario:n,className:r}=e,{_:i}=Bn(),a=SO(n),[o,s]=(0,Q.useState)(null),c=(0,Q.useRef)(void 0),l,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>()=>clearTimeout(c.current),u=[],t[0]=l,t[1]=u):(l=t[0],u=t[1]),(0,Q.useEffect)(l,u);let d,f;if(t[2]!==i||t[3]!==r||t[4]!==o||t[5]!==a){let e=function(e,t){_r(t).then(()=>{s(e),clearTimeout(c.current),c.current=setTimeout(()=>s(null),1600)}).catch(wO)};t[8]===r?d=t[9]:(d=gr(`w-full divide-y divide-border/60 overflow-hidden rounded-2xl border border-border/60 bg-card`,r),t[8]=r,t[9]=d),f=a.map(t=>{let n=t.icon,r=o===t.id;return(0,Z.jsxs)(`li`,{className:`group flex items-start gap-3 p-3.5`,"data-testid":`copy-prompt-${t.id}`,children:[(0,Z.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium leading-tight text-foreground`,children:t.label}),(0,Z.jsx)(`span`,{className:`truncate text-1sm leading-relaxed text-muted-foreground`,children:t.prompt})]}),(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e(t.id,t.prompt),"aria-label":i(r?{id:`6V3Ea3`}:{id:`RG4XHV`,values:{0:t.label}}),className:gr(`shrink-0 gap-1.5 transition-opacity focus-visible:opacity-100 uppercase font-mono`,r?`opacity-100`:`opacity-0 group-hover:opacity-100`),"data-testid":`copy-prompt-button-${t.id}`,children:[r?(0,Z.jsx)(Uu,{className:`size-3.5`,"aria-hidden":`true`}):(0,Z.jsx)(Fn,{className:`size-3.5`,"aria-hidden":`true`}),i(r?{id:`6V3Ea3`}:{id:`he3ygx`})]})]},t.id)}),t[2]=i,t[3]=r,t[4]=o,t[5]=a,t[6]=d,t[7]=f}else d=t[6],f=t[7];let p;return t[10]!==d||t[11]!==f?(p=(0,Z.jsx)(`ul`,{className:d,children:f}),t[10]=d,t[11]=f,t[12]=p):p=t[12],p}function wO(){}function TO(e,t,n){return e.trim().length>0||t.length>0||n}new Set(qa.map(e=>e.id));function EO(e,t){Tl(e,t)}function DO(e){let t=(0,$.c)(32),{scenario:n,className:r}=e,{_:i}=Bn(),{states:a,refresh:o}=Sr(),s=Wa(),{dispatch:c}=Ll(),l=gu(),u=jr(),[d,f]=(0,Q.useState)(kO),p=Za(),m=Ua(),h;t[0]===s?h=t[1]:(h=e=>Ha(s,e.source,e.id,!0,e.supported),t[0]=s,t[1]=h);let g=m.filter(h),_=Ga(g,p),v;t[2]===u?.installedClis?v=t[3]:(v=u?.installedClis??{},t[2]=u?.installedClis,t[3]=v);let y=wl({sticky:d,effectiveThreadAgent:_,enabledClis:u===null?[]:Dl(s,u.installedClis),enabledDesktopTargets:Ml(s,a),unresolvedDesktopTargets:Sl(s,a),installedClis:v,terminalAvailable:u!==null,threadsAvailable:!0,desktopSelectable:!0}),b=y.kind===`thread`,x=y.kind===`cli`?y.cli:null,S=y.kind===`desktop`?y.target:null,C=x!==null,w=(0,Q.useRef)(null),[T]=(0,Q.useState)(OO),[E,D]=(0,Q.useState)(!0),[O,k]=(0,Q.useState)(!1),A;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){D(e),e||k(!1)},t[4]=A):A=t[4];let j=A,M=SO(n),N;t[5]!==s||t[6]!==a?(N=e=>Ka(s,e.id,a[e.id]?.installed),t[5]=s,t[6]=a,t[7]=N):N=t[7];let P=qa.filter(N),F=qa.every(e=>a[e.id]?.installed!=null),I=u!==null&&Dl(s,u.installedClis).length>0,L=F&&P.length===0&&g.length===0&&!I,R;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){f(e),Tl(e),EO(e)},t[8]=R):R=t[8];let z=R,B;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(e){f(Nl(e)),Tl(Nl(e))},t[9]=B):B=t[9];let V=B,ee;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(ee=function(e){Va(e),f(Ol),Tl(Ol)},t[10]=ee):ee=t[10];let H=ee,U=function(){let{instruction:e,mentions:t}=w.current?.getContent()??{instruction:``,mentions:[]};if(!TO(e,t,!1)){k(!0);return}let r=fu({workspace:l,description:e,scenario:n,mentions:t});r!==null&&(tu(r,_===null?void 0:{agent:{source:_.source,id:_.id}}),w.current?.clear(),Da())},W=function(){if(u===null||x===null)return;let{instruction:e,mentions:t}=w.current?.getContent()??{instruction:``,mentions:[]};if(!TO(e,t,!1)){k(!0);return}let r=fu({workspace:l,description:e,scenario:n,mentions:t});r!==null&&(u.launchInTerminal(r,x),w.current?.clear(),Da())},G=function(e){let{instruction:t,mentions:r}=w.current?.getContent()??{instruction:``,mentions:[]};if(!TO(t,r,!1)){k(!0);return}if(EO(e),a[e]?.installed!==!0){let t=qa.find(t=>t.id===e);t&&(Hl(t),Dc.info(i({id:`L1BQTH`,values:{0:t.displayName}})));return}let o=fu({workspace:l,description:t,scenario:n,mentions:r});o!==null&&(c(e,o),w.current?.clear(),Da())},te=function(){b?U():C?W():S!==null&&G(S)},ne=function(e){w.current?.setText(e),w.current?.focus()};if(L){let e;t[11]===r?e=t[12]:(e=gr(`flex w-full flex-wrap items-center justify-between gap-3 rounded-2xl border border-border/60 bg-card px-4 py-3`,r),t[11]=r,t[12]=e);let n;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(pt,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),t[13]=n):n=t[13];let i;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[n,(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`XT-L4j`})})]}),t[14]=i):i=t[14];let a;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:jc,className:`gap-1.5`,"data-testid":`create-configure-agents`,children:[(0,Z.jsx)(mr,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`jRAGrQ`})]}),t[15]=a):a=t[15];let o;return t[16]===e?o=t[17]:(o=(0,Z.jsxs)(`div`,{className:e,"data-testid":`create-no-agents`,children:[i,a]}),t[16]=e,t[17]=o),o}let re=u?Dl(s,u.installedClis):[],K=P.length>0,ie=re.length>0,q=g.length>0,ae=y.kind!==`none`,oe;t[18]===r?oe=t[19]:(oe=gr(`flex w-full flex-col gap-3`,r),t[18]=r,t[19]=oe);let se;t[20]!==i||t[21]!==n?(se=i(n===`skill`?{id:`Dut9Ht`}:{id:`7hctf2`}),t[20]=i,t[21]=n,t[22]=se):se=t[22];let ce;t[23]!==i||t[24]!==n?(ce=i(n===`skill`?{id:`eNhWUl`}:{id:`0jD-Gn`}),t[23]=i,t[24]=n,t[25]=ce):ce=t[25];let le;t[26]!==E||t[27]!==O?(le=O&&E?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-input-required`,children:(0,Z.jsx)(Y,{id:`1FLarN`})}):(0,Z.jsx)(`span`,{}),t[26]=E,t[27]=O,t[28]=le):le=t[28];let ue=ae?(0,Z.jsxs)(Ma,{children:[(0,Z.jsx)(X,{type:`button`,onClick:()=>b?U():C?W():S===null?void 0:G(S),variant:`outline`,className:`gap-1.5`,"data-testid":`create-with-agent`,children:b&&_!==null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ya,{agentId:_.id,iconUrl:_.iconUrl,className:`size-3.5`}),(0,Z.jsx)(Ql,{agentName:_.name})]}):C&&x!==null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(aa,{id:na(x),"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`ti6aF_`,values:{0:ao[x].displayName}})]}):S===null?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(aa,{id:S,"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Gl,{displayName:zl(S)}),(0,Z.jsx)(ju,{"aria-hidden":`true`,className:`size-3.5`})]})}),(0,Z.jsxs)(va,{onOpenChange:e=>{e&&o()},children:[(0,Z.jsx)(fa,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,"aria-label":i({id:`nskygk`}),size:`icon`,variant:`outline`,"data-testid":`create-with-agent-menu`,children:(0,Z.jsx)(Gu,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsxs)(ga,{align:`end`,className:`max-h-80 min-w-[200px]`,children:[q?(0,Z.jsxs)(da,{"aria-label":i({id:`RXEbZy`}),children:[(0,Z.jsx)(ma,{children:(0,Z.jsx)(Y,{id:`RXEbZy`})}),g.map(e=>(0,Z.jsxs)(ca,{onSelect:()=>H(e),"data-testid":`create-agent-option-thread-${e.source}:${e.id}`,children:[(0,Z.jsx)(Ya,{agentId:e.id,iconUrl:e.iconUrl,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1 truncate`,children:e.name}),b&&_!==null&&_.source===e.source&&_.id===e.id?(0,Z.jsx)(Uu,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},`${e.source}:${e.id}`))]}):null,q&&(ie||K)?(0,Z.jsx)(ya,{}):null,ie?(0,Z.jsxs)(da,{"aria-label":i({id:`ALhMYW`}),children:[(0,Z.jsx)(ma,{children:(0,Z.jsx)(Y,{id:`ALhMYW`})}),re.map(e=>{let{displayName:t}=ao[e];return(0,Z.jsxs)(ca,{onSelect:()=>V(e),"data-testid":`create-with-cli-${e}`,"aria-label":i({id:`QYfQdv`,values:{displayName:t}}),children:[(0,Z.jsx)(aa,{id:na(e),"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t}),x===e?(0,Z.jsx)(Uu,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e)})]}):null,K?(0,Z.jsxs)(Z.Fragment,{children:[ie?(0,Z.jsx)(ya,{}):null,(0,Z.jsxs)(da,{"aria-label":i({id:`BwKH4d`}),children:[(0,Z.jsxs)(ma,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(Y,{id:`BwKH4d`}),(0,Z.jsx)(ju,{"aria-hidden":`true`,className:`size-3`})]}),P.map(e=>(0,Z.jsxs)(ca,{onSelect:()=>z(e.id),"data-testid":`create-agent-option-${e.id}`,children:[(0,Z.jsx)(aa,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Zl,{displayName:e.displayName})}),!C&&e.id===S?(0,Z.jsx)(Uu,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null,(0,Z.jsx)(ya,{}),(0,Z.jsxs)(ca,{onSelect:jc,"data-testid":`create-agent-option-settings`,children:[(0,Z.jsx)(mr,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`jRAGrQ`})})]})]})]})]}):(0,Z.jsx)(X,{type:`button`,variant:`outline`,disabled:!0,className:`gap-1.5`,"data-testid":`create-with-agent`,children:(0,Z.jsx)(Y,{id:`hYgDIe`})}),de;return t[29]!==le||t[30]!==ue?(de=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 px-3 pb-3`,children:[le,ue]}),t[29]=le,t[30]=ue,t[31]=de):de=t[31],(0,Z.jsxs)(`div`,{className:oe,children:[(0,Z.jsxs)(`div`,{onMouseDown:e=>Ta(e,w),className:`flex w-full cursor-text flex-col rounded-2xl border border-border/60 bg-card shadow-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[(0,Z.jsx)(Aa,{ref:w,ariaLabel:se,placeholder:ce,onEmptyChange:j,onContentChange:Ca,onSubmit:te,initialDoc:T,className:`max-h-96 overflow-y-auto px-4 py-3 text-sm leading-relaxed subtle-scrollbar [&_.ProseMirror]:min-h-16`}),de]}),n===`new-project`&&M.length>0?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`I5685_`})}),M.map(e=>{let t=e.icon;return(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>ne(e.prompt),className:`gap-1.5 rounded-md font-normal text-muted-foreground hover:text-foreground`,"data-testid":`create-suggestion-${e.id}`,children:[(0,Z.jsx)(t,{className:`size-3.5`,"aria-hidden":`true`}),e.label]},e.id)})]}):null]})}function OO(){return Ea().doc??void 0}function kO(){return jl()}function AO(e){let t=(0,$.c)(18),{title:n,subtitle:r,celebrateSignal:i,onRageStreak:a}=e,o=(0,Q.useRef)(0),s=(0,Q.useRef)(null),c;t[0]===a?c=t[1]:(c=function(){let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=s.current,n=t===null?1/0:e-t;s.current=e;let r=ty(o.current,n);o.current=r,!(r<6)&&(o.current=0,a?.())},t[0]=a,t[1]=c);let l=a?c:void 0,u;t[2]===a?u=t[3]:(u=a?{viewTransitionName:ev}:void 0,t[2]=a,t[3]=u);let d;t[4]!==i||t[5]!==l||t[6]!==u?(d=(0,Z.jsx)(kr,{size:64,celebrateSignal:i,onRage:l,style:u}),t[4]=i,t[5]=l,t[6]=u,t[7]=d):d=t[7];let f;t[8]===n?f=t[9]:(f=(0,Z.jsx)(`h2`,{className:`text-2xl font-light tracking-tighter text-balance`,children:n}),t[8]=n,t[9]=f);let p;t[10]===r?p=t[11]:(p=r?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}):null,t[10]=r,t[11]=p);let m;t[12]!==f||t[13]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[f,p]}),t[12]=f,t[13]=p,t[14]=m):m=t[14];let h;return t[15]!==d||t[16]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex flex-col items-start gap-3 @md/emptystate:flex-row @md/emptystate:items-center @md/emptystate:gap-4`,children:[d,m]}),t[15]=d,t[16]=m,t[17]=h):h=t[17],h}function jO({isOnboarding:e,isEmbedded:t}){return e?{title:{id:`6h4zVU`},subtitle:t?{id:`vGeNNQ`}:{id:`qpQwGC`}}:{title:{id:`FOGD7m`},subtitle:t?{id:`3DTatP`}:{id:`MqQoV-`}}}var MO=`open-knowledge:create-top-level-file`;function NO(e={}){window.dispatchEvent(new CustomEvent(MO,{detail:e}))}function PO(e){let t=t=>{let n=t.detail;e(n??{})};return window.addEventListener(MO,t),()=>window.removeEventListener(MO,t)}function FO(e){let t=(0,$.c)(29),{celebrateSignal:n,onAddStarterPack:r,onRageStreak:i}=e,{_:a}=Bn(),o=Be(),{title:s,subtitle:c}=jO({isOnboarding:!1,isEmbedded:o}),l=af(),u;t[0]!==l.data||t[1]!==l.status?(u=l.status===`ready`?l.data:[],t[0]=l.data,t[1]=l.status,t[2]=u):u=t[2];let d=u,f=l.status===`loading`||l.status===`idle`,p=l.status===`error`,m=AO,h=a(s),g=a(c),_;t[3]!==m||t[4]!==n||t[5]!==i||t[6]!==h||t[7]!==g?(_=(0,Z.jsx)(m,{title:h,subtitle:g,celebrateSignal:n,onRageStreak:i}),t[3]=m,t[4]=n,t[5]=i,t[6]=h,t[7]=g,t[8]=_):_=t[8];let v;t[9]===o?v=t[10]:(v=o?(0,Z.jsx)(CO,{scenario:`existing-repo`}):(0,Z.jsx)(DO,{scenario:`existing-repo`}),t[9]=o,t[10]=v);let y;t[11]!==d||t[12]!==p||t[13]!==f?(y=f||p||d.length>0?(0,Z.jsx)(RO,{templates:d,loading:f,error:p,onSelect:LO}):null,t[11]=d,t[12]=p,t[13]=f,t[14]=y):y=t[14];let b,x;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(dr,{"aria-hidden":`true`,className:`size-3`}),b=(0,Z.jsx)(Y,{id:`IajAbS`}),t[15]=b,t[16]=x):(b=t[15],x=t[16]);let S;t[17]===r?S=t[18]:(S=(0,Z.jsxs)(X,{onClick:r,variant:`link-muted`,size:`xs`,className:`font-mono text-xs uppercase tracking-wider`,children:[x,b]}),t[17]=r,t[18]=S);let C;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(X,{variant:`link-muted`,className:`justify-end`,size:`sm`,onClick:IO,children:(0,Z.jsx)(Y,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(Du,{"aria-hidden":`true`,className:`size-3`})}})}),t[19]=C):C=t[19];let w;t[20]===S?w=t[21]:(w=(0,Z.jsxs)(`div`,{className:`-mt-6 flex w-full items-center justify-between gap-4`,children:[S,C]}),t[20]=S,t[21]=w);let T;t[22]!==w||t[23]!==y?(T=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8`,children:[y,w]}),t[22]=w,t[23]=y,t[24]=T):T=t[24];let E;return t[25]!==T||t[26]!==_||t[27]!==v?(E=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8 py-12 max-w-5xl my-auto`,"data-testid":`create-view`,children:[_,v,T]}),t[25]=T,t[26]=_,t[27]=v,t[28]=E):E=t[28],E}function IO(){return NO({initialDir:``})}function LO(e,t){return NO({template:{folder:e,name:t}})}function RO(e){let t=(0,$.c)(25),{templates:n,loading:r,error:i,onSelect:a}=e,{_:o}=Bn(),s;t[0]===o?s=t[1]:(s=o({id:`_8quCH`}),t[0]=o,t[1]=s);let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`_8quCH`})}),t[2]=c):c=t[2];let l;t[3]!==o||t[4]!==i||t[5]!==r||t[6]!==n?(l=r||i?null:(0,Z.jsx)(Sh,{className:`text-2xs`,variant:`gray`,"aria-label":o({id:`X7u0xR`,values:{0:n.length}}),children:n.length}),t[3]=o,t[4]=i,t[5]=r,t[6]=n,t[7]=l):l=t[7];let u;t[8]===l?u=t[9]:(u=(0,Z.jsxs)(`header`,{className:`flex items-center gap-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[c,l]}),t[8]=l,t[9]=u);let d;t[10]===o?d=t[11]:(d=o({id:`irFGwu`}),t[10]=o,t[11]=d);let f;t[12]!==i||t[13]!==r||t[14]!==a||t[15]!==n?(f=r?(0,Z.jsx)(`p`,{className:`p-4 text-1sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`Hl89Qd`})}):i?(0,Z.jsx)(`p`,{role:`alert`,className:`p-4 text-1sm text-destructive`,children:(0,Z.jsx)(Y,{id:`54Y6Fg`})}):n.map(e=>(0,Z.jsx)(zO,{template:e,targetLabel:e.source_folder===``?`/`:`${e.source_folder}/`,onClick:()=>a(e.source_folder,e.name)},`${e.source_folder}/${e.name}`)),t[12]=i,t[13]=r,t[14]=a,t[15]=n,t[16]=f):f=t[16];let p;t[17]!==r||t[18]!==d||t[19]!==f?(p=(0,Z.jsx)(`div`,{className:`w-full overflow-hidden rounded-xl border border-border/60 bg-card`,children:(0,Z.jsx)(`section`,{"aria-busy":r,"aria-label":d,tabIndex:0,className:`subtle-scrollbar scroll-fade-mask flex max-h-[260px] w-full flex-col overflow-y-auto overscroll-contain focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,children:f})}),t[17]=r,t[18]=d,t[19]=f,t[20]=p):p=t[20];let m;return t[21]!==s||t[22]!==u||t[23]!==p?(m=(0,Z.jsxs)(`section`,{"aria-label":s,className:`flex w-full flex-col gap-3`,children:[u,p]}),t[21]=s,t[22]=u,t[23]=p,t[24]=m):m=t[24],m}function zO(e){let t=(0,$.c)(24),{template:n,targetLabel:r,onClick:i}=e,{_:a}=Bn(),o;t[0]!==n.name||t[1]!==n.title?(o=n.title?.trim()||n.name,t[0]=n.name,t[1]=n.title,t[2]=o):o=t[2];let s=o,c=`${n.name}.md`,l=n.source_folder===``,u;t[3]!==a||t[4]!==s||t[5]!==c||t[6]!==l||t[7]!==r?(u=a(l?{id:`89TtiD`,values:{displayTitle:s,fileName:c}}:{id:`0_J12R`,values:{displayTitle:s,fileName:c,targetLabel:r}}),t[3]=a,t[4]=s,t[5]=c,t[6]=l,t[7]=r,t[8]=u):u=t[8];let d=u,f;t[9]===s?f=t[10]:(f=(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium leading-tight text-foreground/80`,children:s}),t[9]=s,t[10]=f);let p;t[11]===c?p=t[12]:(p=(0,Z.jsx)(`span`,{className:`truncate font-mono text-1sm font-normal text-muted-foreground`,children:c}),t[11]=c,t[12]=p);let m;t[13]!==f||t[14]!==p?(m=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[f,p]}),t[13]=f,t[14]=p,t[15]=m):m=t[15];let h=`shrink-0 font-mono text-1sm ${l?`text-muted-foreground/70`:`text-muted-foreground`}`,g;t[16]!==h||t[17]!==r?(g=(0,Z.jsx)(`span`,{className:h,children:r}),t[16]=h,t[17]=r,t[18]=g):g=t[18];let _;return t[19]!==d||t[20]!==i||t[21]!==m||t[22]!==g?(_=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,onClick:i,"aria-label":d,className:`group flex h-auto w-full items-center justify-between gap-4 rounded-none p-4 text-left transition-colors hover:bg-muted/50 focus-visible:bg-muted/50`,children:[m,g]}),t[19]=d,t[20]=i,t[21]=m,t[22]=g,t[23]=_):_=t[23],_}function BO(e){let t=(0,$.c)(27),{terminalOpen:n,agentsOpen:r,onRageStreak:i}=e,a=n===void 0?!1:n,o=r===void 0?!1:r,[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(void 0),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(0),h=(0,Q.useRef)(!1),g=(0,Q.useRef)(void 0),_,v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>{let e=!1,t=async function(){try{let{ok:t,body:n}=await uh();if(e)return;let r=t?Ho.safeParse(n):null;r?.success?(f(UO(r.data.documents)),h.current=!0):h.current||=(f(1),!0)}catch{!e&&!h.current&&(f(1),h.current=!0)}};t();let n=Xc(e=>{e.includes(`files`)&&t()});return()=>{e=!0,n(),clearTimeout(g.current)}},v=[],t[0]=_,t[1]=v):(_=t[0],v=t[1]),(0,Q.useEffect)(_,v);let y;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(y=function(){clearTimeout(g.current),g.current=setTimeout(()=>m(HO),500),uh().then(e=>{let{ok:t,body:n}=e;if(!t)return;let r=Ho.safeParse(n);r.success&&f(UO(r.data.documents))}).catch(VO)},t[2]=y):y=t[2];let b=y,x=d!==null,S=d===0,C;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(C=function(e){c(e),e||u(void 0)},t[3]=C):C=t[3];let w=C;if(a||o){let e=a?`justify-end`:`justify-center`,n;t[4]===e?n=t[5]:(n=gr(`@container/emptystate flex min-h-0 flex-1 flex-col items-center pb-8 pt-10`,e),t[4]=e,t[5]=n);let r;t[6]!==p||t[7]!==S||t[8]!==x||t[9]!==i?(r=x?(0,Z.jsx)(WO,{isOnboarding:S,celebrateSignal:p,onRageStreak:i}):null,t[6]=p,t[7]=S,t[8]=x,t[9]=i,t[10]=r):r=t[10];let o;t[11]===r?o=t[12]:(o=(0,Z.jsx)(`div`,{className:`flex w-full flex-col items-center px-4 @md/emptystate:px-10 @2xl/emptystate:px-16`,children:r}),t[11]=r,t[12]=o);let s;return t[13]!==o||t[14]!==n?(s=(0,Z.jsx)(`div`,{"data-testid":`empty-editor-state`,className:n,children:o}),t[13]=o,t[14]=n,t[15]=s):s=t[15],s}let T;t[16]!==p||t[17]!==S||t[18]!==x||t[19]!==i?(T=x?S?(0,Z.jsx)(GO,{onRageStreak:i,celebrateSignal:p,onPackSelect:e=>{u(e),c(!0)}}):(0,Z.jsx)(FO,{onRageStreak:i,celebrateSignal:p,onAddStarterPack:()=>{c(!0)}}):null,t[16]=p,t[17]=S,t[18]=x,t[19]=i,t[20]=T):T=t[20];let E;t[21]!==l||t[22]!==s?(E=(0,Z.jsx)(uC,{open:s,onOpenChange:w,onSeedApplied:b,initialPackId:l}),t[21]=l,t[22]=s,t[23]=E):E=t[23];let D;return t[24]!==T||t[25]!==E?(D=(0,Z.jsx)(`div`,{"data-testid":`empty-editor-state`,className:`@container/emptystate flex min-h-0 flex-1 flex-col items-center overflow-y-auto subtle-scrollbar`,children:(0,Z.jsxs)(`div`,{className:`flex w-full flex-1 flex-col items-center px-4 @md/emptystate:px-10 @2xl/emptystate:px-16`,children:[T,E]})}),t[24]=T,t[25]=E,t[26]=D):D=t[26],D}function VO(){}function HO(e){return e+1}function UO(e){return vm(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function WO(e){let t=(0,$.c)(16),{isOnboarding:n,celebrateSignal:r,onRageStreak:i}=e,{_:a}=Bn(),o=Be(),s,c,l,u;if(t[0]!==a||t[1]!==o||t[2]!==n){let{title:e,subtitle:r}=jO({isOnboarding:n,isEmbedded:o});u=`w-full max-w-5xl`,s=AO,c=a(e),l=a(r),t[0]=a,t[1]=o,t[2]=n,t[3]=s,t[4]=c,t[5]=l,t[6]=u}else s=t[3],c=t[4],l=t[5],u=t[6];let d;t[7]!==s||t[8]!==r||t[9]!==i||t[10]!==c||t[11]!==l?(d=(0,Z.jsx)(s,{title:c,subtitle:l,celebrateSignal:r,onRageStreak:i}),t[7]=s,t[8]=r,t[9]=i,t[10]=c,t[11]=l,t[12]=d):d=t[12];let f;return t[13]!==u||t[14]!==d?(f=(0,Z.jsx)(`div`,{className:u,children:d}),t[13]=u,t[14]=d,t[15]=f):f=t[15],f}function GO(e){let t=(0,$.c)(30),{celebrateSignal:n,onPackSelect:r,onRageStreak:i}=e,{_:a}=Bn(),o=Be(),s,c,l,u;if(t[0]!==a||t[1]!==o){let{title:e,subtitle:n}=jO({isOnboarding:!0,isEmbedded:o});u=`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,s=AO,c=a(e),l=a(n),t[0]=a,t[1]=o,t[2]=s,t[3]=c,t[4]=l,t[5]=u}else s=t[2],c=t[3],l=t[4],u=t[5];let d;t[6]!==s||t[7]!==n||t[8]!==i||t[9]!==c||t[10]!==l?(d=(0,Z.jsx)(s,{title:c,subtitle:l,celebrateSignal:n,onRageStreak:i}),t[6]=s,t[7]=n,t[8]=i,t[9]=c,t[10]=l,t[11]=d):d=t[11];let f;t[12]===o?f=t[13]:(f=o?(0,Z.jsx)(CO,{scenario:`new-project`}):(0,Z.jsx)(DO,{scenario:`new-project`}),t[12]=o,t[13]=f);let p;t[14]!==a||t[15]!==o?(p=a(o?{id:`GubkSu`}:{id:`xeXS4P`}),t[14]=a,t[15]=o,t[16]=p):p=t[16];let m;t[17]===p?m=t[18]:(m=(0,Z.jsx)(nee,{label:p}),t[17]=p,t[18]=m);let h;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(h=[`okf`,`entity-vault`],t[19]=h):h=t[19];let g;t[20]===r?g=t[21]:(g=(0,Z.jsx)(bx,{onPackSelect:r,onCreateBlankFile:KO,collapsedPackIds:h}),t[20]=r,t[21]=g);let _;t[22]!==m||t[23]!==g?(_=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-3`,children:[m,g]}),t[22]=m,t[23]=g,t[24]=_):_=t[24];let v;return t[25]!==_||t[26]!==u||t[27]!==d||t[28]!==f?(v=(0,Z.jsxs)(`div`,{className:u,children:[d,f,_]}),t[25]=_,t[26]=u,t[27]=d,t[28]=f,t[29]=v):v=t[29],v}function KO(){return NO()}function nee(e){let t=(0,$.c)(13),{label:n}=e,{_:r}=Bn(),i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`span`,{className:`font-mono text-2xs uppercase tracking-wider text-muted-foreground whitespace-nowrap`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r({id:`jAMpHn`}),t[2]=r,t[3]=a);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(rp,{className:`size-3.5`,"aria-hidden":!0}),t[4]=o):o=t[4];let s;t[5]===a?s=t[6]:(s=(0,Z.jsx)(Br,{className:`text-muted-foreground transition-colors hover:text-foreground`,"aria-label":a,"data-testid":`starter-pack-info`,children:o}),t[5]=a,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Vr,{className:`max-w-xs`,children:(0,Z.jsx)(`p`,{className:`leading-relaxed wrap-break-word`,children:(0,Z.jsx)(Y,{id:`k4CuuV`})})}),t[7]=c):c=t[7];let l;t[8]===s?l=t[9]:(l=(0,Z.jsxs)(Ur,{children:[s,c]}),t[8]=s,t[9]=l);let u;return t[10]!==i||t[11]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[i,l]}),t[10]=i,t[11]=l,t[12]=u):u=t[12],u}function ree(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function iee(e){let t=(0,$.c)(70),{folderPath:n,state:r,onChange:i}=e,{_:a}=Bn(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card p-4 space-y-3`,children:[(0,Z.jsx)(oee,{}),(0,Z.jsx)(tg,{className:`h-7 w-full`}),(0,Z.jsx)(tg,{className:`h-7 w-full`}),(0,Z.jsx)(tg,{className:`h-7 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(Y,{id:`lzmtKp`,values:{message:e}})}),t[1]=e,t[2]=n),n}let f;t[3]===r.data.frontmatterLocal?f=t[4]:(f=r.data.frontmatterLocal??{},t[3]=r.data.frontmatterLocal,t[4]=f);let p=f,m;t[5]===r.data.folder.path?m=t[6]:(m=ree(r.data.folder.path),t[5]=r.data.folder.path,t[6]=m);let h=m,g;t[7]===p?g=t[8]:(g=Object.keys(p),t[7]=p,t[8]=g);let _=g,v;t[9]!==a||t[10]!==n||t[11]!==i?(v=async function(e,t){let r=await Qf(n,{[e]:t});if(!r.ok){let{error:e}=r;Dc.error(a({id:`xXo8FT`,values:{error:e}}));return}i()},t[9]=a,t[10]=n,t[11]=i,t[12]=v):v=t[12];let y=v,b;t[13]!==a||t[14]!==n||t[15]!==i?(b=async function(e){let t=await Qf(n,{[e]:null});if(!t.ok){let{error:e}=t;Dc.error(a({id:`ZU8VV_`,values:{error:e}}));return}i()},t[13]=a,t[14]=n,t[15]=i,t[16]=b):b=t[16];let x=b,S;t[17]!==y||t[18]!==p?(S=function(e,t){let n=p[e];y(e,Pu(n,t))},t[17]=y,t[18]=p,t[19]=S):S=t[19];let C=S,w;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(w=function(){l({name:``,type:`text`,value:``,error:null}),s(!1)},t[20]=w):w=t[20];let T=w,E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(e){l(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Nu[e];return{...t,type:e,value:n,error:null}})},t[21]=E):E=t[21];let D=E,O;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(e){l(t=>t&&{...t,value:e})},t[22]=O):O=t[22];let k=O,A;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){l(t=>t&&{...t,name:e,error:null})},t[23]=A):A=t[23];let j=A,M;t[24]!==a||t[25]!==c||t[26]!==n||t[27]!==i||t[28]!==p?(M=async function(e){if(!c)return;let t=e??c.value,r=c.name.trim();if(!r){l({...c,value:t,error:a({id:`8_brI5`})});return}if(Uo(t)){l({...c,value:t,error:a({id:`hXUWyd`})});return}if(Object.hasOwn(p,r)){l({...c,value:t,error:a({id:`CTJLpz`,values:{trimmed:r}})});return}let o=await Qf(n,{[r]:t});if(!o.ok){l({...c,value:t,error:o.error});return}l(null),i()},t[24]=a,t[25]=c,t[26]=n,t[27]=i,t[28]=p,t[29]=M):M=t[29];let N=M,P;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){d({key:e,draft:e,error:null})},t[30]=P):P=t[30];let F=P,I;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){d(t=>t&&{...t,draft:e,error:null})},t[31]=I):I=t[31];let L=I,R;t[32]!==a||t[33]!==n||t[34]!==i||t[35]!==p||t[36]!==u?(R=async function(){if(!u)return;let e=u.draft.trim();if(!e){d({...u,error:a({id:`8_brI5`})});return}if(e===u.key){d(null);return}if(Object.hasOwn(p,e)){d({...u,error:a({id:`CTJLpz`,values:{trimmed:e}})});return}let t=p[u.key],r=await Qf(n,{[u.key]:null,[e]:t});if(!r.ok){d({...u,error:r.error});return}d(null),i()},t[32]=a,t[33]=n,t[34]=i,t[35]=p,t[36]=u,t[37]=R):R=t[37];let z=R,B;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(){d(null)},t[38]=B):B=t[38];let V=B,ee=!o,H;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>s(!e),t[39]=H):H=t[39];let U=`size-3 shrink-0 motion-safe:transition-transform motion-safe:duration-150 motion-safe:ease-[cubic-bezier(0.23,1,0.32,1)] ${o?``:`rotate-90`}`,W;t[40]===U?W=t[41]:(W=(0,Z.jsx)(Ku,{className:U,"aria-hidden":!0}),t[40]=U,t[41]=W);let G;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(Y,{id:`vQIVHc`}),t[42]=G):G=t[42];let te;t[43]===W?te=t[44]:(te=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[W,G]}),t[43]=W,t[44]=te);let ne;t[45]===h?ne=t[46]:(ne=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text break-all`,onClick:aee,children:h}),t[45]=h,t[46]=ne);let re;t[47]!==te||t[48]!==ne?(re=(0,Z.jsxs)(Gr,{className:`flex w-full cursor-pointer items-center justify-between gap-2 px-3 py-2.5 data-[state=open]:border-b border-border`,children:[te,ne]}),t[47]=te,t[48]=ne,t[49]=re):re=t[49];let K;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`hSBIG-`})}),t[50]=K):K=t[50];let ie;t[51]!==c||t[52]!==y||t[53]!==z||t[54]!==_||t[55]!==p||t[56]!==x||t[57]!==u||t[58]!==C?(ie=_.length===0&&!c?(0,Z.jsx)(`p`,{className:`px-1 py-1 text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`4c_a6S`})}):_.map(e=>{let t=p[e];return(0,Z.jsx)(Rf,{keyName:e,value:t,declared:Fu(t,co(t)),rename:{state:u?.key===e?u:null,onBegin:()=>F(e),onChangeDraft:L,onCommit:z,onCancel:V},badge:null,onCommit:t=>void y(e,t),onChangeType:t=>C(e,t),onRemove:()=>void x(e)},e)}),t[51]=c,t[52]=y,t[53]=z,t[54]=_,t[55]=p,t[56]=x,t[57]=u,t[58]=C,t[59]=ie):ie=t[59];let q;t[60]!==c||t[61]!==N?(q=c?(0,Z.jsx)(Bf,{draft:c,onChangeName:j,onChangeType:D,onChangeValue:k,onCommit:e=>void N(e),onCancel:()=>l(null)}):(0,Z.jsx)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,children:(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:()=>T(),className:`flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(dr,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`G8t9NN`})})]})}),t[60]=c,t[61]=N,t[62]=q):q=t[62];let ae;t[63]!==ie||t[64]!==q?(ae=(0,Z.jsx)(Wr,{children:(0,Z.jsxs)(`div`,{className:`px-2 py-2`,children:[K,ie,q]})}),t[63]=ie,t[64]=q,t[65]=ae):ae=t[65];let oe;return t[66]!==ee||t[67]!==re||t[68]!==ae?(oe=(0,Z.jsx)(`section`,{className:`rounded-lg border bg-card`,children:(0,Z.jsxs)(Kr,{open:ee,onOpenChange:H,children:[re,ae]})}),t[66]=ee,t[67]=re,t[68]=ae,t[69]=oe):oe=t[69],oe}function aee(e){return e.stopPropagation()}function oee(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Jy,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t,(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`vQIVHc`})})]}),e[1]=n):n=e[1],n}function see(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?Hc._({id:`xOTzt5`}):t<3600?Hc._({id:`zbymaY`,values:{0:Math.floor(t/60)}}):t<86400?Hc._({id:`optX0N`,values:{0:Math.floor(t/3600)}}):t<86400*7?Hc._({id:`l1l8sj`,values:{0:Math.floor(t/86400)}}):new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function qO(e){return(e.split(`/`).pop()??e).replace(/\.md$/,``)}function cee(e){let t=e.message,n=t.indexOf(`: `),r=n===-1?t:t.slice(0,n),i=n===-1?``:t.slice(n+2);switch(r){case`template-create`:return{Icon:yr,label:Hc._({id:`QR5SP1`}),detail:qO(i)};case`template-edit`:return{Icon:Zt,label:Hc._({id:`-LHLx7`}),detail:qO(i)};case`template-delete`:return{Icon:Ip,label:Hc._({id:`_gkGSK`}),detail:qO(i)};case`template-rename`:case`template-move`:{let[e,t]=i.split(` -> `);return{Icon:pu,label:Hc._({id:`KPW5WC`}),detail:`${qO(e??``)} → ${qO(t??i)}`}}case`folder-frontmatter-edit`:return{Icon:Jy,label:Hc._({id:`_tekeB`}),detail:``};case`folder-frontmatter-delete`:return{Icon:Jy,label:Hc._({id:`ZWxfrc`}),detail:``};case`folder-create`:return{Icon:Jy,label:Hc._({id:`ZQLDTl`}),detail:``};default:return{Icon:kl,label:r.replace(/-/g,` `),detail:qO(i)}}}function lee(e){return e.contributors.length>0?e.contributors[0].name:e.author===`openknowledge-service`||e.author===`server`?Hc._({id:`B2DrPb`}):e.author||Hc._({id:`Ef7StM`})}function JO(e){let t=(0,$.c)(15),{folderPath:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(!0),[c,l]=(0,Q.useState)(!1),u,d;if(t[1]===n?(u=t[2],d=t[3]):(u=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/history?folder=${encodeURIComponent(n)}&limit=50`);if(e)return;if(!t.ok){l(!0),s(!1);return}let r=await t.json();if(e)return;a(r.entries??[]),l(!1),s(!1)}catch(t){e||(console.warn(`[FolderTimelineCard] failed to load folder timeline:`,t),l(!0),s(!1))}};s(!0),t();let r=Zc(t);return()=>{e=!0,r()}},d=[n],t[1]=n,t[2]=u,t[3]=d),(0,Q.useEffect)(u,d),c||!o&&i.length===0)return null;let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`XJOV1Y`})}),t[4]=f):f=t[4];let p;t[5]===i.length?p=t[6]:(p=i.length>0?(0,Z.jsx)(Sh,{className:`text-xs`,variant:`secondary`,children:i.length}):null,t[5]=i.length,t[6]=p);let m;t[7]===p?m=t[8]:(m=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-1`,children:[f,p]}),t[7]=p,t[8]=m);let h;t[9]!==i||t[10]!==o?(h=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:o?(0,Z.jsxs)(`div`,{className:`space-y-2`,role:`status`,"aria-busy":`true`,children:[(0,Z.jsx)(tg,{className:`h-8 w-full`}),(0,Z.jsx)(tg,{className:`h-8 w-full`})]}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:i.map(YO)})}),t[9]=i,t[10]=o,t[11]=h):h=t[11];let g;return t[12]!==m||t[13]!==h?(g=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,"data-testid":`folder-timeline-card`,children:[m,h]}),t[12]=m,t[13]=h,t[14]=g):g=t[14],g}function YO(e){let{Icon:t,label:n,detail:r}=cee(e);return(0,Z.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm`,children:[(0,Z.jsx)(t,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[(0,Z.jsx)(`span`,{className:`text-foreground`,children:n}),r?(0,Z.jsx)(`code`,{className:`ml-1.5 font-mono text-xs text-muted-foreground`,children:r}):null]}),(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-xs text-muted-foreground`,children:[(0,Z.jsx)(Vb,{className:`size-3`,"aria-hidden":!0}),lee(e)]}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground/80`,dateTime:e.timestamp,title:new Date(e.timestamp).toLocaleString(),children:see(e.timestamp)})]},e.sha)}function XO(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function ZO(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=XO(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function QO(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function $O(e,t){let n=e===``?``:`${e}/`,r=[...t.folderPaths].filter(e=>e.startsWith(n)).map(e=>({path:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({path:e,rel:n})=>({kind:`folder`,path:e,name:n,title:ZO(e,t.pageTitles)})),i=[...t.pages].filter(e=>e.startsWith(n)).map(e=>({docName:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({docName:e,rel:n})=>{let r=t.pageMeta.get(e);return{kind:`file`,path:e,name:n,title:QO(e,n,t.pageTitles),size:r?.size??0,modified:r?.modified??``}}),a=[...r,...i].sort((e,t)=>e.kind===t.kind?e.title.localeCompare(t.title)||e.name.localeCompare(t.name):e.kind===`folder`?-1:1);return{title:ZO(e,t.pageTitles),children:a}}function ek(e){let t=(0,$.c)(41),{folderPath:n,state:r,onChange:i,folderConfigHandle:a}=e,[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(!1);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card px-3 py-2.5 space-y-3`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`-QCLWk`})})}),(0,Z.jsx)(tg,{className:`h-12 w-full`}),(0,Z.jsx)(tg,{className:`h-12 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(Y,{id:`iDZtvM`,values:{message:e}})}),t[1]=e,t[2]=n),n}let f;t[3]===r.data.folder.templates_available?f=t[4]:(f=r.data.folder.templates_available??[],t[3]=r.data.folder.templates_available,t[4]=f);let p=f,m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`-QCLWk`})}),t[5]=m):m=t[5];let h;t[6]===p.length?h=t[7]:(h=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[m,(0,Z.jsx)(Sh,{className:`text-xs`,variant:`secondary`,children:p.length})]}),t[6]=p.length,t[7]=h);let g;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(X,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>d(!0),children:[(0,Z.jsx)(dr,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`G1Gw0v`})]}),t[8]=g):g=t[8];let _;t[9]===h?_=t[10]:(_=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-1`,children:[h,g]}),t[9]=h,t[10]=_);let v;t[11]===p?v=t[12]:(v=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:p.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`MZSBsh`})}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:p.map(e=>(0,Z.jsx)(eee,{template:e,onCreate:()=>l(e.name),onEdit:()=>Yf(bs(e.source_folder,e.name)),onDelete:()=>s(e),badge:e.scope===`inherited`?(0,Z.jsx)(Ff,{source:e.source_folder,target:`templates/${e.name}.md`}):void 0},e.path))})}),t[11]=p,t[12]=v);let y;t[13]!==_||t[14]!==v?(y=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,children:[_,v]}),t[13]=_,t[14]=v,t[15]=y):y=t[15];let b;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{e||s(null)},t[16]=b):b=t[16];let x;t[17]!==o||t[18]!==i?(x=(0,Z.jsx)(qd,{template:o,onOpenChange:b,onDeleted:i}),t[17]=o,t[18]=i,t[19]=x):x=t[19];let S;t[20]===p?S=t[21]:(S=new Set(p.map(tk)),t[20]=p,t[21]=S);let C;t[22]!==n||t[23]!==i?(C=e=>{i(),Yf(bs(n,e))},t[22]=n,t[23]=i,t[24]=C):C=t[24];let w;t[25]!==n||t[26]!==u||t[27]!==S||t[28]!==C?(w=(0,Z.jsx)(df,{folderPath:n,existingNames:S,open:u,onOpenChange:d,onCreated:C}),t[25]=n,t[26]=u,t[27]=S,t[28]=C,t[29]=w):w=t[29];let T=c!==null,E;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{e||l(null)},t[30]=E):E=t[30];let D=c??void 0,O;t[31]!==a||t[32]!==n||t[33]!==T||t[34]!==D?(O=(0,Z.jsx)(nC,{open:T,onOpenChange:E,kind:`file`,initialDir:n,initialTemplate:D,folderConfig:a}),t[31]=a,t[32]=n,t[33]=T,t[34]=D,t[35]=O):O=t[35];let k;return t[36]!==w||t[37]!==O||t[38]!==y||t[39]!==x?(k=(0,Z.jsxs)(Z.Fragment,{children:[y,x,w,O]}),t[36]=w,t[37]=O,t[38]=y,t[39]=x,t[40]=k):k=t[40],k}function tk(e){return e.name}function nk(e){let t=(0,$.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,containerClassName:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=gr(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=gr(`w-full caption-bottom text-sm`,n),t[6]=n,t[7]=o);let s;t[8]!==i||t[9]!==o?(s=(0,Z.jsx)(`table`,{"data-slot":`table`,className:o,...i}),t[8]=i,t[9]=o,t[10]=s):s=t[10];let c;return t[11]!==a||t[12]!==s?(c=(0,Z.jsx)(`div`,{"data-slot":`table-container`,className:a,children:s}),t[11]=a,t[12]=s,t[13]=c):c=t[13],c}function rk(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`[&_tr]:border-b`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`thead`,{"data-slot":`table-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ik(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`[&_tr:last-child]:border-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`tbody`,{"data-slot":`table-body`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ak(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,noHover:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(i===void 0?!1:i)&&`hover:bg-transparent`,o;t[4]!==n||t[5]!==a?(o=gr(`hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors`,a,n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(`tr`,{"data-slot":`table-row`,className:o,...r}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function ok(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,scope:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`col`:i,o;t[4]===n?o=t[5]:(o=gr(`font-mono uppercase text-xs text-muted-foreground h-10 px-4 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`th`,{"data-slot":`table-head`,scope:a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function sk(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`py-3 px-4 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`td`,{"data-slot":`table-cell`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ck(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return Hc._({id:`xOTzt5`});if(r<60)return Hc._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return Hc._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?Hc._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function lk(e,t,n){return[...e].sort((e,r)=>{if(e.kind!==r.kind)return e.kind===`folder`?-1:1;let i=0;switch(t){case`name`:i=e.title.localeCompare(r.title)||e.name.localeCompare(r.name);break;case`modified`:{let t=e.kind===`file`?e.modified:``,n=r.kind===`file`?r.modified:``;i=t.localeCompare(n);break}}return n===`asc`?i:-i})}function uk(e){let t=(0,$.c)(10),{label:n,sortKey:r,activeKey:i,activeDir:a,onSort:o}=e,s=i===r,c;t[0]!==o||t[1]!==r?(c=()=>o(r),t[0]=o,t[1]=r,t[2]=c):c=t[2];let l;t[3]!==a||t[4]!==s?(l=s?a===`asc`?(0,Z.jsx)(Tu,{className:`ml-1 size-3`}):(0,Z.jsx)(Eu,{className:`ml-1 size-3`}):(0,Z.jsx)(Dy,{className:`ml-1 size-3 text-muted-foreground/50`}),t[3]=a,t[4]=s,t[5]=l):l=t[5];let u;return t[6]!==n||t[7]!==c||t[8]!==l?(u=(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,className:`-ml-3 h-8 uppercase font-mono`,onClick:c,children:[n,l]}),t[6]=n,t[7]=c,t[8]=l,t[9]=u):u=t[9],u}function dk(e){let t=(0,$.c)(96),{folderPath:n}=e,{_:r}=Bn(),{folderPaths:i,loading:a,pages:o,pageTitles:s,pageMeta:c}=Nd(),l=hf(n),{state:u,refresh:d}=l,[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(`name`),[g,_]=(0,Q.useState)(`asc`);if(a){let e;t[0]===r?e=t[1]:(e=r({id:`X9VpsP`}),t[0]=r,t[1]=e);let n;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(tg,{className:`size-5 rounded`}),(0,Z.jsx)(tg,{className:`h-7 w-48`})]}),(0,Z.jsx)(tg,{className:`h-9 w-20 rounded-md`})]}),t[2]=n):n=t[2];let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(tg,{className:`h-4 w-16`}),t[3]=i):i=t[3];let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`div`,{className:`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`,children:[n,(0,Z.jsxs)(`div`,{className:`rounded-lg border`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-4 border-b px-4 py-3`,children:[i,(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(tg,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(mk)]})]}),t[4]=a):a=t[4];let o;return t[5]===e?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,role:`status`,"aria-busy":`true`,"aria-label":e,children:a}),t[5]=e,t[6]=o),o}let v,y,b,x,S,C,w,T,E,D,O;if(t[7]!==r||t[8]!==u||t[9]!==l||t[10]!==n||t[11]!==i||t[12]!==c||t[13]!==s||t[14]!==o||t[15]!==d||t[16]!==g||t[17]!==m){let e=$O(n,{pages:o,pageTitles:s,pageMeta:c,folderPaths:i}),a=lk(e.children,m,g),f=e.title||(n===``?r({id:`3aeN7X`}):e.title),k;t[29]===m?k=t[30]:(k=function(e){e===m?_(pk):(h(e),_(`asc`))},t[29]=m,t[30]=k);let A=k;O=`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,C=`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`;let j;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(Wf,{className:`size-5 text-muted-foreground`}),t[31]=j):j=t[31];let M=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[j,(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tight`,children:f})]}),N;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsxs)(X,{onClick:()=>p(!0),children:[(0,Z.jsx)(dr,{className:`size-4`}),(0,Z.jsx)(Y,{id:`isRobC`})]}),t[32]=N):N=t[32],t[33]===M?w=t[34]:(w=(0,Z.jsx)(`div`,{className:`flex flex-col gap-6`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[M,N]})}),t[33]=M,t[34]=w),t[35]!==u||t[36]!==n||t[37]!==d?(T=(0,Z.jsx)(iee,{folderPath:n,state:u,onChange:d}),t[35]=u,t[36]=n,t[37]=d,t[38]=T):T=t[38],t[39]!==u||t[40]!==l||t[41]!==n||t[42]!==d?(E=(0,Z.jsx)(ek,{folderPath:n,state:u,onChange:d,folderConfigHandle:l}),t[39]=u,t[40]=l,t[41]=n,t[42]=d,t[43]=E):E=t[43],t[44]===n?D=t[45]:(D=(0,Z.jsx)(JO,{folderPath:n}),t[44]=n,t[45]=D),S=`rounded-lg border`,y=nk;let P=m===`name`?g===`asc`?`ascending`:`descending`:`none`,F;t[46]===r?F=t[47]:(F=r({id:`6YtxFj`}),t[46]=r,t[47]=F);let I;t[48]!==A||t[49]!==g||t[50]!==m||t[51]!==F?(I=(0,Z.jsx)(uk,{label:F,sortKey:`name`,activeKey:m,activeDir:g,onSort:A}),t[48]=A,t[49]=g,t[50]=m,t[51]=F,t[52]=I):I=t[52];let L;t[53]!==P||t[54]!==I?(L=(0,Z.jsx)(ok,{"aria-sort":P,children:I}),t[53]=P,t[54]=I,t[55]=L):L=t[55];let R=m===`modified`?g===`asc`?`ascending`:`descending`:`none`,z;t[56]===r?z=t[57]:(z=r({id:`tgWuMB`}),t[56]=r,t[57]=z);let B;t[58]!==A||t[59]!==g||t[60]!==m||t[61]!==z?(B=(0,Z.jsx)(uk,{label:z,sortKey:`modified`,activeKey:m,activeDir:g,onSort:A}),t[58]=A,t[59]=g,t[60]=m,t[61]=z,t[62]=B):B=t[62];let V;t[63]!==R||t[64]!==B?(V=(0,Z.jsx)(ok,{className:`w-32`,"aria-sort":R,children:B}),t[63]=R,t[64]=B,t[65]=V):V=t[65],t[66]!==L||t[67]!==V?(x=(0,Z.jsx)(rk,{children:(0,Z.jsxs)(ak,{children:[L,V]})}),t[66]=L,t[67]=V,t[68]=x):x=t[68],v=ik,b=a.length?a.map(fk):(0,Z.jsx)(ak,{children:(0,Z.jsx)(sk,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`Pkw7J9`})})}),t[7]=r,t[8]=u,t[9]=l,t[10]=n,t[11]=i,t[12]=c,t[13]=s,t[14]=o,t[15]=d,t[16]=g,t[17]=m,t[18]=v,t[19]=y,t[20]=b,t[21]=x,t[22]=S,t[23]=C,t[24]=w,t[25]=T,t[26]=E,t[27]=D,t[28]=O}else v=t[18],y=t[19],b=t[20],x=t[21],S=t[22],C=t[23],w=t[24],T=t[25],E=t[26],D=t[27],O=t[28];let k;t[69]!==v||t[70]!==b?(k=(0,Z.jsx)(v,{children:b}),t[69]=v,t[70]=b,t[71]=k):k=t[71];let A;t[72]!==y||t[73]!==k||t[74]!==x?(A=(0,Z.jsxs)(y,{children:[x,k]}),t[72]=y,t[73]=k,t[74]=x,t[75]=A):A=t[75];let j;t[76]!==A||t[77]!==S?(j=(0,Z.jsx)(`div`,{className:S,children:A}),t[76]=A,t[77]=S,t[78]=j):j=t[78];let M;t[79]!==j||t[80]!==C||t[81]!==w||t[82]!==T||t[83]!==E||t[84]!==D?(M=(0,Z.jsxs)(`div`,{className:C,children:[w,T,E,D,j]}),t[79]=j,t[80]=C,t[81]=w,t[82]=T,t[83]=E,t[84]=D,t[85]=M):M=t[85];let N;t[86]!==M||t[87]!==O?(N=(0,Z.jsx)(`div`,{className:O,children:M}),t[86]=M,t[87]=O,t[88]=N):N=t[88];let P;t[89]!==f||t[90]!==l||t[91]!==n?(P=(0,Z.jsx)(nC,{open:f,onOpenChange:p,kind:`file`,initialDir:n,folderConfig:l,suggestedName:`index`}),t[89]=f,t[90]=l,t[91]=n,t[92]=P):P=t[92];let F;return t[93]!==N||t[94]!==P?(F=(0,Z.jsxs)(Z.Fragment,{children:[N,P]}),t[93]=N,t[94]=P,t[95]=F):F=t[95],F}function fk(e){return(0,Z.jsxs)(ak,{children:[(0,Z.jsx)(sk,{children:(0,Z.jsxs)(`a`,{href:qp(e.path),className:`flex items-center gap-2 rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[e.kind===`folder`?(0,Z.jsx)(Kf,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(Ge,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(sk,{className:`text-muted-foreground`,children:e.kind===`file`?ck(e.modified):`—`})]},e.path)}function pk(e){return e===`asc`?`desc`:`asc`}function mk(e){return(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 border-b px-4 py-3 last:border-b-0`,children:[(0,Z.jsx)(tg,{className:`size-4 rounded`}),(0,Z.jsx)(tg,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(tg,{className:`h-4 w-16`})})]},e)}function hk(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`empty`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function gk(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`flex max-w-sm flex-col items-center gap-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`empty-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var _k=Rr(`mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,icon:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4`}},defaultVariants:{variant:`default`}});function vk(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`default`:i,o;t[4]!==n||t[5]!==a?(o=gr(_k({variant:a,className:n})),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o||t[9]!==a?(s=(0,Z.jsx)(`div`,{"data-slot":`empty-icon`,"data-variant":a,className:o,...r}),t[7]=r,t[8]=o,t[9]=a,t[10]=s):s=t[10],s}function yk(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,asChild:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i?zr:`div`,o;t[4]===n?o=t[5]:(o=gr(`font-heading text-sm font-medium tracking-tight`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(a,{"data-slot":`empty-title`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function bk(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`empty-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function xk(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`flex w-full max-w-sm min-w-0 flex-col items-center gap-2.5 text-sm text-balance`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`empty-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Sk(e){let t=(0,$.c)(26),{docName:n,size:r,limit:i,backNav:a}=e,o=a!==void 0,s=(0,Q.useRef)(null),c=(0,Q.useRef)(null),l=(0,Q.useId)(),u,d;t[0]===o?(u=t[1],d=t[2]):(u=()=>{o?s.current?.focus():c.current?.focus()},d=[o],t[0]=o,t[1]=u,t[2]=d),(0,Q.useEffect)(u,d);let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(vk,{variant:`icon`,className:`mb-0 size-16 rounded-full border bg-muted/40 text-muted-foreground`,children:(0,Z.jsx)(Wy,{className:`size-9`,"aria-hidden":`true`})}),t[3]=f):f=t[3];let p=o?void 0:-1,m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(Y,{id:`P3hnm0`}),t[4]=m):m=t[4];let h;t[5]!==p||t[6]!==l?(h=(0,Z.jsx)(yk,{asChild:!0,className:`text-2xl font-light outline-none`,children:(0,Z.jsx)(`h2`,{ref:c,id:l,tabIndex:p,children:m})}),t[5]=p,t[6]=l,t[7]=h):h=t[7];let g;t[8]===r?g=t[9]:(g=is(r),t[8]=r,t[9]=g);let _;t[10]===i?_=t[11]:(_=is(i),t[10]=i,t[11]=_);let v;t[12]!==n||t[13]!==g||t[14]!==_?(v=(0,Z.jsx)(bk,{children:(0,Z.jsx)(Y,{id:`GJH-AT`,values:{0:g,1:_,docName:n}})}),t[12]=n,t[13]=g,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==h||t[17]!==v?(y=(0,Z.jsxs)(gk,{className:`max-w-md gap-1`,children:[h,v]}),t[16]=h,t[17]=v,t[18]=y):y=t[18];let b;t[19]!==a||t[20]!==o?(b=o?(0,Z.jsx)(xk,{children:(0,Z.jsxs)(X,{ref:s,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(Au,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`CKyk7Q`})]})}):null,t[19]=a,t[20]=o,t[21]=b):b=t[21];let x;return t[22]!==y||t[23]!==b||t[24]!==l?(x=(0,Z.jsxs)(hk,{role:`status`,"aria-labelledby":l,"data-slot":`large-file-editor-state`,className:`h-full gap-8 p-8`,children:[f,y,b]}),t[22]=y,t[23]=b,t[24]=l,t[25]=x):x=t[25],x}function Ck(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(wk),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>ct(e=>{i(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})}),o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Q.useEffect)(a,o),!r.has(n))return null;let s;t[2]===n?s=t[3]:(s=function(){rt(n)?.abort(),i(e=>{if(!e.has(n))return e;let t=new Set(e);return t.delete(n),t})},t[2]=n,t[3]=s);let c=s,l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`A67Uwj`})}),t[4]=l):l=t[4];let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Y,{id:`dEgA5A`}),t[5]=u):u=t[5];let d;return t[6]===c?d=t[7]:(d=(0,Z.jsxs)(`div`,{className:`absolute inset-x-0 bottom-8 z-20 flex justify-center text-xs text-muted-foreground`,children:[l,(0,Z.jsx)(X,{variant:`link`,size:`sm`,className:`h-auto px-2 py-0 text-xs`,onClick:c,children:u})]}),t[6]=c,t[7]=d),d}function wk(){return new Set}function Tk(e){let t=(0,$.c)(8),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{autoStart:r}=n,i=r===void 0?!1:r,a=(0,Q.useRef)(null),o,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{a.current?.focus()},s=[],t[2]=o,t[3]=s):(o=t[2],s=t[3]),(0,Q.useEffect)(o,s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tighter text-balance`,children:(0,Z.jsx)(Y,{id:`hgf5io`})}),t[4]=c):c=t[4];let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1 text-center`,children:[c,(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`AUMPjj`})})]}),t[5]=l):l=t[5];let u;return t[6]===i?u=t[7]:(u=(0,Z.jsxs)(`div`,{ref:a,tabIndex:-1,className:`flex h-full w-full flex-col items-center justify-center gap-8 px-6 py-8 outline-none`,children:[l,(0,Z.jsx)(`div`,{className:`w-full`,children:(0,Z.jsx)(cy,{autoStart:i})})]}),t[6]=i,t[7]=u),u}function Ek(e){let t=(0,$.c)(19),{nav:n}=e,{state:r,refetch:i}=Tf(n),a=(0,Q.useRef)(null),o,s;t[0]===r.phase?(o=t[1],s=t[2]):(o=()=>{r.phase===`resolved`&&a.current?.querySelector(`button`)?.focus()},s=[r.phase],t[0]=r.phase,t[1]=o,t[2]=s),(0,Q.useEffect)(o,s);let c;t[3]===n.path?c=t[4]:(c=function(){window.location.hash=Qp(xf(n.path))},t[3]=n.path,t[4]=c);let l=c,u;t[5]===n?u=t[6]:(u=function(e){Ef.arm(wf(n,e)),window.location.hash=n.kind===`folder`?Qp(e):qp(e)},t[5]=n,t[6]=u);let d=u,f=r.phase===`pending`?`polite`:void 0,p=r.phase===`resolved`?r.resolution.verdict:void 0,m=r.phase===`pending`?`flex h-full flex-col items-center justify-center gap-3 p-8 text-center text-sm text-muted-foreground`:`flex h-full flex-col items-center justify-center gap-6 p-8 text-center`,h;t[7]!==l||t[8]!==n||t[9]!==d||t[10]!==i||t[11]!==r?(h=(0,Z.jsx)(Cf,{nav:n,state:r,onBrowseFolder:l,onOpenRenamed:d,onEnableAutoSync:l,onSyncCompleted:i,onPullApplied:i}),t[7]=l,t[8]=n,t[9]=d,t[10]=i,t[11]=r,t[12]=h):h=t[12];let g;return t[13]!==r.phase||t[14]!==f||t[15]!==p||t[16]!==m||t[17]!==h?(g=(0,Z.jsx)(`div`,{ref:a,role:`status`,"aria-live":f,"data-testid":`share-receive-miss-panel`,"data-phase":r.phase,"data-verdict":p,className:m,children:h}),t[13]=r.phase,t[14]=f,t[15]=p,t[16]=m,t[17]=h,t[18]=g):g=t[18],g}var Dk=`ok-find`,Ok=`ok-find-active`;function kk(e,t){let n=t.toLowerCase();if(n===``)return[];let r=[],i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(let e=i.nextNode();e!==null;e=i.nextNode()){let t=(e.textContent??``).toLowerCase(),i=t.indexOf(n);for(;i>=0;){let a=document.createRange();a.setStart(e,i),a.setEnd(e,i+n.length),r.push(a),i=t.indexOf(n,i+n.length)}}return r}function Ak(e){let t=(0,$.c)(61),{containerRef:n,onClose:r}=e,{_:i}=Bn(),a=(0,Q.useRef)(null),[o,s]=(0,Q.useState)(``),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=[],t[0]=c):c=t[0];let[l,u]=(0,Q.useState)(c),[d,f]=(0,Q.useState)(0),p,m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>{a.current?.focus()},m=[],t[1]=p,t[2]=m):(p=t[1],m=t[2]),(0,Q.useEffect)(p,m);let h;t[3]!==n||t[4]!==o?(h=()=>{let e=n.current,t=CSS.highlights;if(!e||t===void 0)return;let r=kk(e,o.trim());return u(r),f(0),t.set(Dk,new Highlight(...r)),()=>{t.delete(Dk),t.delete(Ok)}},t[3]=n,t[4]=o,t[5]=h):h=t[5];let g;t[6]===o?g=t[7]:(g=[o],t[6]=o,t[7]=g),(0,Q.useEffect)(h,g);let _,v;t[8]!==d||t[9]!==l?(_=()=>{let e=CSS.highlights;if(e===void 0)return;let t=l[d];if(t===void 0){e.delete(Ok);return}e.set(Ok,new Highlight(t)),t.startContainer.parentElement?.scrollIntoView({block:`nearest`})},v=[l,d],t[8]=d,t[9]=l,t[10]=_,t[11]=v):(_=t[10],v=t[11]),(0,Q.useEffect)(_,v);let y;t[12]===l.length?y=t[13]:(y=e=>{l.length!==0&&f(t=>(t+e+l.length)%l.length)},t[12]=l.length,t[13]=y);let b=y,x;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>s(e.target.value),t[14]=x):x=t[14];let S;t[15]===i?S=t[16]:(S=i({id:`KujtjC`}),t[15]=i,t[16]=S);let C;t[17]===i?C=t[18]:(C=i({id:`BKI4hX`}),t[17]=i,t[18]=C);let w;t[19]!==r||t[20]!==b?(w=e=>{e.key===`Enter`&&b(e.shiftKey?-1:1),e.key===`Escape`&&r()},t[19]=r,t[20]=b,t[21]=w):w=t[21];let T;t[22]!==o||t[23]!==S||t[24]!==C||t[25]!==w?(T=(0,Z.jsx)(dh,{ref:a,value:o,onChange:x,placeholder:S,"aria-label":C,className:`h-7 w-44`,onKeyDown:w}),t[22]=o,t[23]=S,t[24]=C,t[25]=w,t[26]=T):T=t[26];let E;t[27]!==d||t[28]!==l.length||t[29]!==o?(E=o.trim()===``?null:l.length===0?(0,Z.jsx)(Y,{id:`Y9c_nf`}):`${d+1}/${l.length}`,t[27]=d,t[28]=l.length,t[29]=o,t[30]=E):E=t[30];let D;t[31]===E?D=t[32]:(D=(0,Z.jsx)(`span`,{className:`min-w-10 text-center text-muted-foreground text-xs tabular-nums`,children:E}),t[31]=E,t[32]=D);let O;t[33]===b?O=t[34]:(O=()=>b(-1),t[33]=b,t[34]=O);let k;t[35]===i?k=t[36]:(k=i({id:`oqB2ez`}),t[35]=i,t[36]=k);let A;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(Sa,{className:`size-4`,"aria-hidden":!0}),t[37]=A):A=t[37];let j;t[38]!==O||t[39]!==k?(j=(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-7`,onClick:O,"aria-label":k,children:A}),t[38]=O,t[39]=k,t[40]=j):j=t[40];let M;t[41]===b?M=t[42]:(M=()=>b(1),t[41]=b,t[42]=M);let N;t[43]===i?N=t[44]:(N=i({id:`SiUUCS`}),t[43]=i,t[44]=N);let P;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(Gu,{className:`size-4`,"aria-hidden":!0}),t[45]=P):P=t[45];let F;t[46]!==M||t[47]!==N?(F=(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-7`,onClick:M,"aria-label":N,children:P}),t[46]=M,t[47]=N,t[48]=F):F=t[48];let I;t[49]===i?I=t[50]:(I=i({id:`wJo9oS`}),t[49]=i,t[50]=I);let L;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(zp,{className:`size-4`,"aria-hidden":!0}),t[51]=L):L=t[51];let R;t[52]!==r||t[53]!==I?(R=(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-7`,onClick:r,"aria-label":I,children:L}),t[52]=r,t[53]=I,t[54]=R):R=t[54];let z;return t[55]!==T||t[56]!==D||t[57]!==j||t[58]!==F||t[59]!==R?(z=(0,Z.jsxs)(`div`,{className:`absolute top-2 right-4 z-10 flex items-center gap-1 rounded-md border bg-popover p-1 shadow-md`,children:[T,D,j,F,R]}),t[55]=T,t[56]=D,t[57]=j,t[58]=F,t[59]=R,t[60]=z):z=t[60],z}function jk(e){let t=(0,$.c)(9),{text:n}=e,r;t[0]===n?r=t[1]:(r=Ks(n),t[0]=n,t[1]=r);let{map:i}=r,a,o;if(t[2]!==i||t[3]!==n){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Jo(n),r=e.length>0?e:Object.keys(i);if(r.length===0){o=null;break bb0}let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Y,{id:`l_UFPv`}),t[6]=s):s=t[6];let c;t[7]===i?c=t[8]:(c=(e,t)=>{let n=i[e];return n===void 0?null:(0,Z.jsx)(Mk,{keyName:e,value:n},`${e}-${t}`)},t[7]=i,t[8]=c),a=(0,Z.jsx)(zu,{title:s,count:r.length,testId:`readonly-property-panel`,className:`pt-4`,children:r.map(c)})}t[2]=i,t[3]=n,t[4]=a,t[5]=o}else a=t[4],o=t[5];return o===Symbol.for(`react.early_return_sentinel`)?a:o}function Mk(e){let t=(0,$.c)(9),{keyName:n,value:r}=e,i=Lu[co(r)],a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(i,{className:`size-3.5`}),t[0]=i,t[1]=a);let o;t[2]!==n||t[3]!==r?(o=(0,Z.jsx)(Nk,{keyName:n,value:r}),t[2]=n,t[3]=r,t[4]=o):o=t[4];let s;return t[5]!==n||t[6]!==a||t[7]!==o?(s=(0,Z.jsx)(Bu,{icon:a,label:n,testId:`readonly-property-row`,dataKey:n,children:o}),t[5]=n,t[6]=a,t[7]=o,t[8]=s):s=t[8],s}function Nk(e){let t=(0,$.c)(8),{keyName:n,value:r}=e;if(Ru(r)){let e;return t[0]!==n||t[1]!==r?(e=(0,Z.jsx)(Iu,{keyName:n,value:r}),t[0]=n,t[1]=r,t[2]=e):e=t[2],e}let i;t[3]===r?i=t[4]:(i=Array.isArray(r)?r.filter(Pk).join(`, `):String(r),t[3]=r,t[4]=i);let a=i,o;return t[5]!==a||t[6]!==n?(o=(0,Z.jsx)(`div`,{className:`flex min-h-7 items-center px-2 py-1 text-sm break-words`,"data-testid":`readonly-property-value`,"data-key":n,children:a}),t[5]=a,t[6]=n,t[7]=o):o=t[7],o}function Pk(e){return typeof e==`string`}function Fk(e){let t=(0,$.c)(38),{fileName:n,text:r,flow:i,linkBaseDocName:a,skillPathLinkDocName:o,onBundlePathClick:s}=e,c=i===void 0?!1:i,l,u,d,f;if(t[0]!==a||t[1]!==s||t[2]!==o||t[3]!==r){let e=ac(r).body,n;if(t[8]!==a||t[9]!==s||t[10]!==o){let e=a?bt.map(e=>e.name===`link`?e.configure({docName:a}):e):bt;n=o?[...e,at.configure({docName:o,onBundlePathClick:s})]:e,t[8]=a,t[9]=s,t[10]=o,t[11]=n}else n=t[11];let i=n;f=hi,l=i,u=!1,d=mi().parseWithFallback(e),t[0]=a,t[1]=s,t[2]=o,t[3]=r,t[4]=l,t[5]=u,t[6]=d,t[7]=f}else l=t[4],u=t[5],d=t[6],f=t[7];let p;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(p={attributes:{class:`pt-4`}},t[12]=p):p=t[12];let m;t[13]!==l||t[14]!==u||t[15]!==d?(m={extensions:l,editable:u,content:d,editorProps:p},t[13]=l,t[14]=u,t[15]=d,t[16]=m):m=t[16];let h;t[17]!==a||t[18]!==o||t[19]!==r?(h=[r,a,o],t[17]=a,t[18]=o,t[19]=r,t[20]=h):h=t[20];let g=f(m,h),[_]=(0,Q.useState)(Ik),v=(0,Q.useRef)(null),y,b;t[21]===_?(y=t[22],b=t[23]):(b=()=>{let e=v.current;if(e)return e.appendChild(_),()=>{_.parentNode===e&&e.removeChild(_)}},y=[_],t[21]=_,t[22]=y,t[23]=b),(0,Q.useLayoutEffect)(b,y);let x;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(`div`,{className:`tiptap-editor`,children:(0,Z.jsx)(`div`,{ref:v,style:{display:`contents`}})}),t[24]=x):x=t[24];let S=x,C;t[25]!==n||t[26]!==c||t[27]!==r?(C=c?(0,Z.jsx)(`article`,{className:`bg-background`,"aria-label":n,"data-skill-markdown-viewer":``,"data-skill-markdown-viewer-state":`loaded`,children:S}):(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":n,"data-skill-markdown-viewer":``,"data-skill-markdown-viewer-state":`loaded`,children:(0,Z.jsxs)(`div`,{className:`editor-doc-scroll min-h-0 flex-1 overflow-auto subtle-scrollbar scroll-fade-mask`,children:[(0,Z.jsx)(jk,{text:r}),S]})}),t[25]=n,t[26]=c,t[27]=r,t[28]=C):C=t[28];let w=c?`tiptap-editor-portal-content`:`tiptap-editor-portal-content h-full`,T;t[29]!==g||t[30]!==w?(T=(0,Z.jsx)(pi,{editor:g,className:w}),t[29]=g,t[30]=w,t[31]=T):T=t[31];let E;t[32]!==_||t[33]!==T?(E=(0,$_.createPortal)(T,_),t[32]=_,t[33]=T,t[34]=E):E=t[34];let D;return t[35]!==C||t[36]!==E?(D=(0,Z.jsxs)(Z.Fragment,{children:[C,E]}),t[35]=C,t[36]=E,t[37]=D):D=t[37],D}function Ik(){let e=document.createElement(`div`);return e.style.display=`contents`,e}var Lk=`data-skill-markdown`;function Rk(e){let t=(0,$.c)(22),{scope:n,name:r,path:i,host:a,fileName:o}=e,s;t[0]!==a||t[1]!==r||t[2]!==i||t[3]!==n?(s={loadText:e=>Xm({scope:n,name:r,path:i,host:a},e)},t[0]=a,t[1]=r,t[2]=i,t[3]=n,t[4]=s):s=t[4];let c=pg(s);if(c.status===`loading`){let e;return t[5]===o?e=t[6]:(e=(0,Z.jsx)(vg,{fileName:o,dataAttr:Lk}),t[5]=o,t[6]=e),e}if(c.status===`error`){let e;return t[7]!==c.message||t[8]!==o?(e=(0,Z.jsx)(gg,{fileName:o,dataAttr:Lk,message:c.message}),t[7]=c.message,t[8]=o,t[9]=e):e=t[9],e}let l=c.content,u;t[10]!==r||t[11]!==i||t[12]!==n?(u=ps(n,r,i),t[10]=r,t[11]=i,t[12]=n,t[13]=u):u=t[13];let d;t[14]!==r||t[15]!==n?(d=ko(n,r),t[14]=r,t[15]=n,t[16]=d):d=t[16];let f;return t[17]!==c.content||t[18]!==o||t[19]!==u||t[20]!==d?(f=(0,Z.jsx)(Fk,{fileName:o,text:l,linkBaseDocName:u,skillPathLinkDocName:d}),t[17]=c.content,t[18]=o,t[19]=u,t[20]=d,t[21]=f):f=t[21],f}function zk(e){let t=(0,$.c)(5),[n,r]=(0,Q.useState)(!1),i;t[0]===e?i=t[1]:(i=()=>{let t=t=>{if(t.defaultPrevented||!(t.metaKey||t.ctrlKey)||t.key.toLowerCase()!==`f`)return;let n=e.current;if(n===null)return;let i=t.target;i instanceof Node&&!n.contains(i)&&Vc(i)||(t.preventDefault(),r(!0))};return window.addEventListener(`keydown`,t,!0),()=>window.removeEventListener(`keydown`,t,!0)},t[0]=e,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],t[2]=a):a=t[2],(0,Q.useEffect)(i,a);let o;return t[3]===n?o=t[4]:(o={findOpen:n,setFindOpen:r},t[3]=n,t[4]=o),o}var Bk=new Set([`md`,`mdx`]);function Vk(e){let t=(0,$.c)(18),{scope:n,name:r,path:i,host:a}=e,{_:o}=Bn(),s=(0,Q.useRef)(null),c=(0,Q.useRef)(null),l=(0,Q.useRef)(null),u;t[0]===i?u=t[1]:(u=i.split(`/`).pop()??i,t[0]=i,t[1]=u);let d=u,f=d.lastIndexOf(`.`),p=f>=0?d.slice(f+1).toLowerCase():``,m=Bk.has(p),{findOpen:h,setFindOpen:g}=zk(m?c:l),_=Bk.has(p)?(0,Z.jsx)(Rk,{scope:n,name:r,path:i,host:a,fileName:d}):(0,Z.jsx)(mg,{fileName:d,extension:p,loadText:e=>Xm({scope:n,name:r,path:i,host:a},e)}),v;t[2]!==h||t[3]!==m||t[4]!==g?(v=m&&h?(0,Z.jsx)(Ak,{containerRef:s,onClose:()=>g(!1)}):null,t[2]=h,t[3]=m,t[4]=g,t[5]=v):v=t[5];let y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(bf,{className:`size-4 shrink-0`,"aria-hidden":!0}),t[6]=y):y=t[6];let b;t[7]!==o||t[8]!==r?(b=o({id:`96pApd`,values:{name:r}}),t[7]=o,t[8]=r,t[9]=b):b=t[9];let x;t[10]===b?x=t[11]:(x=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 border-border border-b bg-muted/35 px-3 py-2 text-muted-foreground text-sm`,children:[y,(0,Z.jsx)(`span`,{className:`truncate`,children:b})]}),t[10]=b,t[11]=x);let S;t[12]===_?S=t[13]:(S=(0,Z.jsx)(`div`,{ref:s,className:`min-h-0 flex-1`,children:_}),t[12]=_,t[13]=S);let C;return t[14]!==v||t[15]!==x||t[16]!==S?(C=(0,Z.jsxs)(`div`,{ref:c,className:`relative flex h-full min-h-0 flex-col`,children:[v,x,S]}),t[14]=v,t[15]=x,t[16]=S,t[17]=C):C=t[17],C}var Hk=new Set;function Uk(){for(let e of Hk)e()}function Wk(e){return Hk.add(e),()=>Hk.delete(e)}var Gk=[`from-[#ff9d6c] to-[#ff7eb3]`,`from-[#8fe0c0] to-[#59c0ff]`,`from-[#c0b0ff] to-[#8fb0ff]`,`from-[#ffd18f] to-[#ff9fb0]`,`from-[#8fb0ff] to-[#c9a8ff]`,`from-[#7fe0a0] to-[#bfe08f]`];function Kk(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return Gk[Math.abs(t)%Gk.length]??Gk[0]}var qk=`SKILL.md`,Jk=new Map;function Yk(e){let t=(0,$.c)(44),{source:n,name:r,subtitle:i,tintKey:a,headerActions:o,headerLine:s,noPreviewFallback:c,banner:l,reserveRightGutter:u,selectedPath:d,scope:f,onBundlePathClick:p,onPreviewMeta:m}=e,h=u===void 0?!1:u,{_:g}=Bn(),_=`${n}::${r}`,v;t[0]===_?v=t[1]:(v=()=>Jk.get(_)??null,t[0]=_,t[1]=v);let[y,b]=(0,Q.useState)(v),x;t[2]===_?x=t[3]:(x=()=>Jk.has(_),t[2]=_,t[3]=x);let[S,C]=(0,Q.useState)(x),w=d??qk,T=(0,Q.useRef)(null),E=(0,Q.useRef)(null),{findOpen:D,setFindOpen:O}=zk(T),k,A;t[4]!==r||t[5]!==n?(k=()=>{let e=`${n}::${r}`,t=new AbortController;Jk.has(e)||Ym({source:n,name:r},t.signal).then(n=>{t.signal.aborted||(n.ok&&(Jk.set(e,n),b(n)),C(!0))});let i=Gc(Qk);return()=>{t.abort(),i()}},A=[n,r],t[4]=r,t[5]=n,t[6]=k,t[7]=A):(k=t[6],A=t[7]),(0,Q.useEffect)(k,A);let j,M;t[8]!==m||t[9]!==y?(j=()=>{y&&m?.(y)},M=[y,m],t[8]=m,t[9]=y,t[10]=j,t[11]=M):(j=t[10],M=t[11]),(0,Q.useEffect)(j,M);let N=y?.description,P;if(t[12]!==g||t[13]!==l||t[14]!==N||t[15]!==D||t[16]!==o||t[17]!==s||t[18]!==r||t[19]!==c||t[20]!==p||t[21]!==y||t[22]!==S||t[23]!==h||t[24]!==f||t[25]!==w||t[26]!==O||t[27]!==i||t[28]!==a){let e=y?$k(y.skillMd):[],n;t[30]===y?n=t[31]:(n=y?js(y):null,t[30]=y,t[31]=n);let u=n,d;t[32]!==g||t[33]!==y||t[34]!==w?(d=w===qk?y?{path:`${y.name} SKILL.md`,content:y.skillMd,md:!0}:null:(()=>{let e=y?.files?.find(e=>e.relPath===w);return e?{path:e.relPath,content:e.content??g({id:`fdeFfN`}),md:e.content!==null&&/\.mdx?$/.test(e.relPath)}:null})(),t[32]=g,t[33]=y,t[34]=w,t[35]=d):d=t[35];let m=d,_;t[36]!==D||t[37]!==O?(_=D?(0,Z.jsx)(Ak,{containerRef:E,onClose:()=>O(!1)}):null,t[36]=D,t[37]=O,t[38]=_):_=t[38];let v;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(bf,{className:`size-4`,"aria-hidden":!0}),t[39]=v):v=t[39];let b;t[40]!==o||t[41]!==s||t[42]!==h?(b=(0,Z.jsx)(Fg,{icon:v,actions:o,reserveRightGutter:h,children:s}),t[40]=o,t[41]=s,t[42]=h,t[43]=b):b=t[43],P=(0,Z.jsxs)(`div`,{ref:T,className:`relative flex h-full min-h-0 flex-col`,children:[_,b,y?(0,Z.jsxs)(`div`,{ref:E,className:`editor-doc-scroll min-h-0 flex-1 overflow-auto subtle-scrollbar scroll-fade-mask`,children:[w===qk?l:null,w===qk?(0,Z.jsx)(`div`,{className:`editor-content-aligned pt-6`,children:(0,Z.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Z.jsx)(Bu,{icon:(0,Z.jsx)(Vu,{className:`size-3.5`}),label:g({id:`XmJfZT`}),children:(0,Z.jsx)(`span`,{className:`font-mono`,children:r})}),N?(0,Z.jsx)(Bu,{icon:(0,Z.jsx)(Pb,{className:`size-3.5`}),label:g({id:`eTsJYJ`}),children:(0,Z.jsx)(`p`,{className:`text-foreground/80`,children:N})}):null,(0,Z.jsx)(Bu,{icon:(0,Z.jsx)(Ab,{className:`size-3.5`}),label:g({id:`pTyA_t`}),children:e.length>0?(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.map(Zk)}):(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`N2S1rs`})})}),u?(0,Z.jsx)(Bu,{icon:(0,Z.jsx)(Uf,{className:`size-3.5`}),label:g({id:`WOr-hW`}),children:(0,Z.jsx)(Pg,{size:u})}):null]})}):null,m?.md?(0,Z.jsx)(Fk,{flow:!0,fileName:m.path,text:m.content,linkBaseDocName:f?ps(f,r,w===qk?`SKILL`:w):void 0,skillPathLinkDocName:f?ko(f,r):void 0,onBundlePathClick:p}):m?(0,Z.jsx)(`div`,{className:`editor-content-aligned`,children:(0,Z.jsx)(`pre`,{className:`overflow-auto whitespace-pre-wrap break-words py-4 font-mono text-xs subtle-scrollbar scroll-fade-mask`,children:m.content})}):null]}):S?(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-4`,children:c??(0,Z.jsxs)(`div`,{className:`flex aspect-[2/1] w-full max-w-xl flex-col justify-end rounded-xl bg-gradient-to-br p-5 ${Kk(a)}`,"aria-hidden":!0,children:[(0,Z.jsx)(`span`,{className:`truncate font-semibold text-2xl text-neutral-900`,children:r}),(0,Z.jsx)(`span`,{className:`truncate text-neutral-900/70 text-sm`,children:i})]})}):(0,Z.jsx)(`div`,{className:`editor-doc-scroll min-h-0 flex-1 overflow-auto subtle-scrollbar scroll-fade-mask`,children:(0,Z.jsx)(`div`,{className:`editor-content-aligned pt-6`,children:(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(`div`,{className:`h-6 w-2/3 animate-pulse rounded bg-muted`}),[`a`,`b`,`c`,`d`,`e`].map(Xk)]})})})]}),t[12]=g,t[13]=l,t[14]=N,t[15]=D,t[16]=o,t[17]=s,t[18]=r,t[19]=c,t[20]=p,t[21]=y,t[22]=S,t[23]=h,t[24]=f,t[25]=w,t[26]=O,t[27]=i,t[28]=a,t[29]=P}else P=t[29];return P}function Xk(e){return(0,Z.jsx)(`div`,{className:`h-4 w-11/12 animate-pulse rounded bg-muted`},e)}function Zk(e){return(0,Z.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-muted-foreground text-xs`,children:e},e)}function Qk(){return Jk.clear()}function $k(e){try{let{frontmatter:t}=ac(e);return t?Ls(_s(t)):[]}catch{return[]}}var eA=Rr(`group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pe-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current`}},defaultVariants:{variant:`default`}});function tA(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==i?(a=gr(eA({variant:i}),n),t[4]=n,t[5]=i,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==a?(o=(0,Z.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:a,...r}),t[7]=r,t[8]=a,t[9]=o):o=t[9],o}function nA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`alert-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function rA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`text-balance text-muted-foreground text-sm md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`alert-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function iA(e){let t=(0,$.c)(66),{bundle:n,source:r,scope:i,previewedName:a,onInstalled:o}=e,{_:s}=Bn(),[c,l]=(0,Q.useState)(!1);if(n.names.length<=1)return null;let u;t[0]!==s||t[1]!==n.capabilities?.hooks?(u=n.capabilities?.hooks?s({id:`8fDf7j`}):null,t[0]=s,t[1]=n.capabilities?.hooks,t[2]=u):u=t[2];let d;t[3]!==s||t[4]!==n.capabilities?.commands?(d=n.capabilities?.commands?s({id:`9HKBNN`}):null,t[3]=s,t[4]=n.capabilities?.commands,t[5]=d):d=t[5];let f;t[6]!==s||t[7]!==n.capabilities?.mcp?(f=n.capabilities?.mcp?s({id:`8qgfac`}):null,t[6]=s,t[7]=n.capabilities?.mcp,t[8]=f):f=t[8];let p;t[9]!==s||t[10]!==n.capabilities?.agents?(p=n.capabilities?.agents?s({id:`EpZQFw`}):null,t[9]=s,t[10]=n.capabilities?.agents,t[11]=p):p=t[11];let m;t[12]!==u||t[13]!==d||t[14]!==f||t[15]!==p?(m=[u,d,f,p].filter(oA),t[12]=u,t[13]=d,t[14]=f,t[15]=p,t[16]=m):m=t[16];let h=m,g=n.names.length,_=n.plugin,v,y,b,x,S,C,w,T,E;if(t[17]!==n.names||t[18]!==h||t[19]!==_||t[20]!==a){let e;t[30]===a?e=t[31]:(e=e=>e!==a,t[30]=a,t[31]=e);let r=n.names.filter(e),i=r.slice(0,4);S=`editor-content-aligned`,v=tA,T=`note`,E=`my-3 bg-muted/40 px-4 py-3`,t[32]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(Ap,{className:`size-4`,"aria-hidden":!0}),t[32]=y):y=t[32];let o=_?(0,Z.jsx)(Y,{id:`nFAvDj`,values:{0:r.length,plugin:_}}):(0,Z.jsx)(Y,{id:`Hq3uDq`,values:{0:r.length}});t[33]===o?b=t[34]:(b=(0,Z.jsx)(nA,{children:o}),t[33]=o,t[34]=b);let s;t[35]===h?s=t[36]:(s=h.length>0?(0,Z.jsx)(Y,{id:`5A_TLD`,values:{0:h.join(`, `)}}):null,t[35]=h,t[36]=s),t[37]===s?x=t[38]:(x=(0,Z.jsx)(rA,{className:`min-w-0`,children:s}),t[37]=s,t[38]=x),C=`mt-2 flex flex-wrap items-center gap-x-2 gap-y-1.5 group-has-[>svg]/alert:col-start-2`,w=i.map(aA),t[17]=n.names,t[18]=h,t[19]=_,t[20]=a,t[21]=v,t[22]=y,t[23]=b,t[24]=x,t[25]=S,t[26]=C,t[27]=w,t[28]=T,t[29]=E}else v=t[21],y=t[22],b=t[23],x=t[24],S=t[25],C=t[26],w=t[27],T=t[28],E=t[29];let D;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>l(!0),t[39]=D):D=t[39];let O;t[40]===g?O=t[41]:(O=(0,Z.jsx)(X,{variant:`link`,size:`sm`,className:`px-1`,"data-testid":`plugin-bundle-pick`,onClick:D,children:(0,Z.jsx)(Y,{id:`yhy5h-`,values:{count:g}})}),t[40]=g,t[41]=O);let k;t[42]===n.repositoryUrl?k=t[43]:(k=n.repositoryUrl?(0,Z.jsx)(X,{variant:`ghost`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(`a`,{href:n.repositoryUrl,target:`_blank`,rel:`noreferrer`,children:[(0,Z.jsx)(Y,{id:`Fhp4Gn`}),(0,Z.jsx)(ju,{className:`size-3.5`})]})}):null,t[42]=n.repositoryUrl,t[43]=k);let A;t[44]!==O||t[45]!==k||t[46]!==C||t[47]!==w?(A=(0,Z.jsxs)(`div`,{className:C,children:[w,O,k]}),t[44]=O,t[45]=k,t[46]=C,t[47]=w,t[48]=A):A=t[48];let j;t[49]!==v||t[50]!==y||t[51]!==b||t[52]!==x||t[53]!==A||t[54]!==T||t[55]!==E?(j=(0,Z.jsxs)(v,{role:T,className:E,children:[y,b,x,A]}),t[49]=v,t[50]=y,t[51]=b,t[52]=x,t[53]=A,t[54]=T,t[55]=E,t[56]=j):j=t[56];let M=c?n:null,N;t[57]!==o||t[58]!==i||t[59]!==r||t[60]!==M?(N=(0,Z.jsx)(Zd,{bundle:M,source:r,defaultScope:i,onInstalled:o,onOpenChange:l}),t[57]=o,t[58]=i,t[59]=r,t[60]=M,t[61]=N):N=t[61];let P;return t[62]!==S||t[63]!==j||t[64]!==N?(P=(0,Z.jsxs)(`div`,{className:S,children:[j,N]}),t[62]=S,t[63]=j,t[64]=N,t[65]=P):P=t[65],P}function aA(e){return(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1.5 py-0.5 font-mono text-[12px] text-foreground/80`,children:e},e)}function oA(e){return e!==null}function sA(e){let t=(0,$.c)(33),{source:n,name:r,initialScope:i,marketplace:a}=e,{_:o}=Bn(),[s,c]=(0,Q.useState)(i),l=Fh(),u;t[0]!==l||t[1]!==s?(u=()=>{if(l.status!==`ready`)return null;let e=l.data.find(e=>e.scope===s)?.installableEditors;return e?new Set(e):null},t[0]=l,t[1]=s,t[2]=u):u=t[2];let d=u,[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),v;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(v=[],t[3]=v):v=t[3];let[y,b]=(0,Q.useState)(v),[x,S]=(0,Q.useState)(!1),C;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(C=[],t[4]=C):C=t[4];let w=(0,Q.useRef)(C),T=(0,Q.useRef)(null),E=(0,Q.useRef)(null),D=(0,Q.useRef)(null),O;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=[],t[5]=O):O=t[5];let k=(0,Q.useRef)(O),A=(0,Q.useRef)(!1),j;t[6]!==o||t[7]!==a||t[8]!==r||t[9]!==s||t[10]!==n?(j=async function(){if(T.current)return T.current;if(D.current)return D.current;let e=s,t=Vm({source:n,skill:r,scope:e,install:!1,...a?{marketplace:!0}:{}}).then(t=>t.ok?(T.current=t.name,E.current=e,_(e),p(t.name),h(t.path??null),t.name):(Dc.error(o({id:`oX-rVu`,values:{0:t.error}})),null));D.current=t;let i=await t;return D.current=null,i},t[6]=o,t[7]=a,t[8]=r,t[9]=s,t[10]=n,t[11]=j):j=t[11];let M=j,N;t[12]!==o||t[13]!==M?(N=async function(e){if(w.current=e,k.current=e,b(e),!A.current){for(A.current=!0,S(!0);;){let e=k.current,t=await M(),n=E.current;if(!t||!n)break;let r=await Um({scope:n,name:t,targets:[...e],linkMode:!0});if(!r.ok){Dc.error(o({id:`s-pW_v`,values:{0:r.error}}));break}if(e===k.current){let e=w.current.filter(cA),t=[...new Set([...e,...r.hosts])];w.current=t,b(t);break}}A.current=!1,S(!1)}},t[12]=o,t[13]=M,t[14]=N):N=t[14];let P=N,F;t[15]===y?F=t[16]:(F=new Set(y),t[15]=y,t[16]=F);let I=y.length>0,L;t[17]!==o||t[18]!==x||t[19]!==P||t[20]!==M||t[21]!==d||t[22]!==F||t[23]!==I?(L={hostSet:F,installed:I,installing:x,toggleEditor(e,t){if(e===`agents`){if(!t)return;(async()=>{S(!0);let e=await M(),t=E.current;if(e&&t){let n=await Zm({scope:t,name:e,dir:ks,mode:`copy`});if(n.ok){let e=[...new Set([...w.current,`agents`])];w.current=e,b(e)}else Dc.error(o({id:`s-pW_v`,values:{0:n.error}}))}S(!1)})();return}let n=new Set(w.current);t?n.add(e):n.delete(e),P([...n])},installAll(){let e=d();P(e===null?[...xr]:xr.filter(t=>e.has(t)))},linkMode:!0,placeAt(e,t){(async()=>{S(!0);let n=await M(),r=E.current;if(n&&r){let i=await Zm({scope:r,name:n,dir:e,mode:t});i.ok||Dc.error(o({id:`s-pW_v`,values:{0:i.error}}))}S(!1)})()}},t[17]=o,t[18]=x,t[19]=P,t[20]=M,t[21]=d,t[22]=F,t[23]=I,t[24]=L):L=t[24];let R=L,z=f!==null||x,B;return t[25]!==M||t[26]!==f||t[27]!==m||t[28]!==g||t[29]!==s||t[30]!==z||t[31]!==R?(B={scope:s,setScope:c,scopeLocked:z,importedName:f,importedPath:m,importedScope:g,importNow:M,toggles:R},t[25]=M,t[26]=f,t[27]=m,t[28]=g,t[29]=s,t[30]=z,t[31]=R,t[32]=B):B=t[32],B}function cA(e){return!lc(e)}var lA=`SKILL.md`;function uA(e){let t=(0,$.c)(18),{scope:n,name:r}=e,i;t[0]!==r||t[1]!==n?(i={scope:n,name:r},t[0]=r,t[1]=n,t[2]=i):i=t[2];let{origin:a,github:o,updateAvailable:s,reimport:c,reimporting:l}=Bg(i),u;t[3]!==r||t[4]!==n?(u=(0,Z.jsx)(ou,{scope:n,name:r,showNewFile:!1}),t[3]=r,t[4]=n,t[5]=u):u=t[5];let d=u;if(!a){let e;return t[6]===d?e=t[7]:(e=(0,Z.jsx)(`div`,{className:`flex gap-1`,children:d}),t[6]=d,t[7]=e),e}let f;t[8]===o?f=t[9]:(f=o?(0,Z.jsx)(X,{variant:`ghost`,size:`sm`,className:`px-2`,asChild:!0,children:(0,Z.jsxs)(`a`,{href:o,target:`_blank`,rel:`noreferrer`,children:[(0,Z.jsx)(Y,{id:`wdxz7K`}),(0,Z.jsx)(ju,{className:`h-3.5 w-3.5`})]})}):null,t[8]=o,t[9]=f);let p;t[10]!==c||t[11]!==l||t[12]!==s?(p=s?(0,Z.jsx)(X,{size:`sm`,onClick:()=>void c(),disabled:l,children:l?(0,Z.jsx)(Y,{id:`JL3si7`}):(0,Z.jsx)(Y,{id:`EkH9pt`})}):null,t[10]=c,t[11]=l,t[12]=s,t[13]=p):p=t[13];let m;return t[14]!==d||t[15]!==f||t[16]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[f,p,d]}),t[14]=d,t[15]=f,t[16]=p,t[17]=m):m=t[17],m}function dA(e){let t=(0,$.c)(112),{flavor:n,source:r,name:i,subtitle:a,level:o,reserveRightGutter:s,path:c}=e,l=c??lA,u=ih(),d=Zf(),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(!0),g,_;t[0]!==n||t[1]!==i||t[2]!==r?(g=()=>{if(n!==`explore`)return;let e=!1;return Km({source:r,name:i}).then(t=>{e||t.ok&&p(t)}),()=>{e=!0}},_=[n,r,i],t[0]=n,t[1]=i,t[2]=r,t[3]=g,t[4]=_):(g=t[3],_=t[4]),(0,Q.useEffect)(g,_);let[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(null),S;t[5]!==n||t[6]!==i||t[7]!==r?(S=n===`explore`?Ro(r,i):null,t[5]=n,t[6]=i,t[7]=r,t[8]=S):S=t[8];let C=S,w=n===`explore`?f?.sourceUrl??C?.sourceUrl:v?.repositoryUrl,T=f?.sourceKind??C?.sourceKind,[E,D]=(0,Q.useState)(null),O,k;t[9]!==n||t[10]!==r||t[11]!==T?(O=()=>{if(D(null),n!==`explore`||T!==`site`)return;let e=new AbortController;return Wm(r,e.signal).then(t=>{e.signal.aborted||!t.ok||D(t.skills.map(fA))}),()=>e.abort()},k=[n,T,r],t[9]=n,t[10]=r,t[11]=T,t[12]=O,t[13]=k):(O=t[12],k=t[13]),(0,Q.useEffect)(O,k);let A;t[14]!==b||t[15]!==E?(A=b?{plugin:b.plugin,names:b.bundledSkills,capabilities:b.capabilities,...b.repositoryUrl?{repositoryUrl:b.repositoryUrl}:{}}:E?{plugin:null,names:E}:null,t[14]=b,t[15]=E,t[16]=A):A=t[16];let j=A,M=n===`detected`,N=n===`builtin`,P=n===`linked`,F=n===`foreign`,I=o??`project`,L=n===`explore`,R;t[17]!==i||t[18]!==r||t[19]!==L||t[20]!==I?(R={source:r,name:i,initialScope:I,marketplace:L},t[17]=i,t[18]=r,t[19]=L,t[20]=I,t[21]=R):R=t[21];let z=sA(R),B=(0,Q.useRef)(!1),[V,ee]=(0,Q.useState)(null),H=z.importedName??V,U=z.importedScope??z.scope,{openTabs:W,closeTab:G}=Et(),te=Fh(),[ne,re]=(0,Q.useState)(!1),K;t[22]!==te||t[23]!==P||t[24]!==i||t[25]!==I?(K=P&&te.status===`ready`?te.data.find(e=>e.scope===I&&e.name===i):void 0,t[22]=te,t[23]=P,t[24]=i,t[25]=I,t[26]=K):K=t[26];let ie=K,q=(n===`explore`||F||v!==null)&&H!==null,ae,oe;t[27]!==G||t[28]!==q||t[29]!==ne||t[30]!==H||t[31]!==U||t[32]!==i||t[33]!==d||t[34]!==W||t[35]!==z.importedPath||t[36]!==z.toggles.hostSet||t[37]!==z.toggles.installing?(ae=()=>{if(!q||B.current||ne||z.toggles.installing)return;B.current=!0;let e=W.filter(e=>{let t=ze(e);return t.kind===`skill-preview`&&t.name===i}),t=t=>{d(U,H,{...t===void 0?{}:{path:t},replaceActive:!0,replaceHistory:!0});for(let t of e)G(t)};z.toggles.hostSet.size===0?t(z.importedPath??void 0):Bm(U,H).then(e=>t(e??z.importedPath??void 0))},oe=[q,ne,U,H,d,W,i,G,z.importedPath,z.toggles.installing,z.toggles.hostSet],t[27]=G,t[28]=q,t[29]=ne,t[30]=H,t[31]=U,t[32]=i,t[33]=d,t[34]=W,t[35]=z.importedPath,t[36]=z.toggles.hostSet,t[37]=z.toggles.installing,t[38]=ae,t[39]=oe):(ae=t[38],oe=t[39]),(0,Q.useEffect)(ae,oe);let se;t[40]===a?se=t[41]:(se=a&&a.charAt(0).toUpperCase()+a.slice(1),t[40]=a,t[41]=se);let ce=se,le=u[I],ue;t[42]===i?ue=t[43]:(ue=(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`,children:i}),t[42]=i,t[43]=ue);let de=ue,fe;t[44]===le?fe=t[45]:(fe=(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`,children:le}),t[44]=le,t[45]=fe);let pe=fe,J;t[46]===ce?J=t[47]:(J=(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`,children:ce}),t[46]=ce,t[47]=J);let me=J,he=v?.version?` (v${v.version})`:``,ge=ie?.canonicalPath??ie?.path??null,_e;t[48]!==me||t[49]!==pe||t[50]!==de||t[51]!==N||t[52]!==j||t[53]!==M||t[54]!==F||t[55]!==P||t[56]!==ge||t[57]!==v||t[58]!==he||t[59]!==r||t[60]!==T?(_e=P?(0,Z.jsx)(Y,{id:`8VLpRT`,values:{0:ge??r,boldName:de},components:{0:(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`})}}):N?(0,Z.jsx)(Y,{id:`rmorj0`,values:{boldName:de}}):v?(0,Z.jsx)(Y,{id:`UceXfW`,values:{0:v.plugin,boldName:de,pluginVersion:he,boldHarness:me},components:{0:(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`})}}):F?(0,Z.jsx)(Y,{id:`yhYv9j`,values:{boldName:de,source:r},components:{0:(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`})}}):M?(0,Z.jsx)(Y,{id:`UHwc0P`,values:{boldName:de,boldHarness:me,boldLevel:pe}}):j&&j.names.length>1?T===`site`?(0,Z.jsx)(Y,{id:`iE-yoU`,values:{0:j.names.length,boldName:de}}):(0,Z.jsx)(Y,{id:`El9CQ6`,values:{0:j.names.length,boldName:de}}):(0,Z.jsx)(Y,{id:`fBoO7w`,values:{boldName:de}}),t[48]=me,t[49]=pe,t[50]=de,t[51]=N,t[52]=j,t[53]=M,t[54]=F,t[55]=P,t[56]=ge,t[57]=v,t[58]=he,t[59]=r,t[60]=T,t[61]=_e):_e=t[61];let ve=_e,ye;t[62]!==N||t[63]!==j||t[64]!==f||t[65]!==M||t[66]!==n||t[67]!==F||t[68]!==P||t[69]!==ie||t[70]!==i||t[71]!==v||t[72]!==z.scope||t[73]!==z.scopeLocked||t[74]!==z.setScope||t[75]!==z.toggles||t[76]!==T||t[77]!==w||t[78]!==I?(ye=P?(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[ie?(0,Z.jsx)(X,{variant:`ghost`,size:`sm`,className:`px-2`,"data-testid":`skill-preview-open-source-file`,onClick:()=>{Yf(pm(ie)),Ke(!1),Uk()},children:(0,Z.jsx)(Y,{id:`9npOH9`})}):null,(0,Z.jsx)(ou,{scope:I,name:i,showNewFile:!1})]}):N?(0,Z.jsx)(uA,{scope:I,name:i}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`flex gap-1`,children:[f?.skillsUrl?(0,Z.jsx)(X,{variant:`ghost`,size:`sm`,className:`px-2`,asChild:!0,children:(0,Z.jsxs)(`a`,{href:f.skillsUrl,target:`_blank`,rel:`noreferrer`,children:[(0,Z.jsx)(Y,{id:`gN3JX8`}),(0,Z.jsx)(ju,{className:`h-3.5 w-3.5`})]})}):null,w?(0,Z.jsx)(X,{variant:`ghost`,size:`sm`,className:`px-2`,asChild:!0,children:(0,Z.jsxs)(`a`,{href:w,target:`_blank`,rel:`noreferrer`,children:[n===`explore`&&T===`site`?(0,Z.jsx)(Y,{id:`wdxz7K`}):(0,Z.jsx)(Y,{id:`IreQBq`}),(0,Z.jsx)(ju,{className:`h-3.5 w-3.5`})]})}):null]}),!P&&(v||!M)?(0,Z.jsxs)(va,{modal:!1,onOpenChange:re,children:[(0,Z.jsx)(fa,{asChild:!0,children:(0,Z.jsx)(X,{size:`sm`,disabled:z.toggles.installing,"data-testid":v?`skill-preview-edit-a-copy`:F?`skill-preview-copy-in`:void 0,children:z.toggles.installing?v||F?(0,Z.jsx)(Y,{id:`Dvr1Sg`}):(0,Z.jsx)(Y,{id:`Wtw22s`}):(0,Z.jsxs)(Z.Fragment,{children:[v?(0,Z.jsx)(Y,{id:`rFL-yb`}):F?(0,Z.jsx)(Y,{id:`XBgr2S`}):j&&j.names.length>1?(0,Z.jsx)(Y,{id:`f-k37b`}):(0,Z.jsx)(Y,{id:`TKQ7K-`}),(0,Z.jsx)(Gu,{className:`size-4 opacity-60`,"aria-hidden":!0})]})})}),(0,Z.jsxs)(ga,{align:`end`,className:Dr,children:[v||F?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ma,{className:`font-normal text-muted-foreground text-xs leading-snug whitespace-normal`,children:(0,Z.jsx)(Y,{id:`4FltCB`})}),(0,Z.jsx)(ya,{})]}):null,(0,Z.jsx)(ru,{value:z.scope,onSelect:z.setScope,disabled:z.scopeLocked}),(0,Z.jsx)(ya,{}),(0,Z.jsx)(Tr,{toggles:z.toggles,skill:{scope:z.scope,name:i}})]})]}):null]}),t[62]=N,t[63]=j,t[64]=f,t[65]=M,t[66]=n,t[67]=F,t[68]=P,t[69]=ie,t[70]=i,t[71]=v,t[72]=z.scope,t[73]=z.scopeLocked,t[74]=z.setScope,t[75]=z.toggles,t[76]=T,t[77]=w,t[78]=I,t[79]=ye):ye=t[79];let be=ye,xe;t[80]!==n||t[81]!==o||t[82]!==i||t[83]!==r||t[84]!==a||t[85]!==I?(xe=e=>n===`explore`?(window.location.hash=Yp({flavor:n,source:r,name:i,subtitle:a,level:o,path:e}),!0):(window.location.hash=Zp({scope:I,name:i,path:e}),!0),t[80]=n,t[81]=o,t[82]=i,t[83]=r,t[84]=a,t[85]=I,t[86]=xe):xe=t[86];let Se=xe,Ce=a||i,we;t[87]!==M||t[88]!==n?(we=e=>{let t=M?e.plugin??null:null;y(e=>e?.provider===t?.provider&&e?.plugin===t?.plugin&&e?.version===t?.version&&e?.marketplace===t?.marketplace&&e?.repositoryUrl===t?.repositoryUrl?e:t),x(n===`explore`?e.pluginBundle??null:null)},t[87]=M,t[88]=n,t[89]=we):we=t[89];let Te;t[90]!==j||t[91]!==i||t[92]!==z.scope||t[93]!==r?(Te=j?(0,Z.jsx)(iA,{bundle:j,source:r,scope:z.scope,previewedName:i,onInstalled:e=>{let t=e.get(i);t!==void 0&&ee(t)}}):void 0,t[90]=j,t[91]=i,t[92]=z.scope,t[93]=r,t[94]=Te):Te=t[94];let Ee=N?I:void 0,De;t[95]!==f||t[96]!==m?(De=f?.image&&m?(0,Z.jsx)(`img`,{src:f.image,alt:``,className:`max-h-full max-w-full rounded-xl border border-border bg-muted`,onError:()=>h(!1)}):void 0,t[95]=f,t[96]=m,t[97]=De):De=t[97];let Oe;return t[98]!==be||t[99]!==ve||t[100]!==i||t[101]!==Se||t[102]!==s||t[103]!==l||t[104]!==r||t[105]!==a||t[106]!==Ce||t[107]!==we||t[108]!==Te||t[109]!==Ee||t[110]!==De?(Oe=(0,Z.jsx)(Yk,{source:r,name:i,subtitle:a,tintKey:Ce,onBundlePathClick:Se,headerActions:be,headerLine:ve,reserveRightGutter:s,selectedPath:l,onPreviewMeta:we,banner:Te,scope:Ee,noPreviewFallback:De}),t[98]=be,t[99]=ve,t[100]=i,t[101]=Se,t[102]=s,t[103]=l,t[104]=r,t[105]=a,t[106]=Ce,t[107]=we,t[108]=Te,t[109]=Ee,t[110]=De,t[111]=Oe):Oe=t[111],Oe}function fA(e){return e.name}var pA=al(()=>n(()=>import(`./SettingsDialogBody-GRqpQyOX.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([124,1,125,13,9,28,2,3,29,30,31,32,33,83,37,66,18,8,84,85,86,87,88,89,7,90,43,44,11,12,45,40,14,15,42,19,17,91,21,92,24,126,10,16,20,127,104,23,128,129,130,41,99,118,119,131,132,133,93,39,46,71,72,73,74,75,76,77,78,79,80,81,82,4,5,94,25,34,56,57,58,95,68,61,96,97,98,64,65,100,55,59,60,62,101,102,103,26,105,106,107,35,108,109,110,111,112,113,114,115,134,54,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]),import.meta.url));function mA(e){let t=(0,$.c)(9),{error:n}=e,{_:r}=Bn(),i;t[0]!==r||t[1]!==n?(i=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`3h5zMp`}),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`h3`,{id:`settings-body-error-title`,className:`font-heading text-base leading-none font-medium`,children:(0,Z.jsx)(Y,{id:`hwFOFD`})}),t[3]=o):o=t[3];let s;t[4]===a?s=t[5]:(s=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[o,(0,Z.jsx)(`p`,{className:`max-w-xs text-sm text-muted-foreground`,children:a})]}),t[4]=a,t[5]=s);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(X,{variant:`default`,onClick:hA,children:(0,Z.jsx)(Y,{id:`HpK_8d`})}),t[6]=c):c=t[6];let l;return t[7]===s?l=t[8]:(l=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`settings-body-error-title`,"data-slot":`settings-body-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-5 p-8 text-center`,children:[s,c]}),t[7]=s,t[8]=l),l}function hA(){return window.location.reload()}function gA(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(pr,{fallbackRender:vA,onError:_A,children:n}),t[0]=n,t[1]=r),r}function _A(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function vA(e){return(0,Z.jsx)(mA,{...e})}function yA(e=typeof window>`u`?void 0:window.location){return e?.protocol===`file:`}function bA(e){let{groups:t,translate:n}=e,r=[],i=new Set;for(let e of t)if(e.enabled)for(let t of e.items){i.add(t.id),r.push({id:`section:${t.id}`,kind:`section`,sectionId:t.id,label:t.label,context:e.label,keywords:[e.label]});for(let n of t.subsections??[])r.push({id:`subsection:${t.id}:${n.id}`,kind:`field`,sectionId:t.id,label:n.label,context:`${e.label} → ${t.label}`,keywords:[e.label,t.label],targetField:n.anchor})}for(let e of vf)if(i.has(e.sectionId))for(let t of e.fields){let i=t.path.join(`.`);r.push({id:`field:${e.sectionId}:${i}`,kind:`field`,sectionId:e.sectionId,label:n(t.label),keywords:t.description?[n(t.description)]:[],targetField:i})}if(i.has(`plugin:markdownlint`))for(let e of uc)r.push({id:`rule:${e.id}`,kind:`rule`,sectionId:`plugin:markdownlint`,label:e.name,keywords:[e.id,e.alias,...e.aliases],ruleId:e.id});return r}function xA(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}var SA={"content-rules":{sectionId:`project-preferences`,anchor:`section:content-rules`},terminal:{sectionId:`project-preferences`,anchor:`section:terminal`},sharing:{sectionId:`sync`,anchor:`section:sharing`}};function CA(e){let t=SA[e];return t?{sectionId:t.sectionId,anchor:t.anchor}:{sectionId:e,anchor:null}}function wA(e){return CA(e).sectionId}function TA(e){let t=(0,$.c)(51),{open:n,initialSection:r,onOpenChange:i}=e,a=r===void 0?null:r,{_:o}=Bn(),{collabUrl:s}=Et(),{userBinding:c,userSynced:l,okignoreBinding:u,okignoreSynced:d,projectConfig:f,merged:p}=Fl(),{desktopPresent:m}=Wd(),h=a??`preferences`,g;t[0]===h?g=t[1]:(g=wA(h),t[0]=h,t[1]=g);let[_,v]=(0,Q.useState)(g),[y,b]=(0,Q.useState)(``),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),T=(0,Q.useRef)(0),E=(0,Q.useRef)(null),D,O;t[2]!==a||t[3]!==n?(D=()=>{if(n){let e=CA(a??`preferences`);v(e.sectionId),S(e.anchor?{path:e.anchor}:null),b(``)}},O=[n,a],t[2]=a,t[3]=n,t[4]=D,t[5]=O):(D=t[4],O=t[5]),(0,Q.useEffect)(D,O);let k,A;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>Ic(e=>{let t=CA(e);v(t.sectionId),t.anchor&&S({path:t.anchor})}),A=[],t[6]=k,t[7]=A):(k=t[6],A=t[7]),(0,Q.useEffect)(k,A);let j,M;t[8]===x?(j=t[9],M=t[10]):(j=()=>{if(!x)return;let e=E.current;if(!e)return;let t=null,n=null,r=null,i=null,a=()=>{let r=e.querySelector(`[data-field="${x.path}"]`);return r?(r.scrollIntoView({block:`center`}),r.classList.add(`animate-settings-nav-flash`),t=r,n=setTimeout(()=>r.classList.remove(`animate-settings-nav-flash`),750),!0):!1};return a()||(i=new MutationObserver(()=>{a()&&i?.disconnect()}),i.observe(e,{childList:!0,subtree:!0}),r=setTimeout(()=>i?.disconnect(),4e3)),()=>{i?.disconnect(),n&&clearTimeout(n),r&&clearTimeout(r),t?.classList.remove(`animate-settings-nav-flash`)}},M=[x],t[8]=x,t[9]=j,t[10]=M),(0,Q.useEffect)(j,M);let N=s!==null,P;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(P=zd(),t[11]=P):P=t[11];let F=P,I;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(I=Qd(),t[12]=I):I=t[12];let L=I,R,z;if(t[13]!==o||t[14]!==m||t[15]!==N||t[16]!==p?.appearance?.colorThemeEnabled||t[17]!==p?.slides?.enabled||t[18]!==f?.contentRules){let e;t[21]===f?.contentRules?e=t[22]:(e=e=>f?.contentRules?.[e.id]?.enabled===!0,t[21]=f?.contentRules,t[22]=e);let n=Ad.filter(e).map(EA),r=p?.appearance?.colorThemeEnabled!==!1,i=p?.slides?.enabled===!0,a=yA();R=[{id:`user`,label:o({id:`7PzzBU`}),enabled:!0,items:[{id:`preferences`,label:o({id:`Q6hhn8`})},{id:`configure-agents`,label:o({id:`jRAGrQ`})},{id:`hotkeys`,label:o({id:`4KmEoC`})},{id:`account`,label:o({id:`AeXO77`})},{id:`user-plugins-manage`,label:o({id:`ohUJJM`})},{id:`user-skills`,label:o({id:`w7LRoP`})},...F?[{id:`ai-tools`,label:o({id:`_5qBNl`})}]:[]]},{id:`project`,label:o({id:`ZWyHmq`}),enabled:N,items:[{id:`project-preferences`,label:o({id:`Q6hhn8`}),subsections:[{id:`attachments`,label:o({id:`w_Sphq`}),anchor:`content.attachmentFolderPath`},{id:`content-rules`,label:o({id:`OPOiKn`}),anchor:`section:content-rules`},...L?[{id:`terminal`,label:o({id:`ALhMYW`}),anchor:`section:terminal`}]:[]]},{id:`sync`,label:o({id:`AznQ2V`}),subsections:[{id:`sharing`,label:o({id:`cs4mps`}),anchor:`section:sharing`}]},{id:`search`,label:o({id:`A1taO8`})},{id:`plugins-manage`,label:o({id:`ohUJJM`})},...a?[]:[{id:`link-previews`,label:o({id:`gh27t1`})}],...F?[{id:`project-ai-tools`,label:o({id:`crqzW5`})}]:[],...F?[{id:`network-access`,label:o({id:`RaUKLu`})}]:[],{id:`project-templates`,label:o({id:`iTylMl`})},{id:`skills`,label:o({id:`w7LRoP`})},{id:`okignore`,label:o({id:`3zyg_A`})}]},{id:`plugins`,label:o({id:`ohUJJM`}),enabled:!0,items:[...N?n:[],...r?[{id:`plugin:theme`,label:o({id:`fJ3EbT`})}]:[],...i?[{id:`plugin:slides`,label:o({id:`f14doC`})}]:[]]},{id:`integrations`,label:o({id:`nbfdhU`}),enabled:!0,items:[]}],z=bA({groups:R,translate:o}),t[13]=o,t[14]=m,t[15]=N,t[16]=p?.appearance?.colorThemeEnabled,t[17]=p?.slides?.enabled,t[18]=f?.contentRules,t[19]=R,t[20]=z}else R=t[19],z=t[20];let B=z,V;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(V=function(e){T.current+=1;let t=T.current;v(e.sectionId),e.kind===`field`&&e.targetField?S({path:e.targetField}):e.kind===`rule`&&e.ruleId&&w({query:e.ruleId,nonce:t}),b(``)},t[23]=V):V=t[23];let ee=V,H;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(H=gr(`flex h-[700px] max-h-[calc(100dvh-4rem)] w-[900px] max-w-[calc(100%-2rem)] flex-col gap-0 overflow-hidden p-0 sm:grid sm:grid-cols-[220px_1fr] sm:max-w-[min(900px,calc(100%-2rem))]`,ti()),t[24]=H):H=t[24];let U;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(Jr,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`Tz0i8g`})}),t[25]=U):U=t[25];let W;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Z.jsx)(qr,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`RDrXh4`})}),t[26]=W):W=t[26];let G;t[27]!==_||t[28]!==R||t[29]!==B||t[30]!==y?(G=(0,Z.jsx)(DA,{groups:R,activeId:_,onSelect:v,entries:B,searchQuery:y,onSearchChange:b,onNavigate:ee}),t[27]=_,t[28]=R,t[29]=B,t[30]=y,t[31]=G):G=t[31];let te;t[32]===o?te=t[33]:(te=o({id:`OXb_Df`}),t[32]=o,t[33]=te);let ne;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(FA,{}),t[34]=ne):ne=t[34];let re=l?c:null,K;t[35]!==_||t[36]!==u||t[37]!==d||t[38]!==C||t[39]!==re?(K=(0,Z.jsx)(gA,{children:(0,Z.jsx)(Q.Suspense,{fallback:ne,children:(0,Z.jsx)(pA,{activeId:_,userBinding:re,okignoreBinding:u,okignoreSynced:d,markdownlintRuleQuery:C})})}),t[35]=_,t[36]=u,t[37]=d,t[38]=C,t[39]=re,t[40]=K):K=t[40];let ie;t[41]!==te||t[42]!==K?(ie=(0,Z.jsx)(`section`,{ref:E,"aria-label":te,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain subtle-scrollbar p-6`,tabIndex:0,children:K}),t[41]=te,t[42]=K,t[43]=ie):ie=t[43];let q;t[44]!==G||t[45]!==ie?(q=(0,Z.jsxs)(Yr,{className:H,"data-testid":`settings-dialog`,children:[U,W,G,ie]}),t[44]=G,t[45]=ie,t[46]=q):q=t[46];let ae;return t[47]!==i||t[48]!==n||t[49]!==q?(ae=(0,Z.jsx)(ei,{open:n,onOpenChange:i,children:q}),t[47]=i,t[48]=n,t[49]=q,t[50]=ae):ae=t[50],ae}function EA(e){return{id:`plugin:${e.id}`,label:e.label}}function DA(e){let t=(0,$.c)(46),{groups:n,activeId:r,onSelect:i,entries:a,searchQuery:o,onSearchChange:s,onNavigate:c}=e,{_:l}=Bn(),u,d,f,p,m,h,g,_,v,y;if(t[0]!==l||t[1]!==a||t[2]!==c||t[3]!==s||t[4]!==o){d=o.trim();let e=d===``?[]:a.filter(e=>NS(e.label,d,e.keywords)),n=e.filter(AA),r=e.filter(kA),i=e.filter(OA);t[15]===l?v=t[16]:(v=l({id:`y1t8bQ`}),t[15]=l,t[16]=v),y=`flex shrink-0 gap-x-3 overflow-x-auto overscroll-contain subtle-scrollbar scroll-fade-mask-x-max-sm border-b bg-muted/30 px-3 py-2 max-sm:pt-10 sm:h-full sm:min-h-0 sm:flex-col sm:gap-0 sm:overflow-x-visible sm:border-r sm:border-b-0 sm:py-4`,u=de,f=!1,p=`h-auto w-full shrink-0 bg-transparent sm:mb-3 [&_[data-slot=command-input-wrapper]]:h-9 [&_[data-slot=command-input-wrapper]]:rounded-lg [&_[data-slot=command-input-wrapper]]:border [&_[data-slot=command-input-wrapper]]:border-input`,m=`settings-search`;let b;t[17]===l?b=t[18]:(b=l({id:`1DahsC`}),t[17]=l,t[18]=b),t[19]!==s||t[20]!==o||t[21]!==b?(h=(0,Z.jsx)(Jt,{value:o,onValueChange:s,placeholder:b,className:`py-0`,"data-testid":`settings-search-input`}),t[19]=s,t[20]=o,t[21]=b,t[22]=h):h=t[22];let x=d===``?null:(0,Z.jsx)(Y,{id:`TQJCR6`,values:{0:e.length}});t[23]===x?g=t[24]:(g=(0,Z.jsx)(`span`,{"aria-live":`polite`,className:`sr-only`,"data-testid":`settings-search-result-count`,children:x}),t[23]=x,t[24]=g),_=d===``?null:(0,Z.jsxs)(At,{"data-testid":`settings-search-results`,className:`mt-1.5`,children:[(0,Z.jsx)(mt,{"data-testid":`settings-search-empty`,children:(0,Z.jsx)(Y,{id:`ljFWEt`})}),n.length>0?(0,Z.jsx)(vn,{heading:l({id:`R4OWFD`}),children:n.map(e=>(0,Z.jsx)(jA,{entry:e,query:d,onNavigate:c},e.id))}):null,r.length>0?(0,Z.jsx)(vn,{heading:l({id:`Tz0i8g`}),children:r.map(e=>(0,Z.jsx)(jA,{entry:e,query:d,onNavigate:c},e.id))}):null,i.length>0?(0,Z.jsx)(vn,{heading:l({id:`v2a04T`}),children:i.map(e=>(0,Z.jsx)(jA,{entry:e,query:d,onNavigate:c},e.id))}):null]}),t[0]=l,t[1]=a,t[2]=c,t[3]=s,t[4]=o,t[5]=u,t[6]=d,t[7]=f,t[8]=p,t[9]=m,t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=y}else u=t[5],d=t[6],f=t[7],p=t[8],m=t[9],h=t[10],g=t[11],_=t[12],v=t[13],y=t[14];let b;t[25]!==u||t[26]!==f||t[27]!==p||t[28]!==m||t[29]!==h||t[30]!==g||t[31]!==_?(b=(0,Z.jsxs)(u,{shouldFilter:f,className:p,"data-testid":m,children:[h,g,_]}),t[25]=u,t[26]=f,t[27]=p,t[28]=m,t[29]=h,t[30]=g,t[31]=_,t[32]=b):b=t[32];let x;t[33]!==r||t[34]!==n||t[35]!==i||t[36]!==d?(x=d===``?n.map(e=>(0,Z.jsx)(PA,{group:e,activeId:r,onSelect:i},e.id)):null,t[33]=r,t[34]=n,t[35]=i,t[36]=d,t[37]=x):x=t[37];let S;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(NA,{}),t[38]=S):S=t[38];let C;t[39]===x?C=t[40]:(C=(0,Z.jsxs)(`div`,{className:`contents subtle-scrollbar sm:flex sm:min-h-0 sm:flex-1 sm:flex-col sm:overflow-y-auto sm:overscroll-contain`,children:[x,S]}),t[39]=x,t[40]=C);let w;return t[41]!==C||t[42]!==v||t[43]!==y||t[44]!==b?(w=(0,Z.jsxs)(`nav`,{"aria-label":v,className:y,children:[b,C]}),t[41]=C,t[42]=v,t[43]=y,t[44]=b,t[45]=w):w=t[45],w}function OA(e){return e.kind===`rule`}function kA(e){return e.kind===`field`}function AA(e){return e.kind===`section`}function jA(e){let t=(0,$.c)(16),{entry:n,query:r,onNavigate:i}=e,a=n.id,o;t[0]!==n||t[1]!==i?(o=()=>i(n),t[0]=n,t[1]=i,t[2]=o):o=t[2];let s=`settings-search-result-${n.id}`,c;t[3]!==n.label||t[4]!==r?(c=AS(n.label,r).map(MA),t[3]=n.label,t[4]=r,t[5]=c):c=t[5];let l;t[6]===c?l=t[7]:(l=(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:c}),t[6]=c,t[7]=l);let u;t[8]===n.context?u=t[9]:(u=n.context===void 0?null:(0,Z.jsx)(`span`,{className:`ms-auto shrink-0 truncate ps-3 text-1sm text-muted-foreground`,children:n.context}),t[8]=n.context,t[9]=u);let d;return t[10]!==n.id||t[11]!==o||t[12]!==s||t[13]!==l||t[14]!==u?(d=(0,Z.jsxs)(fn,{value:a,onSelect:o,"data-testid":s,children:[l,u]}),t[10]=n.id,t[11]=o,t[12]=s,t[13]=l,t[14]=u,t[15]=d):d=t[15],d}function MA(e){return e.match?(0,Z.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.text},e.start):(0,Z.jsx)(`span`,{children:e.text},e.start)}function NA(){let e=(0,$.c)(4),t=typeof window<`u`?window.okDesktop??null:null,n=t?.appVersion;if(!t||!n)return null;let r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=xA(n),e[0]=r):r=e[0];let i=r,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`p`,{className:`whitespace-nowrap font-mono text-xs text-muted-foreground/70`,"data-testid":`settings-sidebar-version`,children:[`v`,n]}),e[1]=a):a=e[1];let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{t.shell.openExternal(i)},e[2]=o):o=e[2];let s;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsxs)(`div`,{className:`ml-auto shrink-0 px-2 sm:ml-0 sm:mt-auto sm:pt-3`,children:[a,(0,Z.jsxs)(`button`,{type:`button`,onClick:o,"data-testid":`settings-sidebar-release-notes`,className:gr(`mt-0.5 inline-flex items-center gap-1 whitespace-nowrap rounded text-xs text-muted-foreground transition-colors hover:text-foreground`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`),children:[(0,Z.jsx)(Y,{id:`_PACVa`}),(0,Z.jsx)(ju,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=s):s=e[3],s}function PA(e){let t=(0,$.c)(28),{group:n,activeId:r,onSelect:i}=e;if(n.items.length===0)return null;let a=`settings-group-${n.id}`,o=`${a}-caption`,s=n.enabled?void 0:o,c=n.enabled?`text-muted-foreground/80`:`text-muted-foreground/50`,l;t[0]===c?l=t[1]:(l=gr(`shrink-0 whitespace-nowrap px-2 text-xs font-semibold uppercase tracking-wide font-mono sm:mb-1`,c),t[0]=c,t[1]=l);let u;t[2]!==n.label||t[3]!==a||t[4]!==s||t[5]!==l?(u=(0,Z.jsx)(`h3`,{id:a,"aria-describedby":s,className:l,children:n.label}),t[2]=n.label,t[3]=a,t[4]=s,t[5]=l,t[6]=u):u=t[6];let d;t[7]!==o||t[8]!==n.enabled?(d=n.enabled?null:(0,Z.jsx)(`p`,{id:o,className:`px-2 text-xs italic text-muted-foreground/60 sm:mb-1`,children:(0,Z.jsx)(Y,{id:`JWsZlx`})}),t[7]=o,t[8]=n.enabled,t[9]=d):d=t[9];let f;if(t[10]!==r||t[11]!==o||t[12]!==n.enabled||t[13]!==n.items||t[14]!==i){let e;t[16]!==r||t[17]!==o||t[18]!==n.enabled||t[19]!==i?(e=e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`button`,{type:`button`,"aria-current":r===e.id?`page`:void 0,"aria-disabled":n.enabled?void 0:!0,"aria-describedby":n.enabled?void 0:o,tabIndex:n.enabled?0:-1,disabled:!n.enabled,onClick:()=>n.enabled&&i(e.id),"data-testid":`settings-sidebar-item-${e.id}`,className:gr(`w-auto whitespace-nowrap rounded px-2 py-1.5 text-left text-sm transition-colors sm:w-full`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`,r===e.id&&n.enabled?`bg-accent text-accent-foreground`:`hover:bg-accent/50`),children:e.label})},e.id),t[16]=r,t[17]=o,t[18]=n.enabled,t[19]=i,t[20]=e):e=t[20],f=n.items.map(e),t[10]=r,t[11]=o,t[12]=n.enabled,t[13]=n.items,t[14]=i,t[15]=f}else f=t[15];let p;t[21]!==a||t[22]!==f?(p=(0,Z.jsx)(`ul`,{"aria-labelledby":a,className:`flex gap-1 sm:block sm:space-y-0.5`,children:f}),t[21]=a,t[22]=f,t[23]=p):p=t[23];let m;return t[24]!==u||t[25]!==d||t[26]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:mb-4 sm:block`,children:[u,d,p]}),t[24]=u,t[25]=d,t[26]=p,t[27]=m):m=t[27],m}function FA(){let e=(0,$.c)(4),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`GsBUCk`})}),n=(0,Z.jsx)(tg,{className:`h-5 w-32`}),r=(0,Z.jsx)(tg,{className:`h-4 w-64`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,className:`space-y-3`,"data-testid":`settings-content-skeleton`,children:[t,n,r,(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(tg,{className:`h-9 w-full`}),(0,Z.jsx)(tg,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function IA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`flex h-full w-full aria-[orientation=vertical]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(sO,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function LA(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(dO,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function RA(e){let t=(0,$.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({withHandle:a,className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=gr(`relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,r),t[5]=r,t[6]=o);let s;t[7]===a?s=t[8]:(s=a&&(0,Z.jsx)(`div`,{className:`z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border`}),t[7]=a,t[8]=s);let c;return t[9]!==n||t[10]!==i||t[11]!==o||t[12]!==s?(c=(0,Z.jsxs)(hO,{"data-slot":`resizable-handle`,className:o,...i,children:[s,n]}),t[9]=n,t[10]=i,t[11]=o,t[12]=s,t[13]=c):c=t[13],c}function zA(e){let t=(0,$.c)(119),{findInputRef:n,query:r,replacement:i,replaceOpen:a,caseSensitive:o,wholeWord:s,current:c,total:l,onQueryChange:u,onReplacementChange:d,onReplaceOpenChange:f,onCaseSensitiveChange:p,onWholeWordChange:m,onNext:h,onPrevious:g,onReplaceCurrent:_,onReplaceAll:v,onClose:y}=e,{_:b}=Bn(),x=r.length>0,S=l>0,C;t[0]!==b||t[1]!==c||t[2]!==S||t[3]!==x||t[4]!==l?(C=x?S?`${c} / ${l}`:b({id:`Ev2r9A`}):``,t[0]=b,t[1]=c,t[2]=S,t[3]=x,t[4]=l,t[5]=C):C=t[5];let w=C,T;t[6]!==y||t[7]!==h||t[8]!==g?(T=function(e){e.key===`Enter`?(e.preventDefault(),e.shiftKey?g():h()):e.key===`Escape`&&(e.preventDefault(),y())},t[6]=y,t[7]=h,t[8]=g,t[9]=T):T=t[9];let E=T,D;t[10]!==y||t[11]!==_?(D=function(e){e.key===`Enter`?(e.preventDefault(),_()):e.key===`Escape`&&(e.preventDefault(),y())},t[10]=y,t[11]=_,t[12]=D):D=t[12];let O=D,k;t[13]===b?k=t[14]:(k=b({id:`MVxpbf`}),t[13]=b,t[14]=k);let A;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-find-input`,children:(0,Z.jsx)(Y,{id:`KujtjC`})}),t[15]=A):A=t[15];let j;t[16]===u?j=t[17]:(j=e=>u(e.target.value),t[16]=u,t[17]=j);let M;t[18]===b?M=t[19]:(M=b({id:`KujtjC`}),t[18]=b,t[19]=M);let N;t[20]!==n||t[21]!==E||t[22]!==r||t[23]!==j||t[24]!==M?(N=(0,Z.jsx)(Hg,{ref:n,id:`ok-find-input`,value:r,onChange:j,onKeyDown:E,placeholder:M,autoComplete:`off`,spellCheck:!1,className:`h-7 px-2 text-sm`}),t[20]=n,t[21]=E,t[22]=r,t[23]=j,t[24]=M,t[25]=N):N=t[25];let P;t[26]===b?P=t[27]:(P=b({id:`-8PP0T`}),t[26]=b,t[27]=P);let F;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(Hu,{"aria-hidden":`true`}),t[28]=F):F=t[28];let I;t[29]!==o||t[30]!==p||t[31]!==P?(I=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(za,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":P,pressed:o,onPressedChange:p,className:`size-6 min-w-6 px-0`,children:F})}),t[29]=o,t[30]=p,t[31]=P,t[32]=I):I=t[32];let L;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(Vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`-8PP0T`})}),t[33]=L):L=t[33];let R;t[34]===I?R=t[35]:(R=(0,Z.jsxs)(Ur,{children:[I,L]}),t[34]=I,t[35]=R);let z;t[36]===b?z=t[37]:(z=b({id:`_7UQ7y`}),t[36]=b,t[37]=z);let B;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(Hb,{"aria-hidden":`true`}),t[38]=B):B=t[38];let V;t[39]!==m||t[40]!==z||t[41]!==s?(V=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(za,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":z,pressed:s,onPressedChange:m,className:`size-6 min-w-6 px-0`,children:B})}),t[39]=m,t[40]=z,t[41]=s,t[42]=V):V=t[42];let ee;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(Vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`_7UQ7y`})}),t[43]=ee):ee=t[43];let H;t[44]===V?H=t[45]:(H=(0,Z.jsxs)(Ur,{children:[V,ee]}),t[44]=V,t[45]=H);let U;t[46]!==R||t[47]!==H?(U=(0,Z.jsxs)(Vg,{align:`inline-end`,className:`gap-0.5`,children:[R,H]}),t[46]=R,t[47]=H,t[48]=U):U=t[48];let W;t[49]!==U||t[50]!==N?(W=(0,Z.jsxs)(Ug,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[N,U]}),t[49]=U,t[50]=N,t[51]=W):W=t[51];let G;t[52]===w?G=t[53]:(G=(0,Z.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`min-w-14 px-1 text-right text-muted-foreground text-xs tabular-nums shrink-0`,children:w}),t[52]=w,t[53]=G);let te;t[54]===b?te=t[55]:(te=b({id:`oqB2ez`}),t[54]=b,t[55]=te);let ne=!S,re;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(Sa,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=re):re=t[56];let K;t[57]!==g||t[58]!==te||t[59]!==ne?(K=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":te,disabled:ne,onClick:g,children:re})}),t[57]=g,t[58]=te,t[59]=ne,t[60]=K):K=t[60];let ie;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Z.jsx)(Vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`oqB2ez`})}),t[61]=ie):ie=t[61];let q;t[62]===K?q=t[63]:(q=(0,Z.jsxs)(Ur,{children:[K,ie]}),t[62]=K,t[63]=q);let ae;t[64]===b?ae=t[65]:(ae=b({id:`SiUUCS`}),t[64]=b,t[65]=ae);let oe=!S,se;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(Gu,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=se):se=t[66];let ce;t[67]!==h||t[68]!==ae||t[69]!==oe?(ce=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ae,disabled:oe,onClick:h,children:se})}),t[67]=h,t[68]=ae,t[69]=oe,t[70]=ce):ce=t[70];let le;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(Vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`SiUUCS`})}),t[71]=le):le=t[71];let ue;t[72]===ce?ue=t[73]:(ue=(0,Z.jsxs)(Ur,{children:[ce,le]}),t[72]=ce,t[73]=ue);let de=a?`secondary`:`ghost`,fe;t[74]!==b||t[75]!==a?(fe=b(a?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=b,t[75]=a,t[76]=fe):fe=t[76];let pe=a?`ok-replace-input`:void 0,J;t[77]!==f||t[78]!==a?(J=()=>f(!a),t[77]=f,t[78]=a,t[79]=J):J=t[79];let me;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsx)(yb,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=me):me=t[80];let he;t[81]!==a||t[82]!==de||t[83]!==fe||t[84]!==pe||t[85]!==J?(he=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:de,size:`icon-sm`,"aria-label":fe,"aria-expanded":a,"aria-controls":pe,onClick:J,children:me})}),t[81]=a,t[82]=de,t[83]=fe,t[84]=pe,t[85]=J,t[86]=he):he=t[86];let ge;t[87]===a?ge=t[88]:(ge=(0,Z.jsx)(Vr,{side:`bottom`,children:a?(0,Z.jsx)(Y,{id:`UkQGhd`}):(0,Z.jsx)(Y,{id:`1RluQD`})}),t[87]=a,t[88]=ge);let _e;t[89]!==he||t[90]!==ge?(_e=(0,Z.jsxs)(Ur,{children:[he,ge]}),t[89]=he,t[90]=ge,t[91]=_e):_e=t[91];let ve;t[92]!==b||t[93]!==O||t[94]!==S||t[95]!==v||t[96]!==_||t[97]!==d||t[98]!==a||t[99]!==i?(ve=a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-replace-input`,children:(0,Z.jsx)(Y,{id:`fqSfXY`})}),(0,Z.jsx)(dh,{id:`ok-replace-input`,value:i,onChange:e=>d(e.target.value),onKeyDown:O,placeholder:b({id:`fqSfXY`}),autoComplete:`off`,spellCheck:!1,className:`h-7 w-48 rounded-[min(var(--radius-md),12px)] px-2 text-sm shadow-none focus-visible:ring-2`}),(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b({id:`bS_boY`}),disabled:!S,onClick:_,children:(0,Z.jsx)(yb,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`bS_boY`})})]}),(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b({id:`dr1vFs`}),disabled:!S,onClick:v,children:(0,Z.jsx)(vb,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`dr1vFs`})})]})]}):null,t[92]=b,t[93]=O,t[94]=S,t[95]=v,t[96]=_,t[97]=d,t[98]=a,t[99]=i,t[100]=ve):ve=t[100];let ye;t[101]===b?ye=t[102]:(ye=b({id:`wJo9oS`}),t[101]=b,t[102]=ye);let be;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(zp,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=be):be=t[103];let xe;t[104]!==y||t[105]!==ye?(xe=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ye,onClick:y,children:be})}),t[104]=y,t[105]=ye,t[106]=xe):xe=t[106];let Se;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsx)(Vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`yz7wBu`})}),t[107]=Se):Se=t[107];let Ce;t[108]===xe?Ce=t[109]:(Ce=(0,Z.jsxs)(Ur,{children:[xe,Se]}),t[108]=xe,t[109]=Ce);let we;return t[110]!==W||t[111]!==G||t[112]!==q||t[113]!==ue||t[114]!==k||t[115]!==_e||t[116]!==ve||t[117]!==Ce?(we=(0,Z.jsxs)(`search`,{"data-testid":`find-replace-bar`,"aria-label":k,className:`pointer-events-auto flex max-w-[min(calc(100vw-1rem),720px)] touch-manipulation items-center gap-1 rounded-[calc(var(--radius)+2px)] border border-input bg-popover/95 p-1 text-popover-foreground shadow-md shadow-black/10 backdrop-blur`,children:[A,W,G,q,ue,_e,ve,Ce]}),t[110]=W,t[111]=G,t[112]=q,t[113]=ue,t[114]=k,t[115]=_e,t[116]=ve,t[117]=Ce,t[118]=we):we=t[118],we}var BA={current:0,total:0},VA=120,HA=100;function UA(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?O(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(R,n,WA)}function WA(){return null}function GA(e){if(!e||e.isDestroyed)return null;let{from:t,to:n,empty:r}=e.state.selection;if(r)return null;let i=e.state.doc.textBetween(t,n,`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-BQYAUKok.js","./chunk-CYidjpOJ.js","./preload-helper-Chd9yIcd.js","./trace-api-BP9dN1Hz.js","./propagation-api-DC5404fy.js","./context-api-dUnlgSJr.js","./BugReportHistoryDialog-DGj_pTZf.js","./dist-Nvb76hAm.js","./jsx-runtime-BUgB2tll.js","./react-f2sANaYj.js","./dialog-CTNat3T_.js","./dist-BcvirUWL.js","./dist-BHv-mziD.js","./react-dom-DPxgxlDT.js","./dist-DRO03ovd.js","./es2015-B9_uRFGw.js","./button-Cym3gapE.js","./bundle-mjs-SHeFpKGC.js","./compiler-runtime-BfE3aGVn.js","./utils-CPqDy6Hr.js","./x-DbShSCr5.js","./createLucideIcon-BulbvLvN.js","./BugReportHistory-CuN8iDlA.js","./collapsible-DYySK8La.js","./chevron-down-DNO3PgI_.js","./folder-open-BWpLO6wT.js","./spinner-t7GahFcQ.js","./bug-report-send-manager-5nrn8Psu.js","./dist-As2x8uCt.js","./lib-vOz_s3tj.js","./html-void-elements-zEl0KGqf.js","./lib-DmueaA5E.js","./markdownit-CugClK-K.js","./w3c-keyname-C7Rznu6R.js","./trash-2-DSqYvaPJ.js","./badge-BWfmbBoh.js","./platform-labels-DWuGftrI.js","./dist-Cr4-nBVI.js","./GraphPanel-DDKxNmOr.js","./toggle-group-C2_37kV5.js","./dist-Bn0BEeMP.js","./dist-Dhtu02232.js","./tooltip-DttaCTqz.js","./dist-CMrReMig.js","./floating-ui.dom-BcZPrP06.js","./dist-BDna-dOq.js","./useQuery-ZeEDLtxh.js","./min-B6fjqEav.js","./src-we-4-j9S.js","./colors-6O6-4xPx.js","./ordinal-DJL8o-kw.js","./init-X_ANAGxw.js","./isObject-2-KdVTyV.js","./now-eUYS5OsE.js","./arrow-up-right-BTi7mHwL.js","./prop-types-CTZ-Zcfm.js","./page-list-cache-AR7XhC2q.js","./file-tree-utils-Cy2QEG_5.js","./doc-paths-BkNaaTOB.js","./startup-marks-CUyZjhyC.js","./documents-events-2g_OBjKU.js","./documents-fetch-UmC9duIp.js","./parse-api-error-Dd8VI2eu.js","./target-navigation-intent-D6pgYTG-.js","./maximize-2-D91zEy2V.js","./triangle-alert-GeclLtDN.js","./dist-PQ5KMVDh.js","./panel-DNPki55m.js","./external-link-B0bVg1hn.js","./overlay-layers-Bj-TVfKw.js","./ActivityModeContent-B37XJHxx.js","./DocumentContext-CZ1LyjXH.js","./cm-theme-MqTIJzgL.js","./dist-nQee1FU7.js","./dist-CIM44Ta6.js","./dist-ClB1bacr.js","./dist-Cn5Ah8iR.js","./dist-CnaP_OyG.js","./dist-CWdEDKHh.js","./dist-DMctVxBR.js","./dist-DGNSX3J0.js","./dist-C6BEjIPY.js","./stex-C-5D68LN.js","./config-provider-DWieljqa.js","./dist-CJhtNlOm2.js","./client-version-DewpIoVp.js","./use-apply-config-color-theme-CwClEWrd.js","./use-apply-config-theme-CBmHKD_B.js","./i18n-CpxzRV_v.js","./messages-B2mYVhA4.js","./select-XEGYznMI.js","./dist-Bd_yyADX.js","./check-Dut4Aov8.js","./switch-iwBsEWej.js","./CodeMirrorPropInput-Be4UuxHJ.js","./asset-dispatch-KsnhYIM1.js","./note-window-mode-CsmLTxU_.js","./git-branch-3CSRgL0o.js","./Mermaid-B4Oa2diB.js","./chevron-right-4mYNnAZZ.js","./circle-alert-b-E0_BIP.js","./eye-7pio2q9G.js","./hash-3VQG5UJ7.js","./info-SlzbpjOb.js","./minus-CmrkEJ8b.js","./paperclip-CrupYCX8.js","./local-menu-action-bus-BLEUyEvu.js","./file-tree-rename-validation-B5TvPsC_.js","./input-DJ1c1x-M.js","./popover-BE6X9rKr.js","./dist-GoOli512.js","./use-collab-url-DHOOSaDb.js","./skills-api-KE9J-94z.js","./skill-scope-CauFSzAn.js","./use-workspace-DRylP9vX.js","./DocumentContext-B0sQn39F.css","./undo-2-XcI_wHcs.js","./agent-diff-store-DgFkR0kV.js","./cursor-2VSK5BUh.js","./copilot-DMpTxujg.js","./timeline-diff-store-ym5Oz1UF.js","./use-activity-panel-BCJavN8T.js","./agent-presence-3JajMNAq.js","./lru-string-cache-Cc7rikda.js","./SettingsDialogBody-Cqc-yl4k.js","./sortable.esm-DK-jMveF.js","./alert-dialog-D9BtoYXB.js","./checkbox-LVDa5cS9.js","./terminal-cli-display-C2L3vHWw.js","./dropdown-menu-CRvS0_4-.js","./dist-wcXwpuqG.js","./label-D-K3fWtj.js","./radio-group-npdxiS6E.js","./separator-C6x7j8mC.js","./EnableSyncConfirmDialog-DGwynRzU.js","./RegisteredAgentIcon-CDl1h-4U.js","./lint-plugin-meta-LEBWvINg.js","./auth-state-cache-DNrEadrI.js","./terminal-D4HSnHXf.js","./SkillInstallMenu-BwbbztKY.js","./use-open-skill-DzG96lKz.js","./use-skills-RpG-BeVz.js","./clipboard-adapter-815RzzoI.js","./folder-config-api-DhiWnWlS.js","./refresh-cw-BFSYd-XR.js","./terminal-command-events-D0gJ8NJs.js","./field-Di3yPBdO.js","./textarea-BoMa_3jF.js","./use-settings-route-Dq3eM_ye.js","./ThemePicker-DH1tY5im.js","./square-pen-CBGVrQUa.js","./form-Bz-LEGU-.js","./ConfigSharingInfoTooltip-BzRIZ5Ed.js","./markdownlint-rule-browser-BTovNATK.js","./skeleton-BZIHOzZH.js","./tag-pill-input-CcAyDLGe.js","./lint-config-client-CQNYXMfG.js","./input-group-eVl8FXAc.js","./use-terminal-enabled-DIQ4qqYj.js","./terminal-telemetry-DI0bolzP.js","./schema-fields-view-intent-DCUTojNw.js","./tool-list-format-DRi3JW8x.js","./ManagedArtifactProperties-CV1Prpoj.js","./ManagedArtifactProperties-DeYta-00.js","./PropertyDisplayRow-sm9qwuBw.js","./format-CyaLi0or.js","./braces-Bzye844v.js","./comment-chips-mYvhrkxj.js","./SkillCostValue-DLUxO68c.js","./selection-context-BcWEVrAI.js","./MermaidDocEditor-CiHzMRN9.js","./dist-Drn6e5ml2.js","./dist-D9xNKL3I2.js","./src-B5LNuYlK.js","./ExcalidrawDocEditor-BWNQPfhq.js","./chunk-K2UTITRG-BJBPIYUX.js","./chunk-SRAX5OIU-BEvWJO3c.js","./chunk-ZUYEQ4TG-CQSwzpWR.js","./chunk-6U3AYISY-C-nplzwN.js","./chunk-Z3N5DIM6-2xVL_dId.js","./dist-BY_vnlVW2.js","./ExcalidrawDocEditor-D_O2bRP1.css","./TextDocEditor--IKVxg88.js","./text-viewer-languages-Cc4U6Lc5.js","./SourceEditor-RCKX4Ohe.js","./typing-burst-detector-BO09cycJ.js","./wrench-DcVBYiNl.js","./SkillToolbarControls-Bap6lIv8.js","./AddPropertiesButton-eMa8eBGf.js","./DiffView-DS16M3wC.js","./list-plus-nPRgk4Qi.js","./workspace-paths-CAsMig07.js","./SkillOriginInline-DpPKdpar.js","./use-skill-origin-uUY8unvE.js","./SlidesToolbarControls-BNqlGZ8e.js","./SkillEditBanner-b0gL75iO.js","./SkillModeBanner-Cfij5biF.js","./LintConfigEditor-B3Gj07cI.js","./EditorModeToggle-jAYPDv4d.js","./useLintConfigViewMode-BvPSErDD.js","./SchemaConfigEditor-D17w4XxC.js","./case-sensitive-BwklrMJw.js","./TimelineDiffPane-D8HcBg2n.js","./use-timeline-entry-diff-_fLA4Pt0.js","./libesm-mBLacfDP.js","./panel-right-open-2VYfauQI.js","./AgentDiffPane-DHlBPg3c.js","./AppMenubar-DS-GyfEA.js","./app-menubar-gate-q1nJIutw.js","./AgentThreadClientBinder-lpLw9XDN.js","./thread-client-C32zww5K.js","./SessionsHost-Cl-gIFYH.js","./launcher-selection-DTBWt8s2.js","./terminal-launch-events-rC-SK1H0.js","./TerminalStartingNotice-DFapfn5h.js","./tabs-DmGV_6HP.js","./launch-agent-thread-Cb_G0uH0.js","./ImportSkillDialog-D_3ApyBv.js","./package-Bo0V5xFD.js","./McpConsentDialogBody-CTSqWNk2.js","./RowDisclosure-DDH_M2cK.js","./ok-CtJ8JyHz.js","./ShareBranchSwitchDialog-Ct4sBRfQ.js","./miss-dialog-store-DVpIaq34.js","./share-metadata-rows-DPgPU-ev.js","./auth-prompt-store-3WR-Jv7J.js","./desktop-bridge-types-oYPdTDmz.js","./receive-store-RexqPtVU.js","./ShareReceiveMissDialog-C9VJyG_D.js","./pending-receive-nav-store-DXWRYoc_.js","./ConsentDialogBody-XPmv8PGk.js","./project-paths-BmMTa57i.js","./ShareReceiveDialog-B92aqQEx.js","./TerminalWindowApp-DjRpidld.js","./ReportBugMenuTrigger-D4qlc7zz.js","./use-live-xterm-theme-_zomIp7z.js","./telemetry-startup-BFCbpnFp.js"])))=>i.map(i=>d[i]);
2
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./globals-Bezfr5us.js";import{t as n}from"./preload-helper-Chd9yIcd.js";import{t as r}from"./jsx-runtime-BUgB2tll.js";import{$ as i,$n as a,$r as o,$t as s,A as c,Ar as l,At as u,B as d,Bn as f,Br as p,Bt as m,C as h,Cn as g,Cr as _,Ct as v,D as y,Dt as b,E as x,Er as S,Et as C,F as w,Fr as T,Ft as E,G as D,Gn as O,Gr as k,Gt as A,H as j,Hn as M,Hr as N,I as P,In as F,Ir as I,J as L,Jn as R,Jr as z,Jt as B,K as V,Kn as ee,Kr as H,Kt as U,Ln as W,Lr as G,Lt as te,M as ne,Mn as re,N as K,Nn as ie,Nr as q,Nt as ae,On as oe,Or as se,Ot as ce,Pn as le,Pr as ue,Q as de,Qn as fe,Qr as pe,Qt as J,Rn as me,Rr as he,Rt as ge,S as _e,Sn as ve,St as ye,Tn as be,Tr as xe,Tt as Se,Un as Ce,Ur as we,Ut as Te,V as Ee,Vn as De,Vr as Oe,Vt as ke,W as Ae,Wn as je,Wr as Me,Wt as Ne,Xr as Pe,Xt as Fe,Y as Ie,Yn as Le,Yr as Re,Yt as ze,Z as Be,Zn as Ve,Zr as He,Zt as Ue,_ as We,_r as Ge,_t as Ke,a as qe,ai as Je,an as Ye,ar as Xe,at as Ze,b as Qe,bn as $e,br as et,c as tt,ci as nt,cn as rt,cr as it,ct as at,d as ot,di as st,dn as ct,dr as lt,dt as ut,ei as dt,en as ft,er as pt,et as mt,f as ht,fi as gt,fn as _t,fr as vt,ft as yt,g as bt,gr as xt,gt as St,h as Ct,hr as wt,ht as Tt,i as Et,ii as Dt,in as Ot,ir as kt,it as At,j as jt,jn as Mt,jr as Nt,k as Pt,kn as Ft,kr as It,kt as Lt,l as Rt,li as zt,ln as Bt,lr as Vt,m as Ht,mn as Ut,mr as Wt,mt as Gt,n as Kt,ni as qt,nt as Jt,o as Yt,oi as Xt,or as Zt,ot as Qt,p as $t,pi as en,pn as tn,pr as nn,pt as rn,q as an,qn as on,qr as sn,qt as cn,r as ln,ri as un,rn as dn,rt as fn,s as pn,sn as mn,sr as hn,t as gn,ti as _n,tt as vn,u as yn,ui as bn,un as xn,ur as Sn,v as Cn,vt as wn,w as Tn,wn as En,wr as Dn,wt as On,x as kn,xn as An,xr as jn,xt as Mn,y as Nn,yn as Pn,yr as Fn,z as In,zn as Ln,zt as Rn}from"./DocumentContext-CZ1LyjXH.js";import{t as zn}from"./react-f2sANaYj.js";import{n as Y,r as Bn,t as Vn}from"./dist-Nvb76hAm.js";import{_ as Hn,a as Un,c as Wn,d as Gn,f as Kn,g as qn,h as Jn,i as Yn,l as Xn,m as Zn,n as Qn,o as $n,p as er,r as tr,s as nr,t as rr,u as ir,v as ar,y as or}from"./useQuery-ZeEDLtxh.js";import{n as sr,t as cr}from"./dist-PQ5KMVDh.js";import{t as lr}from"./react-dom-DPxgxlDT.js";import{t as ur}from"./compiler-runtime-BfE3aGVn.js";import{i as dr,n as fr,o as pr,r as mr,t as hr}from"./local-menu-action-bus-BLEUyEvu.js";import{t as gr}from"./utils-CPqDy6Hr.js";import{n as _r}from"./clipboard-adapter-815RzzoI.js";import{C as vr,S as yr,_ as br,a as xr,b as Sr,i as Cr,m as wr,n as Tr,r as Er,t as Dr,v as Or,w as kr,x as Ar,y as jr}from"./SkillInstallMenu-BwbbztKY.js";import{t as Mr}from"./overlay-layers-Bj-TVfKw.js";import{i as Nr,n as Pr,r as Fr,t as Ir}from"./ReportBugMenuTrigger-D4qlc7zz.js";import{n as Lr,r as Rr,t as X}from"./button-Cym3gapE.js";import{t as zr}from"./dist-BHv-mziD.js";import{i as Br,n as Vr,r as Hr,t as Ur}from"./tooltip-DttaCTqz.js";import{n as Wr,r as Gr,t as Kr}from"./collapsible-DYySK8La.js";import{a as qr,c as Jr,i as Yr,n as Xr,o as Zr,r as Qr,s as $r,t as ei,u as ti}from"./dialog-CTNat3T_.js";import{a as ni,c as ri,i as ii,l as ai,o as oi,r as si,s as ci,t as li}from"./alert-dialog-D9BtoYXB.js";import{B as ui,Ct as di,Et as fi,F as pi,G as mi,H as hi,M as gi,O as _i,Q as vi,R as yi,T as bi,Tt as xi,U as Si,V as Ci,Y as wi,Z as Ti,_ as Ei,b as Di,ct as Oi,et as ki,gt as Ai,j as ji,mt as Mi,st as Ni,tt as Pi,ut as Fi,v as Ii,xt as Li,y as Ri}from"./CodeMirrorPropInput-Be4UuxHJ.js";import{t as zi}from"./checkbox-LVDa5cS9.js";import{a as Bi,d as Vi,i as Hi,l as Ui,n as Wi,o as Gi,r as Ki,s as qi,t as Ji,u as Yi}from"./floating-ui.dom-BcZPrP06.js";import{a as Xi,c as Zi,d as Qi,f as $i,i as ea,m as ta,n as na,o as ra,p as ia,r as aa,s as oa,u as sa}from"./terminal-cli-display-C2L3vHWw.js";import{a as ca,d as la,f as ua,i as da,m as fa,n as pa,o as ma,p as ha,r as ga,s as _a,t as va,u as ya}from"./dropdown-menu-CRvS0_4-.js";import{t as ba}from"./label-D-K3fWtj.js";import{c as xa,l as Sa}from"./select-XEGYznMI.js";import{_ as Ca,d as wa,f as Ta,g as Ea,h as Da,m as Oa,o as ka,p as Aa,t as ja,v as Ma,y as Na}from"./progress-YLRB2n7w.js";import{n as Pa,t as Fa}from"./radio-group-npdxiS6E.js";import{n as Ia,t as La}from"./separator-C6x7j8mC.js";import{n as Ra,r as za,t as Ba}from"./toggle-group-C2_37kV5.js";import{_ as Va,a as Ha,b as Ua,d as Wa,h as Ga,i as Ka,p as qa,r as Ja,t as Ya,v as Xa,y as Za}from"./RegisteredAgentIcon-CDl1h-4U.js";import{i as Qa,n as $a,r as eo,s as to}from"./terminal-telemetry-DI0bolzP.js";import{$i as no,$n as ro,$s as io,$t as ao,Aa as oo,Ai as so,Ao as co,At as lo,B as uo,Ba as fo,Bi as po,Bo as mo,Br as ho,C as go,Cr as _o,Do as vo,Ds as yo,E as bo,Ei as xo,Eo as So,Er as Co,F as wo,Fo as To,Fs as Eo,Ga as Do,Gn as Oo,Go as ko,Ha as Ao,Ht as jo,Ia as Mo,In as No,Ji as Po,Jn as Fo,Js as Io,Ka as Lo,Ko as Ro,Kr as zo,Li as Bo,Ln as Vo,M as Ho,Mo as Uo,No as Wo,Ns as Go,Nt as Ko,O as qo,Oi as Jo,Oo as Yo,Os as Xo,P as Zo,Pa as Qo,Pt as $o,Qr as es,R as ts,Ro as ns,Si as rs,Sr as is,Ti as as,To as os,Ts as ss,Uo as cs,Va as ls,Vo as us,Wa as ds,Wi as fs,Wo as ps,Wr as ms,Ws as hs,Xi as gs,Xo as _s,Xs as vs,Ya as ys,Yo as bs,Yr as xs,Ys as Ss,Zs as Cs,_ as ws,_t as Ts,ar as Es,at as Ds,ca as Os,co as ks,cr as As,dr as js,ec as Ms,fa as Ns,fn as Ps,fr as Fs,ft as Is,gr as Ls,ha as Rs,hi as zs,in as Bs,it as Vs,j as Hs,jr as Us,js as Ws,ka as Gs,ki as Ks,kr as qs,ks as Js,la as Ys,ma as Xs,n as Zs,nc as Qs,oi as $s,or as ec,pi as tc,po as nc,pr as rc,qn as ic,qo as ac,qs as oc,ra as sc,rc as cc,ri as lc,rt as uc,s as dc,sn as fc,so as pc,sr as mc,t as hc,tc as gc,v as _c,vi as vc,w as yc,wr as bc,wt as xc,yi as Sc,yn as Cc,yr as wc,zi as Tc,zn as Ec}from"./dist-As2x8uCt.js";import{n as Dc,t as Oc}from"./dist-CJhtNlOm2.js";import{S as kc,_ as Ac,a as jc,b as Mc,g as Nc,h as Pc,i as Fc,l as Ic,m as Lc,r as Rc,t as zc,u as Bc,y as Vc}from"./use-settings-route-Dq3eM_ye.js";import{t as Hc}from"./dist-Cr4-nBVI.js";import{_ as Uc,a as Wc,b as Gc,c as Kc,f as qc,g as Jc,o as Yc,v as Xc,x as Zc,y as Qc}from"./documents-events-2g_OBjKU.js";import{t as $c}from"./note-window-mode-CsmLTxU_.js";import{C as el,E as tl,O as nl,T as rl,a as il,b as al,c as ol,d as sl,f as cl,g as ll,h as ul,l as dl,m as fl,n as pl,o as ml,p as hl,r as gl,t as _l,u as vl,v as yl,w as bl,x as xl}from"./terminal-launch-events-rC-SK1H0.js";import{a as Sl,f as Cl,i as wl,l as Tl,m as El,n as Dl,o as Ol,p as kl,r as Al,s as jl,t as Ml,u as Nl}from"./launcher-selection-DTBWt8s2.js";import{a as Pl,i as Fl}from"./use-apply-config-theme-CBmHKD_B.js";import{t as Il}from"./parse-api-error-Dd8VI2eu.js";import{A as Ll,C as Rl,D as zl,E as Bl,M as Vl,O as Hl,S as Ul,T as Wl,_ as Gl,a as Kl,b as ql,c as Jl,d as Yl,f as Xl,g as Zl,h as Ql,i as $l,j as eu,k as tu,m as nu,n as ru,o as iu,p as au,r as ou,s as su,t as cu,u as lu,v as uu,w as du,x as fu,y as pu}from"./AddPropertiesButton-eMa8eBGf.js";import{n as mu,t as hu}from"./workspace-paths-CAsMig07.js";import{n as gu}from"./use-workspace-DRylP9vX.js";import{t as _u}from"./createLucideIcon-BulbvLvN.js";import{t as vu}from"./git-branch-3CSRgL0o.js";import{_ as yu,d as bu,h as xu,l as Su,m as Cu,u as wu}from"./EnableSyncConfirmDialog-DGwynRzU.js";import{c as Tu,d as Eu,l as Du,n as Ou,r as ku,u as Au}from"./Mermaid-B4Oa2diB.js";import{t as ju}from"./arrow-up-right-BTi7mHwL.js";import{_ as Mu,a as Nu,f as Pu,g as Fu,i as Iu,l as Lu,m as Ru,n as zu,t as Bu,v as Vu}from"./PropertyDisplayRow-sm9qwuBw.js";import{t as Hu}from"./case-sensitive-BwklrMJw.js";import{t as Uu}from"./check-Dut4Aov8.js";import{t as Wu}from"./chevron-left-Dhf0Sw0W.js";import{t as Gu}from"./chevron-down-DNO3PgI_.js";import{t as Ku}from"./chevron-right-4mYNnAZZ.js";import{A as qu,C as Ju,E as Yu,H as Xu,I as Zu,L as Qu,M as $u,N as ed,O as td,P as nd,R as rd,U as id,V as ad,W as od,_ as sd,a as cd,b as ld,c as ud,d as dd,f as fd,g as pd,h as md,k as hd,l as gd,n as _d,o as vd,p as yd,r as bd,s as xd,t as Sd,u as Cd,v as wd,w as Td,x as Ed,y as Dd,z as Od}from"./typing-burst-detector-BO09cycJ.js";import{n as kd,t as Ad}from"./lint-plugin-meta-LEBWvINg.js";import{t as jd}from"./circle-alert-b-E0_BIP.js";import{a as Md,i as Nd,n as Pd,o as Fd,r as Id,s as Ld}from"./prop-types-CTZ-Zcfm.js";import{$ as Rd,B as zd,C as Bd,D as Vd,E as Hd,F as Ud,G as eee,H as Wd,I as Gd,J as Kd,K as qd,P as Jd,Q as Yd,T as Xd,U as Zd,V as Qd,X as $d,Y as ef,Z as tf,a as nf,c as rf,et as af,f as of,h as sf,j as cf,n as lf,nt as uf,q as df,r as ff,rt as pf,t as mf,tt as hf,u as gf,w as _f,z as vf}from"./auth-state-cache-DNrEadrI.js";import{n as yf}from"./terminal-D4HSnHXf.js";import{t as bf}from"./eye-7pio2q9G.js";import{a as xf,c as Sf,i as Cf,n as wf,o as Tf,r as Ef,s as Df,t as Of}from"./pending-receive-nav-store-DXWRYoc_.js";import{_ as kf,a as Af,c as jf,d as Mf,f as Nf,g as Pf,h as Ff,i as If,l as Lf,m as Rf,o as zf,p as Bf,s as Vf,u as Hf,v as Uf}from"./ManagedArtifactProperties-DeYta-00.js";import{t as Wf}from"./folder-open-BWpLO6wT.js";import{a as Gf,c as Kf,i as qf,n as Jf,o as Yf,r as Xf,t as Zf}from"./use-open-skill-DzG96lKz.js";import{i as Qf,n as $f}from"./folder-config-api-DhiWnWlS.js";import{t as ep}from"./hash-3VQG5UJ7.js";import{n as tp,t as np}from"./target-navigation-intent-D6pgYTG-.js";import{t as rp}from"./info-SlzbpjOb.js";import{t as ip}from"./spinner-t7GahFcQ.js";import{o as ap,r as op,t as sp}from"./bug-report-send-manager-5nrn8Psu.js";import{n as cp,t as lp}from"./miss-dialog-store-DVpIaq34.js";import{_ as up,a as dp,b as fp,c as pp,d as mp,f as hp,g as gp,i as _p,l as vp,m as yp,n as bp,o as xp,p as Sp,r as Cp,s as wp,t as Tp,u as Ep,v as Dp,y as Op}from"./comment-chips-mYvhrkxj.js";import{n as kp,t as Ap}from"./package-Bo0V5xFD.js";import{n as jp,t as Mp}from"./panel-right-open-2VYfauQI.js";import{t as Np}from"./paperclip-CrupYCX8.js";import{t as Pp}from"./refresh-cw-BFSYd-XR.js";import{t as Fp}from"./square-pen-CBGVrQUa.js";import{t as Ip}from"./trash-2-DSqYvaPJ.js";import{t as Lp}from"./triangle-alert-GeclLtDN.js";import{t as Rp}from"./undo-2-XcI_wHcs.js";import{t as zp}from"./x-DbShSCr5.js";import{C as Bp,S as Vp,_ as Hp,a as Up,b as Wp,c as Gp,d as Kp,f as qp,g as Jp,h as Yp,i as Xp,m as Zp,p as Qp,s as $p,u as em,v as tm,w as nm,x as rm,y as im}from"./doc-paths-BkNaaTOB.js";import{a as am,i as om,o as sm,s as cm}from"./startup-marks-CUyZjhyC.js";import{c as lm,d as um,f as dm,l as fm,m as pm,o as mm,p as hm,s as gm,u as _m}from"./page-list-cache-AR7XhC2q.js";import{a as vm,c as ym,d as bm,i as xm,l as Sm,n as Cm,o as wm,s as Tm,u as Em}from"./file-tree-utils-Cy2QEG_5.js";import{c as Dm,f as Om,i as km,n as Am,o as jm,r as Mm,t as Nm}from"./config-provider-DWieljqa.js";import{i as Pm,r as Fm,t as Im}from"./use-collab-url-DHOOSaDb.js";import{M as Lm,_ as Rm,b as zm,d as Bm,f as Vm,g as Hm,h as Um,i as Wm,k as Gm,l as Km,n as qm,o as Jm,u as Ym,v as Xm,x as Zm}from"./skills-api-KE9J-94z.js";import{a as Qm,c as $m,d as eh,f as th,l as nh,o as rh,p as ih,s as ah,t as oh,u as sh}from"./skill-scope-CauFSzAn.js";import{n as ch,t as lh}from"./client-version-DewpIoVp.js";import{t as uh}from"./documents-fetch-UmC9duIp.js";import{t as dh}from"./input-DJ1c1x-M.js";import{a as fh,i as ph,n as mh,t as hh}from"./popover-BE6X9rKr.js";import"./i18n-CpxzRV_v.js";import{n as gh,t as _h}from"./external-link-B0bVg1hn.js";import{t as vh}from"./asset-dispatch-KsnhYIM1.js";import{n as yh,r as bh,t as xh}from"./file-tree-rename-validation-B5TvPsC_.js";import{t as Sh}from"./badge-BWfmbBoh.js";import{a as Ch,i as wh,n as Th,o as Eh,r as Dh,s as Oh}from"./project-paths-BmMTa57i.js";import{a as kh,n as Ah,o as jh,r as Mh,s as Nh,t as Ph}from"./field-Di3yPBdO.js";import{t as Fh}from"./use-skills-RpG-BeVz.js";import{i as Ih,n as Lh,r as Rh,t as zh}from"./auth-prompt-store-3WR-Jv7J.js";import{c as Bh,i as Vh,l as Hh,n as Uh,r as Wh,s as Gh,t as Kh}from"./selection-context-BcWEVrAI.js";import{a as qh,c as Jh,i as Yh,n as Xh,o as Zh,r as Qh,s as $h,t as eg}from"./panel-DNPki55m.js";import{t as tg}from"./skeleton-BZIHOzZH.js";import{c as ng,i as rg,l as ig,r as ag}from"./lint-config-client-CQNYXMfG.js";import{a as og,o as sg,t as cg}from"./agent-diff-store-DgFkR0kV.js";import{n as lg,r as ug,t as dg}from"./timeline-diff-store-ym5Oz1UF.js";import{a as fg,c as pg,i as mg,n as hg,o as gg,r as _g,s as vg,t as yg}from"./EditorModeToggle-jAYPDv4d.js";import{a as bg,c as xg,d as Sg,g as Cg,h as wg,i as Tg,m as Eg,n as Dg,p as Og,r as kg,s as Ag,t as jg,u as Mg}from"./sortable.esm-DK-jMveF.js";import{t as Ng}from"./textarea-BoMa_3jF.js";import{t as Pg}from"./SkillCostValue-DLUxO68c.js";import{t as Fg}from"./SkillModeBanner-Cfij5biF.js";import{n as Ig,t as Lg}from"./DiffView-DS16M3wC.js";import{n as Rg,r as zg}from"./platform-labels-DWuGftrI.js";import{t as Bg}from"./use-skill-origin-uUY8unvE.js";import{n as Vg,r as Hg,t as Ug}from"./input-group-eVl8FXAc.js";import{A as Wg,C as Gg,D as Kg,E as qg,O as Jg,S as Yg,T as Xg,_ as Zg,a as Qg,b as $g,c as e_,d as t_,f as n_,g as r_,h as i_,i as a_,j as o_,k as s_,l as c_,m as l_,n as u_,o as d_,p as f_,r as p_,s as m_,t as h_,u as g_,v as __,w as v_,x as y_,y as b_}from"./file-tree-adapter-Q4uvZiQM.js";import{t as x_}from"./use-live-xterm-theme-_zomIp7z.js";import{t as S_}from"./app-menubar-gate-q1nJIutw.js";import{n as C_,r as w_}from"./agent-presence-3JajMNAq.js";import{a as T_,c as E_,d as D_,f as O_,i as k_,l as A_,m as j_,n as M_,o as N_,s as P_,t as F_,u as I_}from"./form-Bz-LEGU-.js";import{n as L_}from"./terminal-command-events-D0gJ8NJs.js";import{n as R_,r as z_,t as B_}from"./ok-CtJ8JyHz.js";import{a as V_,t as H_}from"./receive-store-RexqPtVU.js";function U_(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.64.0`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-BQYAUKok.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)}var tee=class extends Un{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||W_(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=$n({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}})(this.state),Wn.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function W_(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var G_=class extends or{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new tee({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=K_(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=K_(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=K_(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=K_(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Wn.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Kn(t,e))}findAll(e={}){return this.getAll().filter(t=>Kn(e,t))}notify(e){Wn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Wn.batch(()=>Promise.all(e.map(e=>e.continue().catch(Zn))))}};function K_(e){return e.options.scope?.id}var q_=class extends or{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??Gn(r,t),a=this.get(i);return a||(a=new Yn({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Wn.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>er(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>er(e,t)):t}notify(e){Wn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Wn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Wn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},J_=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new q_,this.#t=e.mutationCache||new G_,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=ar.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=nr.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(qn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Xn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Wn.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;Wn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Wn.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=Wn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Zn).catch(Zn)}invalidateQueries(e,t={}){return Wn.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=Wn.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(Zn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Zn)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(qn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Zn).catch(Zn)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Zn).catch(Zn)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return nr.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(ir(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Jn(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(ir(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Jn(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Gn(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Hn&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Z=r(),Q=e(zn(),1),Y_=t(),$=ur(),X_=`button, a[href], input, textarea, select, [contenteditable="true"], [role="button"], [role="menuitem"]`;function Z_(){if(typeof document>`u`)return!1;let e=document.activeElement;return!e||e===document.body?!1:e instanceof Element&&e.matches(X_)}function Q_(e={}){return Mr()?!1:e.allowWhileFocused?!0:!Z_()}var $_=e(lr(),1),ev=`ok-blob-mascot`;function tv(e){if(typeof document>`u`){e();return}let t=document.startViewTransition,n=typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;if(typeof t!=`function`||n){e();return}t.call(document,()=>{(0,$_.flushSync)(e)})}var nv=64*.055,rv=.1875,iv=2400,av=310;av**2/(2*iv);var ov=580**2/(2*iv),sv=2*580/iv,cv=.09,lv=sv+.1,uv=.5,dv=1.3,fv=3200,pv=14,mv=sv*2.4,hv=sv*1.35,gv=.9,_v=.3,vv=14e3;function yv(e,t,n){return e+(t-e)*n}function bv(e){return Math.min(1,Math.max(0,e/vv))}function xv(e){return yv(mv,hv,bv(e))}function Sv(e){return e<=Pv?0:yv(Mv,Nv,bv(e))}var Cv=38,wv=52,Tv=12,Ev=20,Dv=34,Ov=14,kv=18,Av=22,jv=30,Mv=.15,Nv=.45,Pv=900,Fv=240,Iv=.05,Lv=1/120,Rv=12;function zv(){return{phase:`idle`,y:0,vy:0,dwell:0,jumpBuffer:0,jumping:!1,ducking:!1,speed:260,distance:0,obstacles:[],spawnCountdown:260*xv(0),nextObstacleId:0}}function Bv(e){Object.assign(e,zv(),{phase:`running`})}function Vv(e){return e.phase===`running`?e.jumping?(e.jumpBuffer=lv,!1):(e.vy=580,e.dwell=0,e.jumpBuffer=0,e.jumping=!0,!0):!1}function Hv(e,t){e.phase===`running`&&(e.ducking=t)}function Uv(e){return e.ducking&&e.y===0}function Wv(e){return Math.floor(e.distance/Rv)}function Gv(e){if(Uv(e))return{scaleX:dv,scaleY:uv};if(e.y===0&&e.dwell>0){let t=.28*(1-(1-e.dwell/cv));return{scaleX:1+t*.8,scaleY:1-t}}let t=.22*Math.min(Math.abs(e.vy)/580,1);return{scaleX:1-t*.7,scaleY:1+t}}function Kv(e){let t=Uv(e),n=64*(t?dv:1),r=64*(t?uv:1),i=n*rv,a=r*rv,o=28-(n-64)/2;return{left:o+i,right:o+n-i,bottom:e.y+a,top:e.y+r-a}}function qv(e,t){let n=Kv(e);return n.left<t.x+t.width&&n.right>t.x&&n.bottom<t.y+t.height&&n.top>t.y}function Jv(e,t,n){let r=n()<Sv(e.distance),[i,a,o,s,c]=r?[Av,jv,Ov,kv,Dv]:[Tv,Ev,Cv,wv,0];e.obstacles.push({id:e.nextObstacleId,kind:r?`overhead`:`ground`,x:t,y:c,width:i+n()*(a-i),height:o+n()*(s-o)}),e.nextObstacleId+=1;let l=yv(gv,_v,bv(e.distance));e.spawnCountdown=e.speed*(xv(e.distance)+n()*l)}function Yv(e,t,n,r){if(e.jumpBuffer=Math.max(0,e.jumpBuffer-t),e.y>0||e.vy>0){let n=e.ducking?iv+fv:iv;e.vy-=n*t,e.y+=e.vy*t,e.y<=0&&(e.y=0,e.vy=0,e.jumping=!1,e.jumpBuffer>0?(e.vy=580,e.jumpBuffer=0,e.jumping=!0):e.dwell=cv)}else e.ducking?e.dwell=0:(e.dwell-=t,e.dwell<=0&&(e.dwell=0,e.vy=av));e.speed=Math.min(620,e.speed+pv*t);let i=e.speed*t;e.distance+=i;for(let t of e.obstacles)t.x-=i;e.obstacles=e.obstacles.filter(e=>e.x+e.width>0),e.spawnCountdown-=i,e.spawnCountdown<=0&&Jv(e,n,r);for(let t of e.obstacles)if(qv(e,t)){e.phase=`over`;return}}function Xv(e,t,n,r=Math.random){if(e.phase!==`running`)return e;let i=Math.max(n,Fv),a=Math.min(Math.max(t,0),Iv);for(;a>0;){let t=Math.min(a,Lv);if(a-=t,Yv(e,t,i,r),e.phase!==`running`)break}return e}var Zv=`ok-blob-runner-best`;function Qv(){try{return typeof localStorage>`u`?null:localStorage}catch{return null}}function $v(e=Qv()){if(!e)return 0;try{let t=Number(e.getItem(Zv));return Number.isFinite(t)&&t>0?Math.floor(t):0}catch{return 0}}function ey(e,t=Qv()){if(!(!t||!Number.isFinite(e)||e<=0))try{t.setItem(Zv,String(Math.floor(e)))}catch{}}function ty(e,t,n){let r=n?.windowMs??4e3;return e<=0||t>=r?1:e+1}var ny=Math.ceil(ov+64+8),ry=Array.from({length:24},(e,t)=>`obstacle-slot-${t}`),iy=300,ay=4,oy=.45;function sy(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(en,{className:`h-4 min-w-4 px-1.5 align-middle text-[10px]`,children:n}),t[0]=n,t[1]=r),r}function cy(e){let t=(0,$.c)(48),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{autoStart:r}=n,i=r===void 0?!1:r,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=zv(),t[2]=a):a=t[2];let o=(0,Q.useRef)(a),s=(0,Q.useRef)(null),c=(0,Q.useRef)(null),l=(0,Q.useRef)(null),u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],t[3]=u):u=t[3];let d=(0,Q.useRef)(u),[f,p]=(0,Q.useState)(`idle`),[m,h]=(0,Q.useState)(0),[g,_]=(0,Q.useState)(dy),v=(0,Q.useRef)(g),[y,b]=(0,Q.useState)(0),[x,S]=(0,Q.useState)(!1),[C]=(0,Q.useState)(uy),w,T;t[4]!==i||t[5]!==C?(w=()=>{if(!i||C)return;let e=setTimeout(()=>{Bv(o.current),p(`running`)},iy);return()=>clearTimeout(e)},T=[i,C],t[4]=i,t[5]=C,t[6]=w,t[7]=T):(w=t[6],T=t[7]),(0,Q.useEffect)(w,T);let E,D;t[8]===f?(E=t[9],D=t[10]):(E=()=>{if(f!==`running`)return;let e=0,t=performance.now(),n=function(){let e=o.current;if(c.current){let{scaleX:t,scaleY:n}=Gv(e);c.current.style.transform=`translateY(${nv-e.y}px) scale(${t.toFixed(4)}, ${n.toFixed(4)})`}for(let t=0;t<24;t++){let n=d.current[t];if(!n)continue;let r=e.obstacles[t];if(!r){n.style.opacity=`0`;continue}n.style.opacity=`1`,n.style.width=`${r.width}px`,n.style.height=`${r.height}px`,n.style.bottom=`${r.y}px`,n.style.borderRadius=r.kind===`overhead`?`9999px`:`3px`,n.style.transform=`translateX(${r.x}px)`}l.current&&(l.current.textContent=String(Wv(e)).padStart(ay,`0`))};function r(i){let a=o.current;if(Xv(a,(i-t)/1e3,s.current?.clientWidth??0),t=i,n(),a.phase===`over`){let e=Wv(a),t=e>v.current;h(e),t&&(v.current=e,ey(e),_(e),S(!0),b(ly)),p(`over`);return}e=requestAnimationFrame(r)}return e=requestAnimationFrame(r),()=>cancelAnimationFrame(e)},D=[f],t[8]=f,t[9]=E,t[10]=D),(0,Q.useEffect)(E,D);let O,k;t[11]===C?(O=t[12],k=t[13]):(k=()=>{if(C)return;let e=function(){Bv(o.current),S(!1),p(`running`)},t=function(t){let n=o.current;if(t.key===`ArrowDown`){if(!Q_({allowWhileFocused:!0}))return;t.preventDefault(),Hv(n,!0);return}t.key!==` `&&t.key!==`ArrowUp`||Q_({allowWhileFocused:t.key===`ArrowUp`})&&(t.preventDefault(),n.phase===`running`?Vv(n):e())},n=function(e){e.key===`ArrowDown`&&Hv(o.current,!1)};return window.addEventListener(`keydown`,t),window.addEventListener(`keyup`,n),()=>{window.removeEventListener(`keydown`,t),window.removeEventListener(`keyup`,n)}},O=[C],t[11]=C,t[12]=O,t[13]=k),(0,Q.useEffect)(k,O);let A;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){Z_()&&document.activeElement.blur();let t=o.current;if(t.phase!==`running`){Bv(t),S(!1),p(`running`);return}let n=e.currentTarget.getBoundingClientRect();if(e.clientY-n.top>n.height*(1-oy)){Hv(t,!0),e.currentTarget.setPointerCapture?.(e.pointerId);return}Vv(t)},t[14]=A):A=t[14];let j=A,M;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=function(){Hv(o.current,!1)},t[15]=M):M=t[15];let N=M;if(C){let e;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(kr,{size:64,variant:`sleeping`}),t[16]=e):e=t[16],e}let P=f!==`running`&&!x,F;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(F={height:ny},t[17]=F):F=t[17];let I;t[18]===i?I=t[19]:(I={left:28,transform:`translateY(${nv}px)`,...i?{viewTransitionName:ev}:{}},t[18]=i,t[19]=I);let L=P?`sleeping`:`default`,R;t[20]!==y||t[21]!==L?(R=(0,Z.jsx)(kr,{size:64,trackMouse:!1,variant:L,celebrateSignal:y}),t[20]=y,t[21]=L,t[22]=R):R=t[22];let z;t[23]!==I||t[24]!==R?(z=(0,Z.jsx)(`div`,{ref:c,className:`absolute bottom-0 flex origin-bottom will-change-transform`,style:I,children:R}),t[23]=I,t[24]=R,t[25]=z):z=t[25];let B;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(B=ry.map((e,t)=>(0,Z.jsx)(`div`,{"data-slot":`ok-blob-runner-obstacle`,ref:e=>{d.current[t]=e},className:`absolute bottom-0 left-0 rounded-sm bg-muted-foreground/70 will-change-transform`,style:{opacity:0}},e)),t[26]=B):B=t[26];let V;t[27]!==z||t[28]!==B?(V=(0,Z.jsxs)(`div`,{ref:s,"data-slot":`ok-blob-runner-track`,className:`relative w-full cursor-pointer overflow-hidden border-b border-dashed border-border`,style:F,onPointerDown:j,onPointerUp:N,onPointerCancel:N,onPointerLeave:N,children:[z,B]}),t[27]=z,t[28]=B,t[29]=V):V=t[29];let ee;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(ee={left:28},t[30]=ee):ee=t[30];let H;t[31]!==x||t[32]!==g?(H=g>0?(0,Z.jsxs)(`span`,{className:x?`text-muted-foreground`:void 0,children:[(0,Z.jsx)(Y,{id:`9GbR5F`}),` `,String(g).padStart(ay,`0`)]}):null,t[31]=x,t[32]=g,t[33]=H):H=t[33];let U=String(m),W;t[34]===U?W=t[35]:(W=U.padStart(ay,`0`),t[34]=U,t[35]=W);let G;t[36]===W?G=t[37]:(G=(0,Z.jsx)(`span`,{ref:l,children:W}),t[36]=W,t[37]=G);let te;t[38]!==H||t[39]!==G?(te=(0,Z.jsx)(`div`,{className:`relative mt-1.5 h-5`,children:(0,Z.jsxs)(`div`,{"data-slot":`ok-blob-runner-score`,className:`absolute top-0 flex gap-3 font-mono text-xs tabular-nums text-muted-foreground/60`,style:ee,children:[H,G]})}),t[38]=H,t[39]=G,t[40]=te):te=t[40];let ne;t[41]!==x||t[42]!==f?(ne=(0,Z.jsx)(`p`,{"data-slot":`ok-blob-runner-hint`,className:`mt-2 text-center font-mono text-[11px] uppercase tracking-wide text-muted-foreground/60`,children:f===`over`?x?(0,Z.jsx)(Y,{id:`ai40UJ`,components:{0:(0,Z.jsx)(sy,{})}}):(0,Z.jsx)(Y,{id:`uY5Z7P`,components:{0:(0,Z.jsx)(sy,{})}}):f===`running`?(0,Z.jsx)(Y,{id:`pI_bKs`,components:{0:(0,Z.jsx)(sy,{}),1:(0,Z.jsx)(sy,{})}}):(0,Z.jsx)(Y,{id:`7a0YcF`,components:{0:(0,Z.jsx)(sy,{})}})}),t[41]=x,t[42]=f,t[43]=ne):ne=t[43];let re;return t[44]!==V||t[45]!==te||t[46]!==ne?(re=(0,Z.jsxs)(`div`,{"aria-hidden":`true`,"data-slot":`ok-blob-runner`,className:`w-full select-none animate-in fade-in-0 slide-in-from-bottom-2 duration-300 motion-reduce:animate-none`,children:[V,te,ne]}),t[44]=V,t[45]=te,t[46]=ne,t[47]=re):re=t[47],re}function ly(e){return e+1}function uy(){return typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function dy(){return $v()}var fy=80;function py(e){let t=(0,$.c)(9),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{keyboard:r}=n,i=r===void 0?!0:r,[a,o]=(0,Q.useState)(!1),s=(0,Q.useRef)(!1),[c]=(0,Q.useState)(my),l,u;if(t[2]!==i||t[3]!==c?(l=()=>{if(c||!i)return;let e=function(e){s.current||e.key!==` `&&e.key!==`ArrowUp`||Q_({allowWhileFocused:e.key===`ArrowUp`})&&(e.preventDefault(),s.current=!0,tv(()=>o(!0)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},u=[c,i],t[2]=i,t[3]=c,t[4]=l,t[5]=u):(l=t[4],u=t[5]),(0,Q.useEffect)(l,u),a){let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(cy,{autoStart:!0}),t[6]=e):e=t[6],e}if(c){let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(kr,{size:fy,variant:`sleeping`}),t[7]=e):e=t[7],e}let d;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-slot":`ok-blob-runner-easter-egg`,className:`cursor-pointer select-none transition-opacity duration-200`,style:{viewTransitionName:ev},onPointerDown:()=>{Z_()&&document.activeElement.blur(),s.current=!0,tv(()=>o(!0))},children:(0,Z.jsx)(kr,{size:fy,variant:`sleeping`})}),t[8]=d):d=t[8],d}function my(){return typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var hy=new WeakMap;function gy(e,t){typeof e!=`object`||!e||typeof t!=`string`||t.trim()===``||hy.set(e,t)}function _y(e){if(!(typeof e!=`object`||!e))return hy.get(e)}function vy(e){let t=(0,$.c)(24),{error:n,resetErrorBoundary:r}=e,{_:i}=Bn(),[a,o]=(0,Q.useState)(!1),s=(0,Q.useRef)(null),c=typeof window<`u`?window.okDesktop:void 0,l;t[0]!==i||t[1]!==n?(l=n instanceof Error&&n.message?n.message:i({id:`W5A0Ly`}),t[0]=i,t[1]=n,t[2]=l):l=t[2];let u=l,d,f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{s.current?.focus()},f=[],t[3]=d,t[4]=f):(d=t[3],f=t[4]),(0,Q.useEffect)(d,f);let p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(py,{keyboard:!1}),t[5]=p):p=t[5];let m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`h1`,{id:`app-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:(0,Z.jsx)(Y,{id:`nwtY4N`})}),t[6]=m):m=t[6];let h;t[7]===u?h=t[8]:(h=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[m,(0,Z.jsx)(`p`,{className:`max-w-sm text-sm break-words text-muted-foreground`,children:u})]}),t[7]=u,t[8]=h);let g;t[9]===r?g=t[10]:(g=()=>r(),t[9]=r,t[10]=g);let _;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(Y,{id:`KDw4GX`}),t[11]=_):_=t[11];let v;t[12]===g?v=t[13]:(v=(0,Z.jsx)(X,{ref:s,variant:`default`,onClick:g,children:_}),t[12]=g,t[13]=v);let y;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=c?(0,Z.jsx)(X,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>o(!0),children:(0,Z.jsx)(Y,{id:`ii5mVn`})}):null,t[14]=y):y=t[14];let b;t[15]===v?b=t[16]:(b=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[v,y]}),t[15]=v,t[16]=b);let x;t[17]!==n||t[18]!==a?(x=c?(0,Z.jsx)(xy,{children:(0,Z.jsx)(Fr,{open:a,onOpenChange:o,systemWide:c.config.mode===`navigator`,crashContext:{source:`app shell`,errorMessage:n instanceof Error&&n.message?n.message:String(n),componentStack:_y(n)}})}):null,t[17]=n,t[18]=a,t[19]=x):x=t[19];let S;return t[20]!==b||t[21]!==x||t[22]!==h?(S=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`app-error-title`,"data-slot":`app-error-boundary`,className:`flex h-screen flex-col items-center justify-center gap-8 p-8 text-center`,children:[p,h,b,x]}),t[20]=b,t[21]=x,t[22]=h,t[23]=S):S=t[23],S}function yy(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(pr,{FallbackComponent:vy,onError:by,children:n}),t[0]=n,t[1]=r),r}function by(e,t){gy(e,t.componentStack),gt(e),console.error(`[AppErrorBoundary] app-shell render crash`,e,t.componentStack??``)}function xy(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(pr,{fallback:null,onError:Sy,children:n}),t[0]=n,t[1]=r),r}function Sy(e){console.error(`[CrashReportingBoundary] crash-reporting UI render crash`,e)}function Cy(){let e=(0,$.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={queryKey:[`acp-catalog`],queryFn:Ey,staleTime:3e5},e[0]=t):t=e[0];let n=rr(t),r;e[1]===n.data?.agents?r=e[2]:(r=()=>(Xa(eo(n.data?.agents??[]).map(Ty)),wy),e[1]=n.data?.agents,e[2]=r);let i;return e[3]===n.data?i=e[4]:(i=[n.data],e[3]=n.data,e[4]=i),(0,Q.useEffect)(r,i),null}function wy(){return Xa([])}function Ty(e){return{source:e.source,id:e.id,name:e.name,featured:e.featured,...e.iconUrl===void 0?{}:{iconUrl:e.iconUrl}}}function Ey(e){let{signal:t}=e;return Qa(t)}var Dy=_u(`arrow-up-down`,[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]),Oy=_u(`bird`,[[`path`,{d:`M16 7h.01`,key:`1kdx03`}],[`path`,{d:`M3.4 18H12a8 8 0 0 0 8-8V7a4 4 0 0 0-7.28-2.3L2 20`,key:`oj1oa8`}],[`path`,{d:`m20 7 2 .5-2 .5`,key:`12nv4d`}],[`path`,{d:`M10 18v3`,key:`1yea0a`}],[`path`,{d:`M14 17.75V21`,key:`1pymcb`}],[`path`,{d:`M7 18a6 6 0 0 0 3.84-10.61`,key:`1npnn0`}]]),ky=_u(`blocks`,[[`path`,{d:`M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2`,key:`1ah6g2`}],[`rect`,{x:`14`,y:`2`,width:`8`,height:`8`,rx:`1`,key:`88lufb`}]]),Ay=_u(`bold`,[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]),jy=_u(`book-marked`,[[`path`,{d:`M10 2v8l3-3 3 3V2`,key:`sqw3rj`}],[`path`,{d:`M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20`,key:`k3hazp`}]]),My=_u(`cat`,[[`path`,{d:`M12 5c.67 0 1.35.09 2 .26 1.78-2 5.03-2.84 6.42-2.26 1.4.58-.42 7-.42 7 .57 1.07 1 2.24 1 3.44C21 17.9 16.97 21 12 21s-9-3-9-7.56c0-1.25.5-2.4 1-3.44 0 0-1.89-6.42-.5-7 1.39-.58 4.72.23 6.5 2.23A9.04 9.04 0 0 1 12 5Z`,key:`x6xyqk`}],[`path`,{d:`M8 14v.5`,key:`1nzgdb`}],[`path`,{d:`M16 14v.5`,key:`1lajdz`}],[`path`,{d:`M11.25 16.25h1.5L12 17l-.75-.75Z`,key:`12kq1m`}]]),Ny=_u(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),Py=_u(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),Fy=_u(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Iy=_u(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),Ly=_u(`compass`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}]]),Ry=_u(`copy-x`,[[`line`,{x1:`12`,x2:`18`,y1:`12`,y2:`18`,key:`1rg63v`}],[`line`,{x1:`12`,x2:`18`,y1:`18`,y2:`12`,key:`ebkxgr`}],[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),zy=_u(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),By=_u(`dog`,[[`path`,{d:`M11.25 16.25h1.5L12 17z`,key:`w7jh35`}],[`path`,{d:`M16 14v.5`,key:`1lajdz`}],[`path`,{d:`M4.42 11.247A13.152 13.152 0 0 0 4 14.556C4 18.728 7.582 21 12 21s8-2.272 8-6.444a11.702 11.702 0 0 0-.493-3.309`,key:`u7s9ue`}],[`path`,{d:`M8 14v.5`,key:`1nzgdb`}],[`path`,{d:`M8.5 8.5c-.384 1.05-1.083 2.028-2.344 2.5-1.931.722-3.576-.297-3.656-1-.113-.994 1.177-6.53 4-7 1.923-.321 3.651.845 3.651 2.235A7.497 7.497 0 0 1 14 5.277c0-1.39 1.844-2.598 3.767-2.277 2.823.47 4.113 6.006 4 7-.08.703-1.725 1.722-3.656 1-1.261-.472-1.855-1.45-2.239-2.5`,key:`v8hric`}]]),Vy=_u(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Hy=_u(`file-check`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m9 15 2 2 4-4`,key:`1grp1n`}]]),Uy=_u(`file-code-corner`,[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]]),Wy=_u(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Gy=_u(`file-key`,[[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M4 12v6`,key:`bg1pfk`}],[`path`,{d:`M4 14h2`,key:`1sf9f8`}],[`path`,{d:`M9.65 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v4`,key:`d56i0q`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),Ky=_u(`fish`,[[`path`,{d:`M6.5 12c.94-3.46 4.94-6 8.5-6 3.56 0 6.06 2.54 7 6-.94 3.47-3.44 6-7 6s-7.56-2.53-8.5-6Z`,key:`15baut`}],[`path`,{d:`M18 12v.5`,key:`18hhni`}],[`path`,{d:`M16 17.93a9.77 9.77 0 0 1 0-11.86`,key:`16dt7o`}],[`path`,{d:`M7 10.67C7 8 5.58 5.97 2.73 5.5c-1 1.5-1 5 .23 6.5-1.24 1.5-1.24 5-.23 6.5C5.58 18.03 7 16 7 13.33`,key:`l9di03`}],[`path`,{d:`M10.46 7.26C10.2 5.88 9.17 4.24 8 3h5.8a2 2 0 0 1 1.98 1.67l.23 1.4`,key:`1kjonw`}],[`path`,{d:`m16.01 17.93-.23 1.4A2 2 0 0 1 13.8 21H9.5a5.96 5.96 0 0 0 1.49-3.98`,key:`1zlm23`}]]),qy=_u(`fold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3-3-3 3`,key:`e37ymu`}],[`path`,{d:`m15 5-3 3-3-3`,key:`19d6lf`}]]),Jy=_u(`folder-cog`,[[`path`,{d:`M10.3 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.98a2 2 0 0 1 1.69.9l.66 1.2A2 2 0 0 0 12 6h8a2 2 0 0 1 2 2v3.3`,key:`128dxu`}],[`path`,{d:`m14.305 19.53.923-.382`,key:`3m78fa`}],[`path`,{d:`m15.228 16.852-.923-.383`,key:`npixar`}],[`path`,{d:`m16.852 15.228-.383-.923`,key:`5xggr7`}],[`path`,{d:`m16.852 20.772-.383.924`,key:`dpfhf9`}],[`path`,{d:`m19.148 15.228.383-.923`,key:`1reyyz`}],[`path`,{d:`m19.53 21.696-.382-.924`,key:`1goivc`}],[`path`,{d:`m20.772 16.852.924-.383`,key:`htqkph`}],[`path`,{d:`m20.772 19.148.924.383`,key:`9w9pjp`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]),Yy=_u(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Xy=_u(`gamepad-2`,[[`line`,{x1:`6`,x2:`10`,y1:`11`,y2:`11`,key:`1gktln`}],[`line`,{x1:`8`,x2:`8`,y1:`9`,y2:`13`,key:`qnk9ow`}],[`line`,{x1:`15`,x2:`15.01`,y1:`12`,y2:`12`,key:`krot7o`}],[`line`,{x1:`18`,x2:`18.01`,y1:`10`,y2:`10`,key:`1lcuu1`}],[`path`,{d:`M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z`,key:`mfqc10`}]]),Zy=_u(`grid-2x2-x`,[[`path`,{d:`M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3`,key:`11za1p`}],[`path`,{d:`m16 16 5 5`,key:`8tpb07`}],[`path`,{d:`m16 21 5-5`,key:`193jll`}]]),Qy=_u(`hard-drive`,[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]),$y=_u(`highlighter`,[[`path`,{d:`m9 11-6 6v3h9l3-3`,key:`1a3l36`}],[`path`,{d:`m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4`,key:`14a9rk`}]]),eb=_u(`italic`,[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]),tb=_u(`library-big`,[[`rect`,{width:`8`,height:`18`,x:`3`,y:`3`,rx:`1`,key:`oynpb5`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M20.4 18.9c.2.5-.1 1.1-.6 1.3l-1.9.7c-.5.2-1.1-.1-1.3-.6L11.1 5.1c-.2-.5.1-1.1.6-1.3l1.9-.7c.5-.2 1.1.1 1.3.6Z`,key:`1qboyk`}]]),nb=_u(`library`,[[`path`,{d:`m16 6 4 14`,key:`ji33uf`}],[`path`,{d:`M12 6v14`,key:`1n7gus`}],[`path`,{d:`M8 8v12`,key:`1gg7y9`}],[`path`,{d:`M4 4v16`,key:`6qkkli`}]]),rb=_u(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),ib=_u(`list-collapse`,[[`path`,{d:`M10 5h11`,key:`1hkqpe`}],[`path`,{d:`M10 12h11`,key:`6m4ad9`}],[`path`,{d:`M10 19h11`,key:`14g2nv`}],[`path`,{d:`m3 10 3-3-3-3`,key:`i7pm08`}],[`path`,{d:`m3 20 3-3-3-3`,key:`20gx1n`}]]),ab=_u(`list-tree`,[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]),ob=_u(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),sb=_u(`megaphone`,[[`path`,{d:`M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z`,key:`q8bfy3`}],[`path`,{d:`M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14`,key:`1853fq`}],[`path`,{d:`M8 6v8`,key:`15ugcq`}]]),cb=_u(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),lb=_u(`octagon-x`,[[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),ub=_u(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),db=_u(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),fb=_u(`pilcrow`,[[`path`,{d:`M13 4v16`,key:`8vvj80`}],[`path`,{d:`M17 4v16`,key:`7dpous`}],[`path`,{d:`M19 4H9.5a4.5 4.5 0 0 0 0 9H13`,key:`sh4n9v`}]]),pb=_u(`pin-off`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),mb=_u(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),hb=_u(`puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),gb=_u(`rabbit`,[[`path`,{d:`M13 16a3 3 0 0 1 2.24 5`,key:`1epib5`}],[`path`,{d:`M18 12h.01`,key:`yjnet6`}],[`path`,{d:`M18 21h-8a4 4 0 0 1-4-4 7 7 0 0 1 7-7h.2L9.6 6.4a1 1 0 1 1 2.8-2.8L15.8 7h.2c3.3 0 6 2.7 6 6v1a2 2 0 0 1-2 2h-1a3 3 0 0 0-3 3`,key:`ue9ozu`}],[`path`,{d:`M20 8.54V4a2 2 0 1 0-4 0v3`,key:`49iql8`}],[`path`,{d:`M7.612 12.524a3 3 0 1 0-1.6 4.3`,key:`1e33i0`}]]),_b=_u(`rat`,[[`path`,{d:`M13 22H4a2 2 0 0 1 0-4h12`,key:`bt3f23`}],[`path`,{d:`M13.236 18a3 3 0 0 0-2.2-5`,key:`1tbvmo`}],[`path`,{d:`M16 9h.01`,key:`1bdo4e`}],[`path`,{d:`M16.82 3.94a3 3 0 1 1 3.237 4.868l1.815 2.587a1.5 1.5 0 0 1-1.5 2.1l-2.872-.453a3 3 0 0 0-3.5 3`,key:`9ch7kn`}],[`path`,{d:`M17 4.988a3 3 0 1 0-5.2 2.052A7 7 0 0 0 4 14.015 4 4 0 0 0 8 18`,key:`3s7e9i`}]]),vb=_u(`replace-all`,[[`path`,{d:`M14 14a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1`,key:`zg1ipl`}],[`path`,{d:`M14 4a1 1 0 0 1 1-1`,key:`dhj8ez`}],[`path`,{d:`M15 10a1 1 0 0 1-1-1`,key:`1mnyi5`}],[`path`,{d:`M19 14a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1`,key:`txt6k4`}],[`path`,{d:`M21 4a1 1 0 0 0-1-1`,key:`sfs9ap`}],[`path`,{d:`M21 9a1 1 0 0 1-1 1`,key:`mp6qeo`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a2 2 0 0 1 2-2h2`,key:`15xut4`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}]]),yb=_u(`replace`,[[`path`,{d:`M14 4a1 1 0 0 1 1-1`,key:`dhj8ez`}],[`path`,{d:`M15 10a1 1 0 0 1-1-1`,key:`1mnyi5`}],[`path`,{d:`M21 4a1 1 0 0 0-1-1`,key:`sfs9ap`}],[`path`,{d:`M21 9a1 1 0 0 1-1 1`,key:`mp6qeo`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a2 2 0 0 1 2-2h2`,key:`15xut4`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}]]),bb=_u(`shrimp`,[[`path`,{d:`M11 12h.01`,key:`1lr4k6`}],[`path`,{d:`M13 22c.5-.5 1.12-1 2.5-1-1.38 0-2-.5-2.5-1`,key:`fatpdi`}],[`path`,{d:`M14 2a3.28 3.28 0 0 1-3.227 1.798l-6.17-.561A2.387 2.387 0 1 0 4.387 8H15.5a1 1 0 0 1 0 13 1 1 0 0 0 0-5H12a7 7 0 0 1-7-7V8`,key:`kehrqe`}],[`path`,{d:`M14 8a8.5 8.5 0 0 1 0 8`,key:`1imjx2`}],[`path`,{d:`M16 16c2 0 4.5-4 4-6`,key:`z0nejz`}]]),xb=_u(`snail`,[[`path`,{d:`M2 13a6 6 0 1 0 12 0 4 4 0 1 0-8 0 2 2 0 0 0 4 0`,key:`hneq2s`}],[`circle`,{cx:`10`,cy:`13`,r:`8`,key:`194lz3`}],[`path`,{d:`M2 21h12c4.4 0 8-3.6 8-8V7a2 2 0 1 0-4 0v6`,key:`ixqyt7`}],[`path`,{d:`M18 3 19.1 5.2`,key:`9tjm43`}],[`path`,{d:`M22 3 20.9 5.2`,key:`j3odrs`}]]),Sb=_u(`spell-check`,[[`path`,{d:`m6 16 6-12 6 12`,key:`1b4byz`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`m16 20 2 2 4-4`,key:`13tcca`}]]),Cb=_u(`square-arrow-out-up-right`,[[`path`,{d:`M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6`,key:`y09zxi`}],[`path`,{d:`m21 3-9 9`,key:`mpx6sq`}],[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}]]),wb=_u(`square-code`,[[`path`,{d:`m10 9-3 3 3 3`,key:`1oro0q`}],[`path`,{d:`m14 15 3-3-3-3`,key:`bz13h7`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),Tb=_u(`squirrel`,[[`path`,{d:`M15.236 22a3 3 0 0 0-2.2-5`,key:`21bitc`}],[`path`,{d:`M16 20a3 3 0 0 1 3-3h1a2 2 0 0 0 2-2v-2a4 4 0 0 0-4-4V4`,key:`oh0fg0`}],[`path`,{d:`M18 13h.01`,key:`9veqaj`}],[`path`,{d:`M18 6a4 4 0 0 0-4 4 7 7 0 0 0-7 7c0-5 4-5 4-10.5a4.5 4.5 0 1 0-9 0 2.5 2.5 0 0 0 5 0C7 10 3 11 3 17c0 2.8 2.2 5 5 5h10`,key:`980v8a`}]]),Eb=_u(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),Db=_u(`sticky-note`,[[`path`,{d:`M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z`,key:`1dfntj`}],[`path`,{d:`M15 3v5a1 1 0 0 0 1 1h5`,key:`6s6qgf`}]]),Ob=_u(`strikethrough`,[[`path`,{d:`M16 4H9a3 3 0 0 0-2.83 4`,key:`43sutm`}],[`path`,{d:`M14 12a4 4 0 0 1 0 8H6`,key:`nlfj13`}],[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}]]),kb=_u(`table-properties`,[[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]]),Ab=_u(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),jb=_u(`telescope`,[[`path`,{d:`m10.065 12.493-6.18 1.318a.934.934 0 0 1-1.108-.702l-.537-2.15a1.07 1.07 0 0 1 .691-1.265l13.504-4.44`,key:`k4qptu`}],[`path`,{d:`m13.56 11.747 4.332-.924`,key:`19l80z`}],[`path`,{d:`m16 21-3.105-6.21`,key:`7oh9d`}],[`path`,{d:`M16.485 5.94a2 2 0 0 1 1.455-2.425l1.09-.272a1 1 0 0 1 1.212.727l1.515 6.06a1 1 0 0 1-.727 1.213l-1.09.272a2 2 0 0 1-2.425-1.455z`,key:`m7xp4m`}],[`path`,{d:`m6.158 8.633 1.114 4.456`,key:`74o979`}],[`path`,{d:`m8 21 3.105-6.21`,key:`1fvxut`}],[`circle`,{cx:`12`,cy:`13`,r:`2`,key:`1c1ljs`}]]),Mb=_u(`text-align-center`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M17 12H7`,key:`16if0g`}],[`path`,{d:`M19 19H5`,key:`vjpgq2`}]]),Nb=_u(`text-align-end`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M21 19H7`,key:`4cu937`}]]),Pb=_u(`text-align-start`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]]),Fb=_u(`text-quote`,[[`path`,{d:`M17 5H3`,key:`1cn7zz`}],[`path`,{d:`M21 12H8`,key:`scolzb`}],[`path`,{d:`M21 19H8`,key:`13qgcb`}],[`path`,{d:`M3 12v7`,key:`1ri8j3`}]]),Ib=_u(`thumbs-down`,[[`path`,{d:`M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z`,key:`m61m77`}],[`path`,{d:`M17 14V2`,key:`8ymqnk`}]]),Lb=_u(`thumbs-up`,[[`path`,{d:`M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z`,key:`emmmcr`}],[`path`,{d:`M7 10v12`,key:`1qc93n`}]]),Rb=_u(`turtle`,[[`path`,{d:`m12 10 2 4v3a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-3a8 8 0 1 0-16 0v3a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-3l2-4h4Z`,key:`1lbbv7`}],[`path`,{d:`M4.82 7.9 8 10`,key:`m9wose`}],[`path`,{d:`M15.18 7.9 12 10`,key:`p8dp2u`}],[`path`,{d:`M16.93 10H20a2 2 0 0 1 0 4H2`,key:`12nsm7`}]]),zb=_u(`underline`,[[`path`,{d:`M6 4v6a6 6 0 0 0 12 0V4`,key:`9kb039`}],[`line`,{x1:`4`,x2:`20`,y1:`20`,y2:`20`,key:`nun2al`}]]),Bb=_u(`unfold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3 3-3-3`,key:`11eu04`}],[`path`,{d:`m15 5-3-3-3 3`,key:`itvq4r`}]]),Vb=_u(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),Hb=_u(`whole-word`,[[`circle`,{cx:`7`,cy:`12`,r:`3`,key:`12clwm`}],[`path`,{d:`M10 9v6`,key:`17i7lo`}],[`circle`,{cx:`17`,cy:`12`,r:`3`,key:`gl7c2s`}],[`path`,{d:`M14 7v8`,key:`dl84cr`}],[`path`,{d:`M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1`,key:`lt2kga`}]]);function Ub(e){return bp(e.map(xp),``)}function Wb(){let e=(0,$.c)(9),t=gu(),n=Wa(),r=Ua(),i=Za(),a;if(e[0]!==i||e[1]!==n||e[2]!==r){let t;e[4]===n?t=e[5]:(t=e=>Ha(n,e.source,e.id,!0,e.supported),e[4]=n,e[5]=t),a=Ga(r.filter(t),i),e[0]=i,e[1]=n,e[2]=r,e[3]=a}else a=e[3];let o=a,s;return e[6]!==o||e[7]!==t?(s=async e=>{let n=e.map(Kb);if(n.length===0)return!1;let r=ql({docName:null,workspace:t,instruction:Ub(n),mentions:[...new Set(n.map(Gb))]});return r===null?(Dc.error(Hc._({id:`3V94ia`})),!1):o===null?(Dc.info(Hc._({id:`8YymuQ`})),jc(),!1):(tu(r,{agent:{source:o.source,id:o.id}}),!0)},e[6]=o,e[7]=t,e[8]=s):s=e[8],s}function Gb(e){return hu(e.docName)}function Kb(e){return e.payload}function qb(){let e=(0,$.c)(3),t=Wb(),n=nl(),r=n?.kind===`thread`?n:null,i;return e[0]!==t||e[1]!==r?(i=e=>{if(r===null){l({compose:t,threadIds:e});return}El(e)},e[0]=t,e[1]=r,e[2]=i):i=e[2],i}var Jb=null;function Yb(e){Jb=e}function Xb(){return Jb}function Zb(){let e=(0,$.c)(3),t=qb(),n,r;return e[0]===t?(n=e[1],r=e[2]):(n=()=>{let e=function(e){if(!Mc(e,`send-comment-queue`)||Mr())return;let n=Xb();if(n===null)return;let r=n.scope===`doc`?he(n.docName):G();r.length!==0&&(e.preventDefault(),t(r))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},r=[t],e[0]=t,e[1]=n,e[2]=r),(0,Q.useEffect)(n,r),null}function Qb(){let e=(0,$.c)(21),{contentRecycleNotice:t,dismissContentRecycleNotice:n}=Et(),[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(!1),s=typeof window<`u`?window.okDesktop:void 0,c,l;e[0]===t?(c=e[1],l=e[2]):(c=()=>{if(o(!1),t?.kind!==`branch-switch`)return;let e=Math.max(0,t.at+ve-Date.now()),n=setTimeout(()=>o(!0),e);return()=>clearTimeout(n)},l=[t],e[0]=t,e[1]=c,e[2]=l),(0,Q.useEffect)(c,l);let u=g(t,a);if(u===`hidden`)return null;if(u===`switch`){let n=t?.kind===`branch-switch`?t.branch:``,r;e[3]===n?r=e[4]:(r={branch:n},e[3]=n,e[4]=r);let i;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(i={0:(0,Z.jsx)(`code`,{className:`bg-amber-100/60 px-1 rounded`})},e[5]=i):i=e[5];let a;return e[6]===r?a=e[7]:(a=(0,Z.jsx)(`div`,{role:`status`,"data-testid":`branch-recycle-banner-switch`,className:`fixed top-0 inset-x-0 z-50 bg-amber-500/95 text-amber-950 text-sm text-center py-2 px-4 ps-[var(--ok-titlebar-reserve-left,1rem)] shadow-md`,children:(0,Z.jsx)(Y,{id:`vVQlxV`,values:r,components:i})}),e[6]=r,e[7]=a),a}let d;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=async()=>{if(s){i(!0);try{(await uf(s)).ok||i(!1)}catch{i(!1)}}},e[8]=d):d=e[8];let f=d,p;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`F-1xhe`})}),e[9]=p):p=e[9];let m;e[10]===r?m=e[11]:(m=s?(0,Z.jsx)(X,{size:`sm`,onClick:f,disabled:r,className:`h-6 bg-red-950 text-red-50 px-2 text-xs font-medium hover:bg-red-900`,children:r?(0,Z.jsx)(Y,{id:`0Er6-M`}):(0,Z.jsx)(Y,{id:`uaUc6t`})}):null,e[10]=r,e[11]=m);let h;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(X,{size:`sm`,onClick:$b,className:`h-6 bg-red-950 text-red-50 px-2 text-xs font-medium hover:bg-red-900`,children:(0,Z.jsx)(Y,{id:`HpK_8d`})}),e[12]=h):h=e[12];let _;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(_=Hc._({id:`1QfxQT`}),e[13]=_):_=e[13];let v;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(Y,{id:`1QfxQT`}),e[14]=v):v=e[14];let y;e[15]!==n||e[16]!==_?(y=(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,onClick:n,"aria-label":_,className:`h-6 px-2 text-xs text-red-950 hover:bg-red-400/40`,children:v}),e[15]=n,e[16]=_,e[17]=y):y=e[17];let b;return e[18]!==m||e[19]!==y?(b=(0,Z.jsxs)(`div`,{role:`alert`,"data-testid":`branch-recycle-banner-refused`,className:`fixed top-0 inset-x-0 z-50 bg-red-500/95 text-red-950 text-sm text-center py-2 px-4 ps-[var(--ok-titlebar-reserve-left,1rem)] shadow-md flex items-center justify-center gap-3 flex-wrap`,children:[p,m,h,y]}),e[18]=m,e[19]=y,e[20]=b):b=e[20],b}function $b(){return window.location.reload()}function ex(e){return e.split(`/`).pop()??e}function tx(e){let t=(0,$.c)(7),{rowCount:n}=e,{_:r}=Bn(),i;t[0]===r?i=t[1]:(i=r({id:`--T3kB`}),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=(0,Z.jsx)(`ul`,{className:`space-y-2`,children:Array.from({length:n},rx).map(nx)}),t[2]=n,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Z.jsx)(`section`,{role:`status`,"aria-busy":`true`,"aria-label":i,children:a}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function nx(e){return(0,Z.jsxs)(`li`,{"aria-hidden":`true`,className:`flex items-center gap-3`,children:[(0,Z.jsx)(`div`,{className:`size-8 shrink-0 animate-pulse rounded-lg bg-muted`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 py-0.5`,children:[(0,Z.jsx)(`span`,{className:`block h-3.5 w-28 animate-pulse rounded bg-muted`}),(0,Z.jsx)(`span`,{className:`mt-2 block h-3 w-4/5 animate-pulse rounded bg-muted`})]})]},`seed-skeleton-${e}`)}function rx(e,t){return t}function ix(e,t){let n=[];for(let r of t?.folders??[]){let t=`${r.path}/.ok/templates/`,i=e.created.filter(e=>e.kind===`file`&&(e.path.startsWith(t)||e.path.includes(`/${t}`))).map(e=>ex(e.path)),a=i.length,o=e.created.some(e=>e.kind===`folder`&&(e.path===r.path||e.path.endsWith(`/${r.path}`)));(a>0||o)&&n.push({path:r.path,summary:r.summary,templateCount:a,templates:i})}return n}function ax(e){return e.created.filter(e=>e.kind===`file`&&!e.path.split(`/`).includes(`.ok`)).map(e=>({path:e.path,name:ex(e.path)}))}function ox(e){let t=(0,$.c)(17),{plan:n,selectedPack:r}=e,{_:i}=Bn(),a,o,s,c;if(t[0]!==i||t[1]!==n||t[2]!==r){let e=ix(n,r),l=ax(n),u=(n.packSkills??[]).filter(hx),d=(n.requiredPlugins??[]).filter(mx),f=e.length,p=l.length,m=e.reduce(px,0),h=u.length,g=d.length,_={"log.md":i({id:`EoaQyO`}),"USER.md":i({id:`bV6DJA`}),"SOUL.md":i({id:`Waiy-j`}),"ACCESS_POLICY.md":i({id:`6ZhdPI`}),"HEARTBEAT.md":i({id:`MDZSJe`}),"OVERVIEW.md":i({id:`dMsx3p`}),"welcome.md":i({id:`WWcqsG`}),"index.md":i({id:`uFQbYd`})},v=[f>0?{key:`folders`,n:f,label:i({id:`VsaI0G`,values:{folderCount:f}})}:null,p>0?{key:`files`,n:p,label:i({id:`DgcGrb`,values:{fileCount:p}})}:null,m>0?{key:`templates`,n:m,label:i({id:`ba3vIW`,values:{templateCount:m}})}:null,h>0?{key:`skills`,n:h,label:i({id:`HAvRAI`,values:{skillCount:h}})}:null,g>0?{key:`plugins`,n:g,label:i({id:`llXHHh`,values:{pluginCount:g}})}:null].filter(fx),y=e.map(e=>({key:`folder:${e.path}`,icon:Kf,name:`${ex(e.path)}/`,pill:e.templateCount>0?i({id:`-5jISU`,values:{0:e.templateCount}}):void 0,pillTooltip:e.templateCount>0?e.templates:void 0,description:e.summary||void 0})),b=l.map(e=>({key:`file:${e.path}`,icon:Ge,name:e.name,title:e.name,description:_[e.name]})),x=u.map(e=>({key:`skill:${e.name}`,icon:tp,name:ah(e.name),title:e.name,description:i({id:`FEqWFL`})})),S={okf:i({id:`uK2peg`})},C=d.map(e=>({key:`plugin:${e.id}`,icon:hb,name:Ad.find(t=>t.id===e.id)?.label??e.id,title:e.id,description:S[e.id]??i({id:`1ZXkqM`})})),w=[{key:`folders`,label:i({id:`pcqlQu`,values:{0:y.length}}),rows:y},{key:`files`,label:i({id:`ZgGuA4`,values:{0:b.length}}),rows:b},{key:`skill`,label:i({id:`yK1m_z`,values:{0:x.length}}),rows:x},{key:`plugin`,label:i({id:`7wogIQ`,values:{0:C.length}}),rows:C}].filter(dx);s=`space-y-5`;let T;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(`h3`,{className:`flex items-center gap-1.5 text-xs font-medium uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`xSVO3J`})}),t[7]=T):T=t[7];let E=v.length>0?(0,Z.jsx)(`div`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-0.5 text-xs`,children:v.map(ux)}):null;t[8]===E?c=t[9]:(c=(0,Z.jsxs)(`div`,{className:`flex flex-wrap justify-between items-baseline gap-x-2 gap-y-0.5`,children:[T,E]}),t[8]=E,t[9]=c),a=`space-y-5`,o=w.map(sx),t[0]=i,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s,t[6]=c}else a=t[3],o=t[4],s=t[5],c=t[6];let l;t[10]!==a||t[11]!==o?(l=(0,Z.jsx)(`div`,{className:a,children:o}),t[10]=a,t[11]=o,t[12]=l):l=t[12];let u;return t[13]!==s||t[14]!==c||t[15]!==l?(u=(0,Z.jsxs)(`section`,{className:s,children:[c,l]}),t[13]=s,t[14]=c,t[15]=l,t[16]=u):u=t[16],u}function sx(e){return(0,Z.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,Z.jsxs)(`h4`,{className:`flex items-baseline gap-2 text-xs font-medium uppercase font-mono tracking-wider text-muted-foreground`,children:[(0,Z.jsx)(`span`,{children:e.label}),(0,Z.jsx)(`span`,{className:`text-muted-foreground/50`,children:e.rows.length})]}),(0,Z.jsx)(`ul`,{className:`space-y-4`,children:e.rows.map(cx)})]},e.key)}function cx(e){let t=e.icon;return(0,Z.jsxs)(`li`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`div`,{"aria-hidden":`true`,className:`flex size-8 shrink-0 items-center justify-center rounded-lg border border-border/60`,children:(0,Z.jsx)(t,{className:`size-4 text-muted-foreground`})}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 py-0.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-1sm text-foreground/90`,title:e.title,children:e.name}),e.pill?e.pillTooltip&&e.pillTooltip.length>0?(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(Br,{className:`shrink-0 cursor-help rounded bg-transparent p-0 font-mono text-2xs uppercase tracking-wide text-muted-foreground transition-colors hover:text-foreground/70 focus-visible:text-foreground/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,children:e.pill}),(0,Z.jsx)(Vr,{children:(0,Z.jsx)(`ul`,{className:`space-y-0.5 text-left font-mono`,children:e.pillTooltip.map(lx)})})]}):(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-2xs uppercase tracking-wide text-muted-foreground`,children:e.pill}):null]}),e.description?(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-muted-foreground`,children:e.description}):null]})]},e.key)}function lx(e){return(0,Z.jsx)(`li`,{children:e},e)}function ux(e,t){return(0,Z.jsxs)(Q.Fragment,{children:[t>0?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground/50`,children:`·`}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`text-foreground/80`,children:e.n}),` `,(0,Z.jsx)(`span`,{className:`text-muted-foreground/80`,children:e.label})]})]},e.key)}function dx(e){return e.rows.length>0}function fx(e){return e!==null}function px(e,t){return e+t.templateCount}function mx(e){return e.pending}function hx(e){return e.pending}async function gx(e){let t=await e.json().catch(()=>null),n=xc.safeParse(t);if(!n.success)return{kind:`internal`,message:`HTTP ${e.status}`};let r=n.data.detail??n.data.title,i=n.data.type;return i===`urn:ok:error:seed-prerequisite-missing`?{kind:`prerequisite-missing`,message:r}:i===`urn:ok:error:seed-invalid-root`?{kind:`invalid-root`,message:r}:i===`urn:ok:error:no-project-dir`?{kind:`no-project`,message:r}:{kind:`internal`,message:r}}function _x(){let e=typeof window<`u`?window.okDesktop:void 0;if(e?.seed){let t=e.seed.apply;return{plan:e.seed.plan,apply:async(e,n)=>{let r=await t(e,n);return r.ok&&Kc(),r},listPacks:e.seed.listPacks}}return{plan:async e=>{let t=new URLSearchParams;e?.rootDir&&t.set(`rootDir`,e.rootDir),e?.packId&&t.set(`packId`,e.packId);let n=t.toString(),r=await fetch(`/api/seed/plan${n?`?${n}`:``}`);if(!r.ok)return{ok:!1,error:await gx(r)};let i=await r.json().catch(()=>null);return i?.plan?{ok:!0,plan:i.plan}:{ok:!1,error:{kind:`internal`,message:Hc._({id:`5YWCV_`})}}},apply:async(e,t)=>{let n=await fetch(`/api/seed/apply`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({plan:e,packId:t?.packId})});if(!n.ok)return{ok:!1,error:await gx(n)};let r=await n.json().catch(()=>null);return r?.result?(Kc(),{ok:!0,result:r.result}):{ok:!1,error:{kind:`internal`,message:Hc._({id:`aXkLuE`})}}},listPacks:async()=>{let e=await fetch(`/api/seed/packs`);if(!e.ok)return{ok:!1,error:{kind:`internal`,message:`HTTP ${e.status}`}};let t=await e.json().catch(()=>null);return!t||!Array.isArray(t.packs)?{ok:!1,error:{kind:`internal`,message:Hc._({id:`q-QUC7`})}}:{ok:!0,packs:t.packs}}}}var vx={"knowledge-base":nb,"software-lifecycle":vu,"codebase-wiki":jy,"plain-notes":Db,worldbuilding:Ly,"writing-pipeline":db,"entity-vault":cb,okf:Hy};function yx(e){return vx[e]??nb}function bx(e){let t=(0,$.c)(69),{onPackSelect:n,onCreateBlankFile:r,collapsedPackIds:i,className:a,packs:o}=e,{_:s}=Bn(),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(!1),m=o===void 0,h,g;t[0]===m?(h=t[1],g=t[2]):(h=()=>{if(!m)return;let e=!1;return(async()=>{try{let t=await _x().listPacks();if(e)return;t.ok?l(t.packs):d(t.error.message)}catch(t){let n=t;if(e)return;d(n instanceof Error?n.message:String(n))}})(),()=>{e=!0}},g=[m],t[0]=m,t[1]=h,t[2]=g),(0,Q.useEffect)(h,g);let _=m?c:o;if(u!==null){let e;t[3]===a?e=t[4]:(e=gr(`rounded-md bg-destructive/10 p-4 text-sm text-destructive`,a),t[3]=a,t[4]=e);let n;t[5]===u?n=t[6]:(n=(0,Z.jsx)(Y,{id:`56WWtu`,values:{error:u}}),t[5]=u,t[6]=n);let r;return t[7]!==e||t[8]!==n?(r=(0,Z.jsx)(`div`,{role:`alert`,className:e,children:n}),t[7]=e,t[8]=n,t[9]=r):r=t[9],r}if(_===null){let e;t[10]===a?e=t[11]:(e=gr(`@container/packgrid w-full max-w-5xl`,a),t[10]=a,t[11]=e);let n;t[12]===s?n=t[13]:(n=s({id:`BeWTQy`}),t[12]=s,t[13]=n);let r;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(`div`,{className:`grid gap-4 @sm/packgrid:grid-cols-2 @2xl/packgrid:grid-cols-3`,children:Array.from({length:Object.keys(vx).length},Sx).map(xx)}),t[14]=r):r=t[14];let i;return t[15]!==e||t[16]!==n||t[17]!==r?(i=(0,Z.jsx)(`div`,{role:`status`,className:e,"aria-busy":`true`,"aria-label":n,children:r}),t[15]=e,t[16]=n,t[17]=r,t[18]=i):i=t[18],i}if(_.length===0){let e;t[19]===a?e=t[20]:(e=gr(`flex w-full max-w-5xl items-center justify-center rounded-2xl border border-dashed border-border/60 bg-muted/20 p-8 text-sm text-muted-foreground`,a),t[19]=a,t[20]=e);let n;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(Y,{id:`zLGXna`}),t[21]=n):n=t[21];let r;return t[22]===e?r=t[23]:(r=(0,Z.jsx)(`div`,{role:`status`,className:e,children:n}),t[22]=e,t[23]=r),r}let v;t[24]===i?v=t[25]:(v=i??[],t[24]=i,t[25]=v);let y;t[26]===v?y=t[27]:(y=new Set(v),t[26]=v,t[27]=y);let b=y,x,S,C,w,T,E,D,O,k;if(t[28]!==a||t[29]!==b||t[30]!==f||t[31]!==r||t[32]!==n||t[33]!==_){let e;t[43]===b?e=t[44]:(e=e=>!b.has(e.id),t[43]=b,t[44]=e);let i=_.filter(e),o;t[45]===b?o=t[46]:(o=e=>b.has(e.id),t[45]=b,t[46]=o),C=_.filter(o),S=C.length>0,w=S||r!=null,t[47]===a?k=t[48]:(k=gr(`@container/packgrid w-full max-w-5xl`,a),t[47]=a,t[48]=k),x=Kr,T=f,E=p;let s;t[49]===n?s=t[50]:(s=e=>(0,Z.jsx)(Cx,{pack:e,onSelect:()=>n(e.id)},e.id),t[49]=n,t[50]=s);let c=i.map(s);t[51]===c?D=t[52]:(D=(0,Z.jsx)(`div`,{className:`grid gap-4 @sm/packgrid:grid-cols-2 @2xl/packgrid:grid-cols-3`,children:c}),t[51]=c,t[52]=D),O=S?(0,Z.jsx)(Wr,{className:`-mx-1 -mb-1 overflow-hidden px-1 pb-1 data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,children:(0,Z.jsx)(`div`,{className:gr(`grid gap-4 @sm/packgrid:grid-cols-2 @2xl/packgrid:grid-cols-3`,`pt-4`),children:C.map(e=>(0,Z.jsx)(Cx,{pack:e,onSelect:()=>n(e.id)},e.id))})}):null,t[28]=a,t[29]=b,t[30]=f,t[31]=r,t[32]=n,t[33]=_,t[34]=x,t[35]=S,t[36]=C,t[37]=w,t[38]=T,t[39]=E,t[40]=D,t[41]=O,t[42]=k}else x=t[34],S=t[35],C=t[36],w=t[37],T=t[38],E=t[39],D=t[40],O=t[41],k=t[42];let A;t[53]!==f||t[54]!==S||t[55]!==C||t[56]!==r||t[57]!==w?(A=w?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-2`,children:[S?(0,Z.jsx)(Gr,{asChild:!0,children:(0,Z.jsxs)(X,{type:`button`,variant:`link-muted`,size:`sm`,children:[f?(0,Z.jsx)(Y,{id:`6lGV3K`}):(0,Z.jsx)(Y,{id:`ymWJLd`,values:{0:C.length}}),(0,Z.jsx)(Gu,{"aria-hidden":`true`,className:gr(`size-3.5 transition-transform`,f&&`rotate-180`)})]})}):(0,Z.jsx)(`span`,{}),r?(0,Z.jsx)(X,{type:`button`,variant:`link-muted`,size:`sm`,onClick:r,children:(0,Z.jsx)(Y,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(Du,{"aria-hidden":`true`,className:`size-3.5`})}})}):null]}):null,t[53]=f,t[54]=S,t[55]=C,t[56]=r,t[57]=w,t[58]=A):A=t[58];let j;t[59]!==x||t[60]!==A||t[61]!==T||t[62]!==E||t[63]!==D||t[64]!==O?(j=(0,Z.jsxs)(x,{open:T,onOpenChange:E,children:[D,O,A]}),t[59]=x,t[60]=A,t[61]=T,t[62]=E,t[63]=D,t[64]=O,t[65]=j):j=t[65];let M;return t[66]!==j||t[67]!==k?(M=(0,Z.jsx)(`div`,{className:k,children:j}),t[66]=j,t[67]=k,t[68]=M):M=t[68],M}function xx(e){return(0,Z.jsx)(Tx,{},`skeleton-${e}`)}function Sx(e,t){return t}function Cx(e){let t=(0,$.c)(27),{pack:n,onSelect:r}=e,i;t[0]===n.id?i=t[1]:(i=yx(n.id),t[0]=n.id,t[1]=i);let a=i,o;t[2]===a?o=t[3]:(o=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`mt-0.5 shrink-0 text-muted-foreground`,children:(0,Z.jsx)(a,{className:`size-3.5`})}),t[2]=a,t[3]=o);let s;t[4]===n.name?s=t[5]:(s=(0,Z.jsx)(`h3`,{className:`min-w-0 wrap-break-word text-sm font-medium leading-tight`,children:n.name}),t[4]=n.name,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-row items-start gap-2`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;t[9]===n.description?l=t[10]:(l=(0,Z.jsx)(`p`,{className:`line-clamp-2 text-1sm leading-relaxed text-muted-foreground`,children:n.description}),t[9]=n.description,t[10]=l);let u;t[11]!==c||t[12]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col gap-2`,children:[c,l]}),t[11]=c,t[12]=l,t[13]=u):u=t[13];let d;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`span`,{"data-slot":`pack-card-reveal`,className:`pointer-events-none absolute inset-0 flex items-center justify-center gap-1.5 rounded-[inherit] bg-card/85 text-sm font-medium text-muted-foreground opacity-0 transition-opacity duration-200 ease-out-strong group-hover:opacity-100 group-focus-visible:opacity-100 supports-backdrop-filter:bg-card/35 supports-backdrop-filter:backdrop-blur-md reduced-transparency:bg-card`,children:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 motion-safe:translate-y-1 motion-safe:transition-[translate] motion-safe:duration-200 motion-safe:ease-out-strong motion-safe:group-hover:translate-y-0 motion-safe:group-focus-visible:translate-y-0`,children:[(0,Z.jsx)(Y,{id:`UIjjFa`}),(0,Z.jsx)(Du,{"aria-hidden":`true`,className:`size-3.5`})]})}),t[14]=d):d=t[14];let f;t[15]!==r||t[16]!==u?(f=(0,Z.jsxs)(`button`,{type:`button`,onClick:r,"data-slot":`pack-card`,className:`group relative flex h-full min-w-0 flex-col items-start overflow-hidden rounded-2xl border border-border/60 bg-card p-5 text-left transition-[border-color,box-shadow,transform] hover:border-border hover:shadow-sm focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px`,children:[u,d]}),t[15]=r,t[16]=u,t[17]=f):f=t[17];let p=f;if(n.folders.length===0)return p;let m;t[18]===p?m=t[19]:(m=(0,Z.jsx)(Br,{asChild:!0,children:p}),t[18]=p,t[19]=m);let h;t[20]===n.folders?h=t[21]:(h=n.folders.map(wx),t[20]=n.folders,t[21]=h);let g;t[22]===h?g=t[23]:(g=(0,Z.jsx)(Vr,{className:`flex-col items-start gap-1.5`,children:(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1.5 text-left`,children:h})}),t[22]=h,t[23]=g);let _;return t[24]!==g||t[25]!==m?(_=(0,Z.jsxs)(Ur,{children:[m,g]}),t[24]=g,t[25]=m,t[26]=_):_=t[26],_}function wx(e){return(0,Z.jsxs)(`li`,{className:`flex flex-col`,children:[(0,Z.jsx)(`span`,{className:`font-mono`,children:e.path}),(0,Z.jsx)(`span`,{className:`opacity-75`,children:e.summary})]},e.path)}function Tx(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`span`,{className:`size-10 animate-pulse rounded-lg bg-muted`,"aria-hidden":`true`,children:(0,Z.jsx)(ip,{"aria-hidden":`true`,className:`size-5 text-muted-foreground opacity-0`})}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-[200px] flex-col items-start gap-4 rounded-xl border border-border/60 bg-card p-6`,children:[t,(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,children:[(0,Z.jsx)(`div`,{className:`h-4 w-1/2 animate-pulse rounded bg-muted`}),(0,Z.jsx)(`div`,{className:`h-3 w-full animate-pulse rounded bg-muted`}),(0,Z.jsx)(`div`,{className:`h-3 w-4/5 animate-pulse rounded bg-muted`})]})]}),e[1]=n):n=e[1],n}function Ex(e){let t=(0,$.c)(39),{choice:n,subfolder:r,placeholder:i,idPrefix:a,onChoiceChange:o,onSubfolderChange:s}=e,c=a===void 0?`seed-root`:a,{_:l}=Bn(),u=`${c}-project-root`,d=`${c}-subfolder`,f=`${c}-group-label`,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Y,{id:`3wiBAs`}),t[0]=p):p=t[0];let m;t[1]===f?m=t[2]:(m=(0,Z.jsx)(`p`,{id:f,className:`text-sm font-medium`,children:p}),t[1]=f,t[2]=m);let h;t[3]===o?h=t[4]:(h=e=>o(e),t[3]=o,t[4]=h);let g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(Nh,{children:(0,Z.jsx)(Y,{id:`RSqaSd`})}),t[5]=g):g=t[5];let _;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsxs)(Ah,{children:[g,(0,Z.jsx)(Mh,{className:`text-1sm`,children:(0,Z.jsx)(Y,{id:`ZvzbDF`})})]}),t[6]=_):_=t[6];let v;t[7]===u?v=t[8]:(v=(0,Z.jsxs)(Ph,{orientation:`horizontal`,children:[_,(0,Z.jsx)(Pa,{value:`project-root`,id:u})]}),t[7]=u,t[8]=v);let y;t[9]!==u||t[10]!==v?(y=(0,Z.jsx)(jh,{htmlFor:u,children:v}),t[9]=u,t[10]=v,t[11]=y):y=t[11];let b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Nh,{children:(0,Z.jsx)(Y,{id:`ZWgr0b`})}),t[12]=b):b=t[12];let x;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(Mh,{className:`nth-last-2:mt-0 text-1sm`,children:(0,Z.jsx)(Y,{id:`KQGZuq`})}),t[13]=x):x=t[13];let S;t[14]!==l||t[15]!==n||t[16]!==s||t[17]!==i||t[18]!==r?(S=n===`subfolder`&&(0,Z.jsx)(dh,{value:r,onChange:e=>s(e.target.value),placeholder:i,"aria-label":l({id:`NYUhy5`}),spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,className:`mt-1.5 font-mono text-xs bg-background`}),t[14]=l,t[15]=n,t[16]=s,t[17]=i,t[18]=r,t[19]=S):S=t[19];let C;t[20]===S?C=t[21]:(C=(0,Z.jsxs)(Ah,{children:[b,x,S]}),t[20]=S,t[21]=C);let w;t[22]===d?w=t[23]:(w=(0,Z.jsx)(Pa,{value:`subfolder`,id:d}),t[22]=d,t[23]=w);let T;t[24]!==C||t[25]!==w?(T=(0,Z.jsxs)(Ph,{orientation:`horizontal`,children:[C,w]}),t[24]=C,t[25]=w,t[26]=T):T=t[26];let E;t[27]!==d||t[28]!==T?(E=(0,Z.jsx)(jh,{htmlFor:d,children:T}),t[27]=d,t[28]=T,t[29]=E):E=t[29];let D;t[30]!==n||t[31]!==f||t[32]!==E||t[33]!==h||t[34]!==y?(D=(0,Z.jsxs)(Fa,{"aria-labelledby":f,className:`sm:flex`,value:n,onValueChange:h,children:[y,E]}),t[30]=n,t[31]=f,t[32]=E,t[33]=h,t[34]=y,t[35]=D):D=t[35];let O;return t[36]!==D||t[37]!==m?(O=(0,Z.jsxs)(`div`,{className:`space-y-2 py-1`,children:[m,D]}),t[36]=D,t[37]=m,t[38]=O):O=t[38],O}var Dx={"knowledge-base":{id:`gvApb7`},"software-lifecycle":{id:`hCOLSd`},"codebase-wiki":{id:`Fy4GgU`},"plain-notes":{id:`Qw-7Ie`},okf:{id:`_ayOfA`},"writing-pipeline":{id:`Zf0w-R`},"entity-vault":{id:`hmYd9H`},worldbuilding:{id:`VBE2dw`}},Ox=180,kx=5e3,Ax=200;function jx(e,t){if(e===`review`){t.reviewContinueRef.current?.focus();return}if(e===`configure`){t.nameInputRef.current?.focus();return}t.packGridRef.current?.querySelector(`[data-slot="pack-card"]`)?.focus()}function Mx(e,t){if(e===``||t===``)return``;let n=e.includes(`\\`)&&!e.includes(`/`)?`\\`:`/`;return`${e.replace(/[/\\]+$/,``)}${n}${t}`}function Nx(e){if(e===``)return``;let t=e.split(/[/\\]/).filter(Boolean);return t.length>0?t[t.length-1]??e:e}function Px(e){let{parent:t,sanitizedName:n,enclosingProject:r,enclosingGit:i,targetState:a}=e;return t===``||n===``?{kind:`idle`}:r===null?i===null?a===`exists-nonempty`?{kind:`block-nonempty`}:{kind:`free`}:{kind:`confirm-git`,gitRoot:i.gitRoot}:{kind:`block-nested`,rootPath:r.rootPath}}function Fx(e){let t=e instanceof Error?e.message:String(e);for(let e of _c)if(t.startsWith(`${e}:`)||t.includes(`${e}: `))return e===`nested-project`||e===`target-not-empty`?{reason:e}:{reason:e,message:t};return{reason:`unknown`,message:t}}function Ix(e){switch(e.reason){case`nested-project`:return{id:`ScwcF2`};case`target-not-empty`:return{id:`e8L17t`};case`invalid-args`:return{id:`6bTTAN`};case`mkdir-failed`:return{id:`gJR87V`};case`git-init-failed`:return{id:`4CfgPM`};case`init-failed`:return{id:`l17ab4`};case`discovery-failed`:return{id:`ThmUrC`};case`unknown`:return{id:`AddR83`}}}function Lx(e){let t=(0,$.c)(205),{open:n,onOpenChange:r,bridge:i,initialPackId:a,packs:o}=e,{_:s}=Bn(),c=(0,Q.useId)(),l=(0,Q.useId)(),u=(0,Q.useId)(),d=(0,Q.useId)(),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(!0),[S,C]=(0,Q.useState)(Ch),[w,T]=(0,Q.useState)(a),[E,D]=(0,Q.useState)(`configure`),[O,k]=(0,Q.useState)(`project-root`),[A,j]=(0,Q.useState)(``),M;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(M={kind:`loading`},t[0]=M):M=t[0];let[N,P]=(0,Q.useState)(M),F=(o?.length??0)>0,I;t[1]!==a||t[2]!==o?(I=a!==void 0&&(o?.some(e=>e.id===a)??!1),t[1]=a,t[2]=o,t[3]=I):I=t[3];let L=I,R=E!==`pick`,z=N.kind===`plan`?N.plan.packSkills?.length??0:0,B;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(B={kind:`idle`},t[4]=B):B=t[4];let[V,ee]=(0,Q.useState)(B),[H,U]=(0,Q.useState)(`idle`),[W,G]=(0,Q.useState)(!1),[te,ne]=(0,Q.useState)(null),re;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(re={kind:`idle`},t[5]=re):re=t[5];let[K,ie]=(0,Q.useState)(re),[q,ae]=(0,Q.useState)(0),oe;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(oe=new Set,t[6]=oe):oe=t[6];let se=(0,Q.useRef)(oe),ce=(0,Q.useRef)(null),le=(0,Q.useRef)(null),ue=(0,Q.useRef)(null),de=(0,Q.useRef)(null),fe=(0,Q.useRef)(null),pe;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(pe=e=>{D(e),requestAnimationFrame(()=>jx(e,{reviewContinueRef:de,nameInputRef:ue,packGridRef:fe}))},t[7]=pe):pe=t[7];let J=pe,me=(0,Q.useRef)(0),he=(0,Q.useRef)(!0),ge,_e;t[8]!==i||t[9]!==F||t[10]!==a||t[11]!==L||t[12]!==n?(ge=()=>{if(!n)return;se.current.clear(),ne(null),ee({kind:`idle`}),U(`idle`),G(!1),_(``),y(null),x(!0),C(Ch),ie({kind:`idle`}),T(a);let e=L?`review`:F?`pick`:`configure`;D(e),k(`project-root`),P({kind:`loading`}),he.current=!0,me.current+=1;let t=!1;i.integrations.status().then(e=>{if(t)return;let n=new Set(e.editors.filter(Kx).map(Gx));y(e.detectedEditorIds.filter(e=>cs(e,{userMcpEntryInstalled:n.has(e)})))}).catch(e=>{console.warn(`[CreateProjectDialog] editor-detection probe failed:`,e),t||y([])}),p(``),h(!0),i.fs.defaultProjectsRoot().then(e=>{t||p(e)}).catch(Wx).finally(()=>{t||h(!1)});let r=requestAnimationFrame(()=>jx(e,{reviewContinueRef:de,nameInputRef:ue,packGridRef:fe}));return()=>{t=!0,cancelAnimationFrame(r)}},_e=[n,i,a,F,L],t[8]=i,t[9]=F,t[10]=a,t[11]=L,t[12]=n,t[13]=ge,t[14]=_e):(ge=t[13],_e=t[14]),(0,Q.useEffect)(ge,_e);let ve;t[15]!==w||t[16]!==o?(ve=o?.find(e=>e.id===w),t[15]=w,t[16]=o,t[17]=ve):ve=t[17];let ye=ve,be=ye?.defaultSubfolder??``,xe;t[18]!==w||t[19]!==be?(xe=()=>{w!==void 0&&j(be)},t[18]=w,t[19]=be,t[20]=xe):xe=t[20];let Se;t[21]!==n||t[22]!==w||t[23]!==be?(Se=[n,w,be],t[21]=n,t[22]=w,t[23]=be,t[24]=Se):Se=t[24],(0,Q.useEffect)(xe,Se);let Ce;t[25]===A?Ce=t[26]:(Ce=A.trim(),t[25]=A,t[26]=Ce);let we=Ce,Te=ye!==void 0&&O===`subfolder`&&we===``,Ee=O===`project-root`?void 0:we,De=b&&(v?.length??0)>0,Oe,ke;t[27]!==s||t[28]!==n||t[29]!==R||t[30]!==Ee||t[31]!==ye||t[32]!==De||t[33]!==Te?(Oe=()=>{if(!n||ye===void 0||!R)return;if(Te){P({kind:`error`,message:s({id:`Z8KDox`}),blocking:!0});return}let e=he.current?0:Ax;he.current=!1;let t=!1,r=setTimeout(()=>{t||(P(Ux),_x().plan({rootDir:Ee,packId:ye.id,preview:{skillsInstallable:De}}).then(e=>{if(t)return;if(e.ok){P({kind:`plan`,plan:e.plan});return}let n=e.error.kind===`invalid-root`;n||console.warn(`[CreateProjectDialog] pack preview unavailable:`,e.error),P({kind:`error`,message:n?e.error.message:s({id:`7vxWET`}),blocking:n})}).catch(e=>{t||(console.warn(`[CreateProjectDialog] pack preview plan failed:`,e),P({kind:`error`,message:s({id:`7vxWET`}),blocking:!1}))}))},e);return()=>{t=!0,clearTimeout(r)}},ke=[n,R,ye,Ee,Te,De,s],t[27]=s,t[28]=n,t[29]=R,t[30]=Ee,t[31]=ye,t[32]=De,t[33]=Te,t[34]=Oe,t[35]=ke):(Oe=t[34],ke=t[35]),(0,Q.useEffect)(Oe,ke);let Ae;t[36]!==i||t[37]!==f||t[38]!==g||t[39]!==n?(Ae=()=>{if(!n)return;le.current!==null&&clearTimeout(le.current),ce.current!==null&&ce.current.abort();let e=Bo(g);if(f===``||e===``){ee({kind:`idle`}),U(`idle`);return}let t=f,r=Mx(t,e),a=new AbortController;return ce.current=a,le.current=setTimeout(()=>{U(`in-flight`),Promise.all([i.fs.findEnclosingProjectRoot(t),i.fs.findEnclosingGitRoot(t),i.fs.folderState(r)]).then(n=>{let[r,i,o]=n;a.signal.aborted||(U(`idle`),ee(Px({parent:t,sanitizedName:e,enclosingProject:r,enclosingGit:i,targetState:o})))}).catch(e=>{a.signal.aborted||(console.warn(`[CreateProjectDialog] cascade probe failed:`,e),U(`idle`),ee({kind:`free`}))})},Ox),()=>{le.current!==null&&clearTimeout(le.current),a.abort()}},t[36]=i,t[37]=f,t[38]=g,t[39]=n,t[40]=Ae):Ae=t[40];let je;t[41]!==i||t[42]!==f||t[43]!==g||t[44]!==n||t[45]!==q?(je=[n,f,g,i,q],t[41]=i,t[42]=f,t[43]=g,t[44]=n,t[45]=q,t[46]=je):je=t[46],(0,Q.useEffect)(Ae,je);let Me,Ne;t[47]===n?(Me=t[48],Ne=t[49]):(Me=()=>{if(!n)return;let e=()=>ae(Hx);return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},Ne=[n],t[47]=n,t[48]=Me,t[49]=Ne),(0,Q.useEffect)(Me,Ne);let Pe=(0,Q.useRef)(`idle`),Fe,Ie;t[50]===H?(Fe=t[51],Ie=t[52]):(Fe=()=>{Pe.current=H},Ie=[H],t[50]=H,t[51]=Fe,t[52]=Ie),(0,Q.useEffect)(Fe,Ie);let Le,Re;t[53]!==V.kind||t[54]!==n?(Le=()=>{if(!n||V.kind!==`confirm-git`)return;let e=setInterval(()=>{Pe.current!==`in-flight`&&ae(Vx)},kx);return()=>clearInterval(e)},Re=[n,V.kind],t[53]=V.kind,t[54]=n,t[55]=Le,t[56]=Re):(Le=t[55],Re=t[56]),(0,Q.useEffect)(Le,Re);let ze;t[57]!==V.gitRoot||t[58]!==V.kind||t[59]!==K.gitRoot||t[60]!==K.kind?(ze=()=>{if(V.kind!==`confirm-git`){K.kind!==`idle`&&(me.current+=1,ie({kind:`idle`}));return}K.kind===`confirming`&&K.gitRoot!==V.gitRoot&&ie({kind:`idle`}),K.kind===`pending`&&K.gitRoot!==V.gitRoot&&(me.current+=1,ie({kind:`idle`}))},t[57]=V.gitRoot,t[58]=V.kind,t[59]=K.gitRoot,t[60]=K.kind,t[61]=ze):ze=t[61];let Be;t[62]!==V||t[63]!==K?(Be=[V,K],t[62]=V,t[63]=K,t[64]=Be):Be=t[64],(0,Q.useEffect)(ze,Be);let Ve;t[65]!==i||t[66]!==V.kind||t[67]!==n?(Ve=()=>{if(!n)return;let e=null;V.kind===`block-nested`?e=`nested`:V.kind===`block-nonempty`?e=`nonempty`:V.kind===`confirm-git`&&(e=`git-confirm`),e!==null&&(se.current.has(e)||(se.current.add(e),i.project.recordCreateNewBannerShown(e).catch(Bx)))},t[65]=i,t[66]=V.kind,t[67]=n,t[68]=Ve):Ve=t[68];let He;t[69]!==i||t[70]!==V||t[71]!==n?(He=[n,V,i],t[69]=i,t[70]=V,t[71]=n,t[72]=He):He=t[72],(0,Q.useEffect)(Ve,He);let Ue=g,We,Ge,Ke,qe,Je;t[73]!==V.kind||t[74]!==f||t[75]!==Ue?(qe=Ue===``?``:Bo(Ue),Ge=Ue!==``&&qe!==Ue&&qe!==``,Ke=Ue!==``&&qe===``,We=V.kind===`block-nonempty`,Je=f!==``&&qe!==``?Mx(f,qe):``,t[73]=V.kind,t[74]=f,t[75]=Ue,t[76]=We,t[77]=Ge,t[78]=Ke,t[79]=qe,t[80]=Je):(We=t[76],Ge=t[77],Ke=t[78],qe=t[79],Je=t[80]);let Ye=Je,Xe=!W&&f!==``&&Ue!==``&&qe!==``&&!Te&&(ye===void 0||N.kind!==`error`||!N.blocking)&&H===`idle`&&(V.kind===`free`||V.kind===`confirm-git`),Ze=W||b&&v===null||Ue!==``&&!Xe,Qe;t[81]!==i||t[82]!==f?(Qe=async function(){try{let e=await i.dialog.openFolder(f===``?void 0:{defaultPath:f});if(e===null)return;p(e),ae(zx),ne(null)}catch(e){console.warn(`[CreateProjectDialog] dialog.openFolder failed:`,e)}},t[81]=i,t[82]=f,t[83]=Qe):Qe=t[83];let $e=Qe,et;t[84]!==s||t[85]!==i||t[86]!==W||t[87]!==Xe||t[88]!==b||t[89]!==v||t[90]!==f||t[91]!==r||t[92]!==w||t[93]!==Ee||t[94]!==Ue||t[95]!==qe||t[96]!==S?(et=async function(e){if(e.preventDefault(),!W){if(Ue.trim()===``){Dc.error(s({id:`5OqaJi`})),ue.current?.focus();return}if(Xe){G(!0),ne(null);try{await i.project.createNew({parent:f,name:qe,editors:b?[...v??[]]:[],sharing:S,packId:w,rootDir:Ee}),r(!1)}catch(e){ne(Fx(e)),G(!1)}}}},t[84]=s,t[85]=i,t[86]=W,t[87]=Xe,t[88]=b,t[89]=v,t[90]=f,t[91]=r,t[92]=w,t[93]=Ee,t[94]=Ue,t[95]=qe,t[96]=S,t[97]=et):et=t[97];let tt=et,nt;t[98]!==W||t[99]!==r?(nt=function(e){W||r(e)},t[98]=W,t[99]=r,t[100]=nt):nt=t[100];let rt=nt,it;t[101]===Symbol.for(`react.memo_cache_sentinel`)?(it=async function(e){ie({kind:`confirming`,gitRoot:e})},t[101]=it):it=t[101];let at=it,ot;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(ot=async function(){ie({kind:`idle`})},t[102]=ot):ot=t[102];let st=ot,ct;t[103]===i?ct=t[104]:(ct=async function(e){let t=me.current+1;me.current=t,ie({kind:`pending`,gitRoot:e});try{if(await i.fs.removeGitFolder(e),me.current!==t)return;ae(Rx),ie({kind:`idle`})}catch(e){let n=e;if(me.current!==t)return;let r=n instanceof Error?n.message:String(n);console.error(`[CreateProjectDialog] bridge.fs.removeGitFolder failed:`,n),ie({kind:`error`,message:r})}},t[103]=i,t[104]=ct);let lt=ct,ut;t[105]!==i||t[106]!==r?(ut=async function(e){r(!1);try{await i.project.open({path:e,target:`new-window`,entryPoint:`create-new-nested-redirect`})}catch(e){console.warn(`[CreateProjectDialog] project.open failed:`,e)}},t[105]=i,t[106]=r,t[107]=ut):ut=t[107];let dt=ut,ft=Ke||We||Ge?`${u} ${d}`:u,pt=w!==void 0&&F,mt=ye?.name,ht=ye?Dx[ye.id]:void 0,gt;t[108]!==s||t[109]!==E?(gt=s(E===`pick`?{id:`tcjTlU`}:E===`review`?{id:`CPMLsP`}:{id:`tjbyOy`}),t[108]=s,t[109]=E,t[110]=gt):gt=t[110];let _t=gt,vt;t[111]!==s||t[112]!==mt?(vt=s(mt===void 0?{id:`wbv9xO`}:{id:`MPpSAg`,values:{selectedPackName:mt}}),t[111]=s,t[112]=mt,t[113]=vt):vt=t[113];let yt=vt,bt;t[114]!==s||t[115]!==ye||t[116]!==ht?(bt=ye===void 0?s({id:`O6yEPk`}):ht?s(ht):ye.description,t[114]=s,t[115]=ye,t[116]=ht,t[117]=bt):bt=t[117];let xt=bt,St=E===`pick`&&`sm:max-w-3xl`,Ct;t[118]===St?Ct=t[119]:(Ct=gr(`sm:max-w-lg`,St),t[118]=St,t[119]=Ct);let wt;t[120]===_t?wt=t[121]:(wt=(0,Z.jsx)(`span`,{"aria-live":`polite`,className:`sr-only`,"data-testid":`create-step-announcer`,children:_t}),t[120]=_t,t[121]=wt);let Tt;t[122]!==s||t[123]!==E||t[124]!==yt?(Tt=E===`pick`?s({id:`tcjTlU`}):yt,t[122]=s,t[123]=E,t[124]=yt,t[125]=Tt):Tt=t[125];let Et;t[126]===Tt?Et=t[127]:(Et=(0,Z.jsx)(Jr,{children:Tt}),t[126]=Tt,t[127]=Et);let Dt;t[128]!==s||t[129]!==xt||t[130]!==E?(Dt=E===`pick`?s({id:`b6Fgpe`}):E===`review`?s({id:`Z67Zlj`}):xt,t[128]=s,t[129]=xt,t[130]=E,t[131]=Dt):Dt=t[131];let Ot;t[132]===Dt?Ot=t[133]:(Ot=(0,Z.jsx)(qr,{children:Dt}),t[132]=Dt,t[133]=Ot);let kt;t[134]!==Et||t[135]!==Ot?(kt=(0,Z.jsxs)($r,{children:[Et,Ot]}),t[134]=Et,t[135]=Ot,t[136]=kt):kt=t[136];let At;t[137]!==s||t[138]!==W||t[139]!==u||t[140]!==V||t[141]!==b||t[142]!==v||t[143]!==c||t[144]!==f||t[145]!==m||t[146]!==g||t[147]!==ft||t[148]!==d||t[149]!==l||t[150]!==We||t[151]!==$e||t[152]!==lt||t[153]!==dt||t[154]!==tt||t[155]!==w||t[156]!==N.blocking||t[157]!==N.kind||t[158]!==N.message||t[159]!==N.plan||t[160]!==z||t[161]!==o||t[162]!==K||t[163]!==O||t[164]!==Ge||t[165]!==Ke||t[166]!==qe||t[167]!==ye||t[168]!==S||t[169]!==De||t[170]!==E||t[171]!==A||t[172]!==te||t[173]!==Ye?(At=E===`pick`?(0,Z.jsx)(Xr,{ref:fe,children:(0,Z.jsx)(bx,{packs:o??null,onPackSelect:e=>{T(e),e!==w&&k(`project-root`),he.current=!0,P({kind:`loading`}),J(`review`)}})}):E===`review`?ye===void 0?null:(0,Z.jsx)(Xr,{"data-testid":`create-review-body`,children:N.kind===`error`?(0,Z.jsx)(`div`,{role:`alert`,className:`rounded-md bg-destructive/10 p-3 text-sm text-destructive`,"data-testid":`create-pack-preview-error`,children:N.message}):N.kind===`plan`?(0,Z.jsx)(ox,{plan:N.plan,selectedPack:ye}):(0,Z.jsx)(tx,{rowCount:ye.folders.length})}):(0,Z.jsx)(Xr,{className:`space-y-6`,children:(0,Z.jsxs)(`form`,{id:c,onSubmit:tt,"data-testid":`create-project-form`,className:`space-y-6`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(ba,{htmlFor:l,children:(0,Z.jsx)(Y,{id:`OyIC0Q`})}),(0,Z.jsx)(dh,{id:l,ref:ue,value:g,placeholder:s({id:`cV7LOw`}),onChange:e=>_(e.target.value),disabled:W,autoComplete:`off`,"aria-invalid":Ke||We,"aria-describedby":ft,"data-testid":`create-name`}),Ke?(0,Z.jsx)(`p`,{id:d,role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-name-error-erased`,children:(0,Z.jsx)(Y,{id:`_PBJRl`})}):We?(0,Z.jsx)(`p`,{id:d,role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-name-error-taken`,children:(0,Z.jsx)(Y,{id:`7apDiJ`,values:{sanitized:qe},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):Ge?(0,Z.jsx)(`p`,{id:d,role:`status`,"aria-live":`polite`,className:`text-1sm text-muted-foreground`,"data-testid":`create-name-hint-diverged`,children:(0,Z.jsx)(Y,{id:`KnoB--`,values:{sanitized:qe},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):null]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(ba,{children:(0,Z.jsx)(Y,{id:`wJijgU`})}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`div`,{className:`min-w-0 flex-1 rounded-md border border-input bg-muted/50 px-2.5 py-1 text-sm text-foreground wrap-break-word`,"data-testid":`create-location-display`,children:f===``?m?(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`iHAJDj`})}):(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`8m8diM`})}):f}),(0,Z.jsx)(X,{type:`button`,variant:`outline`,className:`shrink-0`,disabled:W,onClick:()=>void $e(),"data-testid":`create-browse`,children:(0,Z.jsx)(Y,{id:`O2UpM1`})})]}),(0,Z.jsx)(`p`,{id:u,className:`text-1sm text-muted-foreground wrap-break-word`,"aria-live":`polite`,"data-testid":`create-target-caption`,children:Ye===``?null:(0,Z.jsx)(Y,{id:`k_yIIc`,values:{targetPreview:Ye},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})})]}),(0,Z.jsx)(qx,{cascade:V,onOpenNested:dt,removeGitState:K,onRequestRemoveGit:at,onCancelRemoveGit:st,onConfirmRemoveGit:lt}),ye?(0,Z.jsxs)(`div`,{className:`space-y-6`,"data-testid":`create-pack-section`,children:[(0,Z.jsx)(Ex,{choice:O,subfolder:A,placeholder:ye.defaultSubfolder??`subfolder`,idPrefix:`create-seed-root`,onChoiceChange:k,onSubfolderChange:j}),V.kind===`confirm-git`?(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`create-pack-promoted-note`,children:(0,Z.jsx)(Y,{id:`-ksoxk`,values:{sanitized:qe},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):null,N.kind===`error`&&N.blocking?(0,Z.jsx)(`div`,{role:`alert`,className:`rounded-md bg-destructive/10 p-3 text-sm text-destructive`,"data-testid":`create-pack-preview-error`,children:N.message}):null]}):null,(0,Z.jsx)(Oh,{detectedEditors:v,checked:b,onCheckedChange:x,disabled:W,testIdPrefix:`create-editors`,itemTestIdPrefix:`create-editor`}),z>0?(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`create-pack-skills-note`,children:De?(0,Z.jsx)(Y,{id:`VPwWZu`,values:{packSkillCount:z}}):(0,Z.jsx)(Y,{id:`vUP_HF`,values:{packSkillCount:z}})}):null,(0,Z.jsx)(Eh,{idPrefix:`create`,testIdPrefix:`create-sharing`,value:S,onValueChange:C,disabled:W}),te===null?null:(0,Z.jsx)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,"data-testid":`create-submit-error`,children:s(Ix(te))})]})}),t[137]=s,t[138]=W,t[139]=u,t[140]=V,t[141]=b,t[142]=v,t[143]=c,t[144]=f,t[145]=m,t[146]=g,t[147]=ft,t[148]=d,t[149]=l,t[150]=We,t[151]=$e,t[152]=lt,t[153]=dt,t[154]=tt,t[155]=w,t[156]=N.blocking,t[157]=N.kind,t[158]=N.message,t[159]=N.plan,t[160]=z,t[161]=o,t[162]=K,t[163]=O,t[164]=Ge,t[165]=Ke,t[166]=qe,t[167]=ye,t[168]=S,t[169]=De,t[170]=E,t[171]=A,t[172]=te,t[173]=Ye,t[174]=At):At=t[174];let jt;t[175]!==W||t[176]!==pt||t[177]!==E?(jt=(E===`configure`||E===`review`)&&pt?(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,className:`me-auto font-mono uppercase`,onClick:()=>J(`pick`),disabled:W,"data-testid":`create-change-pack`,children:[(0,Z.jsx)(Au,{"aria-hidden":`true`,className:`h-4 w-4`}),(0,Z.jsx)(Y,{id:`uLVNZL`})]}):null,t[175]=W,t[176]=pt,t[177]=E,t[178]=jt):jt=t[178];let Mt;t[179]!==W||t[180]!==r||t[181]!==E?(Mt=E===`review`?null:(0,Z.jsx)(X,{type:`button`,variant:`outline`,className:`font-mono uppercase`,onClick:()=>r(!1),disabled:W,"data-testid":`create-cancel`,children:(0,Z.jsx)(Y,{id:`dEgA5A`})}),t[179]=W,t[180]=r,t[181]=E,t[182]=Mt):Mt=t[182];let Nt;t[183]===E?Nt=t[184]:(Nt=E===`review`?(0,Z.jsx)(X,{type:`button`,ref:de,onClick:()=>J(`configure`),"data-testid":`create-review-continue`,children:(0,Z.jsx)(Y,{id:`m-1Z7o`})}):null,t[183]=E,t[184]=Nt);let Pt;t[185]!==W||t[186]!==c||t[187]!==E||t[188]!==Ze?(Pt=E===`configure`?(0,Z.jsx)(X,{type:`submit`,form:c,disabled:Ze,"data-testid":`create-submit`,children:W?(0,Z.jsx)(Y,{id:`E9bKSA`}):(0,Z.jsx)(Y,{id:`hYgDIe`})}):null,t[185]=W,t[186]=c,t[187]=E,t[188]=Ze,t[189]=Pt):Pt=t[189];let Ft;t[190]!==jt||t[191]!==Mt||t[192]!==Nt||t[193]!==Pt?(Ft=(0,Z.jsxs)(Zr,{children:[jt,Mt,Nt,Pt]}),t[190]=jt,t[191]=Mt,t[192]=Nt,t[193]=Pt,t[194]=Ft):Ft=t[194];let It;t[195]!==Ct||t[196]!==wt||t[197]!==kt||t[198]!==At||t[199]!==Ft?(It=(0,Z.jsxs)(Yr,{className:Ct,"data-testid":`create-project-dialog`,children:[wt,kt,At,Ft]}),t[195]=Ct,t[196]=wt,t[197]=kt,t[198]=At,t[199]=Ft,t[200]=It):It=t[200];let Lt;return t[201]!==rt||t[202]!==n||t[203]!==It?(Lt=(0,Z.jsx)(ei,{open:n,onOpenChange:rt,children:It}),t[201]=rt,t[202]=n,t[203]=It,t[204]=Lt):Lt=t[204],Lt}function Rx(e){return e+1}function zx(e){return e+1}function Bx(){}function Vx(e){return e+1}function Hx(e){return e+1}function Ux(e){return e.kind===`plan`?e:{kind:`loading`}}function Wx(e){console.warn(`[CreateProjectDialog] defaultProjectsRoot probe failed:`,e)}function Gx(e){return e.id}function Kx(e){return e.state===`installed`}function qx(e){let t=(0,$.c)(37),{cascade:n,onOpenNested:r,removeGitState:i,onRequestRemoveGit:a,onCancelRemoveGit:o,onConfirmRemoveGit:s}=e;if(n.kind===`idle`||n.kind===`free`||n.kind===`block-nonempty`)return null;if(n.kind===`block-nested`){let{rootPath:e}=n,i;t[0]===e?i=t[1]:(i=Nx(e),t[0]=e,t[1]=i);let a=i,o;t[2]===e?o=t[3]:(o={rootPath:e},t[2]=e,t[3]=o);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})},t[4]=s):s=t[4];let c;t[5]===o?c=t[6]:(c=(0,Z.jsx)(`p`,{className:`mb-2`,children:(0,Z.jsx)(Y,{id:`W7XJN4`,values:o,components:s})}),t[5]=o,t[6]=c);let l;t[7]!==r||t[8]!==e?(l=()=>r(e),t[7]=r,t[8]=e,t[9]=l):l=t[9];let u;t[10]===a?u=t[11]:(u=(0,Z.jsx)(Y,{id:`1Ta7Fd`,values:{basename:a}}),t[10]=a,t[11]=u);let d;t[12]!==l||t[13]!==u?(d=(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:l,"data-testid":`create-banner-nested-open`,children:u}),t[12]=l,t[13]=u,t[14]=d):d=t[14];let f;return t[15]!==c||t[16]!==d?(f=(0,Z.jsxs)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,"data-testid":`create-banner-nested`,children:[c,d]}),t[15]=c,t[16]=d,t[17]=f):f=t[17],f}if(n.kind===`confirm-git`){let{gitRoot:e}=n,r;if(t[18]!==e){let n;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(n=/\/+$/,t[20]=n):n=t[20],r=e.replace(n,``),t[18]=e,t[19]=r}else r=t[19];let c=`${r}/.git`,l=i.kind===`error`?i.message:null,u;t[21]===e?u=t[22]:(u={gitRoot:e},t[21]=e,t[22]=u);let d;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(d={0:(0,Z.jsx)(`code`,{}),1:(0,Z.jsx)(`code`,{})},t[23]=d):d=t[23];let f;t[24]===u?f=t[25]:(f=(0,Z.jsx)(`p`,{children:(0,Z.jsx)(Y,{id:`FEK4oC`,values:u,components:d})}),t[24]=u,t[25]=f);let p;t[26]!==e||t[27]!==o||t[28]!==s||t[29]!==a||t[30]!==l||t[31]!==i.kind||t[32]!==c?(p=i.kind===`idle`||i.kind===`error`?(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-col gap-1`,children:[(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>a(e),"data-testid":`create-banner-git-remove`,children:(0,Z.jsx)(Y,{id:`YTLmTM`,components:{0:(0,Z.jsx)(`code`,{})}})}),i.kind===`error`?(0,Z.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,"data-testid":`create-banner-git-remove-error`,children:(0,Z.jsx)(Y,{id:`SkMZlS`,values:{targetGitPath:c,removeGitError:l},components:{0:(0,Z.jsx)(`code`,{})}})}):null]}):(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-col gap-2 rounded border border-blue-400/60 bg-white/40 p-2 dark:border-blue-600/60 dark:bg-black/20`,"data-testid":`create-banner-git-remove-confirm`,children:[(0,Z.jsx)(`p`,{className:`text-xs`,children:(0,Z.jsx)(Y,{id:`WZ-vBy`,values:{targetGitPath:c},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsx)(X,{type:`button`,variant:`destructive`,size:`sm`,disabled:i.kind===`pending`,onClick:()=>s(e),"data-testid":`create-banner-git-remove-confirm-button`,children:i.kind===`pending`?(0,Z.jsx)(Y,{id:`0-31GV`}):(0,Z.jsx)(Y,{id:`v-h2hx`,values:{targetGitPath:c}})}),(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`sm`,disabled:i.kind===`pending`,onClick:o,"data-testid":`create-banner-git-remove-cancel`,children:(0,Z.jsx)(Y,{id:`dEgA5A`})})]})]}),t[26]=e,t[27]=o,t[28]=s,t[29]=a,t[30]=l,t[31]=i.kind,t[32]=c,t[33]=p):p=t[33];let m;return t[34]!==f||t[35]!==p?(m=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`rounded-md border border-blue-300 bg-blue-50 px-3 py-2 text-sm text-blue-900 dark:border-blue-700 dark:bg-blue-950 dark:text-blue-200`,"data-testid":`create-banner-git-confirm`,children:[f,p]}),t[34]=f,t[35]=p,t[36]=m):m=t[36],m}return null}function Jx(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`GitHub`}),r=(0,Z.jsx)(`path`,{d:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}async function Yx(e,t){let n=typeof window<`u`?window.okDesktop:void 0;if(n)try{if((await n.noteWindow.open(e,t)).ok)return;Dc.error(Hc._({id:`o1veZ6`}))}catch{Dc.error(Hc._({id:`o1veZ6`}))}}function Xx(e){if(e===null)return`none`;switch(e.kind){case`doc`:case`folder-index`:return`doc`;case`folder`:return`folder`;case`asset`:case`skill-file`:case`large-file`:return`asset`;case`missing`:case`skills`:case`skill-preview`:return`none`}}var Zx={blobRun:{id:`hgf5io`},back:{id:`iH8pgl`},forward:{id:`rxWGWX`},newFile:{id:`HdkSiO`},newFolder:{id:`96G6Re`},openGraph:{id:`3Fcb0I`},openInNewWindow:{id:`E91VZY`},initializeStarterPack:{id:`fWi7pn`},newSkill:{id:`MdpSC1`},newProject:{id:`gKi-a_`},openFolderOnDisk:{id:`WPwDin`},openFileOnDisk:{id:`ka6Eke`},switchProject:{id:`xaDWAI`},openSkills:{id:`PCSkw2`},settings:{id:`Tz0i8g`},installClaudeDesktop:{id:`62Pc08`},reportBug:{id:`cd5EXh`},bugReportHistory:{id:`QHCx0c`},sendFeedback:{id:`RoafuO`},newFromTemplate:{id:`Uuj_R4`},rename:{id:`2wxgft`},duplicate:{id:`euc6Ns`},moveToTrash:{id:`q3TWG7`},revealInFinder:{id:`LtSYdi`},copyFullPath:{id:`Up2_7p`},copyRelativePath:{id:`M6mvVi`},closeTab:{id:`r6ncaO`},newWorktree:{id:`DXd9LM`},switchWorktree:{id:`8Vq20-`},sidebarShow:{id:`151wvk`},sidebarHide:{id:`Q1mtyd`},docPanelShow:{id:`fSRzLo`},docPanelHide:{id:`GSYWCm`},terminalShow:{id:`xi9KGG`},terminalHide:{id:`9xCnv8`},terminalMoveRight:{id:`PrWQiT`},terminalMoveBottom:{id:`Tofsyo`},agentPanelShow:{id:`b4V4nU`},agentPanelHide:{id:`93LBnX`},agentPanelAskSelection:{id:`OlFVNr`},showHiddenFiles:{id:`XcGbim`},showOkFolders:{id:`GHsJb8`},showOnlyMarkdownFiles:{id:`WkTLN7`},showSkillsSection:{id:`WkyP2p`},expandAll:{id:`OlAl5i`},collapseAll:{id:`qvWGzP`},newTerminal:{id:`ZBxvV3`},killTerminal:{id:`5_j-DA`},checkForUpdates:{id:`WMCwmR`},setUpIntegrations:{id:`AhoGwP`},checkSpelling:{id:`ZgJVnp`},openOnGithub:{id:`LeGeTf`}},Qx={win32:{revealInFinder:{id:`qi1F96`},moveToTrash:{id:`o9yN4T`}},linux:{revealInFinder:{id:`e1Rn_k`}}};function $x(e,t){if(t===`win32`||t===`linux`){let n=Qx[t][e];if(n)return n}return Zx[e]}var eS={"open-blob-run":Xy,"navigate-back":Wu,"navigate-forward":Ku,"new-file":fi,"new-folder":Yy,"open-graph":cb,"open-in-new-window":Cb,"initialize-starter-pack":Ap,"new-skill":pt,"new-project":dr,"open-folder":Wf,"open-file":xi,"switch-project":nn,"open-skills":Ap,settings:Ar,"install-claude-desktop":yf,"report-bug":Dn,"bug-report-history":kl,"send-feedback":fp,"new-from-template":fi,rename:Zt,duplicate:Fn,"move-to-trash":Ip,"reveal-in-finder":Wf,"copy-full-path":Fn,"copy-relative-path":Fn,"close-tab":zp,"new-worktree":vu,"switch-worktree":vu,"toggle-sidebar":hn,"toggle-doc-panel":tl,"toggle-terminal":rl,"move-terminal":rl,"toggle-agent-panel":fp,"toggle-show-hidden-files":bf,"toggle-show-ok-folders":Kf,"toggle-show-only-markdown-files":xi,"toggle-show-skills-section":pt,"expand-all-tree":Bb,"collapse-all-tree":qy,"new-terminal":rl,"kill-terminal":rl,"check-for-updates":Pp,"set-up-integrations":ky,"toggle-spell-check":Sb,"open-github":Jx},tS={"open-blob-run":e=>e.openBlobRun(),"new-file":e=>{e.closePalette(),e.openNewItemDialog(`file`)},"new-folder":e=>{e.closePalette(),e.openNewItemDialog(`folder`)},"open-graph":e=>{e.closePalette(),zt(`graph`)},"open-in-new-window":e=>{e.closePalette(),e.activeDocName&&Yx(e.activeDocName,`palette`)},"initialize-starter-pack":e=>{e.closePalette(),e.openSeedDialog()},"new-skill":e=>{e.closePalette(),e.createBlankSkill()},"new-project":e=>{e.closePalette(),e.openCreateProjectDialog()},"open-folder":e=>{let t=e.bridge;t&&e.runAction(async()=>{let e=await t.dialog.openFolder();e&&await t.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})})},"open-file":e=>{let t=e.bridge;t&&e.runAction(()=>t.project.openFile())},"switch-project":e=>{let t=e.bridge;t&&e.runAction(()=>t.navigator.open(),Hc._({id:`jol95m`}))},"open-skills":e=>{e.closePalette(),Gt()},settings:e=>{e.closePalette(),window.location.hash!==`#settings`&&(window.location.hash=zc)},"install-claude-desktop":e=>{e.closePalette(),window.location.hash=`#install-claude-desktop`},"report-bug":e=>{e.closePalette(),e.openReportBugDialog()},"bug-report-history":e=>{e.closePalette(),e.openBugReportHistory()},"send-feedback":e=>{e.closePalette(),e.openFeedbackDialog()},"check-for-updates":e=>e.runAction(async()=>{await e.bridge?.update.checkNow()}),"set-up-integrations":e=>e.runAction(async()=>{await e.bridge?.mcpWiring.reconfigure()}),"toggle-spell-check":e=>e.runAction(async()=>{await e.bridge?.spellcheck.toggle()}),"open-github":e=>e.openExternalUrl(Is)};function nS(e){return{host:e.bridge===null?`web`:`desktop`,activeTargetKind:e.contextualTargetKind,singleFile:e.singleFile,terminalCapable:e.bridge!==null&&e.bridge.terminal!=null&&e.bridge.config.ptyAvailable===!0,terminalLive:e.viewMenuState.terminalLive===!0,canExpandAll:e.viewMenuState.canExpandAll!==!1,canCollapseAll:e.viewMenuState.canCollapseAll!==!1,hasActiveDoc:e.activeDocName!==null,showInstallSkill:!1}}function rS(e,t){let n=t.bridge?.platform;if(e.stateToggle){let{overrideKey:r,overrideField:i}=e.stateToggle;if(r!==void 0&&i!==void 0&&t.viewMenuState[i]===!0)return Hc._(Zx[r]);let a=t.viewMenuState[e.stateToggle.stateField]===!0?e.stateToggle.hideKey:e.stateToggle.showKey;return Hc._($x(a,n))}if(e.placementToggle){let r=t.viewMenuState.terminalPlacement===`right`?e.placementToggle.rightKey:e.placementToggle.bottomKey;return Hc._($x(r,n))}return Hc._($x(e.labelKey,n))}function iS(e){let t=e.menuActionId;return e=>e.emitMenuAction(t)}function aS(e){let t=e.palette;if(!t)throw Error(`command ${e.id} has no palette presence`);let n=eS[e.id];if(!n)throw Error(`command ${e.id} has no palette icon`);let r=e.checkField;return{id:e.id,menuActionId:e.menuActionId,label:t=>rS(e,t),keywords:e.keywords,icon:n,group:t.group,visibility:t.visibility,shortcutId:e.shortcutId,shortcutDesktopOnly:e.shortcutDesktopOnly,checked:r?e=>e.viewMenuState[r]===!0:void 0,available:t=>Fs(e.availability,nS(t)),dispatch:tS[e.id]??iS(e)}}var oS=ws.flatMap(e=>e.palette?[aS(e)]:[]),sS=`ok-omnibar-recents-v1`,cS=10;function lS(e){return typeof e==`object`&&!!e&&(e.kind===`file`||e.kind===`folder`)&&typeof e.path==`string`&&typeof e.lastOpenedAt==`string`}function uS(e){if(e)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function dS(e,t){return`${e}:${t}`}function fS(e){let t=uS(e);if(!t)return[];try{let e=t.getItem(sS);if(!e)return[];let n=JSON.parse(e);return Array.isArray(n)?n.filter(lS).slice(0,cS):[]}catch{return[]}}function pS(e,t){let n=uS(t);if(n)try{n.setItem(sS,JSON.stringify(e.slice(0,cS)))}catch(e){console.warn(`[omnibar] Failed to save recent entries:`,e)}}function mS(e,t){return[t,...e.filter(e=>e.kind!==t.kind||e.path!==t.path)].slice(0,cS)}function hS(e,t){return e.filter(e=>t.has(dS(e.kind,e.path)))}var gS=50,_S=50,vS=``,yS=null;function bS(e){return e.trim().toLowerCase()}function xS(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function SS(e){let t=e.trim();return t?[...new Set(t.split(/\s+/).filter(Boolean))].sort((e,t)=>t.length-e.length):[]}function CS(e,t,n=new Map,r=new Map,i=new Set){let a=[],o=new Set;for(let t of e){o.add(t);let e=r.get(t),i=e?.modified,s=n.get(t);a.push({kind:`file`,path:t,name:sc(t),...s&&{title:s},...e?.docExt&&{docExt:e.docExt},...i&&{modifiedTs:Date.parse(i)}})}for(let e of i)o.has(e)||(o.add(e),a.push({kind:`file`,path:e,name:sc(e),bodyIndexed:!1}));for(let e of t)a.push({kind:`folder`,path:e,name:sc(e)});return a.sort((e,t)=>{let n=e.path.localeCompare(t.path);return n===0?e.kind===t.kind?0:e.kind===`folder`?-1:1:n}),a}function wS(e){return ec({kind:e.kind===`folder`?`folder`:e.bodyIndexed===!1?`file`:`page`,path:e.path,title:e.title??e.name,modifiedTs:e.modifiedTs??0})}function TS(e){return{entries:e,byId:new Map(e.map(e=>[`${e.kind===`folder`?`folder`:e.bodyIndexed===!1?`file`:`page`}:${e.path}`,e])),corpus:Es(e.map(wS))}}function ES(e){return e.map(e=>`${e.kind}\u0000${e.path}\u0000${e.title??``}\u0000${e.docExt??``}\u0000${e.modifiedTs??0} ${e.bodyIndexed===!1?`0`:`1`}`).join(``)}function DS(e){let t=ES(e);return yS&&vS===t?yS:(vS=t,yS=TS(e),yS)}function OS(e,t,n=gS){return kS(DS(e),t,n)}function kS(e,t,n=gS){let r=bS(t);return r?po(e.corpus,r,{intent:`omnibar`,limit:n,scopes:[`page`,`folder`,`file`]}).map(t=>e.byId.get(t.document.id)).filter(e=>e!==void 0):e.entries.slice(0,20)}function AS(e,t){let n=SS(t);if(n.length===0||e.length===0)return[{text:e,match:!1,start:0}];let r=RegExp(`(${n.map(xS).join(`|`)})`,`gi`),i=[],a=0;for(let t of e.matchAll(r)){let n=t.index??0;n>a&&i.push({text:e.slice(a,n),match:!1,start:a}),i.push({text:t[0],match:!0,start:n}),a=n+t[0].length}return a<e.length&&i.push({text:e.slice(a),match:!1,start:a}),i.length>0?i:[{text:e,match:!1,start:0}]}function jS(e){if(e.kind!==`page`&&e.kind!==`folder`&&e.kind!==`file`||typeof e.path!=`string`)return null;let t=sc(e.path);return{kind:e.kind===`folder`?`folder`:`file`,path:e.path,name:t,...e.kind===`file`&&{bodyIndexed:!1},...e.title&&{title:e.title},...e.snippet&&{snippet:e.snippet},...typeof e.score==`number`&&{score:e.score}}}async function MS(e,t={}){let n=e.trim();if(!n)return{entries:[],truncated:!1,ready:!0};let r=await fetch(`/api/search`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({query:n,intent:`full_text`,ranking:t.semantic?`relevance`:`navigation`,scopes:[`page`,`folder`,`content`,`file`],limit:t.limit??_S,source:`omnibar`,...t.semantic?{semantic:!0}:{}}),signal:t.signal});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(Il(e)??`Search failed with status ${r.status}`)}let i=await r.json();return{entries:(i.results??[]).map(jS).filter(e=>!!e),truncated:i.truncated===!0,ready:i.ready!==!1}}function NS(e,t,n=[]){let r=bS(t);if(!r)return!0;let i=bS([e,...n].join(` `));return SS(r).every(e=>i.includes(e))}function PS(e,t,n={}){if(e.trim()===``)return`idle`;if(t.length===0)return`empty`;if(n.truncated)return`truncated`;for(let e of t)if(`snippet`in e&&typeof e.snippet==`string`&&e.snippet.length>0)return`content`;return`name-only`}function FS(e){let{query:t,firedQuery:n,status:r,resultCount:i}=e,a=i>0,o=t!==``&&t!==n,s=a&&(r===`loading`||t!==n),c=null;r===`error`&&t!==``?c={kind:`retry`,query:t}:o&&r!==`loading`&&(c={kind:`search`,query:t});let l=null;return r===`loading`?l=`searching`:t===``&&!a?l=`empty`:r===`success`&&!o&&!a&&(l=`no-results`),{submit:c,results:{show:a,dimmed:s,forQuery:a?n:null},notice:l}}var IS=`tag:`;function LS(e,t){if(!e.toLowerCase().startsWith(`tag:`))return{kind:`normal`,query:e};let n=e.slice(4).replace(/^\s+/,``).trim();return n&&t.has(n)?{kind:`tag-docs`,tagName:n}:{kind:`tag-list`,query:n}}function RS(e,t){return h(e,t)}var zS=_e;async function BS(e){let t=await fetch(`/api/tags/${encodeURIComponent(e)}`);if(!t.ok)throw Error(`/api/tags/${e} responded with ${t.status}`);let n=await t.json();return Array.isArray(n.docs)?n.docs:[]}var VS=(0,Q.lazy)(()=>n(()=>import(`./FeedbackForm-BAO3lafp.js`).then(e=>({default:e.FeedbackForm})),[],import.meta.url)),HS=e=>{let t=(0,$.c)(11),{open:n,onOpenChange:r,source:i,onSuccess:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)($r,{children:(0,Z.jsx)(Jr,{children:(0,Z.jsx)(Y,{id:`SItQRc`})})}),t[0]=o):o=t[0];let s;t[1]!==r||t[2]!==a?(s=()=>{r(!1),a?.()},t[1]=r,t[2]=a,t[3]=s):s=t[3];let c;t[4]!==i||t[5]!==s?(c=(0,Z.jsxs)(Yr,{children:[o,(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(VS,{source:i,onSuccess:s})})]}),t[4]=i,t[5]=s,t[6]=c):c=t[6];let l;return t[7]!==r||t[8]!==n||t[9]!==c?(l=(0,Z.jsx)(ei,{open:n,onOpenChange:r,children:c}),t[7]=r,t[8]=n,t[9]=c,t[10]=l):l=t[10],l};async function US(e){let t={path:e.path};e.template!==void 0&&(t.template=e.template);try{let n=await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),r=n.status,i=await d(n,Hc._({id:`d2uTPx`,values:{status:r}}));if(!i.ok)return{ok:!1,error:i.title};let a=yc.safeParse(i.body);return a.success?{ok:!0,docName:a.data.docName}:{ok:!1,error:e.kind===`folder`?Hc._({id:`K1ckLX`}):Hc._({id:`fJgQHX`})}}catch(e){return console.warn(`[create-page-request] create failed:`,e),{ok:!1,error:Hc._({id:`HIb0vl`})}}}function WS(e,t){window.location.hash=qp(e),t(e),Yc([`files`,`backlinks`,`graph`])}function GS(e,t){let n=e?`${e}/`:``;for(let e=1;;e++){let r=`${n}untitled${e===1?``:`-${e}`}`;if(!t.has(r))return r}}var KS=[`.md`,`.mdx`];function qS(e){let t=e.toLowerCase();for(let e of KS)if(t.endsWith(e))return e;return null}var JS={local:0,inherited:1};function YS(e){return[...e].sort((e,t)=>{let n=JS[e.scope]-JS[t.scope];if(n!==0)return n;let r=(e.title??e.name).toLowerCase(),i=(t.title??t.name).toLowerCase();return r.localeCompare(i)})}var XS=`__blank__`;function ZS(e){return e.trim()?e.includes(`..`)?`dotdot`:e.startsWith(`/`)?`leading-slash`:e.includes(`\\`)?`backslash`:e.includes(`\0`)?`null-byte`:null:`empty`}function QS(e){switch(e){case`empty`:return{id:`hYDc6B`};case`dotdot`:return{id:`Wyxs0x`};case`leading-slash`:return{id:`OYnx7O`};case`backslash`:return{id:`qo4zCg`};case`null-byte`:return{id:`saYiIO`}}}function $S(e){let t=e.fileName.trim(),n=qS(t)?t:`${t}${e.fileExtension??`.md`}`;if(e.kind===`folder`){let t=(e.folderName??``).trim();return`${e.initialDir?`${e.initialDir}/${t}`:t}/${n}`}return e.initialDir?`${e.initialDir}/${n}`:n}function eC(e,t){return Vc(e.target)?!1:Mc(e,`new-item`,t)}function tC(e){let t=e.value.lastIndexOf(`.`);t>0?e.setSelectionRange(0,t):e.select()}function nC(e){let t=(0,$.c)(136),{open:n,onOpenChange:r,kind:i,initialDir:a,suggestedName:o,initialTemplate:s,defaultToTemplate:c,description:l,onCreated:u,folderConfig:d}=e,{_:f}=Bn(),{addPage:p}=Nd(),m=hf(d?null:a),h=d??m,[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(XS),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(null),A=(0,Q.useId)(),j=(0,Q.useId)(),M=(0,Q.useId)(),N=(0,Q.useId)(),P=(0,Q.useId)(),[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(null),R=(0,Q.useRef)(null),z,B;t[0]!==s||t[1]!==i||t[2]!==n||t[3]!==o?(z=()=>{n&&(T(null),k(null),D(!1),y(``),x(i===`file`&&s?s:XS),C(!1),I(!1),_(i===`file`?o??`untitled`:`index`))},B=[n,i,o,s],t[0]=s,t[1]=i,t[2]=n,t[3]=o,t[4]=z,t[5]=B):(z=t[4],B=t[5]),(0,Q.useEffect)(z,B);let V;t[6]!==h.state.data||t[7]!==h.state.status?(V=h.state.status===`ready`?YS(h.state.data.folder.templates_available??[]):[],t[6]=h.state.data,t[7]=h.state.status,t[8]=V):V=t[8];let ee=V,H;t[9]!==h.state.data||t[10]!==h.state.status||t[11]!==n||t[12]!==b?(H=()=>{n&&b!==XS&&h.state.status===`ready`&&((h.state.data.folder.templates_available??[]).some(e=>e.name===b)||x(XS))},t[9]=h.state.data,t[10]=h.state.status,t[11]=n,t[12]=b,t[13]=H):H=t[13];let U;t[14]!==h.state||t[15]!==n||t[16]!==b?(U=[n,b,h.state],t[14]=h.state,t[15]=n,t[16]=b,t[17]=U):U=t[17],(0,Q.useEffect)(H,U);let W;t[18]!==c||t[19]!==h.state.data||t[20]!==h.state.status||t[21]!==s||t[22]!==n||t[23]!==S?(W=()=>{if(!n||!c||s||S||h.state.status!==`ready`)return;let e=YS(h.state.data.folder.templates_available??[]);e.length>0&&x(e[0].name)},t[18]=c,t[19]=h.state.data,t[20]=h.state.status,t[21]=s,t[22]=n,t[23]=S,t[24]=W):W=t[24];let G;t[25]!==c||t[26]!==h.state||t[27]!==s||t[28]!==n||t[29]!==S?(G=[n,c,s,S,h.state],t[25]=c,t[26]=h.state,t[27]=s,t[28]=n,t[29]=S,t[30]=G):G=t[30],(0,Q.useEffect)(W,G);let te=h.state.status===`loading`||h.state.status===`idle`,ne=h.state.status===`error`?h.state.message:null,re=i===`file`&&(ee.length>0||!!ne),K;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(K=function(e){_(e),T(null)},t[31]=K):K=t[31];let ie=K,q;t[32]!==g||t[33]!==v||t[34]!==a||t[35]!==i?(q=function(){return $S({kind:i,initialDir:a,fileName:g,folderName:v})},t[32]=g,t[33]=v,t[34]=a,t[35]=i,t[36]=q):q=t[36];let ae=q,oe;t[37]!==f||t[38]!==g||t[39]!==v||t[40]!==i?(oe=function(){if(i===`folder`){let e=ZS(v.trim());if(e)return{message:f({id:`ODGGlj`,values:{detail:f(QS(e))}}),field:`folder`}}let e=ZS(g.trim());return e?{message:f(QS(e)),field:`file`}:null},t[37]=f,t[38]=g,t[39]=v,t[40]=i,t[41]=oe):oe=t[41];let se=oe,ce;t[42]!==E||t[43]!==g||t[44]!==v||t[45]!==i||t[46]!==te?(ce=E||!g.trim()||i===`folder`&&!v.trim()||i===`file`&&te,t[42]=E,t[43]=g,t[44]=v,t[45]=i,t[46]=te,t[47]=ce):ce=t[47];let le=ce,ue;t[48]!==p||t[49]!==ae||t[50]!==se||t[51]!==i||t[52]!==u||t[53]!==r||t[54]!==b?(ue=async function(){let e=se();if(e){T(e.message),k(e.field);return}D(!0),T(null),k(null);let t=await US({path:ae(),template:i===`file`&&b!==XS?b:void 0,kind:i});if(D(!1),!t.ok){T(t.error),k(`form`);return}r(!1),WS(t.docName,p),u?.(t.docName)},t[48]=p,t[49]=ae,t[50]=se,t[51]=i,t[52]=u,t[53]=r,t[54]=b,t[55]=ue):ue=t[55];let de=ue,fe;t[56]!==f||t[57]!==a?(fe=a||f({id:`L6Hhh6`}),t[56]=f,t[57]=a,t[58]=fe):fe=t[58];let pe=fe,J;t[59]===i?J=t[60]:(J=(0,Z.jsx)(Jr,{children:i===`file`?(0,Z.jsx)(Y,{id:`HdkSiO`}):(0,Z.jsx)(Y,{id:`96G6Re`})}),t[59]=i,t[60]=J);let me;t[61]!==l||t[62]!==pe?(me=l??(0,Z.jsx)(Y,{id:`NvOvTi`,values:{dirDisplay:pe},components:{0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})}}),t[61]=l,t[62]=pe,t[63]=me):me=t[63];let he;t[64]===me?he=t[65]:(he=(0,Z.jsx)(qr,{children:me}),t[64]=me,t[65]=he);let ge;t[66]!==J||t[67]!==he?(ge=(0,Z.jsxs)($r,{children:[J,he]}),t[66]=J,t[67]=he,t[68]=ge):ge=t[68];let _e;t[69]!==b||t[70]!==re||t[71]!==N||t[72]!==F||t[73]!==P||t[74]!==ee||t[75]!==ne||t[76]!==te?(_e=re&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{id:N,className:`text-sm font-medium`,children:(0,Z.jsx)(Y,{id:`f65AOQ`})}),ne?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,children:(0,Z.jsx)(Y,{id:`sE7R19`,values:{templatesError:ne}})}):null,(0,Z.jsx)(iC,{triggerId:P,labelledById:N,open:F,onOpenChange:I,value:b,onValueChange:e=>{x(e),C(!0)},templates:ee,loading:te})]}),t[69]=b,t[70]=re,t[71]=N,t[72]=F,t[73]=P,t[74]=ee,t[75]=ne,t[76]=te,t[77]=_e):_e=t[77];let ve;t[78]!==f||t[79]!==w||t[80]!==O||t[81]!==A||t[82]!==j||t[83]!==v||t[84]!==i?(ve=i===`folder`&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:j,children:(0,Z.jsx)(Y,{id:`cqQyPB`})}),(0,Z.jsx)(dh,{ref:R,id:j,value:v,onChange:e=>{y(e.target.value),T(null)},placeholder:`folder-name`,autoFocus:!0,"aria-describedby":w&&(O===`folder`||O===`form`)?A:void 0,"aria-invalid":w&&(O===`folder`||O===`form`)?!0:void 0,onKeyDown:e=>{if(e.key===`Enter`){e.preventDefault();let t=ZS(v.trim());if(t){T(f({id:`ODGGlj`,values:{detail:f(QS(t))}})),k(`folder`);return}L.current?.focus()}}})]}),t[78]=f,t[79]=w,t[80]=O,t[81]=A,t[82]=j,t[83]=v,t[84]=i,t[85]=ve):ve=t[85];let ye;t[86]===i?ye=t[87]:(ye=i===`folder`?(0,Z.jsx)(Y,{id:`jjtmV_`}):(0,Z.jsx)(Y,{id:`s-XOaI`}),t[86]=i,t[87]=ye);let be;t[88]!==M||t[89]!==ye?(be=(0,Z.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:M,children:ye}),t[88]=M,t[89]=ye,t[90]=be):be=t[90];let xe;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(xe=e=>ie(e.target.value),t[91]=xe):xe=t[91];let Se=i===`file`,Ce=w&&(O===`file`||O===`form`)?A:void 0,we=w&&(O===`file`||O===`form`)?!0:void 0,Te;t[92]!==de||t[93]!==le?(Te=e=>{e.key===`Enter`&&!le&&de()},t[92]=de,t[93]=le,t[94]=Te):Te=t[94];let Ee;t[95]!==M||t[96]!==g||t[97]!==Se||t[98]!==Ce||t[99]!==we||t[100]!==Te?(Ee=(0,Z.jsx)(dh,{ref:L,id:M,value:g,onChange:xe,placeholder:`my-note`,autoFocus:Se,"aria-describedby":Ce,"aria-invalid":we,onFocus:rC,onKeyDown:Te}),t[95]=M,t[96]=g,t[97]=Se,t[98]=Ce,t[99]=we,t[100]=Te,t[101]=Ee):Ee=t[101];let De;t[102]!==w||t[103]!==A?(De=w&&(0,Z.jsx)(`p`,{id:A,role:`alert`,className:`text-1sm text-destructive`,children:w}),t[102]=w,t[103]=A,t[104]=De):De=t[104];let Oe;t[105]!==be||t[106]!==Ee||t[107]!==De?(Oe=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[be,Ee,De]}),t[105]=be,t[106]=Ee,t[107]=De,t[108]=Oe):Oe=t[108];let ke;t[109]!==_e||t[110]!==ve||t[111]!==Oe?(ke=(0,Z.jsxs)(Xr,{className:`space-y-6 pb-1`,children:[_e,ve,Oe]}),t[109]=_e,t[110]=ve,t[111]=Oe,t[112]=ke):ke=t[112];let Ae;t[113]===r?Ae=t[114]:(Ae=()=>r(!1),t[113]=r,t[114]=Ae);let je;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(je=(0,Z.jsx)(Y,{id:`dEgA5A`}),t[115]=je):je=t[115];let Me;t[116]!==E||t[117]!==Ae?(Me=(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:Ae,disabled:E,children:je}),t[116]=E,t[117]=Ae,t[118]=Me):Me=t[118];let Ne;t[119]===E?Ne=t[120]:(Ne=E?(0,Z.jsx)(Y,{id:`E9bKSA`}):(0,Z.jsx)(Y,{id:`hYgDIe`}),t[119]=E,t[120]=Ne);let Pe;t[121]!==de||t[122]!==le||t[123]!==Ne?(Pe=(0,Z.jsx)(X,{onClick:de,disabled:le,children:Ne}),t[121]=de,t[122]=le,t[123]=Ne,t[124]=Pe):Pe=t[124];let Fe;t[125]!==Me||t[126]!==Pe?(Fe=(0,Z.jsxs)(Zr,{children:[Me,Pe]}),t[125]=Me,t[126]=Pe,t[127]=Fe):Fe=t[127];let Ie;t[128]!==ge||t[129]!==ke||t[130]!==Fe?(Ie=(0,Z.jsxs)(Yr,{className:`sm:max-w-md`,"data-ok-layer-spawned":``,children:[ge,ke,Fe]}),t[128]=ge,t[129]=ke,t[130]=Fe,t[131]=Ie):Ie=t[131];let Le;return t[132]!==r||t[133]!==n||t[134]!==Ie?(Le=(0,Z.jsx)(ei,{open:n,onOpenChange:r,children:Ie}),t[132]=r,t[133]=n,t[134]=Ie,t[135]=Le):Le=t[135],Le}function rC(e){return tC(e.currentTarget)}function iC(e){let t=(0,$.c)(66),{triggerId:n,labelledById:r,open:i,onOpenChange:a,value:o,onValueChange:s,templates:c,loading:l}=e,{_:u}=Bn(),d=(0,Q.useId)(),f;if(t[0]!==c||t[1]!==o){let e;t[3]===o?e=t[4]:(e=e=>e.name===o,t[3]=o,t[4]=e),f=c.find(e),t[0]=c,t[1]=o,t[2]=f}else f=t[2];let p=f,m=o===XS,h=i?d:void 0,g=`${r} ${n}`,_;t[5]!==m||t[6]!==l||t[7]!==p?.name||t[8]!==p?.title||t[9]!==o?(_=l?(0,Z.jsx)(Y,{id:`Hl89Qd`}):m?(0,Z.jsx)(Y,{id:`E7BhZn`}):p?.title??p?.name??o,t[5]=m,t[6]=l,t[7]=p?.name,t[8]=p?.title,t[9]=o,t[10]=_):_=t[10];let v;t[11]===_?v=t[12]:(v=(0,Z.jsx)(`span`,{className:`truncate`,children:_}),t[11]=_,t[12]=v);let y;t[13]!==m||t[14]!==l||t[15]!==p?(y=!l&&!m&&p?(0,Z.jsx)(cC,{entry:p}):null,t[13]=m,t[14]=l,t[15]=p,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==y?(b=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[v,y]}),t[17]=v,t[18]=y,t[19]=b):b=t[19];let x;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(kd,{className:`ml-2 size-4 shrink-0 opacity-50`,"aria-hidden":`true`}),t[20]=x):x=t[20];let S;t[21]!==l||t[22]!==i||t[23]!==h||t[24]!==g||t[25]!==b||t[26]!==n?(S=(0,Z.jsx)(fh,{asChild:!0,children:(0,Z.jsxs)(X,{id:n,type:`button`,variant:`outline`,role:`combobox`,"aria-expanded":i,"aria-haspopup":`listbox`,"aria-controls":h,"aria-labelledby":g,disabled:l,className:`w-full justify-between font-normal`,children:[b,x]})}),t[21]=l,t[22]=i,t[23]=h,t[24]=g,t[25]=b,t[26]=n,t[27]=S):S=t[27];let C;t[28]===u?C=t[29]:(C=u({id:`UQAp48`}),t[28]=u,t[29]=C);let w;t[30]===C?w=t[31]:(w=(0,Z.jsx)(Jt,{placeholder:C}),t[30]=C,t[31]=w);let T;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(mt,{children:(0,Z.jsx)(Y,{id:`c8iK2Y`})}),t[32]=T):T=t[32];let E;if(t[33]!==a||t[34]!==s||t[35]!==c||t[36]!==o){let e;t[38]!==a||t[39]!==s||t[40]!==o?(e=e=>{let t=e.title??e.name,n=e.title&&e.title!==e.name?e.name:void 0,r=`${e.scope}:${e.source_folder}:${e.name}`;return(0,Z.jsxs)(fn,{value:r,keywords:[t,e.name,e.description??``,e.scope,e.source_folder??``],onSelect:()=>{s(e.name),a(!1)},className:`items-start gap-3`,children:[(0,Z.jsx)(Uu,{className:gr(`mt-1 size-4 shrink-0`,o===e.name?`opacity-100`:`opacity-0`),"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium`,children:t}),n?(0,Z.jsx)(`code`,{className:`font-mono text-2xs text-muted-foreground shrink-0`,children:n}):null,(0,Z.jsx)(cC,{entry:e,className:`ml-auto`})]}),e.description?(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:e.description}):null]})]},r)},t[38]=a,t[39]=s,t[40]=o,t[41]=e):e=t[41],E=c.map(e),t[33]=a,t[34]=s,t[35]=c,t[36]=o,t[37]=E}else E=t[37];let D;t[42]!==a||t[43]!==s?(D=()=>{s(XS),a(!1)},t[42]=a,t[43]=s,t[44]=D):D=t[44];let O=o===XS?`opacity-100`:`opacity-0`,k;t[45]===O?k=t[46]:(k=gr(`mt-1 size-4 shrink-0`,O),t[45]=O,t[46]=k);let A;t[47]===k?A=t[48]:(A=(0,Z.jsx)(Uu,{className:k,"aria-hidden":`true`}),t[47]=k,t[48]=A);let j;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(`span`,{className:`text-sm font-medium`,children:(0,Z.jsx)(Y,{id:`E7BhZn`})}),t[49]=j):j=t[49];let M;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[j,(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`hZoBHK`})})]}),t[50]=M):M=t[50];let N;t[51]!==D||t[52]!==A?(N=(0,Z.jsxs)(fn,{value:`Blank note empty`,onSelect:D,className:`items-start gap-3`,children:[A,M]}),t[51]=D,t[52]=A,t[53]=N):N=t[53];let P;t[54]!==d||t[55]!==E||t[56]!==N?(P=(0,Z.jsxs)(At,{id:d,className:`subtle-scrollbar`,children:[T,E,N]}),t[54]=d,t[55]=E,t[56]=N,t[57]=P):P=t[57];let F;t[58]!==w||t[59]!==P?(F=(0,Z.jsx)(ph,{className:`w-[var(--radix-popover-trigger-width)] p-0`,align:`start`,onOpenAutoFocus:sC,onWheel:oC,onTouchMove:aC,children:(0,Z.jsxs)(de,{children:[w,P]})}),t[58]=w,t[59]=P,t[60]=F):F=t[60];let I;return t[61]!==a||t[62]!==i||t[63]!==F||t[64]!==S?(I=(0,Z.jsxs)(hh,{open:i,onOpenChange:a,children:[S,F]}),t[61]=a,t[62]=i,t[63]=F,t[64]=S,t[65]=I):I=t[65],I}function aC(e){e.stopPropagation()}function oC(e){e.stopPropagation()}function sC(e){e.preventDefault(),e.currentTarget.querySelector(`[cmdk-input]`)?.focus()}function cC(e){let t=(0,$.c)(7),{entry:n,className:r}=e;if(n.scope===`inherited`){let e;t[0]===r?e=t[1]:(e=gr(`shrink-0 text-2xs`,r),t[0]=r,t[1]=e);let i;t[2]===n.source_folder?i=t[3]:(i=n.source_folder||(0,Z.jsx)(Y,{id:`ZNK2Tq`}),t[2]=n.source_folder,t[3]=i);let a;return t[4]!==e||t[5]!==i?(a=(0,Z.jsx)(Sh,{variant:`gray`,className:e,children:i}),t[4]=e,t[5]=i,t[6]=a):a=t[6],a}return null}var lC=`knowledge-base`;function uC(e){let t=(0,$.c)(69),{open:n,onOpenChange:r,onSeedApplied:i,initialPackId:a}=e,{_:o}=Bn(),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={kind:`loading`},t[0]=s):s=t[0];let[c,l]=(0,Q.useState)(s),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(a??lC),[m,h]=(0,Q.useState)(`project-root`),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(a===void 0?`pick`:`configure`),b=(0,Q.useRef)(!0),x=u?.find(e=>e.id===f),S,C;t[1]!==n||t[2]!==u?(S=()=>{if(!n||u!==null)return;let e=!1;return(async()=>{try{let t=await _x().listPacks();if(e)return;t.ok?d(t.packs):(d([]),l({kind:`error`,message:t.error.message}))}catch(t){let n=t;if(e)return;d([]),l({kind:`error`,message:n instanceof Error?n.message:String(n)})}})(),()=>{e=!0}},C=[n,u],t[1]=n,t[2]=u,t[3]=S,t[4]=C):(S=t[3],C=t[4]),(0,Q.useEffect)(S,C);let w,T;t[5]!==a||t[6]!==n?(w=()=>{n&&(p(a??lC),h(`project-root`),_(``),y(a===void 0?`pick`:`configure`),l({kind:`loading`}),b.current=!0)},T=[n,a],t[5]=a,t[6]=n,t[7]=w,t[8]=T):(w=t[7],T=t[8]),(0,Q.useEffect)(w,T),(0,Q.useEffect)(()=>{x&&_(x.defaultSubfolder??``)},[x]);let E;t[9]===g?E=t[10]:(E=g.trim(),t[9]=g,t[10]=E);let D=E,O=m===`subfolder`&&D===``,k,A;t[11]!==o||t[12]!==n||t[13]!==u||t[14]!==m||t[15]!==f||t[16]!==v||t[17]!==O||t[18]!==D?(k=()=>{if(!n||v!==`configure`||u===null)return;if(O){l({kind:`error`,message:o({id:`Z8KDox`})});return}let e=m===`project-root`?void 0:D,t=b.current?0:200;b.current=!1;let r=!1,i=setTimeout(()=>{r||(l(fC),_x().plan({rootDir:e,packId:f}).then(e=>{if(!r){if(!e.ok){l({kind:`error`,message:e.error.message});return}l(as(e.plan)?{kind:`plan`,plan:e.plan}:{kind:`already-seeded`,plan:e.plan})}}).catch(e=>{r||l({kind:`error`,message:e instanceof Error?e.message:String(e)})}))},t);return()=>{r=!0,clearTimeout(i)}},A=[n,v,u,f,m,D,O,o],t[11]=o,t[12]=n,t[13]=u,t[14]=m,t[15]=f,t[16]=v,t[17]=O,t[18]=D,t[19]=k,t[20]=A):(k=t[19],A=t[20]),(0,Q.useEffect)(k,A);let j=async function(){if(c.kind!==`plan`)return;let e=c.plan;l({kind:`applying`,plan:e});let t;try{t=await _x().apply(e,{packId:f})}catch(t){let n=t,r=n instanceof Error?n.message:String(n);Dc.error(o({id:`iqugog`,values:{errorDetail:r}})),l({kind:`plan`,plan:e});return}if(t.ok){let n=x?.name??o({id:`W8vpBM`}),a=t.result.applied,s=e.packSkills?.some(dC)===!0,c=o(a>0?{id:`x3-2ta`,values:{packName:n,projectEntries:a}}:s?{id:`B2Srgd`,values:{packName:n}}:{id:`K6jjWB`,values:{packName:n}});Dc.success(c);for(let e of t.result.packSkillConflicts??[]){let t=e.name,n=e.hosts?.join(`, `);Dc.warning(o(n===void 0||n===``?{id:`GifIjR`,values:{conflictName:t}}:{id:`Mv2lM4`,values:{conflictName:t,conflictHosts:n}}))}i?.(),r(!1)}else{let n=t.error.message;Dc.error(o({id:`iqugog`,values:{errorDetail:n}})),l({kind:`plan`,plan:e})}},M=a!==void 0,N=x?.name,P=o(v===`configure`&&x?{id:`hxEUVJ`,values:{selectedPackName:N}}:{id:`RGkNeJ`}),F=x?Dx[x.id]:void 0,I;t[21]!==o||t[22]!==F||t[23]!==x||t[24]!==v?(I=v===`configure`&&x?F?o(F):x.description:o({id:`msqUNq`}),t[21]=o,t[22]=F,t[23]=x,t[24]=v,t[25]=I):I=t[25];let L=I,R;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){p(e),y(`configure`),b.current=!0},t[26]=R):R=t[26];let z=R,B;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(){y(`pick`),l({kind:`loading`}),b.current=!0},t[27]=B):B=t[27];let V=B,ee;t[28]===P?ee=t[29]:(ee=(0,Z.jsx)(Jr,{children:P}),t[28]=P,t[29]=ee);let H;t[30]===L?H=t[31]:(H=(0,Z.jsx)(qr,{children:L}),t[30]=L,t[31]=H);let U;t[32]!==ee||t[33]!==H?(U=(0,Z.jsxs)($r,{children:[ee,H]}),t[32]=ee,t[33]=H,t[34]=U):U=t[34];let W;t[35]!==u||t[36]!==c||t[37]!==m||t[38]!==x||t[39]!==v||t[40]!==g?(W=v===`pick`?(0,Z.jsx)(Xr,{children:(0,Z.jsx)(bx,{packs:u,onPackSelect:z})}):(0,Z.jsxs)(Xr,{className:`space-y-6`,children:[(0,Z.jsx)(Ex,{choice:m,subfolder:g,placeholder:x?.defaultSubfolder??`subfolder`,onChoiceChange:h,onSubfolderChange:_}),(0,Z.jsx)(pC,{phase:c,selectedPack:x})]}),t[35]=u,t[36]=c,t[37]=m,t[38]=x,t[39]=v,t[40]=g,t[41]=W):W=t[41];let G;t[42]!==M||t[43]!==v?(G=v===`configure`&&!M?(0,Z.jsxs)(X,{className:`me-auto uppercase font-mono`,variant:`ghost`,onClick:V,children:[(0,Z.jsx)(Au,{"aria-hidden":`true`,className:`h-4 w-4`}),(0,Z.jsx)(Y,{id:`iH8pgl`})]}):null,t[42]=M,t[43]=v,t[44]=G):G=t[44];let te;t[45]===r?te=t[46]:(te=()=>r(!1),t[45]=r,t[46]=te);let ne;t[47]===c.kind?ne=t[48]:(ne=c.kind===`already-seeded`||c.kind===`error`?(0,Z.jsx)(Y,{id:`yz7wBu`}):(0,Z.jsx)(Y,{id:`dEgA5A`}),t[47]=c.kind,t[48]=ne);let re;t[49]!==te||t[50]!==ne?(re=(0,Z.jsx)(X,{className:`uppercase font-mono`,variant:`outline`,onClick:te,children:ne}),t[49]=te,t[50]=ne,t[51]=re):re=t[51];let K;t[52]!==j||t[53]!==c.kind||t[54]!==v||t[55]!==O?(K=v===`configure`&&c.kind===`plan`?(0,Z.jsx)(X,{onClick:j,disabled:O,children:(0,Z.jsx)(Y,{id:`4TzU0n`})}):v===`configure`&&c.kind===`applying`?(0,Z.jsxs)(X,{disabled:!0,children:[(0,Z.jsx)(ip,{"aria-hidden":`true`,className:`h-4 w-4`}),(0,Z.jsx)(Y,{id:`XYlJJT`})]}):null,t[52]=j,t[53]=c.kind,t[54]=v,t[55]=O,t[56]=K):K=t[56];let ie;t[57]!==G||t[58]!==re||t[59]!==K?(ie=(0,Z.jsxs)(Zr,{children:[G,re,K]}),t[57]=G,t[58]=re,t[59]=K,t[60]=ie):ie=t[60];let q;t[61]!==U||t[62]!==W||t[63]!==ie?(q=(0,Z.jsxs)(Yr,{className:`sm:max-w-4xl`,"data-ok-layer-spawned":``,children:[U,W,ie]}),t[61]=U,t[62]=W,t[63]=ie,t[64]=q):q=t[64];let ae;return t[65]!==r||t[66]!==n||t[67]!==q?(ae=(0,Z.jsx)(ei,{open:n,onOpenChange:r,children:q}),t[65]=r,t[66]=n,t[67]=q,t[68]=ae):ae=t[68],ae}function dC(e){return e.pending}function fC(e){return e.kind===`plan`||e.kind===`already-seeded`?e:{kind:`loading`}}function pC(e){let t=(0,$.c)(19),{phase:n,selectedPack:r}=e;if(n.kind===`loading`){let e=r?.folders.length??6,n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(tx,{rowCount:e}),t[0]=e,t[1]=n),n}if(n.kind===`error`){let e;return t[2]===n.message?e=t[3]:(e=(0,Z.jsx)(`div`,{className:`rounded-md bg-destructive/10 p-3 text-sm text-destructive`,children:n.message}),t[2]=n.message,t[3]=e),e}if(n.kind===`already-seeded`){let e;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`p`,{className:`font-medium`,children:(0,Z.jsx)(Y,{id:`YwPUUP`})}),t[4]=e):e=t[4];let r;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`div`,{children:[e,(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`h-AdvS`})})]}),t[5]=r):r=t[5];let i;return t[6]===n.plan?i=t[7]:(i=(0,Z.jsxs)(`div`,{className:`space-y-3 py-2 text-sm`,children:[r,(0,Z.jsx)(hC,{plan:n.plan})]}),t[6]=n.plan,t[7]=i),i}let i;t[8]!==n.plan||t[9]!==r?(i=as(n.plan)?(0,Z.jsx)(ox,{plan:n.plan,selectedPack:r}):null,t[8]=n.plan,t[9]=r,t[10]=i):i=t[10];let a;t[11]===n.plan.warnings?a=t[12]:(a=n.plan.warnings.length>0?(0,Z.jsx)(`div`,{className:`rounded-md bg-warning/10 p-3 text-xs text-warning-foreground`,children:n.plan.warnings.map(mC)}):null,t[11]=n.plan.warnings,t[12]=a);let o;t[13]===n.plan?o=t[14]:(o=(0,Z.jsx)(hC,{plan:n.plan}),t[13]=n.plan,t[14]=o);let s;return t[15]!==i||t[16]!==a||t[17]!==o?(s=(0,Z.jsxs)(`div`,{className:`space-y-6 py-1 text-sm`,children:[i,a,o]}),t[15]=i,t[16]=a,t[17]=o,t[18]=s):s=t[18],s}function mC(e){return(0,Z.jsx)(`p`,{children:e},e)}function hC(e){let t=(0,$.c)(7),{plan:n}=e,r,i,a;if(t[0]!==n.packSkills){a=Symbol.for(`react.early_return_sentinel`);bb0:{let e=n.packSkills?.filter(_C)??[];if(e.length===0){a=null;break bb0}r=`rounded-md bg-warning/10 p-3 text-xs text-warning-foreground`,i=e.map(gC)}t[0]=n.packSkills,t[1]=r,t[2]=i,t[3]=a}else r=t[1],i=t[2],a=t[3];if(a!==Symbol.for(`react.early_return_sentinel`))return a;let o;return t[4]!==r||t[5]!==i?(o=(0,Z.jsx)(`div`,{className:r,children:i}),t[4]=r,t[5]=i,t[6]=o):o=t[6],o}function gC(e){return(0,Z.jsx)(`p`,{children:(0,Z.jsx)(Y,{id:`CtoghX`,values:{0:e.name}})},e.name)}function _C(e){return e.conflict}var vC=`Describe what this skill does and when to use it.`;function yC(){let e=(0,$.c)(8),{_:t}=Bn(),n=Fh(),r=Zf(),[i,a]=(0,Q.useState)(!1),o;e[0]!==t||e[1]!==i||e[2]!==r||e[3]!==n?(o=async function(e,o){let s=e===void 0?`project`:e;if(i)return;let c=o?.name?.trim()||`new-skill`;if(a(!0),!o?.name){let e=sh(n.status===`ready`?n.data:[])[s];if(n.status!==`ready`){let n=await Rm(s);if(!n.ok){a(!1),Dc.error(t({id:`xrVr_k`,values:{0:n.error}}));return}e=sh(n.skills)[s]}for(let t=2;e.has(c);t++)c=`new-skill-${t}`}let l=o?.description?.trim()||`Describe what this skill does and when to use it.`,u=await Gm({scope:s,name:c,frontmatter:{name:c,description:l},body:``});if(a(!1),!u.ok){Dc.error(t({id:`xrVr_k`,values:{0:u.error}}));return}Dc.success(t({id:`Yy90sM`,values:{name:c}})),r(s,c,u.path===void 0?void 0:{path:u.path})},e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=o):o=e[4];let s=o,c;return e[5]!==s||e[6]!==i?(c={createBlank:s,creating:i},e[5]=s,e[6]=i,e[7]=c):c=e[7],c}function bC(){return(0,Q.useSyncExternalStore)(Ih,Lh,Lh)}function xC(e,t){return e instanceof Error&&e.message?e.message:t}async function SC(e,t,n,r=`action`){try{n(null),await e()}catch(e){console.error(`[${r}] action failed:`,e),n(xC(e,t))}}async function CC(e,t,n=Dc,r=`action`){await SC(e,t,e=>{e!==null&&n.error(e)},r)}var wC=(0,Q.createContext)(!1);function TC(e){let t=(0,$.c)(5),{children:n}=e,[r,i]=(0,Q.useState)(DC),a,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{if(window.okDesktop)return;let e=new AbortController;return Pm(e.signal).then(t=>{e.signal.aborted||t.status!==`ok`||i(t.config.singleFile)}).catch(EC),()=>e.abort()},o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Q.useEffect)(a,o);let s;return t[2]!==n||t[3]!==r?(s=(0,Z.jsx)(wC,{value:r,children:n}),t[2]=n,t[3]=r,t[4]=s):s=t[4],s}function EC(){}function DC(){return typeof window<`u`?window.okDesktop?.config.singleFile??!1:!1}function OC(){return(0,Q.use)(wC)}function kC(e){return e.opened?e.isMain?`primary`:`worktree`:`none`}function AC(e,t,n){let r=[],i=new Set,a=new Set,o=t!==null&&t.mainRoot===e.project.mainRoot;e.projectSynthesized||(r.push({branch:e.project.branch??null,path:e.project.path,opened:!0,isMain:!0,isCurrent:e.project.path===n}),i.add(e.project.path),e.project.branch!=null&&a.add(e.project.branch));let s=[...e.worktrees].sort((e,t)=>t.lastOpenedAt.localeCompare(e.lastOpenedAt));for(let e of s)i.has(e.path)||(r.push({branch:e.branch??null,path:e.path,opened:!0,isMain:!1,isCurrent:e.path===n}),i.add(e.path),e.branch!=null&&a.add(e.branch));if(o){let e=t.entries.filter(e=>e.branch!==null&&!a.has(e.branch)&&(e.worktreePath===null||!i.has(e.worktreePath))).sort((e,t)=>(e.branch??``).localeCompare(t.branch??``));for(let t of e)r.push({branch:t.branch,path:t.worktreePath,opened:t.worktreePath!==null,isMain:t.isMain,isCurrent:t.isCurrent}),t.branch!=null&&a.add(t.branch),t.worktreePath!=null&&i.add(t.worktreePath)}return r.sort((e,t)=>jC(e)-jC(t))}function jC(e){return e.isMain?0:e.opened?1:2}function MC(e){let t=e.split(/[/\\]/).filter(e=>e.length>0);return t.length>0?t[t.length-1]??e:e}function NC(e){let t=[],n=new Map;for(let r of e){let e=r.gitCommonDir,i=r.mainRoot;if(e===void 0||i===void 0){t.push({project:r,mainRoot:r.path,worktrees:[]});continue}let a=n.get(e);a===void 0&&(a=t.length,n.set(e,a),t.push({project:null,mainRoot:i,worktrees:[]}));let o=t[a];o!==void 0&&(r.isLinkedWorktree?o.worktrees.push(r):o.project===null&&(o.project=r))}return t.map(e=>{let t=e.project===null;return{project:e.project??{path:e.mainRoot,name:MC(e.mainRoot),lastOpenedAt:``},worktrees:e.worktrees,projectSynthesized:t}})}function PC(e){let t=(0,$.c)(14),{path:n,name:r,onRemoveRecent:i,testIdPrefix:a}=e,{_:o}=Bn(),s;t[0]!==o||t[1]!==r?(s=o({id:`Y6PKd1`,values:{name:r}}),t[0]=o,t[1]=r,t[2]=s):s=t[2];let c;t[3]===o?c=t[4]:(c=o({id:`Es-eZU`}),t[3]=o,t[4]=c);let l;t[5]!==i||t[6]!==n?(l=e=>{e.stopPropagation(),i(n)},t[5]=i,t[6]=n,t[7]=l):l=t[7];let u=`${a}-remove-${n}`,d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(zp,{"aria-hidden":`true`,className:`size-3.5`}),t[8]=d):d=t[8];let f;return t[9]!==s||t[10]!==c||t[11]!==l||t[12]!==u?(f=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,tabIndex:-1,"aria-hidden":`true`,"aria-label":s,title:c,onClick:l,className:`absolute top-1/2 right-1 size-6 -translate-y-1/2 text-muted-foreground opacity-0 transition-opacity group-hover/recent:opacity-100 focus-visible:opacity-100`,"data-testid":u,children:d}),t[9]=s,t[10]=c,t[11]=l,t[12]=u,t[13]=f):f=t[13],f}function FC(e){let t=(0,$.c)(13),{path:n,onRemoveRecent:r,testIdPrefix:i,children:a}=e,o;t[0]===a?o=t[1]:(o=(0,Z.jsx)(ta,{asChild:!0,children:a}),t[0]=a,t[1]=o);let s;t[2]!==r||t[3]!==n?(s=()=>r(n),t[2]=r,t[3]=n,t[4]=s):s=t[4];let c=`${i}-context-remove-${n}`,l,u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(zp,{"aria-hidden":`true`}),u=(0,Z.jsx)(Y,{id:`Es-eZU`}),t[5]=l,t[6]=u):(l=t[5],u=t[6]);let d;t[7]!==s||t[8]!==c?(d=(0,Z.jsx)(ra,{children:(0,Z.jsxs)(Zi,{onSelect:s,"data-testid":c,children:[l,u]})}),t[7]=s,t[8]=c,t[9]=d):d=t[9];let f;return t[10]!==o||t[11]!==d?(f=(0,Z.jsxs)(ea,{children:[o,d]}),t[10]=o,t[11]=d,t[12]=f):f=t[12],f}var IC=(0,Q.lazy)(()=>n(()=>import(`./BugReportHistoryDialog-DGj_pTZf.js`),__vite__mapDeps([6,7,1,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,2,3,29,30,31,32,33,4,34,35,36,37]),import.meta.url)),LC=3e3,RC=600,zC=20,BC=(e,t,n)=>CC(e,t,n,`CommandPalette`);function VC(e){window.location.assign(qp(e))}function HC(e,t){return e?.kind===`folder`||e?.kind===`folder-index`?e.folderPath:xm(t)}function UC(e){let t=(0,$.c)(27),{entry:n,query:r,onSelect:i,disabled:a}=e,o=r===void 0?``:r,s=a===void 0?!1:a,c;t[0]===n?c=t[1]:(c=`title`in n&&n.title?n.title:n.path.split(`/`).pop()??n.path,t[0]=n,t[1]=c);let l=c,u=`snippet`in n?n.snippet:void 0,d=`docExt`in n?n.docExt:void 0,f=`bodyIndexed`in n?n.bodyIndexed:void 0,p=`${n.kind} ${n.path}`,m=`command-palette-nav-${n.kind}-${n.path}`,h;t[2]!==f||t[3]!==d||t[4]!==n.kind||t[5]!==n.path?(h=(0,Z.jsx)(K,{bodyIndexed:f,className:`mt-0.5 size-4`,docExt:d,kind:n.kind,path:n.path}),t[2]=f,t[3]=d,t[4]=n.kind,t[5]=n.path,t[6]=h):h=t[6];let g;t[7]!==o||t[8]!==l?(g=(0,Z.jsx)(Mu,{className:`truncate font-medium`,children:(0,Z.jsx)(GC,{query:o,text:l})}),t[7]=o,t[8]=l,t[9]=g):g=t[9];let _;t[10]!==n.path||t[11]!==o?(_=(0,Z.jsx)(Mu,{className:`truncate text-muted-foreground text-xs`,children:(0,Z.jsx)(GC,{query:o,text:n.path})}),t[10]=n.path,t[11]=o,t[12]=_):_=t[12];let v;t[13]!==o||t[14]!==u?(v=u?(0,Z.jsx)(Mu,{className:`max-h-10 overflow-hidden text-muted-foreground text-xs leading-relaxed`,children:(0,Z.jsx)(GC,{query:o,text:u})}):null,t[13]=o,t[14]=u,t[15]=v):v=t[15];let y;t[16]!==g||t[17]!==_||t[18]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[g,_,v]}),t[16]=g,t[17]=_,t[18]=v,t[19]=y):y=t[19];let b;return t[20]!==s||t[21]!==i||t[22]!==y||t[23]!==p||t[24]!==m||t[25]!==h?(b=(0,Z.jsxs)(fn,{value:p,onSelect:i,disabled:s,"data-testid":m,className:`items-start`,children:[h,y]}),t[20]=s,t[21]=i,t[22]=y,t[23]=p,t[24]=m,t[25]=h,t[26]=b):b=t[26],b}function WC(e){let t=(0,$.c)(5),{mode:n,inExclusiveMode:r,paletteModeKind:i}=e;if(r||i!==`normal`||n===`idle`||n===`content`)return null;let a=`command-palette-search-hint-${n}`,o;t[0]===n?o=t[1]:(o=n===`name-only`?(0,Z.jsx)(Y,{id:`GuLeuE`,values:{0:Lc(`find`)},components:{0:(0,Z.jsx)(en,{"aria-label":Ac(`find`)})}}):n===`truncated`?(0,Z.jsx)(Y,{id:`-q4abP`}):(0,Z.jsx)(Y,{id:`DbILZA`}),t[0]=n,t[1]=o);let s;return t[2]!==a||t[3]!==o?(s=(0,Z.jsx)(`div`,{"aria-live":`polite`,"data-testid":a,className:`border-t px-3 py-2 text-muted-foreground text-xs`,children:o}),t[2]=a,t[3]=o,t[4]=s):s=t[4],s}function GC(e){let t=(0,$.c)(5),{text:n,query:r}=e,i;t[0]!==r||t[1]!==n?(i=AS(n,r).map(KC),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a;return t[3]===i?a=t[4]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[3]=i,t[4]=a),a}function KC(e){let t=`${e.start}:${e.match?`match`:`plain`}`;return e.match?(0,Z.jsx)(`mark`,{className:`rounded-sm bg-primary/10 px-0.5 font-semibold text-primary`,children:e.text},t):(0,Z.jsx)(`span`,{children:e.text},t)}function qC({searchResults:e,fallbackSearchResults:t,searchStatus:n}){return e.length>0?e:n===`success`?[]:t}function JC(e){let t=(0,$.c)(150),{bridge:n,open:r,onOpenChange:a}=e,o=n===void 0?null:n,{_:s}=Bn(),c=OC(),[l,u]=(0,Q.useState)(``),d=(0,Q.useDeferredValue)(l),f=d.trim(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=[],t[0]=p):p=t[0];let[m,h]=(0,Q.useState)(p),[g,_]=(0,Q.useState)(`idle`),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(!1),w;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(w=[],t[1]=w):w=t[1];let[T,E]=(0,Q.useState)(w),[D,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(`idle`),j;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(j=[],t[2]=j):j=t[2];let[M,N]=(0,Q.useState)(j),P;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(P=[],t[3]=P):P=t[3];let[F,I]=(0,Q.useState)(P),[L,R]=(0,Q.useState)(null),[z,B]=(0,Q.useState)(!1),[V,ee]=(0,Q.useState)(!1),[H,U]=(0,Q.useState)(null),[W,G]=(0,Q.useState)(!1),[te,ne]=(0,Q.useState)(!1),[re,K]=(0,Q.useState)(!1),{createBlank:ie}=yC(),q=Yt(),ae;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(ae=[],t[4]=ae):ae=t[4];let[oe,se]=(0,Q.useState)(ae),[ce,le]=(0,Q.useState)(`idle`),ue;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(ue=[],t[5]=ue):ue=t[5];let[de,fe]=(0,Q.useState)(ue),[pe,J]=(0,Q.useState)(`idle`),me=(0,Q.useRef)(!1),he=(0,Q.useRef)(null),ge=(0,Q.useRef)(null),_e=(0,Q.useRef)(null),ve=(0,Q.useRef)(null),{activeDocName:ye,activeTarget:be}=Et(),{pages:xe,pageTitles:Se,pageMeta:Ce,folderPaths:we,filePaths:Te,loading:Ee}=Nd(),De=gu(),{states:Oe,refresh:ke}=Sr(),{dispatch:Ae}=Ll(),je;t[6]===r?je=t[7]:(je={enabled:r},t[6]=r,t[7]=je);let{status:Me,refresh:Ne}=Rd(je),Pe=(Me?.enabled??!1)&&(Me?.keyPresent??!1),Fe=Me?.embedded??0,Ie=Me?.total??0,Le=Pe&&Ie>0&&Fe<Ie,Re;t[8]!==S||t[9]!==r||t[10]!==Ne||t[11]!==Le?(Re=()=>{if(!r||!S||!Le)return;let e=window.setInterval(()=>Ne(),2500);return()=>window.clearInterval(e)},t[8]=S,t[9]=r,t[10]=Ne,t[11]=Le,t[12]=Re):Re=t[12];let ze;t[13]!==S||t[14]!==r||t[15]!==Le?(ze=[r,S,Le],t[13]=S,t[14]=r,t[15]=Le,t[16]=ze):ze=t[16],(0,Q.useEffect)(Re,ze);let Ve=Rl({docName:ye,workspace:De}),He=CS(xe,we,Se,Ce,Te),Ue=hS(F,new Set(He.map(QC))),We=o?.config.projectPath??null,Ge=o?M.filter(e=>e.path!==We):[],Ke=bC(),qe=o&&Ke?Ke.entries.filter(ZC):[],Je;t[17]!==ye||t[18]!==be?(Je=HC(be,ye),t[17]=ye,t[18]=be,t[19]=Je):Je=t[19];let Ye=Je,Xe=f===``?[]:OS(He,f,8),Qe,$e;t[20]!==a||t[21]!==r?(Qe=()=>{let e=function(e){Mc(e,`command-palette`)&&(e.preventDefault(),!(!r&&Mr())&&a(!r))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},$e=[a,r],t[20]=a,t[21]=r,t[22]=Qe,t[23]=$e):(Qe=t[22],$e=t[23]),(0,Q.useEffect)(Qe,$e);let et,tt;t[24]!==s||t[25]!==o||t[26]!==r||t[27]!==ke?(et=()=>{if(r){if(I(fS()),ke(),o){let e=!1;return BC(async()=>{let t=await o.project.listRecent();e||N(t)},s({id:`fYKgzG`})),()=>{e=!0}}return}u(``),se([]),le(`idle`),me.current=!1,fe([]),J(`idle`),C(!1),_e.current?.abort(),_e.current=null,ve.current!==null&&(window.clearTimeout(ve.current),ve.current=null),E([]),O(null),A(`idle`)},tt=[r,o,ke,s],t[24]=s,t[25]=o,t[26]=r,t[27]=ke,t[28]=et,t[29]=tt):(et=t[28],tt=t[29]),(0,Q.useEffect)(et,tt);let nt;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(nt=()=>{he.current&&(he.current.scrollTop=0)},t[30]=nt):nt=t[30];let rt;t[31]===l?rt=t[32]:(rt=[l],t[31]=l,t[32]=rt),(0,Q.useEffect)(nt,rt);let it=new Set(oe.map(XC)),at=S?{kind:`normal`,query:d}:LS(d,it),ot=at.kind!==`normal`,st=ot||S,ct=at.kind===`tag-list`?at.query:``,lt=at.kind===`tag-docs`?at.tagName:``,ut=l.trim(),dt=S?FS({query:ut,firedQuery:D,status:k,resultCount:T.length}):null,ft=dt?.submit?.query??``,ht=dt?.results.forQuery??``,gt,_t;t[33]!==ot||t[34]!==r?(gt=()=>{if(!r||!ot||me.current)return;me.current=!0,le(`loading`);let e=!1;return zS().then(t=>{e||(se(t),le(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tags failed`,t),se([]),le(`error`))}),()=>{e=!0}},_t=[r,ot],t[33]=ot,t[34]=r,t[35]=gt,t[36]=_t):(gt=t[35],_t=t[36]),(0,Q.useEffect)(gt,_t);let vt=at.kind===`tag-docs`?at.tagName:null;(0,Q.useEffect)(()=>{if(!r||vt===null){fe([]),J(`idle`);return}J(`loading`),fe([]);let e=!1;return BS(vt).then(t=>{e||(fe(t),J(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tag docs failed`,t),fe([]),J(`error`))}),()=>{e=!0}},[r,vt]),(0,Q.useEffect)(()=>{if(!r||!f||st||Ee){h([]),_(`idle`),y(!1),x(!1);return}let e=!1,t=!1,n=0,i=null,a,o;_(`loading`);let s=()=>e||n>=zC?!1:(n+=1,o=window.setTimeout(l,RC),!0),c=()=>{e||t&&s()||(h([]),_(`error`),y(!1),x(!1))};function l(){let n=new AbortController;i=n,a=window.setTimeout(()=>{n.abort(),c()},LC),MS(f,{signal:n.signal}).then(n=>{let{entries:r,truncated:i,ready:o}=n;if(window.clearTimeout(a),!e){if(!o){t||(t=!0,h([]),y(!1),x(!0),_(`success`)),s()||x(!1);return}h(r),y(i),x(!1),_(`success`)}}).catch(t=>{window.clearTimeout(a),!e&&(t instanceof Error&&t.name===`AbortError`||c())})}return l(),()=>{e=!0,window.clearTimeout(a),window.clearTimeout(o),i?.abort()}},[r,f,st,Ee]);let yt;t[37]!==s||t[38]!==a?(yt=(e,t)=>{let n=t===void 0?s({id:`uuoHOU`}):t;a(!1),BC(async()=>{await e()},n)},t[37]=s,t[38]=a,t[39]=yt):yt=t[39];let bt=yt,xt;t[40]!==s||t[41]!==o?(xt=e=>{o&&BC(async()=>{await o.project.removeRecent(e),N(t=>t.filter(t=>t.path!==e))},s({id:`viwC-K`}))},t[40]=s,t[41]=o,t[42]=xt):xt=t[42];let St=xt,Ct;t[43]!==s||t[44]!==o||t[45]!==bt?(Ct=e=>{if(!o)return;let t=e.worktreePath;if(t!==null){bt(()=>o.project.open({path:t,target:`new-window`,entryPoint:`worktree`}),s({id:`LwMxXg`}));return}let n=e.branch;n!==null&&bt(async()=>{let e=await o.worktree.create({branch:n,createBranch:!1});if(!e.ok)throw Error(e.reason);Rh(),await o.project.open({path:e.path,target:`new-window`,entryPoint:`worktree`})},s({id:`LwMxXg`}))},t[43]=s,t[44]=o,t[45]=bt,t[46]=Ct):Ct=t[46];let wt=Ct,Tt;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Tt=function(e){let t={kind:e.kind,path:e.path,lastOpenedAt:new Date().toISOString()},n=mS(fS(),t);pS(n),I(n)},t[47]=Tt):Tt=t[47];let Dt=Tt,Ot;t[48]===a?Ot=t[49]:(Ot=function(e){a(!1),Dt(e),VC(e.path)},t[48]=a,t[49]=Ot);let kt=Ot,jt=!st&&f===``&&Ue.length>0,Mt=qC({searchResults:m,fallbackSearchResults:Xe,searchStatus:g}),Nt=!st&&Mt.length>0,Pt=!st&&f!==``&&(Ee||b)&&!Nt,Ft=!st&&f!==``&&g===`loading`&&!Nt&&!Pt,It=!st&&o!==null&&Ge.length>0&&(f===``||Ge.some(e=>NS(`${e.name} ${e.path}`,d,[`open recent project`]))),Lt=qe.filter(e=>f===``||NS(e.branch??``,d,[`worktree branch`])),Rt=!st&&o!==null&&Lt.length>0,zt=Be(),Bt=!st&&!zt&&Ve!==null&&(f===``||qa.some(e=>{let t=e.displayName;return NS(s({id:`wHZ58m`,values:{displayName:t}}),d,[e.id,`agent handoff`,`open in`])})),Vt=at.kind===`tag-list`?RS(oe,at.query):[],Ht=at.kind===`tag-list`&&ce!==`loading`&&Vt.length===0,Ut=at.kind===`tag-docs`&&pe===`success`&&de.length===0,Wt=bl(),Gt;t[50]===a?Gt=t[51]:(Gt=e=>{a(!1),hr(e,{launcherBorne:!0})},t[50]=a,t[51]=Gt);let Kt=Gt,qt;t[52]!==o||t[53]!==a?(qt=e=>{a(!1),gh(e,o?{okDesktop:{shell:o.shell}}:{okDesktop:void 0})},t[52]=o,t[53]=a,t[54]=qt):qt=t[54];let Xt=qt,Zt;t[55]===a?Zt=t[56]:(Zt=()=>a(!1),t[55]=a,t[56]=Zt);let Qt;t[57]===R?Qt=t[58]:(Qt=e=>R(e),t[57]=R,t[58]=Qt);let $t;t[59]===B?$t=t[60]:($t=()=>B(!0),t[59]=B,t[60]=$t);let tn;t[61]===ee?tn=t[62]:(tn=()=>ee(!0),t[61]=ee,t[62]=tn);let nn;t[63]===U?nn=t[64]:(nn=()=>U({launcherBorne:!0}),t[63]=U,t[64]=nn);let rn;t[65]===G?rn=t[66]:(rn=()=>{ne(!0),G(!0)},t[65]=G,t[66]=rn);let an;t[67]===K?an=t[68]:(an=()=>K(!0),t[67]=K,t[68]=an);let on;t[69]===ie?on=t[70]:(on=()=>void ie(`project`),t[69]=ie,t[70]=on);let sn;t[71]===q?sn=t[72]:(sn=()=>q?.(),t[71]=q,t[72]=sn);let cn={bridge:o,singleFile:c,activeDocName:ye,contextualTargetKind:Xx(be),viewMenuState:Wt,emitMenuAction:Kt,runAction:bt,openExternalUrl:Xt,closePalette:Zt,openNewItemDialog:Qt,openSeedDialog:$t,openCreateProjectDialog:tn,openReportBugDialog:nn,openBugReportHistory:rn,openFeedbackDialog:an,createBlankSkill:on,openBlobRun:sn},ln=st?[]:oS.flatMap(e=>{if(!e.available(cn)||e.visibility===`search-only`&&f===``)return[];let t=e.label(cn);return NS(t,d,e.keywords)?[{cmd:e,label:t}]:[]}),un=ln.length>0,dn;t[73]===s?dn=t[74]:(dn=e=>{switch(e){case`commands`:return s({id:`45MZFs`});case`project`:return s({id:`e0NrBM`});case`file`:return s({id:`J2eKUI`});case`view`:return s({id:`jpctdh`});case`terminal`:return s({id:`ALhMYW`});case`app`:return s({id:`IrC12v`})}},t[73]=s,t[74]=dn);let pn=dn,mn=e=>{let t=ln.filter(t=>t.cmd.group===e);return t.length===0?null:(0,Z.jsx)(vn,{heading:pn(e),children:t.map(e=>{let{cmd:t,label:n}=e,r=t.shortcutId!==void 0&&(t.shortcutDesktopOnly!==!0||o!==null)?Lc(t.shortcutId):null;return(0,Z.jsxs)(fn,{value:`${n} ${t.keywords.join(` `)}`,onSelect:()=>t.dispatch(cn),"data-testid":`command-palette-${t.id}`,children:[(0,Z.jsx)(t.icon,{}),(0,Z.jsx)(`span`,{children:n}),t.checked?.(cn)?(0,Z.jsx)(Uu,{className:`ml-auto text-muted-foreground`,"aria-hidden":`true`}):null,r?(0,Z.jsx)(Ze,{children:r}):null]},t.id)})},e)},hn=st||jt||Nt||Ft||Pt||It||Bt||un,gn;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(gn=function(e){u(`${IS}${e}`)},t[75]=gn):gn=t[75];let _n=gn,yn;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(yn=function(){_e.current?.abort(),_e.current=null,ve.current!==null&&(window.clearTimeout(ve.current),ve.current=null),E([]),O(null),A(`idle`)},t[76]=yn):yn=t[76];let bn=yn,xn;t[77]===l?xn=t[78]:(xn=function(){C(!0),l.startsWith(`tag:`)&&u(l.slice(IS.length)),bn(),ge.current?.focus()},t[77]=l,t[78]=xn);let Sn=xn,Cn;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(Cn=function(){C(!1),u(``),bn(),ge.current?.focus()},t[79]=Cn):Cn=t[79];let wn=Cn,Tn=function(e){let t=e.trim();if(!t||Ee)return;_e.current?.abort(),ve.current!==null&&window.clearTimeout(ve.current);let n=new AbortController;_e.current=n,A(`loading`);let r=!1,i=window.setTimeout(()=>{r=!0,n.abort(),A(`error`)},LC);ve.current=i,MS(t,{signal:n.signal,semantic:!0,limit:30}).then(e=>{let{entries:r}=e;En(i,n),E(r),O(t),A(`success`)}).catch(e=>{En(i,n),!(e instanceof Error&&e.name===`AbortError`&&!r)&&(console.debug(`[semantic-search] fire failed`,{timedOut:r,error:e}),A(`error`))})};function En(e,t){window.clearTimeout(e),ve.current===e&&(ve.current=null),_e.current===t&&(_e.current=null)}let Dn=function(e){!S||e.key!==`Enter`||(dt?.submit?(e.preventDefault(),e.stopPropagation(),Tn(dt.submit.query)):k===`loading`&&(e.preventDefault(),e.stopPropagation()))},On;t[80]===S?On=t[81]:(On=function(e){S&&(e.preventDefault(),wn())},t[80]=S,t[81]=On);let kn=On,An;t[82]===s?An=t[83]:(An=s({id:`1bDVu5`}),t[82]=s,t[83]=An);let jn;t[84]===s?jn=t[85]:(jn=s({id:`5GRxoA`}),t[84]=s,t[85]=jn);let Mn;t[86]===Symbol.for(`react.memo_cache_sentinel`)?(Mn={shouldFilter:!1,vimBindings:!1,className:`[&_[cmdk-input-wrapper]_svg]:h-4 [&_[cmdk-input-wrapper]_svg]:w-4 [&_[cmdk-item]_svg]:h-4 [&_[cmdk-item]_svg]:w-4`},t[86]=Mn):Mn=t[86];let Nn;t[87]!==s||t[88]!==S?(Nn=s(S?{id:`zXj1rA`}:{id:`ggs9f8`}),t[87]=s,t[88]=S,t[89]=Nn):Nn=t[89];let Pn;t[90]!==S||t[91]!==ot?(Pn=()=>{S&&(C(!1),bn()),u(ot?``:IS),ge.current?.focus()},t[90]=S,t[91]=ot,t[92]=Pn):Pn=t[92];let Fn=ot?`border-primary/30 bg-primary/10 text-primary`:`border-border bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`,In;t[93]===Fn?In=t[94]:(In=gr(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors`,Fn),t[93]=Fn,t[94]=In);let Ln,Rn;t[95]===Symbol.for(`react.memo_cache_sentinel`)?(Ln=(0,Z.jsx)(ep,{className:`size-3.5`}),Rn=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`0rwwOn`})}),t[95]=Ln,t[96]=Rn):(Ln=t[95],Rn=t[96]);let zn;t[97]!==ot||t[98]!==Pn||t[99]!==In?(zn=(0,Z.jsxs)(`button`,{type:`button`,onClick:Pn,"data-testid":`command-palette-filter-tag`,"data-active":ot,"aria-pressed":ot,className:In,children:[Ln,Rn]}),t[97]=ot,t[98]=Pn,t[99]=In,t[100]=zn):zn=t[100];let Vn;t[101]!==Sn||t[102]!==S||t[103]!==Pe?(Vn=Pe?(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>S?wn():Sn(),"data-testid":`command-palette-filter-semantic`,"data-active":S,"aria-pressed":S,className:gr(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors`,S?`border-primary/30 bg-primary/10 text-primary`:`border-border bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`),children:[(0,Z.jsx)(pt,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`9tJX8r`})})]}):null,t[101]=Sn,t[102]=S,t[103]=Pe,t[104]=Vn):Vn=t[104];let Hn;t[105]!==zn||t[106]!==Vn?(Hn=(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 border-b px-3 py-2`,children:[zn,Vn]}),t[105]=zn,t[106]=Vn,t[107]=Hn):Hn=t[107];let Un;t[108]===Pt?Un=t[109]:(Un=Pt?(0,Z.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-6 text-muted-foreground text-sm`,role:`status`,"aria-live":`polite`,"data-testid":`command-palette-search-preparing`,children:[(0,Z.jsx)(ip,{"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(Y,{id:`yIPXut`})]}):null,t[108]=Pt,t[109]=Un);let Wn;t[110]!==Nt||t[111]!==Ft?(Wn=Ft&&!Nt?(0,Z.jsx)(mt,{children:(0,Z.jsx)(Y,{id:`WRNXKp`})}):null,t[110]=Nt,t[111]=Ft,t[112]=Wn):Wn=t[112];let Gn=WC,Kn=PS(f,Mt,{truncated:v}),qn;t[113]!==Gn||t[114]!==st||t[115]!==at.kind||t[116]!==Kn?(qn=(0,Z.jsx)(Gn,{mode:Kn,inExclusiveMode:st,paletteModeKind:at.kind}),t[113]=Gn,t[114]=st,t[115]=at.kind,t[116]=Kn,t[117]=qn):qn=t[117];let Jn=L===`file`,Yn;t[118]===R?Yn=t[119]:(Yn=e=>{e||R(null)},t[118]=R,t[119]=Yn);let Xn;t[120]!==Ye||t[121]!==Jn||t[122]!==Yn?(Xn=(0,Z.jsx)(nC,{open:Jn,onOpenChange:Yn,kind:`file`,initialDir:Ye}),t[120]=Ye,t[121]=Jn,t[122]=Yn,t[123]=Xn):Xn=t[123];let Zn=L===`folder`,Qn;t[124]===R?Qn=t[125]:(Qn=e=>{e||R(null)},t[124]=R,t[125]=Qn);let $n;t[126]!==Ye||t[127]!==Zn||t[128]!==Qn?($n=(0,Z.jsx)(nC,{open:Zn,onOpenChange:Qn,kind:`folder`,initialDir:Ye}),t[126]=Ye,t[127]=Zn,t[128]=Qn,t[129]=$n):$n=t[129];let er;t[130]!==z||t[131]!==B?(er=(0,Z.jsx)(uC,{open:z,onOpenChange:B}),t[130]=z,t[131]=B,t[132]=er):er=t[132];let tr;t[133]!==o||t[134]!==V||t[135]!==ee?(tr=o?(0,Z.jsx)(Lx,{open:V,onOpenChange:ee,bridge:o}):null,t[133]=o,t[134]=V,t[135]=ee,t[136]=tr):tr=t[136];let nr;t[137]!==o||t[138]!==H||t[139]!==U?(nr=o?(0,Z.jsx)(Fr,{open:H!==null,onOpenChange:e=>{e||U(null)},launcherBorne:H?.launcherBorne===!0}):null,t[137]=o,t[138]=H,t[139]=U,t[140]=nr):nr=t[140];let rr;t[141]!==o||t[142]!==te||t[143]!==W||t[144]!==G||t[145]!==U?(rr=o&&te?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(IC,{open:W,onOpenChange:G,onReportABug:()=>{G(!1),U({launcherBorne:!1})}})}):null,t[141]=o,t[142]=te,t[143]=W,t[144]=G,t[145]=U,t[146]=rr):rr=t[146];let ir;return t[147]!==re||t[148]!==K?(ir=(0,Z.jsx)(HS,{open:re,onOpenChange:K,source:`command_palette`}),t[147]=re,t[148]=K,t[149]=ir):ir=t[149],(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(i,{open:r,onOpenChange:a,title:An,description:jn,className:`sm:max-w-2xl`,commandProps:Mn,onEscapeKeyDown:kn,children:[(0,Z.jsx)(Jt,{ref:ge,value:l,onValueChange:u,onKeyDown:Dn,placeholder:Nn}),Hn,(0,Z.jsxs)(At,{ref:he,className:`subtle-scrollbar`,children:[S&&dt?(0,Z.jsxs)(Z.Fragment,{children:[Le?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,"data-testid":`command-palette-semantic-indexing`,children:[(0,Z.jsx)(ip,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`kCNU4q`,values:{semanticIndexedCount:Fe,semanticTotalCount:Ie}})]}):null,dt.submit?(0,Z.jsx)(vn,{children:(0,Z.jsx)(fn,{value:`semantic-submit`,onSelect:()=>Tn(ft),"data-testid":`command-palette-semantic-submit`,children:dt.submit.kind===`retry`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(pt,{}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-amber-700 dark:text-amber-400`,children:(0,Z.jsx)(Y,{id:`w4ZzmQ`})}),(0,Z.jsx)(Ze,{children:`↵`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(pt,{}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,Z.jsx)(Y,{id:`FNTx6u`,values:{semanticSubmitQuery:ft}})}),(0,Z.jsx)(Ze,{children:`↵`})]})})}):null,dt.notice===`empty`?(0,Z.jsx)(mt,{"data-testid":`command-palette-semantic-empty`,children:(0,Z.jsx)(Y,{id:`l5J_HM`,components:{0:(0,Z.jsx)(en,{"aria-label":s({id:`9Vnjc9`})})}})}):null,dt.notice===`searching`?(0,Z.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-6 text-muted-foreground text-sm`,role:`status`,"aria-live":`polite`,"data-testid":`command-palette-semantic-searching`,children:[(0,Z.jsx)(ip,{"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(Y,{id:`PBwmDJ`})]}):null,dt.notice===`no-results`?(0,Z.jsx)(mt,{"data-testid":`command-palette-semantic-no-results`,children:(0,Z.jsx)(Y,{id:`yFyZMJ`,values:{semanticQueryText:ut}})}):null,dt.results.show?(0,Z.jsx)(vn,{heading:dt.results.dimmed?s({id:`QlxHAH`,values:{semanticResultsLabel:ht}}):s({id:`9tJX8r`}),children:(0,Z.jsx)(`div`,{"data-testid":`command-palette-semantic-results`,"data-dimmed":dt.results.dimmed,children:T.map(e=>(0,Z.jsx)(UC,{entry:e,disabled:dt.results.dimmed,onSelect:()=>kt(e)},dS(e.kind,e.path)))})}):null]}):null,Un,Wn,hn?null:(0,Z.jsx)(mt,{children:g===`error`?(0,Z.jsx)(Y,{id:`pkAft1`}):(0,Z.jsx)(Y,{id:`i3f2kh`})}),at.kind===`tag-list`?(0,Z.jsxs)(vn,{heading:at.query?s({id:`evs0iw`,values:{tagListQuery:ct}}):s({id:`2QM24L`}),children:[ce===`loading`?(0,Z.jsx)(mt,{children:(0,Z.jsx)(Y,{id:`a_u4ck`})}):null,ce===`error`?(0,Z.jsx)(mt,{children:(0,Z.jsx)(Y,{id:`qTcZZu`,components:{0:(0,Z.jsx)(en,{"aria-label":s({id:`69KLIV`})})}})}):null,Ht?(0,Z.jsx)(mt,{children:at.query?s({id:`X0ttSN`,values:{tagListQuery:ct}}):s({id:`JLUTgi`})}):null,Vt.map(e=>(0,Z.jsxs)(fn,{value:`tag ${e.name}`,onSelect:()=>_n(e.name),"data-testid":`command-palette-tag-${e.name}`,children:[(0,Z.jsx)(ep,{}),(0,Z.jsx)(Mu,{className:`min-w-0 flex-1 truncate font-medium`,children:e.name}),(0,Z.jsx)(`span`,{className:`ml-auto shrink-0 text-[11px] text-muted-foreground tabular-nums`,children:(0,Z.jsx)(Y,{id:`fVcm9t`,values:{0:e.count}})})]},`tag:${e.name}`))]}):null,at.kind===`tag-docs`?(0,Z.jsxs)(vn,{heading:s({id:`hGmuTc`,values:{tagDocsName:lt}}),children:[pe===`loading`?(0,Z.jsx)(mt,{children:(0,Z.jsx)(Y,{id:`pWbsW6`})}):null,pe===`error`?(0,Z.jsx)(mt,{children:(0,Z.jsx)(Y,{id:`z_4xza`,components:{0:(0,Z.jsx)(en,{"aria-label":s({id:`69KLIV`})})}})}):null,Ut?(0,Z.jsx)(mt,{children:s({id:`NIWAux`,values:{tagDocsName:lt}})}):null,de.map(e=>{let t=e.title||e.docName.split(`/`).pop()||e.docName,n=e.matchingTags.filter(e=>e!==at.tagName).map(YC).join(`, `);return(0,Z.jsxs)(fn,{value:`tag-doc ${e.docName}`,onSelect:()=>{a(!1),VC(e.docName)},"data-testid":`command-palette-tag-doc-${e.docName}`,className:`items-start`,children:[(0,Z.jsx)(xi,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(Mu,{className:`truncate font-medium`,children:t}),(0,Z.jsx)(Mu,{className:`truncate text-muted-foreground text-xs`,children:e.docName}),e.matchingTags.length>0&&e.matchingTags.some(e=>e!==at.tagName)?(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-[11px]`,children:(0,Z.jsx)(Y,{id:`CvsD6Y`,values:{viaTags:n}})}):null]})]},`tag-doc:${e.docName}`)})]}):null,jt?(0,Z.jsx)(vn,{heading:s({id:`MmDDWK`}),children:Ue.map(e=>(0,Z.jsx)(UC,{entry:e,onSelect:()=>kt(e)},dS(e.kind,e.path)))}):null,mn(`commands`),Bt?(0,Z.jsx)(vn,{heading:s({id:`O7_W_a`}),children:qa.filter(e=>{let t=e.displayName;return NS(s({id:`wHZ58m`,values:{displayName:t}}),d,[e.id,`agent handoff`,`open in`])}).map(e=>{let t=Oe[e.id],n=t.installed===!0&&Ve!==null,r=e.displayName,i=t.installed===null?s({id:`IA6JW2`}):t.installed===!1?s({id:`5SwVv1`}):null,o=s(i?{id:`rl35Vz`,values:{displayName:r,hint:i}}:{id:`wHZ58m`,values:{displayName:r}});return(0,Z.jsxs)(fn,{value:`send to ai ${e.displayName} desktop ${e.id} agent open in`,disabled:!n,onSelect:()=>{!n||!Ve||(a(!1),Ae(e.id,Ve))},"data-testid":`command-palette-open-in-${e.id}`,"aria-label":o,children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`wHZ58m`,values:{displayName:r}})}),i?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-auto text-muted-foreground text-xs`,children:i}):null]},e.id)})}):null,mn(`project`),It&&o?(0,Z.jsx)(vn,{heading:s({id:`3iyGWF`}),children:Ge.filter(e=>NS(`${e.name} ${e.path}`,d,[`open recent project`])).slice(0,10).map(e=>{let t=e.isLinkedWorktree===!0,n=t?vu:Kf,r=t&&e.mainRoot!==void 0?MC(e.mainRoot):null;return(0,Z.jsx)(FC,{path:e.path,onRemoveRecent:St,testIdPrefix:`command-palette-recent`,children:(0,Z.jsxs)(`div`,{className:`group/recent relative flex items-center`,children:[(0,Z.jsxs)(fn,{value:`${e.name} ${e.path} recent project`,onSelect:()=>bt(()=>o.project.open({path:e.path,target:`new-window`,entryPoint:`recents`}),s({id:`SUOoXn`})),"data-testid":`command-palette-recent-${e.path}`,className:`flex-1 items-start pr-8`,children:[(0,Z.jsx)(n,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(Mu,{className:`truncate font-medium`,children:e.name}),r===null?null:(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`8Gzz2G`,values:{worktreeOf:r}})}),(0,Z.jsx)(Mu,{className:`truncate text-muted-foreground text-xs`,children:e.path})]})]}),(0,Z.jsx)(PC,{path:e.path,name:e.name,onRemoveRecent:St,testIdPrefix:`command-palette-recent`})]})},e.path)})}):null,Rt&&o?(0,Z.jsx)(vn,{heading:s({id:`sxjyRq`}),children:Lt.slice(0,10).map(e=>(0,Z.jsxs)(fn,{value:`${e.branch} worktree branch`,onSelect:()=>wt(e),"data-testid":`command-palette-worktree-${e.branch}`,className:`items-start`,children:[(0,Z.jsx)(vu,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(Mu,{className:`truncate font-medium`,children:e.branch}),e.worktreePath===null?(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:s({id:`iO8V-7`})}):(0,Z.jsx)(Mu,{className:`truncate text-muted-foreground text-xs`,children:e.worktreePath})]})]},e.branch))}):null,[`file`,`view`,`terminal`,`app`].map(e=>mn(e)),Nt?(0,Z.jsx)(vn,{heading:s({id:`A1taO8`}),children:Mt.map(e=>(0,Z.jsx)(UC,{entry:e,query:f,onSelect:()=>kt(e)},dS(e.kind,e.path)))}):null]}),qn]}),Xn,$n,er,tr,nr,rr,ir]})}function YC(e){return`#${e}`}function XC(e){return e.name}function ZC(e){return e.branch!==null&&!e.isCurrent}function QC(e){return dS(e.kind,e.path)}var $C=500;function ew(e,t,n){return t?`terminal`:e===null&&n?`retrying`:`hidden`}function tw(e){return e?.kind===`null-collab`}function nw(e){if(e===null)return Hc._({id:`Ua78MH`});if(e.kind===`null-collab`)return Hc._({id:`tz_FDV`});if(e.code===`network`)return Hc._({id:`2L8aeZ`});if(e.code===`invalid-body`)return Hc._({id:`FRYB1Q`});let t=e.code;return Hc._({id:`4nj6n8`,values:{code:t}})}function rw(){let e=(0,$.c)(21),t=Yt(),{collabUrl:n,collabTerminal:r,collabLastError:i,retryCollab:a}=Et(),[o,s]=(0,Q.useState)(!1),c,l;e[0]!==r||e[1]!==n?(c=()=>{if(n!==null||r){s(!1);return}let e=setTimeout(()=>s(!0),$C);return()=>clearTimeout(e)},l=[n,r],e[0]=r,e[1]=n,e[2]=c,e[3]=l):(c=e[2],l=e[3]),(0,Q.useEffect)(c,l);let u=ew(n,r,o);if(u===`hidden`)return null;if(u===`terminal`){let n;e[4]===i?n=e[5]:(n=tw(i),e[4]=i,e[5]=n);let r=n,o;e[6]===i?o=e[7]:(o=nw(i),e[6]=i,e[7]=o);let s=o,c;e[8]!==s||e[9]!==r?(c=(0,Z.jsx)(`span`,{children:r?(0,Z.jsx)(Y,{id:`AAlr5Y`,components:{0:(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`})}}):(0,Z.jsx)(Y,{id:`noH1JX`,values:{errorDetail:s},components:{0:(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`}),1:(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`})}})}),e[8]=s,e[9]=r,e[10]=c):c=e[10];let l;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Y,{id:`6gRgw8`}),e[11]=l):l=e[11];let u;e[12]===a?u=e[13]:(u=(0,Z.jsx)(`button`,{type:`button`,onClick:a,className:`bg-red-950 text-red-50 px-2 py-0.5 rounded text-xs font-medium hover:bg-red-900`,children:l}),e[12]=a,e[13]=u);let d;e[14]===t?d=e[15]:(d=t?(0,Z.jsx)(`button`,{type:`button`,onClick:t,"aria-label":Hc._({id:`MsARMw`}),title:Hc._({id:`MsARMw`}),className:`ml-1 flex items-center rounded bg-red-100/60 px-1.5 py-1 transition-colors hover:bg-red-100/90`,children:(0,Z.jsx)(kr,{size:22,trackMouse:!1,variant:`sleeping`})}):null,e[14]=t,e[15]=d);let f;return e[16]!==c||e[17]!==u||e[18]!==d?(f=(0,Z.jsxs)(`div`,{role:`alert`,"aria-live":`assertive`,className:`fixed top-0 inset-x-0 z-50 bg-red-500/95 text-red-950 text-sm text-center py-2 px-4 pl-[var(--ok-titlebar-reserve-left,1rem)] shadow-md flex items-center justify-center gap-3 flex-wrap`,children:[c,u,d]}),e[16]=c,e[17]=u,e[18]=d,e[19]=f):f=e[19],f}let d;return e[20]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`fixed top-0 inset-x-0 z-50 bg-amber-500/95 text-amber-950 text-sm text-center py-2 px-4 pl-[var(--ok-titlebar-reserve-left,1rem)] shadow-md`,children:(0,Z.jsx)(Y,{id:`UYcGIW`})}),e[20]=d):d=e[20],d}function iw(e){let t=(0,$.c)(5),{bridge:n}=e,[r,i]=(0,Q.useState)(!1),a,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>fr(e=>{e===`new-project`&&i(!0)}),o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Q.useEffect)(a,o);let s;return t[2]!==n||t[3]!==r?(s=(0,Z.jsx)(Lx,{open:r,onOpenChange:i,bridge:n}),t[2]=n,t[3]=r,t[4]=s):s=t[4],s}function aw(e,t){e.chain().focus().insertContent({type:`text`,text:t}).run()}function ow(e){if(e.isDestroyed)return null;try{let t=e.view.coordsAtPos(e.state.selection.from);return{left:t.left,top:t.top,bottom:t.bottom}}catch{return null}}function sw(){let e=(0,$.c)(29),{_:t}=Bn(),[n,r]=(0,Q.useState)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=function(e){let t=e.detail;if(!t?.editor||t.editor.isDestroyed)return;let n=ow(t.editor);n&&r({editor:t.editor,...n})};return document.addEventListener(Mn,e),()=>document.removeEventListener(Mn,e)},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),(0,Q.useEffect)(i,a);let o=n?.editor??null,s,c;if(e[2]===o?(s=e[3],c=e[4]):(s=()=>{if(!o)return;let e=function(){let e=o,t=ow(e);r(n=>!n||n.editor!==e?n:t?{...n,...t}:null)};return document.addEventListener(`scroll`,e,{capture:!0,passive:!0}),window.addEventListener(`resize`,e),()=>{document.removeEventListener(`scroll`,e,{capture:!0}),window.removeEventListener(`resize`,e)}},c=[o],e[2]=o,e[3]=s,e[4]=c),(0,Q.useEffect)(s,c),!n)return null;let l;e[5]===n?l=e[6]:(l=function(e){if(!n)return;let{editor:t}=n;r(null),e&&!t.isDestroyed&&t.commands.focus()},e[5]=n,e[6]=l);let u=l,d;e[7]===u?d=e[8]:(d=e=>{e||u(!1)},e[7]=u,e[8]=d);let f=n.bottom-n.top,p;e[9]!==n.left||e[10]!==n.top||e[11]!==f?(p=(0,Z.jsx)(mh,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":!0,"data-testid":`emoji-picker-anchor`,className:`pointer-events-none fixed`,style:{left:n.left,top:n.top,height:f}})}),e[9]=n.left,e[10]=n.top,e[11]=f,e[12]=p):p=e[12];let m;e[13]===t?m=e[14]:(m=t({id:`pFPzHA`}),e[13]=t,e[14]=m);let h,g;e[15]===u?(h=e[16],g=e[17]):(g=()=>u(!0),h=()=>u(!1),e[15]=u,e[16]=h,e[17]=g);let _;e[18]===n.editor?_=e[19]:(_=(0,Z.jsx)(kf,{onSelect:e=>{let t=n.editor;r(null),aw(t,e)}}),e[18]=n.editor,e[19]=_);let v;e[20]!==h||e[21]!==_||e[22]!==m||e[23]!==g?(v=(0,Z.jsx)(ph,{className:`w-auto p-0`,align:`start`,"aria-label":m,"data-testid":`emoji-picker-popover`,onEscapeKeyDown:g,onInteractOutside:h,children:_}),e[20]=h,e[21]=_,e[22]=m,e[23]=g,e[24]=v):v=e[24];let y;return e[25]!==v||e[26]!==d||e[27]!==p?(y=(0,Z.jsxs)(hh,{open:!0,onOpenChange:d,children:[p,v]}),e[25]=v,e[26]=d,e[27]=p,e[28]=y):y=e[28],y}async function cw(e){let t=await fetch(`/api/tags/${encodeURIComponent(e)}`);if(!t.ok){let e=await t.json().catch(()=>null),n=t.status,r=t.statusText;throw Error(Il(e)??Hc._({id:`lHwYMr`,values:{status:n,statusText:r}}))}return(await t.json()).docs??[]}function lw(){let e=(0,$.c)(18),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(null),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={kind:`idle`},e[0]=a):a=e[0];let[o,s]=(0,Q.useState)(a),c=(0,Q.useRef)(0),l,u;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{let e=function(e){let t=e.detail;if(!t||typeof t.value!=`string`)return;let r=c.current+=1;i(t.value),n(!0),s({kind:`loading`}),cw(t.value).then(e=>{c.current===r&&s({kind:`ready`,docs:e})}).catch(e=>{c.current===r&&s({kind:`error`,message:e instanceof Error?e.message:String(e)})})};return document.addEventListener(Tn,e),()=>document.removeEventListener(Tn,e)},u=[],e[1]=l,e[2]=u):(l=e[1],u=e[2]),(0,Q.useEffect)(l,u);let d;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=function(e){n(!1),window.location.assign(qp(e))},e[3]=d):d=e[3];let f=d,p=r??``,m;e[4]===p?m=e[5]:(m={tagName:p},e[4]=p,e[5]=m);let h;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(h={0:(0,Z.jsx)(`span`,{className:`font-mono break-all`})},e[6]=h):h=e[6];let g;e[7]===m?g=e[8]:(g=(0,Z.jsx)($r,{children:(0,Z.jsx)(Jr,{children:(0,Z.jsx)(Y,{id:`7H4UHD`,values:m,components:h})})}),e[7]=m,e[8]=g);let _=r??``,v;e[9]!==o||e[10]!==_?(v=(0,Z.jsx)(Xr,{children:(0,Z.jsx)(uw,{fetchState:o,tag:_,onSelectDoc:f})}),e[9]=o,e[10]=_,e[11]=v):v=e[11];let y;e[12]!==g||e[13]!==v?(y=(0,Z.jsxs)(Yr,{children:[g,v]}),e[12]=g,e[13]=v,e[14]=y):y=e[14];let b;return e[15]!==t||e[16]!==y?(b=(0,Z.jsx)(ei,{open:t,onOpenChange:n,children:y}),e[15]=t,e[16]=y,e[17]=b):b=e[17],b}function uw(e){let t=(0,$.c)(15),{fetchState:n,tag:r,onSelectDoc:i}=e;if(n.kind===`idle`||n.kind===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`tag-dialog-loading`,children:(0,Z.jsx)(Y,{id:`yQE2r9`})}),t[0]=e):e=t[0],e}if(n.kind===`error`){let e;return t[1]===n.message?e=t[2]:(e=(0,Z.jsx)(`p`,{className:`text-destructive text-sm`,"data-testid":`tag-dialog-error`,children:n.message}),t[1]=n.message,t[2]=e),e}if(n.docs.length===0){let e;t[3]===r?e=t[4]:(e={tag:r},t[3]=r,t[4]=e);let n;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(n={0:(0,Z.jsx)(`span`,{className:`font-mono`})},t[5]=n):n=t[5];let i;return t[6]===e?i=t[7]:(i=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`tag-dialog-empty`,children:(0,Z.jsx)(Y,{id:`lAiyU_`,values:e,components:n})}),t[6]=e,t[7]=i),i}let a;if(t[8]!==n.docs||t[9]!==i){let e;t[11]===i?e=t[12]:(e=e=>{let t=e.matchingTags??[];return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,className:`w-full rounded-md px-2 py-1.5 text-left text-sm hover:bg-muted focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring`,onClick:()=>i(e.docName),"data-testid":`tag-dialog-row`,children:[(0,Z.jsx)(`span`,{className:`block truncate font-medium`,children:e.title}),e.docName===e.title?null:(0,Z.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:e.docName}),t.length>0?(0,Z.jsx)(`span`,{className:`mt-1 flex flex-wrap items-center gap-1`,"data-testid":`tag-dialog-row-matches`,children:t.map(dw)}):null]})},e.docName)},t[11]=i,t[12]=e),a=n.docs.map(e),t[8]=n.docs,t[9]=i,t[10]=a}else a=t[10];let o;return t[13]===a?o=t[14]:(o=(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1`,"data-testid":`tag-dialog-list`,children:a}),t[13]=a,t[14]=o),o}function dw(e){return(0,Z.jsxs)(`span`,{"data-testid":`tag-dialog-row-match`,"data-tag":e,className:`tag pointer-events-none text-xs`,children:[`#`,e]},e)}var fw=`raw-mdx-nav`,pw=`ok-editor-mode-v1`,mw=[`wysiwyg`,`source`],hw=`wysiwyg`;function gw(e){return mw.includes(e)}function _w(e=localStorage){try{let t=e.getItem(pw);if(t===null)return hw;if(gw(t))return t;console.warn(`[editor-mode] invalid persisted value, falling back to default`,{raw:t})}catch{}return hw}function vw(e=window,t=localStorage){let n=e.__OK_EDITOR_MODE__;return gw(n)?n:_w(t)}function yw(e,t=localStorage){try{return t.setItem(pw,e),!0}catch(e){return console.warn(`[editor-mode] persist failed`,e),!1}}function bw(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(vw),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=function(e){n(e),yw(e)},e[0]=r):r=e[0];let i=r,a;return e[1]===t?a=e[2]:(a=[t,i],e[1]=t,e[2]=a),a}function xw(e){let t=(0,$.c)(4),{_:n}=Bn(),r=(0,Q.useRef)(!1),i,a;t[0]!==n||t[1]!==e?(i=()=>{e===`no-push-permission`&&!r.current&&(r.current=!0,Dc.info(n({id:`JkCD2u`})))},a=[e,n],t[0]=n,t[1]=e,t[2]=i,t[3]=a):(i=t[2],a=t[3]),(0,Q.useEffect)(i,a)}function Sw(e,t){return e===`follow`?(0,Z.jsx)(Y,{id:`2okwy4`,values:{project:t}}):e===`full`?(0,Z.jsx)(Y,{id:`wk_v1X`,values:{project:t}}):(0,Z.jsx)(Y,{id:`6xPJIj`,values:{project:t}})}function Cw(){let e=(0,$.c)(8),{projectLocalConfig:t,projectLocalSynced:n,projectLocalBinding:r}=Fl(),i=(0,Q.useRef)(!1),a;e[0]!==r||e[1]!==t?.autoSync||e[2]!==n?(a=()=>{if(!n||i.current||r===null)return;let e=t?.autoSync;if(e?.inheritedNoticePending!==!0)return;i.current=!0;let a=typeof e.inheritedFrom==`string`?e.inheritedFrom:``;Dc(Sw(hs({mode:e.mode,enabled:e.enabled}),a)),r.patch({autoSync:{inheritedNoticePending:null}})},e[0]=r,e[1]=t?.autoSync,e[2]=n,e[3]=a):a=e[3];let o;e[4]!==r||e[5]!==t||e[6]!==n?(o=[n,t,r],e[4]=r,e[5]=t,e[6]=n,e[7]=o):o=e[7],(0,Q.useEffect)(a,o)}var ww=`ok-terminal-placement-v1`;function Tw(e){try{return vc((e??localStorage).getItem(ww))}catch{return bo}}function Ew(e,t){try{(t??localStorage).setItem(ww,e)}catch{}}var Dw=`ok-terminal-right-width-v1`;function Ow(e){try{let t=(e??localStorage).getItem(Dw);if(t===null||t.trim()===``)return Ts;let n=Number(t);return Number.isFinite(n)?Sc(n):Ts}catch{return Ts}}function kw(e,t){try{(t??localStorage).setItem(Dw,String(Sc(e)))}catch{}}function Aw(e){let t=(0,$.c)(3),[n,r]=(0,Q.useState)(`connecting`),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e){r(`connecting`);return}let t=e.configuration.websocketProvider.status;e.isSynced?r(`synced`):r(t===`connected`?`connected`:t===`disconnected`?`disconnected`:`connecting`);let n=e=>{let{status:t}=e;r(t===`connected`?jw:t===`disconnected`?`disconnected`:`connecting`)},i=e=>{let{state:t}=e;r(t?`synced`:`connected`)},a=()=>r(`disconnected`);return e.on(`status`,n),e.on(`synced`,i),e.on(`disconnect`,a),()=>{e.off(`status`,n),e.off(`synced`,i),e.off(`disconnect`,a)}},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,Q.useEffect)(i,a),n}function jw(e){return e===`synced`?`synced`:`connected`}function Mw(e){let t=(0,$.c)(36),{open:n,variant:r,onResolved:i}=e,{_:a}=Bn(),o=Su(),s;t[0]!==a||t[1]!==i||t[2]!==r||t[3]!==o?(s=function(e){if(o===null){Dc.error(a({id:`fiMNLl`}));return}let t=o(e?r===`follow`?`follow`:`full`:`off`);if(!t.ok){let n=t.error;Dc.error(a(e?{id:`FUMerq`,values:{detail:n}}:{id:`0t0bbC`,values:{detail:n}}));return}i()},t[0]=a,t[1]=i,t[2]=r,t[3]=o,t[4]=s):s=t[4];let c=s,l;t[5]===r?l=t[6]:(l=(0,Z.jsx)($r,{children:(0,Z.jsx)(wu,{variant:r})}),t[5]=r,t[6]=l);let u;t[7]===r?u=t[8]:(u=(0,Z.jsx)(bu,{variant:r}),t[7]=r,t[8]=u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`QYTOaN`,components:{0:(0,Z.jsx)(`span`,{className:`font-medium`})}})}),t[9]=d):d=t[9];let f;t[10]===u?f=t[11]:(f=(0,Z.jsxs)(Xr,{children:[u,d]}),t[10]=u,t[11]=f);let p;t[12]===c?p=t[13]:(p=()=>c(!1),t[12]=c,t[13]=p);let m=o===null,h;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Y,{id:`IKoTAC`}),t[14]=h):h=t[14];let g;t[15]!==p||t[16]!==m?(g=(0,Z.jsx)(X,{variant:`outline`,className:`uppercase font-mono`,onClick:p,disabled:m,children:h}),t[15]=p,t[16]=m,t[17]=g):g=t[17];let _;t[18]===c?_=t[19]:(_=()=>c(!0),t[18]=c,t[19]=_);let v=o===null,y;t[20]===r?y=t[21]:(y=r===`follow`?(0,Z.jsx)(Y,{id:`jTUxaN`}):(0,Z.jsx)(Y,{id:`pPiV8s`}),t[20]=r,t[21]=y);let b;t[22]!==_||t[23]!==v||t[24]!==y?(b=(0,Z.jsx)(X,{onClick:_,disabled:v,children:y}),t[22]=_,t[23]=v,t[24]=y,t[25]=b):b=t[25];let x;t[26]!==b||t[27]!==g?(x=(0,Z.jsxs)(Zr,{children:[g,b]}),t[26]=b,t[27]=g,t[28]=x):x=t[28];let S;t[29]!==x||t[30]!==l||t[31]!==f?(S=(0,Z.jsxs)(Yr,{className:`sm:max-w-lg`,showCloseButton:!1,children:[l,f,x]}),t[29]=x,t[30]=l,t[31]=f,t[32]=S):S=t[32];let C;return t[33]!==n||t[34]!==S?(C=(0,Z.jsx)(ei,{open:n,onOpenChange:Nw,children:S}),t[33]=n,t[34]=S,t[35]=C):C=t[35],C}function Nw(){}function Pw(e){if(!(!e.autoSyncOnboardingDismissed&&e.hasRemote===!0&&e.projectLocalSynced===!0&&e.projectSynced===!0&&e.projectLocalConfig!==null&&hs(e.projectLocalConfig.autoSync??void 0)===null&&Eo(e.projectConfig?.autoSync?.default)===null))return null;switch(e.pushPermissionCheckStatus){case`allowed`:return`full`;case`denied`:return`follow`;default:return null}}function Fw(e){let t=(0,$.c)(57),{primary:n,onPrimary:r,primaryDisabled:i,enabledTargets:a,selectedTargetId:o,onSelectTarget:s,threadAgents:c,onOpenSettings:l,terminal:u,terminals:d,menuEmptyState:f,menuLeading:p,onMenuOpenChange:m,menuAlign:h,triggerAriaLabel:g,testIds:_}=e,v=i===void 0?!1:i,y=h===void 0?`end`:h,{_:b}=Bn(),x=a.length>0,S=d&&d.length>0?d:null,C=S!=null||u!=null,w=x||C,T=c!==void 0&&c.length>0,E;t[0]===_?E=t[1]:(E=e=>typeof _.terminal==`function`?_.terminal(e):_.terminal,t[0]=_,t[1]=E);let D=E,O;t[2]!==r||t[3]!==n||t[4]!==v||t[5]!==_.primary?(O=(0,Z.jsx)(X,{type:`button`,variant:`outline`,className:`gap-1.5`,disabled:v,onClick:r,"data-testid":_.primary,children:n}),t[2]=r,t[3]=n,t[4]=v,t[5]=_.primary,t[6]=O):O=t[6];let k;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(Gu,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),t[7]=k):k=t[7];let A;t[8]!==_.trigger||t[9]!==g?(A=(0,Z.jsx)(fa,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`icon`,"aria-label":g,"data-testid":_.trigger,children:k})}),t[8]=_.trigger,t[9]=g,t[10]=A):A=t[10];let j;t[11]!==w||t[12]!==p||t[13]!==T?(j=p?(0,Z.jsxs)(Z.Fragment,{children:[p,T||w?(0,Z.jsx)(ya,{}):null]}):null,t[11]=w,t[12]=p,t[13]=T,t[14]=j):j=t[14];let M;t[15]!==b||t[16]!==w||t[17]!==T||t[18]!==_||t[19]!==c?(M=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(da,{"aria-label":b({id:`RXEbZy`}),children:[(0,Z.jsx)(ma,{children:(0,Z.jsx)(Y,{id:`RXEbZy`})}),c?.map(e=>(0,Z.jsxs)(ca,{onSelect:e.onSelect,"data-testid":_.threadAgent?.(e.key),children:[(0,Z.jsx)(Ya,{agentId:e.id,iconUrl:e.iconUrl,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1 truncate`,children:e.name}),e.selected?(0,Z.jsx)(Uu,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.key))]}),w?(0,Z.jsx)(ya,{}):null]}):null,t[15]=b,t[16]=w,t[17]=T,t[18]=_,t[19]=c,t[20]=M):M=t[20];let N;t[21]!==b||t[22]!==S||t[23]!==a||t[24]!==w||t[25]!==s||t[26]!==o||t[27]!==x||t[28]!==C||t[29]!==u||t[30]!==D||t[31]!==_?(N=w?(0,Z.jsxs)(Z.Fragment,{children:[C?(0,Z.jsxs)(da,{"aria-label":b({id:`ALhMYW`}),children:[(0,Z.jsx)(ma,{children:(0,Z.jsx)(Y,{id:`ALhMYW`})}),S?S.map(e=>(0,Z.jsxs)(ca,{onSelect:e.onSelect,"data-testid":D(e.cli),"aria-label":e.ariaLabel,children:[(0,Z.jsx)(aa,{id:na(e.cli),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.label}),e.selected?(0,Z.jsx)(Uu,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.cli)):u?(0,Z.jsxs)(ca,{onSelect:u.onSelect,"data-testid":D(`claude`),"aria-label":b({id:`AcK_r0`}),children:[(0,Z.jsx)(aa,{id:na(`claude`),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`fcgvCA`})}),u.selected?(0,Z.jsx)(Uu,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]}):null]}):null,x?(0,Z.jsxs)(Z.Fragment,{children:[C?(0,Z.jsx)(ya,{}):null,(0,Z.jsxs)(da,{"aria-label":b({id:`BwKH4d`}),children:[(0,Z.jsxs)(ma,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(Y,{id:`BwKH4d`}),(0,Z.jsx)(ju,{"aria-hidden":`true`,className:`size-3`})]}),a.map(e=>(0,Z.jsxs)(ca,{onSelect:()=>s(e),"data-testid":_.option(e.id),children:[(0,Z.jsx)(aa,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Zl,{displayName:e.displayName})}),o===e.id?(0,Z.jsx)(Uu,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null]}):null,t[21]=b,t[22]=S,t[23]=a,t[24]=w,t[25]=s,t[26]=o,t[27]=x,t[28]=C,t[29]=u,t[30]=D,t[31]=_,t[32]=N):N=t[32];let P=!T&&!w?f:null,F;t[33]!==w||t[34]!==T?(F=T||w?(0,Z.jsx)(ya,{}):null,t[33]=w,t[34]=T,t[35]=F):F=t[35];let I;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(mr,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}),t[36]=I):I=t[36];let L;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`jRAGrQ`})}),t[37]=L):L=t[37];let R;t[38]!==l||t[39]!==_.settings?(R=(0,Z.jsxs)(ca,{onSelect:l,"data-testid":_.settings,children:[I,L]}),t[38]=l,t[39]=_.settings,t[40]=R):R=t[40];let z;t[41]!==y||t[42]!==P||t[43]!==F||t[44]!==R||t[45]!==j||t[46]!==M||t[47]!==N||t[48]!==_.menu?(z=(0,Z.jsxs)(ga,{align:y,className:`max-h-80 min-w-[200px]`,"data-testid":_.menu,children:[j,M,N,P,F,R]}),t[41]=y,t[42]=P,t[43]=F,t[44]=R,t[45]=j,t[46]=M,t[47]=N,t[48]=_.menu,t[49]=z):z=t[49];let B;t[50]!==m||t[51]!==z||t[52]!==A?(B=(0,Z.jsxs)(va,{modal:!1,onOpenChange:m,children:[A,z]}),t[50]=m,t[51]=z,t[52]=A,t[53]=B):B=t[53];let V;return t[54]!==B||t[55]!==O?(V=(0,Z.jsxs)(Ma,{children:[O,B]}),t[54]=B,t[55]=O,t[56]=V):V=t[56],V}function Iw(e){let t=(0,$.c)(9),{onStartNewChat:n}=e,{_:r}=Bn(),i;t[0]===r?i=t[1]:(i=r({id:`j15ZSH`}),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(dr,{className:`size-4`}),t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`span`,{className:`flex-1 truncate`,children:(0,Z.jsx)(Y,{id:`vPF04k`})}),t[3]=o):o=t[3];let s;t[4]===n?s=t[5]:(s=(0,Z.jsxs)(ca,{onSelect:n,className:`gap-2`,"data-testid":`comment-queue-send-new`,children:[a,o]}),t[4]=n,t[5]=s);let c;return t[6]!==i||t[7]!==s?(c=(0,Z.jsx)(da,{"aria-label":i,children:s}),t[6]=i,t[7]=s,t[8]=c):c=t[8],c}function Lw(){let e=(0,$.c)(12),t=Wa(),n=Ua(),r=Za(),i,a;if(e[0]!==r||e[1]!==t||e[2]!==n){let o;e[5]===t?o=e[6]:(o=e=>Ha(t,e.source,e.id,!0,e.supported),e[5]=t,e[6]=o);let s=n.filter(o),c=Ga(s,r);a=c,i=s.map(e=>({key:`${e.source}:${e.id}`,id:e.id,name:e.name,...e.iconUrl===void 0?{}:{iconUrl:e.iconUrl},selected:c!==null&&c.source===e.source&&c.id===e.id,onSelect:()=>{Va(e),Tl(Ol)}})),e[0]=r,e[1]=t,e[2]=n,e[3]=i,e[4]=a}else i=e[3],a=e[4];let o;e[7]===i?o=e[8]:(o={threadAgents:i},e[7]=i,e[8]=o);let s;return e[9]!==a||e[10]!==o?(s={threadAgent:a,rows:o},e[9]=a,e[10]=o,e[11]=s):s=e[11],s}function Rw(e){let t=(0,$.c)(49),{threadIds:n,testIdPrefix:r}=e,{_:i}=Bn(),a=Lw(),o=Wb(),s=nl(),c=s?.kind===`thread`?s:null,u=qb(),d;t[0]!==c||t[1]!==a.threadAgent?.iconUrl||t[2]!==a.threadAgent?.id?(d=c===null?(0,Z.jsx)(Ya,{agentId:a.threadAgent?.id??``,iconUrl:a.threadAgent?.iconUrl,className:`size-4`}):(0,Z.jsx)(Ya,{agentId:c.agentId,iconUrl:c.iconUrl,className:`size-4`}),t[0]=c,t[1]=a.threadAgent?.iconUrl,t[2]=a.threadAgent?.id,t[3]=d):d=t[3];let f=d,p;t[4]===i?p=t[5]:(p=i({id:`LaskKp`,values:{0:Ac(`send-comment-queue`)}}),t[4]=i,t[5]=p);let m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=Lc(`send-comment-queue`),t[6]=m):m=t[6];let h;t[7]===p?h=t[8]:(h=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 font-sans text-xs leading-none text-muted-foreground`,title:p,children:m}),t[7]=p,t[8]=h);let g;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=[],t[9]=g):g=t[9];let _;t[10]===c?_=t[11]:(_=(0,Z.jsx)(`span`,{className:`truncate`,children:c===null?(0,Z.jsx)(Y,{id:`vPF04k`}):(0,Z.jsx)(Y,{id:`sKEgGd`})}),t[10]=c,t[11]=_);let v;t[12]!==f||t[13]!==_?(v=(0,Z.jsxs)(Z.Fragment,{children:[f,_]}),t[12]=f,t[13]=_,t[14]=v):v=t[14];let y;t[15]!==u||t[16]!==n?(y=()=>u(n),t[15]=u,t[16]=n,t[17]=y):y=t[17];let b=n.length===0,x;t[18]!==o||t[19]!==c||t[20]!==n?(x=c===null?void 0:(0,Z.jsx)(Iw,{onStartNewChat:()=>void l({compose:o,threadIds:n})}),t[18]=o,t[19]=c,t[20]=n,t[21]=x):x=t[21];let S;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:(0,Z.jsx)(Y,{id:`t9Qn8y`})}),t[22]=S):S=t[22];let C;t[23]===i?C=t[24]:(C=i({id:`nbLQ_9`}),t[23]=i,t[24]=C);let w=`${r}-send`,T=`${r}-send-trigger`,E=`${r}-send-menu`,D,O;t[25]===r?(D=t[26],O=t[27]):(D=e=>`${r}-agent-option-${e}`,O=e=>`${r}-agent-option-thread-${e}`,t[25]=r,t[26]=D,t[27]=O);let k=`${r}-agent-option-settings`,A;t[28]===r?A=t[29]:(A=e=>`${r}-agent-option-terminal-${e}`,t[28]=r,t[29]=A);let j;t[30]!==w||t[31]!==T||t[32]!==E||t[33]!==D||t[34]!==O||t[35]!==k||t[36]!==A?(j={primary:w,trigger:T,menu:E,option:D,threadAgent:O,settings:k,terminal:A},t[30]=w,t[31]=T,t[32]=E,t[33]=D,t[34]=O,t[35]=k,t[36]=A,t[37]=j):j=t[37];let M;t[38]!==a.rows||t[39]!==x||t[40]!==C||t[41]!==j||t[42]!==v||t[43]!==y||t[44]!==b?(M=(0,Z.jsx)(Fw,{enabledTargets:g,selectedTargetId:null,onSelectTarget:zw,primary:v,onPrimary:y,primaryDisabled:b,menuLeading:x,onOpenSettings:jc,menuEmptyState:S,triggerAriaLabel:C,testIds:j,...a.rows}),t[38]=a.rows,t[39]=x,t[40]=C,t[41]=j,t[42]=v,t[43]=y,t[44]=b,t[45]=M):M=t[45];let N;return t[46]!==M||t[47]!==h?(N=(0,Z.jsx)(Zh,{className:`justify-end`,children:(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[h,M]})}),t[46]=M,t[47]=h,t[48]=N):N=t[48],N}function zw(){}function Bw(e){let t=new Map;for(let n of e){let e=t.get(n.docName);e?e.push(n):t.set(n.docName,[n])}return[...t].map(([e,t])=>({docName:e,threads:t}))}function Vw(e,t){let n=new Date(e),r=new Date(t),i=n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate(),a={hour:`numeric`,minute:`2-digit`};return i?n.toLocaleTimeString(void 0,a):n.getFullYear()===r.getFullYear()?n.toLocaleString(void 0,{month:`short`,day:`numeric`,...a}):n.toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,...a})}function Hw(e){let t=(0,$.c)(104),{thread:n,cardRef:r,focused:i,active:a,sending:o}=e,{_:s}=Bn(),[c]=(0,Q.useState)(Ww),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(!1),p=(0,Q.useRef)(null),m=n.status===`orphaned`,h=n.status===`resolved`,g=(0,Q.useRef)(n.body),_;t[0]===n.body?_=t[1]:(_=()=>{g.current=n.body},t[0]=n.body,t[1]=_),(0,Q.useEffect)(_);let v=(0,Q.useRef)(null),y=(0,Q.useRef)(!1),b,x;t[2]===l?(b=t[3],x=t[4]):(b=()=>{l&&(y.current=!1,v.current=null,p.current?.setText(g.current),p.current?.focusEnd())},x=[l],t[2]=l,t[3]=b,t[4]=x),(0,Q.useEffect)(b,x);let C;t[5]===n.id?C=t[6]:(C=function(e){if(y.current)return;y.current=!0,u(!1);let t=(e??``).trim();t.length===0||t===g.current||Nt(n.id,t)},t[5]=n.id,t[6]=C);let w=C,T;t[7]===w?T=t[8]:(T=function(){w(p.current?.getContent().instruction??null)},t[7]=w,t[8]=T);let E=T,D;t[9]===w?D=t[10]:(D=function(){w(null)},t[9]=w,t[10]=D);let O=D,k;t[11]!==O||t[12]!==n.id?(k=function(){O(),It(n.id)},t[11]=O,t[12]=n.id,t[13]=k):k=t[13];let A=k,j;t[14]!==l||t[15]!==w?(j=()=>{if(l)return()=>{w(v.current)}},t[14]=l,t[15]=w,t[16]=j):j=t[16];let M;t[17]===l?M=t[18]:(M=[l],t[17]=l,t[18]=M),(0,Q.useEffect)(j,M);let P;t[19]===n?P=t[20]:(P=function(e){if(n.anchor===null)return;if(ee(n.docName)===null){dp(n);return}if(n.target.kind===`property`){up({key:n.target.key,path:n.target.path,quote:e,start:n.anchor.start,end:n.anchor.end}),q(n.id);return}let t=ee(n.docName);if(!t)return;let r=yp(t.state.doc,e,n.anchor);r&&(Ep(t,r,n.docName),q(n.id))},t[19]=n,t[20]=P);let F=P,I;t[21]!==n.docName||t[22]!==n.id?(I=function(){let e=ee(n.docName);if(!e)return;let{from:t,to:r,empty:i}=e.state.selection;if(i)return;let a=e.state.doc.textBetween(t,r,` `).trim();a.length>0&&we(n.id,a,hp(e.state.doc,t,r))},t[21]=n.docName,t[22]=n.id,t[23]=I):I=t[23];let L=I,R=!l&&!h,z,B,V,H;t[24]===n.id?(z=t[25],B=t[26],V=t[27],H=t[28]):(z=()=>Me(n.id),B=()=>S(n.id),V=()=>Me(n.id),H=()=>S(n.id),t[24]=n.id,t[25]=z,t[26]=B,t[27]=V,t[28]=H);let U;t[29]!==R||t[30]!==n.id?(U=e=>{if(!R||e.target?.closest(`button, [role="checkbox"], [role="textbox"], a, input, textarea`))return;let t=window.getSelection();t!==null&&!t.isCollapsed&&t.anchorNode!==null&&e.currentTarget.contains(t.anchorNode)||pe(n.id)},t[29]=R,t[30]=n.id,t[31]=U):U=t[31];let W=R&&`cursor-pointer`,G=h&&`opacity-70`,te=a&&`bg-blue-600/10`,ne=i&&`ring-2 ring-primary`,re;t[32]!==W||t[33]!==G||t[34]!==te||t[35]!==ne?(re=gr(`flex flex-col gap-1.5 rounded-lg border p-2.5 transition-[box-shadow,border-color,background-color]`,W,G,te,ne),t[32]=W,t[33]=G,t[34]=te,t[35]=ne,t[36]=re):re=t[36];let K;t[37]!==s||t[38]!==h||t[39]!==o||t[40]!==n.id?(K=!h&&(0,Z.jsx)(zi,{checked:o,onCheckedChange:()=>pe(n.id),"aria-label":s(o?{id:`1jym2J`}:{id:`t7YoBO`})}),t[37]=s,t[38]=h,t[39]=o,t[40]=n.id,t[41]=K):K=t[41];let ie;t[42]===n.updatedAt?ie=t[43]:(ie=new Date(n.updatedAt).toLocaleString(),t[42]=n.updatedAt,t[43]=ie);let ae;t[44]!==c||t[45]!==n.updatedAt?(ae=Vw(n.updatedAt,c),t[44]=c,t[45]=n.updatedAt,t[46]=ae):ae=t[46];let oe;t[47]!==ie||t[48]!==ae?(oe=(0,Z.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground`,title:ie,children:ae}),t[47]=ie,t[48]=ae,t[49]=oe):oe=t[49];let se;t[50]!==K||t[51]!==oe?(se=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[K,oe]}),t[50]=K,t[51]=oe,t[52]=se):se=t[52];let ce;t[53]===h?ce=t[54]:(ce=h&&(0,Z.jsxs)(Sh,{variant:`outline`,className:`gap-1 border-green-600/40 text-green-700 dark:text-green-500`,children:[(0,Z.jsx)(Ny,{className:`size-2.5`}),(0,Z.jsx)(Y,{id:`O6H89R`})]}),t[53]=h,t[54]=ce);let le;t[55]!==s||t[56]!==l||t[57]!==h?(le=!h&&(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,"aria-label":s({id:`akmOT9`}),"aria-expanded":l,className:gr(`size-6 p-0`,l?`text-foreground`:`text-muted-foreground hover:text-foreground`),onClick:()=>u(Uw),children:(0,Z.jsx)(Zt,{className:`size-3.5`})})}),(0,Z.jsx)(Vr,{children:(0,Z.jsx)(Y,{id:`akmOT9`})})]}),t[55]=s,t[56]=l,t[57]=h,t[58]=le):le=t[58];let ue;t[59]===s?ue=t[60]:(ue=s({id:`X2zUS5`}),t[59]=s,t[60]=ue);let de;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Z.jsx)(Ip,{className:`size-3.5`}),t[61]=de):de=t[61];let fe;t[62]!==A||t[63]!==ue?(fe=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,className:`size-6 p-0 text-muted-foreground hover:text-destructive`,"aria-label":ue,onClick:A,children:de})}),t[62]=A,t[63]=ue,t[64]=fe):fe=t[64];let J;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(Vr,{children:(0,Z.jsx)(Y,{id:`X2zUS5`})}),t[65]=J):J=t[65];let me;t[66]===fe?me=t[67]:(me=(0,Z.jsxs)(Ur,{children:[fe,J]}),t[66]=fe,t[67]=me);let he;t[68]!==ce||t[69]!==le||t[70]!==me?(he=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[ce,le,me]}),t[68]=ce,t[69]=le,t[70]=me,t[71]=he):he=t[71];let ge;t[72]!==se||t[73]!==he?(ge=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[se,he]}),t[72]=se,t[73]=he,t[74]=ge):ge=t[74];let _e;t[75]!==m||t[76]!==F||t[77]!==n.anchor||t[78]!==n.target?(_e=m?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded border-l-2 border-muted-foreground/40 bg-muted/40 px-2 py-1`,children:[n.anchor!==null&&(0,Z.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground line-through`,title:n.anchor.quote,children:[`“`,n.anchor.quote,`”`]}),(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`05F1GY`})})]}):(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(`span`,{className:`w-full`,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,disabled:n.anchor===null,onClick:()=>F(n.anchor?.quote??``),className:`h-auto w-full justify-start truncate rounded border-l-2 border-muted-foreground/40 bg-muted/40 px-2 py-1 text-left text-xs font-normal text-muted-foreground hover:bg-muted/70 disabled:opacity-100`,children:(0,Z.jsx)(`span`,{className:`truncate`,children:n.target.kind===`property`?(0,Z.jsxs)(`span`,{className:`font-mono`,children:[_p(n.target.key,n.target.path),`:`,n.anchor===null?``:` “${n.anchor.quote}”`]}):(0,Z.jsxs)(Z.Fragment,{children:[`“`,n.anchor?.quote??``,`”`]})})})})}),(0,Z.jsx)(Vr,{children:n.anchor===null?(0,Z.jsx)(Y,{id:`aoT2xX`}):n.target.kind===`property`?(0,Z.jsx)(Y,{id:`FiyNln`}):(0,Z.jsx)(Y,{id:`DpjYd6`})})]}),t[75]=m,t[76]=F,t[77]=n.anchor,t[78]=n.target,t[79]=_e):_e=t[79];let ve;t[80]!==s||t[81]!==O||t[82]!==E||t[83]!==d||t[84]!==l||t[85]!==n.body?(ve=l?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(Aa,{ref:p,ariaLabel:s({id:`akmOT9`}),placeholder:s({id:`akmOT9`}),onEmptyChange:f,onContentChange:()=>{v.current=p.current?.getContent().instruction??null},onSubmit:E,onEscape:O,className:`max-h-40 overflow-y-auto rounded-md border px-2 py-1 text-sm`}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,onClick:O,children:(0,Z.jsx)(Y,{id:`dEgA5A`})}),(0,Z.jsx)(X,{size:`sm`,onClick:E,disabled:d,"aria-label":s({id:`3W5kYZ`}),children:(0,Z.jsx)(Y,{id:`tfDRzk`})})]})]}):(0,Z.jsx)(`p`,{"data-testid":`thread-comment-body`,className:`text-sm text-foreground/90`,children:n.body}),t[80]=s,t[81]=O,t[82]=E,t[83]=d,t[84]=l,t[85]=n.body,t[86]=ve):ve=t[86];let ye;t[87]!==m||t[88]!==h||t[89]!==L||t[90]!==n.id?(ye=m?(0,Z.jsxs)(X,{size:`sm`,variant:`outline`,className:`min-w-0`,onClick:L,children:[(0,Z.jsx)(cp,{className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:(0,Z.jsx)(Y,{id:`QlkiD5`})})]}):(0,Z.jsx)(Z.Fragment,{children:h&&(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-nowrap items-center justify-end gap-1.5`,children:(0,Z.jsxs)(X,{size:`sm`,variant:`outline`,className:`min-w-0`,onClick:()=>N(n.id),children:[(0,Z.jsx)(Ia,{className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:(0,Z.jsx)(Y,{id:`M7SqjM`})})]})})}),t[87]=m,t[88]=h,t[89]=L,t[90]=n.id,t[91]=ye):ye=t[91];let be;return t[92]!==r||t[93]!==z||t[94]!==B||t[95]!==V||t[96]!==H||t[97]!==U||t[98]!==re||t[99]!==ge||t[100]!==_e||t[101]!==ve||t[102]!==ye?(be=(0,Z.jsxs)(`article`,{ref:r,onPointerEnter:z,onPointerLeave:B,onFocusCapture:V,onBlurCapture:H,onClick:U,className:re,children:[ge,_e,ve,ye]}),t[92]=r,t[93]=z,t[94]=B,t[95]=V,t[96]=H,t[97]=U,t[98]=re,t[99]=ge,t[100]=_e,t[101]=ve,t[102]=ye,t[103]=be):be=t[103],be}function Uw(e){return!e}function Ww(){return Date.now()}var Gw=20,Kw=1600;function qw(e,t){let{cards:n,frame:r,ring:i,setFocusedId:a}=t;a(()=>e),r.current!==null&&cancelAnimationFrame(r.current);let o=0,s=()=>{r.current=null;let t=n.get(e);if(t){let e=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;t.scrollIntoView({block:`center`,behavior:e?`auto`:`smooth`});return}o+=1,!(o>=Gw)&&(r.current=requestAnimationFrame(s))};s(),i.current!==null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>{i.current=null,a(t=>t===e?null:t)},Kw)}function Jw(e){let t=(0,$.c)(52),{threads:n,groupByDocument:r,empty:i,testIdPrefix:a,scopeSwitch:o}=e,s=r===void 0?!1:r,{_:c}=Bn(),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=new Map,t[0]=p):p=t[0];let m=(0,Q.useRef)(p),[h,g]=(0,Q.useState)(rT),_=qt(),v=_n(),y;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(y=function(e,t){g(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r})},t[1]=y):y=t[1];let b=y,x=(0,Q.useRef)(null),S=(0,Q.useRef)(null),C;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>({cards:m.current,frame:S,ring:x,setFocusedId:f}),t[2]=C):C=t[2];let w=C,T,E;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{let e=e=>qw(e,w()),t=I();t!==null&&e(t);let n=Pe(t=>{t!==null&&e(t)}),r=Re(e);return()=>{n(),r(),x.current!==null&&window.clearTimeout(x.current),S.current!==null&&cancelAnimationFrame(S.current)}},E=[],t[3]=T,t[4]=E):(T=t[3],E=t[4]),(0,Q.useEffect)(T,E);let D,O,A,j,M,N,P,F,L;if(t[5]!==c||t[6]!==v||t[7]!==h||t[8]!==i||t[9]!==d||t[10]!==s||t[11]!==o||t[12]!==_||t[13]!==l||t[14]!==a||t[15]!==n){A=n.filter(nT);let e=n.filter(tT),r=l?n:A,f=s?Bw(r):[],p=f.length>0&&f.every(e=>h.has(e.docName)),y;t[25]===_?y=t[26]:(y=e=>_.includes(e.id),t[25]=_,t[26]=y),j=A.filter(y).map(eT);let x=A.map($w),S=x.length>0&&j.length===x.length,C;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(C=function(e){return e.threads.filter(Qw).map(Zw)},t[27]=C):C=t[27];let w=C,T;t[28]===_?T=t[29]:(T=function(e){let t=e.filter(e=>_.includes(e)).length;return t===0?!1:t===e.length?!0:`indeterminate`},t[28]=_,t[29]=T);let E=T,I=function(e){return(0,Z.jsx)(Hw,{thread:e,sending:_.includes(e.id),active:v===e.id,focused:d===e.id,cardRef:t=>{t?m.current.set(e.id,t):m.current.delete(e.id)}},e.id)};O=eg;let R;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(Jh,{children:(0,Z.jsx)(Y,{id:`VbyRUy`})}),t[30]=R):R=t[30];let z=e.length>0&&(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsxs)(X,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 gap-1 px-1.5 text-muted-foreground`,"aria-label":c(l?{id:`PHHEuH`,values:{0:e.length}}:{id:`gHb5bB`,values:{0:e.length}}),"aria-pressed":l,"data-testid":`${a}-resolved-toggle`,onClick:()=>u(Xw),children:[l?(0,Z.jsx)(Py,{"aria-hidden":`true`,className:`size-3.5`}):(0,Z.jsx)(Ny,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`text-[11px] tabular-nums`,children:e.length})]})}),(0,Z.jsx)(Vr,{children:l?(0,Z.jsx)(Y,{id:`LRLKnQ`}):(0,Z.jsx)(Y,{id:`o7AkQ0`})})]}),B=f.length>1&&(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{size:`icon`,variant:`ghost`,className:`size-6 shrink-0 text-muted-foreground`,"aria-label":c(p?{id:`QIrBIx`}:{id:`sR0I-f`}),"data-testid":`${a}-collapse-toggle`,onClick:()=>g(p?new Set:new Set(f.map(Yw))),children:p?(0,Z.jsx)(Bb,{"aria-hidden":`true`,className:`size-3.5`}):(0,Z.jsx)(qy,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsx)(Vr,{children:p?(0,Z.jsx)(Y,{id:`QIrBIx`}):(0,Z.jsx)(Y,{id:`sR0I-f`})})]}),V;t[31]===A.length?V=t[32]:(V=(0,Z.jsx)(Qh,{children:A.length}),t[31]=A.length,t[32]=V),t[33]!==z||t[34]!==B||t[35]!==V?(L=(0,Z.jsxs)($h,{children:[R,(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[z,B,V]})]}),t[33]=z,t[34]=B,t[35]=V,t[36]=L):L=t[36],M=o,N=A.length>0&&(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 px-4`,children:[(0,Z.jsx)(zi,{checked:S,onCheckedChange:()=>k(x,!S),"aria-label":c(S?{id:`Ns5f4J`}:{id:`8oWgty`}),"data-testid":`${a}-select-all`}),(0,Z.jsxs)(`span`,{className:`text-[11px] text-muted-foreground tabular-nums`,children:[j.length,`/`,x.length]})]}),D=Xh,P=`flex flex-col gap-3`,F=r.length===0?(0,Z.jsx)(Yh,{children:i}):s?f.map(e=>{let t=w(e),n=E(t);return(0,Z.jsx)(`section`,{"aria-label":e.docName,children:(0,Z.jsxs)(Kr,{open:!h.has(e.docName),onOpenChange:t=>b(e.docName,t),className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`div`,{className:`group/file flex items-center gap-1.5`,children:[(0,Z.jsx)(zi,{checked:n,disabled:t.length===0,onCheckedChange:()=>k(t,n!==!0),"aria-label":c(n===!0?{id:`T2fvhw`,values:{0:Cp(e.docName)}}:{id:`WkQ0Z_`,values:{0:Cp(e.docName)}}),"data-testid":`${a}-file-select-${e.docName}`,className:`opacity-0 transition-opacity focus-visible:opacity-100 group-hover/file:opacity-100`}),(0,Z.jsxs)(Gr,{title:e.docName,className:`group flex min-w-0 flex-1 cursor-pointer items-center gap-1.5 rounded text-left text-[11px] text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(xi,{className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:Cp(e.docName)}),(0,Z.jsx)(Sh,{variant:`outline`,className:`shrink-0 px-1 py-0 text-[10px] tabular-nums`,children:e.threads.length}),(0,Z.jsx)(Ku,{"aria-hidden":`true`,className:`size-3 shrink-0 transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`})]})]}),(0,Z.jsx)(Wr,{className:`flex flex-col gap-2 overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in] motion-reduce:animate-none`,children:e.threads.map(I)})]})},e.docName)}):r.map(I),t[5]=c,t[6]=v,t[7]=h,t[8]=i,t[9]=d,t[10]=s,t[11]=o,t[12]=_,t[13]=l,t[14]=a,t[15]=n,t[16]=D,t[17]=O,t[18]=A,t[19]=j,t[20]=M,t[21]=N,t[22]=P,t[23]=F,t[24]=L}else D=t[16],O=t[17],A=t[18],j=t[19],M=t[20],N=t[21],P=t[22],F=t[23],L=t[24];let R;t[37]!==D||t[38]!==P||t[39]!==F?(R=(0,Z.jsx)(D,{className:P,children:F}),t[37]=D,t[38]=P,t[39]=F,t[40]=R):R=t[40];let z;t[41]!==A.length||t[42]!==j||t[43]!==a?(z=A.length>0&&(0,Z.jsx)(Rw,{threadIds:j,testIdPrefix:a}),t[41]=A.length,t[42]=j,t[43]=a,t[44]=z):z=t[44];let B;return t[45]!==O||t[46]!==M||t[47]!==N||t[48]!==R||t[49]!==z||t[50]!==L?(B=(0,Z.jsxs)(O,{children:[L,M,N,R,z]}),t[45]=O,t[46]=M,t[47]=N,t[48]=R,t[49]=z,t[50]=L,t[51]=B):B=t[51],B}function Yw(e){return e.docName}function Xw(e){return!e}function Zw(e){return e.id}function Qw(e){return e.status!==`resolved`}function $w(e){return e.id}function eT(e){return e.id}function tT(e){return e.status===`resolved`}function nT(e){return e.status!==`resolved`}function rT(){return new Set}function iT(e){let t=(0,$.c)(4),{scopeSwitch:n}=e,r=o(),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Y,{id:`QzofTX`}),t[0]=i):i=t[0];let a;return t[1]!==n||t[2]!==r?(a=(0,Z.jsx)(Jw,{threads:r,groupByDocument:!0,empty:i,testIdPrefix:`comment-queue`,scopeSwitch:n}),t[1]=n,t[2]=r,t[3]=a):a=t[3],a}function aT(e){let t=(0,$.c)(7),{docName:n,scopeSwitch:r}=e,i=dt(n),a,o;t[0]===n?(a=t[1],o=t[2]):(a=()=>{Oe(n).catch(oT)},o=[n],t[0]=n,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o);let s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Y,{id:`zpfN9p`}),t[3]=s):s=t[3];let c;return t[4]!==r||t[5]!==i?(c=(0,Z.jsx)(Jw,{threads:i,empty:s,testIdPrefix:`comment-doc`,scopeSwitch:r}),t[4]=r,t[5]=i,t[6]=c):c=t[6],c}function oT(){}function sT(e){let t=(0,$.c)(3),{docName:n,scopeSwitch:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,Z.jsx)(om,{name:`comments-panel`,children:(0,Z.jsx)(aT,{docName:n,scopeSwitch:r})}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function cT(e){let t=(0,$.c)(13),{docName:n}=e,[r,i]=(0,Q.useState)(`doc`),a=OC(),o=a?`doc`:r,s,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=un();return e!==null&&i(e),Xt(i)},c=[],t[0]=s,t[1]=c):(s=t[0],c=t[1]),(0,Q.useEffect)(s,c);let l,u;t[2]!==n||t[3]!==o?(l=()=>(Yb({scope:o,docName:n}),lT),u=[o,n],t[2]=n,t[3]=o,t[4]=l,t[5]=u):(l=t[4],u=t[5]),(0,Q.useEffect)(l,u);let d;t[6]!==o||t[7]!==a?(d=a?void 0:(0,Z.jsx)(td,{scope:o,onScopeChange:i}),t[6]=o,t[7]=a,t[8]=d):d=t[8];let f=d,p;return t[9]!==n||t[10]!==o||t[11]!==f?(p=o===`doc`?(0,Z.jsx)(sT,{docName:n,scopeSwitch:f}):(0,Z.jsx)(iT,{scopeSwitch:f}),t[9]=n,t[10]=o,t[11]=f,t[12]=p):p=t[12],p}function lT(){return Yb(null)}var uT=!1,dT=new Set;function fT(e){if(e!==uT){uT=e;for(let e of dT)e()}}function pT(e){return dT.add(e),()=>{dT.delete(e)}}function mT(){return uT}function hT(){return(0,Q.useSyncExternalStore)(pT,mT,gT)}function gT(){return!1}var _T=new Map(uc.map(e=>[e.id,e.alias]));function vT(e){return e.source===`markdownlint`?_T.get(e.code):void 0}function yT(e,t,n){return ic({relativePath:hu(e),source:t.source,code:t.code,ruleAlias:vT(t),message:t.message,line:t.range.start.line+1,column:t.range.start.character+1,lineText:n})}function bT(e){return Oo(e===null?null:hu(e))}var xT=5;async function ST(e){let t=await fetch(`/api/backlinks?docName=${encodeURIComponent(e)}`),n=await t.json().catch(()=>null);if(!t.ok){let e=xc.safeParse(n),r=t.status;throw e.success?Error(e.data.title):new vi(Hc._({id:`XopE_I`,values:{status:r}}),{status:r})}let r=dc.safeParse(n);if(!r.success)throw new vi(Hc._({id:`lZAiSP`}),{status:t.status});return r.data.backlinks}async function CT(e){let t=await fetch(`/api/forward-links?docName=${encodeURIComponent(e)}`),n=await t.json().catch(()=>null);if(!t.ok){let e=xc.safeParse(n),r=t.status;throw e.success?Error(e.data.title):new vi(Hc._({id:`GemPfn`,values:{status:r}}),{status:r})}let r=ts.safeParse(n);if(!r.success)throw new vi(Hc._({id:`2YZwPB`}),{status:t.status});return r.data}function wT(e){let t=e.split(`/`);return t.length<=2?e:`…/${t.slice(-2).join(`/`)}`}function TT(e){window.location.hash=qp(e)}function ET(e){let t=(0,$.c)(9),{title:n,count:r,isLoading:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Gu,{className:`size-3.5 text-muted-foreground transition-transform group-data-[state=closed]:-rotate-90`}),t[0]=a):a=t[0];let o;t[1]===n?o=t[2]:(o=(0,Z.jsxs)(`span`,{className:`flex items-center gap-2.5`,children:[a,(0,Z.jsx)(Jh,{children:n})]}),t[1]=n,t[2]=o);let s;t[3]!==r||t[4]!==i?(s=!i&&(0,Z.jsx)(Qh,{children:r}),t[3]=r,t[4]=i,t[5]=s):s=t[5];let c;return t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(Gr,{className:`group flex w-full cursor-pointer items-center justify-between px-5 py-3 text-left transition-colors hover:bg-muted/40`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function DT(e){let t=(0,$.c)(10),{total:n,expanded:r,onToggle:i}=e;if(n<=xT)return null;let a=n-xT,o;t[0]===r?o=t[1]:(o=r?(0,Z.jsx)(Gu,{className:`size-3`}):(0,Z.jsx)(Ku,{className:`size-3`}),t[0]=r,t[1]=o);let s;t[2]!==r||t[3]!==a?(s=r?(0,Z.jsx)(Y,{id:`6fGjTz`}):(0,Z.jsx)(Y,{id:`ZptNUh`,values:{hidden:a}}),t[2]=r,t[3]=a,t[4]=s):s=t[4];let c;return t[5]!==r||t[6]!==i||t[7]!==o||t[8]!==s?(c=(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":r,className:`mt-2 inline-flex cursor-pointer items-center gap-1 px-3 text-xs text-muted-foreground transition-colors hover:text-foreground`,onClick:i,children:[o,s]}),t[5]=r,t[6]=i,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function OT(e){let t=(0,$.c)(38),{icon:n,iconColorClass:r,rowTooltip:i,title:a,path:o,anchor:s,snippet:c,titleHover:l,ariaLabel:u,href:d,external:f,disabled:p,onClick:m,trailing:h}=e,g=o!==void 0&&o!==a,_=r??`text-muted-foreground`,v;t[0]===_?v=t[1]:(v=gr(`mt-0.5 shrink-0`,_),t[0]=_,t[1]=v);let y;t[2]!==n||t[3]!==v?(y=(0,Z.jsx)(`span`,{className:v,children:n}),t[2]=n,t[3]=v,t[4]=y):y=t[4];let b=y,x;t[5]!==u||t[6]!==p||t[7]!==f||t[8]!==d||t[9]!==m||t[10]!==a||t[11]!==l?(x=d?(0,Z.jsxs)(`a`,{href:d,target:f?`_blank`:void 0,rel:f?`noopener noreferrer`:void 0,"aria-label":u,title:l,onClick:m,className:`block w-full truncate text-left font-medium text-foreground no-underline outline-none after:absolute after:inset-0 after:rounded-md focus-visible:after:ring-2 focus-visible:after:ring-ring`,children:[a,f?(0,Z.jsxs)(`span`,{className:`sr-only`,children:[` `,(0,Z.jsx)(Y,{id:`dbtjJh`})]}):null]}):(0,Z.jsx)(`button`,{type:`button`,"aria-label":u,title:l,disabled:p,onClick:m,className:gr(`block w-full truncate text-left font-medium text-foreground no-underline outline-none after:absolute after:inset-0 after:rounded-md focus-visible:after:ring-2 focus-visible:after:ring-ring`,`cursor-pointer bg-transparent p-0 disabled:cursor-not-allowed disabled:opacity-60`),children:a}),t[5]=u,t[6]=p,t[7]=f,t[8]=d,t[9]=m,t[10]=a,t[11]=l,t[12]=x):x=t[12];let S=x,C;t[13]===b?C=t[14]:(C=(0,Z.jsx)(`div`,{className:`mt-px flex items-center`,children:b}),t[13]=b,t[14]=C);let w;t[15]!==s||t[16]!==o||t[17]!==g?(w=g?(0,Z.jsxs)(`div`,{className:`truncate font-mono text-xs text-muted-foreground`,children:[o,s?(0,Z.jsxs)(`span`,{className:`ml-1`,children:[`· #`,s]}):null]}):null,t[15]=s,t[16]=o,t[17]=g,t[18]=w):w=t[18];let T;t[19]===c?T=t[20]:(T=c?(0,Z.jsx)(`p`,{className:`line-clamp-2 text-muted-foreground`,children:c}):null,t[19]=c,t[20]=T);let E;t[21]!==S||t[22]!==w||t[23]!==T?(E=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5 text-1sm`,children:[S,w,T]}),t[21]=S,t[22]=w,t[23]=T,t[24]=E):E=t[24];let D;t[25]===h?D=t[26]:(D=h?(0,Z.jsx)(`div`,{className:`mt-0.5 flex shrink-0 items-center`,children:h}):null,t[25]=h,t[26]=D);let O;t[27]!==C||t[28]!==E||t[29]!==D?(O=(0,Z.jsxs)(`div`,{className:`group relative flex items-start gap-2.5 rounded-md px-3 py-2.5 transition-colors hover:bg-muted/80`,children:[C,E,D]}),t[27]=C,t[28]=E,t[29]=D,t[30]=O):O=t[30];let k=O;if(i){let e;t[31]===k?e=t[32]:(e=(0,Z.jsx)(Br,{asChild:!0,children:k}),t[31]=k,t[32]=e);let n;t[33]===i?n=t[34]:(n=(0,Z.jsx)(Vr,{side:`top`,children:i}),t[33]=i,t[34]=n);let r;return t[35]!==e||t[36]!==n?(r=(0,Z.jsxs)(Ur,{children:[e,n]}),t[35]=e,t[36]=n,t[37]=r):r=t[37],r}return k}function kT(e){let t=(0,$.c)(39),{docName:n}=e,{_:r}=Bn(),{folderPaths:i,pages:a,pagesBySlug:o,pagesByBasename:s,loading:c}=Nd(),l,u;t[0]===n?(l=t[1],u=t[2]):(l=[`backlinks`,n],u=()=>ST(n),t[0]=n,t[1]=l,t[2]=u);let d;t[3]!==n||t[4]!==c||t[5]!==a?(d=!c&&(a.has(n)||Wo(n)),t[3]=n,t[4]=c,t[5]=a,t[6]=d):d=t[6];let f;t[7]!==l||t[8]!==u||t[9]!==d?(f={queryKey:l,queryFn:u,enabled:d},t[7]=l,t[8]=u,t[9]=d,t[10]=f):f=t[10];let{data:p,isLoading:m,error:h}=rr(f),g;t[11]===p?g=t[12]:(g=p===void 0?[]:p,t[11]=p,t[12]=g);let _=g,[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(n);b!==n&&(x(n),y(!1));let S;t[13]!==_||t[14]!==v?(S=v?_:_.slice(0,xT),t[13]=_,t[14]=v,t[15]=S):S=t[15];let C=S,w;t[16]===r?w=t[17]:(w=r({id:`9NJWgv`}),t[16]=r,t[17]=w);let T;t[18]!==_.length||t[19]!==m||t[20]!==w?(T=(0,Z.jsx)(ET,{title:w,count:_.length,isLoading:m}),t[18]=_.length,t[19]=m,t[20]=w,t[21]=T):T=t[21];let E;t[22]!==r||t[23]!==_.length||t[24]!==h||t[25]!==v||t[26]!==i||t[27]!==m||t[28]!==a||t[29]!==s||t[30]!==o||t[31]!==C?(E=h?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(qh,{children:h instanceof Error?h.message:r({id:`Xet9MX`})})}):_.length===0&&!m?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Yh,{children:(0,Z.jsx)(Y,{id:`rVxu1k`})})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:C.map((e,t)=>{let n=np(e.source,{pages:a,folderPaths:i,pagesBySlug:o,pagesByBasename:s});return(0,Z.jsx)(OT,{icon:(0,Z.jsx)(Ge,{className:`size-3.5`}),title:e.title,path:wT(e.source),titleHover:e.source,anchor:e.anchor,snippet:e.snippet,href:qp(n.hashDocName,e.anchor)},`${e.source}-${t}`)})}),(0,Z.jsx)(DT,{total:_.length,expanded:v,onToggle:()=>y(AT)})]}),t[22]=r,t[23]=_.length,t[24]=h,t[25]=v,t[26]=i,t[27]=m,t[28]=a,t[29]=s,t[30]=o,t[31]=C,t[32]=E):E=t[32];let D;t[33]!==m||t[34]!==E?(D=(0,Z.jsx)(Wr,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":m,children:E})}),t[33]=m,t[34]=E,t[35]=D):D=t[35];let O;return t[36]!==D||t[37]!==T?(O=(0,Z.jsxs)(Kr,{defaultOpen:!0,children:[T,D]}),t[36]=D,t[37]=T,t[38]=O):O=t[38],O}function AT(e){return!e}function jT(e){let t=(0,$.c)(49),{docName:n}=e,{_:r}=Bn(),{addPage:i,folderPaths:a,pages:o,pagesBySlug:s,pagesByBasename:c,loading:l}=Nd(),u,d;t[0]===n?(u=t[1],d=t[2]):(u=[`forward-links`,n],d=()=>CT(n),t[0]=n,t[1]=u,t[2]=d);let f;t[3]!==n||t[4]!==o||t[5]!==l?(f=!l&&(o.has(n)||Wo(n)),t[3]=n,t[4]=o,t[5]=l,t[6]=f):f=t[6];let p;t[7]!==u||t[8]!==d||t[9]!==f?(p={queryKey:u,queryFn:d,enabled:f},t[7]=u,t[8]=d,t[9]=f,t[10]=p):p=t[10];let{data:m,isLoading:h,error:g}=rr(p),_;t[11]===m?.forwardLinks?_=t[12]:(_=m?.forwardLinks??[],t[11]=m?.forwardLinks,t[12]=_);let v=_,[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(n);C!==n&&(w(n),S(!1),b(null));let T;t[13]!==x||t[14]!==v?(T=x?v:v.slice(0,xT),t[13]=x,t[14]=v,t[15]=T):T=t[15];let E=T,D;t[16]!==r||t[17]!==i||t[18]!==y?(D=async function(e,t){if(!y){b(t);try{await In(e,{addPage:i,onCreated:TT}),b(null)}catch(e){let t=e;Dc.error(t instanceof Error?t.message:r({id:`tfi40B`})),b(null)}}},t[16]=r,t[17]=i,t[18]=y,t[19]=D):D=t[19];let O=D,k;t[20]!==r||t[21]!==y||t[22]!==a||t[23]!==O||t[24]!==o||t[25]!==c||t[26]!==s||t[27]!==l?(k=function(e){let{title:t}=e;if(e.kind===`external`){let t=e.title===e.url;return(0,Z.jsx)(OT,{icon:(0,Z.jsx)(ju,{className:`size-3.5`}),rowTooltip:r({id:`XDzAnp`}),title:e.title,path:t?void 0:e.url,titleHover:e.url,snippet:e.snippet,href:e.url,external:!0},`ext:${e.url}`)}let n=Ti(e.docName,{pages:o,folderPaths:a,pagesBySlug:s,pagesByBasename:c}),i=!l&&n.kind===`create`,u=!l&&n.kind===`navigate`&&n.displayState===`folder`,d=wT(e.docName),f=e.title===e.docName?d:e.title,p=`doc:${e.docName}:${e.anchor??``}`,m=n.kind===`navigate`?n.hashDocName:e.docName,h=n.kind===`navigate`&&n.hash?n.hash:qp(m,e.anchor);if(i&&n.kind===`create`){let i={initialDir:n.initialDir,suggestedName:n.suggestedName};return(0,Z.jsx)(OT,{icon:(0,Z.jsx)(Lp,{className:`size-3.5`}),iconColorClass:`text-amber-600 dark:text-amber-400`,rowTooltip:r(y===p?{id:`kj9pAE`}:{id:`IQPyrD`}),ariaLabel:r(y===p?{id:`un8kBM`,values:{linkTitle:t}}:{id:`jEdF24`,values:{linkTitle:t}}),title:f,path:d,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,disabled:y!==null,onClick:()=>void O(i,p)},p)}return u&&n.kind===`navigate`?(0,Z.jsx)(OT,{icon:(0,Z.jsx)(Kf,{className:`size-3.5`}),iconColorClass:`text-sky-600 dark:text-sky-400`,ariaLabel:r({id:`P6lAT3`,values:{linkTitle:t}}),title:f,path:d,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,href:h},p):(0,Z.jsx)(OT,{icon:(0,Z.jsx)(Ge,{className:`size-3.5`}),title:f,path:d,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,href:h},p)},t[20]=r,t[21]=y,t[22]=a,t[23]=O,t[24]=o,t[25]=c,t[26]=s,t[27]=l,t[28]=k):k=t[28];let A=k,j;t[29]===r?j=t[30]:(j=r({id:`O0Z2Xr`}),t[29]=r,t[30]=j);let M;t[31]!==h||t[32]!==v.length||t[33]!==j?(M=(0,Z.jsx)(ET,{title:j,count:v.length,isLoading:h}),t[31]=h,t[32]=v.length,t[33]=j,t[34]=M):M=t[34];let N;t[35]!==r||t[36]!==g||t[37]!==x||t[38]!==h||t[39]!==v.length||t[40]!==A||t[41]!==E?(N=g?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(qh,{children:g instanceof Error?g.message:r({id:`pZAs1T`})})}):v.length===0&&!h?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Yh,{children:(0,Z.jsx)(Y,{id:`roiUQQ`})})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:E.map(A)}),(0,Z.jsx)(DT,{total:v.length,expanded:x,onToggle:()=>S(MT)})]}),t[35]=r,t[36]=g,t[37]=x,t[38]=h,t[39]=v.length,t[40]=A,t[41]=E,t[42]=N):N=t[42];let P;t[43]!==h||t[44]!==N?(P=(0,Z.jsx)(Wr,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":h,children:N})}),t[43]=h,t[44]=N,t[45]=P):P=t[45];let F;return t[46]!==M||t[47]!==P?(F=(0,Z.jsxs)(Kr,{defaultOpen:!0,children:[M,P]}),t[46]=M,t[47]=P,t[48]=F):F=t[48],F}function MT(e){return!e}function NT(e){let t=(0,$.c)(42),{docName:n}=e,{_:r}=Bn(),{pages:i,loading:a}=Nd(),o,s;t[0]===n?(o=t[1],s=t[2]):(o=[`forward-links`,n],s=()=>CT(n),t[0]=n,t[1]=o,t[2]=s);let c;t[3]!==n||t[4]!==i||t[5]!==a?(c=!a&&(i.has(n)||Wo(n)),t[3]=n,t[4]=i,t[5]=a,t[6]=c):c=t[6];let l;t[7]!==o||t[8]!==s||t[9]!==c?(l={queryKey:o,queryFn:s,enabled:c},t[7]=o,t[8]=s,t[9]=c,t[10]=l):l=t[10];let{data:u,isLoading:d,error:f}=rr(l),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(n);h!==n&&(g(n),m(!1));let _=u?.localTargets,v;t[11]===_?v=t[12]:(v=_??[],t[11]=_,t[12]=v);let y=v,b;t[13]!==p||t[14]!==y?(b=p?y:y.slice(0,xT),t[13]=p,t[14]=y,t[15]=b):b=t[15];let x=b,S;t[16]===n?S=t[17]:(S=function(e){let t={docName:n,line:e.line+1,column:e.column+1,source:`links`};Od(n,{kind:`lint`,detail:t}),window.dispatchEvent(new CustomEvent(md,{detail:t}))},t[16]=n,t[17]=S);let C=S,w;t[18]!==r||t[19]!==C?(w=function(e){let t=e.role===`image`,n=e.status===`exact`||e.status===`fallback`,i=e.resolvedTarget??e.href,a=e.status===`missing`?r({id:`VU3Nrn`}):r({id:`XYZ7tp`}),o=n?r(t?{id:`radOpL`,values:{identity:i}}:{id:`6LJJ1v`,values:{identity:i}}):e.status===`missing`?r(t?{id:`vPLUCm`,values:{identity:i}}:{id:`Lrsl_h`,values:{identity:i}}):r(t?{id:`y-LQPF`,values:{identity:i}}:{id:`Y_iImT`,values:{identity:i}});return(0,Z.jsx)(OT,{icon:t?(0,Z.jsx)(di,{className:`size-3.5`}):(0,Z.jsx)(Ge,{className:`size-3.5`}),iconColorClass:n?void 0:`text-amber-600 dark:text-amber-400`,title:wT(i),titleHover:i,ariaLabel:o,trailing:n?void 0:(0,Z.jsx)(Sh,{variant:`outline`,className:`font-normal text-muted-foreground`,children:a}),onClick:()=>C(e)},`lt:${e.range.start}-${e.range.end}`)},t[18]=r,t[19]=C,t[20]=w):w=t[20];let T=w,E;t[21]===r?E=t[22]:(E=r({id:`U3RIJu`}),t[21]=r,t[22]=E);let D;t[23]!==d||t[24]!==y.length||t[25]!==E?(D=(0,Z.jsx)(ET,{title:E,count:y.length,isLoading:d}),t[23]=d,t[24]=y.length,t[25]=E,t[26]=D):D=t[26];let O;t[27]!==r||t[28]!==f||t[29]!==p||t[30]!==d||t[31]!==_||t[32]!==T||t[33]!==y.length||t[34]!==x?(O=f?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(qh,{children:f instanceof Error?f.message:r({id:`1xui0Q`})})}):_===void 0&&!d?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Yh,{children:(0,Z.jsx)(Y,{id:`g-dkjJ`})})}):y.length===0&&!d?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Yh,{children:(0,Z.jsx)(Y,{id:`pJ7XCo`})})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:x.map(T)}),(0,Z.jsx)(DT,{total:y.length,expanded:p,onToggle:()=>m(PT)})]}),t[27]=r,t[28]=f,t[29]=p,t[30]=d,t[31]=_,t[32]=T,t[33]=y.length,t[34]=x,t[35]=O):O=t[35];let k;t[36]!==d||t[37]!==O?(k=(0,Z.jsx)(Wr,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":d,children:O})}),t[36]=d,t[37]=O,t[38]=k):k=t[38];let A;return t[39]!==D||t[40]!==k?(A=(0,Z.jsxs)(Kr,{defaultOpen:!0,children:[D,k]}),t[39]=D,t[40]=k,t[41]=A):A=t[41],A}function PT(e){return!e}function FT(e){let t=(0,$.c)(15),{docName:n,className:r}=e,i=r===void 0?``:r,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(jT,{docName:n}),t[0]=n,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(La,{}),t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Z.jsx)(NT,{docName:n}),t[3]=n,t[4]=s);let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(La,{}),t[5]=c):c=t[5];let l;t[6]===n?l=t[7]:(l=(0,Z.jsx)(kT,{docName:n}),t[6]=n,t[7]=l);let u;t[8]!==a||t[9]!==s||t[10]!==l?(u=(0,Z.jsxs)(Xh,{className:`px-0 py-0`,children:[a,o,s,c,l]}),t[8]=a,t[9]=s,t[10]=l,t[11]=u):u=t[11];let d;return t[12]!==i||t[13]!==u?(d=(0,Z.jsx)(eg,{className:i,children:u}),t[12]=i,t[13]=u,t[14]=d):d=t[14],d}function IT(e){let t=e.setTimer??((e,t)=>setTimeout(e,t)),n=e.clearTimer??(e=>clearTimeout(e)),r=!1,i=!1,a=null,o=null,s=e.baseMs,c=!1,l=n=>{if(!r){if(e.isPaused()){c=!0;return}a=t(u,n)}};async function u(){if(a=null,c=!1,r)return;if(e.isPaused()){c=!0;return}o=new AbortController;let t=o.signal;try{let n=await e.poll(t);if(r)return;n===`ok`?(s=e.baseMs,l(e.baseMs)):(s=Math.min(s*2,e.maxBackoffMs),l(s))}catch{if(r||t.aborted)return;s=Math.min(s*2,e.maxBackoffMs),l(s)}}return{start(){r||i||(i=!0,u())},resume(){r||!e.isPaused()&&c&&a===null&&(c=!1,u())},stop(){r=!0,a!==null&&(n(a),a=null),o?.abort()}}}var LT=1e4,RT=6e4;async function zT(e,t,n){try{let r=await fetch(`/api/history?docName=${encodeURIComponent(e)}&limit=100`,{signal:t});if(!r.ok)return n.setError(n.unavailableMessage),`error`;let i=await r.json();return n.setEntries((i.entries??[]).filter(BT)),n.setError(null),`ok`}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)throw e;return n.setError(n.unavailableMessage),console.error(`[timeline]`,e),`error`}finally{t.aborted||n.setLoading(!1)}}function BT(e){return e.type===`checkpoint`?e.checkpoint!==null&&pc(e.checkpoint.kind):!0}function VT(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return Hc._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return Hc._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return Hc._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return Hc._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?Hc._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function HT(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function UT(e){if(e.type===`checkpoint`)return{kind:`recovered`};if(e.type===`upstream`)return{kind:`upstream`};let t=e.message,n=/^rollback: .+ to ([0-9a-f]{7,40})$/.exec(t);if(n)return{kind:`restore`,targetSha7:n[1].slice(0,7)};let r=/^rename: (.+) -> (.+)$/.exec(t);return r?{kind:`rename`,from:r[1],to:r[2]}:t.startsWith(`reconcile: `)?{kind:`reconcile`}:t.startsWith(`import: `)?{kind:`upstream`}:{kind:`edit`}}function WT(e){return e.split(`/`).pop()??e}function GT(e){return e.type===`checkpoint`?Hc._({id:`C-twqs`}):e.type===`upstream`?Hc._({id:`K_vT1F`}):e.contributors.length===1?e.contributors[0].name:e.contributors.length>1?e.contributors.map(e=>e.name).join(`, `):e.author===`openknowledge-server`||e.author===`server`?Hc._({id:`B2DrPb`}):e.author}function KT(e){let t=$o;return e===t.fileSystem?`file-system`:e===t.service||e===t.gitUpstream?`upstream`:e===t.generator?`generated`:`person`}function qT(e){let t=(0,$.c)(19),{entry:n,isDark:r}=e;if(n.type===`checkpoint`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(kl,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),t[0]=e):e=t[0],e}if(n.type===`upstream`){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(vu,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[1]=e):e=t[1],e}if(n.contributors.length>0){let e=n.contributors[0],i=e.colorSeed??e.name,a;t[2]===i?a=t[3]:(a=Us(i),t[2]=i,t[3]=a);let o=a,s=r?Zs[o]??hc[o]:hc[o],c;t[4]!==s||t[5]!==i?(c=s??Vo(i),t[4]=s,t[5]=i,t[6]=c):c=t[6];let l=c;if(o!==`bot`){let e;t[7]===l?e=t[8]:(e={color:l},t[7]=l,t[8]=e);let n;return t[9]!==o||t[10]!==e?(n=(0,Z.jsx)(sg,{icon:o,width:14,height:14,className:`shrink-0`,style:e}),t[9]=o,t[10]=e,t[11]=n):n=t[11],n}switch(KT(e.name)){case`file-system`:{let e;return t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Qy,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[12]=e):e=t[12],e}case`upstream`:{let e;return t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(yu,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[13]=e):e=t[13],e}case`generated`:{let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(pt,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[14]=e):e=t[14],e}default:{let e;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Vb,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[15]=e):e=t[15],e}}}if(n.authorEmail.includes(`agent`)||n.author.includes(`agent`)||n.authorEmail.includes(`cursor`)||n.authorEmail.includes(`claude`)){let e;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(pt,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=e):e=t[16],e}if(n.author===`openknowledge-server`||n.author===`server`){let e;return t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(yu,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[17]=e):e=t[17],e}let i;return t[18]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Vb,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[18]=i):i=t[18],i}function JT(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function YT(e){let t=(0,$.c)(21),{summaries:n}=e,[r,i]=(0,Q.useState)(!1),a=(0,Q.useId)();if(n.length===0)return null;let o,s;t[0]===n?(o=t[1],s=t[2]):([o,...s]=n,t[0]=n,t[1]=o,t[2]=s);let c=s.length,l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),t[3]=l):l=t[3];let u;t[4]===o?u=t[5]:(u=(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[l,o]}),t[4]=o,t[5]=u);let d;t[6]!==r||t[7]!==s?(d=r&&s.map(ZT),t[6]=r,t[7]=s,t[8]=d):d=t[8];let f;t[9]!==a||t[10]!==u||t[11]!==d?(f=(0,Z.jsxs)(`ul`,{id:a,className:`list-none`,children:[u,d]}),t[9]=a,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p;t[13]!==r||t[14]!==c||t[15]!==a||t[16]!==s.length?(p=s.length>0&&(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":r,"aria-controls":a,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,onClick:e=>{e.stopPropagation(),i(XT)},children:[r?(0,Z.jsx)(Gu,{className:`size-3`}):(0,Z.jsx)(Ku,{className:`size-3`}),r?(0,Z.jsx)(Y,{id:`vLyv1R`}):(0,Z.jsx)(Y,{id:`ZptNUh`,values:{hidden:c}})]}),t[13]=r,t[14]=c,t[15]=a,t[16]=s.length,t[17]=p):p=t[17];let m;return t[18]!==f||t[19]!==p?(m=(0,Z.jsxs)(`div`,{className:`mt-0.5`,children:[f,p]}),t[18]=f,t[19]=p,t[20]=m):m=t[20],m}function XT(e){return!e}function ZT(e,t){return(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),e]},`${t}-${e}`)}function QT(e){let t=(0,$.c)(36),{descriptor:n,allDocs:r,versionBySha7:i,onJumpToVersion:a}=e,{_:o}=Bn();if(n.kind===`restore`){let e,r;t[0]!==o||t[1]!==n.targetSha7||t[2]!==i?(r=i.get(n.targetSha7),e=o(r?{id:`sICrVf`,values:{0:HT(r.timestamp)}}:{id:`i09An-`,values:{0:n.targetSha7}}),t[0]=o,t[1]=n.targetSha7,t[2]=i,t[3]=e,t[4]=r):(e=t[3],r=t[4]);let s=e,c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Ia,{className:`size-3 shrink-0`,"aria-hidden":!0}),t[5]=c):c=t[5];let l;return t[6]!==n.targetSha7||t[7]!==s||t[8]!==a||t[9]!==r?(l=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[c,r?(0,Z.jsx)(`button`,{type:`button`,className:`truncate text-left underline-offset-2 hover:text-foreground hover:underline`,title:s,onClick:e=>{e.stopPropagation(),a(n.targetSha7)},children:s}):(0,Z.jsx)(`span`,{className:`truncate`,title:s,children:s})]}),t[6]=n.targetSha7,t[7]=s,t[8]=a,t[9]=r,t[10]=l):l=t[10],l}if(n.kind===`rename`){let e=`${n.from} → ${n.to}`,r;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(pu,{className:`size-3 shrink-0`,"aria-hidden":!0}),t[11]=r):r=t[11];let i;t[12]!==o||t[13]!==n.from||t[14]!==n.to?(i=o({id:`GkYV_4`,values:{0:WT(n.from),1:WT(n.to)}}),t[12]=o,t[13]=n.from,t[14]=n.to,t[15]=i):i=t[15];let a;t[16]===i?a=t[17]:(a=(0,Z.jsx)(`span`,{className:`truncate`,children:i}),t[16]=i,t[17]=a);let s;return t[18]!==e||t[19]!==a?(s=(0,Z.jsxs)(`p`,{className:`flex items-center gap-1 truncate text-xs text-muted-foreground`,title:e,children:[r,a]}),t[18]=e,t[19]=a,t[20]=s):s=t[20],s}if(n.kind===`reconcile`){let e;t[21]===o?e=t[22]:(e=o({id:`0qyKG6`}),t[21]=o,t[22]=e);let n;return t[23]===e?n=t[24]:(n=(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e}),t[23]=e,t[24]=n),n}if(n.kind===`recovered`)return null;if(r.length>0){let e;t[25]===r?e=t[26]:(e=r.join(`, `),t[25]=r,t[26]=e);let n;t[27]===r?n=t[28]:(n=r.join(`, `),t[27]=r,t[28]=n);let i;return t[29]!==e||t[30]!==n?(i=(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:e,children:n}),t[29]=e,t[30]=n,t[31]=i):i=t[31],i}if(n.kind===`upstream`)return null;let s;t[32]===o?s=t[33]:(s=o({id:`MRZxAn`}),t[32]=o,t[33]=s);let c;return t[34]===s?c=t[35]:(c=(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:s}),t[34]=s,t[35]=c),c}function $T(e){let t=(0,$.c)(122),{entry:n,isDark:r,docName:i,laterEdits:a,onRestoreSuccess:o,versionBySha7:s,onJumpToVersion:c,registerRowRef:l,flashing:u}=e,{_:d}=Bn(),f;t[0]===n.timestamp?f=t[1]:(f=VT(n.timestamp),t[0]=n.timestamp,t[1]=f);let p=f,m;t[2]===n?m=t[3]:(m=GT(n),t[2]=n,t[3]=m);let h=m,g;t[4]===n.timestamp?g=t[5]:(g=HT(n.timestamp),t[4]=n.timestamp,t[5]=g);let _=g,v;t[6]===n.contributors?v=t[7]:(v=n.contributors.flatMap(eE),t[6]=n.contributors,t[7]=v);let y=v,b;t[8]===n?b=t[9]:(b=JT(n),t[8]=n,t[9]=b);let x=b,S;t[10]===n?S=t[11]:(S=UT(n),t[10]=n,t[11]=S);let C=S,[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(!1),O=(0,Q.useRef)(null),k=ug(),A=k?.docName===i&&k.sha===n.sha,j,M;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>()=>O.current?.abort(),M=[],t[12]=j,t[13]=M):(j=t[12],M=t[13]),(0,Q.useEffect)(j,M);let N;t[14]!==_||t[15]!==h||t[16]!==i||t[17]!==n.parentSha||t[18]!==n.sha||t[19]!==a||t[20]!==p?(N=()=>{cg(),lg({docName:i,sha:n.sha,parentSha:n.parentSha??null,laterEdits:a,authorName:h,relativeTime:p,absoluteTime:_})},t[14]=_,t[15]=h,t[16]=i,t[17]=n.parentSha,t[18]=n.sha,t[19]=a,t[20]=p,t[21]=N):N=t[21];let P=N,F;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(F=function(){O.current?.abort(),O.current=null,D(!1),T(!1)},t[22]=F):F=t[22];let I=F,L;t[23]!==d||t[24]!==i||t[25]!==n.sha||t[26]!==o?(L=async function(){D(!0);let e=new AbortController;O.current=e;let t=function(){e.signal.aborted||D(!1),O.current===e&&(O.current=null)},r;try{r=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:i,commitSha:n.sha}),signal:e.signal})}catch(r){let a=r;!e.signal.aborted&&!(a instanceof DOMException&&a.name===`AbortError`)&&(console.error(`[timeline] rollback fetch failed`,{docName:i,sha:n.sha,err:a}),Dc.error(d({id:`NkXEFS`}),{duration:4e3})),t();return}if(e.signal.aborted){t();return}if(r.ok)T(!1),o();else{let e=`HTTP ${r.status}`;try{let t=xc.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}console.error(`[timeline] rollback failed`,{docName:i,sha:n.sha,status:r.status,detail:e}),Dc.error(d({id:`uM6jnS`}),{description:e,duration:6e3})}t()},t[23]=d,t[24]=i,t[25]=n.sha,t[26]=o,t[27]=L):L=t[27];let R=L,z;t[28]!==n||t[29]!==r?(z=(0,Z.jsx)(qT,{entry:n,isDark:r}),t[28]=n,t[29]=r,t[30]=z):z=t[30];let B=z,V=u?`ring-2 ring-ring ring-offset-1 ring-offset-background`:``,ee;t[31]===V?ee=t[32]:(ee=[`flex flex-col rounded-lg transition-shadow`,V],t[31]=V,t[32]=ee);let H=ee.join(` `),U=A?`bg-muted`:`hover:bg-muted/80`,W;t[33]===U?W=t[34]:(W=[`group flex w-full items-start gap-2.5 rounded-lg px-3 py-2.5 text-left transition-colors cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring`,U],t[33]=U,t[34]=W);let G=W.join(` `),te;t[35]===P?te=t[36]:(te=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),P())},t[35]=P,t[36]=te);let ne;t[37]===B?ne=t[38]:(ne=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:B}),t[37]=B,t[38]=ne);let re;t[39]===h?re=t[40]:(re=(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:h}),t[39]=h,t[40]=re);let K;t[41]!==n.timestamp||t[42]!==p?(K=(0,Z.jsx)(`time`,{className:`ml-auto shrink-0 text-xs text-muted-foreground/80`,dateTime:n.timestamp,title:n.timestamp,children:p}),t[41]=n.timestamp,t[42]=p,t[43]=K):K=t[43];let ie;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[44]=ie):ie=t[44];let q;t[45]===d?q=t[46]:(q=d({id:`Yea-K5`}),t[45]=d,t[46]=q);let ae;t[47]!==R||t[48]!==a?(ae=e=>{e.stopPropagation(),a>0?T(!0):R()},t[47]=R,t[48]=a,t[49]=ae):ae=t[49];let oe;t[50]===E?oe=t[51]:(oe=E?(0,Z.jsx)(ip,{"aria-hidden":`true`,className:`size-3`}):(0,Z.jsx)(Rp,{className:`size-3`}),t[50]=E,t[51]=oe);let se;t[52]!==E||t[53]!==q||t[54]!==ae||t[55]!==oe?(se=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`timeline-entry-restore`,"aria-label":q,disabled:E,onClick:ae,children:oe})}),t[52]=E,t[53]=q,t[54]=ae,t[55]=oe,t[56]=se):se=t[56];let ce;t[57]===d?ce=t[58]:(ce=d({id:`Yea-K5`}),t[57]=d,t[58]=ce);let le;t[59]===ce?le=t[60]:(le=(0,Z.jsx)(Vr,{side:`top`,children:ce}),t[59]=ce,t[60]=le);let ue;t[61]!==se||t[62]!==le?(ue=(0,Z.jsxs)(Ur,{children:[se,le]}),t[61]=se,t[62]=le,t[63]=ue):ue=t[63];let de;t[64]!==re||t[65]!==K||t[66]!==ue?(de=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[re,K,ie,ue]}),t[64]=re,t[65]=K,t[66]=ue,t[67]=de):de=t[67];let fe;t[68]===x?fe=t[69]:(fe=x.length>0&&(0,Z.jsx)(YT,{summaries:x}),t[68]=x,t[69]=fe);let pe;t[70]!==y||t[71]!==C||t[72]!==c||t[73]!==s?(pe=(0,Z.jsx)(QT,{descriptor:C,allDocs:y,versionBySha7:s,onJumpToVersion:c}),t[70]=y,t[71]=C,t[72]=c,t[73]=s,t[74]=pe):pe=t[74];let J;t[75]!==de||t[76]!==fe||t[77]!==pe?(J=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[de,fe,pe]}),t[75]=de,t[76]=fe,t[77]=pe,t[78]=J):J=t[78];let me;t[79]!==P||t[80]!==A||t[81]!==G||t[82]!==te||t[83]!==ne||t[84]!==J?(me=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-pressed":A,"data-testid":`timeline-entry-open`,className:G,onClick:P,onKeyDown:te,children:[ne,J]}),t[79]=P,t[80]=A,t[81]=G,t[82]=te,t[83]=ne,t[84]=J,t[85]=me):me=t[85];let he;t[86]!==l||t[87]!==H||t[88]!==me?(he=(0,Z.jsx)(`div`,{ref:l,className:H,children:me}),t[86]=l,t[87]=H,t[88]=me,t[89]=he):he=t[89];let ge;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(ge=e=>{e?T(!0):I()},t[90]=ge):ge=t[90];let _e;t[91]===d?_e=t[92]:(_e=d({id:`n3wx1q`}),t[91]=d,t[92]=_e);let ve;t[93]===_e?ve=t[94]:(ve=(0,Z.jsx)(Jr,{children:_e}),t[93]=_e,t[94]=ve);let ye;t[95]===a?ye=t[96]:(ye=(0,Z.jsx)(Y,{id:`nfPccR`,values:{laterEdits:a}}),t[95]=a,t[96]=ye);let be;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(Y,{id:`5ZbJFS`}),t[97]=be):be=t[97];let xe;t[98]===ye?xe=t[99]:(xe=(0,Z.jsxs)(qr,{children:[ye,` `,be]}),t[98]=ye,t[99]=xe);let Se;t[100]!==ve||t[101]!==xe?(Se=(0,Z.jsxs)($r,{children:[ve,xe]}),t[100]=ve,t[101]=xe,t[102]=Se):Se=t[102];let Ce;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(X,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:I,children:(0,Z.jsx)(Y,{id:`dEgA5A`})}),t[103]=Ce):Ce=t[103];let we;t[104]===R?we=t[105]:(we=()=>R(),t[104]=R,t[105]=we);let Te;t[106]===E?Te=t[107]:(Te=E?(0,Z.jsx)(ip,{"aria-hidden":`true`,className:`mr-2 size-4`}):null,t[106]=E,t[107]=Te);let Ee;t[108]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Z.jsx)(Y,{id:`yKu_3Y`}),t[108]=Ee):Ee=t[108];let De;t[109]!==E||t[110]!==we||t[111]!==Te?(De=(0,Z.jsxs)(Zr,{children:[Ce,(0,Z.jsxs)(X,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:E,onClick:we,children:[Te,Ee]})]}),t[109]=E,t[110]=we,t[111]=Te,t[112]=De):De=t[112];let Oe;t[113]!==Se||t[114]!==De?(Oe=(0,Z.jsxs)(Yr,{children:[Se,De]}),t[113]=Se,t[114]=De,t[115]=Oe):Oe=t[115];let ke;t[116]!==w||t[117]!==Oe?(ke=(0,Z.jsx)(ei,{open:w,onOpenChange:ge,children:Oe}),t[116]=w,t[117]=Oe,t[118]=ke):ke=t[118];let Ae;return t[119]!==he||t[120]!==ke?(Ae=(0,Z.jsxs)(Z.Fragment,{children:[he,ke]}),t[119]=he,t[120]=ke,t[121]=Ae):Ae=t[121],Ae}function eE(e){return e.docs}function tE(e){let t=(0,$.c)(27),{docName:n}=e,{_:r}=Bn(),{resolvedTheme:i}=sr(),a=i===`dark`,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=[],t[0]=o):o=t[0];let[s,c]=(0,Q.useState)(o),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),p=(0,Q.useRef)(new Map),[m,h]=(0,Q.useState)(null),g=(0,Q.useRef)(null),_=new Map;for(let e of s)_.set(e.sha.slice(0,7),e);let v,y;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>()=>clearTimeout(g.current??void 0),y=[],t[1]=v,t[2]=y):(v=t[1],y=t[2]),(0,Q.useEffect)(v,y);let b=function(e){let t=_.get(e);t&&(p.current.get(t.sha)?.scrollIntoView({behavior:`smooth`,block:`center`}),h(t.sha),clearTimeout(g.current??void 0),g.current=setTimeout(()=>h(null),1600))},x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=function(){dg()},t[3]=x):x=t[3];let S=x,C,w;t[4]!==r||t[5]!==n?(C=()=>{if(!n){c([]);return}u(!0);let e=IT({baseMs:LT,maxBackoffMs:RT,isPaused:rE,poll:e=>zT(n,e,{setEntries:c,setError:f,setLoading:u,unavailableMessage:r({id:`brCtGB`})})});e.start();let t=()=>e.resume();return typeof document<`u`&&document.addEventListener(`visibilitychange`,t),()=>{e.stop(),typeof document<`u`&&document.removeEventListener(`visibilitychange`,t)}},w=[n,r],t[4]=r,t[5]=n,t[6]=C,t[7]=w):(C=t[6],w=t[7]),(0,Q.useEffect)(C,w);let T;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)($h,{children:(0,Z.jsx)(Jh,{children:(0,Z.jsx)(Y,{id:`cklVjM`})})}),t[8]=T):T=t[8];let E;t[9]!==r||t[10]!==l?(E=l&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,role:`status`,"aria-busy":`true`,"aria-label":r({id:`o49mDZ`}),children:[1,2,3].map(nE)}),t[9]=r,t[10]=l,t[11]=E):E=t[11];let D;t[12]!==d||t[13]!==l?(D=!l&&d&&(0,Z.jsx)(`div`,{className:`px-4 py-3`,children:(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:d})}),t[12]=d,t[13]=l,t[14]=D):D=t[14];let O;t[15]!==s||t[16]!==d||t[17]!==l?(O=!l&&!d&&s.length===0&&(0,Z.jsx)(`div`,{className:`px-4 py-8 text-center`,children:(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`Ta25TG`})})}),t[15]=s,t[16]=d,t[17]=l,t[18]=O):O=t[18];let k=!l&&!d&&s.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:s.map((e,t)=>(0,Z.jsx)($T,{entry:e,isDark:a,docName:n,laterEdits:t,onRestoreSuccess:S,versionBySha7:_,onJumpToVersion:b,registerRowRef:t=>{t?p.current.set(e.sha,t):p.current.delete(e.sha)},flashing:m===e.sha},e.sha))}),A;t[19]!==E||t[20]!==D||t[21]!==O||t[22]!==k?(A=(0,Z.jsxs)(`div`,{className:`flex-1 overflow-y-auto subtle-scrollbar scroll-fade-mask`,children:[E,D,O,k]}),t[19]=E,t[20]=D,t[21]=O,t[22]=k,t[23]=A):A=t[23];let j;return t[24]!==A||t[25]!==T?(j=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[T,A]}),t[24]=A,t[25]=T,t[26]=j):j=t[26],j}function nE(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(tg,{className:`size-3.5 rounded mt-0.5 shrink-0`}),(0,Z.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Z.jsx)(tg,{className:`h-3 w-28`}),(0,Z.jsx)(tg,{className:`h-3 w-40`})]})]},e)}function rE(){return typeof document<`u`&&document.visibilityState===`hidden`}var iE=`open-knowledge:lint-source-fixed`,aE=Object.freeze({source:`local`,skipStoreHooks:!1,context:Object.freeze({origin:`lint-fix`})});function oE(e,t){let n=e.split(`
3
+ `),r=0;for(let e=0;e<t.line&&e<n.length;e+=1)r+=n[e].length+1;let i=n[Math.min(t.line,n.length-1)]?.length??0;return r+Math.min(Math.max(t.character,0),i)}function sE(e){return e.flatMap(e=>e.fixes??[])}function cE(e,t,n){if(t.length===0)return!1;let r=e.document.getText(`source`),i=r.toString(),a=t.map(e=>({from:oE(i,e.range.start),to:oE(i,e.range.end),insert:e.newText})).sort((e,t)=>t.to-e.to||t.from-e.from||e.insert.localeCompare(t.insert)),o=0;return e.document.transact(()=>{let e=1/0,t;for(let n of a){let i=t!==void 0&&n.from===t.from&&n.to===t.to&&n.insert===t.insert;t=n,!(i||n.to>e)&&(n.to>n.from&&r.delete(n.from,n.to-n.from),n.insert.length>0&&r.insert(n.from,n.insert),e=n.from,o+=1)}},aE),o>0&&ge(n),typeof window<`u`&&window.dispatchEvent(new CustomEvent(iE)),!0}var lE=[{id:`outline`,icon:ab},{id:`links`,icon:lt},{id:`graph`,icon:cb},{id:`timeline`,icon:Fy},{id:`problems`,icon:Lp},{id:`comments`,icon:fp}],uE=[`outline`,`problems`,`comments`];function dE(e){let t=0,n=0;for(let r of e)r.severity===`error`?t+=1:n+=1;return{errorCount:t,warningCount:n}}function fE(e){return e===`outline`?Hc._({id:`dD7NPy`}):e===`links`?Hc._({id:`Rj01Fz`}):e===`graph`?Hc._({id:`x2fr_j`}):e===`problems`?Hc._({id:`OXdGnd`}):e===`comments`?Hc._({id:`VbyRUy`}):Hc._({id:`cklVjM`})}function pE(){return n(()=>import(`./GraphPanel-DDKxNmOr.js`),__vite__mapDeps([38,1,28,2,3,29,30,31,32,33,37,7,8,9,39,11,12,13,40,41,16,17,18,19,42,43,44,45,14,46,47,48,49,50,51,52,53,21,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69]),import.meta.url)}var mE=(0,Q.lazy)(async()=>({default:(await pE()).GraphPanel})),hE=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-B37XJHxx.js`),__vite__mapDeps([70,1,37,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,42,43,44,45,71,2,72,73,33,74,75,76,77,78,79,80,81,82,28,3,29,30,31,32,83,66,84,85,86,87,88,89,4,5,90,40,91,92,24,23,93,94,25,34,56,57,58,95,68,61,96,97,98,64,65,99,100,55,59,60,62,101,102,103,26,104,105,106,107,35,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123]),import.meta.url)).ActivityModeContent}));function gE(e){let t=(0,$.c)(48),{docName:n,isSourceMode:r,activeTab:i,onActiveTabChange:a,mode:o,isCollapsed:s}=e,c=s===void 0?!1:s,{_:l}=Bn(),{activeProvider:u,activeDocName:d}=Et(),{data:f}=ig(n),p=d===n?u:null,m=Pf(p,f?.effective??null),h=Yu(n),g=h.findings,_;t[0]!==g||t[1]!==m?(_=[...m,...g],t[0]=g,t[1]=m,t[2]=_):_=t[2];let v=_,y,b;t[3]!==n||t[4]!==m||t[5]!==p?(y=()=>{p!==null&&Dd(n,`lint`,dE(m))},b=[n,p,m],t[3]=n,t[4]=m,t[5]=p,t[6]=y,t[7]=b):(y=t[6],b=t[7]),(0,Q.useEffect)(y,b);let x,S;t[8]!==n||t[9]!==g||t[10]!==h.status||t[11]!==p?(x=()=>{p===null||h.status!==`loaded`||Dd(n,`links`,dE(g))},S=[n,p,g,h.status],t[8]=n,t[9]=g,t[10]=h.status,t[11]=p,t[12]=x,t[13]=S):(x=t[12],S=t[13]),(0,Q.useEffect)(x,S);let C;t[14]!==n||t[15]!==p?(C=e=>{p!==null&&e.fixes&&e.fixes.length>0&&cE(p,e.fixes,n)},t[14]=n,t[15]=p,t[16]=C):C=t[16];let w=C,T;t[17]!==n||t[18]!==m||t[19]!==p?(T=()=>{p!==null&&cE(p,sE(m),n)},t[17]=n,t[18]=m,t[19]=p,t[20]=T):T=t[20];let E=T,D=jr(),O;t[21]!==n||t[22]!==p?(O=e=>{if(p===null)return;let t=p.document.getText(`source`).toString().split(`
4
+ `)[e.range.start.line];xl(yT(n,e,t),{submit:!0})},t[21]=n,t[22]=p,t[23]=O):O=t[23];let k=O,A;t[24]===n?A=t[25]:(A=e=>{xl(bT(e===`doc`?n:null),{submit:!0})},t[24]=n,t[25]=A);let j=A,M=OC()?lE.filter(vE):lE,N=M.some(e=>e.id===i)?i:`outline`,P=o===`doc`&&M.length>1,F,I;t[26]!==N||t[27]!==c||t[28]!==o?(F=()=>(fT(!c&&o===`doc`&&N===`comments`),_E),I=[c,o,N],t[26]=N,t[27]=c,t[28]=o,t[29]=F,t[30]=I):(F=t[29],I=t[30]),(0,Q.useEffect)(F,I);let L=P?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(Ba,{type:`single`,variant:`outline`,value:N,onValueChange:e=>{e&&a(e)},"aria-label":l({id:`SrOuyg`}),children:M.map(e=>{let{id:t,icon:n}=e,r=fE(t),i=t===`problems`&&v.length>0;return(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(Ra,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":i?l({id:`2m_bmh`,values:{0:v.length,label:r}}):r,asChild:!0,children:(0,Z.jsxs)(Br,{className:`relative`,children:[(0,Z.jsx)(n,{}),i&&(0,Z.jsx)(Sh,{variant:`notification`,"aria-hidden":`true`,className:`pointer-events-none absolute -top-0.5 right-0.5 h-3.5 min-w-3.5 rounded-full px-1 font-sans text-[9px] leading-none tabular-nums`,children:v.length>99?`99+`:v.length})]})}),(0,Z.jsx)(Vr,{side:`bottom`,children:r})]},t)})})}):null,R;t[31]!==v||t[32]!==n||t[33]!==N||t[34]!==k||t[35]!==E||t[36]!==w||t[37]!==j||t[38]!==r||t[39]!==h.status||t[40]!==p||t[41]!==o||t[42]!==P||t[43]!==D?(R=o===`doc`?(0,Z.jsxs)(`div`,{...P?{role:`tabpanel`,id:`panel-${N}`,"aria-labelledby":`tab-${N}`}:{},className:`min-h-0 flex-1`,children:[N===`outline`&&(0,Z.jsx)(yd,{docName:n,isSourceMode:r}),N===`links`&&(0,Z.jsx)(FT,{docName:n}),N===`graph`&&(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`-lCAuQ`})}),children:(0,Z.jsx)(mE,{activeDocName:n})}),N===`timeline`&&(0,Z.jsx)(tE,{docName:n}),N===`comments`&&(0,Z.jsx)(cT,{docName:n}),N===`problems`&&(0,Z.jsx)(pd,{docName:n,diagnostics:v,linkFindingsStatus:h.status,onFix:p===null?void 0:w,onAutoFix:p===null?void 0:E,onAskAi:p!==null&&D!==null?k:void 0,onFixWithAi:D===null?void 0:j})]}):(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`ONPvOb`})}),children:(0,Z.jsx)(hE,{})})}),t[31]=v,t[32]=n,t[33]=N,t[34]=k,t[35]=E,t[36]=w,t[37]=j,t[38]=r,t[39]=h.status,t[40]=p,t[41]=o,t[42]=P,t[43]=D,t[44]=R):R=t[44];let z;return t[45]!==L||t[46]!==R?(z=(0,Z.jsxs)(Z.Fragment,{children:[L,R]}),t[45]=L,t[46]=R,t[47]=z):z=t[47],z}function _E(){return fT(!1)}function vE(e){return uE.includes(e.id)}function yE(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function bE(e,t){let n=getComputedStyle(e.ownerDocument.documentElement);return t*parseFloat(n.fontSize)}function xE(e){return e/100*window.innerHeight}function SE(e){return e/100*window.innerWidth}function CE(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function wE({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=CE(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=bE(t,i);break;case`em`:r=yE(t,i);break;case`vh`:r=xE(i);break;case`vw`:r=SE(i);break}return r}function TE(e){return parseFloat(e.toFixed(3))}function EE({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function DE(e){let{panels:t}=e,n=EE({group:e});return n===0?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=TE(wE({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=TE(wE({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=TE(wE({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=TE(wE({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function OE(e,t=`Assertion error`){if(!e)throw Error(t)}function kE(e,t){return Array.from(t).sort(e===`horizontal`?AE:jE)}function AE(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function jE(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function ME(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function NE(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function PE({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=NE(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return OE(i,`No rect found`),i}var FE;function IE(){return FE===void 0&&(FE=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),FE}function LE(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=kE(n,Array.from(t.children).filter(ME).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.hasAttribute(`data-disabled`)||(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,PE({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p;break}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=IE()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:EE({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var RE=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}},zE={cursorFlags:0,state:`inactive`},BE=new RE;function VE(){return zE}function HE(e){return BE.addListener(`change`,e)}function UE(e){let t=zE,n={...zE};n.cursorFlags=e,zE=n,BE.emit(`change`,{prev:t,next:n})}function WE(e){let t=zE;zE=e,BE.emit(`change`,{prev:t,next:e})}var GE=e=>e,KE=()=>{},qE=1,JE=2,YE=4,XE=8,ZE=3,QE=12,$E;function eD(){return $E===void 0&&($E=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&($E=!0)),$E}function tD({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++;break}})}if(!(r===0&&i===0)){switch(n){case`active`:if(e&&eD()){let t=(e&qE)!==0,n=(e&JE)!==0,r=(e&YE)!==0,i=(e&XE)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}break}return eD()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var nD=new WeakMap;function rD(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=nD.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));let r=VE();switch(r.state){case`active`:case`hover`:{let e=tD({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}nD.set(e,{prevStyle:t,styleSheet:n})}var iD=new Map,aD=new RE;function oD(e){iD=new Map(iD),iD.delete(e)}function sD(e,t){for(let[t]of iD)if(t.id===e)return t}function cD(e,t){for(let[t,n]of iD)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function lD(){return iD}function uD(e,t){return aD.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function dD(e,t,n){let r=iD.get(e);iD=new Map(iD),iD.set(e,t),aD.emit(`groupChange`,{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:r,next:t})}function fD(e){let t=VE(),n=!1;switch(t.state){case`active`:WE({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(rD(e),n=!0,t.hitRegions.forEach(e=>{let t=cD(e.group.id,!0);dD(e.group,t,{isUserInteraction:!0})}))}return n}function pD(e){e.defaultPrevented||fD(e.currentTarget)}function mD(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=NE(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t);break}}return r?{distance:i,hitRegion:r}:void 0}function hD(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function gD(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:SD(e),b:SD(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();OE(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:xD(bD(n.a)),b:xD(bD(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var _D=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function vD(e){let t=getComputedStyle(CD(e)??e).display;return t===`flex`||t===`inline-flex`}function yD(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||vD(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||_D.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function bD(e){let t=e.length;for(;t--;){let n=e[t];if(OE(n,`Missing node`),yD(n))return n}return null}function xD(e){return e&&Number(getComputedStyle(e).zIndex)||0}function SD(e){let t=[];for(;e;)t.push(e),e=CD(e);return t}function CD(e){let{parentNode:t}=e;return hD(t)?t.host:t}function wD(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function TD({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!ME(n)||n.contains(e)||e.contains(n))return!0;if(gD(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(wD(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function ED(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=LE(r),a=mD(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&TD({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function DD(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function OD(e,t,n=0){return Math.abs(TE(e)-TE(t))<=n}function kD(e,t){return OD(e,t)?0:e>t?1:-1}function AD({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(kD(r,c)<0)if(a){let e=(i+c)/2;r=kD(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=TE(r),r}function jD({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(OD(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;OE(u!=null,`Invalid first pivot index`),OE(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];OE(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(OE(n!=null,`Previous layout not found for panel index ${t}`),OD(n,i)){let t=o-n;kD(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];OE(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(OE(n!=null,`Previous layout not found for panel index ${t}`),OD(n,o)){let t=n-i;kD(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];OE(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&kD(i,c)<0)if(e>0){let t=c-o,n=t/2;kD(i+e,c)<0&&(e=kD(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;kD(i-e,c)<0&&(e=kD(100+e,n)>0?0:-t)}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];OE(e!=null,`Previous layout not found for panel index ${r}`);let a=AD({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];OE(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=AD({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!OD(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(DD(c,l))return i;{let t=e<0?d:u,r=s[t];OE(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=AD({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!OD(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];OE(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=AD({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(OD(i,s)||(t-=s-i,l[r]=s),OD(t,0))break;e>0?r--:r++}}}if(!OD(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function MD(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||kD(e[n],t[n])!==0)return!1;return!0}function ND({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n];r.length!==t.length&&(e=KD(t),n=Object.values(e),r=[...n]);let i=r.reduce((e,t)=>e+t,0);if(!OD(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];OE(t!=null,`No layout data found for index ${e}`);let n=100/i*t;r[e]=n}let a=0;for(let e=0;e<t.length;e++){let i=n[e];OE(i!=null,`No layout data found for index ${e}`);let o=r[e];OE(o!=null,`No layout data found for index ${e}`);let s=AD({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!OD(a,0))for(let e=0;e<t.length;e++){let n=r[e];OE(n!=null,`No layout data found for index ${e}`);let i=n+a,o=AD({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,OD(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function PD({groupId:e,panelId:t}){let n=()=>{let t=lD();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=({nextSize:e,panels:n,prevLayout:r,derivedPanelConstraints:i})=>{let o=a(),s=n.findIndex(e=>e.id===t),c=s===0,l=s===n.length-1;if(l&&e<o&&(c||n.slice(0,s).every((e,t)=>{let n=i[t];return n?.collapsible&&OD(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,s).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:TE(100-e)}}return jD({delta:l?o-e:e-o,initialLayout:r,panelConstraints:i,pivotIndices:l?[s-1,s]:[s,s+1],prevLayout:r,trigger:`imperative-api`})},s=e=>{if(e===a())return;let{defaultLayoutDeferred:t,derivedPanelConstraints:r,group:i,groupSize:s,layout:c,separatorToPanels:l}=n(),u=ND({layout:o({nextSize:e,panels:i.panels,prevLayout:c,derivedPanelConstraints:r}),panelConstraints:r});MD(c,u)||dD(i,{defaultLayoutDeferred:t,derivedPanelConstraints:r,groupSize:s,layout:u,separatorToPanels:l})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),o=a();e&&o!==t&&(n.expandToSize=o,s(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:o}=i(),c=a();if(e&&c===t){let e=o.expandToSize??n;e===0&&(e=1),s(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&OD(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=EE({group:t});s(TE(wE({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function FD(e){e.defaultPrevented||ED(e,lD()).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=PD({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function ID(e){let t=lD();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function LD({groupId:e}){let t=()=>{let t=lD();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:s}=t(),c=ND({layout:e,panelConstraints:r});return n?o:(MD(o,c)||dD(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function RD(e,t){let n=ID(e),r=cD(n.id,!0),i=n.separators.find(t=>t.element===e);OE(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);OE(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=LD({groupId:n.id}).getLayout(),c=ND({layout:jD({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});MD(s,c)||dD(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function zD(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=ID(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&RD(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&RD(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&RD(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&RD(t,-5);break;case`End`:e.preventDefault(),RD(t,100);break;case`Enter`:{e.preventDefault();let n=ID(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=cD(n.id,!0),o=n.separators.find(e=>e.element===t);OE(o,`Matching separator not found`);let s=a.get(o);OE(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(OE(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];RD(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=ID(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);OE(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus({preventScroll:!0});break}case`Home`:e.preventDefault(),RD(t,-100);break}}function BD(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=lD(),n=ED(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({focusVisible:!1,preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),WE({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}function VD({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:c,panels:l}=n,{disableCursor:u}=n.mutableState,d=0;d=a?c===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:c===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),p=i.get(n);if(!f||!p)return;let{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:_,separatorToPanels:v}=p;if(h&&_&&v){let t=jD({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(MD(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?qE:JE;break;case`vertical`:s|=d<0?YE:XE;break}}else dD(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&ZE:c|=s&ZE,t.movementY===0?c|=o&QE:c|=s&QE,UE(c),rD(e)}function HD(e){let t=lD(),n=VE();switch(n.state){case`active`:VD({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,pointerDownAtPoint:n.pointerDownAtPoint,prevCursorFlags:n.cursorFlags})}}function UD(e){if(e.defaultPrevented)return;let t=VE(),n=lD();switch(t.state){case`active`:if(e.buttons===0){WE({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=cD(e.group.id,!0);dD(e.group,t,{isUserInteraction:!0})});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}VD({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=ED(e,n);r.length===0?t.state!==`inactive`&&WE({cursorFlags:0,state:`inactive`}):WE({cursorFlags:0,hitRegions:r,state:`hover`}),rD(e.currentTarget);break}}}function WD(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(VE().state){case`hover`:WE({cursorFlags:0,state:`inactive`})}}function GD(e){e.defaultPrevented||e.pointerType===`mouse`&&e.button>0||fD(e.currentTarget)&&e.preventDefault()}function KD(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=TE(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=TE((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function qD(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=EE({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:TE(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function JD(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function YD({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,s=new Map,c=[];for(let l of e.panels){let e=r[l.id]??0;switch(l.panelConstraints.groupResizeBehavior){case`preserve-pixel-size`:{o=!0;let r=TE(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e;break}}if(!o||c.length===0)return r;let l=100-i,u={...r};if(s.forEach((e,t)=>{u[t]=e}),a>0)for(let e of c)u[e]=TE((r[e]??0)/a*l);else{let e=TE(l/c.length);for(let t of c)u[t]=e}return u}function XD(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var ZD=new Map;function QD(e){let t=!0;OE(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){let t=EE({group:e});if(t===0)return;let n=cD(e.id);if(!n)return;let r=DE(e),i=n.defaultLayoutDeferred?KD(r):n.layout,a=ND({layout:YD({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&MD(n.layout,a)&&JD(n.derivedPanelConstraints,r)&&n.groupSize===t)return;dD(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else qD(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{OE(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=EE({group:e}),s=DE(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(XD(e.panels,l)||(l=void 0));let u=ND({layout:e.mutableState.layouts[c]??l??KD(s),panelConstraints:s}),d=e.element.ownerDocument;ZD.set(d,(ZD.get(d)??0)+1);let f=new Map;return LE(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),dD(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{OE(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,zD)}),d.addEventListener(`contextmenu`,pD,!0),d.addEventListener(`dblclick`,FD,!0),d.addEventListener(`pointerdown`,BD,!0),d.addEventListener(`pointerleave`,HD),d.addEventListener(`pointermove`,UD),d.addEventListener(`pointerout`,WD),d.addEventListener(`pointerup`,GD,!0),function(){t=!1,ZD.set(d,Math.max(0,(ZD.get(d)??0)-1)),oD(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,zD)}),ZD.get(d)||(d.removeEventListener(`contextmenu`,pD,!0),d.removeEventListener(`dblclick`,FD,!0),d.removeEventListener(`pointerdown`,BD,!0),d.removeEventListener(`pointerleave`,HD),d.removeEventListener(`pointermove`,UD),d.removeEventListener(`pointerout`,WD),d.removeEventListener(`pointerup`,GD,!0)),a.disconnect()}}function $D(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function eO(e){let t=(0,Q.useId)();return`${e??t}`}var tO=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function nO(e){let t=(0,Q.useRef)(e);return tO(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function rO(...e){return nO(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function iO(e){let t=(0,Q.useRef)({...e});return tO(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var aO=(0,Q.createContext)(null);function oO(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:GE});(0,Q.useImperativeHandle)(t,()=>n.current,[]),tO(()=>{Object.assign(n.current,LD({groupId:e}))})}function sO({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,Q.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=nO(e=>{MD(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=nO((e,t)=>{MD(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e,{isUserInteraction:t}))}),_=eO(s),v=(0,Q.useRef)(null),[y,b]=$D(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=rO(v,a);oO(_,o);let C=nO((e,t)=>{let r=VE(),i=sD(e),a=cD(e);if(a){let e=!1;switch(r.state){case`active`:e=r.hitRegions.some(e=>e.group===i);break}return{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),w=iO({defaultLayout:n,disableCursor:r}),T=(0,Q.useMemo)(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:C,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=kE(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=kE(u,[...t.separators,e]),b(),()=>{t.separators=t.separators.filter(t=>t!==e),b()}},updatePanelProps:(e,{disabled:t})=>{let n=x.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=sD(_),i=cD(_);r&&i&&dD(r,{...i,derivedPanelConstraints:DE(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=x.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[C,_,b,u,w]),E=(0,Q.useRef)(null);return tO(()=>{let e=v.current;if(e===null)return;let t=x.current,n;if(w.defaultLayout!==void 0&&Object.keys(w.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=w.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={disabled:!!i,element:e,id:_,mutableState:{defaultLayout:n,disableCursor:!!w.disableCursor,expandedPanelSizes:x.current.lastExpandedPanelSizes,layouts:x.current.layouts},orientation:u,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};E.current=r;let a=QD(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=cD(r.id,!0);!o&&s.length>0&&(h(c),g(c,!1));let l=uD(_,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:i}=e.next;if(t||n.length===0)return;let a=r.panels.map(({id:e})=>e).join(`,`);r.mutableState.layouts[a]=i,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=OD(t.collapsedSize,i[t.panelId]),a=OD(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=VE().state!==`active`;h(i),o&&g(i,e.isUserInteraction)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,Q.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,Z.jsx)(aO.Provider,{value:T,children:(0,Z.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:S,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}sO.displayName=`Group`;function cO(){return(0,Q.useRef)(null)}function lO(){let e=(0,Q.useContext)(aO);return OE(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function uO(e,t){let{id:n}=lO(),r=(0,Q.useRef)({collapse:KE,expand:KE,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:KE});(0,Q.useImperativeHandle)(t,()=>r.current,[]),tO(()=>{Object.assign(r.current,PD({groupId:n,panelId:e}))})}function dO({children:e,className:t,collapsedSize:n=`0%`,collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:s=`preserve-relative-size`,id:c,maxSize:l=`100%`,minSize:u=`0%`,onResize:d,panelRef:f,style:p,...m}){let h=!!c,g=eO(c),_=iO({disabled:a}),v=(0,Q.useRef)(null),y=rO(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=lO(),T=d!==null,E=nO((e,t,n)=>{d?.(e,c,n)});tO(()=>{let e=v.current;if(e!==null)return C({element:e,id:g,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:T?E:void 0,panelConstraints:{groupResizeBehavior:s,collapsedSize:n,collapsible:r,defaultSize:i,disabled:_.disabled,maxSize:l,minSize:u}})},[s,n,r,i,T,g,h,l,u,E,C,_]),(0,Q.useEffect)(()=>{w(g,{disabled:a})},[a,g,w]),uO(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>uD(x,e),D,D),k;return k=O?JSON.parse(O):i===void 0?{flexGrow:1}:{flexGrow:void 0,flexShrink:void 0,flexBasis:i},(0,Z.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...fO,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...k},children:(0,Z.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}dO.displayName=`Panel`;var fO={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function pO(){return(0,Q.useRef)(null)}function mO({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=ND({layout:jD({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=ND({layout:jD({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function hO({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=eO(a),l=iO({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),[m,h]=(0,Q.useState)(!1),g=(0,Q.useRef)(null),_=rO(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=lO(),C=b===`horizontal`?`vertical`:`horizontal`;tO(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=HE(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=uD(y,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);d(mO({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[y,c,x,l]),(0,Q.useEffect)(()=>{S(c,{disabled:n,disableDoubleClick:r})},[n,r,c,S]);let w;n&&!v&&(w=`not-allowed`);let T;if(n)T=`disabled`;else switch(f){case`active`:T=`active`;break;default:T=m?`focus`:f}return(0,Z.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":C,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":T,"data-testid":c,id:c,onBlur:()=>h(!1),onFocus:()=>h(!0),ref:_,role:`separator`,style:{flexBasis:`auto`,cursor:w,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}hO.displayName=`Separator`;function gO(e){let t=(0,$.c)(55),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({fileName:r,extension:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{_:a}=Bn(),[o,s]=(0,Q.useState)(`diagram`),c=pg(i),l;t[4]===n?l=t[5]:(l={"data-mermaid-file-viewer-extension":n},t[4]=n,t[5]=l);let u=l;if(c.status===`loading`){let e;return t[6]!==u||t[7]!==r?(e=(0,Z.jsx)(vg,{fileName:r,dataAttr:`data-mermaid-file-viewer`,extraAttrs:u}),t[6]=u,t[7]=r,t[8]=e):e=t[8],e}if(c.status===`error`){let e=c.message,a;t[9]!==n||t[10]!==c.httpStatus||t[11]!==r||t[12]!==i.assetPath?(a=fg({assetPath:i.assetPath,fileName:r,extension:n,httpStatus:c.httpStatus}),t[9]=n,t[10]=c.httpStatus,t[11]=r,t[12]=i.assetPath,t[13]=a):a=t[13];let o;return t[14]!==u||t[15]!==c.message||t[16]!==r||t[17]!==a?(o=(0,Z.jsx)(gg,{fileName:r,dataAttr:`data-mermaid-file-viewer`,extraAttrs:u,message:e,openFile:a}),t[14]=u,t[15]=c.message,t[16]=r,t[17]=a,t[18]=o):o=t[18],o}let d=c.content,f;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>{e&&s(e)},t[19]=f):f=t[19];let p;t[20]===a?p=t[21]:(p=a({id:`72xhRD`}),t[20]=a,t[21]=p);let m;t[22]===a?m=t[23]:(m=a({id:`DEWDbv`}),t[22]=a,t[23]=m);let h;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Br,{children:(0,Z.jsx)(Ve,{className:`size-4`})}),t[24]=h):h=t[24];let g;t[25]===m?g=t[26]:(g=(0,Z.jsx)(Ra,{value:`diagram`,"aria-label":m,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:h}),t[25]=m,t[26]=g);let _;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(Vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`i-ShMB`})}),t[27]=_):_=t[27];let v;t[28]===g?v=t[29]:(v=(0,Z.jsxs)(Ur,{children:[g,_]}),t[28]=g,t[29]=v);let y;t[30]===a?y=t[31]:(y=a({id:`Y6SK9K`}),t[30]=a,t[31]=y);let b;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Br,{children:(0,Z.jsx)(jn,{className:`size-4`})}),t[32]=b):b=t[32];let x;t[33]===y?x=t[34]:(x=(0,Z.jsx)(Ra,{value:`source`,"aria-label":y,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:b}),t[33]=y,t[34]=x);let S;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`wdxz7K`})}),t[35]=S):S=t[35];let C;t[36]===x?C=t[37]:(C=(0,Z.jsxs)(Ur,{children:[x,S]}),t[36]=x,t[37]=C);let w;t[38]!==o||t[39]!==C||t[40]!==p||t[41]!==v?(w=(0,Z.jsx)(`div`,{className:`flex shrink-0 items-center justify-center border-b bg-background py-2`,children:(0,Z.jsxs)(Ba,{type:`single`,value:o,onValueChange:f,"aria-label":p,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 bg-muted p-0.5 data-[size=sm]:rounded-[10px]`,children:[v,C]})}),t[38]=o,t[39]=C,t[40]=p,t[41]=v,t[42]=w):w=t[42];let T;t[43]!==n||t[44]!==r||t[45]!==o||t[46]!==i||t[47]!==d?(T=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:o===`diagram`?(0,Z.jsx)(`div`,{className:`flex h-full min-h-0 flex-col p-3 [&_.mermaid-error-source]:hidden`,children:(0,Z.jsx)(Ou,{chart:d,className:`min-h-0 flex-1`})}):(0,Z.jsx)(mg,{...i,fileName:r,extension:n})}),t[43]=n,t[44]=r,t[45]=o,t[46]=i,t[47]=d,t[48]=T):T=t[48];let E;return t[49]!==u||t[50]!==r||t[51]!==o||t[52]!==w||t[53]!==T?(E=(0,Z.jsxs)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":r,"data-mermaid-file-viewer":``,"data-mermaid-file-viewer-state":`loaded`,"data-mermaid-file-viewer-mode":o,...u,children:[w,T]}),t[49]=u,t[50]=r,t[51]=o,t[52]=w,t[53]=T,t[54]=E):E=t[54],E}function _O(e){return gs(`/api/asset?path=${encodeURIComponent(e)}`)}function vO(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function yO(e){let t=(0,$.c)(8),{assetPath:n,mediaKind:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(_g,{entry:{kind:`asset`,path:n},className:`shrink-0 border-b bg-background px-3 py-1.5`}),t[0]=n,t[1]=i);let a;t[2]!==n||t[3]!==r?(a=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(bO,{assetPath:n,mediaKind:r})}),t[2]=n,t[3]=r,t[4]=a):a=t[4];let o;return t[5]!==i||t[6]!==a?(o=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[i,a]}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function bO(e){let t=(0,$.c)(33),{assetPath:n,mediaKind:r}=e,[i,a]=(0,Q.useState)(!1),o;t[0]===n?o=t[1]:(o=_O(n),t[0]=n,t[1]=o);let s=o,c;t[2]===n?c=t[3]:(c=n.split(`/`).pop()??n,t[2]=n,t[3]=c);let l=c,u,d,f,p;if(t[4]!==n||t[5]!==l||t[6]!==i||t[7]!==r||t[8]!==s){p=Symbol.for(`react.early_return_sentinel`);bb0:{if(f=l.includes(`.`)?l.split(`.`).pop()??``:``,d=f.length>0?f.toUpperCase():`FILE`,u=i?`text`:r,u===`pdf`){let e;t[13]!==l||t[14]!==s?(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(v,{src:s,title:l,fillContainer:!0})}),t[13]=l,t[14]=s,t[15]=e):e=t[15];let n;t[16]!==l||t[17]!==e?(n=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":l,children:e}),t[16]=l,t[17]=e,t[18]=n):n=t[18],p=n;break bb0}if(u===`text`){let e;t[19]===n?e=t[20]:(e=vO(n),t[19]=n,t[20]=e),p=(0,Z.jsx)(mg,{src:e,assetPath:n,fileName:l,extension:f.toLowerCase()},n);break bb0}if(u===`mermaid`){let e;t[21]===n?e=t[22]:(e=vO(n),t[21]=n,t[22]=e),p=(0,Z.jsx)(gO,{src:e,assetPath:n,fileName:l,extension:f.toLowerCase()},n);break bb0}}t[4]=n,t[5]=l,t[6]=i,t[7]=r,t[8]=s,t[9]=u,t[10]=d,t[11]=f,t[12]=p}else u=t[9],d=t[10],f=t[11],p=t[12];if(p!==Symbol.for(`react.early_return_sentinel`))return p;let m;t[23]!==n||t[24]!==u||t[25]!==d||t[26]!==l||t[27]!==f||t[28]!==s?(m=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:u===`image`?(0,Z.jsx)(Se,{src:s,alt:l,draggable:!1,targetExistence:`exists`,slotClassName:`flex h-full w-full items-center justify-center`,className:`max-h-full max-w-full`}):u===`video`?(0,Z.jsx)(`video`,{src:s,controls:!0,className:`max-h-full max-w-full`}):u===`audio`?(0,Z.jsx)(`audio`,{src:s,controls:!0,className:`w-full max-w-md`}):(0,Z.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-8 text-center`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,Z.jsx)(`div`,{className:`flex items-center justify-center tracking-wide text-muted-foreground/80 text-2xs font-mono`,children:d}),(0,Z.jsx)(`div`,{className:`max-w-full text-balance break-words tracking-tight font-light text-2xl`,children:l})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(X,{variant:`default`,size:`sm`,onClick:()=>a(!0),"data-testid":`asset-preview-open-as-text`,className:`font-mono uppercase`,children:(0,Z.jsx)(Y,{id:`qFWMl-`})}),(0,Z.jsx)(X,{variant:`outline`,size:`sm`,className:`font-mono uppercase`,onClick:()=>{vh({url:s,projectRelPath:n,ext:f.toLowerCase(),title:l,forceOsDelegation:!1})},children:(0,Z.jsx)(Y,{id:`9npOH9`})})]})]})}),t[23]=n,t[24]=u,t[25]=d,t[26]=l,t[27]=f,t[28]=s,t[29]=m):m=t[29];let h;return t[30]!==l||t[31]!==m?(h=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":l,children:m}),t[30]=l,t[31]=m,t[32]=h):h=t[32],h}function xO(){let e=(0,$.c)(5),{_:t}=Bn(),n;e[0]===t?n=e[1]:(n=t({id:`3VsNTI`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(tg,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(tg,{className:`h-4 w-full`}),(0,Z.jsx)(tg,{className:`h-4 w-3/4`})]}),e[2]=r):r=e[2];let i;return e[3]===n?i=e[4]:(i=(0,Z.jsx)(`div`,{className:`tiptap-editor pt-10`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=i),i}function SO(e){let{_:t}=Bn();return e===`existing-repo`?[{id:`draft-spec`,icon:Uy,label:t({id:`LdKIHS`}),prompt:t({id:`N_7kkF`})},{id:`organize-specs`,icon:ab,label:t({id:`cuA8QW`}),prompt:t({id:`mPy9lS`})},{id:`document-architecture`,icon:cb,label:t({id:`6eniID`}),prompt:t({id:`uDlyqd`})}]:[{id:`competitor-research`,icon:jb,label:t({id:`GUqTzn`}),prompt:t({id:`KOZud0`})},{id:`eng-specs`,icon:Uy,label:t({id:`Qvls7J`}),prompt:t({id:`6qMe0o`})},{id:`bird-wiki`,icon:Oy,label:t({id:`FqTpiN`}),prompt:t({id:`jtg_8-`})}]}function CO(e){let t=(0,$.c)(13),{scenario:n,className:r}=e,{_:i}=Bn(),a=SO(n),[o,s]=(0,Q.useState)(null),c=(0,Q.useRef)(void 0),l,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>()=>clearTimeout(c.current),u=[],t[0]=l,t[1]=u):(l=t[0],u=t[1]),(0,Q.useEffect)(l,u);let d,f;if(t[2]!==i||t[3]!==r||t[4]!==o||t[5]!==a){let e=function(e,t){_r(t).then(()=>{s(e),clearTimeout(c.current),c.current=setTimeout(()=>s(null),1600)}).catch(wO)};t[8]===r?d=t[9]:(d=gr(`w-full divide-y divide-border/60 overflow-hidden rounded-2xl border border-border/60 bg-card`,r),t[8]=r,t[9]=d),f=a.map(t=>{let n=t.icon,r=o===t.id;return(0,Z.jsxs)(`li`,{className:`group flex items-start gap-3 p-3.5`,"data-testid":`copy-prompt-${t.id}`,children:[(0,Z.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium leading-tight text-foreground`,children:t.label}),(0,Z.jsx)(`span`,{className:`truncate text-1sm leading-relaxed text-muted-foreground`,children:t.prompt})]}),(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e(t.id,t.prompt),"aria-label":i(r?{id:`6V3Ea3`}:{id:`RG4XHV`,values:{0:t.label}}),className:gr(`shrink-0 gap-1.5 transition-opacity focus-visible:opacity-100 uppercase font-mono`,r?`opacity-100`:`opacity-0 group-hover:opacity-100`),"data-testid":`copy-prompt-button-${t.id}`,children:[r?(0,Z.jsx)(Uu,{className:`size-3.5`,"aria-hidden":`true`}):(0,Z.jsx)(Fn,{className:`size-3.5`,"aria-hidden":`true`}),i(r?{id:`6V3Ea3`}:{id:`he3ygx`})]})]},t.id)}),t[2]=i,t[3]=r,t[4]=o,t[5]=a,t[6]=d,t[7]=f}else d=t[6],f=t[7];let p;return t[10]!==d||t[11]!==f?(p=(0,Z.jsx)(`ul`,{className:d,children:f}),t[10]=d,t[11]=f,t[12]=p):p=t[12],p}function wO(){}function TO(e,t,n){return e.trim().length>0||t.length>0||n}new Set(qa.map(e=>e.id));function EO(e,t){Tl(e,t)}function DO(e){let t=(0,$.c)(32),{scenario:n,className:r}=e,{_:i}=Bn(),{states:a,refresh:o}=Sr(),s=Wa(),{dispatch:c}=Ll(),l=gu(),u=jr(),[d,f]=(0,Q.useState)(kO),p=Za(),m=Ua(),h;t[0]===s?h=t[1]:(h=e=>Ha(s,e.source,e.id,!0,e.supported),t[0]=s,t[1]=h);let g=m.filter(h),_=Ga(g,p),v;t[2]===u?.installedClis?v=t[3]:(v=u?.installedClis??{},t[2]=u?.installedClis,t[3]=v);let y=wl({sticky:d,effectiveThreadAgent:_,enabledClis:u===null?[]:Dl(s,u.installedClis),enabledDesktopTargets:Ml(s,a),unresolvedDesktopTargets:Sl(s,a),installedClis:v,terminalAvailable:u!==null,threadsAvailable:!0,desktopSelectable:!0}),b=y.kind===`thread`,x=y.kind===`cli`?y.cli:null,S=y.kind===`desktop`?y.target:null,C=x!==null,w=(0,Q.useRef)(null),[T]=(0,Q.useState)(OO),[E,D]=(0,Q.useState)(!0),[O,k]=(0,Q.useState)(!1),A;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){D(e),e||k(!1)},t[4]=A):A=t[4];let j=A,M=SO(n),N;t[5]!==s||t[6]!==a?(N=e=>Ka(s,e.id,a[e.id]?.installed),t[5]=s,t[6]=a,t[7]=N):N=t[7];let P=qa.filter(N),F=qa.every(e=>a[e.id]?.installed!=null),I=u!==null&&Dl(s,u.installedClis).length>0,L=F&&P.length===0&&g.length===0&&!I,R;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){f(e),Tl(e),EO(e)},t[8]=R):R=t[8];let z=R,B;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(e){f(Nl(e)),Tl(Nl(e))},t[9]=B):B=t[9];let V=B,ee;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(ee=function(e){Va(e),f(Ol),Tl(Ol)},t[10]=ee):ee=t[10];let H=ee,U=function(){let{instruction:e,mentions:t}=w.current?.getContent()??{instruction:``,mentions:[]};if(!TO(e,t,!1)){k(!0);return}let r=fu({workspace:l,description:e,scenario:n,mentions:t});r!==null&&(tu(r,_===null?void 0:{agent:{source:_.source,id:_.id}}),w.current?.clear(),Da())},W=function(){if(u===null||x===null)return;let{instruction:e,mentions:t}=w.current?.getContent()??{instruction:``,mentions:[]};if(!TO(e,t,!1)){k(!0);return}let r=fu({workspace:l,description:e,scenario:n,mentions:t});r!==null&&(u.launchInTerminal(r,x),w.current?.clear(),Da())},G=function(e){let{instruction:t,mentions:r}=w.current?.getContent()??{instruction:``,mentions:[]};if(!TO(t,r,!1)){k(!0);return}if(EO(e),a[e]?.installed!==!0){let t=qa.find(t=>t.id===e);t&&(Hl(t),Dc.info(i({id:`L1BQTH`,values:{0:t.displayName}})));return}let o=fu({workspace:l,description:t,scenario:n,mentions:r});o!==null&&(c(e,o),w.current?.clear(),Da())},te=function(){b?U():C?W():S!==null&&G(S)},ne=function(e){w.current?.setText(e),w.current?.focus()};if(L){let e;t[11]===r?e=t[12]:(e=gr(`flex w-full flex-wrap items-center justify-between gap-3 rounded-2xl border border-border/60 bg-card px-4 py-3`,r),t[11]=r,t[12]=e);let n;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(pt,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),t[13]=n):n=t[13];let i;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[n,(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`XT-L4j`})})]}),t[14]=i):i=t[14];let a;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:jc,className:`gap-1.5`,"data-testid":`create-configure-agents`,children:[(0,Z.jsx)(mr,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`jRAGrQ`})]}),t[15]=a):a=t[15];let o;return t[16]===e?o=t[17]:(o=(0,Z.jsxs)(`div`,{className:e,"data-testid":`create-no-agents`,children:[i,a]}),t[16]=e,t[17]=o),o}let re=u?Dl(s,u.installedClis):[],K=P.length>0,ie=re.length>0,q=g.length>0,ae=y.kind!==`none`,oe;t[18]===r?oe=t[19]:(oe=gr(`flex w-full flex-col gap-3`,r),t[18]=r,t[19]=oe);let se;t[20]!==i||t[21]!==n?(se=i(n===`skill`?{id:`Dut9Ht`}:{id:`7hctf2`}),t[20]=i,t[21]=n,t[22]=se):se=t[22];let ce;t[23]!==i||t[24]!==n?(ce=i(n===`skill`?{id:`eNhWUl`}:{id:`0jD-Gn`}),t[23]=i,t[24]=n,t[25]=ce):ce=t[25];let le;t[26]!==E||t[27]!==O?(le=O&&E?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-input-required`,children:(0,Z.jsx)(Y,{id:`1FLarN`})}):(0,Z.jsx)(`span`,{}),t[26]=E,t[27]=O,t[28]=le):le=t[28];let ue=ae?(0,Z.jsxs)(Ma,{children:[(0,Z.jsx)(X,{type:`button`,onClick:()=>b?U():C?W():S===null?void 0:G(S),variant:`outline`,className:`gap-1.5`,"data-testid":`create-with-agent`,children:b&&_!==null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ya,{agentId:_.id,iconUrl:_.iconUrl,className:`size-3.5`}),(0,Z.jsx)(Ql,{agentName:_.name})]}):C&&x!==null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(aa,{id:na(x),"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`ti6aF_`,values:{0:ao[x].displayName}})]}):S===null?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(aa,{id:S,"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Gl,{displayName:zl(S)}),(0,Z.jsx)(ju,{"aria-hidden":`true`,className:`size-3.5`})]})}),(0,Z.jsxs)(va,{onOpenChange:e=>{e&&o()},children:[(0,Z.jsx)(fa,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,"aria-label":i({id:`nskygk`}),size:`icon`,variant:`outline`,"data-testid":`create-with-agent-menu`,children:(0,Z.jsx)(Gu,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsxs)(ga,{align:`end`,className:`max-h-80 min-w-[200px]`,children:[q?(0,Z.jsxs)(da,{"aria-label":i({id:`RXEbZy`}),children:[(0,Z.jsx)(ma,{children:(0,Z.jsx)(Y,{id:`RXEbZy`})}),g.map(e=>(0,Z.jsxs)(ca,{onSelect:()=>H(e),"data-testid":`create-agent-option-thread-${e.source}:${e.id}`,children:[(0,Z.jsx)(Ya,{agentId:e.id,iconUrl:e.iconUrl,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1 truncate`,children:e.name}),b&&_!==null&&_.source===e.source&&_.id===e.id?(0,Z.jsx)(Uu,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},`${e.source}:${e.id}`))]}):null,q&&(ie||K)?(0,Z.jsx)(ya,{}):null,ie?(0,Z.jsxs)(da,{"aria-label":i({id:`ALhMYW`}),children:[(0,Z.jsx)(ma,{children:(0,Z.jsx)(Y,{id:`ALhMYW`})}),re.map(e=>{let{displayName:t}=ao[e];return(0,Z.jsxs)(ca,{onSelect:()=>V(e),"data-testid":`create-with-cli-${e}`,"aria-label":i({id:`QYfQdv`,values:{displayName:t}}),children:[(0,Z.jsx)(aa,{id:na(e),"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t}),x===e?(0,Z.jsx)(Uu,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e)})]}):null,K?(0,Z.jsxs)(Z.Fragment,{children:[ie?(0,Z.jsx)(ya,{}):null,(0,Z.jsxs)(da,{"aria-label":i({id:`BwKH4d`}),children:[(0,Z.jsxs)(ma,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(Y,{id:`BwKH4d`}),(0,Z.jsx)(ju,{"aria-hidden":`true`,className:`size-3`})]}),P.map(e=>(0,Z.jsxs)(ca,{onSelect:()=>z(e.id),"data-testid":`create-agent-option-${e.id}`,children:[(0,Z.jsx)(aa,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Zl,{displayName:e.displayName})}),!C&&e.id===S?(0,Z.jsx)(Uu,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null,(0,Z.jsx)(ya,{}),(0,Z.jsxs)(ca,{onSelect:jc,"data-testid":`create-agent-option-settings`,children:[(0,Z.jsx)(mr,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`jRAGrQ`})})]})]})]})]}):(0,Z.jsx)(X,{type:`button`,variant:`outline`,disabled:!0,className:`gap-1.5`,"data-testid":`create-with-agent`,children:(0,Z.jsx)(Y,{id:`hYgDIe`})}),de;return t[29]!==le||t[30]!==ue?(de=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 px-3 pb-3`,children:[le,ue]}),t[29]=le,t[30]=ue,t[31]=de):de=t[31],(0,Z.jsxs)(`div`,{className:oe,children:[(0,Z.jsxs)(`div`,{onMouseDown:e=>Ta(e,w),className:`flex w-full cursor-text flex-col rounded-2xl border border-border/60 bg-card shadow-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[(0,Z.jsx)(Aa,{ref:w,ariaLabel:se,placeholder:ce,onEmptyChange:j,onContentChange:Ca,onSubmit:te,initialDoc:T,className:`max-h-96 overflow-y-auto px-4 py-3 text-sm leading-relaxed subtle-scrollbar [&_.ProseMirror]:min-h-16`}),de]}),n===`new-project`&&M.length>0?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`I5685_`})}),M.map(e=>{let t=e.icon;return(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>ne(e.prompt),className:`gap-1.5 rounded-md font-normal text-muted-foreground hover:text-foreground`,"data-testid":`create-suggestion-${e.id}`,children:[(0,Z.jsx)(t,{className:`size-3.5`,"aria-hidden":`true`}),e.label]},e.id)})]}):null]})}function OO(){return Ea().doc??void 0}function kO(){return jl()}function AO(e){let t=(0,$.c)(18),{title:n,subtitle:r,celebrateSignal:i,onRageStreak:a}=e,o=(0,Q.useRef)(0),s=(0,Q.useRef)(null),c;t[0]===a?c=t[1]:(c=function(){let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=s.current,n=t===null?1/0:e-t;s.current=e;let r=ty(o.current,n);o.current=r,!(r<6)&&(o.current=0,a?.())},t[0]=a,t[1]=c);let l=a?c:void 0,u;t[2]===a?u=t[3]:(u=a?{viewTransitionName:ev}:void 0,t[2]=a,t[3]=u);let d;t[4]!==i||t[5]!==l||t[6]!==u?(d=(0,Z.jsx)(kr,{size:64,celebrateSignal:i,onRage:l,style:u}),t[4]=i,t[5]=l,t[6]=u,t[7]=d):d=t[7];let f;t[8]===n?f=t[9]:(f=(0,Z.jsx)(`h2`,{className:`text-2xl font-light tracking-tighter text-balance`,children:n}),t[8]=n,t[9]=f);let p;t[10]===r?p=t[11]:(p=r?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}):null,t[10]=r,t[11]=p);let m;t[12]!==f||t[13]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[f,p]}),t[12]=f,t[13]=p,t[14]=m):m=t[14];let h;return t[15]!==d||t[16]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex flex-col items-start gap-3 @md/emptystate:flex-row @md/emptystate:items-center @md/emptystate:gap-4`,children:[d,m]}),t[15]=d,t[16]=m,t[17]=h):h=t[17],h}function jO({isOnboarding:e,isEmbedded:t}){return e?{title:{id:`6h4zVU`},subtitle:t?{id:`vGeNNQ`}:{id:`qpQwGC`}}:{title:{id:`FOGD7m`},subtitle:t?{id:`3DTatP`}:{id:`MqQoV-`}}}var MO=`open-knowledge:create-top-level-file`;function NO(e={}){window.dispatchEvent(new CustomEvent(MO,{detail:e}))}function PO(e){let t=t=>{let n=t.detail;e(n??{})};return window.addEventListener(MO,t),()=>window.removeEventListener(MO,t)}function FO(e){let t=(0,$.c)(29),{celebrateSignal:n,onAddStarterPack:r,onRageStreak:i}=e,{_:a}=Bn(),o=Be(),{title:s,subtitle:c}=jO({isOnboarding:!1,isEmbedded:o}),l=af(),u;t[0]!==l.data||t[1]!==l.status?(u=l.status===`ready`?l.data:[],t[0]=l.data,t[1]=l.status,t[2]=u):u=t[2];let d=u,f=l.status===`loading`||l.status===`idle`,p=l.status===`error`,m=AO,h=a(s),g=a(c),_;t[3]!==m||t[4]!==n||t[5]!==i||t[6]!==h||t[7]!==g?(_=(0,Z.jsx)(m,{title:h,subtitle:g,celebrateSignal:n,onRageStreak:i}),t[3]=m,t[4]=n,t[5]=i,t[6]=h,t[7]=g,t[8]=_):_=t[8];let v;t[9]===o?v=t[10]:(v=o?(0,Z.jsx)(CO,{scenario:`existing-repo`}):(0,Z.jsx)(DO,{scenario:`existing-repo`}),t[9]=o,t[10]=v);let y;t[11]!==d||t[12]!==p||t[13]!==f?(y=f||p||d.length>0?(0,Z.jsx)(RO,{templates:d,loading:f,error:p,onSelect:LO}):null,t[11]=d,t[12]=p,t[13]=f,t[14]=y):y=t[14];let b,x;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(dr,{"aria-hidden":`true`,className:`size-3`}),b=(0,Z.jsx)(Y,{id:`IajAbS`}),t[15]=b,t[16]=x):(b=t[15],x=t[16]);let S;t[17]===r?S=t[18]:(S=(0,Z.jsxs)(X,{onClick:r,variant:`link-muted`,size:`xs`,className:`font-mono text-xs uppercase tracking-wider`,children:[x,b]}),t[17]=r,t[18]=S);let C;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(X,{variant:`link-muted`,className:`justify-end`,size:`sm`,onClick:IO,children:(0,Z.jsx)(Y,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(Du,{"aria-hidden":`true`,className:`size-3`})}})}),t[19]=C):C=t[19];let w;t[20]===S?w=t[21]:(w=(0,Z.jsxs)(`div`,{className:`-mt-6 flex w-full items-center justify-between gap-4`,children:[S,C]}),t[20]=S,t[21]=w);let T;t[22]!==w||t[23]!==y?(T=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8`,children:[y,w]}),t[22]=w,t[23]=y,t[24]=T):T=t[24];let E;return t[25]!==T||t[26]!==_||t[27]!==v?(E=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8 py-12 max-w-5xl my-auto`,"data-testid":`create-view`,children:[_,v,T]}),t[25]=T,t[26]=_,t[27]=v,t[28]=E):E=t[28],E}function IO(){return NO({initialDir:``})}function LO(e,t){return NO({template:{folder:e,name:t}})}function RO(e){let t=(0,$.c)(25),{templates:n,loading:r,error:i,onSelect:a}=e,{_:o}=Bn(),s;t[0]===o?s=t[1]:(s=o({id:`_8quCH`}),t[0]=o,t[1]=s);let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`_8quCH`})}),t[2]=c):c=t[2];let l;t[3]!==o||t[4]!==i||t[5]!==r||t[6]!==n?(l=r||i?null:(0,Z.jsx)(Sh,{className:`text-2xs`,variant:`gray`,"aria-label":o({id:`X7u0xR`,values:{0:n.length}}),children:n.length}),t[3]=o,t[4]=i,t[5]=r,t[6]=n,t[7]=l):l=t[7];let u;t[8]===l?u=t[9]:(u=(0,Z.jsxs)(`header`,{className:`flex items-center gap-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[c,l]}),t[8]=l,t[9]=u);let d;t[10]===o?d=t[11]:(d=o({id:`irFGwu`}),t[10]=o,t[11]=d);let f;t[12]!==i||t[13]!==r||t[14]!==a||t[15]!==n?(f=r?(0,Z.jsx)(`p`,{className:`p-4 text-1sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`Hl89Qd`})}):i?(0,Z.jsx)(`p`,{role:`alert`,className:`p-4 text-1sm text-destructive`,children:(0,Z.jsx)(Y,{id:`54Y6Fg`})}):n.map(e=>(0,Z.jsx)(zO,{template:e,targetLabel:e.source_folder===``?`/`:`${e.source_folder}/`,onClick:()=>a(e.source_folder,e.name)},`${e.source_folder}/${e.name}`)),t[12]=i,t[13]=r,t[14]=a,t[15]=n,t[16]=f):f=t[16];let p;t[17]!==r||t[18]!==d||t[19]!==f?(p=(0,Z.jsx)(`div`,{className:`w-full overflow-hidden rounded-xl border border-border/60 bg-card`,children:(0,Z.jsx)(`section`,{"aria-busy":r,"aria-label":d,tabIndex:0,className:`subtle-scrollbar scroll-fade-mask flex max-h-[260px] w-full flex-col overflow-y-auto overscroll-contain focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,children:f})}),t[17]=r,t[18]=d,t[19]=f,t[20]=p):p=t[20];let m;return t[21]!==s||t[22]!==u||t[23]!==p?(m=(0,Z.jsxs)(`section`,{"aria-label":s,className:`flex w-full flex-col gap-3`,children:[u,p]}),t[21]=s,t[22]=u,t[23]=p,t[24]=m):m=t[24],m}function zO(e){let t=(0,$.c)(24),{template:n,targetLabel:r,onClick:i}=e,{_:a}=Bn(),o;t[0]!==n.name||t[1]!==n.title?(o=n.title?.trim()||n.name,t[0]=n.name,t[1]=n.title,t[2]=o):o=t[2];let s=o,c=`${n.name}.md`,l=n.source_folder===``,u;t[3]!==a||t[4]!==s||t[5]!==c||t[6]!==l||t[7]!==r?(u=a(l?{id:`89TtiD`,values:{displayTitle:s,fileName:c}}:{id:`0_J12R`,values:{displayTitle:s,fileName:c,targetLabel:r}}),t[3]=a,t[4]=s,t[5]=c,t[6]=l,t[7]=r,t[8]=u):u=t[8];let d=u,f;t[9]===s?f=t[10]:(f=(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium leading-tight text-foreground/80`,children:s}),t[9]=s,t[10]=f);let p;t[11]===c?p=t[12]:(p=(0,Z.jsx)(`span`,{className:`truncate font-mono text-1sm font-normal text-muted-foreground`,children:c}),t[11]=c,t[12]=p);let m;t[13]!==f||t[14]!==p?(m=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[f,p]}),t[13]=f,t[14]=p,t[15]=m):m=t[15];let h=`shrink-0 font-mono text-1sm ${l?`text-muted-foreground/70`:`text-muted-foreground`}`,g;t[16]!==h||t[17]!==r?(g=(0,Z.jsx)(`span`,{className:h,children:r}),t[16]=h,t[17]=r,t[18]=g):g=t[18];let _;return t[19]!==d||t[20]!==i||t[21]!==m||t[22]!==g?(_=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,onClick:i,"aria-label":d,className:`group flex h-auto w-full items-center justify-between gap-4 rounded-none p-4 text-left transition-colors hover:bg-muted/50 focus-visible:bg-muted/50`,children:[m,g]}),t[19]=d,t[20]=i,t[21]=m,t[22]=g,t[23]=_):_=t[23],_}function BO(e){let t=(0,$.c)(27),{terminalOpen:n,agentsOpen:r,onRageStreak:i}=e,a=n===void 0?!1:n,o=r===void 0?!1:r,[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(void 0),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(0),h=(0,Q.useRef)(!1),g=(0,Q.useRef)(void 0),_,v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>{let e=!1,t=async function(){try{let{ok:t,body:n}=await uh();if(e)return;let r=t?Ho.safeParse(n):null;r?.success?(f(UO(r.data.documents)),h.current=!0):h.current||=(f(1),!0)}catch{!e&&!h.current&&(f(1),h.current=!0)}};t();let n=Xc(e=>{e.includes(`files`)&&t()});return()=>{e=!0,n(),clearTimeout(g.current)}},v=[],t[0]=_,t[1]=v):(_=t[0],v=t[1]),(0,Q.useEffect)(_,v);let y;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(y=function(){clearTimeout(g.current),g.current=setTimeout(()=>m(HO),500),uh().then(e=>{let{ok:t,body:n}=e;if(!t)return;let r=Ho.safeParse(n);r.success&&f(UO(r.data.documents))}).catch(VO)},t[2]=y):y=t[2];let b=y,x=d!==null,S=d===0,C;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(C=function(e){c(e),e||u(void 0)},t[3]=C):C=t[3];let w=C;if(a||o){let e=a?`justify-end`:`justify-center`,n;t[4]===e?n=t[5]:(n=gr(`@container/emptystate flex min-h-0 flex-1 flex-col items-center pb-8 pt-10`,e),t[4]=e,t[5]=n);let r;t[6]!==p||t[7]!==S||t[8]!==x||t[9]!==i?(r=x?(0,Z.jsx)(WO,{isOnboarding:S,celebrateSignal:p,onRageStreak:i}):null,t[6]=p,t[7]=S,t[8]=x,t[9]=i,t[10]=r):r=t[10];let o;t[11]===r?o=t[12]:(o=(0,Z.jsx)(`div`,{className:`flex w-full flex-col items-center px-4 @md/emptystate:px-10 @2xl/emptystate:px-16`,children:r}),t[11]=r,t[12]=o);let s;return t[13]!==o||t[14]!==n?(s=(0,Z.jsx)(`div`,{"data-testid":`empty-editor-state`,className:n,children:o}),t[13]=o,t[14]=n,t[15]=s):s=t[15],s}let T;t[16]!==p||t[17]!==S||t[18]!==x||t[19]!==i?(T=x?S?(0,Z.jsx)(GO,{onRageStreak:i,celebrateSignal:p,onPackSelect:e=>{u(e),c(!0)}}):(0,Z.jsx)(FO,{onRageStreak:i,celebrateSignal:p,onAddStarterPack:()=>{c(!0)}}):null,t[16]=p,t[17]=S,t[18]=x,t[19]=i,t[20]=T):T=t[20];let E;t[21]!==l||t[22]!==s?(E=(0,Z.jsx)(uC,{open:s,onOpenChange:w,onSeedApplied:b,initialPackId:l}),t[21]=l,t[22]=s,t[23]=E):E=t[23];let D;return t[24]!==T||t[25]!==E?(D=(0,Z.jsx)(`div`,{"data-testid":`empty-editor-state`,className:`@container/emptystate flex min-h-0 flex-1 flex-col items-center overflow-y-auto subtle-scrollbar`,children:(0,Z.jsxs)(`div`,{className:`flex w-full flex-1 flex-col items-center px-4 @md/emptystate:px-10 @2xl/emptystate:px-16`,children:[T,E]})}),t[24]=T,t[25]=E,t[26]=D):D=t[26],D}function VO(){}function HO(e){return e+1}function UO(e){return vm(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function WO(e){let t=(0,$.c)(16),{isOnboarding:n,celebrateSignal:r,onRageStreak:i}=e,{_:a}=Bn(),o=Be(),s,c,l,u;if(t[0]!==a||t[1]!==o||t[2]!==n){let{title:e,subtitle:r}=jO({isOnboarding:n,isEmbedded:o});u=`w-full max-w-5xl`,s=AO,c=a(e),l=a(r),t[0]=a,t[1]=o,t[2]=n,t[3]=s,t[4]=c,t[5]=l,t[6]=u}else s=t[3],c=t[4],l=t[5],u=t[6];let d;t[7]!==s||t[8]!==r||t[9]!==i||t[10]!==c||t[11]!==l?(d=(0,Z.jsx)(s,{title:c,subtitle:l,celebrateSignal:r,onRageStreak:i}),t[7]=s,t[8]=r,t[9]=i,t[10]=c,t[11]=l,t[12]=d):d=t[12];let f;return t[13]!==u||t[14]!==d?(f=(0,Z.jsx)(`div`,{className:u,children:d}),t[13]=u,t[14]=d,t[15]=f):f=t[15],f}function GO(e){let t=(0,$.c)(30),{celebrateSignal:n,onPackSelect:r,onRageStreak:i}=e,{_:a}=Bn(),o=Be(),s,c,l,u;if(t[0]!==a||t[1]!==o){let{title:e,subtitle:n}=jO({isOnboarding:!0,isEmbedded:o});u=`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,s=AO,c=a(e),l=a(n),t[0]=a,t[1]=o,t[2]=s,t[3]=c,t[4]=l,t[5]=u}else s=t[2],c=t[3],l=t[4],u=t[5];let d;t[6]!==s||t[7]!==n||t[8]!==i||t[9]!==c||t[10]!==l?(d=(0,Z.jsx)(s,{title:c,subtitle:l,celebrateSignal:n,onRageStreak:i}),t[6]=s,t[7]=n,t[8]=i,t[9]=c,t[10]=l,t[11]=d):d=t[11];let f;t[12]===o?f=t[13]:(f=o?(0,Z.jsx)(CO,{scenario:`new-project`}):(0,Z.jsx)(DO,{scenario:`new-project`}),t[12]=o,t[13]=f);let p;t[14]!==a||t[15]!==o?(p=a(o?{id:`GubkSu`}:{id:`xeXS4P`}),t[14]=a,t[15]=o,t[16]=p):p=t[16];let m;t[17]===p?m=t[18]:(m=(0,Z.jsx)(nee,{label:p}),t[17]=p,t[18]=m);let h;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(h=[`okf`,`entity-vault`],t[19]=h):h=t[19];let g;t[20]===r?g=t[21]:(g=(0,Z.jsx)(bx,{onPackSelect:r,onCreateBlankFile:KO,collapsedPackIds:h}),t[20]=r,t[21]=g);let _;t[22]!==m||t[23]!==g?(_=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-3`,children:[m,g]}),t[22]=m,t[23]=g,t[24]=_):_=t[24];let v;return t[25]!==_||t[26]!==u||t[27]!==d||t[28]!==f?(v=(0,Z.jsxs)(`div`,{className:u,children:[d,f,_]}),t[25]=_,t[26]=u,t[27]=d,t[28]=f,t[29]=v):v=t[29],v}function KO(){return NO()}function nee(e){let t=(0,$.c)(13),{label:n}=e,{_:r}=Bn(),i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`span`,{className:`font-mono text-2xs uppercase tracking-wider text-muted-foreground whitespace-nowrap`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r({id:`jAMpHn`}),t[2]=r,t[3]=a);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(rp,{className:`size-3.5`,"aria-hidden":!0}),t[4]=o):o=t[4];let s;t[5]===a?s=t[6]:(s=(0,Z.jsx)(Br,{className:`text-muted-foreground transition-colors hover:text-foreground`,"aria-label":a,"data-testid":`starter-pack-info`,children:o}),t[5]=a,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Vr,{className:`max-w-xs`,children:(0,Z.jsx)(`p`,{className:`leading-relaxed wrap-break-word`,children:(0,Z.jsx)(Y,{id:`k4CuuV`})})}),t[7]=c):c=t[7];let l;t[8]===s?l=t[9]:(l=(0,Z.jsxs)(Ur,{children:[s,c]}),t[8]=s,t[9]=l);let u;return t[10]!==i||t[11]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[i,l]}),t[10]=i,t[11]=l,t[12]=u):u=t[12],u}function ree(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function iee(e){let t=(0,$.c)(70),{folderPath:n,state:r,onChange:i}=e,{_:a}=Bn(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card p-4 space-y-3`,children:[(0,Z.jsx)(oee,{}),(0,Z.jsx)(tg,{className:`h-7 w-full`}),(0,Z.jsx)(tg,{className:`h-7 w-full`}),(0,Z.jsx)(tg,{className:`h-7 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(Y,{id:`lzmtKp`,values:{message:e}})}),t[1]=e,t[2]=n),n}let f;t[3]===r.data.frontmatterLocal?f=t[4]:(f=r.data.frontmatterLocal??{},t[3]=r.data.frontmatterLocal,t[4]=f);let p=f,m;t[5]===r.data.folder.path?m=t[6]:(m=ree(r.data.folder.path),t[5]=r.data.folder.path,t[6]=m);let h=m,g;t[7]===p?g=t[8]:(g=Object.keys(p),t[7]=p,t[8]=g);let _=g,v;t[9]!==a||t[10]!==n||t[11]!==i?(v=async function(e,t){let r=await Qf(n,{[e]:t});if(!r.ok){let{error:e}=r;Dc.error(a({id:`xXo8FT`,values:{error:e}}));return}i()},t[9]=a,t[10]=n,t[11]=i,t[12]=v):v=t[12];let y=v,b;t[13]!==a||t[14]!==n||t[15]!==i?(b=async function(e){let t=await Qf(n,{[e]:null});if(!t.ok){let{error:e}=t;Dc.error(a({id:`ZU8VV_`,values:{error:e}}));return}i()},t[13]=a,t[14]=n,t[15]=i,t[16]=b):b=t[16];let x=b,S;t[17]!==y||t[18]!==p?(S=function(e,t){let n=p[e];y(e,Pu(n,t))},t[17]=y,t[18]=p,t[19]=S):S=t[19];let C=S,w;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(w=function(){l({name:``,type:`text`,value:``,error:null}),s(!1)},t[20]=w):w=t[20];let T=w,E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(e){l(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Nu[e];return{...t,type:e,value:n,error:null}})},t[21]=E):E=t[21];let D=E,O;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(e){l(t=>t&&{...t,value:e})},t[22]=O):O=t[22];let k=O,A;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){l(t=>t&&{...t,name:e,error:null})},t[23]=A):A=t[23];let j=A,M;t[24]!==a||t[25]!==c||t[26]!==n||t[27]!==i||t[28]!==p?(M=async function(e){if(!c)return;let t=e??c.value,r=c.name.trim();if(!r){l({...c,value:t,error:a({id:`8_brI5`})});return}if(Uo(t)){l({...c,value:t,error:a({id:`hXUWyd`})});return}if(Object.hasOwn(p,r)){l({...c,value:t,error:a({id:`CTJLpz`,values:{trimmed:r}})});return}let o=await Qf(n,{[r]:t});if(!o.ok){l({...c,value:t,error:o.error});return}l(null),i()},t[24]=a,t[25]=c,t[26]=n,t[27]=i,t[28]=p,t[29]=M):M=t[29];let N=M,P;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){d({key:e,draft:e,error:null})},t[30]=P):P=t[30];let F=P,I;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){d(t=>t&&{...t,draft:e,error:null})},t[31]=I):I=t[31];let L=I,R;t[32]!==a||t[33]!==n||t[34]!==i||t[35]!==p||t[36]!==u?(R=async function(){if(!u)return;let e=u.draft.trim();if(!e){d({...u,error:a({id:`8_brI5`})});return}if(e===u.key){d(null);return}if(Object.hasOwn(p,e)){d({...u,error:a({id:`CTJLpz`,values:{trimmed:e}})});return}let t=p[u.key],r=await Qf(n,{[u.key]:null,[e]:t});if(!r.ok){d({...u,error:r.error});return}d(null),i()},t[32]=a,t[33]=n,t[34]=i,t[35]=p,t[36]=u,t[37]=R):R=t[37];let z=R,B;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(){d(null)},t[38]=B):B=t[38];let V=B,ee=!o,H;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>s(!e),t[39]=H):H=t[39];let U=`size-3 shrink-0 motion-safe:transition-transform motion-safe:duration-150 motion-safe:ease-[cubic-bezier(0.23,1,0.32,1)] ${o?``:`rotate-90`}`,W;t[40]===U?W=t[41]:(W=(0,Z.jsx)(Ku,{className:U,"aria-hidden":!0}),t[40]=U,t[41]=W);let G;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(Y,{id:`vQIVHc`}),t[42]=G):G=t[42];let te;t[43]===W?te=t[44]:(te=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[W,G]}),t[43]=W,t[44]=te);let ne;t[45]===h?ne=t[46]:(ne=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text break-all`,onClick:aee,children:h}),t[45]=h,t[46]=ne);let re;t[47]!==te||t[48]!==ne?(re=(0,Z.jsxs)(Gr,{className:`flex w-full cursor-pointer items-center justify-between gap-2 px-3 py-2.5 data-[state=open]:border-b border-border`,children:[te,ne]}),t[47]=te,t[48]=ne,t[49]=re):re=t[49];let K;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`hSBIG-`})}),t[50]=K):K=t[50];let ie;t[51]!==c||t[52]!==y||t[53]!==z||t[54]!==_||t[55]!==p||t[56]!==x||t[57]!==u||t[58]!==C?(ie=_.length===0&&!c?(0,Z.jsx)(`p`,{className:`px-1 py-1 text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`4c_a6S`})}):_.map(e=>{let t=p[e];return(0,Z.jsx)(Rf,{keyName:e,value:t,declared:Fu(t,co(t)),rename:{state:u?.key===e?u:null,onBegin:()=>F(e),onChangeDraft:L,onCommit:z,onCancel:V},badge:null,onCommit:t=>void y(e,t),onChangeType:t=>C(e,t),onRemove:()=>void x(e)},e)}),t[51]=c,t[52]=y,t[53]=z,t[54]=_,t[55]=p,t[56]=x,t[57]=u,t[58]=C,t[59]=ie):ie=t[59];let q;t[60]!==c||t[61]!==N?(q=c?(0,Z.jsx)(Bf,{draft:c,onChangeName:j,onChangeType:D,onChangeValue:k,onCommit:e=>void N(e),onCancel:()=>l(null)}):(0,Z.jsx)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,children:(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:()=>T(),className:`flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(dr,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`G8t9NN`})})]})}),t[60]=c,t[61]=N,t[62]=q):q=t[62];let ae;t[63]!==ie||t[64]!==q?(ae=(0,Z.jsx)(Wr,{children:(0,Z.jsxs)(`div`,{className:`px-2 py-2`,children:[K,ie,q]})}),t[63]=ie,t[64]=q,t[65]=ae):ae=t[65];let oe;return t[66]!==ee||t[67]!==re||t[68]!==ae?(oe=(0,Z.jsx)(`section`,{className:`rounded-lg border bg-card`,children:(0,Z.jsxs)(Kr,{open:ee,onOpenChange:H,children:[re,ae]})}),t[66]=ee,t[67]=re,t[68]=ae,t[69]=oe):oe=t[69],oe}function aee(e){return e.stopPropagation()}function oee(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Jy,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t,(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`vQIVHc`})})]}),e[1]=n):n=e[1],n}function see(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?Hc._({id:`xOTzt5`}):t<3600?Hc._({id:`zbymaY`,values:{0:Math.floor(t/60)}}):t<86400?Hc._({id:`optX0N`,values:{0:Math.floor(t/3600)}}):t<86400*7?Hc._({id:`l1l8sj`,values:{0:Math.floor(t/86400)}}):new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function qO(e){return(e.split(`/`).pop()??e).replace(/\.md$/,``)}function cee(e){let t=e.message,n=t.indexOf(`: `),r=n===-1?t:t.slice(0,n),i=n===-1?``:t.slice(n+2);switch(r){case`template-create`:return{Icon:yr,label:Hc._({id:`QR5SP1`}),detail:qO(i)};case`template-edit`:return{Icon:Zt,label:Hc._({id:`-LHLx7`}),detail:qO(i)};case`template-delete`:return{Icon:Ip,label:Hc._({id:`_gkGSK`}),detail:qO(i)};case`template-rename`:case`template-move`:{let[e,t]=i.split(` -> `);return{Icon:pu,label:Hc._({id:`KPW5WC`}),detail:`${qO(e??``)} → ${qO(t??i)}`}}case`folder-frontmatter-edit`:return{Icon:Jy,label:Hc._({id:`_tekeB`}),detail:``};case`folder-frontmatter-delete`:return{Icon:Jy,label:Hc._({id:`ZWxfrc`}),detail:``};case`folder-create`:return{Icon:Jy,label:Hc._({id:`ZQLDTl`}),detail:``};default:return{Icon:kl,label:r.replace(/-/g,` `),detail:qO(i)}}}function lee(e){return e.contributors.length>0?e.contributors[0].name:e.author===`openknowledge-service`||e.author===`server`?Hc._({id:`B2DrPb`}):e.author||Hc._({id:`Ef7StM`})}function JO(e){let t=(0,$.c)(15),{folderPath:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(!0),[c,l]=(0,Q.useState)(!1),u,d;if(t[1]===n?(u=t[2],d=t[3]):(u=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/history?folder=${encodeURIComponent(n)}&limit=50`);if(e)return;if(!t.ok){l(!0),s(!1);return}let r=await t.json();if(e)return;a(r.entries??[]),l(!1),s(!1)}catch(t){e||(console.warn(`[FolderTimelineCard] failed to load folder timeline:`,t),l(!0),s(!1))}};s(!0),t();let r=Zc(t);return()=>{e=!0,r()}},d=[n],t[1]=n,t[2]=u,t[3]=d),(0,Q.useEffect)(u,d),c||!o&&i.length===0)return null;let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`XJOV1Y`})}),t[4]=f):f=t[4];let p;t[5]===i.length?p=t[6]:(p=i.length>0?(0,Z.jsx)(Sh,{className:`text-xs`,variant:`secondary`,children:i.length}):null,t[5]=i.length,t[6]=p);let m;t[7]===p?m=t[8]:(m=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-1`,children:[f,p]}),t[7]=p,t[8]=m);let h;t[9]!==i||t[10]!==o?(h=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:o?(0,Z.jsxs)(`div`,{className:`space-y-2`,role:`status`,"aria-busy":`true`,children:[(0,Z.jsx)(tg,{className:`h-8 w-full`}),(0,Z.jsx)(tg,{className:`h-8 w-full`})]}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:i.map(YO)})}),t[9]=i,t[10]=o,t[11]=h):h=t[11];let g;return t[12]!==m||t[13]!==h?(g=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,"data-testid":`folder-timeline-card`,children:[m,h]}),t[12]=m,t[13]=h,t[14]=g):g=t[14],g}function YO(e){let{Icon:t,label:n,detail:r}=cee(e);return(0,Z.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm`,children:[(0,Z.jsx)(t,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[(0,Z.jsx)(`span`,{className:`text-foreground`,children:n}),r?(0,Z.jsx)(`code`,{className:`ml-1.5 font-mono text-xs text-muted-foreground`,children:r}):null]}),(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-xs text-muted-foreground`,children:[(0,Z.jsx)(Vb,{className:`size-3`,"aria-hidden":!0}),lee(e)]}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground/80`,dateTime:e.timestamp,title:new Date(e.timestamp).toLocaleString(),children:see(e.timestamp)})]},e.sha)}function XO(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function ZO(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=XO(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function QO(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function $O(e,t){let n=e===``?``:`${e}/`,r=[...t.folderPaths].filter(e=>e.startsWith(n)).map(e=>({path:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({path:e,rel:n})=>({kind:`folder`,path:e,name:n,title:ZO(e,t.pageTitles)})),i=[...t.pages].filter(e=>e.startsWith(n)).map(e=>({docName:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({docName:e,rel:n})=>{let r=t.pageMeta.get(e);return{kind:`file`,path:e,name:n,title:QO(e,n,t.pageTitles),size:r?.size??0,modified:r?.modified??``}}),a=[...r,...i].sort((e,t)=>e.kind===t.kind?e.title.localeCompare(t.title)||e.name.localeCompare(t.name):e.kind===`folder`?-1:1);return{title:ZO(e,t.pageTitles),children:a}}function ek(e){let t=(0,$.c)(41),{folderPath:n,state:r,onChange:i,folderConfigHandle:a}=e,[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(!1);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card px-3 py-2.5 space-y-3`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`-QCLWk`})})}),(0,Z.jsx)(tg,{className:`h-12 w-full`}),(0,Z.jsx)(tg,{className:`h-12 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(Y,{id:`iDZtvM`,values:{message:e}})}),t[1]=e,t[2]=n),n}let f;t[3]===r.data.folder.templates_available?f=t[4]:(f=r.data.folder.templates_available??[],t[3]=r.data.folder.templates_available,t[4]=f);let p=f,m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`-QCLWk`})}),t[5]=m):m=t[5];let h;t[6]===p.length?h=t[7]:(h=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[m,(0,Z.jsx)(Sh,{className:`text-xs`,variant:`secondary`,children:p.length})]}),t[6]=p.length,t[7]=h);let g;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(X,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>d(!0),children:[(0,Z.jsx)(dr,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`G1Gw0v`})]}),t[8]=g):g=t[8];let _;t[9]===h?_=t[10]:(_=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-1`,children:[h,g]}),t[9]=h,t[10]=_);let v;t[11]===p?v=t[12]:(v=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:p.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`MZSBsh`})}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:p.map(e=>(0,Z.jsx)(eee,{template:e,onCreate:()=>l(e.name),onEdit:()=>Yf(bs(e.source_folder,e.name)),onDelete:()=>s(e),badge:e.scope===`inherited`?(0,Z.jsx)(Ff,{source:e.source_folder,target:`templates/${e.name}.md`}):void 0},e.path))})}),t[11]=p,t[12]=v);let y;t[13]!==_||t[14]!==v?(y=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,children:[_,v]}),t[13]=_,t[14]=v,t[15]=y):y=t[15];let b;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{e||s(null)},t[16]=b):b=t[16];let x;t[17]!==o||t[18]!==i?(x=(0,Z.jsx)(qd,{template:o,onOpenChange:b,onDeleted:i}),t[17]=o,t[18]=i,t[19]=x):x=t[19];let S;t[20]===p?S=t[21]:(S=new Set(p.map(tk)),t[20]=p,t[21]=S);let C;t[22]!==n||t[23]!==i?(C=e=>{i(),Yf(bs(n,e))},t[22]=n,t[23]=i,t[24]=C):C=t[24];let w;t[25]!==n||t[26]!==u||t[27]!==S||t[28]!==C?(w=(0,Z.jsx)(df,{folderPath:n,existingNames:S,open:u,onOpenChange:d,onCreated:C}),t[25]=n,t[26]=u,t[27]=S,t[28]=C,t[29]=w):w=t[29];let T=c!==null,E;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{e||l(null)},t[30]=E):E=t[30];let D=c??void 0,O;t[31]!==a||t[32]!==n||t[33]!==T||t[34]!==D?(O=(0,Z.jsx)(nC,{open:T,onOpenChange:E,kind:`file`,initialDir:n,initialTemplate:D,folderConfig:a}),t[31]=a,t[32]=n,t[33]=T,t[34]=D,t[35]=O):O=t[35];let k;return t[36]!==w||t[37]!==O||t[38]!==y||t[39]!==x?(k=(0,Z.jsxs)(Z.Fragment,{children:[y,x,w,O]}),t[36]=w,t[37]=O,t[38]=y,t[39]=x,t[40]=k):k=t[40],k}function tk(e){return e.name}function nk(e){let t=(0,$.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,containerClassName:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=gr(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=gr(`w-full caption-bottom text-sm`,n),t[6]=n,t[7]=o);let s;t[8]!==i||t[9]!==o?(s=(0,Z.jsx)(`table`,{"data-slot":`table`,className:o,...i}),t[8]=i,t[9]=o,t[10]=s):s=t[10];let c;return t[11]!==a||t[12]!==s?(c=(0,Z.jsx)(`div`,{"data-slot":`table-container`,className:a,children:s}),t[11]=a,t[12]=s,t[13]=c):c=t[13],c}function rk(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`[&_tr]:border-b`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`thead`,{"data-slot":`table-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ik(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`[&_tr:last-child]:border-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`tbody`,{"data-slot":`table-body`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ak(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,noHover:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(i===void 0?!1:i)&&`hover:bg-transparent`,o;t[4]!==n||t[5]!==a?(o=gr(`hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors`,a,n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(`tr`,{"data-slot":`table-row`,className:o,...r}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function ok(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,scope:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`col`:i,o;t[4]===n?o=t[5]:(o=gr(`font-mono uppercase text-xs text-muted-foreground h-10 px-4 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`th`,{"data-slot":`table-head`,scope:a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function sk(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`py-3 px-4 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`td`,{"data-slot":`table-cell`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ck(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return Hc._({id:`xOTzt5`});if(r<60)return Hc._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return Hc._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?Hc._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function lk(e,t,n){return[...e].sort((e,r)=>{if(e.kind!==r.kind)return e.kind===`folder`?-1:1;let i=0;switch(t){case`name`:i=e.title.localeCompare(r.title)||e.name.localeCompare(r.name);break;case`modified`:{let t=e.kind===`file`?e.modified:``,n=r.kind===`file`?r.modified:``;i=t.localeCompare(n);break}}return n===`asc`?i:-i})}function uk(e){let t=(0,$.c)(10),{label:n,sortKey:r,activeKey:i,activeDir:a,onSort:o}=e,s=i===r,c;t[0]!==o||t[1]!==r?(c=()=>o(r),t[0]=o,t[1]=r,t[2]=c):c=t[2];let l;t[3]!==a||t[4]!==s?(l=s?a===`asc`?(0,Z.jsx)(Tu,{className:`ml-1 size-3`}):(0,Z.jsx)(Eu,{className:`ml-1 size-3`}):(0,Z.jsx)(Dy,{className:`ml-1 size-3 text-muted-foreground/50`}),t[3]=a,t[4]=s,t[5]=l):l=t[5];let u;return t[6]!==n||t[7]!==c||t[8]!==l?(u=(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,className:`-ml-3 h-8 uppercase font-mono`,onClick:c,children:[n,l]}),t[6]=n,t[7]=c,t[8]=l,t[9]=u):u=t[9],u}function dk(e){let t=(0,$.c)(96),{folderPath:n}=e,{_:r}=Bn(),{folderPaths:i,loading:a,pages:o,pageTitles:s,pageMeta:c}=Nd(),l=hf(n),{state:u,refresh:d}=l,[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(`name`),[g,_]=(0,Q.useState)(`asc`);if(a){let e;t[0]===r?e=t[1]:(e=r({id:`X9VpsP`}),t[0]=r,t[1]=e);let n;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(tg,{className:`size-5 rounded`}),(0,Z.jsx)(tg,{className:`h-7 w-48`})]}),(0,Z.jsx)(tg,{className:`h-9 w-20 rounded-md`})]}),t[2]=n):n=t[2];let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(tg,{className:`h-4 w-16`}),t[3]=i):i=t[3];let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`div`,{className:`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`,children:[n,(0,Z.jsxs)(`div`,{className:`rounded-lg border`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-4 border-b px-4 py-3`,children:[i,(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(tg,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(mk)]})]}),t[4]=a):a=t[4];let o;return t[5]===e?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,role:`status`,"aria-busy":`true`,"aria-label":e,children:a}),t[5]=e,t[6]=o),o}let v,y,b,x,S,C,w,T,E,D,O;if(t[7]!==r||t[8]!==u||t[9]!==l||t[10]!==n||t[11]!==i||t[12]!==c||t[13]!==s||t[14]!==o||t[15]!==d||t[16]!==g||t[17]!==m){let e=$O(n,{pages:o,pageTitles:s,pageMeta:c,folderPaths:i}),a=lk(e.children,m,g),f=e.title||(n===``?r({id:`3aeN7X`}):e.title),k;t[29]===m?k=t[30]:(k=function(e){e===m?_(pk):(h(e),_(`asc`))},t[29]=m,t[30]=k);let A=k;O=`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,C=`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`;let j;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(Wf,{className:`size-5 text-muted-foreground`}),t[31]=j):j=t[31];let M=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[j,(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tight`,children:f})]}),N;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsxs)(X,{onClick:()=>p(!0),children:[(0,Z.jsx)(dr,{className:`size-4`}),(0,Z.jsx)(Y,{id:`isRobC`})]}),t[32]=N):N=t[32],t[33]===M?w=t[34]:(w=(0,Z.jsx)(`div`,{className:`flex flex-col gap-6`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[M,N]})}),t[33]=M,t[34]=w),t[35]!==u||t[36]!==n||t[37]!==d?(T=(0,Z.jsx)(iee,{folderPath:n,state:u,onChange:d}),t[35]=u,t[36]=n,t[37]=d,t[38]=T):T=t[38],t[39]!==u||t[40]!==l||t[41]!==n||t[42]!==d?(E=(0,Z.jsx)(ek,{folderPath:n,state:u,onChange:d,folderConfigHandle:l}),t[39]=u,t[40]=l,t[41]=n,t[42]=d,t[43]=E):E=t[43],t[44]===n?D=t[45]:(D=(0,Z.jsx)(JO,{folderPath:n}),t[44]=n,t[45]=D),S=`rounded-lg border`,y=nk;let P=m===`name`?g===`asc`?`ascending`:`descending`:`none`,F;t[46]===r?F=t[47]:(F=r({id:`6YtxFj`}),t[46]=r,t[47]=F);let I;t[48]!==A||t[49]!==g||t[50]!==m||t[51]!==F?(I=(0,Z.jsx)(uk,{label:F,sortKey:`name`,activeKey:m,activeDir:g,onSort:A}),t[48]=A,t[49]=g,t[50]=m,t[51]=F,t[52]=I):I=t[52];let L;t[53]!==P||t[54]!==I?(L=(0,Z.jsx)(ok,{"aria-sort":P,children:I}),t[53]=P,t[54]=I,t[55]=L):L=t[55];let R=m===`modified`?g===`asc`?`ascending`:`descending`:`none`,z;t[56]===r?z=t[57]:(z=r({id:`tgWuMB`}),t[56]=r,t[57]=z);let B;t[58]!==A||t[59]!==g||t[60]!==m||t[61]!==z?(B=(0,Z.jsx)(uk,{label:z,sortKey:`modified`,activeKey:m,activeDir:g,onSort:A}),t[58]=A,t[59]=g,t[60]=m,t[61]=z,t[62]=B):B=t[62];let V;t[63]!==R||t[64]!==B?(V=(0,Z.jsx)(ok,{className:`w-32`,"aria-sort":R,children:B}),t[63]=R,t[64]=B,t[65]=V):V=t[65],t[66]!==L||t[67]!==V?(x=(0,Z.jsx)(rk,{children:(0,Z.jsxs)(ak,{children:[L,V]})}),t[66]=L,t[67]=V,t[68]=x):x=t[68],v=ik,b=a.length?a.map(fk):(0,Z.jsx)(ak,{children:(0,Z.jsx)(sk,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`Pkw7J9`})})}),t[7]=r,t[8]=u,t[9]=l,t[10]=n,t[11]=i,t[12]=c,t[13]=s,t[14]=o,t[15]=d,t[16]=g,t[17]=m,t[18]=v,t[19]=y,t[20]=b,t[21]=x,t[22]=S,t[23]=C,t[24]=w,t[25]=T,t[26]=E,t[27]=D,t[28]=O}else v=t[18],y=t[19],b=t[20],x=t[21],S=t[22],C=t[23],w=t[24],T=t[25],E=t[26],D=t[27],O=t[28];let k;t[69]!==v||t[70]!==b?(k=(0,Z.jsx)(v,{children:b}),t[69]=v,t[70]=b,t[71]=k):k=t[71];let A;t[72]!==y||t[73]!==k||t[74]!==x?(A=(0,Z.jsxs)(y,{children:[x,k]}),t[72]=y,t[73]=k,t[74]=x,t[75]=A):A=t[75];let j;t[76]!==A||t[77]!==S?(j=(0,Z.jsx)(`div`,{className:S,children:A}),t[76]=A,t[77]=S,t[78]=j):j=t[78];let M;t[79]!==j||t[80]!==C||t[81]!==w||t[82]!==T||t[83]!==E||t[84]!==D?(M=(0,Z.jsxs)(`div`,{className:C,children:[w,T,E,D,j]}),t[79]=j,t[80]=C,t[81]=w,t[82]=T,t[83]=E,t[84]=D,t[85]=M):M=t[85];let N;t[86]!==M||t[87]!==O?(N=(0,Z.jsx)(`div`,{className:O,children:M}),t[86]=M,t[87]=O,t[88]=N):N=t[88];let P;t[89]!==f||t[90]!==l||t[91]!==n?(P=(0,Z.jsx)(nC,{open:f,onOpenChange:p,kind:`file`,initialDir:n,folderConfig:l,suggestedName:`index`}),t[89]=f,t[90]=l,t[91]=n,t[92]=P):P=t[92];let F;return t[93]!==N||t[94]!==P?(F=(0,Z.jsxs)(Z.Fragment,{children:[N,P]}),t[93]=N,t[94]=P,t[95]=F):F=t[95],F}function fk(e){return(0,Z.jsxs)(ak,{children:[(0,Z.jsx)(sk,{children:(0,Z.jsxs)(`a`,{href:qp(e.path),className:`flex items-center gap-2 rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[e.kind===`folder`?(0,Z.jsx)(Kf,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(Ge,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(sk,{className:`text-muted-foreground`,children:e.kind===`file`?ck(e.modified):`—`})]},e.path)}function pk(e){return e===`asc`?`desc`:`asc`}function mk(e){return(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 border-b px-4 py-3 last:border-b-0`,children:[(0,Z.jsx)(tg,{className:`size-4 rounded`}),(0,Z.jsx)(tg,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(tg,{className:`h-4 w-16`})})]},e)}function hk(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`empty`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function gk(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`flex max-w-sm flex-col items-center gap-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`empty-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var _k=Rr(`mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,icon:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4`}},defaultVariants:{variant:`default`}});function vk(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`default`:i,o;t[4]!==n||t[5]!==a?(o=gr(_k({variant:a,className:n})),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o||t[9]!==a?(s=(0,Z.jsx)(`div`,{"data-slot":`empty-icon`,"data-variant":a,className:o,...r}),t[7]=r,t[8]=o,t[9]=a,t[10]=s):s=t[10],s}function yk(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,asChild:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i?zr:`div`,o;t[4]===n?o=t[5]:(o=gr(`font-heading text-sm font-medium tracking-tight`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(a,{"data-slot":`empty-title`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function bk(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`empty-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function xk(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`flex w-full max-w-sm min-w-0 flex-col items-center gap-2.5 text-sm text-balance`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`empty-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Sk(e){let t=(0,$.c)(26),{docName:n,size:r,limit:i,backNav:a}=e,o=a!==void 0,s=(0,Q.useRef)(null),c=(0,Q.useRef)(null),l=(0,Q.useId)(),u,d;t[0]===o?(u=t[1],d=t[2]):(u=()=>{o?s.current?.focus():c.current?.focus()},d=[o],t[0]=o,t[1]=u,t[2]=d),(0,Q.useEffect)(u,d);let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(vk,{variant:`icon`,className:`mb-0 size-16 rounded-full border bg-muted/40 text-muted-foreground`,children:(0,Z.jsx)(Wy,{className:`size-9`,"aria-hidden":`true`})}),t[3]=f):f=t[3];let p=o?void 0:-1,m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(Y,{id:`P3hnm0`}),t[4]=m):m=t[4];let h;t[5]!==p||t[6]!==l?(h=(0,Z.jsx)(yk,{asChild:!0,className:`text-2xl font-light outline-none`,children:(0,Z.jsx)(`h2`,{ref:c,id:l,tabIndex:p,children:m})}),t[5]=p,t[6]=l,t[7]=h):h=t[7];let g;t[8]===r?g=t[9]:(g=is(r),t[8]=r,t[9]=g);let _;t[10]===i?_=t[11]:(_=is(i),t[10]=i,t[11]=_);let v;t[12]!==n||t[13]!==g||t[14]!==_?(v=(0,Z.jsx)(bk,{children:(0,Z.jsx)(Y,{id:`GJH-AT`,values:{0:g,1:_,docName:n}})}),t[12]=n,t[13]=g,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==h||t[17]!==v?(y=(0,Z.jsxs)(gk,{className:`max-w-md gap-1`,children:[h,v]}),t[16]=h,t[17]=v,t[18]=y):y=t[18];let b;t[19]!==a||t[20]!==o?(b=o?(0,Z.jsx)(xk,{children:(0,Z.jsxs)(X,{ref:s,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(Au,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`CKyk7Q`})]})}):null,t[19]=a,t[20]=o,t[21]=b):b=t[21];let x;return t[22]!==y||t[23]!==b||t[24]!==l?(x=(0,Z.jsxs)(hk,{role:`status`,"aria-labelledby":l,"data-slot":`large-file-editor-state`,className:`h-full gap-8 p-8`,children:[f,y,b]}),t[22]=y,t[23]=b,t[24]=l,t[25]=x):x=t[25],x}function Ck(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(wk),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>ct(e=>{i(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})}),o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Q.useEffect)(a,o),!r.has(n))return null;let s;t[2]===n?s=t[3]:(s=function(){rt(n)?.abort(),i(e=>{if(!e.has(n))return e;let t=new Set(e);return t.delete(n),t})},t[2]=n,t[3]=s);let c=s,l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`A67Uwj`})}),t[4]=l):l=t[4];let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Y,{id:`dEgA5A`}),t[5]=u):u=t[5];let d;return t[6]===c?d=t[7]:(d=(0,Z.jsxs)(`div`,{className:`absolute inset-x-0 bottom-8 z-20 flex justify-center text-xs text-muted-foreground`,children:[l,(0,Z.jsx)(X,{variant:`link`,size:`sm`,className:`h-auto px-2 py-0 text-xs`,onClick:c,children:u})]}),t[6]=c,t[7]=d),d}function wk(){return new Set}function Tk(e){let t=(0,$.c)(8),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{autoStart:r}=n,i=r===void 0?!1:r,a=(0,Q.useRef)(null),o,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{a.current?.focus()},s=[],t[2]=o,t[3]=s):(o=t[2],s=t[3]),(0,Q.useEffect)(o,s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tighter text-balance`,children:(0,Z.jsx)(Y,{id:`hgf5io`})}),t[4]=c):c=t[4];let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1 text-center`,children:[c,(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`AUMPjj`})})]}),t[5]=l):l=t[5];let u;return t[6]===i?u=t[7]:(u=(0,Z.jsxs)(`div`,{ref:a,tabIndex:-1,className:`flex h-full w-full flex-col items-center justify-center gap-8 px-6 py-8 outline-none`,children:[l,(0,Z.jsx)(`div`,{className:`w-full`,children:(0,Z.jsx)(cy,{autoStart:i})})]}),t[6]=i,t[7]=u),u}function Ek(e){let t=(0,$.c)(19),{nav:n}=e,{state:r,refetch:i}=Tf(n),a=(0,Q.useRef)(null),o,s;t[0]===r.phase?(o=t[1],s=t[2]):(o=()=>{r.phase===`resolved`&&a.current?.querySelector(`button`)?.focus()},s=[r.phase],t[0]=r.phase,t[1]=o,t[2]=s),(0,Q.useEffect)(o,s);let c;t[3]===n.path?c=t[4]:(c=function(){window.location.hash=Qp(xf(n.path))},t[3]=n.path,t[4]=c);let l=c,u;t[5]===n?u=t[6]:(u=function(e){Ef.arm(wf(n,e)),window.location.hash=n.kind===`folder`?Qp(e):qp(e)},t[5]=n,t[6]=u);let d=u,f=r.phase===`pending`?`polite`:void 0,p=r.phase===`resolved`?r.resolution.verdict:void 0,m=r.phase===`pending`?`flex h-full flex-col items-center justify-center gap-3 p-8 text-center text-sm text-muted-foreground`:`flex h-full flex-col items-center justify-center gap-6 p-8 text-center`,h;t[7]!==l||t[8]!==n||t[9]!==d||t[10]!==i||t[11]!==r?(h=(0,Z.jsx)(Cf,{nav:n,state:r,onBrowseFolder:l,onOpenRenamed:d,onEnableAutoSync:l,onSyncCompleted:i,onPullApplied:i}),t[7]=l,t[8]=n,t[9]=d,t[10]=i,t[11]=r,t[12]=h):h=t[12];let g;return t[13]!==r.phase||t[14]!==f||t[15]!==p||t[16]!==m||t[17]!==h?(g=(0,Z.jsx)(`div`,{ref:a,role:`status`,"aria-live":f,"data-testid":`share-receive-miss-panel`,"data-phase":r.phase,"data-verdict":p,className:m,children:h}),t[13]=r.phase,t[14]=f,t[15]=p,t[16]=m,t[17]=h,t[18]=g):g=t[18],g}var Dk=`ok-find`,Ok=`ok-find-active`;function kk(e,t){let n=t.toLowerCase();if(n===``)return[];let r=[],i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(let e=i.nextNode();e!==null;e=i.nextNode()){let t=(e.textContent??``).toLowerCase(),i=t.indexOf(n);for(;i>=0;){let a=document.createRange();a.setStart(e,i),a.setEnd(e,i+n.length),r.push(a),i=t.indexOf(n,i+n.length)}}return r}function Ak(e){let t=(0,$.c)(61),{containerRef:n,onClose:r}=e,{_:i}=Bn(),a=(0,Q.useRef)(null),[o,s]=(0,Q.useState)(``),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=[],t[0]=c):c=t[0];let[l,u]=(0,Q.useState)(c),[d,f]=(0,Q.useState)(0),p,m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>{a.current?.focus()},m=[],t[1]=p,t[2]=m):(p=t[1],m=t[2]),(0,Q.useEffect)(p,m);let h;t[3]!==n||t[4]!==o?(h=()=>{let e=n.current,t=CSS.highlights;if(!e||t===void 0)return;let r=kk(e,o.trim());return u(r),f(0),t.set(Dk,new Highlight(...r)),()=>{t.delete(Dk),t.delete(Ok)}},t[3]=n,t[4]=o,t[5]=h):h=t[5];let g;t[6]===o?g=t[7]:(g=[o],t[6]=o,t[7]=g),(0,Q.useEffect)(h,g);let _,v;t[8]!==d||t[9]!==l?(_=()=>{let e=CSS.highlights;if(e===void 0)return;let t=l[d];if(t===void 0){e.delete(Ok);return}e.set(Ok,new Highlight(t)),t.startContainer.parentElement?.scrollIntoView({block:`nearest`})},v=[l,d],t[8]=d,t[9]=l,t[10]=_,t[11]=v):(_=t[10],v=t[11]),(0,Q.useEffect)(_,v);let y;t[12]===l.length?y=t[13]:(y=e=>{l.length!==0&&f(t=>(t+e+l.length)%l.length)},t[12]=l.length,t[13]=y);let b=y,x;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>s(e.target.value),t[14]=x):x=t[14];let S;t[15]===i?S=t[16]:(S=i({id:`KujtjC`}),t[15]=i,t[16]=S);let C;t[17]===i?C=t[18]:(C=i({id:`BKI4hX`}),t[17]=i,t[18]=C);let w;t[19]!==r||t[20]!==b?(w=e=>{e.key===`Enter`&&b(e.shiftKey?-1:1),e.key===`Escape`&&r()},t[19]=r,t[20]=b,t[21]=w):w=t[21];let T;t[22]!==o||t[23]!==S||t[24]!==C||t[25]!==w?(T=(0,Z.jsx)(dh,{ref:a,value:o,onChange:x,placeholder:S,"aria-label":C,className:`h-7 w-44`,onKeyDown:w}),t[22]=o,t[23]=S,t[24]=C,t[25]=w,t[26]=T):T=t[26];let E;t[27]!==d||t[28]!==l.length||t[29]!==o?(E=o.trim()===``?null:l.length===0?(0,Z.jsx)(Y,{id:`Y9c_nf`}):`${d+1}/${l.length}`,t[27]=d,t[28]=l.length,t[29]=o,t[30]=E):E=t[30];let D;t[31]===E?D=t[32]:(D=(0,Z.jsx)(`span`,{className:`min-w-10 text-center text-muted-foreground text-xs tabular-nums`,children:E}),t[31]=E,t[32]=D);let O;t[33]===b?O=t[34]:(O=()=>b(-1),t[33]=b,t[34]=O);let k;t[35]===i?k=t[36]:(k=i({id:`oqB2ez`}),t[35]=i,t[36]=k);let A;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(Sa,{className:`size-4`,"aria-hidden":!0}),t[37]=A):A=t[37];let j;t[38]!==O||t[39]!==k?(j=(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-7`,onClick:O,"aria-label":k,children:A}),t[38]=O,t[39]=k,t[40]=j):j=t[40];let M;t[41]===b?M=t[42]:(M=()=>b(1),t[41]=b,t[42]=M);let N;t[43]===i?N=t[44]:(N=i({id:`SiUUCS`}),t[43]=i,t[44]=N);let P;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(Gu,{className:`size-4`,"aria-hidden":!0}),t[45]=P):P=t[45];let F;t[46]!==M||t[47]!==N?(F=(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-7`,onClick:M,"aria-label":N,children:P}),t[46]=M,t[47]=N,t[48]=F):F=t[48];let I;t[49]===i?I=t[50]:(I=i({id:`wJo9oS`}),t[49]=i,t[50]=I);let L;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(zp,{className:`size-4`,"aria-hidden":!0}),t[51]=L):L=t[51];let R;t[52]!==r||t[53]!==I?(R=(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-7`,onClick:r,"aria-label":I,children:L}),t[52]=r,t[53]=I,t[54]=R):R=t[54];let z;return t[55]!==T||t[56]!==D||t[57]!==j||t[58]!==F||t[59]!==R?(z=(0,Z.jsxs)(`div`,{className:`absolute top-2 right-4 z-10 flex items-center gap-1 rounded-md border bg-popover p-1 shadow-md`,children:[T,D,j,F,R]}),t[55]=T,t[56]=D,t[57]=j,t[58]=F,t[59]=R,t[60]=z):z=t[60],z}function jk(e){let t=(0,$.c)(9),{text:n}=e,r;t[0]===n?r=t[1]:(r=Ks(n),t[0]=n,t[1]=r);let{map:i}=r,a,o;if(t[2]!==i||t[3]!==n){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Jo(n),r=e.length>0?e:Object.keys(i);if(r.length===0){o=null;break bb0}let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Y,{id:`l_UFPv`}),t[6]=s):s=t[6];let c;t[7]===i?c=t[8]:(c=(e,t)=>{let n=i[e];return n===void 0?null:(0,Z.jsx)(Mk,{keyName:e,value:n},`${e}-${t}`)},t[7]=i,t[8]=c),a=(0,Z.jsx)(zu,{title:s,count:r.length,testId:`readonly-property-panel`,className:`pt-4`,children:r.map(c)})}t[2]=i,t[3]=n,t[4]=a,t[5]=o}else a=t[4],o=t[5];return o===Symbol.for(`react.early_return_sentinel`)?a:o}function Mk(e){let t=(0,$.c)(9),{keyName:n,value:r}=e,i=Lu[co(r)],a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(i,{className:`size-3.5`}),t[0]=i,t[1]=a);let o;t[2]!==n||t[3]!==r?(o=(0,Z.jsx)(Nk,{keyName:n,value:r}),t[2]=n,t[3]=r,t[4]=o):o=t[4];let s;return t[5]!==n||t[6]!==a||t[7]!==o?(s=(0,Z.jsx)(Bu,{icon:a,label:n,testId:`readonly-property-row`,dataKey:n,children:o}),t[5]=n,t[6]=a,t[7]=o,t[8]=s):s=t[8],s}function Nk(e){let t=(0,$.c)(8),{keyName:n,value:r}=e;if(Ru(r)){let e;return t[0]!==n||t[1]!==r?(e=(0,Z.jsx)(Iu,{keyName:n,value:r}),t[0]=n,t[1]=r,t[2]=e):e=t[2],e}let i;t[3]===r?i=t[4]:(i=Array.isArray(r)?r.filter(Pk).join(`, `):String(r),t[3]=r,t[4]=i);let a=i,o;return t[5]!==a||t[6]!==n?(o=(0,Z.jsx)(`div`,{className:`flex min-h-7 items-center px-2 py-1 text-sm break-words`,"data-testid":`readonly-property-value`,"data-key":n,children:a}),t[5]=a,t[6]=n,t[7]=o):o=t[7],o}function Pk(e){return typeof e==`string`}function Fk(e){let t=(0,$.c)(38),{fileName:n,text:r,flow:i,linkBaseDocName:a,skillPathLinkDocName:o,onBundlePathClick:s}=e,c=i===void 0?!1:i,l,u,d,f;if(t[0]!==a||t[1]!==s||t[2]!==o||t[3]!==r){let e=ac(r).body,n;if(t[8]!==a||t[9]!==s||t[10]!==o){let e=a?bt.map(e=>e.name===`link`?e.configure({docName:a}):e):bt;n=o?[...e,at.configure({docName:o,onBundlePathClick:s})]:e,t[8]=a,t[9]=s,t[10]=o,t[11]=n}else n=t[11];let i=n;f=hi,l=i,u=!1,d=mi().parseWithFallback(e),t[0]=a,t[1]=s,t[2]=o,t[3]=r,t[4]=l,t[5]=u,t[6]=d,t[7]=f}else l=t[4],u=t[5],d=t[6],f=t[7];let p;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(p={attributes:{class:`pt-4`}},t[12]=p):p=t[12];let m;t[13]!==l||t[14]!==u||t[15]!==d?(m={extensions:l,editable:u,content:d,editorProps:p},t[13]=l,t[14]=u,t[15]=d,t[16]=m):m=t[16];let h;t[17]!==a||t[18]!==o||t[19]!==r?(h=[r,a,o],t[17]=a,t[18]=o,t[19]=r,t[20]=h):h=t[20];let g=f(m,h),[_]=(0,Q.useState)(Ik),v=(0,Q.useRef)(null),y,b;t[21]===_?(y=t[22],b=t[23]):(b=()=>{let e=v.current;if(e)return e.appendChild(_),()=>{_.parentNode===e&&e.removeChild(_)}},y=[_],t[21]=_,t[22]=y,t[23]=b),(0,Q.useLayoutEffect)(b,y);let x;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(`div`,{className:`tiptap-editor`,children:(0,Z.jsx)(`div`,{ref:v,style:{display:`contents`}})}),t[24]=x):x=t[24];let S=x,C;t[25]!==n||t[26]!==c||t[27]!==r?(C=c?(0,Z.jsx)(`article`,{className:`bg-background`,"aria-label":n,"data-skill-markdown-viewer":``,"data-skill-markdown-viewer-state":`loaded`,children:S}):(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":n,"data-skill-markdown-viewer":``,"data-skill-markdown-viewer-state":`loaded`,children:(0,Z.jsxs)(`div`,{className:`editor-doc-scroll min-h-0 flex-1 overflow-auto subtle-scrollbar scroll-fade-mask`,children:[(0,Z.jsx)(jk,{text:r}),S]})}),t[25]=n,t[26]=c,t[27]=r,t[28]=C):C=t[28];let w=c?`tiptap-editor-portal-content`:`tiptap-editor-portal-content h-full`,T;t[29]!==g||t[30]!==w?(T=(0,Z.jsx)(pi,{editor:g,className:w}),t[29]=g,t[30]=w,t[31]=T):T=t[31];let E;t[32]!==_||t[33]!==T?(E=(0,$_.createPortal)(T,_),t[32]=_,t[33]=T,t[34]=E):E=t[34];let D;return t[35]!==C||t[36]!==E?(D=(0,Z.jsxs)(Z.Fragment,{children:[C,E]}),t[35]=C,t[36]=E,t[37]=D):D=t[37],D}function Ik(){let e=document.createElement(`div`);return e.style.display=`contents`,e}var Lk=`data-skill-markdown`;function Rk(e){let t=(0,$.c)(22),{scope:n,name:r,path:i,host:a,fileName:o}=e,s;t[0]!==a||t[1]!==r||t[2]!==i||t[3]!==n?(s={loadText:e=>Xm({scope:n,name:r,path:i,host:a},e)},t[0]=a,t[1]=r,t[2]=i,t[3]=n,t[4]=s):s=t[4];let c=pg(s);if(c.status===`loading`){let e;return t[5]===o?e=t[6]:(e=(0,Z.jsx)(vg,{fileName:o,dataAttr:Lk}),t[5]=o,t[6]=e),e}if(c.status===`error`){let e;return t[7]!==c.message||t[8]!==o?(e=(0,Z.jsx)(gg,{fileName:o,dataAttr:Lk,message:c.message}),t[7]=c.message,t[8]=o,t[9]=e):e=t[9],e}let l=c.content,u;t[10]!==r||t[11]!==i||t[12]!==n?(u=ps(n,r,i),t[10]=r,t[11]=i,t[12]=n,t[13]=u):u=t[13];let d;t[14]!==r||t[15]!==n?(d=ko(n,r),t[14]=r,t[15]=n,t[16]=d):d=t[16];let f;return t[17]!==c.content||t[18]!==o||t[19]!==u||t[20]!==d?(f=(0,Z.jsx)(Fk,{fileName:o,text:l,linkBaseDocName:u,skillPathLinkDocName:d}),t[17]=c.content,t[18]=o,t[19]=u,t[20]=d,t[21]=f):f=t[21],f}function zk(e){let t=(0,$.c)(5),[n,r]=(0,Q.useState)(!1),i;t[0]===e?i=t[1]:(i=()=>{let t=t=>{if(t.defaultPrevented||!(t.metaKey||t.ctrlKey)||t.key.toLowerCase()!==`f`)return;let n=e.current;if(n===null)return;let i=t.target;i instanceof Node&&!n.contains(i)&&Vc(i)||(t.preventDefault(),r(!0))};return window.addEventListener(`keydown`,t,!0),()=>window.removeEventListener(`keydown`,t,!0)},t[0]=e,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],t[2]=a):a=t[2],(0,Q.useEffect)(i,a);let o;return t[3]===n?o=t[4]:(o={findOpen:n,setFindOpen:r},t[3]=n,t[4]=o),o}var Bk=new Set([`md`,`mdx`]);function Vk(e){let t=(0,$.c)(18),{scope:n,name:r,path:i,host:a}=e,{_:o}=Bn(),s=(0,Q.useRef)(null),c=(0,Q.useRef)(null),l=(0,Q.useRef)(null),u;t[0]===i?u=t[1]:(u=i.split(`/`).pop()??i,t[0]=i,t[1]=u);let d=u,f=d.lastIndexOf(`.`),p=f>=0?d.slice(f+1).toLowerCase():``,m=Bk.has(p),{findOpen:h,setFindOpen:g}=zk(m?c:l),_=Bk.has(p)?(0,Z.jsx)(Rk,{scope:n,name:r,path:i,host:a,fileName:d}):(0,Z.jsx)(mg,{fileName:d,extension:p,loadText:e=>Xm({scope:n,name:r,path:i,host:a},e)}),v;t[2]!==h||t[3]!==m||t[4]!==g?(v=m&&h?(0,Z.jsx)(Ak,{containerRef:s,onClose:()=>g(!1)}):null,t[2]=h,t[3]=m,t[4]=g,t[5]=v):v=t[5];let y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(bf,{className:`size-4 shrink-0`,"aria-hidden":!0}),t[6]=y):y=t[6];let b;t[7]!==o||t[8]!==r?(b=o({id:`96pApd`,values:{name:r}}),t[7]=o,t[8]=r,t[9]=b):b=t[9];let x;t[10]===b?x=t[11]:(x=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 border-border border-b bg-muted/35 px-3 py-2 text-muted-foreground text-sm`,children:[y,(0,Z.jsx)(`span`,{className:`truncate`,children:b})]}),t[10]=b,t[11]=x);let S;t[12]===_?S=t[13]:(S=(0,Z.jsx)(`div`,{ref:s,className:`min-h-0 flex-1`,children:_}),t[12]=_,t[13]=S);let C;return t[14]!==v||t[15]!==x||t[16]!==S?(C=(0,Z.jsxs)(`div`,{ref:c,className:`relative flex h-full min-h-0 flex-col`,children:[v,x,S]}),t[14]=v,t[15]=x,t[16]=S,t[17]=C):C=t[17],C}var Hk=new Set;function Uk(){for(let e of Hk)e()}function Wk(e){return Hk.add(e),()=>Hk.delete(e)}var Gk=[`from-[#ff9d6c] to-[#ff7eb3]`,`from-[#8fe0c0] to-[#59c0ff]`,`from-[#c0b0ff] to-[#8fb0ff]`,`from-[#ffd18f] to-[#ff9fb0]`,`from-[#8fb0ff] to-[#c9a8ff]`,`from-[#7fe0a0] to-[#bfe08f]`];function Kk(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return Gk[Math.abs(t)%Gk.length]??Gk[0]}var qk=`SKILL.md`,Jk=new Map;function Yk(e){let t=(0,$.c)(44),{source:n,name:r,subtitle:i,tintKey:a,headerActions:o,headerLine:s,noPreviewFallback:c,banner:l,reserveRightGutter:u,selectedPath:d,scope:f,onBundlePathClick:p,onPreviewMeta:m}=e,h=u===void 0?!1:u,{_:g}=Bn(),_=`${n}::${r}`,v;t[0]===_?v=t[1]:(v=()=>Jk.get(_)??null,t[0]=_,t[1]=v);let[y,b]=(0,Q.useState)(v),x;t[2]===_?x=t[3]:(x=()=>Jk.has(_),t[2]=_,t[3]=x);let[S,C]=(0,Q.useState)(x),w=d??qk,T=(0,Q.useRef)(null),E=(0,Q.useRef)(null),{findOpen:D,setFindOpen:O}=zk(T),k,A;t[4]!==r||t[5]!==n?(k=()=>{let e=`${n}::${r}`,t=new AbortController;Jk.has(e)||Ym({source:n,name:r},t.signal).then(n=>{t.signal.aborted||(n.ok&&(Jk.set(e,n),b(n)),C(!0))});let i=Gc(Qk);return()=>{t.abort(),i()}},A=[n,r],t[4]=r,t[5]=n,t[6]=k,t[7]=A):(k=t[6],A=t[7]),(0,Q.useEffect)(k,A);let j,M;t[8]!==m||t[9]!==y?(j=()=>{y&&m?.(y)},M=[y,m],t[8]=m,t[9]=y,t[10]=j,t[11]=M):(j=t[10],M=t[11]),(0,Q.useEffect)(j,M);let N=y?.description,P;if(t[12]!==g||t[13]!==l||t[14]!==N||t[15]!==D||t[16]!==o||t[17]!==s||t[18]!==r||t[19]!==c||t[20]!==p||t[21]!==y||t[22]!==S||t[23]!==h||t[24]!==f||t[25]!==w||t[26]!==O||t[27]!==i||t[28]!==a){let e=y?$k(y.skillMd):[],n;t[30]===y?n=t[31]:(n=y?js(y):null,t[30]=y,t[31]=n);let u=n,d;t[32]!==g||t[33]!==y||t[34]!==w?(d=w===qk?y?{path:`${y.name} SKILL.md`,content:y.skillMd,md:!0}:null:(()=>{let e=y?.files?.find(e=>e.relPath===w);return e?{path:e.relPath,content:e.content??g({id:`fdeFfN`}),md:e.content!==null&&/\.mdx?$/.test(e.relPath)}:null})(),t[32]=g,t[33]=y,t[34]=w,t[35]=d):d=t[35];let m=d,_;t[36]!==D||t[37]!==O?(_=D?(0,Z.jsx)(Ak,{containerRef:E,onClose:()=>O(!1)}):null,t[36]=D,t[37]=O,t[38]=_):_=t[38];let v;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(bf,{className:`size-4`,"aria-hidden":!0}),t[39]=v):v=t[39];let b;t[40]!==o||t[41]!==s||t[42]!==h?(b=(0,Z.jsx)(Fg,{icon:v,actions:o,reserveRightGutter:h,children:s}),t[40]=o,t[41]=s,t[42]=h,t[43]=b):b=t[43],P=(0,Z.jsxs)(`div`,{ref:T,className:`relative flex h-full min-h-0 flex-col`,children:[_,b,y?(0,Z.jsxs)(`div`,{ref:E,className:`editor-doc-scroll min-h-0 flex-1 overflow-auto subtle-scrollbar scroll-fade-mask`,children:[w===qk?l:null,w===qk?(0,Z.jsx)(`div`,{className:`editor-content-aligned pt-6`,children:(0,Z.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Z.jsx)(Bu,{icon:(0,Z.jsx)(Vu,{className:`size-3.5`}),label:g({id:`XmJfZT`}),children:(0,Z.jsx)(`span`,{className:`font-mono`,children:r})}),N?(0,Z.jsx)(Bu,{icon:(0,Z.jsx)(Pb,{className:`size-3.5`}),label:g({id:`eTsJYJ`}),children:(0,Z.jsx)(`p`,{className:`text-foreground/80`,children:N})}):null,(0,Z.jsx)(Bu,{icon:(0,Z.jsx)(Ab,{className:`size-3.5`}),label:g({id:`pTyA_t`}),children:e.length>0?(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.map(Zk)}):(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`N2S1rs`})})}),u?(0,Z.jsx)(Bu,{icon:(0,Z.jsx)(Uf,{className:`size-3.5`}),label:g({id:`WOr-hW`}),children:(0,Z.jsx)(Pg,{size:u})}):null]})}):null,m?.md?(0,Z.jsx)(Fk,{flow:!0,fileName:m.path,text:m.content,linkBaseDocName:f?ps(f,r,w===qk?`SKILL`:w):void 0,skillPathLinkDocName:f?ko(f,r):void 0,onBundlePathClick:p}):m?(0,Z.jsx)(`div`,{className:`editor-content-aligned`,children:(0,Z.jsx)(`pre`,{className:`overflow-auto whitespace-pre-wrap break-words py-4 font-mono text-xs subtle-scrollbar scroll-fade-mask`,children:m.content})}):null]}):S?(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-4`,children:c??(0,Z.jsxs)(`div`,{className:`flex aspect-[2/1] w-full max-w-xl flex-col justify-end rounded-xl bg-gradient-to-br p-5 ${Kk(a)}`,"aria-hidden":!0,children:[(0,Z.jsx)(`span`,{className:`truncate font-semibold text-2xl text-neutral-900`,children:r}),(0,Z.jsx)(`span`,{className:`truncate text-neutral-900/70 text-sm`,children:i})]})}):(0,Z.jsx)(`div`,{className:`editor-doc-scroll min-h-0 flex-1 overflow-auto subtle-scrollbar scroll-fade-mask`,children:(0,Z.jsx)(`div`,{className:`editor-content-aligned pt-6`,children:(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(`div`,{className:`h-6 w-2/3 animate-pulse rounded bg-muted`}),[`a`,`b`,`c`,`d`,`e`].map(Xk)]})})})]}),t[12]=g,t[13]=l,t[14]=N,t[15]=D,t[16]=o,t[17]=s,t[18]=r,t[19]=c,t[20]=p,t[21]=y,t[22]=S,t[23]=h,t[24]=f,t[25]=w,t[26]=O,t[27]=i,t[28]=a,t[29]=P}else P=t[29];return P}function Xk(e){return(0,Z.jsx)(`div`,{className:`h-4 w-11/12 animate-pulse rounded bg-muted`},e)}function Zk(e){return(0,Z.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-muted-foreground text-xs`,children:e},e)}function Qk(){return Jk.clear()}function $k(e){try{let{frontmatter:t}=ac(e);return t?Ls(_s(t)):[]}catch{return[]}}var eA=Rr(`group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pe-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current`}},defaultVariants:{variant:`default`}});function tA(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==i?(a=gr(eA({variant:i}),n),t[4]=n,t[5]=i,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==a?(o=(0,Z.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:a,...r}),t[7]=r,t[8]=a,t[9]=o):o=t[9],o}function nA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`alert-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function rA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`text-balance text-muted-foreground text-sm md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`alert-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function iA(e){let t=(0,$.c)(66),{bundle:n,source:r,scope:i,previewedName:a,onInstalled:o}=e,{_:s}=Bn(),[c,l]=(0,Q.useState)(!1);if(n.names.length<=1)return null;let u;t[0]!==s||t[1]!==n.capabilities?.hooks?(u=n.capabilities?.hooks?s({id:`8fDf7j`}):null,t[0]=s,t[1]=n.capabilities?.hooks,t[2]=u):u=t[2];let d;t[3]!==s||t[4]!==n.capabilities?.commands?(d=n.capabilities?.commands?s({id:`9HKBNN`}):null,t[3]=s,t[4]=n.capabilities?.commands,t[5]=d):d=t[5];let f;t[6]!==s||t[7]!==n.capabilities?.mcp?(f=n.capabilities?.mcp?s({id:`8qgfac`}):null,t[6]=s,t[7]=n.capabilities?.mcp,t[8]=f):f=t[8];let p;t[9]!==s||t[10]!==n.capabilities?.agents?(p=n.capabilities?.agents?s({id:`EpZQFw`}):null,t[9]=s,t[10]=n.capabilities?.agents,t[11]=p):p=t[11];let m;t[12]!==u||t[13]!==d||t[14]!==f||t[15]!==p?(m=[u,d,f,p].filter(oA),t[12]=u,t[13]=d,t[14]=f,t[15]=p,t[16]=m):m=t[16];let h=m,g=n.names.length,_=n.plugin,v,y,b,x,S,C,w,T,E;if(t[17]!==n.names||t[18]!==h||t[19]!==_||t[20]!==a){let e;t[30]===a?e=t[31]:(e=e=>e!==a,t[30]=a,t[31]=e);let r=n.names.filter(e),i=r.slice(0,4);S=`editor-content-aligned`,v=tA,T=`note`,E=`my-3 bg-muted/40 px-4 py-3`,t[32]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(Ap,{className:`size-4`,"aria-hidden":!0}),t[32]=y):y=t[32];let o=_?(0,Z.jsx)(Y,{id:`nFAvDj`,values:{0:r.length,plugin:_}}):(0,Z.jsx)(Y,{id:`Hq3uDq`,values:{0:r.length}});t[33]===o?b=t[34]:(b=(0,Z.jsx)(nA,{children:o}),t[33]=o,t[34]=b);let s;t[35]===h?s=t[36]:(s=h.length>0?(0,Z.jsx)(Y,{id:`5A_TLD`,values:{0:h.join(`, `)}}):null,t[35]=h,t[36]=s),t[37]===s?x=t[38]:(x=(0,Z.jsx)(rA,{className:`min-w-0`,children:s}),t[37]=s,t[38]=x),C=`mt-2 flex flex-wrap items-center gap-x-2 gap-y-1.5 group-has-[>svg]/alert:col-start-2`,w=i.map(aA),t[17]=n.names,t[18]=h,t[19]=_,t[20]=a,t[21]=v,t[22]=y,t[23]=b,t[24]=x,t[25]=S,t[26]=C,t[27]=w,t[28]=T,t[29]=E}else v=t[21],y=t[22],b=t[23],x=t[24],S=t[25],C=t[26],w=t[27],T=t[28],E=t[29];let D;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>l(!0),t[39]=D):D=t[39];let O;t[40]===g?O=t[41]:(O=(0,Z.jsx)(X,{variant:`link`,size:`sm`,className:`px-1`,"data-testid":`plugin-bundle-pick`,onClick:D,children:(0,Z.jsx)(Y,{id:`yhy5h-`,values:{count:g}})}),t[40]=g,t[41]=O);let k;t[42]===n.repositoryUrl?k=t[43]:(k=n.repositoryUrl?(0,Z.jsx)(X,{variant:`ghost`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(`a`,{href:n.repositoryUrl,target:`_blank`,rel:`noreferrer`,children:[(0,Z.jsx)(Y,{id:`Fhp4Gn`}),(0,Z.jsx)(ju,{className:`size-3.5`})]})}):null,t[42]=n.repositoryUrl,t[43]=k);let A;t[44]!==O||t[45]!==k||t[46]!==C||t[47]!==w?(A=(0,Z.jsxs)(`div`,{className:C,children:[w,O,k]}),t[44]=O,t[45]=k,t[46]=C,t[47]=w,t[48]=A):A=t[48];let j;t[49]!==v||t[50]!==y||t[51]!==b||t[52]!==x||t[53]!==A||t[54]!==T||t[55]!==E?(j=(0,Z.jsxs)(v,{role:T,className:E,children:[y,b,x,A]}),t[49]=v,t[50]=y,t[51]=b,t[52]=x,t[53]=A,t[54]=T,t[55]=E,t[56]=j):j=t[56];let M=c?n:null,N;t[57]!==o||t[58]!==i||t[59]!==r||t[60]!==M?(N=(0,Z.jsx)(Zd,{bundle:M,source:r,defaultScope:i,onInstalled:o,onOpenChange:l}),t[57]=o,t[58]=i,t[59]=r,t[60]=M,t[61]=N):N=t[61];let P;return t[62]!==S||t[63]!==j||t[64]!==N?(P=(0,Z.jsxs)(`div`,{className:S,children:[j,N]}),t[62]=S,t[63]=j,t[64]=N,t[65]=P):P=t[65],P}function aA(e){return(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1.5 py-0.5 font-mono text-[12px] text-foreground/80`,children:e},e)}function oA(e){return e!==null}function sA(e){let t=(0,$.c)(33),{source:n,name:r,initialScope:i,marketplace:a}=e,{_:o}=Bn(),[s,c]=(0,Q.useState)(i),l=Fh(),u;t[0]!==l||t[1]!==s?(u=()=>{if(l.status!==`ready`)return null;let e=l.data.find(e=>e.scope===s)?.installableEditors;return e?new Set(e):null},t[0]=l,t[1]=s,t[2]=u):u=t[2];let d=u,[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),v;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(v=[],t[3]=v):v=t[3];let[y,b]=(0,Q.useState)(v),[x,S]=(0,Q.useState)(!1),C;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(C=[],t[4]=C):C=t[4];let w=(0,Q.useRef)(C),T=(0,Q.useRef)(null),E=(0,Q.useRef)(null),D=(0,Q.useRef)(null),O;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=[],t[5]=O):O=t[5];let k=(0,Q.useRef)(O),A=(0,Q.useRef)(!1),j;t[6]!==o||t[7]!==a||t[8]!==r||t[9]!==s||t[10]!==n?(j=async function(){if(T.current)return T.current;if(D.current)return D.current;let e=s,t=Vm({source:n,skill:r,scope:e,install:!1,...a?{marketplace:!0}:{}}).then(t=>t.ok?(T.current=t.name,E.current=e,_(e),p(t.name),h(t.path??null),t.name):(Dc.error(o({id:`oX-rVu`,values:{0:t.error}})),null));D.current=t;let i=await t;return D.current=null,i},t[6]=o,t[7]=a,t[8]=r,t[9]=s,t[10]=n,t[11]=j):j=t[11];let M=j,N;t[12]!==o||t[13]!==M?(N=async function(e){if(w.current=e,k.current=e,b(e),!A.current){for(A.current=!0,S(!0);;){let e=k.current,t=await M(),n=E.current;if(!t||!n)break;let r=await Um({scope:n,name:t,targets:[...e],linkMode:!0});if(!r.ok){Dc.error(o({id:`s-pW_v`,values:{0:r.error}}));break}if(e===k.current){let e=w.current.filter(cA),t=[...new Set([...e,...r.hosts])];w.current=t,b(t);break}}A.current=!1,S(!1)}},t[12]=o,t[13]=M,t[14]=N):N=t[14];let P=N,F;t[15]===y?F=t[16]:(F=new Set(y),t[15]=y,t[16]=F);let I=y.length>0,L;t[17]!==o||t[18]!==x||t[19]!==P||t[20]!==M||t[21]!==d||t[22]!==F||t[23]!==I?(L={hostSet:F,installed:I,installing:x,toggleEditor(e,t){if(e===`agents`){if(!t)return;(async()=>{S(!0);let e=await M(),t=E.current;if(e&&t){let n=await Zm({scope:t,name:e,dir:ks,mode:`copy`});if(n.ok){let e=[...new Set([...w.current,`agents`])];w.current=e,b(e)}else Dc.error(o({id:`s-pW_v`,values:{0:n.error}}))}S(!1)})();return}let n=new Set(w.current);t?n.add(e):n.delete(e),P([...n])},installAll(){let e=d();P(e===null?[...xr]:xr.filter(t=>e.has(t)))},linkMode:!0,placeAt(e,t){(async()=>{S(!0);let n=await M(),r=E.current;if(n&&r){let i=await Zm({scope:r,name:n,dir:e,mode:t});i.ok||Dc.error(o({id:`s-pW_v`,values:{0:i.error}}))}S(!1)})()}},t[17]=o,t[18]=x,t[19]=P,t[20]=M,t[21]=d,t[22]=F,t[23]=I,t[24]=L):L=t[24];let R=L,z=f!==null||x,B;return t[25]!==M||t[26]!==f||t[27]!==m||t[28]!==g||t[29]!==s||t[30]!==z||t[31]!==R?(B={scope:s,setScope:c,scopeLocked:z,importedName:f,importedPath:m,importedScope:g,importNow:M,toggles:R},t[25]=M,t[26]=f,t[27]=m,t[28]=g,t[29]=s,t[30]=z,t[31]=R,t[32]=B):B=t[32],B}function cA(e){return!lc(e)}var lA=`SKILL.md`;function uA(e){let t=(0,$.c)(18),{scope:n,name:r}=e,i;t[0]!==r||t[1]!==n?(i={scope:n,name:r},t[0]=r,t[1]=n,t[2]=i):i=t[2];let{origin:a,github:o,updateAvailable:s,reimport:c,reimporting:l}=Bg(i),u;t[3]!==r||t[4]!==n?(u=(0,Z.jsx)(ou,{scope:n,name:r,showNewFile:!1}),t[3]=r,t[4]=n,t[5]=u):u=t[5];let d=u;if(!a){let e;return t[6]===d?e=t[7]:(e=(0,Z.jsx)(`div`,{className:`flex gap-1`,children:d}),t[6]=d,t[7]=e),e}let f;t[8]===o?f=t[9]:(f=o?(0,Z.jsx)(X,{variant:`ghost`,size:`sm`,className:`px-2`,asChild:!0,children:(0,Z.jsxs)(`a`,{href:o,target:`_blank`,rel:`noreferrer`,children:[(0,Z.jsx)(Y,{id:`wdxz7K`}),(0,Z.jsx)(ju,{className:`h-3.5 w-3.5`})]})}):null,t[8]=o,t[9]=f);let p;t[10]!==c||t[11]!==l||t[12]!==s?(p=s?(0,Z.jsx)(X,{size:`sm`,onClick:()=>void c(),disabled:l,children:l?(0,Z.jsx)(Y,{id:`JL3si7`}):(0,Z.jsx)(Y,{id:`EkH9pt`})}):null,t[10]=c,t[11]=l,t[12]=s,t[13]=p):p=t[13];let m;return t[14]!==d||t[15]!==f||t[16]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[f,p,d]}),t[14]=d,t[15]=f,t[16]=p,t[17]=m):m=t[17],m}function dA(e){let t=(0,$.c)(112),{flavor:n,source:r,name:i,subtitle:a,level:o,reserveRightGutter:s,path:c}=e,l=c??lA,u=ih(),d=Zf(),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(!0),g,_;t[0]!==n||t[1]!==i||t[2]!==r?(g=()=>{if(n!==`explore`)return;let e=!1;return Km({source:r,name:i}).then(t=>{e||t.ok&&p(t)}),()=>{e=!0}},_=[n,r,i],t[0]=n,t[1]=i,t[2]=r,t[3]=g,t[4]=_):(g=t[3],_=t[4]),(0,Q.useEffect)(g,_);let[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(null),S;t[5]!==n||t[6]!==i||t[7]!==r?(S=n===`explore`?Ro(r,i):null,t[5]=n,t[6]=i,t[7]=r,t[8]=S):S=t[8];let C=S,w=n===`explore`?f?.sourceUrl??C?.sourceUrl:v?.repositoryUrl,T=f?.sourceKind??C?.sourceKind,[E,D]=(0,Q.useState)(null),O,k;t[9]!==n||t[10]!==r||t[11]!==T?(O=()=>{if(D(null),n!==`explore`||T!==`site`)return;let e=new AbortController;return Wm(r,e.signal).then(t=>{e.signal.aborted||!t.ok||D(t.skills.map(fA))}),()=>e.abort()},k=[n,T,r],t[9]=n,t[10]=r,t[11]=T,t[12]=O,t[13]=k):(O=t[12],k=t[13]),(0,Q.useEffect)(O,k);let A;t[14]!==b||t[15]!==E?(A=b?{plugin:b.plugin,names:b.bundledSkills,capabilities:b.capabilities,...b.repositoryUrl?{repositoryUrl:b.repositoryUrl}:{}}:E?{plugin:null,names:E}:null,t[14]=b,t[15]=E,t[16]=A):A=t[16];let j=A,M=n===`detected`,N=n===`builtin`,P=n===`linked`,F=n===`foreign`,I=o??`project`,L=n===`explore`,R;t[17]!==i||t[18]!==r||t[19]!==L||t[20]!==I?(R={source:r,name:i,initialScope:I,marketplace:L},t[17]=i,t[18]=r,t[19]=L,t[20]=I,t[21]=R):R=t[21];let z=sA(R),B=(0,Q.useRef)(!1),[V,ee]=(0,Q.useState)(null),H=z.importedName??V,U=z.importedScope??z.scope,{openTabs:W,closeTab:G}=Et(),te=Fh(),[ne,re]=(0,Q.useState)(!1),K;t[22]!==te||t[23]!==P||t[24]!==i||t[25]!==I?(K=P&&te.status===`ready`?te.data.find(e=>e.scope===I&&e.name===i):void 0,t[22]=te,t[23]=P,t[24]=i,t[25]=I,t[26]=K):K=t[26];let ie=K,q=(n===`explore`||F||v!==null)&&H!==null,ae,oe;t[27]!==G||t[28]!==q||t[29]!==ne||t[30]!==H||t[31]!==U||t[32]!==i||t[33]!==d||t[34]!==W||t[35]!==z.importedPath||t[36]!==z.toggles.hostSet||t[37]!==z.toggles.installing?(ae=()=>{if(!q||B.current||ne||z.toggles.installing)return;B.current=!0;let e=W.filter(e=>{let t=ze(e);return t.kind===`skill-preview`&&t.name===i}),t=t=>{d(U,H,{...t===void 0?{}:{path:t},replaceActive:!0,replaceHistory:!0});for(let t of e)G(t)};z.toggles.hostSet.size===0?t(z.importedPath??void 0):Bm(U,H).then(e=>t(e??z.importedPath??void 0))},oe=[q,ne,U,H,d,W,i,G,z.importedPath,z.toggles.installing,z.toggles.hostSet],t[27]=G,t[28]=q,t[29]=ne,t[30]=H,t[31]=U,t[32]=i,t[33]=d,t[34]=W,t[35]=z.importedPath,t[36]=z.toggles.hostSet,t[37]=z.toggles.installing,t[38]=ae,t[39]=oe):(ae=t[38],oe=t[39]),(0,Q.useEffect)(ae,oe);let se;t[40]===a?se=t[41]:(se=a&&a.charAt(0).toUpperCase()+a.slice(1),t[40]=a,t[41]=se);let ce=se,le=u[I],ue;t[42]===i?ue=t[43]:(ue=(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`,children:i}),t[42]=i,t[43]=ue);let de=ue,fe;t[44]===le?fe=t[45]:(fe=(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`,children:le}),t[44]=le,t[45]=fe);let pe=fe,J;t[46]===ce?J=t[47]:(J=(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`,children:ce}),t[46]=ce,t[47]=J);let me=J,he=v?.version?` (v${v.version})`:``,ge=ie?.canonicalPath??ie?.path??null,_e;t[48]!==me||t[49]!==pe||t[50]!==de||t[51]!==N||t[52]!==j||t[53]!==M||t[54]!==F||t[55]!==P||t[56]!==ge||t[57]!==v||t[58]!==he||t[59]!==r||t[60]!==T?(_e=P?(0,Z.jsx)(Y,{id:`8VLpRT`,values:{0:ge??r,boldName:de},components:{0:(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`})}}):N?(0,Z.jsx)(Y,{id:`rmorj0`,values:{boldName:de}}):v?(0,Z.jsx)(Y,{id:`UceXfW`,values:{0:v.plugin,boldName:de,pluginVersion:he,boldHarness:me},components:{0:(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`})}}):F?(0,Z.jsx)(Y,{id:`yhYv9j`,values:{boldName:de,source:r},components:{0:(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`})}}):M?(0,Z.jsx)(Y,{id:`UHwc0P`,values:{boldName:de,boldHarness:me,boldLevel:pe}}):j&&j.names.length>1?T===`site`?(0,Z.jsx)(Y,{id:`iE-yoU`,values:{0:j.names.length,boldName:de}}):(0,Z.jsx)(Y,{id:`El9CQ6`,values:{0:j.names.length,boldName:de}}):(0,Z.jsx)(Y,{id:`fBoO7w`,values:{boldName:de}}),t[48]=me,t[49]=pe,t[50]=de,t[51]=N,t[52]=j,t[53]=M,t[54]=F,t[55]=P,t[56]=ge,t[57]=v,t[58]=he,t[59]=r,t[60]=T,t[61]=_e):_e=t[61];let ve=_e,ye;t[62]!==N||t[63]!==j||t[64]!==f||t[65]!==M||t[66]!==n||t[67]!==F||t[68]!==P||t[69]!==ie||t[70]!==i||t[71]!==v||t[72]!==z.scope||t[73]!==z.scopeLocked||t[74]!==z.setScope||t[75]!==z.toggles||t[76]!==T||t[77]!==w||t[78]!==I?(ye=P?(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[ie?(0,Z.jsx)(X,{variant:`ghost`,size:`sm`,className:`px-2`,"data-testid":`skill-preview-open-source-file`,onClick:()=>{Yf(pm(ie)),Ke(!1),Uk()},children:(0,Z.jsx)(Y,{id:`9npOH9`})}):null,(0,Z.jsx)(ou,{scope:I,name:i,showNewFile:!1})]}):N?(0,Z.jsx)(uA,{scope:I,name:i}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`flex gap-1`,children:[f?.skillsUrl?(0,Z.jsx)(X,{variant:`ghost`,size:`sm`,className:`px-2`,asChild:!0,children:(0,Z.jsxs)(`a`,{href:f.skillsUrl,target:`_blank`,rel:`noreferrer`,children:[(0,Z.jsx)(Y,{id:`gN3JX8`}),(0,Z.jsx)(ju,{className:`h-3.5 w-3.5`})]})}):null,w?(0,Z.jsx)(X,{variant:`ghost`,size:`sm`,className:`px-2`,asChild:!0,children:(0,Z.jsxs)(`a`,{href:w,target:`_blank`,rel:`noreferrer`,children:[n===`explore`&&T===`site`?(0,Z.jsx)(Y,{id:`wdxz7K`}):(0,Z.jsx)(Y,{id:`IreQBq`}),(0,Z.jsx)(ju,{className:`h-3.5 w-3.5`})]})}):null]}),!P&&(v||!M)?(0,Z.jsxs)(va,{modal:!1,onOpenChange:re,children:[(0,Z.jsx)(fa,{asChild:!0,children:(0,Z.jsx)(X,{size:`sm`,disabled:z.toggles.installing,"data-testid":v?`skill-preview-edit-a-copy`:F?`skill-preview-copy-in`:void 0,children:z.toggles.installing?v||F?(0,Z.jsx)(Y,{id:`Dvr1Sg`}):(0,Z.jsx)(Y,{id:`Wtw22s`}):(0,Z.jsxs)(Z.Fragment,{children:[v?(0,Z.jsx)(Y,{id:`rFL-yb`}):F?(0,Z.jsx)(Y,{id:`XBgr2S`}):j&&j.names.length>1?(0,Z.jsx)(Y,{id:`f-k37b`}):(0,Z.jsx)(Y,{id:`TKQ7K-`}),(0,Z.jsx)(Gu,{className:`size-4 opacity-60`,"aria-hidden":!0})]})})}),(0,Z.jsxs)(ga,{align:`end`,className:Dr,children:[v||F?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ma,{className:`font-normal text-muted-foreground text-xs leading-snug whitespace-normal`,children:(0,Z.jsx)(Y,{id:`4FltCB`})}),(0,Z.jsx)(ya,{})]}):null,(0,Z.jsx)(ru,{value:z.scope,onSelect:z.setScope,disabled:z.scopeLocked}),(0,Z.jsx)(ya,{}),(0,Z.jsx)(Tr,{toggles:z.toggles,skill:{scope:z.scope,name:i}})]})]}):null]}),t[62]=N,t[63]=j,t[64]=f,t[65]=M,t[66]=n,t[67]=F,t[68]=P,t[69]=ie,t[70]=i,t[71]=v,t[72]=z.scope,t[73]=z.scopeLocked,t[74]=z.setScope,t[75]=z.toggles,t[76]=T,t[77]=w,t[78]=I,t[79]=ye):ye=t[79];let be=ye,xe;t[80]!==n||t[81]!==o||t[82]!==i||t[83]!==r||t[84]!==a||t[85]!==I?(xe=e=>n===`explore`?(window.location.hash=Yp({flavor:n,source:r,name:i,subtitle:a,level:o,path:e}),!0):(window.location.hash=Zp({scope:I,name:i,path:e}),!0),t[80]=n,t[81]=o,t[82]=i,t[83]=r,t[84]=a,t[85]=I,t[86]=xe):xe=t[86];let Se=xe,Ce=a||i,we;t[87]!==M||t[88]!==n?(we=e=>{let t=M?e.plugin??null:null;y(e=>e?.provider===t?.provider&&e?.plugin===t?.plugin&&e?.version===t?.version&&e?.marketplace===t?.marketplace&&e?.repositoryUrl===t?.repositoryUrl?e:t),x(n===`explore`?e.pluginBundle??null:null)},t[87]=M,t[88]=n,t[89]=we):we=t[89];let Te;t[90]!==j||t[91]!==i||t[92]!==z.scope||t[93]!==r?(Te=j?(0,Z.jsx)(iA,{bundle:j,source:r,scope:z.scope,previewedName:i,onInstalled:e=>{let t=e.get(i);t!==void 0&&ee(t)}}):void 0,t[90]=j,t[91]=i,t[92]=z.scope,t[93]=r,t[94]=Te):Te=t[94];let Ee=N?I:void 0,De;t[95]!==f||t[96]!==m?(De=f?.image&&m?(0,Z.jsx)(`img`,{src:f.image,alt:``,className:`max-h-full max-w-full rounded-xl border border-border bg-muted`,onError:()=>h(!1)}):void 0,t[95]=f,t[96]=m,t[97]=De):De=t[97];let Oe;return t[98]!==be||t[99]!==ve||t[100]!==i||t[101]!==Se||t[102]!==s||t[103]!==l||t[104]!==r||t[105]!==a||t[106]!==Ce||t[107]!==we||t[108]!==Te||t[109]!==Ee||t[110]!==De?(Oe=(0,Z.jsx)(Yk,{source:r,name:i,subtitle:a,tintKey:Ce,onBundlePathClick:Se,headerActions:be,headerLine:ve,reserveRightGutter:s,selectedPath:l,onPreviewMeta:we,banner:Te,scope:Ee,noPreviewFallback:De}),t[98]=be,t[99]=ve,t[100]=i,t[101]=Se,t[102]=s,t[103]=l,t[104]=r,t[105]=a,t[106]=Ce,t[107]=we,t[108]=Te,t[109]=Ee,t[110]=De,t[111]=Oe):Oe=t[111],Oe}function fA(e){return e.name}var pA=al(()=>n(()=>import(`./SettingsDialogBody-Cqc-yl4k.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([124,1,125,13,9,28,2,3,29,30,31,32,33,83,37,66,18,8,84,85,86,87,88,89,7,90,43,44,11,12,45,40,14,15,42,19,17,91,21,92,24,126,10,16,20,127,104,23,128,129,130,41,99,118,119,131,132,133,93,39,46,71,72,73,74,75,76,77,78,79,80,81,82,4,5,94,25,34,56,57,58,95,68,61,96,97,98,64,65,100,55,59,60,62,101,102,103,26,105,106,107,35,108,109,110,111,112,113,114,115,134,54,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]),import.meta.url));function mA(e){let t=(0,$.c)(9),{error:n}=e,{_:r}=Bn(),i;t[0]!==r||t[1]!==n?(i=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`3h5zMp`}),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`h3`,{id:`settings-body-error-title`,className:`font-heading text-base leading-none font-medium`,children:(0,Z.jsx)(Y,{id:`hwFOFD`})}),t[3]=o):o=t[3];let s;t[4]===a?s=t[5]:(s=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[o,(0,Z.jsx)(`p`,{className:`max-w-xs text-sm text-muted-foreground`,children:a})]}),t[4]=a,t[5]=s);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(X,{variant:`default`,onClick:hA,children:(0,Z.jsx)(Y,{id:`HpK_8d`})}),t[6]=c):c=t[6];let l;return t[7]===s?l=t[8]:(l=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`settings-body-error-title`,"data-slot":`settings-body-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-5 p-8 text-center`,children:[s,c]}),t[7]=s,t[8]=l),l}function hA(){return window.location.reload()}function gA(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(pr,{fallbackRender:vA,onError:_A,children:n}),t[0]=n,t[1]=r),r}function _A(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function vA(e){return(0,Z.jsx)(mA,{...e})}function yA(e=typeof window>`u`?void 0:window.location){return e?.protocol===`file:`}function bA(e){let{groups:t,translate:n}=e,r=[],i=new Set;for(let e of t)if(e.enabled)for(let t of e.items){i.add(t.id),r.push({id:`section:${t.id}`,kind:`section`,sectionId:t.id,label:t.label,context:e.label,keywords:[e.label]});for(let n of t.subsections??[])r.push({id:`subsection:${t.id}:${n.id}`,kind:`field`,sectionId:t.id,label:n.label,context:`${e.label} → ${t.label}`,keywords:[e.label,t.label],targetField:n.anchor})}for(let e of vf)if(i.has(e.sectionId))for(let t of e.fields){let i=t.path.join(`.`);r.push({id:`field:${e.sectionId}:${i}`,kind:`field`,sectionId:e.sectionId,label:n(t.label),keywords:t.description?[n(t.description)]:[],targetField:i})}if(i.has(`plugin:markdownlint`))for(let e of uc)r.push({id:`rule:${e.id}`,kind:`rule`,sectionId:`plugin:markdownlint`,label:e.name,keywords:[e.id,e.alias,...e.aliases],ruleId:e.id});return r}function xA(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}var SA={"content-rules":{sectionId:`project-preferences`,anchor:`section:content-rules`},terminal:{sectionId:`project-preferences`,anchor:`section:terminal`},sharing:{sectionId:`sync`,anchor:`section:sharing`}};function CA(e){let t=SA[e];return t?{sectionId:t.sectionId,anchor:t.anchor}:{sectionId:e,anchor:null}}function wA(e){return CA(e).sectionId}function TA(e){let t=(0,$.c)(51),{open:n,initialSection:r,onOpenChange:i}=e,a=r===void 0?null:r,{_:o}=Bn(),{collabUrl:s}=Et(),{userBinding:c,userSynced:l,okignoreBinding:u,okignoreSynced:d,projectConfig:f,merged:p}=Fl(),{desktopPresent:m}=Wd(),h=a??`preferences`,g;t[0]===h?g=t[1]:(g=wA(h),t[0]=h,t[1]=g);let[_,v]=(0,Q.useState)(g),[y,b]=(0,Q.useState)(``),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),T=(0,Q.useRef)(0),E=(0,Q.useRef)(null),D,O;t[2]!==a||t[3]!==n?(D=()=>{if(n){let e=CA(a??`preferences`);v(e.sectionId),S(e.anchor?{path:e.anchor}:null),b(``)}},O=[n,a],t[2]=a,t[3]=n,t[4]=D,t[5]=O):(D=t[4],O=t[5]),(0,Q.useEffect)(D,O);let k,A;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>Ic(e=>{let t=CA(e);v(t.sectionId),t.anchor&&S({path:t.anchor})}),A=[],t[6]=k,t[7]=A):(k=t[6],A=t[7]),(0,Q.useEffect)(k,A);let j,M;t[8]===x?(j=t[9],M=t[10]):(j=()=>{if(!x)return;let e=E.current;if(!e)return;let t=null,n=null,r=null,i=null,a=()=>{let r=e.querySelector(`[data-field="${x.path}"]`);return r?(r.scrollIntoView({block:`center`}),r.classList.add(`animate-settings-nav-flash`),t=r,n=setTimeout(()=>r.classList.remove(`animate-settings-nav-flash`),750),!0):!1};return a()||(i=new MutationObserver(()=>{a()&&i?.disconnect()}),i.observe(e,{childList:!0,subtree:!0}),r=setTimeout(()=>i?.disconnect(),4e3)),()=>{i?.disconnect(),n&&clearTimeout(n),r&&clearTimeout(r),t?.classList.remove(`animate-settings-nav-flash`)}},M=[x],t[8]=x,t[9]=j,t[10]=M),(0,Q.useEffect)(j,M);let N=s!==null,P;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(P=zd(),t[11]=P):P=t[11];let F=P,I;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(I=Qd(),t[12]=I):I=t[12];let L=I,R,z;if(t[13]!==o||t[14]!==m||t[15]!==N||t[16]!==p?.appearance?.colorThemeEnabled||t[17]!==p?.slides?.enabled||t[18]!==f?.contentRules){let e;t[21]===f?.contentRules?e=t[22]:(e=e=>f?.contentRules?.[e.id]?.enabled===!0,t[21]=f?.contentRules,t[22]=e);let n=Ad.filter(e).map(EA),r=p?.appearance?.colorThemeEnabled!==!1,i=p?.slides?.enabled===!0,a=yA();R=[{id:`user`,label:o({id:`7PzzBU`}),enabled:!0,items:[{id:`preferences`,label:o({id:`Q6hhn8`})},{id:`configure-agents`,label:o({id:`jRAGrQ`})},{id:`hotkeys`,label:o({id:`4KmEoC`})},{id:`account`,label:o({id:`AeXO77`})},{id:`user-plugins-manage`,label:o({id:`ohUJJM`})},{id:`user-skills`,label:o({id:`w7LRoP`})},...F?[{id:`ai-tools`,label:o({id:`_5qBNl`})}]:[]]},{id:`project`,label:o({id:`ZWyHmq`}),enabled:N,items:[{id:`project-preferences`,label:o({id:`Q6hhn8`}),subsections:[{id:`attachments`,label:o({id:`w_Sphq`}),anchor:`content.attachmentFolderPath`},{id:`content-rules`,label:o({id:`OPOiKn`}),anchor:`section:content-rules`},...L?[{id:`terminal`,label:o({id:`ALhMYW`}),anchor:`section:terminal`}]:[]]},{id:`sync`,label:o({id:`AznQ2V`}),subsections:[{id:`sharing`,label:o({id:`cs4mps`}),anchor:`section:sharing`}]},{id:`search`,label:o({id:`A1taO8`})},{id:`plugins-manage`,label:o({id:`ohUJJM`})},...a?[]:[{id:`link-previews`,label:o({id:`gh27t1`})}],...F?[{id:`project-ai-tools`,label:o({id:`crqzW5`})}]:[],...F?[{id:`network-access`,label:o({id:`RaUKLu`})}]:[],{id:`project-templates`,label:o({id:`iTylMl`})},{id:`skills`,label:o({id:`w7LRoP`})},{id:`okignore`,label:o({id:`3zyg_A`})}]},{id:`plugins`,label:o({id:`ohUJJM`}),enabled:!0,items:[...N?n:[],...r?[{id:`plugin:theme`,label:o({id:`fJ3EbT`})}]:[],...i?[{id:`plugin:slides`,label:o({id:`f14doC`})}]:[]]},{id:`integrations`,label:o({id:`nbfdhU`}),enabled:!0,items:[]}],z=bA({groups:R,translate:o}),t[13]=o,t[14]=m,t[15]=N,t[16]=p?.appearance?.colorThemeEnabled,t[17]=p?.slides?.enabled,t[18]=f?.contentRules,t[19]=R,t[20]=z}else R=t[19],z=t[20];let B=z,V;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(V=function(e){T.current+=1;let t=T.current;v(e.sectionId),e.kind===`field`&&e.targetField?S({path:e.targetField}):e.kind===`rule`&&e.ruleId&&w({query:e.ruleId,nonce:t}),b(``)},t[23]=V):V=t[23];let ee=V,H;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(H=gr(`flex h-[700px] max-h-[calc(100dvh-4rem)] w-[900px] max-w-[calc(100%-2rem)] flex-col gap-0 overflow-hidden p-0 sm:grid sm:grid-cols-[220px_1fr] sm:max-w-[min(900px,calc(100%-2rem))]`,ti()),t[24]=H):H=t[24];let U;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(Jr,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`Tz0i8g`})}),t[25]=U):U=t[25];let W;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Z.jsx)(qr,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`RDrXh4`})}),t[26]=W):W=t[26];let G;t[27]!==_||t[28]!==R||t[29]!==B||t[30]!==y?(G=(0,Z.jsx)(DA,{groups:R,activeId:_,onSelect:v,entries:B,searchQuery:y,onSearchChange:b,onNavigate:ee}),t[27]=_,t[28]=R,t[29]=B,t[30]=y,t[31]=G):G=t[31];let te;t[32]===o?te=t[33]:(te=o({id:`OXb_Df`}),t[32]=o,t[33]=te);let ne;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(FA,{}),t[34]=ne):ne=t[34];let re=l?c:null,K;t[35]!==_||t[36]!==u||t[37]!==d||t[38]!==C||t[39]!==re?(K=(0,Z.jsx)(gA,{children:(0,Z.jsx)(Q.Suspense,{fallback:ne,children:(0,Z.jsx)(pA,{activeId:_,userBinding:re,okignoreBinding:u,okignoreSynced:d,markdownlintRuleQuery:C})})}),t[35]=_,t[36]=u,t[37]=d,t[38]=C,t[39]=re,t[40]=K):K=t[40];let ie;t[41]!==te||t[42]!==K?(ie=(0,Z.jsx)(`section`,{ref:E,"aria-label":te,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain subtle-scrollbar p-6`,tabIndex:0,children:K}),t[41]=te,t[42]=K,t[43]=ie):ie=t[43];let q;t[44]!==G||t[45]!==ie?(q=(0,Z.jsxs)(Yr,{className:H,"data-testid":`settings-dialog`,children:[U,W,G,ie]}),t[44]=G,t[45]=ie,t[46]=q):q=t[46];let ae;return t[47]!==i||t[48]!==n||t[49]!==q?(ae=(0,Z.jsx)(ei,{open:n,onOpenChange:i,children:q}),t[47]=i,t[48]=n,t[49]=q,t[50]=ae):ae=t[50],ae}function EA(e){return{id:`plugin:${e.id}`,label:e.label}}function DA(e){let t=(0,$.c)(46),{groups:n,activeId:r,onSelect:i,entries:a,searchQuery:o,onSearchChange:s,onNavigate:c}=e,{_:l}=Bn(),u,d,f,p,m,h,g,_,v,y;if(t[0]!==l||t[1]!==a||t[2]!==c||t[3]!==s||t[4]!==o){d=o.trim();let e=d===``?[]:a.filter(e=>NS(e.label,d,e.keywords)),n=e.filter(AA),r=e.filter(kA),i=e.filter(OA);t[15]===l?v=t[16]:(v=l({id:`y1t8bQ`}),t[15]=l,t[16]=v),y=`flex shrink-0 gap-x-3 overflow-x-auto overscroll-contain subtle-scrollbar scroll-fade-mask-x-max-sm border-b bg-muted/30 px-3 py-2 max-sm:pt-10 sm:h-full sm:min-h-0 sm:flex-col sm:gap-0 sm:overflow-x-visible sm:border-r sm:border-b-0 sm:py-4`,u=de,f=!1,p=`h-auto w-full shrink-0 bg-transparent sm:mb-3 [&_[data-slot=command-input-wrapper]]:h-9 [&_[data-slot=command-input-wrapper]]:rounded-lg [&_[data-slot=command-input-wrapper]]:border [&_[data-slot=command-input-wrapper]]:border-input`,m=`settings-search`;let b;t[17]===l?b=t[18]:(b=l({id:`1DahsC`}),t[17]=l,t[18]=b),t[19]!==s||t[20]!==o||t[21]!==b?(h=(0,Z.jsx)(Jt,{value:o,onValueChange:s,placeholder:b,className:`py-0`,"data-testid":`settings-search-input`}),t[19]=s,t[20]=o,t[21]=b,t[22]=h):h=t[22];let x=d===``?null:(0,Z.jsx)(Y,{id:`TQJCR6`,values:{0:e.length}});t[23]===x?g=t[24]:(g=(0,Z.jsx)(`span`,{"aria-live":`polite`,className:`sr-only`,"data-testid":`settings-search-result-count`,children:x}),t[23]=x,t[24]=g),_=d===``?null:(0,Z.jsxs)(At,{"data-testid":`settings-search-results`,className:`mt-1.5`,children:[(0,Z.jsx)(mt,{"data-testid":`settings-search-empty`,children:(0,Z.jsx)(Y,{id:`ljFWEt`})}),n.length>0?(0,Z.jsx)(vn,{heading:l({id:`R4OWFD`}),children:n.map(e=>(0,Z.jsx)(jA,{entry:e,query:d,onNavigate:c},e.id))}):null,r.length>0?(0,Z.jsx)(vn,{heading:l({id:`Tz0i8g`}),children:r.map(e=>(0,Z.jsx)(jA,{entry:e,query:d,onNavigate:c},e.id))}):null,i.length>0?(0,Z.jsx)(vn,{heading:l({id:`v2a04T`}),children:i.map(e=>(0,Z.jsx)(jA,{entry:e,query:d,onNavigate:c},e.id))}):null]}),t[0]=l,t[1]=a,t[2]=c,t[3]=s,t[4]=o,t[5]=u,t[6]=d,t[7]=f,t[8]=p,t[9]=m,t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=y}else u=t[5],d=t[6],f=t[7],p=t[8],m=t[9],h=t[10],g=t[11],_=t[12],v=t[13],y=t[14];let b;t[25]!==u||t[26]!==f||t[27]!==p||t[28]!==m||t[29]!==h||t[30]!==g||t[31]!==_?(b=(0,Z.jsxs)(u,{shouldFilter:f,className:p,"data-testid":m,children:[h,g,_]}),t[25]=u,t[26]=f,t[27]=p,t[28]=m,t[29]=h,t[30]=g,t[31]=_,t[32]=b):b=t[32];let x;t[33]!==r||t[34]!==n||t[35]!==i||t[36]!==d?(x=d===``?n.map(e=>(0,Z.jsx)(PA,{group:e,activeId:r,onSelect:i},e.id)):null,t[33]=r,t[34]=n,t[35]=i,t[36]=d,t[37]=x):x=t[37];let S;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(NA,{}),t[38]=S):S=t[38];let C;t[39]===x?C=t[40]:(C=(0,Z.jsxs)(`div`,{className:`contents subtle-scrollbar sm:flex sm:min-h-0 sm:flex-1 sm:flex-col sm:overflow-y-auto sm:overscroll-contain`,children:[x,S]}),t[39]=x,t[40]=C);let w;return t[41]!==C||t[42]!==v||t[43]!==y||t[44]!==b?(w=(0,Z.jsxs)(`nav`,{"aria-label":v,className:y,children:[b,C]}),t[41]=C,t[42]=v,t[43]=y,t[44]=b,t[45]=w):w=t[45],w}function OA(e){return e.kind===`rule`}function kA(e){return e.kind===`field`}function AA(e){return e.kind===`section`}function jA(e){let t=(0,$.c)(16),{entry:n,query:r,onNavigate:i}=e,a=n.id,o;t[0]!==n||t[1]!==i?(o=()=>i(n),t[0]=n,t[1]=i,t[2]=o):o=t[2];let s=`settings-search-result-${n.id}`,c;t[3]!==n.label||t[4]!==r?(c=AS(n.label,r).map(MA),t[3]=n.label,t[4]=r,t[5]=c):c=t[5];let l;t[6]===c?l=t[7]:(l=(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:c}),t[6]=c,t[7]=l);let u;t[8]===n.context?u=t[9]:(u=n.context===void 0?null:(0,Z.jsx)(`span`,{className:`ms-auto shrink-0 truncate ps-3 text-1sm text-muted-foreground`,children:n.context}),t[8]=n.context,t[9]=u);let d;return t[10]!==n.id||t[11]!==o||t[12]!==s||t[13]!==l||t[14]!==u?(d=(0,Z.jsxs)(fn,{value:a,onSelect:o,"data-testid":s,children:[l,u]}),t[10]=n.id,t[11]=o,t[12]=s,t[13]=l,t[14]=u,t[15]=d):d=t[15],d}function MA(e){return e.match?(0,Z.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.text},e.start):(0,Z.jsx)(`span`,{children:e.text},e.start)}function NA(){let e=(0,$.c)(4),t=typeof window<`u`?window.okDesktop??null:null,n=t?.appVersion;if(!t||!n)return null;let r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=xA(n),e[0]=r):r=e[0];let i=r,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`p`,{className:`whitespace-nowrap font-mono text-xs text-muted-foreground/70`,"data-testid":`settings-sidebar-version`,children:[`v`,n]}),e[1]=a):a=e[1];let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{t.shell.openExternal(i)},e[2]=o):o=e[2];let s;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsxs)(`div`,{className:`ml-auto shrink-0 px-2 sm:ml-0 sm:mt-auto sm:pt-3`,children:[a,(0,Z.jsxs)(`button`,{type:`button`,onClick:o,"data-testid":`settings-sidebar-release-notes`,className:gr(`mt-0.5 inline-flex items-center gap-1 whitespace-nowrap rounded text-xs text-muted-foreground transition-colors hover:text-foreground`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`),children:[(0,Z.jsx)(Y,{id:`_PACVa`}),(0,Z.jsx)(ju,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=s):s=e[3],s}function PA(e){let t=(0,$.c)(28),{group:n,activeId:r,onSelect:i}=e;if(n.items.length===0)return null;let a=`settings-group-${n.id}`,o=`${a}-caption`,s=n.enabled?void 0:o,c=n.enabled?`text-muted-foreground/80`:`text-muted-foreground/50`,l;t[0]===c?l=t[1]:(l=gr(`shrink-0 whitespace-nowrap px-2 text-xs font-semibold uppercase tracking-wide font-mono sm:mb-1`,c),t[0]=c,t[1]=l);let u;t[2]!==n.label||t[3]!==a||t[4]!==s||t[5]!==l?(u=(0,Z.jsx)(`h3`,{id:a,"aria-describedby":s,className:l,children:n.label}),t[2]=n.label,t[3]=a,t[4]=s,t[5]=l,t[6]=u):u=t[6];let d;t[7]!==o||t[8]!==n.enabled?(d=n.enabled?null:(0,Z.jsx)(`p`,{id:o,className:`px-2 text-xs italic text-muted-foreground/60 sm:mb-1`,children:(0,Z.jsx)(Y,{id:`JWsZlx`})}),t[7]=o,t[8]=n.enabled,t[9]=d):d=t[9];let f;if(t[10]!==r||t[11]!==o||t[12]!==n.enabled||t[13]!==n.items||t[14]!==i){let e;t[16]!==r||t[17]!==o||t[18]!==n.enabled||t[19]!==i?(e=e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`button`,{type:`button`,"aria-current":r===e.id?`page`:void 0,"aria-disabled":n.enabled?void 0:!0,"aria-describedby":n.enabled?void 0:o,tabIndex:n.enabled?0:-1,disabled:!n.enabled,onClick:()=>n.enabled&&i(e.id),"data-testid":`settings-sidebar-item-${e.id}`,className:gr(`w-auto whitespace-nowrap rounded px-2 py-1.5 text-left text-sm transition-colors sm:w-full`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`,r===e.id&&n.enabled?`bg-accent text-accent-foreground`:`hover:bg-accent/50`),children:e.label})},e.id),t[16]=r,t[17]=o,t[18]=n.enabled,t[19]=i,t[20]=e):e=t[20],f=n.items.map(e),t[10]=r,t[11]=o,t[12]=n.enabled,t[13]=n.items,t[14]=i,t[15]=f}else f=t[15];let p;t[21]!==a||t[22]!==f?(p=(0,Z.jsx)(`ul`,{"aria-labelledby":a,className:`flex gap-1 sm:block sm:space-y-0.5`,children:f}),t[21]=a,t[22]=f,t[23]=p):p=t[23];let m;return t[24]!==u||t[25]!==d||t[26]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:mb-4 sm:block`,children:[u,d,p]}),t[24]=u,t[25]=d,t[26]=p,t[27]=m):m=t[27],m}function FA(){let e=(0,$.c)(4),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`GsBUCk`})}),n=(0,Z.jsx)(tg,{className:`h-5 w-32`}),r=(0,Z.jsx)(tg,{className:`h-4 w-64`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,className:`space-y-3`,"data-testid":`settings-content-skeleton`,children:[t,n,r,(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(tg,{className:`h-9 w-full`}),(0,Z.jsx)(tg,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function IA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`flex h-full w-full aria-[orientation=vertical]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(sO,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function LA(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(dO,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function RA(e){let t=(0,$.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({withHandle:a,className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=gr(`relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,r),t[5]=r,t[6]=o);let s;t[7]===a?s=t[8]:(s=a&&(0,Z.jsx)(`div`,{className:`z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border`}),t[7]=a,t[8]=s);let c;return t[9]!==n||t[10]!==i||t[11]!==o||t[12]!==s?(c=(0,Z.jsxs)(hO,{"data-slot":`resizable-handle`,className:o,...i,children:[s,n]}),t[9]=n,t[10]=i,t[11]=o,t[12]=s,t[13]=c):c=t[13],c}function zA(e){let t=(0,$.c)(119),{findInputRef:n,query:r,replacement:i,replaceOpen:a,caseSensitive:o,wholeWord:s,current:c,total:l,onQueryChange:u,onReplacementChange:d,onReplaceOpenChange:f,onCaseSensitiveChange:p,onWholeWordChange:m,onNext:h,onPrevious:g,onReplaceCurrent:_,onReplaceAll:v,onClose:y}=e,{_:b}=Bn(),x=r.length>0,S=l>0,C;t[0]!==b||t[1]!==c||t[2]!==S||t[3]!==x||t[4]!==l?(C=x?S?`${c} / ${l}`:b({id:`Ev2r9A`}):``,t[0]=b,t[1]=c,t[2]=S,t[3]=x,t[4]=l,t[5]=C):C=t[5];let w=C,T;t[6]!==y||t[7]!==h||t[8]!==g?(T=function(e){e.key===`Enter`?(e.preventDefault(),e.shiftKey?g():h()):e.key===`Escape`&&(e.preventDefault(),y())},t[6]=y,t[7]=h,t[8]=g,t[9]=T):T=t[9];let E=T,D;t[10]!==y||t[11]!==_?(D=function(e){e.key===`Enter`?(e.preventDefault(),_()):e.key===`Escape`&&(e.preventDefault(),y())},t[10]=y,t[11]=_,t[12]=D):D=t[12];let O=D,k;t[13]===b?k=t[14]:(k=b({id:`MVxpbf`}),t[13]=b,t[14]=k);let A;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-find-input`,children:(0,Z.jsx)(Y,{id:`KujtjC`})}),t[15]=A):A=t[15];let j;t[16]===u?j=t[17]:(j=e=>u(e.target.value),t[16]=u,t[17]=j);let M;t[18]===b?M=t[19]:(M=b({id:`KujtjC`}),t[18]=b,t[19]=M);let N;t[20]!==n||t[21]!==E||t[22]!==r||t[23]!==j||t[24]!==M?(N=(0,Z.jsx)(Hg,{ref:n,id:`ok-find-input`,value:r,onChange:j,onKeyDown:E,placeholder:M,autoComplete:`off`,spellCheck:!1,className:`h-7 px-2 text-sm`}),t[20]=n,t[21]=E,t[22]=r,t[23]=j,t[24]=M,t[25]=N):N=t[25];let P;t[26]===b?P=t[27]:(P=b({id:`-8PP0T`}),t[26]=b,t[27]=P);let F;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(Hu,{"aria-hidden":`true`}),t[28]=F):F=t[28];let I;t[29]!==o||t[30]!==p||t[31]!==P?(I=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(za,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":P,pressed:o,onPressedChange:p,className:`size-6 min-w-6 px-0`,children:F})}),t[29]=o,t[30]=p,t[31]=P,t[32]=I):I=t[32];let L;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(Vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`-8PP0T`})}),t[33]=L):L=t[33];let R;t[34]===I?R=t[35]:(R=(0,Z.jsxs)(Ur,{children:[I,L]}),t[34]=I,t[35]=R);let z;t[36]===b?z=t[37]:(z=b({id:`_7UQ7y`}),t[36]=b,t[37]=z);let B;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(Hb,{"aria-hidden":`true`}),t[38]=B):B=t[38];let V;t[39]!==m||t[40]!==z||t[41]!==s?(V=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(za,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":z,pressed:s,onPressedChange:m,className:`size-6 min-w-6 px-0`,children:B})}),t[39]=m,t[40]=z,t[41]=s,t[42]=V):V=t[42];let ee;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(Vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`_7UQ7y`})}),t[43]=ee):ee=t[43];let H;t[44]===V?H=t[45]:(H=(0,Z.jsxs)(Ur,{children:[V,ee]}),t[44]=V,t[45]=H);let U;t[46]!==R||t[47]!==H?(U=(0,Z.jsxs)(Vg,{align:`inline-end`,className:`gap-0.5`,children:[R,H]}),t[46]=R,t[47]=H,t[48]=U):U=t[48];let W;t[49]!==U||t[50]!==N?(W=(0,Z.jsxs)(Ug,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[N,U]}),t[49]=U,t[50]=N,t[51]=W):W=t[51];let G;t[52]===w?G=t[53]:(G=(0,Z.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`min-w-14 px-1 text-right text-muted-foreground text-xs tabular-nums shrink-0`,children:w}),t[52]=w,t[53]=G);let te;t[54]===b?te=t[55]:(te=b({id:`oqB2ez`}),t[54]=b,t[55]=te);let ne=!S,re;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(Sa,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=re):re=t[56];let K;t[57]!==g||t[58]!==te||t[59]!==ne?(K=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":te,disabled:ne,onClick:g,children:re})}),t[57]=g,t[58]=te,t[59]=ne,t[60]=K):K=t[60];let ie;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Z.jsx)(Vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`oqB2ez`})}),t[61]=ie):ie=t[61];let q;t[62]===K?q=t[63]:(q=(0,Z.jsxs)(Ur,{children:[K,ie]}),t[62]=K,t[63]=q);let ae;t[64]===b?ae=t[65]:(ae=b({id:`SiUUCS`}),t[64]=b,t[65]=ae);let oe=!S,se;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(Gu,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=se):se=t[66];let ce;t[67]!==h||t[68]!==ae||t[69]!==oe?(ce=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ae,disabled:oe,onClick:h,children:se})}),t[67]=h,t[68]=ae,t[69]=oe,t[70]=ce):ce=t[70];let le;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(Vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`SiUUCS`})}),t[71]=le):le=t[71];let ue;t[72]===ce?ue=t[73]:(ue=(0,Z.jsxs)(Ur,{children:[ce,le]}),t[72]=ce,t[73]=ue);let de=a?`secondary`:`ghost`,fe;t[74]!==b||t[75]!==a?(fe=b(a?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=b,t[75]=a,t[76]=fe):fe=t[76];let pe=a?`ok-replace-input`:void 0,J;t[77]!==f||t[78]!==a?(J=()=>f(!a),t[77]=f,t[78]=a,t[79]=J):J=t[79];let me;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsx)(yb,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=me):me=t[80];let he;t[81]!==a||t[82]!==de||t[83]!==fe||t[84]!==pe||t[85]!==J?(he=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:de,size:`icon-sm`,"aria-label":fe,"aria-expanded":a,"aria-controls":pe,onClick:J,children:me})}),t[81]=a,t[82]=de,t[83]=fe,t[84]=pe,t[85]=J,t[86]=he):he=t[86];let ge;t[87]===a?ge=t[88]:(ge=(0,Z.jsx)(Vr,{side:`bottom`,children:a?(0,Z.jsx)(Y,{id:`UkQGhd`}):(0,Z.jsx)(Y,{id:`1RluQD`})}),t[87]=a,t[88]=ge);let _e;t[89]!==he||t[90]!==ge?(_e=(0,Z.jsxs)(Ur,{children:[he,ge]}),t[89]=he,t[90]=ge,t[91]=_e):_e=t[91];let ve;t[92]!==b||t[93]!==O||t[94]!==S||t[95]!==v||t[96]!==_||t[97]!==d||t[98]!==a||t[99]!==i?(ve=a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-replace-input`,children:(0,Z.jsx)(Y,{id:`fqSfXY`})}),(0,Z.jsx)(dh,{id:`ok-replace-input`,value:i,onChange:e=>d(e.target.value),onKeyDown:O,placeholder:b({id:`fqSfXY`}),autoComplete:`off`,spellCheck:!1,className:`h-7 w-48 rounded-[min(var(--radius-md),12px)] px-2 text-sm shadow-none focus-visible:ring-2`}),(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b({id:`bS_boY`}),disabled:!S,onClick:_,children:(0,Z.jsx)(yb,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`bS_boY`})})]}),(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b({id:`dr1vFs`}),disabled:!S,onClick:v,children:(0,Z.jsx)(vb,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`dr1vFs`})})]})]}):null,t[92]=b,t[93]=O,t[94]=S,t[95]=v,t[96]=_,t[97]=d,t[98]=a,t[99]=i,t[100]=ve):ve=t[100];let ye;t[101]===b?ye=t[102]:(ye=b({id:`wJo9oS`}),t[101]=b,t[102]=ye);let be;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(zp,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=be):be=t[103];let xe;t[104]!==y||t[105]!==ye?(xe=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ye,onClick:y,children:be})}),t[104]=y,t[105]=ye,t[106]=xe):xe=t[106];let Se;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsx)(Vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`yz7wBu`})}),t[107]=Se):Se=t[107];let Ce;t[108]===xe?Ce=t[109]:(Ce=(0,Z.jsxs)(Ur,{children:[xe,Se]}),t[108]=xe,t[109]=Ce);let we;return t[110]!==W||t[111]!==G||t[112]!==q||t[113]!==ue||t[114]!==k||t[115]!==_e||t[116]!==ve||t[117]!==Ce?(we=(0,Z.jsxs)(`search`,{"data-testid":`find-replace-bar`,"aria-label":k,className:`pointer-events-auto flex max-w-[min(calc(100vw-1rem),720px)] touch-manipulation items-center gap-1 rounded-[calc(var(--radius)+2px)] border border-input bg-popover/95 p-1 text-popover-foreground shadow-md shadow-black/10 backdrop-blur`,children:[A,W,G,q,ue,_e,ve,Ce]}),t[110]=W,t[111]=G,t[112]=q,t[113]=ue,t[114]=k,t[115]=_e,t[116]=ve,t[117]=Ce,t[118]=we):we=t[118],we}var BA={current:0,total:0},VA=120,HA=100;function UA(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?O(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(R,n,WA)}function WA(){return null}function GA(e){if(!e||e.isDestroyed)return null;let{from:t,to:n,empty:r}=e.state.selection;if(r)return null;let i=e.state.doc.textBetween(t,n,`
5
5
  `,`
6
6
  `).trim();return i.length===0||i.length>VA||i.includes(`
7
7
  `)?null:i}function KA(e){let t=E(e.state);return{current:t.matches.length===0?0:t.activeIndex+1,total:t.matches.length}}function qA(e,t){return e.current===t.current&&e.total===t.total}function JA(e,t,n){e&&!e.isDestroyed&&(e.commands.clearFindMatches(),e.commands.focus()),t(e=>({...e,open:!1,activeIndex:0})),n(BA)}function YA(e){!e||e.isDestroyed||typeof window>`u`||window.requestAnimationFrame(()=>{if(e.isDestroyed)return;let t=Li(e);if(!t)return;let n=t.dom.querySelector(`.ok-find-match-active`);n instanceof HTMLElement&&n.scrollIntoView({block:`center`,inline:`nearest`,behavior:`auto`})})}function XA(e){let t=(0,$.c)(81),{activeDocName:n,isSourceMode:r}=e,i=UA(n),a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),s=(0,Q.useRef)(n),c=(0,Q.useRef)(0),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l={open:!1,replaceOpen:!1,query:``,replacement:``,caseSensitive:!1,wholeWord:!1,activeIndex:0},t[0]=l):l=t[0];let[u,d]=(0,Q.useState)(l),[f,p]=(0,Q.useState)(BA),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{s.current!==n&&(s.current=n,d(QA))},h=[n],t[1]=n,t[2]=m,t[3]=h),(0,Q.useEffect)(m,h);let g,_;t[4]===u.activeIndex?(g=t[5],_=t[6]):(g=()=>{c.current=u.activeIndex},_=[u.activeIndex],t[4]=u.activeIndex,t[5]=g,t[6]=_),(0,Q.useEffect)(g,_);let v,y;t[7]===i?(v=t[8],y=t[9]):(v=()=>{let e=o.current;e&&e!==i&&!e.isDestroyed&&e.commands.clearFindMatches(),o.current=i},y=[i],t[7]=i,t[8]=v,t[9]=y),(0,Q.useEffect)(v,y);let b,x;t[10]===u.open?(b=t[11],x=t[12]):(b=()=>{if(!u.open||!a.current)return;let e=requestAnimationFrame(()=>{a.current?.focus(),a.current?.select()});return()=>cancelAnimationFrame(e)},x=[u.open],t[10]=u.open,t[11]=b,t[12]=x),(0,Q.useEffect)(b,x);let S,C;t[13]!==u.open||t[14]!==r?(S=()=>{!u.open||!r||d(ZA)},C=[u.open,r],t[13]=u.open,t[14]=r,t[15]=S,t[16]=C):(S=t[15],C=t[16]),(0,Q.useEffect)(S,C);let w,T;t[17]!==i||t[18]!==u.caseSensitive||t[19]!==u.open||t[20]!==u.query||t[21]!==u.wholeWord||t[22]!==r?(w=()=>{if(!i||i.isDestroyed){p(BA);return}if(!u.open||r){i.commands.clearFindMatches(),p(BA);return}let e=window.setTimeout(()=>{if(i.isDestroyed)return;i.commands.setFindQuery(u.query,{options:{caseSensitive:u.caseSensitive,wholeWord:u.wholeWord},activeIndex:c.current});let e=KA(i);p(t=>qA(t,e)?t:e)},HA);return()=>window.clearTimeout(e)},T=[i,u.open,u.query,u.caseSensitive,u.wholeWord,r],t[17]=i,t[18]=u.caseSensitive,t[19]=u.open,t[20]=u.query,t[21]=u.wholeWord,t[22]=r,t[23]=w,t[24]=T):(w=t[23],T=t[24]),(0,Q.useEffect)(w,T);let D,O;t[25]!==i||t[26]!==u.open||t[27]!==r?(D=()=>{if(!i||i.isDestroyed||!u.open||r)return;let e=()=>{let e=E(i.state),t=KA(i);p(e=>qA(e,t)?e:t),d(t=>t.activeIndex===e.activeIndex?t:{...t,activeIndex:e.activeIndex})};return i.on(`transaction`,e),()=>{i.off(`transaction`,e)}},O=[i,u.open,r],t[25]=i,t[26]=u.open,t[27]=r,t[28]=D,t[29]=O):(D=t[28],O=t[29]),(0,Q.useEffect)(D,O);let k,A;t[30]!==n||t[31]!==i||t[32]!==u.open||t[33]!==r?(k=()=>{let e=function(e){let t=GA(i);d(n=>({...n,open:!0,replaceOpen:e,query:t??n.query,activeIndex:0}))},t=function(t){if(!(!n||r||t.defaultPrevented)&&!Mr()){if(Mc(t,`find`)){t.preventDefault(),u.open?JA(i,d,p):e(!1);return}if(Mc(t,`replace`)){t.preventDefault(),e(!0);return}if(u.open){let e=Mc(t,`find-next`),n=Mc(t,`find-previous`);if(e||n){t.preventDefault(),(n?i?.commands.selectPreviousFindMatch():i?.commands.selectNextFindMatch())&&YA(i);return}}t.key===`Escape`&&u.open&&(t.preventDefault(),JA(i,d,p))}};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},A=[n,i,u.open,r],t[30]=n,t[31]=i,t[32]=u.open,t[33]=r,t[34]=k,t[35]=A):(k=t[34],A=t[35]),(0,Q.useEffect)(k,A);let j;t[36]!==i||t[37]!==u.caseSensitive||t[38]!==u.query||t[39]!==u.wholeWord?(j=function(){return!i||i.isDestroyed?!1:(i.commands.setFindQuery(u.query,{options:{caseSensitive:u.caseSensitive,wholeWord:u.wholeWord},activeIndex:c.current}),!0)},t[36]=i,t[37]=u.caseSensitive,t[38]=u.query,t[39]=u.wholeWord,t[40]=j):j=t[40];let M=j,N;t[41]===i?N=t[42]:(N=function(){if(!i||i.isDestroyed)return;let e=E(i.state),t=KA(i);p(e=>qA(e,t)?e:t),d(t=>t.activeIndex===e.activeIndex?t:{...t,activeIndex:e.activeIndex})},t[41]=i,t[42]=N);let P=N,F;t[43]===i?F=t[44]:(F=function(){JA(i,d,p)},t[43]=i,t[44]=F);let I=F,L;t[45]!==M||t[46]!==i||t[47]!==P?(L=function(){!i||i.isDestroyed||(M(),i.commands.selectNextFindMatch()&&YA(i),P())},t[45]=M,t[46]=i,t[47]=P,t[48]=L):L=t[48];let R=L,z;t[49]!==M||t[50]!==i||t[51]!==P?(z=function(){!i||i.isDestroyed||(M(),i.commands.selectPreviousFindMatch()&&YA(i),P())},t[49]=M,t[50]=i,t[51]=P,t[52]=z):z=t[52];let B=z,V;t[53]!==M||t[54]!==i||t[55]!==u.replacement||t[56]!==P?(V=function(){!i||i.isDestroyed||(M(),i.commands.replaceCurrentFindMatch(u.replacement)&&YA(i),P())},t[53]=M,t[54]=i,t[55]=u.replacement,t[56]=P,t[57]=V):V=t[57];let ee=V,H;t[58]!==M||t[59]!==i||t[60]!==u.replacement||t[61]!==P?(H=function(){!i||i.isDestroyed||(M(),i.commands.replaceAllFindMatches(u.replacement)&&YA(i),P())},t[58]=M,t[59]=i,t[60]=u.replacement,t[61]=P,t[62]=H):H=t[62];let U=H;if(!u.open||!n||r)return null;let W,G,te,ne,re;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(W=e=>d(t=>({...t,query:e,activeIndex:0})),G=e=>d(t=>({...t,replacement:e})),te=e=>d(t=>({...t,replaceOpen:e})),ne=e=>d(t=>({...t,caseSensitive:e})),re=e=>d(t=>({...t,wholeWord:e})),t[63]=W,t[64]=G,t[65]=te,t[66]=ne,t[67]=re):(W=t[63],G=t[64],te=t[65],ne=t[66],re=t[67]);let K;return t[68]!==I||t[69]!==u.caseSensitive||t[70]!==u.query||t[71]!==u.replaceOpen||t[72]!==u.replacement||t[73]!==u.wholeWord||t[74]!==f.current||t[75]!==f.total||t[76]!==U||t[77]!==ee||t[78]!==R||t[79]!==B?(K=(0,Z.jsx)(`div`,{className:`editor-content-aligned pointer-events-none absolute inset-x-0 top-2 z-30 px-2`,children:(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(zA,{findInputRef:a,query:u.query,replacement:u.replacement,replaceOpen:u.replaceOpen,caseSensitive:u.caseSensitive,wholeWord:u.wholeWord,current:f.current,total:f.total,onQueryChange:W,onReplacementChange:G,onReplaceOpenChange:te,onCaseSensitiveChange:ne,onWholeWordChange:re,onNext:R,onPrevious:B,onReplaceCurrent:ee,onReplaceAll:U,onClose:I})})}),t[68]=I,t[69]=u.caseSensitive,t[70]=u.query,t[71]=u.replaceOpen,t[72]=u.replacement,t[73]=u.wholeWord,t[74]=f.current,t[75]=f.total,t[76]=U,t[77]=ee,t[78]=R,t[79]=B,t[80]=K):K=t[80],K}function ZA(e){return{...e,open:!1,activeIndex:0}}function QA(e){return{...e,activeIndex:0}}var $A=300;function ej(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(xd),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(xd);return}let n=e.document.getText(`source`),r=yo(t)?gd:ud,a=!1,o=null,s=function(){a||i(r(n.toString()))};s();let c=function(){o&&clearTimeout(o),o=setTimeout(s,$A)};return n.observe(c),()=>{a=!0,n.unobserve(c),o&&clearTimeout(o)}},o=[e,t],n[0]=t,n[1]=e,n[2]=a,n[3]=o):(a=n[2],o=n[3]),(0,Q.useEffect)(a,o),r}function tj(e){return e&&e.document.getMap(`lifecycle`).get(`status`)===`conflict`?`conflict`:null}function nj(e){let t=(0,$.c)(8),{poolEntries:n}=Et(),r;t[0]!==e||t[1]!==n?(r=e?n.find(t=>t.docName===e)??null:null,t[0]=e,t[1]=n,t[2]=r):r=t[2];let i=r?.provider??null,a;t[3]===i?a=t[4]:(a=()=>tj(i),t[3]=i,t[4]=a);let[o,s]=(0,Q.useState)(a),c,l;return t[5]===i?(c=t[6],l=t[7]):(c=()=>{if(!i){s(null);return}let e=i.document.getMap(`lifecycle`);s(tj(i));let t=()=>s(tj(i));return e.observe(t),()=>{e.unobserve(t)}},l=[i],t[5]=i,t[6]=c,t[7]=l),(0,Q.useEffect)(c,l),o}function rj(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=()=>_d(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2],(0,Q.useSyncExternalStore)(vd,r)}var ij=`ok-terminal-width-v1`;function aj(e){return Number.isFinite(e)?e<320?320:Math.round(e):480}function oj(e){try{let t=(e??localStorage).getItem(ij);if(t==null)return 480;let n=Number.parseInt(t,10);return Number.isFinite(n)?aj(n):480}catch{return 480}}function sj(e,t){try{(t??localStorage).setItem(ij,String(aj(e)))}catch{}}function cj(){try{return typeof localStorage>`u`?480:oj()}catch{return 480}}var lj=`ok-doc-panel-width-v1`;function uj(e){return Number.isFinite(e)?e<300?300:e>600?600:Math.round(e):320}function dj(e){try{let t=(e??localStorage).getItem(lj);if(t==null)return 320;let n=Number.parseInt(t,10);return Number.isFinite(n)?uj(n):320}catch{return 320}}function fj(e,t){try{(t??localStorage).setItem(lj,String(uj(e)))}catch{}}function pj(){try{return typeof localStorage>`u`?320:dj()}catch{return 320}}var mj=1024,hj=1280,gj={left:mj,right:hj};function _j(e,t,n){return e==null?t>=gj[n]?`above`:`below`:`embedded`}function vj(e){return e===`above`?`open`:`collapsed`}var yj=`ok-sidebar-pins-v2`;function bj(e){return e===`open`||e===`collapsed`}function xj(e){return e===`above`||e===`below`||e===`embedded`}function Sj(e){if(typeof e!=`object`||!e)return!1;let t=e;for(let e of Object.keys(t))if(!xj(e)||!bj(t[e]))return!1;return!0}function Cj(e){let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n=t,r={};return Sj(n.left)&&(r.left=n.left),Sj(n.right)&&(r.right=n.right),r}function wj(e){try{let t=(e??localStorage).getItem(yj);return t==null?{}:Cj(t)}catch{return{}}}function Tj(e,t){try{t.setItem(yj,JSON.stringify(e))}catch{}}function Ej(e,t,n){return n[e]?.[t]??vj(t)}function Dj(e,t,n,r){let i=r??localStorage,a=wj(i);return a[e]={...a[e],[t]:n},Tj(a,i),a}var Oj=`ok-onboarding-card-v1`,kj={initialized:!1,steps:{file:!1,askedAi:!1},fileBaseline:0,dismissed:!1,completed:!1};function Aj(e){return e===!0}function jj(e){if(typeof e!=`object`||!e)return kj;let t=e,n=typeof t.steps==`object`&&t.steps!==null?t.steps:{};return{initialized:Aj(t.initialized),steps:{file:Aj(n.file),askedAi:Aj(n.askedAi)},fileBaseline:typeof t.fileBaseline==`number`&&Number.isFinite(t.fileBaseline)&&t.fileBaseline>=0?t.fileBaseline:0,dismissed:Aj(t.dismissed),completed:Aj(t.completed)}}function Mj(e){try{let t=(e??localStorage).getItem(Oj);return t==null?kj:jj(JSON.parse(t))}catch(e){return console.warn(`[onboarding-card-store] readPersistedState failed (corrupt/privacy/SSR)`,e),kj}}function Nj(e,t){try{(t??localStorage).setItem(Oj,JSON.stringify(e))}catch(e){console.warn(`[onboarding-card-store] writePersistedState failed (quota/privacy/SSR)`,e)}}function Pj(e){let t=Mj(e),n=new Set,r=!1;function i(){for(let e of n)e()}function a(n){t=n,Nj(t,e),i()}return{getSnapshot(){return t},subscribe(e){return n.add(e),()=>{n.delete(e)}},activate(e=0){t.initialized||a({...t,initialized:!0,fileBaseline:e})},markStepComplete(e){t.steps[e]||a({...t,steps:{...t.steps,[e]:!0}})},dismiss(){t.dismissed||a({...t,dismissed:!0})},markCompleted(){t.completed||a({...t,completed:!0})},install(){r||(r=!0,t=Mj(e),i())}}}var Fj=Pj();function Ij(e){let t=e===void 0?Fj:e;return(0,Q.useSyncExternalStore)(t.subscribe,t.getSnapshot,t.getSnapshot)}function Lj(){Fj.install()}function Rj(e){return vm(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}async function zj(){let e=await fetch(`/api/documents`);if(!e.ok)throw Error(`documents request failed: ${e.status}`);let t=await e.json(),n=Ho.safeParse(t);if(!n.success)throw Error(`documents response did not match schema`,{cause:n.error});return Rj(n.data.documents)}async function Bj(e=Fj){let t=e.getSnapshot();if(!(t.steps.file||!t.initialized))try{await zj()>t.fileBaseline&&e.markStepComplete(`file`)}catch(e){console.warn(`[onboarding-signals] file-step count read failed; leaving step incomplete`,e)}}function Vj(e=Fj){e.getSnapshot().initialized&&e.markStepComplete(`askedAi`)}var Hj=`open-knowledge:open-ask-ai-composer`;function Uj(e=typeof window>`u`?new EventTarget:window){e.dispatchEvent(new CustomEvent(Hj))}function Wj(e,t=typeof window>`u`?new EventTarget:window){let n=()=>e();return t.addEventListener(Hj,n),()=>t.removeEventListener(Hj,n)}var Gj=5200,Kj=500,qj=/\.(md|mdx)$/i;function Jj(e,t){return qj.test(e)?e:t?`${e}${t}`:hu(e)}function Yj(e){return qj.test(e)?e.replace(qj,``):null}function Xj(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function Zj(e,t){let n=(0,$.c)(9),[r,i]=(0,Q.useState)(0),[a,o]=(0,Q.useState)(!0),s,c;if(n[0]!==t||n[1]!==a?(s=()=>{if(!t)return;if(a){let e=setTimeout(()=>o(!1),Gj);return()=>clearTimeout(e)}let e=setTimeout(()=>{i(Qj),o(!0)},Kj);return()=>clearTimeout(e)},c=[a,t],n[0]=t,n[1]=a,n[2]=s,n[3]=c):(s=n[2],c=n[3]),(0,Q.useEffect)(s,c),!t){let t=e[0]??``,r;return n[4]===t?r=n[5]:(r={text:t,visible:!0},n[4]=t,n[5]=r),r}let l=e[e.length>0?r%e.length:0]??``,u;return n[6]!==l||n[7]!==a?(u={text:l,visible:a},n[6]=l,n[7]=a,n[8]=u):u=n[8],u}function Qj(e){return e+1}function $j(e){let t=(0,$.c)(105),{docName:n,surface:r,folderPath:i,dismissed:a,onDismiss:o,onReopen:s}=e,c=a===void 0?!1:a,{_:u}=Bn(),d=i!==void 0,f=d?null:n??null,p=r??`wysiwyg`,m=ku(),h=gu(),{pageMeta:g}=Nd(),{states:_,refresh:v}=Sr(),y=Wa(),{dispatch:b}=Ll(),x=jr(),[S]=(0,Q.useState)(fM),[C,w]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(!0),[D,k]=(0,Q.useState)(!1),A=(0,Q.useRef)(null),j=(0,Q.useRef)(null),[M]=(0,Q.useState)(dM),N,P;t[0]!==c||t[1]!==n||t[2]!==d||t[3]!==r?(N=()=>{if(d||n==null)return;let e=document.documentElement,t=()=>{if(Ft(n))return;let e=[...document.querySelectorAll(`.editor-doc-scroll`)].filter(uM);if(e.length===0)return;let t=!1,r=()=>{t=!0};window.addEventListener(`wheel`,r,{passive:!0}),window.addEventListener(`touchstart`,r,{passive:!0});let i=performance.now(),a=()=>{if(Ft(n)&&(t=!0),t||performance.now()-i>=300){window.removeEventListener(`wheel`,r),window.removeEventListener(`touchstart`,r);return}for(let t of e)t.scrollTop=t.scrollHeight-t.clientHeight;requestAnimationFrame(a)};requestAnimationFrame(a)},i=()=>{r===`wysiwyg`&&requestAnimationFrame(()=>{if(Ft(n))return;let e=O(n),t=j.current;if(!(!e||e.isDestroyed||!t))try{let n=e.view,r=n.coordsAtPos(e.state.selection.head).bottom-(t.getBoundingClientRect().top-28);if(r<=0)return;let i=n.dom.closest(`.editor-doc-scroll`);i instanceof HTMLElement&&(i.scrollTop+=r)}catch{}})},a=j.current;if(c||!a){t(),e.style.removeProperty(`--ask-composer-height`);return}let o=()=>{t(),e.style.setProperty(`--ask-composer-height`,`${a.offsetHeight+56}px`)};o(),i();let s=new ResizeObserver(o);return s.observe(a),()=>{s.disconnect(),t(),e.style.removeProperty(`--ask-composer-height`)}},P=[c,r,n,d],t[0]=c,t[1]=n,t[2]=d,t[3]=r,t[4]=N,t[5]=P):(N=t[4],P=t[5]),(0,Q.useEffect)(N,P);let F=(0,Q.useRef)(c),I=(0,Q.useRef)(s),L;t[6]!==c||t[7]!==s?(L=()=>{F.current=c,I.current=s},t[6]=c,t[7]=s,t[8]=L):L=t[8],(0,Q.useEffect)(L);let R,B;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(R=()=>Wj(()=>{F.current?I.current?.():A.current?.focus()}),B=[],t[9]=R,t[10]=B):(R=t[9],B=t[10]),(0,Q.useEffect)(R,B);let V;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(V=[],t[11]=V):V=t[11],(0,Q.useEffect)(cM,V);let ee=(0,Q.useRef)(c),H,U;t[12]===c?(H=t[13],U=t[14]):(H=()=>{let e=ee.current;ee.current=c,e&&!c&&A.current?.focus()},U=[c],t[12]=c,t[13]=H,t[14]=U),(0,Q.useEffect)(H,U);let W;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(W=[],t[15]=W):W=t[15];let[G,te]=(0,Q.useState)(W),[ne,re]=(0,Q.useState)(sM),K=wp(),ie=pp(),[q,ae]=(0,Q.useState)(!0),oe=K>0&&q,se;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(se=[],t[16]=se):se=t[16];let[ce,le]=(0,Q.useState)(se),ue;t[17]!==n||t[18]!==d||t[19]!==g?(ue=d||n==null?``:Jj(n,g.get(n)?.docExt),t[17]=n,t[18]=d,t[19]=g,t[20]=ue):ue=t[20];let de=ue,fe,pe;t[21]!==de||t[22]!==ne||t[23]!==d||t[24]!==T?(fe=()=>{d||T||te(e=>{if(ne.has(de))return e;let t=Yj(de),n=t===null?e:e.filter(e=>e===de||Yj(e)!==t);return n.includes(de)?n.length===e.length?e:n:[...n,de]})},pe=[d,T,de,ne],t[21]=de,t[22]=ne,t[23]=d,t[24]=T,t[25]=fe,t[26]=pe):(fe=t[25],pe=t[26]),(0,Q.useEffect)(fe,pe);let J=d?i&&!ne.has(i)&&!ce.includes(i)?[i]:[]:G.filter(e=>!ne.has(e)&&!ce.includes(e)),me=jf(f,p),he=jf(f,`frontmatter`),[ge,_e]=(0,Q.useState)(null),[ve,ye]=(0,Q.useState)(!1),be,xe;t[27]===me?(be=t[28],xe=t[29]):(be=()=>{me&&_e(me)},xe=[me],t[27]=me,t[28]=be,t[29]=xe),(0,Q.useEffect)(be,xe);let Se,Ce;t[30]===he?(Se=t[31],Ce=t[32]):(Se=()=>{he&&_e(he)},Ce=[he],t[30]=he,t[31]=Se,t[32]=Ce),(0,Q.useEffect)(Se,Ce);let we,Te;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(we=()=>z(()=>{_e(null),ye(!1),ae(!0)}),Te=[],t[33]=we,t[34]=Te):(we=t[33],Te=t[34]),(0,Q.useEffect)(we,Te);let Ee=Za(),De=Ua(),Oe;t[35]===y?Oe=t[36]:(Oe=e=>Ha(y,e.source,e.id,!0,e.supported),t[35]=y,t[36]=Oe);let ke=De.filter(Oe),Ae=Ga(ke,Ee),je;t[37]===x?.installedClis?je=t[38]:(je=x?.installedClis??{},t[37]=x?.installedClis,t[38]=je);let Me=wl({sticky:C??S,effectiveThreadAgent:Ae,enabledClis:x===null?[]:Dl(y,x.installedClis),enabledDesktopTargets:Ml(y,_),unresolvedDesktopTargets:Sl(y,_),installedClis:je,terminalAvailable:x!==null,threadsAvailable:!0,desktopSelectable:!0}),Ne=Me.kind===`thread`,Pe=Me.kind===`cli`?Me.cli:null,Fe=Pe!==null,Ie=Me.kind===`desktop`?qa.find(e=>e.id===Me.target)??null:null,Le=!D&&(!T||ge!==null||oe)&&(Fe||Ie!==null||Ne),Re;t[39]!==y||t[40]!==_?(Re=qa.filter(e=>Ka(y,e.id,_[e.id]?.installed)),t[39]=y,t[40]=_,t[41]=Re):Re=t[41];let ze=Re,Be;t[42]===_?Be=t[43]:(Be=qa.some(e=>_[e.id]?.installed==null),t[42]=_,t[43]=Be);let Ve=Be,He=x===null?void 0:Dl(y,x.installedClis).map(e=>{let{displayName:t}=ao[e];return{cli:e,label:t,ariaLabel:u({id:`QYfQdv`,values:{displayName:t}}),selected:Pe===e,onSelect:()=>qe(e)}}),Ue;t[44]!==u||t[45]!==oe?(Ue=oe?[u({id:`NeQ_0G`})]:[u({id:`KYSocE`}),u({id:`7Ongq0`}),u({id:`HPTPGr`}),u({id:`qiRoLb`})],t[44]=u,t[45]=oe,t[46]=Ue):Ue=t[46];let We=Zj(Ue,!m&&T&&!c&&!oe),Ge;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=e=>{w(e.id),Tl(e.id)},t[47]=Ge):Ge=t[47];let Ke=Ge,qe=e=>{let t=Nl(e);w(t),Tl(t)},Je;if(t[48]===Symbol.for(`react.memo_cache_sentinel`)){let e=()=>{w(Ol),Tl(Ol)};Je=t=>{Va(t),e()},t[48]=Je}else Je=t[48];let Ye=Je,Xe=()=>{A.current?.clear(),_e(null),ye(!1),te([]),re(new Set),ae(!0),Da()},Ze=async(e,t)=>{let n=t===void 0?!0:t,r=()=>{n&&Xe()};if(e===null)return Dc.error(u({id:`y8B54M`})),!1;if(Ne)return tu(e,Ae===null?void 0:{agent:{source:Ae.source,id:Ae.id}}),Vj(),r(),!0;if(Pe!==null&&x!==null){try{x.launchInTerminal(e,Pe)}catch{return Dc.error(u({id:`jBVUXo`})),!1}return Vj(),r(),!0}if(Ie===null)return Dc.error(u({id:`teFjfG`})),!1;if(_[Ie.id]?.installed!==!0)return Hl(Ie),Dc.info(u({id:`L1BQTH`,values:{0:Ie.displayName}})),r(),!1;k(!0);let i=await b(Ie.id,e).finally(()=>{k(!1),r()});return i.ok&&Vj(),i.ok},Qe=()=>{let{instruction:e,mentions:t}=A.current?.getContent()??{instruction:``,mentions:[]};if(d)return ql({docName:null,folderRelativePath:i,workspace:h,instruction:e,mentions:[...new Set([...J,...t])].filter(e=>e!==i)});let r=ge?Bh(ge):void 0,a=ge?.docName??null,o=ge?a:J.includes(de)?n??null:null,s=o===null?null:Jj(o,g.get(o)?.docExt),c=[...new Set([...J,...t])].filter(e=>e!==s);return ql({docName:o,...s===null?{}:{docRelativePath:s},workspace:h,instruction:e,mentions:c,selection:r})},$e=()=>{if(Le){if(oe){et().catch(oM);return}Ze(Qe())}},et=async()=>{let{instruction:e,mentions:t}=A.current?.getContent()??{instruction:``,mentions:[]};(await l({compose:async n=>{let r=ql({docName:null,workspace:h,instruction:bp(n.map(aM),e,ge?{docName:ge.docName,markdown:ge.markdown}:void 0),mentions:[...new Set([...n.map(iM),...J,...t])]});return r===null?(Dc.error(u({id:`253MN6`})),!1):Ze(r,!1)}})).length>0&&Xe()};if(c)return null;let tt=``,nt=``;if(ge){let e;t[49]!==g||t[50]!==ge?(e=Vh(ge,Jj(ge.docName,g.get(ge.docName)?.docExt).split(`/`).pop()??``),t[49]=g,t[50]=ge,t[51]=e):e=t[51],tt=e;let n;t[52]===ge.markdown?n=t[53]:(n=Uh(ge.markdown),t[52]=ge.markdown,t[53]=n),nt=n}let rt;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(rt=e=>Ta(e,A),t[54]=rt):rt=t[54];let it;t[55]!==u||t[56]!==d||t[57]!==o?(it=d?null:(0,Z.jsx)(X,{type:`button`,variant:`outline`,"aria-label":u({id:`EWX92Z`}),onClick:()=>o?.(),"data-testid":`ask-ai-collapse`,className:`-top-2.5 -translate-x-1/2 absolute left-1/2 z-10 h-5 w-10 rounded-md p-0 text-muted-foreground opacity-0 shadow-sm transition-opacity hover:text-foreground focus-visible:opacity-100 group-focus-within:opacity-100 group-hover:opacity-100`,children:(0,Z.jsx)(Gu,{className:`size-3.5`,"aria-hidden":!0})}),t[55]=u,t[56]=d,t[57]=o,t[58]=it):it=t[58];let at;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(at=e=>re(t=>{let n=new Set(t);return n.add(e),n}),t[59]=at):at=t[59];let ot;t[60]!==u||t[61]!==tt||t[62]!==nt||t[63]!==ge||t[64]!==ve?(ot=ge?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-testid":`composer-selection-pill`,title:tt,className:`group/chip inline-flex max-w-[16rem] items-center gap-1 rounded-md border bg-muted/40 py-0.5 pr-1.5 pl-1 text-muted-foreground text-xs`,children:[(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":u({id:`irrm_E`}),onClick:()=>{_e(null),ye(!1)},className:`group/remove relative size-3.5 shrink-0 rounded-sm text-muted-foreground/80 hover:text-foreground`,children:[(0,Z.jsx)(Fb,{className:`absolute top-1/2 left-1/2 size-3 -translate-x-1/2 -translate-y-1/2 opacity-100 transition-opacity duration-150 ease-out group-hover/chip:opacity-0 group-focus-within/chip:opacity-0 motion-reduce:transition-none`,"aria-hidden":!0}),(0,Z.jsx)(zp,{className:`absolute top-1/2 left-1/2 size-3 -translate-x-1/2 -translate-y-1/2 opacity-0 transition-opacity duration-150 ease-out group-hover/chip:opacity-100 group-focus-within/chip:opacity-100 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,Z.jsx)(X,{type:`button`,variant:`ghost`,"aria-expanded":ve,"aria-label":u(ve?{id:`UaDyeb`}:{id:`eTL5y9`}),onClick:()=>ye(rM),"data-testid":`composer-selection-peek`,className:`h-auto min-h-0 min-w-0 shrink justify-start px-0 py-0 text-left font-normal text-muted-foreground text-xs hover:bg-transparent hover:text-foreground`,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:tt})})]}),ve&&nt!==``?(0,Z.jsx)(`p`,{className:`max-h-24 w-full basis-full overflow-y-auto whitespace-pre-wrap text-2xs text-muted-foreground/80 subtle-scrollbar`,"data-testid":`composer-selection-preview`,children:nt}):null]}):null,t[60]=u,t[61]=tt,t[62]=nt,t[63]=ge,t[64]=ve,t[65]=ot):ot=t[65];let st;t[66]!==q||t[67]!==K||t[68]!==ie?(st=K>0&&(0,Z.jsx)(Tp,{count:K,docs:ie,attached:q,onAttach:()=>ae(!0),onDismiss:()=>ae(!1)}),t[66]=q,t[67]=K,t[68]=ie,t[69]=st):st=t[69];let ct;t[70]===u?ct=t[71]:(ct=u({id:`xWEvuo`}),t[70]=u,t[71]=ct);let lt;t[72]!==T||t[73]!==m||t[74]!==We?(lt=T?(0,Z.jsx)(`div`,{"aria-hidden":!0,className:gr(`pointer-events-none absolute inset-0 truncate px-0 py-1 text-base text-muted-foreground/60 md:text-sm`,!m&&`transition-opacity duration-500 ease-in-out`,We.visible?`opacity-100`:`opacity-0`),children:We.text}):null,t[72]=T,t[73]=m,t[74]=We,t[75]=lt):lt=t[75];let ut=Fw,dt=Ne?(0,Z.jsx)(Ya,{agentId:Ae?.id??``,iconUrl:Ae?.iconUrl,className:`size-4`}):Pe===null?Ie?(0,Z.jsx)(aa,{id:Ie.id,className:`size-4`,"aria-hidden":!0}):null:(0,Z.jsx)(aa,{id:na(Pe),className:`size-4`,"aria-hidden":!0}),ft=Ne?Ae===null?(0,Z.jsx)(Y,{id:`an0aL5`}):(0,Z.jsx)(Ql,{agentName:Ae.name}):Pe===null?Ie?(0,Z.jsx)(Gl,{displayName:Ie.displayName}):(0,Z.jsx)(Y,{id:`F-vBv0`}):(0,Z.jsx)(Y,{id:`ti6aF_`,values:{0:ao[Pe].displayName}}),pt;t[76]===ft?pt=t[77]:(pt=(0,Z.jsx)(`span`,{children:ft}),t[76]=ft,t[77]=pt);let mt=Ie?(0,Z.jsx)(ju,{"aria-hidden":!0,className:`size-3.5`}):null,ht;t[78]===D?ht=t[79]:(ht=D?(0,Z.jsx)(ip,{className:`size-3.5`,"aria-hidden":!0}):null,t[78]=D,t[79]=ht);let gt;t[80]!==dt||t[81]!==pt||t[82]!==mt||t[83]!==ht?(gt=(0,Z.jsxs)(Z.Fragment,{children:[dt,pt,mt,ht]}),t[80]=dt,t[81]=pt,t[82]=mt,t[83]=ht,t[84]=gt):gt=t[84];let _t=!Le,vt=Fe?null:Ie?.id??null,yt=ke.map(e=>({key:`${e.source}:${e.id}`,id:e.id,name:e.name,...e.iconUrl===void 0?{}:{iconUrl:e.iconUrl},selected:Ne&&Ae!==null&&Ae.source===e.source&&Ae.id===e.id,onSelect:()=>Ye(e)})),bt;t[85]===v?bt=t[86]:(bt=e=>{e&&v()},t[85]=v,t[86]=bt);let xt;t[87]===Ve?xt=t[88]:(xt=(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:Ve?(0,Z.jsx)(Y,{id:`CPmYSG`}):(0,Z.jsx)(Y,{id:`t9Qn8y`})}),t[87]=Ve,t[88]=xt);let St;t[89]===u?St=t[90]:(St=u({id:`nskygk`}),t[89]=u,t[90]=St);let Ct;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(Ct={primary:`ask-ai-send`,trigger:`ask-ai-agent-trigger`,menu:`ask-ai-agent-menu`,option:nM,threadAgent:tM,settings:`ask-ai-agent-option-settings`,terminal:eM},t[91]=Ct):Ct=t[91];let wt;t[92]!==ut||t[93]!==He||t[94]!==ze||t[95]!==Ke||t[96]!==$e||t[97]!==gt||t[98]!==_t||t[99]!==vt||t[100]!==yt||t[101]!==bt||t[102]!==xt||t[103]!==St?(wt=(0,Z.jsx)(ut,{primary:gt,onPrimary:$e,primaryDisabled:_t,enabledTargets:ze,selectedTargetId:vt,onSelectTarget:Ke,threadAgents:yt,onOpenSettings:jc,onMenuOpenChange:bt,terminals:He,menuEmptyState:xt,triggerAriaLabel:St,testIds:Ct}),t[92]=ut,t[93]=He,t[94]=ze,t[95]=Ke,t[96]=$e,t[97]=gt,t[98]=_t,t[99]=vt,t[100]=yt,t[101]=bt,t[102]=xt,t[103]=St,t[104]=wt):wt=t[104];let Tt=(0,Z.jsxs)(`div`,{ref:j,onMouseDown:rt,className:`pointer-events-auto group relative flex cursor-text flex-col gap-1.5 rounded-2xl border border-border/60 bg-card px-3 py-2 shadow-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[it,(0,Z.jsxs)(wa,{files:J,onRemoveFile:at,children:[ot,st]}),(0,Z.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[(0,Z.jsx)(Aa,{ref:A,ariaLabel:ct,onEmptyChange:E,onContentChange:Ca,onMentionsChange:le,onSubmit:$e,initialDoc:M,className:`max-h-[200px] overflow-y-auto text-base md:text-sm`}),lt]}),wt]})]});return d?(0,Z.jsx)(`div`,{className:`shrink-0 pt-2 pb-3`,"data-testid":`bottom-composer`,children:(0,Z.jsx)(`div`,{className:`mx-auto w-full max-w-4xl px-6`,children:Tt})}):(0,Z.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-[var(--conflict-footer-height,0px)] z-20 editor-content-aligned bg-gradient-to-t from-background from-65% via-background to-transparent pt-10 pb-2`,"data-testid":`bottom-composer`,children:Tt})}function eM(e){return e===`claude`?`ask-ai-agent-option-terminal`:`ask-ai-agent-option-terminal-${e}`}function tM(e){return`ask-ai-agent-option-thread-${e}`}function nM(e){return`ask-ai-agent-option-${e}`}function rM(e){return!e}function iM(e){return hu(e.payload.docName)}function aM(e){return xp(e.payload)}function oM(e){console.warn(`[comments] queued-comment send rejected unexpectedly`,e)}function sM(){return new Set}function cM(){let e=lM;return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})}function lM(e){Mc(e,`open-ask-ai`)&&(Mr()||Xj(e.target)||(e.preventDefault(),Uj()))}function uM(e){let t=e.scrollHeight-e.clientHeight;return t>0&&e.scrollTop>=t-40}function dM(){return Ea().doc??void 0}function fM(){return jl()}function pM(e){return!e.terminalVisible&&!e.agentsVisible&&!e.isEmbedded&&e.activeDocName!==null}function mM(e){return!e.terminalVisible&&!e.agentsVisible&&!e.isEmbedded}function hM(e,t={}){let n=ye(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var gM=200,_M=`Outside any block`;function vM(e){let t=(0,$.c)(5),{editor:n}=e,r=y(n),i=(0,Q.useRef)(null),a=(0,Q.useRef)(null),o=(0,Q.useRef)(!1),s,c;t[0]!==r||t[1]!==n?(s=()=>{if(a.current!==null&&(window.clearTimeout(a.current),a.current=null),!n||!i.current)return;let e=r!==null&&r.ancestorChain.length>0,t;return t=e?yM(n,r):o.current?_M:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},gM),()=>{a.current!==null&&(window.clearTimeout(a.current),a.current=null)}},c=[n,r],t[0]=r,t[1]=n,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,Q.useEffect)(s,c);let l;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`div`,{ref:i,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`sr-only`}),t[4]=l):l=t[4],l}function yM(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=hM(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=hM(a);try{let t=e.state.doc.resolve(r.pos),n=t.index(t.depth),a=t.parent.childCount;return`Selected: ${i}, ${n+1} of ${a} in ${o}`}catch{return`Selected: ${i} in ${o}`}}var bM=new Lo(`okCommentAnchors`);function xM(e,t){e.isDestroyed||e.view.dispatch(e.state.tr.setMeta(bM,{draft:t}))}function SM(e){q(e)}function CM(){I()!==null&&q(null)}function wM(e,t,n){let r=[],i=p(e).filter(e=>e.status===`open`&&e.target.kind===`body`&&e.anchor!==null);if(i.length>0){let e=Sp(t);for(let t of i){if(t.anchor===null)continue;let n=e(t.anchor.quote,t.anchor);n!==null&&r.push({id:t.id,from:n.from,to:n.to})}}return n!==null&&n.from<n.to&&r.push({id:null,from:n.from,to:n.to}),r}function TM(e,t,n){let r=wM(e,t,n);if(r.length===0)return ls.empty;let i=Op(r,T()).map(e=>fo.inline(e.from,e.to,e.threadId===null?{style:e.style}:{style:e.style,"data-comment-thread":e.threadId}));return ls.create(t,i)}function EM(e,t){return typeof t==`object`&&t&&`draft`in t?`draft`:e.docChanged?`rebuild`:t===void 0?`reuse`:`rebuild`}function DM(e){return new Do({key:bM,state:{init:(t,n)=>({draft:null,decorations:TM(e,n.doc,null)}),apply(t,n,r,i){let a=t.getMeta(bM);switch(EM(t,a)){case`reuse`:return n;case`draft`:{let t=a.draft;return{draft:t,decorations:TM(e,i.doc,t)}}default:{let r=n.draft===null?null:{from:t.mapping.map(n.draft.from),to:t.mapping.map(n.draft.to)};return{draft:r,decorations:TM(e,i.doc,r)}}}}},props:{decorations(e){return bM.getState(e)?.decorations},handleClick(t,n){let r=null;for(let i of wM(e,t.state.doc,null))i.id!==null&&(n<i.from||n>i.to||(r===null||i.to-i.from<r.to-r.from)&&(r=i));return r?.id==null?(CM(),!1):(SM(r.id),!1)}}})}function OM(e){let t=(0,$.c)(4),{editor:n,docName:r}=e,i,a;return t[0]!==r||t[1]!==n?(i=()=>{let e=!1;queueMicrotask(()=>{e||n.isDestroyed||(n.registerPlugin(DM(r)),Oe(r).then(()=>{e||n.isDestroyed||n.view.dispatch(n.state.tr.setMeta(bM,{refresh:!0}))}).catch(AM))});let t=()=>{if(e||n.isDestroyed)return;let t=n.editorView;t&&t.dispatch(t.state.tr.setMeta(bM,{refresh:!0}))},i=H(t),a=sn(t),o=kM;return document.addEventListener(`keydown`,o),()=>{e=!0,i(),a(),document.removeEventListener(`keydown`,o),n.isDestroyed||n.unregisterPlugin(bM)}},a=[n,r],t[0]=r,t[1]=n,t[2]=i,t[3]=a):(i=t[2],a=t[3]),(0,Q.useEffect)(i,a),null}function kM(e){e.key===`Escape`&&CM()}function AM(){}var jM=34,MM=30,NM=4;function PM(e,t){return{top:e.top+t,height:Math.max(0,e.height-t)}}var FM=260;function IM(e,t){let n=Math.min(e.right,t);return n-e.left<FM?null:n-jM}function LM(e){let t=e.parentElement;for(;t;){if(getComputedStyle(t).overflowX!==`visible`)return t.getBoundingClientRect().right;t=t.parentElement}return window.innerWidth}function RM(e,t,n){let r=[...e].sort((e,t)=>e.y-t.y),i=t+n-MM,a=[],o=t-NM;for(let e of r){let r=e.y<t||e.y>t+n,s=e.y-MM/2,c=Math.min(i,Math.max(s,o+NM,t));a.push({id:e.id,top:c,offscreen:r}),o=c+MM}return a}function zM(e){let t=(0,$.c)(29),{editor:n,docName:r}=e,{_:i}=Bn(),a=dt(r),o=_n(),[s,c]=(0,Q.useState)(null),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=[],t[0]=l):l=t[0];let[u,d]=(0,Q.useState)(l),f,p;t[1]!==n||t[2]!==a?(f=()=>{let e=Li(n);if(!e)return;let t=vp(e.dom);if(!t)return;let r=a.filter(BM),i=()=>{let i=t.getBoundingClientRect(),a=[];if(r.length>0){let t=Sp(n.state.doc);for(let n of r){let r;if(n.target.kind===`property`){let e=gp(n.target.key);if(e===null)continue;r=e.top+e.height/2}else{if(n.anchor===null)continue;let i=t(n.anchor.quote,n.anchor);if(i===null)continue;try{r=e.coordsAtPos(i.from).top}catch{continue}}a.push({id:n.id,y:r})}}let o=IM(i,LM(t));if(o===null){c(null),d([]);return}let s=PM(i,mp(t));c({top:s.top,height:s.height,left:o}),d(RM(a,s.top,s.height))};i();let o=0,s=()=>{o===0&&(o=requestAnimationFrame(()=>{o=0,i()}))};window.addEventListener(`resize`,s),t.addEventListener(`scroll`,s,{passive:!0});let l=new ResizeObserver(s);return l.observe(t),n.on(`update`,s),()=>{o!==0&&cancelAnimationFrame(o),window.removeEventListener(`resize`,s),t.removeEventListener(`scroll`,s),l.disconnect(),n.off(`update`,s)}},p=[n,a],t[1]=n,t[2]=a,t[3]=f,t[4]=p):(f=t[3],p=t[4]),(0,Q.useEffect)(f,p);let m;t[5]!==o||t[6]!==n||t[7]!==a?(m=function(e){if(o===e){q(null);return}let t=a.find(t=>t.id===e);if(t?.target.kind===`property`)t.anchor!==null&&up({key:t.target.key,path:t.target.path,quote:t.anchor.quote,start:t.anchor.start,end:t.anchor.end})||Dp(t.target.key);else if(t&&t.anchor!==null){let e=yp(n.state.doc,t.anchor.quote,t.anchor);e&&Ep(n,e,t.docName)}q(e)},t[5]=o,t[6]=n,t[7]=a,t[8]=m):m=t[8];let h=m;if(s===null||u.length===0)return null;let g;t[9]!==s.height||t[10]!==s.left||t[11]!==s.top?(g={top:s.top,height:s.height,left:s.left,width:jM},t[9]=s.height,t[10]=s.left,t[11]=s.top,t[12]=g):g=t[12];let _;if(t[13]!==i||t[14]!==o||t[15]!==h||t[16]!==u||t[17]!==s.top||t[18]!==a){let e;t[20]!==i||t[21]!==o||t[22]!==h||t[23]!==s.top||t[24]!==a?(e=e=>{let t=a.find(t=>t.id===e.id);if(!t)return null;let n=e.id===o;return(0,Z.jsx)(X,{type:`button`,variant:`ghost`,"aria-label":i(n?{id:`M92_0q`}:{id:`ojGc_T`}),className:gr(`pointer-events-auto absolute left-0 size-7 rounded-full border bg-background p-0 shadow-sm transition-colors hover:bg-muted`,e.offscreen&&`opacity-40 hover:opacity-100`,n&&`border-blue-600 bg-blue-50 dark:border-blue-500 dark:bg-blue-950`),style:{top:e.top-s.top},"data-comment-thread":t.id,onClick:()=>h(t.id),onPointerEnter:()=>Me(t.id),onPointerLeave:()=>S(t.id),children:(0,Z.jsx)(fp,{className:`size-3.5 text-blue-600 dark:text-blue-400`})},e.id)},t[20]=i,t[21]=o,t[22]=h,t[23]=s.top,t[24]=a,t[25]=e):e=t[25],_=u.map(e),t[13]=i,t[14]=o,t[15]=h,t[16]=u,t[17]=s.top,t[18]=a,t[19]=_}else _=t[19];let v;return t[26]!==g||t[27]!==_?(v=(0,$_.createPortal)((0,Z.jsx)(`div`,{className:`pointer-events-none fixed z-30`,style:g,children:_}),document.body),t[26]=g,t[27]=_,t[28]=v):v=t[28],v}function BM(e){return e.status===`open`&&(e.target.kind===`property`||e.anchor!==null)}function VM(e){let t=1/0,n=-1/0;for(let r of e.ranges)r.$from.pos<t&&(t=r.$from.pos),r.$to.pos>n&&(n=r.$to.pos);return!Number.isFinite(t)||!Number.isFinite(n)?{from:e.from,to:e.to}:{from:t,to:n}}function HM(e){let t=(0,$.c)(54),{editor:n,docName:r,shortcutEnabled:i}=e,{_:a}=Bn(),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(!0),u=hT(),d=(0,Q.useRef)(null),f=(0,Q.useRef)(null),p,m;t[0]!==n||t[1]!==i?(p=()=>{if(!i)return;let e=e=>{if(!Mc(e,`add-comment`))return;let t=e.target;t instanceof HTMLElement&&/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName)||n.state.selection.empty||(e.preventDefault(),ue())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},m=[i,n],t[0]=n,t[1]=i,t[2]=p,t[3]=m):(p=t[2],m=t[3]),(0,Q.useEffect)(p,m);let h,g;t[4]===n?(h=t[5],g=t[6]):(h=()=>He(()=>{let{selection:e}=n.state;if(e.empty)return;let{from:t,to:r}=VM(e);if(r-t<1)return;let i=Ec(n.state.doc,t,r).trim();if(i.length===0)return;let{prefix:a,suffix:o}=hp(n.state.doc,t,r);s({from:t,to:r,quote:i,prefix:a,suffix:o}),xM(n,{from:t,to:r})}),g=[n],t[4]=n,t[5]=h,t[6]=g),(0,Q.useEffect)(h,g);let _,v;t[7]!==o||t[8]!==n?(_=()=>{if(o===null)return;let e=f.current;if(!e)return;let t=Li(n);if(!t)return;let r={getBoundingClientRect:()=>{try{return Mo(t,o.from,o.to)}catch{return new DOMRect}},contextElement:t.dom};return Ki(r,e,()=>{Hi(r,e,{placement:`bottom-start`,strategy:`fixed`,middleware:[Ui(8),Bi(Ei(n)),Yi(Ii(n)),Vi(Ri(n))]}).then(t=>{let{x:n,y:r}=t;e.isConnected&&(e.style.position=`fixed`,e.style.left=`${n}px`,e.style.top=`${r}px`)}).catch(t=>{e.isConnected&&console.warn(`[comments] composer computePosition failed`,t)})})},v=[o,n],t[7]=o,t[8]=n,t[9]=_,t[10]=v):(_=t[9],v=t[10]),(0,Q.useEffect)(_,v);let y,b;t[11]===o?(y=t[12],b=t[13]):(y=()=>{o!==null&&d.current?.focus()},b=[o],t[11]=o,t[12]=y,t[13]=b),(0,Q.useEffect)(y,b);let x;t[14]===n?x=t[15]:(x=function(){d.current?.clear(),l(!0),s(null),xM(n,null)},t[14]=n,t[15]=x);let S=x,C;t[16]!==o||t[17]!==S?(C=()=>{if(o===null)return;let e=e=>{let t=f.current;if(t===null)return;let n=e.target;n instanceof Node&&(t.contains(n)||n instanceof Element&&n.closest(`[data-suggestion-popup]`)!==null||S())};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},t[16]=o,t[17]=S,t[18]=C):C=t[18],(0,Q.useEffect)(C);let w;t[19]!==o||t[20]!==r||t[21]!==n||t[22]!==S?(w=function(){if(o===null)return;let e=d.current?.getContent().instruction.trim()??``;e.length!==0&&(se({docName:r,quote:o.quote,prefix:o.prefix,suffix:o.suffix,body:e}),n.isDestroyed||n.commands.setTextSelection(Math.min(o.to,n.state.doc.content.size)),S())},t[19]=o,t[20]=r,t[21]=n,t[22]=S,t[23]=w):w=t[23];let T=w;if(o===null)return null;let E;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(E={position:`fixed`,top:0,left:0},t[24]=E):E=t[24];let D;t[25]===a?D=t[26]:(D=a({id:`vYOUOk`}),t[25]=a,t[26]=D);let O;t[27]===a?O=t[28]:(O=a({id:`vYOUOk`}),t[27]=a,t[28]=O);let k;t[29]!==T||t[30]!==S||t[31]!==D||t[32]!==O?(k=(0,Z.jsx)(Aa,{ref:d,ariaLabel:D,placeholder:O,onEmptyChange:l,onSubmit:T,onEscape:S,className:`max-h-40 min-h-16 overflow-y-auto rounded-md border px-2 py-1 text-sm`}),t[29]=T,t[30]=S,t[31]=D,t[32]=O,t[33]=k):k=t[33];let A=u?`justify-end`:`justify-between`,j;t[34]===A?j=t[35]:(j=gr(`flex items-center gap-1.5`,A),t[34]=A,t[35]=j);let M;t[36]!==u||t[37]!==r?(M=u?null:(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,onClick:()=>Dt(`doc`,r),className:`px-2 text-muted-foreground hover:text-foreground`,children:(0,Z.jsx)(Y,{id:`Dd6j2Q`})}),t[36]=u,t[37]=r,t[38]=M):M=t[38];let N;t[39]===a?N=t[40]:(N=a({id:`ffH3Rt`}),t[39]=a,t[40]=N);let P,F;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(Y,{id:`hqVQbT`}),F=(0,Z.jsx)(`span`,{className:`ml-0.5 text-[11px] tracking-normal normal-case text-primary-foreground/75`,children:`⏎`}),t[41]=P,t[42]=F):(P=t[41],F=t[42]);let I;t[43]!==c||t[44]!==T||t[45]!==N?(I=(0,Z.jsxs)(X,{size:`sm`,onClick:T,disabled:c,"aria-label":N,children:[P,F]}),t[43]=c,t[44]=T,t[45]=N,t[46]=I):I=t[46];let L;t[47]!==j||t[48]!==M||t[49]!==I?(L=(0,Z.jsxs)(`div`,{className:j,children:[M,I]}),t[47]=j,t[48]=M,t[49]=I,t[50]=L):L=t[50];let R;return t[51]!==k||t[52]!==L?(R=(0,$_.createPortal)((0,Z.jsxs)(`div`,{ref:f,className:`z-[60] flex w-80 flex-col gap-2 rounded-lg border bg-popover p-3 text-popover-foreground shadow-md`,style:E,"data-testid":`comment-composer`,children:[k,L]}),document.body),t[51]=k,t[52]=L,t[53]=R):R=t[53],R}function UM(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(pr,{fallbackRender:WM,children:n}),t[0]=n,t[1]=r),r}function WM(){return null}var GM=!1;function KM(e,t,n,r){let i=e[t];if(typeof i!=`function`){console.warn(`[cold-mount-instrumentation] target missing method "${t}"`);return}e[t]=function(...e){let t=performance.now(),a,o=!1;try{return a=i.apply(this,e),o=!0,a}finally{let e=performance.now()-t,i;if(o&&r)try{i=r(this,a,t,e)}catch(e){i={"instrumentation-error":e instanceof Error?e.message:String(e)}}try{am(n,{durationMs:Math.round(e*1e3)/1e3,threw:!o,...i},{startTime:t,duration:e})}catch{}}}}function qM(e){return e?.doc?typeof e.doc.nodeSize==`number`?e.doc.nodeSize:e.doc.content&&typeof e.doc.content.size==`number`?e.doc.content.size:null:null}var JM=0,YM=0,XM=0,ZM=0,QM=null,$M=[`linkResolutionDecoration$`],eN=new WeakSet,tN=new WeakSet;function nN(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}function rN(){return!1}function iN(){return!rN()}function aN(e,t){if(iN())return t;let n=`ok/cold/nodeview-factory-${nN(e)}`;return function(...r){let i=performance.now();try{return t(...r)}finally{let t=performance.now()-i;am(n,{nodeType:e,durationMs:Math.round(t*1e3)/1e3},{startTime:i,duration:t})}}}function oN(e){if(iN())return;let t=e.state.plugins;for(let e of t){if(tN.has(e))continue;let t=e.spec?.key?.key;if(!t||!$M.some(e=>t.startsWith(e)))continue;let n=e.props,r=n.decorations;if(typeof r!=`function`){tN.add(e);continue}let i=`ok/cold/decoration-${nN(t.replace(/\$\d*$/,``))}`;n.decorations=function(...e){let n=performance.now();try{return r.apply(this,e)}finally{let e=performance.now()-n;am(i,{pluginKey:t,durationMs:Math.round(e*1e3)/1e3},{startTime:n,duration:e})}},tN.add(e)}}function sN(e){if(iN())return;let t=e._props?.nodeViews;if(!(!t||typeof t!=`object`))for(let[e,n]of Object.entries(t)){if(typeof n!=`function`||n.__okWrapped===!0)continue;let r=aN(e,n);r.__okWrapped=!0,t[e]=r}}function cN(e){return iN()?e:e.map(e=>{let t=e.name??`unknown`,n=nN(t);return e.extend({onBeforeCreate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;am(`ok/cold/ext-${n}-on-before-create`,{ext:t,hook:`onBeforeCreate`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}},onCreate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;am(`ok/cold/ext-${n}-on-create`,{ext:t,hook:`onCreate`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}},onUpdate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;am(`ok/cold/ext-${n}-on-update`,{ext:t,hook:`onUpdate`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}},onDestroy(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;am(`ok/cold/ext-${n}-on-destroy`,{ext:t,hook:`onDestroy`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}}})})}function lN(){if(!GM){GM=!0,KM(Xs.prototype,`mount`,`ok/cold/editor-mount`,(e,t,n,r)=>{let i=e;return iN()||(QM=performance.now()),{elementDefault:i.options?.element?.nodeName??null,docSize:qM(i.editorState),durationMs:r}}),KM(Xs.prototype,`createView`,`ok/cold/editor-create-view`,e=>{let t=e;return!iN()&&!eN.has(e)&&t.view&&(oN(t.view),sN(t.view),eN.add(e)),{docSize:qM(t.editorState)}}),KM(Xs.prototype,`createNodeViews`,`ok/cold/create-node-views`,(e,t,n,r)=>{ZM+=1;let i=e;return!iN()&&i.view&&sN(i.view),{docSize:qM(i.view),seq:ZM,durationMs:r}}),KM(Ao.prototype,`updateState`,`ok/cold/pm-update-state`,(e,t,n,r)=>(YM+=1,{seq:YM,docSize:qM(e.state),durationMs:r})),KM(Ao.prototype,`setProps`,`ok/cold/pm-set-props`,(e,t,n,r)=>(XM+=1,{seq:XM,docSize:qM(e.state),durationMs:r})),KM(Oi.prototype,`_forceRerender`,`ok/cold/force-rerender`,(e,t,n,r)=>{JM+=1;let i=e,a=(()=>{try{return i.type?.toArray?i.type.toArray().length:null}catch{return null}})();return{seq:JM,topLevelYElements:a,durationMs:r}}),KM(yi.prototype,`init`,`ok/cold/ec-init`,e=>({editorPresent:!!e.props?.editor}));try{typeof PerformanceObserver<`u`&&new PerformanceObserver(e=>{for(let t of e.getEntries()){let e=t.name;if((e===`first-paint`||e===`first-contentful-paint`)&&(am(e===`first-paint`?`ok/cold/paint-fp`:`ok/cold/paint-fcp`,{entryType:t.entryType,startTime:Math.round(t.startTime*1e3)/1e3},{startTime:t.startTime,duration:0}),!iN()&&e===`first-paint`&&QM!==null)){let e=QM,n=Math.max(0,t.startTime-e);am(`ok/cold/append-to-paint`,{paintEntryType:t.entryType,durationMs:Math.round(n*1e3)/1e3,paintAt:Math.round(t.startTime*1e3)/1e3},{startTime:e,duration:n}),QM=null}}}).observe({type:`paint`,buffered:!0})}catch{}globalThis.__okColdMountInstrumented=!0}}function uN(){let[e]=(0,Q.useState)(Co);return e}var dN=class{awareness=null;started=!1;renewIntervalMs;now;constructor(e,t={}){this.ticker=e,this.renewIntervalMs=t.renewIntervalMs??15e3,this.now=t.now??(()=>Date.now())}start(){this.started||(this.started=!0,this.ticker.start(()=>this.renewIfStale()))}stop(){this.started&&(this.started=!1,this.ticker.stop(),this.awareness=null)}setAwareness(e){this.awareness=e}clearAwareness(e){this.awareness===e&&(this.awareness=null)}renewIfStale(){let e=this.awareness;if(e===null)return;let t=e.getLocalState();if(t===null)return;let n=e.meta.get(e.clientID)?.lastUpdated??0;this.now()-n>=this.renewIntervalMs&&e.setLocalState(t)}},fN=class{worker=null;start(e){typeof Worker>`u`||this.worker!==null||(this.worker=new Worker(new URL(``+new URL(`awareness-heartbeat.worker-BYkbsKQ2.js`,import.meta.url).href,``+import.meta.url),{type:`module`}),this.worker.onmessage=t=>{t.data===`tick`&&e()},this.worker.postMessage(`start`))}stop(){this.worker!==null&&(this.worker.postMessage(`stop`),this.worker.terminate(),this.worker=null)}},pN=null;function mN(){return pN===null&&(pN=new dN(new fN)),pN}function hN({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:_o(e.display_name),color:Vo(e.id,uo),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:Vo(e.id,uo),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function gN(e,t){return e>t}function _N(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.isChangeOrigin===!0?!0:`snapshot`in t&&`prevSnapshot`in t&&t.snapshot===null&&t.prevSnapshot===null}var vN=3,yN=6e4;function bN(e,t){let n=0;for(let r of e)t-r<yN&&(n+=1);return n<vN}var xN=new Map;function SN(e,t){for(let n of e.changed.keys()){let e=n;for(;e!=null;){if(e===t)return!0;let n=e._item;e=n==null?null:n.parent}}return!1}function CN(e){let t=Ai.getState(e);return t?.snapshot!=null||t?.prevSnapshot!=null}function wN(e){let{fragment:t,docName:n,onWedged:r}=e,i=0,a=0,o=!1,s=!1,c=!1,l=null,u=new WeakSet,d=e=>{let t=Ai.getState(e)?.binding;if(!t)return;if(typeof t._prosemirrorChanged!=`function`){am.count(`ok/editor/binding-guard-disarmed`,{docName:n,reason:`no-prosemirror-changed`}),console.warn(`[binding-staleness-guard] ySync binding on "${n}" exposes no _prosemirrorChanged — write-back gate disarmed (vendored y-tiptap contract change?)`);return}if(u.has(t))return;u.add(t);let r=t._prosemirrorChanged.bind(t);t._prosemirrorChanged=e=>{gN(i,a)||r(e)}},f=()=>{if(c=!1,!s||o||!gN(i,a)||l!==null&&CN(l.state))return;o=!0;let e=Date.now();for(let[t,n]of xN)n.every(t=>e-t>=yN)&&xN.delete(t);let t=(xN.get(n)??[]).filter(t=>e-t<yN);if(!bN(t,e)){xN.set(n,t),am.count(`ok/editor/binding-wedge-rate-capped`,{docName:n}),console.warn(`[binding-staleness-guard] wedge on "${n}" rate-capped (externalSeq=${i}, appliedSeq=${a}) — publication gate stays closed, no further recycle`);return}t.push(e),xN.set(n,t),console.warn(`[binding-staleness-guard] wedged binding on "${n}" — Y→PM apply missing (externalSeq=${i}, appliedSeq=${a})`);try{r({externalSeq:i,appliedSeq:a})}catch(e){o=!1,am.count(`ok/editor/binding-wedge-recovery-error`,{docName:n}),console.error(`[binding-staleness-guard] wedge recovery threw for "${n}":`,e)}},p=e=>{e.origin!==Ai&&SN(e,t)&&(i+=1,c||(c=!0,queueMicrotask(f)))};return new Do({state:{init:()=>null,apply:e=>(_N(e.getMeta(Ai))&&(a=i,o&&am.count(`ok/editor/binding-wedge-recovered`,{docName:n}),o=!1),null)},filterTransaction:(e,t)=>!gN(i,a)||CN(t)?!0:e.getMeta(Ai)!==void 0,view:e=>{let r=t.doc;return r==null?(am.count(`ok/editor/binding-guard-disarmed`,{docName:n,reason:`no-ydoc`}),console.error(`[binding-staleness-guard] fragment has no Y.Doc for "${n}" — staleness guard disarmed`),{}):(s=!0,l=e,d(e.state),r.off(`beforeObserverCalls`,p),r.on(`beforeObserverCalls`,p),{destroy:()=>{s=!1,l=null,r.off(`beforeObserverCalls`,p)}})}})}function TN(e,t){let n=Math.min(e.top,t.top),r=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),a=Math.max(e.right,t.right)-i,o=r-n;return new DOMRect(i,n,a,o)}var EN=class{constructor({editor:e,element:t,view:n,pluginKey:r=`bubbleMenu`,updateDelay:i=250,resizeDelay:a=60,shouldShow:o,appendTo:s,getReferencedVirtualElement:c,options:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:`absolute`,placement:`top`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:e,state:t,from:n,to:r})=>{let{doc:i,selection:a}=t,{empty:o}=a,s=!i.textBetween(n,r).length&&Qo(t.selection),c=this.element.contains(document.activeElement);return!(!(e.hasFocus()||c)||o||s||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(e,t)=>{let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);!n&&!r||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=l?.scrollTarget??window,this.getReferencedVirtualElement=c,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener(`dragstart`,this.dragstartHandler),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Bi(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Yi(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Ui(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Ji(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Vi(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Wi(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Gi(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(qi(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}get virtualElement(){let{selection:e}=this.editor.state,t=this.getReferencedVirtualElement?.call(this);if(t)return t;if(!this.view?.dom?.parentNode)return;let n=Mo(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof ds){let t=this.view.nodeDOM(e.from),n=t.dataset.nodeViewWrapper?t:t.querySelector(`[data-node-view-wrapper]`);n&&(t=n),t&&(r={getBoundingClientRect:()=>t.getBoundingClientRect(),getClientRects:()=>[t.getBoundingClientRect()]})}if(e instanceof Os){let{$anchorCell:t,$headCell:n}=e,i=t?t.pos:n.pos,a=n?n.pos:t.pos,o=this.view.nodeDOM(i),s=this.view.nodeDOM(a);if(!o||!s)return;let c=o===s?o.getBoundingClientRect():TN(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&Hi(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(!(!this.isVisible||this.editor.isDestroyed||!this.element.isConnected)){if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(e,t){let{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,t);return}let i=!t?.selection.eq(e.state.selection),a=!t?.doc.eq(e.state.doc);this.updateHandler(e,i,a,t)}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:e,from:i,to:a})||!1}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener(`dragstart`,this.dragstartHandler),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},DN=e=>new Do({key:typeof e.pluginKey==`string`?new Lo(e.pluginKey):e.pluginKey,view:t=>new EN({view:t,...e})});Rs.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[DN({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var ON=class{constructor({editor:e,element:t,view:n,pluginKey:r=`floatingMenu`,updateDelay:i=250,resizeDelay:a=60,options:o,appendTo:s,shouldShow:c}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:e,state:t})=>{let{selection:n}=t,{$anchor:r,empty:i}=n,a=r.depth===1,o=r.parent.isTextblock&&!r.parent.type.spec.code&&!r.parent.textContent&&r.parent.childCount===0&&!this.getTextContent(r.parent);return!(!e.hasFocus()||!i||!a||!o||!this.editor.isEditable)},this.floatingUIOptions={strategy:`absolute`,placement:`right`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=o?.scrollTarget??window,this.floatingUIOptions={...this.floatingUIOptions,...o},this.element.tabIndex=0,c&&(this.shouldShow=c),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return Gs(e,{textSerializers:oo(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Bi(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Yi(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Ui(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Ji(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Vi(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Wi(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Gi(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(qi(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,view:this.view,state:t,oldState:e,from:i,to:a})}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){let{selection:e}=this.editor.state,t=Mo(this.view,e.from,e.to);Hi({getBoundingClientRect:()=>t,getClientRects:()=>[t]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);this.updateHandler(e,n,r,t)}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},kN=e=>new Do({key:typeof e.pluginKey==`string`?new Lo(e.pluginKey):e.pluginKey,view:t=>new ON({view:t,...e})});Rs.create({name:`floatingMenu`,addOptions(){return{element:null,options:{},pluginKey:`floatingMenu`,updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta(this.options.pluginKey,`updatePosition`),!0)}},addProseMirrorPlugins(){return this.options.element?[kN({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function AN(e,t){return e??new Lo(t)}var jN=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,MN=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),NN=new Set(`animationIterationCount.aspectRatio.borderImageOutset.borderImageSlice.borderImageWidth.columnCount.columns.fillOpacity.flex.flexGrow.flexShrink.fontWeight.gridArea.gridColumn.gridColumnEnd.gridColumnStart.gridRow.gridRowEnd.gridRowStart.lineClamp.lineHeight.opacity.order.orphans.scale.stopOpacity.strokeDasharray.strokeDashoffset.strokeMiterlimit.strokeOpacity.strokeWidth.tabSize.widows.zIndex.zoom`.split(`.`)),PN=new Set([`children`,`className`,`style`]),FN=new Set([`tabIndex`]),IN=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),LN={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function RN(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function zN(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function BN(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||IN.has(e)}function VN(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function HN(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:LN[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function UN(e,t){let n=t.defaultPrevented,r=!1,i=Object.create(t);return Object.defineProperties(i,{nativeEvent:{value:t},currentTarget:{value:e},target:{value:t.target},persist:{value:()=>void 0},isDefaultPrevented:{value:()=>n},isPropagationStopped:{value:()=>r},preventDefault:{value:()=>{n=!0,t.preventDefault()}},stopPropagation:{value:()=>{r=!0,t.stopPropagation()}}}),i}function WN(e){return FN.has(e)}function GN(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function KN(e,t){if(t===`tabIndex`){e.removeAttribute(`tabindex`);return}let n=e[t];if(typeof n==`boolean`){e[t]=!1;return}if(typeof n==`number`){e[t]=0;return}e[t]=``}function qN(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||NN.has(e)?String(t):`${t}px`}function JN(e,t){MN.has(t)||e.style.removeProperty(VN(t))}function YN(e,t,n){MN.has(t)||e.style.setProperty(VN(t),qN(t,n))}function XN(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(PN.has(r)||!BN(r)||RN(r,t[r])||RN(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=zN(r);if(a==null||a===!1){WN(r)&&KN(e,r),e.removeAttribute(o);return}if(a===!0){WN(r)&&GN(e,r,!0),e.setAttribute(o,``);return}if(WN(r)){GN(e,r,a);return}e.setAttribute(o,String(a))})}function ZN(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function QN(e,t,n){let r=t??{},i=n??{};new Set([...Object.keys(r),...Object.keys(i)]).forEach(t=>{let n=r[t],a=i[t];if(n!==a){if(a==null){JN(e,t);return}YN(e,t,a)}})}function $N(e,t,n){t.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)});let r=[];return Object.entries(n).forEach(([t,n])=>{if(!RN(t,n))return;let{eventName:i,options:a}=HN(t),o=t=>{n(UN(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function eP(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);jN(()=>{let i=n.current;return ZN(e,i.className,t.className),QN(e,i.style,t.style),XN(e,i,t),r.current=$N(e,r.current,t),n.current=t,()=>{r.current.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)}),r.current=[]}},[e,t])}var tP=Q.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,getReferencedVirtualElement:o,options:s,children:c,...l},u)=>{let d=(0,Q.useRef)(document.createElement(`div`)),f=(0,Q.useRef)(AN(e,`bubbleMenu`)).current;eP(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=Ci(),m=t||p,h={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:f,shouldShow:a,getReferencedVirtualElement:o,options:s},g=(0,Q.useRef)(h);g.current=h;let[_,v]=(0,Q.useState)(!1),y=(0,Q.useRef)(!0);return(0,Q.useEffect)(()=>{if(m?.isDestroyed)return;if(!m){console.warn(`BubbleMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=d.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=DN({...g.current,editor:m,element:e});m.registerPlugin(t);let n=g.current.pluginKey;return y.current=!0,v(!0),()=>{v(!1),m.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[m]),(0,Q.useEffect)(()=>{if(!(!_||!m||m.isDestroyed)){if(y.current){y.current=!1;return}m.view.dispatch(m.state.tr.setMeta(f,{type:`updateOptions`,options:g.current}))}},[_,m,n,r,a,s,i,o,f]),(0,$_.createPortal)(c,d.current)});Q.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,options:o,children:s,...c},l)=>{let u=(0,Q.useRef)(document.createElement(`div`)),d=(0,Q.useRef)(AN(e,`floatingMenu`)).current;eP(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=Ci(),p=t||f,m={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:d,shouldShow:a,options:o},h=(0,Q.useRef)(m);h.current=m;let[g,_]=(0,Q.useState)(!1),v=(0,Q.useRef)(!0);return(0,Q.useEffect)(()=>{if(p?.isDestroyed)return;if(!p){console.warn(`FloatingMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=u.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=kN({...h.current,editor:p,element:e});p.registerPlugin(t);let n=h.current.pluginKey;return v.current=!0,_(!0),()=>{_(!1),p.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[p]),(0,Q.useEffect)(()=>{if(!(!g||!p||p.isDestroyed)){if(v.current){v.current=!1;return}p.view.dispatch(p.state.tr.setMeta(d,{type:`updateOptions`,options:h.current}))}},[g,p,n,r,a,o,i,d]),(0,$_.createPortal)(s,u.current)});function nP(){let e=(0,$.c)(9),{_:t}=Bn(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(La,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),e[0]=n):n=e[0];let r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`comment-bubble-button`,className:`gap-1 px-2 text-sm font-medium text-accent-foreground/80`,onClick:rP,children:[(0,Z.jsx)(pt,{className:`size-3.5`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`NBdIgR`})})]})}),e[1]=r):r=e[1];let i;e[2]===t?i=e[3]:(i=t({id:`58qIOK`}),e[2]=t,e[3]=i);let a;e[4]===i?a=e[5]:(a=(0,Z.jsx)(`span`,{children:i}),e[4]=i,e[5]=a);let o;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(en,{"aria-label":Ac(`add-comment`),children:Lc(`add-comment`)}),e[6]=o):o=e[6];let s;return e[7]===a?s=e[8]:(s=(0,Z.jsxs)(Z.Fragment,{children:[n,(0,Z.jsxs)(Ur,{children:[r,(0,Z.jsxs)(Vr,{side:`bottom`,sideOffset:8,children:[a,o]})]})]}),e[7]=a,e[8]=s),s}function rP(){return ue()}var iP=[{name:`paragraph`,label:{id:`xeiujy`},icon:fb,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:{id:`lXKZGw`},icon:xt,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:{id:`El7NbA`},icon:wt,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:{id:`SFN6dN`},icon:Wt,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:{id:`s1c0ja`},icon:it,isActive:e=>e.isActive(`list`,{ordered:!1})&&!e.isActive(`listItem`,{checked:!0})&&!e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleBulletList().run()},{name:`orderedList`,label:{id:`Uci-Ph`},icon:Sn,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:{id:`G_686w`},icon:Vt,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:{id:`ZhhOwV`},icon:Xe,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:{id:`N2eHWq`},icon:wb,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock({language:`js`}).run()}];function aP(e){let t=(0,$.c)(22),{editor:n}=e,{_:r}=Bn(),i;t[0]===n?i=t[1]:(i={editor:n,selector:oP},t[0]=n,t[1]=i);let{current:a,activeStates:o}=Si(i),s=a.icon,c;t[2]===s?c=t[3]:(c=(0,Z.jsx)(s,{className:`size-3.5`}),t[2]=s,t[3]=c);let l;t[4]!==r||t[5]!==a.label?(l=r(a.label),t[4]=r,t[5]=a.label,t[6]=l):l=t[6];let u;t[7]===l?u=t[8]:(u=(0,Z.jsx)(`span`,{children:l}),t[7]=l,t[8]=u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Gu,{className:`size-3 opacity-50`}),t[9]=d):d=t[9];let f;t[10]!==c||t[11]!==u?(f=(0,Z.jsx)(fa,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,className:`gap-1 px-2 text-sm font-medium text-accent-foreground/80`,children:[c,u,d]})}),t[10]=c,t[11]=u,t[12]=f):f=t[12];let p;t[13]!==r||t[14]!==o||t[15]!==n?(p=iP.map(e=>{let t=e.icon,i=o[e.name];return(0,Z.jsxs)(ca,{className:i?`bg-accent text-accent-foreground`:``,onSelect:()=>{e.command(n)},children:[(0,Z.jsx)(t,{className:`size-4`}),(0,Z.jsx)(`span`,{children:r(e.label)})]},e.name)}),t[13]=r,t[14]=o,t[15]=n,t[16]=p):p=t[16];let m;t[17]===p?m=t[18]:(m=(0,Z.jsx)(ga,{align:`start`,sideOffset:8,className:`w-44 max-h-(--radix-dropdown-menu-content-available-height) overflow-y-auto subtle-scrollbar`,children:p}),t[17]=p,t[18]=m);let h;return t[19]!==f||t[20]!==m?(h=(0,Z.jsxs)(va,{children:[f,m]}),t[19]=f,t[20]=m,t[21]=h):h=t[21],h}function oP(e){let t=Object.fromEntries(iP.map(t=>[t.name,t.isActive(e.editor)]));return{current:iP.find(e=>t[e.name])??iP[0],activeStates:t}}function sP(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(n!==`File`&&n!==`WikiEmbedFile`)return null;let r=(t.attrs.props??{}).src;return typeof r!=`string`||r.length===0?null:r}function cP(e){let t=e.state.selection.node;if(!t)return``;let n=t.attrs.props??{},r=typeof n.alias==`string`?n.alias:``;if(r.length>0)return r;let i=typeof n.name==`string`?n.name:``;return i.length>0?i:C(typeof n.src==`string`?n.src:``)}function lP(e,t){let n=document.createElement(`a`);n.href=e,n.download=t,n.rel=`noopener noreferrer`,n.style.display=`none`,document.body.appendChild(n),n.click(),n.remove()}function uP(e){let t=(0,$.c)(13),{editor:n}=e,{_:r}=Bn(),i;if(t[0]===n?i=t[1]:(i={editor:n,selector:dP},t[0]=n,t[1]=i),Si(i)===null)return null;let a;t[2]===r?a=t[3]:(a=r({id:`WcWS__`}),t[2]=r,t[3]=a);let o;t[4]===n?o=t[5]:(o=e=>{e.preventDefault();let t=sP(n);t&&lP(t,cP(n))},t[4]=n,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(yf,{className:`size-3.5`}),t[6]=s):s=t[6];let c;t[7]!==a||t[8]!==o?(c=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":a,className:`text-accent-foreground`,onMouseDown:o,children:s})}),t[7]=a,t[8]=o,t[9]=c):c=t[9];let l;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Vr,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(Y,{id:`WcWS__`})}),t[10]=l):l=t[10];let u;return t[11]===c?u=t[12]:(u=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:(0,Z.jsxs)(Ur,{children:[c,l]})}),t[11]=c,t[12]=u),u}function dP(e){return sP(e.editor)}function fP(e){return sP(e)!==null}var pP=`img, .ok-embed, .ok-video`,mP=220,hP=`cubic-bezier(0.23, 1, 0.32, 1)`,gP=`ok-image-align-flip`,_P=.5;function vP(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function yP(){return typeof requestAnimationFrame==`function`}function bP(e){return e?e.querySelector(pP):null}function xP(e,t){if(vP()||!yP()){t();return}let n=bP(e);if(!n){t();return}let r=n.getBoundingClientRect().left;t(),requestAnimationFrame(()=>{let t=bP(e);if(!t)return;for(let e of t.getAnimations())e.id===gP&&e.cancel();let n=r-t.getBoundingClientRect().left;if(Math.abs(n)<_P)return;let i=t.animate([{transform:`translateX(${n}px)`},{transform:`translateX(0)`}],{duration:mP,easing:hP,fill:`none`});i.id=gP})}var SP=[{value:`left`,label:{id:`IR6Txi`},icon:Pb},{value:`center`,label:{id:`8nOdkO`},icon:Mb},{value:`right`,label:{id:`pd0UH2`},icon:Nb}];function CP(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(!x.has(String(n)))return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function wP(e){let t=(0,$.c)(8),{editor:n}=e,{_:r}=Bn(),i;t[0]===n?i=t[1]:(i={editor:n,selector:TP},t[0]=n,t[1]=i);let a=Si(i);if(a===null)return null;let o;t[2]!==r||t[3]!==a||t[4]!==n?(o=SP.map(e=>{let{value:t,label:i,icon:o}=e,s=a===t;return(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":r(i),"aria-pressed":s,className:s?`bg-accent text-primary`:`text-accent-foreground`,onMouseDown:e=>{e.preventDefault();let r=n.state.selection,i=r.node;if(!i||i.type.name!==`jsxComponent`)return;let a=String(i.attrs.componentName??``);if(!x.has(a)||i.attrs.kind!==`element`)return;let o=a===`CommonMarkImage`,s=r.from,c={...i.attrs.props??{},align:t},l=o?{...i.attrs,componentName:`img`,props:c,sourceDirty:!0}:{...i.attrs,props:c,sourceDirty:!0},u=n.state.tr.setNodeMarkup(s,null,l);u.setSelection(ds.create(u.doc,s)),xP(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(o,{className:`size-3.5`})})}),(0,Z.jsx)(Vr,{side:`bottom`,sideOffset:8,children:r(i)})]},t)}),t[2]=r,t[3]=a,t[4]=n,t[5]=o):o=t[5];let s;return t[6]===o?s=t[7]:(s=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:o}),t[6]=o,t[7]=s),s}function TP(e){return CP(e.editor)}function EP(e){return CP(e)!==null}function DP({editor:e}){if(E(e.state).query||e.isActive(`codeBlock`))return!1;if(EP(e)||fP(e))return!0;if(e.state.selection.empty)return!1;let{from:t,to:n}=e.state.selection;return!!Ec(e.state.doc,t,n,` `,{inlineOnly:!0}).trim()}function OP(e){throw Error(`Unhandled AddLinkShortcutAction variant: ${JSON.stringify(e)}`)}function kP(e){let{selection:t}=e.state;if(t.empty){if(!e.isActive(`link`))return null;let n=Lt(e.state,t.from,`link`);return n===null?null:{kind:`edit-link`,markId:n}}return!DP({editor:e})||EP(e)||fP(e)?null:{kind:`open-popover`}}function AP(e){let t=e.schema.nodes;return!!(t.footnoteReference&&t.footnoteDefinition)}function jP(e){let{from:t,to:n}=e.state.selection,r=!1;return e.state.doc.nodesBetween(t,n,e=>e.type.name===`footnoteReference`?(r=!0,!1):!0),r}function MP(e){let{$from:t,$to:n}=e.state.selection;return!t.sameParent(n)}function NP(e){let t=(0,$.c)(21),{editor:n}=e,{_:r}=Bn(),i;t[0]===n?i=t[1]:(i={editor:n,selector:PP},t[0]=n,t[1]=i);let o=Si(i),s;t[2]!==o||t[3]!==n?(s=()=>{if(o||!AP(n)||n.state.selection.empty||MP(n)||jP(n))return;let{from:e,to:t}=n.state.selection,r=n.state.doc.textBetween(e,t,` `);if(!r.trim())return;let i=tc(No(n.state.doc)),a=wc(n.state.doc)+1-(t-e);n.chain().focus().deleteSelection().insertFootnoteReference(i).insertContentAt(a,{type:`footnoteDefinition`,attrs:{identifier:i,label:i},content:[{type:`paragraph`,content:[{type:`text`,text:r}]}]}).run()},t[2]=o,t[3]=n,t[4]=s):s=t[4];let c=s,l;t[5]===r?l=t[6]:(l=r({id:`sIGbBZ`}),t[5]=r,t[6]=l);let u;t[7]===c?u=t[8]:(u=e=>{e.preventDefault(),c()},t[7]=c,t[8]=u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(a,{className:`size-3.5`,"aria-hidden":`true`}),t[9]=d):d=t[9];let f;t[10]!==o||t[11]!==l||t[12]!==u?(f=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"data-testid":`footnote-bubble-button`,className:`text-accent-foreground/80`,"aria-label":l,onMouseDown:u,disabled:o,children:d})}),t[10]=o,t[11]=l,t[12]=u,t[13]=f):f=t[13];let p;t[14]===r?p=t[15]:(p=r({id:`sIGbBZ`}),t[14]=r,t[15]=p);let m;t[16]===p?m=t[17]:(m=(0,Z.jsx)(Vr,{side:`bottom`,sideOffset:8,children:p}),t[16]=p,t[17]=m);let h;return t[18]!==f||t[19]!==m?(h=(0,Z.jsxs)(Ur,{children:[f,m]}),t[18]=f,t[19]=m,t[20]=h):h=t[20],h}function PP(e){let t=e.editor;return!!(!AP(t)||t.state.selection.empty||MP(t)||jP(t))}var FP=[{name:`bold`,icon:Ay,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcutId:`format-bold`},{name:`italic`,icon:eb,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcutId:`format-italic`},{name:`underline`,icon:zb,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcutId:`format-underline`},{name:`strikethrough`,icon:Ob,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcutId:`format-strike`},{name:`code`,icon:jn,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcutId:`format-inline-code`},{name:`highlight`,icon:$y,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcutId:`format-highlight`}];function IP(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:LP},t[0]=n,t[1]=r);let i=Si(r),a;t[2]!==i||t[3]!==n?(a=FP.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":e.name,className:r?`bg-accent text-primary`:`text-accent-foreground`,onMouseDown:t=>{t.preventDefault(),e.command(n)},children:(0,Z.jsx)(t,{className:`size-3.5`})})}),(0,Z.jsxs)(Vr,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(en,{"aria-label":Ac(e.shortcutId),children:Lc(e.shortcutId)})]})]},e.name)}),t[2]=i,t[3]=n,t[4]=a):a=t[4];let o;return t[5]===a?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:a}),t[5]=a,t[6]=o),o}function LP(e){return Object.fromEntries(FP.map(t=>[t.name,t.isActive(e.editor)]))}var RP=`open-knowledge:open-link-edit-popover`;function zP(e=typeof window>`u`?new EventTarget:window){e.dispatchEvent(new CustomEvent(RP))}function BP(e,t=typeof window>`u`?new EventTarget:window){let n=()=>e();return t.addEventListener(RP,n),()=>t.removeEventListener(RP,n)}function VP(e){return e.state.selection.empty&&e.isActive(`link`)?e.getAttributes(`link`).href??``:``}async function HP(e,t){let n;try{n=await navigator.clipboard.readText()}catch(e){e instanceof DOMException||console.warn(`[link-popover] clipboard pre-fill read failed unexpectedly`,e);return}let r=V(n);r!==null&&(t(e=>e===``?r:e),requestAnimationFrame(()=>{let t=e.current;t&&t.value===r&&t.select()}))}function UP(e,t,n,r){let i=VP(e);n(i),r(!0),i===``&&HP(t,n)}function WP(e){let t=(0,$.c)(72),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!1:r,{_:a}=Bn(),[o,s]=(0,Q.useState)(!1),[l,d]=(0,Q.useState)(``),f=(0,Q.useRef)(null),{folderPaths:p,loading:m,pages:h}=Nd(),g;t[0]===n?g=t[1]:(g=n.state.selection.empty&&n.isActive(`link`),t[0]=n,t[1]=g);let _=g,v;t[2]===n?v=t[3]:(v=n.getAttributes(`link`).href??``,t[2]=n,t[3]=v);let y=v,x,S;t[4]!==n||t[5]!==i?(x=()=>BP(()=>{i&&UP(n,f,d,s)}),S=[i,n],t[4]=n,t[5]=i,t[6]=x,t[7]=S):(x=t[6],S=t[7]),(0,Q.useEffect)(x,S);let C,w;t[8]!==n||t[9]!==i?(C=()=>{let e=e=>{if(!i||!Mc(e,`add-link`)||!n.editorView?.hasFocus())return;let t=kP(n);if(t!==null)switch(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),t.kind){case`open-popover`:zP();return;case`edit-link`:{let{markId:e}=t;u(e),requestAnimationFrame(()=>{b(n).setActiveNode(e)});return}default:OP(t)}};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},w=[i,n],t[8]=n,t[9]=i,t[10]=C,t[11]=w):(C=t[10],w=t[11]),(0,Q.useEffect)(C,w);let T,E;t[12]===n?(T=t[13],E=t[14]):(T=()=>{let e=function(){n.state.selection.empty&&s(!1)};return n.on(`selectionUpdate`,e),()=>{n.off(`selectionUpdate`,e)}},E=[n],t[12]=n,t[13]=T,t[14]=E),(0,Q.useEffect)(T,E);let D,O;t[15]===o?(D=t[16],O=t[17]):(D=()=>{if(!o)return;let e=!1,t=0,n=r=>{if(e)return;let i=f.current;i&&(i.focus(),document.activeElement===i)||(r<60?t=requestAnimationFrame(()=>n(r+1)):console.warn(`[link-popover] URL input never became focusable`))};return t=requestAnimationFrame(()=>n(0)),()=>{e=!0,cancelAnimationFrame(t)}},O=[o],t[15]=o,t[16]=D,t[17]=O),(0,Q.useEffect)(D,O);let k;t[18]!==n||t[19]!==_||t[20]!==l?(k=function(){l.trim()?n.chain().focus().setLink({href:l.trim()}).run():_&&n.chain().focus().unsetLink().run(),s(!1)},t[18]=n,t[19]=_,t[20]=l,t[21]=k):k=t[21];let A=k,j;t[22]===n?j=t[23]:(j=function(){n.chain().focus().unsetLink().run(),s(!1)},t[22]=n,t[23]=j);let M=j,N;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(N=function(e){d(bi(e.path,null))},t[24]=N):N=t[24];let P=N,F;t[25]!==A||t[26]!==n?(F=function(e){e.key===`Enter`&&(e.preventDefault(),A()),e.key===`Escape`&&(e.preventDefault(),s(!1),n.chain().focus().run())},t[25]=A,t[26]=n,t[27]=F):F=t[27];let I=F;if(o){let e;t[28]===a?e=t[29]:(e=a({id:`ZsGpr_`}),t[28]=a,t[29]=e);let n;t[30]===a?n=t[31]:(n=a({id:`roAe2K`}),t[30]=a,t[31]=n);let r;t[32]!==p||t[33]!==I||t[34]!==m||t[35]!==h||t[36]!==e||t[37]!==n||t[38]!==l?(r=(0,Z.jsx)(c,{ref:f,type:`text`,placeholder:e,value:l,pages:h,folderPaths:p,loading:m,onValueChange:d,onSuggestionSelect:P,onKeyDown:I,"aria-label":n,className:`h-5 w-44 rounded-none border-none bg-transparent px-0 py-0 text-sm placeholder:text-muted-foreground focus-visible:border-transparent focus-visible:ring-0 dark:bg-transparent`}),t[32]=p,t[33]=I,t[34]=m,t[35]=h,t[36]=e,t[37]=n,t[38]=l,t[39]=r):r=t[39];let i;t[40]===a?i=t[41]:(i=a({id:`tP5DDk`}),t[40]=a,t[41]=i);let o;t[42]===A?o=t[43]:(o=()=>{A()},t[42]=A,t[43]=o);let s;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(zy,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[44]=s):s=t[44];let u;t[45]!==i||t[46]!==o?(u=(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":i,onClick:o,children:s}),t[45]=i,t[46]=o,t[47]=u):u=t[47];let g;t[48]!==r||t[49]!==u?(g=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border bg-background px-2 py-1 focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[r,u]}),t[48]=r,t[49]=u,t[50]=g):g=t[50];let v;t[51]!==a||t[52]!==y||t[53]!==_||t[54]!==M?(v=_&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":a({id:`2vIPtm`}),onMouseDown:e=>{e.preventDefault(),_i(y)},children:(0,Z.jsx)(ju,{className:`size-3.5`})})}),(0,Z.jsx)(Vr,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(Y,{id:`2vIPtm`})})]}),(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":a({id:`484LKL`}),onMouseDown:e=>{e.preventDefault(),M()},children:(0,Z.jsx)(Ip,{className:`size-3.5`})})}),(0,Z.jsx)(Vr,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(Y,{id:`484LKL`})})]})]}),t[51]=a,t[52]=y,t[53]=_,t[54]=M,t[55]=v):v=t[55];let b;return t[56]!==g||t[57]!==v?(b=(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[g,v]}),t[56]=g,t[57]=v,t[58]=b):b=t[58],b}let L;t[59]===a?L=t[60]:(L=a({id:`p0Iq25`}),t[59]=a,t[60]=L);let R=_?`bg-accent text-primary`:`text-accent-foreground`,z;t[61]===n?z=t[62]:(z=e=>{e.preventDefault(),UP(n,f,d,s)},t[61]=n,t[62]=z);let B;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(rb,{className:`size-3.5`}),t[63]=B):B=t[63];let V;t[64]!==L||t[65]!==R||t[66]!==z?(V=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":L,className:R,onMouseDown:z,children:B})}),t[64]=L,t[65]=R,t[66]=z,t[67]=V):V=t[67];let ee;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(Y,{id:`yzF66j`}),t[68]=ee):ee=t[68];let H;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsxs)(Vr,{side:`bottom`,sideOffset:8,children:[ee,(0,Z.jsx)(en,{children:Lc(`add-link`)})]}),t[69]=H):H=t[69];let U;return t[70]===V?U=t[71]:(U=(0,Z.jsxs)(Ur,{children:[V,H]}),t[70]=V,t[71]=U),U}function GP(e){let t=(0,$.c)(18),{editor:n}=e,{_:r}=Bn(),i;t[0]===n?i=t[1]:(i=()=>{let e=ki(n),t=ji(n);e===null||!t||qu({editor:n,docName:e,ytext:t.getText(`source`)})},t[0]=n,t[1]=i);let a=i,o;t[2]===r?o=t[3]:(o=r({id:`M0jOcG`}),t[2]=r,t[3]=o);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(hg,{className:`size-3.5`,"aria-hidden":`true`}),t[4]=s):s=t[4];let c;t[5]!==a||t[6]!==o?(c=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"data-testid":`view-in-source-bubble-button`,className:`text-accent-foreground/80`,"aria-label":o,onMouseDown:KP,onClick:a,children:s})}),t[5]=a,t[6]=o,t[7]=c):c=t[7];let l;t[8]===r?l=t[9]:(l=r({id:`M0jOcG`}),t[8]=r,t[9]=l);let u;t[10]===l?u=t[11]:(u=(0,Z.jsx)(`span`,{children:l}),t[10]=l,t[11]=u);let d;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(en,{"aria-label":Ac(`view-source-at-cursor`),children:Lc(`view-source-at-cursor`)}),t[12]=d):d=t[12];let f;t[13]===u?f=t[14]:(f=(0,Z.jsxs)(Vr,{side:`bottom`,sideOffset:8,children:[u,d]}),t[13]=u,t[14]=f);let p;return t[15]!==c||t[16]!==f?(p=(0,Z.jsxs)(Ur,{children:[c,f]}),t[15]=c,t[16]=f,t[17]=p):p=t[17],p}function KP(e){return e.preventDefault()}function qP(e){let t=(0,$.c)(39),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!0:r,a=(0,Q.useRef)(null),[o,s]=(0,Q.useState)(0),c=(0,Q.useRef)(null),l;t[0]===n?l=t[1]:(l={editor:n,selector:ZP},t[0]=n,t[1]=l);let u=Si(l),d;t[2]===n?d=t[3]:(d={editor:n,selector:XP},t[2]=n,t[3]=d);let f=Si(d),p;t[4]!==n.state||t[5]!==n.view?(p=()=>{try{let{from:e,to:t}=n.state.selection;return Mo(n.view,e,t)}catch{return new DOMRect}},t[4]=n.state,t[5]=n.view,t[6]=p):p=t[6];let m;t[7]!==n.view.dom||t[8]!==p?(m={getBoundingClientRect:p,contextElement:n.view.dom},t[7]=n.view.dom,t[8]=p,t[9]=m):m=t[9];let h=m,g;t[10]===n?g=t[11]:(g=Ei(n),t[10]=n,t[11]=g);let _=g,v;t[12]===n?v=t[13]:(v=Ii(n),t[12]=n,t[13]=v);let y=v,b;t[14]===n?b=t[15]:(b=Ri(n),t[14]=n,t[15]=b);let x=b,S;t[16]!==_||t[17]!==y||t[18]!==x||t[19]!==h?(S=()=>{let e=a.current;e&&(c.current?.(),c.current=Ki(h,e,()=>{Hi(h,e,{placement:`top`,strategy:`fixed`,middleware:[Ui(8),Bi(_),Yi(y),Vi(x),Gi(_)]}).then(t=>{let{x:n,y:r,middlewareData:i}=t;e.isConnected&&(e.style.position=`fixed`,e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.visibility=i.hide?.referenceHidden?`hidden`:`visible`)}).catch(t=>{e.isConnected&&console.warn(`[bubble-menu] computePosition failed`,t)})}))},t[16]=_,t[17]=y,t[18]=x,t[19]=h,t[20]=S):S=t[20];let C=S,w;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>{c.current?.(),c.current=null,s(YP)},t[21]=w):w=t[21];let T=w,E;t[22]===n?E=t[23]:(E=Ii(n,{pendingOffsetPx:8}),t[22]=n,t[23]=E);let D;t[24]!==_||t[25]!==C||t[26]!==x||t[27]!==E?(D={onShow:C,onHide:T,strategy:`fixed`,placement:`top`,offset:8,flip:_,shift:E,size:x,hide:_},t[24]=_,t[25]=C,t[26]=x,t[27]=E,t[28]=D):D=t[28];let O;t[29]!==n||t[30]!==f||t[31]!==u||t[32]!==i||t[33]!==o?(O=u?(0,Z.jsx)(wP,{editor:n},`${o}-img-align`):f?(0,Z.jsx)(uP,{editor:n},`${o}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(aP,{editor:n}),(0,Z.jsx)(La,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(IP,{editor:n},o),(0,Z.jsx)(La,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(WP,{editor:n,shortcutEnabled:i},`${o}-link`),(0,Z.jsx)(NP,{editor:n},`${o}-footnote`),(0,Z.jsx)(GP,{editor:n},`${o}-view-source`),(0,Z.jsx)(nP,{},`${o}-comment`)]}),t[29]=n,t[30]=f,t[31]=u,t[32]=i,t[33]=o,t[34]=O):O=t[34];let k;return t[35]!==n||t[36]!==D||t[37]!==O?(k=(0,Z.jsx)(tP,{ref:a,editor:n,"data-testid":`bubble-menu-bar`,appendTo:JP,shouldShow:DP,updateDelay:250,options:D,className:`z-50 flex flex-wrap items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:O}),t[35]=n,t[36]=D,t[37]=O,t[38]=k):k=t[38],k}function JP(){return document.body}function YP(e){return e+1}function XP(e){return fP(e.editor)}function ZP(e){return EP(e.editor)}var QP=new Lo(`bareHtmlImageDecoration`);function $P(e){let t=[],n=0;for(;n<e.length;){let r=e.indexOf(`<img`,n);if(r===-1)break;let i=e[r+4];if(i!==`>`&&i!==void 0&&!/\s/.test(i)){n=r+4;continue}let a=null,o=r+4;for(;o<e.length;o+=1){let t=e[o];if(a!==null)t===a&&(a=null);else if(t===`"`||t===`'`)a=t;else if(t===`>`)break;else if(t===`<`)break}e[o]===`>`&&t.push({index:r,raw:e.slice(r,o+1)}),n=Math.max(r+4,o+1)}return t}function eF(e,t){let n=e.getAttribute(`src`);if(n===null||so(n,t,{literal:!1})===null)return null;let r=e.getAttribute(`loading`),i=e.getAttribute(`decoding`),a=e.getAttribute(`fetchpriority`),o=e.getAttribute(`crossorigin`),s=e.getAttribute(`referrerpolicy`);return{src:zs(n,t),alt:e.getAttribute(`alt`)??``,width:e.getAttribute(`width`)??void 0,height:e.getAttribute(`height`)??void 0,title:e.getAttribute(`title`)??void 0,srcset:e.getAttribute(`srcset`)??void 0,sizes:e.getAttribute(`sizes`)??void 0,loading:r===`eager`||r===`lazy`?r:void 0,decoding:i===`sync`||i===`async`||i===`auto`?i:void 0,fetchpriority:a===`high`||a===`low`||a===`auto`?a:void 0,crossorigin:o===``||o===`anonymous`||o===`use-credentials`?o:void 0,referrerpolicy:s===``||s===`no-referrer`||s===`no-referrer-when-downgrade`||s===`origin`||s===`origin-when-cross-origin`||s===`same-origin`||s===`strict-origin`||s===`strict-origin-when-cross-origin`||s===`unsafe-url`?s:void 0}}function tF(e,t){if(!e.startsWith(`<img`)||e.endsWith(`/>`))return null;let n=document.createElement(`template`);if(n.innerHTML=e,n.content.childNodes.length!==1)return null;let r=n.content.firstElementChild;return r instanceof HTMLImageElement?eF(r,t):null}function nF(e,t){return t?.type.spec.code===!0||t?.type.name.toLowerCase().includes(`codeblock`)?!0:e.marks.some(e=>[`code`,`escapeMark`,`sourceLiteral`].includes(e.type.name))}function rF(e,t){let n=[];return e.descendants((e,r,i)=>{if(!(!e.isText||e.text===void 0||nF(e,i)))for(let i of $P(e.text)){let e=tF(i.raw,t);if(e===null)continue;let a=r+i.index;n.push({...i,from:a,to:a+i.raw.length,props:e})}}),n}function iF(e,t,n){let r=[];for(let i of rF(e,n)){let{from:e,to:n,props:a}=i,o=null;r.push(fo.inline(e,n,{"aria-hidden":`true`,class:`hidden ok-bare-html-image-source`}),fo.widget(e,()=>(o=new ui(On,{editor:t,props:a,as:`span`,className:`ok-bare-html-image-render`}),o.element.setAttribute(`contenteditable`,`false`),o.element),{side:-1,key:`${e}:${i.raw}`,destroy:()=>o?.destroy()}))}return ls.create(e,r)}function aF(e){return Rs.create({name:`bareHtmlImageDecoration`,addProseMirrorPlugins(){let t=this.editor;return[new Do({key:QP,state:{init:(n,r)=>iF(r.doc,t,e),apply:(n,r)=>n.docChanged?iF(n.doc,t,e):r.map(n.mapping,n.doc)},props:{decorations:e=>QP.getState(e)??ls.empty}})]}})}var oF=`0 2px 4px rgba(0, 0, 0, 0.08)`,sF=150,cF=globalThis.ScrollTimeline;function lF(e,t,n,r,i){let a=r-i;if(a<=0)return null;let o=e+n-(t+Di());return{startOffset:o,endOffset:o+a,maxShift:a}}var uF=new WeakMap;function dF(e){let t=uF.get(e);if(t){for(let e of t.animations)e.cancel();uF.delete(e)}}function fF(e){for(let t of Array.from(e.cells))dF(t)}var pF=e=>e.cellIndex===0?`3`:`2`;function mF(e,t){return hF(e,t,e=>({transform:`translateY(${e}px)`}))}function hF(e,t,n){if(!(t>0))return[{offset:0,...n(0)},{offset:1,...n(0)}];let r=t=>Math.max(0,Math.min(t-e.startOffset,e.maxShift));return Array.from(new Set([0,e.startOffset/t,e.endOffset/t,1].map(e=>Math.max(0,Math.min(e,1))))).sort((e,t)=>e-t).map(e=>({offset:e,...n(r(e*t))}))}function gF(e,t,n,r){if(!(t>0))return[{...n,offset:0},{...n,offset:1}];let i=e.startOffset/t;if(i<=0)return[{...r,offset:0},{...r,offset:1}];if(i>=1)return[{...n,offset:0},{...n,offset:1}];let a=Math.min(i+1/t,1);return[{...n,offset:0},{...n,offset:i},{...r,offset:a},{...r,offset:1}]}function _F(e,t,n){return gF(e,t,{zIndex:`auto`,boxShadow:`none`},{zIndex:n,boxShadow:oF})}function vF(e,t){return gF(e,t,{opacity:`0`},{opacity:`1`})}function yF(e,t,n,r){let i=pF(e),a=`sd|${n.startOffset}|${n.maxShift}|${r}|${i}`,o=uF.get(e);if(o?.key===a)return;if(o)for(let e of o.animations)e.cancel();let s={timeline:t,fill:`both`,easing:`linear`},c=e.animate(mF(n,r),s),l=e.animate(_F(n,r,i),s),u=e.animate(vF(n,r),{...s,pseudoElement:`::before`});uF.set(e,{key:a,animations:[c,l,u]})}function bF(e,t){let n=pF(e),r=`in|${t}|${n}`,i=uF.get(e);if(i?.key===r)return;if(i)for(let e of i.animations)e.cancel();let a=e.animate([{transform:`translateY(${t}px)`,zIndex:n,boxShadow:oF}],{duration:0,fill:`forwards`}),o=e.animate([{opacity:`1`}],{duration:0,fill:`forwards`,pseudoElement:`::before`});uF.set(e,{key:r,animations:[a,o]})}function xF(e,t,n,r){let i=e.getBoundingClientRect().top,a=e.scrollTop,o=e.scrollHeight-e.clientHeight,s=t.querySelectorAll(`.tableWrapper`);for(let e of s){r?.(e);let t=e.querySelector(`table`);if(!t)continue;let s=t.querySelector(`tbody`)?.rows[0];if(!s||!Array.from(s.cells).some(e=>e.tagName===`TH`))continue;let c=t.getBoundingClientRect(),l=s.getBoundingClientRect(),u=lF(a,i,c.top,c.height,l.height);if(!u){fF(s);continue}if(n){if(o<=0){fF(s);continue}for(let e of Array.from(s.cells))yF(e,n,u,o);continue}let d=Math.max(0,Math.min(a-u.startOffset,u.maxShift));if(d<=0||c.bottom<=i+Di()){fF(s);continue}for(let e of Array.from(s.cells))bF(e,d)}}var SF=Rs.create({name:`frozenTableHeaders`,addProseMirrorPlugins(){return[new Do({key:new Lo(`frozenTableHeaders`),view(e){let t=null,n=null,r=null,i=null,a=null,o=!1,s=new Set,c=()=>{o||!t||xF(t,e.dom,n,u)},l=()=>{r??=requestAnimationFrame(()=>{r=null,c()})};function u(e){s.has(e)||(s.add(e),e.addEventListener(`contentvisibilityautostatechange`,l))}let d=()=>{if(n){i??l(),i!=null&&clearTimeout(i),i=setTimeout(()=>{i=null,c()},sF);return}l()};return requestAnimationFrame(()=>{if(!o){if(t=e.dom.closest(`[data-testid="editor-scroll-container"]`),t&&cF)try{n=new cF({source:t,axis:`block`})}catch{n=null}t?.addEventListener(`scroll`,d,{passive:!0}),t&&typeof ResizeObserver<`u`&&(a=new ResizeObserver(l),a.observe(t),a.observe(e.dom)),c()}}),{update(e,t){t.doc.eq(e.state.doc)||c()},destroy(){o=!0,t?.removeEventListener(`scroll`,d),a?.disconnect(),r!=null&&cancelAnimationFrame(r),i!=null&&clearTimeout(i);for(let e of s)e.removeEventListener(`contentvisibilityautostatechange`,l);s.clear();for(let t of e.dom.querySelectorAll(`.tableWrapper > table > tbody > tr:first-child`))fF(t)}}}})]}}),CF=6,wF=`22rem`,TF=new Lo(`markdownLintDecorations`),EF=`ok-lint-block`,DF=`ok-lint-block-error`,OF=`ok-lint-block-atom`,kF=400;function AF(e){return Js(e)}function jF(e,t,n){let r=new Map;if(t.length===0)return r;let{spans:i,fmLineCount:a}=od(e,n);for(let e of t){if(AF(e))continue;let t=e.range.start.line+1;if(a>0&&t<=a)continue;let n=ad(i,t);if(n===null)continue;let o=r.get(n);o?o.push(e):r.set(n,[e])}return r}var MF=`data-ok-lint`,NF=`data-ok-lint-fixable`;function PF(e,t){let n=new Map;if(t.size===0)return{set:ls.empty,fixesByOffset:n};let r=[],i=0;return e.forEach((e,a)=>{let o=t.get(i);if(i+=1,!o||o.length===0)return;let s=o.some(e=>e.severity===`error`),c=o.map(e=>`${e.source}/${e.code}: ${e.message}`).join(`
8
- `),l=[EF];e.textContent.length===0&&l.push(OF),s&&l.push(DF);let u={class:l.join(` `),[MF]:c},d=sE(o);d.length>0&&(u[NF]=`1`,n.set(a,d)),r.push(fo.node(a,a+e.nodeSize,u))}),{set:ls.create(e,r),fixesByOffset:n}}function FF(e,t){let n=document.createElement(`div`);n.className=`ok-lint-tooltip`,n.hidden=!0;let r=document.createElement(`div`);r.className=`ok-lint-tooltip-message`,n.appendChild(r);let i=document.createElement(`button`);i.type=`button`,i.className=gr(`ok-lint-tooltip-fix`,Lr({variant:`default`,size:`xs`}),`mt-1 self-start`),i.hidden=!0,n.appendChild(i),n.style.position=`fixed`,n.style.top=`0`,n.style.left=`0`,document.body.appendChild(n);let a=null,o=!1,s=null,c=null,l=0,u=0,d=0,f={getBoundingClientRect:()=>({width:0,height:d-u,x:l,y:u,top:u,left:l,right:l,bottom:d})};function p(){s!==null&&(clearTimeout(s),s=null)}function m(){p(),a=null,n.hidden=!0,c?.(),c=null}function h(){o||(p(),s=setTimeout(m,140))}let g=Ei(t.editor),_=Ii(t.editor),v=Ri(t.editor,{authorMaxWidth:wF});function y(){Hi(f,n,{placement:`top-start`,middleware:[Ui(CF),Bi(g),Yi(_),Vi(v)]}).then(({x:e,y:t})=>{n.isConnected&&(n.style.left=`${e}px`,n.style.top=`${t}px`)}).catch(e=>{n.isConnected&&console.warn(`[markdown-lint] tooltip computePosition failed`,e)})}function b(e){let s=e.getAttribute(MF);if(!s){h();return}p(),a=e,r.textContent=s;let l=t.applyFix?t.getFixes(e):[];l.length>0&&t.applyFix?(i.hidden=!1,i.textContent=Hc._({id:`c4fVUV`}),i.onclick=()=>{t.applyFix?.(l),o=!1,m()}):(i.hidden=!0,i.onclick=null),n.hidden=!1,c?.(),c=Ki(f,n,y)}function x(t){let n=t,r=t.target?.closest(`.${EF}`)??null;if(r)if(r!==a){l=n.clientX;let t=e.posAtCoords({left:n.clientX,top:n.clientY}),i=t?e.coordsAtPos(t.pos):null,a=i&&i.bottom>i.top?i:r.getBoundingClientRect();u=a.top,d=a.bottom,b(r)}else p();else a&&h()}function S(e){let t=e.relatedTarget;if(t===n||t?.closest(`.ok-lint-tooltip`)){p();return}t?.closest(`.${EF}`)||h()}function C(){o=!0,p()}function w(e){o=!1;let t=e.relatedTarget;t!==a&&!t?.closest(`.${EF}`)&&h()}function T(){o=!1,m()}return n.addEventListener(`pointerenter`,C),n.addEventListener(`pointerleave`,w),e.dom.addEventListener(`pointerover`,x),e.dom.addEventListener(`pointerout`,S),e.dom.addEventListener(`keydown`,T),{destroy(){p(),c?.(),e.dom.removeEventListener(`pointerover`,x),e.dom.removeEventListener(`pointerout`,S),e.dom.removeEventListener(`keydown`,T),n.remove()}}}var IF=Rs.create({name:`markdownLintDecorations`,addOptions(){return{docName:``,getSource:void 0,applyFix:void 0}},addProseMirrorPlugins(){let{docName:e,getSource:t,applyFix:n}=this.options,{editor:r}=this,i=new Ds({extensions:fs});return[new Do({key:TF,state:{init:()=>ls.empty,apply(e,t){return e.getMeta(TF)||t.map(e.mapping,e.doc)}},props:{decorations(e){return TF.getState(e)??null}},view(a){let o=null,s=null,c=!1,l=0,u=new Map;async function d(){if(c)return;let n=t?.()??null,r=o?.enabled?await f(o):{kind:`ok`,set:ls.empty,fixesByOffset:new Map};if(c||r.kind===`stale`)return;if(r.kind===`mismatch`){l<2&&(l+=1,p());return}l=0,u=r.fixesByOffset;let i=r.set,s=TF.getState(a.state)??ls.empty;if((i.find().length>0||s.find().length>0)&&a.dispatch(a.state.tr.setMeta(TF,i)),o?.enabled){let t=Qu(e);t?.kind===`lint`&&_(t.detail)&&nd(e)}n!==null&&!c&&t?.()!==n&&p()}async function f(n){let r=a.state.doc,o=t?.()??i.serialize(r.toJSON()),s=await $s(o,n,e);if(!a.state.doc.eq(r))return{kind:`stale`};let{spans:c}=od(o,i);return c.length===id(r)?{kind:`ok`,...PF(r,jF(o,s,i))}:{kind:`mismatch`}}function p(){s&&clearTimeout(s),s=setTimeout(()=>{d().catch(e=>{console.warn(`[markdown-lint] decoration pass failed`,e)})},kF)}let m=0;async function h(){let t=++m,n=await rg(e);c||t!==m||(o=n,await d())}let g=()=>{h().catch(e=>{console.warn(`[markdown-lint] config load/lint pass failed`,e)})};function _(n){if(!a.dom.isConnected||a.dom.offsetParent===null||Js(n))return!1;let{spans:r,fmLineCount:o}=od(t?.()??i.serialize(a.state.doc.toJSON()),i);if(r.length!==id(a.state.doc)||o>0&&n.line<=o)return!1;let s=ad(r,n.line);if(s===null)return!1;let c=-1;return a.state.doc.forEach((e,t,n)=>{n===s&&(c=t)}),c<0?!1:re(e,`problems-row`,()=>{a.dispatch(a.state.tr.setSelection(ys.near(a.state.doc.resolve(c+1)))),a.focus();let e=a.nodeDOM(c);e instanceof HTMLElement&&e.scrollIntoView({behavior:`smooth`,block:`start`})})}function v(t){let n=t.detail;!n||n.docName!==e||c||_(n)&&nd(e)}g();let y=ng(g),b=FF(a,{getFixes:e=>{if(e.getAttribute(NF)!==`1`||u.size===0)return[];let t;try{t=a.posAtDOM(e,0)}catch(e){return console.warn(`[markdown-lint] posAtDOM failed on lint block; Fix button suppressed`,e),[]}let n=Math.min(Math.max(t,0),a.state.doc.content.size),r=a.state.doc.resolve(n),i=r.depth>=1?r.before(1):0;return u.get(i)??[]},applyFix:n,editor:r});window.addEventListener(md,v);let x=()=>{c||p()};return window.addEventListener(iE,x),{update(e,t){e.state.doc!==t.doc&&p()},destroy(){c=!0,s&&clearTimeout(s),y(),b.destroy(),window.removeEventListener(md,v),window.removeEventListener(iE,x)}}}})]}}),LF=1400,RF=new Lo(`okAgentInsertFlash`);function zF(e,t){let n=e.content.findDiffStart(t.content);if(n==null)return null;let r=e.content.findDiffEnd(t.content),i=t.content.size,a=Math.max(0,Math.min(n,i)),o=Math.max(a,Math.min(r?.b??i,i));return o<=a?null:{from:a,to:o}}var BF=6e3;function VF(){return new Do({key:RF,state:{init:()=>ls.empty,apply(e,t){let n=t.map(e.mapping,e.doc),r=e.getMeta(RF);if(r===void 0)return n;if(r.sweep===!0){let e=n.find().filter(e=>r.now-(e.spec.addedAt??0)>=LF);e.length>0&&(n=n.remove(e))}if(r.add!==void 0&&r.add.to>r.add.from){let t={addedAt:r.now};n=n.add(e.doc,[fo.inline(r.add.from,r.add.to,{class:`ok-agent-insert-flash`},t)])}return n}},props:{decorations(e){return RF.getState(e)}}})}function HF(e,t,n){if(t<0||t>e.content.size)return null;let r=Ns(e.resolve(t));return r?n===`row`?Os.rowSelection(r):Os.colSelection(r):null}function UF(e){if(!(e instanceof Os))return null;let t=e.$anchorCell.node(-1);if(!t)return null;let n=e.$anchorCell.start(-1),r=Ys.get(t),i=r.rectBetween(e.$anchorCell.pos-n,e.$headCell.pos-n),a=r.map[i.top*r.width+i.left];return a===void 0?null:n+a}function WF(e,t,n){let{view:r,state:i}=e,a;try{a=r.posAtDOM(t,0)}catch(e){console.warn(`[TableCellHandles] posAtDOM failed on handle anchor; axis not selected`,e);return}let o=HF(i.doc,a,n);o&&r.dispatch(i.tr.setSelection(o))}var GF=5,KF=1;function qF(e){let t=(0,$.c)(14),{editor:n,axis:r,anchor:i,onClickGesture:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(null),c=(0,Q.useRef)(a),l,u;t[0]===a?(l=t[1],u=t[2]):(l=()=>{c.current=a},u=[a],t[0]=a,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u);let d,f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>()=>{s.current?.abort(),s.current=null,o.current=null,document.body.style.cursor=``,document.body.style.userSelect=``},f=[],t[3]=d,t[4]=f):(d=t[3],f=t[4]),(0,Q.useEffect)(d,f);let[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>!(e&&o.current!==null),t[5]=_):_=t[5];let v=_,y;t[6]!==i||t[7]!==r||t[8]!==n?(y=e=>{if(e.button!==0)return;s.current?.abort(),o.current={startX:e.clientX,startY:e.clientY,isDragging:!1,lastTarget:null};let t=new AbortController;s.current=t;let{signal:a}=t,l=e=>{let t=o.current;if(!t)return;if(!t.isDragging){let n=e.clientX-t.startX,r=e.clientY-t.startY;if(Math.hypot(n,r)<GF)return;t.isDragging=!0,m(!0),document.body.style.cursor=`grabbing`,document.body.style.userSelect=`none`}let n=JF(i,r,e.clientX,e.clientY);t.lastTarget=n,g(n)},u=()=>{t.abort(),s.current===t&&(s.current=null),document.body.style.cursor=``,document.body.style.userSelect=``;let e=o.current;o.current=null,m(!1),g(null),e&&(e.isDragging&&e.lastTarget?QF(n,i,r,e.lastTarget.index):e.isDragging||c.current())};document.addEventListener(`pointermove`,l,{signal:a}),document.addEventListener(`pointerup`,u,{signal:a}),document.addEventListener(`pointercancel`,u,{signal:a})},t[6]=i,t[7]=r,t[8]=n,t[9]=y):y=t[9];let b=y,x;return t[10]!==h||t[11]!==p||t[12]!==b?(x={onPointerDown:b,shouldAllowOpen:v,isDragging:p,indicator:h},t[10]=h,t[11]=p,t[12]=b,t[13]=x):x=t[13],x}function JF(e,t,n,r){let i=e.closest(`table`);if(!i)return null;let a=i.getBoundingClientRect();if(t===`row`){let e=Array.from(i.rows);if(e.length===0)return null;for(let t=0;t<e.length;t++){let n=e[t].getBoundingClientRect();if(r<n.top)return{index:KF,rect:XF(a,YF(e,0,n.top))};if(r<=n.bottom){let i=r>=n.top+n.height/2,o=i?t+1:t,s=Math.max(KF,o);return{index:s,rect:XF(a,s===o?i?n.bottom:n.top:YF(e,0,n.top))}}}let t=e[e.length-1].getBoundingClientRect();return{index:e.length,rect:XF(a,t.bottom)}}let o=i.rows[0];if(!o)return null;let s=Array.from(o.cells);if(s.length===0)return null;for(let e=0;e<s.length;e++){let t=s[e].getBoundingClientRect();if(n<t.left)return{index:0,rect:ZF(a,t.left)};if(n<=t.right){let r=n>=t.left+t.width/2,i=r?t.right:t.left;return{index:r?e+1:e,rect:ZF(a,i)}}}let c=s[s.length-1].getBoundingClientRect();return{index:s.length,rect:ZF(a,c.right)}}function YF(e,t,n){let r=e[t];return r?r.getBoundingClientRect().bottom:n}function XF(e,t){return{left:e.left,top:t-1,width:e.width,height:2}}function ZF(e,t){return{left:t-1,top:e.top,width:2,height:e.height}}function QF(e,t,n,r){let i=n===`row`?$F(t):t.cellIndex;if(i<0||n===`row`&&(i<KF||r<KF)||r===i||r===i+1)return;let{state:a,view:o}=e,s=eI(a.selection.$from);if(s<0){console.warn(`[table-drag-reorder] no table found at selection depth`);return}let c=a.doc.nodeAt(s);if(!c){console.warn(`[table-drag-reorder] nodeAt returned null at tablePos`,s);return}let l=a.tr;rI(l,s,c,n===`row`?tI(c,i,r):nI(c,i,r)),o.dispatch(l)}function $F(e){let t=e.parentElement,n=t?.closest(`table`);return n?Array.prototype.indexOf.call(n.rows,t):-1}function eI(e){for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole===`table`)return e.before(t);return-1}function tI(e,t,n){let r=[];e.forEach(e=>{r.push(e)});let[i]=r.splice(t,1),a=n>t?n-1:n;return r.splice(a,0,i),e.type.create(e.attrs,r,e.marks)}function nI(e,t,n){let r=n>t?n-1:n,i=[];return e.forEach(e=>{let n=[];e.forEach(e=>{n.push(e)});let[a]=n.splice(t,1);n.splice(r,0,a),i.push(e.type.create(e.attrs,n,e.marks))}),e.type.create(e.attrs,i,e.marks)}function rI(e,t,n,r){e.replaceRangeWith(t,t+n.nodeSize,r)}function iI(e){return[...e?[{id:`toggle-header-column`,label:{id:`JddocZ`},icon:Iy,run:e=>e.chain().focus().toggleHeaderColumn().run()}]:[],{id:`insert-column-left`,label:{id:`ZJ99sD`},icon:Au,run:e=>e.chain().focus().addColumnBefore().run()},{id:`insert-column-right`,label:{id:`9EykGQ`},icon:Du,run:e=>e.chain().focus().addColumnAfter().run()},{id:`delete-column`,label:{id:`GAohqx`},icon:Ip,separatorBefore:!0,run:e=>e.chain().focus().deleteColumn().run()},{id:`delete-table`,label:{id:`HSI88F`},icon:Zy,run:e=>e.chain().focus().deleteTable().run()}]}function aI(e){return[...e?[{id:`toggle-header-row`,label:{id:`61i3cO`},icon:kb,run:e=>e.chain().focus().toggleHeaderRow().run()}]:[],{id:`insert-row-above`,label:{id:`JrqL_z`},icon:Tu,run:e=>e.chain().focus().addRowBefore().run()},{id:`insert-row-below`,label:{id:`CUmCwI`},icon:Eu,run:e=>e.chain().focus().addRowAfter().run()},{id:`delete-row`,label:{id:`0cspe_`},icon:Ip,separatorBefore:!0,run:e=>e.chain().focus().deleteRow().run()},{id:`delete-table`,label:{id:`HSI88F`},icon:Zy,run:e=>e.chain().focus().deleteTable().run()}]}function oI(e){if(!e.isEditable||E(e.state).query)return null;let{state:t,view:n}=e,r=UF(t.selection)??-1;if(r<0){let e=t.selection.$from;for(let t=e.depth;t>0;t--){let n=e.node(t).type.spec.tableRole;if(n===`cell`||n===`header_cell`){r=e.before(t);break}}}if(r<0)return null;let i=n.nodeDOM(r);if(!(i instanceof HTMLTableCellElement))return null;let a=i.closest(`table`),o=i.closest(`tr`),s=i.closest(`.ProseMirror`);if(!a||!o||!s)return null;let c=Array.prototype.indexOf.call(a.rows,o),l=i.cellIndex,u=a.rows[0]?.cells[l],d=a.rows[c]?.cells[0];return!u||!d?null:{columnAnchor:u,rowAnchor:d,isFirstColumn:l===0,isFirstRow:c===0}}function sI(e){let t=(0,$.c)(46),{editor:n,anchor:r,axis:i,items:a}=e,o=(0,Q.useRef)(null),{_:s}=Bn(),[c,l]=(0,Q.useState)(!1),u;t[0]!==r||t[1]!==i||t[2]!==n?(u=()=>{WF(n,r,i),l(!0)},t[0]=r,t[1]=i,t[2]=n,t[3]=u):u=t[3];let d;t[4]!==r||t[5]!==i||t[6]!==n||t[7]!==u?(d={editor:n,axis:i,anchor:r,onClickGesture:u},t[4]=r,t[5]=i,t[6]=n,t[7]=u,t[8]=d):d=t[8];let f=qF(d),p,m;t[9]!==r||t[10]!==i?(p=()=>{let e=o.current;if(!e)return;let t=i===`column`?`top`:`left`,n=i===`column`?-14:-6;return Ki(r,e,()=>{Hi(r,e,{strategy:`absolute`,placement:t,middleware:[Ui(n)]}).then(t=>{let{x:n,y:r}=t;e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.opacity=`1`}).catch(cI)})},m=[r,i],t[9]=r,t[10]=i,t[11]=p,t[12]=m):(p=t[11],m=t[12]),(0,Q.useEffect)(p,m);let h=i===`column`?Vy:vr,g;t[13]===f?g=t[14]:(g=e=>{f.shouldAllowOpen(e)&&l(e)},t[13]=f,t[14]=g);let _=i===`column`?`h-3 w-7 rounded-full p-0 text-gray-700 dark:text-muted-foreground bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 hover:text-foreground dark:hover:bg-gray-600 dark:hover:text-gray-100 relative cursor-grab before:absolute before:-inset-[6px] before:content-[""]`:`h-7 w-3 rounded-full p-0 text-gray-700 dark:text-muted-foreground bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 hover:text-foreground dark:hover:bg-gray-600 dark:hover:text-gray-100 relative cursor-grab before:absolute before:-inset-[6px] before:content-[""]`,v;t[15]!==s||t[16]!==i?(v=s(i===`column`?{id:`DNkveC`}:{id:`Kge76t`}),t[15]=s,t[16]=i,t[17]=v):v=t[17];let y;t[18]===h?y=t[19]:(y=(0,Z.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),t[18]=h,t[19]=y);let b;t[20]!==f.onPointerDown||t[21]!==_||t[22]!==v||t[23]!==y?(b=(0,Z.jsx)(fa,{asChild:!0,children:(0,Z.jsx)(X,{variant:`secondary`,onPointerDown:f.onPointerDown,className:_,"aria-label":v,children:y})}),t[20]=f.onPointerDown,t[21]=_,t[22]=v,t[23]=y,t[24]=b):b=t[24];let x=i===`column`?`center`:`start`,S=i===`column`?`bottom`:`right`,C;if(t[25]!==s||t[26]!==n||t[27]!==a){let e;t[29]!==s||t[30]!==n?(e=e=>(0,Z.jsxs)(Q.Fragment,{children:[e.separatorBefore&&(0,Z.jsx)(ya,{}),(0,Z.jsxs)(ca,{onSelect:()=>e.run(n),children:[(0,Z.jsx)(e.icon,{"aria-hidden":!0}),s(e.label)]})]},e.id),t[29]=s,t[30]=n,t[31]=e):e=t[31],C=a.map(e),t[25]=s,t[26]=n,t[27]=a,t[28]=C}else C=t[28];let w;t[32]!==x||t[33]!==S||t[34]!==C?(w=(0,Z.jsx)(ga,{align:x,side:S,className:`w-auto min-w-44 whitespace-nowrap`,children:C}),t[32]=x,t[33]=S,t[34]=C,t[35]=w):w=t[35];let T;t[36]!==c||t[37]!==w||t[38]!==g||t[39]!==b?(T=(0,Z.jsx)(`div`,{ref:o,"data-testid":`table-cell-handle`,className:`absolute left-0 top-0 z-10 opacity-0`,children:(0,Z.jsxs)(va,{open:c,onOpenChange:g,children:[b,w]})}),t[36]=c,t[37]=w,t[38]=g,t[39]=b,t[40]=T):T=t[40];let E;t[41]===f.indicator?E=t[42]:(E=f.indicator&&(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none fixed z-50 bg-primary`,style:{left:f.indicator.rect.left,top:f.indicator.rect.top,width:f.indicator.rect.width,height:f.indicator.rect.height}}),t[41]=f.indicator,t[42]=E);let D;return t[43]!==T||t[44]!==E?(D=(0,Z.jsxs)(Z.Fragment,{children:[T,E]}),t[43]=T,t[44]=E,t[45]=D):D=t[45],D}function cI(){}function lI(e){let t=(0,$.c)(18),{editor:n}=e,[r,i]=(0,Q.useState)(null),a,o;if(t[0]===n?(a=t[1],o=t[2]):(a=()=>{let e=()=>i(e=>{let t=oI(n);return e&&t&&e.columnAnchor===t.columnAnchor&&e.rowAnchor===t.rowAnchor?e:t});return e(),n.on(`selectionUpdate`,e),n.on(`update`,e),()=>{n.off(`selectionUpdate`,e),n.off(`update`,e)}},o=[n],t[0]=n,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o),!r)return null;let s=r.columnAnchor,c;t[3]===r.isFirstColumn?c=t[4]:(c=iI(r.isFirstColumn),t[3]=r.isFirstColumn,t[4]=c);let l;t[5]!==r.columnAnchor||t[6]!==n||t[7]!==c?(l=(0,Z.jsx)(sI,{editor:n,anchor:s,axis:`column`,items:c}),t[5]=r.columnAnchor,t[6]=n,t[7]=c,t[8]=l):l=t[8];let u=r.rowAnchor,d;t[9]===r.isFirstRow?d=t[10]:(d=aI(r.isFirstRow),t[9]=r.isFirstRow,t[10]=d);let f;t[11]!==r.rowAnchor||t[12]!==n||t[13]!==d?(f=(0,Z.jsx)(sI,{editor:n,anchor:u,axis:`row`,items:d}),t[11]=r.rowAnchor,t[12]=n,t[13]=d,t[14]=f):f=t[14];let p;return t[15]!==l||t[16]!==f?(p=(0,Z.jsxs)(`div`,{className:`ok-table-cell-handle-layer`,children:[l,f]}),t[15]=l,t[16]=f,t[17]=p):p=t[17],p}function uI(e){let{fragment:t,docName:n}=e,r=!1,i=!1,a=!1,o=()=>{r=!0},s=e=>{console.warn(`[walk-currency] ${e} at view init — stale pre-warm cannot be invalidated: a remote edit that landed in the construct→mount gap will not render, and the first local transaction may silently erase it from the CRDT for every peer and disk (vendored y-tiptap contract change? re-verify y-tiptap.cjs:263-268)`)},c=()=>{i&&(i=!1,t.unobserveDeep(o))},l=e=>{let t=Ai.getState(e.state)?.binding;if(!t){am.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-binding`}),s(`no ySync binding on "${n}"`);return}if(typeof t._forceRerender!=`function`){am.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-force-rerender`}),s(`ySync binding on "${n}" exposes no _forceRerender`);return}am.count(`ok/editor/pattern-d-stale-prewarm`,{docName:n}),t._forceRerender()};return Rs.create({name:`walkCurrency`,onBeforeCreate(){t.observeDeep(o),i=!0},onDestroy(){c()},addProseMirrorPlugins(){return[new Do({view:e=>(a||(a=!0,c(),r&&l(e)),{})})]}})}var dI=new WeakMap;function fI(e){let t=document.createElement(`span`);t.classList.add(`collaboration-cursor__caret`),t.style.borderColor=e.color;let n=document.createElement(`div`);return n.classList.add(`collaboration-cursor__label`),n.style.backgroundColor=e.color,n.style.color=mc(e.color),n.textContent=e.name,t.append(n),t}var pI={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null};function mI(e,t){let n=null;for(let[r,i]of e.entries()){let e=i;typeof e?.timestamp!=`number`||e.timestamp<=t||(n===null||e.timestamp>n.entry.timestamp)&&(n={key:`${r}:${e.timestamp}`,entry:e})}return n}var hI=100,gI=100,_I=3,vI=250,yI=600;function bI(e){return`contentComponent`in e&&`isEditorContentInitialized`in e}function xI(e,t){let n=Li(e);if(!n||t.contains(n.dom))return!1;if(!bI(e))return console.warn(`[TiptapEditor] TipTap EditorContent binding fields missing; detached editor repair skipped`),!1;let r=e;if(r.contentComponent==null)return!1;try{n.setProps({nodeViews:{}})}catch{}return r.contentComponent=null,r.isEditorContentInitialized=!1,!0}function SI(){let e=new Ds({extensions:fs});return{mdManager:e,text:Ie({mdManager:e}),html:L({mdManager:e}),paste:D({mdManager:e}),copy:an({mdManager:e}),drop:Ae({mdManager:e})}}function CI(e,t){return t?{collaboration:j.configure({document:e.document,ySyncOptions:{mapping:t}}),guard:[uI({fragment:e.document.getXmlFragment(`default`),docName:e.configuration.name??``})]}:{collaboration:j.configure({document:e.document}),guard:[]}}function wI(e){let{provider:t,placeholder:n,prebuiltMapping:r,onWedged:i}=e,{collaboration:a,guard:o}=CI(t,r);return[...bt.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`||e.name===`jsxInline`||e.name===`imageReference`?e.configure({docName:t.configuration.name??``}):e),aF(t.configuration.name??``),Oa.configure({placeholder:()=>n??Hc._({id:`RS98db`}),showOnlyCurrent:!0}),at.configure({docName:t.configuration.name??``}),a,Rs.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[ae]}}),Rs.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[Mi(e,{cursorBuilder:fI})]}}),Rs.create({name:`bindingStalenessGuard`,addProseMirrorPlugins(){return[wN({fragment:t.document.getXmlFragment(`default`),docName:t.configuration.name??``,onWedged:i??(()=>{})})]}}),...o,SF,IF.configure({docName:t.configuration.name??``,getSource:()=>t.document.getText(`source`).toString(),applyFix:e=>cE(t,e,t.configuration.name??``)})]}function TI(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{dI.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=dI.get(e);if(dI.delete(e),r==null)return;let i=performance.now();am(`ok/editor/create-tiptap`,{docName:t.configuration.name??`unknown`,ytextLength:t.document.getText(`source`).length},{startTime:r,duration:Math.max(0,i-r)})},editorProps:{attributes:{class:`pt-4 pb-4 h-full`},clipboardTextParser:(e,t,r,i)=>{let a=n.mdManager.parse(e);return i.state.schema.nodeFromJSON(a).content},clipboardTextSerializer:(e,t)=>n.text(e,t),clipboardSerializer:n.html.serializer,handlePaste:(e,t)=>n.paste(e,t),handleDrop:n.drop,handleDOMEvents:{copy:(e,t)=>n.copy(e,t,!1),cut:(e,t)=>n.copy(e,t,!0)}},extensions:cN(wI(e))}}function EI(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i,onWedged:a}=e,o=t.document.getXmlFragment(`default`),s=new Map,c=TI({provider:t,placeholder:n,clipboard:r,ctorStart:i,prebuiltMapping:s,onWedged:a}),l=c.onBeforeCreate;return{...c,onBeforeCreate:e=>{l?.(e);let{editor:t}=e,{doc:n,mapping:r}=Fi(o,t.schema);r.forEach((e,t)=>{s.set(t,e)}),t.options.content=n.toJSON()},element:null}}var DI=e=>{let t=(0,$.c)(23),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(pI),c=uN(),{principal:l,activeDocName:u,recycleDocument:d}=Et(),f=n.configuration.name??``,[p]=(0,Q.useState)(SI),m;t[0]!==p||t[1]!==f||t[2]!==r||t[3]!==n||t[4]!==d?(m=()=>()=>({editor:new Xs(EI({provider:n,placeholder:r,clipboard:p,ctorStart:performance.now(),onWedged:e=>{let{externalSeq:t,appliedSeq:n}=e;am(`ok/editor/binding-wedge-recycle`,{docName:f,externalSeq:t,appliedSeq:n}),d(f)}})),ydoc:n.document,ytext:n.document.getText(`source`),provider:n}),t[0]=p,t[1]=f,t[2]=r,t[3]=n,t[4]=d,t[5]=m):m=t[5];let[h]=(0,Q.useState)(m),g,_;if(t[6]!==h||t[7]!==f||t[8]!==n.document){let e={viewCount:0,bytes:n.document.getText(`source`).length},r=tn(f)??xo();g=Q.use,_=xn({docName:f,mountId:r,construct:h,sizeStats:e}),t[6]=h,t[7]=f,t[8]=n.document,t[9]=g,t[10]=_}else g=t[9],_=t[10];let v=g(_),y=v.editor,b,x;t[11]===v?(b=t[12],x=t[13]):(b=()=>()=>{dn(v)},x=[v],t[11]=v,t[12]=b,t[13]=x),(0,Q.useEffect)(b,x);let S;return t[14]!==u||t[15]!==f||t[16]!==y||t[17]!==c||t[18]!==i||t[19]!==a||t[20]!==l||t[21]!==n?(S=(0,Z.jsx)(OI,{provider:n,isSourceMode:i,docName:f,activeDocName:u,identity:c,principal:l,editor:y,wrapperRef:o,flashStateRef:s,portalTarget:a}),t[14]=u,t[15]=f,t[16]=y,t[17]=c,t[18]=i,t[19]=a,t[20]=l,t[21]=n,t[22]=S):S=t[22],S},OI=e=>{let t=(0,$.c)(140),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:c,editor:l,wrapperRef:u,flashStateRef:d,portalTarget:f}=e,p=(0,Q.useRef)(null),[m,h]=(0,Q.useState)(0),g,_;t[0]===f?(g=t[1],_=t[2]):(g=()=>{let e=p.current;if(e)return e.appendChild(f),()=>{f.parentNode===e&&e.removeChild(f)}},_=[f],t[0]=f,t[1]=g,t[2]=_),(0,Q.useLayoutEffect)(g,_);let v,y;t[3]!==l||t[4]!==f?(v=()=>{xI(l,f)&&h(kI)},y=[l,f],t[3]=l,t[4]=f,t[5]=v,t[6]=y):(v=t[5],y=t[6]),(0,Q.useEffect)(v,y);let x;t[7]!==l||t[8]!==n.configuration.name?(x=()=>(Pi(l,n.configuration.name??null),()=>{Pi(l,null)}),t[7]=l,t[8]=n.configuration.name,t[9]=x):x=t[9];let S;t[10]!==l||t[11]!==n?(S=[l,n],t[10]=l,t[11]=n,t[12]=S):S=t[12],(0,Q.useEffect)(x,S);let C;t[13]!==l||t[14]!==n.configuration.name?(C=()=>{let e=n.configuration.name;if(e)return on(e,l),()=>Le(e,l)},t[13]=l,t[14]=n.configuration.name,t[15]=C):C=t[15];let w;t[16]!==l||t[17]!==n?(w=[l,n],t[16]=l,t[17]=n,t[18]=w):w=t[18],(0,Q.useEffect)(C,w);let T;t[19]!==l||t[20]!==r||t[21]!==n.configuration.name||t[22]!==n.document?(T=()=>{if(r)return;let e=n.configuration.name;if(!e||!rd(e))return;let t=!1,i=null,a=()=>{queueMicrotask(()=>{if(t)return;let r=Zu(e);r?.kind===`selection-offset`&&(i=$u({editor:l,docName:e,navigation:r,ydoc:n.document,transition:{from:`source`,to:`wysiwyg`}}))})};return Li(l)?a():l.on(`create`,a),()=>{t=!0,l.off(`create`,a),i?.cancel(`mode-flip`)}},t[19]=l,t[20]=r,t[21]=n.configuration.name,t[22]=n.document,t[23]=T):T=t[23];let E;t[24]!==l||t[25]!==r||t[26]!==n?(E=[l,n,r],t[24]=l,t[25]=r,t[26]=n,t[27]=E):E=t[27],(0,Q.useEffect)(T,E);let D;t[28]!==l||t[29]!==n.configuration.name?(D=()=>{let e=n.configuration.name;if(!e)return;let t=null,r=()=>{t=null,bd(e,`wysiwyg`,cd(l)),Wh(e,`wysiwyg`,Gh(l,e))},i=()=>{t&&clearTimeout(t),t=setTimeout(r,120)};return r(),l.on(`selectionUpdate`,i),l.on(`update`,i),()=>{t&&clearTimeout(t),l.off(`selectionUpdate`,i),l.off(`update`,i),bd(e,`wysiwyg`,null),Wh(e,`wysiwyg`,null)}},t[28]=l,t[29]=n.configuration.name,t[30]=D):D=t[30];let O;t[31]!==l||t[32]!==n?(O=[l,n],t[31]=l,t[32]=n,t[33]=O):O=t[33],(0,Q.useEffect)(D,O);let k;t[34]!==l||t[35]!==n.configuration.name?(k=()=>{},t[34]=l,t[35]=n.configuration.name,t[36]=k):k=t[36];let A;t[37]!==l||t[38]!==n?(A=[l,n],t[37]=l,t[38]=n,t[39]=A):A=t[39],(0,Q.useEffect)(k,A);let j,M;t[40]===l?(j=t[41],M=t[42]):(j=()=>{let e=AI,t=null,n=()=>{if(t||l.isDestroyed)return;let n=Li(l);n&&(t=n.dom,t.addEventListener(`keydown`,e),t.addEventListener(`paste`,e),t.addEventListener(`drop`,e),t.addEventListener(`cut`,e))},r=()=>{t&&=(t.removeEventListener(`keydown`,e),t.removeEventListener(`paste`,e),t.removeEventListener(`drop`,e),t.removeEventListener(`cut`,e),null)};return Li(l)?n():l.on(`create`,n),()=>{l.off(`create`,n),r()}},M=[l],t[40]=l,t[41]=j,t[42]=M),(0,Q.useEffect)(j,M);let N,P;t[43]===l?(N=t[44],P=t[45]):(N=()=>()=>{l.isDestroyed||!Li(l)||l.commands.setMeta(`hideDragHandle`,!0)},P=[l],t[43]=l,t[44]=N,t[45]=P),(0,Q.useEffect)(N,P);let F;t[46]!==l||t[47]!==n.configuration.name?(F=()=>{let e=n.configuration.name;if(!e)return;let t=t=>{let{transaction:n}=t;te(n)&&ge(e)};return l.on(`transaction`,t),()=>{l.off(`transaction`,t)}},t[46]=l,t[47]=n.configuration.name,t[48]=F):F=t[48];let I;t[49]!==l||t[50]!==n?(I=[l,n],t[49]=l,t[50]=n,t[51]=I):I=t[51],(0,Q.useEffect)(F,I);let L,R;t[52]===l?(L=t[53],R=t[54]):(L=()=>{let e=()=>{l.isDestroyed||!Li(l)||Sd()&&l.commands.focus()};return Li(l)?e():l.on(`create`,e),()=>{l.off(`create`,e)}},R=[l],t[52]=l,t[53]=L,t[54]=R),(0,Q.useEffect)(L,R);let z,B;t[55]!==i||t[56]!==l?(z=()=>{let e=!1,t=()=>{if(e||l.isDestroyed||!Li(l))return;e=!0;let t=Ot(i)?.selection??null;if(t)try{let e=l.state.doc.content.size;if(t.type===`text`){let n=Math.max(0,Math.min(t.anchor,e)),r=Math.max(0,Math.min(t.head,e));l.commands.setTextSelection({from:n,to:r})}else{let n=Math.max(0,Math.min(t.from,e));l.commands.setNodeSelection(n)}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(JSON.stringify({event:`ok-editor-selection-restore-failed`,docName:i,message:n})),am(`ok/editor/selection-restore-failed`,{docName:i,message:n})}s(i)};if(Li(l)){t();return}return l.on(`create`,t),()=>{l.off(`create`,t)}},B=[l,i],t[55]=i,t[56]=l,t[57]=z,t[58]=B):(z=t[57],B=t[58]),(0,Q.useEffect)(z,B);let V,ee;t[59]!==d||t[60]!==n.document||t[61]!==u?(V=()=>{let e=n.document.getMap(`agent-flash`),t=Date.now(),r=0,i=null,a=null,o=null,s=()=>{let t=null;for(let[,n]of e.entries()){let e=n;e.timestamp&&(!t||e.timestamp>t.timestamp)&&(t={agentId:e.agentId??`unknown`,timestamp:e.timestamp,type:e.type??`insert`,description:e.description})}return t},c=e=>{d.current=e;let t=u.current;t&&(t.setAttribute(`data-agent-flash-state`,e.state),t.setAttribute(`data-agent-flash-count`,String(e.count)),t.setAttribute(`data-agent-flash-position`,e.position),t.setAttribute(`data-agent-flash-agent-id`,e.lastAgentId??``))},l=()=>{let e=s(),t=e?.description?.toLowerCase().includes(`prepend`)?`prepend`:`append`,n={state:`editing`,count:(d.current?.count??0)+1,lastFiredAt:Date.now(),position:t,lastAgentId:e?.agentId??null};c(n),document.dispatchEvent(new CustomEvent(`agent-flash`,{detail:n})),a&&clearTimeout(a),o&&clearTimeout(o),a=window.setTimeout(()=>{let e={...n,state:`settled`};c(e),document.dispatchEvent(new CustomEvent(`agent-flash-end`,{detail:e})),o=window.setTimeout(()=>{c({...e,state:`idle`})},300)},wo)};c(pI);let f=()=>{if(rc(e),!qs(e,t)||document.visibilityState!==`visible`)return;let n=Date.now();if(t=n,n-r<500){if(!i){let e=500-(n-r);i=window.setTimeout(()=>{i=null,r=Date.now(),l()},e)}return}r=n,l()};e.observe(f);let p=()=>{document.visibilityState===`visible`?qs(e,t)&&(t=Date.now(),r=Date.now(),l()):t=Date.now()};return document.addEventListener(`visibilitychange`,p),()=>{e.unobserve(f),document.removeEventListener(`visibilitychange`,p),i&&clearTimeout(i),a&&clearTimeout(a),o&&clearTimeout(o)}},ee=[n.document,d,u],t[59]=d,t[60]=n.document,t[61]=u,t[62]=V,t[63]=ee):(V=t[62],ee=t[63]),(0,Q.useEffect)(V,ee);let H=(0,Q.useRef)(null),U;t[64]!==a||t[65]!==i||t[66]!==l||t[67]!==n?(U=()=>{let e=VF(),t=n.document.getMap(`agent-flash`),r=null,o=!1;queueMicrotask(()=>{o||l.isDestroyed||l.registerPlugin(e)});let s=[],c=()=>l.editorView??null,u=(e,t,n)=>{if(e.dispatch(e.state.tr.setMeta(RF,{add:{from:t,to:n},now:Date.now()})),r!==null&&clearTimeout(r),r=window.setTimeout(()=>{r=null;let e=c();e?.dispatch(e.state.tr.setMeta(RF,{now:Date.now(),sweep:!0}))},LF+50),!ka()||document.visibilityState!==`visible`||e.hasFocus())return;let a=()=>{let e=c();if(!(e==null||e.hasFocus()||document.visibilityState!==`visible`)&&!Ft(i))try{let r=e.state.doc.content.size,i=Math.max(0,Math.min(Math.floor((t+n)/2),r-1)),a=e.domAtPos(i),o=a.node,s=o.nodeType===Node.TEXT_NODE?o.parentElement:o.childNodes[a.offset]??o,c=s instanceof HTMLElement?s:s?.parentElement??null;if(c==null)return;let l=c.getBoundingClientRect();if(l.top>=0&&l.bottom<=window.innerHeight)return;c.scrollIntoView({block:`center`,behavior:`smooth`})}catch{}};requestAnimationFrame(a),s.push(window.setTimeout(a,250),window.setTimeout(a,550))},d=e=>{let{transaction:n}=e;if(!n.docChanged||n.getMeta(Ai)?.isChangeOrigin!==!0||!qs(t,Date.now()-1400)||i!==a)return;let r=mI(t,Date.now()-LF);if(r!==null&&r.key===H.current)return;let o=zF(n.before,n.doc);if(o===null)return;let s=c();s!=null&&(r!==null&&(H.current=r.key),u(s,o.from,o.to))};l.on(`transaction`,d);let f=()=>{if(o||i!==a)return;let e=c();if(e==null)return;let n=mI(t,Date.now()-BF);if(n===null||n.key===H.current)return;let r=n.entry.changedBlocks;if(r===void 0)return;let s=Xu(e.state.doc,r.from,r.to);s!==null&&(H.current=n.key,u(e,s.from,s.to))},p=requestAnimationFrame(f),m=()=>{requestAnimationFrame(f)};return n.on(`synced`,m),()=>{o=!0,l.off(`transaction`,d),n.off(`synced`,m),cancelAnimationFrame(p),r!==null&&clearTimeout(r);for(let e of s)clearTimeout(e);l.unregisterPlugin(RF)}},t[64]=a,t[65]=i,t[66]=l,t[67]=n,t[68]=U):U=t[68];let W;t[69]!==a||t[70]!==i||t[71]!==l||t[72]!==n.document||t[73]!==n.off||t[74]!==n.on?(W=[l,n.document,i,a,n.on,n.off],t[69]=a,t[70]=i,t[71]=l,t[72]=n.document,t[73]=n.off,t[74]=n.on,t[75]=W):W=t[75],(0,Q.useEffect)(U,W);let G,ne;t[76]!==a||t[77]!==i||t[78]!==l||t[79]!==r||t[80]!==n?(G=()=>{if(r)return;let e=0,t,o=null,s=null,c=null,u=function(){if(e<hI){e+=1,t=window.setTimeout(m,gI);return}o=null,s=null,e=0},d=function(e){let t=Li(l);if(!t)return null;let n=CSS.escape(e);return t.dom.querySelector(`#${n}`)??t.dom.querySelector(`[data-mirror-source-id="${n}"]`)},f=function(e){let t=d(e);return t?re(i,`deep-link`,()=>{t.scrollIntoView({behavior:`smooth`,block:`start`})}):!1},p=function(e,n){let r=_I,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(f(e),--r,r>0&&(t=window.setTimeout(o,vI)))};t=window.setTimeout(o,vI)};function m(){if(!o||i!==a)return;let t=o,n=s;if(!n){u();return}f(t)?(c=n,o=null,s=null,e=0,p(t,n)):u()}let h=function(){if(i!==a)return;let n=window.location.hash;if(!o&&c===n)return;let r=Xp(n);if(!r){c=n;return}o=r,s=n,e=0,t!==void 0&&(clearTimeout(t),t=void 0),m()},g=function(){if(i===a){if(o){m();return}h()}};return h(),n.on(`synced`,g),l.on(`transaction`,g),window.addEventListener(`hashchange`,h),()=>{t!==void 0&&clearTimeout(t),n.off(`synced`,g),l.off(`transaction`,g),window.removeEventListener(`hashchange`,h)}},ne=[n,l,i,a,r],t[76]=a,t[77]=i,t[78]=l,t[79]=r,t[80]=n,t[81]=G,t[82]=ne):(G=t[81],ne=t[82]),(0,Q.useEffect)(G,ne);let K,ie;t[83]!==i||t[84]!==l||t[85]!==r?(K=()=>{if(r)return;let e,t=function(t){let n=t.detail;if(!n||n.docName!==i||n.mode!==`wysiwyg`||l.isDestroyed)return;let r={docName:i,mode:`wysiwyg`,index:n.index},a=Li(l);if(!a){cm(Cd,{...r,outcome:`no-view`});return}let o=ft(a.dom),s=a.dom.querySelectorAll(`h1, h2, h3, h4, h5, h6`),c={...r,scrollTopBefore:o?.scrollTop,domHeadingCount:s.length,slugFoundAt:Array.from(s).findIndex(e=>e.id===n.slug)},u=s[n.index];if(!u){cm(Cd,{...c,outcome:`no-target`});return}let d=()=>o===null||!o.isConnected||!u.isConnected?void 0:Math.round(u.getBoundingClientRect().top-o.getBoundingClientRect().top),f=d(),p=o?.scrollHeight,m=re(i,`outline`,()=>{u.scrollIntoView({behavior:`smooth`,block:`start`})});cm(Cd,{...c,outcome:m?`scrolled`:`declined`,resolvedLevel:Number(u.tagName.slice(1)),targetTopBefore:f,scrollHeightBefore:p}),m&&(clearTimeout(e),e=setTimeout(()=>{cm(fd,{docName:i,mode:`wysiwyg`,index:n.index,scrollTopAfter:o?.isConnected===!0?o.scrollTop:void 0,scrollHeightAfter:o?.isConnected===!0?o.scrollHeight:void 0,targetTopAfter:d(),scrollerDetached:o!==null&&!o.isConnected,targetDetached:!u.isConnected})},yI))};return window.addEventListener(dd,t),()=>{window.removeEventListener(dd,t),clearTimeout(e)}},ie=[l,i,r],t[83]=i,t[84]=l,t[85]=r,t[86]=K,t[87]=ie):(K=t[86],ie=t[87]),(0,Q.useEffect)(K,ie);let q;t[88]!==a||t[89]!==i||t[90]!==o||t[91]!==r||t[92]!==c||t[93]!==n.awareness?(q=()=>{let e=n.awareness;if(!e)return;if(i!==a){e.setLocalState(null);return}e.setLocalState({user:hN({principal:c,identity:o}),mode:r?`source`:`wysiwyg`});let t=mN();return t.start(),t.setAwareness(e),()=>t.clearAwareness(e)},t[88]=a,t[89]=i,t[90]=o,t[91]=r,t[92]=c,t[93]=n.awareness,t[94]=q):q=t[94];let ae;t[95]!==a||t[96]!==i||t[97]!==o||t[98]!==r||t[99]!==c||t[100]!==n?(ae=[n,i,a,o,c,r],t[95]=a,t[96]=i,t[97]=o,t[98]=r,t[99]=c,t[100]=n,t[101]=ae):ae=t[101],(0,Q.useEffect)(q,ae);let oe,se;t[102]!==l||t[103]!==r?(oe=()=>(Ni(l,r),()=>{Ni(l,!1)}),se=[l,r],t[102]=l,t[103]=r,t[104]=oe,t[105]=se):(oe=t[104],se=t[105]),(0,Q.useEffect)(oe,se);let le;t[106]!==a||t[107]!==i||t[108]!==l||t[109]!==r?(le=!r&&(0,Z.jsx)(qP,{editor:l,shortcutEnabled:i===a}),t[106]=a,t[107]=i,t[108]=l,t[109]=r,t[110]=le):le=t[110];let ue;t[111]!==a||t[112]!==i||t[113]!==l||t[114]!==r?(ue=!r&&(0,Z.jsxs)(UM,{children:[(0,Z.jsx)(HM,{editor:l,docName:i,shortcutEnabled:i===a}),(0,Z.jsx)(OM,{editor:l,docName:i}),i===a&&(0,Z.jsx)(zM,{editor:l,docName:i})]}),t[111]=a,t[112]=i,t[113]=l,t[114]=r,t[115]=ue):ue=t[115];let de;t[116]!==l||t[117]!==r?(de=!r&&(0,Z.jsx)(lI,{editor:l}),t[116]=l,t[117]=r,t[118]=de):de=t[118];let fe;t[119]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Z.jsx)(`div`,{ref:p,style:{display:`contents`}}),t[119]=fe):fe=t[119];let pe;t[120]!==l||t[121]!==m?(pe=(0,Z.jsx)(pi,{editor:l,className:`tiptap-editor-portal-content h-full`},m),t[120]=l,t[121]=m,t[122]=pe):pe=t[122];let J;t[123]!==f||t[124]!==pe?(J=(0,$_.createPortal)(pe,f),t[123]=f,t[124]=pe,t[125]=J):J=t[125];let me;t[126]===l?me=t[127]:(me=(0,Z.jsx)(vM,{editor:l}),t[126]=l,t[127]=me);let he;t[128]===l?he=t[129]:(he=b(l),t[128]=l,t[129]=he);let _e;t[130]===he.store?_e=t[131]:(_e=(0,Z.jsx)(ce,{store:he.store}),t[130]=he.store,t[131]=_e);let ve;return t[132]!==le||t[133]!==ue||t[134]!==de||t[135]!==J||t[136]!==me||t[137]!==_e||t[138]!==u?(ve=(0,Z.jsxs)(`div`,{ref:u,className:`tiptap-editor h-full`,"data-agent-flash-state":`idle`,"data-agent-flash-count":`0`,"data-agent-flash-position":`append`,"data-agent-flash-agent-id":``,children:[le,ue,de,fe,J,me,_e]}),t[132]=le,t[133]=ue,t[134]=de,t[135]=J,t[136]=me,t[137]=_e,t[138]=u,t[139]=ve):ve=t[139],ve};function kI(e){return e+1}function AI(){return gi()}async function jI(e,t,n){try{let r={file:e,strategy:t};n!==void 0&&(r.content=n);let i=await fetch(`/api/sync/resolve-conflict`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)});if(i.ok)return{ok:!0};let a;try{let e=await i.json();typeof e.detail==`string`?a=e.detail:typeof e.title==`string`&&(a=e.title)}catch{}return{ok:!1,detail:a}}catch(n){let r=n instanceof Error?n.message:String(n);return console.warn(JSON.stringify({event:`conflict-resolve-dispatch-failed`,file:e,strategy:t,detail:r})),{ok:!1,detail:r}}}async function MI(e,t){return jI(e,`content`,t)}async function NI(e){return jI(e,`mine`)}async function PI(e){return jI(e,`theirs`)}async function FI(e){return jI(e,`delete`)}async function II(e){try{let t=await fetch(`/api/sync/conflict-content?file=${encodeURIComponent(e)}&source=ytext`);if(!t.ok){let n;try{let e=await t.json();typeof e.detail==`string`?n=e.detail:typeof e.title==`string`&&(n=e.title)}catch{}return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:t.status,detail:n})),null}let n=await t.json(),r=n.kind===`delete-modify`||n.kind===`modify-delete`||n.kind===`both-modified`?n.kind:`both-modified`;return n.kind!==r&&console.warn(JSON.stringify({event:`conflict-kind-missing-fallback`,file:e,receivedKind:n.kind??null})),{base:n.base??``,ours:n.ours??``,theirs:n.theirs??``,kind:r}}catch(t){return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:null,detail:t instanceof Error?t.message:String(t)})),null}}function LI(e){let t=(0,$.c)(86),{docName:n}=e,{_:r}=Bn(),{conflicts:i,loading:a}=Gd(),o;if(t[0]!==i||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>em(e.file)===n,t[3]=n,t[4]=e),o=i.find(e),t[0]=i,t[1]=n,t[2]=o}else o=t[2];let s=o,c=s?.file??`${n}.md`,[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),h=Ig(l?.kind===`delete-modify`||l?.kind===`modify-delete`),g,_;t[5]===n?(g=t[6],_=t[7]):(g=()=>(console.warn(JSON.stringify({event:`editor-area-swap-to-diffview`,"doc.name":n})),()=>{console.warn(JSON.stringify({event:`editor-area-swap-from-diffview`,"doc.name":n}))}),_=[n],t[5]=n,t[6]=g,t[7]=_),(0,Q.useEffect)(g,_);let v=a||s===void 0,y,b;t[8]!==v||t[9]!==c?(y=()=>{if(v)return;let e=!1;return u(null),f(!1),II(c).then(t=>{e||(t===null?f(!0):u(t))}),()=>{e=!0}},b=[c,v],t[8]=v,t[9]=c,t[10]=y,t[11]=b):(y=t[10],b=t[11]),(0,Q.useEffect)(y,b);let x;t[12]!==r||t[13]!==c?(x=async function(e){let t=await MI(c,e);t.ok||Dc.error(r({id:`K-h9cT`,values:{filePath:c}}),{description:t.detail})},t[12]=r,t[13]=c,t[14]=x):x=t[14];let S=x,C;t[15]!==r||t[16]!==c?(C=async function(e){m(!0);let t=await e(c);t.ok||(m(!1),Dc.error(r({id:`jPUPvG`,values:{filePath:c}}),{description:t.detail}))},t[15]=r,t[16]=c,t[17]=C):C=t[17];let w=C;if(d){let e;return t[18]===c?e=t[19]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`ajz9F8`,values:{filePath:c}})}),t[18]=c,t[19]=e),e}if(l===null){let e;return t[20]===c?e=t[21]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`DF1MtZ`,values:{filePath:c}})}),t[20]=c,t[21]=e),e}if(l.kind===`delete-modify`){let e;t[22]===l.theirs?e=t[23]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(Lg,{oldContent:``,newContent:l.theirs,layout:`unified`,previewMode:!0})}),t[22]=l.theirs,t[23]=e);let n;t[24]===c?n=t[25]:(n={filePath:c},t[24]=c,t[25]=n);let r;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[26]=r):r=t[26];let i;t[27]===n?i=t[28]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===w?a=t[30]:(a=()=>void w(FI),t[29]=w,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Y,{id:`Vlc75q`}),t[31]=o):o=t[31];let s;t[32]!==p||t[33]!==a?(s=(0,Z.jsx)(X,{type:`button`,variant:`destructive`,disabled:p,onClick:a,children:o}),t[32]=p,t[33]=a,t[34]=s):s=t[34];let u;t[35]===w?u=t[36]:(u=()=>void w(PI),t[35]=w,t[36]=u);let d;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Y,{id:`3mFsc3`}),t[37]=d):d=t[37];let f;t[38]!==p||t[39]!==u?(f=(0,Z.jsx)(X,{type:`button`,variant:`default`,disabled:p,onClick:u,children:d}),t[38]=p,t[39]=u,t[40]=f):f=t[40];let m;t[41]!==s||t[42]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[41]=s,t[42]=f,t[43]=m):m=t[43];let g;t[44]!==h||t[45]!==i||t[46]!==m?(g=(0,Z.jsxs)(`div`,{ref:h,className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[44]=h,t[45]=i,t[46]=m,t[47]=g):g=t[47];let _;return t[48]!==g||t[49]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[48]=g,t[49]=e,t[50]=_):_=t[50],_}if(l.kind===`modify-delete`){let e;t[51]===l.ours?e=t[52]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(Lg,{oldContent:``,newContent:l.ours,layout:`unified`,previewMode:!0})}),t[51]=l.ours,t[52]=e);let n;t[53]===c?n=t[54]:(n={filePath:c},t[53]=c,t[54]=n);let r;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[55]=r):r=t[55];let i;t[56]===n?i=t[57]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`EhDLBx`,values:n,components:r})}),t[56]=n,t[57]=i);let a;t[58]===w?a=t[59]:(a=()=>void w(NI),t[58]=w,t[59]=a);let o;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Y,{id:`0NA4b3`}),t[60]=o):o=t[60];let s;t[61]!==p||t[62]!==a?(s=(0,Z.jsx)(X,{type:`button`,variant:`default`,disabled:p,onClick:a,children:o}),t[61]=p,t[62]=a,t[63]=s):s=t[63];let u;t[64]===w?u=t[65]:(u=()=>void w(FI),t[64]=w,t[65]=u);let d;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Y,{id:`qSxaOz`}),t[66]=d):d=t[66];let f;t[67]!==p||t[68]!==u?(f=(0,Z.jsx)(X,{type:`button`,variant:`destructive`,disabled:p,onClick:u,children:d}),t[67]=p,t[68]=u,t[69]=f):f=t[69];let m;t[70]!==s||t[71]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[70]=s,t[71]=f,t[72]=m):m=t[72];let g;t[73]!==h||t[74]!==i||t[75]!==m?(g=(0,Z.jsxs)(`div`,{ref:h,className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[73]=h,t[74]=i,t[75]=m,t[76]=g):g=t[76];let _;return t[77]!==g||t[78]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[77]=g,t[78]=e,t[79]=_):_=t[79],_}let T;t[80]===S?T=t[81]:(T=e=>void S(e),t[80]=S,t[81]=T);let E;return t[82]!==l.ours||t[83]!==l.theirs||t[84]!==T?(E=(0,Z.jsx)(Lg,{oldContent:l.theirs,newContent:l.ours,layout:`unified`,conflictMode:!0,onResolve:T}),t[82]=l.ours,t[83]=l.theirs,t[84]=T,t[85]=E):E=t[85],E}function RI(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)($t(n,r));let a;return t[0]===i?a=t[1]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[0]=i,t[1]=a),a}var zI=`__back-nav__`;function BI(e){return e instanceof ot||e instanceof Rt||e instanceof tt||e instanceof pn||e instanceof yn||e instanceof mn?e.docName:null}function VI(e){return e instanceof ot||e instanceof Rt}function HI(e){if(e instanceof ot){let t=e.docName;return{title:Hc._({id:`Jejur6`}),summary:Hc._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof Rt){let t=e.docName;return{title:Hc._({id:`V7QxyT`}),summary:Hc._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof tt){let t=e.docName;return{title:Hc._({id:`1di5fu`}),summary:Hc._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof pn){let t=e.docName;return{title:Hc._({id:`wvbc1r`}),summary:Hc._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof yn)return{title:Hc._({id:`Gfr4fu`}),summary:Hc._({id:`UW2Fg3`})};if(e instanceof mn){let t=e.docName;return{title:Hc._({id:`vv7kpg`}),summary:Hc._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:Hc._({id:`W5A0Ly`});return{title:Hc._({id:`29VNqC`}),summary:t}}function UI(e){let t=(0,$.c)(42),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,s;t[0]===n?s=t[1]:(s=HI(n),t[0]=n,t[1]=s);let{title:c,summary:l}=s,u=!!a&&!!o,d=(0,Q.useRef)(null),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),g=typeof window<`u`?window.okDesktop:void 0,_=g&&VI(n)?g:null,v,y;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>{d.current?.focus()},y=[],t[2]=v,t[3]=y):(v=t[2],y=t[3]),(0,Q.useEffect)(v,y);let b;t[4]===n?b=t[5]:(b=VI(n),t[4]=n,t[5]=b);let x;t[6]===b?x=t[7]:(x=(0,Z.jsx)(py,{keyboard:b}),t[6]=b,t[7]=x);let S;t[8]===c?S=t[9]:(S=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:c}),t[8]=c,t[9]=S);let C;t[10]===l?C=t[11]:(C=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:l}),t[10]=l,t[11]=C);let w;t[12]!==S||t[13]!==C?(w=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[S,C]}),t[12]=S,t[13]=C,t[14]=w):w=t[14];let T;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Y,{id:`KDw4GX`}),t[15]=T):T=t[15];let E;t[16]===r?E=t[17]:(E=(0,Z.jsx)(X,{ref:d,variant:`default`,onClick:r,children:T}),t[16]=r,t[17]=E);let D;t[18]!==_||t[19]!==m?(D=_?(0,Z.jsx)(X,{variant:`outline-mono`,disabled:m,onClick:()=>{h(!0),uf(_).then(GI).catch(WI).finally(()=>h(!1))},children:(0,Z.jsx)(Y,{id:`uaUc6t`})}):null,t[18]=_,t[19]=m,t[20]=D):D=t[20];let O;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(O=g?(0,Z.jsx)(X,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>p(!0),children:(0,Z.jsx)(Y,{id:`ii5mVn`})}):null,t[21]=O):O=t[21];let k;t[22]!==i||t[23]!==u||t[24]!==n||t[25]!==o||t[26]!==a||t[27]!==r?(k=u?(0,Z.jsx)(X,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(ht(BI(n)??i),o(a),r(zI))},children:(0,Z.jsx)(Y,{id:`CKyk7Q`})}):null,t[22]=i,t[23]=u,t[24]=n,t[25]=o,t[26]=a,t[27]=r,t[28]=k):k=t[28];let A;t[29]!==E||t[30]!==D||t[31]!==k?(A=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[E,D,O,k]}),t[29]=E,t[30]=D,t[31]=k,t[32]=A):A=t[32];let j;t[33]!==i||t[34]!==n||t[35]!==f?(j=g?(0,Z.jsx)(Fr,{open:f,onOpenChange:p,crashContext:{source:`document view`,docName:BI(n)??i,errorMessage:n instanceof Error&&n.message?n.message:String(n),componentStack:_y(n)}}):null,t[33]=i,t[34]=n,t[35]=f,t[36]=j):j=t[36];let M;return t[37]!==A||t[38]!==j||t[39]!==x||t[40]!==w?(M=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`document-error-title`,"data-slot":`document-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[x,w,A,j]}),t[37]=A,t[38]=j,t[39]=x,t[40]=w,t[41]=M):M=t[41],M}function WI(){}function GI(e){e.ok||Dc.error(e.message,{id:`server-restart-error`,duration:1/0})}function KI(e){let t=(0,$.c)(17),{activeDocName:n,previousDocName:r,onNavigateBack:i,onRecycle:a,children:o}=e,s;t[0]!==n||t[1]!==i||t[2]!==r?(s=e=>(0,Z.jsx)(UI,{...e,activeDocName:n,previousDocName:r,onNavigateBack:i}),t[0]=n,t[1]=i,t[2]=r,t[3]=s):s=t[3];let c;t[4]===n?c=t[5]:(c=[n],t[4]=n,t[5]=c);let l;t[6]!==n||t[7]!==a?(l=e=>{if(e.reason===`imperative-api`){if(Array.isArray(e.args)&&e.args[0]===zI){console.warn(`[DocumentErrorBoundary] back-nav reset (no recycle)`);return}a(n),console.warn(`[DocumentErrorBoundary] retry recycled ${n}`)}else console.warn(`[DocumentErrorBoundary] reset by key change (${e.prev?.[0]} → ${e.next?.[0]})`)},t[6]=n,t[7]=a,t[8]=l):l=t[8];let u;t[9]===n?u=t[10]:(u=(e,t)=>{gy(e,t.componentStack),console.error(`[DocumentErrorBoundary] rendered fallback for ${n}: ${HI(e).title}`,e,t.componentStack??``)},t[9]=n,t[10]=u);let d;return t[11]!==o||t[12]!==s||t[13]!==c||t[14]!==l||t[15]!==u?(d=(0,Z.jsx)(pr,{fallbackRender:s,resetKeys:c,onReset:l,onError:u,children:o}),t[11]=o,t[12]=s,t[13]=c,t[14]=l,t[15]=u,t[16]=d):d=t[16],d}function qI(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Ks(t);return{map:n,keys:Jo(t),parseError:r}}function JI(e){let t=(0,$.c)(29),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>qI(n),t[0]=n,t[1]=r);let[i,a]=(0,Q.useState)(r),o=(0,Q.useRef)(null),s,c;t[2]===n?(s=t[3],c=t[4]):(s=()=>{let e=m(Cc(n),n.configuration.name??``);o.current=e,a(e.current());let t=e.subscribe(e=>{a(e)});return()=>{t(),e.dispose(),o.current=null}},c=[n],t[2]=n,t[3]=s,t[4]=c),(0,Q.useEffect)(s,c);let l;t[5]===i.map.icon?l=t[6]:(l=kn(i.map.icon),t[5]=i.map.icon,t[6]=l);let u=l,d;t[7]===i.map?d=t[8]:(d=Nn(i.map),t[7]=i.map,t[8]=d);let f=d,p;t[9]!==f||t[10]!==i.map?(p=f?Qe(i.map[f]):{kind:`unsupported`,value:``},t[9]=f,t[10]=i.map,t[11]=p):p=t[11];let h=p,g;t[12]!==f||t[13]!==i.map?(g=f?Cn(i.map[`${f}_y`]):null,t[12]=f,t[13]=i.map,t[14]=g):g=t[14];let _=g,v=h.kind===`url`||h.kind===`path`,y=u.kind!==`unsupported`;if(!v&&!y)return null;let b=v?`true`:`false`,x=y?`true`:`false`,S;t[15]!==h||t[16]!==f||t[17]!==_||t[18]!==v?(S=v&&f?(0,Z.jsx)(YI,{cover:h,focalY:_,onCommitFocalY:e=>{let t=o.current;if(!t)return;let n=t.patch({[`${f}_y`]:e});n.ok||console.warn(`[PageHeader] focal-Y patch rejected:`,n.error)}}):null,t[15]=h,t[16]=f,t[17]=_,t[18]=v,t[19]=S):S=t[19];let C;t[20]!==v||t[21]!==y||t[22]!==u?(C=y?(0,Z.jsx)(XI,{icon:u,hasCover:v}):null,t[20]=v,t[21]=y,t[22]=u,t[23]=C):C=t[23];let w;return t[24]!==S||t[25]!==C||t[26]!==b||t[27]!==x?(w=(0,Z.jsxs)(`div`,{className:`page-header editor-content-aligned`,"data-has-cover":b,"data-has-icon":x,"data-testid":`page-header`,children:[S,C]}),t[24]=S,t[25]=C,t[26]=b,t[27]=x,t[28]=w):w=t[28],w}function YI(e){let t=(0,$.c)(59),{cover:n,focalY:r,onCommitFocalY:i}=e,{_:a}=Bn(),[o,s]=(0,Q.useState)(null),c=(0,Q.useRef)(null),l=(0,Q.useRef)(null),u=o??r,d;t[0]===u?d=t[1]:(d=We(u),t[0]=u,t[1]=d);let f=d,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D;if(t[2]!==a||t[3]!==u||t[4]!==o||t[5]!==r||t[6]!==i){let e=Math.round((u??.5)*100),n;t[22]===r?n=t[23]:(n=function(e){e.button===0&&e.pointerType!==`touch`&&(e.currentTarget.setPointerCapture(e.pointerId),l.current={clientY:e.clientY,focal:r??.5})},t[22]=r,t[23]=n),m=n;let d;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(d=function(e){let t=l.current,n=c.current;if(!t||!n)return;let r=n.getBoundingClientRect();if(r.height===0)return;let i=(t.clientY-e.clientY)/r.height,a=t.focal+i;a<0&&(a=0),a>1&&(a=1),s(a)},t[24]=d):d=t[24],h=d;let f;t[25]!==o||t[26]!==r||t[27]!==i?(f=function(e){if(!l.current)return;l.current=null;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}let t=o;s(null),t!==null&&t!==r&&i(Math.round(t*100)/100)},t[25]=o,t[26]=r,t[27]=i,t[28]=f):f=t[28],g=f;let O;t[29]!==r||t[30]!==i?(O=function(e){let t=r??.5,n;if(e.key===`ArrowUp`||e.key===`ArrowRight`)n=Math.min(1,t+.05);else if(e.key===`ArrowDown`||e.key===`ArrowLeft`)n=Math.max(0,t-.05);else if(e.key===`Home`)n=0;else if(e.key===`End`)n=1;else return;e.preventDefault(),i(Math.round(n*100)/100)},t[29]=r,t[30]=i,t[31]=O):O=t[31],p=O,v=`page-header-cover`,y=`page-header-cover`,b=c,x=`slider`,S=0,t[32]===a?C=t[33]:(C=a({id:`7b3zu8`}),t[32]=a,t[33]=C),w=`vertical`,T=0,E=100,D=e,_=a({id:`AHFljV`,values:{percent:e}}),t[2]=a,t[3]=u,t[4]=o,t[5]=r,t[6]=i,t[7]=p,t[8]=m,t[9]=h,t[10]=g,t[11]=_,t[12]=v,t[13]=y,t[14]=b,t[15]=x,t[16]=S,t[17]=C,t[18]=w,t[19]=T,t[20]=E,t[21]=D}else p=t[7],m=t[8],h=t[9],g=t[10],_=t[11],v=t[12],y=t[13],b=t[14],x=t[15],S=t[16],C=t[17],w=t[18],T=t[19],E=t[20],D=t[21];let O=o!==null||void 0,k;t[34]===f?k=t[35]:(k={objectPosition:f},t[34]=f,t[35]=k);let A;t[36]!==n.value||t[37]!==k?(A=(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,loading:`lazy`,referrerPolicy:`no-referrer`,className:`page-header-cover-img`,style:k}),t[36]=n.value,t[37]=k,t[38]=A):A=t[38];let j;t[39]!==p||t[40]!==m||t[41]!==h||t[42]!==g||t[43]!==_||t[44]!==O||t[45]!==A||t[46]!==b||t[47]!==x||t[48]!==S||t[49]!==C||t[50]!==w||t[51]!==T||t[52]!==E||t[53]!==D?(j=(0,Z.jsx)(`div`,{ref:b,role:x,tabIndex:S,"aria-label":C,"aria-orientation":w,"aria-valuemin":T,"aria-valuemax":E,"aria-valuenow":D,"aria-valuetext":_,onPointerDown:m,onPointerMove:h,onPointerUp:g,onPointerCancel:g,onKeyDown:p,className:`page-header-cover-slider`,"data-testid":`page-header-cover-slider`,"data-dragging":O,children:A}),t[39]=p,t[40]=m,t[41]=h,t[42]=g,t[43]=_,t[44]=O,t[45]=A,t[46]=b,t[47]=x,t[48]=S,t[49]=C,t[50]=w,t[51]=T,t[52]=E,t[53]=D,t[54]=j):j=t[54];let M;return t[55]!==v||t[56]!==y||t[57]!==j?(M=(0,Z.jsx)(`div`,{className:v,"data-testid":y,children:j}),t[55]=v,t[56]=y,t[57]=j,t[58]=M):M=t[58],M}function XI(e){let t=(0,$.c)(9),{icon:n,hasCover:r}=e,i=r?`page-header-icon page-header-icon--with-cover`:`page-header-icon`;if(n.kind===`emoji`){let e;return t[0]!==n.value||t[1]!==i?(e=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":`emoji`,children:n.value}),t[0]=n.value,t[1]=i,t[2]=e):e=t[2],e}let a;t[3]===n.value?a=t[4]:(a=(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,referrerPolicy:`no-referrer`,className:`page-header-icon-img`}),t[3]=n.value,t[4]=a);let o;return t[5]!==n.kind||t[6]!==i||t[7]!==a?(o=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":n.kind,children:a}),t[5]=n.kind,t[6]=i,t[7]=a,t[8]=o):o=t[8],o}var ZI=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{ManagedArtifactProperties:e}=await import(`./ManagedArtifactProperties-AGHZbLhh.js`);return{ManagedArtifactProperties:e}},__vite__mapDeps([162,163,1,125,13,9,28,2,3,29,30,31,32,33,7,8,90,43,44,11,12,45,40,14,15,42,18,19,17,91,21,92,24,23,71,72,73,74,75,76,77,78,79,80,81,82,83,37,66,84,85,86,87,88,89,4,5,10,16,20,93,94,25,34,56,57,58,95,68,61,96,97,98,64,65,99,100,55,59,60,62,101,102,103,26,104,105,106,107,35,108,109,110,111,112,113,114,115,164,127,129,130,41,165,166,143,167,168,147,169,156,141]),import.meta.url)).ManagedArtifactProperties})),QI=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{MermaidDocEditor:e}=await import(`./MermaidDocEditor-CftOutDD.js`);return{MermaidDocEditor:e}},__vite__mapDeps([170,1,72,73,33,83,2,28,3,29,30,31,32,37,66,9,18,8,84,13,85,86,87,88,89,7,94,74,75,76,77,78,79,80,81,82,44,21,25,34,56,57,58,95,68,61,96,171,172,98,10,11,12,14,15,16,17,19,20,64,65,173,69]),import.meta.url)).MermaidDocEditor})),$I=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{ExcalidrawDocEditor:e}=await import(`./ExcalidrawDocEditor-BKndnS9g.js`);return{ExcalidrawDocEditor:e}},__vite__mapDeps([174,1,2,175,176,177,8,9,178,179,7,110,43,44,11,12,13,45,14,15,180,40,41,94,72,73,33,74,75,76,77,78,79,80,81,82,28,3,29,30,31,32,83,37,66,18,84,85,86,87,88,89,21,25,34,56,57,58,95,68,61,96,170,171,172,98,10,16,17,19,20,64,65,173,69,181]),import.meta.url)).ExcalidrawDocEditor})),eL=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{TextDocEditor:e}=await import(`./TextDocEditor-Cb7BPpJA.js`);return{TextDocEditor:e}},__vite__mapDeps([182,1,72,73,33,28,2,3,29,30,31,32,83,37,66,9,18,8,84,13,85,86,87,88,89,7,94,74,75,76,77,78,79,80,81,82,44,21,25,34,56,57,58,95,68,61,96,171,172,173,183]),import.meta.url)).TextDocEditor})),tL=sm(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function nL(e){let t=e.threshold??tL;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function rL(e){return e.hasEmittedFirstToggle||!e.isActive||!e.isLarge?!1:e.renderSource&&e.renderVisual}function iL(e,t,n){return e?t:n}function aL(e){let{docName:t,pages:n,loading:r}=e;return!r&&!n.has(t)&&!Wo(t)&&us(t)===null&&!Ws(t)&&!Xo(t)&&!yo(t)}var oL=sm(`ACTIVITY_MOUNT_LIMIT`,3);function sL(){return n(()=>import(`./SourceEditor-D9_q6g5_.js`),__vite__mapDeps([184,1,78,73,33,72,172,28,2,3,29,30,31,32,83,37,66,9,18,8,84,13,85,86,87,88,89,71,74,75,76,77,79,80,81,82,44,7,4,5,90,43,11,12,45,40,14,15,42,19,17,91,21,92,24,23,10,16,20,93,94,25,34,56,57,58,95,68,61,96,97,98,64,65,99,100,55,59,60,62,101,102,103,26,104,105,106,107,35,108,109,110,111,112,113,114,115,185,39,41,46,136,144,186,67,154,156,148,173,169]),import.meta.url)}var cL=(0,Q.lazy)(async()=>({default:(await sL()).SourceEditor}));function lL(e,t,n){if(n<=0)return[];let r=e.filter(e=>!Ct(e.docName)),i=[...r].sort((e,t)=>t.lastAccessedAt-e.lastAccessedAt);if(typeof t==`string`||t===null){let e=i.slice(0,n);if(t===null||e.some(e=>e.docName===t))return e;let a=r.find(e=>e.docName===t);return a===void 0?e:[...e.slice(0,n-1),a]}let a=t,o=new Map(r.map(e=>[e.docName,e])),s=[...a].filter(e=>!Ct(e)).map(e=>o.get(e)).filter(e=>e!==void 0),c=new Set(s.map(e=>e.docName)),l=Math.max(n,s.length);for(let e of i){if(c.size>=l)break;c.has(e.docName)||(s.push(e),c.add(e.docName))}return s}function uL(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:Hc._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?Hc._({id:`Sc1bKE`,values:{docName:e}}):Hc._({id:`ovIGrT`,values:{docName:e}}),actionLabel:Hc._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:Hc._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?Hc._({id:`bmC18N`,values:{docName:e}}):Hc._({id:`pAgkuZ`,values:{docName:e}})}:null}function dL(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(om,{name:`activity-pool`,children:(0,Z.jsx)(fL,{...e})}),t[0]=e,t[1]=n),n}function fL(e){let t=(0,$.c)(21),{activeDocName:n,visibleDocNames:r,activityHosts:i,parkingHost:a,renderToolbar:o,isSourceMode:s,editorPlaceholder:c,previousDocName:l,onNavigateBack:u,onRecycle:d}=e,{poolEntries:f,serverRestartRecovery:p}=Et(),{pages:m,loading:h}=Nd(),g;t[0]!==n||t[1]!==r?(g=r??new Set([n]),t[0]=n,t[1]=r,t[2]=g):g=t[2];let _=g,v=lL(f,_,oL),y=(0,Q.useRef)(``),b=v.map(pL).join(`,`),x=(0,Q.useRef)(f),S,C;t[3]===f?(S=t[4],C=t[5]):(S=()=>{x.current=f},C=[f],t[3]=f,t[4]=S,t[5]=C),(0,Q.useLayoutEffect)(S,C),(0,Q.useLayoutEffect)(()=>{if(y.current===b)return;let e=y.current?y.current.split(`,`):[],t=b?b.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)_t(e);for(let e of i){let t=x.current.find(t=>t.docName===e)?.poolEventId;Ut(e,t&&t.length>0?t:xo())}am(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),y.current=b,Ye(t)},[b,n]);let w;t[6]!==i||t[7]!==c||t[8]!==_||t[9]!==s||t[10]!==h||t[11]!==u||t[12]!==d||t[13]!==m||t[14]!==a||t[15]!==l||t[16]!==o||t[17]!==p?(w=e=>(0,Z.jsx)(hL,{docName:e.docName,hostMount:i?.get(e.docName)??a??null,children:(0,Z.jsx)(xL,{entry:e,isVisible:_.has(e.docName),toolbar:_.has(e.docName)?o?.(e.docName,e.provider):null,isSourceMode:s,editorPlaceholder:c,isNewDoc:aL({docName:e.docName,pages:m,loading:h}),previousDocName:l,onNavigateBack:u,onRecycle:d,serverRestartRecovery:p})},e.docName),t[6]=i,t[7]=c,t[8]=_,t[9]=s,t[10]=h,t[11]=u,t[12]=d,t[13]=m,t[14]=a,t[15]=l,t[16]=o,t[17]=p,t[18]=w):w=t[18];let T=v.map(w),E;return t[19]===T?E=t[20]:(E=(0,Z.jsx)(Z.Fragment,{children:T}),t[19]=T,t[20]=E),E}function pL(e){return e.docName}function mL(e,t){return{scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight,...t===null?{}:{contentBottom:t}}}function hL(e){let t=(0,$.c)(10),{docName:n,hostMount:r,children:i}=e,a;t[0]===n?a=t[1]:(a=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-activity-host`,n),e.className=`relative h-full min-h-0`,e},t[0]=n,t[1]=a);let[o]=(0,Q.useState)(a),s,c;t[2]!==o||t[3]!==r?(s=()=>{if(r!==null)return r.append(o),()=>o.remove()},c=[o,r],t[2]=o,t[3]=r,t[4]=s,t[5]=c):(s=t[4],c=t[5]),(0,Q.useLayoutEffect)(s,c);let l;return t[6]!==i||t[7]!==o||t[8]!==r?(l=r===null?i:(0,$_.createPortal)(i,o),t[6]=i,t[7]=o,t[8]=r,t[9]=l):l=t[9],l}function gL(e){let t=(0,$.c)(19),{isActive:n,docName:r,mode:i,initialScrollTop:a,bodyAnchorRef:o,children:s}=e,c=(0,Q.useRef)(null),l=(0,Q.useRef)(a??0),u=(0,Q.useRef)(null),d=(0,Q.useRef)(n),p=(0,Q.useRef)(!1),m,h;t[0]===n?(m=t[1],h=t[2]):(m=()=>{d.current=n},h=[n],t[0]=n,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let g=(0,Q.useRef)(i),_,v;t[3]===i?(_=t[4],v=t[5]):(_=()=>{g.current=i},v=[i],t[3]=i,t[4]=_,t[5]=v),(0,Q.useLayoutEffect)(_,v);let y,b;t[6]!==o||t[7]!==r?(y=()=>{let e=c.current;if(!e)return;let t=()=>{if(!(!d.current||p.current)&&e.scrollTop>0){let t=M(e,o?.current);if(!je(t))return;l.current=e.scrollTop,u.current=t.kind===`measured`?t.contentPos:null,t.kind===`measured`&&Mt(r,{offset:e.scrollTop-t.contentPos,mode:g.current,fraction:ie(e.scrollTop,e.scrollHeight,e.clientHeight)})}};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},b=[o,r],t[6]=o,t[7]=r,t[8]=y,t[9]=b):(y=t[8],b=t[9]),(0,Q.useEffect)(y,b);let x,S;t[10]!==o||t[11]!==r||t[12]!==n?(x=()=>{if(!n)return;let e=c.current;if(!e||le(r)===`landing`)return;let t=oe(r);if(t&&t.mode!==g.current){let n=Math.max(0,e.scrollHeight-e.clientHeight),i=Math.round(t.fraction*n),a=n>0;a&&(e.scrollTop=i),am(`ok/scroll-restore/cross-mode`,{docName:r,savedMode:t.mode,mode:g.current,fraction:Number(t.fraction.toFixed(4)),target:i,applied:a&&e.scrollTop===i,...mL(e,Ce(e))});return}let i=l.current,a=t?.offset,s=u.current===null?null:i-u.current,d=a??s;if(i===0&&d===null)return;let m=()=>{let t=Ce(e),n=me(i,d,M(e,o?.current));return{target:n===null?null:W(n,t,e.clientHeight),contentBottom:t}};p.current=!0;let h=e.style.overflowAnchor;e.style.overflowAnchor=`none`;let _=performance.now(),v=!1,y=!1,b=m();b.target!==null&&(e.scrollTop=b.target,Ln(e.scrollTop,b.target)&&f(b.target,b.contentBottom,e.scrollHeight)&&(y=!0,am(`ok/scroll-restore/phase1-success`,{docName:r,target:b.target,elapsedMs:performance.now()-_,...mL(e,b.contentBottom)})));let x=e.scrollTop,S=!1,C=0,w=()=>{S||(S=!0,p.current=!1,e.style.overflowAnchor=h,cancelAnimationFrame(C),clearTimeout(D),e.removeEventListener(`wheel`,T),e.removeEventListener(`touchstart`,T),e.removeEventListener(`mousedown`,T),e.removeEventListener(`keydown`,T))},T=()=>{y||am(`ok/scroll-restore/yielded`,{docName:r,reason:`user`,elapsedMs:performance.now()-_,...mL(e,null)}),w()};e.addEventListener(`wheel`,T,{passive:!0}),e.addEventListener(`touchstart`,T,{passive:!0}),e.addEventListener(`mousedown`,T),e.addEventListener(`keydown`,T);let E=()=>{if(S)return;let t=le(r);if(t){am(`ok/scroll-restore/superseded`,{docName:r,holder:t,elapsedMs:performance.now()-_,finalScrollTop:e.scrollTop}),y||am(`ok/scroll-restore/yielded`,{docName:r,reason:t,elapsedMs:performance.now()-_,...mL(e,null)}),w();return}if(De(x,e.scrollTop)){y||am(`ok/scroll-restore/yielded`,{docName:r,reason:`external`,elapsedMs:performance.now()-_,...mL(e,null)}),w();return}b=m(),b.target!==null&&!Ln(e.scrollTop,b.target)&&f(b.target,b.contentBottom,e.scrollHeight)&&(e.scrollTop=b.target,Ln(e.scrollTop,b.target)&&!v&&(am(`ok/scroll-restore/phase2-success`,{docName:r,target:b.target,elapsedMs:performance.now()-_,...mL(e,b.contentBottom)}),v=!0,y=!0)),x=e.scrollTop,C=requestAnimationFrame(E)};C=requestAnimationFrame(E);let D=setTimeout(()=>{if(S)return;let t=m(),n=t.target;(n===null||!Ln(e.scrollTop,n)&&f(n,t.contentBottom,e.scrollHeight))&&am(`ok/scroll-restore/abandoned`,{docName:r,...n===null?{}:{target:n},anchorMeasurable:n!==null,elapsedMs:performance.now()-_,...mL(e,t.contentBottom)}),w()},F);return w},S=[n,o,r],t[10]=o,t[11]=r,t[12]=n,t[13]=x,t[14]=S):(x=t[13],S=t[14]),(0,Q.useLayoutEffect)(x,S);let C,w;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(w=gr(`editor-doc-scroll subtle-scrollbar h-full overflow-y-auto`,$c()?`pt-0 scroll-pt-0`:`pt-14 scroll-pt-14`),C={overflowAnchor:`auto`},t[15]=C,t[16]=w):(C=t[15],w=t[16]);let T;return t[17]===s?T=t[18]:(T=(0,Z.jsx)(`div`,{ref:c,"data-testid":`editor-scroll-container`,className:w,style:C,children:s}),t[17]=s,t[18]=T),T}function _L(e){let t=(0,$.c)(12),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a}=e,o=r&&i,[s,c]=(0,Q.useState)(o),l,u;if(t[0]===o?(l=t[1],u=t[2]):(l=()=>{o&&c(!0)},u=[o],t[0]=o,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u),!s&&!o)return null;let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(xO,{}),t[3]=d):d=t[3];let f=n.docName,p;t[4]===n.provider.document?p=t[5]:(p=n.provider.document.getText(`source`),t[4]=n.provider.document,t[5]=p);let m;return t[6]!==a||t[7]!==n.docName||t[8]!==n.provider||t[9]!==o||t[10]!==p?(m=(0,Z.jsx)(Q.Suspense,{fallback:d,children:(0,Z.jsx)(cL,{docName:f,ytext:p,provider:n.provider,placeholder:a,isSourceModeActive:o})}),t[6]=a,t[7]=n.docName,t[8]=n.provider,t[9]=o,t[10]=p,t[11]=m):m=t[11],m}function vL(e){let t=(0,$.c)(18),{view:n}=e,r=n.kind===`failed`,i=r?`alert`:`status`,a=!r,o;t[0]===r?o=t[1]:(o=(0,Z.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-full border bg-muted text-muted-foreground`,children:r?(0,Z.jsx)(Pp,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(ip,{className:`size-5`,"aria-hidden":`true`})}),t[0]=r,t[1]=o);let s;t[2]===n.title?s=t[3]:(s=(0,Z.jsx)(`h2`,{className:`text-lg font-medium`,children:n.title}),t[2]=n.title,t[3]=s);let c;t[4]===n.summary?c=t[5]:(c=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:n.summary}),t[4]=n.summary,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==r||t[10]!==n.actionLabel?(u=r?(0,Z.jsxs)(X,{type:`button`,onClick:yL,children:[(0,Z.jsx)(Pp,{className:`size-4`,"aria-hidden":`true`}),n.actionLabel]}):null,t[9]=r,t[10]=n.actionLabel,t[11]=u):u=t[11];let d;return t[12]!==i||t[13]!==a||t[14]!==o||t[15]!==l||t[16]!==u?(d=(0,Z.jsxs)(`div`,{"data-slot":`server-restart-recovery`,role:i,"aria-busy":a,className:`flex h-full flex-col items-center justify-center gap-6 p-8 text-center`,children:[o,l,u]}),t[12]=i,t[13]=a,t[14]=o,t[15]=l,t[16]=u,t[17]=d):d=t[17],d}function yL(){return window.location.reload()}function bL(e){let t=(0,$.c)(2),{html:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`tiptap-editor h-full pointer-events-none`,"aria-hidden":`true`,children:(0,Z.jsx)(`div`,{className:`tiptap ProseMirror tiptap-editor-portal-content`,dangerouslySetInnerHTML:{__html:n}})}),t[0]=n,t[1]=r),r}function xL(e){let t=(0,$.c)(77),{entry:n,isVisible:r,toolbar:i,isSourceMode:a,editorPlaceholder:o,isNewDoc:s,previousDocName:c,onNavigateBack:l,onRecycle:u,serverRestartRecovery:d}=e,f;t[0]!==n.docName||t[1]!==d?(f=uL(n.docName,d),t[0]=n.docName,t[1]=d,t[2]=f):f=t[2];let p=f,m=nj(n.docName)===`conflict`,h;t[3]===n.docName?h=t[4]:(h=Ws(n.docName),t[3]=n.docName,t[4]=h);let g=h,_;t[5]===n.docName?_=t[6]:(_=Xo(n.docName),t[5]=n.docName,t[6]=_);let v=_,y;t[7]!==n.docName||t[8]!==v||t[9]!==g?(y=!g&&!v&&yo(n.docName),t[7]=n.docName,t[8]=v,t[9]=g,t[10]=y):y=t[10];let b=y,x;t[11]===n.docName?x=t[12]:(x=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-portal`,n.docName),e.style.display=`contents`,e},t[11]=n.docName,t[12]=x);let[S]=(0,Q.useState)(x),C=(0,Q.useRef)(null),w=n.provider.document.getText(`source`).length,[T,E]=(0,Q.useState)(a),D,O;t[13]!==a||t[14]!==r||t[15]!==T?(D=()=>{r&&T!==a&&E(a)},O=[r,a,T],t[13]=a,t[14]=r,t[15]=T,t[16]=D,t[17]=O):(D=t[16],O=t[17]),(0,Q.useEffect)(D,O);let k;t[18]!==a||t[19]!==r||t[20]!==T?(k=iL(r,a,T),t[18]=a,t[19]=r,t[20]=T,t[21]=k):k=t[21];let A=k,[j,M]=(0,Q.useState)(A),[N,P]=(0,Q.useState)(!A),F,I;t[22]!==A||t[23]!==j||t[24]!==N?(I=()=>{A&&!j?M(!0):!A&&!N&&P(!0)},F=[A,j,N],t[22]=A,t[23]=j,t[24]=N,t[25]=F,t[26]=I):(F=t[25],I=t[26]),(0,Q.useEffect)(I,F);let L=nL({ytextLength:w,isSourceMode:A,visitedSource:j,visitedVisual:N}),R=(0,Q.useRef)(``),z=`${L.isLarge}-${L.renderSource}-${L.renderVisual}`,B,V;t[27]!==A||t[28]!==n.docName||t[29]!==L.isLarge||t[30]!==L.renderSource||t[31]!==L.renderVisual||t[32]!==z||t[33]!==w?(B=()=>{R.current!==z&&(R.current=z,L.isLarge&&am(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:w,isSourceMode:A,renderSource:L.renderSource,renderVisual:L.renderVisual}))},V=[z,L.isLarge,L.renderSource,L.renderVisual,n.docName,w,A],t[27]=A,t[28]=n.docName,t[29]=L.isLarge,t[30]=L.renderSource,t[31]=L.renderVisual,t[32]=z,t[33]=w,t[34]=B,t[35]=V):(B=t[34],V=t[35]),(0,Q.useEffect)(B,V);let ee;t[36]===n.docName?ee=t[37]:(ee=()=>Ot(n.docName),t[36]=n.docName,t[37]=ee);let[H]=(0,Q.useState)(ee),U=H?.html??null,[W,G]=(0,Q.useState)(!1),te,ne;t[38]!==A||t[39]!==n.docName||t[40]!==L.isLarge||t[41]!==L.renderSource||t[42]!==L.renderVisual||t[43]!==W||t[44]!==r||t[45]!==w?(te=()=>{rL({isActive:r,isLarge:L.isLarge,renderSource:L.renderSource,renderVisual:L.renderVisual,hasEmittedFirstToggle:W})&&(am(`ok/cold/first-toggle`,{docName:n.docName,mountId:tn(n.docName),ytextLength:w,modeEnteredFirst:A?`source`:`visual`}),G(!0))},ne=[W,r,L.isLarge,L.renderSource,L.renderVisual,n.docName,w,A],t[38]=A,t[39]=n.docName,t[40]=L.isLarge,t[41]=L.renderSource,t[42]=L.renderVisual,t[43]=W,t[44]=r,t[45]=w,t[46]=te,t[47]=ne):(te=t[46],ne=t[47]),(0,Q.useEffect)(te,ne);let re=r?`visible`:`hidden`,K=`editor:${n.docName}`,ie=A?`source`:`wysiwyg`,q=H?.scrollTop,ae;t[48]!==o||t[49]!==A||t[50]!==n||t[51]!==L.renderSource||t[52]!==L.renderVisual||t[53]!==m||t[54]!==v||t[55]!==g||t[56]!==s||t[57]!==b||t[58]!==r||t[59]!==l||t[60]!==u||t[61]!==S||t[62]!==c||t[63]!==p||t[64]!==U?(ae=p?(0,Z.jsx)(vL,{view:p}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(KI,{activeDocName:n.docName,previousDocName:c,onNavigateBack:l,onRecycle:u,children:(0,Z.jsx)(Q.Suspense,{fallback:U?(0,Z.jsx)(bL,{html:U}):(0,Z.jsx)(xO,{}),children:(0,Z.jsx)(RI,{docName:n.docName,provider:n.provider,children:m?(0,Z.jsx)(LI,{docName:n.docName,provider:n.provider}):g?(0,Z.jsx)(QI,{docName:n.docName,provider:n.provider,isSourceMode:A}):v?(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(xO,{}),children:(0,Z.jsx)($I,{provider:n.provider})}):b?(0,Z.jsx)(eL,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!A&&(Wo(n.docName)||dm(n.docName)||us(n.docName)?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(ZI,{docName:n.docName,provider:n.provider})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(JI,{provider:n.provider}),(0,Z.jsx)(Vf,{provider:n.provider})]})),(0,Z.jsx)(`div`,{ref:C,"aria-hidden":!0,className:`h-0`,[be]:``}),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[L.renderSource?(0,Z.jsx)(`div`,{className:A?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(_L,{entry:n,isActive:r,isSourceMode:A,editorPlaceholder:o})}):null,L.renderVisual?(0,Z.jsx)(`div`,{className:A?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(DI,{provider:n.provider,placeholder:o,isSourceMode:A,portalTarget:S},`${n.docName}-${String(s)}-${n.poolEventId}`)}):null]})]})})})})}),t[48]=o,t[49]=A,t[50]=n,t[51]=L.renderSource,t[52]=L.renderVisual,t[53]=m,t[54]=v,t[55]=g,t[56]=s,t[57]=b,t[58]=r,t[59]=l,t[60]=u,t[61]=S,t[62]=c,t[63]=p,t[64]=U,t[65]=ae):ae=t[65];let oe;t[66]!==n.docName||t[67]!==r||t[68]!==ie||t[69]!==q||t[70]!==ae?(oe=(0,Z.jsx)(gL,{isActive:r,docName:n.docName,mode:ie,initialScrollTop:q,bodyAnchorRef:C,children:ae}),t[66]=n.docName,t[67]=r,t[68]=ie,t[69]=q,t[70]=ae,t[71]=oe):oe=t[71];let se;return t[72]!==re||t[73]!==K||t[74]!==oe||t[75]!==i?(se=(0,Z.jsxs)(Q.Activity,{mode:re,name:K,children:[oe,i]}),t[72]=re,t[73]=K,t[74]=oe,t[75]=i,t[76]=se):se=t[76],se}function SL(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function CL(e){let{value:t,unit:n}=SL(e);return n===`rem`?t*16:t}function wL(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var TL=3600*24*7;function EL(e){let t=(0,$.c)(28),{direction:n,currentWidth:r,onResize:i,onToggle:a,isCollapsed:o,minResizeWidth:s,maxResizeWidth:c,enableToggle:l,enableAutoCollapse:u,autoCollapseThreshold:d,expandThreshold:f,enableDrag:p,setIsDraggingRail:m,widthCookieName:h,widthCookieMaxAge:g,isNested:_}=e,v=n===void 0?`right`:n,y=o===void 0?!1:o,b=s===void 0?`14rem`:s,x=c===void 0?`24rem`:c,S=l===void 0?!0:l,C=u===void 0?!0:u,w=d===void 0?1.5:d,T=f===void 0?.2:f,E=p===void 0?!0:p,D=m===void 0?DL:m,O=g===void 0?TL:g,k=_===void 0?!1:_,A=(0,Q.useRef)(null),j=(0,Q.useRef)(0),M=(0,Q.useRef)(0),N=(0,Q.useRef)(!1),P=(0,Q.useRef)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(0),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(0),z=(0,Q.useRef)(0),B=(0,Q.useRef)(null),V=(0,Q.useRef)(r),ee=(0,Q.useRef)(y),H,U;t[0]===r?(H=t[1],U=t[2]):(H=()=>{V.current=r},U=[r],t[0]=r,t[1]=H,t[2]=U),(0,Q.useEffect)(H,U);let W,G;t[3]===y?(W=t[4],G=t[5]):(W=()=>{ee.current=y},G=[y],t[3]=y,t[4]=W,t[5]=G),(0,Q.useEffect)(W,G);let te=CL(b),ne;t[6]===x?ne=t[7]:(ne=CL(x),t[6]=x,t[7]=ne);let re=ne,K;t[8]!==E||t[9]!==k?(K=function(e){E&&(P.current=!0,j.current=ee.current?0:CL(V.current),M.current=e.clientX,I.current=e.clientX,F.current=null,L.current=!1,R.current=0,z.current=0,B.current=k&&A.current?A.current.getBoundingClientRect():null,e.preventDefault())},t[8]=E,t[9]=k,t[10]=K):K=t[10];let ie=K,q,ae;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==re||t[18]!==te||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(q=()=>{let e=function(e){h&&(document.cookie=`${h}=${e}; path=/; max-age=${O}`)},t=function(e,t){return v===`left`?e<t:e>t},n=function(e,t,n,r){if(k&&r){let r=e.clientX-t;return v===`left`?n-r:n+r}return v===`left`?window.innerWidth-e.clientX:e.clientX},r=function(r){if(!P.current)return;let o=Math.abs(r.clientX-M.current);if(!N.current&&o>5&&(N.current=!0,D(!0)),N.current){let{unit:o}=SL(V.current),s=B.current;k&&A.current&&(s=A.current.getBoundingClientRect());let c=t(r.clientX,I.current)?`expand`:`collapse`;F.current!==c&&(F.current=c),z.current=Math.abs(r.clientX-I.current);let l=Date.now();if(L.current&&l-R.current>200&&(L.current=!1),!L.current){if(C&&a&&!ee.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=te*w;else if(e<=te){let n=te*(w-1);t=te-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&ee.current&&c===`expand`&&z.current>te*T){a();let t=n(r,M.current,j.current,s),c=Math.max(te,Math.min(re,t)),u=wL(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(ee.current)return;let u=n(r,M.current,j.current,s),d=Math.max(te,Math.min(re,u)),f=wL(o===`rem`?d/16:d,o);i(f),e(f)}},o=function(){P.current&&(!N.current&&a&&S&&a(),N.current=!1,P.current=!1,F.current=null,I.current=0,L.current=!1,R.current=0,z.current=0,B.current=null,D(!1))};return document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,o),()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,o)}},ae=[i,a,D,te,re,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=re,t[18]=te,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=q,t[25]=ae):(q=t[24],ae=t[25]),(0,Q.useEffect)(q,ae);let oe;return t[26]===ie?oe=t[27]:(oe={dragRef:A,isDragging:N,handleMouseDown:ie},t[26]=ie,t[27]=oe),oe}function DL(){}var OL=3600*24*7,kL=`18rem`,AL=`3rem`,jL=`app-file-sidebar`,ML=`14.625rem`,NL=`32rem`,PL=`sidebar_width`,FL=/^\d+(?:\.\d+)?(?:rem|px)$/,IL=Q.createContext(null);function LL(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${PL}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return FL.test(n)?n:e}function RL(){let e=Q.use(IL);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function zL(e){let t=(0,$.c)(57),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({open:i,onOpenChange:o,className:r,style:s,children:n,defaultWidth:c,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=c===void 0?kL:c,[u]=Q.useState(VL),d;t[8]===u?d=t[9]:(d=()=>_j(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>LL(l),t[10]=l,t[11]=m);let[h,g]=Q.useState(m),[_,v]=Q.useState(!1),[y,b]=Q.useState(!1),x;t[12]===u?x=t[13]:(x=()=>{let e=wj();return Ej(`left`,_j(u,window.innerWidth,`left`),e)===`open`},t[12]=u,t[13]=x);let[S,C]=Q.useState(x),w=i??S,T;t[14]!==f||t[15]!==o?(T=e=>{let t=typeof e==`function`?e(k.current):e;o?o(t):C(t),Dj(`left`,f,t?`open`:`collapsed`)},t[14]=f,t[15]=o,t[16]=T):T=t[16];let E=T,D;t[17]===E?D=t[18]:(D=function(){E(BL)},t[17]=E,t[18]=D);let O=D,k=Q.useRef(w),A;t[19]===w?A=t[20]:(A=()=>{k.current=w},t[19]=w,t[20]=A),Q.useLayoutEffect(A);let j;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(){window.innerWidth>=1024||k.current&&(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||b(!0))},t[21]=j):j=t[21];let M=j,N,P;t[22]===u?(N=t[23],P=t[24]):(P=()=>{let e=window.matchMedia(`(min-width: ${mj}px)`),t=()=>{let e=_j(u,window.innerWidth,`left`);p(e),C(Ej(`left`,e,wj())===`open`)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},N=[u],t[22]=u,t[23]=N,t[24]=P),Q.useEffect(P,N);let F,I;t[25]===w?(F=t[26],I=t[27]):(F=()=>{w||document.getElementById(jL)?.contains(document.activeElement)&&document.querySelector(`[data-sidebar="trigger"]`)?.focus()},I=[w],t[25]=w,t[26]=F,t[27]=I),Q.useLayoutEffect(F,I);let L,R;t[28]!==w||t[29]!==f||t[30]!==E?(L=()=>{if(f===`above`||!w)return;let e=e=>{if(e.key!==`Escape`||Mr())return;let t=e.target;t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`)||E(!1)};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},R=[f,w,E],t[28]=w,t[29]=f,t[30]=E,t[31]=L,t[32]=R):(L=t[31],R=t[32]),Q.useEffect(L,R);let z,B;t[33]===O?(z=t[34],B=t[35]):(z=()=>{if(typeof window<`u`&&window.okDesktop!=null)return;let e=e=>{Mc(e,`toggle-files-sidebar`)&&(Mr()||(e.preventDefault(),O()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},B=[O],t[33]=O,t[34]=z,t[35]=B),Q.useEffect(z,B);let V=w?`expanded`:`collapsed`,ee;t[36]!==_||t[37]!==w||t[38]!==E||t[39]!==y||t[40]!==V||t[41]!==O||t[42]!==h?(ee={state:V,open:w,setOpen:E,toggleSidebar:O,width:h,setWidth:g,isDraggingRail:_,setIsDraggingRail:v,showPushPulse:y,setShowPushPulse:b,notifySidebarFileSelected:M},t[36]=_,t[37]=w,t[38]=E,t[39]=y,t[40]=V,t[41]=O,t[42]=h,t[43]=ee):ee=t[43];let H;t[44]!==s||t[45]!==h?(H={"--sidebar-width":h,"--sidebar-width-icon":AL,...s},t[44]=s,t[45]=h,t[46]=H):H=t[46];let U=H,W;t[47]===r?W=t[48]:(W=gr(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[47]=r,t[48]=W);let G;t[49]!==n||t[50]!==a||t[51]!==U||t[52]!==W?(G=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:U,className:W,...a,children:n}),t[49]=n,t[50]=a,t[51]=U,t[52]=W,t[53]=G):G=t[53];let te;return t[54]!==ee||t[55]!==G?(te=(0,Z.jsx)(IL.Provider,{value:ee,children:G}),t[54]=ee,t[55]=G,t[56]=te):te=t[56],te}function BL(e){return!e}function VL(){return As()}function HL(e){let t=(0,$.c)(39),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({side:a,variant:o,collapsible:s,className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=a===void 0?`left`:a,l=o===void 0?`sidebar`:o,u=s===void 0?`offcanvas`:s,{_:d}=Bn(),{state:f,isDraggingRail:p}=RL();if(u===`none`){let e;t[7]===r?e=t[8]:(e=gr(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let a;return t[9]!==n||t[10]!==i||t[11]!==e||t[12]!==l?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":l,className:e,...i,children:n}),t[9]=n,t[10]=i,t[11]=e,t[12]=l,t[13]=a):a=t[13],a}let m=f===`collapsed`?u:``,h=l===`floating`||l===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,g;t[14]===h?g=t[15]:(g=gr(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,h,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[14]=h,t[15]=g);let _;t[16]===g?_=t[17]:(_=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:g}),t[16]=g,t[17]=_);let v;t[18]===d?v=t[19]:(v=d({id:`07q4Qk`}),t[18]=d,t[19]=v);let y=l===`floating`||l===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,b;t[20]!==r||t[21]!==y?(b=gr(`fixed inset-y-0 z-10 flex h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear motion-reduce:transition-none motion-reduce:duration-0 data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]`,y,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[20]=r,t[21]=y,t[22]=b):b=t[22];let x;t[23]===n?x=t[24]:(x=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[23]=n,t[24]=x);let S;t[25]!==i||t[26]!==c||t[27]!==b||t[28]!==x||t[29]!==v?(S=(0,Z.jsx)(`nav`,{id:jL,"aria-label":v,"data-slot":`sidebar-container`,"data-side":c,className:b,...i,children:x}),t[25]=i,t[26]=c,t[27]=b,t[28]=x,t[29]=v,t[30]=S):S=t[30];let C;return t[31]!==p||t[32]!==c||t[33]!==f||t[34]!==S||t[35]!==m||t[36]!==_||t[37]!==l?(C=(0,Z.jsxs)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":f,"data-collapsible":m,"data-variant":l,"data-side":c,"data-slot":`sidebar`,"data-dragging":p,children:[_,S]}),t[31]=p,t[32]=c,t[33]=f,t[34]=S,t[35]=m,t[36]=_,t[37]=l,t[38]=C):C=t[38],C}function UL(e){let t=(0,$.c)(34),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onClick:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{_:a}=Bn(),{toggleSidebar:o,state:s}=RL(),c,l,u,d,f,p,m,h;if(t[4]!==a||t[5]!==s){let e=Ac(`toggle-files-sidebar`);c=X,l=`trigger`,u=`sidebar-trigger`,d=`ghost`,f=`icon-sm`,p=s===`expanded`,m=jL,h=a(s===`expanded`?{id:`4PYsOz`,values:{sidebarShortcutLabel:e}}:{id:`jbSG8V`,values:{sidebarShortcutLabel:e}}),t[4]=a,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h}else c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13];let g;t[14]===n?g=t[15]:(g=gr(n),t[14]=n,t[15]=g);let _;t[16]!==r||t[17]!==o?(_=e=>{r?.(e),o()},t[16]=r,t[17]=o,t[18]=_):_=t[18];let v;t[19]===s?v=t[20]:(v=s===`expanded`?(0,Z.jsx)(hn,{}):(0,Z.jsx)(ub,{}),t[19]=s,t[20]=v);let y;return t[21]!==c||t[22]!==i||t[23]!==l||t[24]!==v||t[25]!==u||t[26]!==d||t[27]!==f||t[28]!==p||t[29]!==m||t[30]!==h||t[31]!==g||t[32]!==_?(y=(0,Z.jsx)(c,{"data-sidebar":l,"data-slot":u,variant:d,size:f,"aria-expanded":p,"aria-controls":m,"aria-label":h,className:g,onClick:_,...i,children:v}),t[21]=c,t[22]=i,t[23]=l,t[24]=v,t[25]=u,t[26]=d,t[27]=f,t[28]=p,t[29]=m,t[30]=h,t[31]=g,t[32]=_,t[33]=y):y=t[33],y}function WL(e){let t=(0,$.c)(32),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,enableDrag:a,enableToggle:o,onMouseDown:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?!0:a,c=o===void 0?!0:o,{_:l}=Bn(),{toggleSidebar:u,setWidth:d,state:f,width:p,setIsDraggingRail:m}=RL(),h=f===`collapsed`,g;t[6]!==s||t[7]!==c||t[8]!==m||t[9]!==d||t[10]!==h||t[11]!==u||t[12]!==p?(g={direction:`right`,enableDrag:s,enableToggle:c,onResize:d,onToggle:u,currentWidth:p,isCollapsed:h,minResizeWidth:ML,maxResizeWidth:NL,setIsDraggingRail:m,widthCookieName:PL,widthCookieMaxAge:OL},t[6]=s,t[7]=c,t[8]=m,t[9]=d,t[10]=h,t[11]=u,t[12]=p,t[13]=g):g=t[13];let{dragRef:_,handleMouseDown:v}=EL(g),y;t[14]!==l||t[15]!==f?(y=l(f===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[14]=l,t[15]=f,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==r?(b=e=>{r?.(e),e.defaultPrevented||v(e)},t[17]=v,t[18]=r,t[19]=b):b=t[19];let x;t[20]!==l||t[21]!==f?(x=l(f===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[20]=l,t[21]=f,t[22]=x):x=t[22];let S;t[23]===n?S=t[24]:(S=gr(`absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2`,`in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,`md:group-data-[variant=inset]:after:inset-y-5`,n),t[23]=n,t[24]=S);let C;return t[25]!==_||t[26]!==i||t[27]!==y||t[28]!==b||t[29]!==x||t[30]!==S?(C=(0,Z.jsx)(`button`,{ref:_,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":y,tabIndex:-1,onMouseDown:b,title:x,className:S,...i}),t[25]=_,t[26]=i,t[27]=y,t[28]=b,t[29]=x,t[30]=S,t[31]=C):C=t[31],C}function GL(e){let t=(0,$.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onAnimationEnd:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{showPushPulse:a,setShowPushPulse:o}=RL(),s;t[4]!==r||t[5]!==o?(s=e=>{r?.(e),e.animationName===`sidebar-push-pulse`&&o(!1)},t[4]=r,t[5]=o,t[6]=s):s=t[6];let c=s,l=a?``:void 0,u;t[7]===n?u=t[8]:(u=gr(`relative flex w-full flex-1 flex-col bg-background peer-data-[variant=inset]:m-2 peer-data-[variant=inset]:ml-0 peer-data-[variant=inset]:rounded-xl peer-data-[variant=inset]:shadow-sm peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,n),t[7]=n,t[8]=u);let d;return t[9]!==c||t[10]!==i||t[11]!==l||t[12]!==u?(d=(0,Z.jsx)(`main`,{"data-slot":`sidebar-inset`,"data-push-pulse":l,onAnimationEnd:c,className:u,...i}),t[9]=c,t[10]=i,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function KL(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function qL(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function JL(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function YL(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`relative flex w-full min-w-0 flex-col p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function XL(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,asChild:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i?zr:`div`,o;t[4]===n?o=t[5]:(o=gr(`flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(a,{"data-slot":`sidebar-group-label`,"data-sidebar":`group-label`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function ZL(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`w-full text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-group-content`,"data-sidebar":`group-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function QL(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`flex w-full min-w-0 flex-col gap-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function $L(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var eR=Rr(`peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-hover hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-hover active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-hover data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground data-active:hover:bg-sidebar-accent [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate`,{variants:{variant:{default:`hover:bg-sidebar-hover hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-hover hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`}},defaultVariants:{variant:`default`,size:`default`}});function tR(e){let t=(0,$.c)(28),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({asChild:i,isActive:a,variant:o,size:s,tooltip:c,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=i===void 0?!1:i,u=a===void 0?!1:a,d=o===void 0?`default`:o,f=s===void 0?`default`:s,p=l?zr:`button`,{state:m}=RL(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=gr(eR({variant:d,size:f}),n),t[8]=n,t[9]=f,t[10]=d,t[11]=h):h=t[11];let g;t[12]!==p||t[13]!==u||t[14]!==r||t[15]!==f||t[16]!==h?(g=(0,Z.jsx)(p,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":f,"data-active":u,className:h,...r}),t[12]=p,t[13]=u,t[14]=r,t[15]=f,t[16]=h,t[17]=g):g=t[17];let _=g;if(!c)return _;if(typeof c==`string`){let e;t[18]===c?e=t[19]:(e={children:c},t[18]=c,t[19]=e),c=e}let v;t[20]===_?v=t[21]:(v=(0,Z.jsx)(Br,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(Vr,{side:`right`,align:`center`,hidden:y,...c}),t[22]=y,t[23]=c,t[24]=b):b=t[24];let x;return t[25]!==v||t[26]!==b?(x=(0,Z.jsxs)(Ur,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function nR(e){let t=null,n=!1,r=new Set;function i(e){if(e!==t){t=e;for(let e of r)e()}}e.subscribeToEvent(i);async function a(){if(!n){n=!0;try{i(await e.fetchBranch())}catch{}}}return{getSnapshot:()=>t,subscribe(e){return r.add(e),a(),()=>{r.delete(e)}}}}async function rR(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=jo.safeParse(t);return n.success?n.data.currentBranch??null:null}var iR=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:nR({fetchBranch:rR,subscribeToEvent:Jc}),aR=iR.subscribe,oR=iR.getSnapshot;function sR(){return(0,Q.useSyncExternalStore)(aR,oR,oR)}function cR(){let e=(0,$.c)(6),t=sR(),n=gu(),{state:r}=RL(),i=typeof window<`u`?window.okDesktop:void 0;if(i&&r===`expanded`)return null;let a;e[0]===n?a=e[1]:(a=i?.config.projectName??(n&&Ud(n.contentDir)||null),e[0]=n,e[1]=a);let o=a,s=i?.config.projectPath??n?.contentDir??null;if(o===null&&t===null)return null;let c;return e[2]!==t||e[3]!==o||e[4]!==s?(c={projectName:o,projectPath:s,branch:t},e[2]=t,e[3]=o,e[4]=s,e[5]=c):c=e[5],c}function lR(e){let t=(0,$.c)(27),{stats:n,selectionStats:r,showStats:i,composerBadge:a}=e,o=i===void 0?!0:i,{_:s}=Bn(),c=cR();if(!o&&c===null&&a==null)return null;let l=r??n,u=r!=null,{words:d,chars:f,tokens:p}=l,m;t[0]!==s||t[1]!==u||t[2]!==o?(m=s(o?u?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=s,t[1]=u,t[2]=o,t[3]=m):m=t[3];let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[4]=h):h=t[4];let g;t[5]!==s||t[6]!==a?(g=a?(0,Z.jsxs)(X,{type:`button`,variant:`outline`,onClick:a.onReopen,"data-testid":`ask-ai-reopen-badge`,className:`-translate-x-1/2 absolute bottom-0 left-1/2 z-10 h-auto gap-1 rounded-md rounded-b-none bg-card px-2.5 py-0.5 text-2xs font-normal text-muted-foreground shadow-sm hover:text-foreground active:not-aria-[haspopup]:translate-y-0`,children:[(0,Z.jsx)(pt,{className:`size-3`,"aria-hidden":!0}),s({id:`xWEvuo`}),(0,Z.jsx)(Sa,{className:`size-3`,"aria-hidden":!0})]}):null,t[5]=s,t[6]=a,t[7]=g):g=t[7];let _;t[8]===c?_=t[9]:(_=c===null?null:(0,Z.jsx)(uR,{identity:c}),t[8]=c,t[9]=_);let v;t[10]===_?v=t[11]:(v=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:_}),t[10]=_,t[11]=v);let y;t[12]!==s||t[13]!==l.chars||t[14]!==l.tokens||t[15]!==l.words||t[16]!==f||t[17]!==u||t[18]!==o||t[19]!==p||t[20]!==d?(y=o?(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[u?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:s({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:l.words.toLocaleString()}),` `,(0,Z.jsx)(Y,{id:`gljvbT`,values:{words:d}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:l.chars.toLocaleString()}),` `,(0,Z.jsx)(Y,{id:`d5rK4X`,values:{chars:f}})]}),(0,Z.jsxs)(`span`,{children:[l.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:l.tokens.toLocaleString()}),` `,(0,Z.jsx)(Y,{id:`uynXup`,values:{tokens:p}})]})]}):null,t[12]=s,t[13]=l.chars,t[14]=l.tokens,t[15]=l.words,t[16]=f,t[17]=u,t[18]=o,t[19]=p,t[20]=d,t[21]=y):y=t[21];let b;return t[22]!==m||t[23]!==g||t[24]!==v||t[25]!==y?(b=(0,Z.jsxs)(`section`,{"aria-label":m,className:`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[h,g,v,y]}),t[22]=m,t[23]=g,t[24]=v,t[25]=y,t[26]=b):b=t[26],b}function uR(e){let t=(0,$.c)(8),{identity:n}=e,{projectName:r,projectPath:i,branch:a}=n,o;t[0]!==r||t[1]!==i?(o=r===null?null:i?(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(Vr,{side:`top`,className:`max-w-xs break-all`,children:i})]}):(0,Z.jsx)(`span`,{className:`truncate`,"data-testid":`editor-footer-project-name`,children:r}),t[0]=r,t[1]=i,t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=a===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,"data-testid":`editor-footer-branch`,children:[(0,Z.jsx)(vu,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:a})]}),t[3]=a,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,Z.jsxs)(Z.Fragment,{children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function dR(e){let t=(0,$.c)(11),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{_:i}=Bn(),a;t[3]===i?a=t[4]:(a=i({id:`3__SjS`}),t[3]=i,t[4]=a);let o;t[5]===n?o=t[6]:(o=gr(n),t[5]=n,t[6]=o);let s;return t[7]!==r||t[8]!==a||t[9]!==o?(s=(0,Z.jsx)(`nav`,{"aria-label":a,"data-slot":`breadcrumb`,className:o,...r}),t[7]=r,t[8]=a,t[9]=o,t[10]=s):s=t[10],s}function fR(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function pR(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`inline-flex items-center gap-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function mR(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({current:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0||i?`page`:void 0,o;t[4]===n?o=t[5]:(o=gr(`font-normal text-foreground`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`span`,{"data-slot":`breadcrumb-page`,"aria-current":a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function hR(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({children:n,className:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=gr(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(Ku,{}),t[6]=n,t[7]=o);let s;return t[8]!==i||t[9]!==a||t[10]!==o?(s=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-separator`,role:`presentation`,"aria-hidden":`true`,className:a,...i,children:o}),t[8]=i,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}var gR=1,_R=2,vR=4;function yR(e){let t=(0,$.c)(21),{docName:n,includeCurrentPage:r,className:i}=e,a=r===void 0?!1:r;if(!n)return null;let o,s,c,l,u,d;if(t[0]!==i||t[1]!==n||t[2]!==a){d=Symbol.for(`react.early_return_sentinel`);bb0:{let e=us(n),r=e?null:ns(n),f=e?e.folder.split(`/`).filter(Boolean):r?[]:J(n,``).prefix.replace(/\/$/,``).split(`/`).filter(Boolean),p=a?[...f,J(n,``).label]:f;if(p.length===0){d=null;break bb0}let m=a?p.join(`/`):null,h=(e,t)=>({kind:`segment`,value:e,key:p.slice(0,t+1).join(`/`)}),g=p.length>vR?[...p.slice(0,gR).map((e,t)=>h(e,t)),{kind:`ellipsis`,hidden:p.slice(gR,-_R)},...p.slice(-_R).map((e,t)=>h(e,p.length-_R+t))]:p.map((e,t)=>h(e,t));s=dR,t[9]===i?u=t[10]:(u=gr(`flex min-w-0 items-center`,i),t[9]=i,t[10]=u),o=fR;let _=a?`text-sm`:`text-xs`;t[11]===_?c=t[12]:(c=gr(`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70`,_),t[11]=_,t[12]=c),l=g.map((e,t)=>{let n=e.kind===`segment`?e.key:`ellipsis`,r=e.kind===`segment`&&e.key===m;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(hR,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(pR,{className:`shrink-0`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,title:e.hidden.join(` / `),className:`flex size-4 items-center justify-center text-muted-foreground/70`,children:(0,Z.jsx)(Vy,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Mu,{children:e.hidden.join(` / `)})})]}):(0,Z.jsx)(pR,{className:`min-w-0`,children:(0,Z.jsx)(mR,{current:r,className:gr(`min-w-0 truncate font-normal`,r?`font-medium text-foreground`:`text-muted-foreground/70`),title:e.value,children:(0,Z.jsx)(Mu,{children:e.value})})})]},n)})}t[0]=i,t[1]=n,t[2]=a,t[3]=o,t[4]=s,t[5]=c,t[6]=l,t[7]=u,t[8]=d}else o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8];if(d!==Symbol.for(`react.early_return_sentinel`))return d;let f;t[13]!==o||t[14]!==c||t[15]!==l?(f=(0,Z.jsx)(o,{className:c,children:l}),t[13]=o,t[14]=c,t[15]=l,t[16]=f):f=t[16];let p;return t[17]!==s||t[18]!==u||t[19]!==f?(p=(0,Z.jsx)(s,{className:u,children:f}),t[17]=s,t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function bR(e=typeof window>`u`?void 0:window){return e?.okDesktop?.slides!=null}var xR=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillToolbarControls:e}=await import(`./SkillToolbarControls-BCXxl3_M.js`);return{SkillToolbarControls:e}},__vite__mapDeps([187,1,7,8,9,90,43,44,11,12,13,45,40,14,15,42,18,19,17,91,21,92,24,129,130,41,99,16,188,189,72,73,33,80,78,76,74,75,77,37,171,172,66,28,2,3,29,30,31,32,126,10,20,128,118,119,131,71,79,81,82,83,84,85,86,87,88,89,4,5,23,93,94,25,34,56,57,58,95,68,61,96,97,98,64,65,100,55,59,60,62,101,102,103,26,104,105,106,107,35,108,109,110,111,112,113,114,115,163,125,164,127,165,166,143,167,168,147,169,156,141,54,135,139,140,142,190,148,36,191]),import.meta.url)).SkillToolbarControls})),SR=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillOriginInline:e}=await import(`./SkillOriginInline-Dshp1Rdi.js`);return{SkillOriginInline:e}},__vite__mapDeps([192,1,189,72,73,33,80,78,76,74,75,77,37,7,8,9,16,12,17,18,19,171,172,66,13,10,11,14,15,20,21,93,91,45,42,43,44,54,26,144,116,193,28,2,3,29,30,31,32,84,141,60,112,62]),import.meta.url)).SkillOriginInline})),CR=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SlidesToolbarControls:e}=await import(`./SlidesToolbarControls-CJxgVynH.js`);return{SlidesToolbarControls:e}},__vite__mapDeps([194,1,28,2,3,29,30,31,32,33,7,8,9,42,43,44,11,12,13,45,14,18,19,17,16,21,84,114,191]),import.meta.url)).SlidesToolbarControls})),wR=[];function TR(e){let t=(0,$.c)(81),{activeDocName:n,activeProvider:r,isSourceMode:i,sourceDisabled:a,onModeChange:o,showAddPropertyButton:s,onAddProperty:c,frontmatterProblems:l,isPanelCollapsed:u,onTogglePanel:d,reserveRightGutter:f}=e,p=l===void 0?wR:l,m=f===void 0?!1:f,{_:h}=Bn(),g=Pl()?.merged?.slides?.enabled===!0,_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=Lc(`toggle-document-panel`),t[0]=_):_=t[0];let v=_,y,b,x,S,C,w,T;if(t[1]!==h||t[2]!==n||t[3]!==r||t[4]!==p||t[5]!==u||t[6]!==i||t[7]!==c||t[8]!==o||t[9]!==d||t[10]!==m||t[11]!==s||t[12]!==g||t[13]!==a){let e=Ac(`toggle-document-panel`),l=!$c(),f;t[21]===n?f=t[22]:(f=n?ns(n):null,t[21]=n,t[22]=f);let _=f,E;t[23]===n?E=t[24]:(E=n?dm(n):null,t[23]=n,t[24]=E);let D=E,O;t[25]!==_||t[26]!==D?(O=_?.kind===`skill`?{scope:_.scope,name:_.name}:D?{scope:`project`,name:D}:null,t[25]=_,t[26]=D,t[27]=O):O=t[27];let k=O,A,j;t[28]!==k||t[29]!==p?(A=zf(p,k?Af:If),j=A.map(ER),t[28]=k,t[29]=p,t[30]=A,t[31]=j):(A=t[30],j=t[31]);let M=j,N;t[32]===n?N=t[33]:(N=n?To(n):null,t[32]=n,t[33]=N);let P=N,F;t[34]!==n||t[35]!==s?(F=s&&(n===null||!yo(n)),t[34]=n,t[35]=s,t[36]=F):F=t[36];let I=F;w=`editor-toolbar`,T=`pointer-events-none absolute inset-x-0 top-0 z-10 @container/toolbar`;let L;t[37]!==n||t[38]!==k||t[39]!==P?(L=k?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(SR,{scope:k.scope,name:k.name})}):P?null:(0,Z.jsx)(yR,{docName:n}),t[37]=n,t[38]=k,t[39]=P,t[40]=L):L=t[40];let R;t[41]===n?R=t[42]:(R=n===null?null:(0,Z.jsx)(_g,{entry:{kind:`document`,docName:n},className:`shrink-0`}),t[41]=n,t[42]=R);let z;t[43]!==L||t[44]!==R?(z=(0,Z.jsxs)(`div`,{className:`pointer-events-auto flex min-w-0 items-center gap-2`,children:[L,R]}),t[43]=L,t[44]=R,t[45]=z):z=t[45];let B;t[46]!==n||t[47]!==i||t[48]!==o||t[49]!==a?(B=n!==null&&(yo(n)||Xo(n))?null:(0,Z.jsx)(yg,{isSourceMode:i,onModeChange:o,sourceDisabled:a}),t[46]=n,t[47]=i,t[48]=o,t[49]=a,t[50]=B):B=t[50];let V;t[51]===B?V=t[52]:(V=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:B}),t[51]=B,t[52]=V),t[53]!==z||t[54]!==V?(y=(0,Z.jsx)(`div`,{className:`editor-content-aligned bg-background py-2`,children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 items-center`,children:[z,V]})}),t[53]=z,t[54]=V,t[55]=y):y=t[55];let ee=m&&`pr-9`;t[56]===ee?b=t[57]:(b=gr(`pointer-events-auto absolute top-0 right-0 flex min-w-0 max-w-[calc(50%_-_3rem)] items-center justify-end gap-1 py-2 pr-2`,ee),t[56]=ee,t[57]=b),t[58]!==n||t[59]!==k||t[60]!==P||t[61]!==c||t[62]!==M||t[63]!==I||t[64]!==A?(x=k&&n?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(xR,{scope:k.scope,name:k.name,showAddPropertyButton:I,onAddProperty:c,problemCount:A.length,problemMessages:M})}):P?null:I&&(0,Z.jsx)(cu,{onAddProperty:c,problemCount:A.length,problemMessages:M}),t[58]=n,t[59]=k,t[60]=P,t[61]=c,t[62]=M,t[63]=I,t[64]=A,t[65]=x):x=t[65],t[66]!==n||t[67]!==r||t[68]!==g?(S=g&&bR()&&r!=null&&n!==null?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(CR,{provider:r,docName:n})}):null,t[66]=n,t[67]=r,t[68]=g,t[69]=S):S=t[69],C=l?(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(X,{"data-doc-panel-toggle":``,variant:`ghost`,size:`icon`,onClick:d,"aria-expanded":!u,"aria-controls":`doc-panel`,"aria-label":h(u?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),asChild:!0,children:(0,Z.jsx)(Br,{children:u?(0,Z.jsx)(Mp,{}):(0,Z.jsx)(jp,{})})}),(0,Z.jsxs)(Vr,{side:`bottom`,children:[(0,Z.jsx)(`span`,{children:h(u?{id:`6iDEWA`}:{id:`170Js2`})}),` `,(0,Z.jsx)(en,{"aria-label":e,children:v})]})]}):null,t[1]=h,t[2]=n,t[3]=r,t[4]=p,t[5]=u,t[6]=i,t[7]=c,t[8]=o,t[9]=d,t[10]=m,t[11]=s,t[12]=g,t[13]=a,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T}else y=t[14],b=t[15],x=t[16],S=t[17],C=t[18],w=t[19],T=t[20];let E;t[70]!==b||t[71]!==x||t[72]!==S||t[73]!==C?(E=(0,Z.jsxs)(`div`,{className:b,children:[x,S,C]}),t[70]=b,t[71]=x,t[72]=S,t[73]=C,t[74]=E):E=t[74];let D;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[75]=D):D=t[75];let O;return t[76]!==y||t[77]!==E||t[78]!==w||t[79]!==T?(O=(0,Z.jsxs)(`div`,{"data-testid":w,className:T,children:[y,E,D]}),t[76]=y,t[77]=E,t[78]=w,t[79]=T,t[80]=O):O=t[80],O}function ER(e){return e.message}function DR(e,t,n){let r=s_(e);t(r.target,{disposition:`permanent`,consumeActiveNewTab:n}),Wp(r.hash)}function OR({children:e}){return e}function kR(e){let t=(0,$.c)(71),{busy:n,deleteLabel:r,folderCreate:i,folderTree:a,hide:o,openWithAi:s,primitives:c,reveal:l,share:u,onCopyFullPath:d,onCopyRelativePath:f,onDelete:p,onDuplicate:m,onImportTemplate:h,onRename:g,workspaceReady:_}=e,v=n===void 0?!1:n,{Item:y,Separator:b,Sub:x,SubContent:S,SubTrigger:C}=c,w=c.Group??OR,T=a?.onExpandAll!=null||a?.onCollapseAll!=null,E=h!=null||m!=null||g!=null||o!=null||p!=null,D;t[0]!==w||t[1]!==y||t[2]!==b||t[3]!==x||t[4]!==S||t[5]!==C||t[6]!==v||t[7]!==i?(D=i?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(w,{children:[(0,Z.jsxs)(y,{disabled:v,onSelect:i.onNewFile,children:[(0,Z.jsx)(Fp,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`HdkSiO`})]}),i.templateItems?(0,Z.jsxs)(x,{children:[(0,Z.jsxs)(C,{disabled:v,children:[(0,Z.jsx)(yr,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`Uuj_R4`})]}),(0,Z.jsx)(S,{children:(0,Z.jsx)(w,{children:i.templateItems})})]}):null,(0,Z.jsxs)(y,{disabled:v,onSelect:i.onNewFolder,children:[(0,Z.jsx)(Yy,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`96G6Re`})]})]}),(0,Z.jsx)(b,{})]}):null,t[0]=w,t[1]=y,t[2]=b,t[3]=x,t[4]=S,t[5]=C,t[6]=v,t[7]=i,t[8]=D):D=t[8];let O;t[9]!==y||t[10]!==l?(O=l?(0,Z.jsxs)(y,{disabled:l.disabled,onSelect:l.onSelect,"aria-label":l.ariaLabel,children:[(0,Z.jsx)(Wf,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:l.label}),l.hint?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ms-2 text-muted-foreground text-xs`,children:l.hint}):null]}):null,t[9]=y,t[10]=l,t[11]=O):O=t[11];let k;t[12]!==y||t[13]!==u?(k=u?(0,Z.jsxs)(y,{"data-testid":`file-tree-menu-share`,onSelect:u.onSelect,children:[(0,Z.jsx)(Na,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`Z8lGw6`})]}):null,t[12]=y,t[13]=u,t[14]=k):k=t[14];let A,j;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(Fn,{"aria-hidden":`true`}),j=(0,Z.jsx)(Y,{id:`oCZkaG`}),t[15]=A,t[16]=j):(A=t[15],j=t[16]);let M;t[17]===C?M=t[18]:(M=(0,Z.jsxs)(C,{children:[A,j]}),t[17]=C,t[18]=M);let N=!_,P;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(Y,{id:`oQA-cA`}),t[19]=P):P=t[19];let F;t[20]!==y||t[21]!==d||t[22]!==N?(F=(0,Z.jsx)(y,{disabled:N,onSelect:d,children:P}),t[20]=y,t[21]=d,t[22]=N,t[23]=F):F=t[23];let I;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(Y,{id:`s061i4`}),t[24]=I):I=t[24];let L;t[25]!==y||t[26]!==f?(L=(0,Z.jsx)(y,{onSelect:f,children:I}),t[25]=y,t[26]=f,t[27]=L):L=t[27];let R;t[28]!==w||t[29]!==F||t[30]!==L?(R=(0,Z.jsxs)(w,{children:[F,L]}),t[28]=w,t[29]=F,t[30]=L,t[31]=R):R=t[31];let z;t[32]!==S||t[33]!==R?(z=(0,Z.jsx)(S,{children:R}),t[32]=S,t[33]=R,t[34]=z):z=t[34];let B;t[35]!==x||t[36]!==z||t[37]!==M?(B=(0,Z.jsxs)(x,{children:[M,z]}),t[35]=x,t[36]=z,t[37]=M,t[38]=B):B=t[38];let V;t[39]!==w||t[40]!==s||t[41]!==B||t[42]!==O||t[43]!==k?(V=(0,Z.jsxs)(w,{children:[O,s,k,B]}),t[39]=w,t[40]=s,t[41]=B,t[42]=O,t[43]=k,t[44]=V):V=t[44];let ee;t[45]!==w||t[46]!==y||t[47]!==b||t[48]!==a||t[49]!==T?(ee=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(b,{}),(0,Z.jsxs)(w,{children:[a?.onExpandAll?(0,Z.jsxs)(y,{onSelect:a.onExpandAll,children:[(0,Z.jsx)(Bb,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`OlAl5i`})]}):null,a?.onCollapseAll?(0,Z.jsxs)(y,{onSelect:a.onCollapseAll,children:[(0,Z.jsx)(qy,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`qvWGzP`})]}):null]})]}):null,t[45]=w,t[46]=y,t[47]=b,t[48]=a,t[49]=T,t[50]=ee):ee=t[50];let H;t[51]!==w||t[52]!==y||t[53]!==b||t[54]!==x||t[55]!==S||t[56]!==C||t[57]!==v||t[58]!==r||t[59]!==E||t[60]!==o||t[61]!==p||t[62]!==m||t[63]!==h||t[64]!==g?(H=E?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(b,{}),(0,Z.jsxs)(w,{children:[h?(0,Z.jsxs)(x,{children:[(0,Z.jsxs)(C,{disabled:v,children:[(0,Z.jsx)(Gy,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`PYmp-0`})]}),(0,Z.jsx)(S,{children:(0,Z.jsxs)(w,{children:[(0,Z.jsx)(y,{disabled:v,onSelect:()=>h(!1),children:(0,Z.jsx)(Y,{id:`-FeyRg`})}),(0,Z.jsx)(y,{disabled:v,onSelect:()=>h(!0),children:(0,Z.jsx)(Y,{id:`dQHSCs`})})]})})]}):null,m?(0,Z.jsxs)(y,{disabled:v,onSelect:m,children:[(0,Z.jsx)(et,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`euc6Ns`})]}):null,g?(0,Z.jsxs)(y,{disabled:v,onSelect:g,children:[(0,Z.jsx)(Zt,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`2wxgft`})]}):null,o?(0,Z.jsxs)(y,{"data-testid":`file-tree-menu-hide`,disabled:o.disabled,onSelect:o.onSelect,children:[(0,Z.jsx)(xa,{"aria-hidden":`true`}),o.label]}):null,p?(0,Z.jsxs)(y,{variant:`destructive`,disabled:v,onSelect:p,children:[(0,Z.jsx)(Ip,{"aria-hidden":`true`}),r??(0,Z.jsx)(Y,{id:`cnGeoo`})]}):null]})]}):null,t[51]=w,t[52]=y,t[53]=b,t[54]=x,t[55]=S,t[56]=C,t[57]=v,t[58]=r,t[59]=E,t[60]=o,t[61]=p,t[62]=m,t[63]=h,t[64]=g,t[65]=H):H=t[65];let U;return t[66]!==V||t[67]!==ee||t[68]!==H||t[69]!==D?(U=(0,Z.jsxs)(Z.Fragment,{children:[D,V,ee,H]}),t[66]=V,t[67]=ee,t[68]=H,t[69]=D,t[70]=U):U=t[70],U}function AR(e){return e.replace(/\\/g,`\\\\`).replace(/\[/g,`\\[`).replace(/\]/g,`\\]`).replace(/\*/g,`\\*`)}function jR(e){let t=AR(e.path);return e.kind===`folder`?`/${t}/`:`/${t}${e.docExt??`.md`}`}function MR(e){let t=(0,$.c)(21),{parentDir:n,onSelectTemplate:r,ItemComponent:i}=e,{state:a}=hf(n);if(a.status===`idle`||a.status===`loading`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Y,{id:`Hl89Qd`}),t[0]=e):e=t[0];let n;return t[1]===i?n=t[2]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[1]=i,t[2]=n),n}if(a.status===`error`){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Y,{id:`AQ-Lfg`}),t[3]=e):e=t[3];let n;return t[4]===i?n=t[5]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[4]=i,t[5]=n),n}let o,s;if(t[6]!==i||t[7]!==r||t[8]!==a.data.folder.templates_available){s=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[11]===a.data.folder.templates_available?e=t[12]:(e=a.data.folder.templates_available??[],t[11]=a.data.folder.templates_available,t[12]=e);let n=YS(e);if(n.length===0){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Y,{id:`iGCs04`}),t[13]=e):e=t[13];let n;t[14]===i?n=t[15]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[14]=i,t[15]=n),s=n;break bb0}let c;t[16]!==i||t[17]!==r?(c=e=>(0,Z.jsx)(i,{onSelect:()=>r(e.name),children:e.title??e.name},`${e.scope}:${e.source_folder}:${e.name}`),t[16]=i,t[17]=r,t[18]=c):c=t[18],o=n.map(c)}t[6]=i,t[7]=r,t[8]=a.data.folder.templates_available,t[9]=o,t[10]=s}else o=t[9],s=t[10];if(s!==Symbol.for(`react.early_return_sentinel`))return s;let c;return t[19]===o?c=t[20]:(c=(0,Z.jsx)(Z.Fragment,{children:o}),t[19]=o,t[20]=c),c}function NR(e,t){return e?.kind===`doc`||e?.kind===`folder-index`?mu(t.contentDir,hu(e.docName),t.pathSeparator):e?.kind===`folder`?mu(t.contentDir,e.folderPath,t.pathSeparator):e?.kind===`asset`?mu(t.contentDir,e.assetPath,t.pathSeparator):t.contentDir}function PR(e){return e?.kind===`doc`||e?.kind===`folder-index`?hu(e.docName):e?.kind===`folder`?e.folderPath:e?.kind===`asset`?e.assetPath:``}function FR(e,t){return e===null?du({workspace:t}):e.kind===`folder`?t?Ul({folderRelativePath:e.folderPath,workspace:t}):null:e.kind===`doc`||e.kind===`folder-index`?Rl({docName:e.docName,workspace:t}):e.kind===`skill-preview`?Wl({skillName:e.name,scope:e.level??`project`,workspace:t}):e.kind===`skill-file`?Wl({skillName:e.name,scope:e.scope,workspace:t}):null}var IR=`open-knowledge:file-tree-menu-action-delete`,LR=`open-knowledge:file-tree-menu-action-rename`,RR=`open-knowledge:file-tree-menu-action-duplicate`,zR=`open-knowledge:file-tree-menu-action-import-template`;function BR(e,t){window.dispatchEvent(new CustomEvent(e,{detail:t}))}function VR(e,t){let n=e=>{let n=e.detail;n?.target&&t(n)};return window.addEventListener(e,n),()=>window.removeEventListener(e,n)}function HR(e){BR(IR,{target:e})}function UR(e){return VR(IR,({target:t})=>e(t))}function WR(e,t){BR(LR,{target:e,nextName:t})}function GR(e){return VR(LR,({target:t,nextName:n})=>e(t,n))}function KR(e){BR(RR,{target:e})}function qR(e){return VR(RR,({target:t})=>e(t))}function JR(e,t){BR(zR,{target:e,deleteSource:t})}function YR(e){return VR(zR,({target:t,deleteSource:n})=>e(t,n))}var XR={Group:oa,Item:Zi,Separator:sa,Sub:Qi,SubContent:$i,SubTrigger:ia};function ZR(e,t){return e.kind!==`doc`||/\.(md|mdx)$/i.test(e.docName)?PR(e):`${e.docName}${t??`.md`}`}function QR(e){return e.kind===`asset`?null:e.kind===`folder`?Xd(e.folderPath):_f(e.docName)}function $R(e,t){return e.kind===`doc`?{kind:`file`,path:e.docName,docExt:t}:e.kind===`folder`?{kind:`folder`,path:e.folderPath}:null}function ez(e){let t=(0,$.c)(90),{docExt:n,target:r,onRename:i}=e,{_:a}=Bn(),o=gu(),{okignoreBinding:s}=Fl(),{status:c}=xu(),l=Sr().states,{dispatch:u}=Ll(),d,f,p,m,h,g,_,v,y,b,x,S,C,w;if(t[0]!==a||t[1]!==n||t[2]!==c?.hasRemote||t[3]!==s||t[4]!==r||t[5]!==o){x=ZR(r,n),v=wm(x),g=r.kind===`asset`,_=r.kind===`folder`,d=typeof window<`u`?window.okDesktop:void 0;let e;t[20]!==g||t[21]!==r||t[22]!==o?(e=g?null:FR(r,o),t[20]=g,t[21]=r,t[22]=o,t[23]=e):e=t[23],m=e;let i;t[24]===r?i=t[25]:(i=QR(r),t[24]=r,t[25]=i);let l=i;f=c?.hasRemote===!0&&l!==null,b=$R(r,n);let u;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(u=function(e,t,n){_r(e).then(()=>Dc.success(t,{description:e})).catch(e=>{console.warn(`[EditorTabTargetMenuItems] clipboard write failed:`,e),Dc.error(n)})},t[26]=u):u=t[26],p=u;let T;t[27]!==a||t[28]!==l?(T=function(){l&&Hd({...l,hasRemote:!0,onClickWhenNoRemote:()=>Dc.error(a({id:`WyQxwa`}))},{clipboardWrite:_r,toastSuccess:rz,toastError:nz,logEvent:tz})},t[27]=a,t[28]=l,t[29]=T):T=t[29],C=T,h=function(){if(!s||!b)return;let e=cf(s.current()),t=Vd(e,jR(b));if(t===e)return;s.patch(Jd(t));let n=x.split(`/`).pop()??x;Dc.success(a(_?{id:`4xtLTl`,values:{basename:n}}:{id:`OD0FCX`,values:{basename:n}}),{description:a({id:`nWv1ja`}),duration:5e3})};let E;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(E=Rg(d?.platform??`linux`),t[30]=E):E=t[30],S=E;let D;t[31]!==a||t[32]!==o?(D=o?null:a({id:`wTcjov`}),t[31]=a,t[32]=o,t[33]=D):D=t[33],y=D,w=o?mu(o.contentDir,x,o.pathSeparator):``,t[0]=a,t[1]=n,t[2]=c?.hasRemote,t[3]=s,t[4]=r,t[5]=o,t[6]=d,t[7]=f,t[8]=p,t[9]=m,t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w}else d=t[6],f=t[7],p=t[8],m=t[9],h=t[10],g=t[11],_=t[12],v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18],w=t[19];let T=w,E=o!==null,D;t[34]!==_||t[35]!==v||t[36]!==r.folderPath?(D=_&&!v?{onNewFile:()=>NO({initialDir:r.folderPath}),onNewFolder:()=>NO({initialDir:r.folderPath,kind:`folder`}),templateItems:(0,Z.jsx)(MR,{parentDir:r.folderPath,onSelectTemplate:e=>NO({template:{folder:r.folderPath,name:e}}),ItemComponent:Zi})}:void 0,t[34]=_,t[35]=v,t[36]=r.folderPath,t[37]=D):D=t[37];let O;t[38]!==d||t[39]!==T||t[40]!==y||t[41]!==S||t[42]!==o?(O=d?{label:S,ariaLabel:y?`${S}, ${y}`:S,disabled:!o,hint:y,onSelect:()=>{o&&d.shell.showItemInFolder(T)}}:void 0,t[38]=d,t[39]=T,t[40]=y,t[41]=S,t[42]=o,t[43]=O):O=t[43];let k;t[44]!==u||t[45]!==m||t[46]!==l||t[47]!==g?(k=g?void 0:(0,Z.jsx)(au,{input:m,installStates:l,dispatch:u}),t[44]=u,t[45]=m,t[46]=l,t[47]=g,t[48]=k):k=t[48];let A;t[49]!==f||t[50]!==C?(A=f?{onSelect:C}:void 0,t[49]=f,t[50]=C,t[51]=A):A=t[51];let j;t[52]!==a||t[53]!==p||t[54]!==T||t[55]!==o?(j=()=>{o&&p(T,a({id:`6_ZOw4`}),a({id:`vfRlCI`}))},t[52]=a,t[53]=p,t[54]=T,t[55]=o,t[56]=j):j=t[56];let M;t[57]!==a||t[58]!==p||t[59]!==x?(M=()=>p(x,a({id:`haHgQj`}),a({id:`5QGTaA`})),t[57]=a,t[58]=p,t[59]=x,t[60]=M):M=t[60];let N;t[61]!==v||t[62]!==r?(N=r.kind===`doc`&&!v?e=>JR(r,e):void 0,t[61]=v,t[62]=r,t[63]=N):N=t[63];let P;t[64]!==g||t[65]!==v||t[66]!==r?(P=!g&&!v?()=>KR(r):void 0,t[64]=g,t[65]=v,t[66]=r,t[67]=P):P=t[67];let F=v?void 0:i,I;t[68]!==h||t[69]!==_||t[70]!==v||t[71]!==s||t[72]!==b?(I=b&&!v?{label:_?(0,Z.jsx)(Y,{id:`5D3Ior`}):(0,Z.jsx)(Y,{id:`dbhUX1`}),disabled:s===null,onSelect:h}:void 0,t[68]=h,t[69]=_,t[70]=v,t[71]=s,t[72]=b,t[73]=I):I=t[73];let L;t[74]!==v||t[75]!==r?(L=v?void 0:()=>HR(r),t[74]=v,t[75]=r,t[76]=L):L=t[76];let R;return t[77]!==P||t[78]!==F||t[79]!==I||t[80]!==L||t[81]!==E||t[82]!==D||t[83]!==O||t[84]!==k||t[85]!==A||t[86]!==j||t[87]!==M||t[88]!==N?(R=(0,Z.jsx)(kR,{primitives:XR,workspaceReady:E,folderCreate:D,reveal:O,openWithAi:k,share:A,onCopyFullPath:j,onCopyRelativePath:M,onImportTemplate:N,onDuplicate:P,onRename:F,hide:I,onDelete:L}),t[77]=P,t[78]=F,t[79]=I,t[80]=L,t[81]=E,t[82]=D,t[83]=O,t[84]=k,t[85]=A,t[86]=j,t[87]=M,t[88]=N,t[89]=R):R=t[89],R}function tz(e){return console.log(e)}function nz(e){return Dc.error(e)}function rz(e){return Dc.success(e)}function iz(e,t){return t.trim()}function az(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function oz(e,t){let n=iz(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function sz(e,t,n=[],r=[],i=[]){if(t.length===0&&n.length===0&&r.length===0&&i.length===0)return e;let a=new Map(t.map(e=>[e.fromDocName,e.toDocName])),o=new Map(i.map(e=>[e.toDocName,e.docExt])),s=new Map(r.map(e=>[e.fromPath,e.toPath]));return e.map(e=>{if(ym(e)){let t=s.get(m_(e.docName,e.docExt));if(t){let n=Em(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:Go(n),size:e.size,modified:e.modified,referencedBy:[]}}let n=a.get(e.docName)??e.docName;return{...e,docName:n,docExt:o.get(n)??e.docExt}}if(Sm(e))return{...e,path:pz(e.path,n)};if(Tm(e)){let t=s.get(e.path);return t&&yh(t)?{kind:`document`,docName:y_(t),docExt:xh(t),size:e.size,modified:e.modified}:{...e,path:t??pz(e.path,n)}}return e})}function cz(e,t,n,r=[]){if(t.length===0&&!n&&r.length===0)return e;let i=new Set(t),a=new Set(r);return e.filter(e=>ym(e)?!i.has(e.docName)&&!_z(e.docName,n):Sm(e)?!_z(e.path,n):Tm(e)?!a.has(e.path)&&!_z(e.path,n):!0)}function lz(e,t){if(e.kind!==`asset`||t.some(t=>Tm(t)&&t.path===e.path))return e;let n=b_(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function uz(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>mz(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>ym(e)&&e.docName===t.path);return o({kind:`document`,docName:n.path,docExt:s?.docExt??t.docExt,size:s?.size??0,modified:r}),i?a:e}let s=e.find(e=>Sm(e)&&e.path===t.path);o({kind:`folder`,path:n.path,size:s?.size??0,modified:r});let c=new Set(n.duplicatedDocNames);for(let i of e){if(ym(i)){let e=gz(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Sm(i)){let e=hz(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function dz(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function fz(e,t){let n=e.kind===`file`?m_(e.path,e.docExt):e.path;return mu(t.contentDir,n,t.pathSeparator)}function pz(e,t){for(let{fromPath:n,toPath:r}of t){if(e===n)return r;if(e.startsWith(`${n}/`))return`${r}${e.slice(n.length)}`}return e}function mz(e,t){return ym(e)&&ym(t)?e.docName===t.docName:Sm(e)&&Sm(t)||Tm(e)&&Tm(t)?e.path===t.path:!1}function hz(e,t,n){return e===t?n:gz(e,t,n)}function gz(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function _z(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function vz(e){let t=(0,$.c)(33),{currentName:n,open:r,onOpenChange:i,onSave:a}=e,[o,s]=(0,Q.useState)(n),c,l;t[0]!==n||t[1]!==o?(c=o.trim(),l=az(c)&&c!==n,t[0]=n,t[1]=o,t[2]=c,t[3]=l):(c=t[2],l=t[3]);let u=l,d;t[4]!==u||t[5]!==c||t[6]!==i||t[7]!==a?(d=function(e){e.preventDefault(),u&&(i(!1),a(c))},t[4]=u,t[5]=c,t[6]=i,t[7]=a,t[8]=d):d=t[8];let f=d,p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)($r,{children:(0,Z.jsx)(Jr,{children:(0,Z.jsx)(Y,{id:`2wxgft`})})}),t[9]=p):p=t[9];let m;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(jh,{htmlFor:`file-target-rename-name`,children:(0,Z.jsx)(Y,{id:`6YtxFj`})}),t[10]=m):m=t[10];let h;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>s(e.currentTarget.value),t[11]=h):h=t[11];let g;t[12]===o?g=t[13]:(g=(0,Z.jsx)(kh,{children:(0,Z.jsxs)(Ph,{children:[m,(0,Z.jsx)(dh,{id:`file-target-rename-name`,autoFocus:!0,value:o,onChange:h})]})}),t[12]=o,t[13]=g);let _;t[14]===i?_=t[15]:(_=()=>i(!1),t[14]=i,t[15]=_);let v;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(Y,{id:`dEgA5A`}),t[16]=v):v=t[16];let y;t[17]===_?y=t[18]:(y=(0,Z.jsx)(X,{type:`button`,variant:`outline`,onClick:_,children:v}),t[17]=_,t[18]=y);let b=!u,x;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(Y,{id:`tfDRzk`}),t[19]=x):x=t[19];let S;t[20]===b?S=t[21]:(S=(0,Z.jsx)(X,{type:`submit`,disabled:b,children:x}),t[20]=b,t[21]=S);let C;t[22]!==S||t[23]!==y?(C=(0,Z.jsxs)(Zr,{children:[y,S]}),t[22]=S,t[23]=y,t[24]=C):C=t[24];let w;t[25]!==f||t[26]!==C||t[27]!==g?(w=(0,Z.jsx)(Yr,{children:(0,Z.jsxs)(`form`,{className:`flex flex-col gap-6`,onSubmit:f,children:[p,g,C]})}),t[25]=f,t[26]=C,t[27]=g,t[28]=w):w=t[28];let T;return t[29]!==i||t[30]!==r||t[31]!==w?(T=(0,Z.jsx)(ei,{open:r,onOpenChange:i,children:w}),t[29]=i,t[30]=r,t[31]=w,t[32]=T):T=t[32],T}var yz=`group @container/tab relative -mb-px flex h-10 min-w-32 max-w-48 grow-0 basis-36 shrink cursor-grab items-center overflow-hidden border border-transparent font-medium outline-none focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:ring-inset active:cursor-grabbing`,bz=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,xz=`rounded-t-md text-muted-foreground hover:border-border/70 hover:bg-muted/60 hover:text-foreground focus-visible:border-border focus-visible:bg-muted focus-visible:text-foreground`,Sz=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden pl-3 pr-1.5 text-left text-[13px] outline-none @max-[5rem]/tab:pl-2`;function Cz(e,t){return gr(Sz,e&&`font-semibold`,t&&`italic`)}function wz(e){return e?`overflow-hidden whitespace-nowrap mask-r-from-[calc(100%-1.5rem)] mask-r-to-[100%]`:`truncate group-hover:text-clip group-hover:mask-r-from-[calc(100%-3rem)] group-hover:mask-r-to-[calc(100%-1.5rem)]`}function Tz(e){let t=e.closest(`[data-editor-tab-overflow-root]`);if(!t)return;let n=Math.max(0,e.scrollWidth-e.clientWidth);t.toggleAttribute(`data-overflow-left`,e.scrollLeft>1),t.toggleAttribute(`data-overflow-right`,e.scrollLeft<n-1)}function Ez(e){return e.metaKey||e.ctrlKey}var Dz=1e3,Oz=new Set;function kz(e,t){return e<0||e>=t?null:e<8?String(e+1):e===t-1?`9`:null}function Az(e,t){let n=kz(e,t);if(n)return[`Meta+${n}`,`Control+${n}`].join(` `)}function jz(e,t){if(!Ez(e)||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key))return null;let n=Number(e.key);if(n===9)return t>0?t-1:null;let r=n-1;return r<Math.min(8,t)?r:null}function Mz(e){let t=(0,$.c)(2),{value:n}=e,r=`⌘${n}`,i;return t[0]===r?i=t[1]:(i=(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`editor-tab-shortcut-hint`,className:`mr-1 flex h-5 w-fit shrink-0 items-center justify-center font-mono tabular-nums @max-[5rem]/tab:hidden`,children:(0,Z.jsx)(en,{className:`px-0.5 text-[10px]`,children:r})}),t[0]=r,t[1]=i),i}function Nz(e){let t=(0,$.c)(52),n,r,i,a,o,s,c,l,u,d,f,p;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=t[12]):({activateFromKeyboard:n,children:r,className:i,dropIndicatorSide:a,label:o,paneId:u,splittable:f,tabId:p,onKeyDown:s,ref:c,style:l,...d}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p);let m;t[13]!==o||t[14]!==u||t[15]!==f||t[16]!==p?(m={kind:`editor-tab`,paneId:u,tabId:p,splittable:f,label:o},t[13]=o,t[14]=u,t[15]=f,t[16]=p,t[17]=m):m=t[17];let h=m,g;t[18]!==h||t[19]!==p?(g={animateLayoutChanges:Pz,id:p,data:h,transition:null},t[18]=h,t[19]=p,t[20]=g):g=t[20];let{attributes:_,listeners:v,rect:y,setNodeRef:b,transform:x,transition:S,isDragging:C}=bg(g),w=y.current?.width,T;t[21]!==C||t[22]!==l||t[23]!==w||t[24]!==x||t[25]!==S?(T=cl({activeWidth:w,disableMovement:!0,isDragging:C,outerStyle:l,transform:x,transition:S}),t[21]=C,t[22]=l,t[23]=w,t[24]=x,t[25]=S,t[26]=T):T=t[26];let E=T,D;t[27]!==c||t[28]!==b?(D=function(e){b(e),typeof c==`function`?c(e):c&&`current`in c&&(c.current=e)},t[27]=c,t[28]=b,t[29]=D):D=t[29];let O=D,k=v?.onKeyDown,A;t[30]!==n||t[31]!==C||t[32]!==s||t[33]!==k?(A=function(e){if(s?.(e),!e.defaultPrevented&&yl(e)){e.preventDefault();let t=e.currentTarget.getBoundingClientRect();e.currentTarget.dispatchEvent(new MouseEvent(`contextmenu`,{bubbles:!0,cancelable:!0,clientX:t.left+Math.min(t.width/2,16),clientY:t.top+t.height/2,view:window}));return}let t=sl({event:e,hasKeyboardActivation:!!n,isDragging:C});if(t!==`ignore`){if(t===`activate-tab`&&n){e.preventDefault(),n();return}k?.(e)}},t[30]=n,t[31]=C,t[32]=s,t[33]=k,t[34]=A):A=t[34];let j=A,M;t[35]!==i||t[36]!==C?(M=vl({className:i,isDragging:C}),t[35]=i,t[36]=C,t[37]=M):M=t[37];let N;t[38]===a?N=t[39]:(N=a?(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-editor-tab-drop-indicator":a,className:gr(`pointer-events-none absolute inset-y-1 z-30 w-0.5 rounded-full bg-primary`,a===`before`?`left-0`:`right-0`)}):null,t[38]=a,t[39]=N);let P;return t[40]!==_||t[41]!==r||t[42]!==O||t[43]!==j||t[44]!==v||t[45]!==u||t[46]!==d||t[47]!==E||t[48]!==M||t[49]!==N||t[50]!==p?(P=(0,Z.jsxs)(`div`,{ref:O,"data-editor-tab-sortable":``,"data-editor-pane-id":u,"data-editor-tab-id":p,className:M,style:E,...d,..._,...v,onKeyDown:j,children:[r,N]}),t[40]=_,t[41]=r,t[42]=O,t[43]=j,t[44]=v,t[45]=u,t[46]=d,t[47]=E,t[48]=M,t[49]=N,t[50]=p,t[51]=P):P=t[51],P}function Pz(){return!1}function Fz(e){let t=(0,$.c)(102),{canSplit:n,children:r,closeTab:i,closeTabs:a,canPin:o,docExt:s,isPreview:c,openTabs:l,pinTab:u,pinnedTabIds:d,promoteTab:f,splitTab:p,skillMenuItems:m,tabLabel:h,tabId:g,target:_,renameName:v,unpinTab:y}=e,b=n===void 0?!0:n,x=o===void 0?!0:o,S=c===void 0?!1:c,[C,w]=(0,Q.useState)(!1),T;t[0]!==x||t[1]!==d||t[2]!==g?(T=x&&d.includes(g),t[0]=x,t[1]=d,t[2]=g,t[3]=T):T=t[3];let E=T,D;if(t[4]!==l||t[5]!==d||t[6]!==g){let e;t[8]===g?e=t[9]:(e=e=>e!==g,t[8]=g,t[9]=e),D=Ne(l.filter(e),d),t[4]=l,t[5]=d,t[6]=g,t[7]=D}else D=t[7];let O=D,k;t[10]!==l||t[11]!==d?(k=Ne(l,d),t[10]=l,t[11]=d,t[12]=k):k=t[12];let A=k,j=b&&l.length>1,M;t[13]===g?M=t[14]:(M=ze(g),t[13]=g,t[14]=M);let N=M,P=N.kind===`doc`&&_&&typeof window<`u`&&window.okDesktop?N.docName:null,F;t[15]===r?F=t[16]:(F=(0,Z.jsx)(ta,{asChild:!0,children:r}),t[15]=r,t[16]=F);let I;t[17]!==i||t[18]!==g?(I=()=>i(g),t[17]=i,t[18]=g,t[19]=I):I=t[19];let L,R;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(zp,{"aria-hidden":`true`}),R=(0,Z.jsx)(Y,{id:`yz7wBu`}),t[20]=L,t[21]=R):(L=t[20],R=t[21]);let z;t[22]!==E||t[23]!==I?(z=(0,Z.jsxs)(Zi,{disabled:E,onSelect:I,children:[L,R]}),t[22]=E,t[23]=I,t[24]=z):z=t[24];let B=O.length===0,V;t[25]!==a||t[26]!==O?(V=()=>{a(O)},t[25]=a,t[26]=O,t[27]=V):V=t[27];let ee,H;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(Ry,{"aria-hidden":`true`}),H=(0,Z.jsx)(Y,{id:`omXJcU`}),t[28]=ee,t[29]=H):(ee=t[28],H=t[29]);let U;t[30]!==B||t[31]!==V?(U=(0,Z.jsxs)(Zi,{disabled:B,onSelect:V,children:[ee,H]}),t[30]=B,t[31]=V,t[32]=U):U=t[32];let W=A.length===0,G;t[33]!==A||t[34]!==a?(G=()=>{a(A)},t[33]=A,t[34]=a,t[35]=G):G=t[35];let te;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(Ip,{"aria-hidden":`true`}),t[36]=te):te=t[36];let ne;t[37]===d.length?ne=t[38]:(ne=d.length?(0,Z.jsx)(Y,{id:`U2Kx6T`}):(0,Z.jsx)(Y,{id:`WyXG7w`}),t[37]=d.length,t[38]=ne);let re;t[39]!==W||t[40]!==G||t[41]!==ne?(re=(0,Z.jsxs)(Zi,{disabled:W,"data-testid":`editor-tab-context-close-all`,onSelect:G,children:[te,ne]}),t[39]=W,t[40]=G,t[41]=ne,t[42]=re):re=t[42];let K;t[43]!==z||t[44]!==U||t[45]!==re?(K=(0,Z.jsxs)(oa,{children:[z,U,re]}),t[43]=z,t[44]=U,t[45]=re,t[46]=K):K=t[46];let ie;t[47]!==s||t[48]!==m||t[49]!==_?(ie=_||m?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(sa,{}),_?(0,Z.jsx)(ez,{docExt:s,target:_,onRename:()=>w(!0)}):null,m]}):null,t[47]=s,t[48]=m,t[49]=_,t[50]=ie):ie=t[50];let q;t[51]!==S||t[52]!==f||t[53]!==g?(q=S&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(sa,{}),(0,Z.jsxs)(Zi,{"data-testid":`editor-tab-context-keep-open`,onSelect:()=>f(g),children:[(0,Z.jsx)(mb,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`GH02QY`})]})]}),t[51]=S,t[52]=f,t[53]=g,t[54]=q):q=t[54];let ae;t[55]!==x||t[56]!==E||t[57]!==u||t[58]!==g||t[59]!==y?(ae=x&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(sa,{}),(0,Z.jsxs)(Zi,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>E?y(g):u(g),children:[(0,Z.jsx)(mb,{"aria-hidden":`true`}),E?(0,Z.jsx)(Y,{id:`SYfHmN`}):(0,Z.jsx)(Y,{id:`3pU8e-`})]})]}),t[55]=x,t[56]=E,t[57]=u,t[58]=g,t[59]=y,t[60]=ae):ae=t[60];let oe;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(sa,{}),t[61]=oe):oe=t[61];let se=!j,ce;t[62]!==p||t[63]!==g||t[64]!==h?(ce=()=>p(g,`left`,h),t[62]=p,t[63]=g,t[64]=h,t[65]=ce):ce=t[65];let le,ue;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(hn,{"aria-hidden":`true`}),ue=(0,Z.jsx)(Y,{id:`pCralD`}),t[66]=le,t[67]=ue):(le=t[66],ue=t[67]);let de;t[68]!==se||t[69]!==ce?(de=(0,Z.jsxs)(Zi,{disabled:se,"data-testid":`editor-tab-context-split-left`,onSelect:ce,children:[le,ue]}),t[68]=se,t[69]=ce,t[70]=de):de=t[70];let fe=!j,pe;t[71]!==p||t[72]!==g||t[73]!==h?(pe=()=>p(g,`right`,h),t[71]=p,t[72]=g,t[73]=h,t[74]=pe):pe=t[74];let J,me;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(tl,{"aria-hidden":`true`}),me=(0,Z.jsx)(Y,{id:`jeCFV7`}),t[75]=J,t[76]=me):(J=t[75],me=t[76]);let he;t[77]!==fe||t[78]!==pe?(he=(0,Z.jsxs)(Zi,{disabled:fe,"data-testid":`editor-tab-context-split-right`,onSelect:pe,children:[J,me]}),t[77]=fe,t[78]=pe,t[79]=he):he=t[79];let ge;t[80]===P?ge=t[81]:(ge=P?(0,Z.jsxs)(Zi,{"data-testid":`editor-tab-context-open-in-new-window`,onSelect:()=>{Yx(P,`tab-menu`)},children:[(0,Z.jsx)(Cb,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`E91VZY`})]}):null,t[80]=P,t[81]=ge);let _e;t[82]!==de||t[83]!==he||t[84]!==ge?(_e=(0,Z.jsxs)(oa,{children:[de,he,ge]}),t[82]=de,t[83]=he,t[84]=ge,t[85]=_e):_e=t[85];let ve;t[86]!==K||t[87]!==ie||t[88]!==q||t[89]!==ae||t[90]!==_e?(ve=(0,Z.jsxs)(ra,{className:`min-w-56`,children:[K,ie,q,ae,oe,_e]}),t[86]=K,t[87]=ie,t[88]=q,t[89]=ae,t[90]=_e,t[91]=ve):ve=t[91];let ye;t[92]!==ve||t[93]!==F?(ye=(0,Z.jsxs)(ea,{children:[F,ve]}),t[92]=ve,t[93]=F,t[94]=ye):ye=t[94];let be;t[95]!==v||t[96]!==C||t[97]!==_?(be=C&&_&&v?(0,Z.jsx)(vz,{currentName:v,open:!0,onOpenChange:w,onSave:e=>WR(_,e)}):null,t[95]=v,t[96]=C,t[97]=_,t[98]=be):be=t[98];let xe;return t[99]!==ye||t[100]!==be?(xe=(0,Z.jsxs)(Z.Fragment,{children:[ye,be]}),t[99]=ye,t[100]=be,t[101]=xe):xe=t[101],xe}function Iz(e){let t=(0,$.c)(28),{accessibleLabel:n,closeTab:r,forceCloseVisible:i,isActive:a,isPinned:o,shortcutHint:s,tabId:c,unpinTab:l}=e,u=i===void 0?!1:i,d=s===void 0?null:s,{_:f}=Bn();if(d){let e;return t[0]===d?e=t[1]:(e=(0,Z.jsx)(Mz,{value:d}),t[0]=d,t[1]=e),e}if(o){let e;t[2]!==f||t[3]!==n?(e=f({id:`t18QYR`,values:{accessibleLabel:n}}),t[2]=f,t[3]=n,t[4]=e):e=t[4];let r;t[5]!==c||t[6]!==l?(r=e=>{e.stopPropagation(),l(c)},t[5]=c,t[6]=l,t[7]=r):r=t[7];let i;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(mb,{"aria-hidden":`true`}),t[8]=i):i=t[8];let a;return t[9]!==e||t[10]!==r?(a=(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,"data-testid":`editor-tab-unpin-button`,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[9]=e,t[10]=r,t[11]=a):a=t[11],a}let p;t[12]!==f||t[13]!==n?(p=f({id:`JLzQi_`,values:{accessibleLabel:n}}),t[12]=f,t[13]=n,t[14]=p):p=t[14];let m=u||a,h;t[15]===m?h=t[16]:(h=hl(m),t[15]=m,t[16]=h);let g;t[17]===a?g=t[18]:(g=fl(a),t[17]=a,t[18]=g);let _;t[19]!==r||t[20]!==c?(_=e=>{e.stopPropagation(),r(c)},t[19]=r,t[20]=c,t[21]=_):_=t[21];let v;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(zp,{"aria-hidden":`true`}),t[22]=v):v=t[22];let y;return t[23]!==p||t[24]!==h||t[25]!==g||t[26]!==_?(y=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":p,"data-testid":`editor-tab-close-button`,className:h,tabIndex:g,onClick:_,children:v}),t[23]=p,t[24]=h,t[25]=g,t[26]=_,t[27]=y):y=t[27],y}function Lz(e){let t=(0,$.c)(7),{children:n,path:r}=e,{active:i}=Og();if(i)return n;let a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(Br,{asChild:!0,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Z.jsx)(Vr,{side:`bottom`,sideOffset:8,className:`max-w-xs break-all`,children:r}),t[2]=r,t[3]=o);let s;return t[4]!==a||t[5]!==o?(s=(0,Z.jsxs)(Ur,{children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6],s}function Rz(e){let t=(0,$.c)(1),{hasConflict:n}=e;if(!n)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Lp,{"aria-hidden":`true`,"data-testid":`editor-tab-conflict-badge`,className:`mr-1 size-3.5 shrink-0 text-amber-500`}),t[0]=r):r=t[0],r}function zz(e){let t=(0,$.c)(37),{accessibleLabel:n,activateTab:r,baseName:i,docName:a,extension:o,hideDocExtension:s,isActive:c,isFocusedPane:l,isPreview:u,promoteTab:d,tabId:f}=e,{_:p}=Bn(),m=nj(a)===`conflict`,h;t[0]!==p||t[1]!==n||t[2]!==m?(h=m?p({id:`mVFyH-`,values:{accessibleLabel:n}}):n,t[0]=p,t[1]=n,t[2]=m,t[3]=h):h=t[3];let g=h,_=c&&l,v;t[4]!==u||t[5]!==_?(v=Cz(_,u),t[4]=u,t[5]=_,t[6]=v):v=t[6];let y;t[7]!==r||t[8]!==f?(y=()=>{r(f)},t[7]=r,t[8]=f,t[9]=y):y=t[9];let b;t[10]!==d||t[11]!==f?(b=e=>{e.preventDefault(),e.stopPropagation(),d(f)},t[10]=d,t[11]=f,t[12]=b):b=t[12];let x;t[13]===m?x=t[14]:(x=(0,Z.jsx)(Rz,{hasConflict:m}),t[13]=m,t[14]=x);let S=c?`fade`:`ellipsis`,C;t[15]===c?C=t[16]:(C=gr(`min-w-0 flex-1`,wz(c)),t[15]=c,t[16]=C);let w;t[17]!==i||t[18]!==S||t[19]!==C?(w=(0,Z.jsx)(`span`,{"data-editor-tab-title-overflow":S,className:C,children:i}),t[17]=i,t[18]=S,t[19]=C,t[20]=w):w=t[20];let T;t[21]!==o||t[22]!==s?(T=!s&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:o}),t[21]=o,t[22]=s,t[23]=T):T=t[23];let E;t[24]!==T||t[25]!==w?(E=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[w,T]}),t[24]=T,t[25]=w,t[26]=E):E=t[26];let D;t[27]!==g||t[28]!==E||t[29]!==v||t[30]!==y||t[31]!==b||t[32]!==x?(D=(0,Z.jsxs)(`button`,{type:`button`,"aria-label":g,dir:`auto`,className:v,onClick:y,onDoubleClick:b,tabIndex:-1,children:[x,E]}),t[27]=g,t[28]=E,t[29]=v,t[30]=y,t[31]=b,t[32]=x,t[33]=D):D=t[33];let O;return t[34]!==g||t[35]!==D?(O=(0,Z.jsx)(Lz,{path:g,children:D}),t[34]=g,t[35]=D,t[36]=O):O=t[36],O}function Bz(e){let t=(0,$.c)(53),{accessibleLabel:n,activateTab:r,ariaKeyShortcuts:i,children:a,closeTab:o,closeTabs:s,docExt:c,dropIndicatorSide:l,forceCloseVisible:u,isActive:d,isPinned:f,isPreview:p,openTabs:m,paneId:h,pinTab:g,pinnedTabIds:_,promoteTab:v,renameName:y,shortcutHint:b,splitTab:x,skillMenuItems:S,tabId:C,target:w,unpinTab:T}=e,E;t[0]!==r||t[1]!==C?(E=()=>r(C),t[0]=r,t[1]=C,t[2]=E):E=t[2];let D=d?`page`:void 0,O=d?`true`:void 0,k=p?`true`:void 0,A=d?bz:xz,j;t[3]===A?j=t[4]:(j=gr(yz,A),t[3]=A,t[4]=j);let M;t[5]!==o||t[6]!==f||t[7]!==C?(M=e=>{e.button===1&&(e.preventDefault(),f||o(C))},t[5]=o,t[6]=f,t[7]=C,t[8]=M):M=t[8];let N;t[9]!==r||t[10]!==C?(N=e=>{e.target===e.currentTarget&&r(C)},t[9]=r,t[10]=C,t[11]=N):N=t[11];let P;t[12]!==n||t[13]!==o||t[14]!==u||t[15]!==d||t[16]!==f||t[17]!==b||t[18]!==C||t[19]!==T?(P=(0,Z.jsx)(Iz,{accessibleLabel:n,closeTab:o,forceCloseVisible:u,isActive:d,isPinned:f,shortcutHint:b,tabId:C,unpinTab:T}),t[12]=n,t[13]=o,t[14]=u,t[15]=d,t[16]=f,t[17]=b,t[18]=C,t[19]=T,t[20]=P):P=t[20];let F;t[21]!==n||t[22]!==i||t[23]!==a||t[24]!==l||t[25]!==h||t[26]!==E||t[27]!==D||t[28]!==O||t[29]!==k||t[30]!==j||t[31]!==M||t[32]!==N||t[33]!==P||t[34]!==C?(F=(0,Z.jsxs)(Nz,{dropIndicatorSide:l,label:n,paneId:h,splittable:!0,tabId:C,activateFromKeyboard:E,"aria-current":D,"aria-keyshortcuts":i,"data-active-tab":O,"data-preview-tab":k,className:j,onAuxClick:M,onClick:N,children:[a,P]}),t[21]=n,t[22]=i,t[23]=a,t[24]=l,t[25]=h,t[26]=E,t[27]=D,t[28]=O,t[29]=k,t[30]=j,t[31]=M,t[32]=N,t[33]=P,t[34]=C,t[35]=F):F=t[35];let I;return t[36]!==n||t[37]!==o||t[38]!==s||t[39]!==c||t[40]!==p||t[41]!==m||t[42]!==g||t[43]!==_||t[44]!==v||t[45]!==y||t[46]!==S||t[47]!==x||t[48]!==F||t[49]!==C||t[50]!==w||t[51]!==T?(I=(0,Z.jsx)(Fz,{tabId:C,docExt:c,target:w,renameName:y,openTabs:m,closeTab:o,closeTabs:s,isPreview:p,pinTab:g,pinnedTabIds:_,promoteTab:v,splitTab:x,skillMenuItems:S,tabLabel:n,unpinTab:T,children:F}),t[36]=n,t[37]=o,t[38]=s,t[39]=c,t[40]=p,t[41]=m,t[42]=g,t[43]=_,t[44]=v,t[45]=y,t[46]=S,t[47]=x,t[48]=F,t[49]=C,t[50]=w,t[51]=T,t[52]=I):I=t[52],I}function Vz(e){let t=(0,$.c)(111),{dropIndicatorIndex:n,paneId:r,onSplitComplete:i,reserveLeadingChrome:a,reserveTrailingChrome:o}=e,s=n===void 0?null:n,c=a===void 0?!1:a,l=o===void 0?!1:o,{_:u}=Bn(),d=Et(),{reopenClosedTab:f}=d,p;t[0]!==d.panes||t[1]!==r?(p=d.panes.find(e=>e.id===r)??d.panes[0],t[0]=d.panes,t[1]=r,t[2]=p):p=t[2];let m=p,h=m?.id??r,g;t[3]===m?.openTabs?g=t[4]:(g=m?.openTabs??[],t[3]=m?.openTabs,t[4]=g);let _=g,v;t[5]===m?.pinnedTabIds?v=t[6]:(v=m?.pinnedTabIds??[],t[5]=m?.pinnedTabIds,t[6]=v);let y=v,b=m?.previewTabId??null,x;t[7]===m?.newTabIds?x=t[8]:(x=m?.newTabIds??[],t[7]=m?.newTabIds,t[8]=x);let S=x,C=d.visibleTabIdsByPane.get(h)??[..._,...S],w=m?.activeTarget??null,T=m?.activeTabId??null,E=m?.activeNewTabId??null,D=E!==null,O=d.focusedPaneId===h,k=Fh({enabled:C.some(qz)}),A=Jl(),j=k.status===`ready`?k.data.filter(Kz):[],M=new Map(j.map(Gz)),N;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(N=[`project`,`global`],t[9]=N):N=t[9];let P;t[10]!==k.data||t[11]!==k.status?(P=new Map(N.map(e=>[e,new Set(k.status===`ready`?k.data.filter(t=>t.scope===e).map(Wz):[])])),t[10]=k.data,t[11]=k.status,t[12]=P):P=t[12];let F=P,I;t[13]!==d||t[14]!==h?(I=e=>d.activateTabInPane(h,e),t[13]=d,t[14]=h,t[15]=I):I=t[15];let L=I,R;t[16]!==d||t[17]!==h?(R=e=>d.activateNewTabInPane(h,e),t[16]=d,t[17]=h,t[18]=R):R=t[18];let z=R,V;t[19]!==d||t[20]!==h?(V=e=>d.closeTabInPane(h,e),t[19]=d,t[20]=h,t[21]=V):V=t[21];let ee=V,H;t[22]!==d||t[23]!==h?(H=e=>d.closeTabsInPane(h,e),t[22]=d,t[23]=h,t[24]=H):H=t[24];let U=H,W;t[25]!==d||t[26]!==h?(W=e=>d.closeNewTabInPane(h,e),t[25]=d,t[26]=h,t[27]=W):W=t[27];let G=W,te;t[28]!==d||t[29]!==h?(te=()=>d.openNewTabInPane(h),t[28]=d,t[29]=h,t[30]=te):te=t[30];let ne=te,re;t[31]!==d||t[32]!==h?(re=e=>d.pinTabInPane(h,e),t[31]=d,t[32]=h,t[33]=re):re=t[33];let K=re,ie;t[34]!==d||t[35]!==h?(ie=e=>d.unpinTabInPane(h,e),t[34]=d,t[35]=h,t[36]=ie):ie=t[36];let q=ie,ae;t[37]!==d||t[38]!==h?(ae=e=>d.promoteTabInPane(h,e),t[37]=d,t[38]=h,t[39]=ae):ae=t[39];let oe=ae,se;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(se={id:0,text:``},t[40]=se):se=t[40];let[ce,le]=(0,Q.useState)(se),ue;t[41]!==u||t[42]!==d||t[43]!==i?(ue=function(e,t,n){let r=d.moveTabToNewPane(e,t);if(!r)return;let a=u(t===`left`?{id:`3C2nIJ`,values:{label:n}}:{id:`GceAYf`,values:{label:n}});le(e=>({id:e.id+1,text:a})),i?.(r,e)},t[41]=u,t[42]=d,t[43]=i,t[44]=ue):ue=t[44];let de=ue,{pageMeta:fe}=Nd(),[pe,me]=(0,Q.useState)(!1),he=(0,Q.useRef)(null),ge=(0,Q.useRef)(null),_e=(0,Q.useRef)(!1),ve=(0,Q.useRef)(!1),ye;t[45]!==T||t[46]!==w?(ye=T??(w?Ue(w):null),t[45]=T,t[46]=w,t[47]=ye):ye=t[47];let be=ye,xe=function(e){if(s===e)return`before`;if(s===C.length&&e===C.length-1)return`after`},Se,Ce;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(Se=()=>()=>{ge.current!==null&&(window.clearTimeout(ge.current),ge.current=null)},Ce=[],t[48]=Se,t[49]=Ce):(Se=t[48],Ce=t[49]),(0,Q.useEffect)(Se,Ce);let we=typeof window<`u`&&window.okDesktop!=null,Te;t[50]===S?Te=t[51]:(Te=new Set(S),t[50]=S,t[51]=Te);let Ee=Te,De;t[52]!==G||t[53]!==U||t[54]!==Ee?(De=function(e){let t=[],n=[];for(let r of e)Ee.has(r)?n.push(r):t.push(r);t.length>0&&U(t);for(let e of n)G(e)},t[52]=G,t[53]=U,t[54]=Ee,t[55]=De):De=t[55];let Oe=De,ke;t[56]!==E||t[57]!==be||t[58]!==d||t[59]!==O||t[60]!==D||t[61]!==S||t[62]!==_||t[63]!==f||t[64]!==h?(ke=()=>{if(!O)return;let e=new Set(S),t=[..._,...S],n=function(){ge.current!==null&&(window.clearTimeout(ge.current),ge.current=null)},r=function(e){_e.current!==e&&(_e.current=e)},i=function(e){ve.current!==e&&(ve.current=e,me(e))},a=function(){r(!0),!(ve.current||ge.current!==null)&&(ge.current=window.setTimeout(()=>{ge.current=null,_e.current&&i(!0)},Dz))},o=function(){n(),r(!1),i(!1)},s=function(t){e.has(t)?d.activateNewTabInPane(h,t):d.activateTabInPane(h,t)},c=function(e){if(t.length===0)return;let n=D?E:be,r=n?t.indexOf(n):-1;s(t[((r>=0?r:0)+e+t.length)%t.length])},l=function(e){if(!Ez(e)||Mr())return;if(a(),Mc(e,`tab-new`)){e.preventDefault(),d.openNewTabInPane(h);return}if(Mc(e,`tab-reopen-closed`)){e.preventDefault(),f();return}if(Mc(e,`tab-next`)){e.preventDefault(),c(1);return}if(Mc(e,`tab-previous`)){e.preventDefault(),c(-1);return}let n=jz(e,t.length);n!==null&&(e.preventDefault(),s(t[n]))},u=function(e){!e.metaKey&&!e.ctrlKey&&o()};return window.addEventListener(`keydown`,l,{capture:!0}),window.addEventListener(`keyup`,u,{capture:!0}),window.addEventListener(`blur`,o),document.addEventListener(`visibilitychange`,o),()=>{window.removeEventListener(`keydown`,l,{capture:!0}),window.removeEventListener(`keyup`,u,{capture:!0}),window.removeEventListener(`blur`,o),document.removeEventListener(`visibilitychange`,o)}},t[56]=E,t[57]=be,t[58]=d,t[59]=O,t[60]=D,t[61]=S,t[62]=_,t[63]=f,t[64]=h,t[65]=ke):ke=t[65];let Ae;t[66]!==E||t[67]!==be||t[68]!==d.activateNewTabInPane||t[69]!==d.activateTabInPane||t[70]!==d.openNewTabInPane||t[71]!==O||t[72]!==D||t[73]!==S||t[74]!==_||t[75]!==f||t[76]!==h?(Ae=[E,be,d.activateNewTabInPane,d.activateTabInPane,d.openNewTabInPane,O,D,S,_,f,h],t[66]=E,t[67]=be,t[68]=d.activateNewTabInPane,t[69]=d.activateTabInPane,t[70]=d.openNewTabInPane,t[71]=O,t[72]=D,t[73]=S,t[74]=_,t[75]=f,t[76]=h,t[77]=Ae):Ae=t[77],(0,Q.useEffect)(ke,Ae);let je=pe,Me=D?E:be,Ne=(0,Q.useRef)(Me),Pe;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=()=>{let e=he.current;e&&Tz(e)},t[78]=Pe):Pe=t[78],(0,Q.useLayoutEffect)(Pe);let Fe,Ie;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=()=>{let e=he.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>Tz(e));return t.observe(e),()=>t.disconnect()},Ie=[],t[79]=Fe,t[80]=Ie):(Fe=t[79],Ie=t[80]),(0,Q.useLayoutEffect)(Fe,Ie);let Le,Re;t[81]!==h||t[82]!==Me?(Le=()=>{let e=Ne.current;if(Ne.current=Me,Me===null||Me===e)return;let t=he.current;t&&dl(t,h,Me)?.scrollIntoView({block:`nearest`,inline:`nearest`})},Re=[h,Me],t[81]=h,t[82]=Me,t[83]=Le,t[84]=Re):(Le=t[83],Re=t[84]),(0,Q.useEffect)(Le,Re);let Be=c?`pl-[calc(var(--editor-header-leading-offset,0px)+var(--editor-header-leading-width,0px)+0.5rem)]`:`pl-2`,Ve=l&&`pr-[var(--editor-header-trailing-width,0px)]`,He;t[85]!==Be||t[86]!==Ve?(He=gr(`flex h-12 w-full min-w-0 touch-manipulation items-end overflow-hidden`,Be,Ve,we&&`[-webkit-app-region:drag]`),t[85]=Be,t[86]=Ve,t[87]=He):He=t[87];let We;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(We=gr(`group/tab-overflow relative flex min-w-0 flex-1 self-stretch items-end gap-px overflow-hidden`,we&&`[-webkit-app-region:drag]`),t[88]=We):We=t[88];let Ge;t[89]!==ce.id||t[90]!==ce.text?(Ge=(0,Z.jsx)(`span`,{"aria-atomic":`true`,"aria-live":`polite`,"data-testid":`editor-tab-split-announcement`,className:`sr-only`,children:(0,Z.jsx)(`span`,{children:ce.text},ce.id)}),t[89]=ce.id,t[90]=ce.text,t[91]=Ge):Ge=t[91];let Ke;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=gr(`relative h-10 w-fit max-w-[calc(100%-1.75rem)] min-w-0 flex-none self-end`,we&&`[-webkit-app-region:no-drag]`),t[92]=Ke):Ke=t[92];let qe=Uz,Je=Hz,Ye=C.length===0&&s===0?(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-editor-tab-drop-indicator":`before`,className:`pointer-events-none absolute inset-y-1 left-0 z-30 w-0.5 rounded-full bg-primary`}):null,Xe=C.map((e,t)=>{let n=pe?kz(t,C.length):null,r=O?Az(t,C.length):void 0;if(Ee.has(e)){let i=e===E;return(0,Z.jsx)(Fz,{tabId:e,canPin:!1,openTabs:C,closeTab:G,closeTabs:Oe,pinTab:K,pinnedTabIds:y,promoteTab:oe,splitTab:de,tabLabel:u({id:`3YvS-c`}),unpinTab:q,children:(0,Z.jsxs)(Nz,{dropIndicatorSide:xe(t),label:u({id:`3YvS-c`}),paneId:h,splittable:!0,tabId:e,activateFromKeyboard:()=>z(e),"aria-current":i?`page`:void 0,"aria-keyshortcuts":r,"data-active-tab":i?`true`:void 0,className:gr(yz,i?bz:xz),onAuxClick:t=>{t.button===1&&(t.preventDefault(),G(e))},onClick:t=>{t.target===t.currentTarget&&z(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":u({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:Cz(i&&O,!1),onClick:()=>z(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{"data-editor-tab-title-overflow":`ellipsis`,className:`min-w-0 truncate`,children:ln(e)?(0,Z.jsx)(Y,{id:`hgf5io`}):(0,Z.jsx)(Y,{id:`3YvS-c`})})}),n?(0,Z.jsx)(Mz,{value:n}):(0,Z.jsx)(`button`,{type:`button`,"aria-label":u({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:hl(je||i),tabIndex:fl(i),onClick:t=>{t.stopPropagation(),G(e)},children:(0,Z.jsx)(zp,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let i=ze(e),a=e===be,o=y.includes(e),s=e===b;if(i.kind===`folder`){let{baseName:c,label:l,prefix:u}=J(i.folderPath,`/`),d=`${u}${l}`;return(0,Z.jsx)(Bz,{accessibleLabel:d,activateTab:L,ariaKeyShortcuts:r,dropIndicatorSide:xe(t),tabId:e,paneId:h,target:{kind:`folder`,target:i.folderPath,folderPath:i.folderPath},renameName:c,openTabs:C,closeTab:ee,closeTabs:Oe,forceCloseVisible:je,isActive:a,isPinned:o,isPreview:s,pinTab:K,pinnedTabIds:y,promoteTab:oe,shortcutHint:n,splitTab:de,unpinTab:q,children:(0,Z.jsx)(Lz,{path:d,children:(0,Z.jsx)(`button`,{type:`button`,"aria-label":d,dir:`auto`,className:Cz(a&&O,s),onClick:()=>L(e),onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),oe(e)},tabIndex:-1,children:(0,Z.jsxs)(`span`,{"data-editor-tab-title-overflow":a?`fade`:`ellipsis`,className:gr(`min-w-0 flex-1`,wz(a)),children:[u&&(0,Z.jsx)(`span`,{className:gr(`@max-[5rem]/tab:hidden`,a&&`text-muted-foreground`),children:u}),(0,Z.jsxs)(`span`,{children:[c,`/`]})]})})})},e)}if(i.kind===`asset`||i.kind===`skill-file`||i.kind===`skill-preview`){let c;bb426:switch(i.kind){case`asset`:c=i.assetPath;break bb426;case`skill-file`:c=i.path;break bb426;case`skill-preview`:c=i.name}let{baseName:l,label:u,prefix:d}=J(c,``),f=`${d}${u}`,p=i.kind===`skill-file`?j.filter(e=>e.scope===i.scope&&e.name===i.name):[],m=i.kind===`skill-file`?i.host?p.find(e=>e.hosts[0]===i.host):p.length===1?p[0]:void 0:void 0;return(0,Z.jsx)(Bz,{accessibleLabel:f,activateTab:L,ariaKeyShortcuts:r,dropIndicatorSide:xe(t),tabId:e,paneId:h,target:i.kind===`asset`?{kind:`asset`,target:i.assetPath,assetPath:i.assetPath,mediaKind:null}:void 0,renameName:i.kind===`asset`?l:void 0,openTabs:C,closeTab:ee,closeTabs:Oe,forceCloseVisible:je,isActive:a,isPinned:o,isPreview:s,pinTab:K,pinnedTabIds:y,promoteTab:oe,shortcutHint:n,splitTab:de,skillMenuItems:i.kind===`skill-file`&&m?(0,Z.jsx)(Kl,{actions:A,filePath:i.path,menuKind:`context`,skill:m}):void 0,unpinTab:q,children:(0,Z.jsx)(Lz,{path:f,children:(0,Z.jsx)(`button`,{type:`button`,"aria-label":f,dir:`auto`,className:Cz(a&&O,s),onClick:()=>L(e),onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),oe(e)},tabIndex:-1,children:(0,Z.jsxs)(`span`,{"data-editor-tab-title-overflow":a?`fade`:`ellipsis`,className:gr(`min-w-0 flex-1`,wz(a)),children:[d?(0,Z.jsx)(`span`,{className:gr(`text-muted-foreground/60 @max-[5rem]/tab:hidden`,a&&`text-muted-foreground`),children:d}):null,(0,Z.jsx)(`span`,{children:l})]})})})},e)}let c=i.docName,l=M.get(c),d=fe.get(c)?.docExt??(yo(c)?``:`.md`),f=l?null:lu(c,j,d),{baseName:p,extension:m,label:g,prefix:_}=J(c,d),v=`${_}${g}`,x=d===``||d===`.md`||d===`.mdx`,S=!B(c)&&!cn(c);return(0,Z.jsx)(Bz,{accessibleLabel:v,activateTab:L,ariaKeyShortcuts:r,dropIndicatorSide:xe(t),tabId:e,paneId:h,docExt:d,target:S?{kind:`doc`,target:c,docName:c}:void 0,renameName:S?`${p}${m}`:void 0,openTabs:C,closeTab:ee,closeTabs:Oe,forceCloseVisible:je,isActive:a,isPinned:o,isPreview:s,pinTab:K,pinnedTabIds:y,promoteTab:oe,shortcutHint:n,splitTab:de,skillMenuItems:l?(0,Z.jsx)($l,{actions:A,existingNames:F.get(l.scope)??Oz,menuKind:`context`,skill:l}):f?(0,Z.jsx)(Kl,{actions:A,filePath:f.filePath,menuKind:`context`,skill:f.skill}):void 0,unpinTab:q,children:(0,Z.jsx)(zz,{accessibleLabel:v,activateTab:L,baseName:p,docName:c,extension:m,hideDocExtension:x,isActive:a,isFocusedPane:O,isPreview:s,promoteTab:oe,tabId:e})},e)}),Ze;t[93]!==qe||t[94]!==Je||t[95]!==Ye||t[96]!==Xe?(Ze=(0,Z.jsxs)(`div`,{ref:he,"data-editor-tab-scroll":``,className:`scrollbar-none flex h-10 w-fit max-w-full min-w-0 items-end gap-px overflow-x-auto overflow-y-hidden overscroll-x-contain group-data-[overflow-left]/tab-overflow:mask-l-from-[calc(100%-4rem)] group-data-[overflow-right]/tab-overflow:mask-r-from-[calc(100%-4rem)]`,onScroll:qe,onWheel:Je,children:[Ye,Xe]}),t[93]=qe,t[94]=Je,t[95]=Ye,t[96]=Xe,t[97]=Ze):Ze=t[97];let Qe;t[98]!==Ke||t[99]!==Ze?(Qe=(0,Z.jsx)(`div`,{className:Ke,children:Ze}),t[98]=Ke,t[99]=Ze,t[100]=Qe):Qe=t[100];let $e;t[101]===u?$e=t[102]:($e=u({id:`3YvS-c`}),t[101]=u,t[102]=$e);let et;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(et=gr(`first:mb-3 mb-1.5 shrink-0`,we&&`[-webkit-app-region:no-drag]`),t[103]=et):et=t[103];let tt;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(tt=(0,Z.jsx)(dr,{"aria-hidden":`true`}),t[104]=tt):tt=t[104];let nt;t[105]!==ne||t[106]!==$e?(nt=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":$e,"data-testid":`editor-new-tab-button`,className:et,onClick:ne,children:tt})}),t[105]=ne,t[106]=$e,t[107]=nt):nt=t[107];let rt;t[108]===Symbol.for(`react.memo_cache_sentinel`)?(rt=(0,Z.jsx)(Vr,{children:(0,Z.jsx)(Y,{id:`3YvS-c`})}),t[108]=rt):rt=t[108];let it;return t[109]===nt?it=t[110]:(it=(0,Z.jsxs)(Ur,{children:[nt,rt]}),t[109]=nt,t[110]=it),(0,Z.jsxs)(`div`,{"data-editor-pane-tabs":h,"data-electron-drag":we?``:void 0,className:He,children:[(0,Z.jsxs)(`div`,{"data-editor-tab-overflow-root":``,"data-electron-drag":we?``:void 0,className:We,children:[Ge,(0,Z.jsx)(jg,{items:[...C],strategy:kg,children:Qe}),it]}),A.dialogs]})}function Hz(e){il(e),Tz(e.currentTarget)}function Uz(e){return Tz(e.currentTarget)}function Wz(e){return e.name}function Gz(e){return[pm(e),e]}function Kz(e){return!e.managed}function qz(e){let t=ze(e);return t.kind===`skill-file`||t.kind===`doc`&&B(t.docName)}function Jz(e){let t=(0,$.c)(8),{docName:n}=e,r=(0,Q.useRef)(null),i,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{r.current?.focus()},a=[],t[0]=i,t[1]=a):(i=t[0],a=t[1]),(0,Q.useEffect)(i,a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`h2`,{className:`font-medium text-base text-foreground`,children:(0,Z.jsx)(Y,{id:`1lFNz3`})}),t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Z.jsx)(`p`,{className:`max-w-md break-all text-muted-foreground text-sm`,children:(0,Z.jsx)(Mu,{children:n})}),t[3]=n,t[4]=s);let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(X,{ref:r,variant:`secondary`,onClick:Yz,children:(0,Z.jsx)(Y,{id:`rf8fiC`})}),t[5]=c):c=t[5];let l;return t[6]===s?l=t[7]:(l=(0,Z.jsxs)(`div`,{"data-testid":`note-window-deleted-state`,className:`flex h-full flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[o,s,c]}),t[6]=s,t[7]=l),l}function Yz(){window.close()}var Xz=300;function Zz(e){return e.activeTarget?.kind===`large-file`?null:e.activeTarget?mm(e.activeTarget):null}function Qz(e){let t=(0,$.c)(14),{children:n,index:r,isFocused:i,paneId:a,size:o}=e,s=`editor-pane-strip:${a}`,c;t[0]!==r||t[1]!==a?(c={kind:`pane-strip`,paneId:a,index:r},t[0]=r,t[1]=a,t[2]=c):c=t[2];let l;t[3]!==s||t[4]!==c?(l={id:s,data:c},t[3]=s,t[4]=c,t[5]=l):l=t[5];let{setNodeRef:u}=Eg(l),d=i||void 0,f;t[6]===o?f=t[7]:(f={flexGrow:o},t[6]=o,t[7]=f);let p;return t[8]!==n||t[9]!==a||t[10]!==u||t[11]!==d||t[12]!==f?(p=(0,Z.jsx)(`div`,{ref:u,"data-editor-pane-tab-group":a,"data-editor-pane-focused":d,className:`relative h-full min-w-0 shrink basis-0`,style:f,children:n}),t[8]=n,t[9]=a,t[10]=u,t[11]=d,t[12]=f,t[13]=p):p=t[13],p}function $z(e){let t=(0,$.c)(16),{drag:n,paneId:r,side:i}=e,a=`editor-pane-edge:${r}:${i}`,o;t[0]!==r||t[1]!==i?(o={kind:`pane-edge`,paneId:r,side:i},t[0]=r,t[1]=i,t[2]=o):o=t[2];let s=n?.splittable!==!0,c;t[3]!==a||t[4]!==o||t[5]!==s?(c={id:a,data:o,disabled:s},t[3]=a,t[4]=o,t[5]=s,t[6]=c):c=t[6];let{isOver:l,setNodeRef:u}=Eg(c),d=l?i:void 0,f=i===`left`?`left-0`:`right-0`,p=l&&`bg-primary/15 opacity-100 ring-2 ring-primary ring-inset`,m;t[7]!==f||t[8]!==p?(m=gr(`pointer-events-none absolute inset-y-0 z-30 w-12 opacity-0`,f,p),t[7]=f,t[8]=p,t[9]=m):m=t[9];let h;return t[10]!==r||t[11]!==u||t[12]!==i||t[13]!==d||t[14]!==m?(h=(0,Z.jsx)(`div`,{ref:u,"aria-hidden":`true`,"data-pane-edge":i,"data-editor-pane-id":r,"data-pane-drop-side":d,className:m}),t[10]=r,t[11]=u,t[12]=i,t[13]=d,t[14]=m,t[15]=h):h=t[15],h}function eB(e){let t=(0,$.c)(29),{drag:n,leftPaneId:r,rightPaneId:i}=e,a=`editor-pane-edge:${r}:right`,o;t[0]===r?o=t[1]:(o={kind:`pane-edge`,paneId:r,side:`right`},t[0]=r,t[1]=o);let s=n?.splittable!==!0,c;t[2]!==a||t[3]!==o||t[4]!==s?(c={id:a,data:o,disabled:s},t[2]=a,t[3]=o,t[4]=s,t[5]=c):c=t[5];let{isOver:l,setNodeRef:u}=Eg(c),d=`editor-pane-edge:${i}:left`,f;t[6]===i?f=t[7]:(f={kind:`pane-edge`,paneId:i,side:`left`},t[6]=i,t[7]=f);let p=n?.splittable!==!0,m;t[8]!==d||t[9]!==f||t[10]!==p?(m={id:d,data:f,disabled:p},t[8]=d,t[9]=f,t[10]=p,t[11]=m):m=t[11];let{isOver:h,setNodeRef:g}=Eg(m),_=l?`right`:h?`left`:null,v;t[12]!==r||t[13]!==u?(v=(0,Z.jsx)(`div`,{ref:u,"aria-hidden":`true`,"data-pane-edge":`right`,"data-pane-edge-pane-id":r,className:`pointer-events-none absolute inset-y-0 right-1/2 w-12`}),t[12]=r,t[13]=u,t[14]=v):v=t[14];let y;t[15]!==i||t[16]!==g?(y=(0,Z.jsx)(`div`,{ref:g,"aria-hidden":`true`,"data-pane-edge":`left`,"data-pane-edge-pane-id":i,className:`pointer-events-none absolute inset-y-0 left-1/2 w-12`}),t[15]=i,t[16]=g,t[17]=y):y=t[17];let b=_??void 0,x=_&&`bg-primary/15 opacity-100 ring-2 ring-primary ring-inset`,S;t[18]===x?S=t[19]:(S=gr(`pointer-events-none absolute inset-y-0 left-1/2 z-30 w-24 -translate-x-1/2 opacity-0`,x),t[18]=x,t[19]=S);let C;t[20]!==r||t[21]!==i||t[22]!==b||t[23]!==S?(C=(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-pane-boundary-drop":``,"data-pane-boundary-left":r,"data-pane-boundary-right":i,"data-pane-drop-side":b,className:S}),t[20]=r,t[21]=i,t[22]=b,t[23]=S,t[24]=C):C=t[24];let w;return t[25]!==y||t[26]!==C||t[27]!==v?(w=(0,Z.jsxs)(Z.Fragment,{children:[v,y,C]}),t[25]=y,t[26]=C,t[27]=v,t[28]=w):w=t[28],w}function tB(e){let t=(0,$.c)(9),{docName:n,onActivityMount:r,onPaneFocus:i,paneId:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useEffectEvent)(r),c=(0,Q.useEffectEvent)(i),l;t[0]!==s||t[1]!==c||t[2]!==a?(l=()=>{let e=o.current;if(!e)return;let t=()=>c(a);return e.addEventListener(`pointerdown`,t,!0),e.addEventListener(`focusin`,t,!0),s(a,e),()=>{e.removeEventListener(`pointerdown`,t,!0),e.removeEventListener(`focusin`,t,!0),s(a,null)}},t[0]=s,t[1]=c,t[2]=a,t[3]=l):l=t[3];let u;t[4]===a?u=t[5]:(u=[a],t[4]=a,t[5]=u),(0,Q.useLayoutEffect)(l,u);let d;return t[6]!==n||t[7]!==a?(d=(0,Z.jsx)(`div`,{ref:o,"data-editor-activity-mount":a,"data-doc-name":n,className:`absolute inset-0`}),t[6]=n,t[7]=a,t[8]=d):d=t[8],d}function nB(e){let t=(0,$.c)(48),{drag:n,isFocused:r,label:i,onActivityMount:a,pane:o,renderPane:s,showOuterLeftDropTarget:c,showOuterRightDropTarget:l,showDropTargets:u}=e,d=c===void 0?!1:c,f=l===void 0?!1:l,p=u===void 0?!0:u,{focusPane:m,openTargetInPane:h}=Et(),[g,_]=(0,Q.useState)(!1),v=(0,Q.useRef)(null),y;t[0]===o?y=t[1]:(y=Zz(o),t[0]=o,t[1]=y);let b=y,x,S;t[2]!==h||t[3]!==o.activeNewTabId||t[4]!==o.id?(x=()=>{let e=v.current;if(!e)return;let t=e=>{Jg(e.dataTransfer)&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`),_(!0))},n=t=>{let n=t.relatedTarget;n instanceof Node&&e.contains(n)||_(!1)},r=()=>_(!1),i=e=>{_(!1);let t=Wg(e.dataTransfer);t&&(e.preventDefault(),e.stopPropagation(),DR(t,(e,t)=>h(o.id,e,t),o.activeNewTabId!==null))};return e.addEventListener(`dragover`,t,!0),e.addEventListener(`dragleave`,n,!0),e.addEventListener(`drop`,i,!0),window.addEventListener(`drop`,r,!0),window.addEventListener(`dragend`,r,!0),()=>{e.removeEventListener(`dragover`,t,!0),e.removeEventListener(`dragleave`,n,!0),e.removeEventListener(`drop`,i,!0),window.removeEventListener(`drop`,r,!0),window.removeEventListener(`dragend`,r,!0)}},S=[h,o.activeNewTabId,o.id],t[2]=h,t[3]=o.activeNewTabId,t[4]=o.id,t[5]=x,t[6]=S):(x=t[5],S=t[6]),(0,Q.useLayoutEffect)(x,S);let C=r?`true`:void 0,w=o.id,T=r||void 0,E=g||void 0,D=g&&`after:pointer-events-none after:absolute after:inset-2 after:z-20 after:rounded-lg after:bg-primary/5 after:ring-2 after:ring-primary/70 after:ring-inset`,O;t[7]===D?O=t[8]:(O=gr(`relative flex h-full min-h-0 min-w-0 flex-col bg-background`,D),t[7]=D,t[8]=O);let k,A;t[9]!==m||t[10]!==o.id?(k=()=>m(o.id),A=()=>m(o.id),t[9]=m,t[10]=o.id,t[11]=k,t[12]=A):(k=t[11],A=t[12]);let j;t[13]!==b||t[14]!==m||t[15]!==a||t[16]!==o.id?(j=b?(0,Z.jsx)(tB,{docName:b,onActivityMount:a,onPaneFocus:m,paneId:o.id}):null,t[13]=b,t[14]=m,t[15]=a,t[16]=o.id,t[17]=j):j=t[17];let M;t[18]!==b||t[19]!==r||t[20]!==o||t[21]!==s||t[22]!==j?(M=s({pane:o,isFocused:r,activityDocName:b,activityMount:j}),t[18]=b,t[19]=r,t[20]=o,t[21]=s,t[22]=j,t[23]=M):M=t[23];let N;t[24]===M?N=t[25]:(N=(0,Z.jsx)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:M}),t[24]=M,t[25]=N);let P;t[26]!==n||t[27]!==o.id||t[28]!==p||t[29]!==d?(P=p&&d?(0,Z.jsx)($z,{drag:n,paneId:o.id,side:`left`}):null,t[26]=n,t[27]=o.id,t[28]=p,t[29]=d,t[30]=P):P=t[30];let F;t[31]!==n||t[32]!==o.id||t[33]!==p||t[34]!==f?(F=p&&f?(0,Z.jsx)($z,{drag:n,paneId:o.id,side:`right`}):null,t[31]=n,t[32]=o.id,t[33]=p,t[34]=f,t[35]=F):F=t[35];let I;return t[36]!==i||t[37]!==o.id||t[38]!==E||t[39]!==O||t[40]!==k||t[41]!==A||t[42]!==N||t[43]!==P||t[44]!==F||t[45]!==C||t[46]!==T?(I=(0,Z.jsxs)(`section`,{ref:v,"aria-current":C,"aria-label":i,"data-editor-pane-id":w,"data-editor-pane-focused":T,"data-sidebar-drop-active":E,className:O,onPointerDownCapture:k,onFocusCapture:A,children:[N,P,F]}),t[36]=i,t[37]=o.id,t[38]=E,t[39]=O,t[40]=k,t[41]=A,t[42]=N,t[43]=P,t[44]=F,t[45]=C,t[46]=T,t[47]=I):I=t[47],I}function rB(e){let t=(0,$.c)(147),{renderActivityPool:n,renderHeader:r,renderPane:i}=e,{_:a}=Bn(),{focusPane:o,focusedPaneId:s,moveTabToPane:c,panes:l,reorderTabsInPane:u,resizePanes:d,splitTab:f,tabSessionLoaded:p,visibleTabIdsByPane:m}=Et(),h=OC(),g=h||$c(),_=(0,Q.useSyncExternalStore)(An,$e,cB),v=!h&&!p&&typeof window<`u`&&window.okDesktop?.config.mode===`editor`,[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(sB),[T,E]=(0,Q.useState)(null),D=(0,Q.useRef)(null),[O,k]=(0,Q.useState)(null),A=(0,Q.useRef)(null),j;t[0]===l?j=t[1]:(j=l.map(oB).join(`\0`),t[0]=l,t[1]=j);let M=j,N;t[2]===l?N=t[3]:(N=Object.fromEntries(l.map(aB)),t[2]=l,t[3]=N);let P=N,F=new Set,I=new Map;for(let e of l){let t=Zz(e);if(!t)continue;F.add(t);let n=C.get(e.id);n&&I.set(t,n)}let L;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(L={activationConstraint:{distance:8}},t[4]=L):L=t[4];let R;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(R={coordinateGetter:Tg,keyboardCodes:ml},t[5]=R):R=t[5];let z=Cg(wg(Sg,L),wg(Mg,R)),B=`max(100%, ${l.length*Xz}px)`,V;t[6]===B?V=t[7]:(V={"--editor-workspace-min-width":B},t[6]=B,t[7]=V);let ee=V,H;t[8]===O?H=t[9]:(H=function(e){(O?.querySelectorAll(`[data-editor-pane-tab-group]`))?.forEach(t=>{let n=t.dataset.editorPaneTabGroup,r=n?e[`editor-pane:${n}`]:void 0;r!==void 0&&t.style.setProperty(`flex-grow`,String(r))})},t[8]=O,t[9]=H);let U=H,W;t[10]!==U||t[11]!==M?(W=()=>{let e=A.current;e?.paneKey===M&&U(e.layout)},t[10]=U,t[11]=M,t[12]=W):W=t[12],(0,Q.useLayoutEffect)(W);let G,te;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(te=()=>()=>{D.current!==null&&cancelAnimationFrame(D.current)},G=[],t[13]=G,t[14]=te):(G=t[13],te=t[14]),(0,Q.useEffect)(te,G);let ne,re;if(t[15]===y?(ne=t[16],re=t[17]):(ne=()=>{if(y)return document.body.setAttribute(`data-editor-tab-dragging`,``),iB},re=[y],t[15]=y,t[16]=ne,t[17]=re),(0,Q.useEffect)(ne,re),v){let e;t[18]===r?e=t[19]:(e=r(null),t[18]=r,t[19]=e);let n;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`div`,{"data-editor-workspace-pending":``,className:`min-h-0 flex-1 bg-background`}),t[20]=n):n=t[20];let i;return t[21]===e?i=t[22]:(i=(0,Z.jsxs)(Z.Fragment,{children:[e,n]}),t[21]=e,t[22]=i),i}let K;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(K=function(e,t){w(n=>{if(n.get(e)===t)return n;let r=new Map(n);return t?r.set(e,t):r.delete(e),r})},t[23]=K):K=t[23];let ie=K,q;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(q=function(e,t){D.current!==null&&cancelAnimationFrame(D.current),D.current=requestAnimationFrame(()=>{D.current=null,dl(document,e,t)?.focus()})},t[24]=q):q=t[24];let ae=q,oe;t[25]===m?oe=t[26]:(oe=function(e){return m.get(e.id)??[...e.openTabs,...e.newTabIds]},t[25]=m,t[26]=oe);let se=oe,ce;t[27]!==c||t[28]!==u?(ce=function(e,t,n,r){if(e.paneId!==t.id){c(e.tabId,t.id,n),ae(t.id,e.tabId);return}if(!r)return;let i=r.indexOf(e.tabId);i<0||i===n||u(t.id,Dg([...r],i,n),e.tabId)},t[27]=c,t[28]=u,t[29]=ce):ce=t[29];let le=ce,ue;t[30]!==l||t[31]!==se?(ue=function(e,t){let n=e.over?.data.current,r,i;if(ul(n)){r=n.paneId;let a=l.find(e=>e.id===r);if(!a)return null;let o=se(a),s=o.indexOf(n.tabId);if(s<0)return null;let c=t.paneId===r?o.indexOf(t.tabId):-1,u=e.delta?.x??0,d=e.active.rect?.current.translated,f=e.over?.rect,p;p=c>=0&&c!==s?c<s:c===s&&u!==0?u>0:d!=null&&f!==void 0&&d.left+d.width/2>f.left+f.width/2,i=s+ +!!p}else if(ll(n)&&n.kind===`pane-strip`)r=n.paneId,i=n.index;else return null;let a=l.find(e=>e.id===r);if(!a)return null;let o=se(a),s=Math.min(Math.max(i,0),o.length),c=t.paneId===a.id?o.indexOf(t.tabId):-1,u=c>=0&&s>c?s-1:s;return c>=0&&u===c?null:{indicatorIndex:s,pane:a,targetIndex:u,targetOrder:o}},t[30]=l,t[31]=se,t[32]=ue):ue=t[32];let de=ue,fe;t[33]===de?fe=t[34]:(fe=function(e){let t=e.active.data.current,n=ul(t)?de(e,t):null,r=n?{index:n.indicatorIndex,paneId:n.pane.id}:null;S(e=>e?.paneId===r?.paneId&&e?.index===r?.index?e:r)},t[33]=de,t[34]=fe);let pe=fe,J;t[35]===o?J=t[36]:(J=function(e){let t=e.active.data.current;ul(t)&&(S(null),b(t),o(t.paneId))},t[35]=o,t[36]=J);let me=J,he;t[37]!==le||t[38]!==de||t[39]!==f?(he=function(e){let t=e.active.data.current,n=e.over?.data.current,r=ul(t)?de(e,t):null;if(S(null),b(null),ul(t)){if(r){le(t,r.pane,r.targetIndex,r.targetOrder);return}if(ll(n)&&n.kind===`pane-edge`){if(!t.splittable)return;let e=f(t.tabId,n.paneId,n.side);e&&ae(e,t.tabId);return}}},t[37]=le,t[38]=de,t[39]=f,t[40]=he):he=t[40];let ge=he,_e;t[41]===O?.style?_e=t[42]:(_e=function(e){O?.style.setProperty(`transform`,`translateX(-${e.currentTarget.scrollLeft}px)`)},t[41]=O?.style,t[42]=_e);let ve=_e,ye;t[43]!==U||t[44]!==M?(ye=function(e){A.current={paneKey:M,layout:e},U(e)},t[43]=U,t[44]=M,t[45]=ye):ye=t[45];let be=ye,xe;t[46]!==a||t[47]!==l?(xe=function(e){let t=l.findIndex(t=>t.id===e);return a(t<0?{id:`n2XqGH`}:{id:`fo6CCk`,values:{0:t+1}})},t[46]=a,t[47]=l,t[48]=xe):xe=t[48];let Se=xe,Ce;t[49]!==a||t[50]!==Se?(Ce=function(e){return ul(e)?Se(e.paneId):ll(e)?e.kind===`pane-edge`?e.side===`left`?a({id:`9Ii3uK`,values:{0:Se(e.paneId)}}):a({id:`jp6I-2`,values:{0:Se(e.paneId)}}):Se(e.paneId):null},t[49]=a,t[50]=Se,t[51]=Ce):Ce=t[51];let we=Ce,Te;t[52]!==l||t[53]!==d?(Te=(e,t)=>{t.isUserInteraction&&d(new Map(l.map(t=>[t.id,e[`editor-pane:${t.id}`]??t.size])))},t[52]=l,t[53]=d,t[54]=Te):Te=t[54];let Ee;t[55]!==y||t[56]!==s||t[57]!==Se||t[58]!==l||t[59]!==i?(Ee=l.map((e,t)=>(0,Z.jsxs)(Q.Fragment,{children:[t>0?(0,Z.jsx)(RA,{withHandle:!0,"data-editor-pane-resize-handle":``,"data-editor-pane-before":l[t-1]?.id,"data-editor-pane-after":e.id,children:(0,Z.jsx)(eB,{drag:y,leftPaneId:l[t-1]?.id??e.id,rightPaneId:e.id})}):null,(0,Z.jsx)(LA,{id:`editor-pane:${e.id}`,defaultSize:`${e.size}%`,minSize:`${Xz}px`,children:(0,Z.jsx)(nB,{drag:y,isFocused:e.id===s,label:Se(e.id),onActivityMount:ie,pane:e,renderPane:i,showOuterLeftDropTarget:t===0,showOuterRightDropTarget:t===l.length-1})})]},e.id)),t[55]=y,t[56]=s,t[57]=Se,t[58]=l,t[59]=i,t[60]=Ee):Ee=t[60];let De;t[61]!==M||t[62]!==P||t[63]!==be||t[64]!==Te||t[65]!==Ee?(De=(0,Z.jsx)(IA,{id:`editor-workspace-panes`,orientation:`horizontal`,defaultLayout:P,onLayoutChange:be,onLayoutChanged:Te,children:Ee},M),t[61]=M,t[62]=P,t[63]=be,t[64]=Te,t[65]=Ee,t[66]=De):De=t[66];let Oe=De,ke;if(t[67]!==x||t[68]!==s||t[69]!==l||t[70]!==se){let e;t[72]!==x||t[73]!==s||t[74]!==l.length||t[75]!==se?(e=(e,t)=>(0,Z.jsxs)(Q.Fragment,{children:[t>0?(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-editor-header-pane-separator":``,className:`w-px shrink-0 bg-border`}):null,(0,Z.jsx)(Qz,{paneId:e.id,index:se(e).length,isFocused:e.id===s,size:e.size,children:(0,Z.jsx)(Vz,{dropIndicatorIndex:x?.paneId===e.id?x.index:null,paneId:e.id,onSplitComplete:ae,reserveLeadingChrome:t===0,reserveTrailingChrome:t===l.length-1})})]},e.id),t[72]=x,t[73]=s,t[74]=l.length,t[75]=se,t[76]=e):e=t[76],ke=l.map(e),t[67]=x,t[68]=s,t[69]=l,t[70]=se,t[71]=ke}else ke=t[71];let Ae;t[77]!==ee||t[78]!==ke?(Ae=(0,Z.jsx)(`div`,{"data-editor-header-tab-groups":``,className:`h-full min-w-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(`div`,{ref:k,"data-editor-header-tab-canvas":``,className:`flex h-full min-w-(--editor-workspace-min-width)`,style:ee,children:ke})}),t[77]=ee,t[78]=ke,t[79]=Ae):Ae=t[79];let je=Ae;if(g){let e;t[80]!==s||t[81]!==l?(e=l.find(e=>e.id===s)??l[0],t[80]=s,t[81]=l,t[82]=e):e=t[82];let a=e;if(_!==null){let e;t[83]===r?e=t[84]:(e=r(null),t[83]=r,t[84]=e);let n;t[85]===_?n=t[86]:(n=(0,Z.jsx)(`div`,{"data-editor-workspace":``,className:`relative min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(Jz,{docName:_})}),t[85]=_,t[86]=n);let i;return t[87]!==e||t[88]!==n?(i=(0,Z.jsxs)(Z.Fragment,{children:[e,n]}),t[87]=e,t[88]=n,t[89]=i):i=t[89],i}let o;t[90]===r?o=t[91]:(o=r(null),t[90]=r,t[91]=o);let c;t[92]!==Se||t[93]!==a||t[94]!==i?(c=a?(0,Z.jsx)(nB,{drag:null,isFocused:!0,label:Se(a.id),onActivityMount:ie,pane:a,renderPane:i,showDropTargets:!1}):null,t[92]=Se,t[93]=a,t[94]=i,t[95]=c):c=t[95];let u;return t[96]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`div`,{ref:E,"data-editor-activity-parking":``,className:`hidden`,inert:!0}),t[96]=u):u=t[96],(0,Z.jsxs)(Z.Fragment,{children:[o,(0,Z.jsxs)(`div`,{"data-editor-workspace":``,className:`relative min-h-0 flex-1 overflow-hidden`,children:[c,u,T===null?null:n?.({activityHosts:I,parkingHost:T,visibleDocNames:F})]})]})}let Me=Ag,Ne=ol,Pe;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=()=>{S(null),b(null)},t[97]=Pe):Pe=t[97];let Fe;t[98]===a?Fe=t[99]:(Fe=a({id:`GrBgX_`}),t[98]=a,t[99]=Fe);let Ie;t[100]===Fe?Ie=t[101]:(Ie={draggable:Fe},t[100]=Fe,t[101]=Ie);let Le;t[102]!==a||t[103]!==Se?(Le=e=>{let{active:t}=e,n=t.data.current;return ul(n)?a({id:`_PnPuw`,values:{0:n.label,1:Se(n.paneId)}}):void 0},t[102]=a,t[103]=Se,t[104]=Le):Le=t[104];let Re,ze;t[105]!==a||t[106]!==we?(Re=e=>{let{active:t,over:n}=e,r=t.data.current;if(!ul(r)||!n)return;let i=we(n.data.current);return i?a({id:`Jnz9AY`,values:{0:r.label,destination:i}}):void 0},ze=e=>{let{active:t,over:n}=e,r=t.data.current;if(!ul(r))return;let i=n?we(n.data.current):null;return a(i?{id:`gqk-3R`,values:{0:r.label,destination:i}}:{id:`Gu9pRm`,values:{0:r.label}})},t[105]=a,t[106]=we,t[107]=Re,t[108]=ze):(Re=t[107],ze=t[108]);let Be;t[109]===a?Be=t[110]:(Be=e=>{let{active:t}=e,n=t.data.current;return ul(n)?a({id:`URN-cv`,values:{0:n.label}}):void 0},t[109]=a,t[110]=Be);let Ve;t[111]!==Le||t[112]!==Re||t[113]!==ze||t[114]!==Be?(Ve={onDragStart:Le,onDragOver:Re,onDragEnd:ze,onDragCancel:Be},t[111]=Le,t[112]=Re,t[113]=ze,t[114]=Be,t[115]=Ve):Ve=t[115];let He;t[116]!==Ie||t[117]!==Ve?(He={container:typeof document<`u`?document.body:void 0,screenReaderInstructions:Ie,announcements:Ve},t[116]=Ie,t[117]=Ve,t[118]=He):He=t[118];let Ue;t[119]!==je||t[120]!==r?(Ue=r(je),t[119]=je,t[120]=r,t[121]=Ue):Ue=t[121];let We;t[122]!==ee||t[123]!==Oe?(We=(0,Z.jsx)(`div`,{"data-editor-workspace-canvas":``,className:`h-full min-w-[var(--editor-workspace-min-width)]`,style:ee,children:Oe}),t[122]=ee,t[123]=Oe,t[124]=We):We=t[124];let Ge;t[125]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,Z.jsx)(`div`,{ref:E,"data-editor-activity-parking":``,className:`hidden`,inert:!0}),t[125]=Ge):Ge=t[125];let Ke=T===null?null:n?.({activityHosts:I,parkingHost:T,visibleDocNames:F}),qe;t[126]!==ve||t[127]!==We||t[128]!==Ge||t[129]!==Ke?(qe=(0,Z.jsxs)(`div`,{"data-editor-workspace":``,className:`relative min-h-0 flex-1 overflow-x-auto overflow-y-hidden`,onScroll:ve,children:[We,Ge,Ke]}),t[126]=ve,t[127]=We,t[128]=Ge,t[129]=Ke,t[130]=qe):qe=t[130];let Je;t[131]===y?Je=t[132]:(Je=y?(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`editor-tab-drag-overlay`,className:`pointer-events-none flex h-10 w-44 max-w-[calc(100vw-2rem)] cursor-grabbing items-center overflow-hidden rounded-md border border-border bg-background px-3 font-medium text-[13px] text-foreground shadow-lg`,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:y.label})}):null,t[131]=y,t[132]=Je);let Ye;t[133]===Je?Ye=t[134]:(Ye=(0,Z.jsx)(xg,{dropAnimation:null,children:Je}),t[133]=Je,t[134]=Ye);let Xe;return t[135]!==Me||t[136]!==ge||t[137]!==me||t[138]!==z||t[139]!==Ne||t[140]!==Pe||t[141]!==He||t[142]!==Ue||t[143]!==qe||t[144]!==Ye||t[145]!==pe?(Xe=(0,Z.jsxs)(Me,{sensors:z,autoScroll:!1,collisionDetection:Ne,onDragStart:me,onDragMove:pe,onDragOver:pe,onDragEnd:ge,onDragCancel:Pe,accessibility:He,children:[Ue,qe,Ye]}),t[135]=Me,t[136]=ge,t[137]=me,t[138]=z,t[139]=Ne,t[140]=Pe,t[141]=He,t[142]=Ue,t[143]=qe,t[144]=Ye,t[145]=pe,t[146]=Xe):Xe=t[146],Xe}function iB(){return document.body.removeAttribute(`data-editor-tab-dragging`)}function aB(e){return[`editor-pane:${e.id}`,e.size]}function oB(e){return e.id}function sB(){return new Map}function cB(){return null}function lB(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}var uB=`doc-panel`,dB=`terminal-column`,fB=`agents-column`,pB=[uB,dB,fB],mB=new Set(pB);function hB(e){return mB.has(e)}function gB(e){let t=null,n=0;for(let r of e)if(!hB(r)&&(t=r,n+=1,n>1))return null;return n===1?t:null}function _B(e){let t=[...e],n=gB(t),r=pB.filter(e=>t.includes(e)),i=new Set(r);n!=null&&i.add(n);let a=t.filter(e=>!i.has(e));return{residualId:n,presentPeers:r,unaccountedIds:a,ok:n!=null&&a.length===0}}function vB(e){let{currentLayout:t,containerPx:n,pinnedPx:r,residualId:i}=e;if(n<=0||!(i in t))return t;let a={...t},o=0;for(let[e,i]of Object.entries(r)){if(!(e in t))continue;let r=i/n*100;a[e]=r,o+=r}let s=0;for(let[e,n]of Object.entries(t))e===i||e in r||(s+=n);let c=100-o-s;return c<0?t:(a[i]=c,a)}var yB=Vs,bB=yB+1,xB=.05;function SB({otherRailWidthPx:e,agentsMinimumWidthPx:t}){let n=e+t+yB;return Math.ceil(n/(1-xB))}function CB({workspaceWidthPx:e,otherRailWidthPx:t,agentsMinimumWidthPx:n,previous:r,current:i,trigger:a}){if(!i.terminalRightVisible||!i.agentsVisible||e>=SB({otherRailWidthPx:t,agentsMinimumWidthPx:n}))return{kind:`none`};if(a===`resize`)return{kind:`close-agents`};let o=!r.agentsVisible&&i.agentsVisible,s=r.terminalRightVisible;return o&&s?{kind:`close-terminal`}:{kind:`close-agents`}}var wB=`ok-terminal-height-v1`,TB=1/3,EB=.5;function DB(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*EB))}function OB(e){let t=Number.isFinite(e)?e:0;return t<=0?240:Math.round(t*TB)}function kB(e,t){let n=DB(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(OB(t),n)}function AB(){return typeof window>`u`?0:window.innerHeight}function jB(e,t){return kB(e,t??AB())}function MB(e,t){try{let n=e??localStorage,r=t??AB(),i=n.getItem(wB);if(i==null)return kB(OB(r),r);let a=Number.parseInt(i,10);return kB(Number.isFinite(a)?a:OB(r),r)}catch{return 240}}function NB(e,t,n){try{let r=t??localStorage,i=n??AB();r.setItem(wB,String(kB(e,i)))}catch{}}function PB(){try{return typeof localStorage>`u`?240:MB()}catch{return 240}}var FB=`terminal-dock-panel`;function IB(e){let t=(0,$.c)(31),{children:n,placement:r,visible:i,onVisibleChange:a,onBottomContainer:o,onEditorRegion:s}=e,c=r===void 0?`bottom`:r,{resolvedTheme:l}=sr(),u=pO(),d=c===`bottom`&&i,[f,p]=(0,Q.useState)(!d),m=x_(l).background,[h]=(0,Q.useState)(LB),g=(0,Q.useRef)(h),[_,v]=(0,Q.useState)(!1),y=(0,Q.useRef)(!1),b=(0,Q.useRef)(null),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=function(e){b.current!=null&&clearTimeout(b.current),b.current=setTimeout(()=>{NB(e),b.current=null},100)},t[0]=x):x=t[0];let S=x,C=(0,Q.useRef)(0),w;t[1]===i?w=t[2]:(w=function(e,t){C.current>=5||(C.current+=1,console.warn(JSON.stringify({event:`ok-terminal-dock-stranded-while-hidden`,panelPx:Math.round(e),panelPct:Number.isFinite(t)?Math.round(t*10)/10:null,visible:i,dockHeightPx:g.current,innerWidth:window.innerWidth,innerHeight:window.innerHeight,devicePixelRatio:window.devicePixelRatio})))},t[1]=i,t[2]=w);let T=w,E=(0,Q.useRef)(null),D,O;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>()=>{b.current!=null&&clearTimeout(b.current),E.current?.()},O=[],t[3]=D,t[4]=O):(D=t[3],O=t[4]),(0,Q.useEffect)(D,O);let k,A;t[5]!==d||t[6]!==u?(k=()=>{let e=u.current;if(e!=null)try{d?e.resize(`${g.current}px`):e.collapse()}catch{}},A=[d,u],t[5]=d,t[6]=u,t[7]=k,t[8]=A):(k=t[7],A=t[8]),(0,Q.useEffect)(k,A);let j,M;t[9]!==d||t[10]!==u?(j=()=>{let e=()=>{let e=jB(g.current);if(e!==g.current&&(g.current=e,d))try{u.current?.resize(`${e}px`)}catch{}};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},M=[d,u],t[9]=d,t[10]=u,t[11]=j,t[12]=M):(j=t[11],M=t[12]),(0,Q.useEffect)(j,M);let N=_||void 0,P;t[13]!==n||t[14]!==s?(P=(0,Z.jsx)(LA,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsx)(`div`,{ref:s,tabIndex:-1,className:`relative flex h-full min-h-0 flex-col outline-none`,children:n})}),t[13]=n,t[14]=s,t[15]=P):P=t[15];let F;t[16]!==d||t[17]!==h||t[18]!==f||t[19]!==_||t[20]!==o||t[21]!==a||t[22]!==u||t[23]!==c||t[24]!==T||t[25]!==m?(F=c===`bottom`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(RA,{withHandle:d,disabled:!d,onPointerDown:e=>{if(!d)return;E.current?.(),v(!0),y.current=!0;let{pointerId:t}=e,n=()=>{v(!1),y.current=!1,window.removeEventListener(`pointerup`,r),window.removeEventListener(`pointercancel`,r),E.current=null},r=e=>{e.pointerId===t&&n()};E.current=n,window.addEventListener(`pointerup`,r),window.addEventListener(`pointercancel`,r)}}),(0,Z.jsx)(LA,{id:FB,style:{backgroundColor:m},panelRef:u,defaultSize:d?`${h}px`:0,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:e=>{let t=e.asPercentage===0;if(p(t),!d&&e.inPixels>0&&!y.current){T(e.inPixels,e.asPercentage);try{u.current?.collapse()}catch{}return}y.current&&(t&&d?a(!1):!t&&!d&&a(!0),e.inPixels>0&&(g.current=e.inPixels,S(e.inPixels)))},inert:f,className:gr(`flex flex-col`,!_&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`),children:(0,Z.jsx)(`div`,{ref:o,className:`flex min-h-0 flex-1 flex-col overflow-hidden`})})]}):null,t[16]=d,t[17]=h,t[18]=f,t[19]=_,t[20]=o,t[21]=a,t[22]=u,t[23]=c,t[24]=T,t[25]=m,t[26]=F):F=t[26];let I;return t[27]!==N||t[28]!==P||t[29]!==F?(I=(0,Z.jsxs)(IA,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":N,children:[P,F]}),t[27]=N,t[28]=P,t[29]=F,t[30]=I):I=t[30],I}function LB(){return PB()}function RB(e){let t=(0,$.c)(20),{edge:n,onReveal:r,className:i}=e,{_:a}=Bn(),o=n===`right`,s;t[0]!==a||t[1]!==o?(s=a(o?{id:`X7ShnN`}:{id:`eRSPr9`}),t[0]=a,t[1]=o,t[2]=s):s=t[2];let c=s,l=o?`rounded-r-none border-r-0`:`rounded-b-none border-b-0`,u;t[3]!==i||t[4]!==l?(u=gr(`absolute z-20 shrink-0 bg-background text-muted-foreground shadow-sm hover:text-foreground`,l,i),t[3]=i,t[4]=l,t[5]=u):u=t[5];let d;t[6]===o?d=t[7]:(d=o?(0,Z.jsx)(Wu,{"aria-hidden":`true`}):(0,Z.jsx)(Sa,{"aria-hidden":`true`}),t[6]=o,t[7]=d);let f;t[8]!==n||t[9]!==c||t[10]!==r||t[11]!==u||t[12]!==d?(f=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":c,"data-terminal-reveal":n,onClick:r,className:u,children:d})}),t[8]=n,t[9]=c,t[10]=r,t[11]=u,t[12]=d,t[13]=f):f=t[13];let p=o?`left`:`top`,m;t[14]!==c||t[15]!==p?(m=(0,Z.jsx)(Vr,{side:p,sideOffset:8,children:c}),t[14]=c,t[15]=p,t[16]=m):m=t[16];let h;return t[17]!==f||t[18]!==m?(h=(0,Z.jsxs)(Ur,{children:[f,m]}),t[17]=f,t[18]=m,t[19]=h):h=t[19],h}var zB=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-xON2KhOz.js`),__vite__mapDeps([70,1,37,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,42,43,44,45,71,2,72,73,33,74,75,76,77,78,79,80,81,82,28,3,29,30,31,32,83,66,84,85,86,87,88,89,4,5,90,40,91,92,24,23,93,94,25,34,56,57,58,95,68,61,96,97,98,64,65,99,100,55,59,60,62,101,102,103,26,104,105,106,107,35,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123]),import.meta.url)).ActivityModeContent})),BB=/^Could not find Group with id "/;function VB(e,t){t instanceof Error&&BB.test(t.message)||console.warn(JSON.stringify({event:e,error:t instanceof Error?t.message:String(t)}))}var HB=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillEditBanner:e}=await import(`./SkillEditBanner-BruoXTh-.js`);return{SkillEditBanner:e}},__vite__mapDeps([195,7,1,8,9,150,21,18,196,19,17,113,28,2,3,29,30,31,32,33]),import.meta.url)).SkillEditBanner})),UB=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./LintConfigEditor-C21DnP0H.js`),__vite__mapDeps([197,7,1,8,9,18,198,72,73,33,28,2,3,29,30,31,32,83,37,66,84,13,85,86,87,88,89,90,43,44,11,12,45,40,14,15,42,19,17,91,21,92,24,39,41,16,171,78,172,57,183,95,153,127,104,23,131,133,93,54,99,103,35,146,108,154,155,20,156,68,199]),import.meta.url)).LintConfigEditor})),WB=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./SchemaConfigEditor-DXhpWbEp.js`),__vite__mapDeps([200,1,7,8,9,90,43,44,11,12,13,45,40,14,15,42,18,19,17,91,21,92,24,131,93,16,166,201,102,34,84,198,72,73,33,28,2,3,29,30,31,32,83,37,66,85,86,87,88,89,39,41,171,78,172,57,183,95,108,155,20,35,156,199,160]),import.meta.url)).SchemaConfigEditor}));function GB(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`NYn1cR`})}),e[0]=t):t=e[0],t}function KB(e){let t=(0,$.c)(17),{docName:n,provider:r,isSourceMode:i,onModeChange:a,isPanelCollapsed:o,onTogglePanel:s,reserveRightGutter:c}=e,{requestAddProperty:l}=Nf(),u=Aw(r),{data:d}=ig(n),f=Hf(i?null:r,d?.effective??null),p;t[0]===f?p=t[1]:(p=Lf(f),t[0]=f,t[1]=p);let{missing:m}=p;if(nj(n)===`conflict`)return null;let h=bR()?r:null,g=u!==`connected`&&u!==`synced`,_=!i,v;t[2]!==n||t[3]!==l?(v=()=>l(n),t[2]=n,t[3]=l,t[4]=v):v=t[4];let y;return t[5]!==n||t[6]!==o||t[7]!==i||t[8]!==m||t[9]!==a||t[10]!==s||t[11]!==c||t[12]!==h||t[13]!==g||t[14]!==_||t[15]!==v?(y=(0,Z.jsx)(TR,{activeDocName:n,activeProvider:h,isSourceMode:i,sourceDisabled:g,onModeChange:a,showAddPropertyButton:_,onAddProperty:v,frontmatterProblems:m,isPanelCollapsed:o,onTogglePanel:s,reserveRightGutter:c}),t[5]=n,t[6]=o,t[7]=i,t[8]=m,t[9]=a,t[10]=s,t[11]=c,t[12]=h,t[13]=g,t[14]=_,t[15]=v,t[16]=y):y=t[16],y}var qB=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./TimelineDiffPane-B1HLCcW9.js`),__vite__mapDeps([202,1,2,203,28,3,29,30,31,32,33,7,8,9,71,72,73,74,75,76,77,78,79,80,81,82,44,83,37,66,18,84,13,85,86,87,88,89,4,5,90,43,11,12,45,40,14,15,42,19,17,91,21,92,24,23,10,16,20,93,94,25,34,56,57,58,95,68,61,96,97,98,64,65,99,100,55,59,60,62,101,102,103,26,104,105,106,107,35,108,109,110,111,112,113,114,115,164,127,129,130,41,165,166,204,39,205,116,123,69,120]),import.meta.url)).TimelineDiffPane})),JB=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./AgentDiffPane-BPGzdN_g.js`),__vite__mapDeps([206,1,2,203,28,3,29,30,31,32,33,7,8,9,71,72,73,74,75,76,77,78,79,80,81,82,44,83,37,66,18,84,13,85,86,87,88,89,4,5,90,43,11,12,45,40,14,15,42,19,17,91,21,92,24,23,10,16,20,93,94,25,34,56,57,58,95,68,61,96,97,98,64,65,99,100,55,59,60,62,101,102,103,26,104,105,106,107,35,108,109,110,111,112,113,114,115,164,127,129,130,41,165,166,204,39,205,117,118,119,123,69,121,122]),import.meta.url)).AgentDiffPane})),YB=300,XB=`${YB}px`,ZB=`600px`;function QB(e){return e}function $B(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(tV,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(eV,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(om,{name:`editor-area`,children:(0,Z.jsxs)(Mf,{children:[n,r]})}),t[3]=n,t[4]=i),i}function eV(){let e=(0,$.c)(6),t=Bc(),n;e[0]===t?n=e[1]:(n=e=>{e||t.close()},e[0]=t,e[1]=n);let r;return e[2]!==t.open||e[3]!==t.section||e[4]!==n?(r=(0,Z.jsx)(TA,{open:t.open,initialSection:t.section,onOpenChange:n}),e[2]=t.open,e[3]=t.section,e[4]=n,e[5]=r):r=e[5],r}function tV(e){let t=(0,$.c)(357),{editorMode:n,onModeChange:r,activeTab:i,onActiveTabChange:a,terminalBridge:o,terminalVisible:s,terminalPlacement:c,terminalRightWidth:l,onTerminalVisibleChange:u,onTerminalRightWidthChange:d,agentsVisible:f,onAgentsVisibleChange:p,onSessionPlacements:m,onRevealAgents:h,renderWorkspaceHeader:g}=e,_=s===void 0?!1:s,v=c===void 0?`bottom`:c,y=f===void 0?!1:f,b=g===void 0?QB:g,{_:x}=Bn(),S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=$c(),t[0]=S):S=t[0];let C=S,{activeDocName:w,activeProvider:T,activeTarget:E,activeNewTabId:D,recycleDocument:O,docPanelMode:k,docPanelAgentId:A,docPanelExpandSignal:j,closeActivityPanel:M}=Et(),{openDocumentTransition:N}=qe(),P=ej(T,w),F=rj(w,n===`source`?`source`:`wysiwyg`),[I,L]=(0,Q.useState)(!1),R,z;t[1]!==T||t[2]!==I?(R=()=>{T!=null&&!I&&L(!0)},z=[T,I],t[1]=T,t[2]=I,t[3]=R,t[4]=z):(R=t[3],z=t[4]),(0,Q.useEffect)(R,z);let B=(0,Q.useDeferredValue)(w),V=n===`source`,ee=E?.kind===`missing`,H=!!w&&E?.kind!==`folder`,U;t[5]!==x||t[6]!==ee?(U=ee?x({id:`K-a33w`}):void 0,t[5]=x,t[6]=ee,t[7]=U):U=t[7];let W=U,G=ug(),te,ne;t[8]!==w||t[9]!==G?(ne=()=>{G&&G.docName!==w&&dg()},te=[w,G],t[8]=w,t[9]=G,t[10]=te,t[11]=ne):(te=t[10],ne=t[11]),(0,Q.useEffect)(ne,te);let re=og(),K=re?.docName??null,ie=(0,Q.useRef)(null),q;t[12]!==w||t[13]!==K||t[14]!==N?(q=()=>{if(K==null){ie.current=null;return}if(ie.current=K,K!==w){let e=qp(K);tm(window.location.hash,e)?N(K):window.location.hash=e}},t[12]=w,t[13]=K,t[14]=N,t[15]=q):q=t[15];let ae;t[16]===K?ae=t[17]:(ae=[K],t[16]=K,t[17]=ae),(0,Q.useEffect)(q,ae);let oe,se;t[18]!==w||t[19]!==K?(oe=()=>{if(K!=null){if(K===w){ie.current=null;return}ie.current!==K&&cg()}},se=[w,K],t[18]=w,t[19]=K,t[20]=oe,t[21]=se):(oe=t[20],se=t[21]),(0,Q.useEffect)(oe,se);let ce,le;t[22]!==A||t[23]!==k?(ce=()=>{k===`agent`&&A!==null||cg()},le=[k,A],t[22]=A,t[23]=k,t[24]=ce,t[25]=le):(ce=t[24],le=t[25]),(0,Q.useEffect)(ce,le);let ue=(0,Q.useSyncExternalStore)(Ef.subscribe,Ef.getSnapshot,Ef.getSnapshot),de;t[26]!==E||t[27]!==ue?(de=Of(E,ue),t[26]=E,t[27]=ue,t[28]=de):de=t[28];let fe=de,[pe]=(0,Q.useState)(aV),J=pe!==null,me;t[29]===pe?me=t[30]:(me=()=>_j(pe,window.innerWidth,`right`),t[29]=pe,t[30]=me);let[he,ge]=(0,Q.useState)(me),_e=(0,Q.useRef)(he),ve,ye;t[31]===he?(ve=t[32],ye=t[33]):(ve=()=>{_e.current=he},ye=[he],t[31]=he,t[32]=ve,t[33]=ye),(0,Q.useEffect)(ve,ye);let be=pO(),xe=pO(),Se=pO(),Ce;t[34]===he?Ce=t[35]:(Ce=()=>Ej(`right`,he,wj())===`collapsed`,t[34]=he,t[35]=Ce);let[we]=(0,Q.useState)(Ce),[Te,Ee]=(0,Q.useState)(we),De=(0,Q.useRef)(Te),[Oe,ke]=(0,Q.useState)(null),[Ae,je]=(0,Q.useState)(null),[Me,Ne]=(0,Q.useState)(null),[Pe,Fe]=(0,Q.useState)(null),[Ie,Le]=(0,Q.useState)(null),[Re,ze]=(0,Q.useState)(null),Be=!C&&y,Ve=!C&&_&&v===`right`,He=Ve||Be,Ue=!C&&!y&&h!=null,We=v===`right`?Ae:Ie,Ge=_&&We!=null,Ke=Be&&Oe!=null,Je,Ye;t[36]!==Oe||t[37]!==Ke||t[38]!==m||t[39]!==We||t[40]!==Re||t[41]!==Ge?(Je=()=>{m?.({terminal:{container:We,isShowing:Ge},agents:{container:Oe,isShowing:Ke},editorRegion:Re})},Ye=[m,We,Ge,Oe,Ke,Re],t[36]=Oe,t[37]=Ke,t[38]=m,t[39]=We,t[40]=Re,t[41]=Ge,t[42]=Je,t[43]=Ye):(Je=t[42],Ye=t[43]),(0,Q.useEffect)(Je,Ye);let Xe,Ze;t[44]===Te?(Xe=t[45],Ze=t[46]):(Xe=()=>{De.current=Te},Ze=[Te],t[44]=Te,t[45]=Xe,t[46]=Ze),(0,Q.useEffect)(Xe,Ze);let[Qe,$e]=(0,Q.useState)(!1),et=(0,Q.useRef)(!1),[tt]=(0,Q.useState)(iV),rt=(0,Q.useRef)(tt),it=(0,Q.useRef)(null),at;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(at=function(e){it.current!=null&&clearTimeout(it.current),it.current=setTimeout(()=>{fj(e),it.current=null},100)},t[47]=at):at=t[47];let ot=at,[st]=(0,Q.useState)(rV),ct=(0,Q.useRef)(st),[lt,ut]=(0,Q.useState)(!1),dt=(0,Q.useRef)(!1),ft=(0,Q.useRef)(null),pt;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(pt=function(e){ft.current!=null&&clearTimeout(ft.current),ft.current=setTimeout(()=>{sj(e),ft.current=null},100)},t[48]=pt):pt=t[48];let mt=pt,ht;t[49]===l?ht=t[50]:(ht=()=>Math.max(l??Ts,bB),t[49]=l,t[50]=ht);let[gt]=(0,Q.useState)(ht),_t=(0,Q.useRef)(gt),[vt,yt]=(0,Q.useState)(!1),bt=(0,Q.useRef)(!1),xt=(0,Q.useRef)(null),St;t[51]===d?St=t[52]:(St=function(e){xt.current!=null&&clearTimeout(xt.current),xt.current=setTimeout(()=>{d?.(e),xt.current=null},100)},t[51]=d,t[52]=St);let Ct=St,wt,Tt;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(wt=()=>()=>{it.current!=null&&clearTimeout(it.current),ft.current!=null&&clearTimeout(ft.current),xt.current!=null&&clearTimeout(xt.current)},Tt=[],t[53]=wt,t[54]=Tt):(wt=t[53],Tt=t[54]),(0,Q.useEffect)(wt,Tt);let[Dt,Ot]=(0,Q.useState)(null),kt=(0,Q.useRef)(null),At,jt;t[55]!==Pe||t[56]!==Me?(At=()=>{if(Me==null||Pe==null)return;let e=()=>{Me.style.setProperty(`--editor-header-tabs-width`,`${Pe.getBoundingClientRect().width}px`)};if(e(),typeof ResizeObserver>`u`)return;let t=new ResizeObserver(e);return t.observe(Pe),()=>t.disconnect()},jt=[Me,Pe],t[55]=Pe,t[56]=Me,t[57]=At,t[58]=jt):(At=t[57],jt=t[58]),(0,Q.useLayoutEffect)(At,jt);let Mt=(0,Q.useRef)(!1),Nt=(0,Q.useRef)(0),Pt=cO(),Ft;t[59]!==xe||t[60]!==be||t[61]!==Se?(Ft=function(){for(let e of[be,Se,xe]){let t=e.current?.getSize();if(t!=null&&t.asPercentage>1&&t.inPixels>0)return t.inPixels/t.asPercentage*100}let e=kt.current;return e!=null&&e.offsetWidth>0?e.offsetWidth:null},t[59]=xe,t[60]=be,t[61]=Se,t[62]=Ft):Ft=t[62];let It=Ft,Lt;t[63]!==Pt||t[64]!==be||t[65]!==It?(Lt=function(){if(Pt.current==null)return null;try{let e=It();if(e==null)return null;if(!Mt.current)return{workspaceWidthPx:e,otherRailWidthPx:0};let t=be.current?.getSize().inPixels,n=t!=null&&t>0?t:rt.current;return{workspaceWidthPx:e,otherRailWidthPx:Math.max(n,YB)}}catch(e){return VB(`resolve-admission-metrics-failed`,e),null}},t[63]=Pt,t[64]=be,t[65]=It,t[66]=Lt):Lt=t[66];let Rt=Lt,zt;t[67]!==y||t[68]!==Ve?(zt={terminalRightVisible:Ve,agentsVisible:y},t[67]=y,t[68]=Ve,t[69]=zt):zt=t[69];let Vt=zt,Ut=(0,Q.useRef)(Vt),Wt=(0,Q.useRef)(Vt),Gt=(0,Q.useRef)(Te),Kt=(0,Q.useRef)(null),qt;t[70]!==x||t[71]!==p||t[72]!==u||t[73]!==Rt?(qt=function(e,t){let n=Rt();if(n==null)return;let r=CB({...n,agentsMinimumWidthPx:320,previous:t,current:Ut.current,trigger:e});if(!(r.kind===`none`||Kt.current===r.kind)){if(r.kind===`close-agents`){if(p==null)return;Kt.current=r.kind,p(!1),Dc.info(x({id:`KGF42E`}));return}u!=null&&(Kt.current=r.kind,u(!1),Dc.info(x({id:`2VSPan`})))}},t[70]=x,t[71]=p,t[72]=u,t[73]=Rt,t[74]=qt):qt=t[74];let Jt=qt,Yt=(0,Q.useRef)(Jt),Xt;t[75]!==Vt||t[76]!==Jt?(Xt=()=>{Yt.current=Jt,Ut.current=Vt},t[75]=Vt,t[76]=Jt,t[77]=Xt):Xt=t[77],(0,Q.useLayoutEffect)(Xt);let Zt,Qt;t[78]!==y||t[79]!==Te||t[80]!==Ve?(Zt=()=>{!y&&Kt.current===`close-agents`&&(Kt.current=null),!Ve&&Kt.current===`close-terminal`&&(Kt.current=null);let e=Wt.current,t=Gt.current;Wt.current={terminalRightVisible:Ve,agentsVisible:y},Gt.current=Te,queueMicrotask(()=>{Yt.current(t===Te?`state-change`:`resize`,e)})},Qt=[y,Ve,Te],t[78]=y,t[79]=Te,t[80]=Ve,t[81]=Zt,t[82]=Qt):(Zt=t[81],Qt=t[82]),(0,Q.useLayoutEffect)(Zt,Qt);let $t;t[83]!==Pt||t[84]!==It?($t=function(e){let t=Pt.current;if(t==null)return!1;let n,r;try{n=It(),r=t.getLayout()}catch(e){return VB(`apply-rail-layout-read-failed`,e),!1}if(n==null)return!1;let i=_B(Object.keys(r));if(!i.ok)return!1;let a=i.residualId;if(a==null)return!1;let o=t=>{let n={};return`doc-panel`in r&&(n[uB]=!Mt.current||e?0:t?YB:rt.current),`terminal-column`in r&&(n[dB]=Ut.current.terminalRightVisible?t?bB:_t.current:0),`agents-column`in r&&(n[fB]=Ut.current.agentsVisible?t?320:ct.current:0),n},s=o(!1);if(Object.keys(s).length===0)return!1;let c=vB({currentLayout:r,containerPx:n,pinnedPx:s,residualId:a});if(c===r&&(s=o(!0),c=vB({currentLayout:r,containerPx:n,pinnedPx:s,residualId:a})),c===r)return!0;try{t.setLayout(c)}catch(e){return VB(`apply-rail-layout-write-failed`,e),!1}let l;try{l=t.getLayout()}catch(e){return VB(`apply-rail-layout-verify-failed`,e),!1}for(let[e,t]of Object.entries(s)){let r=l[e];if(r!=null&&Math.abs(r/100*n-t)>1)return!1}return!0},t[83]=Pt,t[84]=It,t[85]=$t):$t=t[85];let en=$t,tn;t[86]!==Pt||t[87]!==It?(tn=function(e,t,n){t||n<=0||queueMicrotask(()=>{let t=Pt.current;if(t==null)return;let n,r;try{n=t.getLayout(),r=It()}catch(e){VB(`reclaim-hidden-rail-read-failed`,e);return}if(r==null||!(e in n)||n[e]===0)return;let i=gB(Object.keys(n));if(i==null)return;let a=vB({currentLayout:n,containerPx:r,pinnedPx:{[e]:0},residualId:i});if(a!==n)try{t.setLayout(a)}catch(e){VB(`reclaim-hidden-rail-write-failed`,e)}})},t[86]=Pt,t[87]=It,t[88]=tn):tn=t[88];let nn=tn,rn;t[89]===en?rn=t[90]:(rn=function(e){return et.current||bt.current||dt.current?!0:(De.current=e,en(e))},t[89]=en,t[90]=rn);let an=rn,on=(0,Q.useRef)(an),sn;t[91]===an?sn=t[92]:(sn=()=>{on.current=an},t[91]=an,t[92]=sn),(0,Q.useEffect)(sn);let cn=(0,Q.useRef)(null),un;t[93]===Symbol.for(`react.memo_cache_sentinel`)?(un=function(e,t,n,r){cn.current?.(),t(!0),n.current=!0;let i=function(){window.removeEventListener(`pointerup`,a),window.removeEventListener(`pointercancel`,o),cn.current=null,t(!1),n.current=!1};function a(t){t.pointerId===e&&(i(),r?.())}function o(t){t.pointerId===e&&(i(),on.current(De.current))}cn.current=i,window.addEventListener(`pointerup`,a),window.addEventListener(`pointercancel`,o)},t[93]=un):un=t[93];let dn=un,fn,pn;t[94]===Symbol.for(`react.memo_cache_sentinel`)?(fn=()=>()=>cn.current?.(),pn=[],t[94]=fn,t[95]=pn):(fn=t[94],pn=t[95]),(0,Q.useEffect)(fn,pn);let mn;t[96]===en?mn=t[97]:(mn=function(){return et.current||bt.current||dt.current?!0:en(De.current)},t[96]=en,t[97]=mn);let hn=mn,gn;t[98]===hn?gn=t[99]:(gn=()=>{let e={id:0},t=n=>{hn()||n<=0||(e.id=requestAnimationFrame(()=>t(n-1)))};return t(30),()=>{e.id!==0&&cancelAnimationFrame(e.id)}},t[98]=hn,t[99]=gn);let _n;t[100]!==Be||t[101]!==Ve?(_n=[Ve,Be],t[100]=Be,t[101]=Ve,t[102]=_n):_n=t[102],(0,Q.useEffect)(gn,_n);let vn;t[103]===an?vn=t[104]:(vn=function(){Mt.current&&an(!1)},t[103]=an,t[104]=vn);let yn=vn,xn;t[105]===an?xn=t[106]:(xn=function(){if(!Mt.current)return;let e=_e.current;De.current?(Dj(`right`,e,`open`),an(!1)):(Dj(`right`,e,`collapsed`),an(!0))},t[105]=an,t[106]=xn);let Sn=xn,Cn,wn;t[107]!==an||t[108]!==pe?(Cn=()=>{let e=window.matchMedia(`(min-width: ${hj}px)`),t=()=>{let e=_j(pe,window.innerWidth,`right`);ge(e);let t=Ej(`right`,e,wj())===`collapsed`;Ee(t),an(t)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},wn=[pe,an],t[107]=an,t[108]=pe,t[109]=Cn,t[110]=wn):(Cn=t[109],wn=t[110]),(0,Q.useEffect)(Cn,wn);let Tn,En;t[111]!==Dt||t[112]!==J?(Tn=()=>{if(Dt==null||J)return;let e=new ResizeObserver(()=>{on.current(De.current),Yt.current(`resize`,Ut.current)});return e.observe(Dt),()=>e.disconnect()},En=[Dt,J],t[111]=Dt,t[112]=J,t[113]=Tn,t[114]=En):(Tn=t[113],En=t[114]),(0,Q.useEffect)(Tn,En);let Dn;t[115]!==M||t[116]!==k||t[117]!==yn||t[118]!==a?(Dn=e=>{k===`agent`&&M(),a(e),yn()},t[115]=M,t[116]=k,t[117]=yn,t[118]=a,t[119]=Dn):Dn=t[119];let On=(0,Q.useEffectEvent)(Dn),kn;t[120]===On?kn=t[121]:(kn=()=>{let e=nt();return e&&On(e),bn(e=>{nt(),On(e)})},t[120]=On,t[121]=kn);let An;t[122]===Symbol.for(`react.memo_cache_sentinel`)?(An=[],t[122]=An):An=t[122],(0,Q.useEffect)(kn,An);let jn,Mn;t[123]!==j||t[124]!==yn?(jn=()=>{j!==0&&yn()},Mn=[j,yn],t[123]=j,t[124]=yn,t[125]=jn,t[126]=Mn):(jn=t[125],Mn=t[126]),(0,Q.useEffect)(jn,Mn);let Nn,Pn;t[127]===Te?(Nn=t[128],Pn=t[129]):(Nn=()=>{if(!Te||!document.getElementById(`doc-panel`)?.contains(document.activeElement))return;let e=document.querySelector(`[data-doc-panel-toggle]`);if(e){e.focus();return}document.querySelector(`[data-sidebar="trigger"]`)?.focus()},Pn=[Te],t[127]=Te,t[128]=Nn,t[129]=Pn),(0,Q.useLayoutEffect)(Nn,Pn);let Fn,In;t[130]===Te?(Fn=t[131],In=t[132]):(Fn=()=>{el({docPanelVisible:!Te}),window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!Te})},In=[Te],t[130]=Te,t[131]=Fn,t[132]=In),(0,Q.useEffect)(Fn,In);let Ln,Rn;t[133]===Sn?(Ln=t[134],Rn=t[135]):(Ln=()=>fr(e=>{e===`toggle-doc-panel`&&Sn()}),Rn=[Sn],t[133]=Sn,t[134]=Ln,t[135]=Rn),(0,Q.useEffect)(Ln,Rn);let zn,Vn;t[136]===Sn?(zn=t[137],Vn=t[138]):(zn=()=>{if(window.okDesktop!=null)return;let e=e=>{Mc(e,`toggle-document-panel`)&&(Mr()||(e.preventDefault(),Sn()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Vn=[Sn],t[136]=Sn,t[137]=zn,t[138]=Vn),(0,Q.useEffect)(zn,Vn);let Hn=(0,Q.useRef)(null),[Un,Wn]=(0,Q.useState)(null),[Gn,Kn]=(0,Q.useState)(!1),[qn,Jn]=(0,Q.useState)(null),Yn=E?.kind===`large-file`?E.docName:w,Xn,Zn;t[139]===Yn?(Xn=t[140],Zn=t[141]):(Xn=()=>{if(Yn&&Yn!==Hn.current){let e=Hn.current;Hn.current=Yn,Wn(e)}},Zn=[Yn],t[139]=Yn,t[140]=Xn,t[141]=Zn),(0,Q.useEffect)(Xn,Zn);let Qn;t[142]===N?Qn=t[143]:(Qn=function(e){let t=qp(e);tm(window.location.hash,t)?N(e):window.location.hash=t},t[142]=N,t[143]=Qn);let $n=Qn,er,tr,nr,rr;if(t[144]!==w||t[145]!==D||t[146]!==T||t[147]!==i||t[148]!==E||t[149]!==re||t[150]!==K||t[151]!==y||t[152]!==qn||t[153]!==Gn||t[154]!==B||t[155]!==A||t[156]!==k||t[157]!==I||t[158]!==Te||t[159]!==J||t[160]!==V||t[161]!==$n||t[162]!==a||t[163]!==Un||t[164]!==Ue||t[165]!==F||t[166]!==fe||t[167]!==H||t[168]!==P||t[169]!==o||t[170]!==_||t[171]!==G||t[172]!==Sn){if(tr=null,nr=null,er=!1,E?.kind===`large-file`){let e;t[177]!==$n||t[178]!==Un?(e=Un?{previousDocName:Un,onNavigateBack:$n}:void 0,t[177]=$n,t[178]=Un,t[179]=e):e=t[179],rr=(0,Z.jsx)(Sk,{docName:E.docName,size:E.size,limit:E.limit,backNav:e})}else if(E?.kind===`folder`){let e;t[180]!==y||t[181]!==J||t[182]!==_?(e=mM({terminalVisible:_,agentsVisible:y,isEmbedded:J}),t[180]=y,t[181]=J,t[182]=_,t[183]=e):e=t[183];let n=e,r;t[184]===E.folderPath?r=t[185]:(r=(0,Z.jsx)(dk,{folderPath:E.folderPath}),t[184]=E.folderPath,t[185]=r);let i;t[186]===n?i=t[187]:(i=n?(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-2 bg-linear-to-t from-background to-transparent`}):null,t[186]=n,t[187]=i);let a;t[188]!==r||t[189]!==i?(a=(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[r,i]}),t[188]=r,t[189]=i,t[190]=a):a=t[190];let o;if(t[191]!==E.folderPath||t[192]!==n?(o=n?(0,Z.jsx)($j,{folderPath:E.folderPath}):null,t[191]=E.folderPath,t[192]=n,t[193]=o):o=t[193],rr=(0,Z.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[a,o]}),k===`agent`&&A!==null){let e;t[194]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`ONPvOb`})}),children:(0,Z.jsx)(zB,{showBackButton:!1})}),t[194]=e):e=t[194],tr=e}}else if(E?.kind===`asset`&&xs(E.assetPath.split(`/`).pop()??E.assetPath)){let e;t[195]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(GB,{}),t[195]=e):e=t[195];let n;t[196]===E.assetPath?n=t[197]:(n=(0,Z.jsx)(UB,{assetPath:E.assetPath},E.assetPath),t[196]=E.assetPath,t[197]=n),rr=(0,Z.jsx)(Q.Suspense,{fallback:e,children:n})}else if(E?.kind===`asset`&&zo(E.assetPath)){let e;t[198]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(GB,{}),t[198]=e):e=t[198];let n;t[199]===E.assetPath?n=t[200]:(n=(0,Z.jsx)(WB,{assetPath:E.assetPath},E.assetPath),t[199]=E.assetPath,t[200]=n),rr=(0,Z.jsx)(Q.Suspense,{fallback:e,children:n})}else if(E?.kind===`asset`)rr=(0,Z.jsx)(yO,{assetPath:E.assetPath,mediaKind:E.mediaKind},E.assetPath);else if(E?.kind===`skill-file`)rr=(0,Z.jsx)(Vk,{scope:E.scope,name:E.name,path:E.path,host:E.host},`${E.scope}/${E.name}/${E.host??``}/${E.path}`);else if(E?.kind===`skill-preview`)rr=(0,Z.jsx)(dA,{flavor:E.flavor,source:E.source,name:E.name,subtitle:E.subtitle,level:E.level,path:E.path,reserveRightGutter:Ue},`${E.flavor}:${E.source}:${E.name}:${E.level??``}`);else if(fe)rr=(0,Z.jsx)(Ek,{nav:fe},fe.path);else if(!T||!w)if((typeof window<`u`?$p(window.location.hash):null)!==null)if(o!=null&&I){rr=(0,Z.jsx)(xO,{});let e;t[201]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`}),t[201]=e):e=t[201],tr=e}else er=!0;else rr=ln(D)?(0,Z.jsx)(Tk,{}):qn!==null&&qn===D?(0,Z.jsx)(Tk,{autoStart:!0}):(0,Z.jsx)(BO,{terminalOpen:_,agentsOpen:y,onRageStreak:D?()=>tv(()=>Jn(D)):void 0});else{let e;t[202]!==w||t[203]!==re||t[204]!==K||t[205]!==y||t[206]!==J||t[207]!==_||t[208]!==G?(e=pM({terminalVisible:_,agentsVisible:y,isEmbedded:J,activeDocName:w})&&!(G&&G.docName===w)&&!(re&&K===w),t[202]=w,t[203]=re,t[204]=K,t[205]=y,t[206]=J,t[207]=_,t[208]=G,t[209]=e):e=t[209];let n=e,r;t[210]===w?r=t[211]:(r=w?To(w):null,t[210]=w,t[211]=r);let o=r,s;t[212]!==w||t[213]!==re||t[214]!==K||t[215]!==Gn||t[216]!==B||t[217]!==o||t[218]!==Te||t[219]!==V||t[220]!==F||t[221]!==n||t[222]!==H||t[223]!==P||t[224]!==G||t[225]!==Sn?(s=e=>(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[o?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(HB,{name:o.name})}):null,(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[e,(0,Z.jsx)(XA,{activeDocName:w,isSourceMode:V}),lB({activeDocName:w,deferredActiveDocName:B,mountResolved:w!==null&&Bt(w),syncResolved:w!==null&&Ht(w)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(xO,{}),w===null?null:(0,Z.jsx)(Ck,{docName:w})]}):null,G&&G.docName===w?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(qB,{view:G,isPanelCollapsed:Te,onTogglePanel:Sn})}):null,re&&K===w?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(JB,{view:re,isPanelCollapsed:Te,onTogglePanel:Sn})}):null]}),n?(0,Z.jsx)($j,{docName:w,surface:V?`source`:`wysiwyg`,dismissed:Gn,onDismiss:()=>Kn(!0),onReopen:()=>Kn(!1)}):null]}),(0,Z.jsx)(lR,{stats:P,selectionStats:F,showStats:H,composerBadge:n&&Gn?{onReopen:()=>Kn(!1)}:null})]}),t[212]=w,t[213]=re,t[214]=K,t[215]=Gn,t[216]=B,t[217]=o,t[218]=Te,t[219]=V,t[220]=F,t[221]=n,t[222]=H,t[223]=P,t[224]=G,t[225]=Sn,t[226]=s):s=t[226];let c=s;rr=null,nr=c;let l;t[227]!==w||t[228]!==i||t[229]!==k||t[230]!==Te||t[231]!==V||t[232]!==a?(l=(0,Z.jsx)(gE,{docName:w,isSourceMode:V,activeTab:i,onActiveTabChange:a,mode:k,isCollapsed:Te}),t[227]=w,t[228]=i,t[229]=k,t[230]=Te,t[231]=V,t[232]=a,t[233]=l):l=t[233],tr=l}t[144]=w,t[145]=D,t[146]=T,t[147]=i,t[148]=E,t[149]=re,t[150]=K,t[151]=y,t[152]=qn,t[153]=Gn,t[154]=B,t[155]=A,t[156]=k,t[157]=I,t[158]=Te,t[159]=J,t[160]=V,t[161]=$n,t[162]=a,t[163]=Un,t[164]=Ue,t[165]=F,t[166]=fe,t[167]=H,t[168]=P,t[169]=o,t[170]=_,t[171]=G,t[172]=Sn,t[173]=er,t[174]=tr,t[175]=nr,t[176]=rr}else er=t[173],tr=t[174],nr=t[175],rr=t[176];C&&(tr=null);let ir=tr!=null,ar;t[234]===ir?ar=t[235]:(ar=()=>{let e=Mt.current!==ir;if(Mt.current=ir,!e)return;Nt.current!==0&&(cancelAnimationFrame(Nt.current),Nt.current=0);let t=De.current,n=e=>{Nt.current=0,!(on.current(t)||e<=0)&&(Nt.current=requestAnimationFrame(()=>n(e-1)))};n(30)},t[234]=ir,t[235]=ar),(0,Q.useLayoutEffect)(ar);let or,sr;t[236]===Symbol.for(`react.memo_cache_sentinel`)?(or=()=>()=>{Nt.current!==0&&cancelAnimationFrame(Nt.current)},sr=[],t[236]=or,t[237]=sr):(or=t[236],sr=t[237]),(0,Q.useEffect)(or,sr);let cr;t[238]===Symbol.for(`react.memo_cache_sentinel`)?(cr=function(e){let{activityMount:t,pane:n}=e,r=n.activeTarget;return t||(r?.kind===`large-file`?(0,Z.jsx)(Sk,{docName:r.docName,size:r.size,limit:r.limit}):r?.kind===`folder`?(0,Z.jsx)(dk,{folderPath:r.folderPath}):r?.kind===`asset`&&xs(r.assetPath.split(`/`).pop()??r.assetPath)?(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(GB,{}),children:(0,Z.jsx)(UB,{assetPath:r.assetPath},r.assetPath)}):r?.kind===`asset`&&zo(r.assetPath)?(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(GB,{}),children:(0,Z.jsx)(WB,{assetPath:r.assetPath},r.assetPath)}):r?.kind===`asset`?(0,Z.jsx)(yO,{assetPath:r.assetPath,mediaKind:r.mediaKind},r.assetPath):r?.kind===`skill-file`?(0,Z.jsx)(Vk,{scope:r.scope,name:r.name,path:r.path,host:r.host},`${r.scope}/${r.name}/${r.host??``}/${r.path}`):r?.kind===`skill-preview`?(0,Z.jsx)(dA,{flavor:r.flavor,source:r.source,name:r.name,subtitle:r.subtitle,level:r.level,path:r.path},`${r.flavor}:${r.source}:${r.name}:${r.level??``}`):(0,Z.jsx)(BO,{}))},t[238]=cr):cr=t[238];let lr=cr,ur;t[239]!==nr||t[240]!==rr?(ur=function(e){return e.isFocused?nr?nr(e.activityMount):rr:lr(e)},t[239]=nr,t[240]=rr,t[241]=ur):ur=t[241];let dr=ur,pr;t[242]!==w||t[243]!==B||t[244]!==W||t[245]!==Te||t[246]!==V||t[247]!==$n||t[248]!==r||t[249]!==Un||t[250]!==O||t[251]!==Ue||t[252]!==fe||t[253]!==Sn?(pr=function(e){let{activityHosts:t,parkingHost:n,visibleDocNames:i}=e,a=fe?new Set([...i].filter(e=>e!==w)):i,o=w&&a.has(w)?w:void 0,s=B&&a.has(B)?B:void 0,c=o?s??o:a.values().next().value;return c?(0,Z.jsx)(dL,{activeDocName:c,visibleDocNames:a,activityHosts:t,parkingHost:n,renderToolbar:(e,t)=>C?null:(0,Z.jsx)(KB,{docName:e,provider:t,isSourceMode:V,onModeChange:r,isPanelCollapsed:Te,onTogglePanel:Sn,reserveRightGutter:e===w&&Ue&&Te}),isSourceMode:V,editorPlaceholder:c===w?W:void 0,previousDocName:Un??void 0,onNavigateBack:$n,onRecycle:O}):null},t[242]=w,t[243]=B,t[244]=W,t[245]=Te,t[246]=V,t[247]=$n,t[248]=r,t[249]=Un,t[250]=O,t[251]=Ue,t[252]=fe,t[253]=Sn,t[254]=pr):pr=t[254];let mr=pr,hr=u??nV,gr;t[255]!==b||t[256]!==Me?(gr=e=>Me==null?null:(0,$_.createPortal)(b(e),Me),t[255]=b,t[256]=Me,t[257]=gr):gr=t[257];let _r;t[258]!==mr||t[259]!==dr||t[260]!==gr?(_r=(0,Z.jsx)(rB,{renderHeader:gr,renderPane:dr,renderActivityPool:mr}),t[258]=mr,t[259]=dr,t[260]=gr,t[261]=_r):_r=t[261];let vr;t[262]!==hr||t[263]!==_r||t[264]!==v||t[265]!==_?(vr=(0,Z.jsx)(IB,{placement:v,visible:_,onVisibleChange:hr,onBottomContainer:Le,onEditorRegion:ze,children:_r}),t[262]=hr,t[263]=_r,t[264]=v,t[265]=_,t[266]=vr):vr=t[266];let yr=vr,br=ir&&!Te,xr=!ir||Te,Sr=ir?void 0:`pointer-events-none`,Cr;t[267]===ir?Cr=t[268]:(Cr=ir?void 0:{display:`none`},t[267]=ir,t[268]=Cr);let wr;t[269]===Symbol.for(`react.memo_cache_sentinel`)?(wr=e=>{dn(e.pointerId,$e,et)},t[269]=wr):wr=t[269];let Tr;t[270]!==br||t[271]!==xr||t[272]!==Sr||t[273]!==Cr?(Tr=(0,Z.jsx)(RA,{"data-doc-panel-handle":``,withHandle:br,disabled:xr,className:Sr,style:Cr,onPointerDown:wr}),t[270]=br,t[271]=xr,t[272]=Sr,t[273]=Cr,t[274]=Tr):Tr=t[274];let Er=!ir||we?0:`${tt}px`,Dr=ir?ZB:`0px`,Or;t[275]!==ir||t[276]!==nn?(Or=e=>{ir&&Ee(e.asPercentage===0),e.inPixels>0&&et.current&&(rt.current=e.inPixels,ot(e.inPixels)),nn(uB,ir,e.inPixels)},t[275]=ir,t[276]=nn,t[277]=Or):Or=t[277];let kr=!ir||Te,Ar;t[278]!==tr||t[279]!==be||t[280]!==Er||t[281]!==Dr||t[282]!==Or||t[283]!==kr?(Ar=(0,Z.jsx)(LA,{id:uB,panelRef:be,defaultSize:Er,minSize:XB,maxSize:Dr,collapsible:!0,collapsedSize:0,onResize:Or,inert:kr,className:`flex flex-col bg-muted/20`,children:tr}),t[278]=tr,t[279]=be,t[280]=Er,t[281]=Dr,t[282]=Or,t[283]=kr,t[284]=Ar):Ar=t[284];let jr;t[285]!==Tr||t[286]!==Ar?(jr=(0,Z.jsxs)(Z.Fragment,{children:[Tr,Ar]}),t[285]=Tr,t[286]=Ar,t[287]=jr):jr=t[287];let Nr=jr,Pr=Ve?void 0:`pointer-events-none`,Fr;t[288]===Ve?Fr=t[289]:(Fr=Ve?void 0:{display:`none`},t[288]=Ve,t[289]=Fr);let Ir;t[290]!==u||t[291]!==Se?(Ir=e=>{dn(e.pointerId,yt,bt,()=>{Se.current?.isCollapsed()&&u?.(!1)})},t[290]=u,t[291]=Se,t[292]=Ir):Ir=t[292];let Lr;t[293]!==Pr||t[294]!==Fr||t[295]!==Ir||t[296]!==Ve?(Lr=(0,Z.jsx)(RA,{withHandle:Ve,className:Pr,style:Fr,onPointerDown:Ir}),t[293]=Pr,t[294]=Fr,t[295]=Ir,t[296]=Ve,t[297]=Lr):Lr=t[297];let Rr=Ve?`${gt}px`:0,X=Ve?void 0:`0px`,zr;t[298]!==Ct||t[299]!==nn||t[300]!==Ve?(zr=e=>{e.inPixels>0&&bt.current&&(_t.current=e.inPixels,Ct(e.inPixels)),nn(dB,Ve,e.inPixels)},t[298]=Ct,t[299]=nn,t[300]=Ve,t[301]=zr):zr=t[301];let Br;t[302]===Symbol.for(`react.memo_cache_sentinel`)?(Br=(0,Z.jsx)(`div`,{ref:je,"data-terminal-panel-mount":``,className:`flex min-h-0 flex-1 flex-col overflow-hidden`}),t[302]=Br):Br=t[302];let Vr;t[303]!==X||t[304]!==zr||t[305]!==Rr||t[306]!==Se?(Vr=(0,Z.jsx)(LA,{id:dB,panelRef:Se,defaultSize:Rr,minSize:`${bB}px`,maxSize:X,collapsible:!0,collapsedSize:0,onResize:zr,className:`flex flex-col`,children:Br}),t[303]=X,t[304]=zr,t[305]=Rr,t[306]=Se,t[307]=Vr):Vr=t[307];let Hr;t[308]!==Vr||t[309]!==Lr?(Hr=(0,Z.jsxs)(Z.Fragment,{children:[Lr,Vr]}),t[308]=Vr,t[309]=Lr,t[310]=Hr):Hr=t[310];let Ur=Hr,Wr=Be?void 0:`pointer-events-none`,Gr;t[311]===Be?Gr=t[312]:(Gr=Be?void 0:{display:`none`},t[311]=Be,t[312]=Gr);let Kr;t[313]!==xe||t[314]!==p?(Kr=e=>{dn(e.pointerId,ut,dt,()=>{xe.current?.isCollapsed()&&p?.(!1)})},t[313]=xe,t[314]=p,t[315]=Kr):Kr=t[315];let qr;t[316]!==Be||t[317]!==Wr||t[318]!==Gr||t[319]!==Kr?(qr=(0,Z.jsx)(RA,{withHandle:Be,className:Wr,style:Gr,onPointerDown:Kr}),t[316]=Be,t[317]=Wr,t[318]=Gr,t[319]=Kr,t[320]=qr):qr=t[320];let Jr=Be?`${st}px`:0,Yr=Be?`95%`:`0px`,Xr;t[321]!==Be||t[322]!==nn?(Xr=e=>{e.inPixels>0&&dt.current&&(ct.current=e.inPixels,mt(e.inPixels)),nn(fB,Be,e.inPixels)},t[321]=Be,t[322]=nn,t[323]=Xr):Xr=t[323];let Zr;t[324]===Symbol.for(`react.memo_cache_sentinel`)?(Zr=(0,Z.jsx)(`div`,{ref:ke,"data-agents-panel-mount":``,className:`flex min-h-0 flex-1 flex-col overflow-hidden`}),t[324]=Zr):Zr=t[324];let Qr;t[325]!==xe||t[326]!==Jr||t[327]!==Yr||t[328]!==Xr?(Qr=(0,Z.jsx)(LA,{id:fB,panelRef:xe,defaultSize:Jr,minSize:`320px`,maxSize:Yr,collapsible:!0,collapsedSize:0,onResize:Xr,className:`flex flex-col`,children:Zr}),t[325]=xe,t[326]=Jr,t[327]=Yr,t[328]=Xr,t[329]=Qr):Qr=t[329];let $r;t[330]!==qr||t[331]!==Qr?($r=(0,Z.jsxs)(Z.Fragment,{children:[qr,Qr]}),t[330]=qr,t[331]=Qr,t[332]=$r):$r=t[332];let ei=$r;if(er){let e;return t[333]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(xO,{}),t[333]=e):e=t[333],e}let ti=ir&&!we||He,ni;t[334]===Symbol.for(`react.memo_cache_sentinel`)?(ni=(0,Z.jsx)(`div`,{ref:Ne,"data-editor-area-header":``,className:`relative z-30 shrink-0`}),t[334]=ni):ni=t[334];let ri;t[335]===Symbol.for(`react.memo_cache_sentinel`)?(ri=e=>{Ot(e),kt.current=e},t[335]=ri):ri=t[335];let ii=Qe||vt||lt||void 0,ai=He?`5%`:`30%`,oi;t[336]===ti?oi=t[337]:(oi=ti?{}:{defaultSize:`100%`},t[336]=ti,t[337]=oi);let si;t[338]===yr?si=t[339]:(si=(0,Z.jsx)(`div`,{ref:Fe,className:`flex h-full min-w-0 flex-col`,children:yr}),t[338]=yr,t[339]=si);let ci;t[340]!==ai||t[341]!==oi||t[342]!==si?(ci=(0,Z.jsx)(LA,{minSize:ai,...oi,children:si}),t[340]=ai,t[341]=oi,t[342]=si,t[343]=ci):ci=t[343];let li;t[344]!==ei||t[345]!==Nr||t[346]!==Pt||t[347]!==ii||t[348]!==ci||t[349]!==Ur?(li=(0,Z.jsxs)(IA,{orientation:`horizontal`,groupRef:Pt,"data-dragging":ii,children:[ci,Nr,Ur,ei]}),t[344]=ei,t[345]=Nr,t[346]=Pt,t[347]=ii,t[348]=ci,t[349]=Ur,t[350]=li):li=t[350];let ui;t[351]!==h||t[352]!==Ue?(ui=Ue?(0,Z.jsx)(RB,{edge:`right`,onReveal:h,className:`top-2.5 right-0`}):null,t[351]=h,t[352]=Ue,t[353]=ui):ui=t[353];let di;return t[354]!==li||t[355]!==ui?(di=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[ni,(0,Z.jsxs)(`div`,{"data-editor-area-panels":``,className:`relative flex min-h-0 flex-1`,ref:ri,children:[li,ui]})]}),t[354]=li,t[355]=ui,t[356]=di):di=t[356],di}function nV(){}function rV(){return cj()}function iV(){return pj()}function aV(){return As()}function oV(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.kind!==i.kind)return!1;if(r.kind===`human`&&i.kind===`human`){if(r.clientId!==i.clientId||r.mode!==i.mode||r.tabCount!==i.tabCount)return!1;let e=r.user,t=i.user;if(e.name!==t.name||e.color!==t.color||e.icon!==t.icon)return!1}else if(r.kind===`agent`&&i.kind===`agent`){if(r.agentId!==i.agentId)return!1;let e=r.presence,t=i.presence;if(e.displayName!==t.displayName||e.icon!==t.icon||e.color!==t.color||e.currentDoc!==t.currentDoc||e.mode!==t.mode)return!1}}return!0}function sV(e){let t=new Map;for(let n of e){let e=n.user.principalId;if(typeof e==`string`&&e.length>0){let r=t.get(e);r?r.push(n):t.set(e,[n])}}let n=new Map;for(let[e,r]of t){let t=r.reduce((e,t)=>Math.min(e,t.clientId),1/0);n.set(e,{repClientId:t,count:r.length})}let r=[];for(let t of e){let e=t.user.principalId;if(typeof e==`string`&&e.length>0){let i=n.get(e);i&&i.repClientId===t.clientId&&r.push({...t,tabCount:i.count})}else r.push({...t,tabCount:1})}return r}var cV=1e3,lV=!1;function uV(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function dV(e,t,n){let r=(0,$.c)(9),i;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={current:[],crossDoc:[]},r[0]=i):i=r[0];let[a,o]=(0,Q.useState)(i),s;r[1]!==n||r[2]!==e?.awareness||r[3]!==t?.awareness?(s=()=>{let r=e?.awareness,i=t?.awareness,a;i==null?a=void 0:C_(i)?a=i:(a=void 0,lV||(lV=!0,console.warn(`[agent-presence] __system__ provider awareness missing getStates() — presence bar will render without agent peers`)));let s=()=>{let e=(r?.getLocalState())?.user?.principalId??null,t=r?.clientID??null,i=[];if(r)for(let[n,a]of r.getStates().entries()){let r=a;if(!r.user||typeof r.user!=`object`)continue;let o=r.user;o.type===`human`&&(uV({entryPrincipalId:o.principalId,entryClientId:n,localPrincipalId:e,localClientId:t})||i.push({kind:`human`,clientId:n,user:o,mode:r.mode??`wysiwyg`,tabCount:1}))}let s=sV(i),{current:c,crossDoc:l}=a?w_(a,n,Date.now()):{current:[],crossDoc:[]},u=fV,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>oV(e.current,p)&&oV(e.crossDoc,m)?e:{current:p,crossDoc:m})};s();let c=()=>s(),l=()=>s();r?.on(`change`,c),t?.awareness?.on(`change`,l);let u=setInterval(s,cV);return()=>{r?.off(`change`,c),t?.awareness?.off(`change`,l),clearInterval(u)}},r[1]=n,r[2]=e?.awareness,r[3]=t?.awareness,r[4]=s):s=r[4];let c;return r[5]!==n||r[6]!==e||r[7]!==t?(c=[e,t,n],r[5]=n,r[6]=e,r[7]=t,r[8]=c):c=r[8],(0,Q.useEffect)(s,c),a}function fV(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var pV=!1,mV=new Set,hV=!1;function gV(){for(let e of mV)e()}function _V(e){pV!==e&&(pV=e,gV())}function vV(){return pV}function yV(e){return mV.add(e),()=>{mV.delete(e)}}function bV(e){let t=[e.onUpdateRelaunching(()=>_V(!0)),e.onUpdateRelaunchFailed(()=>_V(!1))];return()=>{for(let e of t)e()}}function xV(){if(hV||typeof window>`u`)return;let e=window.okDesktop;e&&(hV=!0,bV(e))}function SV(){return(0,Q.useSyncExternalStore)(yV,vV,CV)}function CV(){return!1}var wV=`sync-status`,TV=1e4;async function EV(e){try{let t=await uf(e);t.ok||Dc.error(t.message,{id:wV,duration:1/0})}catch{}}function DV(e,t){let n=(0,$.c)(8),{_:r}=Bn(),i=SV(),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(null),c=(0,Q.useRef)(!1),l=(0,Q.useRef)(!1),u=(0,Q.useRef)(null),d,f;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>()=>{s.current!==null&&(clearTimeout(s.current),s.current=null)},f=[],n[0]=d,n[1]=f):(d=n[0],f=n[1]),(0,Q.useEffect)(d,f);let p,m;n[2]!==r||n[3]!==t||n[4]!==i||n[5]!==e?(p=()=>{let n=()=>{s.current!==null&&(clearTimeout(s.current),s.current=null)};if(e===`synced`&&(a.current=!0),i){n(),c.current=!1,u.current=null,Dc.dismiss(wV),l.current=!1;return}if(!t){n();return}let d=window.okDesktop,f=d!==void 0,p=d===void 0?{}:{action:{label:r({id:`uaUc6t`}),onClick:()=>{EV(d)}}},m=e=>{l.current=!0,Dc.warning(e,{id:wV,duration:1/0,...p})},h=()=>m(r({id:`HGNCsl`})),g=()=>m(r(f?{id:`X7fxS9`}:{id:`n6N-xC`})),_=()=>m(r(f?{id:`8QLpZe`}:{id:`m_mtGl`}));if(e===`connected`&&(n(),c.current=!1,u.current=null,l.current&&g()),e===`disconnected`&&a.current){if(o.current=!0,c.current){_();return}if(s.current===null){let e=Date.now();u.current===null&&(u.current=e);let t=Math.min(TV,TV-(e-u.current));if(t<=0){c.current=!0,_();return}s.current=setTimeout(()=>{s.current=null,c.current=!0,_()},t)}h()}else o.current&&e===`synced`&&(o.current=!1,n(),c.current=!1,u.current=null,l.current=!1,Dc.success(r({id:`GhjUB_`}),{id:wV,duration:3e3}))},m=[e,t,r,i],n[2]=r,n[3]=t,n[4]=i,n[5]=e,n[6]=p,n[7]=m):(p=n[6],m=n[7]),(0,Q.useEffect)(p,m)}var OV=4,kV=3,AV={Bird:Oy,Cat:My,Dog:By,Fish:Ky,Mouse:_b,Rabbit:gb,Shrimp:bb,Snail:xb,Squirrel:Tb,Turtle:Rb};Object.freeze(Object.keys(AV));function jV(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(AV,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var MV={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function NV(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:i}=e,{_:a}=Bn(),o=jV(n),s=o.kind===`animal`?AV[o.animal]:void 0,c;t[0]===n.name?c=t[1]:(c=ro(n.name),t[0]=n.name,t[1]=c);let l=c,u;t[2]===n.color?u=t[3]:(u=mc(n.color),t[2]=n.color,t[3]=u);let d=u,f=n.name,p;t[4]!==a||t[5]!==i||t[6]!==f?(p=i>1?a({id:`qAhFeg`,values:{userName:f,tabCount:i}}):f,t[4]=a,t[5]=i,t[6]=f,t[7]=p):p=t[7];let m=p,h;t[8]!==a||t[9]!==i||t[10]!==f?(h=i>1?a({id:`BEkF-P`,values:{userName:f,tabCount:i}}):f,t[8]=a,t[9]=i,t[10]=f,t[11]=h):h=t[11];let g=h,_;t[12]===n.color?_=t[13]:(_={backgroundColor:n.color},t[12]=n.color,t[13]=_);let v;t[14]!==s||t[15]!==d||t[16]!==l?(v=s?(0,Z.jsx)(s,{size:18,color:d,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:d},children:l}),t[14]=s,t[15]=d,t[16]=l,t[17]=v):v=t[17];let y;t[18]!==g||t[19]!==r||t[20]!==_||t[21]!==v?(y=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":g,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:_,children:v})}),t[18]=g,t[19]=r,t[20]=_,t[21]=v,t[22]=y):y=t[22];let b;t[23]===m?b=t[24]:(b=(0,Z.jsx)(Vr,{children:m}),t[23]=m,t[24]=b);let x;return t[25]!==y||t[26]!==b?(x=(0,Z.jsxs)(Ur,{children:[y,b]}),t[25]=y,t[26]=b,t[27]=x):x=t[27],x}function PV(e){let t=MV[e.icon];return e.displayName||t||Hc._({id:`iEQQyu`})}function FV(e){let t=(0,$.c)(3),[n,r]=(0,Q.useState)(e===`writing`),i=(0,Q.useRef)(null),a,o;return t[0]===e?(a=t[1],o=t[2]):(a=()=>{if(e===`writing`){i.current!==null&&(clearTimeout(i.current),i.current=null),r(!0);return}return i.current!==null&&clearTimeout(i.current),i.current=setTimeout(()=>{i.current=null,r(!1)},600),()=>{i.current!==null&&(clearTimeout(i.current),i.current=null)}},o=[e],t[0]=e,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o),n}function IV(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{_:o}=Bn(),{activeDocName:s}=Et(),{presence:c,agentId:l}=n,u=PV(c),d=FV(c.mode),f=!r&&d,p=c.currentDoc&&!es(c.currentDoc)?c.currentDoc:null,m=s!==null||p!==null,h=m?`cursor-pointer`:`cursor-default opacity-50`,g=i?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,_=f&&!i?`ring-primary/40 animate-pulse`:``,v;t[0]!==h||t[1]!==g||t[2]!==_?(v=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2`,h,g,_].filter(Boolean),t[0]=h,t[1]=g,t[2]=_,t[3]=v):v=t[3];let y=v.join(` `),b=r?`true`:void 0,x=i?`true`:void 0,S=m?void 0:`true`,C;t[4]!==c.mode||t[5]!==b||t[6]!==x||t[7]!==S?(C={"data-presence-badge":`agent`,"data-presence-mode":c.mode,"data-presence-crossdoc":b,"data-presence-scoped":x,"data-presence-inert":S},t[4]=c.mode,t[5]=b,t[6]=x,t[7]=S,t[8]=C):C=t[8];let w=C,T=o(r&&p?{id:`b4AQFK`,values:{tooltipName:u,realCurrentDoc:p}}:{id:`RfHNf8`,values:{tooltipName:u}}),E;t[9]!==l||t[10]!==T||t[11]!==w||t[12]!==m||t[13]!==a||t[14]!==c.color||t[15]!==c.icon||t[16]!==p||t[17]!==y||t[18]!==u?(E=m?(0,Z.jsx)(`button`,{type:`button`,...w,"aria-label":T,className:y,style:{backgroundColor:c.color},onClick:()=>a(l,p),children:(0,Z.jsx)(sg,{icon:c.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}):(0,Z.jsx)(`div`,{...w,role:`img`,"aria-label":u,className:y,style:{backgroundColor:c.color},children:(0,Z.jsx)(sg,{icon:c.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}),t[9]=l,t[10]=T,t[11]=w,t[12]=m,t[13]=a,t[14]=c.color,t[15]=c.icon,t[16]=p,t[17]=y,t[18]=u,t[19]=E):E=t[19];let D=E,O;t[20]===D?O=t[21]:(O=(0,Z.jsx)(Br,{asChild:!0,children:D}),t[20]=D,t[21]=O);let k;t[22]===u?k=t[23]:(k=(0,Z.jsx)(`span`,{className:`font-medium`,children:u}),t[22]=u,t[23]=k);let A;t[24]!==r||t[25]!==p?(A=r&&p?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`Wh0im4`,values:{realCurrentDoc:p}})}):null,t[24]=r,t[25]=p,t[26]=A):A=t[26];let j;t[27]!==k||t[28]!==A?(j=(0,Z.jsxs)(Vr,{className:`flex flex-col gap-0.5`,children:[k,A]}),t[27]=k,t[28]=A,t[29]=j):j=t[29];let M;return t[30]!==O||t[31]!==j?(M=(0,Z.jsxs)(Ur,{children:[O,j]}),t[30]=O,t[31]=j,t[32]=M):M=t[32],M}function LV(e){let t=(0,$.c)(21),{count:n,remainder:r,crossDoc:i,scopedAgentId:a,onClickAgent:o}=e,s;t[0]!==n||t[1]!==i?(s=i?Hc._({id:`9euN0m`,values:{count:n}}):Hc._({id:`uhJEA2`,values:{count:n}}),t[0]=n,t[1]=i,t[2]=s):s=t[2];let c=s,l=i?`true`:void 0,u;t[3]!==n||t[4]!==c||t[5]!==l?(u=(0,Z.jsx)(fh,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`presence-overflow`,"data-presence-crossdoc":l,className:`inline-flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-full bg-muted font-medium text-muted-foreground text-xs ring-2 ring-background hover:bg-muted/80`,"aria-label":c,children:[`+`,n]})}),t[3]=n,t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;if(t[7]!==i||t[8]!==o||t[9]!==r||t[10]!==a){let e;t[12]!==i||t[13]!==o||t[14]!==a?(e=e=>e.kind===`human`?(0,Z.jsx)(NV,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(IV,{participant:e,crossDoc:i,scoped:a===e.agentId,onClickAgent:o},e.agentId),t[12]=i,t[13]=o,t[14]=a,t[15]=e):e=t[15],d=r.map(e),t[7]=i,t[8]=o,t[9]=r,t[10]=a,t[11]=d}else d=t[11];let f;t[16]===d?f=t[17]:(f=(0,Z.jsx)(ph,{align:`end`,className:`w-auto max-w-xs p-2`,children:(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:d})}),t[16]=d,t[17]=f);let p;return t[18]!==u||t[19]!==f?(p=(0,Z.jsxs)(hh,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function RV(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(NV,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(IV,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function zV(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=Et(),{current:s,crossDoc:c}=dV(t,r,n);if(DV(Aw(t),n),s.length===0&&c.length===0)return null;let l;if(e[0]!==c||e[1]!==s||e[2]!==o||e[3]!==a||e[4]!==i){let t=s.slice(0,OV),n;e[6]===s?n=e[7]:(n=s.slice(OV),e[6]=s,e[7]=n);let r=n,u=c.slice(0,kV),d;e[8]===c?d=e[9]:(d=c.slice(kV),e[8]=c,e[9]=d);let f=d,p=i,m=a===`agent`?o:null,h;e[10]!==p||e[11]!==m?(h=e=>RV(e,p,!1,m),e[10]=p,e[11]=m,e[12]=h):h=e[12];let g=t.map(h),_;e[13]!==r||e[14]!==p||e[15]!==m?(_=r.length>0?(0,Z.jsx)(LV,{count:r.length,remainder:r,crossDoc:!1,scopedAgentId:m,onClickAgent:p}):null,e[13]=r,e[14]=p,e[15]=m,e[16]=_):_=e[16];let v;e[17]!==g||e[18]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,"data-presence-section":`current`,children:[g,_]}),e[17]=g,e[18]=_,e[19]=v):v=e[19],l=(0,Z.jsxs)(`div`,{"data-slot":`presence-bar`,className:`flex items-center px-1 py-1.5`,children:[v,c.length>0?(0,Z.jsxs)(`div`,{className:`ml-1.5 flex items-center gap-1.5`,"data-presence-section":`crossdoc`,children:[u.map(e=>RV(e,p,!0,m)),f.length>0?(0,Z.jsx)(LV,{count:f.length,remainder:f,crossDoc:!0,scopedAgentId:m,onClickAgent:p}):null]}):null]}),e[0]=c,e[1]=s,e[2]=o,e[3]=a,e[4]=i,e[5]=l}else l=e[5];return l}function BV(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(null),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.okDesktop;if(!e)return;let t=!1;return e.state.query().then(e=>{t||n(e.channel)}).catch(VV),()=>{t=!0}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a;return e[2]===t?a=e[3]:(a={channel:t},e[2]=t,e[3]=a),a}function VV(e){console.warn(`[use-update-channel] bridge.state.query() failed`,e)}function HV(e){let t=(0,$.c)(6),{className:n}=e,{_:r}=Bn(),{channel:i}=BV();if(i!==`beta`)return null;let a;t[0]===r?a=t[1]:(a=r({id:`9fhQRL`}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Y,{id:`cSCbv3`}),t[2]=o):o=t[2];let s;return t[3]!==n||t[4]!==a?(s=(0,Z.jsx)(Sh,{variant:`secondary`,"aria-label":a,"data-testid":`beta-badge`,className:n,children:o}),t[3]=n,t[4]=a,t[5]=s):s=t[5],s}var UV=(e,t,n)=>{if(e&&`reportValidity`in e){let r=I_(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},WV=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?UV(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>UV(t,n,e))}},GV=(e,t)=>{t.shouldUseNativeValidation&&WV(e,t);let n={};for(let r in e){let i=I_(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.ref});if(KV(t.names||Object.keys(e),r)){let e=Object.assign({},I_(n,r));D_(e,`root`,a),D_(n,r,e)}else D_(n,r,a)}return n},KV=(e,t)=>{let n=qV(t).replace(/[.*+?^${}()|\\]/g,`\\$&`);return e.some(e=>qV(e).match(`^${n}\\.\\d+`))};function qV(e){return e.replace(/[\[\]]/g,``)}function JV(){return JV=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},JV.apply(null,arguments)}function YV(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function XV(e,t){for(var n={};e.length;){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(`unionErrors`in r){var s=r.unionErrors[0].errors[0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(`unionErrors`in r&&r.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=A_(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function ZV(e,t){for(var n={},r=function(){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(r.code===`invalid_union`&&r.errors.length>0){var s=r.errors[0][0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(r.code===`invalid_union`&&r.errors.forEach(function(t){return t.forEach(function(t){return e.push(JV({},t,{path:[].concat(r.path,t.path)}))})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=A_(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()};e.length;)r();return n}function QV(e,t,n){if(n===void 0&&(n={}),function(e){return`_def`in e&&typeof e._def==`object`&&`typeName`in e._def}(e))return function(r,i,a){try{return Promise.resolve(YV(function(){return Promise.resolve(e[n.mode===`sync`?`parse`:`parseAsync`](r,t)).then(function(e){return a.shouldUseNativeValidation&&WV({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return Array.isArray(e?.issues)}(e))return{values:{},errors:GV(XV(e.errors,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return`_zod`in e&&typeof e._zod==`object`}(e))return function(r,i,a){try{return Promise.resolve(YV(function(){return Promise.resolve((n.mode===`sync`?gc:Qs)(e,r,t)).then(function(e){return a.shouldUseNativeValidation&&WV({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return e instanceof cc}(e))return{values:{},errors:GV(ZV(e.issues,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};throw Error(`Invalid input: not a Zod schema`)}var $V=`https://openknowledge.ai/api/subscribe`;async function eH(e,t){try{let n=await fetch($V,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({email:e,source:t}),signal:AbortSignal.timeout(15e3)});return n.ok?{ok:!0}:n.status===400?{ok:!1,reason:`invalid`}:n.status===503?{ok:!1,reason:`unavailable`}:(console.warn(`[subscribe] action=submit result=http-error status=${n.status}`),{ok:!1,reason:`error`})}catch(e){return console.warn(`[subscribe] action=submit result=network-error message=${e instanceof Error?e.message:String(e)}`),{ok:!1,reason:`error`}}}function tH(e){let t=(0,$.c)(49),{source:n,title:r,description:i,onSuccess:a,onDismiss:o,autoFocus:s,compactSubmit:c,className:l}=e,{_:u}=Bn(),[d,f]=(0,Q.useState)(!1),p=(0,Q.useRef)(null),m,h;t[0]===d?(m=t[1],h=t[2]):(m=()=>{d&&p.current?.focus()},h=[d],t[0]=d,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let g,_;if(t[3]!==u){let e=io({email:Cs({message:u({id:`Wq6Wcm`})})});_=O_,g=QV(e),t[3]=u,t[4]=g,t[5]=_}else g=t[4],_=t[5];let v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v={email:``},t[6]=v):v=t[6];let y;t[7]===g?y=t[8]:(y={resolver:g,defaultValues:v},t[7]=g,t[8]=y);let b=_(y),{isSubmitting:x}=b.formState,S=b.formState.errors.email?.message??b.formState.errors.root?.message,C;t[9]!==u||t[10]!==b||t[11]!==a||t[12]!==n?(C=async function(e){b.clearErrors(`root`);let t=await eH(e.email,n);if(t.ok){f(!0),a?.();return}if(t.reason===`invalid`){b.setError(`email`,{message:u({id:`Wq6Wcm`})});return}if(t.reason===`unavailable`){b.setError(`root`,{message:u({id:`4mLBx9`})});return}b.setError(`root`,{message:u({id:`fWsBTs`})})},t[9]=u,t[10]=b,t[11]=a,t[12]=n,t[13]=C):C=t[13];let w=C,T;t[14]===l?T=t[15]:(T=gr(`flex flex-col gap-3`,l),t[14]=l,t[15]=T);let E=d?-1:void 0,D;t[16]!==d||t[17]!==r?(D=d?(0,Z.jsxs)(`span`,{className:`mb-1.5 inline-flex flex-row items-center gap-2`,children:[(0,Z.jsx)(Uu,{className:`size-4 text-primary`}),(0,Z.jsx)(Y,{id:`PIMM5l`})]}):r??(0,Z.jsx)(Y,{id:`GzPQ2f`}),t[16]=d,t[17]=r,t[18]=D):D=t[18];let O;t[19]!==D||t[20]!==E?(O=(0,Z.jsx)(`p`,{ref:p,tabIndex:E,className:`text-sm font-medium leading-tight text-foreground focus:outline-none`,children:D}),t[19]=D,t[20]=E,t[21]=O):O=t[21];let k;t[22]!==i||t[23]!==d?(k=d?(0,Z.jsx)(Y,{id:`pBROkv`}):i??(0,Z.jsx)(Y,{id:`WmPbvm`}),t[22]=i,t[23]=d,t[24]=k):k=t[24];let A;t[25]===k?A=t[26]:(A=(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,role:`status`,children:k}),t[25]=k,t[26]=A);let j;t[27]!==O||t[28]!==A?(j=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[O,A]}),t[27]=O,t[28]=A,t[29]=j):j=t[29];let M;t[30]!==u||t[31]!==o?(M=o?(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon`,onClick:o,"aria-label":u({id:`yz7wBu`}),className:`-mr-1.5 -mt-1 size-7 shrink-0 text-muted-foreground opacity-60`,children:(0,Z.jsx)(zp,{className:`size-4`})}):null,t[30]=u,t[31]=o,t[32]=M):M=t[32];let N;t[33]!==j||t[34]!==M?(N=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[j,M]}),t[33]=j,t[34]=M,t[35]=N):N=t[35];let P;t[36]!==u||t[37]!==s||t[38]!==c||t[39]!==S||t[40]!==b||t[41]!==x||t[42]!==w||t[43]!==d?(P=d?null:(0,Z.jsxs)(`form`,{onSubmit:b.handleSubmit(w),className:`flex flex-col gap-2`,noValidate:!0,children:[(0,Z.jsx)(E_,{control:b.control,name:`email`,render:e=>{let{field:t,fieldState:n}=e;return(0,Z.jsxs)(Ug,{className:`h-10 rounded-xl`,children:[(0,Z.jsx)(Vg,{className:`pl-2.5`,children:(0,Z.jsx)(ap,{className:`size-4 text-muted-foreground opacity-60`})}),(0,Z.jsx)(Hg,{...t,id:t.name,type:`email`,inputMode:`email`,autoComplete:`email`,spellCheck:!1,autoFocus:s,placeholder:u({id:`2hYmUH`}),"aria-invalid":n.invalid,"aria-label":u({id:`ATGYL1`}),"data-testid":`subscribe-email`,className:`placeholder:text-muted-foreground/60`}),(0,Z.jsx)(X,{type:`submit`,disabled:x,size:c?`icon`:`default`,className:gr(`mr-1 ml-auto text-1sm`,c&&`size-8 shrink-0 rounded-lg`),"data-testid":`subscribe-submit`,children:x?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ip,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`lCC_D5`})})]}):c?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Du,{className:`size-4`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`EDl9kS`})})]}):(0,Z.jsx)(Y,{id:`EDl9kS`})})]})}}),S?(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,role:`alert`,children:S}):null]}),t[36]=u,t[37]=s,t[38]=c,t[39]=S,t[40]=b,t[41]=x,t[42]=w,t[43]=d,t[44]=P):P=t[44];let F;return t[45]!==N||t[46]!==P||t[47]!==T?(F=(0,Z.jsxs)(`div`,{className:T,children:[N,P]}),t[45]=N,t[46]=P,t[47]=T,t[48]=F):F=t[48],F}var nH=`ok-feedback-nudge-v1`,rH={firstSeenAt:null,shownAt:null,dismissed:!1};function iH(e){let t=0;for(let n of e)wm(n)||t++;return t}function aH(e,t,n){return!e.dismissed&&e.shownAt==null&&e.firstSeenAt!=null&&t-e.firstSeenAt>=12096e5&&n>=10}function oH(e){return e===!0}function sH(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:null}function cH(e){if(typeof e!=`object`||!e)return rH;let t=e;return{firstSeenAt:sH(t.firstSeenAt),shownAt:sH(t.shownAt),dismissed:oH(t.dismissed)}}function lH(e){try{let t=(e??localStorage).getItem(nH);return t==null?rH:cH(JSON.parse(t))}catch(e){return console.warn(`[feedback-nudge-store] readPersistedState failed (corrupt/privacy/SSR)`,e),rH}}function uH(e,t){try{(t??localStorage).setItem(nH,JSON.stringify(e))}catch(e){console.warn(`[feedback-nudge-store] writePersistedState failed (quota/privacy/SSR)`,e)}}function dH(e){let t=lH(e),n=new Set,r=!1;function i(){for(let e of n)e()}function a(n){t=n,uH(t,e),i()}function o(){t=lH(e),i()}return{getSnapshot(){return t},subscribe(e){return n.add(e),()=>{n.delete(e)}},recordFirstSeen(e){t.firstSeenAt??a({...t,firstSeenAt:e})},recordShown(e){t.shownAt??a({...t,shownAt:e})},dismiss(){t.dismissed||a({...t,dismissed:!0})},syncFromStorage:o,install(){r||(r=!0,o())}}}var fH=dH();typeof window<`u`&&typeof window.addEventListener==`function`&&window.addEventListener(`storage`,e=>{(e.key===`ok-feedback-nudge-v1`||e.key===null)&&fH.syncFromStorage()});function pH(){fH.install()}var mH=`https://github.com/inkeep/open-knowledge`,hH=`https://discord.gg/VRKk2EaGHN`,gH=`https://x.com/OpenKnowledge`,_H=`ok-subscribe-card-v1`,vH={subscribed:!1,dismissed:!1,shownVersions:[]};function yH(e,t){return!e.subscribed&&!e.dismissed&&e.shownVersions.length<3&&!e.shownVersions.includes(t)}function bH(e){return e===!0}function xH(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function SH(e){if(typeof e!=`object`||!e)return vH;let t=e;return{subscribed:bH(t.subscribed),dismissed:bH(t.dismissed),shownVersions:xH(t.shownVersions)}}function CH(e){try{let t=(e??localStorage).getItem(_H);return t==null?vH:SH(JSON.parse(t))}catch(e){return console.warn(`[subscribe-card-store] readPersistedState failed (corrupt/privacy/SSR)`,e),vH}}function wH(e,t){try{(t??localStorage).setItem(_H,JSON.stringify(e))}catch(e){console.warn(`[subscribe-card-store] writePersistedState failed (quota/privacy/SSR)`,e)}}function TH(e){let t=CH(e),n=new Set,r=!1;function i(){for(let e of n)e()}function a(n){t=n,wH(t,e),i()}return{getSnapshot(){return t},subscribe(e){return n.add(e),()=>{n.delete(e)}},markSubscribed(){t.subscribed||a({...t,subscribed:!0})},dismiss(){t.dismissed||a({...t,dismissed:!0})},recordShown(e){t.shownVersions.includes(e)||a({...t,shownVersions:[...t.shownVersions,e]})},install(){r||(r=!0,t=CH(e),i())}}}var EH=TH();function DH(){EH.install()}function OH(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Discord`}),r=(0,Z.jsx)(`path`,{d:`M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9554 2.4189-2.1568 2.4189Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function kH(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`X (Twitter)`}),r=(0,Z.jsx)(`path`,{d:`M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}var AH=[{key:`resources`,heading:{id:`s-MGs7`},links:[{label:{id:`TbjyhA`},href:`https://openknowledge.ai/docs`,icon:xe},{label:{id:`n4vt3Q`},href:`https://openknowledge.ai/download`,icon:yf}]},{key:`community`,heading:{id:`chL5IG`},links:[{label:`GitHub`,href:mH,icon:Jx},{label:`X (Twitter)`,href:gH,icon:kH},{label:`Discord`,href:hH,icon:OH}]}],jH=`${mH}/releases`,MH=`group flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm text-muted-foreground transition-colors hover:bg-azure-900/5 dark:hover:bg-white/20 hover:text-primary`;function NH(e){if(e<1e3)return String(e);let t=e/1e3;return`${t>=10?Math.round(t):t.toFixed(1)}k`}var PH=e=>{let t=(0,$.c)(12),{count:n}=e,{_:r}=Bn(),i,a,o,s;t[0]!==r||t[1]!==n?(i=NH(n),a=`img`,o=`ml-auto flex items-center gap-1 text-xs tabular-nums text-muted-foreground`,s=r({id:`SVLPt5`,values:{formatted:i}}),t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s):(i=t[2],a=t[3],o=t[4],s=t[5]);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Eb,{className:`size-3 fill-current`,"aria-hidden":`true`}),t[6]=c):c=t[6];let l;return t[7]!==i||t[8]!==a||t[9]!==o||t[10]!==s?(l=(0,Z.jsxs)(`span`,{role:a,className:o,"aria-label":s,children:[c,i]}),t[7]=i,t[8]=a,t[9]=o,t[10]=s,t[11]=l):l=t[11],l},FH=e=>{let t=(0,$.c)(15),{link:n,trailing:r}=e,{_:i}=Bn(),{label:a,href:o,icon:s}=n,c,l;t[0]===o?(c=t[1],l=t[2]):(c=e=>_h(e,o),l=e=>_h(e,o),t[0]=o,t[1]=c,t[2]=l);let u;t[3]===s?u=t[4]:(u=(0,Z.jsx)(s,{"aria-hidden":`true`,className:`size-4 shrink-0`}),t[3]=s,t[4]=u);let d;t[5]!==i||t[6]!==a?(d=typeof a==`string`?a:i(a),t[5]=i,t[6]=a,t[7]=d):d=t[7];let f;return t[8]!==o||t[9]!==c||t[10]!==l||t[11]!==u||t[12]!==d||t[13]!==r?(f=(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,onClick:c,onAuxClick:l,className:MH,children:[u,d,r]})}),t[8]=o,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=r,t[14]=f):f=t[14],f},IH=e=>{let t=(0,$.c)(7),{icon:n,onSelect:r,children:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=gr(MH,`h-auto w-full justify-start font-normal`),t[0]=a):a=t[0];let o;t[1]===n?o=t[2]:(o=(0,Z.jsx)(n,{"aria-hidden":`true`,className:`size-4 shrink-0`}),t[1]=n,t[2]=o);let s;return t[3]!==i||t[4]!==r||t[5]!==o?(s=(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(X,{variant:`ghost`,className:a,onClick:r,children:[o,i]})}),t[3]=i,t[4]=r,t[5]=o,t[6]=s):s=t[6],s},LH=e=>{let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:n}),t[0]=n,t[1]=r),r},RH=()=>{let e=(0,$.c)(36),{_:t}=Bn(),[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=typeof window<`u`&&window.okDesktop!=null,p,m;e[0]!==n||e[1]!==u?(p=()=>{if(!n||u!==null)return;let e=new AbortController;return bc({signal:e.signal}).then(e=>{e!==null&&d(e)}),()=>e.abort()},m=[n,u],e[0]=n,e[1]=u,e[2]=p,e[3]=m):(p=e[2],m=e[3]),(0,Q.useEffect)(p,m);let h;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>{r(e),e||a(!1)},e[4]=h):h=e[4];let g;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(_,{className:`size-4`}),e[5]=g):g=e[5];let v;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(fh,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[g,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`s-MGs7`})})]})})}),e[6]=v):v=e[6];let y;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsxs)(Ur,{children:[v,(0,Z.jsx)(Vr,{children:(0,Z.jsx)(Y,{id:`s-MGs7`})})]}),e[7]=y):y=e[7];let b;e[8]!==t||e[9]!==u?(b=AH.map((e,n)=>(0,Z.jsxs)(`div`,{className:gr(n>0&&`mt-3`),children:[(0,Z.jsx)(LH,{children:t(e.heading)}),(0,Z.jsx)(`nav`,{"aria-label":t(e.heading),children:(0,Z.jsxs)(`ul`,{className:`space-y-0.5`,children:[e.links.map(e=>(0,Z.jsx)(FH,{link:e,trailing:e.href===`https://github.com/inkeep/open-knowledge`&&u!==null?(0,Z.jsx)(PH,{count:u}):void 0},e.href)),e.key===`resources`&&(0,Z.jsxs)(Z.Fragment,{children:[f&&(0,Z.jsx)(IH,{icon:Dn,onSelect:()=>{r(!1),s(!0)},children:(0,Z.jsx)(Y,{id:`cd5EXh`})}),(0,Z.jsx)(IH,{icon:fp,onSelect:()=>{r(!1),l(!0)},children:(0,Z.jsx)(Y,{id:`RoafuO`})})]})]})})]},e.key)),e[8]=t,e[9]=u,e[10]=b):b=e[10];let x;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(LH,{children:(0,Z.jsx)(Y,{id:`arUUsK`})}),e[11]=x):x=e[11];let S;e[12]===t?S=e[13]:(S=t({id:`arUUsK`}),e[12]=t,e[13]=S);let C;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(FH,{link:{label:{id:`3ePd3I`},href:jH,icon:sb}}),e[14]=C):C=e[14];let w;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(fh,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,className:gr(MH,`h-auto w-full justify-start font-normal`),children:[(0,Z.jsx)(ap,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Z.jsx)(Y,{id:`EDl9kS`})]})}),e[15]=w):w=e[15];let T;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(ph,{side:`left`,align:`center`,sideOffset:20,className:`w-80`,children:(0,Z.jsx)(tH,{source:`resources_menu`,autoFocus:!0,onDismiss:()=>a(!1),onSuccess:zH})}),e[16]=T):T=e[16];let E;e[17]===i?E=e[18]:(E=(0,Z.jsxs)(`ul`,{className:`space-y-0.5`,children:[C,(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(hh,{open:i,onOpenChange:a,children:[w,T]})})]}),e[17]=i,e[18]=E);let D;e[19]!==E||e[20]!==S?(D=(0,Z.jsxs)(`div`,{className:`mt-3`,children:[x,(0,Z.jsx)(`nav`,{"aria-label":S,children:E})]}),e[19]=E,e[20]=S,e[21]=D):D=e[21];let O;e[22]!==D||e[23]!==b?(O=(0,Z.jsxs)(ph,{align:`end`,className:`w-56 p-3`,children:[b,D]}),e[22]=D,e[23]=b,e[24]=O):O=e[24];let k;e[25]!==n||e[26]!==O?(k=(0,Z.jsxs)(hh,{open:n,onOpenChange:h,children:[y,O]}),e[25]=n,e[26]=O,e[27]=k):k=e[27];let A;e[28]===o?A=e[29]:(A=f&&(0,Z.jsx)(Fr,{open:o,onOpenChange:s,launcherBorne:!0}),e[28]=o,e[29]=A);let j;e[30]===c?j=e[31]:(j=(0,Z.jsx)(HS,{open:c,onOpenChange:l,onSuccess:BH}),e[30]=c,e[31]=j);let M;return e[32]!==k||e[33]!==A||e[34]!==j?(M=(0,Z.jsxs)(Z.Fragment,{children:[k,A,j]}),e[32]=k,e[33]=A,e[34]=j,e[35]=M):M=e[35],M};function zH(){return EH.markSubscribed()}function BH(){return fH.dismiss()}function VH(e){let t=(0,$.c)(14),{className:n}=e,{_:r}=Bn(),i=typeof window<`u`?window.okDesktop?.instanceLabel??null:null;if(!i)return null;let a;t[0]===r?a=t[1]:(a=r({id:`iRdfLr`,values:{label:i}}),t[0]=r,t[1]=a);let o,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(vu,{"aria-hidden":`true`}),s=(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:i}),t[2]=o,t[3]=s):(o=t[2],s=t[3]);let c;t[4]!==n||t[5]!==a?(c=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsxs)(Sh,{variant:`secondary`,"aria-label":a,"data-testid":`instance-badge`,className:n,children:[o,s]})}),t[4]=n,t[5]=a,t[6]=c):c=t[6];let l;t[7]===r?l=t[8]:(l=r({id:`c5PTFE`,values:{label:i}}),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Z.jsx)(Vr,{children:l}),t[9]=l,t[10]=u);let d;return t[11]!==c||t[12]!==u?(d=(0,Z.jsxs)(Ur,{children:[c,u]}),t[11]=c,t[12]=u,t[13]=d):d=t[13],d}var HH=1,UH=2,WH=HH|UH;function GH(){if(!(typeof window>`u`))return window.navigation}function KH(){let e=GH();return e?(e.canGoBack?HH:0)|(e.canGoForward?UH:0):WH}function qH(e){let t=GH();return t?(t.addEventListener(`currententrychange`,e),()=>t.removeEventListener(`currententrychange`,e)):()=>{}}function JH(){let e=(0,$.c)(42),{_:t}=Bn(),n=(0,Q.useSyncExternalStore)(qH,KH,ZH),r=(n&HH)!==0,i=(n&UH)!==0,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=Lc(`navigate-back`),e[0]=a):a=e[0];let o=a,s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=Ac(`navigate-back`),e[1]=s):s=e[1];let c=s,l;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=Lc(`navigate-forward`),e[2]=l):l=e[2];let u=l,d;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=Ac(`navigate-forward`),e[3]=d):d=e[3];let f=d,p;e[4]===t?p=e[5]:(p=t({id:`kBNHN1`}),e[4]=t,e[5]=p);let m;e[6]===t?m=e[7]:(m=t({id:`iH8pgl`}),e[6]=t,e[7]=m);let h=!r,g;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(Au,{"aria-hidden":`true`}),e[8]=g):g=e[8];let _;e[9]!==m||e[10]!==h?(_=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{"aria-label":m,className:`[-webkit-app-region:no-drag]`,disabled:h,onClick:XH,size:`icon-sm`,variant:`ghost`,children:g})}),e[9]=m,e[10]=h,e[11]=_):_=e[11];let v;e[12]===t?v=e[13]:(v=t({id:`iH8pgl`}),e[12]=t,e[13]=v);let y;e[14]===v?y=e[15]:(y=(0,Z.jsx)(`span`,{children:v}),e[14]=v,e[15]=y);let b;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(en,{"aria-label":c,children:o}),e[16]=b):b=e[16];let x;e[17]===y?x=e[18]:(x=(0,Z.jsxs)(Vr,{children:[y,` `,b]}),e[17]=y,e[18]=x);let S;e[19]!==x||e[20]!==_?(S=(0,Z.jsxs)(Ur,{children:[_,x]}),e[19]=x,e[20]=_,e[21]=S):S=e[21];let C;e[22]===t?C=e[23]:(C=t({id:`rxWGWX`}),e[22]=t,e[23]=C);let w=!i,T;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Du,{"aria-hidden":`true`}),e[24]=T):T=e[24];let E;e[25]!==C||e[26]!==w?(E=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{"aria-label":C,className:`[-webkit-app-region:no-drag]`,disabled:w,onClick:YH,size:`icon-sm`,variant:`ghost`,children:T})}),e[25]=C,e[26]=w,e[27]=E):E=e[27];let D;e[28]===t?D=e[29]:(D=t({id:`rxWGWX`}),e[28]=t,e[29]=D);let O;e[30]===D?O=e[31]:(O=(0,Z.jsx)(`span`,{children:D}),e[30]=D,e[31]=O);let k;e[32]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(en,{"aria-label":f,children:u}),e[32]=k):k=e[32];let A;e[33]===O?A=e[34]:(A=(0,Z.jsxs)(Vr,{children:[O,` `,k]}),e[33]=O,e[34]=A);let j;e[35]!==E||e[36]!==A?(j=(0,Z.jsxs)(Ur,{children:[E,A]}),e[35]=E,e[36]=A,e[37]=j):j=e[37];let M;return e[38]!==S||e[39]!==j||e[40]!==p?(M=(0,Z.jsxs)(Ma,{"aria-label":p,className:`shrink-0`,"data-testid":`navigation-history-controls`,children:[S,j]}),e[38]=S,e[39]=j,e[40]=p,e[41]=M):M=e[41],M}function YH(){return hr(`navigate-forward`)}function XH(){return hr(`navigate-back`)}function ZH(){return WH}var QH=50,$H=()=>{let e=(0,$.c)(8),t=(0,Q.useRef)(null),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=()=>{t.current===null&&(t.current=setTimeout(()=>{t.current=null,pA.preload()},QH))},e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{t.current!==null&&(clearTimeout(t.current),t.current=null)},e[1]=i):i=e[1];let a=i,o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{a(),window.location.hash!==`#settings`&&(window.location.hash=zc)},e[2]=o):o=e[2];let s=o,c,l;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>()=>{t.current!==null&&clearTimeout(t.current)},l=[],e[3]=c,e[4]=l):(c=e[3],l=e[4]),(0,Q.useEffect)(c,l);let u;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Ar,{className:`size-4`}),e[5]=u):u=e[5];let d;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,"data-testid":`header-settings-button`,onMouseEnter:r,onMouseLeave:a,onFocus:r,onBlur:a,onClick:s,children:[u,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`Tz0i8g`})})]})}),e[6]=d):d=e[6];let f;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsxs)(Ur,{children:[d,(0,Z.jsx)(Vr,{children:(0,Z.jsx)(Y,{id:`Tz0i8g`})})]}),e[7]=f):f=e[7],f},eU=`https://openknowledge.ai/docs/features/share`,tU={mac:`⌘ C`,windowsLinux:`Ctrl C`};function nU(e){let t=(0,$.c)(52),{input:n,onClickWhenNoRemote:r}=e,{_:i}=Bn(),{status:a}=xu(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(null),d;t[0]===c?.autoCopyFailed?d=t[1]:(d=()=>{!c?.autoCopyFailed||!u.current||(u.current.focus(),u.current.select())},t[0]=c?.autoCopyFailed,t[1]=d);let f;t[2]===c?f=t[3]:(f=[c],t[2]=c,t[3]=f),(0,Q.useEffect)(d,f);let p=a?.hasRemote===!0,m=n===null,h=Sf(c?.freshness,a),g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=Pc(tU),t[4]=g):g=t[4];let v=g,y;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(y=Nc(tU),t[5]=y):y=t[5];let b=y,x;t[6]!==i||t[7]!==o||t[8]!==p||t[9]!==n||t[10]!==r?(x=async function(){if(!o&&n!==null){s(!0),l(null);try{let e=await Hd({...n,hasRemote:p,onClickWhenNoRemote:r},{clipboardWrite:_r,toastSuccess:uU,toastError:lU,logEvent:cU});e.kind===`copied`?l({url:e.shareUrl,autoCopyFailed:!1,freshness:e.freshness}):e.kind===`clipboard-failed`&&l({url:e.shareUrl,autoCopyFailed:!0,freshness:e.freshness})}catch{Dc.error(i({id:`u3YnKw`}))}s(!1)}},t[6]=i,t[7]=o,t[8]=p,t[9]=n,t[10]=r,t[11]=x):x=t[11];let S=x,C=c!==null,w;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>{e||l(null)},t[12]=w):w=t[12];let T;t[13]!==i||t[14]!==n?.kind?(T=n?.kind===`folder`?i({id:`WR0y2O`}):i({id:`F4IYWe`}),t[13]=i,t[14]=n?.kind,t[15]=T):T=t[15];let E=o||m,D,O;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(Na,{className:`size-3.5`,"aria-hidden":!0}),O=(0,Z.jsx)(Y,{id:`Z8lGw6`}),t[16]=D,t[17]=O):(D=t[16],O=t[17]);let k;t[18]!==S||t[19]!==T||t[20]!==E?(k=(0,Z.jsx)(mh,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,"aria-label":T,onClick:S,disabled:E,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[D,O]})}),t[18]=S,t[19]=T,t[20]=E,t[21]=k):k=t[21];let A=h?`w-96`:`w-80`,j;t[22]===A?j=t[23]:(j=gr(`flex flex-col gap-2`,A),t[22]=A,t[23]=j);let M;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`Z8lGw6`})}),t[24]=M):M=t[24];let N;t[25]===c?.autoCopyFailed?N=t[26]:(N=c?.autoCopyFailed?(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`vj-33a`,values:{copyShortcut:v},components:{0:(0,Z.jsx)(en,{"aria-label":b})}})}):null,t[25]=c?.autoCopyFailed,t[26]=N);let P=c?.url??``,F;t[27]===i?F=t[28]:(F=i({id:`5-FeN2`}),t[27]=i,t[28]=F);let I;t[29]!==P||t[30]!==F?(I=(0,Z.jsx)(dh,{ref:u,readOnly:!0,value:P,onFocus:sU,onClick:oU,onContextMenu:aU,className:`select-all bg-muted font-mono text-xs text-muted-foreground`,"data-testid":`share-button-url`,"aria-label":F}),t[29]=P,t[30]=F,t[31]=I):I=t[31];let L=c?.url??``,R=c?.autoCopyFailed===!1,z;t[32]!==L||t[33]!==R?(z=(0,Z.jsx)(`div`,{className:`absolute inset-y-0 right-1 flex items-center`,children:(0,Z.jsx)(`div`,{className:`rounded-md bg-background/50 backdrop-blur-sm`,children:(0,Z.jsx)(Pt,{copyContent:L,clipboardWrite:_r,initialCopied:R})})}),t[32]=L,t[33]=R,t[34]=z):z=t[34];let B;t[35]!==I||t[36]!==z?(B=(0,Z.jsxs)(`div`,{className:`relative`,children:[I,z]}),t[35]=I,t[36]=z,t[37]=B):B=t[37];let V=c?.freshness,ee=n?.kind??`doc`,H;t[38]!==a||t[39]!==V||t[40]!==ee?(H=(0,Z.jsx)(Df,{freshness:V,status:a,kind:ee}),t[38]=a,t[39]=V,t[40]=ee,t[41]=H):H=t[41];let U;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsxs)(`a`,{href:eU,target:`_blank`,rel:`noopener noreferrer`,onClick:iU,onAuxClick:rU,className:`mt-2 flex items-center gap-1.5 self-start text-xs text-muted-foreground transition-colors hover:text-primary`,children:[(0,Z.jsx)(_,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(Y,{id:`aByJ8j`})]}),t[42]=U):U=t[42];let W;t[43]!==j||t[44]!==N||t[45]!==B||t[46]!==H?(W=(0,Z.jsxs)(ph,{align:`end`,className:j,"data-testid":`share-button-popover`,children:[M,N,B,H,U]}),t[43]=j,t[44]=N,t[45]=B,t[46]=H,t[47]=W):W=t[47];let G;return t[48]!==k||t[49]!==W||t[50]!==C?(G=(0,Z.jsxs)(hh,{open:C,onOpenChange:w,children:[k,W]}),t[48]=k,t[49]=W,t[50]=C,t[51]=G):G=t[51],G}function rU(e){return _h(e,eU)}function iU(e){return _h(e,eU)}function aU(e){return e.currentTarget.select()}function oU(e){return e.currentTarget.select()}function sU(e){return e.currentTarget.select()}function cU(e){return console.log(e)}function lU(e,t){t!==`clipboard`&&Dc.error(e)}function uU(e){return Dc.success(e)}var dU=(0,Q.lazy)(()=>n(()=>import(`./AppMenubar-DS-GyfEA.js`).then(e=>({default:e.AppMenubar})),__vite__mapDeps([207,1,7,8,9,11,12,13,40,130,43,44,45,14,15,41,92,21,99,18,208,36,37,19,17]),import.meta.url));function fU(e){let t=(0,$.c)(57),{children:n,noteModeToggle:r,onSignIn:i,onSetIdentity:a,onOpenSearch:o}=e,{_:s}=Bn(),{activeDocName:c,activeTarget:l}=Et(),u=c?ns(c):null,{state:d}=RL(),f=OC(),p=$c(),m=f||p,h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=Lc(`toggle-files-sidebar`),t[0]=h):h=t[0];let g=h,_;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(_=Ac(`toggle-files-sidebar`),t[1]=_):_=t[1];let v=_,y;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(y=Lc(`command-palette`),t[2]=y):y=t[2];let b=y,x=Ac(`command-palette`),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(!1),E=(0,Q.useRef)(null),D=(0,Q.useRef)(null),O=(0,Q.useRef)(null),k=(0,Q.useRef)(null),A;bb0:{if(l?.kind===`folder`){let e;t[3]===l.folderPath?e=t[4]:(e=Xd(l.folderPath),t[3]=l.folderPath,t[4]=e),A=e;break bb0}if(c&&!u){let e;t[5]===c?e=t[6]:(e=_f(c),t[5]=c,t[6]=e),A=e;break bb0}if(!l&&!c){let e;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=Xd(``),t[7]=e):e=t[7],A=e;break bb0}A=null}let j=A,M=typeof window<`u`&&window.okDesktop!=null,N=d===`collapsed`,P=M&&(N||p),F;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(F=S_()?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(dU,{})}):null,t[8]=F):F=t[8];let I=F,L,R;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>{let e=E.current,t=D.current,n=O.current,r=k.current;if(!e||!t||!n||!r)return;let i=()=>{e.style.setProperty(`--editor-header-leading-width`,`${t.offsetWidth}px`);let i=Number.parseFloat(getComputedStyle(r).marginRight)||0,a=Math.max(0,e.offsetWidth-n.offsetWidth);e.style.setProperty(`--editor-header-trailing-width`,`${Math.max(0,r.offsetWidth+i-a)}px`)};i();let a=requestAnimationFrame(()=>{i(),a=requestAnimationFrame(()=>{i(),T(!0)})}),o=typeof ResizeObserver>`u`?null:new ResizeObserver(i);return o?.observe(e),o?.observe(t),o?.observe(n),o?.observe(r),()=>{cancelAnimationFrame(a),o?.disconnect()}},R=[],t[9]=L,t[10]=R):(L=t[9],R=t[10]),(0,Q.useLayoutEffect)(L,R);let z=!m&&(0,Z.jsx)(nU,{input:j,onClickWhenNoRemote:()=>C(!0)}),B=!p&&(0,Z.jsx)(sf,{onSignIn:i,onSetIdentity:a}),V,ee,H,U;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(zV,{}),ee=(0,Z.jsx)(La,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),H=(0,Z.jsx)(VH,{}),U=(0,Z.jsx)(HV,{}),t[11]=V,t[12]=ee,t[13]=H,t[14]=U):(V=t[11],ee=t[12],H=t[13],U=t[14]);let W=!m&&(0,Z.jsx)($H,{}),G=!p&&(0,Z.jsx)(RH,{}),te;t[15]!==W||t[16]!==G||t[17]!==z||t[18]!==B?(te=(0,Z.jsxs)(Z.Fragment,{children:[z,B,V,ee,H,U,W,G]}),t[15]=W,t[16]=G,t[17]=z,t[18]=B,t[19]=te):te=t[19];let ne=te,re=M?``:void 0,K=P?`var(--ok-titlebar-reserve-left, 1rem)`:`0px`,ie;t[20]===K?ie=t[21]:(ie={"--editor-header-leading-offset":K},t[20]=K,t[21]=ie);let q=p?`bg-background`:`bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,ae;t[22]===q?ae=t[23]:(ae=gr(`group/editor-header relative flex h-12 shrink-0 items-center`,q,M&&`[-webkit-app-region:drag]`),t[22]=q,t[23]=ae);let oe=!w&&`invisible`,se;t[24]===oe?se=t[25]:(se=gr(`absolute inset-y-0 left-0 z-10 flex min-w-0 w-[var(--editor-header-tabs-width,100%)] overflow-hidden`,oe,M&&`[-webkit-app-region:drag]`),t[24]=oe,t[25]=se);let ce;t[26]!==n||t[27]!==se?(ce=(0,Z.jsx)(`div`,{ref:O,"data-electron-drag":M?``:void 0,"data-editor-header-tabs":``,className:se,children:n}),t[26]=n,t[27]=se,t[28]=ce):ce=t[28];let le=M?``:void 0,ue=gr(`absolute inset-y-0 left-0 z-20 flex items-center gap-1 px-3`,M&&`[-webkit-app-region:drag]`,P&&`left-[var(--ok-titlebar-reserve-left,1rem)]`,p&&`max-w-[calc(50%-4rem)] overflow-hidden`),de=f&&I,fe;t[29]!==c||t[30]!==p?(fe=p&&(0,Z.jsx)(yR,{docName:c,includeCurrentPage:!0}),t[29]=c,t[30]=p,t[31]=fe):fe=t[31];let pe=!m&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ma,{"aria-label":s({id:`V6AIOn`}),className:`-ml-1 shrink-0 has-[>[data-slot=button-group]]:gap-0`,children:[(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(UL,{className:gr(`shrink-0 text-muted-foreground`,M&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsxs)(Vr,{children:[(0,Z.jsx)(`span`,{children:s(d===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`})}),` `,(0,Z.jsx)(en,{"aria-label":v,children:g})]})]}),N&&o&&(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,onClick:o,"aria-label":s({id:`DbCfXV`,values:{searchShortcutLabel:x}}),"data-telemetry-event":`ok.editor_header.search.click`,className:gr(`shrink-0 text-muted-foreground`,M&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(kt,{"aria-hidden":`true`})})}),(0,Z.jsxs)(Vr,{children:[(0,Z.jsx)(`span`,{children:s({id:`A1taO8`})}),` `,(0,Z.jsx)(en,{"aria-label":x,children:b})]})]}),M&&N&&(0,Z.jsx)(JH,{})]}),I,(0,Z.jsx)(La,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`})]}),J;t[32]!==le||t[33]!==ue||t[34]!==de||t[35]!==fe||t[36]!==pe?(J=(0,Z.jsxs)(`div`,{ref:D,"data-electron-drag":le,"data-editor-header-leading-actions":``,className:ue,children:[de,fe,pe]}),t[32]=le,t[33]=ue,t[34]=de,t[35]=fe,t[36]=pe,t[37]=J):J=t[37];let me;t[38]!==r||t[39]!==p?(me=p&&r?(0,Z.jsx)(`div`,{"data-note-window-mode-toggle":``,className:`absolute inset-y-0 left-1/2 z-30 flex -translate-x-1/2 items-center [-webkit-app-region:no-drag] [&_[data-slot=toggle-group]]:bg-transparent [&_[data-slot=toggle-group]]:p-0 [&_[data-slot=toggle-group-item]]:size-8 [&_[data-slot=toggle-group-item]]:shadow-none`,children:r}):null,t[38]=r,t[39]=p,t[40]=me):me=t[40];let he;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(he=gr(`absolute inset-y-0 right-0 z-20 flex items-center justify-end gap-2 px-3`,M&&`[-webkit-app-region:drag] [&_button]:[-webkit-app-region:no-drag] [&_a]:[-webkit-app-region:no-drag]`,M&&`mr-[var(--ok-titlebar-reserve-right,0px)]`),t[41]=he):he=t[41];let ge=!p&&ne,_e;t[42]!==S||t[43]!==m||t[44]!==C?(_e=!m&&(0,Z.jsx)(Bd,{open:S,onOpenChange:C}),t[42]=S,t[43]=m,t[44]=C,t[45]=_e):_e=t[45];let ve;t[46]!==ge||t[47]!==_e?(ve=(0,Z.jsxs)(`div`,{ref:k,"data-electron-drag":M?``:void 0,"data-editor-header-actions":``,className:he,children:[ge,_e]}),t[46]=ge,t[47]=_e,t[48]=ve):ve=t[48];let ye;return t[49]!==re||t[50]!==ie||t[51]!==ae||t[52]!==ce||t[53]!==J||t[54]!==me||t[55]!==ve?(ye=(0,Z.jsxs)(`header`,{ref:E,"data-electron-drag":re,style:ie,className:ae,children:[ce,J,me,ve]}),t[49]=re,t[50]=ie,t[51]=ae,t[52]=ce,t[53]=J,t[54]=me,t[55]=ve,t[56]=ye):ye=t[56],ye}function pU(e,t){return Fo({relativePath:hu(e),instruction:``,selectionMarkdown:t,target:`claude-code`})}var mU=(0,Q.lazy)(()=>n(()=>import(`./AgentThreadClientBinder-Sg80UfOQ.js`).then(e=>({default:e.AgentThreadClientBinder})),__vite__mapDeps([209,1,18,9,210,37,84,13,111,28,2,3,29,30,31,32,33]),import.meta.url)),hU=(0,Q.lazy)(()=>n(()=>import(`./SessionsHost-CGbrz5ge.js`).then(e=>({default:e.SessionsHost})),__vite__mapDeps([211,1,2,125,13,9,28,3,29,30,31,32,33,37,7,8,128,11,12,129,130,43,44,45,40,14,15,41,21,92,99,18,19,17,66,118,119,42,46,16,135,24,212,26,213,106,96,34,20,84,214,157,108,147,109,110,215,180,158,83,85,86,87,88,89,159,210,216,148,69]),import.meta.url));function gU(e){let t=(0,$.c)(4),{provider:n,editorMode:r,onModeChange:i}=e,a=Aw(n),o=r===`source`,s=a!==`connected`&&a!==`synced`,c;return t[0]!==i||t[1]!==o||t[2]!==s?(c=(0,Z.jsx)(yg,{isSourceMode:o,onModeChange:i,sourceDisabled:s}),t[0]=i,t[1]=o,t[2]=s,t[3]=c):c=t[3],c}function _U(e){let t=(0,$.c)(145),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,[i,a]=bw(),[o,s]=(0,Q.useState)(i),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(`auth`),f=(0,Q.useSyncExternalStore)(zh.subscribe,zh.getSnapshot,DU),p,m;t[2]===f?(p=t[3],m=t[4]):(p=()=>{f&&(zh.clear(),d(`auth`),l(!0))},m=[f],t[2]=f,t[3]=p,t[4]=m),(0,Q.useEffect)(p,m);let[h,g]=(0,Q.useState)(lE[0].id),[_,v]=(0,Q.useState)(!1),y=typeof window<`u`?window.okDesktop??null:null,b;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(b=$c(),t[5]=b):b=t[5];let x=b,S=!x&&y!=null&&y.terminal!=null&&y.config.ptyAvailable===!0,[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(0),[D,k]=(0,Q.useState)(EU),[A,j]=(0,Q.useState)(TU),M,N;t[6]===D?(M=t[7],N=t[8]):(M=()=>{Ew(D)},N=[D],t[6]=D,t[7]=M,t[8]=N),(0,Q.useEffect)(M,N);let P,F;t[9]===A?(P=t[10],F=t[11]):(P=()=>{kw(A)},F=[A],t[9]=A,t[10]=P,t[11]=F),(0,Q.useEffect)(P,F);let[I,L]=(0,Q.useState)(!1),R=Pr(),[z,B]=(0,Q.useState)(!1),V=(0,Q.useRef)(!1),[ee,H]=(0,Q.useState)(null),[U,W]=(0,Q.useState)(null),[G,te]=(0,Q.useState)(null),ne=(0,Q.useRef)(0),re;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(re={terminal:{container:null,isShowing:!1},agents:{container:null,isShowing:!1},editorRegion:null},t[12]=re):re=t[12];let[K,ie]=(0,Q.useState)(re),q=(0,Q.useRef)(0),ae;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(ae=function(){gl()},t[13]=ae):ae=t[13];let oe=ae,se;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(se=function(){L(!0)},t[14]=se):se=t[14];let ce=se,le=Cu(),{projectConfig:ue,projectLocalConfig:de,projectLocalSynced:fe,projectSynced:pe}=Fl(),{activeDocName:J,activeProvider:me}=Et(),he=le?.hasRemote,_e=le?.pushPermission?.checkStatus,ve;t[15]!==_||t[16]!==ue||t[17]!==de||t[18]!==fe||t[19]!==pe||t[20]!==he||t[21]!==_e?(ve=Pw({autoSyncOnboardingDismissed:_,hasRemote:he,projectLocalSynced:fe,projectSynced:pe,projectLocalConfig:de,projectConfig:ue,pushPermissionCheckStatus:_e}),t[15]=_,t[16]=ue,t[17]=de,t[18]=fe,t[19]=pe,t[20]=he,t[21]=_e,t[22]=ve):ve=t[22];let ye=ve,be,xe;t[23]===J?(be=t[24],xe=t[25]):(be=()=>{let e=function(e){let t=e.detail;t&&J&&Od(J,{kind:`raw-mdx`,detail:t}),s(`source`)};return window.addEventListener(fw,e),()=>window.removeEventListener(fw,e)},xe=[J],t[23]=J,t[24]=be,t[25]=xe),(0,Q.useEffect)(be,xe);let Se;t[26]!==J||t[27]!==o?(Se=function(e,t){if(J==null)return!1;let n=Kh(J,o)?.markdown??``;return n.trim()===``?!1:(xl(`${pU(J,n)}\n\n`,{newTab:e,submit:!1,target:t}),!0)},t[26]=J,t[27]=o,t[28]=Se):Se=t[28];let Ce=Se,we=(0,Q.useEffectEvent)(Ce),Te;t[29]===Ce?Te=t[30]:(Te=()=>Ce(!1,`agents`),t[29]=Ce,t[30]=Te);let Ee=(0,Q.useEffectEvent)(Te),De;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(De=()=>oe(),t[31]=De):De=t[31];let Oe=(0,Q.useEffectEvent)(De),ke;t[32]===Ee?ke=t[33]:(ke=()=>{if(!x)return fr(e=>{if(e===`toggle-terminal`)w(wU);else if(e===`move-terminal`)k(CU);else if(e===`new-terminal`)w(!0);else if(e===`toggle-agent-panel`){if(Ee())return;L(SU)}})},t[32]=Ee,t[33]=ke);let Ae;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=[x],t[34]=Ae):Ae=t[34],(0,Q.useEffect)(ke,Ae);let je,Me;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(je=()=>{let e=window.okDesktop!=null,t=function(t){kc(t,`toggle-terminal-panel`,e)&&(Mr()||S&&(t.preventDefault(),w(xU)))};return window.addEventListener(`keydown`,t,{capture:!0}),()=>window.removeEventListener(`keydown`,t,{capture:!0})},Me=[S],t[35]=je,t[36]=Me):(je=t[35],Me=t[36]),(0,Q.useEffect)(je,Me);let Ne;t[37]===Ee?Ne=t[38]:(Ne=()=>{if(window.okDesktop!=null)return;let e=function(e){Mc(e,`toggle-agent-panel`)&&(Mr()||(e.preventDefault(),!Ee()&&L(bU)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},t[37]=Ee,t[38]=Ne);let Pe;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=[],t[39]=Pe):Pe=t[39],(0,Q.useEffect)(Ne,Pe);let Fe;t[40]!==Oe||t[41]!==we?(Fe=()=>{let e=function(e){Mc(e,`new-terminal-tab`)&&(Mr()||(e.preventDefault(),we(!0)||Oe()))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},t[40]=Oe,t[41]=we,t[42]=Fe):Fe=t[42];let Ie;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=[],t[43]=Ie):Ie=t[43],(0,Q.useEffect)(Fe,Ie);let Le,Re;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(Le=()=>L_(e=>{w(!0),q.current+=1,W({id:e,nonce:q.current})}),Re=[],t[44]=Le,t[45]=Re):(Le=t[44],Re=t[45]),(0,Q.useEffect)(Le,Re);let ze,Be;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(ze=()=>pl((e,t,n)=>{let{stage:r}=n;w(!0),q.current+=1,H({prompt:r?null:e,cli:t,nonce:q.current,stagePaste:r?e:void 0})}),Be=[],t[46]=ze,t[47]=Be):(ze=t[46],Be=t[47]),(0,Q.useEffect)(ze,Be);let Ve,He;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=()=>Vl(e=>{L(!0),ne.current+=1,te({agentSource:e.agentSource,agentId:e.agentId,prompt:e.prompt,docName:e.docName,titleHint:e.titleHint,nonce:ne.current})}),He=[],t[48]=Ve,t[49]=He):(Ve=t[48],He=t[49]),(0,Q.useEffect)(Ve,He);let Ue,We;t[50]===C?(Ue=t[51],We=t[52]):(Ue=()=>{C||H(null)},We=[C],t[50]=C,t[51]=Ue,t[52]=We),(0,Q.useEffect)(Ue,We);let Ge,Ke;t[53]!==z||t[54]!==C?(Ge=()=>{window.okDesktop!=null&&z&&(el({terminalVisible:C}),window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:C}))},Ke=[C,z],t[53]=z,t[54]=C,t[55]=Ge,t[56]=Ke):(Ge=t[55],Ke=t[56]),(0,Q.useEffect)(Ge,Ke);let qe,Je;t[57]!==z||t[58]!==D?(qe=()=>{window.okDesktop!=null&&z&&(el({terminalPlacement:D}),window.okDesktop.editor.notifyViewMenuStateChanged({terminalPlacement:D}))},Je=[D,z],t[57]=z,t[58]=D,t[59]=qe,t[60]=Je):(qe=t[59],Je=t[60]),(0,Q.useEffect)(qe,Je);let Ye,Xe;t[61]!==I||t[62]!==z?(Ye=()=>{window.okDesktop!=null&&z&&(el({agentPanelVisible:I}),window.okDesktop.editor.notifyViewMenuStateChanged({agentPanelVisible:I}))},Xe=[I,z],t[61]=I,t[62]=z,t[63]=Ye,t[64]=Xe):(Ye=t[63],Xe=t[64]),(0,Q.useEffect)(Ye,Xe);let Ze,Qe;t[65]!==J||t[66]!==o?(Ze=()=>{let e=null,t=()=>{let t=((J===null?null:Kh(J,o))?.markdown??``).trim()!==``;t!==e&&(e=t,el({hasEditorSelection:t}),window.okDesktop?.editor.notifyViewMenuStateChanged({hasEditorSelection:t}))};return t(),Hh(t)},Qe=[J,o],t[65]=J,t[66]=o,t[67]=Ze,t[68]=Qe):(Ze=t[67],Qe=t[68]),(0,Q.useEffect)(Ze,Qe);let $e,et;t[69]===Symbol.for(`react.memo_cache_sentinel`)?($e=()=>{if(x){B(!0);return}let e=window.okDesktop;if(e==null)return;if(typeof e.terminal?.getDockState!=`function`){B(!0);return}let t=!1;return e.terminal.getDockState().then(e=>{t||(e.agentPanelVisible&&L(!0),e.terminalVisible&&(V.current=!0,E(yU),w(!0)))}).catch(vU).finally(()=>{t||B(!0)}),()=>{t=!0}},et=[x],t[69]=$e,t[70]=et):($e=t[69],et=t[70]),(0,Q.useEffect)($e,et);let tt,nt;t[71]===C?(tt=t[72],nt=t[73]):(tt=()=>{if(window.okDesktop!=null){if(V.current){V.current=!1;return}C&&$a()}},nt=[C],t[71]=C,t[72]=tt,t[73]=nt),(0,Q.useEffect)(tt,nt),xw(le?.pausedReason),Cw();let rt;t[74]!==J||t[75]!==me||t[76]!==o||t[77]!==a?(rt=function(e){J&&me&&o!==e&&(hd({from:o,to:e,docName:J,ytext:me.document.getText(`source`)}),ge(J)),s(e),a(e)},t[74]=J,t[75]=me,t[76]=o,t[77]=a,t[78]=rt):rt=t[78];let it=rt,at;t[79]!==o||t[80]!==it?(at=()=>{it(o===`source`?`wysiwyg`:`source`)},t[79]=o,t[80]=it,t[81]=at):at=t[81];let ot=(0,Q.useEffectEvent)(at),st=o===`wysiwyg`&&!!J&&!!me,ct;t[82]!==J||t[83]!==me||t[84]!==st?(ct=()=>{if(!st||!J||!me)return;let e=O(J);e&&qu({editor:e,docName:J,ytext:me.document.getText(`source`)})},t[82]=J,t[83]=me,t[84]=st,t[85]=ct):ct=t[85];let lt=(0,Q.useEffectEvent)(ct),ut,dt;t[86]===st?(ut=t[87],dt=t[88]):(ut=()=>{window.okDesktop?.editor.notifyViewMenuStateChanged({canViewInSource:st})},dt=[st],t[86]=st,t[87]=ut,t[88]=dt),(0,Q.useEffect)(ut,dt);let ft;t[89]!==lt||t[90]!==ot?(ft=()=>{let e=function(e){if(Mc(e,`toggle-editor-mode`)){if(Mr())return;e.preventDefault(),ot();return}if(Mc(e,`view-source-at-cursor`)){if(Mr())return;e.preventDefault(),lt()}};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},t[89]=lt,t[90]=ot,t[91]=ft):ft=t[91];let pt;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(pt=[],t[92]=pt):pt=t[92],(0,Q.useEffect)(ft,pt);let mt;t[93]===lt?mt=t[94]:(mt=()=>fr(e=>{e===`toggle-source`&&lt()}),t[93]=lt,t[94]=mt);let ht;t[95]===Symbol.for(`react.memo_cache_sentinel`)?(ht=[],t[95]=ht):ht=t[95],(0,Q.useEffect)(mt,ht);let gt,_t;t[96]===J?(gt=t[97],_t=t[98]):(gt=()=>{let e=function(e){e.detail?.docName===J&&s(`source`)};return window.addEventListener(ed,e),()=>window.removeEventListener(ed,e)},_t=[J],t[96]=J,t[97]=gt,t[98]=_t),(0,Q.useEffect)(gt,_t);let vt;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(vt=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(mU,{})}),t[99]=vt):vt=t[99];let yt=x?!1:C,bt=x?!1:I,xt;t[100]!==J||t[101]!==me||t[102]!==o||t[103]!==it||t[104]!==r?(xt=e=>(0,Z.jsx)(fU,{noteModeToggle:x&&J!==null&&!yo(J)?(0,Z.jsx)(gU,{provider:me,editorMode:o,onModeChange:it}):null,onSignIn:()=>{d(`auth`),l(!0)},onSetIdentity:()=>{d(`identity`),l(!0)},onOpenSearch:r,children:e}),t[100]=J,t[101]=me,t[102]=o,t[103]=it,t[104]=r,t[105]=xt):xt=t[105];let St;t[106]!==h||t[107]!==o||t[108]!==it||t[109]!==yt||t[110]!==bt||t[111]!==xt||t[112]!==D||t[113]!==A?(St=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,Z.jsx)($B,{editorMode:o,onModeChange:it,activeTab:h,onActiveTabChange:g,terminalBridge:S?y:null,terminalVisible:yt,terminalPlacement:D,terminalRightWidth:A,onTerminalVisibleChange:w,onTerminalRightWidthChange:j,agentsVisible:bt,onAgentsVisibleChange:L,onSessionPlacements:ie,onRevealAgents:x?void 0:ce,renderWorkspaceHeader:xt})})}),t[106]=h,t[107]=o,t[108]=it,t[109]=yt,t[110]=bt,t[111]=xt,t[112]=D,t[113]=A,t[114]=St):St=t[114];let Ct;t[115]!==I||t[116]!==R||t[117]!==K||t[118]!==G?(Ct=x?null:(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(hU,{surface:`agents-panel`,bridge:y,terminalCapable:S,visible:I,onVisibleChange:L,threadLaunch:G,installedClis:R,container:K.agents.container,isShowing:K.agents.isShowing,onRequestEditorFocus:()=>K.editorRegion?.focus()})}),t[115]=I,t[116]=R,t[117]=K,t[118]=G,t[119]=Ct):Ct=t[119];let wt;t[120]!==I||t[121]!==R||t[122]!==K||t[123]!==U||t[124]!==ee||t[125]!==D||t[126]!==T||t[127]!==C?(wt=S?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(hU,{surface:`terminal-dock`,terminalPlacement:D,onTerminalPlacementChange:k,reserveRightRevealTabGutter:D===`right`&&!I,bridge:y,terminalCapable:!0,visible:C,terminalRestoreRevealNonce:T,onVisibleChange:w,launch:ee,commandLaunch:U,installedClis:R,container:K.terminal.container,isShowing:K.terminal.isShowing,onRequestEditorFocus:()=>K.editorRegion?.focus()})}):null,t[120]=I,t[121]=R,t[122]=K,t[123]=U,t[124]=ee,t[125]=D,t[126]=T,t[127]=C,t[128]=wt):wt=t[128];let Tt=u===`identity`,Dt;t[129]===Symbol.for(`react.memo_cache_sentinel`)?(Dt=()=>{l(!1)},t[129]=Dt):Dt=t[129];let Ot;t[130]!==c||t[131]!==Tt?(Ot=(0,Z.jsx)(Kd,{open:c,onOpenChange:l,identityPrompt:Tt,onSuccess:Dt}),t[130]=c,t[131]=Tt,t[132]=Ot):Ot=t[132];let kt=ye!==null,At=ye??`full`,jt;t[133]===Symbol.for(`react.memo_cache_sentinel`)?(jt=()=>v(!0),t[133]=jt):jt=t[133];let Mt;t[134]!==kt||t[135]!==At?(Mt=(0,Z.jsx)(Mw,{open:kt,variant:At,onResolved:jt}),t[134]=kt,t[135]=At,t[136]=Mt):Mt=t[136];let Nt,Pt;t[137]===Symbol.for(`react.memo_cache_sentinel`)?(Nt=(0,Z.jsx)(lw,{}),Pt=(0,Z.jsx)(sw,{}),t[137]=Nt,t[138]=Pt):(Nt=t[137],Pt=t[138]);let Ft;return t[139]!==St||t[140]!==Ct||t[141]!==wt||t[142]!==Ot||t[143]!==Mt?(Ft=(0,Z.jsxs)(Z.Fragment,{children:[vt,St,Ct,wt,Ot,Mt,Nt,Pt]}),t[139]=St,t[140]=Ct,t[141]=wt,t[142]=Ot,t[143]=Mt,t[144]=Ft):Ft=t[144],Ft}function vU(e){console.error(`[terminal] dock-state restore failed; staying hidden:`,e)}function yU(e){return e+1}function bU(e){return!e}function xU(e){return!e}function SU(e){return!e}function CU(e){return e===`bottom`?`right`:`bottom`}function wU(e){return!e}function TU(){return Ow()}function EU(){return Tw()}function DU(){return!1}function OU(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(!1),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>fr(e=>{e===`send-feedback`&&n(!0)}),i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a;return e[2]===t?a=e[3]:(a=(0,Z.jsx)(HS,{open:t,onOpenChange:n,source:`help_menu`}),e[2]=t,e[3]=a),a}function kU(e){let t=qp(em(e));typeof window>`u`||tm(window.location.hash,t)||(window.location.hash=t)}function AU(){let e=(0,$.c)(18),{conflicts:t,loading:n,error:r}=Gd(),{_:i}=Bn();if(n)return null;if(r===`server`){let t;e[0]===i?t=e[1]:(t=i({id:`OKImo8`}),e[0]=i,e[1]=t);let n;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`p`,{"data-testid":`conflicts-section-error`,className:`px-2 py-1.5 text-[12px] text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(Lp,{"aria-hidden":`true`,className:`mr-1.5 inline size-3`}),(0,Z.jsx)(Y,{id:`L6Ud-t`})]}),e[2]=n):n=e[2];let r;return e[3]===t?r=e[4]:(r=(0,Z.jsx)(`section`,{"data-testid":`conflicts-section`,"aria-label":t,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:n}),e[3]=t,e[4]=r),r}if(t.length===0)return null;let a;e[5]===i?a=e[6]:(a=i({id:`OKImo8`}),e[5]=i,e[6]=a);let o;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 font-mono text-[11px] uppercase tracking-wider text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(Lp,{"aria-hidden":`true`,className:`size-3`}),(0,Z.jsx)(Y,{id:`KGJb9_`})]}),e[7]=o):o=e[7];let s;e[8]===t.length?s=e[9]:(s=(0,Z.jsxs)(`header`,{className:`flex items-center justify-between px-2 pb-1.5`,children:[o,(0,Z.jsx)(`span`,{"data-testid":`conflicts-section-count`,className:`rounded-full bg-amber-500 px-1.5 py-0.5 font-mono text-[10px] font-medium leading-none text-white`,children:t.length})]}),e[8]=t.length,e[9]=s);let c;e[10]===t?c=e[11]:(c=t.map(jU),e[10]=t,e[11]=c);let l;e[12]===c?l=e[13]:(l=(0,Z.jsx)(`ul`,{className:`flex flex-col gap-px`,children:c}),e[12]=c,e[13]=l);let u;return e[14]!==a||e[15]!==s||e[16]!==l?(u=(0,Z.jsxs)(`section`,{"data-testid":`conflicts-section`,"aria-label":a,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:[s,l]}),e[14]=a,e[15]=s,e[16]=l,e[17]=u):u=e[17],u}function jU(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,"data-testid":`conflicts-section-row`,"data-file":e.file,title:e.file,className:`h-7 w-full justify-start gap-1.5 px-2 font-normal text-[13px] text-amber-800 hover:bg-amber-100/60 hover:text-amber-900 dark:text-amber-300 dark:hover:bg-amber-900/30 dark:hover:text-amber-200`,onClick:()=>kU(e.file),children:[(0,Z.jsx)(Lp,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var MU=`proactive_card`;function NU(){let e=!1,t=!1;return{isEvaluated:()=>e,isShown:()=>t,latchEvaluated:()=>{e=!0},latchShown:()=>{t=!0}}}var PU=NU();function FU(e){let t=(0,$.c)(14),{pages:n,ready:r,blocked:i,store:a,now:o,session:s}=e,c=a===void 0?fH:a,l=o===void 0?Date.now:o,u=s===void 0?PU:s,{dismissed:d}=(0,Q.useSyncExternalStore)(c.subscribe,c.getSnapshot,c.getSnapshot),f;t[0]===u?f=t[1]:(f=u.isShown(),t[0]=u,t[1]=f);let[p,m]=(0,Q.useState)(f),h,g;t[2]!==l||t[3]!==c?(h=()=>{c.recordFirstSeen(l())},g=[c,l],t[2]=l,t[3]=c,t[4]=h,t[5]=g):(h=t[4],g=t[5]),(0,Q.useEffect)(h,g);let _,v;return t[6]!==i||t[7]!==l||t[8]!==n||t[9]!==r||t[10]!==u||t[11]!==c?(_=()=>{u.isEvaluated()||!r||n==null||(u.latchEvaluated(),!i&&aH(c.getSnapshot(),l(),iH(n))&&(c.recordShown(l()),u.latchShown(),m(!0)))},v=[r,i,n,c,l,u],t[6]=i,t[7]=l,t[8]=n,t[9]=r,t[10]=u,t[11]=c,t[12]=_,t[13]=v):(_=t[12],v=t[13]),(0,Q.useEffect)(_,v),p&&!d}var IU=`Relaunch`,LU=`Release notes`,RU=`Updates paused`,zU=`Download`,BU=`Reset to defaults`,VU=`Relaunching to install the update…`,HU=`Getting the latest version…`,UU=`Relaunch failed — please restart manually`;function WU(e){return`Update to ${e} didn't install.`}var GU=`Retry`,KU=`Download manually`,qU=`Recovery action failed — please try again`;function JU(e,t){let n=t instanceof Error&&t.message?t.message:``;return n?`${e}: ${n}`:e}function YU(e){return`Version ${e} ready to install`}function XU(e){return`Updated to Version ${e}`}function ZU(e){return`Your settings and recent projects were saved by a newer build than this one (v${e}). Reset to defaults to continue.`}var QU=0,$U=0,eW=1,tW=2,nW=3,rW=6e4;function iW(e,t,n=()=>{},r=rW,i={isEligible:()=>!1,onShown:()=>{}}){let a=[],o=new Set,s=`update-downloaded`;return a.push(e.onUpdateDownloaded(({version:r})=>{let i=s,a=()=>{t({id:i,body:YU(r),priority:tW,action:{label:IU,onClick:()=>{t({id:i,body:VU,priority:tW,dismissible:!1}),e.update.relaunchNow().then(()=>{n(i)},e=>{a(),t({id:`relaunch-error-${r}`,body:JU(UU,e),variant:`error`,priority:eW})})}}})};a()})),a.push(e.onUpdateRelaunching(()=>{t({id:s,body:VU,priority:tW,dismissible:!1})})),a.push(e.onUpdateFetchingLatest(()=>{t({id:s,body:HU,priority:tW,dismissible:!1})})),a.push(e.onUpdateRelaunchFailed(({version:r,message:i,downloadUrl:a,dismissPending:o})=>{if(o&&n(s),a){let i=`install-failed-${r}`,o=()=>{t({id:i,body:WU(r),variant:`error`,priority:eW,action:{label:GU,onClick:()=>{e.update.relaunchNow().then(()=>{n(i)},e=>{console.warn(`[update-notice] install-failed retry rejected`,e),o()})}},secondaryAction:{label:KU,onClick:()=>{e.shell.openExternal(a)}}})};o();return}t({id:`relaunch-error-${r}`,body:i?`${UU}: ${i}`:UU,variant:`error`,priority:eW})})),a.push(e.onWhatsNew(({version:a,releaseUrl:s})=>{if(i.isEligible(a)){i.onShown(a),t({id:`whats-new-combined-${a}`,body:XU(a),variant:`success`,priority:nW,combinedSubscribe:!0,whatsNew:{version:a,releaseUrl:s},action:{label:LU,onClick:()=>{e.shell.openExternal(s)}}}),e.update.dismissWhatsNew(a);return}let c=`whats-new-${a}`;t({id:c,body:XU(a),variant:`success`,priority:nW,action:{label:LU,onClick:()=>{e.shell.openExternal(s)}},onDismiss:()=>{e.update.dismissWhatsNew(a)}});let l=setTimeout(()=>{o.delete(l),n(c),e.update.dismissWhatsNew(a)},r);o.add(l)})),a.push(e.onWhatsNewDismissed(({version:e})=>{n(`whats-new-${e}`)})),a.push(e.onUpdateStuckHint(({downloadUrl:n})=>{t({id:`update-stuck-hint`,body:RU,priority:$U,action:{label:zU,onClick:()=>{e.shell.openExternal(n)}}})})),()=>{for(let e of a)e();for(let e of o)clearTimeout(e);o.clear()}}function aW(e,t,n,r=()=>{}){let i=`schema-incompatibility-${t.persistedSchemaVersion}`,a=`schema-incompatibility-error-${t.persistedSchemaVersion}`,o=e=>{r(i),n({id:a,body:JU(qU,e),variant:`error`,priority:QU})};n({id:i,body:ZU(t.currentBuild),priority:QU,action:{label:BU,onClick:()=>{e.state.resetIncompatible().then(()=>{r(i)},o)}}})}var oW=[],sW=new Set,cW=!1;function lW(){for(let e of sW)e()}function uW(e){let t=oW.findIndex(t=>t.id===e.id);if(t===-1)oW=[...oW,e];else{let n=oW.slice();n[t]=e,oW=n}lW()}function dW(e){let t=oW.filter(t=>t.id!==e);t.length!==oW.length&&(oW=t,lW())}function fW(){return oW}function pW(e){return sW.add(e),()=>{sW.delete(e)}}function mW(){if(cW||typeof window>`u`)return;let e=window.okDesktop;e&&(cW=!0,iW(e,uW,dW,void 0,{isEligible:e=>yH(EH.getSnapshot(),e),onShown:e=>EH.recordShown(e)}),e.state.query().then(t=>{t.schemaIncompatibility&&aW(e,t.schemaIncompatibility,uW,dW)},e=>{console.warn(`[update-notices-store] bridge.state.query() failed`,e)}))}var hW=new URL(`/api/feedback`,{BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.64.0`}?.VITE_OK_FEEDBACK_INTAKE_ORIGIN||`https://openknowledge.ai`).href;function gW(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let e=typeof r.result==`string`?r.result:``,n=e.indexOf(`,`);t(n===-1?``:e.slice(n+1))},r.onerror=()=>n(r.error??Error(`file read failed`)),r.readAsDataURL(e)})}async function _W(e){return{contentType:e.type,base64:await gW(e)}}function vW(){return typeof window<`u`&&window.okDesktop?.platform||`web`}async function yW(e){try{let t=await fetch(hW,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({...e,appVersion:lh,platform:vW()}),signal:AbortSignal.timeout(3e4)});if(t.ok){let e=await t.json().catch(e=>(console.warn(`[feedback] action=submit result=ok-parse-error message=${e instanceof Error?e.message:String(e)}`),null));return{ok:!0,reference:e&&typeof e.reference==`string`?e.reference:``}}return t.status===400||t.status===413?{ok:!1,reason:`invalid`}:t.status===503?{ok:!1,reason:`unavailable`}:(console.warn(`[feedback] action=submit result=http-error status=${t.status}`),{ok:!1,reason:`error`})}catch(e){return console.warn(`[feedback] action=submit result=network-error message=${e instanceof Error?e.message:String(e)}`),{ok:!1,reason:`error`}}}var bW=Rr(`group/attachment relative flex w-fit max-w-full min-w-0 shrink-0 flex-wrap rounded-xl border bg-card text-card-foreground transition-colors focus-within:ring-1 focus-within:ring-ring/50 has-[>a,>button]:hover:bg-muted/50 data-[state=error]:border-destructive/30 data-[state=idle]:border-dashed`,{variants:{size:{default:`gap-2 text-sm has-data-[slot=attachment-content]:px-2.5 has-data-[slot=attachment-content]:py-2 has-data-[slot=attachment-media]:p-2`,sm:`gap-2.5 text-xs has-data-[slot=attachment-content]:px-2 has-data-[slot=attachment-content]:py-1.5 has-data-[slot=attachment-media]:p-1.5`,xs:`gap-1.5 rounded-lg text-xs has-data-[slot=attachment-content]:px-1.5 has-data-[slot=attachment-content]:py-1 has-data-[slot=attachment-media]:p-1`},orientation:{horizontal:`min-w-40 items-center`,vertical:`w-24 flex-col has-data-[slot=attachment-content]:w-30`}}});function xW(e){let t=(0,$.c)(16),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,state:i,size:a,orientation:o,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=i===void 0?`done`:i,c=a===void 0?`default`:a,l=o===void 0?`horizontal`:o,u;t[6]!==n||t[7]!==l||t[8]!==c?(u=gr(bW({size:c,orientation:l}),n),t[6]=n,t[7]=l,t[8]=c,t[9]=u):u=t[9];let d;return t[10]!==l||t[11]!==r||t[12]!==c||t[13]!==s||t[14]!==u?(d=(0,Z.jsx)(`div`,{"data-slot":`attachment`,"data-state":s,"data-size":c,"data-orientation":l,className:u,...r}),t[10]=l,t[11]=r,t[12]=c,t[13]=s,t[14]=u,t[15]=d):d=t[15],d}var SW=Rr(`relative flex aspect-square w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted text-foreground group-data-[orientation=vertical]/attachment:w-full group-data-[size=sm]/attachment:w-8 group-data-[size=xs]/attachment:w-7 group-data-[size=xs]/attachment:rounded-md group-data-[state=error]/attachment:bg-destructive/10 group-data-[state=error]/attachment:text-destructive group-data-[orientation=vertical]/attachment:*:data-[slot=spinner]:size-6! [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 group-data-[orientation=vertical]/attachment:[&_svg:not([class*='size-'])]:size-6 group-data-[size=xs]/attachment:[&_svg:not([class*='size-'])]:size-3.5`,{variants:{variant:{icon:``,image:`opacity-60 group-data-[state=done]/attachment:opacity-100 group-data-[state=idle]/attachment:opacity-100 *:[img]:aspect-square *:[img]:w-full *:[img]:object-cover`}},defaultVariants:{variant:`icon`}});function CW(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`icon`:i,o;t[4]!==n||t[5]!==a?(o=gr(SW({variant:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o||t[9]!==a?(s=(0,Z.jsx)(`div`,{"data-slot":`attachment-media`,"data-variant":a,className:o,...r}),t[7]=r,t[8]=o,t[9]=a,t[10]=s):s=t[10],s}function wW(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`max-w-full min-w-0 flex-1 leading-tight group-data-[orientation=vertical]/attachment:px-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`attachment-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function TW(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`block max-w-full min-w-0 truncate font-medium group-data-[state=processing]/attachment:shimmer group-data-[state=uploading]/attachment:shimmer`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`span`,{"data-slot":`attachment-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function EW(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`mt-0.5 block min-w-0 truncate text-xs text-muted-foreground group-data-[state=error]/attachment:text-destructive/80`,`max-w-full`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`span`,{"data-slot":`attachment-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function DW(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`relative z-20 flex shrink-0 items-center group-data-[orientation=vertical]/attachment:absolute group-data-[orientation=vertical]/attachment:top-3 group-data-[orientation=vertical]/attachment:right-3 group-data-[orientation=vertical]/attachment:gap-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`attachment-actions`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function OW(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,variant:a,size:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`icon-xs`:i,s=a??`ghost`,c;t[5]===n?c=t[6]:(c=gr(n),t[5]=n,t[6]=c);let l;return t[7]!==r||t[8]!==o||t[9]!==s||t[10]!==c?(l=(0,Z.jsx)(X,{"data-slot":`attachment-action`,variant:s,size:o,className:c,...r}),t[7]=r,t[8]=o,t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function kW(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`flex min-w-0 scroll-fade-x snap-x snap-mandatory scroll-px-1 scrollbar-none gap-3 overflow-x-auto overscroll-x-contain py-1 *:data-[slot=attachment]:flex-none *:data-[slot=attachment]:snap-start`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`attachment-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var AW=[{value:`too-slow`,label:{id:`YJPN3F`}},{value:`hard-to-use`,label:{id:`MDBJwN`}},{value:`missing-feature`,label:{id:`anmUZq`}},{value:`something-broke`,label:{id:`dXCi3J`}},{value:`formatting`,label:{id:`RcrskJ`}},{value:`other`,label:{id:`_IX_7x`}}],jW=3,MW=3*1024*1024,NW=[`image/png`,`image/jpeg`,`image/webp`],PW=`data-[state=on]:border-primary data-[state=on]:bg-primary/5 data-[state=on]:text-primary`,FW=`rounded-full border border-input bg-transparent px-3 ${PW}`;function IW(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function LW(e,t){let n=new Set(e.map(e=>`${e.name}:${e.size}`)),r=Array.from(t??[]).filter(e=>NW.includes(e.type)&&!n.has(`${e.name}:${e.size}`));return[...e,...r].slice(0,jW)}var RW=e=>{let t=(0,$.c)(5),{file:n}=e,[r,i]=(0,Q.useState)(null),a,o;t[0]===n?(a=t[1],o=t[2]):(a=()=>{let e=URL.createObjectURL(n);return i(e),()=>URL.revokeObjectURL(e)},o=[n],t[0]=n,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o);let s;return t[3]===r?s=t[4]:(s=r?(0,Z.jsx)(`img`,{src:r,alt:``,className:`size-full object-cover`}):null,t[3]=r,t[4]=s),s},zW=e=>{let t=(0,$.c)(58),{onSuccess:n,source:r,compact:i,title:a,onDismiss:o,className:s}=e,c=r===void 0?`resources_menu`:r,{_:l}=Bn(),u=(0,Q.useRef)(null),d,f;if(t[0]!==l){let e=io({rating:oc([`positive`,`negative`],{error:l({id:`H-hzll`})}),reasons:Ss(Ms()),message:Ms(),attachments:Ss(Io(File)).max(jW,l({id:`E9gh86`,values:{MAX_ATTACHMENTS:jW}})).refine(VW,l({id:`s7us1p`})).refine(UW,l({id:`ItxGi3`})),shareEmail:vs(),email:Ms()}).refine(WW,{path:[`email`],message:l({id:`fwrPh4`})});f=O_,d=QV(e),t[0]=l,t[1]=d,t[2]=f}else d=t[1],f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=[],t[3]=p):p=t[3];let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m={rating:void 0,reasons:p,message:``,attachments:[],shareEmail:!1,email:``},t[4]=m):m=t[4];let h;t[5]===d?h=t[6]:(h={resolver:d,defaultValues:m},t[5]=d,t[6]=h);let g=f(h),_;t[7]===g.control?_=t[8]:(_={control:g.control,name:`rating`},t[7]=g.control,t[8]=_);let v=j_(_),y=!i||v!=null,b;t[9]===g.control?b=t[10]:(b={control:g.control,name:`shareEmail`},t[9]=g.control,t[10]=b);let x=j_(b),S;t[11]===g.control?S=t[12]:(S={control:g.control,name:`attachments`},t[11]=g.control,t[12]=S);let C=j_(S),w=C.length>=jW,T=g.formState.errors.attachments,E;t[13]===g?E=t[14]:(E=e=>g.setValue(`attachments`,e,{shouldValidate:!0}),t[13]=g,t[14]=E);let D=E,O;t[15]!==l||t[16]!==g||t[17]!==n||t[18]!==c?(O=async e=>{try{let t=e.attachments.length?await Promise.all(e.attachments.map(_W)):void 0,r=await yW({kind:`general`,rating:e.rating,reasons:e.reasons,message:e.message.trim()||void 0,email:e.shareEmail&&e.email?e.email:void 0,attachments:t,source:c});if(r.ok){Dc.success(l({id:`LvdLef`})),g.reset(),n?.();return}if(r.reason===`unavailable`){Dc.error(l({id:`D8JJwQ`}));return}Dc.error(l({id:`D2emTw`}))}catch(e){let t=e;console.warn(`[feedback] action=submit result=unexpected-error message=${t instanceof Error?t.message:String(t)}`),Dc.error(l({id:`D2emTw`}))}},t[15]=l,t[16]=g,t[17]=n,t[18]=c,t[19]=O):O=t[19];let k=O,A;t[20]!==g||t[21]!==k?(A=g.handleSubmit(k),t[20]=g,t[21]=k,t[22]=A):A=t[22];let j=i?`space-y-3`:`space-y-5`,M;t[23]!==s||t[24]!==j?(M=gr(j,s),t[23]=s,t[24]=j,t[25]=M):M=t[25];let N;t[26]!==l||t[27]!==o||t[28]!==a?(N=(a||o)&&(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[a?(0,Z.jsx)(`p`,{className:`font-medium text-1sm`,children:a}):(0,Z.jsx)(`span`,{}),o?(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon`,onClick:o,"aria-label":l({id:`yz7wBu`}),className:`-mr-1.5 -mt-1 size-7 shrink-0 text-muted-foreground opacity-60`,children:(0,Z.jsx)(zp,{className:`size-4`})}):null]}),t[26]=l,t[27]=o,t[28]=a,t[29]=N):N=t[29];let P;t[30]!==l||t[31]!==i||t[32]!==g?(P=e=>{let{field:t}=e;return(0,Z.jsxs)(T_,{children:[(0,Z.jsx)(M_,{children:(0,Z.jsxs)(Ba,{type:`single`,variant:`outline`,spacing:2,"aria-label":l({id:`rg7hNd`}),value:t.value??``,onValueChange:e=>{e&&(t.onChange(e),e===`positive`&&g.setValue(`reasons`,[]))},className:`w-full`,children:[(0,Z.jsxs)(Ra,{value:`positive`,className:gr(`h-auto flex-1 justify-center py-2`,i?`gap-1.5 text-xs`:`gap-2`,PW),children:[(0,Z.jsx)(Lb,{className:`size-4`}),(0,Z.jsx)(Y,{id:`OEEQKT`})]}),(0,Z.jsxs)(Ra,{value:`negative`,className:gr(`h-auto flex-1 justify-center py-2`,i?`gap-1.5 text-xs`:`gap-2`,PW),children:[(0,Z.jsx)(Ib,{className:`size-4`}),(0,Z.jsx)(Y,{id:`U0QBh4`})]})]})}),(0,Z.jsx)(P_,{})]})},t[30]=l,t[31]=i,t[32]=g,t[33]=P):P=t[33];let F;t[34]!==g.control||t[35]!==P?(F=(0,Z.jsx)(k_,{control:g.control,name:`rating`,render:P}),t[34]=g.control,t[35]=P,t[36]=F):F=t[36];let I;t[37]!==l||t[38]!==w||t[39]!==C||t[40]!==T||t[41]!==i||t[42]!==g.control||t[43]!==g.formState.isSubmitting||t[44]!==v||t[45]!==D||t[46]!==x||t[47]!==y?(I=y&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[v===`negative`&&(0,Z.jsx)(k_,{control:g.control,name:`reasons`,render:e=>{let{field:t}=e;return(0,Z.jsxs)(T_,{children:[(0,Z.jsx)(N_,{children:(0,Z.jsx)(Y,{id:`Fqx38P`})}),(0,Z.jsx)(M_,{children:(0,Z.jsx)(Ba,{type:`multiple`,variant:`outline`,spacing:2,value:t.value,onValueChange:t.onChange,className:`w-full flex-wrap justify-start`,children:AW.map(e=>(0,Z.jsx)(Ra,{value:e.value,className:FW,children:l(e.label)},e.value))})})]})}}),(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(k_,{control:g.control,name:`message`,render:e=>{let{field:t}=e;return(0,Z.jsx)(T_,{children:(0,Z.jsx)(M_,{children:(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(Ng,{...t,placeholder:l({id:`QlAG4m`}),className:gr(`resize-none pb-9`,i?`min-h-16`:`min-h-20`)}),(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(`span`,{className:gr(`absolute bottom-1.5 left-1.5 inline-flex`,w&&`cursor-not-allowed`),children:(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`icon`,disabled:w,onClick:()=>u.current?.click(),className:`size-7 text-muted-foreground`,children:[(0,Z.jsx)(Np,{className:`size-4`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`3LbBJn`})})]})})}),(0,Z.jsx)(Vr,{children:w?(0,Z.jsx)(Y,{id:`ASqqsQ`,values:{MAX_ATTACHMENTS:jW}}):(0,Z.jsx)(Y,{id:`3LbBJn`})})]}),(0,Z.jsx)(dh,{ref:u,type:`file`,accept:NW.join(`,`),multiple:!0,className:`hidden`,onChange:e=>{D(LW(C,e.target.files)),e.target.value=``}})]})})})}}),C.length>0&&(0,Z.jsx)(kW,{children:C.map((e,t)=>(0,Z.jsxs)(xW,{size:`xs`,children:[(0,Z.jsx)(CW,{variant:`image`,children:(0,Z.jsx)(RW,{file:e})}),(0,Z.jsxs)(wW,{children:[(0,Z.jsx)(TW,{children:e.name}),(0,Z.jsx)(EW,{children:IW(e.size)})]}),(0,Z.jsx)(DW,{children:(0,Z.jsx)(OW,{type:`button`,"aria-label":l({id:`w61W3L`,values:{0:e.name}}),onClick:()=>D(C.filter((e,n)=>n!==t)),children:(0,Z.jsx)(zp,{className:`size-3.5`})})})]},`${e.name}:${e.size}`))}),T?.message&&(0,Z.jsx)(`p`,{className:`text-destructive text-sm`,children:T.message})]})]}),(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(k_,{control:g.control,name:`shareEmail`,render:GW}),x&&(0,Z.jsx)(k_,{control:g.control,name:`email`,render:e=>{let{field:t}=e;return(0,Z.jsxs)(T_,{children:[(0,Z.jsx)(M_,{children:(0,Z.jsx)(dh,{...t,type:`email`,placeholder:l({id:`JHf6qZ`})})}),(0,Z.jsx)(P_,{})]})}})]}),(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(X,{type:`submit`,size:i?`sm`:`default`,disabled:g.formState.isSubmitting,children:g.formState.isSubmitting?(0,Z.jsx)(Y,{id:`9bG48P`}):(0,Z.jsx)(Y,{id:`JlFcis`})})})]}),t[37]=l,t[38]=w,t[39]=C,t[40]=T,t[41]=i,t[42]=g.control,t[43]=g.formState.isSubmitting,t[44]=v,t[45]=D,t[46]=x,t[47]=y,t[48]=I):I=t[48];let L;t[49]!==A||t[50]!==M||t[51]!==N||t[52]!==F||t[53]!==I?(L=(0,Z.jsxs)(`form`,{onSubmit:A,className:M,children:[N,F,I]}),t[49]=A,t[50]=M,t[51]=N,t[52]=F,t[53]=I,t[54]=L):L=t[54];let R;return t[55]!==g||t[56]!==L?(R=(0,Z.jsx)(F_,{...g,children:L}),t[55]=g,t[56]=L,t[57]=R):R=t[57],R};function BW(e){return NW.includes(e.type)}function VW(e){return e.every(BW)}function HW(e,t){return e+t.size}function UW(e){return e.reduce(HW,0)<=MW}function WW(e){return!e.shareEmail||Cs().safeParse(e.email).success}function GW(e){let{field:t}=e;return(0,Z.jsxs)(T_,{className:`flex flex-row items-center gap-2 space-y-0`,children:[(0,Z.jsx)(M_,{children:(0,Z.jsx)(zi,{checked:t.value,onCheckedChange:e=>t.onChange(e===!0)})}),(0,Z.jsx)(N_,{className:`font-normal`,children:(0,Z.jsx)(Y,{id:`SF9qpO`})})]})}function KW(e){let t=(0,$.c)(10),{onClose:n}=e,{_:r}=Bn(),i;t[0]===r?i=t[1]:(i=r({id:`u5hSeG`}),t[0]=r,t[1]=i);let a;t[2]===r?a=t[3]:(a=r({id:`s0-xF4`}),t[2]=r,t[3]=a);let o;t[4]!==n||t[5]!==a?(o=(0,Z.jsx)(gf,{children:(0,Z.jsx)(zW,{compact:!0,source:MU,title:a,onDismiss:n,onSuccess:n})}),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==i||t[8]!==o?(s=(0,Z.jsx)(rf,{asChild:!0,size:`sm`,className:`mx-1 mb-1`,children:(0,Z.jsx)(`section`,{"aria-label":i,children:o})}),t[7]=i,t[8]=o,t[9]=s):s=t[9],s}function qW(){let e=(0,$.c)(5),t=Id(),n=(0,Q.useSyncExternalStore)(Fj.subscribe,Fj.getSnapshot,Fj.getSnapshot),r=(0,Q.useSyncExternalStore)(pW,fW,fW),i=n.initialized&&!n.dismissed&&!n.completed||r.length>0,a=t?.pages??null,o=t!=null&&!t.loading,s;if(e[0]!==i||e[1]!==a||e[2]!==o?(s={pages:a,ready:o,blocked:i},e[0]=i,e[1]=a,e[2]=o,e[3]=s):s=e[3],!FU(s))return null;let c;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(KW,{onClose:JW}),e[4]=c):c=e[4],c}function JW(){return fH.dismiss()}var YW=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
8
+ `),l=[EF];e.textContent.length===0&&l.push(OF),s&&l.push(DF);let u={class:l.join(` `),[MF]:c},d=sE(o);d.length>0&&(u[NF]=`1`,n.set(a,d)),r.push(fo.node(a,a+e.nodeSize,u))}),{set:ls.create(e,r),fixesByOffset:n}}function FF(e,t){let n=document.createElement(`div`);n.className=`ok-lint-tooltip`,n.hidden=!0;let r=document.createElement(`div`);r.className=`ok-lint-tooltip-message`,n.appendChild(r);let i=document.createElement(`button`);i.type=`button`,i.className=gr(`ok-lint-tooltip-fix`,Lr({variant:`default`,size:`xs`}),`mt-1 self-start`),i.hidden=!0,n.appendChild(i),n.style.position=`fixed`,n.style.top=`0`,n.style.left=`0`,document.body.appendChild(n);let a=null,o=!1,s=null,c=null,l=0,u=0,d=0,f={getBoundingClientRect:()=>({width:0,height:d-u,x:l,y:u,top:u,left:l,right:l,bottom:d})};function p(){s!==null&&(clearTimeout(s),s=null)}function m(){p(),a=null,n.hidden=!0,c?.(),c=null}function h(){o||(p(),s=setTimeout(m,140))}let g=Ei(t.editor),_=Ii(t.editor),v=Ri(t.editor,{authorMaxWidth:wF});function y(){Hi(f,n,{placement:`top-start`,middleware:[Ui(CF),Bi(g),Yi(_),Vi(v)]}).then(({x:e,y:t})=>{n.isConnected&&(n.style.left=`${e}px`,n.style.top=`${t}px`)}).catch(e=>{n.isConnected&&console.warn(`[markdown-lint] tooltip computePosition failed`,e)})}function b(e){let s=e.getAttribute(MF);if(!s){h();return}p(),a=e,r.textContent=s;let l=t.applyFix?t.getFixes(e):[];l.length>0&&t.applyFix?(i.hidden=!1,i.textContent=Hc._({id:`c4fVUV`}),i.onclick=()=>{t.applyFix?.(l),o=!1,m()}):(i.hidden=!0,i.onclick=null),n.hidden=!1,c?.(),c=Ki(f,n,y)}function x(t){let n=t,r=t.target?.closest(`.${EF}`)??null;if(r)if(r!==a){l=n.clientX;let t=e.posAtCoords({left:n.clientX,top:n.clientY}),i=t?e.coordsAtPos(t.pos):null,a=i&&i.bottom>i.top?i:r.getBoundingClientRect();u=a.top,d=a.bottom,b(r)}else p();else a&&h()}function S(e){let t=e.relatedTarget;if(t===n||t?.closest(`.ok-lint-tooltip`)){p();return}t?.closest(`.${EF}`)||h()}function C(){o=!0,p()}function w(e){o=!1;let t=e.relatedTarget;t!==a&&!t?.closest(`.${EF}`)&&h()}function T(){o=!1,m()}return n.addEventListener(`pointerenter`,C),n.addEventListener(`pointerleave`,w),e.dom.addEventListener(`pointerover`,x),e.dom.addEventListener(`pointerout`,S),e.dom.addEventListener(`keydown`,T),{destroy(){p(),c?.(),e.dom.removeEventListener(`pointerover`,x),e.dom.removeEventListener(`pointerout`,S),e.dom.removeEventListener(`keydown`,T),n.remove()}}}var IF=Rs.create({name:`markdownLintDecorations`,addOptions(){return{docName:``,getSource:void 0,applyFix:void 0}},addProseMirrorPlugins(){let{docName:e,getSource:t,applyFix:n}=this.options,{editor:r}=this,i=new Ds({extensions:fs});return[new Do({key:TF,state:{init:()=>ls.empty,apply(e,t){return e.getMeta(TF)||t.map(e.mapping,e.doc)}},props:{decorations(e){return TF.getState(e)??null}},view(a){let o=null,s=null,c=!1,l=0,u=new Map;async function d(){if(c)return;let n=t?.()??null,r=o?.enabled?await f(o):{kind:`ok`,set:ls.empty,fixesByOffset:new Map};if(c||r.kind===`stale`)return;if(r.kind===`mismatch`){l<2&&(l+=1,p());return}l=0,u=r.fixesByOffset;let i=r.set,s=TF.getState(a.state)??ls.empty;if((i.find().length>0||s.find().length>0)&&a.dispatch(a.state.tr.setMeta(TF,i)),o?.enabled){let t=Qu(e);t?.kind===`lint`&&_(t.detail)&&nd(e)}n!==null&&!c&&t?.()!==n&&p()}async function f(n){let r=a.state.doc,o=t?.()??i.serialize(r.toJSON()),s=await $s(o,n,e);if(!a.state.doc.eq(r))return{kind:`stale`};let{spans:c}=od(o,i);return c.length===id(r)?{kind:`ok`,...PF(r,jF(o,s,i))}:{kind:`mismatch`}}function p(){s&&clearTimeout(s),s=setTimeout(()=>{d().catch(e=>{console.warn(`[markdown-lint] decoration pass failed`,e)})},kF)}let m=0;async function h(){let t=++m,n=await rg(e);c||t!==m||(o=n,await d())}let g=()=>{h().catch(e=>{console.warn(`[markdown-lint] config load/lint pass failed`,e)})};function _(n){if(!a.dom.isConnected||a.dom.offsetParent===null||Js(n))return!1;let{spans:r,fmLineCount:o}=od(t?.()??i.serialize(a.state.doc.toJSON()),i);if(r.length!==id(a.state.doc)||o>0&&n.line<=o)return!1;let s=ad(r,n.line);if(s===null)return!1;let c=-1;return a.state.doc.forEach((e,t,n)=>{n===s&&(c=t)}),c<0?!1:re(e,`problems-row`,()=>{a.dispatch(a.state.tr.setSelection(ys.near(a.state.doc.resolve(c+1)))),a.focus();let e=a.nodeDOM(c);e instanceof HTMLElement&&e.scrollIntoView({behavior:`smooth`,block:`start`})})}function v(t){let n=t.detail;!n||n.docName!==e||c||_(n)&&nd(e)}g();let y=ng(g),b=FF(a,{getFixes:e=>{if(e.getAttribute(NF)!==`1`||u.size===0)return[];let t;try{t=a.posAtDOM(e,0)}catch(e){return console.warn(`[markdown-lint] posAtDOM failed on lint block; Fix button suppressed`,e),[]}let n=Math.min(Math.max(t,0),a.state.doc.content.size),r=a.state.doc.resolve(n),i=r.depth>=1?r.before(1):0;return u.get(i)??[]},applyFix:n,editor:r});window.addEventListener(md,v);let x=()=>{c||p()};return window.addEventListener(iE,x),{update(e,t){e.state.doc!==t.doc&&p()},destroy(){c=!0,s&&clearTimeout(s),y(),b.destroy(),window.removeEventListener(md,v),window.removeEventListener(iE,x)}}}})]}}),LF=1400,RF=new Lo(`okAgentInsertFlash`);function zF(e,t){let n=e.content.findDiffStart(t.content);if(n==null)return null;let r=e.content.findDiffEnd(t.content),i=t.content.size,a=Math.max(0,Math.min(n,i)),o=Math.max(a,Math.min(r?.b??i,i));return o<=a?null:{from:a,to:o}}var BF=6e3;function VF(){return new Do({key:RF,state:{init:()=>ls.empty,apply(e,t){let n=t.map(e.mapping,e.doc),r=e.getMeta(RF);if(r===void 0)return n;if(r.sweep===!0){let e=n.find().filter(e=>r.now-(e.spec.addedAt??0)>=LF);e.length>0&&(n=n.remove(e))}if(r.add!==void 0&&r.add.to>r.add.from){let t={addedAt:r.now};n=n.add(e.doc,[fo.inline(r.add.from,r.add.to,{class:`ok-agent-insert-flash`},t)])}return n}},props:{decorations(e){return RF.getState(e)}}})}function HF(e,t,n){if(t<0||t>e.content.size)return null;let r=Ns(e.resolve(t));return r?n===`row`?Os.rowSelection(r):Os.colSelection(r):null}function UF(e){if(!(e instanceof Os))return null;let t=e.$anchorCell.node(-1);if(!t)return null;let n=e.$anchorCell.start(-1),r=Ys.get(t),i=r.rectBetween(e.$anchorCell.pos-n,e.$headCell.pos-n),a=r.map[i.top*r.width+i.left];return a===void 0?null:n+a}function WF(e,t,n){let{view:r,state:i}=e,a;try{a=r.posAtDOM(t,0)}catch(e){console.warn(`[TableCellHandles] posAtDOM failed on handle anchor; axis not selected`,e);return}let o=HF(i.doc,a,n);o&&r.dispatch(i.tr.setSelection(o))}var GF=5,KF=1;function qF(e){let t=(0,$.c)(14),{editor:n,axis:r,anchor:i,onClickGesture:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(null),c=(0,Q.useRef)(a),l,u;t[0]===a?(l=t[1],u=t[2]):(l=()=>{c.current=a},u=[a],t[0]=a,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u);let d,f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>()=>{s.current?.abort(),s.current=null,o.current=null,document.body.style.cursor=``,document.body.style.userSelect=``},f=[],t[3]=d,t[4]=f):(d=t[3],f=t[4]),(0,Q.useEffect)(d,f);let[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>!(e&&o.current!==null),t[5]=_):_=t[5];let v=_,y;t[6]!==i||t[7]!==r||t[8]!==n?(y=e=>{if(e.button!==0)return;s.current?.abort(),o.current={startX:e.clientX,startY:e.clientY,isDragging:!1,lastTarget:null};let t=new AbortController;s.current=t;let{signal:a}=t,l=e=>{let t=o.current;if(!t)return;if(!t.isDragging){let n=e.clientX-t.startX,r=e.clientY-t.startY;if(Math.hypot(n,r)<GF)return;t.isDragging=!0,m(!0),document.body.style.cursor=`grabbing`,document.body.style.userSelect=`none`}let n=JF(i,r,e.clientX,e.clientY);t.lastTarget=n,g(n)},u=()=>{t.abort(),s.current===t&&(s.current=null),document.body.style.cursor=``,document.body.style.userSelect=``;let e=o.current;o.current=null,m(!1),g(null),e&&(e.isDragging&&e.lastTarget?QF(n,i,r,e.lastTarget.index):e.isDragging||c.current())};document.addEventListener(`pointermove`,l,{signal:a}),document.addEventListener(`pointerup`,u,{signal:a}),document.addEventListener(`pointercancel`,u,{signal:a})},t[6]=i,t[7]=r,t[8]=n,t[9]=y):y=t[9];let b=y,x;return t[10]!==h||t[11]!==p||t[12]!==b?(x={onPointerDown:b,shouldAllowOpen:v,isDragging:p,indicator:h},t[10]=h,t[11]=p,t[12]=b,t[13]=x):x=t[13],x}function JF(e,t,n,r){let i=e.closest(`table`);if(!i)return null;let a=i.getBoundingClientRect();if(t===`row`){let e=Array.from(i.rows);if(e.length===0)return null;for(let t=0;t<e.length;t++){let n=e[t].getBoundingClientRect();if(r<n.top)return{index:KF,rect:XF(a,YF(e,0,n.top))};if(r<=n.bottom){let i=r>=n.top+n.height/2,o=i?t+1:t,s=Math.max(KF,o);return{index:s,rect:XF(a,s===o?i?n.bottom:n.top:YF(e,0,n.top))}}}let t=e[e.length-1].getBoundingClientRect();return{index:e.length,rect:XF(a,t.bottom)}}let o=i.rows[0];if(!o)return null;let s=Array.from(o.cells);if(s.length===0)return null;for(let e=0;e<s.length;e++){let t=s[e].getBoundingClientRect();if(n<t.left)return{index:0,rect:ZF(a,t.left)};if(n<=t.right){let r=n>=t.left+t.width/2,i=r?t.right:t.left;return{index:r?e+1:e,rect:ZF(a,i)}}}let c=s[s.length-1].getBoundingClientRect();return{index:s.length,rect:ZF(a,c.right)}}function YF(e,t,n){let r=e[t];return r?r.getBoundingClientRect().bottom:n}function XF(e,t){return{left:e.left,top:t-1,width:e.width,height:2}}function ZF(e,t){return{left:t-1,top:e.top,width:2,height:e.height}}function QF(e,t,n,r){let i=n===`row`?$F(t):t.cellIndex;if(i<0||n===`row`&&(i<KF||r<KF)||r===i||r===i+1)return;let{state:a,view:o}=e,s=eI(a.selection.$from);if(s<0){console.warn(`[table-drag-reorder] no table found at selection depth`);return}let c=a.doc.nodeAt(s);if(!c){console.warn(`[table-drag-reorder] nodeAt returned null at tablePos`,s);return}let l=a.tr;rI(l,s,c,n===`row`?tI(c,i,r):nI(c,i,r)),o.dispatch(l)}function $F(e){let t=e.parentElement,n=t?.closest(`table`);return n?Array.prototype.indexOf.call(n.rows,t):-1}function eI(e){for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole===`table`)return e.before(t);return-1}function tI(e,t,n){let r=[];e.forEach(e=>{r.push(e)});let[i]=r.splice(t,1),a=n>t?n-1:n;return r.splice(a,0,i),e.type.create(e.attrs,r,e.marks)}function nI(e,t,n){let r=n>t?n-1:n,i=[];return e.forEach(e=>{let n=[];e.forEach(e=>{n.push(e)});let[a]=n.splice(t,1);n.splice(r,0,a),i.push(e.type.create(e.attrs,n,e.marks))}),e.type.create(e.attrs,i,e.marks)}function rI(e,t,n,r){e.replaceRangeWith(t,t+n.nodeSize,r)}function iI(e){return[...e?[{id:`toggle-header-column`,label:{id:`JddocZ`},icon:Iy,run:e=>e.chain().focus().toggleHeaderColumn().run()}]:[],{id:`insert-column-left`,label:{id:`ZJ99sD`},icon:Au,run:e=>e.chain().focus().addColumnBefore().run()},{id:`insert-column-right`,label:{id:`9EykGQ`},icon:Du,run:e=>e.chain().focus().addColumnAfter().run()},{id:`delete-column`,label:{id:`GAohqx`},icon:Ip,separatorBefore:!0,run:e=>e.chain().focus().deleteColumn().run()},{id:`delete-table`,label:{id:`HSI88F`},icon:Zy,run:e=>e.chain().focus().deleteTable().run()}]}function aI(e){return[...e?[{id:`toggle-header-row`,label:{id:`61i3cO`},icon:kb,run:e=>e.chain().focus().toggleHeaderRow().run()}]:[],{id:`insert-row-above`,label:{id:`JrqL_z`},icon:Tu,run:e=>e.chain().focus().addRowBefore().run()},{id:`insert-row-below`,label:{id:`CUmCwI`},icon:Eu,run:e=>e.chain().focus().addRowAfter().run()},{id:`delete-row`,label:{id:`0cspe_`},icon:Ip,separatorBefore:!0,run:e=>e.chain().focus().deleteRow().run()},{id:`delete-table`,label:{id:`HSI88F`},icon:Zy,run:e=>e.chain().focus().deleteTable().run()}]}function oI(e){if(!e.isEditable||E(e.state).query)return null;let{state:t,view:n}=e,r=UF(t.selection)??-1;if(r<0){let e=t.selection.$from;for(let t=e.depth;t>0;t--){let n=e.node(t).type.spec.tableRole;if(n===`cell`||n===`header_cell`){r=e.before(t);break}}}if(r<0)return null;let i=n.nodeDOM(r);if(!(i instanceof HTMLTableCellElement))return null;let a=i.closest(`table`),o=i.closest(`tr`),s=i.closest(`.ProseMirror`);if(!a||!o||!s)return null;let c=Array.prototype.indexOf.call(a.rows,o),l=i.cellIndex,u=a.rows[0]?.cells[l],d=a.rows[c]?.cells[0];return!u||!d?null:{columnAnchor:u,rowAnchor:d,isFirstColumn:l===0,isFirstRow:c===0}}function sI(e){let t=(0,$.c)(46),{editor:n,anchor:r,axis:i,items:a}=e,o=(0,Q.useRef)(null),{_:s}=Bn(),[c,l]=(0,Q.useState)(!1),u;t[0]!==r||t[1]!==i||t[2]!==n?(u=()=>{WF(n,r,i),l(!0)},t[0]=r,t[1]=i,t[2]=n,t[3]=u):u=t[3];let d;t[4]!==r||t[5]!==i||t[6]!==n||t[7]!==u?(d={editor:n,axis:i,anchor:r,onClickGesture:u},t[4]=r,t[5]=i,t[6]=n,t[7]=u,t[8]=d):d=t[8];let f=qF(d),p,m;t[9]!==r||t[10]!==i?(p=()=>{let e=o.current;if(!e)return;let t=i===`column`?`top`:`left`,n=i===`column`?-14:-6;return Ki(r,e,()=>{Hi(r,e,{strategy:`absolute`,placement:t,middleware:[Ui(n)]}).then(t=>{let{x:n,y:r}=t;e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.opacity=`1`}).catch(cI)})},m=[r,i],t[9]=r,t[10]=i,t[11]=p,t[12]=m):(p=t[11],m=t[12]),(0,Q.useEffect)(p,m);let h=i===`column`?Vy:vr,g;t[13]===f?g=t[14]:(g=e=>{f.shouldAllowOpen(e)&&l(e)},t[13]=f,t[14]=g);let _=i===`column`?`h-3 w-7 rounded-full p-0 text-gray-700 dark:text-muted-foreground bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 hover:text-foreground dark:hover:bg-gray-600 dark:hover:text-gray-100 relative cursor-grab before:absolute before:-inset-[6px] before:content-[""]`:`h-7 w-3 rounded-full p-0 text-gray-700 dark:text-muted-foreground bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 hover:text-foreground dark:hover:bg-gray-600 dark:hover:text-gray-100 relative cursor-grab before:absolute before:-inset-[6px] before:content-[""]`,v;t[15]!==s||t[16]!==i?(v=s(i===`column`?{id:`DNkveC`}:{id:`Kge76t`}),t[15]=s,t[16]=i,t[17]=v):v=t[17];let y;t[18]===h?y=t[19]:(y=(0,Z.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),t[18]=h,t[19]=y);let b;t[20]!==f.onPointerDown||t[21]!==_||t[22]!==v||t[23]!==y?(b=(0,Z.jsx)(fa,{asChild:!0,children:(0,Z.jsx)(X,{variant:`secondary`,onPointerDown:f.onPointerDown,className:_,"aria-label":v,children:y})}),t[20]=f.onPointerDown,t[21]=_,t[22]=v,t[23]=y,t[24]=b):b=t[24];let x=i===`column`?`center`:`start`,S=i===`column`?`bottom`:`right`,C;if(t[25]!==s||t[26]!==n||t[27]!==a){let e;t[29]!==s||t[30]!==n?(e=e=>(0,Z.jsxs)(Q.Fragment,{children:[e.separatorBefore&&(0,Z.jsx)(ya,{}),(0,Z.jsxs)(ca,{onSelect:()=>e.run(n),children:[(0,Z.jsx)(e.icon,{"aria-hidden":!0}),s(e.label)]})]},e.id),t[29]=s,t[30]=n,t[31]=e):e=t[31],C=a.map(e),t[25]=s,t[26]=n,t[27]=a,t[28]=C}else C=t[28];let w;t[32]!==x||t[33]!==S||t[34]!==C?(w=(0,Z.jsx)(ga,{align:x,side:S,className:`w-auto min-w-44 whitespace-nowrap`,children:C}),t[32]=x,t[33]=S,t[34]=C,t[35]=w):w=t[35];let T;t[36]!==c||t[37]!==w||t[38]!==g||t[39]!==b?(T=(0,Z.jsx)(`div`,{ref:o,"data-testid":`table-cell-handle`,className:`absolute left-0 top-0 z-10 opacity-0`,children:(0,Z.jsxs)(va,{open:c,onOpenChange:g,children:[b,w]})}),t[36]=c,t[37]=w,t[38]=g,t[39]=b,t[40]=T):T=t[40];let E;t[41]===f.indicator?E=t[42]:(E=f.indicator&&(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none fixed z-50 bg-primary`,style:{left:f.indicator.rect.left,top:f.indicator.rect.top,width:f.indicator.rect.width,height:f.indicator.rect.height}}),t[41]=f.indicator,t[42]=E);let D;return t[43]!==T||t[44]!==E?(D=(0,Z.jsxs)(Z.Fragment,{children:[T,E]}),t[43]=T,t[44]=E,t[45]=D):D=t[45],D}function cI(){}function lI(e){let t=(0,$.c)(18),{editor:n}=e,[r,i]=(0,Q.useState)(null),a,o;if(t[0]===n?(a=t[1],o=t[2]):(a=()=>{let e=()=>i(e=>{let t=oI(n);return e&&t&&e.columnAnchor===t.columnAnchor&&e.rowAnchor===t.rowAnchor?e:t});return e(),n.on(`selectionUpdate`,e),n.on(`update`,e),()=>{n.off(`selectionUpdate`,e),n.off(`update`,e)}},o=[n],t[0]=n,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o),!r)return null;let s=r.columnAnchor,c;t[3]===r.isFirstColumn?c=t[4]:(c=iI(r.isFirstColumn),t[3]=r.isFirstColumn,t[4]=c);let l;t[5]!==r.columnAnchor||t[6]!==n||t[7]!==c?(l=(0,Z.jsx)(sI,{editor:n,anchor:s,axis:`column`,items:c}),t[5]=r.columnAnchor,t[6]=n,t[7]=c,t[8]=l):l=t[8];let u=r.rowAnchor,d;t[9]===r.isFirstRow?d=t[10]:(d=aI(r.isFirstRow),t[9]=r.isFirstRow,t[10]=d);let f;t[11]!==r.rowAnchor||t[12]!==n||t[13]!==d?(f=(0,Z.jsx)(sI,{editor:n,anchor:u,axis:`row`,items:d}),t[11]=r.rowAnchor,t[12]=n,t[13]=d,t[14]=f):f=t[14];let p;return t[15]!==l||t[16]!==f?(p=(0,Z.jsxs)(`div`,{className:`ok-table-cell-handle-layer`,children:[l,f]}),t[15]=l,t[16]=f,t[17]=p):p=t[17],p}function uI(e){let{fragment:t,docName:n}=e,r=!1,i=!1,a=!1,o=()=>{r=!0},s=e=>{console.warn(`[walk-currency] ${e} at view init — stale pre-warm cannot be invalidated: a remote edit that landed in the construct→mount gap will not render, and the first local transaction may silently erase it from the CRDT for every peer and disk (vendored y-tiptap contract change? re-verify y-tiptap.cjs:263-268)`)},c=()=>{i&&(i=!1,t.unobserveDeep(o))},l=e=>{let t=Ai.getState(e.state)?.binding;if(!t){am.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-binding`}),s(`no ySync binding on "${n}"`);return}if(typeof t._forceRerender!=`function`){am.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-force-rerender`}),s(`ySync binding on "${n}" exposes no _forceRerender`);return}am.count(`ok/editor/pattern-d-stale-prewarm`,{docName:n}),t._forceRerender()};return Rs.create({name:`walkCurrency`,onBeforeCreate(){t.observeDeep(o),i=!0},onDestroy(){c()},addProseMirrorPlugins(){return[new Do({view:e=>(a||(a=!0,c(),r&&l(e)),{})})]}})}var dI=new WeakMap;function fI(e){let t=document.createElement(`span`);t.classList.add(`collaboration-cursor__caret`),t.style.borderColor=e.color;let n=document.createElement(`div`);return n.classList.add(`collaboration-cursor__label`),n.style.backgroundColor=e.color,n.style.color=mc(e.color),n.textContent=e.name,t.append(n),t}var pI={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null};function mI(e,t){let n=null;for(let[r,i]of e.entries()){let e=i;typeof e?.timestamp!=`number`||e.timestamp<=t||(n===null||e.timestamp>n.entry.timestamp)&&(n={key:`${r}:${e.timestamp}`,entry:e})}return n}var hI=100,gI=100,_I=3,vI=250,yI=600;function bI(e){return`contentComponent`in e&&`isEditorContentInitialized`in e}function xI(e,t){let n=Li(e);if(!n||t.contains(n.dom))return!1;if(!bI(e))return console.warn(`[TiptapEditor] TipTap EditorContent binding fields missing; detached editor repair skipped`),!1;let r=e;if(r.contentComponent==null)return!1;try{n.setProps({nodeViews:{}})}catch{}return r.contentComponent=null,r.isEditorContentInitialized=!1,!0}function SI(){let e=new Ds({extensions:fs});return{mdManager:e,text:Ie({mdManager:e}),html:L({mdManager:e}),paste:D({mdManager:e}),copy:an({mdManager:e}),drop:Ae({mdManager:e})}}function CI(e,t){return t?{collaboration:j.configure({document:e.document,ySyncOptions:{mapping:t}}),guard:[uI({fragment:e.document.getXmlFragment(`default`),docName:e.configuration.name??``})]}:{collaboration:j.configure({document:e.document}),guard:[]}}function wI(e){let{provider:t,placeholder:n,prebuiltMapping:r,onWedged:i}=e,{collaboration:a,guard:o}=CI(t,r);return[...bt.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`||e.name===`jsxInline`||e.name===`imageReference`?e.configure({docName:t.configuration.name??``}):e),aF(t.configuration.name??``),Oa.configure({placeholder:()=>n??Hc._({id:`RS98db`}),showOnlyCurrent:!0}),at.configure({docName:t.configuration.name??``}),a,Rs.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[ae]}}),Rs.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[Mi(e,{cursorBuilder:fI})]}}),Rs.create({name:`bindingStalenessGuard`,addProseMirrorPlugins(){return[wN({fragment:t.document.getXmlFragment(`default`),docName:t.configuration.name??``,onWedged:i??(()=>{})})]}}),...o,SF,IF.configure({docName:t.configuration.name??``,getSource:()=>t.document.getText(`source`).toString(),applyFix:e=>cE(t,e,t.configuration.name??``)})]}function TI(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{dI.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=dI.get(e);if(dI.delete(e),r==null)return;let i=performance.now();am(`ok/editor/create-tiptap`,{docName:t.configuration.name??`unknown`,ytextLength:t.document.getText(`source`).length},{startTime:r,duration:Math.max(0,i-r)})},editorProps:{attributes:{class:`pt-4 pb-4 h-full`},clipboardTextParser:(e,t,r,i)=>{let a=n.mdManager.parse(e);return i.state.schema.nodeFromJSON(a).content},clipboardTextSerializer:(e,t)=>n.text(e,t),clipboardSerializer:n.html.serializer,handlePaste:(e,t)=>n.paste(e,t),handleDrop:n.drop,handleDOMEvents:{copy:(e,t)=>n.copy(e,t,!1),cut:(e,t)=>n.copy(e,t,!0)}},extensions:cN(wI(e))}}function EI(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i,onWedged:a}=e,o=t.document.getXmlFragment(`default`),s=new Map,c=TI({provider:t,placeholder:n,clipboard:r,ctorStart:i,prebuiltMapping:s,onWedged:a}),l=c.onBeforeCreate;return{...c,onBeforeCreate:e=>{l?.(e);let{editor:t}=e,{doc:n,mapping:r}=Fi(o,t.schema);r.forEach((e,t)=>{s.set(t,e)}),t.options.content=n.toJSON()},element:null}}var DI=e=>{let t=(0,$.c)(23),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(pI),c=uN(),{principal:l,activeDocName:u,recycleDocument:d}=Et(),f=n.configuration.name??``,[p]=(0,Q.useState)(SI),m;t[0]!==p||t[1]!==f||t[2]!==r||t[3]!==n||t[4]!==d?(m=()=>()=>({editor:new Xs(EI({provider:n,placeholder:r,clipboard:p,ctorStart:performance.now(),onWedged:e=>{let{externalSeq:t,appliedSeq:n}=e;am(`ok/editor/binding-wedge-recycle`,{docName:f,externalSeq:t,appliedSeq:n}),d(f)}})),ydoc:n.document,ytext:n.document.getText(`source`),provider:n}),t[0]=p,t[1]=f,t[2]=r,t[3]=n,t[4]=d,t[5]=m):m=t[5];let[h]=(0,Q.useState)(m),g,_;if(t[6]!==h||t[7]!==f||t[8]!==n.document){let e={viewCount:0,bytes:n.document.getText(`source`).length},r=tn(f)??xo();g=Q.use,_=xn({docName:f,mountId:r,construct:h,sizeStats:e}),t[6]=h,t[7]=f,t[8]=n.document,t[9]=g,t[10]=_}else g=t[9],_=t[10];let v=g(_),y=v.editor,b,x;t[11]===v?(b=t[12],x=t[13]):(b=()=>()=>{dn(v)},x=[v],t[11]=v,t[12]=b,t[13]=x),(0,Q.useEffect)(b,x);let S;return t[14]!==u||t[15]!==f||t[16]!==y||t[17]!==c||t[18]!==i||t[19]!==a||t[20]!==l||t[21]!==n?(S=(0,Z.jsx)(OI,{provider:n,isSourceMode:i,docName:f,activeDocName:u,identity:c,principal:l,editor:y,wrapperRef:o,flashStateRef:s,portalTarget:a}),t[14]=u,t[15]=f,t[16]=y,t[17]=c,t[18]=i,t[19]=a,t[20]=l,t[21]=n,t[22]=S):S=t[22],S},OI=e=>{let t=(0,$.c)(140),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:c,editor:l,wrapperRef:u,flashStateRef:d,portalTarget:f}=e,p=(0,Q.useRef)(null),[m,h]=(0,Q.useState)(0),g,_;t[0]===f?(g=t[1],_=t[2]):(g=()=>{let e=p.current;if(e)return e.appendChild(f),()=>{f.parentNode===e&&e.removeChild(f)}},_=[f],t[0]=f,t[1]=g,t[2]=_),(0,Q.useLayoutEffect)(g,_);let v,y;t[3]!==l||t[4]!==f?(v=()=>{xI(l,f)&&h(kI)},y=[l,f],t[3]=l,t[4]=f,t[5]=v,t[6]=y):(v=t[5],y=t[6]),(0,Q.useEffect)(v,y);let x;t[7]!==l||t[8]!==n.configuration.name?(x=()=>(Pi(l,n.configuration.name??null),()=>{Pi(l,null)}),t[7]=l,t[8]=n.configuration.name,t[9]=x):x=t[9];let S;t[10]!==l||t[11]!==n?(S=[l,n],t[10]=l,t[11]=n,t[12]=S):S=t[12],(0,Q.useEffect)(x,S);let C;t[13]!==l||t[14]!==n.configuration.name?(C=()=>{let e=n.configuration.name;if(e)return on(e,l),()=>Le(e,l)},t[13]=l,t[14]=n.configuration.name,t[15]=C):C=t[15];let w;t[16]!==l||t[17]!==n?(w=[l,n],t[16]=l,t[17]=n,t[18]=w):w=t[18],(0,Q.useEffect)(C,w);let T;t[19]!==l||t[20]!==r||t[21]!==n.configuration.name||t[22]!==n.document?(T=()=>{if(r)return;let e=n.configuration.name;if(!e||!rd(e))return;let t=!1,i=null,a=()=>{queueMicrotask(()=>{if(t)return;let r=Zu(e);r?.kind===`selection-offset`&&(i=$u({editor:l,docName:e,navigation:r,ydoc:n.document,transition:{from:`source`,to:`wysiwyg`}}))})};return Li(l)?a():l.on(`create`,a),()=>{t=!0,l.off(`create`,a),i?.cancel(`mode-flip`)}},t[19]=l,t[20]=r,t[21]=n.configuration.name,t[22]=n.document,t[23]=T):T=t[23];let E;t[24]!==l||t[25]!==r||t[26]!==n?(E=[l,n,r],t[24]=l,t[25]=r,t[26]=n,t[27]=E):E=t[27],(0,Q.useEffect)(T,E);let D;t[28]!==l||t[29]!==n.configuration.name?(D=()=>{let e=n.configuration.name;if(!e)return;let t=null,r=()=>{t=null,bd(e,`wysiwyg`,cd(l)),Wh(e,`wysiwyg`,Gh(l,e))},i=()=>{t&&clearTimeout(t),t=setTimeout(r,120)};return r(),l.on(`selectionUpdate`,i),l.on(`update`,i),()=>{t&&clearTimeout(t),l.off(`selectionUpdate`,i),l.off(`update`,i),bd(e,`wysiwyg`,null),Wh(e,`wysiwyg`,null)}},t[28]=l,t[29]=n.configuration.name,t[30]=D):D=t[30];let O;t[31]!==l||t[32]!==n?(O=[l,n],t[31]=l,t[32]=n,t[33]=O):O=t[33],(0,Q.useEffect)(D,O);let k;t[34]!==l||t[35]!==n.configuration.name?(k=()=>{},t[34]=l,t[35]=n.configuration.name,t[36]=k):k=t[36];let A;t[37]!==l||t[38]!==n?(A=[l,n],t[37]=l,t[38]=n,t[39]=A):A=t[39],(0,Q.useEffect)(k,A);let j,M;t[40]===l?(j=t[41],M=t[42]):(j=()=>{let e=AI,t=null,n=()=>{if(t||l.isDestroyed)return;let n=Li(l);n&&(t=n.dom,t.addEventListener(`keydown`,e),t.addEventListener(`paste`,e),t.addEventListener(`drop`,e),t.addEventListener(`cut`,e))},r=()=>{t&&=(t.removeEventListener(`keydown`,e),t.removeEventListener(`paste`,e),t.removeEventListener(`drop`,e),t.removeEventListener(`cut`,e),null)};return Li(l)?n():l.on(`create`,n),()=>{l.off(`create`,n),r()}},M=[l],t[40]=l,t[41]=j,t[42]=M),(0,Q.useEffect)(j,M);let N,P;t[43]===l?(N=t[44],P=t[45]):(N=()=>()=>{l.isDestroyed||!Li(l)||l.commands.setMeta(`hideDragHandle`,!0)},P=[l],t[43]=l,t[44]=N,t[45]=P),(0,Q.useEffect)(N,P);let F;t[46]!==l||t[47]!==n.configuration.name?(F=()=>{let e=n.configuration.name;if(!e)return;let t=t=>{let{transaction:n}=t;te(n)&&ge(e)};return l.on(`transaction`,t),()=>{l.off(`transaction`,t)}},t[46]=l,t[47]=n.configuration.name,t[48]=F):F=t[48];let I;t[49]!==l||t[50]!==n?(I=[l,n],t[49]=l,t[50]=n,t[51]=I):I=t[51],(0,Q.useEffect)(F,I);let L,R;t[52]===l?(L=t[53],R=t[54]):(L=()=>{let e=()=>{l.isDestroyed||!Li(l)||Sd()&&l.commands.focus()};return Li(l)?e():l.on(`create`,e),()=>{l.off(`create`,e)}},R=[l],t[52]=l,t[53]=L,t[54]=R),(0,Q.useEffect)(L,R);let z,B;t[55]!==i||t[56]!==l?(z=()=>{let e=!1,t=()=>{if(e||l.isDestroyed||!Li(l))return;e=!0;let t=Ot(i)?.selection??null;if(t)try{let e=l.state.doc.content.size;if(t.type===`text`){let n=Math.max(0,Math.min(t.anchor,e)),r=Math.max(0,Math.min(t.head,e));l.commands.setTextSelection({from:n,to:r})}else{let n=Math.max(0,Math.min(t.from,e));l.commands.setNodeSelection(n)}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(JSON.stringify({event:`ok-editor-selection-restore-failed`,docName:i,message:n})),am(`ok/editor/selection-restore-failed`,{docName:i,message:n})}s(i)};if(Li(l)){t();return}return l.on(`create`,t),()=>{l.off(`create`,t)}},B=[l,i],t[55]=i,t[56]=l,t[57]=z,t[58]=B):(z=t[57],B=t[58]),(0,Q.useEffect)(z,B);let V,ee;t[59]!==d||t[60]!==n.document||t[61]!==u?(V=()=>{let e=n.document.getMap(`agent-flash`),t=Date.now(),r=0,i=null,a=null,o=null,s=()=>{let t=null;for(let[,n]of e.entries()){let e=n;e.timestamp&&(!t||e.timestamp>t.timestamp)&&(t={agentId:e.agentId??`unknown`,timestamp:e.timestamp,type:e.type??`insert`,description:e.description})}return t},c=e=>{d.current=e;let t=u.current;t&&(t.setAttribute(`data-agent-flash-state`,e.state),t.setAttribute(`data-agent-flash-count`,String(e.count)),t.setAttribute(`data-agent-flash-position`,e.position),t.setAttribute(`data-agent-flash-agent-id`,e.lastAgentId??``))},l=()=>{let e=s(),t=e?.description?.toLowerCase().includes(`prepend`)?`prepend`:`append`,n={state:`editing`,count:(d.current?.count??0)+1,lastFiredAt:Date.now(),position:t,lastAgentId:e?.agentId??null};c(n),document.dispatchEvent(new CustomEvent(`agent-flash`,{detail:n})),a&&clearTimeout(a),o&&clearTimeout(o),a=window.setTimeout(()=>{let e={...n,state:`settled`};c(e),document.dispatchEvent(new CustomEvent(`agent-flash-end`,{detail:e})),o=window.setTimeout(()=>{c({...e,state:`idle`})},300)},wo)};c(pI);let f=()=>{if(rc(e),!qs(e,t)||document.visibilityState!==`visible`)return;let n=Date.now();if(t=n,n-r<500){if(!i){let e=500-(n-r);i=window.setTimeout(()=>{i=null,r=Date.now(),l()},e)}return}r=n,l()};e.observe(f);let p=()=>{document.visibilityState===`visible`?qs(e,t)&&(t=Date.now(),r=Date.now(),l()):t=Date.now()};return document.addEventListener(`visibilitychange`,p),()=>{e.unobserve(f),document.removeEventListener(`visibilitychange`,p),i&&clearTimeout(i),a&&clearTimeout(a),o&&clearTimeout(o)}},ee=[n.document,d,u],t[59]=d,t[60]=n.document,t[61]=u,t[62]=V,t[63]=ee):(V=t[62],ee=t[63]),(0,Q.useEffect)(V,ee);let H=(0,Q.useRef)(null),U;t[64]!==a||t[65]!==i||t[66]!==l||t[67]!==n?(U=()=>{let e=VF(),t=n.document.getMap(`agent-flash`),r=null,o=!1;queueMicrotask(()=>{o||l.isDestroyed||l.registerPlugin(e)});let s=[],c=()=>l.editorView??null,u=(e,t,n)=>{if(e.dispatch(e.state.tr.setMeta(RF,{add:{from:t,to:n},now:Date.now()})),r!==null&&clearTimeout(r),r=window.setTimeout(()=>{r=null;let e=c();e?.dispatch(e.state.tr.setMeta(RF,{now:Date.now(),sweep:!0}))},LF+50),!ka()||document.visibilityState!==`visible`||e.hasFocus())return;let a=()=>{let e=c();if(!(e==null||e.hasFocus()||document.visibilityState!==`visible`)&&!Ft(i))try{let r=e.state.doc.content.size,i=Math.max(0,Math.min(Math.floor((t+n)/2),r-1)),a=e.domAtPos(i),o=a.node,s=o.nodeType===Node.TEXT_NODE?o.parentElement:o.childNodes[a.offset]??o,c=s instanceof HTMLElement?s:s?.parentElement??null;if(c==null)return;let l=c.getBoundingClientRect();if(l.top>=0&&l.bottom<=window.innerHeight)return;c.scrollIntoView({block:`center`,behavior:`smooth`})}catch{}};requestAnimationFrame(a),s.push(window.setTimeout(a,250),window.setTimeout(a,550))},d=e=>{let{transaction:n}=e;if(!n.docChanged||n.getMeta(Ai)?.isChangeOrigin!==!0||!qs(t,Date.now()-1400)||i!==a)return;let r=mI(t,Date.now()-LF);if(r!==null&&r.key===H.current)return;let o=zF(n.before,n.doc);if(o===null)return;let s=c();s!=null&&(r!==null&&(H.current=r.key),u(s,o.from,o.to))};l.on(`transaction`,d);let f=()=>{if(o||i!==a)return;let e=c();if(e==null)return;let n=mI(t,Date.now()-BF);if(n===null||n.key===H.current)return;let r=n.entry.changedBlocks;if(r===void 0)return;let s=Xu(e.state.doc,r.from,r.to);s!==null&&(H.current=n.key,u(e,s.from,s.to))},p=requestAnimationFrame(f),m=()=>{requestAnimationFrame(f)};return n.on(`synced`,m),()=>{o=!0,l.off(`transaction`,d),n.off(`synced`,m),cancelAnimationFrame(p),r!==null&&clearTimeout(r);for(let e of s)clearTimeout(e);l.unregisterPlugin(RF)}},t[64]=a,t[65]=i,t[66]=l,t[67]=n,t[68]=U):U=t[68];let W;t[69]!==a||t[70]!==i||t[71]!==l||t[72]!==n.document||t[73]!==n.off||t[74]!==n.on?(W=[l,n.document,i,a,n.on,n.off],t[69]=a,t[70]=i,t[71]=l,t[72]=n.document,t[73]=n.off,t[74]=n.on,t[75]=W):W=t[75],(0,Q.useEffect)(U,W);let G,ne;t[76]!==a||t[77]!==i||t[78]!==l||t[79]!==r||t[80]!==n?(G=()=>{if(r)return;let e=0,t,o=null,s=null,c=null,u=function(){if(e<hI){e+=1,t=window.setTimeout(m,gI);return}o=null,s=null,e=0},d=function(e){let t=Li(l);if(!t)return null;let n=CSS.escape(e);return t.dom.querySelector(`#${n}`)??t.dom.querySelector(`[data-mirror-source-id="${n}"]`)},f=function(e){let t=d(e);return t?re(i,`deep-link`,()=>{t.scrollIntoView({behavior:`smooth`,block:`start`})}):!1},p=function(e,n){let r=_I,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(f(e),--r,r>0&&(t=window.setTimeout(o,vI)))};t=window.setTimeout(o,vI)};function m(){if(!o||i!==a)return;let t=o,n=s;if(!n){u();return}f(t)?(c=n,o=null,s=null,e=0,p(t,n)):u()}let h=function(){if(i!==a)return;let n=window.location.hash;if(!o&&c===n)return;let r=Xp(n);if(!r){c=n;return}o=r,s=n,e=0,t!==void 0&&(clearTimeout(t),t=void 0),m()},g=function(){if(i===a){if(o){m();return}h()}};return h(),n.on(`synced`,g),l.on(`transaction`,g),window.addEventListener(`hashchange`,h),()=>{t!==void 0&&clearTimeout(t),n.off(`synced`,g),l.off(`transaction`,g),window.removeEventListener(`hashchange`,h)}},ne=[n,l,i,a,r],t[76]=a,t[77]=i,t[78]=l,t[79]=r,t[80]=n,t[81]=G,t[82]=ne):(G=t[81],ne=t[82]),(0,Q.useEffect)(G,ne);let K,ie;t[83]!==i||t[84]!==l||t[85]!==r?(K=()=>{if(r)return;let e,t=function(t){let n=t.detail;if(!n||n.docName!==i||n.mode!==`wysiwyg`||l.isDestroyed)return;let r={docName:i,mode:`wysiwyg`,index:n.index},a=Li(l);if(!a){cm(Cd,{...r,outcome:`no-view`});return}let o=ft(a.dom),s=a.dom.querySelectorAll(`h1, h2, h3, h4, h5, h6`),c={...r,scrollTopBefore:o?.scrollTop,domHeadingCount:s.length,slugFoundAt:Array.from(s).findIndex(e=>e.id===n.slug)},u=s[n.index];if(!u){cm(Cd,{...c,outcome:`no-target`});return}let d=()=>o===null||!o.isConnected||!u.isConnected?void 0:Math.round(u.getBoundingClientRect().top-o.getBoundingClientRect().top),f=d(),p=o?.scrollHeight,m=re(i,`outline`,()=>{u.scrollIntoView({behavior:`smooth`,block:`start`})});cm(Cd,{...c,outcome:m?`scrolled`:`declined`,resolvedLevel:Number(u.tagName.slice(1)),targetTopBefore:f,scrollHeightBefore:p}),m&&(clearTimeout(e),e=setTimeout(()=>{cm(fd,{docName:i,mode:`wysiwyg`,index:n.index,scrollTopAfter:o?.isConnected===!0?o.scrollTop:void 0,scrollHeightAfter:o?.isConnected===!0?o.scrollHeight:void 0,targetTopAfter:d(),scrollerDetached:o!==null&&!o.isConnected,targetDetached:!u.isConnected})},yI))};return window.addEventListener(dd,t),()=>{window.removeEventListener(dd,t),clearTimeout(e)}},ie=[l,i,r],t[83]=i,t[84]=l,t[85]=r,t[86]=K,t[87]=ie):(K=t[86],ie=t[87]),(0,Q.useEffect)(K,ie);let q;t[88]!==a||t[89]!==i||t[90]!==o||t[91]!==r||t[92]!==c||t[93]!==n.awareness?(q=()=>{let e=n.awareness;if(!e)return;if(i!==a){e.setLocalState(null);return}e.setLocalState({user:hN({principal:c,identity:o}),mode:r?`source`:`wysiwyg`});let t=mN();return t.start(),t.setAwareness(e),()=>t.clearAwareness(e)},t[88]=a,t[89]=i,t[90]=o,t[91]=r,t[92]=c,t[93]=n.awareness,t[94]=q):q=t[94];let ae;t[95]!==a||t[96]!==i||t[97]!==o||t[98]!==r||t[99]!==c||t[100]!==n?(ae=[n,i,a,o,c,r],t[95]=a,t[96]=i,t[97]=o,t[98]=r,t[99]=c,t[100]=n,t[101]=ae):ae=t[101],(0,Q.useEffect)(q,ae);let oe,se;t[102]!==l||t[103]!==r?(oe=()=>(Ni(l,r),()=>{Ni(l,!1)}),se=[l,r],t[102]=l,t[103]=r,t[104]=oe,t[105]=se):(oe=t[104],se=t[105]),(0,Q.useEffect)(oe,se);let le;t[106]!==a||t[107]!==i||t[108]!==l||t[109]!==r?(le=!r&&(0,Z.jsx)(qP,{editor:l,shortcutEnabled:i===a}),t[106]=a,t[107]=i,t[108]=l,t[109]=r,t[110]=le):le=t[110];let ue;t[111]!==a||t[112]!==i||t[113]!==l||t[114]!==r?(ue=!r&&(0,Z.jsxs)(UM,{children:[(0,Z.jsx)(HM,{editor:l,docName:i,shortcutEnabled:i===a}),(0,Z.jsx)(OM,{editor:l,docName:i}),i===a&&(0,Z.jsx)(zM,{editor:l,docName:i})]}),t[111]=a,t[112]=i,t[113]=l,t[114]=r,t[115]=ue):ue=t[115];let de;t[116]!==l||t[117]!==r?(de=!r&&(0,Z.jsx)(lI,{editor:l}),t[116]=l,t[117]=r,t[118]=de):de=t[118];let fe;t[119]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Z.jsx)(`div`,{ref:p,style:{display:`contents`}}),t[119]=fe):fe=t[119];let pe;t[120]!==l||t[121]!==m?(pe=(0,Z.jsx)(pi,{editor:l,className:`tiptap-editor-portal-content h-full`},m),t[120]=l,t[121]=m,t[122]=pe):pe=t[122];let J;t[123]!==f||t[124]!==pe?(J=(0,$_.createPortal)(pe,f),t[123]=f,t[124]=pe,t[125]=J):J=t[125];let me;t[126]===l?me=t[127]:(me=(0,Z.jsx)(vM,{editor:l}),t[126]=l,t[127]=me);let he;t[128]===l?he=t[129]:(he=b(l),t[128]=l,t[129]=he);let _e;t[130]===he.store?_e=t[131]:(_e=(0,Z.jsx)(ce,{store:he.store}),t[130]=he.store,t[131]=_e);let ve;return t[132]!==le||t[133]!==ue||t[134]!==de||t[135]!==J||t[136]!==me||t[137]!==_e||t[138]!==u?(ve=(0,Z.jsxs)(`div`,{ref:u,className:`tiptap-editor h-full`,"data-agent-flash-state":`idle`,"data-agent-flash-count":`0`,"data-agent-flash-position":`append`,"data-agent-flash-agent-id":``,children:[le,ue,de,fe,J,me,_e]}),t[132]=le,t[133]=ue,t[134]=de,t[135]=J,t[136]=me,t[137]=_e,t[138]=u,t[139]=ve):ve=t[139],ve};function kI(e){return e+1}function AI(){return gi()}async function jI(e,t,n){try{let r={file:e,strategy:t};n!==void 0&&(r.content=n);let i=await fetch(`/api/sync/resolve-conflict`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)});if(i.ok)return{ok:!0};let a;try{let e=await i.json();typeof e.detail==`string`?a=e.detail:typeof e.title==`string`&&(a=e.title)}catch{}return{ok:!1,detail:a}}catch(n){let r=n instanceof Error?n.message:String(n);return console.warn(JSON.stringify({event:`conflict-resolve-dispatch-failed`,file:e,strategy:t,detail:r})),{ok:!1,detail:r}}}async function MI(e,t){return jI(e,`content`,t)}async function NI(e){return jI(e,`mine`)}async function PI(e){return jI(e,`theirs`)}async function FI(e){return jI(e,`delete`)}async function II(e){try{let t=await fetch(`/api/sync/conflict-content?file=${encodeURIComponent(e)}&source=ytext`);if(!t.ok){let n;try{let e=await t.json();typeof e.detail==`string`?n=e.detail:typeof e.title==`string`&&(n=e.title)}catch{}return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:t.status,detail:n})),null}let n=await t.json(),r=n.kind===`delete-modify`||n.kind===`modify-delete`||n.kind===`both-modified`?n.kind:`both-modified`;return n.kind!==r&&console.warn(JSON.stringify({event:`conflict-kind-missing-fallback`,file:e,receivedKind:n.kind??null})),{base:n.base??``,ours:n.ours??``,theirs:n.theirs??``,kind:r}}catch(t){return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:null,detail:t instanceof Error?t.message:String(t)})),null}}function LI(e){let t=(0,$.c)(86),{docName:n}=e,{_:r}=Bn(),{conflicts:i,loading:a}=Gd(),o;if(t[0]!==i||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>em(e.file)===n,t[3]=n,t[4]=e),o=i.find(e),t[0]=i,t[1]=n,t[2]=o}else o=t[2];let s=o,c=s?.file??`${n}.md`,[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),h=Ig(l?.kind===`delete-modify`||l?.kind===`modify-delete`),g,_;t[5]===n?(g=t[6],_=t[7]):(g=()=>(console.warn(JSON.stringify({event:`editor-area-swap-to-diffview`,"doc.name":n})),()=>{console.warn(JSON.stringify({event:`editor-area-swap-from-diffview`,"doc.name":n}))}),_=[n],t[5]=n,t[6]=g,t[7]=_),(0,Q.useEffect)(g,_);let v=a||s===void 0,y,b;t[8]!==v||t[9]!==c?(y=()=>{if(v)return;let e=!1;return u(null),f(!1),II(c).then(t=>{e||(t===null?f(!0):u(t))}),()=>{e=!0}},b=[c,v],t[8]=v,t[9]=c,t[10]=y,t[11]=b):(y=t[10],b=t[11]),(0,Q.useEffect)(y,b);let x;t[12]!==r||t[13]!==c?(x=async function(e){let t=await MI(c,e);t.ok||Dc.error(r({id:`K-h9cT`,values:{filePath:c}}),{description:t.detail})},t[12]=r,t[13]=c,t[14]=x):x=t[14];let S=x,C;t[15]!==r||t[16]!==c?(C=async function(e){m(!0);let t=await e(c);t.ok||(m(!1),Dc.error(r({id:`jPUPvG`,values:{filePath:c}}),{description:t.detail}))},t[15]=r,t[16]=c,t[17]=C):C=t[17];let w=C;if(d){let e;return t[18]===c?e=t[19]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`ajz9F8`,values:{filePath:c}})}),t[18]=c,t[19]=e),e}if(l===null){let e;return t[20]===c?e=t[21]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`DF1MtZ`,values:{filePath:c}})}),t[20]=c,t[21]=e),e}if(l.kind===`delete-modify`){let e;t[22]===l.theirs?e=t[23]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(Lg,{oldContent:``,newContent:l.theirs,layout:`unified`,previewMode:!0})}),t[22]=l.theirs,t[23]=e);let n;t[24]===c?n=t[25]:(n={filePath:c},t[24]=c,t[25]=n);let r;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[26]=r):r=t[26];let i;t[27]===n?i=t[28]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===w?a=t[30]:(a=()=>void w(FI),t[29]=w,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Y,{id:`Vlc75q`}),t[31]=o):o=t[31];let s;t[32]!==p||t[33]!==a?(s=(0,Z.jsx)(X,{type:`button`,variant:`destructive`,disabled:p,onClick:a,children:o}),t[32]=p,t[33]=a,t[34]=s):s=t[34];let u;t[35]===w?u=t[36]:(u=()=>void w(PI),t[35]=w,t[36]=u);let d;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Y,{id:`3mFsc3`}),t[37]=d):d=t[37];let f;t[38]!==p||t[39]!==u?(f=(0,Z.jsx)(X,{type:`button`,variant:`default`,disabled:p,onClick:u,children:d}),t[38]=p,t[39]=u,t[40]=f):f=t[40];let m;t[41]!==s||t[42]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[41]=s,t[42]=f,t[43]=m):m=t[43];let g;t[44]!==h||t[45]!==i||t[46]!==m?(g=(0,Z.jsxs)(`div`,{ref:h,className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[44]=h,t[45]=i,t[46]=m,t[47]=g):g=t[47];let _;return t[48]!==g||t[49]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[48]=g,t[49]=e,t[50]=_):_=t[50],_}if(l.kind===`modify-delete`){let e;t[51]===l.ours?e=t[52]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(Lg,{oldContent:``,newContent:l.ours,layout:`unified`,previewMode:!0})}),t[51]=l.ours,t[52]=e);let n;t[53]===c?n=t[54]:(n={filePath:c},t[53]=c,t[54]=n);let r;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[55]=r):r=t[55];let i;t[56]===n?i=t[57]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`EhDLBx`,values:n,components:r})}),t[56]=n,t[57]=i);let a;t[58]===w?a=t[59]:(a=()=>void w(NI),t[58]=w,t[59]=a);let o;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Y,{id:`0NA4b3`}),t[60]=o):o=t[60];let s;t[61]!==p||t[62]!==a?(s=(0,Z.jsx)(X,{type:`button`,variant:`default`,disabled:p,onClick:a,children:o}),t[61]=p,t[62]=a,t[63]=s):s=t[63];let u;t[64]===w?u=t[65]:(u=()=>void w(FI),t[64]=w,t[65]=u);let d;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Y,{id:`qSxaOz`}),t[66]=d):d=t[66];let f;t[67]!==p||t[68]!==u?(f=(0,Z.jsx)(X,{type:`button`,variant:`destructive`,disabled:p,onClick:u,children:d}),t[67]=p,t[68]=u,t[69]=f):f=t[69];let m;t[70]!==s||t[71]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[70]=s,t[71]=f,t[72]=m):m=t[72];let g;t[73]!==h||t[74]!==i||t[75]!==m?(g=(0,Z.jsxs)(`div`,{ref:h,className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[73]=h,t[74]=i,t[75]=m,t[76]=g):g=t[76];let _;return t[77]!==g||t[78]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[77]=g,t[78]=e,t[79]=_):_=t[79],_}let T;t[80]===S?T=t[81]:(T=e=>void S(e),t[80]=S,t[81]=T);let E;return t[82]!==l.ours||t[83]!==l.theirs||t[84]!==T?(E=(0,Z.jsx)(Lg,{oldContent:l.theirs,newContent:l.ours,layout:`unified`,conflictMode:!0,onResolve:T}),t[82]=l.ours,t[83]=l.theirs,t[84]=T,t[85]=E):E=t[85],E}function RI(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)($t(n,r));let a;return t[0]===i?a=t[1]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[0]=i,t[1]=a),a}var zI=`__back-nav__`;function BI(e){return e instanceof ot||e instanceof Rt||e instanceof tt||e instanceof pn||e instanceof yn||e instanceof mn?e.docName:null}function VI(e){return e instanceof ot||e instanceof Rt}function HI(e){if(e instanceof ot){let t=e.docName;return{title:Hc._({id:`Jejur6`}),summary:Hc._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof Rt){let t=e.docName;return{title:Hc._({id:`V7QxyT`}),summary:Hc._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof tt){let t=e.docName;return{title:Hc._({id:`1di5fu`}),summary:Hc._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof pn){let t=e.docName;return{title:Hc._({id:`wvbc1r`}),summary:Hc._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof yn)return{title:Hc._({id:`Gfr4fu`}),summary:Hc._({id:`UW2Fg3`})};if(e instanceof mn){let t=e.docName;return{title:Hc._({id:`vv7kpg`}),summary:Hc._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:Hc._({id:`W5A0Ly`});return{title:Hc._({id:`29VNqC`}),summary:t}}function UI(e){let t=(0,$.c)(42),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,s;t[0]===n?s=t[1]:(s=HI(n),t[0]=n,t[1]=s);let{title:c,summary:l}=s,u=!!a&&!!o,d=(0,Q.useRef)(null),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),g=typeof window<`u`?window.okDesktop:void 0,_=g&&VI(n)?g:null,v,y;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>{d.current?.focus()},y=[],t[2]=v,t[3]=y):(v=t[2],y=t[3]),(0,Q.useEffect)(v,y);let b;t[4]===n?b=t[5]:(b=VI(n),t[4]=n,t[5]=b);let x;t[6]===b?x=t[7]:(x=(0,Z.jsx)(py,{keyboard:b}),t[6]=b,t[7]=x);let S;t[8]===c?S=t[9]:(S=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:c}),t[8]=c,t[9]=S);let C;t[10]===l?C=t[11]:(C=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:l}),t[10]=l,t[11]=C);let w;t[12]!==S||t[13]!==C?(w=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[S,C]}),t[12]=S,t[13]=C,t[14]=w):w=t[14];let T;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Y,{id:`KDw4GX`}),t[15]=T):T=t[15];let E;t[16]===r?E=t[17]:(E=(0,Z.jsx)(X,{ref:d,variant:`default`,onClick:r,children:T}),t[16]=r,t[17]=E);let D;t[18]!==_||t[19]!==m?(D=_?(0,Z.jsx)(X,{variant:`outline-mono`,disabled:m,onClick:()=>{h(!0),uf(_).then(GI).catch(WI).finally(()=>h(!1))},children:(0,Z.jsx)(Y,{id:`uaUc6t`})}):null,t[18]=_,t[19]=m,t[20]=D):D=t[20];let O;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(O=g?(0,Z.jsx)(X,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>p(!0),children:(0,Z.jsx)(Y,{id:`ii5mVn`})}):null,t[21]=O):O=t[21];let k;t[22]!==i||t[23]!==u||t[24]!==n||t[25]!==o||t[26]!==a||t[27]!==r?(k=u?(0,Z.jsx)(X,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(ht(BI(n)??i),o(a),r(zI))},children:(0,Z.jsx)(Y,{id:`CKyk7Q`})}):null,t[22]=i,t[23]=u,t[24]=n,t[25]=o,t[26]=a,t[27]=r,t[28]=k):k=t[28];let A;t[29]!==E||t[30]!==D||t[31]!==k?(A=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[E,D,O,k]}),t[29]=E,t[30]=D,t[31]=k,t[32]=A):A=t[32];let j;t[33]!==i||t[34]!==n||t[35]!==f?(j=g?(0,Z.jsx)(Fr,{open:f,onOpenChange:p,crashContext:{source:`document view`,docName:BI(n)??i,errorMessage:n instanceof Error&&n.message?n.message:String(n),componentStack:_y(n)}}):null,t[33]=i,t[34]=n,t[35]=f,t[36]=j):j=t[36];let M;return t[37]!==A||t[38]!==j||t[39]!==x||t[40]!==w?(M=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`document-error-title`,"data-slot":`document-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[x,w,A,j]}),t[37]=A,t[38]=j,t[39]=x,t[40]=w,t[41]=M):M=t[41],M}function WI(){}function GI(e){e.ok||Dc.error(e.message,{id:`server-restart-error`,duration:1/0})}function KI(e){let t=(0,$.c)(17),{activeDocName:n,previousDocName:r,onNavigateBack:i,onRecycle:a,children:o}=e,s;t[0]!==n||t[1]!==i||t[2]!==r?(s=e=>(0,Z.jsx)(UI,{...e,activeDocName:n,previousDocName:r,onNavigateBack:i}),t[0]=n,t[1]=i,t[2]=r,t[3]=s):s=t[3];let c;t[4]===n?c=t[5]:(c=[n],t[4]=n,t[5]=c);let l;t[6]!==n||t[7]!==a?(l=e=>{if(e.reason===`imperative-api`){if(Array.isArray(e.args)&&e.args[0]===zI){console.warn(`[DocumentErrorBoundary] back-nav reset (no recycle)`);return}a(n),console.warn(`[DocumentErrorBoundary] retry recycled ${n}`)}else console.warn(`[DocumentErrorBoundary] reset by key change (${e.prev?.[0]} → ${e.next?.[0]})`)},t[6]=n,t[7]=a,t[8]=l):l=t[8];let u;t[9]===n?u=t[10]:(u=(e,t)=>{gy(e,t.componentStack),console.error(`[DocumentErrorBoundary] rendered fallback for ${n}: ${HI(e).title}`,e,t.componentStack??``)},t[9]=n,t[10]=u);let d;return t[11]!==o||t[12]!==s||t[13]!==c||t[14]!==l||t[15]!==u?(d=(0,Z.jsx)(pr,{fallbackRender:s,resetKeys:c,onReset:l,onError:u,children:o}),t[11]=o,t[12]=s,t[13]=c,t[14]=l,t[15]=u,t[16]=d):d=t[16],d}function qI(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Ks(t);return{map:n,keys:Jo(t),parseError:r}}function JI(e){let t=(0,$.c)(29),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>qI(n),t[0]=n,t[1]=r);let[i,a]=(0,Q.useState)(r),o=(0,Q.useRef)(null),s,c;t[2]===n?(s=t[3],c=t[4]):(s=()=>{let e=m(Cc(n),n.configuration.name??``);o.current=e,a(e.current());let t=e.subscribe(e=>{a(e)});return()=>{t(),e.dispose(),o.current=null}},c=[n],t[2]=n,t[3]=s,t[4]=c),(0,Q.useEffect)(s,c);let l;t[5]===i.map.icon?l=t[6]:(l=kn(i.map.icon),t[5]=i.map.icon,t[6]=l);let u=l,d;t[7]===i.map?d=t[8]:(d=Nn(i.map),t[7]=i.map,t[8]=d);let f=d,p;t[9]!==f||t[10]!==i.map?(p=f?Qe(i.map[f]):{kind:`unsupported`,value:``},t[9]=f,t[10]=i.map,t[11]=p):p=t[11];let h=p,g;t[12]!==f||t[13]!==i.map?(g=f?Cn(i.map[`${f}_y`]):null,t[12]=f,t[13]=i.map,t[14]=g):g=t[14];let _=g,v=h.kind===`url`||h.kind===`path`,y=u.kind!==`unsupported`;if(!v&&!y)return null;let b=v?`true`:`false`,x=y?`true`:`false`,S;t[15]!==h||t[16]!==f||t[17]!==_||t[18]!==v?(S=v&&f?(0,Z.jsx)(YI,{cover:h,focalY:_,onCommitFocalY:e=>{let t=o.current;if(!t)return;let n=t.patch({[`${f}_y`]:e});n.ok||console.warn(`[PageHeader] focal-Y patch rejected:`,n.error)}}):null,t[15]=h,t[16]=f,t[17]=_,t[18]=v,t[19]=S):S=t[19];let C;t[20]!==v||t[21]!==y||t[22]!==u?(C=y?(0,Z.jsx)(XI,{icon:u,hasCover:v}):null,t[20]=v,t[21]=y,t[22]=u,t[23]=C):C=t[23];let w;return t[24]!==S||t[25]!==C||t[26]!==b||t[27]!==x?(w=(0,Z.jsxs)(`div`,{className:`page-header editor-content-aligned`,"data-has-cover":b,"data-has-icon":x,"data-testid":`page-header`,children:[S,C]}),t[24]=S,t[25]=C,t[26]=b,t[27]=x,t[28]=w):w=t[28],w}function YI(e){let t=(0,$.c)(59),{cover:n,focalY:r,onCommitFocalY:i}=e,{_:a}=Bn(),[o,s]=(0,Q.useState)(null),c=(0,Q.useRef)(null),l=(0,Q.useRef)(null),u=o??r,d;t[0]===u?d=t[1]:(d=We(u),t[0]=u,t[1]=d);let f=d,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D;if(t[2]!==a||t[3]!==u||t[4]!==o||t[5]!==r||t[6]!==i){let e=Math.round((u??.5)*100),n;t[22]===r?n=t[23]:(n=function(e){e.button===0&&e.pointerType!==`touch`&&(e.currentTarget.setPointerCapture(e.pointerId),l.current={clientY:e.clientY,focal:r??.5})},t[22]=r,t[23]=n),m=n;let d;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(d=function(e){let t=l.current,n=c.current;if(!t||!n)return;let r=n.getBoundingClientRect();if(r.height===0)return;let i=(t.clientY-e.clientY)/r.height,a=t.focal+i;a<0&&(a=0),a>1&&(a=1),s(a)},t[24]=d):d=t[24],h=d;let f;t[25]!==o||t[26]!==r||t[27]!==i?(f=function(e){if(!l.current)return;l.current=null;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}let t=o;s(null),t!==null&&t!==r&&i(Math.round(t*100)/100)},t[25]=o,t[26]=r,t[27]=i,t[28]=f):f=t[28],g=f;let O;t[29]!==r||t[30]!==i?(O=function(e){let t=r??.5,n;if(e.key===`ArrowUp`||e.key===`ArrowRight`)n=Math.min(1,t+.05);else if(e.key===`ArrowDown`||e.key===`ArrowLeft`)n=Math.max(0,t-.05);else if(e.key===`Home`)n=0;else if(e.key===`End`)n=1;else return;e.preventDefault(),i(Math.round(n*100)/100)},t[29]=r,t[30]=i,t[31]=O):O=t[31],p=O,v=`page-header-cover`,y=`page-header-cover`,b=c,x=`slider`,S=0,t[32]===a?C=t[33]:(C=a({id:`7b3zu8`}),t[32]=a,t[33]=C),w=`vertical`,T=0,E=100,D=e,_=a({id:`AHFljV`,values:{percent:e}}),t[2]=a,t[3]=u,t[4]=o,t[5]=r,t[6]=i,t[7]=p,t[8]=m,t[9]=h,t[10]=g,t[11]=_,t[12]=v,t[13]=y,t[14]=b,t[15]=x,t[16]=S,t[17]=C,t[18]=w,t[19]=T,t[20]=E,t[21]=D}else p=t[7],m=t[8],h=t[9],g=t[10],_=t[11],v=t[12],y=t[13],b=t[14],x=t[15],S=t[16],C=t[17],w=t[18],T=t[19],E=t[20],D=t[21];let O=o!==null||void 0,k;t[34]===f?k=t[35]:(k={objectPosition:f},t[34]=f,t[35]=k);let A;t[36]!==n.value||t[37]!==k?(A=(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,loading:`lazy`,referrerPolicy:`no-referrer`,className:`page-header-cover-img`,style:k}),t[36]=n.value,t[37]=k,t[38]=A):A=t[38];let j;t[39]!==p||t[40]!==m||t[41]!==h||t[42]!==g||t[43]!==_||t[44]!==O||t[45]!==A||t[46]!==b||t[47]!==x||t[48]!==S||t[49]!==C||t[50]!==w||t[51]!==T||t[52]!==E||t[53]!==D?(j=(0,Z.jsx)(`div`,{ref:b,role:x,tabIndex:S,"aria-label":C,"aria-orientation":w,"aria-valuemin":T,"aria-valuemax":E,"aria-valuenow":D,"aria-valuetext":_,onPointerDown:m,onPointerMove:h,onPointerUp:g,onPointerCancel:g,onKeyDown:p,className:`page-header-cover-slider`,"data-testid":`page-header-cover-slider`,"data-dragging":O,children:A}),t[39]=p,t[40]=m,t[41]=h,t[42]=g,t[43]=_,t[44]=O,t[45]=A,t[46]=b,t[47]=x,t[48]=S,t[49]=C,t[50]=w,t[51]=T,t[52]=E,t[53]=D,t[54]=j):j=t[54];let M;return t[55]!==v||t[56]!==y||t[57]!==j?(M=(0,Z.jsx)(`div`,{className:v,"data-testid":y,children:j}),t[55]=v,t[56]=y,t[57]=j,t[58]=M):M=t[58],M}function XI(e){let t=(0,$.c)(9),{icon:n,hasCover:r}=e,i=r?`page-header-icon page-header-icon--with-cover`:`page-header-icon`;if(n.kind===`emoji`){let e;return t[0]!==n.value||t[1]!==i?(e=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":`emoji`,children:n.value}),t[0]=n.value,t[1]=i,t[2]=e):e=t[2],e}let a;t[3]===n.value?a=t[4]:(a=(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,referrerPolicy:`no-referrer`,className:`page-header-icon-img`}),t[3]=n.value,t[4]=a);let o;return t[5]!==n.kind||t[6]!==i||t[7]!==a?(o=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":n.kind,children:a}),t[5]=n.kind,t[6]=i,t[7]=a,t[8]=o):o=t[8],o}var ZI=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{ManagedArtifactProperties:e}=await import(`./ManagedArtifactProperties-CV1Prpoj.js`);return{ManagedArtifactProperties:e}},__vite__mapDeps([162,163,1,125,13,9,28,2,3,29,30,31,32,33,7,8,90,43,44,11,12,45,40,14,15,42,18,19,17,91,21,92,24,23,71,72,73,74,75,76,77,78,79,80,81,82,83,37,66,84,85,86,87,88,89,4,5,10,16,20,93,94,25,34,56,57,58,95,68,61,96,97,98,64,65,99,100,55,59,60,62,101,102,103,26,104,105,106,107,35,108,109,110,111,112,113,114,115,164,127,129,130,41,165,166,143,167,168,147,169,156,141]),import.meta.url)).ManagedArtifactProperties})),QI=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{MermaidDocEditor:e}=await import(`./MermaidDocEditor-CiHzMRN9.js`);return{MermaidDocEditor:e}},__vite__mapDeps([170,1,72,73,33,83,2,28,3,29,30,31,32,37,66,9,18,8,84,13,85,86,87,88,89,7,94,74,75,76,77,78,79,80,81,82,44,21,25,34,56,57,58,95,68,61,96,171,172,98,10,11,12,14,15,16,17,19,20,64,65,173,69]),import.meta.url)).MermaidDocEditor})),$I=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{ExcalidrawDocEditor:e}=await import(`./ExcalidrawDocEditor-BWNQPfhq.js`);return{ExcalidrawDocEditor:e}},__vite__mapDeps([174,1,2,175,176,177,8,9,178,179,7,110,43,44,11,12,13,45,14,15,180,40,41,94,72,73,33,74,75,76,77,78,79,80,81,82,28,3,29,30,31,32,83,37,66,18,84,85,86,87,88,89,21,25,34,56,57,58,95,68,61,96,170,171,172,98,10,16,17,19,20,64,65,173,69,181]),import.meta.url)).ExcalidrawDocEditor})),eL=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{TextDocEditor:e}=await import(`./TextDocEditor--IKVxg88.js`);return{TextDocEditor:e}},__vite__mapDeps([182,1,72,73,33,28,2,3,29,30,31,32,83,37,66,9,18,8,84,13,85,86,87,88,89,7,94,74,75,76,77,78,79,80,81,82,44,21,25,34,56,57,58,95,68,61,96,171,172,173,183]),import.meta.url)).TextDocEditor})),tL=sm(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function nL(e){let t=e.threshold??tL;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function rL(e){return e.hasEmittedFirstToggle||!e.isActive||!e.isLarge?!1:e.renderSource&&e.renderVisual}function iL(e,t,n){return e?t:n}function aL(e){let{docName:t,pages:n,loading:r}=e;return!r&&!n.has(t)&&!Wo(t)&&us(t)===null&&!Ws(t)&&!Xo(t)&&!yo(t)}var oL=sm(`ACTIVITY_MOUNT_LIMIT`,3);function sL(){return n(()=>import(`./SourceEditor-RCKX4Ohe.js`),__vite__mapDeps([184,1,78,73,33,72,172,28,2,3,29,30,31,32,83,37,66,9,18,8,84,13,85,86,87,88,89,71,74,75,76,77,79,80,81,82,44,7,4,5,90,43,11,12,45,40,14,15,42,19,17,91,21,92,24,23,10,16,20,93,94,25,34,56,57,58,95,68,61,96,97,98,64,65,99,100,55,59,60,62,101,102,103,26,104,105,106,107,35,108,109,110,111,112,113,114,115,185,39,41,46,136,144,186,67,154,156,148,173,169]),import.meta.url)}var cL=(0,Q.lazy)(async()=>({default:(await sL()).SourceEditor}));function lL(e,t,n){if(n<=0)return[];let r=e.filter(e=>!Ct(e.docName)),i=[...r].sort((e,t)=>t.lastAccessedAt-e.lastAccessedAt);if(typeof t==`string`||t===null){let e=i.slice(0,n);if(t===null||e.some(e=>e.docName===t))return e;let a=r.find(e=>e.docName===t);return a===void 0?e:[...e.slice(0,n-1),a]}let a=t,o=new Map(r.map(e=>[e.docName,e])),s=[...a].filter(e=>!Ct(e)).map(e=>o.get(e)).filter(e=>e!==void 0),c=new Set(s.map(e=>e.docName)),l=Math.max(n,s.length);for(let e of i){if(c.size>=l)break;c.has(e.docName)||(s.push(e),c.add(e.docName))}return s}function uL(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:Hc._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?Hc._({id:`Sc1bKE`,values:{docName:e}}):Hc._({id:`ovIGrT`,values:{docName:e}}),actionLabel:Hc._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:Hc._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?Hc._({id:`bmC18N`,values:{docName:e}}):Hc._({id:`pAgkuZ`,values:{docName:e}})}:null}function dL(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(om,{name:`activity-pool`,children:(0,Z.jsx)(fL,{...e})}),t[0]=e,t[1]=n),n}function fL(e){let t=(0,$.c)(21),{activeDocName:n,visibleDocNames:r,activityHosts:i,parkingHost:a,renderToolbar:o,isSourceMode:s,editorPlaceholder:c,previousDocName:l,onNavigateBack:u,onRecycle:d}=e,{poolEntries:f,serverRestartRecovery:p}=Et(),{pages:m,loading:h}=Nd(),g;t[0]!==n||t[1]!==r?(g=r??new Set([n]),t[0]=n,t[1]=r,t[2]=g):g=t[2];let _=g,v=lL(f,_,oL),y=(0,Q.useRef)(``),b=v.map(pL).join(`,`),x=(0,Q.useRef)(f),S,C;t[3]===f?(S=t[4],C=t[5]):(S=()=>{x.current=f},C=[f],t[3]=f,t[4]=S,t[5]=C),(0,Q.useLayoutEffect)(S,C),(0,Q.useLayoutEffect)(()=>{if(y.current===b)return;let e=y.current?y.current.split(`,`):[],t=b?b.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)_t(e);for(let e of i){let t=x.current.find(t=>t.docName===e)?.poolEventId;Ut(e,t&&t.length>0?t:xo())}am(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),y.current=b,Ye(t)},[b,n]);let w;t[6]!==i||t[7]!==c||t[8]!==_||t[9]!==s||t[10]!==h||t[11]!==u||t[12]!==d||t[13]!==m||t[14]!==a||t[15]!==l||t[16]!==o||t[17]!==p?(w=e=>(0,Z.jsx)(hL,{docName:e.docName,hostMount:i?.get(e.docName)??a??null,children:(0,Z.jsx)(xL,{entry:e,isVisible:_.has(e.docName),toolbar:_.has(e.docName)?o?.(e.docName,e.provider):null,isSourceMode:s,editorPlaceholder:c,isNewDoc:aL({docName:e.docName,pages:m,loading:h}),previousDocName:l,onNavigateBack:u,onRecycle:d,serverRestartRecovery:p})},e.docName),t[6]=i,t[7]=c,t[8]=_,t[9]=s,t[10]=h,t[11]=u,t[12]=d,t[13]=m,t[14]=a,t[15]=l,t[16]=o,t[17]=p,t[18]=w):w=t[18];let T=v.map(w),E;return t[19]===T?E=t[20]:(E=(0,Z.jsx)(Z.Fragment,{children:T}),t[19]=T,t[20]=E),E}function pL(e){return e.docName}function mL(e,t){return{scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight,...t===null?{}:{contentBottom:t}}}function hL(e){let t=(0,$.c)(10),{docName:n,hostMount:r,children:i}=e,a;t[0]===n?a=t[1]:(a=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-activity-host`,n),e.className=`relative h-full min-h-0`,e},t[0]=n,t[1]=a);let[o]=(0,Q.useState)(a),s,c;t[2]!==o||t[3]!==r?(s=()=>{if(r!==null)return r.append(o),()=>o.remove()},c=[o,r],t[2]=o,t[3]=r,t[4]=s,t[5]=c):(s=t[4],c=t[5]),(0,Q.useLayoutEffect)(s,c);let l;return t[6]!==i||t[7]!==o||t[8]!==r?(l=r===null?i:(0,$_.createPortal)(i,o),t[6]=i,t[7]=o,t[8]=r,t[9]=l):l=t[9],l}function gL(e){let t=(0,$.c)(19),{isActive:n,docName:r,mode:i,initialScrollTop:a,bodyAnchorRef:o,children:s}=e,c=(0,Q.useRef)(null),l=(0,Q.useRef)(a??0),u=(0,Q.useRef)(null),d=(0,Q.useRef)(n),p=(0,Q.useRef)(!1),m,h;t[0]===n?(m=t[1],h=t[2]):(m=()=>{d.current=n},h=[n],t[0]=n,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let g=(0,Q.useRef)(i),_,v;t[3]===i?(_=t[4],v=t[5]):(_=()=>{g.current=i},v=[i],t[3]=i,t[4]=_,t[5]=v),(0,Q.useLayoutEffect)(_,v);let y,b;t[6]!==o||t[7]!==r?(y=()=>{let e=c.current;if(!e)return;let t=()=>{if(!(!d.current||p.current)&&e.scrollTop>0){let t=M(e,o?.current);if(!je(t))return;l.current=e.scrollTop,u.current=t.kind===`measured`?t.contentPos:null,t.kind===`measured`&&Mt(r,{offset:e.scrollTop-t.contentPos,mode:g.current,fraction:ie(e.scrollTop,e.scrollHeight,e.clientHeight)})}};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},b=[o,r],t[6]=o,t[7]=r,t[8]=y,t[9]=b):(y=t[8],b=t[9]),(0,Q.useEffect)(y,b);let x,S;t[10]!==o||t[11]!==r||t[12]!==n?(x=()=>{if(!n)return;let e=c.current;if(!e||le(r)===`landing`)return;let t=oe(r);if(t&&t.mode!==g.current){let n=Math.max(0,e.scrollHeight-e.clientHeight),i=Math.round(t.fraction*n),a=n>0;a&&(e.scrollTop=i),am(`ok/scroll-restore/cross-mode`,{docName:r,savedMode:t.mode,mode:g.current,fraction:Number(t.fraction.toFixed(4)),target:i,applied:a&&e.scrollTop===i,...mL(e,Ce(e))});return}let i=l.current,a=t?.offset,s=u.current===null?null:i-u.current,d=a??s;if(i===0&&d===null)return;let m=()=>{let t=Ce(e),n=me(i,d,M(e,o?.current));return{target:n===null?null:W(n,t,e.clientHeight),contentBottom:t}};p.current=!0;let h=e.style.overflowAnchor;e.style.overflowAnchor=`none`;let _=performance.now(),v=!1,y=!1,b=m();b.target!==null&&(e.scrollTop=b.target,Ln(e.scrollTop,b.target)&&f(b.target,b.contentBottom,e.scrollHeight)&&(y=!0,am(`ok/scroll-restore/phase1-success`,{docName:r,target:b.target,elapsedMs:performance.now()-_,...mL(e,b.contentBottom)})));let x=e.scrollTop,S=!1,C=0,w=()=>{S||(S=!0,p.current=!1,e.style.overflowAnchor=h,cancelAnimationFrame(C),clearTimeout(D),e.removeEventListener(`wheel`,T),e.removeEventListener(`touchstart`,T),e.removeEventListener(`mousedown`,T),e.removeEventListener(`keydown`,T))},T=()=>{y||am(`ok/scroll-restore/yielded`,{docName:r,reason:`user`,elapsedMs:performance.now()-_,...mL(e,null)}),w()};e.addEventListener(`wheel`,T,{passive:!0}),e.addEventListener(`touchstart`,T,{passive:!0}),e.addEventListener(`mousedown`,T),e.addEventListener(`keydown`,T);let E=()=>{if(S)return;let t=le(r);if(t){am(`ok/scroll-restore/superseded`,{docName:r,holder:t,elapsedMs:performance.now()-_,finalScrollTop:e.scrollTop}),y||am(`ok/scroll-restore/yielded`,{docName:r,reason:t,elapsedMs:performance.now()-_,...mL(e,null)}),w();return}if(De(x,e.scrollTop)){y||am(`ok/scroll-restore/yielded`,{docName:r,reason:`external`,elapsedMs:performance.now()-_,...mL(e,null)}),w();return}b=m(),b.target!==null&&!Ln(e.scrollTop,b.target)&&f(b.target,b.contentBottom,e.scrollHeight)&&(e.scrollTop=b.target,Ln(e.scrollTop,b.target)&&!v&&(am(`ok/scroll-restore/phase2-success`,{docName:r,target:b.target,elapsedMs:performance.now()-_,...mL(e,b.contentBottom)}),v=!0,y=!0)),x=e.scrollTop,C=requestAnimationFrame(E)};C=requestAnimationFrame(E);let D=setTimeout(()=>{if(S)return;let t=m(),n=t.target;(n===null||!Ln(e.scrollTop,n)&&f(n,t.contentBottom,e.scrollHeight))&&am(`ok/scroll-restore/abandoned`,{docName:r,...n===null?{}:{target:n},anchorMeasurable:n!==null,elapsedMs:performance.now()-_,...mL(e,t.contentBottom)}),w()},F);return w},S=[n,o,r],t[10]=o,t[11]=r,t[12]=n,t[13]=x,t[14]=S):(x=t[13],S=t[14]),(0,Q.useLayoutEffect)(x,S);let C,w;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(w=gr(`editor-doc-scroll subtle-scrollbar h-full overflow-y-auto`,$c()?`pt-0 scroll-pt-0`:`pt-14 scroll-pt-14`),C={overflowAnchor:`auto`},t[15]=C,t[16]=w):(C=t[15],w=t[16]);let T;return t[17]===s?T=t[18]:(T=(0,Z.jsx)(`div`,{ref:c,"data-testid":`editor-scroll-container`,className:w,style:C,children:s}),t[17]=s,t[18]=T),T}function _L(e){let t=(0,$.c)(12),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a}=e,o=r&&i,[s,c]=(0,Q.useState)(o),l,u;if(t[0]===o?(l=t[1],u=t[2]):(l=()=>{o&&c(!0)},u=[o],t[0]=o,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u),!s&&!o)return null;let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(xO,{}),t[3]=d):d=t[3];let f=n.docName,p;t[4]===n.provider.document?p=t[5]:(p=n.provider.document.getText(`source`),t[4]=n.provider.document,t[5]=p);let m;return t[6]!==a||t[7]!==n.docName||t[8]!==n.provider||t[9]!==o||t[10]!==p?(m=(0,Z.jsx)(Q.Suspense,{fallback:d,children:(0,Z.jsx)(cL,{docName:f,ytext:p,provider:n.provider,placeholder:a,isSourceModeActive:o})}),t[6]=a,t[7]=n.docName,t[8]=n.provider,t[9]=o,t[10]=p,t[11]=m):m=t[11],m}function vL(e){let t=(0,$.c)(18),{view:n}=e,r=n.kind===`failed`,i=r?`alert`:`status`,a=!r,o;t[0]===r?o=t[1]:(o=(0,Z.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-full border bg-muted text-muted-foreground`,children:r?(0,Z.jsx)(Pp,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(ip,{className:`size-5`,"aria-hidden":`true`})}),t[0]=r,t[1]=o);let s;t[2]===n.title?s=t[3]:(s=(0,Z.jsx)(`h2`,{className:`text-lg font-medium`,children:n.title}),t[2]=n.title,t[3]=s);let c;t[4]===n.summary?c=t[5]:(c=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:n.summary}),t[4]=n.summary,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==r||t[10]!==n.actionLabel?(u=r?(0,Z.jsxs)(X,{type:`button`,onClick:yL,children:[(0,Z.jsx)(Pp,{className:`size-4`,"aria-hidden":`true`}),n.actionLabel]}):null,t[9]=r,t[10]=n.actionLabel,t[11]=u):u=t[11];let d;return t[12]!==i||t[13]!==a||t[14]!==o||t[15]!==l||t[16]!==u?(d=(0,Z.jsxs)(`div`,{"data-slot":`server-restart-recovery`,role:i,"aria-busy":a,className:`flex h-full flex-col items-center justify-center gap-6 p-8 text-center`,children:[o,l,u]}),t[12]=i,t[13]=a,t[14]=o,t[15]=l,t[16]=u,t[17]=d):d=t[17],d}function yL(){return window.location.reload()}function bL(e){let t=(0,$.c)(2),{html:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`tiptap-editor h-full pointer-events-none`,"aria-hidden":`true`,children:(0,Z.jsx)(`div`,{className:`tiptap ProseMirror tiptap-editor-portal-content`,dangerouslySetInnerHTML:{__html:n}})}),t[0]=n,t[1]=r),r}function xL(e){let t=(0,$.c)(77),{entry:n,isVisible:r,toolbar:i,isSourceMode:a,editorPlaceholder:o,isNewDoc:s,previousDocName:c,onNavigateBack:l,onRecycle:u,serverRestartRecovery:d}=e,f;t[0]!==n.docName||t[1]!==d?(f=uL(n.docName,d),t[0]=n.docName,t[1]=d,t[2]=f):f=t[2];let p=f,m=nj(n.docName)===`conflict`,h;t[3]===n.docName?h=t[4]:(h=Ws(n.docName),t[3]=n.docName,t[4]=h);let g=h,_;t[5]===n.docName?_=t[6]:(_=Xo(n.docName),t[5]=n.docName,t[6]=_);let v=_,y;t[7]!==n.docName||t[8]!==v||t[9]!==g?(y=!g&&!v&&yo(n.docName),t[7]=n.docName,t[8]=v,t[9]=g,t[10]=y):y=t[10];let b=y,x;t[11]===n.docName?x=t[12]:(x=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-portal`,n.docName),e.style.display=`contents`,e},t[11]=n.docName,t[12]=x);let[S]=(0,Q.useState)(x),C=(0,Q.useRef)(null),w=n.provider.document.getText(`source`).length,[T,E]=(0,Q.useState)(a),D,O;t[13]!==a||t[14]!==r||t[15]!==T?(D=()=>{r&&T!==a&&E(a)},O=[r,a,T],t[13]=a,t[14]=r,t[15]=T,t[16]=D,t[17]=O):(D=t[16],O=t[17]),(0,Q.useEffect)(D,O);let k;t[18]!==a||t[19]!==r||t[20]!==T?(k=iL(r,a,T),t[18]=a,t[19]=r,t[20]=T,t[21]=k):k=t[21];let A=k,[j,M]=(0,Q.useState)(A),[N,P]=(0,Q.useState)(!A),F,I;t[22]!==A||t[23]!==j||t[24]!==N?(I=()=>{A&&!j?M(!0):!A&&!N&&P(!0)},F=[A,j,N],t[22]=A,t[23]=j,t[24]=N,t[25]=F,t[26]=I):(F=t[25],I=t[26]),(0,Q.useEffect)(I,F);let L=nL({ytextLength:w,isSourceMode:A,visitedSource:j,visitedVisual:N}),R=(0,Q.useRef)(``),z=`${L.isLarge}-${L.renderSource}-${L.renderVisual}`,B,V;t[27]!==A||t[28]!==n.docName||t[29]!==L.isLarge||t[30]!==L.renderSource||t[31]!==L.renderVisual||t[32]!==z||t[33]!==w?(B=()=>{R.current!==z&&(R.current=z,L.isLarge&&am(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:w,isSourceMode:A,renderSource:L.renderSource,renderVisual:L.renderVisual}))},V=[z,L.isLarge,L.renderSource,L.renderVisual,n.docName,w,A],t[27]=A,t[28]=n.docName,t[29]=L.isLarge,t[30]=L.renderSource,t[31]=L.renderVisual,t[32]=z,t[33]=w,t[34]=B,t[35]=V):(B=t[34],V=t[35]),(0,Q.useEffect)(B,V);let ee;t[36]===n.docName?ee=t[37]:(ee=()=>Ot(n.docName),t[36]=n.docName,t[37]=ee);let[H]=(0,Q.useState)(ee),U=H?.html??null,[W,G]=(0,Q.useState)(!1),te,ne;t[38]!==A||t[39]!==n.docName||t[40]!==L.isLarge||t[41]!==L.renderSource||t[42]!==L.renderVisual||t[43]!==W||t[44]!==r||t[45]!==w?(te=()=>{rL({isActive:r,isLarge:L.isLarge,renderSource:L.renderSource,renderVisual:L.renderVisual,hasEmittedFirstToggle:W})&&(am(`ok/cold/first-toggle`,{docName:n.docName,mountId:tn(n.docName),ytextLength:w,modeEnteredFirst:A?`source`:`visual`}),G(!0))},ne=[W,r,L.isLarge,L.renderSource,L.renderVisual,n.docName,w,A],t[38]=A,t[39]=n.docName,t[40]=L.isLarge,t[41]=L.renderSource,t[42]=L.renderVisual,t[43]=W,t[44]=r,t[45]=w,t[46]=te,t[47]=ne):(te=t[46],ne=t[47]),(0,Q.useEffect)(te,ne);let re=r?`visible`:`hidden`,K=`editor:${n.docName}`,ie=A?`source`:`wysiwyg`,q=H?.scrollTop,ae;t[48]!==o||t[49]!==A||t[50]!==n||t[51]!==L.renderSource||t[52]!==L.renderVisual||t[53]!==m||t[54]!==v||t[55]!==g||t[56]!==s||t[57]!==b||t[58]!==r||t[59]!==l||t[60]!==u||t[61]!==S||t[62]!==c||t[63]!==p||t[64]!==U?(ae=p?(0,Z.jsx)(vL,{view:p}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(KI,{activeDocName:n.docName,previousDocName:c,onNavigateBack:l,onRecycle:u,children:(0,Z.jsx)(Q.Suspense,{fallback:U?(0,Z.jsx)(bL,{html:U}):(0,Z.jsx)(xO,{}),children:(0,Z.jsx)(RI,{docName:n.docName,provider:n.provider,children:m?(0,Z.jsx)(LI,{docName:n.docName,provider:n.provider}):g?(0,Z.jsx)(QI,{docName:n.docName,provider:n.provider,isSourceMode:A}):v?(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(xO,{}),children:(0,Z.jsx)($I,{provider:n.provider})}):b?(0,Z.jsx)(eL,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!A&&(Wo(n.docName)||dm(n.docName)||us(n.docName)?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(ZI,{docName:n.docName,provider:n.provider})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(JI,{provider:n.provider}),(0,Z.jsx)(Vf,{provider:n.provider})]})),(0,Z.jsx)(`div`,{ref:C,"aria-hidden":!0,className:`h-0`,[be]:``}),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[L.renderSource?(0,Z.jsx)(`div`,{className:A?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(_L,{entry:n,isActive:r,isSourceMode:A,editorPlaceholder:o})}):null,L.renderVisual?(0,Z.jsx)(`div`,{className:A?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(DI,{provider:n.provider,placeholder:o,isSourceMode:A,portalTarget:S},`${n.docName}-${String(s)}-${n.poolEventId}`)}):null]})]})})})})}),t[48]=o,t[49]=A,t[50]=n,t[51]=L.renderSource,t[52]=L.renderVisual,t[53]=m,t[54]=v,t[55]=g,t[56]=s,t[57]=b,t[58]=r,t[59]=l,t[60]=u,t[61]=S,t[62]=c,t[63]=p,t[64]=U,t[65]=ae):ae=t[65];let oe;t[66]!==n.docName||t[67]!==r||t[68]!==ie||t[69]!==q||t[70]!==ae?(oe=(0,Z.jsx)(gL,{isActive:r,docName:n.docName,mode:ie,initialScrollTop:q,bodyAnchorRef:C,children:ae}),t[66]=n.docName,t[67]=r,t[68]=ie,t[69]=q,t[70]=ae,t[71]=oe):oe=t[71];let se;return t[72]!==re||t[73]!==K||t[74]!==oe||t[75]!==i?(se=(0,Z.jsxs)(Q.Activity,{mode:re,name:K,children:[oe,i]}),t[72]=re,t[73]=K,t[74]=oe,t[75]=i,t[76]=se):se=t[76],se}function SL(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function CL(e){let{value:t,unit:n}=SL(e);return n===`rem`?t*16:t}function wL(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var TL=3600*24*7;function EL(e){let t=(0,$.c)(28),{direction:n,currentWidth:r,onResize:i,onToggle:a,isCollapsed:o,minResizeWidth:s,maxResizeWidth:c,enableToggle:l,enableAutoCollapse:u,autoCollapseThreshold:d,expandThreshold:f,enableDrag:p,setIsDraggingRail:m,widthCookieName:h,widthCookieMaxAge:g,isNested:_}=e,v=n===void 0?`right`:n,y=o===void 0?!1:o,b=s===void 0?`14rem`:s,x=c===void 0?`24rem`:c,S=l===void 0?!0:l,C=u===void 0?!0:u,w=d===void 0?1.5:d,T=f===void 0?.2:f,E=p===void 0?!0:p,D=m===void 0?DL:m,O=g===void 0?TL:g,k=_===void 0?!1:_,A=(0,Q.useRef)(null),j=(0,Q.useRef)(0),M=(0,Q.useRef)(0),N=(0,Q.useRef)(!1),P=(0,Q.useRef)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(0),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(0),z=(0,Q.useRef)(0),B=(0,Q.useRef)(null),V=(0,Q.useRef)(r),ee=(0,Q.useRef)(y),H,U;t[0]===r?(H=t[1],U=t[2]):(H=()=>{V.current=r},U=[r],t[0]=r,t[1]=H,t[2]=U),(0,Q.useEffect)(H,U);let W,G;t[3]===y?(W=t[4],G=t[5]):(W=()=>{ee.current=y},G=[y],t[3]=y,t[4]=W,t[5]=G),(0,Q.useEffect)(W,G);let te=CL(b),ne;t[6]===x?ne=t[7]:(ne=CL(x),t[6]=x,t[7]=ne);let re=ne,K;t[8]!==E||t[9]!==k?(K=function(e){E&&(P.current=!0,j.current=ee.current?0:CL(V.current),M.current=e.clientX,I.current=e.clientX,F.current=null,L.current=!1,R.current=0,z.current=0,B.current=k&&A.current?A.current.getBoundingClientRect():null,e.preventDefault())},t[8]=E,t[9]=k,t[10]=K):K=t[10];let ie=K,q,ae;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==re||t[18]!==te||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(q=()=>{let e=function(e){h&&(document.cookie=`${h}=${e}; path=/; max-age=${O}`)},t=function(e,t){return v===`left`?e<t:e>t},n=function(e,t,n,r){if(k&&r){let r=e.clientX-t;return v===`left`?n-r:n+r}return v===`left`?window.innerWidth-e.clientX:e.clientX},r=function(r){if(!P.current)return;let o=Math.abs(r.clientX-M.current);if(!N.current&&o>5&&(N.current=!0,D(!0)),N.current){let{unit:o}=SL(V.current),s=B.current;k&&A.current&&(s=A.current.getBoundingClientRect());let c=t(r.clientX,I.current)?`expand`:`collapse`;F.current!==c&&(F.current=c),z.current=Math.abs(r.clientX-I.current);let l=Date.now();if(L.current&&l-R.current>200&&(L.current=!1),!L.current){if(C&&a&&!ee.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=te*w;else if(e<=te){let n=te*(w-1);t=te-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&ee.current&&c===`expand`&&z.current>te*T){a();let t=n(r,M.current,j.current,s),c=Math.max(te,Math.min(re,t)),u=wL(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(ee.current)return;let u=n(r,M.current,j.current,s),d=Math.max(te,Math.min(re,u)),f=wL(o===`rem`?d/16:d,o);i(f),e(f)}},o=function(){P.current&&(!N.current&&a&&S&&a(),N.current=!1,P.current=!1,F.current=null,I.current=0,L.current=!1,R.current=0,z.current=0,B.current=null,D(!1))};return document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,o),()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,o)}},ae=[i,a,D,te,re,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=re,t[18]=te,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=q,t[25]=ae):(q=t[24],ae=t[25]),(0,Q.useEffect)(q,ae);let oe;return t[26]===ie?oe=t[27]:(oe={dragRef:A,isDragging:N,handleMouseDown:ie},t[26]=ie,t[27]=oe),oe}function DL(){}var OL=3600*24*7,kL=`18rem`,AL=`3rem`,jL=`app-file-sidebar`,ML=`14.625rem`,NL=`32rem`,PL=`sidebar_width`,FL=/^\d+(?:\.\d+)?(?:rem|px)$/,IL=Q.createContext(null);function LL(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${PL}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return FL.test(n)?n:e}function RL(){let e=Q.use(IL);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function zL(e){let t=(0,$.c)(57),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({open:i,onOpenChange:o,className:r,style:s,children:n,defaultWidth:c,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=c===void 0?kL:c,[u]=Q.useState(VL),d;t[8]===u?d=t[9]:(d=()=>_j(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>LL(l),t[10]=l,t[11]=m);let[h,g]=Q.useState(m),[_,v]=Q.useState(!1),[y,b]=Q.useState(!1),x;t[12]===u?x=t[13]:(x=()=>{let e=wj();return Ej(`left`,_j(u,window.innerWidth,`left`),e)===`open`},t[12]=u,t[13]=x);let[S,C]=Q.useState(x),w=i??S,T;t[14]!==f||t[15]!==o?(T=e=>{let t=typeof e==`function`?e(k.current):e;o?o(t):C(t),Dj(`left`,f,t?`open`:`collapsed`)},t[14]=f,t[15]=o,t[16]=T):T=t[16];let E=T,D;t[17]===E?D=t[18]:(D=function(){E(BL)},t[17]=E,t[18]=D);let O=D,k=Q.useRef(w),A;t[19]===w?A=t[20]:(A=()=>{k.current=w},t[19]=w,t[20]=A),Q.useLayoutEffect(A);let j;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(){window.innerWidth>=1024||k.current&&(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||b(!0))},t[21]=j):j=t[21];let M=j,N,P;t[22]===u?(N=t[23],P=t[24]):(P=()=>{let e=window.matchMedia(`(min-width: ${mj}px)`),t=()=>{let e=_j(u,window.innerWidth,`left`);p(e),C(Ej(`left`,e,wj())===`open`)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},N=[u],t[22]=u,t[23]=N,t[24]=P),Q.useEffect(P,N);let F,I;t[25]===w?(F=t[26],I=t[27]):(F=()=>{w||document.getElementById(jL)?.contains(document.activeElement)&&document.querySelector(`[data-sidebar="trigger"]`)?.focus()},I=[w],t[25]=w,t[26]=F,t[27]=I),Q.useLayoutEffect(F,I);let L,R;t[28]!==w||t[29]!==f||t[30]!==E?(L=()=>{if(f===`above`||!w)return;let e=e=>{if(e.key!==`Escape`||Mr())return;let t=e.target;t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`)||E(!1)};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},R=[f,w,E],t[28]=w,t[29]=f,t[30]=E,t[31]=L,t[32]=R):(L=t[31],R=t[32]),Q.useEffect(L,R);let z,B;t[33]===O?(z=t[34],B=t[35]):(z=()=>{if(typeof window<`u`&&window.okDesktop!=null)return;let e=e=>{Mc(e,`toggle-files-sidebar`)&&(Mr()||(e.preventDefault(),O()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},B=[O],t[33]=O,t[34]=z,t[35]=B),Q.useEffect(z,B);let V=w?`expanded`:`collapsed`,ee;t[36]!==_||t[37]!==w||t[38]!==E||t[39]!==y||t[40]!==V||t[41]!==O||t[42]!==h?(ee={state:V,open:w,setOpen:E,toggleSidebar:O,width:h,setWidth:g,isDraggingRail:_,setIsDraggingRail:v,showPushPulse:y,setShowPushPulse:b,notifySidebarFileSelected:M},t[36]=_,t[37]=w,t[38]=E,t[39]=y,t[40]=V,t[41]=O,t[42]=h,t[43]=ee):ee=t[43];let H;t[44]!==s||t[45]!==h?(H={"--sidebar-width":h,"--sidebar-width-icon":AL,...s},t[44]=s,t[45]=h,t[46]=H):H=t[46];let U=H,W;t[47]===r?W=t[48]:(W=gr(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[47]=r,t[48]=W);let G;t[49]!==n||t[50]!==a||t[51]!==U||t[52]!==W?(G=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:U,className:W,...a,children:n}),t[49]=n,t[50]=a,t[51]=U,t[52]=W,t[53]=G):G=t[53];let te;return t[54]!==ee||t[55]!==G?(te=(0,Z.jsx)(IL.Provider,{value:ee,children:G}),t[54]=ee,t[55]=G,t[56]=te):te=t[56],te}function BL(e){return!e}function VL(){return As()}function HL(e){let t=(0,$.c)(39),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({side:a,variant:o,collapsible:s,className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=a===void 0?`left`:a,l=o===void 0?`sidebar`:o,u=s===void 0?`offcanvas`:s,{_:d}=Bn(),{state:f,isDraggingRail:p}=RL();if(u===`none`){let e;t[7]===r?e=t[8]:(e=gr(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let a;return t[9]!==n||t[10]!==i||t[11]!==e||t[12]!==l?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":l,className:e,...i,children:n}),t[9]=n,t[10]=i,t[11]=e,t[12]=l,t[13]=a):a=t[13],a}let m=f===`collapsed`?u:``,h=l===`floating`||l===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,g;t[14]===h?g=t[15]:(g=gr(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,h,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[14]=h,t[15]=g);let _;t[16]===g?_=t[17]:(_=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:g}),t[16]=g,t[17]=_);let v;t[18]===d?v=t[19]:(v=d({id:`07q4Qk`}),t[18]=d,t[19]=v);let y=l===`floating`||l===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,b;t[20]!==r||t[21]!==y?(b=gr(`fixed inset-y-0 z-10 flex h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear motion-reduce:transition-none motion-reduce:duration-0 data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]`,y,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[20]=r,t[21]=y,t[22]=b):b=t[22];let x;t[23]===n?x=t[24]:(x=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[23]=n,t[24]=x);let S;t[25]!==i||t[26]!==c||t[27]!==b||t[28]!==x||t[29]!==v?(S=(0,Z.jsx)(`nav`,{id:jL,"aria-label":v,"data-slot":`sidebar-container`,"data-side":c,className:b,...i,children:x}),t[25]=i,t[26]=c,t[27]=b,t[28]=x,t[29]=v,t[30]=S):S=t[30];let C;return t[31]!==p||t[32]!==c||t[33]!==f||t[34]!==S||t[35]!==m||t[36]!==_||t[37]!==l?(C=(0,Z.jsxs)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":f,"data-collapsible":m,"data-variant":l,"data-side":c,"data-slot":`sidebar`,"data-dragging":p,children:[_,S]}),t[31]=p,t[32]=c,t[33]=f,t[34]=S,t[35]=m,t[36]=_,t[37]=l,t[38]=C):C=t[38],C}function UL(e){let t=(0,$.c)(34),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onClick:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{_:a}=Bn(),{toggleSidebar:o,state:s}=RL(),c,l,u,d,f,p,m,h;if(t[4]!==a||t[5]!==s){let e=Ac(`toggle-files-sidebar`);c=X,l=`trigger`,u=`sidebar-trigger`,d=`ghost`,f=`icon-sm`,p=s===`expanded`,m=jL,h=a(s===`expanded`?{id:`4PYsOz`,values:{sidebarShortcutLabel:e}}:{id:`jbSG8V`,values:{sidebarShortcutLabel:e}}),t[4]=a,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h}else c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13];let g;t[14]===n?g=t[15]:(g=gr(n),t[14]=n,t[15]=g);let _;t[16]!==r||t[17]!==o?(_=e=>{r?.(e),o()},t[16]=r,t[17]=o,t[18]=_):_=t[18];let v;t[19]===s?v=t[20]:(v=s===`expanded`?(0,Z.jsx)(hn,{}):(0,Z.jsx)(ub,{}),t[19]=s,t[20]=v);let y;return t[21]!==c||t[22]!==i||t[23]!==l||t[24]!==v||t[25]!==u||t[26]!==d||t[27]!==f||t[28]!==p||t[29]!==m||t[30]!==h||t[31]!==g||t[32]!==_?(y=(0,Z.jsx)(c,{"data-sidebar":l,"data-slot":u,variant:d,size:f,"aria-expanded":p,"aria-controls":m,"aria-label":h,className:g,onClick:_,...i,children:v}),t[21]=c,t[22]=i,t[23]=l,t[24]=v,t[25]=u,t[26]=d,t[27]=f,t[28]=p,t[29]=m,t[30]=h,t[31]=g,t[32]=_,t[33]=y):y=t[33],y}function WL(e){let t=(0,$.c)(32),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,enableDrag:a,enableToggle:o,onMouseDown:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?!0:a,c=o===void 0?!0:o,{_:l}=Bn(),{toggleSidebar:u,setWidth:d,state:f,width:p,setIsDraggingRail:m}=RL(),h=f===`collapsed`,g;t[6]!==s||t[7]!==c||t[8]!==m||t[9]!==d||t[10]!==h||t[11]!==u||t[12]!==p?(g={direction:`right`,enableDrag:s,enableToggle:c,onResize:d,onToggle:u,currentWidth:p,isCollapsed:h,minResizeWidth:ML,maxResizeWidth:NL,setIsDraggingRail:m,widthCookieName:PL,widthCookieMaxAge:OL},t[6]=s,t[7]=c,t[8]=m,t[9]=d,t[10]=h,t[11]=u,t[12]=p,t[13]=g):g=t[13];let{dragRef:_,handleMouseDown:v}=EL(g),y;t[14]!==l||t[15]!==f?(y=l(f===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[14]=l,t[15]=f,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==r?(b=e=>{r?.(e),e.defaultPrevented||v(e)},t[17]=v,t[18]=r,t[19]=b):b=t[19];let x;t[20]!==l||t[21]!==f?(x=l(f===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[20]=l,t[21]=f,t[22]=x):x=t[22];let S;t[23]===n?S=t[24]:(S=gr(`absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2`,`in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,`md:group-data-[variant=inset]:after:inset-y-5`,n),t[23]=n,t[24]=S);let C;return t[25]!==_||t[26]!==i||t[27]!==y||t[28]!==b||t[29]!==x||t[30]!==S?(C=(0,Z.jsx)(`button`,{ref:_,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":y,tabIndex:-1,onMouseDown:b,title:x,className:S,...i}),t[25]=_,t[26]=i,t[27]=y,t[28]=b,t[29]=x,t[30]=S,t[31]=C):C=t[31],C}function GL(e){let t=(0,$.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onAnimationEnd:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{showPushPulse:a,setShowPushPulse:o}=RL(),s;t[4]!==r||t[5]!==o?(s=e=>{r?.(e),e.animationName===`sidebar-push-pulse`&&o(!1)},t[4]=r,t[5]=o,t[6]=s):s=t[6];let c=s,l=a?``:void 0,u;t[7]===n?u=t[8]:(u=gr(`relative flex w-full flex-1 flex-col bg-background peer-data-[variant=inset]:m-2 peer-data-[variant=inset]:ml-0 peer-data-[variant=inset]:rounded-xl peer-data-[variant=inset]:shadow-sm peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,n),t[7]=n,t[8]=u);let d;return t[9]!==c||t[10]!==i||t[11]!==l||t[12]!==u?(d=(0,Z.jsx)(`main`,{"data-slot":`sidebar-inset`,"data-push-pulse":l,onAnimationEnd:c,className:u,...i}),t[9]=c,t[10]=i,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function KL(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function qL(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function JL(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function YL(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`relative flex w-full min-w-0 flex-col p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function XL(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,asChild:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i?zr:`div`,o;t[4]===n?o=t[5]:(o=gr(`flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(a,{"data-slot":`sidebar-group-label`,"data-sidebar":`group-label`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function ZL(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`w-full text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-group-content`,"data-sidebar":`group-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function QL(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`flex w-full min-w-0 flex-col gap-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function $L(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var eR=Rr(`peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-hover hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-hover active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-hover data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground data-active:hover:bg-sidebar-accent [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate`,{variants:{variant:{default:`hover:bg-sidebar-hover hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-hover hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`}},defaultVariants:{variant:`default`,size:`default`}});function tR(e){let t=(0,$.c)(28),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({asChild:i,isActive:a,variant:o,size:s,tooltip:c,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=i===void 0?!1:i,u=a===void 0?!1:a,d=o===void 0?`default`:o,f=s===void 0?`default`:s,p=l?zr:`button`,{state:m}=RL(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=gr(eR({variant:d,size:f}),n),t[8]=n,t[9]=f,t[10]=d,t[11]=h):h=t[11];let g;t[12]!==p||t[13]!==u||t[14]!==r||t[15]!==f||t[16]!==h?(g=(0,Z.jsx)(p,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":f,"data-active":u,className:h,...r}),t[12]=p,t[13]=u,t[14]=r,t[15]=f,t[16]=h,t[17]=g):g=t[17];let _=g;if(!c)return _;if(typeof c==`string`){let e;t[18]===c?e=t[19]:(e={children:c},t[18]=c,t[19]=e),c=e}let v;t[20]===_?v=t[21]:(v=(0,Z.jsx)(Br,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(Vr,{side:`right`,align:`center`,hidden:y,...c}),t[22]=y,t[23]=c,t[24]=b):b=t[24];let x;return t[25]!==v||t[26]!==b?(x=(0,Z.jsxs)(Ur,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function nR(e){let t=null,n=!1,r=new Set;function i(e){if(e!==t){t=e;for(let e of r)e()}}e.subscribeToEvent(i);async function a(){if(!n){n=!0;try{i(await e.fetchBranch())}catch{}}}return{getSnapshot:()=>t,subscribe(e){return r.add(e),a(),()=>{r.delete(e)}}}}async function rR(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=jo.safeParse(t);return n.success?n.data.currentBranch??null:null}var iR=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:nR({fetchBranch:rR,subscribeToEvent:Jc}),aR=iR.subscribe,oR=iR.getSnapshot;function sR(){return(0,Q.useSyncExternalStore)(aR,oR,oR)}function cR(){let e=(0,$.c)(6),t=sR(),n=gu(),{state:r}=RL(),i=typeof window<`u`?window.okDesktop:void 0;if(i&&r===`expanded`)return null;let a;e[0]===n?a=e[1]:(a=i?.config.projectName??(n&&Ud(n.contentDir)||null),e[0]=n,e[1]=a);let o=a,s=i?.config.projectPath??n?.contentDir??null;if(o===null&&t===null)return null;let c;return e[2]!==t||e[3]!==o||e[4]!==s?(c={projectName:o,projectPath:s,branch:t},e[2]=t,e[3]=o,e[4]=s,e[5]=c):c=e[5],c}function lR(e){let t=(0,$.c)(27),{stats:n,selectionStats:r,showStats:i,composerBadge:a}=e,o=i===void 0?!0:i,{_:s}=Bn(),c=cR();if(!o&&c===null&&a==null)return null;let l=r??n,u=r!=null,{words:d,chars:f,tokens:p}=l,m;t[0]!==s||t[1]!==u||t[2]!==o?(m=s(o?u?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=s,t[1]=u,t[2]=o,t[3]=m):m=t[3];let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[4]=h):h=t[4];let g;t[5]!==s||t[6]!==a?(g=a?(0,Z.jsxs)(X,{type:`button`,variant:`outline`,onClick:a.onReopen,"data-testid":`ask-ai-reopen-badge`,className:`-translate-x-1/2 absolute bottom-0 left-1/2 z-10 h-auto gap-1 rounded-md rounded-b-none bg-card px-2.5 py-0.5 text-2xs font-normal text-muted-foreground shadow-sm hover:text-foreground active:not-aria-[haspopup]:translate-y-0`,children:[(0,Z.jsx)(pt,{className:`size-3`,"aria-hidden":!0}),s({id:`xWEvuo`}),(0,Z.jsx)(Sa,{className:`size-3`,"aria-hidden":!0})]}):null,t[5]=s,t[6]=a,t[7]=g):g=t[7];let _;t[8]===c?_=t[9]:(_=c===null?null:(0,Z.jsx)(uR,{identity:c}),t[8]=c,t[9]=_);let v;t[10]===_?v=t[11]:(v=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:_}),t[10]=_,t[11]=v);let y;t[12]!==s||t[13]!==l.chars||t[14]!==l.tokens||t[15]!==l.words||t[16]!==f||t[17]!==u||t[18]!==o||t[19]!==p||t[20]!==d?(y=o?(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[u?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:s({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:l.words.toLocaleString()}),` `,(0,Z.jsx)(Y,{id:`gljvbT`,values:{words:d}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:l.chars.toLocaleString()}),` `,(0,Z.jsx)(Y,{id:`d5rK4X`,values:{chars:f}})]}),(0,Z.jsxs)(`span`,{children:[l.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:l.tokens.toLocaleString()}),` `,(0,Z.jsx)(Y,{id:`uynXup`,values:{tokens:p}})]})]}):null,t[12]=s,t[13]=l.chars,t[14]=l.tokens,t[15]=l.words,t[16]=f,t[17]=u,t[18]=o,t[19]=p,t[20]=d,t[21]=y):y=t[21];let b;return t[22]!==m||t[23]!==g||t[24]!==v||t[25]!==y?(b=(0,Z.jsxs)(`section`,{"aria-label":m,className:`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[h,g,v,y]}),t[22]=m,t[23]=g,t[24]=v,t[25]=y,t[26]=b):b=t[26],b}function uR(e){let t=(0,$.c)(8),{identity:n}=e,{projectName:r,projectPath:i,branch:a}=n,o;t[0]!==r||t[1]!==i?(o=r===null?null:i?(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(Vr,{side:`top`,className:`max-w-xs break-all`,children:i})]}):(0,Z.jsx)(`span`,{className:`truncate`,"data-testid":`editor-footer-project-name`,children:r}),t[0]=r,t[1]=i,t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=a===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,"data-testid":`editor-footer-branch`,children:[(0,Z.jsx)(vu,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:a})]}),t[3]=a,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,Z.jsxs)(Z.Fragment,{children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function dR(e){let t=(0,$.c)(11),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{_:i}=Bn(),a;t[3]===i?a=t[4]:(a=i({id:`3__SjS`}),t[3]=i,t[4]=a);let o;t[5]===n?o=t[6]:(o=gr(n),t[5]=n,t[6]=o);let s;return t[7]!==r||t[8]!==a||t[9]!==o?(s=(0,Z.jsx)(`nav`,{"aria-label":a,"data-slot":`breadcrumb`,className:o,...r}),t[7]=r,t[8]=a,t[9]=o,t[10]=s):s=t[10],s}function fR(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function pR(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`inline-flex items-center gap-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function mR(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({current:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0||i?`page`:void 0,o;t[4]===n?o=t[5]:(o=gr(`font-normal text-foreground`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`span`,{"data-slot":`breadcrumb-page`,"aria-current":a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function hR(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({children:n,className:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=gr(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(Ku,{}),t[6]=n,t[7]=o);let s;return t[8]!==i||t[9]!==a||t[10]!==o?(s=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-separator`,role:`presentation`,"aria-hidden":`true`,className:a,...i,children:o}),t[8]=i,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}var gR=1,_R=2,vR=4;function yR(e){let t=(0,$.c)(21),{docName:n,includeCurrentPage:r,className:i}=e,a=r===void 0?!1:r;if(!n)return null;let o,s,c,l,u,d;if(t[0]!==i||t[1]!==n||t[2]!==a){d=Symbol.for(`react.early_return_sentinel`);bb0:{let e=us(n),r=e?null:ns(n),f=e?e.folder.split(`/`).filter(Boolean):r?[]:J(n,``).prefix.replace(/\/$/,``).split(`/`).filter(Boolean),p=a?[...f,J(n,``).label]:f;if(p.length===0){d=null;break bb0}let m=a?p.join(`/`):null,h=(e,t)=>({kind:`segment`,value:e,key:p.slice(0,t+1).join(`/`)}),g=p.length>vR?[...p.slice(0,gR).map((e,t)=>h(e,t)),{kind:`ellipsis`,hidden:p.slice(gR,-_R)},...p.slice(-_R).map((e,t)=>h(e,p.length-_R+t))]:p.map((e,t)=>h(e,t));s=dR,t[9]===i?u=t[10]:(u=gr(`flex min-w-0 items-center`,i),t[9]=i,t[10]=u),o=fR;let _=a?`text-sm`:`text-xs`;t[11]===_?c=t[12]:(c=gr(`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70`,_),t[11]=_,t[12]=c),l=g.map((e,t)=>{let n=e.kind===`segment`?e.key:`ellipsis`,r=e.kind===`segment`&&e.key===m;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(hR,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(pR,{className:`shrink-0`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,title:e.hidden.join(` / `),className:`flex size-4 items-center justify-center text-muted-foreground/70`,children:(0,Z.jsx)(Vy,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Mu,{children:e.hidden.join(` / `)})})]}):(0,Z.jsx)(pR,{className:`min-w-0`,children:(0,Z.jsx)(mR,{current:r,className:gr(`min-w-0 truncate font-normal`,r?`font-medium text-foreground`:`text-muted-foreground/70`),title:e.value,children:(0,Z.jsx)(Mu,{children:e.value})})})]},n)})}t[0]=i,t[1]=n,t[2]=a,t[3]=o,t[4]=s,t[5]=c,t[6]=l,t[7]=u,t[8]=d}else o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8];if(d!==Symbol.for(`react.early_return_sentinel`))return d;let f;t[13]!==o||t[14]!==c||t[15]!==l?(f=(0,Z.jsx)(o,{className:c,children:l}),t[13]=o,t[14]=c,t[15]=l,t[16]=f):f=t[16];let p;return t[17]!==s||t[18]!==u||t[19]!==f?(p=(0,Z.jsx)(s,{className:u,children:f}),t[17]=s,t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function bR(e=typeof window>`u`?void 0:window){return e?.okDesktop?.slides!=null}var xR=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillToolbarControls:e}=await import(`./SkillToolbarControls-Bap6lIv8.js`);return{SkillToolbarControls:e}},__vite__mapDeps([187,1,7,8,9,90,43,44,11,12,13,45,40,14,15,42,18,19,17,91,21,92,24,129,130,41,99,16,188,189,72,73,33,80,78,76,74,75,77,37,171,172,66,28,2,3,29,30,31,32,126,10,20,128,118,119,131,71,79,81,82,83,84,85,86,87,88,89,4,5,23,93,94,25,34,56,57,58,95,68,61,96,97,98,64,65,100,55,59,60,62,101,102,103,26,104,105,106,107,35,108,109,110,111,112,113,114,115,163,125,164,127,165,166,143,167,168,147,169,156,141,54,135,139,140,142,190,148,36,191]),import.meta.url)).SkillToolbarControls})),SR=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillOriginInline:e}=await import(`./SkillOriginInline-DpPKdpar.js`);return{SkillOriginInline:e}},__vite__mapDeps([192,1,189,72,73,33,80,78,76,74,75,77,37,7,8,9,16,12,17,18,19,171,172,66,13,10,11,14,15,20,21,93,91,45,42,43,44,54,26,144,116,193,28,2,3,29,30,31,32,84,141,60,112,62]),import.meta.url)).SkillOriginInline})),CR=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SlidesToolbarControls:e}=await import(`./SlidesToolbarControls-BNqlGZ8e.js`);return{SlidesToolbarControls:e}},__vite__mapDeps([194,1,28,2,3,29,30,31,32,33,7,8,9,42,43,44,11,12,13,45,14,18,19,17,16,21,84,114,191]),import.meta.url)).SlidesToolbarControls})),wR=[];function TR(e){let t=(0,$.c)(81),{activeDocName:n,activeProvider:r,isSourceMode:i,sourceDisabled:a,onModeChange:o,showAddPropertyButton:s,onAddProperty:c,frontmatterProblems:l,isPanelCollapsed:u,onTogglePanel:d,reserveRightGutter:f}=e,p=l===void 0?wR:l,m=f===void 0?!1:f,{_:h}=Bn(),g=Pl()?.merged?.slides?.enabled===!0,_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=Lc(`toggle-document-panel`),t[0]=_):_=t[0];let v=_,y,b,x,S,C,w,T;if(t[1]!==h||t[2]!==n||t[3]!==r||t[4]!==p||t[5]!==u||t[6]!==i||t[7]!==c||t[8]!==o||t[9]!==d||t[10]!==m||t[11]!==s||t[12]!==g||t[13]!==a){let e=Ac(`toggle-document-panel`),l=!$c(),f;t[21]===n?f=t[22]:(f=n?ns(n):null,t[21]=n,t[22]=f);let _=f,E;t[23]===n?E=t[24]:(E=n?dm(n):null,t[23]=n,t[24]=E);let D=E,O;t[25]!==_||t[26]!==D?(O=_?.kind===`skill`?{scope:_.scope,name:_.name}:D?{scope:`project`,name:D}:null,t[25]=_,t[26]=D,t[27]=O):O=t[27];let k=O,A,j;t[28]!==k||t[29]!==p?(A=zf(p,k?Af:If),j=A.map(ER),t[28]=k,t[29]=p,t[30]=A,t[31]=j):(A=t[30],j=t[31]);let M=j,N;t[32]===n?N=t[33]:(N=n?To(n):null,t[32]=n,t[33]=N);let P=N,F;t[34]!==n||t[35]!==s?(F=s&&(n===null||!yo(n)),t[34]=n,t[35]=s,t[36]=F):F=t[36];let I=F;w=`editor-toolbar`,T=`pointer-events-none absolute inset-x-0 top-0 z-10 @container/toolbar`;let L;t[37]!==n||t[38]!==k||t[39]!==P?(L=k?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(SR,{scope:k.scope,name:k.name})}):P?null:(0,Z.jsx)(yR,{docName:n}),t[37]=n,t[38]=k,t[39]=P,t[40]=L):L=t[40];let R;t[41]===n?R=t[42]:(R=n===null?null:(0,Z.jsx)(_g,{entry:{kind:`document`,docName:n},className:`shrink-0`}),t[41]=n,t[42]=R);let z;t[43]!==L||t[44]!==R?(z=(0,Z.jsxs)(`div`,{className:`pointer-events-auto flex min-w-0 items-center gap-2`,children:[L,R]}),t[43]=L,t[44]=R,t[45]=z):z=t[45];let B;t[46]!==n||t[47]!==i||t[48]!==o||t[49]!==a?(B=n!==null&&(yo(n)||Xo(n))?null:(0,Z.jsx)(yg,{isSourceMode:i,onModeChange:o,sourceDisabled:a}),t[46]=n,t[47]=i,t[48]=o,t[49]=a,t[50]=B):B=t[50];let V;t[51]===B?V=t[52]:(V=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:B}),t[51]=B,t[52]=V),t[53]!==z||t[54]!==V?(y=(0,Z.jsx)(`div`,{className:`editor-content-aligned bg-background py-2`,children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 items-center`,children:[z,V]})}),t[53]=z,t[54]=V,t[55]=y):y=t[55];let ee=m&&`pr-9`;t[56]===ee?b=t[57]:(b=gr(`pointer-events-auto absolute top-0 right-0 flex min-w-0 max-w-[calc(50%_-_3rem)] items-center justify-end gap-1 py-2 pr-2`,ee),t[56]=ee,t[57]=b),t[58]!==n||t[59]!==k||t[60]!==P||t[61]!==c||t[62]!==M||t[63]!==I||t[64]!==A?(x=k&&n?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(xR,{scope:k.scope,name:k.name,showAddPropertyButton:I,onAddProperty:c,problemCount:A.length,problemMessages:M})}):P?null:I&&(0,Z.jsx)(cu,{onAddProperty:c,problemCount:A.length,problemMessages:M}),t[58]=n,t[59]=k,t[60]=P,t[61]=c,t[62]=M,t[63]=I,t[64]=A,t[65]=x):x=t[65],t[66]!==n||t[67]!==r||t[68]!==g?(S=g&&bR()&&r!=null&&n!==null?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(CR,{provider:r,docName:n})}):null,t[66]=n,t[67]=r,t[68]=g,t[69]=S):S=t[69],C=l?(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(X,{"data-doc-panel-toggle":``,variant:`ghost`,size:`icon`,onClick:d,"aria-expanded":!u,"aria-controls":`doc-panel`,"aria-label":h(u?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),asChild:!0,children:(0,Z.jsx)(Br,{children:u?(0,Z.jsx)(Mp,{}):(0,Z.jsx)(jp,{})})}),(0,Z.jsxs)(Vr,{side:`bottom`,children:[(0,Z.jsx)(`span`,{children:h(u?{id:`6iDEWA`}:{id:`170Js2`})}),` `,(0,Z.jsx)(en,{"aria-label":e,children:v})]})]}):null,t[1]=h,t[2]=n,t[3]=r,t[4]=p,t[5]=u,t[6]=i,t[7]=c,t[8]=o,t[9]=d,t[10]=m,t[11]=s,t[12]=g,t[13]=a,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T}else y=t[14],b=t[15],x=t[16],S=t[17],C=t[18],w=t[19],T=t[20];let E;t[70]!==b||t[71]!==x||t[72]!==S||t[73]!==C?(E=(0,Z.jsxs)(`div`,{className:b,children:[x,S,C]}),t[70]=b,t[71]=x,t[72]=S,t[73]=C,t[74]=E):E=t[74];let D;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[75]=D):D=t[75];let O;return t[76]!==y||t[77]!==E||t[78]!==w||t[79]!==T?(O=(0,Z.jsxs)(`div`,{"data-testid":w,className:T,children:[y,E,D]}),t[76]=y,t[77]=E,t[78]=w,t[79]=T,t[80]=O):O=t[80],O}function ER(e){return e.message}function DR(e,t,n){let r=s_(e);t(r.target,{disposition:`permanent`,consumeActiveNewTab:n}),Wp(r.hash)}function OR({children:e}){return e}function kR(e){let t=(0,$.c)(71),{busy:n,deleteLabel:r,folderCreate:i,folderTree:a,hide:o,openWithAi:s,primitives:c,reveal:l,share:u,onCopyFullPath:d,onCopyRelativePath:f,onDelete:p,onDuplicate:m,onImportTemplate:h,onRename:g,workspaceReady:_}=e,v=n===void 0?!1:n,{Item:y,Separator:b,Sub:x,SubContent:S,SubTrigger:C}=c,w=c.Group??OR,T=a?.onExpandAll!=null||a?.onCollapseAll!=null,E=h!=null||m!=null||g!=null||o!=null||p!=null,D;t[0]!==w||t[1]!==y||t[2]!==b||t[3]!==x||t[4]!==S||t[5]!==C||t[6]!==v||t[7]!==i?(D=i?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(w,{children:[(0,Z.jsxs)(y,{disabled:v,onSelect:i.onNewFile,children:[(0,Z.jsx)(Fp,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`HdkSiO`})]}),i.templateItems?(0,Z.jsxs)(x,{children:[(0,Z.jsxs)(C,{disabled:v,children:[(0,Z.jsx)(yr,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`Uuj_R4`})]}),(0,Z.jsx)(S,{children:(0,Z.jsx)(w,{children:i.templateItems})})]}):null,(0,Z.jsxs)(y,{disabled:v,onSelect:i.onNewFolder,children:[(0,Z.jsx)(Yy,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`96G6Re`})]})]}),(0,Z.jsx)(b,{})]}):null,t[0]=w,t[1]=y,t[2]=b,t[3]=x,t[4]=S,t[5]=C,t[6]=v,t[7]=i,t[8]=D):D=t[8];let O;t[9]!==y||t[10]!==l?(O=l?(0,Z.jsxs)(y,{disabled:l.disabled,onSelect:l.onSelect,"aria-label":l.ariaLabel,children:[(0,Z.jsx)(Wf,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:l.label}),l.hint?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ms-2 text-muted-foreground text-xs`,children:l.hint}):null]}):null,t[9]=y,t[10]=l,t[11]=O):O=t[11];let k;t[12]!==y||t[13]!==u?(k=u?(0,Z.jsxs)(y,{"data-testid":`file-tree-menu-share`,onSelect:u.onSelect,children:[(0,Z.jsx)(Na,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`Z8lGw6`})]}):null,t[12]=y,t[13]=u,t[14]=k):k=t[14];let A,j;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(Fn,{"aria-hidden":`true`}),j=(0,Z.jsx)(Y,{id:`oCZkaG`}),t[15]=A,t[16]=j):(A=t[15],j=t[16]);let M;t[17]===C?M=t[18]:(M=(0,Z.jsxs)(C,{children:[A,j]}),t[17]=C,t[18]=M);let N=!_,P;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(Y,{id:`oQA-cA`}),t[19]=P):P=t[19];let F;t[20]!==y||t[21]!==d||t[22]!==N?(F=(0,Z.jsx)(y,{disabled:N,onSelect:d,children:P}),t[20]=y,t[21]=d,t[22]=N,t[23]=F):F=t[23];let I;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(Y,{id:`s061i4`}),t[24]=I):I=t[24];let L;t[25]!==y||t[26]!==f?(L=(0,Z.jsx)(y,{onSelect:f,children:I}),t[25]=y,t[26]=f,t[27]=L):L=t[27];let R;t[28]!==w||t[29]!==F||t[30]!==L?(R=(0,Z.jsxs)(w,{children:[F,L]}),t[28]=w,t[29]=F,t[30]=L,t[31]=R):R=t[31];let z;t[32]!==S||t[33]!==R?(z=(0,Z.jsx)(S,{children:R}),t[32]=S,t[33]=R,t[34]=z):z=t[34];let B;t[35]!==x||t[36]!==z||t[37]!==M?(B=(0,Z.jsxs)(x,{children:[M,z]}),t[35]=x,t[36]=z,t[37]=M,t[38]=B):B=t[38];let V;t[39]!==w||t[40]!==s||t[41]!==B||t[42]!==O||t[43]!==k?(V=(0,Z.jsxs)(w,{children:[O,s,k,B]}),t[39]=w,t[40]=s,t[41]=B,t[42]=O,t[43]=k,t[44]=V):V=t[44];let ee;t[45]!==w||t[46]!==y||t[47]!==b||t[48]!==a||t[49]!==T?(ee=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(b,{}),(0,Z.jsxs)(w,{children:[a?.onExpandAll?(0,Z.jsxs)(y,{onSelect:a.onExpandAll,children:[(0,Z.jsx)(Bb,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`OlAl5i`})]}):null,a?.onCollapseAll?(0,Z.jsxs)(y,{onSelect:a.onCollapseAll,children:[(0,Z.jsx)(qy,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`qvWGzP`})]}):null]})]}):null,t[45]=w,t[46]=y,t[47]=b,t[48]=a,t[49]=T,t[50]=ee):ee=t[50];let H;t[51]!==w||t[52]!==y||t[53]!==b||t[54]!==x||t[55]!==S||t[56]!==C||t[57]!==v||t[58]!==r||t[59]!==E||t[60]!==o||t[61]!==p||t[62]!==m||t[63]!==h||t[64]!==g?(H=E?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(b,{}),(0,Z.jsxs)(w,{children:[h?(0,Z.jsxs)(x,{children:[(0,Z.jsxs)(C,{disabled:v,children:[(0,Z.jsx)(Gy,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`PYmp-0`})]}),(0,Z.jsx)(S,{children:(0,Z.jsxs)(w,{children:[(0,Z.jsx)(y,{disabled:v,onSelect:()=>h(!1),children:(0,Z.jsx)(Y,{id:`-FeyRg`})}),(0,Z.jsx)(y,{disabled:v,onSelect:()=>h(!0),children:(0,Z.jsx)(Y,{id:`dQHSCs`})})]})})]}):null,m?(0,Z.jsxs)(y,{disabled:v,onSelect:m,children:[(0,Z.jsx)(et,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`euc6Ns`})]}):null,g?(0,Z.jsxs)(y,{disabled:v,onSelect:g,children:[(0,Z.jsx)(Zt,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`2wxgft`})]}):null,o?(0,Z.jsxs)(y,{"data-testid":`file-tree-menu-hide`,disabled:o.disabled,onSelect:o.onSelect,children:[(0,Z.jsx)(xa,{"aria-hidden":`true`}),o.label]}):null,p?(0,Z.jsxs)(y,{variant:`destructive`,disabled:v,onSelect:p,children:[(0,Z.jsx)(Ip,{"aria-hidden":`true`}),r??(0,Z.jsx)(Y,{id:`cnGeoo`})]}):null]})]}):null,t[51]=w,t[52]=y,t[53]=b,t[54]=x,t[55]=S,t[56]=C,t[57]=v,t[58]=r,t[59]=E,t[60]=o,t[61]=p,t[62]=m,t[63]=h,t[64]=g,t[65]=H):H=t[65];let U;return t[66]!==V||t[67]!==ee||t[68]!==H||t[69]!==D?(U=(0,Z.jsxs)(Z.Fragment,{children:[D,V,ee,H]}),t[66]=V,t[67]=ee,t[68]=H,t[69]=D,t[70]=U):U=t[70],U}function AR(e){return e.replace(/\\/g,`\\\\`).replace(/\[/g,`\\[`).replace(/\]/g,`\\]`).replace(/\*/g,`\\*`)}function jR(e){let t=AR(e.path);return e.kind===`folder`?`/${t}/`:`/${t}${e.docExt??`.md`}`}function MR(e){let t=(0,$.c)(21),{parentDir:n,onSelectTemplate:r,ItemComponent:i}=e,{state:a}=hf(n);if(a.status===`idle`||a.status===`loading`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Y,{id:`Hl89Qd`}),t[0]=e):e=t[0];let n;return t[1]===i?n=t[2]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[1]=i,t[2]=n),n}if(a.status===`error`){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Y,{id:`AQ-Lfg`}),t[3]=e):e=t[3];let n;return t[4]===i?n=t[5]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[4]=i,t[5]=n),n}let o,s;if(t[6]!==i||t[7]!==r||t[8]!==a.data.folder.templates_available){s=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[11]===a.data.folder.templates_available?e=t[12]:(e=a.data.folder.templates_available??[],t[11]=a.data.folder.templates_available,t[12]=e);let n=YS(e);if(n.length===0){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Y,{id:`iGCs04`}),t[13]=e):e=t[13];let n;t[14]===i?n=t[15]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[14]=i,t[15]=n),s=n;break bb0}let c;t[16]!==i||t[17]!==r?(c=e=>(0,Z.jsx)(i,{onSelect:()=>r(e.name),children:e.title??e.name},`${e.scope}:${e.source_folder}:${e.name}`),t[16]=i,t[17]=r,t[18]=c):c=t[18],o=n.map(c)}t[6]=i,t[7]=r,t[8]=a.data.folder.templates_available,t[9]=o,t[10]=s}else o=t[9],s=t[10];if(s!==Symbol.for(`react.early_return_sentinel`))return s;let c;return t[19]===o?c=t[20]:(c=(0,Z.jsx)(Z.Fragment,{children:o}),t[19]=o,t[20]=c),c}function NR(e,t){return e?.kind===`doc`||e?.kind===`folder-index`?mu(t.contentDir,hu(e.docName),t.pathSeparator):e?.kind===`folder`?mu(t.contentDir,e.folderPath,t.pathSeparator):e?.kind===`asset`?mu(t.contentDir,e.assetPath,t.pathSeparator):t.contentDir}function PR(e){return e?.kind===`doc`||e?.kind===`folder-index`?hu(e.docName):e?.kind===`folder`?e.folderPath:e?.kind===`asset`?e.assetPath:``}function FR(e,t){return e===null?du({workspace:t}):e.kind===`folder`?t?Ul({folderRelativePath:e.folderPath,workspace:t}):null:e.kind===`doc`||e.kind===`folder-index`?Rl({docName:e.docName,workspace:t}):e.kind===`skill-preview`?Wl({skillName:e.name,scope:e.level??`project`,workspace:t}):e.kind===`skill-file`?Wl({skillName:e.name,scope:e.scope,workspace:t}):null}var IR=`open-knowledge:file-tree-menu-action-delete`,LR=`open-knowledge:file-tree-menu-action-rename`,RR=`open-knowledge:file-tree-menu-action-duplicate`,zR=`open-knowledge:file-tree-menu-action-import-template`;function BR(e,t){window.dispatchEvent(new CustomEvent(e,{detail:t}))}function VR(e,t){let n=e=>{let n=e.detail;n?.target&&t(n)};return window.addEventListener(e,n),()=>window.removeEventListener(e,n)}function HR(e){BR(IR,{target:e})}function UR(e){return VR(IR,({target:t})=>e(t))}function WR(e,t){BR(LR,{target:e,nextName:t})}function GR(e){return VR(LR,({target:t,nextName:n})=>e(t,n))}function KR(e){BR(RR,{target:e})}function qR(e){return VR(RR,({target:t})=>e(t))}function JR(e,t){BR(zR,{target:e,deleteSource:t})}function YR(e){return VR(zR,({target:t,deleteSource:n})=>e(t,n))}var XR={Group:oa,Item:Zi,Separator:sa,Sub:Qi,SubContent:$i,SubTrigger:ia};function ZR(e,t){return e.kind!==`doc`||/\.(md|mdx)$/i.test(e.docName)?PR(e):`${e.docName}${t??`.md`}`}function QR(e){return e.kind===`asset`?null:e.kind===`folder`?Xd(e.folderPath):_f(e.docName)}function $R(e,t){return e.kind===`doc`?{kind:`file`,path:e.docName,docExt:t}:e.kind===`folder`?{kind:`folder`,path:e.folderPath}:null}function ez(e){let t=(0,$.c)(90),{docExt:n,target:r,onRename:i}=e,{_:a}=Bn(),o=gu(),{okignoreBinding:s}=Fl(),{status:c}=xu(),l=Sr().states,{dispatch:u}=Ll(),d,f,p,m,h,g,_,v,y,b,x,S,C,w;if(t[0]!==a||t[1]!==n||t[2]!==c?.hasRemote||t[3]!==s||t[4]!==r||t[5]!==o){x=ZR(r,n),v=wm(x),g=r.kind===`asset`,_=r.kind===`folder`,d=typeof window<`u`?window.okDesktop:void 0;let e;t[20]!==g||t[21]!==r||t[22]!==o?(e=g?null:FR(r,o),t[20]=g,t[21]=r,t[22]=o,t[23]=e):e=t[23],m=e;let i;t[24]===r?i=t[25]:(i=QR(r),t[24]=r,t[25]=i);let l=i;f=c?.hasRemote===!0&&l!==null,b=$R(r,n);let u;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(u=function(e,t,n){_r(e).then(()=>Dc.success(t,{description:e})).catch(e=>{console.warn(`[EditorTabTargetMenuItems] clipboard write failed:`,e),Dc.error(n)})},t[26]=u):u=t[26],p=u;let T;t[27]!==a||t[28]!==l?(T=function(){l&&Hd({...l,hasRemote:!0,onClickWhenNoRemote:()=>Dc.error(a({id:`WyQxwa`}))},{clipboardWrite:_r,toastSuccess:rz,toastError:nz,logEvent:tz})},t[27]=a,t[28]=l,t[29]=T):T=t[29],C=T,h=function(){if(!s||!b)return;let e=cf(s.current()),t=Vd(e,jR(b));if(t===e)return;s.patch(Jd(t));let n=x.split(`/`).pop()??x;Dc.success(a(_?{id:`4xtLTl`,values:{basename:n}}:{id:`OD0FCX`,values:{basename:n}}),{description:a({id:`nWv1ja`}),duration:5e3})};let E;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(E=Rg(d?.platform??`linux`),t[30]=E):E=t[30],S=E;let D;t[31]!==a||t[32]!==o?(D=o?null:a({id:`wTcjov`}),t[31]=a,t[32]=o,t[33]=D):D=t[33],y=D,w=o?mu(o.contentDir,x,o.pathSeparator):``,t[0]=a,t[1]=n,t[2]=c?.hasRemote,t[3]=s,t[4]=r,t[5]=o,t[6]=d,t[7]=f,t[8]=p,t[9]=m,t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w}else d=t[6],f=t[7],p=t[8],m=t[9],h=t[10],g=t[11],_=t[12],v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18],w=t[19];let T=w,E=o!==null,D;t[34]!==_||t[35]!==v||t[36]!==r.folderPath?(D=_&&!v?{onNewFile:()=>NO({initialDir:r.folderPath}),onNewFolder:()=>NO({initialDir:r.folderPath,kind:`folder`}),templateItems:(0,Z.jsx)(MR,{parentDir:r.folderPath,onSelectTemplate:e=>NO({template:{folder:r.folderPath,name:e}}),ItemComponent:Zi})}:void 0,t[34]=_,t[35]=v,t[36]=r.folderPath,t[37]=D):D=t[37];let O;t[38]!==d||t[39]!==T||t[40]!==y||t[41]!==S||t[42]!==o?(O=d?{label:S,ariaLabel:y?`${S}, ${y}`:S,disabled:!o,hint:y,onSelect:()=>{o&&d.shell.showItemInFolder(T)}}:void 0,t[38]=d,t[39]=T,t[40]=y,t[41]=S,t[42]=o,t[43]=O):O=t[43];let k;t[44]!==u||t[45]!==m||t[46]!==l||t[47]!==g?(k=g?void 0:(0,Z.jsx)(au,{input:m,installStates:l,dispatch:u}),t[44]=u,t[45]=m,t[46]=l,t[47]=g,t[48]=k):k=t[48];let A;t[49]!==f||t[50]!==C?(A=f?{onSelect:C}:void 0,t[49]=f,t[50]=C,t[51]=A):A=t[51];let j;t[52]!==a||t[53]!==p||t[54]!==T||t[55]!==o?(j=()=>{o&&p(T,a({id:`6_ZOw4`}),a({id:`vfRlCI`}))},t[52]=a,t[53]=p,t[54]=T,t[55]=o,t[56]=j):j=t[56];let M;t[57]!==a||t[58]!==p||t[59]!==x?(M=()=>p(x,a({id:`haHgQj`}),a({id:`5QGTaA`})),t[57]=a,t[58]=p,t[59]=x,t[60]=M):M=t[60];let N;t[61]!==v||t[62]!==r?(N=r.kind===`doc`&&!v?e=>JR(r,e):void 0,t[61]=v,t[62]=r,t[63]=N):N=t[63];let P;t[64]!==g||t[65]!==v||t[66]!==r?(P=!g&&!v?()=>KR(r):void 0,t[64]=g,t[65]=v,t[66]=r,t[67]=P):P=t[67];let F=v?void 0:i,I;t[68]!==h||t[69]!==_||t[70]!==v||t[71]!==s||t[72]!==b?(I=b&&!v?{label:_?(0,Z.jsx)(Y,{id:`5D3Ior`}):(0,Z.jsx)(Y,{id:`dbhUX1`}),disabled:s===null,onSelect:h}:void 0,t[68]=h,t[69]=_,t[70]=v,t[71]=s,t[72]=b,t[73]=I):I=t[73];let L;t[74]!==v||t[75]!==r?(L=v?void 0:()=>HR(r),t[74]=v,t[75]=r,t[76]=L):L=t[76];let R;return t[77]!==P||t[78]!==F||t[79]!==I||t[80]!==L||t[81]!==E||t[82]!==D||t[83]!==O||t[84]!==k||t[85]!==A||t[86]!==j||t[87]!==M||t[88]!==N?(R=(0,Z.jsx)(kR,{primitives:XR,workspaceReady:E,folderCreate:D,reveal:O,openWithAi:k,share:A,onCopyFullPath:j,onCopyRelativePath:M,onImportTemplate:N,onDuplicate:P,onRename:F,hide:I,onDelete:L}),t[77]=P,t[78]=F,t[79]=I,t[80]=L,t[81]=E,t[82]=D,t[83]=O,t[84]=k,t[85]=A,t[86]=j,t[87]=M,t[88]=N,t[89]=R):R=t[89],R}function tz(e){return console.log(e)}function nz(e){return Dc.error(e)}function rz(e){return Dc.success(e)}function iz(e,t){return t.trim()}function az(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function oz(e,t){let n=iz(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function sz(e,t,n=[],r=[],i=[]){if(t.length===0&&n.length===0&&r.length===0&&i.length===0)return e;let a=new Map(t.map(e=>[e.fromDocName,e.toDocName])),o=new Map(i.map(e=>[e.toDocName,e.docExt])),s=new Map(r.map(e=>[e.fromPath,e.toPath]));return e.map(e=>{if(ym(e)){let t=s.get(m_(e.docName,e.docExt));if(t){let n=Em(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:Go(n),size:e.size,modified:e.modified,referencedBy:[]}}let n=a.get(e.docName)??e.docName;return{...e,docName:n,docExt:o.get(n)??e.docExt}}if(Sm(e))return{...e,path:pz(e.path,n)};if(Tm(e)){let t=s.get(e.path);return t&&yh(t)?{kind:`document`,docName:y_(t),docExt:xh(t),size:e.size,modified:e.modified}:{...e,path:t??pz(e.path,n)}}return e})}function cz(e,t,n,r=[]){if(t.length===0&&!n&&r.length===0)return e;let i=new Set(t),a=new Set(r);return e.filter(e=>ym(e)?!i.has(e.docName)&&!_z(e.docName,n):Sm(e)?!_z(e.path,n):Tm(e)?!a.has(e.path)&&!_z(e.path,n):!0)}function lz(e,t){if(e.kind!==`asset`||t.some(t=>Tm(t)&&t.path===e.path))return e;let n=b_(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function uz(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>mz(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>ym(e)&&e.docName===t.path);return o({kind:`document`,docName:n.path,docExt:s?.docExt??t.docExt,size:s?.size??0,modified:r}),i?a:e}let s=e.find(e=>Sm(e)&&e.path===t.path);o({kind:`folder`,path:n.path,size:s?.size??0,modified:r});let c=new Set(n.duplicatedDocNames);for(let i of e){if(ym(i)){let e=gz(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Sm(i)){let e=hz(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function dz(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function fz(e,t){let n=e.kind===`file`?m_(e.path,e.docExt):e.path;return mu(t.contentDir,n,t.pathSeparator)}function pz(e,t){for(let{fromPath:n,toPath:r}of t){if(e===n)return r;if(e.startsWith(`${n}/`))return`${r}${e.slice(n.length)}`}return e}function mz(e,t){return ym(e)&&ym(t)?e.docName===t.docName:Sm(e)&&Sm(t)||Tm(e)&&Tm(t)?e.path===t.path:!1}function hz(e,t,n){return e===t?n:gz(e,t,n)}function gz(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function _z(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function vz(e){let t=(0,$.c)(33),{currentName:n,open:r,onOpenChange:i,onSave:a}=e,[o,s]=(0,Q.useState)(n),c,l;t[0]!==n||t[1]!==o?(c=o.trim(),l=az(c)&&c!==n,t[0]=n,t[1]=o,t[2]=c,t[3]=l):(c=t[2],l=t[3]);let u=l,d;t[4]!==u||t[5]!==c||t[6]!==i||t[7]!==a?(d=function(e){e.preventDefault(),u&&(i(!1),a(c))},t[4]=u,t[5]=c,t[6]=i,t[7]=a,t[8]=d):d=t[8];let f=d,p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)($r,{children:(0,Z.jsx)(Jr,{children:(0,Z.jsx)(Y,{id:`2wxgft`})})}),t[9]=p):p=t[9];let m;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(jh,{htmlFor:`file-target-rename-name`,children:(0,Z.jsx)(Y,{id:`6YtxFj`})}),t[10]=m):m=t[10];let h;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>s(e.currentTarget.value),t[11]=h):h=t[11];let g;t[12]===o?g=t[13]:(g=(0,Z.jsx)(kh,{children:(0,Z.jsxs)(Ph,{children:[m,(0,Z.jsx)(dh,{id:`file-target-rename-name`,autoFocus:!0,value:o,onChange:h})]})}),t[12]=o,t[13]=g);let _;t[14]===i?_=t[15]:(_=()=>i(!1),t[14]=i,t[15]=_);let v;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(Y,{id:`dEgA5A`}),t[16]=v):v=t[16];let y;t[17]===_?y=t[18]:(y=(0,Z.jsx)(X,{type:`button`,variant:`outline`,onClick:_,children:v}),t[17]=_,t[18]=y);let b=!u,x;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(Y,{id:`tfDRzk`}),t[19]=x):x=t[19];let S;t[20]===b?S=t[21]:(S=(0,Z.jsx)(X,{type:`submit`,disabled:b,children:x}),t[20]=b,t[21]=S);let C;t[22]!==S||t[23]!==y?(C=(0,Z.jsxs)(Zr,{children:[y,S]}),t[22]=S,t[23]=y,t[24]=C):C=t[24];let w;t[25]!==f||t[26]!==C||t[27]!==g?(w=(0,Z.jsx)(Yr,{children:(0,Z.jsxs)(`form`,{className:`flex flex-col gap-6`,onSubmit:f,children:[p,g,C]})}),t[25]=f,t[26]=C,t[27]=g,t[28]=w):w=t[28];let T;return t[29]!==i||t[30]!==r||t[31]!==w?(T=(0,Z.jsx)(ei,{open:r,onOpenChange:i,children:w}),t[29]=i,t[30]=r,t[31]=w,t[32]=T):T=t[32],T}var yz=`group @container/tab relative -mb-px flex h-10 min-w-32 max-w-48 grow-0 basis-36 shrink cursor-grab items-center overflow-hidden border border-transparent font-medium outline-none focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:ring-inset active:cursor-grabbing`,bz=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,xz=`rounded-t-md text-muted-foreground hover:border-border/70 hover:bg-muted/60 hover:text-foreground focus-visible:border-border focus-visible:bg-muted focus-visible:text-foreground`,Sz=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden pl-3 pr-1.5 text-left text-[13px] outline-none @max-[5rem]/tab:pl-2`;function Cz(e,t){return gr(Sz,e&&`font-semibold`,t&&`italic`)}function wz(e){return e?`overflow-hidden whitespace-nowrap mask-r-from-[calc(100%-1.5rem)] mask-r-to-[100%]`:`truncate group-hover:text-clip group-hover:mask-r-from-[calc(100%-3rem)] group-hover:mask-r-to-[calc(100%-1.5rem)]`}function Tz(e){let t=e.closest(`[data-editor-tab-overflow-root]`);if(!t)return;let n=Math.max(0,e.scrollWidth-e.clientWidth);t.toggleAttribute(`data-overflow-left`,e.scrollLeft>1),t.toggleAttribute(`data-overflow-right`,e.scrollLeft<n-1)}function Ez(e){return e.metaKey||e.ctrlKey}var Dz=1e3,Oz=new Set;function kz(e,t){return e<0||e>=t?null:e<8?String(e+1):e===t-1?`9`:null}function Az(e,t){let n=kz(e,t);if(n)return[`Meta+${n}`,`Control+${n}`].join(` `)}function jz(e,t){if(!Ez(e)||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key))return null;let n=Number(e.key);if(n===9)return t>0?t-1:null;let r=n-1;return r<Math.min(8,t)?r:null}function Mz(e){let t=(0,$.c)(2),{value:n}=e,r=`⌘${n}`,i;return t[0]===r?i=t[1]:(i=(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`editor-tab-shortcut-hint`,className:`mr-1 flex h-5 w-fit shrink-0 items-center justify-center font-mono tabular-nums @max-[5rem]/tab:hidden`,children:(0,Z.jsx)(en,{className:`px-0.5 text-[10px]`,children:r})}),t[0]=r,t[1]=i),i}function Nz(e){let t=(0,$.c)(52),n,r,i,a,o,s,c,l,u,d,f,p;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=t[12]):({activateFromKeyboard:n,children:r,className:i,dropIndicatorSide:a,label:o,paneId:u,splittable:f,tabId:p,onKeyDown:s,ref:c,style:l,...d}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p);let m;t[13]!==o||t[14]!==u||t[15]!==f||t[16]!==p?(m={kind:`editor-tab`,paneId:u,tabId:p,splittable:f,label:o},t[13]=o,t[14]=u,t[15]=f,t[16]=p,t[17]=m):m=t[17];let h=m,g;t[18]!==h||t[19]!==p?(g={animateLayoutChanges:Pz,id:p,data:h,transition:null},t[18]=h,t[19]=p,t[20]=g):g=t[20];let{attributes:_,listeners:v,rect:y,setNodeRef:b,transform:x,transition:S,isDragging:C}=bg(g),w=y.current?.width,T;t[21]!==C||t[22]!==l||t[23]!==w||t[24]!==x||t[25]!==S?(T=cl({activeWidth:w,disableMovement:!0,isDragging:C,outerStyle:l,transform:x,transition:S}),t[21]=C,t[22]=l,t[23]=w,t[24]=x,t[25]=S,t[26]=T):T=t[26];let E=T,D;t[27]!==c||t[28]!==b?(D=function(e){b(e),typeof c==`function`?c(e):c&&`current`in c&&(c.current=e)},t[27]=c,t[28]=b,t[29]=D):D=t[29];let O=D,k=v?.onKeyDown,A;t[30]!==n||t[31]!==C||t[32]!==s||t[33]!==k?(A=function(e){if(s?.(e),!e.defaultPrevented&&yl(e)){e.preventDefault();let t=e.currentTarget.getBoundingClientRect();e.currentTarget.dispatchEvent(new MouseEvent(`contextmenu`,{bubbles:!0,cancelable:!0,clientX:t.left+Math.min(t.width/2,16),clientY:t.top+t.height/2,view:window}));return}let t=sl({event:e,hasKeyboardActivation:!!n,isDragging:C});if(t!==`ignore`){if(t===`activate-tab`&&n){e.preventDefault(),n();return}k?.(e)}},t[30]=n,t[31]=C,t[32]=s,t[33]=k,t[34]=A):A=t[34];let j=A,M;t[35]!==i||t[36]!==C?(M=vl({className:i,isDragging:C}),t[35]=i,t[36]=C,t[37]=M):M=t[37];let N;t[38]===a?N=t[39]:(N=a?(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-editor-tab-drop-indicator":a,className:gr(`pointer-events-none absolute inset-y-1 z-30 w-0.5 rounded-full bg-primary`,a===`before`?`left-0`:`right-0`)}):null,t[38]=a,t[39]=N);let P;return t[40]!==_||t[41]!==r||t[42]!==O||t[43]!==j||t[44]!==v||t[45]!==u||t[46]!==d||t[47]!==E||t[48]!==M||t[49]!==N||t[50]!==p?(P=(0,Z.jsxs)(`div`,{ref:O,"data-editor-tab-sortable":``,"data-editor-pane-id":u,"data-editor-tab-id":p,className:M,style:E,...d,..._,...v,onKeyDown:j,children:[r,N]}),t[40]=_,t[41]=r,t[42]=O,t[43]=j,t[44]=v,t[45]=u,t[46]=d,t[47]=E,t[48]=M,t[49]=N,t[50]=p,t[51]=P):P=t[51],P}function Pz(){return!1}function Fz(e){let t=(0,$.c)(102),{canSplit:n,children:r,closeTab:i,closeTabs:a,canPin:o,docExt:s,isPreview:c,openTabs:l,pinTab:u,pinnedTabIds:d,promoteTab:f,splitTab:p,skillMenuItems:m,tabLabel:h,tabId:g,target:_,renameName:v,unpinTab:y}=e,b=n===void 0?!0:n,x=o===void 0?!0:o,S=c===void 0?!1:c,[C,w]=(0,Q.useState)(!1),T;t[0]!==x||t[1]!==d||t[2]!==g?(T=x&&d.includes(g),t[0]=x,t[1]=d,t[2]=g,t[3]=T):T=t[3];let E=T,D;if(t[4]!==l||t[5]!==d||t[6]!==g){let e;t[8]===g?e=t[9]:(e=e=>e!==g,t[8]=g,t[9]=e),D=Ne(l.filter(e),d),t[4]=l,t[5]=d,t[6]=g,t[7]=D}else D=t[7];let O=D,k;t[10]!==l||t[11]!==d?(k=Ne(l,d),t[10]=l,t[11]=d,t[12]=k):k=t[12];let A=k,j=b&&l.length>1,M;t[13]===g?M=t[14]:(M=ze(g),t[13]=g,t[14]=M);let N=M,P=N.kind===`doc`&&_&&typeof window<`u`&&window.okDesktop?N.docName:null,F;t[15]===r?F=t[16]:(F=(0,Z.jsx)(ta,{asChild:!0,children:r}),t[15]=r,t[16]=F);let I;t[17]!==i||t[18]!==g?(I=()=>i(g),t[17]=i,t[18]=g,t[19]=I):I=t[19];let L,R;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(zp,{"aria-hidden":`true`}),R=(0,Z.jsx)(Y,{id:`yz7wBu`}),t[20]=L,t[21]=R):(L=t[20],R=t[21]);let z;t[22]!==E||t[23]!==I?(z=(0,Z.jsxs)(Zi,{disabled:E,onSelect:I,children:[L,R]}),t[22]=E,t[23]=I,t[24]=z):z=t[24];let B=O.length===0,V;t[25]!==a||t[26]!==O?(V=()=>{a(O)},t[25]=a,t[26]=O,t[27]=V):V=t[27];let ee,H;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(Ry,{"aria-hidden":`true`}),H=(0,Z.jsx)(Y,{id:`omXJcU`}),t[28]=ee,t[29]=H):(ee=t[28],H=t[29]);let U;t[30]!==B||t[31]!==V?(U=(0,Z.jsxs)(Zi,{disabled:B,onSelect:V,children:[ee,H]}),t[30]=B,t[31]=V,t[32]=U):U=t[32];let W=A.length===0,G;t[33]!==A||t[34]!==a?(G=()=>{a(A)},t[33]=A,t[34]=a,t[35]=G):G=t[35];let te;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(Ip,{"aria-hidden":`true`}),t[36]=te):te=t[36];let ne;t[37]===d.length?ne=t[38]:(ne=d.length?(0,Z.jsx)(Y,{id:`U2Kx6T`}):(0,Z.jsx)(Y,{id:`WyXG7w`}),t[37]=d.length,t[38]=ne);let re;t[39]!==W||t[40]!==G||t[41]!==ne?(re=(0,Z.jsxs)(Zi,{disabled:W,"data-testid":`editor-tab-context-close-all`,onSelect:G,children:[te,ne]}),t[39]=W,t[40]=G,t[41]=ne,t[42]=re):re=t[42];let K;t[43]!==z||t[44]!==U||t[45]!==re?(K=(0,Z.jsxs)(oa,{children:[z,U,re]}),t[43]=z,t[44]=U,t[45]=re,t[46]=K):K=t[46];let ie;t[47]!==s||t[48]!==m||t[49]!==_?(ie=_||m?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(sa,{}),_?(0,Z.jsx)(ez,{docExt:s,target:_,onRename:()=>w(!0)}):null,m]}):null,t[47]=s,t[48]=m,t[49]=_,t[50]=ie):ie=t[50];let q;t[51]!==S||t[52]!==f||t[53]!==g?(q=S&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(sa,{}),(0,Z.jsxs)(Zi,{"data-testid":`editor-tab-context-keep-open`,onSelect:()=>f(g),children:[(0,Z.jsx)(mb,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`GH02QY`})]})]}),t[51]=S,t[52]=f,t[53]=g,t[54]=q):q=t[54];let ae;t[55]!==x||t[56]!==E||t[57]!==u||t[58]!==g||t[59]!==y?(ae=x&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(sa,{}),(0,Z.jsxs)(Zi,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>E?y(g):u(g),children:[(0,Z.jsx)(mb,{"aria-hidden":`true`}),E?(0,Z.jsx)(Y,{id:`SYfHmN`}):(0,Z.jsx)(Y,{id:`3pU8e-`})]})]}),t[55]=x,t[56]=E,t[57]=u,t[58]=g,t[59]=y,t[60]=ae):ae=t[60];let oe;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(sa,{}),t[61]=oe):oe=t[61];let se=!j,ce;t[62]!==p||t[63]!==g||t[64]!==h?(ce=()=>p(g,`left`,h),t[62]=p,t[63]=g,t[64]=h,t[65]=ce):ce=t[65];let le,ue;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(hn,{"aria-hidden":`true`}),ue=(0,Z.jsx)(Y,{id:`pCralD`}),t[66]=le,t[67]=ue):(le=t[66],ue=t[67]);let de;t[68]!==se||t[69]!==ce?(de=(0,Z.jsxs)(Zi,{disabled:se,"data-testid":`editor-tab-context-split-left`,onSelect:ce,children:[le,ue]}),t[68]=se,t[69]=ce,t[70]=de):de=t[70];let fe=!j,pe;t[71]!==p||t[72]!==g||t[73]!==h?(pe=()=>p(g,`right`,h),t[71]=p,t[72]=g,t[73]=h,t[74]=pe):pe=t[74];let J,me;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(tl,{"aria-hidden":`true`}),me=(0,Z.jsx)(Y,{id:`jeCFV7`}),t[75]=J,t[76]=me):(J=t[75],me=t[76]);let he;t[77]!==fe||t[78]!==pe?(he=(0,Z.jsxs)(Zi,{disabled:fe,"data-testid":`editor-tab-context-split-right`,onSelect:pe,children:[J,me]}),t[77]=fe,t[78]=pe,t[79]=he):he=t[79];let ge;t[80]===P?ge=t[81]:(ge=P?(0,Z.jsxs)(Zi,{"data-testid":`editor-tab-context-open-in-new-window`,onSelect:()=>{Yx(P,`tab-menu`)},children:[(0,Z.jsx)(Cb,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`E91VZY`})]}):null,t[80]=P,t[81]=ge);let _e;t[82]!==de||t[83]!==he||t[84]!==ge?(_e=(0,Z.jsxs)(oa,{children:[de,he,ge]}),t[82]=de,t[83]=he,t[84]=ge,t[85]=_e):_e=t[85];let ve;t[86]!==K||t[87]!==ie||t[88]!==q||t[89]!==ae||t[90]!==_e?(ve=(0,Z.jsxs)(ra,{className:`min-w-56`,children:[K,ie,q,ae,oe,_e]}),t[86]=K,t[87]=ie,t[88]=q,t[89]=ae,t[90]=_e,t[91]=ve):ve=t[91];let ye;t[92]!==ve||t[93]!==F?(ye=(0,Z.jsxs)(ea,{children:[F,ve]}),t[92]=ve,t[93]=F,t[94]=ye):ye=t[94];let be;t[95]!==v||t[96]!==C||t[97]!==_?(be=C&&_&&v?(0,Z.jsx)(vz,{currentName:v,open:!0,onOpenChange:w,onSave:e=>WR(_,e)}):null,t[95]=v,t[96]=C,t[97]=_,t[98]=be):be=t[98];let xe;return t[99]!==ye||t[100]!==be?(xe=(0,Z.jsxs)(Z.Fragment,{children:[ye,be]}),t[99]=ye,t[100]=be,t[101]=xe):xe=t[101],xe}function Iz(e){let t=(0,$.c)(28),{accessibleLabel:n,closeTab:r,forceCloseVisible:i,isActive:a,isPinned:o,shortcutHint:s,tabId:c,unpinTab:l}=e,u=i===void 0?!1:i,d=s===void 0?null:s,{_:f}=Bn();if(d){let e;return t[0]===d?e=t[1]:(e=(0,Z.jsx)(Mz,{value:d}),t[0]=d,t[1]=e),e}if(o){let e;t[2]!==f||t[3]!==n?(e=f({id:`t18QYR`,values:{accessibleLabel:n}}),t[2]=f,t[3]=n,t[4]=e):e=t[4];let r;t[5]!==c||t[6]!==l?(r=e=>{e.stopPropagation(),l(c)},t[5]=c,t[6]=l,t[7]=r):r=t[7];let i;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(mb,{"aria-hidden":`true`}),t[8]=i):i=t[8];let a;return t[9]!==e||t[10]!==r?(a=(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,"data-testid":`editor-tab-unpin-button`,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[9]=e,t[10]=r,t[11]=a):a=t[11],a}let p;t[12]!==f||t[13]!==n?(p=f({id:`JLzQi_`,values:{accessibleLabel:n}}),t[12]=f,t[13]=n,t[14]=p):p=t[14];let m=u||a,h;t[15]===m?h=t[16]:(h=hl(m),t[15]=m,t[16]=h);let g;t[17]===a?g=t[18]:(g=fl(a),t[17]=a,t[18]=g);let _;t[19]!==r||t[20]!==c?(_=e=>{e.stopPropagation(),r(c)},t[19]=r,t[20]=c,t[21]=_):_=t[21];let v;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(zp,{"aria-hidden":`true`}),t[22]=v):v=t[22];let y;return t[23]!==p||t[24]!==h||t[25]!==g||t[26]!==_?(y=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":p,"data-testid":`editor-tab-close-button`,className:h,tabIndex:g,onClick:_,children:v}),t[23]=p,t[24]=h,t[25]=g,t[26]=_,t[27]=y):y=t[27],y}function Lz(e){let t=(0,$.c)(7),{children:n,path:r}=e,{active:i}=Og();if(i)return n;let a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(Br,{asChild:!0,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Z.jsx)(Vr,{side:`bottom`,sideOffset:8,className:`max-w-xs break-all`,children:r}),t[2]=r,t[3]=o);let s;return t[4]!==a||t[5]!==o?(s=(0,Z.jsxs)(Ur,{children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6],s}function Rz(e){let t=(0,$.c)(1),{hasConflict:n}=e;if(!n)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Lp,{"aria-hidden":`true`,"data-testid":`editor-tab-conflict-badge`,className:`mr-1 size-3.5 shrink-0 text-amber-500`}),t[0]=r):r=t[0],r}function zz(e){let t=(0,$.c)(37),{accessibleLabel:n,activateTab:r,baseName:i,docName:a,extension:o,hideDocExtension:s,isActive:c,isFocusedPane:l,isPreview:u,promoteTab:d,tabId:f}=e,{_:p}=Bn(),m=nj(a)===`conflict`,h;t[0]!==p||t[1]!==n||t[2]!==m?(h=m?p({id:`mVFyH-`,values:{accessibleLabel:n}}):n,t[0]=p,t[1]=n,t[2]=m,t[3]=h):h=t[3];let g=h,_=c&&l,v;t[4]!==u||t[5]!==_?(v=Cz(_,u),t[4]=u,t[5]=_,t[6]=v):v=t[6];let y;t[7]!==r||t[8]!==f?(y=()=>{r(f)},t[7]=r,t[8]=f,t[9]=y):y=t[9];let b;t[10]!==d||t[11]!==f?(b=e=>{e.preventDefault(),e.stopPropagation(),d(f)},t[10]=d,t[11]=f,t[12]=b):b=t[12];let x;t[13]===m?x=t[14]:(x=(0,Z.jsx)(Rz,{hasConflict:m}),t[13]=m,t[14]=x);let S=c?`fade`:`ellipsis`,C;t[15]===c?C=t[16]:(C=gr(`min-w-0 flex-1`,wz(c)),t[15]=c,t[16]=C);let w;t[17]!==i||t[18]!==S||t[19]!==C?(w=(0,Z.jsx)(`span`,{"data-editor-tab-title-overflow":S,className:C,children:i}),t[17]=i,t[18]=S,t[19]=C,t[20]=w):w=t[20];let T;t[21]!==o||t[22]!==s?(T=!s&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:o}),t[21]=o,t[22]=s,t[23]=T):T=t[23];let E;t[24]!==T||t[25]!==w?(E=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[w,T]}),t[24]=T,t[25]=w,t[26]=E):E=t[26];let D;t[27]!==g||t[28]!==E||t[29]!==v||t[30]!==y||t[31]!==b||t[32]!==x?(D=(0,Z.jsxs)(`button`,{type:`button`,"aria-label":g,dir:`auto`,className:v,onClick:y,onDoubleClick:b,tabIndex:-1,children:[x,E]}),t[27]=g,t[28]=E,t[29]=v,t[30]=y,t[31]=b,t[32]=x,t[33]=D):D=t[33];let O;return t[34]!==g||t[35]!==D?(O=(0,Z.jsx)(Lz,{path:g,children:D}),t[34]=g,t[35]=D,t[36]=O):O=t[36],O}function Bz(e){let t=(0,$.c)(53),{accessibleLabel:n,activateTab:r,ariaKeyShortcuts:i,children:a,closeTab:o,closeTabs:s,docExt:c,dropIndicatorSide:l,forceCloseVisible:u,isActive:d,isPinned:f,isPreview:p,openTabs:m,paneId:h,pinTab:g,pinnedTabIds:_,promoteTab:v,renameName:y,shortcutHint:b,splitTab:x,skillMenuItems:S,tabId:C,target:w,unpinTab:T}=e,E;t[0]!==r||t[1]!==C?(E=()=>r(C),t[0]=r,t[1]=C,t[2]=E):E=t[2];let D=d?`page`:void 0,O=d?`true`:void 0,k=p?`true`:void 0,A=d?bz:xz,j;t[3]===A?j=t[4]:(j=gr(yz,A),t[3]=A,t[4]=j);let M;t[5]!==o||t[6]!==f||t[7]!==C?(M=e=>{e.button===1&&(e.preventDefault(),f||o(C))},t[5]=o,t[6]=f,t[7]=C,t[8]=M):M=t[8];let N;t[9]!==r||t[10]!==C?(N=e=>{e.target===e.currentTarget&&r(C)},t[9]=r,t[10]=C,t[11]=N):N=t[11];let P;t[12]!==n||t[13]!==o||t[14]!==u||t[15]!==d||t[16]!==f||t[17]!==b||t[18]!==C||t[19]!==T?(P=(0,Z.jsx)(Iz,{accessibleLabel:n,closeTab:o,forceCloseVisible:u,isActive:d,isPinned:f,shortcutHint:b,tabId:C,unpinTab:T}),t[12]=n,t[13]=o,t[14]=u,t[15]=d,t[16]=f,t[17]=b,t[18]=C,t[19]=T,t[20]=P):P=t[20];let F;t[21]!==n||t[22]!==i||t[23]!==a||t[24]!==l||t[25]!==h||t[26]!==E||t[27]!==D||t[28]!==O||t[29]!==k||t[30]!==j||t[31]!==M||t[32]!==N||t[33]!==P||t[34]!==C?(F=(0,Z.jsxs)(Nz,{dropIndicatorSide:l,label:n,paneId:h,splittable:!0,tabId:C,activateFromKeyboard:E,"aria-current":D,"aria-keyshortcuts":i,"data-active-tab":O,"data-preview-tab":k,className:j,onAuxClick:M,onClick:N,children:[a,P]}),t[21]=n,t[22]=i,t[23]=a,t[24]=l,t[25]=h,t[26]=E,t[27]=D,t[28]=O,t[29]=k,t[30]=j,t[31]=M,t[32]=N,t[33]=P,t[34]=C,t[35]=F):F=t[35];let I;return t[36]!==n||t[37]!==o||t[38]!==s||t[39]!==c||t[40]!==p||t[41]!==m||t[42]!==g||t[43]!==_||t[44]!==v||t[45]!==y||t[46]!==S||t[47]!==x||t[48]!==F||t[49]!==C||t[50]!==w||t[51]!==T?(I=(0,Z.jsx)(Fz,{tabId:C,docExt:c,target:w,renameName:y,openTabs:m,closeTab:o,closeTabs:s,isPreview:p,pinTab:g,pinnedTabIds:_,promoteTab:v,splitTab:x,skillMenuItems:S,tabLabel:n,unpinTab:T,children:F}),t[36]=n,t[37]=o,t[38]=s,t[39]=c,t[40]=p,t[41]=m,t[42]=g,t[43]=_,t[44]=v,t[45]=y,t[46]=S,t[47]=x,t[48]=F,t[49]=C,t[50]=w,t[51]=T,t[52]=I):I=t[52],I}function Vz(e){let t=(0,$.c)(111),{dropIndicatorIndex:n,paneId:r,onSplitComplete:i,reserveLeadingChrome:a,reserveTrailingChrome:o}=e,s=n===void 0?null:n,c=a===void 0?!1:a,l=o===void 0?!1:o,{_:u}=Bn(),d=Et(),{reopenClosedTab:f}=d,p;t[0]!==d.panes||t[1]!==r?(p=d.panes.find(e=>e.id===r)??d.panes[0],t[0]=d.panes,t[1]=r,t[2]=p):p=t[2];let m=p,h=m?.id??r,g;t[3]===m?.openTabs?g=t[4]:(g=m?.openTabs??[],t[3]=m?.openTabs,t[4]=g);let _=g,v;t[5]===m?.pinnedTabIds?v=t[6]:(v=m?.pinnedTabIds??[],t[5]=m?.pinnedTabIds,t[6]=v);let y=v,b=m?.previewTabId??null,x;t[7]===m?.newTabIds?x=t[8]:(x=m?.newTabIds??[],t[7]=m?.newTabIds,t[8]=x);let S=x,C=d.visibleTabIdsByPane.get(h)??[..._,...S],w=m?.activeTarget??null,T=m?.activeTabId??null,E=m?.activeNewTabId??null,D=E!==null,O=d.focusedPaneId===h,k=Fh({enabled:C.some(qz)}),A=Jl(),j=k.status===`ready`?k.data.filter(Kz):[],M=new Map(j.map(Gz)),N;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(N=[`project`,`global`],t[9]=N):N=t[9];let P;t[10]!==k.data||t[11]!==k.status?(P=new Map(N.map(e=>[e,new Set(k.status===`ready`?k.data.filter(t=>t.scope===e).map(Wz):[])])),t[10]=k.data,t[11]=k.status,t[12]=P):P=t[12];let F=P,I;t[13]!==d||t[14]!==h?(I=e=>d.activateTabInPane(h,e),t[13]=d,t[14]=h,t[15]=I):I=t[15];let L=I,R;t[16]!==d||t[17]!==h?(R=e=>d.activateNewTabInPane(h,e),t[16]=d,t[17]=h,t[18]=R):R=t[18];let z=R,V;t[19]!==d||t[20]!==h?(V=e=>d.closeTabInPane(h,e),t[19]=d,t[20]=h,t[21]=V):V=t[21];let ee=V,H;t[22]!==d||t[23]!==h?(H=e=>d.closeTabsInPane(h,e),t[22]=d,t[23]=h,t[24]=H):H=t[24];let U=H,W;t[25]!==d||t[26]!==h?(W=e=>d.closeNewTabInPane(h,e),t[25]=d,t[26]=h,t[27]=W):W=t[27];let G=W,te;t[28]!==d||t[29]!==h?(te=()=>d.openNewTabInPane(h),t[28]=d,t[29]=h,t[30]=te):te=t[30];let ne=te,re;t[31]!==d||t[32]!==h?(re=e=>d.pinTabInPane(h,e),t[31]=d,t[32]=h,t[33]=re):re=t[33];let K=re,ie;t[34]!==d||t[35]!==h?(ie=e=>d.unpinTabInPane(h,e),t[34]=d,t[35]=h,t[36]=ie):ie=t[36];let q=ie,ae;t[37]!==d||t[38]!==h?(ae=e=>d.promoteTabInPane(h,e),t[37]=d,t[38]=h,t[39]=ae):ae=t[39];let oe=ae,se;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(se={id:0,text:``},t[40]=se):se=t[40];let[ce,le]=(0,Q.useState)(se),ue;t[41]!==u||t[42]!==d||t[43]!==i?(ue=function(e,t,n){let r=d.moveTabToNewPane(e,t);if(!r)return;let a=u(t===`left`?{id:`3C2nIJ`,values:{label:n}}:{id:`GceAYf`,values:{label:n}});le(e=>({id:e.id+1,text:a})),i?.(r,e)},t[41]=u,t[42]=d,t[43]=i,t[44]=ue):ue=t[44];let de=ue,{pageMeta:fe}=Nd(),[pe,me]=(0,Q.useState)(!1),he=(0,Q.useRef)(null),ge=(0,Q.useRef)(null),_e=(0,Q.useRef)(!1),ve=(0,Q.useRef)(!1),ye;t[45]!==T||t[46]!==w?(ye=T??(w?Ue(w):null),t[45]=T,t[46]=w,t[47]=ye):ye=t[47];let be=ye,xe=function(e){if(s===e)return`before`;if(s===C.length&&e===C.length-1)return`after`},Se,Ce;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(Se=()=>()=>{ge.current!==null&&(window.clearTimeout(ge.current),ge.current=null)},Ce=[],t[48]=Se,t[49]=Ce):(Se=t[48],Ce=t[49]),(0,Q.useEffect)(Se,Ce);let we=typeof window<`u`&&window.okDesktop!=null,Te;t[50]===S?Te=t[51]:(Te=new Set(S),t[50]=S,t[51]=Te);let Ee=Te,De;t[52]!==G||t[53]!==U||t[54]!==Ee?(De=function(e){let t=[],n=[];for(let r of e)Ee.has(r)?n.push(r):t.push(r);t.length>0&&U(t);for(let e of n)G(e)},t[52]=G,t[53]=U,t[54]=Ee,t[55]=De):De=t[55];let Oe=De,ke;t[56]!==E||t[57]!==be||t[58]!==d||t[59]!==O||t[60]!==D||t[61]!==S||t[62]!==_||t[63]!==f||t[64]!==h?(ke=()=>{if(!O)return;let e=new Set(S),t=[..._,...S],n=function(){ge.current!==null&&(window.clearTimeout(ge.current),ge.current=null)},r=function(e){_e.current!==e&&(_e.current=e)},i=function(e){ve.current!==e&&(ve.current=e,me(e))},a=function(){r(!0),!(ve.current||ge.current!==null)&&(ge.current=window.setTimeout(()=>{ge.current=null,_e.current&&i(!0)},Dz))},o=function(){n(),r(!1),i(!1)},s=function(t){e.has(t)?d.activateNewTabInPane(h,t):d.activateTabInPane(h,t)},c=function(e){if(t.length===0)return;let n=D?E:be,r=n?t.indexOf(n):-1;s(t[((r>=0?r:0)+e+t.length)%t.length])},l=function(e){if(!Ez(e)||Mr())return;if(a(),Mc(e,`tab-new`)){e.preventDefault(),d.openNewTabInPane(h);return}if(Mc(e,`tab-reopen-closed`)){e.preventDefault(),f();return}if(Mc(e,`tab-next`)){e.preventDefault(),c(1);return}if(Mc(e,`tab-previous`)){e.preventDefault(),c(-1);return}let n=jz(e,t.length);n!==null&&(e.preventDefault(),s(t[n]))},u=function(e){!e.metaKey&&!e.ctrlKey&&o()};return window.addEventListener(`keydown`,l,{capture:!0}),window.addEventListener(`keyup`,u,{capture:!0}),window.addEventListener(`blur`,o),document.addEventListener(`visibilitychange`,o),()=>{window.removeEventListener(`keydown`,l,{capture:!0}),window.removeEventListener(`keyup`,u,{capture:!0}),window.removeEventListener(`blur`,o),document.removeEventListener(`visibilitychange`,o)}},t[56]=E,t[57]=be,t[58]=d,t[59]=O,t[60]=D,t[61]=S,t[62]=_,t[63]=f,t[64]=h,t[65]=ke):ke=t[65];let Ae;t[66]!==E||t[67]!==be||t[68]!==d.activateNewTabInPane||t[69]!==d.activateTabInPane||t[70]!==d.openNewTabInPane||t[71]!==O||t[72]!==D||t[73]!==S||t[74]!==_||t[75]!==f||t[76]!==h?(Ae=[E,be,d.activateNewTabInPane,d.activateTabInPane,d.openNewTabInPane,O,D,S,_,f,h],t[66]=E,t[67]=be,t[68]=d.activateNewTabInPane,t[69]=d.activateTabInPane,t[70]=d.openNewTabInPane,t[71]=O,t[72]=D,t[73]=S,t[74]=_,t[75]=f,t[76]=h,t[77]=Ae):Ae=t[77],(0,Q.useEffect)(ke,Ae);let je=pe,Me=D?E:be,Ne=(0,Q.useRef)(Me),Pe;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=()=>{let e=he.current;e&&Tz(e)},t[78]=Pe):Pe=t[78],(0,Q.useLayoutEffect)(Pe);let Fe,Ie;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=()=>{let e=he.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>Tz(e));return t.observe(e),()=>t.disconnect()},Ie=[],t[79]=Fe,t[80]=Ie):(Fe=t[79],Ie=t[80]),(0,Q.useLayoutEffect)(Fe,Ie);let Le,Re;t[81]!==h||t[82]!==Me?(Le=()=>{let e=Ne.current;if(Ne.current=Me,Me===null||Me===e)return;let t=he.current;t&&dl(t,h,Me)?.scrollIntoView({block:`nearest`,inline:`nearest`})},Re=[h,Me],t[81]=h,t[82]=Me,t[83]=Le,t[84]=Re):(Le=t[83],Re=t[84]),(0,Q.useEffect)(Le,Re);let Be=c?`pl-[calc(var(--editor-header-leading-offset,0px)+var(--editor-header-leading-width,0px)+0.5rem)]`:`pl-2`,Ve=l&&`pr-[var(--editor-header-trailing-width,0px)]`,He;t[85]!==Be||t[86]!==Ve?(He=gr(`flex h-12 w-full min-w-0 touch-manipulation items-end overflow-hidden`,Be,Ve,we&&`[-webkit-app-region:drag]`),t[85]=Be,t[86]=Ve,t[87]=He):He=t[87];let We;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(We=gr(`group/tab-overflow relative flex min-w-0 flex-1 self-stretch items-end gap-px overflow-hidden`,we&&`[-webkit-app-region:drag]`),t[88]=We):We=t[88];let Ge;t[89]!==ce.id||t[90]!==ce.text?(Ge=(0,Z.jsx)(`span`,{"aria-atomic":`true`,"aria-live":`polite`,"data-testid":`editor-tab-split-announcement`,className:`sr-only`,children:(0,Z.jsx)(`span`,{children:ce.text},ce.id)}),t[89]=ce.id,t[90]=ce.text,t[91]=Ge):Ge=t[91];let Ke;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=gr(`relative h-10 w-fit max-w-[calc(100%-1.75rem)] min-w-0 flex-none self-end`,we&&`[-webkit-app-region:no-drag]`),t[92]=Ke):Ke=t[92];let qe=Uz,Je=Hz,Ye=C.length===0&&s===0?(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-editor-tab-drop-indicator":`before`,className:`pointer-events-none absolute inset-y-1 left-0 z-30 w-0.5 rounded-full bg-primary`}):null,Xe=C.map((e,t)=>{let n=pe?kz(t,C.length):null,r=O?Az(t,C.length):void 0;if(Ee.has(e)){let i=e===E;return(0,Z.jsx)(Fz,{tabId:e,canPin:!1,openTabs:C,closeTab:G,closeTabs:Oe,pinTab:K,pinnedTabIds:y,promoteTab:oe,splitTab:de,tabLabel:u({id:`3YvS-c`}),unpinTab:q,children:(0,Z.jsxs)(Nz,{dropIndicatorSide:xe(t),label:u({id:`3YvS-c`}),paneId:h,splittable:!0,tabId:e,activateFromKeyboard:()=>z(e),"aria-current":i?`page`:void 0,"aria-keyshortcuts":r,"data-active-tab":i?`true`:void 0,className:gr(yz,i?bz:xz),onAuxClick:t=>{t.button===1&&(t.preventDefault(),G(e))},onClick:t=>{t.target===t.currentTarget&&z(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":u({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:Cz(i&&O,!1),onClick:()=>z(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{"data-editor-tab-title-overflow":`ellipsis`,className:`min-w-0 truncate`,children:ln(e)?(0,Z.jsx)(Y,{id:`hgf5io`}):(0,Z.jsx)(Y,{id:`3YvS-c`})})}),n?(0,Z.jsx)(Mz,{value:n}):(0,Z.jsx)(`button`,{type:`button`,"aria-label":u({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:hl(je||i),tabIndex:fl(i),onClick:t=>{t.stopPropagation(),G(e)},children:(0,Z.jsx)(zp,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let i=ze(e),a=e===be,o=y.includes(e),s=e===b;if(i.kind===`folder`){let{baseName:c,label:l,prefix:u}=J(i.folderPath,`/`),d=`${u}${l}`;return(0,Z.jsx)(Bz,{accessibleLabel:d,activateTab:L,ariaKeyShortcuts:r,dropIndicatorSide:xe(t),tabId:e,paneId:h,target:{kind:`folder`,target:i.folderPath,folderPath:i.folderPath},renameName:c,openTabs:C,closeTab:ee,closeTabs:Oe,forceCloseVisible:je,isActive:a,isPinned:o,isPreview:s,pinTab:K,pinnedTabIds:y,promoteTab:oe,shortcutHint:n,splitTab:de,unpinTab:q,children:(0,Z.jsx)(Lz,{path:d,children:(0,Z.jsx)(`button`,{type:`button`,"aria-label":d,dir:`auto`,className:Cz(a&&O,s),onClick:()=>L(e),onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),oe(e)},tabIndex:-1,children:(0,Z.jsxs)(`span`,{"data-editor-tab-title-overflow":a?`fade`:`ellipsis`,className:gr(`min-w-0 flex-1`,wz(a)),children:[u&&(0,Z.jsx)(`span`,{className:gr(`@max-[5rem]/tab:hidden`,a&&`text-muted-foreground`),children:u}),(0,Z.jsxs)(`span`,{children:[c,`/`]})]})})})},e)}if(i.kind===`asset`||i.kind===`skill-file`||i.kind===`skill-preview`){let c;bb426:switch(i.kind){case`asset`:c=i.assetPath;break bb426;case`skill-file`:c=i.path;break bb426;case`skill-preview`:c=i.name}let{baseName:l,label:u,prefix:d}=J(c,``),f=`${d}${u}`,p=i.kind===`skill-file`?j.filter(e=>e.scope===i.scope&&e.name===i.name):[],m=i.kind===`skill-file`?i.host?p.find(e=>e.hosts[0]===i.host):p.length===1?p[0]:void 0:void 0;return(0,Z.jsx)(Bz,{accessibleLabel:f,activateTab:L,ariaKeyShortcuts:r,dropIndicatorSide:xe(t),tabId:e,paneId:h,target:i.kind===`asset`?{kind:`asset`,target:i.assetPath,assetPath:i.assetPath,mediaKind:null}:void 0,renameName:i.kind===`asset`?l:void 0,openTabs:C,closeTab:ee,closeTabs:Oe,forceCloseVisible:je,isActive:a,isPinned:o,isPreview:s,pinTab:K,pinnedTabIds:y,promoteTab:oe,shortcutHint:n,splitTab:de,skillMenuItems:i.kind===`skill-file`&&m?(0,Z.jsx)(Kl,{actions:A,filePath:i.path,menuKind:`context`,skill:m}):void 0,unpinTab:q,children:(0,Z.jsx)(Lz,{path:f,children:(0,Z.jsx)(`button`,{type:`button`,"aria-label":f,dir:`auto`,className:Cz(a&&O,s),onClick:()=>L(e),onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),oe(e)},tabIndex:-1,children:(0,Z.jsxs)(`span`,{"data-editor-tab-title-overflow":a?`fade`:`ellipsis`,className:gr(`min-w-0 flex-1`,wz(a)),children:[d?(0,Z.jsx)(`span`,{className:gr(`text-muted-foreground/60 @max-[5rem]/tab:hidden`,a&&`text-muted-foreground`),children:d}):null,(0,Z.jsx)(`span`,{children:l})]})})})},e)}let c=i.docName,l=M.get(c),d=fe.get(c)?.docExt??(yo(c)?``:`.md`),f=l?null:lu(c,j,d),{baseName:p,extension:m,label:g,prefix:_}=J(c,d),v=`${_}${g}`,x=d===``||d===`.md`||d===`.mdx`,S=!B(c)&&!cn(c);return(0,Z.jsx)(Bz,{accessibleLabel:v,activateTab:L,ariaKeyShortcuts:r,dropIndicatorSide:xe(t),tabId:e,paneId:h,docExt:d,target:S?{kind:`doc`,target:c,docName:c}:void 0,renameName:S?`${p}${m}`:void 0,openTabs:C,closeTab:ee,closeTabs:Oe,forceCloseVisible:je,isActive:a,isPinned:o,isPreview:s,pinTab:K,pinnedTabIds:y,promoteTab:oe,shortcutHint:n,splitTab:de,skillMenuItems:l?(0,Z.jsx)($l,{actions:A,existingNames:F.get(l.scope)??Oz,menuKind:`context`,skill:l}):f?(0,Z.jsx)(Kl,{actions:A,filePath:f.filePath,menuKind:`context`,skill:f.skill}):void 0,unpinTab:q,children:(0,Z.jsx)(zz,{accessibleLabel:v,activateTab:L,baseName:p,docName:c,extension:m,hideDocExtension:x,isActive:a,isFocusedPane:O,isPreview:s,promoteTab:oe,tabId:e})},e)}),Ze;t[93]!==qe||t[94]!==Je||t[95]!==Ye||t[96]!==Xe?(Ze=(0,Z.jsxs)(`div`,{ref:he,"data-editor-tab-scroll":``,className:`scrollbar-none flex h-10 w-fit max-w-full min-w-0 items-end gap-px overflow-x-auto overflow-y-hidden overscroll-x-contain group-data-[overflow-left]/tab-overflow:mask-l-from-[calc(100%-4rem)] group-data-[overflow-right]/tab-overflow:mask-r-from-[calc(100%-4rem)]`,onScroll:qe,onWheel:Je,children:[Ye,Xe]}),t[93]=qe,t[94]=Je,t[95]=Ye,t[96]=Xe,t[97]=Ze):Ze=t[97];let Qe;t[98]!==Ke||t[99]!==Ze?(Qe=(0,Z.jsx)(`div`,{className:Ke,children:Ze}),t[98]=Ke,t[99]=Ze,t[100]=Qe):Qe=t[100];let $e;t[101]===u?$e=t[102]:($e=u({id:`3YvS-c`}),t[101]=u,t[102]=$e);let et;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(et=gr(`first:mb-3 mb-1.5 shrink-0`,we&&`[-webkit-app-region:no-drag]`),t[103]=et):et=t[103];let tt;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(tt=(0,Z.jsx)(dr,{"aria-hidden":`true`}),t[104]=tt):tt=t[104];let nt;t[105]!==ne||t[106]!==$e?(nt=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":$e,"data-testid":`editor-new-tab-button`,className:et,onClick:ne,children:tt})}),t[105]=ne,t[106]=$e,t[107]=nt):nt=t[107];let rt;t[108]===Symbol.for(`react.memo_cache_sentinel`)?(rt=(0,Z.jsx)(Vr,{children:(0,Z.jsx)(Y,{id:`3YvS-c`})}),t[108]=rt):rt=t[108];let it;return t[109]===nt?it=t[110]:(it=(0,Z.jsxs)(Ur,{children:[nt,rt]}),t[109]=nt,t[110]=it),(0,Z.jsxs)(`div`,{"data-editor-pane-tabs":h,"data-electron-drag":we?``:void 0,className:He,children:[(0,Z.jsxs)(`div`,{"data-editor-tab-overflow-root":``,"data-electron-drag":we?``:void 0,className:We,children:[Ge,(0,Z.jsx)(jg,{items:[...C],strategy:kg,children:Qe}),it]}),A.dialogs]})}function Hz(e){il(e),Tz(e.currentTarget)}function Uz(e){return Tz(e.currentTarget)}function Wz(e){return e.name}function Gz(e){return[pm(e),e]}function Kz(e){return!e.managed}function qz(e){let t=ze(e);return t.kind===`skill-file`||t.kind===`doc`&&B(t.docName)}function Jz(e){let t=(0,$.c)(8),{docName:n}=e,r=(0,Q.useRef)(null),i,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{r.current?.focus()},a=[],t[0]=i,t[1]=a):(i=t[0],a=t[1]),(0,Q.useEffect)(i,a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`h2`,{className:`font-medium text-base text-foreground`,children:(0,Z.jsx)(Y,{id:`1lFNz3`})}),t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Z.jsx)(`p`,{className:`max-w-md break-all text-muted-foreground text-sm`,children:(0,Z.jsx)(Mu,{children:n})}),t[3]=n,t[4]=s);let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(X,{ref:r,variant:`secondary`,onClick:Yz,children:(0,Z.jsx)(Y,{id:`rf8fiC`})}),t[5]=c):c=t[5];let l;return t[6]===s?l=t[7]:(l=(0,Z.jsxs)(`div`,{"data-testid":`note-window-deleted-state`,className:`flex h-full flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[o,s,c]}),t[6]=s,t[7]=l),l}function Yz(){window.close()}var Xz=300;function Zz(e){return e.activeTarget?.kind===`large-file`?null:e.activeTarget?mm(e.activeTarget):null}function Qz(e){let t=(0,$.c)(14),{children:n,index:r,isFocused:i,paneId:a,size:o}=e,s=`editor-pane-strip:${a}`,c;t[0]!==r||t[1]!==a?(c={kind:`pane-strip`,paneId:a,index:r},t[0]=r,t[1]=a,t[2]=c):c=t[2];let l;t[3]!==s||t[4]!==c?(l={id:s,data:c},t[3]=s,t[4]=c,t[5]=l):l=t[5];let{setNodeRef:u}=Eg(l),d=i||void 0,f;t[6]===o?f=t[7]:(f={flexGrow:o},t[6]=o,t[7]=f);let p;return t[8]!==n||t[9]!==a||t[10]!==u||t[11]!==d||t[12]!==f?(p=(0,Z.jsx)(`div`,{ref:u,"data-editor-pane-tab-group":a,"data-editor-pane-focused":d,className:`relative h-full min-w-0 shrink basis-0`,style:f,children:n}),t[8]=n,t[9]=a,t[10]=u,t[11]=d,t[12]=f,t[13]=p):p=t[13],p}function $z(e){let t=(0,$.c)(16),{drag:n,paneId:r,side:i}=e,a=`editor-pane-edge:${r}:${i}`,o;t[0]!==r||t[1]!==i?(o={kind:`pane-edge`,paneId:r,side:i},t[0]=r,t[1]=i,t[2]=o):o=t[2];let s=n?.splittable!==!0,c;t[3]!==a||t[4]!==o||t[5]!==s?(c={id:a,data:o,disabled:s},t[3]=a,t[4]=o,t[5]=s,t[6]=c):c=t[6];let{isOver:l,setNodeRef:u}=Eg(c),d=l?i:void 0,f=i===`left`?`left-0`:`right-0`,p=l&&`bg-primary/15 opacity-100 ring-2 ring-primary ring-inset`,m;t[7]!==f||t[8]!==p?(m=gr(`pointer-events-none absolute inset-y-0 z-30 w-12 opacity-0`,f,p),t[7]=f,t[8]=p,t[9]=m):m=t[9];let h;return t[10]!==r||t[11]!==u||t[12]!==i||t[13]!==d||t[14]!==m?(h=(0,Z.jsx)(`div`,{ref:u,"aria-hidden":`true`,"data-pane-edge":i,"data-editor-pane-id":r,"data-pane-drop-side":d,className:m}),t[10]=r,t[11]=u,t[12]=i,t[13]=d,t[14]=m,t[15]=h):h=t[15],h}function eB(e){let t=(0,$.c)(29),{drag:n,leftPaneId:r,rightPaneId:i}=e,a=`editor-pane-edge:${r}:right`,o;t[0]===r?o=t[1]:(o={kind:`pane-edge`,paneId:r,side:`right`},t[0]=r,t[1]=o);let s=n?.splittable!==!0,c;t[2]!==a||t[3]!==o||t[4]!==s?(c={id:a,data:o,disabled:s},t[2]=a,t[3]=o,t[4]=s,t[5]=c):c=t[5];let{isOver:l,setNodeRef:u}=Eg(c),d=`editor-pane-edge:${i}:left`,f;t[6]===i?f=t[7]:(f={kind:`pane-edge`,paneId:i,side:`left`},t[6]=i,t[7]=f);let p=n?.splittable!==!0,m;t[8]!==d||t[9]!==f||t[10]!==p?(m={id:d,data:f,disabled:p},t[8]=d,t[9]=f,t[10]=p,t[11]=m):m=t[11];let{isOver:h,setNodeRef:g}=Eg(m),_=l?`right`:h?`left`:null,v;t[12]!==r||t[13]!==u?(v=(0,Z.jsx)(`div`,{ref:u,"aria-hidden":`true`,"data-pane-edge":`right`,"data-pane-edge-pane-id":r,className:`pointer-events-none absolute inset-y-0 right-1/2 w-12`}),t[12]=r,t[13]=u,t[14]=v):v=t[14];let y;t[15]!==i||t[16]!==g?(y=(0,Z.jsx)(`div`,{ref:g,"aria-hidden":`true`,"data-pane-edge":`left`,"data-pane-edge-pane-id":i,className:`pointer-events-none absolute inset-y-0 left-1/2 w-12`}),t[15]=i,t[16]=g,t[17]=y):y=t[17];let b=_??void 0,x=_&&`bg-primary/15 opacity-100 ring-2 ring-primary ring-inset`,S;t[18]===x?S=t[19]:(S=gr(`pointer-events-none absolute inset-y-0 left-1/2 z-30 w-24 -translate-x-1/2 opacity-0`,x),t[18]=x,t[19]=S);let C;t[20]!==r||t[21]!==i||t[22]!==b||t[23]!==S?(C=(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-pane-boundary-drop":``,"data-pane-boundary-left":r,"data-pane-boundary-right":i,"data-pane-drop-side":b,className:S}),t[20]=r,t[21]=i,t[22]=b,t[23]=S,t[24]=C):C=t[24];let w;return t[25]!==y||t[26]!==C||t[27]!==v?(w=(0,Z.jsxs)(Z.Fragment,{children:[v,y,C]}),t[25]=y,t[26]=C,t[27]=v,t[28]=w):w=t[28],w}function tB(e){let t=(0,$.c)(9),{docName:n,onActivityMount:r,onPaneFocus:i,paneId:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useEffectEvent)(r),c=(0,Q.useEffectEvent)(i),l;t[0]!==s||t[1]!==c||t[2]!==a?(l=()=>{let e=o.current;if(!e)return;let t=()=>c(a);return e.addEventListener(`pointerdown`,t,!0),e.addEventListener(`focusin`,t,!0),s(a,e),()=>{e.removeEventListener(`pointerdown`,t,!0),e.removeEventListener(`focusin`,t,!0),s(a,null)}},t[0]=s,t[1]=c,t[2]=a,t[3]=l):l=t[3];let u;t[4]===a?u=t[5]:(u=[a],t[4]=a,t[5]=u),(0,Q.useLayoutEffect)(l,u);let d;return t[6]!==n||t[7]!==a?(d=(0,Z.jsx)(`div`,{ref:o,"data-editor-activity-mount":a,"data-doc-name":n,className:`absolute inset-0`}),t[6]=n,t[7]=a,t[8]=d):d=t[8],d}function nB(e){let t=(0,$.c)(48),{drag:n,isFocused:r,label:i,onActivityMount:a,pane:o,renderPane:s,showOuterLeftDropTarget:c,showOuterRightDropTarget:l,showDropTargets:u}=e,d=c===void 0?!1:c,f=l===void 0?!1:l,p=u===void 0?!0:u,{focusPane:m,openTargetInPane:h}=Et(),[g,_]=(0,Q.useState)(!1),v=(0,Q.useRef)(null),y;t[0]===o?y=t[1]:(y=Zz(o),t[0]=o,t[1]=y);let b=y,x,S;t[2]!==h||t[3]!==o.activeNewTabId||t[4]!==o.id?(x=()=>{let e=v.current;if(!e)return;let t=e=>{Jg(e.dataTransfer)&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`),_(!0))},n=t=>{let n=t.relatedTarget;n instanceof Node&&e.contains(n)||_(!1)},r=()=>_(!1),i=e=>{_(!1);let t=Wg(e.dataTransfer);t&&(e.preventDefault(),e.stopPropagation(),DR(t,(e,t)=>h(o.id,e,t),o.activeNewTabId!==null))};return e.addEventListener(`dragover`,t,!0),e.addEventListener(`dragleave`,n,!0),e.addEventListener(`drop`,i,!0),window.addEventListener(`drop`,r,!0),window.addEventListener(`dragend`,r,!0),()=>{e.removeEventListener(`dragover`,t,!0),e.removeEventListener(`dragleave`,n,!0),e.removeEventListener(`drop`,i,!0),window.removeEventListener(`drop`,r,!0),window.removeEventListener(`dragend`,r,!0)}},S=[h,o.activeNewTabId,o.id],t[2]=h,t[3]=o.activeNewTabId,t[4]=o.id,t[5]=x,t[6]=S):(x=t[5],S=t[6]),(0,Q.useLayoutEffect)(x,S);let C=r?`true`:void 0,w=o.id,T=r||void 0,E=g||void 0,D=g&&`after:pointer-events-none after:absolute after:inset-2 after:z-20 after:rounded-lg after:bg-primary/5 after:ring-2 after:ring-primary/70 after:ring-inset`,O;t[7]===D?O=t[8]:(O=gr(`relative flex h-full min-h-0 min-w-0 flex-col bg-background`,D),t[7]=D,t[8]=O);let k,A;t[9]!==m||t[10]!==o.id?(k=()=>m(o.id),A=()=>m(o.id),t[9]=m,t[10]=o.id,t[11]=k,t[12]=A):(k=t[11],A=t[12]);let j;t[13]!==b||t[14]!==m||t[15]!==a||t[16]!==o.id?(j=b?(0,Z.jsx)(tB,{docName:b,onActivityMount:a,onPaneFocus:m,paneId:o.id}):null,t[13]=b,t[14]=m,t[15]=a,t[16]=o.id,t[17]=j):j=t[17];let M;t[18]!==b||t[19]!==r||t[20]!==o||t[21]!==s||t[22]!==j?(M=s({pane:o,isFocused:r,activityDocName:b,activityMount:j}),t[18]=b,t[19]=r,t[20]=o,t[21]=s,t[22]=j,t[23]=M):M=t[23];let N;t[24]===M?N=t[25]:(N=(0,Z.jsx)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:M}),t[24]=M,t[25]=N);let P;t[26]!==n||t[27]!==o.id||t[28]!==p||t[29]!==d?(P=p&&d?(0,Z.jsx)($z,{drag:n,paneId:o.id,side:`left`}):null,t[26]=n,t[27]=o.id,t[28]=p,t[29]=d,t[30]=P):P=t[30];let F;t[31]!==n||t[32]!==o.id||t[33]!==p||t[34]!==f?(F=p&&f?(0,Z.jsx)($z,{drag:n,paneId:o.id,side:`right`}):null,t[31]=n,t[32]=o.id,t[33]=p,t[34]=f,t[35]=F):F=t[35];let I;return t[36]!==i||t[37]!==o.id||t[38]!==E||t[39]!==O||t[40]!==k||t[41]!==A||t[42]!==N||t[43]!==P||t[44]!==F||t[45]!==C||t[46]!==T?(I=(0,Z.jsxs)(`section`,{ref:v,"aria-current":C,"aria-label":i,"data-editor-pane-id":w,"data-editor-pane-focused":T,"data-sidebar-drop-active":E,className:O,onPointerDownCapture:k,onFocusCapture:A,children:[N,P,F]}),t[36]=i,t[37]=o.id,t[38]=E,t[39]=O,t[40]=k,t[41]=A,t[42]=N,t[43]=P,t[44]=F,t[45]=C,t[46]=T,t[47]=I):I=t[47],I}function rB(e){let t=(0,$.c)(147),{renderActivityPool:n,renderHeader:r,renderPane:i}=e,{_:a}=Bn(),{focusPane:o,focusedPaneId:s,moveTabToPane:c,panes:l,reorderTabsInPane:u,resizePanes:d,splitTab:f,tabSessionLoaded:p,visibleTabIdsByPane:m}=Et(),h=OC(),g=h||$c(),_=(0,Q.useSyncExternalStore)(An,$e,cB),v=!h&&!p&&typeof window<`u`&&window.okDesktop?.config.mode===`editor`,[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(sB),[T,E]=(0,Q.useState)(null),D=(0,Q.useRef)(null),[O,k]=(0,Q.useState)(null),A=(0,Q.useRef)(null),j;t[0]===l?j=t[1]:(j=l.map(oB).join(`\0`),t[0]=l,t[1]=j);let M=j,N;t[2]===l?N=t[3]:(N=Object.fromEntries(l.map(aB)),t[2]=l,t[3]=N);let P=N,F=new Set,I=new Map;for(let e of l){let t=Zz(e);if(!t)continue;F.add(t);let n=C.get(e.id);n&&I.set(t,n)}let L;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(L={activationConstraint:{distance:8}},t[4]=L):L=t[4];let R;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(R={coordinateGetter:Tg,keyboardCodes:ml},t[5]=R):R=t[5];let z=Cg(wg(Sg,L),wg(Mg,R)),B=`max(100%, ${l.length*Xz}px)`,V;t[6]===B?V=t[7]:(V={"--editor-workspace-min-width":B},t[6]=B,t[7]=V);let ee=V,H;t[8]===O?H=t[9]:(H=function(e){(O?.querySelectorAll(`[data-editor-pane-tab-group]`))?.forEach(t=>{let n=t.dataset.editorPaneTabGroup,r=n?e[`editor-pane:${n}`]:void 0;r!==void 0&&t.style.setProperty(`flex-grow`,String(r))})},t[8]=O,t[9]=H);let U=H,W;t[10]!==U||t[11]!==M?(W=()=>{let e=A.current;e?.paneKey===M&&U(e.layout)},t[10]=U,t[11]=M,t[12]=W):W=t[12],(0,Q.useLayoutEffect)(W);let G,te;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(te=()=>()=>{D.current!==null&&cancelAnimationFrame(D.current)},G=[],t[13]=G,t[14]=te):(G=t[13],te=t[14]),(0,Q.useEffect)(te,G);let ne,re;if(t[15]===y?(ne=t[16],re=t[17]):(ne=()=>{if(y)return document.body.setAttribute(`data-editor-tab-dragging`,``),iB},re=[y],t[15]=y,t[16]=ne,t[17]=re),(0,Q.useEffect)(ne,re),v){let e;t[18]===r?e=t[19]:(e=r(null),t[18]=r,t[19]=e);let n;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`div`,{"data-editor-workspace-pending":``,className:`min-h-0 flex-1 bg-background`}),t[20]=n):n=t[20];let i;return t[21]===e?i=t[22]:(i=(0,Z.jsxs)(Z.Fragment,{children:[e,n]}),t[21]=e,t[22]=i),i}let K;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(K=function(e,t){w(n=>{if(n.get(e)===t)return n;let r=new Map(n);return t?r.set(e,t):r.delete(e),r})},t[23]=K):K=t[23];let ie=K,q;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(q=function(e,t){D.current!==null&&cancelAnimationFrame(D.current),D.current=requestAnimationFrame(()=>{D.current=null,dl(document,e,t)?.focus()})},t[24]=q):q=t[24];let ae=q,oe;t[25]===m?oe=t[26]:(oe=function(e){return m.get(e.id)??[...e.openTabs,...e.newTabIds]},t[25]=m,t[26]=oe);let se=oe,ce;t[27]!==c||t[28]!==u?(ce=function(e,t,n,r){if(e.paneId!==t.id){c(e.tabId,t.id,n),ae(t.id,e.tabId);return}if(!r)return;let i=r.indexOf(e.tabId);i<0||i===n||u(t.id,Dg([...r],i,n),e.tabId)},t[27]=c,t[28]=u,t[29]=ce):ce=t[29];let le=ce,ue;t[30]!==l||t[31]!==se?(ue=function(e,t){let n=e.over?.data.current,r,i;if(ul(n)){r=n.paneId;let a=l.find(e=>e.id===r);if(!a)return null;let o=se(a),s=o.indexOf(n.tabId);if(s<0)return null;let c=t.paneId===r?o.indexOf(t.tabId):-1,u=e.delta?.x??0,d=e.active.rect?.current.translated,f=e.over?.rect,p;p=c>=0&&c!==s?c<s:c===s&&u!==0?u>0:d!=null&&f!==void 0&&d.left+d.width/2>f.left+f.width/2,i=s+ +!!p}else if(ll(n)&&n.kind===`pane-strip`)r=n.paneId,i=n.index;else return null;let a=l.find(e=>e.id===r);if(!a)return null;let o=se(a),s=Math.min(Math.max(i,0),o.length),c=t.paneId===a.id?o.indexOf(t.tabId):-1,u=c>=0&&s>c?s-1:s;return c>=0&&u===c?null:{indicatorIndex:s,pane:a,targetIndex:u,targetOrder:o}},t[30]=l,t[31]=se,t[32]=ue):ue=t[32];let de=ue,fe;t[33]===de?fe=t[34]:(fe=function(e){let t=e.active.data.current,n=ul(t)?de(e,t):null,r=n?{index:n.indicatorIndex,paneId:n.pane.id}:null;S(e=>e?.paneId===r?.paneId&&e?.index===r?.index?e:r)},t[33]=de,t[34]=fe);let pe=fe,J;t[35]===o?J=t[36]:(J=function(e){let t=e.active.data.current;ul(t)&&(S(null),b(t),o(t.paneId))},t[35]=o,t[36]=J);let me=J,he;t[37]!==le||t[38]!==de||t[39]!==f?(he=function(e){let t=e.active.data.current,n=e.over?.data.current,r=ul(t)?de(e,t):null;if(S(null),b(null),ul(t)){if(r){le(t,r.pane,r.targetIndex,r.targetOrder);return}if(ll(n)&&n.kind===`pane-edge`){if(!t.splittable)return;let e=f(t.tabId,n.paneId,n.side);e&&ae(e,t.tabId);return}}},t[37]=le,t[38]=de,t[39]=f,t[40]=he):he=t[40];let ge=he,_e;t[41]===O?.style?_e=t[42]:(_e=function(e){O?.style.setProperty(`transform`,`translateX(-${e.currentTarget.scrollLeft}px)`)},t[41]=O?.style,t[42]=_e);let ve=_e,ye;t[43]!==U||t[44]!==M?(ye=function(e){A.current={paneKey:M,layout:e},U(e)},t[43]=U,t[44]=M,t[45]=ye):ye=t[45];let be=ye,xe;t[46]!==a||t[47]!==l?(xe=function(e){let t=l.findIndex(t=>t.id===e);return a(t<0?{id:`n2XqGH`}:{id:`fo6CCk`,values:{0:t+1}})},t[46]=a,t[47]=l,t[48]=xe):xe=t[48];let Se=xe,Ce;t[49]!==a||t[50]!==Se?(Ce=function(e){return ul(e)?Se(e.paneId):ll(e)?e.kind===`pane-edge`?e.side===`left`?a({id:`9Ii3uK`,values:{0:Se(e.paneId)}}):a({id:`jp6I-2`,values:{0:Se(e.paneId)}}):Se(e.paneId):null},t[49]=a,t[50]=Se,t[51]=Ce):Ce=t[51];let we=Ce,Te;t[52]!==l||t[53]!==d?(Te=(e,t)=>{t.isUserInteraction&&d(new Map(l.map(t=>[t.id,e[`editor-pane:${t.id}`]??t.size])))},t[52]=l,t[53]=d,t[54]=Te):Te=t[54];let Ee;t[55]!==y||t[56]!==s||t[57]!==Se||t[58]!==l||t[59]!==i?(Ee=l.map((e,t)=>(0,Z.jsxs)(Q.Fragment,{children:[t>0?(0,Z.jsx)(RA,{withHandle:!0,"data-editor-pane-resize-handle":``,"data-editor-pane-before":l[t-1]?.id,"data-editor-pane-after":e.id,children:(0,Z.jsx)(eB,{drag:y,leftPaneId:l[t-1]?.id??e.id,rightPaneId:e.id})}):null,(0,Z.jsx)(LA,{id:`editor-pane:${e.id}`,defaultSize:`${e.size}%`,minSize:`${Xz}px`,children:(0,Z.jsx)(nB,{drag:y,isFocused:e.id===s,label:Se(e.id),onActivityMount:ie,pane:e,renderPane:i,showOuterLeftDropTarget:t===0,showOuterRightDropTarget:t===l.length-1})})]},e.id)),t[55]=y,t[56]=s,t[57]=Se,t[58]=l,t[59]=i,t[60]=Ee):Ee=t[60];let De;t[61]!==M||t[62]!==P||t[63]!==be||t[64]!==Te||t[65]!==Ee?(De=(0,Z.jsx)(IA,{id:`editor-workspace-panes`,orientation:`horizontal`,defaultLayout:P,onLayoutChange:be,onLayoutChanged:Te,children:Ee},M),t[61]=M,t[62]=P,t[63]=be,t[64]=Te,t[65]=Ee,t[66]=De):De=t[66];let Oe=De,ke;if(t[67]!==x||t[68]!==s||t[69]!==l||t[70]!==se){let e;t[72]!==x||t[73]!==s||t[74]!==l.length||t[75]!==se?(e=(e,t)=>(0,Z.jsxs)(Q.Fragment,{children:[t>0?(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-editor-header-pane-separator":``,className:`w-px shrink-0 bg-border`}):null,(0,Z.jsx)(Qz,{paneId:e.id,index:se(e).length,isFocused:e.id===s,size:e.size,children:(0,Z.jsx)(Vz,{dropIndicatorIndex:x?.paneId===e.id?x.index:null,paneId:e.id,onSplitComplete:ae,reserveLeadingChrome:t===0,reserveTrailingChrome:t===l.length-1})})]},e.id),t[72]=x,t[73]=s,t[74]=l.length,t[75]=se,t[76]=e):e=t[76],ke=l.map(e),t[67]=x,t[68]=s,t[69]=l,t[70]=se,t[71]=ke}else ke=t[71];let Ae;t[77]!==ee||t[78]!==ke?(Ae=(0,Z.jsx)(`div`,{"data-editor-header-tab-groups":``,className:`h-full min-w-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(`div`,{ref:k,"data-editor-header-tab-canvas":``,className:`flex h-full min-w-(--editor-workspace-min-width)`,style:ee,children:ke})}),t[77]=ee,t[78]=ke,t[79]=Ae):Ae=t[79];let je=Ae;if(g){let e;t[80]!==s||t[81]!==l?(e=l.find(e=>e.id===s)??l[0],t[80]=s,t[81]=l,t[82]=e):e=t[82];let a=e;if(_!==null){let e;t[83]===r?e=t[84]:(e=r(null),t[83]=r,t[84]=e);let n;t[85]===_?n=t[86]:(n=(0,Z.jsx)(`div`,{"data-editor-workspace":``,className:`relative min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(Jz,{docName:_})}),t[85]=_,t[86]=n);let i;return t[87]!==e||t[88]!==n?(i=(0,Z.jsxs)(Z.Fragment,{children:[e,n]}),t[87]=e,t[88]=n,t[89]=i):i=t[89],i}let o;t[90]===r?o=t[91]:(o=r(null),t[90]=r,t[91]=o);let c;t[92]!==Se||t[93]!==a||t[94]!==i?(c=a?(0,Z.jsx)(nB,{drag:null,isFocused:!0,label:Se(a.id),onActivityMount:ie,pane:a,renderPane:i,showDropTargets:!1}):null,t[92]=Se,t[93]=a,t[94]=i,t[95]=c):c=t[95];let u;return t[96]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`div`,{ref:E,"data-editor-activity-parking":``,className:`hidden`,inert:!0}),t[96]=u):u=t[96],(0,Z.jsxs)(Z.Fragment,{children:[o,(0,Z.jsxs)(`div`,{"data-editor-workspace":``,className:`relative min-h-0 flex-1 overflow-hidden`,children:[c,u,T===null?null:n?.({activityHosts:I,parkingHost:T,visibleDocNames:F})]})]})}let Me=Ag,Ne=ol,Pe;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=()=>{S(null),b(null)},t[97]=Pe):Pe=t[97];let Fe;t[98]===a?Fe=t[99]:(Fe=a({id:`GrBgX_`}),t[98]=a,t[99]=Fe);let Ie;t[100]===Fe?Ie=t[101]:(Ie={draggable:Fe},t[100]=Fe,t[101]=Ie);let Le;t[102]!==a||t[103]!==Se?(Le=e=>{let{active:t}=e,n=t.data.current;return ul(n)?a({id:`_PnPuw`,values:{0:n.label,1:Se(n.paneId)}}):void 0},t[102]=a,t[103]=Se,t[104]=Le):Le=t[104];let Re,ze;t[105]!==a||t[106]!==we?(Re=e=>{let{active:t,over:n}=e,r=t.data.current;if(!ul(r)||!n)return;let i=we(n.data.current);return i?a({id:`Jnz9AY`,values:{0:r.label,destination:i}}):void 0},ze=e=>{let{active:t,over:n}=e,r=t.data.current;if(!ul(r))return;let i=n?we(n.data.current):null;return a(i?{id:`gqk-3R`,values:{0:r.label,destination:i}}:{id:`Gu9pRm`,values:{0:r.label}})},t[105]=a,t[106]=we,t[107]=Re,t[108]=ze):(Re=t[107],ze=t[108]);let Be;t[109]===a?Be=t[110]:(Be=e=>{let{active:t}=e,n=t.data.current;return ul(n)?a({id:`URN-cv`,values:{0:n.label}}):void 0},t[109]=a,t[110]=Be);let Ve;t[111]!==Le||t[112]!==Re||t[113]!==ze||t[114]!==Be?(Ve={onDragStart:Le,onDragOver:Re,onDragEnd:ze,onDragCancel:Be},t[111]=Le,t[112]=Re,t[113]=ze,t[114]=Be,t[115]=Ve):Ve=t[115];let He;t[116]!==Ie||t[117]!==Ve?(He={container:typeof document<`u`?document.body:void 0,screenReaderInstructions:Ie,announcements:Ve},t[116]=Ie,t[117]=Ve,t[118]=He):He=t[118];let Ue;t[119]!==je||t[120]!==r?(Ue=r(je),t[119]=je,t[120]=r,t[121]=Ue):Ue=t[121];let We;t[122]!==ee||t[123]!==Oe?(We=(0,Z.jsx)(`div`,{"data-editor-workspace-canvas":``,className:`h-full min-w-[var(--editor-workspace-min-width)]`,style:ee,children:Oe}),t[122]=ee,t[123]=Oe,t[124]=We):We=t[124];let Ge;t[125]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,Z.jsx)(`div`,{ref:E,"data-editor-activity-parking":``,className:`hidden`,inert:!0}),t[125]=Ge):Ge=t[125];let Ke=T===null?null:n?.({activityHosts:I,parkingHost:T,visibleDocNames:F}),qe;t[126]!==ve||t[127]!==We||t[128]!==Ge||t[129]!==Ke?(qe=(0,Z.jsxs)(`div`,{"data-editor-workspace":``,className:`relative min-h-0 flex-1 overflow-x-auto overflow-y-hidden`,onScroll:ve,children:[We,Ge,Ke]}),t[126]=ve,t[127]=We,t[128]=Ge,t[129]=Ke,t[130]=qe):qe=t[130];let Je;t[131]===y?Je=t[132]:(Je=y?(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`editor-tab-drag-overlay`,className:`pointer-events-none flex h-10 w-44 max-w-[calc(100vw-2rem)] cursor-grabbing items-center overflow-hidden rounded-md border border-border bg-background px-3 font-medium text-[13px] text-foreground shadow-lg`,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:y.label})}):null,t[131]=y,t[132]=Je);let Ye;t[133]===Je?Ye=t[134]:(Ye=(0,Z.jsx)(xg,{dropAnimation:null,children:Je}),t[133]=Je,t[134]=Ye);let Xe;return t[135]!==Me||t[136]!==ge||t[137]!==me||t[138]!==z||t[139]!==Ne||t[140]!==Pe||t[141]!==He||t[142]!==Ue||t[143]!==qe||t[144]!==Ye||t[145]!==pe?(Xe=(0,Z.jsxs)(Me,{sensors:z,autoScroll:!1,collisionDetection:Ne,onDragStart:me,onDragMove:pe,onDragOver:pe,onDragEnd:ge,onDragCancel:Pe,accessibility:He,children:[Ue,qe,Ye]}),t[135]=Me,t[136]=ge,t[137]=me,t[138]=z,t[139]=Ne,t[140]=Pe,t[141]=He,t[142]=Ue,t[143]=qe,t[144]=Ye,t[145]=pe,t[146]=Xe):Xe=t[146],Xe}function iB(){return document.body.removeAttribute(`data-editor-tab-dragging`)}function aB(e){return[`editor-pane:${e.id}`,e.size]}function oB(e){return e.id}function sB(){return new Map}function cB(){return null}function lB(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}var uB=`doc-panel`,dB=`terminal-column`,fB=`agents-column`,pB=[uB,dB,fB],mB=new Set(pB);function hB(e){return mB.has(e)}function gB(e){let t=null,n=0;for(let r of e)if(!hB(r)&&(t=r,n+=1,n>1))return null;return n===1?t:null}function _B(e){let t=[...e],n=gB(t),r=pB.filter(e=>t.includes(e)),i=new Set(r);n!=null&&i.add(n);let a=t.filter(e=>!i.has(e));return{residualId:n,presentPeers:r,unaccountedIds:a,ok:n!=null&&a.length===0}}function vB(e){let{currentLayout:t,containerPx:n,pinnedPx:r,residualId:i}=e;if(n<=0||!(i in t))return t;let a={...t},o=0;for(let[e,i]of Object.entries(r)){if(!(e in t))continue;let r=i/n*100;a[e]=r,o+=r}let s=0;for(let[e,n]of Object.entries(t))e===i||e in r||(s+=n);let c=100-o-s;return c<0?t:(a[i]=c,a)}var yB=Vs,bB=yB+1,xB=.05;function SB({otherRailWidthPx:e,agentsMinimumWidthPx:t}){let n=e+t+yB;return Math.ceil(n/(1-xB))}function CB({workspaceWidthPx:e,otherRailWidthPx:t,agentsMinimumWidthPx:n,previous:r,current:i,trigger:a}){if(!i.terminalRightVisible||!i.agentsVisible||e>=SB({otherRailWidthPx:t,agentsMinimumWidthPx:n}))return{kind:`none`};if(a===`resize`)return{kind:`close-agents`};let o=!r.agentsVisible&&i.agentsVisible,s=r.terminalRightVisible;return o&&s?{kind:`close-terminal`}:{kind:`close-agents`}}var wB=`ok-terminal-height-v1`,TB=1/3,EB=.5;function DB(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*EB))}function OB(e){let t=Number.isFinite(e)?e:0;return t<=0?240:Math.round(t*TB)}function kB(e,t){let n=DB(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(OB(t),n)}function AB(){return typeof window>`u`?0:window.innerHeight}function jB(e,t){return kB(e,t??AB())}function MB(e,t){try{let n=e??localStorage,r=t??AB(),i=n.getItem(wB);if(i==null)return kB(OB(r),r);let a=Number.parseInt(i,10);return kB(Number.isFinite(a)?a:OB(r),r)}catch{return 240}}function NB(e,t,n){try{let r=t??localStorage,i=n??AB();r.setItem(wB,String(kB(e,i)))}catch{}}function PB(){try{return typeof localStorage>`u`?240:MB()}catch{return 240}}var FB=`terminal-dock-panel`;function IB(e){let t=(0,$.c)(31),{children:n,placement:r,visible:i,onVisibleChange:a,onBottomContainer:o,onEditorRegion:s}=e,c=r===void 0?`bottom`:r,{resolvedTheme:l}=sr(),u=pO(),d=c===`bottom`&&i,[f,p]=(0,Q.useState)(!d),m=x_(l).background,[h]=(0,Q.useState)(LB),g=(0,Q.useRef)(h),[_,v]=(0,Q.useState)(!1),y=(0,Q.useRef)(!1),b=(0,Q.useRef)(null),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=function(e){b.current!=null&&clearTimeout(b.current),b.current=setTimeout(()=>{NB(e),b.current=null},100)},t[0]=x):x=t[0];let S=x,C=(0,Q.useRef)(0),w;t[1]===i?w=t[2]:(w=function(e,t){C.current>=5||(C.current+=1,console.warn(JSON.stringify({event:`ok-terminal-dock-stranded-while-hidden`,panelPx:Math.round(e),panelPct:Number.isFinite(t)?Math.round(t*10)/10:null,visible:i,dockHeightPx:g.current,innerWidth:window.innerWidth,innerHeight:window.innerHeight,devicePixelRatio:window.devicePixelRatio})))},t[1]=i,t[2]=w);let T=w,E=(0,Q.useRef)(null),D,O;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>()=>{b.current!=null&&clearTimeout(b.current),E.current?.()},O=[],t[3]=D,t[4]=O):(D=t[3],O=t[4]),(0,Q.useEffect)(D,O);let k,A;t[5]!==d||t[6]!==u?(k=()=>{let e=u.current;if(e!=null)try{d?e.resize(`${g.current}px`):e.collapse()}catch{}},A=[d,u],t[5]=d,t[6]=u,t[7]=k,t[8]=A):(k=t[7],A=t[8]),(0,Q.useEffect)(k,A);let j,M;t[9]!==d||t[10]!==u?(j=()=>{let e=()=>{let e=jB(g.current);if(e!==g.current&&(g.current=e,d))try{u.current?.resize(`${e}px`)}catch{}};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},M=[d,u],t[9]=d,t[10]=u,t[11]=j,t[12]=M):(j=t[11],M=t[12]),(0,Q.useEffect)(j,M);let N=_||void 0,P;t[13]!==n||t[14]!==s?(P=(0,Z.jsx)(LA,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsx)(`div`,{ref:s,tabIndex:-1,className:`relative flex h-full min-h-0 flex-col outline-none`,children:n})}),t[13]=n,t[14]=s,t[15]=P):P=t[15];let F;t[16]!==d||t[17]!==h||t[18]!==f||t[19]!==_||t[20]!==o||t[21]!==a||t[22]!==u||t[23]!==c||t[24]!==T||t[25]!==m?(F=c===`bottom`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(RA,{withHandle:d,disabled:!d,onPointerDown:e=>{if(!d)return;E.current?.(),v(!0),y.current=!0;let{pointerId:t}=e,n=()=>{v(!1),y.current=!1,window.removeEventListener(`pointerup`,r),window.removeEventListener(`pointercancel`,r),E.current=null},r=e=>{e.pointerId===t&&n()};E.current=n,window.addEventListener(`pointerup`,r),window.addEventListener(`pointercancel`,r)}}),(0,Z.jsx)(LA,{id:FB,style:{backgroundColor:m},panelRef:u,defaultSize:d?`${h}px`:0,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:e=>{let t=e.asPercentage===0;if(p(t),!d&&e.inPixels>0&&!y.current){T(e.inPixels,e.asPercentage);try{u.current?.collapse()}catch{}return}y.current&&(t&&d?a(!1):!t&&!d&&a(!0),e.inPixels>0&&(g.current=e.inPixels,S(e.inPixels)))},inert:f,className:gr(`flex flex-col`,!_&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`),children:(0,Z.jsx)(`div`,{ref:o,className:`flex min-h-0 flex-1 flex-col overflow-hidden`})})]}):null,t[16]=d,t[17]=h,t[18]=f,t[19]=_,t[20]=o,t[21]=a,t[22]=u,t[23]=c,t[24]=T,t[25]=m,t[26]=F):F=t[26];let I;return t[27]!==N||t[28]!==P||t[29]!==F?(I=(0,Z.jsxs)(IA,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":N,children:[P,F]}),t[27]=N,t[28]=P,t[29]=F,t[30]=I):I=t[30],I}function LB(){return PB()}function RB(e){let t=(0,$.c)(20),{edge:n,onReveal:r,className:i}=e,{_:a}=Bn(),o=n===`right`,s;t[0]!==a||t[1]!==o?(s=a(o?{id:`X7ShnN`}:{id:`eRSPr9`}),t[0]=a,t[1]=o,t[2]=s):s=t[2];let c=s,l=o?`rounded-r-none border-r-0`:`rounded-b-none border-b-0`,u;t[3]!==i||t[4]!==l?(u=gr(`absolute z-20 shrink-0 bg-background text-muted-foreground shadow-sm hover:text-foreground`,l,i),t[3]=i,t[4]=l,t[5]=u):u=t[5];let d;t[6]===o?d=t[7]:(d=o?(0,Z.jsx)(Wu,{"aria-hidden":`true`}):(0,Z.jsx)(Sa,{"aria-hidden":`true`}),t[6]=o,t[7]=d);let f;t[8]!==n||t[9]!==c||t[10]!==r||t[11]!==u||t[12]!==d?(f=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":c,"data-terminal-reveal":n,onClick:r,className:u,children:d})}),t[8]=n,t[9]=c,t[10]=r,t[11]=u,t[12]=d,t[13]=f):f=t[13];let p=o?`left`:`top`,m;t[14]!==c||t[15]!==p?(m=(0,Z.jsx)(Vr,{side:p,sideOffset:8,children:c}),t[14]=c,t[15]=p,t[16]=m):m=t[16];let h;return t[17]!==f||t[18]!==m?(h=(0,Z.jsxs)(Ur,{children:[f,m]}),t[17]=f,t[18]=m,t[19]=h):h=t[19],h}var zB=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-B37XJHxx.js`),__vite__mapDeps([70,1,37,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,42,43,44,45,71,2,72,73,33,74,75,76,77,78,79,80,81,82,28,3,29,30,31,32,83,66,84,85,86,87,88,89,4,5,90,40,91,92,24,23,93,94,25,34,56,57,58,95,68,61,96,97,98,64,65,99,100,55,59,60,62,101,102,103,26,104,105,106,107,35,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123]),import.meta.url)).ActivityModeContent})),BB=/^Could not find Group with id "/;function VB(e,t){t instanceof Error&&BB.test(t.message)||console.warn(JSON.stringify({event:e,error:t instanceof Error?t.message:String(t)}))}var HB=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillEditBanner:e}=await import(`./SkillEditBanner-b0gL75iO.js`);return{SkillEditBanner:e}},__vite__mapDeps([195,7,1,8,9,150,21,18,196,19,17,113,28,2,3,29,30,31,32,33]),import.meta.url)).SkillEditBanner})),UB=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./LintConfigEditor-B3Gj07cI.js`),__vite__mapDeps([197,7,1,8,9,18,198,72,73,33,28,2,3,29,30,31,32,83,37,66,84,13,85,86,87,88,89,90,43,44,11,12,45,40,14,15,42,19,17,91,21,92,24,39,41,16,171,78,172,57,183,95,153,127,104,23,131,133,93,54,99,103,35,146,108,154,155,20,156,68,199]),import.meta.url)).LintConfigEditor})),WB=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./SchemaConfigEditor-D17w4XxC.js`),__vite__mapDeps([200,1,7,8,9,90,43,44,11,12,13,45,40,14,15,42,18,19,17,91,21,92,24,131,93,16,166,201,102,34,84,198,72,73,33,28,2,3,29,30,31,32,83,37,66,85,86,87,88,89,39,41,171,78,172,57,183,95,108,155,20,35,156,199,160]),import.meta.url)).SchemaConfigEditor}));function GB(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`NYn1cR`})}),e[0]=t):t=e[0],t}function KB(e){let t=(0,$.c)(17),{docName:n,provider:r,isSourceMode:i,onModeChange:a,isPanelCollapsed:o,onTogglePanel:s,reserveRightGutter:c}=e,{requestAddProperty:l}=Nf(),u=Aw(r),{data:d}=ig(n),f=Hf(i?null:r,d?.effective??null),p;t[0]===f?p=t[1]:(p=Lf(f),t[0]=f,t[1]=p);let{missing:m}=p;if(nj(n)===`conflict`)return null;let h=bR()?r:null,g=u!==`connected`&&u!==`synced`,_=!i,v;t[2]!==n||t[3]!==l?(v=()=>l(n),t[2]=n,t[3]=l,t[4]=v):v=t[4];let y;return t[5]!==n||t[6]!==o||t[7]!==i||t[8]!==m||t[9]!==a||t[10]!==s||t[11]!==c||t[12]!==h||t[13]!==g||t[14]!==_||t[15]!==v?(y=(0,Z.jsx)(TR,{activeDocName:n,activeProvider:h,isSourceMode:i,sourceDisabled:g,onModeChange:a,showAddPropertyButton:_,onAddProperty:v,frontmatterProblems:m,isPanelCollapsed:o,onTogglePanel:s,reserveRightGutter:c}),t[5]=n,t[6]=o,t[7]=i,t[8]=m,t[9]=a,t[10]=s,t[11]=c,t[12]=h,t[13]=g,t[14]=_,t[15]=v,t[16]=y):y=t[16],y}var qB=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./TimelineDiffPane-D8HcBg2n.js`),__vite__mapDeps([202,1,2,203,28,3,29,30,31,32,33,7,8,9,71,72,73,74,75,76,77,78,79,80,81,82,44,83,37,66,18,84,13,85,86,87,88,89,4,5,90,43,11,12,45,40,14,15,42,19,17,91,21,92,24,23,10,16,20,93,94,25,34,56,57,58,95,68,61,96,97,98,64,65,99,100,55,59,60,62,101,102,103,26,104,105,106,107,35,108,109,110,111,112,113,114,115,164,127,129,130,41,165,166,204,39,205,116,123,69,120]),import.meta.url)).TimelineDiffPane})),JB=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./AgentDiffPane-DHlBPg3c.js`),__vite__mapDeps([206,1,2,203,28,3,29,30,31,32,33,7,8,9,71,72,73,74,75,76,77,78,79,80,81,82,44,83,37,66,18,84,13,85,86,87,88,89,4,5,90,43,11,12,45,40,14,15,42,19,17,91,21,92,24,23,10,16,20,93,94,25,34,56,57,58,95,68,61,96,97,98,64,65,99,100,55,59,60,62,101,102,103,26,104,105,106,107,35,108,109,110,111,112,113,114,115,164,127,129,130,41,165,166,204,39,205,117,118,119,123,69,121,122]),import.meta.url)).AgentDiffPane})),YB=300,XB=`${YB}px`,ZB=`600px`;function QB(e){return e}function $B(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(tV,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(eV,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(om,{name:`editor-area`,children:(0,Z.jsxs)(Mf,{children:[n,r]})}),t[3]=n,t[4]=i),i}function eV(){let e=(0,$.c)(6),t=Bc(),n;e[0]===t?n=e[1]:(n=e=>{e||t.close()},e[0]=t,e[1]=n);let r;return e[2]!==t.open||e[3]!==t.section||e[4]!==n?(r=(0,Z.jsx)(TA,{open:t.open,initialSection:t.section,onOpenChange:n}),e[2]=t.open,e[3]=t.section,e[4]=n,e[5]=r):r=e[5],r}function tV(e){let t=(0,$.c)(357),{editorMode:n,onModeChange:r,activeTab:i,onActiveTabChange:a,terminalBridge:o,terminalVisible:s,terminalPlacement:c,terminalRightWidth:l,onTerminalVisibleChange:u,onTerminalRightWidthChange:d,agentsVisible:f,onAgentsVisibleChange:p,onSessionPlacements:m,onRevealAgents:h,renderWorkspaceHeader:g}=e,_=s===void 0?!1:s,v=c===void 0?`bottom`:c,y=f===void 0?!1:f,b=g===void 0?QB:g,{_:x}=Bn(),S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=$c(),t[0]=S):S=t[0];let C=S,{activeDocName:w,activeProvider:T,activeTarget:E,activeNewTabId:D,recycleDocument:O,docPanelMode:k,docPanelAgentId:A,docPanelExpandSignal:j,closeActivityPanel:M}=Et(),{openDocumentTransition:N}=qe(),P=ej(T,w),F=rj(w,n===`source`?`source`:`wysiwyg`),[I,L]=(0,Q.useState)(!1),R,z;t[1]!==T||t[2]!==I?(R=()=>{T!=null&&!I&&L(!0)},z=[T,I],t[1]=T,t[2]=I,t[3]=R,t[4]=z):(R=t[3],z=t[4]),(0,Q.useEffect)(R,z);let B=(0,Q.useDeferredValue)(w),V=n===`source`,ee=E?.kind===`missing`,H=!!w&&E?.kind!==`folder`,U;t[5]!==x||t[6]!==ee?(U=ee?x({id:`K-a33w`}):void 0,t[5]=x,t[6]=ee,t[7]=U):U=t[7];let W=U,G=ug(),te,ne;t[8]!==w||t[9]!==G?(ne=()=>{G&&G.docName!==w&&dg()},te=[w,G],t[8]=w,t[9]=G,t[10]=te,t[11]=ne):(te=t[10],ne=t[11]),(0,Q.useEffect)(ne,te);let re=og(),K=re?.docName??null,ie=(0,Q.useRef)(null),q;t[12]!==w||t[13]!==K||t[14]!==N?(q=()=>{if(K==null){ie.current=null;return}if(ie.current=K,K!==w){let e=qp(K);tm(window.location.hash,e)?N(K):window.location.hash=e}},t[12]=w,t[13]=K,t[14]=N,t[15]=q):q=t[15];let ae;t[16]===K?ae=t[17]:(ae=[K],t[16]=K,t[17]=ae),(0,Q.useEffect)(q,ae);let oe,se;t[18]!==w||t[19]!==K?(oe=()=>{if(K!=null){if(K===w){ie.current=null;return}ie.current!==K&&cg()}},se=[w,K],t[18]=w,t[19]=K,t[20]=oe,t[21]=se):(oe=t[20],se=t[21]),(0,Q.useEffect)(oe,se);let ce,le;t[22]!==A||t[23]!==k?(ce=()=>{k===`agent`&&A!==null||cg()},le=[k,A],t[22]=A,t[23]=k,t[24]=ce,t[25]=le):(ce=t[24],le=t[25]),(0,Q.useEffect)(ce,le);let ue=(0,Q.useSyncExternalStore)(Ef.subscribe,Ef.getSnapshot,Ef.getSnapshot),de;t[26]!==E||t[27]!==ue?(de=Of(E,ue),t[26]=E,t[27]=ue,t[28]=de):de=t[28];let fe=de,[pe]=(0,Q.useState)(aV),J=pe!==null,me;t[29]===pe?me=t[30]:(me=()=>_j(pe,window.innerWidth,`right`),t[29]=pe,t[30]=me);let[he,ge]=(0,Q.useState)(me),_e=(0,Q.useRef)(he),ve,ye;t[31]===he?(ve=t[32],ye=t[33]):(ve=()=>{_e.current=he},ye=[he],t[31]=he,t[32]=ve,t[33]=ye),(0,Q.useEffect)(ve,ye);let be=pO(),xe=pO(),Se=pO(),Ce;t[34]===he?Ce=t[35]:(Ce=()=>Ej(`right`,he,wj())===`collapsed`,t[34]=he,t[35]=Ce);let[we]=(0,Q.useState)(Ce),[Te,Ee]=(0,Q.useState)(we),De=(0,Q.useRef)(Te),[Oe,ke]=(0,Q.useState)(null),[Ae,je]=(0,Q.useState)(null),[Me,Ne]=(0,Q.useState)(null),[Pe,Fe]=(0,Q.useState)(null),[Ie,Le]=(0,Q.useState)(null),[Re,ze]=(0,Q.useState)(null),Be=!C&&y,Ve=!C&&_&&v===`right`,He=Ve||Be,Ue=!C&&!y&&h!=null,We=v===`right`?Ae:Ie,Ge=_&&We!=null,Ke=Be&&Oe!=null,Je,Ye;t[36]!==Oe||t[37]!==Ke||t[38]!==m||t[39]!==We||t[40]!==Re||t[41]!==Ge?(Je=()=>{m?.({terminal:{container:We,isShowing:Ge},agents:{container:Oe,isShowing:Ke},editorRegion:Re})},Ye=[m,We,Ge,Oe,Ke,Re],t[36]=Oe,t[37]=Ke,t[38]=m,t[39]=We,t[40]=Re,t[41]=Ge,t[42]=Je,t[43]=Ye):(Je=t[42],Ye=t[43]),(0,Q.useEffect)(Je,Ye);let Xe,Ze;t[44]===Te?(Xe=t[45],Ze=t[46]):(Xe=()=>{De.current=Te},Ze=[Te],t[44]=Te,t[45]=Xe,t[46]=Ze),(0,Q.useEffect)(Xe,Ze);let[Qe,$e]=(0,Q.useState)(!1),et=(0,Q.useRef)(!1),[tt]=(0,Q.useState)(iV),rt=(0,Q.useRef)(tt),it=(0,Q.useRef)(null),at;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(at=function(e){it.current!=null&&clearTimeout(it.current),it.current=setTimeout(()=>{fj(e),it.current=null},100)},t[47]=at):at=t[47];let ot=at,[st]=(0,Q.useState)(rV),ct=(0,Q.useRef)(st),[lt,ut]=(0,Q.useState)(!1),dt=(0,Q.useRef)(!1),ft=(0,Q.useRef)(null),pt;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(pt=function(e){ft.current!=null&&clearTimeout(ft.current),ft.current=setTimeout(()=>{sj(e),ft.current=null},100)},t[48]=pt):pt=t[48];let mt=pt,ht;t[49]===l?ht=t[50]:(ht=()=>Math.max(l??Ts,bB),t[49]=l,t[50]=ht);let[gt]=(0,Q.useState)(ht),_t=(0,Q.useRef)(gt),[vt,yt]=(0,Q.useState)(!1),bt=(0,Q.useRef)(!1),xt=(0,Q.useRef)(null),St;t[51]===d?St=t[52]:(St=function(e){xt.current!=null&&clearTimeout(xt.current),xt.current=setTimeout(()=>{d?.(e),xt.current=null},100)},t[51]=d,t[52]=St);let Ct=St,wt,Tt;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(wt=()=>()=>{it.current!=null&&clearTimeout(it.current),ft.current!=null&&clearTimeout(ft.current),xt.current!=null&&clearTimeout(xt.current)},Tt=[],t[53]=wt,t[54]=Tt):(wt=t[53],Tt=t[54]),(0,Q.useEffect)(wt,Tt);let[Dt,Ot]=(0,Q.useState)(null),kt=(0,Q.useRef)(null),At,jt;t[55]!==Pe||t[56]!==Me?(At=()=>{if(Me==null||Pe==null)return;let e=()=>{Me.style.setProperty(`--editor-header-tabs-width`,`${Pe.getBoundingClientRect().width}px`)};if(e(),typeof ResizeObserver>`u`)return;let t=new ResizeObserver(e);return t.observe(Pe),()=>t.disconnect()},jt=[Me,Pe],t[55]=Pe,t[56]=Me,t[57]=At,t[58]=jt):(At=t[57],jt=t[58]),(0,Q.useLayoutEffect)(At,jt);let Mt=(0,Q.useRef)(!1),Nt=(0,Q.useRef)(0),Pt=cO(),Ft;t[59]!==xe||t[60]!==be||t[61]!==Se?(Ft=function(){for(let e of[be,Se,xe]){let t=e.current?.getSize();if(t!=null&&t.asPercentage>1&&t.inPixels>0)return t.inPixels/t.asPercentage*100}let e=kt.current;return e!=null&&e.offsetWidth>0?e.offsetWidth:null},t[59]=xe,t[60]=be,t[61]=Se,t[62]=Ft):Ft=t[62];let It=Ft,Lt;t[63]!==Pt||t[64]!==be||t[65]!==It?(Lt=function(){if(Pt.current==null)return null;try{let e=It();if(e==null)return null;if(!Mt.current)return{workspaceWidthPx:e,otherRailWidthPx:0};let t=be.current?.getSize().inPixels,n=t!=null&&t>0?t:rt.current;return{workspaceWidthPx:e,otherRailWidthPx:Math.max(n,YB)}}catch(e){return VB(`resolve-admission-metrics-failed`,e),null}},t[63]=Pt,t[64]=be,t[65]=It,t[66]=Lt):Lt=t[66];let Rt=Lt,zt;t[67]!==y||t[68]!==Ve?(zt={terminalRightVisible:Ve,agentsVisible:y},t[67]=y,t[68]=Ve,t[69]=zt):zt=t[69];let Vt=zt,Ut=(0,Q.useRef)(Vt),Wt=(0,Q.useRef)(Vt),Gt=(0,Q.useRef)(Te),Kt=(0,Q.useRef)(null),qt;t[70]!==x||t[71]!==p||t[72]!==u||t[73]!==Rt?(qt=function(e,t){let n=Rt();if(n==null)return;let r=CB({...n,agentsMinimumWidthPx:320,previous:t,current:Ut.current,trigger:e});if(!(r.kind===`none`||Kt.current===r.kind)){if(r.kind===`close-agents`){if(p==null)return;Kt.current=r.kind,p(!1),Dc.info(x({id:`KGF42E`}));return}u!=null&&(Kt.current=r.kind,u(!1),Dc.info(x({id:`2VSPan`})))}},t[70]=x,t[71]=p,t[72]=u,t[73]=Rt,t[74]=qt):qt=t[74];let Jt=qt,Yt=(0,Q.useRef)(Jt),Xt;t[75]!==Vt||t[76]!==Jt?(Xt=()=>{Yt.current=Jt,Ut.current=Vt},t[75]=Vt,t[76]=Jt,t[77]=Xt):Xt=t[77],(0,Q.useLayoutEffect)(Xt);let Zt,Qt;t[78]!==y||t[79]!==Te||t[80]!==Ve?(Zt=()=>{!y&&Kt.current===`close-agents`&&(Kt.current=null),!Ve&&Kt.current===`close-terminal`&&(Kt.current=null);let e=Wt.current,t=Gt.current;Wt.current={terminalRightVisible:Ve,agentsVisible:y},Gt.current=Te,queueMicrotask(()=>{Yt.current(t===Te?`state-change`:`resize`,e)})},Qt=[y,Ve,Te],t[78]=y,t[79]=Te,t[80]=Ve,t[81]=Zt,t[82]=Qt):(Zt=t[81],Qt=t[82]),(0,Q.useLayoutEffect)(Zt,Qt);let $t;t[83]!==Pt||t[84]!==It?($t=function(e){let t=Pt.current;if(t==null)return!1;let n,r;try{n=It(),r=t.getLayout()}catch(e){return VB(`apply-rail-layout-read-failed`,e),!1}if(n==null)return!1;let i=_B(Object.keys(r));if(!i.ok)return!1;let a=i.residualId;if(a==null)return!1;let o=t=>{let n={};return`doc-panel`in r&&(n[uB]=!Mt.current||e?0:t?YB:rt.current),`terminal-column`in r&&(n[dB]=Ut.current.terminalRightVisible?t?bB:_t.current:0),`agents-column`in r&&(n[fB]=Ut.current.agentsVisible?t?320:ct.current:0),n},s=o(!1);if(Object.keys(s).length===0)return!1;let c=vB({currentLayout:r,containerPx:n,pinnedPx:s,residualId:a});if(c===r&&(s=o(!0),c=vB({currentLayout:r,containerPx:n,pinnedPx:s,residualId:a})),c===r)return!0;try{t.setLayout(c)}catch(e){return VB(`apply-rail-layout-write-failed`,e),!1}let l;try{l=t.getLayout()}catch(e){return VB(`apply-rail-layout-verify-failed`,e),!1}for(let[e,t]of Object.entries(s)){let r=l[e];if(r!=null&&Math.abs(r/100*n-t)>1)return!1}return!0},t[83]=Pt,t[84]=It,t[85]=$t):$t=t[85];let en=$t,tn;t[86]!==Pt||t[87]!==It?(tn=function(e,t,n){t||n<=0||queueMicrotask(()=>{let t=Pt.current;if(t==null)return;let n,r;try{n=t.getLayout(),r=It()}catch(e){VB(`reclaim-hidden-rail-read-failed`,e);return}if(r==null||!(e in n)||n[e]===0)return;let i=gB(Object.keys(n));if(i==null)return;let a=vB({currentLayout:n,containerPx:r,pinnedPx:{[e]:0},residualId:i});if(a!==n)try{t.setLayout(a)}catch(e){VB(`reclaim-hidden-rail-write-failed`,e)}})},t[86]=Pt,t[87]=It,t[88]=tn):tn=t[88];let nn=tn,rn;t[89]===en?rn=t[90]:(rn=function(e){return et.current||bt.current||dt.current?!0:(De.current=e,en(e))},t[89]=en,t[90]=rn);let an=rn,on=(0,Q.useRef)(an),sn;t[91]===an?sn=t[92]:(sn=()=>{on.current=an},t[91]=an,t[92]=sn),(0,Q.useEffect)(sn);let cn=(0,Q.useRef)(null),un;t[93]===Symbol.for(`react.memo_cache_sentinel`)?(un=function(e,t,n,r){cn.current?.(),t(!0),n.current=!0;let i=function(){window.removeEventListener(`pointerup`,a),window.removeEventListener(`pointercancel`,o),cn.current=null,t(!1),n.current=!1};function a(t){t.pointerId===e&&(i(),r?.())}function o(t){t.pointerId===e&&(i(),on.current(De.current))}cn.current=i,window.addEventListener(`pointerup`,a),window.addEventListener(`pointercancel`,o)},t[93]=un):un=t[93];let dn=un,fn,pn;t[94]===Symbol.for(`react.memo_cache_sentinel`)?(fn=()=>()=>cn.current?.(),pn=[],t[94]=fn,t[95]=pn):(fn=t[94],pn=t[95]),(0,Q.useEffect)(fn,pn);let mn;t[96]===en?mn=t[97]:(mn=function(){return et.current||bt.current||dt.current?!0:en(De.current)},t[96]=en,t[97]=mn);let hn=mn,gn;t[98]===hn?gn=t[99]:(gn=()=>{let e={id:0},t=n=>{hn()||n<=0||(e.id=requestAnimationFrame(()=>t(n-1)))};return t(30),()=>{e.id!==0&&cancelAnimationFrame(e.id)}},t[98]=hn,t[99]=gn);let _n;t[100]!==Be||t[101]!==Ve?(_n=[Ve,Be],t[100]=Be,t[101]=Ve,t[102]=_n):_n=t[102],(0,Q.useEffect)(gn,_n);let vn;t[103]===an?vn=t[104]:(vn=function(){Mt.current&&an(!1)},t[103]=an,t[104]=vn);let yn=vn,xn;t[105]===an?xn=t[106]:(xn=function(){if(!Mt.current)return;let e=_e.current;De.current?(Dj(`right`,e,`open`),an(!1)):(Dj(`right`,e,`collapsed`),an(!0))},t[105]=an,t[106]=xn);let Sn=xn,Cn,wn;t[107]!==an||t[108]!==pe?(Cn=()=>{let e=window.matchMedia(`(min-width: ${hj}px)`),t=()=>{let e=_j(pe,window.innerWidth,`right`);ge(e);let t=Ej(`right`,e,wj())===`collapsed`;Ee(t),an(t)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},wn=[pe,an],t[107]=an,t[108]=pe,t[109]=Cn,t[110]=wn):(Cn=t[109],wn=t[110]),(0,Q.useEffect)(Cn,wn);let Tn,En;t[111]!==Dt||t[112]!==J?(Tn=()=>{if(Dt==null||J)return;let e=new ResizeObserver(()=>{on.current(De.current),Yt.current(`resize`,Ut.current)});return e.observe(Dt),()=>e.disconnect()},En=[Dt,J],t[111]=Dt,t[112]=J,t[113]=Tn,t[114]=En):(Tn=t[113],En=t[114]),(0,Q.useEffect)(Tn,En);let Dn;t[115]!==M||t[116]!==k||t[117]!==yn||t[118]!==a?(Dn=e=>{k===`agent`&&M(),a(e),yn()},t[115]=M,t[116]=k,t[117]=yn,t[118]=a,t[119]=Dn):Dn=t[119];let On=(0,Q.useEffectEvent)(Dn),kn;t[120]===On?kn=t[121]:(kn=()=>{let e=nt();return e&&On(e),bn(e=>{nt(),On(e)})},t[120]=On,t[121]=kn);let An;t[122]===Symbol.for(`react.memo_cache_sentinel`)?(An=[],t[122]=An):An=t[122],(0,Q.useEffect)(kn,An);let jn,Mn;t[123]!==j||t[124]!==yn?(jn=()=>{j!==0&&yn()},Mn=[j,yn],t[123]=j,t[124]=yn,t[125]=jn,t[126]=Mn):(jn=t[125],Mn=t[126]),(0,Q.useEffect)(jn,Mn);let Nn,Pn;t[127]===Te?(Nn=t[128],Pn=t[129]):(Nn=()=>{if(!Te||!document.getElementById(`doc-panel`)?.contains(document.activeElement))return;let e=document.querySelector(`[data-doc-panel-toggle]`);if(e){e.focus();return}document.querySelector(`[data-sidebar="trigger"]`)?.focus()},Pn=[Te],t[127]=Te,t[128]=Nn,t[129]=Pn),(0,Q.useLayoutEffect)(Nn,Pn);let Fn,In;t[130]===Te?(Fn=t[131],In=t[132]):(Fn=()=>{el({docPanelVisible:!Te}),window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!Te})},In=[Te],t[130]=Te,t[131]=Fn,t[132]=In),(0,Q.useEffect)(Fn,In);let Ln,Rn;t[133]===Sn?(Ln=t[134],Rn=t[135]):(Ln=()=>fr(e=>{e===`toggle-doc-panel`&&Sn()}),Rn=[Sn],t[133]=Sn,t[134]=Ln,t[135]=Rn),(0,Q.useEffect)(Ln,Rn);let zn,Vn;t[136]===Sn?(zn=t[137],Vn=t[138]):(zn=()=>{if(window.okDesktop!=null)return;let e=e=>{Mc(e,`toggle-document-panel`)&&(Mr()||(e.preventDefault(),Sn()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Vn=[Sn],t[136]=Sn,t[137]=zn,t[138]=Vn),(0,Q.useEffect)(zn,Vn);let Hn=(0,Q.useRef)(null),[Un,Wn]=(0,Q.useState)(null),[Gn,Kn]=(0,Q.useState)(!1),[qn,Jn]=(0,Q.useState)(null),Yn=E?.kind===`large-file`?E.docName:w,Xn,Zn;t[139]===Yn?(Xn=t[140],Zn=t[141]):(Xn=()=>{if(Yn&&Yn!==Hn.current){let e=Hn.current;Hn.current=Yn,Wn(e)}},Zn=[Yn],t[139]=Yn,t[140]=Xn,t[141]=Zn),(0,Q.useEffect)(Xn,Zn);let Qn;t[142]===N?Qn=t[143]:(Qn=function(e){let t=qp(e);tm(window.location.hash,t)?N(e):window.location.hash=t},t[142]=N,t[143]=Qn);let $n=Qn,er,tr,nr,rr;if(t[144]!==w||t[145]!==D||t[146]!==T||t[147]!==i||t[148]!==E||t[149]!==re||t[150]!==K||t[151]!==y||t[152]!==qn||t[153]!==Gn||t[154]!==B||t[155]!==A||t[156]!==k||t[157]!==I||t[158]!==Te||t[159]!==J||t[160]!==V||t[161]!==$n||t[162]!==a||t[163]!==Un||t[164]!==Ue||t[165]!==F||t[166]!==fe||t[167]!==H||t[168]!==P||t[169]!==o||t[170]!==_||t[171]!==G||t[172]!==Sn){if(tr=null,nr=null,er=!1,E?.kind===`large-file`){let e;t[177]!==$n||t[178]!==Un?(e=Un?{previousDocName:Un,onNavigateBack:$n}:void 0,t[177]=$n,t[178]=Un,t[179]=e):e=t[179],rr=(0,Z.jsx)(Sk,{docName:E.docName,size:E.size,limit:E.limit,backNav:e})}else if(E?.kind===`folder`){let e;t[180]!==y||t[181]!==J||t[182]!==_?(e=mM({terminalVisible:_,agentsVisible:y,isEmbedded:J}),t[180]=y,t[181]=J,t[182]=_,t[183]=e):e=t[183];let n=e,r;t[184]===E.folderPath?r=t[185]:(r=(0,Z.jsx)(dk,{folderPath:E.folderPath}),t[184]=E.folderPath,t[185]=r);let i;t[186]===n?i=t[187]:(i=n?(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-2 bg-linear-to-t from-background to-transparent`}):null,t[186]=n,t[187]=i);let a;t[188]!==r||t[189]!==i?(a=(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[r,i]}),t[188]=r,t[189]=i,t[190]=a):a=t[190];let o;if(t[191]!==E.folderPath||t[192]!==n?(o=n?(0,Z.jsx)($j,{folderPath:E.folderPath}):null,t[191]=E.folderPath,t[192]=n,t[193]=o):o=t[193],rr=(0,Z.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[a,o]}),k===`agent`&&A!==null){let e;t[194]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`ONPvOb`})}),children:(0,Z.jsx)(zB,{showBackButton:!1})}),t[194]=e):e=t[194],tr=e}}else if(E?.kind===`asset`&&xs(E.assetPath.split(`/`).pop()??E.assetPath)){let e;t[195]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(GB,{}),t[195]=e):e=t[195];let n;t[196]===E.assetPath?n=t[197]:(n=(0,Z.jsx)(UB,{assetPath:E.assetPath},E.assetPath),t[196]=E.assetPath,t[197]=n),rr=(0,Z.jsx)(Q.Suspense,{fallback:e,children:n})}else if(E?.kind===`asset`&&zo(E.assetPath)){let e;t[198]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(GB,{}),t[198]=e):e=t[198];let n;t[199]===E.assetPath?n=t[200]:(n=(0,Z.jsx)(WB,{assetPath:E.assetPath},E.assetPath),t[199]=E.assetPath,t[200]=n),rr=(0,Z.jsx)(Q.Suspense,{fallback:e,children:n})}else if(E?.kind===`asset`)rr=(0,Z.jsx)(yO,{assetPath:E.assetPath,mediaKind:E.mediaKind},E.assetPath);else if(E?.kind===`skill-file`)rr=(0,Z.jsx)(Vk,{scope:E.scope,name:E.name,path:E.path,host:E.host},`${E.scope}/${E.name}/${E.host??``}/${E.path}`);else if(E?.kind===`skill-preview`)rr=(0,Z.jsx)(dA,{flavor:E.flavor,source:E.source,name:E.name,subtitle:E.subtitle,level:E.level,path:E.path,reserveRightGutter:Ue},`${E.flavor}:${E.source}:${E.name}:${E.level??``}`);else if(fe)rr=(0,Z.jsx)(Ek,{nav:fe},fe.path);else if(!T||!w)if((typeof window<`u`?$p(window.location.hash):null)!==null)if(o!=null&&I){rr=(0,Z.jsx)(xO,{});let e;t[201]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`}),t[201]=e):e=t[201],tr=e}else er=!0;else rr=ln(D)?(0,Z.jsx)(Tk,{}):qn!==null&&qn===D?(0,Z.jsx)(Tk,{autoStart:!0}):(0,Z.jsx)(BO,{terminalOpen:_,agentsOpen:y,onRageStreak:D?()=>tv(()=>Jn(D)):void 0});else{let e;t[202]!==w||t[203]!==re||t[204]!==K||t[205]!==y||t[206]!==J||t[207]!==_||t[208]!==G?(e=pM({terminalVisible:_,agentsVisible:y,isEmbedded:J,activeDocName:w})&&!(G&&G.docName===w)&&!(re&&K===w),t[202]=w,t[203]=re,t[204]=K,t[205]=y,t[206]=J,t[207]=_,t[208]=G,t[209]=e):e=t[209];let n=e,r;t[210]===w?r=t[211]:(r=w?To(w):null,t[210]=w,t[211]=r);let o=r,s;t[212]!==w||t[213]!==re||t[214]!==K||t[215]!==Gn||t[216]!==B||t[217]!==o||t[218]!==Te||t[219]!==V||t[220]!==F||t[221]!==n||t[222]!==H||t[223]!==P||t[224]!==G||t[225]!==Sn?(s=e=>(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[o?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(HB,{name:o.name})}):null,(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[e,(0,Z.jsx)(XA,{activeDocName:w,isSourceMode:V}),lB({activeDocName:w,deferredActiveDocName:B,mountResolved:w!==null&&Bt(w),syncResolved:w!==null&&Ht(w)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(xO,{}),w===null?null:(0,Z.jsx)(Ck,{docName:w})]}):null,G&&G.docName===w?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(qB,{view:G,isPanelCollapsed:Te,onTogglePanel:Sn})}):null,re&&K===w?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(JB,{view:re,isPanelCollapsed:Te,onTogglePanel:Sn})}):null]}),n?(0,Z.jsx)($j,{docName:w,surface:V?`source`:`wysiwyg`,dismissed:Gn,onDismiss:()=>Kn(!0),onReopen:()=>Kn(!1)}):null]}),(0,Z.jsx)(lR,{stats:P,selectionStats:F,showStats:H,composerBadge:n&&Gn?{onReopen:()=>Kn(!1)}:null})]}),t[212]=w,t[213]=re,t[214]=K,t[215]=Gn,t[216]=B,t[217]=o,t[218]=Te,t[219]=V,t[220]=F,t[221]=n,t[222]=H,t[223]=P,t[224]=G,t[225]=Sn,t[226]=s):s=t[226];let c=s;rr=null,nr=c;let l;t[227]!==w||t[228]!==i||t[229]!==k||t[230]!==Te||t[231]!==V||t[232]!==a?(l=(0,Z.jsx)(gE,{docName:w,isSourceMode:V,activeTab:i,onActiveTabChange:a,mode:k,isCollapsed:Te}),t[227]=w,t[228]=i,t[229]=k,t[230]=Te,t[231]=V,t[232]=a,t[233]=l):l=t[233],tr=l}t[144]=w,t[145]=D,t[146]=T,t[147]=i,t[148]=E,t[149]=re,t[150]=K,t[151]=y,t[152]=qn,t[153]=Gn,t[154]=B,t[155]=A,t[156]=k,t[157]=I,t[158]=Te,t[159]=J,t[160]=V,t[161]=$n,t[162]=a,t[163]=Un,t[164]=Ue,t[165]=F,t[166]=fe,t[167]=H,t[168]=P,t[169]=o,t[170]=_,t[171]=G,t[172]=Sn,t[173]=er,t[174]=tr,t[175]=nr,t[176]=rr}else er=t[173],tr=t[174],nr=t[175],rr=t[176];C&&(tr=null);let ir=tr!=null,ar;t[234]===ir?ar=t[235]:(ar=()=>{let e=Mt.current!==ir;if(Mt.current=ir,!e)return;Nt.current!==0&&(cancelAnimationFrame(Nt.current),Nt.current=0);let t=De.current,n=e=>{Nt.current=0,!(on.current(t)||e<=0)&&(Nt.current=requestAnimationFrame(()=>n(e-1)))};n(30)},t[234]=ir,t[235]=ar),(0,Q.useLayoutEffect)(ar);let or,sr;t[236]===Symbol.for(`react.memo_cache_sentinel`)?(or=()=>()=>{Nt.current!==0&&cancelAnimationFrame(Nt.current)},sr=[],t[236]=or,t[237]=sr):(or=t[236],sr=t[237]),(0,Q.useEffect)(or,sr);let cr;t[238]===Symbol.for(`react.memo_cache_sentinel`)?(cr=function(e){let{activityMount:t,pane:n}=e,r=n.activeTarget;return t||(r?.kind===`large-file`?(0,Z.jsx)(Sk,{docName:r.docName,size:r.size,limit:r.limit}):r?.kind===`folder`?(0,Z.jsx)(dk,{folderPath:r.folderPath}):r?.kind===`asset`&&xs(r.assetPath.split(`/`).pop()??r.assetPath)?(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(GB,{}),children:(0,Z.jsx)(UB,{assetPath:r.assetPath},r.assetPath)}):r?.kind===`asset`&&zo(r.assetPath)?(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(GB,{}),children:(0,Z.jsx)(WB,{assetPath:r.assetPath},r.assetPath)}):r?.kind===`asset`?(0,Z.jsx)(yO,{assetPath:r.assetPath,mediaKind:r.mediaKind},r.assetPath):r?.kind===`skill-file`?(0,Z.jsx)(Vk,{scope:r.scope,name:r.name,path:r.path,host:r.host},`${r.scope}/${r.name}/${r.host??``}/${r.path}`):r?.kind===`skill-preview`?(0,Z.jsx)(dA,{flavor:r.flavor,source:r.source,name:r.name,subtitle:r.subtitle,level:r.level,path:r.path},`${r.flavor}:${r.source}:${r.name}:${r.level??``}`):(0,Z.jsx)(BO,{}))},t[238]=cr):cr=t[238];let lr=cr,ur;t[239]!==nr||t[240]!==rr?(ur=function(e){return e.isFocused?nr?nr(e.activityMount):rr:lr(e)},t[239]=nr,t[240]=rr,t[241]=ur):ur=t[241];let dr=ur,pr;t[242]!==w||t[243]!==B||t[244]!==W||t[245]!==Te||t[246]!==V||t[247]!==$n||t[248]!==r||t[249]!==Un||t[250]!==O||t[251]!==Ue||t[252]!==fe||t[253]!==Sn?(pr=function(e){let{activityHosts:t,parkingHost:n,visibleDocNames:i}=e,a=fe?new Set([...i].filter(e=>e!==w)):i,o=w&&a.has(w)?w:void 0,s=B&&a.has(B)?B:void 0,c=o?s??o:a.values().next().value;return c?(0,Z.jsx)(dL,{activeDocName:c,visibleDocNames:a,activityHosts:t,parkingHost:n,renderToolbar:(e,t)=>C?null:(0,Z.jsx)(KB,{docName:e,provider:t,isSourceMode:V,onModeChange:r,isPanelCollapsed:Te,onTogglePanel:Sn,reserveRightGutter:e===w&&Ue&&Te}),isSourceMode:V,editorPlaceholder:c===w?W:void 0,previousDocName:Un??void 0,onNavigateBack:$n,onRecycle:O}):null},t[242]=w,t[243]=B,t[244]=W,t[245]=Te,t[246]=V,t[247]=$n,t[248]=r,t[249]=Un,t[250]=O,t[251]=Ue,t[252]=fe,t[253]=Sn,t[254]=pr):pr=t[254];let mr=pr,hr=u??nV,gr;t[255]!==b||t[256]!==Me?(gr=e=>Me==null?null:(0,$_.createPortal)(b(e),Me),t[255]=b,t[256]=Me,t[257]=gr):gr=t[257];let _r;t[258]!==mr||t[259]!==dr||t[260]!==gr?(_r=(0,Z.jsx)(rB,{renderHeader:gr,renderPane:dr,renderActivityPool:mr}),t[258]=mr,t[259]=dr,t[260]=gr,t[261]=_r):_r=t[261];let vr;t[262]!==hr||t[263]!==_r||t[264]!==v||t[265]!==_?(vr=(0,Z.jsx)(IB,{placement:v,visible:_,onVisibleChange:hr,onBottomContainer:Le,onEditorRegion:ze,children:_r}),t[262]=hr,t[263]=_r,t[264]=v,t[265]=_,t[266]=vr):vr=t[266];let yr=vr,br=ir&&!Te,xr=!ir||Te,Sr=ir?void 0:`pointer-events-none`,Cr;t[267]===ir?Cr=t[268]:(Cr=ir?void 0:{display:`none`},t[267]=ir,t[268]=Cr);let wr;t[269]===Symbol.for(`react.memo_cache_sentinel`)?(wr=e=>{dn(e.pointerId,$e,et)},t[269]=wr):wr=t[269];let Tr;t[270]!==br||t[271]!==xr||t[272]!==Sr||t[273]!==Cr?(Tr=(0,Z.jsx)(RA,{"data-doc-panel-handle":``,withHandle:br,disabled:xr,className:Sr,style:Cr,onPointerDown:wr}),t[270]=br,t[271]=xr,t[272]=Sr,t[273]=Cr,t[274]=Tr):Tr=t[274];let Er=!ir||we?0:`${tt}px`,Dr=ir?ZB:`0px`,Or;t[275]!==ir||t[276]!==nn?(Or=e=>{ir&&Ee(e.asPercentage===0),e.inPixels>0&&et.current&&(rt.current=e.inPixels,ot(e.inPixels)),nn(uB,ir,e.inPixels)},t[275]=ir,t[276]=nn,t[277]=Or):Or=t[277];let kr=!ir||Te,Ar;t[278]!==tr||t[279]!==be||t[280]!==Er||t[281]!==Dr||t[282]!==Or||t[283]!==kr?(Ar=(0,Z.jsx)(LA,{id:uB,panelRef:be,defaultSize:Er,minSize:XB,maxSize:Dr,collapsible:!0,collapsedSize:0,onResize:Or,inert:kr,className:`flex flex-col bg-muted/20`,children:tr}),t[278]=tr,t[279]=be,t[280]=Er,t[281]=Dr,t[282]=Or,t[283]=kr,t[284]=Ar):Ar=t[284];let jr;t[285]!==Tr||t[286]!==Ar?(jr=(0,Z.jsxs)(Z.Fragment,{children:[Tr,Ar]}),t[285]=Tr,t[286]=Ar,t[287]=jr):jr=t[287];let Nr=jr,Pr=Ve?void 0:`pointer-events-none`,Fr;t[288]===Ve?Fr=t[289]:(Fr=Ve?void 0:{display:`none`},t[288]=Ve,t[289]=Fr);let Ir;t[290]!==u||t[291]!==Se?(Ir=e=>{dn(e.pointerId,yt,bt,()=>{Se.current?.isCollapsed()&&u?.(!1)})},t[290]=u,t[291]=Se,t[292]=Ir):Ir=t[292];let Lr;t[293]!==Pr||t[294]!==Fr||t[295]!==Ir||t[296]!==Ve?(Lr=(0,Z.jsx)(RA,{withHandle:Ve,className:Pr,style:Fr,onPointerDown:Ir}),t[293]=Pr,t[294]=Fr,t[295]=Ir,t[296]=Ve,t[297]=Lr):Lr=t[297];let Rr=Ve?`${gt}px`:0,X=Ve?void 0:`0px`,zr;t[298]!==Ct||t[299]!==nn||t[300]!==Ve?(zr=e=>{e.inPixels>0&&bt.current&&(_t.current=e.inPixels,Ct(e.inPixels)),nn(dB,Ve,e.inPixels)},t[298]=Ct,t[299]=nn,t[300]=Ve,t[301]=zr):zr=t[301];let Br;t[302]===Symbol.for(`react.memo_cache_sentinel`)?(Br=(0,Z.jsx)(`div`,{ref:je,"data-terminal-panel-mount":``,className:`flex min-h-0 flex-1 flex-col overflow-hidden`}),t[302]=Br):Br=t[302];let Vr;t[303]!==X||t[304]!==zr||t[305]!==Rr||t[306]!==Se?(Vr=(0,Z.jsx)(LA,{id:dB,panelRef:Se,defaultSize:Rr,minSize:`${bB}px`,maxSize:X,collapsible:!0,collapsedSize:0,onResize:zr,className:`flex flex-col`,children:Br}),t[303]=X,t[304]=zr,t[305]=Rr,t[306]=Se,t[307]=Vr):Vr=t[307];let Hr;t[308]!==Vr||t[309]!==Lr?(Hr=(0,Z.jsxs)(Z.Fragment,{children:[Lr,Vr]}),t[308]=Vr,t[309]=Lr,t[310]=Hr):Hr=t[310];let Ur=Hr,Wr=Be?void 0:`pointer-events-none`,Gr;t[311]===Be?Gr=t[312]:(Gr=Be?void 0:{display:`none`},t[311]=Be,t[312]=Gr);let Kr;t[313]!==xe||t[314]!==p?(Kr=e=>{dn(e.pointerId,ut,dt,()=>{xe.current?.isCollapsed()&&p?.(!1)})},t[313]=xe,t[314]=p,t[315]=Kr):Kr=t[315];let qr;t[316]!==Be||t[317]!==Wr||t[318]!==Gr||t[319]!==Kr?(qr=(0,Z.jsx)(RA,{withHandle:Be,className:Wr,style:Gr,onPointerDown:Kr}),t[316]=Be,t[317]=Wr,t[318]=Gr,t[319]=Kr,t[320]=qr):qr=t[320];let Jr=Be?`${st}px`:0,Yr=Be?`95%`:`0px`,Xr;t[321]!==Be||t[322]!==nn?(Xr=e=>{e.inPixels>0&&dt.current&&(ct.current=e.inPixels,mt(e.inPixels)),nn(fB,Be,e.inPixels)},t[321]=Be,t[322]=nn,t[323]=Xr):Xr=t[323];let Zr;t[324]===Symbol.for(`react.memo_cache_sentinel`)?(Zr=(0,Z.jsx)(`div`,{ref:ke,"data-agents-panel-mount":``,className:`flex min-h-0 flex-1 flex-col overflow-hidden`}),t[324]=Zr):Zr=t[324];let Qr;t[325]!==xe||t[326]!==Jr||t[327]!==Yr||t[328]!==Xr?(Qr=(0,Z.jsx)(LA,{id:fB,panelRef:xe,defaultSize:Jr,minSize:`320px`,maxSize:Yr,collapsible:!0,collapsedSize:0,onResize:Xr,className:`flex flex-col`,children:Zr}),t[325]=xe,t[326]=Jr,t[327]=Yr,t[328]=Xr,t[329]=Qr):Qr=t[329];let $r;t[330]!==qr||t[331]!==Qr?($r=(0,Z.jsxs)(Z.Fragment,{children:[qr,Qr]}),t[330]=qr,t[331]=Qr,t[332]=$r):$r=t[332];let ei=$r;if(er){let e;return t[333]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(xO,{}),t[333]=e):e=t[333],e}let ti=ir&&!we||He,ni;t[334]===Symbol.for(`react.memo_cache_sentinel`)?(ni=(0,Z.jsx)(`div`,{ref:Ne,"data-editor-area-header":``,className:`relative z-30 shrink-0`}),t[334]=ni):ni=t[334];let ri;t[335]===Symbol.for(`react.memo_cache_sentinel`)?(ri=e=>{Ot(e),kt.current=e},t[335]=ri):ri=t[335];let ii=Qe||vt||lt||void 0,ai=He?`5%`:`30%`,oi;t[336]===ti?oi=t[337]:(oi=ti?{}:{defaultSize:`100%`},t[336]=ti,t[337]=oi);let si;t[338]===yr?si=t[339]:(si=(0,Z.jsx)(`div`,{ref:Fe,className:`flex h-full min-w-0 flex-col`,children:yr}),t[338]=yr,t[339]=si);let ci;t[340]!==ai||t[341]!==oi||t[342]!==si?(ci=(0,Z.jsx)(LA,{minSize:ai,...oi,children:si}),t[340]=ai,t[341]=oi,t[342]=si,t[343]=ci):ci=t[343];let li;t[344]!==ei||t[345]!==Nr||t[346]!==Pt||t[347]!==ii||t[348]!==ci||t[349]!==Ur?(li=(0,Z.jsxs)(IA,{orientation:`horizontal`,groupRef:Pt,"data-dragging":ii,children:[ci,Nr,Ur,ei]}),t[344]=ei,t[345]=Nr,t[346]=Pt,t[347]=ii,t[348]=ci,t[349]=Ur,t[350]=li):li=t[350];let ui;t[351]!==h||t[352]!==Ue?(ui=Ue?(0,Z.jsx)(RB,{edge:`right`,onReveal:h,className:`top-2.5 right-0`}):null,t[351]=h,t[352]=Ue,t[353]=ui):ui=t[353];let di;return t[354]!==li||t[355]!==ui?(di=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[ni,(0,Z.jsxs)(`div`,{"data-editor-area-panels":``,className:`relative flex min-h-0 flex-1`,ref:ri,children:[li,ui]})]}),t[354]=li,t[355]=ui,t[356]=di):di=t[356],di}function nV(){}function rV(){return cj()}function iV(){return pj()}function aV(){return As()}function oV(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.kind!==i.kind)return!1;if(r.kind===`human`&&i.kind===`human`){if(r.clientId!==i.clientId||r.mode!==i.mode||r.tabCount!==i.tabCount)return!1;let e=r.user,t=i.user;if(e.name!==t.name||e.color!==t.color||e.icon!==t.icon)return!1}else if(r.kind===`agent`&&i.kind===`agent`){if(r.agentId!==i.agentId)return!1;let e=r.presence,t=i.presence;if(e.displayName!==t.displayName||e.icon!==t.icon||e.color!==t.color||e.currentDoc!==t.currentDoc||e.mode!==t.mode)return!1}}return!0}function sV(e){let t=new Map;for(let n of e){let e=n.user.principalId;if(typeof e==`string`&&e.length>0){let r=t.get(e);r?r.push(n):t.set(e,[n])}}let n=new Map;for(let[e,r]of t){let t=r.reduce((e,t)=>Math.min(e,t.clientId),1/0);n.set(e,{repClientId:t,count:r.length})}let r=[];for(let t of e){let e=t.user.principalId;if(typeof e==`string`&&e.length>0){let i=n.get(e);i&&i.repClientId===t.clientId&&r.push({...t,tabCount:i.count})}else r.push({...t,tabCount:1})}return r}var cV=1e3,lV=!1;function uV(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function dV(e,t,n){let r=(0,$.c)(9),i;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={current:[],crossDoc:[]},r[0]=i):i=r[0];let[a,o]=(0,Q.useState)(i),s;r[1]!==n||r[2]!==e?.awareness||r[3]!==t?.awareness?(s=()=>{let r=e?.awareness,i=t?.awareness,a;i==null?a=void 0:C_(i)?a=i:(a=void 0,lV||(lV=!0,console.warn(`[agent-presence] __system__ provider awareness missing getStates() — presence bar will render without agent peers`)));let s=()=>{let e=(r?.getLocalState())?.user?.principalId??null,t=r?.clientID??null,i=[];if(r)for(let[n,a]of r.getStates().entries()){let r=a;if(!r.user||typeof r.user!=`object`)continue;let o=r.user;o.type===`human`&&(uV({entryPrincipalId:o.principalId,entryClientId:n,localPrincipalId:e,localClientId:t})||i.push({kind:`human`,clientId:n,user:o,mode:r.mode??`wysiwyg`,tabCount:1}))}let s=sV(i),{current:c,crossDoc:l}=a?w_(a,n,Date.now()):{current:[],crossDoc:[]},u=fV,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>oV(e.current,p)&&oV(e.crossDoc,m)?e:{current:p,crossDoc:m})};s();let c=()=>s(),l=()=>s();r?.on(`change`,c),t?.awareness?.on(`change`,l);let u=setInterval(s,cV);return()=>{r?.off(`change`,c),t?.awareness?.off(`change`,l),clearInterval(u)}},r[1]=n,r[2]=e?.awareness,r[3]=t?.awareness,r[4]=s):s=r[4];let c;return r[5]!==n||r[6]!==e||r[7]!==t?(c=[e,t,n],r[5]=n,r[6]=e,r[7]=t,r[8]=c):c=r[8],(0,Q.useEffect)(s,c),a}function fV(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var pV=!1,mV=new Set,hV=!1;function gV(){for(let e of mV)e()}function _V(e){pV!==e&&(pV=e,gV())}function vV(){return pV}function yV(e){return mV.add(e),()=>{mV.delete(e)}}function bV(e){let t=[e.onUpdateRelaunching(()=>_V(!0)),e.onUpdateRelaunchFailed(()=>_V(!1))];return()=>{for(let e of t)e()}}function xV(){if(hV||typeof window>`u`)return;let e=window.okDesktop;e&&(hV=!0,bV(e))}function SV(){return(0,Q.useSyncExternalStore)(yV,vV,CV)}function CV(){return!1}var wV=`sync-status`,TV=1e4;async function EV(e){try{let t=await uf(e);t.ok||Dc.error(t.message,{id:wV,duration:1/0})}catch{}}function DV(e,t){let n=(0,$.c)(8),{_:r}=Bn(),i=SV(),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(null),c=(0,Q.useRef)(!1),l=(0,Q.useRef)(!1),u=(0,Q.useRef)(null),d,f;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>()=>{s.current!==null&&(clearTimeout(s.current),s.current=null)},f=[],n[0]=d,n[1]=f):(d=n[0],f=n[1]),(0,Q.useEffect)(d,f);let p,m;n[2]!==r||n[3]!==t||n[4]!==i||n[5]!==e?(p=()=>{let n=()=>{s.current!==null&&(clearTimeout(s.current),s.current=null)};if(e===`synced`&&(a.current=!0),i){n(),c.current=!1,u.current=null,Dc.dismiss(wV),l.current=!1;return}if(!t){n();return}let d=window.okDesktop,f=d!==void 0,p=d===void 0?{}:{action:{label:r({id:`uaUc6t`}),onClick:()=>{EV(d)}}},m=e=>{l.current=!0,Dc.warning(e,{id:wV,duration:1/0,...p})},h=()=>m(r({id:`HGNCsl`})),g=()=>m(r(f?{id:`X7fxS9`}:{id:`n6N-xC`})),_=()=>m(r(f?{id:`8QLpZe`}:{id:`m_mtGl`}));if(e===`connected`&&(n(),c.current=!1,u.current=null,l.current&&g()),e===`disconnected`&&a.current){if(o.current=!0,c.current){_();return}if(s.current===null){let e=Date.now();u.current===null&&(u.current=e);let t=Math.min(TV,TV-(e-u.current));if(t<=0){c.current=!0,_();return}s.current=setTimeout(()=>{s.current=null,c.current=!0,_()},t)}h()}else o.current&&e===`synced`&&(o.current=!1,n(),c.current=!1,u.current=null,l.current=!1,Dc.success(r({id:`GhjUB_`}),{id:wV,duration:3e3}))},m=[e,t,r,i],n[2]=r,n[3]=t,n[4]=i,n[5]=e,n[6]=p,n[7]=m):(p=n[6],m=n[7]),(0,Q.useEffect)(p,m)}var OV=4,kV=3,AV={Bird:Oy,Cat:My,Dog:By,Fish:Ky,Mouse:_b,Rabbit:gb,Shrimp:bb,Snail:xb,Squirrel:Tb,Turtle:Rb};Object.freeze(Object.keys(AV));function jV(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(AV,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var MV={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function NV(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:i}=e,{_:a}=Bn(),o=jV(n),s=o.kind===`animal`?AV[o.animal]:void 0,c;t[0]===n.name?c=t[1]:(c=ro(n.name),t[0]=n.name,t[1]=c);let l=c,u;t[2]===n.color?u=t[3]:(u=mc(n.color),t[2]=n.color,t[3]=u);let d=u,f=n.name,p;t[4]!==a||t[5]!==i||t[6]!==f?(p=i>1?a({id:`qAhFeg`,values:{userName:f,tabCount:i}}):f,t[4]=a,t[5]=i,t[6]=f,t[7]=p):p=t[7];let m=p,h;t[8]!==a||t[9]!==i||t[10]!==f?(h=i>1?a({id:`BEkF-P`,values:{userName:f,tabCount:i}}):f,t[8]=a,t[9]=i,t[10]=f,t[11]=h):h=t[11];let g=h,_;t[12]===n.color?_=t[13]:(_={backgroundColor:n.color},t[12]=n.color,t[13]=_);let v;t[14]!==s||t[15]!==d||t[16]!==l?(v=s?(0,Z.jsx)(s,{size:18,color:d,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:d},children:l}),t[14]=s,t[15]=d,t[16]=l,t[17]=v):v=t[17];let y;t[18]!==g||t[19]!==r||t[20]!==_||t[21]!==v?(y=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":g,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:_,children:v})}),t[18]=g,t[19]=r,t[20]=_,t[21]=v,t[22]=y):y=t[22];let b;t[23]===m?b=t[24]:(b=(0,Z.jsx)(Vr,{children:m}),t[23]=m,t[24]=b);let x;return t[25]!==y||t[26]!==b?(x=(0,Z.jsxs)(Ur,{children:[y,b]}),t[25]=y,t[26]=b,t[27]=x):x=t[27],x}function PV(e){let t=MV[e.icon];return e.displayName||t||Hc._({id:`iEQQyu`})}function FV(e){let t=(0,$.c)(3),[n,r]=(0,Q.useState)(e===`writing`),i=(0,Q.useRef)(null),a,o;return t[0]===e?(a=t[1],o=t[2]):(a=()=>{if(e===`writing`){i.current!==null&&(clearTimeout(i.current),i.current=null),r(!0);return}return i.current!==null&&clearTimeout(i.current),i.current=setTimeout(()=>{i.current=null,r(!1)},600),()=>{i.current!==null&&(clearTimeout(i.current),i.current=null)}},o=[e],t[0]=e,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o),n}function IV(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{_:o}=Bn(),{activeDocName:s}=Et(),{presence:c,agentId:l}=n,u=PV(c),d=FV(c.mode),f=!r&&d,p=c.currentDoc&&!es(c.currentDoc)?c.currentDoc:null,m=s!==null||p!==null,h=m?`cursor-pointer`:`cursor-default opacity-50`,g=i?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,_=f&&!i?`ring-primary/40 animate-pulse`:``,v;t[0]!==h||t[1]!==g||t[2]!==_?(v=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2`,h,g,_].filter(Boolean),t[0]=h,t[1]=g,t[2]=_,t[3]=v):v=t[3];let y=v.join(` `),b=r?`true`:void 0,x=i?`true`:void 0,S=m?void 0:`true`,C;t[4]!==c.mode||t[5]!==b||t[6]!==x||t[7]!==S?(C={"data-presence-badge":`agent`,"data-presence-mode":c.mode,"data-presence-crossdoc":b,"data-presence-scoped":x,"data-presence-inert":S},t[4]=c.mode,t[5]=b,t[6]=x,t[7]=S,t[8]=C):C=t[8];let w=C,T=o(r&&p?{id:`b4AQFK`,values:{tooltipName:u,realCurrentDoc:p}}:{id:`RfHNf8`,values:{tooltipName:u}}),E;t[9]!==l||t[10]!==T||t[11]!==w||t[12]!==m||t[13]!==a||t[14]!==c.color||t[15]!==c.icon||t[16]!==p||t[17]!==y||t[18]!==u?(E=m?(0,Z.jsx)(`button`,{type:`button`,...w,"aria-label":T,className:y,style:{backgroundColor:c.color},onClick:()=>a(l,p),children:(0,Z.jsx)(sg,{icon:c.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}):(0,Z.jsx)(`div`,{...w,role:`img`,"aria-label":u,className:y,style:{backgroundColor:c.color},children:(0,Z.jsx)(sg,{icon:c.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}),t[9]=l,t[10]=T,t[11]=w,t[12]=m,t[13]=a,t[14]=c.color,t[15]=c.icon,t[16]=p,t[17]=y,t[18]=u,t[19]=E):E=t[19];let D=E,O;t[20]===D?O=t[21]:(O=(0,Z.jsx)(Br,{asChild:!0,children:D}),t[20]=D,t[21]=O);let k;t[22]===u?k=t[23]:(k=(0,Z.jsx)(`span`,{className:`font-medium`,children:u}),t[22]=u,t[23]=k);let A;t[24]!==r||t[25]!==p?(A=r&&p?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`Wh0im4`,values:{realCurrentDoc:p}})}):null,t[24]=r,t[25]=p,t[26]=A):A=t[26];let j;t[27]!==k||t[28]!==A?(j=(0,Z.jsxs)(Vr,{className:`flex flex-col gap-0.5`,children:[k,A]}),t[27]=k,t[28]=A,t[29]=j):j=t[29];let M;return t[30]!==O||t[31]!==j?(M=(0,Z.jsxs)(Ur,{children:[O,j]}),t[30]=O,t[31]=j,t[32]=M):M=t[32],M}function LV(e){let t=(0,$.c)(21),{count:n,remainder:r,crossDoc:i,scopedAgentId:a,onClickAgent:o}=e,s;t[0]!==n||t[1]!==i?(s=i?Hc._({id:`9euN0m`,values:{count:n}}):Hc._({id:`uhJEA2`,values:{count:n}}),t[0]=n,t[1]=i,t[2]=s):s=t[2];let c=s,l=i?`true`:void 0,u;t[3]!==n||t[4]!==c||t[5]!==l?(u=(0,Z.jsx)(fh,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`presence-overflow`,"data-presence-crossdoc":l,className:`inline-flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-full bg-muted font-medium text-muted-foreground text-xs ring-2 ring-background hover:bg-muted/80`,"aria-label":c,children:[`+`,n]})}),t[3]=n,t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;if(t[7]!==i||t[8]!==o||t[9]!==r||t[10]!==a){let e;t[12]!==i||t[13]!==o||t[14]!==a?(e=e=>e.kind===`human`?(0,Z.jsx)(NV,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(IV,{participant:e,crossDoc:i,scoped:a===e.agentId,onClickAgent:o},e.agentId),t[12]=i,t[13]=o,t[14]=a,t[15]=e):e=t[15],d=r.map(e),t[7]=i,t[8]=o,t[9]=r,t[10]=a,t[11]=d}else d=t[11];let f;t[16]===d?f=t[17]:(f=(0,Z.jsx)(ph,{align:`end`,className:`w-auto max-w-xs p-2`,children:(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:d})}),t[16]=d,t[17]=f);let p;return t[18]!==u||t[19]!==f?(p=(0,Z.jsxs)(hh,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function RV(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(NV,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(IV,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function zV(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=Et(),{current:s,crossDoc:c}=dV(t,r,n);if(DV(Aw(t),n),s.length===0&&c.length===0)return null;let l;if(e[0]!==c||e[1]!==s||e[2]!==o||e[3]!==a||e[4]!==i){let t=s.slice(0,OV),n;e[6]===s?n=e[7]:(n=s.slice(OV),e[6]=s,e[7]=n);let r=n,u=c.slice(0,kV),d;e[8]===c?d=e[9]:(d=c.slice(kV),e[8]=c,e[9]=d);let f=d,p=i,m=a===`agent`?o:null,h;e[10]!==p||e[11]!==m?(h=e=>RV(e,p,!1,m),e[10]=p,e[11]=m,e[12]=h):h=e[12];let g=t.map(h),_;e[13]!==r||e[14]!==p||e[15]!==m?(_=r.length>0?(0,Z.jsx)(LV,{count:r.length,remainder:r,crossDoc:!1,scopedAgentId:m,onClickAgent:p}):null,e[13]=r,e[14]=p,e[15]=m,e[16]=_):_=e[16];let v;e[17]!==g||e[18]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,"data-presence-section":`current`,children:[g,_]}),e[17]=g,e[18]=_,e[19]=v):v=e[19],l=(0,Z.jsxs)(`div`,{"data-slot":`presence-bar`,className:`flex items-center px-1 py-1.5`,children:[v,c.length>0?(0,Z.jsxs)(`div`,{className:`ml-1.5 flex items-center gap-1.5`,"data-presence-section":`crossdoc`,children:[u.map(e=>RV(e,p,!0,m)),f.length>0?(0,Z.jsx)(LV,{count:f.length,remainder:f,crossDoc:!0,scopedAgentId:m,onClickAgent:p}):null]}):null]}),e[0]=c,e[1]=s,e[2]=o,e[3]=a,e[4]=i,e[5]=l}else l=e[5];return l}function BV(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(null),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.okDesktop;if(!e)return;let t=!1;return e.state.query().then(e=>{t||n(e.channel)}).catch(VV),()=>{t=!0}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a;return e[2]===t?a=e[3]:(a={channel:t},e[2]=t,e[3]=a),a}function VV(e){console.warn(`[use-update-channel] bridge.state.query() failed`,e)}function HV(e){let t=(0,$.c)(6),{className:n}=e,{_:r}=Bn(),{channel:i}=BV();if(i!==`beta`)return null;let a;t[0]===r?a=t[1]:(a=r({id:`9fhQRL`}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Y,{id:`cSCbv3`}),t[2]=o):o=t[2];let s;return t[3]!==n||t[4]!==a?(s=(0,Z.jsx)(Sh,{variant:`secondary`,"aria-label":a,"data-testid":`beta-badge`,className:n,children:o}),t[3]=n,t[4]=a,t[5]=s):s=t[5],s}var UV=(e,t,n)=>{if(e&&`reportValidity`in e){let r=I_(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},WV=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?UV(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>UV(t,n,e))}},GV=(e,t)=>{t.shouldUseNativeValidation&&WV(e,t);let n={};for(let r in e){let i=I_(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.ref});if(KV(t.names||Object.keys(e),r)){let e=Object.assign({},I_(n,r));D_(e,`root`,a),D_(n,r,e)}else D_(n,r,a)}return n},KV=(e,t)=>{let n=qV(t).replace(/[.*+?^${}()|\\]/g,`\\$&`);return e.some(e=>qV(e).match(`^${n}\\.\\d+`))};function qV(e){return e.replace(/[\[\]]/g,``)}function JV(){return JV=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},JV.apply(null,arguments)}function YV(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function XV(e,t){for(var n={};e.length;){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(`unionErrors`in r){var s=r.unionErrors[0].errors[0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(`unionErrors`in r&&r.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=A_(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function ZV(e,t){for(var n={},r=function(){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(r.code===`invalid_union`&&r.errors.length>0){var s=r.errors[0][0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(r.code===`invalid_union`&&r.errors.forEach(function(t){return t.forEach(function(t){return e.push(JV({},t,{path:[].concat(r.path,t.path)}))})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=A_(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()};e.length;)r();return n}function QV(e,t,n){if(n===void 0&&(n={}),function(e){return`_def`in e&&typeof e._def==`object`&&`typeName`in e._def}(e))return function(r,i,a){try{return Promise.resolve(YV(function(){return Promise.resolve(e[n.mode===`sync`?`parse`:`parseAsync`](r,t)).then(function(e){return a.shouldUseNativeValidation&&WV({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return Array.isArray(e?.issues)}(e))return{values:{},errors:GV(XV(e.errors,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return`_zod`in e&&typeof e._zod==`object`}(e))return function(r,i,a){try{return Promise.resolve(YV(function(){return Promise.resolve((n.mode===`sync`?gc:Qs)(e,r,t)).then(function(e){return a.shouldUseNativeValidation&&WV({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return e instanceof cc}(e))return{values:{},errors:GV(ZV(e.issues,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};throw Error(`Invalid input: not a Zod schema`)}var $V=`https://openknowledge.ai/api/subscribe`;async function eH(e,t){try{let n=await fetch($V,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({email:e,source:t}),signal:AbortSignal.timeout(15e3)});return n.ok?{ok:!0}:n.status===400?{ok:!1,reason:`invalid`}:n.status===503?{ok:!1,reason:`unavailable`}:(console.warn(`[subscribe] action=submit result=http-error status=${n.status}`),{ok:!1,reason:`error`})}catch(e){return console.warn(`[subscribe] action=submit result=network-error message=${e instanceof Error?e.message:String(e)}`),{ok:!1,reason:`error`}}}function tH(e){let t=(0,$.c)(49),{source:n,title:r,description:i,onSuccess:a,onDismiss:o,autoFocus:s,compactSubmit:c,className:l}=e,{_:u}=Bn(),[d,f]=(0,Q.useState)(!1),p=(0,Q.useRef)(null),m,h;t[0]===d?(m=t[1],h=t[2]):(m=()=>{d&&p.current?.focus()},h=[d],t[0]=d,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let g,_;if(t[3]!==u){let e=io({email:Cs({message:u({id:`Wq6Wcm`})})});_=O_,g=QV(e),t[3]=u,t[4]=g,t[5]=_}else g=t[4],_=t[5];let v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v={email:``},t[6]=v):v=t[6];let y;t[7]===g?y=t[8]:(y={resolver:g,defaultValues:v},t[7]=g,t[8]=y);let b=_(y),{isSubmitting:x}=b.formState,S=b.formState.errors.email?.message??b.formState.errors.root?.message,C;t[9]!==u||t[10]!==b||t[11]!==a||t[12]!==n?(C=async function(e){b.clearErrors(`root`);let t=await eH(e.email,n);if(t.ok){f(!0),a?.();return}if(t.reason===`invalid`){b.setError(`email`,{message:u({id:`Wq6Wcm`})});return}if(t.reason===`unavailable`){b.setError(`root`,{message:u({id:`4mLBx9`})});return}b.setError(`root`,{message:u({id:`fWsBTs`})})},t[9]=u,t[10]=b,t[11]=a,t[12]=n,t[13]=C):C=t[13];let w=C,T;t[14]===l?T=t[15]:(T=gr(`flex flex-col gap-3`,l),t[14]=l,t[15]=T);let E=d?-1:void 0,D;t[16]!==d||t[17]!==r?(D=d?(0,Z.jsxs)(`span`,{className:`mb-1.5 inline-flex flex-row items-center gap-2`,children:[(0,Z.jsx)(Uu,{className:`size-4 text-primary`}),(0,Z.jsx)(Y,{id:`PIMM5l`})]}):r??(0,Z.jsx)(Y,{id:`GzPQ2f`}),t[16]=d,t[17]=r,t[18]=D):D=t[18];let O;t[19]!==D||t[20]!==E?(O=(0,Z.jsx)(`p`,{ref:p,tabIndex:E,className:`text-sm font-medium leading-tight text-foreground focus:outline-none`,children:D}),t[19]=D,t[20]=E,t[21]=O):O=t[21];let k;t[22]!==i||t[23]!==d?(k=d?(0,Z.jsx)(Y,{id:`pBROkv`}):i??(0,Z.jsx)(Y,{id:`WmPbvm`}),t[22]=i,t[23]=d,t[24]=k):k=t[24];let A;t[25]===k?A=t[26]:(A=(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,role:`status`,children:k}),t[25]=k,t[26]=A);let j;t[27]!==O||t[28]!==A?(j=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[O,A]}),t[27]=O,t[28]=A,t[29]=j):j=t[29];let M;t[30]!==u||t[31]!==o?(M=o?(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon`,onClick:o,"aria-label":u({id:`yz7wBu`}),className:`-mr-1.5 -mt-1 size-7 shrink-0 text-muted-foreground opacity-60`,children:(0,Z.jsx)(zp,{className:`size-4`})}):null,t[30]=u,t[31]=o,t[32]=M):M=t[32];let N;t[33]!==j||t[34]!==M?(N=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[j,M]}),t[33]=j,t[34]=M,t[35]=N):N=t[35];let P;t[36]!==u||t[37]!==s||t[38]!==c||t[39]!==S||t[40]!==b||t[41]!==x||t[42]!==w||t[43]!==d?(P=d?null:(0,Z.jsxs)(`form`,{onSubmit:b.handleSubmit(w),className:`flex flex-col gap-2`,noValidate:!0,children:[(0,Z.jsx)(E_,{control:b.control,name:`email`,render:e=>{let{field:t,fieldState:n}=e;return(0,Z.jsxs)(Ug,{className:`h-10 rounded-xl`,children:[(0,Z.jsx)(Vg,{className:`pl-2.5`,children:(0,Z.jsx)(ap,{className:`size-4 text-muted-foreground opacity-60`})}),(0,Z.jsx)(Hg,{...t,id:t.name,type:`email`,inputMode:`email`,autoComplete:`email`,spellCheck:!1,autoFocus:s,placeholder:u({id:`2hYmUH`}),"aria-invalid":n.invalid,"aria-label":u({id:`ATGYL1`}),"data-testid":`subscribe-email`,className:`placeholder:text-muted-foreground/60`}),(0,Z.jsx)(X,{type:`submit`,disabled:x,size:c?`icon`:`default`,className:gr(`mr-1 ml-auto text-1sm`,c&&`size-8 shrink-0 rounded-lg`),"data-testid":`subscribe-submit`,children:x?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ip,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`lCC_D5`})})]}):c?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Du,{className:`size-4`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`EDl9kS`})})]}):(0,Z.jsx)(Y,{id:`EDl9kS`})})]})}}),S?(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,role:`alert`,children:S}):null]}),t[36]=u,t[37]=s,t[38]=c,t[39]=S,t[40]=b,t[41]=x,t[42]=w,t[43]=d,t[44]=P):P=t[44];let F;return t[45]!==N||t[46]!==P||t[47]!==T?(F=(0,Z.jsxs)(`div`,{className:T,children:[N,P]}),t[45]=N,t[46]=P,t[47]=T,t[48]=F):F=t[48],F}var nH=`ok-feedback-nudge-v1`,rH={firstSeenAt:null,shownAt:null,dismissed:!1};function iH(e){let t=0;for(let n of e)wm(n)||t++;return t}function aH(e,t,n){return!e.dismissed&&e.shownAt==null&&e.firstSeenAt!=null&&t-e.firstSeenAt>=12096e5&&n>=10}function oH(e){return e===!0}function sH(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:null}function cH(e){if(typeof e!=`object`||!e)return rH;let t=e;return{firstSeenAt:sH(t.firstSeenAt),shownAt:sH(t.shownAt),dismissed:oH(t.dismissed)}}function lH(e){try{let t=(e??localStorage).getItem(nH);return t==null?rH:cH(JSON.parse(t))}catch(e){return console.warn(`[feedback-nudge-store] readPersistedState failed (corrupt/privacy/SSR)`,e),rH}}function uH(e,t){try{(t??localStorage).setItem(nH,JSON.stringify(e))}catch(e){console.warn(`[feedback-nudge-store] writePersistedState failed (quota/privacy/SSR)`,e)}}function dH(e){let t=lH(e),n=new Set,r=!1;function i(){for(let e of n)e()}function a(n){t=n,uH(t,e),i()}function o(){t=lH(e),i()}return{getSnapshot(){return t},subscribe(e){return n.add(e),()=>{n.delete(e)}},recordFirstSeen(e){t.firstSeenAt??a({...t,firstSeenAt:e})},recordShown(e){t.shownAt??a({...t,shownAt:e})},dismiss(){t.dismissed||a({...t,dismissed:!0})},syncFromStorage:o,install(){r||(r=!0,o())}}}var fH=dH();typeof window<`u`&&typeof window.addEventListener==`function`&&window.addEventListener(`storage`,e=>{(e.key===`ok-feedback-nudge-v1`||e.key===null)&&fH.syncFromStorage()});function pH(){fH.install()}var mH=`https://github.com/inkeep/open-knowledge`,hH=`https://discord.gg/VRKk2EaGHN`,gH=`https://x.com/OpenKnowledge`,_H=`ok-subscribe-card-v1`,vH={subscribed:!1,dismissed:!1,shownVersions:[]};function yH(e,t){return!e.subscribed&&!e.dismissed&&e.shownVersions.length<3&&!e.shownVersions.includes(t)}function bH(e){return e===!0}function xH(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function SH(e){if(typeof e!=`object`||!e)return vH;let t=e;return{subscribed:bH(t.subscribed),dismissed:bH(t.dismissed),shownVersions:xH(t.shownVersions)}}function CH(e){try{let t=(e??localStorage).getItem(_H);return t==null?vH:SH(JSON.parse(t))}catch(e){return console.warn(`[subscribe-card-store] readPersistedState failed (corrupt/privacy/SSR)`,e),vH}}function wH(e,t){try{(t??localStorage).setItem(_H,JSON.stringify(e))}catch(e){console.warn(`[subscribe-card-store] writePersistedState failed (quota/privacy/SSR)`,e)}}function TH(e){let t=CH(e),n=new Set,r=!1;function i(){for(let e of n)e()}function a(n){t=n,wH(t,e),i()}return{getSnapshot(){return t},subscribe(e){return n.add(e),()=>{n.delete(e)}},markSubscribed(){t.subscribed||a({...t,subscribed:!0})},dismiss(){t.dismissed||a({...t,dismissed:!0})},recordShown(e){t.shownVersions.includes(e)||a({...t,shownVersions:[...t.shownVersions,e]})},install(){r||(r=!0,t=CH(e),i())}}}var EH=TH();function DH(){EH.install()}function OH(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Discord`}),r=(0,Z.jsx)(`path`,{d:`M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9554 2.4189-2.1568 2.4189Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function kH(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`X (Twitter)`}),r=(0,Z.jsx)(`path`,{d:`M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}var AH=[{key:`resources`,heading:{id:`s-MGs7`},links:[{label:{id:`TbjyhA`},href:`https://openknowledge.ai/docs`,icon:xe},{label:{id:`n4vt3Q`},href:`https://openknowledge.ai/download`,icon:yf}]},{key:`community`,heading:{id:`chL5IG`},links:[{label:`GitHub`,href:mH,icon:Jx},{label:`X (Twitter)`,href:gH,icon:kH},{label:`Discord`,href:hH,icon:OH}]}],jH=`${mH}/releases`,MH=`group flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm text-muted-foreground transition-colors hover:bg-azure-900/5 dark:hover:bg-white/20 hover:text-primary`;function NH(e){if(e<1e3)return String(e);let t=e/1e3;return`${t>=10?Math.round(t):t.toFixed(1)}k`}var PH=e=>{let t=(0,$.c)(12),{count:n}=e,{_:r}=Bn(),i,a,o,s;t[0]!==r||t[1]!==n?(i=NH(n),a=`img`,o=`ml-auto flex items-center gap-1 text-xs tabular-nums text-muted-foreground`,s=r({id:`SVLPt5`,values:{formatted:i}}),t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s):(i=t[2],a=t[3],o=t[4],s=t[5]);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Eb,{className:`size-3 fill-current`,"aria-hidden":`true`}),t[6]=c):c=t[6];let l;return t[7]!==i||t[8]!==a||t[9]!==o||t[10]!==s?(l=(0,Z.jsxs)(`span`,{role:a,className:o,"aria-label":s,children:[c,i]}),t[7]=i,t[8]=a,t[9]=o,t[10]=s,t[11]=l):l=t[11],l},FH=e=>{let t=(0,$.c)(15),{link:n,trailing:r}=e,{_:i}=Bn(),{label:a,href:o,icon:s}=n,c,l;t[0]===o?(c=t[1],l=t[2]):(c=e=>_h(e,o),l=e=>_h(e,o),t[0]=o,t[1]=c,t[2]=l);let u;t[3]===s?u=t[4]:(u=(0,Z.jsx)(s,{"aria-hidden":`true`,className:`size-4 shrink-0`}),t[3]=s,t[4]=u);let d;t[5]!==i||t[6]!==a?(d=typeof a==`string`?a:i(a),t[5]=i,t[6]=a,t[7]=d):d=t[7];let f;return t[8]!==o||t[9]!==c||t[10]!==l||t[11]!==u||t[12]!==d||t[13]!==r?(f=(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,onClick:c,onAuxClick:l,className:MH,children:[u,d,r]})}),t[8]=o,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=r,t[14]=f):f=t[14],f},IH=e=>{let t=(0,$.c)(7),{icon:n,onSelect:r,children:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=gr(MH,`h-auto w-full justify-start font-normal`),t[0]=a):a=t[0];let o;t[1]===n?o=t[2]:(o=(0,Z.jsx)(n,{"aria-hidden":`true`,className:`size-4 shrink-0`}),t[1]=n,t[2]=o);let s;return t[3]!==i||t[4]!==r||t[5]!==o?(s=(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(X,{variant:`ghost`,className:a,onClick:r,children:[o,i]})}),t[3]=i,t[4]=r,t[5]=o,t[6]=s):s=t[6],s},LH=e=>{let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:n}),t[0]=n,t[1]=r),r},RH=()=>{let e=(0,$.c)(36),{_:t}=Bn(),[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=typeof window<`u`&&window.okDesktop!=null,p,m;e[0]!==n||e[1]!==u?(p=()=>{if(!n||u!==null)return;let e=new AbortController;return bc({signal:e.signal}).then(e=>{e!==null&&d(e)}),()=>e.abort()},m=[n,u],e[0]=n,e[1]=u,e[2]=p,e[3]=m):(p=e[2],m=e[3]),(0,Q.useEffect)(p,m);let h;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>{r(e),e||a(!1)},e[4]=h):h=e[4];let g;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(_,{className:`size-4`}),e[5]=g):g=e[5];let v;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(fh,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[g,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`s-MGs7`})})]})})}),e[6]=v):v=e[6];let y;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsxs)(Ur,{children:[v,(0,Z.jsx)(Vr,{children:(0,Z.jsx)(Y,{id:`s-MGs7`})})]}),e[7]=y):y=e[7];let b;e[8]!==t||e[9]!==u?(b=AH.map((e,n)=>(0,Z.jsxs)(`div`,{className:gr(n>0&&`mt-3`),children:[(0,Z.jsx)(LH,{children:t(e.heading)}),(0,Z.jsx)(`nav`,{"aria-label":t(e.heading),children:(0,Z.jsxs)(`ul`,{className:`space-y-0.5`,children:[e.links.map(e=>(0,Z.jsx)(FH,{link:e,trailing:e.href===`https://github.com/inkeep/open-knowledge`&&u!==null?(0,Z.jsx)(PH,{count:u}):void 0},e.href)),e.key===`resources`&&(0,Z.jsxs)(Z.Fragment,{children:[f&&(0,Z.jsx)(IH,{icon:Dn,onSelect:()=>{r(!1),s(!0)},children:(0,Z.jsx)(Y,{id:`cd5EXh`})}),(0,Z.jsx)(IH,{icon:fp,onSelect:()=>{r(!1),l(!0)},children:(0,Z.jsx)(Y,{id:`RoafuO`})})]})]})})]},e.key)),e[8]=t,e[9]=u,e[10]=b):b=e[10];let x;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(LH,{children:(0,Z.jsx)(Y,{id:`arUUsK`})}),e[11]=x):x=e[11];let S;e[12]===t?S=e[13]:(S=t({id:`arUUsK`}),e[12]=t,e[13]=S);let C;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(FH,{link:{label:{id:`3ePd3I`},href:jH,icon:sb}}),e[14]=C):C=e[14];let w;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(fh,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,className:gr(MH,`h-auto w-full justify-start font-normal`),children:[(0,Z.jsx)(ap,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Z.jsx)(Y,{id:`EDl9kS`})]})}),e[15]=w):w=e[15];let T;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(ph,{side:`left`,align:`center`,sideOffset:20,className:`w-80`,children:(0,Z.jsx)(tH,{source:`resources_menu`,autoFocus:!0,onDismiss:()=>a(!1),onSuccess:zH})}),e[16]=T):T=e[16];let E;e[17]===i?E=e[18]:(E=(0,Z.jsxs)(`ul`,{className:`space-y-0.5`,children:[C,(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(hh,{open:i,onOpenChange:a,children:[w,T]})})]}),e[17]=i,e[18]=E);let D;e[19]!==E||e[20]!==S?(D=(0,Z.jsxs)(`div`,{className:`mt-3`,children:[x,(0,Z.jsx)(`nav`,{"aria-label":S,children:E})]}),e[19]=E,e[20]=S,e[21]=D):D=e[21];let O;e[22]!==D||e[23]!==b?(O=(0,Z.jsxs)(ph,{align:`end`,className:`w-56 p-3`,children:[b,D]}),e[22]=D,e[23]=b,e[24]=O):O=e[24];let k;e[25]!==n||e[26]!==O?(k=(0,Z.jsxs)(hh,{open:n,onOpenChange:h,children:[y,O]}),e[25]=n,e[26]=O,e[27]=k):k=e[27];let A;e[28]===o?A=e[29]:(A=f&&(0,Z.jsx)(Fr,{open:o,onOpenChange:s,launcherBorne:!0}),e[28]=o,e[29]=A);let j;e[30]===c?j=e[31]:(j=(0,Z.jsx)(HS,{open:c,onOpenChange:l,onSuccess:BH}),e[30]=c,e[31]=j);let M;return e[32]!==k||e[33]!==A||e[34]!==j?(M=(0,Z.jsxs)(Z.Fragment,{children:[k,A,j]}),e[32]=k,e[33]=A,e[34]=j,e[35]=M):M=e[35],M};function zH(){return EH.markSubscribed()}function BH(){return fH.dismiss()}function VH(e){let t=(0,$.c)(14),{className:n}=e,{_:r}=Bn(),i=typeof window<`u`?window.okDesktop?.instanceLabel??null:null;if(!i)return null;let a;t[0]===r?a=t[1]:(a=r({id:`iRdfLr`,values:{label:i}}),t[0]=r,t[1]=a);let o,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(vu,{"aria-hidden":`true`}),s=(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:i}),t[2]=o,t[3]=s):(o=t[2],s=t[3]);let c;t[4]!==n||t[5]!==a?(c=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsxs)(Sh,{variant:`secondary`,"aria-label":a,"data-testid":`instance-badge`,className:n,children:[o,s]})}),t[4]=n,t[5]=a,t[6]=c):c=t[6];let l;t[7]===r?l=t[8]:(l=r({id:`c5PTFE`,values:{label:i}}),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Z.jsx)(Vr,{children:l}),t[9]=l,t[10]=u);let d;return t[11]!==c||t[12]!==u?(d=(0,Z.jsxs)(Ur,{children:[c,u]}),t[11]=c,t[12]=u,t[13]=d):d=t[13],d}var HH=1,UH=2,WH=HH|UH;function GH(){if(!(typeof window>`u`))return window.navigation}function KH(){let e=GH();return e?(e.canGoBack?HH:0)|(e.canGoForward?UH:0):WH}function qH(e){let t=GH();return t?(t.addEventListener(`currententrychange`,e),()=>t.removeEventListener(`currententrychange`,e)):()=>{}}function JH(){let e=(0,$.c)(42),{_:t}=Bn(),n=(0,Q.useSyncExternalStore)(qH,KH,ZH),r=(n&HH)!==0,i=(n&UH)!==0,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=Lc(`navigate-back`),e[0]=a):a=e[0];let o=a,s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=Ac(`navigate-back`),e[1]=s):s=e[1];let c=s,l;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=Lc(`navigate-forward`),e[2]=l):l=e[2];let u=l,d;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=Ac(`navigate-forward`),e[3]=d):d=e[3];let f=d,p;e[4]===t?p=e[5]:(p=t({id:`kBNHN1`}),e[4]=t,e[5]=p);let m;e[6]===t?m=e[7]:(m=t({id:`iH8pgl`}),e[6]=t,e[7]=m);let h=!r,g;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(Au,{"aria-hidden":`true`}),e[8]=g):g=e[8];let _;e[9]!==m||e[10]!==h?(_=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{"aria-label":m,className:`[-webkit-app-region:no-drag]`,disabled:h,onClick:XH,size:`icon-sm`,variant:`ghost`,children:g})}),e[9]=m,e[10]=h,e[11]=_):_=e[11];let v;e[12]===t?v=e[13]:(v=t({id:`iH8pgl`}),e[12]=t,e[13]=v);let y;e[14]===v?y=e[15]:(y=(0,Z.jsx)(`span`,{children:v}),e[14]=v,e[15]=y);let b;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(en,{"aria-label":c,children:o}),e[16]=b):b=e[16];let x;e[17]===y?x=e[18]:(x=(0,Z.jsxs)(Vr,{children:[y,` `,b]}),e[17]=y,e[18]=x);let S;e[19]!==x||e[20]!==_?(S=(0,Z.jsxs)(Ur,{children:[_,x]}),e[19]=x,e[20]=_,e[21]=S):S=e[21];let C;e[22]===t?C=e[23]:(C=t({id:`rxWGWX`}),e[22]=t,e[23]=C);let w=!i,T;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Du,{"aria-hidden":`true`}),e[24]=T):T=e[24];let E;e[25]!==C||e[26]!==w?(E=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{"aria-label":C,className:`[-webkit-app-region:no-drag]`,disabled:w,onClick:YH,size:`icon-sm`,variant:`ghost`,children:T})}),e[25]=C,e[26]=w,e[27]=E):E=e[27];let D;e[28]===t?D=e[29]:(D=t({id:`rxWGWX`}),e[28]=t,e[29]=D);let O;e[30]===D?O=e[31]:(O=(0,Z.jsx)(`span`,{children:D}),e[30]=D,e[31]=O);let k;e[32]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(en,{"aria-label":f,children:u}),e[32]=k):k=e[32];let A;e[33]===O?A=e[34]:(A=(0,Z.jsxs)(Vr,{children:[O,` `,k]}),e[33]=O,e[34]=A);let j;e[35]!==E||e[36]!==A?(j=(0,Z.jsxs)(Ur,{children:[E,A]}),e[35]=E,e[36]=A,e[37]=j):j=e[37];let M;return e[38]!==S||e[39]!==j||e[40]!==p?(M=(0,Z.jsxs)(Ma,{"aria-label":p,className:`shrink-0`,"data-testid":`navigation-history-controls`,children:[S,j]}),e[38]=S,e[39]=j,e[40]=p,e[41]=M):M=e[41],M}function YH(){return hr(`navigate-forward`)}function XH(){return hr(`navigate-back`)}function ZH(){return WH}var QH=50,$H=()=>{let e=(0,$.c)(8),t=(0,Q.useRef)(null),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=()=>{t.current===null&&(t.current=setTimeout(()=>{t.current=null,pA.preload()},QH))},e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{t.current!==null&&(clearTimeout(t.current),t.current=null)},e[1]=i):i=e[1];let a=i,o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{a(),window.location.hash!==`#settings`&&(window.location.hash=zc)},e[2]=o):o=e[2];let s=o,c,l;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>()=>{t.current!==null&&clearTimeout(t.current)},l=[],e[3]=c,e[4]=l):(c=e[3],l=e[4]),(0,Q.useEffect)(c,l);let u;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Ar,{className:`size-4`}),e[5]=u):u=e[5];let d;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,"data-testid":`header-settings-button`,onMouseEnter:r,onMouseLeave:a,onFocus:r,onBlur:a,onClick:s,children:[u,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`Tz0i8g`})})]})}),e[6]=d):d=e[6];let f;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsxs)(Ur,{children:[d,(0,Z.jsx)(Vr,{children:(0,Z.jsx)(Y,{id:`Tz0i8g`})})]}),e[7]=f):f=e[7],f},eU=`https://openknowledge.ai/docs/features/share`,tU={mac:`⌘ C`,windowsLinux:`Ctrl C`};function nU(e){let t=(0,$.c)(52),{input:n,onClickWhenNoRemote:r}=e,{_:i}=Bn(),{status:a}=xu(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(null),d;t[0]===c?.autoCopyFailed?d=t[1]:(d=()=>{!c?.autoCopyFailed||!u.current||(u.current.focus(),u.current.select())},t[0]=c?.autoCopyFailed,t[1]=d);let f;t[2]===c?f=t[3]:(f=[c],t[2]=c,t[3]=f),(0,Q.useEffect)(d,f);let p=a?.hasRemote===!0,m=n===null,h=Sf(c?.freshness,a),g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=Pc(tU),t[4]=g):g=t[4];let v=g,y;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(y=Nc(tU),t[5]=y):y=t[5];let b=y,x;t[6]!==i||t[7]!==o||t[8]!==p||t[9]!==n||t[10]!==r?(x=async function(){if(!o&&n!==null){s(!0),l(null);try{let e=await Hd({...n,hasRemote:p,onClickWhenNoRemote:r},{clipboardWrite:_r,toastSuccess:uU,toastError:lU,logEvent:cU});e.kind===`copied`?l({url:e.shareUrl,autoCopyFailed:!1,freshness:e.freshness}):e.kind===`clipboard-failed`&&l({url:e.shareUrl,autoCopyFailed:!0,freshness:e.freshness})}catch{Dc.error(i({id:`u3YnKw`}))}s(!1)}},t[6]=i,t[7]=o,t[8]=p,t[9]=n,t[10]=r,t[11]=x):x=t[11];let S=x,C=c!==null,w;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>{e||l(null)},t[12]=w):w=t[12];let T;t[13]!==i||t[14]!==n?.kind?(T=n?.kind===`folder`?i({id:`WR0y2O`}):i({id:`F4IYWe`}),t[13]=i,t[14]=n?.kind,t[15]=T):T=t[15];let E=o||m,D,O;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(Na,{className:`size-3.5`,"aria-hidden":!0}),O=(0,Z.jsx)(Y,{id:`Z8lGw6`}),t[16]=D,t[17]=O):(D=t[16],O=t[17]);let k;t[18]!==S||t[19]!==T||t[20]!==E?(k=(0,Z.jsx)(mh,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,"aria-label":T,onClick:S,disabled:E,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[D,O]})}),t[18]=S,t[19]=T,t[20]=E,t[21]=k):k=t[21];let A=h?`w-96`:`w-80`,j;t[22]===A?j=t[23]:(j=gr(`flex flex-col gap-2`,A),t[22]=A,t[23]=j);let M;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`Z8lGw6`})}),t[24]=M):M=t[24];let N;t[25]===c?.autoCopyFailed?N=t[26]:(N=c?.autoCopyFailed?(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`vj-33a`,values:{copyShortcut:v},components:{0:(0,Z.jsx)(en,{"aria-label":b})}})}):null,t[25]=c?.autoCopyFailed,t[26]=N);let P=c?.url??``,F;t[27]===i?F=t[28]:(F=i({id:`5-FeN2`}),t[27]=i,t[28]=F);let I;t[29]!==P||t[30]!==F?(I=(0,Z.jsx)(dh,{ref:u,readOnly:!0,value:P,onFocus:sU,onClick:oU,onContextMenu:aU,className:`select-all bg-muted font-mono text-xs text-muted-foreground`,"data-testid":`share-button-url`,"aria-label":F}),t[29]=P,t[30]=F,t[31]=I):I=t[31];let L=c?.url??``,R=c?.autoCopyFailed===!1,z;t[32]!==L||t[33]!==R?(z=(0,Z.jsx)(`div`,{className:`absolute inset-y-0 right-1 flex items-center`,children:(0,Z.jsx)(`div`,{className:`rounded-md bg-background/50 backdrop-blur-sm`,children:(0,Z.jsx)(Pt,{copyContent:L,clipboardWrite:_r,initialCopied:R})})}),t[32]=L,t[33]=R,t[34]=z):z=t[34];let B;t[35]!==I||t[36]!==z?(B=(0,Z.jsxs)(`div`,{className:`relative`,children:[I,z]}),t[35]=I,t[36]=z,t[37]=B):B=t[37];let V=c?.freshness,ee=n?.kind??`doc`,H;t[38]!==a||t[39]!==V||t[40]!==ee?(H=(0,Z.jsx)(Df,{freshness:V,status:a,kind:ee}),t[38]=a,t[39]=V,t[40]=ee,t[41]=H):H=t[41];let U;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsxs)(`a`,{href:eU,target:`_blank`,rel:`noopener noreferrer`,onClick:iU,onAuxClick:rU,className:`mt-2 flex items-center gap-1.5 self-start text-xs text-muted-foreground transition-colors hover:text-primary`,children:[(0,Z.jsx)(_,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(Y,{id:`aByJ8j`})]}),t[42]=U):U=t[42];let W;t[43]!==j||t[44]!==N||t[45]!==B||t[46]!==H?(W=(0,Z.jsxs)(ph,{align:`end`,className:j,"data-testid":`share-button-popover`,children:[M,N,B,H,U]}),t[43]=j,t[44]=N,t[45]=B,t[46]=H,t[47]=W):W=t[47];let G;return t[48]!==k||t[49]!==W||t[50]!==C?(G=(0,Z.jsxs)(hh,{open:C,onOpenChange:w,children:[k,W]}),t[48]=k,t[49]=W,t[50]=C,t[51]=G):G=t[51],G}function rU(e){return _h(e,eU)}function iU(e){return _h(e,eU)}function aU(e){return e.currentTarget.select()}function oU(e){return e.currentTarget.select()}function sU(e){return e.currentTarget.select()}function cU(e){return console.log(e)}function lU(e,t){t!==`clipboard`&&Dc.error(e)}function uU(e){return Dc.success(e)}var dU=(0,Q.lazy)(()=>n(()=>import(`./AppMenubar-DS-GyfEA.js`).then(e=>({default:e.AppMenubar})),__vite__mapDeps([207,1,7,8,9,11,12,13,40,130,43,44,45,14,15,41,92,21,99,18,208,36,37,19,17]),import.meta.url));function fU(e){let t=(0,$.c)(57),{children:n,noteModeToggle:r,onSignIn:i,onSetIdentity:a,onOpenSearch:o}=e,{_:s}=Bn(),{activeDocName:c,activeTarget:l}=Et(),u=c?ns(c):null,{state:d}=RL(),f=OC(),p=$c(),m=f||p,h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=Lc(`toggle-files-sidebar`),t[0]=h):h=t[0];let g=h,_;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(_=Ac(`toggle-files-sidebar`),t[1]=_):_=t[1];let v=_,y;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(y=Lc(`command-palette`),t[2]=y):y=t[2];let b=y,x=Ac(`command-palette`),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(!1),E=(0,Q.useRef)(null),D=(0,Q.useRef)(null),O=(0,Q.useRef)(null),k=(0,Q.useRef)(null),A;bb0:{if(l?.kind===`folder`){let e;t[3]===l.folderPath?e=t[4]:(e=Xd(l.folderPath),t[3]=l.folderPath,t[4]=e),A=e;break bb0}if(c&&!u){let e;t[5]===c?e=t[6]:(e=_f(c),t[5]=c,t[6]=e),A=e;break bb0}if(!l&&!c){let e;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=Xd(``),t[7]=e):e=t[7],A=e;break bb0}A=null}let j=A,M=typeof window<`u`&&window.okDesktop!=null,N=d===`collapsed`,P=M&&(N||p),F;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(F=S_()?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(dU,{})}):null,t[8]=F):F=t[8];let I=F,L,R;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>{let e=E.current,t=D.current,n=O.current,r=k.current;if(!e||!t||!n||!r)return;let i=()=>{e.style.setProperty(`--editor-header-leading-width`,`${t.offsetWidth}px`);let i=Number.parseFloat(getComputedStyle(r).marginRight)||0,a=Math.max(0,e.offsetWidth-n.offsetWidth);e.style.setProperty(`--editor-header-trailing-width`,`${Math.max(0,r.offsetWidth+i-a)}px`)};i();let a=requestAnimationFrame(()=>{i(),a=requestAnimationFrame(()=>{i(),T(!0)})}),o=typeof ResizeObserver>`u`?null:new ResizeObserver(i);return o?.observe(e),o?.observe(t),o?.observe(n),o?.observe(r),()=>{cancelAnimationFrame(a),o?.disconnect()}},R=[],t[9]=L,t[10]=R):(L=t[9],R=t[10]),(0,Q.useLayoutEffect)(L,R);let z=!m&&(0,Z.jsx)(nU,{input:j,onClickWhenNoRemote:()=>C(!0)}),B=!p&&(0,Z.jsx)(sf,{onSignIn:i,onSetIdentity:a}),V,ee,H,U;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(zV,{}),ee=(0,Z.jsx)(La,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),H=(0,Z.jsx)(VH,{}),U=(0,Z.jsx)(HV,{}),t[11]=V,t[12]=ee,t[13]=H,t[14]=U):(V=t[11],ee=t[12],H=t[13],U=t[14]);let W=!m&&(0,Z.jsx)($H,{}),G=!p&&(0,Z.jsx)(RH,{}),te;t[15]!==W||t[16]!==G||t[17]!==z||t[18]!==B?(te=(0,Z.jsxs)(Z.Fragment,{children:[z,B,V,ee,H,U,W,G]}),t[15]=W,t[16]=G,t[17]=z,t[18]=B,t[19]=te):te=t[19];let ne=te,re=M?``:void 0,K=P?`var(--ok-titlebar-reserve-left, 1rem)`:`0px`,ie;t[20]===K?ie=t[21]:(ie={"--editor-header-leading-offset":K},t[20]=K,t[21]=ie);let q=p?`bg-background`:`bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,ae;t[22]===q?ae=t[23]:(ae=gr(`group/editor-header relative flex h-12 shrink-0 items-center`,q,M&&`[-webkit-app-region:drag]`),t[22]=q,t[23]=ae);let oe=!w&&`invisible`,se;t[24]===oe?se=t[25]:(se=gr(`absolute inset-y-0 left-0 z-10 flex min-w-0 w-[var(--editor-header-tabs-width,100%)] overflow-hidden`,oe,M&&`[-webkit-app-region:drag]`),t[24]=oe,t[25]=se);let ce;t[26]!==n||t[27]!==se?(ce=(0,Z.jsx)(`div`,{ref:O,"data-electron-drag":M?``:void 0,"data-editor-header-tabs":``,className:se,children:n}),t[26]=n,t[27]=se,t[28]=ce):ce=t[28];let le=M?``:void 0,ue=gr(`absolute inset-y-0 left-0 z-20 flex items-center gap-1 px-3`,M&&`[-webkit-app-region:drag]`,P&&`left-[var(--ok-titlebar-reserve-left,1rem)]`,p&&`max-w-[calc(50%-4rem)] overflow-hidden`),de=f&&I,fe;t[29]!==c||t[30]!==p?(fe=p&&(0,Z.jsx)(yR,{docName:c,includeCurrentPage:!0}),t[29]=c,t[30]=p,t[31]=fe):fe=t[31];let pe=!m&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ma,{"aria-label":s({id:`V6AIOn`}),className:`-ml-1 shrink-0 has-[>[data-slot=button-group]]:gap-0`,children:[(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(UL,{className:gr(`shrink-0 text-muted-foreground`,M&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsxs)(Vr,{children:[(0,Z.jsx)(`span`,{children:s(d===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`})}),` `,(0,Z.jsx)(en,{"aria-label":v,children:g})]})]}),N&&o&&(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,onClick:o,"aria-label":s({id:`DbCfXV`,values:{searchShortcutLabel:x}}),"data-telemetry-event":`ok.editor_header.search.click`,className:gr(`shrink-0 text-muted-foreground`,M&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(kt,{"aria-hidden":`true`})})}),(0,Z.jsxs)(Vr,{children:[(0,Z.jsx)(`span`,{children:s({id:`A1taO8`})}),` `,(0,Z.jsx)(en,{"aria-label":x,children:b})]})]}),M&&N&&(0,Z.jsx)(JH,{})]}),I,(0,Z.jsx)(La,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`})]}),J;t[32]!==le||t[33]!==ue||t[34]!==de||t[35]!==fe||t[36]!==pe?(J=(0,Z.jsxs)(`div`,{ref:D,"data-electron-drag":le,"data-editor-header-leading-actions":``,className:ue,children:[de,fe,pe]}),t[32]=le,t[33]=ue,t[34]=de,t[35]=fe,t[36]=pe,t[37]=J):J=t[37];let me;t[38]!==r||t[39]!==p?(me=p&&r?(0,Z.jsx)(`div`,{"data-note-window-mode-toggle":``,className:`absolute inset-y-0 left-1/2 z-30 flex -translate-x-1/2 items-center [-webkit-app-region:no-drag] [&_[data-slot=toggle-group]]:bg-transparent [&_[data-slot=toggle-group]]:p-0 [&_[data-slot=toggle-group-item]]:size-8 [&_[data-slot=toggle-group-item]]:shadow-none`,children:r}):null,t[38]=r,t[39]=p,t[40]=me):me=t[40];let he;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(he=gr(`absolute inset-y-0 right-0 z-20 flex items-center justify-end gap-2 px-3`,M&&`[-webkit-app-region:drag] [&_button]:[-webkit-app-region:no-drag] [&_a]:[-webkit-app-region:no-drag]`,M&&`mr-[var(--ok-titlebar-reserve-right,0px)]`),t[41]=he):he=t[41];let ge=!p&&ne,_e;t[42]!==S||t[43]!==m||t[44]!==C?(_e=!m&&(0,Z.jsx)(Bd,{open:S,onOpenChange:C}),t[42]=S,t[43]=m,t[44]=C,t[45]=_e):_e=t[45];let ve;t[46]!==ge||t[47]!==_e?(ve=(0,Z.jsxs)(`div`,{ref:k,"data-electron-drag":M?``:void 0,"data-editor-header-actions":``,className:he,children:[ge,_e]}),t[46]=ge,t[47]=_e,t[48]=ve):ve=t[48];let ye;return t[49]!==re||t[50]!==ie||t[51]!==ae||t[52]!==ce||t[53]!==J||t[54]!==me||t[55]!==ve?(ye=(0,Z.jsxs)(`header`,{ref:E,"data-electron-drag":re,style:ie,className:ae,children:[ce,J,me,ve]}),t[49]=re,t[50]=ie,t[51]=ae,t[52]=ce,t[53]=J,t[54]=me,t[55]=ve,t[56]=ye):ye=t[56],ye}function pU(e,t){return Fo({relativePath:hu(e),instruction:``,selectionMarkdown:t,target:`claude-code`})}var mU=(0,Q.lazy)(()=>n(()=>import(`./AgentThreadClientBinder-lpLw9XDN.js`).then(e=>({default:e.AgentThreadClientBinder})),__vite__mapDeps([209,1,18,9,210,37,84,13,111,28,2,3,29,30,31,32,33]),import.meta.url)),hU=(0,Q.lazy)(()=>n(()=>import(`./SessionsHost-Cl-gIFYH.js`).then(e=>({default:e.SessionsHost})),__vite__mapDeps([211,1,2,125,13,9,28,3,29,30,31,32,33,37,7,8,128,11,12,129,130,43,44,45,40,14,15,41,21,92,99,18,19,17,66,118,119,42,46,16,135,24,212,26,213,106,96,34,20,84,214,157,108,147,109,110,215,180,158,83,85,86,87,88,89,159,210,216,148,69]),import.meta.url));function gU(e){let t=(0,$.c)(4),{provider:n,editorMode:r,onModeChange:i}=e,a=Aw(n),o=r===`source`,s=a!==`connected`&&a!==`synced`,c;return t[0]!==i||t[1]!==o||t[2]!==s?(c=(0,Z.jsx)(yg,{isSourceMode:o,onModeChange:i,sourceDisabled:s}),t[0]=i,t[1]=o,t[2]=s,t[3]=c):c=t[3],c}function _U(e){let t=(0,$.c)(145),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,[i,a]=bw(),[o,s]=(0,Q.useState)(i),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(`auth`),f=(0,Q.useSyncExternalStore)(zh.subscribe,zh.getSnapshot,DU),p,m;t[2]===f?(p=t[3],m=t[4]):(p=()=>{f&&(zh.clear(),d(`auth`),l(!0))},m=[f],t[2]=f,t[3]=p,t[4]=m),(0,Q.useEffect)(p,m);let[h,g]=(0,Q.useState)(lE[0].id),[_,v]=(0,Q.useState)(!1),y=typeof window<`u`?window.okDesktop??null:null,b;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(b=$c(),t[5]=b):b=t[5];let x=b,S=!x&&y!=null&&y.terminal!=null&&y.config.ptyAvailable===!0,[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(0),[D,k]=(0,Q.useState)(EU),[A,j]=(0,Q.useState)(TU),M,N;t[6]===D?(M=t[7],N=t[8]):(M=()=>{Ew(D)},N=[D],t[6]=D,t[7]=M,t[8]=N),(0,Q.useEffect)(M,N);let P,F;t[9]===A?(P=t[10],F=t[11]):(P=()=>{kw(A)},F=[A],t[9]=A,t[10]=P,t[11]=F),(0,Q.useEffect)(P,F);let[I,L]=(0,Q.useState)(!1),R=Pr(),[z,B]=(0,Q.useState)(!1),V=(0,Q.useRef)(!1),[ee,H]=(0,Q.useState)(null),[U,W]=(0,Q.useState)(null),[G,te]=(0,Q.useState)(null),ne=(0,Q.useRef)(0),re;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(re={terminal:{container:null,isShowing:!1},agents:{container:null,isShowing:!1},editorRegion:null},t[12]=re):re=t[12];let[K,ie]=(0,Q.useState)(re),q=(0,Q.useRef)(0),ae;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(ae=function(){gl()},t[13]=ae):ae=t[13];let oe=ae,se;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(se=function(){L(!0)},t[14]=se):se=t[14];let ce=se,le=Cu(),{projectConfig:ue,projectLocalConfig:de,projectLocalSynced:fe,projectSynced:pe}=Fl(),{activeDocName:J,activeProvider:me}=Et(),he=le?.hasRemote,_e=le?.pushPermission?.checkStatus,ve;t[15]!==_||t[16]!==ue||t[17]!==de||t[18]!==fe||t[19]!==pe||t[20]!==he||t[21]!==_e?(ve=Pw({autoSyncOnboardingDismissed:_,hasRemote:he,projectLocalSynced:fe,projectSynced:pe,projectLocalConfig:de,projectConfig:ue,pushPermissionCheckStatus:_e}),t[15]=_,t[16]=ue,t[17]=de,t[18]=fe,t[19]=pe,t[20]=he,t[21]=_e,t[22]=ve):ve=t[22];let ye=ve,be,xe;t[23]===J?(be=t[24],xe=t[25]):(be=()=>{let e=function(e){let t=e.detail;t&&J&&Od(J,{kind:`raw-mdx`,detail:t}),s(`source`)};return window.addEventListener(fw,e),()=>window.removeEventListener(fw,e)},xe=[J],t[23]=J,t[24]=be,t[25]=xe),(0,Q.useEffect)(be,xe);let Se;t[26]!==J||t[27]!==o?(Se=function(e,t){if(J==null)return!1;let n=Kh(J,o)?.markdown??``;return n.trim()===``?!1:(xl(`${pU(J,n)}\n\n`,{newTab:e,submit:!1,target:t}),!0)},t[26]=J,t[27]=o,t[28]=Se):Se=t[28];let Ce=Se,we=(0,Q.useEffectEvent)(Ce),Te;t[29]===Ce?Te=t[30]:(Te=()=>Ce(!1,`agents`),t[29]=Ce,t[30]=Te);let Ee=(0,Q.useEffectEvent)(Te),De;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(De=()=>oe(),t[31]=De):De=t[31];let Oe=(0,Q.useEffectEvent)(De),ke;t[32]===Ee?ke=t[33]:(ke=()=>{if(!x)return fr(e=>{if(e===`toggle-terminal`)w(wU);else if(e===`move-terminal`)k(CU);else if(e===`new-terminal`)w(!0);else if(e===`toggle-agent-panel`){if(Ee())return;L(SU)}})},t[32]=Ee,t[33]=ke);let Ae;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=[x],t[34]=Ae):Ae=t[34],(0,Q.useEffect)(ke,Ae);let je,Me;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(je=()=>{let e=window.okDesktop!=null,t=function(t){kc(t,`toggle-terminal-panel`,e)&&(Mr()||S&&(t.preventDefault(),w(xU)))};return window.addEventListener(`keydown`,t,{capture:!0}),()=>window.removeEventListener(`keydown`,t,{capture:!0})},Me=[S],t[35]=je,t[36]=Me):(je=t[35],Me=t[36]),(0,Q.useEffect)(je,Me);let Ne;t[37]===Ee?Ne=t[38]:(Ne=()=>{if(window.okDesktop!=null)return;let e=function(e){Mc(e,`toggle-agent-panel`)&&(Mr()||(e.preventDefault(),!Ee()&&L(bU)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},t[37]=Ee,t[38]=Ne);let Pe;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=[],t[39]=Pe):Pe=t[39],(0,Q.useEffect)(Ne,Pe);let Fe;t[40]!==Oe||t[41]!==we?(Fe=()=>{let e=function(e){Mc(e,`new-terminal-tab`)&&(Mr()||(e.preventDefault(),we(!0)||Oe()))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},t[40]=Oe,t[41]=we,t[42]=Fe):Fe=t[42];let Ie;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=[],t[43]=Ie):Ie=t[43],(0,Q.useEffect)(Fe,Ie);let Le,Re;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(Le=()=>L_(e=>{w(!0),q.current+=1,W({id:e,nonce:q.current})}),Re=[],t[44]=Le,t[45]=Re):(Le=t[44],Re=t[45]),(0,Q.useEffect)(Le,Re);let ze,Be;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(ze=()=>pl((e,t,n)=>{let{stage:r}=n;w(!0),q.current+=1,H({prompt:r?null:e,cli:t,nonce:q.current,stagePaste:r?e:void 0})}),Be=[],t[46]=ze,t[47]=Be):(ze=t[46],Be=t[47]),(0,Q.useEffect)(ze,Be);let Ve,He;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=()=>Vl(e=>{L(!0),ne.current+=1,te({agentSource:e.agentSource,agentId:e.agentId,prompt:e.prompt,docName:e.docName,titleHint:e.titleHint,nonce:ne.current})}),He=[],t[48]=Ve,t[49]=He):(Ve=t[48],He=t[49]),(0,Q.useEffect)(Ve,He);let Ue,We;t[50]===C?(Ue=t[51],We=t[52]):(Ue=()=>{C||H(null)},We=[C],t[50]=C,t[51]=Ue,t[52]=We),(0,Q.useEffect)(Ue,We);let Ge,Ke;t[53]!==z||t[54]!==C?(Ge=()=>{window.okDesktop!=null&&z&&(el({terminalVisible:C}),window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:C}))},Ke=[C,z],t[53]=z,t[54]=C,t[55]=Ge,t[56]=Ke):(Ge=t[55],Ke=t[56]),(0,Q.useEffect)(Ge,Ke);let qe,Je;t[57]!==z||t[58]!==D?(qe=()=>{window.okDesktop!=null&&z&&(el({terminalPlacement:D}),window.okDesktop.editor.notifyViewMenuStateChanged({terminalPlacement:D}))},Je=[D,z],t[57]=z,t[58]=D,t[59]=qe,t[60]=Je):(qe=t[59],Je=t[60]),(0,Q.useEffect)(qe,Je);let Ye,Xe;t[61]!==I||t[62]!==z?(Ye=()=>{window.okDesktop!=null&&z&&(el({agentPanelVisible:I}),window.okDesktop.editor.notifyViewMenuStateChanged({agentPanelVisible:I}))},Xe=[I,z],t[61]=I,t[62]=z,t[63]=Ye,t[64]=Xe):(Ye=t[63],Xe=t[64]),(0,Q.useEffect)(Ye,Xe);let Ze,Qe;t[65]!==J||t[66]!==o?(Ze=()=>{let e=null,t=()=>{let t=((J===null?null:Kh(J,o))?.markdown??``).trim()!==``;t!==e&&(e=t,el({hasEditorSelection:t}),window.okDesktop?.editor.notifyViewMenuStateChanged({hasEditorSelection:t}))};return t(),Hh(t)},Qe=[J,o],t[65]=J,t[66]=o,t[67]=Ze,t[68]=Qe):(Ze=t[67],Qe=t[68]),(0,Q.useEffect)(Ze,Qe);let $e,et;t[69]===Symbol.for(`react.memo_cache_sentinel`)?($e=()=>{if(x){B(!0);return}let e=window.okDesktop;if(e==null)return;if(typeof e.terminal?.getDockState!=`function`){B(!0);return}let t=!1;return e.terminal.getDockState().then(e=>{t||(e.agentPanelVisible&&L(!0),e.terminalVisible&&(V.current=!0,E(yU),w(!0)))}).catch(vU).finally(()=>{t||B(!0)}),()=>{t=!0}},et=[x],t[69]=$e,t[70]=et):($e=t[69],et=t[70]),(0,Q.useEffect)($e,et);let tt,nt;t[71]===C?(tt=t[72],nt=t[73]):(tt=()=>{if(window.okDesktop!=null){if(V.current){V.current=!1;return}C&&$a()}},nt=[C],t[71]=C,t[72]=tt,t[73]=nt),(0,Q.useEffect)(tt,nt),xw(le?.pausedReason),Cw();let rt;t[74]!==J||t[75]!==me||t[76]!==o||t[77]!==a?(rt=function(e){J&&me&&o!==e&&(hd({from:o,to:e,docName:J,ytext:me.document.getText(`source`)}),ge(J)),s(e),a(e)},t[74]=J,t[75]=me,t[76]=o,t[77]=a,t[78]=rt):rt=t[78];let it=rt,at;t[79]!==o||t[80]!==it?(at=()=>{it(o===`source`?`wysiwyg`:`source`)},t[79]=o,t[80]=it,t[81]=at):at=t[81];let ot=(0,Q.useEffectEvent)(at),st=o===`wysiwyg`&&!!J&&!!me,ct;t[82]!==J||t[83]!==me||t[84]!==st?(ct=()=>{if(!st||!J||!me)return;let e=O(J);e&&qu({editor:e,docName:J,ytext:me.document.getText(`source`)})},t[82]=J,t[83]=me,t[84]=st,t[85]=ct):ct=t[85];let lt=(0,Q.useEffectEvent)(ct),ut,dt;t[86]===st?(ut=t[87],dt=t[88]):(ut=()=>{window.okDesktop?.editor.notifyViewMenuStateChanged({canViewInSource:st})},dt=[st],t[86]=st,t[87]=ut,t[88]=dt),(0,Q.useEffect)(ut,dt);let ft;t[89]!==lt||t[90]!==ot?(ft=()=>{let e=function(e){if(Mc(e,`toggle-editor-mode`)){if(Mr())return;e.preventDefault(),ot();return}if(Mc(e,`view-source-at-cursor`)){if(Mr())return;e.preventDefault(),lt()}};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},t[89]=lt,t[90]=ot,t[91]=ft):ft=t[91];let pt;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(pt=[],t[92]=pt):pt=t[92],(0,Q.useEffect)(ft,pt);let mt;t[93]===lt?mt=t[94]:(mt=()=>fr(e=>{e===`toggle-source`&&lt()}),t[93]=lt,t[94]=mt);let ht;t[95]===Symbol.for(`react.memo_cache_sentinel`)?(ht=[],t[95]=ht):ht=t[95],(0,Q.useEffect)(mt,ht);let gt,_t;t[96]===J?(gt=t[97],_t=t[98]):(gt=()=>{let e=function(e){e.detail?.docName===J&&s(`source`)};return window.addEventListener(ed,e),()=>window.removeEventListener(ed,e)},_t=[J],t[96]=J,t[97]=gt,t[98]=_t),(0,Q.useEffect)(gt,_t);let vt;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(vt=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(mU,{})}),t[99]=vt):vt=t[99];let yt=x?!1:C,bt=x?!1:I,xt;t[100]!==J||t[101]!==me||t[102]!==o||t[103]!==it||t[104]!==r?(xt=e=>(0,Z.jsx)(fU,{noteModeToggle:x&&J!==null&&!yo(J)?(0,Z.jsx)(gU,{provider:me,editorMode:o,onModeChange:it}):null,onSignIn:()=>{d(`auth`),l(!0)},onSetIdentity:()=>{d(`identity`),l(!0)},onOpenSearch:r,children:e}),t[100]=J,t[101]=me,t[102]=o,t[103]=it,t[104]=r,t[105]=xt):xt=t[105];let St;t[106]!==h||t[107]!==o||t[108]!==it||t[109]!==yt||t[110]!==bt||t[111]!==xt||t[112]!==D||t[113]!==A?(St=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,Z.jsx)($B,{editorMode:o,onModeChange:it,activeTab:h,onActiveTabChange:g,terminalBridge:S?y:null,terminalVisible:yt,terminalPlacement:D,terminalRightWidth:A,onTerminalVisibleChange:w,onTerminalRightWidthChange:j,agentsVisible:bt,onAgentsVisibleChange:L,onSessionPlacements:ie,onRevealAgents:x?void 0:ce,renderWorkspaceHeader:xt})})}),t[106]=h,t[107]=o,t[108]=it,t[109]=yt,t[110]=bt,t[111]=xt,t[112]=D,t[113]=A,t[114]=St):St=t[114];let Ct;t[115]!==I||t[116]!==R||t[117]!==K||t[118]!==G?(Ct=x?null:(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(hU,{surface:`agents-panel`,bridge:y,terminalCapable:S,visible:I,onVisibleChange:L,threadLaunch:G,installedClis:R,container:K.agents.container,isShowing:K.agents.isShowing,onRequestEditorFocus:()=>K.editorRegion?.focus()})}),t[115]=I,t[116]=R,t[117]=K,t[118]=G,t[119]=Ct):Ct=t[119];let wt;t[120]!==I||t[121]!==R||t[122]!==K||t[123]!==U||t[124]!==ee||t[125]!==D||t[126]!==T||t[127]!==C?(wt=S?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(hU,{surface:`terminal-dock`,terminalPlacement:D,onTerminalPlacementChange:k,reserveRightRevealTabGutter:D===`right`&&!I,bridge:y,terminalCapable:!0,visible:C,terminalRestoreRevealNonce:T,onVisibleChange:w,launch:ee,commandLaunch:U,installedClis:R,container:K.terminal.container,isShowing:K.terminal.isShowing,onRequestEditorFocus:()=>K.editorRegion?.focus()})}):null,t[120]=I,t[121]=R,t[122]=K,t[123]=U,t[124]=ee,t[125]=D,t[126]=T,t[127]=C,t[128]=wt):wt=t[128];let Tt=u===`identity`,Dt;t[129]===Symbol.for(`react.memo_cache_sentinel`)?(Dt=()=>{l(!1)},t[129]=Dt):Dt=t[129];let Ot;t[130]!==c||t[131]!==Tt?(Ot=(0,Z.jsx)(Kd,{open:c,onOpenChange:l,identityPrompt:Tt,onSuccess:Dt}),t[130]=c,t[131]=Tt,t[132]=Ot):Ot=t[132];let kt=ye!==null,At=ye??`full`,jt;t[133]===Symbol.for(`react.memo_cache_sentinel`)?(jt=()=>v(!0),t[133]=jt):jt=t[133];let Mt;t[134]!==kt||t[135]!==At?(Mt=(0,Z.jsx)(Mw,{open:kt,variant:At,onResolved:jt}),t[134]=kt,t[135]=At,t[136]=Mt):Mt=t[136];let Nt,Pt;t[137]===Symbol.for(`react.memo_cache_sentinel`)?(Nt=(0,Z.jsx)(lw,{}),Pt=(0,Z.jsx)(sw,{}),t[137]=Nt,t[138]=Pt):(Nt=t[137],Pt=t[138]);let Ft;return t[139]!==St||t[140]!==Ct||t[141]!==wt||t[142]!==Ot||t[143]!==Mt?(Ft=(0,Z.jsxs)(Z.Fragment,{children:[vt,St,Ct,wt,Ot,Mt,Nt,Pt]}),t[139]=St,t[140]=Ct,t[141]=wt,t[142]=Ot,t[143]=Mt,t[144]=Ft):Ft=t[144],Ft}function vU(e){console.error(`[terminal] dock-state restore failed; staying hidden:`,e)}function yU(e){return e+1}function bU(e){return!e}function xU(e){return!e}function SU(e){return!e}function CU(e){return e===`bottom`?`right`:`bottom`}function wU(e){return!e}function TU(){return Ow()}function EU(){return Tw()}function DU(){return!1}function OU(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(!1),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>fr(e=>{e===`send-feedback`&&n(!0)}),i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a;return e[2]===t?a=e[3]:(a=(0,Z.jsx)(HS,{open:t,onOpenChange:n,source:`help_menu`}),e[2]=t,e[3]=a),a}function kU(e){let t=qp(em(e));typeof window>`u`||tm(window.location.hash,t)||(window.location.hash=t)}function AU(){let e=(0,$.c)(18),{conflicts:t,loading:n,error:r}=Gd(),{_:i}=Bn();if(n)return null;if(r===`server`){let t;e[0]===i?t=e[1]:(t=i({id:`OKImo8`}),e[0]=i,e[1]=t);let n;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`p`,{"data-testid":`conflicts-section-error`,className:`px-2 py-1.5 text-[12px] text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(Lp,{"aria-hidden":`true`,className:`mr-1.5 inline size-3`}),(0,Z.jsx)(Y,{id:`L6Ud-t`})]}),e[2]=n):n=e[2];let r;return e[3]===t?r=e[4]:(r=(0,Z.jsx)(`section`,{"data-testid":`conflicts-section`,"aria-label":t,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:n}),e[3]=t,e[4]=r),r}if(t.length===0)return null;let a;e[5]===i?a=e[6]:(a=i({id:`OKImo8`}),e[5]=i,e[6]=a);let o;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 font-mono text-[11px] uppercase tracking-wider text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(Lp,{"aria-hidden":`true`,className:`size-3`}),(0,Z.jsx)(Y,{id:`KGJb9_`})]}),e[7]=o):o=e[7];let s;e[8]===t.length?s=e[9]:(s=(0,Z.jsxs)(`header`,{className:`flex items-center justify-between px-2 pb-1.5`,children:[o,(0,Z.jsx)(`span`,{"data-testid":`conflicts-section-count`,className:`rounded-full bg-amber-500 px-1.5 py-0.5 font-mono text-[10px] font-medium leading-none text-white`,children:t.length})]}),e[8]=t.length,e[9]=s);let c;e[10]===t?c=e[11]:(c=t.map(jU),e[10]=t,e[11]=c);let l;e[12]===c?l=e[13]:(l=(0,Z.jsx)(`ul`,{className:`flex flex-col gap-px`,children:c}),e[12]=c,e[13]=l);let u;return e[14]!==a||e[15]!==s||e[16]!==l?(u=(0,Z.jsxs)(`section`,{"data-testid":`conflicts-section`,"aria-label":a,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:[s,l]}),e[14]=a,e[15]=s,e[16]=l,e[17]=u):u=e[17],u}function jU(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,"data-testid":`conflicts-section-row`,"data-file":e.file,title:e.file,className:`h-7 w-full justify-start gap-1.5 px-2 font-normal text-[13px] text-amber-800 hover:bg-amber-100/60 hover:text-amber-900 dark:text-amber-300 dark:hover:bg-amber-900/30 dark:hover:text-amber-200`,onClick:()=>kU(e.file),children:[(0,Z.jsx)(Lp,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var MU=`proactive_card`;function NU(){let e=!1,t=!1;return{isEvaluated:()=>e,isShown:()=>t,latchEvaluated:()=>{e=!0},latchShown:()=>{t=!0}}}var PU=NU();function FU(e){let t=(0,$.c)(14),{pages:n,ready:r,blocked:i,store:a,now:o,session:s}=e,c=a===void 0?fH:a,l=o===void 0?Date.now:o,u=s===void 0?PU:s,{dismissed:d}=(0,Q.useSyncExternalStore)(c.subscribe,c.getSnapshot,c.getSnapshot),f;t[0]===u?f=t[1]:(f=u.isShown(),t[0]=u,t[1]=f);let[p,m]=(0,Q.useState)(f),h,g;t[2]!==l||t[3]!==c?(h=()=>{c.recordFirstSeen(l())},g=[c,l],t[2]=l,t[3]=c,t[4]=h,t[5]=g):(h=t[4],g=t[5]),(0,Q.useEffect)(h,g);let _,v;return t[6]!==i||t[7]!==l||t[8]!==n||t[9]!==r||t[10]!==u||t[11]!==c?(_=()=>{u.isEvaluated()||!r||n==null||(u.latchEvaluated(),!i&&aH(c.getSnapshot(),l(),iH(n))&&(c.recordShown(l()),u.latchShown(),m(!0)))},v=[r,i,n,c,l,u],t[6]=i,t[7]=l,t[8]=n,t[9]=r,t[10]=u,t[11]=c,t[12]=_,t[13]=v):(_=t[12],v=t[13]),(0,Q.useEffect)(_,v),p&&!d}var IU=`Relaunch`,LU=`Release notes`,RU=`Updates paused`,zU=`Download`,BU=`Reset to defaults`,VU=`Relaunching to install the update…`,HU=`Getting the latest version…`,UU=`Relaunch failed — please restart manually`;function WU(e){return`Update to ${e} didn't install.`}var GU=`Retry`,KU=`Download manually`,qU=`Recovery action failed — please try again`;function JU(e,t){let n=t instanceof Error&&t.message?t.message:``;return n?`${e}: ${n}`:e}function YU(e){return`Version ${e} ready to install`}function XU(e){return`Updated to Version ${e}`}function ZU(e){return`Your settings and recent projects were saved by a newer build than this one (v${e}). Reset to defaults to continue.`}var QU=0,$U=0,eW=1,tW=2,nW=3,rW=6e4;function iW(e,t,n=()=>{},r=rW,i={isEligible:()=>!1,onShown:()=>{}}){let a=[],o=new Set,s=`update-downloaded`;return a.push(e.onUpdateDownloaded(({version:r})=>{let i=s,a=()=>{t({id:i,body:YU(r),priority:tW,action:{label:IU,onClick:()=>{t({id:i,body:VU,priority:tW,dismissible:!1}),e.update.relaunchNow().then(()=>{n(i)},e=>{a(),t({id:`relaunch-error-${r}`,body:JU(UU,e),variant:`error`,priority:eW})})}}})};a()})),a.push(e.onUpdateRelaunching(()=>{t({id:s,body:VU,priority:tW,dismissible:!1})})),a.push(e.onUpdateFetchingLatest(()=>{t({id:s,body:HU,priority:tW,dismissible:!1})})),a.push(e.onUpdateRelaunchFailed(({version:r,message:i,downloadUrl:a,dismissPending:o})=>{if(o&&n(s),a){let i=`install-failed-${r}`,o=()=>{t({id:i,body:WU(r),variant:`error`,priority:eW,action:{label:GU,onClick:()=>{e.update.relaunchNow().then(()=>{n(i)},e=>{console.warn(`[update-notice] install-failed retry rejected`,e),o()})}},secondaryAction:{label:KU,onClick:()=>{e.shell.openExternal(a)}}})};o();return}t({id:`relaunch-error-${r}`,body:i?`${UU}: ${i}`:UU,variant:`error`,priority:eW})})),a.push(e.onWhatsNew(({version:a,releaseUrl:s})=>{if(i.isEligible(a)){i.onShown(a),t({id:`whats-new-combined-${a}`,body:XU(a),variant:`success`,priority:nW,combinedSubscribe:!0,whatsNew:{version:a,releaseUrl:s},action:{label:LU,onClick:()=>{e.shell.openExternal(s)}}}),e.update.dismissWhatsNew(a);return}let c=`whats-new-${a}`;t({id:c,body:XU(a),variant:`success`,priority:nW,action:{label:LU,onClick:()=>{e.shell.openExternal(s)}},onDismiss:()=>{e.update.dismissWhatsNew(a)}});let l=setTimeout(()=>{o.delete(l),n(c),e.update.dismissWhatsNew(a)},r);o.add(l)})),a.push(e.onWhatsNewDismissed(({version:e})=>{n(`whats-new-${e}`)})),a.push(e.onUpdateStuckHint(({downloadUrl:n})=>{t({id:`update-stuck-hint`,body:RU,priority:$U,action:{label:zU,onClick:()=>{e.shell.openExternal(n)}}})})),()=>{for(let e of a)e();for(let e of o)clearTimeout(e);o.clear()}}function aW(e,t,n,r=()=>{}){let i=`schema-incompatibility-${t.persistedSchemaVersion}`,a=`schema-incompatibility-error-${t.persistedSchemaVersion}`,o=e=>{r(i),n({id:a,body:JU(qU,e),variant:`error`,priority:QU})};n({id:i,body:ZU(t.currentBuild),priority:QU,action:{label:BU,onClick:()=>{e.state.resetIncompatible().then(()=>{r(i)},o)}}})}var oW=[],sW=new Set,cW=!1;function lW(){for(let e of sW)e()}function uW(e){let t=oW.findIndex(t=>t.id===e.id);if(t===-1)oW=[...oW,e];else{let n=oW.slice();n[t]=e,oW=n}lW()}function dW(e){let t=oW.filter(t=>t.id!==e);t.length!==oW.length&&(oW=t,lW())}function fW(){return oW}function pW(e){return sW.add(e),()=>{sW.delete(e)}}function mW(){if(cW||typeof window>`u`)return;let e=window.okDesktop;e&&(cW=!0,iW(e,uW,dW,void 0,{isEligible:e=>yH(EH.getSnapshot(),e),onShown:e=>EH.recordShown(e)}),e.state.query().then(t=>{t.schemaIncompatibility&&aW(e,t.schemaIncompatibility,uW,dW)},e=>{console.warn(`[update-notices-store] bridge.state.query() failed`,e)}))}var hW=new URL(`/api/feedback`,{BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.64.0`}?.VITE_OK_FEEDBACK_INTAKE_ORIGIN||`https://openknowledge.ai`).href;function gW(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let e=typeof r.result==`string`?r.result:``,n=e.indexOf(`,`);t(n===-1?``:e.slice(n+1))},r.onerror=()=>n(r.error??Error(`file read failed`)),r.readAsDataURL(e)})}async function _W(e){return{contentType:e.type,base64:await gW(e)}}function vW(){return typeof window<`u`&&window.okDesktop?.platform||`web`}async function yW(e){try{let t=await fetch(hW,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({...e,appVersion:lh,platform:vW()}),signal:AbortSignal.timeout(3e4)});if(t.ok){let e=await t.json().catch(e=>(console.warn(`[feedback] action=submit result=ok-parse-error message=${e instanceof Error?e.message:String(e)}`),null));return{ok:!0,reference:e&&typeof e.reference==`string`?e.reference:``}}return t.status===400||t.status===413?{ok:!1,reason:`invalid`}:t.status===503?{ok:!1,reason:`unavailable`}:(console.warn(`[feedback] action=submit result=http-error status=${t.status}`),{ok:!1,reason:`error`})}catch(e){return console.warn(`[feedback] action=submit result=network-error message=${e instanceof Error?e.message:String(e)}`),{ok:!1,reason:`error`}}}var bW=Rr(`group/attachment relative flex w-fit max-w-full min-w-0 shrink-0 flex-wrap rounded-xl border bg-card text-card-foreground transition-colors focus-within:ring-1 focus-within:ring-ring/50 has-[>a,>button]:hover:bg-muted/50 data-[state=error]:border-destructive/30 data-[state=idle]:border-dashed`,{variants:{size:{default:`gap-2 text-sm has-data-[slot=attachment-content]:px-2.5 has-data-[slot=attachment-content]:py-2 has-data-[slot=attachment-media]:p-2`,sm:`gap-2.5 text-xs has-data-[slot=attachment-content]:px-2 has-data-[slot=attachment-content]:py-1.5 has-data-[slot=attachment-media]:p-1.5`,xs:`gap-1.5 rounded-lg text-xs has-data-[slot=attachment-content]:px-1.5 has-data-[slot=attachment-content]:py-1 has-data-[slot=attachment-media]:p-1`},orientation:{horizontal:`min-w-40 items-center`,vertical:`w-24 flex-col has-data-[slot=attachment-content]:w-30`}}});function xW(e){let t=(0,$.c)(16),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,state:i,size:a,orientation:o,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=i===void 0?`done`:i,c=a===void 0?`default`:a,l=o===void 0?`horizontal`:o,u;t[6]!==n||t[7]!==l||t[8]!==c?(u=gr(bW({size:c,orientation:l}),n),t[6]=n,t[7]=l,t[8]=c,t[9]=u):u=t[9];let d;return t[10]!==l||t[11]!==r||t[12]!==c||t[13]!==s||t[14]!==u?(d=(0,Z.jsx)(`div`,{"data-slot":`attachment`,"data-state":s,"data-size":c,"data-orientation":l,className:u,...r}),t[10]=l,t[11]=r,t[12]=c,t[13]=s,t[14]=u,t[15]=d):d=t[15],d}var SW=Rr(`relative flex aspect-square w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted text-foreground group-data-[orientation=vertical]/attachment:w-full group-data-[size=sm]/attachment:w-8 group-data-[size=xs]/attachment:w-7 group-data-[size=xs]/attachment:rounded-md group-data-[state=error]/attachment:bg-destructive/10 group-data-[state=error]/attachment:text-destructive group-data-[orientation=vertical]/attachment:*:data-[slot=spinner]:size-6! [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 group-data-[orientation=vertical]/attachment:[&_svg:not([class*='size-'])]:size-6 group-data-[size=xs]/attachment:[&_svg:not([class*='size-'])]:size-3.5`,{variants:{variant:{icon:``,image:`opacity-60 group-data-[state=done]/attachment:opacity-100 group-data-[state=idle]/attachment:opacity-100 *:[img]:aspect-square *:[img]:w-full *:[img]:object-cover`}},defaultVariants:{variant:`icon`}});function CW(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`icon`:i,o;t[4]!==n||t[5]!==a?(o=gr(SW({variant:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o||t[9]!==a?(s=(0,Z.jsx)(`div`,{"data-slot":`attachment-media`,"data-variant":a,className:o,...r}),t[7]=r,t[8]=o,t[9]=a,t[10]=s):s=t[10],s}function wW(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`max-w-full min-w-0 flex-1 leading-tight group-data-[orientation=vertical]/attachment:px-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`attachment-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function TW(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`block max-w-full min-w-0 truncate font-medium group-data-[state=processing]/attachment:shimmer group-data-[state=uploading]/attachment:shimmer`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`span`,{"data-slot":`attachment-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function EW(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`mt-0.5 block min-w-0 truncate text-xs text-muted-foreground group-data-[state=error]/attachment:text-destructive/80`,`max-w-full`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`span`,{"data-slot":`attachment-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function DW(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`relative z-20 flex shrink-0 items-center group-data-[orientation=vertical]/attachment:absolute group-data-[orientation=vertical]/attachment:top-3 group-data-[orientation=vertical]/attachment:right-3 group-data-[orientation=vertical]/attachment:gap-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`attachment-actions`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function OW(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,variant:a,size:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`icon-xs`:i,s=a??`ghost`,c;t[5]===n?c=t[6]:(c=gr(n),t[5]=n,t[6]=c);let l;return t[7]!==r||t[8]!==o||t[9]!==s||t[10]!==c?(l=(0,Z.jsx)(X,{"data-slot":`attachment-action`,variant:s,size:o,className:c,...r}),t[7]=r,t[8]=o,t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function kW(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=gr(`flex min-w-0 scroll-fade-x snap-x snap-mandatory scroll-px-1 scrollbar-none gap-3 overflow-x-auto overscroll-x-contain py-1 *:data-[slot=attachment]:flex-none *:data-[slot=attachment]:snap-start`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`attachment-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var AW=[{value:`too-slow`,label:{id:`YJPN3F`}},{value:`hard-to-use`,label:{id:`MDBJwN`}},{value:`missing-feature`,label:{id:`anmUZq`}},{value:`something-broke`,label:{id:`dXCi3J`}},{value:`formatting`,label:{id:`RcrskJ`}},{value:`other`,label:{id:`_IX_7x`}}],jW=3,MW=3*1024*1024,NW=[`image/png`,`image/jpeg`,`image/webp`],PW=`data-[state=on]:border-primary data-[state=on]:bg-primary/5 data-[state=on]:text-primary`,FW=`rounded-full border border-input bg-transparent px-3 ${PW}`;function IW(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function LW(e,t){let n=new Set(e.map(e=>`${e.name}:${e.size}`)),r=Array.from(t??[]).filter(e=>NW.includes(e.type)&&!n.has(`${e.name}:${e.size}`));return[...e,...r].slice(0,jW)}var RW=e=>{let t=(0,$.c)(5),{file:n}=e,[r,i]=(0,Q.useState)(null),a,o;t[0]===n?(a=t[1],o=t[2]):(a=()=>{let e=URL.createObjectURL(n);return i(e),()=>URL.revokeObjectURL(e)},o=[n],t[0]=n,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o);let s;return t[3]===r?s=t[4]:(s=r?(0,Z.jsx)(`img`,{src:r,alt:``,className:`size-full object-cover`}):null,t[3]=r,t[4]=s),s},zW=e=>{let t=(0,$.c)(58),{onSuccess:n,source:r,compact:i,title:a,onDismiss:o,className:s}=e,c=r===void 0?`resources_menu`:r,{_:l}=Bn(),u=(0,Q.useRef)(null),d,f;if(t[0]!==l){let e=io({rating:oc([`positive`,`negative`],{error:l({id:`H-hzll`})}),reasons:Ss(Ms()),message:Ms(),attachments:Ss(Io(File)).max(jW,l({id:`E9gh86`,values:{MAX_ATTACHMENTS:jW}})).refine(VW,l({id:`s7us1p`})).refine(UW,l({id:`ItxGi3`})),shareEmail:vs(),email:Ms()}).refine(WW,{path:[`email`],message:l({id:`fwrPh4`})});f=O_,d=QV(e),t[0]=l,t[1]=d,t[2]=f}else d=t[1],f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=[],t[3]=p):p=t[3];let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m={rating:void 0,reasons:p,message:``,attachments:[],shareEmail:!1,email:``},t[4]=m):m=t[4];let h;t[5]===d?h=t[6]:(h={resolver:d,defaultValues:m},t[5]=d,t[6]=h);let g=f(h),_;t[7]===g.control?_=t[8]:(_={control:g.control,name:`rating`},t[7]=g.control,t[8]=_);let v=j_(_),y=!i||v!=null,b;t[9]===g.control?b=t[10]:(b={control:g.control,name:`shareEmail`},t[9]=g.control,t[10]=b);let x=j_(b),S;t[11]===g.control?S=t[12]:(S={control:g.control,name:`attachments`},t[11]=g.control,t[12]=S);let C=j_(S),w=C.length>=jW,T=g.formState.errors.attachments,E;t[13]===g?E=t[14]:(E=e=>g.setValue(`attachments`,e,{shouldValidate:!0}),t[13]=g,t[14]=E);let D=E,O;t[15]!==l||t[16]!==g||t[17]!==n||t[18]!==c?(O=async e=>{try{let t=e.attachments.length?await Promise.all(e.attachments.map(_W)):void 0,r=await yW({kind:`general`,rating:e.rating,reasons:e.reasons,message:e.message.trim()||void 0,email:e.shareEmail&&e.email?e.email:void 0,attachments:t,source:c});if(r.ok){Dc.success(l({id:`LvdLef`})),g.reset(),n?.();return}if(r.reason===`unavailable`){Dc.error(l({id:`D8JJwQ`}));return}Dc.error(l({id:`D2emTw`}))}catch(e){let t=e;console.warn(`[feedback] action=submit result=unexpected-error message=${t instanceof Error?t.message:String(t)}`),Dc.error(l({id:`D2emTw`}))}},t[15]=l,t[16]=g,t[17]=n,t[18]=c,t[19]=O):O=t[19];let k=O,A;t[20]!==g||t[21]!==k?(A=g.handleSubmit(k),t[20]=g,t[21]=k,t[22]=A):A=t[22];let j=i?`space-y-3`:`space-y-5`,M;t[23]!==s||t[24]!==j?(M=gr(j,s),t[23]=s,t[24]=j,t[25]=M):M=t[25];let N;t[26]!==l||t[27]!==o||t[28]!==a?(N=(a||o)&&(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[a?(0,Z.jsx)(`p`,{className:`font-medium text-1sm`,children:a}):(0,Z.jsx)(`span`,{}),o?(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon`,onClick:o,"aria-label":l({id:`yz7wBu`}),className:`-mr-1.5 -mt-1 size-7 shrink-0 text-muted-foreground opacity-60`,children:(0,Z.jsx)(zp,{className:`size-4`})}):null]}),t[26]=l,t[27]=o,t[28]=a,t[29]=N):N=t[29];let P;t[30]!==l||t[31]!==i||t[32]!==g?(P=e=>{let{field:t}=e;return(0,Z.jsxs)(T_,{children:[(0,Z.jsx)(M_,{children:(0,Z.jsxs)(Ba,{type:`single`,variant:`outline`,spacing:2,"aria-label":l({id:`rg7hNd`}),value:t.value??``,onValueChange:e=>{e&&(t.onChange(e),e===`positive`&&g.setValue(`reasons`,[]))},className:`w-full`,children:[(0,Z.jsxs)(Ra,{value:`positive`,className:gr(`h-auto flex-1 justify-center py-2`,i?`gap-1.5 text-xs`:`gap-2`,PW),children:[(0,Z.jsx)(Lb,{className:`size-4`}),(0,Z.jsx)(Y,{id:`OEEQKT`})]}),(0,Z.jsxs)(Ra,{value:`negative`,className:gr(`h-auto flex-1 justify-center py-2`,i?`gap-1.5 text-xs`:`gap-2`,PW),children:[(0,Z.jsx)(Ib,{className:`size-4`}),(0,Z.jsx)(Y,{id:`U0QBh4`})]})]})}),(0,Z.jsx)(P_,{})]})},t[30]=l,t[31]=i,t[32]=g,t[33]=P):P=t[33];let F;t[34]!==g.control||t[35]!==P?(F=(0,Z.jsx)(k_,{control:g.control,name:`rating`,render:P}),t[34]=g.control,t[35]=P,t[36]=F):F=t[36];let I;t[37]!==l||t[38]!==w||t[39]!==C||t[40]!==T||t[41]!==i||t[42]!==g.control||t[43]!==g.formState.isSubmitting||t[44]!==v||t[45]!==D||t[46]!==x||t[47]!==y?(I=y&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[v===`negative`&&(0,Z.jsx)(k_,{control:g.control,name:`reasons`,render:e=>{let{field:t}=e;return(0,Z.jsxs)(T_,{children:[(0,Z.jsx)(N_,{children:(0,Z.jsx)(Y,{id:`Fqx38P`})}),(0,Z.jsx)(M_,{children:(0,Z.jsx)(Ba,{type:`multiple`,variant:`outline`,spacing:2,value:t.value,onValueChange:t.onChange,className:`w-full flex-wrap justify-start`,children:AW.map(e=>(0,Z.jsx)(Ra,{value:e.value,className:FW,children:l(e.label)},e.value))})})]})}}),(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(k_,{control:g.control,name:`message`,render:e=>{let{field:t}=e;return(0,Z.jsx)(T_,{children:(0,Z.jsx)(M_,{children:(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(Ng,{...t,placeholder:l({id:`QlAG4m`}),className:gr(`resize-none pb-9`,i?`min-h-16`:`min-h-20`)}),(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(`span`,{className:gr(`absolute bottom-1.5 left-1.5 inline-flex`,w&&`cursor-not-allowed`),children:(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`icon`,disabled:w,onClick:()=>u.current?.click(),className:`size-7 text-muted-foreground`,children:[(0,Z.jsx)(Np,{className:`size-4`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`3LbBJn`})})]})})}),(0,Z.jsx)(Vr,{children:w?(0,Z.jsx)(Y,{id:`ASqqsQ`,values:{MAX_ATTACHMENTS:jW}}):(0,Z.jsx)(Y,{id:`3LbBJn`})})]}),(0,Z.jsx)(dh,{ref:u,type:`file`,accept:NW.join(`,`),multiple:!0,className:`hidden`,onChange:e=>{D(LW(C,e.target.files)),e.target.value=``}})]})})})}}),C.length>0&&(0,Z.jsx)(kW,{children:C.map((e,t)=>(0,Z.jsxs)(xW,{size:`xs`,children:[(0,Z.jsx)(CW,{variant:`image`,children:(0,Z.jsx)(RW,{file:e})}),(0,Z.jsxs)(wW,{children:[(0,Z.jsx)(TW,{children:e.name}),(0,Z.jsx)(EW,{children:IW(e.size)})]}),(0,Z.jsx)(DW,{children:(0,Z.jsx)(OW,{type:`button`,"aria-label":l({id:`w61W3L`,values:{0:e.name}}),onClick:()=>D(C.filter((e,n)=>n!==t)),children:(0,Z.jsx)(zp,{className:`size-3.5`})})})]},`${e.name}:${e.size}`))}),T?.message&&(0,Z.jsx)(`p`,{className:`text-destructive text-sm`,children:T.message})]})]}),(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(k_,{control:g.control,name:`shareEmail`,render:GW}),x&&(0,Z.jsx)(k_,{control:g.control,name:`email`,render:e=>{let{field:t}=e;return(0,Z.jsxs)(T_,{children:[(0,Z.jsx)(M_,{children:(0,Z.jsx)(dh,{...t,type:`email`,placeholder:l({id:`JHf6qZ`})})}),(0,Z.jsx)(P_,{})]})}})]}),(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(X,{type:`submit`,size:i?`sm`:`default`,disabled:g.formState.isSubmitting,children:g.formState.isSubmitting?(0,Z.jsx)(Y,{id:`9bG48P`}):(0,Z.jsx)(Y,{id:`JlFcis`})})})]}),t[37]=l,t[38]=w,t[39]=C,t[40]=T,t[41]=i,t[42]=g.control,t[43]=g.formState.isSubmitting,t[44]=v,t[45]=D,t[46]=x,t[47]=y,t[48]=I):I=t[48];let L;t[49]!==A||t[50]!==M||t[51]!==N||t[52]!==F||t[53]!==I?(L=(0,Z.jsxs)(`form`,{onSubmit:A,className:M,children:[N,F,I]}),t[49]=A,t[50]=M,t[51]=N,t[52]=F,t[53]=I,t[54]=L):L=t[54];let R;return t[55]!==g||t[56]!==L?(R=(0,Z.jsx)(F_,{...g,children:L}),t[55]=g,t[56]=L,t[57]=R):R=t[57],R};function BW(e){return NW.includes(e.type)}function VW(e){return e.every(BW)}function HW(e,t){return e+t.size}function UW(e){return e.reduce(HW,0)<=MW}function WW(e){return!e.shareEmail||Cs().safeParse(e.email).success}function GW(e){let{field:t}=e;return(0,Z.jsxs)(T_,{className:`flex flex-row items-center gap-2 space-y-0`,children:[(0,Z.jsx)(M_,{children:(0,Z.jsx)(zi,{checked:t.value,onCheckedChange:e=>t.onChange(e===!0)})}),(0,Z.jsx)(N_,{className:`font-normal`,children:(0,Z.jsx)(Y,{id:`SF9qpO`})})]})}function KW(e){let t=(0,$.c)(10),{onClose:n}=e,{_:r}=Bn(),i;t[0]===r?i=t[1]:(i=r({id:`u5hSeG`}),t[0]=r,t[1]=i);let a;t[2]===r?a=t[3]:(a=r({id:`s0-xF4`}),t[2]=r,t[3]=a);let o;t[4]!==n||t[5]!==a?(o=(0,Z.jsx)(gf,{children:(0,Z.jsx)(zW,{compact:!0,source:MU,title:a,onDismiss:n,onSuccess:n})}),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==i||t[8]!==o?(s=(0,Z.jsx)(rf,{asChild:!0,size:`sm`,className:`mx-1 mb-1`,children:(0,Z.jsx)(`section`,{"aria-label":i,children:o})}),t[7]=i,t[8]=o,t[9]=s):s=t[9],s}function qW(){let e=(0,$.c)(5),t=Id(),n=(0,Q.useSyncExternalStore)(Fj.subscribe,Fj.getSnapshot,Fj.getSnapshot),r=(0,Q.useSyncExternalStore)(pW,fW,fW),i=n.initialized&&!n.dismissed&&!n.completed||r.length>0,a=t?.pages??null,o=t!=null&&!t.loading,s;if(e[0]!==i||e[1]!==a||e[2]!==o?(s={pages:a,ready:o,blocked:i},e[0]=i,e[1]=a,e[2]=o,e[3]=s):s=e[3],!FU(s))return null;let c;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(KW,{onClose:JW}),e[4]=c):c=e[4],c}function JW(){return fH.dismiss()}var YW=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
9
9
  <symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
10
10
  <path d="M12.4697 5.46973C12.7626 5.17684 13.2374 5.17684 13.5303 5.46973C13.8232 5.76262 13.8232 6.23738 13.5303 6.53028L8.53028 11.5303C8.23738 11.8232 7.76262 11.8232 7.46973 11.5303L2.46973 6.53028C2.17684 6.23738 2.17684 5.76262 2.46973 5.46973C2.76262 5.17684 3.23738 5.17684 3.53028 5.46973L8 9.93946L12.4697 5.46973Z" fill="currentcolor"/>
11
11
  </symbol>
@@ -2200,5 +2200,5 @@ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./globals-Bezfr5us.js";imp
2200
2200
  background-color: var(--accent) !important;
2201
2201
  color: var(--foreground) !important;
2202
2202
  }
2203
- `,F8=null,I8=3e3,L8=null,R8=null;function z8(e){e.current=performance.now()+50}function B8(e){return performance.now()<e.current}function V8(e,t=new Map){let n=e.endsWith(`/`),r=(n?e.slice(0,-1):e).split(`/`),i=r[0]??``,a=r.length>=2?r[1]:void 0;if(!(a!==void 0&&t.has(`${i}/${a}`)))return{scopeLabel:i,group:void 0,skillDisplay:a,sub:r.length>=3?r.slice(2).join(`/`):null,isGroupRow:!1,inProvenanceGroup:!1,isDir:n};let o=r.length>=3?r[2]:void 0,s=o!==void 0&&t.has(`${i}/${a}/${o}`),c=s?`${a}/${o}`:a,l=s?3:2;return{scopeLabel:i,group:c,skillDisplay:r.length>l?r[l]:void 0,sub:r.length>l+1?r.slice(l+1).join(`/`):null,isGroupRow:r.length===(s?3:2),inProvenanceGroup:!0,isDir:n}}function H8(e){let t=(0,$.c)(12),{scope:n,name:r,pinned:i,onToggle:a}=e,o;t[0]!==r||t[1]!==a||t[2]!==i||t[3]!==n?(o=()=>a(n,r,!i),t[0]=r,t[1]=a,t[2]=i,t[3]=n,t[4]=o):o=t[4];let s,c;t[5]===i?(s=t[6],c=t[7]):(s=i?(0,Z.jsx)(pb,{"aria-hidden":!0}):(0,Z.jsx)(mb,{"aria-hidden":!0}),c=i?(0,Z.jsx)(Y,{id:`nWMRxa`}):(0,Z.jsx)(Y,{id:`arNEY0`}),t[5]=i,t[6]=s,t[7]=c);let l;return t[8]!==o||t[9]!==s||t[10]!==c?(l=(0,Z.jsxs)(ca,{onSelect:o,children:[s,c]}),t[8]=o,t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function U8(e){let t=(0,$.c)(209),{paths:n,activePath:r,initialExpandedPaths:i,onExpandedChange:a,sort:o,skillByPrefix:s,detectedByPrefix:c,groupByPrefix:l,pinnedPrefixes:u,labelToScope:d,scopeDescription:f,existingNames:p,actions:m,onOpenSkillMd:h,onOpenFile:g,onOpenDetected:_,onOpenManaged:v,onNewSkill:y,onAddSkill:b,isPinned:x,onTogglePin:S}=e,{_:C}=Bn(),{resolvedTheme:w}=sr(),T=(0,Q.useRef)(null),E=(0,Q.useRef)(null),[D,O]=(0,Q.useState)(!1),k,A;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>O(!0),A=[],t[0]=k,t[1]=A):(k=t[0],A=t[1]),(0,Q.useEffect)(k,A);let[j,M]=(0,Q.useState)(null),N;t[2]===s?N=t[3]:(N=[...s.values()].map(t5),t[2]=s,t[3]=N);let P=N.join(`|`),F=e5,I;t[4]===s?I=t[5]:(I=e=>{let t=F(e);return t===void 0?void 0:s.get(t)},t[4]=s,t[5]=I);let L=I,R;t[6]===c?R=t[7]:(R=e=>{let t=F(e);return t===void 0?void 0:c.get(t)},t[6]=c,t[7]=R);let z=R,B;t[8]!==C||t[9]!==z||t[10]!==l||t[11]!==d||t[12]!==L?(B=e=>{let t=V8(e,l);if(t.isGroupRow){let e=t.group?l.get(`${t.scopeLabel}/${t.group}`):void 0;if(!e)return null;if(e.kind===`plugin`)return e.url?C({id:`sAP9XO`,values:{0:e.id,1:e.url}}):C({id:`dFrqBg`,values:{0:e.id}});let n=e.publisher?`${e.publisher}/${e.id}`:e.id;return e.url?C({id:`c9-Pi9`,values:{source:n}}):C({id:`8Z_GCT`,values:{source:n}})}if(t.skillDisplay===void 0)return null;let n=z(t);if(n){let e=d.get(t.scopeLabel)??`global`,r=n.sourceHarnesses.map(n=>`${nh(n,e)}/${t.skillDisplay}`);return t.sub?r.map(e=>`${e}/${t.sub}`).join(`, `):r.join(`, `)}let r=L(t);if(!r)return null;if(r.managed){let e=r.absolutePath?eh(rh(r.absolutePath)):null;return e?t.sub?`${e}/${t.sub}`:e:null}return $m(r).map(e=>{let n=t.sub?`${e.dir}/${t.sub}`:e.dir;return e.symlink?C({id:`leiGnv`,values:{dir:n}}):n}).join(`, `)},t[8]=C,t[9]=z,t[10]=l,t[11]=d,t[12]=L,t[13]=B):B=t[13];let V=B,ee;t[14]!==l||t[15]!==s?(ee=e=>{if(!e.isGroupRow||e.group===void 0)return[];let t=`${e.scopeLabel}/${e.group}`;return f8({groupPrefix:t,bucket:l.get(t),skillByPrefix:s})},t[14]=l,t[15]=s,t[16]=ee):ee=t[16];let H=ee,U;t[17]!==z||t[18]!==l||t[19]!==d||t[20]!==L||t[21]!==H?(U=e=>{if(!d.get(e.scopeLabel))return!1;if(e.isGroupRow)return H(e).length>0||e.group!==void 0&&l.has(`${e.scopeLabel}/${e.group}`);if(e.skillDisplay===void 0||z(e))return!0;let t=L(e);return t?t.managed?e.sub===null:!0:!1},t[17]=z,t[18]=l,t[19]=d,t[20]=L,t[21]=H,t[22]=U):U=t[22];let W=U,G;t[23]===C?G=t[24]:(G=(e,t)=>{if(!e)return null;if(e.kind===`plugin`){if(!t){if(!e.parent)return null;let t={kind:`source`,id:e.parent.id,publisher:e.parent.publisher,url:e.parent.url};return G(t,!1)}let n=e.id,r=e.url??e.parent?.url??null;return r===null?{kind:`plugin`,title:C({id:`3l32hp`,values:{plugin:n}})}:{kind:`plugin`,title:C({id:`LGvaif`,values:{plugin:n}}),href:r}}let n=e.publisher;if(!n){if(!t)return null;let n=e.id;return{kind:`library`,title:e.url?C({id:`c9-Pi9`,values:{source:n}}):C({id:`8Z_GCT`,values:{source:n}}),...e.url===null?{}:{href:e.url}}}return{kind:`publisher`,login:n,title:e.url===null?C({id:`nWS2gQ`,values:{publisher:n}}):C({id:`2QoAQ-`,values:{publisher:n}}),...e.url===null?{}:{href:e.url}}},t[23]=C,t[24]=G);let te;t[25]!==C||t[26]!==z||t[27]!==l||t[28]!==G||t[29]!==u||t[30]!==L?(te=e=>{let t=V8(e,l);if(!t.inProvenanceGroup&&t.skillDisplay!==void 0&&t.sub===null&&u.has(`${t.scopeLabel}/${t.skillDisplay}`))return{kind:`pin`,title:C({id:`kNiQp6`})};if(t.isGroupRow)return G(l.get(`${t.scopeLabel}/${t.group}`)??null,!0);if(t.inProvenanceGroup||t.skillDisplay===void 0||t.sub!==null)return null;let n=L(t);if(n)return G(b8(n),!1);let r=z(t);return G(r?x8(r):null,!1)},t[25]=C,t[26]=z,t[27]=l,t[28]=G,t[29]=u,t[30]=L,t[31]=te):te=t[31];let ne=te,re=(0,Q.useRef)(W),K;t[32]===W?K=t[33]:(K=()=>{re.current=W},t[32]=W,t[33]=K),(0,Q.useEffect)(K);let ie=(0,Q.useRef)(l),q;t[34]===l?q=t[35]:(q=()=>{ie.current=l},t[34]=l,t[35]=q),(0,Q.useEffect)(q);let ae=(0,Q.useRef)(d),oe;t[36]===d?oe=t[37]:(oe=()=>{ae.current=d},t[36]=d,t[37]=oe),(0,Q.useEffect)(oe);let se;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(se=[],t[38]=se):se=t[38];let ce=(0,Q.useRef)(se),le;t[39]!==z||t[40]!==l||t[41]!==n||t[42]!==L?(le=()=>{let e=[],t=new Set;for(let r of n){let n=V8(r,l);if(n.skillDisplay===void 0||n.isGroupRow||L(n)===void 0&&z(n)===void 0)continue;let i=`${n.group===void 0?n.scopeLabel:`${n.scopeLabel}/${n.group}`}/${n.skillDisplay}/`;t.has(i)||(t.add(i),e.push(i))}ce.current=e},t[39]=z,t[40]=l,t[41]=n,t[42]=L,t[43]=le):le=t[43],(0,Q.useEffect)(le);let ue=$8,de;t[44]!==C||t[45]!==z||t[46]!==l||t[47]!==d||t[48]!==L?(de=e=>{let t=V8(e,l);if(t.skillDisplay===void 0||t.sub!==null)return null;let n=z(t);if(n){let e=d.get(t.scopeLabel)??`global`;return{kind:`icons`,poolKeys:n.sourceHarnesses.map(ue),title:C({id:`W3Tsgy`,values:{0:n.sourceHarnesses.map(t=>nh(t,e)).join(`, `)}})}}let r=L(t);if(!r)return null;let i=Qm(r);return i.length>0?{kind:`icons`,poolKeys:i.map(ue),title:C({id:`h2N-1n`,values:{0:i.map(e=>nh(e,r.scope)).join(`, `)}})}:r.managed?null:{kind:`install`,title:C({id:`fGqEFq`,values:{0:r.name}})}},t[44]=C,t[45]=z,t[46]=l,t[47]=d,t[48]=L,t[49]=de):de=t[49];let pe=de,J;t[50]!==z||t[51]!==l||t[52]!==L?(J=e=>{let t=V8(e,l);if(t.skillDisplay===void 0||t.sub!==null||t.isGroupRow||z(t))return null;let n=L(t);return n&&!n.managed?n:null},t[50]=z,t[51]=l,t[52]=L,t[53]=J):J=t[53];let me=J,he;t[54]===C?he=t[55]:(he=C({id:`TKQ7K-`}),t[54]=C,t[55]=he);let ge;t[56]!==pe||t[57]!==z||t[58]!==me||t[59]!==ne||t[60]!==L||t[61]!==he?(ge={decorForPath:pe,skillFor:L,detectedFor:z,markForPath:ne,draggableEntryFor:me,installLabel:he},t[56]=pe,t[57]=z,t[58]=me,t[59]=ne,t[60]=L,t[61]=he,t[62]=ge):ge=t[62];let _e=(0,Q.useRef)(ge),ve;t[63]!==C||t[64]!==pe||t[65]!==z||t[66]!==me||t[67]!==ne||t[68]!==L?(ve=()=>{_e.current={decorForPath:pe,skillFor:L,detectedFor:z,markForPath:ne,draggableEntryFor:me,installLabel:C({id:`TKQ7K-`})}},t[63]=C,t[64]=pe,t[65]=z,t[66]=me,t[67]=ne,t[68]=L,t[69]=ve):ve=t[69],(0,Q.useEffect)(ve);let ye=(0,Q.useRef)(Q8),be=(0,Q.useRef)(null),xe;if(t[70]!==C||t[71]!==r||t[72]!==z||t[73]!==l||t[74]!==i||t[75]!==n){let e;t[77]!==C||t[78]!==z||t[79]!==l?(e=e=>{let{item:t}=e,n=V8(t.path,l);if(n.skillDisplay===void 0||n.sub!==null)return null;let r=z(n);return r?.provenance.plugin!==void 0&&!n.inProvenanceGroup?{icon:M8,title:C({id:`AkA6DO`,values:{0:r.provenance.plugin}})}:null},t[77]=C,t[78]=z,t[79]=l,t[80]=e):e=t[80],xe=B2({paths:n,initialExpansion:`closed`,initialExpandedPaths:i,initialSelectedPaths:r?[r]:void 0,stickyFolders:!1,enableContextMenu:!0,unsafeCSS:`${z2}\n${P8}\n${G6}\n${c8}`,extraSpriteSymbols:N8,renderRowDecoration:e}),t[70]=C,t[71]=r,t[72]=z,t[73]=l,t[74]=i,t[75]=n,t[76]=xe}else xe=t[76];let Se;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(Se=e=>ye.current(e),t[81]=Se):Se=t[81];let Ce;t[82]!==o||t[83]!==xe?(Ce={...xe,onSelectionChange:Se,sort:o,flattenEmptyDirectories:!1},t[82]=o,t[83]=xe,t[84]=Ce):Ce=t[84];let{model:we}=m0(Ce),Te;t[85]===we?Te=t[86]:(Te=e=>we.getItem(e)?.deselect(),t[85]=we,t[86]=Te);let Ee=Te,De=(0,Q.useRef)(r),Oe;t[87]===r?Oe=t[88]:(Oe=()=>{De.current=r},t[87]=r,t[88]=Oe),(0,Q.useEffect)(Oe);let ke;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(ke=new Set,t[89]=ke):ke=t[89];let[Ae,je]=(0,Q.useState)(ke),Me=(0,Q.useRef)(Ae),Ne;t[90]===Ae?Ne=t[91]:(Ne=()=>{Me.current=Ae},t[90]=Ae,t[91]=Ne),(0,Q.useEffect)(Ne);let Pe=(0,Q.useRef)(0),Fe;t[92]!==r||t[93]!==Ee?(Fe=()=>{let e=Me.current;Me.current=new Set,z8(Pe);for(let t of e)t!==r&&Ee(t);e.size>0&&je(new Set)},t[92]=r,t[93]=Ee,t[94]=Fe):Fe=t[94];let Ie=Fe,[Le,Re]=(0,Q.useState)(null),ze=Zf(),Be;t[95]!==C||t[96]!==ze?(Be=async function(e,t){let n=await Vm({source:rh(e.files.skillMd),skill:e.name,scope:t,install:!1});if(!n.ok){let e=n.error;Dc.error(C({id:`Uw6ERJ`,values:{detail:e}}));return}ze(t,n.name)},t[95]=C,t[96]=ze,t[97]=Be):Be=t[97];let Ve=Be,He;t[98]!==C||t[99]!==Ie?(He=async function(e,t){let n=0;for(let r of e){let e=await zm({name:r.name,fromScope:r.scope,toScope:t});e.ok?n+=1:Dc.error(C({id:`gLjtu3`,values:{0:r.name,1:e.error}}))}n>0&&Dc.success(C(t===`global`?{id:`X0c6kF`,values:{moved:n}}:{id:`ZOVgDv`,values:{moved:n}})),Ie()},t[98]=C,t[99]=Ie,t[100]=He):He=t[100];let Ue=He,We=(0,Q.useRef)(Ue),Ge;t[101]===Ue?Ge=t[102]:(Ge=()=>{We.current=Ue},t[101]=Ue,t[102]=Ge),(0,Q.useEffect)(Ge);let Ke=(0,Q.useRef)(!1),qe=(0,Q.useRef)(0),Je;t[103]!==we||t[104]!==D||t[105]!==Ee?(Je=()=>{if(!D)return;let e=T.current?.querySelector(cK)?.shadowRoot;if(!e)return;let t=e=>{let t=(e.target?.closest?.(`[data-item-path]`))?.getAttribute(`data-item-path`);if(!t)return null;let n=V8(t,ie.current);return n.skillDisplay===void 0||n.sub!==null||n.isGroupRow||!_e.current.skillFor(n)&&!_e.current.detectedFor(n)?null:t},n=e=>!(e instanceof MouseEvent)||!(e.metaKey||e.ctrlKey)?null:t(e),r=e=>!(e instanceof MouseEvent)||!e.shiftKey||e.metaKey||e.ctrlKey?null:t(e),i=!1,a=e=>{Me.current=e,je(e),z8(Pe);for(let t of we.getSelectedPaths())!e.has(t)&&t!==De.current&&Ee(t);for(let t of e)we.getItem(t)?.select()},o=e=>{i=!1;let o=e.target;if(Ke.current=o?.closest?.(`[data-item-section='icon']`)!=null,e instanceof MouseEvent&&e.button===0&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!Ke.current){let n=o?.closest?.(`[data-item-path]`)?.getAttribute(`data-item-path`);n&&(F8={path:n,at:performance.now()},t(e)!==null&&(L8=n,R8=null))}let s=r(e);if(s!==null&&L8!==null){let t=u(),n=t.indexOf(L8),r=t.indexOf(s);if(n!==-1&&r!==-1){e.preventDefault(),e.stopImmediatePropagation(),i=!0,R8=s;let[o,c]=n<=r?[n,r]:[r,n],l=L8.split(`/`)[0];a(new Set(t.slice(o,c+1).filter(e=>e.split(`/`)[0]===l)));return}}let c=n(e);if(c===null)return;e.preventDefault(),e.stopImmediatePropagation(),i=!0,L8=c,R8=null;let l=new Set(Me.current),d=!l.has(c);d?l.add(c):l.delete(c),Me.current=l,je(l),z8(Pe),d?we.getItem(c)?.select():c!==De.current&&Ee(c)},s=e=>{i&&(i=!1,e.preventDefault(),e.stopImmediatePropagation())},c=[],l=e=>{if(!(e instanceof MouseEvent)||e.button!==0)return;let t=e.target;if(t?.closest?.(`[data-item-section='icon']`)!=null)return;let n=(t?.closest?.(`[data-item-path]`))?.getAttribute(`data-item-path`);if(!n)return;let r=qe.current;c.push(setTimeout(()=>{qe.current===r&&(Ke.current=!1,ye.current([n]))},250))},u=()=>{let t=new Set(ce.current),n=[];for(let r of e.querySelectorAll(`[data-item-path]`)){let e=r.getAttribute(`data-item-path`);e!==null&&t.has(e)&&n.push(e)}return n.length>0?n:ce.current},d=e=>{if(!(e instanceof KeyboardEvent))return;let t=e.key.toLowerCase();if(!e.altKey&&!e.shiftKey&&(e.metaKey&&!e.ctrlKey&&t===`backspace`||!e.metaKey&&!e.ctrlKey&&t===`delete`)&&Me.current.size>0){if(e.target?.closest?.(`[contenteditable], input, textarea, [role="textbox"]`))return;let t=[...Me.current].map(e=>_e.current.skillFor(V8(e,ie.current))).filter(Z8);if(t.length===0)return;e.preventDefault(),e.stopImmediatePropagation(),Re(t);return}if(!e.shiftKey||e.key!==`ArrowDown`&&e.key!==`ArrowUp`||e.target?.closest?.(`[contenteditable], input, textarea, [role="textbox"]`))return;let n=T.current?.contains(document.activeElement);if(Me.current.size===0&&!n)return;if(L8===null&&De.current!==void 0){let e=V8(De.current,ie.current);e.skillDisplay!==void 0&&(L8=`${e.group===void 0?e.scopeLabel:`${e.scopeLabel}/${e.group}`}/${e.skillDisplay}/`,R8=null)}if(L8===null)return;let r=L8.split(`/`)[0],i=u().filter(e=>e.split(`/`)[0]===r),o=i.indexOf(L8);if(o===-1)return;let s=R8!==null&&i.indexOf(R8)!==-1?i.indexOf(R8):o,c=Math.min(Math.max(s+(e.key===`ArrowDown`?1:-1),0),i.length-1);e.preventDefault(),e.stopImmediatePropagation(),R8=i[c];let[l,d]=o<=c?[o,c]:[c,o];a(new Set(i.slice(l,d+1)))};return e.addEventListener(`pointerdown`,o,!0),e.addEventListener(`click`,s,!0),e.addEventListener(`click`,l,!0),window.addEventListener(`keydown`,d,!0),()=>{e.removeEventListener(`pointerdown`,o,!0),e.removeEventListener(`click`,s,!0),e.removeEventListener(`click`,l,!0),window.removeEventListener(`keydown`,d,!0);for(let e of c)clearTimeout(e)}},t[103]=we,t[104]=D,t[105]=Ee,t[106]=Je):Je=t[106];let Ye;t[107]===D?Ye=t[108]:(Ye=[D],t[107]=D,t[108]=Ye),(0,Q.useEffect)(Je,Ye);let Xe=(0,Q.useRef)(null),Ze,Qe;t[109]===D?(Ze=t[110],Qe=t[111]):(Ze=()=>{if(!D)return;let e=T.current?.querySelector(cK)?.shadowRoot;if(!e)return;let t=X8,n=()=>{for(let t of e.querySelectorAll(`[data-ok-drop-scope]`))t.removeAttribute(`data-ok-drop-scope`)},r=e=>{let n=Xe.current,r=t(e);if(!n||!r)return null;let i=V8(r,ie.current),a=ae.current.get(i.scopeLabel);return a===void 0||a===n.fromScope?null:{scope:a,label:i.scopeLabel}},i=e=>{if(!(e instanceof DragEvent))return;let n=t(e),r=n===null?null:_e.current.draggableEntryFor(n);if(n===null||r===null){e.preventDefault();return}let i=[r],a=Me.current;if(a.has(n)&&a.size>1){let e=[...a].map(e=>_e.current.draggableEntryFor(e)).filter(e=>e!==null&&e.scope===r.scope);e.length>1&&(i=e)}Xe.current={entries:i,fromScope:r.scope},e.dataTransfer&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,i.map(Y8).join(`, `)))},a=t=>{if(!(t instanceof DragEvent))return;let i=r(t);n(),i!==null&&(t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect=`move`),e.querySelector(`[data-item-path="${i.label}/"]`)?.setAttribute(`data-ok-drop-scope`,`true`))},o=e=>{let t=Xe.current,i=r(e);n(),Xe.current=null,!(!t||i===null)&&(e.preventDefault(),e.stopPropagation(),We.current(t.entries,i.scope))},s=()=>{n(),Xe.current=null};return e.addEventListener(`dragstart`,i,!0),e.addEventListener(`dragover`,a,!0),e.addEventListener(`drop`,o,!0),e.addEventListener(`dragend`,s,!0),()=>{e.removeEventListener(`dragstart`,i,!0),e.removeEventListener(`dragover`,a,!0),e.removeEventListener(`drop`,o,!0),e.removeEventListener(`dragend`,s,!0)}},Qe=[D],t[109]=D,t[110]=Ze,t[111]=Qe),(0,Q.useEffect)(Ze,Qe);let $e;t[112]!==r||t[113]!==z||t[114]!==l||t[115]!==we||t[116]!==_||t[117]!==g||t[118]!==v||t[119]!==h||t[120]!==Ee||t[121]!==L?($e=()=>{let e=(we.getSelectedPaths?.()??[]).filter(e=>e!==r);for(let t of e)Me.current.has(t)||Ee(t);let t=be.current!==we;be.current=we;let n=t&&F8!==null&&performance.now()-F8.at<I8&&F8.path!==r?F8.path:null;ye.current=e=>{if(qe.current+=1,F8!==null&&e[0]===F8.path&&(F8=null),B8(Pe))return;Me.current.size>0&&(Me.current=new Set,je(new Set));let t=e[0],n=Ke.current;if(Ke.current=!1,n&&t){Ee(t);return}if(!t||t===r)return;let i=V8(t,l);if(i.sub!==null&&i.isDir)return;let a=z(i);if(a){_(a,i.sub??void 0),Ee(t);return}let o=L(i);o&&(i.sub===null||i.sub===`SKILL.md`?(o.managed?v:h)(o):g(o,i.sub),Ee(t))},n!==null&&(F8=null,Ke.current=!1,ye.current([n]))},t[112]=r,t[113]=z,t[114]=l,t[115]=we,t[116]=_,t[117]=g,t[118]=v,t[119]=h,t[120]=Ee,t[121]=L,t[122]=$e):$e=t[122],(0,Q.useEffect)($e);let et;t[123]!==c||t[124]!==l||t[125]!==d||t[126]!==a||t[127]!==s?(et={labelToScope:d,skillByPrefix:s,detectedByPrefix:c,groupByPrefix:l,onExpandedChange:a},t[123]=c,t[124]=l,t[125]=d,t[126]=a,t[127]=s,t[128]=et):et=t[128];let tt=(0,Q.useRef)(et),nt;t[129]!==c||t[130]!==l||t[131]!==d||t[132]!==a||t[133]!==s?(nt=()=>{tt.current={labelToScope:d,skillByPrefix:s,detectedByPrefix:c,groupByPrefix:l,onExpandedChange:a}},t[129]=c,t[130]=l,t[131]=d,t[132]=a,t[133]=s,t[134]=nt):nt=t[134],(0,Q.useEffect)(nt);let rt;t[135]===Symbol.for(`react.memo_cache_sentinel`)?(rt=new Set,t[135]=rt):rt=t[135];let it=(0,Q.useRef)(rt),at,ot;t[136]===we?(at=t[137],ot=t[138]):(at=()=>{let e=()=>{let e=tt.current,t=new Set,n=e=>{r4(we.getItem(e))?.isExpanded()&&t.add(e)};for(let t of e.labelToScope.keys())n(`${t}/`);for(let t of e.skillByPrefix.keys())n(`${t}/`);for(let t of e.detectedByPrefix.keys())n(`${t}/`);for(let t of e.groupByPrefix.keys())n(`${t}/`);let r=it.current;r.size===t.size&&[...t].every(e=>r.has(e))||(it.current=t,e.onExpandedChange(t))};return e(),we.subscribe(e)},ot=[we],t[136]=we,t[137]=at,t[138]=ot),(0,Q.useEffect)(at,ot);let st,ct;t[139]!==we||t[140]!==D?(st=()=>{if(D)return we.subscribe(()=>{let e=Me.current;if(e.size>0){let t=new Set(we.getSelectedPaths()),n=!1;for(let r of e)if(!t.has(r)){n=!0;break}if(n){z8(Pe);for(let t of e)we.getItem(t)?.select()}return}let t=De.current;for(let e of we.getSelectedPaths())e!==t&&we.getItem(e)?.deselect()})},ct=[D,we],t[139]=we,t[140]=D,t[141]=st,t[142]=ct):(st=t[141],ct=t[142]),(0,Q.useEffect)(st,ct);let lt,ut;t[143]!==r||t[144]!==we||t[145]!==Ae||t[146]!==D?(lt=()=>{if(D&&!(Ae.size>0)){for(let e of we.getSelectedPaths())e!==r&&we.getItem(e)?.deselect();if(r){we.getItem(r)?.select(),we.focusPath(r);let e=V8(r,ie.current);if(e.skillDisplay!==void 0){let t=e.group===void 0?e.scopeLabel:`${e.scopeLabel}/${e.group}`;r4(we.getItem(`${t}/${e.skillDisplay}/`))?.expand()}A2(we,r)}}},ut=[D,r,we,Ae],t[143]=r,t[144]=we,t[145]=Ae,t[146]=D,t[147]=lt,t[148]=ut):(lt=t[147],ut=t[148]),(0,Q.useEffect)(lt,ut);let dt=(0,Q.useRef)(i),ft;t[149]===i?ft=t[150]:(ft=()=>{dt.current=i},t[149]=i,t[150]=ft),(0,Q.useEffect)(ft);let mt,ht;t[151]!==we||t[152]!==D?(mt=()=>{if(D)for(let e of dt.current)r4(we.getItem(e))?.expand()},ht=[D,we],t[151]=we,t[152]=D,t[153]=mt,t[154]=ht):(mt=t[153],ht=t[154]),(0,Q.useEffect)(mt,ht);let gt,_t;t[155]===D?(gt=t[156],_t=t[157]):(gt=()=>{if(!D)return;let e=T.current?.querySelector(cK)?.shadowRoot;if(!e)return;let t=()=>{let t=e.querySelector(`[data-type="context-menu-anchor"]`);if(!t)return;let n=e.querySelector(`[data-item-context-hover="true"][data-item-path]`)?.dataset.itemPath,r=n!==void 0&&!re.current(V8(n,ie.current));t.style.display=r?`none`:``};t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-context-hover`]}),()=>n.disconnect()},_t=[D],t[155]=D,t[156]=gt,t[157]=_t),(0,Q.useEffect)(gt,_t);let vt;t[158]!==l||t[159]!==D||t[160]!==w?(vt=()=>{if(!D)return;let e=T.current?.querySelector(cK)?.shadowRoot;if(!e)return;let t=()=>{q6(e,{decorFor:e=>_e.current.decorForPath(e),iconPool:E.current,installLabel:_e.current.installLabel,version:w??`light`}),u8(e,{markFor:e=>_e.current.markForPath(e),iconPool:E.current,version:w??`light`});for(let t of e.querySelectorAll(`[data-item-path]`)){let e=t.getAttribute(`data-item-path`),n=e!==null&&_e.current.draggableEntryFor(e)!==null;t.draggable!==n&&(t.draggable=n)}};t();let n=new MutationObserver(t);n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]});let r=e=>{let t=K6(e.target);if(!t)return;e.preventDefault(),e.stopPropagation();let n=_e.current.skillFor(V8(t.path,l));n&&M({skill:n,x:t.rect.left,y:t.rect.bottom})};return e.addEventListener(`click`,r,!0),()=>{n.disconnect(),e.removeEventListener(`click`,r,!0)}},t[158]=l,t[159]=D,t[160]=w,t[161]=vt):vt=t[161];let yt;t[162]!==P||t[163]!==D||t[164]!==w?(yt=[D,w,P],t[162]=P,t[163]=D,t[164]=w,t[165]=yt):yt=t[165],(0,Q.useEffect)(vt,yt);let bt;t[166]===Symbol.for(`react.memo_cache_sentinel`)?(bt=(0,Z.jsxs)(`div`,{ref:E,"aria-hidden":!0,style:{position:`absolute`,width:0,height:0,overflow:`hidden`},children:[Cr.map(J8),(0,Z.jsx)(`span`,{[Z6]:`generic`,children:(0,Z.jsx)(pt,{})}),(0,Z.jsx)(`span`,{[i8]:a8,children:(0,Z.jsx)(Ap,{})}),(0,Z.jsx)(`span`,{[i8]:o8,children:(0,Z.jsx)(mb,{})}),(0,Z.jsx)(`span`,{[i8]:s8,children:(0,Z.jsx)(tb,{})})]}),t[166]=bt):bt=t[166];let xt;t[167]!==m||t[168]!==j?(xt=j?(0,Z.jsxs)(va,{open:!0,onOpenChange:e=>{e||M(null)},children:[(0,Z.jsx)(fa,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":!0,style:{position:`fixed`,left:j.x,top:j.y,width:0,height:0}})}),(0,Z.jsx)(ga,{align:`start`,className:Dr,children:(0,Z.jsx)(n5,{skill:j.skill,actions:m,onRunStart:()=>M(null)})})]}):null,t[167]=m,t[168]=j,t[169]=xt):xt=t[169];let St;t[170]===Symbol.for(`react.memo_cache_sentinel`)?(St=e=>{e||Re(null)},t[170]=St):St=t[170];let Ct;t[171]===Ie?Ct=t[172]:(Ct=()=>{Re(null),Ie()},t[171]=Ie,t[172]=Ct);let wt;t[173]!==Le||t[174]!==Ct?(wt=(0,Z.jsx)(I6,{skills:Le,onOpenChange:St,onDeleted:Ct}),t[173]=Le,t[174]=Ct,t[175]=wt):wt=t[175];let Tt;t[176]===w?Tt=t[177]:(Tt=b0(w),t[176]=w,t[177]=Tt);let Et;t[178]!==C||t[179]!==m||t[180]!==Ue||t[181]!==Ie||t[182]!==z||t[183]!==Ve||t[184]!==p||t[185]!==l||t[186]!==x||t[187]!==d||t[188]!==Ae||t[189]!==b||t[190]!==y||t[191]!==_||t[192]!==S||t[193]!==W||t[194]!==f||t[195]!==s||t[196]!==L||t[197]!==H?(Et=(e,t)=>{let n=V8(e.path,l);if(!W(n))return null;let r=d.get(n.scopeLabel);if(!r)return null;let i,a=Ae.size>1&&Ae.has(e.path)?[...Ae].map(e=>L(V8(e,l))).filter(q8):[];if(a.length>1){let e=new Set(a.map(K8)).size===1&&a.every(G8),t=a[0].scope===`project`?`global`:`project`;i=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ma,{className:`max-w-56 whitespace-normal font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`WG3MZ4`,values:{0:a.length}})}),(0,Z.jsx)(ya,{}),e?(0,Z.jsxs)(ca,{onSelect:()=>void Ue(a,t),children:[(0,Z.jsx)(uu,{"aria-hidden":!0}),t===`global`?(0,Z.jsx)(Y,{id:`Qft6eW`,values:{0:a.length}}):(0,Z.jsx)(Y,{id:`DcH8-w`,values:{0:a.length}})]}):null,(0,Z.jsxs)(ca,{variant:`destructive`,onSelect:()=>Re(a),children:[(0,Z.jsx)(Ip,{"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`N5rzKJ`,values:{0:a.length}})]}),(0,Z.jsx)(ya,{}),(0,Z.jsx)(ca,{onSelect:()=>Ie(),children:(0,Z.jsx)(Y,{id:`FBIuPX`})})]})}else if(n.isGroupRow){let e=H(n),t=n.group===void 0?void 0:l.get(`${n.scopeLabel}/${n.group}`),a=n.group===void 0?[]:p8({groupPrefix:`${n.scopeLabel}/${n.group}`,bucket:t,skillByPrefix:s});if(e.length===0&&a.length===0&&!t)return null;let o=n.group??``;i=(0,Z.jsxs)(Z.Fragment,{children:[t?(0,Z.jsx)(ma,{className:`max-w-56 whitespace-normal font-normal text-muted-foreground text-xs`,children:t.kind===`plugin`?(0,Z.jsx)(Y,{id:`rIFV5h`,values:{0:t.id}}):t.publisher?(0,Z.jsx)(Y,{id:`fKsRVO`,values:{0:t.publisher,1:t.id}}):(0,Z.jsx)(Y,{id:`idufL_`,values:{0:t.id}})}):null,t?.url?(0,Z.jsxs)(ca,{onSelect:()=>gh(t.url),children:[(0,Z.jsx)(ju,{"aria-hidden":!0}),t.kind===`plugin`?(0,Z.jsx)(Y,{id:`Fhp4Gn`}):(0,Z.jsx)(Y,{id:`n_I-da`})]}):null,e.length>0?(0,Z.jsxs)(Z.Fragment,{children:[t?(0,Z.jsx)(ya,{}):null,(0,Z.jsxs)(ca,{onSelect:()=>void m.updateAllFromSource({scope:r,names:e.map(W8),sourceLabel:o}),children:[(0,Z.jsx)(uu,{"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`e4BHn_`})]})]}):null,a.length>0?(0,Z.jsxs)(Z.Fragment,{children:[e.length===0&&t?(0,Z.jsx)(ya,{}):null,(0,Z.jsxs)(ca,{variant:`destructive`,onSelect:()=>Re(a),children:[(0,Z.jsx)(Ip,{"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`N5rzKJ`,values:{0:a.length}})]})]}):null]})}else if(n.skillDisplay===void 0)i=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ma,{className:`max-w-56 whitespace-normal font-normal text-muted-foreground text-xs`,children:f[r]}),(0,Z.jsx)(ya,{}),(0,Z.jsxs)(ca,{onSelect:()=>y(r),children:[(0,Z.jsx)(Fp,{"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`MdpSC1`})]}),(0,Z.jsxs)(ca,{onSelect:()=>b(r,`upload`),children:[(0,Z.jsx)(fe,{"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`koo58J`})]}),(0,Z.jsxs)(ca,{onSelect:()=>b(r,`skills-sh`),children:[(0,Z.jsx)(Ly,{"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`C3Zc44`})]})]});else{let e=z(n);if(e){let t=e.provenance.plugin?.trim()||null,n=t!==null||e.outsideProject===!0,a=rh(e.files.skillMd);i=(0,Z.jsxs)(Z.Fragment,{children:[t===null?e.outsideProject===!0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ma,{className:`max-w-56 whitespace-normal font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`i04BJx`})}),(0,Z.jsx)(ya,{})]}):null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ma,{className:`max-w-56 whitespace-normal font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`RJMO4B`,values:{residentPlugin:t}})}),(0,Z.jsx)(ya,{})]}),(0,Z.jsxs)(ca,{onSelect:()=>_(e),children:[n?(0,Z.jsx)(bf,{"aria-hidden":!0}):(0,Z.jsx)(Fp,{"aria-hidden":!0}),n?(0,Z.jsx)(Y,{id:`jpctdh`}):(0,Z.jsx)(Y,{id:`ePK91l`})]}),t===null?null:(0,Z.jsxs)(la,{children:[(0,Z.jsxs)(ha,{children:[(0,Z.jsx)(Fp,{"aria-hidden":!0,className:`text-muted-foreground`}),(0,Z.jsx)(Y,{id:`rFL-yb`})]}),(0,Z.jsxs)(ua,{children:[(0,Z.jsx)(ma,{className:`max-w-56 whitespace-normal font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`4FltCB`})}),(0,Z.jsx)(ya,{}),(0,Z.jsx)(ca,{onSelect:()=>void Ve(e,`project`),children:(0,Z.jsx)(Y,{id:`e0NrBM`})}),(0,Z.jsx)(ca,{onSelect:()=>void Ve(e,`global`),children:(0,Z.jsx)(Y,{id:`2GT3Hf`})})]})]}),(0,Z.jsx)(ya,{}),(0,Z.jsx)(su,{absolutePath:a}),(0,Z.jsxs)(ca,{onSelect:()=>void _r(a).then(()=>Dc.success(C({id:`SXCSQd`})),()=>Dc.error(C({id:`cRHuuI`}))),children:[(0,Z.jsx)(Fn,{"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`zd00pH`})]}),(0,Z.jsx)(ya,{}),(0,Z.jsx)(H8,{scope:r,name:e.name,pinned:x(r,e.name),onToggle:S})]})}else{let e=L(n);if(!e)return null;if(e.managed){if(n.sub!==null)return null;i=(0,Z.jsx)(iu,{skill:e,actions:m,beforeDelete:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ya,{}),(0,Z.jsx)(H8,{scope:r,name:e.name,pinned:x(r,e.name),onToggle:S})]})})}else i=n.sub===null||n.sub===`SKILL.md`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($l,{skill:e,actions:m,existingNames:p[e.scope]}),(0,Z.jsx)(ya,{}),(0,Z.jsx)(H8,{scope:r,name:e.name,pinned:x(r,e.name),onToggle:S})]}):n.isDir?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(ca,{onSelect:()=>m.requestFileCreate(e,`${n.sub}/`),children:[(0,Z.jsx)(yr,{"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`HdkSiO`})]}),(0,Z.jsx)(ya,{}),(0,Z.jsx)(Kl,{skill:e,filePath:n.sub,actions:m})]}):(0,Z.jsx)(Kl,{skill:e,filePath:n.sub,actions:m})}}return(0,Z.jsxs)(va,{open:!0,modal:!1,onOpenChange:e=>{e||t.close({restoreFocus:!1})},children:[(0,Z.jsx)(fa,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),(0,Z.jsx)(ga,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:i})]})},t[178]=C,t[179]=m,t[180]=Ue,t[181]=Ie,t[182]=z,t[183]=Ve,t[184]=p,t[185]=l,t[186]=x,t[187]=d,t[188]=Ae,t[189]=b,t[190]=y,t[191]=_,t[192]=S,t[193]=W,t[194]=f,t[195]=s,t[196]=L,t[197]=H,t[198]=Et):Et=t[198];let Dt;t[199]!==we||t[200]!==D||t[201]!==Tt||t[202]!==Et||t[203]!==V?(Dt=(0,Z.jsx)(F6,{model:we,hostRef:T,ready:D,className:`min-h-0`,style:Tt,sizeToContent:!0,titleForPath:V,renderContextMenu:Et}),t[199]=we,t[200]=D,t[201]=Tt,t[202]=Et,t[203]=V,t[204]=Dt):Dt=t[204];let Ot;return t[205]!==xt||t[206]!==wt||t[207]!==Dt?(Ot=(0,Z.jsxs)(Z.Fragment,{children:[bt,xt,wt,Dt]}),t[205]=xt,t[206]=wt,t[207]=Dt,t[208]=Ot):Ot=t[208],Ot}function W8(e){return e.name}function G8(e){return!e.managed}function K8(e){return e.scope}function q8(e){return e!==void 0}function J8(e){return(0,Z.jsx)(`span`,{[Z6]:e,children:(0,Z.jsx)(wr,{host:e})},e)}function Y8(e){return e.name}function X8(e){return(e.target?.closest?.(`[data-item-path]`))?.getAttribute(`data-item-path`)??null}function Z8(e){return e!==void 0}function Q8(){}function $8(e){return Cr.includes(e)?e:`generic`}function e5(e){return e.skillDisplay===void 0?void 0:e.group===void 0?`${e.scopeLabel}/${e.skillDisplay}`:`${e.scopeLabel}/${e.group}/${e.skillDisplay}`}function t5(e){return`${e.name}:${[...e.hosts].sort().join(`,`)}`}function n5(e){let t=(0,$.c)(8),{skill:n,actions:r,onRunStart:i}=e,a=Er(n,r),o;t[0]!==r||t[1]!==n?(o=e=>r.requestForkResolve(n,e),t[0]=r,t[1]=n,t[2]=o):o=t[2];let s;return t[3]!==i||t[4]!==n||t[5]!==o||t[6]!==a?(s=(0,Z.jsx)(Tr,{toggles:a,skill:n,onResolveFork:o,onRunStart:i}),t[3]=i,t[4]=n,t[5]=o,t[6]=a,t[7]=s):s=t[7],s}function r5(){let e=(0,$.c)(2),{openTarget:t}=Et(),n;return e[0]===t?n=e[1]:(n=async(e,n,r)=>{let i=await Jm({name:e,home:n});if(!i.ok)return i;let a=r?.rel?vo(e,r.rel):i.docName;return t({kind:`doc`,target:a,docName:a},r?.replaceActive?{tabBehavior:`replace-active`}:void 0),rm(qp(a)),{ok:!0,docName:a}},e[0]=t,e[1]=n),n}var i5={project:`pinnedProjectSkills`,global:`pinnedGlobalSkills`};function a5(e,t){let n=e?.appearance?.sidebar?.[i5[t]];if(!Array.isArray(n))return new Set;let r=new Set;for(let e of n){if(typeof e!=`string`)continue;let t=e.trim();t&&r.add(t)}return r}function o5(e,t,n){let r=new Set(e);return n?r.add(t):r.delete(t),[...r].sort((e,t)=>e.localeCompare(t,void 0,{numeric:!0}))}var s5=(0,Q.lazy)(()=>n(()=>import(`./ImportSkillDialog-C5f6Lj0b.js`).then(e=>({default:e.ImportSkillDialog})),__vite__mapDeps([217,1,28,2,3,29,30,31,32,33,37,7,8,9,90,43,44,11,12,13,45,40,14,15,42,18,19,17,91,21,92,24,10,16,20,131,132,41,46,71,72,73,74,75,76,77,78,79,80,81,82,83,66,84,85,86,87,88,89,4,5,23,93,94,25,34,56,57,58,95,68,61,96,97,98,64,65,99,100,55,59,60,62,101,102,103,26,104,105,106,107,35,108,109,110,111,112,113,114,115,140,141,218,168,157,147,154,215,180]),import.meta.url));function c5(e){let t=(0,$.c)(95),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{dockExpanded:r}=n,i=r===void 0?!1:r,a=Fh(),{openTarget:o,activeDocName:s,activeTarget:c,openTabs:l,activateTab:u}=Et(),{merged:d,userBinding:f,projectLocalBinding:p}=Fl(),m=d?.editor?.previewTabs??!0?`replace-active`:`append`,h=d?.appearance?.sidebar?.showSkillGroups??!0,g;t[2]===d?g=t[3]:(g=a5(d,`project`),t[2]=d,t[3]=g);let _;t[4]===d?_=t[5]:(_=a5(d,`global`),t[4]=d,t[5]=_);let v;t[6]!==g||t[7]!==_?(v={project:g,global:_},t[6]=g,t[7]=_,t[8]=v):v=t[8];let y=v,b=(e,t,n)=>{let r=e===`global`?f:p;if(r===null)return;let i=o5(y[e],t,n),a=r.patch({appearance:{sidebar:{[i5[e]]:i}}});a.ok||Dc.error(T(n?{id:`ybPMz3`,values:{name:t}}:{id:`2-3Mlu`,values:{name:t}}),{description:ss(a.error)})},x=Zf(),S=r5(),C=Jl(),{_:w}=Bn(),T=w,E=ih(),D=th(),O=(0,Q.useRef)(b),k;t[9]===b?k=t[10]:(k=()=>{O.current=b},t[9]=b,t[10]=k),(0,Q.useEffect)(k);let j=(0,Q.useRef)(y),M;t[11]===y?M=t[12]:(M=()=>{j.current=y},t[11]=y,t[12]=M),(0,Q.useEffect)(M);let N,P;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>Qc(e=>{let{name:t,fromScope:n,toScope:r}=e;j.current[n].has(t)&&(O.current(n,t,!1),O.current(r,t,!0))}),N=[],t[13]=N,t[14]=P):(N=t[13],P=t[14]),(0,Q.useEffect)(P,N);let F;t[15]!==a.data||t[16]!==a.status?(F=a.status===`ready`?a.data:[],t[15]=a.data,t[16]=a.status,t[17]=F):F=t[17];let I=F,L;t[18]===I?L=t[19]:(L=sh(I),t[18]=I,t[19]=L);let R=L,[z,B]=(0,Q.useState)(f5),{createBlank:V,creating:ee}=yC(),[H,U]=(0,Q.useState)(null),[W,G]=(0,Q.useState)(null),[te,ne]=(0,Q.useState)(null),re;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(re={},t[20]=re):re=t[20];let[K,ie]=(0,Q.useState)(re),q,ae;t[21]===i?(q=t[22],ae=t[23]):(q=()=>{if(!i)return;let e=!0,t=()=>{Hm().then(t=>{e&&(t.ok?ne(t.skills):(console.warn(`[skills-sidebar] listDetectedSkills failed:`,t),ne([])))})};t();let n=Gc(t);return()=>{e=!1,n()}},ae=[i],t[21]=i,t[22]=q,t[23]=ae),(0,Q.useEffect)(q,ae);let oe;if(t[24]!==I){oe=new Set;let e=new Set;for(let t of I){let n=`${t.scope}:${t.name}`;e.has(n)&&oe.add(n),e.add(n)}t[24]=I,t[25]=oe}else oe=t[25];let se;t[26]===oe?se=t[27]:(se=e=>oe.has(`${e.scope}:${e.name}`)?e.hosts[0]:void 0,t[26]=oe,t[27]=se);let ce=se,le;t[28]===ce?le=t[29]:(le=e=>`${e.scope}:${e.name}:${ce(e)??``}`,t[28]=ce,t[29]=le);let ue=le,de;t[30]===ue?de=t[31]:(de=e=>[ue(e),(e.filePaths??[]).map(d5)],t[30]=ue,t[31]=de);let fe=Object.fromEntries(I.map(de)),pe=(0,Q.useRef)(null),J=(0,Q.useRef)(0),me=(0,Q.useRef)(!1),he,ge;if(t[32]===i?(he=t[33],ge=t[34]):(he=()=>{if(!i)return;let e=pe.current?.closest(p5);if(!e)return;let t=()=>{me.current||(J.current=e.scrollTop)};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},ge=[i],t[32]=i,t[33]=he,t[34]=ge),(0,Q.useEffect)(he,ge),!i)return null;let _e;t[35]!==o||t[36]!==m?(_e=e=>{o({kind:`doc`,target:e,docName:e},{tabBehavior:m}),Wp(qp(e))},t[35]=o,t[36]=m,t[37]=_e):_e=t[37];let ve=_e,ye;t[38]!==x||t[39]!==m?(ye=e=>{x(e.scope,e.name,{replaceActive:m===`replace-active`,...e.path?{path:e.path}:{},...e.hostQualifier===void 0?{}:{host:e.hostQualifier}})},t[38]=x,t[39]=m,t[40]=ye):ye=t[40];let be=ye,xe;t[41]!==u||t[42]!==l||t[43]!==o||t[44]!==m?(xe=e=>{if(e.flavor!==`explore`&&e.level){let t=A(l,e.flavor,e.name,e.subtitle??``,e.level);if(t){u(t),Wp(Yp(e));return}}o({kind:`skill-preview`,target:`${e.flavor}/${e.source}/${e.name}`,flavor:e.flavor,source:e.source,name:e.name,subtitle:e.subtitle,level:e.level,path:e.path},{tabBehavior:m}),Wp(Yp(e))},t[41]=u,t[42]=l,t[43]=o,t[44]=m,t[45]=xe):xe=t[45];let Se=xe,Ce;t[46]===Se?Ce=t[47]:(Ce=e=>{Se({flavor:`builtin`,source:rh(e.absolutePath??``),name:e.name,subtitle:``,level:e.scope})},t[46]=Se,t[47]=Ce);let we=Ce,Te;t[48]!==ce||t[49]!==ve||t[50]!==o||t[51]!==m?(Te=(e,t)=>{if(e.ignored===!0&&!e.managed){qf({scope:e.scope,name:e.name});return}let n=t.lastIndexOf(`.`),r=n>=0?t.slice(n+1).toLowerCase():``;if(!e.managed&&(r===`md`||r===`mdx`)){ve(hm(e,t));return}let i=ce(e);o({kind:`skill-file`,target:`${e.scope}/${e.name}${i?`:${i}`:``}/${t}`,scope:e.scope,name:e.name,path:t,...i?{host:i}:{}},{tabBehavior:m}),Wp(Zp({scope:e.scope,name:e.name,path:t,...i?{host:i}:{}}))},t[48]=ce,t[49]=ve,t[50]=o,t[51]=m,t[52]=Te):Te=t[52];let Ee=Te,De;t[53]===c?De=t[54]:(De=(e,t,n)=>c?.kind===`skill-preview`&&c.name===e&&c.level===t&&c.path===n,t[53]=c,t[54]=De);let Oe=De,ke;t[55]!==s||t[56]!==c||t[57]!==Oe?(ke=(e,t)=>{let n=t.slice(t.lastIndexOf(`.`)+1).toLowerCase();return!e.managed&&(n===`md`||n===`mdx`)?s===hm(e,t):c?.kind===`skill-file`&&c.scope===e.scope&&c.name===e.name&&c.path===t||Oe(e.name,e.scope,t)},t[55]=s,t[56]=c,t[57]=Oe,t[58]=ke):ke=t[58];let Ae=ke,je;t[59]!==s||t[60]!==c?.kind||t[61]!==Oe||t[62]!==l?(je=e=>A8({activeTargetKind:c?.kind,activeDocName:s,openTabs:l,docName:pm(e)})||Oe(e.name,e.scope),t[59]=s,t[60]=c?.kind,t[61]=Oe,t[62]=l,t[63]=je):je=t[63];let Me=je,Ne;t[64]===K?Ne=t[65]:(Ne=(e,t)=>{let n=k8(e);K[n]===void 0&&Ym({source:t,name:e.name}).then(e=>{e.ok&&ie(t=>({...t,[n]:e.files.map(u5)}))})},t[64]=K,t[65]=Ne);let Pe=Ne,Fe;t[66]!==T||t[67]!==Pe||t[68]!==Se||t[69]!==S||t[70]!==m?(Fe=(e,t)=>{let n=rh(e.files.skillMd);Pe(e,n);let r=t&&t!==`SKILL.md`?t:void 0,i=e.provenance.plugin===void 0?e.outsideProject?`foreign`:null:`detected`;if(i!==null){Se({flavor:i,source:n,name:e.name,subtitle:e.sourceHarness??``,level:So(e.provenance.scope),...r===void 0?{}:{path:t}});return}let a=m===`replace-active`;S(e.name,n,{replaceActive:a,rel:r}).then(t=>{t.ok||Dc.error(T({id:`lwCV5v`,values:{0:e.name,1:t.error}}))})},t[66]=T,t[67]=Pe,t[68]=Se,t[69]=S,t[70]=m,t[71]=Fe):Fe=t[71];let Ie=Fe,Le;t[72]===E?Le=t[73]:(Le=e=>[E[e],e],t[72]=E,t[73]=Le);let Re=new Map(oh.map(Le)),ze;t[74]!==s||t[75]!==Oe?(ze=e=>s===Yo(e.name)||Oe(e.name,So(e.provenance.scope)),t[74]=s,t[75]=Oe,t[76]=ze):ze=t[76];let{paths:Be,expanded:Ve,activePath:He,skillByPrefix:Ue,detectedByPrefix:We,groupByPrefix:Ge,pinnedPrefixes:Ke}=j8({skills:I,detected:te,scopeLabel:E,filesByKey:fe,detectedFilesById:K,userExpanded:z,hostQualifierOf:ce,rowKeyFor:ue,isSkillMdActive:Me,isFileActive:Ae,isDetectedActive:ze,showSkillGroups:h,pinnedByScope:y}),qe=w8(Re,We,Ge,Ue,Ke),Je;t[77]===I?Je=t[78]:(Je=I.map(l5).join(``),t[77]=I,t[78]=Je);let Ye=`${Je}|d${We.size}`,Xe=a.status===`loading`,Ze=`${Be.join(`|`)}::${Ye}::p${[...Ke].sort().join(`,`)}`,Qe;t[79]===Xe?Qe=t[80]:(Qe=Xe?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 text-muted-foreground text-xs`,"data-testid":`skills-loading`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(ip,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`VeVIIk`})]}):null,t[79]=Xe,t[80]=Qe);let $e=`keep::${Ze}`,et;t[81]===$e?et=t[82]:(et=(0,Z.jsx)(m5,{sectionRef:pe,lastScrollTopRef:J,restoringRef:me},$e),t[81]=$e,t[82]=et);let tt;t[83]===y?tt=t[84]:(tt=(e,t)=>y[e].has(t),t[83]=y,t[84]=tt);let nt,rt;t[85]===Symbol.for(`react.memo_cache_sentinel`)?(nt=e=>G(e),rt=(e,t)=>U({scope:e,tab:t}),t[85]=nt,t[86]=rt):(nt=t[85],rt=t[86]);let it;t[87]!==V||t[88]!==ee||t[89]!==R||t[90]!==W?(it=W===null?null:(0,Z.jsx)(N6,{open:!0,scope:W,existingNames:R[W],busy:ee,onOpenChange:e=>{e||G(null)},onCreate:e=>{let{name:t,description:n}=e,r=W;G(null),V(r,{name:t,description:n})}}),t[87]=V,t[88]=ee,t[89]=R,t[90]=W,t[91]=it):it=t[91];let at;return t[92]!==H||t[93]!==x?(at=H===null?null:(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(s5,{defaultScope:H.scope,defaultTab:H.tab,open:!0,onOpenChange:e=>{e||U(null)},onImported:e=>{let{scope:t,name:n}=e;U(null),x(t,n)}})}),t[92]=H,t[93]=x,t[94]=at):at=t[94],(0,Z.jsxs)(YL,{ref:pe,className:`px-0`,children:[(0,Z.jsxs)(ZL,{children:[Qe,et,(0,Z.jsx)(U8,{paths:Be,activePath:He,initialExpandedPaths:Ve,onExpandedChange:B,sort:qe,pinnedPrefixes:Ke,isPinned:tt,onTogglePin:b,skillByPrefix:Ue,detectedByPrefix:We,groupByPrefix:Ge,labelToScope:Re,scopeDescription:D,existingNames:R,actions:C,onOpenSkillMd:be,onOpenFile:Ee,onOpenDetected:Ie,onOpenManaged:we,onNewSkill:nt,onAddSkill:rt},Ze)]}),it,C.dialogs,at]})}function l5(e){return`${+!!e.installed}`}function u5(e){return e.relPath}function d5(e){return{path:e}}function f5(){return new Set}var p5=`[data-slot="collapsible-content"]`;function m5(e){let t=(0,$.c)(5),{sectionRef:n,lastScrollTopRef:r,restoringRef:i}=e,a,o;return t[0]!==r||t[1]!==i||t[2]!==n?(a=()=>{let e=r.current;if(e<=0)return;let t=n.current?.closest(p5);if(!t)return;i.current=!0;let a=Date.now()+1e3,o=0,s=()=>{if(t.scrollHeight-t.clientHeight>=e){t.scrollTop=e,i.current=!1;return}if(Date.now()<a){o=requestAnimationFrame(s);return}r.current=Math.min(e,Math.max(0,t.scrollHeight-t.clientHeight)),i.current=!1};return s(),()=>{cancelAnimationFrame(o),i.current=!1}},o=[n,r,i],t[0]=r,t[1]=i,t[2]=n,t[3]=a,t[4]=o):(a=t[3],o=t[4]),(0,Q.useLayoutEffect)(a,o),null}var h5=(0,Q.lazy)(()=>n(()=>import(`./ImportSkillDialog-C5f6Lj0b.js`).then(e=>({default:e.ImportSkillDialog})),__vite__mapDeps([217,1,28,2,3,29,30,31,32,33,37,7,8,9,90,43,44,11,12,13,45,40,14,15,42,18,19,17,91,21,92,24,10,16,20,131,132,41,46,71,72,73,74,75,76,77,78,79,80,81,82,83,66,84,85,86,87,88,89,4,5,23,93,94,25,34,56,57,58,95,68,61,96,97,98,64,65,99,100,55,59,60,62,101,102,103,26,104,105,106,107,35,108,109,110,111,112,113,114,115,140,141,218,168,157,147,154,215,180]),import.meta.url)),g5=32,_5=40;function v5(e){let t=(0,$.c)(64),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{filesOpen:r}=n,i=r===void 0?!0:r,{_:a}=Bn(),[o,s]=(0,Q.useState)(yt),[c,l]=(0,Q.useState)(rn),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),m=(0,Q.useRef)(null),{createBlank:h}=yC(),g=Zf(),_,v;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>St(s),v=[],t[2]=_,t[3]=v):(_=t[2],v=t[3]),(0,Q.useEffect)(_,v);let y=(0,Q.useRef)(c),b;t[4]===c?b=t[5]:(b=()=>{y.current=c},t[4]=c,t[5]=b),(0,Q.useEffect)(b);let x,S;t[6]===o?(x=t[7],S=t[8]):(x=()=>{let e=m.current;if(!o||e===null)return;let t=new ResizeObserver(()=>{if(y.current!==null)return;let t=e.getBoundingClientRect().height;t>0&&d(Math.round(t))});return t.observe(e),()=>t.disconnect()},S=[o],t[6]=o,t[7]=x,t[8]=S),(0,Q.useEffect)(x,S);let C;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(C=(e,t)=>{let n=ut(t+e,window.innerHeight);return l(n),n},t[9]=C):C=t[9];let w=C,T=(0,Q.useRef)(null),E;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(E=(e,t)=>{let n=t===void 0?{}:t;l(e),s(!1),Ke(!1),n.restoreFocus&&requestAnimationFrame(()=>T.current?.focus())},t[10]=E):E=t[10];let D=E,O;t[11]===c?O=t[12]:(O=e=>{if(e.button!==0)return;e.preventDefault();let t=e.clientY,n=m.current?.getBoundingClientRect().height??96,r=c,i=n,a=n,o=e=>{a=n+(t-e.clientY),i=w(t-e.clientY,n)},s=()=>{if(window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,s),a<96-_5){D(r);return}wn(i)};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s),window.addEventListener(`pointercancel`,s)},t[11]=c,t[12]=O);let k=O,A;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{s(e),Ke(e)},t[13]=A):A=t[13];let j=o&&!i?`flex-1`:`shrink-0`,M;t[14]===j?M=t[15]:(M=gr(`group/skills-dock flex min-h-0 flex-col`,j),t[14]=j,t[15]=M);let N;t[16]!==a||t[17]!==o||t[18]!==i||t[19]!==c||t[20]!==u||t[21]!==k?(N=o&&i?(0,Z.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,"aria-label":a({id:`txmRmK`}),"aria-valuenow":Math.max(96,c??u??0),"aria-valuemin":96,"aria-valuemax":typeof window>`u`?void 0:Tt(window.innerHeight),tabIndex:0,"data-testid":`skills-dock-resize`,className:`-mt-1 h-2 shrink-0 cursor-row-resize focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-ring [-webkit-app-region:no-drag]`,onPointerDown:k,onKeyDown:e=>{if(e.key!==`ArrowUp`&&e.key!==`ArrowDown`)return;e.preventDefault();let t=m.current?.getBoundingClientRect().height??96;if(e.key===`ArrowDown`&&t<=96){D(c,{restoreFocus:!0});return}wn(w(e.key===`ArrowUp`?g5:-g5,t))}}):null,t[16]=a,t[17]=o,t[18]=i,t[19]=c,t[20]=u,t[21]=k,t[22]=N):N=t[22];let P;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(Ku,{className:`size-4 shrink-0 text-tree-muted transition-transform group-data-[state=open]/skills-dock:rotate-90 motion-reduce:transition-none`}),t[23]=P):P=t[23];let F;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsxs)(Gr,{ref:T,className:`flex min-w-0 flex-1 items-center gap-1.5 text-muted-foreground hover:text-foreground`,children:[P,(0,Z.jsx)(`span`,{className:`truncate text-sm font-normal`,children:(0,Z.jsx)(Y,{id:`w7LRoP`})})]}),t[24]=F):F=t[24];let I;t[25]===a?I=t[26]:(I=a({id:`0pLDSn`}),t[25]=a,t[26]=I);let L;t[27]===a?L=t[28]:(L=a({id:`MdpSC1`}),t[27]=a,t[28]=L);let R;t[29]===h?R=t[30]:(R=()=>{s(!0),Ke(!0),h(`project`)},t[29]=h,t[30]=R);let z;t[31]!==L||t[32]!==R?(z=(0,Z.jsx)(y5,{icon:Fp,label:L,onClick:R,testId:`skills-dock-new`}),t[31]=L,t[32]=R,t[33]=z):z=t[33];let B;t[34]===a?B=t[35]:(B=a({id:`C3Zc44`}),t[34]=a,t[35]=B);let V;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>p(`skills-sh`),t[36]=V):V=t[36];let ee;t[37]===B?ee=t[38]:(ee=(0,Z.jsx)(y5,{icon:Ly,label:B,onClick:V,testId:`skills-dock-explore`}),t[37]=B,t[38]=ee);let H;t[39]!==I||t[40]!==z||t[41]!==ee?(H=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1.5`,children:[F,(0,Z.jsxs)(`div`,{role:`group`,"aria-label":I,"data-testid":`skills-dock-toolbar`,className:`flex items-center gap-0.5 opacity-0 transition-opacity group-focus-within/skills-dock:opacity-100 group-hover/skills-dock:opacity-100 motion-reduce:transition-none [&>*]:[-webkit-app-region:no-drag]`,children:[z,ee]})]}),t[39]=I,t[40]=z,t[41]=ee,t[42]=H):H=t[42];let U=i?`data-[state=open]:max-h-[70vh]`:`min-h-0 flex-1`,W;t[43]===U?W=t[44]:(W=gr(`overflow-auto subtle-scrollbar`,U),t[43]=U,t[44]=W);let G;t[45]!==i||t[46]!==c?(G=i?c===null?{maxHeight:`45vh`}:{height:c}:void 0,t[45]=i,t[46]=c,t[47]=G):G=t[47];let te;t[48]===o?te=t[49]:(te=(0,Z.jsx)(c5,{dockExpanded:o}),t[48]=o,t[49]=te);let ne;t[50]!==W||t[51]!==G||t[52]!==te?(ne=(0,Z.jsx)(Wr,{ref:m,className:W,style:G,children:te}),t[50]=W,t[51]=G,t[52]=te,t[53]=ne):ne=t[53];let re;t[54]!==f||t[55]!==g?(re=f===null?null:(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(h5,{defaultScope:`project`,defaultTab:f,open:!0,onOpenChange:e=>{e||p(null)},onImported:e=>{let{scope:t,name:n}=e;p(null),g(t,n)}})}),t[54]=f,t[55]=g,t[56]=re):re=t[56];let K;return t[57]!==o||t[58]!==M||t[59]!==N||t[60]!==H||t[61]!==ne||t[62]!==re?(K=(0,Z.jsxs)(Kr,{open:o,onOpenChange:A,className:M,"data-testid":`skills-dock`,children:[N,H,ne,re]}),t[57]=o,t[58]=M,t[59]=N,t[60]=H,t[61]=ne,t[62]=re,t[63]=K):K=t[63],K}function y5(e){let t=(0,$.c)(5),{icon:n,label:r,onClick:i,testId:a}=e,o;return t[0]!==n||t[1]!==r||t[2]!==i||t[3]!==a?(o=(0,Z.jsx)(M6,{icon:n,label:r,onClick:i,"data-testid":a}),t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o):o=t[4],o}var b5=`ok-skills-section-visible-v1`;function x5(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}var S5;function C5(){if(S5===void 0){let e=x5()?.getItem(b5)??null;S5=e===`true`?!0:e===`false`?!1:null}return S5}function w5(e){if(S5!==e){S5=e;try{x5()?.setItem(b5,e?`true`:`false`)}catch{}}}var T5=6e4,E5=e=>{let t=(0,$.c)(11),{href:n,label:r,icon:i}=e,a,o;t[0]===n?(a=t[1],o=t[2]):(a=e=>_h(e,n),o=e=>_h(e,n),t[0]=n,t[1]=a,t[2]=o);let s;t[3]===i?s=t[4]:(s=(0,Z.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),t[3]=i,t[4]=s);let c;return t[5]!==n||t[6]!==r||t[7]!==a||t[8]!==o||t[9]!==s?(c=(0,Z.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,onClick:a,onAuxClick:o,"aria-label":r,className:`rounded-md p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:s}),t[5]=n,t[6]=r,t[7]=a,t[8]=o,t[9]=s,t[10]=c):c=t[10],c};function D5(e){let t=(0,$.c)(34),{version:n,onOpenReleaseNotes:r,onClose:i,store:a,autoDismissMs:o}=e,s=a===void 0?EH:a,c=o===void 0?T5:o,{_:l}=Bn(),[u,d]=(0,Q.useState)(!1),f,p;t[0]!==c||t[1]!==i||t[2]!==u?(f=()=>{if(!u)return;let e=setTimeout(i,c);return()=>clearTimeout(e)},p=[u,i,c],t[0]=c,t[1]=i,t[2]=u,t[3]=f,t[4]=p):(f=t[3],p=t[4]),(0,Q.useEffect)(f,p);let m;t[5]===l?m=t[6]:(m=l({id:`GzPQ2f`}),t[5]=l,t[6]=m);let h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Y,{id:`yLEyuq`}),t[7]=h):h=t[7];let g;t[8]===s?g=t[9]:(g=()=>{s.markSubscribed(),d(!0)},t[8]=s,t[9]=g);let _;t[10]!==i||t[11]!==s?(_=()=>{s.dismiss(),i()},t[10]=i,t[11]=s,t[12]=_):_=t[12];let v;t[13]!==g||t[14]!==_?(v=(0,Z.jsx)(tH,{source:`post_update_card`,compactSubmit:!0,description:h,onSuccess:g,onDismiss:_}),t[13]=g,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==l||t[17]!==u?(y=u?null:(0,Z.jsxs)(`nav`,{"aria-label":l({id:`dbapvC`}),className:`mt-3 flex items-center gap-1.5 text-muted-foreground text-xs`,children:[(0,Z.jsx)(`span`,{className:`mr-0.5`,children:(0,Z.jsx)(Y,{id:`9sBe85`})}),(0,Z.jsx)(E5,{href:gH,label:l({id:`I7Exsw`}),icon:kH}),(0,Z.jsx)(E5,{href:mH,label:l({id:`zyKa-I`}),icon:Jx}),(0,Z.jsx)(E5,{href:hH,label:l({id:`36aWJD`}),icon:OH})]}),t[16]=l,t[17]=u,t[18]=y):y=t[18];let b;t[19]!==y||t[20]!==v?(b=(0,Z.jsxs)(gf,{children:[v,y]}),t[19]=y,t[20]=v,t[21]=b):b=t[21];let x;t[22]===n?x=t[23]:(x=(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`hLy8b1`,values:{version:n}})}),t[22]=n,t[23]=x);let S;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Y,{id:`_PACVa`}),t[24]=S):S=t[24];let C;t[25]===r?C=t[26]:(C=(0,Z.jsx)(X,{variant:`link`,size:`sm`,className:`h-auto p-0 text-muted-foreground text-xs hover:text-foreground`,onClick:r,children:S}),t[25]=r,t[26]=C);let w;t[27]!==x||t[28]!==C?(w=(0,Z.jsxs)(of,{className:`justify-between gap-2`,children:[x,C]}),t[27]=x,t[28]=C,t[29]=w):w=t[29];let T;return t[30]!==b||t[31]!==w||t[32]!==m?(T=(0,Z.jsx)(rf,{asChild:!0,size:`sm`,className:`mx-1 mb-1`,children:(0,Z.jsxs)(`section`,{"aria-label":m,children:[b,w]})}),t[30]=b,t[31]=w,t[32]=m,t[33]=T):T=t[33],T}function O5(e){let t=(0,$.c)(37),{notice:n,onDismiss:r}=e,{_:i}=Bn(),a=n.variant===`error`?`border-destructive/60 bg-sidebar-accent/30 text-muted-foreground`:n.variant===`success`?`border-emerald-500/40 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:`border-sidebar-border bg-sidebar-accent/30 text-muted-foreground`,o;t[0]!==i||t[1]!==n.dismissible||t[2]!==r?(o=n.dismissible===!1?null:(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground`,"aria-label":i({id:`GUYwCr`}),onClick:r,children:(0,Z.jsx)(zp,{"aria-hidden":`true`,className:`size-3`})}),t[0]=i,t[1]=n.dismissible,t[2]=r,t[3]=o):o=t[3];let s=o,c=`shrink-0 text-xs font-medium underline underline-offset-2 ${n.variant===`success`?`decoration-emerald-500/40`:`decoration-muted-foreground/40`} hover:text-sidebar-foreground hover:decoration-sidebar-foreground`;if(n.secondaryAction){let e=`update-notice-${n.id}`,r=`flex flex-col gap-2 rounded-md border px-2 py-2 text-xs ${a}`,i;t[4]===n.body?i=t[5]:(i=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[4]=n.body,t[5]=i);let o;t[6]!==s||t[7]!==i?(o=(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[i,s]}),t[6]=s,t[7]=i,t[8]=o):o=t[8];let l;t[9]!==c||t[10]!==n.action?(l=n.action?(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[9]=c,t[10]=n.action,t[11]=l):l=t[11];let u;t[12]===n.secondaryAction?u=t[13]:(u=()=>{n.secondaryAction?.onClick()},t[12]=n.secondaryAction,t[13]=u);let d;t[14]!==c||t[15]!==n.secondaryAction.label||t[16]!==u?(d=(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:u,children:n.secondaryAction.label}),t[14]=c,t[15]=n.secondaryAction.label,t[16]=u,t[17]=d):d=t[17];let f;t[18]!==l||t[19]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex gap-3 pl-1`,children:[l,d]}),t[18]=l,t[19]=d,t[20]=f):f=t[20];let p;return t[21]!==e||t[22]!==r||t[23]!==o||t[24]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":e,className:r,children:[o,f]}),t[21]=e,t[22]=r,t[23]=o,t[24]=f,t[25]=p):p=t[25],p}let l=`update-notice-${n.id}`,u=`flex items-center gap-2 rounded-md border px-2 py-1.5 text-xs ${a}`,d;t[26]===n.body?d=t[27]:(d=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[26]=n.body,t[27]=d);let f;t[28]!==c||t[29]!==n.action?(f=n.action?(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[28]=c,t[29]=n.action,t[30]=f):f=t[30];let p;return t[31]!==s||t[32]!==l||t[33]!==u||t[34]!==d||t[35]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":l,className:u,children:[d,f,s]}),t[31]=s,t[32]=l,t[33]=u,t[34]=d,t[35]=f,t[36]=p):p=t[36],p}function k5(e){if(e.length===0)return null;let t=e[0];if(!t)return null;for(let n=1;n<e.length;n++){let r=e[n];r&&r.priority<t.priority&&(t=r)}return t}function A5(){let e=(0,$.c)(15),t=(0,Q.useSyncExternalStore)(pW,fW,fW),n;e[0]===t?n=e[1]:(n=k5(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;if(r.combinedSubscribe&&r.whatsNew){let t;e[2]===r.action?t=e[3]:(t=()=>r.action?.onClick(),e[2]=r.action,e[3]=t);let n;e[4]===r.id?n=e[5]:(n=()=>dW(r.id),e[4]=r.id,e[5]=n);let i;return e[6]!==r.whatsNew.version||e[7]!==t||e[8]!==n?(i=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(D5,{version:r.whatsNew.version,onOpenReleaseNotes:t,onClose:n})}),e[6]=r.whatsNew.version,e[7]=t,e[8]=n,e[9]=i):i=e[9],i}let i;e[10]===r?i=e[11]:(i=()=>{r.onDismiss?.(),dW(r.id)},e[10]=r,e[11]=i);let a;return e[12]!==r||e[13]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(O5,{notice:r,onDismiss:i})}),e[12]=r,e[13]=i,e[14]=a):a=e[14],a}var j5={folderCount:0,expandedCount:0},M5=`button, [role="button"], [role="menuitem"], input, textarea, select, a[href]`;function N5(e){return typeof Element>`u`||!(e instanceof Element)?!1:e.closest(M5)!==null}function P5(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(om,{name:`file-sidebar`,children:(0,Z.jsx)(I5,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var F5=e=>{let t=(0,$.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({icon:n,label:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=(0,Z.jsx)(n,{"aria-hidden":`true`}),t[4]=n,t[5]=a);let o;t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(fa,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":r,...i,children:a})})}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9];let s;t[10]===r?s=t[11]:(s=(0,Z.jsx)(Vr,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(Ur,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c};function I5(e){let t=(0,$.c)(326),{onOpenSearch:n}=e,{_:r}=Bn(),[i,a]=(0,Q.useState)(null),{activeDocName:o,activeTarget:s}=Et(),c;t[0]!==o||t[1]!==s?(c=s?.kind===`folder`||s?.kind===`folder-index`?s.folderPath:xm(o),t[0]=o,t[1]=s,t[2]=c):c=t[2];let l=c,u;t[3]===l?u=t[4]:(u=wm(l)?``:l,t[3]=l,t[4]=u);let d=u,[f,p]=(0,Q.useState)(!1),m=f?``:d,h=typeof window<`u`&&window.okDesktop!=null,{state:g,toggleSidebar:_}=RL(),v=Be(),y=g===`expanded`,b=h&&g===`collapsed`,[x,S]=(0,Q.useState)(j5),C,w;t[5]===i?(C=t[6],w=t[7]):(C=()=>{if(i===null)return;let e=()=>{S(i.getFolderState()),p(i.isCreationTargetCleared())};return e(),i.subscribe(e)},w=[i],t[5]=i,t[6]=C,t[7]=w),(0,Q.useEffect)(C,w);let T,E;t[8]===i?(T=t[9],E=t[10]):(T=()=>{if(i!==null)return PO(e=>{let t=e.initialDir??``;if(e.template){i.createFromTemplate(e.template.folder,e.template.name);return}i.startCreating(e.kind??`file`,t)})},E=[i],t[8]=i,t[9]=T,t[10]=E),(0,Q.useEffect)(T,E);let D=x.folderCount>0,O=D&&x.expandedCount===x.folderCount,k=x.expandedCount===0,A=hf(``),j=hf(m===``?null:m),M=m===``?A:j,N=A.state.status===`ready`?(A.state.data.folder.templates_available?.length??0)>0:!0,P=M.state.status===`ready`?(M.state.data.folder.templates_available?.length??0)>0:!0,F=typeof window<`u`?window.okDesktop:void 0,I=gu(),L;t[11]!==r||t[12]!==I?.contentDir?(L=F?.config?.projectName||I?.contentDir.split(`/`).filter(Boolean).pop()||r({id:`sER-bs`}),t[11]=r,t[12]=I?.contentDir,t[13]=L):L=t[13];let R=L,{status:z}=xu(),B=z?.hasRemote===!0,V=Sr().states,{dispatch:ee}=Ll(),H;t[14]===I?H=t[15]:(H=du({workspace:I}),t[14]=I,t[15]=H);let U=H,W=jr(),G=Wa(),te=Ua(),ne=Za(),re=Cl(),{projectLocalBinding:K,merged:ie}=Fl(),q=ie?.appearance?.sidebar?.showHiddenFiles??!1,ae=ie?.appearance?.sidebar?.showOkFolders??!1,oe=ie?.appearance?.sidebar?.showOnlyMarkdownFiles??!1,se=ie?.appearance?.sidebar?.showSkillGroups??!0,[ce,le]=(0,Q.useState)(!0),ue,de;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(de=()=>Wk(()=>le(!0)),ue=[],t[16]=ue,t[17]=de):(ue=t[16],de=t[17]),(0,Q.useEffect)(de,ue);let fe=ie?.appearance?.sidebar?.showSkillsSection,pe;t[18]===fe?pe=t[19]:(pe=fe??C5()??!0,t[18]=fe,t[19]=pe);let J=pe,me,he;t[20]===fe?(me=t[21],he=t[22]):(me=()=>{fe!==void 0&&w5(fe)},he=[fe],t[20]=fe,t[21]=me,t[22]=he),(0,Q.useEffect)(me,he);let ge=D&&!O,_e=D&&!k,ve=ge||_e,ye=(0,Q.useRef)(!1),be;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(be=e=>{ye.current&&(ye.current=!1,e.preventDefault())},t[23]=be):be=t[23];let xe=be,Se=V5,Ce;t[24]!==i||t[25]!==I?(Ce=()=>{I&&(ye.current=!0,i?.startCreating(`file`,``))},t[24]=i,t[25]=I,t[26]=Ce):Ce=t[26];let we=Ce,Te;t[27]!==i||t[28]!==I?(Te=e=>{I&&(ye.current=!0,i?.createFromTemplate(``,e))},t[27]=i,t[28]=I,t[29]=Te):Te=t[29];let Ee=Te,De;t[30]!==i||t[31]!==I?(De=()=>{I&&(ye.current=!0,i?.startCreating(`folder`,``))},t[30]=i,t[31]=I,t[32]=De):De=t[32];let Oe=De,ke;t[33]===I?ke=t[34]:(ke=()=>{!I||!F||F.shell.showItemInFolder(I.contentDir)},t[33]=I,t[34]=ke);let Ae=ke,je;t[35]!==r||t[36]!==I?(je=async()=>{if(I)try{await navigator.clipboard.writeText(I.contentDir),Dc.success(r({id:`6_ZOw4`}),{description:I.contentDir})}catch(e){console.warn(`[FileSidebar] clipboard write failed:`,e),Dc.error(r({id:`vfRlCI`}))}},t[35]=r,t[36]=I,t[37]=je):je=t[37];let Me=je,Ne;t[38]!==r||t[39]!==B?(Ne=()=>{Hd({...Xd(``),hasRemote:B,onClickWhenNoRemote:()=>{Dc.error(r({id:`WyQxwa`}))}},{clipboardWrite:_r,toastSuccess:B5,toastError:z5,logEvent:R5})},t[38]=r,t[39]=B,t[40]=Ne):Ne=t[40];let Pe=Ne,Fe;t[41]!==r||t[42]!==K?(Fe=e=>{if(K===null)return;let t=K.patch({appearance:{sidebar:e}});t.ok||(console.warn(`[FileSidebar] sidebar visibility toggle rejected:`,ss(t.error)),Dc.error(r({id:`P47EWZ`}),{description:ss(t.error)}))},t[41]=r,t[42]=K,t[43]=Fe):Fe=t[43];let Ie=Fe,Le;t[44]===i?Le=t[45]:(Le=()=>{i?.expandAll()},t[44]=i,t[45]=Le);let Re=Le,ze;t[46]===i?ze=t[47]:(ze=()=>{i?.collapseAll()},t[46]=i,t[47]=ze);let Ve=ze,He,Ue;t[48]!==_e||t[49]!==ge||t[50]!==q||t[51]!==ae||t[52]!==oe||t[53]!==J||t[54]!==g?(He=()=>{let e={showHiddenFiles:q,showOkFolders:ae,showOnlyMarkdownFiles:oe,showSkillsSection:J,canExpandAll:ge,canCollapseAll:_e,sidebarVisible:g===`expanded`};el(e),F&&F.editor.notifyViewMenuStateChanged(e)},Ue=[F,q,ae,oe,J,ge,_e,g],t[48]=_e,t[49]=ge,t[50]=q,t[51]=ae,t[52]=oe,t[53]=J,t[54]=g,t[55]=He,t[56]=Ue):(He=t[55],Ue=t[56]),(0,Q.useEffect)(He,Ue);let We;t[57]!==r||t[58]!==s||t[59]!==ne||t[60]!==ee||t[61]!==G||t[62]!==V||t[63]!==m||t[64]!==Ie||t[65]!==te||t[66]!==q||t[67]!==ae||t[68]!==oe||t[69]!==J||t[70]!==re||t[71]!==W||t[72]!==_||t[73]!==i||t[74]!==I?(We=()=>fr(e=>{let t=s!==null&&wm(PR(s));switch(e){case`new-doc`:if(!I||!i)return;i.startCreating(`file`,m);return;case`new-folder`:if(!I||!i)return;i.startCreating(`folder`,m);return;case`new-from-template`:if(!I||!i)return;i.startCreatingFromTemplate(m);return;case`rename`:if(!s||t)return;WR(s);return;case`duplicate`:if(!s||t)return;KR(s);return;case`move-to-trash`:if(!s||t)return;HR(s);return;case`reveal-in-finder`:{if(!F||!I)return;let e=NR(s,I);F.shell.showItemInFolder(e);return}case`send-to-ai`:{let e=wl({sticky:re,effectiveThreadAgent:Ga(Al(te,G),ne),enabledClis:W===null?[]:Dl(G,W.installedClis),enabledDesktopTargets:Ml(G,V),unresolvedDesktopTargets:Sl(G,V),installedClis:W?.installedClis??{},terminalAvailable:W!==null,threadsAvailable:!0,desktopSelectable:!0});if(e.kind===`none`){Dc.error(r({id:`LKOLNn`}));return}let t=FR(s,I);if(!t)return;if(e.kind===`thread`){tu(t,{agent:{source:e.agent.source,id:e.agent.id}});return}if(e.kind===`cli`){W?.launchInTerminal(t,e.cli);return}if(e.kind===`terminal`)return;let n=qa.find(t=>t.id===e.target);if(!n)return;if(V[n.id]?.installed!==!0){Hl(n),Dc.info(r({id:`L1BQTH`,values:{0:n.displayName}}));return}ee(n.id,t);return}case`copy-full-path`:{if(!I)return;let e=NR(s,I);navigator.clipboard.writeText(e).then(()=>Dc.success(r({id:`6_ZOw4`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),Dc.error(r({id:`vfRlCI`}))});return}case`copy-relative-path`:{let e=PR(s);if(e===``){Dc.error(r({id:`74eHt-`}));return}navigator.clipboard.writeText(e).then(()=>Dc.success(r({id:`haHgQj`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),Dc.error(r({id:`5QGTaA`}))});return}case`toggle-show-ok-folders`:Ie({showOkFolders:!ae});return;case`toggle-show-hidden-files`:Ie({showHiddenFiles:!q});return;case`toggle-show-only-markdown-files`:Ie({showOnlyMarkdownFiles:!oe});return;case`toggle-show-skills-section`:Ie({showSkillsSection:!J});return;case`expand-all-tree`:i?.expandAll();return;case`collapse-all-tree`:i?.collapseAll();return;case`toggle-sidebar`:_();return;case`delete`:case`toggle-source`:case`save-version`:case`version-history`:case`focus-search`:case`focus-command-palette`:case`close-active-tab-or-window`:case`toggle-doc-panel`:return}}),t[57]=r,t[58]=s,t[59]=ne,t[60]=ee,t[61]=G,t[62]=V,t[63]=m,t[64]=Ie,t[65]=te,t[66]=q,t[67]=ae,t[68]=oe,t[69]=J,t[70]=re,t[71]=W,t[72]=_,t[73]=i,t[74]=I,t[75]=We):We=t[75];let Ge;t[76]!==r||t[77]!==s||t[78]!==ne||t[79]!==ee||t[80]!==G||t[81]!==V||t[82]!==m||t[83]!==K||t[84]!==te||t[85]!==q||t[86]!==ae||t[87]!==oe||t[88]!==J||t[89]!==re||t[90]!==W||t[91]!==_||t[92]!==i||t[93]!==I?(Ge=[F,i,I,s,m,K,q,ae,oe,J,V,ee,W,G,te,ne,re,_,r],t[76]=r,t[77]=s,t[78]=ne,t[79]=ee,t[80]=G,t[81]=V,t[82]=m,t[83]=K,t[84]=te,t[85]=q,t[86]=ae,t[87]=oe,t[88]=J,t[89]=re,t[90]=W,t[91]=_,t[92]=i,t[93]=I,t[94]=Ge):Ge=t[94],(0,Q.useEffect)(We,Ge);let Ke=h&&y&&`motion-safe:delay-100`,qe=b&&`opacity-0`,Je;t[95]!==Ke||t[96]!==qe?(Je=gr(`flex-row h-12 items-center py-0 pl-3 pr-2`,`justify-between`,h&&`overflow-x-clip`,h&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Ke,qe,h&&`[-webkit-app-region:drag]`),t[95]=Ke,t[96]=qe,t[97]=Je):Je=t[97];let Ye;t[98]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=h?(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`sidebar-traffic-light-reserve`,className:`w-[var(--ok-titlebar-reserve-left,0px)] shrink-0 self-stretch`}):null,t[98]=Ye):Ye=t[98];let Xe;t[99]===y?Xe=t[100]:(Xe=h&&y?(0,Z.jsx)(JH,{}):null,t[99]=y,t[100]=Xe);let Ze;t[101]===g?Ze=t[102]:(Ze=[g],t[101]=g,t[102]=Ze);let Qe;t[103]===n?Qe=t[104]:(Qe=(0,Z.jsx)(A6,{onClick:n}),t[103]=n,t[104]=Qe);let $e;t[105]!==Ze||t[106]!==Qe?($e=(0,Z.jsx)(pr,{fallbackRender:L5,onError:k6,resetKeys:Ze,children:Qe}),t[105]=Ze,t[106]=Qe,t[107]=$e):$e=t[107];let et;t[108]!==Xe||t[109]!==$e?(et=(0,Z.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-0.5 [&>*]:[-webkit-app-region:no-drag]`,children:[Xe,$e]}),t[108]=Xe,t[109]=$e,t[110]=et):et=t[110];let tt;t[111]!==Je||t[112]!==et?(tt=(0,Z.jsxs)(KL,{"data-electron-drag":h?``:void 0,className:Je,children:[Ye,et]}),t[111]=Je,t[112]=et,t[113]=tt):tt=t[113];let nt;t[114]===Symbol.for(`react.memo_cache_sentinel`)?(nt=(0,Z.jsx)(AU,{}),t[114]=nt):nt=t[114];let rt;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(rt=(0,Z.jsx)(Ku,{className:`size-4 shrink-0 text-tree-muted transition-transform group-data-[state=open]/files:rotate-90`}),t[115]=rt):rt=t[115];let it;t[116]===R?it=t[117]:(it=(0,Z.jsxs)(Gr,{"data-sidebar-root-context":!0,className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[rt,(0,Z.jsx)(`span`,{className:`truncate text-sm font-normal text-muted-foreground`,children:R})]}),t[116]=R,t[117]=it);let at;t[118]===r?at=t[119]:(at=r({id:`eaHUxx`}),t[118]=r,t[119]=at);let ot;t[120]===Symbol.for(`react.memo_cache_sentinel`)?(ot=gr(`flex items-center gap-0.5`,h&&`[&>*]:[-webkit-app-region:no-drag]`),t[120]=ot):ot=t[120];let st;t[121]===r?st=t[122]:(st=r({id:`Rq1vFD`}),t[121]=r,t[122]=st);let ct;t[123]===st?ct=t[124]:(ct=(0,Z.jsx)(F5,{icon:ib,label:st}),t[123]=st,t[124]=ct);let lt;t[125]!==ge||t[126]!==i?(lt=ge?(0,Z.jsxs)(ca,{onSelect:()=>i?.expandAll(),children:[(0,Z.jsx)(Bb,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`OlAl5i`})]}):null,t[125]=ge,t[126]=i,t[127]=lt):lt=t[127];let ut;t[128]!==_e||t[129]!==i?(ut=_e?(0,Z.jsxs)(ca,{onSelect:()=>i?.collapseAll(),children:[(0,Z.jsx)(qy,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`qvWGzP`})]}):null,t[128]=_e,t[129]=i,t[130]=ut):ut=t[130];let dt;t[131]===ve?dt=t[132]:(dt=ve?(0,Z.jsx)(ya,{}):null,t[131]=ve,t[132]=dt);let ft;t[133]===r?ft=t[134]:(ft=r({id:`8vETh9`}),t[133]=r,t[134]=ft);let pt;t[135]===Symbol.for(`react.memo_cache_sentinel`)?(pt=(0,Z.jsx)(ma,{children:(0,Z.jsx)(Y,{id:`8vETh9`})}),t[135]=pt):pt=t[135];let mt;t[136]===Ie?mt=t[137]:(mt=e=>Ie({showHiddenFiles:e}),t[136]=Ie,t[137]=mt);let ht=K===null,gt;t[138]===Symbol.for(`react.memo_cache_sentinel`)?(gt=(0,Z.jsx)(Y,{id:`6KCH4m`}),t[138]=gt):gt=t[138];let _t;t[139]!==q||t[140]!==mt||t[141]!==ht?(_t=(0,Z.jsx)(pa,{checked:q,onCheckedChange:mt,disabled:ht,"data-testid":`tree-options-show-hidden-files`,children:gt}),t[139]=q,t[140]=mt,t[141]=ht,t[142]=_t):_t=t[142];let vt;t[143]===Ie?vt=t[144]:(vt=e=>Ie({showOkFolders:e}),t[143]=Ie,t[144]=vt);let yt=K===null,bt;t[145]===Symbol.for(`react.memo_cache_sentinel`)?(bt=(0,Z.jsx)(Y,{id:`ELYtNJ`}),t[145]=bt):bt=t[145];let xt;t[146]!==ae||t[147]!==vt||t[148]!==yt?(xt=(0,Z.jsx)(pa,{checked:ae,onCheckedChange:vt,disabled:yt,"data-testid":`tree-options-show-ok-folders`,children:bt}),t[146]=ae,t[147]=vt,t[148]=yt,t[149]=xt):xt=t[149];let St;t[150]===Ie?St=t[151]:(St=e=>Ie({showOnlyMarkdownFiles:e}),t[150]=Ie,t[151]=St);let Ct=K===null,wt;t[152]===Symbol.for(`react.memo_cache_sentinel`)?(wt=(0,Z.jsx)(Y,{id:`5-o4kO`}),t[152]=wt):wt=t[152];let Tt;t[153]!==oe||t[154]!==St||t[155]!==Ct?(Tt=(0,Z.jsx)(pa,{checked:oe,onCheckedChange:St,disabled:Ct,"data-testid":`tree-options-show-only-markdown-files`,children:wt}),t[153]=oe,t[154]=St,t[155]=Ct,t[156]=Tt):Tt=t[156];let Dt;t[157]===Ie?Dt=t[158]:(Dt=e=>Ie({showSkillsSection:e}),t[157]=Ie,t[158]=Dt);let Ot=K===null,kt;t[159]===Symbol.for(`react.memo_cache_sentinel`)?(kt=(0,Z.jsx)(Y,{id:`w7LRoP`}),t[159]=kt):kt=t[159];let At;t[160]!==J||t[161]!==Dt||t[162]!==Ot?(At=(0,Z.jsx)(pa,{checked:J,onCheckedChange:Dt,disabled:Ot,"data-testid":`tree-options-show-skills`,children:kt}),t[160]=J,t[161]=Dt,t[162]=Ot,t[163]=At):At=t[163];let jt;t[164]!==ft||t[165]!==_t||t[166]!==xt||t[167]!==Tt||t[168]!==At?(jt=(0,Z.jsxs)(da,{"aria-label":ft,children:[pt,_t,xt,Tt,At]}),t[164]=ft,t[165]=_t,t[166]=xt,t[167]=Tt,t[168]=At,t[169]=jt):jt=t[169];let Mt;t[170]!==Ie||t[171]!==K||t[172]!==se||t[173]!==J?(Mt=J?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ya,{}),(0,Z.jsx)(pa,{checked:se,onCheckedChange:e=>Ie({showSkillGroups:e}),disabled:K===null,"data-testid":`tree-options-group-skills`,children:(0,Z.jsx)(Y,{id:`QPWyTw`})})]}):null,t[170]=Ie,t[171]=K,t[172]=se,t[173]=J,t[174]=Mt):Mt=t[174];let Nt;t[175]!==lt||t[176]!==ut||t[177]!==dt||t[178]!==jt||t[179]!==Mt?(Nt=(0,Z.jsxs)(ga,{align:`end`,className:`min-w-52`,"data-testid":`tree-options-menu`,children:[lt,ut,dt,jt,Mt]}),t[175]=lt,t[176]=ut,t[177]=dt,t[178]=jt,t[179]=Mt,t[180]=Nt):Nt=t[180];let Pt;t[181]!==ct||t[182]!==Nt?(Pt=(0,Z.jsxs)(va,{children:[ct,Nt]}),t[181]=ct,t[182]=Nt,t[183]=Pt):Pt=t[183];let Ft;t[184]===r?Ft=t[185]:(Ft=r({id:`HdkSiO`}),t[184]=r,t[185]=Ft);let It;t[186]!==m||t[187]!==i?(It=()=>i?.startCreating(`file`,m),t[186]=m,t[187]=i,t[188]=It):It=t[188];let Lt;t[189]!==Ft||t[190]!==It?(Lt=(0,Z.jsx)(M6,{icon:Fp,label:Ft,onClick:It,shortcutId:`new-item`}),t[189]=Ft,t[190]=It,t[191]=Lt):Lt=t[191];let Rt;t[192]!==r||t[193]!==P||t[194]!==m||t[195]!==i?(Rt=P?(0,Z.jsxs)(va,{children:[(0,Z.jsx)(F5,{icon:yr,label:r({id:`Uuj_R4`})}),(0,Z.jsx)(ga,{align:`end`,className:`min-w-52`,onCloseAutoFocus:xe,children:(0,Z.jsx)(MR,{parentDir:m,onSelectTemplate:e=>{ye.current=!0,i?.createFromTemplate(m,e)},ItemComponent:ca})})]}):null,t[192]=r,t[193]=P,t[194]=m,t[195]=i,t[196]=Rt):Rt=t[196];let zt;t[197]===r?zt=t[198]:(zt=r({id:`96G6Re`}),t[197]=r,t[198]=zt);let Bt;t[199]!==m||t[200]!==i?(Bt=()=>i?.startCreating(`folder`,m),t[199]=m,t[200]=i,t[201]=Bt):Bt=t[201];let Vt;t[202]!==zt||t[203]!==Bt?(Vt=(0,Z.jsx)(M6,{icon:Yy,label:zt,onClick:Bt,shortcutId:h?`new-folder`:void 0}),t[202]=zt,t[203]=Bt,t[204]=Vt):Vt=t[204];let Ht;t[205]!==at||t[206]!==Pt||t[207]!==Lt||t[208]!==Rt||t[209]!==Vt?(Ht=(0,Z.jsxs)(`div`,{role:`group`,"aria-label":at,"data-testid":`sidebar-toolbar`,className:ot,children:[Pt,Lt,Rt,Vt]}),t[205]=at,t[206]=Pt,t[207]=Lt,t[208]=Rt,t[209]=Vt,t[210]=Ht):Ht=t[210];let Ut;t[211]!==it||t[212]!==Ht?(Ut=(0,Z.jsxs)(XL,{className:`shrink-0 gap-1 rounded-none`,children:[it,Ht]}),t[211]=it,t[212]=Ht,t[213]=Ut):Ut=t[213];let Wt;t[214]===Symbol.for(`react.memo_cache_sentinel`)?(Wt=(0,Z.jsx)(Wr,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:(0,Z.jsx)(r3,{ref:a})}),t[214]=Wt):Wt=t[214];let Gt;t[215]===Ut?Gt=t[216]:(Gt=(0,Z.jsxs)(YL,{className:`min-h-0 flex-1 px-0`,children:[Ut,Wt]}),t[215]=Ut,t[216]=Gt);let Kt;t[217]!==ce||t[218]!==Gt?(Kt=(0,Z.jsx)(Kr,{open:ce,onOpenChange:le,className:`group/files flex min-h-0 flex-col data-[state=open]:min-h-48 data-[state=open]:flex-1`,children:Gt}),t[217]=ce,t[218]=Gt,t[219]=Kt):Kt=t[219];let qt;t[220]!==ce||t[221]!==J?(qt=J?(0,Z.jsx)(v5,{filesOpen:ce}):null,t[220]=ce,t[221]=J,t[222]=qt):qt=t[222];let Jt;t[223]!==Kt||t[224]!==qt?(Jt=(0,Z.jsxs)(JL,{children:[nt,Kt,qt]}),t[223]=Kt,t[224]=qt,t[225]=Jt):Jt=t[225];let Yt;t[226]===Symbol.for(`react.memo_cache_sentinel`)?(Yt=(0,Z.jsxs)(qL,{className:`px-0`,children:[(0,Z.jsx)(Z3,{}),(0,Z.jsx)(A5,{}),(0,Z.jsx)(qW,{}),typeof window<`u`&&window.okDesktop?(0,Z.jsx)(QL,{children:(0,Z.jsx)($L,{children:(0,Z.jsx)(b6,{bridge:window.okDesktop})})}):null]}),t[226]=Yt):Yt=t[226];let Xt=!(v&&g===`collapsed`),Zt;t[227]===Xt?Zt=t[228]:(Zt=(0,Z.jsx)(WL,{enableToggle:!1,enableDrag:Xt}),t[227]=Xt,t[228]=Zt);let Qt;t[229]!==tt||t[230]!==Jt||t[231]!==Zt?(Qt=(0,Z.jsx)(ta,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`contents`,onContextMenu:Se,children:[tt,Jt,Yt,Zt]})}),t[229]=tt,t[230]=Jt,t[231]=Zt,t[232]=Qt):Qt=t[232];let $t=!I,en,tn;t[233]===Symbol.for(`react.memo_cache_sentinel`)?(en=(0,Z.jsx)(Fp,{"aria-hidden":`true`}),tn=(0,Z.jsx)(Y,{id:`HdkSiO`}),t[233]=en,t[234]=tn):(en=t[233],tn=t[234]);let nn;t[235]!==we||t[236]!==$t?(nn=(0,Z.jsxs)(Zi,{disabled:$t,onSelect:we,"data-testid":`empty-space-menu-new-file`,children:[en,tn]}),t[235]=we,t[236]=$t,t[237]=nn):nn=t[237];let rn;t[238]!==Ee||t[239]!==N||t[240]!==I?(rn=N?(0,Z.jsxs)(Qi,{children:[(0,Z.jsxs)(ia,{disabled:!I,"data-testid":`empty-space-menu-new-from-template`,children:[(0,Z.jsx)(yr,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`Uuj_R4`})]}),(0,Z.jsx)($i,{children:(0,Z.jsx)(MR,{parentDir:``,onSelectTemplate:Ee,ItemComponent:Zi})})]}):null,t[238]=Ee,t[239]=N,t[240]=I,t[241]=rn):rn=t[241];let an=!I,on,sn;t[242]===Symbol.for(`react.memo_cache_sentinel`)?(on=(0,Z.jsx)(Yy,{"aria-hidden":`true`}),sn=(0,Z.jsx)(Y,{id:`96G6Re`}),t[242]=on,t[243]=sn):(on=t[242],sn=t[243]);let cn;t[244]!==Oe||t[245]!==an?(cn=(0,Z.jsxs)(Zi,{disabled:an,onSelect:Oe,"data-testid":`empty-space-menu-new-folder`,children:[on,sn]}),t[244]=Oe,t[245]=an,t[246]=cn):cn=t[246];let ln;t[247]===Symbol.for(`react.memo_cache_sentinel`)?(ln=(0,Z.jsx)(sa,{}),t[247]=ln):ln=t[247];let un;t[248]!==r||t[249]!==Ae||t[250]!==I?(un=F?(0,Z.jsxs)(Zi,{disabled:!I,onSelect:Ae,"data-testid":`empty-space-menu-reveal-in-finder`,"aria-label":I?Rg(F.platform):r({id:`NcUznW`,values:{0:Rg(F.platform)}}),children:[(0,Z.jsx)(Wf,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:Rg(F.platform)}),I?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`wTcjov`})})]}):null,t[248]=r,t[249]=Ae,t[250]=I,t[251]=un):un=t[251];let dn;t[252]!==ee||t[253]!==U||t[254]!==V?(dn=(0,Z.jsx)(au,{input:U,installStates:V,dispatch:ee}),t[252]=ee,t[253]=U,t[254]=V,t[255]=dn):dn=t[255];let fn;t[256]!==Pe||t[257]!==B?(fn=B?(0,Z.jsxs)(Zi,{onSelect:Pe,"data-testid":`empty-space-menu-share`,children:[(0,Z.jsx)(Na,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`Z8lGw6`})]}):null,t[256]=Pe,t[257]=B,t[258]=fn):fn=t[258];let pn=!I,mn;t[259]!==r||t[260]!==I?(mn=r(I?{id:`Up2_7p`}:{id:`U8CD-l`}),t[259]=r,t[260]=I,t[261]=mn):mn=t[261];let hn;t[262]===Symbol.for(`react.memo_cache_sentinel`)?(hn=(0,Z.jsx)(Fn,{"aria-hidden":`true`}),t[262]=hn):hn=t[262];let gn;t[263]===Symbol.for(`react.memo_cache_sentinel`)?(gn=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`Up2_7p`})}),t[263]=gn):gn=t[263];let _n;t[264]===I?_n=t[265]:(_n=I?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`wTcjov`})}),t[264]=I,t[265]=_n);let vn;t[266]!==Me||t[267]!==pn||t[268]!==mn||t[269]!==_n?(vn=(0,Z.jsxs)(Zi,{disabled:pn,onSelect:Me,"data-testid":`empty-space-menu-copy-full-path`,"aria-label":mn,children:[hn,gn,_n]}),t[266]=Me,t[267]=pn,t[268]=mn,t[269]=_n,t[270]=vn):vn=t[270];let yn;t[271]===Symbol.for(`react.memo_cache_sentinel`)?(yn=(0,Z.jsx)(sa,{}),t[271]=yn):yn=t[271];let bn;t[272]===Ie?bn=t[273]:(bn=e=>Ie({showHiddenFiles:e}),t[272]=Ie,t[273]=bn);let xn=K===null,Sn;t[274]===Symbol.for(`react.memo_cache_sentinel`)?(Sn=(0,Z.jsx)(Y,{id:`XcGbim`}),t[274]=Sn):Sn=t[274];let Cn;t[275]!==q||t[276]!==bn||t[277]!==xn?(Cn=(0,Z.jsx)(Xi,{checked:q,onCheckedChange:bn,disabled:xn,"data-testid":`empty-space-menu-show-hidden-files`,children:Sn}),t[275]=q,t[276]=bn,t[277]=xn,t[278]=Cn):Cn=t[278];let wn;t[279]===Ie?wn=t[280]:(wn=e=>Ie({showOkFolders:e}),t[279]=Ie,t[280]=wn);let Tn=K===null,En;t[281]===Symbol.for(`react.memo_cache_sentinel`)?(En=(0,Z.jsx)(Y,{id:`GHsJb8`}),t[281]=En):En=t[281];let Dn;t[282]!==ae||t[283]!==wn||t[284]!==Tn?(Dn=(0,Z.jsx)(Xi,{checked:ae,onCheckedChange:wn,disabled:Tn,"data-testid":`empty-space-menu-show-ok-folders`,children:En}),t[282]=ae,t[283]=wn,t[284]=Tn,t[285]=Dn):Dn=t[285];let On;t[286]===Ie?On=t[287]:(On=e=>Ie({showOnlyMarkdownFiles:e}),t[286]=Ie,t[287]=On);let kn=K===null,An;t[288]===Symbol.for(`react.memo_cache_sentinel`)?(An=(0,Z.jsx)(Y,{id:`WkTLN7`}),t[288]=An):An=t[288];let jn;t[289]!==oe||t[290]!==On||t[291]!==kn?(jn=(0,Z.jsx)(Xi,{checked:oe,onCheckedChange:On,disabled:kn,"data-testid":`empty-space-menu-show-only-markdown-files`,children:An}),t[289]=oe,t[290]=On,t[291]=kn,t[292]=jn):jn=t[292];let Mn;t[293]===Ie?Mn=t[294]:(Mn=e=>Ie({showSkillsSection:e}),t[293]=Ie,t[294]=Mn);let Nn=K===null,Pn;t[295]===Symbol.for(`react.memo_cache_sentinel`)?(Pn=(0,Z.jsx)(Y,{id:`WkyP2p`}),t[295]=Pn):Pn=t[295];let In;t[296]!==J||t[297]!==Mn||t[298]!==Nn?(In=(0,Z.jsx)(Xi,{checked:J,onCheckedChange:Mn,disabled:Nn,"data-testid":`empty-space-menu-show-skills-section`,children:Pn}),t[296]=J,t[297]=Mn,t[298]=Nn,t[299]=In):In=t[299];let Ln;t[300]===ve?Ln=t[301]:(Ln=ve?(0,Z.jsx)(sa,{}):null,t[300]=ve,t[301]=Ln);let Rn;t[302]!==Re||t[303]!==ge?(Rn=ge?(0,Z.jsxs)(Zi,{onSelect:Re,"data-testid":`empty-space-menu-expand-all`,children:[(0,Z.jsx)(Bb,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`OlAl5i`})]}):null,t[302]=Re,t[303]=ge,t[304]=Rn):Rn=t[304];let zn;t[305]!==Ve||t[306]!==_e?(zn=_e?(0,Z.jsxs)(Zi,{onSelect:Ve,"data-testid":`empty-space-menu-collapse-all`,children:[(0,Z.jsx)(qy,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`qvWGzP`})]}):null,t[305]=Ve,t[306]=_e,t[307]=zn):zn=t[307];let Vn;t[308]!==fn||t[309]!==vn||t[310]!==Cn||t[311]!==Dn||t[312]!==jn||t[313]!==In||t[314]!==Ln||t[315]!==Rn||t[316]!==zn||t[317]!==nn||t[318]!==rn||t[319]!==cn||t[320]!==un||t[321]!==dn?(Vn=(0,Z.jsxs)(ra,{className:`min-w-52`,onCloseAutoFocus:xe,children:[nn,rn,cn,ln,un,dn,fn,vn,yn,Cn,Dn,jn,In,Ln,Rn,zn]}),t[308]=fn,t[309]=vn,t[310]=Cn,t[311]=Dn,t[312]=jn,t[313]=In,t[314]=Ln,t[315]=Rn,t[316]=zn,t[317]=nn,t[318]=rn,t[319]=cn,t[320]=un,t[321]=dn,t[322]=Vn):Vn=t[322];let Hn;return t[323]!==Vn||t[324]!==Qt?(Hn=(0,Z.jsx)(HL,{variant:`inset`,children:(0,Z.jsxs)(ea,{children:[Qt,Vn]})}),t[323]=Vn,t[324]=Qt,t[325]=Hn):Hn=t[325],Hn}function L5(){return null}function R5(e){return console.log(e)}function z5(e){return Dc.error(e)}function B5(e){return Dc.success(e)}function V5(e){e.target instanceof Element&&e.target.closest(`[data-sidebar-root-context]`)!==null||N5(e.target)&&(e.preventDefault(),e.stopPropagation())}var H5=(0,Q.lazy)(()=>n(()=>import(`./McpConsentDialogBody-CTSqWNk2.js`),__vite__mapDeps([219,1,37,7,8,9,126,11,12,13,10,14,15,16,17,18,19,20,21,127,91,45,92,104,131,149,132,40,41,87,66,84,220,109,110,43,44,221,161]),import.meta.url));function U5(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(z_.subscribe,G5,W5))return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(H5,{})}),e[0]=t):t=e[0],t}function W5(){return!1}function G5(){return z_.getSnapshot()!==null}function K5(e,t){switch(e.kind){case`active-input`:xl(e.text,{newTab:e.newTab,submit:e.submit,target:e.target},t);return;case`agent-thread`:eu({agentSource:e.agentSource,agentId:e.agentId,prompt:e.prompt,docName:e.docName,titleHint:e.titleHint},t);return;case`terminal-launch`:_l(e.prompt,e.cli,{stage:e.stage},t);return;case`reveal-comments`:{if(e.scope===`queue`){Je();return}if(zt(`comments`,{},t),typeof window>`u`||t!==window)return;let n=qp(e.docName);tm(window.location.hash,n)||(window.location.hash=n);return}}}function q5(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(J5,t),null}function J5(){if($c())return;let e=window.okDesktop?.noteWindow?.onMainAction;if(typeof e==`function`)return e(Y5)}function Y5(e){return K5(e,window)}function X5(){let e=(0,$.c)(50),{_:t}=Bn(),n=(0,Q.useSyncExternalStore)(Gf,Xf),{openTarget:r}=Et(),{merged:i}=Fl(),a=n!==null,o;e[0]===a?o=e[1]:(o={enabled:a},e[0]=a,e[1]=o);let s=Fh(o),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(`.gitignore`),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),g=n?.scope,_=n?.name,v,y;if(e[2]!==_||e[3]!==g?(v=()=>{if(g===void 0||_===void 0){l(null);return}let e=!1;return h(null),Lm({name:_,scope:g}).then(t=>{if(!e){if(!t.ok){h(t.error);return}l(t.line),d(t.gitignorePath)}}),()=>{e=!0}},y=[g,_],e[2]=_,e[3]=g,e[4]=v,e[5]=y):(v=e[4],y=e[5]),(0,Q.useEffect)(v,y),!n)return null;let b;e[6]===f?b=e[7]:(b=()=>{f||Jf()},e[6]=f,e[7]=b);let x=b,S;e[8]===x?S=e[9]:(S=e=>!e&&x(),e[8]=x,e[9]=S);let C;e[10]===n.name?C=e[11]:(C=(0,Z.jsx)(Jr,{children:(0,Z.jsx)(Y,{id:`HwAKaw`,values:{0:n.name}})}),e[10]=n.name,e[11]=C);let w;e[12]===u?w=e[13]:(w=(0,Z.jsx)(qr,{children:(0,Z.jsx)(Y,{id:`Ehb_JP`,values:{gitignorePath:u}})}),e[12]=u,e[13]=w);let T;e[14]!==C||e[15]!==w?(T=(0,Z.jsxs)($r,{children:[C,w]}),e[14]=C,e[15]=w,e[16]=T):T=e[16];let E;e[17]!==u||e[18]!==m?(E=m!==null&&(0,Z.jsx)(`p`,{className:`text-destructive text-sm`,children:(0,Z.jsx)(Y,{id:`3MA3Hh`,values:{gitignorePath:u,previewError:m}})}),e[17]=u,e[18]=m,e[19]=E):E=e[19];let D;e[20]===c?D=e[21]:(D=c!==null&&(0,Z.jsx)(`pre`,{className:`overflow-x-auto rounded-md bg-muted px-3 py-2 font-mono text-sm`,children:c}),e[20]=c,e[21]=D);let O;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(Y,{id:`dEgA5A`}),e[22]=O):O=e[22];let k;e[23]===f?k=e[24]:(k=(0,Z.jsx)(Qr,{asChild:!0,children:(0,Z.jsx)(X,{variant:`outline`,disabled:f,children:O})}),e[23]=f,e[24]=k);let A=f||c===null,j;e[25]!==t||e[26]!==u||e[27]!==i?.editor?.previewTabs||e[28]!==r||e[29]!==n.name||e[30]!==n.scope||e[31]!==s?(j=async()=>{p(!0);let e=await Lm({name:n.name,scope:n.scope,apply:!0});if(p(!1),!e.ok){Dc.error(t({id:`F1yEaG`,values:{0:e.error,gitignorePath:u}}));return}Jf();let a=s.status===`ready`?s.data.find(e=>e.scope===n.scope&&e.name===n.name):void 0;if(a){let e=pm(a);r({kind:`doc`,target:e,docName:e},{tabBehavior:i?.editor?.previewTabs??!0?`replace-active`:`append`})}},e[25]=t,e[26]=u,e[27]=i?.editor?.previewTabs,e[28]=r,e[29]=n.name,e[30]=n.scope,e[31]=s,e[32]=j):j=e[32];let M;e[33]===u?M=e[34]:(M=(0,Z.jsx)(Y,{id:`cUagXn`,values:{gitignorePath:u}}),e[33]=u,e[34]=M);let N;e[35]!==A||e[36]!==j||e[37]!==M?(N=(0,Z.jsx)(X,{"data-testid":`skill-track-in-git-confirm`,disabled:A,onClick:j,children:M}),e[35]=A,e[36]=j,e[37]=M,e[38]=N):N=e[38];let P;e[39]!==k||e[40]!==N?(P=(0,Z.jsxs)(Zr,{children:[k,N]}),e[39]=k,e[40]=N,e[41]=P):P=e[41];let F;e[42]!==D||e[43]!==P||e[44]!==T||e[45]!==E?(F=(0,Z.jsxs)(Yr,{className:`sm:max-w-lg`,children:[T,E,D,P]}),e[42]=D,e[43]=P,e[44]=T,e[45]=E,e[46]=F):F=e[46];let I;return e[47]!==F||e[48]!==S?(I=(0,Z.jsx)(ei,{open:!0,onOpenChange:S,children:F}),e[47]=F,e[48]=S,e[49]=I):I=e[49],I}function Z5(){let e=(0,$.c)(17),t=tr(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=Et(),l;e[0]!==o||e[1]!==s||e[2]!==a||e[3]!==c||e[4]!==i?(l={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c},e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=i,e[5]=l):l=e[5];let u=(0,Q.useRef)(l),d;e[6]!==o||e[7]!==s||e[8]!==a||e[9]!==c||e[10]!==i?(d=()=>{u.current={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}},e[6]=o,e[7]=s,e[8]=a,e[9]=c,e[10]=i,e[11]=d):d=e[11],(0,Q.useEffect)(d);let f,p;return e[12]!==n||e[13]!==t||e[14]!==r?(f=()=>{if(n===null)return;let e=new Om,i=new Dm({url:n,name:os,document:e,onStateless:e=>{let{payload:t}=e;Fm(t,{onServerInfo:e=>{u.current.updateServerInstanceId(e.serverInstanceId),e.currentBranch!==void 0&&u.current.observeBranch(e.currentBranch)},onBranchSwitched:e=>{u.current.onBranchSwitched(e.branch)},onDiskAck:e=>{u.current.observeDiskAck(e.docName,e.sv),Wc(e.docName)},onDerivedView:r7,onConfigValidationRejected:n7,onConfigIgnoreNestedError:t7,onUnknown:e7})},onClose:$5,onDisconnect:Q5}),a=Xc(e=>{(e.includes(`files`)||e.includes(`backlinks`)||e.includes(`local-targets`))&&(t.invalidateQueries({queryKey:[`backlinks`]}),t.invalidateQueries({queryKey:[`forward-links`]})),(e.includes(`files`)||e.includes(`graph`))&&(t.invalidateQueries({queryKey:[`orphans`]}),t.invalidateQueries({queryKey:[`hubs`]})),e.includes(`lint-config`)&&ag()}),o=Pn(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{Yc([`files`,`backlinks`,`graph`,`local-targets`]),o()});let s=new Set,c=()=>{if(i.awareness)for(let[e,t]of i.awareness.getStates().entries())s.has(e)||t.user?.type===`agent`&&(s.add(e),console.warn(`[agent-presence] observed stale AwarenessUser.type === 'agent' from clientID ${e} — probably a stale bundled client`))};return i.awareness?.on(`change`,c),r(i),()=>{a(),i.awareness?.off(`change`,c),r(null),i.destroy(),e.destroy()}},p=[t,n,r],e[12]=n,e[13]=t,e[14]=r,e[15]=f,e[16]=p):(f=e[15],p=e[16]),(0,Q.useEffect)(f,p),null}function Q5(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function $5(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function e7(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function t7(e){nf(e)}function n7(e){ff(e)}function r7(e){Yc([e.ch])}var i7=500,a7=750,o7=1200,s7=3,c7=1500;function l7(e){return!e.startsWith(`__`)&&!/\.(mmd|mermaid)$/i.test(e)}async function u7(e){let t=await Td({kind:`project`},e);return e.aborted||t===null||t===`audit-superseded`?!1:(ld(t.files),!0)}function d7(){let e=(0,$.c)(13),{merged:t}=Fl(),n=t?.validation?.fileTreeIndicators!==!1,r=t?.validation?.links!==`off`,i,a;e[0]===r?(i=e[1],a=e[2]):(i=()=>wi(r),a=[r],e[0]=r,e[1]=i,e[2]=a),(0,Q.useLayoutEffect)(i,a);let o=Id()?.pages.size??0,s=(0,Q.useRef)(!1),c,l;e[3]===n?(c=e[4],l=e[5]):(c=()=>{if(!n)return;let e=new Map,t=!1,r=e=>{Ju({kind:`doc`,docName:e}).then(n=>{t||n===null||n===`audit-superseded`||wd(e,n.files.filter(t=>em(t.file)===e).flatMap(f7))})},i=Uc(t=>{if(!l7(t))return;let n=e.get(t);n!==void 0&&clearTimeout(n),e.set(t,setTimeout(()=>{e.delete(t),r(t)},i7))});return()=>{t=!0,i();for(let t of e.values())clearTimeout(t);e.clear()}},l=[n],e[3]=n,e[4]=c,e[5]=l),(0,Q.useEffect)(c,l);let u,d;e[6]===n?(u=e[7],d=e[8]):(u=()=>{if(!n)return;let e=null,t=null,r=()=>{t?.abort();let e=new AbortController;t=e,u7(e.signal).finally(()=>{t===e&&(t=null)})},i=()=>{e!==null&&clearTimeout(e),e=setTimeout(()=>{e=null,r()},a7)},a=[ng(i),Jc(i),Xc(e=>{qc(e)&&i()})];return()=>{for(let e of a)e();e!==null&&clearTimeout(e),t?.abort()}},d=[n],e[6]=n,e[7]=u,e[8]=d),(0,Q.useEffect)(u,d);let f,p;return e[9]!==n||e[10]!==o?(f=()=>{if(!n||o===0||s.current)return;let e=new AbortController,t=null,r=0,i=()=>{t=null,u7(e.signal).then(n=>{if(n){s.current=!0;return}if(!e.signal.aborted){if(r+=1,r>=s7){console.warn(`[audit] on-open audit exhausted retries; file-tree counts unavailable`);return}t=setTimeout(i,c7*2**(r-1))}})};return t=setTimeout(i,o7),()=>{t!==null&&clearTimeout(t),e.abort()}},p=[n,o],e[9]=n,e[10]=o,e[11]=f,e[12]=p):(f=e[11],p=e[12]),(0,Q.useEffect)(f,p),null}function f7(e){return e.diagnostics}function p7(e){let t=null,n=()=>{let n=e.hasAnyUnsyncedWork();n!==t&&(t=n,e.report({hasPendingWork:n,enabled:e.enabled}))};return n(),e.addUnsyncedWorkListener(n)}function m7(){let e=(0,$.c)(4),{collabUrl:t}=Et(),{projectConfig:n}=Fl(),r=n?.bridge?.backgroundThrottle?.enabled??!0,i,a;return e[0]!==t||e[1]!==r?(i=()=>{if(t===null)return;let e=window.okDesktop?.editor?.notifyBackgroundThrottle;if(typeof e!=`function`)return;let n=Kt(t);return p7({enabled:r,hasAnyUnsyncedWork:()=>n.hasAnyUnsyncedWork(),addUnsyncedWorkListener:e=>n.addUnsyncedWorkListener(e),report:t=>e(t)})},a=[t,r],e[0]=t,e[1]=r,e[2]=i,e[3]=a):(i=e[2],a=e[3]),(0,Q.useEffect)(i,a),null}function h7(e){let t=e.win??(typeof window<`u`?window:void 0),n=e.doc??(typeof document<`u`?document:void 0);if(t===void 0||n===void 0)return()=>{};let r=!1,i=()=>{r||(r=!0,e.onHide())},a=()=>i(),o=()=>{n.visibilityState===`hidden`?i():n.visibilityState===`visible`&&(r=!1,e.onVisible())};return t.addEventListener(`pagehide`,a),n.addEventListener(`visibilitychange`,o),()=>{t.removeEventListener(`pagehide`,a),n.removeEventListener(`visibilitychange`,o)}}function g7(){let e=(0,$.c)(4),{collabUrl:t}=Et(),{projectConfig:n}=Fl(),r=n?.bridge?.flushOnHide?.enabled??!0,i,a;return e[0]!==t||e[1]!==r?(i=()=>{if(t===null)return;let e=Kt(t);return e.setFlushOnHideEnabled(r),h7({onHide:()=>e.flushOnHide(),onVisible:()=>e.resyncOnVisible()})},a=[t,r],e[0]=t,e[1]=r,e[2]=i,e[3]=a):(i=e[2],a=e[3]),(0,Q.useEffect)(i,a),null}var _7=1e3,v7=3e4;function y7(e){let t=e.scheduler??{setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e)},n=e.initialBackoffMs??_7,r=e.maxBackoffMs??v7,i=e.rng??Math.random,a=e.createWebSocket??(e=>new WebSocket(e)),o=e.logger??null,s=e.log,c=null,l=null,u=!1,d=n;function f(e,t,n){try{o?o[e](t,n):s?.(t)}catch{}}function p(){if(u)return;l!==null&&t.clearTimeout(l);let e=d;d=Math.min(d*2,r);let n=i(),a=Math.max(1,Math.floor(e*(1-n/2)));f(`debug`,`scheduling reconnect`,{backoffMs:a,ceilMs:e}),l=t.setTimeout(()=>{l=null,m().catch(e=>f(`warn`,`reconnect failed`,{error:String(e)}))},a)}async function m(){if(u)return;let t;try{t=await e.resolveWsUrl()}catch(e){f(`warn`,`resolveWsUrl threw`,{error:String(e)}),p();return}if(!t){p();return}let r=[];e.pid!==void 0&&r.push(`pid=${encodeURIComponent(String(e.pid))}`),e.connectionId&&r.push(`connectionId=${encodeURIComponent(e.connectionId)}`),e.connectionId&&e.displayName!==void 0&&e.clientName!==void 0&&e.colorSeed!==void 0&&(r.push(`displayName=${encodeURIComponent(e.displayName)}`),r.push(`clientName=${encodeURIComponent(e.clientName)}`),r.push(`colorSeed=${encodeURIComponent(e.colorSeed)}`));let i=r.length>0?`?${r.join(`&`)}`:``,o=`${t}/collab/keepalive${i}`;try{c=a(o)}catch(e){f(`warn`,`WebSocket constructor failed`,{url:o,error:String(e)}),c=null,p();return}c.addEventListener(`open`,()=>{f(`info`,`connected`,{url:t}),d=n}),c.addEventListener(`close`,()=>{u||(f(`info`,`disconnected`,{url:t}),c=null,p())}),c.addEventListener(`error`,()=>{f(`debug`,`websocket error observed`,{url:t,readyState:c?.readyState,reason:`error-event`})})}return queueMicrotask(()=>{m().catch(e=>f(`warn`,`initial connect failed`,{error:String(e)}))}),{close:()=>{if(!u&&(u=!0,l!==null&&(t.clearTimeout(l),l=null),c)){try{c.close()}catch{}c=null}},isConnected:()=>c!==null&&c.readyState===1}}function b7(e){if(e)return e.replace(/\/collab\/?$/,``)}function x7(){return Im(window)!==null}function S7(e,t){let n=(0,$.c)(5),r=(0,Q.useRef)(e),i=(0,Q.useRef)(t),a,o;n[0]===e?(a=n[1],o=n[2]):(a=()=>{r.current=e},o=[e],n[0]=e,n[1]=a,n[2]=o),(0,Q.useEffect)(a,o);let s,c;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=i.current?.startKeepalive??y7;if((i.current?.isElectronHost??x7)())return;let t=e({resolveWsUrl:async()=>b7(r.current)});return()=>t.close()},c=[],n[3]=s,n[4]=c):(s=n[3],c=n[4]),(0,Q.useEffect)(s,c)}var C7=(0,Q.lazy)(()=>n(()=>import(`./ShareBranchSwitchDialog-DgKD1FWp.js`).then(e=>({default:e.ShareBranchSwitchDialog})),__vite__mapDeps([222,1,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,97,26,223,84,224,225,226,227,28,2,3,29,30,31,32,33,37]),import.meta.url)),w7=(0,Q.lazy)(()=>n(()=>import(`./ShareReceiveMissDialog-DX4YDzpC.js`).then(e=>({default:e.ShareReceiveMissDialog})),__vite__mapDeps([228,1,10,7,8,9,11,12,13,14,15,16,17,18,19,20,21,229,134,28,2,3,29,30,31,32,33,83,37,66,84,85,86,87,88,89,101,60,54,92,25,103,26,223,144,65,68,58]),import.meta.url)),T7=`#install-claude-desktop`,E7=/\.(md|mdx)$/i;function D7(e){return Rc(e)||e===T7}function O7(e,t){if(!E7.test(e))return null;for(let n of t){let t=ze(n);if(t.kind===`doc`&&t.docName===e)return{kind:`doc`,target:e,docName:e}}return null}function k7(e){switch(e.kind){case`skill-file`:case`skill-preview`:return e.path??null;case`doc`:case`folder-index`:case`folder`:case`asset`:case`skills`:case`large-file`:case`missing`:return null}}function A7(e,t,n,r){return[e,t,n,r].map(e=>[...e].sort().join(`\0`)).join(``)}function j7(){let e=(0,$.c)(33),{activeNewTabId:t,activeTabId:n,activeTarget:r,clearTarget:i,openTabs:a,syncOpenTabsWithKnownTargets:o,tabSessionLoaded:s}=Et(),{openTargetTransition:c}=qe();Xl();let{assetPaths:l,filePaths:u,folderPaths:d,loading:f,pageMeta:p,pages:m,pagesBySlug:h,pagesByBasename:g}=Nd(),{merged:_}=Fl(),v=_?.editor?.previewTabs??!0,y=(0,Q.useRef)(null),b=(0,Q.useRef)(null),x=(0,Q.useRef)(null),S;e[0]!==l||e[1]!==u||e[2]!==d||e[3]!==m?(S=A7(m,d,l,u),e[0]=l,e[1]=u,e[2]=d,e[3]=m,e[4]=S):S=e[4];let C=S,w;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(w=[],e[5]=w):w=e[5],(0,Q.useEffect)(N7,w);let T,E;e[6]!==l||e[7]!==u||e[8]!==d||e[9]!==f||e[10]!==m||e[11]!==o||e[12]!==s||e[13]!==C?(T=()=>{f||!s||y.current===C||(y.current=C,o({pages:m,folderPaths:d,assetPaths:l,filePaths:u}))},E=[l,u,d,f,m,o,s,C],e[6]=l,e[7]=u,e[8]=d,e[9]=f,e[10]=m,e[11]=o,e[12]=s,e[13]=C,e[14]=T,e[15]=E):(T=e[14],E=e[15]),(0,Q.useEffect)(T,E);let D;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(D=[],e[16]=D):D=e[16],(0,Q.useEffect)(M7,D);let O,k;return e[17]!==t||e[18]!==n||e[19]!==r||e[20]!==i||e[21]!==d||e[22]!==f||e[23]!==a||e[24]!==c||e[25]!==p||e[26]!==m||e[27]!==g||e[28]!==h||e[29]!==v||e[30]!==s?(O=()=>{if(!s&&window.okDesktop?.config.mode===`editor`)return;l(b.current);let e=function(e){b.current=Hp(e.state)?window.location.href:null},o=function(){let e=b.current;b.current=null,l(e)};function l(e){let o=e===window.location.href;im();let s=x.current===window.location.hash,l=()=>{x.current=window.location.hash},u=()=>{x.current=null},_=e=>{u(),!(Ue(e)===n&&r?.kind===e.kind&&r.target===e.target&&k7(r)===k7(e))&&c(e,{disposition:o?s4(v):`permanent`,consumeActiveNewTab:!0})};if(D7(window.location.hash))return;let y=Up(window.location.hash);if(y){let e=Go(y.split(`.`).pop()??``);am(`ok/nav/hash-change`,{docName:null,kind:`asset`}),_({kind:`asset`,target:y,assetPath:y,mediaKind:e});return}let b=Vp(window.location.hash);if(b){am(`ok/nav/hash-change`,{docName:null,kind:`skill-file`}),_({kind:`skill-file`,target:`${b.scope}/${b.name}${b.host?`:${b.host}`:``}/${b.path}`,scope:b.scope,name:b.name,path:b.path,...b.host?{host:b.host}:{}});return}if(nm(window.location.hash)){if(t!==null){l();return}if(s)return;am(`ok/nav/hash-change`,{docName:null,kind:`skills`}),c({kind:`skills`,target:`skills`});return}let S=Bp(window.location.hash);if(S){am(`ok/nav/hash-change`,{docName:null,kind:`skill-preview`}),_({kind:`skill-preview`,target:`${S.flavor}/${S.source}/${S.name}`,flavor:S.flavor,source:S.source,name:S.name,subtitle:S.subtitle,level:S.level,path:S.path});return}if(Jp(window.location.hash)){am(`ok/nav/hash-change`,{docName:null,kind:`folder`}),_({kind:`folder`,target:``,folderPath:``});return}let C=$p(window.location.hash);if(!C){if(t!==null){l();return}if(s)return;am(`ok/nav/hash-change`,{docName:null,kind:`clear`}),i();return}if(f){am(`ok/nav/hash-change`,{docName:C,kind:`deferred-loading`});return}let w=O7(C,a)??_m(C,{pages:m,folderPaths:d,pagesBySlug:h,pagesByBasename:g});if(w.kind===`missing`&&/\/+$/.test(C.trim())){am(`ok/nav/hash-change`,{docName:C,kind:`deferred-missing-folder`});return}let T=um(gm(w),p);am(`ok/nav/hash-change`,{docName:C,kind:T.kind}),_(T)}return window.addEventListener(`popstate`,e),window.addEventListener(`hashchange`,o),()=>{window.removeEventListener(`popstate`,e),window.removeEventListener(`hashchange`,o)}},k=[t,n,r,i,d,f,c,a,p,m,h,g,v,s],e[17]=t,e[18]=n,e[19]=r,e[20]=i,e[21]=d,e[22]=f,e[23]=a,e[24]=c,e[25]=p,e[26]=m,e[27]=g,e[28]=h,e[29]=v,e[30]=s,e[31]=O,e[32]=k):(O=e[31],k=e[32]),(0,Q.useEffect)(O,k),null}function M7(){st()&&window.location.hash!==``&&!D7(window.location.hash)&&rm(``)}function N7(){return fr(P7)}function P7(e){e===`navigate-back`&&window.history.back(),e===`navigate-forward`&&window.history.forward()}function F7(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(I7,t),null}function I7(){let e=function(e){if(Mr())return;let t=e.target;Fc({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=zc))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function L7(){let e=(0,$.c)(4),{activeTarget:t}=Et(),n=typeof window<`u`?window.okDesktop??null:null,r=t?.kind===`doc`||t?.kind===`folder`||t?.kind===`asset`?t.kind:null,i=t?.kind===`doc`?t.docName:t?.kind===`folder`?t.folderPath:t?.kind===`asset`?t.assetPath:null,a,o;return e[0]!==i||e[1]!==r?(a=()=>{if(n){if(r===null){n.editor.notifyActiveTargetChanged({kind:null});return}i!==null&&n.editor.notifyActiveTargetChanged({kind:r,identifier:i})}},o=[n,r,i],e[0]=i,e[1]=r,e[2]=a,e[3]=o):(a=e[2],o=e[3]),(0,Q.useEffect)(a,o),null}function R7(){let e=(0,$.c)(13),{activeDocName:t,activeTarget:n}=Et(),{pages:r,addPage:i}=Nd(),[a,o]=(0,Q.useState)(!1),s;e[0]!==t||e[1]!==n?(s=n?.kind===`folder`?n.folderPath:xm(t),e[0]=t,e[1]=n,e[2]=s):s=e[2];let c=s,l=hf(c),u=l.state,d=(0,Q.useRef)(!1),f,p;e[3]!==i||e[4]!==u||e[5]!==c||e[6]!==r?(f=()=>{let e=function(e){if(Mr())return;let t=e.target;if(eC({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,key:e.key})){if(e.preventDefault(),u.status!==`ready`||(u.data.folder.templates_available??[]).length>0){o(!0);return}d.current||(d.current=!0,US({path:`${GS(c,r)}.md`,kind:`file`}).then(e=>{if(!e.ok){Dc.error(e.error),o(!0);return}WS(e.docName,i)}).catch(e=>{console.warn(`[NewItemShortcutHandler] create tail failed:`,e),o(!0)}).finally(()=>{d.current=!1}))}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},p=[u,c,r,i],e[3]=i,e[4]=u,e[5]=c,e[6]=r,e[7]=f,e[8]=p):(f=e[7],p=e[8]),(0,Q.useEffect)(f,p);let m;return e[9]!==a||e[10]!==l||e[11]!==c?(m=(0,Z.jsx)(nC,{open:a,onOpenChange:o,kind:`file`,initialDir:c,folderConfig:l}),e[9]=a,e[10]=l,e[11]=c,e[12]=m):m=e[12],m}function z7(e){let t=(0,$.c)(5),{children:n}=e,{collabUrl:r}=Et();S7(r);let i,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(g7,{}),a=(0,Z.jsx)(m7,{}),t[0]=i,t[1]=a):(i=t[0],a=t[1]);let o;return t[2]!==n||t[3]!==r?(o=(0,Z.jsxs)(Nm,{collabUrl:r,children:[i,a,n]}),t[2]=n,t[3]=r,t[4]=o):o=t[4],o}function B7(e){let t=(0,$.c)(6),{children:n}=e,{merged:r}=Fl(),{promoteAllPreviewTabs:i}=Et(),a;t[0]!==r?.editor?.previewTabs||t[1]!==i?(a=()=>{r?.editor?.previewTabs===!1&&i()},t[0]=r?.editor?.previewTabs,t[1]=i,t[2]=a):a=t[2];let o=r?.editor?.previewTabs,s;return t[3]!==i||t[4]!==o?(s=[o,i],t[3]=i,t[4]=o,t[5]=s):s=t[5],(0,Q.useEffect)(a,s),n}function V7(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(om,{name:`app`,children:(0,Z.jsx)(gn,{children:(0,Z.jsx)(z7,{children:(0,Z.jsx)(B7,{children:(0,Z.jsx)(TC,{children:(0,Z.jsx)(H7,{})})})})})}),e[0]=t):t=e[0],t}function H7(){let e=(0,$.c)(36),t=typeof window<`u`?window.okDesktop??null:null,n=typeof window<`u`&&window.okDesktop!=null,[r,i]=(0,Q.useState)(!1),a=OC(),o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=$c(),e[0]=o):o=e[0];let s=o,c=Pr(),l;e[1]===c?l=e[2]:(l=t&&t.config.ptyAvailable===!0?{launchInTerminal:U7,installedClis:c}:null,e[1]=c,e[2]=l);let u=l,d,f;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(rw,{}),f=(0,Z.jsx)(Qb,{}),e[3]=d,e[4]=f):(d=e[3],f=e[4]);let p,m,h,g,_,v,y;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(q5,{}),h=!s&&(0,Z.jsx)(Z5,{}),g=(0,Z.jsx)(d7,{}),_=(0,Z.jsx)(X5,{}),v=(0,Z.jsx)(j7,{}),y=(0,Z.jsx)(L7,{}),p=(0,Z.jsx)(R7,{}),e[5]=p,e[6]=m,e[7]=h,e[8]=g,e[9]=_,e[10]=v,e[11]=y):(p=e[5],m=e[6],h=e[7],g=e[8],_=e[9],v=e[10],y=e[11]);let b;e[12]===a?b=e[13]:(b=!a&&!s&&(0,Z.jsx)(F7,{}),e[12]=a,e[13]=b);let x,S,C,w,T,E;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=!1,S=t?(0,Z.jsx)(iw,{bridge:t}):null,C=t?(0,Z.jsx)(Ir,{}):null,w=t?(0,Z.jsx)(OU,{}):null,T=(0,Z.jsx)(U5,{}),E=t?(0,Z.jsxs)(Q.Suspense,{fallback:null,children:[(0,Z.jsx)(C7,{bridge:t}),(0,Z.jsx)(w7,{})]}):null,e[14]=x,e[15]=S,e[16]=C,e[17]=w,e[18]=T,e[19]=E):(x=e[14],S=e[15],C=e[16],w=e[17],T=e[18],E=e[19]);let D;e[20]===r?D=e[21]:(D=!s&&(0,Z.jsx)(JC,{bridge:t,open:r,onOpenChange:i}),e[20]=r,e[21]=D);let O;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=n&&(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`editor-window-chrome-drag-strip`,"data-electron-drag":``,className:`pointer-events-none fixed inset-x-0 top-0 z-50 h-2 [-webkit-app-region:drag]`}),e[22]=O):O=e[22];let k;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(Zb,{}),e[23]=k):k=e[23];let A;e[24]===a?A=e[25]:(A=!a&&!s&&(0,Z.jsx)(P5,{onOpenSearch:()=>i(!0)}),e[24]=a,e[25]=A);let j;e[26]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(GL,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(_U,{onOpenSearch:()=>i(!0)})}),e[26]=j):j=e[26];let M;e[27]===A?M=e[28]:(M=(0,Z.jsxs)(zL,{className:`h-screen overflow-hidden`,children:[A,j]}),e[27]=A,e[28]=M);let N;e[29]!==M||e[30]!==u?(N=(0,Z.jsxs)(Or,{value:u,children:[k,M]}),e[29]=M,e[30]=u,e[31]=N):N=e[31];let P;return e[32]!==b||e[33]!==D||e[34]!==N?(P=(0,Z.jsxs)(Z.Fragment,{children:[d,f,(0,Z.jsxs)(Pd,{children:[m,h,g,_,v,y,p,b,x,S,C,w,T,E,D,O,N]})]}),e[32]=b,e[33]=D,e[34]=N,e[35]=P):P=e[35],P}function U7(e,t){_l(Bl(e,t),t)}function W7(e){let t=/\/([^/]+?)(?:\.git)?\/?$/.exec(e);return t?t[1]:`repo`}function G7(e){return{async getAuthStatus(t){return e.authQueryTransport.status(t?{host:t}:void 0)},async startSignIn(){return e.openSignIn()},async runClone({url:t,branch:n}){let r=await e.bridge.dialog.openFolder();if(!r)return{kind:`cancelled`};let i=W7(t),a=`${r.replace(/\/$/,``)}/${i}`,o=Dc.loading(Hc._({id:`GXf9hG`,values:{repoName:i}}),{duration:1/0}),s=typeof n==`string`&&n.length>0?n:null;try{let n=e.cloneTransport.start({url:t,dir:a,branch:s});for await(let e of n.events){if(e.type===`progress`){let t=e.phase,n=Math.round(e.pct);Dc.loading(Hc._({id:`GXf9hG`,values:{repoName:i}}),{id:o,description:Hc._({id:`SCzAbA`,values:{phase:t,pct:n}}),duration:1/0});continue}if(e.type===`branch-fallback`){console.log(V_({branch_action:`fallback`,branch:e.branch})),Dc.info(Hc._({id:`3JYy1p`,values:{0:e.branch}}),{duration:8e3});continue}if(e.type===`complete`)return Dc.success(Hc._({id:`IRv9cH`,values:{repoName:i}}),{id:o,duration:4e3}),{kind:`ok`,dir:e.dir};if(e.type===`error`)return Dc.dismiss(o),{kind:`error`,detail:e.message}}return Dc.dismiss(o),{kind:`error`,detail:Hc._({id:`PZt2Ds`})}}catch(e){console.warn(`[clone-controller] clone transport threw`,e);let t=e instanceof Error?e.message:Hc._({id:`29VNqC`});return Dc.dismiss(o),{kind:`error`,detail:t}}}}}function K7(){return{start(e){return $d((t,n)=>{(async()=>{try{let r=await fetch(`/api/local-op/clone`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e.url,dir:e.dir||void 0,branch:typeof e.branch==`string`&&e.branch.length>0?e.branch:void 0}),signal:n});if(!r.ok){let e=r.status,n=Hc._({id:`ZSoojc`,values:{status:e}});try{let e=await r.json(),t=xc.safeParse(e);if(t.success){let e=t.data.title;n=Hc._({id:`OsSaYm`,values:{title:e}})}}catch{}t({type:`error`,message:n});return}if(!r.body){t({type:`error`,message:Hc._({id:`fhaxJL`})});return}let i=r.body.getReader(),a=new TextDecoder,o=``;for(;;){let{done:e,value:r}=await i.read();if(e)break;o+=a.decode(r,{stream:!0});let s=o.split(`
2204
- `);o=s.pop()??``;for(let e of s){if(!e.trim())continue;let n;try{n=JSON.parse(e)}catch{console.warn(`[clone-transport] Dropped unparseable NDJSON line:`,e.slice(0,100));continue}if(n&&typeof n==`object`&&n.type===`error`&&`problem`in n){let e=n.problem;t({type:`error`,message:e?.detail||e?.title||Hc._({id:`29VNqC`})});break}t(n)}if(n.aborted)break}n.aborted||t({type:`error`,message:Hc._({id:`Tz9pJB`})})}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;t({type:`error`,message:Hc._({id:`K9J00P`})})}})()})}}}function q7(e){return{start(t){let n=typeof t.branch==`string`&&t.branch.length>0?t.branch:null;return e.localOp.clone.start({url:t.url,dir:t.dir,branch:n})}}}function J7(e){switch(e){case`receiving`:return{id:`qbfj1f`};case`resolving`:return{id:`adsMWO`};case`checking`:return{id:`1HBhDS`};case`init`:return{id:`LlHqdU`};case`done`:return{id:`bD8I7O`};default:return{id:`25Pw6a`}}}function Y7(e){let t=e.trim();if(/^[\w.-]+\/[\w.-]+$/.test(t))return t.split(`/`)[1];try{return new URL(t.replace(/^git@([^:]+):/,`https://$1/`)).pathname.replace(/\.git$/,``).split(`/`).pop()??`repo`}catch{return t.split(`/`).pop()?.replace(/\.git$/,``)??`repo`}}function X7(e){let t=(0,$.c)(100),{open:n,onOpenChange:r,onSignIn:i,onCloneComplete:a,transport:o,authQueryTransport:s,pickParentFolder:c,initialUrl:l}=e,{_:u}=Bn(),d;t[0]===o?d=t[1]:(d=o??K7(),t[0]=o,t[1]=d);let f=d,p;t[2]===s?p=t[3]:(p=s??tf(),t[2]=s,t[3]=p);let m=p,h=c!==void 0,[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(!1),w;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(w=mf(),t[4]=w):w=t[4];let[T,E]=(0,Q.useState)(w),[D,O]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(-1),N=(0,Q.useRef)(null),P=(0,Q.useRef)(null),F=(0,Q.useRef)(null),I=(0,Q.useId)(),L;t[5]!==n||t[6]!==m?(L=()=>{if(!n)return;let e=!1;return m.status().then(t=>{lf(t.authenticated),e||E(t.authenticated)}).catch(()=>{e||E(!1)}),()=>{e=!0}},t[5]=n,t[6]=m,t[7]=L):L=t[7];let R;t[8]===n?R=t[9]:(R=[n],t[8]=n,t[9]=R),(0,Q.useEffect)(L,R);let z;t[10]!==T||t[11]!==n||t[12]!==m?(z=()=>{if(!T||!n)return;let e=!1;return C(!0),m.repos().then(t=>{e||(x(t.ok?t.repos:[]),C(!1))}).catch(()=>{e||(x([]),C(!1))}),()=>{e=!0}},t[10]=T,t[11]=n,t[12]=m,t[13]=z):z=t[13];let B;t[14]!==T||t[15]!==n?(B=[T,n],t[14]=T,t[15]=n,t[16]=B):B=t[16],(0,Q.useEffect)(z,B);let V,ee;t[17]!==l||t[18]!==n||t[19]!==h?(V=()=>{if(!n||!l||(_(l),h))return;let e=Y7(l);e&&y(`~/Documents/${e}`)},ee=[n,l,h],t[17]=l,t[18]=n,t[19]=h,t[20]=V,t[21]=ee):(V=t[20],ee=t[21]),(0,Q.useEffect)(V,ee);let H,U;t[22]!==j||t[23]!==I?(H=()=>{j<0||document.getElementById(`${I}-opt-${j}`)?.scrollIntoView({block:`nearest`})},U=[j,I],t[22]=j,t[23]=I,t[24]=H,t[25]=U):(H=t[24],U=t[25]),(0,Q.useEffect)(H,U);let W;t[26]===h?W=t[27]:(W=function(e){if(_(e),A(!0),M(-1),h)return;let t=Y7(e);t&&y(`~/Documents/${t}`)},t[26]=h,t[27]=W);let G=W,te;t[28]===h?te=t[29]:(te=function(e){if(_(e.clone_url),h)return;let t=e.full_name.split(`/`)[1];y(`~/Documents/${t}`)},t[28]=h,t[29]=te);let ne=te,re;t[30]!==u||t[31]!==v||t[32]!==a||t[33]!==r||t[34]!==c||t[35]!==f||t[36]!==g?(re=async function(){let e=g.trim();if(!e){Dc.error(u({id:`FTUGgh`}));return}let t=v||``;if(c){O(!0);let n=await c();if(!n){O(!1);return}let r=Y7(e);t=`${n.replace(/\/$/,``)}/${r}`}else O(!0);let n=Dc.loading(u({id:`2tgFCe`}),{duration:1/0});P.current=n;let i=f.start({url:e,dir:t});N.current=i.cancel;try{let e=i.events[Symbol.asyncIterator](),t=await e.next();for(;!t.done;){let i=t.value;if(i.type===`progress`){let e=u(J7(i.phase));Dc.loading(`${e} — ${i.pct}%`,{id:n})}else if(i.type===`complete`){Dc.success(u({id:`u_lS4C`}),{id:n}),r(!1),O(!1),N.current=null;let e=`port`in i?i.port:void 0;a?a({port:e,dir:i.dir}):e!==void 0&&(window.location.href=`http://localhost:${e}`);return}else if(i.type===`error`){let e=i.message;Dc.error(u({id:`eFJkVt`,values:{cloneError:e}}),{id:n}),O(!1),N.current=null;return}t=await e.next()}Dc.error(u({id:`Tz9pJB`}),{id:n}),O(!1),N.current=null}catch(e){console.error(`[CloneDialog] clone iteration failed:`,e),Dc.error(u({id:`K9J00P`}),{id:n}),O(!1),N.current=null}},t[30]=u,t[31]=v,t[32]=a,t[33]=r,t[34]=c,t[35]=f,t[36]=g,t[37]=re):re=t[37];let K=re,ie;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(){N.current?.(),N.current=null,O(!1),Dc.dismiss(P.current??void 0)},t[38]=ie):ie=t[38];let q=ie,ae;t[39]!==D||t[40]!==r||t[41]!==h?(ae=function(e){D||(r(e),e||(_(``),h||y(``),A(!1),M(-1)))},t[39]=D,t[40]=r,t[41]=h,t[42]=ae):ae=t[42];let oe=ae,se;t[43]===ne?se=t[44]:(se=function(e){ne(e),A(!1),M(-1),F.current?.focus()},t[43]=ne,t[44]=se);let ce=se,le=T===null||S&&b===null,ue;if(t[45]!==b||t[46]!==g){let e=g.trim().toLowerCase(),n;t[48]===b?n=t[49]:(n=b??[],t[48]=b,t[49]=n),ue=n.filter(t=>`${t.full_name} ${t.clone_url}`.toLowerCase().includes(e)),t[45]=b,t[46]=g,t[47]=ue}else ue=t[47];let de=ue,fe;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(fe=/:\/\/|^git@|\.git$/i,t[50]=fe):fe=t[50];let pe;t[51]===g?pe=t[52]:(pe=fe.test(g.trim()),t[51]=g,t[52]=pe);let J=pe,me=T===!0&&b!==null&&de.length===0&&!J,he=k&&T!==!1&&!D&&(le||de.length>0||me),ge=de.length,_e=`${I}-loading`,ve,ye;t[53]===ge?(ve=t[54],ye=t[55]):(ve=()=>{M(e=>e>=ge?ge-1:e)},ye=[ge],t[53]=ge,t[54]=ve,t[55]=ye),(0,Q.useEffect)(ve,ye);let be;t[56]!==j||t[57]!==D||t[58]!==he||t[59]!==ce||t[60]!==de?(be=function(e){if(!D)if(e.key===`ArrowDown`){if(e.preventDefault(),!he){A(!0);return}M(e=>Math.min(e+1,de.length-1))}else e.key===`ArrowUp`?(e.preventDefault(),M(n9)):e.key===`Enter`?he&&j>=0&&j<de.length&&(e.preventDefault(),ce(de[j])):e.key===`Escape`&&he&&(e.preventDefault(),e.stopPropagation(),A(!1),M(-1))},t[56]=j,t[57]=D,t[58]=he,t[59]=ce,t[60]=de,t[61]=be):be=t[61];let xe=be,Se;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsx)($r,{children:(0,Z.jsx)(Jr,{children:(0,Z.jsx)(Y,{id:`VdXv4D`})})}),t[62]=Se):Se=t[62];let Ce;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(`label`,{htmlFor:`clone-source`,className:`text-sm font-medium`,children:(0,Z.jsx)(Y,{id:`IreQBq`})}),t[63]=Ce):Ce=t[63];let we;t[64]!==u||t[65]!==j||t[66]!==D||t[67]!==xe||t[68]!==G||t[69]!==T||t[70]!==I||t[71]!==_e||t[72]!==i||t[73]!==he||t[74]!==le||t[75]!==b||t[76]!==ce||t[77]!==de||t[78]!==g?(we=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[Ce,T===!1?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(dh,{id:`clone-source`,placeholder:u({id:`Xv_ijG`}),value:g,onChange:e=>G(e.target.value),disabled:D}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-1sm text-muted-foreground`,children:[(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`9oE4C3`})}),(0,Z.jsx)(X,{variant:`link`,className:`h-auto p-0`,onClick:()=>i?.(),disabled:D,children:(0,Z.jsx)(Y,{id:`3jod3l`})})]})]}):(0,Z.jsxs)(hh,{open:he,onOpenChange:A,children:[(0,Z.jsx)(mh,{asChild:!0,children:(0,Z.jsx)(dh,{id:`clone-source`,ref:F,role:`combobox`,"aria-expanded":he,"aria-controls":he?le?_e:I:void 0,"aria-activedescendant":j>=0?`${I}-opt-${j}`:void 0,"aria-autocomplete":`list`,autoComplete:`off`,placeholder:u({id:`R0jJzV`}),value:g,onChange:e=>G(e.target.value),onFocus:()=>A(!0),onKeyDown:xe,disabled:D})}),(0,Z.jsx)(ph,{align:`start`,sideOffset:4,className:`w-(--radix-popover-trigger-width) max-h-56 overflow-y-auto overscroll-y-contain subtle-scrollbar p-0`,"data-ok-declines-keyboard":``,onOpenAutoFocus:t9,onCloseAutoFocus:e9,onInteractOutside:e=>{F.current?.contains(e.target)&&e.preventDefault()},onWheel:$7,onTouchMove:Q7,children:le?(0,Z.jsxs)(`output`,{id:_e,className:`flex flex-col gap-1.5 px-3 py-2`,"aria-label":u({id:`8XQRON`}),children:[(0,Z.jsx)(tg,{className:`h-4 w-2/3`}),(0,Z.jsx)(tg,{className:`h-4 w-1/2`}),(0,Z.jsx)(tg,{className:`h-4 w-3/4`}),(0,Z.jsx)(tg,{className:`h-4 w-2/5`})]}):(0,Z.jsx)(`div`,{id:I,role:`listbox`,"aria-label":u({id:`KX1MZR`}),className:`py-1`,children:de.length===0?(0,Z.jsx)(`div`,{role:`presentation`,className:`px-3 py-2 text-xs text-muted-foreground`,children:b&&b.length===0?(0,Z.jsx)(Y,{id:`cOSAfL`}):(0,Z.jsx)(Y,{id:`8eW0WQ`})}):de.map((e,t)=>(0,Z.jsxs)(`div`,{id:`${I}-opt-${t}`,role:`option`,tabIndex:-1,"aria-selected":t===j,onMouseDown:Z7,onMouseEnter:()=>M(t),onClick:()=>ce(e),className:gr(`flex cursor-default items-center gap-2 px-3 py-1.5 text-sm`,t===j&&`bg-accent text-accent-foreground`),children:[e.private?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ob,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`n5n_vi`})})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Fd,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`NuH1jp`})})]}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.full_name})]},e.full_name))})})]})]}),t[64]=u,t[65]=j,t[66]=D,t[67]=xe,t[68]=G,t[69]=T,t[70]=I,t[71]=_e,t[72]=i,t[73]=he,t[74]=le,t[75]=b,t[76]=ce,t[77]=de,t[78]=g,t[79]=we):we=t[79];let Te;t[80]!==D||t[81]!==v||t[82]!==h?(Te=!h&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`label`,{htmlFor:`clone-path`,className:`text-sm font-medium`,children:(0,Z.jsx)(Y,{id:`Gp_twO`})}),(0,Z.jsx)(dh,{id:`clone-path`,placeholder:`~/Documents/repo-name`,value:v,onChange:e=>y(e.target.value),disabled:D})]}),t[80]=D,t[81]=v,t[82]=h,t[83]=Te):Te=t[83];let Ee;t[84]!==we||t[85]!==Te?(Ee=(0,Z.jsx)(Xr,{children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[we,Te]})}),t[84]=we,t[85]=Te,t[86]=Ee):Ee=t[86];let De;t[87]!==D||t[88]!==K||t[89]!==oe||t[90]!==g||t[91]!==h?(De=(0,Z.jsx)(Zr,{children:D?(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:q,children:(0,Z.jsx)(Y,{id:`dEgA5A`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:()=>oe(!1),children:(0,Z.jsx)(Y,{id:`dEgA5A`})}),(0,Z.jsx)(X,{onClick:()=>void K(),disabled:!g.trim(),"aria-describedby":h?`clone-picker-hint`:void 0,children:(0,Z.jsx)(Y,{id:`9UQ730`})}),h&&(0,Z.jsx)(`span`,{id:`clone-picker-hint`,className:`sr-only`,children:(0,Z.jsx)(Y,{id:`EvPX7f`})})]})}),t[87]=D,t[88]=K,t[89]=oe,t[90]=g,t[91]=h,t[92]=De):De=t[92];let Oe;t[93]!==Ee||t[94]!==De?(Oe=(0,Z.jsxs)(Yr,{className:`sm:max-w-lg`,children:[Se,Ee,De]}),t[93]=Ee,t[94]=De,t[95]=Oe):Oe=t[95];let ke;return t[96]!==oe||t[97]!==n||t[98]!==Oe?(ke=(0,Z.jsx)(ei,{open:n,onOpenChange:oe,children:Oe}),t[96]=oe,t[97]=n,t[98]=Oe,t[99]=ke):ke=t[99],ke}function Z7(e){return e.preventDefault()}function Q7(e){return e.stopPropagation()}function $7(e){return e.stopPropagation()}function e9(e){return e.preventDefault()}function t9(e){return e.preventDefault()}function n9(e){return Math.max(e-1,-1)}var r9=(0,Q.lazy)(()=>n(()=>import(`./ConsentDialogBody-DQlUb8Vu.js`),__vite__mapDeps([230,1,28,2,3,29,30,31,32,33,7,8,9,23,11,12,13,18,10,14,15,16,17,19,20,21,99,84,231,37,127,91,45,92,104,131,132,40,41,152,42,43,44,103,220,109,110,68,161,108,147]),import.meta.url));function i9(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(Dh.subscribe,o9,a9))return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(r9,{})}),e[0]=t):t=e[0],t}function a9(){return!1}function o9(){return Dh.getSnapshot()!==null}var s9=(0,Q.lazy)(()=>n(()=>import(`./ShareReceiveDialog-BsGWPO5t.js`).then(e=>({default:e.ShareReceiveDialog})),__vite__mapDeps([232,1,28,2,3,29,30,31,32,33,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,26,84,224,226,227,37]),import.meta.url)),c9=(0,Q.lazy)(()=>n(()=>import(`./AppMenubar-DS-GyfEA.js`).then(e=>({default:e.AppMenubar})),__vite__mapDeps([207,1,7,8,9,11,12,13,40,130,43,44,45,14,15,41,92,21,99,18,208,36,37,19,17]),import.meta.url)),l9=(e,t,n)=>SC(e,t,n,`NavigatorApp`);function u9(e,t){return e.filter(e=>e.path!==t)}function d9(e){let t=(0,$.c)(159),{bridge:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=new Map,t[1]=o):o=t[1];let[s,c]=(0,Q.useState)(o),[l,u]=(0,Q.useState)(!0),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(void 0),[D,O]=(0,Q.useState)(void 0),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(!1),[N,P]=(0,Q.useState)(null),F=typeof window<`u`&&window.okDesktop!=null,[I,L]=(0,Q.useState)(`auth`),{theme:R}=sr(),{_:z}=Bn();jm(n,R??`system`);let B;t[2]===n.config.languagePreference?B=t[3]:(B=Am(n.config.languagePreference)??Mm(),t[2]=n.config.languagePreference,t[3]=B);let V;t[4]===B?V=t[5]:(V={preference:B,userConfigSynced:!0},t[4]=B,t[5]=V),km(V);let ee;t[6]!==z||t[7]!==n.project?(ee=()=>{let e=!1;return n.project.listRecent().then(async t=>{if(e)return;a(t);let r=t.filter(f9),i=await Promise.all(r.map(async e=>{try{let{currentBranch:t}=await n.project.readHeadBranch(e.path);return[e.path,t]}catch{return[e.path,null]}}));e||c(e=>{let t=new Map(e);for(let[e,n]of i)t.set(e,n);return t})}).catch(t=>{console.error(`[NavigatorApp] listRecent failed:`,t),e||(m(t instanceof Error?t.message:z({id:`fYKgzG`})),f(!0))}).finally(()=>{e||u(!1)}),()=>{e=!0}},t[6]=z,t[7]=n.project,t[8]=ee):ee=t[8];let H;t[9]!==z||t[10]!==n?(H=[n,z],t[9]=z,t[10]=n,t[11]=H):H=t[11],(0,Q.useEffect)(ee,H);let U,W;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>fr((e,t)=>{e===`new-project`&&b(!0),e===`report-bug`&&S(e=>e??t),e===`send-feedback`&&w(!0),e===`close-active-tab-or-window`&&window.close()}),W=[],t[12]=U,t[13]=W):(U=t[12],W=t[13]),(0,Q.useEffect)(U,W);let G,te;t[14]===n?(G=t[15],te=t[16]):(te=()=>n.onRecentRemovedMissing(e=>{let{path:t}=e;a(e=>u9(e,t)),c(e=>{if(!e.has(t))return e;let n=new Map(e);return n.delete(t),n})}),G=[n],t[14]=n,t[15]=G,t[16]=te),(0,Q.useEffect)(te,G);let ne;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(e,t)=>l9(e,t,m),t[17]=ne):ne=t[17];let re=ne,K;t[18]!==z||t[19]!==n?(K=(e,t,r)=>re(()=>(g(r),_9(n,e,t).finally(()=>g(null))),z({id:`SUOoXn`})),t[18]=z,t[19]=n,t[20]=K):K=t[20];let ie=K,q;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(q=()=>v(!0),t[21]=q):q=t[21];let ae=q,oe;t[22]!==z||t[23]!==n?(oe=()=>re(async()=>{let e=await n.dialog.openFolder();e&&(g(v9(e)),await _9(n,e,`pick-existing`).finally(()=>g(null)))},z({id:`gmJ0An`})),t[22]=z,t[23]=n,t[24]=oe):oe=t[24];let se=oe,ce;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(ce=()=>b(!0),t[25]=ce):ce=t[25];let le=ce,ue;t[26]!==z||t[27]!==n.project?(ue=()=>re(()=>n.project.openFile(),z({id:`8vCZcs`})),t[26]=z,t[27]=n.project,t[28]=ue):ue=t[28];let de=ue,fe;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(e,t)=>{E(e),O(t),b(!0)},t[29]=fe):fe=t[29];let pe=fe,J;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(J=e=>{b(e),e||(E(void 0),O(void 0))},t[30]=J):J=t[30];let me=J,he;t[31]===ie?he=t[32]:(he=e=>ie(e,`recents`,v9(e)),t[31]=ie,t[32]=he);let ge=he,_e;t[33]!==z||t[34]!==n.project?(_e=e=>re(async()=>{await n.project.removeRecent(e),a(t=>u9(t,e)),c(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},z({id:`viwC-K`})),t[33]=z,t[34]=n.project,t[35]=_e):_e=t[35];let ve=_e,ye;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(ye=(0,Z.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 top-0 z-10 h-9 ${F?`[-webkit-app-region:drag]`:``}`,"data-electron-drag":F?``:void 0,"data-testid":`nav-chrome-row`,children:S_()&&(0,Z.jsx)(`div`,{className:`pointer-events-auto flex h-full items-center px-2`,children:(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(c9,{})})})}),t[36]=ye):ye=t[36];let be;t[37]!==z||t[38]!==h?(be=h===null?null:(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-20 flex flex-col items-center justify-center gap-3 bg-primary-foreground/85 dark:bg-background/85 backdrop-blur-sm`,"data-testid":`nav-opening-overlay`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(ip,{"aria-hidden":`true`,className:`size-6 text-muted-foreground`}),(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:z({id:`s0_GnA`,values:{openingLabel:h}})})]}),t[37]=z,t[38]=h,t[39]=be):be=t[39];let xe;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Z.jsx)(B_,{className:`size-12 shrink-0`}),t[40]=xe):xe=t[40];let Se;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`h1`,{className:`font-medium text-xl tracking-tight`,children:`OpenKnowledge`}),(0,Z.jsx)(HV,{})]}),t[41]=Se):Se=t[41];let Ce;t[42]===n.appVersion?Ce=t[43]:(Ce=(0,Z.jsxs)(`header`,{className:`shrink-0 flex-wrap flex items-center gap-2.5`,children:[xe,(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[Se,(0,Z.jsxs)(`p`,{className:`text-muted-foreground text-xs font-mono`,children:[`v`,n.appVersion]})]})]}),t[42]=n.appVersion,t[43]=Ce);let we;t[44]===z?we=t[45]:(we=z({id:`wbv9xO`}),t[44]=z,t[45]=we);let Te;t[46]===z?Te=t[47]:(Te=z({id:`0uTHCg`}),t[46]=z,t[47]=Te);let Ee;t[48]!==we||t[49]!==Te?(Ee=(0,Z.jsx)(p9,{title:we,description:Te,onClick:le,dataTestId:`nav-create-new`,Icon:dr}),t[48]=we,t[49]=Te,t[50]=Ee):Ee=t[50];let De;t[51]===z?De=t[52]:(De=z({id:`WPwDin`}),t[51]=z,t[52]=De);let Oe;t[53]===z?Oe=t[54]:(Oe=z({id:`tUvUfp`}),t[53]=z,t[54]=Oe);let ke;t[55]!==se||t[56]!==De||t[57]!==Oe?(ke=(0,Z.jsx)(p9,{title:De,description:Oe,onClick:se,dataTestId:`nav-open`,Icon:Wf}),t[55]=se,t[56]=De,t[57]=Oe,t[58]=ke):ke=t[58];let Ae;t[59]===z?Ae=t[60]:(Ae=z({id:`ka6Eke`}),t[59]=z,t[60]=Ae);let je;t[61]===z?je=t[62]:(je=z({id:`gOD68k`}),t[61]=z,t[62]=je);let Me;t[63]!==de||t[64]!==Ae||t[65]!==je?(Me=(0,Z.jsx)(p9,{title:Ae,description:je,onClick:de,dataTestId:`nav-open-file`,Icon:xi}),t[63]=de,t[64]=Ae,t[65]=je,t[66]=Me):Me=t[66];let Ne;t[67]===z?Ne=t[68]:(Ne=z({id:`VdXv4D`}),t[67]=z,t[68]=Ne);let Pe;t[69]===z?Pe=t[70]:(Pe=z({id:`JOcPqH`}),t[69]=z,t[70]=Pe);let Fe;t[71]!==Ne||t[72]!==Pe?(Fe=(0,Z.jsx)(p9,{title:Ne,description:Pe,onClick:ae,dataTestId:`nav-clone`,Icon:Jx}),t[71]=Ne,t[72]=Pe,t[73]=Fe):Fe=t[73];let Ie;t[74]!==Ee||t[75]!==ke||t[76]!==Me||t[77]!==Fe?(Ie=(0,Z.jsxs)(`section`,{className:`grid sm:grid-cols-2 gap-3`,children:[Ee,ke,Me,Fe]}),t[74]=Ee,t[75]=ke,t[76]=Me,t[77]=Fe,t[78]=Ie):Ie=t[78];let Le;t[79]!==l||t[80]!==i||t[81]!==d?(Le=!l&&!d&&i.length===0?(0,Z.jsx)(h9,{onPackSelect:pe}):null,t[79]=l,t[80]=i,t[81]=d,t[82]=Le):Le=t[82];let Re;t[83]!==Ie||t[84]!==Le?(Re=(0,Z.jsxs)(`div`,{className:`shrink-0 space-y-6`,children:[Ie,Le]}),t[83]=Ie,t[84]=Le,t[85]=Re):Re=t[85];let ze;t[86]===p?ze=t[87]:(ze=p===null?null:(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 rounded-md border border-red-500/30 bg-red-500/10 px-3 py-2`,"data-testid":`nav-error-banner`,role:`alert`,children:[(0,Z.jsx)(`span`,{className:`text-red-700 text-xs dark:text-red-300`,children:p}),(0,Z.jsx)(X,{type:`button`,variant:`link`,size:`sm`,onClick:()=>m(null),className:`h-auto p-0 text-red-700 text-xs dark:text-red-300`,"data-testid":`nav-error-dismiss`,children:(0,Z.jsx)(Y,{id:`1QfxQT`})})]}),t[86]=p,t[87]=ze);let Be;t[88]!==l||t[89]!==ge||t[90]!==ve||t[91]!==s||t[92]!==i?(Be=l?(0,Z.jsx)(`section`,{className:`flex shrink-0 flex-col items-center`,children:(0,Z.jsx)(ip,{className:`size-4 text-muted-foreground/60`})}):i.length>0?(0,Z.jsxs)(`section`,{className:`flex min-h-0 flex-col`,children:[(0,Z.jsx)(`h2`,{className:`mb-2 shrink-0 font-medium text-muted-foreground font-mono text-xs uppercase tracking-wide`,children:(0,Z.jsx)(Y,{id:`CCTop_`})}),(0,Z.jsx)(`ul`,{className:`min-h-0 max-h-48 subtle-scrollbar scroll-fade-mask overflow-y-auto space-y-0.5 -mx-4`,"data-testid":`nav-recent-list`,children:i.map(e=>(0,Z.jsx)(g9,{project:e,branch:s.get(e.path)??null,onOpen:()=>ge(e.path),onRemove:()=>ve(e.path)},e.path))})]}):null,t[88]=l,t[89]=ge,t[90]=ve,t[91]=s,t[92]=i,t[93]=Be):Be=t[93];let Ve;t[94]!==Ce||t[95]!==Re||t[96]!==ze||t[97]!==Be?(Ve=(0,Z.jsx)(`div`,{className:`mx-auto flex h-full w-full max-w-5xl flex-col overflow-hidden px-12 py-12`,children:(0,Z.jsxs)(`div`,{className:`my-auto flex min-h-0 flex-col space-y-10`,children:[Ce,Re,ze,Be]})}),t[94]=Ce,t[95]=Re,t[96]=ze,t[97]=Be,t[98]=Ve):Ve=t[98];let He,Ue;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,Z.jsx)(U5,{}),Ue=(0,Z.jsx)(i9,{}),t[99]=He,t[100]=Ue):(He=t[99],Ue=t[100]);let We;t[101]!==n||t[102]!==y||t[103]!==T||t[104]!==D?(We=(0,Z.jsx)(Lx,{open:y,onOpenChange:me,bridge:n,initialPackId:T,packs:D}),t[101]=n,t[102]=y,t[103]=T,t[104]=D,t[105]=We):We=t[105];let Ge=x!==null,Ke;t[106]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=e=>{e||S(null)},t[106]=Ke):Ke=t[106];let qe=x?.launcherBorne===!0,Je;t[107]!==Ge||t[108]!==qe?(Je=(0,Z.jsx)(Fr,{open:Ge,onOpenChange:Ke,launcherBorne:qe,systemWide:!0}),t[107]=Ge,t[108]=qe,t[109]=Je):Je=t[109];let Ye;t[110]===C?Ye=t[111]:(Ye=(0,Z.jsx)(HS,{open:C,onOpenChange:w,source:`help_menu`}),t[110]=C,t[111]=Ye);let Xe;t[112]===N?Xe=t[113]:(Xe=e=>{A(e),e||(M(!1),N&&(N(null),P(null)))},t[112]=N,t[113]=Xe);let Ze;t[114]===n?Ze=t[115]:(Ze=ef(n),t[114]=n,t[115]=Ze);let Qe;t[116]===n?Qe=t[117]:(Qe=Yd(n),t[116]=n,t[117]=Qe);let $e=I===`identity`,et;t[118]!==j||t[119]!==N?(et=e=>{A(!1),j&&(M(!1),v(!0)),N&&(N({authenticated:!0,host:`github.com`,login:e.login}),P(null))},t[118]=j,t[119]=N,t[120]=et):et=t[120];let tt;t[121]!==k||t[122]!==Xe||t[123]!==Ze||t[124]!==Qe||t[125]!==$e||t[126]!==et?(tt=(0,Z.jsx)(Kd,{open:k,onOpenChange:Xe,transport:Ze,queryTransport:Qe,identityPrompt:$e,onSuccess:et}),t[121]=k,t[122]=Xe,t[123]=Ze,t[124]=Qe,t[125]=$e,t[126]=et,t[127]=tt):tt=t[127];let nt;t[128]===n?nt=t[129]:(nt=q7(n),t[128]=n,t[129]=nt);let rt;t[130]===n?rt=t[131]:(rt=Yd(n),t[130]=n,t[131]=rt);let it;t[132]===n.dialog?it=t[133]:(it=()=>n.dialog.openFolder(),t[132]=n.dialog,t[133]=it);let at;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(at=()=>{v(!1),L(`auth`),M(!0),A(!0)},t[134]=at):at=t[134];let ot;t[135]!==z||t[136]!==n?(ot=e=>{let{dir:t}=e;re(()=>(g(v9(t)),_9(n,t,`pick-existing`).finally(()=>g(null))),z({id:`iSnkwB`}))},t[135]=z,t[136]=n,t[137]=ot):ot=t[137];let st;t[138]!==_||t[139]!==nt||t[140]!==rt||t[141]!==it||t[142]!==ot?(st=(0,Z.jsx)(X7,{open:_,onOpenChange:v,transport:nt,authQueryTransport:rt,pickParentFolder:it,onSignIn:at,onCloneComplete:ot}),t[138]=_,t[139]=nt,t[140]=rt,t[141]=it,t[142]=ot,t[143]=st):st=t[143];let ct;if(t[144]!==n){let e;t[146]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>new Promise(e=>{P(()=>e),A(!0)}),t[146]=e):e=t[146],ct=G7({bridge:n,authQueryTransport:Yd(n),cloneTransport:q7(n),openSignIn:e}),t[144]=n,t[145]=ct}else ct=t[145];let lt;t[147]!==n||t[148]!==ct?(lt=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(s9,{bridge:n,cloneController:ct})}),t[147]=n,t[148]=ct,t[149]=lt):lt=t[149];let ut;return t[150]!==be||t[151]!==Ve||t[152]!==We||t[153]!==Je||t[154]!==Ye||t[155]!==tt||t[156]!==st||t[157]!==lt?(ut=(0,Z.jsxs)(`div`,{className:`relative flex h-screen w-screen flex-col overflow-hidden bg-primary-foreground dark:bg-background text-foreground`,children:[ye,be,Ve,He,Ue,We,Je,Ye,tt,st,lt]}),t[150]=be,t[151]=Ve,t[152]=We,t[153]=Je,t[154]=Ye,t[155]=tt,t[156]=st,t[157]=lt,t[158]=ut):ut=t[158],ut}function f9(e){return!e.missing}function p9(e){let t=(0,$.c)(14),{title:n,description:r,onClick:i,dataTestId:a,Icon:o}=e,s;t[0]===o?s=t[1]:(s=o?(0,Z.jsx)(o,{className:`size-4 shrink-0 text-muted-foreground`}):null,t[0]=o,t[1]=s);let c;t[2]===n?c=t[3]:(c=(0,Z.jsx)(`span`,{className:`font-medium text-foreground text-sm`,children:n}),t[2]=n,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]===r?u=t[8]:(u=(0,Z.jsx)(`span`,{className:`line-clamp-2 text-muted-foreground text-xs leading-snug`,children:r}),t[7]=r,t[8]=u);let d;return t[9]!==a||t[10]!==i||t[11]!==l||t[12]!==u?(d=(0,Z.jsxs)(X,{type:`button`,variant:`outline`,onClick:i,"data-testid":a,className:`h-auto flex-col items-start justify-start gap-1.5 whitespace-normal bg-card px-4 py-3.5 text-left`,children:[l,u]}),t[9]=a,t[10]=i,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}var m9=3;function h9(e){let t=(0,$.c)(27),{onPackSelect:n}=e,{_:r}=Bn(),[i,a]=(0,Q.useState)(null),o,s;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{let e=!1;return(async()=>{try{let t=await _x().listPacks();if(e)return;t.ok?a(t.packs):(console.error(`[NavigatorApp] listPacks returned error:`,t),a([]))}catch(t){let n=t;if(e)return;console.error(`[NavigatorApp] listPacks failed:`,n),a([])}})(),()=>{e=!0}},s=[],t[0]=o,t[1]=s):(o=t[0],s=t[1]),(0,Q.useEffect)(o,s),i===null||i.length===0)return null;let c,l,u,d,f,p;if(t[2]!==n||t[3]!==i){let e=i.slice(0,m9);c=i.length-e.length;let r=e=>n(e,i);d=`flex flex-wrap items-center gap-x-3 gap-y-2`,f=`nav-starter-packs`,t[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:(0,Z.jsx)(Y,{id:`C-xgad`})}),t[10]=p):p=t[10],l=`flex flex-wrap items-center gap-2`;let a;t[11]===r?a=t[12]:(a=e=>{let t=yx(e.id);return(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,className:`rounded-full`,onClick:()=>r(e.id),"data-testid":`nav-pack-pill-${e.id}`,children:[(0,Z.jsx)(t,{className:`size-3.5 text-muted-foreground`}),e.name]})}),(0,Z.jsx)(Vr,{children:e.description})]},e.id)},t[11]=r,t[12]=a),u=e.map(a),t[2]=n,t[3]=i,t[4]=c,t[5]=l,t[6]=u,t[7]=d,t[8]=f,t[9]=p}else c=t[4],l=t[5],u=t[6],d=t[7],f=t[8],p=t[9];let m;t[13]!==r||t[14]!==n||t[15]!==c||t[16]!==i?(m=c>0?(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`sm`,className:`rounded-full`,onClick:()=>n(void 0,i),"aria-label":r({id:`e4FxjG`,values:{0:i.length}}),"data-testid":`nav-pack-more`,children:(0,Z.jsx)(Y,{id:`B6Lac2`,values:{overflowCount:c}})}):null,t[13]=r,t[14]=n,t[15]=c,t[16]=i,t[17]=m):m=t[17];let h;t[18]!==l||t[19]!==u||t[20]!==m?(h=(0,Z.jsxs)(`div`,{className:l,children:[u,m]}),t[18]=l,t[19]=u,t[20]=m,t[21]=h):h=t[21];let g;return t[22]!==d||t[23]!==f||t[24]!==p||t[25]!==h?(g=(0,Z.jsxs)(`section`,{className:d,"data-testid":f,children:[p,h]}),t[22]=d,t[23]=f,t[24]=p,t[25]=h,t[26]=g):g=t[26],g}function g9(e){let t=(0,$.c)(43),{project:n,branch:r,onOpen:i,onRemove:a}=e,{_:o}=Bn(),{name:s}=n,c=n.isLinkedWorktree===!0,l=c?n.branch??r:r,u=n.path,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Kf,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-muted-foreground`}),t[0]=d):d=t[0];let f;t[1]===n.name?f=t[2]:(f=(0,Z.jsx)(`span`,{className:`truncate font-medium text-sm text-gray-700 dark:text-foreground`,children:n.name}),t[1]=n.name,t[2]=f);let p;t[3]===c?p=t[4]:(p=c?(0,Z.jsxs)(Sh,{variant:`secondary`,className:`shrink-0 gap-1 rounded-full border-transparent bg-green-600/10 px-2 py-0 font-medium text-2xs text-green-800 dark:bg-green-400/10 dark:text-green-400`,children:[(0,Z.jsx)(vu,{"aria-hidden":`true`,className:`size-2.5`}),(0,Z.jsx)(Y,{id:`z-lawV`})]}):null,t[3]=c,t[4]=p);let m;t[5]!==f||t[6]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[f,p]}),t[5]=f,t[6]=p,t[7]=m):m=t[7];let h=c?n.mainRoot??``:n.path,g;t[8]!==c||t[9]!==n.mainRoot||t[10]!==n.path?(g=c?(0,Z.jsx)(Y,{id:`PRnH8G`,values:{0:MC(n.mainRoot??``)}}):n.path,t[8]=c,t[9]=n.mainRoot,t[10]=n.path,t[11]=g):g=t[11];let _;t[12]!==h||t[13]!==g?(_=(0,Z.jsx)(`span`,{className:`truncate w-full text-muted-foreground text-xs`,title:h,children:g}),t[12]=h,t[13]=g,t[14]=_):_=t[14];let v;t[15]!==m||t[16]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[d,(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 truncate`,children:[m,_]})]}),t[15]=m,t[16]=_,t[17]=v):v=t[17];let y;t[18]!==n.path||t[19]!==l?(y=l==null?null:(0,Z.jsxs)(`span`,{className:`flex max-w-[40%] items-center gap-1 text-muted-foreground text-xs`,"data-testid":`nav-recent-branch-${n.path}`,children:[(0,Z.jsx)(vu,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate font-mono`,children:l})]}),t[18]=n.path,t[19]=l,t[20]=y):y=t[20];let b;t[21]!==i||t[22]!==y||t[23]!==v?(b=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,onClick:i,className:`h-auto min-w-0 flex-1 justify-between gap-3 py-3.5 pl-4 pr-2 text-left hover:bg-transparent`,children:[v,y]}),t[21]=i,t[22]=y,t[23]=v,t[24]=b):b=t[24];let x;t[25]!==o||t[26]!==s?(x=o({id:`hDoLrm`,values:{projectName:s}}),t[25]=o,t[26]=s,t[27]=x):x=t[27];let S;t[28]===o?S=t[29]:(S=o({id:`Es-eZU`}),t[28]=o,t[29]=S);let C=`nav-recent-remove-${n.path}`,w;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(zp,{"aria-hidden":`true`}),t[30]=w):w=t[30];let T;t[31]!==a||t[32]!==x||t[33]!==S||t[34]!==C?(T=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:a,"aria-label":x,title:S,className:`pointer-events-none mr-2 opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 focus-visible:pointer-events-auto focus-visible:opacity-100`,"data-testid":C,children:w}),t[31]=a,t[32]=x,t[33]=S,t[34]=C,t[35]=T):T=t[35];let E;t[36]!==b||t[37]!==T?(E=(0,Z.jsxs)(`li`,{className:`group flex items-center justify-between rounded-lg hover:bg-accent`,children:[b,T]}),t[36]=b,t[37]=T,t[38]=E):E=t[38];let D;return t[39]!==a||t[40]!==n.path||t[41]!==E?(D=(0,Z.jsx)(FC,{path:u,onRemoveRecent:a,testIdPrefix:`nav-recent`,children:E}),t[39]=a,t[40]=n.path,t[41]=E,t[42]=D):D=t[42],D}async function _9(e,t,n){await e.project.open({path:t,target:`new-window`,entryPoint:n})}function v9(e){let t=e.split(/[/\\]/).filter(Boolean);return t.length>0?t[t.length-1]??e:e}var y9=(0,Q.lazy)(()=>n(()=>import(`./TerminalWindowApp-VUZguLdJ.js`).then(e=>({default:e.TerminalWindowApp})),__vite__mapDeps([233,1,83,2,28,3,29,30,31,32,33,37,66,9,18,8,84,13,85,86,87,88,89,211,125,7,128,11,12,129,130,43,44,45,40,14,15,41,21,92,99,19,17,118,119,42,46,16,135,24,212,26,213,106,96,34,20,214,157,108,147,109,110,215,180,158,159,210,216,148,69,234,235]),import.meta.url));function b9(e){return e?.config.mode===`terminal`?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(y9,{bridge:e})}):e?.config.mode===`navigator`?(0,Z.jsx)(d9,{bridge:e}):(0,Z.jsx)(V7,{})}function x9(){let e=null,t=new Set,n=!1,r=null;function i(){for(let e of t)e()}function a(){e!==null&&(e=null,i())}return{install({bridge:t}){let o=t?.bugReport?.onCrashDetected;if(typeof o==`function`)return n?r??void 0:(n=!0,r=o(t=>{e=t,i()}),()=>{r?.(),r=null,n=!1,a()})},getSnapshot(){return e},subscribe(e){return t.add(e),()=>{t.delete(e)}},dismiss(){a()}}}var S9=x9();function C9(e){return S9.install(e)}function w9(e){let t=(0,$.c)(7),{bridge:n}=e,r=(0,Q.useSyncExternalStore)(S9.subscribe,S9.getSnapshot);if(r===null)return null;let i;t[0]!==n.bugReport||t[1]!==r.eventId?(i=e=>{e||(n.bugReport.crashAck({eventId:r.eventId}),S9.dismiss())},t[0]=n.bugReport,t[1]=r.eventId,t[2]=i):i=t[2];let a=n.config.mode===`navigator`,o;return t[3]!==r||t[4]!==i||t[5]!==a?(o=(0,Z.jsx)(Fr,{open:!0,onOpenChange:i,systemWide:a,crashInvite:r},r.eventId),t[3]=r,t[4]=i,t[5]=a,t[6]=o):o=t[6],o}var T9=e=>{let t=(0,$.c)(8),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{theme:r}=sr(),i=r===void 0?`system`:r,a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={success:(0,Z.jsx)(Ld,{className:`size-4`}),info:(0,Z.jsx)(rp,{className:`size-4`}),warning:(0,Z.jsx)(Lp,{className:`size-4`}),error:(0,Z.jsx)(lb,{className:`size-4`}),loading:(0,Z.jsx)(ip,{"aria-hidden":`true`,className:`size-4`})},o={"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`,"--border-radius":`var(--radius)`},t[2]=a,t[3]=o):(a=t[2],o=t[3]);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={classNames:{toast:`cn-toast`}},t[4]=s):s=t[4];let c;return t[5]!==n||t[6]!==i?(c=(0,Z.jsx)(Oc,{theme:i,className:`toaster group`,icons:a,style:o,toastOptions:s,...n}),t[5]=n,t[6]=i,t[7]=c):c=t[7],c},E9=99999;function D9(e){return!Number.isFinite(e)||e<0?0:e>E9?E9:Math.floor(e)}function O9(e){let t=e.locked?`1`:`0`,n=e.settled?`1`:`0`;return`v1 lock=${t} f=${D9(e.inFrame)} n=${D9(e.total)} s=${n}`}function k9(e){let t=e?.classList;return typeof t?.contains==`function`?t.contains(Qt):!1}function A9(){if(typeof window>`u`)return;let e=window.okDesktop?.setDisplayLockCrashKey;if(typeof e==`function`)return e}function j9(e){let t=e.publish??A9();if(t===void 0)return()=>{};let n=e.schedule??(e=>requestAnimationFrame(e)),r=!1,i=!1,a=0,o=0,s=!1,c=0,l=!1,u=e=>{try{t(e)}catch{}},d=()=>{if(i=!1,r)return;if(a===0){l&&(l=!1,u(O9({locked:s,inFrame:c,total:o,settled:!0})));return}let e=a;c=e,a=0,l=!0,i=!0,n(d),u(O9({locked:s,inFrame:e,total:o,settled:!1}))},f=e=>{k9(e.target)&&(s=e.skipped,a+=1,o+=1,!i&&(i=!0,n(d)))};return e.root.addEventListener(`contentvisibilityautostatechange`,f,{capture:!0}),()=>{r=!0,e.root.removeEventListener(`contentvisibilityautostatechange`,f,{capture:!0})}}var M9=Symbol.for(`ok.client.fetchWrapper`);function N9(e={}){if(typeof window>`u`)return;let t=e.apiOrigin&&e.apiOrigin.length>0?e.apiOrigin:void 0;if(window.fetch[M9])return;let n=window.fetch.bind(window),r=ch(),i=((e,i)=>{let a=F9(e,t);if(!a.isApi)return n(e,i);if(e instanceof Request){let t=P9(e.headers,r);return n(new Request(a.url,e),{headers:t})}let o=P9(i?.headers,r);return n(a.url,{...i,headers:o})});i[M9]=!0,window.fetch=i}function P9(e,t){let n=new Headers(e);for(let[e,r]of Object.entries(t))n.set(e,r);return n}function F9(e,t){if(typeof e==`string`){if(e.startsWith(`/api/`))return{isApi:!0,url:t?t+e:e};let n=I9(e);return n&&L9(n,t)?{isApi:!0,url:e}:{isApi:!1,url:e}}let n=e instanceof URL?e:I9(e.url,window.location.origin);if(n&&L9(n,t)){let r=e instanceof URL?e.href:e.url;return t&&(n.origin===window.location.origin||n.protocol===`file:`)?{isApi:!0,url:t+n.pathname+n.search+n.hash}:{isApi:!0,url:r}}return{isApi:!1,url:e instanceof URL?e.href:e.url}}function I9(e,t){try{return new URL(e,t)}catch{return null}}function L9(e,t){if(!e.pathname.startsWith(`/api/`))return!1;if(e.origin===window.location.origin||e.protocol===`file:`)return!0;if(t){let n=I9(t);if(n&&e.origin===n.origin)return!0}return!1}var R9=1500;function z9(e){let t=(0,$.c)(19),{operationId:n,manager:r,actions:i,platform:a}=e,o;t[0]!==r||t[1]!==n?(o=()=>r.get(n),t[0]=r,t[1]=n,t[2]=o):o=t[2];let s=(0,Q.useSyncExternalStore)(r.subscribe,o);if(s===void 0)return null;switch(s.status){case`sending`:{let e;return t[3]!==i||t[4]!==s?(e=(0,Z.jsx)(H9,{operation:s,actions:i}),t[3]=i,t[4]=s,t[5]=e):e=t[5],e}case`sent`:{let e;return t[6]!==i||t[7]!==s?(e=(0,Z.jsx)(U9,{operation:s,actions:i}),t[6]=i,t[7]=s,t[8]=e):e=t[8],e}case`email-draft`:{let e;return t[9]!==i||t[10]!==s||t[11]!==a?(e=(0,Z.jsx)(dee,{operation:s,actions:i,platform:a}),t[9]=i,t[10]=s,t[11]=a,t[12]=e):e=t[12],e}case`failed`:{let e;return t[13]!==i||t[14]!==s||t[15]!==a?(e=(0,Z.jsx)(fee,{operation:s,actions:i,platform:a}),t[13]=i,t[14]=s,t[15]=a,t[16]=e):e=t[16],e}case`already-sending`:{let e;return t[17]===i?e=t[18]:(e=(0,Z.jsx)(pee,{actions:i}),t[17]=i,t[18]=e),e}}}function B9(e){let t=(0,$.c)(5),{icon:n,children:r}=e,i;t[0]===r?i=t[1]:(i=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:r}),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,Z.jsxs)(`div`,{className:`flex w-full gap-3 rounded-lg border bg-popover p-4 text-popover-foreground shadow-lg`,children:[n,i]}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function V9(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-2`,children:n}),t[0]=n,t[1]=r),r}function H9(e){let t=(0,$.c)(21),{operation:n,actions:r}=e,i=(0,Q.useId)(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(ip,{className:`mt-0.5 size-4 shrink-0 text-primary`,"aria-hidden":`true`}),t[0]=a):a=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Y,{id:`M5_9s2`}),t[1]=o):o=t[1];let s;t[2]===i?s=t[3]:(s=(0,Z.jsx)(`p`,{id:i,className:`font-medium text-sm`,children:o}),t[2]=i,t[3]=s);let c;t[4]===n.zipSizeBytes?c=t[5]:(c=op(n.zipSizeBytes),t[4]=n.zipSizeBytes,t[5]=c);let l;t[6]===c?l=t[7]:(l=(0,Z.jsx)(`span`,{className:`ms-auto shrink-0 text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`JJcBCm`,values:{0:c}})}),t[6]=c,t[7]=l);let u;t[8]!==s||t[9]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[s,l]}),t[8]=s,t[9]=l,t[10]=u):u=t[10];let d;t[11]!==n.fillPercent||t[12]!==i?(d=(0,Z.jsx)(ja,{value:null,indeterminateFillPercent:n.fillPercent,"aria-labelledby":i,className:`h-1.5 bg-secondary`}),t[11]=n.fillPercent,t[12]=i,t[13]=d):d=t[13];let f;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(Y,{id:`1QfxQT`}),t[14]=f):f=t[14];let p;t[15]===r.dismiss?p=t[16]:(p=(0,Z.jsx)(V9,{children:(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,onClick:r.dismiss,children:f})}),t[15]=r.dismiss,t[16]=p);let m;return t[17]!==u||t[18]!==d||t[19]!==p?(m=(0,Z.jsxs)(B9,{icon:a,children:[u,d,p]}),t[17]=u,t[18]=d,t[19]=p,t[20]=m):m=t[20],m}function U9(e){let t=(0,$.c)(12),{operation:n,actions:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Uu,{className:`mt-0.5 size-4 shrink-0 text-primary`,"aria-hidden":`true`}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`p`,{className:`font-medium text-sm`,children:(0,Z.jsx)(Y,{id:`IYciRC`})}),t[1]=a):a=t[1];let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:(0,Z.jsx)(Y,{id:`2myNzt`})}),t[2]=o):o=t[2];let s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`N2C89m`})}),t[3]=s):s=t[3];let c;t[4]===n.reference?c=t[5]:(c=(0,Z.jsx)(`span`,{className:`min-w-0 select-all truncate font-mono font-medium text-xs tracking-wide`,children:n.reference}),t[4]=n.reference,t[5]=c);let l;t[6]!==r.writeToClipboard||t[7]!==n.reference?(l=(0,Z.jsx)(mee,{reference:n.reference,write:r.writeToClipboard}),t[6]=r.writeToClipboard,t[7]=n.reference,t[8]=l):l=t[8];let u;return t[9]!==c||t[10]!==l?(u=(0,Z.jsxs)(B9,{icon:i,children:[a,o,(0,Z.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1.5`,children:[s,c,l]})]}),t[9]=c,t[10]=l,t[11]=u):u=t[11],u}function dee(e){let t=(0,$.c)(16),{operation:n,actions:r,platform:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(ap,{className:`mt-0.5 size-4 shrink-0 text-primary`,"aria-hidden":`true`}),t[0]=a):a=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`p`,{className:`font-medium text-sm`,children:(0,Z.jsx)(Y,{id:`6zzhQL`})}),t[1]=o):o=t[1];let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:(0,Z.jsx)(Y,{id:`Udgz4J`})}),t[2]=s):s=t[2];let c;t[3]!==r||t[4]!==n.mailtoUrl?(c=()=>r.openExternal(n.mailtoUrl),t[3]=r,t[4]=n.mailtoUrl,t[5]=c):c=t[5];let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Y,{id:`GuaJb-`}),t[6]=l):l=t[6];let u;t[7]===c?u=t[8]:(u=(0,Z.jsx)(X,{size:`sm`,onClick:c,children:l}),t[7]=c,t[8]=u);let d;t[9]!==r.revealInFileManager||t[10]!==n.zipPath||t[11]!==i?(d=(0,Z.jsx)(W9,{zipPath:n.zipPath,platform:i,onReveal:r.revealInFileManager}),t[9]=r.revealInFileManager,t[10]=n.zipPath,t[11]=i,t[12]=d):d=t[12];let f;return t[13]!==u||t[14]!==d?(f=(0,Z.jsxs)(B9,{icon:a,children:[o,s,(0,Z.jsxs)(V9,{children:[u,d]})]}),t[13]=u,t[14]=d,t[15]=f):f=t[15],f}function fee(e){let t=(0,$.c)(17),{operation:n,actions:r,platform:i}=e,{mailtoUrl:a}=n,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(jd,{className:`mt-0.5 size-4 shrink-0 text-destructive`,"aria-hidden":`true`}),t[0]=o):o=t[0];let s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(`p`,{className:`font-medium text-sm`,children:(0,Z.jsx)(Y,{id:`Wi-VWy`})}),t[1]=s):s=t[1];let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:(0,Z.jsx)(Y,{id:`r7tQuq`})}),t[2]=c):c=t[2];let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Y,{id:`KDw4GX`}),t[3]=l):l=t[3];let u;t[4]===r.retry?u=t[5]:(u=(0,Z.jsx)(X,{size:`sm`,onClick:r.retry,children:l}),t[4]=r.retry,t[5]=u);let d;t[6]!==r||t[7]!==a?(d=a!==void 0&&(0,Z.jsx)(X,{size:`sm`,variant:`outline`,onClick:()=>r.openExternal(a),children:(0,Z.jsx)(Y,{id:`GuaJb-`})}),t[6]=r,t[7]=a,t[8]=d):d=t[8];let f;t[9]!==r.revealInFileManager||t[10]!==n.zipPath||t[11]!==i?(f=(0,Z.jsx)(W9,{zipPath:n.zipPath,platform:i,onReveal:r.revealInFileManager}),t[9]=r.revealInFileManager,t[10]=n.zipPath,t[11]=i,t[12]=f):f=t[12];let p;return t[13]!==u||t[14]!==d||t[15]!==f?(p=(0,Z.jsxs)(B9,{icon:o,children:[s,c,(0,Z.jsxs)(V9,{children:[u,d,f]})]}),t[13]=u,t[14]=d,t[15]=f,t[16]=p):p=t[16],p}function pee(e){let t=(0,$.c)(6),{actions:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(rp,{className:`mt-0.5 size-4 shrink-0 text-primary`,"aria-hidden":`true`}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`p`,{className:`font-medium text-sm`,children:(0,Z.jsx)(Y,{id:`8W9CF6`})}),t[1]=i):i=t[1];let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:(0,Z.jsx)(Y,{id:`7WnfoD`})}),t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Y,{id:`1QfxQT`}),t[3]=o):o=t[3];let s;return t[4]===n.dismiss?s=t[5]:(s=(0,Z.jsxs)(B9,{icon:r,children:[i,a,(0,Z.jsx)(V9,{children:(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,onClick:n.dismiss,children:o})})]}),t[4]=n.dismiss,t[5]=s),s}function W9(e){let t=(0,$.c)(8),{zipPath:n,platform:r,onReveal:i}=e,a;t[0]!==i||t[1]!==n?(a=()=>i(n),t[0]=i,t[1]=n,t[2]=a):a=t[2];let o;t[3]===r?o=t[4]:(o=Rg(r),t[3]=r,t[4]=o);let s;return t[5]!==a||t[6]!==o?(s=(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,onClick:a,children:o}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function mee(e){let t=(0,$.c)(15),{reference:n,write:r}=e,{_:i}=Bn(),[a,o]=(0,Q.useState)(0),s=a>0,c,l;t[0]===a?(c=t[1],l=t[2]):(c=()=>{if(a===0)return;let e=setTimeout(()=>o(0),R9);return()=>clearTimeout(e)},l=[a],t[0]=a,t[1]=c,t[2]=l),(0,Q.useEffect)(c,l);let u;t[3]!==n||t[4]!==r?(u=()=>{Promise.resolve().then(()=>r(n)).then(()=>o(gee),hee)},t[3]=n,t[4]=r,t[5]=u):u=t[5];let d=u,f;t[6]!==i||t[7]!==s?(f=i(s?{id:`PiH3UR`}:{id:`5hFl0U`}),t[6]=i,t[7]=s,t[8]=f):f=t[8];let p;t[9]===s?p=t[10]:(p=s?(0,Z.jsx)(Uu,{className:`size-3.5`,"aria-hidden":`true`}):(0,Z.jsx)(Fn,{className:`size-3.5`,"aria-hidden":`true`}),t[9]=s,t[10]=p);let m;return t[11]!==d||t[12]!==f||t[13]!==p?(m=(0,Z.jsx)(X,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":f,onClick:d,children:p}),t[11]=d,t[12]=f,t[13]=p,t[14]=m):m=t[14],m}function hee(){}function gee(e){return e+1}var _ee=8e3;function vee(e){switch(e){case`sent`:case`already-sending`:return _ee;case`sending`:case`email-draft`:case`failed`:return 1/0}}var G9=!1;function yee(e={}){let t=e.manager??sp;if(t===sp){if(G9)return()=>{};G9=!0}let n=e.bridge,r=new Map;function i(e){return{dismiss:()=>{Dc.dismiss(e)},retry:()=>{t.retryBugReportSend(e)},openExternal:e=>{n?.shell.openExternal(e)},revealInFileManager:e=>{n?.shell.showItemInFolder(e)},writeToClipboard:_r}}function a(e){let{operationId:a,status:o,requestSeq:s}=e;Dc.custom(()=>(0,Q.createElement)(z9,{operationId:a,manager:t,actions:i(a),platform:n?.platform}),{id:a,duration:vee(o)}),r.set(a,{status:o,requestSeq:s})}let o=t.subscribe(()=>{for(let e of t.getSnapshot()){let t=r.get(e.operationId);t!==void 0&&t.status===e.status&&t.requestSeq===e.requestSeq||a(e)}});return()=>{o(),t===sp&&(G9=!1)}}var K9=Symbol.for(`ok.client.logForwarder`),bee=2e3,q9=[`log`,`info`,`warn`,`error`],xee={log:`info`,info:`info`,warn:`warn`,error:`error`};function J9(e){if(typeof e==`string`)return e;if(e instanceof Error)return`${e.name}: ${e.message}`;try{return JSON.stringify(e)??String(e)}catch{return String(e)}}function Y9(e){let t=e.message.length+80;if(e.event&&(t+=e.event.length),e.fields)try{t+=JSON.stringify(e.fields).length}catch{}return t}function See(e={}){let t=e.windowObj??(typeof window<`u`?window:void 0);if(!t||t.okDesktop)return;let n=t;if(n[K9])return;n[K9]=!0;let r=e.consoleObj??console,i=e.documentObj===void 0?typeof document<`u`?document:null:e.documentObj,a=e.flushIntervalMs??bee,o=e.fetchImpl??n.fetch.bind(n),s=e.now??Date.now,c=[],l=0,u=null,d=!1,f=0,p={log:r.log.bind(r),info:r.info.bind(r),warn:r.warn.bind(r),error:r.error.bind(r)};function m(){if(u!==null&&(clearTimeout(u),u=null),c.length===0)return;let e=c.splice(0,100);l=0;let t=f;d=!0;try{o(`/api/client-logs`,{method:`POST`,headers:{"content-type":`application/json`},keepalive:!0,body:JSON.stringify(t>0?{entries:e,droppedSinceLastFlush:t}:{entries:e})}).then(n=>{n.ok?f=Math.max(0,f-t):f+=e.length},()=>{f+=e.length})}catch{f+=e.length}finally{d=!1}}function h(e){if(c.push(e),l+=Y9(e),c.length>100){let e=c.shift();e&&(l-=Y9(e),f+=1)}if(c.length>=100||l>=32768){m();return}u===null&&(u=setTimeout(m,a))}function g(e,t){if(!d)try{let n=no(Tc(t.map(J9).join(` `))),r=t[0],i=typeof r==`string`&&r.length<=32768?r:void 0,a=i?rs(i):null,o=a?.fields;if(o)try{JSON.stringify(o).length>8192&&(o=void 0)}catch{o=void 0}h({level:e,message:n,ts:s(),...a?.event?{event:a.event}:{},...o?{fields:o}:{}})}catch{}}for(let e of q9)r[e]=(...t)=>{p[e](...t),g(xee[e],t)};let _=e=>{if(d)return;let t=e;g(`error`,[`uncaught error: ${t.message} (${t.filename}:${t.lineno}:${t.colno})`])},v=e=>{d||g(`error`,[`unhandledrejection: ${J9(e.reason)}`])},y=()=>m(),b=()=>{i&&i.visibilityState===`hidden`&&m()};n.addEventListener(`error`,_),n.addEventListener(`unhandledrejection`,v),n.addEventListener(`pagehide`,y),i&&i.addEventListener(`visibilitychange`,b);function x(){for(let e of q9)r[e]=p[e];n.removeEventListener(`error`,_),n.removeEventListener(`unhandledrejection`,v),n.removeEventListener(`pagehide`,y),i&&i.removeEventListener(`visibilitychange`,b),u!==null&&(clearTimeout(u),u=null),c.length=0,delete n[K9]}return{flushNow:m,uninstall:x}}function Cee(e,t){if(e.branch===void 0||e.branch===null||e.branch===``||t===``||e.multiCandidate!==!0)return null;let n=e.branch;return{message:Hc._({id:`n5Vy3l`,values:{branch:n}}),description:t}}function wee(e){let t=e.bridge;if(!t)return;let n=e.setHash??(e=>{window.location.hash=e}),r=e.emitToast??((e,t)=>{Dc(e,t)});return t.onDeepLink(e=>{let i=e.kind??`doc`,a={kind:i,path:e.doc,repositoryPath:e.repositoryPath??e.doc,...e.contentRootDepth===void 0?{}:{contentRootDepth:e.contentRootDepth},branch:e.branch??null};if(e.targetMissing===!0){lp.arm(a);return}Ef.arm(a),n(Gp(i,e.doc,i===`doc`?e.branch:void 0));let o=Cee(e,t.config.projectPath);o!==null&&r(o.message,{description:o.description,duration:3e3})})}var X9=4e3,Z9=1440*60*1e3;function Tee(e){let t=e.bridge;if(t&&t.onboarding)return t.onboarding.onToast(e=>{if(e.kind===`ancestor-promote`){let t=e.ancestorPath;Dc.success(Hc._({id:`hAbGf0`,values:{ancestorPath:t}}),{duration:X9});return}if(e.kind===`startup-reclaim`){let t=[];if(e.mcp.status===`repaired`){let n=e.mcp.editors.map(e=>nc[e]??e).join(`, `);t.push(Hc._({id:`FK57sK`,values:{names:n}}))}else e.mcp.status===`failed`&&t.push(Hc._({id:`DMLE5q`}));if(e.path.status===`installed`&&t.push(e.path.summary),e.path.status===`failed`){let n=e.path.summary;t.push(Hc._({id:`L83DKQ`,values:{summary:n}}))}let n=t.length>0?t.join(`; `):Hc._({id:`-X1eoK`}),r=e.mcp.status===`failed`||e.path.status===`failed`,i=e.path.status!==`none`;Dc[r?`error`:`success`](n,{duration:r||i?Z9:X9,position:`bottom-left`});return}if(e.kind===`sharing-refused-tracked`){let t=e.tracked.length;Dc.error(Hc._({id:`LlJ8LD`,values:{trackedCount:t}}),{duration:Z9,description:e.remediation});return}if(e.kind===`sharing-no-git`){Dc.warning(Hc._({id:`GU1Y4A`}),{duration:X9});return}let t=Th(e.gitRoot,e.pickedPath)??e.pickedPath,n=e.gitRoot;Dc.success(Hc._({id:`pZ91JC`,values:{gitRoot:n,subPath:t}}),{duration:X9})})}function Eee(e){return Hc._({id:`wXw19Y`,values:{projectName:e}})}function Dee(e){let t=e.bridge;if(t)return t.onRecentRemovedMissing(({projectName:e})=>{Dc(Eee(e))})}function Oee(e){let t=(0,$.c)(18),{body:n,warning:r,restartLabel:i,cancelLabel:a,onRestart:o,onDismiss:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Lp,{className:`mt-0.5 size-4 shrink-0 text-amber-500`}),t[0]=c):c=t[0];let l;t[1]===n?l=t[2]:(l=(0,Z.jsx)(`p`,{className:`font-medium text-sm`,children:n}),t[1]=n,t[2]=l);let u;t[3]===r?u=t[4]:(u=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:r}),t[3]=r,t[4]=u);let d;t[5]!==o||t[6]!==i?(d=(0,Z.jsx)(X,{size:`sm`,onClick:o,children:i}),t[5]=o,t[6]=i,t[7]=d):d=t[7];let f;t[8]!==a||t[9]!==s?(f=(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,onClick:s,children:a}),t[8]=a,t[9]=s,t[10]=f):f=t[10];let p;t[11]!==d||t[12]!==f?(p=(0,Z.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-2`,children:[d,f]}),t[11]=d,t[12]=f,t[13]=p):p=t[13];let m;return t[14]!==l||t[15]!==u||t[16]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex w-full gap-3 rounded-lg border bg-popover p-4 text-popover-foreground shadow-lg`,children:[c,(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[l,u,p]})]}),t[14]=l,t[15]=u,t[16]=p,t[17]=m):m=t[17],m}function kee(){return Hc._({id:`f_PkYv`})}function Aee(e){return e.serverRuntime===e.appRuntime?Hc._({id:`FWQuPE`,values:{0:e.appRuntime}}):e.relation===`older`?Hc._({id:`LhQlGR`,values:{0:e.serverRuntime,1:e.appRuntime}}):Hc._({id:`yZmvQ4`,values:{0:e.serverRuntime,1:e.appRuntime}})}function jee(e){return Hc._({id:`2YOwme`,values:{appRuntime:e}})}function Mee(e){return e===`eperm`?Hc._({id:`uQewpR`}):Hc._({id:`PqYWiC`})}async function Nee(e){let t=Dc.loading(Hc._({id:`Kf7GG5`}),{duration:1/0}),n;try{n=await e.restartServer(e.config.projectPath)}catch{return}Dc.dismiss(t),n.ok===!1&&Dc.error(Mee(n.reason),{duration:1/0})}function Pee(e){let t=e.bridge;if(!t)return;let n=t.onServerVersionDrift(e=>{Dc.custom(n=>(0,Q.createElement)(Oee,{body:Aee(e),warning:kee(),restartLabel:Hc._({id:`ppDgFi`}),cancelLabel:Hc._({id:`PBxg_E`}),onRestart:()=>{Dc.dismiss(n),Nee(t)},onDismiss:()=>Dc.dismiss(n)}),{duration:1/0})}),r=t.onServerRestarted(e=>{Dc.success(jee(e.appRuntime))});return()=>{n(),r()}}async function Fee(e=typeof navigator<`u`?navigator:void 0){try{let t=e?.storage;return t===void 0||typeof t.persist!=`function`?!1:await t.persist()}catch{return!1}}function Iee(e){let{initialDoc:t}=e;if(!t)return;let n=e.getHash();n!==``&&n!==`#`&&n!==`#/`||e.setHash(qp(t))}function Lee(){typeof window>`u`||!window.okDesktop||Iee({initialDoc:window.okDesktop.config.initialDoc,getHash:()=>window.location.hash,setHash:e=>{window.location.hash=e}})}U_(),n(()=>import(`./telemetry-startup-C_zn8gFF.js`).then(e=>e.initStartupTrace()),__vite__mapDeps([236,0,1,2,3,4,5,59,28,29,30,31,32,33,18,9,8]),import.meta.url),N9({apiOrigin:typeof window<`u`?window.okDesktop?.config.apiOrigin:void 0}),See(),Fee(),rN()&&lN(),mW(),Lj(),DH(),pH(),typeof window<`u`&&window.okDesktop!==void 0&&Nr(),xV(),typeof window<`u`&&wee({bridge:window.okDesktop}),typeof window<`u`&&Pee({bridge:window.okDesktop}),typeof window<`u`&&Dee({bridge:window.okDesktop}),typeof window<`u`&&R_({bridge:window.okDesktop}),typeof window<`u`&&wh({bridge:window.okDesktop}),typeof window<`u`&&Tee({bridge:window.okDesktop}),typeof window<`u`&&H_({bridge:window.okDesktop}),typeof window<`u`&&C9({bridge:window.okDesktop}),typeof window<`u`&&yee({bridge:window.okDesktop}),Lee();var Ree=new J_({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),Q9=document.getElementById(`root`);if(!Q9)throw Error(`Root element not found`);var $9=typeof window>`u`?void 0:window.okDesktop;function zee(){return to(),null}j9({root:document}),(0,Y_.createRoot)(Q9).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(Vn,{i18n:Hc,children:(0,Z.jsxs)(Qn,{client:Ree,children:[(0,Z.jsx)(Cy,{}),(0,Z.jsxs)(cr,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(zee,{}),(0,Z.jsxs)(Hr,{children:[(0,Z.jsx)(yy,{children:b9($9)}),$9!==void 0&&(0,Z.jsx)(xy,{children:(0,Z.jsx)(w9,{bridge:$9})}),(0,Z.jsx)(T9,{richColors:!0,closeButton:!0})]})]})]})})}));export{zW as t};
2203
+ `,F8=null,I8=3e3,L8=null,R8=null;function z8(e){e.current=performance.now()+50}function B8(e){return performance.now()<e.current}function V8(e,t=new Map){let n=e.endsWith(`/`),r=(n?e.slice(0,-1):e).split(`/`),i=r[0]??``,a=r.length>=2?r[1]:void 0;if(!(a!==void 0&&t.has(`${i}/${a}`)))return{scopeLabel:i,group:void 0,skillDisplay:a,sub:r.length>=3?r.slice(2).join(`/`):null,isGroupRow:!1,inProvenanceGroup:!1,isDir:n};let o=r.length>=3?r[2]:void 0,s=o!==void 0&&t.has(`${i}/${a}/${o}`),c=s?`${a}/${o}`:a,l=s?3:2;return{scopeLabel:i,group:c,skillDisplay:r.length>l?r[l]:void 0,sub:r.length>l+1?r.slice(l+1).join(`/`):null,isGroupRow:r.length===(s?3:2),inProvenanceGroup:!0,isDir:n}}function H8(e){let t=(0,$.c)(12),{scope:n,name:r,pinned:i,onToggle:a}=e,o;t[0]!==r||t[1]!==a||t[2]!==i||t[3]!==n?(o=()=>a(n,r,!i),t[0]=r,t[1]=a,t[2]=i,t[3]=n,t[4]=o):o=t[4];let s,c;t[5]===i?(s=t[6],c=t[7]):(s=i?(0,Z.jsx)(pb,{"aria-hidden":!0}):(0,Z.jsx)(mb,{"aria-hidden":!0}),c=i?(0,Z.jsx)(Y,{id:`nWMRxa`}):(0,Z.jsx)(Y,{id:`arNEY0`}),t[5]=i,t[6]=s,t[7]=c);let l;return t[8]!==o||t[9]!==s||t[10]!==c?(l=(0,Z.jsxs)(ca,{onSelect:o,children:[s,c]}),t[8]=o,t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function U8(e){let t=(0,$.c)(209),{paths:n,activePath:r,initialExpandedPaths:i,onExpandedChange:a,sort:o,skillByPrefix:s,detectedByPrefix:c,groupByPrefix:l,pinnedPrefixes:u,labelToScope:d,scopeDescription:f,existingNames:p,actions:m,onOpenSkillMd:h,onOpenFile:g,onOpenDetected:_,onOpenManaged:v,onNewSkill:y,onAddSkill:b,isPinned:x,onTogglePin:S}=e,{_:C}=Bn(),{resolvedTheme:w}=sr(),T=(0,Q.useRef)(null),E=(0,Q.useRef)(null),[D,O]=(0,Q.useState)(!1),k,A;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>O(!0),A=[],t[0]=k,t[1]=A):(k=t[0],A=t[1]),(0,Q.useEffect)(k,A);let[j,M]=(0,Q.useState)(null),N;t[2]===s?N=t[3]:(N=[...s.values()].map(t5),t[2]=s,t[3]=N);let P=N.join(`|`),F=e5,I;t[4]===s?I=t[5]:(I=e=>{let t=F(e);return t===void 0?void 0:s.get(t)},t[4]=s,t[5]=I);let L=I,R;t[6]===c?R=t[7]:(R=e=>{let t=F(e);return t===void 0?void 0:c.get(t)},t[6]=c,t[7]=R);let z=R,B;t[8]!==C||t[9]!==z||t[10]!==l||t[11]!==d||t[12]!==L?(B=e=>{let t=V8(e,l);if(t.isGroupRow){let e=t.group?l.get(`${t.scopeLabel}/${t.group}`):void 0;if(!e)return null;if(e.kind===`plugin`)return e.url?C({id:`sAP9XO`,values:{0:e.id,1:e.url}}):C({id:`dFrqBg`,values:{0:e.id}});let n=e.publisher?`${e.publisher}/${e.id}`:e.id;return e.url?C({id:`c9-Pi9`,values:{source:n}}):C({id:`8Z_GCT`,values:{source:n}})}if(t.skillDisplay===void 0)return null;let n=z(t);if(n){let e=d.get(t.scopeLabel)??`global`,r=n.sourceHarnesses.map(n=>`${nh(n,e)}/${t.skillDisplay}`);return t.sub?r.map(e=>`${e}/${t.sub}`).join(`, `):r.join(`, `)}let r=L(t);if(!r)return null;if(r.managed){let e=r.absolutePath?eh(rh(r.absolutePath)):null;return e?t.sub?`${e}/${t.sub}`:e:null}return $m(r).map(e=>{let n=t.sub?`${e.dir}/${t.sub}`:e.dir;return e.symlink?C({id:`leiGnv`,values:{dir:n}}):n}).join(`, `)},t[8]=C,t[9]=z,t[10]=l,t[11]=d,t[12]=L,t[13]=B):B=t[13];let V=B,ee;t[14]!==l||t[15]!==s?(ee=e=>{if(!e.isGroupRow||e.group===void 0)return[];let t=`${e.scopeLabel}/${e.group}`;return f8({groupPrefix:t,bucket:l.get(t),skillByPrefix:s})},t[14]=l,t[15]=s,t[16]=ee):ee=t[16];let H=ee,U;t[17]!==z||t[18]!==l||t[19]!==d||t[20]!==L||t[21]!==H?(U=e=>{if(!d.get(e.scopeLabel))return!1;if(e.isGroupRow)return H(e).length>0||e.group!==void 0&&l.has(`${e.scopeLabel}/${e.group}`);if(e.skillDisplay===void 0||z(e))return!0;let t=L(e);return t?t.managed?e.sub===null:!0:!1},t[17]=z,t[18]=l,t[19]=d,t[20]=L,t[21]=H,t[22]=U):U=t[22];let W=U,G;t[23]===C?G=t[24]:(G=(e,t)=>{if(!e)return null;if(e.kind===`plugin`){if(!t){if(!e.parent)return null;let t={kind:`source`,id:e.parent.id,publisher:e.parent.publisher,url:e.parent.url};return G(t,!1)}let n=e.id,r=e.url??e.parent?.url??null;return r===null?{kind:`plugin`,title:C({id:`3l32hp`,values:{plugin:n}})}:{kind:`plugin`,title:C({id:`LGvaif`,values:{plugin:n}}),href:r}}let n=e.publisher;if(!n){if(!t)return null;let n=e.id;return{kind:`library`,title:e.url?C({id:`c9-Pi9`,values:{source:n}}):C({id:`8Z_GCT`,values:{source:n}}),...e.url===null?{}:{href:e.url}}}return{kind:`publisher`,login:n,title:e.url===null?C({id:`nWS2gQ`,values:{publisher:n}}):C({id:`2QoAQ-`,values:{publisher:n}}),...e.url===null?{}:{href:e.url}}},t[23]=C,t[24]=G);let te;t[25]!==C||t[26]!==z||t[27]!==l||t[28]!==G||t[29]!==u||t[30]!==L?(te=e=>{let t=V8(e,l);if(!t.inProvenanceGroup&&t.skillDisplay!==void 0&&t.sub===null&&u.has(`${t.scopeLabel}/${t.skillDisplay}`))return{kind:`pin`,title:C({id:`kNiQp6`})};if(t.isGroupRow)return G(l.get(`${t.scopeLabel}/${t.group}`)??null,!0);if(t.inProvenanceGroup||t.skillDisplay===void 0||t.sub!==null)return null;let n=L(t);if(n)return G(b8(n),!1);let r=z(t);return G(r?x8(r):null,!1)},t[25]=C,t[26]=z,t[27]=l,t[28]=G,t[29]=u,t[30]=L,t[31]=te):te=t[31];let ne=te,re=(0,Q.useRef)(W),K;t[32]===W?K=t[33]:(K=()=>{re.current=W},t[32]=W,t[33]=K),(0,Q.useEffect)(K);let ie=(0,Q.useRef)(l),q;t[34]===l?q=t[35]:(q=()=>{ie.current=l},t[34]=l,t[35]=q),(0,Q.useEffect)(q);let ae=(0,Q.useRef)(d),oe;t[36]===d?oe=t[37]:(oe=()=>{ae.current=d},t[36]=d,t[37]=oe),(0,Q.useEffect)(oe);let se;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(se=[],t[38]=se):se=t[38];let ce=(0,Q.useRef)(se),le;t[39]!==z||t[40]!==l||t[41]!==n||t[42]!==L?(le=()=>{let e=[],t=new Set;for(let r of n){let n=V8(r,l);if(n.skillDisplay===void 0||n.isGroupRow||L(n)===void 0&&z(n)===void 0)continue;let i=`${n.group===void 0?n.scopeLabel:`${n.scopeLabel}/${n.group}`}/${n.skillDisplay}/`;t.has(i)||(t.add(i),e.push(i))}ce.current=e},t[39]=z,t[40]=l,t[41]=n,t[42]=L,t[43]=le):le=t[43],(0,Q.useEffect)(le);let ue=$8,de;t[44]!==C||t[45]!==z||t[46]!==l||t[47]!==d||t[48]!==L?(de=e=>{let t=V8(e,l);if(t.skillDisplay===void 0||t.sub!==null)return null;let n=z(t);if(n){let e=d.get(t.scopeLabel)??`global`;return{kind:`icons`,poolKeys:n.sourceHarnesses.map(ue),title:C({id:`W3Tsgy`,values:{0:n.sourceHarnesses.map(t=>nh(t,e)).join(`, `)}})}}let r=L(t);if(!r)return null;let i=Qm(r);return i.length>0?{kind:`icons`,poolKeys:i.map(ue),title:C({id:`h2N-1n`,values:{0:i.map(e=>nh(e,r.scope)).join(`, `)}})}:r.managed?null:{kind:`install`,title:C({id:`fGqEFq`,values:{0:r.name}})}},t[44]=C,t[45]=z,t[46]=l,t[47]=d,t[48]=L,t[49]=de):de=t[49];let pe=de,J;t[50]!==z||t[51]!==l||t[52]!==L?(J=e=>{let t=V8(e,l);if(t.skillDisplay===void 0||t.sub!==null||t.isGroupRow||z(t))return null;let n=L(t);return n&&!n.managed?n:null},t[50]=z,t[51]=l,t[52]=L,t[53]=J):J=t[53];let me=J,he;t[54]===C?he=t[55]:(he=C({id:`TKQ7K-`}),t[54]=C,t[55]=he);let ge;t[56]!==pe||t[57]!==z||t[58]!==me||t[59]!==ne||t[60]!==L||t[61]!==he?(ge={decorForPath:pe,skillFor:L,detectedFor:z,markForPath:ne,draggableEntryFor:me,installLabel:he},t[56]=pe,t[57]=z,t[58]=me,t[59]=ne,t[60]=L,t[61]=he,t[62]=ge):ge=t[62];let _e=(0,Q.useRef)(ge),ve;t[63]!==C||t[64]!==pe||t[65]!==z||t[66]!==me||t[67]!==ne||t[68]!==L?(ve=()=>{_e.current={decorForPath:pe,skillFor:L,detectedFor:z,markForPath:ne,draggableEntryFor:me,installLabel:C({id:`TKQ7K-`})}},t[63]=C,t[64]=pe,t[65]=z,t[66]=me,t[67]=ne,t[68]=L,t[69]=ve):ve=t[69],(0,Q.useEffect)(ve);let ye=(0,Q.useRef)(Q8),be=(0,Q.useRef)(null),xe;if(t[70]!==C||t[71]!==r||t[72]!==z||t[73]!==l||t[74]!==i||t[75]!==n){let e;t[77]!==C||t[78]!==z||t[79]!==l?(e=e=>{let{item:t}=e,n=V8(t.path,l);if(n.skillDisplay===void 0||n.sub!==null)return null;let r=z(n);return r?.provenance.plugin!==void 0&&!n.inProvenanceGroup?{icon:M8,title:C({id:`AkA6DO`,values:{0:r.provenance.plugin}})}:null},t[77]=C,t[78]=z,t[79]=l,t[80]=e):e=t[80],xe=B2({paths:n,initialExpansion:`closed`,initialExpandedPaths:i,initialSelectedPaths:r?[r]:void 0,stickyFolders:!1,enableContextMenu:!0,unsafeCSS:`${z2}\n${P8}\n${G6}\n${c8}`,extraSpriteSymbols:N8,renderRowDecoration:e}),t[70]=C,t[71]=r,t[72]=z,t[73]=l,t[74]=i,t[75]=n,t[76]=xe}else xe=t[76];let Se;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(Se=e=>ye.current(e),t[81]=Se):Se=t[81];let Ce;t[82]!==o||t[83]!==xe?(Ce={...xe,onSelectionChange:Se,sort:o,flattenEmptyDirectories:!1},t[82]=o,t[83]=xe,t[84]=Ce):Ce=t[84];let{model:we}=m0(Ce),Te;t[85]===we?Te=t[86]:(Te=e=>we.getItem(e)?.deselect(),t[85]=we,t[86]=Te);let Ee=Te,De=(0,Q.useRef)(r),Oe;t[87]===r?Oe=t[88]:(Oe=()=>{De.current=r},t[87]=r,t[88]=Oe),(0,Q.useEffect)(Oe);let ke;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(ke=new Set,t[89]=ke):ke=t[89];let[Ae,je]=(0,Q.useState)(ke),Me=(0,Q.useRef)(Ae),Ne;t[90]===Ae?Ne=t[91]:(Ne=()=>{Me.current=Ae},t[90]=Ae,t[91]=Ne),(0,Q.useEffect)(Ne);let Pe=(0,Q.useRef)(0),Fe;t[92]!==r||t[93]!==Ee?(Fe=()=>{let e=Me.current;Me.current=new Set,z8(Pe);for(let t of e)t!==r&&Ee(t);e.size>0&&je(new Set)},t[92]=r,t[93]=Ee,t[94]=Fe):Fe=t[94];let Ie=Fe,[Le,Re]=(0,Q.useState)(null),ze=Zf(),Be;t[95]!==C||t[96]!==ze?(Be=async function(e,t){let n=await Vm({source:rh(e.files.skillMd),skill:e.name,scope:t,install:!1});if(!n.ok){let e=n.error;Dc.error(C({id:`Uw6ERJ`,values:{detail:e}}));return}ze(t,n.name)},t[95]=C,t[96]=ze,t[97]=Be):Be=t[97];let Ve=Be,He;t[98]!==C||t[99]!==Ie?(He=async function(e,t){let n=0;for(let r of e){let e=await zm({name:r.name,fromScope:r.scope,toScope:t});e.ok?n+=1:Dc.error(C({id:`gLjtu3`,values:{0:r.name,1:e.error}}))}n>0&&Dc.success(C(t===`global`?{id:`X0c6kF`,values:{moved:n}}:{id:`ZOVgDv`,values:{moved:n}})),Ie()},t[98]=C,t[99]=Ie,t[100]=He):He=t[100];let Ue=He,We=(0,Q.useRef)(Ue),Ge;t[101]===Ue?Ge=t[102]:(Ge=()=>{We.current=Ue},t[101]=Ue,t[102]=Ge),(0,Q.useEffect)(Ge);let Ke=(0,Q.useRef)(!1),qe=(0,Q.useRef)(0),Je;t[103]!==we||t[104]!==D||t[105]!==Ee?(Je=()=>{if(!D)return;let e=T.current?.querySelector(cK)?.shadowRoot;if(!e)return;let t=e=>{let t=(e.target?.closest?.(`[data-item-path]`))?.getAttribute(`data-item-path`);if(!t)return null;let n=V8(t,ie.current);return n.skillDisplay===void 0||n.sub!==null||n.isGroupRow||!_e.current.skillFor(n)&&!_e.current.detectedFor(n)?null:t},n=e=>!(e instanceof MouseEvent)||!(e.metaKey||e.ctrlKey)?null:t(e),r=e=>!(e instanceof MouseEvent)||!e.shiftKey||e.metaKey||e.ctrlKey?null:t(e),i=!1,a=e=>{Me.current=e,je(e),z8(Pe);for(let t of we.getSelectedPaths())!e.has(t)&&t!==De.current&&Ee(t);for(let t of e)we.getItem(t)?.select()},o=e=>{i=!1;let o=e.target;if(Ke.current=o?.closest?.(`[data-item-section='icon']`)!=null,e instanceof MouseEvent&&e.button===0&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!Ke.current){let n=o?.closest?.(`[data-item-path]`)?.getAttribute(`data-item-path`);n&&(F8={path:n,at:performance.now()},t(e)!==null&&(L8=n,R8=null))}let s=r(e);if(s!==null&&L8!==null){let t=u(),n=t.indexOf(L8),r=t.indexOf(s);if(n!==-1&&r!==-1){e.preventDefault(),e.stopImmediatePropagation(),i=!0,R8=s;let[o,c]=n<=r?[n,r]:[r,n],l=L8.split(`/`)[0];a(new Set(t.slice(o,c+1).filter(e=>e.split(`/`)[0]===l)));return}}let c=n(e);if(c===null)return;e.preventDefault(),e.stopImmediatePropagation(),i=!0,L8=c,R8=null;let l=new Set(Me.current),d=!l.has(c);d?l.add(c):l.delete(c),Me.current=l,je(l),z8(Pe),d?we.getItem(c)?.select():c!==De.current&&Ee(c)},s=e=>{i&&(i=!1,e.preventDefault(),e.stopImmediatePropagation())},c=[],l=e=>{if(!(e instanceof MouseEvent)||e.button!==0)return;let t=e.target;if(t?.closest?.(`[data-item-section='icon']`)!=null)return;let n=(t?.closest?.(`[data-item-path]`))?.getAttribute(`data-item-path`);if(!n)return;let r=qe.current;c.push(setTimeout(()=>{qe.current===r&&(Ke.current=!1,ye.current([n]))},250))},u=()=>{let t=new Set(ce.current),n=[];for(let r of e.querySelectorAll(`[data-item-path]`)){let e=r.getAttribute(`data-item-path`);e!==null&&t.has(e)&&n.push(e)}return n.length>0?n:ce.current},d=e=>{if(!(e instanceof KeyboardEvent))return;let t=e.key.toLowerCase();if(!e.altKey&&!e.shiftKey&&(e.metaKey&&!e.ctrlKey&&t===`backspace`||!e.metaKey&&!e.ctrlKey&&t===`delete`)&&Me.current.size>0){if(e.target?.closest?.(`[contenteditable], input, textarea, [role="textbox"]`))return;let t=[...Me.current].map(e=>_e.current.skillFor(V8(e,ie.current))).filter(Z8);if(t.length===0)return;e.preventDefault(),e.stopImmediatePropagation(),Re(t);return}if(!e.shiftKey||e.key!==`ArrowDown`&&e.key!==`ArrowUp`||e.target?.closest?.(`[contenteditable], input, textarea, [role="textbox"]`))return;let n=T.current?.contains(document.activeElement);if(Me.current.size===0&&!n)return;if(L8===null&&De.current!==void 0){let e=V8(De.current,ie.current);e.skillDisplay!==void 0&&(L8=`${e.group===void 0?e.scopeLabel:`${e.scopeLabel}/${e.group}`}/${e.skillDisplay}/`,R8=null)}if(L8===null)return;let r=L8.split(`/`)[0],i=u().filter(e=>e.split(`/`)[0]===r),o=i.indexOf(L8);if(o===-1)return;let s=R8!==null&&i.indexOf(R8)!==-1?i.indexOf(R8):o,c=Math.min(Math.max(s+(e.key===`ArrowDown`?1:-1),0),i.length-1);e.preventDefault(),e.stopImmediatePropagation(),R8=i[c];let[l,d]=o<=c?[o,c]:[c,o];a(new Set(i.slice(l,d+1)))};return e.addEventListener(`pointerdown`,o,!0),e.addEventListener(`click`,s,!0),e.addEventListener(`click`,l,!0),window.addEventListener(`keydown`,d,!0),()=>{e.removeEventListener(`pointerdown`,o,!0),e.removeEventListener(`click`,s,!0),e.removeEventListener(`click`,l,!0),window.removeEventListener(`keydown`,d,!0);for(let e of c)clearTimeout(e)}},t[103]=we,t[104]=D,t[105]=Ee,t[106]=Je):Je=t[106];let Ye;t[107]===D?Ye=t[108]:(Ye=[D],t[107]=D,t[108]=Ye),(0,Q.useEffect)(Je,Ye);let Xe=(0,Q.useRef)(null),Ze,Qe;t[109]===D?(Ze=t[110],Qe=t[111]):(Ze=()=>{if(!D)return;let e=T.current?.querySelector(cK)?.shadowRoot;if(!e)return;let t=X8,n=()=>{for(let t of e.querySelectorAll(`[data-ok-drop-scope]`))t.removeAttribute(`data-ok-drop-scope`)},r=e=>{let n=Xe.current,r=t(e);if(!n||!r)return null;let i=V8(r,ie.current),a=ae.current.get(i.scopeLabel);return a===void 0||a===n.fromScope?null:{scope:a,label:i.scopeLabel}},i=e=>{if(!(e instanceof DragEvent))return;let n=t(e),r=n===null?null:_e.current.draggableEntryFor(n);if(n===null||r===null){e.preventDefault();return}let i=[r],a=Me.current;if(a.has(n)&&a.size>1){let e=[...a].map(e=>_e.current.draggableEntryFor(e)).filter(e=>e!==null&&e.scope===r.scope);e.length>1&&(i=e)}Xe.current={entries:i,fromScope:r.scope},e.dataTransfer&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,i.map(Y8).join(`, `)))},a=t=>{if(!(t instanceof DragEvent))return;let i=r(t);n(),i!==null&&(t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect=`move`),e.querySelector(`[data-item-path="${i.label}/"]`)?.setAttribute(`data-ok-drop-scope`,`true`))},o=e=>{let t=Xe.current,i=r(e);n(),Xe.current=null,!(!t||i===null)&&(e.preventDefault(),e.stopPropagation(),We.current(t.entries,i.scope))},s=()=>{n(),Xe.current=null};return e.addEventListener(`dragstart`,i,!0),e.addEventListener(`dragover`,a,!0),e.addEventListener(`drop`,o,!0),e.addEventListener(`dragend`,s,!0),()=>{e.removeEventListener(`dragstart`,i,!0),e.removeEventListener(`dragover`,a,!0),e.removeEventListener(`drop`,o,!0),e.removeEventListener(`dragend`,s,!0)}},Qe=[D],t[109]=D,t[110]=Ze,t[111]=Qe),(0,Q.useEffect)(Ze,Qe);let $e;t[112]!==r||t[113]!==z||t[114]!==l||t[115]!==we||t[116]!==_||t[117]!==g||t[118]!==v||t[119]!==h||t[120]!==Ee||t[121]!==L?($e=()=>{let e=(we.getSelectedPaths?.()??[]).filter(e=>e!==r);for(let t of e)Me.current.has(t)||Ee(t);let t=be.current!==we;be.current=we;let n=t&&F8!==null&&performance.now()-F8.at<I8&&F8.path!==r?F8.path:null;ye.current=e=>{if(qe.current+=1,F8!==null&&e[0]===F8.path&&(F8=null),B8(Pe))return;Me.current.size>0&&(Me.current=new Set,je(new Set));let t=e[0],n=Ke.current;if(Ke.current=!1,n&&t){Ee(t);return}if(!t||t===r)return;let i=V8(t,l);if(i.sub!==null&&i.isDir)return;let a=z(i);if(a){_(a,i.sub??void 0),Ee(t);return}let o=L(i);o&&(i.sub===null||i.sub===`SKILL.md`?(o.managed?v:h)(o):g(o,i.sub),Ee(t))},n!==null&&(F8=null,Ke.current=!1,ye.current([n]))},t[112]=r,t[113]=z,t[114]=l,t[115]=we,t[116]=_,t[117]=g,t[118]=v,t[119]=h,t[120]=Ee,t[121]=L,t[122]=$e):$e=t[122],(0,Q.useEffect)($e);let et;t[123]!==c||t[124]!==l||t[125]!==d||t[126]!==a||t[127]!==s?(et={labelToScope:d,skillByPrefix:s,detectedByPrefix:c,groupByPrefix:l,onExpandedChange:a},t[123]=c,t[124]=l,t[125]=d,t[126]=a,t[127]=s,t[128]=et):et=t[128];let tt=(0,Q.useRef)(et),nt;t[129]!==c||t[130]!==l||t[131]!==d||t[132]!==a||t[133]!==s?(nt=()=>{tt.current={labelToScope:d,skillByPrefix:s,detectedByPrefix:c,groupByPrefix:l,onExpandedChange:a}},t[129]=c,t[130]=l,t[131]=d,t[132]=a,t[133]=s,t[134]=nt):nt=t[134],(0,Q.useEffect)(nt);let rt;t[135]===Symbol.for(`react.memo_cache_sentinel`)?(rt=new Set,t[135]=rt):rt=t[135];let it=(0,Q.useRef)(rt),at,ot;t[136]===we?(at=t[137],ot=t[138]):(at=()=>{let e=()=>{let e=tt.current,t=new Set,n=e=>{r4(we.getItem(e))?.isExpanded()&&t.add(e)};for(let t of e.labelToScope.keys())n(`${t}/`);for(let t of e.skillByPrefix.keys())n(`${t}/`);for(let t of e.detectedByPrefix.keys())n(`${t}/`);for(let t of e.groupByPrefix.keys())n(`${t}/`);let r=it.current;r.size===t.size&&[...t].every(e=>r.has(e))||(it.current=t,e.onExpandedChange(t))};return e(),we.subscribe(e)},ot=[we],t[136]=we,t[137]=at,t[138]=ot),(0,Q.useEffect)(at,ot);let st,ct;t[139]!==we||t[140]!==D?(st=()=>{if(D)return we.subscribe(()=>{let e=Me.current;if(e.size>0){let t=new Set(we.getSelectedPaths()),n=!1;for(let r of e)if(!t.has(r)){n=!0;break}if(n){z8(Pe);for(let t of e)we.getItem(t)?.select()}return}let t=De.current;for(let e of we.getSelectedPaths())e!==t&&we.getItem(e)?.deselect()})},ct=[D,we],t[139]=we,t[140]=D,t[141]=st,t[142]=ct):(st=t[141],ct=t[142]),(0,Q.useEffect)(st,ct);let lt,ut;t[143]!==r||t[144]!==we||t[145]!==Ae||t[146]!==D?(lt=()=>{if(D&&!(Ae.size>0)){for(let e of we.getSelectedPaths())e!==r&&we.getItem(e)?.deselect();if(r){we.getItem(r)?.select(),we.focusPath(r);let e=V8(r,ie.current);if(e.skillDisplay!==void 0){let t=e.group===void 0?e.scopeLabel:`${e.scopeLabel}/${e.group}`;r4(we.getItem(`${t}/${e.skillDisplay}/`))?.expand()}A2(we,r)}}},ut=[D,r,we,Ae],t[143]=r,t[144]=we,t[145]=Ae,t[146]=D,t[147]=lt,t[148]=ut):(lt=t[147],ut=t[148]),(0,Q.useEffect)(lt,ut);let dt=(0,Q.useRef)(i),ft;t[149]===i?ft=t[150]:(ft=()=>{dt.current=i},t[149]=i,t[150]=ft),(0,Q.useEffect)(ft);let mt,ht;t[151]!==we||t[152]!==D?(mt=()=>{if(D)for(let e of dt.current)r4(we.getItem(e))?.expand()},ht=[D,we],t[151]=we,t[152]=D,t[153]=mt,t[154]=ht):(mt=t[153],ht=t[154]),(0,Q.useEffect)(mt,ht);let gt,_t;t[155]===D?(gt=t[156],_t=t[157]):(gt=()=>{if(!D)return;let e=T.current?.querySelector(cK)?.shadowRoot;if(!e)return;let t=()=>{let t=e.querySelector(`[data-type="context-menu-anchor"]`);if(!t)return;let n=e.querySelector(`[data-item-context-hover="true"][data-item-path]`)?.dataset.itemPath,r=n!==void 0&&!re.current(V8(n,ie.current));t.style.display=r?`none`:``};t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-context-hover`]}),()=>n.disconnect()},_t=[D],t[155]=D,t[156]=gt,t[157]=_t),(0,Q.useEffect)(gt,_t);let vt;t[158]!==l||t[159]!==D||t[160]!==w?(vt=()=>{if(!D)return;let e=T.current?.querySelector(cK)?.shadowRoot;if(!e)return;let t=()=>{q6(e,{decorFor:e=>_e.current.decorForPath(e),iconPool:E.current,installLabel:_e.current.installLabel,version:w??`light`}),u8(e,{markFor:e=>_e.current.markForPath(e),iconPool:E.current,version:w??`light`});for(let t of e.querySelectorAll(`[data-item-path]`)){let e=t.getAttribute(`data-item-path`),n=e!==null&&_e.current.draggableEntryFor(e)!==null;t.draggable!==n&&(t.draggable=n)}};t();let n=new MutationObserver(t);n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]});let r=e=>{let t=K6(e.target);if(!t)return;e.preventDefault(),e.stopPropagation();let n=_e.current.skillFor(V8(t.path,l));n&&M({skill:n,x:t.rect.left,y:t.rect.bottom})};return e.addEventListener(`click`,r,!0),()=>{n.disconnect(),e.removeEventListener(`click`,r,!0)}},t[158]=l,t[159]=D,t[160]=w,t[161]=vt):vt=t[161];let yt;t[162]!==P||t[163]!==D||t[164]!==w?(yt=[D,w,P],t[162]=P,t[163]=D,t[164]=w,t[165]=yt):yt=t[165],(0,Q.useEffect)(vt,yt);let bt;t[166]===Symbol.for(`react.memo_cache_sentinel`)?(bt=(0,Z.jsxs)(`div`,{ref:E,"aria-hidden":!0,style:{position:`absolute`,width:0,height:0,overflow:`hidden`},children:[Cr.map(J8),(0,Z.jsx)(`span`,{[Z6]:`generic`,children:(0,Z.jsx)(pt,{})}),(0,Z.jsx)(`span`,{[i8]:a8,children:(0,Z.jsx)(Ap,{})}),(0,Z.jsx)(`span`,{[i8]:o8,children:(0,Z.jsx)(mb,{})}),(0,Z.jsx)(`span`,{[i8]:s8,children:(0,Z.jsx)(tb,{})})]}),t[166]=bt):bt=t[166];let xt;t[167]!==m||t[168]!==j?(xt=j?(0,Z.jsxs)(va,{open:!0,onOpenChange:e=>{e||M(null)},children:[(0,Z.jsx)(fa,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":!0,style:{position:`fixed`,left:j.x,top:j.y,width:0,height:0}})}),(0,Z.jsx)(ga,{align:`start`,className:Dr,children:(0,Z.jsx)(n5,{skill:j.skill,actions:m,onRunStart:()=>M(null)})})]}):null,t[167]=m,t[168]=j,t[169]=xt):xt=t[169];let St;t[170]===Symbol.for(`react.memo_cache_sentinel`)?(St=e=>{e||Re(null)},t[170]=St):St=t[170];let Ct;t[171]===Ie?Ct=t[172]:(Ct=()=>{Re(null),Ie()},t[171]=Ie,t[172]=Ct);let wt;t[173]!==Le||t[174]!==Ct?(wt=(0,Z.jsx)(I6,{skills:Le,onOpenChange:St,onDeleted:Ct}),t[173]=Le,t[174]=Ct,t[175]=wt):wt=t[175];let Tt;t[176]===w?Tt=t[177]:(Tt=b0(w),t[176]=w,t[177]=Tt);let Et;t[178]!==C||t[179]!==m||t[180]!==Ue||t[181]!==Ie||t[182]!==z||t[183]!==Ve||t[184]!==p||t[185]!==l||t[186]!==x||t[187]!==d||t[188]!==Ae||t[189]!==b||t[190]!==y||t[191]!==_||t[192]!==S||t[193]!==W||t[194]!==f||t[195]!==s||t[196]!==L||t[197]!==H?(Et=(e,t)=>{let n=V8(e.path,l);if(!W(n))return null;let r=d.get(n.scopeLabel);if(!r)return null;let i,a=Ae.size>1&&Ae.has(e.path)?[...Ae].map(e=>L(V8(e,l))).filter(q8):[];if(a.length>1){let e=new Set(a.map(K8)).size===1&&a.every(G8),t=a[0].scope===`project`?`global`:`project`;i=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ma,{className:`max-w-56 whitespace-normal font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`WG3MZ4`,values:{0:a.length}})}),(0,Z.jsx)(ya,{}),e?(0,Z.jsxs)(ca,{onSelect:()=>void Ue(a,t),children:[(0,Z.jsx)(uu,{"aria-hidden":!0}),t===`global`?(0,Z.jsx)(Y,{id:`Qft6eW`,values:{0:a.length}}):(0,Z.jsx)(Y,{id:`DcH8-w`,values:{0:a.length}})]}):null,(0,Z.jsxs)(ca,{variant:`destructive`,onSelect:()=>Re(a),children:[(0,Z.jsx)(Ip,{"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`N5rzKJ`,values:{0:a.length}})]}),(0,Z.jsx)(ya,{}),(0,Z.jsx)(ca,{onSelect:()=>Ie(),children:(0,Z.jsx)(Y,{id:`FBIuPX`})})]})}else if(n.isGroupRow){let e=H(n),t=n.group===void 0?void 0:l.get(`${n.scopeLabel}/${n.group}`),a=n.group===void 0?[]:p8({groupPrefix:`${n.scopeLabel}/${n.group}`,bucket:t,skillByPrefix:s});if(e.length===0&&a.length===0&&!t)return null;let o=n.group??``;i=(0,Z.jsxs)(Z.Fragment,{children:[t?(0,Z.jsx)(ma,{className:`max-w-56 whitespace-normal font-normal text-muted-foreground text-xs`,children:t.kind===`plugin`?(0,Z.jsx)(Y,{id:`rIFV5h`,values:{0:t.id}}):t.publisher?(0,Z.jsx)(Y,{id:`fKsRVO`,values:{0:t.publisher,1:t.id}}):(0,Z.jsx)(Y,{id:`idufL_`,values:{0:t.id}})}):null,t?.url?(0,Z.jsxs)(ca,{onSelect:()=>gh(t.url),children:[(0,Z.jsx)(ju,{"aria-hidden":!0}),t.kind===`plugin`?(0,Z.jsx)(Y,{id:`Fhp4Gn`}):(0,Z.jsx)(Y,{id:`n_I-da`})]}):null,e.length>0?(0,Z.jsxs)(Z.Fragment,{children:[t?(0,Z.jsx)(ya,{}):null,(0,Z.jsxs)(ca,{onSelect:()=>void m.updateAllFromSource({scope:r,names:e.map(W8),sourceLabel:o}),children:[(0,Z.jsx)(uu,{"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`e4BHn_`})]})]}):null,a.length>0?(0,Z.jsxs)(Z.Fragment,{children:[e.length===0&&t?(0,Z.jsx)(ya,{}):null,(0,Z.jsxs)(ca,{variant:`destructive`,onSelect:()=>Re(a),children:[(0,Z.jsx)(Ip,{"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`N5rzKJ`,values:{0:a.length}})]})]}):null]})}else if(n.skillDisplay===void 0)i=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ma,{className:`max-w-56 whitespace-normal font-normal text-muted-foreground text-xs`,children:f[r]}),(0,Z.jsx)(ya,{}),(0,Z.jsxs)(ca,{onSelect:()=>y(r),children:[(0,Z.jsx)(Fp,{"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`MdpSC1`})]}),(0,Z.jsxs)(ca,{onSelect:()=>b(r,`upload`),children:[(0,Z.jsx)(fe,{"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`koo58J`})]}),(0,Z.jsxs)(ca,{onSelect:()=>b(r,`skills-sh`),children:[(0,Z.jsx)(Ly,{"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`C3Zc44`})]})]});else{let e=z(n);if(e){let t=e.provenance.plugin?.trim()||null,n=t!==null||e.outsideProject===!0,a=rh(e.files.skillMd);i=(0,Z.jsxs)(Z.Fragment,{children:[t===null?e.outsideProject===!0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ma,{className:`max-w-56 whitespace-normal font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`i04BJx`})}),(0,Z.jsx)(ya,{})]}):null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ma,{className:`max-w-56 whitespace-normal font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`RJMO4B`,values:{residentPlugin:t}})}),(0,Z.jsx)(ya,{})]}),(0,Z.jsxs)(ca,{onSelect:()=>_(e),children:[n?(0,Z.jsx)(bf,{"aria-hidden":!0}):(0,Z.jsx)(Fp,{"aria-hidden":!0}),n?(0,Z.jsx)(Y,{id:`jpctdh`}):(0,Z.jsx)(Y,{id:`ePK91l`})]}),t===null?null:(0,Z.jsxs)(la,{children:[(0,Z.jsxs)(ha,{children:[(0,Z.jsx)(Fp,{"aria-hidden":!0,className:`text-muted-foreground`}),(0,Z.jsx)(Y,{id:`rFL-yb`})]}),(0,Z.jsxs)(ua,{children:[(0,Z.jsx)(ma,{className:`max-w-56 whitespace-normal font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`4FltCB`})}),(0,Z.jsx)(ya,{}),(0,Z.jsx)(ca,{onSelect:()=>void Ve(e,`project`),children:(0,Z.jsx)(Y,{id:`e0NrBM`})}),(0,Z.jsx)(ca,{onSelect:()=>void Ve(e,`global`),children:(0,Z.jsx)(Y,{id:`2GT3Hf`})})]})]}),(0,Z.jsx)(ya,{}),(0,Z.jsx)(su,{absolutePath:a}),(0,Z.jsxs)(ca,{onSelect:()=>void _r(a).then(()=>Dc.success(C({id:`SXCSQd`})),()=>Dc.error(C({id:`cRHuuI`}))),children:[(0,Z.jsx)(Fn,{"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`zd00pH`})]}),(0,Z.jsx)(ya,{}),(0,Z.jsx)(H8,{scope:r,name:e.name,pinned:x(r,e.name),onToggle:S})]})}else{let e=L(n);if(!e)return null;if(e.managed){if(n.sub!==null)return null;i=(0,Z.jsx)(iu,{skill:e,actions:m,beforeDelete:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ya,{}),(0,Z.jsx)(H8,{scope:r,name:e.name,pinned:x(r,e.name),onToggle:S})]})})}else i=n.sub===null||n.sub===`SKILL.md`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($l,{skill:e,actions:m,existingNames:p[e.scope]}),(0,Z.jsx)(ya,{}),(0,Z.jsx)(H8,{scope:r,name:e.name,pinned:x(r,e.name),onToggle:S})]}):n.isDir?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(ca,{onSelect:()=>m.requestFileCreate(e,`${n.sub}/`),children:[(0,Z.jsx)(yr,{"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`HdkSiO`})]}),(0,Z.jsx)(ya,{}),(0,Z.jsx)(Kl,{skill:e,filePath:n.sub,actions:m})]}):(0,Z.jsx)(Kl,{skill:e,filePath:n.sub,actions:m})}}return(0,Z.jsxs)(va,{open:!0,modal:!1,onOpenChange:e=>{e||t.close({restoreFocus:!1})},children:[(0,Z.jsx)(fa,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),(0,Z.jsx)(ga,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:i})]})},t[178]=C,t[179]=m,t[180]=Ue,t[181]=Ie,t[182]=z,t[183]=Ve,t[184]=p,t[185]=l,t[186]=x,t[187]=d,t[188]=Ae,t[189]=b,t[190]=y,t[191]=_,t[192]=S,t[193]=W,t[194]=f,t[195]=s,t[196]=L,t[197]=H,t[198]=Et):Et=t[198];let Dt;t[199]!==we||t[200]!==D||t[201]!==Tt||t[202]!==Et||t[203]!==V?(Dt=(0,Z.jsx)(F6,{model:we,hostRef:T,ready:D,className:`min-h-0`,style:Tt,sizeToContent:!0,titleForPath:V,renderContextMenu:Et}),t[199]=we,t[200]=D,t[201]=Tt,t[202]=Et,t[203]=V,t[204]=Dt):Dt=t[204];let Ot;return t[205]!==xt||t[206]!==wt||t[207]!==Dt?(Ot=(0,Z.jsxs)(Z.Fragment,{children:[bt,xt,wt,Dt]}),t[205]=xt,t[206]=wt,t[207]=Dt,t[208]=Ot):Ot=t[208],Ot}function W8(e){return e.name}function G8(e){return!e.managed}function K8(e){return e.scope}function q8(e){return e!==void 0}function J8(e){return(0,Z.jsx)(`span`,{[Z6]:e,children:(0,Z.jsx)(wr,{host:e})},e)}function Y8(e){return e.name}function X8(e){return(e.target?.closest?.(`[data-item-path]`))?.getAttribute(`data-item-path`)??null}function Z8(e){return e!==void 0}function Q8(){}function $8(e){return Cr.includes(e)?e:`generic`}function e5(e){return e.skillDisplay===void 0?void 0:e.group===void 0?`${e.scopeLabel}/${e.skillDisplay}`:`${e.scopeLabel}/${e.group}/${e.skillDisplay}`}function t5(e){return`${e.name}:${[...e.hosts].sort().join(`,`)}`}function n5(e){let t=(0,$.c)(8),{skill:n,actions:r,onRunStart:i}=e,a=Er(n,r),o;t[0]!==r||t[1]!==n?(o=e=>r.requestForkResolve(n,e),t[0]=r,t[1]=n,t[2]=o):o=t[2];let s;return t[3]!==i||t[4]!==n||t[5]!==o||t[6]!==a?(s=(0,Z.jsx)(Tr,{toggles:a,skill:n,onResolveFork:o,onRunStart:i}),t[3]=i,t[4]=n,t[5]=o,t[6]=a,t[7]=s):s=t[7],s}function r5(){let e=(0,$.c)(2),{openTarget:t}=Et(),n;return e[0]===t?n=e[1]:(n=async(e,n,r)=>{let i=await Jm({name:e,home:n});if(!i.ok)return i;let a=r?.rel?vo(e,r.rel):i.docName;return t({kind:`doc`,target:a,docName:a},r?.replaceActive?{tabBehavior:`replace-active`}:void 0),rm(qp(a)),{ok:!0,docName:a}},e[0]=t,e[1]=n),n}var i5={project:`pinnedProjectSkills`,global:`pinnedGlobalSkills`};function a5(e,t){let n=e?.appearance?.sidebar?.[i5[t]];if(!Array.isArray(n))return new Set;let r=new Set;for(let e of n){if(typeof e!=`string`)continue;let t=e.trim();t&&r.add(t)}return r}function o5(e,t,n){let r=new Set(e);return n?r.add(t):r.delete(t),[...r].sort((e,t)=>e.localeCompare(t,void 0,{numeric:!0}))}var s5=(0,Q.lazy)(()=>n(()=>import(`./ImportSkillDialog-D_3ApyBv.js`).then(e=>({default:e.ImportSkillDialog})),__vite__mapDeps([217,1,28,2,3,29,30,31,32,33,37,7,8,9,90,43,44,11,12,13,45,40,14,15,42,18,19,17,91,21,92,24,10,16,20,131,132,41,46,71,72,73,74,75,76,77,78,79,80,81,82,83,66,84,85,86,87,88,89,4,5,23,93,94,25,34,56,57,58,95,68,61,96,97,98,64,65,99,100,55,59,60,62,101,102,103,26,104,105,106,107,35,108,109,110,111,112,113,114,115,140,141,218,168,157,147,154,215,180]),import.meta.url));function c5(e){let t=(0,$.c)(95),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{dockExpanded:r}=n,i=r===void 0?!1:r,a=Fh(),{openTarget:o,activeDocName:s,activeTarget:c,openTabs:l,activateTab:u}=Et(),{merged:d,userBinding:f,projectLocalBinding:p}=Fl(),m=d?.editor?.previewTabs??!0?`replace-active`:`append`,h=d?.appearance?.sidebar?.showSkillGroups??!0,g;t[2]===d?g=t[3]:(g=a5(d,`project`),t[2]=d,t[3]=g);let _;t[4]===d?_=t[5]:(_=a5(d,`global`),t[4]=d,t[5]=_);let v;t[6]!==g||t[7]!==_?(v={project:g,global:_},t[6]=g,t[7]=_,t[8]=v):v=t[8];let y=v,b=(e,t,n)=>{let r=e===`global`?f:p;if(r===null)return;let i=o5(y[e],t,n),a=r.patch({appearance:{sidebar:{[i5[e]]:i}}});a.ok||Dc.error(T(n?{id:`ybPMz3`,values:{name:t}}:{id:`2-3Mlu`,values:{name:t}}),{description:ss(a.error)})},x=Zf(),S=r5(),C=Jl(),{_:w}=Bn(),T=w,E=ih(),D=th(),O=(0,Q.useRef)(b),k;t[9]===b?k=t[10]:(k=()=>{O.current=b},t[9]=b,t[10]=k),(0,Q.useEffect)(k);let j=(0,Q.useRef)(y),M;t[11]===y?M=t[12]:(M=()=>{j.current=y},t[11]=y,t[12]=M),(0,Q.useEffect)(M);let N,P;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>Qc(e=>{let{name:t,fromScope:n,toScope:r}=e;j.current[n].has(t)&&(O.current(n,t,!1),O.current(r,t,!0))}),N=[],t[13]=N,t[14]=P):(N=t[13],P=t[14]),(0,Q.useEffect)(P,N);let F;t[15]!==a.data||t[16]!==a.status?(F=a.status===`ready`?a.data:[],t[15]=a.data,t[16]=a.status,t[17]=F):F=t[17];let I=F,L;t[18]===I?L=t[19]:(L=sh(I),t[18]=I,t[19]=L);let R=L,[z,B]=(0,Q.useState)(f5),{createBlank:V,creating:ee}=yC(),[H,U]=(0,Q.useState)(null),[W,G]=(0,Q.useState)(null),[te,ne]=(0,Q.useState)(null),re;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(re={},t[20]=re):re=t[20];let[K,ie]=(0,Q.useState)(re),q,ae;t[21]===i?(q=t[22],ae=t[23]):(q=()=>{if(!i)return;let e=!0,t=()=>{Hm().then(t=>{e&&(t.ok?ne(t.skills):(console.warn(`[skills-sidebar] listDetectedSkills failed:`,t),ne([])))})};t();let n=Gc(t);return()=>{e=!1,n()}},ae=[i],t[21]=i,t[22]=q,t[23]=ae),(0,Q.useEffect)(q,ae);let oe;if(t[24]!==I){oe=new Set;let e=new Set;for(let t of I){let n=`${t.scope}:${t.name}`;e.has(n)&&oe.add(n),e.add(n)}t[24]=I,t[25]=oe}else oe=t[25];let se;t[26]===oe?se=t[27]:(se=e=>oe.has(`${e.scope}:${e.name}`)?e.hosts[0]:void 0,t[26]=oe,t[27]=se);let ce=se,le;t[28]===ce?le=t[29]:(le=e=>`${e.scope}:${e.name}:${ce(e)??``}`,t[28]=ce,t[29]=le);let ue=le,de;t[30]===ue?de=t[31]:(de=e=>[ue(e),(e.filePaths??[]).map(d5)],t[30]=ue,t[31]=de);let fe=Object.fromEntries(I.map(de)),pe=(0,Q.useRef)(null),J=(0,Q.useRef)(0),me=(0,Q.useRef)(!1),he,ge;if(t[32]===i?(he=t[33],ge=t[34]):(he=()=>{if(!i)return;let e=pe.current?.closest(p5);if(!e)return;let t=()=>{me.current||(J.current=e.scrollTop)};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},ge=[i],t[32]=i,t[33]=he,t[34]=ge),(0,Q.useEffect)(he,ge),!i)return null;let _e;t[35]!==o||t[36]!==m?(_e=e=>{o({kind:`doc`,target:e,docName:e},{tabBehavior:m}),Wp(qp(e))},t[35]=o,t[36]=m,t[37]=_e):_e=t[37];let ve=_e,ye;t[38]!==x||t[39]!==m?(ye=e=>{x(e.scope,e.name,{replaceActive:m===`replace-active`,...e.path?{path:e.path}:{},...e.hostQualifier===void 0?{}:{host:e.hostQualifier}})},t[38]=x,t[39]=m,t[40]=ye):ye=t[40];let be=ye,xe;t[41]!==u||t[42]!==l||t[43]!==o||t[44]!==m?(xe=e=>{if(e.flavor!==`explore`&&e.level){let t=A(l,e.flavor,e.name,e.subtitle??``,e.level);if(t){u(t),Wp(Yp(e));return}}o({kind:`skill-preview`,target:`${e.flavor}/${e.source}/${e.name}`,flavor:e.flavor,source:e.source,name:e.name,subtitle:e.subtitle,level:e.level,path:e.path},{tabBehavior:m}),Wp(Yp(e))},t[41]=u,t[42]=l,t[43]=o,t[44]=m,t[45]=xe):xe=t[45];let Se=xe,Ce;t[46]===Se?Ce=t[47]:(Ce=e=>{Se({flavor:`builtin`,source:rh(e.absolutePath??``),name:e.name,subtitle:``,level:e.scope})},t[46]=Se,t[47]=Ce);let we=Ce,Te;t[48]!==ce||t[49]!==ve||t[50]!==o||t[51]!==m?(Te=(e,t)=>{if(e.ignored===!0&&!e.managed){qf({scope:e.scope,name:e.name});return}let n=t.lastIndexOf(`.`),r=n>=0?t.slice(n+1).toLowerCase():``;if(!e.managed&&(r===`md`||r===`mdx`)){ve(hm(e,t));return}let i=ce(e);o({kind:`skill-file`,target:`${e.scope}/${e.name}${i?`:${i}`:``}/${t}`,scope:e.scope,name:e.name,path:t,...i?{host:i}:{}},{tabBehavior:m}),Wp(Zp({scope:e.scope,name:e.name,path:t,...i?{host:i}:{}}))},t[48]=ce,t[49]=ve,t[50]=o,t[51]=m,t[52]=Te):Te=t[52];let Ee=Te,De;t[53]===c?De=t[54]:(De=(e,t,n)=>c?.kind===`skill-preview`&&c.name===e&&c.level===t&&c.path===n,t[53]=c,t[54]=De);let Oe=De,ke;t[55]!==s||t[56]!==c||t[57]!==Oe?(ke=(e,t)=>{let n=t.slice(t.lastIndexOf(`.`)+1).toLowerCase();return!e.managed&&(n===`md`||n===`mdx`)?s===hm(e,t):c?.kind===`skill-file`&&c.scope===e.scope&&c.name===e.name&&c.path===t||Oe(e.name,e.scope,t)},t[55]=s,t[56]=c,t[57]=Oe,t[58]=ke):ke=t[58];let Ae=ke,je;t[59]!==s||t[60]!==c?.kind||t[61]!==Oe||t[62]!==l?(je=e=>A8({activeTargetKind:c?.kind,activeDocName:s,openTabs:l,docName:pm(e)})||Oe(e.name,e.scope),t[59]=s,t[60]=c?.kind,t[61]=Oe,t[62]=l,t[63]=je):je=t[63];let Me=je,Ne;t[64]===K?Ne=t[65]:(Ne=(e,t)=>{let n=k8(e);K[n]===void 0&&Ym({source:t,name:e.name}).then(e=>{e.ok&&ie(t=>({...t,[n]:e.files.map(u5)}))})},t[64]=K,t[65]=Ne);let Pe=Ne,Fe;t[66]!==T||t[67]!==Pe||t[68]!==Se||t[69]!==S||t[70]!==m?(Fe=(e,t)=>{let n=rh(e.files.skillMd);Pe(e,n);let r=t&&t!==`SKILL.md`?t:void 0,i=e.provenance.plugin===void 0?e.outsideProject?`foreign`:null:`detected`;if(i!==null){Se({flavor:i,source:n,name:e.name,subtitle:e.sourceHarness??``,level:So(e.provenance.scope),...r===void 0?{}:{path:t}});return}let a=m===`replace-active`;S(e.name,n,{replaceActive:a,rel:r}).then(t=>{t.ok||Dc.error(T({id:`lwCV5v`,values:{0:e.name,1:t.error}}))})},t[66]=T,t[67]=Pe,t[68]=Se,t[69]=S,t[70]=m,t[71]=Fe):Fe=t[71];let Ie=Fe,Le;t[72]===E?Le=t[73]:(Le=e=>[E[e],e],t[72]=E,t[73]=Le);let Re=new Map(oh.map(Le)),ze;t[74]!==s||t[75]!==Oe?(ze=e=>s===Yo(e.name)||Oe(e.name,So(e.provenance.scope)),t[74]=s,t[75]=Oe,t[76]=ze):ze=t[76];let{paths:Be,expanded:Ve,activePath:He,skillByPrefix:Ue,detectedByPrefix:We,groupByPrefix:Ge,pinnedPrefixes:Ke}=j8({skills:I,detected:te,scopeLabel:E,filesByKey:fe,detectedFilesById:K,userExpanded:z,hostQualifierOf:ce,rowKeyFor:ue,isSkillMdActive:Me,isFileActive:Ae,isDetectedActive:ze,showSkillGroups:h,pinnedByScope:y}),qe=w8(Re,We,Ge,Ue,Ke),Je;t[77]===I?Je=t[78]:(Je=I.map(l5).join(``),t[77]=I,t[78]=Je);let Ye=`${Je}|d${We.size}`,Xe=a.status===`loading`,Ze=`${Be.join(`|`)}::${Ye}::p${[...Ke].sort().join(`,`)}`,Qe;t[79]===Xe?Qe=t[80]:(Qe=Xe?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 text-muted-foreground text-xs`,"data-testid":`skills-loading`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(ip,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`VeVIIk`})]}):null,t[79]=Xe,t[80]=Qe);let $e=`keep::${Ze}`,et;t[81]===$e?et=t[82]:(et=(0,Z.jsx)(m5,{sectionRef:pe,lastScrollTopRef:J,restoringRef:me},$e),t[81]=$e,t[82]=et);let tt;t[83]===y?tt=t[84]:(tt=(e,t)=>y[e].has(t),t[83]=y,t[84]=tt);let nt,rt;t[85]===Symbol.for(`react.memo_cache_sentinel`)?(nt=e=>G(e),rt=(e,t)=>U({scope:e,tab:t}),t[85]=nt,t[86]=rt):(nt=t[85],rt=t[86]);let it;t[87]!==V||t[88]!==ee||t[89]!==R||t[90]!==W?(it=W===null?null:(0,Z.jsx)(N6,{open:!0,scope:W,existingNames:R[W],busy:ee,onOpenChange:e=>{e||G(null)},onCreate:e=>{let{name:t,description:n}=e,r=W;G(null),V(r,{name:t,description:n})}}),t[87]=V,t[88]=ee,t[89]=R,t[90]=W,t[91]=it):it=t[91];let at;return t[92]!==H||t[93]!==x?(at=H===null?null:(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(s5,{defaultScope:H.scope,defaultTab:H.tab,open:!0,onOpenChange:e=>{e||U(null)},onImported:e=>{let{scope:t,name:n}=e;U(null),x(t,n)}})}),t[92]=H,t[93]=x,t[94]=at):at=t[94],(0,Z.jsxs)(YL,{ref:pe,className:`px-0`,children:[(0,Z.jsxs)(ZL,{children:[Qe,et,(0,Z.jsx)(U8,{paths:Be,activePath:He,initialExpandedPaths:Ve,onExpandedChange:B,sort:qe,pinnedPrefixes:Ke,isPinned:tt,onTogglePin:b,skillByPrefix:Ue,detectedByPrefix:We,groupByPrefix:Ge,labelToScope:Re,scopeDescription:D,existingNames:R,actions:C,onOpenSkillMd:be,onOpenFile:Ee,onOpenDetected:Ie,onOpenManaged:we,onNewSkill:nt,onAddSkill:rt},Ze)]}),it,C.dialogs,at]})}function l5(e){return`${+!!e.installed}`}function u5(e){return e.relPath}function d5(e){return{path:e}}function f5(){return new Set}var p5=`[data-slot="collapsible-content"]`;function m5(e){let t=(0,$.c)(5),{sectionRef:n,lastScrollTopRef:r,restoringRef:i}=e,a,o;return t[0]!==r||t[1]!==i||t[2]!==n?(a=()=>{let e=r.current;if(e<=0)return;let t=n.current?.closest(p5);if(!t)return;i.current=!0;let a=Date.now()+1e3,o=0,s=()=>{if(t.scrollHeight-t.clientHeight>=e){t.scrollTop=e,i.current=!1;return}if(Date.now()<a){o=requestAnimationFrame(s);return}r.current=Math.min(e,Math.max(0,t.scrollHeight-t.clientHeight)),i.current=!1};return s(),()=>{cancelAnimationFrame(o),i.current=!1}},o=[n,r,i],t[0]=r,t[1]=i,t[2]=n,t[3]=a,t[4]=o):(a=t[3],o=t[4]),(0,Q.useLayoutEffect)(a,o),null}var h5=(0,Q.lazy)(()=>n(()=>import(`./ImportSkillDialog-D_3ApyBv.js`).then(e=>({default:e.ImportSkillDialog})),__vite__mapDeps([217,1,28,2,3,29,30,31,32,33,37,7,8,9,90,43,44,11,12,13,45,40,14,15,42,18,19,17,91,21,92,24,10,16,20,131,132,41,46,71,72,73,74,75,76,77,78,79,80,81,82,83,66,84,85,86,87,88,89,4,5,23,93,94,25,34,56,57,58,95,68,61,96,97,98,64,65,99,100,55,59,60,62,101,102,103,26,104,105,106,107,35,108,109,110,111,112,113,114,115,140,141,218,168,157,147,154,215,180]),import.meta.url)),g5=32,_5=40;function v5(e){let t=(0,$.c)(64),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{filesOpen:r}=n,i=r===void 0?!0:r,{_:a}=Bn(),[o,s]=(0,Q.useState)(yt),[c,l]=(0,Q.useState)(rn),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),m=(0,Q.useRef)(null),{createBlank:h}=yC(),g=Zf(),_,v;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>St(s),v=[],t[2]=_,t[3]=v):(_=t[2],v=t[3]),(0,Q.useEffect)(_,v);let y=(0,Q.useRef)(c),b;t[4]===c?b=t[5]:(b=()=>{y.current=c},t[4]=c,t[5]=b),(0,Q.useEffect)(b);let x,S;t[6]===o?(x=t[7],S=t[8]):(x=()=>{let e=m.current;if(!o||e===null)return;let t=new ResizeObserver(()=>{if(y.current!==null)return;let t=e.getBoundingClientRect().height;t>0&&d(Math.round(t))});return t.observe(e),()=>t.disconnect()},S=[o],t[6]=o,t[7]=x,t[8]=S),(0,Q.useEffect)(x,S);let C;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(C=(e,t)=>{let n=ut(t+e,window.innerHeight);return l(n),n},t[9]=C):C=t[9];let w=C,T=(0,Q.useRef)(null),E;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(E=(e,t)=>{let n=t===void 0?{}:t;l(e),s(!1),Ke(!1),n.restoreFocus&&requestAnimationFrame(()=>T.current?.focus())},t[10]=E):E=t[10];let D=E,O;t[11]===c?O=t[12]:(O=e=>{if(e.button!==0)return;e.preventDefault();let t=e.clientY,n=m.current?.getBoundingClientRect().height??96,r=c,i=n,a=n,o=e=>{a=n+(t-e.clientY),i=w(t-e.clientY,n)},s=()=>{if(window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,s),a<96-_5){D(r);return}wn(i)};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s),window.addEventListener(`pointercancel`,s)},t[11]=c,t[12]=O);let k=O,A;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{s(e),Ke(e)},t[13]=A):A=t[13];let j=o&&!i?`flex-1`:`shrink-0`,M;t[14]===j?M=t[15]:(M=gr(`group/skills-dock flex min-h-0 flex-col`,j),t[14]=j,t[15]=M);let N;t[16]!==a||t[17]!==o||t[18]!==i||t[19]!==c||t[20]!==u||t[21]!==k?(N=o&&i?(0,Z.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,"aria-label":a({id:`txmRmK`}),"aria-valuenow":Math.max(96,c??u??0),"aria-valuemin":96,"aria-valuemax":typeof window>`u`?void 0:Tt(window.innerHeight),tabIndex:0,"data-testid":`skills-dock-resize`,className:`-mt-1 h-2 shrink-0 cursor-row-resize focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-ring [-webkit-app-region:no-drag]`,onPointerDown:k,onKeyDown:e=>{if(e.key!==`ArrowUp`&&e.key!==`ArrowDown`)return;e.preventDefault();let t=m.current?.getBoundingClientRect().height??96;if(e.key===`ArrowDown`&&t<=96){D(c,{restoreFocus:!0});return}wn(w(e.key===`ArrowUp`?g5:-g5,t))}}):null,t[16]=a,t[17]=o,t[18]=i,t[19]=c,t[20]=u,t[21]=k,t[22]=N):N=t[22];let P;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(Ku,{className:`size-4 shrink-0 text-tree-muted transition-transform group-data-[state=open]/skills-dock:rotate-90 motion-reduce:transition-none`}),t[23]=P):P=t[23];let F;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsxs)(Gr,{ref:T,className:`flex min-w-0 flex-1 items-center gap-1.5 text-muted-foreground hover:text-foreground`,children:[P,(0,Z.jsx)(`span`,{className:`truncate text-sm font-normal`,children:(0,Z.jsx)(Y,{id:`w7LRoP`})})]}),t[24]=F):F=t[24];let I;t[25]===a?I=t[26]:(I=a({id:`0pLDSn`}),t[25]=a,t[26]=I);let L;t[27]===a?L=t[28]:(L=a({id:`MdpSC1`}),t[27]=a,t[28]=L);let R;t[29]===h?R=t[30]:(R=()=>{s(!0),Ke(!0),h(`project`)},t[29]=h,t[30]=R);let z;t[31]!==L||t[32]!==R?(z=(0,Z.jsx)(y5,{icon:Fp,label:L,onClick:R,testId:`skills-dock-new`}),t[31]=L,t[32]=R,t[33]=z):z=t[33];let B;t[34]===a?B=t[35]:(B=a({id:`C3Zc44`}),t[34]=a,t[35]=B);let V;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>p(`skills-sh`),t[36]=V):V=t[36];let ee;t[37]===B?ee=t[38]:(ee=(0,Z.jsx)(y5,{icon:Ly,label:B,onClick:V,testId:`skills-dock-explore`}),t[37]=B,t[38]=ee);let H;t[39]!==I||t[40]!==z||t[41]!==ee?(H=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1.5`,children:[F,(0,Z.jsxs)(`div`,{role:`group`,"aria-label":I,"data-testid":`skills-dock-toolbar`,className:`flex items-center gap-0.5 opacity-0 transition-opacity group-focus-within/skills-dock:opacity-100 group-hover/skills-dock:opacity-100 motion-reduce:transition-none [&>*]:[-webkit-app-region:no-drag]`,children:[z,ee]})]}),t[39]=I,t[40]=z,t[41]=ee,t[42]=H):H=t[42];let U=i?`data-[state=open]:max-h-[70vh]`:`min-h-0 flex-1`,W;t[43]===U?W=t[44]:(W=gr(`overflow-auto subtle-scrollbar`,U),t[43]=U,t[44]=W);let G;t[45]!==i||t[46]!==c?(G=i?c===null?{maxHeight:`45vh`}:{height:c}:void 0,t[45]=i,t[46]=c,t[47]=G):G=t[47];let te;t[48]===o?te=t[49]:(te=(0,Z.jsx)(c5,{dockExpanded:o}),t[48]=o,t[49]=te);let ne;t[50]!==W||t[51]!==G||t[52]!==te?(ne=(0,Z.jsx)(Wr,{ref:m,className:W,style:G,children:te}),t[50]=W,t[51]=G,t[52]=te,t[53]=ne):ne=t[53];let re;t[54]!==f||t[55]!==g?(re=f===null?null:(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(h5,{defaultScope:`project`,defaultTab:f,open:!0,onOpenChange:e=>{e||p(null)},onImported:e=>{let{scope:t,name:n}=e;p(null),g(t,n)}})}),t[54]=f,t[55]=g,t[56]=re):re=t[56];let K;return t[57]!==o||t[58]!==M||t[59]!==N||t[60]!==H||t[61]!==ne||t[62]!==re?(K=(0,Z.jsxs)(Kr,{open:o,onOpenChange:A,className:M,"data-testid":`skills-dock`,children:[N,H,ne,re]}),t[57]=o,t[58]=M,t[59]=N,t[60]=H,t[61]=ne,t[62]=re,t[63]=K):K=t[63],K}function y5(e){let t=(0,$.c)(5),{icon:n,label:r,onClick:i,testId:a}=e,o;return t[0]!==n||t[1]!==r||t[2]!==i||t[3]!==a?(o=(0,Z.jsx)(M6,{icon:n,label:r,onClick:i,"data-testid":a}),t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o):o=t[4],o}var b5=`ok-skills-section-visible-v1`;function x5(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}var S5;function C5(){if(S5===void 0){let e=x5()?.getItem(b5)??null;S5=e===`true`?!0:e===`false`?!1:null}return S5}function w5(e){if(S5!==e){S5=e;try{x5()?.setItem(b5,e?`true`:`false`)}catch{}}}var T5=6e4,E5=e=>{let t=(0,$.c)(11),{href:n,label:r,icon:i}=e,a,o;t[0]===n?(a=t[1],o=t[2]):(a=e=>_h(e,n),o=e=>_h(e,n),t[0]=n,t[1]=a,t[2]=o);let s;t[3]===i?s=t[4]:(s=(0,Z.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),t[3]=i,t[4]=s);let c;return t[5]!==n||t[6]!==r||t[7]!==a||t[8]!==o||t[9]!==s?(c=(0,Z.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,onClick:a,onAuxClick:o,"aria-label":r,className:`rounded-md p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:s}),t[5]=n,t[6]=r,t[7]=a,t[8]=o,t[9]=s,t[10]=c):c=t[10],c};function D5(e){let t=(0,$.c)(34),{version:n,onOpenReleaseNotes:r,onClose:i,store:a,autoDismissMs:o}=e,s=a===void 0?EH:a,c=o===void 0?T5:o,{_:l}=Bn(),[u,d]=(0,Q.useState)(!1),f,p;t[0]!==c||t[1]!==i||t[2]!==u?(f=()=>{if(!u)return;let e=setTimeout(i,c);return()=>clearTimeout(e)},p=[u,i,c],t[0]=c,t[1]=i,t[2]=u,t[3]=f,t[4]=p):(f=t[3],p=t[4]),(0,Q.useEffect)(f,p);let m;t[5]===l?m=t[6]:(m=l({id:`GzPQ2f`}),t[5]=l,t[6]=m);let h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Y,{id:`yLEyuq`}),t[7]=h):h=t[7];let g;t[8]===s?g=t[9]:(g=()=>{s.markSubscribed(),d(!0)},t[8]=s,t[9]=g);let _;t[10]!==i||t[11]!==s?(_=()=>{s.dismiss(),i()},t[10]=i,t[11]=s,t[12]=_):_=t[12];let v;t[13]!==g||t[14]!==_?(v=(0,Z.jsx)(tH,{source:`post_update_card`,compactSubmit:!0,description:h,onSuccess:g,onDismiss:_}),t[13]=g,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==l||t[17]!==u?(y=u?null:(0,Z.jsxs)(`nav`,{"aria-label":l({id:`dbapvC`}),className:`mt-3 flex items-center gap-1.5 text-muted-foreground text-xs`,children:[(0,Z.jsx)(`span`,{className:`mr-0.5`,children:(0,Z.jsx)(Y,{id:`9sBe85`})}),(0,Z.jsx)(E5,{href:gH,label:l({id:`I7Exsw`}),icon:kH}),(0,Z.jsx)(E5,{href:mH,label:l({id:`zyKa-I`}),icon:Jx}),(0,Z.jsx)(E5,{href:hH,label:l({id:`36aWJD`}),icon:OH})]}),t[16]=l,t[17]=u,t[18]=y):y=t[18];let b;t[19]!==y||t[20]!==v?(b=(0,Z.jsxs)(gf,{children:[v,y]}),t[19]=y,t[20]=v,t[21]=b):b=t[21];let x;t[22]===n?x=t[23]:(x=(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`hLy8b1`,values:{version:n}})}),t[22]=n,t[23]=x);let S;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Y,{id:`_PACVa`}),t[24]=S):S=t[24];let C;t[25]===r?C=t[26]:(C=(0,Z.jsx)(X,{variant:`link`,size:`sm`,className:`h-auto p-0 text-muted-foreground text-xs hover:text-foreground`,onClick:r,children:S}),t[25]=r,t[26]=C);let w;t[27]!==x||t[28]!==C?(w=(0,Z.jsxs)(of,{className:`justify-between gap-2`,children:[x,C]}),t[27]=x,t[28]=C,t[29]=w):w=t[29];let T;return t[30]!==b||t[31]!==w||t[32]!==m?(T=(0,Z.jsx)(rf,{asChild:!0,size:`sm`,className:`mx-1 mb-1`,children:(0,Z.jsxs)(`section`,{"aria-label":m,children:[b,w]})}),t[30]=b,t[31]=w,t[32]=m,t[33]=T):T=t[33],T}function O5(e){let t=(0,$.c)(37),{notice:n,onDismiss:r}=e,{_:i}=Bn(),a=n.variant===`error`?`border-destructive/60 bg-sidebar-accent/30 text-muted-foreground`:n.variant===`success`?`border-emerald-500/40 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:`border-sidebar-border bg-sidebar-accent/30 text-muted-foreground`,o;t[0]!==i||t[1]!==n.dismissible||t[2]!==r?(o=n.dismissible===!1?null:(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground`,"aria-label":i({id:`GUYwCr`}),onClick:r,children:(0,Z.jsx)(zp,{"aria-hidden":`true`,className:`size-3`})}),t[0]=i,t[1]=n.dismissible,t[2]=r,t[3]=o):o=t[3];let s=o,c=`shrink-0 text-xs font-medium underline underline-offset-2 ${n.variant===`success`?`decoration-emerald-500/40`:`decoration-muted-foreground/40`} hover:text-sidebar-foreground hover:decoration-sidebar-foreground`;if(n.secondaryAction){let e=`update-notice-${n.id}`,r=`flex flex-col gap-2 rounded-md border px-2 py-2 text-xs ${a}`,i;t[4]===n.body?i=t[5]:(i=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[4]=n.body,t[5]=i);let o;t[6]!==s||t[7]!==i?(o=(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[i,s]}),t[6]=s,t[7]=i,t[8]=o):o=t[8];let l;t[9]!==c||t[10]!==n.action?(l=n.action?(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[9]=c,t[10]=n.action,t[11]=l):l=t[11];let u;t[12]===n.secondaryAction?u=t[13]:(u=()=>{n.secondaryAction?.onClick()},t[12]=n.secondaryAction,t[13]=u);let d;t[14]!==c||t[15]!==n.secondaryAction.label||t[16]!==u?(d=(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:u,children:n.secondaryAction.label}),t[14]=c,t[15]=n.secondaryAction.label,t[16]=u,t[17]=d):d=t[17];let f;t[18]!==l||t[19]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex gap-3 pl-1`,children:[l,d]}),t[18]=l,t[19]=d,t[20]=f):f=t[20];let p;return t[21]!==e||t[22]!==r||t[23]!==o||t[24]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":e,className:r,children:[o,f]}),t[21]=e,t[22]=r,t[23]=o,t[24]=f,t[25]=p):p=t[25],p}let l=`update-notice-${n.id}`,u=`flex items-center gap-2 rounded-md border px-2 py-1.5 text-xs ${a}`,d;t[26]===n.body?d=t[27]:(d=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[26]=n.body,t[27]=d);let f;t[28]!==c||t[29]!==n.action?(f=n.action?(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[28]=c,t[29]=n.action,t[30]=f):f=t[30];let p;return t[31]!==s||t[32]!==l||t[33]!==u||t[34]!==d||t[35]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":l,className:u,children:[d,f,s]}),t[31]=s,t[32]=l,t[33]=u,t[34]=d,t[35]=f,t[36]=p):p=t[36],p}function k5(e){if(e.length===0)return null;let t=e[0];if(!t)return null;for(let n=1;n<e.length;n++){let r=e[n];r&&r.priority<t.priority&&(t=r)}return t}function A5(){let e=(0,$.c)(15),t=(0,Q.useSyncExternalStore)(pW,fW,fW),n;e[0]===t?n=e[1]:(n=k5(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;if(r.combinedSubscribe&&r.whatsNew){let t;e[2]===r.action?t=e[3]:(t=()=>r.action?.onClick(),e[2]=r.action,e[3]=t);let n;e[4]===r.id?n=e[5]:(n=()=>dW(r.id),e[4]=r.id,e[5]=n);let i;return e[6]!==r.whatsNew.version||e[7]!==t||e[8]!==n?(i=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(D5,{version:r.whatsNew.version,onOpenReleaseNotes:t,onClose:n})}),e[6]=r.whatsNew.version,e[7]=t,e[8]=n,e[9]=i):i=e[9],i}let i;e[10]===r?i=e[11]:(i=()=>{r.onDismiss?.(),dW(r.id)},e[10]=r,e[11]=i);let a;return e[12]!==r||e[13]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(O5,{notice:r,onDismiss:i})}),e[12]=r,e[13]=i,e[14]=a):a=e[14],a}var j5={folderCount:0,expandedCount:0},M5=`button, [role="button"], [role="menuitem"], input, textarea, select, a[href]`;function N5(e){return typeof Element>`u`||!(e instanceof Element)?!1:e.closest(M5)!==null}function P5(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(om,{name:`file-sidebar`,children:(0,Z.jsx)(I5,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var F5=e=>{let t=(0,$.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({icon:n,label:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=(0,Z.jsx)(n,{"aria-hidden":`true`}),t[4]=n,t[5]=a);let o;t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsx)(fa,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":r,...i,children:a})})}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9];let s;t[10]===r?s=t[11]:(s=(0,Z.jsx)(Vr,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(Ur,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c};function I5(e){let t=(0,$.c)(326),{onOpenSearch:n}=e,{_:r}=Bn(),[i,a]=(0,Q.useState)(null),{activeDocName:o,activeTarget:s}=Et(),c;t[0]!==o||t[1]!==s?(c=s?.kind===`folder`||s?.kind===`folder-index`?s.folderPath:xm(o),t[0]=o,t[1]=s,t[2]=c):c=t[2];let l=c,u;t[3]===l?u=t[4]:(u=wm(l)?``:l,t[3]=l,t[4]=u);let d=u,[f,p]=(0,Q.useState)(!1),m=f?``:d,h=typeof window<`u`&&window.okDesktop!=null,{state:g,toggleSidebar:_}=RL(),v=Be(),y=g===`expanded`,b=h&&g===`collapsed`,[x,S]=(0,Q.useState)(j5),C,w;t[5]===i?(C=t[6],w=t[7]):(C=()=>{if(i===null)return;let e=()=>{S(i.getFolderState()),p(i.isCreationTargetCleared())};return e(),i.subscribe(e)},w=[i],t[5]=i,t[6]=C,t[7]=w),(0,Q.useEffect)(C,w);let T,E;t[8]===i?(T=t[9],E=t[10]):(T=()=>{if(i!==null)return PO(e=>{let t=e.initialDir??``;if(e.template){i.createFromTemplate(e.template.folder,e.template.name);return}i.startCreating(e.kind??`file`,t)})},E=[i],t[8]=i,t[9]=T,t[10]=E),(0,Q.useEffect)(T,E);let D=x.folderCount>0,O=D&&x.expandedCount===x.folderCount,k=x.expandedCount===0,A=hf(``),j=hf(m===``?null:m),M=m===``?A:j,N=A.state.status===`ready`?(A.state.data.folder.templates_available?.length??0)>0:!0,P=M.state.status===`ready`?(M.state.data.folder.templates_available?.length??0)>0:!0,F=typeof window<`u`?window.okDesktop:void 0,I=gu(),L;t[11]!==r||t[12]!==I?.contentDir?(L=F?.config?.projectName||I?.contentDir.split(`/`).filter(Boolean).pop()||r({id:`sER-bs`}),t[11]=r,t[12]=I?.contentDir,t[13]=L):L=t[13];let R=L,{status:z}=xu(),B=z?.hasRemote===!0,V=Sr().states,{dispatch:ee}=Ll(),H;t[14]===I?H=t[15]:(H=du({workspace:I}),t[14]=I,t[15]=H);let U=H,W=jr(),G=Wa(),te=Ua(),ne=Za(),re=Cl(),{projectLocalBinding:K,merged:ie}=Fl(),q=ie?.appearance?.sidebar?.showHiddenFiles??!1,ae=ie?.appearance?.sidebar?.showOkFolders??!1,oe=ie?.appearance?.sidebar?.showOnlyMarkdownFiles??!1,se=ie?.appearance?.sidebar?.showSkillGroups??!0,[ce,le]=(0,Q.useState)(!0),ue,de;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(de=()=>Wk(()=>le(!0)),ue=[],t[16]=ue,t[17]=de):(ue=t[16],de=t[17]),(0,Q.useEffect)(de,ue);let fe=ie?.appearance?.sidebar?.showSkillsSection,pe;t[18]===fe?pe=t[19]:(pe=fe??C5()??!0,t[18]=fe,t[19]=pe);let J=pe,me,he;t[20]===fe?(me=t[21],he=t[22]):(me=()=>{fe!==void 0&&w5(fe)},he=[fe],t[20]=fe,t[21]=me,t[22]=he),(0,Q.useEffect)(me,he);let ge=D&&!O,_e=D&&!k,ve=ge||_e,ye=(0,Q.useRef)(!1),be;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(be=e=>{ye.current&&(ye.current=!1,e.preventDefault())},t[23]=be):be=t[23];let xe=be,Se=V5,Ce;t[24]!==i||t[25]!==I?(Ce=()=>{I&&(ye.current=!0,i?.startCreating(`file`,``))},t[24]=i,t[25]=I,t[26]=Ce):Ce=t[26];let we=Ce,Te;t[27]!==i||t[28]!==I?(Te=e=>{I&&(ye.current=!0,i?.createFromTemplate(``,e))},t[27]=i,t[28]=I,t[29]=Te):Te=t[29];let Ee=Te,De;t[30]!==i||t[31]!==I?(De=()=>{I&&(ye.current=!0,i?.startCreating(`folder`,``))},t[30]=i,t[31]=I,t[32]=De):De=t[32];let Oe=De,ke;t[33]===I?ke=t[34]:(ke=()=>{!I||!F||F.shell.showItemInFolder(I.contentDir)},t[33]=I,t[34]=ke);let Ae=ke,je;t[35]!==r||t[36]!==I?(je=async()=>{if(I)try{await navigator.clipboard.writeText(I.contentDir),Dc.success(r({id:`6_ZOw4`}),{description:I.contentDir})}catch(e){console.warn(`[FileSidebar] clipboard write failed:`,e),Dc.error(r({id:`vfRlCI`}))}},t[35]=r,t[36]=I,t[37]=je):je=t[37];let Me=je,Ne;t[38]!==r||t[39]!==B?(Ne=()=>{Hd({...Xd(``),hasRemote:B,onClickWhenNoRemote:()=>{Dc.error(r({id:`WyQxwa`}))}},{clipboardWrite:_r,toastSuccess:B5,toastError:z5,logEvent:R5})},t[38]=r,t[39]=B,t[40]=Ne):Ne=t[40];let Pe=Ne,Fe;t[41]!==r||t[42]!==K?(Fe=e=>{if(K===null)return;let t=K.patch({appearance:{sidebar:e}});t.ok||(console.warn(`[FileSidebar] sidebar visibility toggle rejected:`,ss(t.error)),Dc.error(r({id:`P47EWZ`}),{description:ss(t.error)}))},t[41]=r,t[42]=K,t[43]=Fe):Fe=t[43];let Ie=Fe,Le;t[44]===i?Le=t[45]:(Le=()=>{i?.expandAll()},t[44]=i,t[45]=Le);let Re=Le,ze;t[46]===i?ze=t[47]:(ze=()=>{i?.collapseAll()},t[46]=i,t[47]=ze);let Ve=ze,He,Ue;t[48]!==_e||t[49]!==ge||t[50]!==q||t[51]!==ae||t[52]!==oe||t[53]!==J||t[54]!==g?(He=()=>{let e={showHiddenFiles:q,showOkFolders:ae,showOnlyMarkdownFiles:oe,showSkillsSection:J,canExpandAll:ge,canCollapseAll:_e,sidebarVisible:g===`expanded`};el(e),F&&F.editor.notifyViewMenuStateChanged(e)},Ue=[F,q,ae,oe,J,ge,_e,g],t[48]=_e,t[49]=ge,t[50]=q,t[51]=ae,t[52]=oe,t[53]=J,t[54]=g,t[55]=He,t[56]=Ue):(He=t[55],Ue=t[56]),(0,Q.useEffect)(He,Ue);let We;t[57]!==r||t[58]!==s||t[59]!==ne||t[60]!==ee||t[61]!==G||t[62]!==V||t[63]!==m||t[64]!==Ie||t[65]!==te||t[66]!==q||t[67]!==ae||t[68]!==oe||t[69]!==J||t[70]!==re||t[71]!==W||t[72]!==_||t[73]!==i||t[74]!==I?(We=()=>fr(e=>{let t=s!==null&&wm(PR(s));switch(e){case`new-doc`:if(!I||!i)return;i.startCreating(`file`,m);return;case`new-folder`:if(!I||!i)return;i.startCreating(`folder`,m);return;case`new-from-template`:if(!I||!i)return;i.startCreatingFromTemplate(m);return;case`rename`:if(!s||t)return;WR(s);return;case`duplicate`:if(!s||t)return;KR(s);return;case`move-to-trash`:if(!s||t)return;HR(s);return;case`reveal-in-finder`:{if(!F||!I)return;let e=NR(s,I);F.shell.showItemInFolder(e);return}case`send-to-ai`:{let e=wl({sticky:re,effectiveThreadAgent:Ga(Al(te,G),ne),enabledClis:W===null?[]:Dl(G,W.installedClis),enabledDesktopTargets:Ml(G,V),unresolvedDesktopTargets:Sl(G,V),installedClis:W?.installedClis??{},terminalAvailable:W!==null,threadsAvailable:!0,desktopSelectable:!0});if(e.kind===`none`){Dc.error(r({id:`LKOLNn`}));return}let t=FR(s,I);if(!t)return;if(e.kind===`thread`){tu(t,{agent:{source:e.agent.source,id:e.agent.id}});return}if(e.kind===`cli`){W?.launchInTerminal(t,e.cli);return}if(e.kind===`terminal`)return;let n=qa.find(t=>t.id===e.target);if(!n)return;if(V[n.id]?.installed!==!0){Hl(n),Dc.info(r({id:`L1BQTH`,values:{0:n.displayName}}));return}ee(n.id,t);return}case`copy-full-path`:{if(!I)return;let e=NR(s,I);navigator.clipboard.writeText(e).then(()=>Dc.success(r({id:`6_ZOw4`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),Dc.error(r({id:`vfRlCI`}))});return}case`copy-relative-path`:{let e=PR(s);if(e===``){Dc.error(r({id:`74eHt-`}));return}navigator.clipboard.writeText(e).then(()=>Dc.success(r({id:`haHgQj`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),Dc.error(r({id:`5QGTaA`}))});return}case`toggle-show-ok-folders`:Ie({showOkFolders:!ae});return;case`toggle-show-hidden-files`:Ie({showHiddenFiles:!q});return;case`toggle-show-only-markdown-files`:Ie({showOnlyMarkdownFiles:!oe});return;case`toggle-show-skills-section`:Ie({showSkillsSection:!J});return;case`expand-all-tree`:i?.expandAll();return;case`collapse-all-tree`:i?.collapseAll();return;case`toggle-sidebar`:_();return;case`delete`:case`toggle-source`:case`save-version`:case`version-history`:case`focus-search`:case`focus-command-palette`:case`close-active-tab-or-window`:case`toggle-doc-panel`:return}}),t[57]=r,t[58]=s,t[59]=ne,t[60]=ee,t[61]=G,t[62]=V,t[63]=m,t[64]=Ie,t[65]=te,t[66]=q,t[67]=ae,t[68]=oe,t[69]=J,t[70]=re,t[71]=W,t[72]=_,t[73]=i,t[74]=I,t[75]=We):We=t[75];let Ge;t[76]!==r||t[77]!==s||t[78]!==ne||t[79]!==ee||t[80]!==G||t[81]!==V||t[82]!==m||t[83]!==K||t[84]!==te||t[85]!==q||t[86]!==ae||t[87]!==oe||t[88]!==J||t[89]!==re||t[90]!==W||t[91]!==_||t[92]!==i||t[93]!==I?(Ge=[F,i,I,s,m,K,q,ae,oe,J,V,ee,W,G,te,ne,re,_,r],t[76]=r,t[77]=s,t[78]=ne,t[79]=ee,t[80]=G,t[81]=V,t[82]=m,t[83]=K,t[84]=te,t[85]=q,t[86]=ae,t[87]=oe,t[88]=J,t[89]=re,t[90]=W,t[91]=_,t[92]=i,t[93]=I,t[94]=Ge):Ge=t[94],(0,Q.useEffect)(We,Ge);let Ke=h&&y&&`motion-safe:delay-100`,qe=b&&`opacity-0`,Je;t[95]!==Ke||t[96]!==qe?(Je=gr(`flex-row h-12 items-center py-0 pl-3 pr-2`,`justify-between`,h&&`overflow-x-clip`,h&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Ke,qe,h&&`[-webkit-app-region:drag]`),t[95]=Ke,t[96]=qe,t[97]=Je):Je=t[97];let Ye;t[98]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=h?(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`sidebar-traffic-light-reserve`,className:`w-[var(--ok-titlebar-reserve-left,0px)] shrink-0 self-stretch`}):null,t[98]=Ye):Ye=t[98];let Xe;t[99]===y?Xe=t[100]:(Xe=h&&y?(0,Z.jsx)(JH,{}):null,t[99]=y,t[100]=Xe);let Ze;t[101]===g?Ze=t[102]:(Ze=[g],t[101]=g,t[102]=Ze);let Qe;t[103]===n?Qe=t[104]:(Qe=(0,Z.jsx)(A6,{onClick:n}),t[103]=n,t[104]=Qe);let $e;t[105]!==Ze||t[106]!==Qe?($e=(0,Z.jsx)(pr,{fallbackRender:L5,onError:k6,resetKeys:Ze,children:Qe}),t[105]=Ze,t[106]=Qe,t[107]=$e):$e=t[107];let et;t[108]!==Xe||t[109]!==$e?(et=(0,Z.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-0.5 [&>*]:[-webkit-app-region:no-drag]`,children:[Xe,$e]}),t[108]=Xe,t[109]=$e,t[110]=et):et=t[110];let tt;t[111]!==Je||t[112]!==et?(tt=(0,Z.jsxs)(KL,{"data-electron-drag":h?``:void 0,className:Je,children:[Ye,et]}),t[111]=Je,t[112]=et,t[113]=tt):tt=t[113];let nt;t[114]===Symbol.for(`react.memo_cache_sentinel`)?(nt=(0,Z.jsx)(AU,{}),t[114]=nt):nt=t[114];let rt;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(rt=(0,Z.jsx)(Ku,{className:`size-4 shrink-0 text-tree-muted transition-transform group-data-[state=open]/files:rotate-90`}),t[115]=rt):rt=t[115];let it;t[116]===R?it=t[117]:(it=(0,Z.jsxs)(Gr,{"data-sidebar-root-context":!0,className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[rt,(0,Z.jsx)(`span`,{className:`truncate text-sm font-normal text-muted-foreground`,children:R})]}),t[116]=R,t[117]=it);let at;t[118]===r?at=t[119]:(at=r({id:`eaHUxx`}),t[118]=r,t[119]=at);let ot;t[120]===Symbol.for(`react.memo_cache_sentinel`)?(ot=gr(`flex items-center gap-0.5`,h&&`[&>*]:[-webkit-app-region:no-drag]`),t[120]=ot):ot=t[120];let st;t[121]===r?st=t[122]:(st=r({id:`Rq1vFD`}),t[121]=r,t[122]=st);let ct;t[123]===st?ct=t[124]:(ct=(0,Z.jsx)(F5,{icon:ib,label:st}),t[123]=st,t[124]=ct);let lt;t[125]!==ge||t[126]!==i?(lt=ge?(0,Z.jsxs)(ca,{onSelect:()=>i?.expandAll(),children:[(0,Z.jsx)(Bb,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`OlAl5i`})]}):null,t[125]=ge,t[126]=i,t[127]=lt):lt=t[127];let ut;t[128]!==_e||t[129]!==i?(ut=_e?(0,Z.jsxs)(ca,{onSelect:()=>i?.collapseAll(),children:[(0,Z.jsx)(qy,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`qvWGzP`})]}):null,t[128]=_e,t[129]=i,t[130]=ut):ut=t[130];let dt;t[131]===ve?dt=t[132]:(dt=ve?(0,Z.jsx)(ya,{}):null,t[131]=ve,t[132]=dt);let ft;t[133]===r?ft=t[134]:(ft=r({id:`8vETh9`}),t[133]=r,t[134]=ft);let pt;t[135]===Symbol.for(`react.memo_cache_sentinel`)?(pt=(0,Z.jsx)(ma,{children:(0,Z.jsx)(Y,{id:`8vETh9`})}),t[135]=pt):pt=t[135];let mt;t[136]===Ie?mt=t[137]:(mt=e=>Ie({showHiddenFiles:e}),t[136]=Ie,t[137]=mt);let ht=K===null,gt;t[138]===Symbol.for(`react.memo_cache_sentinel`)?(gt=(0,Z.jsx)(Y,{id:`6KCH4m`}),t[138]=gt):gt=t[138];let _t;t[139]!==q||t[140]!==mt||t[141]!==ht?(_t=(0,Z.jsx)(pa,{checked:q,onCheckedChange:mt,disabled:ht,"data-testid":`tree-options-show-hidden-files`,children:gt}),t[139]=q,t[140]=mt,t[141]=ht,t[142]=_t):_t=t[142];let vt;t[143]===Ie?vt=t[144]:(vt=e=>Ie({showOkFolders:e}),t[143]=Ie,t[144]=vt);let yt=K===null,bt;t[145]===Symbol.for(`react.memo_cache_sentinel`)?(bt=(0,Z.jsx)(Y,{id:`ELYtNJ`}),t[145]=bt):bt=t[145];let xt;t[146]!==ae||t[147]!==vt||t[148]!==yt?(xt=(0,Z.jsx)(pa,{checked:ae,onCheckedChange:vt,disabled:yt,"data-testid":`tree-options-show-ok-folders`,children:bt}),t[146]=ae,t[147]=vt,t[148]=yt,t[149]=xt):xt=t[149];let St;t[150]===Ie?St=t[151]:(St=e=>Ie({showOnlyMarkdownFiles:e}),t[150]=Ie,t[151]=St);let Ct=K===null,wt;t[152]===Symbol.for(`react.memo_cache_sentinel`)?(wt=(0,Z.jsx)(Y,{id:`5-o4kO`}),t[152]=wt):wt=t[152];let Tt;t[153]!==oe||t[154]!==St||t[155]!==Ct?(Tt=(0,Z.jsx)(pa,{checked:oe,onCheckedChange:St,disabled:Ct,"data-testid":`tree-options-show-only-markdown-files`,children:wt}),t[153]=oe,t[154]=St,t[155]=Ct,t[156]=Tt):Tt=t[156];let Dt;t[157]===Ie?Dt=t[158]:(Dt=e=>Ie({showSkillsSection:e}),t[157]=Ie,t[158]=Dt);let Ot=K===null,kt;t[159]===Symbol.for(`react.memo_cache_sentinel`)?(kt=(0,Z.jsx)(Y,{id:`w7LRoP`}),t[159]=kt):kt=t[159];let At;t[160]!==J||t[161]!==Dt||t[162]!==Ot?(At=(0,Z.jsx)(pa,{checked:J,onCheckedChange:Dt,disabled:Ot,"data-testid":`tree-options-show-skills`,children:kt}),t[160]=J,t[161]=Dt,t[162]=Ot,t[163]=At):At=t[163];let jt;t[164]!==ft||t[165]!==_t||t[166]!==xt||t[167]!==Tt||t[168]!==At?(jt=(0,Z.jsxs)(da,{"aria-label":ft,children:[pt,_t,xt,Tt,At]}),t[164]=ft,t[165]=_t,t[166]=xt,t[167]=Tt,t[168]=At,t[169]=jt):jt=t[169];let Mt;t[170]!==Ie||t[171]!==K||t[172]!==se||t[173]!==J?(Mt=J?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ya,{}),(0,Z.jsx)(pa,{checked:se,onCheckedChange:e=>Ie({showSkillGroups:e}),disabled:K===null,"data-testid":`tree-options-group-skills`,children:(0,Z.jsx)(Y,{id:`QPWyTw`})})]}):null,t[170]=Ie,t[171]=K,t[172]=se,t[173]=J,t[174]=Mt):Mt=t[174];let Nt;t[175]!==lt||t[176]!==ut||t[177]!==dt||t[178]!==jt||t[179]!==Mt?(Nt=(0,Z.jsxs)(ga,{align:`end`,className:`min-w-52`,"data-testid":`tree-options-menu`,children:[lt,ut,dt,jt,Mt]}),t[175]=lt,t[176]=ut,t[177]=dt,t[178]=jt,t[179]=Mt,t[180]=Nt):Nt=t[180];let Pt;t[181]!==ct||t[182]!==Nt?(Pt=(0,Z.jsxs)(va,{children:[ct,Nt]}),t[181]=ct,t[182]=Nt,t[183]=Pt):Pt=t[183];let Ft;t[184]===r?Ft=t[185]:(Ft=r({id:`HdkSiO`}),t[184]=r,t[185]=Ft);let It;t[186]!==m||t[187]!==i?(It=()=>i?.startCreating(`file`,m),t[186]=m,t[187]=i,t[188]=It):It=t[188];let Lt;t[189]!==Ft||t[190]!==It?(Lt=(0,Z.jsx)(M6,{icon:Fp,label:Ft,onClick:It,shortcutId:`new-item`}),t[189]=Ft,t[190]=It,t[191]=Lt):Lt=t[191];let Rt;t[192]!==r||t[193]!==P||t[194]!==m||t[195]!==i?(Rt=P?(0,Z.jsxs)(va,{children:[(0,Z.jsx)(F5,{icon:yr,label:r({id:`Uuj_R4`})}),(0,Z.jsx)(ga,{align:`end`,className:`min-w-52`,onCloseAutoFocus:xe,children:(0,Z.jsx)(MR,{parentDir:m,onSelectTemplate:e=>{ye.current=!0,i?.createFromTemplate(m,e)},ItemComponent:ca})})]}):null,t[192]=r,t[193]=P,t[194]=m,t[195]=i,t[196]=Rt):Rt=t[196];let zt;t[197]===r?zt=t[198]:(zt=r({id:`96G6Re`}),t[197]=r,t[198]=zt);let Bt;t[199]!==m||t[200]!==i?(Bt=()=>i?.startCreating(`folder`,m),t[199]=m,t[200]=i,t[201]=Bt):Bt=t[201];let Vt;t[202]!==zt||t[203]!==Bt?(Vt=(0,Z.jsx)(M6,{icon:Yy,label:zt,onClick:Bt,shortcutId:h?`new-folder`:void 0}),t[202]=zt,t[203]=Bt,t[204]=Vt):Vt=t[204];let Ht;t[205]!==at||t[206]!==Pt||t[207]!==Lt||t[208]!==Rt||t[209]!==Vt?(Ht=(0,Z.jsxs)(`div`,{role:`group`,"aria-label":at,"data-testid":`sidebar-toolbar`,className:ot,children:[Pt,Lt,Rt,Vt]}),t[205]=at,t[206]=Pt,t[207]=Lt,t[208]=Rt,t[209]=Vt,t[210]=Ht):Ht=t[210];let Ut;t[211]!==it||t[212]!==Ht?(Ut=(0,Z.jsxs)(XL,{className:`shrink-0 gap-1 rounded-none`,children:[it,Ht]}),t[211]=it,t[212]=Ht,t[213]=Ut):Ut=t[213];let Wt;t[214]===Symbol.for(`react.memo_cache_sentinel`)?(Wt=(0,Z.jsx)(Wr,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:(0,Z.jsx)(r3,{ref:a})}),t[214]=Wt):Wt=t[214];let Gt;t[215]===Ut?Gt=t[216]:(Gt=(0,Z.jsxs)(YL,{className:`min-h-0 flex-1 px-0`,children:[Ut,Wt]}),t[215]=Ut,t[216]=Gt);let Kt;t[217]!==ce||t[218]!==Gt?(Kt=(0,Z.jsx)(Kr,{open:ce,onOpenChange:le,className:`group/files flex min-h-0 flex-col data-[state=open]:min-h-48 data-[state=open]:flex-1`,children:Gt}),t[217]=ce,t[218]=Gt,t[219]=Kt):Kt=t[219];let qt;t[220]!==ce||t[221]!==J?(qt=J?(0,Z.jsx)(v5,{filesOpen:ce}):null,t[220]=ce,t[221]=J,t[222]=qt):qt=t[222];let Jt;t[223]!==Kt||t[224]!==qt?(Jt=(0,Z.jsxs)(JL,{children:[nt,Kt,qt]}),t[223]=Kt,t[224]=qt,t[225]=Jt):Jt=t[225];let Yt;t[226]===Symbol.for(`react.memo_cache_sentinel`)?(Yt=(0,Z.jsxs)(qL,{className:`px-0`,children:[(0,Z.jsx)(Z3,{}),(0,Z.jsx)(A5,{}),(0,Z.jsx)(qW,{}),typeof window<`u`&&window.okDesktop?(0,Z.jsx)(QL,{children:(0,Z.jsx)($L,{children:(0,Z.jsx)(b6,{bridge:window.okDesktop})})}):null]}),t[226]=Yt):Yt=t[226];let Xt=!(v&&g===`collapsed`),Zt;t[227]===Xt?Zt=t[228]:(Zt=(0,Z.jsx)(WL,{enableToggle:!1,enableDrag:Xt}),t[227]=Xt,t[228]=Zt);let Qt;t[229]!==tt||t[230]!==Jt||t[231]!==Zt?(Qt=(0,Z.jsx)(ta,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`contents`,onContextMenu:Se,children:[tt,Jt,Yt,Zt]})}),t[229]=tt,t[230]=Jt,t[231]=Zt,t[232]=Qt):Qt=t[232];let $t=!I,en,tn;t[233]===Symbol.for(`react.memo_cache_sentinel`)?(en=(0,Z.jsx)(Fp,{"aria-hidden":`true`}),tn=(0,Z.jsx)(Y,{id:`HdkSiO`}),t[233]=en,t[234]=tn):(en=t[233],tn=t[234]);let nn;t[235]!==we||t[236]!==$t?(nn=(0,Z.jsxs)(Zi,{disabled:$t,onSelect:we,"data-testid":`empty-space-menu-new-file`,children:[en,tn]}),t[235]=we,t[236]=$t,t[237]=nn):nn=t[237];let rn;t[238]!==Ee||t[239]!==N||t[240]!==I?(rn=N?(0,Z.jsxs)(Qi,{children:[(0,Z.jsxs)(ia,{disabled:!I,"data-testid":`empty-space-menu-new-from-template`,children:[(0,Z.jsx)(yr,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`Uuj_R4`})]}),(0,Z.jsx)($i,{children:(0,Z.jsx)(MR,{parentDir:``,onSelectTemplate:Ee,ItemComponent:Zi})})]}):null,t[238]=Ee,t[239]=N,t[240]=I,t[241]=rn):rn=t[241];let an=!I,on,sn;t[242]===Symbol.for(`react.memo_cache_sentinel`)?(on=(0,Z.jsx)(Yy,{"aria-hidden":`true`}),sn=(0,Z.jsx)(Y,{id:`96G6Re`}),t[242]=on,t[243]=sn):(on=t[242],sn=t[243]);let cn;t[244]!==Oe||t[245]!==an?(cn=(0,Z.jsxs)(Zi,{disabled:an,onSelect:Oe,"data-testid":`empty-space-menu-new-folder`,children:[on,sn]}),t[244]=Oe,t[245]=an,t[246]=cn):cn=t[246];let ln;t[247]===Symbol.for(`react.memo_cache_sentinel`)?(ln=(0,Z.jsx)(sa,{}),t[247]=ln):ln=t[247];let un;t[248]!==r||t[249]!==Ae||t[250]!==I?(un=F?(0,Z.jsxs)(Zi,{disabled:!I,onSelect:Ae,"data-testid":`empty-space-menu-reveal-in-finder`,"aria-label":I?Rg(F.platform):r({id:`NcUznW`,values:{0:Rg(F.platform)}}),children:[(0,Z.jsx)(Wf,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:Rg(F.platform)}),I?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`wTcjov`})})]}):null,t[248]=r,t[249]=Ae,t[250]=I,t[251]=un):un=t[251];let dn;t[252]!==ee||t[253]!==U||t[254]!==V?(dn=(0,Z.jsx)(au,{input:U,installStates:V,dispatch:ee}),t[252]=ee,t[253]=U,t[254]=V,t[255]=dn):dn=t[255];let fn;t[256]!==Pe||t[257]!==B?(fn=B?(0,Z.jsxs)(Zi,{onSelect:Pe,"data-testid":`empty-space-menu-share`,children:[(0,Z.jsx)(Na,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`Z8lGw6`})]}):null,t[256]=Pe,t[257]=B,t[258]=fn):fn=t[258];let pn=!I,mn;t[259]!==r||t[260]!==I?(mn=r(I?{id:`Up2_7p`}:{id:`U8CD-l`}),t[259]=r,t[260]=I,t[261]=mn):mn=t[261];let hn;t[262]===Symbol.for(`react.memo_cache_sentinel`)?(hn=(0,Z.jsx)(Fn,{"aria-hidden":`true`}),t[262]=hn):hn=t[262];let gn;t[263]===Symbol.for(`react.memo_cache_sentinel`)?(gn=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`Up2_7p`})}),t[263]=gn):gn=t[263];let _n;t[264]===I?_n=t[265]:(_n=I?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`wTcjov`})}),t[264]=I,t[265]=_n);let vn;t[266]!==Me||t[267]!==pn||t[268]!==mn||t[269]!==_n?(vn=(0,Z.jsxs)(Zi,{disabled:pn,onSelect:Me,"data-testid":`empty-space-menu-copy-full-path`,"aria-label":mn,children:[hn,gn,_n]}),t[266]=Me,t[267]=pn,t[268]=mn,t[269]=_n,t[270]=vn):vn=t[270];let yn;t[271]===Symbol.for(`react.memo_cache_sentinel`)?(yn=(0,Z.jsx)(sa,{}),t[271]=yn):yn=t[271];let bn;t[272]===Ie?bn=t[273]:(bn=e=>Ie({showHiddenFiles:e}),t[272]=Ie,t[273]=bn);let xn=K===null,Sn;t[274]===Symbol.for(`react.memo_cache_sentinel`)?(Sn=(0,Z.jsx)(Y,{id:`XcGbim`}),t[274]=Sn):Sn=t[274];let Cn;t[275]!==q||t[276]!==bn||t[277]!==xn?(Cn=(0,Z.jsx)(Xi,{checked:q,onCheckedChange:bn,disabled:xn,"data-testid":`empty-space-menu-show-hidden-files`,children:Sn}),t[275]=q,t[276]=bn,t[277]=xn,t[278]=Cn):Cn=t[278];let wn;t[279]===Ie?wn=t[280]:(wn=e=>Ie({showOkFolders:e}),t[279]=Ie,t[280]=wn);let Tn=K===null,En;t[281]===Symbol.for(`react.memo_cache_sentinel`)?(En=(0,Z.jsx)(Y,{id:`GHsJb8`}),t[281]=En):En=t[281];let Dn;t[282]!==ae||t[283]!==wn||t[284]!==Tn?(Dn=(0,Z.jsx)(Xi,{checked:ae,onCheckedChange:wn,disabled:Tn,"data-testid":`empty-space-menu-show-ok-folders`,children:En}),t[282]=ae,t[283]=wn,t[284]=Tn,t[285]=Dn):Dn=t[285];let On;t[286]===Ie?On=t[287]:(On=e=>Ie({showOnlyMarkdownFiles:e}),t[286]=Ie,t[287]=On);let kn=K===null,An;t[288]===Symbol.for(`react.memo_cache_sentinel`)?(An=(0,Z.jsx)(Y,{id:`WkTLN7`}),t[288]=An):An=t[288];let jn;t[289]!==oe||t[290]!==On||t[291]!==kn?(jn=(0,Z.jsx)(Xi,{checked:oe,onCheckedChange:On,disabled:kn,"data-testid":`empty-space-menu-show-only-markdown-files`,children:An}),t[289]=oe,t[290]=On,t[291]=kn,t[292]=jn):jn=t[292];let Mn;t[293]===Ie?Mn=t[294]:(Mn=e=>Ie({showSkillsSection:e}),t[293]=Ie,t[294]=Mn);let Nn=K===null,Pn;t[295]===Symbol.for(`react.memo_cache_sentinel`)?(Pn=(0,Z.jsx)(Y,{id:`WkyP2p`}),t[295]=Pn):Pn=t[295];let In;t[296]!==J||t[297]!==Mn||t[298]!==Nn?(In=(0,Z.jsx)(Xi,{checked:J,onCheckedChange:Mn,disabled:Nn,"data-testid":`empty-space-menu-show-skills-section`,children:Pn}),t[296]=J,t[297]=Mn,t[298]=Nn,t[299]=In):In=t[299];let Ln;t[300]===ve?Ln=t[301]:(Ln=ve?(0,Z.jsx)(sa,{}):null,t[300]=ve,t[301]=Ln);let Rn;t[302]!==Re||t[303]!==ge?(Rn=ge?(0,Z.jsxs)(Zi,{onSelect:Re,"data-testid":`empty-space-menu-expand-all`,children:[(0,Z.jsx)(Bb,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`OlAl5i`})]}):null,t[302]=Re,t[303]=ge,t[304]=Rn):Rn=t[304];let zn;t[305]!==Ve||t[306]!==_e?(zn=_e?(0,Z.jsxs)(Zi,{onSelect:Ve,"data-testid":`empty-space-menu-collapse-all`,children:[(0,Z.jsx)(qy,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`qvWGzP`})]}):null,t[305]=Ve,t[306]=_e,t[307]=zn):zn=t[307];let Vn;t[308]!==fn||t[309]!==vn||t[310]!==Cn||t[311]!==Dn||t[312]!==jn||t[313]!==In||t[314]!==Ln||t[315]!==Rn||t[316]!==zn||t[317]!==nn||t[318]!==rn||t[319]!==cn||t[320]!==un||t[321]!==dn?(Vn=(0,Z.jsxs)(ra,{className:`min-w-52`,onCloseAutoFocus:xe,children:[nn,rn,cn,ln,un,dn,fn,vn,yn,Cn,Dn,jn,In,Ln,Rn,zn]}),t[308]=fn,t[309]=vn,t[310]=Cn,t[311]=Dn,t[312]=jn,t[313]=In,t[314]=Ln,t[315]=Rn,t[316]=zn,t[317]=nn,t[318]=rn,t[319]=cn,t[320]=un,t[321]=dn,t[322]=Vn):Vn=t[322];let Hn;return t[323]!==Vn||t[324]!==Qt?(Hn=(0,Z.jsx)(HL,{variant:`inset`,children:(0,Z.jsxs)(ea,{children:[Qt,Vn]})}),t[323]=Vn,t[324]=Qt,t[325]=Hn):Hn=t[325],Hn}function L5(){return null}function R5(e){return console.log(e)}function z5(e){return Dc.error(e)}function B5(e){return Dc.success(e)}function V5(e){e.target instanceof Element&&e.target.closest(`[data-sidebar-root-context]`)!==null||N5(e.target)&&(e.preventDefault(),e.stopPropagation())}var H5=(0,Q.lazy)(()=>n(()=>import(`./McpConsentDialogBody-CTSqWNk2.js`),__vite__mapDeps([219,1,37,7,8,9,126,11,12,13,10,14,15,16,17,18,19,20,21,127,91,45,92,104,131,149,132,40,41,87,66,84,220,109,110,43,44,221,161]),import.meta.url));function U5(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(z_.subscribe,G5,W5))return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(H5,{})}),e[0]=t):t=e[0],t}function W5(){return!1}function G5(){return z_.getSnapshot()!==null}function K5(e,t){switch(e.kind){case`active-input`:xl(e.text,{newTab:e.newTab,submit:e.submit,target:e.target},t);return;case`agent-thread`:eu({agentSource:e.agentSource,agentId:e.agentId,prompt:e.prompt,docName:e.docName,titleHint:e.titleHint},t);return;case`terminal-launch`:_l(e.prompt,e.cli,{stage:e.stage},t);return;case`reveal-comments`:{if(e.scope===`queue`){Je();return}if(zt(`comments`,{},t),typeof window>`u`||t!==window)return;let n=qp(e.docName);tm(window.location.hash,n)||(window.location.hash=n);return}}}function q5(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(J5,t),null}function J5(){if($c())return;let e=window.okDesktop?.noteWindow?.onMainAction;if(typeof e==`function`)return e(Y5)}function Y5(e){return K5(e,window)}function X5(){let e=(0,$.c)(50),{_:t}=Bn(),n=(0,Q.useSyncExternalStore)(Gf,Xf),{openTarget:r}=Et(),{merged:i}=Fl(),a=n!==null,o;e[0]===a?o=e[1]:(o={enabled:a},e[0]=a,e[1]=o);let s=Fh(o),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(`.gitignore`),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),g=n?.scope,_=n?.name,v,y;if(e[2]!==_||e[3]!==g?(v=()=>{if(g===void 0||_===void 0){l(null);return}let e=!1;return h(null),Lm({name:_,scope:g}).then(t=>{if(!e){if(!t.ok){h(t.error);return}l(t.line),d(t.gitignorePath)}}),()=>{e=!0}},y=[g,_],e[2]=_,e[3]=g,e[4]=v,e[5]=y):(v=e[4],y=e[5]),(0,Q.useEffect)(v,y),!n)return null;let b;e[6]===f?b=e[7]:(b=()=>{f||Jf()},e[6]=f,e[7]=b);let x=b,S;e[8]===x?S=e[9]:(S=e=>!e&&x(),e[8]=x,e[9]=S);let C;e[10]===n.name?C=e[11]:(C=(0,Z.jsx)(Jr,{children:(0,Z.jsx)(Y,{id:`HwAKaw`,values:{0:n.name}})}),e[10]=n.name,e[11]=C);let w;e[12]===u?w=e[13]:(w=(0,Z.jsx)(qr,{children:(0,Z.jsx)(Y,{id:`Ehb_JP`,values:{gitignorePath:u}})}),e[12]=u,e[13]=w);let T;e[14]!==C||e[15]!==w?(T=(0,Z.jsxs)($r,{children:[C,w]}),e[14]=C,e[15]=w,e[16]=T):T=e[16];let E;e[17]!==u||e[18]!==m?(E=m!==null&&(0,Z.jsx)(`p`,{className:`text-destructive text-sm`,children:(0,Z.jsx)(Y,{id:`3MA3Hh`,values:{gitignorePath:u,previewError:m}})}),e[17]=u,e[18]=m,e[19]=E):E=e[19];let D;e[20]===c?D=e[21]:(D=c!==null&&(0,Z.jsx)(`pre`,{className:`overflow-x-auto rounded-md bg-muted px-3 py-2 font-mono text-sm`,children:c}),e[20]=c,e[21]=D);let O;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(Y,{id:`dEgA5A`}),e[22]=O):O=e[22];let k;e[23]===f?k=e[24]:(k=(0,Z.jsx)(Qr,{asChild:!0,children:(0,Z.jsx)(X,{variant:`outline`,disabled:f,children:O})}),e[23]=f,e[24]=k);let A=f||c===null,j;e[25]!==t||e[26]!==u||e[27]!==i?.editor?.previewTabs||e[28]!==r||e[29]!==n.name||e[30]!==n.scope||e[31]!==s?(j=async()=>{p(!0);let e=await Lm({name:n.name,scope:n.scope,apply:!0});if(p(!1),!e.ok){Dc.error(t({id:`F1yEaG`,values:{0:e.error,gitignorePath:u}}));return}Jf();let a=s.status===`ready`?s.data.find(e=>e.scope===n.scope&&e.name===n.name):void 0;if(a){let e=pm(a);r({kind:`doc`,target:e,docName:e},{tabBehavior:i?.editor?.previewTabs??!0?`replace-active`:`append`})}},e[25]=t,e[26]=u,e[27]=i?.editor?.previewTabs,e[28]=r,e[29]=n.name,e[30]=n.scope,e[31]=s,e[32]=j):j=e[32];let M;e[33]===u?M=e[34]:(M=(0,Z.jsx)(Y,{id:`cUagXn`,values:{gitignorePath:u}}),e[33]=u,e[34]=M);let N;e[35]!==A||e[36]!==j||e[37]!==M?(N=(0,Z.jsx)(X,{"data-testid":`skill-track-in-git-confirm`,disabled:A,onClick:j,children:M}),e[35]=A,e[36]=j,e[37]=M,e[38]=N):N=e[38];let P;e[39]!==k||e[40]!==N?(P=(0,Z.jsxs)(Zr,{children:[k,N]}),e[39]=k,e[40]=N,e[41]=P):P=e[41];let F;e[42]!==D||e[43]!==P||e[44]!==T||e[45]!==E?(F=(0,Z.jsxs)(Yr,{className:`sm:max-w-lg`,children:[T,E,D,P]}),e[42]=D,e[43]=P,e[44]=T,e[45]=E,e[46]=F):F=e[46];let I;return e[47]!==F||e[48]!==S?(I=(0,Z.jsx)(ei,{open:!0,onOpenChange:S,children:F}),e[47]=F,e[48]=S,e[49]=I):I=e[49],I}function Z5(){let e=(0,$.c)(17),t=tr(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=Et(),l;e[0]!==o||e[1]!==s||e[2]!==a||e[3]!==c||e[4]!==i?(l={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c},e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=i,e[5]=l):l=e[5];let u=(0,Q.useRef)(l),d;e[6]!==o||e[7]!==s||e[8]!==a||e[9]!==c||e[10]!==i?(d=()=>{u.current={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}},e[6]=o,e[7]=s,e[8]=a,e[9]=c,e[10]=i,e[11]=d):d=e[11],(0,Q.useEffect)(d);let f,p;return e[12]!==n||e[13]!==t||e[14]!==r?(f=()=>{if(n===null)return;let e=new Om,i=new Dm({url:n,name:os,document:e,onStateless:e=>{let{payload:t}=e;Fm(t,{onServerInfo:e=>{u.current.updateServerInstanceId(e.serverInstanceId),e.currentBranch!==void 0&&u.current.observeBranch(e.currentBranch)},onBranchSwitched:e=>{u.current.onBranchSwitched(e.branch)},onDiskAck:e=>{u.current.observeDiskAck(e.docName,e.sv),Wc(e.docName)},onDerivedView:r7,onConfigValidationRejected:n7,onConfigIgnoreNestedError:t7,onUnknown:e7})},onClose:$5,onDisconnect:Q5}),a=Xc(e=>{(e.includes(`files`)||e.includes(`backlinks`)||e.includes(`local-targets`))&&(t.invalidateQueries({queryKey:[`backlinks`]}),t.invalidateQueries({queryKey:[`forward-links`]})),(e.includes(`files`)||e.includes(`graph`))&&(t.invalidateQueries({queryKey:[`orphans`]}),t.invalidateQueries({queryKey:[`hubs`]})),e.includes(`lint-config`)&&ag()}),o=Pn(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{Yc([`files`,`backlinks`,`graph`,`local-targets`]),o()});let s=new Set,c=()=>{if(i.awareness)for(let[e,t]of i.awareness.getStates().entries())s.has(e)||t.user?.type===`agent`&&(s.add(e),console.warn(`[agent-presence] observed stale AwarenessUser.type === 'agent' from clientID ${e} — probably a stale bundled client`))};return i.awareness?.on(`change`,c),r(i),()=>{a(),i.awareness?.off(`change`,c),r(null),i.destroy(),e.destroy()}},p=[t,n,r],e[12]=n,e[13]=t,e[14]=r,e[15]=f,e[16]=p):(f=e[15],p=e[16]),(0,Q.useEffect)(f,p),null}function Q5(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function $5(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function e7(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function t7(e){nf(e)}function n7(e){ff(e)}function r7(e){Yc([e.ch])}var i7=500,a7=750,o7=1200,s7=3,c7=1500;function l7(e){return!e.startsWith(`__`)&&!/\.(mmd|mermaid)$/i.test(e)}async function u7(e){let t=await Td({kind:`project`},e);return e.aborted||t===null||t===`audit-superseded`?!1:(ld(t.files),!0)}function d7(){let e=(0,$.c)(13),{merged:t}=Fl(),n=t?.validation?.fileTreeIndicators!==!1,r=t?.validation?.links!==`off`,i,a;e[0]===r?(i=e[1],a=e[2]):(i=()=>wi(r),a=[r],e[0]=r,e[1]=i,e[2]=a),(0,Q.useLayoutEffect)(i,a);let o=Id()?.pages.size??0,s=(0,Q.useRef)(!1),c,l;e[3]===n?(c=e[4],l=e[5]):(c=()=>{if(!n)return;let e=new Map,t=!1,r=e=>{Ju({kind:`doc`,docName:e}).then(n=>{t||n===null||n===`audit-superseded`||wd(e,n.files.filter(t=>em(t.file)===e).flatMap(f7))})},i=Uc(t=>{if(!l7(t))return;let n=e.get(t);n!==void 0&&clearTimeout(n),e.set(t,setTimeout(()=>{e.delete(t),r(t)},i7))});return()=>{t=!0,i();for(let t of e.values())clearTimeout(t);e.clear()}},l=[n],e[3]=n,e[4]=c,e[5]=l),(0,Q.useEffect)(c,l);let u,d;e[6]===n?(u=e[7],d=e[8]):(u=()=>{if(!n)return;let e=null,t=null,r=()=>{t?.abort();let e=new AbortController;t=e,u7(e.signal).finally(()=>{t===e&&(t=null)})},i=()=>{e!==null&&clearTimeout(e),e=setTimeout(()=>{e=null,r()},a7)},a=[ng(i),Jc(i),Xc(e=>{qc(e)&&i()})];return()=>{for(let e of a)e();e!==null&&clearTimeout(e),t?.abort()}},d=[n],e[6]=n,e[7]=u,e[8]=d),(0,Q.useEffect)(u,d);let f,p;return e[9]!==n||e[10]!==o?(f=()=>{if(!n||o===0||s.current)return;let e=new AbortController,t=null,r=0,i=()=>{t=null,u7(e.signal).then(n=>{if(n){s.current=!0;return}if(!e.signal.aborted){if(r+=1,r>=s7){console.warn(`[audit] on-open audit exhausted retries; file-tree counts unavailable`);return}t=setTimeout(i,c7*2**(r-1))}})};return t=setTimeout(i,o7),()=>{t!==null&&clearTimeout(t),e.abort()}},p=[n,o],e[9]=n,e[10]=o,e[11]=f,e[12]=p):(f=e[11],p=e[12]),(0,Q.useEffect)(f,p),null}function f7(e){return e.diagnostics}function p7(e){let t=null,n=()=>{let n=e.hasAnyUnsyncedWork();n!==t&&(t=n,e.report({hasPendingWork:n,enabled:e.enabled}))};return n(),e.addUnsyncedWorkListener(n)}function m7(){let e=(0,$.c)(4),{collabUrl:t}=Et(),{projectConfig:n}=Fl(),r=n?.bridge?.backgroundThrottle?.enabled??!0,i,a;return e[0]!==t||e[1]!==r?(i=()=>{if(t===null)return;let e=window.okDesktop?.editor?.notifyBackgroundThrottle;if(typeof e!=`function`)return;let n=Kt(t);return p7({enabled:r,hasAnyUnsyncedWork:()=>n.hasAnyUnsyncedWork(),addUnsyncedWorkListener:e=>n.addUnsyncedWorkListener(e),report:t=>e(t)})},a=[t,r],e[0]=t,e[1]=r,e[2]=i,e[3]=a):(i=e[2],a=e[3]),(0,Q.useEffect)(i,a),null}function h7(e){let t=e.win??(typeof window<`u`?window:void 0),n=e.doc??(typeof document<`u`?document:void 0);if(t===void 0||n===void 0)return()=>{};let r=!1,i=()=>{r||(r=!0,e.onHide())},a=()=>i(),o=()=>{n.visibilityState===`hidden`?i():n.visibilityState===`visible`&&(r=!1,e.onVisible())};return t.addEventListener(`pagehide`,a),n.addEventListener(`visibilitychange`,o),()=>{t.removeEventListener(`pagehide`,a),n.removeEventListener(`visibilitychange`,o)}}function g7(){let e=(0,$.c)(4),{collabUrl:t}=Et(),{projectConfig:n}=Fl(),r=n?.bridge?.flushOnHide?.enabled??!0,i,a;return e[0]!==t||e[1]!==r?(i=()=>{if(t===null)return;let e=Kt(t);return e.setFlushOnHideEnabled(r),h7({onHide:()=>e.flushOnHide(),onVisible:()=>e.resyncOnVisible()})},a=[t,r],e[0]=t,e[1]=r,e[2]=i,e[3]=a):(i=e[2],a=e[3]),(0,Q.useEffect)(i,a),null}var _7=1e3,v7=3e4;function y7(e){let t=e.scheduler??{setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e)},n=e.initialBackoffMs??_7,r=e.maxBackoffMs??v7,i=e.rng??Math.random,a=e.createWebSocket??(e=>new WebSocket(e)),o=e.logger??null,s=e.log,c=null,l=null,u=!1,d=n;function f(e,t,n){try{o?o[e](t,n):s?.(t)}catch{}}function p(){if(u)return;l!==null&&t.clearTimeout(l);let e=d;d=Math.min(d*2,r);let n=i(),a=Math.max(1,Math.floor(e*(1-n/2)));f(`debug`,`scheduling reconnect`,{backoffMs:a,ceilMs:e}),l=t.setTimeout(()=>{l=null,m().catch(e=>f(`warn`,`reconnect failed`,{error:String(e)}))},a)}async function m(){if(u)return;let t;try{t=await e.resolveWsUrl()}catch(e){f(`warn`,`resolveWsUrl threw`,{error:String(e)}),p();return}if(!t){p();return}let r=[];e.pid!==void 0&&r.push(`pid=${encodeURIComponent(String(e.pid))}`),e.connectionId&&r.push(`connectionId=${encodeURIComponent(e.connectionId)}`),e.connectionId&&e.displayName!==void 0&&e.clientName!==void 0&&e.colorSeed!==void 0&&(r.push(`displayName=${encodeURIComponent(e.displayName)}`),r.push(`clientName=${encodeURIComponent(e.clientName)}`),r.push(`colorSeed=${encodeURIComponent(e.colorSeed)}`));let i=r.length>0?`?${r.join(`&`)}`:``,o=`${t}/collab/keepalive${i}`;try{c=a(o)}catch(e){f(`warn`,`WebSocket constructor failed`,{url:o,error:String(e)}),c=null,p();return}c.addEventListener(`open`,()=>{f(`info`,`connected`,{url:t}),d=n}),c.addEventListener(`close`,()=>{u||(f(`info`,`disconnected`,{url:t}),c=null,p())}),c.addEventListener(`error`,()=>{f(`debug`,`websocket error observed`,{url:t,readyState:c?.readyState,reason:`error-event`})})}return queueMicrotask(()=>{m().catch(e=>f(`warn`,`initial connect failed`,{error:String(e)}))}),{close:()=>{if(!u&&(u=!0,l!==null&&(t.clearTimeout(l),l=null),c)){try{c.close()}catch{}c=null}},isConnected:()=>c!==null&&c.readyState===1}}function b7(e){if(e)return e.replace(/\/collab\/?$/,``)}function x7(){return Im(window)!==null}function S7(e,t){let n=(0,$.c)(5),r=(0,Q.useRef)(e),i=(0,Q.useRef)(t),a,o;n[0]===e?(a=n[1],o=n[2]):(a=()=>{r.current=e},o=[e],n[0]=e,n[1]=a,n[2]=o),(0,Q.useEffect)(a,o);let s,c;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=i.current?.startKeepalive??y7;if((i.current?.isElectronHost??x7)())return;let t=e({resolveWsUrl:async()=>b7(r.current)});return()=>t.close()},c=[],n[3]=s,n[4]=c):(s=n[3],c=n[4]),(0,Q.useEffect)(s,c)}var C7=(0,Q.lazy)(()=>n(()=>import(`./ShareBranchSwitchDialog-Ct4sBRfQ.js`).then(e=>({default:e.ShareBranchSwitchDialog})),__vite__mapDeps([222,1,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,97,26,223,84,224,225,226,227,28,2,3,29,30,31,32,33,37]),import.meta.url)),w7=(0,Q.lazy)(()=>n(()=>import(`./ShareReceiveMissDialog-C9VJyG_D.js`).then(e=>({default:e.ShareReceiveMissDialog})),__vite__mapDeps([228,1,10,7,8,9,11,12,13,14,15,16,17,18,19,20,21,229,134,28,2,3,29,30,31,32,33,83,37,66,84,85,86,87,88,89,101,60,54,92,25,103,26,223,144,65,68,58]),import.meta.url)),T7=`#install-claude-desktop`,E7=/\.(md|mdx)$/i;function D7(e){return Rc(e)||e===T7}function O7(e,t){if(!E7.test(e))return null;for(let n of t){let t=ze(n);if(t.kind===`doc`&&t.docName===e)return{kind:`doc`,target:e,docName:e}}return null}function k7(e){switch(e.kind){case`skill-file`:case`skill-preview`:return e.path??null;case`doc`:case`folder-index`:case`folder`:case`asset`:case`skills`:case`large-file`:case`missing`:return null}}function A7(e,t,n,r){return[e,t,n,r].map(e=>[...e].sort().join(`\0`)).join(``)}function j7(){let e=(0,$.c)(33),{activeNewTabId:t,activeTabId:n,activeTarget:r,clearTarget:i,openTabs:a,syncOpenTabsWithKnownTargets:o,tabSessionLoaded:s}=Et(),{openTargetTransition:c}=qe();Xl();let{assetPaths:l,filePaths:u,folderPaths:d,loading:f,pageMeta:p,pages:m,pagesBySlug:h,pagesByBasename:g}=Nd(),{merged:_}=Fl(),v=_?.editor?.previewTabs??!0,y=(0,Q.useRef)(null),b=(0,Q.useRef)(null),x=(0,Q.useRef)(null),S;e[0]!==l||e[1]!==u||e[2]!==d||e[3]!==m?(S=A7(m,d,l,u),e[0]=l,e[1]=u,e[2]=d,e[3]=m,e[4]=S):S=e[4];let C=S,w;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(w=[],e[5]=w):w=e[5],(0,Q.useEffect)(N7,w);let T,E;e[6]!==l||e[7]!==u||e[8]!==d||e[9]!==f||e[10]!==m||e[11]!==o||e[12]!==s||e[13]!==C?(T=()=>{f||!s||y.current===C||(y.current=C,o({pages:m,folderPaths:d,assetPaths:l,filePaths:u}))},E=[l,u,d,f,m,o,s,C],e[6]=l,e[7]=u,e[8]=d,e[9]=f,e[10]=m,e[11]=o,e[12]=s,e[13]=C,e[14]=T,e[15]=E):(T=e[14],E=e[15]),(0,Q.useEffect)(T,E);let D;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(D=[],e[16]=D):D=e[16],(0,Q.useEffect)(M7,D);let O,k;return e[17]!==t||e[18]!==n||e[19]!==r||e[20]!==i||e[21]!==d||e[22]!==f||e[23]!==a||e[24]!==c||e[25]!==p||e[26]!==m||e[27]!==g||e[28]!==h||e[29]!==v||e[30]!==s?(O=()=>{if(!s&&window.okDesktop?.config.mode===`editor`)return;l(b.current);let e=function(e){b.current=Hp(e.state)?window.location.href:null},o=function(){let e=b.current;b.current=null,l(e)};function l(e){let o=e===window.location.href;im();let s=x.current===window.location.hash,l=()=>{x.current=window.location.hash},u=()=>{x.current=null},_=e=>{u(),!(Ue(e)===n&&r?.kind===e.kind&&r.target===e.target&&k7(r)===k7(e))&&c(e,{disposition:o?s4(v):`permanent`,consumeActiveNewTab:!0})};if(D7(window.location.hash))return;let y=Up(window.location.hash);if(y){let e=Go(y.split(`.`).pop()??``);am(`ok/nav/hash-change`,{docName:null,kind:`asset`}),_({kind:`asset`,target:y,assetPath:y,mediaKind:e});return}let b=Vp(window.location.hash);if(b){am(`ok/nav/hash-change`,{docName:null,kind:`skill-file`}),_({kind:`skill-file`,target:`${b.scope}/${b.name}${b.host?`:${b.host}`:``}/${b.path}`,scope:b.scope,name:b.name,path:b.path,...b.host?{host:b.host}:{}});return}if(nm(window.location.hash)){if(t!==null){l();return}if(s)return;am(`ok/nav/hash-change`,{docName:null,kind:`skills`}),c({kind:`skills`,target:`skills`});return}let S=Bp(window.location.hash);if(S){am(`ok/nav/hash-change`,{docName:null,kind:`skill-preview`}),_({kind:`skill-preview`,target:`${S.flavor}/${S.source}/${S.name}`,flavor:S.flavor,source:S.source,name:S.name,subtitle:S.subtitle,level:S.level,path:S.path});return}if(Jp(window.location.hash)){am(`ok/nav/hash-change`,{docName:null,kind:`folder`}),_({kind:`folder`,target:``,folderPath:``});return}let C=$p(window.location.hash);if(!C){if(t!==null){l();return}if(s)return;am(`ok/nav/hash-change`,{docName:null,kind:`clear`}),i();return}if(f){am(`ok/nav/hash-change`,{docName:C,kind:`deferred-loading`});return}let w=O7(C,a)??_m(C,{pages:m,folderPaths:d,pagesBySlug:h,pagesByBasename:g});if(w.kind===`missing`&&/\/+$/.test(C.trim())){am(`ok/nav/hash-change`,{docName:C,kind:`deferred-missing-folder`});return}let T=um(gm(w),p);am(`ok/nav/hash-change`,{docName:C,kind:T.kind}),_(T)}return window.addEventListener(`popstate`,e),window.addEventListener(`hashchange`,o),()=>{window.removeEventListener(`popstate`,e),window.removeEventListener(`hashchange`,o)}},k=[t,n,r,i,d,f,c,a,p,m,h,g,v,s],e[17]=t,e[18]=n,e[19]=r,e[20]=i,e[21]=d,e[22]=f,e[23]=a,e[24]=c,e[25]=p,e[26]=m,e[27]=g,e[28]=h,e[29]=v,e[30]=s,e[31]=O,e[32]=k):(O=e[31],k=e[32]),(0,Q.useEffect)(O,k),null}function M7(){st()&&window.location.hash!==``&&!D7(window.location.hash)&&rm(``)}function N7(){return fr(P7)}function P7(e){e===`navigate-back`&&window.history.back(),e===`navigate-forward`&&window.history.forward()}function F7(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(I7,t),null}function I7(){let e=function(e){if(Mr())return;let t=e.target;Fc({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=zc))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function L7(){let e=(0,$.c)(4),{activeTarget:t}=Et(),n=typeof window<`u`?window.okDesktop??null:null,r=t?.kind===`doc`||t?.kind===`folder`||t?.kind===`asset`?t.kind:null,i=t?.kind===`doc`?t.docName:t?.kind===`folder`?t.folderPath:t?.kind===`asset`?t.assetPath:null,a,o;return e[0]!==i||e[1]!==r?(a=()=>{if(n){if(r===null){n.editor.notifyActiveTargetChanged({kind:null});return}i!==null&&n.editor.notifyActiveTargetChanged({kind:r,identifier:i})}},o=[n,r,i],e[0]=i,e[1]=r,e[2]=a,e[3]=o):(a=e[2],o=e[3]),(0,Q.useEffect)(a,o),null}function R7(){let e=(0,$.c)(13),{activeDocName:t,activeTarget:n}=Et(),{pages:r,addPage:i}=Nd(),[a,o]=(0,Q.useState)(!1),s;e[0]!==t||e[1]!==n?(s=n?.kind===`folder`?n.folderPath:xm(t),e[0]=t,e[1]=n,e[2]=s):s=e[2];let c=s,l=hf(c),u=l.state,d=(0,Q.useRef)(!1),f,p;e[3]!==i||e[4]!==u||e[5]!==c||e[6]!==r?(f=()=>{let e=function(e){if(Mr())return;let t=e.target;if(eC({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,key:e.key})){if(e.preventDefault(),u.status!==`ready`||(u.data.folder.templates_available??[]).length>0){o(!0);return}d.current||(d.current=!0,US({path:`${GS(c,r)}.md`,kind:`file`}).then(e=>{if(!e.ok){Dc.error(e.error),o(!0);return}WS(e.docName,i)}).catch(e=>{console.warn(`[NewItemShortcutHandler] create tail failed:`,e),o(!0)}).finally(()=>{d.current=!1}))}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},p=[u,c,r,i],e[3]=i,e[4]=u,e[5]=c,e[6]=r,e[7]=f,e[8]=p):(f=e[7],p=e[8]),(0,Q.useEffect)(f,p);let m;return e[9]!==a||e[10]!==l||e[11]!==c?(m=(0,Z.jsx)(nC,{open:a,onOpenChange:o,kind:`file`,initialDir:c,folderConfig:l}),e[9]=a,e[10]=l,e[11]=c,e[12]=m):m=e[12],m}function z7(e){let t=(0,$.c)(5),{children:n}=e,{collabUrl:r}=Et();S7(r);let i,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(g7,{}),a=(0,Z.jsx)(m7,{}),t[0]=i,t[1]=a):(i=t[0],a=t[1]);let o;return t[2]!==n||t[3]!==r?(o=(0,Z.jsxs)(Nm,{collabUrl:r,children:[i,a,n]}),t[2]=n,t[3]=r,t[4]=o):o=t[4],o}function B7(e){let t=(0,$.c)(6),{children:n}=e,{merged:r}=Fl(),{promoteAllPreviewTabs:i}=Et(),a;t[0]!==r?.editor?.previewTabs||t[1]!==i?(a=()=>{r?.editor?.previewTabs===!1&&i()},t[0]=r?.editor?.previewTabs,t[1]=i,t[2]=a):a=t[2];let o=r?.editor?.previewTabs,s;return t[3]!==i||t[4]!==o?(s=[o,i],t[3]=i,t[4]=o,t[5]=s):s=t[5],(0,Q.useEffect)(a,s),n}function V7(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(om,{name:`app`,children:(0,Z.jsx)(gn,{children:(0,Z.jsx)(z7,{children:(0,Z.jsx)(B7,{children:(0,Z.jsx)(TC,{children:(0,Z.jsx)(H7,{})})})})})}),e[0]=t):t=e[0],t}function H7(){let e=(0,$.c)(36),t=typeof window<`u`?window.okDesktop??null:null,n=typeof window<`u`&&window.okDesktop!=null,[r,i]=(0,Q.useState)(!1),a=OC(),o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=$c(),e[0]=o):o=e[0];let s=o,c=Pr(),l;e[1]===c?l=e[2]:(l=t&&t.config.ptyAvailable===!0?{launchInTerminal:U7,installedClis:c}:null,e[1]=c,e[2]=l);let u=l,d,f;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(rw,{}),f=(0,Z.jsx)(Qb,{}),e[3]=d,e[4]=f):(d=e[3],f=e[4]);let p,m,h,g,_,v,y;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(q5,{}),h=!s&&(0,Z.jsx)(Z5,{}),g=(0,Z.jsx)(d7,{}),_=(0,Z.jsx)(X5,{}),v=(0,Z.jsx)(j7,{}),y=(0,Z.jsx)(L7,{}),p=(0,Z.jsx)(R7,{}),e[5]=p,e[6]=m,e[7]=h,e[8]=g,e[9]=_,e[10]=v,e[11]=y):(p=e[5],m=e[6],h=e[7],g=e[8],_=e[9],v=e[10],y=e[11]);let b;e[12]===a?b=e[13]:(b=!a&&!s&&(0,Z.jsx)(F7,{}),e[12]=a,e[13]=b);let x,S,C,w,T,E;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=!1,S=t?(0,Z.jsx)(iw,{bridge:t}):null,C=t?(0,Z.jsx)(Ir,{}):null,w=t?(0,Z.jsx)(OU,{}):null,T=(0,Z.jsx)(U5,{}),E=t?(0,Z.jsxs)(Q.Suspense,{fallback:null,children:[(0,Z.jsx)(C7,{bridge:t}),(0,Z.jsx)(w7,{})]}):null,e[14]=x,e[15]=S,e[16]=C,e[17]=w,e[18]=T,e[19]=E):(x=e[14],S=e[15],C=e[16],w=e[17],T=e[18],E=e[19]);let D;e[20]===r?D=e[21]:(D=!s&&(0,Z.jsx)(JC,{bridge:t,open:r,onOpenChange:i}),e[20]=r,e[21]=D);let O;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=n&&(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`editor-window-chrome-drag-strip`,"data-electron-drag":``,className:`pointer-events-none fixed inset-x-0 top-0 z-50 h-2 [-webkit-app-region:drag]`}),e[22]=O):O=e[22];let k;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(Zb,{}),e[23]=k):k=e[23];let A;e[24]===a?A=e[25]:(A=!a&&!s&&(0,Z.jsx)(P5,{onOpenSearch:()=>i(!0)}),e[24]=a,e[25]=A);let j;e[26]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(GL,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(_U,{onOpenSearch:()=>i(!0)})}),e[26]=j):j=e[26];let M;e[27]===A?M=e[28]:(M=(0,Z.jsxs)(zL,{className:`h-screen overflow-hidden`,children:[A,j]}),e[27]=A,e[28]=M);let N;e[29]!==M||e[30]!==u?(N=(0,Z.jsxs)(Or,{value:u,children:[k,M]}),e[29]=M,e[30]=u,e[31]=N):N=e[31];let P;return e[32]!==b||e[33]!==D||e[34]!==N?(P=(0,Z.jsxs)(Z.Fragment,{children:[d,f,(0,Z.jsxs)(Pd,{children:[m,h,g,_,v,y,p,b,x,S,C,w,T,E,D,O,N]})]}),e[32]=b,e[33]=D,e[34]=N,e[35]=P):P=e[35],P}function U7(e,t){_l(Bl(e,t),t)}function W7(e){let t=/\/([^/]+?)(?:\.git)?\/?$/.exec(e);return t?t[1]:`repo`}function G7(e){return{async getAuthStatus(t){return e.authQueryTransport.status(t?{host:t}:void 0)},async startSignIn(){return e.openSignIn()},async runClone({url:t,branch:n}){let r=await e.bridge.dialog.openFolder();if(!r)return{kind:`cancelled`};let i=W7(t),a=`${r.replace(/\/$/,``)}/${i}`,o=Dc.loading(Hc._({id:`GXf9hG`,values:{repoName:i}}),{duration:1/0}),s=typeof n==`string`&&n.length>0?n:null;try{let n=e.cloneTransport.start({url:t,dir:a,branch:s});for await(let e of n.events){if(e.type===`progress`){let t=e.phase,n=Math.round(e.pct);Dc.loading(Hc._({id:`GXf9hG`,values:{repoName:i}}),{id:o,description:Hc._({id:`SCzAbA`,values:{phase:t,pct:n}}),duration:1/0});continue}if(e.type===`branch-fallback`){console.log(V_({branch_action:`fallback`,branch:e.branch})),Dc.info(Hc._({id:`3JYy1p`,values:{0:e.branch}}),{duration:8e3});continue}if(e.type===`complete`)return Dc.success(Hc._({id:`IRv9cH`,values:{repoName:i}}),{id:o,duration:4e3}),{kind:`ok`,dir:e.dir};if(e.type===`error`)return Dc.dismiss(o),{kind:`error`,detail:e.message}}return Dc.dismiss(o),{kind:`error`,detail:Hc._({id:`PZt2Ds`})}}catch(e){console.warn(`[clone-controller] clone transport threw`,e);let t=e instanceof Error?e.message:Hc._({id:`29VNqC`});return Dc.dismiss(o),{kind:`error`,detail:t}}}}}function K7(){return{start(e){return $d((t,n)=>{(async()=>{try{let r=await fetch(`/api/local-op/clone`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e.url,dir:e.dir||void 0,branch:typeof e.branch==`string`&&e.branch.length>0?e.branch:void 0}),signal:n});if(!r.ok){let e=r.status,n=Hc._({id:`ZSoojc`,values:{status:e}});try{let e=await r.json(),t=xc.safeParse(e);if(t.success){let e=t.data.title;n=Hc._({id:`OsSaYm`,values:{title:e}})}}catch{}t({type:`error`,message:n});return}if(!r.body){t({type:`error`,message:Hc._({id:`fhaxJL`})});return}let i=r.body.getReader(),a=new TextDecoder,o=``;for(;;){let{done:e,value:r}=await i.read();if(e)break;o+=a.decode(r,{stream:!0});let s=o.split(`
2204
+ `);o=s.pop()??``;for(let e of s){if(!e.trim())continue;let n;try{n=JSON.parse(e)}catch{console.warn(`[clone-transport] Dropped unparseable NDJSON line:`,e.slice(0,100));continue}if(n&&typeof n==`object`&&n.type===`error`&&`problem`in n){let e=n.problem;t({type:`error`,message:e?.detail||e?.title||Hc._({id:`29VNqC`})});break}t(n)}if(n.aborted)break}n.aborted||t({type:`error`,message:Hc._({id:`Tz9pJB`})})}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;t({type:`error`,message:Hc._({id:`K9J00P`})})}})()})}}}function q7(e){return{start(t){let n=typeof t.branch==`string`&&t.branch.length>0?t.branch:null;return e.localOp.clone.start({url:t.url,dir:t.dir,branch:n})}}}function J7(e){switch(e){case`receiving`:return{id:`qbfj1f`};case`resolving`:return{id:`adsMWO`};case`checking`:return{id:`1HBhDS`};case`init`:return{id:`LlHqdU`};case`done`:return{id:`bD8I7O`};default:return{id:`25Pw6a`}}}function Y7(e){let t=e.trim();if(/^[\w.-]+\/[\w.-]+$/.test(t))return t.split(`/`)[1];try{return new URL(t.replace(/^git@([^:]+):/,`https://$1/`)).pathname.replace(/\.git$/,``).split(`/`).pop()??`repo`}catch{return t.split(`/`).pop()?.replace(/\.git$/,``)??`repo`}}function X7(e){let t=(0,$.c)(100),{open:n,onOpenChange:r,onSignIn:i,onCloneComplete:a,transport:o,authQueryTransport:s,pickParentFolder:c,initialUrl:l}=e,{_:u}=Bn(),d;t[0]===o?d=t[1]:(d=o??K7(),t[0]=o,t[1]=d);let f=d,p;t[2]===s?p=t[3]:(p=s??tf(),t[2]=s,t[3]=p);let m=p,h=c!==void 0,[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(!1),w;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(w=mf(),t[4]=w):w=t[4];let[T,E]=(0,Q.useState)(w),[D,O]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(-1),N=(0,Q.useRef)(null),P=(0,Q.useRef)(null),F=(0,Q.useRef)(null),I=(0,Q.useId)(),L;t[5]!==n||t[6]!==m?(L=()=>{if(!n)return;let e=!1;return m.status().then(t=>{lf(t.authenticated),e||E(t.authenticated)}).catch(()=>{e||E(!1)}),()=>{e=!0}},t[5]=n,t[6]=m,t[7]=L):L=t[7];let R;t[8]===n?R=t[9]:(R=[n],t[8]=n,t[9]=R),(0,Q.useEffect)(L,R);let z;t[10]!==T||t[11]!==n||t[12]!==m?(z=()=>{if(!T||!n)return;let e=!1;return C(!0),m.repos().then(t=>{e||(x(t.ok?t.repos:[]),C(!1))}).catch(()=>{e||(x([]),C(!1))}),()=>{e=!0}},t[10]=T,t[11]=n,t[12]=m,t[13]=z):z=t[13];let B;t[14]!==T||t[15]!==n?(B=[T,n],t[14]=T,t[15]=n,t[16]=B):B=t[16],(0,Q.useEffect)(z,B);let V,ee;t[17]!==l||t[18]!==n||t[19]!==h?(V=()=>{if(!n||!l||(_(l),h))return;let e=Y7(l);e&&y(`~/Documents/${e}`)},ee=[n,l,h],t[17]=l,t[18]=n,t[19]=h,t[20]=V,t[21]=ee):(V=t[20],ee=t[21]),(0,Q.useEffect)(V,ee);let H,U;t[22]!==j||t[23]!==I?(H=()=>{j<0||document.getElementById(`${I}-opt-${j}`)?.scrollIntoView({block:`nearest`})},U=[j,I],t[22]=j,t[23]=I,t[24]=H,t[25]=U):(H=t[24],U=t[25]),(0,Q.useEffect)(H,U);let W;t[26]===h?W=t[27]:(W=function(e){if(_(e),A(!0),M(-1),h)return;let t=Y7(e);t&&y(`~/Documents/${t}`)},t[26]=h,t[27]=W);let G=W,te;t[28]===h?te=t[29]:(te=function(e){if(_(e.clone_url),h)return;let t=e.full_name.split(`/`)[1];y(`~/Documents/${t}`)},t[28]=h,t[29]=te);let ne=te,re;t[30]!==u||t[31]!==v||t[32]!==a||t[33]!==r||t[34]!==c||t[35]!==f||t[36]!==g?(re=async function(){let e=g.trim();if(!e){Dc.error(u({id:`FTUGgh`}));return}let t=v||``;if(c){O(!0);let n=await c();if(!n){O(!1);return}let r=Y7(e);t=`${n.replace(/\/$/,``)}/${r}`}else O(!0);let n=Dc.loading(u({id:`2tgFCe`}),{duration:1/0});P.current=n;let i=f.start({url:e,dir:t});N.current=i.cancel;try{let e=i.events[Symbol.asyncIterator](),t=await e.next();for(;!t.done;){let i=t.value;if(i.type===`progress`){let e=u(J7(i.phase));Dc.loading(`${e} — ${i.pct}%`,{id:n})}else if(i.type===`complete`){Dc.success(u({id:`u_lS4C`}),{id:n}),r(!1),O(!1),N.current=null;let e=`port`in i?i.port:void 0;a?a({port:e,dir:i.dir}):e!==void 0&&(window.location.href=`http://localhost:${e}`);return}else if(i.type===`error`){let e=i.message;Dc.error(u({id:`eFJkVt`,values:{cloneError:e}}),{id:n}),O(!1),N.current=null;return}t=await e.next()}Dc.error(u({id:`Tz9pJB`}),{id:n}),O(!1),N.current=null}catch(e){console.error(`[CloneDialog] clone iteration failed:`,e),Dc.error(u({id:`K9J00P`}),{id:n}),O(!1),N.current=null}},t[30]=u,t[31]=v,t[32]=a,t[33]=r,t[34]=c,t[35]=f,t[36]=g,t[37]=re):re=t[37];let K=re,ie;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(){N.current?.(),N.current=null,O(!1),Dc.dismiss(P.current??void 0)},t[38]=ie):ie=t[38];let q=ie,ae;t[39]!==D||t[40]!==r||t[41]!==h?(ae=function(e){D||(r(e),e||(_(``),h||y(``),A(!1),M(-1)))},t[39]=D,t[40]=r,t[41]=h,t[42]=ae):ae=t[42];let oe=ae,se;t[43]===ne?se=t[44]:(se=function(e){ne(e),A(!1),M(-1),F.current?.focus()},t[43]=ne,t[44]=se);let ce=se,le=T===null||S&&b===null,ue;if(t[45]!==b||t[46]!==g){let e=g.trim().toLowerCase(),n;t[48]===b?n=t[49]:(n=b??[],t[48]=b,t[49]=n),ue=n.filter(t=>`${t.full_name} ${t.clone_url}`.toLowerCase().includes(e)),t[45]=b,t[46]=g,t[47]=ue}else ue=t[47];let de=ue,fe;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(fe=/:\/\/|^git@|\.git$/i,t[50]=fe):fe=t[50];let pe;t[51]===g?pe=t[52]:(pe=fe.test(g.trim()),t[51]=g,t[52]=pe);let J=pe,me=T===!0&&b!==null&&de.length===0&&!J,he=k&&T!==!1&&!D&&(le||de.length>0||me),ge=de.length,_e=`${I}-loading`,ve,ye;t[53]===ge?(ve=t[54],ye=t[55]):(ve=()=>{M(e=>e>=ge?ge-1:e)},ye=[ge],t[53]=ge,t[54]=ve,t[55]=ye),(0,Q.useEffect)(ve,ye);let be;t[56]!==j||t[57]!==D||t[58]!==he||t[59]!==ce||t[60]!==de?(be=function(e){if(!D)if(e.key===`ArrowDown`){if(e.preventDefault(),!he){A(!0);return}M(e=>Math.min(e+1,de.length-1))}else e.key===`ArrowUp`?(e.preventDefault(),M(n9)):e.key===`Enter`?he&&j>=0&&j<de.length&&(e.preventDefault(),ce(de[j])):e.key===`Escape`&&he&&(e.preventDefault(),e.stopPropagation(),A(!1),M(-1))},t[56]=j,t[57]=D,t[58]=he,t[59]=ce,t[60]=de,t[61]=be):be=t[61];let xe=be,Se;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsx)($r,{children:(0,Z.jsx)(Jr,{children:(0,Z.jsx)(Y,{id:`VdXv4D`})})}),t[62]=Se):Se=t[62];let Ce;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(`label`,{htmlFor:`clone-source`,className:`text-sm font-medium`,children:(0,Z.jsx)(Y,{id:`IreQBq`})}),t[63]=Ce):Ce=t[63];let we;t[64]!==u||t[65]!==j||t[66]!==D||t[67]!==xe||t[68]!==G||t[69]!==T||t[70]!==I||t[71]!==_e||t[72]!==i||t[73]!==he||t[74]!==le||t[75]!==b||t[76]!==ce||t[77]!==de||t[78]!==g?(we=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[Ce,T===!1?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(dh,{id:`clone-source`,placeholder:u({id:`Xv_ijG`}),value:g,onChange:e=>G(e.target.value),disabled:D}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-1sm text-muted-foreground`,children:[(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`9oE4C3`})}),(0,Z.jsx)(X,{variant:`link`,className:`h-auto p-0`,onClick:()=>i?.(),disabled:D,children:(0,Z.jsx)(Y,{id:`3jod3l`})})]})]}):(0,Z.jsxs)(hh,{open:he,onOpenChange:A,children:[(0,Z.jsx)(mh,{asChild:!0,children:(0,Z.jsx)(dh,{id:`clone-source`,ref:F,role:`combobox`,"aria-expanded":he,"aria-controls":he?le?_e:I:void 0,"aria-activedescendant":j>=0?`${I}-opt-${j}`:void 0,"aria-autocomplete":`list`,autoComplete:`off`,placeholder:u({id:`R0jJzV`}),value:g,onChange:e=>G(e.target.value),onFocus:()=>A(!0),onKeyDown:xe,disabled:D})}),(0,Z.jsx)(ph,{align:`start`,sideOffset:4,className:`w-(--radix-popover-trigger-width) max-h-56 overflow-y-auto overscroll-y-contain subtle-scrollbar p-0`,"data-ok-declines-keyboard":``,onOpenAutoFocus:t9,onCloseAutoFocus:e9,onInteractOutside:e=>{F.current?.contains(e.target)&&e.preventDefault()},onWheel:$7,onTouchMove:Q7,children:le?(0,Z.jsxs)(`output`,{id:_e,className:`flex flex-col gap-1.5 px-3 py-2`,"aria-label":u({id:`8XQRON`}),children:[(0,Z.jsx)(tg,{className:`h-4 w-2/3`}),(0,Z.jsx)(tg,{className:`h-4 w-1/2`}),(0,Z.jsx)(tg,{className:`h-4 w-3/4`}),(0,Z.jsx)(tg,{className:`h-4 w-2/5`})]}):(0,Z.jsx)(`div`,{id:I,role:`listbox`,"aria-label":u({id:`KX1MZR`}),className:`py-1`,children:de.length===0?(0,Z.jsx)(`div`,{role:`presentation`,className:`px-3 py-2 text-xs text-muted-foreground`,children:b&&b.length===0?(0,Z.jsx)(Y,{id:`cOSAfL`}):(0,Z.jsx)(Y,{id:`8eW0WQ`})}):de.map((e,t)=>(0,Z.jsxs)(`div`,{id:`${I}-opt-${t}`,role:`option`,tabIndex:-1,"aria-selected":t===j,onMouseDown:Z7,onMouseEnter:()=>M(t),onClick:()=>ce(e),className:gr(`flex cursor-default items-center gap-2 px-3 py-1.5 text-sm`,t===j&&`bg-accent text-accent-foreground`),children:[e.private?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ob,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`n5n_vi`})})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Fd,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`NuH1jp`})})]}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.full_name})]},e.full_name))})})]})]}),t[64]=u,t[65]=j,t[66]=D,t[67]=xe,t[68]=G,t[69]=T,t[70]=I,t[71]=_e,t[72]=i,t[73]=he,t[74]=le,t[75]=b,t[76]=ce,t[77]=de,t[78]=g,t[79]=we):we=t[79];let Te;t[80]!==D||t[81]!==v||t[82]!==h?(Te=!h&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`label`,{htmlFor:`clone-path`,className:`text-sm font-medium`,children:(0,Z.jsx)(Y,{id:`Gp_twO`})}),(0,Z.jsx)(dh,{id:`clone-path`,placeholder:`~/Documents/repo-name`,value:v,onChange:e=>y(e.target.value),disabled:D})]}),t[80]=D,t[81]=v,t[82]=h,t[83]=Te):Te=t[83];let Ee;t[84]!==we||t[85]!==Te?(Ee=(0,Z.jsx)(Xr,{children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[we,Te]})}),t[84]=we,t[85]=Te,t[86]=Ee):Ee=t[86];let De;t[87]!==D||t[88]!==K||t[89]!==oe||t[90]!==g||t[91]!==h?(De=(0,Z.jsx)(Zr,{children:D?(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:q,children:(0,Z.jsx)(Y,{id:`dEgA5A`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:()=>oe(!1),children:(0,Z.jsx)(Y,{id:`dEgA5A`})}),(0,Z.jsx)(X,{onClick:()=>void K(),disabled:!g.trim(),"aria-describedby":h?`clone-picker-hint`:void 0,children:(0,Z.jsx)(Y,{id:`9UQ730`})}),h&&(0,Z.jsx)(`span`,{id:`clone-picker-hint`,className:`sr-only`,children:(0,Z.jsx)(Y,{id:`EvPX7f`})})]})}),t[87]=D,t[88]=K,t[89]=oe,t[90]=g,t[91]=h,t[92]=De):De=t[92];let Oe;t[93]!==Ee||t[94]!==De?(Oe=(0,Z.jsxs)(Yr,{className:`sm:max-w-lg`,children:[Se,Ee,De]}),t[93]=Ee,t[94]=De,t[95]=Oe):Oe=t[95];let ke;return t[96]!==oe||t[97]!==n||t[98]!==Oe?(ke=(0,Z.jsx)(ei,{open:n,onOpenChange:oe,children:Oe}),t[96]=oe,t[97]=n,t[98]=Oe,t[99]=ke):ke=t[99],ke}function Z7(e){return e.preventDefault()}function Q7(e){return e.stopPropagation()}function $7(e){return e.stopPropagation()}function e9(e){return e.preventDefault()}function t9(e){return e.preventDefault()}function n9(e){return Math.max(e-1,-1)}var r9=(0,Q.lazy)(()=>n(()=>import(`./ConsentDialogBody-XPmv8PGk.js`),__vite__mapDeps([230,1,28,2,3,29,30,31,32,33,7,8,9,23,11,12,13,18,10,14,15,16,17,19,20,21,99,84,231,37,127,91,45,92,104,131,132,40,41,152,42,43,44,103,220,109,110,68,161,108,147]),import.meta.url));function i9(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(Dh.subscribe,o9,a9))return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(r9,{})}),e[0]=t):t=e[0],t}function a9(){return!1}function o9(){return Dh.getSnapshot()!==null}var s9=(0,Q.lazy)(()=>n(()=>import(`./ShareReceiveDialog-B92aqQEx.js`).then(e=>({default:e.ShareReceiveDialog})),__vite__mapDeps([232,1,28,2,3,29,30,31,32,33,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,26,84,224,226,227,37]),import.meta.url)),c9=(0,Q.lazy)(()=>n(()=>import(`./AppMenubar-DS-GyfEA.js`).then(e=>({default:e.AppMenubar})),__vite__mapDeps([207,1,7,8,9,11,12,13,40,130,43,44,45,14,15,41,92,21,99,18,208,36,37,19,17]),import.meta.url)),l9=(e,t,n)=>SC(e,t,n,`NavigatorApp`);function u9(e,t){return e.filter(e=>e.path!==t)}function d9(e){let t=(0,$.c)(159),{bridge:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=new Map,t[1]=o):o=t[1];let[s,c]=(0,Q.useState)(o),[l,u]=(0,Q.useState)(!0),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(void 0),[D,O]=(0,Q.useState)(void 0),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(!1),[N,P]=(0,Q.useState)(null),F=typeof window<`u`&&window.okDesktop!=null,[I,L]=(0,Q.useState)(`auth`),{theme:R}=sr(),{_:z}=Bn();jm(n,R??`system`);let B;t[2]===n.config.languagePreference?B=t[3]:(B=Am(n.config.languagePreference)??Mm(),t[2]=n.config.languagePreference,t[3]=B);let V;t[4]===B?V=t[5]:(V={preference:B,userConfigSynced:!0},t[4]=B,t[5]=V),km(V);let ee;t[6]!==z||t[7]!==n.project?(ee=()=>{let e=!1;return n.project.listRecent().then(async t=>{if(e)return;a(t);let r=t.filter(f9),i=await Promise.all(r.map(async e=>{try{let{currentBranch:t}=await n.project.readHeadBranch(e.path);return[e.path,t]}catch{return[e.path,null]}}));e||c(e=>{let t=new Map(e);for(let[e,n]of i)t.set(e,n);return t})}).catch(t=>{console.error(`[NavigatorApp] listRecent failed:`,t),e||(m(t instanceof Error?t.message:z({id:`fYKgzG`})),f(!0))}).finally(()=>{e||u(!1)}),()=>{e=!0}},t[6]=z,t[7]=n.project,t[8]=ee):ee=t[8];let H;t[9]!==z||t[10]!==n?(H=[n,z],t[9]=z,t[10]=n,t[11]=H):H=t[11],(0,Q.useEffect)(ee,H);let U,W;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>fr((e,t)=>{e===`new-project`&&b(!0),e===`report-bug`&&S(e=>e??t),e===`send-feedback`&&w(!0),e===`close-active-tab-or-window`&&window.close()}),W=[],t[12]=U,t[13]=W):(U=t[12],W=t[13]),(0,Q.useEffect)(U,W);let G,te;t[14]===n?(G=t[15],te=t[16]):(te=()=>n.onRecentRemovedMissing(e=>{let{path:t}=e;a(e=>u9(e,t)),c(e=>{if(!e.has(t))return e;let n=new Map(e);return n.delete(t),n})}),G=[n],t[14]=n,t[15]=G,t[16]=te),(0,Q.useEffect)(te,G);let ne;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(e,t)=>l9(e,t,m),t[17]=ne):ne=t[17];let re=ne,K;t[18]!==z||t[19]!==n?(K=(e,t,r)=>re(()=>(g(r),_9(n,e,t).finally(()=>g(null))),z({id:`SUOoXn`})),t[18]=z,t[19]=n,t[20]=K):K=t[20];let ie=K,q;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(q=()=>v(!0),t[21]=q):q=t[21];let ae=q,oe;t[22]!==z||t[23]!==n?(oe=()=>re(async()=>{let e=await n.dialog.openFolder();e&&(g(v9(e)),await _9(n,e,`pick-existing`).finally(()=>g(null)))},z({id:`gmJ0An`})),t[22]=z,t[23]=n,t[24]=oe):oe=t[24];let se=oe,ce;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(ce=()=>b(!0),t[25]=ce):ce=t[25];let le=ce,ue;t[26]!==z||t[27]!==n.project?(ue=()=>re(()=>n.project.openFile(),z({id:`8vCZcs`})),t[26]=z,t[27]=n.project,t[28]=ue):ue=t[28];let de=ue,fe;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(e,t)=>{E(e),O(t),b(!0)},t[29]=fe):fe=t[29];let pe=fe,J;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(J=e=>{b(e),e||(E(void 0),O(void 0))},t[30]=J):J=t[30];let me=J,he;t[31]===ie?he=t[32]:(he=e=>ie(e,`recents`,v9(e)),t[31]=ie,t[32]=he);let ge=he,_e;t[33]!==z||t[34]!==n.project?(_e=e=>re(async()=>{await n.project.removeRecent(e),a(t=>u9(t,e)),c(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},z({id:`viwC-K`})),t[33]=z,t[34]=n.project,t[35]=_e):_e=t[35];let ve=_e,ye;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(ye=(0,Z.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 top-0 z-10 h-9 ${F?`[-webkit-app-region:drag]`:``}`,"data-electron-drag":F?``:void 0,"data-testid":`nav-chrome-row`,children:S_()&&(0,Z.jsx)(`div`,{className:`pointer-events-auto flex h-full items-center px-2`,children:(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(c9,{})})})}),t[36]=ye):ye=t[36];let be;t[37]!==z||t[38]!==h?(be=h===null?null:(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-20 flex flex-col items-center justify-center gap-3 bg-primary-foreground/85 dark:bg-background/85 backdrop-blur-sm`,"data-testid":`nav-opening-overlay`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(ip,{"aria-hidden":`true`,className:`size-6 text-muted-foreground`}),(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:z({id:`s0_GnA`,values:{openingLabel:h}})})]}),t[37]=z,t[38]=h,t[39]=be):be=t[39];let xe;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Z.jsx)(B_,{className:`size-12 shrink-0`}),t[40]=xe):xe=t[40];let Se;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`h1`,{className:`font-medium text-xl tracking-tight`,children:`OpenKnowledge`}),(0,Z.jsx)(HV,{})]}),t[41]=Se):Se=t[41];let Ce;t[42]===n.appVersion?Ce=t[43]:(Ce=(0,Z.jsxs)(`header`,{className:`shrink-0 flex-wrap flex items-center gap-2.5`,children:[xe,(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[Se,(0,Z.jsxs)(`p`,{className:`text-muted-foreground text-xs font-mono`,children:[`v`,n.appVersion]})]})]}),t[42]=n.appVersion,t[43]=Ce);let we;t[44]===z?we=t[45]:(we=z({id:`wbv9xO`}),t[44]=z,t[45]=we);let Te;t[46]===z?Te=t[47]:(Te=z({id:`0uTHCg`}),t[46]=z,t[47]=Te);let Ee;t[48]!==we||t[49]!==Te?(Ee=(0,Z.jsx)(p9,{title:we,description:Te,onClick:le,dataTestId:`nav-create-new`,Icon:dr}),t[48]=we,t[49]=Te,t[50]=Ee):Ee=t[50];let De;t[51]===z?De=t[52]:(De=z({id:`WPwDin`}),t[51]=z,t[52]=De);let Oe;t[53]===z?Oe=t[54]:(Oe=z({id:`tUvUfp`}),t[53]=z,t[54]=Oe);let ke;t[55]!==se||t[56]!==De||t[57]!==Oe?(ke=(0,Z.jsx)(p9,{title:De,description:Oe,onClick:se,dataTestId:`nav-open`,Icon:Wf}),t[55]=se,t[56]=De,t[57]=Oe,t[58]=ke):ke=t[58];let Ae;t[59]===z?Ae=t[60]:(Ae=z({id:`ka6Eke`}),t[59]=z,t[60]=Ae);let je;t[61]===z?je=t[62]:(je=z({id:`gOD68k`}),t[61]=z,t[62]=je);let Me;t[63]!==de||t[64]!==Ae||t[65]!==je?(Me=(0,Z.jsx)(p9,{title:Ae,description:je,onClick:de,dataTestId:`nav-open-file`,Icon:xi}),t[63]=de,t[64]=Ae,t[65]=je,t[66]=Me):Me=t[66];let Ne;t[67]===z?Ne=t[68]:(Ne=z({id:`VdXv4D`}),t[67]=z,t[68]=Ne);let Pe;t[69]===z?Pe=t[70]:(Pe=z({id:`JOcPqH`}),t[69]=z,t[70]=Pe);let Fe;t[71]!==Ne||t[72]!==Pe?(Fe=(0,Z.jsx)(p9,{title:Ne,description:Pe,onClick:ae,dataTestId:`nav-clone`,Icon:Jx}),t[71]=Ne,t[72]=Pe,t[73]=Fe):Fe=t[73];let Ie;t[74]!==Ee||t[75]!==ke||t[76]!==Me||t[77]!==Fe?(Ie=(0,Z.jsxs)(`section`,{className:`grid sm:grid-cols-2 gap-3`,children:[Ee,ke,Me,Fe]}),t[74]=Ee,t[75]=ke,t[76]=Me,t[77]=Fe,t[78]=Ie):Ie=t[78];let Le;t[79]!==l||t[80]!==i||t[81]!==d?(Le=!l&&!d&&i.length===0?(0,Z.jsx)(h9,{onPackSelect:pe}):null,t[79]=l,t[80]=i,t[81]=d,t[82]=Le):Le=t[82];let Re;t[83]!==Ie||t[84]!==Le?(Re=(0,Z.jsxs)(`div`,{className:`shrink-0 space-y-6`,children:[Ie,Le]}),t[83]=Ie,t[84]=Le,t[85]=Re):Re=t[85];let ze;t[86]===p?ze=t[87]:(ze=p===null?null:(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 rounded-md border border-red-500/30 bg-red-500/10 px-3 py-2`,"data-testid":`nav-error-banner`,role:`alert`,children:[(0,Z.jsx)(`span`,{className:`text-red-700 text-xs dark:text-red-300`,children:p}),(0,Z.jsx)(X,{type:`button`,variant:`link`,size:`sm`,onClick:()=>m(null),className:`h-auto p-0 text-red-700 text-xs dark:text-red-300`,"data-testid":`nav-error-dismiss`,children:(0,Z.jsx)(Y,{id:`1QfxQT`})})]}),t[86]=p,t[87]=ze);let Be;t[88]!==l||t[89]!==ge||t[90]!==ve||t[91]!==s||t[92]!==i?(Be=l?(0,Z.jsx)(`section`,{className:`flex shrink-0 flex-col items-center`,children:(0,Z.jsx)(ip,{className:`size-4 text-muted-foreground/60`})}):i.length>0?(0,Z.jsxs)(`section`,{className:`flex min-h-0 flex-col`,children:[(0,Z.jsx)(`h2`,{className:`mb-2 shrink-0 font-medium text-muted-foreground font-mono text-xs uppercase tracking-wide`,children:(0,Z.jsx)(Y,{id:`CCTop_`})}),(0,Z.jsx)(`ul`,{className:`min-h-0 max-h-48 subtle-scrollbar scroll-fade-mask overflow-y-auto space-y-0.5 -mx-4`,"data-testid":`nav-recent-list`,children:i.map(e=>(0,Z.jsx)(g9,{project:e,branch:s.get(e.path)??null,onOpen:()=>ge(e.path),onRemove:()=>ve(e.path)},e.path))})]}):null,t[88]=l,t[89]=ge,t[90]=ve,t[91]=s,t[92]=i,t[93]=Be):Be=t[93];let Ve;t[94]!==Ce||t[95]!==Re||t[96]!==ze||t[97]!==Be?(Ve=(0,Z.jsx)(`div`,{className:`mx-auto flex h-full w-full max-w-5xl flex-col overflow-hidden px-12 py-12`,children:(0,Z.jsxs)(`div`,{className:`my-auto flex min-h-0 flex-col space-y-10`,children:[Ce,Re,ze,Be]})}),t[94]=Ce,t[95]=Re,t[96]=ze,t[97]=Be,t[98]=Ve):Ve=t[98];let He,Ue;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,Z.jsx)(U5,{}),Ue=(0,Z.jsx)(i9,{}),t[99]=He,t[100]=Ue):(He=t[99],Ue=t[100]);let We;t[101]!==n||t[102]!==y||t[103]!==T||t[104]!==D?(We=(0,Z.jsx)(Lx,{open:y,onOpenChange:me,bridge:n,initialPackId:T,packs:D}),t[101]=n,t[102]=y,t[103]=T,t[104]=D,t[105]=We):We=t[105];let Ge=x!==null,Ke;t[106]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=e=>{e||S(null)},t[106]=Ke):Ke=t[106];let qe=x?.launcherBorne===!0,Je;t[107]!==Ge||t[108]!==qe?(Je=(0,Z.jsx)(Fr,{open:Ge,onOpenChange:Ke,launcherBorne:qe,systemWide:!0}),t[107]=Ge,t[108]=qe,t[109]=Je):Je=t[109];let Ye;t[110]===C?Ye=t[111]:(Ye=(0,Z.jsx)(HS,{open:C,onOpenChange:w,source:`help_menu`}),t[110]=C,t[111]=Ye);let Xe;t[112]===N?Xe=t[113]:(Xe=e=>{A(e),e||(M(!1),N&&(N(null),P(null)))},t[112]=N,t[113]=Xe);let Ze;t[114]===n?Ze=t[115]:(Ze=ef(n),t[114]=n,t[115]=Ze);let Qe;t[116]===n?Qe=t[117]:(Qe=Yd(n),t[116]=n,t[117]=Qe);let $e=I===`identity`,et;t[118]!==j||t[119]!==N?(et=e=>{A(!1),j&&(M(!1),v(!0)),N&&(N({authenticated:!0,host:`github.com`,login:e.login}),P(null))},t[118]=j,t[119]=N,t[120]=et):et=t[120];let tt;t[121]!==k||t[122]!==Xe||t[123]!==Ze||t[124]!==Qe||t[125]!==$e||t[126]!==et?(tt=(0,Z.jsx)(Kd,{open:k,onOpenChange:Xe,transport:Ze,queryTransport:Qe,identityPrompt:$e,onSuccess:et}),t[121]=k,t[122]=Xe,t[123]=Ze,t[124]=Qe,t[125]=$e,t[126]=et,t[127]=tt):tt=t[127];let nt;t[128]===n?nt=t[129]:(nt=q7(n),t[128]=n,t[129]=nt);let rt;t[130]===n?rt=t[131]:(rt=Yd(n),t[130]=n,t[131]=rt);let it;t[132]===n.dialog?it=t[133]:(it=()=>n.dialog.openFolder(),t[132]=n.dialog,t[133]=it);let at;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(at=()=>{v(!1),L(`auth`),M(!0),A(!0)},t[134]=at):at=t[134];let ot;t[135]!==z||t[136]!==n?(ot=e=>{let{dir:t}=e;re(()=>(g(v9(t)),_9(n,t,`pick-existing`).finally(()=>g(null))),z({id:`iSnkwB`}))},t[135]=z,t[136]=n,t[137]=ot):ot=t[137];let st;t[138]!==_||t[139]!==nt||t[140]!==rt||t[141]!==it||t[142]!==ot?(st=(0,Z.jsx)(X7,{open:_,onOpenChange:v,transport:nt,authQueryTransport:rt,pickParentFolder:it,onSignIn:at,onCloneComplete:ot}),t[138]=_,t[139]=nt,t[140]=rt,t[141]=it,t[142]=ot,t[143]=st):st=t[143];let ct;if(t[144]!==n){let e;t[146]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>new Promise(e=>{P(()=>e),A(!0)}),t[146]=e):e=t[146],ct=G7({bridge:n,authQueryTransport:Yd(n),cloneTransport:q7(n),openSignIn:e}),t[144]=n,t[145]=ct}else ct=t[145];let lt;t[147]!==n||t[148]!==ct?(lt=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(s9,{bridge:n,cloneController:ct})}),t[147]=n,t[148]=ct,t[149]=lt):lt=t[149];let ut;return t[150]!==be||t[151]!==Ve||t[152]!==We||t[153]!==Je||t[154]!==Ye||t[155]!==tt||t[156]!==st||t[157]!==lt?(ut=(0,Z.jsxs)(`div`,{className:`relative flex h-screen w-screen flex-col overflow-hidden bg-primary-foreground dark:bg-background text-foreground`,children:[ye,be,Ve,He,Ue,We,Je,Ye,tt,st,lt]}),t[150]=be,t[151]=Ve,t[152]=We,t[153]=Je,t[154]=Ye,t[155]=tt,t[156]=st,t[157]=lt,t[158]=ut):ut=t[158],ut}function f9(e){return!e.missing}function p9(e){let t=(0,$.c)(14),{title:n,description:r,onClick:i,dataTestId:a,Icon:o}=e,s;t[0]===o?s=t[1]:(s=o?(0,Z.jsx)(o,{className:`size-4 shrink-0 text-muted-foreground`}):null,t[0]=o,t[1]=s);let c;t[2]===n?c=t[3]:(c=(0,Z.jsx)(`span`,{className:`font-medium text-foreground text-sm`,children:n}),t[2]=n,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]===r?u=t[8]:(u=(0,Z.jsx)(`span`,{className:`line-clamp-2 text-muted-foreground text-xs leading-snug`,children:r}),t[7]=r,t[8]=u);let d;return t[9]!==a||t[10]!==i||t[11]!==l||t[12]!==u?(d=(0,Z.jsxs)(X,{type:`button`,variant:`outline`,onClick:i,"data-testid":a,className:`h-auto flex-col items-start justify-start gap-1.5 whitespace-normal bg-card px-4 py-3.5 text-left`,children:[l,u]}),t[9]=a,t[10]=i,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}var m9=3;function h9(e){let t=(0,$.c)(27),{onPackSelect:n}=e,{_:r}=Bn(),[i,a]=(0,Q.useState)(null),o,s;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{let e=!1;return(async()=>{try{let t=await _x().listPacks();if(e)return;t.ok?a(t.packs):(console.error(`[NavigatorApp] listPacks returned error:`,t),a([]))}catch(t){let n=t;if(e)return;console.error(`[NavigatorApp] listPacks failed:`,n),a([])}})(),()=>{e=!0}},s=[],t[0]=o,t[1]=s):(o=t[0],s=t[1]),(0,Q.useEffect)(o,s),i===null||i.length===0)return null;let c,l,u,d,f,p;if(t[2]!==n||t[3]!==i){let e=i.slice(0,m9);c=i.length-e.length;let r=e=>n(e,i);d=`flex flex-wrap items-center gap-x-3 gap-y-2`,f=`nav-starter-packs`,t[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:(0,Z.jsx)(Y,{id:`C-xgad`})}),t[10]=p):p=t[10],l=`flex flex-wrap items-center gap-2`;let a;t[11]===r?a=t[12]:(a=e=>{let t=yx(e.id);return(0,Z.jsxs)(Ur,{children:[(0,Z.jsx)(Br,{asChild:!0,children:(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,className:`rounded-full`,onClick:()=>r(e.id),"data-testid":`nav-pack-pill-${e.id}`,children:[(0,Z.jsx)(t,{className:`size-3.5 text-muted-foreground`}),e.name]})}),(0,Z.jsx)(Vr,{children:e.description})]},e.id)},t[11]=r,t[12]=a),u=e.map(a),t[2]=n,t[3]=i,t[4]=c,t[5]=l,t[6]=u,t[7]=d,t[8]=f,t[9]=p}else c=t[4],l=t[5],u=t[6],d=t[7],f=t[8],p=t[9];let m;t[13]!==r||t[14]!==n||t[15]!==c||t[16]!==i?(m=c>0?(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`sm`,className:`rounded-full`,onClick:()=>n(void 0,i),"aria-label":r({id:`e4FxjG`,values:{0:i.length}}),"data-testid":`nav-pack-more`,children:(0,Z.jsx)(Y,{id:`B6Lac2`,values:{overflowCount:c}})}):null,t[13]=r,t[14]=n,t[15]=c,t[16]=i,t[17]=m):m=t[17];let h;t[18]!==l||t[19]!==u||t[20]!==m?(h=(0,Z.jsxs)(`div`,{className:l,children:[u,m]}),t[18]=l,t[19]=u,t[20]=m,t[21]=h):h=t[21];let g;return t[22]!==d||t[23]!==f||t[24]!==p||t[25]!==h?(g=(0,Z.jsxs)(`section`,{className:d,"data-testid":f,children:[p,h]}),t[22]=d,t[23]=f,t[24]=p,t[25]=h,t[26]=g):g=t[26],g}function g9(e){let t=(0,$.c)(43),{project:n,branch:r,onOpen:i,onRemove:a}=e,{_:o}=Bn(),{name:s}=n,c=n.isLinkedWorktree===!0,l=c?n.branch??r:r,u=n.path,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Kf,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-muted-foreground`}),t[0]=d):d=t[0];let f;t[1]===n.name?f=t[2]:(f=(0,Z.jsx)(`span`,{className:`truncate font-medium text-sm text-gray-700 dark:text-foreground`,children:n.name}),t[1]=n.name,t[2]=f);let p;t[3]===c?p=t[4]:(p=c?(0,Z.jsxs)(Sh,{variant:`secondary`,className:`shrink-0 gap-1 rounded-full border-transparent bg-green-600/10 px-2 py-0 font-medium text-2xs text-green-800 dark:bg-green-400/10 dark:text-green-400`,children:[(0,Z.jsx)(vu,{"aria-hidden":`true`,className:`size-2.5`}),(0,Z.jsx)(Y,{id:`z-lawV`})]}):null,t[3]=c,t[4]=p);let m;t[5]!==f||t[6]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[f,p]}),t[5]=f,t[6]=p,t[7]=m):m=t[7];let h=c?n.mainRoot??``:n.path,g;t[8]!==c||t[9]!==n.mainRoot||t[10]!==n.path?(g=c?(0,Z.jsx)(Y,{id:`PRnH8G`,values:{0:MC(n.mainRoot??``)}}):n.path,t[8]=c,t[9]=n.mainRoot,t[10]=n.path,t[11]=g):g=t[11];let _;t[12]!==h||t[13]!==g?(_=(0,Z.jsx)(`span`,{className:`truncate w-full text-muted-foreground text-xs`,title:h,children:g}),t[12]=h,t[13]=g,t[14]=_):_=t[14];let v;t[15]!==m||t[16]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[d,(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 truncate`,children:[m,_]})]}),t[15]=m,t[16]=_,t[17]=v):v=t[17];let y;t[18]!==n.path||t[19]!==l?(y=l==null?null:(0,Z.jsxs)(`span`,{className:`flex max-w-[40%] items-center gap-1 text-muted-foreground text-xs`,"data-testid":`nav-recent-branch-${n.path}`,children:[(0,Z.jsx)(vu,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate font-mono`,children:l})]}),t[18]=n.path,t[19]=l,t[20]=y):y=t[20];let b;t[21]!==i||t[22]!==y||t[23]!==v?(b=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,onClick:i,className:`h-auto min-w-0 flex-1 justify-between gap-3 py-3.5 pl-4 pr-2 text-left hover:bg-transparent`,children:[v,y]}),t[21]=i,t[22]=y,t[23]=v,t[24]=b):b=t[24];let x;t[25]!==o||t[26]!==s?(x=o({id:`hDoLrm`,values:{projectName:s}}),t[25]=o,t[26]=s,t[27]=x):x=t[27];let S;t[28]===o?S=t[29]:(S=o({id:`Es-eZU`}),t[28]=o,t[29]=S);let C=`nav-recent-remove-${n.path}`,w;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(zp,{"aria-hidden":`true`}),t[30]=w):w=t[30];let T;t[31]!==a||t[32]!==x||t[33]!==S||t[34]!==C?(T=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:a,"aria-label":x,title:S,className:`pointer-events-none mr-2 opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 focus-visible:pointer-events-auto focus-visible:opacity-100`,"data-testid":C,children:w}),t[31]=a,t[32]=x,t[33]=S,t[34]=C,t[35]=T):T=t[35];let E;t[36]!==b||t[37]!==T?(E=(0,Z.jsxs)(`li`,{className:`group flex items-center justify-between rounded-lg hover:bg-accent`,children:[b,T]}),t[36]=b,t[37]=T,t[38]=E):E=t[38];let D;return t[39]!==a||t[40]!==n.path||t[41]!==E?(D=(0,Z.jsx)(FC,{path:u,onRemoveRecent:a,testIdPrefix:`nav-recent`,children:E}),t[39]=a,t[40]=n.path,t[41]=E,t[42]=D):D=t[42],D}async function _9(e,t,n){await e.project.open({path:t,target:`new-window`,entryPoint:n})}function v9(e){let t=e.split(/[/\\]/).filter(Boolean);return t.length>0?t[t.length-1]??e:e}var y9=(0,Q.lazy)(()=>n(()=>import(`./TerminalWindowApp-DjRpidld.js`).then(e=>({default:e.TerminalWindowApp})),__vite__mapDeps([233,1,83,2,28,3,29,30,31,32,33,37,66,9,18,8,84,13,85,86,87,88,89,211,125,7,128,11,12,129,130,43,44,45,40,14,15,41,21,92,99,19,17,118,119,42,46,16,135,24,212,26,213,106,96,34,20,214,157,108,147,109,110,215,180,158,159,210,216,148,69,234,235]),import.meta.url));function b9(e){return e?.config.mode===`terminal`?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(y9,{bridge:e})}):e?.config.mode===`navigator`?(0,Z.jsx)(d9,{bridge:e}):(0,Z.jsx)(V7,{})}function x9(){let e=null,t=new Set,n=!1,r=null;function i(){for(let e of t)e()}function a(){e!==null&&(e=null,i())}return{install({bridge:t}){let o=t?.bugReport?.onCrashDetected;if(typeof o==`function`)return n?r??void 0:(n=!0,r=o(t=>{e=t,i()}),()=>{r?.(),r=null,n=!1,a()})},getSnapshot(){return e},subscribe(e){return t.add(e),()=>{t.delete(e)}},dismiss(){a()}}}var S9=x9();function C9(e){return S9.install(e)}function w9(e){let t=(0,$.c)(7),{bridge:n}=e,r=(0,Q.useSyncExternalStore)(S9.subscribe,S9.getSnapshot);if(r===null)return null;let i;t[0]!==n.bugReport||t[1]!==r.eventId?(i=e=>{e||(n.bugReport.crashAck({eventId:r.eventId}),S9.dismiss())},t[0]=n.bugReport,t[1]=r.eventId,t[2]=i):i=t[2];let a=n.config.mode===`navigator`,o;return t[3]!==r||t[4]!==i||t[5]!==a?(o=(0,Z.jsx)(Fr,{open:!0,onOpenChange:i,systemWide:a,crashInvite:r},r.eventId),t[3]=r,t[4]=i,t[5]=a,t[6]=o):o=t[6],o}var T9=e=>{let t=(0,$.c)(8),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{theme:r}=sr(),i=r===void 0?`system`:r,a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={success:(0,Z.jsx)(Ld,{className:`size-4`}),info:(0,Z.jsx)(rp,{className:`size-4`}),warning:(0,Z.jsx)(Lp,{className:`size-4`}),error:(0,Z.jsx)(lb,{className:`size-4`}),loading:(0,Z.jsx)(ip,{"aria-hidden":`true`,className:`size-4`})},o={"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`,"--border-radius":`var(--radius)`},t[2]=a,t[3]=o):(a=t[2],o=t[3]);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={classNames:{toast:`cn-toast`}},t[4]=s):s=t[4];let c;return t[5]!==n||t[6]!==i?(c=(0,Z.jsx)(Oc,{theme:i,className:`toaster group`,icons:a,style:o,toastOptions:s,...n}),t[5]=n,t[6]=i,t[7]=c):c=t[7],c},E9=99999;function D9(e){return!Number.isFinite(e)||e<0?0:e>E9?E9:Math.floor(e)}function O9(e){let t=e.locked?`1`:`0`,n=e.settled?`1`:`0`;return`v1 lock=${t} f=${D9(e.inFrame)} n=${D9(e.total)} s=${n}`}function k9(e){let t=e?.classList;return typeof t?.contains==`function`?t.contains(Qt):!1}function A9(){if(typeof window>`u`)return;let e=window.okDesktop?.setDisplayLockCrashKey;if(typeof e==`function`)return e}function j9(e){let t=e.publish??A9();if(t===void 0)return()=>{};let n=e.schedule??(e=>requestAnimationFrame(e)),r=!1,i=!1,a=0,o=0,s=!1,c=0,l=!1,u=e=>{try{t(e)}catch{}},d=()=>{if(i=!1,r)return;if(a===0){l&&(l=!1,u(O9({locked:s,inFrame:c,total:o,settled:!0})));return}let e=a;c=e,a=0,l=!0,i=!0,n(d),u(O9({locked:s,inFrame:e,total:o,settled:!1}))},f=e=>{k9(e.target)&&(s=e.skipped,a+=1,o+=1,!i&&(i=!0,n(d)))};return e.root.addEventListener(`contentvisibilityautostatechange`,f,{capture:!0}),()=>{r=!0,e.root.removeEventListener(`contentvisibilityautostatechange`,f,{capture:!0})}}var M9=Symbol.for(`ok.client.fetchWrapper`);function N9(e={}){if(typeof window>`u`)return;let t=e.apiOrigin&&e.apiOrigin.length>0?e.apiOrigin:void 0;if(window.fetch[M9])return;let n=window.fetch.bind(window),r=ch(),i=((e,i)=>{let a=F9(e,t);if(!a.isApi)return n(e,i);if(e instanceof Request){let t=P9(e.headers,r);return n(new Request(a.url,e),{headers:t})}let o=P9(i?.headers,r);return n(a.url,{...i,headers:o})});i[M9]=!0,window.fetch=i}function P9(e,t){let n=new Headers(e);for(let[e,r]of Object.entries(t))n.set(e,r);return n}function F9(e,t){if(typeof e==`string`){if(e.startsWith(`/api/`))return{isApi:!0,url:t?t+e:e};let n=I9(e);return n&&L9(n,t)?{isApi:!0,url:e}:{isApi:!1,url:e}}let n=e instanceof URL?e:I9(e.url,window.location.origin);if(n&&L9(n,t)){let r=e instanceof URL?e.href:e.url;return t&&(n.origin===window.location.origin||n.protocol===`file:`)?{isApi:!0,url:t+n.pathname+n.search+n.hash}:{isApi:!0,url:r}}return{isApi:!1,url:e instanceof URL?e.href:e.url}}function I9(e,t){try{return new URL(e,t)}catch{return null}}function L9(e,t){if(!e.pathname.startsWith(`/api/`))return!1;if(e.origin===window.location.origin||e.protocol===`file:`)return!0;if(t){let n=I9(t);if(n&&e.origin===n.origin)return!0}return!1}var R9=1500;function z9(e){let t=(0,$.c)(19),{operationId:n,manager:r,actions:i,platform:a}=e,o;t[0]!==r||t[1]!==n?(o=()=>r.get(n),t[0]=r,t[1]=n,t[2]=o):o=t[2];let s=(0,Q.useSyncExternalStore)(r.subscribe,o);if(s===void 0)return null;switch(s.status){case`sending`:{let e;return t[3]!==i||t[4]!==s?(e=(0,Z.jsx)(H9,{operation:s,actions:i}),t[3]=i,t[4]=s,t[5]=e):e=t[5],e}case`sent`:{let e;return t[6]!==i||t[7]!==s?(e=(0,Z.jsx)(U9,{operation:s,actions:i}),t[6]=i,t[7]=s,t[8]=e):e=t[8],e}case`email-draft`:{let e;return t[9]!==i||t[10]!==s||t[11]!==a?(e=(0,Z.jsx)(dee,{operation:s,actions:i,platform:a}),t[9]=i,t[10]=s,t[11]=a,t[12]=e):e=t[12],e}case`failed`:{let e;return t[13]!==i||t[14]!==s||t[15]!==a?(e=(0,Z.jsx)(fee,{operation:s,actions:i,platform:a}),t[13]=i,t[14]=s,t[15]=a,t[16]=e):e=t[16],e}case`already-sending`:{let e;return t[17]===i?e=t[18]:(e=(0,Z.jsx)(pee,{actions:i}),t[17]=i,t[18]=e),e}}}function B9(e){let t=(0,$.c)(5),{icon:n,children:r}=e,i;t[0]===r?i=t[1]:(i=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:r}),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,Z.jsxs)(`div`,{className:`flex w-full gap-3 rounded-lg border bg-popover p-4 text-popover-foreground shadow-lg`,children:[n,i]}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function V9(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-2`,children:n}),t[0]=n,t[1]=r),r}function H9(e){let t=(0,$.c)(21),{operation:n,actions:r}=e,i=(0,Q.useId)(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(ip,{className:`mt-0.5 size-4 shrink-0 text-primary`,"aria-hidden":`true`}),t[0]=a):a=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Y,{id:`M5_9s2`}),t[1]=o):o=t[1];let s;t[2]===i?s=t[3]:(s=(0,Z.jsx)(`p`,{id:i,className:`font-medium text-sm`,children:o}),t[2]=i,t[3]=s);let c;t[4]===n.zipSizeBytes?c=t[5]:(c=op(n.zipSizeBytes),t[4]=n.zipSizeBytes,t[5]=c);let l;t[6]===c?l=t[7]:(l=(0,Z.jsx)(`span`,{className:`ms-auto shrink-0 text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`JJcBCm`,values:{0:c}})}),t[6]=c,t[7]=l);let u;t[8]!==s||t[9]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[s,l]}),t[8]=s,t[9]=l,t[10]=u):u=t[10];let d;t[11]!==n.fillPercent||t[12]!==i?(d=(0,Z.jsx)(ja,{value:null,indeterminateFillPercent:n.fillPercent,"aria-labelledby":i,className:`h-1.5 bg-secondary`}),t[11]=n.fillPercent,t[12]=i,t[13]=d):d=t[13];let f;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(Y,{id:`1QfxQT`}),t[14]=f):f=t[14];let p;t[15]===r.dismiss?p=t[16]:(p=(0,Z.jsx)(V9,{children:(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,onClick:r.dismiss,children:f})}),t[15]=r.dismiss,t[16]=p);let m;return t[17]!==u||t[18]!==d||t[19]!==p?(m=(0,Z.jsxs)(B9,{icon:a,children:[u,d,p]}),t[17]=u,t[18]=d,t[19]=p,t[20]=m):m=t[20],m}function U9(e){let t=(0,$.c)(12),{operation:n,actions:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Uu,{className:`mt-0.5 size-4 shrink-0 text-primary`,"aria-hidden":`true`}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`p`,{className:`font-medium text-sm`,children:(0,Z.jsx)(Y,{id:`IYciRC`})}),t[1]=a):a=t[1];let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:(0,Z.jsx)(Y,{id:`2myNzt`})}),t[2]=o):o=t[2];let s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`N2C89m`})}),t[3]=s):s=t[3];let c;t[4]===n.reference?c=t[5]:(c=(0,Z.jsx)(`span`,{className:`min-w-0 select-all truncate font-mono font-medium text-xs tracking-wide`,children:n.reference}),t[4]=n.reference,t[5]=c);let l;t[6]!==r.writeToClipboard||t[7]!==n.reference?(l=(0,Z.jsx)(mee,{reference:n.reference,write:r.writeToClipboard}),t[6]=r.writeToClipboard,t[7]=n.reference,t[8]=l):l=t[8];let u;return t[9]!==c||t[10]!==l?(u=(0,Z.jsxs)(B9,{icon:i,children:[a,o,(0,Z.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1.5`,children:[s,c,l]})]}),t[9]=c,t[10]=l,t[11]=u):u=t[11],u}function dee(e){let t=(0,$.c)(16),{operation:n,actions:r,platform:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(ap,{className:`mt-0.5 size-4 shrink-0 text-primary`,"aria-hidden":`true`}),t[0]=a):a=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`p`,{className:`font-medium text-sm`,children:(0,Z.jsx)(Y,{id:`6zzhQL`})}),t[1]=o):o=t[1];let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:(0,Z.jsx)(Y,{id:`Udgz4J`})}),t[2]=s):s=t[2];let c;t[3]!==r||t[4]!==n.mailtoUrl?(c=()=>r.openExternal(n.mailtoUrl),t[3]=r,t[4]=n.mailtoUrl,t[5]=c):c=t[5];let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Y,{id:`GuaJb-`}),t[6]=l):l=t[6];let u;t[7]===c?u=t[8]:(u=(0,Z.jsx)(X,{size:`sm`,onClick:c,children:l}),t[7]=c,t[8]=u);let d;t[9]!==r.revealInFileManager||t[10]!==n.zipPath||t[11]!==i?(d=(0,Z.jsx)(W9,{zipPath:n.zipPath,platform:i,onReveal:r.revealInFileManager}),t[9]=r.revealInFileManager,t[10]=n.zipPath,t[11]=i,t[12]=d):d=t[12];let f;return t[13]!==u||t[14]!==d?(f=(0,Z.jsxs)(B9,{icon:a,children:[o,s,(0,Z.jsxs)(V9,{children:[u,d]})]}),t[13]=u,t[14]=d,t[15]=f):f=t[15],f}function fee(e){let t=(0,$.c)(17),{operation:n,actions:r,platform:i}=e,{mailtoUrl:a}=n,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(jd,{className:`mt-0.5 size-4 shrink-0 text-destructive`,"aria-hidden":`true`}),t[0]=o):o=t[0];let s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(`p`,{className:`font-medium text-sm`,children:(0,Z.jsx)(Y,{id:`Wi-VWy`})}),t[1]=s):s=t[1];let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:(0,Z.jsx)(Y,{id:`r7tQuq`})}),t[2]=c):c=t[2];let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Y,{id:`KDw4GX`}),t[3]=l):l=t[3];let u;t[4]===r.retry?u=t[5]:(u=(0,Z.jsx)(X,{size:`sm`,onClick:r.retry,children:l}),t[4]=r.retry,t[5]=u);let d;t[6]!==r||t[7]!==a?(d=a!==void 0&&(0,Z.jsx)(X,{size:`sm`,variant:`outline`,onClick:()=>r.openExternal(a),children:(0,Z.jsx)(Y,{id:`GuaJb-`})}),t[6]=r,t[7]=a,t[8]=d):d=t[8];let f;t[9]!==r.revealInFileManager||t[10]!==n.zipPath||t[11]!==i?(f=(0,Z.jsx)(W9,{zipPath:n.zipPath,platform:i,onReveal:r.revealInFileManager}),t[9]=r.revealInFileManager,t[10]=n.zipPath,t[11]=i,t[12]=f):f=t[12];let p;return t[13]!==u||t[14]!==d||t[15]!==f?(p=(0,Z.jsxs)(B9,{icon:o,children:[s,c,(0,Z.jsxs)(V9,{children:[u,d,f]})]}),t[13]=u,t[14]=d,t[15]=f,t[16]=p):p=t[16],p}function pee(e){let t=(0,$.c)(6),{actions:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(rp,{className:`mt-0.5 size-4 shrink-0 text-primary`,"aria-hidden":`true`}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`p`,{className:`font-medium text-sm`,children:(0,Z.jsx)(Y,{id:`8W9CF6`})}),t[1]=i):i=t[1];let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:(0,Z.jsx)(Y,{id:`7WnfoD`})}),t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Y,{id:`1QfxQT`}),t[3]=o):o=t[3];let s;return t[4]===n.dismiss?s=t[5]:(s=(0,Z.jsxs)(B9,{icon:r,children:[i,a,(0,Z.jsx)(V9,{children:(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,onClick:n.dismiss,children:o})})]}),t[4]=n.dismiss,t[5]=s),s}function W9(e){let t=(0,$.c)(8),{zipPath:n,platform:r,onReveal:i}=e,a;t[0]!==i||t[1]!==n?(a=()=>i(n),t[0]=i,t[1]=n,t[2]=a):a=t[2];let o;t[3]===r?o=t[4]:(o=Rg(r),t[3]=r,t[4]=o);let s;return t[5]!==a||t[6]!==o?(s=(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,onClick:a,children:o}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function mee(e){let t=(0,$.c)(15),{reference:n,write:r}=e,{_:i}=Bn(),[a,o]=(0,Q.useState)(0),s=a>0,c,l;t[0]===a?(c=t[1],l=t[2]):(c=()=>{if(a===0)return;let e=setTimeout(()=>o(0),R9);return()=>clearTimeout(e)},l=[a],t[0]=a,t[1]=c,t[2]=l),(0,Q.useEffect)(c,l);let u;t[3]!==n||t[4]!==r?(u=()=>{Promise.resolve().then(()=>r(n)).then(()=>o(gee),hee)},t[3]=n,t[4]=r,t[5]=u):u=t[5];let d=u,f;t[6]!==i||t[7]!==s?(f=i(s?{id:`PiH3UR`}:{id:`5hFl0U`}),t[6]=i,t[7]=s,t[8]=f):f=t[8];let p;t[9]===s?p=t[10]:(p=s?(0,Z.jsx)(Uu,{className:`size-3.5`,"aria-hidden":`true`}):(0,Z.jsx)(Fn,{className:`size-3.5`,"aria-hidden":`true`}),t[9]=s,t[10]=p);let m;return t[11]!==d||t[12]!==f||t[13]!==p?(m=(0,Z.jsx)(X,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":f,onClick:d,children:p}),t[11]=d,t[12]=f,t[13]=p,t[14]=m):m=t[14],m}function hee(){}function gee(e){return e+1}var _ee=8e3;function vee(e){switch(e){case`sent`:case`already-sending`:return _ee;case`sending`:case`email-draft`:case`failed`:return 1/0}}var G9=!1;function yee(e={}){let t=e.manager??sp;if(t===sp){if(G9)return()=>{};G9=!0}let n=e.bridge,r=new Map;function i(e){return{dismiss:()=>{Dc.dismiss(e)},retry:()=>{t.retryBugReportSend(e)},openExternal:e=>{n?.shell.openExternal(e)},revealInFileManager:e=>{n?.shell.showItemInFolder(e)},writeToClipboard:_r}}function a(e){let{operationId:a,status:o,requestSeq:s}=e;Dc.custom(()=>(0,Q.createElement)(z9,{operationId:a,manager:t,actions:i(a),platform:n?.platform}),{id:a,duration:vee(o)}),r.set(a,{status:o,requestSeq:s})}let o=t.subscribe(()=>{for(let e of t.getSnapshot()){let t=r.get(e.operationId);t!==void 0&&t.status===e.status&&t.requestSeq===e.requestSeq||a(e)}});return()=>{o(),t===sp&&(G9=!1)}}var K9=Symbol.for(`ok.client.logForwarder`),bee=2e3,q9=[`log`,`info`,`warn`,`error`],xee={log:`info`,info:`info`,warn:`warn`,error:`error`};function J9(e){if(typeof e==`string`)return e;if(e instanceof Error)return`${e.name}: ${e.message}`;try{return JSON.stringify(e)??String(e)}catch{return String(e)}}function Y9(e){let t=e.message.length+80;if(e.event&&(t+=e.event.length),e.fields)try{t+=JSON.stringify(e.fields).length}catch{}return t}function See(e={}){let t=e.windowObj??(typeof window<`u`?window:void 0);if(!t||t.okDesktop)return;let n=t;if(n[K9])return;n[K9]=!0;let r=e.consoleObj??console,i=e.documentObj===void 0?typeof document<`u`?document:null:e.documentObj,a=e.flushIntervalMs??bee,o=e.fetchImpl??n.fetch.bind(n),s=e.now??Date.now,c=[],l=0,u=null,d=!1,f=0,p={log:r.log.bind(r),info:r.info.bind(r),warn:r.warn.bind(r),error:r.error.bind(r)};function m(){if(u!==null&&(clearTimeout(u),u=null),c.length===0)return;let e=c.splice(0,100);l=0;let t=f;d=!0;try{o(`/api/client-logs`,{method:`POST`,headers:{"content-type":`application/json`},keepalive:!0,body:JSON.stringify(t>0?{entries:e,droppedSinceLastFlush:t}:{entries:e})}).then(n=>{n.ok?f=Math.max(0,f-t):f+=e.length},()=>{f+=e.length})}catch{f+=e.length}finally{d=!1}}function h(e){if(c.push(e),l+=Y9(e),c.length>100){let e=c.shift();e&&(l-=Y9(e),f+=1)}if(c.length>=100||l>=32768){m();return}u===null&&(u=setTimeout(m,a))}function g(e,t){if(!d)try{let n=no(Tc(t.map(J9).join(` `))),r=t[0],i=typeof r==`string`&&r.length<=32768?r:void 0,a=i?rs(i):null,o=a?.fields;if(o)try{JSON.stringify(o).length>8192&&(o=void 0)}catch{o=void 0}h({level:e,message:n,ts:s(),...a?.event?{event:a.event}:{},...o?{fields:o}:{}})}catch{}}for(let e of q9)r[e]=(...t)=>{p[e](...t),g(xee[e],t)};let _=e=>{if(d)return;let t=e;g(`error`,[`uncaught error: ${t.message} (${t.filename}:${t.lineno}:${t.colno})`])},v=e=>{d||g(`error`,[`unhandledrejection: ${J9(e.reason)}`])},y=()=>m(),b=()=>{i&&i.visibilityState===`hidden`&&m()};n.addEventListener(`error`,_),n.addEventListener(`unhandledrejection`,v),n.addEventListener(`pagehide`,y),i&&i.addEventListener(`visibilitychange`,b);function x(){for(let e of q9)r[e]=p[e];n.removeEventListener(`error`,_),n.removeEventListener(`unhandledrejection`,v),n.removeEventListener(`pagehide`,y),i&&i.removeEventListener(`visibilitychange`,b),u!==null&&(clearTimeout(u),u=null),c.length=0,delete n[K9]}return{flushNow:m,uninstall:x}}function Cee(e,t){if(e.branch===void 0||e.branch===null||e.branch===``||t===``||e.multiCandidate!==!0)return null;let n=e.branch;return{message:Hc._({id:`n5Vy3l`,values:{branch:n}}),description:t}}function wee(e){let t=e.bridge;if(!t)return;let n=e.setHash??(e=>{window.location.hash=e}),r=e.emitToast??((e,t)=>{Dc(e,t)});return t.onDeepLink(e=>{let i=e.kind??`doc`,a={kind:i,path:e.doc,repositoryPath:e.repositoryPath??e.doc,...e.contentRootDepth===void 0?{}:{contentRootDepth:e.contentRootDepth},branch:e.branch??null};if(e.targetMissing===!0){lp.arm(a);return}Ef.arm(a),n(Gp(i,e.doc,i===`doc`?e.branch:void 0));let o=Cee(e,t.config.projectPath);o!==null&&r(o.message,{description:o.description,duration:3e3})})}var X9=4e3,Z9=1440*60*1e3;function Tee(e){let t=e.bridge;if(t&&t.onboarding)return t.onboarding.onToast(e=>{if(e.kind===`ancestor-promote`){let t=e.ancestorPath;Dc.success(Hc._({id:`hAbGf0`,values:{ancestorPath:t}}),{duration:X9});return}if(e.kind===`startup-reclaim`){let t=[];if(e.mcp.status===`repaired`){let n=e.mcp.editors.map(e=>nc[e]??e).join(`, `);t.push(Hc._({id:`FK57sK`,values:{names:n}}))}else e.mcp.status===`failed`&&t.push(Hc._({id:`DMLE5q`}));if(e.path.status===`installed`&&t.push(e.path.summary),e.path.status===`failed`){let n=e.path.summary;t.push(Hc._({id:`L83DKQ`,values:{summary:n}}))}let n=t.length>0?t.join(`; `):Hc._({id:`-X1eoK`}),r=e.mcp.status===`failed`||e.path.status===`failed`,i=e.path.status!==`none`;Dc[r?`error`:`success`](n,{duration:r||i?Z9:X9,position:`bottom-left`});return}if(e.kind===`sharing-refused-tracked`){let t=e.tracked.length;Dc.error(Hc._({id:`LlJ8LD`,values:{trackedCount:t}}),{duration:Z9,description:e.remediation});return}if(e.kind===`sharing-no-git`){Dc.warning(Hc._({id:`GU1Y4A`}),{duration:X9});return}let t=Th(e.gitRoot,e.pickedPath)??e.pickedPath,n=e.gitRoot;Dc.success(Hc._({id:`pZ91JC`,values:{gitRoot:n,subPath:t}}),{duration:X9})})}function Eee(e){return Hc._({id:`wXw19Y`,values:{projectName:e}})}function Dee(e){let t=e.bridge;if(t)return t.onRecentRemovedMissing(({projectName:e})=>{Dc(Eee(e))})}function Oee(e){let t=(0,$.c)(18),{body:n,warning:r,restartLabel:i,cancelLabel:a,onRestart:o,onDismiss:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Lp,{className:`mt-0.5 size-4 shrink-0 text-amber-500`}),t[0]=c):c=t[0];let l;t[1]===n?l=t[2]:(l=(0,Z.jsx)(`p`,{className:`font-medium text-sm`,children:n}),t[1]=n,t[2]=l);let u;t[3]===r?u=t[4]:(u=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:r}),t[3]=r,t[4]=u);let d;t[5]!==o||t[6]!==i?(d=(0,Z.jsx)(X,{size:`sm`,onClick:o,children:i}),t[5]=o,t[6]=i,t[7]=d):d=t[7];let f;t[8]!==a||t[9]!==s?(f=(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,onClick:s,children:a}),t[8]=a,t[9]=s,t[10]=f):f=t[10];let p;t[11]!==d||t[12]!==f?(p=(0,Z.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-2`,children:[d,f]}),t[11]=d,t[12]=f,t[13]=p):p=t[13];let m;return t[14]!==l||t[15]!==u||t[16]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex w-full gap-3 rounded-lg border bg-popover p-4 text-popover-foreground shadow-lg`,children:[c,(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[l,u,p]})]}),t[14]=l,t[15]=u,t[16]=p,t[17]=m):m=t[17],m}function kee(){return Hc._({id:`f_PkYv`})}function Aee(e){return e.serverRuntime===e.appRuntime?Hc._({id:`FWQuPE`,values:{0:e.appRuntime}}):e.relation===`older`?Hc._({id:`LhQlGR`,values:{0:e.serverRuntime,1:e.appRuntime}}):Hc._({id:`yZmvQ4`,values:{0:e.serverRuntime,1:e.appRuntime}})}function jee(e){return Hc._({id:`2YOwme`,values:{appRuntime:e}})}function Mee(e){return e===`eperm`?Hc._({id:`uQewpR`}):Hc._({id:`PqYWiC`})}async function Nee(e){let t=Dc.loading(Hc._({id:`Kf7GG5`}),{duration:1/0}),n;try{n=await e.restartServer(e.config.projectPath)}catch{return}Dc.dismiss(t),n.ok===!1&&Dc.error(Mee(n.reason),{duration:1/0})}function Pee(e){let t=e.bridge;if(!t)return;let n=t.onServerVersionDrift(e=>{Dc.custom(n=>(0,Q.createElement)(Oee,{body:Aee(e),warning:kee(),restartLabel:Hc._({id:`ppDgFi`}),cancelLabel:Hc._({id:`PBxg_E`}),onRestart:()=>{Dc.dismiss(n),Nee(t)},onDismiss:()=>Dc.dismiss(n)}),{duration:1/0})}),r=t.onServerRestarted(e=>{Dc.success(jee(e.appRuntime))});return()=>{n(),r()}}async function Fee(e=typeof navigator<`u`?navigator:void 0){try{let t=e?.storage;return t===void 0||typeof t.persist!=`function`?!1:await t.persist()}catch{return!1}}function Iee(e){let{initialDoc:t}=e;if(!t)return;let n=e.getHash();n!==``&&n!==`#`&&n!==`#/`||e.setHash(qp(t))}function Lee(){typeof window>`u`||!window.okDesktop||Iee({initialDoc:window.okDesktop.config.initialDoc,getHash:()=>window.location.hash,setHash:e=>{window.location.hash=e}})}U_(),n(()=>import(`./telemetry-startup-BFCbpnFp.js`).then(e=>e.initStartupTrace()),__vite__mapDeps([236,0,1,2,3,4,5,59,28,29,30,31,32,33,18,9,8]),import.meta.url),N9({apiOrigin:typeof window<`u`?window.okDesktop?.config.apiOrigin:void 0}),See(),Fee(),rN()&&lN(),mW(),Lj(),DH(),pH(),typeof window<`u`&&window.okDesktop!==void 0&&Nr(),xV(),typeof window<`u`&&wee({bridge:window.okDesktop}),typeof window<`u`&&Pee({bridge:window.okDesktop}),typeof window<`u`&&Dee({bridge:window.okDesktop}),typeof window<`u`&&R_({bridge:window.okDesktop}),typeof window<`u`&&wh({bridge:window.okDesktop}),typeof window<`u`&&Tee({bridge:window.okDesktop}),typeof window<`u`&&H_({bridge:window.okDesktop}),typeof window<`u`&&C9({bridge:window.okDesktop}),typeof window<`u`&&yee({bridge:window.okDesktop}),Lee();var Ree=new J_({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),Q9=document.getElementById(`root`);if(!Q9)throw Error(`Root element not found`);var $9=typeof window>`u`?void 0:window.okDesktop;function zee(){return to(),null}j9({root:document}),(0,Y_.createRoot)(Q9).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(Vn,{i18n:Hc,children:(0,Z.jsxs)(Qn,{client:Ree,children:[(0,Z.jsx)(Cy,{}),(0,Z.jsxs)(cr,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(zee,{}),(0,Z.jsxs)(Hr,{children:[(0,Z.jsx)(yy,{children:b9($9)}),$9!==void 0&&(0,Z.jsx)(xy,{children:(0,Z.jsx)(w9,{bridge:$9})}),(0,Z.jsx)(T9,{richColors:!0,closeButton:!0})]})]})]})})}));export{zW as t};