@inkeep/open-knowledge 0.52.4 → 0.52.5

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 (107) hide show
  1. package/dist/{acp-harness-probe-XTgNAWCH.mjs → acp-harness-probe-D8lWeMYs.mjs} +2 -2
  2. package/dist/cli.mjs +6 -6
  3. package/dist/constants-Cq9xPd4B.mjs +2 -0
  4. package/dist/index.mjs +1 -1
  5. package/dist/init-Bdkg_LMu.mjs +1 -0
  6. package/dist/{init-BLgGQUiA.mjs → init-DAp0k8pn.mjs} +3 -3
  7. package/dist/{launch-json-removal-BY0JfYzW.mjs → launch-json-removal-C1xPWBKL.mjs} +2 -2
  8. package/dist/loader-D6TvYuZR.mjs +1 -0
  9. package/dist/{loader-DFPCRuiv.mjs → loader-DEQaoLYB.mjs} +2 -2
  10. package/dist/preview-Bzc9OLIC.mjs +1 -0
  11. package/dist/{preview-BuOydejY.mjs → preview-CHL4RkuG.mjs} +2 -2
  12. package/dist/public/assets/{ActivityModeContent-82sBOezj.js → ActivityModeContent-DgOXZQPM.js} +1 -1
  13. package/dist/public/assets/{AgentDiffPane-CoeEE99v.js → AgentDiffPane-DxMmxvZ_.js} +1 -1
  14. package/dist/public/assets/{AgentThreadClientBinder-DoXKRY3h.js → AgentThreadClientBinder-Dr4KCMFV.js} +1 -1
  15. package/dist/public/assets/{ChangedOutsideBadge-D047_w8_.js → ChangedOutsideBadge-ChinF2OV.js} +1 -1
  16. package/dist/public/assets/{CodeMirrorPropInput-AfI-A739.js → CodeMirrorPropInput-BG6vAU3f.js} +1 -1
  17. package/dist/public/assets/{DocumentContext-RfseIiCK.js → DocumentContext-dF2iyDoR.js} +1 -1
  18. package/dist/public/assets/{EditorModeToggle-BFLOwOkQ.js → EditorModeToggle-v0ruFGAI.js} +1 -1
  19. package/dist/public/assets/{EnableSyncConfirmDialog-DrKJd8P_.js → EnableSyncConfirmDialog-CoTYoRIg.js} +1 -1
  20. package/dist/public/assets/FeedbackForm-hMBuqLQh.js +1 -0
  21. package/dist/public/assets/{GraphPanel-CIsyWZZL.js → GraphPanel-ovwXA2NQ.js} +1 -1
  22. package/dist/public/assets/{ImportSkillDialog-R8BKwyCS.js → ImportSkillDialog-C4hZ7UL5.js} +1 -1
  23. package/dist/public/assets/{LintConfigEditor-CMXHDFZF.js → LintConfigEditor-Qiz8julD.js} +1 -1
  24. package/dist/public/assets/ManagedArtifactProperties-16Q3Ko9H.js +1 -0
  25. package/dist/public/assets/{ManagedArtifactProperties-BfpBSbt8.js → ManagedArtifactProperties-CNc3-2jZ.js} +1 -1
  26. package/dist/public/assets/{McpConsentDialogBody-D6qWh37S.js → McpConsentDialogBody-BSCT3OvM.js} +1 -1
  27. package/dist/public/assets/{MermaidDocEditor-DbdolXNy.js → MermaidDocEditor-C4p4uQqN.js} +1 -1
  28. package/dist/public/assets/{ReportBugDialogBody-0zuUulQL.js → ReportBugDialogBody-BicwB-J9.js} +1 -1
  29. package/dist/public/assets/{SchemaConfigEditor-rEKhSqJM.js → SchemaConfigEditor-D6hcCq89.js} +1 -1
  30. package/dist/public/assets/{SessionsHost-CGV_FZVZ.js → SessionsHost-OteEtmPR.js} +2 -2
  31. package/dist/public/assets/{SettingsDialogBody-DPjbScQ8.js → SettingsDialogBody-eShyjwp_.js} +1 -1
  32. package/dist/public/assets/{ShareBranchSwitchDialog-BHZw8v-i.js → ShareBranchSwitchDialog-DDrNzFpA.js} +1 -1
  33. package/dist/public/assets/{ShareReceiveDialog-CA7GkSOU.js → ShareReceiveDialog-CXNvnUuO.js} +1 -1
  34. package/dist/public/assets/{ShareReceiveMissDialog-BVb9iCe7.js → ShareReceiveMissDialog-Bzfc6gmc.js} +1 -1
  35. package/dist/public/assets/{SkillEditBanner-Dc5M38zl.js → SkillEditBanner-BAS_3XLj.js} +1 -1
  36. package/dist/public/assets/{SkillOriginInline-B-wdZ-wi.js → SkillOriginInline-CLT-BIkT.js} +1 -1
  37. package/dist/public/assets/{SkillToolbarControls-B1VGCLbB.js → SkillToolbarControls-ChzkHlc2.js} +1 -1
  38. package/dist/public/assets/{SlidesToolbarControls-DpEF1_8n.js → SlidesToolbarControls-XPbdtH71.js} +1 -1
  39. package/dist/public/assets/{SourceEditor-BXsOQKW8.js → SourceEditor-GHoDb1-I.js} +1 -1
  40. package/dist/public/assets/{TerminalPanel-D4k0ePYg.js → TerminalPanel-DxlLFrrc.js} +1 -1
  41. package/dist/public/assets/{TerminalWindowApp-C1Ej4Kb1.js → TerminalWindowApp-CYIfwjHf.js} +1 -1
  42. package/dist/public/assets/{TextDocEditor-DxhziylX.js → TextDocEditor-DfWDVWNo.js} +1 -1
  43. package/dist/public/assets/{ThreadView-DlpPbPgC.js → ThreadView-CbGlUw2z.js} +1 -1
  44. package/dist/public/assets/{TimelineDiffPane-35Fhuse-.js → TimelineDiffPane-CPn64osU.js} +1 -1
  45. package/dist/public/assets/{agent-diff-store-BTtYfAZI.js → agent-diff-store-D6dVnd_h.js} +1 -1
  46. package/dist/public/assets/{auth-state-cache-j2uCE1rv.js → auth-state-cache-Cgyydfw6.js} +1 -1
  47. package/dist/public/assets/{client-version-UVydSM1_.js → client-version-CjhiC-Jt.js} +1 -1
  48. package/dist/public/assets/{comment-chips-CspvZbMA.js → comment-chips-msfGGi8U.js} +1 -1
  49. package/dist/public/assets/{config-provider-DAD08DXO.js → config-provider-D-VNxNBY.js} +1 -1
  50. package/dist/public/assets/{dist-CKFXiBrL.js → dist-8YlYwLg8.js} +1 -1
  51. package/dist/public/assets/{doc-paths-aGtYCY4p.js → doc-paths-78wumkT9.js} +1 -1
  52. package/dist/public/assets/{documents-events-BNjnUfCu.js → documents-events-DKMYe_0X.js} +1 -1
  53. package/dist/public/assets/{file-tree-adapter-BnKrzDCF.js → file-tree-adapter-CGtSLM3V.js} +1 -1
  54. package/dist/public/assets/{file-tree-utils-CPfKs0_W.js → file-tree-utils-CZ9kiPBg.js} +1 -1
  55. package/dist/public/assets/{folder-config-api-C00aXHgv.js → folder-config-api-fyPH9MBe.js} +1 -1
  56. package/dist/public/assets/{follow-file-ClUkwvTW.js → follow-file-BaVLq6cx.js} +1 -1
  57. package/dist/public/assets/i18n-gFEbQZNX.js +1 -0
  58. package/dist/public/assets/{index-DkaSwI0X.js → index-BSXrWulb.js} +8 -8
  59. package/dist/public/assets/{lint-config-client-CwpzRrsJ.js → lint-config-client-CedjssG2.js} +1 -1
  60. package/dist/public/assets/{markdownlint-rule-browser-DDivenan.js → markdownlint-rule-browser-BxyZeWyD.js} +1 -1
  61. package/dist/public/assets/{navigation-targets-BN-b0SwY.js → navigation-targets-BS-NLUXq.js} +1 -1
  62. package/dist/public/assets/{open-managed-artifact-tab-Dxiu79gQ.js → open-managed-artifact-tab-CVw5wiFN.js} +1 -1
  63. package/dist/public/assets/{pending-receive-nav-store-DTGiCG3P.js → pending-receive-nav-store-DyyFinN6.js} +1 -1
  64. package/dist/public/assets/{prop-types-RgJQCViX.js → prop-types-BKsu1Pla.js} +1 -1
  65. package/dist/public/assets/{receive-store-C7RBAUmu.js → receive-store-DbAkD4vm.js} +1 -1
  66. package/dist/public/assets/{selection-context-D_1ahjGj.js → selection-context-DJzHAfeZ.js} +1 -1
  67. package/dist/public/assets/{skill-actions-BKW-L6YY.js → skill-actions-ZS4T13Ax.js} +1 -1
  68. package/dist/public/assets/{skill-scope-D3fqbCKZ.js → skill-scope-CnsZQNOC.js} +1 -1
  69. package/dist/public/assets/{skills-api-BAB9Nk_K.js → skills-api-BYVWoHSe.js} +1 -1
  70. package/dist/public/assets/{src-Dfy4grTv.js → src-Kocvrol1.js} +1 -1
  71. package/dist/public/assets/{tag-pill-input-vgqgNkXB.js → tag-pill-input-CaySXFvi.js} +1 -1
  72. package/dist/public/assets/{target-navigation-intent-DEiFgbdU.js → target-navigation-intent-Djv7KQmO.js} +1 -1
  73. package/dist/public/assets/{terminal-cli-display-Du0YYwUl.js → terminal-cli-display-DghW2MNw.js} +1 -1
  74. package/dist/public/assets/{terminal-launch-events-C5JkD3Qb.js → terminal-launch-events-CBR70eGX.js} +1 -1
  75. package/dist/public/assets/{terminal-telemetry-Cj_uo6eX.js → terminal-telemetry-C1pBFgq5.js} +1 -1
  76. package/dist/public/assets/{typing-burst-detector-vxYjrFWQ.js → typing-burst-detector-mfCCGiI2.js} +1 -1
  77. package/dist/public/assets/{uninstall-C6wmbgyN.js → uninstall-DtIVpzW8.js} +1 -1
  78. package/dist/public/assets/{use-activity-panel-DtCqiYlm.js → use-activity-panel-w209_TE7.js} +1 -1
  79. package/dist/public/assets/{use-apply-config-color-theme-DkVlJHc4.js → use-apply-config-color-theme-lxp6AFtt.js} +1 -1
  80. package/dist/public/assets/{use-collab-url-CpJYowg_.js → use-collab-url-B0illVqB.js} +1 -1
  81. package/dist/public/assets/{use-live-xterm-theme-DfHZqsch.js → use-live-xterm-theme-D4pfJFa6.js} +1 -1
  82. package/dist/public/assets/{use-open-skill-DdTYxJp4.js → use-open-skill-BF7e4PgL.js} +1 -1
  83. package/dist/public/assets/{use-popular-skills-C9TB91tU.js → use-popular-skills-D2yWnUy-.js} +1 -1
  84. package/dist/public/assets/{use-settings-route-D_8EQ_KO.js → use-settings-route-CSes8Uwx.js} +1 -1
  85. package/dist/public/assets/{use-skill-origin-BjB7AiHp.js → use-skill-origin-B7sZ5WC1.js} +1 -1
  86. package/dist/public/assets/{use-skills-DMV2hvXx.js → use-skills-BxzTRUh9.js} +1 -1
  87. package/dist/public/assets/{use-terminal-enabled-D2pvXg6e.js → use-terminal-enabled-DM8hVWf8.js} +1 -1
  88. package/dist/public/assets/{use-timeline-entry-diff-Do0ZBwge.js → use-timeline-entry-diff-DxEnQQVQ.js} +1 -1
  89. package/dist/public/assets/{use-workspace-e-krFmvC.js → use-workspace-DogmR2pu.js} +1 -1
  90. package/dist/public/index.html +44 -44
  91. package/dist/public/uninstall.html +3 -3
  92. package/dist/{repair-launch-json-BgwsX3Jx.mjs → repair-launch-json-Dl0Gey9L.mjs} +2 -2
  93. package/dist/{repair-mcp-configs-CcLsbctb.mjs → repair-mcp-configs-DvqxHaU5.mjs} +2 -2
  94. package/dist/{src-DtvO7rZS.mjs → src-DuQtFnj2.mjs} +2 -2
  95. package/dist/src-lASptBjy.mjs +1 -0
  96. package/dist/start-CXRN7Bpx.mjs +1 -0
  97. package/dist/{start-HJ61fNSx.mjs → start-DhG8qpNf.mjs} +2 -2
  98. package/package.json +5 -5
  99. package/dist/constants-DjzJQLPT.mjs +0 -2
  100. package/dist/init-DRq2NWqE.mjs +0 -1
  101. package/dist/loader-NVyWW4oJ.mjs +0 -1
  102. package/dist/preview-T7rJOVHM.mjs +0 -1
  103. package/dist/public/assets/FeedbackForm-CpyB0Ay7.js +0 -1
  104. package/dist/public/assets/ManagedArtifactProperties-CaU-7RSA.js +0 -1
  105. package/dist/public/assets/i18n-DnAdj3V4.js +0 -1
  106. package/dist/src-BAzYWv6h.mjs +0 -1
  107. package/dist/start-CTUHFYX2.mjs +0 -1
@@ -1,11 +1,11 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-Bvv5kEhb.js","./chunk-CYidjpOJ.js","./preload-helper-Chd9yIcd.js","./trace-api-18gcBe0u.js","./propagation-api-PBYTadVM.js","./ReportBugDialogBody-0zuUulQL.js","./dist-CKFXiBrL.js","./lib-Bgq5iQnh.js","./html-void-elements-C35FEqss.js","./lib-C0Wr4O8I.js","./markdownit-C1Squg6O.js","./w3c-keyname-Bw5giFqP.js","./dist-Nvb76hAm.js","./jsx-runtime-BUgB2tll.js","./react-f2sANaYj.js","./checkbox-vidgONxv.js","./dist-DsLZcVyZ.js","./dist-mv8e6dBX.js","./react-dom-DPxgxlDT.js","./dist-DH4zqp8r.js","./dist-DX6BuR0m.js","./check-CGfmW4da.js","./createLucideIcon-Bhw2PmPp.js","./minus-D07ZsfDZ.js","./compiler-runtime-BfE3aGVn.js","./utils-CPqDy6Hr.js","./bundle-mjs-SHeFpKGC.js","./dialog-DztIj-ZS.js","./dist-BvwnbioL.js","./es2015-wpLRKwCl.js","./button-CA0dewJJ.js","./x-DS57FvHW.js","./progress-BdSO2c_8.js","./CopyButton-ByR_1gcU.js","./tooltip-DHXgxWLL.js","./dist-DmTWt7nC.js","./floating-ui.dom-By-yeALv.js","./spinner-BqySY7qY.js","./BugReportHistory-C59fSH13.js","./collapsible-COrqeoHr.js","./chevron-down-DabHDQTe.js","./folder-open-DUSc8NL8.js","./trash-2-N0ilsnnr.js","./badge-DFX4S3a5.js","./platform-labels-glrfxkSh.js","./dist-DUfEoSbR.js","./triangle-alert-COo6wbUK.js","./input-BYiOK210.js","./textarea-yZk4yd9U.js","./external-link-BIMZpgNa.js","./clipboard-adapter-DqemxSWT.js","./BugReportHistoryDialog-C2b4xA3d.js","./GraphPanel-CIsyWZZL.js","./toggle-group-CZcn-1gX.js","./dist-gTGB_-tT.js","./dist-Bme5LuHX.js","./useQuery-ZeEDLtxh.js","./min-Dbr9KJ3U.js","./src-DlFhp60C.js","./colors-CElM_Snc.js","./ordinal-CBsC_qub.js","./init-B1Vy7sk-.js","./isObject-DaQSDnzB.js","./now-Bs9xiL-y.js","./arrow-up-right-CGe6dTck.js","./prop-types-RgJQCViX.js","./navigation-targets-BN-b0SwY.js","./file-tree-utils-CPfKs0_W.js","./doc-paths-aGtYCY4p.js","./skill-scope-D3fqbCKZ.js","./documents-events-BNjnUfCu.js","./documents-fetch-CV8lWh8v.js","./parse-api-error-DfesE4Y7.js","./startup-marks-Cdkh8q3E.js","./dist-PQ5KMVDh.js","./target-navigation-intent-DEiFgbdU.js","./panel-CbGx_cRv.js","./overlay-layers-Bj-TVfKw.js","./ActivityModeContent-82sBOezj.js","./DocumentContext-RfseIiCK.js","./cm-theme-DZT10ikr.js","./dist-DAqA-GDU.js","./dist-BiwzWInZ.js","./dist-BgBcg3TP.js","./dist-CkFATl39.js","./dist-DfLFtHzK.js","./dist-ofeGnIBD.js","./dist-DQyQPRvE.js","./dist-dO0W-CVt.js","./dist-BVpMlVG3.js","./stex-PMopVeEZ.js","./config-provider-DAD08DXO.js","./dist-B6jB2qbD2.js","./client-version-UVydSM1_.js","./use-apply-config-color-theme-DkVlJHc4.js","./i18n-DnAdj3V4.js","./messages-CT0uUq60.js","./select-CguJodwX.js","./chevron-up-BNZIobnQ.js","./local-menu-action-bus-Cypryz6Z.js","./switch-B2sF5R0q.js","./CodeMirrorPropInput-AfI-A739.js","./asset-dispatch-Cz1weVX3.js","./git-branch-CCnsAeFH.js","./Mermaid-BHfANkja.js","./chevron-right-Diamp-K_.js","./eye-CSz7ogHo.js","./hash-DI30zEBt.js","./info-CV59RycV.js","./paperclip-BlKB6Xwa.js","./file-tree-rename-validation-CCqiFGp1.js","./use-collab-url-CpJYowg_.js","./skills-api-BAB9Nk_K.js","./DocumentContext-B0sQn39F.css","./undo-2-WGCwknr8.js","./agent-diff-store-BTtYfAZI.js","./cursor-B6reg1lS.js","./copilot-Dh1BU6kS.js","./timeline-diff-store-DnRthkM7.js","./use-activity-panel-DtCqiYlm.js","./agent-presence-C3GIHDxc.js","./lru-string-cache-Ckr1Pjrr.js","./ImportSkillDialog-R8BKwyCS.js","./label-B5yNUINo.js","./radio-group-BSCe7mNt.js","./tabs-DlmsMbtD.js","./folder-CopDpuy5.js","./use-popular-skills-C9TB91tU.js","./skeleton-BOVIbSHk.js","./use-open-skill-DdTYxJp4.js","./use-skills-DMV2hvXx.js","./open-managed-artifact-tab-Dxiu79gQ.js","./input-group-BiaQ-rIw.js","./SettingsDialogBody-DPjbScQ8.js","./sortable.esm-Dd5A8_XI.js","./ChangedOutsideBadge-D047_w8_.js","./terminal-cli-display-Du0YYwUl.js","./dropdown-menu-CLgDYkh1.js","./dist-6Kl8HTi9.js","./mascot-outline-CtS592mc.js","./separator-vdmCepR4.js","./EnableSyncConfirmDialog-DrKJd8P_.js","./RegisteredAgentIcon-gjOJZp_B.js","./auth-state-cache-j2uCE1rv.js","./download-C3PYuI1f.js","./folder-config-api-C00aXHgv.js","./refresh-cw-DQervzDZ.js","./field-CtVP3IIV.js","./use-workspace-e-krFmvC.js","./square-pen-Cb57Y3fg.js","./terminal-Cvoe7pfU.js","./form-dlFqxdSN.js","./ConfigSharingInfoTooltip-4T5uhyyt.js","./terminal-command-events-DXmeHtnk.js","./schema-fields-view-intent-DiE8NL9y.js","./lint-plugin-meta-FPoTE-0t.js","./markdownlint-rule-browser-DDivenan.js","./tag-pill-input-vgqgNkXB.js","./lint-config-client-CwpzRrsJ.js","./use-terminal-enabled-D2pvXg6e.js","./terminal-telemetry-Cj_uo6eX.js","./use-settings-route-D_8EQ_KO.js","./ManagedArtifactProperties-CaU-7RSA.js","./ManagedArtifactProperties-BfpBSbt8.js","./format-I3YtNHrv.js","./braces-CJEjDc1f.js","./comment-chips-CspvZbMA.js","./selection-context-D_1ahjGj.js","./MermaidDocEditor-DbdolXNy.js","./dist-BRmJz2fY.js","./dist-z-y_5Bgj.js","./src-Dfy4grTv.js","./TextDocEditor-DxhziylX.js","./text-viewer-languages-oVDGEYYY.js","./SourceEditor-BXsOQKW8.js","./typing-burst-detector-vxYjrFWQ.js","./wrench-CP2MIQHF.js","./SkillToolbarControls-B1VGCLbB.js","./skill-actions-BKW-L6YY.js","./DiffView-C-imhjB8.js","./context-menu-D1MgERPo.js","./list-plus-DBdmIc6v.js","./workspace-paths-CKUFX0v6.js","./SkillOriginInline-B-wdZ-wi.js","./use-skill-origin-BjB7AiHp.js","./SlidesToolbarControls-DpEF1_8n.js","./SkillEditBanner-Dc5M38zl.js","./SkillModeBanner-cMF-HPLA.js","./LintConfigEditor-CMXHDFZF.js","./EditorModeToggle-BFLOwOkQ.js","./useLintConfigViewMode-DX8l9aBY.js","./SchemaConfigEditor-rEKhSqJM.js","./case-sensitive-CE1B0vR4.js","./TimelineDiffPane-35Fhuse-.js","./use-timeline-entry-diff-Do0ZBwge.js","./libesm-DQtLkQQh.js","./panel-right-open-B66oA9M1.js","./AgentDiffPane-CoeEE99v.js","./AppMenubar-CYaE7Hn6.js","./AgentThreadClientBinder-DoXKRY3h.js","./thread-client-DnaLPSLV.js","./SessionsHost-CGV_FZVZ.js","./history-B1SZDFzE.js","./terminal-launch-events-C5JkD3Qb.js","./thread-draft-staging-BG7XGHEN.js","./McpConsentDialogBody-D6qWh37S.js","./mcp-consent-store-BASpxNOZ.js","./ShareBranchSwitchDialog-BHZw8v-i.js","./miss-dialog-store-sSyy54tn.js","./share-metadata-rows-D5y9TY7o.js","./auth-prompt-store-BYOv6_8O.js","./desktop-bridge-types-NXCK8Pd7.js","./receive-store-C7RBAUmu.js","./ShareReceiveMissDialog-BVb9iCe7.js","./pending-receive-nav-store-DTGiCG3P.js","./ConsentDialogBody-DfhGpXdb.js","./project-paths-_w2mRvRX.js","./ShareReceiveDialog-CA7GkSOU.js","./TerminalWindowApp-C1Ej4Kb1.js","./use-live-xterm-theme-DfHZqsch.js","./use-installed-clis-Cydpb5jd.js","./telemetry-startup-C8JOSRcr.js"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./globals-CLY_4Hw9.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,$t as o,A as s,An as c,Ar as l,At as u,Bn as d,Bt as f,C as p,Cn as m,E as h,Er as g,Et as _,F as v,Fn as y,Ft as b,G as x,Gn as S,Hn as C,I as w,In as T,It as E,J as D,Jn as O,Jt as k,K as A,Kt as j,L as M,Ln as N,Lt as P,M as F,Mn as I,Mr as L,Mt as R,N as z,Nn as B,Nr as V,Nt as H,O as U,Or as W,Ot as ee,P as G,Pn as K,Pt as q,Q as te,Qn as J,Qt as ne,Rn as re,Rt as ie,S as ae,Sn as oe,Sr as se,St as ce,T as le,Tn as ue,Tr as de,Tt as fe,V as pe,Vn as me,Vt as he,Wn as ge,X as _e,Xn as ve,Xt as ye,Y as be,Yn as xe,Yt as Se,Z as Ce,Zt as we,_ as Te,_n as Ee,_r as De,a as Oe,an as ke,ar as Ae,at as je,b as Me,bn as Ne,br as Pe,c as Fe,cn as Ie,ct as Le,d as Re,dn as ze,dt as Be,en as Ve,er as He,et as Ue,f as We,fn as Ge,fr as Ke,g as qe,gn as Je,gr as Ye,gt as Xe,h as Ze,hn as Qe,hr as $e,ht as et,i as tt,in as nt,ir as rt,jn as it,jr as at,jt as ot,k as st,kn as ct,kr as lt,kt as ut,l as dt,ln as ft,lr as pt,lt as mt,m as ht,mr as gt,mt as _t,n as vt,nn as yt,o as bt,on as xt,or as St,p as Ct,pr as wt,q as Tt,qn as Et,qt as Dt,r as Ot,rn as kt,rr as At,rt as jt,s as Mt,sn as Nt,sr as Pt,st as Ft,t as It,tn as Lt,tr as Rt,u as zt,ur as Bt,ut as Vt,v as Ht,vn as Ut,vr as Wt,vt as Gt,wn as Kt,wr as qt,wt as Jt,x as Yt,xr as Xt,xt as Zt,y as Qt,yn as $t,yr as en,z as tn,zn as nn,zt as rn}from"./DocumentContext-RfseIiCK.js";import{t as an}from"./react-f2sANaYj.js";import{n as Y,r as on,t as sn}from"./dist-Nvb76hAm.js";import{_ as cn,a as ln,c as un,d as dn,f as fn,g as pn,h as mn,i as hn,l as gn,m as _n,n as vn,o as yn,p as bn,r as xn,s as Sn,t as Cn,u as wn,v as Tn,y as En}from"./useQuery-ZeEDLtxh.js";import{n as Dn,t as On}from"./dist-PQ5KMVDh.js";import{t as kn}from"./react-dom-DPxgxlDT.js";import{t as An}from"./compiler-runtime-BfE3aGVn.js";import{a as jn,c as Mn,i as Nn,l as Pn,n as Fn,o as In,r as Ln,s as Rn,t as zn}from"./local-menu-action-bus-Cypryz6Z.js";import{t as Bn}from"./utils-CPqDy6Hr.js";import{_ as Vn,a as Hn,c as Un,d as Wn,f as Gn,g as Kn,h as qn,i as Jn,l as Yn,m as Xn,n as Zn,o as Qn,p as $n,s as er,u as tr,v as nr}from"./ChangedOutsideBadge-D047_w8_.js";import{t as rr}from"./overlay-layers-Bj-TVfKw.js";import{n as ir,r as ar,t as X}from"./button-CA0dewJJ.js";import{t as or}from"./dist-mv8e6dBX.js";import{i as sr,n as cr,r as lr,t as ur}from"./tooltip-DHXgxWLL.js";import{n as dr,r as fr,t as pr}from"./collapsible-COrqeoHr.js";import{a as mr,c as hr,i as gr,n as _r,o as vr,s as yr,t as br}from"./dialog-DztIj-ZS.js";import{$ as xr,J as Sr,M as Cr,R as wr,S as Tr,T as Er,W as Dr,Z as Or,_ as kr,at as Ar,ct as jr,et as Mr,j as Nr,k as Pr,m as Fr,nt as Ir,rt as Lr,st as Rr,tt as zr,x as Br,z as Vr}from"./CodeMirrorPropInput-AfI-A739.js";import{t as Hr}from"./checkbox-vidgONxv.js";import{a as Ur,d as Wr,i as Gr,l as Kr,n as qr,o as Jr,r as Yr,s as Xr,t as Zr,u as Qr}from"./floating-ui.dom-By-yeALv.js";import{a as $r,c as ei,d as ti,i as ni,l as ri,n as ii,r as ai,s as oi,t as si,u as ci}from"./context-menu-D1MgERPo.js";import{a as li,c as ui,d as di,f as fi,i as pi,l as mi,m as hi,n as gi,o as _i,p as vi,r as yi,s as bi,t as xi,u as Si}from"./dropdown-menu-CLgDYkh1.js";import{t as Ci}from"./label-B5yNUINo.js";import{c as wi,i as Ti,n as Ei,o as Di,s as Oi,t as ki}from"./select-CguJodwX.js";import{n as Ai,t as ji}from"./radio-group-BSCe7mNt.js";import{n as Mi,t as Ni}from"./separator-vdmCepR4.js";import{n as Pi,r as Fi,t as Ii}from"./toggle-group-CZcn-1gX.js";import{S as Li,_ as Ri,a as zi,b as Bi,c as Vi,f as Hi,i as Ui,m as Wi,n as Gi,o as Ki,r as qi,u as Ji,x as Yi,y as Xi}from"./terminal-cli-display-Du0YYwUl.js";import{a as Zi,i as Qi,n as $i,r as ea}from"./terminal-telemetry-Cj_uo6eX.js";import{$a as ta,$t as na,Ai as ra,B as ia,Bn as aa,Br as oa,C as sa,Ci as ca,Cs as la,Dn as ua,E as da,Ei as fa,Er as pa,F as ma,Fi as ha,Fn as ga,Gn as _a,Gt as va,Hi as ya,Ii as ba,It as xa,Jn as Sa,Jo as Ca,Jr as wa,Kn as Ta,Kr as Ea,Lr as Da,M as Oa,Mn as ka,Na as Aa,Nr as ja,O as Ma,Or as Na,Ot as Pa,P as Fa,Pa as Ia,Pn as La,Qa as Ra,Qo as za,Qr as Ba,R as Va,Sa as Ha,Sr as Ua,Ss as Wa,Tn as Ga,Ts as Ka,Tt as qa,Vi as Ja,Xa as Ya,Xn as Xa,Xo as Za,Xt as Qa,Za as $a,Zn as eo,Zr as to,_ as no,_a as ro,_s as io,ar as ao,ci as oo,ct as so,do as co,dr as lo,er as uo,fi as fo,fs as po,ft as mo,go as ho,gs as go,ha as _o,hi as vo,ho as yo,hs as bo,ii as xo,in as So,io as Co,is as wo,it as To,j as Eo,jr as Do,la as Oo,ln as ko,lo as Ao,lr as jo,ma as Mo,mi as No,mo as Po,n as Fo,na as Io,ns as Lo,nt as Ro,oi as zo,oo as Bo,or as Vo,pa as Ho,po as Uo,pr as Wo,qn as Go,ra as Ko,ro as qo,rr as Jo,rt as Yo,s as Xo,sa as Zo,si as Qo,sr as $o,t as es,ti as ts,to as ns,v as rs,va as is,vi as as,vo as os,vs as ss,w as cs,wn as ls,ws as us,xi as ds,xs as fs,ya as ps,yo as ms,ys as hs,yt as gs,za as _s,zi as vs}from"./dist-CKFXiBrL.js";import{_ as ys,c as bs,f as xs,h as Ss,i as Cs,m as ws,n as Ts,p as Es,r as Ds,s as Os,t as ks,v as As,y as js}from"./use-settings-route-D_8EQ_KO.js";import{t as Ms}from"./dist-DUfEoSbR.js";import{n as Ns,t as Ps}from"./dist-B6jB2qbD2.js";import{a as Fs,d as Is,f as Ls,i as Rs,l as zs,m as Bs,o as Vs,p as Hs,u as Us}from"./documents-events-BNjnUfCu.js";import{C as Ws,E as Gs,F as Ks,L as qs,M as Js,N as Ys,O as Xs,P as Zs,S as Qs,T as $s,a as ec,b as tc,c as nc,d as rc,f as ic,g as ac,h as oc,k as sc,l as cc,m as lc,n as uc,o as dc,p as fc,r as pc,t as mc,u as hc,v as gc,x as _c}from"./terminal-launch-events-C5JkD3Qb.js";import{n as vc,t as yc}from"./history-B1SZDFzE.js";import{g as bc,h as xc}from"./use-apply-config-color-theme-DkVlJHc4.js";import{t as Sc}from"./parse-api-error-DfesE4Y7.js";import{C as Cc,D as wc,E as Tc,S as Ec,T as Dc,_ as Oc,b as kc,c as Ac,d as jc,f as Mc,g as Nc,h as Pc,i as Fc,l as Ic,m as Lc,n as Rc,o as zc,p as Bc,r as Vc,s as Hc,t as Uc,u as Wc,v as Gc,w as Kc,x as qc,y as Jc}from"./skill-actions-BKW-L6YY.js";import{n as Yc,t as Xc}from"./workspace-paths-CKUFX0v6.js";import{t as Zc}from"./use-workspace-e-krFmvC.js";import{t as Qc}from"./createLucideIcon-Bhw2PmPp.js";import{t as $c}from"./git-branch-CCnsAeFH.js";import{c as el,d as tl,f as nl,l as rl,p as il,u as al}from"./EnableSyncConfirmDialog-DrKJd8P_.js";import{c as ol,l as sl,o as cl,s as ll,t as ul}from"./Mermaid-BHfANkja.js";import{t as dl}from"./arrow-up-right-CGe6dTck.js";import{r as fl,t as pl}from"./RegisteredAgentIcon-gjOJZp_B.js";import{C as ml,D as hl,E as gl,S as _l,T as vl,_ as yl,a as bl,b as xl,c as Sl,d as Cl,f as wl,g as Tl,h as El,i as Dl,l as Ol,m as kl,o as Al,p as jl,s as Ml,u as Nl,v as Pl,w as Fl,x as Il,y as Ll}from"./ManagedArtifactProperties-BfpBSbt8.js";import{t as Rl}from"./case-sensitive-CE1B0vR4.js";import{t as zl}from"./check-CGfmW4da.js";import{t as Bl}from"./chevron-left-UUhIKmW4.js";import{t as Vl}from"./chevron-down-DabHDQTe.js";import{t as Hl}from"./chevron-right-Diamp-K_.js";import{t as Ul}from"./chevron-up-BNZIobnQ.js";import{A as Wl,B as Gl,E as Kl,F as ql,L as Jl,M as Yl,N as Xl,O as Zl,P as Ql,R as $l,S as eu,T as tu,V as nu,_ as ru,a as iu,b as au,c as ou,d as su,f as cu,g as lu,h as uu,i as du,k as fu,l as pu,m as mu,n as hu,o as gu,p as _u,s as vu,t as yu,w as bu,y as xu,z as Su}from"./typing-burst-detector-vxYjrFWQ.js";import{n as Cu,t as wu}from"./CopyButton-ByR_1gcU.js";import{a as Tu,i as Eu,n as Du,o as Ou,r as ku,s as Au}from"./prop-types-RgJQCViX.js";import{A as ju,B as Mu,C as Nu,F as Pu,H as Fu,I as Iu,L as Lu,M as Ru,N as zu,O as Bu,P as Vu,R as Hu,T as Uu,V as Wu,a as Gu,b as Ku,c as qu,f as Ju,g as Yu,h as Xu,j as Zu,k as Qu,m as $u,n as ed,p as td,r as nd,t as rd,w as id,z as ad}from"./auth-state-cache-j2uCE1rv.js";import{t as od}from"./download-C3PYuI1f.js";import{t as sd}from"./eye-CSz7ogHo.js";import{a as cd,i as ld,n as ud,o as dd,r as fd,s as pd,t as md}from"./pending-receive-nav-store-DTGiCG3P.js";import{t as hd}from"./folder-open-DUSc8NL8.js";import{t as gd}from"./folder-CopDpuy5.js";import{i as _d,n as vd}from"./folder-config-api-C00aXHgv.js";import{t as yd}from"./hash-DI30zEBt.js";import{t as bd}from"./info-CV59RycV.js";import{t as xd}from"./spinner-BqySY7qY.js";import{n as Sd,t as Cd}from"./miss-dialog-store-sSyy54tn.js";import{_ as wd,a as Td,b as Ed,c as Dd,d as Od,f as kd,g as Ad,h as jd,i as Md,l as Nd,m as Pd,n as Fd,o as Id,p as Ld,r as Rd,s as zd,t as Bd,u as Vd,v as Hd,x as Ud,y as Wd}from"./comment-chips-CspvZbMA.js";import{i as Gd,n as Kd,r as qd,t as Jd}from"./use-popular-skills-C9TB91tU.js";import{n as Yd,t as Xd}from"./panel-right-open-B66oA9M1.js";import{t as Zd}from"./paperclip-BlKB6Xwa.js";import{t as Qd}from"./refresh-cw-DQervzDZ.js";import{_ as $d,b as ef,d as tf,f as nf,g as rf,h as af,i as of,m as sf,p as cf,u as lf,v as uf}from"./follow-file-ClUkwvTW.js";import{t as df}from"./square-pen-Cb57Y3fg.js";import{t as ff}from"./trash-2-N0ilsnnr.js";import{t as pf}from"./triangle-alert-COo6wbUK.js";import{t as mf}from"./undo-2-WGCwknr8.js";import{t as hf}from"./x-DS57FvHW.js";import{C as gf,S as _f,_ as vf,a as yf,b as bf,c as xf,d as Sf,f as Cf,g as wf,h as Tf,i as Ef,m as Df,p as Of,s as kf,u as Af,v as jf,w as Mf,x as Nf,y as Pf}from"./doc-paths-aGtYCY4p.js";import{a as Ff,i as If,n as Lf,r as Rf}from"./project-paths-_w2mRvRX.js";import{t as zf}from"./input-BYiOK210.js";import"./i18n-DnAdj3V4.js";import{n as Bf,r as Vf,t as Hf}from"./file-tree-rename-validation-CCqiFGp1.js";import{a as Uf,c as Wf,d as Gf,i as Kf,l as qf,n as Jf,o as Yf,s as Xf,u as Zf}from"./file-tree-utils-CPfKs0_W.js";import{E as Qf,J as $f,K as ep,M as tp,_ as np,a as rp,c as ip,f as ap,g as op,h as sp,j as cp,l as lp,n as up,o as dp,p as fp,q as pp,r as mp,s as hp,v as gp,x as _p}from"./navigation-targets-BN-b0SwY.js";import{t as vp}from"./documents-fetch-CV8lWh8v.js";import{a as yp,i as bp,o as xp}from"./startup-marks-Cdkh8q3E.js";import{a as Sp,c as Cp,d as wp,f as Tp,i as Ep,l as Dp,o as Op,s as kp,t as Ap,u as jp}from"./skill-scope-D3fqbCKZ.js";import{t as Mp}from"./badge-DFX4S3a5.js";import{a as Np,n as Pp,o as Fp,r as Ip,s as Lp,t as Rp}from"./field-CtVP3IIV.js";import{c as zp,f as Bp,i as Vp,n as Hp,o as Up,r as Wp,t as Gp}from"./config-provider-DAD08DXO.js";import{i as Kp,r as qp,t as Jp}from"./use-collab-url-CpJYowg_.js";import{n as Yp,t as Xp}from"./client-version-UVydSM1_.js";import{D as Zp,_ as Qp,b as $p,d as em,f as tm,h as nm,i as rm,l as im,m as am,o as om,p as sm,u as cm}from"./skills-api-BAB9Nk_K.js";import{n as lm,t as um}from"./external-link-BIMZpgNa.js";import{t as dm}from"./asset-dispatch-Cz1weVX3.js";import{t as fm}from"./use-skills-DMV2hvXx.js";import{t as pm}from"./use-open-skill-DdTYxJp4.js";import{i as mm,n as hm,r as gm,t as _m}from"./auth-prompt-store-BYOv6_8O.js";import{c as vm,i as ym,l as bm,n as xm,r as Sm,s as Cm,t as wm}from"./selection-context-D_1ahjGj.js";import{t as Tm}from"./use-installed-clis-Cydpb5jd.js";import{a as Em,c as Dm,i as Om,n as km,o as Am,r as jm,s as Mm,t as Nm}from"./panel-CbGx_cRv.js";import{t as Pm}from"./textarea-yZk4yd9U.js";import{t as Fm}from"./lint-plugin-meta-FPoTE-0t.js";import{t as Im}from"./skeleton-BOVIbSHk.js";import{c as Lm,i as Rm,l as zm,r as Bm}from"./lint-config-client-CwpzRrsJ.js";import{t as Vm}from"./target-navigation-intent-DEiFgbdU.js";import{a as Hm,o as Um,t as Wm}from"./agent-diff-store-BTtYfAZI.js";import{n as Gm,r as Km,t as qm}from"./timeline-diff-store-DnRthkM7.js";import{a as Jm,c as Ym,i as Xm,n as Zm,o as Qm,r as $m,s as eh,t as th}from"./EditorModeToggle-BFLOwOkQ.js";import{n as nh}from"./clipboard-adapter-DqemxSWT.js";import{a as rh,c as ih,d as ah,g as oh,h as sh,i as ch,m as lh,n as uh,p as dh,r as fh,s as ph,t as mh,u as hh}from"./sortable.esm-Dd5A8_XI.js";import{t as gh}from"./open-managed-artifact-tab-Dxiu79gQ.js";import{t as _h}from"./SkillModeBanner-cMF-HPLA.js";import{t as vh}from"./use-skill-origin-BjB7AiHp.js";import{n as yh,r as bh,t as xh}from"./input-group-BiaQ-rIw.js";import{n as Sh,t as Ch}from"./DiffView-C-imhjB8.js";import{A as wh,C as Th,D as Eh,E as Dh,O as Oh,S as kh,T as Ah,_ as jh,a as Mh,b as Nh,c as Ph,d as Fh,f as Ih,g as Lh,h as Rh,i as zh,j as Bh,k as Vh,l as Hh,m as Uh,n as Wh,o as Gh,p as Kh,r as qh,s as Jh,t as Yh,u as Xh,v as Zh,w as Qh,x as $h,y as eg}from"./file-tree-adapter-BnKrzDCF.js";import{n as tg,r as ng}from"./platform-labels-glrfxkSh.js";import{t as rg}from"./use-live-xterm-theme-DfHZqsch.js";import{n as ig,r as ag}from"./agent-presence-C3GIHDxc.js";import{a as og,c as sg,d as cg,f as lg,i as ug,l as dg,m as fg,n as pg,o as mg,s as hg,t as gg,u as _g}from"./form-dlFqxdSN.js";import{n as vg}from"./terminal-command-events-DXmeHtnk.js";import{n as yg,t as bg}from"./mcp-consent-store-BASpxNOZ.js";import{a as xg,t as Sg}from"./receive-store-C7RBAUmu.js";function Cg(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.51.4`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-Bvv5kEhb.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}var wg=class extends ln{#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||Tg(),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=yn({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),un.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Tg(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Eg=class extends En{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 wg({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=Dg(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=Dg(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=Dg(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=Dg(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){un.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=>fn(t,e))}findAll(e={}){return this.getAll().filter(t=>fn(e,t))}notify(e){un.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return un.batch(()=>Promise.all(e.map(e=>e.continue().catch(_n))))}};function Dg(e){return e.options.scope?.id}var Og=class extends En{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??dn(r,t),a=this.get(i);return a||(a=new hn({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(){un.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=>bn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>bn(e,t)):t}notify(e){un.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){un.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){un.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},kg=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Og,this.#t=e.mutationCache||new Eg,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Tn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Sn.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(pn(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=gn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return un.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;un.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return un.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=un.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(_n).catch(_n)}invalidateQueries(e,t={}){return un.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=un.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(_n)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(_n)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(pn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(_n).catch(_n)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(_n).catch(_n)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Sn.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(wn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{mn(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(wn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{mn(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||=dn(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===cn&&(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(an(),1),Ag=t(),$=An(),jg=`button, a[href], input, textarea, select, [contenteditable="true"], [role="button"], [role="menuitem"]`;function Mg(){if(typeof document>`u`)return!1;let e=document.activeElement;return!e||e===document.body?!1:e instanceof Element&&e.matches(jg)}function Ng(e={}){return rr()?!1:e.allowWhileFocused?!0:!Mg()}var Pg=e(kn(),1),Fg=`ok-blob-mascot`;function Ig(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,Pg.flushSync)(e)})}var Lg=64*.055,Rg=.1875,zg=2400,Bg=310;Bg**2/(2*zg);var Vg=580**2/(2*zg),Hg=2*580/zg,Ug=.09,Wg=Hg+.1,Gg=.5,Kg=1.3,qg=3200,Jg=14,Yg=Hg*2.4,Xg=Hg*1.35,Zg=.9,Qg=.3,$g=14e3;function e_(e,t,n){return e+(t-e)*n}function t_(e){return Math.min(1,Math.max(0,e/$g))}function n_(e){return e_(Yg,Xg,t_(e))}function r_(e){return e<=h_?0:e_(p_,m_,t_(e))}var i_=38,a_=52,o_=12,s_=20,c_=34,l_=14,u_=18,d_=22,f_=30,p_=.15,m_=.45,h_=900,g_=240,__=.05,v_=1/120,y_=12;function b_(){return{phase:`idle`,y:0,vy:0,dwell:0,jumpBuffer:0,jumping:!1,ducking:!1,speed:260,distance:0,obstacles:[],spawnCountdown:260*n_(0),nextObstacleId:0}}function x_(e){Object.assign(e,b_(),{phase:`running`})}function S_(e){return e.phase===`running`?e.jumping?(e.jumpBuffer=Wg,!1):(e.vy=580,e.dwell=0,e.jumpBuffer=0,e.jumping=!0,!0):!1}function C_(e,t){e.phase===`running`&&(e.ducking=t)}function w_(e){return e.ducking&&e.y===0}function T_(e){return Math.floor(e.distance/y_)}function E_(e){if(w_(e))return{scaleX:Kg,scaleY:Gg};if(e.y===0&&e.dwell>0){let t=.28*(1-(1-e.dwell/Ug));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 D_(e){let t=w_(e),n=64*(t?Kg:1),r=64*(t?Gg:1),i=n*Rg,a=r*Rg,o=28-(n-64)/2;return{left:o+i,right:o+n-i,bottom:e.y+a,top:e.y+r-a}}function O_(e,t){let n=D_(e);return n.left<t.x+t.width&&n.right>t.x&&n.bottom<t.y+t.height&&n.top>t.y}function k_(e,t,n){let r=n()<r_(e.distance),[i,a,o,s,c]=r?[d_,f_,l_,u_,c_]:[o_,s_,i_,a_,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=e_(Zg,Qg,t_(e.distance));e.spawnCountdown=e.speed*(n_(e.distance)+n()*l)}function A_(e,t,n,r){if(e.jumpBuffer=Math.max(0,e.jumpBuffer-t),e.y>0||e.vy>0){let n=e.ducking?zg+qg:zg;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=Ug)}else e.ducking?e.dwell=0:(e.dwell-=t,e.dwell<=0&&(e.dwell=0,e.vy=Bg));e.speed=Math.min(620,e.speed+Jg*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&&k_(e,n,r);for(let t of e.obstacles)if(O_(e,t)){e.phase=`over`;return}}function j_(e,t,n,r=Math.random){if(e.phase!==`running`)return e;let i=Math.max(n,g_),a=Math.min(Math.max(t,0),__);for(;a>0;){let t=Math.min(a,v_);if(a-=t,A_(e,t,i,r),e.phase!==`running`)break}return e}var M_=`ok-blob-runner-best`;function N_(){try{return typeof localStorage>`u`?null:localStorage}catch{return null}}function P_(e=N_()){if(!e)return 0;try{let t=Number(e.getItem(M_));return Number.isFinite(t)&&t>0?Math.floor(t):0}catch{return 0}}function F_(e,t=N_()){if(!(!t||!Number.isFinite(e)||e<=0))try{t.setItem(M_,String(Math.floor(e)))}catch{}}function I_(e,t,n){let r=n?.windowMs??4e3;return e<=0||t>=r?1:e+1}var L_=Math.ceil(Vg+64+8),R_=Array.from({length:24},(e,t)=>`obstacle-slot-${t}`),z_=300,B_=4,V_=.45;function H_(e){let t=(0,$.c)(47),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=b_(),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)(G_),v=(0,Q.useRef)(g),[y,b]=(0,Q.useState)(0),[x,S]=(0,Q.useState)(!1),[C]=(0,Q.useState)(W_),w,T;t[4]!==i||t[5]!==C?(w=()=>{if(!i||C)return;let e=setTimeout(()=>{x_(o.current),p(`running`)},z_);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}=E_(e);c.current.style.transform=`translateY(${Lg-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(T_(e)).padStart(B_,`0`))};function r(i){let a=o.current;if(j_(a,(i-t)/1e3,s.current?.clientWidth??0),t=i,n(),a.phase===`over`){let e=T_(a),t=e>v.current;h(e),t&&(v.current=e,F_(e),_(e),S(!0),b(U_)),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(){x_(o.current),S(!1),p(`running`)},t=function(t){let n=o.current;if(t.key===`ArrowDown`){if(!Ng({allowWhileFocused:!0}))return;t.preventDefault(),C_(n,!0);return}t.key!==` `&&t.key!==`ArrowUp`||Ng({allowWhileFocused:t.key===`ArrowUp`})&&(t.preventDefault(),n.phase===`running`?S_(n):e())},n=function(e){e.key===`ArrowDown`&&C_(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){Mg()&&document.activeElement.blur();let t=o.current;if(t.phase!==`running`){x_(t),S(!1),p(`running`);return}let n=e.currentTarget.getBoundingClientRect();if(e.clientY-n.top>n.height*(1-V_)){C_(t,!0),e.currentTarget.setPointerCapture?.(e.pointerId);return}S_(t)},t[14]=A):A=t[14];let j=A,M;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=function(){C_(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)(nr,{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:L_},t[17]=F):F=t[17];let I;t[18]!==x||t[19]!==g?(I=g>0?(0,Z.jsxs)(`span`,{className:x?`text-muted-foreground`:void 0,children:[(0,Z.jsx)(Y,{id:`9GbR5F`}),` `,String(g).padStart(B_,`0`)]}):null,t[18]=x,t[19]=g,t[20]=I):I=t[20];let L=String(m),R;t[21]===L?R=t[22]:(R=L.padStart(B_,`0`),t[21]=L,t[22]=R);let z;t[23]===R?z=t[24]:(z=(0,Z.jsx)(`span`,{ref:l,children:R}),t[23]=R,t[24]=z);let B;t[25]!==I||t[26]!==z?(B=(0,Z.jsxs)(`div`,{className:`absolute top-0 end-0 flex gap-3 font-mono text-xs tabular-nums text-muted-foreground/60`,children:[I,z]}),t[25]=I,t[26]=z,t[27]=B):B=t[27];let V;t[28]===i?V=t[29]:(V={left:28,transform:`translateY(${Lg}px)`,...i?{viewTransitionName:Fg}:{}},t[28]=i,t[29]=V);let H=P?`sleeping`:`default`,U;t[30]!==y||t[31]!==H?(U=(0,Z.jsx)(nr,{size:64,trackMouse:!1,variant:H,celebrateSignal:y}),t[30]=y,t[31]=H,t[32]=U):U=t[32];let W;t[33]!==V||t[34]!==U?(W=(0,Z.jsx)(`div`,{ref:c,className:`absolute bottom-0 flex origin-bottom will-change-transform`,style:V,children:U}),t[33]=V,t[34]=U,t[35]=W):W=t[35];let ee;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(ee=R_.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[36]=ee):ee=t[36];let G;t[37]!==B||t[38]!==W||t[39]!==ee?(G=(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:[B,W,ee]}),t[37]=B,t[38]=W,t[39]=ee,t[40]=G):G=t[40];let K;t[41]!==x||t[42]!==f?(K=(0,Z.jsx)(`p`,{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:`8SrrDi`}):(0,Z.jsx)(Y,{id:`4o57um`}):f===`running`?(0,Z.jsx)(Y,{id:`QUhYEG`}):(0,Z.jsx)(Y,{id:`wIM7ul`})}),t[41]=x,t[42]=f,t[43]=K):K=t[43];let q;return t[44]!==G||t[45]!==K?(q=(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:[G,K]}),t[44]=G,t[45]=K,t[46]=q):q=t[46],q}function U_(e){return e+1}function W_(){return typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function G_(){return P_()}var K_=80;function q_(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)(J_),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`||Ng({allowWhileFocused:e.key===`ArrowUp`})&&(e.preventDefault(),s.current=!0,Ig(()=>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)(H_,{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)(nr,{size:K_,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:Fg},onPointerDown:()=>{Mg()&&document.activeElement.blur(),s.current=!0,Ig(()=>o(!0))},children:(0,Z.jsx)(nr,{size:K_,variant:`sleeping`})}),t[8]=d):d=t[8],d}function J_(){return typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var Y_=(0,Q.lazy)(()=>n(()=>import(`./ReportBugDialogBody-0zuUulQL.js`),__vite__mapDeps([5,1,6,2,3,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50]),import.meta.url)),X_=1200,Z_=`[cmdk-root],[data-radix-popper-content-wrapper]`,Q_=500;function $_(e){let t=(0,$.c)(9),[n,r]=(0,Q.useState)(e.open),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(!1),u=(0,Q.useRef)(0);e.open&&!n&&r(!0);let d,f;if(t[0]!==e.crashInvite||t[1]!==e.open?(d=()=>{if(!e.open){a(!1);return}let t=u.current+=1;l(!1);let n=window.okDesktop?.bugReport?.crashDumpAvailability;e.crashInvite===void 0&&typeof n==`function`&&n().then(e=>{u.current===t&&l(e.available)}).catch(ev);let r=window.okDesktop?.bugReport?.captureScreenshot;if(typeof r!=`function`||e.crashInvite!==void 0){s(null),a(!0);return}s(null);let i=!1,o=e=>{i||u.current!==t||(i=!0,s(e),a(!0))},c=setTimeout(()=>o(null),X_),d=performance.now(),f=0,p=()=>{if(u.current!==t)return;let e=performance.now()-d>=Q_;if(document.querySelector(Z_)!==null&&!e){f=requestAnimationFrame(p);return}f=requestAnimationFrame(()=>{u.current===t&&r().then(o).catch(()=>o(null))})};return f=requestAnimationFrame(p),()=>{u.current+=1,clearTimeout(c),cancelAnimationFrame(f)}},f=[e.open,e.crashInvite],t[0]=e.crashInvite,t[1]=e.open,t[2]=d,t[3]=f):(d=t[2],f=t[3]),(0,Q.useEffect)(d,f),!n)return null;let p=e.open&&i,m;return t[4]!==c||t[5]!==e||t[6]!==o||t[7]!==p?(m=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(Y_,{...e,open:p,screenshot:o,crashDumpAvailable:c})}),t[4]=c,t[5]=e,t[6]=o,t[7]=p,t[8]=m):m=t[8],m}function ev(e){console.warn(`[bug-report] crash-dump availability probe failed:`,e)}var tv=new WeakMap;function nv(e,t){typeof e!=`object`||!e||typeof t!=`string`||t.trim()===``||tv.set(e,t)}function rv(e){if(!(typeof e!=`object`||!e))return tv.get(e)}function iv(e){let t=(0,$.c)(24),{error:n,resetErrorBoundary:r}=e,{_:i}=on(),[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)(q_,{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)(sv,{children:(0,Z.jsx)($_,{open:a,onOpenChange:o,systemWide:c.config.mode===`navigator`,crashContext:{source:`app shell`,errorMessage:n instanceof Error&&n.message?n.message:String(n),componentStack:rv(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 av(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(Pn,{FallbackComponent:iv,onError:ov,children:n}),t[0]=n,t[1]=r),r}function ov(e,t){nv(e,t.componentStack),console.error(`[AppErrorBoundary] app-shell render crash`,e,t.componentStack??``)}function sv(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(Pn,{fallback:null,onError:cv,children:n}),t[0]=n,t[1]=r),r}function cv(e){console.error(`[CrashReportingBoundary] crash-reporting UI render crash`,e)}function lv(){let e=(0,$.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={queryKey:[`acp-catalog`],queryFn:fv,staleTime:3e5},e[0]=t):t=e[0];let n=Cn(t),r;e[1]===n.data?.agents?r=e[2]:(r=()=>(Bi(ea(n.data?.agents??[]).map(dv)),uv),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 uv(){return Bi([])}function dv(e){return{source:e.source,id:e.id,name:e.name,featured:e.featured,...e.iconUrl===void 0?{}:{iconUrl:e.iconUrl}}}function fv(e){let{signal:t}=e;return Qi(t)}var pv=Qc(`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`}]]),mv=Qc(`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`}]]),hv=Qc(`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`}]]),gv=Qc(`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`}]]),_v=Qc(`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`}]]),vv=Qc(`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`}]]),yv=Qc(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),bv=Qc(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),xv=Qc(`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`}]]),Sv=Qc(`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`}]]),Cv=Qc(`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`}]]),wv=Qc(`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`}]]),Tv=Qc(`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`}]]),Ev=Qc(`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`}]]),Dv=Qc(`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`}]]),Ov=Qc(`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`}]]),kv=Qc(`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`}]]),Av=Qc(`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`}]]),jv=Qc(`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`}]]),Mv=Qc(`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`}]]),Nv=Qc(`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`}]]),Pv=Qc(`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`}]]),Fv=Qc(`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`}]]),Iv=Qc(`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`}]]),Lv=Qc(`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`}]]),Rv=Qc(`hexagon`,[[`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}]]),zv=Qc(`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`}]]),Bv=Qc(`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`}]]),Vv=Qc(`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`}]]),Hv=Qc(`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`}]]),Uv=Qc(`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`}]]),Wv=Qc(`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`}]]),Gv=[[`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`}]],Kv=Qc(`lock`,Gv),qv=Qc(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),Jv=Qc(`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`}]]),Yv=Qc(`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`}]]),Xv=Qc(`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`}]]),Zv=Qc(`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`}]]),Qv=Qc(`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`}]]),$v=Qc(`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`}]]),ey=Qc(`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`}]]),ty=Qc(`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`}]]),ny=Qc(`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`}]]),ry=Qc(`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`}]]),iy=Qc(`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`}]]),ay=Qc(`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`}]]),oy=Qc(`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`}]]),sy=Qc(`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`}]]),cy=Qc(`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`}]]),ly=Qc(`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`}]]),uy=Qc(`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`}]]),dy=Qc(`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`}]]),fy=Qc(`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`}]]),py=Qc(`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`}]]),my=Qc(`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`}]]),hy=Qc(`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`}]]),gy=Qc(`text-align-center`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M17 12H7`,key:`16if0g`}],[`path`,{d:`M19 19H5`,key:`vjpgq2`}]]),_y=Qc(`text-align-end`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M21 19H7`,key:`4cu937`}]]),vy=Qc(`text-align-start`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]]),yy=Qc(`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`}]]),by=Qc(`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`}]]),xy=Qc(`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`}]]),Sy=Qc(`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`}]]),Cy=Qc(`underline`,[[`path`,{d:`M6 4v6a6 6 0 0 0 12 0V4`,key:`9kb039`}],[`line`,{x1:`4`,x2:`20`,y1:`20`,y2:`20`,key:`nun2al`}]]),wy=Qc(`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`}]]),Ty=Qc(`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`}]]),Ey=Qc(`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 Dy(e){return Rd(e.map(zd),``)}function Oy(){let e=(0,$.c)(9),t=Zc(),n=Hi(),r=Li(),i=Yi(),a;if(e[0]!==i||e[1]!==n||e[2]!==r){let t;e[4]===n?t=e[5]:(t=e=>Ki(n,e.source,e.id,!0,e.supported),e[4]=n,e[5]=t),a=Ri(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(Ay);if(n.length===0)return!1;let r=Oc({docName:null,workspace:t,instruction:Dy(n),mentions:[...new Set(n.map(ky))]});return r===null?(Ns.error(Ms._({id:`3V94ia`})),!1):o===null?(Ns.info(Ms._({id:`8YymuQ`})),Cs(),!1):(Dc(r,{agent:{source:o.source,id:o.id}}),!0)},e[6]=o,e[7]=t,e[8]=s):s=e[8],s}function ky(e){return Xc(e.docName)}function Ay(e){return e.payload}function jy(){let e=(0,$.c)(3),t=Oy(),n=qs(),r=n?.kind===`thread`?n:null,i;return e[0]!==t||e[1]!==r?(i=e=>{if(r===null){He({compose:t,threadIds:e});return}vc(e)},e[0]=t,e[1]=r,e[2]=i):i=e[2],i}var My=null;function Ny(e){My=e}function Py(){return My}function Fy(){let e=(0,$.c)(3),t=jy(),n,r;return e[0]===t?(n=e[1],r=e[2]):(n=()=>{let e=function(e){if(!As(e,`send-comment-queue`)||rr())return;let n=Py();if(n===null)return;let r=n.scope===`doc`?Pt(n.docName):St();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}var Iy=180,Ly=5e3;function Ry(e,t){if(e===``||t===``)return``;let n=e.includes(`\\`)&&!e.includes(`/`)?`\\`:`/`;return`${e.replace(/[/\\]+$/,``)}${n}${t}`}function zy(e){if(e===``)return``;let t=e.split(/[/\\]/).filter(Boolean);return t.length>0?t[t.length-1]??e:e}function By(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 Vy(e){let t=e instanceof Error?e.message:String(e);for(let e of rs)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 Hy(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 Uy(e){let t=(0,$.c)(186),{open:n,onOpenChange:r,bridge:i,initialPackId:a,packs:o}=e,{_:s}=on(),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)(Xy),[b,x]=(0,Q.useState)(`shared`),[S,C]=(0,Q.useState)(!1),w;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(w={kind:`idle`},t[0]=w):w=t[0];let[T,E]=(0,Q.useState)(w),[D,O]=(0,Q.useState)(`idle`),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(null),N;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(N={kind:`idle`},t[1]=N):N=t[1];let[P,F]=(0,Q.useState)(N),[I,L]=(0,Q.useState)(0),R;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(R=new Set,t[2]=R):R=t[2];let z=(0,Q.useRef)(R),B=(0,Q.useRef)(null),V=(0,Q.useRef)(null),H=(0,Q.useRef)(null),U=(0,Q.useRef)(0),W,ee;t[3]!==i||t[4]!==n?(W=()=>{if(!n)return;z.current.clear(),M(null),E({kind:`idle`}),O(`idle`),A(!1),_(``),y(new Set(Ia)),x(`shared`),C(!1),F({kind:`idle`}),U.current+=1;let e=!1;p(``),h(!0),i.fs.defaultProjectsRoot().then(t=>{e||p(t)}).catch(Yy).finally(()=>{e||h(!1)});let t=requestAnimationFrame(()=>{H.current?.focus()});return()=>{e=!0,cancelAnimationFrame(t)}},ee=[n,i],t[3]=i,t[4]=n,t[5]=W,t[6]=ee):(W=t[5],ee=t[6]),(0,Q.useEffect)(W,ee);let G;t[7]!==i||t[8]!==f||t[9]!==g||t[10]!==n?(G=()=>{if(!n)return;V.current!==null&&clearTimeout(V.current),B.current!==null&&B.current.abort();let e=fo(g);if(f===``||e===``){E({kind:`idle`}),O(`idle`);return}let t=f,r=Ry(t,e),a=new AbortController;return B.current=a,V.current=setTimeout(()=>{O(`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||(O(`idle`),E(By({parent:t,sanitizedName:e,enclosingProject:r,enclosingGit:i,targetState:o})))}).catch(e=>{a.signal.aborted||(console.warn(`[CreateProjectDialog] cascade probe failed:`,e),O(`idle`),E({kind:`free`}))})},Iy),()=>{V.current!==null&&clearTimeout(V.current),a.abort()}},t[7]=i,t[8]=f,t[9]=g,t[10]=n,t[11]=G):G=t[11];let K;t[12]!==i||t[13]!==f||t[14]!==g||t[15]!==n||t[16]!==I?(K=[n,f,g,i,I],t[12]=i,t[13]=f,t[14]=g,t[15]=n,t[16]=I,t[17]=K):K=t[17],(0,Q.useEffect)(G,K);let q,te;t[18]===n?(q=t[19],te=t[20]):(q=()=>{if(!n)return;let e=()=>L(Jy);return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},te=[n],t[18]=n,t[19]=q,t[20]=te),(0,Q.useEffect)(q,te);let J=(0,Q.useRef)(`idle`),ne,re;t[21]===D?(ne=t[22],re=t[23]):(ne=()=>{J.current=D},re=[D],t[21]=D,t[22]=ne,t[23]=re),(0,Q.useEffect)(ne,re);let ie,ae;t[24]!==T.kind||t[25]!==n?(ie=()=>{if(!n||T.kind!==`confirm-git`)return;let e=setInterval(()=>{J.current!==`in-flight`&&L(qy)},Ly);return()=>clearInterval(e)},ae=[n,T.kind],t[24]=T.kind,t[25]=n,t[26]=ie,t[27]=ae):(ie=t[26],ae=t[27]),(0,Q.useEffect)(ie,ae);let oe;t[28]!==T.gitRoot||t[29]!==T.kind||t[30]!==P.gitRoot||t[31]!==P.kind?(oe=()=>{if(T.kind!==`confirm-git`){P.kind!==`idle`&&(U.current+=1,F({kind:`idle`}));return}P.kind===`confirming`&&P.gitRoot!==T.gitRoot&&F({kind:`idle`}),P.kind===`pending`&&P.gitRoot!==T.gitRoot&&(U.current+=1,F({kind:`idle`}))},t[28]=T.gitRoot,t[29]=T.kind,t[30]=P.gitRoot,t[31]=P.kind,t[32]=oe):oe=t[32];let se;t[33]!==T||t[34]!==P?(se=[T,P],t[33]=T,t[34]=P,t[35]=se):se=t[35],(0,Q.useEffect)(oe,se);let ce;t[36]!==i||t[37]!==T.kind||t[38]!==n?(ce=()=>{if(!n)return;let e=null;T.kind===`block-nested`?e=`nested`:T.kind===`block-nonempty`?e=`nonempty`:T.kind===`confirm-git`&&(e=`git-confirm`),e!==null&&(z.current.has(e)||(z.current.add(e),i.project.recordCreateNewBannerShown(e).catch(Ky)))},t[36]=i,t[37]=T.kind,t[38]=n,t[39]=ce):ce=t[39];let le;t[40]!==i||t[41]!==T||t[42]!==n?(le=[n,T,i],t[40]=i,t[41]=T,t[42]=n,t[43]=le):le=t[43],(0,Q.useEffect)(ce,le);let ue;t[44]!==a||t[45]!==o?(ue=o?.find(e=>e.id===a),t[44]=a,t[45]=o,t[46]=ue):ue=t[46];let de=ue,fe=g,pe,me,he,ge,_e;t[47]!==T.kind||t[48]!==f||t[49]!==fe?(ge=fe===``?``:fo(fe),me=fe!==``&&ge!==fe&&ge!==``,he=fe!==``&&ge===``,pe=T.kind===`block-nonempty`,_e=f!==``&&ge!==``?Ry(f,ge):``,t[47]=T.kind,t[48]=f,t[49]=fe,t[50]=pe,t[51]=me,t[52]=he,t[53]=ge,t[54]=_e):(pe=t[50],me=t[51],he=t[52],ge=t[53],_e=t[54]);let ve=_e,ye=!k&&f!==``&&fe!==``&&ge!==``&&D===`idle`&&(T.kind===`free`||T.kind===`confirm-git`),be=k||fe!==``&&!ye,xe;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(xe=function(e){y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[55]=xe):xe=t[55];let Se=xe,Ce;t[56]!==i||t[57]!==f?(Ce=async function(){try{let e=await i.dialog.openFolder(f===``?void 0:{defaultPath:f});if(e===null)return;p(e),L(Gy),M(null)}catch(e){console.warn(`[CreateProjectDialog] dialog.openFolder failed:`,e)}},t[56]=i,t[57]=f,t[58]=Ce):Ce=t[58];let we=Ce,Te;t[59]!==s||t[60]!==i||t[61]!==k||t[62]!==ye||t[63]!==v||t[64]!==a||t[65]!==f||t[66]!==r||t[67]!==fe||t[68]!==ge||t[69]!==b?(Te=async function(e){if(e.preventDefault(),!k){if(fe.trim()===``){Ns.error(s({id:`5OqaJi`})),H.current?.focus();return}if(ye){A(!0),M(null);try{await i.project.createNew({parent:f,name:ge,editors:Array.from(v),sharing:b,packId:a}),r(!1)}catch(e){M(Vy(e)),A(!1)}}}},t[59]=s,t[60]=i,t[61]=k,t[62]=ye,t[63]=v,t[64]=a,t[65]=f,t[66]=r,t[67]=fe,t[68]=ge,t[69]=b,t[70]=Te):Te=t[70];let Ee=Te,De;t[71]!==k||t[72]!==r?(De=function(e){k||r(e)},t[71]=k,t[72]=r,t[73]=De):De=t[73];let Oe=De,ke;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(ke=async function(e){F({kind:`confirming`,gitRoot:e})},t[74]=ke):ke=t[74];let Ae=ke,je;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(je=async function(){F({kind:`idle`})},t[75]=je):je=t[75];let Me=je,Ne;t[76]===i?Ne=t[77]:(Ne=async function(e){let t=U.current+1;U.current=t,F({kind:`pending`,gitRoot:e});try{if(await i.fs.removeGitFolder(e),U.current!==t)return;L(Wy),F({kind:`idle`})}catch(e){let n=e;if(U.current!==t)return;let r=n instanceof Error?n.message:String(n);console.error(`[CreateProjectDialog] bridge.fs.removeGitFolder failed:`,n),F({kind:`error`,message:r})}},t[76]=i,t[77]=Ne);let Pe=Ne,Fe;t[78]!==i||t[79]!==r?(Fe=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[78]=i,t[79]=r,t[80]=Fe):Fe=t[80];let Ie=Fe,Le=he||pe||me?`${u} ${d}`:u,Re;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(0,Z.jsx)(hr,{children:(0,Z.jsx)(Y,{id:`wbv9xO`})}),t[81]=Re):Re=t[81];let ze;t[82]===de?ze=t[83]:(ze=(0,Z.jsxs)(yr,{children:[Re,(0,Z.jsx)(mr,{children:de?(0,Z.jsx)(Y,{id:`D2CwBE`,values:{0:de.name,1:de.entryCounts.folders},components:{0:(0,Z.jsx)(`strong`,{})}}):(0,Z.jsx)(Y,{id:`O6yEPk`})})]}),t[82]=de,t[83]=ze);let Be;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,Z.jsx)(Y,{id:`OyIC0Q`}),t[84]=Be):Be=t[84];let Ve;t[85]===l?Ve=t[86]:(Ve=(0,Z.jsx)(Ci,{htmlFor:l,children:Be}),t[85]=l,t[86]=Ve);let He;t[87]===s?He=t[88]:(He=s({id:`cV7LOw`}),t[87]=s,t[88]=He);let Ue;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=e=>_(e.target.value),t[89]=Ue):Ue=t[89];let We=he||pe,Ge;t[90]!==k||t[91]!==g||t[92]!==Le||t[93]!==l||t[94]!==He||t[95]!==We?(Ge=(0,Z.jsx)(zf,{id:l,ref:H,value:g,placeholder:He,onChange:Ue,disabled:k,autoComplete:`off`,"aria-invalid":We,"aria-describedby":Le,"data-testid":`create-name`}),t[90]=k,t[91]=g,t[92]=Le,t[93]=l,t[94]=He,t[95]=We,t[96]=Ge):Ge=t[96];let Ke;t[97]!==d||t[98]!==pe||t[99]!==me||t[100]!==he||t[101]!==ge?(Ke=he?(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`})}):pe?(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:ge},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):me?(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:ge},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):null,t[97]=d,t[98]=pe,t[99]=me,t[100]=he,t[101]=ge,t[102]=Ke):Ke=t[102];let qe;t[103]!==Ve||t[104]!==Ge||t[105]!==Ke?(qe=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[Ve,Ge,Ke]}),t[103]=Ve,t[104]=Ge,t[105]=Ke,t[106]=qe):qe=t[106];let Je;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Je=(0,Z.jsx)(Ci,{children:(0,Z.jsx)(Y,{id:`wJijgU`})}),t[107]=Je):Je=t[107];let Ye;t[108]!==f||t[109]!==m?(Ye=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,t[108]=f,t[109]=m,t[110]=Ye):Ye=t[110];let Xe;t[111]===Ye?Xe=t[112]:(Xe=(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:Ye}),t[111]=Ye,t[112]=Xe);let Ze;t[113]===we?Ze=t[114]:(Ze=()=>void we(),t[113]=we,t[114]=Ze);let Qe;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=(0,Z.jsx)(Y,{id:`O2UpM1`}),t[115]=Qe):Qe=t[115];let $e;t[116]!==k||t[117]!==Ze?($e=(0,Z.jsx)(X,{type:`button`,variant:`outline`,className:`shrink-0`,disabled:k,onClick:Ze,"data-testid":`create-browse`,children:Qe}),t[116]=k,t[117]=Ze,t[118]=$e):$e=t[118];let et;t[119]!==Xe||t[120]!==$e?(et=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[Xe,$e]}),t[119]=Xe,t[120]=$e,t[121]=et):et=t[121];let tt;t[122]===ve?tt=t[123]:(tt=ve===``?null:(0,Z.jsx)(Y,{id:`k_yIIc`,values:{targetPreview:ve},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}}),t[122]=ve,t[123]=tt);let nt;t[124]!==u||t[125]!==tt?(nt=(0,Z.jsx)(`p`,{id:u,className:`text-1sm text-muted-foreground wrap-break-word`,"aria-live":`polite`,"data-testid":`create-target-caption`,children:tt}),t[124]=u,t[125]=tt,t[126]=nt):nt=t[126];let rt;t[127]!==et||t[128]!==nt?(rt=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[Je,et,nt]}),t[127]=et,t[128]=nt,t[129]=rt):rt=t[129];let it;t[130]!==T||t[131]!==Pe||t[132]!==Ie||t[133]!==P?(it=(0,Z.jsx)(Zy,{cascade:T,onOpenNested:Ie,removeGitState:P,onRequestRemoveGit:Ae,onCancelRemoveGit:Me,onConfirmRemoveGit:Pe}),t[130]=T,t[131]=Pe,t[132]=Ie,t[133]=P,t[134]=it):it=t[134];let at;t[135]===Symbol.for(`react.memo_cache_sentinel`)?(at=(0,Z.jsxs)(fr,{className:`group flex w-full items-center justify-between gap-2 px-3 py-2 text-sm font-medium hover:bg-muted/50`,"data-testid":`create-advanced-trigger`,children:[(0,Z.jsx)(Y,{id:`VNgKZz`}),(0,Z.jsx)(Hl,{className:`size-4 transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`,"aria-hidden":!0})]}),t[135]=at):at=t[135];let ot;t[136]===Symbol.for(`react.memo_cache_sentinel`)?(ot=(0,Z.jsx)(`legend`,{className:`text-sm font-medium`,children:(0,Z.jsx)(Y,{id:`0YEbfk`})}),t[136]=ot):ot=t[136];let st;t[137]===Symbol.for(`react.memo_cache_sentinel`)?(st=(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`8IP5jY`})}),t[137]=st):st=t[137];let ct;t[138]!==k||t[139]!==v?(ct=Ia.map(e=>{let t=`create-editor-${e}`;return(0,Z.jsxs)(Ci,{htmlFor:t,className:`text-sm font-normal`,children:[(0,Z.jsx)(Hr,{id:t,checked:v.has(e),onCheckedChange:()=>Se(e),disabled:k,"data-testid":`create-editor-${e}`}),(0,Z.jsx)(`span`,{children:_s[e]})]},e)}),t[138]=k,t[139]=v,t[140]=ct):ct=t[140];let lt;t[141]===ct?lt=t[142]:(lt=(0,Z.jsxs)(`fieldset`,{className:`flex flex-col space-y-2 pb-2`,children:[ot,st,ct]}),t[141]=ct,t[142]=lt);let ut;t[143]!==k||t[144]!==b?(ut=(0,Z.jsx)(Ff,{idPrefix:`create`,testIdPrefix:`create-sharing`,value:b,onValueChange:x,disabled:k}),t[143]=k,t[144]=b,t[145]=ut):ut=t[145];let dt;t[146]!==lt||t[147]!==ut?(dt=(0,Z.jsxs)(dr,{className:`space-y-6 border-t border-border px-3 py-4`,children:[lt,ut]}),t[146]=lt,t[147]=ut,t[148]=dt):dt=t[148];let ft;t[149]!==S||t[150]!==dt?(ft=(0,Z.jsxs)(pr,{open:S,onOpenChange:C,className:`rounded-md border border-border`,"data-testid":`create-advanced`,children:[at,dt]}),t[149]=S,t[150]=dt,t[151]=ft):ft=t[151];let pt;t[152]!==s||t[153]!==j?(pt=j===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(Hy(j))}),t[152]=s,t[153]=j,t[154]=pt):pt=t[154];let mt;t[155]!==c||t[156]!==Ee||t[157]!==qe||t[158]!==rt||t[159]!==it||t[160]!==ft||t[161]!==pt?(mt=(0,Z.jsx)(_r,{className:`space-y-6`,children:(0,Z.jsxs)(`form`,{id:c,onSubmit:Ee,"data-testid":`create-project-form`,className:`space-y-6`,children:[qe,rt,it,ft,pt]})}),t[155]=c,t[156]=Ee,t[157]=qe,t[158]=rt,t[159]=it,t[160]=ft,t[161]=pt,t[162]=mt):mt=t[162];let ht;t[163]===r?ht=t[164]:(ht=()=>r(!1),t[163]=r,t[164]=ht);let gt;t[165]===Symbol.for(`react.memo_cache_sentinel`)?(gt=(0,Z.jsx)(Y,{id:`dEgA5A`}),t[165]=gt):gt=t[165];let _t;t[166]!==k||t[167]!==ht?(_t=(0,Z.jsx)(X,{type:`button`,variant:`outline`,className:`font-mono uppercase`,onClick:ht,disabled:k,"data-testid":`create-cancel`,children:gt}),t[166]=k,t[167]=ht,t[168]=_t):_t=t[168];let vt;t[169]===k?vt=t[170]:(vt=k?(0,Z.jsx)(Y,{id:`E9bKSA`}):(0,Z.jsx)(Y,{id:`hYgDIe`}),t[169]=k,t[170]=vt);let yt;t[171]!==c||t[172]!==be||t[173]!==vt?(yt=(0,Z.jsx)(X,{type:`submit`,form:c,disabled:be,"data-testid":`create-submit`,children:vt}),t[171]=c,t[172]=be,t[173]=vt,t[174]=yt):yt=t[174];let bt;t[175]!==_t||t[176]!==yt?(bt=(0,Z.jsxs)(vr,{children:[_t,yt]}),t[175]=_t,t[176]=yt,t[177]=bt):bt=t[177];let xt;t[178]!==ze||t[179]!==mt||t[180]!==bt?(xt=(0,Z.jsxs)(gr,{className:`sm:max-w-lg`,"data-testid":`create-project-dialog`,children:[ze,mt,bt]}),t[178]=ze,t[179]=mt,t[180]=bt,t[181]=xt):xt=t[181];let St;return t[182]!==Oe||t[183]!==n||t[184]!==xt?(St=(0,Z.jsx)(br,{open:n,onOpenChange:Oe,children:xt}),t[182]=Oe,t[183]=n,t[184]=xt,t[185]=St):St=t[185],St}function Wy(e){return e+1}function Gy(e){return e+1}function Ky(){}function qy(e){return e+1}function Jy(e){return e+1}function Yy(e){console.warn(`[CreateProjectDialog] defaultProjectsRoot probe failed:`,e)}function Xy(){return new Set(Ia)}function Zy(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=zy(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 Qy(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}function $y(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 eb={blobRun:{id:`hgf5io`},back:{id:`iH8pgl`},forward:{id:`rxWGWX`},newFile:{id:`HdkSiO`},newFolder:{id:`96G6Re`},openGraph:{id:`3Fcb0I`},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`}},tb={win32:{revealInFinder:{id:`qi1F96`},moveToTrash:{id:`o9yN4T`}},linux:{revealInFinder:{id:`e1Rn_k`}}};function nb(e,t){if(t===`win32`||t===`linux`){let n=tb[t][e];if(n)return n}return eb[e]}var rb={"open-blob-run":Fv,"navigate-back":Bl,"navigate-forward":Hl,"new-file":jr,"new-folder":Pv,"open-graph":Yv,"initialize-starter-pack":qd,"new-skill":ue,"new-project":Mn,"open-folder":hd,"open-file":Rr,"switch-project":re,"open-skills":qd,settings:Pc,"install-claude-desktop":od,"report-bug":O,"bug-report-history":yc,"send-feedback":Ud,"new-from-template":jr,rename:it,duplicate:Cu,"move-to-trash":ff,"reveal-in-finder":hd,"copy-full-path":Cu,"copy-relative-path":Cu,"close-tab":hf,"new-worktree":$c,"switch-worktree":$c,"toggle-sidebar":I,"toggle-doc-panel":Ks,"toggle-terminal":Zs,"move-terminal":Zs,"toggle-agent-panel":Ud,"toggle-show-hidden-files":sd,"toggle-show-ok-folders":gd,"toggle-show-only-markdown-files":Rr,"toggle-show-skills-section":ue,"expand-all-tree":wy,"collapse-all-tree":Mv,"new-terminal":Zs,"kill-terminal":Zs,"check-for-updates":Qd,"set-up-integrations":hv,"toggle-spell-check":sy,"open-github":Qy},ib={"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(),L(`graph`)},"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(),Ms._({id:`jol95m`}))},"open-skills":e=>{e.closePalette(),window.location.hash=wf()},settings:e=>{e.closePalette(),window.location.hash!==`#settings`&&(window.location.hash=ks)},"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(so)};function ab(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 ob(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 Ms._(eb[r]);let a=t.viewMenuState[e.stateToggle.stateField]===!0?e.stateToggle.hideKey:e.stateToggle.showKey;return Ms._(nb(a,n))}if(e.placementToggle){let r=t.viewMenuState.terminalPlacement===`right`?e.placementToggle.rightKey:e.placementToggle.bottomKey;return Ms._(nb(r,n))}return Ms._(nb(e.labelKey,n))}function sb(e){let t=e.menuActionId;return e=>e.emitMenuAction(t)}function cb(e){let t=e.palette;if(!t)throw Error(`command ${e.id} has no palette presence`);let n=rb[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=>ob(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=>Xa(e.availability,ab(t)),dispatch:ib[e.id]??sb(e)}}var lb=no.flatMap(e=>e.palette?[cb(e)]:[]),ub=`ok-omnibar-recents-v1`,db=10;function fb(e){return typeof e==`object`&&!!e&&(e.kind===`file`||e.kind===`folder`)&&typeof e.path==`string`&&typeof e.lastOpenedAt==`string`}function pb(e){if(e)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function mb(e,t){return`${e}:${t}`}function hb(e){let t=pb(e);if(!t)return[];try{let e=t.getItem(ub);if(!e)return[];let n=JSON.parse(e);return Array.isArray(n)?n.filter(fb).slice(0,db):[]}catch{return[]}}function gb(e,t){let n=pb(t);if(n)try{n.setItem(ub,JSON.stringify(e.slice(0,db)))}catch(e){console.warn(`[omnibar] Failed to save recent entries:`,e)}}function _b(e,t){return[t,...e.filter(e=>e.kind!==t.kind||e.path!==t.path)].slice(0,db)}function vb(e,t){return e.filter(e=>t.has(mb(e.kind,e.path)))}var yb=50,bb=50,xb=``,Sb=null;function Cb(e){return e.trim().toLowerCase()}function wb(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Tb(e){let t=e.trim();return t?[...new Set(t.split(/\s+/).filter(Boolean))].sort((e,t)=>t.length-e.length):[]}function Eb(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:ra(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:ra(e),bodyIndexed:!1}));for(let e of t)a.push({kind:`folder`,path:e,name:ra(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 Db(e){return Ta({kind:e.kind===`folder`?`folder`:e.bodyIndexed===!1?`file`:`page`,path:e.path,title:e.title??e.name,modifiedTs:e.modifiedTs??0})}function Ob(e){return{entries:e,byId:new Map(e.map(e=>[`${e.kind===`folder`?`folder`:e.bodyIndexed===!1?`file`:`page`}:${e.path}`,e])),corpus:_a(e.map(Db))}}function kb(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 Ab(e){let t=kb(e);return Sb&&xb===t?Sb:(xb=t,Sb=Ob(e),Sb)}function jb(e,t,n=yb){return Mb(Ab(e),t,n)}function Mb(e,t,n=yb){let r=Cb(t);return r?vo(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 Nb(e,t){let n=Tb(t);if(n.length===0||e.length===0)return[{text:e,match:!1,start:0}];let r=RegExp(`(${n.map(wb).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 Pb(e){if(e.kind!==`page`&&e.kind!==`folder`&&e.kind!==`file`||typeof e.path!=`string`)return null;let t=ra(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 Fb(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??bb,source:`omnibar`,...t.semantic?{semantic:!0}:{}}),signal:t.signal});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(Sc(e)??`Search failed with status ${r.status}`)}let i=await r.json();return{entries:(i.results??[]).map(Pb).filter(e=>!!e),truncated:i.truncated===!0,ready:i.ready!==!1}}function Ib(e,t,n=[]){let r=Cb(t);return r?Cb([e,...n].join(` `)).includes(r):!0}function Lb(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 Rb(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 zb=`tag:`;function Bb(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 Vb(e,t){return Je(e,t)}var Hb=Qe;async function Ub(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 Wb=(0,Q.lazy)(()=>n(()=>import(`./FeedbackForm-CpyB0Ay7.js`).then(e=>({default:e.FeedbackForm})),[],import.meta.url)),Gb=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)(yr,{children:(0,Z.jsx)(hr,{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)(gr,{children:[o,(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(Wb,{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)(br,{open:n,onOpenChange:r,children:c}),t[7]=r,t[8]=n,t[9]=c,t[10]=l):l=t[10],l},Kb=[`.md`,`.mdx`];function qb(e){let t=e.toLowerCase();for(let e of Kb)if(t.endsWith(e))return e;return null}var Jb={local:0,inherited:1};function Yb(e){return[...e].sort((e,t)=>{let n=Jb[e.scope]-Jb[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 Xb=`__blank__`;function Zb(e){return e.trim()?e.includes(`..`)?`dotdot`:e.startsWith(`/`)?`leading-slash`:e.includes(`\\`)?`backslash`:e.includes(`\0`)?`null-byte`:null:`empty`}function Qb(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 $b(e){let t=e.fileName.trim(),n=qb(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 ex(e,t){return ys(e.target)?!1:As(e,`new-item`,t)}function tx(e){let t=e.value.lastIndexOf(`.`);t>0?e.setSelectionRange(0,t):e.select()}function nx(e){let t=(0,$.c)(136),{open:n,onOpenChange:r,kind:i,initialDir:a,suggestedName:s,initialTemplate:c,defaultToTemplate:l,description:u,onCreated:d,folderConfig:f}=e,{_:p}=on(),{addPage:m}=Eu(),h=Wu(f?null:a),g=f??h,[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(``),[x,S]=(0,Q.useState)(Xb),[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(null),j=(0,Q.useId)(),M=(0,Q.useId)(),N=(0,Q.useId)(),P=(0,Q.useId)(),F=(0,Q.useId)(),[I,L]=(0,Q.useState)(!1),R=(0,Q.useRef)(null),z=(0,Q.useRef)(null),B,V;t[0]!==c||t[1]!==i||t[2]!==n||t[3]!==s?(B=()=>{n&&(E(null),A(null),O(!1),b(``),S(i===`file`&&c?c:Xb),w(!1),L(!1),v(i===`file`?s??`untitled`:`index`))},V=[n,i,s,c],t[0]=c,t[1]=i,t[2]=n,t[3]=s,t[4]=B,t[5]=V):(B=t[4],V=t[5]),(0,Q.useEffect)(B,V);let H;t[6]!==g.state.data||t[7]!==g.state.status?(H=g.state.status===`ready`?Yb(g.state.data.folder.templates_available??[]):[],t[6]=g.state.data,t[7]=g.state.status,t[8]=H):H=t[8];let U=H,W;t[9]!==g.state.data||t[10]!==g.state.status||t[11]!==n||t[12]!==x?(W=()=>{n&&x!==Xb&&g.state.status===`ready`&&((g.state.data.folder.templates_available??[]).some(e=>e.name===x)||S(Xb))},t[9]=g.state.data,t[10]=g.state.status,t[11]=n,t[12]=x,t[13]=W):W=t[13];let ee;t[14]!==g.state||t[15]!==n||t[16]!==x?(ee=[n,x,g.state],t[14]=g.state,t[15]=n,t[16]=x,t[17]=ee):ee=t[17],(0,Q.useEffect)(W,ee);let G;t[18]!==l||t[19]!==g.state.data||t[20]!==g.state.status||t[21]!==c||t[22]!==n||t[23]!==C?(G=()=>{if(!n||!l||c||C||g.state.status!==`ready`)return;let e=Yb(g.state.data.folder.templates_available??[]);e.length>0&&S(e[0].name)},t[18]=l,t[19]=g.state.data,t[20]=g.state.status,t[21]=c,t[22]=n,t[23]=C,t[24]=G):G=t[24];let K;t[25]!==l||t[26]!==g.state||t[27]!==c||t[28]!==n||t[29]!==C?(K=[n,l,c,C,g.state],t[25]=l,t[26]=g.state,t[27]=c,t[28]=n,t[29]=C,t[30]=K):K=t[30],(0,Q.useEffect)(G,K);let q=i===`file`,te=g.state.status===`loading`||g.state.status===`idle`,J=g.state.status===`error`?g.state.message:null,ne;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(ne=function(e){v(e),E(null)},t[31]=ne):ne=t[31];let re=ne,ie;t[32]!==_||t[33]!==y||t[34]!==a||t[35]!==i?(ie=function(){return $b({kind:i,initialDir:a,fileName:_,folderName:y})},t[32]=_,t[33]=y,t[34]=a,t[35]=i,t[36]=ie):ie=t[36];let ae=ie,oe;t[37]!==p||t[38]!==_||t[39]!==y||t[40]!==i?(oe=function(){if(i===`folder`){let e=Zb(y.trim());if(e)return{message:p({id:`ODGGlj`,values:{detail:p(Qb(e))}}),field:`folder`}}let e=Zb(_.trim());return e?{message:p(Qb(e)),field:`file`}:null},t[37]=p,t[38]=_,t[39]=y,t[40]=i,t[41]=oe):oe=t[41];let se=oe,ce;t[42]!==D||t[43]!==_||t[44]!==y||t[45]!==i?(ce=D||!_.trim()||i===`folder`&&!y.trim(),t[42]=D,t[43]=_,t[44]=y,t[45]=i,t[46]=ce):ce=t[46];let le=ce,ue;t[47]!==p||t[48]!==m||t[49]!==ae||t[50]!==se||t[51]!==i||t[52]!==d||t[53]!==r||t[54]!==x?(ue=async function(){let e=se();if(e){E(e.message),A(e.field);return}O(!0),E(null),A(null);let t=ae(),n=i===`file`&&x!==Xb?x:void 0,a={path:t};n!==void 0&&(a.template=n);try{let e=await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(a)}),t=e.status,n=await o(e,p({id:`d2uTPx`,values:{status:t}}));if(!n.ok){O(!1),E(n.title),A(`form`);return}let s=cs.safeParse(n.body);if(O(!1),!s.success){E(p(i===`folder`?{id:`K1ckLX`}:{id:`fJgQHX`})),A(`form`);return}let c=s.data.docName;r(!1),window.location.hash=`#/${c}`,m(c),Fs([`files`,`backlinks`,`graph`]),d?.(c)}catch(e){console.warn(`[NewItemDialog] create failed:`,e),O(!1),E(p({id:`HIb0vl`})),A(`form`)}},t[47]=p,t[48]=m,t[49]=ae,t[50]=se,t[51]=i,t[52]=d,t[53]=r,t[54]=x,t[55]=ue):ue=t[55];let de=ue,fe;t[56]!==p||t[57]!==a?(fe=a||p({id:`L6Hhh6`}),t[56]=p,t[57]=a,t[58]=fe):fe=t[58];let pe=fe,me;t[59]===i?me=t[60]:(me=(0,Z.jsx)(hr,{children:i===`file`?(0,Z.jsx)(Y,{id:`HdkSiO`}):(0,Z.jsx)(Y,{id:`96G6Re`})}),t[59]=i,t[60]=me);let he;t[61]!==u||t[62]!==pe?(he=u??(0,Z.jsx)(Y,{id:`NvOvTi`,values:{dirDisplay:pe},components:{0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})}}),t[61]=u,t[62]=pe,t[63]=he):he=t[63];let ge;t[64]===he?ge=t[65]:(ge=(0,Z.jsx)(mr,{children:he}),t[64]=he,t[65]=ge);let _e;t[66]!==me||t[67]!==ge?(_e=(0,Z.jsxs)(yr,{children:[me,ge]}),t[66]=me,t[67]=ge,t[68]=_e):_e=t[68];let ve;t[69]!==x||t[70]!==q||t[71]!==P||t[72]!==I||t[73]!==F||t[74]!==U||t[75]!==J||t[76]!==te?(ve=q&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{id:P,className:`text-sm font-medium`,children:(0,Z.jsx)(Y,{id:`f65AOQ`})}),J?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,children:(0,Z.jsx)(Y,{id:`sE7R19`,values:{templatesError:J}})}):null,(0,Z.jsx)(ix,{triggerId:F,labelledById:P,open:I,onOpenChange:L,value:x,onValueChange:e=>{S(e),w(!0)},templates:U,loading:te}),!te&&!J&&U.length===0?(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`uWtdQR`})}):null]}),t[69]=x,t[70]=q,t[71]=P,t[72]=I,t[73]=F,t[74]=U,t[75]=J,t[76]=te,t[77]=ve):ve=t[77];let ye;t[78]!==p||t[79]!==T||t[80]!==k||t[81]!==j||t[82]!==M||t[83]!==y||t[84]!==i?(ye=i===`folder`&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:M,children:(0,Z.jsx)(Y,{id:`cqQyPB`})}),(0,Z.jsx)(zf,{ref:z,id:M,value:y,onChange:e=>{b(e.target.value),E(null)},placeholder:`folder-name`,autoFocus:!0,"aria-describedby":T&&(k===`folder`||k===`form`)?j:void 0,"aria-invalid":T&&(k===`folder`||k===`form`)?!0:void 0,onKeyDown:e=>{if(e.key===`Enter`){e.preventDefault();let t=Zb(y.trim());if(t){E(p({id:`ODGGlj`,values:{detail:p(Qb(t))}})),A(`folder`);return}R.current?.focus()}}})]}),t[78]=p,t[79]=T,t[80]=k,t[81]=j,t[82]=M,t[83]=y,t[84]=i,t[85]=ye):ye=t[85];let be;t[86]===i?be=t[87]:(be=i===`folder`?(0,Z.jsx)(Y,{id:`jjtmV_`}):(0,Z.jsx)(Y,{id:`s-XOaI`}),t[86]=i,t[87]=be);let xe;t[88]!==N||t[89]!==be?(xe=(0,Z.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:N,children:be}),t[88]=N,t[89]=be,t[90]=xe):xe=t[90];let Se;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(Se=e=>re(e.target.value),t[91]=Se):Se=t[91];let Ce=i===`file`,we=T&&(k===`file`||k===`form`)?j:void 0,Te=T&&(k===`file`||k===`form`)?!0:void 0,Ee;t[92]!==de||t[93]!==le?(Ee=e=>{e.key===`Enter`&&!le&&de()},t[92]=de,t[93]=le,t[94]=Ee):Ee=t[94];let De;t[95]!==N||t[96]!==_||t[97]!==Ce||t[98]!==we||t[99]!==Te||t[100]!==Ee?(De=(0,Z.jsx)(zf,{ref:R,id:N,value:_,onChange:Se,placeholder:`my-note`,autoFocus:Ce,"aria-describedby":we,"aria-invalid":Te,onFocus:rx,onKeyDown:Ee}),t[95]=N,t[96]=_,t[97]=Ce,t[98]=we,t[99]=Te,t[100]=Ee,t[101]=De):De=t[101];let Oe;t[102]!==T||t[103]!==j?(Oe=T&&(0,Z.jsx)(`p`,{id:j,role:`alert`,className:`text-1sm text-destructive`,children:T}),t[102]=T,t[103]=j,t[104]=Oe):Oe=t[104];let ke;t[105]!==xe||t[106]!==De||t[107]!==Oe?(ke=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[xe,De,Oe]}),t[105]=xe,t[106]=De,t[107]=Oe,t[108]=ke):ke=t[108];let Ae;t[109]!==ve||t[110]!==ye||t[111]!==ke?(Ae=(0,Z.jsxs)(_r,{className:`space-y-6 pb-1`,children:[ve,ye,ke]}),t[109]=ve,t[110]=ye,t[111]=ke,t[112]=Ae):Ae=t[112];let je;t[113]===r?je=t[114]:(je=()=>r(!1),t[113]=r,t[114]=je);let Me;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(Me=(0,Z.jsx)(Y,{id:`dEgA5A`}),t[115]=Me):Me=t[115];let Ne;t[116]!==D||t[117]!==je?(Ne=(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:je,disabled:D,children:Me}),t[116]=D,t[117]=je,t[118]=Ne):Ne=t[118];let Pe;t[119]===D?Pe=t[120]:(Pe=D?(0,Z.jsx)(Y,{id:`E9bKSA`}):(0,Z.jsx)(Y,{id:`hYgDIe`}),t[119]=D,t[120]=Pe);let Fe;t[121]!==de||t[122]!==le||t[123]!==Pe?(Fe=(0,Z.jsx)(X,{onClick:de,disabled:le,children:Pe}),t[121]=de,t[122]=le,t[123]=Pe,t[124]=Fe):Fe=t[124];let Ie;t[125]!==Ne||t[126]!==Fe?(Ie=(0,Z.jsxs)(vr,{children:[Ne,Fe]}),t[125]=Ne,t[126]=Fe,t[127]=Ie):Ie=t[127];let Le;t[128]!==_e||t[129]!==Ae||t[130]!==Ie?(Le=(0,Z.jsxs)(gr,{className:`sm:max-w-md`,"data-ok-layer-spawned":``,children:[_e,Ae,Ie]}),t[128]=_e,t[129]=Ae,t[130]=Ie,t[131]=Le):Le=t[131];let Re;return t[132]!==r||t[133]!==n||t[134]!==Le?(Re=(0,Z.jsx)(br,{open:n,onOpenChange:r,children:Le}),t[132]=r,t[133]=n,t[134]=Le,t[135]=Re):Re=t[135],Re}function rx(e){return tx(e.currentTarget)}function ix(e){let t=(0,$.c)(66),{triggerId:n,labelledById:r,open:i,onOpenChange:a,value:o,onValueChange:s,templates:c,loading:l}=e,{_:u}=on(),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===Xb,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)(cx,{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)(nu,{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)(In,{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)(ke,{placeholder:C}),t[30]=C,t[31]=w);let T;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(kt,{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)(xt,{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)(zl,{className:Bn(`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)(cx,{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(Xb),a(!1)},t[42]=a,t[43]=s,t[44]=D):D=t[44];let O=o===Xb?`opacity-100`:`opacity-0`,k;t[45]===O?k=t[46]:(k=Bn(`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)(zl,{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)(xt,{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)(Nt,{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)(jn,{className:`w-[var(--radix-popover-trigger-width)] p-0`,align:`start`,onOpenAutoFocus:sx,onWheel:ox,onTouchMove:ax,children:(0,Z.jsxs)(Lt,{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)(Ln,{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 ax(e){e.stopPropagation()}function ox(e){e.stopPropagation()}function sx(e){e.preventDefault(),e.currentTarget.querySelector(`[cmdk-input]`)?.focus()}function cx(e){let t=(0,$.c)(7),{entry:n,className:r}=e;if(n.scope===`inherited`){let e;t[0]===r?e=t[1]:(e=Bn(`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)(Mp,{variant:`gray`,className:e,children:i}),t[4]=e,t[5]=i,t[6]=a):a=t[6],a}return null}function lx(e){return e.split(`/`).pop()??e}function ux(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=>lx(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 dx(e){return e.created.filter(e=>e.kind===`file`&&!e.path.split(`/`).includes(`.ok`)).map(e=>({path:e.path,name:lx(e.path)}))}function fx(e){let t=(0,$.c)(17),{plan:n,selectedPack:r}=e,{_:i}=on(),a,o,s,c;if(t[0]!==i||t[1]!==n||t[2]!==r){let e=ux(n,r),l=dx(n),u=(n.packSkills??[]).filter(bx),d=e.length,f=l.length,p=e.reduce(yx,0),m=u.length,h={"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`})},g=[d>0?{key:`folders`,n:d,label:i({id:`VsaI0G`,values:{folderCount:d}})}:null,f>0?{key:`files`,n:f,label:i({id:`DgcGrb`,values:{fileCount:f}})}:null,p>0?{key:`templates`,n:p,label:i({id:`ba3vIW`,values:{templateCount:p}})}:null,m>0?{key:`skills`,n:m,label:i({id:`HAvRAI`,values:{skillCount:m}})}:null].filter(vx),_=e.map(e=>({key:`folder:${e.path}`,icon:gd,name:`${lx(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})),v=l.map(e=>({key:`file:${e.path}`,icon:C,name:e.name,title:e.name,description:h[e.name]})),y=u.map(e=>({key:`skill:${e.name}`,icon:Rv,name:Op(e.name),title:e.name,description:i({id:`FEqWFL`})})),b=[{key:`folders`,label:i({id:`pcqlQu`,values:{0:_.length}}),rows:_},{key:`files`,label:i({id:`ZgGuA4`,values:{0:v.length}}),rows:v},{key:`skill`,label:i({id:`yK1m_z`,values:{0:y.length}}),rows:y}].filter(_x);s=`space-y-5`;let x;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(x=(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]=x):x=t[7];let S=g.length>0?(0,Z.jsx)(`div`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-0.5 text-xs`,children:g.map(gx)}):null;t[8]===S?c=t[9]:(c=(0,Z.jsxs)(`div`,{className:`flex flex-wrap justify-between items-baseline gap-x-2 gap-y-0.5`,children:[x,S]}),t[8]=S,t[9]=c),a=`space-y-5`,o=b.map(px),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 px(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(mx)})]},e.key)}function mx(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)(sr,{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)(cr,{children:(0,Z.jsx)(`ul`,{className:`space-y-0.5 text-left font-mono`,children:e.pillTooltip.map(hx)})})]}):(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 hx(e){return(0,Z.jsx)(`li`,{children:e},e)}function gx(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 _x(e){return e.rows.length>0}function vx(e){return e!==null}function yx(e,t){return e+t.templateCount}function bx(e){return e.pending}async function xx(e){let t=await e.json().catch(()=>null),n=gs.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 Sx(){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&&Vs(),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 xx(r)};let i=await r.json().catch(()=>null);return i?.plan?{ok:!0,plan:i.plan}:{ok:!1,error:{kind:`internal`,message:Ms._({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 xx(n)};let r=await n.json().catch(()=>null);return r?.result?(Vs(),{ok:!0,result:r.result}):{ok:!1,error:{kind:`internal`,message:Ms._({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:Ms._({id:`q-QUC7`})}}:{ok:!0,packs:t.packs}}}}var Cx={"knowledge-base":Vv,"software-lifecycle":$c,"codebase-wiki":_v,"plain-notes":dy,worldbuilding:Sv,"writing-pipeline":Qv,"entity-vault":Yv,okf:Dv};function wx(e){return Cx[e]??Vv}function Tx(e){let t=(0,$.c)(69),{onPackSelect:n,onCreateBlankFile:r,collapsedPackIds:i,className:a,packs:o}=e,{_:s}=on(),[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 Sx().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=Bn(`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=Bn(`@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(Cx).length},Dx).map(Ex)}),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=Bn(`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=Bn(`@container/packgrid w-full max-w-5xl`,a),t[47]=a,t[48]=k),x=pr,T=f,E=p;let s;t[49]===n?s=t[50]:(s=e=>(0,Z.jsx)(Ox,{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)(dr,{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:Bn(`grid gap-4 @sm/packgrid:grid-cols-2 @2xl/packgrid:grid-cols-3`,`pt-4`),children:C.map(e=>(0,Z.jsx)(Ox,{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)(fr,{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)(Vl,{"aria-hidden":`true`,className:Bn(`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)(ll,{"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 Ex(e){return(0,Z.jsx)(kx,{},`skeleton-${e}`)}function Dx(e,t){return t}function Ox(e){let t=(0,$.c)(17),{pack:n,onSelect:r}=e,i;t[0]===n.id?i=t[1]:(i=wx(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;return t[14]!==r||t[15]!==u?(d=(0,Z.jsx)(`button`,{type:`button`,onClick:r,className:`group flex h-full min-w-0 flex-col items-start gap-4 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}),t[14]=r,t[15]=u,t[16]=d):d=t[16],d}function kx(){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)(xd,{"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`})]}),(0,Z.jsx)(`div`,{className:`mt-auto h-3 w-20 animate-pulse rounded bg-muted`})]}),e[1]=n):n=e[1],n}var Ax=`knowledge-base`;function jx(e){let t=(0,$.c)(94),{open:n,onOpenChange:r,onSeedApplied:i,initialPackId:a}=e,{_:o}=on(),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??Ax),[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 Sx().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??Ax),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(Px),Sx().plan({rootDir:e,packId:f}).then(e=>{if(!r){if(!e.ok){l({kind:`error`,message:e.error.message});return}l(e.plan.created.length>0||e.plan.packSkills?.some(Nx)===!0?{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 Sx().apply(e,{packId:f})}catch(t){let n=t,r=n instanceof Error?n.message:String(n);Ns.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(Mx)===!0,c=o(a>0?{id:`x3-2ta`,values:{packName:n,projectEntries:a}}:s?{id:`B2Srgd`,values:{packName:n}}:{id:`K6jjWB`,values:{packName:n}});Ns.success(c);for(let e of t.result.packSkillConflicts??[]){let t=e.name,n=e.hosts?.join(`, `);Ns.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;Ns.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;t[21]===o?F=t[22]:(F=o({id:`gvApb7`}),t[21]=o,t[22]=F);let I;t[23]===o?I=t[24]:(I=o({id:`hCOLSd`}),t[23]=o,t[24]=I);let L;t[25]===o?L=t[26]:(L=o({id:`Fy4GgU`}),t[25]=o,t[26]=L);let R;t[27]===o?R=t[28]:(R=o({id:`Qw-7Ie`}),t[27]=o,t[28]=R);let z;t[29]===o?z=t[30]:(z=o({id:`_ayOfA`}),t[29]=o,t[30]=z);let B;t[31]===o?B=t[32]:(B=o({id:`Zf0w-R`}),t[31]=o,t[32]=B);let V;t[33]===o?V=t[34]:(V=o({id:`hmYd9H`}),t[33]=o,t[34]=V);let H;t[35]===o?H=t[36]:(H=o({id:`VBE2dw`}),t[35]=o,t[36]=H);let U;t[37]!==F||t[38]!==I||t[39]!==L||t[40]!==R||t[41]!==z||t[42]!==B||t[43]!==V||t[44]!==H?(U={"knowledge-base":F,"software-lifecycle":I,"codebase-wiki":L,"plain-notes":R,okf:z,"writing-pipeline":B,"entity-vault":V,worldbuilding:H},t[37]=F,t[38]=I,t[39]=L,t[40]=R,t[41]=z,t[42]=B,t[43]=V,t[44]=H,t[45]=U):U=t[45];let W=U,ee;t[46]!==o||t[47]!==W||t[48]!==x||t[49]!==v?(ee=v===`configure`&&x?W[x.id]??x.description:o({id:`msqUNq`}),t[46]=o,t[47]=W,t[48]=x,t[49]=v,t[50]=ee):ee=t[50];let G=ee,K;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(K=function(e){p(e),y(`configure`),b.current=!0},t[51]=K):K=t[51];let q=K,te;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(te=function(){y(`pick`),l({kind:`loading`}),b.current=!0},t[52]=te):te=t[52];let J=te,ne;t[53]===P?ne=t[54]:(ne=(0,Z.jsx)(hr,{children:P}),t[53]=P,t[54]=ne);let re;t[55]===G?re=t[56]:(re=(0,Z.jsx)(mr,{children:G}),t[55]=G,t[56]=re);let ie;t[57]!==ne||t[58]!==re?(ie=(0,Z.jsxs)(yr,{children:[ne,re]}),t[57]=ne,t[58]=re,t[59]=ie):ie=t[59];let ae;t[60]!==u||t[61]!==c||t[62]!==m||t[63]!==x||t[64]!==v||t[65]!==g?(ae=v===`pick`?(0,Z.jsx)(_r,{children:(0,Z.jsx)(Tx,{packs:u,onPackSelect:q})}):(0,Z.jsxs)(_r,{className:`space-y-6`,children:[(0,Z.jsx)(Fx,{choice:m,subfolder:g,placeholder:x?.defaultSubfolder??`subfolder`,onChoiceChange:h,onSubfolderChange:_}),(0,Z.jsx)(Ix,{phase:c,selectedPack:x})]}),t[60]=u,t[61]=c,t[62]=m,t[63]=x,t[64]=v,t[65]=g,t[66]=ae):ae=t[66];let oe;t[67]!==M||t[68]!==v?(oe=v===`configure`&&!M?(0,Z.jsxs)(X,{className:`mr-auto uppercase font-mono`,variant:`ghost`,onClick:J,children:[(0,Z.jsx)(ol,{"aria-hidden":`true`,className:`h-4 w-4`}),(0,Z.jsx)(Y,{id:`iH8pgl`})]}):null,t[67]=M,t[68]=v,t[69]=oe):oe=t[69];let se;t[70]===r?se=t[71]:(se=()=>r(!1),t[70]=r,t[71]=se);let ce;t[72]===c.kind?ce=t[73]:(ce=c.kind===`already-seeded`||c.kind===`error`?(0,Z.jsx)(Y,{id:`yz7wBu`}):(0,Z.jsx)(Y,{id:`dEgA5A`}),t[72]=c.kind,t[73]=ce);let le;t[74]!==se||t[75]!==ce?(le=(0,Z.jsx)(X,{className:`uppercase font-mono`,variant:`outline`,onClick:se,children:ce}),t[74]=se,t[75]=ce,t[76]=le):le=t[76];let ue;t[77]!==j||t[78]!==c.kind||t[79]!==v||t[80]!==O?(ue=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)(xd,{"aria-hidden":`true`,className:`h-4 w-4`}),(0,Z.jsx)(Y,{id:`XYlJJT`})]}):null,t[77]=j,t[78]=c.kind,t[79]=v,t[80]=O,t[81]=ue):ue=t[81];let de;t[82]!==oe||t[83]!==le||t[84]!==ue?(de=(0,Z.jsxs)(vr,{children:[oe,le,ue]}),t[82]=oe,t[83]=le,t[84]=ue,t[85]=de):de=t[85];let fe;t[86]!==ie||t[87]!==ae||t[88]!==de?(fe=(0,Z.jsxs)(gr,{className:`sm:max-w-4xl`,"data-ok-layer-spawned":``,children:[ie,ae,de]}),t[86]=ie,t[87]=ae,t[88]=de,t[89]=fe):fe=t[89];let pe;return t[90]!==r||t[91]!==n||t[92]!==fe?(pe=(0,Z.jsx)(br,{open:n,onOpenChange:r,children:fe}),t[90]=r,t[91]=n,t[92]=fe,t[93]=pe):pe=t[93],pe}function Mx(e){return e.pending}function Nx(e){return e.pending}function Px(e){return e.kind===`plan`||e.kind===`already-seeded`?e:{kind:`loading`}}function Fx(e){let t=(0,$.c)(22),{choice:n,subfolder:r,placeholder:i,onChoiceChange:a,onSubfolderChange:o}=e,{_:s}=on(),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Z.jsx)(Y,{id:`3wiBAs`})}),t[0]=c):c=t[0];let l;t[1]===a?l=t[2]:(l=e=>a(e),t[1]=a,t[2]=l);let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Lp,{children:(0,Z.jsx)(Y,{id:`RSqaSd`})}),t[3]=u):u=t[3];let d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Fp,{htmlFor:`seed-root-project-root`,children:(0,Z.jsxs)(Rp,{orientation:`horizontal`,children:[(0,Z.jsxs)(Pp,{children:[u,(0,Z.jsx)(Ip,{className:`text-1sm`,children:(0,Z.jsx)(Y,{id:`ZvzbDF`})})]}),(0,Z.jsx)(Ai,{value:`project-root`,id:`seed-root-project-root`})]})}),t[4]=d):d=t[4];let f;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(Lp,{children:(0,Z.jsx)(Y,{id:`ZWgr0b`})}),t[5]=f):f=t[5];let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Ip,{className:`nth-last-2:mt-0 text-1sm`,children:(0,Z.jsx)(Y,{id:`KQGZuq`})}),t[6]=p):p=t[6];let m;t[7]!==s||t[8]!==n||t[9]!==o||t[10]!==i||t[11]!==r?(m=n===`subfolder`&&(0,Z.jsx)(zf,{value:r,onChange:e=>o(e.target.value),placeholder:i,"aria-label":s({id:`NYUhy5`}),spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,className:`mt-1.5 font-mono text-xs bg-background`}),t[7]=s,t[8]=n,t[9]=o,t[10]=i,t[11]=r,t[12]=m):m=t[12];let h;t[13]===m?h=t[14]:(h=(0,Z.jsxs)(Pp,{children:[f,p,m]}),t[13]=m,t[14]=h);let g;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(Ai,{value:`subfolder`,id:`seed-root-subfolder`}),t[15]=g):g=t[15];let _;t[16]===h?_=t[17]:(_=(0,Z.jsx)(Fp,{htmlFor:`seed-root-subfolder`,children:(0,Z.jsxs)(Rp,{orientation:`horizontal`,children:[h,g]})}),t[16]=h,t[17]=_);let v;return t[18]!==n||t[19]!==_||t[20]!==l?(v=(0,Z.jsxs)(`div`,{className:`space-y-2 py-1`,children:[c,(0,Z.jsxs)(ji,{className:`sm:flex`,value:n,onValueChange:l,children:[d,_]})]}),t[18]=n,t[19]=_,t[20]=l,t[21]=v):v=t[21],v}function Ix(e){let t=(0,$.c)(24),{phase:n,selectedPack:r}=e,{_:i}=on();if(n.kind===`loading`){let e=r?.folders.length??6,n;t[0]===i?n=t[1]:(n=i({id:`--T3kB`}),t[0]=i,t[1]=n);let a;t[2]===e?a=t[3]:(a=(0,Z.jsx)(`ul`,{className:`space-y-2`,children:Array.from({length:e},Bx).map(zx)}),t[2]=e,t[3]=a);let o;return t[4]!==n||t[5]!==a?(o=(0,Z.jsx)(`section`,{role:`status`,"aria-busy":`true`,"aria-label":n,children:a}),t[4]=n,t[5]=a,t[6]=o):o=t[6],o}if(n.kind===`error`){let e;return t[7]===n.message?e=t[8]:(e=(0,Z.jsx)(`div`,{className:`rounded-md bg-destructive/10 p-3 text-sm text-destructive`,children:n.message}),t[7]=n.message,t[8]=e),e}if(n.kind===`already-seeded`){let e;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`p`,{className:`font-medium`,children:(0,Z.jsx)(Y,{id:`YwPUUP`})}),t[9]=e):e=t[9];let r;t[10]===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[10]=r):r=t[10];let i;return t[11]===n.plan?i=t[12]:(i=(0,Z.jsxs)(`div`,{className:`space-y-3 py-2 text-sm`,children:[r,(0,Z.jsx)(Vx,{plan:n.plan})]}),t[11]=n.plan,t[12]=i),i}let a;t[13]!==n.plan||t[14]!==r?(a=n.plan.created.length>0||n.plan.packSkills?.some(Rx)?(0,Z.jsx)(fx,{plan:n.plan,selectedPack:r}):null,t[13]=n.plan,t[14]=r,t[15]=a):a=t[15];let o;t[16]===n.plan.warnings?o=t[17]:(o=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(Lx)}):null,t[16]=n.plan.warnings,t[17]=o);let s;t[18]===n.plan?s=t[19]:(s=(0,Z.jsx)(Vx,{plan:n.plan}),t[18]=n.plan,t[19]=s);let c;return t[20]!==a||t[21]!==o||t[22]!==s?(c=(0,Z.jsxs)(`div`,{className:`space-y-6 py-1 text-sm`,children:[a,o,s]}),t[20]=a,t[21]=o,t[22]=s,t[23]=c):c=t[23],c}function Lx(e){return(0,Z.jsx)(`p`,{children:e},e)}function Rx(e){return e.pending}function zx(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 Bx(e,t){return t}function Vx(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(Ux)??[];if(e.length===0){a=null;break bb0}r=`rounded-md bg-warning/10 p-3 text-xs text-warning-foreground`,i=e.map(Hx)}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 Hx(e){return(0,Z.jsx)(`p`,{children:(0,Z.jsx)(Y,{id:`CtoghX`,values:{0:e.name}})},e.name)}function Ux(e){return e.conflict}var Wx=`Describe what this skill does and when to use it.`;function Gx(){let e=(0,$.c)(8),{_:t}=on(),n=fm(),r=pm(),[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=Dp(n.status===`ready`?n.data:[])[s],l=o?.name?.trim()||`new-skill`;if(!o?.name)for(let e=2;c.has(l);e++)l=`new-skill-${e}`;let u=o?.description?.trim()||`Describe what this skill does and when to use it.`;a(!0);let d=await Zp({scope:s,name:l,frontmatter:{name:l,description:u},body:``});if(a(!1),!d.ok){Ns.error(t({id:`xrVr_k`,values:{0:d.error}}));return}Ns.success(t({id:`Yy90sM`,values:{name:l}})),r(s,l,d.path===void 0?void 0:{path:d.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 Kx(){return(0,Q.useSyncExternalStore)(mm,hm,hm)}function qx(e,t){return e instanceof Error&&e.message?e.message:t}async function Jx(e,t,n,r=`action`){try{n(null),await e()}catch(e){console.error(`[${r}] action failed:`,e),n(qx(e,t))}}async function Yx(e,t,n=Ns,r=`action`){await Jx(e,t,e=>{e!==null&&n.error(e)},r)}var Xx=(0,Q.createContext)(!1);function Zx(e){let t=(0,$.c)(5),{children:n}=e,[r,i]=(0,Q.useState)($x),a,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{if(window.okDesktop)return;let e=new AbortController;return Kp(e.signal).then(t=>{e.signal.aborted||t.status!==`ok`||i(t.config.singleFile)}).catch(Qx),()=>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)(Xx,{value:r,children:n}),t[2]=n,t[3]=r,t[4]=s):s=t[4],s}function Qx(){}function $x(){return typeof window<`u`?window.okDesktop?.config.singleFile??!1:!1}function eS(){return(0,Q.use)(Xx)}function tS(e){return e.opened?e.isMain?`primary`:`worktree`:`none`}function nS(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)=>rS(e)-rS(t))}function rS(e){return e.isMain?0:e.opened?1:2}function iS(e){let t=e.split(/[/\\]/).filter(e=>e.length>0);return t.length>0?t[t.length-1]??e:e}function aS(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:iS(e.mainRoot),lastOpenedAt:``},worktrees:e.worktrees,projectSynthesized:t}})}function oS(e){let t=(0,$.c)(14),{path:n,name:r,onRemoveRecent:i,testIdPrefix:a}=e,{_:o}=on(),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)(hf,{"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 sS(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)(ti,{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)(hf,{"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)(ai,{children:(0,Z.jsxs)($r,{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)(si,{children:[o,d]}),t[10]=o,t[11]=d,t[12]=f):f=t[12],f}var cS=(0,Q.lazy)(()=>n(()=>import(`./BugReportHistoryDialog-C2b4xA3d.js`),__vite__mapDeps([51,12,1,13,14,27,16,17,18,28,29,30,26,24,25,31,22,38,39,40,41,37,42,43,44,45]),import.meta.url)),lS=3e3,uS=600,dS=20,fS=(e,t,n)=>Yx(e,t,n,`CommandPalette`);function pS(e){window.location.assign(Cf(e))}function mS(e,t){return e?.kind===`folder`||e?.kind===`folder-index`?e.folderPath:Kf(t)}function hS(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)(ft,{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)(gl,{className:`truncate font-medium`,children:(0,Z.jsx)(_S,{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)(gl,{className:`truncate text-muted-foreground text-xs`,children:(0,Z.jsx)(_S,{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)(gl,{className:`max-h-10 overflow-hidden text-muted-foreground text-xs leading-relaxed`,children:(0,Z.jsx)(_S,{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)(xt,{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 gS(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:xs(`find`)},components:{0:(0,Z.jsx)(ne,{"aria-label":Ss(`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 _S(e){let t=(0,$.c)(5),{text:n,query:r}=e,i;t[0]!==r||t[1]!==n?(i=Nb(n,r).map(vS),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 vS(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 yS({searchResults:e,fallbackSearchResults:t,searchStatus:n}){return e.length>0?e:n===`success`?[]:t}function bS(e){let t=(0,$.c)(150),{bridge:n,open:r,onOpenChange:i}=e,a=n===void 0?null:n,{_:o}=on(),s=eS(),[c,l]=(0,Q.useState)(``),u=(0,Q.useDeferredValue)(c),d=u.trim(),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=[],t[0]=f):f=t[0];let[p,m]=(0,Q.useState)(f),[h,g]=(0,Q.useState)(`idle`),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(!1),C;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(C=[],t[1]=C):C=t[1];let[w,T]=(0,Q.useState)(C),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(`idle`),A;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(A=[],t[2]=A):A=t[2];let[j,M]=(0,Q.useState)(A),N;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(N=[],t[3]=N):N=t[3];let[P,F]=(0,Q.useState)(N),[I,L]=(0,Q.useState)(null),[R,z]=(0,Q.useState)(!1),[B,V]=(0,Q.useState)(!1),[H,U]=(0,Q.useState)(!1),[W,ee]=(0,Q.useState)(!1),[G,K]=(0,Q.useState)(!1),[q,te]=(0,Q.useState)(!1),{createBlank:J}=Gx(),re=Mt(),ie;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(ie=[],t[4]=ie):ie=t[4];let[ae,oe]=(0,Q.useState)(ie),[se,ce]=(0,Q.useState)(`idle`),le;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(le=[],t[5]=le):le=t[5];let[de,fe]=(0,Q.useState)(le),[pe,me]=(0,Q.useState)(`idle`),he=(0,Q.useRef)(!1),ge=(0,Q.useRef)(null),_e=(0,Q.useRef)(null),ve=(0,Q.useRef)(null),ye=(0,Q.useRef)(null),{activeDocName:be,activeTarget:xe}=Oe(),{pages:Se,pageTitles:Ce,pageMeta:we,folderPaths:Te,filePaths:Ee,loading:De}=Eu(),Ae=Zc(),{states:je,refresh:Me}=qn(),{dispatch:Ne}=Tc(),Pe;t[6]===r?Pe=t[7]:(Pe={enabled:r},t[6]=r,t[7]=Pe);let{status:Fe,refresh:Le}=ad(Pe),Re=(Fe?.enabled??!1)&&(Fe?.keyPresent??!1),ze=Fe?.embedded??0,Be=Fe?.total??0,Ve=Re&&Be>0&&ze<Be,He;t[8]!==x||t[9]!==r||t[10]!==Le||t[11]!==Ve?(He=()=>{if(!r||!x||!Ve)return;let e=window.setInterval(()=>Le(),2500);return()=>window.clearInterval(e)},t[8]=x,t[9]=r,t[10]=Le,t[11]=Ve,t[12]=He):He=t[12];let Ue;t[13]!==x||t[14]!==r||t[15]!==Ve?(Ue=[r,x,Ve],t[13]=x,t[14]=r,t[15]=Ve,t[16]=Ue):Ue=t[16],(0,Q.useEffect)(He,Ue);let We=kc({docName:be,workspace:Ae}),Ge=Eb(Se,Te,Ce,we,Ee),Ke=vb(P,new Set(Ge.map(wS))),qe=a?.config.projectPath??null,Je=a?j.filter(e=>e.path!==qe):[],Ye=Kx(),Xe=a&&Ye?Ye.entries.filter(CS):[],Ze;t[17]!==be||t[18]!==xe?(Ze=mS(xe,be),t[17]=be,t[18]=xe,t[19]=Ze):Ze=t[19];let Qe=Ze,$e=d===``?[]:jb(Ge,d,8),et,tt;t[20]!==i||t[21]!==r?(et=()=>{let e=function(e){As(e,`command-palette`)&&(e.preventDefault(),!(!r&&rr())&&i(!r))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},tt=[i,r],t[20]=i,t[21]=r,t[22]=et,t[23]=tt):(et=t[22],tt=t[23]),(0,Q.useEffect)(et,tt);let rt,it;t[24]!==o||t[25]!==a||t[26]!==r||t[27]!==Me?(rt=()=>{if(r){if(F(hb()),Me(),a){let e=!1;return fS(async()=>{let t=await a.project.listRecent();e||M(t)},o({id:`fYKgzG`})),()=>{e=!0}}return}l(``),oe([]),ce(`idle`),he.current=!1,fe([]),me(`idle`),S(!1),ve.current?.abort(),ve.current=null,ye.current!==null&&(window.clearTimeout(ye.current),ye.current=null),T([]),D(null),k(`idle`)},it=[r,a,Me,o],t[24]=o,t[25]=a,t[26]=r,t[27]=Me,t[28]=rt,t[29]=it):(rt=t[28],it=t[29]),(0,Q.useEffect)(rt,it);let at;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(at=()=>{ge.current&&(ge.current.scrollTop=0)},t[30]=at):at=t[30];let ot;t[31]===c?ot=t[32]:(ot=[c],t[31]=c,t[32]=ot),(0,Q.useEffect)(at,ot);let st=new Set(ae.map(SS)),ct=x?{kind:`normal`,query:u}:Bb(u,st),lt=ct.kind!==`normal`,ut=lt||x,dt=ct.kind===`tag-list`?ct.query:``,ft=ct.kind===`tag-docs`?ct.tagName:``,pt=c.trim(),mt=x?Rb({query:pt,firedQuery:E,status:O,resultCount:w.length}):null,ht=mt?.submit?.query??``,gt=mt?.results.forQuery??``,_t,vt;t[33]!==lt||t[34]!==r?(_t=()=>{if(!r||!lt||he.current)return;he.current=!0,ce(`loading`);let e=!1;return Hb().then(t=>{e||(oe(t),ce(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tags failed`,t),oe([]),ce(`error`))}),()=>{e=!0}},vt=[r,lt],t[33]=lt,t[34]=r,t[35]=_t,t[36]=vt):(_t=t[35],vt=t[36]),(0,Q.useEffect)(_t,vt);let bt=ct.kind===`tag-docs`?ct.tagName:null;(0,Q.useEffect)(()=>{if(!r||bt===null){fe([]),me(`idle`);return}me(`loading`),fe([]);let e=!1;return Ub(bt).then(t=>{e||(fe(t),me(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tag docs failed`,t),fe([]),me(`error`))}),()=>{e=!0}},[r,bt]),(0,Q.useEffect)(()=>{if(!r||!d||ut||De){m([]),g(`idle`),v(!1),b(!1);return}let e=!1,t=!1,n=0,i=null,a,o;g(`loading`);let s=()=>e||n>=dS?!1:(n+=1,o=window.setTimeout(l,uS),!0),c=()=>{e||t&&s()||(m([]),g(`error`),v(!1),b(!1))};function l(){let n=new AbortController;i=n,a=window.setTimeout(()=>{n.abort(),c()},lS),Fb(d,{signal:n.signal}).then(n=>{let{entries:r,truncated:i,ready:o}=n;if(window.clearTimeout(a),!e){if(!o){t||(t=!0,m([]),v(!1),b(!0),g(`success`)),s()||b(!1);return}m(r),v(i),b(!1),g(`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,d,ut,De]);let St;t[37]!==o||t[38]!==i?(St=(e,t)=>{let n=t===void 0?o({id:`uuoHOU`}):t;i(!1),fS(async()=>{await e()},n)},t[37]=o,t[38]=i,t[39]=St):St=t[39];let Ct=St,wt;t[40]!==o||t[41]!==a?(wt=e=>{a&&fS(async()=>{await a.project.removeRecent(e),M(t=>t.filter(t=>t.path!==e))},o({id:`viwC-K`}))},t[40]=o,t[41]=a,t[42]=wt):wt=t[42];let Tt=wt,Et;t[43]!==o||t[44]!==a||t[45]!==Ct?(Et=e=>{if(!a)return;let t=e.worktreePath;if(t!==null){Ct(()=>a.project.open({path:t,target:`new-window`,entryPoint:`worktree`}),o({id:`LwMxXg`}));return}let n=e.branch;n!==null&&Ct(async()=>{let e=await a.worktree.create({branch:n,createBranch:!1});if(!e.ok)throw Error(e.reason);gm(),await a.project.open({path:e.path,target:`new-window`,entryPoint:`worktree`})},o({id:`LwMxXg`}))},t[43]=o,t[44]=a,t[45]=Ct,t[46]=Et):Et=t[46];let Dt=Et,Ot;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Ot=function(e){let t={kind:e.kind,path:e.path,lastOpenedAt:new Date().toISOString()},n=_b(hb(),t);gb(n),F(n)},t[47]=Ot):Ot=t[47];let At=Ot,jt;t[48]===i?jt=t[49]:(jt=function(e){i(!1),At(e),pS(e.path)},t[48]=i,t[49]=jt);let Pt=jt,Ft=!ut&&d===``&&Ke.length>0,It=yS({searchResults:p,fallbackSearchResults:$e,searchStatus:h}),Lt=!ut&&It.length>0,Rt=!ut&&d!==``&&(De||y)&&!Lt,zt=!ut&&d!==``&&h===`loading`&&!Lt&&!Rt,Bt=!ut&&a!==null&&Je.length>0&&(d===``||Je.some(e=>Ib(`${e.name} ${e.path}`,u,[`open recent project`]))),Vt=Xe.filter(e=>d===``||Ib(e.branch??``,u,[`worktree branch`])),Ht=!ut&&a!==null&&Vt.length>0,Ut=tn(),Wt=!ut&&!Ut&&We!==null&&(d===``||Wi.some(e=>{let t=e.displayName;return Ib(o({id:`WqLq6M`,values:{displayName:t}}),u,[e.id,`agent handoff`,`open in`])})),Gt=ct.kind===`tag-list`?Vb(ae,ct.query):[],Kt=ct.kind===`tag-list`&&se!==`loading`&&Gt.length===0,qt=ct.kind===`tag-docs`&&pe===`success`&&de.length===0,Jt=Ys(),Yt;t[50]===i?Yt=t[51]:(Yt=e=>{i(!1),zn(e)},t[50]=i,t[51]=Yt);let Xt=Yt,Zt;t[52]!==a||t[53]!==i?(Zt=e=>{i(!1),lm(e,a?{okDesktop:{shell:a.shell}}:{okDesktop:void 0})},t[52]=a,t[53]=i,t[54]=Zt):Zt=t[54];let Qt=Zt,$t;t[55]===i?$t=t[56]:($t=()=>i(!1),t[55]=i,t[56]=$t);let en;t[57]===L?en=t[58]:(en=e=>L(e),t[57]=L,t[58]=en);let nn;t[59]===z?nn=t[60]:(nn=()=>z(!0),t[59]=z,t[60]=nn);let rn;t[61]===V?rn=t[62]:(rn=()=>V(!0),t[61]=V,t[62]=rn);let an;t[63]===U?an=t[64]:(an=()=>U(!0),t[63]=U,t[64]=an);let sn;t[65]===ee?sn=t[66]:(sn=()=>{K(!0),ee(!0)},t[65]=ee,t[66]=sn);let cn;t[67]===te?cn=t[68]:(cn=()=>te(!0),t[67]=te,t[68]=cn);let ln;t[69]===J?ln=t[70]:(ln=()=>void J(`project`),t[69]=J,t[70]=ln);let un;t[71]===re?un=t[72]:(un=()=>re?.(),t[71]=re,t[72]=un);let dn={bridge:a,singleFile:s,activeDocName:be,contextualTargetKind:$y(xe),viewMenuState:Jt,emitMenuAction:Xt,runAction:Ct,openExternalUrl:Qt,closePalette:$t,openNewItemDialog:en,openSeedDialog:nn,openCreateProjectDialog:rn,openReportBugDialog:an,openBugReportHistory:sn,openFeedbackDialog:cn,createBlankSkill:ln,openBlobRun:un},fn=ut?[]:lb.flatMap(e=>{if(!e.available(dn)||e.visibility===`search-only`&&d===``)return[];let t=e.label(dn);return Ib(t,u,e.keywords)?[{cmd:e,label:t}]:[]}),pn=fn.length>0,mn;t[73]===o?mn=t[74]:(mn=e=>{switch(e){case`commands`:return o({id:`45MZFs`});case`project`:return o({id:`e0NrBM`});case`file`:return o({id:`J2eKUI`});case`view`:return o({id:`jpctdh`});case`terminal`:return o({id:`ALhMYW`});case`app`:return o({id:`IrC12v`})}},t[73]=o,t[74]=mn);let hn=mn,gn=e=>{let t=fn.filter(t=>t.cmd.group===e);return t.length===0?null:(0,Z.jsx)(nt,{heading:hn(e),children:t.map(e=>{let{cmd:t,label:n}=e,r=t.shortcutId!==void 0&&(t.shortcutDesktopOnly!==!0||a!==null)?xs(t.shortcutId):null;return(0,Z.jsxs)(xt,{value:`${n} ${t.keywords.join(` `)}`,onSelect:()=>t.dispatch(dn),"data-testid":`command-palette-${t.id}`,children:[(0,Z.jsx)(t.icon,{}),(0,Z.jsx)(`span`,{children:n}),t.checked?.(dn)?(0,Z.jsx)(zl,{className:`ml-auto text-muted-foreground`,"aria-hidden":`true`}):null,r?(0,Z.jsx)(Ie,{children:r}):null]},t.id)})},e)},_n=ut||Ft||Lt||zt||Rt||Bt||Wt||pn,vn;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(vn=function(e){l(`${zb}${e}`)},t[75]=vn):vn=t[75];let yn=vn,bn;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(bn=function(){ve.current?.abort(),ve.current=null,ye.current!==null&&(window.clearTimeout(ye.current),ye.current=null),T([]),D(null),k(`idle`)},t[76]=bn):bn=t[76];let xn=bn,Sn;t[77]===c?Sn=t[78]:(Sn=function(){S(!0),c.startsWith(`tag:`)&&l(c.slice(zb.length)),xn(),_e.current?.focus()},t[77]=c,t[78]=Sn);let Cn=Sn,wn;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(wn=function(){S(!1),l(``),xn(),_e.current?.focus()},t[79]=wn):wn=t[79];let Tn=wn,En=function(e){let t=e.trim();if(!t||De)return;ve.current?.abort(),ye.current!==null&&window.clearTimeout(ye.current);let n=new AbortController;ve.current=n,k(`loading`);let r=!1,i=window.setTimeout(()=>{r=!0,n.abort(),k(`error`)},lS);ye.current=i,Fb(t,{signal:n.signal,semantic:!0,limit:30}).then(e=>{let{entries:r}=e;Dn(i,n),T(r),D(t),k(`success`)}).catch(e=>{Dn(i,n),!(e instanceof Error&&e.name===`AbortError`&&!r)&&(console.debug(`[semantic-search] fire failed`,{timedOut:r,error:e}),k(`error`))})};function Dn(e,t){window.clearTimeout(e),ye.current===e&&(ye.current=null),ve.current===t&&(ve.current=null)}let On=function(e){!x||e.key!==`Enter`||(mt?.submit?(e.preventDefault(),e.stopPropagation(),En(mt.submit.query)):O===`loading`&&(e.preventDefault(),e.stopPropagation()))},kn;t[80]===x?kn=t[81]:(kn=function(e){x&&(e.preventDefault(),Tn())},t[80]=x,t[81]=kn);let An=kn,jn;t[82]===o?jn=t[83]:(jn=o({id:`1bDVu5`}),t[82]=o,t[83]=jn);let Mn;t[84]===o?Mn=t[85]:(Mn=o({id:`5GRxoA`}),t[84]=o,t[85]=Mn);let Nn;t[86]===Symbol.for(`react.memo_cache_sentinel`)?(Nn={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]=Nn):Nn=t[86];let Pn;t[87]!==o||t[88]!==x?(Pn=o(x?{id:`zXj1rA`}:{id:`ggs9f8`}),t[87]=o,t[88]=x,t[89]=Pn):Pn=t[89];let Fn;t[90]!==x||t[91]!==lt?(Fn=()=>{x&&(S(!1),xn()),l(lt?``:zb),_e.current?.focus()},t[90]=x,t[91]=lt,t[92]=Fn):Fn=t[92];let In=lt?`border-primary/30 bg-primary/10 text-primary`:`border-border bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`,Ln;t[93]===In?Ln=t[94]:(Ln=Bn(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors`,In),t[93]=In,t[94]=Ln);let Rn,Vn;t[95]===Symbol.for(`react.memo_cache_sentinel`)?(Rn=(0,Z.jsx)(yd,{className:`size-3.5`}),Vn=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`0rwwOn`})}),t[95]=Rn,t[96]=Vn):(Rn=t[95],Vn=t[96]);let Hn;t[97]!==lt||t[98]!==Fn||t[99]!==Ln?(Hn=(0,Z.jsxs)(`button`,{type:`button`,onClick:Fn,"data-testid":`command-palette-filter-tag`,"data-active":lt,"aria-pressed":lt,className:Ln,children:[Rn,Vn]}),t[97]=lt,t[98]=Fn,t[99]=Ln,t[100]=Hn):Hn=t[100];let Un;t[101]!==Cn||t[102]!==x||t[103]!==Re?(Un=Re?(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>x?Tn():Cn(),"data-testid":`command-palette-filter-semantic`,"data-active":x,"aria-pressed":x,className:Bn(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors`,x?`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)(ue,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`9tJX8r`})})]}):null,t[101]=Cn,t[102]=x,t[103]=Re,t[104]=Un):Un=t[104];let Wn;t[105]!==Hn||t[106]!==Un?(Wn=(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 border-b px-3 py-2`,children:[Hn,Un]}),t[105]=Hn,t[106]=Un,t[107]=Wn):Wn=t[107];let Gn;t[108]===Rt?Gn=t[109]:(Gn=Rt?(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)(xd,{"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(Y,{id:`yIPXut`})]}):null,t[108]=Rt,t[109]=Gn);let Kn;t[110]!==Lt||t[111]!==zt?(Kn=zt&&!Lt?(0,Z.jsx)(kt,{children:(0,Z.jsx)(Y,{id:`WRNXKp`})}):null,t[110]=Lt,t[111]=zt,t[112]=Kn):Kn=t[112];let Jn=gS,Yn=Lb(d,It,{truncated:_}),Xn;t[113]!==Jn||t[114]!==ut||t[115]!==ct.kind||t[116]!==Yn?(Xn=(0,Z.jsx)(Jn,{mode:Yn,inExclusiveMode:ut,paletteModeKind:ct.kind}),t[113]=Jn,t[114]=ut,t[115]=ct.kind,t[116]=Yn,t[117]=Xn):Xn=t[117];let Zn=I===`file`,Qn;t[118]===L?Qn=t[119]:(Qn=e=>{e||L(null)},t[118]=L,t[119]=Qn);let $n;t[120]!==Qe||t[121]!==Zn||t[122]!==Qn?($n=(0,Z.jsx)(nx,{open:Zn,onOpenChange:Qn,kind:`file`,initialDir:Qe}),t[120]=Qe,t[121]=Zn,t[122]=Qn,t[123]=$n):$n=t[123];let er=I===`folder`,tr;t[124]===L?tr=t[125]:(tr=e=>{e||L(null)},t[124]=L,t[125]=tr);let nr;t[126]!==Qe||t[127]!==er||t[128]!==tr?(nr=(0,Z.jsx)(nx,{open:er,onOpenChange:tr,kind:`folder`,initialDir:Qe}),t[126]=Qe,t[127]=er,t[128]=tr,t[129]=nr):nr=t[129];let ir;t[130]!==R||t[131]!==z?(ir=(0,Z.jsx)(jx,{open:R,onOpenChange:z}),t[130]=R,t[131]=z,t[132]=ir):ir=t[132];let ar;t[133]!==a||t[134]!==B||t[135]!==V?(ar=a?(0,Z.jsx)(Uy,{open:B,onOpenChange:V,bridge:a}):null,t[133]=a,t[134]=B,t[135]=V,t[136]=ar):ar=t[136];let X;t[137]!==a||t[138]!==H||t[139]!==U?(X=a?(0,Z.jsx)($_,{open:H,onOpenChange:U}):null,t[137]=a,t[138]=H,t[139]=U,t[140]=X):X=t[140];let or;t[141]!==a||t[142]!==G||t[143]!==W||t[144]!==ee||t[145]!==U?(or=a&&G?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(cS,{open:W,onOpenChange:ee,onReportABug:()=>{ee(!1),U(!0)}})}):null,t[141]=a,t[142]=G,t[143]=W,t[144]=ee,t[145]=U,t[146]=or):or=t[146];let sr;return t[147]!==q||t[148]!==te?(sr=(0,Z.jsx)(Gb,{open:q,onOpenChange:te,source:`command_palette`}),t[147]=q,t[148]=te,t[149]=sr):sr=t[149],(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(yt,{open:r,onOpenChange:i,title:jn,description:Mn,className:`sm:max-w-2xl`,commandProps:Nn,onEscapeKeyDown:An,children:[(0,Z.jsx)(ke,{ref:_e,value:c,onValueChange:l,onKeyDown:On,placeholder:Pn}),Wn,(0,Z.jsxs)(Nt,{ref:ge,className:`subtle-scrollbar`,children:[x&&mt?(0,Z.jsxs)(Z.Fragment,{children:[Ve?(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)(xd,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`kCNU4q`,values:{semanticIndexedCount:ze,semanticTotalCount:Be}})]}):null,mt.submit?(0,Z.jsx)(nt,{children:(0,Z.jsx)(xt,{value:`semantic-submit`,onSelect:()=>En(ht),"data-testid":`command-palette-semantic-submit`,children:mt.submit.kind===`retry`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ue,{}),(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)(Ie,{children:`↵`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ue,{}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,Z.jsx)(Y,{id:`FNTx6u`,values:{semanticSubmitQuery:ht}})}),(0,Z.jsx)(Ie,{children:`↵`})]})})}):null,mt.notice===`empty`?(0,Z.jsx)(kt,{"data-testid":`command-palette-semantic-empty`,children:(0,Z.jsx)(Y,{id:`l5J_HM`,components:{0:(0,Z.jsx)(ne,{"aria-label":o({id:`9Vnjc9`})})}})}):null,mt.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)(xd,{"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(Y,{id:`PBwmDJ`})]}):null,mt.notice===`no-results`?(0,Z.jsx)(kt,{"data-testid":`command-palette-semantic-no-results`,children:(0,Z.jsx)(Y,{id:`yFyZMJ`,values:{semanticQueryText:pt}})}):null,mt.results.show?(0,Z.jsx)(nt,{heading:mt.results.dimmed?o({id:`QlxHAH`,values:{semanticResultsLabel:gt}}):o({id:`9tJX8r`}),children:(0,Z.jsx)(`div`,{"data-testid":`command-palette-semantic-results`,"data-dimmed":mt.results.dimmed,children:w.map(e=>(0,Z.jsx)(hS,{entry:e,disabled:mt.results.dimmed,onSelect:()=>Pt(e)},mb(e.kind,e.path)))})}):null]}):null,Gn,Kn,_n?null:(0,Z.jsx)(kt,{children:h===`error`?(0,Z.jsx)(Y,{id:`pkAft1`}):(0,Z.jsx)(Y,{id:`i3f2kh`})}),ct.kind===`tag-list`?(0,Z.jsxs)(nt,{heading:ct.query?o({id:`evs0iw`,values:{tagListQuery:dt}}):o({id:`2QM24L`}),children:[se===`loading`?(0,Z.jsx)(kt,{children:(0,Z.jsx)(Y,{id:`a_u4ck`})}):null,se===`error`?(0,Z.jsx)(kt,{children:(0,Z.jsx)(Y,{id:`qTcZZu`,components:{0:(0,Z.jsx)(ne,{"aria-label":o({id:`69KLIV`})})}})}):null,Kt?(0,Z.jsx)(kt,{children:ct.query?o({id:`X0ttSN`,values:{tagListQuery:dt}}):o({id:`JLUTgi`})}):null,Gt.map(e=>(0,Z.jsxs)(xt,{value:`tag ${e.name}`,onSelect:()=>yn(e.name),"data-testid":`command-palette-tag-${e.name}`,children:[(0,Z.jsx)(yd,{}),(0,Z.jsx)(gl,{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,ct.kind===`tag-docs`?(0,Z.jsxs)(nt,{heading:o({id:`hGmuTc`,values:{tagDocsName:ft}}),children:[pe===`loading`?(0,Z.jsx)(kt,{children:(0,Z.jsx)(Y,{id:`pWbsW6`})}):null,pe===`error`?(0,Z.jsx)(kt,{children:(0,Z.jsx)(Y,{id:`z_4xza`,components:{0:(0,Z.jsx)(ne,{"aria-label":o({id:`69KLIV`})})}})}):null,qt?(0,Z.jsx)(kt,{children:o({id:`NIWAux`,values:{tagDocsName:ft}})}):null,de.map(e=>{let t=e.title||e.docName.split(`/`).pop()||e.docName,n=e.matchingTags.filter(e=>e!==ct.tagName).map(xS).join(`, `);return(0,Z.jsxs)(xt,{value:`tag-doc ${e.docName}`,onSelect:()=>{i(!1),pS(e.docName)},"data-testid":`command-palette-tag-doc-${e.docName}`,className:`items-start`,children:[(0,Z.jsx)(Rr,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(gl,{className:`truncate font-medium`,children:t}),(0,Z.jsx)(gl,{className:`truncate text-muted-foreground text-xs`,children:e.docName}),e.matchingTags.length>0&&e.matchingTags.some(e=>e!==ct.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,Ft?(0,Z.jsx)(nt,{heading:o({id:`MmDDWK`}),children:Ke.map(e=>(0,Z.jsx)(hS,{entry:e,onSelect:()=>Pt(e)},mb(e.kind,e.path)))}):null,gn(`commands`),Wt?(0,Z.jsx)(nt,{heading:o({id:`O7_W_a`}),children:Wi.filter(e=>{let t=e.displayName;return Ib(o({id:`WqLq6M`,values:{displayName:t}}),u,[e.id,`agent handoff`,`open in`])}).map(e=>{let t=je[e.id],n=t.installed===!0&&We!==null,r=e.displayName,a=t.installed===null?o({id:`IA6JW2`}):t.installed===!1?o({id:`5SwVv1`}):null,s=o(a?{id:`1ZpfyB`,values:{displayName:r,hint:a}}:{id:`WqLq6M`,values:{displayName:r}});return(0,Z.jsxs)(xt,{value:`send to ai ${e.displayName} ${e.id} agent open in`,disabled:!n,onSelect:()=>{!n||!We||(i(!1),Ne(e.id,We))},"data-testid":`command-palette-open-in-${e.id}`,"aria-label":s,children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`WqLq6M`,values:{displayName:r}})}),a?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-auto text-muted-foreground text-xs`,children:a}):null]},e.id)})}):null,gn(`project`),Bt&&a?(0,Z.jsx)(nt,{heading:o({id:`3iyGWF`}),children:Je.filter(e=>Ib(`${e.name} ${e.path}`,u,[`open recent project`])).slice(0,10).map(e=>{let t=e.isLinkedWorktree===!0,n=t?$c:gd,r=t&&e.mainRoot!==void 0?iS(e.mainRoot):null;return(0,Z.jsx)(sS,{path:e.path,onRemoveRecent:Tt,testIdPrefix:`command-palette-recent`,children:(0,Z.jsxs)(`div`,{className:`group/recent relative flex items-center`,children:[(0,Z.jsxs)(xt,{value:`${e.name} ${e.path} recent project`,onSelect:()=>Ct(()=>a.project.open({path:e.path,target:`new-window`,entryPoint:`recents`}),o({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)(gl,{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)(gl,{className:`truncate text-muted-foreground text-xs`,children:e.path})]})]}),(0,Z.jsx)(oS,{path:e.path,name:e.name,onRemoveRecent:Tt,testIdPrefix:`command-palette-recent`})]})},e.path)})}):null,Ht&&a?(0,Z.jsx)(nt,{heading:o({id:`sxjyRq`}),children:Vt.slice(0,10).map(e=>(0,Z.jsxs)(xt,{value:`${e.branch} worktree branch`,onSelect:()=>Dt(e),"data-testid":`command-palette-worktree-${e.branch}`,className:`items-start`,children:[(0,Z.jsx)($c,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(gl,{className:`truncate font-medium`,children:e.branch}),e.worktreePath===null?(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:o({id:`iO8V-7`})}):(0,Z.jsx)(gl,{className:`truncate text-muted-foreground text-xs`,children:e.worktreePath})]})]},e.branch))}):null,[`file`,`view`,`terminal`,`app`].map(e=>gn(e)),Lt?(0,Z.jsx)(nt,{heading:o({id:`A1taO8`}),children:It.map(e=>(0,Z.jsx)(hS,{entry:e,query:d,onSelect:()=>Pt(e)},mb(e.kind,e.path)))}):null]}),Xn]}),$n,nr,ir,ar,X,or,sr]})}function xS(e){return`#${e}`}function SS(e){return e.name}function CS(e){return e.branch!==null&&!e.isCurrent}function wS(e){return mb(e.kind,e.path)}function TS(e){return e===`eperm`?Ms._({id:`XuQzrk`}):Ms._({id:`BUyQnq`})}async function ES(e){let t=await e.restartServer(e.config.projectPath);return t.ok?{ok:!0}:{ok:!1,message:TS(t.reason)}}var DS=500;function OS(e,t,n){return t?`terminal`:e===null&&n?`retrying`:`hidden`}function kS(e){return e?.kind===`null-collab`}function AS(e){if(e===null)return Ms._({id:`Ua78MH`});if(e.kind===`null-collab`)return Ms._({id:`TJnkyf`});if(e.code===`network`)return Ms._({id:`aoa6xA`});if(e.code===`invalid-body`)return Ms._({id:`FRYB1Q`});let t=e.code;return Ms._({id:`4nj6n8`,values:{code:t}})}function jS(){let e=(0,$.c)(31),t=Mt(),{collabUrl:n,collabTerminal:r,collabLastError:i,retryCollab:a}=Oe(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=typeof window<`u`?window.okDesktop:void 0,p,m;e[0]!==r||e[1]!==n?(p=()=>{if(n!==null||r){s(!1);return}let e=setTimeout(()=>s(!0),DS);return()=>clearTimeout(e)},m=[n,r],e[0]=r,e[1]=n,e[2]=p,e[3]=m):(p=e[2],m=e[3]),(0,Q.useEffect)(p,m);let h=OS(n,r,o);if(h===`hidden`)return null;if(h===`terminal`){let n;e[4]===i?n=e[5]:(n=kS(i),e[4]=i,e[5]=n);let r=n,o;e[6]===i?o=e[7]:(o=AS(i),e[6]=i,e[7]=o);let s=o,p;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(p=async()=>{if(f){d(null),l(!0);try{let e=await ES(f);e.ok||(d(e.message),l(!1))}catch{l(!1)}}},e[8]=p):p=e[8];let m=p,h;e[9]!==s||e[10]!==r?(h=(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[9]=s,e[10]=r,e[11]=h):h=e[11];let g;e[12]===a?g=e[13]:(g=()=>{d(null),a()},e[12]=a,e[13]=g);let _;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(Y,{id:`6gRgw8`}),e[14]=_):_=e[14];let v;e[15]!==c||e[16]!==g?(v=(0,Z.jsx)(`button`,{type:`button`,onClick:g,disabled:c,className:`bg-red-950 text-red-50 px-2 py-0.5 rounded text-xs font-medium hover:bg-red-900 disabled:opacity-60`,children:_}),e[15]=c,e[16]=g,e[17]=v):v=e[17];let y;e[18]===c?y=e[19]:(y=f?(0,Z.jsx)(`button`,{type:`button`,onClick:m,disabled:c,className:`bg-red-950 text-red-50 px-2 py-0.5 rounded text-xs font-medium hover:bg-red-900 disabled:opacity-60`,children:c?(0,Z.jsx)(Y,{id:`0Er6-M`}):(0,Z.jsx)(Y,{id:`uaUc6t`})}):null,e[18]=c,e[19]=y);let b;e[20]===t?b=e[21]:(b=t?(0,Z.jsx)(`button`,{type:`button`,onClick:t,"aria-label":Ms._({id:`MsARMw`}),title:Ms._({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)(nr,{size:22,trackMouse:!1,variant:`sleeping`})}):null,e[20]=t,e[21]=b);let x;e[22]===u?x=e[23]:(x=u===null?null:(0,Z.jsx)(`span`,{className:`w-full text-red-950 text-xs`,children:u}),e[22]=u,e[23]=x);let S;return e[24]!==b||e[25]!==x||e[26]!==h||e[27]!==v||e[28]!==y?(S=(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:[h,v,y,b,x]}),e[24]=b,e[25]=x,e[26]=h,e[27]=v,e[28]=y,e[29]=S):S=e[29],S}let g;return e[30]===Symbol.for(`react.memo_cache_sentinel`)?(g=(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[30]=g):g=e[30],g}function MS(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=()=>Fn(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)(Uy,{open:r,onOpenChange:i,bridge:n}),t[2]=n,t[3]=r,t[4]=s):s=t[4],s}var NS=`ok-acp-desktop-migration-v1`,PS=[`ok-preferred-agent-v1`,`ok-ask-ai-agent-v2`,`ok-ask-ai-default-agent-v1`];function FS(e){try{return localStorage.getItem(e)}catch{return null}}function IS(){try{localStorage.setItem(NS,`1`)}catch{}}function LS(){return PS.some(e=>FS(e)!==null)}function RS(e){return Wi.every(t=>e[t.id]?.installed!=null)?Wi.filter(t=>e[t.id]?.installed===!0).map(e=>e.id):null}function zS(e){let t=(0,$.c)(3),n,r;t[0]===e?(n=t[1],r=t[2]):(n=()=>{if(FS(NS)!==null)return;if(!LS()){IS();return}let t=RS(e);if(t!==null){for(let e of t)Ji(Vi(e),!0);IS()}},r=[e],t[0]=e,t[1]=n,t[2]=r),(0,Q.useEffect)(n,r)}function BS(){let{states:e}=qn();return zS(e),null}function VS(e,t){e.chain().focus().insertContent({type:`text`,text:t}).run()}function HS(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 US(){let e=(0,$.c)(29),{_:t}=on(),[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=HS(t.editor);n&&r({editor:t.editor,...n})};return document.addEventListener(x,e),()=>document.removeEventListener(x,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=HS(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)(Nn,{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)(vl,{onSelect:e=>{let t=n.editor;r(null),VS(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)(jn,{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)(Ln,{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 WS(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(Sc(e)??Ms._({id:`lHwYMr`,values:{status:n,statusText:r}}))}return(await t.json()).docs??[]}function GS(){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`}),WS(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(p,e),()=>document.removeEventListener(p,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(Cf(e))},e[3]=d):d=e[3];let f=d,m=r??``,h;e[4]===m?h=e[5]:(h={tagName:m},e[4]=m,e[5]=h);let g;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(g={0:(0,Z.jsx)(`span`,{className:`font-mono break-all`})},e[6]=g):g=e[6];let _;e[7]===h?_=e[8]:(_=(0,Z.jsx)(yr,{children:(0,Z.jsx)(hr,{children:(0,Z.jsx)(Y,{id:`7H4UHD`,values:h,components:g})})}),e[7]=h,e[8]=_);let v=r??``,y;e[9]!==o||e[10]!==v?(y=(0,Z.jsx)(_r,{children:(0,Z.jsx)(KS,{fetchState:o,tag:v,onSelectDoc:f})}),e[9]=o,e[10]=v,e[11]=y):y=e[11];let b;e[12]!==_||e[13]!==y?(b=(0,Z.jsxs)(gr,{children:[_,y]}),e[12]=_,e[13]=y,e[14]=b):b=e[14];let x;return e[15]!==t||e[16]!==b?(x=(0,Z.jsx)(br,{open:t,onOpenChange:n,children:b}),e[15]=t,e[16]=b,e[17]=x):x=e[17],x}function KS(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(qS)}):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 qS(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 JS=`raw-mdx-nav`,YS=`ok-editor-mode-v1`,XS=[`wysiwyg`,`source`],ZS=`wysiwyg`;function QS(e){return XS.includes(e)}function $S(e=localStorage){try{let t=e.getItem(YS);if(t===null)return ZS;if(QS(t))return t;console.warn(`[editor-mode] invalid persisted value, falling back to default`,{raw:t})}catch{}return ZS}function eC(e=window,t=localStorage){let n=e.__OK_EDITOR_MODE__;return QS(n)?n:$S(t)}function tC(e,t=localStorage){try{return t.setItem(YS,e),!0}catch(e){return console.warn(`[editor-mode] persist failed`,e),!1}}function nC(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(eC),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=function(e){n(e),tC(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 rC(e){let t=(0,$.c)(4),{_:n}=on(),r=(0,Q.useRef)(!1),i,a;t[0]!==n||t[1]!==e?(i=()=>{e===`no-push-permission`&&!r.current&&(r.current=!0,Ns.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 iC(e,t){return e===`follow`?(0,Z.jsx)(Y,{id:`Sxx_Zz`,values:{project:t}}):e===`full`?(0,Z.jsx)(Y,{id:`4zEZS5`,values:{project:t}}):(0,Z.jsx)(Y,{id:`AaaESH`,values:{project:t}})}function aC(){let e=(0,$.c)(8),{projectLocalConfig:t,projectLocalSynced:n,projectLocalBinding:r}=xc(),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:``;Ns(iC(po({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 oC=`ok-terminal-placement-v1`;function sC(e){try{return to((e??localStorage).getItem(oC))}catch{return da}}function cC(e,t){try{(t??localStorage).setItem(oC,e)}catch{}}var lC=`ok-terminal-right-width-v1`;function uC(e){try{let t=(e??localStorage).getItem(lC);if(t===null||t.trim()===``)return mo;let n=Number(t);return Number.isFinite(n)?Ba(n):mo}catch{return mo}}function dC(e,t){try{(t??localStorage).setItem(lC,String(Ba(e)))}catch{}}function fC(e){let t=(0,$.c)(36),{open:n,variant:r,onResolved:i}=e,{_:a}=on(),o=el(),s;t[0]!==a||t[1]!==i||t[2]!==r||t[3]!==o?(s=function(e){if(o===null){Ns.error(a({id:`fiMNLl`}));return}let t=o(e?r===`follow`?`follow`:`full`:`off`);if(!t.ok){let n=t.error;Ns.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)(yr,{children:(0,Z.jsx)(rl,{variant:r})}),t[5]=r,t[6]=l);let u;t[7]===r?u=t[8]:(u=(0,Z.jsx)(al,{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)(_r,{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:`U4nTfu`}):(0,Z.jsx)(Y,{id:`XU0OXn`}),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)(vr,{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)(gr,{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)(br,{open:n,onOpenChange:pC,children:S}),t[33]=n,t[34]=S,t[35]=C):C=t[35],C}function pC(){}function mC(e){if(!(!e.autoSyncOnboardingDismissed&&e.hasRemote===!0&&e.projectLocalSynced===!0&&e.projectSynced===!0&&e.projectLocalConfig!==null&&po(e.projectLocalConfig.autoSync??void 0)===null&&wo(e.projectConfig?.autoSync?.default)===null))return null;switch(e.pushPermissionCheckStatus){case`allowed`:return`full`;case`denied`:return`follow`;default:return null}}function hC(e){let t=(0,$.c)(57),{primary:n,onPrimary:r,primaryDisabled:i,installedTargets: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}=on(),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)(Vl,{"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)(hi,{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)(Si,{}):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)(pi,{"aria-label":b({id:`vPKX2i`}),children:[(0,Z.jsxs)(_i,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(Y,{id:`RXEbZy`}),(0,Z.jsx)(Ui,{})]}),c?.map(e=>(0,Z.jsxs)(li,{onSelect:e.onSelect,"data-testid":_.threadAgent?.(e.key),children:[(0,Z.jsx)(pl,{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)(zl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.key))]}),w?(0,Z.jsx)(Si,{}):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]!==w||t[24]!==a||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)(pi,{"aria-label":b({id:`ALhMYW`}),children:[(0,Z.jsx)(_i,{children:(0,Z.jsx)(Y,{id:`ALhMYW`})}),S?S.map(e=>(0,Z.jsxs)(li,{onSelect:e.onSelect,"data-testid":D(e.cli),"aria-label":e.ariaLabel,children:[(0,Z.jsx)(qi,{id:Gi(e.cli),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.label}),e.selected?(0,Z.jsx)(zl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.cli)):u?(0,Z.jsxs)(li,{onSelect:u.onSelect,"data-testid":D(`claude`),"aria-label":b({id:`AcK_r0`}),children:[(0,Z.jsx)(qi,{id:Gi(`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)(zl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]}):null]}):null,x?(0,Z.jsxs)(Z.Fragment,{children:[C?(0,Z.jsx)(Si,{}):null,(0,Z.jsxs)(pi,{"aria-label":b({id:`BBqGS9`}),children:[(0,Z.jsx)(_i,{children:(0,Z.jsx)(Y,{id:`BBqGS9`})}),a.map(e=>(0,Z.jsxs)(li,{onSelect:()=>s(e),"data-testid":_.option(e.id),children:[(0,Z.jsx)(qi,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),o===e.id?(0,Z.jsx)(zl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null]}):null,t[21]=b,t[22]=S,t[23]=w,t[24]=a,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)(Si,{}):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)(Rn,{"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)(li,{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)(yi,{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)(xi,{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)(uf,{children:[O,B]}),t[54]=B,t[55]=O,t[56]=V):V=t[56],V}function gC(e){let t=(0,$.c)(9),{onStartNewChat:n}=e,{_:r}=on(),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)(Mn,{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)(li,{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)(pi,{"aria-label":i,children:s}),t[6]=i,t[7]=s,t[8]=c):c=t[8],c}function _C(){let e=(0,$.c)(12),t=Hi(),n=Li(),r=Yi(),i,a;if(e[0]!==r||e[1]!==t||e[2]!==n){let o;e[5]===t?o=e[6]:(o=e=>Ki(t,e.source,e.id,!0,e.supported),e[5]=t,e[6]=o);let s=n.filter(o),c=Ri(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:()=>{Xi(e),Xs($s)}})),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 vC(e){let t=(0,$.c)(68),{threadIds:n,selectableIds:r,testIdPrefix:i}=e,{_:a}=on(),o=_C(),s=Oy(),c=qs(),l=c?.kind===`thread`?c:null,u=jy(),d;t[0]!==l||t[1]!==o.threadAgent?.iconUrl||t[2]!==o.threadAgent?.id?(d=l===null?(0,Z.jsx)(pl,{agentId:o.threadAgent?.id??``,iconUrl:o.threadAgent?.iconUrl,className:`size-4`}):(0,Z.jsx)(pl,{agentId:l.agentId,iconUrl:l.iconUrl,className:`size-4`}),t[0]=l,t[1]=o.threadAgent?.iconUrl,t[2]=o.threadAgent?.id,t[3]=d):d=t[3];let f=d,p=r.length>0&&n.length===r.length,m;t[4]!==p||t[5]!==r?(m=()=>Ye(r,!p),t[4]=p,t[5]=r,t[6]=m):m=t[6];let h;t[7]!==a||t[8]!==p?(h=a(p?{id:`Ns5f4J`}:{id:`8oWgty`}),t[7]=a,t[8]=p,t[9]=h):h=t[9];let g;t[10]!==p||t[11]!==m||t[12]!==h?(g=(0,Z.jsx)(Hr,{checked:p,onCheckedChange:m,"aria-label":h}),t[10]=p,t[11]=m,t[12]=h,t[13]=g):g=t[13];let _;t[14]!==r.length||t[15]!==n.length?(_=(0,Z.jsxs)(`span`,{className:`truncate tabular-nums`,children:[n.length,`/`,r.length]}),t[14]=r.length,t[15]=n.length,t[16]=_):_=t[16];let v;t[17]!==g||t[18]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[g,_]}),t[17]=g,t[18]=_,t[19]=v):v=t[19];let y;t[20]===a?y=t[21]:(y=a({id:`LaskKp`,values:{0:Ss(`send-comment-queue`)}}),t[20]=a,t[21]=y);let b;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(b=xs(`send-comment-queue`),t[22]=b):b=t[22];let x;t[23]===y?x=t[24]:(x=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 font-mono text-[13px] text-muted-foreground`,title:y,children:b}),t[23]=y,t[24]=x);let S;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[25]=S):S=t[25];let C;t[26]===l?C=t[27]:(C=(0,Z.jsx)(`span`,{className:`truncate`,children:l===null?(0,Z.jsx)(Y,{id:`vPF04k`}):(0,Z.jsx)(Y,{id:`sKEgGd`})}),t[26]=l,t[27]=C);let w;t[28]!==f||t[29]!==C?(w=(0,Z.jsxs)(Z.Fragment,{children:[f,C]}),t[28]=f,t[29]=C,t[30]=w):w=t[30];let T;t[31]!==u||t[32]!==n?(T=()=>u(n),t[31]=u,t[32]=n,t[33]=T):T=t[33];let E=n.length===0,D;t[34]!==s||t[35]!==l||t[36]!==n?(D=l===null?void 0:(0,Z.jsx)(gC,{onStartNewChat:()=>void He({compose:s,threadIds:n})}),t[34]=s,t[35]=l,t[36]=n,t[37]=D):D=t[37];let O;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(O=(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[38]=O):O=t[38];let k;t[39]===a?k=t[40]:(k=a({id:`nbLQ_9`}),t[39]=a,t[40]=k);let A=`${i}-send`,j=`${i}-send-trigger`,M=`${i}-send-menu`,N,P;t[41]===i?(N=t[42],P=t[43]):(N=e=>`${i}-agent-option-${e}`,P=e=>`${i}-agent-option-thread-${e}`,t[41]=i,t[42]=N,t[43]=P);let F=`${i}-agent-option-settings`,I;t[44]===i?I=t[45]:(I=e=>`${i}-agent-option-terminal-${e}`,t[44]=i,t[45]=I);let L;t[46]!==A||t[47]!==j||t[48]!==M||t[49]!==N||t[50]!==P||t[51]!==F||t[52]!==I?(L={primary:A,trigger:j,menu:M,option:N,threadAgent:P,settings:F,terminal:I},t[46]=A,t[47]=j,t[48]=M,t[49]=N,t[50]=P,t[51]=F,t[52]=I,t[53]=L):L=t[53];let R;t[54]!==o.rows||t[55]!==w||t[56]!==T||t[57]!==E||t[58]!==D||t[59]!==k||t[60]!==L?(R=(0,Z.jsx)(hC,{installedTargets:S,selectedTargetId:null,onSelectTarget:yC,primary:w,onPrimary:T,primaryDisabled:E,menuLeading:D,onOpenSettings:Cs,menuEmptyState:O,triggerAriaLabel:k,testIds:L,...o.rows}),t[54]=o.rows,t[55]=w,t[56]=T,t[57]=E,t[58]=D,t[59]=k,t[60]=L,t[61]=R):R=t[61];let z;t[62]!==R||t[63]!==x?(z=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[x,R]}),t[62]=R,t[63]=x,t[64]=z):z=t[64];let B;return t[65]!==z||t[66]!==v?(B=(0,Z.jsxs)(Am,{className:`justify-between`,children:[v,z]}),t[65]=z,t[66]=v,t[67]=B):B=t[67],B}function yC(){}function bC(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 xC(e,t){let n=Math.max(1,Math.floor((t-e)/1e3));if(n<60)return Ms._({id:`Qpfxa1`,values:{secs:n}});let r=Math.floor(n/60);if(r<60)return Ms._({id:`4uaCUA`,values:{mins:r}});let i=Math.floor(r/60);if(i<24)return Ms._({id:`_oqig9`,values:{hours:i}});let a=Math.floor(i/24);return a<7?Ms._({id:`XWEqQj`,values:{days:a}}):new Date(e).toLocaleDateString()}function SC(e){let t=(0,$.c)(97),{thread:n,now:r,cardRef:i,focused:o,sending:s,onClose:c}=e,{_:l}=on(),[u,d]=(0,Q.useState)(n.body),[f,p]=(0,Q.useState)(!1),m=(0,Q.useRef)(null),h=n.status===`orphaned`,g=n.status===`resolved`,_,v;t[0]===f?(_=t[1],v=t[2]):(_=()=>{if(!f)return;let e=m.current;if(e===null)return;e.focus();let t=e.value.length;e.setSelectionRange(t,t)},v=[f],t[0]=f,t[1]=_,t[2]=v),(0,Q.useEffect)(_,v);let y;t[3]===n?y=t[4]:(y=function(e){if(n.anchor===null)return;if(Ee(n.docName)===null){Id(n);return}if(n.target.kind===`property`){wd({key:n.target.key,path:n.target.path,quote:e,start:n.anchor.start,end:n.anchor.end});return}let t=Ee(n.docName);if(!t)return;let r=jd(t.state.doc,e,n.anchor);r&&(t.chain().focus().setTextSelection(r).run(),Od(t,r))},t[3]=n,t[4]=y);let b=y,x;t[5]===n.body?x=t[6]:(x=function(){d(n.body),p(!1)},t[5]=n.body,t[6]=x);let S=x,C;t[7]!==u||t[8]!==n.body||t[9]!==n.id?(C=function(){let e=u.trim();if(e.length===0||e===n.body){p(!1);return}Rt(n.id,e),p(!1)},t[7]=u,t[8]=n.body,t[9]=n.id,t[10]=C):C=t[10];let w=C,T;t[11]!==n.docName||t[12]!==n.id?(T=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&&wt(n.id,a,Ld(e.state.doc,t,r))},t[11]=n.docName,t[12]=n.id,t[13]=T):T=t[13];let E=T,D,O,k,A;t[14]===n.id?(D=t[15],O=t[16],k=t[17],A=t[18]):(O=()=>$e(n.id),k=()=>ve(n.id),A=()=>$e(n.id),D=()=>ve(n.id),t[14]=n.id,t[15]=D,t[16]=O,t[17]=k,t[18]=A);let j=g&&`opacity-70`,M=h&&`border-amber-500/40 bg-amber-500/5`,N=o&&`ring-2 ring-primary`,P;t[19]!==j||t[20]!==M||t[21]!==N?(P=Bn(`flex flex-col gap-1.5 rounded-lg border p-2.5 transition-shadow`,j,M,N),t[19]=j,t[20]=M,t[21]=N,t[22]=P):P=t[22];let F;t[23]!==l||t[24]!==g||t[25]!==s||t[26]!==n.id?(F=!g&&(0,Z.jsx)(Hr,{checked:s,onCheckedChange:()=>qt(n.id),"aria-label":l(s?{id:`1jym2J`}:{id:`t7YoBO`})}),t[23]=l,t[24]=g,t[25]=s,t[26]=n.id,t[27]=F):F=t[27];let I;t[28]!==r||t[29]!==n.createdAt?(I=xC(n.createdAt,r),t[28]=r,t[29]=n.createdAt,t[30]=I):I=t[30];let L;t[31]===I?L=t[32]:(L=(0,Z.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground`,children:I}),t[31]=I,t[32]=L);let R;t[33]!==F||t[34]!==L?(R=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[F,L]}),t[33]=F,t[34]=L,t[35]=R):R=t[35];let z;t[36]===g?z=t[37]:(z=g&&(0,Z.jsxs)(Mp,{variant:`outline`,className:`gap-1 border-green-600/40 text-green-700 dark:text-green-500`,children:[(0,Z.jsx)(zl,{className:`size-2.5`}),(0,Z.jsx)(Y,{id:`O6H89R`})]}),t[36]=g,t[37]=z);let B;t[38]===h?B=t[39]:(B=h&&(0,Z.jsxs)(Mp,{variant:`outline`,className:`gap-1 border-amber-500/50 text-amber-600 dark:text-amber-500`,children:[(0,Z.jsx)(Ed,{className:`size-2.5`}),(0,Z.jsx)(Y,{id:`UEdTEN`})]}),t[38]=h,t[39]=B);let V;t[40]!==l||t[41]!==f||t[42]!==g||t[43]!==n.body?(V=!g&&(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,"aria-label":l({id:`akmOT9`}),title:l({id:`akmOT9`}),"aria-expanded":f,className:Bn(`size-6 p-0`,f?`text-foreground`:`text-muted-foreground hover:text-foreground`),onClick:()=>{d(n.body),p(CC)},children:(0,Z.jsx)(it,{className:`size-3.5`})}),t[40]=l,t[41]=f,t[42]=g,t[43]=n.body,t[44]=V):V=t[44];let H;t[45]===l?H=t[46]:(H=l({id:`X2zUS5`}),t[45]=l,t[46]=H);let U;t[47]===l?U=t[48]:(U=l({id:`X2zUS5`}),t[47]=l,t[48]=U);let W;t[49]===n.id?W=t[50]:(W=()=>a(n.id),t[49]=n.id,t[50]=W);let ee;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(ff,{className:`size-3.5`}),t[51]=ee):ee=t[51];let G;t[52]!==H||t[53]!==U||t[54]!==W?(G=(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,className:`size-6 p-0 text-muted-foreground hover:text-destructive`,"aria-label":H,title:U,onClick:W,children:ee}),t[52]=H,t[53]=U,t[54]=W,t[55]=G):G=t[55];let K;t[56]!==l||t[57]!==c?(K=c&&(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,className:`-mr-1 size-6 p-0 text-muted-foreground hover:text-foreground`,"aria-label":l({id:`yz7wBu`}),onClick:c,children:(0,Z.jsx)(hf,{className:`size-3.5`})}),t[56]=l,t[57]=c,t[58]=K):K=t[58];let q;t[59]!==z||t[60]!==B||t[61]!==V||t[62]!==G||t[63]!==K?(q=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[z,B,V,G,K]}),t[59]=z,t[60]=B,t[61]=V,t[62]=G,t[63]=K,t[64]=q):q=t[64];let te;t[65]!==R||t[66]!==q?(te=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[R,q]}),t[65]=R,t[66]=q,t[67]=te):te=t[67];let J;t[68]!==l||t[69]!==h||t[70]!==b||t[71]!==n.anchor||t[72]!==n.target?(J=h?(0,Z.jsx)(`p`,{className:`rounded border-l-2 border-amber-500/60 bg-amber-500/10 px-2 py-1 text-xs text-amber-700 dark:text-amber-400`,children:(0,Z.jsx)(Y,{id:`nG-XA9`})}):(0,Z.jsx)(X,{type:`button`,variant:`ghost`,disabled:n.anchor===null,onClick:()=>b(n.anchor?.quote??``),title:n.anchor===null?l({id:`aoT2xX`}):n.target.kind===`property`?l({id:`5GBQ-F`}):l({id:`DpjYd6`}),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:[Td(n.target.key,n.target.path),`:`,n.anchor===null?``:` “${n.anchor.quote}”`]}):(0,Z.jsxs)(Z.Fragment,{children:[`“`,n.anchor?.quote??``,`”`]})})}),t[68]=l,t[69]=h,t[70]=b,t[71]=n.anchor,t[72]=n.target,t[73]=J):J=t[73];let ne;t[74]===n.body?ne=t[75]:(ne=(0,Z.jsx)(`p`,{className:`text-sm text-foreground/90`,children:n.body}),t[74]=n.body,t[75]=ne);let re;t[76]!==l||t[77]!==S||t[78]!==u||t[79]!==f||t[80]!==h||t[81]!==g||t[82]!==E||t[83]!==w||t[84]!==n.id?(re=h?(0,Z.jsxs)(X,{size:`sm`,variant:`outline`,className:`min-w-0`,onClick:E,children:[(0,Z.jsx)(Sd,{className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:(0,Z.jsx)(Y,{id:`QlkiD5`})})]}):(0,Z.jsxs)(Z.Fragment,{children:[f&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(Pm,{ref:m,rows:1,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{if(e.key===`Escape`){S();return}e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),w())},placeholder:l({id:`akmOT9`}),className:`min-h-0 resize-none px-2 py-1 text-sm leading-5`}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,onClick:S,children:(0,Z.jsx)(Y,{id:`dEgA5A`})}),(0,Z.jsx)(X,{size:`sm`,onClick:w,disabled:u.trim().length===0,"aria-label":l({id:`3W5kYZ`}),children:(0,Z.jsx)(Y,{id:`tfDRzk`})})]})]}),g&&(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:()=>Ke(n.id),children:[(0,Z.jsx)(Mi,{className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:(0,Z.jsx)(Y,{id:`M7SqjM`})})]})})]}),t[76]=l,t[77]=S,t[78]=u,t[79]=f,t[80]=h,t[81]=g,t[82]=E,t[83]=w,t[84]=n.id,t[85]=re):re=t[85];let ie;return t[86]!==i||t[87]!==D||t[88]!==P||t[89]!==te||t[90]!==J||t[91]!==ne||t[92]!==re||t[93]!==O||t[94]!==k||t[95]!==A?(ie=(0,Z.jsxs)(`article`,{ref:i,onPointerEnter:O,onPointerLeave:k,onFocusCapture:A,onBlurCapture:D,className:P,children:[te,J,ne,re]}),t[86]=i,t[87]=D,t[88]=P,t[89]=te,t[90]=J,t[91]=ne,t[92]=re,t[93]=O,t[94]=k,t[95]=A,t[96]=ie):ie=t[96],ie}function CC(e){return!e}function wC(e){let t=(0,$.c)(27),{threads:n,groupByDocument:r,empty:i,testIdPrefix:a}=e,o=r===void 0?!1:r,{_:s}=on(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=new Map,t[0]=f):f=t[0];let p=(0,Q.useRef)(f),[m]=(0,Q.useState)(MC),[h,g]=(0,Q.useState)(jC),_=W(),v;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(v=function(e,t){g(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r})},t[1]=v):v=t[1];let y=v,b=(0,Q.useRef)(null),x,S;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>{let e=Pe(e=>{d(e),p.current.get(e)?.scrollIntoView({block:`center`,behavior:`smooth`}),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>{b.current=null,d(t=>t===e?null:t)},1600)});return()=>{e(),b.current!==null&&window.clearTimeout(b.current)}},S=[],t[2]=x,t[3]=S):(x=t[2],S=t[3]),(0,Q.useEffect)(x,S);let C;if(t[4]!==s||t[5]!==h||t[6]!==i||t[7]!==u||t[8]!==o||t[9]!==m||t[10]!==_||t[11]!==c||t[12]!==a||t[13]!==n){let e=n.filter(AC),r;t[15]===n?r=t[16]:(r=n.filter(kC),t[15]=n,t[16]=r);let d=r,f=c?n:e,v=o?bC(f):[],b=v.length>0&&v.every(e=>h.has(e.docName)),x;t[17]===_?x=t[18]:(x=e=>_.includes(e.id),t[17]=_,t[18]=x);let S=e.filter(x).map(OC),w=function(e){return(0,Z.jsx)(SC,{thread:e,now:m,sending:_.includes(e.id),focused:u===e.id,cardRef:t=>{t?p.current.set(e.id,t):p.current.delete(e.id)}},e.id)},T;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Dm,{children:(0,Z.jsx)(Y,{id:`VbyRUy`})}),t[19]=T):T=t[19];let E;t[20]!==s||t[21]!==d.length||t[22]!==c||t[23]!==a?(E=d.length>0&&(0,Z.jsxs)(ur,{children:[(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(X,{size:`icon`,variant:`ghost`,className:`size-6 shrink-0 text-muted-foreground`,"aria-label":s(c?{id:`G1zJlD`}:{id:`_YEyHO`}),"aria-pressed":c,"data-testid":`${a}-resolved-toggle`,onClick:()=>l(DC),children:c?(0,Z.jsx)(yv,{"aria-hidden":`true`,className:`size-3.5`}):(0,Z.jsx)(zl,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsx)(cr,{children:c?(0,Z.jsx)(Y,{id:`LRLKnQ`}):(0,Z.jsx)(Y,{id:`j0ItfO`,values:{0:d.length}})})]}),t[20]=s,t[21]=d.length,t[22]=c,t[23]=a,t[24]=E):E=t[24];let D=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[E,v.length>1&&(0,Z.jsxs)(ur,{children:[(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(X,{size:`icon`,variant:`ghost`,className:`size-6 shrink-0 text-muted-foreground`,"aria-label":s(b?{id:`QIrBIx`}:{id:`sR0I-f`}),"data-testid":`${a}-collapse-toggle`,onClick:()=>g(b?new Set:new Set(v.map(EC))),children:b?(0,Z.jsx)(wy,{"aria-hidden":`true`,className:`size-3.5`}):(0,Z.jsx)(Mv,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsx)(cr,{children:b?(0,Z.jsx)(Y,{id:`QIrBIx`}):(0,Z.jsx)(Y,{id:`sR0I-f`})})]}),(0,Z.jsx)(jm,{children:e.length})]}),O;t[25]===D?O=t[26]:(O=(0,Z.jsxs)(Mm,{children:[T,D]}),t[25]=D,t[26]=O),C=(0,Z.jsxs)(Nm,{children:[O,(0,Z.jsx)(km,{className:`flex flex-col gap-3`,children:f.length===0?(0,Z.jsx)(Om,{children:i}):o?v.map(e=>(0,Z.jsx)(`section`,{"aria-label":e.docName,children:(0,Z.jsxs)(pr,{open:!h.has(e.docName),onOpenChange:t=>y(e.docName,t),className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-1.5`,children:(0,Z.jsxs)(fr,{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)(Rr,{className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:Md(e.docName)}),(0,Z.jsx)(Mp,{variant:`outline`,className:`shrink-0 px-1 py-0 text-[10px] tabular-nums`,children:e.threads.length}),(0,Z.jsx)(Hl,{"aria-hidden":`true`,className:`size-3 shrink-0 transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`})]})}),(0,Z.jsx)(dr,{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(w)})]})},e.docName)):f.map(w)}),e.length>0&&(0,Z.jsx)(vC,{threadIds:S,selectableIds:e.map(TC),testIdPrefix:a})]}),t[4]=s,t[5]=h,t[6]=i,t[7]=u,t[8]=o,t[9]=m,t[10]=_,t[11]=c,t[12]=a,t[13]=n,t[14]=C}else C=t[14];return C}function TC(e){return e.id}function EC(e){return e.docName}function DC(e){return!e}function OC(e){return e.id}function kC(e){return e.status===`resolved`}function AC(e){return e.status!==`resolved`}function jC(){return new Set}function MC(){return Date.now()}function NC(){let e=(0,$.c)(3),t=de(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(Y,{id:`QzofTX`}),e[0]=n):n=e[0];let r;return e[1]===t?r=e[2]:(r=(0,Z.jsx)(wC,{threads:t,groupByDocument:!0,empty:n,testIdPrefix:`comment-queue`}),e[1]=t,e[2]=r),r}function PC(e){let t=(0,$.c)(6),{docName:n}=e,r=g(n),i,a;t[0]===n?(i=t[1],a=t[2]):(i=()=>{Bt(n).catch(FC)},a=[n],t[0]=n,t[1]=i,t[2]=a),(0,Q.useEffect)(i,a);let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Y,{id:`zpfN9p`}),t[3]=o):o=t[3];let s;return t[4]===r?s=t[5]:(s=(0,Z.jsx)(wC,{threads:r,empty:o,testIdPrefix:`comment-doc`}),t[4]=r,t[5]=s),s}function FC(){}function IC(e){let t=(0,$.c)(2),{docName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(bp,{name:`comments-panel`,children:(0,Z.jsx)(PC,{docName:n})}),t[0]=n,t[1]=r),r}function LC(e){let t=(0,$.c)(17),{docName:n}=e,{_:r}=on(),[i,a]=(0,Q.useState)(`doc`),o,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>(lt()&&a(`project`),l(()=>a(`project`))),s=[],t[0]=o,t[1]=s):(o=t[0],s=t[1]),(0,Q.useEffect)(o,s);let c,u;t[2]!==n||t[3]!==i?(c=()=>(Ny({scope:i,docName:n}),RC),u=[i,n],t[2]=n,t[3]=i,t[4]=c,t[5]=u):(c=t[4],u=t[5]),(0,Q.useEffect)(c,u);let d;t[6]===r?d=t[7]:(d=r({id:`ZWyHmq`}),t[6]=r,t[7]=d);let f;t[8]!==i||t[9]!==d?(f=(0,Z.jsx)(bu,{scope:i,onScopeChange:a,projectLabel:d}),t[8]=i,t[9]=d,t[10]=f):f=t[10];let p;t[11]!==n||t[12]!==i?(p=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:i===`doc`?(0,Z.jsx)(IC,{docName:n}):(0,Z.jsx)(NC,{})}),t[11]=n,t[12]=i,t[13]=p):p=t[13];let m;return t[14]!==f||t[15]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col pt-2`,children:[f,p]}),t[14]=f,t[15]=p,t[16]=m):m=t[16],m}function RC(){return Ny(null)}var zC=new Map(Ro.map(e=>[e.id,e.alias]));function BC(e){return e.source===`markdownlint`?zC.get(e.code):void 0}function VC(e,t,n){return La({relativePath:Xc(e),source:t.source,code:t.code,ruleAlias:BC(t),message:t.message,line:t.range.start.line+1,column:t.range.start.character+1,lineText:n})}function HC(e){return ka(e===null?null:Xc(e))}var UC=5;async function WC(e){let t=await fetch(`/api/backlinks?docName=${encodeURIComponent(e)}`),n=await t.json().catch(()=>null);if(!t.ok){let e=gs.safeParse(n),r=t.status;throw e.success?Error(e.data.title):new Cr(Ms._({id:`XopE_I`,values:{status:r}}),{status:r})}let r=Xo.safeParse(n);if(!r.success)throw new Cr(Ms._({id:`lZAiSP`}),{status:t.status});return r.data.backlinks}async function GC(e){let t=await fetch(`/api/forward-links?docName=${encodeURIComponent(e)}`),n=await t.json().catch(()=>null);if(!t.ok){let e=gs.safeParse(n),r=t.status;throw e.success?Error(e.data.title):new Cr(Ms._({id:`GemPfn`,values:{status:r}}),{status:r})}let r=Va.safeParse(n);if(!r.success)throw new Cr(Ms._({id:`2YZwPB`}),{status:t.status});return r.data}function KC(e){let t=e.split(`/`);return t.length<=2?e:`…/${t.slice(-2).join(`/`)}`}function qC(e){window.location.hash=Cf(e)}function JC(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)(Vl,{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)(Dm,{children:n})]}),t[1]=n,t[2]=o);let s;t[3]!==r||t[4]!==i?(s=!i&&(0,Z.jsx)(jm,{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)(fr,{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 YC(e){let t=(0,$.c)(10),{total:n,expanded:r,onToggle:i}=e;if(n<=UC)return null;let a=n-UC,o;t[0]===r?o=t[1]:(o=r?(0,Z.jsx)(Vl,{className:`size-3`}):(0,Z.jsx)(Hl,{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 XC(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=Bn(`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:Bn(`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)(sr,{asChild:!0,children:k}),t[31]=k,t[32]=e);let n;t[33]===i?n=t[34]:(n=(0,Z.jsx)(cr,{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 ZC(e){let t=(0,$.c)(39),{docName:n}=e,{_:r}=on(),{folderPaths:i,pages:a,pagesBySlug:o,pagesByBasename:s,loading:c}=Eu(),l,u;t[0]===n?(l=t[1],u=t[2]):(l=[`backlinks`,n],u=()=>WC(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)||Co(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}=Cn(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,UC),t[13]=_,t[14]=v,t[15]=S):S=t[15];let w=S,T;t[16]===r?T=t[17]:(T=r({id:`9NJWgv`}),t[16]=r,t[17]=T);let E;t[18]!==_.length||t[19]!==m||t[20]!==T?(E=(0,Z.jsx)(JC,{title:T,count:_.length,isLoading:m}),t[18]=_.length,t[19]=m,t[20]=T,t[21]=E):E=t[21];let D;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]!==w?(D=h?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Em,{children:h instanceof Error?h.message:r({id:`Xet9MX`})})}):_.length===0&&!m?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Om,{children:(0,Z.jsx)(Y,{id:`rVxu1k`})})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:w.map((e,t)=>{let n=Vm(e.source,{pages:a,folderPaths:i,pagesBySlug:o,pagesByBasename:s});return(0,Z.jsx)(XC,{icon:(0,Z.jsx)(C,{className:`size-3.5`}),title:e.title,path:KC(e.source),titleHover:e.source,anchor:e.anchor,snippet:e.snippet,href:Cf(n.hashDocName,e.anchor)},`${e.source}-${t}`)})}),(0,Z.jsx)(YC,{total:_.length,expanded:v,onToggle:()=>y(QC)})]}),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]=w,t[32]=D):D=t[32];let O;t[33]!==m||t[34]!==D?(O=(0,Z.jsx)(dr,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":m,children:D})}),t[33]=m,t[34]=D,t[35]=O):O=t[35];let k;return t[36]!==O||t[37]!==E?(k=(0,Z.jsxs)(pr,{defaultOpen:!0,children:[E,O]}),t[36]=O,t[37]=E,t[38]=k):k=t[38],k}function QC(e){return!e}function $C(e){let t=(0,$.c)(49),{docName:n}=e,{_:r}=on(),{addPage:i,folderPaths:a,pages:o,pagesBySlug:s,pagesByBasename:c,loading:l}=Eu(),u,d;t[0]===n?(u=t[1],d=t[2]):(u=[`forward-links`,n],d=()=>GC(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)||Co(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}=Cn(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),[w,T]=(0,Q.useState)(n);w!==n&&(T(n),S(!1),b(null));let E;t[13]!==x||t[14]!==v?(E=x?v:v.slice(0,UC),t[13]=x,t[14]=v,t[15]=E):E=t[15];let D=E,O;t[16]!==r||t[17]!==i||t[18]!==y?(O=async function(e,t){if(!y){b(t);try{await st(e,{addPage:i,onCreated:qC}),b(null)}catch(e){let t=e;Ns.error(t instanceof Error?t.message:r({id:`tfi40B`})),b(null)}}},t[16]=r,t[17]=i,t[18]=y,t[19]=O):O=t[19];let k=O,A;t[20]!==r||t[21]!==y||t[22]!==a||t[23]!==k||t[24]!==o||t[25]!==c||t[26]!==s||t[27]!==l?(A=function(e){let{title:t}=e;if(e.kind===`external`){let t=e.title===e.url;return(0,Z.jsx)(XC,{icon:(0,Z.jsx)(dl,{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=Nr(e.docName,{pages:o,folderPaths:a,pagesBySlug:s,pagesByBasename:c}),i=!l&&n.kind===`create`,u=!l&&n.kind===`navigate`&&n.displayState===`folder`,d=KC(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:Cf(m,e.anchor);if(i&&n.kind===`create`){let i={initialDir:n.initialDir,suggestedName:n.suggestedName};return(0,Z.jsx)(XC,{icon:(0,Z.jsx)(pf,{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 k(i,p)},p)}return u&&n.kind===`navigate`?(0,Z.jsx)(XC,{icon:(0,Z.jsx)(gd,{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)(XC,{icon:(0,Z.jsx)(C,{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]=k,t[24]=o,t[25]=c,t[26]=s,t[27]=l,t[28]=A):A=t[28];let j=A,M;t[29]===r?M=t[30]:(M=r({id:`O0Z2Xr`}),t[29]=r,t[30]=M);let N;t[31]!==h||t[32]!==v.length||t[33]!==M?(N=(0,Z.jsx)(JC,{title:M,count:v.length,isLoading:h}),t[31]=h,t[32]=v.length,t[33]=M,t[34]=N):N=t[34];let P;t[35]!==r||t[36]!==g||t[37]!==x||t[38]!==h||t[39]!==v.length||t[40]!==j||t[41]!==D?(P=g?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Em,{children:g instanceof Error?g.message:r({id:`pZAs1T`})})}):v.length===0&&!h?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Om,{children:(0,Z.jsx)(Y,{id:`roiUQQ`})})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:D.map(j)}),(0,Z.jsx)(YC,{total:v.length,expanded:x,onToggle:()=>S(ew)})]}),t[35]=r,t[36]=g,t[37]=x,t[38]=h,t[39]=v.length,t[40]=j,t[41]=D,t[42]=P):P=t[42];let F;t[43]!==h||t[44]!==P?(F=(0,Z.jsx)(dr,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":h,children:P})}),t[43]=h,t[44]=P,t[45]=F):F=t[45];let I;return t[46]!==N||t[47]!==F?(I=(0,Z.jsxs)(pr,{defaultOpen:!0,children:[N,F]}),t[46]=N,t[47]=F,t[48]=I):I=t[48],I}function ew(e){return!e}function tw(e){let t=(0,$.c)(42),{docName:n}=e,{_:r}=on(),{pages:i,loading:a}=Eu(),o,s;t[0]===n?(o=t[1],s=t[2]):(o=[`forward-links`,n],s=()=>GC(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)||Co(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}=Cn(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,UC),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`};ql(n,{kind:`lint`,detail:t}),window.dispatchEvent(new CustomEvent(su,{detail:t}))},t[16]=n,t[17]=S);let w=S,T;t[18]!==r||t[19]!==w?(T=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)(XC,{icon:t?(0,Z.jsx)(Ar,{className:`size-3.5`}):(0,Z.jsx)(C,{className:`size-3.5`}),iconColorClass:n?void 0:`text-amber-600 dark:text-amber-400`,title:KC(i),titleHover:i,ariaLabel:o,trailing:n?void 0:(0,Z.jsx)(Mp,{variant:`outline`,className:`font-normal text-muted-foreground`,children:a}),onClick:()=>w(e)},`lt:${e.range.start}-${e.range.end}`)},t[18]=r,t[19]=w,t[20]=T):T=t[20];let E=T,D;t[21]===r?D=t[22]:(D=r({id:`U3RIJu`}),t[21]=r,t[22]=D);let O;t[23]!==d||t[24]!==y.length||t[25]!==D?(O=(0,Z.jsx)(JC,{title:D,count:y.length,isLoading:d}),t[23]=d,t[24]=y.length,t[25]=D,t[26]=O):O=t[26];let k;t[27]!==r||t[28]!==f||t[29]!==p||t[30]!==d||t[31]!==_||t[32]!==E||t[33]!==y.length||t[34]!==x?(k=f?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Em,{children:f instanceof Error?f.message:r({id:`1xui0Q`})})}):_===void 0&&!d?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Om,{children:(0,Z.jsx)(Y,{id:`g-dkjJ`})})}):y.length===0&&!d?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Om,{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(E)}),(0,Z.jsx)(YC,{total:y.length,expanded:p,onToggle:()=>m(nw)})]}),t[27]=r,t[28]=f,t[29]=p,t[30]=d,t[31]=_,t[32]=E,t[33]=y.length,t[34]=x,t[35]=k):k=t[35];let A;t[36]!==d||t[37]!==k?(A=(0,Z.jsx)(dr,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":d,children:k})}),t[36]=d,t[37]=k,t[38]=A):A=t[38];let j;return t[39]!==O||t[40]!==A?(j=(0,Z.jsxs)(pr,{defaultOpen:!0,children:[O,A]}),t[39]=O,t[40]=A,t[41]=j):j=t[41],j}function nw(e){return!e}function rw(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)($C,{docName:n}),t[0]=n,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Ni,{}),t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Z.jsx)(tw,{docName:n}),t[3]=n,t[4]=s);let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Ni,{}),t[5]=c):c=t[5];let l;t[6]===n?l=t[7]:(l=(0,Z.jsx)(ZC,{docName:n}),t[6]=n,t[7]=l);let u;t[8]!==a||t[9]!==s||t[10]!==l?(u=(0,Z.jsxs)(km,{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)(Nm,{className:i,children:u}),t[12]=i,t[13]=u,t[14]=d):d=t[14],d}function iw(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 aw=1e4,ow=6e4;async function sw(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(cw)),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 cw(e){return e.type===`checkpoint`?e.checkpoint!==null&&Aa(e.checkpoint.kind):!0}function lw(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return Ms._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return Ms._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return Ms._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return Ms._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?Ms._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function uw(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function dw(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 fw(e){return e.split(`/`).pop()??e}function pw(e){return e.type===`checkpoint`?Ms._({id:`C-twqs`}):e.type===`upstream`?Ms._({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`?Ms._({id:`B2DrPb`}):e.author}function mw(e){let t=(0,$.c)(18),{entry:n,isDark:r}=e;if(n.type===`checkpoint`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(yc,{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)($c,{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=Wo(i),t[2]=i,t[3]=a);let o=a,s=r?Fo[o]??es[o]:es[o],c;t[4]!==s||t[5]!==i?(c=s??Ga(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)(Um,{icon:o,width:14,height:14,className:`shrink-0`,style:e}),t[9]=o,t[10]=e,t[11]=n):n=t[11],n}if(e.name===`File System`){let e;return t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Lv,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[12]=e):e=t[12],e}if(e.name===`OpenKnowledge (service)`||e.name===`Git (upstream)`){let e;return t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(il,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[13]=e):e=t[13],e}let u;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Ty,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[14]=u):u=t[14],u}if(n.authorEmail.includes(`agent`)||n.author.includes(`agent`)||n.authorEmail.includes(`cursor`)||n.authorEmail.includes(`claude`)){let e;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ue,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[15]=e):e=t[15],e}if(n.author===`openknowledge-server`||n.author===`server`){let e;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(il,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=e):e=t[16],e}let i;return t[17]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Ty,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[17]=i):i=t[17],i}function hw(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function gw(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(vw),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(_w)},children:[r?(0,Z.jsx)(Vl,{className:`size-3`}):(0,Z.jsx)(Hl,{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 _w(e){return!e}function vw(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 yw(e){let t=(0,$.c)(36),{descriptor:n,allDocs:r,versionBySha7:i,onJumpToVersion:a}=e,{_:o}=on();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:uw(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)(Mi,{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)(Nc,{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:fw(n.from),1:fw(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 bw(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}=on(),f;t[0]===n.timestamp?f=t[1]:(f=lw(n.timestamp),t[0]=n.timestamp,t[1]=f);let p=f,m;t[2]===n?m=t[3]:(m=pw(n),t[2]=n,t[3]=m);let h=m,g;t[4]===n.timestamp?g=t[5]:(g=uw(n.timestamp),t[4]=n.timestamp,t[5]=g);let _=g,v;t[6]===n.contributors?v=t[7]:(v=n.contributors.flatMap(xw),t[6]=n.contributors,t[7]=v);let y=v,b;t[8]===n?b=t[9]:(b=hw(n),t[8]=n,t[9]=b);let x=b,S;t[10]===n?S=t[11]:(S=dw(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=Km(),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=()=>{Wm(),Gm({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}),Ns.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=gs.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}),Ns.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)(mw,{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`:``,H;t[31]===V?H=t[32]:(H=[`flex flex-col rounded-lg transition-shadow`,V],t[31]=V,t[32]=H);let U=H.join(` `),W=A?`bg-muted`:`hover:bg-muted/80`,ee;t[33]===W?ee=t[34]:(ee=[`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`,W],t[33]=W,t[34]=ee);let G=ee.join(` `),K;t[35]===P?K=t[36]:(K=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),P())},t[35]=P,t[36]=K);let q;t[37]===B?q=t[38]:(q=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:B}),t[37]=B,t[38]=q);let te;t[39]===h?te=t[40]:(te=(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:h}),t[39]=h,t[40]=te);let J;t[41]!==n.timestamp||t[42]!==p?(J=(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]=J):J=t[43];let ne;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[44]=ne):ne=t[44];let re;t[45]===d?re=t[46]:(re=d({id:`Yea-K5`}),t[45]=d,t[46]=re);let ie;t[47]!==R||t[48]!==a?(ie=e=>{e.stopPropagation(),a>0?T(!0):R()},t[47]=R,t[48]=a,t[49]=ie):ie=t[49];let ae;t[50]===E?ae=t[51]:(ae=E?(0,Z.jsx)(xd,{"aria-hidden":`true`,className:`size-3`}):(0,Z.jsx)(mf,{className:`size-3`}),t[50]=E,t[51]=ae);let oe;t[52]!==E||t[53]!==re||t[54]!==ie||t[55]!==ae?(oe=(0,Z.jsx)(sr,{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":re,disabled:E,onClick:ie,children:ae})}),t[52]=E,t[53]=re,t[54]=ie,t[55]=ae,t[56]=oe):oe=t[56];let se;t[57]===d?se=t[58]:(se=d({id:`Yea-K5`}),t[57]=d,t[58]=se);let ce;t[59]===se?ce=t[60]:(ce=(0,Z.jsx)(cr,{side:`top`,children:se}),t[59]=se,t[60]=ce);let le;t[61]!==oe||t[62]!==ce?(le=(0,Z.jsxs)(ur,{children:[oe,ce]}),t[61]=oe,t[62]=ce,t[63]=le):le=t[63];let ue;t[64]!==te||t[65]!==J||t[66]!==le?(ue=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[te,J,ne,le]}),t[64]=te,t[65]=J,t[66]=le,t[67]=ue):ue=t[67];let de;t[68]===x?de=t[69]:(de=x.length>0&&(0,Z.jsx)(gw,{summaries:x}),t[68]=x,t[69]=de);let fe;t[70]!==y||t[71]!==C||t[72]!==c||t[73]!==s?(fe=(0,Z.jsx)(yw,{descriptor:C,allDocs:y,versionBySha7:s,onJumpToVersion:c}),t[70]=y,t[71]=C,t[72]=c,t[73]=s,t[74]=fe):fe=t[74];let pe;t[75]!==ue||t[76]!==de||t[77]!==fe?(pe=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[ue,de,fe]}),t[75]=ue,t[76]=de,t[77]=fe,t[78]=pe):pe=t[78];let me;t[79]!==P||t[80]!==A||t[81]!==G||t[82]!==K||t[83]!==q||t[84]!==pe?(me=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-pressed":A,"data-testid":`timeline-entry-open`,className:G,onClick:P,onKeyDown:K,children:[q,pe]}),t[79]=P,t[80]=A,t[81]=G,t[82]=K,t[83]=q,t[84]=pe,t[85]=me):me=t[85];let he;t[86]!==l||t[87]!==U||t[88]!==me?(he=(0,Z.jsx)(`div`,{ref:l,className:U,children:me}),t[86]=l,t[87]=U,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)(hr,{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)(mr,{children:[ye,` `,be]}),t[98]=ye,t[99]=xe);let Se;t[100]!==ve||t[101]!==xe?(Se=(0,Z.jsxs)(yr,{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)(xd,{"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)(vr,{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)(gr,{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)(br,{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 xw(e){return e.docs}function Sw(e){let t=(0,$.c)(27),{docName:n}=e,{_:r}=on(),{resolvedTheme:i}=Dn(),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(){qm()},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=iw({baseMs:aw,maxBackoffMs:ow,isPaused:ww,poll:e=>sw(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)(Mm,{children:(0,Z.jsx)(Dm,{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(Cw)}),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)(bw,{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 Cw(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(Im,{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)(Im,{className:`h-3 w-28`}),(0,Z.jsx)(Im,{className:`h-3 w-40`})]})]},e)}function ww(){return typeof document<`u`&&document.visibilityState===`hidden`}var Tw=`open-knowledge:lint-source-fixed`,Ew=Object.freeze({source:`local`,skipStoreHooks:!1,context:Object.freeze({origin:`lint-fix`})});function Dw(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 Ow(e){return e.flatMap(e=>e.fixes??[])}function kw(e,t,n){if(t.length===0)return!1;let r=e.document.getText(`source`),i=r.toString(),a=t.map(e=>({from:Dw(i,e.range.start),to:Dw(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)}},Ew),o>0&&Le(n),typeof window<`u`&&window.dispatchEvent(new CustomEvent(Tw)),!0}var Aw=[{id:`outline`,icon:Wv},{id:`links`,icon:T},{id:`graph`,icon:Yv},{id:`timeline`,icon:bv},{id:`problems`,icon:pf}],jw=[{id:`comments`,icon:Ud}];function Mw(e){let t=0,n=0;for(let r of e)r.severity===`error`?t+=1:n+=1;return{errorCount:t,warningCount:n}}function Nw(e){return e===`outline`?Ms._({id:`dD7NPy`}):e===`links`?Ms._({id:`Rj01Fz`}):e===`graph`?Ms._({id:`x2fr_j`}):e===`problems`?Ms._({id:`OXdGnd`}):e===`comments`?Ms._({id:`VbyRUy`}):Ms._({id:`cklVjM`})}function Pw(){return n(()=>import(`./GraphPanel-CIsyWZZL.js`),__vite__mapDeps([52,1,6,2,3,7,8,9,10,11,45,12,13,14,53,16,17,18,54,55,30,26,24,25,34,35,36,20,28,56,57,58,59,60,61,62,63,22,64,65,66,67,68,69,70,71,72,73,46,74,75,76,49,77]),import.meta.url)}var Fw=(0,Q.lazy)(async()=>({default:(await Pw()).GraphPanel})),Iw=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-82sBOezj.js`),__vite__mapDeps([78,1,45,12,13,14,27,16,17,18,28,29,30,26,24,25,31,22,34,35,36,20,79,2,80,81,11,82,83,84,85,86,87,88,89,90,6,3,7,8,9,10,91,74,92,93,94,95,96,4,97,54,19,21,40,98,39,99,100,101,41,42,66,67,68,69,102,49,71,103,104,46,105,33,65,70,72,73,106,107,108,37,23,109,110,43,47,111,112,113,114,115,116,117,118,119,120,121]),import.meta.url)).ActivityModeContent}));function Lw(e){let t=(0,$.c)(52),{docName:n,isSourceMode:r,activeTab:i,onActiveTabChange:a,mode:o}=e,{_:s}=on(),{activeProvider:c,activeDocName:l}=Oe(),{data:u}=zm(n),d=l===n?c:null,f=Fl(d,u?.effective??null),p=eu(n),m=p.findings,h;t[0]!==m||t[1]!==f?(h=[...f,...m],t[0]=m,t[1]=f,t[2]=h):h=t[2];let g=h,_,v;t[3]!==n||t[4]!==f||t[5]!==d?(_=()=>{d!==null&&uu(n,`lint`,Mw(f))},v=[n,d,f],t[3]=n,t[4]=f,t[5]=d,t[6]=_,t[7]=v):(_=t[6],v=t[7]),(0,Q.useEffect)(_,v);let y,b;t[8]!==n||t[9]!==m||t[10]!==p.status||t[11]!==d?(y=()=>{d===null||p.status!==`loaded`||uu(n,`links`,Mw(m))},b=[n,d,m,p.status],t[8]=n,t[9]=m,t[10]=p.status,t[11]=d,t[12]=y,t[13]=b):(y=t[12],b=t[13]),(0,Q.useEffect)(y,b);let x;t[14]!==n||t[15]!==d?(x=e=>{d!==null&&e.fixes&&e.fixes.length>0&&kw(d,e.fixes,n)},t[14]=n,t[15]=d,t[16]=x):x=t[16];let S=x,C;t[17]!==n||t[18]!==f||t[19]!==d?(C=()=>{d!==null&&kw(d,Ow(f),n)},t[17]=n,t[18]=f,t[19]=d,t[20]=C):C=t[20];let w=C,T=Xn(),E;t[21]!==n||t[22]!==d?(E=e=>{if(d===null)return;let t=d.document.getText(`source`).toString().split(`
4
- `)[e.range.start.line];Ws(VC(n,e,t),{submit:!0})},t[21]=n,t[22]=d,t[23]=E):E=t[23];let D=E,O;t[24]===n?O=t[25]:(O=e=>{Ws(HC(e===`doc`?n:null),{submit:!0})},t[24]=n,t[25]=O);let k=O,A=eS(),j,M,N;if(t[26]!==s||t[27]!==i||t[28]!==g||t[29]!==o||t[30]!==a||t[31]!==A){let e=A?Aw.filter(Rw):Aw,n=A?e:[...e,...jw];j=n.some(e=>e.id===i)?i:`outline`,M=o===`doc`&&n.length>1,N=M?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(Ii,{type:`single`,variant:`outline`,value:j,onValueChange:e=>{e&&a(e)},"aria-label":s({id:`SrOuyg`}),children:n.map(e=>{let{id:t,icon:n}=e,r=Nw(t),i=t===`problems`&&g.length>0;return(0,Z.jsxs)(ur,{children:[(0,Z.jsx)(Pi,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":i?s({id:`2m_bmh`,values:{0:g.length,label:r}}):r,asChild:!0,children:(0,Z.jsxs)(sr,{className:`relative`,children:[(0,Z.jsx)(n,{}),i&&(0,Z.jsx)(Mp,{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:g.length>99?`99+`:g.length})]})}),(0,Z.jsx)(cr,{side:`bottom`,children:r})]},t)})})}):null,t[26]=s,t[27]=i,t[28]=g,t[29]=o,t[30]=a,t[31]=A,t[32]=j,t[33]=M,t[34]=N}else j=t[32],M=t[33],N=t[34];let P;t[35]!==g||t[36]!==n||t[37]!==j||t[38]!==D||t[39]!==w||t[40]!==S||t[41]!==k||t[42]!==r||t[43]!==p.status||t[44]!==d||t[45]!==o||t[46]!==M||t[47]!==T?(P=o===`doc`?(0,Z.jsxs)(`div`,{...M?{role:`tabpanel`,id:`panel-${j}`,"aria-labelledby":`tab-${j}`}:{},className:`min-h-0 flex-1`,children:[j===`outline`&&(0,Z.jsx)(pu,{docName:n,isSourceMode:r}),j===`links`&&(0,Z.jsx)(rw,{docName:n}),j===`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)(Fw,{activeDocName:n})}),j===`timeline`&&(0,Z.jsx)(Sw,{docName:n}),j===`comments`&&(0,Z.jsx)(LC,{docName:n}),j===`problems`&&(0,Z.jsx)(cu,{docName:n,diagnostics:g,linkFindingsStatus:p.status,onFix:d===null?void 0:S,onAutoFix:d===null?void 0:w,onAskAi:d!==null&&T!==null?D:void 0,onFixWithAi:T===null?void 0:k})]}):(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)(Iw,{})})}),t[35]=g,t[36]=n,t[37]=j,t[38]=D,t[39]=w,t[40]=S,t[41]=k,t[42]=r,t[43]=p.status,t[44]=d,t[45]=o,t[46]=M,t[47]=T,t[48]=P):P=t[48];let F;return t[49]!==N||t[50]!==P?(F=(0,Z.jsxs)(Z.Fragment,{children:[N,P]}),t[49]=N,t[50]=P,t[51]=F):F=t[51],F}function Rw(e){return e.id===`outline`||e.id===`problems`}function zw(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function Bw(e,t){let n=getComputedStyle(e.ownerDocument.documentElement);return t*parseFloat(n.fontSize)}function Vw(e){return e/100*window.innerHeight}function Hw(e){return e/100*window.innerWidth}function Uw(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 Ww({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=Uw(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=Bw(t,i);break;case`em`:r=zw(t,i);break;case`vh`:r=Vw(i);break;case`vw`:r=Hw(i);break}return r}function Gw(e){return parseFloat(e.toFixed(3))}function Kw({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 qw(e){let{panels:t}=e,n=Kw({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=Gw(Ww({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=Gw(Ww({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=Gw(Ww({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=Gw(Ww({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 Jw(e,t=`Assertion error`){if(!e)throw Error(t)}function Yw(e,t){return Array.from(t).sort(e===`horizontal`?Xw:Zw)}function Xw(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function Zw(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function Qw(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function $w(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 eT({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}=$w(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return Jw(i,`No rect found`),i}var tT;function nT(){return tT===void 0&&(tT=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),tT}function rT(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Yw(n,Array.from(t.children).filter(Qw).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,eT({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=nT()?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:Kw({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 iT=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)}}},aT={cursorFlags:0,state:`inactive`},oT=new iT;function sT(){return aT}function cT(e){return oT.addListener(`change`,e)}function lT(e){let t=aT,n={...aT};n.cursorFlags=e,aT=n,oT.emit(`change`,{prev:t,next:n})}function uT(e){let t=aT;aT=e,oT.emit(`change`,{prev:t,next:e})}var dT=e=>e,fT=()=>{},pT=1,mT=2,hT=4,gT=8,_T=3,vT=12,yT;function bT(){return yT===void 0&&(yT=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(yT=!0)),yT}function xT({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&&bT()){let t=(e&pT)!==0,n=(e&mT)!==0,r=(e&hT)!==0,i=(e&gT)!==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 bT()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var ST=new WeakMap;function CT(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=ST.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=sT();switch(r.state){case`active`:case`hover`:{let e=xT({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}ST.set(e,{prevStyle:t,styleSheet:n})}var wT=new Map,TT=new iT;function ET(e){wT=new Map(wT),wT.delete(e)}function DT(e,t){for(let[t]of wT)if(t.id===e)return t}function OT(e,t){for(let[t,n]of wT)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function kT(){return wT}function AT(e,t){return TT.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function jT(e,t,n){let r=wT.get(e);wT=new Map(wT),wT.set(e,t),TT.emit(`groupChange`,{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:r,next:t})}function MT(e){let t=sT(),n=!1;switch(t.state){case`active`:uT({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(CT(e),n=!0,t.hitRegions.forEach(e=>{let t=OT(e.group.id,!0);jT(e.group,t,{isUserInteraction:!0})}))}return n}function NT(e){e.defaultPrevented||MT(e.currentTarget)}function PT(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=$w(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 FT(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function IT(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:HT(e),b:HT(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();Jw(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:VT(BT(n.a)),b:VT(BT(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 LT=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function RT(e){let t=getComputedStyle(UT(e)??e).display;return t===`flex`||t===`inline-flex`}function zT(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||RT(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`||LT.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function BT(e){let t=e.length;for(;t--;){let n=e[t];if(Jw(n,`Missing node`),zT(n))return n}return null}function VT(e){return e&&Number(getComputedStyle(e).zIndex)||0}function HT(e){let t=[];for(;e;)t.push(e),e=UT(e);return t}function UT(e){let{parentNode:t}=e;return FT(t)?t.host:t}function WT(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 GT({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Qw(n)||n.contains(e)||e.contains(n))return!0;if(IT(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(WT(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function KT(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=rT(r),a=PT(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&GT({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function qT(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 JT(e,t,n=0){return Math.abs(Gw(e)-Gw(t))<=n}function YT(e,t){return JT(e,t)?0:e>t?1:-1}function XT({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(YT(r,c)<0)if(a){let e=(i+c)/2;r=YT(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=Gw(r),r}function ZT({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(JT(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;Jw(u!=null,`Invalid first pivot index`),Jw(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];Jw(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(Jw(n!=null,`Previous layout not found for panel index ${t}`),JT(n,i)){let t=o-n;YT(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];Jw(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(Jw(n!=null,`Previous layout not found for panel index ${t}`),JT(n,o)){let t=n-i;YT(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];Jw(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&YT(i,c)<0)if(e>0){let t=c-o,n=t/2;YT(i+e,c)<0&&(e=YT(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;YT(i-e,c)<0&&(e=YT(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];Jw(e!=null,`Previous layout not found for panel index ${r}`);let a=XT({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];Jw(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=XT({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!JT(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(qT(c,l))return i;{let t=e<0?d:u,r=s[t];Jw(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=XT({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!JT(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];Jw(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=XT({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(JT(i,s)||(t-=s-i,l[r]=s),JT(t,0))break;e>0?r--:r++}}}if(!JT(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 QT(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||YT(e[n],t[n])!==0)return!1;return!0}function $T({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n];r.length!==t.length&&(e=fE(t),n=Object.values(e),r=[...n]);let i=r.reduce((e,t)=>e+t,0);if(!JT(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];Jw(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];Jw(i!=null,`No layout data found for index ${e}`);let o=r[e];Jw(o!=null,`No layout data found for index ${e}`);let s=XT({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!JT(a,0))for(let e=0;e<t.length;e++){let n=r[e];Jw(n!=null,`No layout data found for index ${e}`);let i=n+a,o=XT({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,JT(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function eE({groupId:e,panelId:t}){let n=()=>{let t=kT();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&&JT(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,s).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:Gw(100-e)}}return ZT({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=$T({layout:o({nextSize:e,panels:i.panels,prevLayout:c,derivedPanelConstraints:r}),panelConstraints:r});QT(c,u)||jT(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&&JT(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=Kw({group:t});s(Gw(Ww({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function tE(e){e.defaultPrevented||KT(e,kT()).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=eE({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function nE(e){let t=kT();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 rE({groupId:e}){let t=()=>{let t=kT();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=$T({layout:e,panelConstraints:r});return n?o:(QT(o,c)||jT(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function iE(e,t){let n=nE(e),r=OT(n.id,!0),i=n.separators.find(t=>t.element===e);Jw(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);Jw(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=rE({groupId:n.id}).getLayout(),c=$T({layout:ZT({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});QT(s,c)||jT(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function aE(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=nE(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&iE(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&iE(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&iE(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&iE(t,-5);break;case`End`:e.preventDefault(),iE(t,100);break;case`Enter`:{e.preventDefault();let n=nE(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=OT(n.id,!0),o=n.separators.find(e=>e.element===t);Jw(o,`Matching separator not found`);let s=a.get(o);Jw(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(Jw(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];iE(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=nE(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);Jw(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(),iE(t,-100);break}}function oE(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=kT(),n=KT(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)}),uT({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}function sE({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=ZT({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(QT(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?pT:mT;break;case`vertical`:s|=d<0?hT:gT;break}}else jT(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&_T:c|=s&_T,t.movementY===0?c|=o&vT:c|=s&vT,lT(c),CT(e)}function cE(e){let t=kT(),n=sT();switch(n.state){case`active`:sE({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function lE(e){if(e.defaultPrevented)return;let t=sT(),n=kT();switch(t.state){case`active`:if(e.buttons===0){uT({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=OT(e.group.id,!0);jT(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)}sE({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=KT(e,n);r.length===0?t.state!==`inactive`&&uT({cursorFlags:0,state:`inactive`}):uT({cursorFlags:0,hitRegions:r,state:`hover`}),CT(e.currentTarget);break}}}function uE(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(sT().state){case`hover`:uT({cursorFlags:0,state:`inactive`})}}function dE(e){e.defaultPrevented||e.pointerType===`mouse`&&e.button>0||MT(e.currentTarget)&&e.preventDefault()}function fE(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=Gw(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=Gw((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function pE(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=Kw({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:Gw(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function mE(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 hE({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=Gw(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]=Gw((r[e]??0)/a*l);else{let e=Gw(l/c.length);for(let t of c)u[t]=e}return u}function gE(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 _E=new Map;function vE(e){let t=!0;Jw(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=Kw({group:e});if(t===0)return;let n=OT(e.id);if(!n)return;let r=qw(e),i=n.defaultLayoutDeferred?fE(r):n.layout,a=$T({layout:hE({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&QT(n.layout,a)&&mE(n.derivedPanelConstraints,r)&&n.groupSize===t)return;jT(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else pE(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{Jw(!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=Kw({group:e}),s=qw(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(gE(e.panels,l)||(l=void 0));let u=$T({layout:e.mutableState.layouts[c]??l??fE(s),panelConstraints:s}),d=e.element.ownerDocument;_E.set(d,(_E.get(d)??0)+1);let f=new Map;return rT(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),jT(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{Jw(!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`,aE)}),d.addEventListener(`contextmenu`,NT,!0),d.addEventListener(`dblclick`,tE,!0),d.addEventListener(`pointerdown`,oE,!0),d.addEventListener(`pointerleave`,cE),d.addEventListener(`pointermove`,lE),d.addEventListener(`pointerout`,uE),d.addEventListener(`pointerup`,dE,!0),function(){t=!1,_E.set(d,Math.max(0,(_E.get(d)??0)-1)),ET(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,aE)}),_E.get(d)||(d.removeEventListener(`contextmenu`,NT,!0),d.removeEventListener(`dblclick`,tE,!0),d.removeEventListener(`pointerdown`,oE,!0),d.removeEventListener(`pointerleave`,cE),d.removeEventListener(`pointermove`,lE),d.removeEventListener(`pointerout`,uE),d.removeEventListener(`pointerup`,dE,!0)),a.disconnect()}}function yE(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function bE(e){let t=(0,Q.useId)();return`${e??t}`}var xE=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function SE(e){let t=(0,Q.useRef)(e);return xE(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function CE(...e){return SE(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function wE(e){let t=(0,Q.useRef)({...e});return xE(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var TE=(0,Q.createContext)(null);function EE(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:dT});(0,Q.useImperativeHandle)(t,()=>n.current,[]),xE(()=>{Object.assign(n.current,rE({groupId:e}))})}function DE({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=SE(e=>{QT(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=SE((e,t)=>{QT(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e,{isUserInteraction:t}))}),_=bE(s),v=(0,Q.useRef)(null),[y,b]=yE(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=CE(v,a);EE(_,o);let C=SE((e,t)=>{let r=sT(),i=DT(e),a=OT(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=wE({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=Yw(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=Yw(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=DT(_),i=OT(_);r&&i&&jT(r,{...i,derivedPanelConstraints:qw(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 xE(()=>{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=vE(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=OT(r.id,!0);!o&&s.length>0&&(h(c),g(c,!1));let l=AT(_,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=JT(t.collapsedSize,i[t.panelId]),a=JT(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=sT().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)(TE.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})})}DE.displayName=`Group`;function OE(){return(0,Q.useRef)(null)}function kE(){let e=(0,Q.useContext)(TE);return Jw(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function AE(e,t){let{id:n}=kE(),r=(0,Q.useRef)({collapse:fT,expand:fT,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:fT});(0,Q.useImperativeHandle)(t,()=>r.current,[]),xE(()=>{Object.assign(r.current,eE({groupId:n,panelId:e}))})}function jE({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=bE(c),_=wE({disabled:a}),v=(0,Q.useRef)(null),y=CE(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=kE(),T=d!==null,E=SE((e,t,n)=>{d?.(e,c,n)});xE(()=>{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]),AE(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>AT(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:{...ME,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})})}jE.displayName=`Panel`;var ME={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function NE(){return(0,Q.useRef)(null)}function PE({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=$T({layout:ZT({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=$T({layout:ZT({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function FE({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=bE(a),l=wE({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),_=CE(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=kE(),C=b===`horizontal`?`vertical`:`horizontal`;xE(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=cT(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=AT(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(PE({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})}FE.displayName=`Separator`;function IE(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}=on(),[o,s]=(0,Q.useState)(`diagram`),c=Ym(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)(eh,{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=Jm({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)(Qm,{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)(sr,{children:(0,Z.jsx)(oe,{className:`size-4`})}),t[24]=h):h=t[24];let g;t[25]===m?g=t[26]:(g=(0,Z.jsx)(Pi,{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)(cr,{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)(sr,{children:(0,Z.jsx)(S,{className:`size-4`})}),t[32]=b):b=t[32];let x;t[33]===y?x=t[34]:(x=(0,Z.jsx)(Pi,{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 C;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(cr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`wdxz7K`})}),t[35]=C):C=t[35];let w;t[36]===x?w=t[37]:(w=(0,Z.jsxs)(ur,{children:[x,C]}),t[36]=x,t[37]=w);let T;t[38]!==o||t[39]!==w||t[40]!==p||t[41]!==v?(T=(0,Z.jsx)(`div`,{className:`flex shrink-0 items-center justify-center border-b bg-background py-2`,children:(0,Z.jsxs)(Ii,{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,w]})}),t[38]=o,t[39]=w,t[40]=p,t[41]=v,t[42]=T):T=t[42];let E;t[43]!==n||t[44]!==r||t[45]!==o||t[46]!==i||t[47]!==d?(E=(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)(ul,{chart:d,className:`min-h-0 flex-1`})}):(0,Z.jsx)(Xm,{...i,fileName:r,extension:n})}),t[43]=n,t[44]=r,t[45]=o,t[46]=i,t[47]=d,t[48]=E):E=t[48];let D;return t[49]!==u||t[50]!==r||t[51]!==o||t[52]!==T||t[53]!==E?(D=(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:[T,E]}),t[49]=u,t[50]=r,t[51]=o,t[52]=T,t[53]=E,t[54]=D):D=t[54],D}function LE(e){return ca(`/api/asset?path=${encodeURIComponent(e)}`)}function RE(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function zE(e){let t=(0,$.c)(8),{assetPath:n,mediaKind:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)($m,{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)(BE,{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 BE(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=LE(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)(Tt,{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=RE(n),t[19]=n,t[20]=e),p=(0,Z.jsx)(Xm,{src:e,assetPath:n,fileName:l,extension:f.toLowerCase()},n);break bb0}if(u===`mermaid`){let e;t[21]===n?e=t[22]:(e=RE(n),t[21]=n,t[22]=e),p=(0,Z.jsx)(IE,{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)(be,{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:()=>{dm({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 VE(){let e=(0,$.c)(5),{_:t}=on(),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)(Im,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(Im,{className:`h-4 w-full`}),(0,Z.jsx)(Im,{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 HE(e){let{_:t}=on();return e===`existing-repo`?[{id:`draft-spec`,icon:Ov,label:t({id:`LdKIHS`}),prompt:t({id:`N_7kkF`})},{id:`organize-specs`,icon:Wv,label:t({id:`cuA8QW`}),prompt:t({id:`mPy9lS`})},{id:`document-architecture`,icon:Yv,label:t({id:`6eniID`}),prompt:t({id:`uDlyqd`})}]:[{id:`competitor-research`,icon:hy,label:t({id:`GUqTzn`}),prompt:t({id:`KOZud0`})},{id:`eng-specs`,icon:Ov,label:t({id:`Qvls7J`}),prompt:t({id:`6qMe0o`})},{id:`bird-wiki`,icon:mv,label:t({id:`FqTpiN`}),prompt:t({id:`jtg_8-`})}]}function UE(e){let t=(0,$.c)(13),{scenario:n,className:r}=e,{_:i}=on(),a=HE(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){nh(t).then(()=>{s(e),clearTimeout(c.current),c.current=setTimeout(()=>s(null),1600)}).catch(WE)};t[8]===r?d=t[9]:(d=Bn(`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:Bn(`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)(zl,{className:`size-3.5`,"aria-hidden":`true`}):(0,Z.jsx)(Cu,{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 WE(){}function GE(e,t,n){return e.trim().length>0||t.length>0||n}new Set(Wi.map(e=>e.id));function KE(e,t){Xs(e,t)}function qE(e){let t=(0,$.c)(2),{agentName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(Y,{id:`5PrrYw`,values:{agentName:n}}),t[0]=n,t[1]=r),r}function JE(e){let t=(0,$.c)(31),{scenario:n,className:r}=e,{_:i}=on(),{states:a,refresh:o}=qn(),s=Hi(),{dispatch:c}=Tc(),l=Zc(),u=Xn(),[d,f]=(0,Q.useState)(XE),p=Yi(),m=Li(),h;t[0]===s?h=t[1]:(h=e=>Ki(s,e.source,e.id,!0,e.supported),t[0]=s,t[1]=h);let g=m.filter(h),_=Ri(g,p),v;t[2]===u?.installedClis?v=t[3]:(v=u?.installedClis??{},t[2]=u?.installedClis,t[3]=v);let y=Qs({sticky:d,effectiveThreadAgent:_,enabledClis:u===null?[]:_c(s,u.installedClis),enabledDesktopTargets:tc(s),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)(YE),[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=HE(n),N;t[5]===s?N=t[6]:(N=e=>zi(s,e.id),t[5]=s,t[6]=N);let P=Wi.filter(N),F=Wi.every(e=>a[e.id]?.installed!=null),I=u!==null&&_c(s,u.installedClis).length>0,L=F&&P.length===0&&g.length===0&&!I,R;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){f(e),Xs(e),KE(e)},t[7]=R):R=t[7];let z=R,B;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(e){f(sc(e)),Xs(sc(e))},t[8]=B):B=t[8];let V=B,H;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(H=function(e){Xi(e),f($s),Xs($s)},t[9]=H):H=t[9];let U=H,W=function(){let{instruction:e,mentions:t}=w.current?.getContent()??{instruction:``,mentions:[]};if(!GE(e,t,!1)){k(!0);return}let r=Gc({workspace:l,description:e,scenario:n,mentions:t});r!==null&&(Dc(r,_===null?void 0:{agent:{source:_.source,id:_.id}}),w.current?.clear(),af())},ee=function(){if(u===null||x===null)return;let{instruction:e,mentions:t}=w.current?.getContent()??{instruction:``,mentions:[]};if(!GE(e,t,!1)){k(!0);return}let r=Gc({workspace:l,description:e,scenario:n,mentions:t});r!==null&&(u.launchInTerminal(r,x),w.current?.clear(),af())},G=function(e){let{instruction:t,mentions:r}=w.current?.getContent()??{instruction:``,mentions:[]};if(!GE(t,r,!1)){k(!0);return}if(KE(e),a[e]?.installed!==!0){let t=Wi.find(t=>t.id===e);t&&Kc(t);return}let i=Gc({workspace:l,description:t,scenario:n,mentions:r});i!==null&&(c(e,i),w.current?.clear(),af())},K=function(){b?W():C?ee():S!==null&&G(S)},q=function(e){w.current?.setText(e),w.current?.focus()};if(L){let e;t[10]===r?e=t[11]:(e=Bn(`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[10]=r,t[11]=e);let n;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(ue,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),t[12]=n):n=t[12];let i;t[13]===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[13]=i):i=t[13];let a;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:Cs,className:`gap-1.5`,"data-testid":`create-configure-agents`,children:[(0,Z.jsx)(Rn,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`jRAGrQ`})]}),t[14]=a):a=t[14];let o;return t[15]===e?o=t[16]:(o=(0,Z.jsxs)(`div`,{className:e,"data-testid":`create-no-agents`,children:[i,a]}),t[15]=e,t[16]=o),o}let te=u?_c(s,u.installedClis):[],J=P.length>0,ne=te.length>0,re=g.length>0,ie=y.kind!==`none`,ae;t[17]===r?ae=t[18]:(ae=Bn(`flex w-full flex-col gap-3`,r),t[17]=r,t[18]=ae);let oe;t[19]!==i||t[20]!==n?(oe=i(n===`skill`?{id:`Dut9Ht`}:{id:`7hctf2`}),t[19]=i,t[20]=n,t[21]=oe):oe=t[21];let se;t[22]!==i||t[23]!==n?(se=i(n===`skill`?{id:`eNhWUl`}:{id:`0jD-Gn`}),t[22]=i,t[23]=n,t[24]=se):se=t[24];let ce;t[25]!==E||t[26]!==O?(ce=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[25]=E,t[26]=O,t[27]=ce):ce=t[27];let le=ie?(0,Z.jsxs)(uf,{children:[(0,Z.jsx)(X,{type:`button`,onClick:()=>b?W():C?ee():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)(pl,{agentId:_.id,iconUrl:_.iconUrl,className:`size-3.5`}),(0,Z.jsx)(qE,{agentName:_.name})]}):C&&x!==null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(qi,{id:Gi(x),"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`4rjwLG`,values:{0:va[x].displayName}})]}):S===null?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(qi,{id:S,"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`9dw5bW`,values:{0:Cc(S)}})]})}),(0,Z.jsxs)(xi,{onOpenChange:e=>{e&&o()},children:[(0,Z.jsx)(hi,{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)(Vl,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsxs)(yi,{align:`end`,className:`max-h-80 min-w-[200px]`,children:[re?(0,Z.jsxs)(pi,{"aria-label":i({id:`vPKX2i`}),children:[(0,Z.jsxs)(_i,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(Y,{id:`RXEbZy`}),(0,Z.jsx)(Ui,{})]}),g.map(e=>(0,Z.jsxs)(li,{onSelect:()=>U(e),"data-testid":`create-agent-option-thread-${e.source}:${e.id}`,children:[(0,Z.jsx)(pl,{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)(zl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},`${e.source}:${e.id}`))]}):null,re&&(ne||J)?(0,Z.jsx)(Si,{}):null,ne?(0,Z.jsxs)(pi,{"aria-label":i({id:`ALhMYW`}),children:[(0,Z.jsx)(_i,{children:(0,Z.jsx)(Y,{id:`ALhMYW`})}),te.map(e=>{let{displayName:t}=va[e];return(0,Z.jsxs)(li,{onSelect:()=>V(e),"data-testid":`create-with-cli-${e}`,"aria-label":i({id:`QYfQdv`,values:{displayName:t}}),children:[(0,Z.jsx)(qi,{id:Gi(e),"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t}),x===e?(0,Z.jsx)(zl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e)})]}):null,J?(0,Z.jsxs)(Z.Fragment,{children:[ne?(0,Z.jsx)(Si,{}):null,(0,Z.jsxs)(pi,{"aria-label":i({id:`BBqGS9`}),children:[(0,Z.jsx)(_i,{children:(0,Z.jsx)(Y,{id:`BBqGS9`})}),P.map(e=>(0,Z.jsxs)(li,{onSelect:()=>z(e.id),"data-testid":`create-agent-option-${e.id}`,children:[(0,Z.jsx)(qi,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),!C&&e.id===S?(0,Z.jsx)(zl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null,(0,Z.jsx)(Si,{}),(0,Z.jsxs)(li,{onSelect:Cs,"data-testid":`create-agent-option-settings`,children:[(0,Z.jsx)(Rn,{"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[28]!==ce||t[29]!==le?(de=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 px-3 pb-3`,children:[ce,le]}),t[28]=ce,t[29]=le,t[30]=de):de=t[30],(0,Z.jsxs)(`div`,{className:ae,children:[(0,Z.jsxs)(`div`,{onMouseDown:e=>sf(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)(nf,{ref:w,ariaLabel:oe,placeholder:se,onEmptyChange:j,onContentChange:$d,onSubmit:K,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:()=>q(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 YE(){return rf().doc??void 0}function XE(){return Gs()}function ZE(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=I_(o.current,n);o.current=r,!(r<2)&&(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:Fg}:void 0,t[2]=a,t[3]=u);let d;t[4]!==i||t[5]!==l||t[6]!==u?(d=(0,Z.jsx)(nr,{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 QE({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 $E=`open-knowledge:create-top-level-file`;function eD(e={}){window.dispatchEvent(new CustomEvent($E,{detail:e}))}function tD(e){let t=t=>{let n=t.detail;e(n??{})};return window.addEventListener($E,t),()=>window.removeEventListener($E,t)}function nD(e){let t=(0,$.c)(29),{celebrateSignal:n,onAddStarterPack:r,onRageStreak:i}=e,{_:a}=on(),o=tn(),{title:s,subtitle:c}=QE({isOnboarding:!1,isEmbedded:o}),l=Mu(),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=ZE,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)(UE,{scenario:`existing-repo`}):(0,Z.jsx)(JE,{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)(aD,{templates:d,loading:f,error:p,onSelect:iD}):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`)?(b=(0,Z.jsx)(Mn,{"aria-hidden":`true`,className:`size-3`}),x=(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:[b,x]}),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:rD,children:(0,Z.jsx)(Y,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(ll,{"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`,children:[_,v,T]}),t[25]=T,t[26]=_,t[27]=v,t[28]=E):E=t[28],E}function rD(){return eD({initialDir:``})}function iD(e,t){return eD({template:{folder:e,name:t}})}function aD(e){let t=(0,$.c)(25),{templates:n,loading:r,error:i,onSelect:a}=e,{_:o}=on(),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)(Mp,{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)(oD,{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 oD(e){let t=(0,$.c)(24),{template:n,targetLabel:r,onClick:i}=e,{_:a}=on(),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 sD(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 vp();if(e)return;let r=t?Oa.safeParse(n):null;r?.success?(f(uD(r.data.documents)),h.current=!0):h.current||=(f(1),!0)}catch{!e&&!h.current&&(f(1),h.current=!0)}};t();let n=Ls(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(lD),500),vp().then(e=>{let{ok:t,body:n}=e;if(!t)return;let r=Oa.safeParse(n);r.success&&f(uD(r.data.documents))}).catch(cD)},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=Bn(`@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)(dD,{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`,{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)(fD,{onRageStreak:i,celebrateSignal:p,onPackSelect:e=>{u(e),c(!0)}}):(0,Z.jsx)(nD,{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)(jx,{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`,{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 cD(){}function lD(e){return e+1}function uD(e){return Uf(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function dD(e){let t=(0,$.c)(16),{isOnboarding:n,celebrateSignal:r,onRageStreak:i}=e,{_:a}=on(),o=tn(),s,c,l,u;if(t[0]!==a||t[1]!==o||t[2]!==n){let{title:e,subtitle:r}=QE({isOnboarding:n,isEmbedded:o});u=`w-full max-w-5xl`,s=ZE,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 fD(e){let t=(0,$.c)(30),{celebrateSignal:n,onPackSelect:r,onRageStreak:i}=e,{_:a}=on(),o=tn(),s,c,l,u;if(t[0]!==a||t[1]!==o){let{title:e,subtitle:n}=QE({isOnboarding:!0,isEmbedded:o});u=`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,s=ZE,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)(UE,{scenario:`new-project`}):(0,Z.jsx)(JE,{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)(mD,{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)(Tx,{onPackSelect:r,onCreateBlankFile:pD,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 pD(){return eD()}function mD(e){let t=(0,$.c)(13),{label:n}=e,{_:r}=on(),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)(bd,{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)(sr,{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)(cr,{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 hD(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function gD(e){let t=(0,$.c)(70),{folderPath:n,state:r,onChange:i}=e,{_:a}=on(),[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)(vD,{}),(0,Z.jsx)(Im,{className:`h-7 w-full`}),(0,Z.jsx)(Im,{className:`h-7 w-full`}),(0,Z.jsx)(Im,{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=hD(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 _d(n,{[e]:t});if(!r.ok){let{error:e}=r;Ns.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 _d(n,{[e]:null});if(!t.ok){let{error:e}=t;Ns.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,Il(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):Ll[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(qo(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 _d(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 _d(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,H=!o,U;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>s(!e),t[39]=U):U=t[39];let W=`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`}`,ee;t[40]===W?ee=t[41]:(ee=(0,Z.jsx)(Hl,{className:W,"aria-hidden":!0}),t[40]=W,t[41]=ee);let G;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(Y,{id:`vQIVHc`}),t[42]=G):G=t[42];let K;t[43]===ee?K=t[44]:(K=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[ee,G]}),t[43]=ee,t[44]=K);let q;t[45]===h?q=t[46]:(q=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text break-all`,onClick:_D,children:h}),t[45]=h,t[46]=q);let te;t[47]!==K||t[48]!==q?(te=(0,Z.jsxs)(fr,{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:[K,q]}),t[47]=K,t[48]=q,t[49]=te):te=t[49];let J;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`hSBIG-`})}),t[50]=J):J=t[50];let ne;t[51]!==c||t[52]!==y||t[53]!==z||t[54]!==_||t[55]!==p||t[56]!==x||t[57]!==u||t[58]!==C?(ne=_.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)(Tl,{keyName:e,value:t,declared:ml(t,ns(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]=ne):ne=t[59];let re;t[60]!==c||t[61]!==N?(re=c?(0,Z.jsx)(El,{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)(Mn,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`G8t9NN`})})]})}),t[60]=c,t[61]=N,t[62]=re):re=t[62];let ie;t[63]!==ne||t[64]!==re?(ie=(0,Z.jsx)(dr,{children:(0,Z.jsxs)(`div`,{className:`px-2 py-2`,children:[J,ne,re]})}),t[63]=ne,t[64]=re,t[65]=ie):ie=t[65];let ae;return t[66]!==H||t[67]!==te||t[68]!==ie?(ae=(0,Z.jsx)(`section`,{className:`rounded-lg border bg-card`,children:(0,Z.jsxs)(pr,{open:H,onOpenChange:U,children:[te,ie]})}),t[66]=H,t[67]=te,t[68]=ie,t[69]=ae):ae=t[69],ae}function _D(e){return e.stopPropagation()}function vD(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Nv,{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 yD(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?Ms._({id:`xOTzt5`}):t<3600?Ms._({id:`zbymaY`,values:{0:Math.floor(t/60)}}):t<86400?Ms._({id:`optX0N`,values:{0:Math.floor(t/3600)}}):t<86400*7?Ms._({id:`l1l8sj`,values:{0:Math.floor(t/86400)}}):new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function bD(e){return(e.split(`/`).pop()??e).replace(/\.md$/,``)}function xD(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:Kn,label:Ms._({id:`QR5SP1`}),detail:bD(i)};case`template-edit`:return{Icon:it,label:Ms._({id:`-LHLx7`}),detail:bD(i)};case`template-delete`:return{Icon:ff,label:Ms._({id:`_gkGSK`}),detail:bD(i)};case`template-rename`:case`template-move`:{let[e,t]=i.split(` -> `);return{Icon:Nc,label:Ms._({id:`KPW5WC`}),detail:`${bD(e??``)} → ${bD(t??i)}`}}case`folder-frontmatter-edit`:return{Icon:Nv,label:Ms._({id:`_tekeB`}),detail:``};case`folder-frontmatter-delete`:return{Icon:Nv,label:Ms._({id:`ZWxfrc`}),detail:``};case`folder-create`:return{Icon:Nv,label:Ms._({id:`ZQLDTl`}),detail:``};default:return{Icon:yc,label:r.replace(/-/g,` `),detail:bD(i)}}}function SD(e){return e.contributors.length>0?e.contributors[0].name:e.author===`openknowledge-service`||e.author===`server`?Ms._({id:`B2DrPb`}):e.author||Ms._({id:`Ef7StM`})}function CD(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=Bs(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)(Mp,{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)(Im,{className:`h-8 w-full`}),(0,Z.jsx)(Im,{className:`h-8 w-full`})]}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:i.map(wD)})}),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 wD(e){let{Icon:t,label:n,detail:r}=xD(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)(Ty,{className:`size-3`,"aria-hidden":!0}),SD(e)]}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground/80`,dateTime:e.timestamp,title:new Date(e.timestamp).toLocaleString(),children:yD(e.timestamp)})]},e.sha)}function TD(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function ED(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=TD(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function DD(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function OD(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:ED(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:DD(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:ED(e,t.pageTitles),children:a}}function kD(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)(Im,{className:`h-12 w-full`}),(0,Z.jsx)(Im,{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)(Mp,{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)(Mn,{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)(Zu,{template:e,onCreate:()=>l(e.name),onEdit:()=>gh(os(e.source_folder,e.name)),onDelete:()=>s(e),badge:e.scope===`inherited`?(0,Z.jsx)(yl,{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)(Ru,{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(AD)),t[20]=p,t[21]=S);let C;t[22]!==n||t[23]!==i?(C=e=>{i(),gh(os(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)(zu,{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)(nx,{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 AD(e){return e.name}function jD(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=Bn(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=Bn(`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 MD(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=Bn(`[&_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 ND(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=Bn(`[&_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 PD(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=Bn(`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 FD(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=Bn(`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 ID(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=Bn(`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 LD(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return Ms._({id:`xOTzt5`});if(r<60)return Ms._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return Ms._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?Ms._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function RD(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 zD(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)(cl,{className:`ml-1 size-3`}):(0,Z.jsx)(sl,{className:`ml-1 size-3`}):(0,Z.jsx)(pv,{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 BD(e){let t=(0,$.c)(96),{folderPath:n}=e,{_:r}=on(),{folderPaths:i,loading:a,pages:o,pageTitles:s,pageMeta:c}=Eu(),l=Wu(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)(Im,{className:`size-5 rounded`}),(0,Z.jsx)(Im,{className:`h-7 w-48`})]}),(0,Z.jsx)(Im,{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)(Im,{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)(Im,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(UD)]})]}),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=OD(n,{pages:o,pageTitles:s,pageMeta:c,folderPaths:i}),a=RD(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?_(HD):(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)(hd,{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)(Mn,{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)(gD,{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)(kD,{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)(CD,{folderPath:n}),t[44]=n,t[45]=D),S=`rounded-lg border`,y=jD;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)(zD,{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)(FD,{"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)(zD,{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)(FD,{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)(MD,{children:(0,Z.jsxs)(PD,{children:[L,V]})}),t[66]=L,t[67]=V,t[68]=x):x=t[68],v=ND,b=a.length?a.map(VD):(0,Z.jsx)(PD,{children:(0,Z.jsx)(ID,{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)(nx,{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 VD(e){return(0,Z.jsxs)(PD,{children:[(0,Z.jsx)(ID,{children:(0,Z.jsxs)(`a`,{href:Cf(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)(gd,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(C,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(ID,{className:`text-muted-foreground`,children:e.kind===`file`?LD(e.modified):`—`})]},e.path)}function HD(e){return e===`asc`?`desc`:`asc`}function UD(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)(Im,{className:`size-4 rounded`}),(0,Z.jsx)(Im,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Im,{className:`h-4 w-16`})})]},e)}function WD(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=Bn(`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 GD(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=Bn(`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 KD=ar(`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 qD(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=Bn(KD({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 JD(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?or:`div`,o;t[4]===n?o=t[5]:(o=Bn(`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 YD(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=Bn(`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 XD(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=Bn(`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 ZD(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)(qD,{variant:`icon`,className:`mb-0 size-16 rounded-full border bg-muted/40 text-muted-foreground`,children:(0,Z.jsx)(kv,{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)(JD,{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=ao(r),t[8]=r,t[9]=g);let _;t[10]===i?_=t[11]:(_=ao(i),t[10]=i,t[11]=_);let v;t[12]!==n||t[13]!==g||t[14]!==_?(v=(0,Z.jsx)(YD,{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)(GD,{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)(XD,{children:(0,Z.jsxs)(X,{ref:s,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(ol,{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)(WD,{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 QD(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)($D),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>ie(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(){b(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 $D(){return new Set}function eO(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)(H_,{autoStart:i})})]}),t[6]=i,t[7]=u),u}function tO(e){let t=(0,$.c)(20),{nav:n}=e,{state:r,refetch:i}=cd(n),a=(0,Q.useRef)(null),o=n.branch,s,c;t[0]===r.phase?(s=t[1],c=t[2]):(s=()=>{r.phase===`resolved`&&a.current?.querySelector(`button`)?.focus()},c=[r.phase],t[0]=r.phase,t[1]=s,t[2]=c),(0,Q.useEffect)(s,c);let l;t[3]===n.path?l=t[4]:(l=function(){window.location.hash=Of(ld(n.path))},t[3]=n.path,t[4]=l);let u=l,d;t[5]!==o||t[6]!==n.kind?(d=function(e){ud.arm({kind:n.kind,path:e,branch:o}),window.location.hash=n.kind===`folder`?Of(e):Cf(e)},t[5]=o,t[6]=n.kind,t[7]=d):d=t[7];let f=d,p=r.phase===`pending`?`polite`:void 0,m=r.phase===`resolved`?r.resolution.verdict:void 0,h=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`,g;t[8]!==u||t[9]!==n||t[10]!==f||t[11]!==i||t[12]!==r?(g=(0,Z.jsx)(fd,{nav:n,state:r,onBrowseFolder:u,onOpenRenamed:f,onEnableAutoSync:u,onSyncCompleted:i,onPullApplied:i}),t[8]=u,t[9]=n,t[10]=f,t[11]=i,t[12]=r,t[13]=g):g=t[13];let _;return t[14]!==r.phase||t[15]!==p||t[16]!==m||t[17]!==h||t[18]!==g?(_=(0,Z.jsx)(`div`,{ref:a,role:`status`,"aria-live":p,"data-testid":`share-receive-miss-panel`,"data-phase":r.phase,"data-verdict":m,className:h,children:g}),t[14]=r.phase,t[15]=p,t[16]=m,t[17]=h,t[18]=g,t[19]=_):_=t[19],_}var nO=`ok-find`,rO=`ok-find-active`;function iO(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 aO(e){let t=(0,$.c)(61),{containerRef:n,onClose:r}=e,{_:i}=on(),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=iO(e,o.trim());return u(r),f(0),t.set(nO,new Highlight(...r)),()=>{t.delete(nO),t.delete(rO)}},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(rO);return}e.set(rO,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)(zf,{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)(Ul,{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)(Vl,{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)(hf,{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 oO(e){let t=(0,$.c)(9),{text:n}=e,r;t[0]===n?r=t[1]:(r=Qo(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=zo(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)(sO,{keyName:e,value:n},`${e}-${t}`)},t[7]=i,t[8]=c),a=(0,Z.jsx)(wl,{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 sO(e){let t=(0,$.c)(9),{keyName:n,value:r}=e,i=xl[ns(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)(cO,{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)(Cl,{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 cO(e){let t=(0,$.c)(8),{keyName:n,value:r}=e;if(_l(r)){let e;return t[0]!==n||t[1]!==r?(e=(0,Z.jsx)(Pl,{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(lO).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 lO(e){return typeof e==`string`}function uO(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=ho(r).body,n;if(t[8]!==a||t[9]!==s||t[10]!==o){let e=a?Te.map(e=>e.name===`link`?e.configure({docName:a}):e):Te;n=o?[...e,pe.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=zr,l=i,u=!1,d=Er().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)(dO),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)(oO,{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)(Sr,{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,Pg.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 dO(){let e=document.createElement(`div`);return e.style.display=`contents`,e}var fO=`data-skill-markdown`;function pO(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=>Qp({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=Ym(s);if(c.status===`loading`){let e;return t[5]===o?e=t[6]:(e=(0,Z.jsx)(eh,{fileName:o,dataAttr:fO}),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)(Qm,{fileName:o,dataAttr:fO,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=Uo(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=Po(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)(uO,{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 mO(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)&&ys(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 hO=new Set([`md`,`mdx`]);function gO(e){let t=(0,$.c)(18),{scope:n,name:r,path:i,host:a}=e,{_:o}=on(),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=hO.has(p),{findOpen:h,setFindOpen:g}=mO(m?c:l),_=hO.has(p)?(0,Z.jsx)(pO,{scope:n,name:r,path:i,host:a,fileName:d}):(0,Z.jsx)(Xm,{fileName:d,extension:p,loadText:e=>Qp({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)(aO,{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)(sd,{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 _O=[`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 vO(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return _O[Math.abs(t)%_O.length]??_O[0]}var yO=`SKILL.md`,bO=new Map;function xO(e){let t=(0,$.c)(42),{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}=on(),_=`${n}::${r}`,v;t[0]===_?v=t[1]:(v=()=>bO.get(_)??null,t[0]=_,t[1]=v);let[y,b]=(0,Q.useState)(v),x;t[2]===_?x=t[3]:(x=()=>bO.has(_),t[2]=_,t[3]=x);let[S,C]=(0,Q.useState)(x),w=d??yO,T=(0,Q.useRef)(null),E=(0,Q.useRef)(null),{findOpen:D,setFindOpen:O}=mO(T),k,A;t[4]!==r||t[5]!==n?(k=()=>{let e=`${n}::${r}`,t=new AbortController;bO.has(e)||cm({source:n,name:r},t.signal).then(n=>{t.signal.aborted||(n.ok&&(bO.set(e,n),b(n)),C(!0))});let i=Hs(wO);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?TO(y.skillMd):[],n;t[30]!==g||t[31]!==y||t[32]!==w?(n=w===yO?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[30]=g,t[31]=y,t[32]=w,t[33]=n):n=t[33];let u=n,d;t[34]!==D||t[35]!==O?(d=D?(0,Z.jsx)(aO,{containerRef:E,onClose:()=>O(!1)}):null,t[34]=D,t[35]=O,t[36]=d):d=t[36];let m;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(sd,{className:`size-4`,"aria-hidden":!0}),t[37]=m):m=t[37];let _;t[38]!==o||t[39]!==s||t[40]!==h?(_=(0,Z.jsx)(_h,{icon:m,actions:o,reserveRightGutter:h,children:s}),t[38]=o,t[39]=s,t[40]=h,t[41]=_):_=t[41],P=(0,Z.jsxs)(`div`,{ref:T,className:`relative flex h-full min-h-0 flex-col`,children:[d,_,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===yO?l:null,w===yO?(0,Z.jsx)(`div`,{className:`editor-content-aligned pt-6`,children:(0,Z.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Z.jsx)(Cl,{icon:(0,Z.jsx)(hl,{className:`size-3.5`}),label:g({id:`XmJfZT`}),children:(0,Z.jsx)(`span`,{className:`font-mono`,children:r})}),N?(0,Z.jsx)(Cl,{icon:(0,Z.jsx)(vy,{className:`size-3.5`}),label:g({id:`eTsJYJ`}),children:(0,Z.jsx)(`p`,{className:`text-foreground/80`,children:N})}):null,(0,Z.jsx)(Cl,{icon:(0,Z.jsx)(my,{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(CO)}):(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`N2S1rs`})})})]})}):null,u?.md?(0,Z.jsx)(uO,{flow:!0,fileName:u.path,text:u.content,linkBaseDocName:f?Uo(f,r,w===yO?`SKILL`:w):void 0,skillPathLinkDocName:f?Po(f,r):void 0,onBundlePathClick:p}):u?(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:u.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 ${vO(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(SO)]})})})]}),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 SO(e){return(0,Z.jsx)(`div`,{className:`h-4 w-11/12 animate-pulse rounded bg-muted`},e)}function CO(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 wO(){return bO.clear()}function TO(e){try{let{frontmatter:t}=ho(e);return t?uo(ms(t)):[]}catch{return[]}}function EO(e){let t=(0,$.c)(119),{bundle:n,source:r,defaultScope:i,onInstalled:a,onOpenChange:o}=e,{_:s}=on(),c=(0,Q.useId)(),l=Tp(),[u,d]=(0,Q.useState)(i),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=new Set,t[0]=f):f=t[0];let[p,m]=(0,Q.useState)(f),[h,g]=(0,Q.useState)(!1),_;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(_=new Map,t[1]=_):_=t[1];let[v,y]=(0,Q.useState)(_),b=ju(),[x,S]=(0,Q.useState)(null),C=b.state.status===`ready`?b.state.data.targets:null,w;t[2]!==C||t[3]!==x?(w=x??new Set(C??[]),t[2]=C,t[3]=x,t[4]=w):w=t[4];let T=w,E=n!==null,D,O;if(t[5]!==i||t[6]!==E||t[7]!==r?(D=()=>{if(!E)return;m(new Set),S(null),d(i);let e=new AbortController;return rm(r,e.signal).then(t=>{e.signal.aborted||!t.ok||y(new Map(t.skills.map(jO)))}),()=>e.abort()},O=[E,r,i],t[5]=i,t[6]=E,t[7]=r,t[8]=D,t[9]=O):(D=t[8],O=t[9]),(0,Q.useEffect)(D,O),!n)return null;let{plugin:k,names:A}=n,j=p.size===A.length&&A.length>0,M;t[10]===p?M=t[11]:(M=function(e,t){let n=new Set(p);t?n.add(e):n.delete(e),m(n)},t[10]=p,t[11]=M);let N=M,P;t[12]!==s||t[13]!==T||t[14]!==a||t[15]!==o||t[16]!==k||t[17]!==u||t[18]!==p||t[19]!==r?(P=async function(){g(!0);let e=await sm({source:r,skills:[...p],scope:u,install:!1,marketplace:!0});if(!e.ok){g(!1),Ns.error(s({id:`Lbl6KA`,values:{0:k??r,1:e.error}}));return}let t=e.results.map(AO).filter(kO),n=[...T];if(n.length>0)for(let e of t){let t=await am({scope:u,name:e,targets:n,linkMode:!0});t.ok||Ns.error(s({id:`1oSHI0`,values:{0:t.error,skillName:e}}))}g(!1);let{imported:i,alreadyImported:c,failed:l}=e;if(l>0){let t=e.results.filter(OO).map(DO).join(`, `);Ns.error(s({id:`cMMb6H`,values:{imported:i,failed:l,failedNames:t}}))}else i===0?Ns.info(s({id:`uJfwF8`})):c>0?Ns.success(s({id:`tkIXtS`,values:{imported:i,alreadyImported:c}})):Ns.success(s({id:`-kKdCC`,values:{0:k??r,imported:i}}));let d=new Map;for(let t of e.results)t.status!==`imported`&&t.status!==`already-imported`||d.set(t.requested,t.name??t.requested);d.size>0&&a?.(d),o(!1)},t[12]=s,t[13]=T,t[14]=a,t[15]=o,t[16]=k,t[17]=u,t[18]=p,t[19]=r,t[20]=P):P=t[20];let F=P,I;t[21]!==h||t[22]!==o?(I=e=>{!e&&!h&&o(!1)},t[21]=h,t[22]=o,t[23]=I):I=t[23];let L;t[24]!==k||t[25]!==r?(L=(0,Z.jsx)(hr,{children:k?(0,Z.jsx)(Y,{id:`J86siq`,values:{plugin:k}}):(0,Z.jsx)(Y,{id:`Q-DKvr`,values:{source:r}})}),t[24]=k,t[25]=r,t[26]=L):L=t[26];let R;t[27]===k?R=t[28]:(R=(0,Z.jsx)(mr,{children:k?(0,Z.jsx)(Y,{id:`lj4cNf`}):(0,Z.jsx)(Y,{id:`4mDIcg`})}),t[27]=k,t[28]=R);let z;t[29]!==R||t[30]!==L?(z=(0,Z.jsxs)(yr,{children:[L,R]}),t[29]=R,t[30]=L,t[31]=z):z=t[31];let B;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(Y,{id:`oCHfGC`}),t[32]=B):B=t[32];let V;t[33]===c?V=t[34]:(V=(0,Z.jsx)(Ci,{htmlFor:c,children:B}),t[33]=c,t[34]=V);let H;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>d(e),t[35]=H):H=t[35];let U;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(Oi,{}),t[36]=U):U=t[36];let W;t[37]===c?W=t[38]:(W=(0,Z.jsx)(Di,{id:c,className:`w-full`,children:U}),t[37]=c,t[38]=W);let ee;t[39]===l?ee=t[40]:(ee=Ap.map(e=>(0,Z.jsx)(Ti,{value:e,children:l[e]},e)),t[39]=l,t[40]=ee);let G;t[41]===ee?G=t[42]:(G=(0,Z.jsx)(Ei,{children:ee}),t[41]=ee,t[42]=G);let K;t[43]!==u||t[44]!==W||t[45]!==G?(K=(0,Z.jsxs)(ki,{value:u,onValueChange:H,children:[W,G]}),t[43]=u,t[44]=W,t[45]=G,t[46]=K):K=t[46];let q;t[47]!==V||t[48]!==K?(q=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[V,K]}),t[47]=V,t[48]=K,t[49]=q):q=t[49];let te;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(Ci,{children:(0,Z.jsx)(Y,{id:`Y5la_5`})}),t[50]=te):te=t[50];let J;t[51]!==h||t[52]!==T?(J=jc.map(e=>(0,Z.jsxs)(Ci,{className:`flex cursor-pointer items-center gap-2 text-sm font-normal`,children:[(0,Z.jsx)(Hr,{checked:T.has(e),disabled:h,onCheckedChange:t=>{let n=new Set(T);t===!0?n.add(e):n.delete(e),S(n)}}),_s[e]??e]},e)),t[51]=h,t[52]=T,t[53]=J):J=t[53];let ne;t[54]===J?ne=t[55]:(ne=(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-2`,children:J}),t[54]=J,t[55]=ne);let re;t[56]===T.size?re=t[57]:(re=T.size===0?(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`7ZkJdV`})}):null,t[56]=T.size,t[57]=re);let ie;t[58]!==ne||t[59]!==re?(ie=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[te,ne,re]}),t[58]=ne,t[59]=re,t[60]=ie):ie=t[60];let ae;t[61]!==A.length||t[62]!==p.size?(ae=(0,Z.jsx)(`p`,{className:`font-medium text-xs font-mono text-muted-foreground/80 uppercase tracking-wider`,children:(0,Z.jsx)(Y,{id:`lUtr1r`,values:{0:p.size,1:A.length}})}),t[61]=A.length,t[62]=p.size,t[63]=ae):ae=t[63];let oe;t[64]!==j||t[65]!==A?(oe=()=>m(j?new Set:new Set(A)),t[64]=j,t[65]=A,t[66]=oe):oe=t[66];let se;t[67]===j?se=t[68]:(se=j?(0,Z.jsx)(Y,{id:`xCJdfg`}):(0,Z.jsx)(Y,{id:`wgNoIs`}),t[67]=j,t[68]=se);let ce;t[69]!==h||t[70]!==oe||t[71]!==se?(ce=(0,Z.jsx)(X,{variant:`ghost`,size:`sm`,disabled:h,onClick:oe,children:se}),t[69]=h,t[70]=oe,t[71]=se,t[72]=ce):ce=t[72];let le;t[73]!==ae||t[74]!==ce?(le=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[ae,ce]}),t[73]=ae,t[74]=ce,t[75]=le):le=t[75];let ue;if(t[76]!==h||t[77]!==v||t[78]!==A||t[79]!==p||t[80]!==N){let e;t[82]!==h||t[83]!==v||t[84]!==p||t[85]!==N?(e=e=>{let t=v.get(e);return(0,Z.jsxs)(Ci,{className:`flex cursor-pointer items-start gap-3 p-3 text-sm font-normal hover:bg-muted/40`,children:[(0,Z.jsx)(Hr,{checked:p.has(e),disabled:h,onCheckedChange:t=>N(e,t===!0),className:`mt-0.5`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,Z.jsx)(`span`,{className:`font-mono`,children:e}),t?(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground line-clamp-2`,children:t}):null]})]},e)},t[82]=h,t[83]=v,t[84]=p,t[85]=N,t[86]=e):e=t[86],ue=A.map(e),t[76]=h,t[77]=v,t[78]=A,t[79]=p,t[80]=N,t[81]=ue}else ue=t[81];let de;t[87]===ue?de=t[88]:(de=(0,Z.jsx)(`div`,{className:`max-h-72 overflow-y-auto rounded-md border border-border divide-y divide-border`,children:ue}),t[87]=ue,t[88]=de);let fe;t[89]!==q||t[90]!==ie||t[91]!==le||t[92]!==de?(fe=(0,Z.jsxs)(_r,{className:`flex flex-col gap-4`,children:[q,ie,le,de]}),t[89]=q,t[90]=ie,t[91]=le,t[92]=de,t[93]=fe):fe=t[93];let pe;t[94]===o?pe=t[95]:(pe=()=>o(!1),t[94]=o,t[95]=pe);let me;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsx)(Y,{id:`dEgA5A`}),t[96]=me):me=t[96];let he;t[97]!==h||t[98]!==pe?(he=(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,disabled:h,onClick:pe,children:me}),t[97]=h,t[98]=pe,t[99]=he):he=t[99];let ge=h||p.size===0,_e;t[100]===F?_e=t[101]:(_e=()=>void F(),t[100]=F,t[101]=_e);let ve;t[102]===h?ve=t[103]:(ve=h?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(xd,{"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(Y,{id:`Wtw22s`})]}):(0,Z.jsx)(Y,{id:`4wo5UV`}),t[102]=h,t[103]=ve);let ye;t[104]!==ge||t[105]!==_e||t[106]!==ve?(ye=(0,Z.jsx)(X,{"data-testid":`plugin-bundle-install`,disabled:ge,onClick:_e,children:ve}),t[104]=ge,t[105]=_e,t[106]=ve,t[107]=ye):ye=t[107];let be;t[108]!==he||t[109]!==ye?(be=(0,Z.jsxs)(vr,{children:[he,ye]}),t[108]=he,t[109]=ye,t[110]=be):be=t[110];let xe;t[111]!==z||t[112]!==fe||t[113]!==be?(xe=(0,Z.jsxs)(gr,{className:`sm:max-w-lg`,children:[z,fe,be]}),t[111]=z,t[112]=fe,t[113]=be,t[114]=xe):xe=t[114];let Se;return t[115]!==E||t[116]!==xe||t[117]!==I?(Se=(0,Z.jsx)(br,{open:E,onOpenChange:I,children:xe}),t[115]=E,t[116]=xe,t[117]=I,t[118]=Se):Se=t[118],Se}function DO(e){return e.requested}function OO(e){return e.status===`failed`||e.status===`not-found`}function kO(e){return typeof e==`string`}function AO(e){return e.name}function jO(e){return[e.name,e.description]}var MO=ar(`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 NO(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=Bn(MO({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 PO(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=Bn(`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 FO(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=Bn(`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 IO(e){let t=(0,$.c)(43),{bundle:n,source:r,scope:i,onInstalled:a}=e,{_:o}=on(),[s,c]=(0,Q.useState)(!1);if(n.names.length<=1)return null;let l;t[0]!==o||t[1]!==n.capabilities?.hooks?(l=n.capabilities?.hooks?o({id:`8fDf7j`}):null,t[0]=o,t[1]=n.capabilities?.hooks,t[2]=l):l=t[2];let u;t[3]!==o||t[4]!==n.capabilities?.commands?(u=n.capabilities?.commands?o({id:`9HKBNN`}):null,t[3]=o,t[4]=n.capabilities?.commands,t[5]=u):u=t[5];let d;t[6]!==o||t[7]!==n.capabilities?.mcp?(d=n.capabilities?.mcp?o({id:`8qgfac`}):null,t[6]=o,t[7]=n.capabilities?.mcp,t[8]=d):d=t[8];let f;t[9]!==o||t[10]!==n.capabilities?.agents?(f=n.capabilities?.agents?o({id:`EpZQFw`}):null,t[9]=o,t[10]=n.capabilities?.agents,t[11]=f):f=t[11];let p;t[12]!==l||t[13]!==u||t[14]!==d||t[15]!==f?(p=[l,u,d,f].filter(LO),t[12]=l,t[13]=u,t[14]=d,t[15]=f,t[16]=p):p=t[16];let m=p,h=n.names.length,g=n.plugin,_;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(qd,{className:`size-4`,"aria-hidden":!0}),t[17]=_):_=t[17];let v;t[18]!==h||t[19]!==g?(v=(0,Z.jsx)(PO,{children:g?(0,Z.jsx)(Y,{id:`3l32hp`,values:{plugin:g}}):(0,Z.jsx)(Y,{id:`_mcDqU`,values:{count:h}})}),t[18]=h,t[19]=g,t[20]=v):v=t[20];let y;t[21]!==m||t[22]!==h||t[23]!==g||t[24]!==r?(y=(0,Z.jsx)(FO,{className:`min-w-0`,children:m.length>0?(0,Z.jsx)(Y,{id:`aR4DgO`,values:{0:m.join(`, `),count:h}}):g?(0,Z.jsx)(Y,{id:`zt9ZgM`,values:{count:h}}):(0,Z.jsx)(Y,{id:`wefL17`,values:{source:r,count:h}})}),t[21]=m,t[22]=h,t[23]=g,t[24]=r,t[25]=y):y=t[25];let b;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(X,{variant:`outline`,size:`sm`,"data-testid":`plugin-bundle-pick`,onClick:()=>c(!0),children:(0,Z.jsx)(Y,{id:`XVnIvs`})}),t[26]=b):b=t[26];let x;t[27]===n.repositoryUrl?x=t[28]:(x=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)(dl,{className:`size-3.5`})]})}):null,t[27]=n.repositoryUrl,t[28]=x);let S;t[29]===x?S=t[30]:(S=(0,Z.jsxs)(`div`,{className:`mt-2.5 flex items-center gap-2 group-has-[>svg]/alert:col-start-2`,children:[b,x]}),t[29]=x,t[30]=S);let C;t[31]!==S||t[32]!==v||t[33]!==y?(C=(0,Z.jsxs)(NO,{role:`note`,className:`my-3 bg-muted/40 px-4 py-3`,children:[_,v,y,S]}),t[31]=S,t[32]=v,t[33]=y,t[34]=C):C=t[34];let w=s?n:null,T;t[35]!==a||t[36]!==i||t[37]!==r||t[38]!==w?(T=(0,Z.jsx)(EO,{bundle:w,source:r,defaultScope:i,onInstalled:a,onOpenChange:c}),t[35]=a,t[36]=i,t[37]=r,t[38]=w,t[39]=T):T=t[39];let E;return t[40]!==C||t[41]!==T?(E=(0,Z.jsxs)(`div`,{className:`editor-content-aligned`,children:[C,T]}),t[40]=C,t[41]=T,t[42]=E):E=t[42],E}function LO(e){return e!==null}function RO(e){let t=(0,$.c)(27),{source:n,name:r,initialScope:i,marketplace:a}=e,{_:o}=on(),[s,c]=(0,Q.useState)(i),[l,u]=(0,Q.useState)(null),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=[],t[0]=d):d=t[0];let[f,p]=(0,Q.useState)(d),[m,h]=(0,Q.useState)(!1),g;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(g=[],t[1]=g):g=t[1];let _=(0,Q.useRef)(g),v=(0,Q.useRef)(null),y=(0,Q.useRef)(null),b=(0,Q.useRef)(null),x;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(x=[],t[2]=x):x=t[2];let S=(0,Q.useRef)(x),C=(0,Q.useRef)(!1),w;t[3]!==o||t[4]!==a||t[5]!==r||t[6]!==s||t[7]!==n?(w=async function(){if(v.current)return v.current;if(b.current)return b.current;let e=s,t=tm({source:n,skill:r,scope:e,install:!1,...a?{marketplace:!0}:{}}).then(t=>t.ok?(v.current=t.name,y.current=e,u(t.name),t.name):(Ns.error(o({id:`oX-rVu`,values:{0:t.error}})),null));b.current=t;let i=await t;return b.current=null,i},t[3]=o,t[4]=a,t[5]=r,t[6]=s,t[7]=n,t[8]=w):w=t[8];let T=w,E;t[9]!==o||t[10]!==T?(E=async function(e){if(_.current=e,S.current=e,p(e),!C.current){for(C.current=!0,h(!0);;){let e=S.current,t=await T(),n=y.current;if(!t||!n)break;let r=await am({scope:n,name:t,targets:[...e],linkMode:!0});if(!r.ok){Ns.error(o({id:`s-pW_v`,values:{0:r.error}}));break}if(e===S.current){let e=_.current.filter(zO),t=[...new Set([...e,...r.hosts])];_.current=t,p(t);break}}C.current=!1,h(!1)}},t[9]=o,t[10]=T,t[11]=E):E=t[11];let D=E,O;t[12]===f?O=t[13]:(O=new Set(f),t[12]=f,t[13]=O);let k=f.length>0,A;t[14]!==o||t[15]!==m||t[16]!==D||t[17]!==T||t[18]!==O||t[19]!==k?(A={hostSet:O,installed:k,installing:m,toggleEditor(e,t){if(e===`agents`){if(!t)return;(async()=>{h(!0);let e=await T(),t=y.current;if(e&&t){let n=await $p({scope:t,name:e,dir:`.agents/skills`,mode:`copy`});if(n.ok){let e=[...new Set([..._.current,`agents`])];_.current=e,p(e)}else Ns.error(o({id:`s-pW_v`,values:{0:n.error}}))}h(!1)})();return}let n=new Set(_.current);t?n.add(e):n.delete(e),D([...n])},installAll(){D([...jc])},linkMode:!0,placeAt(e,t){(async()=>{h(!0);let n=await T(),r=y.current;if(n&&r){let i=await $p({scope:r,name:n,dir:e,mode:t});i.ok||Ns.error(o({id:`s-pW_v`,values:{0:i.error}}))}h(!1)})()}},t[14]=o,t[15]=m,t[16]=D,t[17]=T,t[18]=O,t[19]=k,t[20]=A):A=t[20];let j=A,M=l!==null||m,N;return t[21]!==T||t[22]!==l||t[23]!==s||t[24]!==M||t[25]!==j?(N={scope:s,setScope:c,scopeLocked:M,importedName:l,importNow:T,toggles:j},t[21]=T,t[22]=l,t[23]=s,t[24]=M,t[25]=j,t[26]=N):N=t[26],N}function zO(e){return!Da(e)}var BO=`SKILL.md`;function VO(e){let t=(0,$.c)(12),{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}=vh(i);if(!a)return null;let u;t[3]===o?u=t[4]:(u=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)(dl,{className:`h-3.5 w-3.5`})]})}):null,t[3]=o,t[4]=u);let d;t[5]!==c||t[6]!==l||t[7]!==s?(d=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[5]=c,t[6]=l,t[7]=s,t[8]=d):d=t[8];let f;return t[9]!==u||t[10]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex gap-1`,children:[u,d]}),t[9]=u,t[10]=d,t[11]=f):f=t[11],f}function HO(e){let t=(0,$.c)(92),{flavor:n,source:r,name:i,subtitle:a,level:o,reserveRightGutter:s,path:c}=e,l=c??BO,u=Tp(),d=pm(),[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 im({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`?yo(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 rm(r,e.signal).then(t=>{e.signal.aborted||!t.ok||D(t.skills.map(GO))}),()=>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===`foreign`,F=o??`project`,I=n===`explore`,L;t[17]!==i||t[18]!==r||t[19]!==I||t[20]!==F?(L={source:r,name:i,initialScope:F,marketplace:I},t[17]=i,t[18]=r,t[19]=I,t[20]=F,t[21]=L):L=t[21];let R=RO(L),z=(0,Q.useRef)(!1),[B,V]=(0,Q.useState)(null),H=R.importedName??B,U=(n===`explore`||P||v!==null)&&H!==null,W,ee;t[22]!==U||t[23]!==H||t[24]!==d||t[25]!==R.scope?(ee=()=>{!U||z.current||(z.current=!0,d(R.scope,H,{replaceActive:!0}))},W=[U,R.scope,H,d],t[22]=U,t[23]=H,t[24]=d,t[25]=R.scope,t[26]=W,t[27]=ee):(W=t[26],ee=t[27]),(0,Q.useEffect)(ee,W);let G;t[28]===a?G=t[29]:(G=a&&a.charAt(0).toUpperCase()+a.slice(1),t[28]=a,t[29]=G);let K=G,q=u[F],te;t[30]===i?te=t[31]:(te=(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`,children:i}),t[30]=i,t[31]=te);let J=te,ne;t[32]===q?ne=t[33]:(ne=(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`,children:q}),t[32]=q,t[33]=ne);let re=ne,ie;t[34]===K?ie=t[35]:(ie=(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`,children:K}),t[34]=K,t[35]=ie);let ae=ie,oe=v?.version?` (v${v.version})`:``,se;t[36]!==ae||t[37]!==re||t[38]!==J||t[39]!==N||t[40]!==M||t[41]!==P||t[42]!==v||t[43]!==oe||t[44]!==r?(se=N?(0,Z.jsx)(Y,{id:`rmorj0`,values:{boldName:J}}):v?(0,Z.jsx)(Y,{id:`UceXfW`,values:{0:v.plugin,boldName:J,pluginVersion:oe,boldHarness:ae},components:{0:(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`})}}):P?(0,Z.jsx)(Y,{id:`yhYv9j`,values:{boldName:J,source:r},components:{0:(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`})}}):M?(0,Z.jsx)(Y,{id:`UHwc0P`,values:{boldName:J,boldHarness:ae,boldLevel:re}}):(0,Z.jsx)(Y,{id:`fBoO7w`,values:{boldName:J}}),t[36]=ae,t[37]=re,t[38]=J,t[39]=N,t[40]=M,t[41]=P,t[42]=v,t[43]=oe,t[44]=r,t[45]=se):se=t[45];let ce=se,le;t[46]!==N||t[47]!==f||t[48]!==M||t[49]!==n||t[50]!==P||t[51]!==i||t[52]!==v||t[53]!==R||t[54]!==u.global||t[55]!==u.project||t[56]!==T||t[57]!==w||t[58]!==F?(le=N?(0,Z.jsx)(VO,{scope:F,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)(dl,{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)(dl,{className:`h-3.5 w-3.5`})]})}):null]}),v||!M?(0,Z.jsxs)(xi,{children:[(0,Z.jsx)(hi,{asChild:!0,children:(0,Z.jsx)(X,{size:`sm`,disabled:R.toggles.installing,"data-testid":v?`skill-preview-edit-a-copy`:P?`skill-preview-copy-in`:void 0,children:R.toggles.installing?v||P?(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`}):P?(0,Z.jsx)(Y,{id:`XBgr2S`}):(0,Z.jsx)(Y,{id:`TKQ7K-`}),(0,Z.jsx)(Vl,{className:`size-4 opacity-60`,"aria-hidden":!0})]})})}),(0,Z.jsxs)(yi,{align:`end`,className:Mc,children:[(0,Z.jsx)(_i,{children:(0,Z.jsx)(Y,{id:`oCHfGC`})}),(0,Z.jsxs)(ui,{value:R.scope,onValueChange:e=>R.setScope(e),children:[(0,Z.jsx)(mi,{value:`project`,disabled:R.scopeLocked,onSelect:WO,children:u.project}),(0,Z.jsx)(mi,{value:`global`,disabled:R.scopeLocked,onSelect:UO,children:u.global})]}),(0,Z.jsx)(Si,{}),(0,Z.jsx)(Bc,{toggles:R.toggles,skill:{scope:R.scope,name:i}})]})]}):null]}),t[46]=N,t[47]=f,t[48]=M,t[49]=n,t[50]=P,t[51]=i,t[52]=v,t[53]=R,t[54]=u.global,t[55]=u.project,t[56]=T,t[57]=w,t[58]=F,t[59]=le):le=t[59];let ue=le,de;t[60]!==n||t[61]!==o||t[62]!==i||t[63]!==r||t[64]!==a||t[65]!==F?(de=e=>n===`explore`?(window.location.hash=Tf({flavor:n,source:r,name:i,subtitle:a,level:o,path:e}),!0):(window.location.hash=Df({scope:F,name:i,path:e}),!0),t[60]=n,t[61]=o,t[62]=i,t[63]=r,t[64]=a,t[65]=F,t[66]=de):de=t[66];let fe=de,pe=a||i,me;t[67]!==M||t[68]!==n?(me=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[67]=M,t[68]=n,t[69]=me):me=t[69];let he;t[70]!==j||t[71]!==i||t[72]!==R.scope||t[73]!==r?(he=j?(0,Z.jsx)(IO,{bundle:j,source:r,scope:R.scope,onInstalled:e=>{let t=e.get(i);t!==void 0&&V(t)}}):void 0,t[70]=j,t[71]=i,t[72]=R.scope,t[73]=r,t[74]=he):he=t[74];let ge=N?F:void 0,_e;t[75]!==f||t[76]!==m?(_e=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[75]=f,t[76]=m,t[77]=_e):_e=t[77];let ve;return t[78]!==ue||t[79]!==ce||t[80]!==i||t[81]!==fe||t[82]!==s||t[83]!==l||t[84]!==r||t[85]!==a||t[86]!==pe||t[87]!==me||t[88]!==he||t[89]!==ge||t[90]!==_e?(ve=(0,Z.jsx)(xO,{source:r,name:i,subtitle:a,tintKey:pe,onBundlePathClick:fe,headerActions:ue,headerLine:ce,reserveRightGutter:s,selectedPath:l,onPreviewMeta:me,banner:he,scope:ge,noPreviewFallback:_e}),t[78]=ue,t[79]=ce,t[80]=i,t[81]=fe,t[82]=s,t[83]=l,t[84]=r,t[85]=a,t[86]=pe,t[87]=me,t[88]=he,t[89]=ge,t[90]=_e,t[91]=ve):ve=t[91],ve}function UO(e){return e.preventDefault()}function WO(e){return e.preventDefault()}function GO(e){return e.name}var KO=(0,Q.lazy)(()=>n(()=>import(`./ImportSkillDialog-R8BKwyCS.js`).then(e=>({default:e.ImportSkillDialog})),__vite__mapDeps([122,1,6,2,3,7,8,9,10,11,45,12,13,14,97,35,36,16,17,18,20,54,28,29,34,24,25,26,19,22,21,40,98,27,30,31,123,124,55,125,56,79,80,81,82,83,84,85,86,87,88,89,90,91,74,92,93,94,95,96,4,39,99,100,101,41,42,66,67,68,69,102,49,71,103,104,46,105,33,65,70,72,73,106,107,108,37,23,109,110,43,47,111,112,113,126,127,128,129,130,131,132,48]),import.meta.url)),qO=6;function JO(e){let t=(0,$.c)(41),{sessionsDockOpen:n}=e,r=n===void 0?!1:n,{_:i}=on(),a=tn()||r,[o,s]=(0,Q.useState)(null),c=pm(),{createBlank:l}=Gx(),{skills:u,isPending:d}=Jd(),f;t[0]===u?f=t[1]:(f=u.slice(0,qO),t[0]=u,t[1]=f);let p=f,h=d||p.length>0,g;t[2]===i?g=t[3]:(g=i({id:`ivwdwq`}),t[2]=i,t[3]=g);let _;t[4]===i?_=t[5]:(_=i({id:`6Mbe-P`}),t[4]=i,t[5]=_);let v;t[6]!==g||t[7]!==_?(v=(0,Z.jsx)(ZE,{title:g,subtitle:_,celebrateSignal:0}),t[6]=g,t[7]=_,t[8]=v):v=t[8];let y;t[9]===a?y=t[10]:(y=a?null:(0,Z.jsx)(JE,{scenario:`skill`}),t[9]=a,t[10]=y);let b;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>s(`upload`),t[11]=b):b=t[11];let x;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,onClick:b,"data-testid":`skill-source-upload`,className:`gap-1.5 font-normal text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(m,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`mShKiV`})]}),t[12]=x):x=t[12];let S;t[13]===l?S=t[14]:(S=()=>void l(`project`),t[13]=l,t[14]=S);let C,w;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(jr,{"aria-hidden":`true`,className:`size-3.5`}),w=(0,Z.jsx)(Y,{id:`dJXrT9`}),t[15]=C,t[16]=w):(C=t[15],w=t[16]);let T;t[17]===S?T=t[18]:(T=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,onClick:S,"data-testid":`skill-source-new`,className:`gap-1.5 font-normal text-muted-foreground hover:text-foreground`,children:[C,w]}),t[17]=S,t[18]=T);let E;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>s(`skills-sh`),t[19]=E):E=t[19];let D;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,onClick:E,"data-testid":`skill-source-skills-sh`,className:`gap-1.5 font-normal text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(Sv,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`EBS8_X`})]}),t[20]=D):D=t[20];let O;t[21]===T?O=t[22]:(O=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[x,T,D]}),t[21]=T,t[22]=O);let k;t[23]!==O||t[24]!==y?(k=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[y,O]}),t[23]=O,t[24]=y,t[25]=k):k=t[25];let A;t[26]!==i||t[27]!==p||t[28]!==d||t[29]!==h?(A=h?(0,Z.jsx)(Kd,{scope:`project`,results:p,pending:d,skeletonCount:qO,testId:`skills-popular`,loadingLabel:i({id:`JDHcCM`}),label:(0,Z.jsx)(Y,{id:`3v62tp`}),action:d?null:(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>s(`skills-sh`),"data-testid":`skill-popular-browse-all`,className:`h-auto gap-1 py-0.5 font-mono text-2xs uppercase tracking-wider text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(Y,{id:`O-m8q9`}),(0,Z.jsx)(ll,{"aria-hidden":`true`,className:`size-3`})]})}):null,t[26]=i,t[27]=p,t[28]=d,t[29]=h,t[30]=A):A=t[30];let j;t[31]!==k||t[32]!==A||t[33]!==v?(j=(0,Z.jsxs)(`div`,{className:`my-auto w-full max-w-4xl space-y-6`,children:[v,k,A]}),t[31]=k,t[32]=A,t[33]=v,t[34]=j):j=t[34];let M;t[35]!==o||t[36]!==c?(M=o===null?null:(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(KO,{defaultScope:`project`,defaultTab:o,open:!0,onOpenChange:e=>{e||s(null)},onImported:e=>{let{scope:t,name:n}=e;s(null),c(t,n)}})}),t[35]=o,t[36]=c,t[37]=M):M=t[37];let N;return t[38]!==j||t[39]!==M?(N=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col items-center overflow-auto subtle-scrollbar p-10`,children:[j,M]}),t[38]=j,t[39]=M,t[40]=N):N=t[40],N}function YO(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var XO=YO(()=>n(()=>import(`./SettingsDialogBody-DPjbScQ8.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([133,1,134,18,14,6,2,3,7,8,9,10,11,91,45,74,24,13,92,93,94,95,96,12,97,35,36,16,17,20,54,28,29,34,25,26,19,22,21,40,98,135,27,30,31,79,80,81,82,83,84,85,86,87,88,89,90,4,39,99,100,101,41,42,66,67,68,69,102,49,71,103,104,46,105,33,65,70,72,73,106,107,108,37,23,109,110,43,47,111,112,113,126,136,137,138,55,116,117,139,15,123,124,140,53,56,141,64,142,143,144,145,146,147,48,50,148,149,150,151,152,153,154,155,156,128,157,158,132,159,160,161,131]),import.meta.url));function ZO(e){let t=(0,$.c)(9),{error:n}=e,{_:r}=on(),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:QO,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 QO(){return window.location.reload()}function $O(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(Pn,{fallbackRender:tk,onError:ek,children:n}),t[0]=n,t[1]=r),r}function ek(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function tk(e){return(0,Z.jsx)(ZO,{...e})}function nk(e=typeof window>`u`?void 0:window.location){return e?.protocol===`file:`}function rk(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,keywords:[e.label]});for(let e of Bu)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 Ro)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 ik(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}function ak(e){let t=(0,$.c)(46),{open:n,initialSection:r,onOpenChange:i}=e,a=r===void 0?null:r,{_:o}=on(),{collabUrl:s}=Oe(),{userBinding:c,userSynced:l,okignoreBinding:u,okignoreSynced:d,projectConfig:f,merged:p}=xc(),{desktopPresent:m}=Qu(),[h,g]=(0,Q.useState)(a??`preferences`),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(null),C=(0,Q.useRef)(0),w=(0,Q.useRef)(null),T,E;t[0]!==a||t[1]!==n?(T=()=>{n&&(g(a??`preferences`),v(``))},E=[n,a],t[0]=a,t[1]=n,t[2]=T,t[3]=E):(T=t[2],E=t[3]),(0,Q.useEffect)(T,E);let D,O;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>Os(g),O=[],t[4]=D,t[5]=O):(D=t[4],O=t[5]),(0,Q.useEffect)(D,O);let k,A;t[6]===y?(k=t[7],A=t[8]):(k=()=>{if(!y)return;let e=w.current;if(!e)return;let t=null,n=null,r=null,i=null,a=()=>{let r=e.querySelector(`[data-field="${y.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`)}},A=[y],t[6]=y,t[7]=k,t[8]=A),(0,Q.useEffect)(k,A);let j=s!==null,M=typeof window<`u`&&window.okDesktop!=null,N=M&&window.okDesktop?.config.ptyAvailable===!0,P,F;if(t[9]!==o||t[10]!==m||t[11]!==j||t[12]!==p?.appearance?.colorThemeEnabled||t[13]!==p?.slides?.enabled||t[14]!==f?.contentRules){let e;t[17]===f?.contentRules?e=t[18]:(e=e=>f?.contentRules?.[e.id]?.enabled===!0,t[17]=f?.contentRules,t[18]=e);let n=Fm.filter(e).map(ok),r=p?.appearance?.colorThemeEnabled!==!1,i=p?.slides?.enabled===!0,a=nk();P=[{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:`PCSkw2`})},...M?[{id:`ai-tools`,label:o({id:`_5qBNl`})}]:[]]},{id:`project`,label:o({id:`ZWyHmq`}),enabled:j,items:[{id:`sync`,label:o({id:`Nu4DdT`})},{id:`search`,label:o({id:`A1taO8`})},{id:`plugins-manage`,label:o({id:`ohUJJM`})},{id:`content-rules`,label:o({id:`OPOiKn`})},...a?[]:[{id:`link-previews`,label:o({id:`gh27t1`})}],...N?[{id:`terminal`,label:o({id:`ALhMYW`})}]:[],...M?[{id:`project-ai-tools`,label:o({id:`crqzW5`})}]:[],{id:`project-templates`,label:o({id:`iTylMl`})},{id:`skills`,label:o({id:`PCSkw2`})},{id:`okignore`,label:o({id:`3zyg_A`})},{id:`sharing`,label:o({id:`cs4mps`})}]},{id:`plugins`,label:o({id:`ohUJJM`}),enabled:!0,items:[...j?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:[]}],F=rk({groups:P,translate:o}),t[9]=o,t[10]=m,t[11]=j,t[12]=p?.appearance?.colorThemeEnabled,t[13]=p?.slides?.enabled,t[14]=f?.contentRules,t[15]=P,t[16]=F}else P=t[15],F=t[16];let I=F,L;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(L=function(e){C.current+=1;let t=C.current;g(e.sectionId),e.kind===`field`&&e.targetField?b({path:e.targetField}):e.kind===`rule`&&e.ruleId&&S({query:e.ruleId,nonce:t}),v(``)},t[19]=L):L=t[19];let R=L,z;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(hr,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`Tz0i8g`})}),t[20]=z):z=t[20];let B;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(mr,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`RDrXh4`})}),t[21]=B):B=t[21];let V;t[22]!==h||t[23]!==P||t[24]!==I||t[25]!==_?(V=(0,Z.jsx)(sk,{groups:P,activeId:h,onSelect:g,entries:I,searchQuery:_,onSearchChange:v,onNavigate:R}),t[22]=h,t[23]=P,t[24]=I,t[25]=_,t[26]=V):V=t[26];let H;t[27]===o?H=t[28]:(H=o({id:`OXb_Df`}),t[27]=o,t[28]=H);let U;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(hk,{}),t[29]=U):U=t[29];let W=l?c:null,ee;t[30]!==h||t[31]!==u||t[32]!==d||t[33]!==x||t[34]!==W?(ee=(0,Z.jsx)($O,{children:(0,Z.jsx)(Q.Suspense,{fallback:U,children:(0,Z.jsx)(XO,{activeId:h,userBinding:W,okignoreBinding:u,okignoreSynced:d,markdownlintRuleQuery:x})})}),t[30]=h,t[31]=u,t[32]=d,t[33]=x,t[34]=W,t[35]=ee):ee=t[35];let G;t[36]!==H||t[37]!==ee?(G=(0,Z.jsx)(`section`,{ref:w,"aria-label":H,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain subtle-scrollbar p-6`,tabIndex:0,children:ee}),t[36]=H,t[37]=ee,t[38]=G):G=t[38];let K;t[39]!==V||t[40]!==G?(K=(0,Z.jsxs)(gr,{className:`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))]`,"data-testid":`settings-dialog`,children:[z,B,V,G]}),t[39]=V,t[40]=G,t[41]=K):K=t[41];let q;return t[42]!==i||t[43]!==n||t[44]!==K?(q=(0,Z.jsx)(br,{open:n,onOpenChange:i,children:K}),t[42]=i,t[43]=n,t[44]=K,t[45]=q):q=t[45],q}function ok(e){return{id:`plugin:${e.id}`,label:e.label}}function sk(e){let t=(0,$.c)(46),{groups:n,activeId:r,onSelect:i,entries:a,searchQuery:o,onSearchChange:s,onNavigate:c}=e,{_:l}=on(),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=>Ib(e.label,d,e.keywords)),n=e.filter(uk),r=e.filter(lk),i=e.filter(ck);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=Lt,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)(ke,{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)(Nt,{"data-testid":`settings-search-results`,className:`mt-1.5`,children:[(0,Z.jsx)(kt,{"data-testid":`settings-search-empty`,children:(0,Z.jsx)(Y,{id:`ljFWEt`})}),n.length>0?(0,Z.jsx)(nt,{heading:l({id:`R4OWFD`}),children:n.map(e=>(0,Z.jsx)(dk,{entry:e,query:d,onNavigate:c},e.id))}):null,r.length>0?(0,Z.jsx)(nt,{heading:l({id:`Tz0i8g`}),children:r.map(e=>(0,Z.jsx)(dk,{entry:e,query:d,onNavigate:c},e.id))}):null,i.length>0?(0,Z.jsx)(nt,{heading:l({id:`v2a04T`}),children:i.map(e=>(0,Z.jsx)(dk,{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)(mk,{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)(pk,{}),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 ck(e){return e.kind===`rule`}function lk(e){return e.kind===`field`}function uk(e){return e.kind===`section`}function dk(e){let t=(0,$.c)(13),{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=Nb(n.label,r).map(fk),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:`truncate`,children:c}),t[6]=c,t[7]=l);let u;return t[8]!==n.id||t[9]!==o||t[10]!==s||t[11]!==l?(u=(0,Z.jsx)(xt,{value:a,onSelect:o,"data-testid":s,children:l}),t[8]=n.id,t[9]=o,t[10]=s,t[11]=l,t[12]=u):u=t[12],u}function fk(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 pk(){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=ik(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:Bn(`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)(dl,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=s):s=e[3],s}function mk(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=Bn(`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:Bn(`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 hk(){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)(Im,{className:`h-5 w-32`}),r=(0,Z.jsx)(Im,{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)(Im,{className:`h-9 w-full`}),(0,Z.jsx)(Im,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}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=Bn(`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)(DE,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function _k(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)(jE,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function vk(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=Bn(`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)(FE,{"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 yk(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}=on(),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)(bh,{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)(Rl,{"aria-hidden":`true`}),t[28]=F):F=t[28];let I;t[29]!==o||t[30]!==p||t[31]!==P?(I=(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(Fi,{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)(cr,{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)(Ey,{"aria-hidden":`true`}),t[38]=B):B=t[38];let V;t[39]!==m||t[40]!==z||t[41]!==s?(V=(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(Fi,{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 H;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(cr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`_7UQ7y`})}),t[43]=H):H=t[43];let U;t[44]===V?U=t[45]:(U=(0,Z.jsxs)(ur,{children:[V,H]}),t[44]=V,t[45]=U);let W;t[46]!==R||t[47]!==U?(W=(0,Z.jsxs)(yh,{align:`inline-end`,className:`gap-0.5`,children:[R,U]}),t[46]=R,t[47]=U,t[48]=W):W=t[48];let ee;t[49]!==W||t[50]!==N?(ee=(0,Z.jsxs)(xh,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[N,W]}),t[49]=W,t[50]=N,t[51]=ee):ee=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 K;t[54]===b?K=t[55]:(K=b({id:`oqB2ez`}),t[54]=b,t[55]=K);let q=!S,te;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(Ul,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=te):te=t[56];let J;t[57]!==g||t[58]!==K||t[59]!==q?(J=(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":K,disabled:q,onClick:g,children:te})}),t[57]=g,t[58]=K,t[59]=q,t[60]=J):J=t[60];let ne;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(cr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`oqB2ez`})}),t[61]=ne):ne=t[61];let re;t[62]===J?re=t[63]:(re=(0,Z.jsxs)(ur,{children:[J,ne]}),t[62]=J,t[63]=re);let ie;t[64]===b?ie=t[65]:(ie=b({id:`SiUUCS`}),t[64]=b,t[65]=ie);let ae=!S,oe;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(Vl,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=oe):oe=t[66];let se;t[67]!==h||t[68]!==ie||t[69]!==ae?(se=(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ie,disabled:ae,onClick:h,children:oe})}),t[67]=h,t[68]=ie,t[69]=ae,t[70]=se):se=t[70];let ce;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,Z.jsx)(cr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`SiUUCS`})}),t[71]=ce):ce=t[71];let le;t[72]===se?le=t[73]:(le=(0,Z.jsxs)(ur,{children:[se,ce]}),t[72]=se,t[73]=le);let ue=a?`secondary`:`ghost`,de;t[74]!==b||t[75]!==a?(de=b(a?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=b,t[75]=a,t[76]=de):de=t[76];let fe=a?`ok-replace-input`:void 0,pe;t[77]!==f||t[78]!==a?(pe=()=>f(!a),t[77]=f,t[78]=a,t[79]=pe):pe=t[79];let me;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsx)(iy,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=me):me=t[80];let he;t[81]!==a||t[82]!==ue||t[83]!==de||t[84]!==fe||t[85]!==pe?(he=(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:ue,size:`icon-sm`,"aria-label":de,"aria-expanded":a,"aria-controls":fe,onClick:pe,children:me})}),t[81]=a,t[82]=ue,t[83]=de,t[84]=fe,t[85]=pe,t[86]=he):he=t[86];let ge;t[87]===a?ge=t[88]:(ge=(0,Z.jsx)(cr,{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)(zf,{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)(sr,{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)(iy,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(cr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`bS_boY`})})]}),(0,Z.jsxs)(ur,{children:[(0,Z.jsx)(sr,{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)(ry,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(cr,{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)(hf,{"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)(sr,{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)(cr,{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]!==ee||t[111]!==G||t[112]!==re||t[113]!==le||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,ee,G,re,le,_e,ve,Ce]}),t[110]=ee,t[111]=G,t[112]=re,t[113]=le,t[114]=k,t[115]=_e,t[116]=ve,t[117]=Ce,t[118]=we):we=t[118],we}var bk={current:0,total:0},xk=120,Sk=100;function Ck(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?Ee(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)($t,n,wk)}function wk(){return null}function Tk(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-Bvv5kEhb.js","./chunk-CYidjpOJ.js","./preload-helper-Chd9yIcd.js","./trace-api-18gcBe0u.js","./propagation-api-PBYTadVM.js","./ReportBugDialogBody-BicwB-J9.js","./dist-8YlYwLg8.js","./lib-Bgq5iQnh.js","./html-void-elements-C35FEqss.js","./lib-C0Wr4O8I.js","./markdownit-C1Squg6O.js","./w3c-keyname-Bw5giFqP.js","./dist-Nvb76hAm.js","./jsx-runtime-BUgB2tll.js","./react-f2sANaYj.js","./checkbox-vidgONxv.js","./dist-DsLZcVyZ.js","./dist-mv8e6dBX.js","./react-dom-DPxgxlDT.js","./dist-DH4zqp8r.js","./dist-DX6BuR0m.js","./check-CGfmW4da.js","./createLucideIcon-Bhw2PmPp.js","./minus-D07ZsfDZ.js","./compiler-runtime-BfE3aGVn.js","./utils-CPqDy6Hr.js","./bundle-mjs-SHeFpKGC.js","./dialog-DztIj-ZS.js","./dist-BvwnbioL.js","./es2015-wpLRKwCl.js","./button-CA0dewJJ.js","./x-DS57FvHW.js","./progress-BdSO2c_8.js","./CopyButton-ByR_1gcU.js","./tooltip-DHXgxWLL.js","./dist-DmTWt7nC.js","./floating-ui.dom-By-yeALv.js","./spinner-BqySY7qY.js","./BugReportHistory-C59fSH13.js","./collapsible-COrqeoHr.js","./chevron-down-DabHDQTe.js","./folder-open-DUSc8NL8.js","./trash-2-N0ilsnnr.js","./badge-DFX4S3a5.js","./platform-labels-glrfxkSh.js","./dist-DUfEoSbR.js","./triangle-alert-COo6wbUK.js","./input-BYiOK210.js","./textarea-yZk4yd9U.js","./external-link-BIMZpgNa.js","./clipboard-adapter-DqemxSWT.js","./BugReportHistoryDialog-C2b4xA3d.js","./GraphPanel-ovwXA2NQ.js","./toggle-group-CZcn-1gX.js","./dist-gTGB_-tT.js","./dist-Bme5LuHX.js","./useQuery-ZeEDLtxh.js","./min-Dbr9KJ3U.js","./src-DlFhp60C.js","./colors-CElM_Snc.js","./ordinal-CBsC_qub.js","./init-B1Vy7sk-.js","./isObject-DaQSDnzB.js","./now-Bs9xiL-y.js","./arrow-up-right-CGe6dTck.js","./prop-types-BKsu1Pla.js","./navigation-targets-BS-NLUXq.js","./file-tree-utils-CZ9kiPBg.js","./doc-paths-78wumkT9.js","./skill-scope-CnsZQNOC.js","./documents-events-DKMYe_0X.js","./documents-fetch-CV8lWh8v.js","./parse-api-error-DfesE4Y7.js","./startup-marks-Cdkh8q3E.js","./dist-PQ5KMVDh.js","./target-navigation-intent-Djv7KQmO.js","./panel-CbGx_cRv.js","./overlay-layers-Bj-TVfKw.js","./ActivityModeContent-DgOXZQPM.js","./DocumentContext-dF2iyDoR.js","./cm-theme-DZT10ikr.js","./dist-DAqA-GDU.js","./dist-BiwzWInZ.js","./dist-BgBcg3TP.js","./dist-CkFATl39.js","./dist-DfLFtHzK.js","./dist-ofeGnIBD.js","./dist-DQyQPRvE.js","./dist-dO0W-CVt.js","./dist-BVpMlVG3.js","./stex-PMopVeEZ.js","./config-provider-D-VNxNBY.js","./dist-B6jB2qbD2.js","./client-version-CjhiC-Jt.js","./use-apply-config-color-theme-lxp6AFtt.js","./i18n-gFEbQZNX.js","./messages-CT0uUq60.js","./select-CguJodwX.js","./chevron-up-BNZIobnQ.js","./local-menu-action-bus-Cypryz6Z.js","./switch-B2sF5R0q.js","./CodeMirrorPropInput-BG6vAU3f.js","./asset-dispatch-Cz1weVX3.js","./git-branch-CCnsAeFH.js","./Mermaid-BHfANkja.js","./chevron-right-Diamp-K_.js","./eye-CSz7ogHo.js","./hash-DI30zEBt.js","./info-CV59RycV.js","./paperclip-BlKB6Xwa.js","./file-tree-rename-validation-CCqiFGp1.js","./use-collab-url-B0illVqB.js","./skills-api-BYVWoHSe.js","./DocumentContext-B0sQn39F.css","./undo-2-WGCwknr8.js","./agent-diff-store-D6dVnd_h.js","./cursor-B6reg1lS.js","./copilot-Dh1BU6kS.js","./timeline-diff-store-DnRthkM7.js","./use-activity-panel-w209_TE7.js","./agent-presence-C3GIHDxc.js","./lru-string-cache-Ckr1Pjrr.js","./ImportSkillDialog-C4hZ7UL5.js","./label-B5yNUINo.js","./radio-group-BSCe7mNt.js","./tabs-DlmsMbtD.js","./folder-CopDpuy5.js","./use-popular-skills-D2yWnUy-.js","./skeleton-BOVIbSHk.js","./use-open-skill-BF7e4PgL.js","./use-skills-BxzTRUh9.js","./open-managed-artifact-tab-CVw5wiFN.js","./input-group-BiaQ-rIw.js","./SettingsDialogBody-eShyjwp_.js","./sortable.esm-Dd5A8_XI.js","./ChangedOutsideBadge-ChinF2OV.js","./terminal-cli-display-DghW2MNw.js","./dropdown-menu-CLgDYkh1.js","./dist-6Kl8HTi9.js","./mascot-outline-CtS592mc.js","./separator-vdmCepR4.js","./EnableSyncConfirmDialog-CoTYoRIg.js","./RegisteredAgentIcon-gjOJZp_B.js","./auth-state-cache-Cgyydfw6.js","./download-C3PYuI1f.js","./folder-config-api-fyPH9MBe.js","./refresh-cw-DQervzDZ.js","./field-CtVP3IIV.js","./use-workspace-DogmR2pu.js","./square-pen-Cb57Y3fg.js","./terminal-Cvoe7pfU.js","./form-dlFqxdSN.js","./ConfigSharingInfoTooltip-4T5uhyyt.js","./terminal-command-events-DXmeHtnk.js","./schema-fields-view-intent-DiE8NL9y.js","./lint-plugin-meta-FPoTE-0t.js","./markdownlint-rule-browser-BxyZeWyD.js","./tag-pill-input-CaySXFvi.js","./lint-config-client-CedjssG2.js","./use-terminal-enabled-DM8hVWf8.js","./terminal-telemetry-C1pBFgq5.js","./use-settings-route-CSes8Uwx.js","./ManagedArtifactProperties-16Q3Ko9H.js","./ManagedArtifactProperties-CNc3-2jZ.js","./format-I3YtNHrv.js","./braces-CJEjDc1f.js","./comment-chips-msfGGi8U.js","./selection-context-DJzHAfeZ.js","./MermaidDocEditor-C4p4uQqN.js","./dist-BRmJz2fY.js","./dist-z-y_5Bgj.js","./src-Kocvrol1.js","./TextDocEditor-DfWDVWNo.js","./text-viewer-languages-oVDGEYYY.js","./SourceEditor-GHoDb1-I.js","./typing-burst-detector-mfCCGiI2.js","./wrench-CP2MIQHF.js","./SkillToolbarControls-ChzkHlc2.js","./skill-actions-ZS4T13Ax.js","./DiffView-C-imhjB8.js","./context-menu-D1MgERPo.js","./list-plus-DBdmIc6v.js","./workspace-paths-CKUFX0v6.js","./SkillOriginInline-CLT-BIkT.js","./use-skill-origin-B7sZ5WC1.js","./SlidesToolbarControls-XPbdtH71.js","./SkillEditBanner-BAS_3XLj.js","./SkillModeBanner-cMF-HPLA.js","./LintConfigEditor-Qiz8julD.js","./EditorModeToggle-v0ruFGAI.js","./useLintConfigViewMode-DX8l9aBY.js","./SchemaConfigEditor-D6hcCq89.js","./case-sensitive-CE1B0vR4.js","./TimelineDiffPane-CPn64osU.js","./use-timeline-entry-diff-DxEnQQVQ.js","./libesm-DQtLkQQh.js","./panel-right-open-B66oA9M1.js","./AgentDiffPane-DxMmxvZ_.js","./AppMenubar-CYaE7Hn6.js","./AgentThreadClientBinder-Dr4KCMFV.js","./thread-client-DnaLPSLV.js","./SessionsHost-OteEtmPR.js","./history-B1SZDFzE.js","./terminal-launch-events-CBR70eGX.js","./thread-draft-staging-BG7XGHEN.js","./McpConsentDialogBody-BSCT3OvM.js","./mcp-consent-store-BASpxNOZ.js","./ShareBranchSwitchDialog-DDrNzFpA.js","./miss-dialog-store-sSyy54tn.js","./share-metadata-rows-D5y9TY7o.js","./auth-prompt-store-BYOv6_8O.js","./desktop-bridge-types-NXCK8Pd7.js","./receive-store-DbAkD4vm.js","./ShareReceiveMissDialog-Bzfc6gmc.js","./pending-receive-nav-store-DyyFinN6.js","./ConsentDialogBody-DfhGpXdb.js","./project-paths-_w2mRvRX.js","./ShareReceiveDialog-CXNvnUuO.js","./TerminalWindowApp-CYIfwjHf.js","./use-live-xterm-theme-D4pfJFa6.js","./use-installed-clis-Cydpb5jd.js","./telemetry-startup-C8JOSRcr.js"])))=>i.map(i=>d[i]);
2
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./globals-CLY_4Hw9.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,$t as o,A as s,An as c,Ar as l,At as u,Bn as d,Bt as f,C as p,Cn as m,E as h,Er as g,Et as _,F as v,Fn as y,Ft as b,G as x,Gn as S,Hn as C,I as w,In as T,It as E,J as D,Jn as O,Jt as k,K as A,Kt as j,L as M,Ln as N,Lt as P,M as F,Mn as I,Mr as L,Mt as R,N as z,Nn as B,Nr as V,Nt as H,O as U,Or as W,Ot as ee,P as G,Pn as K,Pt as q,Q as te,Qn as J,Qt as ne,Rn as re,Rt as ie,S as ae,Sn as oe,Sr as se,St as ce,T as le,Tn as ue,Tr as de,Tt as fe,V as pe,Vn as me,Vt as he,Wn as ge,X as _e,Xn as ve,Xt as ye,Y as be,Yn as xe,Yt as Se,Z as Ce,Zt as we,_ as Te,_n as Ee,_r as De,a as Oe,an as ke,ar as Ae,at as je,b as Me,bn as Ne,br as Pe,c as Fe,cn as Ie,ct as Le,d as Re,dn as ze,dt as Be,en as Ve,er as He,et as Ue,f as We,fn as Ge,fr as Ke,g as qe,gn as Je,gr as Ye,gt as Xe,h as Ze,hn as Qe,hr as $e,ht as et,i as tt,in as nt,ir as rt,jn as it,jr as at,jt as ot,k as st,kn as ct,kr as lt,kt as ut,l as dt,ln as ft,lr as pt,lt as mt,m as ht,mr as gt,mt as _t,n as vt,nn as yt,o as bt,on as xt,or as St,p as Ct,pr as wt,q as Tt,qn as Et,qt as Dt,r as Ot,rn as kt,rr as At,rt as jt,s as Mt,sn as Nt,sr as Pt,st as Ft,t as It,tn as Lt,tr as Rt,u as zt,ur as Bt,ut as Vt,v as Ht,vn as Ut,vr as Wt,vt as Gt,wn as Kt,wr as qt,wt as Jt,x as Yt,xr as Xt,xt as Zt,y as Qt,yn as $t,yr as en,z as tn,zn as nn,zt as rn}from"./DocumentContext-dF2iyDoR.js";import{t as an}from"./react-f2sANaYj.js";import{n as Y,r as on,t as sn}from"./dist-Nvb76hAm.js";import{_ as cn,a as ln,c as un,d as dn,f as fn,g as pn,h as mn,i as hn,l as gn,m as _n,n as vn,o as yn,p as bn,r as xn,s as Sn,t as Cn,u as wn,v as Tn,y as En}from"./useQuery-ZeEDLtxh.js";import{n as Dn,t as On}from"./dist-PQ5KMVDh.js";import{t as kn}from"./react-dom-DPxgxlDT.js";import{t as An}from"./compiler-runtime-BfE3aGVn.js";import{a as jn,c as Mn,i as Nn,l as Pn,n as Fn,o as In,r as Ln,s as Rn,t as zn}from"./local-menu-action-bus-Cypryz6Z.js";import{t as Bn}from"./utils-CPqDy6Hr.js";import{_ as Vn,a as Hn,c as Un,d as Wn,f as Gn,g as Kn,h as qn,i as Jn,l as Yn,m as Xn,n as Zn,o as Qn,p as $n,s as er,u as tr,v as nr}from"./ChangedOutsideBadge-ChinF2OV.js";import{t as rr}from"./overlay-layers-Bj-TVfKw.js";import{n as ir,r as ar,t as X}from"./button-CA0dewJJ.js";import{t as or}from"./dist-mv8e6dBX.js";import{i as sr,n as cr,r as lr,t as ur}from"./tooltip-DHXgxWLL.js";import{n as dr,r as fr,t as pr}from"./collapsible-COrqeoHr.js";import{a as mr,c as hr,i as gr,n as _r,o as vr,s as yr,t as br}from"./dialog-DztIj-ZS.js";import{$ as xr,J as Sr,M as Cr,R as wr,S as Tr,T as Er,W as Dr,Z as Or,_ as kr,at as Ar,ct as jr,et as Mr,j as Nr,k as Pr,m as Fr,nt as Ir,rt as Lr,st as Rr,tt as zr,x as Br,z as Vr}from"./CodeMirrorPropInput-BG6vAU3f.js";import{t as Hr}from"./checkbox-vidgONxv.js";import{a as Ur,d as Wr,i as Gr,l as Kr,n as qr,o as Jr,r as Yr,s as Xr,t as Zr,u as Qr}from"./floating-ui.dom-By-yeALv.js";import{a as $r,c as ei,d as ti,i as ni,l as ri,n as ii,r as ai,s as oi,t as si,u as ci}from"./context-menu-D1MgERPo.js";import{a as li,c as ui,d as di,f as fi,i as pi,l as mi,m as hi,n as gi,o as _i,p as vi,r as yi,s as bi,t as xi,u as Si}from"./dropdown-menu-CLgDYkh1.js";import{t as Ci}from"./label-B5yNUINo.js";import{c as wi,i as Ti,n as Ei,o as Di,s as Oi,t as ki}from"./select-CguJodwX.js";import{n as Ai,t as ji}from"./radio-group-BSCe7mNt.js";import{n as Mi,t as Ni}from"./separator-vdmCepR4.js";import{n as Pi,r as Fi,t as Ii}from"./toggle-group-CZcn-1gX.js";import{S as Li,_ as Ri,a as zi,b as Bi,c as Vi,f as Hi,i as Ui,m as Wi,n as Gi,o as Ki,r as qi,u as Ji,x as Yi,y as Xi}from"./terminal-cli-display-DghW2MNw.js";import{a as Zi,i as Qi,n as $i,r as ea}from"./terminal-telemetry-C1pBFgq5.js";import{$a as ta,$t as na,Ai as ra,B as ia,Bn as aa,Br as oa,C as sa,Ci as ca,Cs as la,Dn as ua,E as da,Ei as fa,Er as pa,F as ma,Fi as ha,Fn as ga,Gn as _a,Gt as va,Hi as ya,Ii as ba,It as xa,Jn as Sa,Jo as Ca,Jr as wa,Kn as Ta,Kr as Ea,Lr as Da,M as Oa,Mn as ka,Na as Aa,Nr as ja,O as Ma,Or as Na,Ot as Pa,P as Fa,Pa as Ia,Pn as La,Qa as Ra,Qo as za,Qr as Ba,R as Va,Sa as Ha,Sr as Ua,Ss as Wa,Tn as Ga,Ts as Ka,Tt as qa,Vi as Ja,Xa as Ya,Xn as Xa,Xo as Za,Xt as Qa,Za as $a,Zn as eo,Zr as to,_ as no,_a as ro,_s as io,ar as ao,ci as oo,ct as so,do as co,dr as lo,er as uo,fi as fo,fs as po,ft as mo,go as ho,gs as go,ha as _o,hi as vo,ho as yo,hs as bo,ii as xo,in as So,io as Co,is as wo,it as To,j as Eo,jr as Do,la as Oo,ln as ko,lo as Ao,lr as jo,ma as Mo,mi as No,mo as Po,n as Fo,na as Io,ns as Lo,nt as Ro,oi as zo,oo as Bo,or as Vo,pa as Ho,po as Uo,pr as Wo,qn as Go,ra as Ko,ro as qo,rr as Jo,rt as Yo,s as Xo,sa as Zo,si as Qo,sr as $o,t as es,ti as ts,to as ns,v as rs,va as is,vi as as,vo as os,vs as ss,w as cs,wn as ls,ws as us,xi as ds,xs as fs,ya as ps,yo as ms,ys as hs,yt as gs,za as _s,zi as vs}from"./dist-8YlYwLg8.js";import{_ as ys,c as bs,f as xs,h as Ss,i as Cs,m as ws,n as Ts,p as Es,r as Ds,s as Os,t as ks,v as As,y as js}from"./use-settings-route-CSes8Uwx.js";import{t as Ms}from"./dist-DUfEoSbR.js";import{n as Ns,t as Ps}from"./dist-B6jB2qbD2.js";import{a as Fs,d as Is,f as Ls,i as Rs,l as zs,m as Bs,o as Vs,p as Hs,u as Us}from"./documents-events-DKMYe_0X.js";import{C as Ws,E as Gs,F as Ks,L as qs,M as Js,N as Ys,O as Xs,P as Zs,S as Qs,T as $s,a as ec,b as tc,c as nc,d as rc,f as ic,g as ac,h as oc,k as sc,l as cc,m as lc,n as uc,o as dc,p as fc,r as pc,t as mc,u as hc,v as gc,x as _c}from"./terminal-launch-events-CBR70eGX.js";import{n as vc,t as yc}from"./history-B1SZDFzE.js";import{g as bc,h as xc}from"./use-apply-config-color-theme-lxp6AFtt.js";import{t as Sc}from"./parse-api-error-DfesE4Y7.js";import{C as Cc,D as wc,E as Tc,S as Ec,T as Dc,_ as Oc,b as kc,c as Ac,d as jc,f as Mc,g as Nc,h as Pc,i as Fc,l as Ic,m as Lc,n as Rc,o as zc,p as Bc,r as Vc,s as Hc,t as Uc,u as Wc,v as Gc,w as Kc,x as qc,y as Jc}from"./skill-actions-ZS4T13Ax.js";import{n as Yc,t as Xc}from"./workspace-paths-CKUFX0v6.js";import{t as Zc}from"./use-workspace-DogmR2pu.js";import{t as Qc}from"./createLucideIcon-Bhw2PmPp.js";import{t as $c}from"./git-branch-CCnsAeFH.js";import{c as el,d as tl,f as nl,l as rl,p as il,u as al}from"./EnableSyncConfirmDialog-CoTYoRIg.js";import{c as ol,l as sl,o as cl,s as ll,t as ul}from"./Mermaid-BHfANkja.js";import{t as dl}from"./arrow-up-right-CGe6dTck.js";import{r as fl,t as pl}from"./RegisteredAgentIcon-gjOJZp_B.js";import{C as ml,D as hl,E as gl,S as _l,T as vl,_ as yl,a as bl,b as xl,c as Sl,d as Cl,f as wl,g as Tl,h as El,i as Dl,l as Ol,m as kl,o as Al,p as jl,s as Ml,u as Nl,v as Pl,w as Fl,x as Il,y as Ll}from"./ManagedArtifactProperties-CNc3-2jZ.js";import{t as Rl}from"./case-sensitive-CE1B0vR4.js";import{t as zl}from"./check-CGfmW4da.js";import{t as Bl}from"./chevron-left-UUhIKmW4.js";import{t as Vl}from"./chevron-down-DabHDQTe.js";import{t as Hl}from"./chevron-right-Diamp-K_.js";import{t as Ul}from"./chevron-up-BNZIobnQ.js";import{A as Wl,B as Gl,E as Kl,F as ql,L as Jl,M as Yl,N as Xl,O as Zl,P as Ql,R as $l,S as eu,T as tu,V as nu,_ as ru,a as iu,b as au,c as ou,d as su,f as cu,g as lu,h as uu,i as du,k as fu,l as pu,m as mu,n as hu,o as gu,p as _u,s as vu,t as yu,w as bu,y as xu,z as Su}from"./typing-burst-detector-mfCCGiI2.js";import{n as Cu,t as wu}from"./CopyButton-ByR_1gcU.js";import{a as Tu,i as Eu,n as Du,o as Ou,r as ku,s as Au}from"./prop-types-BKsu1Pla.js";import{A as ju,B as Mu,C as Nu,F as Pu,H as Fu,I as Iu,L as Lu,M as Ru,N as zu,O as Bu,P as Vu,R as Hu,T as Uu,V as Wu,a as Gu,b as Ku,c as qu,f as Ju,g as Yu,h as Xu,j as Zu,k as Qu,m as $u,n as ed,p as td,r as nd,t as rd,w as id,z as ad}from"./auth-state-cache-Cgyydfw6.js";import{t as od}from"./download-C3PYuI1f.js";import{t as sd}from"./eye-CSz7ogHo.js";import{a as cd,i as ld,n as ud,o as dd,r as fd,s as pd,t as md}from"./pending-receive-nav-store-DyyFinN6.js";import{t as hd}from"./folder-open-DUSc8NL8.js";import{t as gd}from"./folder-CopDpuy5.js";import{i as _d,n as vd}from"./folder-config-api-fyPH9MBe.js";import{t as yd}from"./hash-DI30zEBt.js";import{t as bd}from"./info-CV59RycV.js";import{t as xd}from"./spinner-BqySY7qY.js";import{n as Sd,t as Cd}from"./miss-dialog-store-sSyy54tn.js";import{_ as wd,a as Td,b as Ed,c as Dd,d as Od,f as kd,g as Ad,h as jd,i as Md,l as Nd,m as Pd,n as Fd,o as Id,p as Ld,r as Rd,s as zd,t as Bd,u as Vd,v as Hd,x as Ud,y as Wd}from"./comment-chips-msfGGi8U.js";import{i as Gd,n as Kd,r as qd,t as Jd}from"./use-popular-skills-D2yWnUy-.js";import{n as Yd,t as Xd}from"./panel-right-open-B66oA9M1.js";import{t as Zd}from"./paperclip-BlKB6Xwa.js";import{t as Qd}from"./refresh-cw-DQervzDZ.js";import{_ as $d,b as ef,d as tf,f as nf,g as rf,h as af,i as of,m as sf,p as cf,u as lf,v as uf}from"./follow-file-BaVLq6cx.js";import{t as df}from"./square-pen-Cb57Y3fg.js";import{t as ff}from"./trash-2-N0ilsnnr.js";import{t as pf}from"./triangle-alert-COo6wbUK.js";import{t as mf}from"./undo-2-WGCwknr8.js";import{t as hf}from"./x-DS57FvHW.js";import{C as gf,S as _f,_ as vf,a as yf,b as bf,c as xf,d as Sf,f as Cf,g as wf,h as Tf,i as Ef,m as Df,p as Of,s as kf,u as Af,v as jf,w as Mf,x as Nf,y as Pf}from"./doc-paths-78wumkT9.js";import{a as Ff,i as If,n as Lf,r as Rf}from"./project-paths-_w2mRvRX.js";import{t as zf}from"./input-BYiOK210.js";import"./i18n-gFEbQZNX.js";import{n as Bf,r as Vf,t as Hf}from"./file-tree-rename-validation-CCqiFGp1.js";import{a as Uf,c as Wf,d as Gf,i as Kf,l as qf,n as Jf,o as Yf,s as Xf,u as Zf}from"./file-tree-utils-CZ9kiPBg.js";import{E as Qf,J as $f,K as ep,M as tp,_ as np,a as rp,c as ip,f as ap,g as op,h as sp,j as cp,l as lp,n as up,o as dp,p as fp,q as pp,r as mp,s as hp,v as gp,x as _p}from"./navigation-targets-BS-NLUXq.js";import{t as vp}from"./documents-fetch-CV8lWh8v.js";import{a as yp,i as bp,o as xp}from"./startup-marks-Cdkh8q3E.js";import{a as Sp,c as Cp,d as wp,f as Tp,i as Ep,l as Dp,o as Op,s as kp,t as Ap,u as jp}from"./skill-scope-CnsZQNOC.js";import{t as Mp}from"./badge-DFX4S3a5.js";import{a as Np,n as Pp,o as Fp,r as Ip,s as Lp,t as Rp}from"./field-CtVP3IIV.js";import{c as zp,f as Bp,i as Vp,n as Hp,o as Up,r as Wp,t as Gp}from"./config-provider-D-VNxNBY.js";import{i as Kp,r as qp,t as Jp}from"./use-collab-url-B0illVqB.js";import{n as Yp,t as Xp}from"./client-version-CjhiC-Jt.js";import{D as Zp,_ as Qp,b as $p,d as em,f as tm,h as nm,i as rm,l as im,m as am,o as om,p as sm,u as cm}from"./skills-api-BYVWoHSe.js";import{n as lm,t as um}from"./external-link-BIMZpgNa.js";import{t as dm}from"./asset-dispatch-Cz1weVX3.js";import{t as fm}from"./use-skills-BxzTRUh9.js";import{t as pm}from"./use-open-skill-BF7e4PgL.js";import{i as mm,n as hm,r as gm,t as _m}from"./auth-prompt-store-BYOv6_8O.js";import{c as vm,i as ym,l as bm,n as xm,r as Sm,s as Cm,t as wm}from"./selection-context-DJzHAfeZ.js";import{t as Tm}from"./use-installed-clis-Cydpb5jd.js";import{a as Em,c as Dm,i as Om,n as km,o as Am,r as jm,s as Mm,t as Nm}from"./panel-CbGx_cRv.js";import{t as Pm}from"./textarea-yZk4yd9U.js";import{t as Fm}from"./lint-plugin-meta-FPoTE-0t.js";import{t as Im}from"./skeleton-BOVIbSHk.js";import{c as Lm,i as Rm,l as zm,r as Bm}from"./lint-config-client-CedjssG2.js";import{t as Vm}from"./target-navigation-intent-Djv7KQmO.js";import{a as Hm,o as Um,t as Wm}from"./agent-diff-store-D6dVnd_h.js";import{n as Gm,r as Km,t as qm}from"./timeline-diff-store-DnRthkM7.js";import{a as Jm,c as Ym,i as Xm,n as Zm,o as Qm,r as $m,s as eh,t as th}from"./EditorModeToggle-v0ruFGAI.js";import{n as nh}from"./clipboard-adapter-DqemxSWT.js";import{a as rh,c as ih,d as ah,g as oh,h as sh,i as ch,m as lh,n as uh,p as dh,r as fh,s as ph,t as mh,u as hh}from"./sortable.esm-Dd5A8_XI.js";import{t as gh}from"./open-managed-artifact-tab-CVw5wiFN.js";import{t as _h}from"./SkillModeBanner-cMF-HPLA.js";import{t as vh}from"./use-skill-origin-B7sZ5WC1.js";import{n as yh,r as bh,t as xh}from"./input-group-BiaQ-rIw.js";import{n as Sh,t as Ch}from"./DiffView-C-imhjB8.js";import{A as wh,C as Th,D as Eh,E as Dh,O as Oh,S as kh,T as Ah,_ as jh,a as Mh,b as Nh,c as Ph,d as Fh,f as Ih,g as Lh,h as Rh,i as zh,j as Bh,k as Vh,l as Hh,m as Uh,n as Wh,o as Gh,p as Kh,r as qh,s as Jh,t as Yh,u as Xh,v as Zh,w as Qh,x as $h,y as eg}from"./file-tree-adapter-CGtSLM3V.js";import{n as tg,r as ng}from"./platform-labels-glrfxkSh.js";import{t as rg}from"./use-live-xterm-theme-D4pfJFa6.js";import{n as ig,r as ag}from"./agent-presence-C3GIHDxc.js";import{a as og,c as sg,d as cg,f as lg,i as ug,l as dg,m as fg,n as pg,o as mg,s as hg,t as gg,u as _g}from"./form-dlFqxdSN.js";import{n as vg}from"./terminal-command-events-DXmeHtnk.js";import{n as yg,t as bg}from"./mcp-consent-store-BASpxNOZ.js";import{a as xg,t as Sg}from"./receive-store-DbAkD4vm.js";function Cg(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.51.4`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-Bvv5kEhb.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}var wg=class extends ln{#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||Tg(),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=yn({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),un.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Tg(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Eg=class extends En{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 wg({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=Dg(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=Dg(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=Dg(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=Dg(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){un.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=>fn(t,e))}findAll(e={}){return this.getAll().filter(t=>fn(e,t))}notify(e){un.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return un.batch(()=>Promise.all(e.map(e=>e.continue().catch(_n))))}};function Dg(e){return e.options.scope?.id}var Og=class extends En{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??dn(r,t),a=this.get(i);return a||(a=new hn({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(){un.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=>bn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>bn(e,t)):t}notify(e){un.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){un.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){un.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},kg=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Og,this.#t=e.mutationCache||new Eg,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Tn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Sn.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(pn(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=gn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return un.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;un.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return un.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=un.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(_n).catch(_n)}invalidateQueries(e,t={}){return un.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=un.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(_n)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(_n)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(pn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(_n).catch(_n)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(_n).catch(_n)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Sn.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(wn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{mn(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(wn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{mn(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||=dn(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===cn&&(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(an(),1),Ag=t(),$=An(),jg=`button, a[href], input, textarea, select, [contenteditable="true"], [role="button"], [role="menuitem"]`;function Mg(){if(typeof document>`u`)return!1;let e=document.activeElement;return!e||e===document.body?!1:e instanceof Element&&e.matches(jg)}function Ng(e={}){return rr()?!1:e.allowWhileFocused?!0:!Mg()}var Pg=e(kn(),1),Fg=`ok-blob-mascot`;function Ig(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,Pg.flushSync)(e)})}var Lg=64*.055,Rg=.1875,zg=2400,Bg=310;Bg**2/(2*zg);var Vg=580**2/(2*zg),Hg=2*580/zg,Ug=.09,Wg=Hg+.1,Gg=.5,Kg=1.3,qg=3200,Jg=14,Yg=Hg*2.4,Xg=Hg*1.35,Zg=.9,Qg=.3,$g=14e3;function e_(e,t,n){return e+(t-e)*n}function t_(e){return Math.min(1,Math.max(0,e/$g))}function n_(e){return e_(Yg,Xg,t_(e))}function r_(e){return e<=h_?0:e_(p_,m_,t_(e))}var i_=38,a_=52,o_=12,s_=20,c_=34,l_=14,u_=18,d_=22,f_=30,p_=.15,m_=.45,h_=900,g_=240,__=.05,v_=1/120,y_=12;function b_(){return{phase:`idle`,y:0,vy:0,dwell:0,jumpBuffer:0,jumping:!1,ducking:!1,speed:260,distance:0,obstacles:[],spawnCountdown:260*n_(0),nextObstacleId:0}}function x_(e){Object.assign(e,b_(),{phase:`running`})}function S_(e){return e.phase===`running`?e.jumping?(e.jumpBuffer=Wg,!1):(e.vy=580,e.dwell=0,e.jumpBuffer=0,e.jumping=!0,!0):!1}function C_(e,t){e.phase===`running`&&(e.ducking=t)}function w_(e){return e.ducking&&e.y===0}function T_(e){return Math.floor(e.distance/y_)}function E_(e){if(w_(e))return{scaleX:Kg,scaleY:Gg};if(e.y===0&&e.dwell>0){let t=.28*(1-(1-e.dwell/Ug));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 D_(e){let t=w_(e),n=64*(t?Kg:1),r=64*(t?Gg:1),i=n*Rg,a=r*Rg,o=28-(n-64)/2;return{left:o+i,right:o+n-i,bottom:e.y+a,top:e.y+r-a}}function O_(e,t){let n=D_(e);return n.left<t.x+t.width&&n.right>t.x&&n.bottom<t.y+t.height&&n.top>t.y}function k_(e,t,n){let r=n()<r_(e.distance),[i,a,o,s,c]=r?[d_,f_,l_,u_,c_]:[o_,s_,i_,a_,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=e_(Zg,Qg,t_(e.distance));e.spawnCountdown=e.speed*(n_(e.distance)+n()*l)}function A_(e,t,n,r){if(e.jumpBuffer=Math.max(0,e.jumpBuffer-t),e.y>0||e.vy>0){let n=e.ducking?zg+qg:zg;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=Ug)}else e.ducking?e.dwell=0:(e.dwell-=t,e.dwell<=0&&(e.dwell=0,e.vy=Bg));e.speed=Math.min(620,e.speed+Jg*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&&k_(e,n,r);for(let t of e.obstacles)if(O_(e,t)){e.phase=`over`;return}}function j_(e,t,n,r=Math.random){if(e.phase!==`running`)return e;let i=Math.max(n,g_),a=Math.min(Math.max(t,0),__);for(;a>0;){let t=Math.min(a,v_);if(a-=t,A_(e,t,i,r),e.phase!==`running`)break}return e}var M_=`ok-blob-runner-best`;function N_(){try{return typeof localStorage>`u`?null:localStorage}catch{return null}}function P_(e=N_()){if(!e)return 0;try{let t=Number(e.getItem(M_));return Number.isFinite(t)&&t>0?Math.floor(t):0}catch{return 0}}function F_(e,t=N_()){if(!(!t||!Number.isFinite(e)||e<=0))try{t.setItem(M_,String(Math.floor(e)))}catch{}}function I_(e,t,n){let r=n?.windowMs??4e3;return e<=0||t>=r?1:e+1}var L_=Math.ceil(Vg+64+8),R_=Array.from({length:24},(e,t)=>`obstacle-slot-${t}`),z_=300,B_=4,V_=.45;function H_(e){let t=(0,$.c)(47),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=b_(),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)(G_),v=(0,Q.useRef)(g),[y,b]=(0,Q.useState)(0),[x,S]=(0,Q.useState)(!1),[C]=(0,Q.useState)(W_),w,T;t[4]!==i||t[5]!==C?(w=()=>{if(!i||C)return;let e=setTimeout(()=>{x_(o.current),p(`running`)},z_);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}=E_(e);c.current.style.transform=`translateY(${Lg-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(T_(e)).padStart(B_,`0`))};function r(i){let a=o.current;if(j_(a,(i-t)/1e3,s.current?.clientWidth??0),t=i,n(),a.phase===`over`){let e=T_(a),t=e>v.current;h(e),t&&(v.current=e,F_(e),_(e),S(!0),b(U_)),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(){x_(o.current),S(!1),p(`running`)},t=function(t){let n=o.current;if(t.key===`ArrowDown`){if(!Ng({allowWhileFocused:!0}))return;t.preventDefault(),C_(n,!0);return}t.key!==` `&&t.key!==`ArrowUp`||Ng({allowWhileFocused:t.key===`ArrowUp`})&&(t.preventDefault(),n.phase===`running`?S_(n):e())},n=function(e){e.key===`ArrowDown`&&C_(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){Mg()&&document.activeElement.blur();let t=o.current;if(t.phase!==`running`){x_(t),S(!1),p(`running`);return}let n=e.currentTarget.getBoundingClientRect();if(e.clientY-n.top>n.height*(1-V_)){C_(t,!0),e.currentTarget.setPointerCapture?.(e.pointerId);return}S_(t)},t[14]=A):A=t[14];let j=A,M;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=function(){C_(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)(nr,{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:L_},t[17]=F):F=t[17];let I;t[18]!==x||t[19]!==g?(I=g>0?(0,Z.jsxs)(`span`,{className:x?`text-muted-foreground`:void 0,children:[(0,Z.jsx)(Y,{id:`9GbR5F`}),` `,String(g).padStart(B_,`0`)]}):null,t[18]=x,t[19]=g,t[20]=I):I=t[20];let L=String(m),R;t[21]===L?R=t[22]:(R=L.padStart(B_,`0`),t[21]=L,t[22]=R);let z;t[23]===R?z=t[24]:(z=(0,Z.jsx)(`span`,{ref:l,children:R}),t[23]=R,t[24]=z);let B;t[25]!==I||t[26]!==z?(B=(0,Z.jsxs)(`div`,{className:`absolute top-0 end-0 flex gap-3 font-mono text-xs tabular-nums text-muted-foreground/60`,children:[I,z]}),t[25]=I,t[26]=z,t[27]=B):B=t[27];let V;t[28]===i?V=t[29]:(V={left:28,transform:`translateY(${Lg}px)`,...i?{viewTransitionName:Fg}:{}},t[28]=i,t[29]=V);let H=P?`sleeping`:`default`,U;t[30]!==y||t[31]!==H?(U=(0,Z.jsx)(nr,{size:64,trackMouse:!1,variant:H,celebrateSignal:y}),t[30]=y,t[31]=H,t[32]=U):U=t[32];let W;t[33]!==V||t[34]!==U?(W=(0,Z.jsx)(`div`,{ref:c,className:`absolute bottom-0 flex origin-bottom will-change-transform`,style:V,children:U}),t[33]=V,t[34]=U,t[35]=W):W=t[35];let ee;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(ee=R_.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[36]=ee):ee=t[36];let G;t[37]!==B||t[38]!==W||t[39]!==ee?(G=(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:[B,W,ee]}),t[37]=B,t[38]=W,t[39]=ee,t[40]=G):G=t[40];let K;t[41]!==x||t[42]!==f?(K=(0,Z.jsx)(`p`,{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:`8SrrDi`}):(0,Z.jsx)(Y,{id:`4o57um`}):f===`running`?(0,Z.jsx)(Y,{id:`QUhYEG`}):(0,Z.jsx)(Y,{id:`wIM7ul`})}),t[41]=x,t[42]=f,t[43]=K):K=t[43];let q;return t[44]!==G||t[45]!==K?(q=(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:[G,K]}),t[44]=G,t[45]=K,t[46]=q):q=t[46],q}function U_(e){return e+1}function W_(){return typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function G_(){return P_()}var K_=80;function q_(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)(J_),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`||Ng({allowWhileFocused:e.key===`ArrowUp`})&&(e.preventDefault(),s.current=!0,Ig(()=>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)(H_,{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)(nr,{size:K_,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:Fg},onPointerDown:()=>{Mg()&&document.activeElement.blur(),s.current=!0,Ig(()=>o(!0))},children:(0,Z.jsx)(nr,{size:K_,variant:`sleeping`})}),t[8]=d):d=t[8],d}function J_(){return typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var Y_=(0,Q.lazy)(()=>n(()=>import(`./ReportBugDialogBody-BicwB-J9.js`),__vite__mapDeps([5,1,6,2,3,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50]),import.meta.url)),X_=1200,Z_=`[cmdk-root],[data-radix-popper-content-wrapper]`,Q_=500;function $_(e){let t=(0,$.c)(9),[n,r]=(0,Q.useState)(e.open),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(!1),u=(0,Q.useRef)(0);e.open&&!n&&r(!0);let d,f;if(t[0]!==e.crashInvite||t[1]!==e.open?(d=()=>{if(!e.open){a(!1);return}let t=u.current+=1;l(!1);let n=window.okDesktop?.bugReport?.crashDumpAvailability;e.crashInvite===void 0&&typeof n==`function`&&n().then(e=>{u.current===t&&l(e.available)}).catch(ev);let r=window.okDesktop?.bugReport?.captureScreenshot;if(typeof r!=`function`||e.crashInvite!==void 0){s(null),a(!0);return}s(null);let i=!1,o=e=>{i||u.current!==t||(i=!0,s(e),a(!0))},c=setTimeout(()=>o(null),X_),d=performance.now(),f=0,p=()=>{if(u.current!==t)return;let e=performance.now()-d>=Q_;if(document.querySelector(Z_)!==null&&!e){f=requestAnimationFrame(p);return}f=requestAnimationFrame(()=>{u.current===t&&r().then(o).catch(()=>o(null))})};return f=requestAnimationFrame(p),()=>{u.current+=1,clearTimeout(c),cancelAnimationFrame(f)}},f=[e.open,e.crashInvite],t[0]=e.crashInvite,t[1]=e.open,t[2]=d,t[3]=f):(d=t[2],f=t[3]),(0,Q.useEffect)(d,f),!n)return null;let p=e.open&&i,m;return t[4]!==c||t[5]!==e||t[6]!==o||t[7]!==p?(m=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(Y_,{...e,open:p,screenshot:o,crashDumpAvailable:c})}),t[4]=c,t[5]=e,t[6]=o,t[7]=p,t[8]=m):m=t[8],m}function ev(e){console.warn(`[bug-report] crash-dump availability probe failed:`,e)}var tv=new WeakMap;function nv(e,t){typeof e!=`object`||!e||typeof t!=`string`||t.trim()===``||tv.set(e,t)}function rv(e){if(!(typeof e!=`object`||!e))return tv.get(e)}function iv(e){let t=(0,$.c)(24),{error:n,resetErrorBoundary:r}=e,{_:i}=on(),[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)(q_,{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)(sv,{children:(0,Z.jsx)($_,{open:a,onOpenChange:o,systemWide:c.config.mode===`navigator`,crashContext:{source:`app shell`,errorMessage:n instanceof Error&&n.message?n.message:String(n),componentStack:rv(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 av(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(Pn,{FallbackComponent:iv,onError:ov,children:n}),t[0]=n,t[1]=r),r}function ov(e,t){nv(e,t.componentStack),console.error(`[AppErrorBoundary] app-shell render crash`,e,t.componentStack??``)}function sv(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(Pn,{fallback:null,onError:cv,children:n}),t[0]=n,t[1]=r),r}function cv(e){console.error(`[CrashReportingBoundary] crash-reporting UI render crash`,e)}function lv(){let e=(0,$.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={queryKey:[`acp-catalog`],queryFn:fv,staleTime:3e5},e[0]=t):t=e[0];let n=Cn(t),r;e[1]===n.data?.agents?r=e[2]:(r=()=>(Bi(ea(n.data?.agents??[]).map(dv)),uv),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 uv(){return Bi([])}function dv(e){return{source:e.source,id:e.id,name:e.name,featured:e.featured,...e.iconUrl===void 0?{}:{iconUrl:e.iconUrl}}}function fv(e){let{signal:t}=e;return Qi(t)}var pv=Qc(`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`}]]),mv=Qc(`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`}]]),hv=Qc(`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`}]]),gv=Qc(`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`}]]),_v=Qc(`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`}]]),vv=Qc(`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`}]]),yv=Qc(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),bv=Qc(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),xv=Qc(`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`}]]),Sv=Qc(`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`}]]),Cv=Qc(`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`}]]),wv=Qc(`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`}]]),Tv=Qc(`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`}]]),Ev=Qc(`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`}]]),Dv=Qc(`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`}]]),Ov=Qc(`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`}]]),kv=Qc(`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`}]]),Av=Qc(`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`}]]),jv=Qc(`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`}]]),Mv=Qc(`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`}]]),Nv=Qc(`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`}]]),Pv=Qc(`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`}]]),Fv=Qc(`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`}]]),Iv=Qc(`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`}]]),Lv=Qc(`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`}]]),Rv=Qc(`hexagon`,[[`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}]]),zv=Qc(`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`}]]),Bv=Qc(`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`}]]),Vv=Qc(`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`}]]),Hv=Qc(`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`}]]),Uv=Qc(`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`}]]),Wv=Qc(`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`}]]),Gv=[[`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`}]],Kv=Qc(`lock`,Gv),qv=Qc(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),Jv=Qc(`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`}]]),Yv=Qc(`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`}]]),Xv=Qc(`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`}]]),Zv=Qc(`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`}]]),Qv=Qc(`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`}]]),$v=Qc(`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`}]]),ey=Qc(`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`}]]),ty=Qc(`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`}]]),ny=Qc(`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`}]]),ry=Qc(`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`}]]),iy=Qc(`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`}]]),ay=Qc(`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`}]]),oy=Qc(`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`}]]),sy=Qc(`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`}]]),cy=Qc(`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`}]]),ly=Qc(`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`}]]),uy=Qc(`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`}]]),dy=Qc(`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`}]]),fy=Qc(`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`}]]),py=Qc(`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`}]]),my=Qc(`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`}]]),hy=Qc(`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`}]]),gy=Qc(`text-align-center`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M17 12H7`,key:`16if0g`}],[`path`,{d:`M19 19H5`,key:`vjpgq2`}]]),_y=Qc(`text-align-end`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M21 19H7`,key:`4cu937`}]]),vy=Qc(`text-align-start`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]]),yy=Qc(`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`}]]),by=Qc(`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`}]]),xy=Qc(`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`}]]),Sy=Qc(`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`}]]),Cy=Qc(`underline`,[[`path`,{d:`M6 4v6a6 6 0 0 0 12 0V4`,key:`9kb039`}],[`line`,{x1:`4`,x2:`20`,y1:`20`,y2:`20`,key:`nun2al`}]]),wy=Qc(`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`}]]),Ty=Qc(`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`}]]),Ey=Qc(`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 Dy(e){return Rd(e.map(zd),``)}function Oy(){let e=(0,$.c)(9),t=Zc(),n=Hi(),r=Li(),i=Yi(),a;if(e[0]!==i||e[1]!==n||e[2]!==r){let t;e[4]===n?t=e[5]:(t=e=>Ki(n,e.source,e.id,!0,e.supported),e[4]=n,e[5]=t),a=Ri(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(Ay);if(n.length===0)return!1;let r=Oc({docName:null,workspace:t,instruction:Dy(n),mentions:[...new Set(n.map(ky))]});return r===null?(Ns.error(Ms._({id:`3V94ia`})),!1):o===null?(Ns.info(Ms._({id:`8YymuQ`})),Cs(),!1):(Dc(r,{agent:{source:o.source,id:o.id}}),!0)},e[6]=o,e[7]=t,e[8]=s):s=e[8],s}function ky(e){return Xc(e.docName)}function Ay(e){return e.payload}function jy(){let e=(0,$.c)(3),t=Oy(),n=qs(),r=n?.kind===`thread`?n:null,i;return e[0]!==t||e[1]!==r?(i=e=>{if(r===null){He({compose:t,threadIds:e});return}vc(e)},e[0]=t,e[1]=r,e[2]=i):i=e[2],i}var My=null;function Ny(e){My=e}function Py(){return My}function Fy(){let e=(0,$.c)(3),t=jy(),n,r;return e[0]===t?(n=e[1],r=e[2]):(n=()=>{let e=function(e){if(!As(e,`send-comment-queue`)||rr())return;let n=Py();if(n===null)return;let r=n.scope===`doc`?Pt(n.docName):St();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}var Iy=180,Ly=5e3;function Ry(e,t){if(e===``||t===``)return``;let n=e.includes(`\\`)&&!e.includes(`/`)?`\\`:`/`;return`${e.replace(/[/\\]+$/,``)}${n}${t}`}function zy(e){if(e===``)return``;let t=e.split(/[/\\]/).filter(Boolean);return t.length>0?t[t.length-1]??e:e}function By(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 Vy(e){let t=e instanceof Error?e.message:String(e);for(let e of rs)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 Hy(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 Uy(e){let t=(0,$.c)(186),{open:n,onOpenChange:r,bridge:i,initialPackId:a,packs:o}=e,{_:s}=on(),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)(Xy),[b,x]=(0,Q.useState)(`shared`),[S,C]=(0,Q.useState)(!1),w;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(w={kind:`idle`},t[0]=w):w=t[0];let[T,E]=(0,Q.useState)(w),[D,O]=(0,Q.useState)(`idle`),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(null),N;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(N={kind:`idle`},t[1]=N):N=t[1];let[P,F]=(0,Q.useState)(N),[I,L]=(0,Q.useState)(0),R;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(R=new Set,t[2]=R):R=t[2];let z=(0,Q.useRef)(R),B=(0,Q.useRef)(null),V=(0,Q.useRef)(null),H=(0,Q.useRef)(null),U=(0,Q.useRef)(0),W,ee;t[3]!==i||t[4]!==n?(W=()=>{if(!n)return;z.current.clear(),M(null),E({kind:`idle`}),O(`idle`),A(!1),_(``),y(new Set(Ia)),x(`shared`),C(!1),F({kind:`idle`}),U.current+=1;let e=!1;p(``),h(!0),i.fs.defaultProjectsRoot().then(t=>{e||p(t)}).catch(Yy).finally(()=>{e||h(!1)});let t=requestAnimationFrame(()=>{H.current?.focus()});return()=>{e=!0,cancelAnimationFrame(t)}},ee=[n,i],t[3]=i,t[4]=n,t[5]=W,t[6]=ee):(W=t[5],ee=t[6]),(0,Q.useEffect)(W,ee);let G;t[7]!==i||t[8]!==f||t[9]!==g||t[10]!==n?(G=()=>{if(!n)return;V.current!==null&&clearTimeout(V.current),B.current!==null&&B.current.abort();let e=fo(g);if(f===``||e===``){E({kind:`idle`}),O(`idle`);return}let t=f,r=Ry(t,e),a=new AbortController;return B.current=a,V.current=setTimeout(()=>{O(`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||(O(`idle`),E(By({parent:t,sanitizedName:e,enclosingProject:r,enclosingGit:i,targetState:o})))}).catch(e=>{a.signal.aborted||(console.warn(`[CreateProjectDialog] cascade probe failed:`,e),O(`idle`),E({kind:`free`}))})},Iy),()=>{V.current!==null&&clearTimeout(V.current),a.abort()}},t[7]=i,t[8]=f,t[9]=g,t[10]=n,t[11]=G):G=t[11];let K;t[12]!==i||t[13]!==f||t[14]!==g||t[15]!==n||t[16]!==I?(K=[n,f,g,i,I],t[12]=i,t[13]=f,t[14]=g,t[15]=n,t[16]=I,t[17]=K):K=t[17],(0,Q.useEffect)(G,K);let q,te;t[18]===n?(q=t[19],te=t[20]):(q=()=>{if(!n)return;let e=()=>L(Jy);return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},te=[n],t[18]=n,t[19]=q,t[20]=te),(0,Q.useEffect)(q,te);let J=(0,Q.useRef)(`idle`),ne,re;t[21]===D?(ne=t[22],re=t[23]):(ne=()=>{J.current=D},re=[D],t[21]=D,t[22]=ne,t[23]=re),(0,Q.useEffect)(ne,re);let ie,ae;t[24]!==T.kind||t[25]!==n?(ie=()=>{if(!n||T.kind!==`confirm-git`)return;let e=setInterval(()=>{J.current!==`in-flight`&&L(qy)},Ly);return()=>clearInterval(e)},ae=[n,T.kind],t[24]=T.kind,t[25]=n,t[26]=ie,t[27]=ae):(ie=t[26],ae=t[27]),(0,Q.useEffect)(ie,ae);let oe;t[28]!==T.gitRoot||t[29]!==T.kind||t[30]!==P.gitRoot||t[31]!==P.kind?(oe=()=>{if(T.kind!==`confirm-git`){P.kind!==`idle`&&(U.current+=1,F({kind:`idle`}));return}P.kind===`confirming`&&P.gitRoot!==T.gitRoot&&F({kind:`idle`}),P.kind===`pending`&&P.gitRoot!==T.gitRoot&&(U.current+=1,F({kind:`idle`}))},t[28]=T.gitRoot,t[29]=T.kind,t[30]=P.gitRoot,t[31]=P.kind,t[32]=oe):oe=t[32];let se;t[33]!==T||t[34]!==P?(se=[T,P],t[33]=T,t[34]=P,t[35]=se):se=t[35],(0,Q.useEffect)(oe,se);let ce;t[36]!==i||t[37]!==T.kind||t[38]!==n?(ce=()=>{if(!n)return;let e=null;T.kind===`block-nested`?e=`nested`:T.kind===`block-nonempty`?e=`nonempty`:T.kind===`confirm-git`&&(e=`git-confirm`),e!==null&&(z.current.has(e)||(z.current.add(e),i.project.recordCreateNewBannerShown(e).catch(Ky)))},t[36]=i,t[37]=T.kind,t[38]=n,t[39]=ce):ce=t[39];let le;t[40]!==i||t[41]!==T||t[42]!==n?(le=[n,T,i],t[40]=i,t[41]=T,t[42]=n,t[43]=le):le=t[43],(0,Q.useEffect)(ce,le);let ue;t[44]!==a||t[45]!==o?(ue=o?.find(e=>e.id===a),t[44]=a,t[45]=o,t[46]=ue):ue=t[46];let de=ue,fe=g,pe,me,he,ge,_e;t[47]!==T.kind||t[48]!==f||t[49]!==fe?(ge=fe===``?``:fo(fe),me=fe!==``&&ge!==fe&&ge!==``,he=fe!==``&&ge===``,pe=T.kind===`block-nonempty`,_e=f!==``&&ge!==``?Ry(f,ge):``,t[47]=T.kind,t[48]=f,t[49]=fe,t[50]=pe,t[51]=me,t[52]=he,t[53]=ge,t[54]=_e):(pe=t[50],me=t[51],he=t[52],ge=t[53],_e=t[54]);let ve=_e,ye=!k&&f!==``&&fe!==``&&ge!==``&&D===`idle`&&(T.kind===`free`||T.kind===`confirm-git`),be=k||fe!==``&&!ye,xe;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(xe=function(e){y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[55]=xe):xe=t[55];let Se=xe,Ce;t[56]!==i||t[57]!==f?(Ce=async function(){try{let e=await i.dialog.openFolder(f===``?void 0:{defaultPath:f});if(e===null)return;p(e),L(Gy),M(null)}catch(e){console.warn(`[CreateProjectDialog] dialog.openFolder failed:`,e)}},t[56]=i,t[57]=f,t[58]=Ce):Ce=t[58];let we=Ce,Te;t[59]!==s||t[60]!==i||t[61]!==k||t[62]!==ye||t[63]!==v||t[64]!==a||t[65]!==f||t[66]!==r||t[67]!==fe||t[68]!==ge||t[69]!==b?(Te=async function(e){if(e.preventDefault(),!k){if(fe.trim()===``){Ns.error(s({id:`5OqaJi`})),H.current?.focus();return}if(ye){A(!0),M(null);try{await i.project.createNew({parent:f,name:ge,editors:Array.from(v),sharing:b,packId:a}),r(!1)}catch(e){M(Vy(e)),A(!1)}}}},t[59]=s,t[60]=i,t[61]=k,t[62]=ye,t[63]=v,t[64]=a,t[65]=f,t[66]=r,t[67]=fe,t[68]=ge,t[69]=b,t[70]=Te):Te=t[70];let Ee=Te,De;t[71]!==k||t[72]!==r?(De=function(e){k||r(e)},t[71]=k,t[72]=r,t[73]=De):De=t[73];let Oe=De,ke;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(ke=async function(e){F({kind:`confirming`,gitRoot:e})},t[74]=ke):ke=t[74];let Ae=ke,je;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(je=async function(){F({kind:`idle`})},t[75]=je):je=t[75];let Me=je,Ne;t[76]===i?Ne=t[77]:(Ne=async function(e){let t=U.current+1;U.current=t,F({kind:`pending`,gitRoot:e});try{if(await i.fs.removeGitFolder(e),U.current!==t)return;L(Wy),F({kind:`idle`})}catch(e){let n=e;if(U.current!==t)return;let r=n instanceof Error?n.message:String(n);console.error(`[CreateProjectDialog] bridge.fs.removeGitFolder failed:`,n),F({kind:`error`,message:r})}},t[76]=i,t[77]=Ne);let Pe=Ne,Fe;t[78]!==i||t[79]!==r?(Fe=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[78]=i,t[79]=r,t[80]=Fe):Fe=t[80];let Ie=Fe,Le=he||pe||me?`${u} ${d}`:u,Re;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(0,Z.jsx)(hr,{children:(0,Z.jsx)(Y,{id:`wbv9xO`})}),t[81]=Re):Re=t[81];let ze;t[82]===de?ze=t[83]:(ze=(0,Z.jsxs)(yr,{children:[Re,(0,Z.jsx)(mr,{children:de?(0,Z.jsx)(Y,{id:`D2CwBE`,values:{0:de.name,1:de.entryCounts.folders},components:{0:(0,Z.jsx)(`strong`,{})}}):(0,Z.jsx)(Y,{id:`O6yEPk`})})]}),t[82]=de,t[83]=ze);let Be;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,Z.jsx)(Y,{id:`OyIC0Q`}),t[84]=Be):Be=t[84];let Ve;t[85]===l?Ve=t[86]:(Ve=(0,Z.jsx)(Ci,{htmlFor:l,children:Be}),t[85]=l,t[86]=Ve);let He;t[87]===s?He=t[88]:(He=s({id:`cV7LOw`}),t[87]=s,t[88]=He);let Ue;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=e=>_(e.target.value),t[89]=Ue):Ue=t[89];let We=he||pe,Ge;t[90]!==k||t[91]!==g||t[92]!==Le||t[93]!==l||t[94]!==He||t[95]!==We?(Ge=(0,Z.jsx)(zf,{id:l,ref:H,value:g,placeholder:He,onChange:Ue,disabled:k,autoComplete:`off`,"aria-invalid":We,"aria-describedby":Le,"data-testid":`create-name`}),t[90]=k,t[91]=g,t[92]=Le,t[93]=l,t[94]=He,t[95]=We,t[96]=Ge):Ge=t[96];let Ke;t[97]!==d||t[98]!==pe||t[99]!==me||t[100]!==he||t[101]!==ge?(Ke=he?(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`})}):pe?(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:ge},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):me?(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:ge},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):null,t[97]=d,t[98]=pe,t[99]=me,t[100]=he,t[101]=ge,t[102]=Ke):Ke=t[102];let qe;t[103]!==Ve||t[104]!==Ge||t[105]!==Ke?(qe=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[Ve,Ge,Ke]}),t[103]=Ve,t[104]=Ge,t[105]=Ke,t[106]=qe):qe=t[106];let Je;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Je=(0,Z.jsx)(Ci,{children:(0,Z.jsx)(Y,{id:`wJijgU`})}),t[107]=Je):Je=t[107];let Ye;t[108]!==f||t[109]!==m?(Ye=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,t[108]=f,t[109]=m,t[110]=Ye):Ye=t[110];let Xe;t[111]===Ye?Xe=t[112]:(Xe=(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:Ye}),t[111]=Ye,t[112]=Xe);let Ze;t[113]===we?Ze=t[114]:(Ze=()=>void we(),t[113]=we,t[114]=Ze);let Qe;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=(0,Z.jsx)(Y,{id:`O2UpM1`}),t[115]=Qe):Qe=t[115];let $e;t[116]!==k||t[117]!==Ze?($e=(0,Z.jsx)(X,{type:`button`,variant:`outline`,className:`shrink-0`,disabled:k,onClick:Ze,"data-testid":`create-browse`,children:Qe}),t[116]=k,t[117]=Ze,t[118]=$e):$e=t[118];let et;t[119]!==Xe||t[120]!==$e?(et=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[Xe,$e]}),t[119]=Xe,t[120]=$e,t[121]=et):et=t[121];let tt;t[122]===ve?tt=t[123]:(tt=ve===``?null:(0,Z.jsx)(Y,{id:`k_yIIc`,values:{targetPreview:ve},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}}),t[122]=ve,t[123]=tt);let nt;t[124]!==u||t[125]!==tt?(nt=(0,Z.jsx)(`p`,{id:u,className:`text-1sm text-muted-foreground wrap-break-word`,"aria-live":`polite`,"data-testid":`create-target-caption`,children:tt}),t[124]=u,t[125]=tt,t[126]=nt):nt=t[126];let rt;t[127]!==et||t[128]!==nt?(rt=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[Je,et,nt]}),t[127]=et,t[128]=nt,t[129]=rt):rt=t[129];let it;t[130]!==T||t[131]!==Pe||t[132]!==Ie||t[133]!==P?(it=(0,Z.jsx)(Zy,{cascade:T,onOpenNested:Ie,removeGitState:P,onRequestRemoveGit:Ae,onCancelRemoveGit:Me,onConfirmRemoveGit:Pe}),t[130]=T,t[131]=Pe,t[132]=Ie,t[133]=P,t[134]=it):it=t[134];let at;t[135]===Symbol.for(`react.memo_cache_sentinel`)?(at=(0,Z.jsxs)(fr,{className:`group flex w-full items-center justify-between gap-2 px-3 py-2 text-sm font-medium hover:bg-muted/50`,"data-testid":`create-advanced-trigger`,children:[(0,Z.jsx)(Y,{id:`VNgKZz`}),(0,Z.jsx)(Hl,{className:`size-4 transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`,"aria-hidden":!0})]}),t[135]=at):at=t[135];let ot;t[136]===Symbol.for(`react.memo_cache_sentinel`)?(ot=(0,Z.jsx)(`legend`,{className:`text-sm font-medium`,children:(0,Z.jsx)(Y,{id:`0YEbfk`})}),t[136]=ot):ot=t[136];let st;t[137]===Symbol.for(`react.memo_cache_sentinel`)?(st=(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`8IP5jY`})}),t[137]=st):st=t[137];let ct;t[138]!==k||t[139]!==v?(ct=Ia.map(e=>{let t=`create-editor-${e}`;return(0,Z.jsxs)(Ci,{htmlFor:t,className:`text-sm font-normal`,children:[(0,Z.jsx)(Hr,{id:t,checked:v.has(e),onCheckedChange:()=>Se(e),disabled:k,"data-testid":`create-editor-${e}`}),(0,Z.jsx)(`span`,{children:_s[e]})]},e)}),t[138]=k,t[139]=v,t[140]=ct):ct=t[140];let lt;t[141]===ct?lt=t[142]:(lt=(0,Z.jsxs)(`fieldset`,{className:`flex flex-col space-y-2 pb-2`,children:[ot,st,ct]}),t[141]=ct,t[142]=lt);let ut;t[143]!==k||t[144]!==b?(ut=(0,Z.jsx)(Ff,{idPrefix:`create`,testIdPrefix:`create-sharing`,value:b,onValueChange:x,disabled:k}),t[143]=k,t[144]=b,t[145]=ut):ut=t[145];let dt;t[146]!==lt||t[147]!==ut?(dt=(0,Z.jsxs)(dr,{className:`space-y-6 border-t border-border px-3 py-4`,children:[lt,ut]}),t[146]=lt,t[147]=ut,t[148]=dt):dt=t[148];let ft;t[149]!==S||t[150]!==dt?(ft=(0,Z.jsxs)(pr,{open:S,onOpenChange:C,className:`rounded-md border border-border`,"data-testid":`create-advanced`,children:[at,dt]}),t[149]=S,t[150]=dt,t[151]=ft):ft=t[151];let pt;t[152]!==s||t[153]!==j?(pt=j===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(Hy(j))}),t[152]=s,t[153]=j,t[154]=pt):pt=t[154];let mt;t[155]!==c||t[156]!==Ee||t[157]!==qe||t[158]!==rt||t[159]!==it||t[160]!==ft||t[161]!==pt?(mt=(0,Z.jsx)(_r,{className:`space-y-6`,children:(0,Z.jsxs)(`form`,{id:c,onSubmit:Ee,"data-testid":`create-project-form`,className:`space-y-6`,children:[qe,rt,it,ft,pt]})}),t[155]=c,t[156]=Ee,t[157]=qe,t[158]=rt,t[159]=it,t[160]=ft,t[161]=pt,t[162]=mt):mt=t[162];let ht;t[163]===r?ht=t[164]:(ht=()=>r(!1),t[163]=r,t[164]=ht);let gt;t[165]===Symbol.for(`react.memo_cache_sentinel`)?(gt=(0,Z.jsx)(Y,{id:`dEgA5A`}),t[165]=gt):gt=t[165];let _t;t[166]!==k||t[167]!==ht?(_t=(0,Z.jsx)(X,{type:`button`,variant:`outline`,className:`font-mono uppercase`,onClick:ht,disabled:k,"data-testid":`create-cancel`,children:gt}),t[166]=k,t[167]=ht,t[168]=_t):_t=t[168];let vt;t[169]===k?vt=t[170]:(vt=k?(0,Z.jsx)(Y,{id:`E9bKSA`}):(0,Z.jsx)(Y,{id:`hYgDIe`}),t[169]=k,t[170]=vt);let yt;t[171]!==c||t[172]!==be||t[173]!==vt?(yt=(0,Z.jsx)(X,{type:`submit`,form:c,disabled:be,"data-testid":`create-submit`,children:vt}),t[171]=c,t[172]=be,t[173]=vt,t[174]=yt):yt=t[174];let bt;t[175]!==_t||t[176]!==yt?(bt=(0,Z.jsxs)(vr,{children:[_t,yt]}),t[175]=_t,t[176]=yt,t[177]=bt):bt=t[177];let xt;t[178]!==ze||t[179]!==mt||t[180]!==bt?(xt=(0,Z.jsxs)(gr,{className:`sm:max-w-lg`,"data-testid":`create-project-dialog`,children:[ze,mt,bt]}),t[178]=ze,t[179]=mt,t[180]=bt,t[181]=xt):xt=t[181];let St;return t[182]!==Oe||t[183]!==n||t[184]!==xt?(St=(0,Z.jsx)(br,{open:n,onOpenChange:Oe,children:xt}),t[182]=Oe,t[183]=n,t[184]=xt,t[185]=St):St=t[185],St}function Wy(e){return e+1}function Gy(e){return e+1}function Ky(){}function qy(e){return e+1}function Jy(e){return e+1}function Yy(e){console.warn(`[CreateProjectDialog] defaultProjectsRoot probe failed:`,e)}function Xy(){return new Set(Ia)}function Zy(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=zy(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 Qy(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}function $y(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 eb={blobRun:{id:`hgf5io`},back:{id:`iH8pgl`},forward:{id:`rxWGWX`},newFile:{id:`HdkSiO`},newFolder:{id:`96G6Re`},openGraph:{id:`3Fcb0I`},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`}},tb={win32:{revealInFinder:{id:`qi1F96`},moveToTrash:{id:`o9yN4T`}},linux:{revealInFinder:{id:`e1Rn_k`}}};function nb(e,t){if(t===`win32`||t===`linux`){let n=tb[t][e];if(n)return n}return eb[e]}var rb={"open-blob-run":Fv,"navigate-back":Bl,"navigate-forward":Hl,"new-file":jr,"new-folder":Pv,"open-graph":Yv,"initialize-starter-pack":qd,"new-skill":ue,"new-project":Mn,"open-folder":hd,"open-file":Rr,"switch-project":re,"open-skills":qd,settings:Pc,"install-claude-desktop":od,"report-bug":O,"bug-report-history":yc,"send-feedback":Ud,"new-from-template":jr,rename:it,duplicate:Cu,"move-to-trash":ff,"reveal-in-finder":hd,"copy-full-path":Cu,"copy-relative-path":Cu,"close-tab":hf,"new-worktree":$c,"switch-worktree":$c,"toggle-sidebar":I,"toggle-doc-panel":Ks,"toggle-terminal":Zs,"move-terminal":Zs,"toggle-agent-panel":Ud,"toggle-show-hidden-files":sd,"toggle-show-ok-folders":gd,"toggle-show-only-markdown-files":Rr,"toggle-show-skills-section":ue,"expand-all-tree":wy,"collapse-all-tree":Mv,"new-terminal":Zs,"kill-terminal":Zs,"check-for-updates":Qd,"set-up-integrations":hv,"toggle-spell-check":sy,"open-github":Qy},ib={"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(),L(`graph`)},"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(),Ms._({id:`jol95m`}))},"open-skills":e=>{e.closePalette(),window.location.hash=wf()},settings:e=>{e.closePalette(),window.location.hash!==`#settings`&&(window.location.hash=ks)},"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(so)};function ab(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 ob(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 Ms._(eb[r]);let a=t.viewMenuState[e.stateToggle.stateField]===!0?e.stateToggle.hideKey:e.stateToggle.showKey;return Ms._(nb(a,n))}if(e.placementToggle){let r=t.viewMenuState.terminalPlacement===`right`?e.placementToggle.rightKey:e.placementToggle.bottomKey;return Ms._(nb(r,n))}return Ms._(nb(e.labelKey,n))}function sb(e){let t=e.menuActionId;return e=>e.emitMenuAction(t)}function cb(e){let t=e.palette;if(!t)throw Error(`command ${e.id} has no palette presence`);let n=rb[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=>ob(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=>Xa(e.availability,ab(t)),dispatch:ib[e.id]??sb(e)}}var lb=no.flatMap(e=>e.palette?[cb(e)]:[]),ub=`ok-omnibar-recents-v1`,db=10;function fb(e){return typeof e==`object`&&!!e&&(e.kind===`file`||e.kind===`folder`)&&typeof e.path==`string`&&typeof e.lastOpenedAt==`string`}function pb(e){if(e)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function mb(e,t){return`${e}:${t}`}function hb(e){let t=pb(e);if(!t)return[];try{let e=t.getItem(ub);if(!e)return[];let n=JSON.parse(e);return Array.isArray(n)?n.filter(fb).slice(0,db):[]}catch{return[]}}function gb(e,t){let n=pb(t);if(n)try{n.setItem(ub,JSON.stringify(e.slice(0,db)))}catch(e){console.warn(`[omnibar] Failed to save recent entries:`,e)}}function _b(e,t){return[t,...e.filter(e=>e.kind!==t.kind||e.path!==t.path)].slice(0,db)}function vb(e,t){return e.filter(e=>t.has(mb(e.kind,e.path)))}var yb=50,bb=50,xb=``,Sb=null;function Cb(e){return e.trim().toLowerCase()}function wb(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Tb(e){let t=e.trim();return t?[...new Set(t.split(/\s+/).filter(Boolean))].sort((e,t)=>t.length-e.length):[]}function Eb(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:ra(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:ra(e),bodyIndexed:!1}));for(let e of t)a.push({kind:`folder`,path:e,name:ra(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 Db(e){return Ta({kind:e.kind===`folder`?`folder`:e.bodyIndexed===!1?`file`:`page`,path:e.path,title:e.title??e.name,modifiedTs:e.modifiedTs??0})}function Ob(e){return{entries:e,byId:new Map(e.map(e=>[`${e.kind===`folder`?`folder`:e.bodyIndexed===!1?`file`:`page`}:${e.path}`,e])),corpus:_a(e.map(Db))}}function kb(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 Ab(e){let t=kb(e);return Sb&&xb===t?Sb:(xb=t,Sb=Ob(e),Sb)}function jb(e,t,n=yb){return Mb(Ab(e),t,n)}function Mb(e,t,n=yb){let r=Cb(t);return r?vo(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 Nb(e,t){let n=Tb(t);if(n.length===0||e.length===0)return[{text:e,match:!1,start:0}];let r=RegExp(`(${n.map(wb).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 Pb(e){if(e.kind!==`page`&&e.kind!==`folder`&&e.kind!==`file`||typeof e.path!=`string`)return null;let t=ra(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 Fb(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??bb,source:`omnibar`,...t.semantic?{semantic:!0}:{}}),signal:t.signal});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(Sc(e)??`Search failed with status ${r.status}`)}let i=await r.json();return{entries:(i.results??[]).map(Pb).filter(e=>!!e),truncated:i.truncated===!0,ready:i.ready!==!1}}function Ib(e,t,n=[]){let r=Cb(t);return r?Cb([e,...n].join(` `)).includes(r):!0}function Lb(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 Rb(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 zb=`tag:`;function Bb(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 Vb(e,t){return Je(e,t)}var Hb=Qe;async function Ub(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 Wb=(0,Q.lazy)(()=>n(()=>import(`./FeedbackForm-hMBuqLQh.js`).then(e=>({default:e.FeedbackForm})),[],import.meta.url)),Gb=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)(yr,{children:(0,Z.jsx)(hr,{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)(gr,{children:[o,(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(Wb,{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)(br,{open:n,onOpenChange:r,children:c}),t[7]=r,t[8]=n,t[9]=c,t[10]=l):l=t[10],l},Kb=[`.md`,`.mdx`];function qb(e){let t=e.toLowerCase();for(let e of Kb)if(t.endsWith(e))return e;return null}var Jb={local:0,inherited:1};function Yb(e){return[...e].sort((e,t)=>{let n=Jb[e.scope]-Jb[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 Xb=`__blank__`;function Zb(e){return e.trim()?e.includes(`..`)?`dotdot`:e.startsWith(`/`)?`leading-slash`:e.includes(`\\`)?`backslash`:e.includes(`\0`)?`null-byte`:null:`empty`}function Qb(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 $b(e){let t=e.fileName.trim(),n=qb(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 ex(e,t){return ys(e.target)?!1:As(e,`new-item`,t)}function tx(e){let t=e.value.lastIndexOf(`.`);t>0?e.setSelectionRange(0,t):e.select()}function nx(e){let t=(0,$.c)(136),{open:n,onOpenChange:r,kind:i,initialDir:a,suggestedName:s,initialTemplate:c,defaultToTemplate:l,description:u,onCreated:d,folderConfig:f}=e,{_:p}=on(),{addPage:m}=Eu(),h=Wu(f?null:a),g=f??h,[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(``),[x,S]=(0,Q.useState)(Xb),[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(null),j=(0,Q.useId)(),M=(0,Q.useId)(),N=(0,Q.useId)(),P=(0,Q.useId)(),F=(0,Q.useId)(),[I,L]=(0,Q.useState)(!1),R=(0,Q.useRef)(null),z=(0,Q.useRef)(null),B,V;t[0]!==c||t[1]!==i||t[2]!==n||t[3]!==s?(B=()=>{n&&(E(null),A(null),O(!1),b(``),S(i===`file`&&c?c:Xb),w(!1),L(!1),v(i===`file`?s??`untitled`:`index`))},V=[n,i,s,c],t[0]=c,t[1]=i,t[2]=n,t[3]=s,t[4]=B,t[5]=V):(B=t[4],V=t[5]),(0,Q.useEffect)(B,V);let H;t[6]!==g.state.data||t[7]!==g.state.status?(H=g.state.status===`ready`?Yb(g.state.data.folder.templates_available??[]):[],t[6]=g.state.data,t[7]=g.state.status,t[8]=H):H=t[8];let U=H,W;t[9]!==g.state.data||t[10]!==g.state.status||t[11]!==n||t[12]!==x?(W=()=>{n&&x!==Xb&&g.state.status===`ready`&&((g.state.data.folder.templates_available??[]).some(e=>e.name===x)||S(Xb))},t[9]=g.state.data,t[10]=g.state.status,t[11]=n,t[12]=x,t[13]=W):W=t[13];let ee;t[14]!==g.state||t[15]!==n||t[16]!==x?(ee=[n,x,g.state],t[14]=g.state,t[15]=n,t[16]=x,t[17]=ee):ee=t[17],(0,Q.useEffect)(W,ee);let G;t[18]!==l||t[19]!==g.state.data||t[20]!==g.state.status||t[21]!==c||t[22]!==n||t[23]!==C?(G=()=>{if(!n||!l||c||C||g.state.status!==`ready`)return;let e=Yb(g.state.data.folder.templates_available??[]);e.length>0&&S(e[0].name)},t[18]=l,t[19]=g.state.data,t[20]=g.state.status,t[21]=c,t[22]=n,t[23]=C,t[24]=G):G=t[24];let K;t[25]!==l||t[26]!==g.state||t[27]!==c||t[28]!==n||t[29]!==C?(K=[n,l,c,C,g.state],t[25]=l,t[26]=g.state,t[27]=c,t[28]=n,t[29]=C,t[30]=K):K=t[30],(0,Q.useEffect)(G,K);let q=i===`file`,te=g.state.status===`loading`||g.state.status===`idle`,J=g.state.status===`error`?g.state.message:null,ne;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(ne=function(e){v(e),E(null)},t[31]=ne):ne=t[31];let re=ne,ie;t[32]!==_||t[33]!==y||t[34]!==a||t[35]!==i?(ie=function(){return $b({kind:i,initialDir:a,fileName:_,folderName:y})},t[32]=_,t[33]=y,t[34]=a,t[35]=i,t[36]=ie):ie=t[36];let ae=ie,oe;t[37]!==p||t[38]!==_||t[39]!==y||t[40]!==i?(oe=function(){if(i===`folder`){let e=Zb(y.trim());if(e)return{message:p({id:`ODGGlj`,values:{detail:p(Qb(e))}}),field:`folder`}}let e=Zb(_.trim());return e?{message:p(Qb(e)),field:`file`}:null},t[37]=p,t[38]=_,t[39]=y,t[40]=i,t[41]=oe):oe=t[41];let se=oe,ce;t[42]!==D||t[43]!==_||t[44]!==y||t[45]!==i?(ce=D||!_.trim()||i===`folder`&&!y.trim(),t[42]=D,t[43]=_,t[44]=y,t[45]=i,t[46]=ce):ce=t[46];let le=ce,ue;t[47]!==p||t[48]!==m||t[49]!==ae||t[50]!==se||t[51]!==i||t[52]!==d||t[53]!==r||t[54]!==x?(ue=async function(){let e=se();if(e){E(e.message),A(e.field);return}O(!0),E(null),A(null);let t=ae(),n=i===`file`&&x!==Xb?x:void 0,a={path:t};n!==void 0&&(a.template=n);try{let e=await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(a)}),t=e.status,n=await o(e,p({id:`d2uTPx`,values:{status:t}}));if(!n.ok){O(!1),E(n.title),A(`form`);return}let s=cs.safeParse(n.body);if(O(!1),!s.success){E(p(i===`folder`?{id:`K1ckLX`}:{id:`fJgQHX`})),A(`form`);return}let c=s.data.docName;r(!1),window.location.hash=`#/${c}`,m(c),Fs([`files`,`backlinks`,`graph`]),d?.(c)}catch(e){console.warn(`[NewItemDialog] create failed:`,e),O(!1),E(p({id:`HIb0vl`})),A(`form`)}},t[47]=p,t[48]=m,t[49]=ae,t[50]=se,t[51]=i,t[52]=d,t[53]=r,t[54]=x,t[55]=ue):ue=t[55];let de=ue,fe;t[56]!==p||t[57]!==a?(fe=a||p({id:`L6Hhh6`}),t[56]=p,t[57]=a,t[58]=fe):fe=t[58];let pe=fe,me;t[59]===i?me=t[60]:(me=(0,Z.jsx)(hr,{children:i===`file`?(0,Z.jsx)(Y,{id:`HdkSiO`}):(0,Z.jsx)(Y,{id:`96G6Re`})}),t[59]=i,t[60]=me);let he;t[61]!==u||t[62]!==pe?(he=u??(0,Z.jsx)(Y,{id:`NvOvTi`,values:{dirDisplay:pe},components:{0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})}}),t[61]=u,t[62]=pe,t[63]=he):he=t[63];let ge;t[64]===he?ge=t[65]:(ge=(0,Z.jsx)(mr,{children:he}),t[64]=he,t[65]=ge);let _e;t[66]!==me||t[67]!==ge?(_e=(0,Z.jsxs)(yr,{children:[me,ge]}),t[66]=me,t[67]=ge,t[68]=_e):_e=t[68];let ve;t[69]!==x||t[70]!==q||t[71]!==P||t[72]!==I||t[73]!==F||t[74]!==U||t[75]!==J||t[76]!==te?(ve=q&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{id:P,className:`text-sm font-medium`,children:(0,Z.jsx)(Y,{id:`f65AOQ`})}),J?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,children:(0,Z.jsx)(Y,{id:`sE7R19`,values:{templatesError:J}})}):null,(0,Z.jsx)(ix,{triggerId:F,labelledById:P,open:I,onOpenChange:L,value:x,onValueChange:e=>{S(e),w(!0)},templates:U,loading:te}),!te&&!J&&U.length===0?(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`uWtdQR`})}):null]}),t[69]=x,t[70]=q,t[71]=P,t[72]=I,t[73]=F,t[74]=U,t[75]=J,t[76]=te,t[77]=ve):ve=t[77];let ye;t[78]!==p||t[79]!==T||t[80]!==k||t[81]!==j||t[82]!==M||t[83]!==y||t[84]!==i?(ye=i===`folder`&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:M,children:(0,Z.jsx)(Y,{id:`cqQyPB`})}),(0,Z.jsx)(zf,{ref:z,id:M,value:y,onChange:e=>{b(e.target.value),E(null)},placeholder:`folder-name`,autoFocus:!0,"aria-describedby":T&&(k===`folder`||k===`form`)?j:void 0,"aria-invalid":T&&(k===`folder`||k===`form`)?!0:void 0,onKeyDown:e=>{if(e.key===`Enter`){e.preventDefault();let t=Zb(y.trim());if(t){E(p({id:`ODGGlj`,values:{detail:p(Qb(t))}})),A(`folder`);return}R.current?.focus()}}})]}),t[78]=p,t[79]=T,t[80]=k,t[81]=j,t[82]=M,t[83]=y,t[84]=i,t[85]=ye):ye=t[85];let be;t[86]===i?be=t[87]:(be=i===`folder`?(0,Z.jsx)(Y,{id:`jjtmV_`}):(0,Z.jsx)(Y,{id:`s-XOaI`}),t[86]=i,t[87]=be);let xe;t[88]!==N||t[89]!==be?(xe=(0,Z.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:N,children:be}),t[88]=N,t[89]=be,t[90]=xe):xe=t[90];let Se;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(Se=e=>re(e.target.value),t[91]=Se):Se=t[91];let Ce=i===`file`,we=T&&(k===`file`||k===`form`)?j:void 0,Te=T&&(k===`file`||k===`form`)?!0:void 0,Ee;t[92]!==de||t[93]!==le?(Ee=e=>{e.key===`Enter`&&!le&&de()},t[92]=de,t[93]=le,t[94]=Ee):Ee=t[94];let De;t[95]!==N||t[96]!==_||t[97]!==Ce||t[98]!==we||t[99]!==Te||t[100]!==Ee?(De=(0,Z.jsx)(zf,{ref:R,id:N,value:_,onChange:Se,placeholder:`my-note`,autoFocus:Ce,"aria-describedby":we,"aria-invalid":Te,onFocus:rx,onKeyDown:Ee}),t[95]=N,t[96]=_,t[97]=Ce,t[98]=we,t[99]=Te,t[100]=Ee,t[101]=De):De=t[101];let Oe;t[102]!==T||t[103]!==j?(Oe=T&&(0,Z.jsx)(`p`,{id:j,role:`alert`,className:`text-1sm text-destructive`,children:T}),t[102]=T,t[103]=j,t[104]=Oe):Oe=t[104];let ke;t[105]!==xe||t[106]!==De||t[107]!==Oe?(ke=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[xe,De,Oe]}),t[105]=xe,t[106]=De,t[107]=Oe,t[108]=ke):ke=t[108];let Ae;t[109]!==ve||t[110]!==ye||t[111]!==ke?(Ae=(0,Z.jsxs)(_r,{className:`space-y-6 pb-1`,children:[ve,ye,ke]}),t[109]=ve,t[110]=ye,t[111]=ke,t[112]=Ae):Ae=t[112];let je;t[113]===r?je=t[114]:(je=()=>r(!1),t[113]=r,t[114]=je);let Me;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(Me=(0,Z.jsx)(Y,{id:`dEgA5A`}),t[115]=Me):Me=t[115];let Ne;t[116]!==D||t[117]!==je?(Ne=(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:je,disabled:D,children:Me}),t[116]=D,t[117]=je,t[118]=Ne):Ne=t[118];let Pe;t[119]===D?Pe=t[120]:(Pe=D?(0,Z.jsx)(Y,{id:`E9bKSA`}):(0,Z.jsx)(Y,{id:`hYgDIe`}),t[119]=D,t[120]=Pe);let Fe;t[121]!==de||t[122]!==le||t[123]!==Pe?(Fe=(0,Z.jsx)(X,{onClick:de,disabled:le,children:Pe}),t[121]=de,t[122]=le,t[123]=Pe,t[124]=Fe):Fe=t[124];let Ie;t[125]!==Ne||t[126]!==Fe?(Ie=(0,Z.jsxs)(vr,{children:[Ne,Fe]}),t[125]=Ne,t[126]=Fe,t[127]=Ie):Ie=t[127];let Le;t[128]!==_e||t[129]!==Ae||t[130]!==Ie?(Le=(0,Z.jsxs)(gr,{className:`sm:max-w-md`,"data-ok-layer-spawned":``,children:[_e,Ae,Ie]}),t[128]=_e,t[129]=Ae,t[130]=Ie,t[131]=Le):Le=t[131];let Re;return t[132]!==r||t[133]!==n||t[134]!==Le?(Re=(0,Z.jsx)(br,{open:n,onOpenChange:r,children:Le}),t[132]=r,t[133]=n,t[134]=Le,t[135]=Re):Re=t[135],Re}function rx(e){return tx(e.currentTarget)}function ix(e){let t=(0,$.c)(66),{triggerId:n,labelledById:r,open:i,onOpenChange:a,value:o,onValueChange:s,templates:c,loading:l}=e,{_:u}=on(),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===Xb,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)(cx,{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)(nu,{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)(In,{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)(ke,{placeholder:C}),t[30]=C,t[31]=w);let T;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(kt,{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)(xt,{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)(zl,{className:Bn(`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)(cx,{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(Xb),a(!1)},t[42]=a,t[43]=s,t[44]=D):D=t[44];let O=o===Xb?`opacity-100`:`opacity-0`,k;t[45]===O?k=t[46]:(k=Bn(`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)(zl,{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)(xt,{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)(Nt,{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)(jn,{className:`w-[var(--radix-popover-trigger-width)] p-0`,align:`start`,onOpenAutoFocus:sx,onWheel:ox,onTouchMove:ax,children:(0,Z.jsxs)(Lt,{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)(Ln,{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 ax(e){e.stopPropagation()}function ox(e){e.stopPropagation()}function sx(e){e.preventDefault(),e.currentTarget.querySelector(`[cmdk-input]`)?.focus()}function cx(e){let t=(0,$.c)(7),{entry:n,className:r}=e;if(n.scope===`inherited`){let e;t[0]===r?e=t[1]:(e=Bn(`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)(Mp,{variant:`gray`,className:e,children:i}),t[4]=e,t[5]=i,t[6]=a):a=t[6],a}return null}function lx(e){return e.split(`/`).pop()??e}function ux(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=>lx(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 dx(e){return e.created.filter(e=>e.kind===`file`&&!e.path.split(`/`).includes(`.ok`)).map(e=>({path:e.path,name:lx(e.path)}))}function fx(e){let t=(0,$.c)(17),{plan:n,selectedPack:r}=e,{_:i}=on(),a,o,s,c;if(t[0]!==i||t[1]!==n||t[2]!==r){let e=ux(n,r),l=dx(n),u=(n.packSkills??[]).filter(bx),d=e.length,f=l.length,p=e.reduce(yx,0),m=u.length,h={"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`})},g=[d>0?{key:`folders`,n:d,label:i({id:`VsaI0G`,values:{folderCount:d}})}:null,f>0?{key:`files`,n:f,label:i({id:`DgcGrb`,values:{fileCount:f}})}:null,p>0?{key:`templates`,n:p,label:i({id:`ba3vIW`,values:{templateCount:p}})}:null,m>0?{key:`skills`,n:m,label:i({id:`HAvRAI`,values:{skillCount:m}})}:null].filter(vx),_=e.map(e=>({key:`folder:${e.path}`,icon:gd,name:`${lx(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})),v=l.map(e=>({key:`file:${e.path}`,icon:C,name:e.name,title:e.name,description:h[e.name]})),y=u.map(e=>({key:`skill:${e.name}`,icon:Rv,name:Op(e.name),title:e.name,description:i({id:`FEqWFL`})})),b=[{key:`folders`,label:i({id:`pcqlQu`,values:{0:_.length}}),rows:_},{key:`files`,label:i({id:`ZgGuA4`,values:{0:v.length}}),rows:v},{key:`skill`,label:i({id:`yK1m_z`,values:{0:y.length}}),rows:y}].filter(_x);s=`space-y-5`;let x;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(x=(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]=x):x=t[7];let S=g.length>0?(0,Z.jsx)(`div`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-0.5 text-xs`,children:g.map(gx)}):null;t[8]===S?c=t[9]:(c=(0,Z.jsxs)(`div`,{className:`flex flex-wrap justify-between items-baseline gap-x-2 gap-y-0.5`,children:[x,S]}),t[8]=S,t[9]=c),a=`space-y-5`,o=b.map(px),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 px(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(mx)})]},e.key)}function mx(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)(sr,{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)(cr,{children:(0,Z.jsx)(`ul`,{className:`space-y-0.5 text-left font-mono`,children:e.pillTooltip.map(hx)})})]}):(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 hx(e){return(0,Z.jsx)(`li`,{children:e},e)}function gx(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 _x(e){return e.rows.length>0}function vx(e){return e!==null}function yx(e,t){return e+t.templateCount}function bx(e){return e.pending}async function xx(e){let t=await e.json().catch(()=>null),n=gs.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 Sx(){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&&Vs(),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 xx(r)};let i=await r.json().catch(()=>null);return i?.plan?{ok:!0,plan:i.plan}:{ok:!1,error:{kind:`internal`,message:Ms._({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 xx(n)};let r=await n.json().catch(()=>null);return r?.result?(Vs(),{ok:!0,result:r.result}):{ok:!1,error:{kind:`internal`,message:Ms._({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:Ms._({id:`q-QUC7`})}}:{ok:!0,packs:t.packs}}}}var Cx={"knowledge-base":Vv,"software-lifecycle":$c,"codebase-wiki":_v,"plain-notes":dy,worldbuilding:Sv,"writing-pipeline":Qv,"entity-vault":Yv,okf:Dv};function wx(e){return Cx[e]??Vv}function Tx(e){let t=(0,$.c)(69),{onPackSelect:n,onCreateBlankFile:r,collapsedPackIds:i,className:a,packs:o}=e,{_:s}=on(),[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 Sx().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=Bn(`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=Bn(`@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(Cx).length},Dx).map(Ex)}),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=Bn(`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=Bn(`@container/packgrid w-full max-w-5xl`,a),t[47]=a,t[48]=k),x=pr,T=f,E=p;let s;t[49]===n?s=t[50]:(s=e=>(0,Z.jsx)(Ox,{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)(dr,{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:Bn(`grid gap-4 @sm/packgrid:grid-cols-2 @2xl/packgrid:grid-cols-3`,`pt-4`),children:C.map(e=>(0,Z.jsx)(Ox,{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)(fr,{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)(Vl,{"aria-hidden":`true`,className:Bn(`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)(ll,{"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 Ex(e){return(0,Z.jsx)(kx,{},`skeleton-${e}`)}function Dx(e,t){return t}function Ox(e){let t=(0,$.c)(17),{pack:n,onSelect:r}=e,i;t[0]===n.id?i=t[1]:(i=wx(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;return t[14]!==r||t[15]!==u?(d=(0,Z.jsx)(`button`,{type:`button`,onClick:r,className:`group flex h-full min-w-0 flex-col items-start gap-4 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}),t[14]=r,t[15]=u,t[16]=d):d=t[16],d}function kx(){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)(xd,{"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`})]}),(0,Z.jsx)(`div`,{className:`mt-auto h-3 w-20 animate-pulse rounded bg-muted`})]}),e[1]=n):n=e[1],n}var Ax=`knowledge-base`;function jx(e){let t=(0,$.c)(94),{open:n,onOpenChange:r,onSeedApplied:i,initialPackId:a}=e,{_:o}=on(),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??Ax),[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 Sx().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??Ax),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(Px),Sx().plan({rootDir:e,packId:f}).then(e=>{if(!r){if(!e.ok){l({kind:`error`,message:e.error.message});return}l(e.plan.created.length>0||e.plan.packSkills?.some(Nx)===!0?{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 Sx().apply(e,{packId:f})}catch(t){let n=t,r=n instanceof Error?n.message:String(n);Ns.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(Mx)===!0,c=o(a>0?{id:`x3-2ta`,values:{packName:n,projectEntries:a}}:s?{id:`B2Srgd`,values:{packName:n}}:{id:`K6jjWB`,values:{packName:n}});Ns.success(c);for(let e of t.result.packSkillConflicts??[]){let t=e.name,n=e.hosts?.join(`, `);Ns.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;Ns.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;t[21]===o?F=t[22]:(F=o({id:`gvApb7`}),t[21]=o,t[22]=F);let I;t[23]===o?I=t[24]:(I=o({id:`hCOLSd`}),t[23]=o,t[24]=I);let L;t[25]===o?L=t[26]:(L=o({id:`Fy4GgU`}),t[25]=o,t[26]=L);let R;t[27]===o?R=t[28]:(R=o({id:`Qw-7Ie`}),t[27]=o,t[28]=R);let z;t[29]===o?z=t[30]:(z=o({id:`_ayOfA`}),t[29]=o,t[30]=z);let B;t[31]===o?B=t[32]:(B=o({id:`Zf0w-R`}),t[31]=o,t[32]=B);let V;t[33]===o?V=t[34]:(V=o({id:`hmYd9H`}),t[33]=o,t[34]=V);let H;t[35]===o?H=t[36]:(H=o({id:`VBE2dw`}),t[35]=o,t[36]=H);let U;t[37]!==F||t[38]!==I||t[39]!==L||t[40]!==R||t[41]!==z||t[42]!==B||t[43]!==V||t[44]!==H?(U={"knowledge-base":F,"software-lifecycle":I,"codebase-wiki":L,"plain-notes":R,okf:z,"writing-pipeline":B,"entity-vault":V,worldbuilding:H},t[37]=F,t[38]=I,t[39]=L,t[40]=R,t[41]=z,t[42]=B,t[43]=V,t[44]=H,t[45]=U):U=t[45];let W=U,ee;t[46]!==o||t[47]!==W||t[48]!==x||t[49]!==v?(ee=v===`configure`&&x?W[x.id]??x.description:o({id:`msqUNq`}),t[46]=o,t[47]=W,t[48]=x,t[49]=v,t[50]=ee):ee=t[50];let G=ee,K;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(K=function(e){p(e),y(`configure`),b.current=!0},t[51]=K):K=t[51];let q=K,te;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(te=function(){y(`pick`),l({kind:`loading`}),b.current=!0},t[52]=te):te=t[52];let J=te,ne;t[53]===P?ne=t[54]:(ne=(0,Z.jsx)(hr,{children:P}),t[53]=P,t[54]=ne);let re;t[55]===G?re=t[56]:(re=(0,Z.jsx)(mr,{children:G}),t[55]=G,t[56]=re);let ie;t[57]!==ne||t[58]!==re?(ie=(0,Z.jsxs)(yr,{children:[ne,re]}),t[57]=ne,t[58]=re,t[59]=ie):ie=t[59];let ae;t[60]!==u||t[61]!==c||t[62]!==m||t[63]!==x||t[64]!==v||t[65]!==g?(ae=v===`pick`?(0,Z.jsx)(_r,{children:(0,Z.jsx)(Tx,{packs:u,onPackSelect:q})}):(0,Z.jsxs)(_r,{className:`space-y-6`,children:[(0,Z.jsx)(Fx,{choice:m,subfolder:g,placeholder:x?.defaultSubfolder??`subfolder`,onChoiceChange:h,onSubfolderChange:_}),(0,Z.jsx)(Ix,{phase:c,selectedPack:x})]}),t[60]=u,t[61]=c,t[62]=m,t[63]=x,t[64]=v,t[65]=g,t[66]=ae):ae=t[66];let oe;t[67]!==M||t[68]!==v?(oe=v===`configure`&&!M?(0,Z.jsxs)(X,{className:`mr-auto uppercase font-mono`,variant:`ghost`,onClick:J,children:[(0,Z.jsx)(ol,{"aria-hidden":`true`,className:`h-4 w-4`}),(0,Z.jsx)(Y,{id:`iH8pgl`})]}):null,t[67]=M,t[68]=v,t[69]=oe):oe=t[69];let se;t[70]===r?se=t[71]:(se=()=>r(!1),t[70]=r,t[71]=se);let ce;t[72]===c.kind?ce=t[73]:(ce=c.kind===`already-seeded`||c.kind===`error`?(0,Z.jsx)(Y,{id:`yz7wBu`}):(0,Z.jsx)(Y,{id:`dEgA5A`}),t[72]=c.kind,t[73]=ce);let le;t[74]!==se||t[75]!==ce?(le=(0,Z.jsx)(X,{className:`uppercase font-mono`,variant:`outline`,onClick:se,children:ce}),t[74]=se,t[75]=ce,t[76]=le):le=t[76];let ue;t[77]!==j||t[78]!==c.kind||t[79]!==v||t[80]!==O?(ue=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)(xd,{"aria-hidden":`true`,className:`h-4 w-4`}),(0,Z.jsx)(Y,{id:`XYlJJT`})]}):null,t[77]=j,t[78]=c.kind,t[79]=v,t[80]=O,t[81]=ue):ue=t[81];let de;t[82]!==oe||t[83]!==le||t[84]!==ue?(de=(0,Z.jsxs)(vr,{children:[oe,le,ue]}),t[82]=oe,t[83]=le,t[84]=ue,t[85]=de):de=t[85];let fe;t[86]!==ie||t[87]!==ae||t[88]!==de?(fe=(0,Z.jsxs)(gr,{className:`sm:max-w-4xl`,"data-ok-layer-spawned":``,children:[ie,ae,de]}),t[86]=ie,t[87]=ae,t[88]=de,t[89]=fe):fe=t[89];let pe;return t[90]!==r||t[91]!==n||t[92]!==fe?(pe=(0,Z.jsx)(br,{open:n,onOpenChange:r,children:fe}),t[90]=r,t[91]=n,t[92]=fe,t[93]=pe):pe=t[93],pe}function Mx(e){return e.pending}function Nx(e){return e.pending}function Px(e){return e.kind===`plan`||e.kind===`already-seeded`?e:{kind:`loading`}}function Fx(e){let t=(0,$.c)(22),{choice:n,subfolder:r,placeholder:i,onChoiceChange:a,onSubfolderChange:o}=e,{_:s}=on(),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Z.jsx)(Y,{id:`3wiBAs`})}),t[0]=c):c=t[0];let l;t[1]===a?l=t[2]:(l=e=>a(e),t[1]=a,t[2]=l);let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Lp,{children:(0,Z.jsx)(Y,{id:`RSqaSd`})}),t[3]=u):u=t[3];let d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Fp,{htmlFor:`seed-root-project-root`,children:(0,Z.jsxs)(Rp,{orientation:`horizontal`,children:[(0,Z.jsxs)(Pp,{children:[u,(0,Z.jsx)(Ip,{className:`text-1sm`,children:(0,Z.jsx)(Y,{id:`ZvzbDF`})})]}),(0,Z.jsx)(Ai,{value:`project-root`,id:`seed-root-project-root`})]})}),t[4]=d):d=t[4];let f;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(Lp,{children:(0,Z.jsx)(Y,{id:`ZWgr0b`})}),t[5]=f):f=t[5];let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Ip,{className:`nth-last-2:mt-0 text-1sm`,children:(0,Z.jsx)(Y,{id:`KQGZuq`})}),t[6]=p):p=t[6];let m;t[7]!==s||t[8]!==n||t[9]!==o||t[10]!==i||t[11]!==r?(m=n===`subfolder`&&(0,Z.jsx)(zf,{value:r,onChange:e=>o(e.target.value),placeholder:i,"aria-label":s({id:`NYUhy5`}),spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,className:`mt-1.5 font-mono text-xs bg-background`}),t[7]=s,t[8]=n,t[9]=o,t[10]=i,t[11]=r,t[12]=m):m=t[12];let h;t[13]===m?h=t[14]:(h=(0,Z.jsxs)(Pp,{children:[f,p,m]}),t[13]=m,t[14]=h);let g;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(Ai,{value:`subfolder`,id:`seed-root-subfolder`}),t[15]=g):g=t[15];let _;t[16]===h?_=t[17]:(_=(0,Z.jsx)(Fp,{htmlFor:`seed-root-subfolder`,children:(0,Z.jsxs)(Rp,{orientation:`horizontal`,children:[h,g]})}),t[16]=h,t[17]=_);let v;return t[18]!==n||t[19]!==_||t[20]!==l?(v=(0,Z.jsxs)(`div`,{className:`space-y-2 py-1`,children:[c,(0,Z.jsxs)(ji,{className:`sm:flex`,value:n,onValueChange:l,children:[d,_]})]}),t[18]=n,t[19]=_,t[20]=l,t[21]=v):v=t[21],v}function Ix(e){let t=(0,$.c)(24),{phase:n,selectedPack:r}=e,{_:i}=on();if(n.kind===`loading`){let e=r?.folders.length??6,n;t[0]===i?n=t[1]:(n=i({id:`--T3kB`}),t[0]=i,t[1]=n);let a;t[2]===e?a=t[3]:(a=(0,Z.jsx)(`ul`,{className:`space-y-2`,children:Array.from({length:e},Bx).map(zx)}),t[2]=e,t[3]=a);let o;return t[4]!==n||t[5]!==a?(o=(0,Z.jsx)(`section`,{role:`status`,"aria-busy":`true`,"aria-label":n,children:a}),t[4]=n,t[5]=a,t[6]=o):o=t[6],o}if(n.kind===`error`){let e;return t[7]===n.message?e=t[8]:(e=(0,Z.jsx)(`div`,{className:`rounded-md bg-destructive/10 p-3 text-sm text-destructive`,children:n.message}),t[7]=n.message,t[8]=e),e}if(n.kind===`already-seeded`){let e;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`p`,{className:`font-medium`,children:(0,Z.jsx)(Y,{id:`YwPUUP`})}),t[9]=e):e=t[9];let r;t[10]===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[10]=r):r=t[10];let i;return t[11]===n.plan?i=t[12]:(i=(0,Z.jsxs)(`div`,{className:`space-y-3 py-2 text-sm`,children:[r,(0,Z.jsx)(Vx,{plan:n.plan})]}),t[11]=n.plan,t[12]=i),i}let a;t[13]!==n.plan||t[14]!==r?(a=n.plan.created.length>0||n.plan.packSkills?.some(Rx)?(0,Z.jsx)(fx,{plan:n.plan,selectedPack:r}):null,t[13]=n.plan,t[14]=r,t[15]=a):a=t[15];let o;t[16]===n.plan.warnings?o=t[17]:(o=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(Lx)}):null,t[16]=n.plan.warnings,t[17]=o);let s;t[18]===n.plan?s=t[19]:(s=(0,Z.jsx)(Vx,{plan:n.plan}),t[18]=n.plan,t[19]=s);let c;return t[20]!==a||t[21]!==o||t[22]!==s?(c=(0,Z.jsxs)(`div`,{className:`space-y-6 py-1 text-sm`,children:[a,o,s]}),t[20]=a,t[21]=o,t[22]=s,t[23]=c):c=t[23],c}function Lx(e){return(0,Z.jsx)(`p`,{children:e},e)}function Rx(e){return e.pending}function zx(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 Bx(e,t){return t}function Vx(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(Ux)??[];if(e.length===0){a=null;break bb0}r=`rounded-md bg-warning/10 p-3 text-xs text-warning-foreground`,i=e.map(Hx)}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 Hx(e){return(0,Z.jsx)(`p`,{children:(0,Z.jsx)(Y,{id:`CtoghX`,values:{0:e.name}})},e.name)}function Ux(e){return e.conflict}var Wx=`Describe what this skill does and when to use it.`;function Gx(){let e=(0,$.c)(8),{_:t}=on(),n=fm(),r=pm(),[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=Dp(n.status===`ready`?n.data:[])[s],l=o?.name?.trim()||`new-skill`;if(!o?.name)for(let e=2;c.has(l);e++)l=`new-skill-${e}`;let u=o?.description?.trim()||`Describe what this skill does and when to use it.`;a(!0);let d=await Zp({scope:s,name:l,frontmatter:{name:l,description:u},body:``});if(a(!1),!d.ok){Ns.error(t({id:`xrVr_k`,values:{0:d.error}}));return}Ns.success(t({id:`Yy90sM`,values:{name:l}})),r(s,l,d.path===void 0?void 0:{path:d.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 Kx(){return(0,Q.useSyncExternalStore)(mm,hm,hm)}function qx(e,t){return e instanceof Error&&e.message?e.message:t}async function Jx(e,t,n,r=`action`){try{n(null),await e()}catch(e){console.error(`[${r}] action failed:`,e),n(qx(e,t))}}async function Yx(e,t,n=Ns,r=`action`){await Jx(e,t,e=>{e!==null&&n.error(e)},r)}var Xx=(0,Q.createContext)(!1);function Zx(e){let t=(0,$.c)(5),{children:n}=e,[r,i]=(0,Q.useState)($x),a,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{if(window.okDesktop)return;let e=new AbortController;return Kp(e.signal).then(t=>{e.signal.aborted||t.status!==`ok`||i(t.config.singleFile)}).catch(Qx),()=>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)(Xx,{value:r,children:n}),t[2]=n,t[3]=r,t[4]=s):s=t[4],s}function Qx(){}function $x(){return typeof window<`u`?window.okDesktop?.config.singleFile??!1:!1}function eS(){return(0,Q.use)(Xx)}function tS(e){return e.opened?e.isMain?`primary`:`worktree`:`none`}function nS(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)=>rS(e)-rS(t))}function rS(e){return e.isMain?0:e.opened?1:2}function iS(e){let t=e.split(/[/\\]/).filter(e=>e.length>0);return t.length>0?t[t.length-1]??e:e}function aS(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:iS(e.mainRoot),lastOpenedAt:``},worktrees:e.worktrees,projectSynthesized:t}})}function oS(e){let t=(0,$.c)(14),{path:n,name:r,onRemoveRecent:i,testIdPrefix:a}=e,{_:o}=on(),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)(hf,{"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 sS(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)(ti,{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)(hf,{"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)(ai,{children:(0,Z.jsxs)($r,{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)(si,{children:[o,d]}),t[10]=o,t[11]=d,t[12]=f):f=t[12],f}var cS=(0,Q.lazy)(()=>n(()=>import(`./BugReportHistoryDialog-C2b4xA3d.js`),__vite__mapDeps([51,12,1,13,14,27,16,17,18,28,29,30,26,24,25,31,22,38,39,40,41,37,42,43,44,45]),import.meta.url)),lS=3e3,uS=600,dS=20,fS=(e,t,n)=>Yx(e,t,n,`CommandPalette`);function pS(e){window.location.assign(Cf(e))}function mS(e,t){return e?.kind===`folder`||e?.kind===`folder-index`?e.folderPath:Kf(t)}function hS(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)(ft,{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)(gl,{className:`truncate font-medium`,children:(0,Z.jsx)(_S,{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)(gl,{className:`truncate text-muted-foreground text-xs`,children:(0,Z.jsx)(_S,{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)(gl,{className:`max-h-10 overflow-hidden text-muted-foreground text-xs leading-relaxed`,children:(0,Z.jsx)(_S,{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)(xt,{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 gS(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:xs(`find`)},components:{0:(0,Z.jsx)(ne,{"aria-label":Ss(`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 _S(e){let t=(0,$.c)(5),{text:n,query:r}=e,i;t[0]!==r||t[1]!==n?(i=Nb(n,r).map(vS),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 vS(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 yS({searchResults:e,fallbackSearchResults:t,searchStatus:n}){return e.length>0?e:n===`success`?[]:t}function bS(e){let t=(0,$.c)(150),{bridge:n,open:r,onOpenChange:i}=e,a=n===void 0?null:n,{_:o}=on(),s=eS(),[c,l]=(0,Q.useState)(``),u=(0,Q.useDeferredValue)(c),d=u.trim(),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=[],t[0]=f):f=t[0];let[p,m]=(0,Q.useState)(f),[h,g]=(0,Q.useState)(`idle`),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(!1),C;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(C=[],t[1]=C):C=t[1];let[w,T]=(0,Q.useState)(C),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(`idle`),A;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(A=[],t[2]=A):A=t[2];let[j,M]=(0,Q.useState)(A),N;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(N=[],t[3]=N):N=t[3];let[P,F]=(0,Q.useState)(N),[I,L]=(0,Q.useState)(null),[R,z]=(0,Q.useState)(!1),[B,V]=(0,Q.useState)(!1),[H,U]=(0,Q.useState)(!1),[W,ee]=(0,Q.useState)(!1),[G,K]=(0,Q.useState)(!1),[q,te]=(0,Q.useState)(!1),{createBlank:J}=Gx(),re=Mt(),ie;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(ie=[],t[4]=ie):ie=t[4];let[ae,oe]=(0,Q.useState)(ie),[se,ce]=(0,Q.useState)(`idle`),le;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(le=[],t[5]=le):le=t[5];let[de,fe]=(0,Q.useState)(le),[pe,me]=(0,Q.useState)(`idle`),he=(0,Q.useRef)(!1),ge=(0,Q.useRef)(null),_e=(0,Q.useRef)(null),ve=(0,Q.useRef)(null),ye=(0,Q.useRef)(null),{activeDocName:be,activeTarget:xe}=Oe(),{pages:Se,pageTitles:Ce,pageMeta:we,folderPaths:Te,filePaths:Ee,loading:De}=Eu(),Ae=Zc(),{states:je,refresh:Me}=qn(),{dispatch:Ne}=Tc(),Pe;t[6]===r?Pe=t[7]:(Pe={enabled:r},t[6]=r,t[7]=Pe);let{status:Fe,refresh:Le}=ad(Pe),Re=(Fe?.enabled??!1)&&(Fe?.keyPresent??!1),ze=Fe?.embedded??0,Be=Fe?.total??0,Ve=Re&&Be>0&&ze<Be,He;t[8]!==x||t[9]!==r||t[10]!==Le||t[11]!==Ve?(He=()=>{if(!r||!x||!Ve)return;let e=window.setInterval(()=>Le(),2500);return()=>window.clearInterval(e)},t[8]=x,t[9]=r,t[10]=Le,t[11]=Ve,t[12]=He):He=t[12];let Ue;t[13]!==x||t[14]!==r||t[15]!==Ve?(Ue=[r,x,Ve],t[13]=x,t[14]=r,t[15]=Ve,t[16]=Ue):Ue=t[16],(0,Q.useEffect)(He,Ue);let We=kc({docName:be,workspace:Ae}),Ge=Eb(Se,Te,Ce,we,Ee),Ke=vb(P,new Set(Ge.map(wS))),qe=a?.config.projectPath??null,Je=a?j.filter(e=>e.path!==qe):[],Ye=Kx(),Xe=a&&Ye?Ye.entries.filter(CS):[],Ze;t[17]!==be||t[18]!==xe?(Ze=mS(xe,be),t[17]=be,t[18]=xe,t[19]=Ze):Ze=t[19];let Qe=Ze,$e=d===``?[]:jb(Ge,d,8),et,tt;t[20]!==i||t[21]!==r?(et=()=>{let e=function(e){As(e,`command-palette`)&&(e.preventDefault(),!(!r&&rr())&&i(!r))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},tt=[i,r],t[20]=i,t[21]=r,t[22]=et,t[23]=tt):(et=t[22],tt=t[23]),(0,Q.useEffect)(et,tt);let rt,it;t[24]!==o||t[25]!==a||t[26]!==r||t[27]!==Me?(rt=()=>{if(r){if(F(hb()),Me(),a){let e=!1;return fS(async()=>{let t=await a.project.listRecent();e||M(t)},o({id:`fYKgzG`})),()=>{e=!0}}return}l(``),oe([]),ce(`idle`),he.current=!1,fe([]),me(`idle`),S(!1),ve.current?.abort(),ve.current=null,ye.current!==null&&(window.clearTimeout(ye.current),ye.current=null),T([]),D(null),k(`idle`)},it=[r,a,Me,o],t[24]=o,t[25]=a,t[26]=r,t[27]=Me,t[28]=rt,t[29]=it):(rt=t[28],it=t[29]),(0,Q.useEffect)(rt,it);let at;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(at=()=>{ge.current&&(ge.current.scrollTop=0)},t[30]=at):at=t[30];let ot;t[31]===c?ot=t[32]:(ot=[c],t[31]=c,t[32]=ot),(0,Q.useEffect)(at,ot);let st=new Set(ae.map(SS)),ct=x?{kind:`normal`,query:u}:Bb(u,st),lt=ct.kind!==`normal`,ut=lt||x,dt=ct.kind===`tag-list`?ct.query:``,ft=ct.kind===`tag-docs`?ct.tagName:``,pt=c.trim(),mt=x?Rb({query:pt,firedQuery:E,status:O,resultCount:w.length}):null,ht=mt?.submit?.query??``,gt=mt?.results.forQuery??``,_t,vt;t[33]!==lt||t[34]!==r?(_t=()=>{if(!r||!lt||he.current)return;he.current=!0,ce(`loading`);let e=!1;return Hb().then(t=>{e||(oe(t),ce(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tags failed`,t),oe([]),ce(`error`))}),()=>{e=!0}},vt=[r,lt],t[33]=lt,t[34]=r,t[35]=_t,t[36]=vt):(_t=t[35],vt=t[36]),(0,Q.useEffect)(_t,vt);let bt=ct.kind===`tag-docs`?ct.tagName:null;(0,Q.useEffect)(()=>{if(!r||bt===null){fe([]),me(`idle`);return}me(`loading`),fe([]);let e=!1;return Ub(bt).then(t=>{e||(fe(t),me(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tag docs failed`,t),fe([]),me(`error`))}),()=>{e=!0}},[r,bt]),(0,Q.useEffect)(()=>{if(!r||!d||ut||De){m([]),g(`idle`),v(!1),b(!1);return}let e=!1,t=!1,n=0,i=null,a,o;g(`loading`);let s=()=>e||n>=dS?!1:(n+=1,o=window.setTimeout(l,uS),!0),c=()=>{e||t&&s()||(m([]),g(`error`),v(!1),b(!1))};function l(){let n=new AbortController;i=n,a=window.setTimeout(()=>{n.abort(),c()},lS),Fb(d,{signal:n.signal}).then(n=>{let{entries:r,truncated:i,ready:o}=n;if(window.clearTimeout(a),!e){if(!o){t||(t=!0,m([]),v(!1),b(!0),g(`success`)),s()||b(!1);return}m(r),v(i),b(!1),g(`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,d,ut,De]);let St;t[37]!==o||t[38]!==i?(St=(e,t)=>{let n=t===void 0?o({id:`uuoHOU`}):t;i(!1),fS(async()=>{await e()},n)},t[37]=o,t[38]=i,t[39]=St):St=t[39];let Ct=St,wt;t[40]!==o||t[41]!==a?(wt=e=>{a&&fS(async()=>{await a.project.removeRecent(e),M(t=>t.filter(t=>t.path!==e))},o({id:`viwC-K`}))},t[40]=o,t[41]=a,t[42]=wt):wt=t[42];let Tt=wt,Et;t[43]!==o||t[44]!==a||t[45]!==Ct?(Et=e=>{if(!a)return;let t=e.worktreePath;if(t!==null){Ct(()=>a.project.open({path:t,target:`new-window`,entryPoint:`worktree`}),o({id:`LwMxXg`}));return}let n=e.branch;n!==null&&Ct(async()=>{let e=await a.worktree.create({branch:n,createBranch:!1});if(!e.ok)throw Error(e.reason);gm(),await a.project.open({path:e.path,target:`new-window`,entryPoint:`worktree`})},o({id:`LwMxXg`}))},t[43]=o,t[44]=a,t[45]=Ct,t[46]=Et):Et=t[46];let Dt=Et,Ot;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Ot=function(e){let t={kind:e.kind,path:e.path,lastOpenedAt:new Date().toISOString()},n=_b(hb(),t);gb(n),F(n)},t[47]=Ot):Ot=t[47];let At=Ot,jt;t[48]===i?jt=t[49]:(jt=function(e){i(!1),At(e),pS(e.path)},t[48]=i,t[49]=jt);let Pt=jt,Ft=!ut&&d===``&&Ke.length>0,It=yS({searchResults:p,fallbackSearchResults:$e,searchStatus:h}),Lt=!ut&&It.length>0,Rt=!ut&&d!==``&&(De||y)&&!Lt,zt=!ut&&d!==``&&h===`loading`&&!Lt&&!Rt,Bt=!ut&&a!==null&&Je.length>0&&(d===``||Je.some(e=>Ib(`${e.name} ${e.path}`,u,[`open recent project`]))),Vt=Xe.filter(e=>d===``||Ib(e.branch??``,u,[`worktree branch`])),Ht=!ut&&a!==null&&Vt.length>0,Ut=tn(),Wt=!ut&&!Ut&&We!==null&&(d===``||Wi.some(e=>{let t=e.displayName;return Ib(o({id:`WqLq6M`,values:{displayName:t}}),u,[e.id,`agent handoff`,`open in`])})),Gt=ct.kind===`tag-list`?Vb(ae,ct.query):[],Kt=ct.kind===`tag-list`&&se!==`loading`&&Gt.length===0,qt=ct.kind===`tag-docs`&&pe===`success`&&de.length===0,Jt=Ys(),Yt;t[50]===i?Yt=t[51]:(Yt=e=>{i(!1),zn(e)},t[50]=i,t[51]=Yt);let Xt=Yt,Zt;t[52]!==a||t[53]!==i?(Zt=e=>{i(!1),lm(e,a?{okDesktop:{shell:a.shell}}:{okDesktop:void 0})},t[52]=a,t[53]=i,t[54]=Zt):Zt=t[54];let Qt=Zt,$t;t[55]===i?$t=t[56]:($t=()=>i(!1),t[55]=i,t[56]=$t);let en;t[57]===L?en=t[58]:(en=e=>L(e),t[57]=L,t[58]=en);let nn;t[59]===z?nn=t[60]:(nn=()=>z(!0),t[59]=z,t[60]=nn);let rn;t[61]===V?rn=t[62]:(rn=()=>V(!0),t[61]=V,t[62]=rn);let an;t[63]===U?an=t[64]:(an=()=>U(!0),t[63]=U,t[64]=an);let sn;t[65]===ee?sn=t[66]:(sn=()=>{K(!0),ee(!0)},t[65]=ee,t[66]=sn);let cn;t[67]===te?cn=t[68]:(cn=()=>te(!0),t[67]=te,t[68]=cn);let ln;t[69]===J?ln=t[70]:(ln=()=>void J(`project`),t[69]=J,t[70]=ln);let un;t[71]===re?un=t[72]:(un=()=>re?.(),t[71]=re,t[72]=un);let dn={bridge:a,singleFile:s,activeDocName:be,contextualTargetKind:$y(xe),viewMenuState:Jt,emitMenuAction:Xt,runAction:Ct,openExternalUrl:Qt,closePalette:$t,openNewItemDialog:en,openSeedDialog:nn,openCreateProjectDialog:rn,openReportBugDialog:an,openBugReportHistory:sn,openFeedbackDialog:cn,createBlankSkill:ln,openBlobRun:un},fn=ut?[]:lb.flatMap(e=>{if(!e.available(dn)||e.visibility===`search-only`&&d===``)return[];let t=e.label(dn);return Ib(t,u,e.keywords)?[{cmd:e,label:t}]:[]}),pn=fn.length>0,mn;t[73]===o?mn=t[74]:(mn=e=>{switch(e){case`commands`:return o({id:`45MZFs`});case`project`:return o({id:`e0NrBM`});case`file`:return o({id:`J2eKUI`});case`view`:return o({id:`jpctdh`});case`terminal`:return o({id:`ALhMYW`});case`app`:return o({id:`IrC12v`})}},t[73]=o,t[74]=mn);let hn=mn,gn=e=>{let t=fn.filter(t=>t.cmd.group===e);return t.length===0?null:(0,Z.jsx)(nt,{heading:hn(e),children:t.map(e=>{let{cmd:t,label:n}=e,r=t.shortcutId!==void 0&&(t.shortcutDesktopOnly!==!0||a!==null)?xs(t.shortcutId):null;return(0,Z.jsxs)(xt,{value:`${n} ${t.keywords.join(` `)}`,onSelect:()=>t.dispatch(dn),"data-testid":`command-palette-${t.id}`,children:[(0,Z.jsx)(t.icon,{}),(0,Z.jsx)(`span`,{children:n}),t.checked?.(dn)?(0,Z.jsx)(zl,{className:`ml-auto text-muted-foreground`,"aria-hidden":`true`}):null,r?(0,Z.jsx)(Ie,{children:r}):null]},t.id)})},e)},_n=ut||Ft||Lt||zt||Rt||Bt||Wt||pn,vn;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(vn=function(e){l(`${zb}${e}`)},t[75]=vn):vn=t[75];let yn=vn,bn;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(bn=function(){ve.current?.abort(),ve.current=null,ye.current!==null&&(window.clearTimeout(ye.current),ye.current=null),T([]),D(null),k(`idle`)},t[76]=bn):bn=t[76];let xn=bn,Sn;t[77]===c?Sn=t[78]:(Sn=function(){S(!0),c.startsWith(`tag:`)&&l(c.slice(zb.length)),xn(),_e.current?.focus()},t[77]=c,t[78]=Sn);let Cn=Sn,wn;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(wn=function(){S(!1),l(``),xn(),_e.current?.focus()},t[79]=wn):wn=t[79];let Tn=wn,En=function(e){let t=e.trim();if(!t||De)return;ve.current?.abort(),ye.current!==null&&window.clearTimeout(ye.current);let n=new AbortController;ve.current=n,k(`loading`);let r=!1,i=window.setTimeout(()=>{r=!0,n.abort(),k(`error`)},lS);ye.current=i,Fb(t,{signal:n.signal,semantic:!0,limit:30}).then(e=>{let{entries:r}=e;Dn(i,n),T(r),D(t),k(`success`)}).catch(e=>{Dn(i,n),!(e instanceof Error&&e.name===`AbortError`&&!r)&&(console.debug(`[semantic-search] fire failed`,{timedOut:r,error:e}),k(`error`))})};function Dn(e,t){window.clearTimeout(e),ye.current===e&&(ye.current=null),ve.current===t&&(ve.current=null)}let On=function(e){!x||e.key!==`Enter`||(mt?.submit?(e.preventDefault(),e.stopPropagation(),En(mt.submit.query)):O===`loading`&&(e.preventDefault(),e.stopPropagation()))},kn;t[80]===x?kn=t[81]:(kn=function(e){x&&(e.preventDefault(),Tn())},t[80]=x,t[81]=kn);let An=kn,jn;t[82]===o?jn=t[83]:(jn=o({id:`1bDVu5`}),t[82]=o,t[83]=jn);let Mn;t[84]===o?Mn=t[85]:(Mn=o({id:`5GRxoA`}),t[84]=o,t[85]=Mn);let Nn;t[86]===Symbol.for(`react.memo_cache_sentinel`)?(Nn={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]=Nn):Nn=t[86];let Pn;t[87]!==o||t[88]!==x?(Pn=o(x?{id:`zXj1rA`}:{id:`ggs9f8`}),t[87]=o,t[88]=x,t[89]=Pn):Pn=t[89];let Fn;t[90]!==x||t[91]!==lt?(Fn=()=>{x&&(S(!1),xn()),l(lt?``:zb),_e.current?.focus()},t[90]=x,t[91]=lt,t[92]=Fn):Fn=t[92];let In=lt?`border-primary/30 bg-primary/10 text-primary`:`border-border bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`,Ln;t[93]===In?Ln=t[94]:(Ln=Bn(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors`,In),t[93]=In,t[94]=Ln);let Rn,Vn;t[95]===Symbol.for(`react.memo_cache_sentinel`)?(Rn=(0,Z.jsx)(yd,{className:`size-3.5`}),Vn=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`0rwwOn`})}),t[95]=Rn,t[96]=Vn):(Rn=t[95],Vn=t[96]);let Hn;t[97]!==lt||t[98]!==Fn||t[99]!==Ln?(Hn=(0,Z.jsxs)(`button`,{type:`button`,onClick:Fn,"data-testid":`command-palette-filter-tag`,"data-active":lt,"aria-pressed":lt,className:Ln,children:[Rn,Vn]}),t[97]=lt,t[98]=Fn,t[99]=Ln,t[100]=Hn):Hn=t[100];let Un;t[101]!==Cn||t[102]!==x||t[103]!==Re?(Un=Re?(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>x?Tn():Cn(),"data-testid":`command-palette-filter-semantic`,"data-active":x,"aria-pressed":x,className:Bn(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors`,x?`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)(ue,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`9tJX8r`})})]}):null,t[101]=Cn,t[102]=x,t[103]=Re,t[104]=Un):Un=t[104];let Wn;t[105]!==Hn||t[106]!==Un?(Wn=(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 border-b px-3 py-2`,children:[Hn,Un]}),t[105]=Hn,t[106]=Un,t[107]=Wn):Wn=t[107];let Gn;t[108]===Rt?Gn=t[109]:(Gn=Rt?(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)(xd,{"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(Y,{id:`yIPXut`})]}):null,t[108]=Rt,t[109]=Gn);let Kn;t[110]!==Lt||t[111]!==zt?(Kn=zt&&!Lt?(0,Z.jsx)(kt,{children:(0,Z.jsx)(Y,{id:`WRNXKp`})}):null,t[110]=Lt,t[111]=zt,t[112]=Kn):Kn=t[112];let Jn=gS,Yn=Lb(d,It,{truncated:_}),Xn;t[113]!==Jn||t[114]!==ut||t[115]!==ct.kind||t[116]!==Yn?(Xn=(0,Z.jsx)(Jn,{mode:Yn,inExclusiveMode:ut,paletteModeKind:ct.kind}),t[113]=Jn,t[114]=ut,t[115]=ct.kind,t[116]=Yn,t[117]=Xn):Xn=t[117];let Zn=I===`file`,Qn;t[118]===L?Qn=t[119]:(Qn=e=>{e||L(null)},t[118]=L,t[119]=Qn);let $n;t[120]!==Qe||t[121]!==Zn||t[122]!==Qn?($n=(0,Z.jsx)(nx,{open:Zn,onOpenChange:Qn,kind:`file`,initialDir:Qe}),t[120]=Qe,t[121]=Zn,t[122]=Qn,t[123]=$n):$n=t[123];let er=I===`folder`,tr;t[124]===L?tr=t[125]:(tr=e=>{e||L(null)},t[124]=L,t[125]=tr);let nr;t[126]!==Qe||t[127]!==er||t[128]!==tr?(nr=(0,Z.jsx)(nx,{open:er,onOpenChange:tr,kind:`folder`,initialDir:Qe}),t[126]=Qe,t[127]=er,t[128]=tr,t[129]=nr):nr=t[129];let ir;t[130]!==R||t[131]!==z?(ir=(0,Z.jsx)(jx,{open:R,onOpenChange:z}),t[130]=R,t[131]=z,t[132]=ir):ir=t[132];let ar;t[133]!==a||t[134]!==B||t[135]!==V?(ar=a?(0,Z.jsx)(Uy,{open:B,onOpenChange:V,bridge:a}):null,t[133]=a,t[134]=B,t[135]=V,t[136]=ar):ar=t[136];let X;t[137]!==a||t[138]!==H||t[139]!==U?(X=a?(0,Z.jsx)($_,{open:H,onOpenChange:U}):null,t[137]=a,t[138]=H,t[139]=U,t[140]=X):X=t[140];let or;t[141]!==a||t[142]!==G||t[143]!==W||t[144]!==ee||t[145]!==U?(or=a&&G?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(cS,{open:W,onOpenChange:ee,onReportABug:()=>{ee(!1),U(!0)}})}):null,t[141]=a,t[142]=G,t[143]=W,t[144]=ee,t[145]=U,t[146]=or):or=t[146];let sr;return t[147]!==q||t[148]!==te?(sr=(0,Z.jsx)(Gb,{open:q,onOpenChange:te,source:`command_palette`}),t[147]=q,t[148]=te,t[149]=sr):sr=t[149],(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(yt,{open:r,onOpenChange:i,title:jn,description:Mn,className:`sm:max-w-2xl`,commandProps:Nn,onEscapeKeyDown:An,children:[(0,Z.jsx)(ke,{ref:_e,value:c,onValueChange:l,onKeyDown:On,placeholder:Pn}),Wn,(0,Z.jsxs)(Nt,{ref:ge,className:`subtle-scrollbar`,children:[x&&mt?(0,Z.jsxs)(Z.Fragment,{children:[Ve?(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)(xd,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`kCNU4q`,values:{semanticIndexedCount:ze,semanticTotalCount:Be}})]}):null,mt.submit?(0,Z.jsx)(nt,{children:(0,Z.jsx)(xt,{value:`semantic-submit`,onSelect:()=>En(ht),"data-testid":`command-palette-semantic-submit`,children:mt.submit.kind===`retry`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ue,{}),(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)(Ie,{children:`↵`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ue,{}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,Z.jsx)(Y,{id:`FNTx6u`,values:{semanticSubmitQuery:ht}})}),(0,Z.jsx)(Ie,{children:`↵`})]})})}):null,mt.notice===`empty`?(0,Z.jsx)(kt,{"data-testid":`command-palette-semantic-empty`,children:(0,Z.jsx)(Y,{id:`l5J_HM`,components:{0:(0,Z.jsx)(ne,{"aria-label":o({id:`9Vnjc9`})})}})}):null,mt.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)(xd,{"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(Y,{id:`PBwmDJ`})]}):null,mt.notice===`no-results`?(0,Z.jsx)(kt,{"data-testid":`command-palette-semantic-no-results`,children:(0,Z.jsx)(Y,{id:`yFyZMJ`,values:{semanticQueryText:pt}})}):null,mt.results.show?(0,Z.jsx)(nt,{heading:mt.results.dimmed?o({id:`QlxHAH`,values:{semanticResultsLabel:gt}}):o({id:`9tJX8r`}),children:(0,Z.jsx)(`div`,{"data-testid":`command-palette-semantic-results`,"data-dimmed":mt.results.dimmed,children:w.map(e=>(0,Z.jsx)(hS,{entry:e,disabled:mt.results.dimmed,onSelect:()=>Pt(e)},mb(e.kind,e.path)))})}):null]}):null,Gn,Kn,_n?null:(0,Z.jsx)(kt,{children:h===`error`?(0,Z.jsx)(Y,{id:`pkAft1`}):(0,Z.jsx)(Y,{id:`i3f2kh`})}),ct.kind===`tag-list`?(0,Z.jsxs)(nt,{heading:ct.query?o({id:`evs0iw`,values:{tagListQuery:dt}}):o({id:`2QM24L`}),children:[se===`loading`?(0,Z.jsx)(kt,{children:(0,Z.jsx)(Y,{id:`a_u4ck`})}):null,se===`error`?(0,Z.jsx)(kt,{children:(0,Z.jsx)(Y,{id:`qTcZZu`,components:{0:(0,Z.jsx)(ne,{"aria-label":o({id:`69KLIV`})})}})}):null,Kt?(0,Z.jsx)(kt,{children:ct.query?o({id:`X0ttSN`,values:{tagListQuery:dt}}):o({id:`JLUTgi`})}):null,Gt.map(e=>(0,Z.jsxs)(xt,{value:`tag ${e.name}`,onSelect:()=>yn(e.name),"data-testid":`command-palette-tag-${e.name}`,children:[(0,Z.jsx)(yd,{}),(0,Z.jsx)(gl,{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,ct.kind===`tag-docs`?(0,Z.jsxs)(nt,{heading:o({id:`hGmuTc`,values:{tagDocsName:ft}}),children:[pe===`loading`?(0,Z.jsx)(kt,{children:(0,Z.jsx)(Y,{id:`pWbsW6`})}):null,pe===`error`?(0,Z.jsx)(kt,{children:(0,Z.jsx)(Y,{id:`z_4xza`,components:{0:(0,Z.jsx)(ne,{"aria-label":o({id:`69KLIV`})})}})}):null,qt?(0,Z.jsx)(kt,{children:o({id:`NIWAux`,values:{tagDocsName:ft}})}):null,de.map(e=>{let t=e.title||e.docName.split(`/`).pop()||e.docName,n=e.matchingTags.filter(e=>e!==ct.tagName).map(xS).join(`, `);return(0,Z.jsxs)(xt,{value:`tag-doc ${e.docName}`,onSelect:()=>{i(!1),pS(e.docName)},"data-testid":`command-palette-tag-doc-${e.docName}`,className:`items-start`,children:[(0,Z.jsx)(Rr,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(gl,{className:`truncate font-medium`,children:t}),(0,Z.jsx)(gl,{className:`truncate text-muted-foreground text-xs`,children:e.docName}),e.matchingTags.length>0&&e.matchingTags.some(e=>e!==ct.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,Ft?(0,Z.jsx)(nt,{heading:o({id:`MmDDWK`}),children:Ke.map(e=>(0,Z.jsx)(hS,{entry:e,onSelect:()=>Pt(e)},mb(e.kind,e.path)))}):null,gn(`commands`),Wt?(0,Z.jsx)(nt,{heading:o({id:`O7_W_a`}),children:Wi.filter(e=>{let t=e.displayName;return Ib(o({id:`WqLq6M`,values:{displayName:t}}),u,[e.id,`agent handoff`,`open in`])}).map(e=>{let t=je[e.id],n=t.installed===!0&&We!==null,r=e.displayName,a=t.installed===null?o({id:`IA6JW2`}):t.installed===!1?o({id:`5SwVv1`}):null,s=o(a?{id:`1ZpfyB`,values:{displayName:r,hint:a}}:{id:`WqLq6M`,values:{displayName:r}});return(0,Z.jsxs)(xt,{value:`send to ai ${e.displayName} ${e.id} agent open in`,disabled:!n,onSelect:()=>{!n||!We||(i(!1),Ne(e.id,We))},"data-testid":`command-palette-open-in-${e.id}`,"aria-label":s,children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`WqLq6M`,values:{displayName:r}})}),a?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-auto text-muted-foreground text-xs`,children:a}):null]},e.id)})}):null,gn(`project`),Bt&&a?(0,Z.jsx)(nt,{heading:o({id:`3iyGWF`}),children:Je.filter(e=>Ib(`${e.name} ${e.path}`,u,[`open recent project`])).slice(0,10).map(e=>{let t=e.isLinkedWorktree===!0,n=t?$c:gd,r=t&&e.mainRoot!==void 0?iS(e.mainRoot):null;return(0,Z.jsx)(sS,{path:e.path,onRemoveRecent:Tt,testIdPrefix:`command-palette-recent`,children:(0,Z.jsxs)(`div`,{className:`group/recent relative flex items-center`,children:[(0,Z.jsxs)(xt,{value:`${e.name} ${e.path} recent project`,onSelect:()=>Ct(()=>a.project.open({path:e.path,target:`new-window`,entryPoint:`recents`}),o({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)(gl,{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)(gl,{className:`truncate text-muted-foreground text-xs`,children:e.path})]})]}),(0,Z.jsx)(oS,{path:e.path,name:e.name,onRemoveRecent:Tt,testIdPrefix:`command-palette-recent`})]})},e.path)})}):null,Ht&&a?(0,Z.jsx)(nt,{heading:o({id:`sxjyRq`}),children:Vt.slice(0,10).map(e=>(0,Z.jsxs)(xt,{value:`${e.branch} worktree branch`,onSelect:()=>Dt(e),"data-testid":`command-palette-worktree-${e.branch}`,className:`items-start`,children:[(0,Z.jsx)($c,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(gl,{className:`truncate font-medium`,children:e.branch}),e.worktreePath===null?(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:o({id:`iO8V-7`})}):(0,Z.jsx)(gl,{className:`truncate text-muted-foreground text-xs`,children:e.worktreePath})]})]},e.branch))}):null,[`file`,`view`,`terminal`,`app`].map(e=>gn(e)),Lt?(0,Z.jsx)(nt,{heading:o({id:`A1taO8`}),children:It.map(e=>(0,Z.jsx)(hS,{entry:e,query:d,onSelect:()=>Pt(e)},mb(e.kind,e.path)))}):null]}),Xn]}),$n,nr,ir,ar,X,or,sr]})}function xS(e){return`#${e}`}function SS(e){return e.name}function CS(e){return e.branch!==null&&!e.isCurrent}function wS(e){return mb(e.kind,e.path)}function TS(e){return e===`eperm`?Ms._({id:`XuQzrk`}):Ms._({id:`BUyQnq`})}async function ES(e){let t=await e.restartServer(e.config.projectPath);return t.ok?{ok:!0}:{ok:!1,message:TS(t.reason)}}var DS=500;function OS(e,t,n){return t?`terminal`:e===null&&n?`retrying`:`hidden`}function kS(e){return e?.kind===`null-collab`}function AS(e){if(e===null)return Ms._({id:`Ua78MH`});if(e.kind===`null-collab`)return Ms._({id:`TJnkyf`});if(e.code===`network`)return Ms._({id:`aoa6xA`});if(e.code===`invalid-body`)return Ms._({id:`FRYB1Q`});let t=e.code;return Ms._({id:`4nj6n8`,values:{code:t}})}function jS(){let e=(0,$.c)(31),t=Mt(),{collabUrl:n,collabTerminal:r,collabLastError:i,retryCollab:a}=Oe(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=typeof window<`u`?window.okDesktop:void 0,p,m;e[0]!==r||e[1]!==n?(p=()=>{if(n!==null||r){s(!1);return}let e=setTimeout(()=>s(!0),DS);return()=>clearTimeout(e)},m=[n,r],e[0]=r,e[1]=n,e[2]=p,e[3]=m):(p=e[2],m=e[3]),(0,Q.useEffect)(p,m);let h=OS(n,r,o);if(h===`hidden`)return null;if(h===`terminal`){let n;e[4]===i?n=e[5]:(n=kS(i),e[4]=i,e[5]=n);let r=n,o;e[6]===i?o=e[7]:(o=AS(i),e[6]=i,e[7]=o);let s=o,p;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(p=async()=>{if(f){d(null),l(!0);try{let e=await ES(f);e.ok||(d(e.message),l(!1))}catch{l(!1)}}},e[8]=p):p=e[8];let m=p,h;e[9]!==s||e[10]!==r?(h=(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[9]=s,e[10]=r,e[11]=h):h=e[11];let g;e[12]===a?g=e[13]:(g=()=>{d(null),a()},e[12]=a,e[13]=g);let _;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(Y,{id:`6gRgw8`}),e[14]=_):_=e[14];let v;e[15]!==c||e[16]!==g?(v=(0,Z.jsx)(`button`,{type:`button`,onClick:g,disabled:c,className:`bg-red-950 text-red-50 px-2 py-0.5 rounded text-xs font-medium hover:bg-red-900 disabled:opacity-60`,children:_}),e[15]=c,e[16]=g,e[17]=v):v=e[17];let y;e[18]===c?y=e[19]:(y=f?(0,Z.jsx)(`button`,{type:`button`,onClick:m,disabled:c,className:`bg-red-950 text-red-50 px-2 py-0.5 rounded text-xs font-medium hover:bg-red-900 disabled:opacity-60`,children:c?(0,Z.jsx)(Y,{id:`0Er6-M`}):(0,Z.jsx)(Y,{id:`uaUc6t`})}):null,e[18]=c,e[19]=y);let b;e[20]===t?b=e[21]:(b=t?(0,Z.jsx)(`button`,{type:`button`,onClick:t,"aria-label":Ms._({id:`MsARMw`}),title:Ms._({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)(nr,{size:22,trackMouse:!1,variant:`sleeping`})}):null,e[20]=t,e[21]=b);let x;e[22]===u?x=e[23]:(x=u===null?null:(0,Z.jsx)(`span`,{className:`w-full text-red-950 text-xs`,children:u}),e[22]=u,e[23]=x);let S;return e[24]!==b||e[25]!==x||e[26]!==h||e[27]!==v||e[28]!==y?(S=(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:[h,v,y,b,x]}),e[24]=b,e[25]=x,e[26]=h,e[27]=v,e[28]=y,e[29]=S):S=e[29],S}let g;return e[30]===Symbol.for(`react.memo_cache_sentinel`)?(g=(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[30]=g):g=e[30],g}function MS(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=()=>Fn(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)(Uy,{open:r,onOpenChange:i,bridge:n}),t[2]=n,t[3]=r,t[4]=s):s=t[4],s}var NS=`ok-acp-desktop-migration-v1`,PS=[`ok-preferred-agent-v1`,`ok-ask-ai-agent-v2`,`ok-ask-ai-default-agent-v1`];function FS(e){try{return localStorage.getItem(e)}catch{return null}}function IS(){try{localStorage.setItem(NS,`1`)}catch{}}function LS(){return PS.some(e=>FS(e)!==null)}function RS(e){return Wi.every(t=>e[t.id]?.installed!=null)?Wi.filter(t=>e[t.id]?.installed===!0).map(e=>e.id):null}function zS(e){let t=(0,$.c)(3),n,r;t[0]===e?(n=t[1],r=t[2]):(n=()=>{if(FS(NS)!==null)return;if(!LS()){IS();return}let t=RS(e);if(t!==null){for(let e of t)Ji(Vi(e),!0);IS()}},r=[e],t[0]=e,t[1]=n,t[2]=r),(0,Q.useEffect)(n,r)}function BS(){let{states:e}=qn();return zS(e),null}function VS(e,t){e.chain().focus().insertContent({type:`text`,text:t}).run()}function HS(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 US(){let e=(0,$.c)(29),{_:t}=on(),[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=HS(t.editor);n&&r({editor:t.editor,...n})};return document.addEventListener(x,e),()=>document.removeEventListener(x,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=HS(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)(Nn,{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)(vl,{onSelect:e=>{let t=n.editor;r(null),VS(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)(jn,{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)(Ln,{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 WS(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(Sc(e)??Ms._({id:`lHwYMr`,values:{status:n,statusText:r}}))}return(await t.json()).docs??[]}function GS(){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`}),WS(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(p,e),()=>document.removeEventListener(p,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(Cf(e))},e[3]=d):d=e[3];let f=d,m=r??``,h;e[4]===m?h=e[5]:(h={tagName:m},e[4]=m,e[5]=h);let g;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(g={0:(0,Z.jsx)(`span`,{className:`font-mono break-all`})},e[6]=g):g=e[6];let _;e[7]===h?_=e[8]:(_=(0,Z.jsx)(yr,{children:(0,Z.jsx)(hr,{children:(0,Z.jsx)(Y,{id:`7H4UHD`,values:h,components:g})})}),e[7]=h,e[8]=_);let v=r??``,y;e[9]!==o||e[10]!==v?(y=(0,Z.jsx)(_r,{children:(0,Z.jsx)(KS,{fetchState:o,tag:v,onSelectDoc:f})}),e[9]=o,e[10]=v,e[11]=y):y=e[11];let b;e[12]!==_||e[13]!==y?(b=(0,Z.jsxs)(gr,{children:[_,y]}),e[12]=_,e[13]=y,e[14]=b):b=e[14];let x;return e[15]!==t||e[16]!==b?(x=(0,Z.jsx)(br,{open:t,onOpenChange:n,children:b}),e[15]=t,e[16]=b,e[17]=x):x=e[17],x}function KS(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(qS)}):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 qS(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 JS=`raw-mdx-nav`,YS=`ok-editor-mode-v1`,XS=[`wysiwyg`,`source`],ZS=`wysiwyg`;function QS(e){return XS.includes(e)}function $S(e=localStorage){try{let t=e.getItem(YS);if(t===null)return ZS;if(QS(t))return t;console.warn(`[editor-mode] invalid persisted value, falling back to default`,{raw:t})}catch{}return ZS}function eC(e=window,t=localStorage){let n=e.__OK_EDITOR_MODE__;return QS(n)?n:$S(t)}function tC(e,t=localStorage){try{return t.setItem(YS,e),!0}catch(e){return console.warn(`[editor-mode] persist failed`,e),!1}}function nC(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(eC),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=function(e){n(e),tC(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 rC(e){let t=(0,$.c)(4),{_:n}=on(),r=(0,Q.useRef)(!1),i,a;t[0]!==n||t[1]!==e?(i=()=>{e===`no-push-permission`&&!r.current&&(r.current=!0,Ns.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 iC(e,t){return e===`follow`?(0,Z.jsx)(Y,{id:`Sxx_Zz`,values:{project:t}}):e===`full`?(0,Z.jsx)(Y,{id:`4zEZS5`,values:{project:t}}):(0,Z.jsx)(Y,{id:`AaaESH`,values:{project:t}})}function aC(){let e=(0,$.c)(8),{projectLocalConfig:t,projectLocalSynced:n,projectLocalBinding:r}=xc(),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:``;Ns(iC(po({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 oC=`ok-terminal-placement-v1`;function sC(e){try{return to((e??localStorage).getItem(oC))}catch{return da}}function cC(e,t){try{(t??localStorage).setItem(oC,e)}catch{}}var lC=`ok-terminal-right-width-v1`;function uC(e){try{let t=(e??localStorage).getItem(lC);if(t===null||t.trim()===``)return mo;let n=Number(t);return Number.isFinite(n)?Ba(n):mo}catch{return mo}}function dC(e,t){try{(t??localStorage).setItem(lC,String(Ba(e)))}catch{}}function fC(e){let t=(0,$.c)(36),{open:n,variant:r,onResolved:i}=e,{_:a}=on(),o=el(),s;t[0]!==a||t[1]!==i||t[2]!==r||t[3]!==o?(s=function(e){if(o===null){Ns.error(a({id:`fiMNLl`}));return}let t=o(e?r===`follow`?`follow`:`full`:`off`);if(!t.ok){let n=t.error;Ns.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)(yr,{children:(0,Z.jsx)(rl,{variant:r})}),t[5]=r,t[6]=l);let u;t[7]===r?u=t[8]:(u=(0,Z.jsx)(al,{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)(_r,{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:`U4nTfu`}):(0,Z.jsx)(Y,{id:`XU0OXn`}),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)(vr,{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)(gr,{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)(br,{open:n,onOpenChange:pC,children:S}),t[33]=n,t[34]=S,t[35]=C):C=t[35],C}function pC(){}function mC(e){if(!(!e.autoSyncOnboardingDismissed&&e.hasRemote===!0&&e.projectLocalSynced===!0&&e.projectSynced===!0&&e.projectLocalConfig!==null&&po(e.projectLocalConfig.autoSync??void 0)===null&&wo(e.projectConfig?.autoSync?.default)===null))return null;switch(e.pushPermissionCheckStatus){case`allowed`:return`full`;case`denied`:return`follow`;default:return null}}function hC(e){let t=(0,$.c)(57),{primary:n,onPrimary:r,primaryDisabled:i,installedTargets: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}=on(),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)(Vl,{"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)(hi,{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)(Si,{}):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)(pi,{"aria-label":b({id:`vPKX2i`}),children:[(0,Z.jsxs)(_i,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(Y,{id:`RXEbZy`}),(0,Z.jsx)(Ui,{})]}),c?.map(e=>(0,Z.jsxs)(li,{onSelect:e.onSelect,"data-testid":_.threadAgent?.(e.key),children:[(0,Z.jsx)(pl,{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)(zl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.key))]}),w?(0,Z.jsx)(Si,{}):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]!==w||t[24]!==a||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)(pi,{"aria-label":b({id:`ALhMYW`}),children:[(0,Z.jsx)(_i,{children:(0,Z.jsx)(Y,{id:`ALhMYW`})}),S?S.map(e=>(0,Z.jsxs)(li,{onSelect:e.onSelect,"data-testid":D(e.cli),"aria-label":e.ariaLabel,children:[(0,Z.jsx)(qi,{id:Gi(e.cli),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.label}),e.selected?(0,Z.jsx)(zl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.cli)):u?(0,Z.jsxs)(li,{onSelect:u.onSelect,"data-testid":D(`claude`),"aria-label":b({id:`AcK_r0`}),children:[(0,Z.jsx)(qi,{id:Gi(`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)(zl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]}):null]}):null,x?(0,Z.jsxs)(Z.Fragment,{children:[C?(0,Z.jsx)(Si,{}):null,(0,Z.jsxs)(pi,{"aria-label":b({id:`BBqGS9`}),children:[(0,Z.jsx)(_i,{children:(0,Z.jsx)(Y,{id:`BBqGS9`})}),a.map(e=>(0,Z.jsxs)(li,{onSelect:()=>s(e),"data-testid":_.option(e.id),children:[(0,Z.jsx)(qi,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),o===e.id?(0,Z.jsx)(zl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null]}):null,t[21]=b,t[22]=S,t[23]=w,t[24]=a,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)(Si,{}):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)(Rn,{"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)(li,{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)(yi,{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)(xi,{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)(uf,{children:[O,B]}),t[54]=B,t[55]=O,t[56]=V):V=t[56],V}function gC(e){let t=(0,$.c)(9),{onStartNewChat:n}=e,{_:r}=on(),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)(Mn,{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)(li,{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)(pi,{"aria-label":i,children:s}),t[6]=i,t[7]=s,t[8]=c):c=t[8],c}function _C(){let e=(0,$.c)(12),t=Hi(),n=Li(),r=Yi(),i,a;if(e[0]!==r||e[1]!==t||e[2]!==n){let o;e[5]===t?o=e[6]:(o=e=>Ki(t,e.source,e.id,!0,e.supported),e[5]=t,e[6]=o);let s=n.filter(o),c=Ri(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:()=>{Xi(e),Xs($s)}})),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 vC(e){let t=(0,$.c)(68),{threadIds:n,selectableIds:r,testIdPrefix:i}=e,{_:a}=on(),o=_C(),s=Oy(),c=qs(),l=c?.kind===`thread`?c:null,u=jy(),d;t[0]!==l||t[1]!==o.threadAgent?.iconUrl||t[2]!==o.threadAgent?.id?(d=l===null?(0,Z.jsx)(pl,{agentId:o.threadAgent?.id??``,iconUrl:o.threadAgent?.iconUrl,className:`size-4`}):(0,Z.jsx)(pl,{agentId:l.agentId,iconUrl:l.iconUrl,className:`size-4`}),t[0]=l,t[1]=o.threadAgent?.iconUrl,t[2]=o.threadAgent?.id,t[3]=d):d=t[3];let f=d,p=r.length>0&&n.length===r.length,m;t[4]!==p||t[5]!==r?(m=()=>Ye(r,!p),t[4]=p,t[5]=r,t[6]=m):m=t[6];let h;t[7]!==a||t[8]!==p?(h=a(p?{id:`Ns5f4J`}:{id:`8oWgty`}),t[7]=a,t[8]=p,t[9]=h):h=t[9];let g;t[10]!==p||t[11]!==m||t[12]!==h?(g=(0,Z.jsx)(Hr,{checked:p,onCheckedChange:m,"aria-label":h}),t[10]=p,t[11]=m,t[12]=h,t[13]=g):g=t[13];let _;t[14]!==r.length||t[15]!==n.length?(_=(0,Z.jsxs)(`span`,{className:`truncate tabular-nums`,children:[n.length,`/`,r.length]}),t[14]=r.length,t[15]=n.length,t[16]=_):_=t[16];let v;t[17]!==g||t[18]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[g,_]}),t[17]=g,t[18]=_,t[19]=v):v=t[19];let y;t[20]===a?y=t[21]:(y=a({id:`LaskKp`,values:{0:Ss(`send-comment-queue`)}}),t[20]=a,t[21]=y);let b;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(b=xs(`send-comment-queue`),t[22]=b):b=t[22];let x;t[23]===y?x=t[24]:(x=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 font-mono text-[13px] text-muted-foreground`,title:y,children:b}),t[23]=y,t[24]=x);let S;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[25]=S):S=t[25];let C;t[26]===l?C=t[27]:(C=(0,Z.jsx)(`span`,{className:`truncate`,children:l===null?(0,Z.jsx)(Y,{id:`vPF04k`}):(0,Z.jsx)(Y,{id:`sKEgGd`})}),t[26]=l,t[27]=C);let w;t[28]!==f||t[29]!==C?(w=(0,Z.jsxs)(Z.Fragment,{children:[f,C]}),t[28]=f,t[29]=C,t[30]=w):w=t[30];let T;t[31]!==u||t[32]!==n?(T=()=>u(n),t[31]=u,t[32]=n,t[33]=T):T=t[33];let E=n.length===0,D;t[34]!==s||t[35]!==l||t[36]!==n?(D=l===null?void 0:(0,Z.jsx)(gC,{onStartNewChat:()=>void He({compose:s,threadIds:n})}),t[34]=s,t[35]=l,t[36]=n,t[37]=D):D=t[37];let O;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(O=(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[38]=O):O=t[38];let k;t[39]===a?k=t[40]:(k=a({id:`nbLQ_9`}),t[39]=a,t[40]=k);let A=`${i}-send`,j=`${i}-send-trigger`,M=`${i}-send-menu`,N,P;t[41]===i?(N=t[42],P=t[43]):(N=e=>`${i}-agent-option-${e}`,P=e=>`${i}-agent-option-thread-${e}`,t[41]=i,t[42]=N,t[43]=P);let F=`${i}-agent-option-settings`,I;t[44]===i?I=t[45]:(I=e=>`${i}-agent-option-terminal-${e}`,t[44]=i,t[45]=I);let L;t[46]!==A||t[47]!==j||t[48]!==M||t[49]!==N||t[50]!==P||t[51]!==F||t[52]!==I?(L={primary:A,trigger:j,menu:M,option:N,threadAgent:P,settings:F,terminal:I},t[46]=A,t[47]=j,t[48]=M,t[49]=N,t[50]=P,t[51]=F,t[52]=I,t[53]=L):L=t[53];let R;t[54]!==o.rows||t[55]!==w||t[56]!==T||t[57]!==E||t[58]!==D||t[59]!==k||t[60]!==L?(R=(0,Z.jsx)(hC,{installedTargets:S,selectedTargetId:null,onSelectTarget:yC,primary:w,onPrimary:T,primaryDisabled:E,menuLeading:D,onOpenSettings:Cs,menuEmptyState:O,triggerAriaLabel:k,testIds:L,...o.rows}),t[54]=o.rows,t[55]=w,t[56]=T,t[57]=E,t[58]=D,t[59]=k,t[60]=L,t[61]=R):R=t[61];let z;t[62]!==R||t[63]!==x?(z=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[x,R]}),t[62]=R,t[63]=x,t[64]=z):z=t[64];let B;return t[65]!==z||t[66]!==v?(B=(0,Z.jsxs)(Am,{className:`justify-between`,children:[v,z]}),t[65]=z,t[66]=v,t[67]=B):B=t[67],B}function yC(){}function bC(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 xC(e,t){let n=Math.max(1,Math.floor((t-e)/1e3));if(n<60)return Ms._({id:`Qpfxa1`,values:{secs:n}});let r=Math.floor(n/60);if(r<60)return Ms._({id:`4uaCUA`,values:{mins:r}});let i=Math.floor(r/60);if(i<24)return Ms._({id:`_oqig9`,values:{hours:i}});let a=Math.floor(i/24);return a<7?Ms._({id:`XWEqQj`,values:{days:a}}):new Date(e).toLocaleDateString()}function SC(e){let t=(0,$.c)(97),{thread:n,now:r,cardRef:i,focused:o,sending:s,onClose:c}=e,{_:l}=on(),[u,d]=(0,Q.useState)(n.body),[f,p]=(0,Q.useState)(!1),m=(0,Q.useRef)(null),h=n.status===`orphaned`,g=n.status===`resolved`,_,v;t[0]===f?(_=t[1],v=t[2]):(_=()=>{if(!f)return;let e=m.current;if(e===null)return;e.focus();let t=e.value.length;e.setSelectionRange(t,t)},v=[f],t[0]=f,t[1]=_,t[2]=v),(0,Q.useEffect)(_,v);let y;t[3]===n?y=t[4]:(y=function(e){if(n.anchor===null)return;if(Ee(n.docName)===null){Id(n);return}if(n.target.kind===`property`){wd({key:n.target.key,path:n.target.path,quote:e,start:n.anchor.start,end:n.anchor.end});return}let t=Ee(n.docName);if(!t)return;let r=jd(t.state.doc,e,n.anchor);r&&(t.chain().focus().setTextSelection(r).run(),Od(t,r))},t[3]=n,t[4]=y);let b=y,x;t[5]===n.body?x=t[6]:(x=function(){d(n.body),p(!1)},t[5]=n.body,t[6]=x);let S=x,C;t[7]!==u||t[8]!==n.body||t[9]!==n.id?(C=function(){let e=u.trim();if(e.length===0||e===n.body){p(!1);return}Rt(n.id,e),p(!1)},t[7]=u,t[8]=n.body,t[9]=n.id,t[10]=C):C=t[10];let w=C,T;t[11]!==n.docName||t[12]!==n.id?(T=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&&wt(n.id,a,Ld(e.state.doc,t,r))},t[11]=n.docName,t[12]=n.id,t[13]=T):T=t[13];let E=T,D,O,k,A;t[14]===n.id?(D=t[15],O=t[16],k=t[17],A=t[18]):(O=()=>$e(n.id),k=()=>ve(n.id),A=()=>$e(n.id),D=()=>ve(n.id),t[14]=n.id,t[15]=D,t[16]=O,t[17]=k,t[18]=A);let j=g&&`opacity-70`,M=h&&`border-amber-500/40 bg-amber-500/5`,N=o&&`ring-2 ring-primary`,P;t[19]!==j||t[20]!==M||t[21]!==N?(P=Bn(`flex flex-col gap-1.5 rounded-lg border p-2.5 transition-shadow`,j,M,N),t[19]=j,t[20]=M,t[21]=N,t[22]=P):P=t[22];let F;t[23]!==l||t[24]!==g||t[25]!==s||t[26]!==n.id?(F=!g&&(0,Z.jsx)(Hr,{checked:s,onCheckedChange:()=>qt(n.id),"aria-label":l(s?{id:`1jym2J`}:{id:`t7YoBO`})}),t[23]=l,t[24]=g,t[25]=s,t[26]=n.id,t[27]=F):F=t[27];let I;t[28]!==r||t[29]!==n.createdAt?(I=xC(n.createdAt,r),t[28]=r,t[29]=n.createdAt,t[30]=I):I=t[30];let L;t[31]===I?L=t[32]:(L=(0,Z.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground`,children:I}),t[31]=I,t[32]=L);let R;t[33]!==F||t[34]!==L?(R=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[F,L]}),t[33]=F,t[34]=L,t[35]=R):R=t[35];let z;t[36]===g?z=t[37]:(z=g&&(0,Z.jsxs)(Mp,{variant:`outline`,className:`gap-1 border-green-600/40 text-green-700 dark:text-green-500`,children:[(0,Z.jsx)(zl,{className:`size-2.5`}),(0,Z.jsx)(Y,{id:`O6H89R`})]}),t[36]=g,t[37]=z);let B;t[38]===h?B=t[39]:(B=h&&(0,Z.jsxs)(Mp,{variant:`outline`,className:`gap-1 border-amber-500/50 text-amber-600 dark:text-amber-500`,children:[(0,Z.jsx)(Ed,{className:`size-2.5`}),(0,Z.jsx)(Y,{id:`UEdTEN`})]}),t[38]=h,t[39]=B);let V;t[40]!==l||t[41]!==f||t[42]!==g||t[43]!==n.body?(V=!g&&(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,"aria-label":l({id:`akmOT9`}),title:l({id:`akmOT9`}),"aria-expanded":f,className:Bn(`size-6 p-0`,f?`text-foreground`:`text-muted-foreground hover:text-foreground`),onClick:()=>{d(n.body),p(CC)},children:(0,Z.jsx)(it,{className:`size-3.5`})}),t[40]=l,t[41]=f,t[42]=g,t[43]=n.body,t[44]=V):V=t[44];let H;t[45]===l?H=t[46]:(H=l({id:`X2zUS5`}),t[45]=l,t[46]=H);let U;t[47]===l?U=t[48]:(U=l({id:`X2zUS5`}),t[47]=l,t[48]=U);let W;t[49]===n.id?W=t[50]:(W=()=>a(n.id),t[49]=n.id,t[50]=W);let ee;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(ff,{className:`size-3.5`}),t[51]=ee):ee=t[51];let G;t[52]!==H||t[53]!==U||t[54]!==W?(G=(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,className:`size-6 p-0 text-muted-foreground hover:text-destructive`,"aria-label":H,title:U,onClick:W,children:ee}),t[52]=H,t[53]=U,t[54]=W,t[55]=G):G=t[55];let K;t[56]!==l||t[57]!==c?(K=c&&(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,className:`-mr-1 size-6 p-0 text-muted-foreground hover:text-foreground`,"aria-label":l({id:`yz7wBu`}),onClick:c,children:(0,Z.jsx)(hf,{className:`size-3.5`})}),t[56]=l,t[57]=c,t[58]=K):K=t[58];let q;t[59]!==z||t[60]!==B||t[61]!==V||t[62]!==G||t[63]!==K?(q=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[z,B,V,G,K]}),t[59]=z,t[60]=B,t[61]=V,t[62]=G,t[63]=K,t[64]=q):q=t[64];let te;t[65]!==R||t[66]!==q?(te=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[R,q]}),t[65]=R,t[66]=q,t[67]=te):te=t[67];let J;t[68]!==l||t[69]!==h||t[70]!==b||t[71]!==n.anchor||t[72]!==n.target?(J=h?(0,Z.jsx)(`p`,{className:`rounded border-l-2 border-amber-500/60 bg-amber-500/10 px-2 py-1 text-xs text-amber-700 dark:text-amber-400`,children:(0,Z.jsx)(Y,{id:`nG-XA9`})}):(0,Z.jsx)(X,{type:`button`,variant:`ghost`,disabled:n.anchor===null,onClick:()=>b(n.anchor?.quote??``),title:n.anchor===null?l({id:`aoT2xX`}):n.target.kind===`property`?l({id:`5GBQ-F`}):l({id:`DpjYd6`}),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:[Td(n.target.key,n.target.path),`:`,n.anchor===null?``:` “${n.anchor.quote}”`]}):(0,Z.jsxs)(Z.Fragment,{children:[`“`,n.anchor?.quote??``,`”`]})})}),t[68]=l,t[69]=h,t[70]=b,t[71]=n.anchor,t[72]=n.target,t[73]=J):J=t[73];let ne;t[74]===n.body?ne=t[75]:(ne=(0,Z.jsx)(`p`,{className:`text-sm text-foreground/90`,children:n.body}),t[74]=n.body,t[75]=ne);let re;t[76]!==l||t[77]!==S||t[78]!==u||t[79]!==f||t[80]!==h||t[81]!==g||t[82]!==E||t[83]!==w||t[84]!==n.id?(re=h?(0,Z.jsxs)(X,{size:`sm`,variant:`outline`,className:`min-w-0`,onClick:E,children:[(0,Z.jsx)(Sd,{className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:(0,Z.jsx)(Y,{id:`QlkiD5`})})]}):(0,Z.jsxs)(Z.Fragment,{children:[f&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(Pm,{ref:m,rows:1,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{if(e.key===`Escape`){S();return}e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),w())},placeholder:l({id:`akmOT9`}),className:`min-h-0 resize-none px-2 py-1 text-sm leading-5`}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,onClick:S,children:(0,Z.jsx)(Y,{id:`dEgA5A`})}),(0,Z.jsx)(X,{size:`sm`,onClick:w,disabled:u.trim().length===0,"aria-label":l({id:`3W5kYZ`}),children:(0,Z.jsx)(Y,{id:`tfDRzk`})})]})]}),g&&(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:()=>Ke(n.id),children:[(0,Z.jsx)(Mi,{className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:(0,Z.jsx)(Y,{id:`M7SqjM`})})]})})]}),t[76]=l,t[77]=S,t[78]=u,t[79]=f,t[80]=h,t[81]=g,t[82]=E,t[83]=w,t[84]=n.id,t[85]=re):re=t[85];let ie;return t[86]!==i||t[87]!==D||t[88]!==P||t[89]!==te||t[90]!==J||t[91]!==ne||t[92]!==re||t[93]!==O||t[94]!==k||t[95]!==A?(ie=(0,Z.jsxs)(`article`,{ref:i,onPointerEnter:O,onPointerLeave:k,onFocusCapture:A,onBlurCapture:D,className:P,children:[te,J,ne,re]}),t[86]=i,t[87]=D,t[88]=P,t[89]=te,t[90]=J,t[91]=ne,t[92]=re,t[93]=O,t[94]=k,t[95]=A,t[96]=ie):ie=t[96],ie}function CC(e){return!e}function wC(e){let t=(0,$.c)(27),{threads:n,groupByDocument:r,empty:i,testIdPrefix:a}=e,o=r===void 0?!1:r,{_:s}=on(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=new Map,t[0]=f):f=t[0];let p=(0,Q.useRef)(f),[m]=(0,Q.useState)(MC),[h,g]=(0,Q.useState)(jC),_=W(),v;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(v=function(e,t){g(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r})},t[1]=v):v=t[1];let y=v,b=(0,Q.useRef)(null),x,S;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>{let e=Pe(e=>{d(e),p.current.get(e)?.scrollIntoView({block:`center`,behavior:`smooth`}),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>{b.current=null,d(t=>t===e?null:t)},1600)});return()=>{e(),b.current!==null&&window.clearTimeout(b.current)}},S=[],t[2]=x,t[3]=S):(x=t[2],S=t[3]),(0,Q.useEffect)(x,S);let C;if(t[4]!==s||t[5]!==h||t[6]!==i||t[7]!==u||t[8]!==o||t[9]!==m||t[10]!==_||t[11]!==c||t[12]!==a||t[13]!==n){let e=n.filter(AC),r;t[15]===n?r=t[16]:(r=n.filter(kC),t[15]=n,t[16]=r);let d=r,f=c?n:e,v=o?bC(f):[],b=v.length>0&&v.every(e=>h.has(e.docName)),x;t[17]===_?x=t[18]:(x=e=>_.includes(e.id),t[17]=_,t[18]=x);let S=e.filter(x).map(OC),w=function(e){return(0,Z.jsx)(SC,{thread:e,now:m,sending:_.includes(e.id),focused:u===e.id,cardRef:t=>{t?p.current.set(e.id,t):p.current.delete(e.id)}},e.id)},T;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Dm,{children:(0,Z.jsx)(Y,{id:`VbyRUy`})}),t[19]=T):T=t[19];let E;t[20]!==s||t[21]!==d.length||t[22]!==c||t[23]!==a?(E=d.length>0&&(0,Z.jsxs)(ur,{children:[(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(X,{size:`icon`,variant:`ghost`,className:`size-6 shrink-0 text-muted-foreground`,"aria-label":s(c?{id:`G1zJlD`}:{id:`_YEyHO`}),"aria-pressed":c,"data-testid":`${a}-resolved-toggle`,onClick:()=>l(DC),children:c?(0,Z.jsx)(yv,{"aria-hidden":`true`,className:`size-3.5`}):(0,Z.jsx)(zl,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsx)(cr,{children:c?(0,Z.jsx)(Y,{id:`LRLKnQ`}):(0,Z.jsx)(Y,{id:`j0ItfO`,values:{0:d.length}})})]}),t[20]=s,t[21]=d.length,t[22]=c,t[23]=a,t[24]=E):E=t[24];let D=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[E,v.length>1&&(0,Z.jsxs)(ur,{children:[(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(X,{size:`icon`,variant:`ghost`,className:`size-6 shrink-0 text-muted-foreground`,"aria-label":s(b?{id:`QIrBIx`}:{id:`sR0I-f`}),"data-testid":`${a}-collapse-toggle`,onClick:()=>g(b?new Set:new Set(v.map(EC))),children:b?(0,Z.jsx)(wy,{"aria-hidden":`true`,className:`size-3.5`}):(0,Z.jsx)(Mv,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsx)(cr,{children:b?(0,Z.jsx)(Y,{id:`QIrBIx`}):(0,Z.jsx)(Y,{id:`sR0I-f`})})]}),(0,Z.jsx)(jm,{children:e.length})]}),O;t[25]===D?O=t[26]:(O=(0,Z.jsxs)(Mm,{children:[T,D]}),t[25]=D,t[26]=O),C=(0,Z.jsxs)(Nm,{children:[O,(0,Z.jsx)(km,{className:`flex flex-col gap-3`,children:f.length===0?(0,Z.jsx)(Om,{children:i}):o?v.map(e=>(0,Z.jsx)(`section`,{"aria-label":e.docName,children:(0,Z.jsxs)(pr,{open:!h.has(e.docName),onOpenChange:t=>y(e.docName,t),className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-1.5`,children:(0,Z.jsxs)(fr,{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)(Rr,{className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:Md(e.docName)}),(0,Z.jsx)(Mp,{variant:`outline`,className:`shrink-0 px-1 py-0 text-[10px] tabular-nums`,children:e.threads.length}),(0,Z.jsx)(Hl,{"aria-hidden":`true`,className:`size-3 shrink-0 transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`})]})}),(0,Z.jsx)(dr,{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(w)})]})},e.docName)):f.map(w)}),e.length>0&&(0,Z.jsx)(vC,{threadIds:S,selectableIds:e.map(TC),testIdPrefix:a})]}),t[4]=s,t[5]=h,t[6]=i,t[7]=u,t[8]=o,t[9]=m,t[10]=_,t[11]=c,t[12]=a,t[13]=n,t[14]=C}else C=t[14];return C}function TC(e){return e.id}function EC(e){return e.docName}function DC(e){return!e}function OC(e){return e.id}function kC(e){return e.status===`resolved`}function AC(e){return e.status!==`resolved`}function jC(){return new Set}function MC(){return Date.now()}function NC(){let e=(0,$.c)(3),t=de(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(Y,{id:`QzofTX`}),e[0]=n):n=e[0];let r;return e[1]===t?r=e[2]:(r=(0,Z.jsx)(wC,{threads:t,groupByDocument:!0,empty:n,testIdPrefix:`comment-queue`}),e[1]=t,e[2]=r),r}function PC(e){let t=(0,$.c)(6),{docName:n}=e,r=g(n),i,a;t[0]===n?(i=t[1],a=t[2]):(i=()=>{Bt(n).catch(FC)},a=[n],t[0]=n,t[1]=i,t[2]=a),(0,Q.useEffect)(i,a);let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Y,{id:`zpfN9p`}),t[3]=o):o=t[3];let s;return t[4]===r?s=t[5]:(s=(0,Z.jsx)(wC,{threads:r,empty:o,testIdPrefix:`comment-doc`}),t[4]=r,t[5]=s),s}function FC(){}function IC(e){let t=(0,$.c)(2),{docName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(bp,{name:`comments-panel`,children:(0,Z.jsx)(PC,{docName:n})}),t[0]=n,t[1]=r),r}function LC(e){let t=(0,$.c)(17),{docName:n}=e,{_:r}=on(),[i,a]=(0,Q.useState)(`doc`),o,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>(lt()&&a(`project`),l(()=>a(`project`))),s=[],t[0]=o,t[1]=s):(o=t[0],s=t[1]),(0,Q.useEffect)(o,s);let c,u;t[2]!==n||t[3]!==i?(c=()=>(Ny({scope:i,docName:n}),RC),u=[i,n],t[2]=n,t[3]=i,t[4]=c,t[5]=u):(c=t[4],u=t[5]),(0,Q.useEffect)(c,u);let d;t[6]===r?d=t[7]:(d=r({id:`ZWyHmq`}),t[6]=r,t[7]=d);let f;t[8]!==i||t[9]!==d?(f=(0,Z.jsx)(bu,{scope:i,onScopeChange:a,projectLabel:d}),t[8]=i,t[9]=d,t[10]=f):f=t[10];let p;t[11]!==n||t[12]!==i?(p=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:i===`doc`?(0,Z.jsx)(IC,{docName:n}):(0,Z.jsx)(NC,{})}),t[11]=n,t[12]=i,t[13]=p):p=t[13];let m;return t[14]!==f||t[15]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col pt-2`,children:[f,p]}),t[14]=f,t[15]=p,t[16]=m):m=t[16],m}function RC(){return Ny(null)}var zC=new Map(Ro.map(e=>[e.id,e.alias]));function BC(e){return e.source===`markdownlint`?zC.get(e.code):void 0}function VC(e,t,n){return La({relativePath:Xc(e),source:t.source,code:t.code,ruleAlias:BC(t),message:t.message,line:t.range.start.line+1,column:t.range.start.character+1,lineText:n})}function HC(e){return ka(e===null?null:Xc(e))}var UC=5;async function WC(e){let t=await fetch(`/api/backlinks?docName=${encodeURIComponent(e)}`),n=await t.json().catch(()=>null);if(!t.ok){let e=gs.safeParse(n),r=t.status;throw e.success?Error(e.data.title):new Cr(Ms._({id:`XopE_I`,values:{status:r}}),{status:r})}let r=Xo.safeParse(n);if(!r.success)throw new Cr(Ms._({id:`lZAiSP`}),{status:t.status});return r.data.backlinks}async function GC(e){let t=await fetch(`/api/forward-links?docName=${encodeURIComponent(e)}`),n=await t.json().catch(()=>null);if(!t.ok){let e=gs.safeParse(n),r=t.status;throw e.success?Error(e.data.title):new Cr(Ms._({id:`GemPfn`,values:{status:r}}),{status:r})}let r=Va.safeParse(n);if(!r.success)throw new Cr(Ms._({id:`2YZwPB`}),{status:t.status});return r.data}function KC(e){let t=e.split(`/`);return t.length<=2?e:`…/${t.slice(-2).join(`/`)}`}function qC(e){window.location.hash=Cf(e)}function JC(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)(Vl,{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)(Dm,{children:n})]}),t[1]=n,t[2]=o);let s;t[3]!==r||t[4]!==i?(s=!i&&(0,Z.jsx)(jm,{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)(fr,{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 YC(e){let t=(0,$.c)(10),{total:n,expanded:r,onToggle:i}=e;if(n<=UC)return null;let a=n-UC,o;t[0]===r?o=t[1]:(o=r?(0,Z.jsx)(Vl,{className:`size-3`}):(0,Z.jsx)(Hl,{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 XC(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=Bn(`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:Bn(`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)(sr,{asChild:!0,children:k}),t[31]=k,t[32]=e);let n;t[33]===i?n=t[34]:(n=(0,Z.jsx)(cr,{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 ZC(e){let t=(0,$.c)(39),{docName:n}=e,{_:r}=on(),{folderPaths:i,pages:a,pagesBySlug:o,pagesByBasename:s,loading:c}=Eu(),l,u;t[0]===n?(l=t[1],u=t[2]):(l=[`backlinks`,n],u=()=>WC(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)||Co(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}=Cn(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,UC),t[13]=_,t[14]=v,t[15]=S):S=t[15];let w=S,T;t[16]===r?T=t[17]:(T=r({id:`9NJWgv`}),t[16]=r,t[17]=T);let E;t[18]!==_.length||t[19]!==m||t[20]!==T?(E=(0,Z.jsx)(JC,{title:T,count:_.length,isLoading:m}),t[18]=_.length,t[19]=m,t[20]=T,t[21]=E):E=t[21];let D;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]!==w?(D=h?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Em,{children:h instanceof Error?h.message:r({id:`Xet9MX`})})}):_.length===0&&!m?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Om,{children:(0,Z.jsx)(Y,{id:`rVxu1k`})})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:w.map((e,t)=>{let n=Vm(e.source,{pages:a,folderPaths:i,pagesBySlug:o,pagesByBasename:s});return(0,Z.jsx)(XC,{icon:(0,Z.jsx)(C,{className:`size-3.5`}),title:e.title,path:KC(e.source),titleHover:e.source,anchor:e.anchor,snippet:e.snippet,href:Cf(n.hashDocName,e.anchor)},`${e.source}-${t}`)})}),(0,Z.jsx)(YC,{total:_.length,expanded:v,onToggle:()=>y(QC)})]}),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]=w,t[32]=D):D=t[32];let O;t[33]!==m||t[34]!==D?(O=(0,Z.jsx)(dr,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":m,children:D})}),t[33]=m,t[34]=D,t[35]=O):O=t[35];let k;return t[36]!==O||t[37]!==E?(k=(0,Z.jsxs)(pr,{defaultOpen:!0,children:[E,O]}),t[36]=O,t[37]=E,t[38]=k):k=t[38],k}function QC(e){return!e}function $C(e){let t=(0,$.c)(49),{docName:n}=e,{_:r}=on(),{addPage:i,folderPaths:a,pages:o,pagesBySlug:s,pagesByBasename:c,loading:l}=Eu(),u,d;t[0]===n?(u=t[1],d=t[2]):(u=[`forward-links`,n],d=()=>GC(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)||Co(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}=Cn(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),[w,T]=(0,Q.useState)(n);w!==n&&(T(n),S(!1),b(null));let E;t[13]!==x||t[14]!==v?(E=x?v:v.slice(0,UC),t[13]=x,t[14]=v,t[15]=E):E=t[15];let D=E,O;t[16]!==r||t[17]!==i||t[18]!==y?(O=async function(e,t){if(!y){b(t);try{await st(e,{addPage:i,onCreated:qC}),b(null)}catch(e){let t=e;Ns.error(t instanceof Error?t.message:r({id:`tfi40B`})),b(null)}}},t[16]=r,t[17]=i,t[18]=y,t[19]=O):O=t[19];let k=O,A;t[20]!==r||t[21]!==y||t[22]!==a||t[23]!==k||t[24]!==o||t[25]!==c||t[26]!==s||t[27]!==l?(A=function(e){let{title:t}=e;if(e.kind===`external`){let t=e.title===e.url;return(0,Z.jsx)(XC,{icon:(0,Z.jsx)(dl,{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=Nr(e.docName,{pages:o,folderPaths:a,pagesBySlug:s,pagesByBasename:c}),i=!l&&n.kind===`create`,u=!l&&n.kind===`navigate`&&n.displayState===`folder`,d=KC(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:Cf(m,e.anchor);if(i&&n.kind===`create`){let i={initialDir:n.initialDir,suggestedName:n.suggestedName};return(0,Z.jsx)(XC,{icon:(0,Z.jsx)(pf,{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 k(i,p)},p)}return u&&n.kind===`navigate`?(0,Z.jsx)(XC,{icon:(0,Z.jsx)(gd,{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)(XC,{icon:(0,Z.jsx)(C,{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]=k,t[24]=o,t[25]=c,t[26]=s,t[27]=l,t[28]=A):A=t[28];let j=A,M;t[29]===r?M=t[30]:(M=r({id:`O0Z2Xr`}),t[29]=r,t[30]=M);let N;t[31]!==h||t[32]!==v.length||t[33]!==M?(N=(0,Z.jsx)(JC,{title:M,count:v.length,isLoading:h}),t[31]=h,t[32]=v.length,t[33]=M,t[34]=N):N=t[34];let P;t[35]!==r||t[36]!==g||t[37]!==x||t[38]!==h||t[39]!==v.length||t[40]!==j||t[41]!==D?(P=g?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Em,{children:g instanceof Error?g.message:r({id:`pZAs1T`})})}):v.length===0&&!h?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Om,{children:(0,Z.jsx)(Y,{id:`roiUQQ`})})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:D.map(j)}),(0,Z.jsx)(YC,{total:v.length,expanded:x,onToggle:()=>S(ew)})]}),t[35]=r,t[36]=g,t[37]=x,t[38]=h,t[39]=v.length,t[40]=j,t[41]=D,t[42]=P):P=t[42];let F;t[43]!==h||t[44]!==P?(F=(0,Z.jsx)(dr,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":h,children:P})}),t[43]=h,t[44]=P,t[45]=F):F=t[45];let I;return t[46]!==N||t[47]!==F?(I=(0,Z.jsxs)(pr,{defaultOpen:!0,children:[N,F]}),t[46]=N,t[47]=F,t[48]=I):I=t[48],I}function ew(e){return!e}function tw(e){let t=(0,$.c)(42),{docName:n}=e,{_:r}=on(),{pages:i,loading:a}=Eu(),o,s;t[0]===n?(o=t[1],s=t[2]):(o=[`forward-links`,n],s=()=>GC(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)||Co(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}=Cn(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,UC),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`};ql(n,{kind:`lint`,detail:t}),window.dispatchEvent(new CustomEvent(su,{detail:t}))},t[16]=n,t[17]=S);let w=S,T;t[18]!==r||t[19]!==w?(T=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)(XC,{icon:t?(0,Z.jsx)(Ar,{className:`size-3.5`}):(0,Z.jsx)(C,{className:`size-3.5`}),iconColorClass:n?void 0:`text-amber-600 dark:text-amber-400`,title:KC(i),titleHover:i,ariaLabel:o,trailing:n?void 0:(0,Z.jsx)(Mp,{variant:`outline`,className:`font-normal text-muted-foreground`,children:a}),onClick:()=>w(e)},`lt:${e.range.start}-${e.range.end}`)},t[18]=r,t[19]=w,t[20]=T):T=t[20];let E=T,D;t[21]===r?D=t[22]:(D=r({id:`U3RIJu`}),t[21]=r,t[22]=D);let O;t[23]!==d||t[24]!==y.length||t[25]!==D?(O=(0,Z.jsx)(JC,{title:D,count:y.length,isLoading:d}),t[23]=d,t[24]=y.length,t[25]=D,t[26]=O):O=t[26];let k;t[27]!==r||t[28]!==f||t[29]!==p||t[30]!==d||t[31]!==_||t[32]!==E||t[33]!==y.length||t[34]!==x?(k=f?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Em,{children:f instanceof Error?f.message:r({id:`1xui0Q`})})}):_===void 0&&!d?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Om,{children:(0,Z.jsx)(Y,{id:`g-dkjJ`})})}):y.length===0&&!d?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Om,{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(E)}),(0,Z.jsx)(YC,{total:y.length,expanded:p,onToggle:()=>m(nw)})]}),t[27]=r,t[28]=f,t[29]=p,t[30]=d,t[31]=_,t[32]=E,t[33]=y.length,t[34]=x,t[35]=k):k=t[35];let A;t[36]!==d||t[37]!==k?(A=(0,Z.jsx)(dr,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":d,children:k})}),t[36]=d,t[37]=k,t[38]=A):A=t[38];let j;return t[39]!==O||t[40]!==A?(j=(0,Z.jsxs)(pr,{defaultOpen:!0,children:[O,A]}),t[39]=O,t[40]=A,t[41]=j):j=t[41],j}function nw(e){return!e}function rw(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)($C,{docName:n}),t[0]=n,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Ni,{}),t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Z.jsx)(tw,{docName:n}),t[3]=n,t[4]=s);let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Ni,{}),t[5]=c):c=t[5];let l;t[6]===n?l=t[7]:(l=(0,Z.jsx)(ZC,{docName:n}),t[6]=n,t[7]=l);let u;t[8]!==a||t[9]!==s||t[10]!==l?(u=(0,Z.jsxs)(km,{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)(Nm,{className:i,children:u}),t[12]=i,t[13]=u,t[14]=d):d=t[14],d}function iw(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 aw=1e4,ow=6e4;async function sw(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(cw)),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 cw(e){return e.type===`checkpoint`?e.checkpoint!==null&&Aa(e.checkpoint.kind):!0}function lw(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return Ms._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return Ms._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return Ms._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return Ms._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?Ms._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function uw(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function dw(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 fw(e){return e.split(`/`).pop()??e}function pw(e){return e.type===`checkpoint`?Ms._({id:`C-twqs`}):e.type===`upstream`?Ms._({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`?Ms._({id:`B2DrPb`}):e.author}function mw(e){let t=(0,$.c)(18),{entry:n,isDark:r}=e;if(n.type===`checkpoint`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(yc,{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)($c,{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=Wo(i),t[2]=i,t[3]=a);let o=a,s=r?Fo[o]??es[o]:es[o],c;t[4]!==s||t[5]!==i?(c=s??Ga(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)(Um,{icon:o,width:14,height:14,className:`shrink-0`,style:e}),t[9]=o,t[10]=e,t[11]=n):n=t[11],n}if(e.name===`File System`){let e;return t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Lv,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[12]=e):e=t[12],e}if(e.name===`OpenKnowledge (service)`||e.name===`Git (upstream)`){let e;return t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(il,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[13]=e):e=t[13],e}let u;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Ty,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[14]=u):u=t[14],u}if(n.authorEmail.includes(`agent`)||n.author.includes(`agent`)||n.authorEmail.includes(`cursor`)||n.authorEmail.includes(`claude`)){let e;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ue,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[15]=e):e=t[15],e}if(n.author===`openknowledge-server`||n.author===`server`){let e;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(il,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=e):e=t[16],e}let i;return t[17]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Ty,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[17]=i):i=t[17],i}function hw(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function gw(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(vw),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(_w)},children:[r?(0,Z.jsx)(Vl,{className:`size-3`}):(0,Z.jsx)(Hl,{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 _w(e){return!e}function vw(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 yw(e){let t=(0,$.c)(36),{descriptor:n,allDocs:r,versionBySha7:i,onJumpToVersion:a}=e,{_:o}=on();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:uw(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)(Mi,{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)(Nc,{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:fw(n.from),1:fw(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 bw(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}=on(),f;t[0]===n.timestamp?f=t[1]:(f=lw(n.timestamp),t[0]=n.timestamp,t[1]=f);let p=f,m;t[2]===n?m=t[3]:(m=pw(n),t[2]=n,t[3]=m);let h=m,g;t[4]===n.timestamp?g=t[5]:(g=uw(n.timestamp),t[4]=n.timestamp,t[5]=g);let _=g,v;t[6]===n.contributors?v=t[7]:(v=n.contributors.flatMap(xw),t[6]=n.contributors,t[7]=v);let y=v,b;t[8]===n?b=t[9]:(b=hw(n),t[8]=n,t[9]=b);let x=b,S;t[10]===n?S=t[11]:(S=dw(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=Km(),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=()=>{Wm(),Gm({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}),Ns.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=gs.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}),Ns.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)(mw,{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`:``,H;t[31]===V?H=t[32]:(H=[`flex flex-col rounded-lg transition-shadow`,V],t[31]=V,t[32]=H);let U=H.join(` `),W=A?`bg-muted`:`hover:bg-muted/80`,ee;t[33]===W?ee=t[34]:(ee=[`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`,W],t[33]=W,t[34]=ee);let G=ee.join(` `),K;t[35]===P?K=t[36]:(K=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),P())},t[35]=P,t[36]=K);let q;t[37]===B?q=t[38]:(q=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:B}),t[37]=B,t[38]=q);let te;t[39]===h?te=t[40]:(te=(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:h}),t[39]=h,t[40]=te);let J;t[41]!==n.timestamp||t[42]!==p?(J=(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]=J):J=t[43];let ne;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[44]=ne):ne=t[44];let re;t[45]===d?re=t[46]:(re=d({id:`Yea-K5`}),t[45]=d,t[46]=re);let ie;t[47]!==R||t[48]!==a?(ie=e=>{e.stopPropagation(),a>0?T(!0):R()},t[47]=R,t[48]=a,t[49]=ie):ie=t[49];let ae;t[50]===E?ae=t[51]:(ae=E?(0,Z.jsx)(xd,{"aria-hidden":`true`,className:`size-3`}):(0,Z.jsx)(mf,{className:`size-3`}),t[50]=E,t[51]=ae);let oe;t[52]!==E||t[53]!==re||t[54]!==ie||t[55]!==ae?(oe=(0,Z.jsx)(sr,{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":re,disabled:E,onClick:ie,children:ae})}),t[52]=E,t[53]=re,t[54]=ie,t[55]=ae,t[56]=oe):oe=t[56];let se;t[57]===d?se=t[58]:(se=d({id:`Yea-K5`}),t[57]=d,t[58]=se);let ce;t[59]===se?ce=t[60]:(ce=(0,Z.jsx)(cr,{side:`top`,children:se}),t[59]=se,t[60]=ce);let le;t[61]!==oe||t[62]!==ce?(le=(0,Z.jsxs)(ur,{children:[oe,ce]}),t[61]=oe,t[62]=ce,t[63]=le):le=t[63];let ue;t[64]!==te||t[65]!==J||t[66]!==le?(ue=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[te,J,ne,le]}),t[64]=te,t[65]=J,t[66]=le,t[67]=ue):ue=t[67];let de;t[68]===x?de=t[69]:(de=x.length>0&&(0,Z.jsx)(gw,{summaries:x}),t[68]=x,t[69]=de);let fe;t[70]!==y||t[71]!==C||t[72]!==c||t[73]!==s?(fe=(0,Z.jsx)(yw,{descriptor:C,allDocs:y,versionBySha7:s,onJumpToVersion:c}),t[70]=y,t[71]=C,t[72]=c,t[73]=s,t[74]=fe):fe=t[74];let pe;t[75]!==ue||t[76]!==de||t[77]!==fe?(pe=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[ue,de,fe]}),t[75]=ue,t[76]=de,t[77]=fe,t[78]=pe):pe=t[78];let me;t[79]!==P||t[80]!==A||t[81]!==G||t[82]!==K||t[83]!==q||t[84]!==pe?(me=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-pressed":A,"data-testid":`timeline-entry-open`,className:G,onClick:P,onKeyDown:K,children:[q,pe]}),t[79]=P,t[80]=A,t[81]=G,t[82]=K,t[83]=q,t[84]=pe,t[85]=me):me=t[85];let he;t[86]!==l||t[87]!==U||t[88]!==me?(he=(0,Z.jsx)(`div`,{ref:l,className:U,children:me}),t[86]=l,t[87]=U,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)(hr,{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)(mr,{children:[ye,` `,be]}),t[98]=ye,t[99]=xe);let Se;t[100]!==ve||t[101]!==xe?(Se=(0,Z.jsxs)(yr,{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)(xd,{"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)(vr,{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)(gr,{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)(br,{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 xw(e){return e.docs}function Sw(e){let t=(0,$.c)(27),{docName:n}=e,{_:r}=on(),{resolvedTheme:i}=Dn(),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(){qm()},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=iw({baseMs:aw,maxBackoffMs:ow,isPaused:ww,poll:e=>sw(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)(Mm,{children:(0,Z.jsx)(Dm,{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(Cw)}),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)(bw,{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 Cw(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(Im,{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)(Im,{className:`h-3 w-28`}),(0,Z.jsx)(Im,{className:`h-3 w-40`})]})]},e)}function ww(){return typeof document<`u`&&document.visibilityState===`hidden`}var Tw=`open-knowledge:lint-source-fixed`,Ew=Object.freeze({source:`local`,skipStoreHooks:!1,context:Object.freeze({origin:`lint-fix`})});function Dw(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 Ow(e){return e.flatMap(e=>e.fixes??[])}function kw(e,t,n){if(t.length===0)return!1;let r=e.document.getText(`source`),i=r.toString(),a=t.map(e=>({from:Dw(i,e.range.start),to:Dw(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)}},Ew),o>0&&Le(n),typeof window<`u`&&window.dispatchEvent(new CustomEvent(Tw)),!0}var Aw=[{id:`outline`,icon:Wv},{id:`links`,icon:T},{id:`graph`,icon:Yv},{id:`timeline`,icon:bv},{id:`problems`,icon:pf}],jw=[{id:`comments`,icon:Ud}];function Mw(e){let t=0,n=0;for(let r of e)r.severity===`error`?t+=1:n+=1;return{errorCount:t,warningCount:n}}function Nw(e){return e===`outline`?Ms._({id:`dD7NPy`}):e===`links`?Ms._({id:`Rj01Fz`}):e===`graph`?Ms._({id:`x2fr_j`}):e===`problems`?Ms._({id:`OXdGnd`}):e===`comments`?Ms._({id:`VbyRUy`}):Ms._({id:`cklVjM`})}function Pw(){return n(()=>import(`./GraphPanel-ovwXA2NQ.js`),__vite__mapDeps([52,1,6,2,3,7,8,9,10,11,45,12,13,14,53,16,17,18,54,55,30,26,24,25,34,35,36,20,28,56,57,58,59,60,61,62,63,22,64,65,66,67,68,69,70,71,72,73,46,74,75,76,49,77]),import.meta.url)}var Fw=(0,Q.lazy)(async()=>({default:(await Pw()).GraphPanel})),Iw=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-DgOXZQPM.js`),__vite__mapDeps([78,1,45,12,13,14,27,16,17,18,28,29,30,26,24,25,31,22,34,35,36,20,79,2,80,81,11,82,83,84,85,86,87,88,89,90,6,3,7,8,9,10,91,74,92,93,94,95,96,4,97,54,19,21,40,98,39,99,100,101,41,42,66,67,68,69,102,49,71,103,104,46,105,33,65,70,72,73,106,107,108,37,23,109,110,43,47,111,112,113,114,115,116,117,118,119,120,121]),import.meta.url)).ActivityModeContent}));function Lw(e){let t=(0,$.c)(52),{docName:n,isSourceMode:r,activeTab:i,onActiveTabChange:a,mode:o}=e,{_:s}=on(),{activeProvider:c,activeDocName:l}=Oe(),{data:u}=zm(n),d=l===n?c:null,f=Fl(d,u?.effective??null),p=eu(n),m=p.findings,h;t[0]!==m||t[1]!==f?(h=[...f,...m],t[0]=m,t[1]=f,t[2]=h):h=t[2];let g=h,_,v;t[3]!==n||t[4]!==f||t[5]!==d?(_=()=>{d!==null&&uu(n,`lint`,Mw(f))},v=[n,d,f],t[3]=n,t[4]=f,t[5]=d,t[6]=_,t[7]=v):(_=t[6],v=t[7]),(0,Q.useEffect)(_,v);let y,b;t[8]!==n||t[9]!==m||t[10]!==p.status||t[11]!==d?(y=()=>{d===null||p.status!==`loaded`||uu(n,`links`,Mw(m))},b=[n,d,m,p.status],t[8]=n,t[9]=m,t[10]=p.status,t[11]=d,t[12]=y,t[13]=b):(y=t[12],b=t[13]),(0,Q.useEffect)(y,b);let x;t[14]!==n||t[15]!==d?(x=e=>{d!==null&&e.fixes&&e.fixes.length>0&&kw(d,e.fixes,n)},t[14]=n,t[15]=d,t[16]=x):x=t[16];let S=x,C;t[17]!==n||t[18]!==f||t[19]!==d?(C=()=>{d!==null&&kw(d,Ow(f),n)},t[17]=n,t[18]=f,t[19]=d,t[20]=C):C=t[20];let w=C,T=Xn(),E;t[21]!==n||t[22]!==d?(E=e=>{if(d===null)return;let t=d.document.getText(`source`).toString().split(`
4
+ `)[e.range.start.line];Ws(VC(n,e,t),{submit:!0})},t[21]=n,t[22]=d,t[23]=E):E=t[23];let D=E,O;t[24]===n?O=t[25]:(O=e=>{Ws(HC(e===`doc`?n:null),{submit:!0})},t[24]=n,t[25]=O);let k=O,A=eS(),j,M,N;if(t[26]!==s||t[27]!==i||t[28]!==g||t[29]!==o||t[30]!==a||t[31]!==A){let e=A?Aw.filter(Rw):Aw,n=A?e:[...e,...jw];j=n.some(e=>e.id===i)?i:`outline`,M=o===`doc`&&n.length>1,N=M?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(Ii,{type:`single`,variant:`outline`,value:j,onValueChange:e=>{e&&a(e)},"aria-label":s({id:`SrOuyg`}),children:n.map(e=>{let{id:t,icon:n}=e,r=Nw(t),i=t===`problems`&&g.length>0;return(0,Z.jsxs)(ur,{children:[(0,Z.jsx)(Pi,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":i?s({id:`2m_bmh`,values:{0:g.length,label:r}}):r,asChild:!0,children:(0,Z.jsxs)(sr,{className:`relative`,children:[(0,Z.jsx)(n,{}),i&&(0,Z.jsx)(Mp,{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:g.length>99?`99+`:g.length})]})}),(0,Z.jsx)(cr,{side:`bottom`,children:r})]},t)})})}):null,t[26]=s,t[27]=i,t[28]=g,t[29]=o,t[30]=a,t[31]=A,t[32]=j,t[33]=M,t[34]=N}else j=t[32],M=t[33],N=t[34];let P;t[35]!==g||t[36]!==n||t[37]!==j||t[38]!==D||t[39]!==w||t[40]!==S||t[41]!==k||t[42]!==r||t[43]!==p.status||t[44]!==d||t[45]!==o||t[46]!==M||t[47]!==T?(P=o===`doc`?(0,Z.jsxs)(`div`,{...M?{role:`tabpanel`,id:`panel-${j}`,"aria-labelledby":`tab-${j}`}:{},className:`min-h-0 flex-1`,children:[j===`outline`&&(0,Z.jsx)(pu,{docName:n,isSourceMode:r}),j===`links`&&(0,Z.jsx)(rw,{docName:n}),j===`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)(Fw,{activeDocName:n})}),j===`timeline`&&(0,Z.jsx)(Sw,{docName:n}),j===`comments`&&(0,Z.jsx)(LC,{docName:n}),j===`problems`&&(0,Z.jsx)(cu,{docName:n,diagnostics:g,linkFindingsStatus:p.status,onFix:d===null?void 0:S,onAutoFix:d===null?void 0:w,onAskAi:d!==null&&T!==null?D:void 0,onFixWithAi:T===null?void 0:k})]}):(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)(Iw,{})})}),t[35]=g,t[36]=n,t[37]=j,t[38]=D,t[39]=w,t[40]=S,t[41]=k,t[42]=r,t[43]=p.status,t[44]=d,t[45]=o,t[46]=M,t[47]=T,t[48]=P):P=t[48];let F;return t[49]!==N||t[50]!==P?(F=(0,Z.jsxs)(Z.Fragment,{children:[N,P]}),t[49]=N,t[50]=P,t[51]=F):F=t[51],F}function Rw(e){return e.id===`outline`||e.id===`problems`}function zw(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function Bw(e,t){let n=getComputedStyle(e.ownerDocument.documentElement);return t*parseFloat(n.fontSize)}function Vw(e){return e/100*window.innerHeight}function Hw(e){return e/100*window.innerWidth}function Uw(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 Ww({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=Uw(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=Bw(t,i);break;case`em`:r=zw(t,i);break;case`vh`:r=Vw(i);break;case`vw`:r=Hw(i);break}return r}function Gw(e){return parseFloat(e.toFixed(3))}function Kw({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 qw(e){let{panels:t}=e,n=Kw({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=Gw(Ww({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=Gw(Ww({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=Gw(Ww({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=Gw(Ww({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 Jw(e,t=`Assertion error`){if(!e)throw Error(t)}function Yw(e,t){return Array.from(t).sort(e===`horizontal`?Xw:Zw)}function Xw(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function Zw(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function Qw(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function $w(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 eT({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}=$w(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return Jw(i,`No rect found`),i}var tT;function nT(){return tT===void 0&&(tT=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),tT}function rT(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Yw(n,Array.from(t.children).filter(Qw).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,eT({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=nT()?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:Kw({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 iT=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)}}},aT={cursorFlags:0,state:`inactive`},oT=new iT;function sT(){return aT}function cT(e){return oT.addListener(`change`,e)}function lT(e){let t=aT,n={...aT};n.cursorFlags=e,aT=n,oT.emit(`change`,{prev:t,next:n})}function uT(e){let t=aT;aT=e,oT.emit(`change`,{prev:t,next:e})}var dT=e=>e,fT=()=>{},pT=1,mT=2,hT=4,gT=8,_T=3,vT=12,yT;function bT(){return yT===void 0&&(yT=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(yT=!0)),yT}function xT({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&&bT()){let t=(e&pT)!==0,n=(e&mT)!==0,r=(e&hT)!==0,i=(e&gT)!==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 bT()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var ST=new WeakMap;function CT(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=ST.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=sT();switch(r.state){case`active`:case`hover`:{let e=xT({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}ST.set(e,{prevStyle:t,styleSheet:n})}var wT=new Map,TT=new iT;function ET(e){wT=new Map(wT),wT.delete(e)}function DT(e,t){for(let[t]of wT)if(t.id===e)return t}function OT(e,t){for(let[t,n]of wT)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function kT(){return wT}function AT(e,t){return TT.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function jT(e,t,n){let r=wT.get(e);wT=new Map(wT),wT.set(e,t),TT.emit(`groupChange`,{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:r,next:t})}function MT(e){let t=sT(),n=!1;switch(t.state){case`active`:uT({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(CT(e),n=!0,t.hitRegions.forEach(e=>{let t=OT(e.group.id,!0);jT(e.group,t,{isUserInteraction:!0})}))}return n}function NT(e){e.defaultPrevented||MT(e.currentTarget)}function PT(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=$w(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 FT(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function IT(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:HT(e),b:HT(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();Jw(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:VT(BT(n.a)),b:VT(BT(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 LT=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function RT(e){let t=getComputedStyle(UT(e)??e).display;return t===`flex`||t===`inline-flex`}function zT(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||RT(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`||LT.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function BT(e){let t=e.length;for(;t--;){let n=e[t];if(Jw(n,`Missing node`),zT(n))return n}return null}function VT(e){return e&&Number(getComputedStyle(e).zIndex)||0}function HT(e){let t=[];for(;e;)t.push(e),e=UT(e);return t}function UT(e){let{parentNode:t}=e;return FT(t)?t.host:t}function WT(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 GT({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Qw(n)||n.contains(e)||e.contains(n))return!0;if(IT(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(WT(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function KT(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=rT(r),a=PT(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&GT({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function qT(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 JT(e,t,n=0){return Math.abs(Gw(e)-Gw(t))<=n}function YT(e,t){return JT(e,t)?0:e>t?1:-1}function XT({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(YT(r,c)<0)if(a){let e=(i+c)/2;r=YT(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=Gw(r),r}function ZT({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(JT(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;Jw(u!=null,`Invalid first pivot index`),Jw(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];Jw(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(Jw(n!=null,`Previous layout not found for panel index ${t}`),JT(n,i)){let t=o-n;YT(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];Jw(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(Jw(n!=null,`Previous layout not found for panel index ${t}`),JT(n,o)){let t=n-i;YT(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];Jw(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&YT(i,c)<0)if(e>0){let t=c-o,n=t/2;YT(i+e,c)<0&&(e=YT(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;YT(i-e,c)<0&&(e=YT(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];Jw(e!=null,`Previous layout not found for panel index ${r}`);let a=XT({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];Jw(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=XT({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!JT(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(qT(c,l))return i;{let t=e<0?d:u,r=s[t];Jw(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=XT({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!JT(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];Jw(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=XT({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(JT(i,s)||(t-=s-i,l[r]=s),JT(t,0))break;e>0?r--:r++}}}if(!JT(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 QT(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||YT(e[n],t[n])!==0)return!1;return!0}function $T({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n];r.length!==t.length&&(e=fE(t),n=Object.values(e),r=[...n]);let i=r.reduce((e,t)=>e+t,0);if(!JT(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];Jw(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];Jw(i!=null,`No layout data found for index ${e}`);let o=r[e];Jw(o!=null,`No layout data found for index ${e}`);let s=XT({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!JT(a,0))for(let e=0;e<t.length;e++){let n=r[e];Jw(n!=null,`No layout data found for index ${e}`);let i=n+a,o=XT({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,JT(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function eE({groupId:e,panelId:t}){let n=()=>{let t=kT();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&&JT(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,s).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:Gw(100-e)}}return ZT({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=$T({layout:o({nextSize:e,panels:i.panels,prevLayout:c,derivedPanelConstraints:r}),panelConstraints:r});QT(c,u)||jT(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&&JT(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=Kw({group:t});s(Gw(Ww({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function tE(e){e.defaultPrevented||KT(e,kT()).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=eE({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function nE(e){let t=kT();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 rE({groupId:e}){let t=()=>{let t=kT();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=$T({layout:e,panelConstraints:r});return n?o:(QT(o,c)||jT(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function iE(e,t){let n=nE(e),r=OT(n.id,!0),i=n.separators.find(t=>t.element===e);Jw(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);Jw(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=rE({groupId:n.id}).getLayout(),c=$T({layout:ZT({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});QT(s,c)||jT(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function aE(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=nE(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&iE(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&iE(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&iE(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&iE(t,-5);break;case`End`:e.preventDefault(),iE(t,100);break;case`Enter`:{e.preventDefault();let n=nE(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=OT(n.id,!0),o=n.separators.find(e=>e.element===t);Jw(o,`Matching separator not found`);let s=a.get(o);Jw(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(Jw(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];iE(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=nE(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);Jw(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(),iE(t,-100);break}}function oE(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=kT(),n=KT(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)}),uT({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}function sE({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=ZT({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(QT(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?pT:mT;break;case`vertical`:s|=d<0?hT:gT;break}}else jT(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&_T:c|=s&_T,t.movementY===0?c|=o&vT:c|=s&vT,lT(c),CT(e)}function cE(e){let t=kT(),n=sT();switch(n.state){case`active`:sE({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function lE(e){if(e.defaultPrevented)return;let t=sT(),n=kT();switch(t.state){case`active`:if(e.buttons===0){uT({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=OT(e.group.id,!0);jT(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)}sE({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=KT(e,n);r.length===0?t.state!==`inactive`&&uT({cursorFlags:0,state:`inactive`}):uT({cursorFlags:0,hitRegions:r,state:`hover`}),CT(e.currentTarget);break}}}function uE(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(sT().state){case`hover`:uT({cursorFlags:0,state:`inactive`})}}function dE(e){e.defaultPrevented||e.pointerType===`mouse`&&e.button>0||MT(e.currentTarget)&&e.preventDefault()}function fE(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=Gw(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=Gw((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function pE(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=Kw({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:Gw(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function mE(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 hE({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=Gw(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]=Gw((r[e]??0)/a*l);else{let e=Gw(l/c.length);for(let t of c)u[t]=e}return u}function gE(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 _E=new Map;function vE(e){let t=!0;Jw(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=Kw({group:e});if(t===0)return;let n=OT(e.id);if(!n)return;let r=qw(e),i=n.defaultLayoutDeferred?fE(r):n.layout,a=$T({layout:hE({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&QT(n.layout,a)&&mE(n.derivedPanelConstraints,r)&&n.groupSize===t)return;jT(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else pE(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{Jw(!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=Kw({group:e}),s=qw(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(gE(e.panels,l)||(l=void 0));let u=$T({layout:e.mutableState.layouts[c]??l??fE(s),panelConstraints:s}),d=e.element.ownerDocument;_E.set(d,(_E.get(d)??0)+1);let f=new Map;return rT(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),jT(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{Jw(!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`,aE)}),d.addEventListener(`contextmenu`,NT,!0),d.addEventListener(`dblclick`,tE,!0),d.addEventListener(`pointerdown`,oE,!0),d.addEventListener(`pointerleave`,cE),d.addEventListener(`pointermove`,lE),d.addEventListener(`pointerout`,uE),d.addEventListener(`pointerup`,dE,!0),function(){t=!1,_E.set(d,Math.max(0,(_E.get(d)??0)-1)),ET(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,aE)}),_E.get(d)||(d.removeEventListener(`contextmenu`,NT,!0),d.removeEventListener(`dblclick`,tE,!0),d.removeEventListener(`pointerdown`,oE,!0),d.removeEventListener(`pointerleave`,cE),d.removeEventListener(`pointermove`,lE),d.removeEventListener(`pointerout`,uE),d.removeEventListener(`pointerup`,dE,!0)),a.disconnect()}}function yE(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function bE(e){let t=(0,Q.useId)();return`${e??t}`}var xE=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function SE(e){let t=(0,Q.useRef)(e);return xE(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function CE(...e){return SE(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function wE(e){let t=(0,Q.useRef)({...e});return xE(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var TE=(0,Q.createContext)(null);function EE(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:dT});(0,Q.useImperativeHandle)(t,()=>n.current,[]),xE(()=>{Object.assign(n.current,rE({groupId:e}))})}function DE({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=SE(e=>{QT(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=SE((e,t)=>{QT(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e,{isUserInteraction:t}))}),_=bE(s),v=(0,Q.useRef)(null),[y,b]=yE(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=CE(v,a);EE(_,o);let C=SE((e,t)=>{let r=sT(),i=DT(e),a=OT(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=wE({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=Yw(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=Yw(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=DT(_),i=OT(_);r&&i&&jT(r,{...i,derivedPanelConstraints:qw(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 xE(()=>{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=vE(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=OT(r.id,!0);!o&&s.length>0&&(h(c),g(c,!1));let l=AT(_,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=JT(t.collapsedSize,i[t.panelId]),a=JT(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=sT().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)(TE.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})})}DE.displayName=`Group`;function OE(){return(0,Q.useRef)(null)}function kE(){let e=(0,Q.useContext)(TE);return Jw(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function AE(e,t){let{id:n}=kE(),r=(0,Q.useRef)({collapse:fT,expand:fT,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:fT});(0,Q.useImperativeHandle)(t,()=>r.current,[]),xE(()=>{Object.assign(r.current,eE({groupId:n,panelId:e}))})}function jE({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=bE(c),_=wE({disabled:a}),v=(0,Q.useRef)(null),y=CE(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=kE(),T=d!==null,E=SE((e,t,n)=>{d?.(e,c,n)});xE(()=>{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]),AE(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>AT(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:{...ME,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})})}jE.displayName=`Panel`;var ME={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function NE(){return(0,Q.useRef)(null)}function PE({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=$T({layout:ZT({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=$T({layout:ZT({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function FE({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=bE(a),l=wE({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),_=CE(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=kE(),C=b===`horizontal`?`vertical`:`horizontal`;xE(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=cT(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=AT(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(PE({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})}FE.displayName=`Separator`;function IE(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}=on(),[o,s]=(0,Q.useState)(`diagram`),c=Ym(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)(eh,{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=Jm({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)(Qm,{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)(sr,{children:(0,Z.jsx)(oe,{className:`size-4`})}),t[24]=h):h=t[24];let g;t[25]===m?g=t[26]:(g=(0,Z.jsx)(Pi,{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)(cr,{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)(sr,{children:(0,Z.jsx)(S,{className:`size-4`})}),t[32]=b):b=t[32];let x;t[33]===y?x=t[34]:(x=(0,Z.jsx)(Pi,{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 C;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(cr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`wdxz7K`})}),t[35]=C):C=t[35];let w;t[36]===x?w=t[37]:(w=(0,Z.jsxs)(ur,{children:[x,C]}),t[36]=x,t[37]=w);let T;t[38]!==o||t[39]!==w||t[40]!==p||t[41]!==v?(T=(0,Z.jsx)(`div`,{className:`flex shrink-0 items-center justify-center border-b bg-background py-2`,children:(0,Z.jsxs)(Ii,{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,w]})}),t[38]=o,t[39]=w,t[40]=p,t[41]=v,t[42]=T):T=t[42];let E;t[43]!==n||t[44]!==r||t[45]!==o||t[46]!==i||t[47]!==d?(E=(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)(ul,{chart:d,className:`min-h-0 flex-1`})}):(0,Z.jsx)(Xm,{...i,fileName:r,extension:n})}),t[43]=n,t[44]=r,t[45]=o,t[46]=i,t[47]=d,t[48]=E):E=t[48];let D;return t[49]!==u||t[50]!==r||t[51]!==o||t[52]!==T||t[53]!==E?(D=(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:[T,E]}),t[49]=u,t[50]=r,t[51]=o,t[52]=T,t[53]=E,t[54]=D):D=t[54],D}function LE(e){return ca(`/api/asset?path=${encodeURIComponent(e)}`)}function RE(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function zE(e){let t=(0,$.c)(8),{assetPath:n,mediaKind:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)($m,{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)(BE,{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 BE(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=LE(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)(Tt,{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=RE(n),t[19]=n,t[20]=e),p=(0,Z.jsx)(Xm,{src:e,assetPath:n,fileName:l,extension:f.toLowerCase()},n);break bb0}if(u===`mermaid`){let e;t[21]===n?e=t[22]:(e=RE(n),t[21]=n,t[22]=e),p=(0,Z.jsx)(IE,{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)(be,{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:()=>{dm({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 VE(){let e=(0,$.c)(5),{_:t}=on(),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)(Im,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(Im,{className:`h-4 w-full`}),(0,Z.jsx)(Im,{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 HE(e){let{_:t}=on();return e===`existing-repo`?[{id:`draft-spec`,icon:Ov,label:t({id:`LdKIHS`}),prompt:t({id:`N_7kkF`})},{id:`organize-specs`,icon:Wv,label:t({id:`cuA8QW`}),prompt:t({id:`mPy9lS`})},{id:`document-architecture`,icon:Yv,label:t({id:`6eniID`}),prompt:t({id:`uDlyqd`})}]:[{id:`competitor-research`,icon:hy,label:t({id:`GUqTzn`}),prompt:t({id:`KOZud0`})},{id:`eng-specs`,icon:Ov,label:t({id:`Qvls7J`}),prompt:t({id:`6qMe0o`})},{id:`bird-wiki`,icon:mv,label:t({id:`FqTpiN`}),prompt:t({id:`jtg_8-`})}]}function UE(e){let t=(0,$.c)(13),{scenario:n,className:r}=e,{_:i}=on(),a=HE(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){nh(t).then(()=>{s(e),clearTimeout(c.current),c.current=setTimeout(()=>s(null),1600)}).catch(WE)};t[8]===r?d=t[9]:(d=Bn(`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:Bn(`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)(zl,{className:`size-3.5`,"aria-hidden":`true`}):(0,Z.jsx)(Cu,{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 WE(){}function GE(e,t,n){return e.trim().length>0||t.length>0||n}new Set(Wi.map(e=>e.id));function KE(e,t){Xs(e,t)}function qE(e){let t=(0,$.c)(2),{agentName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(Y,{id:`5PrrYw`,values:{agentName:n}}),t[0]=n,t[1]=r),r}function JE(e){let t=(0,$.c)(31),{scenario:n,className:r}=e,{_:i}=on(),{states:a,refresh:o}=qn(),s=Hi(),{dispatch:c}=Tc(),l=Zc(),u=Xn(),[d,f]=(0,Q.useState)(XE),p=Yi(),m=Li(),h;t[0]===s?h=t[1]:(h=e=>Ki(s,e.source,e.id,!0,e.supported),t[0]=s,t[1]=h);let g=m.filter(h),_=Ri(g,p),v;t[2]===u?.installedClis?v=t[3]:(v=u?.installedClis??{},t[2]=u?.installedClis,t[3]=v);let y=Qs({sticky:d,effectiveThreadAgent:_,enabledClis:u===null?[]:_c(s,u.installedClis),enabledDesktopTargets:tc(s),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)(YE),[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=HE(n),N;t[5]===s?N=t[6]:(N=e=>zi(s,e.id),t[5]=s,t[6]=N);let P=Wi.filter(N),F=Wi.every(e=>a[e.id]?.installed!=null),I=u!==null&&_c(s,u.installedClis).length>0,L=F&&P.length===0&&g.length===0&&!I,R;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){f(e),Xs(e),KE(e)},t[7]=R):R=t[7];let z=R,B;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(e){f(sc(e)),Xs(sc(e))},t[8]=B):B=t[8];let V=B,H;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(H=function(e){Xi(e),f($s),Xs($s)},t[9]=H):H=t[9];let U=H,W=function(){let{instruction:e,mentions:t}=w.current?.getContent()??{instruction:``,mentions:[]};if(!GE(e,t,!1)){k(!0);return}let r=Gc({workspace:l,description:e,scenario:n,mentions:t});r!==null&&(Dc(r,_===null?void 0:{agent:{source:_.source,id:_.id}}),w.current?.clear(),af())},ee=function(){if(u===null||x===null)return;let{instruction:e,mentions:t}=w.current?.getContent()??{instruction:``,mentions:[]};if(!GE(e,t,!1)){k(!0);return}let r=Gc({workspace:l,description:e,scenario:n,mentions:t});r!==null&&(u.launchInTerminal(r,x),w.current?.clear(),af())},G=function(e){let{instruction:t,mentions:r}=w.current?.getContent()??{instruction:``,mentions:[]};if(!GE(t,r,!1)){k(!0);return}if(KE(e),a[e]?.installed!==!0){let t=Wi.find(t=>t.id===e);t&&Kc(t);return}let i=Gc({workspace:l,description:t,scenario:n,mentions:r});i!==null&&(c(e,i),w.current?.clear(),af())},K=function(){b?W():C?ee():S!==null&&G(S)},q=function(e){w.current?.setText(e),w.current?.focus()};if(L){let e;t[10]===r?e=t[11]:(e=Bn(`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[10]=r,t[11]=e);let n;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(ue,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),t[12]=n):n=t[12];let i;t[13]===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[13]=i):i=t[13];let a;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:Cs,className:`gap-1.5`,"data-testid":`create-configure-agents`,children:[(0,Z.jsx)(Rn,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`jRAGrQ`})]}),t[14]=a):a=t[14];let o;return t[15]===e?o=t[16]:(o=(0,Z.jsxs)(`div`,{className:e,"data-testid":`create-no-agents`,children:[i,a]}),t[15]=e,t[16]=o),o}let te=u?_c(s,u.installedClis):[],J=P.length>0,ne=te.length>0,re=g.length>0,ie=y.kind!==`none`,ae;t[17]===r?ae=t[18]:(ae=Bn(`flex w-full flex-col gap-3`,r),t[17]=r,t[18]=ae);let oe;t[19]!==i||t[20]!==n?(oe=i(n===`skill`?{id:`Dut9Ht`}:{id:`7hctf2`}),t[19]=i,t[20]=n,t[21]=oe):oe=t[21];let se;t[22]!==i||t[23]!==n?(se=i(n===`skill`?{id:`eNhWUl`}:{id:`0jD-Gn`}),t[22]=i,t[23]=n,t[24]=se):se=t[24];let ce;t[25]!==E||t[26]!==O?(ce=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[25]=E,t[26]=O,t[27]=ce):ce=t[27];let le=ie?(0,Z.jsxs)(uf,{children:[(0,Z.jsx)(X,{type:`button`,onClick:()=>b?W():C?ee():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)(pl,{agentId:_.id,iconUrl:_.iconUrl,className:`size-3.5`}),(0,Z.jsx)(qE,{agentName:_.name})]}):C&&x!==null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(qi,{id:Gi(x),"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`4rjwLG`,values:{0:va[x].displayName}})]}):S===null?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(qi,{id:S,"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`9dw5bW`,values:{0:Cc(S)}})]})}),(0,Z.jsxs)(xi,{onOpenChange:e=>{e&&o()},children:[(0,Z.jsx)(hi,{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)(Vl,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsxs)(yi,{align:`end`,className:`max-h-80 min-w-[200px]`,children:[re?(0,Z.jsxs)(pi,{"aria-label":i({id:`vPKX2i`}),children:[(0,Z.jsxs)(_i,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(Y,{id:`RXEbZy`}),(0,Z.jsx)(Ui,{})]}),g.map(e=>(0,Z.jsxs)(li,{onSelect:()=>U(e),"data-testid":`create-agent-option-thread-${e.source}:${e.id}`,children:[(0,Z.jsx)(pl,{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)(zl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},`${e.source}:${e.id}`))]}):null,re&&(ne||J)?(0,Z.jsx)(Si,{}):null,ne?(0,Z.jsxs)(pi,{"aria-label":i({id:`ALhMYW`}),children:[(0,Z.jsx)(_i,{children:(0,Z.jsx)(Y,{id:`ALhMYW`})}),te.map(e=>{let{displayName:t}=va[e];return(0,Z.jsxs)(li,{onSelect:()=>V(e),"data-testid":`create-with-cli-${e}`,"aria-label":i({id:`QYfQdv`,values:{displayName:t}}),children:[(0,Z.jsx)(qi,{id:Gi(e),"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t}),x===e?(0,Z.jsx)(zl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e)})]}):null,J?(0,Z.jsxs)(Z.Fragment,{children:[ne?(0,Z.jsx)(Si,{}):null,(0,Z.jsxs)(pi,{"aria-label":i({id:`BBqGS9`}),children:[(0,Z.jsx)(_i,{children:(0,Z.jsx)(Y,{id:`BBqGS9`})}),P.map(e=>(0,Z.jsxs)(li,{onSelect:()=>z(e.id),"data-testid":`create-agent-option-${e.id}`,children:[(0,Z.jsx)(qi,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),!C&&e.id===S?(0,Z.jsx)(zl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null,(0,Z.jsx)(Si,{}),(0,Z.jsxs)(li,{onSelect:Cs,"data-testid":`create-agent-option-settings`,children:[(0,Z.jsx)(Rn,{"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[28]!==ce||t[29]!==le?(de=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 px-3 pb-3`,children:[ce,le]}),t[28]=ce,t[29]=le,t[30]=de):de=t[30],(0,Z.jsxs)(`div`,{className:ae,children:[(0,Z.jsxs)(`div`,{onMouseDown:e=>sf(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)(nf,{ref:w,ariaLabel:oe,placeholder:se,onEmptyChange:j,onContentChange:$d,onSubmit:K,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:()=>q(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 YE(){return rf().doc??void 0}function XE(){return Gs()}function ZE(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=I_(o.current,n);o.current=r,!(r<2)&&(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:Fg}:void 0,t[2]=a,t[3]=u);let d;t[4]!==i||t[5]!==l||t[6]!==u?(d=(0,Z.jsx)(nr,{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 QE({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 $E=`open-knowledge:create-top-level-file`;function eD(e={}){window.dispatchEvent(new CustomEvent($E,{detail:e}))}function tD(e){let t=t=>{let n=t.detail;e(n??{})};return window.addEventListener($E,t),()=>window.removeEventListener($E,t)}function nD(e){let t=(0,$.c)(29),{celebrateSignal:n,onAddStarterPack:r,onRageStreak:i}=e,{_:a}=on(),o=tn(),{title:s,subtitle:c}=QE({isOnboarding:!1,isEmbedded:o}),l=Mu(),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=ZE,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)(UE,{scenario:`existing-repo`}):(0,Z.jsx)(JE,{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)(aD,{templates:d,loading:f,error:p,onSelect:iD}):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`)?(b=(0,Z.jsx)(Mn,{"aria-hidden":`true`,className:`size-3`}),x=(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:[b,x]}),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:rD,children:(0,Z.jsx)(Y,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(ll,{"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`,children:[_,v,T]}),t[25]=T,t[26]=_,t[27]=v,t[28]=E):E=t[28],E}function rD(){return eD({initialDir:``})}function iD(e,t){return eD({template:{folder:e,name:t}})}function aD(e){let t=(0,$.c)(25),{templates:n,loading:r,error:i,onSelect:a}=e,{_:o}=on(),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)(Mp,{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)(oD,{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 oD(e){let t=(0,$.c)(24),{template:n,targetLabel:r,onClick:i}=e,{_:a}=on(),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 sD(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 vp();if(e)return;let r=t?Oa.safeParse(n):null;r?.success?(f(uD(r.data.documents)),h.current=!0):h.current||=(f(1),!0)}catch{!e&&!h.current&&(f(1),h.current=!0)}};t();let n=Ls(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(lD),500),vp().then(e=>{let{ok:t,body:n}=e;if(!t)return;let r=Oa.safeParse(n);r.success&&f(uD(r.data.documents))}).catch(cD)},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=Bn(`@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)(dD,{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`,{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)(fD,{onRageStreak:i,celebrateSignal:p,onPackSelect:e=>{u(e),c(!0)}}):(0,Z.jsx)(nD,{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)(jx,{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`,{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 cD(){}function lD(e){return e+1}function uD(e){return Uf(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function dD(e){let t=(0,$.c)(16),{isOnboarding:n,celebrateSignal:r,onRageStreak:i}=e,{_:a}=on(),o=tn(),s,c,l,u;if(t[0]!==a||t[1]!==o||t[2]!==n){let{title:e,subtitle:r}=QE({isOnboarding:n,isEmbedded:o});u=`w-full max-w-5xl`,s=ZE,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 fD(e){let t=(0,$.c)(30),{celebrateSignal:n,onPackSelect:r,onRageStreak:i}=e,{_:a}=on(),o=tn(),s,c,l,u;if(t[0]!==a||t[1]!==o){let{title:e,subtitle:n}=QE({isOnboarding:!0,isEmbedded:o});u=`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,s=ZE,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)(UE,{scenario:`new-project`}):(0,Z.jsx)(JE,{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)(mD,{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)(Tx,{onPackSelect:r,onCreateBlankFile:pD,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 pD(){return eD()}function mD(e){let t=(0,$.c)(13),{label:n}=e,{_:r}=on(),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)(bd,{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)(sr,{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)(cr,{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 hD(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function gD(e){let t=(0,$.c)(70),{folderPath:n,state:r,onChange:i}=e,{_:a}=on(),[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)(vD,{}),(0,Z.jsx)(Im,{className:`h-7 w-full`}),(0,Z.jsx)(Im,{className:`h-7 w-full`}),(0,Z.jsx)(Im,{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=hD(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 _d(n,{[e]:t});if(!r.ok){let{error:e}=r;Ns.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 _d(n,{[e]:null});if(!t.ok){let{error:e}=t;Ns.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,Il(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):Ll[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(qo(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 _d(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 _d(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,H=!o,U;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>s(!e),t[39]=U):U=t[39];let W=`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`}`,ee;t[40]===W?ee=t[41]:(ee=(0,Z.jsx)(Hl,{className:W,"aria-hidden":!0}),t[40]=W,t[41]=ee);let G;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(Y,{id:`vQIVHc`}),t[42]=G):G=t[42];let K;t[43]===ee?K=t[44]:(K=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[ee,G]}),t[43]=ee,t[44]=K);let q;t[45]===h?q=t[46]:(q=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text break-all`,onClick:_D,children:h}),t[45]=h,t[46]=q);let te;t[47]!==K||t[48]!==q?(te=(0,Z.jsxs)(fr,{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:[K,q]}),t[47]=K,t[48]=q,t[49]=te):te=t[49];let J;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`hSBIG-`})}),t[50]=J):J=t[50];let ne;t[51]!==c||t[52]!==y||t[53]!==z||t[54]!==_||t[55]!==p||t[56]!==x||t[57]!==u||t[58]!==C?(ne=_.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)(Tl,{keyName:e,value:t,declared:ml(t,ns(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]=ne):ne=t[59];let re;t[60]!==c||t[61]!==N?(re=c?(0,Z.jsx)(El,{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)(Mn,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`G8t9NN`})})]})}),t[60]=c,t[61]=N,t[62]=re):re=t[62];let ie;t[63]!==ne||t[64]!==re?(ie=(0,Z.jsx)(dr,{children:(0,Z.jsxs)(`div`,{className:`px-2 py-2`,children:[J,ne,re]})}),t[63]=ne,t[64]=re,t[65]=ie):ie=t[65];let ae;return t[66]!==H||t[67]!==te||t[68]!==ie?(ae=(0,Z.jsx)(`section`,{className:`rounded-lg border bg-card`,children:(0,Z.jsxs)(pr,{open:H,onOpenChange:U,children:[te,ie]})}),t[66]=H,t[67]=te,t[68]=ie,t[69]=ae):ae=t[69],ae}function _D(e){return e.stopPropagation()}function vD(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Nv,{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 yD(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?Ms._({id:`xOTzt5`}):t<3600?Ms._({id:`zbymaY`,values:{0:Math.floor(t/60)}}):t<86400?Ms._({id:`optX0N`,values:{0:Math.floor(t/3600)}}):t<86400*7?Ms._({id:`l1l8sj`,values:{0:Math.floor(t/86400)}}):new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function bD(e){return(e.split(`/`).pop()??e).replace(/\.md$/,``)}function xD(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:Kn,label:Ms._({id:`QR5SP1`}),detail:bD(i)};case`template-edit`:return{Icon:it,label:Ms._({id:`-LHLx7`}),detail:bD(i)};case`template-delete`:return{Icon:ff,label:Ms._({id:`_gkGSK`}),detail:bD(i)};case`template-rename`:case`template-move`:{let[e,t]=i.split(` -> `);return{Icon:Nc,label:Ms._({id:`KPW5WC`}),detail:`${bD(e??``)} → ${bD(t??i)}`}}case`folder-frontmatter-edit`:return{Icon:Nv,label:Ms._({id:`_tekeB`}),detail:``};case`folder-frontmatter-delete`:return{Icon:Nv,label:Ms._({id:`ZWxfrc`}),detail:``};case`folder-create`:return{Icon:Nv,label:Ms._({id:`ZQLDTl`}),detail:``};default:return{Icon:yc,label:r.replace(/-/g,` `),detail:bD(i)}}}function SD(e){return e.contributors.length>0?e.contributors[0].name:e.author===`openknowledge-service`||e.author===`server`?Ms._({id:`B2DrPb`}):e.author||Ms._({id:`Ef7StM`})}function CD(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=Bs(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)(Mp,{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)(Im,{className:`h-8 w-full`}),(0,Z.jsx)(Im,{className:`h-8 w-full`})]}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:i.map(wD)})}),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 wD(e){let{Icon:t,label:n,detail:r}=xD(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)(Ty,{className:`size-3`,"aria-hidden":!0}),SD(e)]}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground/80`,dateTime:e.timestamp,title:new Date(e.timestamp).toLocaleString(),children:yD(e.timestamp)})]},e.sha)}function TD(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function ED(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=TD(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function DD(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function OD(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:ED(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:DD(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:ED(e,t.pageTitles),children:a}}function kD(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)(Im,{className:`h-12 w-full`}),(0,Z.jsx)(Im,{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)(Mp,{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)(Mn,{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)(Zu,{template:e,onCreate:()=>l(e.name),onEdit:()=>gh(os(e.source_folder,e.name)),onDelete:()=>s(e),badge:e.scope===`inherited`?(0,Z.jsx)(yl,{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)(Ru,{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(AD)),t[20]=p,t[21]=S);let C;t[22]!==n||t[23]!==i?(C=e=>{i(),gh(os(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)(zu,{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)(nx,{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 AD(e){return e.name}function jD(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=Bn(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=Bn(`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 MD(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=Bn(`[&_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 ND(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=Bn(`[&_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 PD(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=Bn(`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 FD(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=Bn(`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 ID(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=Bn(`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 LD(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return Ms._({id:`xOTzt5`});if(r<60)return Ms._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return Ms._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?Ms._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function RD(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 zD(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)(cl,{className:`ml-1 size-3`}):(0,Z.jsx)(sl,{className:`ml-1 size-3`}):(0,Z.jsx)(pv,{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 BD(e){let t=(0,$.c)(96),{folderPath:n}=e,{_:r}=on(),{folderPaths:i,loading:a,pages:o,pageTitles:s,pageMeta:c}=Eu(),l=Wu(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)(Im,{className:`size-5 rounded`}),(0,Z.jsx)(Im,{className:`h-7 w-48`})]}),(0,Z.jsx)(Im,{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)(Im,{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)(Im,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(UD)]})]}),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=OD(n,{pages:o,pageTitles:s,pageMeta:c,folderPaths:i}),a=RD(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?_(HD):(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)(hd,{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)(Mn,{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)(gD,{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)(kD,{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)(CD,{folderPath:n}),t[44]=n,t[45]=D),S=`rounded-lg border`,y=jD;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)(zD,{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)(FD,{"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)(zD,{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)(FD,{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)(MD,{children:(0,Z.jsxs)(PD,{children:[L,V]})}),t[66]=L,t[67]=V,t[68]=x):x=t[68],v=ND,b=a.length?a.map(VD):(0,Z.jsx)(PD,{children:(0,Z.jsx)(ID,{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)(nx,{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 VD(e){return(0,Z.jsxs)(PD,{children:[(0,Z.jsx)(ID,{children:(0,Z.jsxs)(`a`,{href:Cf(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)(gd,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(C,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(ID,{className:`text-muted-foreground`,children:e.kind===`file`?LD(e.modified):`—`})]},e.path)}function HD(e){return e===`asc`?`desc`:`asc`}function UD(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)(Im,{className:`size-4 rounded`}),(0,Z.jsx)(Im,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Im,{className:`h-4 w-16`})})]},e)}function WD(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=Bn(`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 GD(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=Bn(`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 KD=ar(`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 qD(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=Bn(KD({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 JD(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?or:`div`,o;t[4]===n?o=t[5]:(o=Bn(`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 YD(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=Bn(`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 XD(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=Bn(`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 ZD(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)(qD,{variant:`icon`,className:`mb-0 size-16 rounded-full border bg-muted/40 text-muted-foreground`,children:(0,Z.jsx)(kv,{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)(JD,{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=ao(r),t[8]=r,t[9]=g);let _;t[10]===i?_=t[11]:(_=ao(i),t[10]=i,t[11]=_);let v;t[12]!==n||t[13]!==g||t[14]!==_?(v=(0,Z.jsx)(YD,{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)(GD,{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)(XD,{children:(0,Z.jsxs)(X,{ref:s,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(ol,{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)(WD,{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 QD(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)($D),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>ie(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(){b(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 $D(){return new Set}function eO(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)(H_,{autoStart:i})})]}),t[6]=i,t[7]=u),u}function tO(e){let t=(0,$.c)(20),{nav:n}=e,{state:r,refetch:i}=cd(n),a=(0,Q.useRef)(null),o=n.branch,s,c;t[0]===r.phase?(s=t[1],c=t[2]):(s=()=>{r.phase===`resolved`&&a.current?.querySelector(`button`)?.focus()},c=[r.phase],t[0]=r.phase,t[1]=s,t[2]=c),(0,Q.useEffect)(s,c);let l;t[3]===n.path?l=t[4]:(l=function(){window.location.hash=Of(ld(n.path))},t[3]=n.path,t[4]=l);let u=l,d;t[5]!==o||t[6]!==n.kind?(d=function(e){ud.arm({kind:n.kind,path:e,branch:o}),window.location.hash=n.kind===`folder`?Of(e):Cf(e)},t[5]=o,t[6]=n.kind,t[7]=d):d=t[7];let f=d,p=r.phase===`pending`?`polite`:void 0,m=r.phase===`resolved`?r.resolution.verdict:void 0,h=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`,g;t[8]!==u||t[9]!==n||t[10]!==f||t[11]!==i||t[12]!==r?(g=(0,Z.jsx)(fd,{nav:n,state:r,onBrowseFolder:u,onOpenRenamed:f,onEnableAutoSync:u,onSyncCompleted:i,onPullApplied:i}),t[8]=u,t[9]=n,t[10]=f,t[11]=i,t[12]=r,t[13]=g):g=t[13];let _;return t[14]!==r.phase||t[15]!==p||t[16]!==m||t[17]!==h||t[18]!==g?(_=(0,Z.jsx)(`div`,{ref:a,role:`status`,"aria-live":p,"data-testid":`share-receive-miss-panel`,"data-phase":r.phase,"data-verdict":m,className:h,children:g}),t[14]=r.phase,t[15]=p,t[16]=m,t[17]=h,t[18]=g,t[19]=_):_=t[19],_}var nO=`ok-find`,rO=`ok-find-active`;function iO(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 aO(e){let t=(0,$.c)(61),{containerRef:n,onClose:r}=e,{_:i}=on(),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=iO(e,o.trim());return u(r),f(0),t.set(nO,new Highlight(...r)),()=>{t.delete(nO),t.delete(rO)}},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(rO);return}e.set(rO,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)(zf,{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)(Ul,{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)(Vl,{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)(hf,{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 oO(e){let t=(0,$.c)(9),{text:n}=e,r;t[0]===n?r=t[1]:(r=Qo(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=zo(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)(sO,{keyName:e,value:n},`${e}-${t}`)},t[7]=i,t[8]=c),a=(0,Z.jsx)(wl,{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 sO(e){let t=(0,$.c)(9),{keyName:n,value:r}=e,i=xl[ns(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)(cO,{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)(Cl,{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 cO(e){let t=(0,$.c)(8),{keyName:n,value:r}=e;if(_l(r)){let e;return t[0]!==n||t[1]!==r?(e=(0,Z.jsx)(Pl,{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(lO).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 lO(e){return typeof e==`string`}function uO(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=ho(r).body,n;if(t[8]!==a||t[9]!==s||t[10]!==o){let e=a?Te.map(e=>e.name===`link`?e.configure({docName:a}):e):Te;n=o?[...e,pe.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=zr,l=i,u=!1,d=Er().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)(dO),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)(oO,{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)(Sr,{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,Pg.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 dO(){let e=document.createElement(`div`);return e.style.display=`contents`,e}var fO=`data-skill-markdown`;function pO(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=>Qp({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=Ym(s);if(c.status===`loading`){let e;return t[5]===o?e=t[6]:(e=(0,Z.jsx)(eh,{fileName:o,dataAttr:fO}),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)(Qm,{fileName:o,dataAttr:fO,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=Uo(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=Po(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)(uO,{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 mO(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)&&ys(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 hO=new Set([`md`,`mdx`]);function gO(e){let t=(0,$.c)(18),{scope:n,name:r,path:i,host:a}=e,{_:o}=on(),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=hO.has(p),{findOpen:h,setFindOpen:g}=mO(m?c:l),_=hO.has(p)?(0,Z.jsx)(pO,{scope:n,name:r,path:i,host:a,fileName:d}):(0,Z.jsx)(Xm,{fileName:d,extension:p,loadText:e=>Qp({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)(aO,{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)(sd,{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 _O=[`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 vO(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return _O[Math.abs(t)%_O.length]??_O[0]}var yO=`SKILL.md`,bO=new Map;function xO(e){let t=(0,$.c)(42),{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}=on(),_=`${n}::${r}`,v;t[0]===_?v=t[1]:(v=()=>bO.get(_)??null,t[0]=_,t[1]=v);let[y,b]=(0,Q.useState)(v),x;t[2]===_?x=t[3]:(x=()=>bO.has(_),t[2]=_,t[3]=x);let[S,C]=(0,Q.useState)(x),w=d??yO,T=(0,Q.useRef)(null),E=(0,Q.useRef)(null),{findOpen:D,setFindOpen:O}=mO(T),k,A;t[4]!==r||t[5]!==n?(k=()=>{let e=`${n}::${r}`,t=new AbortController;bO.has(e)||cm({source:n,name:r},t.signal).then(n=>{t.signal.aborted||(n.ok&&(bO.set(e,n),b(n)),C(!0))});let i=Hs(wO);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?TO(y.skillMd):[],n;t[30]!==g||t[31]!==y||t[32]!==w?(n=w===yO?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[30]=g,t[31]=y,t[32]=w,t[33]=n):n=t[33];let u=n,d;t[34]!==D||t[35]!==O?(d=D?(0,Z.jsx)(aO,{containerRef:E,onClose:()=>O(!1)}):null,t[34]=D,t[35]=O,t[36]=d):d=t[36];let m;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(sd,{className:`size-4`,"aria-hidden":!0}),t[37]=m):m=t[37];let _;t[38]!==o||t[39]!==s||t[40]!==h?(_=(0,Z.jsx)(_h,{icon:m,actions:o,reserveRightGutter:h,children:s}),t[38]=o,t[39]=s,t[40]=h,t[41]=_):_=t[41],P=(0,Z.jsxs)(`div`,{ref:T,className:`relative flex h-full min-h-0 flex-col`,children:[d,_,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===yO?l:null,w===yO?(0,Z.jsx)(`div`,{className:`editor-content-aligned pt-6`,children:(0,Z.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Z.jsx)(Cl,{icon:(0,Z.jsx)(hl,{className:`size-3.5`}),label:g({id:`XmJfZT`}),children:(0,Z.jsx)(`span`,{className:`font-mono`,children:r})}),N?(0,Z.jsx)(Cl,{icon:(0,Z.jsx)(vy,{className:`size-3.5`}),label:g({id:`eTsJYJ`}),children:(0,Z.jsx)(`p`,{className:`text-foreground/80`,children:N})}):null,(0,Z.jsx)(Cl,{icon:(0,Z.jsx)(my,{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(CO)}):(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`N2S1rs`})})})]})}):null,u?.md?(0,Z.jsx)(uO,{flow:!0,fileName:u.path,text:u.content,linkBaseDocName:f?Uo(f,r,w===yO?`SKILL`:w):void 0,skillPathLinkDocName:f?Po(f,r):void 0,onBundlePathClick:p}):u?(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:u.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 ${vO(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(SO)]})})})]}),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 SO(e){return(0,Z.jsx)(`div`,{className:`h-4 w-11/12 animate-pulse rounded bg-muted`},e)}function CO(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 wO(){return bO.clear()}function TO(e){try{let{frontmatter:t}=ho(e);return t?uo(ms(t)):[]}catch{return[]}}function EO(e){let t=(0,$.c)(119),{bundle:n,source:r,defaultScope:i,onInstalled:a,onOpenChange:o}=e,{_:s}=on(),c=(0,Q.useId)(),l=Tp(),[u,d]=(0,Q.useState)(i),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=new Set,t[0]=f):f=t[0];let[p,m]=(0,Q.useState)(f),[h,g]=(0,Q.useState)(!1),_;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(_=new Map,t[1]=_):_=t[1];let[v,y]=(0,Q.useState)(_),b=ju(),[x,S]=(0,Q.useState)(null),C=b.state.status===`ready`?b.state.data.targets:null,w;t[2]!==C||t[3]!==x?(w=x??new Set(C??[]),t[2]=C,t[3]=x,t[4]=w):w=t[4];let T=w,E=n!==null,D,O;if(t[5]!==i||t[6]!==E||t[7]!==r?(D=()=>{if(!E)return;m(new Set),S(null),d(i);let e=new AbortController;return rm(r,e.signal).then(t=>{e.signal.aborted||!t.ok||y(new Map(t.skills.map(jO)))}),()=>e.abort()},O=[E,r,i],t[5]=i,t[6]=E,t[7]=r,t[8]=D,t[9]=O):(D=t[8],O=t[9]),(0,Q.useEffect)(D,O),!n)return null;let{plugin:k,names:A}=n,j=p.size===A.length&&A.length>0,M;t[10]===p?M=t[11]:(M=function(e,t){let n=new Set(p);t?n.add(e):n.delete(e),m(n)},t[10]=p,t[11]=M);let N=M,P;t[12]!==s||t[13]!==T||t[14]!==a||t[15]!==o||t[16]!==k||t[17]!==u||t[18]!==p||t[19]!==r?(P=async function(){g(!0);let e=await sm({source:r,skills:[...p],scope:u,install:!1,marketplace:!0});if(!e.ok){g(!1),Ns.error(s({id:`Lbl6KA`,values:{0:k??r,1:e.error}}));return}let t=e.results.map(AO).filter(kO),n=[...T];if(n.length>0)for(let e of t){let t=await am({scope:u,name:e,targets:n,linkMode:!0});t.ok||Ns.error(s({id:`1oSHI0`,values:{0:t.error,skillName:e}}))}g(!1);let{imported:i,alreadyImported:c,failed:l}=e;if(l>0){let t=e.results.filter(OO).map(DO).join(`, `);Ns.error(s({id:`cMMb6H`,values:{imported:i,failed:l,failedNames:t}}))}else i===0?Ns.info(s({id:`uJfwF8`})):c>0?Ns.success(s({id:`tkIXtS`,values:{imported:i,alreadyImported:c}})):Ns.success(s({id:`-kKdCC`,values:{0:k??r,imported:i}}));let d=new Map;for(let t of e.results)t.status!==`imported`&&t.status!==`already-imported`||d.set(t.requested,t.name??t.requested);d.size>0&&a?.(d),o(!1)},t[12]=s,t[13]=T,t[14]=a,t[15]=o,t[16]=k,t[17]=u,t[18]=p,t[19]=r,t[20]=P):P=t[20];let F=P,I;t[21]!==h||t[22]!==o?(I=e=>{!e&&!h&&o(!1)},t[21]=h,t[22]=o,t[23]=I):I=t[23];let L;t[24]!==k||t[25]!==r?(L=(0,Z.jsx)(hr,{children:k?(0,Z.jsx)(Y,{id:`J86siq`,values:{plugin:k}}):(0,Z.jsx)(Y,{id:`Q-DKvr`,values:{source:r}})}),t[24]=k,t[25]=r,t[26]=L):L=t[26];let R;t[27]===k?R=t[28]:(R=(0,Z.jsx)(mr,{children:k?(0,Z.jsx)(Y,{id:`lj4cNf`}):(0,Z.jsx)(Y,{id:`4mDIcg`})}),t[27]=k,t[28]=R);let z;t[29]!==R||t[30]!==L?(z=(0,Z.jsxs)(yr,{children:[L,R]}),t[29]=R,t[30]=L,t[31]=z):z=t[31];let B;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(Y,{id:`oCHfGC`}),t[32]=B):B=t[32];let V;t[33]===c?V=t[34]:(V=(0,Z.jsx)(Ci,{htmlFor:c,children:B}),t[33]=c,t[34]=V);let H;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>d(e),t[35]=H):H=t[35];let U;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(Oi,{}),t[36]=U):U=t[36];let W;t[37]===c?W=t[38]:(W=(0,Z.jsx)(Di,{id:c,className:`w-full`,children:U}),t[37]=c,t[38]=W);let ee;t[39]===l?ee=t[40]:(ee=Ap.map(e=>(0,Z.jsx)(Ti,{value:e,children:l[e]},e)),t[39]=l,t[40]=ee);let G;t[41]===ee?G=t[42]:(G=(0,Z.jsx)(Ei,{children:ee}),t[41]=ee,t[42]=G);let K;t[43]!==u||t[44]!==W||t[45]!==G?(K=(0,Z.jsxs)(ki,{value:u,onValueChange:H,children:[W,G]}),t[43]=u,t[44]=W,t[45]=G,t[46]=K):K=t[46];let q;t[47]!==V||t[48]!==K?(q=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[V,K]}),t[47]=V,t[48]=K,t[49]=q):q=t[49];let te;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(Ci,{children:(0,Z.jsx)(Y,{id:`Y5la_5`})}),t[50]=te):te=t[50];let J;t[51]!==h||t[52]!==T?(J=jc.map(e=>(0,Z.jsxs)(Ci,{className:`flex cursor-pointer items-center gap-2 text-sm font-normal`,children:[(0,Z.jsx)(Hr,{checked:T.has(e),disabled:h,onCheckedChange:t=>{let n=new Set(T);t===!0?n.add(e):n.delete(e),S(n)}}),_s[e]??e]},e)),t[51]=h,t[52]=T,t[53]=J):J=t[53];let ne;t[54]===J?ne=t[55]:(ne=(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-2`,children:J}),t[54]=J,t[55]=ne);let re;t[56]===T.size?re=t[57]:(re=T.size===0?(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`7ZkJdV`})}):null,t[56]=T.size,t[57]=re);let ie;t[58]!==ne||t[59]!==re?(ie=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[te,ne,re]}),t[58]=ne,t[59]=re,t[60]=ie):ie=t[60];let ae;t[61]!==A.length||t[62]!==p.size?(ae=(0,Z.jsx)(`p`,{className:`font-medium text-xs font-mono text-muted-foreground/80 uppercase tracking-wider`,children:(0,Z.jsx)(Y,{id:`lUtr1r`,values:{0:p.size,1:A.length}})}),t[61]=A.length,t[62]=p.size,t[63]=ae):ae=t[63];let oe;t[64]!==j||t[65]!==A?(oe=()=>m(j?new Set:new Set(A)),t[64]=j,t[65]=A,t[66]=oe):oe=t[66];let se;t[67]===j?se=t[68]:(se=j?(0,Z.jsx)(Y,{id:`xCJdfg`}):(0,Z.jsx)(Y,{id:`wgNoIs`}),t[67]=j,t[68]=se);let ce;t[69]!==h||t[70]!==oe||t[71]!==se?(ce=(0,Z.jsx)(X,{variant:`ghost`,size:`sm`,disabled:h,onClick:oe,children:se}),t[69]=h,t[70]=oe,t[71]=se,t[72]=ce):ce=t[72];let le;t[73]!==ae||t[74]!==ce?(le=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[ae,ce]}),t[73]=ae,t[74]=ce,t[75]=le):le=t[75];let ue;if(t[76]!==h||t[77]!==v||t[78]!==A||t[79]!==p||t[80]!==N){let e;t[82]!==h||t[83]!==v||t[84]!==p||t[85]!==N?(e=e=>{let t=v.get(e);return(0,Z.jsxs)(Ci,{className:`flex cursor-pointer items-start gap-3 p-3 text-sm font-normal hover:bg-muted/40`,children:[(0,Z.jsx)(Hr,{checked:p.has(e),disabled:h,onCheckedChange:t=>N(e,t===!0),className:`mt-0.5`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,Z.jsx)(`span`,{className:`font-mono`,children:e}),t?(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground line-clamp-2`,children:t}):null]})]},e)},t[82]=h,t[83]=v,t[84]=p,t[85]=N,t[86]=e):e=t[86],ue=A.map(e),t[76]=h,t[77]=v,t[78]=A,t[79]=p,t[80]=N,t[81]=ue}else ue=t[81];let de;t[87]===ue?de=t[88]:(de=(0,Z.jsx)(`div`,{className:`max-h-72 overflow-y-auto rounded-md border border-border divide-y divide-border`,children:ue}),t[87]=ue,t[88]=de);let fe;t[89]!==q||t[90]!==ie||t[91]!==le||t[92]!==de?(fe=(0,Z.jsxs)(_r,{className:`flex flex-col gap-4`,children:[q,ie,le,de]}),t[89]=q,t[90]=ie,t[91]=le,t[92]=de,t[93]=fe):fe=t[93];let pe;t[94]===o?pe=t[95]:(pe=()=>o(!1),t[94]=o,t[95]=pe);let me;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsx)(Y,{id:`dEgA5A`}),t[96]=me):me=t[96];let he;t[97]!==h||t[98]!==pe?(he=(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,disabled:h,onClick:pe,children:me}),t[97]=h,t[98]=pe,t[99]=he):he=t[99];let ge=h||p.size===0,_e;t[100]===F?_e=t[101]:(_e=()=>void F(),t[100]=F,t[101]=_e);let ve;t[102]===h?ve=t[103]:(ve=h?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(xd,{"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(Y,{id:`Wtw22s`})]}):(0,Z.jsx)(Y,{id:`4wo5UV`}),t[102]=h,t[103]=ve);let ye;t[104]!==ge||t[105]!==_e||t[106]!==ve?(ye=(0,Z.jsx)(X,{"data-testid":`plugin-bundle-install`,disabled:ge,onClick:_e,children:ve}),t[104]=ge,t[105]=_e,t[106]=ve,t[107]=ye):ye=t[107];let be;t[108]!==he||t[109]!==ye?(be=(0,Z.jsxs)(vr,{children:[he,ye]}),t[108]=he,t[109]=ye,t[110]=be):be=t[110];let xe;t[111]!==z||t[112]!==fe||t[113]!==be?(xe=(0,Z.jsxs)(gr,{className:`sm:max-w-lg`,children:[z,fe,be]}),t[111]=z,t[112]=fe,t[113]=be,t[114]=xe):xe=t[114];let Se;return t[115]!==E||t[116]!==xe||t[117]!==I?(Se=(0,Z.jsx)(br,{open:E,onOpenChange:I,children:xe}),t[115]=E,t[116]=xe,t[117]=I,t[118]=Se):Se=t[118],Se}function DO(e){return e.requested}function OO(e){return e.status===`failed`||e.status===`not-found`}function kO(e){return typeof e==`string`}function AO(e){return e.name}function jO(e){return[e.name,e.description]}var MO=ar(`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 NO(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=Bn(MO({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 PO(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=Bn(`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 FO(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=Bn(`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 IO(e){let t=(0,$.c)(43),{bundle:n,source:r,scope:i,onInstalled:a}=e,{_:o}=on(),[s,c]=(0,Q.useState)(!1);if(n.names.length<=1)return null;let l;t[0]!==o||t[1]!==n.capabilities?.hooks?(l=n.capabilities?.hooks?o({id:`8fDf7j`}):null,t[0]=o,t[1]=n.capabilities?.hooks,t[2]=l):l=t[2];let u;t[3]!==o||t[4]!==n.capabilities?.commands?(u=n.capabilities?.commands?o({id:`9HKBNN`}):null,t[3]=o,t[4]=n.capabilities?.commands,t[5]=u):u=t[5];let d;t[6]!==o||t[7]!==n.capabilities?.mcp?(d=n.capabilities?.mcp?o({id:`8qgfac`}):null,t[6]=o,t[7]=n.capabilities?.mcp,t[8]=d):d=t[8];let f;t[9]!==o||t[10]!==n.capabilities?.agents?(f=n.capabilities?.agents?o({id:`EpZQFw`}):null,t[9]=o,t[10]=n.capabilities?.agents,t[11]=f):f=t[11];let p;t[12]!==l||t[13]!==u||t[14]!==d||t[15]!==f?(p=[l,u,d,f].filter(LO),t[12]=l,t[13]=u,t[14]=d,t[15]=f,t[16]=p):p=t[16];let m=p,h=n.names.length,g=n.plugin,_;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(qd,{className:`size-4`,"aria-hidden":!0}),t[17]=_):_=t[17];let v;t[18]!==h||t[19]!==g?(v=(0,Z.jsx)(PO,{children:g?(0,Z.jsx)(Y,{id:`3l32hp`,values:{plugin:g}}):(0,Z.jsx)(Y,{id:`_mcDqU`,values:{count:h}})}),t[18]=h,t[19]=g,t[20]=v):v=t[20];let y;t[21]!==m||t[22]!==h||t[23]!==g||t[24]!==r?(y=(0,Z.jsx)(FO,{className:`min-w-0`,children:m.length>0?(0,Z.jsx)(Y,{id:`aR4DgO`,values:{0:m.join(`, `),count:h}}):g?(0,Z.jsx)(Y,{id:`zt9ZgM`,values:{count:h}}):(0,Z.jsx)(Y,{id:`wefL17`,values:{source:r,count:h}})}),t[21]=m,t[22]=h,t[23]=g,t[24]=r,t[25]=y):y=t[25];let b;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(X,{variant:`outline`,size:`sm`,"data-testid":`plugin-bundle-pick`,onClick:()=>c(!0),children:(0,Z.jsx)(Y,{id:`XVnIvs`})}),t[26]=b):b=t[26];let x;t[27]===n.repositoryUrl?x=t[28]:(x=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)(dl,{className:`size-3.5`})]})}):null,t[27]=n.repositoryUrl,t[28]=x);let S;t[29]===x?S=t[30]:(S=(0,Z.jsxs)(`div`,{className:`mt-2.5 flex items-center gap-2 group-has-[>svg]/alert:col-start-2`,children:[b,x]}),t[29]=x,t[30]=S);let C;t[31]!==S||t[32]!==v||t[33]!==y?(C=(0,Z.jsxs)(NO,{role:`note`,className:`my-3 bg-muted/40 px-4 py-3`,children:[_,v,y,S]}),t[31]=S,t[32]=v,t[33]=y,t[34]=C):C=t[34];let w=s?n:null,T;t[35]!==a||t[36]!==i||t[37]!==r||t[38]!==w?(T=(0,Z.jsx)(EO,{bundle:w,source:r,defaultScope:i,onInstalled:a,onOpenChange:c}),t[35]=a,t[36]=i,t[37]=r,t[38]=w,t[39]=T):T=t[39];let E;return t[40]!==C||t[41]!==T?(E=(0,Z.jsxs)(`div`,{className:`editor-content-aligned`,children:[C,T]}),t[40]=C,t[41]=T,t[42]=E):E=t[42],E}function LO(e){return e!==null}function RO(e){let t=(0,$.c)(27),{source:n,name:r,initialScope:i,marketplace:a}=e,{_:o}=on(),[s,c]=(0,Q.useState)(i),[l,u]=(0,Q.useState)(null),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=[],t[0]=d):d=t[0];let[f,p]=(0,Q.useState)(d),[m,h]=(0,Q.useState)(!1),g;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(g=[],t[1]=g):g=t[1];let _=(0,Q.useRef)(g),v=(0,Q.useRef)(null),y=(0,Q.useRef)(null),b=(0,Q.useRef)(null),x;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(x=[],t[2]=x):x=t[2];let S=(0,Q.useRef)(x),C=(0,Q.useRef)(!1),w;t[3]!==o||t[4]!==a||t[5]!==r||t[6]!==s||t[7]!==n?(w=async function(){if(v.current)return v.current;if(b.current)return b.current;let e=s,t=tm({source:n,skill:r,scope:e,install:!1,...a?{marketplace:!0}:{}}).then(t=>t.ok?(v.current=t.name,y.current=e,u(t.name),t.name):(Ns.error(o({id:`oX-rVu`,values:{0:t.error}})),null));b.current=t;let i=await t;return b.current=null,i},t[3]=o,t[4]=a,t[5]=r,t[6]=s,t[7]=n,t[8]=w):w=t[8];let T=w,E;t[9]!==o||t[10]!==T?(E=async function(e){if(_.current=e,S.current=e,p(e),!C.current){for(C.current=!0,h(!0);;){let e=S.current,t=await T(),n=y.current;if(!t||!n)break;let r=await am({scope:n,name:t,targets:[...e],linkMode:!0});if(!r.ok){Ns.error(o({id:`s-pW_v`,values:{0:r.error}}));break}if(e===S.current){let e=_.current.filter(zO),t=[...new Set([...e,...r.hosts])];_.current=t,p(t);break}}C.current=!1,h(!1)}},t[9]=o,t[10]=T,t[11]=E):E=t[11];let D=E,O;t[12]===f?O=t[13]:(O=new Set(f),t[12]=f,t[13]=O);let k=f.length>0,A;t[14]!==o||t[15]!==m||t[16]!==D||t[17]!==T||t[18]!==O||t[19]!==k?(A={hostSet:O,installed:k,installing:m,toggleEditor(e,t){if(e===`agents`){if(!t)return;(async()=>{h(!0);let e=await T(),t=y.current;if(e&&t){let n=await $p({scope:t,name:e,dir:`.agents/skills`,mode:`copy`});if(n.ok){let e=[...new Set([..._.current,`agents`])];_.current=e,p(e)}else Ns.error(o({id:`s-pW_v`,values:{0:n.error}}))}h(!1)})();return}let n=new Set(_.current);t?n.add(e):n.delete(e),D([...n])},installAll(){D([...jc])},linkMode:!0,placeAt(e,t){(async()=>{h(!0);let n=await T(),r=y.current;if(n&&r){let i=await $p({scope:r,name:n,dir:e,mode:t});i.ok||Ns.error(o({id:`s-pW_v`,values:{0:i.error}}))}h(!1)})()}},t[14]=o,t[15]=m,t[16]=D,t[17]=T,t[18]=O,t[19]=k,t[20]=A):A=t[20];let j=A,M=l!==null||m,N;return t[21]!==T||t[22]!==l||t[23]!==s||t[24]!==M||t[25]!==j?(N={scope:s,setScope:c,scopeLocked:M,importedName:l,importNow:T,toggles:j},t[21]=T,t[22]=l,t[23]=s,t[24]=M,t[25]=j,t[26]=N):N=t[26],N}function zO(e){return!Da(e)}var BO=`SKILL.md`;function VO(e){let t=(0,$.c)(12),{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}=vh(i);if(!a)return null;let u;t[3]===o?u=t[4]:(u=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)(dl,{className:`h-3.5 w-3.5`})]})}):null,t[3]=o,t[4]=u);let d;t[5]!==c||t[6]!==l||t[7]!==s?(d=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[5]=c,t[6]=l,t[7]=s,t[8]=d):d=t[8];let f;return t[9]!==u||t[10]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex gap-1`,children:[u,d]}),t[9]=u,t[10]=d,t[11]=f):f=t[11],f}function HO(e){let t=(0,$.c)(92),{flavor:n,source:r,name:i,subtitle:a,level:o,reserveRightGutter:s,path:c}=e,l=c??BO,u=Tp(),d=pm(),[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 im({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`?yo(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 rm(r,e.signal).then(t=>{e.signal.aborted||!t.ok||D(t.skills.map(GO))}),()=>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===`foreign`,F=o??`project`,I=n===`explore`,L;t[17]!==i||t[18]!==r||t[19]!==I||t[20]!==F?(L={source:r,name:i,initialScope:F,marketplace:I},t[17]=i,t[18]=r,t[19]=I,t[20]=F,t[21]=L):L=t[21];let R=RO(L),z=(0,Q.useRef)(!1),[B,V]=(0,Q.useState)(null),H=R.importedName??B,U=(n===`explore`||P||v!==null)&&H!==null,W,ee;t[22]!==U||t[23]!==H||t[24]!==d||t[25]!==R.scope?(ee=()=>{!U||z.current||(z.current=!0,d(R.scope,H,{replaceActive:!0}))},W=[U,R.scope,H,d],t[22]=U,t[23]=H,t[24]=d,t[25]=R.scope,t[26]=W,t[27]=ee):(W=t[26],ee=t[27]),(0,Q.useEffect)(ee,W);let G;t[28]===a?G=t[29]:(G=a&&a.charAt(0).toUpperCase()+a.slice(1),t[28]=a,t[29]=G);let K=G,q=u[F],te;t[30]===i?te=t[31]:(te=(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`,children:i}),t[30]=i,t[31]=te);let J=te,ne;t[32]===q?ne=t[33]:(ne=(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`,children:q}),t[32]=q,t[33]=ne);let re=ne,ie;t[34]===K?ie=t[35]:(ie=(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`,children:K}),t[34]=K,t[35]=ie);let ae=ie,oe=v?.version?` (v${v.version})`:``,se;t[36]!==ae||t[37]!==re||t[38]!==J||t[39]!==N||t[40]!==M||t[41]!==P||t[42]!==v||t[43]!==oe||t[44]!==r?(se=N?(0,Z.jsx)(Y,{id:`rmorj0`,values:{boldName:J}}):v?(0,Z.jsx)(Y,{id:`UceXfW`,values:{0:v.plugin,boldName:J,pluginVersion:oe,boldHarness:ae},components:{0:(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`})}}):P?(0,Z.jsx)(Y,{id:`yhYv9j`,values:{boldName:J,source:r},components:{0:(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`})}}):M?(0,Z.jsx)(Y,{id:`UHwc0P`,values:{boldName:J,boldHarness:ae,boldLevel:re}}):(0,Z.jsx)(Y,{id:`fBoO7w`,values:{boldName:J}}),t[36]=ae,t[37]=re,t[38]=J,t[39]=N,t[40]=M,t[41]=P,t[42]=v,t[43]=oe,t[44]=r,t[45]=se):se=t[45];let ce=se,le;t[46]!==N||t[47]!==f||t[48]!==M||t[49]!==n||t[50]!==P||t[51]!==i||t[52]!==v||t[53]!==R||t[54]!==u.global||t[55]!==u.project||t[56]!==T||t[57]!==w||t[58]!==F?(le=N?(0,Z.jsx)(VO,{scope:F,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)(dl,{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)(dl,{className:`h-3.5 w-3.5`})]})}):null]}),v||!M?(0,Z.jsxs)(xi,{children:[(0,Z.jsx)(hi,{asChild:!0,children:(0,Z.jsx)(X,{size:`sm`,disabled:R.toggles.installing,"data-testid":v?`skill-preview-edit-a-copy`:P?`skill-preview-copy-in`:void 0,children:R.toggles.installing?v||P?(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`}):P?(0,Z.jsx)(Y,{id:`XBgr2S`}):(0,Z.jsx)(Y,{id:`TKQ7K-`}),(0,Z.jsx)(Vl,{className:`size-4 opacity-60`,"aria-hidden":!0})]})})}),(0,Z.jsxs)(yi,{align:`end`,className:Mc,children:[(0,Z.jsx)(_i,{children:(0,Z.jsx)(Y,{id:`oCHfGC`})}),(0,Z.jsxs)(ui,{value:R.scope,onValueChange:e=>R.setScope(e),children:[(0,Z.jsx)(mi,{value:`project`,disabled:R.scopeLocked,onSelect:WO,children:u.project}),(0,Z.jsx)(mi,{value:`global`,disabled:R.scopeLocked,onSelect:UO,children:u.global})]}),(0,Z.jsx)(Si,{}),(0,Z.jsx)(Bc,{toggles:R.toggles,skill:{scope:R.scope,name:i}})]})]}):null]}),t[46]=N,t[47]=f,t[48]=M,t[49]=n,t[50]=P,t[51]=i,t[52]=v,t[53]=R,t[54]=u.global,t[55]=u.project,t[56]=T,t[57]=w,t[58]=F,t[59]=le):le=t[59];let ue=le,de;t[60]!==n||t[61]!==o||t[62]!==i||t[63]!==r||t[64]!==a||t[65]!==F?(de=e=>n===`explore`?(window.location.hash=Tf({flavor:n,source:r,name:i,subtitle:a,level:o,path:e}),!0):(window.location.hash=Df({scope:F,name:i,path:e}),!0),t[60]=n,t[61]=o,t[62]=i,t[63]=r,t[64]=a,t[65]=F,t[66]=de):de=t[66];let fe=de,pe=a||i,me;t[67]!==M||t[68]!==n?(me=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[67]=M,t[68]=n,t[69]=me):me=t[69];let he;t[70]!==j||t[71]!==i||t[72]!==R.scope||t[73]!==r?(he=j?(0,Z.jsx)(IO,{bundle:j,source:r,scope:R.scope,onInstalled:e=>{let t=e.get(i);t!==void 0&&V(t)}}):void 0,t[70]=j,t[71]=i,t[72]=R.scope,t[73]=r,t[74]=he):he=t[74];let ge=N?F:void 0,_e;t[75]!==f||t[76]!==m?(_e=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[75]=f,t[76]=m,t[77]=_e):_e=t[77];let ve;return t[78]!==ue||t[79]!==ce||t[80]!==i||t[81]!==fe||t[82]!==s||t[83]!==l||t[84]!==r||t[85]!==a||t[86]!==pe||t[87]!==me||t[88]!==he||t[89]!==ge||t[90]!==_e?(ve=(0,Z.jsx)(xO,{source:r,name:i,subtitle:a,tintKey:pe,onBundlePathClick:fe,headerActions:ue,headerLine:ce,reserveRightGutter:s,selectedPath:l,onPreviewMeta:me,banner:he,scope:ge,noPreviewFallback:_e}),t[78]=ue,t[79]=ce,t[80]=i,t[81]=fe,t[82]=s,t[83]=l,t[84]=r,t[85]=a,t[86]=pe,t[87]=me,t[88]=he,t[89]=ge,t[90]=_e,t[91]=ve):ve=t[91],ve}function UO(e){return e.preventDefault()}function WO(e){return e.preventDefault()}function GO(e){return e.name}var KO=(0,Q.lazy)(()=>n(()=>import(`./ImportSkillDialog-C4hZ7UL5.js`).then(e=>({default:e.ImportSkillDialog})),__vite__mapDeps([122,1,6,2,3,7,8,9,10,11,45,12,13,14,97,35,36,16,17,18,20,54,28,29,34,24,25,26,19,22,21,40,98,27,30,31,123,124,55,125,56,79,80,81,82,83,84,85,86,87,88,89,90,91,74,92,93,94,95,96,4,39,99,100,101,41,42,66,67,68,69,102,49,71,103,104,46,105,33,65,70,72,73,106,107,108,37,23,109,110,43,47,111,112,113,126,127,128,129,130,131,132,48]),import.meta.url)),qO=6;function JO(e){let t=(0,$.c)(41),{sessionsDockOpen:n}=e,r=n===void 0?!1:n,{_:i}=on(),a=tn()||r,[o,s]=(0,Q.useState)(null),c=pm(),{createBlank:l}=Gx(),{skills:u,isPending:d}=Jd(),f;t[0]===u?f=t[1]:(f=u.slice(0,qO),t[0]=u,t[1]=f);let p=f,h=d||p.length>0,g;t[2]===i?g=t[3]:(g=i({id:`ivwdwq`}),t[2]=i,t[3]=g);let _;t[4]===i?_=t[5]:(_=i({id:`6Mbe-P`}),t[4]=i,t[5]=_);let v;t[6]!==g||t[7]!==_?(v=(0,Z.jsx)(ZE,{title:g,subtitle:_,celebrateSignal:0}),t[6]=g,t[7]=_,t[8]=v):v=t[8];let y;t[9]===a?y=t[10]:(y=a?null:(0,Z.jsx)(JE,{scenario:`skill`}),t[9]=a,t[10]=y);let b;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>s(`upload`),t[11]=b):b=t[11];let x;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,onClick:b,"data-testid":`skill-source-upload`,className:`gap-1.5 font-normal text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(m,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`mShKiV`})]}),t[12]=x):x=t[12];let S;t[13]===l?S=t[14]:(S=()=>void l(`project`),t[13]=l,t[14]=S);let C,w;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(jr,{"aria-hidden":`true`,className:`size-3.5`}),w=(0,Z.jsx)(Y,{id:`dJXrT9`}),t[15]=C,t[16]=w):(C=t[15],w=t[16]);let T;t[17]===S?T=t[18]:(T=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,onClick:S,"data-testid":`skill-source-new`,className:`gap-1.5 font-normal text-muted-foreground hover:text-foreground`,children:[C,w]}),t[17]=S,t[18]=T);let E;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>s(`skills-sh`),t[19]=E):E=t[19];let D;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,onClick:E,"data-testid":`skill-source-skills-sh`,className:`gap-1.5 font-normal text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(Sv,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`EBS8_X`})]}),t[20]=D):D=t[20];let O;t[21]===T?O=t[22]:(O=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[x,T,D]}),t[21]=T,t[22]=O);let k;t[23]!==O||t[24]!==y?(k=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[y,O]}),t[23]=O,t[24]=y,t[25]=k):k=t[25];let A;t[26]!==i||t[27]!==p||t[28]!==d||t[29]!==h?(A=h?(0,Z.jsx)(Kd,{scope:`project`,results:p,pending:d,skeletonCount:qO,testId:`skills-popular`,loadingLabel:i({id:`JDHcCM`}),label:(0,Z.jsx)(Y,{id:`3v62tp`}),action:d?null:(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>s(`skills-sh`),"data-testid":`skill-popular-browse-all`,className:`h-auto gap-1 py-0.5 font-mono text-2xs uppercase tracking-wider text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(Y,{id:`O-m8q9`}),(0,Z.jsx)(ll,{"aria-hidden":`true`,className:`size-3`})]})}):null,t[26]=i,t[27]=p,t[28]=d,t[29]=h,t[30]=A):A=t[30];let j;t[31]!==k||t[32]!==A||t[33]!==v?(j=(0,Z.jsxs)(`div`,{className:`my-auto w-full max-w-4xl space-y-6`,children:[v,k,A]}),t[31]=k,t[32]=A,t[33]=v,t[34]=j):j=t[34];let M;t[35]!==o||t[36]!==c?(M=o===null?null:(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(KO,{defaultScope:`project`,defaultTab:o,open:!0,onOpenChange:e=>{e||s(null)},onImported:e=>{let{scope:t,name:n}=e;s(null),c(t,n)}})}),t[35]=o,t[36]=c,t[37]=M):M=t[37];let N;return t[38]!==j||t[39]!==M?(N=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col items-center overflow-auto subtle-scrollbar p-10`,children:[j,M]}),t[38]=j,t[39]=M,t[40]=N):N=t[40],N}function YO(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var XO=YO(()=>n(()=>import(`./SettingsDialogBody-eShyjwp_.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([133,1,134,18,14,6,2,3,7,8,9,10,11,91,45,74,24,13,92,93,94,95,96,12,97,35,36,16,17,20,54,28,29,34,25,26,19,22,21,40,98,135,27,30,31,79,80,81,82,83,84,85,86,87,88,89,90,4,39,99,100,101,41,42,66,67,68,69,102,49,71,103,104,46,105,33,65,70,72,73,106,107,108,37,23,109,110,43,47,111,112,113,126,136,137,138,55,116,117,139,15,123,124,140,53,56,141,64,142,143,144,145,146,147,48,50,148,149,150,151,152,153,154,155,156,128,157,158,132,159,160,161,131]),import.meta.url));function ZO(e){let t=(0,$.c)(9),{error:n}=e,{_:r}=on(),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:QO,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 QO(){return window.location.reload()}function $O(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(Pn,{fallbackRender:tk,onError:ek,children:n}),t[0]=n,t[1]=r),r}function ek(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function tk(e){return(0,Z.jsx)(ZO,{...e})}function nk(e=typeof window>`u`?void 0:window.location){return e?.protocol===`file:`}function rk(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,keywords:[e.label]});for(let e of Bu)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 Ro)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 ik(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}function ak(e){let t=(0,$.c)(46),{open:n,initialSection:r,onOpenChange:i}=e,a=r===void 0?null:r,{_:o}=on(),{collabUrl:s}=Oe(),{userBinding:c,userSynced:l,okignoreBinding:u,okignoreSynced:d,projectConfig:f,merged:p}=xc(),{desktopPresent:m}=Qu(),[h,g]=(0,Q.useState)(a??`preferences`),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(null),C=(0,Q.useRef)(0),w=(0,Q.useRef)(null),T,E;t[0]!==a||t[1]!==n?(T=()=>{n&&(g(a??`preferences`),v(``))},E=[n,a],t[0]=a,t[1]=n,t[2]=T,t[3]=E):(T=t[2],E=t[3]),(0,Q.useEffect)(T,E);let D,O;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>Os(g),O=[],t[4]=D,t[5]=O):(D=t[4],O=t[5]),(0,Q.useEffect)(D,O);let k,A;t[6]===y?(k=t[7],A=t[8]):(k=()=>{if(!y)return;let e=w.current;if(!e)return;let t=null,n=null,r=null,i=null,a=()=>{let r=e.querySelector(`[data-field="${y.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`)}},A=[y],t[6]=y,t[7]=k,t[8]=A),(0,Q.useEffect)(k,A);let j=s!==null,M=typeof window<`u`&&window.okDesktop!=null,N=M&&window.okDesktop?.config.ptyAvailable===!0,P,F;if(t[9]!==o||t[10]!==m||t[11]!==j||t[12]!==p?.appearance?.colorThemeEnabled||t[13]!==p?.slides?.enabled||t[14]!==f?.contentRules){let e;t[17]===f?.contentRules?e=t[18]:(e=e=>f?.contentRules?.[e.id]?.enabled===!0,t[17]=f?.contentRules,t[18]=e);let n=Fm.filter(e).map(ok),r=p?.appearance?.colorThemeEnabled!==!1,i=p?.slides?.enabled===!0,a=nk();P=[{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:`PCSkw2`})},...M?[{id:`ai-tools`,label:o({id:`_5qBNl`})}]:[]]},{id:`project`,label:o({id:`ZWyHmq`}),enabled:j,items:[{id:`sync`,label:o({id:`Nu4DdT`})},{id:`search`,label:o({id:`A1taO8`})},{id:`plugins-manage`,label:o({id:`ohUJJM`})},{id:`content-rules`,label:o({id:`OPOiKn`})},...a?[]:[{id:`link-previews`,label:o({id:`gh27t1`})}],...N?[{id:`terminal`,label:o({id:`ALhMYW`})}]:[],...M?[{id:`project-ai-tools`,label:o({id:`crqzW5`})}]:[],{id:`project-templates`,label:o({id:`iTylMl`})},{id:`skills`,label:o({id:`PCSkw2`})},{id:`okignore`,label:o({id:`3zyg_A`})},{id:`sharing`,label:o({id:`cs4mps`})}]},{id:`plugins`,label:o({id:`ohUJJM`}),enabled:!0,items:[...j?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:[]}],F=rk({groups:P,translate:o}),t[9]=o,t[10]=m,t[11]=j,t[12]=p?.appearance?.colorThemeEnabled,t[13]=p?.slides?.enabled,t[14]=f?.contentRules,t[15]=P,t[16]=F}else P=t[15],F=t[16];let I=F,L;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(L=function(e){C.current+=1;let t=C.current;g(e.sectionId),e.kind===`field`&&e.targetField?b({path:e.targetField}):e.kind===`rule`&&e.ruleId&&S({query:e.ruleId,nonce:t}),v(``)},t[19]=L):L=t[19];let R=L,z;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(hr,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`Tz0i8g`})}),t[20]=z):z=t[20];let B;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(mr,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`RDrXh4`})}),t[21]=B):B=t[21];let V;t[22]!==h||t[23]!==P||t[24]!==I||t[25]!==_?(V=(0,Z.jsx)(sk,{groups:P,activeId:h,onSelect:g,entries:I,searchQuery:_,onSearchChange:v,onNavigate:R}),t[22]=h,t[23]=P,t[24]=I,t[25]=_,t[26]=V):V=t[26];let H;t[27]===o?H=t[28]:(H=o({id:`OXb_Df`}),t[27]=o,t[28]=H);let U;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(hk,{}),t[29]=U):U=t[29];let W=l?c:null,ee;t[30]!==h||t[31]!==u||t[32]!==d||t[33]!==x||t[34]!==W?(ee=(0,Z.jsx)($O,{children:(0,Z.jsx)(Q.Suspense,{fallback:U,children:(0,Z.jsx)(XO,{activeId:h,userBinding:W,okignoreBinding:u,okignoreSynced:d,markdownlintRuleQuery:x})})}),t[30]=h,t[31]=u,t[32]=d,t[33]=x,t[34]=W,t[35]=ee):ee=t[35];let G;t[36]!==H||t[37]!==ee?(G=(0,Z.jsx)(`section`,{ref:w,"aria-label":H,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain subtle-scrollbar p-6`,tabIndex:0,children:ee}),t[36]=H,t[37]=ee,t[38]=G):G=t[38];let K;t[39]!==V||t[40]!==G?(K=(0,Z.jsxs)(gr,{className:`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))]`,"data-testid":`settings-dialog`,children:[z,B,V,G]}),t[39]=V,t[40]=G,t[41]=K):K=t[41];let q;return t[42]!==i||t[43]!==n||t[44]!==K?(q=(0,Z.jsx)(br,{open:n,onOpenChange:i,children:K}),t[42]=i,t[43]=n,t[44]=K,t[45]=q):q=t[45],q}function ok(e){return{id:`plugin:${e.id}`,label:e.label}}function sk(e){let t=(0,$.c)(46),{groups:n,activeId:r,onSelect:i,entries:a,searchQuery:o,onSearchChange:s,onNavigate:c}=e,{_:l}=on(),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=>Ib(e.label,d,e.keywords)),n=e.filter(uk),r=e.filter(lk),i=e.filter(ck);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=Lt,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)(ke,{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)(Nt,{"data-testid":`settings-search-results`,className:`mt-1.5`,children:[(0,Z.jsx)(kt,{"data-testid":`settings-search-empty`,children:(0,Z.jsx)(Y,{id:`ljFWEt`})}),n.length>0?(0,Z.jsx)(nt,{heading:l({id:`R4OWFD`}),children:n.map(e=>(0,Z.jsx)(dk,{entry:e,query:d,onNavigate:c},e.id))}):null,r.length>0?(0,Z.jsx)(nt,{heading:l({id:`Tz0i8g`}),children:r.map(e=>(0,Z.jsx)(dk,{entry:e,query:d,onNavigate:c},e.id))}):null,i.length>0?(0,Z.jsx)(nt,{heading:l({id:`v2a04T`}),children:i.map(e=>(0,Z.jsx)(dk,{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)(mk,{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)(pk,{}),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 ck(e){return e.kind===`rule`}function lk(e){return e.kind===`field`}function uk(e){return e.kind===`section`}function dk(e){let t=(0,$.c)(13),{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=Nb(n.label,r).map(fk),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:`truncate`,children:c}),t[6]=c,t[7]=l);let u;return t[8]!==n.id||t[9]!==o||t[10]!==s||t[11]!==l?(u=(0,Z.jsx)(xt,{value:a,onSelect:o,"data-testid":s,children:l}),t[8]=n.id,t[9]=o,t[10]=s,t[11]=l,t[12]=u):u=t[12],u}function fk(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 pk(){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=ik(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:Bn(`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)(dl,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=s):s=e[3],s}function mk(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=Bn(`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:Bn(`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 hk(){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)(Im,{className:`h-5 w-32`}),r=(0,Z.jsx)(Im,{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)(Im,{className:`h-9 w-full`}),(0,Z.jsx)(Im,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}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=Bn(`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)(DE,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function _k(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)(jE,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function vk(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=Bn(`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)(FE,{"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 yk(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}=on(),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)(bh,{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)(Rl,{"aria-hidden":`true`}),t[28]=F):F=t[28];let I;t[29]!==o||t[30]!==p||t[31]!==P?(I=(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(Fi,{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)(cr,{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)(Ey,{"aria-hidden":`true`}),t[38]=B):B=t[38];let V;t[39]!==m||t[40]!==z||t[41]!==s?(V=(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(Fi,{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 H;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(cr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`_7UQ7y`})}),t[43]=H):H=t[43];let U;t[44]===V?U=t[45]:(U=(0,Z.jsxs)(ur,{children:[V,H]}),t[44]=V,t[45]=U);let W;t[46]!==R||t[47]!==U?(W=(0,Z.jsxs)(yh,{align:`inline-end`,className:`gap-0.5`,children:[R,U]}),t[46]=R,t[47]=U,t[48]=W):W=t[48];let ee;t[49]!==W||t[50]!==N?(ee=(0,Z.jsxs)(xh,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[N,W]}),t[49]=W,t[50]=N,t[51]=ee):ee=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 K;t[54]===b?K=t[55]:(K=b({id:`oqB2ez`}),t[54]=b,t[55]=K);let q=!S,te;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(Ul,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=te):te=t[56];let J;t[57]!==g||t[58]!==K||t[59]!==q?(J=(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":K,disabled:q,onClick:g,children:te})}),t[57]=g,t[58]=K,t[59]=q,t[60]=J):J=t[60];let ne;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(cr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`oqB2ez`})}),t[61]=ne):ne=t[61];let re;t[62]===J?re=t[63]:(re=(0,Z.jsxs)(ur,{children:[J,ne]}),t[62]=J,t[63]=re);let ie;t[64]===b?ie=t[65]:(ie=b({id:`SiUUCS`}),t[64]=b,t[65]=ie);let ae=!S,oe;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(Vl,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=oe):oe=t[66];let se;t[67]!==h||t[68]!==ie||t[69]!==ae?(se=(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ie,disabled:ae,onClick:h,children:oe})}),t[67]=h,t[68]=ie,t[69]=ae,t[70]=se):se=t[70];let ce;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,Z.jsx)(cr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`SiUUCS`})}),t[71]=ce):ce=t[71];let le;t[72]===se?le=t[73]:(le=(0,Z.jsxs)(ur,{children:[se,ce]}),t[72]=se,t[73]=le);let ue=a?`secondary`:`ghost`,de;t[74]!==b||t[75]!==a?(de=b(a?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=b,t[75]=a,t[76]=de):de=t[76];let fe=a?`ok-replace-input`:void 0,pe;t[77]!==f||t[78]!==a?(pe=()=>f(!a),t[77]=f,t[78]=a,t[79]=pe):pe=t[79];let me;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsx)(iy,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=me):me=t[80];let he;t[81]!==a||t[82]!==ue||t[83]!==de||t[84]!==fe||t[85]!==pe?(he=(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:ue,size:`icon-sm`,"aria-label":de,"aria-expanded":a,"aria-controls":fe,onClick:pe,children:me})}),t[81]=a,t[82]=ue,t[83]=de,t[84]=fe,t[85]=pe,t[86]=he):he=t[86];let ge;t[87]===a?ge=t[88]:(ge=(0,Z.jsx)(cr,{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)(zf,{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)(sr,{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)(iy,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(cr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`bS_boY`})})]}),(0,Z.jsxs)(ur,{children:[(0,Z.jsx)(sr,{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)(ry,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(cr,{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)(hf,{"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)(sr,{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)(cr,{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]!==ee||t[111]!==G||t[112]!==re||t[113]!==le||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,ee,G,re,le,_e,ve,Ce]}),t[110]=ee,t[111]=G,t[112]=re,t[113]=le,t[114]=k,t[115]=_e,t[116]=ve,t[117]=Ce,t[118]=we):we=t[118],we}var bk={current:0,total:0},xk=120,Sk=100;function Ck(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?Ee(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)($t,n,wk)}function wk(){return null}function Tk(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>xk||i.includes(`
7
7
  `)?null:i}function Ek(e){let t=je(e.state);return{current:t.matches.length===0?0:t.activeIndex+1,total:t.matches.length}}function Dk(e,t){return e.current===t.current&&e.total===t.total}function Ok(e,t,n){e&&!e.isDestroyed&&(e.commands.clearFindMatches(),e.commands.focus()),t(e=>({...e,open:!1,activeIndex:0})),n(bk)}function kk(e){!e||e.isDestroyed||typeof window>`u`||window.requestAnimationFrame(()=>{if(e.isDestroyed)return;let t=Lr(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 Ak(e){let t=(0,$.c)(81),{activeDocName:n,isSourceMode:r}=e,i=Ck(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)(bk),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{s.current!==n&&(s.current=n,d(Mk))},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(jk)},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(bk);return}if(!u.open||r){i.commands.clearFindMatches(),p(bk);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=Ek(i);p(t=>Dk(t,e)?t:e)},Sk);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 E,D;t[25]!==i||t[26]!==u.open||t[27]!==r?(E=()=>{if(!i||i.isDestroyed||!u.open||r)return;let e=()=>{let e=je(i.state),t=Ek(i);p(e=>Dk(e,t)?e:t),d(t=>t.activeIndex===e.activeIndex?t:{...t,activeIndex:e.activeIndex})};return i.on(`transaction`,e),()=>{i.off(`transaction`,e)}},D=[i,u.open,r],t[25]=i,t[26]=u.open,t[27]=r,t[28]=E,t[29]=D):(E=t[28],D=t[29]),(0,Q.useEffect)(E,D);let O,k;t[30]!==n||t[31]!==i||t[32]!==u.open||t[33]!==r?(O=()=>{let e=function(e){let t=Tk(i);d(n=>({...n,open:!0,replaceOpen:e,query:t??n.query,activeIndex:0}))},t=function(t){if(!(!n||r||t.defaultPrevented)&&!rr()){if(As(t,`find`)){t.preventDefault(),u.open?Ok(i,d,p):e(!1);return}if(As(t,`replace`)){t.preventDefault(),e(!0);return}if(u.open){let e=As(t,`find-next`),n=As(t,`find-previous`);if(e||n){t.preventDefault(),(n?i?.commands.selectPreviousFindMatch():i?.commands.selectNextFindMatch())&&kk(i);return}}t.key===`Escape`&&u.open&&(t.preventDefault(),Ok(i,d,p))}};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},k=[n,i,u.open,r],t[30]=n,t[31]=i,t[32]=u.open,t[33]=r,t[34]=O,t[35]=k):(O=t[34],k=t[35]),(0,Q.useEffect)(O,k);let A;t[36]!==i||t[37]!==u.caseSensitive||t[38]!==u.query||t[39]!==u.wholeWord?(A=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]=A):A=t[40];let j=A,M;t[41]===i?M=t[42]:(M=function(){if(!i||i.isDestroyed)return;let e=je(i.state),t=Ek(i);p(e=>Dk(e,t)?e:t),d(t=>t.activeIndex===e.activeIndex?t:{...t,activeIndex:e.activeIndex})},t[41]=i,t[42]=M);let N=M,P;t[43]===i?P=t[44]:(P=function(){Ok(i,d,p)},t[43]=i,t[44]=P);let F=P,I;t[45]!==j||t[46]!==i||t[47]!==N?(I=function(){!i||i.isDestroyed||(j(),i.commands.selectNextFindMatch()&&kk(i),N())},t[45]=j,t[46]=i,t[47]=N,t[48]=I):I=t[48];let L=I,R;t[49]!==j||t[50]!==i||t[51]!==N?(R=function(){!i||i.isDestroyed||(j(),i.commands.selectPreviousFindMatch()&&kk(i),N())},t[49]=j,t[50]=i,t[51]=N,t[52]=R):R=t[52];let z=R,B;t[53]!==j||t[54]!==i||t[55]!==u.replacement||t[56]!==N?(B=function(){!i||i.isDestroyed||(j(),i.commands.replaceCurrentFindMatch(u.replacement)&&kk(i),N())},t[53]=j,t[54]=i,t[55]=u.replacement,t[56]=N,t[57]=B):B=t[57];let V=B,H;t[58]!==j||t[59]!==i||t[60]!==u.replacement||t[61]!==N?(H=function(){!i||i.isDestroyed||(j(),i.commands.replaceAllFindMatches(u.replacement)&&kk(i),N())},t[58]=j,t[59]=i,t[60]=u.replacement,t[61]=N,t[62]=H):H=t[62];let U=H;if(!u.open||!n||r)return null;let W,ee,G,K,q;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(W=e=>d(t=>({...t,query:e,activeIndex:0})),ee=e=>d(t=>({...t,replacement:e})),G=e=>d(t=>({...t,replaceOpen:e})),K=e=>d(t=>({...t,caseSensitive:e})),q=e=>d(t=>({...t,wholeWord:e})),t[63]=W,t[64]=ee,t[65]=G,t[66]=K,t[67]=q):(W=t[63],ee=t[64],G=t[65],K=t[66],q=t[67]);let te;return t[68]!==F||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]!==V||t[78]!==L||t[79]!==z?(te=(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)(yk,{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:ee,onReplaceOpenChange:G,onCaseSensitiveChange:K,onWholeWordChange:q,onNext:L,onPrevious:z,onReplaceCurrent:V,onReplaceAll:U,onClose:F})})}),t[68]=F,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]=V,t[78]=L,t[79]=z,t[80]=te):te=t[80],te}function jk(e){return{...e,open:!1,activeIndex:0}}function Mk(e){return{...e,activeIndex:0}}var Nk=300;function Pk(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(gu),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(gu);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(vu(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,Nk)};return n.observe(s),()=>{r=!0,n.unobserve(s),a&&clearTimeout(a)}},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 Fk(e){return e&&e.document.getMap(`lifecycle`).get(`status`)===`conflict`?`conflict`:null}function Ik(e){let t=(0,$.c)(8),{poolEntries:n}=Oe(),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=()=>Fk(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(Fk(i));let t=()=>s(Fk(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 Lk(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=()=>yu(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2],(0,Q.useSyncExternalStore)(iu,r)}var Rk=`ok-terminal-width-v1`;function zk(e){return Number.isFinite(e)?e<320?320:Math.round(e):480}function Bk(e){try{let t=(e??localStorage).getItem(Rk);if(t==null)return 480;let n=Number.parseInt(t,10);return Number.isFinite(n)?zk(n):480}catch{return 480}}function Vk(e,t){try{(t??localStorage).setItem(Rk,String(zk(e)))}catch{}}function Hk(){try{return typeof localStorage>`u`?480:Bk()}catch{return 480}}var Uk=`ok-doc-panel-width-v1`;function Wk(e){return Number.isFinite(e)?e<300?300:e>600?600:Math.round(e):320}function Gk(e){try{let t=(e??localStorage).getItem(Uk);if(t==null)return 320;let n=Number.parseInt(t,10);return Number.isFinite(n)?Wk(n):320}catch{return 320}}function Kk(e,t){try{(t??localStorage).setItem(Uk,String(Wk(e)))}catch{}}function qk(){try{return typeof localStorage>`u`?320:Gk()}catch{return 320}}var Jk=1024,Yk=1280,Xk={left:Jk,right:Yk};function Zk(e,t,n){return e==null?t>=Xk[n]?`above`:`below`:`embedded`}function Qk(e){return e===`above`?`open`:`collapsed`}var $k=`ok-sidebar-pins-v2`;function eA(e){return e===`open`||e===`collapsed`}function tA(e){return e===`above`||e===`below`||e===`embedded`}function nA(e){if(typeof e!=`object`||!e)return!1;let t=e;for(let e of Object.keys(t))if(!tA(e)||!eA(t[e]))return!1;return!0}function rA(e){let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n=t,r={};return nA(n.left)&&(r.left=n.left),nA(n.right)&&(r.right=n.right),r}function iA(e){try{let t=(e??localStorage).getItem($k);return t==null?{}:rA(t)}catch{return{}}}function aA(e,t){try{t.setItem($k,JSON.stringify(e))}catch{}}function oA(e,t,n){return n[e]?.[t]??Qk(t)}function sA(e,t,n,r){let i=r??localStorage,a=iA(i);return a[e]={...a[e],[t]:n},aA(a,i),a}function cA(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`?lA: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 lA(e){return e===`synced`?`synced`:`connected`}var uA=`ok-onboarding-card-v1`,dA={initialized:!1,steps:{file:!1,askedAi:!1},fileBaseline:0,dismissed:!1,completed:!1};function fA(e){return e===!0}function pA(e){if(typeof e!=`object`||!e)return dA;let t=e,n=typeof t.steps==`object`&&t.steps!==null?t.steps:{};return{initialized:fA(t.initialized),steps:{file:fA(n.file),askedAi:fA(n.askedAi)},fileBaseline:typeof t.fileBaseline==`number`&&Number.isFinite(t.fileBaseline)&&t.fileBaseline>=0?t.fileBaseline:0,dismissed:fA(t.dismissed),completed:fA(t.completed)}}function mA(e){try{let t=(e??localStorage).getItem(uA);return t==null?dA:pA(JSON.parse(t))}catch(e){return console.warn(`[onboarding-card-store] readPersistedState failed (corrupt/privacy/SSR)`,e),dA}}function hA(e,t){try{(t??localStorage).setItem(uA,JSON.stringify(e))}catch(e){console.warn(`[onboarding-card-store] writePersistedState failed (quota/privacy/SSR)`,e)}}function gA(e){let t=mA(e),n=new Set,r=!1;function i(){for(let e of n)e()}function a(n){t=n,hA(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=mA(e),i())}}}var _A=gA();function vA(e){let t=e===void 0?_A:e;return(0,Q.useSyncExternalStore)(t.subscribe,t.getSnapshot,t.getSnapshot)}function yA(){_A.install()}function bA(e){return Uf(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}async function xA(){let e=await fetch(`/api/documents`);if(!e.ok)throw Error(`documents request failed: ${e.status}`);let t=await e.json(),n=Oa.safeParse(t);if(!n.success)throw Error(`documents response did not match schema`,{cause:n.error});return bA(n.data.documents)}async function SA(e=_A){let t=e.getSnapshot();if(!(t.steps.file||!t.initialized))try{await xA()>t.fileBaseline&&e.markStepComplete(`file`)}catch(e){console.warn(`[onboarding-signals] file-step count read failed; leaving step incomplete`,e)}}function CA(e=_A){e.getSnapshot().initialized&&e.markStepComplete(`askedAi`)}var wA=`open-knowledge:open-ask-ai-composer`;function TA(e=typeof window>`u`?new EventTarget:window){e.dispatchEvent(new CustomEvent(wA))}function EA(e,t=typeof window>`u`?new EventTarget:window){let n=()=>e();return t.addEventListener(wA,n),()=>t.removeEventListener(wA,n)}var DA=5200,OA=500,kA=/\.(md|mdx)$/i;function AA(e,t){return kA.test(e)?e:t?`${e}${t}`:Xc(e)}function jA(e){return kA.test(e)?e.replace(kA,``):null}function MA(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function NA(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),DA);return()=>clearTimeout(e)}let e=setTimeout(()=>{i(PA),o(!0)},OA);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 PA(e){return e+1}function FA(e){let t=(0,$.c)(2),{agentName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(Y,{id:`5PrrYw`,values:{agentName:n}}),t[0]=n,t[1]=r),r}function IA(e){let t=(0,$.c)(102),{docName:n,surface:r,folderPath:i,dismissed:a,onDismiss:o,onReopen:s}=e,c=a===void 0?!1:a,{_:l}=on(),u=i!==void 0,d=u?null:n??null,f=r??`wysiwyg`,p=lf(),m=Zc(),{pageMeta:h}=Eu(),{states:g}=qn(),_=Hi(),{dispatch:v}=Tc(),y=Xn(),[b]=(0,Q.useState)(XA),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(!0),[T,E]=(0,Q.useState)(!1),D=(0,Q.useRef)(null),O=(0,Q.useRef)(null),[k]=(0,Q.useState)(YA),A,j;t[0]!==c||t[1]!==n||t[2]!==u||t[3]!==r?(A=()=>{if(u||n==null)return;let e=document.documentElement,t=()=>{if(ce(n))return;let e=[...document.querySelectorAll(`.editor-doc-scroll`)].filter(JA);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(ce(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(ce(n))return;let e=Ee(n),t=O.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=O.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`)}},j=[c,r,n,u],t[0]=c,t[1]=n,t[2]=u,t[3]=r,t[4]=A,t[5]=j):(A=t[4],j=t[5]),(0,Q.useEffect)(A,j);let M=(0,Q.useRef)(c),N=(0,Q.useRef)(s),P;t[6]!==c||t[7]!==s?(P=()=>{M.current=c,N.current=s},t[6]=c,t[7]=s,t[8]=P):P=t[8],(0,Q.useEffect)(P);let F,I;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>EA(()=>{M.current?N.current?.():D.current?.focus()}),I=[],t[9]=F,t[10]=I):(F=t[9],I=t[10]),(0,Q.useEffect)(F,I);let L;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(L=[],t[11]=L):L=t[11],(0,Q.useEffect)(KA,L);let R=(0,Q.useRef)(c),z,B;t[12]===c?(z=t[13],B=t[14]):(z=()=>{let e=R.current;R.current=c,e&&!c&&D.current?.focus()},B=[c],t[12]=c,t[13]=z,t[14]=B),(0,Q.useEffect)(z,B);let V;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(V=[],t[15]=V):V=t[15];let[H,U]=(0,Q.useState)(V),[W,ee]=(0,Q.useState)(GA),G=Dd(),K=Nd(),[q,te]=(0,Q.useState)(!1),[J,ne]=(0,Q.useState)(!1),re=G.length,ie=K>0&&J,ae;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(ae=[],t[16]=ae):ae=t[16];let[oe,se]=(0,Q.useState)(ae),le;t[17]!==n||t[18]!==u||t[19]!==h?(le=u||n==null?``:AA(n,h.get(n)?.docExt),t[17]=n,t[18]=u,t[19]=h,t[20]=le):le=t[20];let ue=le,de,fe;t[21]!==ue||t[22]!==W||t[23]!==u||t[24]!==C?(de=()=>{u||C||U(e=>{if(W.has(ue))return e;let t=jA(ue),n=t===null?e:e.filter(e=>e===ue||jA(e)!==t);return n.includes(ue)?n.length===e.length?e:n:[...n,ue]})},fe=[u,C,ue,W],t[21]=ue,t[22]=W,t[23]=u,t[24]=C,t[25]=de,t[26]=fe):(de=t[25],fe=t[26]),(0,Q.useEffect)(de,fe);let pe=u?i&&!W.has(i)&&!oe.includes(i)?[i]:[]:H.filter(e=>!W.has(e)&&!oe.includes(e)),me=Sl(d,f),he=Sl(d,`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=()=>en(()=>{_e(null),ye(!1)}),Te=[],t[33]=we,t[34]=Te):(we=t[33],Te=t[34]),(0,Q.useEffect)(we,Te);let De=Yi(),Oe=Li(),ke;t[35]===_?ke=t[36]:(ke=e=>Ki(_,e.source,e.id,!0,e.supported),t[35]=_,t[36]=ke);let Ae=Oe.filter(ke),je=Ri(Ae,De),Me;t[37]===y?.installedClis?Me=t[38]:(Me=y?.installedClis??{},t[37]=y?.installedClis,t[38]=Me);let Ne=Qs({sticky:x??b,effectiveThreadAgent:je,enabledClis:y===null?[]:_c(_,y.installedClis),enabledDesktopTargets:tc(_),installedClis:Me,terminalAvailable:y!==null,threadsAvailable:!0,desktopSelectable:!0}),Pe=Ne.kind===`thread`,Fe=Ne.kind===`cli`?Ne.cli:null,Ie=Fe!==null,Le=Ne.kind===`desktop`?Wi.find(e=>e.id===Ne.target)??null:null,Re=!T&&(!C||ge!==null||ie)&&(Ie||Le!==null||Pe),ze;t[39]===_?ze=t[40]:(ze=Wi.filter(e=>zi(_,e.id)),t[39]=_,t[40]=ze);let Be=ze,Ve;t[41]===g?Ve=t[42]:(Ve=Wi.some(e=>g[e.id]?.installed==null),t[41]=g,t[42]=Ve);let Ue=Ve,We=y===null?void 0:_c(_,y.installedClis).map(e=>{let{displayName:t}=va[e];return{cli:e,label:t,ariaLabel:l({id:`QYfQdv`,values:{displayName:t}}),selected:Fe===e,onSelect:()=>Ye(e)}}),Ge;t[43]!==l||t[44]!==ie?(Ge=ie?[l({id:`NeQ_0G`})]:[l({id:`KYSocE`}),l({id:`7Ongq0`}),l({id:`HPTPGr`}),l({id:`qiRoLb`})],t[43]=l,t[44]=ie,t[45]=Ge):Ge=t[45];let Ke=NA(Ge,!p&&C&&!c&&!ie),qe;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(qe=e=>{S(e.id),Xs(e.id)},t[46]=qe):qe=t[46];let Je=qe,Ye=e=>{let t=sc(e);S(t),Xs(t)},Xe;if(t[47]===Symbol.for(`react.memo_cache_sentinel`)){let e=()=>{S($s),Xs($s)};Xe=t=>{Xi(t),e()},t[47]=Xe}else Xe=t[47];let Ze=Xe,Qe=()=>{D.current?.clear(),_e(null),ye(!1),U([]),ee(new Set),ne(!1),te(!1),af()},$e=async(e,t)=>{let n=t===void 0?!0:t,r=()=>{n&&Qe()};if(e===null)return Ns.error(l({id:`y8B54M`})),!1;if(Pe)return Dc(e,je===null?void 0:{agent:{source:je.source,id:je.id}}),CA(),r(),!0;if(Fe!==null&&y!==null){try{y.launchInTerminal(e,Fe)}catch{return Ns.error(l({id:`jBVUXo`})),!1}return CA(),r(),!0}if(Le===null)return Ns.error(l({id:`teFjfG`})),!1;if(g[Le.id]?.installed!==!0)return Kc(Le),Ns.info(l({id:`L1BQTH`,values:{0:Le.displayName}})),r(),!1;E(!0);let i=await v(Le.id,e).finally(()=>{E(!1),r()});return i.ok&&CA(),i.ok},et=()=>{let{instruction:e,mentions:t}=D.current?.getContent()??{instruction:``,mentions:[]};if(u)return Oc({docName:null,folderRelativePath:i,workspace:m,instruction:e,mentions:[...new Set([...pe,...t])].filter(e=>e!==i)});let r=ge?vm(ge):void 0,a=ge?.docName??null,o=ge?a:pe.includes(ue)?n??null:null,s=o===null?null:AA(o,h.get(o)?.docExt),c=[...new Set([...pe,...t])].filter(e=>e!==s);return Oc({docName:o,...s===null?{}:{docRelativePath:s},workspace:m,instruction:e,mentions:c,selection:r})},tt=()=>{if(Re){if(ie){nt().catch(WA);return}$e(et())}},nt=async()=>{let{instruction:e,mentions:t}=D.current?.getContent()??{instruction:``,mentions:[]};(await He({compose:async n=>{let r=Oc({docName:null,workspace:m,instruction:Rd(n.map(UA),e,ge?{docName:ge.docName,markdown:ge.markdown}:void 0),mentions:[...new Set([...n.map(HA),...pe,...t])]});return r===null?(Ns.error(l({id:`253MN6`})),!1):$e(r,!1)}})).length>0&&Qe()};if(c)return null;let rt=``,it=``;if(ge){let e;t[48]!==h||t[49]!==ge?(e=ym(ge,AA(ge.docName,h.get(ge.docName)?.docExt).split(`/`).pop()??``),t[48]=h,t[49]=ge,t[50]=e):e=t[50],rt=e;let n;t[51]===ge.markdown?n=t[52]:(n=xm(ge.markdown),t[51]=ge.markdown,t[52]=n),it=n}let at;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(at=e=>sf(e,D),t[53]=at):at=t[53];let ot;t[54]!==l||t[55]!==u||t[56]!==o?(ot=u?null:(0,Z.jsx)(X,{type:`button`,variant:`outline`,"aria-label":l({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)(Vl,{className:`size-3.5`,"aria-hidden":!0})}),t[54]=l,t[55]=u,t[56]=o,t[57]=ot):ot=t[57];let st;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(st=e=>ee(t=>{let n=new Set(t);return n.add(e),n}),t[58]=st):st=t[58];let ct;t[59]!==l||t[60]!==rt||t[61]!==it||t[62]!==ge||t[63]!==ve?(ct=ge?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-testid":`composer-selection-pill`,title:rt,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":l({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)(yy,{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)(hf,{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":l(ve?{id:`UaDyeb`}:{id:`eTL5y9`}),onClick:()=>ye(VA),"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:rt})})]}),ve&&it!==``?(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:it}):null]}):null,t[59]=l,t[60]=rt,t[61]=it,t[62]=ge,t[63]=ve,t[64]=ct):ct=t[64];let lt;t[65]!==q||t[66]!==ie||t[67]!==re||t[68]!==G||t[69]!==K?(lt=re>0&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Bd,{count:ie?K:re,attached:ie,expanded:q,onAttach:()=>{ne(!0),gt()},onToggleExpanded:()=>te(BA),onDismiss:()=>{ne(!1),te(!1)}}),ie&&q&&(0,Z.jsx)(Fd,{threads:G})]}),t[65]=q,t[66]=ie,t[67]=re,t[68]=G,t[69]=K,t[70]=lt):lt=t[70];let ut;t[71]===l?ut=t[72]:(ut=l({id:`xWEvuo`}),t[71]=l,t[72]=ut);let dt;t[73]!==C||t[74]!==p||t[75]!==Ke?(dt=C?(0,Z.jsx)(`div`,{"aria-hidden":!0,className:Bn(`pointer-events-none absolute inset-0 truncate px-0 py-1 text-base text-muted-foreground/60 md:text-sm`,!p&&`transition-opacity duration-500 ease-in-out`,Ke.visible?`opacity-100`:`opacity-0`),children:Ke.text}):null,t[73]=C,t[74]=p,t[75]=Ke,t[76]=dt):dt=t[76];let ft=hC,pt=Pe?(0,Z.jsx)(pl,{agentId:je?.id??``,iconUrl:je?.iconUrl,className:`size-4`}):Fe===null?Le?(0,Z.jsx)(qi,{id:Le.id,className:`size-4`,"aria-hidden":!0}):null:(0,Z.jsx)(qi,{id:Gi(Fe),className:`size-4`,"aria-hidden":!0}),mt=Pe?je===null?(0,Z.jsx)(Y,{id:`G7bn_N`}):(0,Z.jsx)(FA,{agentName:je.name}):Fe===null?Le?(0,Z.jsx)(Y,{id:`nUNZL4`,values:{0:Le.displayName}}):(0,Z.jsx)(Y,{id:`F-vBv0`}):(0,Z.jsx)(Y,{id:`ti6aF_`,values:{0:va[Fe].displayName}}),ht;t[77]===mt?ht=t[78]:(ht=(0,Z.jsx)(`span`,{children:mt}),t[77]=mt,t[78]=ht);let _t;t[79]===T?_t=t[80]:(_t=T?(0,Z.jsx)(xd,{className:`size-3.5`,"aria-hidden":!0}):null,t[79]=T,t[80]=_t);let vt;t[81]!==pt||t[82]!==ht||t[83]!==_t?(vt=(0,Z.jsxs)(Z.Fragment,{children:[pt,ht,_t]}),t[81]=pt,t[82]=ht,t[83]=_t,t[84]=vt):vt=t[84];let yt=!Re,bt=Ie?null:Le?.id??null,xt=Ae.map(e=>({key:`${e.source}:${e.id}`,id:e.id,name:e.name,...e.iconUrl===void 0?{}:{iconUrl:e.iconUrl},selected:Pe&&je!==null&&je.source===e.source&&je.id===e.id,onSelect:()=>Ze(e)})),St;t[85]===Ue?St=t[86]:(St=(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:Ue?(0,Z.jsx)(Y,{id:`CPmYSG`}):(0,Z.jsx)(Y,{id:`t9Qn8y`})}),t[85]=Ue,t[86]=St);let Ct;t[87]===l?Ct=t[88]:(Ct=l({id:`nskygk`}),t[87]=l,t[88]=Ct);let wt;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(wt={primary:`ask-ai-send`,trigger:`ask-ai-agent-trigger`,menu:`ask-ai-agent-menu`,option:zA,threadAgent:RA,settings:`ask-ai-agent-option-settings`,terminal:LA},t[89]=wt):wt=t[89];let Tt;t[90]!==ft||t[91]!==We||t[92]!==Be||t[93]!==Je||t[94]!==tt||t[95]!==vt||t[96]!==yt||t[97]!==bt||t[98]!==xt||t[99]!==St||t[100]!==Ct?(Tt=(0,Z.jsx)(ft,{primary:vt,onPrimary:tt,primaryDisabled:yt,installedTargets:Be,selectedTargetId:bt,onSelectTarget:Je,threadAgents:xt,onOpenSettings:Cs,terminals:We,menuEmptyState:St,triggerAriaLabel:Ct,testIds:wt}),t[90]=ft,t[91]=We,t[92]=Be,t[93]=Je,t[94]=tt,t[95]=vt,t[96]=yt,t[97]=bt,t[98]=xt,t[99]=St,t[100]=Ct,t[101]=Tt):Tt=t[101];let Et=(0,Z.jsxs)(`div`,{ref:O,onMouseDown:at,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:[ot,(0,Z.jsxs)(tf,{files:pe,onRemoveFile:st,children:[ct,lt]}),(0,Z.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[(0,Z.jsx)(nf,{ref:D,ariaLabel:ut,onEmptyChange:w,onContentChange:$d,onMentionsChange:se,onSubmit:tt,initialDoc:k,className:`max-h-[200px] overflow-y-auto text-base md:text-sm`}),dt]}),Tt]})]});return u?(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:Et})}):(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:Et})}function LA(e){return e===`claude`?`ask-ai-agent-option-terminal`:`ask-ai-agent-option-terminal-${e}`}function RA(e){return`ask-ai-agent-option-thread-${e}`}function zA(e){return`ask-ai-agent-option-${e}`}function BA(e){return!e}function VA(e){return!e}function HA(e){return Xc(e.payload.docName)}function UA(e){return zd(e.payload)}function WA(e){console.warn(`[comments] queued-comment send rejected unexpectedly`,e)}function GA(){return new Set}function KA(){let e=qA;return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})}function qA(e){As(e,`open-ask-ai`)&&(rr()||MA(e.target)||(e.preventDefault(),TA()))}function JA(e){let t=e.scrollHeight-e.clientHeight;return t>0&&e.scrollTop>=t-40}function YA(){return rf().doc??void 0}function XA(){return Gs()}function ZA(e){return!e.terminalVisible&&!e.agentsVisible&&!e.isEmbedded&&e.activeDocName!==null}function QA(e){return!e.terminalVisible&&!e.agentsVisible&&!e.isEmbedded}function $A(e,t={}){let n=A(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var ej=200,tj=`Outside any block`;function nj(e){let t=(0,$.c)(5),{editor:n}=e,r=h(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?rj(n,r):o.current?tj:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},ej),()=>{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 rj(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=$A(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=$A(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 ij=new ps(`okCommentAnchors`);function aj(e,t){e.isDestroyed||e.view.dispatch(e.state.tr.setMeta(ij,{draft:t}))}function oj(e){At(e)}function sj(e,t,n){let r=[],i=pt(e).filter(e=>e.status===`open`&&e.target.kind===`body`&&e.anchor!==null);if(i.length>0){let e=Pd(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 cj(e,t,n){let r=sj(e,t,n);if(r.length===0)return Mo.empty;let i=Wd(r,Ae()).map(e=>Ho.inline(e.from,e.to,e.threadId===null?{style:e.style}:{style:e.style,"data-comment-thread":e.threadId}));return Mo.create(t,i)}function lj(e,t){return typeof t==`object`&&t&&`draft`in t?`draft`:e.docChanged?`rebuild`:t===void 0?`reuse`:`rebuild`}function uj(e){return new is({key:ij,state:{init:(t,n)=>({draft:null,decorations:cj(e,n.doc,null)}),apply(t,n,r,i){let a=t.getMeta(ij);switch(lj(t,a)){case`reuse`:return n;case`draft`:{let t=a.draft;return{draft:t,decorations:cj(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:cj(e,i.doc,r)}}}}},props:{decorations(e){return ij.getState(e)?.decorations},handleClick(t,n){let r=null;for(let i of sj(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?!1:(oj(r.id),!0)}}})}function dj(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(uj(r)),Bt(r).then(()=>{e||n.isDestroyed||n.view.dispatch(n.state.tr.setMeta(ij,{refresh:!0}))}).catch(fj))});let t=()=>{if(e||n.isDestroyed)return;let t=n.editorView;t&&t.dispatch(t.state.tr.setMeta(ij,{refresh:!0}))},i=De(t),a=Wt(t);return()=>{e=!0,i(),a(),n.isDestroyed||n.unregisterPlugin(ij)}},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 fj(){}var pj=34,mj=30,hj=4;function gj(e,t){return{top:e.top+t,height:Math.max(0,e.height-t)}}function _j(e,t,n){let r=[...e].sort((e,t)=>e.y-t.y),i=t+n-mj,a=[],o=t-hj;for(let e of r){let r=e.y<t||e.y>t+n,s=e.y-mj/2,c=Math.min(i,Math.max(s,o+hj,t));a.push({id:e.id,top:c,offscreen:r}),o=c+mj}return a}function vj(e){let t=(0,$.c)(31),{editor:n,docName:r}=e,{_:i}=on(),a=g(r),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],t[0]=u):u=t[0];let[d,f]=(0,Q.useState)(u),p,m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>Xt(e=>s(e)),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]!==a?(h=()=>{let e=Lr(n);if(!e)return;let t=Vd(e.dom);if(!t)return;let r=a.filter(yj),i=()=>{let i=t.getBoundingClientRect(),a=[];if(r.length>0){let t=Pd(n.state.doc);for(let n of r){let r;if(n.target.kind===`property`){let e=Ad(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=gj(i,kd(t));l({top:o.top,height:o.height,left:i.right-pj}),f(_j(a,o.top,o.height))};i();let o=0,s=()=>{o===0&&(o=requestAnimationFrame(()=>{o=0,i()}))};window.addEventListener(`resize`,s),t.addEventListener(`scroll`,s,{passive:!0});let c=new ResizeObserver(s);return c.observe(t),n.on(`update`,s),()=>{o!==0&&cancelAnimationFrame(o),window.removeEventListener(`resize`,s),t.removeEventListener(`scroll`,s),c.disconnect(),n.off(`update`,s)}},_=[n,a],t[3]=n,t[4]=a,t[5]=h,t[6]=_):(h=t[5],_=t[6]),(0,Q.useEffect)(h,_);let v;t[7]!==o||t[8]!==n||t[9]!==a?(v=function(e){if(o===e){At(null);return}let t=a.find(t=>t.id===e);if(t?.target.kind===`property`)t.anchor!==null&&wd({key:t.target.key,path:t.target.path,quote:t.anchor.quote,start:t.anchor.start,end:t.anchor.end})||Hd(t.target.key);else if(t&&t.anchor!==null){let e=jd(n.state.doc,t.anchor.quote,t.anchor);e&&Od(n,e)}At(e)},t[7]=o,t[8]=n,t[9]=a,t[10]=v):v=t[10];let y=v;if(c===null||d.length===0)return null;let b;t[11]!==c.height||t[12]!==c.left||t[13]!==c.top?(b={top:c.top,height:c.height,left:c.left,width:pj},t[11]=c.height,t[12]=c.left,t[13]=c.top,t[14]=b):b=t[14];let x;if(t[15]!==i||t[16]!==o||t[17]!==y||t[18]!==d||t[19]!==c.top||t[20]!==a){let e;t[22]!==i||t[23]!==o||t[24]!==y||t[25]!==c.top||t[26]!==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`}),"aria-expanded":n,className:Bn(`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-amber-500 bg-amber-50`),style:{top:e.top-c.top},"data-comment-thread":t.id,onClick:()=>y(t.id),onPointerEnter:()=>$e(t.id),onPointerLeave:()=>ve(t.id),children:(0,Z.jsx)(Ud,{className:`size-3.5 text-amber-500`})},e.id)},t[22]=i,t[23]=o,t[24]=y,t[25]=c.top,t[26]=a,t[27]=e):e=t[27],x=d.map(e),t[15]=i,t[16]=o,t[17]=y,t[18]=d,t[19]=c.top,t[20]=a,t[21]=x}else x=t[21];let S;return t[28]!==b||t[29]!==x?(S=(0,Pg.createPortal)((0,Z.jsx)(`div`,{className:`pointer-events-none fixed z-30`,style:b,children:x}),document.body),t[28]=b,t[29]=x,t[30]=S):S=t[30],S}function yj(e){return e.status===`open`&&(e.target.kind===`property`||e.anchor!==null)}function bj(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 xj(e){let t=(0,$.c)(53),{editor:n,docName:r,shortcutEnabled:i}=e,{_:a}=on(),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(!0),u=(0,Q.useRef)(null),d=(0,Q.useRef)(null),f,p;t[0]!==n||t[1]!==i?(f=()=>{if(!i)return;let e=e=>{if(!As(e,`add-comment`))return;let t=e.target;t instanceof HTMLElement&&/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName)||n.state.selection.empty||(e.preventDefault(),rt())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},p=[i,n],t[0]=n,t[1]=i,t[2]=f,t[3]=p):(f=t[2],p=t[3]),(0,Q.useEffect)(f,p);let m,h;t[4]===n?(m=t[5],h=t[6]):(m=()=>se(()=>{let{selection:e}=n.state;if(e.empty)return;let{from:t,to:r}=bj(e);if(r-t<1)return;let i=ua(n.state.doc,t,r).trim();if(i.length===0)return;let{prefix:a,suffix:o}=Ld(n.state.doc,t,r);s({from:t,to:r,quote:i,prefix:a,suffix:o}),aj(n,{from:t,to:r})}),h=[n],t[4]=n,t[5]=m,t[6]=h),(0,Q.useEffect)(m,h);let g,_;t[7]!==o||t[8]!==n?(g=()=>{if(o===null)return;let e=d.current;if(!e)return;let t=Lr(n);if(!t)return;let r={getBoundingClientRect:()=>{try{return Oo(t,o.from,o.to)}catch{return new DOMRect}},contextElement:t.dom};return Yr(r,e,()=>{Gr(r,e,{placement:`bottom-start`,strategy:`fixed`,middleware:[Kr(8),Ur(),Qr({padding:8})]}).then(t=>{let{x:n,y:r}=t;e.style.position=`fixed`,e.style.left=`${n}px`,e.style.top=`${r}px`})})},_=[o,n],t[7]=o,t[8]=n,t[9]=g,t[10]=_):(g=t[9],_=t[10]),(0,Q.useEffect)(g,_);let v,y;t[11]===o?(v=t[12],y=t[13]):(v=()=>{o!==null&&u.current?.focus()},y=[o],t[11]=o,t[12]=v,t[13]=y),(0,Q.useEffect)(v,y);let b;t[14]===n?b=t[15]:(b=function(){u.current?.clear(),l(!0),s(null),aj(n,null)},t[14]=n,t[15]=b);let x=b,S;t[16]!==o||t[17]!==x?(S=()=>{if(o===null)return;let e=e=>{let t=d.current;if(t===null)return;let n=e.target;n instanceof Node&&(t.contains(n)||n instanceof Element&&n.closest(`[data-suggestion-popup]`)!==null||x())};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},t[16]=o,t[17]=x,t[18]=S):S=t[18],(0,Q.useEffect)(S);let C;t[19]!==o||t[20]!==r||t[21]!==n||t[22]!==x?(C=function(){if(o===null)return;let e=u.current?.getContent().instruction.trim()??``;e.length!==0&&(J({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)),x())},t[19]=o,t[20]=r,t[21]=n,t[22]=x,t[23]=C):C=t[23];let w=C;if(o===null)return null;let T;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(T={position:`fixed`,top:0,left:0},t[24]=T):T=t[24];let E;t[25]===a?E=t[26]:(E=a({id:`4eO-iB`}),t[25]=a,t[26]=E);let D;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(hf,{className:`size-3.5`}),t[27]=D):D=t[27];let O;t[28]!==x||t[29]!==E?(O=(0,Z.jsx)(`div`,{className:`-mt-1 -mr-1 -mb-1 flex justify-end`,children:(0,Z.jsx)(X,{type:`button`,size:`sm`,variant:`ghost`,"aria-label":E,onClick:x,className:`size-6 shrink-0 p-0 text-muted-foreground hover:text-foreground`,children:D})}),t[28]=x,t[29]=E,t[30]=O):O=t[30];let k;t[31]===a?k=t[32]:(k=a({id:`vYOUOk`}),t[31]=a,t[32]=k);let A;t[33]===a?A=t[34]:(A=a({id:`vYOUOk`}),t[33]=a,t[34]=A);let j;t[35]!==w||t[36]!==x||t[37]!==k||t[38]!==A?(j=(0,Z.jsx)(nf,{ref:u,ariaLabel:k,placeholder:A,onEmptyChange:l,onSubmit:w,onEscape:x,className:`max-h-40 min-h-16 overflow-y-auto rounded-md border px-2 py-1 text-sm`}),t[35]=w,t[36]=x,t[37]=k,t[38]=A,t[39]=j):j=t[39];let M;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsxs)(X,{size:`sm`,variant:`ghost`,onClick:Sj,className:`gap-1 px-2 text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(Ud,{className:`size-3.5`,"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`NiGIcB`})]}),t[40]=M):M=t[40];let N;t[41]===a?N=t[42]:(N=a({id:`ffH3Rt`}),t[41]=a,t[42]=N);let P,F;t[43]===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[43]=P,t[44]=F):(P=t[43],F=t[44]);let I;t[45]!==c||t[46]!==w||t[47]!==N?(I=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-1.5`,children:[M,(0,Z.jsxs)(X,{size:`sm`,onClick:w,disabled:c,"aria-label":N,children:[P,F]})]}),t[45]=c,t[46]=w,t[47]=N,t[48]=I):I=t[48];let L;return t[49]!==O||t[50]!==j||t[51]!==I?(L=(0,Pg.createPortal)((0,Z.jsxs)(`div`,{ref:d,className:`z-[60] flex w-80 flex-col gap-2 rounded-lg border bg-popover p-3 shadow-lg`,style:T,"data-testid":`comment-composer`,children:[O,j,I]}),document.body),t[49]=O,t[50]=j,t[51]=I,t[52]=L):L=t[52],L}function Sj(){return L(`comments`)}function Cj(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(Pn,{fallbackRender:wj,children:n}),t[0]=n,t[1]=r),r}function wj(){return null}function Tj(e){let t=(0,$.c)(24),{editor:n,docName:r}=e,[i,a]=(0,Q.useState)(null),[o]=(0,Q.useState)(kj),s=(0,Q.useRef)(null),c=g(r),l;t[0]!==i||t[1]!==c?(l=i?c.find(e=>e.id===i)??null:null,t[0]=i,t[1]=c,t[2]=l):l=t[2];let u=l,d=W(),f,p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>Xt(e=>a(e)),p=[],t[3]=f,t[4]=p):(f=t[3],p=t[4]),(0,Q.useEffect)(f,p);let m,h;t[5]!==u||t[6]!==i?(m=()=>{i!==null&&(u===null||u.status!==`open`)&&At(null)},h=[i,u],t[5]=u,t[6]=i,t[7]=m,t[8]=h):(m=t[7],h=t[8]),(0,Q.useEffect)(m,h);let _,v;t[9]!==n||t[10]!==u?(_=()=>{if(u===null)return;let e=s.current;if(!e)return;let t=Lr(n);if(!t)return;let r=u.target.kind===`property`?u.target.key:null,i=r===null&&u.anchor!==null?jd(n.state.doc,u.anchor.quote,u.anchor):null;if(r===null&&i===null)return;let a={getBoundingClientRect:()=>{if(r!==null)return Ad(r)??new DOMRect;if(i===null)return new DOMRect;try{return Oo(t,i.from,i.to)}catch{return new DOMRect}},contextElement:t.dom};return Yr(a,e,()=>{Gr(a,e,{placement:`bottom-start`,strategy:`fixed`,middleware:[Kr(8),Ur(),Qr({padding:8})]}).then(t=>{let{x:n,y:r}=t;e.style.position=`fixed`,e.style.left=`${n}px`,e.style.top=`${r}px`})})},v=[u,n],t[9]=n,t[10]=u,t[11]=_,t[12]=v):(_=t[11],v=t[12]),(0,Q.useEffect)(_,v);let y,b;if(t[13]===u?(y=t[14],b=t[15]):(y=()=>{if(u===null)return;let e=e=>{let t=e.target;s.current?.contains(t)||t?.closest(`[data-comment-thread]`)||At(null)},t=Oj;return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},b=[u],t[13]=u,t[14]=y,t[15]=b),(0,Q.useEffect)(y,b),u===null)return null;let x;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(x={position:`fixed`,top:0,left:0},t[16]=x):x=t[16];let S;t[17]!==d||t[18]!==u.id?(S=d.includes(u.id),t[17]=d,t[18]=u.id,t[19]=S):S=t[19];let C;return t[20]!==o||t[21]!==S||t[22]!==u?(C=(0,Pg.createPortal)((0,Z.jsx)(`div`,{ref:s,className:`z-50 w-80 rounded-lg bg-popover shadow-lg`,style:x,children:(0,Z.jsx)(SC,{thread:u,now:o,focused:!1,sending:S,cardRef:Dj,onClose:Ej})}),document.body),t[20]=o,t[21]=S,t[22]=u,t[23]=C):C=t[23],C}function Ej(){return At(null)}function Dj(){}function Oj(e){e.key===`Escape`&&At(null)}function kj(){return Date.now()}var Aj=!1;function jj(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{yp(n,{durationMs:Math.round(e*1e3)/1e3,threw:!o,...i},{startTime:t,duration:e})}catch{}}}}function Mj(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 Nj=0,Pj=0,Fj=0,Ij=0,Lj=null,Rj=[`linkResolutionDecoration$`],zj=new WeakSet,Bj=new WeakSet;function Vj(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}function Hj(){return!1}function Uj(){return!Hj()}function Wj(e,t){if(Uj())return t;let n=`ok/cold/nodeview-factory-${Vj(e)}`;return function(...r){let i=performance.now();try{return t(...r)}finally{let t=performance.now()-i;yp(n,{nodeType:e,durationMs:Math.round(t*1e3)/1e3},{startTime:i,duration:t})}}}function Gj(e){if(Uj())return;let t=e.state.plugins;for(let e of t){if(Bj.has(e))continue;let t=e.spec?.key?.key;if(!t||!Rj.some(e=>t.startsWith(e)))continue;let n=e.props,r=n.decorations;if(typeof r!=`function`){Bj.add(e);continue}let i=`ok/cold/decoration-${Vj(t.replace(/\$\d*$/,``))}`;n.decorations=function(...e){let n=performance.now();try{return r.apply(this,e)}finally{let e=performance.now()-n;yp(i,{pluginKey:t,durationMs:Math.round(e*1e3)/1e3},{startTime:n,duration:e})}},Bj.add(e)}}function Kj(e){if(Uj())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=Wj(e,n);r.__okWrapped=!0,t[e]=r}}function qj(e){return Uj()?e:e.map(e=>{let t=e.name??`unknown`,n=Vj(t);return e.extend({onBeforeCreate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;yp(`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;yp(`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;yp(`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;yp(`ok/cold/ext-${n}-on-destroy`,{ext:t,hook:`onDestroy`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}}})})}function Jj(){if(!Aj){Aj=!0,jj(Ja.prototype,`mount`,`ok/cold/editor-mount`,(e,t,n,r)=>{let i=e;return Uj()||(Lj=performance.now()),{elementDefault:i.options?.element?.nodeName??null,docSize:Mj(i.editorState),durationMs:r}}),jj(Ja.prototype,`createView`,`ok/cold/editor-create-view`,e=>{let t=e;return!Uj()&&!zj.has(e)&&t.view&&(Gj(t.view),Kj(t.view),zj.add(e)),{docSize:Mj(t.editorState)}}),jj(Ja.prototype,`createNodeViews`,`ok/cold/create-node-views`,(e,t,n,r)=>{Ij+=1;let i=e;return!Uj()&&i.view&&Kj(i.view),{docSize:Mj(i.view),seq:Ij,durationMs:r}}),jj(_o.prototype,`updateState`,`ok/cold/pm-update-state`,(e,t,n,r)=>(Pj+=1,{seq:Pj,docSize:Mj(e.state),durationMs:r})),jj(_o.prototype,`setProps`,`ok/cold/pm-set-props`,(e,t,n,r)=>(Fj+=1,{seq:Fj,docSize:Mj(e.state),durationMs:r})),jj(j.prototype,`_forceRerender`,`ok/cold/force-rerender`,(e,t,n,r)=>{Nj+=1;let i=e,a=(()=>{try{return i.type?.toArray?i.type.toArray().length:null}catch{return null}})();return{seq:Nj,topLevelYElements:a,durationMs:r}}),jj(Or.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`)&&(yp(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}),!Uj()&&e===`first-paint`&&Lj!==null)){let e=Lj,n=Math.max(0,t.startTime-e);yp(`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}),Lj=null}}}).observe({type:`paint`,buffered:!0})}catch{}globalThis.__okColdMountInstrumented=!0}}function Yj(){let[e]=(0,Q.useState)(jo);return e}var Xj=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)}},Zj=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)}},Qj=null;function $j(){return Qj===null&&(Qj=new Xj(new Zj)),Qj}function eM({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:Vo(e.display_name),color:Ga(e.id,ia),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:Ga(e.id,ia),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function tM(e,t){return e>t}function nM(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 rM=3,iM=6e4;function aM(e,t){let n=0;for(let r of e)t-r<iM&&(n+=1);return n<rM}var oM=new Map;function sM(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 cM(e){let t=Se.getState(e);return t?.snapshot!=null||t?.prevSnapshot!=null}function lM(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=Se.getState(e)?.binding;if(!t)return;if(typeof t._prosemirrorChanged!=`function`){yp.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=>{tM(i,a)||r(e)}},f=()=>{if(c=!1,!s||o||!tM(i,a)||l!==null&&cM(l.state))return;o=!0;let e=Date.now();for(let[t,n]of oM)n.every(t=>e-t>=iM)&&oM.delete(t);let t=(oM.get(n)??[]).filter(t=>e-t<iM);if(!aM(t,e)){oM.set(n,t),yp.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),oM.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,yp.count(`ok/editor/binding-wedge-recovery-error`,{docName:n}),console.error(`[binding-staleness-guard] wedge recovery threw for "${n}":`,e)}},p=e=>{e.origin!==Se&&sM(e,t)&&(i+=1,c||(c=!0,queueMicrotask(f)))};return new is({state:{init:()=>null,apply:e=>(nM(e.getMeta(Se))&&(a=i,o&&yp.count(`ok/editor/binding-wedge-recovered`,{docName:n}),o=!1),null)},filterTransaction:(e,t)=>!tM(i,a)||cM(t)?!0:e.getMeta(Se)!==void 0,view:e=>{let r=t.doc;return r==null?(yp.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 uM(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 dM=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&&Zo(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(Ur(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Qr(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Kr(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Zr(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Wr(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(qr(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Jr(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(Xr(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=Oo(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof ro){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 ha){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():uM(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&Gr(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()}},fM=e=>new is({key:typeof e.pluginKey==`string`?new ps(e.pluginKey):e.pluginKey,view:t=>new dM({view:t,...e})});ya.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[fM({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 pM=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 Io(e,{textSerializers:Ko(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Ur(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Qr(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Kr(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Zr(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Wr(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(qr(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Jr(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(Xr(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=Oo(this.view,e.from,e.to);Gr({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()}},mM=e=>new is({key:typeof e.pluginKey==`string`?new ps(e.pluginKey):e.pluginKey,view:t=>new pM({view:t,...e})});ya.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?[mM({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 hM(e,t){return e??new ps(t)}var gM=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,_M=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),vM=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(`.`)),yM=new Set([`children`,`className`,`style`]),bM=new Set([`tabIndex`]),xM=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),SM={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function CM(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function wM(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function TM(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||xM.has(e)}function EM(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function DM(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:SM[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function OM(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 kM(e){return bM.has(e)}function AM(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function jM(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 MM(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||vM.has(e)?String(t):`${t}px`}function NM(e,t){_M.has(t)||e.style.removeProperty(EM(t))}function PM(e,t,n){_M.has(t)||e.style.setProperty(EM(t),MM(t,n))}function FM(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(yM.has(r)||!TM(r)||CM(r,t[r])||CM(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=wM(r);if(a==null||a===!1){kM(r)&&jM(e,r),e.removeAttribute(o);return}if(a===!0){kM(r)&&AM(e,r,!0),e.setAttribute(o,``);return}if(kM(r)){AM(e,r,a);return}e.setAttribute(o,String(a))})}function IM(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function LM(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){NM(e,t);return}PM(e,t,a)}})}function RM(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(!CM(t,n))return;let{eventName:i,options:a}=DM(t),o=t=>{n(OM(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function zM(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);gM(()=>{let i=n.current;return IM(e,i.className,t.className),LM(e,i.style,t.style),FM(e,i,t),r.current=RM(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 BM=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)(hM(e,`bubbleMenu`)).current;zM(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=Mr(),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=fM({...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,Pg.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)(hM(e,`floatingMenu`)).current;zM(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=Mr(),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=mM({...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,Pg.createPortal)(s,u.current)});function VM(){let e=(0,$.c)(9),{_:t}=on(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(Ni,{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)(sr,{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:HM,children:[(0,Z.jsx)(ue,{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)(ne,{"aria-label":Ss(`add-comment`),children:xs(`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)(cr,{side:`bottom`,sideOffset:8,children:[a,o]})]})]}),e[7]=a,e[8]=s),s}function HM(){return rt()}var UM=[{name:`paragraph`,label:{id:`xeiujy`},icon:$v,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:{id:`lXKZGw`},icon:me,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:{id:`El7NbA`},icon:d,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:{id:`SFN6dN`},icon:nn,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:{id:`s1c0ja`},icon:B,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:y,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:{id:`G_686w`},icon:K,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:c,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:{id:`N2eHWq`},icon:cy,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock({language:`js`}).run()}];function WM(e){let t=(0,$.c)(22),{editor:n}=e,{_:r}=on(),i;t[0]===n?i=t[1]:(i={editor:n,selector:GM},t[0]=n,t[1]=i);let{current:a,activeStates:o}=Ir(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)(Vl,{className:`size-3 opacity-50`}),t[9]=d):d=t[9];let f;t[10]!==c||t[11]!==u?(f=(0,Z.jsx)(hi,{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=UM.map(e=>{let t=e.icon,i=o[e.name];return(0,Z.jsxs)(li,{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)(yi,{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)(xi,{children:[f,m]}),t[19]=f,t[20]=m,t[21]=h):h=t[21],h}function GM(e){let t=Object.fromEntries(UM.map(t=>[t.name,t.isActive(e.editor)]));return{current:UM.find(e=>t[e.name])??UM[0],activeStates:t}}var KM=`0 2px 4px rgba(0, 0, 0, 0.08)`,qM=150,JM=globalThis.ScrollTimeline;function YM(e,t,n,r,i){let a=r-i;if(a<=0)return null;let o=e+n-(t+56);return{startOffset:o,endOffset:o+a,maxShift:a}}var XM=new WeakMap;function ZM(e){let t=XM.get(e);if(t){for(let e of t.animations)e.cancel();XM.delete(e)}}function QM(e){for(let t of Array.from(e.cells))ZM(t)}var $M=e=>e.cellIndex===0?`3`:`2`;function eN(e,t){return tN(e,t,e=>({transform:`translateY(${e}px)`}))}function tN(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 nN(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 rN(e,t,n){return nN(e,t,{zIndex:`auto`,boxShadow:`none`},{zIndex:n,boxShadow:KM})}function iN(e,t){return nN(e,t,{opacity:`0`},{opacity:`1`})}function aN(e,t,n,r){let i=$M(e),a=`sd|${n.startOffset}|${n.maxShift}|${r}|${i}`,o=XM.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(eN(n,r),s),l=e.animate(rN(n,r,i),s),u=e.animate(iN(n,r),{...s,pseudoElement:`::before`});XM.set(e,{key:a,animations:[c,l,u]})}function oN(e,t){let n=$M(e),r=`in|${t}|${n}`,i=XM.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:KM}],{duration:0,fill:`forwards`}),o=e.animate([{opacity:`1`}],{duration:0,fill:`forwards`,pseudoElement:`::before`});XM.set(e,{key:r,animations:[a,o]})}function sN(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=YM(a,i,c.top,c.height,l.height);if(!u){QM(s);continue}if(n){if(o<=0){QM(s);continue}for(let e of Array.from(s.cells))aN(e,n,u,o);continue}let d=Math.max(0,Math.min(a-u.startOffset,u.maxShift));if(d<=0||c.bottom<=i+56){QM(s);continue}for(let e of Array.from(s.cells))oN(e,d)}}var cN=ya.create({name:`frozenTableHeaders`,addProseMirrorPlugins(){return[new is({key:new ps(`frozenTableHeaders`),view(e){let t=null,n=null,r=null,i=null,a=null,o=!1,s=new Set,c=()=>{o||!t||sN(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()},qM);return}l()};return requestAnimationFrame(()=>{if(!o){if(t=e.dom.closest(`[data-testid="editor-scroll-container"]`),t&&JM)try{n=new JM({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`))QM(t)}}}})]}});function lN(e){return()=>{let t=null;try{t=e.view.dom.closest(`.editor-doc-scroll`)}catch{}let n={top:56,bottom:uN(`--ask-composer-height`)+uN(`--conflict-footer-height`)};return t?{boundary:t,padding:n}:{padding:n}}}function uN(e){let t=Number.parseFloat(document.documentElement.style.getPropertyValue(e));return Number.isFinite(t)?t:0}function dN(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 fN(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:_e(typeof n.src==`string`?n.src:``)}function pN(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 mN(e){let t=(0,$.c)(13),{editor:n}=e,{_:r}=on(),i;if(t[0]===n?i=t[1]:(i={editor:n,selector:hN},t[0]=n,t[1]=i),Ir(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=dN(n);t&&pN(t,fN(n))},t[4]=n,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(od,{className:`size-3.5`}),t[6]=s):s=t[6];let c;t[7]!==a||t[8]!==o?(c=(0,Z.jsx)(sr,{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)(cr,{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 hN(e){return dN(e.editor)}function gN(e){return dN(e)!==null}var _N=`img, .ok-embed, .ok-video`,vN=220,yN=`cubic-bezier(0.23, 1, 0.32, 1)`,bN=`ok-image-align-flip`,xN=.5;function SN(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function CN(){return typeof requestAnimationFrame==`function`}function wN(e){return e?e.querySelector(_N):null}function TN(e,t){if(SN()||!CN()){t();return}let n=wN(e);if(!n){t();return}let r=n.getBoundingClientRect().left;t(),requestAnimationFrame(()=>{let t=wN(e);if(!t)return;for(let e of t.getAnimations())e.id===bN&&e.cancel();let n=r-t.getBoundingClientRect().left;if(Math.abs(n)<xN)return;let i=t.animate([{transform:`translateX(${n}px)`},{transform:`translateX(0)`}],{duration:vN,easing:yN,fill:`none`});i.id=bN})}var EN=[{value:`left`,label:{id:`IR6Txi`},icon:vy},{value:`center`,label:{id:`8nOdkO`},icon:gy},{value:`right`,label:{id:`pd0UH2`},icon:_y}];function DN(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(!le.has(String(n)))return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function ON(e){let t=(0,$.c)(8),{editor:n}=e,{_:r}=on(),i;t[0]===n?i=t[1]:(i={editor:n,selector:kN},t[0]=n,t[1]=i);let a=Ir(i);if(a===null)return null;let o;t[2]!==r||t[3]!==a||t[4]!==n?(o=EN.map(e=>{let{value:t,label:i,icon:o}=e,s=a===t;return(0,Z.jsxs)(ur,{children:[(0,Z.jsx)(sr,{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(!le.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(ro.create(u.doc,s)),TN(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(o,{className:`size-3.5`})})}),(0,Z.jsx)(cr,{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 kN(e){return DN(e.editor)}function AN(e){return DN(e)!==null}function jN({editor:e}){if(je(e.state).query||e.isActive(`codeBlock`))return!1;if(AN(e)||gN(e))return!0;if(e.state.selection.empty)return!1;let{from:t,to:n}=e.state.selection;return!!ua(e.state.doc,t,n,` `,{inlineOnly:!0}).trim()}function MN(e){throw Error(`Unhandled AddLinkShortcutAction variant: ${JSON.stringify(e)}`)}function NN(e){let{selection:t}=e.state;if(t.empty){if(!e.isActive(`link`))return null;let n=i(e.state,t.from,`link`);return n===null?null:{kind:`edit-link`,markId:n}}return!jN({editor:e})||AN(e)||gN(e)?null:{kind:`open-popover`}}function PN(e){let t=e.schema.nodes;return!!(t.footnoteReference&&t.footnoteDefinition)}function FN(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 IN(e){let{$from:t,$to:n}=e.state.selection;return!t.sameParent(n)}function LN(e){let t=(0,$.c)(21),{editor:n}=e,{_:r}=on(),i;t[0]===n?i=t[1]:(i={editor:n,selector:RN},t[0]=n,t[1]=i);let a=Ir(i),o;t[2]!==a||t[3]!==n?(o=()=>{if(a||!PN(n)||n.state.selection.empty||IN(n)||FN(n))return;let{from:e,to:t}=n.state.selection,r=n.state.doc.textBetween(e,t,` `);if(!r.trim())return;let i=Ea(ls(n.state.doc)),o=Jo(n.state.doc)+1-(t-e);n.chain().focus().deleteSelection().insertFootnoteReference(i).insertContentAt(o,{type:`footnoteDefinition`,attrs:{identifier:i,label:i},content:[{type:`paragraph`,content:[{type:`text`,text:r}]}]}).run()},t[2]=a,t[3]=n,t[4]=o):o=t[4];let s=o,c;t[5]===r?c=t[6]:(c=r({id:`sIGbBZ`}),t[5]=r,t[6]=c);let l;t[7]===s?l=t[8]:(l=e=>{e.preventDefault(),s()},t[7]=s,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Kt,{className:`size-3.5`,"aria-hidden":`true`}),t[9]=u):u=t[9];let d;t[10]!==a||t[11]!==c||t[12]!==l?(d=(0,Z.jsx)(sr,{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":c,onMouseDown:l,disabled:a,children:u})}),t[10]=a,t[11]=c,t[12]=l,t[13]=d):d=t[13];let f;t[14]===r?f=t[15]:(f=r({id:`sIGbBZ`}),t[14]=r,t[15]=f);let p;t[16]===f?p=t[17]:(p=(0,Z.jsx)(cr,{side:`bottom`,sideOffset:8,children:f}),t[16]=f,t[17]=p);let m;return t[18]!==d||t[19]!==p?(m=(0,Z.jsxs)(ur,{children:[d,p]}),t[18]=d,t[19]=p,t[20]=m):m=t[20],m}function RN(e){let t=e.editor;return!!(!PN(t)||t.state.selection.empty||IN(t)||FN(t))}var zN=[{name:`bold`,icon:gv,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcutId:`format-bold`},{name:`italic`,icon:Bv,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcutId:`format-italic`},{name:`underline`,icon:Cy,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcutId:`format-underline`},{name:`strikethrough`,icon:fy,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcutId:`format-strike`},{name:`code`,icon:S,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcutId:`format-inline-code`},{name:`highlight`,icon:zv,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcutId:`format-highlight`}];function BN(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:VN},t[0]=n,t[1]=r);let i=Ir(r),a;t[2]!==i||t[3]!==n?(a=zN.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(ur,{children:[(0,Z.jsx)(sr,{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)(cr,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(ne,{"aria-label":Ss(e.shortcutId),children:xs(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 VN(e){return Object.fromEntries(zN.map(t=>[t.name,t.isActive(e.editor)]))}var HN=`open-knowledge:open-link-edit-popover`;function UN(e=typeof window>`u`?new EventTarget:window){e.dispatchEvent(new CustomEvent(HN))}function WN(e,t=typeof window>`u`?new EventTarget:window){let n=()=>e();return t.addEventListener(HN,n),()=>t.removeEventListener(HN,n)}function GN(e){return e.state.selection.empty&&e.isActive(`link`)?e.getAttributes(`link`).href??``:``}async function KN(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=G(n);r!==null&&(t(e=>e===``?r:e),requestAnimationFrame(()=>{let t=e.current;t&&t.value===r&&t.select()}))}function qN(e,t,n,r){let i=GN(e);n(i),r(!0),i===``&&KN(t,n)}function JN(e){let t=(0,$.c)(72),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!1:r,{_:a}=on(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``),u=(0,Q.useRef)(null),{folderPaths:d,loading:f,pages:p}=Eu(),m;t[0]===n?m=t[1]:(m=n.state.selection.empty&&n.isActive(`link`),t[0]=n,t[1]=m);let h=m,g;t[2]===n?g=t[3]:(g=n.getAttributes(`link`).href??``,t[2]=n,t[3]=g);let _=g,v,y;t[4]!==n||t[5]!==i?(v=()=>WN(()=>{i&&qN(n,u,l,s)}),y=[i,n],t[4]=n,t[5]=i,t[6]=v,t[7]=y):(v=t[6],y=t[7]),(0,Q.useEffect)(v,y);let b,x;t[8]!==n||t[9]!==i?(b=()=>{let e=e=>{if(!i||!As(e,`add-link`)||!n.editorView?.hasFocus())return;let t=NN(n);if(t!==null)switch(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),t.kind){case`open-popover`:UN();return;case`edit-link`:{let{markId:e}=t;Ue(e),requestAnimationFrame(()=>{Ce(n).setActiveNode(e)});return}default:MN(t)}};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},x=[i,n],t[8]=n,t[9]=i,t[10]=b,t[11]=x):(b=t[10],x=t[11]),(0,Q.useEffect)(b,x);let S,C;t[12]===n?(S=t[13],C=t[14]):(S=()=>{let e=function(){n.state.selection.empty&&s(!1)};return n.on(`selectionUpdate`,e),()=>{n.off(`selectionUpdate`,e)}},C=[n],t[12]=n,t[13]=S,t[14]=C),(0,Q.useEffect)(S,C);let w,T;t[15]===o?(w=t[16],T=t[17]):(w=()=>{if(!o)return;let e=!1,t=0,n=r=>{if(e)return;let i=u.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)}},T=[o],t[15]=o,t[16]=w,t[17]=T),(0,Q.useEffect)(w,T);let E;t[18]!==n||t[19]!==h||t[20]!==c?(E=function(){c.trim()?n.chain().focus().setLink({href:c.trim()}).run():h&&n.chain().focus().unsetLink().run(),s(!1)},t[18]=n,t[19]=h,t[20]=c,t[21]=E):E=t[21];let D=E,O;t[22]===n?O=t[23]:(O=function(){n.chain().focus().unsetLink().run(),s(!1)},t[22]=n,t[23]=O);let k=O,A;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){l(Fr(e.path,null))},t[24]=A):A=t[24];let j=A,M;t[25]!==D||t[26]!==n?(M=function(e){e.key===`Enter`&&(e.preventDefault(),D()),e.key===`Escape`&&(e.preventDefault(),s(!1),n.chain().focus().run())},t[25]=D,t[26]=n,t[27]=M):M=t[27];let N=M;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]!==d||t[33]!==N||t[34]!==f||t[35]!==p||t[36]!==e||t[37]!==n||t[38]!==c?(r=(0,Z.jsx)(U,{ref:u,type:`text`,placeholder:e,value:c,pages:p,folderPaths:d,loading:f,onValueChange:l,onSuggestionSelect:j,onKeyDown:N,"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]=d,t[33]=N,t[34]=f,t[35]=p,t[36]=e,t[37]=n,t[38]=c,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]===D?o=t[43]:(o=()=>{D()},t[42]=D,t[43]=o);let s;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(wv,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[44]=s):s=t[44];let m;t[45]!==i||t[46]!==o?(m=(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":i,onClick:o,children:s}),t[45]=i,t[46]=o,t[47]=m):m=t[47];let g;t[48]!==r||t[49]!==m?(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,m]}),t[48]=r,t[49]=m,t[50]=g):g=t[50];let v;t[51]!==a||t[52]!==_||t[53]!==h||t[54]!==k?(v=h&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(ur,{children:[(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":a({id:`2vIPtm`}),onMouseDown:e=>{e.preventDefault(),kr(_)},children:(0,Z.jsx)(dl,{className:`size-3.5`})})}),(0,Z.jsx)(cr,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(Y,{id:`2vIPtm`})})]}),(0,Z.jsxs)(ur,{children:[(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":a({id:`484LKL`}),onMouseDown:e=>{e.preventDefault(),k()},children:(0,Z.jsx)(ff,{className:`size-3.5`})})}),(0,Z.jsx)(cr,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(Y,{id:`484LKL`})})]})]}),t[51]=a,t[52]=_,t[53]=h,t[54]=k,t[55]=v):v=t[55];let y;return t[56]!==g||t[57]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[g,v]}),t[56]=g,t[57]=v,t[58]=y):y=t[58],y}let P;t[59]===a?P=t[60]:(P=a({id:`p0Iq25`}),t[59]=a,t[60]=P);let F=h?`bg-accent text-primary`:`text-accent-foreground`,I;t[61]===n?I=t[62]:(I=e=>{e.preventDefault(),qN(n,u,l,s)},t[61]=n,t[62]=I);let L;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(Hv,{className:`size-3.5`}),t[63]=L):L=t[63];let R;t[64]!==P||t[65]!==F||t[66]!==I?(R=(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":P,className:F,onMouseDown:I,children:L})}),t[64]=P,t[65]=F,t[66]=I,t[67]=R):R=t[67];let z;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(Y,{id:`yzF66j`}),t[68]=z):z=t[68];let B;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsxs)(cr,{side:`bottom`,sideOffset:8,children:[z,(0,Z.jsx)(ne,{children:xs(`add-link`)})]}),t[69]=B):B=t[69];let V;return t[70]===R?V=t[71]:(V=(0,Z.jsxs)(ur,{children:[R,B]}),t[70]=R,t[71]=V),V}function YN(e){let t=(0,$.c)(18),{editor:n}=e,{_:r}=on(),i;t[0]===n?i=t[1]:(i=()=>{let e=wr(n),t=Br(n);e===null||!t||Kl({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)(Zm,{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)(sr,{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:XN,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)(ne,{"aria-label":Ss(`view-source-at-cursor`),children:xs(`view-source-at-cursor`)}),t[12]=d):d=t[12];let f;t[13]===u?f=t[14]:(f=(0,Z.jsxs)(cr,{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 XN(e){return e.preventDefault()}function ZN(e){let t=(0,$.c)(30),{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:nP},t[0]=n,t[1]=l);let u=Ir(l),d;t[2]===n?d=t[3]:(d={editor:n,selector:tP},t[2]=n,t[3]=d);let f=Ir(d),p;t[4]!==n.state||t[5]!==n.view?(p=()=>{try{let{from:e,to:t}=n.state.selection;return Oo(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=lN(n),t[10]=n,t[11]=g);let _=g,v;t[12]!==_||t[13]!==h?(v=()=>{let e=a.current;e&&(c.current?.(),c.current=Yr(h,e,()=>{Gr(h,e,{placement:`top`,strategy:`fixed`,middleware:[Kr(8),Ur(_),Qr({padding:8}),Jr(_)]}).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(eP)}))},t[12]=_,t[13]=h,t[14]=v):v=t[14];let y=v,b;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>{c.current?.(),c.current=null,s($N)},t[15]=b):b=t[15];let x=b,S;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(S={padding:8},t[16]=S):S=t[16];let C;t[17]!==_||t[18]!==y?(C={onShow:y,onHide:x,strategy:`fixed`,flip:_,shift:S,hide:_},t[17]=_,t[18]=y,t[19]=C):C=t[19];let w;t[20]!==n||t[21]!==f||t[22]!==u||t[23]!==i||t[24]!==o?(w=u?(0,Z.jsx)(ON,{editor:n},`${o}-img-align`):f?(0,Z.jsx)(mN,{editor:n},`${o}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(WM,{editor:n}),(0,Z.jsx)(Ni,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(BN,{editor:n},o),(0,Z.jsx)(Ni,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(JN,{editor:n,shortcutEnabled:i},`${o}-link`),(0,Z.jsx)(LN,{editor:n},`${o}-footnote`),(0,Z.jsx)(YN,{editor:n},`${o}-view-source`),(0,Z.jsx)(VM,{},`${o}-comment`)]}),t[20]=n,t[21]=f,t[22]=u,t[23]=i,t[24]=o,t[25]=w):w=t[25];let T;return t[26]!==n||t[27]!==C||t[28]!==w?(T=(0,Z.jsx)(BM,{ref:a,editor:n,"data-testid":`bubble-menu-bar`,appendTo:QN,shouldShow:jN,updateDelay:250,options:C,className:`z-50 flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:w}),t[26]=n,t[27]=C,t[28]=w,t[29]=T):T=t[29],T}function QN(){return document.body}function $N(e){return e+1}function eP(){}function tP(e){return gN(e.editor)}function nP(e){return AN(e.editor)}var rP=new ps(`bareHtmlImageDecoration`);function iP(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 aP(e,t){let n=e.getAttribute(`src`);if(n===null||oo(n,t)===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:wa(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 oP(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?aP(r,t):null}function sP(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 cP(e,t){let n=[];return e.descendants((e,r,i)=>{if(!(!e.isText||e.text===void 0||sP(e,i)))for(let i of iP(e.text)){let e=oP(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 lP(e,t,n){let r=[];for(let i of cP(e,n)){let{from:e,to:n,props:a}=i,o=null;r.push(Ho.inline(e,n,{"aria-hidden":`true`,class:`hidden ok-bare-html-image-source`}),Ho.widget(e,()=>(o=new xr(D,{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 Mo.create(e,r)}function uP(e){return ya.create({name:`bareHtmlImageDecoration`,addProseMirrorPlugins(){let t=this.editor;return[new is({key:rP,state:{init:(n,r)=>lP(r.doc,t,e),apply:(n,r)=>n.docChanged?lP(n.doc,t,e):r.map(n.mapping,n.doc)},props:{decorations:e=>rP.getState(e)??Mo.empty}})]}})}var dP=new ps(`markdownLintDecorations`),fP=`ok-lint-block`,pP=`ok-lint-block-error`,mP=`ok-lint-block-atom`,hP=400;function gP(e){return e.source===`frontmatter`}function _P(e,t,n){let r=new Map;if(t.length===0)return r;let{spans:i,fmLineCount:a}=Gl(e,n);for(let e of t){if(gP(e))continue;let t=e.range.start.line+1;if(a>0&&t<=a)continue;let n=Jl(i,t);if(n===null)continue;let o=r.get(n);o?o.push(e):r.set(n,[e])}return r}var vP=`data-ok-lint`,yP=`data-ok-lint-fixable`;function bP(e,t){let n=new Map;if(t.size===0)return{set:Mo.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=[fP];e.textContent.length===0&&l.push(mP),s&&l.push(pP);let u={class:l.join(` `),[vP]:c},d=Ow(o);d.length>0&&(u[yP]=`1`,n.set(a,d)),r.push(Ho.node(a,a+e.nodeSize,u))}),{set:Mo.create(e,r),fixesByOffset:n}}function xP(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=Bn(`ok-lint-tooltip-fix`,ir({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={getBoundingClientRect:()=>({width:0,height:0,x:l,y:u,top:u,left:l,right:l,bottom:u})};function f(){s!==null&&(clearTimeout(s),s=null)}function p(){f(),a=null,n.hidden=!0,c?.(),c=null}function m(){o||(f(),s=setTimeout(p,140))}function h(){Gr(d,n,{placement:`top-start`,middleware:[Kr(6),Ur(),Qr({padding:8})]}).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 g(e){let s=e.getAttribute(vP);if(!s){m();return}f(),a=e,r.textContent=s;let l=t.applyFix?t.getFixes(e):[];l.length>0&&t.applyFix?(i.hidden=!1,i.textContent=Ms._({id:`c4fVUV`}),i.onclick=()=>{t.applyFix?.(l),o=!1,p()}):(i.hidden=!0,i.onclick=null),n.hidden=!1,c?.(),c=Yr(d,n,h)}function _(e){let t=e,n=e.target?.closest(`.${fP}`)??null;n?n===a?f():(l=t.clientX,u=t.clientY,g(n)):a&&m()}function v(e){let t=e.relatedTarget;if(t===n||t?.closest(`.ok-lint-tooltip`)){f();return}t?.closest(`.${fP}`)||m()}function y(){o=!0,f()}function b(e){o=!1;let t=e.relatedTarget;t!==a&&!t?.closest(`.${fP}`)&&m()}return n.addEventListener(`pointerenter`,y),n.addEventListener(`pointerleave`,b),e.dom.addEventListener(`pointerover`,_),e.dom.addEventListener(`pointerout`,v),{destroy(){f(),c?.(),e.dom.removeEventListener(`pointerover`,_),e.dom.removeEventListener(`pointerout`,v),n.remove()}}}var SP=ya.create({name:`markdownLintDecorations`,addOptions(){return{docName:``,getSource:void 0,applyFix:void 0}},addProseMirrorPlugins(){let{docName:e,getSource:t,applyFix:n}=this.options,r=new To({extensions:as});return[new is({key:dP,state:{init:()=>Mo.empty,apply(e,t){return e.getMeta(dP)||t.map(e.mapping,e.doc)}},props:{decorations(e){return dP.getState(e)??null}},view(i){let a=null,o=null,s=!1,c=0,l=new Map;async function u(){if(s)return;let n=t?.()??null,r=a?.enabled?await d(a):{kind:`ok`,set:Mo.empty,fixesByOffset:new Map};if(s||r.kind===`stale`)return;if(r.kind===`mismatch`){c<2&&(c+=1,f());return}c=0,l=r.fixesByOffset;let o=r.set,u=dP.getState(i.state)??Mo.empty;if((o.find().length>0||u.find().length>0)&&i.dispatch(i.state.tr.setMeta(dP,o)),a?.enabled){let t=Xl(e);t?.kind===`lint`&&g(t.detail)&&Wl(e)}n!==null&&!s&&t?.()!==n&&f()}async function d(n){let a=i.state.doc,o=t?.()??r.serialize(a.toJSON()),s=await oa(o,n,e);if(!i.state.doc.eq(a))return{kind:`stale`};let{spans:c}=Gl(o,r);return c.length===Su(a)?{kind:`ok`,...bP(a,_P(o,s,r))}:{kind:`mismatch`}}function f(){o&&clearTimeout(o),o=setTimeout(()=>{u().catch(e=>{console.warn(`[markdown-lint] decoration pass failed`,e)})},hP)}let p=0;async function m(){let t=++p,n=await Rm(e);s||t!==p||(a=n,await u())}let h=()=>{m().catch(e=>{console.warn(`[markdown-lint] config load/lint pass failed`,e)})};function g(n){if(!i.dom.isConnected||i.dom.offsetParent===null||n.source===`frontmatter`)return!1;let{spans:a,fmLineCount:o}=Gl(t?.()??r.serialize(i.state.doc.toJSON()),r);if(a.length!==Su(i.state.doc)||o>0&&n.line<=o)return!1;let s=Jl(a,n.line);if(s===null)return!1;let c=-1;return i.state.doc.forEach((e,t,n)=>{n===s&&(c=t)}),c<0?!1:fe(e,()=>{i.dispatch(i.state.tr.setSelection(Ha.near(i.state.doc.resolve(c+1)))),i.focus();let e=i.nodeDOM(c);e instanceof HTMLElement&&e.scrollIntoView({behavior:`smooth`,block:`start`})})}function _(t){let n=t.detail;!n||n.docName!==e||s||g(n)&&Wl(e)}h();let v=Lm(h),y=xP(i,{getFixes:e=>{if(e.getAttribute(yP)!==`1`||l.size===0)return[];let t;try{t=i.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),i.state.doc.content.size),r=i.state.doc.resolve(n),a=r.depth>=1?r.before(1):0;return l.get(a)??[]},applyFix:n});window.addEventListener(su,_);let b=()=>{s||f()};return window.addEventListener(Tw,b),{update(e,t){e.state.doc!==t.doc&&f()},destroy(){s=!0,o&&clearTimeout(o),v(),y.destroy(),window.removeEventListener(su,_),window.removeEventListener(Tw,b)}}}})]}}),CP=1400,wP=new ps(`okAgentInsertFlash`);function TP(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 EP=6e3;function DP(){return new is({key:wP,state:{init:()=>Mo.empty,apply(e,t){let n=t.map(e.mapping,e.doc),r=e.getMeta(wP);if(r===void 0)return n;if(r.sweep===!0){let e=n.find().filter(e=>r.now-(e.spec.addedAt??0)>=CP);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,[Ho.inline(r.add.from,r.add.to,{class:`ok-agent-insert-flash`},t)])}return n}},props:{decorations(e){return wP.getState(e)}}})}function OP(e,t,n){if(t<0||t>e.content.size)return null;let r=vs(e.resolve(t));return r?n===`row`?ha.rowSelection(r):ha.colSelection(r):null}function kP(e){if(!(e instanceof ha))return null;let t=e.$anchorCell.node(-1);if(!t)return null;let n=e.$anchorCell.start(-1),r=ba.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 AP(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=OP(i.doc,a,n);o&&r.dispatch(i.tr.setSelection(o))}var jP=5,MP=1;function NP(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)<jP)return;t.isDragging=!0,m(!0),document.body.style.cursor=`grabbing`,document.body.style.userSelect=`none`}let n=PP(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?RP(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 PP(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:MP,rect:IP(a,FP(e,0,n.top))};if(r<=n.bottom){let i=r>=n.top+n.height/2,o=i?t+1:t,s=Math.max(MP,o);return{index:s,rect:IP(a,s===o?i?n.bottom:n.top:FP(e,0,n.top))}}}let t=e[e.length-1].getBoundingClientRect();return{index:e.length,rect:IP(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:LP(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:LP(a,i)}}}let c=s[s.length-1].getBoundingClientRect();return{index:s.length,rect:LP(a,c.right)}}function FP(e,t,n){let r=e[t];return r?r.getBoundingClientRect().bottom:n}function IP(e,t){return{left:e.left,top:t-1,width:e.width,height:2}}function LP(e,t){return{left:t-1,top:e.top,width:2,height:e.height}}function RP(e,t,n,r){let i=n===`row`?zP(t):t.cellIndex;if(i<0||n===`row`&&(i<MP||r<MP)||r===i||r===i+1)return;let{state:a,view:o}=e,s=BP(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;UP(l,s,c,n===`row`?VP(c,i,r):HP(c,i,r)),o.dispatch(l)}function zP(e){let t=e.parentElement,n=t?.closest(`table`);return n?Array.prototype.indexOf.call(n.rows,t):-1}function BP(e){for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole===`table`)return e.before(t);return-1}function VP(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 HP(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 UP(e,t,n,r){e.replaceRangeWith(t,t+n.nodeSize,r)}function WP(e){return[...e?[{id:`toggle-header-column`,label:{id:`JddocZ`},icon:xv,run:e=>e.chain().focus().toggleHeaderColumn().run()}]:[],{id:`insert-column-left`,label:{id:`ZJ99sD`},icon:ol,run:e=>e.chain().focus().addColumnBefore().run()},{id:`insert-column-right`,label:{id:`9EykGQ`},icon:ll,run:e=>e.chain().focus().addColumnAfter().run()},{id:`delete-column`,label:{id:`GAohqx`},icon:ff,separatorBefore:!0,run:e=>e.chain().focus().deleteColumn().run()},{id:`delete-table`,label:{id:`HSI88F`},icon:Iv,run:e=>e.chain().focus().deleteTable().run()}]}function GP(e){return[...e?[{id:`toggle-header-row`,label:{id:`61i3cO`},icon:py,run:e=>e.chain().focus().toggleHeaderRow().run()}]:[],{id:`insert-row-above`,label:{id:`JrqL_z`},icon:cl,run:e=>e.chain().focus().addRowBefore().run()},{id:`insert-row-below`,label:{id:`CUmCwI`},icon:sl,run:e=>e.chain().focus().addRowAfter().run()},{id:`delete-row`,label:{id:`0cspe_`},icon:ff,separatorBefore:!0,run:e=>e.chain().focus().deleteRow().run()},{id:`delete-table`,label:{id:`HSI88F`},icon:Iv,run:e=>e.chain().focus().deleteTable().run()}]}function KP(e){if(!e.isEditable||je(e.state).query)return null;let{state:t,view:n}=e,r=kP(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 qP(e){let t=(0,$.c)(46),{editor:n,anchor:r,axis:i,items:a}=e,o=(0,Q.useRef)(null),{_:s}=on(),[c,l]=(0,Q.useState)(!1),u;t[0]!==r||t[1]!==i||t[2]!==n?(u=()=>{AP(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=NP(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 Yr(r,e,()=>{Gr(r,e,{strategy:`absolute`,placement:t,middleware:[Kr(n)]}).then(t=>{let{x:n,y:r}=t;e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.opacity=`1`}).catch(JP)})},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`?Ev:Vn,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)(hi,{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)(Si,{}),(0,Z.jsxs)(li,{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)(yi,{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)(xi,{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 JP(){}function YP(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=KP(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=WP(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)(qP,{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=GP(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)(qP,{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 XP(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=Se.getState(e.state)?.binding;if(!t){yp.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-binding`}),s(`no ySync binding on "${n}"`);return}if(typeof t._forceRerender!=`function`){yp.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-force-rerender`}),s(`ySync binding on "${n}" exposes no _forceRerender`);return}yp.count(`ok/editor/pattern-d-stale-prewarm`,{docName:n}),t._forceRerender()};return ya.create({name:`walkCurrency`,onBeforeCreate(){t.observeDeep(o),i=!0},onDestroy(){c()},addProseMirrorPlugins(){return[new is({view:e=>(a||(a=!0,c(),r&&l(e)),{})})]}})}var ZP=new WeakMap;function QP(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=Go(e.color),n.textContent=e.name,t.append(n),t}var $P={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null};function eF(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 tF=100,nF=100,rF=3,iF=250;function aF(e){return`contentComponent`in e&&`isEditorContentInitialized`in e}function oF(e,t){let n=Lr(e);if(!n||t.contains(n.dom))return!1;if(!aF(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 sF(){let e=new To({extensions:as});return{mdManager:e,text:M({mdManager:e}),html:w({mdManager:e}),paste:z({mdManager:e}),copy:v({mdManager:e}),drop:F({mdManager:e})}}function cF(e,t){return t?{collaboration:s.configure({document:e.document,ySyncOptions:{mapping:t}}),guard:[XP({fragment:e.document.getXmlFragment(`default`),docName:e.configuration.name??``})]}:{collaboration:s.configure({document:e.document}),guard:[]}}function lF(e){let{provider:t,placeholder:n,prebuiltMapping:r,onWedged:i}=e,{collaboration:a,guard:o}=cF(t,r);return[...Te.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`||e.name===`jsxInline`||e.name===`imageReference`?e.configure({docName:t.configuration.name??``}):e),uP(t.configuration.name??``),cf.configure({placeholder:()=>n??Ms._({id:`RS98db`}),showOnlyCurrent:!0}),pe.configure({docName:t.configuration.name??``}),a,ya.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[jt]}}),ya.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[k(e,{cursorBuilder:QP})]}}),ya.create({name:`bindingStalenessGuard`,addProseMirrorPlugins(){return[lM({fragment:t.document.getXmlFragment(`default`),docName:t.configuration.name??``,onWedged:i??(()=>{})})]}}),...o,cN,SP.configure({docName:t.configuration.name??``,getSource:()=>t.document.getText(`source`).toString(),applyFix:e=>kw(t,e,t.configuration.name??``)})]}function uF(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{ZP.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=ZP.get(e);if(ZP.delete(e),r==null)return;let i=performance.now();yp(`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:qj(lF(e))}}function dF(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i,onWedged:a}=e,o=t.document.getXmlFragment(`default`),s=new Map,c=uF({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}=Dt(o,t.schema);r.forEach((e,t)=>{s.set(t,e)}),t.options.content=n.toJSON()},element:null}}var fF=e=>{let t=(0,$.c)(23),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)($P),c=Yj(),{principal:l,activeDocName:u,recycleDocument:d}=Oe(),p=n.configuration.name??``,[m]=(0,Q.useState)(sF),h;t[0]!==m||t[1]!==p||t[2]!==r||t[3]!==n||t[4]!==d?(h=()=>()=>({editor:new Ja(dF({provider:n,placeholder:r,clipboard:m,ctorStart:performance.now(),onWedged:e=>{let{externalSeq:t,appliedSeq:n}=e;yp(`ok/editor/binding-wedge-recycle`,{docName:p,externalSeq:t,appliedSeq:n}),d(p)}})),ydoc:n.document,ytext:n.document.getText(`source`),provider:n}),t[0]=m,t[1]=p,t[2]=r,t[3]=n,t[4]=d,t[5]=h):h=t[5];let[g]=(0,Q.useState)(h),_,v;if(t[6]!==g||t[7]!==p||t[8]!==n.document){let e={viewCount:0,bytes:n.document.getText(`source`).length},r=f(p)??xo();_=Q.use,v=P({docName:p,mountId:r,construct:g,sizeStats:e}),t[6]=g,t[7]=p,t[8]=n.document,t[9]=_,t[10]=v}else _=t[9],v=t[10];let y=_(v),b=y.editor,x,S;t[11]===y?(x=t[12],S=t[13]):(x=()=>()=>{_t(y)},S=[y],t[11]=y,t[12]=x,t[13]=S),(0,Q.useEffect)(x,S);let C;return t[14]!==u||t[15]!==p||t[16]!==b||t[17]!==c||t[18]!==i||t[19]!==a||t[20]!==l||t[21]!==n?(C=(0,Z.jsx)(pF,{provider:n,isSourceMode:i,docName:p,activeDocName:u,identity:c,principal:l,editor:b,wrapperRef:o,flashStateRef:s,portalTarget:a}),t[14]=u,t[15]=p,t[16]=b,t[17]=c,t[18]=i,t[19]=a,t[20]=l,t[21]=n,t[22]=C):C=t[22],C},pF=e=>{let t=(0,$.c)(133),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:s,editor:c,wrapperRef:l,flashStateRef:u,portalTarget:d}=e,f=(0,Q.useRef)(null),[p,m]=(0,Q.useState)(0),h,g;t[0]===d?(h=t[1],g=t[2]):(h=()=>{let e=f.current;if(e)return e.appendChild(d),()=>{d.parentNode===e&&e.removeChild(d)}},g=[d],t[0]=d,t[1]=h,t[2]=g),(0,Q.useLayoutEffect)(h,g);let _,v;t[3]!==c||t[4]!==d?(_=()=>{oF(c,d)&&m(mF)},v=[c,d],t[3]=c,t[4]=d,t[5]=_,t[6]=v):(_=t[5],v=t[6]),(0,Q.useEffect)(_,v);let y;t[7]!==c||t[8]!==n.configuration.name?(y=()=>(Vr(c,n.configuration.name??null),()=>{Vr(c,null)}),t[7]=c,t[8]=n.configuration.name,t[9]=y):y=t[9];let b;t[10]!==c||t[11]!==n?(b=[c,n],t[10]=c,t[11]=n,t[12]=b):b=t[12],(0,Q.useEffect)(y,b);let x;t[13]!==c||t[14]!==n.configuration.name?(x=()=>{let e=n.configuration.name;if(e)return Ut(e,c),()=>Ne(e,c)},t[13]=c,t[14]=n.configuration.name,t[15]=x):x=t[15];let S;t[16]!==c||t[17]!==n?(S=[c,n],t[16]=c,t[17]=n,t[18]=S):S=t[18],(0,Q.useEffect)(x,S);let C;t[19]!==c||t[20]!==r||t[21]!==n.configuration.name||t[22]!==n.document?(C=()=>{if(r)return;let e=n.configuration.name;if(!e||!Ql(e))return;let t=!1,i=null,a=()=>{queueMicrotask(()=>{if(t)return;let r=Yl(e);r?.kind===`selection-offset`&&(i=Zl({editor:c,docName:e,navigation:r,ydoc:n.document,transition:{from:`source`,to:`wysiwyg`}}))})};return Lr(c)?a():c.on(`create`,a),()=>{t=!0,c.off(`create`,a),i?.cancel(`mode-flip`)}},t[19]=c,t[20]=r,t[21]=n.configuration.name,t[22]=n.document,t[23]=C):C=t[23];let w;t[24]!==c||t[25]!==r||t[26]!==n?(w=[c,n,r],t[24]=c,t[25]=r,t[26]=n,t[27]=w):w=t[27],(0,Q.useEffect)(C,w);let T;t[28]!==c||t[29]!==n.configuration.name?(T=()=>{let e=n.configuration.name;if(!e)return;let t=null,r=()=>{t=null,hu(e,`wysiwyg`,du(c)),Sm(e,`wysiwyg`,Cm(c,e))},i=()=>{t&&clearTimeout(t),t=setTimeout(r,120)};return r(),c.on(`selectionUpdate`,i),c.on(`update`,i),()=>{t&&clearTimeout(t),c.off(`selectionUpdate`,i),c.off(`update`,i),hu(e,`wysiwyg`,null),Sm(e,`wysiwyg`,null)}},t[28]=c,t[29]=n.configuration.name,t[30]=T):T=t[30];let E;t[31]!==c||t[32]!==n?(E=[c,n],t[31]=c,t[32]=n,t[33]=E):E=t[33],(0,Q.useEffect)(T,E);let D;t[34]!==c||t[35]!==n.configuration.name?(D=()=>{},t[34]=c,t[35]=n.configuration.name,t[36]=D):D=t[36];let O;t[37]!==c||t[38]!==n?(O=[c,n],t[37]=c,t[38]=n,t[39]=O):O=t[39],(0,Q.useEffect)(D,O);let k,A;t[40]===c?(k=t[41],A=t[42]):(k=()=>{let e=hF,t=null,n=()=>{if(t||c.isDestroyed)return;let n=Lr(c);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 Lr(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},A=[c],t[40]=c,t[41]=k,t[42]=A),(0,Q.useEffect)(k,A);let j;t[43]!==c||t[44]!==n.configuration.name?(j=()=>{let e=n.configuration.name;if(!e)return;let t=t=>{let{transaction:n}=t;Ft(n)&&Le(e)};return c.on(`transaction`,t),()=>{c.off(`transaction`,t)}},t[43]=c,t[44]=n.configuration.name,t[45]=j):j=t[45];let M;t[46]!==c||t[47]!==n?(M=[c,n],t[46]=c,t[47]=n,t[48]=M):M=t[48],(0,Q.useEffect)(j,M);let N,P;t[49]!==i||t[50]!==c?(N=()=>{let e=!1,t=()=>{if(e||c.isDestroyed||!Lr(c))return;e=!0;let t=et(i)?.selection??null;if(t)try{let e=c.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));c.commands.setTextSelection({from:n,to:r})}else{let n=Math.max(0,Math.min(t.from,e));c.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})),yp(`ok/editor/selection-restore-failed`,{docName:i,message:n})}Be(i)};if(Lr(c)){t();return}return c.on(`create`,t),()=>{c.off(`create`,t)}},P=[c,i],t[49]=i,t[50]=c,t[51]=N,t[52]=P):(N=t[51],P=t[52]),(0,Q.useEffect)(N,P);let F,I;t[53]!==u||t[54]!==n.document||t[55]!==l?(F=()=>{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=>{u.current=e;let t=l.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??``))},d=()=>{let e=s(),t=e?.description?.toLowerCase().includes(`prepend`)?`prepend`:`append`,n={state:`editing`,count:(u.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)},ma)};c($P);let f=()=>{if(eo(e),!lo(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(),d()},e)}return}r=n,d()};e.observe(f);let p=()=>{document.visibilityState===`visible`?lo(e,t)&&(t=Date.now(),r=Date.now(),d()):t=Date.now()};return document.addEventListener(`visibilitychange`,p),()=>{e.unobserve(f),document.removeEventListener(`visibilitychange`,p),i&&clearTimeout(i),a&&clearTimeout(a),o&&clearTimeout(o)}},I=[n.document,u,l],t[53]=u,t[54]=n.document,t[55]=l,t[56]=F,t[57]=I):(F=t[56],I=t[57]),(0,Q.useEffect)(F,I);let L=(0,Q.useRef)(null),R;t[58]!==a||t[59]!==i||t[60]!==c||t[61]!==n?(R=()=>{let e=DP(),t=n.document.getMap(`agent-flash`),r=null,o=!1;queueMicrotask(()=>{o||c.isDestroyed||c.registerPlugin(e)});let s=[],l=()=>c.editorView??null,u=(e,t,n)=>{if(e.dispatch(e.state.tr.setMeta(wP,{add:{from:t,to:n},now:Date.now()})),r!==null&&clearTimeout(r),r=window.setTimeout(()=>{r=null;let e=l();e?.dispatch(e.state.tr.setMeta(wP,{now:Date.now(),sweep:!0}))},CP+50),!of()||document.visibilityState!==`visible`||e.hasFocus())return;let a=()=>{let e=l();if(!(e==null||e.hasFocus()||document.visibilityState!==`visible`)&&!ce(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(Se)?.isChangeOrigin!==!0||!lo(t,Date.now()-1400)||i!==a)return;let r=eF(t,Date.now()-CP);if(r!==null&&r.key===L.current)return;let o=TP(n.before,n.doc);if(o===null)return;let s=l();s!=null&&(r!==null&&(L.current=r.key),u(s,o.from,o.to))};c.on(`transaction`,d);let f=()=>{if(o||i!==a)return;let e=l();if(e==null)return;let n=eF(t,Date.now()-EP);if(n===null||n.key===L.current)return;let r=n.entry.changedBlocks;if(r===void 0)return;let s=$l(e.state.doc,r.from,r.to);s!==null&&(L.current=n.key,u(e,s.from,s.to))},p=requestAnimationFrame(f),m=()=>{requestAnimationFrame(f)};return n.on(`synced`,m),()=>{o=!0,c.off(`transaction`,d),n.off(`synced`,m),cancelAnimationFrame(p),r!==null&&clearTimeout(r);for(let e of s)clearTimeout(e);c.unregisterPlugin(wP)}},t[58]=a,t[59]=i,t[60]=c,t[61]=n,t[62]=R):R=t[62];let z;t[63]!==a||t[64]!==i||t[65]!==c||t[66]!==n.document||t[67]!==n.off||t[68]!==n.on?(z=[c,n.document,i,a,n.on,n.off],t[63]=a,t[64]=i,t[65]=c,t[66]=n.document,t[67]=n.off,t[68]=n.on,t[69]=z):z=t[69],(0,Q.useEffect)(R,z);let B,V;t[70]!==a||t[71]!==i||t[72]!==c||t[73]!==r||t[74]!==n?(B=()=>{if(r)return;let e=0,t,o=null,s=null,l=null,u=function(){if(e<tF){e+=1,t=window.setTimeout(m,nF);return}o=null,s=null,e=0},d=function(e){let t=Lr(c);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?fe(i,()=>{t.scrollIntoView({behavior:`smooth`,block:`start`})}):!1},p=function(e,n){let r=rF,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(f(e),--r,r>0&&(t=window.setTimeout(o,iF)))};t=window.setTimeout(o,iF)};function m(){if(!o||i!==a)return;let t=o,n=s;if(!n){u();return}f(t)?(l=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&&l===n)return;let r=Ef(n);if(!r){l=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),c.on(`transaction`,g),window.addEventListener(`hashchange`,h),()=>{t!==void 0&&clearTimeout(t),n.off(`synced`,g),c.off(`transaction`,g),window.removeEventListener(`hashchange`,h)}},V=[n,c,i,a,r],t[70]=a,t[71]=i,t[72]=c,t[73]=r,t[74]=n,t[75]=B,t[76]=V):(B=t[75],V=t[76]),(0,Q.useEffect)(B,V);let H,U;t[77]!==i||t[78]!==c?(H=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==i||t.mode!==`wysiwyg`||c.isDestroyed)return;let n=Lr(c);if(!n)return;let r=n.dom.querySelectorAll(`h1, h2, h3, h4, h5, h6`)[t.index];r&&fe(i,()=>{r.scrollIntoView({behavior:`smooth`,block:`start`})})};return window.addEventListener(ou,e),()=>window.removeEventListener(ou,e)},U=[c,i],t[77]=i,t[78]=c,t[79]=H,t[80]=U):(H=t[79],U=t[80]),(0,Q.useEffect)(H,U);let W;t[81]!==a||t[82]!==i||t[83]!==o||t[84]!==r||t[85]!==s||t[86]!==n.awareness?(W=()=>{let e=n.awareness;if(!e)return;if(i!==a){e.setLocalState(null);return}e.setLocalState({user:eM({principal:s,identity:o}),mode:r?`source`:`wysiwyg`});let t=$j();return t.start(),t.setAwareness(e),()=>t.clearAwareness(e)},t[81]=a,t[82]=i,t[83]=o,t[84]=r,t[85]=s,t[86]=n.awareness,t[87]=W):W=t[87];let ee;t[88]!==a||t[89]!==i||t[90]!==o||t[91]!==r||t[92]!==s||t[93]!==n?(ee=[n,i,a,o,s,r],t[88]=a,t[89]=i,t[90]=o,t[91]=r,t[92]=s,t[93]=n,t[94]=ee):ee=t[94],(0,Q.useEffect)(W,ee);let G,K;t[95]!==c||t[96]!==r?(G=()=>(Dr(c,r),()=>{Dr(c,!1)}),K=[c,r],t[95]=c,t[96]=r,t[97]=G,t[98]=K):(G=t[97],K=t[98]),(0,Q.useEffect)(G,K);let q;t[99]!==a||t[100]!==i||t[101]!==c||t[102]!==r?(q=!r&&(0,Z.jsx)(ZN,{editor:c,shortcutEnabled:i===a}),t[99]=a,t[100]=i,t[101]=c,t[102]=r,t[103]=q):q=t[103];let J;t[104]!==a||t[105]!==i||t[106]!==c||t[107]!==r?(J=!r&&(0,Z.jsxs)(Cj,{children:[(0,Z.jsx)(xj,{editor:c,docName:i,shortcutEnabled:i===a}),(0,Z.jsx)(dj,{editor:c,docName:i}),(0,Z.jsx)(Tj,{editor:c,docName:i}),i===a&&(0,Z.jsx)(vj,{editor:c,docName:i})]}),t[104]=a,t[105]=i,t[106]=c,t[107]=r,t[108]=J):J=t[108];let ne;t[109]!==c||t[110]!==r?(ne=!r&&(0,Z.jsx)(YP,{editor:c}),t[109]=c,t[110]=r,t[111]=ne):ne=t[111];let re;t[112]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(`div`,{ref:f,style:{display:`contents`}}),t[112]=re):re=t[112];let ie;t[113]!==c||t[114]!==p?(ie=(0,Z.jsx)(Sr,{editor:c,className:`tiptap-editor-portal-content h-full`},p),t[113]=c,t[114]=p,t[115]=ie):ie=t[115];let ae;t[116]!==d||t[117]!==ie?(ae=(0,Pg.createPortal)(ie,d),t[116]=d,t[117]=ie,t[118]=ae):ae=t[118];let oe;t[119]===c?oe=t[120]:(oe=(0,Z.jsx)(nj,{editor:c}),t[119]=c,t[120]=oe);let se;t[121]===c?se=t[122]:(se=Ce(c),t[121]=c,t[122]=se);let le;t[123]===se.store?le=t[124]:(le=(0,Z.jsx)(te,{store:se.store}),t[123]=se.store,t[124]=le);let ue;return t[125]!==q||t[126]!==J||t[127]!==ne||t[128]!==ae||t[129]!==oe||t[130]!==le||t[131]!==l?(ue=(0,Z.jsxs)(`div`,{ref:l,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:[q,J,ne,re,ae,oe,le]}),t[125]=q,t[126]=J,t[127]=ne,t[128]=ae,t[129]=oe,t[130]=le,t[131]=l,t[132]=ue):ue=t[132],ue};function mF(e){return e+1}function hF(){return Tr()}async function gF(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 _F(e,t){return gF(e,`content`,t)}async function vF(e){return gF(e,`mine`)}async function yF(e){return gF(e,`theirs`)}async function bF(e){return gF(e,`delete`)}async function xF(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 SF(e){let t=(0,$.c)(86),{docName:n}=e,{_:r}=on(),{conflicts:i,loading:a}=Uu(),o;if(t[0]!==i||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>Af(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=Sh(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),xF(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 _F(c,e);t.ok||Ns.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),Ns.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)(Ch,{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(bF),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(yF),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)(Ch,{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(vF),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(bF),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)(Ch,{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 CF(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(ht(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 wF=`__back-nav__`;function TF(e){return e instanceof We||e instanceof zt||e instanceof dt||e instanceof Fe||e instanceof Re||e instanceof q?e.docName:null}function EF(e){return e instanceof We||e instanceof zt}function DF(e){if(e instanceof We){let t=e.docName;return{title:Ms._({id:`Jejur6`}),summary:Ms._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof zt){let t=e.docName;return{title:Ms._({id:`V7QxyT`}),summary:Ms._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof dt){let t=e.docName;return{title:Ms._({id:`1di5fu`}),summary:Ms._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof Fe){let t=e.docName;return{title:Ms._({id:`wvbc1r`}),summary:Ms._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof Re)return{title:Ms._({id:`Gfr4fu`}),summary:Ms._({id:`UW2Fg3`})};if(e instanceof q){let t=e.docName;return{title:Ms._({id:`vv7kpg`}),summary:Ms._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:Ms._({id:`W5A0Ly`});return{title:Ms._({id:`29VNqC`}),summary:t}}function OF(e){let t=(0,$.c)(41),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,s;t[0]===n?s=t[1]:(s=DF(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=typeof window<`u`?window.okDesktop:void 0,h=m&&EF(n)?m:null,g,_;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{d.current?.focus()},_=[],t[2]=g,t[3]=_):(g=t[2],_=t[3]),(0,Q.useEffect)(g,_);let v;t[4]===n?v=t[5]:(v=EF(n),t[4]=n,t[5]=v);let y;t[6]===v?y=t[7]:(y=(0,Z.jsx)(q_,{keyboard:v}),t[6]=v,t[7]=y);let b;t[8]===c?b=t[9]:(b=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:c}),t[8]=c,t[9]=b);let x;t[10]===l?x=t[11]:(x=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:l}),t[10]=l,t[11]=x);let S;t[12]!==b||t[13]!==x?(S=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[b,x]}),t[12]=b,t[13]=x,t[14]=S):S=t[14];let C;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(Y,{id:`KDw4GX`}),t[15]=C):C=t[15];let w;t[16]===r?w=t[17]:(w=(0,Z.jsx)(X,{ref:d,variant:`default`,onClick:r,children:C}),t[16]=r,t[17]=w);let T;t[18]===h?T=t[19]:(T=h?(0,Z.jsx)(X,{variant:`outline-mono`,onClick:()=>{ES(h).then(AF).catch(kF)},children:(0,Z.jsx)(Y,{id:`uaUc6t`})}):null,t[18]=h,t[19]=T);let E;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(E=m?(0,Z.jsx)(X,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>p(!0),children:(0,Z.jsx)(Y,{id:`ii5mVn`})}):null,t[20]=E):E=t[20];let D;t[21]!==i||t[22]!==u||t[23]!==n||t[24]!==o||t[25]!==a||t[26]!==r?(D=u?(0,Z.jsx)(X,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(Ct(TF(n)??i),o(a),r(wF))},children:(0,Z.jsx)(Y,{id:`CKyk7Q`})}):null,t[21]=i,t[22]=u,t[23]=n,t[24]=o,t[25]=a,t[26]=r,t[27]=D):D=t[27];let O;t[28]!==w||t[29]!==T||t[30]!==D?(O=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[w,T,E,D]}),t[28]=w,t[29]=T,t[30]=D,t[31]=O):O=t[31];let k;t[32]!==i||t[33]!==n||t[34]!==f?(k=m?(0,Z.jsx)($_,{open:f,onOpenChange:p,crashContext:{source:`document view`,docName:TF(n)??i,errorMessage:n instanceof Error&&n.message?n.message:String(n),componentStack:rv(n)}}):null,t[32]=i,t[33]=n,t[34]=f,t[35]=k):k=t[35];let A;return t[36]!==O||t[37]!==k||t[38]!==y||t[39]!==S?(A=(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:[y,S,O,k]}),t[36]=O,t[37]=k,t[38]=y,t[39]=S,t[40]=A):A=t[40],A}function kF(){}function AF(e){e.ok||Ns.error(e.message,{id:`server-restart-error`,duration:1/0})}function jF(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)(OF,{...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]===wF){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)=>{nv(e,t.componentStack),console.error(`[DocumentErrorBoundary] rendered fallback for ${n}: ${DF(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)(Pn,{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 MF(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Qo(t);return{map:n,keys:zo(t),parseError:r}}function NF(e){let t=(0,$.c)(29),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>MF(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=Vt(ko(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=ae(i.map.icon),t[5]=i.map.icon,t[6]=l);let u=l,d;t[7]===i.map?d=t[8]:(d=Me(i.map),t[7]=i.map,t[8]=d);let f=d,p;t[9]!==f||t[10]!==i.map?(p=f?Yt(i.map[f]):{kind:`unsupported`,value:``},t[9]=f,t[10]=i.map,t[11]=p):p=t[11];let m=p,h;t[12]!==f||t[13]!==i.map?(h=f?Qt(i.map[`${f}_y`]):null,t[12]=f,t[13]=i.map,t[14]=h):h=t[14];let g=h,_=m.kind===`url`||m.kind===`path`,v=u.kind!==`unsupported`;if(!_&&!v)return null;let y=_?`true`:`false`,b=v?`true`:`false`,x;t[15]!==m||t[16]!==f||t[17]!==g||t[18]!==_?(x=_&&f?(0,Z.jsx)(PF,{cover:m,focalY:g,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]=m,t[16]=f,t[17]=g,t[18]=_,t[19]=x):x=t[19];let S;t[20]!==_||t[21]!==v||t[22]!==u?(S=v?(0,Z.jsx)(FF,{icon:u,hasCover:_}):null,t[20]=_,t[21]=v,t[22]=u,t[23]=S):S=t[23];let C;return t[24]!==x||t[25]!==S||t[26]!==y||t[27]!==b?(C=(0,Z.jsxs)(`div`,{className:`page-header editor-content-aligned`,"data-has-cover":y,"data-has-icon":b,"data-testid":`page-header`,children:[x,S]}),t[24]=x,t[25]=S,t[26]=y,t[27]=b,t[28]=C):C=t[28],C}function PF(e){let t=(0,$.c)(59),{cover:n,focalY:r,onCommitFocalY:i}=e,{_:a}=on(),[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=Ht(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 FF(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 IF=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{ManagedArtifactProperties:e}=await import(`./ManagedArtifactProperties-CaU-7RSA.js`);return{ManagedArtifactProperties:e}},__vite__mapDeps([162,163,1,2,134,18,14,6,3,7,8,9,10,11,12,13,97,35,36,16,17,20,54,28,29,34,24,25,26,19,22,21,40,98,15,23,39,137,138,55,105,99,79,80,81,82,83,84,85,86,87,88,89,90,91,45,74,92,93,94,95,96,4,27,30,31,100,101,41,42,66,67,68,69,102,49,71,103,104,46,33,65,70,72,73,106,107,108,37,109,110,43,47,111,112,113,164,165,145,166,48,167,158,130]),import.meta.url)).ManagedArtifactProperties})),LF=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{MermaidDocEditor:e}=await import(`./MermaidDocEditor-DbdolXNy.js`);return{MermaidDocEditor:e}},__vite__mapDeps([168,1,80,81,11,91,2,6,3,7,8,9,10,45,74,14,24,13,92,18,93,94,95,96,12,101,82,83,84,85,86,87,88,89,90,36,22,41,42,66,67,68,69,102,49,71,169,170,104,30,17,26,25,46,171,77]),import.meta.url)).MermaidDocEditor})),RF=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{TextDocEditor:e}=await import(`./TextDocEditor-DxhziylX.js`);return{TextDocEditor:e}},__vite__mapDeps([172,1,80,81,11,6,2,3,7,8,9,10,91,45,74,14,24,13,92,18,93,94,95,96,12,101,82,83,84,85,86,87,88,89,90,36,22,41,42,66,67,68,69,102,49,71,169,170,171,173]),import.meta.url)).TextDocEditor})),zF=xp(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function BF(e){let t=e.threshold??zF;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function VF(e){return e.hasEmittedFirstToggle||!e.isActive||!e.isLarge?!1:e.renderSource&&e.renderVisual}function HF(e,t,n){return e?t:n}function UF(e){let{docName:t,pages:n,loading:r}=e;return!r&&!n.has(t)&&!Co(t)&&co(t)===null&&!za(t)&&!Za(t)}var WF=xp(`ACTIVITY_MOUNT_LIMIT`,3);function GF(){return n(()=>import(`./SourceEditor-BXsOQKW8.js`),__vite__mapDeps([174,1,86,81,11,80,170,6,2,3,7,8,9,10,91,45,74,14,24,13,92,18,93,94,95,96,79,82,83,84,85,87,88,89,90,36,12,4,97,35,16,17,20,54,28,29,34,25,26,19,22,21,40,98,39,27,30,31,99,100,101,41,42,66,67,68,69,102,49,71,103,104,46,105,33,65,70,72,73,106,107,108,37,23,109,110,43,47,111,112,113,175,53,55,56,146,176,155,76,128,158,161,171,167]),import.meta.url)}var KF=(0,Q.lazy)(async()=>({default:(await GF()).SourceEditor}));function qF(e,t,n){if(n<=0)return[];let r=e.filter(e=>!qe(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=>!qe(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 JF(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:Ms._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?Ms._({id:`Sc1bKE`,values:{docName:e}}):Ms._({id:`ovIGrT`,values:{docName:e}}),actionLabel:Ms._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:Ms._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?Ms._({id:`bmC18N`,values:{docName:e}}):Ms._({id:`pAgkuZ`,values:{docName:e}})}:null}function YF(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(bp,{name:`activity-pool`,children:(0,Z.jsx)(XF,{...e})}),t[0]=e,t[1]=n),n}function XF(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}=Oe(),{pages:m,loading:h}=Eu(),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=qF(f,_,WF),y=(0,Q.useRef)(``),b=v.map(ZF).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)rn(e);for(let e of i){let t=x.current.find(t=>t.docName===e)?.poolEventId;he(e,t&&t.length>0?t:xo())}yp(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),y.current=b,Xe(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)(QF,{docName:e.docName,hostMount:i?.get(e.docName)??a??null,children:(0,Z.jsx)(iI,{entry:e,isVisible:_.has(e.docName),toolbar:_.has(e.docName)?o?.(e.docName,e.provider):null,isSourceMode:s,editorPlaceholder:c,isNewDoc:UF({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 ZF(e){return e.docName}function QF(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,Pg.createPortal)(i,o),t[6]=i,t[7]=o,t[8]=r,t[9]=l):l=t[9],l}function $F(e){let t=(0,$.c)(18),{isActive:n,docName:r,mode:i,initialScrollTop:a,bodyAnchorRef:o,children:s}=e,c=(0,Q.useRef)(null),l=(0,Q.useRef)(a??0),d=(0,Q.useRef)(null),f=(0,Q.useRef)(n),p=(0,Q.useRef)(!1),m,h;t[0]===n?(m=t[1],h=t[2]):(m=()=>{f.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,y;t[3]===i?(v=t[4],y=t[5]):(v=()=>{g.current=i},y=[i],t[3]=i,t[4]=v,t[5]=y),(0,Q.useLayoutEffect)(v,y);let b,x;t[6]!==o||t[7]!==r?(b=()=>{let e=c.current;if(!e)return;let t=()=>{if(!(!f.current||p.current)&&e.scrollTop>0){let t=R(e,o?.current);if(!H(t))return;l.current=e.scrollTop,d.current=t.kind===`measured`?t.contentPos:null,t.kind===`measured`&&Jt(r,{offset:e.scrollTop-t.contentPos,mode:g.current,fraction:_(e.scrollTop,e.scrollHeight,e.clientHeight)})}};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},x=[o,r],t[6]=o,t[7]=r,t[8]=b,t[9]=x):(b=t[8],x=t[9]),(0,Q.useEffect)(b,x);let S,C;t[10]!==o||t[11]!==r||t[12]!==n?(S=()=>{if(!n)return;let e=c.current;if(!e||ce(r))return;let t=Zt(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),yp(`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});return}let i=l.current,a=t?.offset,s=d.current===null?null:i-d.current,f=a??s;if(i===0&&f===null)return;let m=()=>ut(i,f,R(e,o?.current));p.current=!0;let h=e.style.overflowAnchor;e.style.overflowAnchor=`none`;let _=performance.now(),v=!1,y=!1,b=m();b!==null&&(e.scrollTop=b,u(e.scrollTop,b)&&e.scrollHeight>b&&(y=!0,yp(`ok/scroll-restore/phase1-success`,{target:b,elapsedMs:performance.now()-_})));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||yp(`ok/scroll-restore/yielded`,{reason:`user`,elapsedMs:performance.now()-_,finalScrollTop:e.scrollTop}),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){if(ce(r)){y||yp(`ok/scroll-restore/yielded`,{reason:`landing`,elapsedMs:performance.now()-_,finalScrollTop:e.scrollTop}),w();return}if(ot(x,e.scrollTop)){y||yp(`ok/scroll-restore/yielded`,{reason:`external`,elapsedMs:performance.now()-_,finalScrollTop:e.scrollTop}),w();return}b=m(),b!==null&&!u(e.scrollTop,b)&&e.scrollHeight>b&&(e.scrollTop=b,u(e.scrollTop,b)&&!v&&(yp(`ok/scroll-restore/phase2-success`,{target:b,elapsedMs:performance.now()-_}),v=!0,y=!0)),x=e.scrollTop,C=requestAnimationFrame(E)}};C=requestAnimationFrame(E);let D=setTimeout(()=>{if(S)return;let t=m();(t===null||!u(e.scrollTop,t)&&e.scrollHeight>t)&&yp(`ok/scroll-restore/abandoned`,{...t===null?{}:{target:t},anchorMeasurable:t!==null,elapsedMs:performance.now()-_,scrollHeight:e.scrollHeight,finalScrollTop:e.scrollTop}),w()},ee);return w},C=[n,o,r],t[10]=o,t[11]=r,t[12]=n,t[13]=S,t[14]=C):(S=t[13],C=t[14]),(0,Q.useLayoutEffect)(S,C);let w;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(w={overflowAnchor:`auto`},t[15]=w):w=t[15];let T;return t[16]===s?T=t[17]:(T=(0,Z.jsx)(`div`,{ref:c,"data-testid":`editor-scroll-container`,className:`editor-doc-scroll subtle-scrollbar h-full overflow-y-auto pt-14 scroll-pt-14`,style:w,children:s}),t[16]=s,t[17]=T),T}function eI(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)(VE,{}),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)(KF,{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 tI(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)(Qd,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(xd,{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:nI,children:[(0,Z.jsx)(Qd,{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 nI(){return window.location.reload()}function rI(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 iI(e){let t=(0,$.c)(73),{entry:n,isVisible:r,toolbar:i,isSourceMode:a,editorPlaceholder:o,isNewDoc:s,previousDocName:c,onNavigateBack:l,onRecycle:u,serverRestartRecovery:d}=e,p;t[0]!==n.docName||t[1]!==d?(p=JF(n.docName,d),t[0]=n.docName,t[1]=d,t[2]=p):p=t[2];let m=p,h=Ik(n.docName)===`conflict`,g;t[3]===n.docName?g=t[4]:(g=za(n.docName),t[3]=n.docName,t[4]=g);let _=g,v;t[5]!==n.docName||t[6]!==_?(v=!_&&Za(n.docName),t[5]=n.docName,t[6]=_,t[7]=v):v=t[7];let y=v,b;t[8]===n.docName?b=t[9]:(b=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-portal`,n.docName),e.style.display=`contents`,e},t[8]=n.docName,t[9]=b);let[x]=(0,Q.useState)(b),S=(0,Q.useRef)(null),C=n.provider.document.getText(`source`).length,[w,T]=(0,Q.useState)(a),E,D;t[10]!==a||t[11]!==r||t[12]!==w?(E=()=>{r&&w!==a&&T(a)},D=[r,a,w],t[10]=a,t[11]=r,t[12]=w,t[13]=E,t[14]=D):(E=t[13],D=t[14]),(0,Q.useEffect)(E,D);let O;t[15]!==a||t[16]!==r||t[17]!==w?(O=HF(r,a,w),t[15]=a,t[16]=r,t[17]=w,t[18]=O):O=t[18];let k=O,[A,j]=(0,Q.useState)(k),[M,N]=(0,Q.useState)(!k),P,F;t[19]!==k||t[20]!==A||t[21]!==M?(P=()=>{k&&!A?j(!0):!k&&!M&&N(!0)},F=[k,A,M],t[19]=k,t[20]=A,t[21]=M,t[22]=P,t[23]=F):(P=t[22],F=t[23]),(0,Q.useEffect)(P,F);let I=BF({ytextLength:C,isSourceMode:k,visitedSource:A,visitedVisual:M}),L=(0,Q.useRef)(``),R=`${I.isLarge}-${I.renderSource}-${I.renderVisual}`,z,B;t[24]!==k||t[25]!==n.docName||t[26]!==I.isLarge||t[27]!==I.renderSource||t[28]!==I.renderVisual||t[29]!==R||t[30]!==C?(z=()=>{L.current!==R&&(L.current=R,I.isLarge&&yp(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:C,isSourceMode:k,renderSource:I.renderSource,renderVisual:I.renderVisual}))},B=[R,I.isLarge,I.renderSource,I.renderVisual,n.docName,C,k],t[24]=k,t[25]=n.docName,t[26]=I.isLarge,t[27]=I.renderSource,t[28]=I.renderVisual,t[29]=R,t[30]=C,t[31]=z,t[32]=B):(z=t[31],B=t[32]),(0,Q.useEffect)(z,B);let V;t[33]===n.docName?V=t[34]:(V=()=>et(n.docName),t[33]=n.docName,t[34]=V);let[H]=(0,Q.useState)(V),U=H?.html??null,[W,ee]=(0,Q.useState)(!1),G,K;t[35]!==k||t[36]!==n.docName||t[37]!==I.isLarge||t[38]!==I.renderSource||t[39]!==I.renderVisual||t[40]!==W||t[41]!==r||t[42]!==C?(G=()=>{VF({isActive:r,isLarge:I.isLarge,renderSource:I.renderSource,renderVisual:I.renderVisual,hasEmittedFirstToggle:W})&&(yp(`ok/cold/first-toggle`,{docName:n.docName,mountId:f(n.docName),ytextLength:C,modeEnteredFirst:k?`source`:`visual`}),ee(!0))},K=[W,r,I.isLarge,I.renderSource,I.renderVisual,n.docName,C,k],t[35]=k,t[36]=n.docName,t[37]=I.isLarge,t[38]=I.renderSource,t[39]=I.renderVisual,t[40]=W,t[41]=r,t[42]=C,t[43]=G,t[44]=K):(G=t[43],K=t[44]),(0,Q.useEffect)(G,K);let q=r?`visible`:`hidden`,te=`editor:${n.docName}`,J=k?`source`:`wysiwyg`,ne=H?.scrollTop,re;t[45]!==o||t[46]!==k||t[47]!==n||t[48]!==I.renderSource||t[49]!==I.renderVisual||t[50]!==h||t[51]!==_||t[52]!==s||t[53]!==y||t[54]!==r||t[55]!==l||t[56]!==u||t[57]!==x||t[58]!==c||t[59]!==m||t[60]!==U?(re=m?(0,Z.jsx)(tI,{view:m}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(jF,{activeDocName:n.docName,previousDocName:c,onNavigateBack:l,onRecycle:u,children:(0,Z.jsx)(Q.Suspense,{fallback:U?(0,Z.jsx)(rI,{html:U}):(0,Z.jsx)(VE,{}),children:(0,Z.jsx)(CF,{docName:n.docName,provider:n.provider,children:h?(0,Z.jsx)(SF,{docName:n.docName,provider:n.provider}):_?(0,Z.jsx)(LF,{docName:n.docName,provider:n.provider,isSourceMode:k}):y?(0,Z.jsx)(RF,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!k&&(Co(n.docName)||ep(n.docName)||co(n.docName)?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(IF,{docName:n.docName,provider:n.provider})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(NF,{provider:n.provider}),(0,Z.jsx)(Ml,{provider:n.provider})]})),(0,Z.jsx)(`div`,{ref:S,"aria-hidden":!0,className:`h-0`,[Gt]:``}),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[I.renderSource?(0,Z.jsx)(`div`,{className:k?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(eI,{entry:n,isActive:r,isSourceMode:k,editorPlaceholder:o})}):null,I.renderVisual?(0,Z.jsx)(`div`,{className:k?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(fF,{provider:n.provider,placeholder:o,isSourceMode:k,portalTarget:x},`${n.docName}-${String(s)}-${n.poolEventId}`)}):null]})]})})})})}),t[45]=o,t[46]=k,t[47]=n,t[48]=I.renderSource,t[49]=I.renderVisual,t[50]=h,t[51]=_,t[52]=s,t[53]=y,t[54]=r,t[55]=l,t[56]=u,t[57]=x,t[58]=c,t[59]=m,t[60]=U,t[61]=re):re=t[61];let ie;t[62]!==n.docName||t[63]!==r||t[64]!==J||t[65]!==ne||t[66]!==re?(ie=(0,Z.jsx)($F,{isActive:r,docName:n.docName,mode:J,initialScrollTop:ne,bodyAnchorRef:S,children:re}),t[62]=n.docName,t[63]=r,t[64]=J,t[65]=ne,t[66]=re,t[67]=ie):ie=t[67];let ae;return t[68]!==q||t[69]!==te||t[70]!==ie||t[71]!==i?(ae=(0,Z.jsxs)(Q.Activity,{mode:q,name:te,children:[ie,i]}),t[68]=q,t[69]=te,t[70]=ie,t[71]=i,t[72]=ae):ae=t[72],ae}function aI(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function oI(e){let{value:t,unit:n}=aI(e);return n===`rem`?t*16:t}function sI(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var cI=3600*24*7;function lI(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?uI:m,O=g===void 0?cI: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),H=(0,Q.useRef)(y),U,W;t[0]===r?(U=t[1],W=t[2]):(U=()=>{V.current=r},W=[r],t[0]=r,t[1]=U,t[2]=W),(0,Q.useEffect)(U,W);let ee,G;t[3]===y?(ee=t[4],G=t[5]):(ee=()=>{H.current=y},G=[y],t[3]=y,t[4]=ee,t[5]=G),(0,Q.useEffect)(ee,G);let K=oI(b),q;t[6]===x?q=t[7]:(q=oI(x),t[6]=x,t[7]=q);let te=q,J;t[8]!==E||t[9]!==k?(J=function(e){E&&(P.current=!0,j.current=H.current?0:oI(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]=J):J=t[10];let ne=J,re,ie;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==te||t[18]!==K||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(re=()=>{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}=aI(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&&!H.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=K*w;else if(e<=K){let n=K*(w-1);t=K-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&H.current&&c===`expand`&&z.current>K*T){a();let t=n(r,M.current,j.current,s),c=Math.max(K,Math.min(te,t)),u=sI(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(H.current)return;let u=n(r,M.current,j.current,s),d=Math.max(K,Math.min(te,u)),f=sI(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)}},ie=[i,a,D,K,te,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]=te,t[18]=K,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=re,t[25]=ie):(re=t[24],ie=t[25]),(0,Q.useEffect)(re,ie);let ae;return t[26]===ne?ae=t[27]:(ae={dragRef:A,isDragging:N,handleMouseDown:ne},t[26]=ne,t[27]=ae),ae}function uI(){}var dI=3600*24*7,fI=`18rem`,pI=`3rem`,mI=`app-file-sidebar`,hI=`14.625rem`,gI=`32rem`,_I=`sidebar_width`,vI=/^\d+(?:\.\d+)?(?:rem|px)$/,yI=Q.createContext(null);function bI(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${_I}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return vI.test(n)?n:e}function xI(){let e=Q.use(yI);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function SI(e){let t=(0,$.c)(58),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?fI:c,[u]=Q.useState(wI),d;t[8]===u?d=t[9]:(d=()=>Zk(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>bI(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=iA();return oA(`left`,Zk(u,window.innerWidth,`left`),e)===`open`},t[12]=u,t[13]=x);let[S,C]=Q.useState(x),w=i??S,T;t[14]!==w||t[15]!==f||t[16]!==o?(T=e=>{let t=typeof e==`function`?e(w):e;o?o(t):C(t),sA(`left`,f,t?`open`:`collapsed`)},t[14]=w,t[15]=f,t[16]=o,t[17]=T):T=t[17];let E=T,D;t[18]===E?D=t[19]:(D=function(){E(CI)},t[18]=E,t[19]=D);let O=D,k=Q.useRef(w),A;t[20]===w?A=t[21]:(A=()=>{k.current=w},t[20]=w,t[21]=A),Q.useLayoutEffect(A);let j;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(){window.innerWidth>=1024||k.current&&(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||b(!0))},t[22]=j):j=t[22];let M=j,N,P;t[23]===u?(N=t[24],P=t[25]):(P=()=>{let e=window.matchMedia(`(min-width: ${Jk}px)`),t=()=>{let e=Zk(u,window.innerWidth,`left`);p(e),C(oA(`left`,e,iA())===`open`)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},N=[u],t[23]=u,t[24]=N,t[25]=P),Q.useEffect(P,N);let F,I;t[26]===w?(F=t[27],I=t[28]):(F=()=>{w||document.getElementById(mI)?.contains(document.activeElement)&&document.querySelector(`[data-sidebar="trigger"]`)?.focus()},I=[w],t[26]=w,t[27]=F,t[28]=I),Q.useLayoutEffect(F,I);let L,R;t[29]!==w||t[30]!==f||t[31]!==E?(L=()=>{if(f===`above`||!w)return;let e=e=>{if(e.key!==`Escape`||rr())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[29]=w,t[30]=f,t[31]=E,t[32]=L,t[33]=R):(L=t[32],R=t[33]),Q.useEffect(L,R);let z,B;t[34]===O?(z=t[35],B=t[36]):(z=()=>{if(typeof window<`u`&&window.okDesktop!=null)return;let e=e=>{As(e,`toggle-files-sidebar`)&&(rr()||(e.preventDefault(),O()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},B=[O],t[34]=O,t[35]=z,t[36]=B),Q.useEffect(z,B);let V=w?`expanded`:`collapsed`,H;t[37]!==_||t[38]!==w||t[39]!==E||t[40]!==y||t[41]!==V||t[42]!==O||t[43]!==h?(H={state:V,open:w,setOpen:E,toggleSidebar:O,width:h,setWidth:g,isDraggingRail:_,setIsDraggingRail:v,showPushPulse:y,setShowPushPulse:b,notifySidebarFileSelected:M},t[37]=_,t[38]=w,t[39]=E,t[40]=y,t[41]=V,t[42]=O,t[43]=h,t[44]=H):H=t[44];let U;t[45]!==s||t[46]!==h?(U={"--sidebar-width":h,"--sidebar-width-icon":pI,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,ee;t[48]===r?ee=t[49]:(ee=Bn(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[48]=r,t[49]=ee);let G;t[50]!==n||t[51]!==a||t[52]!==W||t[53]!==ee?(G=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:W,className:ee,...a,children:n}),t[50]=n,t[51]=a,t[52]=W,t[53]=ee,t[54]=G):G=t[54];let K;return t[55]!==H||t[56]!==G?(K=(0,Z.jsx)(yI.Provider,{value:H,children:G}),t[55]=H,t[56]=G,t[57]=K):K=t[57],K}function CI(e){return!e}function wI(){return Sa()}function TI(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}=on(),{state:f,isDraggingRail:p}=xI();if(u===`none`){let e;t[7]===r?e=t[8]:(e=Bn(`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=Bn(`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=Bn(`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:mI,"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 EI(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}=on(),{toggleSidebar:o,state:s}=xI(),c,l,u,d,f,p,m,h;if(t[4]!==a||t[5]!==s){let e=Ss(`toggle-files-sidebar`);c=X,l=`trigger`,u=`sidebar-trigger`,d=`ghost`,f=`icon-sm`,p=s===`expanded`,m=mI,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=Bn(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)(I,{}):(0,Z.jsx)(Zv,{}),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 DI(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}=on(),{toggleSidebar:u,setWidth:d,state:f,width:p,setIsDraggingRail:m}=xI(),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:hI,maxResizeWidth:gI,setIsDraggingRail:m,widthCookieName:_I,widthCookieMaxAge:dI},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}=lI(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=Bn(`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 OI(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}=xI(),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=Bn(`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 kI(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=Bn(`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 AI(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=Bn(`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 jI(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=Bn(`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 MI(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=Bn(`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 NI(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?or:`div`,o;t[4]===n?o=t[5]:(o=Bn(`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 PI(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=Bn(`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 FI(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=Bn(`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 II(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=Bn(`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 LI=ar(`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 RI(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?or:`button`,{state:m}=xI(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=Bn(LI({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)(sr,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(cr,{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 zI(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 BI(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=xa.safeParse(t);return n.success?n.data.currentBranch??null:null}var VI=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:zI({fetchBranch:BI,subscribeToEvent:Us}),HI=VI.subscribe,UI=VI.getSnapshot;function WI(){return(0,Q.useSyncExternalStore)(HI,UI,UI)}function GI(){let e=(0,$.c)(6),t=WI(),n=Zc(),{state:r}=xI(),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&&id(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 KI(e){let t=(0,$.c)(27),{stats:n,selectionStats:r,showStats:i,composerBadge:a}=e,o=i===void 0?!0:i,{_:s}=on(),c=GI();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)(ue,{className:`size-3`,"aria-hidden":!0}),s({id:`xWEvuo`}),(0,Z.jsx)(Ul,{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)(qI,{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 qI(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)(sr,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(cr,{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)($c,{"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 JI(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}=on(),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=Bn(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 YI(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=Bn(`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 XI(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=Bn(`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 ZI(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=Bn(`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 QI(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=Bn(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(Hl,{}),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 $I=1,eL=2,tL=4;function nL(e){let t=(0,$.c)(18),{docName:n,className:r}=e;if(!n)return null;let i,a,o,s,c,l;if(t[0]!==r||t[1]!==n){l=Symbol.for(`react.early_return_sentinel`);bb0:{let e=co(n),u=e?null:Ao(n),d=e?e.folder.split(`/`).filter(Boolean):u?[]:tp(n,``).prefix.replace(/\/$/,``).split(`/`).filter(Boolean);if(d.length===0){l=null;break bb0}let f=(e,t)=>({kind:`segment`,value:e,key:d.slice(0,t+1).join(`/`)}),p=d.length>tL?[...d.slice(0,$I).map((e,t)=>f(e,t)),{kind:`ellipsis`,hidden:d.slice($I,-eL)},...d.slice(-eL).map((e,t)=>f(e,d.length-eL+t))]:d.map((e,t)=>f(e,t));a=JI,t[8]===r?c=t[9]:(c=Bn(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=YI,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=p.map(rL)}t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7];if(l!==Symbol.for(`react.early_return_sentinel`))return l;let u;t[10]!==i||t[11]!==o||t[12]!==s?(u=(0,Z.jsx)(i,{className:o,children:s}),t[10]=i,t[11]=o,t[12]=s,t[13]=u):u=t[13];let d;return t[14]!==a||t[15]!==c||t[16]!==u?(d=(0,Z.jsx)(a,{className:c,children:u}),t[14]=a,t[15]=c,t[16]=u,t[17]=d):d=t[17],d}function rL(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(QI,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(XI,{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)(Ev,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(gl,{children:e.hidden.join(` / `)})})]}):(0,Z.jsx)(XI,{className:`min-w-0`,children:(0,Z.jsx)(ZI,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:(0,Z.jsx)(gl,{children:e.value})})})]},n)}function iL(e=typeof window>`u`?void 0:window){return e?.okDesktop?.slides!=null}var aL=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillToolbarControls:e}=await import(`./SkillToolbarControls-B1VGCLbB.js`);return{SkillToolbarControls:e}},__vite__mapDeps([177,1,12,13,14,97,35,36,16,17,18,20,54,28,29,34,24,25,26,19,22,21,40,98,135,6,2,3,7,8,9,10,11,27,30,31,79,80,81,82,83,84,85,86,87,88,89,90,91,45,74,92,93,94,95,96,4,39,99,100,101,41,42,66,67,68,69,102,49,71,103,104,46,105,33,65,70,72,73,106,107,108,37,23,109,110,43,47,111,112,113,126,136,137,138,55,116,117,139,178,179,169,170,180,123,163,134,15,164,165,145,166,48,167,158,130,142,181,129,161,44,50,148,182]),import.meta.url)).SkillToolbarControls})),oL=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillOriginInline:e}=await import(`./SkillOriginInline-B-wdZ-wi.js`);return{SkillOriginInline:e}},__vite__mapDeps([183,1,179,80,81,11,88,86,84,82,83,85,45,12,13,14,30,17,26,24,25,169,170,74,18,27,16,28,29,31,22,100,19,20,34,35,36,64,37,146,114,184,6,2,3,7,8,9,10,92,130,70,72,112]),import.meta.url)).SkillOriginInline})),sL=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SlidesToolbarControls:e}=await import(`./SlidesToolbarControls-DpEF1_8n.js`);return{SlidesToolbarControls:e}},__vite__mapDeps([185,1,6,2,3,7,8,9,10,11,12,13,14,34,35,36,16,17,18,20,28,24,25,26,30,22,92,148,182]),import.meta.url)).SlidesToolbarControls})),cL=[];function lL(e){let t=(0,$.c)(113),{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?cL:l,m=f===void 0?!1:f,{_:h}=on(),g=bc()?.merged?.slides?.enabled===!0,_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=xs(`toggle-document-panel`),t[0]=_):_=t[0];let v=_,y,b,x,S,C,w,T,E,D,O,k,A,j,M,N,P;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){x=Ss(`toggle-document-panel`);let e;t[30]===n?e=t[31]:(e=n?Ao(n):null,t[30]=n,t[31]=e);let l=e,f;t[32]===n?f=t[33]:(f=n?ep(n):null,t[32]=n,t[33]=f);let _=f,v;t[34]!==l||t[35]!==_?(v=l?.kind===`skill`?{scope:l.scope,name:l.name}:_?{scope:`project`,name:_}:null,t[34]=l,t[35]=_,t[36]=v):v=t[36];let F=v,I,L;t[37]!==F||t[38]!==p?(I=Al(p,F?bl:Dl),L=I.map(uL),t[37]=F,t[38]=p,t[39]=I,t[40]=L):(I=t[39],L=t[40]);let R=L,z;t[41]===n?z=t[42]:(z=n?Bo(n):null,t[41]=n,t[42]=z);let B=z;E=`editor-toolbar`,D=`pointer-events-none absolute inset-x-0 top-0 z-10 @container/toolbar`;let V;t[43]!==n||t[44]!==F||t[45]!==B?(V=F?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(oL,{scope:F.scope,name:F.name})}):B?null:(0,Z.jsx)(nL,{docName:n}),t[43]=n,t[44]=F,t[45]=B,t[46]=V):V=t[46];let H;t[47]===n?H=t[48]:(H=n===null?null:(0,Z.jsx)($m,{entry:{kind:`document`,docName:n},className:`shrink-0`}),t[47]=n,t[48]=H);let U;t[49]!==V||t[50]!==H?(U=(0,Z.jsxs)(`div`,{className:`pointer-events-auto flex min-w-0 items-center gap-2`,children:[V,H]}),t[49]=V,t[50]=H,t[51]=U):U=t[51];let W;t[52]!==n||t[53]!==i||t[54]!==o||t[55]!==a?(W=n!==null&&Za(n)?null:(0,Z.jsx)(th,{isSourceMode:i,onModeChange:o,sourceDisabled:a}),t[52]=n,t[53]=i,t[54]=o,t[55]=a,t[56]=W):W=t[56];let ee;t[57]===W?ee=t[58]:(ee=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:W}),t[57]=W,t[58]=ee),t[59]!==U||t[60]!==ee?(O=(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:[U,ee]})}),t[59]=U,t[60]=ee,t[61]=O):O=t[61];let G=m&&`pr-9`;t[62]===G?C=t[63]:(C=Bn(`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`,G),t[62]=G,t[63]=C),t[64]!==n||t[65]!==F||t[66]!==B||t[67]!==c||t[68]!==R||t[69]!==s||t[70]!==I?(w=F&&n?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(aL,{scope:F.scope,name:F.name,showAddPropertyButton:s,onAddProperty:c,problemCount:I.length,problemMessages:R})}):B?null:s&&(0,Z.jsx)(Wc,{onAddProperty:c,problemCount:I.length,problemMessages:R}),t[64]=n,t[65]=F,t[66]=B,t[67]=c,t[68]=R,t[69]=s,t[70]=I,t[71]=w):w=t[71],t[72]!==n||t[73]!==r||t[74]!==g?(T=g&&iL()&&r!=null&&n!==null?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(sL,{provider:r,docName:n})}):null,t[72]=n,t[73]=r,t[74]=g,t[75]=T):T=t[75],b=ur,y=X,k=``,A=`ghost`,j=`icon`,M=d,N=!u,P=`doc-panel`,S=h(u?{id:`u7H-Wn`,values:{panelShortcutLabel:x}}:{id:`2hpdRq`,values:{panelShortcutLabel:x}}),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,t[21]=E,t[22]=D,t[23]=O,t[24]=k,t[25]=A,t[26]=j,t[27]=M,t[28]=N,t[29]=P}else 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=t[22],O=t[23],k=t[24],A=t[25],j=t[26],M=t[27],N=t[28],P=t[29];let F;t[76]===u?F=t[77]:(F=(0,Z.jsx)(sr,{children:u?(0,Z.jsx)(Xd,{}):(0,Z.jsx)(Yd,{})}),t[76]=u,t[77]=F);let I;t[78]!==y||t[79]!==S||t[80]!==F||t[81]!==k||t[82]!==A||t[83]!==j||t[84]!==M||t[85]!==N||t[86]!==P?(I=(0,Z.jsx)(y,{"data-doc-panel-toggle":k,variant:A,size:j,onClick:M,"aria-expanded":N,"aria-controls":P,"aria-label":S,asChild:!0,children:F}),t[78]=y,t[79]=S,t[80]=F,t[81]=k,t[82]=A,t[83]=j,t[84]=M,t[85]=N,t[86]=P,t[87]=I):I=t[87];let L;t[88]!==h||t[89]!==u?(L=h(u?{id:`6iDEWA`}:{id:`170Js2`}),t[88]=h,t[89]=u,t[90]=L):L=t[90];let R;t[91]===L?R=t[92]:(R=(0,Z.jsx)(`span`,{children:L}),t[91]=L,t[92]=R);let z;t[93]===x?z=t[94]:(z=(0,Z.jsx)(ne,{"aria-label":x,children:v}),t[93]=x,t[94]=z);let B;t[95]!==R||t[96]!==z?(B=(0,Z.jsxs)(cr,{side:`bottom`,children:[R,` `,z]}),t[95]=R,t[96]=z,t[97]=B):B=t[97];let V;t[98]!==b||t[99]!==I||t[100]!==B?(V=(0,Z.jsxs)(b,{children:[I,B]}),t[98]=b,t[99]=I,t[100]=B,t[101]=V):V=t[101];let H;t[102]!==C||t[103]!==w||t[104]!==T||t[105]!==V?(H=(0,Z.jsxs)(`div`,{className:C,children:[w,T,V]}),t[102]=C,t[103]=w,t[104]=T,t[105]=V,t[106]=H):H=t[106];let U;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[107]=U):U=t[107];let W;return t[108]!==E||t[109]!==D||t[110]!==O||t[111]!==H?(W=(0,Z.jsxs)(`div`,{"data-testid":E,className:D,children:[O,H,U]}),t[108]=E,t[109]=D,t[110]=O,t[111]=H,t[112]=W):W=t[112],W}function uL(e){return e.message}function dL(e,t,n){let r=Vh(e);t(r.target,{disposition:`permanent`,consumeActiveNewTab:n}),bf(r.hash)}function fL({children:e}){return e}function pL(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??fL,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)(df,{"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)(Kn,{"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)(Pv,{"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)(hd,{"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)(ef,{"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)(Cu,{"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 H;t[45]!==w||t[46]!==y||t[47]!==b||t[48]!==a||t[49]!==T?(H=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)(wy,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`OlAl5i`})]}):null,a?.onCollapseAll?(0,Z.jsxs)(y,{onSelect:a.onCollapseAll,children:[(0,Z.jsx)(Mv,{"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]=H):H=t[50];let U;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?(U=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)(Av,{"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)(ge,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`euc6Ns`})]}):null,g?(0,Z.jsxs)(y,{disabled:v,onSelect:g,children:[(0,Z.jsx)(it,{"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)(wi,{"aria-hidden":`true`}),o.label]}):null,p?(0,Z.jsxs)(y,{variant:`destructive`,disabled:v,onSelect:p,children:[(0,Z.jsx)(ff,{"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]=U):U=t[65];let W;return t[66]!==V||t[67]!==H||t[68]!==U||t[69]!==D?(W=(0,Z.jsxs)(Z.Fragment,{children:[D,V,H,U]}),t[66]=V,t[67]=H,t[68]=U,t[69]=D,t[70]=W):W=t[70],W}function mL(e){return e.replace(/\\/g,`\\\\`).replace(/\[/g,`\\[`).replace(/\]/g,`\\]`).replace(/\*/g,`\\*`)}function hL(e){let t=mL(e.path);return e.kind===`folder`?`/${t}/`:`/${t}${e.docExt??`.md`}`}function gL(e){let t=(0,$.c)(21),{parentDir:n,onSelectTemplate:r,ItemComponent:i}=e,{state:a}=Wu(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=Yb(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 _L(e,t){return e?.kind===`doc`||e?.kind===`folder-index`?Yc(t.contentDir,Xc(e.docName),t.pathSeparator):e?.kind===`folder`?Yc(t.contentDir,e.folderPath,t.pathSeparator):e?.kind===`asset`?Yc(t.contentDir,e.assetPath,t.pathSeparator):t.contentDir}function vL(e){return e?.kind===`doc`||e?.kind===`folder-index`?Xc(e.docName):e?.kind===`folder`?e.folderPath:e?.kind===`asset`?e.assetPath:``}function yL(e,t){return e===null?qc({workspace:t}):e.kind===`folder`?t?Jc({folderRelativePath:e.folderPath,workspace:t}):null:e.kind===`doc`||e.kind===`folder-index`?kc({docName:e.docName,workspace:t}):null}var bL=`open-knowledge:file-tree-menu-action-delete`,xL=`open-knowledge:file-tree-menu-action-rename`,SL=`open-knowledge:file-tree-menu-action-duplicate`,CL=`open-knowledge:file-tree-menu-action-import-template`;function wL(e,t){window.dispatchEvent(new CustomEvent(e,{detail:t}))}function TL(e,t){let n=e=>{let n=e.detail;n?.target&&t(n)};return window.addEventListener(e,n),()=>window.removeEventListener(e,n)}function EL(e){wL(bL,{target:e})}function DL(e){return TL(bL,({target:t})=>e(t))}function OL(e,t){wL(xL,{target:e,nextName:t})}function kL(e){return TL(xL,({target:t,nextName:n})=>e(t,n))}function AL(e){wL(SL,{target:e})}function jL(e){return TL(SL,({target:t})=>e(t))}function ML(e,t){wL(CL,{target:e,deleteSource:t})}function NL(e){return TL(CL,({target:t,deleteSource:n})=>e(t,n))}var PL={Group:ni,Item:$r,Separator:oi,Sub:ei,SubContent:ri,SubTrigger:ci};function FL(e,t){return e.kind!==`doc`||/\.(md|mdx)$/i.test(e.docName)?vL(e):`${e.docName}${t??`.md`}`}function IL(e){return e.kind===`asset`?null:e.kind===`folder`?$u(e.folderPath):td(e.docName)}function LL(e,t){return e.kind===`doc`?{kind:`file`,path:e.docName,docExt:t}:e.kind===`folder`?{kind:`folder`,path:e.folderPath}:null}function RL(e){let t=(0,$.c)(90),{docExt:n,target:r,onRename:i}=e,{_:a}=on(),o=Zc(),{okignoreBinding:s}=xc(),{status:c}=nl(),l=qn().states,{dispatch:u}=Tc(),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=FL(r,n),v=Yf(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:yL(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=IL(r),t[24]=r,t[25]=i);let l=i;f=c?.hasRemote===!0&&l!==null,b=LL(r,n);let u;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(u=function(e,t,n){nh(e).then(()=>Ns.success(t,{description:e})).catch(e=>{console.warn(`[EditorTabTargetMenuItems] clipboard write failed:`,e),Ns.error(n)})},t[26]=u):u=t[26],p=u;let T;t[27]!==a||t[28]!==l?(T=function(){l&&Xu({...l,hasRemote:!0,onClickWhenNoRemote:()=>Ns.error(a({id:`WyQxwa`}))},{clipboardWrite:nh,toastSuccess:VL,toastError:BL,logEvent:zL})},t[27]=a,t[28]=l,t[29]=T):T=t[29],C=T,h=function(){if(!s||!b)return;let e=Ku(s.current()),t=Yu(e,hL(b));if(t===e)return;s.patch(Nu(t));let n=x.split(`/`).pop()??x;Ns.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=tg(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?Yc(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:()=>eD({initialDir:r.folderPath}),onNewFolder:()=>eD({initialDir:r.folderPath,kind:`folder`}),templateItems:(0,Z.jsx)(gL,{parentDir:r.folderPath,onSelectTemplate:e=>eD({template:{folder:r.folderPath,name:e}}),ItemComponent:$r})}: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)(Ic,{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=>ML(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?()=>AL(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:()=>EL(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)(pL,{primitives:PL,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 zL(e){return console.log(e)}function BL(e){return Ns.error(e)}function VL(e){return Ns.success(e)}function HL(e,t){return t.trim()}function UL(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function WL(e,t){let n=HL(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function GL(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(Wf(e)){let t=s.get(Jh(e.docName,e.docExt));if(t){let n=Zf(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:Lo(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(qf(e))return{...e,path:ZL(e.path,n)};if(Xf(e)){let t=s.get(e.path);return t&&Bf(t)?{kind:`document`,docName:$h(t),docExt:Hf(t),size:e.size,modified:e.modified}:{...e,path:t??ZL(e.path,n)}}return e})}function KL(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=>Wf(e)?!i.has(e.docName)&&!tR(e.docName,n):qf(e)?!tR(e.path,n):Xf(e)?!a.has(e.path)&&!tR(e.path,n):!0)}function qL(e,t){if(e.kind!==`asset`||t.some(t=>Xf(t)&&t.path===e.path))return e;let n=eg(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function JL(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>QL(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>Wf(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=>qf(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(Wf(i)){let e=eR(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(qf(i)){let e=$L(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function YL(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function XL(e,t){let n=e.kind===`file`?Jh(e.path,e.docExt):e.path;return Yc(t.contentDir,n,t.pathSeparator)}function ZL(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 QL(e,t){return Wf(e)&&Wf(t)?e.docName===t.docName:qf(e)&&qf(t)||Xf(e)&&Xf(t)?e.path===t.path:!1}function $L(e,t,n){return e===t?n:eR(e,t,n)}function eR(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function tR(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function nR(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=UL(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)(yr,{children:(0,Z.jsx)(hr,{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)(Fp,{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)(Np,{children:(0,Z.jsxs)(Rp,{children:[m,(0,Z.jsx)(zf,{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)(vr,{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)(gr,{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)(br,{open:r,onOpenChange:i,children:w}),t[29]=i,t[30]=r,t[31]=w,t[32]=T):T=t[32],T}var rR=`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`,iR=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,aR=`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`,oR=`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 sR(e,t){return Bn(oR,e&&`font-semibold`,t&&`italic`)}function cR(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 lR(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 uR(e){return e.metaKey||e.ctrlKey}var dR=1e3,fR=new Set;function pR(e,t){return e<0||e>=t?null:e<8?String(e+1):e===t-1?`9`:null}function mR(e,t){let n=pR(e,t);if(n)return[`Meta+${n}`,`Control+${n}`].join(` `)}function hR(e,t){if(!uR(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 gR(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)(ne,{className:`px-0.5 text-[10px]`,children:r})}),t[0]=r,t[1]=i),i}function _R(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:vR,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}=rh(g),w=y.current?.width,T;t[21]!==C||t[22]!==l||t[23]!==w||t[24]!==x||t[25]!==S?(T=ic({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&&gc(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=rc({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=hc({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:Bn(`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 vR(){return!1}function yR(e){let t=(0,$.c)(97),{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=fp(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=fp(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]===r?M=t[14]:(M=(0,Z.jsx)(ti,{asChild:!0,children:r}),t[13]=r,t[14]=M);let N;t[15]!==i||t[16]!==g?(N=()=>i(g),t[15]=i,t[16]=g,t[17]=N):N=t[17];let P,F;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(hf,{"aria-hidden":`true`}),P=(0,Z.jsx)(Y,{id:`yz7wBu`}),t[18]=P,t[19]=F):(P=t[18],F=t[19]);let L;t[20]!==E||t[21]!==N?(L=(0,Z.jsxs)($r,{disabled:E,onSelect:N,children:[F,P]}),t[20]=E,t[21]=N,t[22]=L):L=t[22];let R=O.length===0,z;t[23]!==a||t[24]!==O?(z=()=>{a(O)},t[23]=a,t[24]=O,t[25]=z):z=t[25];let B,V;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(Cv,{"aria-hidden":`true`}),V=(0,Z.jsx)(Y,{id:`omXJcU`}),t[26]=B,t[27]=V):(B=t[26],V=t[27]);let H;t[28]!==R||t[29]!==z?(H=(0,Z.jsxs)($r,{disabled:R,onSelect:z,children:[B,V]}),t[28]=R,t[29]=z,t[30]=H):H=t[30];let U=A.length===0,W;t[31]!==A||t[32]!==a?(W=()=>{a(A)},t[31]=A,t[32]=a,t[33]=W):W=t[33];let ee;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(ff,{"aria-hidden":`true`}),t[34]=ee):ee=t[34];let G;t[35]===d.length?G=t[36]:(G=d.length?(0,Z.jsx)(Y,{id:`U2Kx6T`}):(0,Z.jsx)(Y,{id:`WyXG7w`}),t[35]=d.length,t[36]=G);let K;t[37]!==U||t[38]!==W||t[39]!==G?(K=(0,Z.jsxs)($r,{disabled:U,"data-testid":`editor-tab-context-close-all`,onSelect:W,children:[ee,G]}),t[37]=U,t[38]=W,t[39]=G,t[40]=K):K=t[40];let q;t[41]!==L||t[42]!==H||t[43]!==K?(q=(0,Z.jsxs)(ni,{children:[L,H,K]}),t[41]=L,t[42]=H,t[43]=K,t[44]=q):q=t[44];let te;t[45]!==s||t[46]!==m||t[47]!==_?(te=_||m?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(oi,{}),_?(0,Z.jsx)(RL,{docExt:s,target:_,onRename:()=>w(!0)}):null,m]}):null,t[45]=s,t[46]=m,t[47]=_,t[48]=te):te=t[48];let J;t[49]!==S||t[50]!==f||t[51]!==g?(J=S&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(oi,{}),(0,Z.jsxs)($r,{"data-testid":`editor-tab-context-keep-open`,onSelect:()=>f(g),children:[(0,Z.jsx)(ey,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`GH02QY`})]})]}),t[49]=S,t[50]=f,t[51]=g,t[52]=J):J=t[52];let ne;t[53]!==x||t[54]!==E||t[55]!==u||t[56]!==g||t[57]!==y?(ne=x&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(oi,{}),(0,Z.jsxs)($r,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>E?y(g):u(g),children:[(0,Z.jsx)(ey,{"aria-hidden":`true`}),E?(0,Z.jsx)(Y,{id:`SYfHmN`}):(0,Z.jsx)(Y,{id:`3pU8e-`})]})]}),t[53]=x,t[54]=E,t[55]=u,t[56]=g,t[57]=y,t[58]=ne):ne=t[58];let re;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(oi,{}),t[59]=re):re=t[59];let ie=!j,ae;t[60]!==p||t[61]!==g||t[62]!==h?(ae=()=>p(g,`left`,h),t[60]=p,t[61]=g,t[62]=h,t[63]=ae):ae=t[63];let oe,se;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(I,{"aria-hidden":`true`}),se=(0,Z.jsx)(Y,{id:`pCralD`}),t[64]=oe,t[65]=se):(oe=t[64],se=t[65]);let ce;t[66]!==ie||t[67]!==ae?(ce=(0,Z.jsxs)($r,{disabled:ie,"data-testid":`editor-tab-context-split-left`,onSelect:ae,children:[oe,se]}),t[66]=ie,t[67]=ae,t[68]=ce):ce=t[68];let le=!j,ue;t[69]!==p||t[70]!==g||t[71]!==h?(ue=()=>p(g,`right`,h),t[69]=p,t[70]=g,t[71]=h,t[72]=ue):ue=t[72];let de,fe;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Z.jsx)(Ks,{"aria-hidden":`true`}),fe=(0,Z.jsx)(Y,{id:`jeCFV7`}),t[73]=de,t[74]=fe):(de=t[73],fe=t[74]);let pe;t[75]!==le||t[76]!==ue?(pe=(0,Z.jsxs)($r,{disabled:le,"data-testid":`editor-tab-context-split-right`,onSelect:ue,children:[de,fe]}),t[75]=le,t[76]=ue,t[77]=pe):pe=t[77];let me;t[78]!==ce||t[79]!==pe?(me=(0,Z.jsxs)(ni,{children:[ce,pe]}),t[78]=ce,t[79]=pe,t[80]=me):me=t[80];let he;t[81]!==q||t[82]!==te||t[83]!==J||t[84]!==ne||t[85]!==me?(he=(0,Z.jsxs)(ai,{className:`min-w-56`,children:[q,te,J,ne,re,me]}),t[81]=q,t[82]=te,t[83]=J,t[84]=ne,t[85]=me,t[86]=he):he=t[86];let ge;t[87]!==he||t[88]!==M?(ge=(0,Z.jsxs)(si,{children:[M,he]}),t[87]=he,t[88]=M,t[89]=ge):ge=t[89];let _e;t[90]!==v||t[91]!==C||t[92]!==_?(_e=C&&_&&v?(0,Z.jsx)(nR,{currentName:v,open:!0,onOpenChange:w,onSave:e=>OL(_,e)}):null,t[90]=v,t[91]=C,t[92]=_,t[93]=_e):_e=t[93];let ve;return t[94]!==ge||t[95]!==_e?(ve=(0,Z.jsxs)(Z.Fragment,{children:[ge,_e]}),t[94]=ge,t[95]=_e,t[96]=ve):ve=t[96],ve}function bR(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}=on();if(d){let e;return t[0]===d?e=t[1]:(e=(0,Z.jsx)(gR,{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)(ey,{"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=fc(m),t[15]=m,t[16]=h);let g;t[17]===a?g=t[18]:(g=lc(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)(hf,{"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 xR(e){let t=(0,$.c)(7),{children:n,path:r}=e,{active:i}=dh();if(i)return n;let a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(sr,{asChild:!0,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Z.jsx)(cr,{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 SR(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)(pf,{"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 CR(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}=on(),m=Ik(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=sR(_,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)(SR,{hasConflict:m}),t[13]=m,t[14]=x);let S=c?`fade`:`ellipsis`,C;t[15]===c?C=t[16]:(C=Bn(`min-w-0 flex-1`,cR(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)(xR,{path:g,children:D}),t[34]=g,t[35]=D,t[36]=O):O=t[36],O}function wR(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?iR:aR,j;t[3]===A?j=t[4]:(j=Bn(rR,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)(bR,{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)(_R,{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)(yR,{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 TR(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}=on(),d=Oe(),{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=fm({enabled:C.some(jR)}),A=Fc(),j=k.status===`ready`?k.data.filter(AR):[],M=new Map(j.map(kR)),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(OR):[])])),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,B;t[19]!==d||t[20]!==h?(B=e=>d.closeTabInPane(h,e),t[19]=d,t[20]=h,t[21]=B):B=t[21];let V=B,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 ee=W,G;t[28]!==d||t[29]!==h?(G=()=>d.openNewTabInPane(h),t[28]=d,t[29]=h,t[30]=G):G=t[30];let K=G,q;t[31]!==d||t[32]!==h?(q=e=>d.pinTabInPane(h,e),t[31]=d,t[32]=h,t[33]=q):q=t[33];let te=q,J;t[34]!==d||t[35]!==h?(J=e=>d.unpinTabInPane(h,e),t[34]=d,t[35]=h,t[36]=J):J=t[36];let ne=J,re;t[37]!==d||t[38]!==h?(re=e=>d.promoteTabInPane(h,e),t[37]=d,t[38]=h,t[39]=re):re=t[39];let ie=re,ae;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(ae={id:0,text:``},t[40]=ae):ae=t[40];let[oe,se]=(0,Q.useState)(ae),ce;t[41]!==u||t[42]!==d||t[43]!==i?(ce=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}});se(e=>({id:e.id+1,text:a})),i?.(r,e)},t[41]=u,t[42]=d,t[43]=i,t[44]=ce):ce=t[44];let le=ce,{pageMeta:ue}=Eu(),[de,fe]=(0,Q.useState)(!1),pe=(0,Q.useRef)(null),me=(0,Q.useRef)(null),he=(0,Q.useRef)(!1),ge=(0,Q.useRef)(!1),_e;t[45]!==T||t[46]!==w?(_e=T??(w?cp(w):null),t[45]=T,t[46]=w,t[47]=_e):_e=t[47];let ve=_e,ye=function(e){if(s===e)return`before`;if(s===C.length&&e===C.length-1)return`after`},be,xe;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(be=()=>()=>{me.current!==null&&(window.clearTimeout(me.current),me.current=null)},xe=[],t[48]=be,t[49]=xe):(be=t[48],xe=t[49]),(0,Q.useEffect)(be,xe);let Se=typeof window<`u`&&window.okDesktop!=null,Ce;t[50]===S?Ce=t[51]:(Ce=new Set(S),t[50]=S,t[51]=Ce);let we=Ce,Te;t[52]!==ee||t[53]!==U||t[54]!==we?(Te=function(e){let t=[],n=[];for(let r of e)we.has(r)?n.push(r):t.push(r);t.length>0&&U(t);for(let e of n)ee(e)},t[52]=ee,t[53]=U,t[54]=we,t[55]=Te):Te=t[55];let Ee=Te,De;t[56]!==E||t[57]!==ve||t[58]!==d||t[59]!==O||t[60]!==D||t[61]!==S||t[62]!==_||t[63]!==f||t[64]!==h?(De=()=>{if(!O)return;let e=new Set(S),t=[..._,...S],n=function(){me.current!==null&&(window.clearTimeout(me.current),me.current=null)},r=function(e){he.current!==e&&(he.current=e)},i=function(e){ge.current!==e&&(ge.current=e,fe(e))},a=function(){r(!0),!(ge.current||me.current!==null)&&(me.current=window.setTimeout(()=>{me.current=null,he.current&&i(!0)},dR))},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:ve,r=n?t.indexOf(n):-1;s(t[((r>=0?r:0)+e+t.length)%t.length])},l=function(e){if(!uR(e)||rr())return;if(a(),As(e,`tab-new`)){e.preventDefault(),d.openNewTabInPane(h);return}if(As(e,`tab-reopen-closed`)){e.preventDefault(),f();return}if(As(e,`tab-next`)){e.preventDefault(),c(1);return}if(As(e,`tab-previous`)){e.preventDefault(),c(-1);return}let n=hR(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]=ve,t[58]=d,t[59]=O,t[60]=D,t[61]=S,t[62]=_,t[63]=f,t[64]=h,t[65]=De):De=t[65];let ke;t[66]!==E||t[67]!==ve||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?(ke=[E,ve,d.activateNewTabInPane,d.activateTabInPane,d.openNewTabInPane,O,D,S,_,f,h],t[66]=E,t[67]=ve,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]=ke):ke=t[77],(0,Q.useEffect)(De,ke);let Ae=de,je=D?E:ve,Me=(0,Q.useRef)(je),Ne;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=()=>{let e=pe.current;e&&lR(e)},t[78]=Ne):Ne=t[78],(0,Q.useLayoutEffect)(Ne);let Pe,Fe;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=()=>{let e=pe.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>lR(e));return t.observe(e),()=>t.disconnect()},Fe=[],t[79]=Pe,t[80]=Fe):(Pe=t[79],Fe=t[80]),(0,Q.useLayoutEffect)(Pe,Fe);let Ie,Le;t[81]!==h||t[82]!==je?(Ie=()=>{let e=Me.current;if(Me.current=je,je===null||je===e)return;let t=pe.current;t&&cc(t,h,je)?.scrollIntoView({block:`nearest`,inline:`nearest`})},Le=[h,je],t[81]=h,t[82]=je,t[83]=Ie,t[84]=Le):(Ie=t[83],Le=t[84]),(0,Q.useEffect)(Ie,Le);let Re=c?`pl-[calc(var(--editor-header-leading-offset,0px)+var(--editor-header-leading-width,0px)+0.5rem)]`:`pl-2`,ze=l&&`pr-[var(--editor-header-trailing-width,0px)]`,Be;t[85]!==Re||t[86]!==ze?(Be=Bn(`flex h-12 w-full min-w-0 touch-manipulation items-end overflow-hidden`,Re,ze,Se&&`[-webkit-app-region:drag]`),t[85]=Re,t[86]=ze,t[87]=Be):Be=t[87];let Ve;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=Bn(`group/tab-overflow relative flex min-w-0 flex-1 self-stretch items-end gap-px overflow-hidden`,Se&&`[-webkit-app-region:drag]`),t[88]=Ve):Ve=t[88];let He;t[89]!==oe.id||t[90]!==oe.text?(He=(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:oe.text},oe.id)}),t[89]=oe.id,t[90]=oe.text,t[91]=He):He=t[91];let Ue;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=Bn(`relative h-10 w-fit max-w-[calc(100%-1.75rem)] min-w-0 flex-none self-end`,Se&&`[-webkit-app-region:no-drag]`),t[92]=Ue):Ue=t[92];let We=DR,Ge=ER,Ke=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,qe=C.map((e,t)=>{let n=de?pR(t,C.length):null,r=O?mR(t,C.length):void 0;if(we.has(e)){let i=e===E;return(0,Z.jsx)(yR,{tabId:e,canPin:!1,openTabs:C,closeTab:ee,closeTabs:Ee,pinTab:te,pinnedTabIds:y,promoteTab:ie,splitTab:le,tabLabel:u({id:`3YvS-c`}),unpinTab:ne,children:(0,Z.jsxs)(_R,{dropIndicatorSide:ye(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:Bn(rR,i?iR:aR),onAuxClick:t=>{t.button===1&&(t.preventDefault(),ee(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:sR(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:Ot(e)?(0,Z.jsx)(Y,{id:`hgf5io`}):(0,Z.jsx)(Y,{id:`3YvS-c`})})}),n?(0,Z.jsx)(gR,{value:n}):(0,Z.jsx)(`button`,{type:`button`,"aria-label":u({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:fc(Ae||i),tabIndex:lc(i),onClick:t=>{t.stopPropagation(),ee(e)},children:(0,Z.jsx)(hf,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let i=_p(e),a=e===ve,o=y.includes(e),s=e===b;if(i.kind===`folder`){let{baseName:c,label:l,prefix:u}=tp(i.folderPath,`/`),d=`${u}${l}`;return(0,Z.jsx)(wR,{accessibleLabel:d,activateTab:L,ariaKeyShortcuts:r,dropIndicatorSide:ye(t),tabId:e,paneId:h,target:{kind:`folder`,target:i.folderPath,folderPath:i.folderPath},renameName:c,openTabs:C,closeTab:V,closeTabs:Ee,forceCloseVisible:Ae,isActive:a,isPinned:o,isPreview:s,pinTab:te,pinnedTabIds:y,promoteTab:ie,shortcutHint:n,splitTab:le,unpinTab:ne,children:(0,Z.jsx)(xR,{path:d,children:(0,Z.jsx)(`button`,{type:`button`,"aria-label":d,dir:`auto`,className:sR(a&&O,s),onClick:()=>L(e),onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),ie(e)},tabIndex:-1,children:(0,Z.jsxs)(`span`,{"data-editor-tab-title-overflow":a?`fade`:`ellipsis`,className:Bn(`min-w-0 flex-1`,cR(a)),children:[u&&(0,Z.jsx)(`span`,{className:Bn(`@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}=tp(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)(wR,{accessibleLabel:f,activateTab:L,ariaKeyShortcuts:r,dropIndicatorSide:ye(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:V,closeTabs:Ee,forceCloseVisible:Ae,isActive:a,isPinned:o,isPreview:s,pinTab:te,pinnedTabIds:y,promoteTab:ie,shortcutHint:n,splitTab:le,skillMenuItems:i.kind===`skill-file`&&m?(0,Z.jsx)(Rc,{actions:A,filePath:i.path,menuKind:`context`,skill:m}):void 0,unpinTab:ne,children:(0,Z.jsx)(xR,{path:f,children:(0,Z.jsx)(`button`,{type:`button`,"aria-label":f,dir:`auto`,className:sR(a&&O,s),onClick:()=>L(e),onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),ie(e)},tabIndex:-1,children:(0,Z.jsxs)(`span`,{"data-editor-tab-title-overflow":a?`fade`:`ellipsis`,className:Bn(`min-w-0 flex-1`,cR(a)),children:[d?(0,Z.jsx)(`span`,{className:Bn(`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=ue.get(c)?.docExt??`.md`,f=l?null:zc(c,j,d),{baseName:p,extension:m,label:g,prefix:_}=tp(c,d),v=`${_}${g}`,x=d===`.md`||d===`.mdx`,S=!gp(c)&&!np(c);return(0,Z.jsx)(wR,{accessibleLabel:v,activateTab:L,ariaKeyShortcuts:r,dropIndicatorSide:ye(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:V,closeTabs:Ee,forceCloseVisible:Ae,isActive:a,isPinned:o,isPreview:s,pinTab:te,pinnedTabIds:y,promoteTab:ie,shortcutHint:n,splitTab:le,skillMenuItems:l?(0,Z.jsx)(Uc,{actions:A,existingNames:F.get(l.scope)??fR,menuKind:`context`,skill:l}):f?(0,Z.jsx)(Rc,{actions:A,filePath:f.filePath,menuKind:`context`,skill:f.skill}):void 0,unpinTab:ne,children:(0,Z.jsx)(CR,{accessibleLabel:v,activateTab:L,baseName:p,docName:c,extension:m,hideDocExtension:x,isActive:a,isFocusedPane:O,isPreview:s,promoteTab:ie,tabId:e})},e)}),Je;t[93]!==We||t[94]!==Ge||t[95]!==Ke||t[96]!==qe?(Je=(0,Z.jsxs)(`div`,{ref:pe,"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:We,onWheel:Ge,children:[Ke,qe]}),t[93]=We,t[94]=Ge,t[95]=Ke,t[96]=qe,t[97]=Je):Je=t[97];let Ye;t[98]!==Ue||t[99]!==Je?(Ye=(0,Z.jsx)(`div`,{className:Ue,children:Je}),t[98]=Ue,t[99]=Je,t[100]=Ye):Ye=t[100];let Xe;t[101]===u?Xe=t[102]:(Xe=u({id:`3YvS-c`}),t[101]=u,t[102]=Xe);let Ze;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=Bn(`first:mb-3 mb-1.5 shrink-0`,Se&&`[-webkit-app-region:no-drag]`),t[103]=Ze):Ze=t[103];let Qe;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=(0,Z.jsx)(Mn,{"aria-hidden":`true`}),t[104]=Qe):Qe=t[104];let $e;t[105]!==K||t[106]!==Xe?($e=(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":Xe,"data-testid":`editor-new-tab-button`,className:Ze,onClick:K,children:Qe})}),t[105]=K,t[106]=Xe,t[107]=$e):$e=t[107];let et;t[108]===Symbol.for(`react.memo_cache_sentinel`)?(et=(0,Z.jsx)(cr,{children:(0,Z.jsx)(Y,{id:`3YvS-c`})}),t[108]=et):et=t[108];let tt;return t[109]===$e?tt=t[110]:(tt=(0,Z.jsxs)(ur,{children:[$e,et]}),t[109]=$e,t[110]=tt),(0,Z.jsxs)(`div`,{"data-editor-pane-tabs":h,"data-electron-drag":Se?``:void 0,className:Be,children:[(0,Z.jsxs)(`div`,{"data-editor-tab-overflow-root":``,"data-electron-drag":Se?``:void 0,className:Ve,children:[He,(0,Z.jsx)(mh,{items:[...C],strategy:fh,children:Ye}),tt]}),A.dialogs]})}function ER(e){ec(e),lR(e.currentTarget)}function DR(e){return lR(e.currentTarget)}function OR(e){return e.name}function kR(e){return[$f(e),e]}function AR(e){return!e.managed}function jR(e){let t=_p(e);return t.kind===`skill-file`||t.kind===`doc`&&gp(t.docName)}var MR=300;function NR(e){return e.activeTarget?.kind===`large-file`?null:e.activeTarget?up(e.activeTarget):null}function PR(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}=lh(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 FR(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}=lh(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=Bn(`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 IR(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}=lh(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}=lh(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=Bn(`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 LR(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 RR(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}=Oe(),[g,_]=(0,Q.useState)(!1),v=(0,Q.useRef)(null),y;t[0]===o?y=t[1]:(y=NR(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=>{Oh(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=wh(e.dataTransfer);t&&(e.preventDefault(),e.stopPropagation(),dL(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=Bn(`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)(LR,{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)(FR,{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)(FR,{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 zR(e){let t=(0,$.c)(131),{renderActivityPool:n,renderHeader:r,renderPane:i}=e,{_:a}=on(),{focusPane:o,focusedPaneId:s,moveTabToPane:c,panes:l,reorderTabsInPane:u,resizePanes:d,splitTab:f,tabSessionLoaded:p,visibleTabIdsByPane:m}=Oe(),h=eS(),g=!h&&!p&&typeof window<`u`&&window.okDesktop?.config.mode===`editor`,[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(UR),[C,w]=(0,Q.useState)(null),T=(0,Q.useRef)(null),E=(0,Q.useRef)(null),D;t[0]===l?D=t[1]:(D=l.map(HR).join(`\0`),t[0]=l,t[1]=D);let O=D,k;t[2]===l?k=t[3]:(k=Object.fromEntries(l.map(VR)),t[2]=l,t[3]=k);let A=k,j=new Set,M=new Map;for(let e of l){let t=NR(e);if(!t)continue;j.add(t);let n=x.get(e.id);n&&M.set(t,n)}let N;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(N={activationConstraint:{distance:8}},t[4]=N):N=t[4];let P;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(P={coordinateGetter:ch,keyboardCodes:dc},t[5]=P):P=t[5];let F=oh(sh(ah,N),sh(hh,P)),I=`max(100%, ${l.length*MR}px)`,L;t[6]===I?L=t[7]:(L={"--editor-workspace-min-width":I},t[6]=I,t[7]=L);let R=L,z,B;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(z=()=>()=>{T.current!==null&&cancelAnimationFrame(T.current)},B=[],t[8]=z,t[9]=B):(z=t[8],B=t[9]),(0,Q.useEffect)(z,B);let V,H;if(t[10]===_?(V=t[11],H=t[12]):(H=()=>{if(_)return document.body.setAttribute(`data-editor-tab-dragging`,``),BR},V=[_],t[10]=_,t[11]=V,t[12]=H),(0,Q.useEffect)(H,V),g){let e;t[13]===r?e=t[14]:(e=r(null),t[13]=r,t[14]=e);let n;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`div`,{"data-editor-workspace-pending":``,className:`min-h-0 flex-1 bg-background`}),t[15]=n):n=t[15];let i;return t[16]===e?i=t[17]:(i=(0,Z.jsxs)(Z.Fragment,{children:[e,n]}),t[16]=e,t[17]=i),i}let U;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(U=function(e,t){S(n=>{if(n.get(e)===t)return n;let r=new Map(n);return t?r.set(e,t):r.delete(e),r})},t[18]=U):U=t[18];let W=U,ee;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(ee=function(e,t){T.current!==null&&cancelAnimationFrame(T.current),T.current=requestAnimationFrame(()=>{T.current=null,cc(document,e,t)?.focus()})},t[19]=ee):ee=t[19];let G=ee,K;t[20]===m?K=t[21]:(K=function(e){return m.get(e.id)??[...e.openTabs,...e.newTabIds]},t[20]=m,t[21]=K);let q=K,te;t[22]!==c||t[23]!==u?(te=function(e,t,n,r){if(e.paneId!==t.id){c(e.tabId,t.id,n),G(t.id,e.tabId);return}if(!r)return;let i=r.indexOf(e.tabId);i<0||i===n||u(t.id,uh([...r],i,n),e.tabId)},t[22]=c,t[23]=u,t[24]=te):te=t[24];let J=te,ne;t[25]!==l||t[26]!==q?(ne=function(e,t){let n=e.over?.data.current,r,i;if(oc(n)){r=n.paneId;let a=l.find(e=>e.id===r);if(!a)return null;let o=q(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(ac(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=q(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[25]=l,t[26]=q,t[27]=ne):ne=t[27];let re=ne,ie;t[28]===re?ie=t[29]:(ie=function(e){let t=e.active.data.current,n=oc(t)?re(e,t):null,r=n?{index:n.indicatorIndex,paneId:n.pane.id}:null;b(e=>e?.paneId===r?.paneId&&e?.index===r?.index?e:r)},t[28]=re,t[29]=ie);let ae=ie,oe;t[30]===o?oe=t[31]:(oe=function(e){let t=e.active.data.current;oc(t)&&(b(null),v(t),o(t.paneId))},t[30]=o,t[31]=oe);let se=oe,ce;t[32]!==J||t[33]!==re||t[34]!==f?(ce=function(e){let t=e.active.data.current,n=e.over?.data.current,r=oc(t)?re(e,t):null;if(b(null),v(null),oc(t)){if(r){J(t,r.pane,r.targetIndex,r.targetOrder);return}if(ac(n)&&n.kind===`pane-edge`){if(!t.splittable)return;let e=f(t.tabId,n.paneId,n.side);e&&G(e,t.tabId);return}}},t[32]=J,t[33]=re,t[34]=f,t[35]=ce):ce=t[35];let le=ce,ue;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(ue=function(e){E.current?.style.setProperty(`transform`,`translateX(-${e.currentTarget.scrollLeft}px)`)},t[36]=ue):ue=t[36];let de=ue,fe;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(fe=function(e){(E.current?.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[37]=fe):fe=t[37];let pe=fe,me;t[38]!==a||t[39]!==l?(me=function(e){let t=l.findIndex(t=>t.id===e);return a(t<0?{id:`n2XqGH`}:{id:`fo6CCk`,values:{0:t+1}})},t[38]=a,t[39]=l,t[40]=me):me=t[40];let he=me,ge;t[41]!==a||t[42]!==he?(ge=function(e){return oc(e)?he(e.paneId):ac(e)?e.kind===`pane-edge`?e.side===`left`?a({id:`9Ii3uK`,values:{0:he(e.paneId)}}):a({id:`jp6I-2`,values:{0:he(e.paneId)}}):he(e.paneId):null},t[41]=a,t[42]=he,t[43]=ge):ge=t[43];let _e=ge,ve;t[44]!==l||t[45]!==d?(ve=(e,t)=>{t.isUserInteraction&&d(new Map(l.map(t=>[t.id,e[`editor-pane:${t.id}`]??t.size])))},t[44]=l,t[45]=d,t[46]=ve):ve=t[46];let ye;t[47]!==_||t[48]!==s||t[49]!==he||t[50]!==l||t[51]!==i?(ye=l.map((e,t)=>(0,Z.jsxs)(Q.Fragment,{children:[t>0?(0,Z.jsx)(vk,{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)(IR,{drag:_,leftPaneId:l[t-1]?.id??e.id,rightPaneId:e.id})}):null,(0,Z.jsx)(_k,{id:`editor-pane:${e.id}`,defaultSize:`${e.size}%`,minSize:`${MR}px`,children:(0,Z.jsx)(RR,{drag:_,isFocused:e.id===s,label:he(e.id),onActivityMount:W,pane:e,renderPane:i,showOuterLeftDropTarget:t===0,showOuterRightDropTarget:t===l.length-1})})]},e.id)),t[47]=_,t[48]=s,t[49]=he,t[50]=l,t[51]=i,t[52]=ye):ye=t[52];let be;t[53]!==O||t[54]!==A||t[55]!==ve||t[56]!==ye?(be=(0,Z.jsx)(gk,{id:`editor-workspace-panes`,orientation:`horizontal`,defaultLayout:A,onLayoutChange:pe,onLayoutChanged:ve,children:ye},O),t[53]=O,t[54]=A,t[55]=ve,t[56]=ye,t[57]=be):be=t[57];let xe=be,Se;if(t[58]!==y||t[59]!==s||t[60]!==l||t[61]!==q){let e;t[63]!==y||t[64]!==s||t[65]!==l.length||t[66]!==q?(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)(PR,{paneId:e.id,index:q(e).length,isFocused:e.id===s,size:e.size,children:(0,Z.jsx)(TR,{dropIndicatorIndex:y?.paneId===e.id?y.index:null,paneId:e.id,onSplitComplete:G,reserveLeadingChrome:t===0,reserveTrailingChrome:t===l.length-1})})]},e.id),t[63]=y,t[64]=s,t[65]=l.length,t[66]=q,t[67]=e):e=t[67],Se=l.map(e),t[58]=y,t[59]=s,t[60]=l,t[61]=q,t[62]=Se}else Se=t[62];let Ce;t[68]!==R||t[69]!==Se?(Ce=(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:E,"data-editor-header-tab-canvas":``,className:`flex h-full min-w-(--editor-workspace-min-width)`,style:R,children:Se})}),t[68]=R,t[69]=Se,t[70]=Ce):Ce=t[70];let we=Ce;if(h){let e;t[71]!==s||t[72]!==l?(e=l.find(e=>e.id===s)??l[0],t[71]=s,t[72]=l,t[73]=e):e=t[73];let a=e,o;t[74]===r?o=t[75]:(o=r(null),t[74]=r,t[75]=o);let c;t[76]!==he||t[77]!==a||t[78]!==i?(c=a?(0,Z.jsx)(RR,{drag:null,isFocused:!0,label:he(a.id),onActivityMount:W,pane:a,renderPane:i,showDropTargets:!1}):null,t[76]=he,t[77]=a,t[78]=i,t[79]=c):c=t[79];let u;return t[80]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`div`,{ref:w,"data-editor-activity-parking":``,className:`hidden`,inert:!0}),t[80]=u):u=t[80],(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,C===null?null:n?.({activityHosts:M,parkingHost:C,visibleDocNames:j})]})]})}let Te=ph,Ee=nc,De;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(De=()=>{b(null),v(null)},t[81]=De):De=t[81];let ke;t[82]===a?ke=t[83]:(ke=a({id:`GrBgX_`}),t[82]=a,t[83]=ke);let Ae;t[84]===ke?Ae=t[85]:(Ae={draggable:ke},t[84]=ke,t[85]=Ae);let je;t[86]!==a||t[87]!==he?(je=e=>{let{active:t}=e,n=t.data.current;return oc(n)?a({id:`_PnPuw`,values:{0:n.label,1:he(n.paneId)}}):void 0},t[86]=a,t[87]=he,t[88]=je):je=t[88];let Me,Ne;t[89]!==a||t[90]!==_e?(Me=e=>{let{active:t,over:n}=e,r=t.data.current;if(!oc(r)||!n)return;let i=_e(n.data.current);return i?a({id:`Jnz9AY`,values:{0:r.label,destination:i}}):void 0},Ne=e=>{let{active:t,over:n}=e,r=t.data.current;if(!oc(r))return;let i=n?_e(n.data.current):null;return a(i?{id:`gqk-3R`,values:{0:r.label,destination:i}}:{id:`Gu9pRm`,values:{0:r.label}})},t[89]=a,t[90]=_e,t[91]=Me,t[92]=Ne):(Me=t[91],Ne=t[92]);let Pe;t[93]===a?Pe=t[94]:(Pe=e=>{let{active:t}=e,n=t.data.current;return oc(n)?a({id:`URN-cv`,values:{0:n.label}}):void 0},t[93]=a,t[94]=Pe);let Fe;t[95]!==je||t[96]!==Me||t[97]!==Ne||t[98]!==Pe?(Fe={onDragStart:je,onDragOver:Me,onDragEnd:Ne,onDragCancel:Pe},t[95]=je,t[96]=Me,t[97]=Ne,t[98]=Pe,t[99]=Fe):Fe=t[99];let Ie;t[100]!==Ae||t[101]!==Fe?(Ie={container:typeof document<`u`?document.body:void 0,screenReaderInstructions:Ae,announcements:Fe},t[100]=Ae,t[101]=Fe,t[102]=Ie):Ie=t[102];let Le;t[103]!==we||t[104]!==r?(Le=r(we),t[103]=we,t[104]=r,t[105]=Le):Le=t[105];let Re;t[106]!==R||t[107]!==xe?(Re=(0,Z.jsx)(`div`,{"data-editor-workspace-canvas":``,className:`h-full min-w-[var(--editor-workspace-min-width)]`,style:R,children:xe}),t[106]=R,t[107]=xe,t[108]=Re):Re=t[108];let ze;t[109]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,Z.jsx)(`div`,{ref:w,"data-editor-activity-parking":``,className:`hidden`,inert:!0}),t[109]=ze):ze=t[109];let Be=C===null?null:n?.({activityHosts:M,parkingHost:C,visibleDocNames:j}),Ve;t[110]!==de||t[111]!==Re||t[112]!==ze||t[113]!==Be?(Ve=(0,Z.jsxs)(`div`,{"data-editor-workspace":``,className:`relative min-h-0 flex-1 overflow-x-auto overflow-y-hidden`,onScroll:de,children:[Re,ze,Be]}),t[110]=de,t[111]=Re,t[112]=ze,t[113]=Be,t[114]=Ve):Ve=t[114];let He;t[115]===_?He=t[116]:(He=_?(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:_.label})}):null,t[115]=_,t[116]=He);let Ue;t[117]===He?Ue=t[118]:(Ue=(0,Z.jsx)(ih,{dropAnimation:null,children:He}),t[117]=He,t[118]=Ue);let We;return t[119]!==Te||t[120]!==le||t[121]!==se||t[122]!==F||t[123]!==Ee||t[124]!==De||t[125]!==Ie||t[126]!==Le||t[127]!==Ve||t[128]!==Ue||t[129]!==ae?(We=(0,Z.jsxs)(Te,{sensors:F,autoScroll:!1,collisionDetection:Ee,onDragStart:se,onDragMove:ae,onDragOver:ae,onDragEnd:le,onDragCancel:De,accessibility:Ie,children:[Le,Ve,Ue]}),t[119]=Te,t[120]=le,t[121]=se,t[122]=F,t[123]=Ee,t[124]=De,t[125]=Ie,t[126]=Le,t[127]=Ve,t[128]=Ue,t[129]=ae,t[130]=We):We=t[130],We}function BR(){return document.body.removeAttribute(`data-editor-tab-dragging`)}function VR(e){return[`editor-pane:${e.id}`,e.size]}function HR(e){return e.id}function UR(){return new Map}function WR(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}var GR=`doc-panel`,KR=`agent-panel`,qR=`terminal-column`,JR=`agents-column`,YR=[GR,KR,qR,JR],XR=new Set(YR);function ZR(e){return XR.has(e)}function QR(e){let t=null,n=0;for(let r of e)if(!ZR(r)&&(t=r,n+=1,n>1))return null;return n===1?t:null}function $R(e){let t=[...e],n=QR(t),r=YR.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 ez(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 tz=Yo,nz=tz+1,rz=.05;function iz({otherRailWidthPx:e,agentsMinimumWidthPx:t}){let n=e+t+tz;return Math.ceil(n/(1-rz))}function az({workspaceWidthPx:e,otherRailWidthPx:t,agentsMinimumWidthPx:n,previous:r,current:i,trigger:a}){if(!i.terminalRightVisible||!i.agentsVisible||e>=iz({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 oz=`ok-terminal-height-v1`,sz=1/3,cz=.5;function lz(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*cz))}function uz(e){let t=Number.isFinite(e)?e:0;return t<=0?240:Math.round(t*sz)}function dz(e,t){let n=lz(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(uz(t),n)}function fz(){return typeof window>`u`?0:window.innerHeight}function pz(e,t){return dz(e,t??fz())}function mz(e,t){try{let n=e??localStorage,r=t??fz(),i=n.getItem(oz);if(i==null)return dz(uz(r),r);let a=Number.parseInt(i,10);return dz(Number.isFinite(a)?a:uz(r),r)}catch{return 240}}function hz(e,t,n){try{let r=t??localStorage,i=n??fz();r.setItem(oz,String(dz(e,i)))}catch{}}function gz(){try{return typeof localStorage>`u`?240:mz()}catch{return 240}}var _z=`terminal-dock-panel`;function vz(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}=Dn(),u=NE(),d=c===`bottom`&&i,[f,p]=(0,Q.useState)(!d),m=rg(l).background,[h]=(0,Q.useState)(yz),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(()=>{hz(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=pz(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)(_k,{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)(vk,{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)(_k,{id:_z,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:Bn(`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)(gk,{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 yz(){return gz()}function bz(e){let t=(0,$.c)(20),{edge:n,onReveal:r,className:i}=e,{_:a}=on(),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=Bn(`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)(Bl,{"aria-hidden":`true`}):(0,Z.jsx)(Ul,{"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)(sr,{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)(cr,{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 xz=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-82sBOezj.js`),__vite__mapDeps([78,1,45,12,13,14,27,16,17,18,28,29,30,26,24,25,31,22,34,35,36,20,79,2,80,81,11,82,83,84,85,86,87,88,89,90,6,3,7,8,9,10,91,74,92,93,94,95,96,4,97,54,19,21,40,98,39,99,100,101,41,42,66,67,68,69,102,49,71,103,104,46,105,33,65,70,72,73,106,107,108,37,23,109,110,43,47,111,112,113,114,115,116,117,118,119,120,121]),import.meta.url)).ActivityModeContent})),Sz=/^Could not find Group with id "/;function Cz(e,t){t instanceof Error&&Sz.test(t.message)||console.warn(JSON.stringify({event:e,error:t instanceof Error?t.message:String(t)}))}var wz=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillEditBanner:e}=await import(`./SkillEditBanner-Dc5M38zl.js`);return{SkillEditBanner:e}},__vite__mapDeps([186,12,1,13,14,149,22,24,187,25,26,69,6,2,3,7,8,9,10,11]),import.meta.url)).SkillEditBanner})),Tz=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./LintConfigEditor-CMXHDFZF.js`),__vite__mapDeps([188,12,1,13,14,24,189,80,81,11,6,2,3,7,8,9,10,91,45,74,92,18,93,94,95,96,97,35,36,16,17,20,54,28,29,34,25,26,19,22,21,40,98,53,55,30,169,86,170,67,173,102,156,15,23,39,123,140,100,64,105,108,43,147,47,128,157,31,158,49,190]),import.meta.url)).LintConfigEditor})),Ez=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./SchemaConfigEditor-rEKhSqJM.js`),__vite__mapDeps([191,1,12,13,14,97,35,36,16,17,18,20,54,28,29,34,24,25,26,19,22,21,40,98,123,100,30,165,192,107,42,92,189,80,81,11,6,2,3,7,8,9,10,91,45,74,93,94,95,96,53,55,169,86,170,67,173,102,154,43,47,157,31,158,190]),import.meta.url)).SchemaConfigEditor}));function Dz(){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 Oz(e){let t=(0,$.c)(17),{docName:n,provider:r,isSourceMode:i,onModeChange:a,isPanelCollapsed:o,onTogglePanel:s,reserveRightGutter:c}=e,{requestAddProperty:l}=kl(),u=cA(r),{data:d}=zm(n),f=Nl(i?null:r,d?.effective??null),p;t[0]===f?p=t[1]:(p=Ol(f),t[0]=f,t[1]=p);let{missing:m}=p;if(Ik(n)===`conflict`)return null;let h=iL()?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)(lL,{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 kz=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./TimelineDiffPane-35Fhuse-.js`),__vite__mapDeps([193,1,2,194,6,3,7,8,9,10,11,79,80,81,82,83,84,85,86,87,88,89,90,36,91,45,74,14,24,13,92,18,93,94,95,96,12,4,97,35,16,17,20,54,28,29,34,25,26,19,22,21,40,98,39,27,30,31,99,100,101,41,42,66,67,68,69,102,49,71,103,104,46,105,33,65,70,72,73,106,107,108,37,23,109,110,43,47,111,112,113,195,53,55,196,114,121,77,118]),import.meta.url)).TimelineDiffPane})),Az=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./AgentDiffPane-CoeEE99v.js`),__vite__mapDeps([197,1,2,194,6,3,7,8,9,10,11,79,80,81,82,83,84,85,86,87,88,89,90,36,91,45,74,14,24,13,92,18,93,94,95,96,12,4,97,35,16,17,20,54,28,29,34,25,26,19,22,21,40,98,39,27,30,31,99,100,101,41,42,66,67,68,69,102,49,71,103,104,46,105,33,65,70,72,73,106,107,108,37,23,109,110,43,47,111,112,113,195,53,55,196,115,116,117,121,77,119,120]),import.meta.url)).AgentDiffPane})),jz=300,Mz=`${jz}px`,Nz=`600px`;function Pz(e){return e}function Fz(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(Lz,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Iz,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(bp,{name:`editor-area`,children:(0,Z.jsxs)(jl,{children:[n,r]})}),t[3]=n,t[4]=i),i}function Iz(){let e=(0,$.c)(6),t=bs(),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)(ak,{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 Lz(e){let t=(0,$.c)(346),{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?Pz:g,{_:x}=on(),{activeDocName:S,activeProvider:C,activeTarget:w,activeNewTabId:T,skillsSidebar:D,recycleDocument:O,docPanelMode:k,docPanelAgentId:A,docPanelExpandSignal:j}=Oe(),{openDocumentTransition:M}=bt(),N=Pk(C,S),P=Lk(S,n===`source`?`source`:`wysiwyg`),[F,I]=(0,Q.useState)(!1),L,R;t[0]!==C||t[1]!==F?(L=()=>{C!=null&&!F&&I(!0)},R=[C,F],t[0]=C,t[1]=F,t[2]=L,t[3]=R):(L=t[2],R=t[3]),(0,Q.useEffect)(L,R);let z=(0,Q.useDeferredValue)(S),B=n===`source`,H=w?.kind===`missing`,U=!!S&&w?.kind!==`folder`,W;t[4]!==x||t[5]!==H?(W=H?x({id:`K-a33w`}):void 0,t[4]=x,t[5]=H,t[6]=W):W=t[6];let ee=W,G=Km(),K,q;t[7]!==S||t[8]!==G?(K=()=>{G&&G.docName!==S&&qm()},q=[S,G],t[7]=S,t[8]=G,t[9]=K,t[10]=q):(K=t[9],q=t[10]),(0,Q.useEffect)(K,q);let te=Hm(),J=te?.docName??null,ne=(0,Q.useRef)(null),re;t[11]!==S||t[12]!==J||t[13]!==M?(re=()=>{if(J==null){ne.current=null;return}if(ne.current=J,J!==S){let e=Cf(J);jf(window.location.hash,e)?M(J):window.location.hash=e}},t[11]=S,t[12]=J,t[13]=M,t[14]=re):re=t[14];let ie;t[15]===J?ie=t[16]:(ie=[J],t[15]=J,t[16]=ie),(0,Q.useEffect)(re,ie);let ae,oe;t[17]!==S||t[18]!==J?(ae=()=>{if(J!=null){if(J===S){ne.current=null;return}ne.current!==J&&Wm()}},oe=[S,J],t[17]=S,t[18]=J,t[19]=ae,t[20]=oe):(ae=t[19],oe=t[20]),(0,Q.useEffect)(ae,oe);let se,ce;t[21]!==A||t[22]!==k?(se=()=>{k===`agent`&&A!==null||Wm()},ce=[k,A],t[21]=A,t[22]=k,t[23]=se,t[24]=ce):(se=t[23],ce=t[24]),(0,Q.useEffect)(se,ce);let le=(0,Q.useSyncExternalStore)(ud.subscribe,ud.getSnapshot,ud.getSnapshot),ue;t[25]!==w||t[26]!==le?(ue=md(w,le),t[25]=w,t[26]=le,t[27]=ue):ue=t[27];let de=ue,[fe]=(0,Q.useState)(Vz),pe=fe!==null,me;t[28]===fe?me=t[29]:(me=()=>Zk(fe,window.innerWidth,`right`),t[28]=fe,t[29]=me);let[he,ge]=(0,Q.useState)(me),_e=(0,Q.useRef)(he),ve,ye;t[30]===he?(ve=t[31],ye=t[32]):(ve=()=>{_e.current=he},ye=[he],t[30]=he,t[31]=ve,t[32]=ye),(0,Q.useEffect)(ve,ye);let be=NE(),xe=NE(),Se=NE(),Ce;t[33]===he?Ce=t[34]:(Ce=()=>oA(`right`,he,iA())===`collapsed`,t[33]=he,t[34]=Ce);let[we]=(0,Q.useState)(Ce),[Te,Ee]=(0,Q.useState)(we),De=(0,Q.useRef)(Te),[ke,Ae]=(0,Q.useState)(null),[je,Me]=(0,Q.useState)(null),[Ne,Pe]=(0,Q.useState)(null),[Fe,Ie]=(0,Q.useState)(null),[Le,Re]=(0,Q.useState)(null),[ze,Be]=(0,Q.useState)(null),Ve=y,He=_&&v===`right`,Ue=He||Ve,We=!y&&h!=null,Ge=v===`right`?je:Le,Ke=_&&Ge!=null,qe=y&&ke!=null,Je,Ye;t[35]!==ke||t[36]!==qe||t[37]!==m||t[38]!==Ge||t[39]!==ze||t[40]!==Ke?(Je=()=>{m?.({terminal:{container:Ge,isShowing:Ke},agents:{container:ke,isShowing:qe},editorRegion:ze})},Ye=[m,Ge,Ke,ke,qe,ze],t[35]=ke,t[36]=qe,t[37]=m,t[38]=Ge,t[39]=ze,t[40]=Ke,t[41]=Je,t[42]=Ye):(Je=t[41],Ye=t[42]),(0,Q.useEffect)(Je,Ye);let Xe,Qe;t[43]===Te?(Xe=t[44],Qe=t[45]):(Xe=()=>{De.current=Te},Qe=[Te],t[43]=Te,t[44]=Xe,t[45]=Qe),(0,Q.useEffect)(Xe,Qe);let[$e,et]=(0,Q.useState)(!1),nt=(0,Q.useRef)(!1),[rt]=(0,Q.useState)(Bz),it=(0,Q.useRef)(rt),ot=(0,Q.useRef)(null),st;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(st=function(e){ot.current!=null&&clearTimeout(ot.current),ot.current=setTimeout(()=>{Kk(e),ot.current=null},100)},t[46]=st):st=t[46];let ct=st,[lt]=(0,Q.useState)(zz),ut=(0,Q.useRef)(lt),[dt,ft]=(0,Q.useState)(!1),pt=(0,Q.useRef)(!1),mt=(0,Q.useRef)(null),ht;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(ht=function(e){mt.current!=null&&clearTimeout(mt.current),mt.current=setTimeout(()=>{Vk(e),mt.current=null},100)},t[47]=ht):ht=t[47];let gt=ht,_t;t[48]===l?_t=t[49]:(_t=()=>Math.max(l??mo,nz),t[48]=l,t[49]=_t);let[vt]=(0,Q.useState)(_t),yt=Math.max(l??vt,nz),xt=(0,Q.useRef)(vt),[St,Ct]=(0,Q.useState)(!1),wt=(0,Q.useRef)(!1),Tt=(0,Q.useRef)(null),Et;t[50]===d?Et=t[51]:(Et=function(e){Tt.current!=null&&clearTimeout(Tt.current),Tt.current=setTimeout(()=>{d?.(e),Tt.current=null},100)},t[50]=d,t[51]=Et);let Dt=Et,kt,At;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(kt=()=>()=>{ot.current!=null&&clearTimeout(ot.current),mt.current!=null&&clearTimeout(mt.current),Tt.current!=null&&clearTimeout(Tt.current)},At=[],t[52]=kt,t[53]=At):(kt=t[52],At=t[53]),(0,Q.useEffect)(kt,At);let[jt,Mt]=(0,Q.useState)(null),Nt=(0,Q.useRef)(null),Pt,Ft;t[54]!==Fe||t[55]!==Ne?(Pt=()=>{if(Ne==null||Fe==null)return;let e=()=>{Ne.style.setProperty(`--editor-header-tabs-width`,`${Fe.getBoundingClientRect().width}px`)};if(e(),typeof ResizeObserver>`u`)return;let t=new ResizeObserver(e);return t.observe(Fe),()=>t.disconnect()},Ft=[Ne,Fe],t[54]=Fe,t[55]=Ne,t[56]=Pt,t[57]=Ft):(Pt=t[56],Ft=t[57]),(0,Q.useLayoutEffect)(Pt,Ft);let It=OE(),Lt;t[58]!==xe||t[59]!==be||t[60]!==Se?(Lt=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=Nt.current;return e!=null&&e.offsetWidth>0?e.offsetWidth:null},t[58]=xe,t[59]=be,t[60]=Se,t[61]=Lt):Lt=t[61];let Rt=Lt,zt;t[62]!==It||t[63]!==be||t[64]!==Rt?(zt=function(){let e=It.current;if(e==null)return null;try{let t=Rt();if(t==null)return null;let n=e.getLayout();if(!(`doc-panel`in n||`agent-panel`in n))return{workspaceWidthPx:t,otherRailWidthPx:0};let r=be.current?.getSize().inPixels,i=r!=null&&r>0?r:it.current;return{workspaceWidthPx:t,otherRailWidthPx:Math.max(i,jz)}}catch(e){return Cz(`resolve-admission-metrics-failed`,e),null}},t[62]=It,t[63]=be,t[64]=Rt,t[65]=zt):zt=t[65];let Bt=zt,Vt;t[66]!==y||t[67]!==He?(Vt={terminalRightVisible:He,agentsVisible:y},t[66]=y,t[67]=He,t[68]=Vt):Vt=t[68];let Ht=Vt,Ut=(0,Q.useRef)(Ht),Wt=(0,Q.useRef)(Ht),Gt=(0,Q.useRef)(Te),Kt=(0,Q.useRef)(null),qt;t[69]!==x||t[70]!==p||t[71]!==u||t[72]!==Bt?(qt=function(e,t){let n=Bt();if(n==null)return;let r=az({...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),Ns.info(x({id:`KGF42E`}));return}u!=null&&(Kt.current=r.kind,u(!1),Ns.info(x({id:`2VSPan`})))}},t[69]=x,t[70]=p,t[71]=u,t[72]=Bt,t[73]=qt):qt=t[73];let Jt=qt,Yt=(0,Q.useRef)(Jt),Xt;t[74]!==Ht||t[75]!==Jt?(Xt=()=>{Yt.current=Jt,Ut.current=Ht},t[74]=Ht,t[75]=Jt,t[76]=Xt):Xt=t[76],(0,Q.useLayoutEffect)(Xt);let Zt,Qt;t[77]!==y||t[78]!==Te||t[79]!==He?(Zt=()=>{!y&&Kt.current===`close-agents`&&(Kt.current=null),!He&&Kt.current===`close-terminal`&&(Kt.current=null);let e=Wt.current,t=Gt.current;Wt.current={terminalRightVisible:He,agentsVisible:y},Gt.current=Te,queueMicrotask(()=>{Yt.current(t===Te?`state-change`:`resize`,e)})},Qt=[y,He,Te],t[77]=y,t[78]=Te,t[79]=He,t[80]=Zt,t[81]=Qt):(Zt=t[80],Qt=t[81]),(0,Q.useLayoutEffect)(Zt,Qt);let $t;t[82]!==It||t[83]!==Rt?($t=function(e){let t=It.current;if(t==null)return!1;let n,r;try{n=Rt(),r=t.getLayout()}catch(e){return Cz(`apply-rail-layout-read-failed`,e),!1}if(n==null)return!1;let i=$R(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[GR]=e?0:t?jz:it.current),`terminal-column`in r&&(n[qR]=Ut.current.terminalRightVisible?t?nz:xt.current:0),`agents-column`in r&&(n[JR]=Ut.current.agentsVisible?t?320:ut.current:0),n},s=o(!1);if(Object.keys(s).length===0)return!1;let c=ez({currentLayout:r,containerPx:n,pinnedPx:s,residualId:a});if(c===r&&(c=ez({currentLayout:r,containerPx:n,pinnedPx:o(!0),residualId:a})),c===r)return!0;try{t.setLayout(c)}catch(e){return Cz(`apply-rail-layout-write-failed`,e),!1}return!0},t[82]=It,t[83]=Rt,t[84]=$t):$t=t[84];let en=$t,tn;t[85]!==It||t[86]!==Rt?(tn=function(e,t,n){t||n<=0||queueMicrotask(()=>{let t=It.current;if(t==null)return;let n,r;try{n=t.getLayout(),r=Rt()}catch(e){Cz(`reclaim-hidden-rail-read-failed`,e);return}if(r==null||!(e in n)||n[e]===0)return;let i=QR(Object.keys(n));if(i==null)return;let a=ez({currentLayout:n,containerPx:r,pinnedPx:{[e]:0},residualId:i});if(a!==n)try{t.setLayout(a)}catch(e){Cz(`reclaim-hidden-rail-write-failed`,e)}})},t[85]=It,t[86]=Rt,t[87]=tn):tn=t[87];let nn=tn,rn;t[88]===en?rn=t[89]:(rn=function(e){nt.current||wt.current||pt.current||(De.current=e,en(e))},t[88]=en,t[89]=rn);let an=rn,sn=(0,Q.useRef)(an),cn;t[90]===an?cn=t[91]:(cn=()=>{sn.current=an},t[90]=an,t[91]=cn),(0,Q.useEffect)(cn);let ln=(0,Q.useRef)(null),un;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(un=function(e,t,n,r){ln.current?.(),t(!0),n.current=!0;let i=function(){window.removeEventListener(`pointerup`,a),window.removeEventListener(`pointercancel`,o),ln.current=null,t(!1),n.current=!1};function a(t){t.pointerId===e&&(i(),r?.())}function o(t){t.pointerId===e&&(i(),sn.current(De.current))}ln.current=i,window.addEventListener(`pointerup`,a),window.addEventListener(`pointercancel`,o)},t[92]=un):un=t[92];let dn=un,fn,pn;t[93]===Symbol.for(`react.memo_cache_sentinel`)?(fn=()=>()=>ln.current?.(),pn=[],t[93]=fn,t[94]=pn):(fn=t[93],pn=t[94]),(0,Q.useEffect)(fn,pn);let mn;t[95]===en?mn=t[96]:(mn=function(){return nt.current||wt.current||pt.current?!0:en(De.current)},t[95]=en,t[96]=mn);let hn=mn,gn;t[97]===hn?gn=t[98]:(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[97]=hn,t[98]=gn);let _n;t[99]!==Ve||t[100]!==He?(_n=[He,Ve],t[99]=Ve,t[100]=He,t[101]=_n):_n=t[101],(0,Q.useEffect)(gn,_n);let vn;t[102]!==an||t[103]!==be?(vn=function(){be.current!=null&&an(!1)},t[102]=an,t[103]=be,t[104]=vn):vn=t[104];let yn=vn,bn;t[105]!==an||t[106]!==Te||t[107]!==be?(bn=function(){if(be.current==null)return;let e=_e.current;Te?(sA(`right`,e,`open`),an(!1)):(sA(`right`,e,`collapsed`),an(!0))},t[105]=an,t[106]=Te,t[107]=be,t[108]=bn):bn=t[108];let xn=bn,Sn,Cn;t[109]!==an||t[110]!==fe?(Sn=()=>{let e=window.matchMedia(`(min-width: ${Yk}px)`),t=()=>{let e=Zk(fe,window.innerWidth,`right`);ge(e);let t=oA(`right`,e,iA())===`collapsed`;Ee(t),an(t)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},Cn=[fe,an],t[109]=an,t[110]=fe,t[111]=Sn,t[112]=Cn):(Sn=t[111],Cn=t[112]),(0,Q.useEffect)(Sn,Cn);let wn,Tn;t[113]!==jt||t[114]!==pe?(wn=()=>{if(jt==null||pe)return;let e=new ResizeObserver(()=>{sn.current(De.current),Yt.current(`resize`,Ut.current)});return e.observe(jt),()=>e.disconnect()},Tn=[jt,pe],t[113]=jt,t[114]=pe,t[115]=wn,t[116]=Tn):(wn=t[115],Tn=t[116]),(0,Q.useEffect)(wn,Tn);let En,Dn;t[117]!==yn||t[118]!==a?(En=()=>{let e=e=>{a(e),yn()},t=at();return t&&e(t),V(t=>{at(),e(t)})},Dn=[a,yn],t[117]=yn,t[118]=a,t[119]=En,t[120]=Dn):(En=t[119],Dn=t[120]),(0,Q.useEffect)(En,Dn);let On,kn;t[121]!==j||t[122]!==yn?(On=()=>{j!==0&&yn()},kn=[j,yn],t[121]=j,t[122]=yn,t[123]=On,t[124]=kn):(On=t[123],kn=t[124]),(0,Q.useEffect)(On,kn);let An=`${He}:${Ve}`,jn=(0,Q.useRef)(An),Mn,Nn;t[125]!==Te||t[126]!==An?(Mn=()=>{if(jn.current===An)return;jn.current=An;let e=Te;queueMicrotask(()=>{sn.current(e)})},Nn=[An,Te],t[125]=Te,t[126]=An,t[127]=Mn,t[128]=Nn):(Mn=t[127],Nn=t[128]),(0,Q.useLayoutEffect)(Mn,Nn);let Pn,In;t[129]===Te?(Pn=t[130],In=t[131]):(Pn=()=>{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()},In=[Te],t[129]=Te,t[130]=Pn,t[131]=In),(0,Q.useLayoutEffect)(Pn,In);let Ln,Rn;t[132]===Te?(Ln=t[133],Rn=t[134]):(Ln=()=>{Js({docPanelVisible:!Te}),window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!Te})},Rn=[Te],t[132]=Te,t[133]=Ln,t[134]=Rn),(0,Q.useEffect)(Ln,Rn);let zn,Bn;t[135]===xn?(zn=t[136],Bn=t[137]):(zn=()=>Fn(e=>{e===`toggle-doc-panel`&&xn()}),Bn=[xn],t[135]=xn,t[136]=zn,t[137]=Bn),(0,Q.useEffect)(zn,Bn);let Vn,Hn;t[138]===xn?(Vn=t[139],Hn=t[140]):(Vn=()=>{if(window.okDesktop!=null)return;let e=e=>{As(e,`toggle-document-panel`)&&(rr()||(e.preventDefault(),xn()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Hn=[xn],t[138]=xn,t[139]=Vn,t[140]=Hn),(0,Q.useEffect)(Vn,Hn);let Un=(0,Q.useRef)(null),[Wn,Gn]=(0,Q.useState)(null),[Kn,qn]=(0,Q.useState)(!1),[Jn,Yn]=(0,Q.useState)(null),Xn=w?.kind===`large-file`?w.docName:S,Zn,Qn;t[141]===Xn?(Zn=t[142],Qn=t[143]):(Zn=()=>{if(Xn&&Xn!==Un.current){let e=Un.current;Un.current=Xn,Gn(e)}},Qn=[Xn],t[141]=Xn,t[142]=Zn,t[143]=Qn),(0,Q.useEffect)(Zn,Qn);let $n;t[144]===M?$n=t[145]:($n=function(e){let t=Cf(e);jf(window.location.hash,t)?M(e):window.location.hash=t},t[144]=M,t[145]=$n);let er=$n,tr,nr,ir,ar;if(t[146]!==S||t[147]!==T||t[148]!==C||t[149]!==i||t[150]!==w||t[151]!==te||t[152]!==J||t[153]!==y||t[154]!==Jn||t[155]!==Kn||t[156]!==z||t[157]!==A||t[158]!==k||t[159]!==F||t[160]!==rt||t[161]!==we||t[162]!==Te||t[163]!==pe||t[164]!==B||t[165]!==er||t[166]!==a||t[167]!==be||t[168]!==Wn||t[169]!==We||t[170]!==P||t[171]!==de||t[172]!==U||t[173]!==D||t[174]!==N||t[175]!==o||t[176]!==_||t[177]!==G||t[178]!==xn){ir=Symbol.for(`react.early_return_sentinel`);bb0:if(nr=null,tr=null,w?.kind===`large-file`){let e;t[183]!==er||t[184]!==Wn?(e=Wn?{previousDocName:Wn,onNavigateBack:er}:void 0,t[183]=er,t[184]=Wn,t[185]=e):e=t[185],ar=(0,Z.jsx)(ZD,{docName:w.docName,size:w.size,limit:w.limit,backNav:e})}else if(w?.kind===`folder`){let e;t[186]!==y||t[187]!==pe||t[188]!==_?(e=QA({terminalVisible:_,agentsVisible:y,isEmbedded:pe}),t[186]=y,t[187]=pe,t[188]=_,t[189]=e):e=t[189];let n=e,r;t[190]===w.folderPath?r=t[191]:(r=(0,Z.jsx)(BD,{folderPath:w.folderPath}),t[190]=w.folderPath,t[191]=r);let i;t[192]===n?i=t[193]:(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[192]=n,t[193]=i);let a;t[194]!==r||t[195]!==i?(a=(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[r,i]}),t[194]=r,t[195]=i,t[196]=a):a=t[196];let o;if(t[197]!==w.folderPath||t[198]!==n?(o=n?(0,Z.jsx)(IA,{folderPath:w.folderPath}):null,t[197]=w.folderPath,t[198]=n,t[199]=o):o=t[199],ar=(0,Z.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[a,o]}),k===`agent`&&A!==null){let e;t[200]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(vk,{withHandle:!0}),t[200]=e):e=t[200];let n;t[201]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(_k,{id:KR,defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,className:`flex flex-col bg-muted/20`,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)(xz,{showBackButton:!1})})})]}),t[201]=n):n=t[201],nr=n}}else if(w?.kind===`asset`&&Do(w.assetPath.split(`/`).pop()??w.assetPath)){let e;t[202]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Dz,{}),t[202]=e):e=t[202];let n;t[203]===w.assetPath?n=t[204]:(n=(0,Z.jsx)(Tz,{assetPath:w.assetPath},w.assetPath),t[203]=w.assetPath,t[204]=n),ar=(0,Z.jsx)(Q.Suspense,{fallback:e,children:n})}else if(w?.kind===`asset`&&Na(w.assetPath)){let e;t[205]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Dz,{}),t[205]=e):e=t[205];let n;t[206]===w.assetPath?n=t[207]:(n=(0,Z.jsx)(Ez,{assetPath:w.assetPath},w.assetPath),t[206]=w.assetPath,t[207]=n),ar=(0,Z.jsx)(Q.Suspense,{fallback:e,children:n})}else if(w?.kind===`asset`)ar=(0,Z.jsx)(zE,{assetPath:w.assetPath,mediaKind:w.mediaKind},w.assetPath);else if(w?.kind===`skill-file`)ar=(0,Z.jsx)(gO,{scope:w.scope,name:w.name,path:w.path,host:w.host},`${w.scope}/${w.name}/${w.host??``}/${w.path}`);else if(w?.kind===`skill-preview`)ar=(0,Z.jsx)(HO,{flavor:w.flavor,source:w.source,name:w.name,subtitle:w.subtitle,level:w.level,path:w.path,reserveRightGutter:We},`${w.flavor}:${w.source}:${w.name}:${w.level??``}`);else if(de)ar=(0,Z.jsx)(tO,{nav:de},de.path);else if(!C||!S)if((typeof window<`u`?kf(window.location.hash):null)!==null)if(o!=null&&F){ar=(0,Z.jsx)(VE,{});let e;t[208]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(vk,{withHandle:!0,disabled:!0}),t[208]=e):e=t[208];let n=we?0:`${rt}px`,r;t[209]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`}),t[209]=r):r=t[209];let i;t[210]===n?i=t[211]:(i=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(_k,{id:GR,defaultSize:n,minSize:Mz,maxSize:Nz,collapsible:!0,collapsedSize:0,inert:!0,className:`flex flex-col bg-muted/20`,children:r})]}),t[210]=n,t[211]=i),nr=i}else{let e;t[212]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(VE,{}),t[212]=e):e=t[212],ir=e;break bb0}else ar=Ot(T)?(0,Z.jsx)(eO,{}):tt(T)||D?(0,Z.jsx)(JO,{sessionsDockOpen:_}):Jn!==null&&Jn===T?(0,Z.jsx)(eO,{autoStart:!0}):(0,Z.jsx)(sD,{terminalOpen:_,agentsOpen:y,onRageStreak:T?()=>Ig(()=>Yn(T)):void 0});else{let e;t[213]!==S||t[214]!==te||t[215]!==J||t[216]!==y||t[217]!==pe||t[218]!==_||t[219]!==G?(e=ZA({terminalVisible:_,agentsVisible:y,isEmbedded:pe,activeDocName:S})&&!(G&&G.docName===S)&&!(te&&J===S),t[213]=S,t[214]=te,t[215]=J,t[216]=y,t[217]=pe,t[218]=_,t[219]=G,t[220]=e):e=t[220];let n=e,r;t[221]===S?r=t[222]:(r=S?Bo(S):null,t[221]=S,t[222]=r);let o=r,s;t[223]!==S||t[224]!==te||t[225]!==J||t[226]!==Kn||t[227]!==z||t[228]!==o||t[229]!==Te||t[230]!==B||t[231]!==P||t[232]!==n||t[233]!==U||t[234]!==N||t[235]!==G||t[236]!==xn?(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)(wz,{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)(Ak,{activeDocName:S,isSourceMode:B}),WR({activeDocName:S,deferredActiveDocName:z,mountResolved:S!==null&&E(S),syncResolved:S!==null&&Ze(S)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(VE,{}),S===null?null:(0,Z.jsx)(QD,{docName:S})]}):null,G&&G.docName===S?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(kz,{view:G,isPanelCollapsed:Te,onTogglePanel:xn})}):null,te&&J===S?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(Az,{view:te,isPanelCollapsed:Te,onTogglePanel:xn})}):null]}),n?(0,Z.jsx)(IA,{docName:S,surface:B?`source`:`wysiwyg`,dismissed:Kn,onDismiss:()=>qn(!0),onReopen:()=>qn(!1)}):null]}),(0,Z.jsx)(KI,{stats:N,selectionStats:P,showStats:U,composerBadge:n&&Kn?{onReopen:()=>qn(!1)}:null})]}),t[223]=S,t[224]=te,t[225]=J,t[226]=Kn,t[227]=z,t[228]=o,t[229]=Te,t[230]=B,t[231]=P,t[232]=n,t[233]=U,t[234]=N,t[235]=G,t[236]=xn,t[237]=s):s=t[237];let c=s;ar=null,tr=c;let l=!Te,u;t[238]===Symbol.for(`react.memo_cache_sentinel`)?(u=e=>{dn(e.pointerId,et,nt)},t[238]=u):u=t[238];let d;t[239]!==Te||t[240]!==l?(d=(0,Z.jsx)(vk,{"data-doc-panel-handle":``,withHandle:l,disabled:Te,onPointerDown:u}),t[239]=Te,t[240]=l,t[241]=d):d=t[241];let f=we?0:`${rt}px`,p;t[242]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{Ee(e.asPercentage===0),e.inPixels>0&&nt.current&&(it.current=e.inPixels,ct(e.inPixels))},t[242]=p):p=t[242];let m;t[243]!==S||t[244]!==i||t[245]!==k||t[246]!==B||t[247]!==a?(m=(0,Z.jsx)(Lw,{docName:S,isSourceMode:B,activeTab:i,onActiveTabChange:a,mode:k}),t[243]=S,t[244]=i,t[245]=k,t[246]=B,t[247]=a,t[248]=m):m=t[248];let h;t[249]!==Te||t[250]!==be||t[251]!==f||t[252]!==m?(h=(0,Z.jsx)(_k,{id:GR,panelRef:be,defaultSize:f,minSize:Mz,maxSize:Nz,collapsible:!0,collapsedSize:0,onResize:p,inert:Te,className:`flex flex-col bg-muted/20`,children:m}),t[249]=Te,t[250]=be,t[251]=f,t[252]=m,t[253]=h):h=t[253];let g;t[254]!==d||t[255]!==h?(g=(0,Z.jsxs)(Z.Fragment,{children:[d,h]}),t[254]=d,t[255]=h,t[256]=g):g=t[256],nr=g}t[146]=S,t[147]=T,t[148]=C,t[149]=i,t[150]=w,t[151]=te,t[152]=J,t[153]=y,t[154]=Jn,t[155]=Kn,t[156]=z,t[157]=A,t[158]=k,t[159]=F,t[160]=rt,t[161]=we,t[162]=Te,t[163]=pe,t[164]=B,t[165]=er,t[166]=a,t[167]=be,t[168]=Wn,t[169]=We,t[170]=P,t[171]=de,t[172]=U,t[173]=D,t[174]=N,t[175]=o,t[176]=_,t[177]=G,t[178]=xn,t[179]=tr,t[180]=nr,t[181]=ir,t[182]=ar}else tr=t[179],nr=t[180],ir=t[181],ar=t[182];if(ir!==Symbol.for(`react.early_return_sentinel`))return ir;let X;t[257]===Symbol.for(`react.memo_cache_sentinel`)?(X=function(e){let{activityMount:t,pane:n}=e,r=n.activeTarget;return t||(r?.kind===`large-file`?(0,Z.jsx)(ZD,{docName:r.docName,size:r.size,limit:r.limit}):r?.kind===`folder`?(0,Z.jsx)(BD,{folderPath:r.folderPath}):r?.kind===`asset`&&Do(r.assetPath.split(`/`).pop()??r.assetPath)?(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(Dz,{}),children:(0,Z.jsx)(Tz,{assetPath:r.assetPath},r.assetPath)}):r?.kind===`asset`&&Na(r.assetPath)?(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(Dz,{}),children:(0,Z.jsx)(Ez,{assetPath:r.assetPath},r.assetPath)}):r?.kind===`asset`?(0,Z.jsx)(zE,{assetPath:r.assetPath,mediaKind:r.mediaKind},r.assetPath):r?.kind===`skill-file`?(0,Z.jsx)(gO,{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)(HO,{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??``}`):n.activeNewTabId&&tt(n.activeNewTabId)?(0,Z.jsx)(JO,{sessionsDockOpen:!1}):(0,Z.jsx)(sD,{}))},t[257]=X):X=t[257];let or=X,sr;t[258]!==tr||t[259]!==ar?(sr=function(e){return e.isFocused?tr?tr(e.activityMount):ar:or(e)},t[258]=tr,t[259]=ar,t[260]=sr):sr=t[260];let cr=sr,lr;t[261]!==S||t[262]!==z||t[263]!==ee||t[264]!==Te||t[265]!==B||t[266]!==er||t[267]!==r||t[268]!==Wn||t[269]!==O||t[270]!==We||t[271]!==de||t[272]!==xn?(lr=function(e){let{activityHosts:t,parkingHost:n,visibleDocNames:i}=e,a=de?new Set([...i].filter(e=>e!==S)):i,o=S&&a.has(S)?S:void 0,s=z&&a.has(z)?z:void 0,c=o?s??o:a.values().next().value;return c?(0,Z.jsx)(YF,{activeDocName:c,visibleDocNames:a,activityHosts:t,parkingHost:n,renderToolbar:(e,t)=>(0,Z.jsx)(Oz,{docName:e,provider:t,isSourceMode:B,onModeChange:r,isPanelCollapsed:Te,onTogglePanel:xn,reserveRightGutter:e===S&&We&&Te}),isSourceMode:B,editorPlaceholder:c===S?ee:void 0,previousDocName:Wn??void 0,onNavigateBack:er,onRecycle:O}):null},t[261]=S,t[262]=z,t[263]=ee,t[264]=Te,t[265]=B,t[266]=er,t[267]=r,t[268]=Wn,t[269]=O,t[270]=We,t[271]=de,t[272]=xn,t[273]=lr):lr=t[273];let ur=lr,dr=u??Rz,fr;t[274]!==b||t[275]!==Ne?(fr=e=>Ne==null?null:(0,Pg.createPortal)(b(e),Ne),t[274]=b,t[275]=Ne,t[276]=fr):fr=t[276];let pr;t[277]!==ur||t[278]!==cr||t[279]!==fr?(pr=(0,Z.jsx)(zR,{renderHeader:fr,renderPane:cr,renderActivityPool:ur}),t[277]=ur,t[278]=cr,t[279]=fr,t[280]=pr):pr=t[280];let mr;t[281]!==dr||t[282]!==pr||t[283]!==v||t[284]!==_?(mr=(0,Z.jsx)(vz,{placement:v,visible:_,onVisibleChange:dr,onBottomContainer:Re,onEditorRegion:Be,children:pr}),t[281]=dr,t[282]=pr,t[283]=v,t[284]=_,t[285]=mr):mr=t[285];let hr=mr,gr=He?void 0:`pointer-events-none`,_r;t[286]!==u||t[287]!==Se?(_r=e=>{dn(e.pointerId,Ct,wt,()=>{Se.current?.isCollapsed()&&u?.(!1)})},t[286]=u,t[287]=Se,t[288]=_r):_r=t[288];let vr;t[289]!==gr||t[290]!==_r||t[291]!==He?(vr=(0,Z.jsx)(vk,{withHandle:He,className:gr,onPointerDown:_r}),t[289]=gr,t[290]=_r,t[291]=He,t[292]=vr):vr=t[292];let yr=He?`${yt}px`:0,br;t[293]!==Dt||t[294]!==nn||t[295]!==He?(br=e=>{e.inPixels>0&&wt.current&&(xt.current=e.inPixels,Dt(e.inPixels)),nn(qR,He,e.inPixels)},t[293]=Dt,t[294]=nn,t[295]=He,t[296]=br):br=t[296];let xr;t[297]===Symbol.for(`react.memo_cache_sentinel`)?(xr=(0,Z.jsx)(`div`,{ref:Me,"data-terminal-panel-mount":``,className:`flex min-h-0 flex-1 flex-col overflow-hidden`}),t[297]=xr):xr=t[297];let Sr;t[298]!==yr||t[299]!==br||t[300]!==Se?(Sr=(0,Z.jsx)(_k,{id:qR,panelRef:Se,defaultSize:yr,minSize:`${nz}px`,collapsible:!0,collapsedSize:0,onResize:br,className:`flex flex-col`,children:xr}),t[298]=yr,t[299]=br,t[300]=Se,t[301]=Sr):Sr=t[301];let Cr;t[302]!==vr||t[303]!==Sr?(Cr=(0,Z.jsxs)(Z.Fragment,{children:[vr,Sr]}),t[302]=vr,t[303]=Sr,t[304]=Cr):Cr=t[304];let wr=Cr,Tr=Ve?void 0:`pointer-events-none`,Er;t[305]!==xe||t[306]!==p?(Er=e=>{dn(e.pointerId,ft,pt,()=>{xe.current?.isCollapsed()&&p?.(!1)})},t[305]=xe,t[306]=p,t[307]=Er):Er=t[307];let Dr;t[308]!==Ve||t[309]!==Tr||t[310]!==Er?(Dr=(0,Z.jsx)(vk,{withHandle:Ve,className:Tr,onPointerDown:Er}),t[308]=Ve,t[309]=Tr,t[310]=Er,t[311]=Dr):Dr=t[311];let Or=Ve?`${lt}px`:0,kr;t[312]!==Ve||t[313]!==nn?(kr=e=>{e.inPixels>0&&pt.current&&(ut.current=e.inPixels,gt(e.inPixels)),nn(JR,Ve,e.inPixels)},t[312]=Ve,t[313]=nn,t[314]=kr):kr=t[314];let Ar;t[315]===Symbol.for(`react.memo_cache_sentinel`)?(Ar=(0,Z.jsx)(`div`,{ref:Ae,"data-agents-panel-mount":``,className:`flex min-h-0 flex-1 flex-col overflow-hidden`}),t[315]=Ar):Ar=t[315];let jr;t[316]!==xe||t[317]!==Or||t[318]!==kr?(jr=(0,Z.jsx)(_k,{id:JR,panelRef:xe,defaultSize:Or,minSize:`320px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:kr,className:`flex flex-col`,children:Ar}),t[316]=xe,t[317]=Or,t[318]=kr,t[319]=jr):jr=t[319];let Mr;t[320]!==Dr||t[321]!==jr?(Mr=(0,Z.jsxs)(Z.Fragment,{children:[Dr,jr]}),t[320]=Dr,t[321]=jr,t[322]=Mr):Mr=t[322];let Nr=Mr,Pr=nr!=null&&!we||Ue,Fr;t[323]===Symbol.for(`react.memo_cache_sentinel`)?(Fr=(0,Z.jsx)(`div`,{ref:Pe,"data-editor-area-header":``,className:`relative z-30 shrink-0`}),t[323]=Fr):Fr=t[323];let Ir;t[324]===Symbol.for(`react.memo_cache_sentinel`)?(Ir=e=>{Mt(e),Nt.current=e},t[324]=Ir):Ir=t[324];let Lr=$e||St||dt||void 0,Rr=Ue?`5%`:`30%`,zr;t[325]===Pr?zr=t[326]:(zr=Pr?{}:{defaultSize:`100%`},t[325]=Pr,t[326]=zr);let Br;t[327]===hr?Br=t[328]:(Br=(0,Z.jsx)(`div`,{ref:Ie,className:`flex h-full min-w-0 flex-col`,children:hr}),t[327]=hr,t[328]=Br);let Vr;t[329]!==Rr||t[330]!==zr||t[331]!==Br?(Vr=(0,Z.jsx)(_k,{minSize:Rr,...zr,children:Br}),t[329]=Rr,t[330]=zr,t[331]=Br,t[332]=Vr):Vr=t[332];let Hr;t[333]!==Nr||t[334]!==It||t[335]!==nr||t[336]!==Vr||t[337]!==Lr||t[338]!==wr?(Hr=(0,Z.jsxs)(gk,{orientation:`horizontal`,groupRef:It,"data-dragging":Lr,children:[Vr,nr,wr,Nr]}),t[333]=Nr,t[334]=It,t[335]=nr,t[336]=Vr,t[337]=Lr,t[338]=wr,t[339]=Hr):Hr=t[339];let Ur;t[340]!==h||t[341]!==We?(Ur=We?(0,Z.jsx)(bz,{edge:`right`,onReveal:h,className:`top-2.5 right-0`}):null,t[340]=h,t[341]=We,t[342]=Ur):Ur=t[342];let Wr;return t[343]!==Hr||t[344]!==Ur?(Wr=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[Fr,(0,Z.jsxs)(`div`,{"data-editor-area-panels":``,className:`relative flex min-h-0 flex-1`,ref:Ir,children:[Hr,Ur]})]}),t[343]=Hr,t[344]=Ur,t[345]=Wr):Wr=t[345],Wr}function Rz(){}function zz(){return Hk()}function Bz(){return qk()}function Vz(){return Sa()}function Hz(){if(typeof window>`u`)return!1;let e=window.okDesktop;return e!=null&&e.menu!=null&&e.platform!==`darwin`}function Uz(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 Wz(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 Gz=1e3,Kz=!1;function qz(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function Jz(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:ig(i)?a=i:(a=void 0,Kz||(Kz=!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`&&(qz({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=Wz(i),{current:c,crossDoc:l}=a?ag(a,n,Date.now()):{current:[],crossDoc:[]},u=Yz,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>Uz(e.current,p)&&Uz(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,Gz);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 Yz(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var Xz=!1,Zz=new Set,Qz=!1;function $z(){for(let e of Zz)e()}function eB(e){Xz!==e&&(Xz=e,$z())}function tB(){return Xz}function nB(e){return Zz.add(e),()=>{Zz.delete(e)}}function rB(e){let t=[e.onUpdateRelaunching(()=>eB(!0)),e.onUpdateRelaunchFailed(()=>eB(!1))];return()=>{for(let e of t)e()}}function iB(){if(Qz||typeof window>`u`)return;let e=window.okDesktop;e&&(Qz=!0,rB(e))}function aB(){return(0,Q.useSyncExternalStore)(nB,tB,oB)}function oB(){return!1}var sB=`sync-status`;async function cB(e){try{let t=await ES(e);t.ok||Ns.error(t.message,{id:sB,duration:1/0})}catch{}}function lB(e,t){let n=(0,$.c)(6),{_:r}=on(),i=aB(),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(t),c,l;n[0]!==r||n[1]!==t||n[2]!==i||n[3]!==e?(c=()=>{if(s.current!==t&&(s.current=t,a.current=!1,o.current=!1),t)if(e===`synced`&&(a.current=!0),e===`disconnected`&&a.current){if(i){Ns.dismiss(sB);return}o.current=!0;let e=window.okDesktop;Ns.warning(r({id:`HGNCsl`}),{id:sB,duration:1/0,...e?{action:{label:r({id:`uaUc6t`}),onClick:()=>{cB(e)}}}:{}})}else o.current&&e===`synced`&&(o.current=!1,Ns.success(r({id:`GhjUB_`}),{id:sB,duration:3e3}))},l=[e,t,r,i],n[0]=r,n[1]=t,n[2]=i,n[3]=e,n[4]=c,n[5]=l):(c=n[4],l=n[5]),(0,Q.useEffect)(c,l)}var uB=4,dB=3,fB={Bird:mv,Cat:vv,Dog:Tv,Fish:jv,Mouse:ny,Rabbit:ty,Shrimp:ay,Snail:oy,Squirrel:ly,Turtle:Sy};Object.freeze(Object.keys(fB));function pB(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(fB,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var mB={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function hB(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:i}=e,{_:a}=on(),o=pB(n),s=o.kind===`animal`?fB[o.animal]:void 0,c;t[0]===n.name?c=t[1]:(c=aa(n.name),t[0]=n.name,t[1]=c);let l=c,u;t[2]===n.color?u=t[3]:(u=Go(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)(sr,{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)(cr,{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 gB(e){let t=mB[e.icon];return e.displayName||t||Ms._({id:`iEQQyu`})}function _B(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 vB(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{_:o}=on(),{activeDocName:s}=Oe(),{presence:c,agentId:l}=n,u=gB(c),d=_B(c.mode),f=!r&&d,p=c.currentDoc&&!ja(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)(Um,{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)(Um,{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)(sr,{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)(cr,{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 yB(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?Ms._({id:`9euN0m`,values:{count:n}}):Ms._({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)(In,{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)(hB,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(vB,{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)(jn,{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)(Ln,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function bB(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(hB,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(vB,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function xB(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=Oe(),{current:s,crossDoc:c}=Jz(t,r,n);if(lB(cA(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,uB),n;e[6]===s?n=e[7]:(n=s.slice(uB),e[6]=s,e[7]=n);let r=n,u=c.slice(0,dB),d;e[8]===c?d=e[9]:(d=c.slice(dB),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=>bB(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)(yB,{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=>bB(e,p,!0,m)),f.length>0?(0,Z.jsx)(yB,{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 SB(){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(CB),()=>{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 CB(e){console.warn(`[use-update-channel] bridge.state.query() failed`,e)}function wB(e){let t=(0,$.c)(6),{className:n}=e,{_:r}=on(),{channel:i}=SB();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)(Mp,{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 TB=(e,t,n)=>{if(e&&`reportValidity`in e){let r=_g(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},EB=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?TB(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>TB(t,n,e))}},DB=(e,t)=>{t.shouldUseNativeValidation&&EB(e,t);let n={};for(let r in e){let i=_g(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.ref});if(OB(t.names||Object.keys(e),r)){let e=Object.assign({},_g(n,r));cg(e,`root`,a),cg(n,r,e)}else cg(n,r,a)}return n},OB=(e,t)=>{let n=kB(t).replace(/[.*+?^${}()|\\]/g,`\\$&`);return e.some(e=>kB(e).match(`^${n}\\.\\d+`))};function kB(e){return e.replace(/[\[\]]/g,``)}function AB(){return AB=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},AB.apply(null,arguments)}function jB(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function MB(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]=dg(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function NB(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(AB({},t,{path:[].concat(r.path,t.path)}))})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=dg(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()};e.length;)r();return n}function PB(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(jB(function(){return Promise.resolve(e[n.mode===`sync`?`parse`:`parseAsync`](r,t)).then(function(e){return a.shouldUseNativeValidation&&EB({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return Array.isArray(e?.issues)}(e))return{values:{},errors:DB(MB(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(jB(function(){return Promise.resolve((n.mode===`sync`?la:us)(e,r,t)).then(function(e){return a.shouldUseNativeValidation&&EB({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return e instanceof Ka}(e))return{values:{},errors:DB(NB(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 FB=`https://openknowledge.ai/api/subscribe`;async function IB(e,t){try{let n=await fetch(FB,{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 LB(e){let t=(0,$.c)(49),{source:n,title:r,description:i,onSuccess:a,onDismiss:o,autoFocus:s,compactSubmit:c,className:l}=e,{_:u}=on(),[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=fs({email:hs({message:u({id:`Wq6Wcm`})})});_=lg,g=PB(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 IB(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=Bn(`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)(zl,{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)(hf,{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)(sg,{control:b.control,name:`email`,render:e=>{let{field:t,fieldState:n}=e;return(0,Z.jsxs)(xh,{className:`h-10 rounded-xl`,children:[(0,Z.jsx)(yh,{className:`pl-2.5`,children:(0,Z.jsx)(qv,{className:`size-4 text-muted-foreground opacity-60`})}),(0,Z.jsx)(bh,{...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:Bn(`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)(xd,{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)(ll,{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 RB=`ok-feedback-nudge-v1`,zB={firstSeenAt:null,shownAt:null,dismissed:!1};function BB(e){let t=0;for(let n of e)Yf(n)||t++;return t}function VB(e,t,n){return!e.dismissed&&e.shownAt==null&&e.firstSeenAt!=null&&t-e.firstSeenAt>=12096e5&&n>=10}function HB(e){return e===!0}function UB(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:null}function WB(e){if(typeof e!=`object`||!e)return zB;let t=e;return{firstSeenAt:UB(t.firstSeenAt),shownAt:UB(t.shownAt),dismissed:HB(t.dismissed)}}function GB(e){try{let t=(e??localStorage).getItem(RB);return t==null?zB:WB(JSON.parse(t))}catch(e){return console.warn(`[feedback-nudge-store] readPersistedState failed (corrupt/privacy/SSR)`,e),zB}}function KB(e,t){try{(t??localStorage).setItem(RB,JSON.stringify(e))}catch(e){console.warn(`[feedback-nudge-store] writePersistedState failed (quota/privacy/SSR)`,e)}}function qB(e){let t=GB(e),n=new Set,r=!1;function i(){for(let e of n)e()}function a(n){t=n,KB(t,e),i()}function o(){t=GB(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 JB=qB();typeof window<`u`&&typeof window.addEventListener==`function`&&window.addEventListener(`storage`,e=>{(e.key===`ok-feedback-nudge-v1`||e.key===null)&&JB.syncFromStorage()});function YB(){JB.install()}var XB=`https://github.com/inkeep/open-knowledge`,ZB=`https://discord.gg/VRKk2EaGHN`,QB=`https://x.com/OpenKnowledge`,$B=`ok-subscribe-card-v1`,eV={subscribed:!1,dismissed:!1,shownVersions:[]};function tV(e,t){return!e.subscribed&&!e.dismissed&&e.shownVersions.length<3&&!e.shownVersions.includes(t)}function nV(e){return e===!0}function rV(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function iV(e){if(typeof e!=`object`||!e)return eV;let t=e;return{subscribed:nV(t.subscribed),dismissed:nV(t.dismissed),shownVersions:rV(t.shownVersions)}}function aV(e){try{let t=(e??localStorage).getItem($B);return t==null?eV:iV(JSON.parse(t))}catch(e){return console.warn(`[subscribe-card-store] readPersistedState failed (corrupt/privacy/SSR)`,e),eV}}function oV(e,t){try{(t??localStorage).setItem($B,JSON.stringify(e))}catch(e){console.warn(`[subscribe-card-store] writePersistedState failed (quota/privacy/SSR)`,e)}}function sV(e){let t=aV(e),n=new Set,r=!1;function i(){for(let e of n)e()}function a(n){t=n,oV(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=aV(e),i())}}}var cV=sV();function lV(){cV.install()}function uV(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 dV(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 fV=[{key:`resources`,heading:{id:`s-MGs7`},links:[{label:{id:`TbjyhA`},href:`https://openknowledge.ai/docs`,icon:xe}]},{key:`community`,heading:{id:`chL5IG`},links:[{label:`Discord`,href:ZB,icon:uV},{label:`X (Twitter)`,href:QB,icon:dV},{label:`GitHub`,href:XB,icon:Qy}]}],pV=`${XB}/releases`,mV=`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 hV(e){if(e<1e3)return String(e);let t=e/1e3;return`${t>=10?Math.round(t):t.toFixed(1)}k`}var gV=e=>{let t=(0,$.c)(12),{count:n}=e,{_:r}=on(),i,a,o,s;t[0]!==r||t[1]!==n?(i=hV(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)(uy,{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},_V=e=>{let t=(0,$.c)(15),{link:n,trailing:r}=e,{_:i}=on(),{label:a,href:o,icon:s}=n,c,l;t[0]===o?(c=t[1],l=t[2]):(c=e=>um(e,o),l=e=>um(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:mV,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},vV=e=>{let t=(0,$.c)(7),{icon:n,onSelect:r,children:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=Bn(mV,`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},yV=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},bV=()=>{let e=(0,$.c)(37),{_:t}=on(),[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=Mt(),[d,f]=(0,Q.useState)(null),p=typeof window<`u`&&window.okDesktop!=null,m,h;e[0]!==n||e[1]!==d?(m=()=>{if(!n||d!==null)return;let e=new AbortController;return $o({signal:e.signal}).then(e=>{e!==null&&f(e)}),()=>e.abort()},h=[n,d],e[0]=n,e[1]=d,e[2]=m,e[3]=h):(m=e[2],h=e[3]),(0,Q.useEffect)(m,h);let g;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>{r(e),e||a(!1)},e[4]=g):g=e[4];let _;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(Et,{className:`size-4`}),e[5]=_):_=e[5];let v;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(In,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[_,(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)(cr,{children:(0,Z.jsx)(Y,{id:`s-MGs7`})})]}),e[7]=y):y=e[7];let b;e[8]!==t||e[9]!==u||e[10]!==d?(b=fV.map((e,n)=>(0,Z.jsxs)(`div`,{className:Bn(n>0&&`mt-3`),children:[(0,Z.jsx)(yV,{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)(_V,{link:e,trailing:e.href===`https://github.com/inkeep/open-knowledge`&&d!==null?(0,Z.jsx)(gV,{count:d}):void 0},e.href)),e.key===`resources`&&(0,Z.jsxs)(Z.Fragment,{children:[p&&(0,Z.jsx)(vV,{icon:O,onSelect:()=>{r(!1),s(!0)},children:(0,Z.jsx)(Y,{id:`cd5EXh`})}),(0,Z.jsx)(vV,{icon:Ud,onSelect:()=>{r(!1),l(!0)},children:(0,Z.jsx)(Y,{id:`RoafuO`})}),u?(0,Z.jsx)(vV,{icon:Fv,onSelect:()=>{r(!1),u()},children:(0,Z.jsx)(Y,{id:`hgf5io`})}):null]})]})})]},e.key)),e[8]=t,e[9]=u,e[10]=d,e[11]=b):b=e[11];let x;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(yV,{children:(0,Z.jsx)(Y,{id:`arUUsK`})}),e[12]=x):x=e[12];let S;e[13]===t?S=e[14]:(S=t({id:`arUUsK`}),e[13]=t,e[14]=S);let C;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(_V,{link:{label:{id:`3ePd3I`},href:pV,icon:Jv}}),e[15]=C):C=e[15];let w;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(In,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,className:Bn(mV,`h-auto w-full justify-start font-normal`),children:[(0,Z.jsx)(qv,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Z.jsx)(Y,{id:`EDl9kS`})]})}),e[16]=w):w=e[16];let T;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(jn,{side:`left`,align:`center`,sideOffset:20,className:`w-80`,children:(0,Z.jsx)(LB,{source:`resources_menu`,autoFocus:!0,onDismiss:()=>a(!1),onSuccess:xV})}),e[17]=T):T=e[17];let E;e[18]===i?E=e[19]:(E=(0,Z.jsxs)(`ul`,{className:`space-y-0.5`,children:[C,(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(Ln,{open:i,onOpenChange:a,children:[w,T]})})]}),e[18]=i,e[19]=E);let D;e[20]!==E||e[21]!==S?(D=(0,Z.jsxs)(`div`,{className:`mt-3`,children:[x,(0,Z.jsx)(`nav`,{"aria-label":S,children:E})]}),e[20]=E,e[21]=S,e[22]=D):D=e[22];let k;e[23]!==D||e[24]!==b?(k=(0,Z.jsxs)(jn,{align:`end`,className:`w-56 p-3`,children:[b,D]}),e[23]=D,e[24]=b,e[25]=k):k=e[25];let A;e[26]!==n||e[27]!==k?(A=(0,Z.jsxs)(Ln,{open:n,onOpenChange:g,children:[y,k]}),e[26]=n,e[27]=k,e[28]=A):A=e[28];let j;e[29]===o?j=e[30]:(j=p&&(0,Z.jsx)($_,{open:o,onOpenChange:s}),e[29]=o,e[30]=j);let M;e[31]===c?M=e[32]:(M=(0,Z.jsx)(Gb,{open:c,onOpenChange:l,onSuccess:SV}),e[31]=c,e[32]=M);let N;return e[33]!==A||e[34]!==j||e[35]!==M?(N=(0,Z.jsxs)(Z.Fragment,{children:[A,j,M]}),e[33]=A,e[34]=j,e[35]=M,e[36]=N):N=e[36],N};function xV(){return cV.markSubscribed()}function SV(){return JB.dismiss()}function CV(e){let t=(0,$.c)(14),{className:n}=e,{_:r}=on(),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)($c,{"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)(sr,{asChild:!0,children:(0,Z.jsxs)(Mp,{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)(cr,{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 wV=1,TV=2,EV=wV|TV;function DV(){if(!(typeof window>`u`))return window.navigation}function OV(){let e=DV();return e?(e.canGoBack?wV:0)|(e.canGoForward?TV:0):EV}function kV(e){let t=DV();return t?(t.addEventListener(`currententrychange`,e),()=>t.removeEventListener(`currententrychange`,e)):()=>{}}function AV(){let e=(0,$.c)(42),{_:t}=on(),n=(0,Q.useSyncExternalStore)(kV,OV,NV),r=(n&wV)!==0,i=(n&TV)!==0,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=xs(`navigate-back`),e[0]=a):a=e[0];let o=a,s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=Ss(`navigate-back`),e[1]=s):s=e[1];let c=s,l;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=xs(`navigate-forward`),e[2]=l):l=e[2];let u=l,d;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=Ss(`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)(ol,{"aria-hidden":`true`}),e[8]=g):g=e[8];let _;e[9]!==m||e[10]!==h?(_=(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(X,{"aria-label":m,className:`[-webkit-app-region:no-drag]`,disabled:h,onClick:MV,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)(ne,{"aria-label":c,children:o}),e[16]=b):b=e[16];let x;e[17]===y?x=e[18]:(x=(0,Z.jsxs)(cr,{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)(ll,{"aria-hidden":`true`}),e[24]=T):T=e[24];let E;e[25]!==C||e[26]!==w?(E=(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(X,{"aria-label":C,className:`[-webkit-app-region:no-drag]`,disabled:w,onClick:jV,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)(ne,{"aria-label":f,children:u}),e[32]=k):k=e[32];let A;e[33]===O?A=e[34]:(A=(0,Z.jsxs)(cr,{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)(uf,{"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 jV(){return zn(`navigate-forward`)}function MV(){return zn(`navigate-back`)}function NV(){return EV}var PV=50,FV=()=>{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,XO.preload()},PV))},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=ks)},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)(Pc,{className:`size-4`}),e[5]=u):u=e[5];let d;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(sr,{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)(cr,{children:(0,Z.jsx)(Y,{id:`Tz0i8g`})})]}),e[7]=f):f=e[7],f},IV=`https://openknowledge.ai/docs/features/share`,LV={mac:`⌘ C`,windowsLinux:`Ctrl C`};function RV(e){let t=(0,$.c)(52),{input:n,onClickWhenNoRemote:r}=e,{_:i}=on(),{status:a}=nl(),[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=pd(c?.freshness,a),g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=Es(LV),t[4]=g):g=t[4];let _=g,v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v=ws(LV),t[5]=v):v=t[5];let y=v,b;t[6]!==i||t[7]!==o||t[8]!==p||t[9]!==n||t[10]!==r?(b=async function(){if(!o&&n!==null){s(!0),l(null);try{let e=await Xu({...n,hasRemote:p,onClickWhenNoRemote:r},{clipboardWrite:nh,toastSuccess:KV,toastError:GV,logEvent:WV});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{Ns.error(i({id:`u3YnKw`}))}s(!1)}},t[6]=i,t[7]=o,t[8]=p,t[9]=n,t[10]=r,t[11]=b):b=t[11];let x=b,S=c!==null,C;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{e||l(null)},t[12]=C):C=t[12];let w;t[13]!==i||t[14]!==n?.kind?(w=n?.kind===`folder`?i({id:`WR0y2O`}):i({id:`F4IYWe`}),t[13]=i,t[14]=n?.kind,t[15]=w):w=t[15];let T=o||m,E,D;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(ef,{className:`size-3.5`,"aria-hidden":!0}),D=(0,Z.jsx)(Y,{id:`Z8lGw6`}),t[16]=E,t[17]=D):(E=t[16],D=t[17]);let O;t[18]!==x||t[19]!==w||t[20]!==T?(O=(0,Z.jsx)(Nn,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,"aria-label":w,onClick:x,disabled:T,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[E,D]})}),t[18]=x,t[19]=w,t[20]=T,t[21]=O):O=t[21];let k=h?`w-96`:`w-80`,A;t[22]===k?A=t[23]:(A=Bn(`flex flex-col gap-2`,k),t[22]=k,t[23]=A);let j;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`Z8lGw6`})}),t[24]=j):j=t[24];let M;t[25]===c?.autoCopyFailed?M=t[26]:(M=c?.autoCopyFailed?(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`vj-33a`,values:{copyShortcut:_},components:{0:(0,Z.jsx)(ne,{"aria-label":y})}})}):null,t[25]=c?.autoCopyFailed,t[26]=M);let N=c?.url??``,P;t[27]===i?P=t[28]:(P=i({id:`5-FeN2`}),t[27]=i,t[28]=P);let F;t[29]!==N||t[30]!==P?(F=(0,Z.jsx)(zf,{ref:u,readOnly:!0,value:N,onFocus:UV,onClick:HV,onContextMenu:VV,className:`select-all bg-muted font-mono text-xs text-muted-foreground`,"data-testid":`share-button-url`,"aria-label":P}),t[29]=N,t[30]=P,t[31]=F):F=t[31];let I=c?.url??``,L=c?.autoCopyFailed===!1,R;t[32]!==I||t[33]!==L?(R=(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)(wu,{copyContent:I,clipboardWrite:nh,initialCopied:L})})}),t[32]=I,t[33]=L,t[34]=R):R=t[34];let z;t[35]!==F||t[36]!==R?(z=(0,Z.jsxs)(`div`,{className:`relative`,children:[F,R]}),t[35]=F,t[36]=R,t[37]=z):z=t[37];let B=c?.freshness,V=n?.kind??`doc`,H;t[38]!==a||t[39]!==B||t[40]!==V?(H=(0,Z.jsx)(dd,{freshness:B,status:a,kind:V}),t[38]=a,t[39]=B,t[40]=V,t[41]=H):H=t[41];let U;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsxs)(`a`,{href:IV,target:`_blank`,rel:`noopener noreferrer`,onClick:BV,onAuxClick:zV,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)(Et,{"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]!==A||t[44]!==M||t[45]!==z||t[46]!==H?(W=(0,Z.jsxs)(jn,{align:`end`,className:A,"data-testid":`share-button-popover`,children:[j,M,z,H,U]}),t[43]=A,t[44]=M,t[45]=z,t[46]=H,t[47]=W):W=t[47];let ee;return t[48]!==O||t[49]!==W||t[50]!==S?(ee=(0,Z.jsxs)(Ln,{open:S,onOpenChange:C,children:[O,W]}),t[48]=O,t[49]=W,t[50]=S,t[51]=ee):ee=t[51],ee}function zV(e){return um(e,IV)}function BV(e){return um(e,IV)}function VV(e){return e.currentTarget.select()}function HV(e){return e.currentTarget.select()}function UV(e){return e.currentTarget.select()}function WV(e){return console.log(e)}function GV(e,t){t!==`clipboard`&&Ns.error(e)}function KV(e){return Ns.success(e)}var qV=(0,Q.lazy)(()=>n(()=>import(`./AppMenubar-CYaE7Hn6.js`).then(e=>({default:e.AppMenubar})),__vite__mapDeps([198,1,12,13,14,16,17,18,54,138,35,36,20,28,29,55,21,22,105,24,44,45,25,26]),import.meta.url));function JV(e){let t=(0,$.c)(59),{children:n,onSignIn:r,onSetIdentity:i,onOpenSearch:a}=e,{_:o}=on(),{activeDocName:s,activeTarget:c}=Oe(),l=s?Ao(s):null,{state:u}=xI(),d=eS(),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=xs(`toggle-files-sidebar`),t[0]=f):f=t[0];let p=f,m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(m=Ss(`toggle-files-sidebar`),t[1]=m):m=t[1];let h=m,g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=xs(`command-palette`),t[2]=g):g=t[2];let _=g,v=Ss(`command-palette`),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(!1),C=(0,Q.useRef)(null),w=(0,Q.useRef)(null),T=(0,Q.useRef)(null),E=(0,Q.useRef)(null),D;bb0:{if(c?.kind===`folder`){let e;t[3]===c.folderPath?e=t[4]:(e=$u(c.folderPath),t[3]=c.folderPath,t[4]=e),D=e;break bb0}if(s&&!l){let e;t[5]===s?e=t[6]:(e=td(s),t[5]=s,t[6]=e),D=e;break bb0}if(!c&&!s){let e;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=$u(``),t[7]=e):e=t[7],D=e;break bb0}D=null}let O=D,k=typeof window<`u`&&window.okDesktop!=null,A=u===`collapsed`,j;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(j=Hz()?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(qV,{})}):null,t[8]=j):j=t[8];let M=j,N,P;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(N=()=>{let e=C.current,t=w.current,n=T.current,r=E.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(),S(!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()}},P=[],t[9]=N,t[10]=P):(N=t[9],P=t[10]),(0,Q.useLayoutEffect)(N,P);let F;t[11]!==b||t[12]!==O||t[13]!==d?(F=!d&&(0,Z.jsx)(RV,{input:O,onClickWhenNoRemote:()=>b(!0)}),t[11]=b,t[12]=O,t[13]=d,t[14]=F):F=t[14];let I;t[15]!==i||t[16]!==r?(I=(0,Z.jsx)(qu,{onSignIn:r,onSetIdentity:i}),t[15]=i,t[16]=r,t[17]=I):I=t[17];let L,R,z,B;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(xB,{}),R=(0,Z.jsx)(Ni,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),z=(0,Z.jsx)(CV,{}),B=(0,Z.jsx)(wB,{}),t[18]=L,t[19]=R,t[20]=z,t[21]=B):(L=t[18],R=t[19],z=t[20],B=t[21]);let V;t[22]===d?V=t[23]:(V=!d&&(0,Z.jsx)(FV,{}),t[22]=d,t[23]=V);let H;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(bV,{}),t[24]=H):H=t[24];let U;t[25]!==V||t[26]!==F||t[27]!==I?(U=(0,Z.jsxs)(Z.Fragment,{children:[F,I,L,R,z,B,V,H]}),t[25]=V,t[26]=F,t[27]=I,t[28]=U):U=t[28];let W=U,ee=k?``:void 0,G=k&&A?`var(--ok-titlebar-reserve-left, 1rem)`:`0px`,K;t[29]===G?K=t[30]:(K={"--editor-header-leading-offset":G},t[29]=G,t[30]=K);let q;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(q=Bn(`group/editor-header relative flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,k&&`[-webkit-app-region:drag]`),t[31]=q):q=t[31];let te=!x&&`invisible`,J;t[32]===te?J=t[33]:(J=Bn(`absolute inset-y-0 left-0 z-10 flex min-w-0 w-[var(--editor-header-tabs-width,100%)] overflow-hidden`,te,k&&`[-webkit-app-region:drag]`),t[32]=te,t[33]=J);let re;t[34]!==n||t[35]!==J?(re=(0,Z.jsx)(`div`,{ref:T,"data-electron-drag":k?``:void 0,"data-editor-header-tabs":``,className:J,children:n}),t[34]=n,t[35]=J,t[36]=re):re=t[36];let ie=k?``:void 0,ae=k&&A&&`left-[var(--ok-titlebar-reserve-left,1rem)]`,oe;t[37]===ae?oe=t[38]:(oe=Bn(`absolute inset-y-0 left-0 z-20 flex items-center gap-1 px-3`,k&&`[-webkit-app-region:drag]`,ae),t[37]=ae,t[38]=oe);let se=d&&M,ce=!d&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(uf,{"aria-label":o({id:`V6AIOn`}),className:`-ml-1 shrink-0 has-[>[data-slot=button-group]]:gap-0`,children:[(0,Z.jsxs)(ur,{children:[(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(EI,{className:Bn(`shrink-0 text-muted-foreground`,k&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsxs)(cr,{children:[(0,Z.jsx)(`span`,{children:o(u===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`})}),` `,(0,Z.jsx)(ne,{"aria-label":h,children:p})]})]}),A&&a&&(0,Z.jsxs)(ur,{children:[(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,onClick:a,"aria-label":o({id:`DbCfXV`,values:{searchShortcutLabel:v}}),"data-telemetry-event":`ok.editor_header.search.click`,className:Bn(`shrink-0 text-muted-foreground`,k&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(ct,{"aria-hidden":`true`})})}),(0,Z.jsxs)(cr,{children:[(0,Z.jsx)(`span`,{children:o({id:`A1taO8`})}),` `,(0,Z.jsx)(ne,{"aria-label":v,children:_})]})]}),k&&A&&(0,Z.jsx)(AV,{})]}),M,(0,Z.jsx)(Ni,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`})]}),le;t[39]!==ie||t[40]!==oe||t[41]!==se||t[42]!==ce?(le=(0,Z.jsxs)(`div`,{ref:w,"data-electron-drag":ie,"data-editor-header-leading-actions":``,className:oe,children:[se,ce]}),t[39]=ie,t[40]=oe,t[41]=se,t[42]=ce,t[43]=le):le=t[43];let ue;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(ue=Bn(`absolute inset-y-0 right-0 z-20 flex items-center justify-end gap-2 px-3`,k&&`[-webkit-app-region:drag] [&_button]:[-webkit-app-region:no-drag] [&_a]:[-webkit-app-region:no-drag]`,k&&`mr-[var(--ok-titlebar-reserve-right,0px)]`),t[44]=ue):ue=t[44];let de;t[45]!==y||t[46]!==b||t[47]!==d?(de=!d&&(0,Z.jsx)(Ju,{open:y,onOpenChange:b}),t[45]=y,t[46]=b,t[47]=d,t[48]=de):de=t[48];let fe;t[49]!==W||t[50]!==de?(fe=(0,Z.jsxs)(`div`,{ref:E,"data-electron-drag":k?``:void 0,"data-editor-header-actions":``,className:ue,children:[W,de]}),t[49]=W,t[50]=de,t[51]=fe):fe=t[51];let pe;return t[52]!==ee||t[53]!==K||t[54]!==q||t[55]!==re||t[56]!==le||t[57]!==fe?(pe=(0,Z.jsxs)(`header`,{ref:C,"data-electron-drag":ee,style:K,className:q,children:[re,le,fe]}),t[52]=ee,t[53]=K,t[54]=q,t[55]=re,t[56]=le,t[57]=fe,t[58]=pe):pe=t[58],pe}function YV(e,t){return ga({relativePath:Xc(e),instruction:``,selectionMarkdown:t,target:`claude-code`})}var XV=(0,Q.lazy)(()=>n(()=>import(`./AgentThreadClientBinder-DoXKRY3h.js`).then(e=>({default:e.AgentThreadClientBinder})),__vite__mapDeps([199,1,24,14,200,45,92,18,111,6,2,3,7,8,9,10,11]),import.meta.url)),ZV=(0,Q.lazy)(()=>n(()=>import(`./SessionsHost-CGV_FZVZ.js`).then(e=>({default:e.SessionsHost})),__vite__mapDeps([201,1,2,134,18,14,6,3,7,8,9,10,11,45,12,13,180,16,17,138,35,36,20,54,28,29,55,21,22,105,24,25,26,137,99,125,30,34,56,142,116,40,202,37,203,136,74,117,43,42,31,92,132,47,48,159,91,93,94,95,96,160,200,204,161,77]),import.meta.url));function QV(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]=nC(),[o,s]=(0,Q.useState)(i),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(`auth`),f=(0,Q.useSyncExternalStore)(_m.subscribe,_m.getSnapshot,cH),p,m;t[2]===f?(p=t[3],m=t[4]):(p=()=>{f&&(_m.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)(Aw[0].id),[_,v]=(0,Q.useState)(!1),y=typeof window<`u`?window.okDesktop??null:null,b=y!=null&&y.terminal!=null&&y.config.ptyAvailable===!0,[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(0),[T,E]=(0,Q.useState)(sH),[D,O]=(0,Q.useState)(oH),k,A;t[5]===T?(k=t[6],A=t[7]):(k=()=>{cC(T)},A=[T],t[5]=T,t[6]=k,t[7]=A),(0,Q.useEffect)(k,A);let j,M;t[8]===D?(j=t[9],M=t[10]):(j=()=>{dC(D)},M=[D],t[8]=D,t[9]=j,t[10]=M),(0,Q.useEffect)(j,M);let[N,P]=(0,Q.useState)(!1),F=Tm(),[I,L]=(0,Q.useState)(!1),R=(0,Q.useRef)(!1),[z,B]=(0,Q.useState)(null),[V,H]=(0,Q.useState)(null),[U,W]=(0,Q.useState)(null),ee=(0,Q.useRef)(0),G;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(G={terminal:{container:null,isShowing:!1},agents:{container:null,isShowing:!1},editorRegion:null},t[11]=G):G=t[11];let[K,q]=(0,Q.useState)(G),te=(0,Q.useRef)(0),J;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(J=function(){pc()},t[12]=J):J=t[12];let ne=J,re;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(re=function(){P(!0)},t[13]=re):re=t[13];let ie=re,ae=tl(),{projectConfig:oe,projectLocalConfig:se,projectLocalSynced:ce,projectSynced:le}=xc(),{activeDocName:ue,activeProvider:de}=Oe(),fe=ae?.hasRemote,pe=ae?.pushPermission?.checkStatus,me;t[14]!==_||t[15]!==oe||t[16]!==se||t[17]!==ce||t[18]!==le||t[19]!==fe||t[20]!==pe?(me=mC({autoSyncOnboardingDismissed:_,hasRemote:fe,projectLocalSynced:ce,projectSynced:le,projectLocalConfig:se,projectConfig:oe,pushPermissionCheckStatus:pe}),t[14]=_,t[15]=oe,t[16]=se,t[17]=ce,t[18]=le,t[19]=fe,t[20]=pe,t[21]=me):me=t[21];let he=me,ge,_e;t[22]===ue?(ge=t[23],_e=t[24]):(ge=()=>{let e=function(e){let t=e.detail;t&&ue&&ql(ue,{kind:`raw-mdx`,detail:t}),s(`source`)};return window.addEventListener(JS,e),()=>window.removeEventListener(JS,e)},_e=[ue],t[22]=ue,t[23]=ge,t[24]=_e),(0,Q.useEffect)(ge,_e);let ve;t[25]!==ue||t[26]!==o?(ve=function(e,t){if(ue==null)return!1;let n=wm(ue,o)?.markdown??``;return n.trim()===``?!1:(Ws(`${YV(ue,n)}\n\n`,{newTab:e,submit:!1,target:t}),!0)},t[25]=ue,t[26]=o,t[27]=ve):ve=t[27];let ye=ve,be=(0,Q.useEffectEvent)(ye),xe;t[28]===ye?xe=t[29]:(xe=()=>ye(!1,`agents`),t[28]=ye,t[29]=xe);let Se=(0,Q.useEffectEvent)(xe),Ce;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=()=>ne(),t[30]=Ce):Ce=t[30];let we=(0,Q.useEffectEvent)(Ce),Te;t[31]===Se?Te=t[32]:(Te=()=>Fn(e=>{if(e===`toggle-terminal`)S(aH);else if(e===`move-terminal`)E(iH);else if(e===`new-terminal`)S(!0);else if(e===`toggle-agent-panel`){if(Se())return;P(rH)}}),t[31]=Se,t[32]=Te);let De;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(De=[],t[33]=De):De=t[33],(0,Q.useEffect)(Te,De);let ke,Ae;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(ke=()=>{let e=window.okDesktop!=null,t=function(t){js(t,`toggle-terminal-panel`,e)&&(rr()||b&&(t.preventDefault(),S(nH)))};return window.addEventListener(`keydown`,t,{capture:!0}),()=>window.removeEventListener(`keydown`,t,{capture:!0})},Ae=[b],t[34]=ke,t[35]=Ae):(ke=t[34],Ae=t[35]),(0,Q.useEffect)(ke,Ae);let je;t[36]===Se?je=t[37]:(je=()=>{if(window.okDesktop!=null)return;let e=function(e){As(e,`toggle-agent-panel`)&&(rr()||(e.preventDefault(),!Se()&&P(tH)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},t[36]=Se,t[37]=je);let Me;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(Me=[],t[38]=Me):Me=t[38],(0,Q.useEffect)(je,Me);let Ne;t[39]!==we||t[40]!==be?(Ne=()=>{let e=function(e){As(e,`new-terminal-tab`)&&(rr()||(e.preventDefault(),be(!0)||we()))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},t[39]=we,t[40]=be,t[41]=Ne):Ne=t[41];let Pe;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=[],t[42]=Pe):Pe=t[42],(0,Q.useEffect)(Ne,Pe);let Fe,Ie;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=()=>vg(e=>{S(!0),te.current+=1,H({id:e,nonce:te.current})}),Ie=[],t[43]=Fe,t[44]=Ie):(Fe=t[43],Ie=t[44]),(0,Q.useEffect)(Fe,Ie);let Re,ze;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(Re=()=>uc((e,t,n)=>{let{stage:r}=n;S(!0),te.current+=1,B({prompt:r?null:e,cli:t,nonce:te.current,stagePaste:r?e:void 0})}),ze=[],t[45]=Re,t[46]=ze):(Re=t[45],ze=t[46]),(0,Q.useEffect)(Re,ze);let Be,Ve;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Be=()=>wc(e=>{P(!0),ee.current+=1,W({agentSource:e.agentSource,agentId:e.agentId,prompt:e.prompt,docName:e.docName,titleHint:e.titleHint,nonce:ee.current})}),Ve=[],t[47]=Be,t[48]=Ve):(Be=t[47],Ve=t[48]),(0,Q.useEffect)(Be,Ve);let He,Ue;t[49]===x?(He=t[50],Ue=t[51]):(He=()=>{x||B(null)},Ue=[x],t[49]=x,t[50]=He,t[51]=Ue),(0,Q.useEffect)(He,Ue);let We,Ge;t[52]!==I||t[53]!==x?(We=()=>{window.okDesktop!=null&&I&&(Js({terminalVisible:x}),window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:x}))},Ge=[x,I],t[52]=I,t[53]=x,t[54]=We,t[55]=Ge):(We=t[54],Ge=t[55]),(0,Q.useEffect)(We,Ge);let Ke,qe;t[56]!==I||t[57]!==T?(Ke=()=>{window.okDesktop!=null&&I&&(Js({terminalPlacement:T}),window.okDesktop.editor.notifyViewMenuStateChanged({terminalPlacement:T}))},qe=[T,I],t[56]=I,t[57]=T,t[58]=Ke,t[59]=qe):(Ke=t[58],qe=t[59]),(0,Q.useEffect)(Ke,qe);let Je,Ye;t[60]!==N||t[61]!==I?(Je=()=>{window.okDesktop!=null&&I&&(Js({agentPanelVisible:N}),window.okDesktop.editor.notifyViewMenuStateChanged({agentPanelVisible:N}))},Ye=[N,I],t[60]=N,t[61]=I,t[62]=Je,t[63]=Ye):(Je=t[62],Ye=t[63]),(0,Q.useEffect)(Je,Ye);let Xe,Ze;t[64]!==ue||t[65]!==o?(Xe=()=>{let e=null,t=()=>{let t=((ue===null?null:wm(ue,o))?.markdown??``).trim()!==``;t!==e&&(e=t,Js({hasEditorSelection:t}),window.okDesktop?.editor.notifyViewMenuStateChanged({hasEditorSelection:t}))};return t(),bm(t)},Ze=[ue,o],t[64]=ue,t[65]=o,t[66]=Xe,t[67]=Ze):(Xe=t[66],Ze=t[67]),(0,Q.useEffect)(Xe,Ze);let Qe,$e;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=()=>{let e=window.okDesktop;if(e==null)return;if(typeof e.terminal?.getDockState!=`function`){L(!0);return}let t=!1;return e.terminal.getDockState().then(e=>{t||(e.agentPanelVisible&&P(!0),e.terminalVisible&&(R.current=!0,w(eH),S(!0)))}).catch($V).finally(()=>{t||L(!0)}),()=>{t=!0}},$e=[],t[68]=Qe,t[69]=$e):(Qe=t[68],$e=t[69]),(0,Q.useEffect)(Qe,$e);let et,tt;t[70]===x?(et=t[71],tt=t[72]):(et=()=>{if(window.okDesktop!=null){if(R.current){R.current=!1;return}x&&$i()}},tt=[x],t[70]=x,t[71]=et,t[72]=tt),(0,Q.useEffect)(et,tt),rC(ae?.pausedReason),aC();let nt;t[73]!==ue||t[74]!==de||t[75]!==o||t[76]!==a?(nt=function(e){ue&&de&&o!==e&&(tu({from:o,to:e,docName:ue,ytext:de.document.getText(`source`)}),Le(ue)),s(e),a(e)},t[73]=ue,t[74]=de,t[75]=o,t[76]=a,t[77]=nt):nt=t[77];let rt=nt,it;t[78]!==o||t[79]!==rt?(it=()=>{rt(o===`source`?`wysiwyg`:`source`)},t[78]=o,t[79]=rt,t[80]=it):it=t[80];let at=(0,Q.useEffectEvent)(it),ot=o===`wysiwyg`&&!!ue&&!!de,st;t[81]!==ue||t[82]!==de||t[83]!==ot?(st=()=>{if(!ot||!ue||!de)return;let e=Ee(ue);e&&Kl({editor:e,docName:ue,ytext:de.document.getText(`source`)})},t[81]=ue,t[82]=de,t[83]=ot,t[84]=st):st=t[84];let ct=(0,Q.useEffectEvent)(st),lt,ut;t[85]===ot?(lt=t[86],ut=t[87]):(lt=()=>{window.okDesktop?.editor.notifyViewMenuStateChanged({canViewInSource:ot})},ut=[ot],t[85]=ot,t[86]=lt,t[87]=ut),(0,Q.useEffect)(lt,ut);let dt;t[88]!==ct||t[89]!==at?(dt=()=>{let e=function(e){if(As(e,`toggle-editor-mode`)){if(rr())return;e.preventDefault(),at();return}if(As(e,`view-source-at-cursor`)){if(rr())return;e.preventDefault(),ct()}};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},t[88]=ct,t[89]=at,t[90]=dt):dt=t[90];let ft;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(ft=[],t[91]=ft):ft=t[91],(0,Q.useEffect)(dt,ft);let pt;t[92]===ct?pt=t[93]:(pt=()=>Fn(e=>{e===`toggle-source`&&ct()}),t[92]=ct,t[93]=pt);let mt;t[94]===Symbol.for(`react.memo_cache_sentinel`)?(mt=[],t[94]=mt):mt=t[94],(0,Q.useEffect)(pt,mt);let ht,gt;t[95]===ue?(ht=t[96],gt=t[97]):(ht=()=>{let e=function(e){e.detail?.docName===ue&&s(`source`)};return window.addEventListener(fu,e),()=>window.removeEventListener(fu,e)},gt=[ue],t[95]=ue,t[96]=ht,t[97]=gt),(0,Q.useEffect)(ht,gt);let _t;t[98]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(XV,{})}),t[98]=_t):_t=t[98];let vt;t[99]===r?vt=t[100]:(vt=e=>(0,Z.jsx)(JV,{onSignIn:()=>{d(`auth`),l(!0)},onSetIdentity:()=>{d(`identity`),l(!0)},onOpenSearch:r,children:e}),t[99]=r,t[100]=vt);let yt;t[101]!==h||t[102]!==N||t[103]!==o||t[104]!==rt||t[105]!==vt||t[106]!==T||t[107]!==D||t[108]!==x?(yt=(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)(Fz,{editorMode:o,onModeChange:rt,activeTab:h,onActiveTabChange:g,terminalBridge:b?y:null,terminalVisible:x,terminalPlacement:T,terminalRightWidth:D,onTerminalVisibleChange:S,onTerminalRightWidthChange:O,agentsVisible:N,onAgentsVisibleChange:P,onSessionPlacements:q,onRevealAgents:ie,renderWorkspaceHeader:vt})})}),t[101]=h,t[102]=N,t[103]=o,t[104]=rt,t[105]=vt,t[106]=T,t[107]=D,t[108]=x,t[109]=yt):yt=t[109];let bt;t[110]===K.editorRegion?bt=t[111]:(bt=()=>K.editorRegion?.focus(),t[110]=K.editorRegion,t[111]=bt);let xt;t[112]!==N||t[113]!==F||t[114]!==K.agents.container||t[115]!==K.agents.isShowing||t[116]!==bt||t[117]!==U?(xt=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(ZV,{surface:`agents-panel`,bridge:y,terminalCapable:b,visible:N,onVisibleChange:P,threadLaunch:U,installedClis:F,container:K.agents.container,isShowing:K.agents.isShowing,onRequestEditorFocus:bt})}),t[112]=N,t[113]=F,t[114]=K.agents.container,t[115]=K.agents.isShowing,t[116]=bt,t[117]=U,t[118]=xt):xt=t[118];let St;t[119]!==N||t[120]!==F||t[121]!==K.editorRegion||t[122]!==K.terminal||t[123]!==V||t[124]!==z||t[125]!==T||t[126]!==C||t[127]!==x?(St=b?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(ZV,{surface:`terminal-dock`,terminalPlacement:T,onTerminalPlacementChange:E,reserveRightRevealTabGutter:T===`right`&&!N,bridge:y,terminalCapable:!0,visible:x,terminalRestoreRevealNonce:C,onVisibleChange:S,launch:z,commandLaunch:V,installedClis:F,container:K.terminal.container,isShowing:K.terminal.isShowing,onRequestEditorFocus:()=>K.editorRegion?.focus()})}):null,t[119]=N,t[120]=F,t[121]=K.editorRegion,t[122]=K.terminal,t[123]=V,t[124]=z,t[125]=T,t[126]=C,t[127]=x,t[128]=St):St=t[128];let Ct=u===`identity`,wt;t[129]===Symbol.for(`react.memo_cache_sentinel`)?(wt=()=>{l(!1)},t[129]=wt):wt=t[129];let Tt;t[130]!==c||t[131]!==Ct?(Tt=(0,Z.jsx)(Vu,{open:c,onOpenChange:l,identityPrompt:Ct,onSuccess:wt}),t[130]=c,t[131]=Ct,t[132]=Tt):Tt=t[132];let Et=he!==null,Dt=he??`full`,Ot;t[133]===Symbol.for(`react.memo_cache_sentinel`)?(Ot=()=>v(!0),t[133]=Ot):Ot=t[133];let kt;t[134]!==Et||t[135]!==Dt?(kt=(0,Z.jsx)(fC,{open:Et,variant:Dt,onResolved:Ot}),t[134]=Et,t[135]=Dt,t[136]=kt):kt=t[136];let At,jt;t[137]===Symbol.for(`react.memo_cache_sentinel`)?(At=(0,Z.jsx)(GS,{}),jt=(0,Z.jsx)(US,{}),t[137]=At,t[138]=jt):(At=t[137],jt=t[138]);let Mt;return t[139]!==yt||t[140]!==xt||t[141]!==St||t[142]!==Tt||t[143]!==kt?(Mt=(0,Z.jsxs)(Z.Fragment,{children:[_t,yt,xt,St,Tt,kt,At,jt]}),t[139]=yt,t[140]=xt,t[141]=St,t[142]=Tt,t[143]=kt,t[144]=Mt):Mt=t[144],Mt}function $V(e){console.error(`[terminal] dock-state restore failed; staying hidden:`,e)}function eH(e){return e+1}function tH(e){return!e}function nH(e){return!e}function rH(e){return!e}function iH(e){return e===`bottom`?`right`:`bottom`}function aH(e){return!e}function oH(){return uC()}function sH(){return sC()}function cH(){return!1}function lH(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(!1),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>Fn(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)(Gb,{open:t,onOpenChange:n,source:`help_menu`}),e[2]=t,e[3]=a),a}function uH(e){let t=Cf(Af(e));typeof window>`u`||jf(window.location.hash,t)||(window.location.hash=t)}function dH(){let e=(0,$.c)(18),{conflicts:t,loading:n,error:r}=Uu(),{_:i}=on();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)(pf,{"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)(pf,{"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(fH),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 fH(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:()=>uH(e.file),children:[(0,Z.jsx)(pf,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}function pH(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,size:i,asChild:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`default`:i,s=a!==void 0&&a?or:`div`,c;t[5]===n?c=t[6]:(c=Bn(`group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl`,n),t[5]=n,t[6]=c);let l;return t[7]!==s||t[8]!==r||t[9]!==o||t[10]!==c?(l=(0,Z.jsx)(s,{"data-slot":`card`,"data-size":o,className:c,...r}),t[7]=s,t[8]=r,t[9]=o,t[10]=c,t[11]=l):l=t[11],l}function mH(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=Bn(`px-(--card-spacing)`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`card-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function hH(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=Bn(`flex items-center rounded-b-xl border-t bg-muted/50 p-(--card-spacing)`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`card-footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var gH=`proactive_card`;function _H(){let e=!1,t=!1;return{isEvaluated:()=>e,isShown:()=>t,latchEvaluated:()=>{e=!0},latchShown:()=>{t=!0}}}var vH=_H();function yH(e){let t=(0,$.c)(14),{pages:n,ready:r,blocked:i,store:a,now:o,session:s}=e,c=a===void 0?JB:a,l=o===void 0?Date.now:o,u=s===void 0?vH: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&&VB(c.getSnapshot(),l(),BB(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 bH=`Relaunch`,xH=`Release notes`,SH=`Updates paused`,CH=`Download`,wH=`Reset to defaults`,TH=`Relaunching to install the update…`,EH=`Relaunch failed — please restart manually`;function DH(e){return`Update to ${e} didn't install.`}var OH=`Retry`,kH=`Download manually`,AH=`Recovery action failed — please try again`;function jH(e,t){let n=t instanceof Error&&t.message?t.message:``;return n?`${e}: ${n}`:e}function MH(e){return`Version ${e} ready to install`}function NH(e){return`Updated to Version ${e}`}function PH(e){return`Your settings and recent projects were saved by a newer build than this one (v${e}). Reset to defaults to continue.`}var FH=0,IH=0,LH=1,RH=2,zH=3,BH=6e4;function VH(e,t,n=()=>{},r=BH,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:MH(r),priority:RH,action:{label:bH,onClick:()=>{t({id:i,body:TH,priority:RH,dismissible:!1}),e.update.relaunchNow().then(()=>{n(i)},e=>{a(),t({id:`relaunch-error-${r}`,body:jH(EH,e),variant:`error`,priority:LH})})}}})};a()})),a.push(e.onUpdateRelaunching(()=>{t({id:s,body:TH,priority:RH,dismissible:!1})})),a.push(e.onUpdateRelaunchFailed(({version:r,message:i,downloadUrl:a})=>{if(a){let i=`install-failed-${r}`,o=()=>{t({id:i,body:DH(r),variant:`error`,priority:LH,action:{label:OH,onClick:()=>{e.update.relaunchNow().then(()=>{n(i)},e=>{console.warn(`[update-notice] install-failed retry rejected`,e),o()})}},secondaryAction:{label:kH,onClick:()=>{e.shell.openExternal(a)}}})};o();return}t({id:`relaunch-error-${r}`,body:i?`${EH}: ${i}`:EH,variant:`error`,priority:LH})})),a.push(e.onWhatsNew(({version:a,releaseUrl:s})=>{if(i.isEligible(a)){i.onShown(a),t({id:`whats-new-combined-${a}`,body:NH(a),variant:`success`,priority:zH,combinedSubscribe:!0,whatsNew:{version:a,releaseUrl:s},action:{label:xH,onClick:()=>{e.shell.openExternal(s)}}}),e.update.dismissWhatsNew(a);return}let c=`whats-new-${a}`;t({id:c,body:NH(a),variant:`success`,priority:zH,action:{label:xH,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:SH,priority:IH,action:{label:CH,onClick:()=>{e.shell.openExternal(n)}}})})),()=>{for(let e of a)e();for(let e of o)clearTimeout(e);o.clear()}}function HH(e,t,n,r=()=>{}){let i=`schema-incompatibility-${t.persistedSchemaVersion}`,a=`schema-incompatibility-error-${t.persistedSchemaVersion}`,o=e=>{r(i),n({id:a,body:jH(AH,e),variant:`error`,priority:FH})};n({id:i,body:PH(t.currentBuild),priority:FH,action:{label:wH,onClick:()=>{e.state.resetIncompatible().then(()=>{r(i)},o)}}})}var UH=[],WH=new Set,GH=!1;function KH(){for(let e of WH)e()}function qH(e){let t=UH.findIndex(t=>t.id===e.id);if(t===-1)UH=[...UH,e];else{let n=UH.slice();n[t]=e,UH=n}KH()}function JH(e){let t=UH.filter(t=>t.id!==e);t.length!==UH.length&&(UH=t,KH())}function YH(){return UH}function XH(e){return WH.add(e),()=>{WH.delete(e)}}function ZH(){if(GH||typeof window>`u`)return;let e=window.okDesktop;e&&(GH=!0,VH(e,qH,JH,void 0,{isEligible:e=>tV(cV.getSnapshot(),e),onShown:e=>cV.recordShown(e)}),e.state.query().then(t=>{t.schemaIncompatibility&&HH(e,t.schemaIncompatibility,qH,JH)},e=>{console.warn(`[update-notices-store] bridge.state.query() failed`,e)}))}var QH=new URL(`/api/feedback`,{BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.51.4`}?.VITE_OK_FEEDBACK_INTAKE_ORIGIN||`https://openknowledge.ai`).href;function $H(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 eU(e){return{contentType:e.type,base64:await $H(e)}}function tU(){return typeof window<`u`&&window.okDesktop?.platform||`web`}async function nU(e){try{let t=await fetch(QH,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({...e,appVersion:Xp,platform:tU()}),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 rU=ar(`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 iU(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=Bn(rU({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 aU=ar(`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 oU(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=Bn(aU({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 sU(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=Bn(`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 cU(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=Bn(`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 lU(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=Bn(`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 uU(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=Bn(`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 dU(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=Bn(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 fU(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=Bn(`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 pU=[{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`}}],mU=3,hU=3*1024*1024,gU=[`image/png`,`image/jpeg`,`image/webp`],_U=`data-[state=on]:border-primary data-[state=on]:bg-primary/5 data-[state=on]:text-primary`,vU=`rounded-full border border-input bg-transparent px-3 ${_U}`;function yU(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function bU(e,t){let n=new Set(e.map(e=>`${e.name}:${e.size}`)),r=Array.from(t??[]).filter(e=>gU.includes(e.type)&&!n.has(`${e.name}:${e.size}`));return[...e,...r].slice(0,mU)}var xU=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},SU=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}=on(),u=(0,Q.useRef)(null),d,f;if(t[0]!==l){let e=fs({rating:bo([`positive`,`negative`],{error:l({id:`H-hzll`})}),reasons:io(Wa()),message:Wa(),attachments:io(go(File)).max(mU,l({id:`E9gh86`,values:{MAX_ATTACHMENTS:mU}})).refine(wU,l({id:`s7us1p`})).refine(EU,l({id:`ItxGi3`})),shareEmail:ss(),email:Wa()}).refine(DU,{path:[`email`],message:l({id:`fwrPh4`})});f=lg,d=PB(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=fg(_),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=fg(b),S;t[11]===g.control?S=t[12]:(S={control:g.control,name:`attachments`},t[11]=g.control,t[12]=S);let C=fg(S),w=C.length>=mU,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(eU)):void 0,r=await nU({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){Ns.success(l({id:`LvdLef`})),g.reset(),n?.();return}if(r.reason===`unavailable`){Ns.error(l({id:`D8JJwQ`}));return}Ns.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)}`),Ns.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=Bn(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)(hf,{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)(og,{children:[(0,Z.jsx)(pg,{children:(0,Z.jsxs)(Ii,{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)(Pi,{value:`positive`,className:Bn(`h-auto flex-1 justify-center py-2`,i?`gap-1.5 text-xs`:`gap-2`,_U),children:[(0,Z.jsx)(xy,{className:`size-4`}),(0,Z.jsx)(Y,{id:`OEEQKT`})]}),(0,Z.jsxs)(Pi,{value:`negative`,className:Bn(`h-auto flex-1 justify-center py-2`,i?`gap-1.5 text-xs`:`gap-2`,_U),children:[(0,Z.jsx)(by,{className:`size-4`}),(0,Z.jsx)(Y,{id:`U0QBh4`})]})]})}),(0,Z.jsx)(hg,{})]})},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)(ug,{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)(ug,{control:g.control,name:`reasons`,render:e=>{let{field:t}=e;return(0,Z.jsxs)(og,{children:[(0,Z.jsx)(mg,{children:(0,Z.jsx)(Y,{id:`Fqx38P`})}),(0,Z.jsx)(pg,{children:(0,Z.jsx)(Ii,{type:`multiple`,variant:`outline`,spacing:2,value:t.value,onValueChange:t.onChange,className:`w-full flex-wrap justify-start`,children:pU.map(e=>(0,Z.jsx)(Pi,{value:e.value,className:vU,children:l(e.label)},e.value))})})]})}}),(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(ug,{control:g.control,name:`message`,render:e=>{let{field:t}=e;return(0,Z.jsx)(og,{children:(0,Z.jsx)(pg,{children:(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(Pm,{...t,placeholder:l({id:`QlAG4m`}),className:Bn(`resize-none pb-9`,i?`min-h-16`:`min-h-20`)}),(0,Z.jsxs)(ur,{children:[(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(`span`,{className:Bn(`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)(Zd,{className:`size-4`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`3LbBJn`})})]})})}),(0,Z.jsx)(cr,{children:w?(0,Z.jsx)(Y,{id:`ASqqsQ`,values:{MAX_ATTACHMENTS:mU}}):(0,Z.jsx)(Y,{id:`3LbBJn`})})]}),(0,Z.jsx)(zf,{ref:u,type:`file`,accept:gU.join(`,`),multiple:!0,className:`hidden`,onChange:e=>{D(bU(C,e.target.files)),e.target.value=``}})]})})})}}),C.length>0&&(0,Z.jsx)(fU,{children:C.map((e,t)=>(0,Z.jsxs)(iU,{size:`xs`,children:[(0,Z.jsx)(oU,{variant:`image`,children:(0,Z.jsx)(xU,{file:e})}),(0,Z.jsxs)(sU,{children:[(0,Z.jsx)(cU,{children:e.name}),(0,Z.jsx)(lU,{children:yU(e.size)})]}),(0,Z.jsx)(uU,{children:(0,Z.jsx)(dU,{type:`button`,"aria-label":l({id:`w61W3L`,values:{0:e.name}}),onClick:()=>D(C.filter((e,n)=>n!==t)),children:(0,Z.jsx)(hf,{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)(ug,{control:g.control,name:`shareEmail`,render:OU}),x&&(0,Z.jsx)(ug,{control:g.control,name:`email`,render:e=>{let{field:t}=e;return(0,Z.jsxs)(og,{children:[(0,Z.jsx)(pg,{children:(0,Z.jsx)(zf,{...t,type:`email`,placeholder:l({id:`JHf6qZ`})})}),(0,Z.jsx)(hg,{})]})}})]}),(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)(gg,{...g,children:L}),t[55]=g,t[56]=L,t[57]=R):R=t[57],R};function CU(e){return gU.includes(e.type)}function wU(e){return e.every(CU)}function TU(e,t){return e+t.size}function EU(e){return e.reduce(TU,0)<=hU}function DU(e){return!e.shareEmail||hs().safeParse(e.email).success}function OU(e){let{field:t}=e;return(0,Z.jsxs)(og,{className:`flex flex-row items-center gap-2 space-y-0`,children:[(0,Z.jsx)(pg,{children:(0,Z.jsx)(Hr,{checked:t.value,onCheckedChange:e=>t.onChange(e===!0)})}),(0,Z.jsx)(mg,{className:`font-normal`,children:(0,Z.jsx)(Y,{id:`SF9qpO`})})]})}function kU(e){let t=(0,$.c)(10),{onClose:n}=e,{_:r}=on(),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)(mH,{children:(0,Z.jsx)(SU,{compact:!0,source:gH,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)(pH,{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 AU(){let e=(0,$.c)(5),t=ku(),n=(0,Q.useSyncExternalStore)(_A.subscribe,_A.getSnapshot,_A.getSnapshot),r=(0,Q.useSyncExternalStore)(XH,YH,YH),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],!yH(s))return null;let c;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(kU,{onClose:jU}),e[4]=c):c=e[4],c}function jU(){return JB.dismiss()}function MU(e){let t=(0,$.c)(20),{active:n}=e,{_:r}=on(),{setSkillsSidebar:i}=Oe(),a;t[0]===i?a=t[1]:(a=e=>{e===`skills`?i(!0):e===`files`&&i(!1)},t[0]=i,t[1]=a);let o;t[2]===r?o=t[3]:(o=r({id:`6h4-4a`}),t[2]=r,t[3]=o);let s;t[4]===r?s=t[5]:(s=r({id:`sER-bs`}),t[4]=r,t[5]=s);let c=n===`files`,l;t[6]!==s||t[7]!==c?(l=(0,Z.jsx)(NU,{value:`files`,icon:C,label:s,selected:c,testId:`sidebar-files-toggle`}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]===r?u=t[10]:(u=r({id:`PCSkw2`}),t[9]=r,t[10]=u);let d=n===`skills`,f;t[11]!==u||t[12]!==d?(f=(0,Z.jsx)(NU,{value:`skills`,icon:Rv,label:u,selected:d,testId:`sidebar-skills-toggle`}),t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;return t[14]!==n||t[15]!==a||t[16]!==o||t[17]!==l||t[18]!==f?(p=(0,Z.jsxs)(Ii,{type:`single`,value:n,onValueChange:a,"aria-label":o,size:`sm`,spacing:1,children:[l,f]}),t[14]=n,t[15]=a,t[16]=o,t[17]=l,t[18]=f,t[19]=p):p=t[19],p}function NU(e){let t=(0,$.c)(20),{value:n,icon:r,label:i,selected:a,testId:o}=e,s=a?void 0:i,c=a&&`bg-foreground/5 text-foreground dark:bg-foreground/10`,l;t[0]===c?l=t[1]:(l=Bn(`gap-0`,c),t[0]=c,t[1]=l);let u;t[2]===r?u=t[3]:(u=(0,Z.jsx)(r,{className:`size-4`,"aria-hidden":!0}),t[2]=r,t[3]=u);let d;t[4]!==i||t[5]!==a?(d=(0,Z.jsx)(PU,{expanded:a,children:i}),t[4]=i,t[5]=a,t[6]=d):d=t[6];let f;t[7]!==s||t[8]!==l||t[9]!==u||t[10]!==d||t[11]!==o||t[12]!==n?(f=(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsxs)(Pi,{value:n,"aria-label":s,className:l,"data-testid":o,children:[u,d]})}),t[7]=s,t[8]=l,t[9]=u,t[10]=d,t[11]=o,t[12]=n,t[13]=f):f=t[13];let p;t[14]!==i||t[15]!==a?(p=a?null:(0,Z.jsx)(cr,{side:`bottom`,children:i}),t[14]=i,t[15]=a,t[16]=p):p=t[16];let m;return t[17]!==f||t[18]!==p?(m=(0,Z.jsxs)(ur,{children:[f,p]}),t[17]=f,t[18]=p,t[19]=m):m=t[19],m}function PU(e){let t=(0,$.c)(7),{children:n,expanded:r}=e,i=r&&`grid-cols-[1fr]`,a;t[0]===i?a=t[1]:(a=Bn(`grid grid-cols-[0fr] transition-[grid-template-columns] duration-150 ease-out motion-reduce:transition-none`,i),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(`span`,{className:`overflow-hidden`,children:(0,Z.jsx)(`span`,{className:`block whitespace-nowrap pl-1.5`,children:n})}),t[2]=n,t[3]=o);let s;return t[4]!==a||t[5]!==o?(s=(0,Z.jsx)(`span`,{className:a,children:o}),t[4]=a,t[5]=o,t[6]=s):s=t[6],s}var FU=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
8
+ `),l=[fP];e.textContent.length===0&&l.push(mP),s&&l.push(pP);let u={class:l.join(` `),[vP]:c},d=Ow(o);d.length>0&&(u[yP]=`1`,n.set(a,d)),r.push(Ho.node(a,a+e.nodeSize,u))}),{set:Mo.create(e,r),fixesByOffset:n}}function xP(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=Bn(`ok-lint-tooltip-fix`,ir({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={getBoundingClientRect:()=>({width:0,height:0,x:l,y:u,top:u,left:l,right:l,bottom:u})};function f(){s!==null&&(clearTimeout(s),s=null)}function p(){f(),a=null,n.hidden=!0,c?.(),c=null}function m(){o||(f(),s=setTimeout(p,140))}function h(){Gr(d,n,{placement:`top-start`,middleware:[Kr(6),Ur(),Qr({padding:8})]}).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 g(e){let s=e.getAttribute(vP);if(!s){m();return}f(),a=e,r.textContent=s;let l=t.applyFix?t.getFixes(e):[];l.length>0&&t.applyFix?(i.hidden=!1,i.textContent=Ms._({id:`c4fVUV`}),i.onclick=()=>{t.applyFix?.(l),o=!1,p()}):(i.hidden=!0,i.onclick=null),n.hidden=!1,c?.(),c=Yr(d,n,h)}function _(e){let t=e,n=e.target?.closest(`.${fP}`)??null;n?n===a?f():(l=t.clientX,u=t.clientY,g(n)):a&&m()}function v(e){let t=e.relatedTarget;if(t===n||t?.closest(`.ok-lint-tooltip`)){f();return}t?.closest(`.${fP}`)||m()}function y(){o=!0,f()}function b(e){o=!1;let t=e.relatedTarget;t!==a&&!t?.closest(`.${fP}`)&&m()}return n.addEventListener(`pointerenter`,y),n.addEventListener(`pointerleave`,b),e.dom.addEventListener(`pointerover`,_),e.dom.addEventListener(`pointerout`,v),{destroy(){f(),c?.(),e.dom.removeEventListener(`pointerover`,_),e.dom.removeEventListener(`pointerout`,v),n.remove()}}}var SP=ya.create({name:`markdownLintDecorations`,addOptions(){return{docName:``,getSource:void 0,applyFix:void 0}},addProseMirrorPlugins(){let{docName:e,getSource:t,applyFix:n}=this.options,r=new To({extensions:as});return[new is({key:dP,state:{init:()=>Mo.empty,apply(e,t){return e.getMeta(dP)||t.map(e.mapping,e.doc)}},props:{decorations(e){return dP.getState(e)??null}},view(i){let a=null,o=null,s=!1,c=0,l=new Map;async function u(){if(s)return;let n=t?.()??null,r=a?.enabled?await d(a):{kind:`ok`,set:Mo.empty,fixesByOffset:new Map};if(s||r.kind===`stale`)return;if(r.kind===`mismatch`){c<2&&(c+=1,f());return}c=0,l=r.fixesByOffset;let o=r.set,u=dP.getState(i.state)??Mo.empty;if((o.find().length>0||u.find().length>0)&&i.dispatch(i.state.tr.setMeta(dP,o)),a?.enabled){let t=Xl(e);t?.kind===`lint`&&g(t.detail)&&Wl(e)}n!==null&&!s&&t?.()!==n&&f()}async function d(n){let a=i.state.doc,o=t?.()??r.serialize(a.toJSON()),s=await oa(o,n,e);if(!i.state.doc.eq(a))return{kind:`stale`};let{spans:c}=Gl(o,r);return c.length===Su(a)?{kind:`ok`,...bP(a,_P(o,s,r))}:{kind:`mismatch`}}function f(){o&&clearTimeout(o),o=setTimeout(()=>{u().catch(e=>{console.warn(`[markdown-lint] decoration pass failed`,e)})},hP)}let p=0;async function m(){let t=++p,n=await Rm(e);s||t!==p||(a=n,await u())}let h=()=>{m().catch(e=>{console.warn(`[markdown-lint] config load/lint pass failed`,e)})};function g(n){if(!i.dom.isConnected||i.dom.offsetParent===null||n.source===`frontmatter`)return!1;let{spans:a,fmLineCount:o}=Gl(t?.()??r.serialize(i.state.doc.toJSON()),r);if(a.length!==Su(i.state.doc)||o>0&&n.line<=o)return!1;let s=Jl(a,n.line);if(s===null)return!1;let c=-1;return i.state.doc.forEach((e,t,n)=>{n===s&&(c=t)}),c<0?!1:fe(e,()=>{i.dispatch(i.state.tr.setSelection(Ha.near(i.state.doc.resolve(c+1)))),i.focus();let e=i.nodeDOM(c);e instanceof HTMLElement&&e.scrollIntoView({behavior:`smooth`,block:`start`})})}function _(t){let n=t.detail;!n||n.docName!==e||s||g(n)&&Wl(e)}h();let v=Lm(h),y=xP(i,{getFixes:e=>{if(e.getAttribute(yP)!==`1`||l.size===0)return[];let t;try{t=i.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),i.state.doc.content.size),r=i.state.doc.resolve(n),a=r.depth>=1?r.before(1):0;return l.get(a)??[]},applyFix:n});window.addEventListener(su,_);let b=()=>{s||f()};return window.addEventListener(Tw,b),{update(e,t){e.state.doc!==t.doc&&f()},destroy(){s=!0,o&&clearTimeout(o),v(),y.destroy(),window.removeEventListener(su,_),window.removeEventListener(Tw,b)}}}})]}}),CP=1400,wP=new ps(`okAgentInsertFlash`);function TP(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 EP=6e3;function DP(){return new is({key:wP,state:{init:()=>Mo.empty,apply(e,t){let n=t.map(e.mapping,e.doc),r=e.getMeta(wP);if(r===void 0)return n;if(r.sweep===!0){let e=n.find().filter(e=>r.now-(e.spec.addedAt??0)>=CP);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,[Ho.inline(r.add.from,r.add.to,{class:`ok-agent-insert-flash`},t)])}return n}},props:{decorations(e){return wP.getState(e)}}})}function OP(e,t,n){if(t<0||t>e.content.size)return null;let r=vs(e.resolve(t));return r?n===`row`?ha.rowSelection(r):ha.colSelection(r):null}function kP(e){if(!(e instanceof ha))return null;let t=e.$anchorCell.node(-1);if(!t)return null;let n=e.$anchorCell.start(-1),r=ba.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 AP(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=OP(i.doc,a,n);o&&r.dispatch(i.tr.setSelection(o))}var jP=5,MP=1;function NP(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)<jP)return;t.isDragging=!0,m(!0),document.body.style.cursor=`grabbing`,document.body.style.userSelect=`none`}let n=PP(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?RP(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 PP(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:MP,rect:IP(a,FP(e,0,n.top))};if(r<=n.bottom){let i=r>=n.top+n.height/2,o=i?t+1:t,s=Math.max(MP,o);return{index:s,rect:IP(a,s===o?i?n.bottom:n.top:FP(e,0,n.top))}}}let t=e[e.length-1].getBoundingClientRect();return{index:e.length,rect:IP(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:LP(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:LP(a,i)}}}let c=s[s.length-1].getBoundingClientRect();return{index:s.length,rect:LP(a,c.right)}}function FP(e,t,n){let r=e[t];return r?r.getBoundingClientRect().bottom:n}function IP(e,t){return{left:e.left,top:t-1,width:e.width,height:2}}function LP(e,t){return{left:t-1,top:e.top,width:2,height:e.height}}function RP(e,t,n,r){let i=n===`row`?zP(t):t.cellIndex;if(i<0||n===`row`&&(i<MP||r<MP)||r===i||r===i+1)return;let{state:a,view:o}=e,s=BP(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;UP(l,s,c,n===`row`?VP(c,i,r):HP(c,i,r)),o.dispatch(l)}function zP(e){let t=e.parentElement,n=t?.closest(`table`);return n?Array.prototype.indexOf.call(n.rows,t):-1}function BP(e){for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole===`table`)return e.before(t);return-1}function VP(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 HP(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 UP(e,t,n,r){e.replaceRangeWith(t,t+n.nodeSize,r)}function WP(e){return[...e?[{id:`toggle-header-column`,label:{id:`JddocZ`},icon:xv,run:e=>e.chain().focus().toggleHeaderColumn().run()}]:[],{id:`insert-column-left`,label:{id:`ZJ99sD`},icon:ol,run:e=>e.chain().focus().addColumnBefore().run()},{id:`insert-column-right`,label:{id:`9EykGQ`},icon:ll,run:e=>e.chain().focus().addColumnAfter().run()},{id:`delete-column`,label:{id:`GAohqx`},icon:ff,separatorBefore:!0,run:e=>e.chain().focus().deleteColumn().run()},{id:`delete-table`,label:{id:`HSI88F`},icon:Iv,run:e=>e.chain().focus().deleteTable().run()}]}function GP(e){return[...e?[{id:`toggle-header-row`,label:{id:`61i3cO`},icon:py,run:e=>e.chain().focus().toggleHeaderRow().run()}]:[],{id:`insert-row-above`,label:{id:`JrqL_z`},icon:cl,run:e=>e.chain().focus().addRowBefore().run()},{id:`insert-row-below`,label:{id:`CUmCwI`},icon:sl,run:e=>e.chain().focus().addRowAfter().run()},{id:`delete-row`,label:{id:`0cspe_`},icon:ff,separatorBefore:!0,run:e=>e.chain().focus().deleteRow().run()},{id:`delete-table`,label:{id:`HSI88F`},icon:Iv,run:e=>e.chain().focus().deleteTable().run()}]}function KP(e){if(!e.isEditable||je(e.state).query)return null;let{state:t,view:n}=e,r=kP(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 qP(e){let t=(0,$.c)(46),{editor:n,anchor:r,axis:i,items:a}=e,o=(0,Q.useRef)(null),{_:s}=on(),[c,l]=(0,Q.useState)(!1),u;t[0]!==r||t[1]!==i||t[2]!==n?(u=()=>{AP(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=NP(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 Yr(r,e,()=>{Gr(r,e,{strategy:`absolute`,placement:t,middleware:[Kr(n)]}).then(t=>{let{x:n,y:r}=t;e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.opacity=`1`}).catch(JP)})},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`?Ev:Vn,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)(hi,{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)(Si,{}),(0,Z.jsxs)(li,{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)(yi,{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)(xi,{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 JP(){}function YP(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=KP(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=WP(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)(qP,{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=GP(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)(qP,{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 XP(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=Se.getState(e.state)?.binding;if(!t){yp.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-binding`}),s(`no ySync binding on "${n}"`);return}if(typeof t._forceRerender!=`function`){yp.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-force-rerender`}),s(`ySync binding on "${n}" exposes no _forceRerender`);return}yp.count(`ok/editor/pattern-d-stale-prewarm`,{docName:n}),t._forceRerender()};return ya.create({name:`walkCurrency`,onBeforeCreate(){t.observeDeep(o),i=!0},onDestroy(){c()},addProseMirrorPlugins(){return[new is({view:e=>(a||(a=!0,c(),r&&l(e)),{})})]}})}var ZP=new WeakMap;function QP(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=Go(e.color),n.textContent=e.name,t.append(n),t}var $P={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null};function eF(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 tF=100,nF=100,rF=3,iF=250;function aF(e){return`contentComponent`in e&&`isEditorContentInitialized`in e}function oF(e,t){let n=Lr(e);if(!n||t.contains(n.dom))return!1;if(!aF(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 sF(){let e=new To({extensions:as});return{mdManager:e,text:M({mdManager:e}),html:w({mdManager:e}),paste:z({mdManager:e}),copy:v({mdManager:e}),drop:F({mdManager:e})}}function cF(e,t){return t?{collaboration:s.configure({document:e.document,ySyncOptions:{mapping:t}}),guard:[XP({fragment:e.document.getXmlFragment(`default`),docName:e.configuration.name??``})]}:{collaboration:s.configure({document:e.document}),guard:[]}}function lF(e){let{provider:t,placeholder:n,prebuiltMapping:r,onWedged:i}=e,{collaboration:a,guard:o}=cF(t,r);return[...Te.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`||e.name===`jsxInline`||e.name===`imageReference`?e.configure({docName:t.configuration.name??``}):e),uP(t.configuration.name??``),cf.configure({placeholder:()=>n??Ms._({id:`RS98db`}),showOnlyCurrent:!0}),pe.configure({docName:t.configuration.name??``}),a,ya.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[jt]}}),ya.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[k(e,{cursorBuilder:QP})]}}),ya.create({name:`bindingStalenessGuard`,addProseMirrorPlugins(){return[lM({fragment:t.document.getXmlFragment(`default`),docName:t.configuration.name??``,onWedged:i??(()=>{})})]}}),...o,cN,SP.configure({docName:t.configuration.name??``,getSource:()=>t.document.getText(`source`).toString(),applyFix:e=>kw(t,e,t.configuration.name??``)})]}function uF(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{ZP.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=ZP.get(e);if(ZP.delete(e),r==null)return;let i=performance.now();yp(`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:qj(lF(e))}}function dF(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i,onWedged:a}=e,o=t.document.getXmlFragment(`default`),s=new Map,c=uF({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}=Dt(o,t.schema);r.forEach((e,t)=>{s.set(t,e)}),t.options.content=n.toJSON()},element:null}}var fF=e=>{let t=(0,$.c)(23),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)($P),c=Yj(),{principal:l,activeDocName:u,recycleDocument:d}=Oe(),p=n.configuration.name??``,[m]=(0,Q.useState)(sF),h;t[0]!==m||t[1]!==p||t[2]!==r||t[3]!==n||t[4]!==d?(h=()=>()=>({editor:new Ja(dF({provider:n,placeholder:r,clipboard:m,ctorStart:performance.now(),onWedged:e=>{let{externalSeq:t,appliedSeq:n}=e;yp(`ok/editor/binding-wedge-recycle`,{docName:p,externalSeq:t,appliedSeq:n}),d(p)}})),ydoc:n.document,ytext:n.document.getText(`source`),provider:n}),t[0]=m,t[1]=p,t[2]=r,t[3]=n,t[4]=d,t[5]=h):h=t[5];let[g]=(0,Q.useState)(h),_,v;if(t[6]!==g||t[7]!==p||t[8]!==n.document){let e={viewCount:0,bytes:n.document.getText(`source`).length},r=f(p)??xo();_=Q.use,v=P({docName:p,mountId:r,construct:g,sizeStats:e}),t[6]=g,t[7]=p,t[8]=n.document,t[9]=_,t[10]=v}else _=t[9],v=t[10];let y=_(v),b=y.editor,x,S;t[11]===y?(x=t[12],S=t[13]):(x=()=>()=>{_t(y)},S=[y],t[11]=y,t[12]=x,t[13]=S),(0,Q.useEffect)(x,S);let C;return t[14]!==u||t[15]!==p||t[16]!==b||t[17]!==c||t[18]!==i||t[19]!==a||t[20]!==l||t[21]!==n?(C=(0,Z.jsx)(pF,{provider:n,isSourceMode:i,docName:p,activeDocName:u,identity:c,principal:l,editor:b,wrapperRef:o,flashStateRef:s,portalTarget:a}),t[14]=u,t[15]=p,t[16]=b,t[17]=c,t[18]=i,t[19]=a,t[20]=l,t[21]=n,t[22]=C):C=t[22],C},pF=e=>{let t=(0,$.c)(133),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:s,editor:c,wrapperRef:l,flashStateRef:u,portalTarget:d}=e,f=(0,Q.useRef)(null),[p,m]=(0,Q.useState)(0),h,g;t[0]===d?(h=t[1],g=t[2]):(h=()=>{let e=f.current;if(e)return e.appendChild(d),()=>{d.parentNode===e&&e.removeChild(d)}},g=[d],t[0]=d,t[1]=h,t[2]=g),(0,Q.useLayoutEffect)(h,g);let _,v;t[3]!==c||t[4]!==d?(_=()=>{oF(c,d)&&m(mF)},v=[c,d],t[3]=c,t[4]=d,t[5]=_,t[6]=v):(_=t[5],v=t[6]),(0,Q.useEffect)(_,v);let y;t[7]!==c||t[8]!==n.configuration.name?(y=()=>(Vr(c,n.configuration.name??null),()=>{Vr(c,null)}),t[7]=c,t[8]=n.configuration.name,t[9]=y):y=t[9];let b;t[10]!==c||t[11]!==n?(b=[c,n],t[10]=c,t[11]=n,t[12]=b):b=t[12],(0,Q.useEffect)(y,b);let x;t[13]!==c||t[14]!==n.configuration.name?(x=()=>{let e=n.configuration.name;if(e)return Ut(e,c),()=>Ne(e,c)},t[13]=c,t[14]=n.configuration.name,t[15]=x):x=t[15];let S;t[16]!==c||t[17]!==n?(S=[c,n],t[16]=c,t[17]=n,t[18]=S):S=t[18],(0,Q.useEffect)(x,S);let C;t[19]!==c||t[20]!==r||t[21]!==n.configuration.name||t[22]!==n.document?(C=()=>{if(r)return;let e=n.configuration.name;if(!e||!Ql(e))return;let t=!1,i=null,a=()=>{queueMicrotask(()=>{if(t)return;let r=Yl(e);r?.kind===`selection-offset`&&(i=Zl({editor:c,docName:e,navigation:r,ydoc:n.document,transition:{from:`source`,to:`wysiwyg`}}))})};return Lr(c)?a():c.on(`create`,a),()=>{t=!0,c.off(`create`,a),i?.cancel(`mode-flip`)}},t[19]=c,t[20]=r,t[21]=n.configuration.name,t[22]=n.document,t[23]=C):C=t[23];let w;t[24]!==c||t[25]!==r||t[26]!==n?(w=[c,n,r],t[24]=c,t[25]=r,t[26]=n,t[27]=w):w=t[27],(0,Q.useEffect)(C,w);let T;t[28]!==c||t[29]!==n.configuration.name?(T=()=>{let e=n.configuration.name;if(!e)return;let t=null,r=()=>{t=null,hu(e,`wysiwyg`,du(c)),Sm(e,`wysiwyg`,Cm(c,e))},i=()=>{t&&clearTimeout(t),t=setTimeout(r,120)};return r(),c.on(`selectionUpdate`,i),c.on(`update`,i),()=>{t&&clearTimeout(t),c.off(`selectionUpdate`,i),c.off(`update`,i),hu(e,`wysiwyg`,null),Sm(e,`wysiwyg`,null)}},t[28]=c,t[29]=n.configuration.name,t[30]=T):T=t[30];let E;t[31]!==c||t[32]!==n?(E=[c,n],t[31]=c,t[32]=n,t[33]=E):E=t[33],(0,Q.useEffect)(T,E);let D;t[34]!==c||t[35]!==n.configuration.name?(D=()=>{},t[34]=c,t[35]=n.configuration.name,t[36]=D):D=t[36];let O;t[37]!==c||t[38]!==n?(O=[c,n],t[37]=c,t[38]=n,t[39]=O):O=t[39],(0,Q.useEffect)(D,O);let k,A;t[40]===c?(k=t[41],A=t[42]):(k=()=>{let e=hF,t=null,n=()=>{if(t||c.isDestroyed)return;let n=Lr(c);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 Lr(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},A=[c],t[40]=c,t[41]=k,t[42]=A),(0,Q.useEffect)(k,A);let j;t[43]!==c||t[44]!==n.configuration.name?(j=()=>{let e=n.configuration.name;if(!e)return;let t=t=>{let{transaction:n}=t;Ft(n)&&Le(e)};return c.on(`transaction`,t),()=>{c.off(`transaction`,t)}},t[43]=c,t[44]=n.configuration.name,t[45]=j):j=t[45];let M;t[46]!==c||t[47]!==n?(M=[c,n],t[46]=c,t[47]=n,t[48]=M):M=t[48],(0,Q.useEffect)(j,M);let N,P;t[49]!==i||t[50]!==c?(N=()=>{let e=!1,t=()=>{if(e||c.isDestroyed||!Lr(c))return;e=!0;let t=et(i)?.selection??null;if(t)try{let e=c.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));c.commands.setTextSelection({from:n,to:r})}else{let n=Math.max(0,Math.min(t.from,e));c.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})),yp(`ok/editor/selection-restore-failed`,{docName:i,message:n})}Be(i)};if(Lr(c)){t();return}return c.on(`create`,t),()=>{c.off(`create`,t)}},P=[c,i],t[49]=i,t[50]=c,t[51]=N,t[52]=P):(N=t[51],P=t[52]),(0,Q.useEffect)(N,P);let F,I;t[53]!==u||t[54]!==n.document||t[55]!==l?(F=()=>{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=>{u.current=e;let t=l.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??``))},d=()=>{let e=s(),t=e?.description?.toLowerCase().includes(`prepend`)?`prepend`:`append`,n={state:`editing`,count:(u.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)},ma)};c($P);let f=()=>{if(eo(e),!lo(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(),d()},e)}return}r=n,d()};e.observe(f);let p=()=>{document.visibilityState===`visible`?lo(e,t)&&(t=Date.now(),r=Date.now(),d()):t=Date.now()};return document.addEventListener(`visibilitychange`,p),()=>{e.unobserve(f),document.removeEventListener(`visibilitychange`,p),i&&clearTimeout(i),a&&clearTimeout(a),o&&clearTimeout(o)}},I=[n.document,u,l],t[53]=u,t[54]=n.document,t[55]=l,t[56]=F,t[57]=I):(F=t[56],I=t[57]),(0,Q.useEffect)(F,I);let L=(0,Q.useRef)(null),R;t[58]!==a||t[59]!==i||t[60]!==c||t[61]!==n?(R=()=>{let e=DP(),t=n.document.getMap(`agent-flash`),r=null,o=!1;queueMicrotask(()=>{o||c.isDestroyed||c.registerPlugin(e)});let s=[],l=()=>c.editorView??null,u=(e,t,n)=>{if(e.dispatch(e.state.tr.setMeta(wP,{add:{from:t,to:n},now:Date.now()})),r!==null&&clearTimeout(r),r=window.setTimeout(()=>{r=null;let e=l();e?.dispatch(e.state.tr.setMeta(wP,{now:Date.now(),sweep:!0}))},CP+50),!of()||document.visibilityState!==`visible`||e.hasFocus())return;let a=()=>{let e=l();if(!(e==null||e.hasFocus()||document.visibilityState!==`visible`)&&!ce(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(Se)?.isChangeOrigin!==!0||!lo(t,Date.now()-1400)||i!==a)return;let r=eF(t,Date.now()-CP);if(r!==null&&r.key===L.current)return;let o=TP(n.before,n.doc);if(o===null)return;let s=l();s!=null&&(r!==null&&(L.current=r.key),u(s,o.from,o.to))};c.on(`transaction`,d);let f=()=>{if(o||i!==a)return;let e=l();if(e==null)return;let n=eF(t,Date.now()-EP);if(n===null||n.key===L.current)return;let r=n.entry.changedBlocks;if(r===void 0)return;let s=$l(e.state.doc,r.from,r.to);s!==null&&(L.current=n.key,u(e,s.from,s.to))},p=requestAnimationFrame(f),m=()=>{requestAnimationFrame(f)};return n.on(`synced`,m),()=>{o=!0,c.off(`transaction`,d),n.off(`synced`,m),cancelAnimationFrame(p),r!==null&&clearTimeout(r);for(let e of s)clearTimeout(e);c.unregisterPlugin(wP)}},t[58]=a,t[59]=i,t[60]=c,t[61]=n,t[62]=R):R=t[62];let z;t[63]!==a||t[64]!==i||t[65]!==c||t[66]!==n.document||t[67]!==n.off||t[68]!==n.on?(z=[c,n.document,i,a,n.on,n.off],t[63]=a,t[64]=i,t[65]=c,t[66]=n.document,t[67]=n.off,t[68]=n.on,t[69]=z):z=t[69],(0,Q.useEffect)(R,z);let B,V;t[70]!==a||t[71]!==i||t[72]!==c||t[73]!==r||t[74]!==n?(B=()=>{if(r)return;let e=0,t,o=null,s=null,l=null,u=function(){if(e<tF){e+=1,t=window.setTimeout(m,nF);return}o=null,s=null,e=0},d=function(e){let t=Lr(c);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?fe(i,()=>{t.scrollIntoView({behavior:`smooth`,block:`start`})}):!1},p=function(e,n){let r=rF,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(f(e),--r,r>0&&(t=window.setTimeout(o,iF)))};t=window.setTimeout(o,iF)};function m(){if(!o||i!==a)return;let t=o,n=s;if(!n){u();return}f(t)?(l=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&&l===n)return;let r=Ef(n);if(!r){l=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),c.on(`transaction`,g),window.addEventListener(`hashchange`,h),()=>{t!==void 0&&clearTimeout(t),n.off(`synced`,g),c.off(`transaction`,g),window.removeEventListener(`hashchange`,h)}},V=[n,c,i,a,r],t[70]=a,t[71]=i,t[72]=c,t[73]=r,t[74]=n,t[75]=B,t[76]=V):(B=t[75],V=t[76]),(0,Q.useEffect)(B,V);let H,U;t[77]!==i||t[78]!==c?(H=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==i||t.mode!==`wysiwyg`||c.isDestroyed)return;let n=Lr(c);if(!n)return;let r=n.dom.querySelectorAll(`h1, h2, h3, h4, h5, h6`)[t.index];r&&fe(i,()=>{r.scrollIntoView({behavior:`smooth`,block:`start`})})};return window.addEventListener(ou,e),()=>window.removeEventListener(ou,e)},U=[c,i],t[77]=i,t[78]=c,t[79]=H,t[80]=U):(H=t[79],U=t[80]),(0,Q.useEffect)(H,U);let W;t[81]!==a||t[82]!==i||t[83]!==o||t[84]!==r||t[85]!==s||t[86]!==n.awareness?(W=()=>{let e=n.awareness;if(!e)return;if(i!==a){e.setLocalState(null);return}e.setLocalState({user:eM({principal:s,identity:o}),mode:r?`source`:`wysiwyg`});let t=$j();return t.start(),t.setAwareness(e),()=>t.clearAwareness(e)},t[81]=a,t[82]=i,t[83]=o,t[84]=r,t[85]=s,t[86]=n.awareness,t[87]=W):W=t[87];let ee;t[88]!==a||t[89]!==i||t[90]!==o||t[91]!==r||t[92]!==s||t[93]!==n?(ee=[n,i,a,o,s,r],t[88]=a,t[89]=i,t[90]=o,t[91]=r,t[92]=s,t[93]=n,t[94]=ee):ee=t[94],(0,Q.useEffect)(W,ee);let G,K;t[95]!==c||t[96]!==r?(G=()=>(Dr(c,r),()=>{Dr(c,!1)}),K=[c,r],t[95]=c,t[96]=r,t[97]=G,t[98]=K):(G=t[97],K=t[98]),(0,Q.useEffect)(G,K);let q;t[99]!==a||t[100]!==i||t[101]!==c||t[102]!==r?(q=!r&&(0,Z.jsx)(ZN,{editor:c,shortcutEnabled:i===a}),t[99]=a,t[100]=i,t[101]=c,t[102]=r,t[103]=q):q=t[103];let J;t[104]!==a||t[105]!==i||t[106]!==c||t[107]!==r?(J=!r&&(0,Z.jsxs)(Cj,{children:[(0,Z.jsx)(xj,{editor:c,docName:i,shortcutEnabled:i===a}),(0,Z.jsx)(dj,{editor:c,docName:i}),(0,Z.jsx)(Tj,{editor:c,docName:i}),i===a&&(0,Z.jsx)(vj,{editor:c,docName:i})]}),t[104]=a,t[105]=i,t[106]=c,t[107]=r,t[108]=J):J=t[108];let ne;t[109]!==c||t[110]!==r?(ne=!r&&(0,Z.jsx)(YP,{editor:c}),t[109]=c,t[110]=r,t[111]=ne):ne=t[111];let re;t[112]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(`div`,{ref:f,style:{display:`contents`}}),t[112]=re):re=t[112];let ie;t[113]!==c||t[114]!==p?(ie=(0,Z.jsx)(Sr,{editor:c,className:`tiptap-editor-portal-content h-full`},p),t[113]=c,t[114]=p,t[115]=ie):ie=t[115];let ae;t[116]!==d||t[117]!==ie?(ae=(0,Pg.createPortal)(ie,d),t[116]=d,t[117]=ie,t[118]=ae):ae=t[118];let oe;t[119]===c?oe=t[120]:(oe=(0,Z.jsx)(nj,{editor:c}),t[119]=c,t[120]=oe);let se;t[121]===c?se=t[122]:(se=Ce(c),t[121]=c,t[122]=se);let le;t[123]===se.store?le=t[124]:(le=(0,Z.jsx)(te,{store:se.store}),t[123]=se.store,t[124]=le);let ue;return t[125]!==q||t[126]!==J||t[127]!==ne||t[128]!==ae||t[129]!==oe||t[130]!==le||t[131]!==l?(ue=(0,Z.jsxs)(`div`,{ref:l,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:[q,J,ne,re,ae,oe,le]}),t[125]=q,t[126]=J,t[127]=ne,t[128]=ae,t[129]=oe,t[130]=le,t[131]=l,t[132]=ue):ue=t[132],ue};function mF(e){return e+1}function hF(){return Tr()}async function gF(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 _F(e,t){return gF(e,`content`,t)}async function vF(e){return gF(e,`mine`)}async function yF(e){return gF(e,`theirs`)}async function bF(e){return gF(e,`delete`)}async function xF(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 SF(e){let t=(0,$.c)(86),{docName:n}=e,{_:r}=on(),{conflicts:i,loading:a}=Uu(),o;if(t[0]!==i||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>Af(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=Sh(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),xF(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 _F(c,e);t.ok||Ns.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),Ns.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)(Ch,{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(bF),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(yF),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)(Ch,{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(vF),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(bF),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)(Ch,{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 CF(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(ht(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 wF=`__back-nav__`;function TF(e){return e instanceof We||e instanceof zt||e instanceof dt||e instanceof Fe||e instanceof Re||e instanceof q?e.docName:null}function EF(e){return e instanceof We||e instanceof zt}function DF(e){if(e instanceof We){let t=e.docName;return{title:Ms._({id:`Jejur6`}),summary:Ms._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof zt){let t=e.docName;return{title:Ms._({id:`V7QxyT`}),summary:Ms._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof dt){let t=e.docName;return{title:Ms._({id:`1di5fu`}),summary:Ms._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof Fe){let t=e.docName;return{title:Ms._({id:`wvbc1r`}),summary:Ms._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof Re)return{title:Ms._({id:`Gfr4fu`}),summary:Ms._({id:`UW2Fg3`})};if(e instanceof q){let t=e.docName;return{title:Ms._({id:`vv7kpg`}),summary:Ms._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:Ms._({id:`W5A0Ly`});return{title:Ms._({id:`29VNqC`}),summary:t}}function OF(e){let t=(0,$.c)(41),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,s;t[0]===n?s=t[1]:(s=DF(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=typeof window<`u`?window.okDesktop:void 0,h=m&&EF(n)?m:null,g,_;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{d.current?.focus()},_=[],t[2]=g,t[3]=_):(g=t[2],_=t[3]),(0,Q.useEffect)(g,_);let v;t[4]===n?v=t[5]:(v=EF(n),t[4]=n,t[5]=v);let y;t[6]===v?y=t[7]:(y=(0,Z.jsx)(q_,{keyboard:v}),t[6]=v,t[7]=y);let b;t[8]===c?b=t[9]:(b=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:c}),t[8]=c,t[9]=b);let x;t[10]===l?x=t[11]:(x=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:l}),t[10]=l,t[11]=x);let S;t[12]!==b||t[13]!==x?(S=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[b,x]}),t[12]=b,t[13]=x,t[14]=S):S=t[14];let C;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(Y,{id:`KDw4GX`}),t[15]=C):C=t[15];let w;t[16]===r?w=t[17]:(w=(0,Z.jsx)(X,{ref:d,variant:`default`,onClick:r,children:C}),t[16]=r,t[17]=w);let T;t[18]===h?T=t[19]:(T=h?(0,Z.jsx)(X,{variant:`outline-mono`,onClick:()=>{ES(h).then(AF).catch(kF)},children:(0,Z.jsx)(Y,{id:`uaUc6t`})}):null,t[18]=h,t[19]=T);let E;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(E=m?(0,Z.jsx)(X,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>p(!0),children:(0,Z.jsx)(Y,{id:`ii5mVn`})}):null,t[20]=E):E=t[20];let D;t[21]!==i||t[22]!==u||t[23]!==n||t[24]!==o||t[25]!==a||t[26]!==r?(D=u?(0,Z.jsx)(X,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(Ct(TF(n)??i),o(a),r(wF))},children:(0,Z.jsx)(Y,{id:`CKyk7Q`})}):null,t[21]=i,t[22]=u,t[23]=n,t[24]=o,t[25]=a,t[26]=r,t[27]=D):D=t[27];let O;t[28]!==w||t[29]!==T||t[30]!==D?(O=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[w,T,E,D]}),t[28]=w,t[29]=T,t[30]=D,t[31]=O):O=t[31];let k;t[32]!==i||t[33]!==n||t[34]!==f?(k=m?(0,Z.jsx)($_,{open:f,onOpenChange:p,crashContext:{source:`document view`,docName:TF(n)??i,errorMessage:n instanceof Error&&n.message?n.message:String(n),componentStack:rv(n)}}):null,t[32]=i,t[33]=n,t[34]=f,t[35]=k):k=t[35];let A;return t[36]!==O||t[37]!==k||t[38]!==y||t[39]!==S?(A=(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:[y,S,O,k]}),t[36]=O,t[37]=k,t[38]=y,t[39]=S,t[40]=A):A=t[40],A}function kF(){}function AF(e){e.ok||Ns.error(e.message,{id:`server-restart-error`,duration:1/0})}function jF(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)(OF,{...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]===wF){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)=>{nv(e,t.componentStack),console.error(`[DocumentErrorBoundary] rendered fallback for ${n}: ${DF(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)(Pn,{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 MF(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Qo(t);return{map:n,keys:zo(t),parseError:r}}function NF(e){let t=(0,$.c)(29),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>MF(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=Vt(ko(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=ae(i.map.icon),t[5]=i.map.icon,t[6]=l);let u=l,d;t[7]===i.map?d=t[8]:(d=Me(i.map),t[7]=i.map,t[8]=d);let f=d,p;t[9]!==f||t[10]!==i.map?(p=f?Yt(i.map[f]):{kind:`unsupported`,value:``},t[9]=f,t[10]=i.map,t[11]=p):p=t[11];let m=p,h;t[12]!==f||t[13]!==i.map?(h=f?Qt(i.map[`${f}_y`]):null,t[12]=f,t[13]=i.map,t[14]=h):h=t[14];let g=h,_=m.kind===`url`||m.kind===`path`,v=u.kind!==`unsupported`;if(!_&&!v)return null;let y=_?`true`:`false`,b=v?`true`:`false`,x;t[15]!==m||t[16]!==f||t[17]!==g||t[18]!==_?(x=_&&f?(0,Z.jsx)(PF,{cover:m,focalY:g,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]=m,t[16]=f,t[17]=g,t[18]=_,t[19]=x):x=t[19];let S;t[20]!==_||t[21]!==v||t[22]!==u?(S=v?(0,Z.jsx)(FF,{icon:u,hasCover:_}):null,t[20]=_,t[21]=v,t[22]=u,t[23]=S):S=t[23];let C;return t[24]!==x||t[25]!==S||t[26]!==y||t[27]!==b?(C=(0,Z.jsxs)(`div`,{className:`page-header editor-content-aligned`,"data-has-cover":y,"data-has-icon":b,"data-testid":`page-header`,children:[x,S]}),t[24]=x,t[25]=S,t[26]=y,t[27]=b,t[28]=C):C=t[28],C}function PF(e){let t=(0,$.c)(59),{cover:n,focalY:r,onCommitFocalY:i}=e,{_:a}=on(),[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=Ht(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 FF(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 IF=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{ManagedArtifactProperties:e}=await import(`./ManagedArtifactProperties-16Q3Ko9H.js`);return{ManagedArtifactProperties:e}},__vite__mapDeps([162,163,1,2,134,18,14,6,3,7,8,9,10,11,12,13,97,35,36,16,17,20,54,28,29,34,24,25,26,19,22,21,40,98,15,23,39,137,138,55,105,99,79,80,81,82,83,84,85,86,87,88,89,90,91,45,74,92,93,94,95,96,4,27,30,31,100,101,41,42,66,67,68,69,102,49,71,103,104,46,33,65,70,72,73,106,107,108,37,109,110,43,47,111,112,113,164,165,145,166,48,167,158,130]),import.meta.url)).ManagedArtifactProperties})),LF=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{MermaidDocEditor:e}=await import(`./MermaidDocEditor-C4p4uQqN.js`);return{MermaidDocEditor:e}},__vite__mapDeps([168,1,80,81,11,91,2,6,3,7,8,9,10,45,74,14,24,13,92,18,93,94,95,96,12,101,82,83,84,85,86,87,88,89,90,36,22,41,42,66,67,68,69,102,49,71,169,170,104,30,17,26,25,46,171,77]),import.meta.url)).MermaidDocEditor})),RF=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{TextDocEditor:e}=await import(`./TextDocEditor-DfWDVWNo.js`);return{TextDocEditor:e}},__vite__mapDeps([172,1,80,81,11,6,2,3,7,8,9,10,91,45,74,14,24,13,92,18,93,94,95,96,12,101,82,83,84,85,86,87,88,89,90,36,22,41,42,66,67,68,69,102,49,71,169,170,171,173]),import.meta.url)).TextDocEditor})),zF=xp(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function BF(e){let t=e.threshold??zF;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function VF(e){return e.hasEmittedFirstToggle||!e.isActive||!e.isLarge?!1:e.renderSource&&e.renderVisual}function HF(e,t,n){return e?t:n}function UF(e){let{docName:t,pages:n,loading:r}=e;return!r&&!n.has(t)&&!Co(t)&&co(t)===null&&!za(t)&&!Za(t)}var WF=xp(`ACTIVITY_MOUNT_LIMIT`,3);function GF(){return n(()=>import(`./SourceEditor-GHoDb1-I.js`),__vite__mapDeps([174,1,86,81,11,80,170,6,2,3,7,8,9,10,91,45,74,14,24,13,92,18,93,94,95,96,79,82,83,84,85,87,88,89,90,36,12,4,97,35,16,17,20,54,28,29,34,25,26,19,22,21,40,98,39,27,30,31,99,100,101,41,42,66,67,68,69,102,49,71,103,104,46,105,33,65,70,72,73,106,107,108,37,23,109,110,43,47,111,112,113,175,53,55,56,146,176,155,76,128,158,161,171,167]),import.meta.url)}var KF=(0,Q.lazy)(async()=>({default:(await GF()).SourceEditor}));function qF(e,t,n){if(n<=0)return[];let r=e.filter(e=>!qe(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=>!qe(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 JF(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:Ms._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?Ms._({id:`Sc1bKE`,values:{docName:e}}):Ms._({id:`ovIGrT`,values:{docName:e}}),actionLabel:Ms._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:Ms._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?Ms._({id:`bmC18N`,values:{docName:e}}):Ms._({id:`pAgkuZ`,values:{docName:e}})}:null}function YF(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(bp,{name:`activity-pool`,children:(0,Z.jsx)(XF,{...e})}),t[0]=e,t[1]=n),n}function XF(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}=Oe(),{pages:m,loading:h}=Eu(),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=qF(f,_,WF),y=(0,Q.useRef)(``),b=v.map(ZF).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)rn(e);for(let e of i){let t=x.current.find(t=>t.docName===e)?.poolEventId;he(e,t&&t.length>0?t:xo())}yp(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),y.current=b,Xe(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)(QF,{docName:e.docName,hostMount:i?.get(e.docName)??a??null,children:(0,Z.jsx)(iI,{entry:e,isVisible:_.has(e.docName),toolbar:_.has(e.docName)?o?.(e.docName,e.provider):null,isSourceMode:s,editorPlaceholder:c,isNewDoc:UF({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 ZF(e){return e.docName}function QF(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,Pg.createPortal)(i,o),t[6]=i,t[7]=o,t[8]=r,t[9]=l):l=t[9],l}function $F(e){let t=(0,$.c)(18),{isActive:n,docName:r,mode:i,initialScrollTop:a,bodyAnchorRef:o,children:s}=e,c=(0,Q.useRef)(null),l=(0,Q.useRef)(a??0),d=(0,Q.useRef)(null),f=(0,Q.useRef)(n),p=(0,Q.useRef)(!1),m,h;t[0]===n?(m=t[1],h=t[2]):(m=()=>{f.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,y;t[3]===i?(v=t[4],y=t[5]):(v=()=>{g.current=i},y=[i],t[3]=i,t[4]=v,t[5]=y),(0,Q.useLayoutEffect)(v,y);let b,x;t[6]!==o||t[7]!==r?(b=()=>{let e=c.current;if(!e)return;let t=()=>{if(!(!f.current||p.current)&&e.scrollTop>0){let t=R(e,o?.current);if(!H(t))return;l.current=e.scrollTop,d.current=t.kind===`measured`?t.contentPos:null,t.kind===`measured`&&Jt(r,{offset:e.scrollTop-t.contentPos,mode:g.current,fraction:_(e.scrollTop,e.scrollHeight,e.clientHeight)})}};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},x=[o,r],t[6]=o,t[7]=r,t[8]=b,t[9]=x):(b=t[8],x=t[9]),(0,Q.useEffect)(b,x);let S,C;t[10]!==o||t[11]!==r||t[12]!==n?(S=()=>{if(!n)return;let e=c.current;if(!e||ce(r))return;let t=Zt(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),yp(`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});return}let i=l.current,a=t?.offset,s=d.current===null?null:i-d.current,f=a??s;if(i===0&&f===null)return;let m=()=>ut(i,f,R(e,o?.current));p.current=!0;let h=e.style.overflowAnchor;e.style.overflowAnchor=`none`;let _=performance.now(),v=!1,y=!1,b=m();b!==null&&(e.scrollTop=b,u(e.scrollTop,b)&&e.scrollHeight>b&&(y=!0,yp(`ok/scroll-restore/phase1-success`,{target:b,elapsedMs:performance.now()-_})));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||yp(`ok/scroll-restore/yielded`,{reason:`user`,elapsedMs:performance.now()-_,finalScrollTop:e.scrollTop}),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){if(ce(r)){y||yp(`ok/scroll-restore/yielded`,{reason:`landing`,elapsedMs:performance.now()-_,finalScrollTop:e.scrollTop}),w();return}if(ot(x,e.scrollTop)){y||yp(`ok/scroll-restore/yielded`,{reason:`external`,elapsedMs:performance.now()-_,finalScrollTop:e.scrollTop}),w();return}b=m(),b!==null&&!u(e.scrollTop,b)&&e.scrollHeight>b&&(e.scrollTop=b,u(e.scrollTop,b)&&!v&&(yp(`ok/scroll-restore/phase2-success`,{target:b,elapsedMs:performance.now()-_}),v=!0,y=!0)),x=e.scrollTop,C=requestAnimationFrame(E)}};C=requestAnimationFrame(E);let D=setTimeout(()=>{if(S)return;let t=m();(t===null||!u(e.scrollTop,t)&&e.scrollHeight>t)&&yp(`ok/scroll-restore/abandoned`,{...t===null?{}:{target:t},anchorMeasurable:t!==null,elapsedMs:performance.now()-_,scrollHeight:e.scrollHeight,finalScrollTop:e.scrollTop}),w()},ee);return w},C=[n,o,r],t[10]=o,t[11]=r,t[12]=n,t[13]=S,t[14]=C):(S=t[13],C=t[14]),(0,Q.useLayoutEffect)(S,C);let w;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(w={overflowAnchor:`auto`},t[15]=w):w=t[15];let T;return t[16]===s?T=t[17]:(T=(0,Z.jsx)(`div`,{ref:c,"data-testid":`editor-scroll-container`,className:`editor-doc-scroll subtle-scrollbar h-full overflow-y-auto pt-14 scroll-pt-14`,style:w,children:s}),t[16]=s,t[17]=T),T}function eI(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)(VE,{}),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)(KF,{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 tI(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)(Qd,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(xd,{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:nI,children:[(0,Z.jsx)(Qd,{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 nI(){return window.location.reload()}function rI(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 iI(e){let t=(0,$.c)(73),{entry:n,isVisible:r,toolbar:i,isSourceMode:a,editorPlaceholder:o,isNewDoc:s,previousDocName:c,onNavigateBack:l,onRecycle:u,serverRestartRecovery:d}=e,p;t[0]!==n.docName||t[1]!==d?(p=JF(n.docName,d),t[0]=n.docName,t[1]=d,t[2]=p):p=t[2];let m=p,h=Ik(n.docName)===`conflict`,g;t[3]===n.docName?g=t[4]:(g=za(n.docName),t[3]=n.docName,t[4]=g);let _=g,v;t[5]!==n.docName||t[6]!==_?(v=!_&&Za(n.docName),t[5]=n.docName,t[6]=_,t[7]=v):v=t[7];let y=v,b;t[8]===n.docName?b=t[9]:(b=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-portal`,n.docName),e.style.display=`contents`,e},t[8]=n.docName,t[9]=b);let[x]=(0,Q.useState)(b),S=(0,Q.useRef)(null),C=n.provider.document.getText(`source`).length,[w,T]=(0,Q.useState)(a),E,D;t[10]!==a||t[11]!==r||t[12]!==w?(E=()=>{r&&w!==a&&T(a)},D=[r,a,w],t[10]=a,t[11]=r,t[12]=w,t[13]=E,t[14]=D):(E=t[13],D=t[14]),(0,Q.useEffect)(E,D);let O;t[15]!==a||t[16]!==r||t[17]!==w?(O=HF(r,a,w),t[15]=a,t[16]=r,t[17]=w,t[18]=O):O=t[18];let k=O,[A,j]=(0,Q.useState)(k),[M,N]=(0,Q.useState)(!k),P,F;t[19]!==k||t[20]!==A||t[21]!==M?(P=()=>{k&&!A?j(!0):!k&&!M&&N(!0)},F=[k,A,M],t[19]=k,t[20]=A,t[21]=M,t[22]=P,t[23]=F):(P=t[22],F=t[23]),(0,Q.useEffect)(P,F);let I=BF({ytextLength:C,isSourceMode:k,visitedSource:A,visitedVisual:M}),L=(0,Q.useRef)(``),R=`${I.isLarge}-${I.renderSource}-${I.renderVisual}`,z,B;t[24]!==k||t[25]!==n.docName||t[26]!==I.isLarge||t[27]!==I.renderSource||t[28]!==I.renderVisual||t[29]!==R||t[30]!==C?(z=()=>{L.current!==R&&(L.current=R,I.isLarge&&yp(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:C,isSourceMode:k,renderSource:I.renderSource,renderVisual:I.renderVisual}))},B=[R,I.isLarge,I.renderSource,I.renderVisual,n.docName,C,k],t[24]=k,t[25]=n.docName,t[26]=I.isLarge,t[27]=I.renderSource,t[28]=I.renderVisual,t[29]=R,t[30]=C,t[31]=z,t[32]=B):(z=t[31],B=t[32]),(0,Q.useEffect)(z,B);let V;t[33]===n.docName?V=t[34]:(V=()=>et(n.docName),t[33]=n.docName,t[34]=V);let[H]=(0,Q.useState)(V),U=H?.html??null,[W,ee]=(0,Q.useState)(!1),G,K;t[35]!==k||t[36]!==n.docName||t[37]!==I.isLarge||t[38]!==I.renderSource||t[39]!==I.renderVisual||t[40]!==W||t[41]!==r||t[42]!==C?(G=()=>{VF({isActive:r,isLarge:I.isLarge,renderSource:I.renderSource,renderVisual:I.renderVisual,hasEmittedFirstToggle:W})&&(yp(`ok/cold/first-toggle`,{docName:n.docName,mountId:f(n.docName),ytextLength:C,modeEnteredFirst:k?`source`:`visual`}),ee(!0))},K=[W,r,I.isLarge,I.renderSource,I.renderVisual,n.docName,C,k],t[35]=k,t[36]=n.docName,t[37]=I.isLarge,t[38]=I.renderSource,t[39]=I.renderVisual,t[40]=W,t[41]=r,t[42]=C,t[43]=G,t[44]=K):(G=t[43],K=t[44]),(0,Q.useEffect)(G,K);let q=r?`visible`:`hidden`,te=`editor:${n.docName}`,J=k?`source`:`wysiwyg`,ne=H?.scrollTop,re;t[45]!==o||t[46]!==k||t[47]!==n||t[48]!==I.renderSource||t[49]!==I.renderVisual||t[50]!==h||t[51]!==_||t[52]!==s||t[53]!==y||t[54]!==r||t[55]!==l||t[56]!==u||t[57]!==x||t[58]!==c||t[59]!==m||t[60]!==U?(re=m?(0,Z.jsx)(tI,{view:m}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(jF,{activeDocName:n.docName,previousDocName:c,onNavigateBack:l,onRecycle:u,children:(0,Z.jsx)(Q.Suspense,{fallback:U?(0,Z.jsx)(rI,{html:U}):(0,Z.jsx)(VE,{}),children:(0,Z.jsx)(CF,{docName:n.docName,provider:n.provider,children:h?(0,Z.jsx)(SF,{docName:n.docName,provider:n.provider}):_?(0,Z.jsx)(LF,{docName:n.docName,provider:n.provider,isSourceMode:k}):y?(0,Z.jsx)(RF,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!k&&(Co(n.docName)||ep(n.docName)||co(n.docName)?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(IF,{docName:n.docName,provider:n.provider})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(NF,{provider:n.provider}),(0,Z.jsx)(Ml,{provider:n.provider})]})),(0,Z.jsx)(`div`,{ref:S,"aria-hidden":!0,className:`h-0`,[Gt]:``}),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[I.renderSource?(0,Z.jsx)(`div`,{className:k?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(eI,{entry:n,isActive:r,isSourceMode:k,editorPlaceholder:o})}):null,I.renderVisual?(0,Z.jsx)(`div`,{className:k?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(fF,{provider:n.provider,placeholder:o,isSourceMode:k,portalTarget:x},`${n.docName}-${String(s)}-${n.poolEventId}`)}):null]})]})})})})}),t[45]=o,t[46]=k,t[47]=n,t[48]=I.renderSource,t[49]=I.renderVisual,t[50]=h,t[51]=_,t[52]=s,t[53]=y,t[54]=r,t[55]=l,t[56]=u,t[57]=x,t[58]=c,t[59]=m,t[60]=U,t[61]=re):re=t[61];let ie;t[62]!==n.docName||t[63]!==r||t[64]!==J||t[65]!==ne||t[66]!==re?(ie=(0,Z.jsx)($F,{isActive:r,docName:n.docName,mode:J,initialScrollTop:ne,bodyAnchorRef:S,children:re}),t[62]=n.docName,t[63]=r,t[64]=J,t[65]=ne,t[66]=re,t[67]=ie):ie=t[67];let ae;return t[68]!==q||t[69]!==te||t[70]!==ie||t[71]!==i?(ae=(0,Z.jsxs)(Q.Activity,{mode:q,name:te,children:[ie,i]}),t[68]=q,t[69]=te,t[70]=ie,t[71]=i,t[72]=ae):ae=t[72],ae}function aI(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function oI(e){let{value:t,unit:n}=aI(e);return n===`rem`?t*16:t}function sI(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var cI=3600*24*7;function lI(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?uI:m,O=g===void 0?cI: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),H=(0,Q.useRef)(y),U,W;t[0]===r?(U=t[1],W=t[2]):(U=()=>{V.current=r},W=[r],t[0]=r,t[1]=U,t[2]=W),(0,Q.useEffect)(U,W);let ee,G;t[3]===y?(ee=t[4],G=t[5]):(ee=()=>{H.current=y},G=[y],t[3]=y,t[4]=ee,t[5]=G),(0,Q.useEffect)(ee,G);let K=oI(b),q;t[6]===x?q=t[7]:(q=oI(x),t[6]=x,t[7]=q);let te=q,J;t[8]!==E||t[9]!==k?(J=function(e){E&&(P.current=!0,j.current=H.current?0:oI(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]=J):J=t[10];let ne=J,re,ie;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==te||t[18]!==K||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(re=()=>{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}=aI(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&&!H.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=K*w;else if(e<=K){let n=K*(w-1);t=K-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&H.current&&c===`expand`&&z.current>K*T){a();let t=n(r,M.current,j.current,s),c=Math.max(K,Math.min(te,t)),u=sI(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(H.current)return;let u=n(r,M.current,j.current,s),d=Math.max(K,Math.min(te,u)),f=sI(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)}},ie=[i,a,D,K,te,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]=te,t[18]=K,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=re,t[25]=ie):(re=t[24],ie=t[25]),(0,Q.useEffect)(re,ie);let ae;return t[26]===ne?ae=t[27]:(ae={dragRef:A,isDragging:N,handleMouseDown:ne},t[26]=ne,t[27]=ae),ae}function uI(){}var dI=3600*24*7,fI=`18rem`,pI=`3rem`,mI=`app-file-sidebar`,hI=`14.625rem`,gI=`32rem`,_I=`sidebar_width`,vI=/^\d+(?:\.\d+)?(?:rem|px)$/,yI=Q.createContext(null);function bI(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${_I}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return vI.test(n)?n:e}function xI(){let e=Q.use(yI);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function SI(e){let t=(0,$.c)(58),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?fI:c,[u]=Q.useState(wI),d;t[8]===u?d=t[9]:(d=()=>Zk(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>bI(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=iA();return oA(`left`,Zk(u,window.innerWidth,`left`),e)===`open`},t[12]=u,t[13]=x);let[S,C]=Q.useState(x),w=i??S,T;t[14]!==w||t[15]!==f||t[16]!==o?(T=e=>{let t=typeof e==`function`?e(w):e;o?o(t):C(t),sA(`left`,f,t?`open`:`collapsed`)},t[14]=w,t[15]=f,t[16]=o,t[17]=T):T=t[17];let E=T,D;t[18]===E?D=t[19]:(D=function(){E(CI)},t[18]=E,t[19]=D);let O=D,k=Q.useRef(w),A;t[20]===w?A=t[21]:(A=()=>{k.current=w},t[20]=w,t[21]=A),Q.useLayoutEffect(A);let j;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(){window.innerWidth>=1024||k.current&&(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||b(!0))},t[22]=j):j=t[22];let M=j,N,P;t[23]===u?(N=t[24],P=t[25]):(P=()=>{let e=window.matchMedia(`(min-width: ${Jk}px)`),t=()=>{let e=Zk(u,window.innerWidth,`left`);p(e),C(oA(`left`,e,iA())===`open`)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},N=[u],t[23]=u,t[24]=N,t[25]=P),Q.useEffect(P,N);let F,I;t[26]===w?(F=t[27],I=t[28]):(F=()=>{w||document.getElementById(mI)?.contains(document.activeElement)&&document.querySelector(`[data-sidebar="trigger"]`)?.focus()},I=[w],t[26]=w,t[27]=F,t[28]=I),Q.useLayoutEffect(F,I);let L,R;t[29]!==w||t[30]!==f||t[31]!==E?(L=()=>{if(f===`above`||!w)return;let e=e=>{if(e.key!==`Escape`||rr())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[29]=w,t[30]=f,t[31]=E,t[32]=L,t[33]=R):(L=t[32],R=t[33]),Q.useEffect(L,R);let z,B;t[34]===O?(z=t[35],B=t[36]):(z=()=>{if(typeof window<`u`&&window.okDesktop!=null)return;let e=e=>{As(e,`toggle-files-sidebar`)&&(rr()||(e.preventDefault(),O()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},B=[O],t[34]=O,t[35]=z,t[36]=B),Q.useEffect(z,B);let V=w?`expanded`:`collapsed`,H;t[37]!==_||t[38]!==w||t[39]!==E||t[40]!==y||t[41]!==V||t[42]!==O||t[43]!==h?(H={state:V,open:w,setOpen:E,toggleSidebar:O,width:h,setWidth:g,isDraggingRail:_,setIsDraggingRail:v,showPushPulse:y,setShowPushPulse:b,notifySidebarFileSelected:M},t[37]=_,t[38]=w,t[39]=E,t[40]=y,t[41]=V,t[42]=O,t[43]=h,t[44]=H):H=t[44];let U;t[45]!==s||t[46]!==h?(U={"--sidebar-width":h,"--sidebar-width-icon":pI,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,ee;t[48]===r?ee=t[49]:(ee=Bn(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[48]=r,t[49]=ee);let G;t[50]!==n||t[51]!==a||t[52]!==W||t[53]!==ee?(G=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:W,className:ee,...a,children:n}),t[50]=n,t[51]=a,t[52]=W,t[53]=ee,t[54]=G):G=t[54];let K;return t[55]!==H||t[56]!==G?(K=(0,Z.jsx)(yI.Provider,{value:H,children:G}),t[55]=H,t[56]=G,t[57]=K):K=t[57],K}function CI(e){return!e}function wI(){return Sa()}function TI(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}=on(),{state:f,isDraggingRail:p}=xI();if(u===`none`){let e;t[7]===r?e=t[8]:(e=Bn(`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=Bn(`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=Bn(`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:mI,"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 EI(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}=on(),{toggleSidebar:o,state:s}=xI(),c,l,u,d,f,p,m,h;if(t[4]!==a||t[5]!==s){let e=Ss(`toggle-files-sidebar`);c=X,l=`trigger`,u=`sidebar-trigger`,d=`ghost`,f=`icon-sm`,p=s===`expanded`,m=mI,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=Bn(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)(I,{}):(0,Z.jsx)(Zv,{}),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 DI(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}=on(),{toggleSidebar:u,setWidth:d,state:f,width:p,setIsDraggingRail:m}=xI(),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:hI,maxResizeWidth:gI,setIsDraggingRail:m,widthCookieName:_I,widthCookieMaxAge:dI},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}=lI(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=Bn(`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 OI(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}=xI(),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=Bn(`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 kI(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=Bn(`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 AI(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=Bn(`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 jI(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=Bn(`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 MI(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=Bn(`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 NI(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?or:`div`,o;t[4]===n?o=t[5]:(o=Bn(`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 PI(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=Bn(`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 FI(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=Bn(`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 II(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=Bn(`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 LI=ar(`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 RI(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?or:`button`,{state:m}=xI(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=Bn(LI({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)(sr,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(cr,{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 zI(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 BI(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=xa.safeParse(t);return n.success?n.data.currentBranch??null:null}var VI=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:zI({fetchBranch:BI,subscribeToEvent:Us}),HI=VI.subscribe,UI=VI.getSnapshot;function WI(){return(0,Q.useSyncExternalStore)(HI,UI,UI)}function GI(){let e=(0,$.c)(6),t=WI(),n=Zc(),{state:r}=xI(),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&&id(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 KI(e){let t=(0,$.c)(27),{stats:n,selectionStats:r,showStats:i,composerBadge:a}=e,o=i===void 0?!0:i,{_:s}=on(),c=GI();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)(ue,{className:`size-3`,"aria-hidden":!0}),s({id:`xWEvuo`}),(0,Z.jsx)(Ul,{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)(qI,{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 qI(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)(sr,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(cr,{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)($c,{"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 JI(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}=on(),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=Bn(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 YI(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=Bn(`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 XI(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=Bn(`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 ZI(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=Bn(`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 QI(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=Bn(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(Hl,{}),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 $I=1,eL=2,tL=4;function nL(e){let t=(0,$.c)(18),{docName:n,className:r}=e;if(!n)return null;let i,a,o,s,c,l;if(t[0]!==r||t[1]!==n){l=Symbol.for(`react.early_return_sentinel`);bb0:{let e=co(n),u=e?null:Ao(n),d=e?e.folder.split(`/`).filter(Boolean):u?[]:tp(n,``).prefix.replace(/\/$/,``).split(`/`).filter(Boolean);if(d.length===0){l=null;break bb0}let f=(e,t)=>({kind:`segment`,value:e,key:d.slice(0,t+1).join(`/`)}),p=d.length>tL?[...d.slice(0,$I).map((e,t)=>f(e,t)),{kind:`ellipsis`,hidden:d.slice($I,-eL)},...d.slice(-eL).map((e,t)=>f(e,d.length-eL+t))]:d.map((e,t)=>f(e,t));a=JI,t[8]===r?c=t[9]:(c=Bn(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=YI,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=p.map(rL)}t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7];if(l!==Symbol.for(`react.early_return_sentinel`))return l;let u;t[10]!==i||t[11]!==o||t[12]!==s?(u=(0,Z.jsx)(i,{className:o,children:s}),t[10]=i,t[11]=o,t[12]=s,t[13]=u):u=t[13];let d;return t[14]!==a||t[15]!==c||t[16]!==u?(d=(0,Z.jsx)(a,{className:c,children:u}),t[14]=a,t[15]=c,t[16]=u,t[17]=d):d=t[17],d}function rL(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(QI,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(XI,{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)(Ev,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(gl,{children:e.hidden.join(` / `)})})]}):(0,Z.jsx)(XI,{className:`min-w-0`,children:(0,Z.jsx)(ZI,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:(0,Z.jsx)(gl,{children:e.value})})})]},n)}function iL(e=typeof window>`u`?void 0:window){return e?.okDesktop?.slides!=null}var aL=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillToolbarControls:e}=await import(`./SkillToolbarControls-ChzkHlc2.js`);return{SkillToolbarControls:e}},__vite__mapDeps([177,1,12,13,14,97,35,36,16,17,18,20,54,28,29,34,24,25,26,19,22,21,40,98,135,6,2,3,7,8,9,10,11,27,30,31,79,80,81,82,83,84,85,86,87,88,89,90,91,45,74,92,93,94,95,96,4,39,99,100,101,41,42,66,67,68,69,102,49,71,103,104,46,105,33,65,70,72,73,106,107,108,37,23,109,110,43,47,111,112,113,126,136,137,138,55,116,117,139,178,179,169,170,180,123,163,134,15,164,165,145,166,48,167,158,130,142,181,129,161,44,50,148,182]),import.meta.url)).SkillToolbarControls})),oL=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillOriginInline:e}=await import(`./SkillOriginInline-CLT-BIkT.js`);return{SkillOriginInline:e}},__vite__mapDeps([183,1,179,80,81,11,88,86,84,82,83,85,45,12,13,14,30,17,26,24,25,169,170,74,18,27,16,28,29,31,22,100,19,20,34,35,36,64,37,146,114,184,6,2,3,7,8,9,10,92,130,70,72,112]),import.meta.url)).SkillOriginInline})),sL=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SlidesToolbarControls:e}=await import(`./SlidesToolbarControls-XPbdtH71.js`);return{SlidesToolbarControls:e}},__vite__mapDeps([185,1,6,2,3,7,8,9,10,11,12,13,14,34,35,36,16,17,18,20,28,24,25,26,30,22,92,148,182]),import.meta.url)).SlidesToolbarControls})),cL=[];function lL(e){let t=(0,$.c)(113),{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?cL:l,m=f===void 0?!1:f,{_:h}=on(),g=bc()?.merged?.slides?.enabled===!0,_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=xs(`toggle-document-panel`),t[0]=_):_=t[0];let v=_,y,b,x,S,C,w,T,E,D,O,k,A,j,M,N,P;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){x=Ss(`toggle-document-panel`);let e;t[30]===n?e=t[31]:(e=n?Ao(n):null,t[30]=n,t[31]=e);let l=e,f;t[32]===n?f=t[33]:(f=n?ep(n):null,t[32]=n,t[33]=f);let _=f,v;t[34]!==l||t[35]!==_?(v=l?.kind===`skill`?{scope:l.scope,name:l.name}:_?{scope:`project`,name:_}:null,t[34]=l,t[35]=_,t[36]=v):v=t[36];let F=v,I,L;t[37]!==F||t[38]!==p?(I=Al(p,F?bl:Dl),L=I.map(uL),t[37]=F,t[38]=p,t[39]=I,t[40]=L):(I=t[39],L=t[40]);let R=L,z;t[41]===n?z=t[42]:(z=n?Bo(n):null,t[41]=n,t[42]=z);let B=z;E=`editor-toolbar`,D=`pointer-events-none absolute inset-x-0 top-0 z-10 @container/toolbar`;let V;t[43]!==n||t[44]!==F||t[45]!==B?(V=F?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(oL,{scope:F.scope,name:F.name})}):B?null:(0,Z.jsx)(nL,{docName:n}),t[43]=n,t[44]=F,t[45]=B,t[46]=V):V=t[46];let H;t[47]===n?H=t[48]:(H=n===null?null:(0,Z.jsx)($m,{entry:{kind:`document`,docName:n},className:`shrink-0`}),t[47]=n,t[48]=H);let U;t[49]!==V||t[50]!==H?(U=(0,Z.jsxs)(`div`,{className:`pointer-events-auto flex min-w-0 items-center gap-2`,children:[V,H]}),t[49]=V,t[50]=H,t[51]=U):U=t[51];let W;t[52]!==n||t[53]!==i||t[54]!==o||t[55]!==a?(W=n!==null&&Za(n)?null:(0,Z.jsx)(th,{isSourceMode:i,onModeChange:o,sourceDisabled:a}),t[52]=n,t[53]=i,t[54]=o,t[55]=a,t[56]=W):W=t[56];let ee;t[57]===W?ee=t[58]:(ee=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:W}),t[57]=W,t[58]=ee),t[59]!==U||t[60]!==ee?(O=(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:[U,ee]})}),t[59]=U,t[60]=ee,t[61]=O):O=t[61];let G=m&&`pr-9`;t[62]===G?C=t[63]:(C=Bn(`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`,G),t[62]=G,t[63]=C),t[64]!==n||t[65]!==F||t[66]!==B||t[67]!==c||t[68]!==R||t[69]!==s||t[70]!==I?(w=F&&n?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(aL,{scope:F.scope,name:F.name,showAddPropertyButton:s,onAddProperty:c,problemCount:I.length,problemMessages:R})}):B?null:s&&(0,Z.jsx)(Wc,{onAddProperty:c,problemCount:I.length,problemMessages:R}),t[64]=n,t[65]=F,t[66]=B,t[67]=c,t[68]=R,t[69]=s,t[70]=I,t[71]=w):w=t[71],t[72]!==n||t[73]!==r||t[74]!==g?(T=g&&iL()&&r!=null&&n!==null?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(sL,{provider:r,docName:n})}):null,t[72]=n,t[73]=r,t[74]=g,t[75]=T):T=t[75],b=ur,y=X,k=``,A=`ghost`,j=`icon`,M=d,N=!u,P=`doc-panel`,S=h(u?{id:`u7H-Wn`,values:{panelShortcutLabel:x}}:{id:`2hpdRq`,values:{panelShortcutLabel:x}}),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,t[21]=E,t[22]=D,t[23]=O,t[24]=k,t[25]=A,t[26]=j,t[27]=M,t[28]=N,t[29]=P}else 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=t[22],O=t[23],k=t[24],A=t[25],j=t[26],M=t[27],N=t[28],P=t[29];let F;t[76]===u?F=t[77]:(F=(0,Z.jsx)(sr,{children:u?(0,Z.jsx)(Xd,{}):(0,Z.jsx)(Yd,{})}),t[76]=u,t[77]=F);let I;t[78]!==y||t[79]!==S||t[80]!==F||t[81]!==k||t[82]!==A||t[83]!==j||t[84]!==M||t[85]!==N||t[86]!==P?(I=(0,Z.jsx)(y,{"data-doc-panel-toggle":k,variant:A,size:j,onClick:M,"aria-expanded":N,"aria-controls":P,"aria-label":S,asChild:!0,children:F}),t[78]=y,t[79]=S,t[80]=F,t[81]=k,t[82]=A,t[83]=j,t[84]=M,t[85]=N,t[86]=P,t[87]=I):I=t[87];let L;t[88]!==h||t[89]!==u?(L=h(u?{id:`6iDEWA`}:{id:`170Js2`}),t[88]=h,t[89]=u,t[90]=L):L=t[90];let R;t[91]===L?R=t[92]:(R=(0,Z.jsx)(`span`,{children:L}),t[91]=L,t[92]=R);let z;t[93]===x?z=t[94]:(z=(0,Z.jsx)(ne,{"aria-label":x,children:v}),t[93]=x,t[94]=z);let B;t[95]!==R||t[96]!==z?(B=(0,Z.jsxs)(cr,{side:`bottom`,children:[R,` `,z]}),t[95]=R,t[96]=z,t[97]=B):B=t[97];let V;t[98]!==b||t[99]!==I||t[100]!==B?(V=(0,Z.jsxs)(b,{children:[I,B]}),t[98]=b,t[99]=I,t[100]=B,t[101]=V):V=t[101];let H;t[102]!==C||t[103]!==w||t[104]!==T||t[105]!==V?(H=(0,Z.jsxs)(`div`,{className:C,children:[w,T,V]}),t[102]=C,t[103]=w,t[104]=T,t[105]=V,t[106]=H):H=t[106];let U;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[107]=U):U=t[107];let W;return t[108]!==E||t[109]!==D||t[110]!==O||t[111]!==H?(W=(0,Z.jsxs)(`div`,{"data-testid":E,className:D,children:[O,H,U]}),t[108]=E,t[109]=D,t[110]=O,t[111]=H,t[112]=W):W=t[112],W}function uL(e){return e.message}function dL(e,t,n){let r=Vh(e);t(r.target,{disposition:`permanent`,consumeActiveNewTab:n}),bf(r.hash)}function fL({children:e}){return e}function pL(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??fL,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)(df,{"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)(Kn,{"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)(Pv,{"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)(hd,{"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)(ef,{"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)(Cu,{"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 H;t[45]!==w||t[46]!==y||t[47]!==b||t[48]!==a||t[49]!==T?(H=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)(wy,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`OlAl5i`})]}):null,a?.onCollapseAll?(0,Z.jsxs)(y,{onSelect:a.onCollapseAll,children:[(0,Z.jsx)(Mv,{"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]=H):H=t[50];let U;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?(U=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)(Av,{"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)(ge,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`euc6Ns`})]}):null,g?(0,Z.jsxs)(y,{disabled:v,onSelect:g,children:[(0,Z.jsx)(it,{"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)(wi,{"aria-hidden":`true`}),o.label]}):null,p?(0,Z.jsxs)(y,{variant:`destructive`,disabled:v,onSelect:p,children:[(0,Z.jsx)(ff,{"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]=U):U=t[65];let W;return t[66]!==V||t[67]!==H||t[68]!==U||t[69]!==D?(W=(0,Z.jsxs)(Z.Fragment,{children:[D,V,H,U]}),t[66]=V,t[67]=H,t[68]=U,t[69]=D,t[70]=W):W=t[70],W}function mL(e){return e.replace(/\\/g,`\\\\`).replace(/\[/g,`\\[`).replace(/\]/g,`\\]`).replace(/\*/g,`\\*`)}function hL(e){let t=mL(e.path);return e.kind===`folder`?`/${t}/`:`/${t}${e.docExt??`.md`}`}function gL(e){let t=(0,$.c)(21),{parentDir:n,onSelectTemplate:r,ItemComponent:i}=e,{state:a}=Wu(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=Yb(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 _L(e,t){return e?.kind===`doc`||e?.kind===`folder-index`?Yc(t.contentDir,Xc(e.docName),t.pathSeparator):e?.kind===`folder`?Yc(t.contentDir,e.folderPath,t.pathSeparator):e?.kind===`asset`?Yc(t.contentDir,e.assetPath,t.pathSeparator):t.contentDir}function vL(e){return e?.kind===`doc`||e?.kind===`folder-index`?Xc(e.docName):e?.kind===`folder`?e.folderPath:e?.kind===`asset`?e.assetPath:``}function yL(e,t){return e===null?qc({workspace:t}):e.kind===`folder`?t?Jc({folderRelativePath:e.folderPath,workspace:t}):null:e.kind===`doc`||e.kind===`folder-index`?kc({docName:e.docName,workspace:t}):null}var bL=`open-knowledge:file-tree-menu-action-delete`,xL=`open-knowledge:file-tree-menu-action-rename`,SL=`open-knowledge:file-tree-menu-action-duplicate`,CL=`open-knowledge:file-tree-menu-action-import-template`;function wL(e,t){window.dispatchEvent(new CustomEvent(e,{detail:t}))}function TL(e,t){let n=e=>{let n=e.detail;n?.target&&t(n)};return window.addEventListener(e,n),()=>window.removeEventListener(e,n)}function EL(e){wL(bL,{target:e})}function DL(e){return TL(bL,({target:t})=>e(t))}function OL(e,t){wL(xL,{target:e,nextName:t})}function kL(e){return TL(xL,({target:t,nextName:n})=>e(t,n))}function AL(e){wL(SL,{target:e})}function jL(e){return TL(SL,({target:t})=>e(t))}function ML(e,t){wL(CL,{target:e,deleteSource:t})}function NL(e){return TL(CL,({target:t,deleteSource:n})=>e(t,n))}var PL={Group:ni,Item:$r,Separator:oi,Sub:ei,SubContent:ri,SubTrigger:ci};function FL(e,t){return e.kind!==`doc`||/\.(md|mdx)$/i.test(e.docName)?vL(e):`${e.docName}${t??`.md`}`}function IL(e){return e.kind===`asset`?null:e.kind===`folder`?$u(e.folderPath):td(e.docName)}function LL(e,t){return e.kind===`doc`?{kind:`file`,path:e.docName,docExt:t}:e.kind===`folder`?{kind:`folder`,path:e.folderPath}:null}function RL(e){let t=(0,$.c)(90),{docExt:n,target:r,onRename:i}=e,{_:a}=on(),o=Zc(),{okignoreBinding:s}=xc(),{status:c}=nl(),l=qn().states,{dispatch:u}=Tc(),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=FL(r,n),v=Yf(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:yL(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=IL(r),t[24]=r,t[25]=i);let l=i;f=c?.hasRemote===!0&&l!==null,b=LL(r,n);let u;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(u=function(e,t,n){nh(e).then(()=>Ns.success(t,{description:e})).catch(e=>{console.warn(`[EditorTabTargetMenuItems] clipboard write failed:`,e),Ns.error(n)})},t[26]=u):u=t[26],p=u;let T;t[27]!==a||t[28]!==l?(T=function(){l&&Xu({...l,hasRemote:!0,onClickWhenNoRemote:()=>Ns.error(a({id:`WyQxwa`}))},{clipboardWrite:nh,toastSuccess:VL,toastError:BL,logEvent:zL})},t[27]=a,t[28]=l,t[29]=T):T=t[29],C=T,h=function(){if(!s||!b)return;let e=Ku(s.current()),t=Yu(e,hL(b));if(t===e)return;s.patch(Nu(t));let n=x.split(`/`).pop()??x;Ns.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=tg(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?Yc(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:()=>eD({initialDir:r.folderPath}),onNewFolder:()=>eD({initialDir:r.folderPath,kind:`folder`}),templateItems:(0,Z.jsx)(gL,{parentDir:r.folderPath,onSelectTemplate:e=>eD({template:{folder:r.folderPath,name:e}}),ItemComponent:$r})}: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)(Ic,{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=>ML(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?()=>AL(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:()=>EL(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)(pL,{primitives:PL,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 zL(e){return console.log(e)}function BL(e){return Ns.error(e)}function VL(e){return Ns.success(e)}function HL(e,t){return t.trim()}function UL(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function WL(e,t){let n=HL(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function GL(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(Wf(e)){let t=s.get(Jh(e.docName,e.docExt));if(t){let n=Zf(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:Lo(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(qf(e))return{...e,path:ZL(e.path,n)};if(Xf(e)){let t=s.get(e.path);return t&&Bf(t)?{kind:`document`,docName:$h(t),docExt:Hf(t),size:e.size,modified:e.modified}:{...e,path:t??ZL(e.path,n)}}return e})}function KL(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=>Wf(e)?!i.has(e.docName)&&!tR(e.docName,n):qf(e)?!tR(e.path,n):Xf(e)?!a.has(e.path)&&!tR(e.path,n):!0)}function qL(e,t){if(e.kind!==`asset`||t.some(t=>Xf(t)&&t.path===e.path))return e;let n=eg(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function JL(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>QL(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>Wf(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=>qf(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(Wf(i)){let e=eR(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(qf(i)){let e=$L(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function YL(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function XL(e,t){let n=e.kind===`file`?Jh(e.path,e.docExt):e.path;return Yc(t.contentDir,n,t.pathSeparator)}function ZL(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 QL(e,t){return Wf(e)&&Wf(t)?e.docName===t.docName:qf(e)&&qf(t)||Xf(e)&&Xf(t)?e.path===t.path:!1}function $L(e,t,n){return e===t?n:eR(e,t,n)}function eR(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function tR(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function nR(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=UL(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)(yr,{children:(0,Z.jsx)(hr,{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)(Fp,{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)(Np,{children:(0,Z.jsxs)(Rp,{children:[m,(0,Z.jsx)(zf,{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)(vr,{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)(gr,{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)(br,{open:r,onOpenChange:i,children:w}),t[29]=i,t[30]=r,t[31]=w,t[32]=T):T=t[32],T}var rR=`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`,iR=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,aR=`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`,oR=`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 sR(e,t){return Bn(oR,e&&`font-semibold`,t&&`italic`)}function cR(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 lR(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 uR(e){return e.metaKey||e.ctrlKey}var dR=1e3,fR=new Set;function pR(e,t){return e<0||e>=t?null:e<8?String(e+1):e===t-1?`9`:null}function mR(e,t){let n=pR(e,t);if(n)return[`Meta+${n}`,`Control+${n}`].join(` `)}function hR(e,t){if(!uR(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 gR(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)(ne,{className:`px-0.5 text-[10px]`,children:r})}),t[0]=r,t[1]=i),i}function _R(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:vR,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}=rh(g),w=y.current?.width,T;t[21]!==C||t[22]!==l||t[23]!==w||t[24]!==x||t[25]!==S?(T=ic({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&&gc(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=rc({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=hc({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:Bn(`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 vR(){return!1}function yR(e){let t=(0,$.c)(97),{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=fp(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=fp(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]===r?M=t[14]:(M=(0,Z.jsx)(ti,{asChild:!0,children:r}),t[13]=r,t[14]=M);let N;t[15]!==i||t[16]!==g?(N=()=>i(g),t[15]=i,t[16]=g,t[17]=N):N=t[17];let P,F;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(hf,{"aria-hidden":`true`}),P=(0,Z.jsx)(Y,{id:`yz7wBu`}),t[18]=P,t[19]=F):(P=t[18],F=t[19]);let L;t[20]!==E||t[21]!==N?(L=(0,Z.jsxs)($r,{disabled:E,onSelect:N,children:[F,P]}),t[20]=E,t[21]=N,t[22]=L):L=t[22];let R=O.length===0,z;t[23]!==a||t[24]!==O?(z=()=>{a(O)},t[23]=a,t[24]=O,t[25]=z):z=t[25];let B,V;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(Cv,{"aria-hidden":`true`}),V=(0,Z.jsx)(Y,{id:`omXJcU`}),t[26]=B,t[27]=V):(B=t[26],V=t[27]);let H;t[28]!==R||t[29]!==z?(H=(0,Z.jsxs)($r,{disabled:R,onSelect:z,children:[B,V]}),t[28]=R,t[29]=z,t[30]=H):H=t[30];let U=A.length===0,W;t[31]!==A||t[32]!==a?(W=()=>{a(A)},t[31]=A,t[32]=a,t[33]=W):W=t[33];let ee;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(ff,{"aria-hidden":`true`}),t[34]=ee):ee=t[34];let G;t[35]===d.length?G=t[36]:(G=d.length?(0,Z.jsx)(Y,{id:`U2Kx6T`}):(0,Z.jsx)(Y,{id:`WyXG7w`}),t[35]=d.length,t[36]=G);let K;t[37]!==U||t[38]!==W||t[39]!==G?(K=(0,Z.jsxs)($r,{disabled:U,"data-testid":`editor-tab-context-close-all`,onSelect:W,children:[ee,G]}),t[37]=U,t[38]=W,t[39]=G,t[40]=K):K=t[40];let q;t[41]!==L||t[42]!==H||t[43]!==K?(q=(0,Z.jsxs)(ni,{children:[L,H,K]}),t[41]=L,t[42]=H,t[43]=K,t[44]=q):q=t[44];let te;t[45]!==s||t[46]!==m||t[47]!==_?(te=_||m?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(oi,{}),_?(0,Z.jsx)(RL,{docExt:s,target:_,onRename:()=>w(!0)}):null,m]}):null,t[45]=s,t[46]=m,t[47]=_,t[48]=te):te=t[48];let J;t[49]!==S||t[50]!==f||t[51]!==g?(J=S&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(oi,{}),(0,Z.jsxs)($r,{"data-testid":`editor-tab-context-keep-open`,onSelect:()=>f(g),children:[(0,Z.jsx)(ey,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`GH02QY`})]})]}),t[49]=S,t[50]=f,t[51]=g,t[52]=J):J=t[52];let ne;t[53]!==x||t[54]!==E||t[55]!==u||t[56]!==g||t[57]!==y?(ne=x&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(oi,{}),(0,Z.jsxs)($r,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>E?y(g):u(g),children:[(0,Z.jsx)(ey,{"aria-hidden":`true`}),E?(0,Z.jsx)(Y,{id:`SYfHmN`}):(0,Z.jsx)(Y,{id:`3pU8e-`})]})]}),t[53]=x,t[54]=E,t[55]=u,t[56]=g,t[57]=y,t[58]=ne):ne=t[58];let re;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(oi,{}),t[59]=re):re=t[59];let ie=!j,ae;t[60]!==p||t[61]!==g||t[62]!==h?(ae=()=>p(g,`left`,h),t[60]=p,t[61]=g,t[62]=h,t[63]=ae):ae=t[63];let oe,se;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(I,{"aria-hidden":`true`}),se=(0,Z.jsx)(Y,{id:`pCralD`}),t[64]=oe,t[65]=se):(oe=t[64],se=t[65]);let ce;t[66]!==ie||t[67]!==ae?(ce=(0,Z.jsxs)($r,{disabled:ie,"data-testid":`editor-tab-context-split-left`,onSelect:ae,children:[oe,se]}),t[66]=ie,t[67]=ae,t[68]=ce):ce=t[68];let le=!j,ue;t[69]!==p||t[70]!==g||t[71]!==h?(ue=()=>p(g,`right`,h),t[69]=p,t[70]=g,t[71]=h,t[72]=ue):ue=t[72];let de,fe;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Z.jsx)(Ks,{"aria-hidden":`true`}),fe=(0,Z.jsx)(Y,{id:`jeCFV7`}),t[73]=de,t[74]=fe):(de=t[73],fe=t[74]);let pe;t[75]!==le||t[76]!==ue?(pe=(0,Z.jsxs)($r,{disabled:le,"data-testid":`editor-tab-context-split-right`,onSelect:ue,children:[de,fe]}),t[75]=le,t[76]=ue,t[77]=pe):pe=t[77];let me;t[78]!==ce||t[79]!==pe?(me=(0,Z.jsxs)(ni,{children:[ce,pe]}),t[78]=ce,t[79]=pe,t[80]=me):me=t[80];let he;t[81]!==q||t[82]!==te||t[83]!==J||t[84]!==ne||t[85]!==me?(he=(0,Z.jsxs)(ai,{className:`min-w-56`,children:[q,te,J,ne,re,me]}),t[81]=q,t[82]=te,t[83]=J,t[84]=ne,t[85]=me,t[86]=he):he=t[86];let ge;t[87]!==he||t[88]!==M?(ge=(0,Z.jsxs)(si,{children:[M,he]}),t[87]=he,t[88]=M,t[89]=ge):ge=t[89];let _e;t[90]!==v||t[91]!==C||t[92]!==_?(_e=C&&_&&v?(0,Z.jsx)(nR,{currentName:v,open:!0,onOpenChange:w,onSave:e=>OL(_,e)}):null,t[90]=v,t[91]=C,t[92]=_,t[93]=_e):_e=t[93];let ve;return t[94]!==ge||t[95]!==_e?(ve=(0,Z.jsxs)(Z.Fragment,{children:[ge,_e]}),t[94]=ge,t[95]=_e,t[96]=ve):ve=t[96],ve}function bR(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}=on();if(d){let e;return t[0]===d?e=t[1]:(e=(0,Z.jsx)(gR,{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)(ey,{"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=fc(m),t[15]=m,t[16]=h);let g;t[17]===a?g=t[18]:(g=lc(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)(hf,{"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 xR(e){let t=(0,$.c)(7),{children:n,path:r}=e,{active:i}=dh();if(i)return n;let a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(sr,{asChild:!0,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Z.jsx)(cr,{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 SR(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)(pf,{"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 CR(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}=on(),m=Ik(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=sR(_,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)(SR,{hasConflict:m}),t[13]=m,t[14]=x);let S=c?`fade`:`ellipsis`,C;t[15]===c?C=t[16]:(C=Bn(`min-w-0 flex-1`,cR(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)(xR,{path:g,children:D}),t[34]=g,t[35]=D,t[36]=O):O=t[36],O}function wR(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?iR:aR,j;t[3]===A?j=t[4]:(j=Bn(rR,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)(bR,{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)(_R,{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)(yR,{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 TR(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}=on(),d=Oe(),{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=fm({enabled:C.some(jR)}),A=Fc(),j=k.status===`ready`?k.data.filter(AR):[],M=new Map(j.map(kR)),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(OR):[])])),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,B;t[19]!==d||t[20]!==h?(B=e=>d.closeTabInPane(h,e),t[19]=d,t[20]=h,t[21]=B):B=t[21];let V=B,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 ee=W,G;t[28]!==d||t[29]!==h?(G=()=>d.openNewTabInPane(h),t[28]=d,t[29]=h,t[30]=G):G=t[30];let K=G,q;t[31]!==d||t[32]!==h?(q=e=>d.pinTabInPane(h,e),t[31]=d,t[32]=h,t[33]=q):q=t[33];let te=q,J;t[34]!==d||t[35]!==h?(J=e=>d.unpinTabInPane(h,e),t[34]=d,t[35]=h,t[36]=J):J=t[36];let ne=J,re;t[37]!==d||t[38]!==h?(re=e=>d.promoteTabInPane(h,e),t[37]=d,t[38]=h,t[39]=re):re=t[39];let ie=re,ae;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(ae={id:0,text:``},t[40]=ae):ae=t[40];let[oe,se]=(0,Q.useState)(ae),ce;t[41]!==u||t[42]!==d||t[43]!==i?(ce=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}});se(e=>({id:e.id+1,text:a})),i?.(r,e)},t[41]=u,t[42]=d,t[43]=i,t[44]=ce):ce=t[44];let le=ce,{pageMeta:ue}=Eu(),[de,fe]=(0,Q.useState)(!1),pe=(0,Q.useRef)(null),me=(0,Q.useRef)(null),he=(0,Q.useRef)(!1),ge=(0,Q.useRef)(!1),_e;t[45]!==T||t[46]!==w?(_e=T??(w?cp(w):null),t[45]=T,t[46]=w,t[47]=_e):_e=t[47];let ve=_e,ye=function(e){if(s===e)return`before`;if(s===C.length&&e===C.length-1)return`after`},be,xe;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(be=()=>()=>{me.current!==null&&(window.clearTimeout(me.current),me.current=null)},xe=[],t[48]=be,t[49]=xe):(be=t[48],xe=t[49]),(0,Q.useEffect)(be,xe);let Se=typeof window<`u`&&window.okDesktop!=null,Ce;t[50]===S?Ce=t[51]:(Ce=new Set(S),t[50]=S,t[51]=Ce);let we=Ce,Te;t[52]!==ee||t[53]!==U||t[54]!==we?(Te=function(e){let t=[],n=[];for(let r of e)we.has(r)?n.push(r):t.push(r);t.length>0&&U(t);for(let e of n)ee(e)},t[52]=ee,t[53]=U,t[54]=we,t[55]=Te):Te=t[55];let Ee=Te,De;t[56]!==E||t[57]!==ve||t[58]!==d||t[59]!==O||t[60]!==D||t[61]!==S||t[62]!==_||t[63]!==f||t[64]!==h?(De=()=>{if(!O)return;let e=new Set(S),t=[..._,...S],n=function(){me.current!==null&&(window.clearTimeout(me.current),me.current=null)},r=function(e){he.current!==e&&(he.current=e)},i=function(e){ge.current!==e&&(ge.current=e,fe(e))},a=function(){r(!0),!(ge.current||me.current!==null)&&(me.current=window.setTimeout(()=>{me.current=null,he.current&&i(!0)},dR))},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:ve,r=n?t.indexOf(n):-1;s(t[((r>=0?r:0)+e+t.length)%t.length])},l=function(e){if(!uR(e)||rr())return;if(a(),As(e,`tab-new`)){e.preventDefault(),d.openNewTabInPane(h);return}if(As(e,`tab-reopen-closed`)){e.preventDefault(),f();return}if(As(e,`tab-next`)){e.preventDefault(),c(1);return}if(As(e,`tab-previous`)){e.preventDefault(),c(-1);return}let n=hR(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]=ve,t[58]=d,t[59]=O,t[60]=D,t[61]=S,t[62]=_,t[63]=f,t[64]=h,t[65]=De):De=t[65];let ke;t[66]!==E||t[67]!==ve||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?(ke=[E,ve,d.activateNewTabInPane,d.activateTabInPane,d.openNewTabInPane,O,D,S,_,f,h],t[66]=E,t[67]=ve,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]=ke):ke=t[77],(0,Q.useEffect)(De,ke);let Ae=de,je=D?E:ve,Me=(0,Q.useRef)(je),Ne;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=()=>{let e=pe.current;e&&lR(e)},t[78]=Ne):Ne=t[78],(0,Q.useLayoutEffect)(Ne);let Pe,Fe;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=()=>{let e=pe.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>lR(e));return t.observe(e),()=>t.disconnect()},Fe=[],t[79]=Pe,t[80]=Fe):(Pe=t[79],Fe=t[80]),(0,Q.useLayoutEffect)(Pe,Fe);let Ie,Le;t[81]!==h||t[82]!==je?(Ie=()=>{let e=Me.current;if(Me.current=je,je===null||je===e)return;let t=pe.current;t&&cc(t,h,je)?.scrollIntoView({block:`nearest`,inline:`nearest`})},Le=[h,je],t[81]=h,t[82]=je,t[83]=Ie,t[84]=Le):(Ie=t[83],Le=t[84]),(0,Q.useEffect)(Ie,Le);let Re=c?`pl-[calc(var(--editor-header-leading-offset,0px)+var(--editor-header-leading-width,0px)+0.5rem)]`:`pl-2`,ze=l&&`pr-[var(--editor-header-trailing-width,0px)]`,Be;t[85]!==Re||t[86]!==ze?(Be=Bn(`flex h-12 w-full min-w-0 touch-manipulation items-end overflow-hidden`,Re,ze,Se&&`[-webkit-app-region:drag]`),t[85]=Re,t[86]=ze,t[87]=Be):Be=t[87];let Ve;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=Bn(`group/tab-overflow relative flex min-w-0 flex-1 self-stretch items-end gap-px overflow-hidden`,Se&&`[-webkit-app-region:drag]`),t[88]=Ve):Ve=t[88];let He;t[89]!==oe.id||t[90]!==oe.text?(He=(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:oe.text},oe.id)}),t[89]=oe.id,t[90]=oe.text,t[91]=He):He=t[91];let Ue;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=Bn(`relative h-10 w-fit max-w-[calc(100%-1.75rem)] min-w-0 flex-none self-end`,Se&&`[-webkit-app-region:no-drag]`),t[92]=Ue):Ue=t[92];let We=DR,Ge=ER,Ke=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,qe=C.map((e,t)=>{let n=de?pR(t,C.length):null,r=O?mR(t,C.length):void 0;if(we.has(e)){let i=e===E;return(0,Z.jsx)(yR,{tabId:e,canPin:!1,openTabs:C,closeTab:ee,closeTabs:Ee,pinTab:te,pinnedTabIds:y,promoteTab:ie,splitTab:le,tabLabel:u({id:`3YvS-c`}),unpinTab:ne,children:(0,Z.jsxs)(_R,{dropIndicatorSide:ye(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:Bn(rR,i?iR:aR),onAuxClick:t=>{t.button===1&&(t.preventDefault(),ee(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:sR(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:Ot(e)?(0,Z.jsx)(Y,{id:`hgf5io`}):(0,Z.jsx)(Y,{id:`3YvS-c`})})}),n?(0,Z.jsx)(gR,{value:n}):(0,Z.jsx)(`button`,{type:`button`,"aria-label":u({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:fc(Ae||i),tabIndex:lc(i),onClick:t=>{t.stopPropagation(),ee(e)},children:(0,Z.jsx)(hf,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let i=_p(e),a=e===ve,o=y.includes(e),s=e===b;if(i.kind===`folder`){let{baseName:c,label:l,prefix:u}=tp(i.folderPath,`/`),d=`${u}${l}`;return(0,Z.jsx)(wR,{accessibleLabel:d,activateTab:L,ariaKeyShortcuts:r,dropIndicatorSide:ye(t),tabId:e,paneId:h,target:{kind:`folder`,target:i.folderPath,folderPath:i.folderPath},renameName:c,openTabs:C,closeTab:V,closeTabs:Ee,forceCloseVisible:Ae,isActive:a,isPinned:o,isPreview:s,pinTab:te,pinnedTabIds:y,promoteTab:ie,shortcutHint:n,splitTab:le,unpinTab:ne,children:(0,Z.jsx)(xR,{path:d,children:(0,Z.jsx)(`button`,{type:`button`,"aria-label":d,dir:`auto`,className:sR(a&&O,s),onClick:()=>L(e),onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),ie(e)},tabIndex:-1,children:(0,Z.jsxs)(`span`,{"data-editor-tab-title-overflow":a?`fade`:`ellipsis`,className:Bn(`min-w-0 flex-1`,cR(a)),children:[u&&(0,Z.jsx)(`span`,{className:Bn(`@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}=tp(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)(wR,{accessibleLabel:f,activateTab:L,ariaKeyShortcuts:r,dropIndicatorSide:ye(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:V,closeTabs:Ee,forceCloseVisible:Ae,isActive:a,isPinned:o,isPreview:s,pinTab:te,pinnedTabIds:y,promoteTab:ie,shortcutHint:n,splitTab:le,skillMenuItems:i.kind===`skill-file`&&m?(0,Z.jsx)(Rc,{actions:A,filePath:i.path,menuKind:`context`,skill:m}):void 0,unpinTab:ne,children:(0,Z.jsx)(xR,{path:f,children:(0,Z.jsx)(`button`,{type:`button`,"aria-label":f,dir:`auto`,className:sR(a&&O,s),onClick:()=>L(e),onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),ie(e)},tabIndex:-1,children:(0,Z.jsxs)(`span`,{"data-editor-tab-title-overflow":a?`fade`:`ellipsis`,className:Bn(`min-w-0 flex-1`,cR(a)),children:[d?(0,Z.jsx)(`span`,{className:Bn(`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=ue.get(c)?.docExt??`.md`,f=l?null:zc(c,j,d),{baseName:p,extension:m,label:g,prefix:_}=tp(c,d),v=`${_}${g}`,x=d===`.md`||d===`.mdx`,S=!gp(c)&&!np(c);return(0,Z.jsx)(wR,{accessibleLabel:v,activateTab:L,ariaKeyShortcuts:r,dropIndicatorSide:ye(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:V,closeTabs:Ee,forceCloseVisible:Ae,isActive:a,isPinned:o,isPreview:s,pinTab:te,pinnedTabIds:y,promoteTab:ie,shortcutHint:n,splitTab:le,skillMenuItems:l?(0,Z.jsx)(Uc,{actions:A,existingNames:F.get(l.scope)??fR,menuKind:`context`,skill:l}):f?(0,Z.jsx)(Rc,{actions:A,filePath:f.filePath,menuKind:`context`,skill:f.skill}):void 0,unpinTab:ne,children:(0,Z.jsx)(CR,{accessibleLabel:v,activateTab:L,baseName:p,docName:c,extension:m,hideDocExtension:x,isActive:a,isFocusedPane:O,isPreview:s,promoteTab:ie,tabId:e})},e)}),Je;t[93]!==We||t[94]!==Ge||t[95]!==Ke||t[96]!==qe?(Je=(0,Z.jsxs)(`div`,{ref:pe,"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:We,onWheel:Ge,children:[Ke,qe]}),t[93]=We,t[94]=Ge,t[95]=Ke,t[96]=qe,t[97]=Je):Je=t[97];let Ye;t[98]!==Ue||t[99]!==Je?(Ye=(0,Z.jsx)(`div`,{className:Ue,children:Je}),t[98]=Ue,t[99]=Je,t[100]=Ye):Ye=t[100];let Xe;t[101]===u?Xe=t[102]:(Xe=u({id:`3YvS-c`}),t[101]=u,t[102]=Xe);let Ze;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=Bn(`first:mb-3 mb-1.5 shrink-0`,Se&&`[-webkit-app-region:no-drag]`),t[103]=Ze):Ze=t[103];let Qe;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=(0,Z.jsx)(Mn,{"aria-hidden":`true`}),t[104]=Qe):Qe=t[104];let $e;t[105]!==K||t[106]!==Xe?($e=(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":Xe,"data-testid":`editor-new-tab-button`,className:Ze,onClick:K,children:Qe})}),t[105]=K,t[106]=Xe,t[107]=$e):$e=t[107];let et;t[108]===Symbol.for(`react.memo_cache_sentinel`)?(et=(0,Z.jsx)(cr,{children:(0,Z.jsx)(Y,{id:`3YvS-c`})}),t[108]=et):et=t[108];let tt;return t[109]===$e?tt=t[110]:(tt=(0,Z.jsxs)(ur,{children:[$e,et]}),t[109]=$e,t[110]=tt),(0,Z.jsxs)(`div`,{"data-editor-pane-tabs":h,"data-electron-drag":Se?``:void 0,className:Be,children:[(0,Z.jsxs)(`div`,{"data-editor-tab-overflow-root":``,"data-electron-drag":Se?``:void 0,className:Ve,children:[He,(0,Z.jsx)(mh,{items:[...C],strategy:fh,children:Ye}),tt]}),A.dialogs]})}function ER(e){ec(e),lR(e.currentTarget)}function DR(e){return lR(e.currentTarget)}function OR(e){return e.name}function kR(e){return[$f(e),e]}function AR(e){return!e.managed}function jR(e){let t=_p(e);return t.kind===`skill-file`||t.kind===`doc`&&gp(t.docName)}var MR=300;function NR(e){return e.activeTarget?.kind===`large-file`?null:e.activeTarget?up(e.activeTarget):null}function PR(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}=lh(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 FR(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}=lh(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=Bn(`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 IR(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}=lh(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}=lh(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=Bn(`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 LR(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 RR(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}=Oe(),[g,_]=(0,Q.useState)(!1),v=(0,Q.useRef)(null),y;t[0]===o?y=t[1]:(y=NR(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=>{Oh(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=wh(e.dataTransfer);t&&(e.preventDefault(),e.stopPropagation(),dL(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=Bn(`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)(LR,{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)(FR,{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)(FR,{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 zR(e){let t=(0,$.c)(131),{renderActivityPool:n,renderHeader:r,renderPane:i}=e,{_:a}=on(),{focusPane:o,focusedPaneId:s,moveTabToPane:c,panes:l,reorderTabsInPane:u,resizePanes:d,splitTab:f,tabSessionLoaded:p,visibleTabIdsByPane:m}=Oe(),h=eS(),g=!h&&!p&&typeof window<`u`&&window.okDesktop?.config.mode===`editor`,[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(UR),[C,w]=(0,Q.useState)(null),T=(0,Q.useRef)(null),E=(0,Q.useRef)(null),D;t[0]===l?D=t[1]:(D=l.map(HR).join(`\0`),t[0]=l,t[1]=D);let O=D,k;t[2]===l?k=t[3]:(k=Object.fromEntries(l.map(VR)),t[2]=l,t[3]=k);let A=k,j=new Set,M=new Map;for(let e of l){let t=NR(e);if(!t)continue;j.add(t);let n=x.get(e.id);n&&M.set(t,n)}let N;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(N={activationConstraint:{distance:8}},t[4]=N):N=t[4];let P;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(P={coordinateGetter:ch,keyboardCodes:dc},t[5]=P):P=t[5];let F=oh(sh(ah,N),sh(hh,P)),I=`max(100%, ${l.length*MR}px)`,L;t[6]===I?L=t[7]:(L={"--editor-workspace-min-width":I},t[6]=I,t[7]=L);let R=L,z,B;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(z=()=>()=>{T.current!==null&&cancelAnimationFrame(T.current)},B=[],t[8]=z,t[9]=B):(z=t[8],B=t[9]),(0,Q.useEffect)(z,B);let V,H;if(t[10]===_?(V=t[11],H=t[12]):(H=()=>{if(_)return document.body.setAttribute(`data-editor-tab-dragging`,``),BR},V=[_],t[10]=_,t[11]=V,t[12]=H),(0,Q.useEffect)(H,V),g){let e;t[13]===r?e=t[14]:(e=r(null),t[13]=r,t[14]=e);let n;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`div`,{"data-editor-workspace-pending":``,className:`min-h-0 flex-1 bg-background`}),t[15]=n):n=t[15];let i;return t[16]===e?i=t[17]:(i=(0,Z.jsxs)(Z.Fragment,{children:[e,n]}),t[16]=e,t[17]=i),i}let U;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(U=function(e,t){S(n=>{if(n.get(e)===t)return n;let r=new Map(n);return t?r.set(e,t):r.delete(e),r})},t[18]=U):U=t[18];let W=U,ee;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(ee=function(e,t){T.current!==null&&cancelAnimationFrame(T.current),T.current=requestAnimationFrame(()=>{T.current=null,cc(document,e,t)?.focus()})},t[19]=ee):ee=t[19];let G=ee,K;t[20]===m?K=t[21]:(K=function(e){return m.get(e.id)??[...e.openTabs,...e.newTabIds]},t[20]=m,t[21]=K);let q=K,te;t[22]!==c||t[23]!==u?(te=function(e,t,n,r){if(e.paneId!==t.id){c(e.tabId,t.id,n),G(t.id,e.tabId);return}if(!r)return;let i=r.indexOf(e.tabId);i<0||i===n||u(t.id,uh([...r],i,n),e.tabId)},t[22]=c,t[23]=u,t[24]=te):te=t[24];let J=te,ne;t[25]!==l||t[26]!==q?(ne=function(e,t){let n=e.over?.data.current,r,i;if(oc(n)){r=n.paneId;let a=l.find(e=>e.id===r);if(!a)return null;let o=q(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(ac(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=q(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[25]=l,t[26]=q,t[27]=ne):ne=t[27];let re=ne,ie;t[28]===re?ie=t[29]:(ie=function(e){let t=e.active.data.current,n=oc(t)?re(e,t):null,r=n?{index:n.indicatorIndex,paneId:n.pane.id}:null;b(e=>e?.paneId===r?.paneId&&e?.index===r?.index?e:r)},t[28]=re,t[29]=ie);let ae=ie,oe;t[30]===o?oe=t[31]:(oe=function(e){let t=e.active.data.current;oc(t)&&(b(null),v(t),o(t.paneId))},t[30]=o,t[31]=oe);let se=oe,ce;t[32]!==J||t[33]!==re||t[34]!==f?(ce=function(e){let t=e.active.data.current,n=e.over?.data.current,r=oc(t)?re(e,t):null;if(b(null),v(null),oc(t)){if(r){J(t,r.pane,r.targetIndex,r.targetOrder);return}if(ac(n)&&n.kind===`pane-edge`){if(!t.splittable)return;let e=f(t.tabId,n.paneId,n.side);e&&G(e,t.tabId);return}}},t[32]=J,t[33]=re,t[34]=f,t[35]=ce):ce=t[35];let le=ce,ue;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(ue=function(e){E.current?.style.setProperty(`transform`,`translateX(-${e.currentTarget.scrollLeft}px)`)},t[36]=ue):ue=t[36];let de=ue,fe;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(fe=function(e){(E.current?.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[37]=fe):fe=t[37];let pe=fe,me;t[38]!==a||t[39]!==l?(me=function(e){let t=l.findIndex(t=>t.id===e);return a(t<0?{id:`n2XqGH`}:{id:`fo6CCk`,values:{0:t+1}})},t[38]=a,t[39]=l,t[40]=me):me=t[40];let he=me,ge;t[41]!==a||t[42]!==he?(ge=function(e){return oc(e)?he(e.paneId):ac(e)?e.kind===`pane-edge`?e.side===`left`?a({id:`9Ii3uK`,values:{0:he(e.paneId)}}):a({id:`jp6I-2`,values:{0:he(e.paneId)}}):he(e.paneId):null},t[41]=a,t[42]=he,t[43]=ge):ge=t[43];let _e=ge,ve;t[44]!==l||t[45]!==d?(ve=(e,t)=>{t.isUserInteraction&&d(new Map(l.map(t=>[t.id,e[`editor-pane:${t.id}`]??t.size])))},t[44]=l,t[45]=d,t[46]=ve):ve=t[46];let ye;t[47]!==_||t[48]!==s||t[49]!==he||t[50]!==l||t[51]!==i?(ye=l.map((e,t)=>(0,Z.jsxs)(Q.Fragment,{children:[t>0?(0,Z.jsx)(vk,{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)(IR,{drag:_,leftPaneId:l[t-1]?.id??e.id,rightPaneId:e.id})}):null,(0,Z.jsx)(_k,{id:`editor-pane:${e.id}`,defaultSize:`${e.size}%`,minSize:`${MR}px`,children:(0,Z.jsx)(RR,{drag:_,isFocused:e.id===s,label:he(e.id),onActivityMount:W,pane:e,renderPane:i,showOuterLeftDropTarget:t===0,showOuterRightDropTarget:t===l.length-1})})]},e.id)),t[47]=_,t[48]=s,t[49]=he,t[50]=l,t[51]=i,t[52]=ye):ye=t[52];let be;t[53]!==O||t[54]!==A||t[55]!==ve||t[56]!==ye?(be=(0,Z.jsx)(gk,{id:`editor-workspace-panes`,orientation:`horizontal`,defaultLayout:A,onLayoutChange:pe,onLayoutChanged:ve,children:ye},O),t[53]=O,t[54]=A,t[55]=ve,t[56]=ye,t[57]=be):be=t[57];let xe=be,Se;if(t[58]!==y||t[59]!==s||t[60]!==l||t[61]!==q){let e;t[63]!==y||t[64]!==s||t[65]!==l.length||t[66]!==q?(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)(PR,{paneId:e.id,index:q(e).length,isFocused:e.id===s,size:e.size,children:(0,Z.jsx)(TR,{dropIndicatorIndex:y?.paneId===e.id?y.index:null,paneId:e.id,onSplitComplete:G,reserveLeadingChrome:t===0,reserveTrailingChrome:t===l.length-1})})]},e.id),t[63]=y,t[64]=s,t[65]=l.length,t[66]=q,t[67]=e):e=t[67],Se=l.map(e),t[58]=y,t[59]=s,t[60]=l,t[61]=q,t[62]=Se}else Se=t[62];let Ce;t[68]!==R||t[69]!==Se?(Ce=(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:E,"data-editor-header-tab-canvas":``,className:`flex h-full min-w-(--editor-workspace-min-width)`,style:R,children:Se})}),t[68]=R,t[69]=Se,t[70]=Ce):Ce=t[70];let we=Ce;if(h){let e;t[71]!==s||t[72]!==l?(e=l.find(e=>e.id===s)??l[0],t[71]=s,t[72]=l,t[73]=e):e=t[73];let a=e,o;t[74]===r?o=t[75]:(o=r(null),t[74]=r,t[75]=o);let c;t[76]!==he||t[77]!==a||t[78]!==i?(c=a?(0,Z.jsx)(RR,{drag:null,isFocused:!0,label:he(a.id),onActivityMount:W,pane:a,renderPane:i,showDropTargets:!1}):null,t[76]=he,t[77]=a,t[78]=i,t[79]=c):c=t[79];let u;return t[80]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`div`,{ref:w,"data-editor-activity-parking":``,className:`hidden`,inert:!0}),t[80]=u):u=t[80],(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,C===null?null:n?.({activityHosts:M,parkingHost:C,visibleDocNames:j})]})]})}let Te=ph,Ee=nc,De;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(De=()=>{b(null),v(null)},t[81]=De):De=t[81];let ke;t[82]===a?ke=t[83]:(ke=a({id:`GrBgX_`}),t[82]=a,t[83]=ke);let Ae;t[84]===ke?Ae=t[85]:(Ae={draggable:ke},t[84]=ke,t[85]=Ae);let je;t[86]!==a||t[87]!==he?(je=e=>{let{active:t}=e,n=t.data.current;return oc(n)?a({id:`_PnPuw`,values:{0:n.label,1:he(n.paneId)}}):void 0},t[86]=a,t[87]=he,t[88]=je):je=t[88];let Me,Ne;t[89]!==a||t[90]!==_e?(Me=e=>{let{active:t,over:n}=e,r=t.data.current;if(!oc(r)||!n)return;let i=_e(n.data.current);return i?a({id:`Jnz9AY`,values:{0:r.label,destination:i}}):void 0},Ne=e=>{let{active:t,over:n}=e,r=t.data.current;if(!oc(r))return;let i=n?_e(n.data.current):null;return a(i?{id:`gqk-3R`,values:{0:r.label,destination:i}}:{id:`Gu9pRm`,values:{0:r.label}})},t[89]=a,t[90]=_e,t[91]=Me,t[92]=Ne):(Me=t[91],Ne=t[92]);let Pe;t[93]===a?Pe=t[94]:(Pe=e=>{let{active:t}=e,n=t.data.current;return oc(n)?a({id:`URN-cv`,values:{0:n.label}}):void 0},t[93]=a,t[94]=Pe);let Fe;t[95]!==je||t[96]!==Me||t[97]!==Ne||t[98]!==Pe?(Fe={onDragStart:je,onDragOver:Me,onDragEnd:Ne,onDragCancel:Pe},t[95]=je,t[96]=Me,t[97]=Ne,t[98]=Pe,t[99]=Fe):Fe=t[99];let Ie;t[100]!==Ae||t[101]!==Fe?(Ie={container:typeof document<`u`?document.body:void 0,screenReaderInstructions:Ae,announcements:Fe},t[100]=Ae,t[101]=Fe,t[102]=Ie):Ie=t[102];let Le;t[103]!==we||t[104]!==r?(Le=r(we),t[103]=we,t[104]=r,t[105]=Le):Le=t[105];let Re;t[106]!==R||t[107]!==xe?(Re=(0,Z.jsx)(`div`,{"data-editor-workspace-canvas":``,className:`h-full min-w-[var(--editor-workspace-min-width)]`,style:R,children:xe}),t[106]=R,t[107]=xe,t[108]=Re):Re=t[108];let ze;t[109]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,Z.jsx)(`div`,{ref:w,"data-editor-activity-parking":``,className:`hidden`,inert:!0}),t[109]=ze):ze=t[109];let Be=C===null?null:n?.({activityHosts:M,parkingHost:C,visibleDocNames:j}),Ve;t[110]!==de||t[111]!==Re||t[112]!==ze||t[113]!==Be?(Ve=(0,Z.jsxs)(`div`,{"data-editor-workspace":``,className:`relative min-h-0 flex-1 overflow-x-auto overflow-y-hidden`,onScroll:de,children:[Re,ze,Be]}),t[110]=de,t[111]=Re,t[112]=ze,t[113]=Be,t[114]=Ve):Ve=t[114];let He;t[115]===_?He=t[116]:(He=_?(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:_.label})}):null,t[115]=_,t[116]=He);let Ue;t[117]===He?Ue=t[118]:(Ue=(0,Z.jsx)(ih,{dropAnimation:null,children:He}),t[117]=He,t[118]=Ue);let We;return t[119]!==Te||t[120]!==le||t[121]!==se||t[122]!==F||t[123]!==Ee||t[124]!==De||t[125]!==Ie||t[126]!==Le||t[127]!==Ve||t[128]!==Ue||t[129]!==ae?(We=(0,Z.jsxs)(Te,{sensors:F,autoScroll:!1,collisionDetection:Ee,onDragStart:se,onDragMove:ae,onDragOver:ae,onDragEnd:le,onDragCancel:De,accessibility:Ie,children:[Le,Ve,Ue]}),t[119]=Te,t[120]=le,t[121]=se,t[122]=F,t[123]=Ee,t[124]=De,t[125]=Ie,t[126]=Le,t[127]=Ve,t[128]=Ue,t[129]=ae,t[130]=We):We=t[130],We}function BR(){return document.body.removeAttribute(`data-editor-tab-dragging`)}function VR(e){return[`editor-pane:${e.id}`,e.size]}function HR(e){return e.id}function UR(){return new Map}function WR(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}var GR=`doc-panel`,KR=`agent-panel`,qR=`terminal-column`,JR=`agents-column`,YR=[GR,KR,qR,JR],XR=new Set(YR);function ZR(e){return XR.has(e)}function QR(e){let t=null,n=0;for(let r of e)if(!ZR(r)&&(t=r,n+=1,n>1))return null;return n===1?t:null}function $R(e){let t=[...e],n=QR(t),r=YR.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 ez(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 tz=Yo,nz=tz+1,rz=.05;function iz({otherRailWidthPx:e,agentsMinimumWidthPx:t}){let n=e+t+tz;return Math.ceil(n/(1-rz))}function az({workspaceWidthPx:e,otherRailWidthPx:t,agentsMinimumWidthPx:n,previous:r,current:i,trigger:a}){if(!i.terminalRightVisible||!i.agentsVisible||e>=iz({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 oz=`ok-terminal-height-v1`,sz=1/3,cz=.5;function lz(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*cz))}function uz(e){let t=Number.isFinite(e)?e:0;return t<=0?240:Math.round(t*sz)}function dz(e,t){let n=lz(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(uz(t),n)}function fz(){return typeof window>`u`?0:window.innerHeight}function pz(e,t){return dz(e,t??fz())}function mz(e,t){try{let n=e??localStorage,r=t??fz(),i=n.getItem(oz);if(i==null)return dz(uz(r),r);let a=Number.parseInt(i,10);return dz(Number.isFinite(a)?a:uz(r),r)}catch{return 240}}function hz(e,t,n){try{let r=t??localStorage,i=n??fz();r.setItem(oz,String(dz(e,i)))}catch{}}function gz(){try{return typeof localStorage>`u`?240:mz()}catch{return 240}}var _z=`terminal-dock-panel`;function vz(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}=Dn(),u=NE(),d=c===`bottom`&&i,[f,p]=(0,Q.useState)(!d),m=rg(l).background,[h]=(0,Q.useState)(yz),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(()=>{hz(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=pz(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)(_k,{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)(vk,{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)(_k,{id:_z,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:Bn(`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)(gk,{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 yz(){return gz()}function bz(e){let t=(0,$.c)(20),{edge:n,onReveal:r,className:i}=e,{_:a}=on(),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=Bn(`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)(Bl,{"aria-hidden":`true`}):(0,Z.jsx)(Ul,{"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)(sr,{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)(cr,{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 xz=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-DgOXZQPM.js`),__vite__mapDeps([78,1,45,12,13,14,27,16,17,18,28,29,30,26,24,25,31,22,34,35,36,20,79,2,80,81,11,82,83,84,85,86,87,88,89,90,6,3,7,8,9,10,91,74,92,93,94,95,96,4,97,54,19,21,40,98,39,99,100,101,41,42,66,67,68,69,102,49,71,103,104,46,105,33,65,70,72,73,106,107,108,37,23,109,110,43,47,111,112,113,114,115,116,117,118,119,120,121]),import.meta.url)).ActivityModeContent})),Sz=/^Could not find Group with id "/;function Cz(e,t){t instanceof Error&&Sz.test(t.message)||console.warn(JSON.stringify({event:e,error:t instanceof Error?t.message:String(t)}))}var wz=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillEditBanner:e}=await import(`./SkillEditBanner-BAS_3XLj.js`);return{SkillEditBanner:e}},__vite__mapDeps([186,12,1,13,14,149,22,24,187,25,26,69,6,2,3,7,8,9,10,11]),import.meta.url)).SkillEditBanner})),Tz=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./LintConfigEditor-Qiz8julD.js`),__vite__mapDeps([188,12,1,13,14,24,189,80,81,11,6,2,3,7,8,9,10,91,45,74,92,18,93,94,95,96,97,35,36,16,17,20,54,28,29,34,25,26,19,22,21,40,98,53,55,30,169,86,170,67,173,102,156,15,23,39,123,140,100,64,105,108,43,147,47,128,157,31,158,49,190]),import.meta.url)).LintConfigEditor})),Ez=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./SchemaConfigEditor-D6hcCq89.js`),__vite__mapDeps([191,1,12,13,14,97,35,36,16,17,18,20,54,28,29,34,24,25,26,19,22,21,40,98,123,100,30,165,192,107,42,92,189,80,81,11,6,2,3,7,8,9,10,91,45,74,93,94,95,96,53,55,169,86,170,67,173,102,154,43,47,157,31,158,190]),import.meta.url)).SchemaConfigEditor}));function Dz(){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 Oz(e){let t=(0,$.c)(17),{docName:n,provider:r,isSourceMode:i,onModeChange:a,isPanelCollapsed:o,onTogglePanel:s,reserveRightGutter:c}=e,{requestAddProperty:l}=kl(),u=cA(r),{data:d}=zm(n),f=Nl(i?null:r,d?.effective??null),p;t[0]===f?p=t[1]:(p=Ol(f),t[0]=f,t[1]=p);let{missing:m}=p;if(Ik(n)===`conflict`)return null;let h=iL()?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)(lL,{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 kz=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./TimelineDiffPane-CPn64osU.js`),__vite__mapDeps([193,1,2,194,6,3,7,8,9,10,11,79,80,81,82,83,84,85,86,87,88,89,90,36,91,45,74,14,24,13,92,18,93,94,95,96,12,4,97,35,16,17,20,54,28,29,34,25,26,19,22,21,40,98,39,27,30,31,99,100,101,41,42,66,67,68,69,102,49,71,103,104,46,105,33,65,70,72,73,106,107,108,37,23,109,110,43,47,111,112,113,195,53,55,196,114,121,77,118]),import.meta.url)).TimelineDiffPane})),Az=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./AgentDiffPane-DxMmxvZ_.js`),__vite__mapDeps([197,1,2,194,6,3,7,8,9,10,11,79,80,81,82,83,84,85,86,87,88,89,90,36,91,45,74,14,24,13,92,18,93,94,95,96,12,4,97,35,16,17,20,54,28,29,34,25,26,19,22,21,40,98,39,27,30,31,99,100,101,41,42,66,67,68,69,102,49,71,103,104,46,105,33,65,70,72,73,106,107,108,37,23,109,110,43,47,111,112,113,195,53,55,196,115,116,117,121,77,119,120]),import.meta.url)).AgentDiffPane})),jz=300,Mz=`${jz}px`,Nz=`600px`;function Pz(e){return e}function Fz(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(Lz,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Iz,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(bp,{name:`editor-area`,children:(0,Z.jsxs)(jl,{children:[n,r]})}),t[3]=n,t[4]=i),i}function Iz(){let e=(0,$.c)(6),t=bs(),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)(ak,{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 Lz(e){let t=(0,$.c)(346),{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?Pz:g,{_:x}=on(),{activeDocName:S,activeProvider:C,activeTarget:w,activeNewTabId:T,skillsSidebar:D,recycleDocument:O,docPanelMode:k,docPanelAgentId:A,docPanelExpandSignal:j}=Oe(),{openDocumentTransition:M}=bt(),N=Pk(C,S),P=Lk(S,n===`source`?`source`:`wysiwyg`),[F,I]=(0,Q.useState)(!1),L,R;t[0]!==C||t[1]!==F?(L=()=>{C!=null&&!F&&I(!0)},R=[C,F],t[0]=C,t[1]=F,t[2]=L,t[3]=R):(L=t[2],R=t[3]),(0,Q.useEffect)(L,R);let z=(0,Q.useDeferredValue)(S),B=n===`source`,H=w?.kind===`missing`,U=!!S&&w?.kind!==`folder`,W;t[4]!==x||t[5]!==H?(W=H?x({id:`K-a33w`}):void 0,t[4]=x,t[5]=H,t[6]=W):W=t[6];let ee=W,G=Km(),K,q;t[7]!==S||t[8]!==G?(K=()=>{G&&G.docName!==S&&qm()},q=[S,G],t[7]=S,t[8]=G,t[9]=K,t[10]=q):(K=t[9],q=t[10]),(0,Q.useEffect)(K,q);let te=Hm(),J=te?.docName??null,ne=(0,Q.useRef)(null),re;t[11]!==S||t[12]!==J||t[13]!==M?(re=()=>{if(J==null){ne.current=null;return}if(ne.current=J,J!==S){let e=Cf(J);jf(window.location.hash,e)?M(J):window.location.hash=e}},t[11]=S,t[12]=J,t[13]=M,t[14]=re):re=t[14];let ie;t[15]===J?ie=t[16]:(ie=[J],t[15]=J,t[16]=ie),(0,Q.useEffect)(re,ie);let ae,oe;t[17]!==S||t[18]!==J?(ae=()=>{if(J!=null){if(J===S){ne.current=null;return}ne.current!==J&&Wm()}},oe=[S,J],t[17]=S,t[18]=J,t[19]=ae,t[20]=oe):(ae=t[19],oe=t[20]),(0,Q.useEffect)(ae,oe);let se,ce;t[21]!==A||t[22]!==k?(se=()=>{k===`agent`&&A!==null||Wm()},ce=[k,A],t[21]=A,t[22]=k,t[23]=se,t[24]=ce):(se=t[23],ce=t[24]),(0,Q.useEffect)(se,ce);let le=(0,Q.useSyncExternalStore)(ud.subscribe,ud.getSnapshot,ud.getSnapshot),ue;t[25]!==w||t[26]!==le?(ue=md(w,le),t[25]=w,t[26]=le,t[27]=ue):ue=t[27];let de=ue,[fe]=(0,Q.useState)(Vz),pe=fe!==null,me;t[28]===fe?me=t[29]:(me=()=>Zk(fe,window.innerWidth,`right`),t[28]=fe,t[29]=me);let[he,ge]=(0,Q.useState)(me),_e=(0,Q.useRef)(he),ve,ye;t[30]===he?(ve=t[31],ye=t[32]):(ve=()=>{_e.current=he},ye=[he],t[30]=he,t[31]=ve,t[32]=ye),(0,Q.useEffect)(ve,ye);let be=NE(),xe=NE(),Se=NE(),Ce;t[33]===he?Ce=t[34]:(Ce=()=>oA(`right`,he,iA())===`collapsed`,t[33]=he,t[34]=Ce);let[we]=(0,Q.useState)(Ce),[Te,Ee]=(0,Q.useState)(we),De=(0,Q.useRef)(Te),[ke,Ae]=(0,Q.useState)(null),[je,Me]=(0,Q.useState)(null),[Ne,Pe]=(0,Q.useState)(null),[Fe,Ie]=(0,Q.useState)(null),[Le,Re]=(0,Q.useState)(null),[ze,Be]=(0,Q.useState)(null),Ve=y,He=_&&v===`right`,Ue=He||Ve,We=!y&&h!=null,Ge=v===`right`?je:Le,Ke=_&&Ge!=null,qe=y&&ke!=null,Je,Ye;t[35]!==ke||t[36]!==qe||t[37]!==m||t[38]!==Ge||t[39]!==ze||t[40]!==Ke?(Je=()=>{m?.({terminal:{container:Ge,isShowing:Ke},agents:{container:ke,isShowing:qe},editorRegion:ze})},Ye=[m,Ge,Ke,ke,qe,ze],t[35]=ke,t[36]=qe,t[37]=m,t[38]=Ge,t[39]=ze,t[40]=Ke,t[41]=Je,t[42]=Ye):(Je=t[41],Ye=t[42]),(0,Q.useEffect)(Je,Ye);let Xe,Qe;t[43]===Te?(Xe=t[44],Qe=t[45]):(Xe=()=>{De.current=Te},Qe=[Te],t[43]=Te,t[44]=Xe,t[45]=Qe),(0,Q.useEffect)(Xe,Qe);let[$e,et]=(0,Q.useState)(!1),nt=(0,Q.useRef)(!1),[rt]=(0,Q.useState)(Bz),it=(0,Q.useRef)(rt),ot=(0,Q.useRef)(null),st;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(st=function(e){ot.current!=null&&clearTimeout(ot.current),ot.current=setTimeout(()=>{Kk(e),ot.current=null},100)},t[46]=st):st=t[46];let ct=st,[lt]=(0,Q.useState)(zz),ut=(0,Q.useRef)(lt),[dt,ft]=(0,Q.useState)(!1),pt=(0,Q.useRef)(!1),mt=(0,Q.useRef)(null),ht;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(ht=function(e){mt.current!=null&&clearTimeout(mt.current),mt.current=setTimeout(()=>{Vk(e),mt.current=null},100)},t[47]=ht):ht=t[47];let gt=ht,_t;t[48]===l?_t=t[49]:(_t=()=>Math.max(l??mo,nz),t[48]=l,t[49]=_t);let[vt]=(0,Q.useState)(_t),yt=Math.max(l??vt,nz),xt=(0,Q.useRef)(vt),[St,Ct]=(0,Q.useState)(!1),wt=(0,Q.useRef)(!1),Tt=(0,Q.useRef)(null),Et;t[50]===d?Et=t[51]:(Et=function(e){Tt.current!=null&&clearTimeout(Tt.current),Tt.current=setTimeout(()=>{d?.(e),Tt.current=null},100)},t[50]=d,t[51]=Et);let Dt=Et,kt,At;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(kt=()=>()=>{ot.current!=null&&clearTimeout(ot.current),mt.current!=null&&clearTimeout(mt.current),Tt.current!=null&&clearTimeout(Tt.current)},At=[],t[52]=kt,t[53]=At):(kt=t[52],At=t[53]),(0,Q.useEffect)(kt,At);let[jt,Mt]=(0,Q.useState)(null),Nt=(0,Q.useRef)(null),Pt,Ft;t[54]!==Fe||t[55]!==Ne?(Pt=()=>{if(Ne==null||Fe==null)return;let e=()=>{Ne.style.setProperty(`--editor-header-tabs-width`,`${Fe.getBoundingClientRect().width}px`)};if(e(),typeof ResizeObserver>`u`)return;let t=new ResizeObserver(e);return t.observe(Fe),()=>t.disconnect()},Ft=[Ne,Fe],t[54]=Fe,t[55]=Ne,t[56]=Pt,t[57]=Ft):(Pt=t[56],Ft=t[57]),(0,Q.useLayoutEffect)(Pt,Ft);let It=OE(),Lt;t[58]!==xe||t[59]!==be||t[60]!==Se?(Lt=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=Nt.current;return e!=null&&e.offsetWidth>0?e.offsetWidth:null},t[58]=xe,t[59]=be,t[60]=Se,t[61]=Lt):Lt=t[61];let Rt=Lt,zt;t[62]!==It||t[63]!==be||t[64]!==Rt?(zt=function(){let e=It.current;if(e==null)return null;try{let t=Rt();if(t==null)return null;let n=e.getLayout();if(!(`doc-panel`in n||`agent-panel`in n))return{workspaceWidthPx:t,otherRailWidthPx:0};let r=be.current?.getSize().inPixels,i=r!=null&&r>0?r:it.current;return{workspaceWidthPx:t,otherRailWidthPx:Math.max(i,jz)}}catch(e){return Cz(`resolve-admission-metrics-failed`,e),null}},t[62]=It,t[63]=be,t[64]=Rt,t[65]=zt):zt=t[65];let Bt=zt,Vt;t[66]!==y||t[67]!==He?(Vt={terminalRightVisible:He,agentsVisible:y},t[66]=y,t[67]=He,t[68]=Vt):Vt=t[68];let Ht=Vt,Ut=(0,Q.useRef)(Ht),Wt=(0,Q.useRef)(Ht),Gt=(0,Q.useRef)(Te),Kt=(0,Q.useRef)(null),qt;t[69]!==x||t[70]!==p||t[71]!==u||t[72]!==Bt?(qt=function(e,t){let n=Bt();if(n==null)return;let r=az({...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),Ns.info(x({id:`KGF42E`}));return}u!=null&&(Kt.current=r.kind,u(!1),Ns.info(x({id:`2VSPan`})))}},t[69]=x,t[70]=p,t[71]=u,t[72]=Bt,t[73]=qt):qt=t[73];let Jt=qt,Yt=(0,Q.useRef)(Jt),Xt;t[74]!==Ht||t[75]!==Jt?(Xt=()=>{Yt.current=Jt,Ut.current=Ht},t[74]=Ht,t[75]=Jt,t[76]=Xt):Xt=t[76],(0,Q.useLayoutEffect)(Xt);let Zt,Qt;t[77]!==y||t[78]!==Te||t[79]!==He?(Zt=()=>{!y&&Kt.current===`close-agents`&&(Kt.current=null),!He&&Kt.current===`close-terminal`&&(Kt.current=null);let e=Wt.current,t=Gt.current;Wt.current={terminalRightVisible:He,agentsVisible:y},Gt.current=Te,queueMicrotask(()=>{Yt.current(t===Te?`state-change`:`resize`,e)})},Qt=[y,He,Te],t[77]=y,t[78]=Te,t[79]=He,t[80]=Zt,t[81]=Qt):(Zt=t[80],Qt=t[81]),(0,Q.useLayoutEffect)(Zt,Qt);let $t;t[82]!==It||t[83]!==Rt?($t=function(e){let t=It.current;if(t==null)return!1;let n,r;try{n=Rt(),r=t.getLayout()}catch(e){return Cz(`apply-rail-layout-read-failed`,e),!1}if(n==null)return!1;let i=$R(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[GR]=e?0:t?jz:it.current),`terminal-column`in r&&(n[qR]=Ut.current.terminalRightVisible?t?nz:xt.current:0),`agents-column`in r&&(n[JR]=Ut.current.agentsVisible?t?320:ut.current:0),n},s=o(!1);if(Object.keys(s).length===0)return!1;let c=ez({currentLayout:r,containerPx:n,pinnedPx:s,residualId:a});if(c===r&&(c=ez({currentLayout:r,containerPx:n,pinnedPx:o(!0),residualId:a})),c===r)return!0;try{t.setLayout(c)}catch(e){return Cz(`apply-rail-layout-write-failed`,e),!1}return!0},t[82]=It,t[83]=Rt,t[84]=$t):$t=t[84];let en=$t,tn;t[85]!==It||t[86]!==Rt?(tn=function(e,t,n){t||n<=0||queueMicrotask(()=>{let t=It.current;if(t==null)return;let n,r;try{n=t.getLayout(),r=Rt()}catch(e){Cz(`reclaim-hidden-rail-read-failed`,e);return}if(r==null||!(e in n)||n[e]===0)return;let i=QR(Object.keys(n));if(i==null)return;let a=ez({currentLayout:n,containerPx:r,pinnedPx:{[e]:0},residualId:i});if(a!==n)try{t.setLayout(a)}catch(e){Cz(`reclaim-hidden-rail-write-failed`,e)}})},t[85]=It,t[86]=Rt,t[87]=tn):tn=t[87];let nn=tn,rn;t[88]===en?rn=t[89]:(rn=function(e){nt.current||wt.current||pt.current||(De.current=e,en(e))},t[88]=en,t[89]=rn);let an=rn,sn=(0,Q.useRef)(an),cn;t[90]===an?cn=t[91]:(cn=()=>{sn.current=an},t[90]=an,t[91]=cn),(0,Q.useEffect)(cn);let ln=(0,Q.useRef)(null),un;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(un=function(e,t,n,r){ln.current?.(),t(!0),n.current=!0;let i=function(){window.removeEventListener(`pointerup`,a),window.removeEventListener(`pointercancel`,o),ln.current=null,t(!1),n.current=!1};function a(t){t.pointerId===e&&(i(),r?.())}function o(t){t.pointerId===e&&(i(),sn.current(De.current))}ln.current=i,window.addEventListener(`pointerup`,a),window.addEventListener(`pointercancel`,o)},t[92]=un):un=t[92];let dn=un,fn,pn;t[93]===Symbol.for(`react.memo_cache_sentinel`)?(fn=()=>()=>ln.current?.(),pn=[],t[93]=fn,t[94]=pn):(fn=t[93],pn=t[94]),(0,Q.useEffect)(fn,pn);let mn;t[95]===en?mn=t[96]:(mn=function(){return nt.current||wt.current||pt.current?!0:en(De.current)},t[95]=en,t[96]=mn);let hn=mn,gn;t[97]===hn?gn=t[98]:(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[97]=hn,t[98]=gn);let _n;t[99]!==Ve||t[100]!==He?(_n=[He,Ve],t[99]=Ve,t[100]=He,t[101]=_n):_n=t[101],(0,Q.useEffect)(gn,_n);let vn;t[102]!==an||t[103]!==be?(vn=function(){be.current!=null&&an(!1)},t[102]=an,t[103]=be,t[104]=vn):vn=t[104];let yn=vn,bn;t[105]!==an||t[106]!==Te||t[107]!==be?(bn=function(){if(be.current==null)return;let e=_e.current;Te?(sA(`right`,e,`open`),an(!1)):(sA(`right`,e,`collapsed`),an(!0))},t[105]=an,t[106]=Te,t[107]=be,t[108]=bn):bn=t[108];let xn=bn,Sn,Cn;t[109]!==an||t[110]!==fe?(Sn=()=>{let e=window.matchMedia(`(min-width: ${Yk}px)`),t=()=>{let e=Zk(fe,window.innerWidth,`right`);ge(e);let t=oA(`right`,e,iA())===`collapsed`;Ee(t),an(t)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},Cn=[fe,an],t[109]=an,t[110]=fe,t[111]=Sn,t[112]=Cn):(Sn=t[111],Cn=t[112]),(0,Q.useEffect)(Sn,Cn);let wn,Tn;t[113]!==jt||t[114]!==pe?(wn=()=>{if(jt==null||pe)return;let e=new ResizeObserver(()=>{sn.current(De.current),Yt.current(`resize`,Ut.current)});return e.observe(jt),()=>e.disconnect()},Tn=[jt,pe],t[113]=jt,t[114]=pe,t[115]=wn,t[116]=Tn):(wn=t[115],Tn=t[116]),(0,Q.useEffect)(wn,Tn);let En,Dn;t[117]!==yn||t[118]!==a?(En=()=>{let e=e=>{a(e),yn()},t=at();return t&&e(t),V(t=>{at(),e(t)})},Dn=[a,yn],t[117]=yn,t[118]=a,t[119]=En,t[120]=Dn):(En=t[119],Dn=t[120]),(0,Q.useEffect)(En,Dn);let On,kn;t[121]!==j||t[122]!==yn?(On=()=>{j!==0&&yn()},kn=[j,yn],t[121]=j,t[122]=yn,t[123]=On,t[124]=kn):(On=t[123],kn=t[124]),(0,Q.useEffect)(On,kn);let An=`${He}:${Ve}`,jn=(0,Q.useRef)(An),Mn,Nn;t[125]!==Te||t[126]!==An?(Mn=()=>{if(jn.current===An)return;jn.current=An;let e=Te;queueMicrotask(()=>{sn.current(e)})},Nn=[An,Te],t[125]=Te,t[126]=An,t[127]=Mn,t[128]=Nn):(Mn=t[127],Nn=t[128]),(0,Q.useLayoutEffect)(Mn,Nn);let Pn,In;t[129]===Te?(Pn=t[130],In=t[131]):(Pn=()=>{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()},In=[Te],t[129]=Te,t[130]=Pn,t[131]=In),(0,Q.useLayoutEffect)(Pn,In);let Ln,Rn;t[132]===Te?(Ln=t[133],Rn=t[134]):(Ln=()=>{Js({docPanelVisible:!Te}),window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!Te})},Rn=[Te],t[132]=Te,t[133]=Ln,t[134]=Rn),(0,Q.useEffect)(Ln,Rn);let zn,Bn;t[135]===xn?(zn=t[136],Bn=t[137]):(zn=()=>Fn(e=>{e===`toggle-doc-panel`&&xn()}),Bn=[xn],t[135]=xn,t[136]=zn,t[137]=Bn),(0,Q.useEffect)(zn,Bn);let Vn,Hn;t[138]===xn?(Vn=t[139],Hn=t[140]):(Vn=()=>{if(window.okDesktop!=null)return;let e=e=>{As(e,`toggle-document-panel`)&&(rr()||(e.preventDefault(),xn()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Hn=[xn],t[138]=xn,t[139]=Vn,t[140]=Hn),(0,Q.useEffect)(Vn,Hn);let Un=(0,Q.useRef)(null),[Wn,Gn]=(0,Q.useState)(null),[Kn,qn]=(0,Q.useState)(!1),[Jn,Yn]=(0,Q.useState)(null),Xn=w?.kind===`large-file`?w.docName:S,Zn,Qn;t[141]===Xn?(Zn=t[142],Qn=t[143]):(Zn=()=>{if(Xn&&Xn!==Un.current){let e=Un.current;Un.current=Xn,Gn(e)}},Qn=[Xn],t[141]=Xn,t[142]=Zn,t[143]=Qn),(0,Q.useEffect)(Zn,Qn);let $n;t[144]===M?$n=t[145]:($n=function(e){let t=Cf(e);jf(window.location.hash,t)?M(e):window.location.hash=t},t[144]=M,t[145]=$n);let er=$n,tr,nr,ir,ar;if(t[146]!==S||t[147]!==T||t[148]!==C||t[149]!==i||t[150]!==w||t[151]!==te||t[152]!==J||t[153]!==y||t[154]!==Jn||t[155]!==Kn||t[156]!==z||t[157]!==A||t[158]!==k||t[159]!==F||t[160]!==rt||t[161]!==we||t[162]!==Te||t[163]!==pe||t[164]!==B||t[165]!==er||t[166]!==a||t[167]!==be||t[168]!==Wn||t[169]!==We||t[170]!==P||t[171]!==de||t[172]!==U||t[173]!==D||t[174]!==N||t[175]!==o||t[176]!==_||t[177]!==G||t[178]!==xn){ir=Symbol.for(`react.early_return_sentinel`);bb0:if(nr=null,tr=null,w?.kind===`large-file`){let e;t[183]!==er||t[184]!==Wn?(e=Wn?{previousDocName:Wn,onNavigateBack:er}:void 0,t[183]=er,t[184]=Wn,t[185]=e):e=t[185],ar=(0,Z.jsx)(ZD,{docName:w.docName,size:w.size,limit:w.limit,backNav:e})}else if(w?.kind===`folder`){let e;t[186]!==y||t[187]!==pe||t[188]!==_?(e=QA({terminalVisible:_,agentsVisible:y,isEmbedded:pe}),t[186]=y,t[187]=pe,t[188]=_,t[189]=e):e=t[189];let n=e,r;t[190]===w.folderPath?r=t[191]:(r=(0,Z.jsx)(BD,{folderPath:w.folderPath}),t[190]=w.folderPath,t[191]=r);let i;t[192]===n?i=t[193]:(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[192]=n,t[193]=i);let a;t[194]!==r||t[195]!==i?(a=(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[r,i]}),t[194]=r,t[195]=i,t[196]=a):a=t[196];let o;if(t[197]!==w.folderPath||t[198]!==n?(o=n?(0,Z.jsx)(IA,{folderPath:w.folderPath}):null,t[197]=w.folderPath,t[198]=n,t[199]=o):o=t[199],ar=(0,Z.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[a,o]}),k===`agent`&&A!==null){let e;t[200]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(vk,{withHandle:!0}),t[200]=e):e=t[200];let n;t[201]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(_k,{id:KR,defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,className:`flex flex-col bg-muted/20`,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)(xz,{showBackButton:!1})})})]}),t[201]=n):n=t[201],nr=n}}else if(w?.kind===`asset`&&Do(w.assetPath.split(`/`).pop()??w.assetPath)){let e;t[202]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Dz,{}),t[202]=e):e=t[202];let n;t[203]===w.assetPath?n=t[204]:(n=(0,Z.jsx)(Tz,{assetPath:w.assetPath},w.assetPath),t[203]=w.assetPath,t[204]=n),ar=(0,Z.jsx)(Q.Suspense,{fallback:e,children:n})}else if(w?.kind===`asset`&&Na(w.assetPath)){let e;t[205]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Dz,{}),t[205]=e):e=t[205];let n;t[206]===w.assetPath?n=t[207]:(n=(0,Z.jsx)(Ez,{assetPath:w.assetPath},w.assetPath),t[206]=w.assetPath,t[207]=n),ar=(0,Z.jsx)(Q.Suspense,{fallback:e,children:n})}else if(w?.kind===`asset`)ar=(0,Z.jsx)(zE,{assetPath:w.assetPath,mediaKind:w.mediaKind},w.assetPath);else if(w?.kind===`skill-file`)ar=(0,Z.jsx)(gO,{scope:w.scope,name:w.name,path:w.path,host:w.host},`${w.scope}/${w.name}/${w.host??``}/${w.path}`);else if(w?.kind===`skill-preview`)ar=(0,Z.jsx)(HO,{flavor:w.flavor,source:w.source,name:w.name,subtitle:w.subtitle,level:w.level,path:w.path,reserveRightGutter:We},`${w.flavor}:${w.source}:${w.name}:${w.level??``}`);else if(de)ar=(0,Z.jsx)(tO,{nav:de},de.path);else if(!C||!S)if((typeof window<`u`?kf(window.location.hash):null)!==null)if(o!=null&&F){ar=(0,Z.jsx)(VE,{});let e;t[208]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(vk,{withHandle:!0,disabled:!0}),t[208]=e):e=t[208];let n=we?0:`${rt}px`,r;t[209]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`}),t[209]=r):r=t[209];let i;t[210]===n?i=t[211]:(i=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(_k,{id:GR,defaultSize:n,minSize:Mz,maxSize:Nz,collapsible:!0,collapsedSize:0,inert:!0,className:`flex flex-col bg-muted/20`,children:r})]}),t[210]=n,t[211]=i),nr=i}else{let e;t[212]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(VE,{}),t[212]=e):e=t[212],ir=e;break bb0}else ar=Ot(T)?(0,Z.jsx)(eO,{}):tt(T)||D?(0,Z.jsx)(JO,{sessionsDockOpen:_}):Jn!==null&&Jn===T?(0,Z.jsx)(eO,{autoStart:!0}):(0,Z.jsx)(sD,{terminalOpen:_,agentsOpen:y,onRageStreak:T?()=>Ig(()=>Yn(T)):void 0});else{let e;t[213]!==S||t[214]!==te||t[215]!==J||t[216]!==y||t[217]!==pe||t[218]!==_||t[219]!==G?(e=ZA({terminalVisible:_,agentsVisible:y,isEmbedded:pe,activeDocName:S})&&!(G&&G.docName===S)&&!(te&&J===S),t[213]=S,t[214]=te,t[215]=J,t[216]=y,t[217]=pe,t[218]=_,t[219]=G,t[220]=e):e=t[220];let n=e,r;t[221]===S?r=t[222]:(r=S?Bo(S):null,t[221]=S,t[222]=r);let o=r,s;t[223]!==S||t[224]!==te||t[225]!==J||t[226]!==Kn||t[227]!==z||t[228]!==o||t[229]!==Te||t[230]!==B||t[231]!==P||t[232]!==n||t[233]!==U||t[234]!==N||t[235]!==G||t[236]!==xn?(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)(wz,{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)(Ak,{activeDocName:S,isSourceMode:B}),WR({activeDocName:S,deferredActiveDocName:z,mountResolved:S!==null&&E(S),syncResolved:S!==null&&Ze(S)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(VE,{}),S===null?null:(0,Z.jsx)(QD,{docName:S})]}):null,G&&G.docName===S?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(kz,{view:G,isPanelCollapsed:Te,onTogglePanel:xn})}):null,te&&J===S?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(Az,{view:te,isPanelCollapsed:Te,onTogglePanel:xn})}):null]}),n?(0,Z.jsx)(IA,{docName:S,surface:B?`source`:`wysiwyg`,dismissed:Kn,onDismiss:()=>qn(!0),onReopen:()=>qn(!1)}):null]}),(0,Z.jsx)(KI,{stats:N,selectionStats:P,showStats:U,composerBadge:n&&Kn?{onReopen:()=>qn(!1)}:null})]}),t[223]=S,t[224]=te,t[225]=J,t[226]=Kn,t[227]=z,t[228]=o,t[229]=Te,t[230]=B,t[231]=P,t[232]=n,t[233]=U,t[234]=N,t[235]=G,t[236]=xn,t[237]=s):s=t[237];let c=s;ar=null,tr=c;let l=!Te,u;t[238]===Symbol.for(`react.memo_cache_sentinel`)?(u=e=>{dn(e.pointerId,et,nt)},t[238]=u):u=t[238];let d;t[239]!==Te||t[240]!==l?(d=(0,Z.jsx)(vk,{"data-doc-panel-handle":``,withHandle:l,disabled:Te,onPointerDown:u}),t[239]=Te,t[240]=l,t[241]=d):d=t[241];let f=we?0:`${rt}px`,p;t[242]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{Ee(e.asPercentage===0),e.inPixels>0&&nt.current&&(it.current=e.inPixels,ct(e.inPixels))},t[242]=p):p=t[242];let m;t[243]!==S||t[244]!==i||t[245]!==k||t[246]!==B||t[247]!==a?(m=(0,Z.jsx)(Lw,{docName:S,isSourceMode:B,activeTab:i,onActiveTabChange:a,mode:k}),t[243]=S,t[244]=i,t[245]=k,t[246]=B,t[247]=a,t[248]=m):m=t[248];let h;t[249]!==Te||t[250]!==be||t[251]!==f||t[252]!==m?(h=(0,Z.jsx)(_k,{id:GR,panelRef:be,defaultSize:f,minSize:Mz,maxSize:Nz,collapsible:!0,collapsedSize:0,onResize:p,inert:Te,className:`flex flex-col bg-muted/20`,children:m}),t[249]=Te,t[250]=be,t[251]=f,t[252]=m,t[253]=h):h=t[253];let g;t[254]!==d||t[255]!==h?(g=(0,Z.jsxs)(Z.Fragment,{children:[d,h]}),t[254]=d,t[255]=h,t[256]=g):g=t[256],nr=g}t[146]=S,t[147]=T,t[148]=C,t[149]=i,t[150]=w,t[151]=te,t[152]=J,t[153]=y,t[154]=Jn,t[155]=Kn,t[156]=z,t[157]=A,t[158]=k,t[159]=F,t[160]=rt,t[161]=we,t[162]=Te,t[163]=pe,t[164]=B,t[165]=er,t[166]=a,t[167]=be,t[168]=Wn,t[169]=We,t[170]=P,t[171]=de,t[172]=U,t[173]=D,t[174]=N,t[175]=o,t[176]=_,t[177]=G,t[178]=xn,t[179]=tr,t[180]=nr,t[181]=ir,t[182]=ar}else tr=t[179],nr=t[180],ir=t[181],ar=t[182];if(ir!==Symbol.for(`react.early_return_sentinel`))return ir;let X;t[257]===Symbol.for(`react.memo_cache_sentinel`)?(X=function(e){let{activityMount:t,pane:n}=e,r=n.activeTarget;return t||(r?.kind===`large-file`?(0,Z.jsx)(ZD,{docName:r.docName,size:r.size,limit:r.limit}):r?.kind===`folder`?(0,Z.jsx)(BD,{folderPath:r.folderPath}):r?.kind===`asset`&&Do(r.assetPath.split(`/`).pop()??r.assetPath)?(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(Dz,{}),children:(0,Z.jsx)(Tz,{assetPath:r.assetPath},r.assetPath)}):r?.kind===`asset`&&Na(r.assetPath)?(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(Dz,{}),children:(0,Z.jsx)(Ez,{assetPath:r.assetPath},r.assetPath)}):r?.kind===`asset`?(0,Z.jsx)(zE,{assetPath:r.assetPath,mediaKind:r.mediaKind},r.assetPath):r?.kind===`skill-file`?(0,Z.jsx)(gO,{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)(HO,{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??``}`):n.activeNewTabId&&tt(n.activeNewTabId)?(0,Z.jsx)(JO,{sessionsDockOpen:!1}):(0,Z.jsx)(sD,{}))},t[257]=X):X=t[257];let or=X,sr;t[258]!==tr||t[259]!==ar?(sr=function(e){return e.isFocused?tr?tr(e.activityMount):ar:or(e)},t[258]=tr,t[259]=ar,t[260]=sr):sr=t[260];let cr=sr,lr;t[261]!==S||t[262]!==z||t[263]!==ee||t[264]!==Te||t[265]!==B||t[266]!==er||t[267]!==r||t[268]!==Wn||t[269]!==O||t[270]!==We||t[271]!==de||t[272]!==xn?(lr=function(e){let{activityHosts:t,parkingHost:n,visibleDocNames:i}=e,a=de?new Set([...i].filter(e=>e!==S)):i,o=S&&a.has(S)?S:void 0,s=z&&a.has(z)?z:void 0,c=o?s??o:a.values().next().value;return c?(0,Z.jsx)(YF,{activeDocName:c,visibleDocNames:a,activityHosts:t,parkingHost:n,renderToolbar:(e,t)=>(0,Z.jsx)(Oz,{docName:e,provider:t,isSourceMode:B,onModeChange:r,isPanelCollapsed:Te,onTogglePanel:xn,reserveRightGutter:e===S&&We&&Te}),isSourceMode:B,editorPlaceholder:c===S?ee:void 0,previousDocName:Wn??void 0,onNavigateBack:er,onRecycle:O}):null},t[261]=S,t[262]=z,t[263]=ee,t[264]=Te,t[265]=B,t[266]=er,t[267]=r,t[268]=Wn,t[269]=O,t[270]=We,t[271]=de,t[272]=xn,t[273]=lr):lr=t[273];let ur=lr,dr=u??Rz,fr;t[274]!==b||t[275]!==Ne?(fr=e=>Ne==null?null:(0,Pg.createPortal)(b(e),Ne),t[274]=b,t[275]=Ne,t[276]=fr):fr=t[276];let pr;t[277]!==ur||t[278]!==cr||t[279]!==fr?(pr=(0,Z.jsx)(zR,{renderHeader:fr,renderPane:cr,renderActivityPool:ur}),t[277]=ur,t[278]=cr,t[279]=fr,t[280]=pr):pr=t[280];let mr;t[281]!==dr||t[282]!==pr||t[283]!==v||t[284]!==_?(mr=(0,Z.jsx)(vz,{placement:v,visible:_,onVisibleChange:dr,onBottomContainer:Re,onEditorRegion:Be,children:pr}),t[281]=dr,t[282]=pr,t[283]=v,t[284]=_,t[285]=mr):mr=t[285];let hr=mr,gr=He?void 0:`pointer-events-none`,_r;t[286]!==u||t[287]!==Se?(_r=e=>{dn(e.pointerId,Ct,wt,()=>{Se.current?.isCollapsed()&&u?.(!1)})},t[286]=u,t[287]=Se,t[288]=_r):_r=t[288];let vr;t[289]!==gr||t[290]!==_r||t[291]!==He?(vr=(0,Z.jsx)(vk,{withHandle:He,className:gr,onPointerDown:_r}),t[289]=gr,t[290]=_r,t[291]=He,t[292]=vr):vr=t[292];let yr=He?`${yt}px`:0,br;t[293]!==Dt||t[294]!==nn||t[295]!==He?(br=e=>{e.inPixels>0&&wt.current&&(xt.current=e.inPixels,Dt(e.inPixels)),nn(qR,He,e.inPixels)},t[293]=Dt,t[294]=nn,t[295]=He,t[296]=br):br=t[296];let xr;t[297]===Symbol.for(`react.memo_cache_sentinel`)?(xr=(0,Z.jsx)(`div`,{ref:Me,"data-terminal-panel-mount":``,className:`flex min-h-0 flex-1 flex-col overflow-hidden`}),t[297]=xr):xr=t[297];let Sr;t[298]!==yr||t[299]!==br||t[300]!==Se?(Sr=(0,Z.jsx)(_k,{id:qR,panelRef:Se,defaultSize:yr,minSize:`${nz}px`,collapsible:!0,collapsedSize:0,onResize:br,className:`flex flex-col`,children:xr}),t[298]=yr,t[299]=br,t[300]=Se,t[301]=Sr):Sr=t[301];let Cr;t[302]!==vr||t[303]!==Sr?(Cr=(0,Z.jsxs)(Z.Fragment,{children:[vr,Sr]}),t[302]=vr,t[303]=Sr,t[304]=Cr):Cr=t[304];let wr=Cr,Tr=Ve?void 0:`pointer-events-none`,Er;t[305]!==xe||t[306]!==p?(Er=e=>{dn(e.pointerId,ft,pt,()=>{xe.current?.isCollapsed()&&p?.(!1)})},t[305]=xe,t[306]=p,t[307]=Er):Er=t[307];let Dr;t[308]!==Ve||t[309]!==Tr||t[310]!==Er?(Dr=(0,Z.jsx)(vk,{withHandle:Ve,className:Tr,onPointerDown:Er}),t[308]=Ve,t[309]=Tr,t[310]=Er,t[311]=Dr):Dr=t[311];let Or=Ve?`${lt}px`:0,kr;t[312]!==Ve||t[313]!==nn?(kr=e=>{e.inPixels>0&&pt.current&&(ut.current=e.inPixels,gt(e.inPixels)),nn(JR,Ve,e.inPixels)},t[312]=Ve,t[313]=nn,t[314]=kr):kr=t[314];let Ar;t[315]===Symbol.for(`react.memo_cache_sentinel`)?(Ar=(0,Z.jsx)(`div`,{ref:Ae,"data-agents-panel-mount":``,className:`flex min-h-0 flex-1 flex-col overflow-hidden`}),t[315]=Ar):Ar=t[315];let jr;t[316]!==xe||t[317]!==Or||t[318]!==kr?(jr=(0,Z.jsx)(_k,{id:JR,panelRef:xe,defaultSize:Or,minSize:`320px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:kr,className:`flex flex-col`,children:Ar}),t[316]=xe,t[317]=Or,t[318]=kr,t[319]=jr):jr=t[319];let Mr;t[320]!==Dr||t[321]!==jr?(Mr=(0,Z.jsxs)(Z.Fragment,{children:[Dr,jr]}),t[320]=Dr,t[321]=jr,t[322]=Mr):Mr=t[322];let Nr=Mr,Pr=nr!=null&&!we||Ue,Fr;t[323]===Symbol.for(`react.memo_cache_sentinel`)?(Fr=(0,Z.jsx)(`div`,{ref:Pe,"data-editor-area-header":``,className:`relative z-30 shrink-0`}),t[323]=Fr):Fr=t[323];let Ir;t[324]===Symbol.for(`react.memo_cache_sentinel`)?(Ir=e=>{Mt(e),Nt.current=e},t[324]=Ir):Ir=t[324];let Lr=$e||St||dt||void 0,Rr=Ue?`5%`:`30%`,zr;t[325]===Pr?zr=t[326]:(zr=Pr?{}:{defaultSize:`100%`},t[325]=Pr,t[326]=zr);let Br;t[327]===hr?Br=t[328]:(Br=(0,Z.jsx)(`div`,{ref:Ie,className:`flex h-full min-w-0 flex-col`,children:hr}),t[327]=hr,t[328]=Br);let Vr;t[329]!==Rr||t[330]!==zr||t[331]!==Br?(Vr=(0,Z.jsx)(_k,{minSize:Rr,...zr,children:Br}),t[329]=Rr,t[330]=zr,t[331]=Br,t[332]=Vr):Vr=t[332];let Hr;t[333]!==Nr||t[334]!==It||t[335]!==nr||t[336]!==Vr||t[337]!==Lr||t[338]!==wr?(Hr=(0,Z.jsxs)(gk,{orientation:`horizontal`,groupRef:It,"data-dragging":Lr,children:[Vr,nr,wr,Nr]}),t[333]=Nr,t[334]=It,t[335]=nr,t[336]=Vr,t[337]=Lr,t[338]=wr,t[339]=Hr):Hr=t[339];let Ur;t[340]!==h||t[341]!==We?(Ur=We?(0,Z.jsx)(bz,{edge:`right`,onReveal:h,className:`top-2.5 right-0`}):null,t[340]=h,t[341]=We,t[342]=Ur):Ur=t[342];let Wr;return t[343]!==Hr||t[344]!==Ur?(Wr=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[Fr,(0,Z.jsxs)(`div`,{"data-editor-area-panels":``,className:`relative flex min-h-0 flex-1`,ref:Ir,children:[Hr,Ur]})]}),t[343]=Hr,t[344]=Ur,t[345]=Wr):Wr=t[345],Wr}function Rz(){}function zz(){return Hk()}function Bz(){return qk()}function Vz(){return Sa()}function Hz(){if(typeof window>`u`)return!1;let e=window.okDesktop;return e!=null&&e.menu!=null&&e.platform!==`darwin`}function Uz(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 Wz(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 Gz=1e3,Kz=!1;function qz(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function Jz(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:ig(i)?a=i:(a=void 0,Kz||(Kz=!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`&&(qz({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=Wz(i),{current:c,crossDoc:l}=a?ag(a,n,Date.now()):{current:[],crossDoc:[]},u=Yz,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>Uz(e.current,p)&&Uz(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,Gz);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 Yz(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var Xz=!1,Zz=new Set,Qz=!1;function $z(){for(let e of Zz)e()}function eB(e){Xz!==e&&(Xz=e,$z())}function tB(){return Xz}function nB(e){return Zz.add(e),()=>{Zz.delete(e)}}function rB(e){let t=[e.onUpdateRelaunching(()=>eB(!0)),e.onUpdateRelaunchFailed(()=>eB(!1))];return()=>{for(let e of t)e()}}function iB(){if(Qz||typeof window>`u`)return;let e=window.okDesktop;e&&(Qz=!0,rB(e))}function aB(){return(0,Q.useSyncExternalStore)(nB,tB,oB)}function oB(){return!1}var sB=`sync-status`;async function cB(e){try{let t=await ES(e);t.ok||Ns.error(t.message,{id:sB,duration:1/0})}catch{}}function lB(e,t){let n=(0,$.c)(6),{_:r}=on(),i=aB(),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(t),c,l;n[0]!==r||n[1]!==t||n[2]!==i||n[3]!==e?(c=()=>{if(s.current!==t&&(s.current=t,a.current=!1,o.current=!1),t)if(e===`synced`&&(a.current=!0),e===`disconnected`&&a.current){if(i){Ns.dismiss(sB);return}o.current=!0;let e=window.okDesktop;Ns.warning(r({id:`HGNCsl`}),{id:sB,duration:1/0,...e?{action:{label:r({id:`uaUc6t`}),onClick:()=>{cB(e)}}}:{}})}else o.current&&e===`synced`&&(o.current=!1,Ns.success(r({id:`GhjUB_`}),{id:sB,duration:3e3}))},l=[e,t,r,i],n[0]=r,n[1]=t,n[2]=i,n[3]=e,n[4]=c,n[5]=l):(c=n[4],l=n[5]),(0,Q.useEffect)(c,l)}var uB=4,dB=3,fB={Bird:mv,Cat:vv,Dog:Tv,Fish:jv,Mouse:ny,Rabbit:ty,Shrimp:ay,Snail:oy,Squirrel:ly,Turtle:Sy};Object.freeze(Object.keys(fB));function pB(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(fB,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var mB={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function hB(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:i}=e,{_:a}=on(),o=pB(n),s=o.kind===`animal`?fB[o.animal]:void 0,c;t[0]===n.name?c=t[1]:(c=aa(n.name),t[0]=n.name,t[1]=c);let l=c,u;t[2]===n.color?u=t[3]:(u=Go(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)(sr,{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)(cr,{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 gB(e){let t=mB[e.icon];return e.displayName||t||Ms._({id:`iEQQyu`})}function _B(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 vB(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{_:o}=on(),{activeDocName:s}=Oe(),{presence:c,agentId:l}=n,u=gB(c),d=_B(c.mode),f=!r&&d,p=c.currentDoc&&!ja(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)(Um,{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)(Um,{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)(sr,{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)(cr,{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 yB(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?Ms._({id:`9euN0m`,values:{count:n}}):Ms._({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)(In,{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)(hB,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(vB,{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)(jn,{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)(Ln,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function bB(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(hB,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(vB,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function xB(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=Oe(),{current:s,crossDoc:c}=Jz(t,r,n);if(lB(cA(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,uB),n;e[6]===s?n=e[7]:(n=s.slice(uB),e[6]=s,e[7]=n);let r=n,u=c.slice(0,dB),d;e[8]===c?d=e[9]:(d=c.slice(dB),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=>bB(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)(yB,{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=>bB(e,p,!0,m)),f.length>0?(0,Z.jsx)(yB,{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 SB(){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(CB),()=>{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 CB(e){console.warn(`[use-update-channel] bridge.state.query() failed`,e)}function wB(e){let t=(0,$.c)(6),{className:n}=e,{_:r}=on(),{channel:i}=SB();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)(Mp,{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 TB=(e,t,n)=>{if(e&&`reportValidity`in e){let r=_g(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},EB=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?TB(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>TB(t,n,e))}},DB=(e,t)=>{t.shouldUseNativeValidation&&EB(e,t);let n={};for(let r in e){let i=_g(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.ref});if(OB(t.names||Object.keys(e),r)){let e=Object.assign({},_g(n,r));cg(e,`root`,a),cg(n,r,e)}else cg(n,r,a)}return n},OB=(e,t)=>{let n=kB(t).replace(/[.*+?^${}()|\\]/g,`\\$&`);return e.some(e=>kB(e).match(`^${n}\\.\\d+`))};function kB(e){return e.replace(/[\[\]]/g,``)}function AB(){return AB=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},AB.apply(null,arguments)}function jB(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function MB(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]=dg(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function NB(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(AB({},t,{path:[].concat(r.path,t.path)}))})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=dg(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()};e.length;)r();return n}function PB(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(jB(function(){return Promise.resolve(e[n.mode===`sync`?`parse`:`parseAsync`](r,t)).then(function(e){return a.shouldUseNativeValidation&&EB({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return Array.isArray(e?.issues)}(e))return{values:{},errors:DB(MB(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(jB(function(){return Promise.resolve((n.mode===`sync`?la:us)(e,r,t)).then(function(e){return a.shouldUseNativeValidation&&EB({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return e instanceof Ka}(e))return{values:{},errors:DB(NB(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 FB=`https://openknowledge.ai/api/subscribe`;async function IB(e,t){try{let n=await fetch(FB,{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 LB(e){let t=(0,$.c)(49),{source:n,title:r,description:i,onSuccess:a,onDismiss:o,autoFocus:s,compactSubmit:c,className:l}=e,{_:u}=on(),[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=fs({email:hs({message:u({id:`Wq6Wcm`})})});_=lg,g=PB(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 IB(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=Bn(`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)(zl,{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)(hf,{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)(sg,{control:b.control,name:`email`,render:e=>{let{field:t,fieldState:n}=e;return(0,Z.jsxs)(xh,{className:`h-10 rounded-xl`,children:[(0,Z.jsx)(yh,{className:`pl-2.5`,children:(0,Z.jsx)(qv,{className:`size-4 text-muted-foreground opacity-60`})}),(0,Z.jsx)(bh,{...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:Bn(`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)(xd,{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)(ll,{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 RB=`ok-feedback-nudge-v1`,zB={firstSeenAt:null,shownAt:null,dismissed:!1};function BB(e){let t=0;for(let n of e)Yf(n)||t++;return t}function VB(e,t,n){return!e.dismissed&&e.shownAt==null&&e.firstSeenAt!=null&&t-e.firstSeenAt>=12096e5&&n>=10}function HB(e){return e===!0}function UB(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:null}function WB(e){if(typeof e!=`object`||!e)return zB;let t=e;return{firstSeenAt:UB(t.firstSeenAt),shownAt:UB(t.shownAt),dismissed:HB(t.dismissed)}}function GB(e){try{let t=(e??localStorage).getItem(RB);return t==null?zB:WB(JSON.parse(t))}catch(e){return console.warn(`[feedback-nudge-store] readPersistedState failed (corrupt/privacy/SSR)`,e),zB}}function KB(e,t){try{(t??localStorage).setItem(RB,JSON.stringify(e))}catch(e){console.warn(`[feedback-nudge-store] writePersistedState failed (quota/privacy/SSR)`,e)}}function qB(e){let t=GB(e),n=new Set,r=!1;function i(){for(let e of n)e()}function a(n){t=n,KB(t,e),i()}function o(){t=GB(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 JB=qB();typeof window<`u`&&typeof window.addEventListener==`function`&&window.addEventListener(`storage`,e=>{(e.key===`ok-feedback-nudge-v1`||e.key===null)&&JB.syncFromStorage()});function YB(){JB.install()}var XB=`https://github.com/inkeep/open-knowledge`,ZB=`https://discord.gg/VRKk2EaGHN`,QB=`https://x.com/OpenKnowledge`,$B=`ok-subscribe-card-v1`,eV={subscribed:!1,dismissed:!1,shownVersions:[]};function tV(e,t){return!e.subscribed&&!e.dismissed&&e.shownVersions.length<3&&!e.shownVersions.includes(t)}function nV(e){return e===!0}function rV(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function iV(e){if(typeof e!=`object`||!e)return eV;let t=e;return{subscribed:nV(t.subscribed),dismissed:nV(t.dismissed),shownVersions:rV(t.shownVersions)}}function aV(e){try{let t=(e??localStorage).getItem($B);return t==null?eV:iV(JSON.parse(t))}catch(e){return console.warn(`[subscribe-card-store] readPersistedState failed (corrupt/privacy/SSR)`,e),eV}}function oV(e,t){try{(t??localStorage).setItem($B,JSON.stringify(e))}catch(e){console.warn(`[subscribe-card-store] writePersistedState failed (quota/privacy/SSR)`,e)}}function sV(e){let t=aV(e),n=new Set,r=!1;function i(){for(let e of n)e()}function a(n){t=n,oV(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=aV(e),i())}}}var cV=sV();function lV(){cV.install()}function uV(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 dV(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 fV=[{key:`resources`,heading:{id:`s-MGs7`},links:[{label:{id:`TbjyhA`},href:`https://openknowledge.ai/docs`,icon:xe}]},{key:`community`,heading:{id:`chL5IG`},links:[{label:`Discord`,href:ZB,icon:uV},{label:`X (Twitter)`,href:QB,icon:dV},{label:`GitHub`,href:XB,icon:Qy}]}],pV=`${XB}/releases`,mV=`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 hV(e){if(e<1e3)return String(e);let t=e/1e3;return`${t>=10?Math.round(t):t.toFixed(1)}k`}var gV=e=>{let t=(0,$.c)(12),{count:n}=e,{_:r}=on(),i,a,o,s;t[0]!==r||t[1]!==n?(i=hV(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)(uy,{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},_V=e=>{let t=(0,$.c)(15),{link:n,trailing:r}=e,{_:i}=on(),{label:a,href:o,icon:s}=n,c,l;t[0]===o?(c=t[1],l=t[2]):(c=e=>um(e,o),l=e=>um(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:mV,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},vV=e=>{let t=(0,$.c)(7),{icon:n,onSelect:r,children:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=Bn(mV,`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},yV=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},bV=()=>{let e=(0,$.c)(37),{_:t}=on(),[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=Mt(),[d,f]=(0,Q.useState)(null),p=typeof window<`u`&&window.okDesktop!=null,m,h;e[0]!==n||e[1]!==d?(m=()=>{if(!n||d!==null)return;let e=new AbortController;return $o({signal:e.signal}).then(e=>{e!==null&&f(e)}),()=>e.abort()},h=[n,d],e[0]=n,e[1]=d,e[2]=m,e[3]=h):(m=e[2],h=e[3]),(0,Q.useEffect)(m,h);let g;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>{r(e),e||a(!1)},e[4]=g):g=e[4];let _;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(Et,{className:`size-4`}),e[5]=_):_=e[5];let v;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(In,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[_,(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)(cr,{children:(0,Z.jsx)(Y,{id:`s-MGs7`})})]}),e[7]=y):y=e[7];let b;e[8]!==t||e[9]!==u||e[10]!==d?(b=fV.map((e,n)=>(0,Z.jsxs)(`div`,{className:Bn(n>0&&`mt-3`),children:[(0,Z.jsx)(yV,{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)(_V,{link:e,trailing:e.href===`https://github.com/inkeep/open-knowledge`&&d!==null?(0,Z.jsx)(gV,{count:d}):void 0},e.href)),e.key===`resources`&&(0,Z.jsxs)(Z.Fragment,{children:[p&&(0,Z.jsx)(vV,{icon:O,onSelect:()=>{r(!1),s(!0)},children:(0,Z.jsx)(Y,{id:`cd5EXh`})}),(0,Z.jsx)(vV,{icon:Ud,onSelect:()=>{r(!1),l(!0)},children:(0,Z.jsx)(Y,{id:`RoafuO`})}),u?(0,Z.jsx)(vV,{icon:Fv,onSelect:()=>{r(!1),u()},children:(0,Z.jsx)(Y,{id:`hgf5io`})}):null]})]})})]},e.key)),e[8]=t,e[9]=u,e[10]=d,e[11]=b):b=e[11];let x;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(yV,{children:(0,Z.jsx)(Y,{id:`arUUsK`})}),e[12]=x):x=e[12];let S;e[13]===t?S=e[14]:(S=t({id:`arUUsK`}),e[13]=t,e[14]=S);let C;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(_V,{link:{label:{id:`3ePd3I`},href:pV,icon:Jv}}),e[15]=C):C=e[15];let w;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(In,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,className:Bn(mV,`h-auto w-full justify-start font-normal`),children:[(0,Z.jsx)(qv,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Z.jsx)(Y,{id:`EDl9kS`})]})}),e[16]=w):w=e[16];let T;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(jn,{side:`left`,align:`center`,sideOffset:20,className:`w-80`,children:(0,Z.jsx)(LB,{source:`resources_menu`,autoFocus:!0,onDismiss:()=>a(!1),onSuccess:xV})}),e[17]=T):T=e[17];let E;e[18]===i?E=e[19]:(E=(0,Z.jsxs)(`ul`,{className:`space-y-0.5`,children:[C,(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(Ln,{open:i,onOpenChange:a,children:[w,T]})})]}),e[18]=i,e[19]=E);let D;e[20]!==E||e[21]!==S?(D=(0,Z.jsxs)(`div`,{className:`mt-3`,children:[x,(0,Z.jsx)(`nav`,{"aria-label":S,children:E})]}),e[20]=E,e[21]=S,e[22]=D):D=e[22];let k;e[23]!==D||e[24]!==b?(k=(0,Z.jsxs)(jn,{align:`end`,className:`w-56 p-3`,children:[b,D]}),e[23]=D,e[24]=b,e[25]=k):k=e[25];let A;e[26]!==n||e[27]!==k?(A=(0,Z.jsxs)(Ln,{open:n,onOpenChange:g,children:[y,k]}),e[26]=n,e[27]=k,e[28]=A):A=e[28];let j;e[29]===o?j=e[30]:(j=p&&(0,Z.jsx)($_,{open:o,onOpenChange:s}),e[29]=o,e[30]=j);let M;e[31]===c?M=e[32]:(M=(0,Z.jsx)(Gb,{open:c,onOpenChange:l,onSuccess:SV}),e[31]=c,e[32]=M);let N;return e[33]!==A||e[34]!==j||e[35]!==M?(N=(0,Z.jsxs)(Z.Fragment,{children:[A,j,M]}),e[33]=A,e[34]=j,e[35]=M,e[36]=N):N=e[36],N};function xV(){return cV.markSubscribed()}function SV(){return JB.dismiss()}function CV(e){let t=(0,$.c)(14),{className:n}=e,{_:r}=on(),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)($c,{"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)(sr,{asChild:!0,children:(0,Z.jsxs)(Mp,{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)(cr,{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 wV=1,TV=2,EV=wV|TV;function DV(){if(!(typeof window>`u`))return window.navigation}function OV(){let e=DV();return e?(e.canGoBack?wV:0)|(e.canGoForward?TV:0):EV}function kV(e){let t=DV();return t?(t.addEventListener(`currententrychange`,e),()=>t.removeEventListener(`currententrychange`,e)):()=>{}}function AV(){let e=(0,$.c)(42),{_:t}=on(),n=(0,Q.useSyncExternalStore)(kV,OV,NV),r=(n&wV)!==0,i=(n&TV)!==0,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=xs(`navigate-back`),e[0]=a):a=e[0];let o=a,s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=Ss(`navigate-back`),e[1]=s):s=e[1];let c=s,l;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=xs(`navigate-forward`),e[2]=l):l=e[2];let u=l,d;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=Ss(`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)(ol,{"aria-hidden":`true`}),e[8]=g):g=e[8];let _;e[9]!==m||e[10]!==h?(_=(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(X,{"aria-label":m,className:`[-webkit-app-region:no-drag]`,disabled:h,onClick:MV,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)(ne,{"aria-label":c,children:o}),e[16]=b):b=e[16];let x;e[17]===y?x=e[18]:(x=(0,Z.jsxs)(cr,{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)(ll,{"aria-hidden":`true`}),e[24]=T):T=e[24];let E;e[25]!==C||e[26]!==w?(E=(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(X,{"aria-label":C,className:`[-webkit-app-region:no-drag]`,disabled:w,onClick:jV,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)(ne,{"aria-label":f,children:u}),e[32]=k):k=e[32];let A;e[33]===O?A=e[34]:(A=(0,Z.jsxs)(cr,{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)(uf,{"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 jV(){return zn(`navigate-forward`)}function MV(){return zn(`navigate-back`)}function NV(){return EV}var PV=50,FV=()=>{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,XO.preload()},PV))},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=ks)},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)(Pc,{className:`size-4`}),e[5]=u):u=e[5];let d;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(sr,{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)(cr,{children:(0,Z.jsx)(Y,{id:`Tz0i8g`})})]}),e[7]=f):f=e[7],f},IV=`https://openknowledge.ai/docs/features/share`,LV={mac:`⌘ C`,windowsLinux:`Ctrl C`};function RV(e){let t=(0,$.c)(52),{input:n,onClickWhenNoRemote:r}=e,{_:i}=on(),{status:a}=nl(),[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=pd(c?.freshness,a),g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=Es(LV),t[4]=g):g=t[4];let _=g,v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v=ws(LV),t[5]=v):v=t[5];let y=v,b;t[6]!==i||t[7]!==o||t[8]!==p||t[9]!==n||t[10]!==r?(b=async function(){if(!o&&n!==null){s(!0),l(null);try{let e=await Xu({...n,hasRemote:p,onClickWhenNoRemote:r},{clipboardWrite:nh,toastSuccess:KV,toastError:GV,logEvent:WV});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{Ns.error(i({id:`u3YnKw`}))}s(!1)}},t[6]=i,t[7]=o,t[8]=p,t[9]=n,t[10]=r,t[11]=b):b=t[11];let x=b,S=c!==null,C;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{e||l(null)},t[12]=C):C=t[12];let w;t[13]!==i||t[14]!==n?.kind?(w=n?.kind===`folder`?i({id:`WR0y2O`}):i({id:`F4IYWe`}),t[13]=i,t[14]=n?.kind,t[15]=w):w=t[15];let T=o||m,E,D;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(ef,{className:`size-3.5`,"aria-hidden":!0}),D=(0,Z.jsx)(Y,{id:`Z8lGw6`}),t[16]=E,t[17]=D):(E=t[16],D=t[17]);let O;t[18]!==x||t[19]!==w||t[20]!==T?(O=(0,Z.jsx)(Nn,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,"aria-label":w,onClick:x,disabled:T,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[E,D]})}),t[18]=x,t[19]=w,t[20]=T,t[21]=O):O=t[21];let k=h?`w-96`:`w-80`,A;t[22]===k?A=t[23]:(A=Bn(`flex flex-col gap-2`,k),t[22]=k,t[23]=A);let j;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`Z8lGw6`})}),t[24]=j):j=t[24];let M;t[25]===c?.autoCopyFailed?M=t[26]:(M=c?.autoCopyFailed?(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`vj-33a`,values:{copyShortcut:_},components:{0:(0,Z.jsx)(ne,{"aria-label":y})}})}):null,t[25]=c?.autoCopyFailed,t[26]=M);let N=c?.url??``,P;t[27]===i?P=t[28]:(P=i({id:`5-FeN2`}),t[27]=i,t[28]=P);let F;t[29]!==N||t[30]!==P?(F=(0,Z.jsx)(zf,{ref:u,readOnly:!0,value:N,onFocus:UV,onClick:HV,onContextMenu:VV,className:`select-all bg-muted font-mono text-xs text-muted-foreground`,"data-testid":`share-button-url`,"aria-label":P}),t[29]=N,t[30]=P,t[31]=F):F=t[31];let I=c?.url??``,L=c?.autoCopyFailed===!1,R;t[32]!==I||t[33]!==L?(R=(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)(wu,{copyContent:I,clipboardWrite:nh,initialCopied:L})})}),t[32]=I,t[33]=L,t[34]=R):R=t[34];let z;t[35]!==F||t[36]!==R?(z=(0,Z.jsxs)(`div`,{className:`relative`,children:[F,R]}),t[35]=F,t[36]=R,t[37]=z):z=t[37];let B=c?.freshness,V=n?.kind??`doc`,H;t[38]!==a||t[39]!==B||t[40]!==V?(H=(0,Z.jsx)(dd,{freshness:B,status:a,kind:V}),t[38]=a,t[39]=B,t[40]=V,t[41]=H):H=t[41];let U;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsxs)(`a`,{href:IV,target:`_blank`,rel:`noopener noreferrer`,onClick:BV,onAuxClick:zV,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)(Et,{"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]!==A||t[44]!==M||t[45]!==z||t[46]!==H?(W=(0,Z.jsxs)(jn,{align:`end`,className:A,"data-testid":`share-button-popover`,children:[j,M,z,H,U]}),t[43]=A,t[44]=M,t[45]=z,t[46]=H,t[47]=W):W=t[47];let ee;return t[48]!==O||t[49]!==W||t[50]!==S?(ee=(0,Z.jsxs)(Ln,{open:S,onOpenChange:C,children:[O,W]}),t[48]=O,t[49]=W,t[50]=S,t[51]=ee):ee=t[51],ee}function zV(e){return um(e,IV)}function BV(e){return um(e,IV)}function VV(e){return e.currentTarget.select()}function HV(e){return e.currentTarget.select()}function UV(e){return e.currentTarget.select()}function WV(e){return console.log(e)}function GV(e,t){t!==`clipboard`&&Ns.error(e)}function KV(e){return Ns.success(e)}var qV=(0,Q.lazy)(()=>n(()=>import(`./AppMenubar-CYaE7Hn6.js`).then(e=>({default:e.AppMenubar})),__vite__mapDeps([198,1,12,13,14,16,17,18,54,138,35,36,20,28,29,55,21,22,105,24,44,45,25,26]),import.meta.url));function JV(e){let t=(0,$.c)(59),{children:n,onSignIn:r,onSetIdentity:i,onOpenSearch:a}=e,{_:o}=on(),{activeDocName:s,activeTarget:c}=Oe(),l=s?Ao(s):null,{state:u}=xI(),d=eS(),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=xs(`toggle-files-sidebar`),t[0]=f):f=t[0];let p=f,m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(m=Ss(`toggle-files-sidebar`),t[1]=m):m=t[1];let h=m,g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=xs(`command-palette`),t[2]=g):g=t[2];let _=g,v=Ss(`command-palette`),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(!1),C=(0,Q.useRef)(null),w=(0,Q.useRef)(null),T=(0,Q.useRef)(null),E=(0,Q.useRef)(null),D;bb0:{if(c?.kind===`folder`){let e;t[3]===c.folderPath?e=t[4]:(e=$u(c.folderPath),t[3]=c.folderPath,t[4]=e),D=e;break bb0}if(s&&!l){let e;t[5]===s?e=t[6]:(e=td(s),t[5]=s,t[6]=e),D=e;break bb0}if(!c&&!s){let e;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=$u(``),t[7]=e):e=t[7],D=e;break bb0}D=null}let O=D,k=typeof window<`u`&&window.okDesktop!=null,A=u===`collapsed`,j;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(j=Hz()?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(qV,{})}):null,t[8]=j):j=t[8];let M=j,N,P;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(N=()=>{let e=C.current,t=w.current,n=T.current,r=E.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(),S(!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()}},P=[],t[9]=N,t[10]=P):(N=t[9],P=t[10]),(0,Q.useLayoutEffect)(N,P);let F;t[11]!==b||t[12]!==O||t[13]!==d?(F=!d&&(0,Z.jsx)(RV,{input:O,onClickWhenNoRemote:()=>b(!0)}),t[11]=b,t[12]=O,t[13]=d,t[14]=F):F=t[14];let I;t[15]!==i||t[16]!==r?(I=(0,Z.jsx)(qu,{onSignIn:r,onSetIdentity:i}),t[15]=i,t[16]=r,t[17]=I):I=t[17];let L,R,z,B;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(xB,{}),R=(0,Z.jsx)(Ni,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),z=(0,Z.jsx)(CV,{}),B=(0,Z.jsx)(wB,{}),t[18]=L,t[19]=R,t[20]=z,t[21]=B):(L=t[18],R=t[19],z=t[20],B=t[21]);let V;t[22]===d?V=t[23]:(V=!d&&(0,Z.jsx)(FV,{}),t[22]=d,t[23]=V);let H;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(bV,{}),t[24]=H):H=t[24];let U;t[25]!==V||t[26]!==F||t[27]!==I?(U=(0,Z.jsxs)(Z.Fragment,{children:[F,I,L,R,z,B,V,H]}),t[25]=V,t[26]=F,t[27]=I,t[28]=U):U=t[28];let W=U,ee=k?``:void 0,G=k&&A?`var(--ok-titlebar-reserve-left, 1rem)`:`0px`,K;t[29]===G?K=t[30]:(K={"--editor-header-leading-offset":G},t[29]=G,t[30]=K);let q;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(q=Bn(`group/editor-header relative flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,k&&`[-webkit-app-region:drag]`),t[31]=q):q=t[31];let te=!x&&`invisible`,J;t[32]===te?J=t[33]:(J=Bn(`absolute inset-y-0 left-0 z-10 flex min-w-0 w-[var(--editor-header-tabs-width,100%)] overflow-hidden`,te,k&&`[-webkit-app-region:drag]`),t[32]=te,t[33]=J);let re;t[34]!==n||t[35]!==J?(re=(0,Z.jsx)(`div`,{ref:T,"data-electron-drag":k?``:void 0,"data-editor-header-tabs":``,className:J,children:n}),t[34]=n,t[35]=J,t[36]=re):re=t[36];let ie=k?``:void 0,ae=k&&A&&`left-[var(--ok-titlebar-reserve-left,1rem)]`,oe;t[37]===ae?oe=t[38]:(oe=Bn(`absolute inset-y-0 left-0 z-20 flex items-center gap-1 px-3`,k&&`[-webkit-app-region:drag]`,ae),t[37]=ae,t[38]=oe);let se=d&&M,ce=!d&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(uf,{"aria-label":o({id:`V6AIOn`}),className:`-ml-1 shrink-0 has-[>[data-slot=button-group]]:gap-0`,children:[(0,Z.jsxs)(ur,{children:[(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(EI,{className:Bn(`shrink-0 text-muted-foreground`,k&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsxs)(cr,{children:[(0,Z.jsx)(`span`,{children:o(u===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`})}),` `,(0,Z.jsx)(ne,{"aria-label":h,children:p})]})]}),A&&a&&(0,Z.jsxs)(ur,{children:[(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,onClick:a,"aria-label":o({id:`DbCfXV`,values:{searchShortcutLabel:v}}),"data-telemetry-event":`ok.editor_header.search.click`,className:Bn(`shrink-0 text-muted-foreground`,k&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(ct,{"aria-hidden":`true`})})}),(0,Z.jsxs)(cr,{children:[(0,Z.jsx)(`span`,{children:o({id:`A1taO8`})}),` `,(0,Z.jsx)(ne,{"aria-label":v,children:_})]})]}),k&&A&&(0,Z.jsx)(AV,{})]}),M,(0,Z.jsx)(Ni,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`})]}),le;t[39]!==ie||t[40]!==oe||t[41]!==se||t[42]!==ce?(le=(0,Z.jsxs)(`div`,{ref:w,"data-electron-drag":ie,"data-editor-header-leading-actions":``,className:oe,children:[se,ce]}),t[39]=ie,t[40]=oe,t[41]=se,t[42]=ce,t[43]=le):le=t[43];let ue;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(ue=Bn(`absolute inset-y-0 right-0 z-20 flex items-center justify-end gap-2 px-3`,k&&`[-webkit-app-region:drag] [&_button]:[-webkit-app-region:no-drag] [&_a]:[-webkit-app-region:no-drag]`,k&&`mr-[var(--ok-titlebar-reserve-right,0px)]`),t[44]=ue):ue=t[44];let de;t[45]!==y||t[46]!==b||t[47]!==d?(de=!d&&(0,Z.jsx)(Ju,{open:y,onOpenChange:b}),t[45]=y,t[46]=b,t[47]=d,t[48]=de):de=t[48];let fe;t[49]!==W||t[50]!==de?(fe=(0,Z.jsxs)(`div`,{ref:E,"data-electron-drag":k?``:void 0,"data-editor-header-actions":``,className:ue,children:[W,de]}),t[49]=W,t[50]=de,t[51]=fe):fe=t[51];let pe;return t[52]!==ee||t[53]!==K||t[54]!==q||t[55]!==re||t[56]!==le||t[57]!==fe?(pe=(0,Z.jsxs)(`header`,{ref:C,"data-electron-drag":ee,style:K,className:q,children:[re,le,fe]}),t[52]=ee,t[53]=K,t[54]=q,t[55]=re,t[56]=le,t[57]=fe,t[58]=pe):pe=t[58],pe}function YV(e,t){return ga({relativePath:Xc(e),instruction:``,selectionMarkdown:t,target:`claude-code`})}var XV=(0,Q.lazy)(()=>n(()=>import(`./AgentThreadClientBinder-Dr4KCMFV.js`).then(e=>({default:e.AgentThreadClientBinder})),__vite__mapDeps([199,1,24,14,200,45,92,18,111,6,2,3,7,8,9,10,11]),import.meta.url)),ZV=(0,Q.lazy)(()=>n(()=>import(`./SessionsHost-OteEtmPR.js`).then(e=>({default:e.SessionsHost})),__vite__mapDeps([201,1,2,134,18,14,6,3,7,8,9,10,11,45,12,13,180,16,17,138,35,36,20,54,28,29,55,21,22,105,24,25,26,137,99,125,30,34,56,142,116,40,202,37,203,136,74,117,43,42,31,92,132,47,48,159,91,93,94,95,96,160,200,204,161,77]),import.meta.url));function QV(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]=nC(),[o,s]=(0,Q.useState)(i),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(`auth`),f=(0,Q.useSyncExternalStore)(_m.subscribe,_m.getSnapshot,cH),p,m;t[2]===f?(p=t[3],m=t[4]):(p=()=>{f&&(_m.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)(Aw[0].id),[_,v]=(0,Q.useState)(!1),y=typeof window<`u`?window.okDesktop??null:null,b=y!=null&&y.terminal!=null&&y.config.ptyAvailable===!0,[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(0),[T,E]=(0,Q.useState)(sH),[D,O]=(0,Q.useState)(oH),k,A;t[5]===T?(k=t[6],A=t[7]):(k=()=>{cC(T)},A=[T],t[5]=T,t[6]=k,t[7]=A),(0,Q.useEffect)(k,A);let j,M;t[8]===D?(j=t[9],M=t[10]):(j=()=>{dC(D)},M=[D],t[8]=D,t[9]=j,t[10]=M),(0,Q.useEffect)(j,M);let[N,P]=(0,Q.useState)(!1),F=Tm(),[I,L]=(0,Q.useState)(!1),R=(0,Q.useRef)(!1),[z,B]=(0,Q.useState)(null),[V,H]=(0,Q.useState)(null),[U,W]=(0,Q.useState)(null),ee=(0,Q.useRef)(0),G;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(G={terminal:{container:null,isShowing:!1},agents:{container:null,isShowing:!1},editorRegion:null},t[11]=G):G=t[11];let[K,q]=(0,Q.useState)(G),te=(0,Q.useRef)(0),J;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(J=function(){pc()},t[12]=J):J=t[12];let ne=J,re;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(re=function(){P(!0)},t[13]=re):re=t[13];let ie=re,ae=tl(),{projectConfig:oe,projectLocalConfig:se,projectLocalSynced:ce,projectSynced:le}=xc(),{activeDocName:ue,activeProvider:de}=Oe(),fe=ae?.hasRemote,pe=ae?.pushPermission?.checkStatus,me;t[14]!==_||t[15]!==oe||t[16]!==se||t[17]!==ce||t[18]!==le||t[19]!==fe||t[20]!==pe?(me=mC({autoSyncOnboardingDismissed:_,hasRemote:fe,projectLocalSynced:ce,projectSynced:le,projectLocalConfig:se,projectConfig:oe,pushPermissionCheckStatus:pe}),t[14]=_,t[15]=oe,t[16]=se,t[17]=ce,t[18]=le,t[19]=fe,t[20]=pe,t[21]=me):me=t[21];let he=me,ge,_e;t[22]===ue?(ge=t[23],_e=t[24]):(ge=()=>{let e=function(e){let t=e.detail;t&&ue&&ql(ue,{kind:`raw-mdx`,detail:t}),s(`source`)};return window.addEventListener(JS,e),()=>window.removeEventListener(JS,e)},_e=[ue],t[22]=ue,t[23]=ge,t[24]=_e),(0,Q.useEffect)(ge,_e);let ve;t[25]!==ue||t[26]!==o?(ve=function(e,t){if(ue==null)return!1;let n=wm(ue,o)?.markdown??``;return n.trim()===``?!1:(Ws(`${YV(ue,n)}\n\n`,{newTab:e,submit:!1,target:t}),!0)},t[25]=ue,t[26]=o,t[27]=ve):ve=t[27];let ye=ve,be=(0,Q.useEffectEvent)(ye),xe;t[28]===ye?xe=t[29]:(xe=()=>ye(!1,`agents`),t[28]=ye,t[29]=xe);let Se=(0,Q.useEffectEvent)(xe),Ce;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=()=>ne(),t[30]=Ce):Ce=t[30];let we=(0,Q.useEffectEvent)(Ce),Te;t[31]===Se?Te=t[32]:(Te=()=>Fn(e=>{if(e===`toggle-terminal`)S(aH);else if(e===`move-terminal`)E(iH);else if(e===`new-terminal`)S(!0);else if(e===`toggle-agent-panel`){if(Se())return;P(rH)}}),t[31]=Se,t[32]=Te);let De;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(De=[],t[33]=De):De=t[33],(0,Q.useEffect)(Te,De);let ke,Ae;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(ke=()=>{let e=window.okDesktop!=null,t=function(t){js(t,`toggle-terminal-panel`,e)&&(rr()||b&&(t.preventDefault(),S(nH)))};return window.addEventListener(`keydown`,t,{capture:!0}),()=>window.removeEventListener(`keydown`,t,{capture:!0})},Ae=[b],t[34]=ke,t[35]=Ae):(ke=t[34],Ae=t[35]),(0,Q.useEffect)(ke,Ae);let je;t[36]===Se?je=t[37]:(je=()=>{if(window.okDesktop!=null)return;let e=function(e){As(e,`toggle-agent-panel`)&&(rr()||(e.preventDefault(),!Se()&&P(tH)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},t[36]=Se,t[37]=je);let Me;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(Me=[],t[38]=Me):Me=t[38],(0,Q.useEffect)(je,Me);let Ne;t[39]!==we||t[40]!==be?(Ne=()=>{let e=function(e){As(e,`new-terminal-tab`)&&(rr()||(e.preventDefault(),be(!0)||we()))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},t[39]=we,t[40]=be,t[41]=Ne):Ne=t[41];let Pe;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=[],t[42]=Pe):Pe=t[42],(0,Q.useEffect)(Ne,Pe);let Fe,Ie;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=()=>vg(e=>{S(!0),te.current+=1,H({id:e,nonce:te.current})}),Ie=[],t[43]=Fe,t[44]=Ie):(Fe=t[43],Ie=t[44]),(0,Q.useEffect)(Fe,Ie);let Re,ze;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(Re=()=>uc((e,t,n)=>{let{stage:r}=n;S(!0),te.current+=1,B({prompt:r?null:e,cli:t,nonce:te.current,stagePaste:r?e:void 0})}),ze=[],t[45]=Re,t[46]=ze):(Re=t[45],ze=t[46]),(0,Q.useEffect)(Re,ze);let Be,Ve;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Be=()=>wc(e=>{P(!0),ee.current+=1,W({agentSource:e.agentSource,agentId:e.agentId,prompt:e.prompt,docName:e.docName,titleHint:e.titleHint,nonce:ee.current})}),Ve=[],t[47]=Be,t[48]=Ve):(Be=t[47],Ve=t[48]),(0,Q.useEffect)(Be,Ve);let He,Ue;t[49]===x?(He=t[50],Ue=t[51]):(He=()=>{x||B(null)},Ue=[x],t[49]=x,t[50]=He,t[51]=Ue),(0,Q.useEffect)(He,Ue);let We,Ge;t[52]!==I||t[53]!==x?(We=()=>{window.okDesktop!=null&&I&&(Js({terminalVisible:x}),window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:x}))},Ge=[x,I],t[52]=I,t[53]=x,t[54]=We,t[55]=Ge):(We=t[54],Ge=t[55]),(0,Q.useEffect)(We,Ge);let Ke,qe;t[56]!==I||t[57]!==T?(Ke=()=>{window.okDesktop!=null&&I&&(Js({terminalPlacement:T}),window.okDesktop.editor.notifyViewMenuStateChanged({terminalPlacement:T}))},qe=[T,I],t[56]=I,t[57]=T,t[58]=Ke,t[59]=qe):(Ke=t[58],qe=t[59]),(0,Q.useEffect)(Ke,qe);let Je,Ye;t[60]!==N||t[61]!==I?(Je=()=>{window.okDesktop!=null&&I&&(Js({agentPanelVisible:N}),window.okDesktop.editor.notifyViewMenuStateChanged({agentPanelVisible:N}))},Ye=[N,I],t[60]=N,t[61]=I,t[62]=Je,t[63]=Ye):(Je=t[62],Ye=t[63]),(0,Q.useEffect)(Je,Ye);let Xe,Ze;t[64]!==ue||t[65]!==o?(Xe=()=>{let e=null,t=()=>{let t=((ue===null?null:wm(ue,o))?.markdown??``).trim()!==``;t!==e&&(e=t,Js({hasEditorSelection:t}),window.okDesktop?.editor.notifyViewMenuStateChanged({hasEditorSelection:t}))};return t(),bm(t)},Ze=[ue,o],t[64]=ue,t[65]=o,t[66]=Xe,t[67]=Ze):(Xe=t[66],Ze=t[67]),(0,Q.useEffect)(Xe,Ze);let Qe,$e;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=()=>{let e=window.okDesktop;if(e==null)return;if(typeof e.terminal?.getDockState!=`function`){L(!0);return}let t=!1;return e.terminal.getDockState().then(e=>{t||(e.agentPanelVisible&&P(!0),e.terminalVisible&&(R.current=!0,w(eH),S(!0)))}).catch($V).finally(()=>{t||L(!0)}),()=>{t=!0}},$e=[],t[68]=Qe,t[69]=$e):(Qe=t[68],$e=t[69]),(0,Q.useEffect)(Qe,$e);let et,tt;t[70]===x?(et=t[71],tt=t[72]):(et=()=>{if(window.okDesktop!=null){if(R.current){R.current=!1;return}x&&$i()}},tt=[x],t[70]=x,t[71]=et,t[72]=tt),(0,Q.useEffect)(et,tt),rC(ae?.pausedReason),aC();let nt;t[73]!==ue||t[74]!==de||t[75]!==o||t[76]!==a?(nt=function(e){ue&&de&&o!==e&&(tu({from:o,to:e,docName:ue,ytext:de.document.getText(`source`)}),Le(ue)),s(e),a(e)},t[73]=ue,t[74]=de,t[75]=o,t[76]=a,t[77]=nt):nt=t[77];let rt=nt,it;t[78]!==o||t[79]!==rt?(it=()=>{rt(o===`source`?`wysiwyg`:`source`)},t[78]=o,t[79]=rt,t[80]=it):it=t[80];let at=(0,Q.useEffectEvent)(it),ot=o===`wysiwyg`&&!!ue&&!!de,st;t[81]!==ue||t[82]!==de||t[83]!==ot?(st=()=>{if(!ot||!ue||!de)return;let e=Ee(ue);e&&Kl({editor:e,docName:ue,ytext:de.document.getText(`source`)})},t[81]=ue,t[82]=de,t[83]=ot,t[84]=st):st=t[84];let ct=(0,Q.useEffectEvent)(st),lt,ut;t[85]===ot?(lt=t[86],ut=t[87]):(lt=()=>{window.okDesktop?.editor.notifyViewMenuStateChanged({canViewInSource:ot})},ut=[ot],t[85]=ot,t[86]=lt,t[87]=ut),(0,Q.useEffect)(lt,ut);let dt;t[88]!==ct||t[89]!==at?(dt=()=>{let e=function(e){if(As(e,`toggle-editor-mode`)){if(rr())return;e.preventDefault(),at();return}if(As(e,`view-source-at-cursor`)){if(rr())return;e.preventDefault(),ct()}};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},t[88]=ct,t[89]=at,t[90]=dt):dt=t[90];let ft;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(ft=[],t[91]=ft):ft=t[91],(0,Q.useEffect)(dt,ft);let pt;t[92]===ct?pt=t[93]:(pt=()=>Fn(e=>{e===`toggle-source`&&ct()}),t[92]=ct,t[93]=pt);let mt;t[94]===Symbol.for(`react.memo_cache_sentinel`)?(mt=[],t[94]=mt):mt=t[94],(0,Q.useEffect)(pt,mt);let ht,gt;t[95]===ue?(ht=t[96],gt=t[97]):(ht=()=>{let e=function(e){e.detail?.docName===ue&&s(`source`)};return window.addEventListener(fu,e),()=>window.removeEventListener(fu,e)},gt=[ue],t[95]=ue,t[96]=ht,t[97]=gt),(0,Q.useEffect)(ht,gt);let _t;t[98]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(XV,{})}),t[98]=_t):_t=t[98];let vt;t[99]===r?vt=t[100]:(vt=e=>(0,Z.jsx)(JV,{onSignIn:()=>{d(`auth`),l(!0)},onSetIdentity:()=>{d(`identity`),l(!0)},onOpenSearch:r,children:e}),t[99]=r,t[100]=vt);let yt;t[101]!==h||t[102]!==N||t[103]!==o||t[104]!==rt||t[105]!==vt||t[106]!==T||t[107]!==D||t[108]!==x?(yt=(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)(Fz,{editorMode:o,onModeChange:rt,activeTab:h,onActiveTabChange:g,terminalBridge:b?y:null,terminalVisible:x,terminalPlacement:T,terminalRightWidth:D,onTerminalVisibleChange:S,onTerminalRightWidthChange:O,agentsVisible:N,onAgentsVisibleChange:P,onSessionPlacements:q,onRevealAgents:ie,renderWorkspaceHeader:vt})})}),t[101]=h,t[102]=N,t[103]=o,t[104]=rt,t[105]=vt,t[106]=T,t[107]=D,t[108]=x,t[109]=yt):yt=t[109];let bt;t[110]===K.editorRegion?bt=t[111]:(bt=()=>K.editorRegion?.focus(),t[110]=K.editorRegion,t[111]=bt);let xt;t[112]!==N||t[113]!==F||t[114]!==K.agents.container||t[115]!==K.agents.isShowing||t[116]!==bt||t[117]!==U?(xt=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(ZV,{surface:`agents-panel`,bridge:y,terminalCapable:b,visible:N,onVisibleChange:P,threadLaunch:U,installedClis:F,container:K.agents.container,isShowing:K.agents.isShowing,onRequestEditorFocus:bt})}),t[112]=N,t[113]=F,t[114]=K.agents.container,t[115]=K.agents.isShowing,t[116]=bt,t[117]=U,t[118]=xt):xt=t[118];let St;t[119]!==N||t[120]!==F||t[121]!==K.editorRegion||t[122]!==K.terminal||t[123]!==V||t[124]!==z||t[125]!==T||t[126]!==C||t[127]!==x?(St=b?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(ZV,{surface:`terminal-dock`,terminalPlacement:T,onTerminalPlacementChange:E,reserveRightRevealTabGutter:T===`right`&&!N,bridge:y,terminalCapable:!0,visible:x,terminalRestoreRevealNonce:C,onVisibleChange:S,launch:z,commandLaunch:V,installedClis:F,container:K.terminal.container,isShowing:K.terminal.isShowing,onRequestEditorFocus:()=>K.editorRegion?.focus()})}):null,t[119]=N,t[120]=F,t[121]=K.editorRegion,t[122]=K.terminal,t[123]=V,t[124]=z,t[125]=T,t[126]=C,t[127]=x,t[128]=St):St=t[128];let Ct=u===`identity`,wt;t[129]===Symbol.for(`react.memo_cache_sentinel`)?(wt=()=>{l(!1)},t[129]=wt):wt=t[129];let Tt;t[130]!==c||t[131]!==Ct?(Tt=(0,Z.jsx)(Vu,{open:c,onOpenChange:l,identityPrompt:Ct,onSuccess:wt}),t[130]=c,t[131]=Ct,t[132]=Tt):Tt=t[132];let Et=he!==null,Dt=he??`full`,Ot;t[133]===Symbol.for(`react.memo_cache_sentinel`)?(Ot=()=>v(!0),t[133]=Ot):Ot=t[133];let kt;t[134]!==Et||t[135]!==Dt?(kt=(0,Z.jsx)(fC,{open:Et,variant:Dt,onResolved:Ot}),t[134]=Et,t[135]=Dt,t[136]=kt):kt=t[136];let At,jt;t[137]===Symbol.for(`react.memo_cache_sentinel`)?(At=(0,Z.jsx)(GS,{}),jt=(0,Z.jsx)(US,{}),t[137]=At,t[138]=jt):(At=t[137],jt=t[138]);let Mt;return t[139]!==yt||t[140]!==xt||t[141]!==St||t[142]!==Tt||t[143]!==kt?(Mt=(0,Z.jsxs)(Z.Fragment,{children:[_t,yt,xt,St,Tt,kt,At,jt]}),t[139]=yt,t[140]=xt,t[141]=St,t[142]=Tt,t[143]=kt,t[144]=Mt):Mt=t[144],Mt}function $V(e){console.error(`[terminal] dock-state restore failed; staying hidden:`,e)}function eH(e){return e+1}function tH(e){return!e}function nH(e){return!e}function rH(e){return!e}function iH(e){return e===`bottom`?`right`:`bottom`}function aH(e){return!e}function oH(){return uC()}function sH(){return sC()}function cH(){return!1}function lH(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(!1),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>Fn(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)(Gb,{open:t,onOpenChange:n,source:`help_menu`}),e[2]=t,e[3]=a),a}function uH(e){let t=Cf(Af(e));typeof window>`u`||jf(window.location.hash,t)||(window.location.hash=t)}function dH(){let e=(0,$.c)(18),{conflicts:t,loading:n,error:r}=Uu(),{_:i}=on();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)(pf,{"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)(pf,{"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(fH),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 fH(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:()=>uH(e.file),children:[(0,Z.jsx)(pf,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}function pH(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,size:i,asChild:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`default`:i,s=a!==void 0&&a?or:`div`,c;t[5]===n?c=t[6]:(c=Bn(`group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl`,n),t[5]=n,t[6]=c);let l;return t[7]!==s||t[8]!==r||t[9]!==o||t[10]!==c?(l=(0,Z.jsx)(s,{"data-slot":`card`,"data-size":o,className:c,...r}),t[7]=s,t[8]=r,t[9]=o,t[10]=c,t[11]=l):l=t[11],l}function mH(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=Bn(`px-(--card-spacing)`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`card-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function hH(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=Bn(`flex items-center rounded-b-xl border-t bg-muted/50 p-(--card-spacing)`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`card-footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var gH=`proactive_card`;function _H(){let e=!1,t=!1;return{isEvaluated:()=>e,isShown:()=>t,latchEvaluated:()=>{e=!0},latchShown:()=>{t=!0}}}var vH=_H();function yH(e){let t=(0,$.c)(14),{pages:n,ready:r,blocked:i,store:a,now:o,session:s}=e,c=a===void 0?JB:a,l=o===void 0?Date.now:o,u=s===void 0?vH: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&&VB(c.getSnapshot(),l(),BB(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 bH=`Relaunch`,xH=`Release notes`,SH=`Updates paused`,CH=`Download`,wH=`Reset to defaults`,TH=`Relaunching to install the update…`,EH=`Relaunch failed — please restart manually`;function DH(e){return`Update to ${e} didn't install.`}var OH=`Retry`,kH=`Download manually`,AH=`Recovery action failed — please try again`;function jH(e,t){let n=t instanceof Error&&t.message?t.message:``;return n?`${e}: ${n}`:e}function MH(e){return`Version ${e} ready to install`}function NH(e){return`Updated to Version ${e}`}function PH(e){return`Your settings and recent projects were saved by a newer build than this one (v${e}). Reset to defaults to continue.`}var FH=0,IH=0,LH=1,RH=2,zH=3,BH=6e4;function VH(e,t,n=()=>{},r=BH,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:MH(r),priority:RH,action:{label:bH,onClick:()=>{t({id:i,body:TH,priority:RH,dismissible:!1}),e.update.relaunchNow().then(()=>{n(i)},e=>{a(),t({id:`relaunch-error-${r}`,body:jH(EH,e),variant:`error`,priority:LH})})}}})};a()})),a.push(e.onUpdateRelaunching(()=>{t({id:s,body:TH,priority:RH,dismissible:!1})})),a.push(e.onUpdateRelaunchFailed(({version:r,message:i,downloadUrl:a})=>{if(a){let i=`install-failed-${r}`,o=()=>{t({id:i,body:DH(r),variant:`error`,priority:LH,action:{label:OH,onClick:()=>{e.update.relaunchNow().then(()=>{n(i)},e=>{console.warn(`[update-notice] install-failed retry rejected`,e),o()})}},secondaryAction:{label:kH,onClick:()=>{e.shell.openExternal(a)}}})};o();return}t({id:`relaunch-error-${r}`,body:i?`${EH}: ${i}`:EH,variant:`error`,priority:LH})})),a.push(e.onWhatsNew(({version:a,releaseUrl:s})=>{if(i.isEligible(a)){i.onShown(a),t({id:`whats-new-combined-${a}`,body:NH(a),variant:`success`,priority:zH,combinedSubscribe:!0,whatsNew:{version:a,releaseUrl:s},action:{label:xH,onClick:()=>{e.shell.openExternal(s)}}}),e.update.dismissWhatsNew(a);return}let c=`whats-new-${a}`;t({id:c,body:NH(a),variant:`success`,priority:zH,action:{label:xH,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:SH,priority:IH,action:{label:CH,onClick:()=>{e.shell.openExternal(n)}}})})),()=>{for(let e of a)e();for(let e of o)clearTimeout(e);o.clear()}}function HH(e,t,n,r=()=>{}){let i=`schema-incompatibility-${t.persistedSchemaVersion}`,a=`schema-incompatibility-error-${t.persistedSchemaVersion}`,o=e=>{r(i),n({id:a,body:jH(AH,e),variant:`error`,priority:FH})};n({id:i,body:PH(t.currentBuild),priority:FH,action:{label:wH,onClick:()=>{e.state.resetIncompatible().then(()=>{r(i)},o)}}})}var UH=[],WH=new Set,GH=!1;function KH(){for(let e of WH)e()}function qH(e){let t=UH.findIndex(t=>t.id===e.id);if(t===-1)UH=[...UH,e];else{let n=UH.slice();n[t]=e,UH=n}KH()}function JH(e){let t=UH.filter(t=>t.id!==e);t.length!==UH.length&&(UH=t,KH())}function YH(){return UH}function XH(e){return WH.add(e),()=>{WH.delete(e)}}function ZH(){if(GH||typeof window>`u`)return;let e=window.okDesktop;e&&(GH=!0,VH(e,qH,JH,void 0,{isEligible:e=>tV(cV.getSnapshot(),e),onShown:e=>cV.recordShown(e)}),e.state.query().then(t=>{t.schemaIncompatibility&&HH(e,t.schemaIncompatibility,qH,JH)},e=>{console.warn(`[update-notices-store] bridge.state.query() failed`,e)}))}var QH=new URL(`/api/feedback`,{BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.51.4`}?.VITE_OK_FEEDBACK_INTAKE_ORIGIN||`https://openknowledge.ai`).href;function $H(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 eU(e){return{contentType:e.type,base64:await $H(e)}}function tU(){return typeof window<`u`&&window.okDesktop?.platform||`web`}async function nU(e){try{let t=await fetch(QH,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({...e,appVersion:Xp,platform:tU()}),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 rU=ar(`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 iU(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=Bn(rU({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 aU=ar(`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 oU(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=Bn(aU({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 sU(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=Bn(`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 cU(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=Bn(`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 lU(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=Bn(`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 uU(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=Bn(`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 dU(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=Bn(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 fU(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=Bn(`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 pU=[{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`}}],mU=3,hU=3*1024*1024,gU=[`image/png`,`image/jpeg`,`image/webp`],_U=`data-[state=on]:border-primary data-[state=on]:bg-primary/5 data-[state=on]:text-primary`,vU=`rounded-full border border-input bg-transparent px-3 ${_U}`;function yU(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function bU(e,t){let n=new Set(e.map(e=>`${e.name}:${e.size}`)),r=Array.from(t??[]).filter(e=>gU.includes(e.type)&&!n.has(`${e.name}:${e.size}`));return[...e,...r].slice(0,mU)}var xU=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},SU=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}=on(),u=(0,Q.useRef)(null),d,f;if(t[0]!==l){let e=fs({rating:bo([`positive`,`negative`],{error:l({id:`H-hzll`})}),reasons:io(Wa()),message:Wa(),attachments:io(go(File)).max(mU,l({id:`E9gh86`,values:{MAX_ATTACHMENTS:mU}})).refine(wU,l({id:`s7us1p`})).refine(EU,l({id:`ItxGi3`})),shareEmail:ss(),email:Wa()}).refine(DU,{path:[`email`],message:l({id:`fwrPh4`})});f=lg,d=PB(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=fg(_),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=fg(b),S;t[11]===g.control?S=t[12]:(S={control:g.control,name:`attachments`},t[11]=g.control,t[12]=S);let C=fg(S),w=C.length>=mU,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(eU)):void 0,r=await nU({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){Ns.success(l({id:`LvdLef`})),g.reset(),n?.();return}if(r.reason===`unavailable`){Ns.error(l({id:`D8JJwQ`}));return}Ns.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)}`),Ns.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=Bn(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)(hf,{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)(og,{children:[(0,Z.jsx)(pg,{children:(0,Z.jsxs)(Ii,{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)(Pi,{value:`positive`,className:Bn(`h-auto flex-1 justify-center py-2`,i?`gap-1.5 text-xs`:`gap-2`,_U),children:[(0,Z.jsx)(xy,{className:`size-4`}),(0,Z.jsx)(Y,{id:`OEEQKT`})]}),(0,Z.jsxs)(Pi,{value:`negative`,className:Bn(`h-auto flex-1 justify-center py-2`,i?`gap-1.5 text-xs`:`gap-2`,_U),children:[(0,Z.jsx)(by,{className:`size-4`}),(0,Z.jsx)(Y,{id:`U0QBh4`})]})]})}),(0,Z.jsx)(hg,{})]})},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)(ug,{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)(ug,{control:g.control,name:`reasons`,render:e=>{let{field:t}=e;return(0,Z.jsxs)(og,{children:[(0,Z.jsx)(mg,{children:(0,Z.jsx)(Y,{id:`Fqx38P`})}),(0,Z.jsx)(pg,{children:(0,Z.jsx)(Ii,{type:`multiple`,variant:`outline`,spacing:2,value:t.value,onValueChange:t.onChange,className:`w-full flex-wrap justify-start`,children:pU.map(e=>(0,Z.jsx)(Pi,{value:e.value,className:vU,children:l(e.label)},e.value))})})]})}}),(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(ug,{control:g.control,name:`message`,render:e=>{let{field:t}=e;return(0,Z.jsx)(og,{children:(0,Z.jsx)(pg,{children:(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(Pm,{...t,placeholder:l({id:`QlAG4m`}),className:Bn(`resize-none pb-9`,i?`min-h-16`:`min-h-20`)}),(0,Z.jsxs)(ur,{children:[(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(`span`,{className:Bn(`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)(Zd,{className:`size-4`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`3LbBJn`})})]})})}),(0,Z.jsx)(cr,{children:w?(0,Z.jsx)(Y,{id:`ASqqsQ`,values:{MAX_ATTACHMENTS:mU}}):(0,Z.jsx)(Y,{id:`3LbBJn`})})]}),(0,Z.jsx)(zf,{ref:u,type:`file`,accept:gU.join(`,`),multiple:!0,className:`hidden`,onChange:e=>{D(bU(C,e.target.files)),e.target.value=``}})]})})})}}),C.length>0&&(0,Z.jsx)(fU,{children:C.map((e,t)=>(0,Z.jsxs)(iU,{size:`xs`,children:[(0,Z.jsx)(oU,{variant:`image`,children:(0,Z.jsx)(xU,{file:e})}),(0,Z.jsxs)(sU,{children:[(0,Z.jsx)(cU,{children:e.name}),(0,Z.jsx)(lU,{children:yU(e.size)})]}),(0,Z.jsx)(uU,{children:(0,Z.jsx)(dU,{type:`button`,"aria-label":l({id:`w61W3L`,values:{0:e.name}}),onClick:()=>D(C.filter((e,n)=>n!==t)),children:(0,Z.jsx)(hf,{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)(ug,{control:g.control,name:`shareEmail`,render:OU}),x&&(0,Z.jsx)(ug,{control:g.control,name:`email`,render:e=>{let{field:t}=e;return(0,Z.jsxs)(og,{children:[(0,Z.jsx)(pg,{children:(0,Z.jsx)(zf,{...t,type:`email`,placeholder:l({id:`JHf6qZ`})})}),(0,Z.jsx)(hg,{})]})}})]}),(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)(gg,{...g,children:L}),t[55]=g,t[56]=L,t[57]=R):R=t[57],R};function CU(e){return gU.includes(e.type)}function wU(e){return e.every(CU)}function TU(e,t){return e+t.size}function EU(e){return e.reduce(TU,0)<=hU}function DU(e){return!e.shareEmail||hs().safeParse(e.email).success}function OU(e){let{field:t}=e;return(0,Z.jsxs)(og,{className:`flex flex-row items-center gap-2 space-y-0`,children:[(0,Z.jsx)(pg,{children:(0,Z.jsx)(Hr,{checked:t.value,onCheckedChange:e=>t.onChange(e===!0)})}),(0,Z.jsx)(mg,{className:`font-normal`,children:(0,Z.jsx)(Y,{id:`SF9qpO`})})]})}function kU(e){let t=(0,$.c)(10),{onClose:n}=e,{_:r}=on(),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)(mH,{children:(0,Z.jsx)(SU,{compact:!0,source:gH,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)(pH,{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 AU(){let e=(0,$.c)(5),t=ku(),n=(0,Q.useSyncExternalStore)(_A.subscribe,_A.getSnapshot,_A.getSnapshot),r=(0,Q.useSyncExternalStore)(XH,YH,YH),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],!yH(s))return null;let c;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(kU,{onClose:jU}),e[4]=c):c=e[4],c}function jU(){return JB.dismiss()}function MU(e){let t=(0,$.c)(20),{active:n}=e,{_:r}=on(),{setSkillsSidebar:i}=Oe(),a;t[0]===i?a=t[1]:(a=e=>{e===`skills`?i(!0):e===`files`&&i(!1)},t[0]=i,t[1]=a);let o;t[2]===r?o=t[3]:(o=r({id:`6h4-4a`}),t[2]=r,t[3]=o);let s;t[4]===r?s=t[5]:(s=r({id:`sER-bs`}),t[4]=r,t[5]=s);let c=n===`files`,l;t[6]!==s||t[7]!==c?(l=(0,Z.jsx)(NU,{value:`files`,icon:C,label:s,selected:c,testId:`sidebar-files-toggle`}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]===r?u=t[10]:(u=r({id:`PCSkw2`}),t[9]=r,t[10]=u);let d=n===`skills`,f;t[11]!==u||t[12]!==d?(f=(0,Z.jsx)(NU,{value:`skills`,icon:Rv,label:u,selected:d,testId:`sidebar-skills-toggle`}),t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;return t[14]!==n||t[15]!==a||t[16]!==o||t[17]!==l||t[18]!==f?(p=(0,Z.jsxs)(Ii,{type:`single`,value:n,onValueChange:a,"aria-label":o,size:`sm`,spacing:1,children:[l,f]}),t[14]=n,t[15]=a,t[16]=o,t[17]=l,t[18]=f,t[19]=p):p=t[19],p}function NU(e){let t=(0,$.c)(20),{value:n,icon:r,label:i,selected:a,testId:o}=e,s=a?void 0:i,c=a&&`bg-foreground/5 text-foreground dark:bg-foreground/10`,l;t[0]===c?l=t[1]:(l=Bn(`gap-0`,c),t[0]=c,t[1]=l);let u;t[2]===r?u=t[3]:(u=(0,Z.jsx)(r,{className:`size-4`,"aria-hidden":!0}),t[2]=r,t[3]=u);let d;t[4]!==i||t[5]!==a?(d=(0,Z.jsx)(PU,{expanded:a,children:i}),t[4]=i,t[5]=a,t[6]=d):d=t[6];let f;t[7]!==s||t[8]!==l||t[9]!==u||t[10]!==d||t[11]!==o||t[12]!==n?(f=(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsxs)(Pi,{value:n,"aria-label":s,className:l,"data-testid":o,children:[u,d]})}),t[7]=s,t[8]=l,t[9]=u,t[10]=d,t[11]=o,t[12]=n,t[13]=f):f=t[13];let p;t[14]!==i||t[15]!==a?(p=a?null:(0,Z.jsx)(cr,{side:`bottom`,children:i}),t[14]=i,t[15]=a,t[16]=p):p=t[16];let m;return t[17]!==f||t[18]!==p?(m=(0,Z.jsxs)(ur,{children:[f,p]}),t[17]=f,t[18]=p,t[19]=m):m=t[19],m}function PU(e){let t=(0,$.c)(7),{children:n,expanded:r}=e,i=r&&`grid-cols-[1fr]`,a;t[0]===i?a=t[1]:(a=Bn(`grid grid-cols-[0fr] transition-[grid-template-columns] duration-150 ease-out motion-reduce:transition-none`,i),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(`span`,{className:`overflow-hidden`,children:(0,Z.jsx)(`span`,{className:`block whitespace-nowrap pl-1.5`,children:n})}),t[2]=n,t[3]=o);let s;return t[4]!==a||t[5]!==o?(s=(0,Z.jsx)(`span`,{className:a,children:o}),t[4]=a,t[5]=o,t[6]=s):s=t[6],s}var FU=`<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>
@@ -2011,7 +2011,7 @@ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./globals-CLY_4Hw9.js";imp
2011
2011
  :host([${D2}]) [data-item-focused="true"] {
2012
2012
  --trees-focus-ring-color: transparent;
2013
2013
  }
2014
- `}\n${a1}\n${o1}\n${x0}`,k2={Item:li,Separator:Si,Sub:di,SubContent:fi,SubTrigger:vi};function A2(e){let t=(0,$.c)(133),{item:n,context:r,anyActionBusy:i,workspace:a,handoff:o,model:s,okignoreBinding:c,onStartCreating:l,onCreateFromTemplate:u,onDuplicate:d,onImportTemplate:f,onDelete:p,onExpandSubtree:m,onCollapseSubtree:h,folderTreePaths:g,isAsset:_,documents:v}=e,{_:y}=on(),b=Th(n,v),x=n.kind===`directory`,S;t[0]===n.path?S=t[1]:(S=Yf(n.path),t[0]=n.path,t[1]=S);let C=S,w=b.kind===`asset`?null:b,T=w!==null&&c!==null,E;t[2]!==y||t[3]!==x?(E=y(x?{id:`5D3Ior`}:{id:`dbhUX1`}),t[2]=y,t[3]=x,t[4]=E):E=t[4];let D=E,O;t[5]!==x||t[6]!==n.path?(O=x?Nh(n.path):null,t[5]=x,t[6]=n.path,t[7]=O):O=t[7];let k=O,A=Wu(k),j=A.state.status===`ready`?(A.state.data.folder.templates_available?.length??0)>0:!0,M=s.getSelectedPaths(),N=M.includes(b.treePath)?R1(M,v):[],P=N.length>1?N:[b],F=Ms._({id:`3nnyi_`,values:{0:P.length}}),I,L;if(t[8]!==v||t[9]!==_||t[10]!==x||t[11]!==n||t[12]!==a){if(L=Zh(n),I=null,x)I=Jc({folderRelativePath:L,workspace:a});else if(!_){let e;t[15]!==v||t[16]!==n.path||t[17]!==a?(e=kc({docName:kh(n.path,v),workspace:a}),t[15]=v,t[16]=n.path,t[17]=a,t[18]=e):e=t[18],I=e}t[8]=v,t[9]=_,t[10]=x,t[11]=n,t[12]=a,t[13]=I,t[14]=L}else I=t[13],L=t[14];let R;t[19]===r?R=t[20]:(R=()=>r.close({restoreFocus:!1}),t[19]=r,t[20]=R);let z=R,B;t[21]===r?B=t[22]:(B=()=>r.close(),t[21]=r,t[22]=B);let V=B,{status:H}=nl(),U=H?.hasRemote===!0,W;t[23]!==v||t[24]!==k||t[25]!==_||t[26]!==x||t[27]!==n.path||t[28]!==b?(W=null,x?W=$u(k??``):!_&&b.kind!==`asset`&&(W=td(kh(n.path,v))),t[23]=v,t[24]=k,t[25]=_,t[26]=x,t[27]=n.path,t[28]=b,t[29]=W):W=t[29];let ee=U&&W!==null,G;t[30]!==y||t[31]!==U||t[32]!==W?(G=function(){W&&Xu({...W,hasRemote:U,onClickWhenNoRemote:()=>{Ns.error(y({id:`WyQxwa`}))}},{clipboardWrite:nh,toastSuccess:N2,toastError:M2,logEvent:j2})},t[30]=y,t[31]=U,t[32]=W,t[33]=G):G=t[33];let K=G,q=0,te=0;if(x){let e=Uh(n.path);for(let t of g)(t===e||t.startsWith(e))&&(q++,L0(s.getItem(t))?.isExpanded()&&te++)}let J=x&&te<q,ne=x&&te>0,re=typeof window<`u`?window.okDesktop:void 0,ie;t[34]!==y||t[35]!==a?(ie=a?null:y({id:`wTcjov`}),t[34]=y,t[35]=a,t[36]=ie):ie=t[36];let ae=ie,oe;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(oe=re?tg(re.platform):null,t[37]=oe):oe=t[37];let se=oe,ce=se&&ae?`${se}, ${ae}`:se,le;t[38]!==y||t[39]!==V||t[40]!==x||t[41]!==c||t[42]!==w?(le=function(){if(!c||!w)return;V();let e=hL(w),t=Ku(c.current()),n=Yu(t,e);if(n===t)return;c.patch(Nu(n));let r=w.path.split(`/`).pop()||w.path;Ns.success(y(x?{id:`4xtLTl`,values:{basename:r}}:{id:`OD0FCX`,values:{basename:r}}),{description:y({id:`nWv1ja`}),duration:5e3})},t[38]=y,t[39]=V,t[40]=x,t[41]=c,t[42]=w,t[43]=le):le=t[43];let ue=le,de;t[44]===V?de=t[45]:(de=e=>{e||V()},t[44]=V,t[45]=de);let fe;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Z.jsx)(hi,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[46]=fe):fe=t[46];let pe=a!=null,me;t[47]!==z||t[48]!==j||t[49]!==k||t[50]!==x||t[51]!==C||t[52]!==u||t[53]!==l?(me=x&&!C&&k!=null?{onNewFile:()=>{z(),l(`file`,k)},onNewFolder:()=>{z(),l(`folder`,k)},templateItems:j?(0,Z.jsx)(gL,{parentDir:k,onSelectTemplate:e=>{z(),u(k,e)},ItemComponent:li}):void 0}:void 0,t[47]=z,t[48]=j,t[49]=k,t[50]=x,t[51]=C,t[52]=u,t[53]=l,t[54]=me):me=t[54];let he;t[55]!==V||t[56]!==L||t[57]!==ce||t[58]!==ae||t[59]!==a?(he=re?{label:se,ariaLabel:ce??void 0,disabled:!a,hint:ae,onSelect:()=>{if(!a)return;V();let e=Yc(a.contentDir,L,a.pathSeparator);re.shell.showItemInFolder(e)}}:void 0,t[55]=V,t[56]=L,t[57]=ce,t[58]=ae,t[59]=a,t[60]=he):he=t[60];let ge;t[61]!==V||t[62]!==o||t[63]!==I||t[64]!==_?(ge=_?void 0:(0,Z.jsx)(Ac,{input:I,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch,onBeforeLaunch:V}),t[61]=V,t[62]=o,t[63]=I,t[64]=_,t[65]=ge):ge=t[65];let _e;t[66]!==ee||t[67]!==V||t[68]!==K?(_e=ee?{onSelect:()=>{V(),K()}}:void 0,t[66]=ee,t[67]=V,t[68]=K,t[69]=_e):_e=t[69];let ve;t[70]!==V||t[71]!==L||t[72]!==a?(ve=()=>{a&&(V(),y2(Yc(a.contentDir,L,a.pathSeparator),`full`))},t[70]=V,t[71]=L,t[72]=a,t[73]=ve):ve=t[73];let ye;t[74]!==V||t[75]!==L?(ye=()=>{V(),y2(L,`relative`)},t[74]=V,t[75]=L,t[76]=ye):ye=t[76];let be;t[77]!==V||t[78]!==x||t[79]!==n||t[80]!==h||t[81]!==m||t[82]!==ne||t[83]!==J?(be=x?{onExpandAll:J?()=>{V(),m(n.path)}:void 0,onCollapseAll:ne?()=>{V(),h(n.path)}:void 0}:void 0,t[77]=V,t[78]=x,t[79]=n,t[80]=h,t[81]=m,t[82]=ne,t[83]=J,t[84]=be):be=t[84];let xe;t[85]!==V||t[86]!==_||t[87]!==x||t[88]!==C||t[89]!==f||t[90]!==b?(xe=!x&&!_&&!C?e=>{V(),f(b,e)}:void 0,t[85]=V,t[86]=_,t[87]=x,t[88]=C,t[89]=f,t[90]=b,t[91]=xe):xe=t[91];let Se;t[92]!==V||t[93]!==_||t[94]!==C||t[95]!==d||t[96]!==b?(Se=!_&&!C?()=>{V(),d(b)}:void 0,t[92]=V,t[93]=_,t[94]=C,t[95]=d,t[96]=b,t[97]=Se):Se=t[97];let Ce;t[98]!==z||t[99]!==C||t[100]!==n||t[101]!==s?(Ce=C?void 0:()=>{z(),s.startRenaming(n.path)},t[98]=z,t[99]=C,t[100]=n,t[101]=s,t[102]=Ce):Ce=t[102];let we;t[103]!==T||t[104]!==D||t[105]!==ue||t[106]!==C||t[107]!==w?(we=!C&&w?{label:D,disabled:!T,onSelect:ue}:void 0,t[103]=T,t[104]=D,t[105]=ue,t[106]=C,t[107]=w,t[108]=we):we=t[108];let Te;t[109]!==V||t[110]!==P||t[111]!==C||t[112]!==p?(Te=C?void 0:()=>{V(),p(P)},t[109]=V,t[110]=P,t[111]=C,t[112]=p,t[113]=Te):Te=t[113];let Ee;t[114]!==i||t[115]!==F||t[116]!==pe||t[117]!==me||t[118]!==he||t[119]!==ge||t[120]!==_e||t[121]!==ve||t[122]!==ye||t[123]!==be||t[124]!==xe||t[125]!==Se||t[126]!==Ce||t[127]!==we||t[128]!==Te?(Ee=(0,Z.jsx)(yi,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:(0,Z.jsx)(pL,{busy:i,deleteLabel:F,primitives:k2,workspaceReady:pe,folderCreate:me,reveal:he,openWithAi:ge,share:_e,onCopyFullPath:ve,onCopyRelativePath:ye,folderTree:be,onImportTemplate:xe,onDuplicate:Se,onRename:Ce,hide:we,onDelete:Te})}),t[114]=i,t[115]=F,t[116]=pe,t[117]=me,t[118]=he,t[119]=ge,t[120]=_e,t[121]=ve,t[122]=ye,t[123]=be,t[124]=xe,t[125]=Se,t[126]=Ce,t[127]=we,t[128]=Te,t[129]=Ee):Ee=t[129];let De;return t[130]!==de||t[131]!==Ee?(De=(0,Z.jsxs)(xi,{open:!0,modal:!1,onOpenChange:de,children:[fe,Ee]}),t[130]=de,t[131]=Ee,t[132]=De):De=t[132],De}function j2(e){return console.log(e)}function M2(e){return Ns.error(e)}function N2(e){return Ns.success(e)}function P2(e){let t=(0,$.c)(376),{ref:n}=e,{_:r,i18n:i}=on(),{activeDocName:a,activeTarget:s,closeTabs:c,closeDocument:l,isNewTabActive:u,openTarget:d,prewarm:f,reconcileLocalRemoval:p,reconcileLocalRename:m,setSkillsSidebar:h}=Oe(),{notifySidebarFileSelected:g}=xI(),{resolvedTheme:_}=Dn(),{addPage:v,pageMeta:y,pages:b}=Eu(),{okignoreBinding:x,merged:S}=xc(),C=S?.appearance?.sidebar?.showHiddenFiles??!1,w=S?.appearance?.sidebar?.showOnlyMarkdownFiles??!1,T=S?.appearance?.sidebar?.showOkFolders??!1,E=S?.editor?.previewTabs??!0?`preview`:`permanent`,D;t[0]===E?D=t[1]:(D={disposition:E,consumeActiveNewTab:!0},t[0]=E,t[1]=D);let O=D,k;t[2]===r?k=t[3]:(k=r({id:`8RtNI0`}),t[2]=r,t[3]=k);let A;t[4]===r?A=t[5]:(A=r({id:`HlmZBk`}),t[4]=r,t[5]=A);let j;t[6]===r?j=t[7]:(j=r({id:`34qyH5`}),t[6]=r,t[7]=j);let M;t[8]!==k||t[9]!==A||t[10]!==j?(M={fallbackErrorTitle:k,schemaMismatchTitle:A,couldNotReachServerTitle:j},t[8]=k,t[9]=A,t[10]=j,t[11]=M):M=t[11];let N;t[12]!==C||t[13]!==T||t[14]!==w||t[15]!==M?(N={showHiddenFiles:C,showOnlyMarkdownFiles:w,showOkFolders:T,messages:M},t[12]=C,t[13]=T,t[14]=w,t[15]=M,t[16]=N):N=t[16];let{documents:P,setDocuments:F,recordOptimisticAdd:I,loading:L,error:R,setError:z,reconnecting:B,relaunchInFlight:V,truncatedShownCount:H,unfilteredRootEntryCount:U,observeExpandedFolderPaths:W}=p2(N),ee;t[17]===y?ee=t[18]:(ee=function(e,t){return rp(e,t??y.get(e)?.size)??{kind:`doc`,target:e,docName:e}},t[17]=y,t[18]=ee);let G=ee,[K,q]=(0,Q.useState)(null),[te,J]=(0,Q.useState)(null),[ne,re]=(0,Q.useState)(null),[ie,ae]=(0,Q.useState)(null),{conflicts:oe}=Uu(),[se,ce]=(0,Q.useState)(null),[le,ue]=(0,Q.useState)(null),[de,fe]=(0,Q.useState)(!1),pe=(0,Q.useRef)(de),me;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(me=new Set,t[19]=me):me=t[19];let he=(0,Q.useRef)(me),ge=(0,Q.useRef)(P),_e=(0,Q.useRef)(y),ve=(0,Q.useRef)(null),ye;t[20]!==v||t[21]!==G||t[22]!==g||t[23]!==d||t[24]!==O||t[25]!==h?(ye=function(e){if(e.kind===`doc`)e.registerPage&&v(e.docName),d(G(e.docName,e.size),O),bf(Cf(e.docName));else if(e.kind===`folder`)d({kind:`folder`,target:e.folderPath,folderPath:e.folderPath},O),bf(Of(e.folderPath));else{let t=(e.entries??ge.current).find(t=>Xf(t)&&t.path===e.assetPath);d({kind:`asset`,target:e.assetPath,assetPath:e.assetPath,mediaKind:t?.mediaKind??null},O),bf(Sf(e.assetPath))}h(!1),g()},t[20]=v,t[21]=G,t[22]=g,t[23]=d,t[24]=O,t[25]=h,t[26]=ye):ye=t[26];let be=ye,xe;t[27]!==P||t[28]!==be||t[29]!==g||t[30]!==d||t[31]!==b||t[32]!==O?(xe=function(e,t){let n=t===void 0?P:t,r=h0(e,n);if(r.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,Ah(e));return}if(r.kind===`asset`){d({kind:`asset`,target:r.path,assetPath:r.path,mediaKind:r.mediaKind},O),bf(r.hash),g();return}if(r.kind===`folder`){be({kind:`folder`,folderPath:r.path});return}let i=n.find(e=>Wf(e)&&e.docName===r.path),a=dp(r.path,{pages:b,docExt:i?.docExt});if(a?.kind===`asset`){d(a,O),bf(Sf(a.assetPath)),g();return}if(a?.kind===`doc`){be({kind:`doc`,docName:a.docName});return}be({kind:`doc`,docName:r.path,size:i?.size,registerPage:Bf(r.path)})},t[27]=P,t[28]=be,t[29]=g,t[30]=d,t[31]=b,t[32]=O,t[33]=xe):xe=t[33];let Se=xe,Ce=(0,Q.useRef)(a),we;t[34]===P?we=t[35]:(we=new Set(P.filter(Xf).map(s4)),t[34]=P,t[35]=we);let Te=we,Ee=(0,Q.useRef)(Te),De;t[36]===P?De=t[37]:(De=q1(P),t[36]=P,t[37]=De);let ke=De,Ae=(0,Q.useRef)(ke),je;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(je=[],t[38]=je):je=t[38];let Me=(0,Q.useRef)(je),Ne=(0,Q.useRef)(null),Pe=(0,Q.useRef)(o4),Fe=(0,Q.useRef)(null),Ie=(0,Q.useRef)(null),Le=(0,Q.useRef)(!1),Re=(0,Q.useRef)(!1),ze=(0,Q.useRef)(null),Be;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(Be={row:null,root:null},t[39]=Be):Be=t[39];let He=(0,Q.useRef)(Be),Ue=(0,Q.useRef)(a4),We=(0,Q.useRef)(null),Ke=(0,Q.useRef)(null),qe=(0,Q.useRef)(i4),Je=(0,Q.useRef)(!1),Ye=(0,Q.useRef)(null),Xe=(0,Q.useRef)(r4),Ze=(0,Q.useRef)(n4),Qe=(0,Q.useRef)(t4),$e=(0,Q.useRef)(e4),et=(0,Q.useRef)(s),[tt,nt]=(0,Q.useState)(!1),rt,it;t[40]!==P.length||t[41]!==L?(rt=()=>{if(L||P.length===0)return;let e=Ye.current?.querySelector(JW)?.shadowRoot;if(!e)return;let t=e,n=function(){ze.current!==null&&clearTimeout(ze.current),ze.current=setTimeout(()=>{Re.current=!1,ze.current=null},0)},r=function(e){if(!(e instanceof DragEvent))return;let t=l4(e),n=t?.dataset.itemPath;if(!n)return;let r=k0(t.dataset.itemType===`folder`?Uh(n):n,ge.current,_e.current);r&&(ze.current!==null&&(clearTimeout(ze.current),ze.current=null),Re.current=!0,e.dataTransfer?.setData(Eh,Bh(r)))},i=function(e){e instanceof DragEvent&&Oh(e.dataTransfer)&&e.dataTransfer&&(e.dataTransfer.effectAllowed=`copyMove`)},a=function(e){if(!(e instanceof DragEvent)||!Rh(e))return;let t=d4(e);if(!t){_2(He);return}e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`),v2(He,t)},o=function(e){if(!(e instanceof DragEvent)||!Rh(e))return;let n=e.relatedTarget;n instanceof Node&&t.contains(n)||_2(He)},s=function(e){if(!(e instanceof DragEvent)||!Rh(e))return;let t=d4(e),n=Ih(e);if(!t||n.length===0){_2(He);return}e.preventDefault(),e.stopPropagation(),_2(He),Ue.current(n,t.parentDir,t.busyPath)};return e.addEventListener(`dragstart`,r,{capture:!0}),e.addEventListener(`dragstart`,i),e.addEventListener(`dragover`,a,{capture:!0}),e.addEventListener(`dragleave`,o,{capture:!0}),e.addEventListener(`drop`,s,{capture:!0}),e.addEventListener(`dragend`,n,{capture:!0}),window.addEventListener(`drop`,n,!0),window.addEventListener(`dragend`,n,!0),()=>{e.removeEventListener(`dragstart`,r,{capture:!0}),e.removeEventListener(`dragstart`,i),e.removeEventListener(`dragover`,a,{capture:!0}),e.removeEventListener(`dragleave`,o,{capture:!0}),e.removeEventListener(`drop`,s,{capture:!0}),e.removeEventListener(`dragend`,n,{capture:!0}),window.removeEventListener(`drop`,n,!0),window.removeEventListener(`dragend`,n,!0),_2(He),ze.current!==null&&(clearTimeout(ze.current),ze.current=null),Re.current=!1}},it=[P.length,L],t[40]=P.length,t[41]=L,t[42]=rt,t[43]=it):(rt=t[42],it=t[43]),(0,Q.useEffect)(rt,it);let{selectedFilePath:at,selectedFolderPath:ot,navigationPath:st}=m0(s,u?null:a),ct=at?Jh(at,P.find(e=>Wf(e)&&e.docName===at)?.docExt):ot?Uh(ot):s?.kind===`asset`?s.assetPath:null,lt=de?null:ct,ut=qn().states,{dispatch:dt}=Tc(),ft;t[44]!==dt||t[45]!==ut?(ft={installStates:ut,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:dt},t[44]=dt,t[45]=ut,t[46]=ft):ft=t[46];let pt=ft,ht;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(ht=()=>We.current===null,t[47]=ht):ht=t[47];let gt=ht,_t;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(_t=[],t[48]=_t):_t=t[48];let vt;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(vt={set:`complete`,spriteSheet:O1,byFileExtension:{md:{name:w1,viewBox:Ge},mdx:{name:w1,viewBox:Ge}}},t[49]=vt):vt=t[49];let yt;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(yt={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[50]=yt):yt=t[50];let bt;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(bt={canDrag:gt,canDrop:gt,onDropComplete:e=>$e.current(e),onDropError:$2},t[51]=bt):bt=t[51];let xt,St;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(xt={canRename:gt,onRename:e=>Ze.current(e),onError:e=>Qe.current(e)},St=e=>Xe.current(e),t[52]=xt,t[53]=St):(xt=t[52],St=t[53]);let Ct;t[54]===r?Ct=t[55]:(Ct={paths:_t,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,...r1,icons:vt,unsafeCSS:O2,composition:yt,dragAndDrop:bt,renaming:xt,onSelectionChange:St,renderRowDecoration:e=>{let{item:t}=e;if(t.kind===`file`){let e=Ae.current.docsByTreePath.get(t.path);if(e?.isSymlink){let t=e.targetPath;return{icon:S1,title:r(t?{id:`JE21eh`,values:{targetPath:t}}:{id:`BQu9Pg`})}}return N1(t.path)?{icon:C1,title:r({id:`i9toLO`})}:null}let n=Ae.current.foldersByTreeDirectoryPath.get(Uh(t.path));if(n?.isSymlink){let e=n.targetPath;return{icon:S1,title:r(e?{id:`JE21eh`,values:{targetPath:e}}:{id:`BQu9Pg`})}}return null}},t[54]=r,t[55]=Ct);let{model:wt}=t1(Ct),Tt;t[56]===wt?Tt=t[57]:(Tt=function(e){let t=wt.getItem(e)??wt.getItem(Uh(e));return t?.isDirectory()?Uh(Nh(t.getPath())):e},t[56]=wt,t[57]=Tt);let Et=Tt,Dt,Ot;t[58]===P?(Dt=t[59],Ot=t[60]):(Ot=Ph(P),Dt=Qh(Ot),t[58]=P,t[59]=Dt,t[60]=Ot);let kt=Dt,At=(0,Q.useRef)(Ot),jt;t[61]!==P||t[62]!==T?(jt=Wh(P,{includeOkFolders:T}),t[61]=P,t[62]=T,t[63]=jt):jt=t[63];let Mt=jt,Nt=(0,Q.useRef)(Mt),Pt=ot?qh(Uh(ot)).slice(0,-1):qh(lt??st),Ft=Pt.join(`\0`),It;t[64]===wt?It=t[65]:(It=()=>{let e=new Set;for(let t of Nt.current)L0(wt.getItem(t))?.isExpanded()&&e.add(t);return e},t[64]=wt,t[65]=It);let Lt=It,Rt;t[66]===Lt?Rt=t[67]:(Rt=e=>{let t=new Set(Wh(e??ge.current,{includeOkFolders:Je.current})),n=Lt();for(let e of Me.current)n.add(e);return[...n].filter(e=>t.has(e))},t[66]=Lt,t[67]=Rt);let zt=Rt,Bt;t[68]!==zt||t[69]!==wt?(Bt=e=>{let t=Ph(e??ge.current);wt.resetPaths(t,{initialExpandedPaths:zt(e)})},t[68]=zt,t[69]=wt,t[70]=Bt):Bt=t[70];let Vt=Bt,Ht;t[71]!==wt||t[72]!==Vt?(Ht=(e,t,n,r)=>{let i=r===void 0?[]:r,a=0,o=null;for(let{fromDocName:r,toDocName:i}of n){let n=e.find(e=>Wf(e)&&e.docName===r);if(n==null||wt.getItem(i)==null)continue;let s=Jh(i,t.find(e=>Wf(e)&&e.docName===i)?.docExt??n.docExt);wt.move(i,s),o=s,a+=1}for(let{toPath:e}of i){let t=Hf(e);if(t===``)continue;let n=e.slice(0,-t.length);wt.getItem(n)!=null&&(wt.getItem(e)??wt.move(n,e),o=e,a+=1)}a!==0&&(Vt(t),o!=null&&wt.focusPath(o))},t[71]=wt,t[72]=Vt,t[73]=Ht):Ht=t[73];let Ut=Ht,Wt;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(Wt=e=>{Fe.current=Hh(e)},t[74]=Wt):Wt=t[74];let Gt=Wt,Kt;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(Kt=e=>Ee.current.has(e),t[75]=Kt):Kt=t[75];let qt=Kt,Jt;t[76]!==r||t[77]!==v||t[78]!==be||t[79]!==Vt||t[80]!==F||t[81]!==z?(Jt=async function(e){if(e.kind===`asset`||We.current!==null)return;let t=()=>{q(null),We.current=null};We.current=e.path,q(e.path),z(null);try{let n=await o(await fetch(`/api/duplicate-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.path})}),r({id:`dw_dUJ`}));if(!n.ok){Ns.error(n.title),Vt(),t();return}let i=Ve(Fa,n.body,`duplicate-path`,null);if(i===null){let e=r({id:`67f-3g`});Ns.error(e),z(e),Fs([`files`,`backlinks`,`graph`]),Vt(),t();return}for(let e of i.duplicatedDocNames)v(e);F(t=>{let n=JL(t,e,i);return Vt(n),Gt(n),n}),Fs([`files`,`backlinks`,`graph`]),i.path!==e.path&&(i.kind===`folder`?be({kind:`folder`,folderPath:i.path}):be({kind:`doc`,docName:i.path})),Ns.success(i.kind===`folder`?r({id:`iilQXA`}):r({id:`A6h5b-`}),{description:i.path}),t()}catch(e){let n=e,i=n instanceof Error?n.message:String(n);console.warn(`[FileTree] duplicate failed:`,n),Ns.error(r({id:`EBVbtP`}),{description:i}),Vt(),t()}},t[76]=r,t[77]=v,t[78]=be,t[79]=Vt,t[80]=F,t[81]=z,t[82]=Jt):Jt=t[82];let Yt=Jt,Xt=(0,Q.useRef)(Yt),Zt;t[83]===Yt?Zt=t[84]:(Zt=()=>{Xt.current=Yt},t[83]=Yt,t[84]=Zt),(0,Q.useEffect)(Zt);let Qt=function(e){let t=A1(e);if(!t||j1(t))return!1;let n=wt.getFocusedPath()??wt.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||qt(n))return!1;let r=j1(n);if(!r)return!1;let i=Uh(t);if(!Nt.current.includes(i))return!1;let a=`${t}${r}`;return At.current.includes(a)?!1:(Tn({sourcePath:n,destinationPath:a,isFolder:!1}),wt.move(n,a),!0)},$t;t[85]===Symbol.for(`react.memo_cache_sentinel`)?($t=e=>{let t=e??Ne.current;!t||Ne.current!==t||(t.disposeCommitListener(),Ne.current=null)},t[85]=$t):$t=t[85];let en=$t,tn;t[86]!==r||t[87]!==en||t[88]!==l||t[89]!==c||t[90]!==Vt||t[91]!==F?(tn=async function(e,t){let n=t===void 0?{}:t,i=n.updateUi??!0,a=n.restoreLocation??i;en(e),i&&q(e.renamePath);try{let t=await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.createdPath})});if(!t.ok&&t.status!==404){let n=e.kind,a=e.createdPath,s=await o(t,r({id:`EcM3k7`,values:{kind:n}}));if(s.ok)return;let c=s.title,l=r({id:`YPFBfr`,values:{detail:c,kind:n,createdPath:a}});i?Ns.error(l):console.warn(`[FileTree] cleanup pending create failed: ${l}`),i&&(q(null),Vt());return}}catch(t){if(console.warn(`[FileTree] cleanup pending create failed:`,t),i){let t=e.kind,n=e.createdPath;Ns.error(r({id:`_TDESN`,values:{kind:t,createdPath:n}}))}i&&(q(null),Vt());return}i&&(e.kind===`file`?l(e.createdPath):c([op(e.createdPath)],{force:!0})),i&&F(t=>{let n=KL(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return Gt(n),n}),Fs([`files`,`backlinks`,`graph`]),a&&(window.location.hash=e.previousHash),i&&q(null)},t[86]=r,t[87]=en,t[88]=l,t[89]=c,t[90]=Vt,t[91]=F,t[92]=tn):tn=t[92];let nn=tn,rn,an;t[93]===Symbol.for(`react.memo_cache_sentinel`)?(rn=()=>()=>{let e=Ne.current;e&&Pe.current(e,{restoreLocation:!1,updateUi:!1}).catch(Q2)},an=[],t[93]=rn,t[94]=an):(rn=t[93],an=t[94]),(0,Q.useEffect)(rn,an);let sn,cn;t[95]===Symbol.for(`react.memo_cache_sentinel`)?(sn=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=Ve(So,n,`workspace`,null);r&&ue({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(Z2),()=>{e=!1}},cn=[],t[95]=sn,t[96]=cn):(sn=t[95],cn=t[96]),(0,Q.useEffect)(sn,cn);let ln;t[97]!==zt||t[98]!==wt||t[99]!==kt?(ln=()=>{if(Fe.current===kt){Fe.current=null;return}wt.resetPaths(At.current,{initialExpandedPaths:zt()})},t[97]=zt,t[98]=wt,t[99]=kt,t[100]=ln):ln=t[100];let un;t[101]!==wt||t[102]!==kt?(un=[wt,kt],t[101]=wt,t[102]=kt,t[103]=un):un=t[103],(0,Q.useEffect)(ln,un),B0(wt,lt,Ft,Le,kt);let dn;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(dn=()=>{fe(!1)},t[104]=dn):dn=t[104];let fn;t[105]===ct?fn=t[106]:(fn=[ct],t[105]=ct,t[106]=fn),(0,Q.useEffect)(dn,fn);let pn,mn;t[107]===de?(pn=t[108],mn=t[109]):(pn=()=>{pe.current=de;for(let e of he.current)e()},mn=[de],t[107]=de,t[108]=pn,t[109]=mn),(0,Q.useEffect)(pn,mn);let hn;t[110]!==lt||t[111]!==L||t[112]!==wt?(hn=()=>{L||!lt||f0(wt,lt)},t[110]=lt,t[111]=L,t[112]=wt,t[113]=hn):hn=t[113];let gn;t[114]!==Ft||t[115]!==lt||t[116]!==L||t[117]!==wt||t[118]!==kt?(gn=[lt,Ft,kt,L,wt],t[114]=Ft,t[115]=lt,t[116]=L,t[117]=wt,t[118]=kt,t[119]=gn):gn=t[119],(0,Q.useEffect)(hn,gn);let _n,vn;t[120]===wt?(_n=t[121],vn=t[122]):(_n=()=>wt.subscribe(()=>{if(!wt.isSearchOpen())for(let e of Me.current){let t=L0(wt.getItem(e));t&&!t.isExpanded()&&t.expand()}}),vn=[wt],t[120]=wt,t[121]=_n,t[122]=vn),(0,Q.useEffect)(_n,vn);let yn;t[123]!==Lt||t[124]!==wt?(yn=()=>wt.subscribe(()=>{qe.current([...Lt()])}),t[123]=Lt,t[124]=wt,t[125]=yn):yn=t[125];let bn;t[126]===wt?bn=t[127]:(bn=[wt],t[126]=wt,t[127]=bn),(0,Q.useEffect)(yn,bn);let xn,Sn;t[128]===wt?(xn=t[129],Sn=t[130]):(xn=()=>wt.onMutation(`remove`,e=>{let t=Ne.current;!t||e.path!==t.renamePath||Pe.current(t)}),Sn=[wt],t[128]=wt,t[129]=xn,t[130]=Sn),(0,Q.useEffect)(xn,Sn);let Cn;t[131]!==v||t[132]!==be||t[133]!==m||t[134]!==Ut||t[135]!==F?(Cn=async(e,t,n,r,i)=>{let a=t===void 0?[]:t,o=n===void 0?[]:n,s=i===void 0?[]:i,c=r?.docName??Ce.current,l=new Map,u=new Map;for(let e of ge.current){if(Wf(e)){let t=o.find(t=>t.fromPath===Jh(e.docName,e.docExt))?.toPath;t&&l.set(e.docName,t);continue}if(Xf(e)){let t=o.find(t=>t.fromPath===e.path)?.toPath;t&&Bf(t)&&u.set(e.path,$h(t))}}let d=c?l.get(c)??null:null,f=r?.folderPath??(et.current?.kind===`folder`?et.current.folderPath:null),p=f?Qf(f,a):null,h=r?.assetPath??(et.current?.kind===`asset`?et.current.assetPath:null),g=h?u.get(h)??null:null,_=d?null:g??YL(c,e),y=d??(h?g?null:o.find(e=>e.fromPath===h)?.toPath??Qf(h,a):null);await m({renamed:e,renamedFolders:a,renamedAssets:o,additionalRemovedDocNames:[...l.keys()]});for(let t of e)v(t.toDocName);for(let e of u.values())v(e);let b=null;F(t=>{let n=GL(t,e,a,o,s);return b=n,Ut(t,n,e,o),Gt(n),n}),f&&p&&p!==f?be({kind:`folder`,folderPath:p}):_&&_!==c?(be({kind:`doc`,docName:_}),g2(_)):y&&(d||y!==h)&&be({kind:`asset`,assetPath:y,entries:b??ge.current}),Fs([`files`,`backlinks`,`graph`])},t[131]=v,t[132]=be,t[133]=m,t[134]=Ut,t[135]=F,t[136]=Cn):Cn=t[136];let wn=Cn;async function Tn(e){let t=!e.isFolder&&qt(e.sourcePath),n=t?e.sourcePath:Lh(e.sourcePath,e.isFolder);q(n),z(null);try{let i=Vf(e.sourcePath,e.destinationPath,e.isFolder),a=!e.isFolder&&!t&&!Bf(i.destinationPath),s=t||a?i.destinationPath:Lh(i.destinationPath,e.isFolder),c=e.isFolder?{kind:`folder`,fromPath:Nh(n),toPath:Nh(s)}:t||a?{kind:`asset`,fromPath:n,toPath:s}:{kind:`file`,fromPath:kh(n,ge.current),toPath:s},l={docName:Ce.current,folderPath:et.current?.kind===`folder`?et.current.folderPath:null,assetPath:et.current?.kind===`asset`?et.current.assetPath:null},u=await o(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(c)}),r({id:`gijbne`}));if(!u.ok){Ns.error(u.title),Vt();let e=Ne.current;e&&e.renamePath===n?await nn(e):en(),q(null);return}let d=Ve(qa,u.body,`rename-path`,{renamed:[],renamedAssets:[]});try{await wn(d.renamed,e.isFolder?[{fromPath:Nh(n),toPath:Nh(s)}]:[],d.renamedAssets,l,!e.isFolder&&!t&&!a?d.renamed.flatMap(e=>{let t=Hf(s);return t?[{toDocName:e.toDocName,docExt:t}]:[]}):[])}catch(e){console.warn(`[FileTree] post-rename reconciliation failed`,{err:e,sourceTreePath:n,destinationTreePath:s,renamedCount:d.renamed.length,renamedAssetCount:d.renamedAssets.length}),Ns.error(r({id:`dDpCOp`}))}en(),q(null)}catch(e){console.warn(`[FileTree] rename failed:`,e);let t=r({id:`HIb0vl`});Ns.error(t),z(t),Vt();let i=Ne.current;i&&i.renamePath===n?await nn(i):en(),q(null)}}let En=(0,Q.useEffectEvent)(Tn),On;t[137]!==r||t[138]!==wn||t[139]!==Vt||t[140]!==z?(On=async function(e){let t=e.draggedPaths.map(t=>{let n=zh(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(X2);if(t.length!==0){q(t[0]?.sourcePath??null),z(null);try{let e=[],n=[],i=[],a={docName:Ce.current,folderPath:et.current?.kind===`folder`?et.current.folderPath:null,assetPath:et.current?.kind===`asset`?et.current.assetPath:null};for(let a of t){let t=a.sourcePath.endsWith(`/`),s=!t&&qt(a.sourcePath),c=s?null:kh(a.sourcePath,ge.current),l=t?{kind:`folder`,fromPath:Nh(a.sourcePath),toPath:Nh(a.destinationTreePath)}:s?{kind:`asset`,fromPath:a.sourcePath,toPath:a.destinationTreePath}:{kind:`file`,fromPath:c??$h(a.sourcePath),toPath:c&&Bf(c)?a.destinationTreePath:$h(a.destinationTreePath)},u=await o(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(l)}),r({id:`dOHMA0`}));if(!u.ok){Ns.error(u.title),Vt(),q(null);return}let d=Ve(qa,u.body,`rename-path:drop`,{renamed:[],renamedAssets:[]});e=e.concat(d.renamed),n=n.concat(d.renamedAssets),t&&i.push({fromPath:Nh(a.sourcePath),toPath:Nh(a.destinationTreePath)})}try{await wn(e,i,n,a)}catch(i){console.warn(`[FileTree] post-move reconciliation failed`,{err:i,operationCount:t.length,renamedCount:e.length,renamedAssetCount:n.length}),Ns.error(r({id:`8OxKZy`}))}q(null)}catch(e){console.warn(`[FileTree] move failed:`,e),Ns.error(r({id:`HIb0vl`})),Vt(),q(null)}}},t[137]=r,t[138]=wn,t[139]=Vt,t[140]=z,t[141]=On):On=t[141];let kn=On,An;t[142]!==r||t[143]!==v||t[144]!==I||t[145]!==Vt||t[146]!==F||t[147]!==z?(An=async function(e,t,n){if(e.length===0||We.current!==null)return;let i=()=>{We.current=null,q(null)};We.current=n,q(n),z(null);let a=[],s=0,c=0;for(let n of e){let e=new FormData;e.append(`file`,n),Yh(e,t,n.name||`upload`);try{let i=await o(await fetch(`/api/upload`,{method:`POST`,body:e}),r({id:`4Gz2wC`}));if(!i.ok){c+=1,Ns.error(i.title,{description:n.name});continue}let l=Ve(na,i.body,`upload:drop`,null);if(l===null){c+=1,Ns.error(r({id:`4Gz2wC`}),{description:n.name});continue}let u=Dh(t,l);if(l.deduped===!0){c+=1,Ns.error(r({id:`4sKwf6`}),{description:u});continue}s+=1;let d=Xh(u,n);d&&a.push(d)}catch(e){let t=e;c+=1,console.warn(`[FileTree] external file upload failed:`,t),Ns.error(t instanceof TypeError?r({id:`HIb0vl`}):r({id:`4Gz2wC`}),{description:n.name})}}try{if(a.length>0){for(let e of a)Wf(e)&&v(e.docName);F(e=>{let t=new Set(e.map(Fh)),n=!1,r=[...e];for(let e of a){let i=Fh(e);I(e),!t.has(i)&&(t.add(i),r.push(e),n=!0)}return n?(Vt(r),Gt(r),r):e})}s>0&&(Fs([`files`,`backlinks`,`graph`]),Ns.success(Ms._({id:`v75Em9`,values:{uploadedCount:s}}),{description:t||r({id:`RSqaSd`})})),c>0&&z(s>0?Ms._({id:`yH7T4q`,values:{failedCount:c}}):r({id:`4Gz2wC`})),i()}catch(e){let t=e,n=r({id:`VcqWBy`});console.warn(`[FileTree] upload post-upload reconciliation failed:`,t),Ns.error(n),z(n),i()}},t[142]=r,t[143]=v,t[144]=I,t[145]=Vt,t[146]=F,t[147]=z,t[148]=An):An=t[148];let jn=An,Mn;t[149]===Symbol.for(`react.memo_cache_sentinel`)?(Mn=function(e){ce({parentDir:e})},t[149]=Mn):Mn=t[149];let Nn=Mn,Pn;t[150]!==r||t[151]!==v||t[152]!==nn||t[153]!==en||t[154]!==wt||t[155]!==be||t[156]!==I||t[157]!==Vt||t[158]!==F||t[159]!==Ot?(Pn=async function(e,t,n){if(We.current)return;let i=Ne.current;i&&en(i);try{let i=Gh(e,t,[...Ot,...Nt.current]);q(i.renamePath),We.current=i.renamePath;let a=window.location.hash,s;if(e===`file`){let e=Mh(`file`,i.addPath),t={path:e};n?.template&&(t.template=n.template);let a=await o(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),r({id:`fJgQHX`}));if(!a.ok){Ns.error(a.title),q(null),We.current=null;return}let c=$h(e),l=Ve(cs,a.body,`create-page`,{docName:c}).docName;s=l;let u={kind:`document`,docName:l,docExt:e.toLowerCase().endsWith(`.mdx`)?`.mdx`:`.md`,modified:new Date().toISOString(),size:0};v(l),F(e=>{if(e.some(e=>Wf(e)&&e.docName===l))return e;let t=[...e,u];return Gt(t),I(u),t}),Fs([`files`,`backlinks`,`graph`]),be({kind:`doc`,docName:l})}else{let e=Nh(i.addPath),t=await o(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),r({id:`K1ckLX`}));if(!t.ok){Ns.error(t.title),q(null),We.current=null;return}s=Ve(sa,t.body,`create-folder`,{path:e}).path;let n={kind:`folder`,path:s,modified:new Date().toISOString(),size:0};F(e=>{if(e.some(e=>qf(e)&&e.path===s))return e;let t=[...e,n];return Gt(t),I(n),t}),Fs([`files`]),be({kind:`folder`,folderPath:s})}let c=!1,l=e=>{if(e.key!==`Enter`||rr())return;let t=Ne.current;!t||t.renamePath!==i.renamePath||queueMicrotask(()=>en(t))};document.addEventListener(`keydown`,l,!0),Ne.current={kind:e,renamePath:i.renamePath,createdPath:s,previousHash:a,disposeCommitListener:()=>{c||(c=!0,document.removeEventListener(`keydown`,l,!0))}},q(null),We.current=null,wt.add(i.addPath),wt.startRenaming(i.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),Ns.error(r({id:`S6l5dv`}));let t=Ne.current;t?await nn(t):en(),q(null),We.current=null,Vt()}},t[150]=r,t[151]=v,t[152]=nn,t[153]=en,t[154]=wt,t[155]=be,t[156]=I,t[157]=Vt,t[158]=F,t[159]=Ot,t[160]=Pn):Pn=t[160];let Fn=Pn,In;t[161]===wt?In=t[162]:(In=function(e){let t=Uh(e);(0,Q.startTransition)(()=>{for(let e of Nt.current)if(e===t||e.startsWith(t)){let t=L0(wt.getItem(e));t&&t.expand()}})},t[161]=wt,t[162]=In);let Ln=In,Rn;t[163]===wt?Rn=t[164]:(Rn=function(e){let t=Uh(e),n=new Set(Me.current);(0,Q.startTransition)(()=>{for(let e of[...Nt.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=L0(wt.getItem(e));t&&t.collapse()}})},t[163]=wt,t[164]=Rn);let zn=Rn,Vn;t[165]===Symbol.for(`react.memo_cache_sentinel`)?(Vn=function(){return((Ye.current?.querySelector(`file-tree-container`)?.shadowRoot)?.querySelector(`[aria-selected="true"][data-item-path]`))?.dataset.itemPath??null},t[165]=Vn):Vn=t[165];let Un=Vn,Wn;t[166]!==Se||t[167]!==Pt||t[168]!==a||t[169]!==s||t[170]!==Te||t[171]!==K||t[172]!==nn||t[173]!==P||t[174]!==Mt||t[175]!==kn||t[176]!==Tn||t[177]!==Et||t[178]!==W||t[179]!==y||t[180]!==Qt||t[181]!==ke||t[182]!==T||t[183]!==Ot||t[184]!==jn?(Wn=()=>{ge.current=P,Ae.current=ke,_e.current=y,Ce.current=a,et.current=s,Ee.current=Te,We.current=K,Je.current=T,At.current=Ot,Nt.current=Mt,Me.current=Pt,qe.current=W,Pe.current=nn,Ue.current=(e,t,n)=>{jn(e,t,n)},Xe.current=e=>{if(Le.current||Re.current||e.length!==1)return;let t=e[0];if(t){fe(!1);let e=Et(t),n=ve.current,r=n!==null&&$h(n)===$h(e),i=r?n:e;ve.current=null,queueMicrotask(()=>{Se(Et((r?null:Un())??i),ge.current)})}},Qe.current=e=>{Qt(e)||Ns.error(e)},Ze.current=Tn,$e.current=kn},t[166]=Se,t[167]=Pt,t[168]=a,t[169]=s,t[170]=Te,t[171]=K,t[172]=nn,t[173]=P,t[174]=Mt,t[175]=kn,t[176]=Tn,t[177]=Et,t[178]=W,t[179]=y,t[180]=Qt,t[181]=ke,t[182]=T,t[183]=Ot,t[184]=jn,t[185]=Wn):Wn=t[185],(0,Q.useLayoutEffect)(Wn);let Gn,Kn;t[186]===wt?(Gn=t[187],Kn=t[188]):(Gn=()=>{let e=e=>{let t=(e.metaKey||e.ctrlKey)&&!e.altKey,n=e.key.toLowerCase(),r=t&&n===`a`,i=t&&!e.shiftKey&&n===`d`,a=t&&!e.shiftKey&&n===`c`,o=t&&!e.shiftKey&&n===`v`,s=!e.altKey&&!e.shiftKey&&(e.metaKey&&!e.ctrlKey&&n===`backspace`||!e.metaKey&&!e.ctrlKey&&n===`delete`);if(!r&&!i&&!a&&!o&&!s||W1(e.target))return;let c=Ye.current,l=e.target,u=document.activeElement,d=l instanceof Node&&c?.contains(l),f=u instanceof Node&&c?.contains(u);if(!d&&!f)return;if(a){let t=V1(wt,ge.current,Ee.current);if(!t)return;Ke.current=t,e.preventDefault(),e.stopPropagation();return}if(o){let t=Ke.current;if(!t)return;Xt.current(t),e.preventDefault(),e.stopPropagation();return}if(i){let t=V1(wt,ge.current,Ee.current);if(!t)return;Xt.current(t),e.preventDefault(),e.stopPropagation();return}if(s){if(We.current!==null)return;let t=H1(wt,ge.current);if(t.length===0)return;J({targets:t}),e.preventDefault(),e.stopPropagation();return}let p=new Set([...Nt.current,...At.current]);Le.current=!0;for(let e of p)e&&wt.getItem(e)?.select();queueMicrotask(()=>{Le.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},Kn=[wt],t[186]=wt,t[187]=Gn,t[188]=Kn),(0,Q.useEffect)(Gn,Kn);let Yn,Xn;t[189]!==P.length||t[190]!==L?(Yn=()=>{if(L||P.length===0)return;let e=Ye.current?.querySelector(JW)?.shadowRoot;if(!e)return;let t=Y2,n=()=>{for(let n of e.querySelectorAll(`[data-item-path]`)){let e=n.dataset.itemPath;if(!e)continue;let r=t(e);n.title!==r&&(n.title=r)}let n=e.querySelector(`[data-type="context-menu-anchor"]`);if(n){let r=e.querySelector(`[data-item-context-hover="true"][data-item-path]`)?.dataset.itemPath,i=r?t(r):``;n.title!==i&&(n.title=i)}};n();let r=new MutationObserver(n);return r.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`,`data-item-context-hover`]}),()=>r.disconnect()},Xn=[L,P.length],t[189]=P.length,t[190]=L,t[191]=Yn,t[192]=Xn):(Yn=t[191],Xn=t[192]),(0,Q.useEffect)(Yn,Xn);let Zn,Qn;t[193]!==P.length||t[194]!==L?(Zn=()=>{if(L||P.length===0)return;let e=Ye.current?.querySelector(JW)?.shadowRoot;if(!e)return;let t=()=>f1(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},Qn=[L,P.length],t[193]=P.length,t[194]=L,t[195]=Zn,t[196]=Qn):(Zn=t[195],Qn=t[196]),(0,Q.useEffect)(Zn,Qn);let $n=S?.validation?.fileTreeIndicators!==!1,er,tr;t[197]!==P.length||t[198]!==L||t[199]!==$n?(er=()=>{if(L||P.length===0)return;let e=Ye.current?.querySelector(JW)?.shadowRoot;if(!e)return;if(!$n){Z1(e,new Map);return}let t=()=>Z1(e,_u());t();let n=new MutationObserver(t);n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]});let r=ru(t);return()=>{n.disconnect(),r()}},tr=[L,P.length,$n],t[197]=P.length,t[198]=L,t[199]=$n,t[200]=er,t[201]=tr):(er=t[200],tr=t[201]),(0,Q.useEffect)(er,tr);let nr,ir;t[202]!==P.length||t[203]!==L?(nr=()=>{if(L||P.length===0)return;let e=Ye.current?.querySelector(JW)?.shadowRoot;if(!e)return;let t=()=>s0(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},ir=[L,P.length],t[202]=P.length,t[203]=L,t[204]=nr,t[205]=ir):(nr=t[204],ir=t[205]),(0,Q.useEffect)(nr,ir);let ar;t[206]===Symbol.for(`react.memo_cache_sentinel`)?(ar={folderCount:0,expandedCount:0},t[206]=ar):ar=t[206];let or=(0,Q.useRef)(ar),sr=(0,Q.useRef)(Fn),cr=(0,Q.useRef)(Nn),lr;t[207]===Fn?lr=t[208]:(lr=()=>{sr.current=Fn,cr.current=Nn},t[207]=Fn,t[208]=lr),(0,Q.useEffect)(lr);let ur,dr;t[209]===wt?(ur=t[210],dr=t[211]):(ur=()=>({startCreating(e,t){sr.current(e,t)},startCreatingFromTemplate(e){cr.current(e)},createFromTemplate(e,t){sr.current(`file`,e,{template:t})},expandAll(){(0,Q.startTransition)(()=>{for(let e of Nt.current){let t=L0(wt.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(Me.current);(0,Q.startTransition)(()=>{for(let t of[...Nt.current].reverse()){if(e.has(t))continue;let n=L0(wt.getItem(t));n&&n.collapse()}})},getFolderState(){let e=Nt.current,t=0;for(let n of e)L0(wt.getItem(n))?.isExpanded()&&t++;let n=e.length,r=or.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return or.current=i,i},isCreationTargetCleared(){return pe.current},subscribe(e){he.current.add(e);let t=wt.subscribe(e);return()=>{he.current.delete(e),t()}}}),dr=[wt],t[209]=wt,t[210]=ur,t[211]=dr),(0,Q.useImperativeHandle)(n,ur,dr);let fr;t[212]!==en||t[213]!==wt||t[214]!==p||t[215]!==F?(fr=async function(e,t,n){let r=G1(e,ge.current,Nt.current),i=Ne.current;i&&e.some(e=>K1(e,i))&&(i.kind===`file`?r.docNames.add(i.createdPath):r.folderPaths.add(i.createdPath),en(i));let a=new Set([...r.docNames,...t]),o=new Set([...r.folderPaths,...n]),s=new Set([...r.assetPaths,...e.filter(J2).map(q2)]);await p({tabIdsToClose:[...[...a].map(K2),...[...o].map(G2),...[...s].map(W2)],docNamesToClear:[...a]});for(let t of e){let e=t.kind===`folder`?Uh(t.path):t.kind===`asset`?t.path:Jh(t.path,t.docExt);wt.getItem(e)&&wt.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}F(e=>{let t=KL(e,[...a],void 0,[...s]);for(let e of o)t=KL(t,[],e);return Gt(t),t}),Fs([`files`,`backlinks`,`graph`])},t[212]=en,t[213]=wt,t[214]=p,t[215]=F,t[216]=fr):fr=t[216];let pr=fr,mr;t[217]!==r||t[218]!==pr||t[219]!==Vt||t[220]!==F||t[221]!==z?(mr=async function(e,t){if(We.current!==null)return;let n=()=>{q(null),We.current=null,re(null)};We.current=e.path,q(e.path),z(null);let i=e.path,a=i.lastIndexOf(`/`),o=a===-1?``:i.slice(0,a),s=await vd({sourcePath:e.path,targetFolder:o,deleteSource:t});if(!s.ok){Ns.error(r({id:`rDOuNw`}),{description:s.error}),n();return}t&&(await pr([e],[e.path],[]),F(t=>{let n=t.filter(t=>!(Wf(t)&&t.docName===e.path));return Vt(n),Gt(n),n}),Fs([`files`,`backlinks`,`graph`])),Ns.success(r({id:`Ba4D2x`}),{description:s.path}),n()},t[217]=r,t[218]=pr,t[219]=Vt,t[220]=F,t[221]=z,t[222]=mr):mr=t[222];let hr=mr,gr;t[223]===hr?gr=t[224]:(gr=async function(e,t){if(e.kind===`file`){if(t){re(e);return}await hr(e,!1)}},t[223]=hr,t[224]=gr);let _r=gr,vr=(0,Q.useEffectEvent)(_r),yr;t[225]!==r||t[226]!==pr?(yr=async function(e){let t=[],n=[],i=[];for(let a of e){let e=a.kind;q(a.path);let s=await o(await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),r({id:`7JtSLi`}));if(!s.ok)return i.length>0&&await pr(i,t,n),Ns.error(s.title),!1;let c=Ve(Ma,s.body,`delete-path`,{deletedDocNames:[]});t.push(...c.deletedDocNames),e===`folder`&&n.push(a.path),i.push(a)}return await pr(i,t,n),!0},t[225]=r,t[226]=pr,t[227]=yr):yr=t[227];let br=yr,xr;t[228]===Symbol.for(`react.memo_cache_sentinel`)?(xr=async function(e,t,n){let r=[],i=[];for(let a of e){q(a.path);let e=XL(a,n),o=await t.shell.trashItem(e);o.ok?r.push(a):i.push({kind:a.kind,path:a.path,name:a.name,reason:j0(o.reason),detail:o.detail})}return{trashed:r,failed:i}},t[228]=xr):xr=t[228];let Sr=xr,Cr;t[229]===r?Cr=t[230]:(Cr=async function(e){let t=[],n=[],i=[];for(let a of e){let e=a.kind;try{let s=await o(await fetch(`/api/trash/cleanup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),r({id:`DVh_Tb`}));if(!s.ok){console.warn(`[FileTree] trash-cleanup failed`,{target:`${a.kind}:${a.path}`,reason:s.title}),i.push({target:a,reason:s.title});continue}let c=Ve(Qa,s.body,`trash-cleanup`,{deletedDocNames:[]});t.push(...c.deletedDocNames),e===`folder`&&n.push(a.path)}catch(e){let t=e;console.warn(`[FileTree] trash-cleanup threw`,{target:`${a.kind}:${a.path}`,err:t}),i.push({target:a,reason:r({id:`r4R7AZ`})})}}if(i.length>0){let e=i.length,t=ng(typeof window<`u`?window.okDesktop?.platform:void 0);Ns.error(r({id:`IrB5AK`,values:{failedCount:e}}),{description:r({id:`skvOCc`,values:{trashNoun:t}})})}return i.length===e.length&&e.length>0?null:{deletedDocNames:t,deletedFolderPaths:n}},t[229]=r,t[230]=Cr);let wr=Cr,Tr;t[231]!==r||t[232]!==oe||t[233]!==pr||t[234]!==br||t[235]!==wr||t[236]!==Vt||t[237]!==le?(Tr=async function(e){let t=e.filter(U2).map(e=>qL(e,ge.current)),n=t[0];if(!n)return;let i=oe.filter(e=>t.some(t=>{if(t.kind===`file`){let n=`${t.path}${t.docExt??`.md`}`;return e.file===n}return t.kind===`folder`?e.file.startsWith(`${t.path}/`):!1}));if(i.length>0){let e=i.slice(0,3).map(H2),t=e.join(`, `),n=i.length-e.length;Ns.error(r({id:`erenF-`}),{description:r(n>0?{id:`deD5fS`,values:{files:t,overflow:n}}:{id:`yDlK9k`,values:{files:t}})});return}q(n.path),J(null);let a=typeof window<`u`?window.okDesktop:void 0;try{if(a&&le){let{trashed:e,failed:n}=await Sr(t,a,le);if(e.length>0){let t=await wr(e);t?await pr(e,t.deletedDocNames,t.deletedFolderPaths):await pr(e,e.filter(V2).map(B2),e.filter(z2).map(R2))}n.length>0&&ae({failed:n,originalTargets:[...t]}),q(null)}else{let e=await br(t);q(null),e||Vt()}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] delete failed:`,t),Ns.error(r({id:`0eHrMb`}),{description:n}),q(null),Vt()}},t[231]=r,t[232]=oe,t[233]=pr,t[234]=br,t[235]=wr,t[236]=Vt,t[237]=le,t[238]=Tr):Tr=t[238];let Er=Tr,Dr;t[239]!==r||t[240]!==br||t[241]!==Vt||t[242]!==ie?(Dr=async function(){if(!ie)return;let e=new Set(ie.failed.map(L2)),t=ie.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));if(ae(null),t.length!==0){q(t[0]?.path??null);try{let e=await br(t);q(null),e||Vt()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] hard-delete fallback failed:`,t),Ns.error(r({id:`0eHrMb`}),{description:n}),q(null),Vt()}}},t[239]=r,t[240]=br,t[241]=Vt,t[242]=ie,t[243]=Dr):Dr=t[243];let Or=Dr,kr;t[244]!==Er||t[245]!==ie?(kr=async function(){if(!ie)return;let e=new Set(ie.failed.map(I2)),t=ie.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));ae(null),await Er(t)},t[244]=Er,t[245]=ie,t[246]=kr):kr=t[246];let Ar=kr,jr,Mr;t[247]===Symbol.for(`react.memo_cache_sentinel`)?(jr=()=>DL(e=>{let t=b2(e,ge.current);if(t){Yf(t.path)||J({targets:[t]});return}x2(`delete`,e)}),Mr=[],t[247]=jr,t[248]=Mr):(jr=t[247],Mr=t[248]),(0,Q.useEffect)(jr,Mr);let Nr,Pr;t[249]===Symbol.for(`react.memo_cache_sentinel`)?(Nr=()=>jL(e=>{let t=b2(e,ge.current);if(t&&t.kind!==`asset`){Xt.current(t);return}x2(`duplicate`,e)}),Pr=[],t[249]=Nr,t[250]=Pr):(Nr=t[249],Pr=t[250]),(0,Q.useEffect)(Nr,Pr);let Fr;t[251]!==En||t[252]!==wt?(Fr=()=>kL((e,t)=>{let n=b2(e,ge.current,`tree-path`);if(!n){x2(`rename`,e);return}if(t===void 0){wt.startRenaming(n.path);return}En({sourcePath:n.path,destinationPath:WL(n,t),isFolder:n.kind===`folder`})}),t[251]=En,t[252]=wt,t[253]=Fr):Fr=t[253];let Ir;t[254]===wt?Ir=t[255]:(Ir=[wt],t[254]=wt,t[255]=Ir),(0,Q.useEffect)(Fr,Ir);let Lr;t[256]===vr?Lr=t[257]:(Lr=()=>NL((e,t)=>{let n=b2(e,ge.current);n?.kind===`file`&&vr(n,t)}),t[256]=vr,t[257]=Lr);let Rr;t[258]===Symbol.for(`react.memo_cache_sentinel`)?(Rr=[],t[258]=Rr):Rr=t[258],(0,Q.useEffect)(Lr,Rr);let zr;t[259]===Symbol.for(`react.memo_cache_sentinel`)?(zr=function(){let e=Ie.current;e&&$0(e),Ie.current=null},t[259]=zr):zr=t[259];let Br=zr,Vr;t[260]===Symbol.for(`react.memo_cache_sentinel`)?(Vr=function(e){let t=F1(e);if(!t)return!1;let n=Ye.current?.querySelector(JW)?.shadowRoot;if(!n)return!1;for(let e of n.querySelectorAll(`[data-item-path]`))if(e.dataset.itemPath===t)return!0;return!1},t[260]=Vr):Vr=t[260];let Hr=Vr,Ur;t[261]===f?Ur=t[262]:(Ur=function(e){let t=c4(e.nativeEvent);if(!t||t.endsWith(`/`)){Br();return}let n=ge.current.find(e=>Fh(e)===t);if(n&&Xf(n)){Br();return}let r=n&&Wf(n)?n.docName:kh(t,ge.current);if(n&&Wf(n)&&pa(n.size)){Br();return}Ie.current!==r&&(Br(),Ie.current=r,Q0(r,e=>f(e)))},t[261]=f,t[262]=Ur);let Wr=Ur,Gr;t[263]!==Se||t[264]!==wt||t[265]!==be?(Gr=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=l4(e.nativeEvent);if(!t){f4(e.nativeEvent)&&fe(!0);return}if(t.dataset.fileTreeStickyRow===`true`)return;let n=t.getAttribute(`aria-selected`)===`true`,r=t.dataset.itemPath;if(!r)return;let i=t.dataset.itemType===`folder`?Uh(r):r;if(t.dataset.itemType===`folder`){let t=Nh(i),r=L0(wt.getItem(i));if(!n){e.preventDefault(),e.stopPropagation(),r&&!r.isExpanded()&&r.expand(),queueMicrotask(()=>be({kind:`folder`,folderPath:t}));return}if(wt.getSelectedPaths().length!==1||jf(window.location.hash,Of(t)))return;e.preventDefault(),e.stopPropagation(),r&&!r.isExpanded()&&r.expand(),queueMicrotask(()=>be({kind:`folder`,folderPath:t}));return}if(!n){if(I1(i,At.current)||Hr(i)){ve.current=i,setTimeout(()=>be({kind:`doc`,docName:i,registerPage:!0}),0);return}queueMicrotask(()=>Se(i));return}let a=kh(i,ge.current);wt.getSelectedPaths().length===1&&(jf(window.location.hash,Cf(a))||queueMicrotask(()=>Se(i)))},t[263]=Se,t[264]=wt,t[265]=be,t[266]=Gr):Gr=t[266];let Kr=Gr,qr;t[267]===b?qr=t[268]:(qr=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||W1(e.target))return;let t=l4(e.nativeEvent);if(!t||t.dataset.fileTreeStickyRow===`true`||t.dataset.itemType===`folder`)return;let n=g0(t.dataset.itemPath,ge.current,b);n&&mt(n)},t[267]=b,t[268]=qr);let Jr=qr,Yr;t[269]===Symbol.for(`react.memo_cache_sentinel`)?(Yr=function(e){Rh(e.nativeEvent)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,nt(!0))},t[269]=Yr):Yr=t[269];let Xr=Yr,Zr;t[270]===Symbol.for(`react.memo_cache_sentinel`)?(Zr=function(e){let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||nt(!1)},t[270]=Zr):Zr=t[270];let Qr=Zr,$r;t[271]===jn?$r=t[272]:($r=function(e){if(!Rh(e.nativeEvent))return;let t=Ih(e.nativeEvent);t.length!==0&&(e.preventDefault(),e.stopPropagation(),nt(!1),jn(t,``,T2))},t[271]=jn,t[272]=$r);let ei=$r;if(L){let e;return t[273]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(m4,{}),t[273]=e):e=t[273],e}let ti;t[274]!==r||t[275]!==B||t[276]!==V?(ti=B?r(V?{id:`H-vDm3`}:{id:`09Tv5j`}):null,t[274]=r,t[275]=B,t[276]=V,t[277]=ti):ti=t[277];let ni=ti;if(P.length===0){if(ni!==null){let e;return t[278]===ni?e=t[279]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{role:`status`,className:`select-none text-sidebar-foreground/50 text-sm`,children:ni})}),t[278]=ni,t[279]=e),e}if(R){let e;return t[280]===R?e=t[281]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{role:`alert`,className:`select-none text-sidebar-foreground/50 text-sm`,children:R})}),t[280]=R,t[281]=e),e}if(Jf({visibility:{showHiddenFiles:C,showOnlyMarkdownFiles:w},unfilteredRootEntryCount:U,knownPageCount:b.size})===`filtered-to-zero`){let e;return t[282]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(n1,{}),t[282]=e):e=t[282],e}let e;t[283]===r?e=t[284]:(e=r({id:`5ZB7XC`}),t[283]=r,t[284]=e);let n=tt&&`bg-primary/5 ring-2 ring-primary/70 ring-inset`,i;t[285]===n?i=t[286]:(i=Bn(`flex flex-1 flex-col items-center justify-center gap-3 rounded-md py-8`,n),t[285]=n,t[286]=i);let a;t[287]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:(0,Z.jsx)(Y,{id:`xiv-dW`})}),t[287]=a):a=t[287];let o;t[288]===Fn?o=t[289]:(o=()=>Fn(`file`,``),t[288]=Fn,t[289]=o);let s;t[290]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Y,{id:`6ibbCg`}),t[290]=s):s=t[290];let c;t[291]===o?c=t[292]:(c=(0,Z.jsx)(X,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:o,children:s}),t[291]=o,t[292]=c);let l;return t[293]!==ei||t[294]!==e||t[295]!==i||t[296]!==c?(l=(0,Z.jsxs)(`section`,{"aria-label":e,className:i,onDragOver:Xr,onDragLeave:Qr,onDrop:ei,children:[a,c]}),t[293]=ei,t[294]=e,t[295]=i,t[296]=c,t[297]=l):l=t[297],l}let ri=K!==null,ii=te?.targets[0]??null,ai=null;if(H!==null){let e;if(t[298]!==i.locale||t[299]!==H){let n=new Intl.NumberFormat(i.locale).format(H);e=Ms._({id:`LuoJWu`,values:{truncatedShownCount:H,formattedCount:n}}),t[298]=i.locale,t[299]=H,t[300]=e}else e=t[300];ai=e}let oi;t[301]!==R||t[302]!==ni||t[303]!==ai?(oi=(R||ni!==null||ai!==null)&&(0,Z.jsxs)(Z.Fragment,{children:[ni===null?R&&(0,Z.jsx)(g4,{kind:`error`,children:R}):(0,Z.jsx)(g4,{kind:`reconnecting`,children:ni}),ai!==null&&(0,Z.jsx)(g4,{kind:`info`,children:ai})]}),t[301]=R,t[302]=ni,t[303]=ai,t[304]=oi):oi=t[304];let si;t[305]===_?si=t[306]:(si=s1(_),t[305]=_,t[306]=si);let ci=de?``:void 0,li;t[307]===ci?li=t[308]:(li={[D2]:ci},t[307]=ci,t[308]=li);let ui;t[309]!==ri||t[310]!==Te||t[311]!==zn||t[312]!==P||t[313]!==Ln||t[314]!==Mt||t[315]!==Yt||t[316]!==_r||t[317]!==pt||t[318]!==wt||t[319]!==x||t[320]!==Fn||t[321]!==le?(ui=(e,t)=>(0,Z.jsx)(A2,{item:e,context:t,anyActionBusy:ri,workspace:le,handoff:pt,model:wt,okignoreBinding:x,onStartCreating:Fn,onCreateFromTemplate:(e,t)=>Fn(`file`,e,{template:t}),onDuplicate:Yt,onImportTemplate:_r,onDelete:e=>J({targets:e}),onExpandSubtree:Ln,onCollapseSubtree:zn,folderTreePaths:Mt,isAsset:Te.has(e.path),documents:P}),t[309]=ri,t[310]=Te,t[311]=zn,t[312]=P,t[313]=Ln,t[314]=Mt,t[315]=Yt,t[316]=_r,t[317]=pt,t[318]=wt,t[319]=x,t[320]=Fn,t[321]=le,t[322]=ui):ui=t[322];let di;t[323]!==Kr||t[324]!==Jr||t[325]!==Wr||t[326]!==wt||t[327]!==oi||t[328]!==si||t[329]!==li||t[330]!==ui?(di=(0,Z.jsx)(`div`,{ref:Ye,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(e1,{header:oi,model:wt,style:si,...li,onClickCapture:Kr,onDoubleClickCapture:Jr,onMouseMove:Wr,onMouseLeave:Br,renderContextMenu:ui})}),t[323]=Kr,t[324]=Jr,t[325]=Wr,t[326]=wt,t[327]=oi,t[328]=si,t[329]=li,t[330]=ui,t[331]=di):di=t[331];let fi=!!te,pi;t[332]===K?pi=t[333]:(pi=e=>{!e&&!K&&J(null)},t[332]=K,t[333]=pi);let mi;t[334]!==r||t[335]!==K||t[336]!==te||t[337]!==Er||t[338]!==ii?(mi=te&&ii&&(0,Z.jsx)(Jn,{...(()=>{let e=D0(typeof window<`u`&&window.okDesktop!=null?`electron`:`web`,te.targets,typeof window<`u`?window.okDesktop?.platform:void 0);if(e)return{customTitle:e.title,customDescription:``,customDetail:e.detail,customConfirmLabel:e.confirmLabel,customConfirmLabelBusy:e.confirmLabelBusy,children:e.listedTargets?(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1 font-mono text-foreground text-xs`,children:e.listedTargets.map(F2)}):null};let t=te.targets.length,n=ii.name;return{itemName:t===1?ii.kind===`folder`?`${ii.name}/`:ii.kind===`file`?`${ii.name}${ii.docExt??`.md`}`:ii.name:void 0,customTitle:t>1?r({id:`abiHje`}):void 0,customDescription:t>1?r({id:`WMIKXK`,values:{targetCount:t}}):ii.kind===`folder`?r({id:`a5W0q0`,values:{folderName:n}}):void 0}})(),isSubmitting:K!==null,onDelete:()=>Er(te.targets)}),t[334]=r,t[335]=K,t[336]=te,t[337]=Er,t[338]=ii,t[339]=mi):mi=t[339];let hi;t[340]!==fi||t[341]!==pi||t[342]!==mi?(hi=(0,Z.jsx)(Hn,{open:fi,onOpenChange:pi,children:mi}),t[340]=fi,t[341]=pi,t[342]=mi,t[343]=hi):hi=t[343];let gi=!!ne,_i;t[344]===K?_i=t[345]:(_i=e=>{!e&&!K&&re(null)},t[344]=K,t[345]=_i);let vi;t[346]!==r||t[347]!==K||t[348]!==hr||t[349]!==ne?(vi=ne&&(0,Z.jsx)(Jn,{itemName:ne.name+(ne.kind===`file`?ne.docExt??`.md`:`.md`),customTitle:r({id:`hLod4_`}),customDescription:r({id:`RMQe3p`}),customConfirmLabel:r({id:`hvZwVx`}),customConfirmLabelBusy:r({id:`ul1Atu`}),isSubmitting:K!==null,onDelete:()=>hr(ne,!0)}),t[346]=r,t[347]=K,t[348]=hr,t[349]=ne,t[350]=vi):vi=t[350];let yi;t[351]!==gi||t[352]!==_i||t[353]!==vi?(yi=(0,Z.jsx)(Hn,{open:gi,onOpenChange:_i,children:vi}),t[351]=gi,t[352]=_i,t[353]=vi,t[354]=yi):yi=t[354];let bi=!!ie,xi;t[355]===K?xi=t[356]:(xi=e=>{!e&&!K&&ae(null)},t[355]=K,t[356]=xi);let Si;t[357]!==K||t[358]!==Or||t[359]!==Ar||t[360]!==ie?(Si=ie&&(0,Z.jsx)(F0,{failedTargets:ie.failed,isSubmitting:K!==null,onDeletePermanently:Or,onRetry:Ar,onCancel:()=>ae(null)}),t[357]=K,t[358]=Or,t[359]=Ar,t[360]=ie,t[361]=Si):Si=t[361];let Ci;t[362]!==bi||t[363]!==xi||t[364]!==Si?(Ci=(0,Z.jsx)(Hn,{open:bi,onOpenChange:xi,children:Si}),t[362]=bi,t[363]=xi,t[364]=Si,t[365]=Ci):Ci=t[365];let wi=se!==null,Ti;t[366]===Symbol.for(`react.memo_cache_sentinel`)?(Ti=e=>{e||ce(null)},t[366]=Ti):Ti=t[366];let Ei=se?.parentDir??``,Di;t[367]!==wi||t[368]!==Ei?(Di=(0,Z.jsx)(nx,{open:wi,onOpenChange:Ti,kind:`file`,initialDir:Ei,defaultToTemplate:!0}),t[367]=wi,t[368]=Ei,t[369]=Di):Di=t[369];let Oi;return t[370]!==di||t[371]!==hi||t[372]!==yi||t[373]!==Ci||t[374]!==Di?(Oi=(0,Z.jsxs)(Z.Fragment,{children:[di,hi,yi,Ci,Di]}),t[370]=di,t[371]=hi,t[372]=yi,t[373]=Ci,t[374]=Di,t[375]=Oi):Oi=t[375],Oi}function F2(e){return(0,Z.jsx)(`li`,{"data-testid":`delete-target-row`,children:O0(e)},`${e.kind}:${e.path}`)}function I2(e){return`${e.kind}:${e.path}`}function L2(e){return`${e.kind}:${e.path}`}function R2(e){return e.path}function z2(e){return e.kind===`folder`}function B2(e){return e.path}function V2(e){return e.kind===`file`}function H2(e){return e.file}function U2(e){return!Yf(e.path)}function W2(e){return lp(e)}function G2(e){return op(e)}function K2(e){return ap(e)}function q2(e){return e.path}function J2(e){return e.kind===`asset`}function Y2(e){return e.endsWith(`/`)?e.slice(0,-1):e}function X2(e){return!!e}function Z2(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function Q2(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function $2(e){Ns.error(e)}function e4(){}function t4(e){return Ns.error(e)}function n4(){}function r4(){}function i4(){}function a4(){}async function o4(){}function s4(e){return Fh(e)}function c4(e){return l4(e)?.dataset.itemPath??null}function l4(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}function u4(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-root]`))return t;return null}function d4(e){let t=l4(e);if(t){let e=t.dataset.itemPath;if(!e)return null;let n=t.dataset.itemType===`folder`,r=jh(e,n);return{parentDir:r,row:t,root:null,busyPath:n?Uh(r):e}}return f4(e)?{parentDir:``,row:null,root:u4(e),busyPath:T2}:null}function f4(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-scroll]`))return!0;return!1}var p4=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function m4(){let e=(0,$.c)(5),{_:t}=on(),n;e[0]===t?n=e[1]:(n=t({id:`5Tk8Fb`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=p4.map(h4),e[2]=r):r=e[2];let i;return e[3]===n?i=e[4]:(i=(0,Z.jsx)(`div`,{className:`flex flex-1 flex-col gap-1 px-2 py-2`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=i),i}function h4(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(Im,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(Im,{className:`h-3 ${e}`})]},t)}function g4(e){let t=(0,$.c)(12),{kind:n,children:r}=e,i=n===`error`?pf:bd,a=n===`error`?`alert`:`status`,o=n===`error`?`text-destructive`:`text-muted-foreground`,s;t[0]===o?s=t[1]:(s=Bn(`mx-2 mb-1 flex items-start gap-1.5 rounded-md bg-muted/50 px-2 py-1.5 text-xs leading-snug`,o),t[0]=o,t[1]=s);let c;t[2]!==i||t[3]!==n?(c=n===`reconnecting`?(0,Z.jsx)(xd,{"aria-hidden":`true`,icon:Qd,className:`mt-0.5 size-3.5 shrink-0`}):(0,Z.jsx)(i,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),t[2]=i,t[3]=n,t[4]=c):c=t[4];let l;t[5]===r?l=t[6]:(l=(0,Z.jsx)(`span`,{className:`min-w-0`,children:r}),t[5]=r,t[6]=l);let u;return t[7]!==a||t[8]!==s||t[9]!==c||t[10]!==l?(u=(0,Z.jsxs)(`span`,{role:a,className:s,children:[c,l]}),t[7]=a,t[8]=s,t[9]=c,t[10]=l,t[11]=u):u=t[11],u}async function _4(e){try{let t=await e.project.listRecent(),n=e.config.projectPath;if(t.some(e=>e.path!==n))return null;let r=await xA();return e.config.freshlyCreated?r:r===0?0:null}catch(e){return console.warn(`[onboarding-card-visible] fresh-project probe failed; suppressing card`,e),null}}function v4(e){let t=(0,$.c)(4),n=e===void 0?_A:e,{initialized:r,dismissed:i,completed:a}=(0,Q.useSyncExternalStore)(n.subscribe,n.getSnapshot,n.getSnapshot),o=i||a,s=!r&&!o,c,l;return t[0]!==s||t[1]!==n?(c=()=>{if(!s)return;let e=window.okDesktop;if(e==null)return;let t=!1;return _4(e).then(e=>{!t&&e!==null&&n.activate(e)}),()=>{t=!0}},l=[s,n],t[0]=s,t[1]=n,t[2]=c,t[3]=l):(c=t[2],l=t[3]),(0,Q.useEffect)(c,l),r&&!o}function y4(e){let t=(0,$.c)(3),n=e===void 0?_A:e,r,i;t[0]===n?(r=t[1],i=t[2]):(r=()=>{if(n.getSnapshot().steps.file)return;let e=Ls(e=>{e.includes(`files`)&&SA(n)});return SA(n),e},i=[n],t[0]=n,t[1]=r,t[2]=i),(0,Q.useEffect)(r,i)}var b4=3,x4=5200,S4=1500,C4=220;function w4(e){let t=(0,$.c)(14),{complete:n,label:r,shortcutId:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(Hr,{checked:n,disabled:!0,"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none opacity-100 disabled:opacity-100`}),t[0]=n,t[1]=a);let o=n?`flex-1 text-muted-foreground/60`:`flex-1`,s;t[2]===n?s=t[3]:(s=n?(0,Z.jsxs)(`span`,{className:`sr-only`,children:[(0,Z.jsx)(Y,{id:`Qj4RL5`}),` `]}):null,t[2]=n,t[3]=s);let c;t[4]!==r||t[5]!==o||t[6]!==s?(c=(0,Z.jsxs)(`span`,{className:o,children:[s,r]}),t[4]=r,t[5]=o,t[6]=s,t[7]=c):c=t[7];let l;t[8]===i?l=t[9]:(l=i?(0,Z.jsx)(ne,{children:xs(i)}):null,t[8]=i,t[9]=l);let u;return t[10]!==a||t[11]!==c||t[12]!==l?(u=(0,Z.jsxs)(`li`,{className:`flex items-center gap-2 py-0.5 text-sm`,children:[a,c,l]}),t[10]=a,t[11]=c,t[12]=l,t[13]=u):u=t[13],u}function T4(e){let t=(0,$.c)(24),{store:n,lingerMs:r}=e,i=n===void 0?_A:n,a=r===void 0?x4:r,{_:o}=on(),{steps:s}=vA(i);y4(i);let[c,l]=(0,Q.useState)(0),[u,d]=(0,Q.useState)(!1),f=1+ +!!s.file+ +!!s.askedAi,p=f===b4,m,h;t[0]!==p||t[1]!==a?(m=()=>{if(!p)return;l(D4);let e=setInterval(()=>l(E4),S4),t=setTimeout(()=>{clearInterval(e),d(!0)},a);return()=>{clearInterval(e),clearTimeout(t)}},h=[p,a],t[0]=p,t[1]=a,t[2]=m,t[3]=h):(m=t[2],h=t[3]),(0,Q.useEffect)(m,h);let g,_;t[4]!==u||t[5]!==i?(g=()=>{if(!u)return;let e=setTimeout(()=>i.markCompleted(),C4);return()=>clearTimeout(e)},_=[u,i],t[4]=u,t[5]=i,t[6]=g,t[7]=_):(g=t[6],_=t[7]),(0,Q.useEffect)(g,_);let v;t[8]!==o||t[9]!==p?(v=p?o({id:`7jIIFX`}):``,t[8]=o,t[9]=p,t[10]=v):v=t[10];let y;t[11]===v?y=t[12]:(y=(0,Z.jsx)(`div`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:v}),t[11]=v,t[12]=y);let b;t[13]!==p||t[14]!==c||t[15]!==f||t[16]!==u||t[17]!==s.askedAi||t[18]!==s.file||t[19]!==i?(b=p?(0,Z.jsxs)(`section`,{"aria-hidden":!0,className:Bn(`mx-2 mb-1 flex items-center gap-3 rounded-lg border bg-card px-4 py-3 text-card-foreground`,`motion-reduce:animate-none motion-reduce:duration-0`,u?`animate-out fade-out-0 zoom-out-95 fill-mode-forwards duration-200`:`animate-in fade-in-0 zoom-in-95 duration-300`),children:[(0,Z.jsx)(nr,{size:36,celebrateSignal:c}),(0,Z.jsx)(`span`,{className:`font-medium text-sm`,children:(0,Z.jsx)(Y,{id:`7jIIFX`})})]}):(0,Z.jsxs)(`section`,{"aria-labelledby":`onboarding-card-heading`,className:`mx-2 mb-1 rounded-lg border bg-card px-4 py-3 text-card-foreground`,children:[(0,Z.jsxs)(`header`,{className:`mb-3 flex items-center justify-between`,children:[(0,Z.jsx)(`h2`,{id:`onboarding-card-heading`,className:`font-medium text-sm`,children:(0,Z.jsx)(Y,{id:`Y1QMlM`})}),(0,Z.jsx)(`span`,{className:`text-muted-foreground/60 text-xs tabular-nums`,children:`${f} / ${b4}`})]}),(0,Z.jsxs)(`ul`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(w4,{complete:!0,label:(0,Z.jsx)(Y,{id:`4E9jPa`})}),(0,Z.jsx)(w4,{complete:s.file,label:(0,Z.jsx)(Y,{id:`6ibbCg`}),shortcutId:`new-item`}),(0,Z.jsx)(w4,{complete:s.askedAi,label:(0,Z.jsx)(Y,{id:`xWEvuo`}),shortcutId:`open-ask-ai`})]}),(0,Z.jsx)(`footer`,{className:`-mb-1 mt-2 flex justify-end`,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`sm`,className:`h-auto px-2 py-1 text-muted-foreground text-xs`,onClick:()=>i.dismiss(),children:(0,Z.jsx)(Y,{id:`1QfxQT`})})})]}),t[13]=p,t[14]=c,t[15]=f,t[16]=u,t[17]=s.askedAi,t[18]=s.file,t[19]=i,t[20]=b):b=t[20];let x;return t[21]!==y||t[22]!==b?(x=(0,Z.jsxs)(Z.Fragment,{children:[y,b]}),t[21]=y,t[22]=b,t[23]=x):x=t[23],x}function E4(e){return e+1}function D4(e){return e+1}function O4(){let e=(0,$.c)(1);if(!v4())return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(T4,{}),e[0]=t):t=e[0],t}function k4(e){return e===null?null:e.kind===`local`?e.name:e.ref}function A4(e,t){if(e.length===0)return null;let n=`origin/${e}`;return t.includes(n)?n:t.find(t=>ds(t)===e)??null}function j4(e){switch(e){case`branch-exists`:return{id:`wzq9Rv`};case`already-checked-out`:return{id:`ljHjfg`};case`path-exists`:return{id:`mYzDD_`};case`invalid-branch`:return{id:`r-OJYm`};case`no-git`:return{id:`CFnavk`};case`empty-repo`:return{id:`5IgYAM`};case`helper-not-found`:return{id:`HqOPpj`};default:return{id:`-zA2E7`}}}function M4(e){let t=(0,$.c)(71),{open:n,onOpenChange:r,bridge:i,currentBranch:a,branches:o,existingWorktreeBranches:s,remoteBranches:c,behindByBranch:l,initialBranchName:u}=e,d=o===void 0?[]:o,f=c===void 0?[]:c,p=u===void 0?``:u,{_:m}=on(),h=(0,Q.useId)(),g=(0,Q.useId)(),_=(0,Q.useId)(),v=(0,Q.useId)(),y=(0,Q.useId)(),b=(0,Q.useId)(),[x,S]=(0,Q.useState)(``),C;t[0]===a?C=t[1]:(C=a===null?null:{kind:`local`,name:a},t[0]=a,t[1]=C);let[w,T]=(0,Q.useState)(C),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(``),[A,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(null),P=(0,Q.useRef)(null),F=(0,Q.useRef)(null),I,L;t[2]!==a||t[3]!==p||t[4]!==n?(I=()=>{if(!n)return;S(p),T(a===null?null:{kind:`local`,name:a}),D(!1),k(``),j(!1),N(null);let e=requestAnimationFrame(()=>P.current?.focus());return()=>cancelAnimationFrame(e)},L=[n,a,p],t[2]=a,t[3]=p,t[4]=n,t[5]=I,t[6]=L):(I=t[5],L=t[6]),(0,Q.useEffect)(I,L);let R=x.trim(),z=!A&&R.length>0,B=R.length>0&&d.includes(R),V=B?null:A4(R,f),H=V!==null,U=B||H,W=B&&(s?.has(R)??!1),ee=d.filter(e=>e.toLowerCase().startsWith(R.toLowerCase())),G=!A&&ee.length>0&&!U,K=(a!==null&&!d.includes(a)?[a,...d]:d).map(L4),q=f.map(I4),te=k4(w),J=O.trim().toLowerCase(),ne=J===``?K:K.filter(e=>e.name.toLowerCase().includes(J)),re=J===``?q:q.filter(e=>e.ref.toLowerCase().includes(J)),ie=J!==``&&ne.length===0&&re.length===0,ae=async function(e){if(e.preventDefault(),z){j(!0),N(null);try{let e=H?{branch:R,createBranch:!0,remoteRef:V}:B?{branch:R,createBranch:!1}:{branch:R,createBranch:!0,baseBranch:w?.kind===`local`?w.name:void 0,baseRef:w?.kind===`remote`?w.ref:void 0},t=await i.worktree.create(e);if(!t.ok){N({copy:j4(t.reason),detail:t.message}),j(!1);return}gm(),r(!1),await i.project.open({path:t.path,target:`new-window`,entryPoint:`worktree`})}catch(e){console.warn(`[NewWorktreeDialog] worktree create/open failed:`,e),Ns.error(m({id:`vAYoCZ`})),j(!1)}}},oe=br,se;t[7]!==A||t[8]!==r?(se=e=>{A||r(e)},t[7]=A,t[8]=r,t[9]=se):se=t[9];let ce=gr,le;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(hr,{children:(0,Z.jsx)(Y,{id:`DXd9LM`})}),t[10]=le):le=t[10];let ue;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Z.jsxs)(yr,{children:[le,(0,Z.jsx)(mr,{children:(0,Z.jsx)(Y,{id:`NEzPEh`})})]}),t[11]=ue):ue=t[11];let de=_r,fe;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Z.jsx)(Y,{id:`ng2Ibo`}),t[12]=fe):fe=t[12];let pe;t[13]===g?pe=t[14]:(pe=(0,Z.jsx)(Ci,{htmlFor:g,children:fe}),t[13]=g,t[14]=pe);let me;t[15]===m?me=t[16]:(me=m({id:`IX_uXB`}),t[15]=m,t[16]=me);let he;t[17]===M?he=t[18]:(he=e=>{S(e.target.value),M!==null&&N(null)},t[17]=M,t[18]=he);let ge=M!==null,_e=M===null?y:`${y} ${b}`,ve;t[19]!==x||t[20]!==A||t[21]!==g||t[22]!==me||t[23]!==he||t[24]!==ge||t[25]!==_e?(ve=(0,Z.jsx)(zf,{id:g,ref:P,value:x,placeholder:me,onChange:he,disabled:A,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-invalid":ge,"aria-describedby":_e,"data-testid":`new-worktree-branch`}),t[19]=x,t[20]=A,t[21]=g,t[22]=me,t[23]=he,t[24]=ge,t[25]=_e,t[26]=ve):ve=t[26];let ye=R.length>0?(0,Z.jsxs)(`p`,{id:y,className:`flex items-start gap-1.5 text-1sm text-muted-foreground`,"data-testid":W?`new-worktree-mode-existing-worktree`:H?`new-worktree-mode-remote-checkout`:B?`new-worktree-mode-checkout`:`new-worktree-mode-create`,children:[W?(0,Z.jsx)(hd,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400`}):H?(0,Z.jsx)(Fu,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-violet-600 dark:text-violet-400`}):B?(0,Z.jsx)(zl,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-blue-600 dark:text-blue-400`}):(0,Z.jsx)(Mn,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-green-600 dark:text-green-400`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1`,children:W?(0,Z.jsx)(Y,{id:`QAi7Q9`,values:{trimmed:R},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`})}}):H?(0,Z.jsx)(Y,{id:`oAGN8p`,values:{remoteCheckoutRef:V,trimmed:R},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),2:(0,Z.jsx)(`code`,{className:`font-mono`})}}):B?(0,Z.jsx)(Y,{id:`b4VvP-`,values:{trimmed:R},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono`})}}):te===null?(0,Z.jsx)(Y,{id:`t4sFKC`,values:{trimmed:R},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono`})}}):(0,Z.jsx)(Y,{id:`dGAdpH`,values:{trimmed:R,currentBaseLabel:te},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),2:(0,Z.jsx)(`code`,{className:`font-mono`})}})})]}):null,be=G?(0,Z.jsx)(`div`,{className:`max-h-40 overflow-y-auto rounded-md border bg-popover p-1 shadow-xs`,"data-testid":`new-worktree-branch-list`,children:ee.map(e=>(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,tabIndex:-1,onClick:()=>{S(e),M!==null&&N(null),P.current?.focus()},"data-testid":`new-worktree-branch-option-${e}`,className:`h-8 w-full justify-start gap-2 font-normal`,children:[(0,Z.jsx)($c,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:e})]},e))}):null,xe=U?null:(0,Z.jsxs)(`div`,{className:`mt-1 flex flex-col gap-2`,children:[(0,Z.jsx)(Ci,{id:v,htmlFor:_,children:(0,Z.jsx)(Y,{id:`ZWwYwM`})}),(0,Z.jsxs)(Ln,{open:E,onOpenChange:e=>{D(e),e||k(``)},children:[(0,Z.jsx)(In,{asChild:!0,children:(0,Z.jsxs)(X,{id:_,type:`button`,variant:`outline`,role:`combobox`,"aria-expanded":E,"aria-haspopup":`listbox`,"aria-labelledby":`${v} ${_}`,"aria-label":m({id:`ZWwYwM`}),disabled:A,"data-testid":`new-worktree-base-trigger`,className:`w-full justify-between font-normal`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[w?.kind===`remote`?(0,Z.jsx)(Fu,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}):(0,Z.jsx)($c,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-left`,children:te===null?(0,Z.jsx)(Y,{id:`EbjWsS`}):te})]}),(0,Z.jsx)(nu,{"aria-hidden":`true`,className:`ml-2 size-4 shrink-0 opacity-50`})]})}),(0,Z.jsxs)(jn,{align:`start`,className:`w-[var(--radix-popover-trigger-width)] p-1`,onWheel:F4,onTouchMove:P4,onOpenAutoFocus:e=>{e.preventDefault(),F.current?.focus()},children:[(0,Z.jsxs)(xh,{className:`mb-1 h-8`,children:[(0,Z.jsx)(bh,{ref:F,"aria-label":m({id:`fuJZKk`}),placeholder:m({id:`hQXiDc`}),value:O,onChange:e=>k(e.target.value),onKeyDown:N4,"data-testid":`new-worktree-base-search`}),(0,Z.jsx)(yh,{children:(0,Z.jsx)(ct,{"aria-hidden":`true`})})]}),(0,Z.jsxs)(`div`,{role:`listbox`,"aria-label":m({id:`ZWwYwM`}),className:`max-h-56 overflow-y-auto`,"data-testid":`new-worktree-base-list`,children:[ie?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-1sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`Sh3Qkg`})}):null,ne.map(e=>{let t=e.name,n=l?.get(t);return(0,Z.jsxs)(X,{type:`button`,role:`option`,"aria-selected":w?.kind===`local`&&w.name===t,variant:`ghost`,size:`sm`,onClick:()=>{T(e),D(!1),k(``)},"data-testid":`new-worktree-base-option-${t}`,className:`h-8 w-full justify-start gap-2 font-normal`,children:[(0,Z.jsx)($c,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:t}),n!==void 0&&n>0?(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-amber-600 dark:text-amber-400`,"data-testid":`new-worktree-base-behind-${t}`,children:(0,Z.jsx)(Y,{id:`6-wLTJ`,values:{behind:n}})}):null]},`local:${t}`)}),re.map(e=>{let t=e.ref;return(0,Z.jsxs)(X,{type:`button`,role:`option`,"aria-selected":w?.kind===`remote`&&w.ref===t,variant:`ghost`,size:`sm`,onClick:()=>{T(e),D(!1),k(``)},"data-testid":`new-worktree-base-option-${t}`,className:`h-8 w-full justify-start gap-2 font-normal`,children:[(0,Z.jsx)(Fu,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:t}),(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`dIYSqk`})})]},`remote:${t}`)})]})]})]})]}),Se;t[27]!==m||t[28]!==M||t[29]!==b?(Se=M===null?null:(0,Z.jsxs)(`div`,{id:b,role:`alert`,children:[(0,Z.jsx)(`p`,{className:`text-1sm text-destructive`,"data-testid":`new-worktree-error`,children:m(M.copy)}),M.detail!==void 0&&M.detail.length>0?(0,Z.jsx)(`p`,{className:`mt-1 break-words font-mono text-xs text-muted-foreground`,"data-testid":`new-worktree-error-detail`,children:M.detail}):null]}),t[27]=m,t[28]=M,t[29]=b,t[30]=Se):Se=t[30];let Ce;t[31]!==h||t[32]!==ae||t[33]!==pe||t[34]!==ve||t[35]!==ye||t[36]!==be||t[37]!==xe||t[38]!==Se?(Ce=(0,Z.jsxs)(`form`,{id:h,onSubmit:ae,className:`flex flex-col gap-2`,children:[pe,ve,ye,be,xe,Se]}),t[31]=h,t[32]=ae,t[33]=pe,t[34]=ve,t[35]=ye,t[36]=be,t[37]=xe,t[38]=Se,t[39]=Ce):Ce=t[39];let we;t[40]!==de||t[41]!==Ce?(we=(0,Z.jsx)(de,{children:Ce}),t[40]=de,t[41]=Ce,t[42]=we):we=t[42];let Te;t[43]===r?Te=t[44]:(Te=()=>r(!1),t[43]=r,t[44]=Te);let Ee;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Z.jsx)(Y,{id:`dEgA5A`}),t[45]=Ee):Ee=t[45];let De;t[46]!==A||t[47]!==Te?(De=(0,Z.jsx)(X,{type:`button`,variant:`outline`,onClick:Te,disabled:A,"data-testid":`new-worktree-cancel`,children:Ee}),t[46]=A,t[47]=Te,t[48]=De):De=t[48];let Oe=!z,ke;t[49]!==A||t[50]!==W||t[51]!==B||t[52]!==H?(ke=A?(0,Z.jsx)(Y,{id:`b4itZn`}):W?(0,Z.jsx)(Y,{id:`XV5sC0`}):H?(0,Z.jsx)(Y,{id:`XAyxsa`}):B?(0,Z.jsx)(Y,{id:`uGaIIS`}):(0,Z.jsx)(Y,{id:`iO8V-7`}),t[49]=A,t[50]=W,t[51]=B,t[52]=H,t[53]=ke):ke=t[53];let Ae;t[54]!==h||t[55]!==Oe||t[56]!==ke?(Ae=(0,Z.jsx)(X,{type:`submit`,form:h,disabled:Oe,"data-testid":`new-worktree-create`,children:ke}),t[54]=h,t[55]=Oe,t[56]=ke,t[57]=Ae):Ae=t[57];let je;t[58]!==De||t[59]!==Ae?(je=(0,Z.jsxs)(vr,{children:[De,Ae]}),t[58]=De,t[59]=Ae,t[60]=je):je=t[60];let Me;t[61]!==ce||t[62]!==ue||t[63]!==we||t[64]!==je?(Me=(0,Z.jsxs)(ce,{className:`sm:max-w-md`,"data-testid":`new-worktree-dialog`,children:[ue,we,je]}),t[61]=ce,t[62]=ue,t[63]=we,t[64]=je,t[65]=Me):Me=t[65];let Ne;return t[66]!==oe||t[67]!==n||t[68]!==Me||t[69]!==se?(Ne=(0,Z.jsx)(oe,{open:n,onOpenChange:se,children:Me}),t[66]=oe,t[67]=n,t[68]=Me,t[69]=se,t[70]=Ne):Ne=t[70],Ne}function N4(e){return e.stopPropagation()}function P4(e){e.stopPropagation()}function F4(e){e.stopPropagation()}function I4(e){return{kind:`remote`,ref:e}}function L4(e){return{kind:`local`,name:e}}function R4(e){let t=(0,$.c)(54),{bridge:n,recents:r,currentPath:i,query:a,worktreeModel:o,closeMenu:s,guardStaleSelect:c,onRemoveRecent:l,flyoutPath:u,setFlyoutPath:d,openNewWorktreeWith:f}=e,{_:p}=on(),m;t[0]!==p||t[1]!==n.project||t[2]!==s?(m=function(e,t){s(),n.project.open({path:e,target:`new-window`,entryPoint:t}).catch(e=>{console.warn(`[RecentProjectsMenu] project.open failed:`,e),Ns.error(p({id:`6HCOwA`}))})},t[0]=p,t[1]=n.project,t[2]=s,t[3]=m):m=t[3];let h=m,g;t[4]!==p||t[5]!==n.project||t[6]!==n.worktree?(g=async function(e){try{let t=await n.worktree.create({branch:e,createBranch:!1});if(!t.ok){Ns.error(p({id:`teD0H9`}));return}gm(),await n.project.open({path:t.path,target:`new-window`,entryPoint:`worktree`})}catch(e){console.warn(`[RecentProjectsMenu] create/open branch failed:`,e),Ns.error(p({id:`LwMxXg`}))}},t[4]=p,t[5]=n.project,t[6]=n.worktree,t[7]=g):g=t[7];let _=g,v;t[8]!==s||t[9]!==i||t[10]!==h?(v=function(e){if(e.path===i){s();return}h(e.path,e.isLinkedWorktree?`worktree`:`recents`)},t[8]=s,t[9]=i,t[10]=h,t[11]=v):v=t[11];let y=v,b;t[12]!==s||t[13]!==_||t[14]!==i||t[15]!==h?(b=function(e){if(e.path!==null){if(e.path===i){s();return}h(e.path,e.isMain?`recents`:`worktree`);return}e.branch!==null&&(s(),_(e.branch))},t[12]=s,t[13]=_,t[14]=i,t[15]=h,t[16]=b):b=t[16];let x=b;if(a!==``){let e;t[17]!==s||t[18]!==_?(e=e=>{s(),_(e)},t[17]=s,t[18]=_,t[19]=e):e=t[19];let n;return t[20]!==i||t[21]!==c||t[22]!==y||t[23]!==l||t[24]!==a||t[25]!==r||t[26]!==e||t[27]!==o?(n=(0,Z.jsx)(W4,{recents:r,currentPath:i,query:a,worktreeModel:o,onPickEntry:y,onPickBranch:e,guardStaleSelect:c,onRemoveRecent:l}),t[20]=i,t[21]=c,t[22]=y,t[23]=l,t[24]=a,t[25]=r,t[26]=e,t[27]=o,t[28]=n):n=t[28],n}let S;if(t[29]!==s||t[30]!==i||t[31]!==u||t[32]!==c||t[33]!==x||t[34]!==l||t[35]!==f||t[36]!==h||t[37]!==r||t[38]!==d||t[39]!==o){let e=aS(r),n;t[41]!==s||t[42]!==i||t[43]!==u||t[44]!==c||t[45]!==x||t[46]!==l||t[47]!==f||t[48]!==h||t[49]!==d||t[50]!==o?(n=e=>(0,Z.jsx)(z4,{group:e,currentPath:i,worktreeModel:o,flyoutOpen:u===e.project.path,setFlyoutOpen:t=>d(n=>t?e.project.path:n===e.project.path?null:n),onPickProject:()=>{if(e.project.path===i){s();return}h(e.project.path,`recents`)},onPickFlyoutEntry:x,guardStaleSelect:c,onRemoveRecent:l,openNewWorktreeWith:f},e.project.path),t[41]=s,t[42]=i,t[43]=u,t[44]=c,t[45]=x,t[46]=l,t[47]=f,t[48]=h,t[49]=d,t[50]=o,t[51]=n):n=t[51],S=e.map(n),t[29]=s,t[30]=i,t[31]=u,t[32]=c,t[33]=x,t[34]=l,t[35]=f,t[36]=h,t[37]=r,t[38]=d,t[39]=o,t[40]=S}else S=t[40];let C;return t[52]===S?C=t[53]:(C=(0,Z.jsx)(Z.Fragment,{children:S}),t[52]=S,t[53]=C),C}function z4(e){let t=(0,$.c)(45),{group:n,currentPath:r,worktreeModel:i,flyoutOpen:a,setFlyoutOpen:o,onPickProject:s,onPickFlyoutEntry:c,guardStaleSelect:l,onRemoveRecent:u,openNewWorktreeWith:d}=e,f=n.project.path===r,p,m;t[0]!==r||t[1]!==n||t[2]!==i?(p=nS(n,i,r),m=p.filter(B4),t[0]=r,t[1]=n,t[2]=i,t[3]=p,t[4]=m):(p=t[3],m=t[4]);let h=m.length;if(h===0){let e;t[5]!==l||t[6]!==s?(e=e=>{l(e)||s()},t[5]=l,t[6]=s,t[7]=e):e=t[7];let r=`project-switcher-recent-${n.project.path}`,i=f?`true`:void 0,a;t[8]!==n.project.name||t[9]!==n.project.path||t[10]!==f?(a=(0,Z.jsx)(q4,{name:n.project.name,path:n.project.path,current:f}),t[8]=n.project.name,t[9]=n.project.path,t[10]=f,t[11]=a):a=t[11];let o;t[12]!==e||t[13]!==r||t[14]!==i||t[15]!==a?(o=(0,Z.jsx)(li,{onSelect:e,className:`flex w-full min-w-0 flex-col items-start gap-0.5 pr-8`,"data-testid":r,"data-current":i,children:a}),t[12]=e,t[13]=r,t[14]=i,t[15]=a,t[16]=o):o=t[16];let c;t[17]!==n.project.name||t[18]!==n.project.path||t[19]!==u?(c=(0,Z.jsx)(oS,{path:n.project.path,name:n.project.name,onRemoveRecent:u,testIdPrefix:`project-switcher-recent`}),t[17]=n.project.name,t[18]=n.project.path,t[19]=u,t[20]=c):c=t[20];let d;t[21]!==o||t[22]!==c?(d=(0,Z.jsxs)(`div`,{className:`group/recent relative flex items-center`,children:[o,c]}),t[21]=o,t[22]=c,t[23]=d):d=t[23];let p;return t[24]!==n.project.path||t[25]!==u||t[26]!==d?(p=(0,Z.jsx)(sS,{path:n.project.path,onRemoveRecent:u,testIdPrefix:`project-switcher-recent`,children:d}),t[24]=n.project.path,t[25]=u,t[26]=d,t[27]=p):p=t[27],p}let g;t[28]!==r||t[29]!==n.worktrees||t[30]!==f?(g=f||n.worktrees.some(e=>e.path===r),t[28]=r,t[29]=n.worktrees,t[30]=f,t[31]=g):g=t[31];let _=g,v;return t[32]!==_||t[33]!==r||t[34]!==p||t[35]!==a||t[36]!==n||t[37]!==l||t[38]!==c||t[39]!==s||t[40]!==d||t[41]!==h||t[42]!==o||t[43]!==i?(v=(0,Z.jsx)(V4,{group:n,currentPath:r,containsCurrent:_,worktreeModel:i,flyoutEntries:p,openedWorktreeCount:h,flyoutOpen:a,setFlyoutOpen:o,onPickProject:s,onPickFlyoutEntry:c,guardStaleSelect:l,openNewWorktreeWith:d}),t[32]=_,t[33]=r,t[34]=p,t[35]=a,t[36]=n,t[37]=l,t[38]=c,t[39]=s,t[40]=d,t[41]=h,t[42]=o,t[43]=i,t[44]=v):v=t[44],v}function B4(e){return e.opened&&!e.isMain}function V4(e){let t=(0,$.c)(46),{group:n,currentPath:r,containsCurrent:i,worktreeModel:a,flyoutEntries:o,openedWorktreeCount:s,flyoutOpen:c,setFlyoutOpen:l,onPickProject:u,onPickFlyoutEntry:d,guardStaleSelect:f,openNewWorktreeWith:p}=e,{_:m}=on(),h=n.project.path===r,g;t[0]!==f||t[1]!==u?(g=e=>{f(e)||u()},t[0]=f,t[1]=u,t[2]=g):g=t[2];let _=g,v,y;t[3]===_?(v=t[4],y=t[5]):(v=e=>{e.target.closest(`[data-project-open]`)!==null&&(e.preventDefault(),_(e.nativeEvent))},y=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),_(e.nativeEvent))},t[3]=_,t[4]=v,t[5]=y);let b=`project-switcher-group-${n.project.path}`,x=c?`true`:void 0,S=i?`true`:void 0,C;t[6]===n.project.name?C=t[7]:(C=(0,Z.jsx)(`span`,{className:`truncate font-medium text-sm`,"data-project-open":``,title:n.project.name,children:n.project.name}),t[6]=n.project.name,t[7]=C);let w;t[8]===n.project.path?w=t[9]:(w=(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,title:n.project.path,children:n.project.path}),t[8]=n.project.path,t[9]=w);let T;t[10]!==C||t[11]!==w?(T=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[C,w]}),t[10]=C,t[11]=w,t[12]=T):T=t[12];let E;t[13]!==m||t[14]!==h?(E=h?(0,Z.jsx)(zl,{"aria-label":m({id:`Hp1l6f`}),className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`}):null,t[13]=m,t[14]=h,t[15]=E):E=t[15];let D=`project-switcher-toggle-${n.project.path}`,O;t[16]===s?O=t[17]:(O=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:s}),t[16]=s,t[17]=O);let k;t[18]===s?k=t[19]:(k=(0,Z.jsx)(Y,{id:`AKxFtn`,values:{openedWorktreeCount:s}}),t[18]=s,t[19]=k);let A;t[20]!==D||t[21]!==O||t[22]!==k?(A=(0,Z.jsxs)(`span`,{className:`mt-0.5 shrink-0 text-muted-foreground text-xs`,"data-testid":D,children:[O,` `,k]}),t[20]=D,t[21]=O,t[22]=k,t[23]=A):A=t[23];let j;t[24]!==E||t[25]!==A||t[26]!==v||t[27]!==y||t[28]!==b||t[29]!==x||t[30]!==S||t[31]!==T?(j=(0,Z.jsxs)(vi,{onClick:v,onKeyDown:y,className:`flex w-full min-w-0 items-start gap-2`,"data-testid":b,"data-flyout-open":x,"data-current":S,children:[T,E,A]}),t[24]=E,t[25]=A,t[26]=v,t[27]=y,t[28]=b,t[29]=x,t[30]=S,t[31]=T,t[32]=j):j=t[32];let M;t[33]!==o||t[34]!==c||t[35]!==n||t[36]!==f||t[37]!==d||t[38]!==p||t[39]!==a?(M=(0,Z.jsx)(H4,{group:n,open:c,worktreeModel:a,entries:o,onPickFlyoutEntry:d,guardStaleSelect:f,openNewWorktreeWith:p}),t[33]=o,t[34]=c,t[35]=n,t[36]=f,t[37]=d,t[38]=p,t[39]=a,t[40]=M):M=t[40];let N;return t[41]!==c||t[42]!==l||t[43]!==j||t[44]!==M?(N=(0,Z.jsxs)(di,{open:c,onOpenChange:l,children:[j,M]}),t[41]=c,t[42]=l,t[43]=j,t[44]=M,t[45]=N):N=t[45],N}function H4(e){let t=(0,$.c)(15),{group:n,open:r,worktreeModel:i,entries:a,onPickFlyoutEntry:o,guardStaleSelect:s,openNewWorktreeWith:c}=e,{_:l}=on(),[u,d]=(0,Q.useState)(``),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m,h;t[0]===r?(m=t[1],h=t[2]):(m=()=>{r&&f.current?.focus({preventScroll:!0})},h=[r],t[0]=r,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let g=function(){let e=p.current;return e===null?[]:[...e.querySelectorAll(`[role="menuitem"]`)]},_=function(e){g()[e]?.focus()},v=function(e,t){if(e.key===`ArrowDown`){e.preventDefault(),e.stopPropagation();let t=g(),n=t.indexOf(e.currentTarget);_(Math.min(n+1,t.length-1))}else if(e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation();let t=g().indexOf(e.currentTarget);t<=0?f.current?.focus():_(t-1)}else e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),t())},y;if(t[3]!==a||t[4]!==u){let e=u.trim().toLowerCase();y=e===``?a:a.filter(t=>(t.branch??``).toLowerCase().includes(e)),t[3]=a,t[4]=u,t[5]=y}else y=t[5];let b=y,x=i!==null&&i.mainRoot===n.project.mainRoot,S=u.trim(),C=x&&S.length>0,w;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(yh,{align:`inline-start`,children:(0,Z.jsx)(ct,{"aria-hidden":`true`})}),t[6]=w):w=t[6];let T;t[7]===l?T=t[8]:(T=l({id:`bSD4im`}),t[7]=l,t[8]=T);let E;t[9]===l?E=t[10]:(E=l({id:`Skr_7L`}),t[9]=l,t[10]=E);let D;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>d(e.target.value),t[11]=D):D=t[11];let O=b.length===0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(_i,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:l({id:`-uaQnI`})}),C?(0,Z.jsxs)(li,{onSelect:e=>{s(e)||c(S)},onKeyDown:e=>v(e,()=>c(S)),className:`flex items-center gap-2`,"data-testid":`project-switcher-flyout-create`,children:[(0,Z.jsx)(Mn,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,title:S,children:(0,Z.jsx)(Y,{id:`gHSAWT`,values:{typedName:S},components:{0:(0,Z.jsx)(`span`,{className:`font-medium`}),1:(0,Z.jsx)(`span`,{className:`font-mono`})}})})]}):null]}):b.map(e=>{let t=e.path??`branch:${e.branch}`,n=e.branch??l({id:`D12vtS`});return(0,Z.jsxs)(li,{onSelect:t=>{s(t)||o(e)},onKeyDown:t=>v(t,()=>o(e)),className:`flex items-center gap-2`,"data-testid":`project-switcher-flyout-entry-${t}`,"data-current":e.isCurrent?`true`:void 0,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,title:n,children:n}),(0,Z.jsx)(U4,{entry:e}),e.isCurrent?(0,Z.jsx)(J4,{}):null]},t)}),k;return t[12]!==p||t[13]!==O?(k=(0,Z.jsx)(`div`,{ref:p,className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain subtle-scrollbar`,children:O}),t[12]=p,t[13]=O,t[14]=k):k=t[14],(0,Z.jsx)(bi,{children:(0,Z.jsxs)(fi,{avoidCollisions:!1,sideOffset:-8,className:`flex max-h-80 w-96 flex-col gap-1 overflow-hidden p-1`,"data-testid":`project-switcher-flyout-${n.project.path}`,children:[(0,Z.jsxs)(xh,{className:`mb-1 h-8 shrink-0`,children:[w,(0,Z.jsx)(bh,{ref:f,"aria-label":T,placeholder:E,value:u,onChange:D,onKeyDown:e=>{e.key===`ArrowDown`&&(e.preventDefault(),_(0)),e.stopPropagation()},"data-testid":`project-switcher-flyout-search-${n.project.path}`})]}),k]})})}function U4(e){let t=(0,$.c)(28),{entry:n}=e,{_:r}=on(),i;t[0]===r?i=t[1]:(i=r({id:`rnrdEX`}),t[0]=r,t[1]=i);let a;t[2]===r?a=t[3]:(a=r({id:`vAUpF5`}),t[2]=r,t[3]=a);let o;t[4]!==i||t[5]!==a?(o={label:i,description:a},t[4]=i,t[5]=a,t[6]=o):o=t[6];let s;t[7]===r?s=t[8]:(s=r({id:`z-lawV`}),t[7]=r,t[8]=s);let c;t[9]===r?c=t[10]:(c=r({id:`3UzaS-`}),t[9]=r,t[10]=c);let l;t[11]!==s||t[12]!==c?(l={label:s,description:c},t[11]=s,t[12]=c,t[13]=l):l=t[13];let u;t[14]===r?u=t[15]:(u=r({id:`nfoduq`}),t[14]=r,t[15]=u);let d;t[16]===r?d=t[17]:(d=r({id:`Dvwa0U`}),t[16]=r,t[17]=d);let f;t[18]!==u||t[19]!==d?(f={label:u,description:d},t[18]=u,t[19]=d,t[20]=f):f=t[20];let p;t[21]!==o||t[22]!==l||t[23]!==f?(p={primary:o,worktree:l,none:f},t[21]=o,t[22]=l,t[23]=f,t[24]=p):p=t[24];let{label:m,description:h}=p[tS(n)],g;return t[25]!==h||t[26]!==m?(g=(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,title:h,children:m}),t[25]=h,t[26]=m,t[27]=g):g=t[27],g}function W4(e){let t=(0,$.c)(43),{recents:n,currentPath:r,query:i,worktreeModel:a,onPickEntry:o,onPickBranch:s,guardStaleSelect:c,onRemoveRecent:l}=e,{_:u}=on(),d;t[0]===i?d=t[1]:(d=e=>e.toLowerCase().includes(i),t[0]=i,t[1]=d);let f=d,p,m,h,g;if(t[2]!==u||t[3]!==r||t[4]!==c||t[5]!==f||t[6]!==s||t[7]!==o||t[8]!==l||t[9]!==n||t[10]!==a){g=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[15]===f?e=t[16]:(e=e=>!e.isLinkedWorktree&&(f(e.name)||f(e.path)),t[15]=f,t[16]=e);let i=n.filter(e),d;t[17]===f?d=t[18]:(d=e=>e.isLinkedWorktree===!0&&(f(e.branch??``)||f(e.path)),t[17]=f,t[18]=d);let _=n.filter(d),v=new Set(_.map(G4)),y;t[19]===a?.entries?y=t[20]:(y=a?.entries??[],t[19]=a?.entries,t[20]=y);let b=y.filter(e=>e.branch!==null&&f(e.branch)&&(e.worktreePath===null||!v.has(e.worktreePath))&&e.worktreePath!==r);if(i.length===0&&_.length===0&&b.length===0){let e;t[21]===u?e=t[22]:(e=u({id:`pEQFsW`}),t[21]=u,t[22]=e);let n;t[23]===e?n=t[24]:(n=(0,Z.jsx)(_i,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:e}),t[23]=e,t[24]=n),g=n;break bb0}let x;t[25]!==r||t[26]!==c||t[27]!==o||t[28]!==l?(x=e=>(0,Z.jsx)(sS,{path:e.path,onRemoveRecent:l,testIdPrefix:`project-switcher-recent`,children:(0,Z.jsxs)(`div`,{className:`group/recent relative flex items-center`,children:[(0,Z.jsx)(li,{onSelect:t=>{c(t)||o(e)},className:`flex w-full min-w-0 flex-col items-start gap-0.5 pr-8`,"data-testid":`project-switcher-recent-${e.path}`,children:(0,Z.jsx)(q4,{name:e.name,path:e.path,current:e.path===r})}),(0,Z.jsx)(oS,{path:e.path,name:e.name,onRemoveRecent:l,testIdPrefix:`project-switcher-recent`})]})},e.path),t[25]=r,t[26]=c,t[27]=o,t[28]=l,t[29]=x):x=t[29],p=i.map(x);let S;t[30]!==r||t[31]!==c||t[32]!==o?(S=e=>(0,Z.jsxs)(li,{onSelect:t=>{c(t)||o(e)},className:`flex items-start gap-2`,"data-testid":`project-switcher-worktree-${e.path}`,"data-current":e.path===r?`true`:void 0,children:[(0,Z.jsx)($c,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),(0,Z.jsx)(K4,{branch:e.branch??e.name,project:e.mainRoot===void 0?null:iS(e.mainRoot)})]},e.path),t[30]=r,t[31]=c,t[32]=o,t[33]=S):S=t[33],m=_.map(S);let C;t[34]!==u||t[35]!==c||t[36]!==s||t[37]!==a?(C=e=>(0,Z.jsxs)(li,{onSelect:t=>{c(t)||e.branch!==null&&s(e.branch)},className:`flex items-start gap-2`,"data-testid":`project-switcher-branch-${e.branch}`,children:[(0,Z.jsx)($c,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 opacity-40`}),(0,Z.jsx)(K4,{branch:e.branch??``,project:a===null?null:iS(a.mainRoot),hint:u({id:`nfoduq`})})]},`branch:${e.branch}`),t[34]=u,t[35]=c,t[36]=s,t[37]=a,t[38]=C):C=t[38],h=b.map(C)}t[2]=u,t[3]=r,t[4]=c,t[5]=f,t[6]=s,t[7]=o,t[8]=l,t[9]=n,t[10]=a,t[11]=p,t[12]=m,t[13]=h,t[14]=g}else p=t[11],m=t[12],h=t[13],g=t[14];if(g!==Symbol.for(`react.early_return_sentinel`))return g;let _;return t[39]!==p||t[40]!==m||t[41]!==h?(_=(0,Z.jsxs)(Z.Fragment,{children:[p,m,h]}),t[39]=p,t[40]=m,t[41]=h,t[42]=_):_=t[42],_}function G4(e){return e.path}function K4(e){let t=(0,$.c)(12),{branch:n,project:r,hint:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:n}),t[0]=n,t[1]=a);let o;t[2]===i?o=t[3]:(o=i===void 0?null:(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,children:i}),t[2]=i,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,Z.jsxs)(`span`,{className:`flex w-full min-w-0 items-center gap-1.5`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===r?c=t[8]:(c=r===null?null:(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,title:r,children:r}),t[7]=r,t[8]=c);let l;return t[9]!==s||t[10]!==c?(l=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[s,c]}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function q4(e){let t=(0,$.c)(15),{name:n,path:r,current:i}=e,a=i&&`font-medium`,o;t[0]===a?o=t[1]:(o=Bn(`flex w-full items-center gap-1.5`,a),t[0]=a,t[1]=o);let s;t[2]===n?s=t[3]:(s=(0,Z.jsx)(`span`,{className:`truncate font-medium text-sm`,title:n,children:n}),t[2]=n,t[3]=s);let c;t[4]===i?c=t[5]:(c=i?(0,Z.jsx)(zl,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}):null,t[4]=i,t[5]=c);let l;t[6]!==o||t[7]!==s||t[8]!==c?(l=(0,Z.jsxs)(`span`,{className:o,children:[s,c]}),t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9];let u;t[10]===r?u=t[11]:(u=(0,Z.jsx)(`span`,{className:`w-full truncate text-muted-foreground text-xs`,title:r,children:r}),t[10]=r,t[11]=u);let d;return t[12]!==l||t[13]!==u?(d=(0,Z.jsxs)(`span`,{className:`flex w-full min-w-0 flex-col gap-0.5`,children:[l,u]}),t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function J4(){let e=(0,$.c)(4),{_:t}=on(),n;e[0]===t?n=e[1]:(n=t({id:`Hp1l6f`}),e[0]=t,e[1]=n);let r;return e[2]===n?r=e[3]:(r=(0,Z.jsx)(zl,{"aria-label":n,className:`size-3.5 shrink-0 text-muted-foreground`}),e[2]=n,e[3]=r),r}var Y4=(e,t,n)=>Yx(e,t,n,`ProjectSwitcher`),X4=350;function Z4(e){let t=(0,$.c)(121),{bridge:n}=e,{_:r}=on(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(null),v=WI(),y=Kx(),b=typeof window<`u`&&window.okDesktop!=null,x=(0,Q.useRef)(!1),S=(0,Q.useRef)(!1),C=(0,Q.useRef)(null),w;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>{e&&(S.current=!0,C.current!==null&&clearTimeout(C.current),C.current=setTimeout(()=>{S.current=!1},X4)),s(e),e||(l(``),_(null))},t[0]=w):w=t[0];let T=w,E;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>!b||!S.current?!1:(e.preventDefault(),!0),t[1]=E):E=t[1];let D=E,O;t[2]!==r||t[3]!==n.project||t[4]!==o?(O=()=>{if(!o)return;let e=!1;return Y4(async()=>{let t=await n.project.listRecent();e||a(t)},r({id:`fYKgzG`})),()=>{e=!0}},t[2]=r,t[3]=n.project,t[4]=o,t[5]=O):O=t[5];let k;t[6]!==r||t[7]!==n||t[8]!==o?(k=[o,n,r],t[6]=r,t[7]=n,t[8]=o,t[9]=k):k=t[9],(0,Q.useEffect)(O,k);let A,j;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>Fn(e=>{e===`new-worktree`?(s(!1),_(null),h(``),p(!0)):e===`switch-worktree`&&s(!0)}),j=[],t[10]=A,t[11]=j):(A=t[10],j=t[11]),(0,Q.useEffect)(A,j);let M;t[12]!==r||t[13]!==n.dialog||t[14]!==n.project?(M=()=>{T(!1),Y4(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})},r({id:`gmJ0An`}))},t[12]=r,t[13]=n.dialog,t[14]=n.project,t[15]=M):M=t[15];let N=M,P;t[16]!==r||t[17]!==n.project?(P=()=>{T(!1),Y4(()=>n.project.openFile(),r({id:`8vCZcs`}))},t[16]=r,t[17]=n.project,t[18]=P):P=t[18];let F=P,I;t[19]!==r||t[20]!==n.navigator?(I=()=>{T(!1),Y4(()=>n.navigator.open(),r({id:`jol95m`}))},t[19]=r,t[20]=n.navigator,t[21]=I):I=t[21];let L=I,R;t[22]!==r||t[23]!==n.project?(R=e=>Y4(async()=>{await n.project.removeRecent(e),a(t=>t===null?t:t.filter(t=>t.path!==e))},r({id:`viwC-K`})),t[22]=r,t[23]=n.project,t[24]=R):R=t[24];let z=R,B;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(B=()=>{T(!1),d(!0)},t[25]=B):B=t[25];let V=B,H;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>{T(!1),h(e),p(!0)},t[26]=H):H=t[26];let U=H,W=n.config.projectPath,ee;t[27]===c?ee=t[28]:(ee=c.trim().toLowerCase(),t[27]=c,t[28]=ee);let G=ee,K=G!==``,q;t[29]===i?q=t[30]:(q=i??[],t[29]=i,t[30]=q);let te=q,J;t[31]!==K||t[32]!==te?(J=K?te.filter(a3):te,t[31]=K,t[32]=te,t[33]=J):J=t[33];let ne=J,ie=K?null:y,ae=v!==null&&`h-auto py-1.5`,oe;t[34]===ae?oe=t[35]:(oe=Bn(`justify-between text-sidebar-foreground/70 hover:text-sidebar-foreground! data-open:hover:text-sidebar-foreground!`,ae),t[34]=ae,t[35]=oe);let se;t[36]===r?se=t[37]:(se=r({id:`zZ_I5K`}),t[36]=r,t[37]=se);let ce;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ce=b?()=>{x.current=!0}:void 0,t[38]=ce):ce=t[38];let le;t[39]===o?le=t[40]:(le=b?()=>{if(x.current){x.current=!1;return}T(!o)}:void 0,t[39]=o,t[40]=le);let ue;t[41]===n.config.projectName?ue=t[42]:(ue=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[41]=n.config.projectName,t[42]=ue);let de;t[43]===v?de=t[44]:(de=v===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 text-xs text-sidebar-foreground/50 group-hover/menu-button:text-sidebar-foreground`,"data-testid":`project-switcher-branch`,children:[(0,Z.jsx)($c,{"aria-hidden":`true`,className:`size-3! shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:v})]}),t[43]=v,t[44]=de);let fe;t[45]!==ue||t[46]!==de?(fe=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[ue,de]}),t[45]=ue,t[46]=de,t[47]=fe):fe=t[47];let pe;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Z.jsx)(nu,{"aria-hidden":`true`,className:`opacity-60`}),t[48]=pe):pe=t[48];let me;t[49]!==n.config.projectPath||t[50]!==oe||t[51]!==se||t[52]!==le||t[53]!==fe?(me=(0,Z.jsx)(hi,{asChild:!0,children:(0,Z.jsxs)(RI,{className:oe,"data-testid":`project-switcher-trigger`,"aria-label":se,title:n.config.projectPath,onPointerDown:ce,onClick:le,children:[fe,pe]})}),t[49]=n.config.projectPath,t[50]=oe,t[51]=se,t[52]=le,t[53]=fe,t[54]=me):me=t[54];let he;t[55]!==r||t[56]!==n||t[57]!==W||t[58]!==g||t[59]!==ne||t[60]!==ie||t[61]!==z||t[62]!==G||t[63]!==i||t[64]!==c?(he=i===null?null:i.length===0?(0,Z.jsx)(_i,{className:`font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`MUrVEo`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(xh,{className:`mb-1 h-8 border-0 shadow-none has-[[data-slot=input-group-control]:focus-visible]:ring-0`,children:[(0,Z.jsx)(bh,{"aria-label":r({id:`blFttG`}),placeholder:r({id:`RVZJWQ`}),value:c,onChange:e=>{e.target.value!==``&&_(null),l(e.target.value)},onKeyDown:i3,"data-testid":`project-switcher-search`}),(0,Z.jsx)(yh,{children:(0,Z.jsx)(ct,{"aria-hidden":`true`})})]}),(0,Z.jsx)(Si,{}),(0,Z.jsx)(`div`,{className:`max-h-64 overflow-x-hidden overflow-y-auto overscroll-contain subtle-scrollbar scroll-fade-mask`,"data-testid":`project-switcher-scroll`,onScroll:()=>{g!==null&&_(null)},children:(0,Z.jsx)(R4,{bridge:n,recents:ne,currentPath:W,query:G,worktreeModel:ie,closeMenu:()=>T(!1),guardStaleSelect:D,onRemoveRecent:z,flyoutPath:g,setFlyoutPath:_,openNewWorktreeWith:U})})]}),t[55]=r,t[56]=n,t[57]=W,t[58]=g,t[59]=ne,t[60]=ie,t[61]=z,t[62]=G,t[63]=i,t[64]=c,t[65]=he):he=t[65];let ge;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Z.jsx)(Si,{}),t[66]=ge):ge=t[66];let _e;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(_e=e=>{D(e)||V()},t[67]=_e):_e=t[67];let ve;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,Z.jsxs)(li,{onSelect:_e,"data-testid":`project-switcher-new-project`,children:[(0,Z.jsx)(Mn,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(Y,{id:`gKi-a_`})]}),t[68]=ve):ve=t[68];let ye;t[69]===L?ye=t[70]:(ye=e=>{D(e)||L()},t[69]=L,t[70]=ye);let be,xe;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(re,{"aria-hidden":`true`,className:`text-muted-foreground`}),xe=(0,Z.jsx)(Y,{id:`xaDWAI`}),t[71]=be,t[72]=xe):(be=t[71],xe=t[72]);let Se;t[73]===ye?Se=t[74]:(Se=(0,Z.jsxs)(li,{onSelect:ye,"data-testid":`project-switcher-switch-project`,children:[be,xe]}),t[73]=ye,t[74]=Se);let Ce;t[75]===N?Ce=t[76]:(Ce=e=>{D(e)||N()},t[75]=N,t[76]=Ce);let we,Te;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(hd,{"aria-hidden":`true`,className:`text-muted-foreground`}),Te=(0,Z.jsx)(Y,{id:`PVUn_c`}),t[77]=we,t[78]=Te):(we=t[77],Te=t[78]);let Ee;t[79]===Ce?Ee=t[80]:(Ee=(0,Z.jsxs)(li,{onSelect:Ce,"data-testid":`project-switcher-open-folder`,children:[we,Te]}),t[79]=Ce,t[80]=Ee);let De;t[81]===F?De=t[82]:(De=e=>{D(e)||F()},t[81]=F,t[82]=De);let Oe,ke;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,Z.jsx)(Rr,{"aria-hidden":`true`,className:`text-muted-foreground`}),ke=(0,Z.jsx)(Y,{id:`9npOH9`}),t[83]=Oe,t[84]=ke):(Oe=t[83],ke=t[84]);let Ae;t[85]===De?Ae=t[86]:(Ae=(0,Z.jsxs)(li,{onSelect:De,"data-testid":`project-switcher-open-file`,children:[Oe,ke]}),t[85]=De,t[86]=Ae);let je;t[87]===v?je=t[88]:(je=v===null?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Si,{}),(0,Z.jsxs)(li,{onSelect:e=>{D(e)||(T(!1),h(``),p(!0))},"data-testid":`project-switcher-new-worktree`,children:[(0,Z.jsx)($c,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(Y,{id:`DXd9LM`})]})]}),t[87]=v,t[88]=je);let Me;t[89]!==he||t[90]!==Se||t[91]!==Ee||t[92]!==Ae||t[93]!==je?(Me=(0,Z.jsxs)(yi,{align:`start`,side:`top`,className:`min-w-[260px]`,"data-testid":`project-switcher-menu`,children:[he,ge,ve,Se,Ee,Ae,je]}),t[89]=he,t[90]=Se,t[91]=Ee,t[92]=Ae,t[93]=je,t[94]=Me):Me=t[94];let Ne;t[95]!==o||t[96]!==me||t[97]!==Me?(Ne=(0,Z.jsxs)(xi,{open:o,onOpenChange:T,modal:!1,children:[me,Me]}),t[95]=o,t[96]=me,t[97]=Me,t[98]=Ne):Ne=t[98];let Pe;t[99]!==n||t[100]!==u?(Pe=(0,Z.jsx)(Uy,{open:u,onOpenChange:d,bridge:n}),t[99]=n,t[100]=u,t[101]=Pe):Pe=t[101];let Fe;t[102]===y?.entries?Fe=t[103]:(Fe=y?.entries.map(r3).filter(n3),t[102]=y?.entries,t[103]=Fe);let Ie;t[104]===y?.entries?Ie=t[105]:(Ie=new Set(y?.entries.filter(t3).map(e3)),t[104]=y?.entries,t[105]=Ie);let Le=y?.remoteBranches,Re;t[106]===y?.entries?Re=t[107]:(Re=new Map(y?.entries.filter($4).map(Q4)),t[106]=y?.entries,t[107]=Re);let ze;t[108]!==v||t[109]!==n||t[110]!==m||t[111]!==f||t[112]!==Fe||t[113]!==Ie||t[114]!==Le||t[115]!==Re?(ze=(0,Z.jsx)(M4,{open:f,onOpenChange:p,bridge:n,currentBranch:v,initialBranchName:m,branches:Fe,existingWorktreeBranches:Ie,remoteBranches:Le,behindByBranch:Re}),t[108]=v,t[109]=n,t[110]=m,t[111]=f,t[112]=Fe,t[113]=Ie,t[114]=Le,t[115]=Re,t[116]=ze):ze=t[116];let Be;return t[117]!==Ne||t[118]!==Pe||t[119]!==ze?(Be=(0,Z.jsxs)(Z.Fragment,{children:[Ne,Pe,ze]}),t[117]=Ne,t[118]=Pe,t[119]=ze,t[120]=Be):Be=t[120],Be}function Q4(e){return[e.branch,e.behind]}function $4(e){return e.branch!==null&&e.behind!==void 0}function e3(e){return e.branch}function t3(e){return e.branch!==null&&e.worktreePath!==null}function n3(e){return e!==null}function r3(e){return e.branch}function i3(e){return e.stopPropagation()}function a3(e){return!e.isLinkedWorktree}function o3(e,t){let n=e instanceof Error?e:Error(String(e));console.warn(JSON.stringify({event:`jsx-render-failure`,component:`sidebarSearchPill`,rawComponentName:`sidebarSearchPill`,error:String(n),stack:t.componentStack})),Ua(`sidebarSearchPill`)}function s3(e){let t=(0,$.c)(15),{onClick:n,className:r}=e,{_:i}=on(),a;t[0]===i?a=t[1]:(a=i({id:`A1taO8`}),t[0]=i,t[1]=a);let o=a,s;t[2]===r?s=t[3]:(s=Bn(`shrink-0 text-muted-foreground`,r),t[2]=r,t[3]=s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(ct,{"aria-hidden":`true`}),t[4]=c):c=t[4];let l;t[5]!==o||t[6]!==n||t[7]!==s?(l=(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,onClick:n,"aria-label":o,"data-telemetry-event":`ok.sidebar.search_pill.click`,className:s,children:c})}),t[5]=o,t[6]=n,t[7]=s,t[8]=l):l=t[8];let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(ne,{className:`text-foreground/70`,children:xs(`command-palette`)}),t[9]=u):u=t[9];let d;t[10]===o?d=t[11]:(d=(0,Z.jsxs)(cr,{children:[o,u]}),t[10]=o,t[11]=d);let f;return t[12]!==l||t[13]!==d?(f=(0,Z.jsxs)(ur,{children:[l,d]}),t[12]=l,t[13]=d,t[14]=f):f=t[14],f}var c3=e=>{let t=(0,$.c)(7),{label:n,shortcutId:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`span`,{children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsx)(ne,{"aria-label":Ss(r),children:xs(r)})]}):null,t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Z.jsxs)(cr,{children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o},l3=e=>{let t=(0,$.c)(17),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({icon:n,label:r,shortcutId:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===n?o=t[6]:(o=(0,Z.jsx)(n,{"aria-hidden":`true`}),t[5]=n,t[6]=o);let s;t[7]!==r||t[8]!==i||t[9]!==o?(s=(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":r,...i,children:o})}),t[7]=r,t[8]=i,t[9]=o,t[10]=s):s=t[10];let c;t[11]!==r||t[12]!==a?(c=(0,Z.jsx)(c3,{label:r,shortcutId:a}),t[11]=r,t[12]=a,t[13]=c):c=t[13];let l;return t[14]!==s||t[15]!==c?(l=(0,Z.jsxs)(ur,{children:[s,c]}),t[14]=s,t[15]=c,t[16]=l):l=t[16],l};function u3(e){let t=(0,$.c)(75),{open:n,onOpenChange:r,scope:i,existingNames:a,busy:o,onCreate:s}=e,{_:c}=on(),[l,u]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(null),h=(0,Q.useId)(),g=(0,Q.useId)(),_=(0,Q.useId)(),v=(0,Q.useRef)(null),y,b;t[0]!==a||t[1]!==n?(y=()=>{if(!n)return;let e=`new-skill`;for(let t=2;a.has(e);t++)e=`new-skill-${t}`;u(e),f(Wx),m(null)},b=[n,a],t[0]=a,t[1]=n,t[2]=y,t[3]=b):(y=t[2],b=t[3]),(0,Q.useEffect)(y,b);let x;t[4]!==c||t[5]!==a?(x=function(e){let t=e.trim();return t?Pa.test(t)?a.has(t)?c({id:`XIltnd`,values:{trimmed:t}}):null:c({id:`szy9BS`}):c({id:`hYDc6B`})},t[4]=c,t[5]=a,t[6]=x):x=t[6];let S=x,C;t[7]!==d||t[8]!==l||t[9]!==s||t[10]!==S?(C=function(){let e=l.trim(),t=S(e);if(t){m(t),v.current?.focus();return}s({name:e,description:d.trim()||`Describe what this skill does and when to use it.`})},t[7]=d,t[8]=l,t[9]=s,t[10]=S,t[11]=C):C=t[11];let w=C,T;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(hr,{children:(0,Z.jsx)(Y,{id:`MdpSC1`})}),t[12]=T):T=t[12];let E;t[13]===i?E=t[14]:(E=(0,Z.jsxs)(yr,{children:[T,(0,Z.jsx)(mr,{children:i===`global`?(0,Z.jsx)(Y,{id:`w7bnEb`}):(0,Z.jsx)(Y,{id:`1VpfKR`})})]}),t[13]=i,t[14]=E);let D;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(Y,{id:`6YtxFj`}),t[15]=D):D=t[15];let O;t[16]===h?O=t[17]:(O=(0,Z.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:h,children:D}),t[16]=h,t[17]=O);let k;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>{u(e.target.value),m(null)},t[18]=k):k=t[18];let A=p?!0:void 0,j=p?_:void 0,M;t[19]!==o||t[20]!==w?(M=e=>{e.key===`Enter`&&!o&&(e.preventDefault(),w())},t[19]=o,t[20]=w,t[21]=M):M=t[21];let N;t[22]!==l||t[23]!==h||t[24]!==A||t[25]!==j||t[26]!==M?(N=(0,Z.jsx)(zf,{ref:v,id:h,value:l,onChange:k,placeholder:`my-skill`,autoFocus:!0,onFocus:d3,"aria-invalid":A,"aria-describedby":j,onKeyDown:M}),t[22]=l,t[23]=h,t[24]=A,t[25]=j,t[26]=M,t[27]=N):N=t[27];let P;t[28]!==p||t[29]!==_?(P=p?(0,Z.jsx)(`p`,{id:_,role:`alert`,className:`text-1sm text-destructive`,children:p}):null,t[28]=p,t[29]=_,t[30]=P):P=t[30];let F;t[31]!==N||t[32]!==P||t[33]!==O?(F=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[O,N,P]}),t[31]=N,t[32]=P,t[33]=O,t[34]=F):F=t[34];let I;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(Y,{id:`Nu4oKW`}),t[35]=I):I=t[35];let L;t[36]===g?L=t[37]:(L=(0,Z.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:g,children:I}),t[36]=g,t[37]=L);let R;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>f(e.target.value),t[38]=R):R=t[38];let z;t[39]!==d||t[40]!==g?(z=(0,Z.jsx)(Pm,{id:g,value:d,onChange:R,rows:2,placeholder:Wx}),t[39]=d,t[40]=g,t[41]=z):z=t[41];let B;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(`p`,{className:`text-2xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`Tn5sik`})}),t[42]=B):B=t[42];let V;t[43]!==L||t[44]!==z?(V=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[L,z,B]}),t[43]=L,t[44]=z,t[45]=V):V=t[45];let H;t[46]!==F||t[47]!==V?(H=(0,Z.jsxs)(_r,{className:`space-y-4`,children:[F,V]}),t[46]=F,t[47]=V,t[48]=H):H=t[48];let U;t[49]===r?U=t[50]:(U=()=>r(!1),t[49]=r,t[50]=U);let W;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Z.jsx)(Y,{id:`dEgA5A`}),t[51]=W):W=t[51];let ee;t[52]!==o||t[53]!==U?(ee=(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:U,disabled:o,children:W}),t[52]=o,t[53]=U,t[54]=ee):ee=t[54];let G;t[55]!==o||t[56]!==l?(G=o||!l.trim(),t[55]=o,t[56]=l,t[57]=G):G=t[57];let K;t[58]===o?K=t[59]:(K=o?(0,Z.jsx)(Y,{id:`E9bKSA`}):(0,Z.jsx)(Y,{id:`hYgDIe`}),t[58]=o,t[59]=K);let q;t[60]!==w||t[61]!==G||t[62]!==K?(q=(0,Z.jsx)(X,{onClick:w,disabled:G,children:K}),t[60]=w,t[61]=G,t[62]=K,t[63]=q):q=t[63];let te;t[64]!==ee||t[65]!==q?(te=(0,Z.jsxs)(vr,{children:[ee,q]}),t[64]=ee,t[65]=q,t[66]=te):te=t[66];let J;t[67]!==H||t[68]!==te||t[69]!==E?(J=(0,Z.jsxs)(gr,{className:`sm:max-w-md`,children:[E,H,te]}),t[67]=H,t[68]=te,t[69]=E,t[70]=J):J=t[70];let ne;return t[71]!==r||t[72]!==n||t[73]!==J?(ne=(0,Z.jsx)(br,{open:n,onOpenChange:r,children:J}),t[71]=r,t[72]=n,t[73]=J,t[74]=ne):ne=t[74],ne}function d3(e){return e.currentTarget.select()}function f3(e){let t=(0,$.c)(29),{model:n,hostRef:r,ready:i,style:a,header:o,className:s,hostAttrs:c,renderContextMenu:l,onClickCapture:u,onMouseMove:d,onMouseLeave:f,onContentHeightChange:p,sizeToContent:m,titleForPath:h}=e,g=(0,Q.useRef)(h),_;t[0]===h?_=t[1]:(_=()=>{g.current=h},t[0]=h,t[1]=_),(0,Q.useEffect)(_);let v,y;t[2]!==r||t[3]!==i?(v=()=>{if(!i)return;let e=r.current?.querySelector(JW)?.shadowRoot;if(!e)return;let t=e=>g.current?.(e)??(e.endsWith(`/`)?e.slice(0,-1):e),n=()=>{for(let n of e.querySelectorAll(`[data-item-path]`)){let e=n.dataset.itemPath;if(!e)continue;let r=t(e);n.title!==r&&(n.title=r)}let n=e.querySelector(`[data-type="context-menu-anchor"]`);if(n){let r=e.querySelector(`[data-item-context-hover="true"][data-item-path]`)?.dataset.itemPath,i=r?t(r):``;n.title!==i&&(n.title=i)}};n();let a=new MutationObserver(n);return a.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`,`data-item-context-hover`]}),()=>a.disconnect()},y=[i,r],t[2]=r,t[3]=i,t[4]=v,t[5]=y):(v=t[4],y=t[5]),(0,Q.useEffect)(v,y);let b,x;t[6]!==r||t[7]!==i?(b=()=>{if(!i)return;let e=r.current?.querySelector(JW)?.shadowRoot;if(!e)return;let t=()=>f1(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},x=[i,r],t[6]=r,t[7]=i,t[8]=b,t[9]=x):(b=t[8],x=t[9]),(0,Q.useEffect)(b,x);let S,C;t[10]!==r||t[11]!==n||t[12]!==p||t[13]!==m?(S=()=>{if(!p&&!m)return;let e=0,t=0,i=()=>r.current?.querySelector(`file-tree-container`)?.shadowRoot?.querySelector(`[data-file-tree-virtualized-list]`)??null,a=()=>{let e=i();if(!e)return;let t=Number.parseFloat(e.style.height);Number.isFinite(t)&&(p?.(t),m&&r.current&&(r.current.style.height=`${t}px`))},o=()=>{cancelAnimationFrame(e),e=requestAnimationFrame(a)},s=new MutationObserver(a),c=()=>{let e=i();e?(s.observe(e,{attributes:!0,attributeFilter:[`style`]}),a()):t=requestAnimationFrame(c)};c();let l=n.subscribe(o);return window.addEventListener(`resize`,o),()=>{cancelAnimationFrame(e),cancelAnimationFrame(t),s.disconnect(),l(),window.removeEventListener(`resize`,o)}},C=[p,m,n,r],t[10]=r,t[11]=n,t[12]=p,t[13]=m,t[14]=S,t[15]=C):(S=t[14],C=t[15]),(0,Q.useEffect)(S,C);let w;t[16]!==o||t[17]!==c||t[18]!==n||t[19]!==u||t[20]!==f||t[21]!==d||t[22]!==l||t[23]!==a?(w=(0,Z.jsx)(e1,{header:o,model:n,style:a,...c,onClickCapture:u,onMouseMove:d,onMouseLeave:f,renderContextMenu:l}),t[16]=o,t[17]=c,t[18]=n,t[19]=u,t[20]=f,t[21]=d,t[22]=l,t[23]=a,t[24]=w):w=t[24];let T;return t[25]!==s||t[26]!==r||t[27]!==w?(T=(0,Z.jsx)(`div`,{ref:r,className:s,children:w}),t[25]=s,t[26]=r,t[27]=w,t[28]=T):T=t[28],T}var p3=`data-ok-install-cluster`,m3=`data-ok-cluster-key`,h3=`data-ok-install-pill`,g3=`data-ok-install-path`,_3=`data-ok-host-pool-key`,v3=`data-ok-cluster-hint`,y3=`
2014
+ `}\n${a1}\n${o1}\n${x0}`,k2={Item:li,Separator:Si,Sub:di,SubContent:fi,SubTrigger:vi};function A2(e){let t=(0,$.c)(133),{item:n,context:r,anyActionBusy:i,workspace:a,handoff:o,model:s,okignoreBinding:c,onStartCreating:l,onCreateFromTemplate:u,onDuplicate:d,onImportTemplate:f,onDelete:p,onExpandSubtree:m,onCollapseSubtree:h,folderTreePaths:g,isAsset:_,documents:v}=e,{_:y}=on(),b=Th(n,v),x=n.kind===`directory`,S;t[0]===n.path?S=t[1]:(S=Yf(n.path),t[0]=n.path,t[1]=S);let C=S,w=b.kind===`asset`?null:b,T=w!==null&&c!==null,E;t[2]!==y||t[3]!==x?(E=y(x?{id:`5D3Ior`}:{id:`dbhUX1`}),t[2]=y,t[3]=x,t[4]=E):E=t[4];let D=E,O;t[5]!==x||t[6]!==n.path?(O=x?Nh(n.path):null,t[5]=x,t[6]=n.path,t[7]=O):O=t[7];let k=O,A=Wu(k),j=A.state.status===`ready`?(A.state.data.folder.templates_available?.length??0)>0:!0,M=s.getSelectedPaths(),N=M.includes(b.treePath)?R1(M,v):[],P=N.length>1?N:[b],F=Ms._({id:`3nnyi_`,values:{0:P.length}}),I,L;if(t[8]!==v||t[9]!==_||t[10]!==x||t[11]!==n||t[12]!==a){if(L=Zh(n),I=null,x)I=Jc({folderRelativePath:L,workspace:a});else if(!_){let e;t[15]!==v||t[16]!==n.path||t[17]!==a?(e=kc({docName:kh(n.path,v),workspace:a}),t[15]=v,t[16]=n.path,t[17]=a,t[18]=e):e=t[18],I=e}t[8]=v,t[9]=_,t[10]=x,t[11]=n,t[12]=a,t[13]=I,t[14]=L}else I=t[13],L=t[14];let R;t[19]===r?R=t[20]:(R=()=>r.close({restoreFocus:!1}),t[19]=r,t[20]=R);let z=R,B;t[21]===r?B=t[22]:(B=()=>r.close(),t[21]=r,t[22]=B);let V=B,{status:H}=nl(),U=H?.hasRemote===!0,W;t[23]!==v||t[24]!==k||t[25]!==_||t[26]!==x||t[27]!==n.path||t[28]!==b?(W=null,x?W=$u(k??``):!_&&b.kind!==`asset`&&(W=td(kh(n.path,v))),t[23]=v,t[24]=k,t[25]=_,t[26]=x,t[27]=n.path,t[28]=b,t[29]=W):W=t[29];let ee=U&&W!==null,G;t[30]!==y||t[31]!==U||t[32]!==W?(G=function(){W&&Xu({...W,hasRemote:U,onClickWhenNoRemote:()=>{Ns.error(y({id:`WyQxwa`}))}},{clipboardWrite:nh,toastSuccess:N2,toastError:M2,logEvent:j2})},t[30]=y,t[31]=U,t[32]=W,t[33]=G):G=t[33];let K=G,q=0,te=0;if(x){let e=Uh(n.path);for(let t of g)(t===e||t.startsWith(e))&&(q++,L0(s.getItem(t))?.isExpanded()&&te++)}let J=x&&te<q,ne=x&&te>0,re=typeof window<`u`?window.okDesktop:void 0,ie;t[34]!==y||t[35]!==a?(ie=a?null:y({id:`wTcjov`}),t[34]=y,t[35]=a,t[36]=ie):ie=t[36];let ae=ie,oe;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(oe=re?tg(re.platform):null,t[37]=oe):oe=t[37];let se=oe,ce=se&&ae?`${se}, ${ae}`:se,le;t[38]!==y||t[39]!==V||t[40]!==x||t[41]!==c||t[42]!==w?(le=function(){if(!c||!w)return;V();let e=hL(w),t=Ku(c.current()),n=Yu(t,e);if(n===t)return;c.patch(Nu(n));let r=w.path.split(`/`).pop()||w.path;Ns.success(y(x?{id:`4xtLTl`,values:{basename:r}}:{id:`OD0FCX`,values:{basename:r}}),{description:y({id:`nWv1ja`}),duration:5e3})},t[38]=y,t[39]=V,t[40]=x,t[41]=c,t[42]=w,t[43]=le):le=t[43];let ue=le,de;t[44]===V?de=t[45]:(de=e=>{e||V()},t[44]=V,t[45]=de);let fe;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Z.jsx)(hi,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[46]=fe):fe=t[46];let pe=a!=null,me;t[47]!==z||t[48]!==j||t[49]!==k||t[50]!==x||t[51]!==C||t[52]!==u||t[53]!==l?(me=x&&!C&&k!=null?{onNewFile:()=>{z(),l(`file`,k)},onNewFolder:()=>{z(),l(`folder`,k)},templateItems:j?(0,Z.jsx)(gL,{parentDir:k,onSelectTemplate:e=>{z(),u(k,e)},ItemComponent:li}):void 0}:void 0,t[47]=z,t[48]=j,t[49]=k,t[50]=x,t[51]=C,t[52]=u,t[53]=l,t[54]=me):me=t[54];let he;t[55]!==V||t[56]!==L||t[57]!==ce||t[58]!==ae||t[59]!==a?(he=re?{label:se,ariaLabel:ce??void 0,disabled:!a,hint:ae,onSelect:()=>{if(!a)return;V();let e=Yc(a.contentDir,L,a.pathSeparator);re.shell.showItemInFolder(e)}}:void 0,t[55]=V,t[56]=L,t[57]=ce,t[58]=ae,t[59]=a,t[60]=he):he=t[60];let ge;t[61]!==V||t[62]!==o||t[63]!==I||t[64]!==_?(ge=_?void 0:(0,Z.jsx)(Ac,{input:I,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch,onBeforeLaunch:V}),t[61]=V,t[62]=o,t[63]=I,t[64]=_,t[65]=ge):ge=t[65];let _e;t[66]!==ee||t[67]!==V||t[68]!==K?(_e=ee?{onSelect:()=>{V(),K()}}:void 0,t[66]=ee,t[67]=V,t[68]=K,t[69]=_e):_e=t[69];let ve;t[70]!==V||t[71]!==L||t[72]!==a?(ve=()=>{a&&(V(),y2(Yc(a.contentDir,L,a.pathSeparator),`full`))},t[70]=V,t[71]=L,t[72]=a,t[73]=ve):ve=t[73];let ye;t[74]!==V||t[75]!==L?(ye=()=>{V(),y2(L,`relative`)},t[74]=V,t[75]=L,t[76]=ye):ye=t[76];let be;t[77]!==V||t[78]!==x||t[79]!==n||t[80]!==h||t[81]!==m||t[82]!==ne||t[83]!==J?(be=x?{onExpandAll:J?()=>{V(),m(n.path)}:void 0,onCollapseAll:ne?()=>{V(),h(n.path)}:void 0}:void 0,t[77]=V,t[78]=x,t[79]=n,t[80]=h,t[81]=m,t[82]=ne,t[83]=J,t[84]=be):be=t[84];let xe;t[85]!==V||t[86]!==_||t[87]!==x||t[88]!==C||t[89]!==f||t[90]!==b?(xe=!x&&!_&&!C?e=>{V(),f(b,e)}:void 0,t[85]=V,t[86]=_,t[87]=x,t[88]=C,t[89]=f,t[90]=b,t[91]=xe):xe=t[91];let Se;t[92]!==V||t[93]!==_||t[94]!==C||t[95]!==d||t[96]!==b?(Se=!_&&!C?()=>{V(),d(b)}:void 0,t[92]=V,t[93]=_,t[94]=C,t[95]=d,t[96]=b,t[97]=Se):Se=t[97];let Ce;t[98]!==z||t[99]!==C||t[100]!==n||t[101]!==s?(Ce=C?void 0:()=>{z(),s.startRenaming(n.path)},t[98]=z,t[99]=C,t[100]=n,t[101]=s,t[102]=Ce):Ce=t[102];let we;t[103]!==T||t[104]!==D||t[105]!==ue||t[106]!==C||t[107]!==w?(we=!C&&w?{label:D,disabled:!T,onSelect:ue}:void 0,t[103]=T,t[104]=D,t[105]=ue,t[106]=C,t[107]=w,t[108]=we):we=t[108];let Te;t[109]!==V||t[110]!==P||t[111]!==C||t[112]!==p?(Te=C?void 0:()=>{V(),p(P)},t[109]=V,t[110]=P,t[111]=C,t[112]=p,t[113]=Te):Te=t[113];let Ee;t[114]!==i||t[115]!==F||t[116]!==pe||t[117]!==me||t[118]!==he||t[119]!==ge||t[120]!==_e||t[121]!==ve||t[122]!==ye||t[123]!==be||t[124]!==xe||t[125]!==Se||t[126]!==Ce||t[127]!==we||t[128]!==Te?(Ee=(0,Z.jsx)(yi,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:(0,Z.jsx)(pL,{busy:i,deleteLabel:F,primitives:k2,workspaceReady:pe,folderCreate:me,reveal:he,openWithAi:ge,share:_e,onCopyFullPath:ve,onCopyRelativePath:ye,folderTree:be,onImportTemplate:xe,onDuplicate:Se,onRename:Ce,hide:we,onDelete:Te})}),t[114]=i,t[115]=F,t[116]=pe,t[117]=me,t[118]=he,t[119]=ge,t[120]=_e,t[121]=ve,t[122]=ye,t[123]=be,t[124]=xe,t[125]=Se,t[126]=Ce,t[127]=we,t[128]=Te,t[129]=Ee):Ee=t[129];let De;return t[130]!==de||t[131]!==Ee?(De=(0,Z.jsxs)(xi,{open:!0,modal:!1,onOpenChange:de,children:[fe,Ee]}),t[130]=de,t[131]=Ee,t[132]=De):De=t[132],De}function j2(e){return console.log(e)}function M2(e){return Ns.error(e)}function N2(e){return Ns.success(e)}function P2(e){let t=(0,$.c)(376),{ref:n}=e,{_:r,i18n:i}=on(),{activeDocName:a,activeTarget:s,closeTabs:c,closeDocument:l,isNewTabActive:u,openTarget:d,prewarm:f,reconcileLocalRemoval:p,reconcileLocalRename:m,setSkillsSidebar:h}=Oe(),{notifySidebarFileSelected:g}=xI(),{resolvedTheme:_}=Dn(),{addPage:v,pageMeta:y,pages:b}=Eu(),{okignoreBinding:x,merged:S}=xc(),C=S?.appearance?.sidebar?.showHiddenFiles??!1,w=S?.appearance?.sidebar?.showOnlyMarkdownFiles??!1,T=S?.appearance?.sidebar?.showOkFolders??!1,E=S?.editor?.previewTabs??!0?`preview`:`permanent`,D;t[0]===E?D=t[1]:(D={disposition:E,consumeActiveNewTab:!0},t[0]=E,t[1]=D);let O=D,k;t[2]===r?k=t[3]:(k=r({id:`8RtNI0`}),t[2]=r,t[3]=k);let A;t[4]===r?A=t[5]:(A=r({id:`HlmZBk`}),t[4]=r,t[5]=A);let j;t[6]===r?j=t[7]:(j=r({id:`34qyH5`}),t[6]=r,t[7]=j);let M;t[8]!==k||t[9]!==A||t[10]!==j?(M={fallbackErrorTitle:k,schemaMismatchTitle:A,couldNotReachServerTitle:j},t[8]=k,t[9]=A,t[10]=j,t[11]=M):M=t[11];let N;t[12]!==C||t[13]!==T||t[14]!==w||t[15]!==M?(N={showHiddenFiles:C,showOnlyMarkdownFiles:w,showOkFolders:T,messages:M},t[12]=C,t[13]=T,t[14]=w,t[15]=M,t[16]=N):N=t[16];let{documents:P,setDocuments:F,recordOptimisticAdd:I,loading:L,error:R,setError:z,reconnecting:B,relaunchInFlight:V,truncatedShownCount:H,unfilteredRootEntryCount:U,observeExpandedFolderPaths:W}=p2(N),ee;t[17]===y?ee=t[18]:(ee=function(e,t){return rp(e,t??y.get(e)?.size)??{kind:`doc`,target:e,docName:e}},t[17]=y,t[18]=ee);let G=ee,[K,q]=(0,Q.useState)(null),[te,J]=(0,Q.useState)(null),[ne,re]=(0,Q.useState)(null),[ie,ae]=(0,Q.useState)(null),{conflicts:oe}=Uu(),[se,ce]=(0,Q.useState)(null),[le,ue]=(0,Q.useState)(null),[de,fe]=(0,Q.useState)(!1),pe=(0,Q.useRef)(de),me;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(me=new Set,t[19]=me):me=t[19];let he=(0,Q.useRef)(me),ge=(0,Q.useRef)(P),_e=(0,Q.useRef)(y),ve=(0,Q.useRef)(null),ye;t[20]!==v||t[21]!==G||t[22]!==g||t[23]!==d||t[24]!==O||t[25]!==h?(ye=function(e){if(e.kind===`doc`)e.registerPage&&v(e.docName),d(G(e.docName,e.size),O),bf(Cf(e.docName));else if(e.kind===`folder`)d({kind:`folder`,target:e.folderPath,folderPath:e.folderPath},O),bf(Of(e.folderPath));else{let t=(e.entries??ge.current).find(t=>Xf(t)&&t.path===e.assetPath);d({kind:`asset`,target:e.assetPath,assetPath:e.assetPath,mediaKind:t?.mediaKind??null},O),bf(Sf(e.assetPath))}h(!1),g()},t[20]=v,t[21]=G,t[22]=g,t[23]=d,t[24]=O,t[25]=h,t[26]=ye):ye=t[26];let be=ye,xe;t[27]!==P||t[28]!==be||t[29]!==g||t[30]!==d||t[31]!==b||t[32]!==O?(xe=function(e,t){let n=t===void 0?P:t,r=h0(e,n);if(r.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,Ah(e));return}if(r.kind===`asset`){d({kind:`asset`,target:r.path,assetPath:r.path,mediaKind:r.mediaKind},O),bf(r.hash),g();return}if(r.kind===`folder`){be({kind:`folder`,folderPath:r.path});return}let i=n.find(e=>Wf(e)&&e.docName===r.path),a=dp(r.path,{pages:b,docExt:i?.docExt});if(a?.kind===`asset`){d(a,O),bf(Sf(a.assetPath)),g();return}if(a?.kind===`doc`){be({kind:`doc`,docName:a.docName});return}be({kind:`doc`,docName:r.path,size:i?.size,registerPage:Bf(r.path)})},t[27]=P,t[28]=be,t[29]=g,t[30]=d,t[31]=b,t[32]=O,t[33]=xe):xe=t[33];let Se=xe,Ce=(0,Q.useRef)(a),we;t[34]===P?we=t[35]:(we=new Set(P.filter(Xf).map(s4)),t[34]=P,t[35]=we);let Te=we,Ee=(0,Q.useRef)(Te),De;t[36]===P?De=t[37]:(De=q1(P),t[36]=P,t[37]=De);let ke=De,Ae=(0,Q.useRef)(ke),je;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(je=[],t[38]=je):je=t[38];let Me=(0,Q.useRef)(je),Ne=(0,Q.useRef)(null),Pe=(0,Q.useRef)(o4),Fe=(0,Q.useRef)(null),Ie=(0,Q.useRef)(null),Le=(0,Q.useRef)(!1),Re=(0,Q.useRef)(!1),ze=(0,Q.useRef)(null),Be;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(Be={row:null,root:null},t[39]=Be):Be=t[39];let He=(0,Q.useRef)(Be),Ue=(0,Q.useRef)(a4),We=(0,Q.useRef)(null),Ke=(0,Q.useRef)(null),qe=(0,Q.useRef)(i4),Je=(0,Q.useRef)(!1),Ye=(0,Q.useRef)(null),Xe=(0,Q.useRef)(r4),Ze=(0,Q.useRef)(n4),Qe=(0,Q.useRef)(t4),$e=(0,Q.useRef)(e4),et=(0,Q.useRef)(s),[tt,nt]=(0,Q.useState)(!1),rt,it;t[40]!==P.length||t[41]!==L?(rt=()=>{if(L||P.length===0)return;let e=Ye.current?.querySelector(JW)?.shadowRoot;if(!e)return;let t=e,n=function(){ze.current!==null&&clearTimeout(ze.current),ze.current=setTimeout(()=>{Re.current=!1,ze.current=null},0)},r=function(e){if(!(e instanceof DragEvent))return;let t=l4(e),n=t?.dataset.itemPath;if(!n)return;let r=k0(t.dataset.itemType===`folder`?Uh(n):n,ge.current,_e.current);r&&(ze.current!==null&&(clearTimeout(ze.current),ze.current=null),Re.current=!0,e.dataTransfer?.setData(Eh,Bh(r)))},i=function(e){e instanceof DragEvent&&Oh(e.dataTransfer)&&e.dataTransfer&&(e.dataTransfer.effectAllowed=`copyMove`)},a=function(e){if(!(e instanceof DragEvent)||!Rh(e))return;let t=d4(e);if(!t){_2(He);return}e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`),v2(He,t)},o=function(e){if(!(e instanceof DragEvent)||!Rh(e))return;let n=e.relatedTarget;n instanceof Node&&t.contains(n)||_2(He)},s=function(e){if(!(e instanceof DragEvent)||!Rh(e))return;let t=d4(e),n=Ih(e);if(!t||n.length===0){_2(He);return}e.preventDefault(),e.stopPropagation(),_2(He),Ue.current(n,t.parentDir,t.busyPath)};return e.addEventListener(`dragstart`,r,{capture:!0}),e.addEventListener(`dragstart`,i),e.addEventListener(`dragover`,a,{capture:!0}),e.addEventListener(`dragleave`,o,{capture:!0}),e.addEventListener(`drop`,s,{capture:!0}),e.addEventListener(`dragend`,n,{capture:!0}),window.addEventListener(`drop`,n,!0),window.addEventListener(`dragend`,n,!0),()=>{e.removeEventListener(`dragstart`,r,{capture:!0}),e.removeEventListener(`dragstart`,i),e.removeEventListener(`dragover`,a,{capture:!0}),e.removeEventListener(`dragleave`,o,{capture:!0}),e.removeEventListener(`drop`,s,{capture:!0}),e.removeEventListener(`dragend`,n,{capture:!0}),window.removeEventListener(`drop`,n,!0),window.removeEventListener(`dragend`,n,!0),_2(He),ze.current!==null&&(clearTimeout(ze.current),ze.current=null),Re.current=!1}},it=[P.length,L],t[40]=P.length,t[41]=L,t[42]=rt,t[43]=it):(rt=t[42],it=t[43]),(0,Q.useEffect)(rt,it);let{selectedFilePath:at,selectedFolderPath:ot,navigationPath:st}=m0(s,u?null:a),ct=at?Jh(at,P.find(e=>Wf(e)&&e.docName===at)?.docExt):ot?Uh(ot):s?.kind===`asset`?s.assetPath:null,lt=de?null:ct,ut=qn().states,{dispatch:dt}=Tc(),ft;t[44]!==dt||t[45]!==ut?(ft={installStates:ut,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:dt},t[44]=dt,t[45]=ut,t[46]=ft):ft=t[46];let pt=ft,ht;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(ht=()=>We.current===null,t[47]=ht):ht=t[47];let gt=ht,_t;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(_t=[],t[48]=_t):_t=t[48];let vt;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(vt={set:`complete`,spriteSheet:O1,byFileExtension:{md:{name:w1,viewBox:Ge},mdx:{name:w1,viewBox:Ge}}},t[49]=vt):vt=t[49];let yt;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(yt={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[50]=yt):yt=t[50];let bt;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(bt={canDrag:gt,canDrop:gt,onDropComplete:e=>$e.current(e),onDropError:$2},t[51]=bt):bt=t[51];let xt,St;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(xt={canRename:gt,onRename:e=>Ze.current(e),onError:e=>Qe.current(e)},St=e=>Xe.current(e),t[52]=xt,t[53]=St):(xt=t[52],St=t[53]);let Ct;t[54]===r?Ct=t[55]:(Ct={paths:_t,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,...r1,icons:vt,unsafeCSS:O2,composition:yt,dragAndDrop:bt,renaming:xt,onSelectionChange:St,renderRowDecoration:e=>{let{item:t}=e;if(t.kind===`file`){let e=Ae.current.docsByTreePath.get(t.path);if(e?.isSymlink){let t=e.targetPath;return{icon:S1,title:r(t?{id:`JE21eh`,values:{targetPath:t}}:{id:`BQu9Pg`})}}return N1(t.path)?{icon:C1,title:r({id:`i9toLO`})}:null}let n=Ae.current.foldersByTreeDirectoryPath.get(Uh(t.path));if(n?.isSymlink){let e=n.targetPath;return{icon:S1,title:r(e?{id:`JE21eh`,values:{targetPath:e}}:{id:`BQu9Pg`})}}return null}},t[54]=r,t[55]=Ct);let{model:wt}=t1(Ct),Tt;t[56]===wt?Tt=t[57]:(Tt=function(e){let t=wt.getItem(e)??wt.getItem(Uh(e));return t?.isDirectory()?Uh(Nh(t.getPath())):e},t[56]=wt,t[57]=Tt);let Et=Tt,Dt,Ot;t[58]===P?(Dt=t[59],Ot=t[60]):(Ot=Ph(P),Dt=Qh(Ot),t[58]=P,t[59]=Dt,t[60]=Ot);let kt=Dt,At=(0,Q.useRef)(Ot),jt;t[61]!==P||t[62]!==T?(jt=Wh(P,{includeOkFolders:T}),t[61]=P,t[62]=T,t[63]=jt):jt=t[63];let Mt=jt,Nt=(0,Q.useRef)(Mt),Pt=ot?qh(Uh(ot)).slice(0,-1):qh(lt??st),Ft=Pt.join(`\0`),It;t[64]===wt?It=t[65]:(It=()=>{let e=new Set;for(let t of Nt.current)L0(wt.getItem(t))?.isExpanded()&&e.add(t);return e},t[64]=wt,t[65]=It);let Lt=It,Rt;t[66]===Lt?Rt=t[67]:(Rt=e=>{let t=new Set(Wh(e??ge.current,{includeOkFolders:Je.current})),n=Lt();for(let e of Me.current)n.add(e);return[...n].filter(e=>t.has(e))},t[66]=Lt,t[67]=Rt);let zt=Rt,Bt;t[68]!==zt||t[69]!==wt?(Bt=e=>{let t=Ph(e??ge.current);wt.resetPaths(t,{initialExpandedPaths:zt(e)})},t[68]=zt,t[69]=wt,t[70]=Bt):Bt=t[70];let Vt=Bt,Ht;t[71]!==wt||t[72]!==Vt?(Ht=(e,t,n,r)=>{let i=r===void 0?[]:r,a=0,o=null;for(let{fromDocName:r,toDocName:i}of n){let n=e.find(e=>Wf(e)&&e.docName===r);if(n==null||wt.getItem(i)==null)continue;let s=Jh(i,t.find(e=>Wf(e)&&e.docName===i)?.docExt??n.docExt);wt.move(i,s),o=s,a+=1}for(let{toPath:e}of i){let t=Hf(e);if(t===``)continue;let n=e.slice(0,-t.length);wt.getItem(n)!=null&&(wt.getItem(e)??wt.move(n,e),o=e,a+=1)}a!==0&&(Vt(t),o!=null&&wt.focusPath(o))},t[71]=wt,t[72]=Vt,t[73]=Ht):Ht=t[73];let Ut=Ht,Wt;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(Wt=e=>{Fe.current=Hh(e)},t[74]=Wt):Wt=t[74];let Gt=Wt,Kt;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(Kt=e=>Ee.current.has(e),t[75]=Kt):Kt=t[75];let qt=Kt,Jt;t[76]!==r||t[77]!==v||t[78]!==be||t[79]!==Vt||t[80]!==F||t[81]!==z?(Jt=async function(e){if(e.kind===`asset`||We.current!==null)return;let t=()=>{q(null),We.current=null};We.current=e.path,q(e.path),z(null);try{let n=await o(await fetch(`/api/duplicate-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.path})}),r({id:`dw_dUJ`}));if(!n.ok){Ns.error(n.title),Vt(),t();return}let i=Ve(Fa,n.body,`duplicate-path`,null);if(i===null){let e=r({id:`67f-3g`});Ns.error(e),z(e),Fs([`files`,`backlinks`,`graph`]),Vt(),t();return}for(let e of i.duplicatedDocNames)v(e);F(t=>{let n=JL(t,e,i);return Vt(n),Gt(n),n}),Fs([`files`,`backlinks`,`graph`]),i.path!==e.path&&(i.kind===`folder`?be({kind:`folder`,folderPath:i.path}):be({kind:`doc`,docName:i.path})),Ns.success(i.kind===`folder`?r({id:`iilQXA`}):r({id:`A6h5b-`}),{description:i.path}),t()}catch(e){let n=e,i=n instanceof Error?n.message:String(n);console.warn(`[FileTree] duplicate failed:`,n),Ns.error(r({id:`EBVbtP`}),{description:i}),Vt(),t()}},t[76]=r,t[77]=v,t[78]=be,t[79]=Vt,t[80]=F,t[81]=z,t[82]=Jt):Jt=t[82];let Yt=Jt,Xt=(0,Q.useRef)(Yt),Zt;t[83]===Yt?Zt=t[84]:(Zt=()=>{Xt.current=Yt},t[83]=Yt,t[84]=Zt),(0,Q.useEffect)(Zt);let Qt=function(e){let t=A1(e);if(!t||j1(t))return!1;let n=wt.getFocusedPath()??wt.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||qt(n))return!1;let r=j1(n);if(!r)return!1;let i=Uh(t);if(!Nt.current.includes(i))return!1;let a=`${t}${r}`;return At.current.includes(a)?!1:(Tn({sourcePath:n,destinationPath:a,isFolder:!1}),wt.move(n,a),!0)},$t;t[85]===Symbol.for(`react.memo_cache_sentinel`)?($t=e=>{let t=e??Ne.current;!t||Ne.current!==t||(t.disposeCommitListener(),Ne.current=null)},t[85]=$t):$t=t[85];let en=$t,tn;t[86]!==r||t[87]!==en||t[88]!==l||t[89]!==c||t[90]!==Vt||t[91]!==F?(tn=async function(e,t){let n=t===void 0?{}:t,i=n.updateUi??!0,a=n.restoreLocation??i;en(e),i&&q(e.renamePath);try{let t=await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.createdPath})});if(!t.ok&&t.status!==404){let n=e.kind,a=e.createdPath,s=await o(t,r({id:`EcM3k7`,values:{kind:n}}));if(s.ok)return;let c=s.title,l=r({id:`YPFBfr`,values:{detail:c,kind:n,createdPath:a}});i?Ns.error(l):console.warn(`[FileTree] cleanup pending create failed: ${l}`),i&&(q(null),Vt());return}}catch(t){if(console.warn(`[FileTree] cleanup pending create failed:`,t),i){let t=e.kind,n=e.createdPath;Ns.error(r({id:`_TDESN`,values:{kind:t,createdPath:n}}))}i&&(q(null),Vt());return}i&&(e.kind===`file`?l(e.createdPath):c([op(e.createdPath)],{force:!0})),i&&F(t=>{let n=KL(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return Gt(n),n}),Fs([`files`,`backlinks`,`graph`]),a&&(window.location.hash=e.previousHash),i&&q(null)},t[86]=r,t[87]=en,t[88]=l,t[89]=c,t[90]=Vt,t[91]=F,t[92]=tn):tn=t[92];let nn=tn,rn,an;t[93]===Symbol.for(`react.memo_cache_sentinel`)?(rn=()=>()=>{let e=Ne.current;e&&Pe.current(e,{restoreLocation:!1,updateUi:!1}).catch(Q2)},an=[],t[93]=rn,t[94]=an):(rn=t[93],an=t[94]),(0,Q.useEffect)(rn,an);let sn,cn;t[95]===Symbol.for(`react.memo_cache_sentinel`)?(sn=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=Ve(So,n,`workspace`,null);r&&ue({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(Z2),()=>{e=!1}},cn=[],t[95]=sn,t[96]=cn):(sn=t[95],cn=t[96]),(0,Q.useEffect)(sn,cn);let ln;t[97]!==zt||t[98]!==wt||t[99]!==kt?(ln=()=>{if(Fe.current===kt){Fe.current=null;return}wt.resetPaths(At.current,{initialExpandedPaths:zt()})},t[97]=zt,t[98]=wt,t[99]=kt,t[100]=ln):ln=t[100];let un;t[101]!==wt||t[102]!==kt?(un=[wt,kt],t[101]=wt,t[102]=kt,t[103]=un):un=t[103],(0,Q.useEffect)(ln,un),B0(wt,lt,Ft,Le,kt);let dn;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(dn=()=>{fe(!1)},t[104]=dn):dn=t[104];let fn;t[105]===ct?fn=t[106]:(fn=[ct],t[105]=ct,t[106]=fn),(0,Q.useEffect)(dn,fn);let pn,mn;t[107]===de?(pn=t[108],mn=t[109]):(pn=()=>{pe.current=de;for(let e of he.current)e()},mn=[de],t[107]=de,t[108]=pn,t[109]=mn),(0,Q.useEffect)(pn,mn);let hn;t[110]!==lt||t[111]!==L||t[112]!==wt?(hn=()=>{L||!lt||f0(wt,lt)},t[110]=lt,t[111]=L,t[112]=wt,t[113]=hn):hn=t[113];let gn;t[114]!==Ft||t[115]!==lt||t[116]!==L||t[117]!==wt||t[118]!==kt?(gn=[lt,Ft,kt,L,wt],t[114]=Ft,t[115]=lt,t[116]=L,t[117]=wt,t[118]=kt,t[119]=gn):gn=t[119],(0,Q.useEffect)(hn,gn);let _n,vn;t[120]===wt?(_n=t[121],vn=t[122]):(_n=()=>wt.subscribe(()=>{if(!wt.isSearchOpen())for(let e of Me.current){let t=L0(wt.getItem(e));t&&!t.isExpanded()&&t.expand()}}),vn=[wt],t[120]=wt,t[121]=_n,t[122]=vn),(0,Q.useEffect)(_n,vn);let yn;t[123]!==Lt||t[124]!==wt?(yn=()=>wt.subscribe(()=>{qe.current([...Lt()])}),t[123]=Lt,t[124]=wt,t[125]=yn):yn=t[125];let bn;t[126]===wt?bn=t[127]:(bn=[wt],t[126]=wt,t[127]=bn),(0,Q.useEffect)(yn,bn);let xn,Sn;t[128]===wt?(xn=t[129],Sn=t[130]):(xn=()=>wt.onMutation(`remove`,e=>{let t=Ne.current;!t||e.path!==t.renamePath||Pe.current(t)}),Sn=[wt],t[128]=wt,t[129]=xn,t[130]=Sn),(0,Q.useEffect)(xn,Sn);let Cn;t[131]!==v||t[132]!==be||t[133]!==m||t[134]!==Ut||t[135]!==F?(Cn=async(e,t,n,r,i)=>{let a=t===void 0?[]:t,o=n===void 0?[]:n,s=i===void 0?[]:i,c=r?.docName??Ce.current,l=new Map,u=new Map;for(let e of ge.current){if(Wf(e)){let t=o.find(t=>t.fromPath===Jh(e.docName,e.docExt))?.toPath;t&&l.set(e.docName,t);continue}if(Xf(e)){let t=o.find(t=>t.fromPath===e.path)?.toPath;t&&Bf(t)&&u.set(e.path,$h(t))}}let d=c?l.get(c)??null:null,f=r?.folderPath??(et.current?.kind===`folder`?et.current.folderPath:null),p=f?Qf(f,a):null,h=r?.assetPath??(et.current?.kind===`asset`?et.current.assetPath:null),g=h?u.get(h)??null:null,_=d?null:g??YL(c,e),y=d??(h?g?null:o.find(e=>e.fromPath===h)?.toPath??Qf(h,a):null);await m({renamed:e,renamedFolders:a,renamedAssets:o,additionalRemovedDocNames:[...l.keys()]});for(let t of e)v(t.toDocName);for(let e of u.values())v(e);let b=null;F(t=>{let n=GL(t,e,a,o,s);return b=n,Ut(t,n,e,o),Gt(n),n}),f&&p&&p!==f?be({kind:`folder`,folderPath:p}):_&&_!==c?(be({kind:`doc`,docName:_}),g2(_)):y&&(d||y!==h)&&be({kind:`asset`,assetPath:y,entries:b??ge.current}),Fs([`files`,`backlinks`,`graph`])},t[131]=v,t[132]=be,t[133]=m,t[134]=Ut,t[135]=F,t[136]=Cn):Cn=t[136];let wn=Cn;async function Tn(e){let t=!e.isFolder&&qt(e.sourcePath),n=t?e.sourcePath:Lh(e.sourcePath,e.isFolder);q(n),z(null);try{let i=Vf(e.sourcePath,e.destinationPath,e.isFolder),a=!e.isFolder&&!t&&!Bf(i.destinationPath),s=t||a?i.destinationPath:Lh(i.destinationPath,e.isFolder),c=e.isFolder?{kind:`folder`,fromPath:Nh(n),toPath:Nh(s)}:t||a?{kind:`asset`,fromPath:n,toPath:s}:{kind:`file`,fromPath:kh(n,ge.current),toPath:s},l={docName:Ce.current,folderPath:et.current?.kind===`folder`?et.current.folderPath:null,assetPath:et.current?.kind===`asset`?et.current.assetPath:null},u=await o(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(c)}),r({id:`gijbne`}));if(!u.ok){Ns.error(u.title),Vt();let e=Ne.current;e&&e.renamePath===n?await nn(e):en(),q(null);return}let d=Ve(qa,u.body,`rename-path`,{renamed:[],renamedAssets:[]});try{await wn(d.renamed,e.isFolder?[{fromPath:Nh(n),toPath:Nh(s)}]:[],d.renamedAssets,l,!e.isFolder&&!t&&!a?d.renamed.flatMap(e=>{let t=Hf(s);return t?[{toDocName:e.toDocName,docExt:t}]:[]}):[])}catch(e){console.warn(`[FileTree] post-rename reconciliation failed`,{err:e,sourceTreePath:n,destinationTreePath:s,renamedCount:d.renamed.length,renamedAssetCount:d.renamedAssets.length}),Ns.error(r({id:`dDpCOp`}))}en(),q(null)}catch(e){console.warn(`[FileTree] rename failed:`,e);let t=r({id:`HIb0vl`});Ns.error(t),z(t),Vt();let i=Ne.current;i&&i.renamePath===n?await nn(i):en(),q(null)}}let En=(0,Q.useEffectEvent)(Tn),On;t[137]!==r||t[138]!==wn||t[139]!==Vt||t[140]!==z?(On=async function(e){let t=e.draggedPaths.map(t=>{let n=zh(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(X2);if(t.length!==0){q(t[0]?.sourcePath??null),z(null);try{let e=[],n=[],i=[],a={docName:Ce.current,folderPath:et.current?.kind===`folder`?et.current.folderPath:null,assetPath:et.current?.kind===`asset`?et.current.assetPath:null};for(let a of t){let t=a.sourcePath.endsWith(`/`),s=!t&&qt(a.sourcePath),c=s?null:kh(a.sourcePath,ge.current),l=t?{kind:`folder`,fromPath:Nh(a.sourcePath),toPath:Nh(a.destinationTreePath)}:s?{kind:`asset`,fromPath:a.sourcePath,toPath:a.destinationTreePath}:{kind:`file`,fromPath:c??$h(a.sourcePath),toPath:c&&Bf(c)?a.destinationTreePath:$h(a.destinationTreePath)},u=await o(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(l)}),r({id:`dOHMA0`}));if(!u.ok){Ns.error(u.title),Vt(),q(null);return}let d=Ve(qa,u.body,`rename-path:drop`,{renamed:[],renamedAssets:[]});e=e.concat(d.renamed),n=n.concat(d.renamedAssets),t&&i.push({fromPath:Nh(a.sourcePath),toPath:Nh(a.destinationTreePath)})}try{await wn(e,i,n,a)}catch(i){console.warn(`[FileTree] post-move reconciliation failed`,{err:i,operationCount:t.length,renamedCount:e.length,renamedAssetCount:n.length}),Ns.error(r({id:`8OxKZy`}))}q(null)}catch(e){console.warn(`[FileTree] move failed:`,e),Ns.error(r({id:`HIb0vl`})),Vt(),q(null)}}},t[137]=r,t[138]=wn,t[139]=Vt,t[140]=z,t[141]=On):On=t[141];let kn=On,An;t[142]!==r||t[143]!==v||t[144]!==I||t[145]!==Vt||t[146]!==F||t[147]!==z?(An=async function(e,t,n){if(e.length===0||We.current!==null)return;let i=()=>{We.current=null,q(null)};We.current=n,q(n),z(null);let a=[],s=0,c=0;for(let n of e){let e=new FormData;e.append(`file`,n),Yh(e,t,n.name||`upload`);try{let i=await o(await fetch(`/api/upload`,{method:`POST`,body:e}),r({id:`4Gz2wC`}));if(!i.ok){c+=1,Ns.error(i.title,{description:n.name});continue}let l=Ve(na,i.body,`upload:drop`,null);if(l===null){c+=1,Ns.error(r({id:`4Gz2wC`}),{description:n.name});continue}let u=Dh(t,l);if(l.deduped===!0){c+=1,Ns.error(r({id:`4sKwf6`}),{description:u});continue}s+=1;let d=Xh(u,n);d&&a.push(d)}catch(e){let t=e;c+=1,console.warn(`[FileTree] external file upload failed:`,t),Ns.error(t instanceof TypeError?r({id:`HIb0vl`}):r({id:`4Gz2wC`}),{description:n.name})}}try{if(a.length>0){for(let e of a)Wf(e)&&v(e.docName);F(e=>{let t=new Set(e.map(Fh)),n=!1,r=[...e];for(let e of a){let i=Fh(e);I(e),!t.has(i)&&(t.add(i),r.push(e),n=!0)}return n?(Vt(r),Gt(r),r):e})}s>0&&(Fs([`files`,`backlinks`,`graph`]),Ns.success(Ms._({id:`v75Em9`,values:{uploadedCount:s}}),{description:t||r({id:`RSqaSd`})})),c>0&&z(s>0?Ms._({id:`yH7T4q`,values:{failedCount:c}}):r({id:`4Gz2wC`})),i()}catch(e){let t=e,n=r({id:`VcqWBy`});console.warn(`[FileTree] upload post-upload reconciliation failed:`,t),Ns.error(n),z(n),i()}},t[142]=r,t[143]=v,t[144]=I,t[145]=Vt,t[146]=F,t[147]=z,t[148]=An):An=t[148];let jn=An,Mn;t[149]===Symbol.for(`react.memo_cache_sentinel`)?(Mn=function(e){ce({parentDir:e})},t[149]=Mn):Mn=t[149];let Nn=Mn,Pn;t[150]!==r||t[151]!==v||t[152]!==nn||t[153]!==en||t[154]!==wt||t[155]!==be||t[156]!==I||t[157]!==Vt||t[158]!==F||t[159]!==Ot?(Pn=async function(e,t,n){if(We.current)return;let i=Ne.current;i&&en(i);try{let i=Gh(e,t,[...Ot,...Nt.current]);q(i.renamePath),We.current=i.renamePath;let a=window.location.hash,s;if(e===`file`){let e=Mh(`file`,i.addPath),t={path:e};n?.template&&(t.template=n.template);let a=await o(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),r({id:`fJgQHX`}));if(!a.ok){Ns.error(a.title),q(null),We.current=null;return}let c=$h(e),l=Ve(cs,a.body,`create-page`,{docName:c}).docName;s=l;let u={kind:`document`,docName:l,docExt:e.toLowerCase().endsWith(`.mdx`)?`.mdx`:`.md`,modified:new Date().toISOString(),size:0};v(l),F(e=>{if(e.some(e=>Wf(e)&&e.docName===l))return e;let t=[...e,u];return Gt(t),I(u),t}),Fs([`files`,`backlinks`,`graph`]),be({kind:`doc`,docName:l})}else{let e=Nh(i.addPath),t=await o(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),r({id:`K1ckLX`}));if(!t.ok){Ns.error(t.title),q(null),We.current=null;return}s=Ve(sa,t.body,`create-folder`,{path:e}).path;let n={kind:`folder`,path:s,modified:new Date().toISOString(),size:0};F(e=>{if(e.some(e=>qf(e)&&e.path===s))return e;let t=[...e,n];return Gt(t),I(n),t}),Fs([`files`]),be({kind:`folder`,folderPath:s})}let c=!1,l=e=>{if(e.key!==`Enter`||rr())return;let t=Ne.current;!t||t.renamePath!==i.renamePath||queueMicrotask(()=>en(t))};document.addEventListener(`keydown`,l,!0),Ne.current={kind:e,renamePath:i.renamePath,createdPath:s,previousHash:a,disposeCommitListener:()=>{c||(c=!0,document.removeEventListener(`keydown`,l,!0))}},q(null),We.current=null,wt.add(i.addPath),wt.startRenaming(i.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),Ns.error(r({id:`S6l5dv`}));let t=Ne.current;t?await nn(t):en(),q(null),We.current=null,Vt()}},t[150]=r,t[151]=v,t[152]=nn,t[153]=en,t[154]=wt,t[155]=be,t[156]=I,t[157]=Vt,t[158]=F,t[159]=Ot,t[160]=Pn):Pn=t[160];let Fn=Pn,In;t[161]===wt?In=t[162]:(In=function(e){let t=Uh(e);(0,Q.startTransition)(()=>{for(let e of Nt.current)if(e===t||e.startsWith(t)){let t=L0(wt.getItem(e));t&&t.expand()}})},t[161]=wt,t[162]=In);let Ln=In,Rn;t[163]===wt?Rn=t[164]:(Rn=function(e){let t=Uh(e),n=new Set(Me.current);(0,Q.startTransition)(()=>{for(let e of[...Nt.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=L0(wt.getItem(e));t&&t.collapse()}})},t[163]=wt,t[164]=Rn);let zn=Rn,Vn;t[165]===Symbol.for(`react.memo_cache_sentinel`)?(Vn=function(){return((Ye.current?.querySelector(`file-tree-container`)?.shadowRoot)?.querySelector(`[aria-selected="true"][data-item-path]`))?.dataset.itemPath??null},t[165]=Vn):Vn=t[165];let Un=Vn,Wn;t[166]!==Se||t[167]!==Pt||t[168]!==a||t[169]!==s||t[170]!==Te||t[171]!==K||t[172]!==nn||t[173]!==P||t[174]!==Mt||t[175]!==kn||t[176]!==Tn||t[177]!==Et||t[178]!==W||t[179]!==y||t[180]!==Qt||t[181]!==ke||t[182]!==T||t[183]!==Ot||t[184]!==jn?(Wn=()=>{ge.current=P,Ae.current=ke,_e.current=y,Ce.current=a,et.current=s,Ee.current=Te,We.current=K,Je.current=T,At.current=Ot,Nt.current=Mt,Me.current=Pt,qe.current=W,Pe.current=nn,Ue.current=(e,t,n)=>{jn(e,t,n)},Xe.current=e=>{if(Le.current||Re.current||e.length!==1)return;let t=e[0];if(t){fe(!1);let e=Et(t),n=ve.current,r=n!==null&&$h(n)===$h(e),i=r?n:e;ve.current=null,queueMicrotask(()=>{Se(Et((r?null:Un())??i),ge.current)})}},Qe.current=e=>{Qt(e)||Ns.error(e)},Ze.current=Tn,$e.current=kn},t[166]=Se,t[167]=Pt,t[168]=a,t[169]=s,t[170]=Te,t[171]=K,t[172]=nn,t[173]=P,t[174]=Mt,t[175]=kn,t[176]=Tn,t[177]=Et,t[178]=W,t[179]=y,t[180]=Qt,t[181]=ke,t[182]=T,t[183]=Ot,t[184]=jn,t[185]=Wn):Wn=t[185],(0,Q.useLayoutEffect)(Wn);let Gn,Kn;t[186]===wt?(Gn=t[187],Kn=t[188]):(Gn=()=>{let e=e=>{let t=(e.metaKey||e.ctrlKey)&&!e.altKey,n=e.key.toLowerCase(),r=t&&n===`a`,i=t&&!e.shiftKey&&n===`d`,a=t&&!e.shiftKey&&n===`c`,o=t&&!e.shiftKey&&n===`v`,s=!e.altKey&&!e.shiftKey&&(e.metaKey&&!e.ctrlKey&&n===`backspace`||!e.metaKey&&!e.ctrlKey&&n===`delete`);if(!r&&!i&&!a&&!o&&!s||W1(e.target))return;let c=Ye.current,l=e.target,u=document.activeElement,d=l instanceof Node&&c?.contains(l),f=u instanceof Node&&c?.contains(u);if(!d&&!f)return;if(a){let t=V1(wt,ge.current,Ee.current);if(!t)return;Ke.current=t,e.preventDefault(),e.stopPropagation();return}if(o){let t=Ke.current;if(!t)return;Xt.current(t),e.preventDefault(),e.stopPropagation();return}if(i){let t=V1(wt,ge.current,Ee.current);if(!t)return;Xt.current(t),e.preventDefault(),e.stopPropagation();return}if(s){if(We.current!==null)return;let t=H1(wt,ge.current);if(t.length===0)return;J({targets:t}),e.preventDefault(),e.stopPropagation();return}let p=new Set([...Nt.current,...At.current]);Le.current=!0;for(let e of p)e&&wt.getItem(e)?.select();queueMicrotask(()=>{Le.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},Kn=[wt],t[186]=wt,t[187]=Gn,t[188]=Kn),(0,Q.useEffect)(Gn,Kn);let Yn,Xn;t[189]!==P.length||t[190]!==L?(Yn=()=>{if(L||P.length===0)return;let e=Ye.current?.querySelector(JW)?.shadowRoot;if(!e)return;let t=Y2,n=()=>{for(let n of e.querySelectorAll(`[data-item-path]`)){let e=n.dataset.itemPath;if(!e)continue;let r=t(e);n.title!==r&&(n.title=r)}let n=e.querySelector(`[data-type="context-menu-anchor"]`);if(n){let r=e.querySelector(`[data-item-context-hover="true"][data-item-path]`)?.dataset.itemPath,i=r?t(r):``;n.title!==i&&(n.title=i)}};n();let r=new MutationObserver(n);return r.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`,`data-item-context-hover`]}),()=>r.disconnect()},Xn=[L,P.length],t[189]=P.length,t[190]=L,t[191]=Yn,t[192]=Xn):(Yn=t[191],Xn=t[192]),(0,Q.useEffect)(Yn,Xn);let Zn,Qn;t[193]!==P.length||t[194]!==L?(Zn=()=>{if(L||P.length===0)return;let e=Ye.current?.querySelector(JW)?.shadowRoot;if(!e)return;let t=()=>f1(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},Qn=[L,P.length],t[193]=P.length,t[194]=L,t[195]=Zn,t[196]=Qn):(Zn=t[195],Qn=t[196]),(0,Q.useEffect)(Zn,Qn);let $n=S?.validation?.fileTreeIndicators!==!1,er,tr;t[197]!==P.length||t[198]!==L||t[199]!==$n?(er=()=>{if(L||P.length===0)return;let e=Ye.current?.querySelector(JW)?.shadowRoot;if(!e)return;if(!$n){Z1(e,new Map);return}let t=()=>Z1(e,_u());t();let n=new MutationObserver(t);n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]});let r=ru(t);return()=>{n.disconnect(),r()}},tr=[L,P.length,$n],t[197]=P.length,t[198]=L,t[199]=$n,t[200]=er,t[201]=tr):(er=t[200],tr=t[201]),(0,Q.useEffect)(er,tr);let nr,ir;t[202]!==P.length||t[203]!==L?(nr=()=>{if(L||P.length===0)return;let e=Ye.current?.querySelector(JW)?.shadowRoot;if(!e)return;let t=()=>s0(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},ir=[L,P.length],t[202]=P.length,t[203]=L,t[204]=nr,t[205]=ir):(nr=t[204],ir=t[205]),(0,Q.useEffect)(nr,ir);let ar;t[206]===Symbol.for(`react.memo_cache_sentinel`)?(ar={folderCount:0,expandedCount:0},t[206]=ar):ar=t[206];let or=(0,Q.useRef)(ar),sr=(0,Q.useRef)(Fn),cr=(0,Q.useRef)(Nn),lr;t[207]===Fn?lr=t[208]:(lr=()=>{sr.current=Fn,cr.current=Nn},t[207]=Fn,t[208]=lr),(0,Q.useEffect)(lr);let ur,dr;t[209]===wt?(ur=t[210],dr=t[211]):(ur=()=>({startCreating(e,t){sr.current(e,t)},startCreatingFromTemplate(e){cr.current(e)},createFromTemplate(e,t){sr.current(`file`,e,{template:t})},expandAll(){(0,Q.startTransition)(()=>{for(let e of Nt.current){let t=L0(wt.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(Me.current);(0,Q.startTransition)(()=>{for(let t of[...Nt.current].reverse()){if(e.has(t))continue;let n=L0(wt.getItem(t));n&&n.collapse()}})},getFolderState(){let e=Nt.current,t=0;for(let n of e)L0(wt.getItem(n))?.isExpanded()&&t++;let n=e.length,r=or.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return or.current=i,i},isCreationTargetCleared(){return pe.current},subscribe(e){he.current.add(e);let t=wt.subscribe(e);return()=>{he.current.delete(e),t()}}}),dr=[wt],t[209]=wt,t[210]=ur,t[211]=dr),(0,Q.useImperativeHandle)(n,ur,dr);let fr;t[212]!==en||t[213]!==wt||t[214]!==p||t[215]!==F?(fr=async function(e,t,n){let r=G1(e,ge.current,Nt.current),i=Ne.current;i&&e.some(e=>K1(e,i))&&(i.kind===`file`?r.docNames.add(i.createdPath):r.folderPaths.add(i.createdPath),en(i));let a=new Set([...r.docNames,...t]),o=new Set([...r.folderPaths,...n]),s=new Set([...r.assetPaths,...e.filter(J2).map(q2)]);await p({tabIdsToClose:[...[...a].map(K2),...[...o].map(G2),...[...s].map(W2)],docNamesToClear:[...a]});for(let t of e){let e=t.kind===`folder`?Uh(t.path):t.kind===`asset`?t.path:Jh(t.path,t.docExt);wt.getItem(e)&&wt.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}F(e=>{let t=KL(e,[...a],void 0,[...s]);for(let e of o)t=KL(t,[],e);return Gt(t),t}),Fs([`files`,`backlinks`,`graph`])},t[212]=en,t[213]=wt,t[214]=p,t[215]=F,t[216]=fr):fr=t[216];let pr=fr,mr;t[217]!==r||t[218]!==pr||t[219]!==Vt||t[220]!==F||t[221]!==z?(mr=async function(e,t){if(We.current!==null)return;let n=()=>{q(null),We.current=null,re(null)};We.current=e.path,q(e.path),z(null);let i=e.path,a=i.lastIndexOf(`/`),o=a===-1?``:i.slice(0,a),s=await vd({sourcePath:e.path,targetFolder:o,deleteSource:t});if(!s.ok){Ns.error(r({id:`rDOuNw`}),{description:s.error}),n();return}t&&(await pr([e],[e.path],[]),F(t=>{let n=t.filter(t=>!(Wf(t)&&t.docName===e.path));return Vt(n),Gt(n),n}),Fs([`files`,`backlinks`,`graph`])),Ns.success(r({id:`Ba4D2x`}),{description:s.path}),n()},t[217]=r,t[218]=pr,t[219]=Vt,t[220]=F,t[221]=z,t[222]=mr):mr=t[222];let hr=mr,gr;t[223]===hr?gr=t[224]:(gr=async function(e,t){if(e.kind===`file`){if(t){re(e);return}await hr(e,!1)}},t[223]=hr,t[224]=gr);let _r=gr,vr=(0,Q.useEffectEvent)(_r),yr;t[225]!==r||t[226]!==pr?(yr=async function(e){let t=[],n=[],i=[];for(let a of e){let e=a.kind;q(a.path);let s=await o(await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),r({id:`7JtSLi`}));if(!s.ok)return i.length>0&&await pr(i,t,n),Ns.error(s.title),!1;let c=Ve(Ma,s.body,`delete-path`,{deletedDocNames:[]});t.push(...c.deletedDocNames),e===`folder`&&n.push(a.path),i.push(a)}return await pr(i,t,n),!0},t[225]=r,t[226]=pr,t[227]=yr):yr=t[227];let br=yr,xr;t[228]===Symbol.for(`react.memo_cache_sentinel`)?(xr=async function(e,t,n){let r=[],i=[];for(let a of e){q(a.path);let e=XL(a,n),o=await t.shell.trashItem(e);o.ok?r.push(a):i.push({kind:a.kind,path:a.path,name:a.name,reason:j0(o.reason),detail:o.detail})}return{trashed:r,failed:i}},t[228]=xr):xr=t[228];let Sr=xr,Cr;t[229]===r?Cr=t[230]:(Cr=async function(e){let t=[],n=[],i=[];for(let a of e){let e=a.kind;try{let s=await o(await fetch(`/api/trash/cleanup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),r({id:`DVh_Tb`}));if(!s.ok){console.warn(`[FileTree] trash-cleanup failed`,{target:`${a.kind}:${a.path}`,reason:s.title}),i.push({target:a,reason:s.title});continue}let c=Ve(Qa,s.body,`trash-cleanup`,{deletedDocNames:[]});t.push(...c.deletedDocNames),e===`folder`&&n.push(a.path)}catch(e){let t=e;console.warn(`[FileTree] trash-cleanup threw`,{target:`${a.kind}:${a.path}`,err:t}),i.push({target:a,reason:r({id:`r4R7AZ`})})}}if(i.length>0){let e=i.length,t=ng(typeof window<`u`?window.okDesktop?.platform:void 0);Ns.error(r({id:`IrB5AK`,values:{failedCount:e}}),{description:r({id:`skvOCc`,values:{trashNoun:t}})})}return i.length===e.length&&e.length>0?null:{deletedDocNames:t,deletedFolderPaths:n}},t[229]=r,t[230]=Cr);let wr=Cr,Tr;t[231]!==r||t[232]!==oe||t[233]!==pr||t[234]!==br||t[235]!==wr||t[236]!==Vt||t[237]!==le?(Tr=async function(e){let t=e.filter(U2).map(e=>qL(e,ge.current)),n=t[0];if(!n)return;let i=oe.filter(e=>t.some(t=>{if(t.kind===`file`){let n=`${t.path}${t.docExt??`.md`}`;return e.file===n}return t.kind===`folder`?e.file.startsWith(`${t.path}/`):!1}));if(i.length>0){let e=i.slice(0,3).map(H2),t=e.join(`, `),n=i.length-e.length;Ns.error(r({id:`erenF-`}),{description:r(n>0?{id:`deD5fS`,values:{files:t,overflow:n}}:{id:`yDlK9k`,values:{files:t}})});return}q(n.path),J(null);let a=typeof window<`u`?window.okDesktop:void 0;try{if(a&&le){let{trashed:e,failed:n}=await Sr(t,a,le);if(e.length>0){let t=await wr(e);t?await pr(e,t.deletedDocNames,t.deletedFolderPaths):await pr(e,e.filter(V2).map(B2),e.filter(z2).map(R2))}n.length>0&&ae({failed:n,originalTargets:[...t]}),q(null)}else{let e=await br(t);q(null),e||Vt()}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] delete failed:`,t),Ns.error(r({id:`0eHrMb`}),{description:n}),q(null),Vt()}},t[231]=r,t[232]=oe,t[233]=pr,t[234]=br,t[235]=wr,t[236]=Vt,t[237]=le,t[238]=Tr):Tr=t[238];let Er=Tr,Dr;t[239]!==r||t[240]!==br||t[241]!==Vt||t[242]!==ie?(Dr=async function(){if(!ie)return;let e=new Set(ie.failed.map(L2)),t=ie.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));if(ae(null),t.length!==0){q(t[0]?.path??null);try{let e=await br(t);q(null),e||Vt()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] hard-delete fallback failed:`,t),Ns.error(r({id:`0eHrMb`}),{description:n}),q(null),Vt()}}},t[239]=r,t[240]=br,t[241]=Vt,t[242]=ie,t[243]=Dr):Dr=t[243];let Or=Dr,kr;t[244]!==Er||t[245]!==ie?(kr=async function(){if(!ie)return;let e=new Set(ie.failed.map(I2)),t=ie.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));ae(null),await Er(t)},t[244]=Er,t[245]=ie,t[246]=kr):kr=t[246];let Ar=kr,jr,Mr;t[247]===Symbol.for(`react.memo_cache_sentinel`)?(jr=()=>DL(e=>{let t=b2(e,ge.current);if(t){Yf(t.path)||J({targets:[t]});return}x2(`delete`,e)}),Mr=[],t[247]=jr,t[248]=Mr):(jr=t[247],Mr=t[248]),(0,Q.useEffect)(jr,Mr);let Nr,Pr;t[249]===Symbol.for(`react.memo_cache_sentinel`)?(Nr=()=>jL(e=>{let t=b2(e,ge.current);if(t&&t.kind!==`asset`){Xt.current(t);return}x2(`duplicate`,e)}),Pr=[],t[249]=Nr,t[250]=Pr):(Nr=t[249],Pr=t[250]),(0,Q.useEffect)(Nr,Pr);let Fr;t[251]!==En||t[252]!==wt?(Fr=()=>kL((e,t)=>{let n=b2(e,ge.current,`tree-path`);if(!n){x2(`rename`,e);return}if(t===void 0){wt.startRenaming(n.path);return}En({sourcePath:n.path,destinationPath:WL(n,t),isFolder:n.kind===`folder`})}),t[251]=En,t[252]=wt,t[253]=Fr):Fr=t[253];let Ir;t[254]===wt?Ir=t[255]:(Ir=[wt],t[254]=wt,t[255]=Ir),(0,Q.useEffect)(Fr,Ir);let Lr;t[256]===vr?Lr=t[257]:(Lr=()=>NL((e,t)=>{let n=b2(e,ge.current);n?.kind===`file`&&vr(n,t)}),t[256]=vr,t[257]=Lr);let Rr;t[258]===Symbol.for(`react.memo_cache_sentinel`)?(Rr=[],t[258]=Rr):Rr=t[258],(0,Q.useEffect)(Lr,Rr);let zr;t[259]===Symbol.for(`react.memo_cache_sentinel`)?(zr=function(){let e=Ie.current;e&&$0(e),Ie.current=null},t[259]=zr):zr=t[259];let Br=zr,Vr;t[260]===Symbol.for(`react.memo_cache_sentinel`)?(Vr=function(e){let t=F1(e);if(!t)return!1;let n=Ye.current?.querySelector(JW)?.shadowRoot;if(!n)return!1;for(let e of n.querySelectorAll(`[data-item-path]`))if(e.dataset.itemPath===t)return!0;return!1},t[260]=Vr):Vr=t[260];let Hr=Vr,Ur;t[261]===f?Ur=t[262]:(Ur=function(e){let t=c4(e.nativeEvent);if(!t||t.endsWith(`/`)){Br();return}let n=ge.current.find(e=>Fh(e)===t);if(n&&Xf(n)){Br();return}let r=n&&Wf(n)?n.docName:kh(t,ge.current);if(n&&Wf(n)&&pa(n.size)){Br();return}Ie.current!==r&&(Br(),Ie.current=r,Q0(r,e=>f(e)))},t[261]=f,t[262]=Ur);let Wr=Ur,Gr;t[263]!==Se||t[264]!==wt||t[265]!==be?(Gr=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=l4(e.nativeEvent);if(!t){f4(e.nativeEvent)&&fe(!0);return}if(t.dataset.fileTreeStickyRow===`true`)return;let n=t.getAttribute(`aria-selected`)===`true`,r=t.dataset.itemPath;if(!r)return;let i=t.dataset.itemType===`folder`?Uh(r):r;if(t.dataset.itemType===`folder`){let e=Nh(i);if(n&&(wt.getSelectedPaths().length!==1||jf(window.location.hash,Of(e))))return;queueMicrotask(()=>be({kind:`folder`,folderPath:e}));return}if(!n){if(I1(i,At.current)||Hr(i)){ve.current=i,setTimeout(()=>be({kind:`doc`,docName:i,registerPage:!0}),0);return}queueMicrotask(()=>Se(i));return}let a=kh(i,ge.current);wt.getSelectedPaths().length===1&&(jf(window.location.hash,Cf(a))||queueMicrotask(()=>Se(i)))},t[263]=Se,t[264]=wt,t[265]=be,t[266]=Gr):Gr=t[266];let Kr=Gr,qr;t[267]===b?qr=t[268]:(qr=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||W1(e.target))return;let t=l4(e.nativeEvent);if(!t||t.dataset.fileTreeStickyRow===`true`||t.dataset.itemType===`folder`)return;let n=g0(t.dataset.itemPath,ge.current,b);n&&mt(n)},t[267]=b,t[268]=qr);let Jr=qr,Yr;t[269]===Symbol.for(`react.memo_cache_sentinel`)?(Yr=function(e){Rh(e.nativeEvent)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,nt(!0))},t[269]=Yr):Yr=t[269];let Xr=Yr,Zr;t[270]===Symbol.for(`react.memo_cache_sentinel`)?(Zr=function(e){let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||nt(!1)},t[270]=Zr):Zr=t[270];let Qr=Zr,$r;t[271]===jn?$r=t[272]:($r=function(e){if(!Rh(e.nativeEvent))return;let t=Ih(e.nativeEvent);t.length!==0&&(e.preventDefault(),e.stopPropagation(),nt(!1),jn(t,``,T2))},t[271]=jn,t[272]=$r);let ei=$r;if(L){let e;return t[273]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(m4,{}),t[273]=e):e=t[273],e}let ti;t[274]!==r||t[275]!==B||t[276]!==V?(ti=B?r(V?{id:`H-vDm3`}:{id:`09Tv5j`}):null,t[274]=r,t[275]=B,t[276]=V,t[277]=ti):ti=t[277];let ni=ti;if(P.length===0){if(ni!==null){let e;return t[278]===ni?e=t[279]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{role:`status`,className:`select-none text-sidebar-foreground/50 text-sm`,children:ni})}),t[278]=ni,t[279]=e),e}if(R){let e;return t[280]===R?e=t[281]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{role:`alert`,className:`select-none text-sidebar-foreground/50 text-sm`,children:R})}),t[280]=R,t[281]=e),e}if(Jf({visibility:{showHiddenFiles:C,showOnlyMarkdownFiles:w},unfilteredRootEntryCount:U,knownPageCount:b.size})===`filtered-to-zero`){let e;return t[282]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(n1,{}),t[282]=e):e=t[282],e}let e;t[283]===r?e=t[284]:(e=r({id:`5ZB7XC`}),t[283]=r,t[284]=e);let n=tt&&`bg-primary/5 ring-2 ring-primary/70 ring-inset`,i;t[285]===n?i=t[286]:(i=Bn(`flex flex-1 flex-col items-center justify-center gap-3 rounded-md py-8`,n),t[285]=n,t[286]=i);let a;t[287]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:(0,Z.jsx)(Y,{id:`xiv-dW`})}),t[287]=a):a=t[287];let o;t[288]===Fn?o=t[289]:(o=()=>Fn(`file`,``),t[288]=Fn,t[289]=o);let s;t[290]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Y,{id:`6ibbCg`}),t[290]=s):s=t[290];let c;t[291]===o?c=t[292]:(c=(0,Z.jsx)(X,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:o,children:s}),t[291]=o,t[292]=c);let l;return t[293]!==ei||t[294]!==e||t[295]!==i||t[296]!==c?(l=(0,Z.jsxs)(`section`,{"aria-label":e,className:i,onDragOver:Xr,onDragLeave:Qr,onDrop:ei,children:[a,c]}),t[293]=ei,t[294]=e,t[295]=i,t[296]=c,t[297]=l):l=t[297],l}let ri=K!==null,ii=te?.targets[0]??null,ai=null;if(H!==null){let e;if(t[298]!==i.locale||t[299]!==H){let n=new Intl.NumberFormat(i.locale).format(H);e=Ms._({id:`LuoJWu`,values:{truncatedShownCount:H,formattedCount:n}}),t[298]=i.locale,t[299]=H,t[300]=e}else e=t[300];ai=e}let oi;t[301]!==R||t[302]!==ni||t[303]!==ai?(oi=(R||ni!==null||ai!==null)&&(0,Z.jsxs)(Z.Fragment,{children:[ni===null?R&&(0,Z.jsx)(g4,{kind:`error`,children:R}):(0,Z.jsx)(g4,{kind:`reconnecting`,children:ni}),ai!==null&&(0,Z.jsx)(g4,{kind:`info`,children:ai})]}),t[301]=R,t[302]=ni,t[303]=ai,t[304]=oi):oi=t[304];let si;t[305]===_?si=t[306]:(si=s1(_),t[305]=_,t[306]=si);let ci=de?``:void 0,li;t[307]===ci?li=t[308]:(li={[D2]:ci},t[307]=ci,t[308]=li);let ui;t[309]!==ri||t[310]!==Te||t[311]!==zn||t[312]!==P||t[313]!==Ln||t[314]!==Mt||t[315]!==Yt||t[316]!==_r||t[317]!==pt||t[318]!==wt||t[319]!==x||t[320]!==Fn||t[321]!==le?(ui=(e,t)=>(0,Z.jsx)(A2,{item:e,context:t,anyActionBusy:ri,workspace:le,handoff:pt,model:wt,okignoreBinding:x,onStartCreating:Fn,onCreateFromTemplate:(e,t)=>Fn(`file`,e,{template:t}),onDuplicate:Yt,onImportTemplate:_r,onDelete:e=>J({targets:e}),onExpandSubtree:Ln,onCollapseSubtree:zn,folderTreePaths:Mt,isAsset:Te.has(e.path),documents:P}),t[309]=ri,t[310]=Te,t[311]=zn,t[312]=P,t[313]=Ln,t[314]=Mt,t[315]=Yt,t[316]=_r,t[317]=pt,t[318]=wt,t[319]=x,t[320]=Fn,t[321]=le,t[322]=ui):ui=t[322];let di;t[323]!==Kr||t[324]!==Jr||t[325]!==Wr||t[326]!==wt||t[327]!==oi||t[328]!==si||t[329]!==li||t[330]!==ui?(di=(0,Z.jsx)(`div`,{ref:Ye,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(e1,{header:oi,model:wt,style:si,...li,onClickCapture:Kr,onDoubleClickCapture:Jr,onMouseMove:Wr,onMouseLeave:Br,renderContextMenu:ui})}),t[323]=Kr,t[324]=Jr,t[325]=Wr,t[326]=wt,t[327]=oi,t[328]=si,t[329]=li,t[330]=ui,t[331]=di):di=t[331];let fi=!!te,pi;t[332]===K?pi=t[333]:(pi=e=>{!e&&!K&&J(null)},t[332]=K,t[333]=pi);let mi;t[334]!==r||t[335]!==K||t[336]!==te||t[337]!==Er||t[338]!==ii?(mi=te&&ii&&(0,Z.jsx)(Jn,{...(()=>{let e=D0(typeof window<`u`&&window.okDesktop!=null?`electron`:`web`,te.targets,typeof window<`u`?window.okDesktop?.platform:void 0);if(e)return{customTitle:e.title,customDescription:``,customDetail:e.detail,customConfirmLabel:e.confirmLabel,customConfirmLabelBusy:e.confirmLabelBusy,children:e.listedTargets?(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1 font-mono text-foreground text-xs`,children:e.listedTargets.map(F2)}):null};let t=te.targets.length,n=ii.name;return{itemName:t===1?ii.kind===`folder`?`${ii.name}/`:ii.kind===`file`?`${ii.name}${ii.docExt??`.md`}`:ii.name:void 0,customTitle:t>1?r({id:`abiHje`}):void 0,customDescription:t>1?r({id:`WMIKXK`,values:{targetCount:t}}):ii.kind===`folder`?r({id:`a5W0q0`,values:{folderName:n}}):void 0}})(),isSubmitting:K!==null,onDelete:()=>Er(te.targets)}),t[334]=r,t[335]=K,t[336]=te,t[337]=Er,t[338]=ii,t[339]=mi):mi=t[339];let hi;t[340]!==fi||t[341]!==pi||t[342]!==mi?(hi=(0,Z.jsx)(Hn,{open:fi,onOpenChange:pi,children:mi}),t[340]=fi,t[341]=pi,t[342]=mi,t[343]=hi):hi=t[343];let gi=!!ne,_i;t[344]===K?_i=t[345]:(_i=e=>{!e&&!K&&re(null)},t[344]=K,t[345]=_i);let vi;t[346]!==r||t[347]!==K||t[348]!==hr||t[349]!==ne?(vi=ne&&(0,Z.jsx)(Jn,{itemName:ne.name+(ne.kind===`file`?ne.docExt??`.md`:`.md`),customTitle:r({id:`hLod4_`}),customDescription:r({id:`RMQe3p`}),customConfirmLabel:r({id:`hvZwVx`}),customConfirmLabelBusy:r({id:`ul1Atu`}),isSubmitting:K!==null,onDelete:()=>hr(ne,!0)}),t[346]=r,t[347]=K,t[348]=hr,t[349]=ne,t[350]=vi):vi=t[350];let yi;t[351]!==gi||t[352]!==_i||t[353]!==vi?(yi=(0,Z.jsx)(Hn,{open:gi,onOpenChange:_i,children:vi}),t[351]=gi,t[352]=_i,t[353]=vi,t[354]=yi):yi=t[354];let bi=!!ie,xi;t[355]===K?xi=t[356]:(xi=e=>{!e&&!K&&ae(null)},t[355]=K,t[356]=xi);let Si;t[357]!==K||t[358]!==Or||t[359]!==Ar||t[360]!==ie?(Si=ie&&(0,Z.jsx)(F0,{failedTargets:ie.failed,isSubmitting:K!==null,onDeletePermanently:Or,onRetry:Ar,onCancel:()=>ae(null)}),t[357]=K,t[358]=Or,t[359]=Ar,t[360]=ie,t[361]=Si):Si=t[361];let Ci;t[362]!==bi||t[363]!==xi||t[364]!==Si?(Ci=(0,Z.jsx)(Hn,{open:bi,onOpenChange:xi,children:Si}),t[362]=bi,t[363]=xi,t[364]=Si,t[365]=Ci):Ci=t[365];let wi=se!==null,Ti;t[366]===Symbol.for(`react.memo_cache_sentinel`)?(Ti=e=>{e||ce(null)},t[366]=Ti):Ti=t[366];let Ei=se?.parentDir??``,Di;t[367]!==wi||t[368]!==Ei?(Di=(0,Z.jsx)(nx,{open:wi,onOpenChange:Ti,kind:`file`,initialDir:Ei,defaultToTemplate:!0}),t[367]=wi,t[368]=Ei,t[369]=Di):Di=t[369];let Oi;return t[370]!==di||t[371]!==hi||t[372]!==yi||t[373]!==Ci||t[374]!==Di?(Oi=(0,Z.jsxs)(Z.Fragment,{children:[di,hi,yi,Ci,Di]}),t[370]=di,t[371]=hi,t[372]=yi,t[373]=Ci,t[374]=Di,t[375]=Oi):Oi=t[375],Oi}function F2(e){return(0,Z.jsx)(`li`,{"data-testid":`delete-target-row`,children:O0(e)},`${e.kind}:${e.path}`)}function I2(e){return`${e.kind}:${e.path}`}function L2(e){return`${e.kind}:${e.path}`}function R2(e){return e.path}function z2(e){return e.kind===`folder`}function B2(e){return e.path}function V2(e){return e.kind===`file`}function H2(e){return e.file}function U2(e){return!Yf(e.path)}function W2(e){return lp(e)}function G2(e){return op(e)}function K2(e){return ap(e)}function q2(e){return e.path}function J2(e){return e.kind===`asset`}function Y2(e){return e.endsWith(`/`)?e.slice(0,-1):e}function X2(e){return!!e}function Z2(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function Q2(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function $2(e){Ns.error(e)}function e4(){}function t4(e){return Ns.error(e)}function n4(){}function r4(){}function i4(){}function a4(){}async function o4(){}function s4(e){return Fh(e)}function c4(e){return l4(e)?.dataset.itemPath??null}function l4(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}function u4(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-root]`))return t;return null}function d4(e){let t=l4(e);if(t){let e=t.dataset.itemPath;if(!e)return null;let n=t.dataset.itemType===`folder`,r=jh(e,n);return{parentDir:r,row:t,root:null,busyPath:n?Uh(r):e}}return f4(e)?{parentDir:``,row:null,root:u4(e),busyPath:T2}:null}function f4(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-scroll]`))return!0;return!1}var p4=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function m4(){let e=(0,$.c)(5),{_:t}=on(),n;e[0]===t?n=e[1]:(n=t({id:`5Tk8Fb`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=p4.map(h4),e[2]=r):r=e[2];let i;return e[3]===n?i=e[4]:(i=(0,Z.jsx)(`div`,{className:`flex flex-1 flex-col gap-1 px-2 py-2`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=i),i}function h4(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(Im,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(Im,{className:`h-3 ${e}`})]},t)}function g4(e){let t=(0,$.c)(12),{kind:n,children:r}=e,i=n===`error`?pf:bd,a=n===`error`?`alert`:`status`,o=n===`error`?`text-destructive`:`text-muted-foreground`,s;t[0]===o?s=t[1]:(s=Bn(`mx-2 mb-1 flex items-start gap-1.5 rounded-md bg-muted/50 px-2 py-1.5 text-xs leading-snug`,o),t[0]=o,t[1]=s);let c;t[2]!==i||t[3]!==n?(c=n===`reconnecting`?(0,Z.jsx)(xd,{"aria-hidden":`true`,icon:Qd,className:`mt-0.5 size-3.5 shrink-0`}):(0,Z.jsx)(i,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),t[2]=i,t[3]=n,t[4]=c):c=t[4];let l;t[5]===r?l=t[6]:(l=(0,Z.jsx)(`span`,{className:`min-w-0`,children:r}),t[5]=r,t[6]=l);let u;return t[7]!==a||t[8]!==s||t[9]!==c||t[10]!==l?(u=(0,Z.jsxs)(`span`,{role:a,className:s,children:[c,l]}),t[7]=a,t[8]=s,t[9]=c,t[10]=l,t[11]=u):u=t[11],u}async function _4(e){try{let t=await e.project.listRecent(),n=e.config.projectPath;if(t.some(e=>e.path!==n))return null;let r=await xA();return e.config.freshlyCreated?r:r===0?0:null}catch(e){return console.warn(`[onboarding-card-visible] fresh-project probe failed; suppressing card`,e),null}}function v4(e){let t=(0,$.c)(4),n=e===void 0?_A:e,{initialized:r,dismissed:i,completed:a}=(0,Q.useSyncExternalStore)(n.subscribe,n.getSnapshot,n.getSnapshot),o=i||a,s=!r&&!o,c,l;return t[0]!==s||t[1]!==n?(c=()=>{if(!s)return;let e=window.okDesktop;if(e==null)return;let t=!1;return _4(e).then(e=>{!t&&e!==null&&n.activate(e)}),()=>{t=!0}},l=[s,n],t[0]=s,t[1]=n,t[2]=c,t[3]=l):(c=t[2],l=t[3]),(0,Q.useEffect)(c,l),r&&!o}function y4(e){let t=(0,$.c)(3),n=e===void 0?_A:e,r,i;t[0]===n?(r=t[1],i=t[2]):(r=()=>{if(n.getSnapshot().steps.file)return;let e=Ls(e=>{e.includes(`files`)&&SA(n)});return SA(n),e},i=[n],t[0]=n,t[1]=r,t[2]=i),(0,Q.useEffect)(r,i)}var b4=3,x4=5200,S4=1500,C4=220;function w4(e){let t=(0,$.c)(14),{complete:n,label:r,shortcutId:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(Hr,{checked:n,disabled:!0,"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none opacity-100 disabled:opacity-100`}),t[0]=n,t[1]=a);let o=n?`flex-1 text-muted-foreground/60`:`flex-1`,s;t[2]===n?s=t[3]:(s=n?(0,Z.jsxs)(`span`,{className:`sr-only`,children:[(0,Z.jsx)(Y,{id:`Qj4RL5`}),` `]}):null,t[2]=n,t[3]=s);let c;t[4]!==r||t[5]!==o||t[6]!==s?(c=(0,Z.jsxs)(`span`,{className:o,children:[s,r]}),t[4]=r,t[5]=o,t[6]=s,t[7]=c):c=t[7];let l;t[8]===i?l=t[9]:(l=i?(0,Z.jsx)(ne,{children:xs(i)}):null,t[8]=i,t[9]=l);let u;return t[10]!==a||t[11]!==c||t[12]!==l?(u=(0,Z.jsxs)(`li`,{className:`flex items-center gap-2 py-0.5 text-sm`,children:[a,c,l]}),t[10]=a,t[11]=c,t[12]=l,t[13]=u):u=t[13],u}function T4(e){let t=(0,$.c)(24),{store:n,lingerMs:r}=e,i=n===void 0?_A:n,a=r===void 0?x4:r,{_:o}=on(),{steps:s}=vA(i);y4(i);let[c,l]=(0,Q.useState)(0),[u,d]=(0,Q.useState)(!1),f=1+ +!!s.file+ +!!s.askedAi,p=f===b4,m,h;t[0]!==p||t[1]!==a?(m=()=>{if(!p)return;l(D4);let e=setInterval(()=>l(E4),S4),t=setTimeout(()=>{clearInterval(e),d(!0)},a);return()=>{clearInterval(e),clearTimeout(t)}},h=[p,a],t[0]=p,t[1]=a,t[2]=m,t[3]=h):(m=t[2],h=t[3]),(0,Q.useEffect)(m,h);let g,_;t[4]!==u||t[5]!==i?(g=()=>{if(!u)return;let e=setTimeout(()=>i.markCompleted(),C4);return()=>clearTimeout(e)},_=[u,i],t[4]=u,t[5]=i,t[6]=g,t[7]=_):(g=t[6],_=t[7]),(0,Q.useEffect)(g,_);let v;t[8]!==o||t[9]!==p?(v=p?o({id:`7jIIFX`}):``,t[8]=o,t[9]=p,t[10]=v):v=t[10];let y;t[11]===v?y=t[12]:(y=(0,Z.jsx)(`div`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:v}),t[11]=v,t[12]=y);let b;t[13]!==p||t[14]!==c||t[15]!==f||t[16]!==u||t[17]!==s.askedAi||t[18]!==s.file||t[19]!==i?(b=p?(0,Z.jsxs)(`section`,{"aria-hidden":!0,className:Bn(`mx-2 mb-1 flex items-center gap-3 rounded-lg border bg-card px-4 py-3 text-card-foreground`,`motion-reduce:animate-none motion-reduce:duration-0`,u?`animate-out fade-out-0 zoom-out-95 fill-mode-forwards duration-200`:`animate-in fade-in-0 zoom-in-95 duration-300`),children:[(0,Z.jsx)(nr,{size:36,celebrateSignal:c}),(0,Z.jsx)(`span`,{className:`font-medium text-sm`,children:(0,Z.jsx)(Y,{id:`7jIIFX`})})]}):(0,Z.jsxs)(`section`,{"aria-labelledby":`onboarding-card-heading`,className:`mx-2 mb-1 rounded-lg border bg-card px-4 py-3 text-card-foreground`,children:[(0,Z.jsxs)(`header`,{className:`mb-3 flex items-center justify-between`,children:[(0,Z.jsx)(`h2`,{id:`onboarding-card-heading`,className:`font-medium text-sm`,children:(0,Z.jsx)(Y,{id:`Y1QMlM`})}),(0,Z.jsx)(`span`,{className:`text-muted-foreground/60 text-xs tabular-nums`,children:`${f} / ${b4}`})]}),(0,Z.jsxs)(`ul`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(w4,{complete:!0,label:(0,Z.jsx)(Y,{id:`4E9jPa`})}),(0,Z.jsx)(w4,{complete:s.file,label:(0,Z.jsx)(Y,{id:`6ibbCg`}),shortcutId:`new-item`}),(0,Z.jsx)(w4,{complete:s.askedAi,label:(0,Z.jsx)(Y,{id:`xWEvuo`}),shortcutId:`open-ask-ai`})]}),(0,Z.jsx)(`footer`,{className:`-mb-1 mt-2 flex justify-end`,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`sm`,className:`h-auto px-2 py-1 text-muted-foreground text-xs`,onClick:()=>i.dismiss(),children:(0,Z.jsx)(Y,{id:`1QfxQT`})})})]}),t[13]=p,t[14]=c,t[15]=f,t[16]=u,t[17]=s.askedAi,t[18]=s.file,t[19]=i,t[20]=b):b=t[20];let x;return t[21]!==y||t[22]!==b?(x=(0,Z.jsxs)(Z.Fragment,{children:[y,b]}),t[21]=y,t[22]=b,t[23]=x):x=t[23],x}function E4(e){return e+1}function D4(e){return e+1}function O4(){let e=(0,$.c)(1);if(!v4())return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(T4,{}),e[0]=t):t=e[0],t}function k4(e){return e===null?null:e.kind===`local`?e.name:e.ref}function A4(e,t){if(e.length===0)return null;let n=`origin/${e}`;return t.includes(n)?n:t.find(t=>ds(t)===e)??null}function j4(e){switch(e){case`branch-exists`:return{id:`wzq9Rv`};case`already-checked-out`:return{id:`ljHjfg`};case`path-exists`:return{id:`mYzDD_`};case`invalid-branch`:return{id:`r-OJYm`};case`no-git`:return{id:`CFnavk`};case`empty-repo`:return{id:`5IgYAM`};case`helper-not-found`:return{id:`HqOPpj`};default:return{id:`-zA2E7`}}}function M4(e){let t=(0,$.c)(71),{open:n,onOpenChange:r,bridge:i,currentBranch:a,branches:o,existingWorktreeBranches:s,remoteBranches:c,behindByBranch:l,initialBranchName:u}=e,d=o===void 0?[]:o,f=c===void 0?[]:c,p=u===void 0?``:u,{_:m}=on(),h=(0,Q.useId)(),g=(0,Q.useId)(),_=(0,Q.useId)(),v=(0,Q.useId)(),y=(0,Q.useId)(),b=(0,Q.useId)(),[x,S]=(0,Q.useState)(``),C;t[0]===a?C=t[1]:(C=a===null?null:{kind:`local`,name:a},t[0]=a,t[1]=C);let[w,T]=(0,Q.useState)(C),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(``),[A,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(null),P=(0,Q.useRef)(null),F=(0,Q.useRef)(null),I,L;t[2]!==a||t[3]!==p||t[4]!==n?(I=()=>{if(!n)return;S(p),T(a===null?null:{kind:`local`,name:a}),D(!1),k(``),j(!1),N(null);let e=requestAnimationFrame(()=>P.current?.focus());return()=>cancelAnimationFrame(e)},L=[n,a,p],t[2]=a,t[3]=p,t[4]=n,t[5]=I,t[6]=L):(I=t[5],L=t[6]),(0,Q.useEffect)(I,L);let R=x.trim(),z=!A&&R.length>0,B=R.length>0&&d.includes(R),V=B?null:A4(R,f),H=V!==null,U=B||H,W=B&&(s?.has(R)??!1),ee=d.filter(e=>e.toLowerCase().startsWith(R.toLowerCase())),G=!A&&ee.length>0&&!U,K=(a!==null&&!d.includes(a)?[a,...d]:d).map(L4),q=f.map(I4),te=k4(w),J=O.trim().toLowerCase(),ne=J===``?K:K.filter(e=>e.name.toLowerCase().includes(J)),re=J===``?q:q.filter(e=>e.ref.toLowerCase().includes(J)),ie=J!==``&&ne.length===0&&re.length===0,ae=async function(e){if(e.preventDefault(),z){j(!0),N(null);try{let e=H?{branch:R,createBranch:!0,remoteRef:V}:B?{branch:R,createBranch:!1}:{branch:R,createBranch:!0,baseBranch:w?.kind===`local`?w.name:void 0,baseRef:w?.kind===`remote`?w.ref:void 0},t=await i.worktree.create(e);if(!t.ok){N({copy:j4(t.reason),detail:t.message}),j(!1);return}gm(),r(!1),await i.project.open({path:t.path,target:`new-window`,entryPoint:`worktree`})}catch(e){console.warn(`[NewWorktreeDialog] worktree create/open failed:`,e),Ns.error(m({id:`vAYoCZ`})),j(!1)}}},oe=br,se;t[7]!==A||t[8]!==r?(se=e=>{A||r(e)},t[7]=A,t[8]=r,t[9]=se):se=t[9];let ce=gr,le;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(hr,{children:(0,Z.jsx)(Y,{id:`DXd9LM`})}),t[10]=le):le=t[10];let ue;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Z.jsxs)(yr,{children:[le,(0,Z.jsx)(mr,{children:(0,Z.jsx)(Y,{id:`NEzPEh`})})]}),t[11]=ue):ue=t[11];let de=_r,fe;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Z.jsx)(Y,{id:`ng2Ibo`}),t[12]=fe):fe=t[12];let pe;t[13]===g?pe=t[14]:(pe=(0,Z.jsx)(Ci,{htmlFor:g,children:fe}),t[13]=g,t[14]=pe);let me;t[15]===m?me=t[16]:(me=m({id:`IX_uXB`}),t[15]=m,t[16]=me);let he;t[17]===M?he=t[18]:(he=e=>{S(e.target.value),M!==null&&N(null)},t[17]=M,t[18]=he);let ge=M!==null,_e=M===null?y:`${y} ${b}`,ve;t[19]!==x||t[20]!==A||t[21]!==g||t[22]!==me||t[23]!==he||t[24]!==ge||t[25]!==_e?(ve=(0,Z.jsx)(zf,{id:g,ref:P,value:x,placeholder:me,onChange:he,disabled:A,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-invalid":ge,"aria-describedby":_e,"data-testid":`new-worktree-branch`}),t[19]=x,t[20]=A,t[21]=g,t[22]=me,t[23]=he,t[24]=ge,t[25]=_e,t[26]=ve):ve=t[26];let ye=R.length>0?(0,Z.jsxs)(`p`,{id:y,className:`flex items-start gap-1.5 text-1sm text-muted-foreground`,"data-testid":W?`new-worktree-mode-existing-worktree`:H?`new-worktree-mode-remote-checkout`:B?`new-worktree-mode-checkout`:`new-worktree-mode-create`,children:[W?(0,Z.jsx)(hd,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400`}):H?(0,Z.jsx)(Fu,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-violet-600 dark:text-violet-400`}):B?(0,Z.jsx)(zl,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-blue-600 dark:text-blue-400`}):(0,Z.jsx)(Mn,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-green-600 dark:text-green-400`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1`,children:W?(0,Z.jsx)(Y,{id:`QAi7Q9`,values:{trimmed:R},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`})}}):H?(0,Z.jsx)(Y,{id:`oAGN8p`,values:{remoteCheckoutRef:V,trimmed:R},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),2:(0,Z.jsx)(`code`,{className:`font-mono`})}}):B?(0,Z.jsx)(Y,{id:`b4VvP-`,values:{trimmed:R},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono`})}}):te===null?(0,Z.jsx)(Y,{id:`t4sFKC`,values:{trimmed:R},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono`})}}):(0,Z.jsx)(Y,{id:`dGAdpH`,values:{trimmed:R,currentBaseLabel:te},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),2:(0,Z.jsx)(`code`,{className:`font-mono`})}})})]}):null,be=G?(0,Z.jsx)(`div`,{className:`max-h-40 overflow-y-auto rounded-md border bg-popover p-1 shadow-xs`,"data-testid":`new-worktree-branch-list`,children:ee.map(e=>(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,tabIndex:-1,onClick:()=>{S(e),M!==null&&N(null),P.current?.focus()},"data-testid":`new-worktree-branch-option-${e}`,className:`h-8 w-full justify-start gap-2 font-normal`,children:[(0,Z.jsx)($c,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:e})]},e))}):null,xe=U?null:(0,Z.jsxs)(`div`,{className:`mt-1 flex flex-col gap-2`,children:[(0,Z.jsx)(Ci,{id:v,htmlFor:_,children:(0,Z.jsx)(Y,{id:`ZWwYwM`})}),(0,Z.jsxs)(Ln,{open:E,onOpenChange:e=>{D(e),e||k(``)},children:[(0,Z.jsx)(In,{asChild:!0,children:(0,Z.jsxs)(X,{id:_,type:`button`,variant:`outline`,role:`combobox`,"aria-expanded":E,"aria-haspopup":`listbox`,"aria-labelledby":`${v} ${_}`,"aria-label":m({id:`ZWwYwM`}),disabled:A,"data-testid":`new-worktree-base-trigger`,className:`w-full justify-between font-normal`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[w?.kind===`remote`?(0,Z.jsx)(Fu,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}):(0,Z.jsx)($c,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-left`,children:te===null?(0,Z.jsx)(Y,{id:`EbjWsS`}):te})]}),(0,Z.jsx)(nu,{"aria-hidden":`true`,className:`ml-2 size-4 shrink-0 opacity-50`})]})}),(0,Z.jsxs)(jn,{align:`start`,className:`w-[var(--radix-popover-trigger-width)] p-1`,onWheel:F4,onTouchMove:P4,onOpenAutoFocus:e=>{e.preventDefault(),F.current?.focus()},children:[(0,Z.jsxs)(xh,{className:`mb-1 h-8`,children:[(0,Z.jsx)(bh,{ref:F,"aria-label":m({id:`fuJZKk`}),placeholder:m({id:`hQXiDc`}),value:O,onChange:e=>k(e.target.value),onKeyDown:N4,"data-testid":`new-worktree-base-search`}),(0,Z.jsx)(yh,{children:(0,Z.jsx)(ct,{"aria-hidden":`true`})})]}),(0,Z.jsxs)(`div`,{role:`listbox`,"aria-label":m({id:`ZWwYwM`}),className:`max-h-56 overflow-y-auto`,"data-testid":`new-worktree-base-list`,children:[ie?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-1sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`Sh3Qkg`})}):null,ne.map(e=>{let t=e.name,n=l?.get(t);return(0,Z.jsxs)(X,{type:`button`,role:`option`,"aria-selected":w?.kind===`local`&&w.name===t,variant:`ghost`,size:`sm`,onClick:()=>{T(e),D(!1),k(``)},"data-testid":`new-worktree-base-option-${t}`,className:`h-8 w-full justify-start gap-2 font-normal`,children:[(0,Z.jsx)($c,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:t}),n!==void 0&&n>0?(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-amber-600 dark:text-amber-400`,"data-testid":`new-worktree-base-behind-${t}`,children:(0,Z.jsx)(Y,{id:`6-wLTJ`,values:{behind:n}})}):null]},`local:${t}`)}),re.map(e=>{let t=e.ref;return(0,Z.jsxs)(X,{type:`button`,role:`option`,"aria-selected":w?.kind===`remote`&&w.ref===t,variant:`ghost`,size:`sm`,onClick:()=>{T(e),D(!1),k(``)},"data-testid":`new-worktree-base-option-${t}`,className:`h-8 w-full justify-start gap-2 font-normal`,children:[(0,Z.jsx)(Fu,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:t}),(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`dIYSqk`})})]},`remote:${t}`)})]})]})]})]}),Se;t[27]!==m||t[28]!==M||t[29]!==b?(Se=M===null?null:(0,Z.jsxs)(`div`,{id:b,role:`alert`,children:[(0,Z.jsx)(`p`,{className:`text-1sm text-destructive`,"data-testid":`new-worktree-error`,children:m(M.copy)}),M.detail!==void 0&&M.detail.length>0?(0,Z.jsx)(`p`,{className:`mt-1 break-words font-mono text-xs text-muted-foreground`,"data-testid":`new-worktree-error-detail`,children:M.detail}):null]}),t[27]=m,t[28]=M,t[29]=b,t[30]=Se):Se=t[30];let Ce;t[31]!==h||t[32]!==ae||t[33]!==pe||t[34]!==ve||t[35]!==ye||t[36]!==be||t[37]!==xe||t[38]!==Se?(Ce=(0,Z.jsxs)(`form`,{id:h,onSubmit:ae,className:`flex flex-col gap-2`,children:[pe,ve,ye,be,xe,Se]}),t[31]=h,t[32]=ae,t[33]=pe,t[34]=ve,t[35]=ye,t[36]=be,t[37]=xe,t[38]=Se,t[39]=Ce):Ce=t[39];let we;t[40]!==de||t[41]!==Ce?(we=(0,Z.jsx)(de,{children:Ce}),t[40]=de,t[41]=Ce,t[42]=we):we=t[42];let Te;t[43]===r?Te=t[44]:(Te=()=>r(!1),t[43]=r,t[44]=Te);let Ee;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Z.jsx)(Y,{id:`dEgA5A`}),t[45]=Ee):Ee=t[45];let De;t[46]!==A||t[47]!==Te?(De=(0,Z.jsx)(X,{type:`button`,variant:`outline`,onClick:Te,disabled:A,"data-testid":`new-worktree-cancel`,children:Ee}),t[46]=A,t[47]=Te,t[48]=De):De=t[48];let Oe=!z,ke;t[49]!==A||t[50]!==W||t[51]!==B||t[52]!==H?(ke=A?(0,Z.jsx)(Y,{id:`b4itZn`}):W?(0,Z.jsx)(Y,{id:`XV5sC0`}):H?(0,Z.jsx)(Y,{id:`XAyxsa`}):B?(0,Z.jsx)(Y,{id:`uGaIIS`}):(0,Z.jsx)(Y,{id:`iO8V-7`}),t[49]=A,t[50]=W,t[51]=B,t[52]=H,t[53]=ke):ke=t[53];let Ae;t[54]!==h||t[55]!==Oe||t[56]!==ke?(Ae=(0,Z.jsx)(X,{type:`submit`,form:h,disabled:Oe,"data-testid":`new-worktree-create`,children:ke}),t[54]=h,t[55]=Oe,t[56]=ke,t[57]=Ae):Ae=t[57];let je;t[58]!==De||t[59]!==Ae?(je=(0,Z.jsxs)(vr,{children:[De,Ae]}),t[58]=De,t[59]=Ae,t[60]=je):je=t[60];let Me;t[61]!==ce||t[62]!==ue||t[63]!==we||t[64]!==je?(Me=(0,Z.jsxs)(ce,{className:`sm:max-w-md`,"data-testid":`new-worktree-dialog`,children:[ue,we,je]}),t[61]=ce,t[62]=ue,t[63]=we,t[64]=je,t[65]=Me):Me=t[65];let Ne;return t[66]!==oe||t[67]!==n||t[68]!==Me||t[69]!==se?(Ne=(0,Z.jsx)(oe,{open:n,onOpenChange:se,children:Me}),t[66]=oe,t[67]=n,t[68]=Me,t[69]=se,t[70]=Ne):Ne=t[70],Ne}function N4(e){return e.stopPropagation()}function P4(e){e.stopPropagation()}function F4(e){e.stopPropagation()}function I4(e){return{kind:`remote`,ref:e}}function L4(e){return{kind:`local`,name:e}}function R4(e){let t=(0,$.c)(54),{bridge:n,recents:r,currentPath:i,query:a,worktreeModel:o,closeMenu:s,guardStaleSelect:c,onRemoveRecent:l,flyoutPath:u,setFlyoutPath:d,openNewWorktreeWith:f}=e,{_:p}=on(),m;t[0]!==p||t[1]!==n.project||t[2]!==s?(m=function(e,t){s(),n.project.open({path:e,target:`new-window`,entryPoint:t}).catch(e=>{console.warn(`[RecentProjectsMenu] project.open failed:`,e),Ns.error(p({id:`6HCOwA`}))})},t[0]=p,t[1]=n.project,t[2]=s,t[3]=m):m=t[3];let h=m,g;t[4]!==p||t[5]!==n.project||t[6]!==n.worktree?(g=async function(e){try{let t=await n.worktree.create({branch:e,createBranch:!1});if(!t.ok){Ns.error(p({id:`teD0H9`}));return}gm(),await n.project.open({path:t.path,target:`new-window`,entryPoint:`worktree`})}catch(e){console.warn(`[RecentProjectsMenu] create/open branch failed:`,e),Ns.error(p({id:`LwMxXg`}))}},t[4]=p,t[5]=n.project,t[6]=n.worktree,t[7]=g):g=t[7];let _=g,v;t[8]!==s||t[9]!==i||t[10]!==h?(v=function(e){if(e.path===i){s();return}h(e.path,e.isLinkedWorktree?`worktree`:`recents`)},t[8]=s,t[9]=i,t[10]=h,t[11]=v):v=t[11];let y=v,b;t[12]!==s||t[13]!==_||t[14]!==i||t[15]!==h?(b=function(e){if(e.path!==null){if(e.path===i){s();return}h(e.path,e.isMain?`recents`:`worktree`);return}e.branch!==null&&(s(),_(e.branch))},t[12]=s,t[13]=_,t[14]=i,t[15]=h,t[16]=b):b=t[16];let x=b;if(a!==``){let e;t[17]!==s||t[18]!==_?(e=e=>{s(),_(e)},t[17]=s,t[18]=_,t[19]=e):e=t[19];let n;return t[20]!==i||t[21]!==c||t[22]!==y||t[23]!==l||t[24]!==a||t[25]!==r||t[26]!==e||t[27]!==o?(n=(0,Z.jsx)(W4,{recents:r,currentPath:i,query:a,worktreeModel:o,onPickEntry:y,onPickBranch:e,guardStaleSelect:c,onRemoveRecent:l}),t[20]=i,t[21]=c,t[22]=y,t[23]=l,t[24]=a,t[25]=r,t[26]=e,t[27]=o,t[28]=n):n=t[28],n}let S;if(t[29]!==s||t[30]!==i||t[31]!==u||t[32]!==c||t[33]!==x||t[34]!==l||t[35]!==f||t[36]!==h||t[37]!==r||t[38]!==d||t[39]!==o){let e=aS(r),n;t[41]!==s||t[42]!==i||t[43]!==u||t[44]!==c||t[45]!==x||t[46]!==l||t[47]!==f||t[48]!==h||t[49]!==d||t[50]!==o?(n=e=>(0,Z.jsx)(z4,{group:e,currentPath:i,worktreeModel:o,flyoutOpen:u===e.project.path,setFlyoutOpen:t=>d(n=>t?e.project.path:n===e.project.path?null:n),onPickProject:()=>{if(e.project.path===i){s();return}h(e.project.path,`recents`)},onPickFlyoutEntry:x,guardStaleSelect:c,onRemoveRecent:l,openNewWorktreeWith:f},e.project.path),t[41]=s,t[42]=i,t[43]=u,t[44]=c,t[45]=x,t[46]=l,t[47]=f,t[48]=h,t[49]=d,t[50]=o,t[51]=n):n=t[51],S=e.map(n),t[29]=s,t[30]=i,t[31]=u,t[32]=c,t[33]=x,t[34]=l,t[35]=f,t[36]=h,t[37]=r,t[38]=d,t[39]=o,t[40]=S}else S=t[40];let C;return t[52]===S?C=t[53]:(C=(0,Z.jsx)(Z.Fragment,{children:S}),t[52]=S,t[53]=C),C}function z4(e){let t=(0,$.c)(45),{group:n,currentPath:r,worktreeModel:i,flyoutOpen:a,setFlyoutOpen:o,onPickProject:s,onPickFlyoutEntry:c,guardStaleSelect:l,onRemoveRecent:u,openNewWorktreeWith:d}=e,f=n.project.path===r,p,m;t[0]!==r||t[1]!==n||t[2]!==i?(p=nS(n,i,r),m=p.filter(B4),t[0]=r,t[1]=n,t[2]=i,t[3]=p,t[4]=m):(p=t[3],m=t[4]);let h=m.length;if(h===0){let e;t[5]!==l||t[6]!==s?(e=e=>{l(e)||s()},t[5]=l,t[6]=s,t[7]=e):e=t[7];let r=`project-switcher-recent-${n.project.path}`,i=f?`true`:void 0,a;t[8]!==n.project.name||t[9]!==n.project.path||t[10]!==f?(a=(0,Z.jsx)(q4,{name:n.project.name,path:n.project.path,current:f}),t[8]=n.project.name,t[9]=n.project.path,t[10]=f,t[11]=a):a=t[11];let o;t[12]!==e||t[13]!==r||t[14]!==i||t[15]!==a?(o=(0,Z.jsx)(li,{onSelect:e,className:`flex w-full min-w-0 flex-col items-start gap-0.5 pr-8`,"data-testid":r,"data-current":i,children:a}),t[12]=e,t[13]=r,t[14]=i,t[15]=a,t[16]=o):o=t[16];let c;t[17]!==n.project.name||t[18]!==n.project.path||t[19]!==u?(c=(0,Z.jsx)(oS,{path:n.project.path,name:n.project.name,onRemoveRecent:u,testIdPrefix:`project-switcher-recent`}),t[17]=n.project.name,t[18]=n.project.path,t[19]=u,t[20]=c):c=t[20];let d;t[21]!==o||t[22]!==c?(d=(0,Z.jsxs)(`div`,{className:`group/recent relative flex items-center`,children:[o,c]}),t[21]=o,t[22]=c,t[23]=d):d=t[23];let p;return t[24]!==n.project.path||t[25]!==u||t[26]!==d?(p=(0,Z.jsx)(sS,{path:n.project.path,onRemoveRecent:u,testIdPrefix:`project-switcher-recent`,children:d}),t[24]=n.project.path,t[25]=u,t[26]=d,t[27]=p):p=t[27],p}let g;t[28]!==r||t[29]!==n.worktrees||t[30]!==f?(g=f||n.worktrees.some(e=>e.path===r),t[28]=r,t[29]=n.worktrees,t[30]=f,t[31]=g):g=t[31];let _=g,v;return t[32]!==_||t[33]!==r||t[34]!==p||t[35]!==a||t[36]!==n||t[37]!==l||t[38]!==c||t[39]!==s||t[40]!==d||t[41]!==h||t[42]!==o||t[43]!==i?(v=(0,Z.jsx)(V4,{group:n,currentPath:r,containsCurrent:_,worktreeModel:i,flyoutEntries:p,openedWorktreeCount:h,flyoutOpen:a,setFlyoutOpen:o,onPickProject:s,onPickFlyoutEntry:c,guardStaleSelect:l,openNewWorktreeWith:d}),t[32]=_,t[33]=r,t[34]=p,t[35]=a,t[36]=n,t[37]=l,t[38]=c,t[39]=s,t[40]=d,t[41]=h,t[42]=o,t[43]=i,t[44]=v):v=t[44],v}function B4(e){return e.opened&&!e.isMain}function V4(e){let t=(0,$.c)(46),{group:n,currentPath:r,containsCurrent:i,worktreeModel:a,flyoutEntries:o,openedWorktreeCount:s,flyoutOpen:c,setFlyoutOpen:l,onPickProject:u,onPickFlyoutEntry:d,guardStaleSelect:f,openNewWorktreeWith:p}=e,{_:m}=on(),h=n.project.path===r,g;t[0]!==f||t[1]!==u?(g=e=>{f(e)||u()},t[0]=f,t[1]=u,t[2]=g):g=t[2];let _=g,v,y;t[3]===_?(v=t[4],y=t[5]):(v=e=>{e.target.closest(`[data-project-open]`)!==null&&(e.preventDefault(),_(e.nativeEvent))},y=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),_(e.nativeEvent))},t[3]=_,t[4]=v,t[5]=y);let b=`project-switcher-group-${n.project.path}`,x=c?`true`:void 0,S=i?`true`:void 0,C;t[6]===n.project.name?C=t[7]:(C=(0,Z.jsx)(`span`,{className:`truncate font-medium text-sm`,"data-project-open":``,title:n.project.name,children:n.project.name}),t[6]=n.project.name,t[7]=C);let w;t[8]===n.project.path?w=t[9]:(w=(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,title:n.project.path,children:n.project.path}),t[8]=n.project.path,t[9]=w);let T;t[10]!==C||t[11]!==w?(T=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[C,w]}),t[10]=C,t[11]=w,t[12]=T):T=t[12];let E;t[13]!==m||t[14]!==h?(E=h?(0,Z.jsx)(zl,{"aria-label":m({id:`Hp1l6f`}),className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`}):null,t[13]=m,t[14]=h,t[15]=E):E=t[15];let D=`project-switcher-toggle-${n.project.path}`,O;t[16]===s?O=t[17]:(O=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:s}),t[16]=s,t[17]=O);let k;t[18]===s?k=t[19]:(k=(0,Z.jsx)(Y,{id:`AKxFtn`,values:{openedWorktreeCount:s}}),t[18]=s,t[19]=k);let A;t[20]!==D||t[21]!==O||t[22]!==k?(A=(0,Z.jsxs)(`span`,{className:`mt-0.5 shrink-0 text-muted-foreground text-xs`,"data-testid":D,children:[O,` `,k]}),t[20]=D,t[21]=O,t[22]=k,t[23]=A):A=t[23];let j;t[24]!==E||t[25]!==A||t[26]!==v||t[27]!==y||t[28]!==b||t[29]!==x||t[30]!==S||t[31]!==T?(j=(0,Z.jsxs)(vi,{onClick:v,onKeyDown:y,className:`flex w-full min-w-0 items-start gap-2`,"data-testid":b,"data-flyout-open":x,"data-current":S,children:[T,E,A]}),t[24]=E,t[25]=A,t[26]=v,t[27]=y,t[28]=b,t[29]=x,t[30]=S,t[31]=T,t[32]=j):j=t[32];let M;t[33]!==o||t[34]!==c||t[35]!==n||t[36]!==f||t[37]!==d||t[38]!==p||t[39]!==a?(M=(0,Z.jsx)(H4,{group:n,open:c,worktreeModel:a,entries:o,onPickFlyoutEntry:d,guardStaleSelect:f,openNewWorktreeWith:p}),t[33]=o,t[34]=c,t[35]=n,t[36]=f,t[37]=d,t[38]=p,t[39]=a,t[40]=M):M=t[40];let N;return t[41]!==c||t[42]!==l||t[43]!==j||t[44]!==M?(N=(0,Z.jsxs)(di,{open:c,onOpenChange:l,children:[j,M]}),t[41]=c,t[42]=l,t[43]=j,t[44]=M,t[45]=N):N=t[45],N}function H4(e){let t=(0,$.c)(15),{group:n,open:r,worktreeModel:i,entries:a,onPickFlyoutEntry:o,guardStaleSelect:s,openNewWorktreeWith:c}=e,{_:l}=on(),[u,d]=(0,Q.useState)(``),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m,h;t[0]===r?(m=t[1],h=t[2]):(m=()=>{r&&f.current?.focus({preventScroll:!0})},h=[r],t[0]=r,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let g=function(){let e=p.current;return e===null?[]:[...e.querySelectorAll(`[role="menuitem"]`)]},_=function(e){g()[e]?.focus()},v=function(e,t){if(e.key===`ArrowDown`){e.preventDefault(),e.stopPropagation();let t=g(),n=t.indexOf(e.currentTarget);_(Math.min(n+1,t.length-1))}else if(e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation();let t=g().indexOf(e.currentTarget);t<=0?f.current?.focus():_(t-1)}else e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),t())},y;if(t[3]!==a||t[4]!==u){let e=u.trim().toLowerCase();y=e===``?a:a.filter(t=>(t.branch??``).toLowerCase().includes(e)),t[3]=a,t[4]=u,t[5]=y}else y=t[5];let b=y,x=i!==null&&i.mainRoot===n.project.mainRoot,S=u.trim(),C=x&&S.length>0,w;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(yh,{align:`inline-start`,children:(0,Z.jsx)(ct,{"aria-hidden":`true`})}),t[6]=w):w=t[6];let T;t[7]===l?T=t[8]:(T=l({id:`bSD4im`}),t[7]=l,t[8]=T);let E;t[9]===l?E=t[10]:(E=l({id:`Skr_7L`}),t[9]=l,t[10]=E);let D;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>d(e.target.value),t[11]=D):D=t[11];let O=b.length===0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(_i,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:l({id:`-uaQnI`})}),C?(0,Z.jsxs)(li,{onSelect:e=>{s(e)||c(S)},onKeyDown:e=>v(e,()=>c(S)),className:`flex items-center gap-2`,"data-testid":`project-switcher-flyout-create`,children:[(0,Z.jsx)(Mn,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,title:S,children:(0,Z.jsx)(Y,{id:`gHSAWT`,values:{typedName:S},components:{0:(0,Z.jsx)(`span`,{className:`font-medium`}),1:(0,Z.jsx)(`span`,{className:`font-mono`})}})})]}):null]}):b.map(e=>{let t=e.path??`branch:${e.branch}`,n=e.branch??l({id:`D12vtS`});return(0,Z.jsxs)(li,{onSelect:t=>{s(t)||o(e)},onKeyDown:t=>v(t,()=>o(e)),className:`flex items-center gap-2`,"data-testid":`project-switcher-flyout-entry-${t}`,"data-current":e.isCurrent?`true`:void 0,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,title:n,children:n}),(0,Z.jsx)(U4,{entry:e}),e.isCurrent?(0,Z.jsx)(J4,{}):null]},t)}),k;return t[12]!==p||t[13]!==O?(k=(0,Z.jsx)(`div`,{ref:p,className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain subtle-scrollbar`,children:O}),t[12]=p,t[13]=O,t[14]=k):k=t[14],(0,Z.jsx)(bi,{children:(0,Z.jsxs)(fi,{avoidCollisions:!1,sideOffset:-8,className:`flex max-h-80 w-96 flex-col gap-1 overflow-hidden p-1`,"data-testid":`project-switcher-flyout-${n.project.path}`,children:[(0,Z.jsxs)(xh,{className:`mb-1 h-8 shrink-0`,children:[w,(0,Z.jsx)(bh,{ref:f,"aria-label":T,placeholder:E,value:u,onChange:D,onKeyDown:e=>{e.key===`ArrowDown`&&(e.preventDefault(),_(0)),e.stopPropagation()},"data-testid":`project-switcher-flyout-search-${n.project.path}`})]}),k]})})}function U4(e){let t=(0,$.c)(28),{entry:n}=e,{_:r}=on(),i;t[0]===r?i=t[1]:(i=r({id:`rnrdEX`}),t[0]=r,t[1]=i);let a;t[2]===r?a=t[3]:(a=r({id:`vAUpF5`}),t[2]=r,t[3]=a);let o;t[4]!==i||t[5]!==a?(o={label:i,description:a},t[4]=i,t[5]=a,t[6]=o):o=t[6];let s;t[7]===r?s=t[8]:(s=r({id:`z-lawV`}),t[7]=r,t[8]=s);let c;t[9]===r?c=t[10]:(c=r({id:`3UzaS-`}),t[9]=r,t[10]=c);let l;t[11]!==s||t[12]!==c?(l={label:s,description:c},t[11]=s,t[12]=c,t[13]=l):l=t[13];let u;t[14]===r?u=t[15]:(u=r({id:`nfoduq`}),t[14]=r,t[15]=u);let d;t[16]===r?d=t[17]:(d=r({id:`Dvwa0U`}),t[16]=r,t[17]=d);let f;t[18]!==u||t[19]!==d?(f={label:u,description:d},t[18]=u,t[19]=d,t[20]=f):f=t[20];let p;t[21]!==o||t[22]!==l||t[23]!==f?(p={primary:o,worktree:l,none:f},t[21]=o,t[22]=l,t[23]=f,t[24]=p):p=t[24];let{label:m,description:h}=p[tS(n)],g;return t[25]!==h||t[26]!==m?(g=(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,title:h,children:m}),t[25]=h,t[26]=m,t[27]=g):g=t[27],g}function W4(e){let t=(0,$.c)(43),{recents:n,currentPath:r,query:i,worktreeModel:a,onPickEntry:o,onPickBranch:s,guardStaleSelect:c,onRemoveRecent:l}=e,{_:u}=on(),d;t[0]===i?d=t[1]:(d=e=>e.toLowerCase().includes(i),t[0]=i,t[1]=d);let f=d,p,m,h,g;if(t[2]!==u||t[3]!==r||t[4]!==c||t[5]!==f||t[6]!==s||t[7]!==o||t[8]!==l||t[9]!==n||t[10]!==a){g=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[15]===f?e=t[16]:(e=e=>!e.isLinkedWorktree&&(f(e.name)||f(e.path)),t[15]=f,t[16]=e);let i=n.filter(e),d;t[17]===f?d=t[18]:(d=e=>e.isLinkedWorktree===!0&&(f(e.branch??``)||f(e.path)),t[17]=f,t[18]=d);let _=n.filter(d),v=new Set(_.map(G4)),y;t[19]===a?.entries?y=t[20]:(y=a?.entries??[],t[19]=a?.entries,t[20]=y);let b=y.filter(e=>e.branch!==null&&f(e.branch)&&(e.worktreePath===null||!v.has(e.worktreePath))&&e.worktreePath!==r);if(i.length===0&&_.length===0&&b.length===0){let e;t[21]===u?e=t[22]:(e=u({id:`pEQFsW`}),t[21]=u,t[22]=e);let n;t[23]===e?n=t[24]:(n=(0,Z.jsx)(_i,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:e}),t[23]=e,t[24]=n),g=n;break bb0}let x;t[25]!==r||t[26]!==c||t[27]!==o||t[28]!==l?(x=e=>(0,Z.jsx)(sS,{path:e.path,onRemoveRecent:l,testIdPrefix:`project-switcher-recent`,children:(0,Z.jsxs)(`div`,{className:`group/recent relative flex items-center`,children:[(0,Z.jsx)(li,{onSelect:t=>{c(t)||o(e)},className:`flex w-full min-w-0 flex-col items-start gap-0.5 pr-8`,"data-testid":`project-switcher-recent-${e.path}`,children:(0,Z.jsx)(q4,{name:e.name,path:e.path,current:e.path===r})}),(0,Z.jsx)(oS,{path:e.path,name:e.name,onRemoveRecent:l,testIdPrefix:`project-switcher-recent`})]})},e.path),t[25]=r,t[26]=c,t[27]=o,t[28]=l,t[29]=x):x=t[29],p=i.map(x);let S;t[30]!==r||t[31]!==c||t[32]!==o?(S=e=>(0,Z.jsxs)(li,{onSelect:t=>{c(t)||o(e)},className:`flex items-start gap-2`,"data-testid":`project-switcher-worktree-${e.path}`,"data-current":e.path===r?`true`:void 0,children:[(0,Z.jsx)($c,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),(0,Z.jsx)(K4,{branch:e.branch??e.name,project:e.mainRoot===void 0?null:iS(e.mainRoot)})]},e.path),t[30]=r,t[31]=c,t[32]=o,t[33]=S):S=t[33],m=_.map(S);let C;t[34]!==u||t[35]!==c||t[36]!==s||t[37]!==a?(C=e=>(0,Z.jsxs)(li,{onSelect:t=>{c(t)||e.branch!==null&&s(e.branch)},className:`flex items-start gap-2`,"data-testid":`project-switcher-branch-${e.branch}`,children:[(0,Z.jsx)($c,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 opacity-40`}),(0,Z.jsx)(K4,{branch:e.branch??``,project:a===null?null:iS(a.mainRoot),hint:u({id:`nfoduq`})})]},`branch:${e.branch}`),t[34]=u,t[35]=c,t[36]=s,t[37]=a,t[38]=C):C=t[38],h=b.map(C)}t[2]=u,t[3]=r,t[4]=c,t[5]=f,t[6]=s,t[7]=o,t[8]=l,t[9]=n,t[10]=a,t[11]=p,t[12]=m,t[13]=h,t[14]=g}else p=t[11],m=t[12],h=t[13],g=t[14];if(g!==Symbol.for(`react.early_return_sentinel`))return g;let _;return t[39]!==p||t[40]!==m||t[41]!==h?(_=(0,Z.jsxs)(Z.Fragment,{children:[p,m,h]}),t[39]=p,t[40]=m,t[41]=h,t[42]=_):_=t[42],_}function G4(e){return e.path}function K4(e){let t=(0,$.c)(12),{branch:n,project:r,hint:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:n}),t[0]=n,t[1]=a);let o;t[2]===i?o=t[3]:(o=i===void 0?null:(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,children:i}),t[2]=i,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,Z.jsxs)(`span`,{className:`flex w-full min-w-0 items-center gap-1.5`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===r?c=t[8]:(c=r===null?null:(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,title:r,children:r}),t[7]=r,t[8]=c);let l;return t[9]!==s||t[10]!==c?(l=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[s,c]}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function q4(e){let t=(0,$.c)(15),{name:n,path:r,current:i}=e,a=i&&`font-medium`,o;t[0]===a?o=t[1]:(o=Bn(`flex w-full items-center gap-1.5`,a),t[0]=a,t[1]=o);let s;t[2]===n?s=t[3]:(s=(0,Z.jsx)(`span`,{className:`truncate font-medium text-sm`,title:n,children:n}),t[2]=n,t[3]=s);let c;t[4]===i?c=t[5]:(c=i?(0,Z.jsx)(zl,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}):null,t[4]=i,t[5]=c);let l;t[6]!==o||t[7]!==s||t[8]!==c?(l=(0,Z.jsxs)(`span`,{className:o,children:[s,c]}),t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9];let u;t[10]===r?u=t[11]:(u=(0,Z.jsx)(`span`,{className:`w-full truncate text-muted-foreground text-xs`,title:r,children:r}),t[10]=r,t[11]=u);let d;return t[12]!==l||t[13]!==u?(d=(0,Z.jsxs)(`span`,{className:`flex w-full min-w-0 flex-col gap-0.5`,children:[l,u]}),t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function J4(){let e=(0,$.c)(4),{_:t}=on(),n;e[0]===t?n=e[1]:(n=t({id:`Hp1l6f`}),e[0]=t,e[1]=n);let r;return e[2]===n?r=e[3]:(r=(0,Z.jsx)(zl,{"aria-label":n,className:`size-3.5 shrink-0 text-muted-foreground`}),e[2]=n,e[3]=r),r}var Y4=(e,t,n)=>Yx(e,t,n,`ProjectSwitcher`),X4=350;function Z4(e){let t=(0,$.c)(121),{bridge:n}=e,{_:r}=on(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(null),v=WI(),y=Kx(),b=typeof window<`u`&&window.okDesktop!=null,x=(0,Q.useRef)(!1),S=(0,Q.useRef)(!1),C=(0,Q.useRef)(null),w;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>{e&&(S.current=!0,C.current!==null&&clearTimeout(C.current),C.current=setTimeout(()=>{S.current=!1},X4)),s(e),e||(l(``),_(null))},t[0]=w):w=t[0];let T=w,E;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>!b||!S.current?!1:(e.preventDefault(),!0),t[1]=E):E=t[1];let D=E,O;t[2]!==r||t[3]!==n.project||t[4]!==o?(O=()=>{if(!o)return;let e=!1;return Y4(async()=>{let t=await n.project.listRecent();e||a(t)},r({id:`fYKgzG`})),()=>{e=!0}},t[2]=r,t[3]=n.project,t[4]=o,t[5]=O):O=t[5];let k;t[6]!==r||t[7]!==n||t[8]!==o?(k=[o,n,r],t[6]=r,t[7]=n,t[8]=o,t[9]=k):k=t[9],(0,Q.useEffect)(O,k);let A,j;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>Fn(e=>{e===`new-worktree`?(s(!1),_(null),h(``),p(!0)):e===`switch-worktree`&&s(!0)}),j=[],t[10]=A,t[11]=j):(A=t[10],j=t[11]),(0,Q.useEffect)(A,j);let M;t[12]!==r||t[13]!==n.dialog||t[14]!==n.project?(M=()=>{T(!1),Y4(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})},r({id:`gmJ0An`}))},t[12]=r,t[13]=n.dialog,t[14]=n.project,t[15]=M):M=t[15];let N=M,P;t[16]!==r||t[17]!==n.project?(P=()=>{T(!1),Y4(()=>n.project.openFile(),r({id:`8vCZcs`}))},t[16]=r,t[17]=n.project,t[18]=P):P=t[18];let F=P,I;t[19]!==r||t[20]!==n.navigator?(I=()=>{T(!1),Y4(()=>n.navigator.open(),r({id:`jol95m`}))},t[19]=r,t[20]=n.navigator,t[21]=I):I=t[21];let L=I,R;t[22]!==r||t[23]!==n.project?(R=e=>Y4(async()=>{await n.project.removeRecent(e),a(t=>t===null?t:t.filter(t=>t.path!==e))},r({id:`viwC-K`})),t[22]=r,t[23]=n.project,t[24]=R):R=t[24];let z=R,B;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(B=()=>{T(!1),d(!0)},t[25]=B):B=t[25];let V=B,H;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>{T(!1),h(e),p(!0)},t[26]=H):H=t[26];let U=H,W=n.config.projectPath,ee;t[27]===c?ee=t[28]:(ee=c.trim().toLowerCase(),t[27]=c,t[28]=ee);let G=ee,K=G!==``,q;t[29]===i?q=t[30]:(q=i??[],t[29]=i,t[30]=q);let te=q,J;t[31]!==K||t[32]!==te?(J=K?te.filter(a3):te,t[31]=K,t[32]=te,t[33]=J):J=t[33];let ne=J,ie=K?null:y,ae=v!==null&&`h-auto py-1.5`,oe;t[34]===ae?oe=t[35]:(oe=Bn(`justify-between text-sidebar-foreground/70 hover:text-sidebar-foreground! data-open:hover:text-sidebar-foreground!`,ae),t[34]=ae,t[35]=oe);let se;t[36]===r?se=t[37]:(se=r({id:`zZ_I5K`}),t[36]=r,t[37]=se);let ce;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ce=b?()=>{x.current=!0}:void 0,t[38]=ce):ce=t[38];let le;t[39]===o?le=t[40]:(le=b?()=>{if(x.current){x.current=!1;return}T(!o)}:void 0,t[39]=o,t[40]=le);let ue;t[41]===n.config.projectName?ue=t[42]:(ue=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[41]=n.config.projectName,t[42]=ue);let de;t[43]===v?de=t[44]:(de=v===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 text-xs text-sidebar-foreground/50 group-hover/menu-button:text-sidebar-foreground`,"data-testid":`project-switcher-branch`,children:[(0,Z.jsx)($c,{"aria-hidden":`true`,className:`size-3! shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:v})]}),t[43]=v,t[44]=de);let fe;t[45]!==ue||t[46]!==de?(fe=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[ue,de]}),t[45]=ue,t[46]=de,t[47]=fe):fe=t[47];let pe;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Z.jsx)(nu,{"aria-hidden":`true`,className:`opacity-60`}),t[48]=pe):pe=t[48];let me;t[49]!==n.config.projectPath||t[50]!==oe||t[51]!==se||t[52]!==le||t[53]!==fe?(me=(0,Z.jsx)(hi,{asChild:!0,children:(0,Z.jsxs)(RI,{className:oe,"data-testid":`project-switcher-trigger`,"aria-label":se,title:n.config.projectPath,onPointerDown:ce,onClick:le,children:[fe,pe]})}),t[49]=n.config.projectPath,t[50]=oe,t[51]=se,t[52]=le,t[53]=fe,t[54]=me):me=t[54];let he;t[55]!==r||t[56]!==n||t[57]!==W||t[58]!==g||t[59]!==ne||t[60]!==ie||t[61]!==z||t[62]!==G||t[63]!==i||t[64]!==c?(he=i===null?null:i.length===0?(0,Z.jsx)(_i,{className:`font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`MUrVEo`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(xh,{className:`mb-1 h-8 border-0 shadow-none has-[[data-slot=input-group-control]:focus-visible]:ring-0`,children:[(0,Z.jsx)(bh,{"aria-label":r({id:`blFttG`}),placeholder:r({id:`RVZJWQ`}),value:c,onChange:e=>{e.target.value!==``&&_(null),l(e.target.value)},onKeyDown:i3,"data-testid":`project-switcher-search`}),(0,Z.jsx)(yh,{children:(0,Z.jsx)(ct,{"aria-hidden":`true`})})]}),(0,Z.jsx)(Si,{}),(0,Z.jsx)(`div`,{className:`max-h-64 overflow-x-hidden overflow-y-auto overscroll-contain subtle-scrollbar scroll-fade-mask`,"data-testid":`project-switcher-scroll`,onScroll:()=>{g!==null&&_(null)},children:(0,Z.jsx)(R4,{bridge:n,recents:ne,currentPath:W,query:G,worktreeModel:ie,closeMenu:()=>T(!1),guardStaleSelect:D,onRemoveRecent:z,flyoutPath:g,setFlyoutPath:_,openNewWorktreeWith:U})})]}),t[55]=r,t[56]=n,t[57]=W,t[58]=g,t[59]=ne,t[60]=ie,t[61]=z,t[62]=G,t[63]=i,t[64]=c,t[65]=he):he=t[65];let ge;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Z.jsx)(Si,{}),t[66]=ge):ge=t[66];let _e;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(_e=e=>{D(e)||V()},t[67]=_e):_e=t[67];let ve;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,Z.jsxs)(li,{onSelect:_e,"data-testid":`project-switcher-new-project`,children:[(0,Z.jsx)(Mn,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(Y,{id:`gKi-a_`})]}),t[68]=ve):ve=t[68];let ye;t[69]===L?ye=t[70]:(ye=e=>{D(e)||L()},t[69]=L,t[70]=ye);let be,xe;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(re,{"aria-hidden":`true`,className:`text-muted-foreground`}),xe=(0,Z.jsx)(Y,{id:`xaDWAI`}),t[71]=be,t[72]=xe):(be=t[71],xe=t[72]);let Se;t[73]===ye?Se=t[74]:(Se=(0,Z.jsxs)(li,{onSelect:ye,"data-testid":`project-switcher-switch-project`,children:[be,xe]}),t[73]=ye,t[74]=Se);let Ce;t[75]===N?Ce=t[76]:(Ce=e=>{D(e)||N()},t[75]=N,t[76]=Ce);let we,Te;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(hd,{"aria-hidden":`true`,className:`text-muted-foreground`}),Te=(0,Z.jsx)(Y,{id:`PVUn_c`}),t[77]=we,t[78]=Te):(we=t[77],Te=t[78]);let Ee;t[79]===Ce?Ee=t[80]:(Ee=(0,Z.jsxs)(li,{onSelect:Ce,"data-testid":`project-switcher-open-folder`,children:[we,Te]}),t[79]=Ce,t[80]=Ee);let De;t[81]===F?De=t[82]:(De=e=>{D(e)||F()},t[81]=F,t[82]=De);let Oe,ke;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,Z.jsx)(Rr,{"aria-hidden":`true`,className:`text-muted-foreground`}),ke=(0,Z.jsx)(Y,{id:`9npOH9`}),t[83]=Oe,t[84]=ke):(Oe=t[83],ke=t[84]);let Ae;t[85]===De?Ae=t[86]:(Ae=(0,Z.jsxs)(li,{onSelect:De,"data-testid":`project-switcher-open-file`,children:[Oe,ke]}),t[85]=De,t[86]=Ae);let je;t[87]===v?je=t[88]:(je=v===null?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Si,{}),(0,Z.jsxs)(li,{onSelect:e=>{D(e)||(T(!1),h(``),p(!0))},"data-testid":`project-switcher-new-worktree`,children:[(0,Z.jsx)($c,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(Y,{id:`DXd9LM`})]})]}),t[87]=v,t[88]=je);let Me;t[89]!==he||t[90]!==Se||t[91]!==Ee||t[92]!==Ae||t[93]!==je?(Me=(0,Z.jsxs)(yi,{align:`start`,side:`top`,className:`min-w-[260px]`,"data-testid":`project-switcher-menu`,children:[he,ge,ve,Se,Ee,Ae,je]}),t[89]=he,t[90]=Se,t[91]=Ee,t[92]=Ae,t[93]=je,t[94]=Me):Me=t[94];let Ne;t[95]!==o||t[96]!==me||t[97]!==Me?(Ne=(0,Z.jsxs)(xi,{open:o,onOpenChange:T,modal:!1,children:[me,Me]}),t[95]=o,t[96]=me,t[97]=Me,t[98]=Ne):Ne=t[98];let Pe;t[99]!==n||t[100]!==u?(Pe=(0,Z.jsx)(Uy,{open:u,onOpenChange:d,bridge:n}),t[99]=n,t[100]=u,t[101]=Pe):Pe=t[101];let Fe;t[102]===y?.entries?Fe=t[103]:(Fe=y?.entries.map(r3).filter(n3),t[102]=y?.entries,t[103]=Fe);let Ie;t[104]===y?.entries?Ie=t[105]:(Ie=new Set(y?.entries.filter(t3).map(e3)),t[104]=y?.entries,t[105]=Ie);let Le=y?.remoteBranches,Re;t[106]===y?.entries?Re=t[107]:(Re=new Map(y?.entries.filter($4).map(Q4)),t[106]=y?.entries,t[107]=Re);let ze;t[108]!==v||t[109]!==n||t[110]!==m||t[111]!==f||t[112]!==Fe||t[113]!==Ie||t[114]!==Le||t[115]!==Re?(ze=(0,Z.jsx)(M4,{open:f,onOpenChange:p,bridge:n,currentBranch:v,initialBranchName:m,branches:Fe,existingWorktreeBranches:Ie,remoteBranches:Le,behindByBranch:Re}),t[108]=v,t[109]=n,t[110]=m,t[111]=f,t[112]=Fe,t[113]=Ie,t[114]=Le,t[115]=Re,t[116]=ze):ze=t[116];let Be;return t[117]!==Ne||t[118]!==Pe||t[119]!==ze?(Be=(0,Z.jsxs)(Z.Fragment,{children:[Ne,Pe,ze]}),t[117]=Ne,t[118]=Pe,t[119]=ze,t[120]=Be):Be=t[120],Be}function Q4(e){return[e.branch,e.behind]}function $4(e){return e.branch!==null&&e.behind!==void 0}function e3(e){return e.branch}function t3(e){return e.branch!==null&&e.worktreePath!==null}function n3(e){return e!==null}function r3(e){return e.branch}function i3(e){return e.stopPropagation()}function a3(e){return!e.isLinkedWorktree}function o3(e,t){let n=e instanceof Error?e:Error(String(e));console.warn(JSON.stringify({event:`jsx-render-failure`,component:`sidebarSearchPill`,rawComponentName:`sidebarSearchPill`,error:String(n),stack:t.componentStack})),Ua(`sidebarSearchPill`)}function s3(e){let t=(0,$.c)(15),{onClick:n,className:r}=e,{_:i}=on(),a;t[0]===i?a=t[1]:(a=i({id:`A1taO8`}),t[0]=i,t[1]=a);let o=a,s;t[2]===r?s=t[3]:(s=Bn(`shrink-0 text-muted-foreground`,r),t[2]=r,t[3]=s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(ct,{"aria-hidden":`true`}),t[4]=c):c=t[4];let l;t[5]!==o||t[6]!==n||t[7]!==s?(l=(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,onClick:n,"aria-label":o,"data-telemetry-event":`ok.sidebar.search_pill.click`,className:s,children:c})}),t[5]=o,t[6]=n,t[7]=s,t[8]=l):l=t[8];let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(ne,{className:`text-foreground/70`,children:xs(`command-palette`)}),t[9]=u):u=t[9];let d;t[10]===o?d=t[11]:(d=(0,Z.jsxs)(cr,{children:[o,u]}),t[10]=o,t[11]=d);let f;return t[12]!==l||t[13]!==d?(f=(0,Z.jsxs)(ur,{children:[l,d]}),t[12]=l,t[13]=d,t[14]=f):f=t[14],f}var c3=e=>{let t=(0,$.c)(7),{label:n,shortcutId:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`span`,{children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsx)(ne,{"aria-label":Ss(r),children:xs(r)})]}):null,t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Z.jsxs)(cr,{children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o},l3=e=>{let t=(0,$.c)(17),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({icon:n,label:r,shortcutId:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===n?o=t[6]:(o=(0,Z.jsx)(n,{"aria-hidden":`true`}),t[5]=n,t[6]=o);let s;t[7]!==r||t[8]!==i||t[9]!==o?(s=(0,Z.jsx)(sr,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":r,...i,children:o})}),t[7]=r,t[8]=i,t[9]=o,t[10]=s):s=t[10];let c;t[11]!==r||t[12]!==a?(c=(0,Z.jsx)(c3,{label:r,shortcutId:a}),t[11]=r,t[12]=a,t[13]=c):c=t[13];let l;return t[14]!==s||t[15]!==c?(l=(0,Z.jsxs)(ur,{children:[s,c]}),t[14]=s,t[15]=c,t[16]=l):l=t[16],l};function u3(e){let t=(0,$.c)(75),{open:n,onOpenChange:r,scope:i,existingNames:a,busy:o,onCreate:s}=e,{_:c}=on(),[l,u]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(null),h=(0,Q.useId)(),g=(0,Q.useId)(),_=(0,Q.useId)(),v=(0,Q.useRef)(null),y,b;t[0]!==a||t[1]!==n?(y=()=>{if(!n)return;let e=`new-skill`;for(let t=2;a.has(e);t++)e=`new-skill-${t}`;u(e),f(Wx),m(null)},b=[n,a],t[0]=a,t[1]=n,t[2]=y,t[3]=b):(y=t[2],b=t[3]),(0,Q.useEffect)(y,b);let x;t[4]!==c||t[5]!==a?(x=function(e){let t=e.trim();return t?Pa.test(t)?a.has(t)?c({id:`XIltnd`,values:{trimmed:t}}):null:c({id:`szy9BS`}):c({id:`hYDc6B`})},t[4]=c,t[5]=a,t[6]=x):x=t[6];let S=x,C;t[7]!==d||t[8]!==l||t[9]!==s||t[10]!==S?(C=function(){let e=l.trim(),t=S(e);if(t){m(t),v.current?.focus();return}s({name:e,description:d.trim()||`Describe what this skill does and when to use it.`})},t[7]=d,t[8]=l,t[9]=s,t[10]=S,t[11]=C):C=t[11];let w=C,T;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(hr,{children:(0,Z.jsx)(Y,{id:`MdpSC1`})}),t[12]=T):T=t[12];let E;t[13]===i?E=t[14]:(E=(0,Z.jsxs)(yr,{children:[T,(0,Z.jsx)(mr,{children:i===`global`?(0,Z.jsx)(Y,{id:`w7bnEb`}):(0,Z.jsx)(Y,{id:`1VpfKR`})})]}),t[13]=i,t[14]=E);let D;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(Y,{id:`6YtxFj`}),t[15]=D):D=t[15];let O;t[16]===h?O=t[17]:(O=(0,Z.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:h,children:D}),t[16]=h,t[17]=O);let k;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>{u(e.target.value),m(null)},t[18]=k):k=t[18];let A=p?!0:void 0,j=p?_:void 0,M;t[19]!==o||t[20]!==w?(M=e=>{e.key===`Enter`&&!o&&(e.preventDefault(),w())},t[19]=o,t[20]=w,t[21]=M):M=t[21];let N;t[22]!==l||t[23]!==h||t[24]!==A||t[25]!==j||t[26]!==M?(N=(0,Z.jsx)(zf,{ref:v,id:h,value:l,onChange:k,placeholder:`my-skill`,autoFocus:!0,onFocus:d3,"aria-invalid":A,"aria-describedby":j,onKeyDown:M}),t[22]=l,t[23]=h,t[24]=A,t[25]=j,t[26]=M,t[27]=N):N=t[27];let P;t[28]!==p||t[29]!==_?(P=p?(0,Z.jsx)(`p`,{id:_,role:`alert`,className:`text-1sm text-destructive`,children:p}):null,t[28]=p,t[29]=_,t[30]=P):P=t[30];let F;t[31]!==N||t[32]!==P||t[33]!==O?(F=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[O,N,P]}),t[31]=N,t[32]=P,t[33]=O,t[34]=F):F=t[34];let I;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(Y,{id:`Nu4oKW`}),t[35]=I):I=t[35];let L;t[36]===g?L=t[37]:(L=(0,Z.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:g,children:I}),t[36]=g,t[37]=L);let R;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>f(e.target.value),t[38]=R):R=t[38];let z;t[39]!==d||t[40]!==g?(z=(0,Z.jsx)(Pm,{id:g,value:d,onChange:R,rows:2,placeholder:Wx}),t[39]=d,t[40]=g,t[41]=z):z=t[41];let B;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(`p`,{className:`text-2xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`Tn5sik`})}),t[42]=B):B=t[42];let V;t[43]!==L||t[44]!==z?(V=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[L,z,B]}),t[43]=L,t[44]=z,t[45]=V):V=t[45];let H;t[46]!==F||t[47]!==V?(H=(0,Z.jsxs)(_r,{className:`space-y-4`,children:[F,V]}),t[46]=F,t[47]=V,t[48]=H):H=t[48];let U;t[49]===r?U=t[50]:(U=()=>r(!1),t[49]=r,t[50]=U);let W;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Z.jsx)(Y,{id:`dEgA5A`}),t[51]=W):W=t[51];let ee;t[52]!==o||t[53]!==U?(ee=(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:U,disabled:o,children:W}),t[52]=o,t[53]=U,t[54]=ee):ee=t[54];let G;t[55]!==o||t[56]!==l?(G=o||!l.trim(),t[55]=o,t[56]=l,t[57]=G):G=t[57];let K;t[58]===o?K=t[59]:(K=o?(0,Z.jsx)(Y,{id:`E9bKSA`}):(0,Z.jsx)(Y,{id:`hYgDIe`}),t[58]=o,t[59]=K);let q;t[60]!==w||t[61]!==G||t[62]!==K?(q=(0,Z.jsx)(X,{onClick:w,disabled:G,children:K}),t[60]=w,t[61]=G,t[62]=K,t[63]=q):q=t[63];let te;t[64]!==ee||t[65]!==q?(te=(0,Z.jsxs)(vr,{children:[ee,q]}),t[64]=ee,t[65]=q,t[66]=te):te=t[66];let J;t[67]!==H||t[68]!==te||t[69]!==E?(J=(0,Z.jsxs)(gr,{className:`sm:max-w-md`,children:[E,H,te]}),t[67]=H,t[68]=te,t[69]=E,t[70]=J):J=t[70];let ne;return t[71]!==r||t[72]!==n||t[73]!==J?(ne=(0,Z.jsx)(br,{open:n,onOpenChange:r,children:J}),t[71]=r,t[72]=n,t[73]=J,t[74]=ne):ne=t[74],ne}function d3(e){return e.currentTarget.select()}function f3(e){let t=(0,$.c)(29),{model:n,hostRef:r,ready:i,style:a,header:o,className:s,hostAttrs:c,renderContextMenu:l,onClickCapture:u,onMouseMove:d,onMouseLeave:f,onContentHeightChange:p,sizeToContent:m,titleForPath:h}=e,g=(0,Q.useRef)(h),_;t[0]===h?_=t[1]:(_=()=>{g.current=h},t[0]=h,t[1]=_),(0,Q.useEffect)(_);let v,y;t[2]!==r||t[3]!==i?(v=()=>{if(!i)return;let e=r.current?.querySelector(JW)?.shadowRoot;if(!e)return;let t=e=>g.current?.(e)??(e.endsWith(`/`)?e.slice(0,-1):e),n=()=>{for(let n of e.querySelectorAll(`[data-item-path]`)){let e=n.dataset.itemPath;if(!e)continue;let r=t(e);n.title!==r&&(n.title=r)}let n=e.querySelector(`[data-type="context-menu-anchor"]`);if(n){let r=e.querySelector(`[data-item-context-hover="true"][data-item-path]`)?.dataset.itemPath,i=r?t(r):``;n.title!==i&&(n.title=i)}};n();let a=new MutationObserver(n);return a.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`,`data-item-context-hover`]}),()=>a.disconnect()},y=[i,r],t[2]=r,t[3]=i,t[4]=v,t[5]=y):(v=t[4],y=t[5]),(0,Q.useEffect)(v,y);let b,x;t[6]!==r||t[7]!==i?(b=()=>{if(!i)return;let e=r.current?.querySelector(JW)?.shadowRoot;if(!e)return;let t=()=>f1(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},x=[i,r],t[6]=r,t[7]=i,t[8]=b,t[9]=x):(b=t[8],x=t[9]),(0,Q.useEffect)(b,x);let S,C;t[10]!==r||t[11]!==n||t[12]!==p||t[13]!==m?(S=()=>{if(!p&&!m)return;let e=0,t=0,i=()=>r.current?.querySelector(`file-tree-container`)?.shadowRoot?.querySelector(`[data-file-tree-virtualized-list]`)??null,a=()=>{let e=i();if(!e)return;let t=Number.parseFloat(e.style.height);Number.isFinite(t)&&(p?.(t),m&&r.current&&(r.current.style.height=`${t}px`))},o=()=>{cancelAnimationFrame(e),e=requestAnimationFrame(a)},s=new MutationObserver(a),c=()=>{let e=i();e?(s.observe(e,{attributes:!0,attributeFilter:[`style`]}),a()):t=requestAnimationFrame(c)};c();let l=n.subscribe(o);return window.addEventListener(`resize`,o),()=>{cancelAnimationFrame(e),cancelAnimationFrame(t),s.disconnect(),l(),window.removeEventListener(`resize`,o)}},C=[p,m,n,r],t[10]=r,t[11]=n,t[12]=p,t[13]=m,t[14]=S,t[15]=C):(S=t[14],C=t[15]),(0,Q.useEffect)(S,C);let w;t[16]!==o||t[17]!==c||t[18]!==n||t[19]!==u||t[20]!==f||t[21]!==d||t[22]!==l||t[23]!==a?(w=(0,Z.jsx)(e1,{header:o,model:n,style:a,...c,onClickCapture:u,onMouseMove:d,onMouseLeave:f,renderContextMenu:l}),t[16]=o,t[17]=c,t[18]=n,t[19]=u,t[20]=f,t[21]=d,t[22]=l,t[23]=a,t[24]=w):w=t[24];let T;return t[25]!==s||t[26]!==r||t[27]!==w?(T=(0,Z.jsx)(`div`,{ref:r,className:s,children:w}),t[25]=s,t[26]=r,t[27]=w,t[28]=T):T=t[28],T}var p3=`data-ok-install-cluster`,m3=`data-ok-cluster-key`,h3=`data-ok-install-pill`,g3=`data-ok-install-path`,_3=`data-ok-host-pool-key`,v3=`data-ok-cluster-hint`,y3=`
2015
2015
  [${p3}] {
2016
2016
  display: inline-flex;
2017
2017
  align-items: center;
@@ -2091,5 +2091,5 @@ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./globals-CLY_4Hw9.js";imp
2091
2091
  /* Empty-scope sentinel child: structural only (forces the scope folder to
2092
2092
  render); never shown to the user. */
2093
2093
  [data-item-path$='/${O3}'] { display: none !important; }
2094
- `;function N3(e){let t=e.endsWith(`/`),n=(t?e.slice(0,-1):e).split(`/`);return{scopeLabel:n[0]??``,skillDisplay:n.length>=2?n[1]:void 0,sub:n.length>=3?n.slice(2).join(`/`):null,isDir:t}}function P3(e){let t=(0,$.c)(118),{paths:n,activePath:r,initialExpandedPaths:i,onExpandedChange:a,sort:o,skillByPrefix:s,detectedByPrefix:c,labelToScope:l,scopeDescription:u,existingNames:d,actions:f,onOpenSkillMd:p,onOpenFile:h,onOpenDetected:g,onOpenManaged:_,onNewSkill:v,onAddSkill:y}=e,{_:b}=on(),{resolvedTheme:x}=Dn(),S=(0,Q.useRef)(null),C=(0,Q.useRef)(null),[w,T]=(0,Q.useState)(!1),E,D;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>T(!0),D=[],t[0]=E,t[1]=D):(E=t[0],D=t[1]),(0,Q.useEffect)(E,D);let[O,k]=(0,Q.useState)(null),A;t[2]===s?A=t[3]:(A=[...s.values()].map(z3),t[2]=s,t[3]=A);let j=A.join(`|`),M=R3,N;t[4]===s?N=t[5]:(N=e=>{let t=M(e);return t===void 0?void 0:s.get(t)},t[4]=s,t[5]=N);let P=N,F;t[6]===c?F=t[7]:(F=e=>{let t=M(e);return t===void 0?void 0:c.get(t)},t[6]=c,t[7]=F);let I=F,L;t[8]!==b||t[9]!==I||t[10]!==l||t[11]!==P?(L=e=>{let t=N3(e);if(t.skillDisplay===void 0)return null;let n=I(t);if(n){let e=l.get(t.scopeLabel)??`global`,r=n.sourceHarnesses.map(n=>`${Cp(n,e)}/${t.skillDisplay}`);return t.sub?r.map(e=>`${e}/${t.sub}`).join(`, `):r.join(`, `)}let r=P(t);if(!r)return null;if(r.managed){let e=r.absolutePath?jp(Sp(r.absolutePath)):null;return e?t.sub?`${e}/${t.sub}`:e:null}return kp(r).map(e=>{let n=t.sub?`${e.dir}/${t.sub}`:e.dir;return e.symlink?b({id:`leiGnv`,values:{dir:n}}):n}).join(`, `)},t[8]=b,t[9]=I,t[10]=l,t[11]=P,t[12]=L):L=t[12];let R=L,z;t[13]!==I||t[14]!==l||t[15]!==P?(z=e=>{if(!l.get(e.scopeLabel))return!1;if(e.skillDisplay===void 0||I(e))return!0;let t=P(e);return!(!t||t.managed)},t[13]=I,t[14]=l,t[15]=P,t[16]=z):z=t[16];let B=z,V=(0,Q.useRef)(B),H;t[17]===B?H=t[18]:(H=()=>{V.current=B},t[17]=B,t[18]=H),(0,Q.useEffect)(H);let U=L3,W;t[19]!==b||t[20]!==I||t[21]!==l||t[22]!==P?(W=e=>{let t=N3(e);if(t.skillDisplay===void 0||t.sub!==null)return null;let n=I(t);if(n){let e=l.get(t.scopeLabel)??`global`;return{kind:`icons`,poolKeys:n.sourceHarnesses.map(U),title:b({id:`W3Tsgy`,values:{0:n.sourceHarnesses.map(t=>Cp(t,e)).join(`, `)}})}}let r=P(t);if(!r||r.managed)return null;let i=Ep(r);return i.length>0?{kind:`icons`,poolKeys:i.map(U),title:b({id:`h2N-1n`,values:{0:i.map(e=>Cp(e,r.scope)).join(`, `)}})}:{kind:`install`,title:b({id:`fGqEFq`,values:{0:r.name}})}},t[19]=b,t[20]=I,t[21]=l,t[22]=P,t[23]=W):W=t[23];let ee=W,G;t[24]===b?G=t[25]:(G=b({id:`TKQ7K-`}),t[24]=b,t[25]=G);let K;t[26]!==ee||t[27]!==P||t[28]!==G?(K={decorForPath:ee,skillFor:P,installLabel:G},t[26]=ee,t[27]=P,t[28]=G,t[29]=K):K=t[29];let q=(0,Q.useRef)(K),te;t[30]!==b||t[31]!==ee||t[32]!==P?(te=()=>{q.current={decorForPath:ee,skillFor:P,installLabel:b({id:`TKQ7K-`})}},t[30]=b,t[31]=ee,t[32]=P,t[33]=te):te=t[33],(0,Q.useEffect)(te);let J=(0,Q.useRef)(I3),ne;if(t[34]!==b||t[35]!==r||t[36]!==I||t[37]!==i||t[38]!==n||t[39]!==P){let e;t[41]!==b||t[42]!==I||t[43]!==P?(e=e=>{let{item:t}=e,n=N3(t.path);if(n.skillDisplay===void 0||n.sub!==null)return null;if(P(n)?.managed)return{icon:k3,title:b({id:`KN5RGc`})};let r=I(n);return r?.provenance.plugin===void 0?null:{icon:A3,title:b({id:`AkA6DO`,values:{0:r.provenance.plugin}})}},t[41]=b,t[42]=I,t[43]=P,t[44]=e):e=t[44],ne=C0({paths:n,initialExpansion:`closed`,initialExpandedPaths:i,initialSelectedPaths:r?[r]:void 0,stickyFolders:!1,enableContextMenu:!0,unsafeCSS:`${S0}\n${M3}\n${y3}`,extraSpriteSymbols:j3,renderRowDecoration:e}),t[34]=b,t[35]=r,t[36]=I,t[37]=i,t[38]=n,t[39]=P,t[40]=ne}else ne=t[40];let re;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(re=e=>J.current(e),t[45]=re):re=t[45];let ie;t[46]!==o||t[47]!==ne?(ie={...ne,onSelectionChange:re,sort:o,flattenEmptyDirectories:!1},t[46]=o,t[47]=ne,t[48]=ie):ie=t[48];let{model:ae}=t1(ie),oe;t[49]!==r||t[50]!==I||t[51]!==g||t[52]!==h||t[53]!==_||t[54]!==p||t[55]!==P?(oe=()=>{J.current=e=>{let t=e[0];if(!t||t===r)return;let n=N3(t);if(n.sub!==null&&n.isDir)return;let i=I(n);if(i){g(i,n.sub??void 0);return}let a=P(n);a&&(n.sub===null||n.sub===`SKILL.md`?(a.managed?_:p)(a):h(a,n.sub))}},t[49]=r,t[50]=I,t[51]=g,t[52]=h,t[53]=_,t[54]=p,t[55]=P,t[56]=oe):oe=t[56],(0,Q.useEffect)(oe);let se;t[57]!==c||t[58]!==l||t[59]!==a||t[60]!==s?(se={labelToScope:l,skillByPrefix:s,detectedByPrefix:c,onExpandedChange:a},t[57]=c,t[58]=l,t[59]=a,t[60]=s,t[61]=se):se=t[61];let ce=(0,Q.useRef)(se),le;t[62]!==c||t[63]!==l||t[64]!==a||t[65]!==s?(le=()=>{ce.current={labelToScope:l,skillByPrefix:s,detectedByPrefix:c,onExpandedChange:a}},t[62]=c,t[63]=l,t[64]=a,t[65]=s,t[66]=le):le=t[66],(0,Q.useEffect)(le);let de;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(de=new Set,t[67]=de):de=t[67];let fe=(0,Q.useRef)(de),pe,me;t[68]===ae?(pe=t[69],me=t[70]):(pe=()=>{let e=()=>{let e=ce.current,t=new Set,n=e=>{L0(ae.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}/`);let r=fe.current;r.size===t.size&&[...t].every(e=>r.has(e))||(fe.current=t,e.onExpandedChange(t))};return e(),ae.subscribe(e)},me=[ae],t[68]=ae,t[69]=pe,t[70]=me),(0,Q.useEffect)(pe,me);let he,ge;t[71]!==r||t[72]!==ae||t[73]!==w?(he=()=>{if(w){for(let e of ae.getSelectedPaths())e!==r&&ae.getItem(e)?.deselect();if(r){ae.getItem(r)?.select(),ae.focusPath(r);let e=N3(r);e.skillDisplay!==void 0&&L0(ae.getItem(`${e.scopeLabel}/${e.skillDisplay}/`))?.expand()}}},ge=[w,r,ae],t[71]=r,t[72]=ae,t[73]=w,t[74]=he,t[75]=ge):(he=t[74],ge=t[75]),(0,Q.useEffect)(he,ge);let _e=(0,Q.useRef)(i),ve;t[76]===i?ve=t[77]:(ve=()=>{_e.current=i},t[76]=i,t[77]=ve),(0,Q.useEffect)(ve);let ye,be;t[78]!==ae||t[79]!==w?(ye=()=>{if(w)for(let e of _e.current)L0(ae.getItem(e))?.expand()},be=[w,ae],t[78]=ae,t[79]=w,t[80]=ye,t[81]=be):(ye=t[80],be=t[81]),(0,Q.useEffect)(ye,be);let xe,Se;t[82]===w?(xe=t[83],Se=t[84]):(xe=()=>{if(!w)return;let e=S.current?.querySelector(JW)?.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&&!V.current(N3(n));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()},Se=[w],t[82]=w,t[83]=xe,t[84]=Se),(0,Q.useEffect)(xe,Se);let Ce;t[85]!==w||t[86]!==x?(Ce=()=>{if(!w)return;let e=S.current?.querySelector(JW)?.shadowRoot;if(!e)return;let t=()=>x3(e,{decorFor:e=>q.current.decorForPath(e),iconPool:C.current,installLabel:q.current.installLabel,version:x??`light`});t();let n=new MutationObserver(t);n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]});let r=e=>{let t=b3(e.target);if(!t)return;e.preventDefault(),e.stopPropagation();let n=q.current.skillFor(N3(t.path));n&&k({skill:n,x:t.rect.left,y:t.rect.bottom})};return e.addEventListener(`click`,r,!0),()=>{n.disconnect(),e.removeEventListener(`click`,r,!0)}},t[85]=w,t[86]=x,t[87]=Ce):Ce=t[87];let we;t[88]!==j||t[89]!==w||t[90]!==x?(we=[w,x,j],t[88]=j,t[89]=w,t[90]=x,t[91]=we):we=t[91],(0,Q.useEffect)(Ce,we);let Te;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,Z.jsxs)(`div`,{ref:C,"aria-hidden":!0,style:{position:`absolute`,width:0,height:0,overflow:`hidden`},children:[jc.map(F3),(0,Z.jsx)(`span`,{[T3]:`generic`,children:(0,Z.jsx)(ue,{})})]}),t[92]=Te):Te=t[92];let Ee;t[93]!==f||t[94]!==O?(Ee=O?(0,Z.jsxs)(xi,{open:!0,onOpenChange:e=>{e||k(null)},children:[(0,Z.jsx)(hi,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":!0,style:{position:`fixed`,left:O.x,top:O.y,width:0,height:0}})}),(0,Z.jsx)(yi,{align:`start`,className:Mc,children:(0,Z.jsx)(B3,{skill:O.skill,actions:f,onRunStart:()=>k(null)})})]}):null,t[93]=f,t[94]=O,t[95]=Ee):Ee=t[95];let De;t[96]===x?De=t[97]:(De=s1(x),t[96]=x,t[97]=De);let Oe;t[98]!==f||t[99]!==I||t[100]!==d||t[101]!==l||t[102]!==y||t[103]!==v||t[104]!==g||t[105]!==B||t[106]!==u||t[107]!==P?(Oe=(e,t)=>{let n=N3(e.path);if(!B(n))return null;let r=l.get(n.scopeLabel);if(!r)return null;let i;if(n.skillDisplay===void 0)i=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(_i,{className:`max-w-56 whitespace-normal font-normal text-muted-foreground text-xs`,children:u[r]}),(0,Z.jsx)(Si,{}),(0,Z.jsxs)(li,{onSelect:()=>v(r),children:[(0,Z.jsx)(df,{"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`MdpSC1`})]}),(0,Z.jsxs)(li,{onSelect:()=>y(r,`upload`),children:[(0,Z.jsx)(m,{"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`koo58J`})]}),(0,Z.jsxs)(li,{onSelect:()=>y(r,`skills-sh`),children:[(0,Z.jsx)(Sv,{"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`C3Zc44`})]})]});else{let e=I(n);if(e)i=(0,Z.jsxs)(li,{onSelect:()=>g(e),children:[(0,Z.jsx)(df,{"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`ePK91l`})]});else{let e=P(n);if(!e||e.managed)return null;i=n.sub===null||n.sub===`SKILL.md`?(0,Z.jsx)(Uc,{skill:e,actions:f,existingNames:d[e.scope]}):n.isDir?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Vc,{absolutePath:e.absolutePath?`${Sp(e.absolutePath)}/${n.sub}`:void 0}),(0,Z.jsx)(li,{onSelect:()=>f.requestFileCreate(e,`${n.sub}/`),children:(0,Z.jsx)(Y,{id:`HdkSiO`})})]}):(0,Z.jsx)(Rc,{skill:e,filePath:n.sub,actions:f})}}return(0,Z.jsxs)(xi,{open:!0,modal:!1,onOpenChange:e=>{e||t.close({restoreFocus:!1})},children:[(0,Z.jsx)(hi,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),(0,Z.jsx)(yi,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:i})]})},t[98]=f,t[99]=I,t[100]=d,t[101]=l,t[102]=y,t[103]=v,t[104]=g,t[105]=B,t[106]=u,t[107]=P,t[108]=Oe):Oe=t[108];let ke;t[109]!==ae||t[110]!==w||t[111]!==De||t[112]!==Oe||t[113]!==R?(ke=(0,Z.jsx)(f3,{model:ae,hostRef:S,ready:w,className:`min-h-0`,style:De,sizeToContent:!0,titleForPath:R,renderContextMenu:Oe}),t[109]=ae,t[110]=w,t[111]=De,t[112]=Oe,t[113]=R,t[114]=ke):ke=t[114];let Ae;return t[115]!==Ee||t[116]!==ke?(Ae=(0,Z.jsxs)(Z.Fragment,{children:[Te,Ee,ke]}),t[115]=Ee,t[116]=ke,t[117]=Ae):Ae=t[117],Ae}function F3(e){return(0,Z.jsx)(`span`,{[T3]:e,children:(0,Z.jsx)(Zn,{host:e})},e)}function I3(){}function L3(e){return jc.includes(e)?e:`generic`}function R3(e){return e.skillDisplay===void 0?void 0:`${e.scopeLabel}/${e.skillDisplay}`}function z3(e){return`${e.name}:${[...e.hosts].sort().join(`,`)}`}function B3(e){let t=(0,$.c)(8),{skill:n,actions:r,onRunStart:i}=e,a=Lc(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)(Bc,{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 V3(){let e=(0,$.c)(2),{openTarget:t}=Oe(),n;return e[0]===t?n=e[1]:(n=async(e,n,r)=>{let i=await om({name:e,home:n});if(!i.ok)return i;let a=r?.rel?Ra(e,r.rel):i.docName;return t({kind:`doc`,target:a,docName:a},r?.replaceActive?{tabBehavior:`replace-active`}:void 0),Nf(Cf(a)),{ok:!0,docName:a}},e[0]=t,e[1]=n),n}var H3=(0,Q.lazy)(()=>n(()=>import(`./ImportSkillDialog-R8BKwyCS.js`).then(e=>({default:e.ImportSkillDialog})),__vite__mapDeps([122,1,6,2,3,7,8,9,10,11,45,12,13,14,97,35,36,16,17,18,20,54,28,29,34,24,25,26,19,22,21,40,98,27,30,31,123,124,55,125,56,79,80,81,82,83,84,85,86,87,88,89,90,91,74,92,93,94,95,96,4,39,99,100,101,41,42,66,67,68,69,102,49,71,103,104,46,105,33,65,70,72,73,106,107,108,37,23,109,110,43,47,111,112,113,126,127,128,129,130,131,132,48]),import.meta.url)),U3=new Set([`open-knowledge`,`open-knowledge-discovery`,`open-knowledge-write-skill`]);function W3(e){let t=(0,$.c)(83),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{skillsMode:r}=n,i=r===void 0?!1:r,a=fm(),{openTarget:o,activeDocName:s,activeTarget:c,openTabs:l,activateTab:u,setSkillsSidebar:d}=Oe(),f;t[2]===d?f=t[3]:(f=()=>d(!0),t[2]=d,t[3]=f);let p=f,{merged:m}=xc(),h=m?.editor?.previewTabs??!0?`replace-active`:`append`,g=pm(),_=V3(),v=Fc(),{_:y}=on(),b=Tp(),x=wp(),S;t[4]!==a.data||t[5]!==a.status?(S=a.status===`ready`?a.data:[],t[4]=a.data,t[5]=a.status,t[6]=S):S=t[6];let C=S,w=Dp(C),[T,E]=(0,Q.useState)(Q3),{createBlank:D,creating:O}=Gx(),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(null),[N,P]=(0,Q.useState)(null),F;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(F={},t[7]=F):F=t[7];let[I,L]=(0,Q.useState)(F),R,z;t[8]===i?(R=t[9],z=t[10]):(R=()=>{if(!i)return;let e=!0,t=()=>{nm().then(t=>{e&&(t.ok?P(t.skills):(console.warn(`[skills-sidebar] listDetectedSkills failed:`,t),P([])))})};t();let n=Hs(t);return()=>{e=!1,n()}},z=[i],t[8]=i,t[9]=R,t[10]=z),(0,Q.useEffect)(R,z);let B;if(t[11]!==C){B=new Set;let e=new Set;for(let t of C){let n=`${t.scope}:${t.name}`;e.has(n)&&B.add(n),e.add(n)}t[11]=C,t[12]=B}else B=t[12];let V;t[13]===B?V=t[14]:(V=e=>B.has(`${e.scope}:${e.name}`)?e.hosts[0]:void 0,t[13]=B,t[14]=V);let H=V,U;t[15]===H?U=t[16]:(U=e=>`${e.scope}:${e.name}:${H(e)??``}`,t[15]=H,t[16]=U);let W=U,ee;t[17]!==W||t[18]!==C?(ee=C.map(W).join(`|`),t[17]=W,t[18]=C,t[19]=ee):ee=t[19];let G=ee,K;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(K={},t[20]=K):K=t[20];let[q,te]=(0,Q.useState)(K),[J,ne]=(0,Q.useState)(!1),re,ie;if(t[21]!==G||t[22]!==i?(re=()=>{if(!i)return;let e=!0,t=G?G.split(`|`):[],n=()=>{ne(!0),Promise.all(t.map(Z3)).then(t=>{e&&te(Object.fromEntries(t))}).catch(X3).finally(()=>{e&&ne(!1)})};n();let r=Hs(n);return()=>{e=!1,r()}},ie=[G,i],t[21]=G,t[22]=i,t[23]=re,t[24]=ie):(re=t[23],ie=t[24]),(0,Q.useEffect)(re,ie),!i)return null;let ae;t[25]!==o||t[26]!==p||t[27]!==h?(ae=e=>{o({kind:`doc`,target:e,docName:e},{tabBehavior:h}),bf(Cf(e)),p()},t[25]=o,t[26]=p,t[27]=h,t[28]=ae):ae=t[28];let oe=ae,se;t[29]===oe?se=t[30]:(se=e=>{oe($f(e))},t[29]=oe,t[30]=se);let ce=se,le;t[31]!==u||t[32]!==l||t[33]!==o||t[34]!==p||t[35]!==h?(le=e=>{if(e.flavor!==`explore`&&e.level){let t=sp(l,e.flavor,e.name,e.level);if(t){u(t),bf(Tf(e)),p();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:h}),bf(Tf(e)),p()},t[31]=u,t[32]=l,t[33]=o,t[34]=p,t[35]=h,t[36]=le):le=t[36];let ue=le,de;t[37]===ue?de=t[38]:(de=e=>{ue({flavor:`builtin`,source:Sp(e.absolutePath??``),name:e.name,subtitle:``,level:e.scope})},t[37]=ue,t[38]=de);let fe=de,pe;t[39]!==H||t[40]!==oe||t[41]!==o||t[42]!==p||t[43]!==h?(pe=(e,t)=>{let n=t.lastIndexOf(`.`),r=n>=0?t.slice(n+1).toLowerCase():``;if(!e.managed&&(r===`md`||r===`mdx`)){oe(pp(e,t));return}let i=H(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:h}),bf(Df({scope:e.scope,name:e.name,path:t,...i?{host:i}:{}})),p()},t[39]=H,t[40]=oe,t[41]=o,t[42]=p,t[43]=h,t[44]=pe):pe=t[44];let me=pe,he=(e,t)=>{let n=t.slice(t.lastIndexOf(`.`)+1).toLowerCase();return!e.managed&&(n===`md`||n===`mdx`)?s===pp(e,t):c?.kind===`skill-file`&&c.scope===e.scope&&c.name===e.name&&c.path===t},ge=e=>c?.kind===`doc`?s===$f(e):!1,_e=Y3,ve;t[45]===I?ve=t[46]:(ve=(e,t)=>{let n=_e(e);I[n]===void 0&&cm({source:t,name:e.name}).then(e=>{e.ok&&L(t=>({...t,[n]:e.files.map(J3)}))})},t[45]=I,t[46]=ve);let ye=ve,be;t[47]!==y||t[48]!==ye||t[49]!==ue||t[50]!==_||t[51]!==p||t[52]!==h?(be=(e,t)=>{let n=Sp(e.files.skillMd);ye(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){ue({flavor:i,source:n,name:e.name,subtitle:e.sourceHarness??``,level:$a(e.provenance.scope),...r===void 0?{}:{path:t}});return}let a=h===`replace-active`;_(e.name,n,{replaceActive:a,rel:r}).then(t=>{t.ok?p():Ns.error(y({id:`lwCV5v`,values:{0:e.name,1:t.error}}))})},t[47]=y,t[48]=ye,t[49]=ue,t[50]=_,t[51]=p,t[52]=h,t[53]=be):be=t[53];let xe=be,Se;t[54]===b?Se=t[55]:(Se=e=>[b[e],e],t[54]=b,t[55]=Se);let Ce=new Map(Ap.map(Se)),we;if(t[56]!==C){we=new Map;for(let e of C){let t=`${e.scope}\x00${Op(e.name)}`;we.set(t,(we.get(t)??0)+1)}t[56]=C,t[57]=we}else we=t[57];let Te;t[58]!==we||t[59]!==H?(Te=e=>{let t=Op(e.name),n=H(e);return n?`${e.name} (${n===`agents`?`.agents`:n})`:(we.get(`${e.scope}\x00${t}`)??0)>1?e.name:t},t[58]=we,t[59]=H,t[60]=Te):Te=t[60];let Ee=Te,De=new Map,ke=[],Ae,je=[],Me=new Map(Ap.map(q3));for(let e of Ap)ke.push(`${b[e]}/`),je.push(`${b[e]}/`);for(let e of C){let t=Ee(e);Me.get(e.scope)?.add(t);let n=`${b[e.scope]}/${t}`;De.set(n,e),ke.push(`${n}/${E3}`),ge(e)&&(Ae=`${n}/${E3}`,je.push(`${b[e.scope]}/`,`${n}/`));for(let t of q[W(e)]??[])ke.push(`${n}/${t.path}`),!Ae&&he(e,t.path)&&(Ae=`${n}/${t.path}`,je.push(`${b[e.scope]}/`,`${n}/`))}let Ne=new Set([...w.global,...w.project]),Pe=new Map,Fe=N??[];for(let e of Fe){if(Ne.has(e.name)||U3.has(e.name))continue;let t=$a(e.provenance.scope),n=Me.get(t);if(!n)continue;let r=Op(e.name);if(n.has(r)&&(r=e.name),n.has(r))continue;n.add(r);let i=`${b[t]}/${r}`;Pe.set(i,e),ke.push(`${i}/${E3}`),!Ae&&s===ta(e.name)&&(Ae=`${i}/${E3}`,je.push(`${b[t]}/`,`${i}/`));let a=I[_e(e)]??[];for(let e of a)ke.push(`${i}/${e}`);a.length>0&&je.push(`${i}/`)}for(let e of Ap)Me.get(e)?.size===0&&ke.push(`${b[e]}/${O3}`);let Ie=new Set;for(let e of Ap)Ie.add(`${b[e]}/`);for(let e of De.keys())Ie.add(`${e}/`);for(let e of Pe.keys())Ie.add(`${e}/`);for(let e of T)Ie.has(e)&&je.push(e);let Le=D3(Ce,Pe),Re;t[61]===C?Re=t[62]:(Re=C.map(K3).join(``),t[61]=C,t[62]=Re);let ze=`${Re}|d${Pe.size}`,Be=a.status===`loading`||J,Ve;t[63]===C?Ve=t[64]:(Ve=C.some(G3),t[63]=C,t[64]=Ve);let He;t[65]===Ve?He=t[66]:(He=(0,Z.jsx)($3,{hasProjectSkills:Ve}),t[65]=Ve,t[66]=He);let Ue;t[67]===Be?Ue=t[68]:(Ue=Be?(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)(xd,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`VeVIIk`})]}):null,t[67]=Be,t[68]=Ue);let We;t[69]===M?We=t[70]:(We=e=>M(e),t[69]=M,t[70]=We);let Ge;t[71]===A?Ge=t[72]:(Ge=(e,t)=>A({scope:e,tab:t}),t[71]=A,t[72]=Ge);let Ke;t[73]!==D||t[74]!==O||t[75]!==w||t[76]!==j||t[77]!==M?(Ke=j===null?null:(0,Z.jsx)(u3,{open:!0,scope:j,existingNames:w[j],busy:O,onOpenChange:e=>{e||M(null)},onCreate:e=>{let{name:t,description:n}=e,r=j;M(null),D(r,{name:t,description:n})}}),t[73]=D,t[74]=O,t[75]=w,t[76]=j,t[77]=M,t[78]=Ke):Ke=t[78];let qe;return t[79]!==k||t[80]!==g||t[81]!==A?(qe=k===null?null:(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(H3,{defaultScope:k.scope,defaultTab:k.tab,open:!0,onOpenChange:e=>{e||A(null)},onImported:e=>{let{scope:t,name:n}=e;A(null),g(t,n)}})}),t[79]=k,t[80]=g,t[81]=A,t[82]=qe):qe=t[82],(0,Z.jsxs)(MI,{className:`px-0`,children:[(0,Z.jsxs)(PI,{children:[He,Ue,(0,Z.jsx)(P3,{paths:ke,activePath:Ae,initialExpandedPaths:je,onExpandedChange:E,sort:Le,skillByPrefix:De,detectedByPrefix:Pe,labelToScope:Ce,scopeDescription:x,existingNames:w,actions:v,onOpenSkillMd:ce,onOpenFile:me,onOpenDetected:xe,onOpenManaged:fe,onNewSkill:We,onAddSkill:Ge},`${ke.join(`|`)}::${ze}`)]}),Ke,v.dialogs,qe]})}function G3(e){return e.scope===`project`&&!e.managed}function K3(e){return`${+!!e.installed}`}function q3(e){return[e,new Set]}function J3(e){return e.relPath}function Y3(e){return`${$a(e.provenance.scope)}::${e.name}`}function X3(e){console.error(`[skills-sidebar] unexpected error loading skill bundle files`,e)}function Z3(e){let[t,n,r]=e.split(`:`);return em(t,n,r||void 0).then(t=>(t.ok||console.warn(`[skills-sidebar] failed to load bundle files for ${e}:`,t.error),[e,t.ok?t.files:[]]))}function Q3(){return new Set}function $3(e){let t=(0,$.c)(12),{hasProjectSkills:n}=e,{_:r}=on(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),c,l;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=window.okDesktop?.sharing;if(!e)return;let t=!1,n=()=>{e.status().then(e=>{t||a(e.mode===`local-only`&&!e.skillsShared)}).catch(e6)};return n(),window.addEventListener(`focus`,n),()=>{t=!0,window.removeEventListener(`focus`,n)}},l=[],t[0]=c,t[1]=l):(c=t[0],l=t[1]),(0,Q.useEffect)(c,l),!n||i!==!0)return null;let u;t[2]!==r||t[3]!==o?(u=async()=>{let e=window.okDesktop?.sharing;if(!e||o)return;s(!0);let t=null,n=null;try{t=await e.setSkillsShared(!0)}catch(e){n=e}if(s(!1),n!==null){let e=n instanceof Error?n.message:``;Ns.error(e.startsWith(`ok:sharing:dispatch:`)?r({id:`qXN416`}):e||r({id:`K2v7QF`}));return}if(t!==null){if(t.kind===`applied`)Ns.success(r({id:`Q7cNKe`})),a(!1);else if(t.kind===`no-exclude`){let e=t.reason===`no-git`?r({id:`Xwump4`}):t.reason===`inaccessible`?r({id:`PlGC6r`}):r({id:`zcmYx4`});Ns.warning(r({id:`EARn6h`,values:{detail:e}}))}}},t[2]=r,t[3]=o,t[4]=u):u=t[4];let d=u,f;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`p`,{className:`mb-2 text-amber-900 dark:text-amber-200`,children:(0,Z.jsx)(Y,{id:`Bh9671`})}),t[5]=f):f=t[5];let p;t[6]===d?p=t[7]:(p=()=>void d(),t[6]=d,t[7]=p);let m;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(Y,{id:`TUzThQ`}),t[8]=m):m=t[8];let h;return t[9]!==o||t[10]!==p?(h=(0,Z.jsxs)(`div`,{className:`mx-2 mb-1 rounded-md border border-amber-300 bg-amber-50 p-2 text-xs dark:border-amber-700 dark:bg-amber-950`,children:[f,(0,Z.jsx)(X,{size:`sm`,className:`h-6 px-2 text-xs`,disabled:o,onClick:p,children:m})]}),t[9]=o,t[10]=p,t[11]=h):h=t[11],h}function e6(e){console.warn(JSON.stringify({event:`skills-share-status-read-failed`,error:e instanceof Error?e.message:String(e)}))}var t6=`ok-skills-section-visible-v1`;function n6(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}var r6;function i6(){if(r6===void 0){let e=n6()?.getItem(t6)??null;r6=e===`true`?!0:e===`false`?!1:null}return r6}function a6(e){if(r6!==e){r6=e;try{n6()?.setItem(t6,e?`true`:`false`)}catch{}}}var o6=6e4,s6=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=>um(e,n),o=e=>um(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 c6(e){let t=(0,$.c)(34),{version:n,onOpenReleaseNotes:r,onClose:i,store:a,autoDismissMs:o}=e,s=a===void 0?cV:a,c=o===void 0?o6:o,{_:l}=on(),[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)(LB,{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)(s6,{href:QB,label:l({id:`I7Exsw`}),icon:dV}),(0,Z.jsx)(s6,{href:XB,label:l({id:`zyKa-I`}),icon:Qy}),(0,Z.jsx)(s6,{href:ZB,label:l({id:`36aWJD`}),icon:uV})]}),t[16]=l,t[17]=u,t[18]=y):y=t[18];let b;t[19]!==y||t[20]!==v?(b=(0,Z.jsxs)(mH,{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)(hH,{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)(pH,{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 l6(e){let t=(0,$.c)(37),{notice:n,onDismiss:r}=e,{_:i}=on(),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)(hf,{"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 u6(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 d6(){let e=(0,$.c)(15),t=(0,Q.useSyncExternalStore)(XH,YH,YH),n;e[0]===t?n=e[1]:(n=u6(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=()=>JH(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)(c6,{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?.(),JH(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)(l6,{notice:r,onDismiss:i})}),e[12]=r,e[13]=i,e[14]=a):a=e[14],a}var f6={folderCount:0,expandedCount:0},p6=`button, [role="button"], [role="menuitem"], input, textarea, select, a[href]`;function m6(e){return typeof Element>`u`||!(e instanceof Element)?!1:e.closest(p6)!==null}function h6(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(bp,{name:`file-sidebar`,children:(0,Z.jsx)(_6,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var g6=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)(sr,{asChild:!0,children:(0,Z.jsx)(hi,{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)(cr,{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 _6(e){let t=(0,$.c)(239),{onOpenSearch:n}=e,{_:r}=on(),[i,a]=(0,Q.useState)(null),{activeDocName:o,activeTarget:s,skillFocused:c}=Oe(),l;t[0]!==o||t[1]!==s?(l=s?.kind===`folder`||s?.kind===`folder-index`?s.folderPath:Kf(o),t[0]=o,t[1]=s,t[2]=l):l=t[2];let u=l,d;t[3]===u?d=t[4]:(d=Yf(u)?``:u,t[3]=u,t[4]=d);let f=d,[p,m]=(0,Q.useState)(!1),h=p?``:f,g=typeof window<`u`&&window.okDesktop!=null,{state:_,toggleSidebar:v}=xI(),y=tn(),b=_===`expanded`,x=g&&_===`collapsed`,[S,C]=(0,Q.useState)(f6),w,T;t[5]===i?(w=t[6],T=t[7]):(w=()=>{if(i===null)return;let e=()=>{C(i.getFolderState()),m(i.isCreationTargetCleared())};return e(),i.subscribe(e)},T=[i],t[5]=i,t[6]=w,t[7]=T),(0,Q.useEffect)(w,T);let E,D;t[8]===i?(E=t[9],D=t[10]):(E=()=>{if(i!==null)return tD(e=>{let t=e.initialDir??``;if(e.template){i.createFromTemplate(e.template.folder,e.template.name);return}i.startCreating(e.kind??`file`,t)})},D=[i],t[8]=i,t[9]=E,t[10]=D),(0,Q.useEffect)(E,D);let O=S.folderCount>0,k=O&&S.expandedCount===S.folderCount,A=S.expandedCount===0,j=Wu(``),M=Wu(h===``?null:h),N=h===``?j:M,P=j.state.status===`ready`?(j.state.data.folder.templates_available?.length??0)>0:!0,F=N.state.status===`ready`?(N.state.data.folder.templates_available?.length??0)>0:!0,I=typeof window<`u`?window.okDesktop:void 0,L=Zc(),R;t[11]!==r||t[12]!==L?.contentDir?(R=I?.config?.projectName||L?.contentDir.split(`/`).filter(Boolean).pop()||r({id:`sER-bs`}),t[11]=r,t[12]=L?.contentDir,t[13]=R):R=t[13];let z=R,{status:B}=nl(),V=B?.hasRemote===!0,H=qn().states,{dispatch:U}=Tc(),W;t[14]===L?W=t[15]:(W=qc({workspace:L}),t[14]=L,t[15]=W);let ee=W,{projectLocalBinding:G,merged:K}=xc(),q=K?.appearance?.sidebar?.showHiddenFiles??!1,te=K?.appearance?.sidebar?.showOkFolders??!1,J=K?.appearance?.sidebar?.showOnlyMarkdownFiles??!1,ne=K?.appearance?.sidebar?.showSkillsSection,re;t[16]===ne?re=t[17]:(re=ne??i6()??!0,t[16]=ne,t[17]=re);let ie=re,ae,oe;t[18]===ne?(ae=t[19],oe=t[20]):(ae=()=>{ne!==void 0&&a6(ne)},oe=[ne],t[18]=ne,t[19]=ae,t[20]=oe),(0,Q.useEffect)(ae,oe);let se=c&&ie,ce=O&&!k,le=O&&!A,ue=ce||le,de=(0,Q.useRef)(!1),fe;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(fe=e=>{de.current&&(de.current=!1,e.preventDefault())},t[21]=fe):fe=t[21];let pe=fe,me;t[22]===se?me=t[23]:(me=e=>{if(se){e.preventDefault(),e.stopPropagation();return}e.target instanceof Element&&e.target.closest(`[data-sidebar-root-context]`)!==null||m6(e.target)&&(e.preventDefault(),e.stopPropagation())},t[22]=se,t[23]=me);let he=me,ge;t[24]!==i||t[25]!==L?(ge=()=>{L&&(de.current=!0,i?.startCreating(`file`,``))},t[24]=i,t[25]=L,t[26]=ge):ge=t[26];let _e=ge,ve;t[27]!==i||t[28]!==L?(ve=e=>{L&&(de.current=!0,i?.createFromTemplate(``,e))},t[27]=i,t[28]=L,t[29]=ve):ve=t[29];let ye=ve,be;t[30]!==i||t[31]!==L?(be=()=>{L&&(de.current=!0,i?.startCreating(`folder`,``))},t[30]=i,t[31]=L,t[32]=be):be=t[32];let xe=be,Se;t[33]===L?Se=t[34]:(Se=()=>{!L||!I||I.shell.showItemInFolder(L.contentDir)},t[33]=L,t[34]=Se);let Ce=Se,we;t[35]!==r||t[36]!==L?(we=async()=>{if(L)try{await navigator.clipboard.writeText(L.contentDir),Ns.success(r({id:`6_ZOw4`}),{description:L.contentDir})}catch(e){console.warn(`[FileSidebar] clipboard write failed:`,e),Ns.error(r({id:`vfRlCI`}))}},t[35]=r,t[36]=L,t[37]=we):we=t[37];let Te=we,Ee;t[38]!==r||t[39]!==V?(Ee=()=>{Xu({...$u(``),hasRemote:V,onClickWhenNoRemote:()=>{Ns.error(r({id:`WyQxwa`}))}},{clipboardWrite:nh,toastSuccess:x6,toastError:b6,logEvent:y6})},t[38]=r,t[39]=V,t[40]=Ee):Ee=t[40];let De=Ee,ke;t[41]!==r||t[42]!==G?(ke=e=>{if(G===null)return;let t=G.patch({appearance:{sidebar:e}});t.ok||(console.warn(`[FileSidebar] sidebar visibility toggle rejected:`,Ca(t.error)),Ns.error(r({id:`P47EWZ`}),{description:Ca(t.error)}))},t[41]=r,t[42]=G,t[43]=ke):ke=t[43];let Ae=ke,je;t[44]===i?je=t[45]:(je=()=>{i?.expandAll()},t[44]=i,t[45]=je);let Me=je,Ne;t[46]===i?Ne=t[47]:(Ne=()=>{i?.collapseAll()},t[46]=i,t[47]=Ne);let Pe=Ne,Fe,Ie;t[48]!==le||t[49]!==ce||t[50]!==q||t[51]!==te||t[52]!==J||t[53]!==ie||t[54]!==_?(Fe=()=>{let e={showHiddenFiles:q,showOkFolders:te,showOnlyMarkdownFiles:J,showSkillsSection:ie,canExpandAll:ce,canCollapseAll:le,sidebarVisible:_===`expanded`};Js(e),I&&I.editor.notifyViewMenuStateChanged(e)},Ie=[I,q,te,J,ie,ce,le,_],t[48]=le,t[49]=ce,t[50]=q,t[51]=te,t[52]=J,t[53]=ie,t[54]=_,t[55]=Fe,t[56]=Ie):(Fe=t[55],Ie=t[56]),(0,Q.useEffect)(Fe,Ie);let Le;t[57]!==r||t[58]!==s||t[59]!==U||t[60]!==H||t[61]!==h||t[62]!==Ae||t[63]!==q||t[64]!==te||t[65]!==J||t[66]!==ie||t[67]!==v||t[68]!==i||t[69]!==L?(Le=()=>Fn(e=>{let t=s!==null&&Yf(vL(s));switch(e){case`new-doc`:if(!L||!i)return;i.startCreating(`file`,h);return;case`new-folder`:if(!L||!i)return;i.startCreating(`folder`,h);return;case`new-from-template`:if(!L||!i)return;i.startCreatingFromTemplate(h);return;case`rename`:if(!s||t)return;OL(s);return;case`duplicate`:if(!s||t)return;AL(s);return;case`move-to-trash`:if(!s||t)return;EL(s);return;case`reveal-in-finder`:{if(!I||!L)return;let e=_L(s,L);I.shell.showItemInFolder(e);return}case`send-to-ai`:{let e=Wi.filter(e=>H[e.id]?.installed===!0);if(e.length===0){Ns.error(r({id:`LKOLNn`}));return}let t=yL(s,L);if(!t)return;let[n]=e;if(!n)return;U(n.id,t);return}case`copy-full-path`:{if(!L)return;let e=_L(s,L);navigator.clipboard.writeText(e).then(()=>Ns.success(r({id:`6_ZOw4`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),Ns.error(r({id:`vfRlCI`}))});return}case`copy-relative-path`:{let e=vL(s);if(e===``){Ns.error(r({id:`74eHt-`}));return}navigator.clipboard.writeText(e).then(()=>Ns.success(r({id:`haHgQj`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),Ns.error(r({id:`5QGTaA`}))});return}case`toggle-show-ok-folders`:Ae({showOkFolders:!te});return;case`toggle-show-hidden-files`:Ae({showHiddenFiles:!q});return;case`toggle-show-only-markdown-files`:Ae({showOnlyMarkdownFiles:!J});return;case`toggle-show-skills-section`:Ae({showSkillsSection:!ie});return;case`expand-all-tree`:i?.expandAll();return;case`collapse-all-tree`:i?.collapseAll();return;case`toggle-sidebar`:v();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]=U,t[60]=H,t[61]=h,t[62]=Ae,t[63]=q,t[64]=te,t[65]=J,t[66]=ie,t[67]=v,t[68]=i,t[69]=L,t[70]=Le):Le=t[70];let Re;t[71]!==r||t[72]!==s||t[73]!==U||t[74]!==H||t[75]!==h||t[76]!==G||t[77]!==q||t[78]!==te||t[79]!==J||t[80]!==ie||t[81]!==v||t[82]!==i||t[83]!==L?(Re=[I,i,L,s,h,G,q,te,J,ie,H,U,v,r],t[71]=r,t[72]=s,t[73]=U,t[74]=H,t[75]=h,t[76]=G,t[77]=q,t[78]=te,t[79]=J,t[80]=ie,t[81]=v,t[82]=i,t[83]=L,t[84]=Re):Re=t[84],(0,Q.useEffect)(Le,Re);let ze=g&&b&&`motion-safe:delay-100`,Be=x&&`opacity-0`,Ve;t[85]!==ze||t[86]!==Be?(Ve=Bn(`flex-row h-12 items-center py-0 pl-3 pr-2`,`justify-between`,g&&`overflow-x-clip`,g&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,ze,Be,g&&`[-webkit-app-region:drag]`),t[85]=ze,t[86]=Be,t[87]=Ve):Ve=t[87];let He;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(He=g?(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[88]=He):He=t[88];let Ue;t[89]===b?Ue=t[90]:(Ue=b&&!g?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:(0,Z.jsx)(Y,{id:`sER-bs`})}):null,t[89]=b,t[90]=Ue);let We;t[91]===b?We=t[92]:(We=g&&b?(0,Z.jsx)(AV,{}):null,t[91]=b,t[92]=We);let Ge;t[93]!==Ve||t[94]!==Ue||t[95]!==We?(Ge=(0,Z.jsxs)(kI,{"data-electron-drag":g?``:void 0,className:Ve,children:[He,Ue,We]}),t[93]=Ve,t[94]=Ue,t[95]=We,t[96]=Ge):Ge=t[96];let Ke=g&&b&&`motion-safe:delay-100`,qe=x&&`opacity-0`,Je;t[97]!==Ke||t[98]!==qe?(Je=Bn(`flex items-center gap-2 px-2 pb-0.5`,g&&`[-webkit-app-region:no-drag]`,g&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Ke,qe),t[97]=Ke,t[98]=qe,t[99]=Je):Je=t[99];let Ye;t[100]!==ie||t[101]!==c?(Ye=ie?(0,Z.jsx)(MU,{active:c?`skills`:`files`}):null,t[100]=ie,t[101]=c,t[102]=Ye):Ye=t[102];let Xe;t[103]===_?Xe=t[104]:(Xe=[_],t[103]=_,t[104]=Xe);let Ze;t[105]===n?Ze=t[106]:(Ze=(0,Z.jsx)(s3,{onClick:n,className:`ml-auto`}),t[105]=n,t[106]=Ze);let Qe;t[107]!==Xe||t[108]!==Ze?(Qe=(0,Z.jsx)(Pn,{fallbackRender:v6,onError:o3,resetKeys:Xe,children:Ze}),t[107]=Xe,t[108]=Ze,t[109]=Qe):Qe=t[109];let $e;t[110]!==Je||t[111]!==Ye||t[112]!==Qe?($e=(0,Z.jsxs)(`div`,{className:Je,children:[Ye,Qe]}),t[110]=Je,t[111]=Ye,t[112]=Qe,t[113]=$e):$e=t[113];let et;t[114]===Symbol.for(`react.memo_cache_sentinel`)?(et=(0,Z.jsx)(dH,{}),t[114]=et):et=t[114];let tt;t[115]!==ie||t[116]!==c?(tt=ie?(0,Z.jsx)(W3,{skillsMode:c}):null,t[115]=ie,t[116]=c,t[117]=tt):tt=t[117];let nt;t[118]!==r||t[119]!==F||t[120]!==h||t[121]!==Ae||t[122]!==G||t[123]!==z||t[124]!==le||t[125]!==ce||t[126]!==q||t[127]!==te||t[128]!==J||t[129]!==ie||t[130]!==ue||t[131]!==se||t[132]!==i?(nt=se?null:(0,Z.jsx)(pr,{defaultOpen:!0,className:`group/files flex min-h-0 flex-col data-[state=open]:min-h-48 data-[state=open]:flex-1`,children:(0,Z.jsxs)(MI,{className:`min-h-0 flex-1 px-0`,children:[(0,Z.jsxs)(NI,{className:`shrink-0 gap-1`,children:[(0,Z.jsxs)(fr,{"data-sidebar-root-context":!0,className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,Z.jsx)(Hl,{className:`size-4 shrink-0 text-tree-muted transition-transform group-data-[state=open]/files:rotate-90`}),(0,Z.jsx)(`span`,{className:`truncate text-sm font-normal text-muted-foreground`,children:z})]}),(0,Z.jsxs)(`div`,{role:`group`,"aria-label":r({id:`eaHUxx`}),"data-testid":`sidebar-toolbar`,className:Bn(`flex items-center gap-0.5`,g&&`[&>*]:[-webkit-app-region:no-drag]`),children:[se?null:(0,Z.jsxs)(xi,{children:[(0,Z.jsx)(g6,{icon:Uv,label:r({id:`Rq1vFD`})}),(0,Z.jsxs)(yi,{align:`end`,className:`min-w-52`,"data-testid":`tree-options-menu`,children:[ce?(0,Z.jsxs)(li,{onSelect:()=>i?.expandAll(),children:[(0,Z.jsx)(wy,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`OlAl5i`})]}):null,le?(0,Z.jsxs)(li,{onSelect:()=>i?.collapseAll(),children:[(0,Z.jsx)(Mv,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`qvWGzP`})]}):null,ue?(0,Z.jsx)(Si,{}):null,(0,Z.jsxs)(pi,{"aria-label":r({id:`8vETh9`}),children:[(0,Z.jsx)(_i,{children:(0,Z.jsx)(Y,{id:`8vETh9`})}),(0,Z.jsx)(gi,{checked:q,onCheckedChange:e=>Ae({showHiddenFiles:e}),disabled:G===null,"data-testid":`tree-options-show-hidden-files`,children:(0,Z.jsx)(Y,{id:`6KCH4m`})}),(0,Z.jsx)(gi,{checked:te,onCheckedChange:e=>Ae({showOkFolders:e}),disabled:G===null,"data-testid":`tree-options-show-ok-folders`,children:(0,Z.jsx)(Y,{id:`ELYtNJ`})}),(0,Z.jsx)(gi,{checked:J,onCheckedChange:e=>Ae({showOnlyMarkdownFiles:e}),disabled:G===null,"data-testid":`tree-options-show-only-markdown-files`,children:(0,Z.jsx)(Y,{id:`5-o4kO`})}),(0,Z.jsx)(gi,{checked:ie,onCheckedChange:e=>Ae({showSkillsSection:e}),disabled:G===null,"data-testid":`tree-options-show-skills`,children:(0,Z.jsx)(Y,{id:`PCSkw2`})})]})]})]}),se?null:(0,Z.jsx)(l3,{icon:df,label:r({id:`HdkSiO`}),onClick:()=>i?.startCreating(`file`,h),shortcutId:`new-item`}),!se&&F?(0,Z.jsxs)(xi,{children:[(0,Z.jsx)(g6,{icon:Kn,label:r({id:`Uuj_R4`})}),(0,Z.jsx)(yi,{align:`end`,className:`min-w-52`,onCloseAutoFocus:pe,children:(0,Z.jsx)(gL,{parentDir:h,onSelectTemplate:e=>{de.current=!0,i?.createFromTemplate(h,e)},ItemComponent:li})})]}):null,se?null:(0,Z.jsx)(l3,{icon:Pv,label:r({id:`96G6Re`}),onClick:()=>i?.startCreating(`folder`,h),shortcutId:g?`new-folder`:void 0})]})]}),(0,Z.jsx)(dr,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:(0,Z.jsx)(P2,{ref:a})})]})}),t[118]=r,t[119]=F,t[120]=h,t[121]=Ae,t[122]=G,t[123]=z,t[124]=le,t[125]=ce,t[126]=q,t[127]=te,t[128]=J,t[129]=ie,t[130]=ue,t[131]=se,t[132]=i,t[133]=nt):nt=t[133];let rt;t[134]!==tt||t[135]!==nt?(rt=(0,Z.jsxs)(jI,{children:[et,tt,nt]}),t[134]=tt,t[135]=nt,t[136]=rt):rt=t[136];let it;t[137]===Symbol.for(`react.memo_cache_sentinel`)?(it=(0,Z.jsxs)(AI,{className:`px-0`,children:[(0,Z.jsx)(O4,{}),(0,Z.jsx)(d6,{}),(0,Z.jsx)(AU,{}),typeof window<`u`&&window.okDesktop?(0,Z.jsx)(FI,{children:(0,Z.jsx)(II,{children:(0,Z.jsx)(Z4,{bridge:window.okDesktop})})}):null]}),t[137]=it):it=t[137];let at=!(y&&_===`collapsed`),ot;t[138]===at?ot=t[139]:(ot=(0,Z.jsx)(DI,{enableToggle:!1,enableDrag:at}),t[138]=at,t[139]=ot);let st;t[140]!==he||t[141]!==Ge||t[142]!==$e||t[143]!==rt||t[144]!==ot?(st=(0,Z.jsx)(ti,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`contents`,onContextMenu:he,children:[Ge,$e,rt,it,ot]})}),t[140]=he,t[141]=Ge,t[142]=$e,t[143]=rt,t[144]=ot,t[145]=st):st=t[145];let ct=!L,lt,ut;t[146]===Symbol.for(`react.memo_cache_sentinel`)?(lt=(0,Z.jsx)(df,{"aria-hidden":`true`}),ut=(0,Z.jsx)(Y,{id:`HdkSiO`}),t[146]=lt,t[147]=ut):(lt=t[146],ut=t[147]);let dt;t[148]!==_e||t[149]!==ct?(dt=(0,Z.jsxs)($r,{disabled:ct,onSelect:_e,"data-testid":`empty-space-menu-new-file`,children:[lt,ut]}),t[148]=_e,t[149]=ct,t[150]=dt):dt=t[150];let ft;t[151]!==ye||t[152]!==P||t[153]!==L?(ft=P?(0,Z.jsxs)(ei,{children:[(0,Z.jsxs)(ci,{disabled:!L,"data-testid":`empty-space-menu-new-from-template`,children:[(0,Z.jsx)(Kn,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`Uuj_R4`})]}),(0,Z.jsx)(ri,{children:(0,Z.jsx)(gL,{parentDir:``,onSelectTemplate:ye,ItemComponent:$r})})]}):null,t[151]=ye,t[152]=P,t[153]=L,t[154]=ft):ft=t[154];let pt=!L,mt,ht;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(mt=(0,Z.jsx)(Pv,{"aria-hidden":`true`}),ht=(0,Z.jsx)(Y,{id:`96G6Re`}),t[155]=mt,t[156]=ht):(mt=t[155],ht=t[156]);let gt;t[157]!==xe||t[158]!==pt?(gt=(0,Z.jsxs)($r,{disabled:pt,onSelect:xe,"data-testid":`empty-space-menu-new-folder`,children:[mt,ht]}),t[157]=xe,t[158]=pt,t[159]=gt):gt=t[159];let _t;t[160]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,Z.jsx)(oi,{}),t[160]=_t):_t=t[160];let vt;t[161]!==r||t[162]!==Ce||t[163]!==L?(vt=I?(0,Z.jsxs)($r,{disabled:!L,onSelect:Ce,"data-testid":`empty-space-menu-reveal-in-finder`,"aria-label":L?tg(I.platform):r({id:`NcUznW`,values:{0:tg(I.platform)}}),children:[(0,Z.jsx)(hd,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:tg(I.platform)}),L?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[161]=r,t[162]=Ce,t[163]=L,t[164]=vt):vt=t[164];let yt;t[165]!==U||t[166]!==ee||t[167]!==H?(yt=(0,Z.jsx)(Ic,{input:ee,installStates:H,dispatch:U}),t[165]=U,t[166]=ee,t[167]=H,t[168]=yt):yt=t[168];let bt;t[169]!==De||t[170]!==V?(bt=V?(0,Z.jsxs)($r,{onSelect:De,"data-testid":`empty-space-menu-share`,children:[(0,Z.jsx)(ef,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`Z8lGw6`})]}):null,t[169]=De,t[170]=V,t[171]=bt):bt=t[171];let xt=!L,St;t[172]!==r||t[173]!==L?(St=r(L?{id:`Up2_7p`}:{id:`U8CD-l`}),t[172]=r,t[173]=L,t[174]=St):St=t[174];let Ct;t[175]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=(0,Z.jsx)(Cu,{"aria-hidden":`true`}),t[175]=Ct):Ct=t[175];let wt;t[176]===Symbol.for(`react.memo_cache_sentinel`)?(wt=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`Up2_7p`})}),t[176]=wt):wt=t[176];let Tt;t[177]===L?Tt=t[178]:(Tt=L?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`wTcjov`})}),t[177]=L,t[178]=Tt);let Et;t[179]!==Te||t[180]!==xt||t[181]!==St||t[182]!==Tt?(Et=(0,Z.jsxs)($r,{disabled:xt,onSelect:Te,"data-testid":`empty-space-menu-copy-full-path`,"aria-label":St,children:[Ct,wt,Tt]}),t[179]=Te,t[180]=xt,t[181]=St,t[182]=Tt,t[183]=Et):Et=t[183];let Dt;t[184]===Symbol.for(`react.memo_cache_sentinel`)?(Dt=(0,Z.jsx)(oi,{}),t[184]=Dt):Dt=t[184];let Ot;t[185]===Ae?Ot=t[186]:(Ot=e=>Ae({showHiddenFiles:e}),t[185]=Ae,t[186]=Ot);let kt=G===null,At;t[187]===Symbol.for(`react.memo_cache_sentinel`)?(At=(0,Z.jsx)(Y,{id:`XcGbim`}),t[187]=At):At=t[187];let jt;t[188]!==q||t[189]!==Ot||t[190]!==kt?(jt=(0,Z.jsx)(ii,{checked:q,onCheckedChange:Ot,disabled:kt,"data-testid":`empty-space-menu-show-hidden-files`,children:At}),t[188]=q,t[189]=Ot,t[190]=kt,t[191]=jt):jt=t[191];let Mt;t[192]===Ae?Mt=t[193]:(Mt=e=>Ae({showOkFolders:e}),t[192]=Ae,t[193]=Mt);let Nt=G===null,Pt;t[194]===Symbol.for(`react.memo_cache_sentinel`)?(Pt=(0,Z.jsx)(Y,{id:`GHsJb8`}),t[194]=Pt):Pt=t[194];let Ft;t[195]!==te||t[196]!==Mt||t[197]!==Nt?(Ft=(0,Z.jsx)(ii,{checked:te,onCheckedChange:Mt,disabled:Nt,"data-testid":`empty-space-menu-show-ok-folders`,children:Pt}),t[195]=te,t[196]=Mt,t[197]=Nt,t[198]=Ft):Ft=t[198];let It;t[199]===Ae?It=t[200]:(It=e=>Ae({showOnlyMarkdownFiles:e}),t[199]=Ae,t[200]=It);let Lt=G===null,Rt;t[201]===Symbol.for(`react.memo_cache_sentinel`)?(Rt=(0,Z.jsx)(Y,{id:`WkTLN7`}),t[201]=Rt):Rt=t[201];let zt;t[202]!==J||t[203]!==It||t[204]!==Lt?(zt=(0,Z.jsx)(ii,{checked:J,onCheckedChange:It,disabled:Lt,"data-testid":`empty-space-menu-show-only-markdown-files`,children:Rt}),t[202]=J,t[203]=It,t[204]=Lt,t[205]=zt):zt=t[205];let Bt;t[206]===Ae?Bt=t[207]:(Bt=e=>Ae({showSkillsSection:e}),t[206]=Ae,t[207]=Bt);let Vt=G===null,Ht;t[208]===Symbol.for(`react.memo_cache_sentinel`)?(Ht=(0,Z.jsx)(Y,{id:`WkyP2p`}),t[208]=Ht):Ht=t[208];let Ut;t[209]!==ie||t[210]!==Bt||t[211]!==Vt?(Ut=(0,Z.jsx)(ii,{checked:ie,onCheckedChange:Bt,disabled:Vt,"data-testid":`empty-space-menu-show-skills-section`,children:Ht}),t[209]=ie,t[210]=Bt,t[211]=Vt,t[212]=Ut):Ut=t[212];let Wt;t[213]===ue?Wt=t[214]:(Wt=ue?(0,Z.jsx)(oi,{}):null,t[213]=ue,t[214]=Wt);let Gt;t[215]!==Me||t[216]!==ce?(Gt=ce?(0,Z.jsxs)($r,{onSelect:Me,"data-testid":`empty-space-menu-expand-all`,children:[(0,Z.jsx)(wy,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`OlAl5i`})]}):null,t[215]=Me,t[216]=ce,t[217]=Gt):Gt=t[217];let Kt;t[218]!==Pe||t[219]!==le?(Kt=le?(0,Z.jsxs)($r,{onSelect:Pe,"data-testid":`empty-space-menu-collapse-all`,children:[(0,Z.jsx)(Mv,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`qvWGzP`})]}):null,t[218]=Pe,t[219]=le,t[220]=Kt):Kt=t[220];let qt;t[221]!==dt||t[222]!==ft||t[223]!==gt||t[224]!==vt||t[225]!==yt||t[226]!==bt||t[227]!==Et||t[228]!==jt||t[229]!==Ft||t[230]!==zt||t[231]!==Ut||t[232]!==Wt||t[233]!==Gt||t[234]!==Kt?(qt=(0,Z.jsxs)(ai,{className:`min-w-52`,onCloseAutoFocus:pe,children:[dt,ft,gt,_t,vt,yt,bt,Et,Dt,jt,Ft,zt,Ut,Wt,Gt,Kt]}),t[221]=dt,t[222]=ft,t[223]=gt,t[224]=vt,t[225]=yt,t[226]=bt,t[227]=Et,t[228]=jt,t[229]=Ft,t[230]=zt,t[231]=Ut,t[232]=Wt,t[233]=Gt,t[234]=Kt,t[235]=qt):qt=t[235];let Jt;return t[236]!==st||t[237]!==qt?(Jt=(0,Z.jsx)(TI,{variant:`inset`,children:(0,Z.jsxs)(si,{children:[st,qt]})}),t[236]=st,t[237]=qt,t[238]=Jt):Jt=t[238],Jt}function v6(){return null}function y6(e){return console.log(e)}function b6(e){return Ns.error(e)}function x6(e){return Ns.success(e)}var S6=(0,Q.lazy)(()=>n(()=>import(`./McpConsentDialogBody-D6qWh37S.js`),__vite__mapDeps([205,1,6,2,3,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,123,34,35,36,64,40,98,108,92,49,206,45]),import.meta.url));function C6(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(yg.subscribe,T6,w6))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)(S6,{})}),e[0]=t):t=e[0],t}function w6(){return!1}function T6(){return yg.getSnapshot()!==null}function E6(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(!1),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>Fn(e=>{e===`report-bug`&&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)($_,{open:t,onOpenChange:n}),e[2]=t,e[3]=a),a}function D6(){let e=(0,$.c)(17),t=xn(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=Oe(),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 Bp,i=new zp({url:n,name:Ya,document:e,onStateless:e=>{let{payload:t}=e;qp(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),Rs(e.docName)},onDerivedView:N6,onConfigValidationRejected:M6,onConfigIgnoreNestedError:j6,onUnknown:A6})},onClose:k6,onDisconnect:O6}),a=Ls(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`)&&Bm()}),o=ye(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{Fs([`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 O6(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function k6(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function A6(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function j6(e){Gu(e)}function M6(e){nd(e)}function N6(e){Fs([e.ch])}var P6=500,F6=750,I6=1200,L6=3,R6=1500;function z6(e){return!e.startsWith(`__`)&&!/\.(mmd|mermaid)$/i.test(e)}async function B6(e){let t=await au({kind:`project`},e);return e.aborted||t===null||t===`audit-superseded`?!1:(lu(t.files),!0)}function V6(){let e=(0,$.c)(13),{merged:t}=xc(),n=t?.validation?.fileTreeIndicators!==!1,r=t?.validation?.links!==`off`,i,a;e[0]===r?(i=e[1],a=e[2]):(i=()=>Pr(r),a=[r],e[0]=r,e[1]=i,e[2]=a),(0,Q.useLayoutEffect)(i,a);let o=ku()?.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=>{xu({kind:`doc`,docName:e}).then(n=>{t||n===null||n===`audit-superseded`||mu(e,n.files.filter(t=>Af(t.file)===e).flatMap(H6))})},i=Is(t=>{if(!z6(t))return;let n=e.get(t);n!==void 0&&clearTimeout(n),e.set(t,setTimeout(()=>{e.delete(t),r(t)},P6))});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,B6(e.signal).finally(()=>{t===e&&(t=null)})},i=()=>{e!==null&&clearTimeout(e),e=setTimeout(()=>{e=null,r()},F6)},a=[Lm(i),Us(i),Ls(e=>{zs(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,B6(e.signal).then(n=>{if(n){s.current=!0;return}if(!e.signal.aborted){if(r+=1,r>=L6){console.warn(`[audit] on-open audit exhausted retries; file-tree counts unavailable`);return}t=setTimeout(i,R6*2**(r-1))}})};return t=setTimeout(i,I6),()=>{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 H6(e){return e.diagnostics}function U6(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 W6(){let e=(0,$.c)(4),{collabUrl:t}=Oe(),{projectConfig:n}=xc(),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=vt(t);return U6({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 G6(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 K6(){let e=(0,$.c)(4),{collabUrl:t}=Oe(),{projectConfig:n}=xc(),r=n?.bridge?.flushOnHide?.enabled??!0,i,a;return e[0]!==t||e[1]!==r?(i=()=>{if(t===null)return;let e=vt(t);return e.setFlushOnHideEnabled(r),G6({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 q6=1e3,J6=3e4;function Y6(e){let t=e.scheduler??{setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e)},n=e.initialBackoffMs??q6,r=e.maxBackoffMs??J6,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 X6(e){if(e)return e.replace(/\/collab\/?$/,``)}function Z6(){return Jp(window)!==null}function Q6(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??Y6;if((i.current?.isElectronHost??Z6)())return;let t=e({resolveWsUrl:async()=>X6(r.current)});return()=>t.close()},c=[],n[3]=s,n[4]=c):(s=n[3],c=n[4]),(0,Q.useEffect)(s,c)}var $6=(0,Q.lazy)(()=>n(()=>import(`./ShareBranchSwitchDialog-BHZw8v-i.js`).then(e=>({default:e.ShareBranchSwitchDialog})),__vite__mapDeps([207,1,12,13,14,27,16,17,18,28,29,30,26,24,25,31,22,103,37,208,92,209,210,211,212,6,2,3,7,8,9,10,11,45]),import.meta.url)),e8=(0,Q.lazy)(()=>n(()=>import(`./ShareReceiveMissDialog-BVb9iCe7.js`).then(e=>({default:e.ShareReceiveMissDialog})),__vite__mapDeps([213,1,27,12,13,14,16,17,18,28,29,30,26,24,25,31,22,214,141,6,2,3,7,8,9,10,11,91,45,74,92,93,94,95,96,106,70,64,21,41,108,37,208,146,46,49,68]),import.meta.url)),t8=`#install-claude-desktop`,n8=/\.(md|mdx)$/i;function r8(e){return Ts(e)||e===t8}function i8(e,t){if(!n8.test(e))return null;for(let n of t){let t=_p(n);if(t.kind===`doc`&&t.docName===e)return{kind:`doc`,target:e,docName:e}}return null}function a8(e,t,n,r){return[e,t,n,r].map(e=>[...e].sort().join(`\0`)).join(``)}function o8(){let e=(0,$.c)(30),{activeTabId:t,activeTarget:n,clearTarget:r,openTabs:i,syncOpenTabsWithKnownTargets:a,tabSessionLoaded:o}=Oe(),{openTargetTransition:s}=bt();Hc();let{assetPaths:c,filePaths:l,folderPaths:u,loading:d,pageMeta:f,pages:p,pagesBySlug:m,pagesByBasename:h}=Eu(),g=(0,Q.useRef)(null),_;e[0]!==c||e[1]!==l||e[2]!==u||e[3]!==p?(_=a8(p,u,c,l),e[0]=c,e[1]=l,e[2]=u,e[3]=p,e[4]=_):_=e[4];let v=_,y;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(y=[],e[5]=y):y=e[5],(0,Q.useEffect)(s8,y);let b,x;e[6]!==c||e[7]!==l||e[8]!==u||e[9]!==d||e[10]!==p||e[11]!==a||e[12]!==o||e[13]!==v?(b=()=>{d||!o||g.current===v||(g.current=v,a({pages:p,folderPaths:u,assetPaths:c,filePaths:l}))},x=[c,l,u,d,p,a,o,v],e[6]=c,e[7]=l,e[8]=u,e[9]=d,e[10]=p,e[11]=a,e[12]=o,e[13]=v,e[14]=b,e[15]=x):(b=e[14],x=e[15]),(0,Q.useEffect)(b,x);let S,C;return e[16]!==t||e[17]!==n||e[18]!==r||e[19]!==u||e[20]!==d||e[21]!==i||e[22]!==s||e[23]!==f||e[24]!==p||e[25]!==h||e[26]!==m||e[27]!==o?(S=()=>{if(!o&&window.okDesktop?.config.mode===`editor`)return;e();function e(){Pf();let e=e=>{cp(e)===t&&n?.kind===e.kind&&n.target===e.target||s(e,{disposition:`permanent`,consumeActiveNewTab:!0})};if(r8(window.location.hash))return;let a=yf(window.location.hash);if(a){let t=Lo(a.split(`.`).pop()??``);yp(`ok/nav/hash-change`,{docName:null,kind:`asset`}),e({kind:`asset`,target:a,assetPath:a,mediaKind:t});return}let o=_f(window.location.hash);if(o){yp(`ok/nav/hash-change`,{docName:null,kind:`skill-file`}),e({kind:`skill-file`,target:`${o.scope}/${o.name}${o.host?`:${o.host}`:``}/${o.path}`,scope:o.scope,name:o.name,path:o.path,...o.host?{host:o.host}:{}});return}if(Mf(window.location.hash)){yp(`ok/nav/hash-change`,{docName:null,kind:`skills`}),s({kind:`skills`,target:`skills`});return}let c=gf(window.location.hash);if(c){yp(`ok/nav/hash-change`,{docName:null,kind:`skill-preview`}),s({kind:`skill-preview`,target:`${c.flavor}/${c.source}/${c.name}`,flavor:c.flavor,source:c.source,name:c.name,subtitle:c.subtitle,level:c.level,path:c.path});return}if(vf(window.location.hash)){yp(`ok/nav/hash-change`,{docName:null,kind:`folder`}),e({kind:`folder`,target:``,folderPath:``});return}let l=kf(window.location.hash);if(!l){yp(`ok/nav/hash-change`,{docName:null,kind:`clear`}),r();return}if(d){yp(`ok/nav/hash-change`,{docName:l,kind:`deferred-loading`});return}let g=i8(l,i)??hp(l,{pages:p,folderPaths:u,pagesBySlug:m,pagesByBasename:h});if(g.kind===`missing`&&/\/+$/.test(l.trim())){yp(`ok/nav/hash-change`,{docName:l,kind:`deferred-missing-folder`});return}let _=ip(mp(g),f);yp(`ok/nav/hash-change`,{docName:l,kind:_.kind}),e(_)}return window.addEventListener(`hashchange`,e),()=>{window.removeEventListener(`hashchange`,e)}},C=[t,n,r,u,d,s,i,f,p,m,h,o],e[16]=t,e[17]=n,e[18]=r,e[19]=u,e[20]=d,e[21]=i,e[22]=s,e[23]=f,e[24]=p,e[25]=h,e[26]=m,e[27]=o,e[28]=S,e[29]=C):(S=e[28],C=e[29]),(0,Q.useEffect)(S,C),null}function s8(){return Fn(c8)}function c8(e){e===`navigate-back`&&window.history.back(),e===`navigate-forward`&&window.history.forward()}function l8(){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)(u8,t),null}function u8(){let e=function(e){if(rr())return;let t=e.target;Ds({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=ks))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function d8(){let e=(0,$.c)(4),{activeTarget:t}=Oe(),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 f8(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=Oe(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:Kf(t),e[0]=t,e[1]=n,e[2]=a):a=e[2];let o=a,s,c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=function(e){if(rr())return;let t=e.target;ex({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,key:e.key})&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},c=[],e[3]=s,e[4]=c):(s=e[3],c=e[4]),(0,Q.useEffect)(s,c);let l;return e[5]!==r||e[6]!==o?(l=(0,Z.jsx)(nx,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function p8(e){let t=(0,$.c)(5),{children:n}=e,{collabUrl:r}=Oe();Q6(r);let i,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(K6,{}),a=(0,Z.jsx)(W6,{}),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)(Gp,{collabUrl:r,children:[i,a,n]}),t[2]=n,t[3]=r,t[4]=o):o=t[4],o}function m8(e){let t=(0,$.c)(6),{children:n}=e,{merged:r}=xc(),{promoteAllPreviewTabs:i}=Oe(),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 h8(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(bp,{name:`app`,children:(0,Z.jsx)(It,{children:(0,Z.jsx)(p8,{children:(0,Z.jsx)(m8,{children:(0,Z.jsx)(Zx,{children:(0,Z.jsx)(g8,{})})})})})}),e[0]=t):t=e[0],t}function g8(){let e=(0,$.c)(33),t=typeof window<`u`?window.okDesktop??null:null,n=typeof window<`u`&&window.okDesktop!=null,[r,i]=(0,Q.useState)(!1),a=eS(),o=Tm(),s;e[0]===o?s=e[1]:(s=t&&t.config.ptyAvailable===!0?{launchInTerminal:_8,installedClis:o}:null,e[0]=o,e[1]=s);let c=s,l;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(jS,{}),e[2]=l):l=e[2];let u,d,f,p,m;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(D6,{}),d=(0,Z.jsx)(V6,{}),f=(0,Z.jsx)(o8,{}),p=(0,Z.jsx)(d8,{}),m=(0,Z.jsx)(f8,{}),e[3]=u,e[4]=d,e[5]=f,e[6]=p,e[7]=m):(u=e[3],d=e[4],f=e[5],p=e[6],m=e[7]);let h;e[8]===a?h=e[9]:(h=!a&&(0,Z.jsx)(l8,{}),e[8]=a,e[9]=h);let g,_,v,y,b,x,S;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(x=!1,S=t?(0,Z.jsx)(MS,{bridge:t}):null,g=t?(0,Z.jsx)(BS,{}):null,_=t?(0,Z.jsx)(E6,{}):null,v=t?(0,Z.jsx)(lH,{}):null,y=(0,Z.jsx)(C6,{}),b=t?(0,Z.jsxs)(Q.Suspense,{fallback:null,children:[(0,Z.jsx)($6,{bridge:t}),(0,Z.jsx)(e8,{})]}):null,e[10]=g,e[11]=_,e[12]=v,e[13]=y,e[14]=b,e[15]=x,e[16]=S):(g=e[10],_=e[11],v=e[12],y=e[13],b=e[14],x=e[15],S=e[16]);let C;e[17]===r?C=e[18]:(C=(0,Z.jsx)(bS,{bridge:t,open:r,onOpenChange:i}),e[17]=r,e[18]=C);let w;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(w=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[19]=w):w=e[19];let T;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Fy,{}),e[20]=T):T=e[20];let E;e[21]===a?E=e[22]:(E=!a&&(0,Z.jsx)(h6,{onOpenSearch:()=>i(!0)}),e[21]=a,e[22]=E);let D;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(OI,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(QV,{onOpenSearch:()=>i(!0)})}),e[23]=D):D=e[23];let O;e[24]===E?O=e[25]:(O=(0,Z.jsxs)(SI,{className:`h-screen overflow-hidden`,children:[E,D]}),e[24]=E,e[25]=O);let k;e[26]!==O||e[27]!==c?(k=(0,Z.jsxs)($n,{value:c,children:[T,O]}),e[26]=O,e[27]=c,e[28]=k):k=e[28];let A;return e[29]!==C||e[30]!==k||e[31]!==h?(A=(0,Z.jsxs)(Z.Fragment,{children:[l,(0,Z.jsxs)(Du,{children:[u,d,f,p,m,h,x,S,g,_,v,y,b,C,w,k]})]}),e[29]=C,e[30]=k,e[31]=h,e[32]=A):A=e[32],A}function _8(e,t){mc(Ec(e,t),t)}function v8(e){let t=/\/([^/]+?)(?:\.git)?\/?$/.exec(e);return t?t[1]:`repo`}function y8(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=v8(t),a=`${r.replace(/\/$/,``)}/${i}`,o=Ns.loading(Ms._({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);Ns.loading(Ms._({id:`GXf9hG`,values:{repoName:i}}),{id:o,description:Ms._({id:`SCzAbA`,values:{phase:t,pct:n}}),duration:1/0});continue}if(e.type===`branch-fallback`){console.log(xg({branch_action:`fallback`,branch:e.branch})),Ns.info(Ms._({id:`3JYy1p`,values:{0:e.branch}}),{duration:8e3});continue}if(e.type===`complete`)return Ns.success(Ms._({id:`IRv9cH`,values:{repoName:i}}),{id:o,duration:4e3}),{kind:`ok`,dir:e.dir};if(e.type===`error`)return Ns.dismiss(o),{kind:`error`,detail:e.message}}return Ns.dismiss(o),{kind:`error`,detail:Ms._({id:`PZt2Ds`})}}catch(e){console.warn(`[clone-controller] clone transport threw`,e);let t=e instanceof Error?e.message:Ms._({id:`29VNqC`});return Ns.dismiss(o),{kind:`error`,detail:t}}}}}function b8(){return{start(e){return Iu((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=Ms._({id:`ZSoojc`,values:{status:e}});try{let e=await r.json(),t=gs.safeParse(e);if(t.success){let e=t.data.title;n=Ms._({id:`OsSaYm`,values:{title:e}})}}catch{}t({type:`error`,message:n});return}if(!r.body){t({type:`error`,message:Ms._({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(`
2095
- `);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||Ms._({id:`29VNqC`})});break}t(n)}if(n.aborted)break}n.aborted||t({type:`error`,message:Ms._({id:`Tz9pJB`})})}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;t({type:`error`,message:Ms._({id:`K9J00P`})})}})()})}}}function x8(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 S8(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 C8(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 w8(e){let t=(0,$.c)(100),{open:n,onOpenChange:r,onSignIn:i,onCloneComplete:a,transport:o,authQueryTransport:s,pickParentFolder:c,initialUrl:l}=e,{_:u}=on(),d;t[0]===o?d=t[1]:(d=o??b8(),t[0]=o,t[1]=d);let f=d,p;t[2]===s?p=t[3]:(p=s??Lu(),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=rd(),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=>{ed(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,H;t[17]!==l||t[18]!==n||t[19]!==h?(V=()=>{if(!n||!l||(_(l),h))return;let e=C8(l);e&&y(`~/Documents/${e}`)},H=[n,l,h],t[17]=l,t[18]=n,t[19]=h,t[20]=V,t[21]=H):(V=t[20],H=t[21]),(0,Q.useEffect)(V,H);let U,W;t[22]!==j||t[23]!==I?(U=()=>{j<0||document.getElementById(`${I}-opt-${j}`)?.scrollIntoView({block:`nearest`})},W=[j,I],t[22]=j,t[23]=I,t[24]=U,t[25]=W):(U=t[24],W=t[25]),(0,Q.useEffect)(U,W);let ee;t[26]===h?ee=t[27]:(ee=function(e){if(_(e),A(!0),M(-1),h)return;let t=C8(e);t&&y(`~/Documents/${t}`)},t[26]=h,t[27]=ee);let G=ee,K;t[28]===h?K=t[29]:(K=function(e){if(_(e.clone_url),h)return;let t=e.full_name.split(`/`)[1];y(`~/Documents/${t}`)},t[28]=h,t[29]=K);let q=K,te;t[30]!==u||t[31]!==v||t[32]!==a||t[33]!==r||t[34]!==c||t[35]!==f||t[36]!==g?(te=async function(){let e=g.trim();if(!e){Ns.error(u({id:`FTUGgh`}));return}let t=v||``;if(c){O(!0);let n=await c();if(!n){O(!1);return}let r=C8(e);t=`${n.replace(/\/$/,``)}/${r}`}else O(!0);let n=Ns.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(S8(i.phase));Ns.loading(`${e} — ${i.pct}%`,{id:n})}else if(i.type===`complete`){Ns.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;Ns.error(u({id:`eFJkVt`,values:{cloneError:e}}),{id:n}),O(!1),N.current=null;return}t=await e.next()}Ns.error(u({id:`Tz9pJB`}),{id:n}),O(!1),N.current=null}catch(e){console.error(`[CloneDialog] clone iteration failed:`,e),Ns.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]=te):te=t[37];let J=te,ne;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ne=function(){N.current?.(),N.current=null,O(!1),Ns.dismiss(P.current??void 0)},t[38]=ne):ne=t[38];let re=ne,ie;t[39]!==D||t[40]!==r||t[41]!==h?(ie=function(e){D||(r(e),e||(_(``),h||y(``),A(!1),M(-1)))},t[39]=D,t[40]=r,t[41]=h,t[42]=ie):ie=t[42];let ae=ie,oe;t[43]===q?oe=t[44]:(oe=function(e){q(e),A(!1),M(-1),F.current?.focus()},t[43]=q,t[44]=oe);let se=oe,ce=T===null||S&&b===null,le;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),le=n.filter(t=>`${t.full_name} ${t.clone_url}`.toLowerCase().includes(e)),t[45]=b,t[46]=g,t[47]=le}else le=t[47];let ue=le,de;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(de=/:\/\/|^git@|\.git$/i,t[50]=de):de=t[50];let fe;t[51]===g?fe=t[52]:(fe=de.test(g.trim()),t[51]=g,t[52]=fe);let pe=fe,me=T===!0&&b!==null&&ue.length===0&&!pe,he=k&&T!==!1&&!D&&(ce||ue.length>0||me),ge=ue.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]!==se||t[60]!==ue?(be=function(e){if(!D)if(e.key===`ArrowDown`){if(e.preventDefault(),!he){A(!0);return}M(e=>Math.min(e+1,ue.length-1))}else e.key===`ArrowUp`?(e.preventDefault(),M(A8)):e.key===`Enter`?he&&j>=0&&j<ue.length&&(e.preventDefault(),se(ue[j])):e.key===`Escape`&&he&&(e.preventDefault(),e.stopPropagation(),A(!1),M(-1))},t[56]=j,t[57]=D,t[58]=he,t[59]=se,t[60]=ue,t[61]=be):be=t[61];let xe=be,Se;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsx)(yr,{children:(0,Z.jsx)(hr,{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]!==ce||t[75]!==b||t[76]!==se||t[77]!==ue||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)(zf,{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)(Ln,{open:he,onOpenChange:A,children:[(0,Z.jsx)(Nn,{asChild:!0,children:(0,Z.jsx)(zf,{id:`clone-source`,ref:F,role:`combobox`,"aria-expanded":he,"aria-controls":he?ce?_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)(jn,{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:k8,onCloseAutoFocus:O8,onInteractOutside:e=>{F.current?.contains(e.target)&&e.preventDefault()},onWheel:D8,onTouchMove:E8,children:ce?(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)(Im,{className:`h-4 w-2/3`}),(0,Z.jsx)(Im,{className:`h-4 w-1/2`}),(0,Z.jsx)(Im,{className:`h-4 w-3/4`}),(0,Z.jsx)(Im,{className:`h-4 w-2/5`})]}):(0,Z.jsx)(`div`,{id:I,role:`listbox`,"aria-label":u({id:`KX1MZR`}),className:`py-1`,children:ue.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`})}):ue.map((e,t)=>(0,Z.jsxs)(`div`,{id:`${I}-opt-${t}`,role:`option`,tabIndex:-1,"aria-selected":t===j,onMouseDown:T8,onMouseEnter:()=>M(t),onClick:()=>se(e),className:Bn(`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)(Kv,{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)(Ou,{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]=ce,t[75]=b,t[76]=se,t[77]=ue,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)(zf,{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)(_r,{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]!==J||t[89]!==ae||t[90]!==g||t[91]!==h?(De=(0,Z.jsx)(vr,{children:D?(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:re,children:(0,Z.jsx)(Y,{id:`dEgA5A`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:()=>ae(!1),children:(0,Z.jsx)(Y,{id:`dEgA5A`})}),(0,Z.jsx)(X,{onClick:()=>void J(),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]=J,t[89]=ae,t[90]=g,t[91]=h,t[92]=De):De=t[92];let Oe;t[93]!==Ee||t[94]!==De?(Oe=(0,Z.jsxs)(gr,{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]!==ae||t[97]!==n||t[98]!==Oe?(ke=(0,Z.jsx)(br,{open:n,onOpenChange:ae,children:Oe}),t[96]=ae,t[97]=n,t[98]=Oe,t[99]=ke):ke=t[99],ke}function T8(e){return e.preventDefault()}function E8(e){return e.stopPropagation()}function D8(e){return e.stopPropagation()}function O8(e){return e.preventDefault()}function k8(e){return e.preventDefault()}function A8(e){return Math.max(e-1,-1)}var j8=(0,Q.lazy)(()=>n(()=>import(`./ConsentDialogBody-DfhGpXdb.js`),__vite__mapDeps([215,1,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,39,27,28,29,30,31,105,92,216,45,123,124,54,55,152,34,35,36,108,47,48]),import.meta.url));function M8(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(Rf.subscribe,P8,N8))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)(j8,{})}),e[0]=t):t=e[0],t}function N8(){return!1}function P8(){return Rf.getSnapshot()!==null}function F8(e){let t=(0,$.c)(5),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`OpenKnowledge icon`}),t[0]=n):n=t[0];let r;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`g`,{filter:`url(#filter0_d_ok)`,children:[(0,Z.jsx)(`path`,{d:`M66.8902 16.1017C58.2694 3.86669 46.1739 -0.690239 29.9182 2.17749C21.3995 3.67813 13.4602 9.555 8.67934 17.9009C3.93974 26.1701 2.98514 35.6533 6.05714 43.9166C9.31574 52.6868 16.7168 58.4752 24.2299 63.4231C25.7973 64.4562 26.1351 65.7172 26.3551 68.9896C26.5221 71.4625 26.799 75.6011 30.6842 77.7204C31.8176 78.3372 33.0648 78.6515 34.3946 78.6515C37.0796 78.6515 39.4033 77.3649 40.5189 76.7482C47.1049 73.1046 68.8878 59.7147 72.6453 40.4027C74.3444 31.6679 70.9797 21.9019 66.8922 16.1017H66.8902Z`,fill:`white`}),(0,Z.jsx)(`path`,{d:`M37.4214 71.154C28.7888 75.929 36.787 64.0397 27.7458 58.0843C21.6372 54.0616 14.788 49.0568 12.0499 41.6911C6.74463 27.4192 17.5438 10.8473 31.028 8.47262C45.1977 5.97613 54.6946 9.8947 61.6635 19.7844C65.2089 24.8167 67.6013 32.8365 66.3658 39.1828C63.6906 52.9341 49.073 64.7075 37.4214 71.154Z`,fill:`#69A3FF`}),(0,Z.jsx)(`path`,{d:`M52.7244 29.2638C53.4665 28.5217 54.6697 28.5217 55.4119 29.2638V29.2638C56.154 30.0059 56.154 31.2091 55.4119 31.9513L49.2589 38.1042L46.5715 35.4167L52.7244 29.2638Z`,fill:`#D5E5FF`}),(0,Z.jsx)(`path`,{d:`M55.4119 38.8821C56.154 39.6242 56.154 40.8274 55.4119 41.5696V41.5696C54.6698 42.3117 53.4665 42.3117 52.7244 41.5696L46.5715 35.4166L49.259 32.7292L55.4119 38.8821Z`,fill:`#D5E5FF`})]}),t[1]=r):r=t[1];let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`defs`,{children:(0,Z.jsxs)(`filter`,{id:`filter0_d_ok`,x:`-9.53674e-07`,y:`-0.0799994`,width:`77.3817`,height:`85.8743`,filterUnits:`userSpaceOnUse`,colorInterpolationFilters:`sRGB`,children:[(0,Z.jsx)(`feFlood`,{floodOpacity:`0`,result:`BackgroundImageFix`}),(0,Z.jsx)(`feColorMatrix`,{in:`SourceAlpha`,type:`matrix`,values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0`,result:`hardAlpha`}),(0,Z.jsx)(`feOffset`,{dy:`2.85714`}),(0,Z.jsx)(`feGaussianBlur`,{stdDeviation:`2.14286`}),(0,Z.jsx)(`feComposite`,{in2:`hardAlpha`,operator:`out`}),(0,Z.jsx)(`feColorMatrix`,{type:`matrix`,values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0`}),(0,Z.jsx)(`feBlend`,{mode:`normal`,in2:`BackgroundImageFix`,result:`effect1_dropShadow_ok`}),(0,Z.jsx)(`feBlend`,{mode:`normal`,in:`SourceGraphic`,in2:`effect1_dropShadow_ok`,result:`shape`})]})}),t[2]=i):i=t[2];let a;return t[3]===e?a=t[4]:(a=(0,Z.jsxs)(`svg`,{role:`img`,"aria-label":`OpenKnowledge icon`,fill:`none`,height:24,width:24,viewBox:`0 0 78 80`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r,i]}),t[3]=e,t[4]=a),a}var I8=(0,Q.lazy)(()=>n(()=>import(`./ShareReceiveDialog-CA7GkSOU.js`).then(e=>({default:e.ShareReceiveDialog})),__vite__mapDeps([217,1,6,2,3,7,8,9,10,11,12,13,14,27,16,17,18,28,29,30,26,24,25,31,22,37,92,209,211,212,45]),import.meta.url)),L8=(0,Q.lazy)(()=>n(()=>import(`./AppMenubar-CYaE7Hn6.js`).then(e=>({default:e.AppMenubar})),__vite__mapDeps([198,1,12,13,14,16,17,18,54,138,35,36,20,28,29,55,21,22,105,24,44,45,25,26]),import.meta.url)),R8=(e,t,n)=>Jx(e,t,n,`NavigatorApp`);function z8(e,t){return e.filter(e=>e.path!==t)}function B8(e){let t=(0,$.c)(157),{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)(!1),[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}=Dn(),{_:z}=on();Up(n,R??`system`);let B;t[2]===n.config.languagePreference?B=t[3]:(B=Hp(n.config.languagePreference)??Wp(),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),Vp(V);let H;t[6]!==z||t[7]!==n.project?(H=()=>{let e=!1;return n.project.listRecent().then(async t=>{if(e)return;a(t);let r=t.filter(V8),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]=H):H=t[8];let U;t[9]!==z||t[10]!==n?(U=[n,z],t[9]=z,t[10]=n,t[11]=U):U=t[11],(0,Q.useEffect)(H,U);let W,ee;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>Fn(e=>{e===`new-project`&&b(!0),e===`report-bug`&&S(!0),e===`send-feedback`&&w(!0),e===`close-active-tab-or-window`&&window.close()}),ee=[],t[12]=W,t[13]=ee):(W=t[12],ee=t[13]),(0,Q.useEffect)(W,ee);let G,K;t[14]===n?(G=t[15],K=t[16]):(K=()=>n.onRecentRemovedMissing(e=>{let{path:t}=e;a(e=>z8(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]=K),(0,Q.useEffect)(K,G);let q;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(q=(e,t)=>R8(e,t,m),t[17]=q):q=t[17];let te=q,J;t[18]!==z||t[19]!==n?(J=(e,t,r)=>te(()=>(g(r),K8(n,e,t).finally(()=>g(null))),z({id:`SUOoXn`})),t[18]=z,t[19]=n,t[20]=J):J=t[20];let ne=J,re;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(re=()=>v(!0),t[21]=re):re=t[21];let ie=re,ae;t[22]!==z||t[23]!==n?(ae=()=>te(async()=>{let e=await n.dialog.openFolder();e&&(g(q8(e)),await K8(n,e,`pick-existing`).finally(()=>g(null)))},z({id:`gmJ0An`})),t[22]=z,t[23]=n,t[24]=ae):ae=t[24];let oe=ae,se;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>b(!0),t[25]=se):se=t[25];let ce=se,le;t[26]!==z||t[27]!==n.project?(le=()=>te(()=>n.project.openFile(),z({id:`8vCZcs`})),t[26]=z,t[27]=n.project,t[28]=le):le=t[28];let ue=le,de;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(de=(e,t)=>{E(e),O(t),b(!0)},t[29]=de):de=t[29];let fe=de,pe;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(pe=e=>{b(e),e||(E(void 0),O(void 0))},t[30]=pe):pe=t[30];let me=pe,he;t[31]===ne?he=t[32]:(he=e=>ne(e,`recents`,q8(e)),t[31]=ne,t[32]=he);let ge=he,_e;t[33]!==z||t[34]!==n.project?(_e=e=>te(async()=>{await n.project.removeRecent(e),a(t=>z8(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:Hz()&&(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)(L8,{})})})}),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)(xd,{"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)(F8,{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)(wB,{})]}),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)(H8,{title:we,description:Te,onClick:ce,dataTestId:`nav-create-new`,Icon:Mn}),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]!==oe||t[56]!==De||t[57]!==Oe?(ke=(0,Z.jsx)(H8,{title:De,description:Oe,onClick:oe,dataTestId:`nav-open`,Icon:hd}),t[55]=oe,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]!==ue||t[64]!==Ae||t[65]!==je?(Me=(0,Z.jsx)(H8,{title:Ae,description:je,onClick:ue,dataTestId:`nav-open-file`,Icon:Rr}),t[63]=ue,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)(H8,{title:Ne,description:Pe,onClick:ie,dataTestId:`nav-clone`,Icon:Qy}),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)(W8,{onPackSelect:fe}):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)(xd,{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)(G8,{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)(C6,{}),Ue=(0,Z.jsx)(M8,{}),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)(Uy,{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;t[106]===x?Ge=t[107]:(Ge=(0,Z.jsx)($_,{open:x,onOpenChange:S,systemWide:!0}),t[106]=x,t[107]=Ge);let Ke;t[108]===C?Ke=t[109]:(Ke=(0,Z.jsx)(Gb,{open:C,onOpenChange:w,source:`help_menu`}),t[108]=C,t[109]=Ke);let qe;t[110]===N?qe=t[111]:(qe=e=>{A(e),e||(M(!1),N&&(N(null),P(null)))},t[110]=N,t[111]=qe);let Je;t[112]===n?Je=t[113]:(Je=Pu(n),t[112]=n,t[113]=Je);let Ye;t[114]===n?Ye=t[115]:(Ye=Hu(n),t[114]=n,t[115]=Ye);let Xe=I===`identity`,Ze;t[116]!==j||t[117]!==N?(Ze=e=>{A(!1),j&&(M(!1),v(!0)),N&&(N({authenticated:!0,host:`github.com`,login:e.login}),P(null))},t[116]=j,t[117]=N,t[118]=Ze):Ze=t[118];let Qe;t[119]!==k||t[120]!==qe||t[121]!==Je||t[122]!==Ye||t[123]!==Xe||t[124]!==Ze?(Qe=(0,Z.jsx)(Vu,{open:k,onOpenChange:qe,transport:Je,queryTransport:Ye,identityPrompt:Xe,onSuccess:Ze}),t[119]=k,t[120]=qe,t[121]=Je,t[122]=Ye,t[123]=Xe,t[124]=Ze,t[125]=Qe):Qe=t[125];let $e;t[126]===n?$e=t[127]:($e=x8(n),t[126]=n,t[127]=$e);let et;t[128]===n?et=t[129]:(et=Hu(n),t[128]=n,t[129]=et);let tt;t[130]===n.dialog?tt=t[131]:(tt=()=>n.dialog.openFolder(),t[130]=n.dialog,t[131]=tt);let nt;t[132]===Symbol.for(`react.memo_cache_sentinel`)?(nt=()=>{v(!1),L(`auth`),M(!0),A(!0)},t[132]=nt):nt=t[132];let rt;t[133]!==z||t[134]!==n?(rt=e=>{let{dir:t}=e;te(()=>(g(q8(t)),K8(n,t,`pick-existing`).finally(()=>g(null))),z({id:`iSnkwB`}))},t[133]=z,t[134]=n,t[135]=rt):rt=t[135];let it;t[136]!==_||t[137]!==$e||t[138]!==et||t[139]!==tt||t[140]!==rt?(it=(0,Z.jsx)(w8,{open:_,onOpenChange:v,transport:$e,authQueryTransport:et,pickParentFolder:tt,onSignIn:nt,onCloneComplete:rt}),t[136]=_,t[137]=$e,t[138]=et,t[139]=tt,t[140]=rt,t[141]=it):it=t[141];let at;if(t[142]!==n){let e;t[144]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>new Promise(e=>{P(()=>e),A(!0)}),t[144]=e):e=t[144],at=y8({bridge:n,authQueryTransport:Hu(n),cloneTransport:x8(n),openSignIn:e}),t[142]=n,t[143]=at}else at=t[143];let ot;t[145]!==n||t[146]!==at?(ot=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(I8,{bridge:n,cloneController:at})}),t[145]=n,t[146]=at,t[147]=ot):ot=t[147];let st;return t[148]!==be||t[149]!==Ve||t[150]!==We||t[151]!==Ge||t[152]!==Ke||t[153]!==Qe||t[154]!==it||t[155]!==ot?(st=(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,Ge,Ke,Qe,it,ot]}),t[148]=be,t[149]=Ve,t[150]=We,t[151]=Ge,t[152]=Ke,t[153]=Qe,t[154]=it,t[155]=ot,t[156]=st):st=t[156],st}function V8(e){return!e.missing}function H8(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 U8=3;function W8(e){let t=(0,$.c)(36),{onPackSelect:n}=e,{_:r}=on(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),c,l;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=!1;return(async()=>{try{let t=await Sx().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}},l=[],t[0]=c,t[1]=l):(c=t[0],l=t[1]),(0,Q.useEffect)(c,l),i===null||i.length===0)return null;let u,d,f,p,m,h,g;if(t[2]!==n||t[3]!==i){let e=i.slice(0,U8);u=i.length-e.length,d=e=>{s(!1),n(e,i)},m=`flex flex-wrap items-center gap-x-3 gap-y-2`,h=`nav-starter-packs`,t[11]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:(0,Z.jsx)(Y,{id:`C-xgad`})}),t[11]=g):g=t[11],f=`flex flex-wrap items-center gap-2`;let r;t[12]===d?r=t[13]:(r=e=>{let t=wx(e.id);return(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,className:`rounded-full`,onClick:()=>d(e.id),"data-testid":`nav-pack-pill-${e.id}`,children:[(0,Z.jsx)(t,{className:`size-3.5 text-muted-foreground`}),e.name]},e.id)},t[12]=d,t[13]=r),p=e.map(r),t[2]=n,t[3]=i,t[4]=u,t[5]=d,t[6]=f,t[7]=p,t[8]=m,t[9]=h,t[10]=g}else u=t[4],d=t[5],f=t[6],p=t[7],m=t[8],h=t[9],g=t[10];let _;t[14]!==r||t[15]!==u||t[16]!==i.length?(_=u>0?(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`sm`,className:`rounded-full`,onClick:()=>s(!0),"aria-label":r({id:`e4FxjG`,values:{0:i.length}}),"data-testid":`nav-pack-more`,children:(0,Z.jsx)(Y,{id:`B6Lac2`,values:{overflowCount:u}})}):null,t[14]=r,t[15]=u,t[16]=i.length,t[17]=_):_=t[17];let v;t[18]!==f||t[19]!==p||t[20]!==_?(v=(0,Z.jsxs)(`div`,{className:f,children:[p,_]}),t[18]=f,t[19]=p,t[20]=_,t[21]=v):v=t[21];let y;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(hr,{children:(0,Z.jsx)(Y,{id:`tcjTlU`})}),t[22]=y):y=t[22];let b;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsxs)(yr,{children:[y,(0,Z.jsx)(mr,{children:(0,Z.jsx)(Y,{id:`b6Fgpe`})})]}),t[23]=b):b=t[23];let x;t[24]!==i||t[25]!==d?(x=(0,Z.jsxs)(gr,{className:`sm:max-w-3xl`,"data-testid":`nav-pack-picker`,children:[b,(0,Z.jsx)(_r,{children:(0,Z.jsx)(Tx,{packs:i,onPackSelect:d})})]}),t[24]=i,t[25]=d,t[26]=x):x=t[26];let S;t[27]!==o||t[28]!==x?(S=(0,Z.jsx)(br,{open:o,onOpenChange:s,children:x}),t[27]=o,t[28]=x,t[29]=S):S=t[29];let C;return t[30]!==S||t[31]!==m||t[32]!==h||t[33]!==g||t[34]!==v?(C=(0,Z.jsxs)(`section`,{className:m,"data-testid":h,children:[g,v,S]}),t[30]=S,t[31]=m,t[32]=h,t[33]=g,t[34]=v,t[35]=C):C=t[35],C}function G8(e){let t=(0,$.c)(43),{project:n,branch:r,onOpen:i,onRemove:a}=e,{_:o}=on(),{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)(gd,{"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)(Mp,{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)($c,{"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:iS(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)($c,{"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)(hf,{"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)(sS,{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 K8(e,t,n){await e.project.open({path:t,target:`new-window`,entryPoint:n})}function q8(e){let t=e.split(/[/\\]/).filter(Boolean);return t.length>0?t[t.length-1]??e:e}var J8=(0,Q.lazy)(()=>n(()=>import(`./TerminalWindowApp-C1Ej4Kb1.js`).then(e=>({default:e.TerminalWindowApp})),__vite__mapDeps([218,1,91,2,6,3,7,8,9,10,11,45,74,14,24,13,92,18,93,94,95,96,201,134,12,180,16,17,138,35,36,20,54,28,29,55,21,22,105,25,26,137,99,125,30,34,56,142,116,40,202,37,203,136,117,43,42,31,132,47,48,159,160,200,204,161,77,219,220]),import.meta.url));function Y8(e){return e?.config.mode===`terminal`?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(J8,{bridge:e})}):e?.config.mode===`navigator`?(0,Z.jsx)(B8,{bridge:e}):(0,Z.jsx)(h8,{})}function X8(){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 Z8=X8();function Q8(e){return Z8.install(e)}function $8(e){let t=(0,$.c)(7),{bridge:n}=e,r=(0,Q.useSyncExternalStore)(Z8.subscribe,Z8.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}),Z8.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)($_,{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 e5=e=>{let t=(0,$.c)(8),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{theme:r}=Dn(),i=r===void 0?`system`:r,a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={success:(0,Z.jsx)(Au,{className:`size-4`}),info:(0,Z.jsx)(bd,{className:`size-4`}),warning:(0,Z.jsx)(pf,{className:`size-4`}),error:(0,Z.jsx)(Xv,{className:`size-4`}),loading:(0,Z.jsx)(xd,{"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)(Ps,{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},t5=Symbol.for(`ok.client.fetchWrapper`);function n5(e={}){if(typeof window>`u`)return;let t=e.apiOrigin&&e.apiOrigin.length>0?e.apiOrigin:void 0;if(window.fetch[t5])return;let n=window.fetch.bind(window),r=Yp(),i=((e,i)=>{let a=i5(e,t);if(!a.isApi)return n(e,i);if(e instanceof Request){let t=r5(e.headers,r);return n(new Request(a.url,e),{headers:t})}let o=r5(i?.headers,r);return n(a.url,{...i,headers:o})});i[t5]=!0,window.fetch=i}function r5(e,t){let n=new Headers(e);for(let[e,r]of Object.entries(t))n.set(e,r);return n}function i5(e,t){if(typeof e==`string`){if(e.startsWith(`/api/`))return{isApi:!0,url:t?t+e:e};let n=a5(e);return n&&o5(n,t)?{isApi:!0,url:e}:{isApi:!1,url:e}}let n=e instanceof URL?e:a5(e.url,window.location.origin);if(n&&o5(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 a5(e,t){try{return new URL(e,t)}catch{return null}}function o5(e,t){if(!e.pathname.startsWith(`/api/`))return!1;if(e.origin===window.location.origin||e.protocol===`file:`)return!0;if(t){let n=a5(t);if(n&&e.origin===n.origin)return!0}return!1}var s5=Symbol.for(`ok.client.logForwarder`),c5=2e3,l5=[`log`,`info`,`warn`,`error`],u5={log:`info`,info:`info`,warn:`warn`,error:`error`};function d5(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 f5(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 p5(e={}){let t=e.windowObj??(typeof window<`u`?window:void 0);if(!t||t.okDesktop)return;let n=t;if(n[s5])return;n[s5]=!0;let r=e.consoleObj??console,i=e.documentObj===void 0?typeof document<`u`?document:null:e.documentObj,a=e.flushIntervalMs??c5,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+=f5(e),c.length>100){let e=c.shift();e&&(l-=f5(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=fa(No(t.map(d5).join(` `))),r=t[0],i=typeof r==`string`&&r.length<=32768?r:void 0,a=i?ts(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 l5)r[e]=(...t)=>{p[e](...t),g(u5[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: ${d5(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 l5)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[s5]}return{flushNow:m,uninstall:x}}function m5(e,t){if(e.branch===void 0||e.branch===null||e.branch===``||t===``||e.multiCandidate!==!0)return null;let n=e.branch;return{message:Ms._({id:`n5Vy3l`,values:{branch:n}}),description:t}}function h5(e){let t=e.bridge;if(!t)return;let n=e.setHash??(e=>{window.location.hash=e}),r=e.emitToast??((e,t)=>{Ns(e,t)});return t.onDeepLink(e=>{let i=e.kind??`doc`,a={kind:i,path:e.doc,branch:e.branch??null};if(e.targetMissing===!0){Cd.arm(a);return}ud.arm(a),n(xf(i,e.doc,i===`doc`?e.branch:void 0));let o=m5(e,t.config.projectPath);o!==null&&r(o.message,{description:o.description,duration:3e3})})}var g5=4e3,_5=1440*60*1e3;function v5(e){let t=e.bridge;if(t&&t.onboarding)return t.onboarding.onToast(e=>{if(e.kind===`ancestor-promote`){let t=e.ancestorPath;Ns.success(Ms._({id:`hAbGf0`,values:{ancestorPath:t}}),{duration:g5});return}if(e.kind===`startup-reclaim`){let t=[];if(e.mcp.status===`repaired`){let n=e.mcp.editors.map(e=>_s[e]??e).join(`, `);t.push(Ms._({id:`FK57sK`,values:{names:n}}))}else e.mcp.status===`failed`&&t.push(Ms._({id:`DMLE5q`}));if(e.path.status===`installed`&&t.push(e.path.summary),e.path.status===`failed`){let n=e.path.summary;t.push(Ms._({id:`L83DKQ`,values:{summary:n}}))}let n=t.length>0?t.join(`; `):Ms._({id:`-X1eoK`}),r=e.mcp.status===`failed`||e.path.status===`failed`,i=e.path.status!==`none`;Ns[r?`error`:`success`](n,{duration:r||i?_5:g5,position:`bottom-left`});return}if(e.kind===`sharing-refused-tracked`){let t=e.tracked.length;Ns.error(Ms._({id:`LlJ8LD`,values:{trackedCount:t}}),{duration:_5,description:e.remediation});return}if(e.kind===`sharing-no-git`){Ns.warning(Ms._({id:`PaYmFG`}),{duration:g5});return}let t=Lf(e.gitRoot,e.pickedPath)??e.pickedPath,n=e.gitRoot;Ns.success(Ms._({id:`pZ91JC`,values:{gitRoot:n,subPath:t}}),{duration:g5})})}function y5(e){return Ms._({id:`wXw19Y`,values:{projectName:e}})}function b5(e){let t=e.bridge;if(t)return t.onRecentRemovedMissing(({projectName:e})=>{Ns(y5(e))})}function x5(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)(pf,{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 S5(){return Ms._({id:`f_PkYv`})}function C5(e){return e.serverRuntime===e.appRuntime?Ms._({id:`FWQuPE`,values:{0:e.appRuntime}}):e.relation===`older`?Ms._({id:`LhQlGR`,values:{0:e.serverRuntime,1:e.appRuntime}}):Ms._({id:`yZmvQ4`,values:{0:e.serverRuntime,1:e.appRuntime}})}function w5(e){return Ms._({id:`2YOwme`,values:{appRuntime:e}})}function T5(e){return e===`eperm`?Ms._({id:`uQewpR`}):Ms._({id:`PqYWiC`})}async function E5(e){let t=Ns.loading(Ms._({id:`Kf7GG5`}),{duration:1/0}),n;try{n=await e.restartServer(e.config.projectPath)}catch{return}Ns.dismiss(t),n.ok===!1&&Ns.error(T5(n.reason),{duration:1/0})}function D5(e){let t=e.bridge;if(!t)return;let n=t.onServerVersionDrift(e=>{Ns.custom(n=>(0,Q.createElement)(x5,{body:C5(e),warning:S5(),restartLabel:Ms._({id:`ppDgFi`}),cancelLabel:Ms._({id:`PBxg_E`}),onRestart:()=>{Ns.dismiss(n),E5(t)},onDismiss:()=>Ns.dismiss(n)}),{duration:1/0})}),r=t.onServerRestarted(e=>{Ns.success(w5(e.appRuntime))});return()=>{n(),r()}}async function O5(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 k5(e){let{initialDoc:t}=e;if(!t)return;let n=e.getHash();n!==``&&n!==`#`&&n!==`#/`||e.setHash(Cf(t))}function A5(){typeof window>`u`||!window.okDesktop||k5({initialDoc:window.okDesktop.config.initialDoc,getHash:()=>window.location.hash,setHash:e=>{window.location.hash=e}})}Cg(),n(()=>import(`./telemetry-startup-C8JOSRcr.js`).then(e=>e.initStartupTrace()),__vite__mapDeps([221,0,1,2,3,4,73,24,14,13]),import.meta.url),n5({apiOrigin:typeof window<`u`?window.okDesktop?.config.apiOrigin:void 0}),p5(),O5(),Hj()&&Jj(),ZH(),yA(),lV(),YB(),iB(),typeof window<`u`&&h5({bridge:window.okDesktop}),typeof window<`u`&&D5({bridge:window.okDesktop}),typeof window<`u`&&b5({bridge:window.okDesktop}),typeof window<`u`&&bg({bridge:window.okDesktop}),typeof window<`u`&&If({bridge:window.okDesktop}),typeof window<`u`&&v5({bridge:window.okDesktop}),typeof window<`u`&&Sg({bridge:window.okDesktop}),typeof window<`u`&&Q8({bridge:window.okDesktop}),A5();var j5=new kg({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),M5=document.getElementById(`root`);if(!M5)throw Error(`Root element not found`);var N5=typeof window>`u`?void 0:window.okDesktop;function P5(){return Zi(),null}(0,Ag.createRoot)(M5).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(sn,{i18n:Ms,children:(0,Z.jsxs)(vn,{client:j5,children:[(0,Z.jsx)(lv,{}),(0,Z.jsxs)(On,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(P5,{}),(0,Z.jsxs)(lr,{children:[(0,Z.jsx)(av,{children:Y8(N5)}),N5!==void 0&&(0,Z.jsx)(sv,{children:(0,Z.jsx)($8,{bridge:N5})})]}),(0,Z.jsx)(e5,{richColors:!0,closeButton:!0})]})]})})}));export{SU as t};
2094
+ `;function N3(e){let t=e.endsWith(`/`),n=(t?e.slice(0,-1):e).split(`/`);return{scopeLabel:n[0]??``,skillDisplay:n.length>=2?n[1]:void 0,sub:n.length>=3?n.slice(2).join(`/`):null,isDir:t}}function P3(e){let t=(0,$.c)(118),{paths:n,activePath:r,initialExpandedPaths:i,onExpandedChange:a,sort:o,skillByPrefix:s,detectedByPrefix:c,labelToScope:l,scopeDescription:u,existingNames:d,actions:f,onOpenSkillMd:p,onOpenFile:h,onOpenDetected:g,onOpenManaged:_,onNewSkill:v,onAddSkill:y}=e,{_:b}=on(),{resolvedTheme:x}=Dn(),S=(0,Q.useRef)(null),C=(0,Q.useRef)(null),[w,T]=(0,Q.useState)(!1),E,D;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>T(!0),D=[],t[0]=E,t[1]=D):(E=t[0],D=t[1]),(0,Q.useEffect)(E,D);let[O,k]=(0,Q.useState)(null),A;t[2]===s?A=t[3]:(A=[...s.values()].map(z3),t[2]=s,t[3]=A);let j=A.join(`|`),M=R3,N;t[4]===s?N=t[5]:(N=e=>{let t=M(e);return t===void 0?void 0:s.get(t)},t[4]=s,t[5]=N);let P=N,F;t[6]===c?F=t[7]:(F=e=>{let t=M(e);return t===void 0?void 0:c.get(t)},t[6]=c,t[7]=F);let I=F,L;t[8]!==b||t[9]!==I||t[10]!==l||t[11]!==P?(L=e=>{let t=N3(e);if(t.skillDisplay===void 0)return null;let n=I(t);if(n){let e=l.get(t.scopeLabel)??`global`,r=n.sourceHarnesses.map(n=>`${Cp(n,e)}/${t.skillDisplay}`);return t.sub?r.map(e=>`${e}/${t.sub}`).join(`, `):r.join(`, `)}let r=P(t);if(!r)return null;if(r.managed){let e=r.absolutePath?jp(Sp(r.absolutePath)):null;return e?t.sub?`${e}/${t.sub}`:e:null}return kp(r).map(e=>{let n=t.sub?`${e.dir}/${t.sub}`:e.dir;return e.symlink?b({id:`leiGnv`,values:{dir:n}}):n}).join(`, `)},t[8]=b,t[9]=I,t[10]=l,t[11]=P,t[12]=L):L=t[12];let R=L,z;t[13]!==I||t[14]!==l||t[15]!==P?(z=e=>{if(!l.get(e.scopeLabel))return!1;if(e.skillDisplay===void 0||I(e))return!0;let t=P(e);return!(!t||t.managed)},t[13]=I,t[14]=l,t[15]=P,t[16]=z):z=t[16];let B=z,V=(0,Q.useRef)(B),H;t[17]===B?H=t[18]:(H=()=>{V.current=B},t[17]=B,t[18]=H),(0,Q.useEffect)(H);let U=L3,W;t[19]!==b||t[20]!==I||t[21]!==l||t[22]!==P?(W=e=>{let t=N3(e);if(t.skillDisplay===void 0||t.sub!==null)return null;let n=I(t);if(n){let e=l.get(t.scopeLabel)??`global`;return{kind:`icons`,poolKeys:n.sourceHarnesses.map(U),title:b({id:`W3Tsgy`,values:{0:n.sourceHarnesses.map(t=>Cp(t,e)).join(`, `)}})}}let r=P(t);if(!r||r.managed)return null;let i=Ep(r);return i.length>0?{kind:`icons`,poolKeys:i.map(U),title:b({id:`h2N-1n`,values:{0:i.map(e=>Cp(e,r.scope)).join(`, `)}})}:{kind:`install`,title:b({id:`fGqEFq`,values:{0:r.name}})}},t[19]=b,t[20]=I,t[21]=l,t[22]=P,t[23]=W):W=t[23];let ee=W,G;t[24]===b?G=t[25]:(G=b({id:`TKQ7K-`}),t[24]=b,t[25]=G);let K;t[26]!==ee||t[27]!==P||t[28]!==G?(K={decorForPath:ee,skillFor:P,installLabel:G},t[26]=ee,t[27]=P,t[28]=G,t[29]=K):K=t[29];let q=(0,Q.useRef)(K),te;t[30]!==b||t[31]!==ee||t[32]!==P?(te=()=>{q.current={decorForPath:ee,skillFor:P,installLabel:b({id:`TKQ7K-`})}},t[30]=b,t[31]=ee,t[32]=P,t[33]=te):te=t[33],(0,Q.useEffect)(te);let J=(0,Q.useRef)(I3),ne;if(t[34]!==b||t[35]!==r||t[36]!==I||t[37]!==i||t[38]!==n||t[39]!==P){let e;t[41]!==b||t[42]!==I||t[43]!==P?(e=e=>{let{item:t}=e,n=N3(t.path);if(n.skillDisplay===void 0||n.sub!==null)return null;if(P(n)?.managed)return{icon:k3,title:b({id:`KN5RGc`})};let r=I(n);return r?.provenance.plugin===void 0?null:{icon:A3,title:b({id:`AkA6DO`,values:{0:r.provenance.plugin}})}},t[41]=b,t[42]=I,t[43]=P,t[44]=e):e=t[44],ne=C0({paths:n,initialExpansion:`closed`,initialExpandedPaths:i,initialSelectedPaths:r?[r]:void 0,stickyFolders:!1,enableContextMenu:!0,unsafeCSS:`${S0}\n${M3}\n${y3}`,extraSpriteSymbols:j3,renderRowDecoration:e}),t[34]=b,t[35]=r,t[36]=I,t[37]=i,t[38]=n,t[39]=P,t[40]=ne}else ne=t[40];let re;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(re=e=>J.current(e),t[45]=re):re=t[45];let ie;t[46]!==o||t[47]!==ne?(ie={...ne,onSelectionChange:re,sort:o,flattenEmptyDirectories:!1},t[46]=o,t[47]=ne,t[48]=ie):ie=t[48];let{model:ae}=t1(ie),oe;t[49]!==r||t[50]!==I||t[51]!==g||t[52]!==h||t[53]!==_||t[54]!==p||t[55]!==P?(oe=()=>{J.current=e=>{let t=e[0];if(!t||t===r)return;let n=N3(t);if(n.sub!==null&&n.isDir)return;let i=I(n);if(i){g(i,n.sub??void 0);return}let a=P(n);a&&(n.sub===null||n.sub===`SKILL.md`?(a.managed?_:p)(a):h(a,n.sub))}},t[49]=r,t[50]=I,t[51]=g,t[52]=h,t[53]=_,t[54]=p,t[55]=P,t[56]=oe):oe=t[56],(0,Q.useEffect)(oe);let se;t[57]!==c||t[58]!==l||t[59]!==a||t[60]!==s?(se={labelToScope:l,skillByPrefix:s,detectedByPrefix:c,onExpandedChange:a},t[57]=c,t[58]=l,t[59]=a,t[60]=s,t[61]=se):se=t[61];let ce=(0,Q.useRef)(se),le;t[62]!==c||t[63]!==l||t[64]!==a||t[65]!==s?(le=()=>{ce.current={labelToScope:l,skillByPrefix:s,detectedByPrefix:c,onExpandedChange:a}},t[62]=c,t[63]=l,t[64]=a,t[65]=s,t[66]=le):le=t[66],(0,Q.useEffect)(le);let de;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(de=new Set,t[67]=de):de=t[67];let fe=(0,Q.useRef)(de),pe,me;t[68]===ae?(pe=t[69],me=t[70]):(pe=()=>{let e=()=>{let e=ce.current,t=new Set,n=e=>{L0(ae.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}/`);let r=fe.current;r.size===t.size&&[...t].every(e=>r.has(e))||(fe.current=t,e.onExpandedChange(t))};return e(),ae.subscribe(e)},me=[ae],t[68]=ae,t[69]=pe,t[70]=me),(0,Q.useEffect)(pe,me);let he,ge;t[71]!==r||t[72]!==ae||t[73]!==w?(he=()=>{if(w){for(let e of ae.getSelectedPaths())e!==r&&ae.getItem(e)?.deselect();if(r){ae.getItem(r)?.select(),ae.focusPath(r);let e=N3(r);e.skillDisplay!==void 0&&L0(ae.getItem(`${e.scopeLabel}/${e.skillDisplay}/`))?.expand()}}},ge=[w,r,ae],t[71]=r,t[72]=ae,t[73]=w,t[74]=he,t[75]=ge):(he=t[74],ge=t[75]),(0,Q.useEffect)(he,ge);let _e=(0,Q.useRef)(i),ve;t[76]===i?ve=t[77]:(ve=()=>{_e.current=i},t[76]=i,t[77]=ve),(0,Q.useEffect)(ve);let ye,be;t[78]!==ae||t[79]!==w?(ye=()=>{if(w)for(let e of _e.current)L0(ae.getItem(e))?.expand()},be=[w,ae],t[78]=ae,t[79]=w,t[80]=ye,t[81]=be):(ye=t[80],be=t[81]),(0,Q.useEffect)(ye,be);let xe,Se;t[82]===w?(xe=t[83],Se=t[84]):(xe=()=>{if(!w)return;let e=S.current?.querySelector(JW)?.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&&!V.current(N3(n));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()},Se=[w],t[82]=w,t[83]=xe,t[84]=Se),(0,Q.useEffect)(xe,Se);let Ce;t[85]!==w||t[86]!==x?(Ce=()=>{if(!w)return;let e=S.current?.querySelector(JW)?.shadowRoot;if(!e)return;let t=()=>x3(e,{decorFor:e=>q.current.decorForPath(e),iconPool:C.current,installLabel:q.current.installLabel,version:x??`light`});t();let n=new MutationObserver(t);n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]});let r=e=>{let t=b3(e.target);if(!t)return;e.preventDefault(),e.stopPropagation();let n=q.current.skillFor(N3(t.path));n&&k({skill:n,x:t.rect.left,y:t.rect.bottom})};return e.addEventListener(`click`,r,!0),()=>{n.disconnect(),e.removeEventListener(`click`,r,!0)}},t[85]=w,t[86]=x,t[87]=Ce):Ce=t[87];let we;t[88]!==j||t[89]!==w||t[90]!==x?(we=[w,x,j],t[88]=j,t[89]=w,t[90]=x,t[91]=we):we=t[91],(0,Q.useEffect)(Ce,we);let Te;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,Z.jsxs)(`div`,{ref:C,"aria-hidden":!0,style:{position:`absolute`,width:0,height:0,overflow:`hidden`},children:[jc.map(F3),(0,Z.jsx)(`span`,{[T3]:`generic`,children:(0,Z.jsx)(ue,{})})]}),t[92]=Te):Te=t[92];let Ee;t[93]!==f||t[94]!==O?(Ee=O?(0,Z.jsxs)(xi,{open:!0,onOpenChange:e=>{e||k(null)},children:[(0,Z.jsx)(hi,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":!0,style:{position:`fixed`,left:O.x,top:O.y,width:0,height:0}})}),(0,Z.jsx)(yi,{align:`start`,className:Mc,children:(0,Z.jsx)(B3,{skill:O.skill,actions:f,onRunStart:()=>k(null)})})]}):null,t[93]=f,t[94]=O,t[95]=Ee):Ee=t[95];let De;t[96]===x?De=t[97]:(De=s1(x),t[96]=x,t[97]=De);let Oe;t[98]!==f||t[99]!==I||t[100]!==d||t[101]!==l||t[102]!==y||t[103]!==v||t[104]!==g||t[105]!==B||t[106]!==u||t[107]!==P?(Oe=(e,t)=>{let n=N3(e.path);if(!B(n))return null;let r=l.get(n.scopeLabel);if(!r)return null;let i;if(n.skillDisplay===void 0)i=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(_i,{className:`max-w-56 whitespace-normal font-normal text-muted-foreground text-xs`,children:u[r]}),(0,Z.jsx)(Si,{}),(0,Z.jsxs)(li,{onSelect:()=>v(r),children:[(0,Z.jsx)(df,{"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`MdpSC1`})]}),(0,Z.jsxs)(li,{onSelect:()=>y(r,`upload`),children:[(0,Z.jsx)(m,{"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`koo58J`})]}),(0,Z.jsxs)(li,{onSelect:()=>y(r,`skills-sh`),children:[(0,Z.jsx)(Sv,{"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`C3Zc44`})]})]});else{let e=I(n);if(e)i=(0,Z.jsxs)(li,{onSelect:()=>g(e),children:[(0,Z.jsx)(df,{"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`ePK91l`})]});else{let e=P(n);if(!e||e.managed)return null;i=n.sub===null||n.sub===`SKILL.md`?(0,Z.jsx)(Uc,{skill:e,actions:f,existingNames:d[e.scope]}):n.isDir?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Vc,{absolutePath:e.absolutePath?`${Sp(e.absolutePath)}/${n.sub}`:void 0}),(0,Z.jsx)(li,{onSelect:()=>f.requestFileCreate(e,`${n.sub}/`),children:(0,Z.jsx)(Y,{id:`HdkSiO`})})]}):(0,Z.jsx)(Rc,{skill:e,filePath:n.sub,actions:f})}}return(0,Z.jsxs)(xi,{open:!0,modal:!1,onOpenChange:e=>{e||t.close({restoreFocus:!1})},children:[(0,Z.jsx)(hi,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),(0,Z.jsx)(yi,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:i})]})},t[98]=f,t[99]=I,t[100]=d,t[101]=l,t[102]=y,t[103]=v,t[104]=g,t[105]=B,t[106]=u,t[107]=P,t[108]=Oe):Oe=t[108];let ke;t[109]!==ae||t[110]!==w||t[111]!==De||t[112]!==Oe||t[113]!==R?(ke=(0,Z.jsx)(f3,{model:ae,hostRef:S,ready:w,className:`min-h-0`,style:De,sizeToContent:!0,titleForPath:R,renderContextMenu:Oe}),t[109]=ae,t[110]=w,t[111]=De,t[112]=Oe,t[113]=R,t[114]=ke):ke=t[114];let Ae;return t[115]!==Ee||t[116]!==ke?(Ae=(0,Z.jsxs)(Z.Fragment,{children:[Te,Ee,ke]}),t[115]=Ee,t[116]=ke,t[117]=Ae):Ae=t[117],Ae}function F3(e){return(0,Z.jsx)(`span`,{[T3]:e,children:(0,Z.jsx)(Zn,{host:e})},e)}function I3(){}function L3(e){return jc.includes(e)?e:`generic`}function R3(e){return e.skillDisplay===void 0?void 0:`${e.scopeLabel}/${e.skillDisplay}`}function z3(e){return`${e.name}:${[...e.hosts].sort().join(`,`)}`}function B3(e){let t=(0,$.c)(8),{skill:n,actions:r,onRunStart:i}=e,a=Lc(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)(Bc,{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 V3(){let e=(0,$.c)(2),{openTarget:t}=Oe(),n;return e[0]===t?n=e[1]:(n=async(e,n,r)=>{let i=await om({name:e,home:n});if(!i.ok)return i;let a=r?.rel?Ra(e,r.rel):i.docName;return t({kind:`doc`,target:a,docName:a},r?.replaceActive?{tabBehavior:`replace-active`}:void 0),Nf(Cf(a)),{ok:!0,docName:a}},e[0]=t,e[1]=n),n}var H3=(0,Q.lazy)(()=>n(()=>import(`./ImportSkillDialog-C4hZ7UL5.js`).then(e=>({default:e.ImportSkillDialog})),__vite__mapDeps([122,1,6,2,3,7,8,9,10,11,45,12,13,14,97,35,36,16,17,18,20,54,28,29,34,24,25,26,19,22,21,40,98,27,30,31,123,124,55,125,56,79,80,81,82,83,84,85,86,87,88,89,90,91,74,92,93,94,95,96,4,39,99,100,101,41,42,66,67,68,69,102,49,71,103,104,46,105,33,65,70,72,73,106,107,108,37,23,109,110,43,47,111,112,113,126,127,128,129,130,131,132,48]),import.meta.url)),U3=new Set([`open-knowledge`,`open-knowledge-discovery`,`open-knowledge-write-skill`]);function W3(e){let t=(0,$.c)(83),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{skillsMode:r}=n,i=r===void 0?!1:r,a=fm(),{openTarget:o,activeDocName:s,activeTarget:c,openTabs:l,activateTab:u,setSkillsSidebar:d}=Oe(),f;t[2]===d?f=t[3]:(f=()=>d(!0),t[2]=d,t[3]=f);let p=f,{merged:m}=xc(),h=m?.editor?.previewTabs??!0?`replace-active`:`append`,g=pm(),_=V3(),v=Fc(),{_:y}=on(),b=Tp(),x=wp(),S;t[4]!==a.data||t[5]!==a.status?(S=a.status===`ready`?a.data:[],t[4]=a.data,t[5]=a.status,t[6]=S):S=t[6];let C=S,w=Dp(C),[T,E]=(0,Q.useState)(Q3),{createBlank:D,creating:O}=Gx(),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(null),[N,P]=(0,Q.useState)(null),F;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(F={},t[7]=F):F=t[7];let[I,L]=(0,Q.useState)(F),R,z;t[8]===i?(R=t[9],z=t[10]):(R=()=>{if(!i)return;let e=!0,t=()=>{nm().then(t=>{e&&(t.ok?P(t.skills):(console.warn(`[skills-sidebar] listDetectedSkills failed:`,t),P([])))})};t();let n=Hs(t);return()=>{e=!1,n()}},z=[i],t[8]=i,t[9]=R,t[10]=z),(0,Q.useEffect)(R,z);let B;if(t[11]!==C){B=new Set;let e=new Set;for(let t of C){let n=`${t.scope}:${t.name}`;e.has(n)&&B.add(n),e.add(n)}t[11]=C,t[12]=B}else B=t[12];let V;t[13]===B?V=t[14]:(V=e=>B.has(`${e.scope}:${e.name}`)?e.hosts[0]:void 0,t[13]=B,t[14]=V);let H=V,U;t[15]===H?U=t[16]:(U=e=>`${e.scope}:${e.name}:${H(e)??``}`,t[15]=H,t[16]=U);let W=U,ee;t[17]!==W||t[18]!==C?(ee=C.map(W).join(`|`),t[17]=W,t[18]=C,t[19]=ee):ee=t[19];let G=ee,K;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(K={},t[20]=K):K=t[20];let[q,te]=(0,Q.useState)(K),[J,ne]=(0,Q.useState)(!1),re,ie;if(t[21]!==G||t[22]!==i?(re=()=>{if(!i)return;let e=!0,t=G?G.split(`|`):[],n=()=>{ne(!0),Promise.all(t.map(Z3)).then(t=>{e&&te(Object.fromEntries(t))}).catch(X3).finally(()=>{e&&ne(!1)})};n();let r=Hs(n);return()=>{e=!1,r()}},ie=[G,i],t[21]=G,t[22]=i,t[23]=re,t[24]=ie):(re=t[23],ie=t[24]),(0,Q.useEffect)(re,ie),!i)return null;let ae;t[25]!==o||t[26]!==p||t[27]!==h?(ae=e=>{o({kind:`doc`,target:e,docName:e},{tabBehavior:h}),bf(Cf(e)),p()},t[25]=o,t[26]=p,t[27]=h,t[28]=ae):ae=t[28];let oe=ae,se;t[29]===oe?se=t[30]:(se=e=>{oe($f(e))},t[29]=oe,t[30]=se);let ce=se,le;t[31]!==u||t[32]!==l||t[33]!==o||t[34]!==p||t[35]!==h?(le=e=>{if(e.flavor!==`explore`&&e.level){let t=sp(l,e.flavor,e.name,e.level);if(t){u(t),bf(Tf(e)),p();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:h}),bf(Tf(e)),p()},t[31]=u,t[32]=l,t[33]=o,t[34]=p,t[35]=h,t[36]=le):le=t[36];let ue=le,de;t[37]===ue?de=t[38]:(de=e=>{ue({flavor:`builtin`,source:Sp(e.absolutePath??``),name:e.name,subtitle:``,level:e.scope})},t[37]=ue,t[38]=de);let fe=de,pe;t[39]!==H||t[40]!==oe||t[41]!==o||t[42]!==p||t[43]!==h?(pe=(e,t)=>{let n=t.lastIndexOf(`.`),r=n>=0?t.slice(n+1).toLowerCase():``;if(!e.managed&&(r===`md`||r===`mdx`)){oe(pp(e,t));return}let i=H(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:h}),bf(Df({scope:e.scope,name:e.name,path:t,...i?{host:i}:{}})),p()},t[39]=H,t[40]=oe,t[41]=o,t[42]=p,t[43]=h,t[44]=pe):pe=t[44];let me=pe,he=(e,t)=>{let n=t.slice(t.lastIndexOf(`.`)+1).toLowerCase();return!e.managed&&(n===`md`||n===`mdx`)?s===pp(e,t):c?.kind===`skill-file`&&c.scope===e.scope&&c.name===e.name&&c.path===t},ge=e=>c?.kind===`doc`?s===$f(e):!1,_e=Y3,ve;t[45]===I?ve=t[46]:(ve=(e,t)=>{let n=_e(e);I[n]===void 0&&cm({source:t,name:e.name}).then(e=>{e.ok&&L(t=>({...t,[n]:e.files.map(J3)}))})},t[45]=I,t[46]=ve);let ye=ve,be;t[47]!==y||t[48]!==ye||t[49]!==ue||t[50]!==_||t[51]!==p||t[52]!==h?(be=(e,t)=>{let n=Sp(e.files.skillMd);ye(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){ue({flavor:i,source:n,name:e.name,subtitle:e.sourceHarness??``,level:$a(e.provenance.scope),...r===void 0?{}:{path:t}});return}let a=h===`replace-active`;_(e.name,n,{replaceActive:a,rel:r}).then(t=>{t.ok?p():Ns.error(y({id:`lwCV5v`,values:{0:e.name,1:t.error}}))})},t[47]=y,t[48]=ye,t[49]=ue,t[50]=_,t[51]=p,t[52]=h,t[53]=be):be=t[53];let xe=be,Se;t[54]===b?Se=t[55]:(Se=e=>[b[e],e],t[54]=b,t[55]=Se);let Ce=new Map(Ap.map(Se)),we;if(t[56]!==C){we=new Map;for(let e of C){let t=`${e.scope}\x00${Op(e.name)}`;we.set(t,(we.get(t)??0)+1)}t[56]=C,t[57]=we}else we=t[57];let Te;t[58]!==we||t[59]!==H?(Te=e=>{let t=Op(e.name),n=H(e);return n?`${e.name} (${n===`agents`?`.agents`:n})`:(we.get(`${e.scope}\x00${t}`)??0)>1?e.name:t},t[58]=we,t[59]=H,t[60]=Te):Te=t[60];let Ee=Te,De=new Map,ke=[],Ae,je=[],Me=new Map(Ap.map(q3));for(let e of Ap)ke.push(`${b[e]}/`),je.push(`${b[e]}/`);for(let e of C){let t=Ee(e);Me.get(e.scope)?.add(t);let n=`${b[e.scope]}/${t}`;De.set(n,e),ke.push(`${n}/${E3}`),ge(e)&&(Ae=`${n}/${E3}`,je.push(`${b[e.scope]}/`,`${n}/`));for(let t of q[W(e)]??[])ke.push(`${n}/${t.path}`),!Ae&&he(e,t.path)&&(Ae=`${n}/${t.path}`,je.push(`${b[e.scope]}/`,`${n}/`))}let Ne=new Set([...w.global,...w.project]),Pe=new Map,Fe=N??[];for(let e of Fe){if(Ne.has(e.name)||U3.has(e.name))continue;let t=$a(e.provenance.scope),n=Me.get(t);if(!n)continue;let r=Op(e.name);if(n.has(r)&&(r=e.name),n.has(r))continue;n.add(r);let i=`${b[t]}/${r}`;Pe.set(i,e),ke.push(`${i}/${E3}`),!Ae&&s===ta(e.name)&&(Ae=`${i}/${E3}`,je.push(`${b[t]}/`,`${i}/`));let a=I[_e(e)]??[];for(let e of a)ke.push(`${i}/${e}`);a.length>0&&je.push(`${i}/`)}for(let e of Ap)Me.get(e)?.size===0&&ke.push(`${b[e]}/${O3}`);let Ie=new Set;for(let e of Ap)Ie.add(`${b[e]}/`);for(let e of De.keys())Ie.add(`${e}/`);for(let e of Pe.keys())Ie.add(`${e}/`);for(let e of T)Ie.has(e)&&je.push(e);let Le=D3(Ce,Pe),Re;t[61]===C?Re=t[62]:(Re=C.map(K3).join(``),t[61]=C,t[62]=Re);let ze=`${Re}|d${Pe.size}`,Be=a.status===`loading`||J,Ve;t[63]===C?Ve=t[64]:(Ve=C.some(G3),t[63]=C,t[64]=Ve);let He;t[65]===Ve?He=t[66]:(He=(0,Z.jsx)($3,{hasProjectSkills:Ve}),t[65]=Ve,t[66]=He);let Ue;t[67]===Be?Ue=t[68]:(Ue=Be?(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)(xd,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`VeVIIk`})]}):null,t[67]=Be,t[68]=Ue);let We;t[69]===M?We=t[70]:(We=e=>M(e),t[69]=M,t[70]=We);let Ge;t[71]===A?Ge=t[72]:(Ge=(e,t)=>A({scope:e,tab:t}),t[71]=A,t[72]=Ge);let Ke;t[73]!==D||t[74]!==O||t[75]!==w||t[76]!==j||t[77]!==M?(Ke=j===null?null:(0,Z.jsx)(u3,{open:!0,scope:j,existingNames:w[j],busy:O,onOpenChange:e=>{e||M(null)},onCreate:e=>{let{name:t,description:n}=e,r=j;M(null),D(r,{name:t,description:n})}}),t[73]=D,t[74]=O,t[75]=w,t[76]=j,t[77]=M,t[78]=Ke):Ke=t[78];let qe;return t[79]!==k||t[80]!==g||t[81]!==A?(qe=k===null?null:(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(H3,{defaultScope:k.scope,defaultTab:k.tab,open:!0,onOpenChange:e=>{e||A(null)},onImported:e=>{let{scope:t,name:n}=e;A(null),g(t,n)}})}),t[79]=k,t[80]=g,t[81]=A,t[82]=qe):qe=t[82],(0,Z.jsxs)(MI,{className:`px-0`,children:[(0,Z.jsxs)(PI,{children:[He,Ue,(0,Z.jsx)(P3,{paths:ke,activePath:Ae,initialExpandedPaths:je,onExpandedChange:E,sort:Le,skillByPrefix:De,detectedByPrefix:Pe,labelToScope:Ce,scopeDescription:x,existingNames:w,actions:v,onOpenSkillMd:ce,onOpenFile:me,onOpenDetected:xe,onOpenManaged:fe,onNewSkill:We,onAddSkill:Ge},`${ke.join(`|`)}::${ze}`)]}),Ke,v.dialogs,qe]})}function G3(e){return e.scope===`project`&&!e.managed}function K3(e){return`${+!!e.installed}`}function q3(e){return[e,new Set]}function J3(e){return e.relPath}function Y3(e){return`${$a(e.provenance.scope)}::${e.name}`}function X3(e){console.error(`[skills-sidebar] unexpected error loading skill bundle files`,e)}function Z3(e){let[t,n,r]=e.split(`:`);return em(t,n,r||void 0).then(t=>(t.ok||console.warn(`[skills-sidebar] failed to load bundle files for ${e}:`,t.error),[e,t.ok?t.files:[]]))}function Q3(){return new Set}function $3(e){let t=(0,$.c)(12),{hasProjectSkills:n}=e,{_:r}=on(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),c,l;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=window.okDesktop?.sharing;if(!e)return;let t=!1,n=()=>{e.status().then(e=>{t||a(e.mode===`local-only`&&!e.skillsShared)}).catch(e6)};return n(),window.addEventListener(`focus`,n),()=>{t=!0,window.removeEventListener(`focus`,n)}},l=[],t[0]=c,t[1]=l):(c=t[0],l=t[1]),(0,Q.useEffect)(c,l),!n||i!==!0)return null;let u;t[2]!==r||t[3]!==o?(u=async()=>{let e=window.okDesktop?.sharing;if(!e||o)return;s(!0);let t=null,n=null;try{t=await e.setSkillsShared(!0)}catch(e){n=e}if(s(!1),n!==null){let e=n instanceof Error?n.message:``;Ns.error(e.startsWith(`ok:sharing:dispatch:`)?r({id:`qXN416`}):e||r({id:`K2v7QF`}));return}if(t!==null){if(t.kind===`applied`)Ns.success(r({id:`Q7cNKe`})),a(!1);else if(t.kind===`no-exclude`){let e=t.reason===`no-git`?r({id:`Xwump4`}):t.reason===`inaccessible`?r({id:`PlGC6r`}):r({id:`zcmYx4`});Ns.warning(r({id:`EARn6h`,values:{detail:e}}))}}},t[2]=r,t[3]=o,t[4]=u):u=t[4];let d=u,f;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`p`,{className:`mb-2 text-amber-900 dark:text-amber-200`,children:(0,Z.jsx)(Y,{id:`Bh9671`})}),t[5]=f):f=t[5];let p;t[6]===d?p=t[7]:(p=()=>void d(),t[6]=d,t[7]=p);let m;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(Y,{id:`TUzThQ`}),t[8]=m):m=t[8];let h;return t[9]!==o||t[10]!==p?(h=(0,Z.jsxs)(`div`,{className:`mx-2 mb-1 rounded-md border border-amber-300 bg-amber-50 p-2 text-xs dark:border-amber-700 dark:bg-amber-950`,children:[f,(0,Z.jsx)(X,{size:`sm`,className:`h-6 px-2 text-xs`,disabled:o,onClick:p,children:m})]}),t[9]=o,t[10]=p,t[11]=h):h=t[11],h}function e6(e){console.warn(JSON.stringify({event:`skills-share-status-read-failed`,error:e instanceof Error?e.message:String(e)}))}var t6=`ok-skills-section-visible-v1`;function n6(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}var r6;function i6(){if(r6===void 0){let e=n6()?.getItem(t6)??null;r6=e===`true`?!0:e===`false`?!1:null}return r6}function a6(e){if(r6!==e){r6=e;try{n6()?.setItem(t6,e?`true`:`false`)}catch{}}}var o6=6e4,s6=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=>um(e,n),o=e=>um(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 c6(e){let t=(0,$.c)(34),{version:n,onOpenReleaseNotes:r,onClose:i,store:a,autoDismissMs:o}=e,s=a===void 0?cV:a,c=o===void 0?o6:o,{_:l}=on(),[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)(LB,{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)(s6,{href:QB,label:l({id:`I7Exsw`}),icon:dV}),(0,Z.jsx)(s6,{href:XB,label:l({id:`zyKa-I`}),icon:Qy}),(0,Z.jsx)(s6,{href:ZB,label:l({id:`36aWJD`}),icon:uV})]}),t[16]=l,t[17]=u,t[18]=y):y=t[18];let b;t[19]!==y||t[20]!==v?(b=(0,Z.jsxs)(mH,{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)(hH,{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)(pH,{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 l6(e){let t=(0,$.c)(37),{notice:n,onDismiss:r}=e,{_:i}=on(),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)(hf,{"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 u6(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 d6(){let e=(0,$.c)(15),t=(0,Q.useSyncExternalStore)(XH,YH,YH),n;e[0]===t?n=e[1]:(n=u6(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=()=>JH(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)(c6,{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?.(),JH(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)(l6,{notice:r,onDismiss:i})}),e[12]=r,e[13]=i,e[14]=a):a=e[14],a}var f6={folderCount:0,expandedCount:0},p6=`button, [role="button"], [role="menuitem"], input, textarea, select, a[href]`;function m6(e){return typeof Element>`u`||!(e instanceof Element)?!1:e.closest(p6)!==null}function h6(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(bp,{name:`file-sidebar`,children:(0,Z.jsx)(_6,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var g6=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)(sr,{asChild:!0,children:(0,Z.jsx)(hi,{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)(cr,{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 _6(e){let t=(0,$.c)(239),{onOpenSearch:n}=e,{_:r}=on(),[i,a]=(0,Q.useState)(null),{activeDocName:o,activeTarget:s,skillFocused:c}=Oe(),l;t[0]!==o||t[1]!==s?(l=s?.kind===`folder`||s?.kind===`folder-index`?s.folderPath:Kf(o),t[0]=o,t[1]=s,t[2]=l):l=t[2];let u=l,d;t[3]===u?d=t[4]:(d=Yf(u)?``:u,t[3]=u,t[4]=d);let f=d,[p,m]=(0,Q.useState)(!1),h=p?``:f,g=typeof window<`u`&&window.okDesktop!=null,{state:_,toggleSidebar:v}=xI(),y=tn(),b=_===`expanded`,x=g&&_===`collapsed`,[S,C]=(0,Q.useState)(f6),w,T;t[5]===i?(w=t[6],T=t[7]):(w=()=>{if(i===null)return;let e=()=>{C(i.getFolderState()),m(i.isCreationTargetCleared())};return e(),i.subscribe(e)},T=[i],t[5]=i,t[6]=w,t[7]=T),(0,Q.useEffect)(w,T);let E,D;t[8]===i?(E=t[9],D=t[10]):(E=()=>{if(i!==null)return tD(e=>{let t=e.initialDir??``;if(e.template){i.createFromTemplate(e.template.folder,e.template.name);return}i.startCreating(e.kind??`file`,t)})},D=[i],t[8]=i,t[9]=E,t[10]=D),(0,Q.useEffect)(E,D);let O=S.folderCount>0,k=O&&S.expandedCount===S.folderCount,A=S.expandedCount===0,j=Wu(``),M=Wu(h===``?null:h),N=h===``?j:M,P=j.state.status===`ready`?(j.state.data.folder.templates_available?.length??0)>0:!0,F=N.state.status===`ready`?(N.state.data.folder.templates_available?.length??0)>0:!0,I=typeof window<`u`?window.okDesktop:void 0,L=Zc(),R;t[11]!==r||t[12]!==L?.contentDir?(R=I?.config?.projectName||L?.contentDir.split(`/`).filter(Boolean).pop()||r({id:`sER-bs`}),t[11]=r,t[12]=L?.contentDir,t[13]=R):R=t[13];let z=R,{status:B}=nl(),V=B?.hasRemote===!0,H=qn().states,{dispatch:U}=Tc(),W;t[14]===L?W=t[15]:(W=qc({workspace:L}),t[14]=L,t[15]=W);let ee=W,{projectLocalBinding:G,merged:K}=xc(),q=K?.appearance?.sidebar?.showHiddenFiles??!1,te=K?.appearance?.sidebar?.showOkFolders??!1,J=K?.appearance?.sidebar?.showOnlyMarkdownFiles??!1,ne=K?.appearance?.sidebar?.showSkillsSection,re;t[16]===ne?re=t[17]:(re=ne??i6()??!0,t[16]=ne,t[17]=re);let ie=re,ae,oe;t[18]===ne?(ae=t[19],oe=t[20]):(ae=()=>{ne!==void 0&&a6(ne)},oe=[ne],t[18]=ne,t[19]=ae,t[20]=oe),(0,Q.useEffect)(ae,oe);let se=c&&ie,ce=O&&!k,le=O&&!A,ue=ce||le,de=(0,Q.useRef)(!1),fe;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(fe=e=>{de.current&&(de.current=!1,e.preventDefault())},t[21]=fe):fe=t[21];let pe=fe,me;t[22]===se?me=t[23]:(me=e=>{if(se){e.preventDefault(),e.stopPropagation();return}e.target instanceof Element&&e.target.closest(`[data-sidebar-root-context]`)!==null||m6(e.target)&&(e.preventDefault(),e.stopPropagation())},t[22]=se,t[23]=me);let he=me,ge;t[24]!==i||t[25]!==L?(ge=()=>{L&&(de.current=!0,i?.startCreating(`file`,``))},t[24]=i,t[25]=L,t[26]=ge):ge=t[26];let _e=ge,ve;t[27]!==i||t[28]!==L?(ve=e=>{L&&(de.current=!0,i?.createFromTemplate(``,e))},t[27]=i,t[28]=L,t[29]=ve):ve=t[29];let ye=ve,be;t[30]!==i||t[31]!==L?(be=()=>{L&&(de.current=!0,i?.startCreating(`folder`,``))},t[30]=i,t[31]=L,t[32]=be):be=t[32];let xe=be,Se;t[33]===L?Se=t[34]:(Se=()=>{!L||!I||I.shell.showItemInFolder(L.contentDir)},t[33]=L,t[34]=Se);let Ce=Se,we;t[35]!==r||t[36]!==L?(we=async()=>{if(L)try{await navigator.clipboard.writeText(L.contentDir),Ns.success(r({id:`6_ZOw4`}),{description:L.contentDir})}catch(e){console.warn(`[FileSidebar] clipboard write failed:`,e),Ns.error(r({id:`vfRlCI`}))}},t[35]=r,t[36]=L,t[37]=we):we=t[37];let Te=we,Ee;t[38]!==r||t[39]!==V?(Ee=()=>{Xu({...$u(``),hasRemote:V,onClickWhenNoRemote:()=>{Ns.error(r({id:`WyQxwa`}))}},{clipboardWrite:nh,toastSuccess:x6,toastError:b6,logEvent:y6})},t[38]=r,t[39]=V,t[40]=Ee):Ee=t[40];let De=Ee,ke;t[41]!==r||t[42]!==G?(ke=e=>{if(G===null)return;let t=G.patch({appearance:{sidebar:e}});t.ok||(console.warn(`[FileSidebar] sidebar visibility toggle rejected:`,Ca(t.error)),Ns.error(r({id:`P47EWZ`}),{description:Ca(t.error)}))},t[41]=r,t[42]=G,t[43]=ke):ke=t[43];let Ae=ke,je;t[44]===i?je=t[45]:(je=()=>{i?.expandAll()},t[44]=i,t[45]=je);let Me=je,Ne;t[46]===i?Ne=t[47]:(Ne=()=>{i?.collapseAll()},t[46]=i,t[47]=Ne);let Pe=Ne,Fe,Ie;t[48]!==le||t[49]!==ce||t[50]!==q||t[51]!==te||t[52]!==J||t[53]!==ie||t[54]!==_?(Fe=()=>{let e={showHiddenFiles:q,showOkFolders:te,showOnlyMarkdownFiles:J,showSkillsSection:ie,canExpandAll:ce,canCollapseAll:le,sidebarVisible:_===`expanded`};Js(e),I&&I.editor.notifyViewMenuStateChanged(e)},Ie=[I,q,te,J,ie,ce,le,_],t[48]=le,t[49]=ce,t[50]=q,t[51]=te,t[52]=J,t[53]=ie,t[54]=_,t[55]=Fe,t[56]=Ie):(Fe=t[55],Ie=t[56]),(0,Q.useEffect)(Fe,Ie);let Le;t[57]!==r||t[58]!==s||t[59]!==U||t[60]!==H||t[61]!==h||t[62]!==Ae||t[63]!==q||t[64]!==te||t[65]!==J||t[66]!==ie||t[67]!==v||t[68]!==i||t[69]!==L?(Le=()=>Fn(e=>{let t=s!==null&&Yf(vL(s));switch(e){case`new-doc`:if(!L||!i)return;i.startCreating(`file`,h);return;case`new-folder`:if(!L||!i)return;i.startCreating(`folder`,h);return;case`new-from-template`:if(!L||!i)return;i.startCreatingFromTemplate(h);return;case`rename`:if(!s||t)return;OL(s);return;case`duplicate`:if(!s||t)return;AL(s);return;case`move-to-trash`:if(!s||t)return;EL(s);return;case`reveal-in-finder`:{if(!I||!L)return;let e=_L(s,L);I.shell.showItemInFolder(e);return}case`send-to-ai`:{let e=Wi.filter(e=>H[e.id]?.installed===!0);if(e.length===0){Ns.error(r({id:`LKOLNn`}));return}let t=yL(s,L);if(!t)return;let[n]=e;if(!n)return;U(n.id,t);return}case`copy-full-path`:{if(!L)return;let e=_L(s,L);navigator.clipboard.writeText(e).then(()=>Ns.success(r({id:`6_ZOw4`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),Ns.error(r({id:`vfRlCI`}))});return}case`copy-relative-path`:{let e=vL(s);if(e===``){Ns.error(r({id:`74eHt-`}));return}navigator.clipboard.writeText(e).then(()=>Ns.success(r({id:`haHgQj`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),Ns.error(r({id:`5QGTaA`}))});return}case`toggle-show-ok-folders`:Ae({showOkFolders:!te});return;case`toggle-show-hidden-files`:Ae({showHiddenFiles:!q});return;case`toggle-show-only-markdown-files`:Ae({showOnlyMarkdownFiles:!J});return;case`toggle-show-skills-section`:Ae({showSkillsSection:!ie});return;case`expand-all-tree`:i?.expandAll();return;case`collapse-all-tree`:i?.collapseAll();return;case`toggle-sidebar`:v();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]=U,t[60]=H,t[61]=h,t[62]=Ae,t[63]=q,t[64]=te,t[65]=J,t[66]=ie,t[67]=v,t[68]=i,t[69]=L,t[70]=Le):Le=t[70];let Re;t[71]!==r||t[72]!==s||t[73]!==U||t[74]!==H||t[75]!==h||t[76]!==G||t[77]!==q||t[78]!==te||t[79]!==J||t[80]!==ie||t[81]!==v||t[82]!==i||t[83]!==L?(Re=[I,i,L,s,h,G,q,te,J,ie,H,U,v,r],t[71]=r,t[72]=s,t[73]=U,t[74]=H,t[75]=h,t[76]=G,t[77]=q,t[78]=te,t[79]=J,t[80]=ie,t[81]=v,t[82]=i,t[83]=L,t[84]=Re):Re=t[84],(0,Q.useEffect)(Le,Re);let ze=g&&b&&`motion-safe:delay-100`,Be=x&&`opacity-0`,Ve;t[85]!==ze||t[86]!==Be?(Ve=Bn(`flex-row h-12 items-center py-0 pl-3 pr-2`,`justify-between`,g&&`overflow-x-clip`,g&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,ze,Be,g&&`[-webkit-app-region:drag]`),t[85]=ze,t[86]=Be,t[87]=Ve):Ve=t[87];let He;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(He=g?(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[88]=He):He=t[88];let Ue;t[89]===b?Ue=t[90]:(Ue=b&&!g?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:(0,Z.jsx)(Y,{id:`sER-bs`})}):null,t[89]=b,t[90]=Ue);let We;t[91]===b?We=t[92]:(We=g&&b?(0,Z.jsx)(AV,{}):null,t[91]=b,t[92]=We);let Ge;t[93]!==Ve||t[94]!==Ue||t[95]!==We?(Ge=(0,Z.jsxs)(kI,{"data-electron-drag":g?``:void 0,className:Ve,children:[He,Ue,We]}),t[93]=Ve,t[94]=Ue,t[95]=We,t[96]=Ge):Ge=t[96];let Ke=g&&b&&`motion-safe:delay-100`,qe=x&&`opacity-0`,Je;t[97]!==Ke||t[98]!==qe?(Je=Bn(`flex items-center gap-2 px-2 pb-0.5`,g&&`[-webkit-app-region:no-drag]`,g&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Ke,qe),t[97]=Ke,t[98]=qe,t[99]=Je):Je=t[99];let Ye;t[100]!==ie||t[101]!==c?(Ye=ie?(0,Z.jsx)(MU,{active:c?`skills`:`files`}):null,t[100]=ie,t[101]=c,t[102]=Ye):Ye=t[102];let Xe;t[103]===_?Xe=t[104]:(Xe=[_],t[103]=_,t[104]=Xe);let Ze;t[105]===n?Ze=t[106]:(Ze=(0,Z.jsx)(s3,{onClick:n,className:`ml-auto`}),t[105]=n,t[106]=Ze);let Qe;t[107]!==Xe||t[108]!==Ze?(Qe=(0,Z.jsx)(Pn,{fallbackRender:v6,onError:o3,resetKeys:Xe,children:Ze}),t[107]=Xe,t[108]=Ze,t[109]=Qe):Qe=t[109];let $e;t[110]!==Je||t[111]!==Ye||t[112]!==Qe?($e=(0,Z.jsxs)(`div`,{className:Je,children:[Ye,Qe]}),t[110]=Je,t[111]=Ye,t[112]=Qe,t[113]=$e):$e=t[113];let et;t[114]===Symbol.for(`react.memo_cache_sentinel`)?(et=(0,Z.jsx)(dH,{}),t[114]=et):et=t[114];let tt;t[115]!==ie||t[116]!==c?(tt=ie?(0,Z.jsx)(W3,{skillsMode:c}):null,t[115]=ie,t[116]=c,t[117]=tt):tt=t[117];let nt;t[118]!==r||t[119]!==F||t[120]!==h||t[121]!==Ae||t[122]!==G||t[123]!==z||t[124]!==le||t[125]!==ce||t[126]!==q||t[127]!==te||t[128]!==J||t[129]!==ie||t[130]!==ue||t[131]!==se||t[132]!==i?(nt=se?null:(0,Z.jsx)(pr,{defaultOpen:!0,className:`group/files flex min-h-0 flex-col data-[state=open]:min-h-48 data-[state=open]:flex-1`,children:(0,Z.jsxs)(MI,{className:`min-h-0 flex-1 px-0`,children:[(0,Z.jsxs)(NI,{className:`shrink-0 gap-1`,children:[(0,Z.jsxs)(fr,{"data-sidebar-root-context":!0,className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,Z.jsx)(Hl,{className:`size-4 shrink-0 text-tree-muted transition-transform group-data-[state=open]/files:rotate-90`}),(0,Z.jsx)(`span`,{className:`truncate text-sm font-normal text-muted-foreground`,children:z})]}),(0,Z.jsxs)(`div`,{role:`group`,"aria-label":r({id:`eaHUxx`}),"data-testid":`sidebar-toolbar`,className:Bn(`flex items-center gap-0.5`,g&&`[&>*]:[-webkit-app-region:no-drag]`),children:[se?null:(0,Z.jsxs)(xi,{children:[(0,Z.jsx)(g6,{icon:Uv,label:r({id:`Rq1vFD`})}),(0,Z.jsxs)(yi,{align:`end`,className:`min-w-52`,"data-testid":`tree-options-menu`,children:[ce?(0,Z.jsxs)(li,{onSelect:()=>i?.expandAll(),children:[(0,Z.jsx)(wy,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`OlAl5i`})]}):null,le?(0,Z.jsxs)(li,{onSelect:()=>i?.collapseAll(),children:[(0,Z.jsx)(Mv,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`qvWGzP`})]}):null,ue?(0,Z.jsx)(Si,{}):null,(0,Z.jsxs)(pi,{"aria-label":r({id:`8vETh9`}),children:[(0,Z.jsx)(_i,{children:(0,Z.jsx)(Y,{id:`8vETh9`})}),(0,Z.jsx)(gi,{checked:q,onCheckedChange:e=>Ae({showHiddenFiles:e}),disabled:G===null,"data-testid":`tree-options-show-hidden-files`,children:(0,Z.jsx)(Y,{id:`6KCH4m`})}),(0,Z.jsx)(gi,{checked:te,onCheckedChange:e=>Ae({showOkFolders:e}),disabled:G===null,"data-testid":`tree-options-show-ok-folders`,children:(0,Z.jsx)(Y,{id:`ELYtNJ`})}),(0,Z.jsx)(gi,{checked:J,onCheckedChange:e=>Ae({showOnlyMarkdownFiles:e}),disabled:G===null,"data-testid":`tree-options-show-only-markdown-files`,children:(0,Z.jsx)(Y,{id:`5-o4kO`})}),(0,Z.jsx)(gi,{checked:ie,onCheckedChange:e=>Ae({showSkillsSection:e}),disabled:G===null,"data-testid":`tree-options-show-skills`,children:(0,Z.jsx)(Y,{id:`PCSkw2`})})]})]})]}),se?null:(0,Z.jsx)(l3,{icon:df,label:r({id:`HdkSiO`}),onClick:()=>i?.startCreating(`file`,h),shortcutId:`new-item`}),!se&&F?(0,Z.jsxs)(xi,{children:[(0,Z.jsx)(g6,{icon:Kn,label:r({id:`Uuj_R4`})}),(0,Z.jsx)(yi,{align:`end`,className:`min-w-52`,onCloseAutoFocus:pe,children:(0,Z.jsx)(gL,{parentDir:h,onSelectTemplate:e=>{de.current=!0,i?.createFromTemplate(h,e)},ItemComponent:li})})]}):null,se?null:(0,Z.jsx)(l3,{icon:Pv,label:r({id:`96G6Re`}),onClick:()=>i?.startCreating(`folder`,h),shortcutId:g?`new-folder`:void 0})]})]}),(0,Z.jsx)(dr,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:(0,Z.jsx)(P2,{ref:a})})]})}),t[118]=r,t[119]=F,t[120]=h,t[121]=Ae,t[122]=G,t[123]=z,t[124]=le,t[125]=ce,t[126]=q,t[127]=te,t[128]=J,t[129]=ie,t[130]=ue,t[131]=se,t[132]=i,t[133]=nt):nt=t[133];let rt;t[134]!==tt||t[135]!==nt?(rt=(0,Z.jsxs)(jI,{children:[et,tt,nt]}),t[134]=tt,t[135]=nt,t[136]=rt):rt=t[136];let it;t[137]===Symbol.for(`react.memo_cache_sentinel`)?(it=(0,Z.jsxs)(AI,{className:`px-0`,children:[(0,Z.jsx)(O4,{}),(0,Z.jsx)(d6,{}),(0,Z.jsx)(AU,{}),typeof window<`u`&&window.okDesktop?(0,Z.jsx)(FI,{children:(0,Z.jsx)(II,{children:(0,Z.jsx)(Z4,{bridge:window.okDesktop})})}):null]}),t[137]=it):it=t[137];let at=!(y&&_===`collapsed`),ot;t[138]===at?ot=t[139]:(ot=(0,Z.jsx)(DI,{enableToggle:!1,enableDrag:at}),t[138]=at,t[139]=ot);let st;t[140]!==he||t[141]!==Ge||t[142]!==$e||t[143]!==rt||t[144]!==ot?(st=(0,Z.jsx)(ti,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`contents`,onContextMenu:he,children:[Ge,$e,rt,it,ot]})}),t[140]=he,t[141]=Ge,t[142]=$e,t[143]=rt,t[144]=ot,t[145]=st):st=t[145];let ct=!L,lt,ut;t[146]===Symbol.for(`react.memo_cache_sentinel`)?(lt=(0,Z.jsx)(df,{"aria-hidden":`true`}),ut=(0,Z.jsx)(Y,{id:`HdkSiO`}),t[146]=lt,t[147]=ut):(lt=t[146],ut=t[147]);let dt;t[148]!==_e||t[149]!==ct?(dt=(0,Z.jsxs)($r,{disabled:ct,onSelect:_e,"data-testid":`empty-space-menu-new-file`,children:[lt,ut]}),t[148]=_e,t[149]=ct,t[150]=dt):dt=t[150];let ft;t[151]!==ye||t[152]!==P||t[153]!==L?(ft=P?(0,Z.jsxs)(ei,{children:[(0,Z.jsxs)(ci,{disabled:!L,"data-testid":`empty-space-menu-new-from-template`,children:[(0,Z.jsx)(Kn,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`Uuj_R4`})]}),(0,Z.jsx)(ri,{children:(0,Z.jsx)(gL,{parentDir:``,onSelectTemplate:ye,ItemComponent:$r})})]}):null,t[151]=ye,t[152]=P,t[153]=L,t[154]=ft):ft=t[154];let pt=!L,mt,ht;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(mt=(0,Z.jsx)(Pv,{"aria-hidden":`true`}),ht=(0,Z.jsx)(Y,{id:`96G6Re`}),t[155]=mt,t[156]=ht):(mt=t[155],ht=t[156]);let gt;t[157]!==xe||t[158]!==pt?(gt=(0,Z.jsxs)($r,{disabled:pt,onSelect:xe,"data-testid":`empty-space-menu-new-folder`,children:[mt,ht]}),t[157]=xe,t[158]=pt,t[159]=gt):gt=t[159];let _t;t[160]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,Z.jsx)(oi,{}),t[160]=_t):_t=t[160];let vt;t[161]!==r||t[162]!==Ce||t[163]!==L?(vt=I?(0,Z.jsxs)($r,{disabled:!L,onSelect:Ce,"data-testid":`empty-space-menu-reveal-in-finder`,"aria-label":L?tg(I.platform):r({id:`NcUznW`,values:{0:tg(I.platform)}}),children:[(0,Z.jsx)(hd,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:tg(I.platform)}),L?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[161]=r,t[162]=Ce,t[163]=L,t[164]=vt):vt=t[164];let yt;t[165]!==U||t[166]!==ee||t[167]!==H?(yt=(0,Z.jsx)(Ic,{input:ee,installStates:H,dispatch:U}),t[165]=U,t[166]=ee,t[167]=H,t[168]=yt):yt=t[168];let bt;t[169]!==De||t[170]!==V?(bt=V?(0,Z.jsxs)($r,{onSelect:De,"data-testid":`empty-space-menu-share`,children:[(0,Z.jsx)(ef,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`Z8lGw6`})]}):null,t[169]=De,t[170]=V,t[171]=bt):bt=t[171];let xt=!L,St;t[172]!==r||t[173]!==L?(St=r(L?{id:`Up2_7p`}:{id:`U8CD-l`}),t[172]=r,t[173]=L,t[174]=St):St=t[174];let Ct;t[175]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=(0,Z.jsx)(Cu,{"aria-hidden":`true`}),t[175]=Ct):Ct=t[175];let wt;t[176]===Symbol.for(`react.memo_cache_sentinel`)?(wt=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`Up2_7p`})}),t[176]=wt):wt=t[176];let Tt;t[177]===L?Tt=t[178]:(Tt=L?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`wTcjov`})}),t[177]=L,t[178]=Tt);let Et;t[179]!==Te||t[180]!==xt||t[181]!==St||t[182]!==Tt?(Et=(0,Z.jsxs)($r,{disabled:xt,onSelect:Te,"data-testid":`empty-space-menu-copy-full-path`,"aria-label":St,children:[Ct,wt,Tt]}),t[179]=Te,t[180]=xt,t[181]=St,t[182]=Tt,t[183]=Et):Et=t[183];let Dt;t[184]===Symbol.for(`react.memo_cache_sentinel`)?(Dt=(0,Z.jsx)(oi,{}),t[184]=Dt):Dt=t[184];let Ot;t[185]===Ae?Ot=t[186]:(Ot=e=>Ae({showHiddenFiles:e}),t[185]=Ae,t[186]=Ot);let kt=G===null,At;t[187]===Symbol.for(`react.memo_cache_sentinel`)?(At=(0,Z.jsx)(Y,{id:`XcGbim`}),t[187]=At):At=t[187];let jt;t[188]!==q||t[189]!==Ot||t[190]!==kt?(jt=(0,Z.jsx)(ii,{checked:q,onCheckedChange:Ot,disabled:kt,"data-testid":`empty-space-menu-show-hidden-files`,children:At}),t[188]=q,t[189]=Ot,t[190]=kt,t[191]=jt):jt=t[191];let Mt;t[192]===Ae?Mt=t[193]:(Mt=e=>Ae({showOkFolders:e}),t[192]=Ae,t[193]=Mt);let Nt=G===null,Pt;t[194]===Symbol.for(`react.memo_cache_sentinel`)?(Pt=(0,Z.jsx)(Y,{id:`GHsJb8`}),t[194]=Pt):Pt=t[194];let Ft;t[195]!==te||t[196]!==Mt||t[197]!==Nt?(Ft=(0,Z.jsx)(ii,{checked:te,onCheckedChange:Mt,disabled:Nt,"data-testid":`empty-space-menu-show-ok-folders`,children:Pt}),t[195]=te,t[196]=Mt,t[197]=Nt,t[198]=Ft):Ft=t[198];let It;t[199]===Ae?It=t[200]:(It=e=>Ae({showOnlyMarkdownFiles:e}),t[199]=Ae,t[200]=It);let Lt=G===null,Rt;t[201]===Symbol.for(`react.memo_cache_sentinel`)?(Rt=(0,Z.jsx)(Y,{id:`WkTLN7`}),t[201]=Rt):Rt=t[201];let zt;t[202]!==J||t[203]!==It||t[204]!==Lt?(zt=(0,Z.jsx)(ii,{checked:J,onCheckedChange:It,disabled:Lt,"data-testid":`empty-space-menu-show-only-markdown-files`,children:Rt}),t[202]=J,t[203]=It,t[204]=Lt,t[205]=zt):zt=t[205];let Bt;t[206]===Ae?Bt=t[207]:(Bt=e=>Ae({showSkillsSection:e}),t[206]=Ae,t[207]=Bt);let Vt=G===null,Ht;t[208]===Symbol.for(`react.memo_cache_sentinel`)?(Ht=(0,Z.jsx)(Y,{id:`WkyP2p`}),t[208]=Ht):Ht=t[208];let Ut;t[209]!==ie||t[210]!==Bt||t[211]!==Vt?(Ut=(0,Z.jsx)(ii,{checked:ie,onCheckedChange:Bt,disabled:Vt,"data-testid":`empty-space-menu-show-skills-section`,children:Ht}),t[209]=ie,t[210]=Bt,t[211]=Vt,t[212]=Ut):Ut=t[212];let Wt;t[213]===ue?Wt=t[214]:(Wt=ue?(0,Z.jsx)(oi,{}):null,t[213]=ue,t[214]=Wt);let Gt;t[215]!==Me||t[216]!==ce?(Gt=ce?(0,Z.jsxs)($r,{onSelect:Me,"data-testid":`empty-space-menu-expand-all`,children:[(0,Z.jsx)(wy,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`OlAl5i`})]}):null,t[215]=Me,t[216]=ce,t[217]=Gt):Gt=t[217];let Kt;t[218]!==Pe||t[219]!==le?(Kt=le?(0,Z.jsxs)($r,{onSelect:Pe,"data-testid":`empty-space-menu-collapse-all`,children:[(0,Z.jsx)(Mv,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`qvWGzP`})]}):null,t[218]=Pe,t[219]=le,t[220]=Kt):Kt=t[220];let qt;t[221]!==dt||t[222]!==ft||t[223]!==gt||t[224]!==vt||t[225]!==yt||t[226]!==bt||t[227]!==Et||t[228]!==jt||t[229]!==Ft||t[230]!==zt||t[231]!==Ut||t[232]!==Wt||t[233]!==Gt||t[234]!==Kt?(qt=(0,Z.jsxs)(ai,{className:`min-w-52`,onCloseAutoFocus:pe,children:[dt,ft,gt,_t,vt,yt,bt,Et,Dt,jt,Ft,zt,Ut,Wt,Gt,Kt]}),t[221]=dt,t[222]=ft,t[223]=gt,t[224]=vt,t[225]=yt,t[226]=bt,t[227]=Et,t[228]=jt,t[229]=Ft,t[230]=zt,t[231]=Ut,t[232]=Wt,t[233]=Gt,t[234]=Kt,t[235]=qt):qt=t[235];let Jt;return t[236]!==st||t[237]!==qt?(Jt=(0,Z.jsx)(TI,{variant:`inset`,children:(0,Z.jsxs)(si,{children:[st,qt]})}),t[236]=st,t[237]=qt,t[238]=Jt):Jt=t[238],Jt}function v6(){return null}function y6(e){return console.log(e)}function b6(e){return Ns.error(e)}function x6(e){return Ns.success(e)}var S6=(0,Q.lazy)(()=>n(()=>import(`./McpConsentDialogBody-BSCT3OvM.js`),__vite__mapDeps([205,1,6,2,3,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,123,34,35,36,64,40,98,108,92,49,206,45]),import.meta.url));function C6(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(yg.subscribe,T6,w6))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)(S6,{})}),e[0]=t):t=e[0],t}function w6(){return!1}function T6(){return yg.getSnapshot()!==null}function E6(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(!1),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>Fn(e=>{e===`report-bug`&&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)($_,{open:t,onOpenChange:n}),e[2]=t,e[3]=a),a}function D6(){let e=(0,$.c)(17),t=xn(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=Oe(),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 Bp,i=new zp({url:n,name:Ya,document:e,onStateless:e=>{let{payload:t}=e;qp(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),Rs(e.docName)},onDerivedView:N6,onConfigValidationRejected:M6,onConfigIgnoreNestedError:j6,onUnknown:A6})},onClose:k6,onDisconnect:O6}),a=Ls(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`)&&Bm()}),o=ye(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{Fs([`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 O6(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function k6(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function A6(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function j6(e){Gu(e)}function M6(e){nd(e)}function N6(e){Fs([e.ch])}var P6=500,F6=750,I6=1200,L6=3,R6=1500;function z6(e){return!e.startsWith(`__`)&&!/\.(mmd|mermaid)$/i.test(e)}async function B6(e){let t=await au({kind:`project`},e);return e.aborted||t===null||t===`audit-superseded`?!1:(lu(t.files),!0)}function V6(){let e=(0,$.c)(13),{merged:t}=xc(),n=t?.validation?.fileTreeIndicators!==!1,r=t?.validation?.links!==`off`,i,a;e[0]===r?(i=e[1],a=e[2]):(i=()=>Pr(r),a=[r],e[0]=r,e[1]=i,e[2]=a),(0,Q.useLayoutEffect)(i,a);let o=ku()?.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=>{xu({kind:`doc`,docName:e}).then(n=>{t||n===null||n===`audit-superseded`||mu(e,n.files.filter(t=>Af(t.file)===e).flatMap(H6))})},i=Is(t=>{if(!z6(t))return;let n=e.get(t);n!==void 0&&clearTimeout(n),e.set(t,setTimeout(()=>{e.delete(t),r(t)},P6))});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,B6(e.signal).finally(()=>{t===e&&(t=null)})},i=()=>{e!==null&&clearTimeout(e),e=setTimeout(()=>{e=null,r()},F6)},a=[Lm(i),Us(i),Ls(e=>{zs(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,B6(e.signal).then(n=>{if(n){s.current=!0;return}if(!e.signal.aborted){if(r+=1,r>=L6){console.warn(`[audit] on-open audit exhausted retries; file-tree counts unavailable`);return}t=setTimeout(i,R6*2**(r-1))}})};return t=setTimeout(i,I6),()=>{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 H6(e){return e.diagnostics}function U6(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 W6(){let e=(0,$.c)(4),{collabUrl:t}=Oe(),{projectConfig:n}=xc(),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=vt(t);return U6({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 G6(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 K6(){let e=(0,$.c)(4),{collabUrl:t}=Oe(),{projectConfig:n}=xc(),r=n?.bridge?.flushOnHide?.enabled??!0,i,a;return e[0]!==t||e[1]!==r?(i=()=>{if(t===null)return;let e=vt(t);return e.setFlushOnHideEnabled(r),G6({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 q6=1e3,J6=3e4;function Y6(e){let t=e.scheduler??{setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e)},n=e.initialBackoffMs??q6,r=e.maxBackoffMs??J6,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 X6(e){if(e)return e.replace(/\/collab\/?$/,``)}function Z6(){return Jp(window)!==null}function Q6(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??Y6;if((i.current?.isElectronHost??Z6)())return;let t=e({resolveWsUrl:async()=>X6(r.current)});return()=>t.close()},c=[],n[3]=s,n[4]=c):(s=n[3],c=n[4]),(0,Q.useEffect)(s,c)}var $6=(0,Q.lazy)(()=>n(()=>import(`./ShareBranchSwitchDialog-DDrNzFpA.js`).then(e=>({default:e.ShareBranchSwitchDialog})),__vite__mapDeps([207,1,12,13,14,27,16,17,18,28,29,30,26,24,25,31,22,103,37,208,92,209,210,211,212,6,2,3,7,8,9,10,11,45]),import.meta.url)),e8=(0,Q.lazy)(()=>n(()=>import(`./ShareReceiveMissDialog-Bzfc6gmc.js`).then(e=>({default:e.ShareReceiveMissDialog})),__vite__mapDeps([213,1,27,12,13,14,16,17,18,28,29,30,26,24,25,31,22,214,141,6,2,3,7,8,9,10,11,91,45,74,92,93,94,95,96,106,70,64,21,41,108,37,208,146,46,49,68]),import.meta.url)),t8=`#install-claude-desktop`,n8=/\.(md|mdx)$/i;function r8(e){return Ts(e)||e===t8}function i8(e,t){if(!n8.test(e))return null;for(let n of t){let t=_p(n);if(t.kind===`doc`&&t.docName===e)return{kind:`doc`,target:e,docName:e}}return null}function a8(e,t,n,r){return[e,t,n,r].map(e=>[...e].sort().join(`\0`)).join(``)}function o8(){let e=(0,$.c)(30),{activeTabId:t,activeTarget:n,clearTarget:r,openTabs:i,syncOpenTabsWithKnownTargets:a,tabSessionLoaded:o}=Oe(),{openTargetTransition:s}=bt();Hc();let{assetPaths:c,filePaths:l,folderPaths:u,loading:d,pageMeta:f,pages:p,pagesBySlug:m,pagesByBasename:h}=Eu(),g=(0,Q.useRef)(null),_;e[0]!==c||e[1]!==l||e[2]!==u||e[3]!==p?(_=a8(p,u,c,l),e[0]=c,e[1]=l,e[2]=u,e[3]=p,e[4]=_):_=e[4];let v=_,y;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(y=[],e[5]=y):y=e[5],(0,Q.useEffect)(s8,y);let b,x;e[6]!==c||e[7]!==l||e[8]!==u||e[9]!==d||e[10]!==p||e[11]!==a||e[12]!==o||e[13]!==v?(b=()=>{d||!o||g.current===v||(g.current=v,a({pages:p,folderPaths:u,assetPaths:c,filePaths:l}))},x=[c,l,u,d,p,a,o,v],e[6]=c,e[7]=l,e[8]=u,e[9]=d,e[10]=p,e[11]=a,e[12]=o,e[13]=v,e[14]=b,e[15]=x):(b=e[14],x=e[15]),(0,Q.useEffect)(b,x);let S,C;return e[16]!==t||e[17]!==n||e[18]!==r||e[19]!==u||e[20]!==d||e[21]!==i||e[22]!==s||e[23]!==f||e[24]!==p||e[25]!==h||e[26]!==m||e[27]!==o?(S=()=>{if(!o&&window.okDesktop?.config.mode===`editor`)return;e();function e(){Pf();let e=e=>{cp(e)===t&&n?.kind===e.kind&&n.target===e.target||s(e,{disposition:`permanent`,consumeActiveNewTab:!0})};if(r8(window.location.hash))return;let a=yf(window.location.hash);if(a){let t=Lo(a.split(`.`).pop()??``);yp(`ok/nav/hash-change`,{docName:null,kind:`asset`}),e({kind:`asset`,target:a,assetPath:a,mediaKind:t});return}let o=_f(window.location.hash);if(o){yp(`ok/nav/hash-change`,{docName:null,kind:`skill-file`}),e({kind:`skill-file`,target:`${o.scope}/${o.name}${o.host?`:${o.host}`:``}/${o.path}`,scope:o.scope,name:o.name,path:o.path,...o.host?{host:o.host}:{}});return}if(Mf(window.location.hash)){yp(`ok/nav/hash-change`,{docName:null,kind:`skills`}),s({kind:`skills`,target:`skills`});return}let c=gf(window.location.hash);if(c){yp(`ok/nav/hash-change`,{docName:null,kind:`skill-preview`}),s({kind:`skill-preview`,target:`${c.flavor}/${c.source}/${c.name}`,flavor:c.flavor,source:c.source,name:c.name,subtitle:c.subtitle,level:c.level,path:c.path});return}if(vf(window.location.hash)){yp(`ok/nav/hash-change`,{docName:null,kind:`folder`}),e({kind:`folder`,target:``,folderPath:``});return}let l=kf(window.location.hash);if(!l){yp(`ok/nav/hash-change`,{docName:null,kind:`clear`}),r();return}if(d){yp(`ok/nav/hash-change`,{docName:l,kind:`deferred-loading`});return}let g=i8(l,i)??hp(l,{pages:p,folderPaths:u,pagesBySlug:m,pagesByBasename:h});if(g.kind===`missing`&&/\/+$/.test(l.trim())){yp(`ok/nav/hash-change`,{docName:l,kind:`deferred-missing-folder`});return}let _=ip(mp(g),f);yp(`ok/nav/hash-change`,{docName:l,kind:_.kind}),e(_)}return window.addEventListener(`hashchange`,e),()=>{window.removeEventListener(`hashchange`,e)}},C=[t,n,r,u,d,s,i,f,p,m,h,o],e[16]=t,e[17]=n,e[18]=r,e[19]=u,e[20]=d,e[21]=i,e[22]=s,e[23]=f,e[24]=p,e[25]=h,e[26]=m,e[27]=o,e[28]=S,e[29]=C):(S=e[28],C=e[29]),(0,Q.useEffect)(S,C),null}function s8(){return Fn(c8)}function c8(e){e===`navigate-back`&&window.history.back(),e===`navigate-forward`&&window.history.forward()}function l8(){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)(u8,t),null}function u8(){let e=function(e){if(rr())return;let t=e.target;Ds({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=ks))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function d8(){let e=(0,$.c)(4),{activeTarget:t}=Oe(),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 f8(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=Oe(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:Kf(t),e[0]=t,e[1]=n,e[2]=a):a=e[2];let o=a,s,c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=function(e){if(rr())return;let t=e.target;ex({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,key:e.key})&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},c=[],e[3]=s,e[4]=c):(s=e[3],c=e[4]),(0,Q.useEffect)(s,c);let l;return e[5]!==r||e[6]!==o?(l=(0,Z.jsx)(nx,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function p8(e){let t=(0,$.c)(5),{children:n}=e,{collabUrl:r}=Oe();Q6(r);let i,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(K6,{}),a=(0,Z.jsx)(W6,{}),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)(Gp,{collabUrl:r,children:[i,a,n]}),t[2]=n,t[3]=r,t[4]=o):o=t[4],o}function m8(e){let t=(0,$.c)(6),{children:n}=e,{merged:r}=xc(),{promoteAllPreviewTabs:i}=Oe(),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 h8(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(bp,{name:`app`,children:(0,Z.jsx)(It,{children:(0,Z.jsx)(p8,{children:(0,Z.jsx)(m8,{children:(0,Z.jsx)(Zx,{children:(0,Z.jsx)(g8,{})})})})})}),e[0]=t):t=e[0],t}function g8(){let e=(0,$.c)(33),t=typeof window<`u`?window.okDesktop??null:null,n=typeof window<`u`&&window.okDesktop!=null,[r,i]=(0,Q.useState)(!1),a=eS(),o=Tm(),s;e[0]===o?s=e[1]:(s=t&&t.config.ptyAvailable===!0?{launchInTerminal:_8,installedClis:o}:null,e[0]=o,e[1]=s);let c=s,l;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(jS,{}),e[2]=l):l=e[2];let u,d,f,p,m;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(D6,{}),d=(0,Z.jsx)(V6,{}),f=(0,Z.jsx)(o8,{}),p=(0,Z.jsx)(d8,{}),m=(0,Z.jsx)(f8,{}),e[3]=u,e[4]=d,e[5]=f,e[6]=p,e[7]=m):(u=e[3],d=e[4],f=e[5],p=e[6],m=e[7]);let h;e[8]===a?h=e[9]:(h=!a&&(0,Z.jsx)(l8,{}),e[8]=a,e[9]=h);let g,_,v,y,b,x,S;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(x=!1,S=t?(0,Z.jsx)(MS,{bridge:t}):null,g=t?(0,Z.jsx)(BS,{}):null,_=t?(0,Z.jsx)(E6,{}):null,v=t?(0,Z.jsx)(lH,{}):null,y=(0,Z.jsx)(C6,{}),b=t?(0,Z.jsxs)(Q.Suspense,{fallback:null,children:[(0,Z.jsx)($6,{bridge:t}),(0,Z.jsx)(e8,{})]}):null,e[10]=g,e[11]=_,e[12]=v,e[13]=y,e[14]=b,e[15]=x,e[16]=S):(g=e[10],_=e[11],v=e[12],y=e[13],b=e[14],x=e[15],S=e[16]);let C;e[17]===r?C=e[18]:(C=(0,Z.jsx)(bS,{bridge:t,open:r,onOpenChange:i}),e[17]=r,e[18]=C);let w;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(w=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[19]=w):w=e[19];let T;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Fy,{}),e[20]=T):T=e[20];let E;e[21]===a?E=e[22]:(E=!a&&(0,Z.jsx)(h6,{onOpenSearch:()=>i(!0)}),e[21]=a,e[22]=E);let D;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(OI,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(QV,{onOpenSearch:()=>i(!0)})}),e[23]=D):D=e[23];let O;e[24]===E?O=e[25]:(O=(0,Z.jsxs)(SI,{className:`h-screen overflow-hidden`,children:[E,D]}),e[24]=E,e[25]=O);let k;e[26]!==O||e[27]!==c?(k=(0,Z.jsxs)($n,{value:c,children:[T,O]}),e[26]=O,e[27]=c,e[28]=k):k=e[28];let A;return e[29]!==C||e[30]!==k||e[31]!==h?(A=(0,Z.jsxs)(Z.Fragment,{children:[l,(0,Z.jsxs)(Du,{children:[u,d,f,p,m,h,x,S,g,_,v,y,b,C,w,k]})]}),e[29]=C,e[30]=k,e[31]=h,e[32]=A):A=e[32],A}function _8(e,t){mc(Ec(e,t),t)}function v8(e){let t=/\/([^/]+?)(?:\.git)?\/?$/.exec(e);return t?t[1]:`repo`}function y8(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=v8(t),a=`${r.replace(/\/$/,``)}/${i}`,o=Ns.loading(Ms._({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);Ns.loading(Ms._({id:`GXf9hG`,values:{repoName:i}}),{id:o,description:Ms._({id:`SCzAbA`,values:{phase:t,pct:n}}),duration:1/0});continue}if(e.type===`branch-fallback`){console.log(xg({branch_action:`fallback`,branch:e.branch})),Ns.info(Ms._({id:`3JYy1p`,values:{0:e.branch}}),{duration:8e3});continue}if(e.type===`complete`)return Ns.success(Ms._({id:`IRv9cH`,values:{repoName:i}}),{id:o,duration:4e3}),{kind:`ok`,dir:e.dir};if(e.type===`error`)return Ns.dismiss(o),{kind:`error`,detail:e.message}}return Ns.dismiss(o),{kind:`error`,detail:Ms._({id:`PZt2Ds`})}}catch(e){console.warn(`[clone-controller] clone transport threw`,e);let t=e instanceof Error?e.message:Ms._({id:`29VNqC`});return Ns.dismiss(o),{kind:`error`,detail:t}}}}}function b8(){return{start(e){return Iu((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=Ms._({id:`ZSoojc`,values:{status:e}});try{let e=await r.json(),t=gs.safeParse(e);if(t.success){let e=t.data.title;n=Ms._({id:`OsSaYm`,values:{title:e}})}}catch{}t({type:`error`,message:n});return}if(!r.body){t({type:`error`,message:Ms._({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(`
2095
+ `);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||Ms._({id:`29VNqC`})});break}t(n)}if(n.aborted)break}n.aborted||t({type:`error`,message:Ms._({id:`Tz9pJB`})})}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;t({type:`error`,message:Ms._({id:`K9J00P`})})}})()})}}}function x8(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 S8(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 C8(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 w8(e){let t=(0,$.c)(100),{open:n,onOpenChange:r,onSignIn:i,onCloneComplete:a,transport:o,authQueryTransport:s,pickParentFolder:c,initialUrl:l}=e,{_:u}=on(),d;t[0]===o?d=t[1]:(d=o??b8(),t[0]=o,t[1]=d);let f=d,p;t[2]===s?p=t[3]:(p=s??Lu(),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=rd(),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=>{ed(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,H;t[17]!==l||t[18]!==n||t[19]!==h?(V=()=>{if(!n||!l||(_(l),h))return;let e=C8(l);e&&y(`~/Documents/${e}`)},H=[n,l,h],t[17]=l,t[18]=n,t[19]=h,t[20]=V,t[21]=H):(V=t[20],H=t[21]),(0,Q.useEffect)(V,H);let U,W;t[22]!==j||t[23]!==I?(U=()=>{j<0||document.getElementById(`${I}-opt-${j}`)?.scrollIntoView({block:`nearest`})},W=[j,I],t[22]=j,t[23]=I,t[24]=U,t[25]=W):(U=t[24],W=t[25]),(0,Q.useEffect)(U,W);let ee;t[26]===h?ee=t[27]:(ee=function(e){if(_(e),A(!0),M(-1),h)return;let t=C8(e);t&&y(`~/Documents/${t}`)},t[26]=h,t[27]=ee);let G=ee,K;t[28]===h?K=t[29]:(K=function(e){if(_(e.clone_url),h)return;let t=e.full_name.split(`/`)[1];y(`~/Documents/${t}`)},t[28]=h,t[29]=K);let q=K,te;t[30]!==u||t[31]!==v||t[32]!==a||t[33]!==r||t[34]!==c||t[35]!==f||t[36]!==g?(te=async function(){let e=g.trim();if(!e){Ns.error(u({id:`FTUGgh`}));return}let t=v||``;if(c){O(!0);let n=await c();if(!n){O(!1);return}let r=C8(e);t=`${n.replace(/\/$/,``)}/${r}`}else O(!0);let n=Ns.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(S8(i.phase));Ns.loading(`${e} — ${i.pct}%`,{id:n})}else if(i.type===`complete`){Ns.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;Ns.error(u({id:`eFJkVt`,values:{cloneError:e}}),{id:n}),O(!1),N.current=null;return}t=await e.next()}Ns.error(u({id:`Tz9pJB`}),{id:n}),O(!1),N.current=null}catch(e){console.error(`[CloneDialog] clone iteration failed:`,e),Ns.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]=te):te=t[37];let J=te,ne;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ne=function(){N.current?.(),N.current=null,O(!1),Ns.dismiss(P.current??void 0)},t[38]=ne):ne=t[38];let re=ne,ie;t[39]!==D||t[40]!==r||t[41]!==h?(ie=function(e){D||(r(e),e||(_(``),h||y(``),A(!1),M(-1)))},t[39]=D,t[40]=r,t[41]=h,t[42]=ie):ie=t[42];let ae=ie,oe;t[43]===q?oe=t[44]:(oe=function(e){q(e),A(!1),M(-1),F.current?.focus()},t[43]=q,t[44]=oe);let se=oe,ce=T===null||S&&b===null,le;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),le=n.filter(t=>`${t.full_name} ${t.clone_url}`.toLowerCase().includes(e)),t[45]=b,t[46]=g,t[47]=le}else le=t[47];let ue=le,de;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(de=/:\/\/|^git@|\.git$/i,t[50]=de):de=t[50];let fe;t[51]===g?fe=t[52]:(fe=de.test(g.trim()),t[51]=g,t[52]=fe);let pe=fe,me=T===!0&&b!==null&&ue.length===0&&!pe,he=k&&T!==!1&&!D&&(ce||ue.length>0||me),ge=ue.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]!==se||t[60]!==ue?(be=function(e){if(!D)if(e.key===`ArrowDown`){if(e.preventDefault(),!he){A(!0);return}M(e=>Math.min(e+1,ue.length-1))}else e.key===`ArrowUp`?(e.preventDefault(),M(A8)):e.key===`Enter`?he&&j>=0&&j<ue.length&&(e.preventDefault(),se(ue[j])):e.key===`Escape`&&he&&(e.preventDefault(),e.stopPropagation(),A(!1),M(-1))},t[56]=j,t[57]=D,t[58]=he,t[59]=se,t[60]=ue,t[61]=be):be=t[61];let xe=be,Se;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsx)(yr,{children:(0,Z.jsx)(hr,{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]!==ce||t[75]!==b||t[76]!==se||t[77]!==ue||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)(zf,{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)(Ln,{open:he,onOpenChange:A,children:[(0,Z.jsx)(Nn,{asChild:!0,children:(0,Z.jsx)(zf,{id:`clone-source`,ref:F,role:`combobox`,"aria-expanded":he,"aria-controls":he?ce?_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)(jn,{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:k8,onCloseAutoFocus:O8,onInteractOutside:e=>{F.current?.contains(e.target)&&e.preventDefault()},onWheel:D8,onTouchMove:E8,children:ce?(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)(Im,{className:`h-4 w-2/3`}),(0,Z.jsx)(Im,{className:`h-4 w-1/2`}),(0,Z.jsx)(Im,{className:`h-4 w-3/4`}),(0,Z.jsx)(Im,{className:`h-4 w-2/5`})]}):(0,Z.jsx)(`div`,{id:I,role:`listbox`,"aria-label":u({id:`KX1MZR`}),className:`py-1`,children:ue.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`})}):ue.map((e,t)=>(0,Z.jsxs)(`div`,{id:`${I}-opt-${t}`,role:`option`,tabIndex:-1,"aria-selected":t===j,onMouseDown:T8,onMouseEnter:()=>M(t),onClick:()=>se(e),className:Bn(`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)(Kv,{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)(Ou,{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]=ce,t[75]=b,t[76]=se,t[77]=ue,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)(zf,{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)(_r,{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]!==J||t[89]!==ae||t[90]!==g||t[91]!==h?(De=(0,Z.jsx)(vr,{children:D?(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:re,children:(0,Z.jsx)(Y,{id:`dEgA5A`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:()=>ae(!1),children:(0,Z.jsx)(Y,{id:`dEgA5A`})}),(0,Z.jsx)(X,{onClick:()=>void J(),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]=J,t[89]=ae,t[90]=g,t[91]=h,t[92]=De):De=t[92];let Oe;t[93]!==Ee||t[94]!==De?(Oe=(0,Z.jsxs)(gr,{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]!==ae||t[97]!==n||t[98]!==Oe?(ke=(0,Z.jsx)(br,{open:n,onOpenChange:ae,children:Oe}),t[96]=ae,t[97]=n,t[98]=Oe,t[99]=ke):ke=t[99],ke}function T8(e){return e.preventDefault()}function E8(e){return e.stopPropagation()}function D8(e){return e.stopPropagation()}function O8(e){return e.preventDefault()}function k8(e){return e.preventDefault()}function A8(e){return Math.max(e-1,-1)}var j8=(0,Q.lazy)(()=>n(()=>import(`./ConsentDialogBody-DfhGpXdb.js`),__vite__mapDeps([215,1,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,39,27,28,29,30,31,105,92,216,45,123,124,54,55,152,34,35,36,108,47,48]),import.meta.url));function M8(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(Rf.subscribe,P8,N8))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)(j8,{})}),e[0]=t):t=e[0],t}function N8(){return!1}function P8(){return Rf.getSnapshot()!==null}function F8(e){let t=(0,$.c)(5),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`OpenKnowledge icon`}),t[0]=n):n=t[0];let r;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`g`,{filter:`url(#filter0_d_ok)`,children:[(0,Z.jsx)(`path`,{d:`M66.8902 16.1017C58.2694 3.86669 46.1739 -0.690239 29.9182 2.17749C21.3995 3.67813 13.4602 9.555 8.67934 17.9009C3.93974 26.1701 2.98514 35.6533 6.05714 43.9166C9.31574 52.6868 16.7168 58.4752 24.2299 63.4231C25.7973 64.4562 26.1351 65.7172 26.3551 68.9896C26.5221 71.4625 26.799 75.6011 30.6842 77.7204C31.8176 78.3372 33.0648 78.6515 34.3946 78.6515C37.0796 78.6515 39.4033 77.3649 40.5189 76.7482C47.1049 73.1046 68.8878 59.7147 72.6453 40.4027C74.3444 31.6679 70.9797 21.9019 66.8922 16.1017H66.8902Z`,fill:`white`}),(0,Z.jsx)(`path`,{d:`M37.4214 71.154C28.7888 75.929 36.787 64.0397 27.7458 58.0843C21.6372 54.0616 14.788 49.0568 12.0499 41.6911C6.74463 27.4192 17.5438 10.8473 31.028 8.47262C45.1977 5.97613 54.6946 9.8947 61.6635 19.7844C65.2089 24.8167 67.6013 32.8365 66.3658 39.1828C63.6906 52.9341 49.073 64.7075 37.4214 71.154Z`,fill:`#69A3FF`}),(0,Z.jsx)(`path`,{d:`M52.7244 29.2638C53.4665 28.5217 54.6697 28.5217 55.4119 29.2638V29.2638C56.154 30.0059 56.154 31.2091 55.4119 31.9513L49.2589 38.1042L46.5715 35.4167L52.7244 29.2638Z`,fill:`#D5E5FF`}),(0,Z.jsx)(`path`,{d:`M55.4119 38.8821C56.154 39.6242 56.154 40.8274 55.4119 41.5696V41.5696C54.6698 42.3117 53.4665 42.3117 52.7244 41.5696L46.5715 35.4166L49.259 32.7292L55.4119 38.8821Z`,fill:`#D5E5FF`})]}),t[1]=r):r=t[1];let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`defs`,{children:(0,Z.jsxs)(`filter`,{id:`filter0_d_ok`,x:`-9.53674e-07`,y:`-0.0799994`,width:`77.3817`,height:`85.8743`,filterUnits:`userSpaceOnUse`,colorInterpolationFilters:`sRGB`,children:[(0,Z.jsx)(`feFlood`,{floodOpacity:`0`,result:`BackgroundImageFix`}),(0,Z.jsx)(`feColorMatrix`,{in:`SourceAlpha`,type:`matrix`,values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0`,result:`hardAlpha`}),(0,Z.jsx)(`feOffset`,{dy:`2.85714`}),(0,Z.jsx)(`feGaussianBlur`,{stdDeviation:`2.14286`}),(0,Z.jsx)(`feComposite`,{in2:`hardAlpha`,operator:`out`}),(0,Z.jsx)(`feColorMatrix`,{type:`matrix`,values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0`}),(0,Z.jsx)(`feBlend`,{mode:`normal`,in2:`BackgroundImageFix`,result:`effect1_dropShadow_ok`}),(0,Z.jsx)(`feBlend`,{mode:`normal`,in:`SourceGraphic`,in2:`effect1_dropShadow_ok`,result:`shape`})]})}),t[2]=i):i=t[2];let a;return t[3]===e?a=t[4]:(a=(0,Z.jsxs)(`svg`,{role:`img`,"aria-label":`OpenKnowledge icon`,fill:`none`,height:24,width:24,viewBox:`0 0 78 80`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r,i]}),t[3]=e,t[4]=a),a}var I8=(0,Q.lazy)(()=>n(()=>import(`./ShareReceiveDialog-CXNvnUuO.js`).then(e=>({default:e.ShareReceiveDialog})),__vite__mapDeps([217,1,6,2,3,7,8,9,10,11,12,13,14,27,16,17,18,28,29,30,26,24,25,31,22,37,92,209,211,212,45]),import.meta.url)),L8=(0,Q.lazy)(()=>n(()=>import(`./AppMenubar-CYaE7Hn6.js`).then(e=>({default:e.AppMenubar})),__vite__mapDeps([198,1,12,13,14,16,17,18,54,138,35,36,20,28,29,55,21,22,105,24,44,45,25,26]),import.meta.url)),R8=(e,t,n)=>Jx(e,t,n,`NavigatorApp`);function z8(e,t){return e.filter(e=>e.path!==t)}function B8(e){let t=(0,$.c)(157),{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)(!1),[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}=Dn(),{_:z}=on();Up(n,R??`system`);let B;t[2]===n.config.languagePreference?B=t[3]:(B=Hp(n.config.languagePreference)??Wp(),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),Vp(V);let H;t[6]!==z||t[7]!==n.project?(H=()=>{let e=!1;return n.project.listRecent().then(async t=>{if(e)return;a(t);let r=t.filter(V8),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]=H):H=t[8];let U;t[9]!==z||t[10]!==n?(U=[n,z],t[9]=z,t[10]=n,t[11]=U):U=t[11],(0,Q.useEffect)(H,U);let W,ee;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>Fn(e=>{e===`new-project`&&b(!0),e===`report-bug`&&S(!0),e===`send-feedback`&&w(!0),e===`close-active-tab-or-window`&&window.close()}),ee=[],t[12]=W,t[13]=ee):(W=t[12],ee=t[13]),(0,Q.useEffect)(W,ee);let G,K;t[14]===n?(G=t[15],K=t[16]):(K=()=>n.onRecentRemovedMissing(e=>{let{path:t}=e;a(e=>z8(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]=K),(0,Q.useEffect)(K,G);let q;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(q=(e,t)=>R8(e,t,m),t[17]=q):q=t[17];let te=q,J;t[18]!==z||t[19]!==n?(J=(e,t,r)=>te(()=>(g(r),K8(n,e,t).finally(()=>g(null))),z({id:`SUOoXn`})),t[18]=z,t[19]=n,t[20]=J):J=t[20];let ne=J,re;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(re=()=>v(!0),t[21]=re):re=t[21];let ie=re,ae;t[22]!==z||t[23]!==n?(ae=()=>te(async()=>{let e=await n.dialog.openFolder();e&&(g(q8(e)),await K8(n,e,`pick-existing`).finally(()=>g(null)))},z({id:`gmJ0An`})),t[22]=z,t[23]=n,t[24]=ae):ae=t[24];let oe=ae,se;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>b(!0),t[25]=se):se=t[25];let ce=se,le;t[26]!==z||t[27]!==n.project?(le=()=>te(()=>n.project.openFile(),z({id:`8vCZcs`})),t[26]=z,t[27]=n.project,t[28]=le):le=t[28];let ue=le,de;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(de=(e,t)=>{E(e),O(t),b(!0)},t[29]=de):de=t[29];let fe=de,pe;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(pe=e=>{b(e),e||(E(void 0),O(void 0))},t[30]=pe):pe=t[30];let me=pe,he;t[31]===ne?he=t[32]:(he=e=>ne(e,`recents`,q8(e)),t[31]=ne,t[32]=he);let ge=he,_e;t[33]!==z||t[34]!==n.project?(_e=e=>te(async()=>{await n.project.removeRecent(e),a(t=>z8(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:Hz()&&(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)(L8,{})})})}),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)(xd,{"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)(F8,{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)(wB,{})]}),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)(H8,{title:we,description:Te,onClick:ce,dataTestId:`nav-create-new`,Icon:Mn}),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]!==oe||t[56]!==De||t[57]!==Oe?(ke=(0,Z.jsx)(H8,{title:De,description:Oe,onClick:oe,dataTestId:`nav-open`,Icon:hd}),t[55]=oe,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]!==ue||t[64]!==Ae||t[65]!==je?(Me=(0,Z.jsx)(H8,{title:Ae,description:je,onClick:ue,dataTestId:`nav-open-file`,Icon:Rr}),t[63]=ue,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)(H8,{title:Ne,description:Pe,onClick:ie,dataTestId:`nav-clone`,Icon:Qy}),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)(W8,{onPackSelect:fe}):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)(xd,{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)(G8,{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)(C6,{}),Ue=(0,Z.jsx)(M8,{}),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)(Uy,{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;t[106]===x?Ge=t[107]:(Ge=(0,Z.jsx)($_,{open:x,onOpenChange:S,systemWide:!0}),t[106]=x,t[107]=Ge);let Ke;t[108]===C?Ke=t[109]:(Ke=(0,Z.jsx)(Gb,{open:C,onOpenChange:w,source:`help_menu`}),t[108]=C,t[109]=Ke);let qe;t[110]===N?qe=t[111]:(qe=e=>{A(e),e||(M(!1),N&&(N(null),P(null)))},t[110]=N,t[111]=qe);let Je;t[112]===n?Je=t[113]:(Je=Pu(n),t[112]=n,t[113]=Je);let Ye;t[114]===n?Ye=t[115]:(Ye=Hu(n),t[114]=n,t[115]=Ye);let Xe=I===`identity`,Ze;t[116]!==j||t[117]!==N?(Ze=e=>{A(!1),j&&(M(!1),v(!0)),N&&(N({authenticated:!0,host:`github.com`,login:e.login}),P(null))},t[116]=j,t[117]=N,t[118]=Ze):Ze=t[118];let Qe;t[119]!==k||t[120]!==qe||t[121]!==Je||t[122]!==Ye||t[123]!==Xe||t[124]!==Ze?(Qe=(0,Z.jsx)(Vu,{open:k,onOpenChange:qe,transport:Je,queryTransport:Ye,identityPrompt:Xe,onSuccess:Ze}),t[119]=k,t[120]=qe,t[121]=Je,t[122]=Ye,t[123]=Xe,t[124]=Ze,t[125]=Qe):Qe=t[125];let $e;t[126]===n?$e=t[127]:($e=x8(n),t[126]=n,t[127]=$e);let et;t[128]===n?et=t[129]:(et=Hu(n),t[128]=n,t[129]=et);let tt;t[130]===n.dialog?tt=t[131]:(tt=()=>n.dialog.openFolder(),t[130]=n.dialog,t[131]=tt);let nt;t[132]===Symbol.for(`react.memo_cache_sentinel`)?(nt=()=>{v(!1),L(`auth`),M(!0),A(!0)},t[132]=nt):nt=t[132];let rt;t[133]!==z||t[134]!==n?(rt=e=>{let{dir:t}=e;te(()=>(g(q8(t)),K8(n,t,`pick-existing`).finally(()=>g(null))),z({id:`iSnkwB`}))},t[133]=z,t[134]=n,t[135]=rt):rt=t[135];let it;t[136]!==_||t[137]!==$e||t[138]!==et||t[139]!==tt||t[140]!==rt?(it=(0,Z.jsx)(w8,{open:_,onOpenChange:v,transport:$e,authQueryTransport:et,pickParentFolder:tt,onSignIn:nt,onCloneComplete:rt}),t[136]=_,t[137]=$e,t[138]=et,t[139]=tt,t[140]=rt,t[141]=it):it=t[141];let at;if(t[142]!==n){let e;t[144]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>new Promise(e=>{P(()=>e),A(!0)}),t[144]=e):e=t[144],at=y8({bridge:n,authQueryTransport:Hu(n),cloneTransport:x8(n),openSignIn:e}),t[142]=n,t[143]=at}else at=t[143];let ot;t[145]!==n||t[146]!==at?(ot=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(I8,{bridge:n,cloneController:at})}),t[145]=n,t[146]=at,t[147]=ot):ot=t[147];let st;return t[148]!==be||t[149]!==Ve||t[150]!==We||t[151]!==Ge||t[152]!==Ke||t[153]!==Qe||t[154]!==it||t[155]!==ot?(st=(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,Ge,Ke,Qe,it,ot]}),t[148]=be,t[149]=Ve,t[150]=We,t[151]=Ge,t[152]=Ke,t[153]=Qe,t[154]=it,t[155]=ot,t[156]=st):st=t[156],st}function V8(e){return!e.missing}function H8(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 U8=3;function W8(e){let t=(0,$.c)(36),{onPackSelect:n}=e,{_:r}=on(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),c,l;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=!1;return(async()=>{try{let t=await Sx().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}},l=[],t[0]=c,t[1]=l):(c=t[0],l=t[1]),(0,Q.useEffect)(c,l),i===null||i.length===0)return null;let u,d,f,p,m,h,g;if(t[2]!==n||t[3]!==i){let e=i.slice(0,U8);u=i.length-e.length,d=e=>{s(!1),n(e,i)},m=`flex flex-wrap items-center gap-x-3 gap-y-2`,h=`nav-starter-packs`,t[11]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:(0,Z.jsx)(Y,{id:`C-xgad`})}),t[11]=g):g=t[11],f=`flex flex-wrap items-center gap-2`;let r;t[12]===d?r=t[13]:(r=e=>{let t=wx(e.id);return(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,className:`rounded-full`,onClick:()=>d(e.id),"data-testid":`nav-pack-pill-${e.id}`,children:[(0,Z.jsx)(t,{className:`size-3.5 text-muted-foreground`}),e.name]},e.id)},t[12]=d,t[13]=r),p=e.map(r),t[2]=n,t[3]=i,t[4]=u,t[5]=d,t[6]=f,t[7]=p,t[8]=m,t[9]=h,t[10]=g}else u=t[4],d=t[5],f=t[6],p=t[7],m=t[8],h=t[9],g=t[10];let _;t[14]!==r||t[15]!==u||t[16]!==i.length?(_=u>0?(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`sm`,className:`rounded-full`,onClick:()=>s(!0),"aria-label":r({id:`e4FxjG`,values:{0:i.length}}),"data-testid":`nav-pack-more`,children:(0,Z.jsx)(Y,{id:`B6Lac2`,values:{overflowCount:u}})}):null,t[14]=r,t[15]=u,t[16]=i.length,t[17]=_):_=t[17];let v;t[18]!==f||t[19]!==p||t[20]!==_?(v=(0,Z.jsxs)(`div`,{className:f,children:[p,_]}),t[18]=f,t[19]=p,t[20]=_,t[21]=v):v=t[21];let y;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(hr,{children:(0,Z.jsx)(Y,{id:`tcjTlU`})}),t[22]=y):y=t[22];let b;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsxs)(yr,{children:[y,(0,Z.jsx)(mr,{children:(0,Z.jsx)(Y,{id:`b6Fgpe`})})]}),t[23]=b):b=t[23];let x;t[24]!==i||t[25]!==d?(x=(0,Z.jsxs)(gr,{className:`sm:max-w-3xl`,"data-testid":`nav-pack-picker`,children:[b,(0,Z.jsx)(_r,{children:(0,Z.jsx)(Tx,{packs:i,onPackSelect:d})})]}),t[24]=i,t[25]=d,t[26]=x):x=t[26];let S;t[27]!==o||t[28]!==x?(S=(0,Z.jsx)(br,{open:o,onOpenChange:s,children:x}),t[27]=o,t[28]=x,t[29]=S):S=t[29];let C;return t[30]!==S||t[31]!==m||t[32]!==h||t[33]!==g||t[34]!==v?(C=(0,Z.jsxs)(`section`,{className:m,"data-testid":h,children:[g,v,S]}),t[30]=S,t[31]=m,t[32]=h,t[33]=g,t[34]=v,t[35]=C):C=t[35],C}function G8(e){let t=(0,$.c)(43),{project:n,branch:r,onOpen:i,onRemove:a}=e,{_:o}=on(),{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)(gd,{"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)(Mp,{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)($c,{"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:iS(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)($c,{"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)(hf,{"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)(sS,{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 K8(e,t,n){await e.project.open({path:t,target:`new-window`,entryPoint:n})}function q8(e){let t=e.split(/[/\\]/).filter(Boolean);return t.length>0?t[t.length-1]??e:e}var J8=(0,Q.lazy)(()=>n(()=>import(`./TerminalWindowApp-CYIfwjHf.js`).then(e=>({default:e.TerminalWindowApp})),__vite__mapDeps([218,1,91,2,6,3,7,8,9,10,11,45,74,14,24,13,92,18,93,94,95,96,201,134,12,180,16,17,138,35,36,20,54,28,29,55,21,22,105,25,26,137,99,125,30,34,56,142,116,40,202,37,203,136,117,43,42,31,132,47,48,159,160,200,204,161,77,219,220]),import.meta.url));function Y8(e){return e?.config.mode===`terminal`?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(J8,{bridge:e})}):e?.config.mode===`navigator`?(0,Z.jsx)(B8,{bridge:e}):(0,Z.jsx)(h8,{})}function X8(){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 Z8=X8();function Q8(e){return Z8.install(e)}function $8(e){let t=(0,$.c)(7),{bridge:n}=e,r=(0,Q.useSyncExternalStore)(Z8.subscribe,Z8.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}),Z8.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)($_,{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 e5=e=>{let t=(0,$.c)(8),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{theme:r}=Dn(),i=r===void 0?`system`:r,a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={success:(0,Z.jsx)(Au,{className:`size-4`}),info:(0,Z.jsx)(bd,{className:`size-4`}),warning:(0,Z.jsx)(pf,{className:`size-4`}),error:(0,Z.jsx)(Xv,{className:`size-4`}),loading:(0,Z.jsx)(xd,{"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)(Ps,{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},t5=Symbol.for(`ok.client.fetchWrapper`);function n5(e={}){if(typeof window>`u`)return;let t=e.apiOrigin&&e.apiOrigin.length>0?e.apiOrigin:void 0;if(window.fetch[t5])return;let n=window.fetch.bind(window),r=Yp(),i=((e,i)=>{let a=i5(e,t);if(!a.isApi)return n(e,i);if(e instanceof Request){let t=r5(e.headers,r);return n(new Request(a.url,e),{headers:t})}let o=r5(i?.headers,r);return n(a.url,{...i,headers:o})});i[t5]=!0,window.fetch=i}function r5(e,t){let n=new Headers(e);for(let[e,r]of Object.entries(t))n.set(e,r);return n}function i5(e,t){if(typeof e==`string`){if(e.startsWith(`/api/`))return{isApi:!0,url:t?t+e:e};let n=a5(e);return n&&o5(n,t)?{isApi:!0,url:e}:{isApi:!1,url:e}}let n=e instanceof URL?e:a5(e.url,window.location.origin);if(n&&o5(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 a5(e,t){try{return new URL(e,t)}catch{return null}}function o5(e,t){if(!e.pathname.startsWith(`/api/`))return!1;if(e.origin===window.location.origin||e.protocol===`file:`)return!0;if(t){let n=a5(t);if(n&&e.origin===n.origin)return!0}return!1}var s5=Symbol.for(`ok.client.logForwarder`),c5=2e3,l5=[`log`,`info`,`warn`,`error`],u5={log:`info`,info:`info`,warn:`warn`,error:`error`};function d5(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 f5(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 p5(e={}){let t=e.windowObj??(typeof window<`u`?window:void 0);if(!t||t.okDesktop)return;let n=t;if(n[s5])return;n[s5]=!0;let r=e.consoleObj??console,i=e.documentObj===void 0?typeof document<`u`?document:null:e.documentObj,a=e.flushIntervalMs??c5,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+=f5(e),c.length>100){let e=c.shift();e&&(l-=f5(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=fa(No(t.map(d5).join(` `))),r=t[0],i=typeof r==`string`&&r.length<=32768?r:void 0,a=i?ts(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 l5)r[e]=(...t)=>{p[e](...t),g(u5[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: ${d5(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 l5)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[s5]}return{flushNow:m,uninstall:x}}function m5(e,t){if(e.branch===void 0||e.branch===null||e.branch===``||t===``||e.multiCandidate!==!0)return null;let n=e.branch;return{message:Ms._({id:`n5Vy3l`,values:{branch:n}}),description:t}}function h5(e){let t=e.bridge;if(!t)return;let n=e.setHash??(e=>{window.location.hash=e}),r=e.emitToast??((e,t)=>{Ns(e,t)});return t.onDeepLink(e=>{let i=e.kind??`doc`,a={kind:i,path:e.doc,branch:e.branch??null};if(e.targetMissing===!0){Cd.arm(a);return}ud.arm(a),n(xf(i,e.doc,i===`doc`?e.branch:void 0));let o=m5(e,t.config.projectPath);o!==null&&r(o.message,{description:o.description,duration:3e3})})}var g5=4e3,_5=1440*60*1e3;function v5(e){let t=e.bridge;if(t&&t.onboarding)return t.onboarding.onToast(e=>{if(e.kind===`ancestor-promote`){let t=e.ancestorPath;Ns.success(Ms._({id:`hAbGf0`,values:{ancestorPath:t}}),{duration:g5});return}if(e.kind===`startup-reclaim`){let t=[];if(e.mcp.status===`repaired`){let n=e.mcp.editors.map(e=>_s[e]??e).join(`, `);t.push(Ms._({id:`FK57sK`,values:{names:n}}))}else e.mcp.status===`failed`&&t.push(Ms._({id:`DMLE5q`}));if(e.path.status===`installed`&&t.push(e.path.summary),e.path.status===`failed`){let n=e.path.summary;t.push(Ms._({id:`L83DKQ`,values:{summary:n}}))}let n=t.length>0?t.join(`; `):Ms._({id:`-X1eoK`}),r=e.mcp.status===`failed`||e.path.status===`failed`,i=e.path.status!==`none`;Ns[r?`error`:`success`](n,{duration:r||i?_5:g5,position:`bottom-left`});return}if(e.kind===`sharing-refused-tracked`){let t=e.tracked.length;Ns.error(Ms._({id:`LlJ8LD`,values:{trackedCount:t}}),{duration:_5,description:e.remediation});return}if(e.kind===`sharing-no-git`){Ns.warning(Ms._({id:`PaYmFG`}),{duration:g5});return}let t=Lf(e.gitRoot,e.pickedPath)??e.pickedPath,n=e.gitRoot;Ns.success(Ms._({id:`pZ91JC`,values:{gitRoot:n,subPath:t}}),{duration:g5})})}function y5(e){return Ms._({id:`wXw19Y`,values:{projectName:e}})}function b5(e){let t=e.bridge;if(t)return t.onRecentRemovedMissing(({projectName:e})=>{Ns(y5(e))})}function x5(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)(pf,{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 S5(){return Ms._({id:`f_PkYv`})}function C5(e){return e.serverRuntime===e.appRuntime?Ms._({id:`FWQuPE`,values:{0:e.appRuntime}}):e.relation===`older`?Ms._({id:`LhQlGR`,values:{0:e.serverRuntime,1:e.appRuntime}}):Ms._({id:`yZmvQ4`,values:{0:e.serverRuntime,1:e.appRuntime}})}function w5(e){return Ms._({id:`2YOwme`,values:{appRuntime:e}})}function T5(e){return e===`eperm`?Ms._({id:`uQewpR`}):Ms._({id:`PqYWiC`})}async function E5(e){let t=Ns.loading(Ms._({id:`Kf7GG5`}),{duration:1/0}),n;try{n=await e.restartServer(e.config.projectPath)}catch{return}Ns.dismiss(t),n.ok===!1&&Ns.error(T5(n.reason),{duration:1/0})}function D5(e){let t=e.bridge;if(!t)return;let n=t.onServerVersionDrift(e=>{Ns.custom(n=>(0,Q.createElement)(x5,{body:C5(e),warning:S5(),restartLabel:Ms._({id:`ppDgFi`}),cancelLabel:Ms._({id:`PBxg_E`}),onRestart:()=>{Ns.dismiss(n),E5(t)},onDismiss:()=>Ns.dismiss(n)}),{duration:1/0})}),r=t.onServerRestarted(e=>{Ns.success(w5(e.appRuntime))});return()=>{n(),r()}}async function O5(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 k5(e){let{initialDoc:t}=e;if(!t)return;let n=e.getHash();n!==``&&n!==`#`&&n!==`#/`||e.setHash(Cf(t))}function A5(){typeof window>`u`||!window.okDesktop||k5({initialDoc:window.okDesktop.config.initialDoc,getHash:()=>window.location.hash,setHash:e=>{window.location.hash=e}})}Cg(),n(()=>import(`./telemetry-startup-C8JOSRcr.js`).then(e=>e.initStartupTrace()),__vite__mapDeps([221,0,1,2,3,4,73,24,14,13]),import.meta.url),n5({apiOrigin:typeof window<`u`?window.okDesktop?.config.apiOrigin:void 0}),p5(),O5(),Hj()&&Jj(),ZH(),yA(),lV(),YB(),iB(),typeof window<`u`&&h5({bridge:window.okDesktop}),typeof window<`u`&&D5({bridge:window.okDesktop}),typeof window<`u`&&b5({bridge:window.okDesktop}),typeof window<`u`&&bg({bridge:window.okDesktop}),typeof window<`u`&&If({bridge:window.okDesktop}),typeof window<`u`&&v5({bridge:window.okDesktop}),typeof window<`u`&&Sg({bridge:window.okDesktop}),typeof window<`u`&&Q8({bridge:window.okDesktop}),A5();var j5=new kg({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),M5=document.getElementById(`root`);if(!M5)throw Error(`Root element not found`);var N5=typeof window>`u`?void 0:window.okDesktop;function P5(){return Zi(),null}(0,Ag.createRoot)(M5).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(sn,{i18n:Ms,children:(0,Z.jsxs)(vn,{client:j5,children:[(0,Z.jsx)(lv,{}),(0,Z.jsxs)(On,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(P5,{}),(0,Z.jsxs)(lr,{children:[(0,Z.jsx)(av,{children:Y8(N5)}),N5!==void 0&&(0,Z.jsx)(sv,{children:(0,Z.jsx)($8,{bridge:N5})})]}),(0,Z.jsx)(e5,{richColors:!0,closeButton:!0})]})]})})}));export{SU as t};