@inkeep/open-knowledge 0.42.0-beta.9 → 0.42.1

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 (119) hide show
  1. package/dist/{acp-harness-probe-DOzi_1ED.mjs → acp-harness-probe-BC8-tjIs.mjs} +2 -2
  2. package/dist/assets/skills/discovery/SKILL.md +1 -1
  3. package/dist/assets/skills/project/SKILL.md +1 -1
  4. package/dist/assets/skills/write-skill/SKILL.md +1 -1
  5. package/dist/cli.mjs +50 -50
  6. package/dist/constants-DafFdWJR.mjs +2 -0
  7. package/dist/{git-handle-B1TJqyoh.mjs → git-handle-BFhoHYr0.mjs} +2 -2
  8. package/dist/git-handle-CRnnMEIm.mjs +1 -0
  9. package/dist/index.mjs +1 -1
  10. package/dist/init-CY3jgzP0.mjs +1 -0
  11. package/dist/{init-CJBY0h7f.mjs → init-D7cD6zok.mjs} +4 -4
  12. package/dist/{launch-json-removal-CFvmMnMo.mjs → launch-json-removal-CTJjliTF.mjs} +2 -2
  13. package/dist/loader-BjQNNJAX.mjs +1 -0
  14. package/dist/{loader-CvlOZSkR.mjs → loader-CiE2EBJO.mjs} +2 -2
  15. package/dist/md-manager-CAqfesEA.mjs +2 -0
  16. package/dist/{open-browser-CXby8R3t.mjs → open-browser-Be1y1t9d.mjs} +2 -2
  17. package/dist/parse-worker.mjs +1 -1
  18. package/dist/preview-BMVXzzrS.mjs +1 -0
  19. package/dist/{preview-AkwIJF-W.mjs → preview-DXg4YbDp.mjs} +2 -2
  20. package/dist/public/assets/{ActivityModeContent-BYOU34x5.js → ActivityModeContent-CnhDNi-c.js} +1 -1
  21. package/dist/public/assets/{AgentDiffPane-CnYpYKgw.js → AgentDiffPane-BKvov9S5.js} +1 -1
  22. package/dist/public/assets/{AgentThreadClientBinder-aNRlyBpl.js → AgentThreadClientBinder-MaSL3zla.js} +1 -1
  23. package/dist/public/assets/{CodeMirrorPropInput-8sqIlsVF.js → CodeMirrorPropInput-ZGACWLSy.js} +1 -1
  24. package/dist/public/assets/{DocumentContext-D5LU2-RZ.js → DocumentContext-DDkluS7D.js} +20 -20
  25. package/dist/public/assets/{EditorModeToggle-D64ZxCxZ.js → EditorModeToggle-D0Db8Ydu.js} +1 -1
  26. package/dist/public/assets/{EnableSyncConfirmDialog-BeUuMUfa.js → EnableSyncConfirmDialog-B2sHRtLY.js} +1 -1
  27. package/dist/public/assets/FeedbackForm-DuEQbMOb.js +1 -0
  28. package/dist/public/assets/{GraphPanel-C_ZvUO1o.js → GraphPanel-1CKwHElx.js} +1 -1
  29. package/dist/public/assets/{LintConfigEditor-CmWBO8eN.js → LintConfigEditor-DKgxJcvl.js} +1 -1
  30. package/dist/public/assets/{ManagedArtifactProperties-hL8Gk4O1.js → ManagedArtifactProperties-9e_jj3hZ.js} +1 -1
  31. package/dist/public/assets/{McpConsentDialogBody-BqvQlEmy.js → McpConsentDialogBody-CYOKF_sf.js} +1 -1
  32. package/dist/public/assets/{MermaidDocEditor-C4nx_bCP.js → MermaidDocEditor-BNURUYJE.js} +1 -1
  33. package/dist/public/assets/{PropertyPanel-DlcDB4qF.js → PropertyPanel-BMIcO_AS.js} +1 -1
  34. package/dist/public/assets/{ReportBugDialogBody-Cz6r8X4G.js → ReportBugDialogBody-ByMe7BRT.js} +2 -2
  35. package/dist/public/assets/{SchemaConfigEditor-CRmLZgz9.js → SchemaConfigEditor-D7xbhgl6.js} +1 -1
  36. package/dist/public/assets/{SettingsDialogBody-DqSzMMsr.js → SettingsDialogBody-Bkz3Bpgp.js} +1 -1
  37. package/dist/public/assets/{ShareBranchSwitchDialog-CIds8xzv.js → ShareBranchSwitchDialog-C6G5A_aK.js} +1 -1
  38. package/dist/public/assets/{ShareReceiveDialog-BAEP9cfe.js → ShareReceiveDialog-DLEkjmkI.js} +1 -1
  39. package/dist/public/assets/{ShareReceiveMissDialog-DgHALd8T.js → ShareReceiveMissDialog-Ls1ECEge.js} +1 -1
  40. package/dist/public/assets/{SkillEditorActions-CJRnDLA3.js → SkillEditorActions-AGeWFFyT.js} +1 -1
  41. package/dist/public/assets/{SourceEditor-DBo24Kh4.js → SourceEditor-DI6JkRTr.js} +1 -1
  42. package/dist/public/assets/{TerminalPanel-DyeEsFY8.js → TerminalPanel-Bf_h8SIB.js} +1 -1
  43. package/dist/public/assets/{TerminalSessionsHost-C_Kpm1av.js → TerminalSessionsHost-B2cWbpj-.js} +2 -2
  44. package/dist/public/assets/{TerminalWindowApp-B2Q31qSO.js → TerminalWindowApp-2yCXBcQc.js} +1 -1
  45. package/dist/public/assets/ThreadView-D2BFrI_O.js +6 -0
  46. package/dist/public/assets/{TimelineDiffPane-94ZlUQPR.js → TimelineDiffPane-B9KqEt7q.js} +1 -1
  47. package/dist/public/assets/{agent-diff-store-Nx0XQusg.js → agent-diff-store-Bi0IQPgd.js} +1 -1
  48. package/dist/public/assets/{agent-visibility-CnzdlhVC.js → agent-visibility-HpfSUFqP.js} +1 -1
  49. package/dist/public/assets/{auth-state-cache-D-o9mDQf.js → auth-state-cache-BUVYaS5m.js} +1 -1
  50. package/dist/public/assets/client-version-FVbajnsJ.js +1 -0
  51. package/dist/public/assets/{config-provider-CGoD2yzK.js → config-provider-DIuwNlqX.js} +1 -1
  52. package/dist/public/assets/{dist-Dxs5l5f3.js → dist-Cal4LUep.js} +1 -1
  53. package/dist/public/assets/{doc-hash-BmhDnlQv.js → doc-hash-BSK-KaTu.js} +1 -1
  54. package/dist/public/assets/{documents-events-CnYTr2EX.js → documents-events-1HWCdfoh.js} +1 -1
  55. package/dist/public/assets/{file-tree-adapter-CqsJyRKs.js → file-tree-adapter-Dw7Dgyj1.js} +1 -1
  56. package/dist/public/assets/{file-tree-utils-DT-xGfQd.js → file-tree-utils-DiUPuK3N.js} +1 -1
  57. package/dist/public/assets/{globals-C6WpSvCs.js → globals-CXEWtNVL.js} +1 -1
  58. package/dist/public/assets/globals-GYHxaktb.css +1 -0
  59. package/dist/public/assets/index-Bh6-_Nba.js +2014 -0
  60. package/dist/public/assets/{lint-config-client-DWwcbNDR.js → lint-config-client-G_mrikOJ.js} +1 -1
  61. package/dist/public/assets/{markdownlint-rule-browser-FIuqfE86.js → markdownlint-rule-browser-rS3aDGOb.js} +1 -1
  62. package/dist/public/assets/{navigation-targets-WiJR7LAU.js → navigation-targets-Ci2h-vaL.js} +1 -1
  63. package/dist/public/assets/{open-managed-artifact-tab-epta6SQV.js → open-managed-artifact-tab-DfGutPkc.js} +1 -1
  64. package/dist/public/assets/{pending-receive-nav-store-DEu4B-Yy.js → pending-receive-nav-store-BuGLGemz.js} +1 -1
  65. package/dist/public/assets/{prop-types-Dq1Y_y68.js → prop-types-B-N3_i3c.js} +1 -1
  66. package/dist/public/assets/{receive-store-iF35zQOA.js → receive-store-CL0RH8Oa.js} +1 -1
  67. package/dist/public/assets/{selection-context-ES61tXh3.js → selection-context-zsjvL-8N.js} +1 -1
  68. package/dist/public/assets/{skill-actions-CnQNy6QY.js → skill-actions-C_5-d4BC.js} +1 -1
  69. package/dist/public/assets/{skills-api-D3bQVQ4F.js → skills-api-ChYiP1Zv.js} +1 -1
  70. package/dist/public/assets/{src-DL0JxhQ2.js → src-D8jPu2QV.js} +1 -1
  71. package/dist/public/assets/{tag-pill-input-DC-n23FS.js → tag-pill-input-B27HgfRy.js} +1 -1
  72. package/dist/public/assets/{target-navigation-intent-B61RCsTX.js → target-navigation-intent-ClG4AlV8.js} +1 -1
  73. package/dist/public/assets/{telemetry-impl-B0xfYfCD.js → telemetry-impl-DXiL3sBk.js} +1 -1
  74. package/dist/public/assets/{telemetry-startup-BYP0kNl2.js → telemetry-startup-Db44p95P.js} +1 -1
  75. package/dist/public/assets/{terminal-launch-events-CY0gttpS.js → terminal-launch-events-N4CMVbPT.js} +1 -1
  76. package/dist/public/assets/{terminal-telemetry-BO22BE3r.js → terminal-telemetry-DxTZB2oZ.js} +1 -1
  77. package/dist/public/assets/thread-client-CurKSSA8.js +1 -0
  78. package/dist/public/assets/{typing-burst-detector-CqVsFepb.js → typing-burst-detector-BP7d86JP.js} +1 -1
  79. package/dist/public/assets/{uninstall-CU9G6dEv.js → uninstall-DHjtqCbn.js} +1 -1
  80. package/dist/public/assets/{use-activity-panel-AnCM2KLb.js → use-activity-panel-35_3901z.js} +1 -1
  81. package/dist/public/assets/{use-apply-config-color-theme-r5IzVx3u.js → use-apply-config-color-theme-CK97Jvup.js} +1 -1
  82. package/dist/public/assets/{use-collab-url-C1DXOS9I.js → use-collab-url-D0INpn_f.js} +1 -1
  83. package/dist/public/assets/{use-live-xterm-theme-rgABb9gP.js → use-live-xterm-theme-C-fHLeXw.js} +1 -1
  84. package/dist/public/assets/{use-settings-route-B-L25JMs.js → use-settings-route-CXFzIfYo.js} +1 -1
  85. package/dist/public/assets/{use-terminal-enabled-8hGsIhI1.js → use-terminal-enabled-fhwpyN81.js} +1 -1
  86. package/dist/public/assets/{use-timeline-entry-diff-BigQON95.js → use-timeline-entry-diff-CHWJnnz2.js} +1 -1
  87. package/dist/public/assets/{use-workspace-NdYT_dp2.js → use-workspace-3T40FR83.js} +1 -1
  88. package/dist/public/assets/{workspace-paths-ai6F0DQ3.js → workspace-paths-B-NChZS2.js} +1 -1
  89. package/dist/public/index.html +37 -37
  90. package/dist/public/uninstall.html +4 -4
  91. package/dist/{repair-launch-json-CAdtcpGt.mjs → repair-launch-json-CyiLC6sz.mjs} +2 -2
  92. package/dist/{repair-mcp-configs-BlUiHB3J.mjs → repair-mcp-configs-MZhuDeWK.mjs} +2 -2
  93. package/dist/repair-skills-B1Zc-g_X.mjs +1 -0
  94. package/dist/{repair-skills-DllMOsvZ.mjs → repair-skills-CBmnNSO7.mjs} +2 -2
  95. package/dist/server-lock-DKRUWCqU.mjs +1 -0
  96. package/dist/{server-lock-Cr23NqXF.mjs → server-lock-vdpThyb4.mjs} +2 -2
  97. package/dist/{src-C4H4J7S8.mjs → src--Oy-0xgD.mjs} +2 -2
  98. package/dist/{src-CJ8mKCzo.mjs → src-DtcKZLt0.mjs} +87 -87
  99. package/dist/{src-CIFd3tOE.mjs → src-mOlBaMpr.mjs} +320 -320
  100. package/dist/{src-DHVO9P4d.mjs → src-o9XsfdYT.mjs} +1 -1
  101. package/dist/{start-DsU4nHte.mjs → start-BRjY-38U.mjs} +2 -2
  102. package/dist/start-BnM87E8e.mjs +1 -0
  103. package/dist/{write-project-skill-CeYehb7h.mjs → write-project-skill-B_HecSEZ.mjs} +4 -4
  104. package/package.json +4 -4
  105. package/dist/constants-BU4A6vbq.mjs +0 -2
  106. package/dist/git-handle-Dqp-QyuN.mjs +0 -1
  107. package/dist/init-Byoir7UR.mjs +0 -1
  108. package/dist/loader-BlJfxAty.mjs +0 -1
  109. package/dist/md-manager-B4llsKsm.mjs +0 -2
  110. package/dist/preview-ChQ6Nj5u.mjs +0 -1
  111. package/dist/public/assets/FeedbackForm-3Fe-DlHM.js +0 -1
  112. package/dist/public/assets/ThreadView-_sgiyOMC.js +0 -6
  113. package/dist/public/assets/client-version-CaNXATg1.js +0 -1
  114. package/dist/public/assets/globals-DF_8aGgC.css +0 -1
  115. package/dist/public/assets/index-e9suledE.js +0 -2014
  116. package/dist/public/assets/thread-client-CXDtD9Ce.js +0 -1
  117. package/dist/repair-skills-Buq5QlSJ.mjs +0 -1
  118. package/dist/server-lock-D335a5oG.mjs +0 -1
  119. package/dist/start-BcW2zDmT.mjs +0 -1
@@ -0,0 +1,2014 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-DXiL3sBk.js","./chunk-CYidjpOJ.js","./preload-helper-Chd9yIcd.js","./trace-api-DHyWZzIa.js","./propagation-api-OHat7V1z.js","./ReportBugDialogBody-ByMe7BRT.js","./dist-Cal4LUep.js","./lib-Iu39CNZE.js","./markdownit-YwcN3EvW.js","./w3c-keyname-DtWCia6R.js","./dist-Nvb76hAm.js","./jsx-runtime-BUgB2tll.js","./react-f2sANaYj.js","./checkbox-DY-vIhnZ.js","./dist-D6h-uzOv.js","./createLucideIcon-DAkhoPjT.js","./bundle-mjs-SHeFpKGC.js","./react-dom-DPxgxlDT.js","./dist-DFt8VaPU.js","./dist-DEamjSXE.js","./check-GqWaoTdV.js","./minus-SecfYzeQ.js","./compiler-runtime-BfE3aGVn.js","./dialog-TkFkuYVg.js","./dist-BNcdLYQI.js","./es2015-BNlmLq62.js","./button-Gol9BgNB.js","./x-DVkpYo5d.js","./CopyButton-1Q6Wnnjb.js","./tooltip-B4J7VHmA.js","./dist-nHZgBxFS.js","./floating-ui.dom-DxCSXcm6.js","./copy-9EDFYcyR.js","./loader-circle-Cg5SU7AZ.js","./BugReportHistory-B0qbbAw0.js","./collapsible-B1mS1n9y.js","./chevron-down-Bx9f3tW-.js","./folder-open-wLd69QUc.js","./trash-2-BUuL4OCw.js","./badge-Dba4cvJR.js","./triangle-alert-Clgvyc7B.js","./input-D0ZW0Opq.js","./textarea-RSYJwPz9.js","./external-link-T4Nj1gcG.js","./clipboard-adapter--Ja4oXEM.js","./BugReportHistoryDialog-B5Yf5rAM.js","./GraphPanel-1CKwHElx.js","./dist-q14fBS3T.js","./toggle-group-CjXmmTGy.js","./dist-BjDuLI_j.js","./dist-DAU1MdSo.js","./useQuery-ZeEDLtxh.js","./min-Bd9Lorof.js","./src-BaTc8y5c.js","./colors-C1oQkVlI.js","./ordinal-DrDHGs3t.js","./init-BX0_4ZBD.js","./isObject-BkQ5hIlp.js","./now-Ck_JVNC2.js","./arrow-up-right-obRIg3Sv.js","./prop-types-B-N3_i3c.js","./navigation-targets-Ci2h-vaL.js","./file-tree-utils-DiUPuK3N.js","./doc-hash-BSK-KaTu.js","./documents-events-1HWCdfoh.js","./documents-fetch-CLL0O1of.js","./parse-api-error-C_gwkKmG.js","./startup-marks-CqVzdU1y.js","./dist-PQ5KMVDh.js","./target-navigation-intent-ClG4AlV8.js","./panel-Cyobla0Z.js","./ActivityModeContent-CnhDNi-c.js","./DocumentContext-DDkluS7D.js","./esm-HV7Pxfbn.js","./dist-DNwOaDhC.js","./dist-CP0xcBf_.js","./dist-ioWbCXab.js","./dist-DifRwKW-.js","./dist-BObw0jPE.js","./dist-CiPafPDy.js","./dist-BR00oFrA2.js","./dist-DGzvBIzr.js","./dist-C7rVxfRB.js","./stex-CniH6-Mv.js","./config-provider-DIuwNlqX.js","./client-version-FVbajnsJ.js","./use-apply-config-color-theme-CK97Jvup.js","./config-context-gd3BC-iY.js","./switch-DYic2V-1.js","./terminal-input-events-C5UuEsAB.js","./CodeMirrorPropInput-ZGACWLSy.js","./git-branch-CMJAiYLz.js","./chevron-right-C8oTR6gu.js","./workspace-paths-B-NChZS2.js","./eye-CASw1HTi.js","./hash-DNKDqZ18.js","./info-yKMseklR.js","./paperclip-CX7J_G-w.js","./sliders-horizontal-34K0eDW2.js","./dist-BLAMau9Z.js","./file-tree-rename-validation-wADtjYEi.js","./use-collab-url-D0INpn_f.js","./DocumentContext-B0sQn39F.css","./timeline-diff-store-CYckprSS.js","./agent-diff-store-Bi0IQPgd.js","./cursor-C1n4GZG0.js","./copilot-BAzfPGty.js","./use-activity-panel-35_3901z.js","./agent-presence-CTJkQnoU.js","./lru-string-cache-hwDoWobi.js","./SettingsDialogBody-Bkz3Bpgp.js","./sortable.esm-B6whf_t-.js","./dropdown-menu-xw8WTdb-.js","./dist-BJa2CfR3.js","./label-DyipnO5I.js","./radio-group-CGEdWasQ.js","./separator-DExEeoYE.js","./EnableSyncConfirmDialog-B2sHRtLY.js","./RegisteredAgentIcon-8Tcfr3WP.js","./skill-actions-C_5-d4BC.js","./refresh-cw-BfeWGCsv.js","./agent-visibility-HpfSUFqP.js","./use-settings-route-CXFzIfYo.js","./skills-api-ChYiP1Zv.js","./use-workspace-3T40FR83.js","./auth-state-cache-BUVYaS5m.js","./square-pen-C1vIlMAW.js","./open-managed-artifact-tab-DfGutPkc.js","./field-DVIFAnvR.js","./form-D-z6QdLf.js","./ConfigSharingInfoTooltip-DMbsfWD9.js","./schema-fields-view-intent-Dz1ZzVCe.js","./lint-plugin-meta-B3N1DKgL.js","./markdownlint-rule-browser-rS3aDGOb.js","./skeleton-HLkcMp95.js","./tag-pill-input-B27HgfRy.js","./lint-config-client-G_mrikOJ.js","./use-terminal-enabled-fhwpyN81.js","./terminal-telemetry-DxTZB2oZ.js","./ManagedArtifactProperties-9e_jj3hZ.js","./PropertyPanel-BMIcO_AS.js","./format-BVhfvqw3.js","./braces-DwnwFx_V.js","./selection-context-zsjvL-8N.js","./MermaidDocEditor-BNURUYJE.js","./dist-B1qkpf98.js","./src-D8jPu2QV.js","./SourceEditor-DI6JkRTr.js","./typing-burst-detector-BP7d86JP.js","./wrench-BfoTvqT9.js","./SkillEditorActions-AGeWFFyT.js","./LintConfigEditor-DKgxJcvl.js","./EditorModeToggle-D0Db8Ydu.js","./useLintConfigViewMode-BYm6FwC5.js","./SchemaConfigEditor-D7xbhgl6.js","./case-sensitive-nl0tWMnZ.js","./TimelineDiffPane-B9KqEt7q.js","./use-timeline-entry-diff-CHWJnnz2.js","./libesm-CHqp8owk.js","./panel-right-open-B7ziq39V.js","./AgentDiffPane-BKvov9S5.js","./AppMenubar-CXadCCMc.js","./AgentThreadClientBinder-MaSL3zla.js","./thread-client-CurKSSA8.js","./TerminalSessionsHost-B2cWbpj-.js","./terminal-launch-events-N4CMVbPT.js","./thread-draft-staging-B4_1TigQ.js","./McpConsentDialogBody-CYOKF_sf.js","./mcp-consent-store-Xk9UA_MB.js","./ShareBranchSwitchDialog-C6G5A_aK.js","./miss-dialog-store-Bx4JLuKB.js","./share-metadata-rows-BlaR96La.js","./desktop-bridge-types--ZPzhkC9.js","./receive-store-CL0RH8Oa.js","./worktree-store-LSx9q9Ga.js","./ShareReceiveMissDialog-Ls1ECEge.js","./pending-receive-nav-store-BuGLGemz.js","./ConsentDialogBody-BjbzWR8D.js","./project-paths-Dwo4Of8C.js","./ShareReceiveDialog-DLEkjmkI.js","./TerminalWindowApp-2yCXBcQc.js","./use-live-xterm-theme-C-fHLeXw.js","./use-installed-clis-B_nDAq7A.js","./telemetry-startup-Db44p95P.js"])))=>i.map(i=>d[i]);
2
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./globals-CXEWtNVL.js";import{t as n}from"./preload-helper-Chd9yIcd.js";import{t as r}from"./jsx-runtime-BUgB2tll.js";import{$ as i,$t as a,A as o,At as s,B as c,Bt as l,C as u,Ct as d,D as f,Dt as p,E as m,Et as h,F as g,Ft as _,G as v,H as y,Ht as b,I as x,It as S,J as C,Jt as w,K as T,Kt as E,L as D,Lt as O,M as k,Mt as A,N as j,Nt as M,O as N,Ot as P,P as F,Pt as I,Q as L,Qt as R,R as z,Rt as B,S as V,St as H,Tt as U,U as ee,Ut as W,V as G,Vt as K,W as te,Wt as ne,X as q,Xt as re,Y as ie,Yt as ae,Z as oe,Zt as se,_t as ce,a as le,an as ue,at as de,bt as fe,c as pe,ct as me,d as he,dn as ge,dt as _e,en as ve,et as ye,f as be,ft as xe,g as Se,gt as Ce,h as we,ht as Te,i as Ee,in as De,it as Oe,j as ke,jt as Ae,k as je,kt as Me,l as Ne,ln as Pe,lt as Fe,m as Ie,mt as Le,n as Re,nn as ze,o as Be,ot as Ve,p as He,pt as Ue,q as We,qt as Ge,r as Ke,rn as qe,s as Je,sn as Ye,st as Xe,t as Ze,tn as Qe,tt as $e,u as et,un as tt,ut as nt,v as rt,vt as it,w as at,wt as ot,x as st,xt as ct,y as lt,yt as ut,z as dt,zt as ft}from"./DocumentContext-DDkluS7D.js";import{t as pt}from"./react-f2sANaYj.js";import{n as J,r as mt,t as ht}from"./dist-Nvb76hAm.js";import{_ as gt,a as _t,c as vt,d as yt,f as bt,g as xt,h as St,i as Ct,l as wt,m as Tt,n as Et,o as Dt,p as Ot,r as kt,s as At,t as jt,u as Mt,v as Nt,y as Pt}from"./useQuery-ZeEDLtxh.js";import{n as Ft,t as It}from"./dist-PQ5KMVDh.js";import{t as Lt}from"./react-dom-DPxgxlDT.js";import{t as Rt}from"./compiler-runtime-BfE3aGVn.js";import{a as zt,c as Bt,i as Vt,l as Ht,o as Ut,r as Wt,s as Gt,t as Kt,u as qt}from"./terminal-input-events-C5UuEsAB.js";import{n as Jt,s as Y,t as Yt}from"./createLucideIcon-DAkhoPjT.js";import{n as Xt,r as Zt,t as X}from"./button-Gol9BgNB.js";import{c as Qt,i as $t,l as en,o as tn,t as nn}from"./dist-D6h-uzOv.js";import{i as rn,n as an,r as on,t as sn}from"./tooltip-B4J7VHmA.js";import{n as cn,r as ln,t as un}from"./collapsible-B1mS1n9y.js";import{a as dn,c as fn,i as pn,n as mn,o as hn,s as gn,t as _n}from"./dialog-TkFkuYVg.js";import{$ as vn,A as yn,B as bn,C as xn,E as Sn,G as Cn,H as wn,K as Tn,N as En,Q as Dn,T as On,U as kn,X as An,_ as jn,b as Mn,ct as Nn,dt as Pn,et as Fn,f as In,ft as Ln,k as Rn,l as zn,lt as Bn,m as Vn,q as Hn,st as Un,tt as Wn,u as Gn,ut as Kn,z as qn}from"./CodeMirrorPropInput-ZGACWLSy.js";import{t as Jn}from"./checkbox-DY-vIhnZ.js";import{a as Yn,d as Xn,i as Zn,l as Qn,n as $n,o as er,r as tr,s as nr,t as rr,u as ir}from"./floating-ui.dom-DxCSXcm6.js";import{_ as ar,a as or,c as sr,d as cr,f as lr,g as ur,h as dr,i as fr,l as pr,m as mr,n as hr,o as gr,p as _r,r as vr,s as yr,t as br,u as xr}from"./dist-BJa2CfR3.js";import{a as Sr,d as Cr,f as wr,i as Tr,m as Er,n as Dr,o as Or,p as kr,r as Ar,s as jr,t as Mr,u as Nr}from"./dropdown-menu-xw8WTdb-.js";import{t as Pr}from"./label-DyipnO5I.js";import{c as Fr,s as Ir}from"./switch-DYic2V-1.js";import{n as Lr,t as Rr}from"./radio-group-CGEdWasQ.js";import{t as zr}from"./separator-DExEeoYE.js";import{n as Br,r as Vr,t as Hr}from"./toggle-group-CjXmmTGy.js";import{C as Ur,S as Wr,a as Gr,b as Kr,c as qr,f as Jr,h as Yr,n as Xr,o as Zr,r as Qr,s as $r,t as ei,u as ti,v as ni,x as ri}from"./agent-visibility-HpfSUFqP.js";import{a as ii,i as ai,n as oi,r as si}from"./terminal-telemetry-DxTZB2oZ.js";import{$a as ci,$i as li,$t as ui,A as di,An as fi,B as pi,Bn as mi,Ci as hi,Ct as gi,Di as _i,En as vi,Fa as yi,Fn as bi,Ga as xi,Gi as Si,Gn as Ci,Gr as wi,Gt as Ti,H as Ei,Ha as Di,Hi as Oi,Hn as ki,Ht as Ai,I as ji,Ja as Mi,Ji as Ni,Jr as Pi,La as Fi,Lr as Ii,Mn as Li,N as Ri,O as zi,Ot as Bi,P as Vi,Pn as Hi,Qr as Ui,Ri as Wi,Rt as Gi,Sn as Ki,T as qi,Tr as Ji,Ui as Yi,Un as Xi,Ur as Zi,Va as Qi,Wi as $i,Wr as ea,Xa as ta,Xi as na,Ya as ra,Yi as ia,Yn as aa,Yr as oa,Yt as sa,Za as ca,Zi as la,Zn as ua,_i as da,_r as fa,_t as pa,ai as ma,br as ha,c as ga,ci as _a,ct as va,dr as ya,ea as ba,ei as xa,eo as Sa,g as Ca,gi as wa,hi as Ta,hn as Ea,ia as Da,it as Oa,j as ka,jn as Aa,jr as ja,kn as Ma,kt as Na,lr as Pa,mi as Fa,mn as Ia,mr as La,n as Ra,ni as za,no as Ba,or as Va,pi as Ha,pr as Ua,qa as Wa,qn as Ga,r as Ka,ri as qa,ro as Ja,rt as Ya,t as Xa,ta as Za,to as Qa,vi as $a,vr as eo,w as to,wi as no,x as ro,xn as io,zi as ao,zr as oo,zt as so}from"./dist-Cal4LUep.js";import{t as co}from"./git-branch-CMJAiYLz.js";import{c as lo,d as uo,f as fo,l as po,p as mo,u as ho}from"./EnableSyncConfirmDialog-B2sHRtLY.js";import{t as go}from"./arrow-up-right-obRIg3Sv.js";import{r as _o,t as vo}from"./RegisteredAgentIcon-8Tcfr3WP.js";import{a as yo,c as bo,d as xo,f as So,i as Co,l as wo,m as To,n as Eo,o as Do,p as Oo,r as ko,s as Ao,t as jo,u as Mo}from"./PropertyPanel-BMIcO_AS.js";import{t as No}from"./case-sensitive-nl0tWMnZ.js";import{t as Po}from"./check-GqWaoTdV.js";import{t as Fo}from"./chevron-left-BQ6OM94c.js";import{t as Io}from"./chevron-down-Bx9f3tW-.js";import{t as Lo}from"./chevron-right-C8oTR6gu.js";import{t as Ro}from"./CopyButton-1Q6Wnnjb.js";import{a as zo,i as Bo,n as Vo,o as Ho,r as Uo,s as Wo}from"./prop-types-B-N3_i3c.js";import{S as Go,_ as Ko,a as qo,b as Jo,c as Yo,d as Xo,f as Zo,g as Qo,i as $o,l as es,m as ts,n as ns,o as rs,p as is,r as as,s as os,u as ss,v as cs,x as ls,y as us}from"./skill-actions-C_5-d4BC.js";import{B as ds,D as fs,E as ps,F as ms,G as hs,H as gs,I as _s,K as vs,L as ys,M as bs,N as xs,O as Ss,P as Cs,R as ws,S as Ts,T as Es,U as Ds,V as Os,W as ks,_ as As,a as js,c as Ms,j as Ns,l as Ps,m as Fs,n as Is,r as Ls,t as Rs,u as zs,v as Bs,w as Vs,z as Hs}from"./auth-state-cache-BUVYaS5m.js";import{a as Us,d as Ws,i as Gs,l as Ks,n as qs,o as Js,r as Ys,s as Xs,t as Zs,u as Qs}from"./workspace-paths-B-NChZS2.js";import{t as $s}from"./copy-9EDFYcyR.js";import{n as ec,t as tc}from"./square-pen-C1vIlMAW.js";import{t as nc}from"./eye-CASw1HTi.js";import{a as rc,i as ic,n as ac,o as oc,r as sc,s as cc,t as lc}from"./pending-receive-nav-store-BuGLGemz.js";import{t as uc}from"./folder-open-wLd69QUc.js";import{i as dc,o as fc,t as pc}from"./open-managed-artifact-tab-DfGutPkc.js";import{t as mc}from"./hash-DNKDqZ18.js";import{A as hc,C as gc,D as _c,O as vc,S as yc,T as bc,_ as xc,a as Sc,b as Cc,c as wc,d as Tc,f as Ec,g as Dc,h as Oc,j as kc,k as Ac,l as jc,m as Mc,n as Nc,o as Pc,p as Fc,r as Ic,s as Lc,t as Rc,u as zc,v as Bc,w as Vc,x as Hc,y as Uc}from"./terminal-launch-events-N4CMVbPT.js";import{t as Wc}from"./info-yKMseklR.js";import{t as Gc}from"./loader-circle-Cg5SU7AZ.js";import{t as Kc}from"./miss-dialog-store-Bx4JLuKB.js";import{n as qc,t as Jc}from"./panel-right-open-B7ziq39V.js";import{t as Yc}from"./paperclip-CX7J_G-w.js";import{t as Xc}from"./refresh-cw-BfeWGCsv.js";import{c as Zc,n as Qc,o as $c,r as el,s as tl,t as nl}from"./field-DVIFAnvR.js";import{t as rl}from"./sliders-horizontal-34K0eDW2.js";import{t as il}from"./trash-2-BUuL4OCw.js";import{t as al}from"./triangle-alert-Clgvyc7B.js";import{i as ol,n as sl,r as cl,t as ll}from"./timeline-diff-store-CYckprSS.js";import{t as ul}from"./x-DVkpYo5d.js";import{n as dl,t as fl}from"./dist-BLAMau9Z.js";import{a as pl,i as ml,n as hl,r as gl}from"./project-paths-Dwo4Of8C.js";import{t as _l}from"./input-D0ZW0Opq.js";import{t as vl}from"./dist-q14fBS3T.js";import{d as yl,f as bl,g as xl,h as Sl,i as Cl,n as wl,o as Tl,p as El,r as Dl,t as Ol,u as kl}from"./use-settings-route-CXFzIfYo.js";import{t as Al}from"./parse-api-error-C_gwkKmG.js";import{n as jl,r as Ml,t as Nl}from"./file-tree-rename-validation-wADtjYEi.js";import{a as Pl,c as Fl,d as Il,i as Ll,l as Rl,n as zl,o as Bl,s as Vl,u as Hl}from"./file-tree-utils-DiUPuK3N.js";import{a as Ul,i as Wl,n as Gl,o as Kl,r as ql,s as Jl}from"./navigation-targets-Ci2h-vaL.js";import{c as Yl,i as Xl,l as Zl,n as Ql,o as $l,r as eu,s as tu,u as nu}from"./documents-events-1HWCdfoh.js";import{t as ru}from"./documents-fetch-CLL0O1of.js";import{a as iu,i as au,o as ou}from"./startup-marks-CqVzdU1y.js";import{a as su,c as cu,d as lu,f as uu,h as du,i as fu,l as pu,n as mu,o as hu,p as gu,r as _u,s as vu,t as yu,u as bu}from"./doc-hash-BSK-KaTu.js";import{t as xu}from"./badge-Dba4cvJR.js";import{c as Su,i as Cu,n as wu,t as Tu}from"./config-provider-DIuwNlqX.js";import{i as Eu,r as Du,t as Ou}from"./use-collab-url-D0INpn_f.js";import{n as ku,t as Au}from"./client-version-FVbajnsJ.js";import{$ as ju,Et as Mu,Ft as Nu,I as Pu,It as Fu,J as Iu,Lt as Lu,Mt as Ru,Nt as zu,Ot as Bu,Q as Vu,X as Hu,Z as Uu,jt as Wu,k as Gu,kt as Ku,ot as qu,w as Ju,wt as Yu,xt as Xu}from"./dist-DNwOaDhC.js";import{n as Zu,s as Qu,t as $u}from"./esm-HV7Pxfbn.js";import{n as ed}from"./dist-DGzvBIzr.js";import{n as td}from"./config-context-gd3BC-iY.js";import{n as nd,t as rd}from"./external-link-T4Nj1gcG.js";import{n as id,r as ad,t as od}from"./worktree-store-LSx9q9Ga.js";import{t as sd}from"./use-workspace-3T40FR83.js";import{c as cd,i as ld,n as ud,r as dd,s as fd,t as pd}from"./selection-context-zsjvL-8N.js";import{_ as md,a as hd,b as gd,c as _d,d as vd,f as yd,g as bd,h as xd,i as Sd,l as Cd,m as wd,n as Td,o as Ed,p as Dd,s as Od,t as kd,u as Ad,v as jd,x as Md}from"./typing-burst-detector-BP7d86JP.js";import{t as Nd}from"./use-installed-clis-B_nDAq7A.js";import{a as Pd,i as Fd,n as Id,o as Ld,r as Rd,s as zd,t as Bd}from"./panel-Cyobla0Z.js";import{t as Vd}from"./target-navigation-intent-ClG4AlV8.js";import{t as Hd}from"./lint-plugin-meta-B3N1DKgL.js";import{t as Ud}from"./skeleton-HLkcMp95.js";import{c as Wd,i as Gd,l as Kd,r as qd}from"./lint-config-client-G_mrikOJ.js";import{a as Jd,o as Yd,t as Xd}from"./agent-diff-store-Bi0IQPgd.js";import{t as Zd}from"./dist-B1qkpf98.js";import{a as Qd,i as $d,n as ef,o as tf,r as nf,t as rf}from"./EditorModeToggle-D0Db8Ydu.js";import{n as af}from"./clipboard-adapter--Ja4oXEM.js";import{a as of,n as sf,s as cf}from"./follow-file-DBnmqlyk.js";import{a as lf,f as uf,i as df,l as ff,n as pf,p as mf,r as hf,s as gf,t as _f,u as vf}from"./sortable.esm-B6whf_t-.js";import{t as yf}from"./textarea-RSYJwPz9.js";import{i as bf,o as xf,r as Sf,u as Cf}from"./skills-api-ChYiP1Zv.js";import{C as wf,D as Tf,E as Ef,O as Df,S as Of,T as kf,_ as Af,a as jf,b as Mf,c as Nf,d as Pf,f as Ff,g as If,h as Lf,i as Rf,k as zf,l as Bf,m as Vf,n as Hf,o as Uf,p as Wf,r as Gf,s as Kf,t as qf,u as Jf,v as Yf,w as Xf,x as Zf,y as Qf}from"./file-tree-adapter-Dw7Dgyj1.js";import{t as $f}from"./use-live-xterm-theme-C-fHLeXw.js";import{n as ep,r as tp}from"./agent-presence-CTJkQnoU.js";import{a as np,c as rp,d as ip,f as ap,i as op,l as sp,m as cp,n as lp,o as up,s as dp,t as fp,u as pp}from"./form-D-z6QdLf.js";import{n as mp,t as hp}from"./mcp-consent-store-Xk9UA_MB.js";import{a as gp,t as _p}from"./receive-store-CL0RH8Oa.js";function vp(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.41.0`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-DXiL3sBk.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}var yp=class extends _t{#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||bp(),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=Dt({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),vt.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function bp(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var xp=class extends Pt{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 yp({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=Sp(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=Sp(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=Sp(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=Sp(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){vt.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=>bt(t,e))}findAll(e={}){return this.getAll().filter(t=>bt(e,t))}notify(e){vt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return vt.batch(()=>Promise.all(e.map(e=>e.continue().catch(Tt))))}};function Sp(e){return e.options.scope?.id}var Cp=class extends Pt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??yt(r,t),a=this.get(i);return a||(a=new Ct({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(){vt.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=>Ot(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Ot(e,t)):t}notify(e){vt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){vt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){vt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},wp=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Cp,this.#t=e.mutationCache||new xp,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Nt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=At.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(xt(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=wt(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return vt.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;vt.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return vt.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=vt.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Tt).catch(Tt)}invalidateQueries(e,t={}){return vt.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=vt.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(Tt)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Tt)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(xt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Tt).catch(Tt)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Tt).catch(Tt)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return At.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(Mt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{St(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Mt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{St(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||=yt(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===gt&&(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(pt(),1),Tp=t(),$=Rt(),Ep=3100,Dp=3;function Op(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??Dp;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var kp={0:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},1:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},2:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},3:{count:16,startRadius:11,baseDistance:7,distanceVariance:3,sizeMin:.45,sizeMax:1.2,maxDelay:500,durationMin:1100,durationMax:2400}},Ap=[`var(--color-azure-blue)`,`var(--color-sky-blue)`,`var(--color-violet-300)`,`var(--color-orange-light)`,`var(--color-crystal-blue)`,`var(--color-white-cream)`];function jp(e,t={}){let n=t.rng??Math.random,r=t.colors??Ap,i=kp[e];if(i.count===0||r.length===0)return[];let a=[],o=Math.PI*2/i.count;for(let e=0;e<i.count;e++){let t=e*o+(n()-.5)*o*.7,s=i.baseDistance+(n()-.5)*2*i.distanceVariance,c=i.sizeMin+n()*(i.sizeMax-i.sizeMin),l=n()*i.maxDelay,u=i.durationMin+n()*(i.durationMax-i.durationMin),d=Math.floor(n()*r.length),f=Math.cos(t),p=Math.sin(t);a.push({id:e,dx:f*s,dy:p*s,originDx:f*i.startRadius,originDy:p*i.startRadius,size:c,color:r[d]??`currentColor`,delay:l,duration:u})}return a}var Mp=1.8,Np=90,Pp=16,Fp=380,Ip=.025,Lp=.1,Rp=.18,zp=400,Bp=9.2736,Vp=18.1799,Hp=14.5244,Up={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function Wp(e,t){let{halfWidth:n,apexLift:r}=Up[t];return`M${e-n} ${Hp+.3} Q${e} ${Hp-r}, ${e+n} ${Hp+.3}`}function Gp(e){let t=1.5,n=.3;return`M${e-t} ${Hp-n} Q${e} ${Hp+1.4}, ${e+t} ${Hp-n}`}var Kp=15,qp=15;function Jp(e){return{fill:e.color,"--fx-tx":`${e.dx}px`,"--fx-ty":`${e.dy}px`,"--fx-delay":`${e.delay}ms`,"--fx-duration":`${e.duration}ms`}}function Yp(e){let t=(0,$.c)(71),{size:n,className:r,trackMouse:i,variant:a,celebrateSignal:o}=e,s=n===void 0?48:n,c=i===void 0?!0:i,l=a===void 0?`default`:a,u=o===void 0?0:o,d=(0,Q.useRef)(null),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={x:0,y:0},t[0]=m):m=t[0];let h=(0,Q.useRef)(m),[g,_]=(0,Q.useState)(0),[v,y]=(0,Q.useState)(0),b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[1]=b):b=t[1];let[x,S]=(0,Q.useState)(b),C=(0,Q.useRef)(0),w=(0,Q.useRef)(void 0),T=l===`sleeping`,E;t[2]!==g||t[3]!==T?(E=function(){if(T)return;let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=C.current===0?1/0:e-C.current;C.current=e;let n=Op(g,t);_(n),y($p),S(jp(n)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},Ep)},t[2]=g,t[3]=T,t[4]=E):E=t[4];let D=E,O,k;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>()=>clearTimeout(w.current),k=[],t[5]=O,t[6]=k):(O=t[5],k=t[6]),(0,Q.useEffect)(O,k);let A,j;t[7]!==u||t[8]!==T?(A=()=>{u===0||T||(_(3),y(Qp),S(jp(3)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},Ep))},j=[u,T],t[7]=u,t[8]=T,t[9]=A,t[10]=j):(A=t[9],j=t[10]),(0,Q.useEffect)(A,j);let M,N;t[11]!==T||t[12]!==c?(M=()=>{if(!c||T||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let e=0,t=0,n=!1,r=0,i=0,a=0,o=0,s=0,l=function(){s===0&&(s=requestAnimationFrame(m))},u=function(r){e=r.clientX,t=r.clientY,n=!0,l()};function m(){s=0;let c=f.current,u=d.current;if(!c||!u){l();return}let m=n;n=!1;let g=c.getBoundingClientRect(),_=g.left+g.width/2,v=g.top+g.height*.48,y=e-_,b=t-v,x=Math.hypot(y,b),S=Math.max(-1,Math.min(1,y/Fp)),C=-Math.max(-1,Math.min(1,b/Fp))*Pp,w=S*Pp,T=0,E=0;if(x>=1){let e=Math.min(x/Np,1)*Mp;T=y/x*e,E=b/x*e}let D=Math.abs(C-r)<.01&&Math.abs(w-i)<.01&&Math.abs(T-a)<.01&&Math.abs(E-o)<.01;if(!m&&D)return;l(),r+=(C-r)*Lp,i+=(w-i)*Lp,u.style.transform=`perspective(${zp}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(T-a)*Rp,o+=(E-o)*Rp;let O=i*Ip,k=-r*Ip,A=a+O,j=o+k;h.current.x=A,h.current.y=j,p.current?.setAttribute(`transform`,`translate(${A.toFixed(3)} ${j.toFixed(3)})`)}return document.addEventListener(`mousemove`,u,{passive:!0}),l(),()=>{document.removeEventListener(`mousemove`,u),s!==0&&cancelAnimationFrame(s),s=0,d.current&&(d.current.style.transform=``),h.current={x:0,y:0},p.current?.removeAttribute(`transform`)}},N=[c,T],t[11]=T,t[12]=c,t[13]=M,t[14]=N):(M=t[13],N=t[14]),(0,Q.useEffect)(M,N);let P;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{let e=p.current;if(!e)return;let{x:t,y:n}=h.current;e.setAttribute(`transform`,`translate(${t.toFixed(3)} ${n.toFixed(3)})`)},t[15]=P):P=t[15],(0,Q.useLayoutEffect)(P);let F=g>0,I=F?g:1,L=F?`ok-blob-clicked-${g}`:null,R;t[16]===r?R=t[17]:(R=Y(`ok-blob-3d-wrapper`,r),t[16]=r,t[17]=R);let z=T?`cursor-default`:`cursor-pointer`,B=`body-${v}`,V=T&&`ok-blob-sleeping`,H;t[18]!==L||t[19]!==V?(H=Y(`ok-blob-group`,V,L),t[18]=L,t[19]=V,t[20]=H):H=t[20];let U;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(`path`,{d:`M25.2339 6.78134C25.5199 7.35734 25.8179 8.47234 26.0179 9.07834C26.0189 9.08234 26.0209 9.08634 26.0219 9.09134C26.0229 9.09534 26.0249 9.10034 26.0259 9.10434C26.0539 9.19734 26.0949 9.29533 26.1519 9.41633C26.2919 9.71133 26.5269 10.1173 27.1299 11.1683C27.3259 11.4643 27.5209 11.7693 27.7119 12.0903C29.9739 15.1623 29.3259 20.1913 27.0469 22.9153C26.7779 23.2953 26.4869 23.6043 26.1889 23.8863C26.1519 23.9253 26.1129 23.9643 26.0729 24.0033C25.3159 24.7543 24.2949 25.4673 23.6129 25.8323C22.7469 26.2983 22.1349 26.5483 21.6299 26.7463C20.3649 27.3063 19.0609 27.7733 17.6569 28.0423C15.9649 28.3513 14.1939 28.4433 12.4569 28.1373C11.4779 27.9663 10.5119 27.6663 9.60891 27.2493C8.77491 26.8663 7.99192 26.3853 7.26992 25.8403C6.83592 25.5393 6.43893 25.2343 6.08093 24.9383C5.57893 24.5223 5.15993 24.1263 4.83493 23.7793C4.04993 22.9443 3.31593 21.8893 2.80893 21.0953C2.72593 20.9663 2.64792 20.8433 2.57592 20.7293C2.56192 20.7093 2.54793 20.6893 2.53393 20.6703C2.08593 20.0263 1.71892 19.3293 1.43792 18.5993C1.42892 18.5453 1.42093 18.4903 1.41293 18.4353C1.32093 17.7443 1.08292 16.9423 1.01092 15.6333C0.984921 15.0653 0.998928 14.4013 1.12393 13.6353C1.20693 13.1413 1.31993 12.9023 1.40893 12.7113C1.43593 12.6543 1.46193 12.6023 1.48593 12.5483C1.56793 12.3653 1.59392 12.1563 1.63592 11.9083C1.68992 11.5883 1.76992 11.1943 2.04592 10.7553C2.94392 9.37934 3.36792 8.81934 3.66592 8.33934C3.75592 8.20334 3.84292 8.08134 3.94192 7.96634C4.21592 7.64634 4.67693 7.29534 5.10293 7.05734C5.16693 7.02234 5.23093 6.98834 5.29193 6.95534C5.62993 6.77834 6.22592 6.30135 6.66992 5.92035C6.83692 5.77635 7.08193 5.60735 7.37393 5.40935C7.67393 5.20535 8.02593 4.96934 8.39193 4.70234C9.32093 4.02634 9.84091 3.69134 10.2599 3.42334C10.3799 3.34734 10.4919 3.27734 10.6049 3.20834C10.9609 2.98834 11.4149 2.73034 11.8869 2.48634C12.4519 2.19334 13.0469 1.92133 13.5089 1.72233C14.7399 1.30233 16.0539 1.01333 17.4169 1.00033C18.1169 0.991333 18.7939 1.16534 19.2389 1.43034C19.6869 1.69534 19.8689 2.00335 19.8039 2.23935C19.7379 2.47835 19.4399 2.63634 19.0109 2.74734C18.5789 2.85634 18.0469 2.92035 17.4889 2.96135C16.3639 3.04235 15.2399 3.36435 14.1499 3.80835C12.8199 4.35135 11.5379 5.07133 10.2719 5.84733C9.38691 6.39133 8.51192 6.97334 7.63592 7.56834C7.54492 7.63034 7.45492 7.69135 7.36492 7.75235C6.97392 8.06635 6.58293 8.38134 6.22293 8.66334C5.97893 8.85734 5.76793 9.04834 5.59393 9.21434C5.26893 9.52334 5.02393 9.74334 4.81893 9.93934C4.67793 10.0753 4.55793 10.2013 4.45593 10.3443C4.40093 10.4213 4.32992 10.5273 4.24792 10.6593C3.90492 11.1933 3.44493 12.1693 3.15393 13.1173C3.01893 13.5363 2.87991 14.0343 2.79391 14.5253C2.66591 15.2253 2.65594 15.9053 2.71994 16.2373C2.82794 16.8193 2.95593 17.4833 3.14093 18.0553C3.31293 18.6003 3.52991 19.0583 3.70791 19.2823C3.81591 19.4183 3.90394 19.5473 3.99594 19.6913C4.09394 19.8413 4.19191 20.0073 4.31091 20.2033C4.47891 20.4803 4.68592 20.8163 5.00192 21.2493C5.36492 21.7463 5.61793 22.1043 5.83493 22.4023C6.14493 22.8243 6.38591 23.1343 6.83691 23.5033C7.33891 23.9113 7.86593 24.3113 8.26693 24.6393C8.44893 24.7883 8.66993 24.9443 8.90493 25.0963C9.21593 25.2963 9.55192 25.4893 9.85592 25.6703C10.1059 25.8203 10.3059 25.9633 10.4869 26.0863C10.5429 26.1243 10.5979 26.1603 10.6519 26.1943C10.8699 26.2803 11.0929 26.3593 11.3159 26.4283C11.3539 26.4323 11.3949 26.4353 11.4369 26.4393C11.6509 26.4573 11.9089 26.4733 12.2209 26.5133C12.7169 26.5753 13.1399 26.6603 13.6019 26.7243C13.9589 26.7733 14.3409 26.8083 14.7729 26.7893C15.0729 26.7753 15.4069 26.7353 15.7389 26.6813C16.2349 26.6023 16.7179 26.4943 17.0569 26.4473C17.1499 26.4343 17.2359 26.4343 17.3209 26.4373C17.3489 26.4393 17.3799 26.4413 17.4109 26.4433C17.4119 26.4433 17.4119 26.4433 17.4129 26.4433C17.4199 26.4433 17.4279 26.4443 17.4349 26.4443C18.2329 26.2413 19.0259 25.9433 19.7959 25.5983C19.8609 25.5633 19.9259 25.5273 19.9899 25.4913C20.3059 25.3173 20.6049 25.1383 20.7869 24.9943C20.9829 24.8393 21.5189 24.5373 22.0579 24.1853C22.4109 23.9553 22.7649 23.7053 23.0369 23.4833C23.1949 23.3553 23.3689 23.2693 23.5479 23.1773C23.7129 23.0923 23.8809 23.0013 24.0349 22.8653C24.1109 22.7983 24.1869 22.7173 24.2639 22.6303C24.3309 22.5563 24.4039 22.4723 24.4759 22.3923C24.5459 22.3153 24.7199 22.1723 24.9139 21.9793C25.0079 21.8863 25.1059 21.7783 25.1909 21.6713C25.2199 21.6323 25.2489 21.5943 25.2769 21.5553C25.5919 21.0403 25.8779 20.5003 26.1019 19.9653C26.1299 19.8403 26.1379 19.7293 26.1279 19.6373C26.1199 19.5703 26.1029 19.5113 26.0839 19.4503C26.0599 19.3643 26.0329 19.2773 26.0239 19.1723C26.0169 19.0893 26.0309 19.0043 26.0629 18.9543C26.0779 18.9323 26.0969 18.9143 26.1129 18.8993C26.1329 18.8823 26.1499 18.8673 26.1569 18.8443C26.1609 18.8273 26.1579 18.8073 26.1529 18.7833C26.1459 18.7443 26.1369 18.6943 26.1539 18.6293C26.2189 18.3853 26.2869 18.1103 26.3319 17.8383C26.3829 17.5393 26.4049 17.2433 26.3949 17.0123C26.3849 16.7493 26.3909 16.3823 26.3469 16.0003C26.3179 15.7343 26.2659 15.4663 26.1979 15.2383C26.1319 15.0143 26.0219 14.7913 25.9039 14.5783C25.7629 14.3223 25.6119 14.0783 25.5169 13.8453C25.4969 13.7983 25.4999 13.7263 25.4999 13.6323C25.5009 13.5673 25.4999 13.4913 25.4919 13.4083C25.3239 13.1243 25.1459 12.8423 24.9589 12.5483C24.9479 12.5413 24.9369 12.5333 24.9249 12.5263C24.6689 12.3503 24.3139 12.1173 24.0769 11.5503C24.0179 11.4063 24.0069 11.2983 23.9969 11.1993C23.9859 11.1013 23.9799 11.0183 23.9289 10.9093C23.8709 10.7853 23.7759 10.6583 23.6709 10.4993C23.5849 10.3703 23.4899 10.2133 23.4199 10.0423C23.3819 9.95134 23.3509 9.85734 23.3329 9.75934C23.3299 9.74334 23.3269 9.72534 23.3229 9.70634C23.2899 9.52734 23.2439 9.26534 23.2409 8.98634C23.0209 8.24434 22.8339 7.48833 22.6519 6.77633C22.3429 5.57133 22.0519 4.54234 21.3329 3.95434C20.9839 3.65334 20.5689 3.35433 20.2459 3.05433C19.9259 2.75633 19.7449 2.47534 19.8019 2.23834C19.8639 2.00634 20.1589 1.82934 20.6659 1.80534C21.1699 1.78334 21.8699 1.93235 22.5209 2.39235C23.6159 3.14235 24.2029 4.38334 24.5599 5.35734C24.5829 5.40834 24.6049 5.46034 24.6259 5.51234C24.7849 5.89434 24.9529 6.22834 25.1199 6.55534C25.1579 6.63034 25.1969 6.70834 25.2339 6.78134Z`,className:`ok-blob-body`}),t[21]=U):U=t[21];let ee=(F||T)&&`ok-blob-eye-hidden`,W;t[22]===ee?W=t[23]:(W=Y(`ok-blob-eye`,ee),t[22]=ee,t[23]=W);let G;t[24]===W?G=t[25]:(G=(0,Z.jsx)(`ellipse`,{cx:Bp,cy:Hp,rx:1.2722,ry:1.9083,className:W}),t[24]=W,t[25]=G);let K=(F||T)&&`ok-blob-eye-hidden`,te;t[26]===K?te=t[27]:(te=Y(`ok-blob-eye ok-blob-eye-right`,K),t[26]=K,t[27]=te);let ne;t[28]===te?ne=t[29]:(ne=(0,Z.jsx)(`ellipse`,{cx:Vp,cy:Hp,rx:1.2722,ry:1.9083,className:te}),t[28]=te,t[29]=ne);let q;t[30]===I?q=t[31]:(q=Wp(Bp,I),t[30]=I,t[31]=q);let re=(!F||T)&&`ok-blob-eye-hidden`,ie;t[32]===re?ie=t[33]:(ie=Y(`ok-blob-happy-eye`,re),t[32]=re,t[33]=ie);let ae;t[34]!==q||t[35]!==ie?(ae=(0,Z.jsx)(`path`,{d:q,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ie}),t[34]=q,t[35]=ie,t[36]=ae):ae=t[36];let oe;t[37]===I?oe=t[38]:(oe=Wp(Vp,I),t[37]=I,t[38]=oe);let se=(!F||T)&&`ok-blob-eye-hidden`,ce;t[39]===se?ce=t[40]:(ce=Y(`ok-blob-happy-eye`,se),t[39]=se,t[40]=ce);let le;t[41]!==oe||t[42]!==ce?(le=(0,Z.jsx)(`path`,{d:oe,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ce}),t[41]=oe,t[42]=ce,t[43]=le):le=t[43];let ue;t[44]===T?ue=t[45]:(ue=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:Gp(Bp),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:Gp(Vp),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[44]=T,t[45]=ue);let de;t[46]!==G||t[47]!==ne||t[48]!==ae||t[49]!==le||t[50]!==ue?(de=(0,Z.jsxs)(`g`,{ref:p,children:[G,ne,ae,le,ue]}),t[46]=G,t[47]=ne,t[48]=ae,t[49]=le,t[50]=ue,t[51]=de):de=t[51];let fe;t[52]!==B||t[53]!==H||t[54]!==de?(fe=(0,Z.jsxs)(`g`,{className:H,children:[U,de]},B),t[52]=B,t[53]=H,t[54]=de,t[55]=fe):fe=t[55];let pe;t[56]===T?pe=t[57]:(pe=T?(0,Z.jsxs)(`g`,{children:[(0,Z.jsx)(`text`,{x:21,y:7,className:`ok-blob-z ok-blob-z-1`,children:`z`}),(0,Z.jsx)(`text`,{x:26,y:2,className:`ok-blob-z ok-blob-z-2`,children:`z`})]}):null,t[56]=T,t[57]=pe);let me;t[58]!==v||t[59]!==x?(me=x.length>0&&(0,Z.jsx)(`g`,{children:x.map(Xp)},`firework-${v}`),t[58]=v,t[59]=x,t[60]=me):me=t[60];let he;t[61]!==D||t[62]!==s||t[63]!==z||t[64]!==fe||t[65]!==pe||t[66]!==me?(he=(0,Z.jsxs)(`svg`,{ref:f,width:s,height:s,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:z,"aria-hidden":`true`,onClick:D,onMouseDown:Zp,children:[fe,pe,me]}),t[61]=D,t[62]=s,t[63]=z,t[64]=fe,t[65]=pe,t[66]=me,t[67]=he):he=t[67];let ge;return t[68]!==R||t[69]!==he?(ge=(0,Z.jsx)(`span`,{ref:d,className:R,children:he}),t[68]=R,t[69]=he,t[70]=ge):ge=t[70],ge}function Xp(e){return(0,Z.jsx)(`circle`,{cx:Kp+e.originDx,cy:qp+e.originDy,r:e.size,className:`ok-blob-firework`,style:Jp(e)},e.id)}function Zp(e){return e.preventDefault()}function Qp(e){return e+1}function $p(e){return e+1}var em=(0,Q.lazy)(()=>n(()=>import(`./ReportBugDialogBody-ByMe7BRT.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]),import.meta.url)),tm=1200,nm=`[cmdk-root],[data-radix-popper-content-wrapper]`,rm=500;function im(e){let t=(0,$.c)(8),[n,r]=(0,Q.useState)(e.open),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),c=(0,Q.useRef)(0);e.open&&!n&&r(!0);let l,u;if(t[0]!==e.crashInvite||t[1]!==e.open?(l=()=>{if(!e.open){a(!1);return}let t=c.current+=1,n=window.okDesktop?.bugReport?.captureScreenshot;if(typeof n!=`function`||e.crashInvite!==void 0){s(null),a(!0);return}s(null);let r=!1,i=e=>{r||c.current!==t||(r=!0,s(e),a(!0))},o=setTimeout(()=>i(null),tm),l=performance.now(),u=0,d=()=>{if(c.current!==t)return;let e=performance.now()-l>=rm;if(document.querySelector(nm)!==null&&!e){u=requestAnimationFrame(d);return}u=requestAnimationFrame(()=>{c.current===t&&n().then(i).catch(()=>i(null))})};return u=requestAnimationFrame(d),()=>{c.current+=1,clearTimeout(o),cancelAnimationFrame(u)}},u=[e.open,e.crashInvite],t[0]=e.crashInvite,t[1]=e.open,t[2]=l,t[3]=u):(l=t[2],u=t[3]),(0,Q.useEffect)(l,u),!n)return null;let d=e.open&&i,f;return t[4]!==e||t[5]!==o||t[6]!==d?(f=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(em,{...e,open:d,screenshot:o})}),t[4]=e,t[5]=o,t[6]=d,t[7]=f):f=t[7],f}var am=`ContextMenu`,[om,sm]=Qt(am,[ar]),cm=ar(),[lm,um]=om(am),dm=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,dir:i,modal:a=!0}=e,[o,s]=Q.useState(!1),c=cm(t),l=nn(r),u=Q.useCallback(e=>{s(e),l(e)},[l]);return(0,Z.jsx)(lm,{scope:t,open:o,onOpenChange:u,modal:a,children:(0,Z.jsx)(lr,{...c,dir:i,open:o,onOpenChange:u,modal:a,children:n})})};dm.displayName=am;var fm=`ContextMenuTrigger`,pm=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=um(fm,n),o=cm(n),s=Q.useRef({x:0,y:0}),c=Q.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...s.current})}),l=Q.useRef(0),u=Q.useCallback(()=>window.clearTimeout(l.current),[]),d=e=>{s.current={x:e.clientX,y:e.clientY},a.onOpenChange(!0)};return Q.useEffect(()=>u,[u]),Q.useEffect(()=>void(r&&u()),[r,u]),(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(br,{...o,virtualRef:c}),(0,Z.jsx)(en.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:tn(e.onContextMenu,e=>{u(),d(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:tn(e.onPointerDown,Hm(e=>{u(),l.current=window.setTimeout(()=>d(e),700)})),onPointerMove:r?e.onPointerMove:tn(e.onPointerMove,Hm(u)),onPointerCancel:r?e.onPointerCancel:tn(e.onPointerCancel,Hm(u)),onPointerUp:r?e.onPointerUp:tn(e.onPointerUp,Hm(u))})]})});pm.displayName=fm;var mm=`ContextMenuPortal`,hm=e=>{let{__scopeContextMenu:t,...n}=e,r=cm(t);return(0,Z.jsx)(pr,{...r,...n})};hm.displayName=mm;var gm=`ContextMenuContent`,_m=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=um(gm,n),a=cm(n),o=Q.useRef(!1);return(0,Z.jsx)(fr,{...a,...r,ref:t,side:`right`,sideOffset:2,align:`start`,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&o.current&&t.preventDefault(),o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),!t.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});_m.displayName=gm;var vm=`ContextMenuGroup`,ym=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=cm(n);return(0,Z.jsx)(or,{...i,...r,ref:t})});ym.displayName=vm;var bm=`ContextMenuLabel`,xm=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=cm(n);return(0,Z.jsx)(sr,{...i,...r,ref:t})});xm.displayName=bm;var Sm=`ContextMenuItem`,Cm=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=cm(n);return(0,Z.jsx)(gr,{...i,...r,ref:t})});Cm.displayName=Sm;var wm=`ContextMenuCheckboxItem`,Tm=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=cm(n);return(0,Z.jsx)(vr,{...i,...r,ref:t})});Tm.displayName=wm;var Em=`ContextMenuRadioGroup`,Dm=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=cm(n);return(0,Z.jsx)(xr,{...i,...r,ref:t})});Dm.displayName=Em;var Om=`ContextMenuRadioItem`,km=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=cm(n);return(0,Z.jsx)(cr,{...i,...r,ref:t})});km.displayName=Om;var Am=`ContextMenuItemIndicator`,jm=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=cm(n);return(0,Z.jsx)(yr,{...i,...r,ref:t})});jm.displayName=Am;var Mm=`ContextMenuSeparator`,Nm=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=cm(n);return(0,Z.jsx)(_r,{...i,...r,ref:t})});Nm.displayName=Mm;var Pm=`ContextMenuArrow`,Fm=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=cm(n);return(0,Z.jsx)(hr,{...i,...r,ref:t})});Fm.displayName=Pm;var Im=`ContextMenuSub`,Lm=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,defaultOpen:a}=e,o=cm(t),[s,c]=$t({prop:i,defaultProp:a??!1,onChange:r,caller:Im});return(0,Z.jsx)(mr,{...o,open:s,onOpenChange:c,children:n})};Lm.displayName=Im;var Rm=`ContextMenuSubTrigger`,zm=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=cm(n);return(0,Z.jsx)(ur,{...i,...r,ref:t})});zm.displayName=Rm;var Bm=`ContextMenuSubContent`,Vm=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=cm(n);return(0,Z.jsx)(dr,{...i,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Vm.displayName=Bm;function Hm(e){return t=>t.pointerType===`mouse`?void 0:e(t)}var Um=dm,Wm=pm,Gm=hm,Km=_m,qm=ym,Jm=xm,Ym=Cm,Xm=Tm,Zm=jm,Qm=Nm,$m=Lm,eh=zm,th=Vm;function nh(e){let t=(0,$.c)(24),{error:n,resetErrorBoundary:r}=e,{_:i}=mt(),[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)(Yp,{size:80,variant:`sleeping`}),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)(J,{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)(J,{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)(J,{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)(ah,{children:(0,Z.jsx)(im,{open:a,onOpenChange:o,systemWide:c.config.mode===`navigator`,crashContext:{source:`app shell`,errorMessage:n instanceof Error&&n.message?n.message:String(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 rh(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(qt,{FallbackComponent:nh,onError:ih,children:n}),t[0]=n,t[1]=r),r}function ih(e){console.error(`[AppErrorBoundary] app-shell render crash`,e)}function ah(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(qt,{fallback:null,onError:oh,children:n}),t[0]=n,t[1]=r),r}function oh(e){console.error(`[CrashReportingBoundary] crash-reporting UI render crash`,e)}function sh(){let e=(0,$.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={queryKey:[`acp-catalog`],queryFn:uh,staleTime:3e5},e[0]=t):t=e[0];let n=jt(t),r;e[1]===n.data?.agents?r=e[2]:(r=()=>(ri(si(n.data?.agents??[]).map(lh)),ch),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 ch(){return ri([])}function lh(e){return{source:e.source,id:e.id,name:e.name,...e.iconUrl===void 0?{}:{iconUrl:e.iconUrl}}}function uh(e){let{signal:t}=e;return ai(t)}var dh=Yt(`arrow-left-right`,[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]),fh=Yt(`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`}]]),ph=Yt(`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`}]]),mh=Yt(`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`}]]),hh=Yt(`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`}]]),gh=Yt(`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`}]]),_h=Yt(`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`}]]),vh=Yt(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),yh=Yt(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),bh=Yt(`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`}]]),xh=Yt(`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`}]]),Sh=Yt(`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`}]]),Ch=Yt(`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`}]]),wh=Yt(`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`}]]),Th=Yt(`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`}]]),Eh=Yt(`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`}]]),Dh=Yt(`file-code`,[[`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:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),Oh=Yt(`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`}]]),kh=Yt(`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`}]]),Ah=Yt(`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`}]]),jh=Yt(`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`}]]),Mh=Yt(`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`}]]),Nh=Yt(`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`}]]),Ph=Yt(`folder`,[[`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`}]]),Fh=Yt(`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`}]]),Ih=Yt(`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`}]]),Lh=Yt(`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`}]]),Rh=Yt(`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`}]]),zh=Yt(`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`}]]),Bh=Yt(`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`}]]),Vh=Yt(`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`}]]),Hh=Yt(`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`}]]),Uh=Yt(`list-plus`,[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M11 12H3`,key:`51ecnj`}],[`path`,{d:`M16 19H3`,key:`zzsher`}],[`path`,{d:`M18 9v6`,key:`1twb98`}],[`path`,{d:`M21 12h-6`,key:`bt1uis`}]]),Wh=Yt(`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`}]]),Gh=Yt(`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`}]]),Kh=Yt(`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`}]]),qh=Yt(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),Jh=Yt(`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`}]]),Yh=Yt(`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`}]]),Xh=Yt(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 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.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),Zh=Yt(`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`}]]),Qh=Yt(`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`}]]),$h=Yt(`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`}]]),eg=Yt(`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`}]]),tg=Yt(`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`}]]),ng=Yt(`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`}]]),rg=Yt(`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`}]]),ig=Yt(`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`}]]),ag=Yt(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),og=Yt(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),sg=Yt(`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`}]]),cg=Yt(`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`}]]),lg=Yt(`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`}]]),ug=Yt(`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`}]]),dg=Yt(`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`}]]),fg=Yt(`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`}]]),pg=Yt(`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`}]]),mg=Yt(`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`}]]),hg=Yt(`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`}]]),gg=Yt(`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`}]]),_g=Yt(`text-align-center`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M17 12H7`,key:`16if0g`}],[`path`,{d:`M19 19H5`,key:`vjpgq2`}]]),vg=Yt(`text-align-end`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M21 19H7`,key:`4cu937`}]]),yg=Yt(`text-align-start`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]]),bg=Yt(`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`}]]),xg=Yt(`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`}]]),Sg=Yt(`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`}]]),Cg=Yt(`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`}]]),wg=Yt(`underline`,[[`path`,{d:`M6 4v6a6 6 0 0 0 12 0V4`,key:`9kb039`}],[`line`,{x1:`4`,x2:`20`,y1:`20`,y2:`20`,key:`nun2al`}]]),Tg=Yt(`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`}]]),Eg=Yt(`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`}]]),Dg=Yt(`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`}]]),Og=180,kg=5e3;function Ag(e,t){if(e===``||t===``)return``;let n=e.includes(`\\`)&&!e.includes(`/`)?`\\`:`/`;return`${e.replace(/[/\\]+$/,``)}${n}${t}`}function jg(e){if(e===``)return``;let t=e.split(/[/\\]/).filter(Boolean);return t.length>0?t[t.length-1]??e:e}function Mg(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 Ng(e){let t=e instanceof Error?e.message:String(e);for(let e of ro)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 Pg(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 Fg(e){let t=(0,$.c)(186),{open:n,onOpenChange:r,bridge:i,initialPackId:a,packs:o}=e,{_:s}=mt(),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)(Hg),[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),ee,W;t[3]!==i||t[4]!==n?(ee=()=>{if(!n)return;z.current.clear(),M(null),E({kind:`idle`}),O(`idle`),A(!1),_(``),y(new Set(Ka)),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(Vg).finally(()=>{e||h(!1)});let t=requestAnimationFrame(()=>{H.current?.focus()});return()=>{e=!0,cancelAnimationFrame(t)}},W=[n,i],t[3]=i,t[4]=n,t[5]=ee,t[6]=W):(ee=t[5],W=t[6]),(0,Q.useEffect)(ee,W);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=Pi(g);if(f===``||e===``){E({kind:`idle`}),O(`idle`);return}let t=f,r=Ag(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(Mg({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`}))})},Og),()=>{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 te,ne;t[18]===n?(te=t[19],ne=t[20]):(te=()=>{if(!n)return;let e=()=>L(Bg);return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},ne=[n],t[18]=n,t[19]=te,t[20]=ne),(0,Q.useEffect)(te,ne);let q=(0,Q.useRef)(`idle`),re,ie;t[21]===D?(re=t[22],ie=t[23]):(re=()=>{q.current=D},ie=[D],t[21]=D,t[22]=re,t[23]=ie),(0,Q.useEffect)(re,ie);let ae,oe;t[24]!==T.kind||t[25]!==n?(ae=()=>{if(!n||T.kind!==`confirm-git`)return;let e=setInterval(()=>{q.current!==`in-flight`&&L(zg)},kg);return()=>clearInterval(e)},oe=[n,T.kind],t[24]=T.kind,t[25]=n,t[26]=ae,t[27]=oe):(ae=t[26],oe=t[27]),(0,Q.useEffect)(ae,oe);let se;t[28]!==T.gitRoot||t[29]!==T.kind||t[30]!==P.gitRoot||t[31]!==P.kind?(se=()=>{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]=se):se=t[32];let ce;t[33]!==T||t[34]!==P?(ce=[T,P],t[33]=T,t[34]=P,t[35]=ce):ce=t[35],(0,Q.useEffect)(se,ce);let le;t[36]!==i||t[37]!==T.kind||t[38]!==n?(le=()=>{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(Rg)))},t[36]=i,t[37]=T.kind,t[38]=n,t[39]=le):le=t[39];let ue;t[40]!==i||t[41]!==T||t[42]!==n?(ue=[n,T,i],t[40]=i,t[41]=T,t[42]=n,t[43]=ue):ue=t[43],(0,Q.useEffect)(le,ue);let de;t[44]!==a||t[45]!==o?(de=o?.find(e=>e.id===a),t[44]=a,t[45]=o,t[46]=de):de=t[46];let fe=de,pe=g,me,he,ge,_e,ve;t[47]!==T.kind||t[48]!==f||t[49]!==pe?(_e=pe===``?``:Pi(pe),he=pe!==``&&_e!==pe&&_e!==``,ge=pe!==``&&_e===``,me=T.kind===`block-nonempty`,ve=f!==``&&_e!==``?Ag(f,_e):``,t[47]=T.kind,t[48]=f,t[49]=pe,t[50]=me,t[51]=he,t[52]=ge,t[53]=_e,t[54]=ve):(me=t[50],he=t[51],ge=t[52],_e=t[53],ve=t[54]);let ye=ve,be=!k&&f!==``&&pe!==``&&_e!==``&&D===`idle`&&(T.kind===`free`||T.kind===`confirm-git`),xe=k||pe!==``&&!be,Se;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(Se=function(e){y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[55]=Se):Se=t[55];let Ce=Se,we;t[56]!==i||t[57]!==f?(we=async function(){try{let e=await i.dialog.openFolder(f===``?void 0:{defaultPath:f});if(e===null)return;p(e),L(Lg),M(null)}catch(e){console.warn(`[CreateProjectDialog] dialog.openFolder failed:`,e)}},t[56]=i,t[57]=f,t[58]=we):we=t[58];let Te=we,Ee;t[59]!==s||t[60]!==i||t[61]!==k||t[62]!==be||t[63]!==v||t[64]!==a||t[65]!==f||t[66]!==r||t[67]!==pe||t[68]!==_e||t[69]!==b?(Ee=async function(e){if(e.preventDefault(),!k){if(pe.trim()===``){dl.error(s({id:`5OqaJi`})),H.current?.focus();return}if(be){A(!0),M(null);try{await i.project.createNew({parent:f,name:_e,editors:Array.from(v),sharing:b,packId:a}),r(!1)}catch(e){M(Ng(e)),A(!1)}}}},t[59]=s,t[60]=i,t[61]=k,t[62]=be,t[63]=v,t[64]=a,t[65]=f,t[66]=r,t[67]=pe,t[68]=_e,t[69]=b,t[70]=Ee):Ee=t[70];let De=Ee,Oe;t[71]!==k||t[72]!==r?(Oe=function(e){k||r(e)},t[71]=k,t[72]=r,t[73]=Oe):Oe=t[73];let ke=Oe,Ae;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=async function(e){F({kind:`confirming`,gitRoot:e})},t[74]=Ae):Ae=t[74];let je=Ae,Me;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(Me=async function(){F({kind:`idle`})},t[75]=Me):Me=t[75];let Ne=Me,Pe;t[76]===i?Pe=t[77]:(Pe=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(Ig),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]=Pe);let Fe=Pe,Ie;t[78]!==i||t[79]!==r?(Ie=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]=Ie):Ie=t[80];let Le=Ie,Re=ge||me||he?`${u} ${d}`:u,ze;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,Z.jsx)(fn,{children:(0,Z.jsx)(J,{id:`wbv9xO`})}),t[81]=ze):ze=t[81];let Be;t[82]===fe?Be=t[83]:(Be=(0,Z.jsxs)(gn,{children:[ze,(0,Z.jsx)(dn,{children:fe?(0,Z.jsx)(J,{id:`D2CwBE`,values:{0:fe.name,1:fe.entryCounts.folders},components:{0:(0,Z.jsx)(`strong`,{})}}):(0,Z.jsx)(J,{id:`O6yEPk`})})]}),t[82]=fe,t[83]=Be);let Ve;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=(0,Z.jsx)(J,{id:`OyIC0Q`}),t[84]=Ve):Ve=t[84];let He;t[85]===l?He=t[86]:(He=(0,Z.jsx)(Pr,{htmlFor:l,children:Ve}),t[85]=l,t[86]=He);let Ue;t[87]===s?Ue=t[88]:(Ue=s({id:`cV7LOw`}),t[87]=s,t[88]=Ue);let We;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(We=e=>_(e.target.value),t[89]=We):We=t[89];let Ge=ge||me,Ke;t[90]!==k||t[91]!==g||t[92]!==Re||t[93]!==l||t[94]!==Ue||t[95]!==Ge?(Ke=(0,Z.jsx)(_l,{id:l,ref:H,value:g,placeholder:Ue,onChange:We,disabled:k,autoComplete:`off`,"aria-invalid":Ge,"aria-describedby":Re,"data-testid":`create-name`}),t[90]=k,t[91]=g,t[92]=Re,t[93]=l,t[94]=Ue,t[95]=Ge,t[96]=Ke):Ke=t[96];let qe;t[97]!==d||t[98]!==me||t[99]!==he||t[100]!==ge||t[101]!==_e?(qe=ge?(0,Z.jsx)(`p`,{id:d,role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-name-error-erased`,children:(0,Z.jsx)(J,{id:`_PBJRl`})}):me?(0,Z.jsx)(`p`,{id:d,role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-name-error-taken`,children:(0,Z.jsx)(J,{id:`7apDiJ`,values:{sanitized:_e},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):he?(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)(J,{id:`KnoB--`,values:{sanitized:_e},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):null,t[97]=d,t[98]=me,t[99]=he,t[100]=ge,t[101]=_e,t[102]=qe):qe=t[102];let Je;t[103]!==He||t[104]!==Ke||t[105]!==qe?(Je=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[He,Ke,qe]}),t[103]=He,t[104]=Ke,t[105]=qe,t[106]=Je):Je=t[106];let Ye;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=(0,Z.jsx)(Pr,{children:(0,Z.jsx)(J,{id:`wJijgU`})}),t[107]=Ye):Ye=t[107];let Xe;t[108]!==f||t[109]!==m?(Xe=f===``?m?(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(J,{id:`iHAJDj`})}):(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(J,{id:`8m8diM`})}):f,t[108]=f,t[109]=m,t[110]=Xe):Xe=t[110];let Ze;t[111]===Xe?Ze=t[112]:(Ze=(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:Xe}),t[111]=Xe,t[112]=Ze);let Qe;t[113]===Te?Qe=t[114]:(Qe=()=>void Te(),t[113]=Te,t[114]=Qe);let $e;t[115]===Symbol.for(`react.memo_cache_sentinel`)?($e=(0,Z.jsx)(J,{id:`O2UpM1`}),t[115]=$e):$e=t[115];let et;t[116]!==k||t[117]!==Qe?(et=(0,Z.jsx)(X,{type:`button`,variant:`outline`,className:`shrink-0`,disabled:k,onClick:Qe,"data-testid":`create-browse`,children:$e}),t[116]=k,t[117]=Qe,t[118]=et):et=t[118];let tt;t[119]!==Ze||t[120]!==et?(tt=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[Ze,et]}),t[119]=Ze,t[120]=et,t[121]=tt):tt=t[121];let nt;t[122]===ye?nt=t[123]:(nt=ye===``?null:(0,Z.jsx)(J,{id:`k_yIIc`,values:{targetPreview:ye},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}}),t[122]=ye,t[123]=nt);let rt;t[124]!==u||t[125]!==nt?(rt=(0,Z.jsx)(`p`,{id:u,className:`text-1sm text-muted-foreground wrap-break-word`,"aria-live":`polite`,"data-testid":`create-target-caption`,children:nt}),t[124]=u,t[125]=nt,t[126]=rt):rt=t[126];let it;t[127]!==tt||t[128]!==rt?(it=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[Ye,tt,rt]}),t[127]=tt,t[128]=rt,t[129]=it):it=t[129];let at;t[130]!==T||t[131]!==Fe||t[132]!==Le||t[133]!==P?(at=(0,Z.jsx)(Ug,{cascade:T,onOpenNested:Le,removeGitState:P,onRequestRemoveGit:je,onCancelRemoveGit:Ne,onConfirmRemoveGit:Fe}),t[130]=T,t[131]=Fe,t[132]=Le,t[133]=P,t[134]=at):at=t[134];let ot;t[135]===Symbol.for(`react.memo_cache_sentinel`)?(ot=(0,Z.jsxs)(ln,{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)(J,{id:`VNgKZz`}),(0,Z.jsx)(Lo,{className:`size-4 transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`,"aria-hidden":!0})]}),t[135]=ot):ot=t[135];let st;t[136]===Symbol.for(`react.memo_cache_sentinel`)?(st=(0,Z.jsx)(`legend`,{className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`0YEbfk`})}),t[136]=st):st=t[136];let ct;t[137]===Symbol.for(`react.memo_cache_sentinel`)?(ct=(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`8IP5jY`})}),t[137]=ct):ct=t[137];let lt;t[138]!==k||t[139]!==v?(lt=Ka.map(e=>{let t=`create-editor-${e}`;return(0,Z.jsxs)(Pr,{htmlFor:t,className:`text-sm font-normal`,children:[(0,Z.jsx)(Jn,{id:t,checked:v.has(e),onCheckedChange:()=>Ce(e),disabled:k,"data-testid":`create-editor-${e}`}),(0,Z.jsx)(`span`,{children:Vi[e]})]},e)}),t[138]=k,t[139]=v,t[140]=lt):lt=t[140];let ut;t[141]===lt?ut=t[142]:(ut=(0,Z.jsxs)(`fieldset`,{className:`flex flex-col space-y-2 pb-2`,children:[st,ct,lt]}),t[141]=lt,t[142]=ut);let dt;t[143]!==k||t[144]!==b?(dt=(0,Z.jsx)(pl,{idPrefix:`create`,testIdPrefix:`create-sharing`,value:b,onValueChange:x,disabled:k}),t[143]=k,t[144]=b,t[145]=dt):dt=t[145];let ft;t[146]!==ut||t[147]!==dt?(ft=(0,Z.jsxs)(cn,{className:`space-y-6 border-t border-border px-3 py-4`,children:[ut,dt]}),t[146]=ut,t[147]=dt,t[148]=ft):ft=t[148];let pt;t[149]!==S||t[150]!==ft?(pt=(0,Z.jsxs)(un,{open:S,onOpenChange:C,className:`rounded-md border border-border`,"data-testid":`create-advanced`,children:[ot,ft]}),t[149]=S,t[150]=ft,t[151]=pt):pt=t[151];let ht;t[152]!==s||t[153]!==j?(ht=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(Pg(j))}),t[152]=s,t[153]=j,t[154]=ht):ht=t[154];let gt;t[155]!==c||t[156]!==De||t[157]!==Je||t[158]!==it||t[159]!==at||t[160]!==pt||t[161]!==ht?(gt=(0,Z.jsx)(mn,{className:`space-y-6`,children:(0,Z.jsxs)(`form`,{id:c,onSubmit:De,"data-testid":`create-project-form`,className:`space-y-6`,children:[Je,it,at,pt,ht]})}),t[155]=c,t[156]=De,t[157]=Je,t[158]=it,t[159]=at,t[160]=pt,t[161]=ht,t[162]=gt):gt=t[162];let _t;t[163]===r?_t=t[164]:(_t=()=>r(!1),t[163]=r,t[164]=_t);let vt;t[165]===Symbol.for(`react.memo_cache_sentinel`)?(vt=(0,Z.jsx)(J,{id:`dEgA5A`}),t[165]=vt):vt=t[165];let yt;t[166]!==k||t[167]!==_t?(yt=(0,Z.jsx)(X,{type:`button`,variant:`outline`,className:`font-mono uppercase`,onClick:_t,disabled:k,"data-testid":`create-cancel`,children:vt}),t[166]=k,t[167]=_t,t[168]=yt):yt=t[168];let bt;t[169]===k?bt=t[170]:(bt=k?(0,Z.jsx)(J,{id:`E9bKSA`}):(0,Z.jsx)(J,{id:`hYgDIe`}),t[169]=k,t[170]=bt);let xt;t[171]!==c||t[172]!==xe||t[173]!==bt?(xt=(0,Z.jsx)(X,{type:`submit`,form:c,disabled:xe,"data-testid":`create-submit`,children:bt}),t[171]=c,t[172]=xe,t[173]=bt,t[174]=xt):xt=t[174];let St;t[175]!==yt||t[176]!==xt?(St=(0,Z.jsxs)(hn,{children:[yt,xt]}),t[175]=yt,t[176]=xt,t[177]=St):St=t[177];let Ct;t[178]!==Be||t[179]!==gt||t[180]!==St?(Ct=(0,Z.jsxs)(pn,{className:`sm:max-w-lg`,"data-testid":`create-project-dialog`,children:[Be,gt,St]}),t[178]=Be,t[179]=gt,t[180]=St,t[181]=Ct):Ct=t[181];let wt;return t[182]!==ke||t[183]!==n||t[184]!==Ct?(wt=(0,Z.jsx)(_n,{open:n,onOpenChange:ke,children:Ct}),t[182]=ke,t[183]=n,t[184]=Ct,t[185]=wt):wt=t[185],wt}function Ig(e){return e+1}function Lg(e){return e+1}function Rg(){}function zg(e){return e+1}function Bg(e){return e+1}function Vg(e){console.warn(`[CreateProjectDialog] defaultProjectsRoot probe failed:`,e)}function Hg(){return new Set(Ka)}function Ug(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=jg(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)(J,{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)(J,{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)(J,{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)(J,{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)(J,{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)(J,{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)(J,{id:`0-31GV`}):(0,Z.jsx)(J,{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)(J,{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}var Wg=`open-knowledge:doc-panel-tab`,Gg=null;function Kg(){let e=Gg;return Gg=null,e}function qg(e,t=typeof window>`u`?new EventTarget:window){Gg=e,t.dispatchEvent(new CustomEvent(Wg,{detail:{tab:e}}))}function Jg(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail?.tab:void 0;n&&e(n)};return t.addEventListener(Wg,n),()=>t.removeEventListener(Wg,n)}function Yg(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 Xg(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`:return`none`}}var Zg={back:{id:`iH8pgl`},forward:{id:`rxWGWX`},newFile:{id:`HdkSiO`},newFolder:{id:`96G6Re`},openGraph:{id:`3Fcb0I`},initializeStarterPack:{id:`fWi7pn`},newProject:{id:`gKi-a_`},openFolderOnDisk:{id:`WPwDin`},openFileOnDisk:{id:`ka6Eke`},switchProject:{id:`xaDWAI`},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`},showHiddenFiles:{id:`XcGbim`},showOkFolders:{id:`GHsJb8`},showOnlyMarkdownFiles:{id:`WkTLN7`},showSkillsSection:{id:`NF_Wcg`},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`}},Qg={"navigate-back":Fo,"navigate-forward":Lo,"new-file":Nn,"new-folder":Nh,"open-graph":Jh,"initialize-starter-pack":Xh,"new-project":Ht,"open-folder":uc,"open-file":Un,"switch-project":Qe,settings:ag,"install-claude-desktop":ec,"report-bug":tt,"bug-report-history":kc,"send-feedback":qh,"new-from-template":Nn,rename:Qs,duplicate:$s,"move-to-trash":il,"reveal-in-finder":uc,"copy-full-path":$s,"copy-relative-path":$s,"close-tab":ul,"new-worktree":co,"switch-worktree":co,"toggle-sidebar":ae,"toggle-doc-panel":hc,"toggle-terminal":Ac,"toggle-show-hidden-files":nc,"toggle-show-ok-folders":Ph,"toggle-show-only-markdown-files":Un,"toggle-show-skills-section":Ks,"expand-all-tree":Tg,"collapse-all-tree":jh,"new-terminal":Ac,"kill-terminal":Ac,"check-for-updates":Xc,"set-up-integrations":mh,"toggle-spell-check":lg,"open-github":Yg},$g={"new-file":e=>{e.closePalette(),e.openNewItemDialog(`file`)},"new-folder":e=>{e.closePalette(),e.openNewItemDialog(`folder`)},"open-graph":e=>{e.closePalette(),qg(`graph`)},"initialize-starter-pack":e=>{e.closePalette(),e.openSeedDialog()},"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(),vl._({id:`jol95m`}))},settings:e=>{e.closePalette(),window.location.hash!==`#settings`&&(window.location.hash=Ol)},"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(va)};function e_(e){return{host:e.bridge===null?`web`:`desktop`,activeTargetKind:e.contextualTargetKind,singleFile:e.singleFile,terminalLive:e.viewMenuState.terminalLive===!0,canExpandAll:e.viewMenuState.canExpandAll!==!1,canCollapseAll:e.viewMenuState.canCollapseAll!==!1,hasActiveDoc:e.activeDocName!==null,showInstallSkill:!1}}function t_(e,t){if(e.stateToggle){let n=t.viewMenuState[e.stateToggle.stateField]===!0?e.stateToggle.hideKey:e.stateToggle.showKey;return vl._(Zg[n])}return vl._(Zg[e.labelKey])}function n_(e){let t=e.menuActionId;return e=>e.emitMenuAction(t)}function r_(e){let t=e.palette;if(!t)throw Error(`command ${e.id} has no palette presence`);let n=Qg[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=>t_(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=>Hi(e.availability,e_(t)),dispatch:$g[e.id]??n_(e)}}var i_=Ca.flatMap(e=>e.palette?[r_(e)]:[]),a_=`ok-omnibar-recents-v1`,o_=10;function s_(e){return typeof e==`object`&&!!e&&(e.kind===`file`||e.kind===`folder`)&&typeof e.path==`string`&&typeof e.lastOpenedAt==`string`}function c_(e){if(e)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function l_(e,t){return`${e}:${t}`}function u_(e){let t=c_(e);if(!t)return[];try{let e=t.getItem(a_);if(!e)return[];let n=JSON.parse(e);return Array.isArray(n)?n.filter(s_).slice(0,o_):[]}catch{return[]}}function d_(e,t){let n=c_(t);if(n)try{n.setItem(a_,JSON.stringify(e.slice(0,o_)))}catch(e){console.warn(`[omnibar] Failed to save recent entries:`,e)}}function f_(e,t){return[t,...e.filter(e=>e.kind!==t.kind||e.path!==t.path)].slice(0,o_)}function p_(e,t){return e.filter(e=>t.has(l_(e.kind,e.path)))}var m_=50,h_=50,g_=``,__=null;function v_(e){return e.trim().toLowerCase()}function y_(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function b_(e){let t=e.trim();return t?[...new Set(t.split(/\s+/).filter(Boolean))].sort((e,t)=>t.length-e.length):[]}function x_(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:Ha(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:Ha(e),bodyIndexed:!1}));for(let e of t)a.push({kind:`folder`,path:e,name:Ha(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 S_(e){return fi({kind:e.kind===`folder`?`folder`:e.bodyIndexed===!1?`file`:`page`,path:e.path,title:e.title??e.name,modifiedTs:e.modifiedTs??0})}function C_(e){return{entries:e,byId:new Map(e.map(e=>[`${e.kind===`folder`?`folder`:e.bodyIndexed===!1?`file`:`page`}:${e.path}`,e])),corpus:Ma(e.map(S_))}}function w_(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 T_(e){let t=w_(e);return __&&g_===t?__:(g_=t,__=C_(e),__)}function E_(e,t,n=m_){return D_(T_(e),t,n)}function D_(e,t,n=m_){let r=v_(t);return r?oa(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 O_(e,t){let n=b_(t);if(n.length===0||e.length===0)return[{text:e,match:!1,start:0}];let r=RegExp(`(${n.map(y_).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 k_(e){if(e.kind!==`page`&&e.kind!==`folder`&&e.kind!==`file`||typeof e.path!=`string`)return null;let t=Ha(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 A_(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??h_,source:`omnibar`,...t.semantic?{semantic:!0}:{}}),signal:t.signal});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(Al(e)??`Search failed with status ${r.status}`)}let i=await r.json();return{entries:(i.results??[]).map(k_).filter(e=>!!e),truncated:i.truncated===!0,ready:i.ready!==!1}}function j_(e,t,n=[]){let r=v_(t);return r?v_([e,...n].join(` `)).includes(r):!0}function M_(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 N_(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 P_=`tag:`;function F_(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 I_(e,t){return W(e,t)}var L_=b;async function R_(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 z_=(0,Q.lazy)(()=>n(()=>import(`./FeedbackForm-DuEQbMOb.js`).then(e=>({default:e.FeedbackForm})),[],import.meta.url)),B_=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)(gn,{children:(0,Z.jsx)(fn,{children:(0,Z.jsx)(J,{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)(pn,{children:[o,(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(z_,{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)(_n,{open:n,onOpenChange:r,children:c}),t[7]=r,t[8]=n,t[9]=c,t[10]=l):l=t[10],l},V_=[`.md`,`.mdx`];function H_(e){let t=e.toLowerCase();for(let e of V_)if(t.endsWith(e))return e;return null}var U_={local:0,inherited:1};function W_(e){return[...e].sort((e,t)=>{let n=U_[e.scope]-U_[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 G_=`__blank__`;function K_(e){return e.trim()?e.includes(`..`)?`dotdot`:e.startsWith(`/`)?`leading-slash`:e.includes(`\\`)?`backslash`:e.includes(`\0`)?`null-byte`:null:`empty`}function q_(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 J_(e){let t=e.fileName.trim(),n=H_(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 Y_(e,t){return Sl(e.target)?!1:xl(e,`new-item`,t)}function X_(e){let t=e.value.lastIndexOf(`.`);t>0?e.setSelectionRange(0,t):e.select()}function Z_(e){let t=(0,$.c)(136),{open:n,onOpenChange:r,kind:i,initialDir:a,suggestedName:o,initialTemplate:s,defaultToTemplate:c,description:l,onCreated:u,folderConfig:d}=e,{_:f}=mt(),{addPage:p}=Bo(),m=Ds(d?null:a),g=d??m,[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(``),[x,S]=(0,Q.useState)(G_),[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]!==s||t[1]!==i||t[2]!==n||t[3]!==o?(B=()=>{n&&(E(null),A(null),O(!1),b(``),S(i===`file`&&s?s:G_),w(!1),L(!1),v(i===`file`?o??`untitled`:`index`))},V=[n,i,o,s],t[0]=s,t[1]=i,t[2]=n,t[3]=o,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`?W_(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,ee;t[9]!==g.state.data||t[10]!==g.state.status||t[11]!==n||t[12]!==x?(ee=()=>{n&&x!==G_&&g.state.status===`ready`&&((g.state.data.folder.templates_available??[]).some(e=>e.name===x)||S(G_))},t[9]=g.state.data,t[10]=g.state.status,t[11]=n,t[12]=x,t[13]=ee):ee=t[13];let W;t[14]!==g.state||t[15]!==n||t[16]!==x?(W=[n,x,g.state],t[14]=g.state,t[15]=n,t[16]=x,t[17]=W):W=t[17],(0,Q.useEffect)(ee,W);let G;t[18]!==c||t[19]!==g.state.data||t[20]!==g.state.status||t[21]!==s||t[22]!==n||t[23]!==C?(G=()=>{if(!n||!c||s||C||g.state.status!==`ready`)return;let e=W_(g.state.data.folder.templates_available??[]);e.length>0&&S(e[0].name)},t[18]=c,t[19]=g.state.data,t[20]=g.state.status,t[21]=s,t[22]=n,t[23]=C,t[24]=G):G=t[24];let K;t[25]!==c||t[26]!==g.state||t[27]!==s||t[28]!==n||t[29]!==C?(K=[n,c,s,C,g.state],t[25]=c,t[26]=g.state,t[27]=s,t[28]=n,t[29]=C,t[30]=K):K=t[30],(0,Q.useEffect)(G,K);let te=i===`file`,ne=g.state.status===`loading`||g.state.status===`idle`,q=g.state.status===`error`?g.state.message:null,re;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(re=function(e){v(e),E(null)},t[31]=re):re=t[31];let ie=re,ae;t[32]!==_||t[33]!==y||t[34]!==a||t[35]!==i?(ae=function(){return J_({kind:i,initialDir:a,fileName:_,folderName:y})},t[32]=_,t[33]=y,t[34]=a,t[35]=i,t[36]=ae):ae=t[36];let oe=ae,se;t[37]!==f||t[38]!==_||t[39]!==y||t[40]!==i?(se=function(){if(i===`folder`){let e=K_(y.trim());if(e)return{message:f({id:`ODGGlj`,values:{detail:f(q_(e))}}),field:`folder`}}let e=K_(_.trim());return e?{message:f(q_(e)),field:`file`}:null},t[37]=f,t[38]=_,t[39]=y,t[40]=i,t[41]=se):se=t[41];let ce=se,le;t[42]!==D||t[43]!==_||t[44]!==y||t[45]!==i?(le=D||!_.trim()||i===`folder`&&!y.trim(),t[42]=D,t[43]=_,t[44]=y,t[45]=i,t[46]=le):le=t[46];let ue=le,de;t[47]!==f||t[48]!==p||t[49]!==oe||t[50]!==ce||t[51]!==i||t[52]!==u||t[53]!==r||t[54]!==x?(de=async function(){let e=ce();if(e){E(e.message),A(e.field);return}O(!0),E(null),A(null);let t=oe(),n=i===`file`&&x!==G_?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 h(e,f({id:`d2uTPx`,values:{status:t}}));if(!n.ok){O(!1),E(n.title),A(`form`);return}let o=qi.safeParse(n.body);if(O(!1),!o.success){E(f(i===`folder`?{id:`K1ckLX`}:{id:`fJgQHX`})),A(`form`);return}let s=o.data.docName;r(!1),window.location.hash=`#/${s}`,p(s),eu([`files`,`backlinks`,`graph`]),u?.(s)}catch(e){console.warn(`[NewItemDialog] create failed:`,e),O(!1),E(f({id:`HIb0vl`})),A(`form`)}},t[47]=f,t[48]=p,t[49]=oe,t[50]=ce,t[51]=i,t[52]=u,t[53]=r,t[54]=x,t[55]=de):de=t[55];let fe=de,pe;t[56]!==f||t[57]!==a?(pe=a||f({id:`L6Hhh6`}),t[56]=f,t[57]=a,t[58]=pe):pe=t[58];let me=pe,he;t[59]===i?he=t[60]:(he=(0,Z.jsx)(fn,{children:i===`file`?(0,Z.jsx)(J,{id:`HdkSiO`}):(0,Z.jsx)(J,{id:`96G6Re`})}),t[59]=i,t[60]=he);let ge;t[61]!==l||t[62]!==me?(ge=l??(0,Z.jsx)(J,{id:`NvOvTi`,values:{dirDisplay:me},components:{0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})}}),t[61]=l,t[62]=me,t[63]=ge):ge=t[63];let _e;t[64]===ge?_e=t[65]:(_e=(0,Z.jsx)(dn,{children:ge}),t[64]=ge,t[65]=_e);let ve;t[66]!==he||t[67]!==_e?(ve=(0,Z.jsxs)(gn,{children:[he,_e]}),t[66]=he,t[67]=_e,t[68]=ve):ve=t[68];let ye;t[69]!==x||t[70]!==te||t[71]!==P||t[72]!==I||t[73]!==F||t[74]!==U||t[75]!==q||t[76]!==ne?(ye=te&&(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)(J,{id:`f65AOQ`})}),q?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,children:(0,Z.jsx)(J,{id:`sE7R19`,values:{templatesError:q}})}):null,(0,Z.jsx)($_,{triggerId:F,labelledById:P,open:I,onOpenChange:L,value:x,onValueChange:e=>{S(e),w(!0)},templates:U,loading:ne}),!ne&&!q&&U.length===0?(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`uWtdQR`})}):null]}),t[69]=x,t[70]=te,t[71]=P,t[72]=I,t[73]=F,t[74]=U,t[75]=q,t[76]=ne,t[77]=ye):ye=t[77];let be;t[78]!==f||t[79]!==T||t[80]!==k||t[81]!==j||t[82]!==M||t[83]!==y||t[84]!==i?(be=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)(J,{id:`cqQyPB`})}),(0,Z.jsx)(_l,{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=K_(y.trim());if(t){E(f({id:`ODGGlj`,values:{detail:f(q_(t))}})),A(`folder`);return}R.current?.focus()}}})]}),t[78]=f,t[79]=T,t[80]=k,t[81]=j,t[82]=M,t[83]=y,t[84]=i,t[85]=be):be=t[85];let xe;t[86]===i?xe=t[87]:(xe=i===`folder`?(0,Z.jsx)(J,{id:`jjtmV_`}):(0,Z.jsx)(J,{id:`s-XOaI`}),t[86]=i,t[87]=xe);let Se;t[88]!==N||t[89]!==xe?(Se=(0,Z.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:N,children:xe}),t[88]=N,t[89]=xe,t[90]=Se):Se=t[90];let Ce;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=e=>ie(e.target.value),t[91]=Ce):Ce=t[91];let we=i===`file`,Te=T&&(k===`file`||k===`form`)?j:void 0,Ee=T&&(k===`file`||k===`form`)?!0:void 0,De;t[92]!==fe||t[93]!==ue?(De=e=>{e.key===`Enter`&&!ue&&fe()},t[92]=fe,t[93]=ue,t[94]=De):De=t[94];let Oe;t[95]!==N||t[96]!==_||t[97]!==we||t[98]!==Te||t[99]!==Ee||t[100]!==De?(Oe=(0,Z.jsx)(_l,{ref:R,id:N,value:_,onChange:Ce,placeholder:`my-note`,autoFocus:we,"aria-describedby":Te,"aria-invalid":Ee,onFocus:Q_,onKeyDown:De}),t[95]=N,t[96]=_,t[97]=we,t[98]=Te,t[99]=Ee,t[100]=De,t[101]=Oe):Oe=t[101];let ke;t[102]!==T||t[103]!==j?(ke=T&&(0,Z.jsx)(`p`,{id:j,role:`alert`,className:`text-1sm text-destructive`,children:T}),t[102]=T,t[103]=j,t[104]=ke):ke=t[104];let Ae;t[105]!==Se||t[106]!==Oe||t[107]!==ke?(Ae=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[Se,Oe,ke]}),t[105]=Se,t[106]=Oe,t[107]=ke,t[108]=Ae):Ae=t[108];let je;t[109]!==ye||t[110]!==be||t[111]!==Ae?(je=(0,Z.jsxs)(mn,{className:`space-y-6 pb-1`,children:[ye,be,Ae]}),t[109]=ye,t[110]=be,t[111]=Ae,t[112]=je):je=t[112];let Me;t[113]===r?Me=t[114]:(Me=()=>r(!1),t[113]=r,t[114]=Me);let Ne;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,Z.jsx)(J,{id:`dEgA5A`}),t[115]=Ne):Ne=t[115];let Pe;t[116]!==D||t[117]!==Me?(Pe=(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:Me,disabled:D,children:Ne}),t[116]=D,t[117]=Me,t[118]=Pe):Pe=t[118];let Fe;t[119]===D?Fe=t[120]:(Fe=D?(0,Z.jsx)(J,{id:`E9bKSA`}):(0,Z.jsx)(J,{id:`hYgDIe`}),t[119]=D,t[120]=Fe);let Ie;t[121]!==fe||t[122]!==ue||t[123]!==Fe?(Ie=(0,Z.jsx)(X,{onClick:fe,disabled:ue,children:Fe}),t[121]=fe,t[122]=ue,t[123]=Fe,t[124]=Ie):Ie=t[124];let Le;t[125]!==Pe||t[126]!==Ie?(Le=(0,Z.jsxs)(hn,{children:[Pe,Ie]}),t[125]=Pe,t[126]=Ie,t[127]=Le):Le=t[127];let Re;t[128]!==ve||t[129]!==je||t[130]!==Le?(Re=(0,Z.jsxs)(pn,{className:`sm:max-w-md`,"data-ok-layer-spawned":``,children:[ve,je,Le]}),t[128]=ve,t[129]=je,t[130]=Le,t[131]=Re):Re=t[131];let ze;return t[132]!==r||t[133]!==n||t[134]!==Re?(ze=(0,Z.jsx)(_n,{open:n,onOpenChange:r,children:Re}),t[132]=r,t[133]=n,t[134]=Re,t[135]=ze):ze=t[135],ze}function Q_(e){return X_(e.currentTarget)}function $_(e){let t=(0,$.c)(66),{triggerId:n,labelledById:r,open:i,onOpenChange:a,value:o,onValueChange:c,templates:l,loading:u}=e,{_:d}=mt(),f=(0,Q.useId)(),p;if(t[0]!==l||t[1]!==o){let e;t[3]===o?e=t[4]:(e=e=>e.name===o,t[3]=o,t[4]=e),p=l.find(e),t[0]=l,t[1]=o,t[2]=p}else p=t[2];let m=p,h=o===G_,g=i?f:void 0,_=`${r} ${n}`,v;t[5]!==h||t[6]!==u||t[7]!==m?.name||t[8]!==m?.title||t[9]!==o?(v=u?(0,Z.jsx)(J,{id:`Hl89Qd`}):h?(0,Z.jsx)(J,{id:`E7BhZn`}):m?.title??m?.name??o,t[5]=h,t[6]=u,t[7]=m?.name,t[8]=m?.title,t[9]=o,t[10]=v):v=t[10];let y;t[11]===v?y=t[12]:(y=(0,Z.jsx)(`span`,{className:`truncate`,children:v}),t[11]=v,t[12]=y);let b;t[13]!==h||t[14]!==u||t[15]!==m?(b=!u&&!h&&m?(0,Z.jsx)(rv,{entry:m}):null,t[13]=h,t[14]=u,t[15]=m,t[16]=b):b=t[16];let x;t[17]!==y||t[18]!==b?(x=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[y,b]}),t[17]=y,t[18]=b,t[19]=x):x=t[19];let S;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(vh,{className:`ml-2 size-4 shrink-0 opacity-50`,"aria-hidden":`true`}),t[20]=S):S=t[20];let C;t[21]!==u||t[22]!==i||t[23]!==g||t[24]!==_||t[25]!==x||t[26]!==n?(C=(0,Z.jsx)(Bt,{asChild:!0,children:(0,Z.jsxs)(X,{id:n,type:`button`,variant:`outline`,role:`combobox`,"aria-expanded":i,"aria-haspopup":`listbox`,"aria-controls":g,"aria-labelledby":_,disabled:u,className:`w-full justify-between font-normal`,children:[x,S]})}),t[21]=u,t[22]=i,t[23]=g,t[24]=_,t[25]=x,t[26]=n,t[27]=C):C=t[27];let w;t[28]===d?w=t[29]:(w=d({id:`UQAp48`}),t[28]=d,t[29]=w);let T;t[30]===w?T=t[31]:(T=(0,Z.jsx)(A,{placeholder:w}),t[30]=w,t[31]=T);let E;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(s,{children:(0,Z.jsx)(J,{id:`c8iK2Y`})}),t[32]=E):E=t[32];let D;if(t[33]!==a||t[34]!==c||t[35]!==l||t[36]!==o){let e;t[38]!==a||t[39]!==c||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)(M,{value:r,keywords:[t,e.name,e.description??``,e.scope,e.source_folder??``],onSelect:()=>{c(e.name),a(!1)},className:`items-start gap-3`,children:[(0,Z.jsx)(Po,{className:Y(`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)(rv,{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]=c,t[40]=o,t[41]=e):e=t[41],D=l.map(e),t[33]=a,t[34]=c,t[35]=l,t[36]=o,t[37]=D}else D=t[37];let O;t[42]!==a||t[43]!==c?(O=()=>{c(G_),a(!1)},t[42]=a,t[43]=c,t[44]=O):O=t[44];let k=o===G_?`opacity-100`:`opacity-0`,j;t[45]===k?j=t[46]:(j=Y(`mt-1 size-4 shrink-0`,k),t[45]=k,t[46]=j);let N;t[47]===j?N=t[48]:(N=(0,Z.jsx)(Po,{className:j,"aria-hidden":`true`}),t[47]=j,t[48]=N);let F;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(`span`,{className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`E7BhZn`})}),t[49]=F):F=t[49];let L;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[F,(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`hZoBHK`})})]}),t[50]=L):L=t[50];let R;t[51]!==O||t[52]!==N?(R=(0,Z.jsxs)(M,{value:`Blank note empty`,onSelect:O,className:`items-start gap-3`,children:[N,L]}),t[51]=O,t[52]=N,t[53]=R):R=t[53];let z;t[54]!==f||t[55]!==D||t[56]!==R?(z=(0,Z.jsxs)(I,{id:f,className:`subtle-scrollbar`,children:[E,D,R]}),t[54]=f,t[55]=D,t[56]=R,t[57]=z):z=t[57];let B;t[58]!==T||t[59]!==z?(B=(0,Z.jsx)(Gt,{className:`w-[var(--radix-popover-trigger-width)] p-0`,align:`start`,onOpenAutoFocus:nv,onWheel:tv,onTouchMove:ev,children:(0,Z.jsxs)(P,{children:[T,z]})}),t[58]=T,t[59]=z,t[60]=B):B=t[60];let V;return t[61]!==a||t[62]!==i||t[63]!==B||t[64]!==C?(V=(0,Z.jsxs)(zt,{open:i,onOpenChange:a,children:[C,B]}),t[61]=a,t[62]=i,t[63]=B,t[64]=C,t[65]=V):V=t[65],V}function ev(e){e.stopPropagation()}function tv(e){e.stopPropagation()}function nv(e){e.preventDefault(),e.currentTarget.querySelector(`[cmdk-input]`)?.focus()}function rv(e){let t=(0,$.c)(7),{entry:n,className:r}=e;if(n.scope===`inherited`){let e;t[0]===r?e=t[1]:(e=Y(`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)(J,{id:`ZNK2Tq`}),t[2]=n.source_folder,t[3]=i);let a;return t[4]!==e||t[5]!==i?(a=(0,Z.jsx)(xu,{variant:`gray`,className:e,children:i}),t[4]=e,t[5]=i,t[6]=a):a=t[6],a}return null}function iv(e){return e.split(`/`).pop()??e}function av(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=>iv(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 ov(e){return e.created.filter(e=>e.kind===`file`&&!e.path.split(`/`).includes(`.ok`)).map(e=>({path:e.path,name:iv(e.path)}))}function sv(e){let t=(0,$.c)(17),{plan:n,selectedPack:r}=e,{_:i}=mt(),a,o,s,c;if(t[0]!==i||t[1]!==n||t[2]!==r){let e=av(n,r),l=ov(n),u=n.packSkill?.pending?n.packSkill:void 0,d=e.length,f=l.length,p=e.reduce(mv,0),m=+!!u,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(pv),_=e.map(e=>({key:`folder:${e.path}`,icon:Ph,name:`${iv(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:ue,name:e.name,title:e.name,description:h[e.name]})),y=u?[{key:`skill:${u.name}`,icon:Lh,name:Us(u.name),title:u.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:`OZJeTZ`}),rows:y}].filter(fv);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)(J,{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(dv)}):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(cv),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 cv(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(lv)})]},e.key)}function lv(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)(sn,{children:[(0,Z.jsx)(rn,{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)(an,{children:(0,Z.jsx)(`ul`,{className:`space-y-0.5 text-left font-mono`,children:e.pillTooltip.map(uv)})})]}):(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 uv(e){return(0,Z.jsx)(`li`,{children:e},e)}function dv(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 fv(e){return e.rows.length>0}function pv(e){return e!==null}function mv(e,t){return e+t.templateCount}async function hv(e){let t=await e.json().catch(()=>null),n=pa.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 gv(){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&&Xl(),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 hv(r)};let i=await r.json().catch(()=>null);return i?.plan?{ok:!0,plan:i.plan}:{ok:!1,error:{kind:`internal`,message:`Malformed plan response`}}},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 hv(n)};let r=await n.json().catch(()=>null);return r?.result?(Xl(),{ok:!0,result:r.result}):{ok:!1,error:{kind:`internal`,message:`Malformed apply response`}}},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:`Malformed listPacks response`}}:{ok:!0,packs:t.packs}}}}var _v={"knowledge-base":Bh,"software-lifecycle":co,"codebase-wiki":gh,"plain-notes":pg,worldbuilding:xh,"writing-pipeline":Qh,"entity-vault":Jh,okf:Th};function vv(e){return _v[e]??Bh}function yv(e){let t=(0,$.c)(69),{onPackSelect:n,onCreateBlankFile:r,collapsedPackIds:i,className:a,packs:o}=e,{_:s}=mt(),[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 gv().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=Y(`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)(J,{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=Y(`@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(_v).length},xv).map(bv)}),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=Y(`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)(J,{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=Y(`@container/packgrid w-full max-w-5xl`,a),t[47]=a,t[48]=k),x=un,T=f,E=p;let s;t[49]===n?s=t[50]:(s=e=>(0,Z.jsx)(Sv,{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)(cn,{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:Y(`grid gap-4 @sm/packgrid:grid-cols-2 @2xl/packgrid:grid-cols-3`,`pt-4`),children:C.map(e=>(0,Z.jsx)(Sv,{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)(ln,{asChild:!0,children:(0,Z.jsxs)(X,{type:`button`,variant:`link-muted`,size:`sm`,children:[f?(0,Z.jsx)(J,{id:`6lGV3K`}):(0,Z.jsx)(J,{id:`ymWJLd`,values:{0:C.length}}),(0,Z.jsx)(Io,{"aria-hidden":`true`,className:Y(`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)(J,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(Kn,{"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 bv(e){return(0,Z.jsx)(Cv,{},`skeleton-${e}`)}function xv(e,t){return t}function Sv(e){let t=(0,$.c)(17),{pack:n,onSelect:r}=e,i;t[0]===n.id?i=t[1]:(i=vv(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 Cv(){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)(Gc,{className:`size-5 animate-spin 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 wv=`knowledge-base`;function Tv(e){let t=(0,$.c)(94),{open:n,onOpenChange:r,onSeedApplied:i,initialPackId:a}=e,{_:o}=mt(),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??wv),[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 gv().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??wv),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(Ev),gv().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.packSkill?.pending===!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 gv().apply(e,{packId:f})}catch(t){let n=t,r=n instanceof Error?n.message:String(n);dl.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.packSkill?.pending===!0,c=o(a>0?{id:`x3-2ta`,values:{packName:n,projectEntries:a}}:s?{id:`B2Srgd`,values:{packName:n}}:{id:`K6jjWB`,values:{packName:n}});dl.success(c),i?.(),r(!1)}else{let n=t.error.message;dl.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 ee=U,W;t[46]!==o||t[47]!==ee||t[48]!==x||t[49]!==v?(W=v===`configure`&&x?ee[x.id]??x.description:o({id:`msqUNq`}),t[46]=o,t[47]=ee,t[48]=x,t[49]=v,t[50]=W):W=t[50];let G=W,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 te=K,ne;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(ne=function(){y(`pick`),l({kind:`loading`}),b.current=!0},t[52]=ne):ne=t[52];let q=ne,re;t[53]===P?re=t[54]:(re=(0,Z.jsx)(fn,{children:P}),t[53]=P,t[54]=re);let ie;t[55]===G?ie=t[56]:(ie=(0,Z.jsx)(dn,{children:G}),t[55]=G,t[56]=ie);let ae;t[57]!==re||t[58]!==ie?(ae=(0,Z.jsxs)(gn,{children:[re,ie]}),t[57]=re,t[58]=ie,t[59]=ae):ae=t[59];let oe;t[60]!==u||t[61]!==c||t[62]!==m||t[63]!==x||t[64]!==v||t[65]!==g?(oe=v===`pick`?(0,Z.jsx)(mn,{children:(0,Z.jsx)(yv,{packs:u,onPackSelect:te})}):(0,Z.jsxs)(mn,{className:`space-y-6`,children:[(0,Z.jsx)(Dv,{choice:m,subfolder:g,placeholder:x?.defaultSubfolder??`subfolder`,onChoiceChange:h,onSubfolderChange:_}),(0,Z.jsx)(Ov,{phase:c,selectedPack:x})]}),t[60]=u,t[61]=c,t[62]=m,t[63]=x,t[64]=v,t[65]=g,t[66]=oe):oe=t[66];let se;t[67]!==M||t[68]!==v?(se=v===`configure`&&!M?(0,Z.jsxs)(X,{className:`mr-auto uppercase font-mono`,variant:`ghost`,onClick:q,children:[(0,Z.jsx)(Pn,{"aria-hidden":`true`,className:`h-4 w-4`}),(0,Z.jsx)(J,{id:`iH8pgl`})]}):null,t[67]=M,t[68]=v,t[69]=se):se=t[69];let ce;t[70]===r?ce=t[71]:(ce=()=>r(!1),t[70]=r,t[71]=ce);let le;t[72]===c.kind?le=t[73]:(le=c.kind===`already-seeded`||c.kind===`error`?(0,Z.jsx)(J,{id:`yz7wBu`}):(0,Z.jsx)(J,{id:`dEgA5A`}),t[72]=c.kind,t[73]=le);let ue;t[74]!==ce||t[75]!==le?(ue=(0,Z.jsx)(X,{className:`uppercase font-mono`,variant:`outline`,onClick:ce,children:le}),t[74]=ce,t[75]=le,t[76]=ue):ue=t[76];let de;t[77]!==j||t[78]!==c.kind||t[79]!==v||t[80]!==O?(de=v===`configure`&&c.kind===`plan`?(0,Z.jsx)(X,{onClick:j,disabled:O,children:(0,Z.jsx)(J,{id:`4TzU0n`})}):v===`configure`&&c.kind===`applying`?(0,Z.jsxs)(X,{disabled:!0,children:[(0,Z.jsx)(Gc,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),(0,Z.jsx)(J,{id:`XYlJJT`})]}):null,t[77]=j,t[78]=c.kind,t[79]=v,t[80]=O,t[81]=de):de=t[81];let fe;t[82]!==se||t[83]!==ue||t[84]!==de?(fe=(0,Z.jsxs)(hn,{children:[se,ue,de]}),t[82]=se,t[83]=ue,t[84]=de,t[85]=fe):fe=t[85];let pe;t[86]!==ae||t[87]!==oe||t[88]!==fe?(pe=(0,Z.jsxs)(pn,{className:`sm:max-w-4xl`,"data-ok-layer-spawned":``,children:[ae,oe,fe]}),t[86]=ae,t[87]=oe,t[88]=fe,t[89]=pe):pe=t[89];let me;return t[90]!==r||t[91]!==n||t[92]!==pe?(me=(0,Z.jsx)(_n,{open:n,onOpenChange:r,children:pe}),t[90]=r,t[91]=n,t[92]=pe,t[93]=me):me=t[93],me}function Ev(e){return e.kind===`plan`||e.kind===`already-seeded`?e:{kind:`loading`}}function Dv(e){let t=(0,$.c)(22),{choice:n,subfolder:r,placeholder:i,onChoiceChange:a,onSubfolderChange:o}=e,{_:s}=mt(),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Z.jsx)(J,{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)(tl,{children:(0,Z.jsx)(J,{id:`RSqaSd`})}),t[3]=u):u=t[3];let d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)($c,{htmlFor:`seed-root-project-root`,children:(0,Z.jsxs)(nl,{orientation:`horizontal`,children:[(0,Z.jsxs)(Qc,{children:[u,(0,Z.jsx)(el,{className:`text-1sm`,children:(0,Z.jsx)(J,{id:`ZvzbDF`})})]}),(0,Z.jsx)(Lr,{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)(tl,{children:(0,Z.jsx)(J,{id:`ZWgr0b`})}),t[5]=f):f=t[5];let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(el,{className:`nth-last-2:mt-0 text-1sm`,children:(0,Z.jsx)(J,{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)(_l,{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)(Qc,{children:[f,p,m]}),t[13]=m,t[14]=h);let g;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(Lr,{value:`subfolder`,id:`seed-root-subfolder`}),t[15]=g):g=t[15];let _;t[16]===h?_=t[17]:(_=(0,Z.jsx)($c,{htmlFor:`seed-root-subfolder`,children:(0,Z.jsxs)(nl,{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)(Rr,{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 Ov(e){let t=(0,$.c)(19),{phase:n,selectedPack:r}=e,{_:i}=mt();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},jv).map(Av)}),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)(J,{id:`YwPUUP`})}),t[9]=e):e=t[9];let n;return t[10]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`py-2 text-sm`,children:[e,(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:(0,Z.jsx)(J,{id:`h-AdvS`})})]}),t[10]=n):n=t[10],n}let a;t[11]!==n.plan||t[12]!==r?(a=n.plan.created.length>0||n.plan.packSkill?.pending?(0,Z.jsx)(sv,{plan:n.plan,selectedPack:r}):null,t[11]=n.plan,t[12]=r,t[13]=a):a=t[13];let o;t[14]===n.plan.warnings?o=t[15]:(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(kv)}):null,t[14]=n.plan.warnings,t[15]=o);let s;return t[16]!==a||t[17]!==o?(s=(0,Z.jsxs)(`div`,{className:`space-y-6 py-1 text-sm`,children:[a,o]}),t[16]=a,t[17]=o,t[18]=s):s=t[18],s}function kv(e){return(0,Z.jsx)(`p`,{children:e},e)}function Av(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 jv(e,t){return t}function Mv(){return(0,Q.useSyncExternalStore)(ad,od,od)}function Nv(e,t){return e instanceof Error&&e.message?e.message:t}async function Pv(e,t,n,r=`action`){try{n(null),await e()}catch(e){console.error(`[${r}] action failed:`,e),n(Nv(e,t))}}async function Fv(e,t,n=dl,r=`action`){await Pv(e,t,e=>{e!==null&&n.error(e)},r)}var Iv=(0,Q.createContext)(!1);function Lv(e){let t=(0,$.c)(5),{children:n}=e,[r,i]=(0,Q.useState)(zv),a,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{if(window.okDesktop)return;let e=new AbortController;return Eu(e.signal).then(t=>{e.signal.aborted||t.status!==`ok`||i(t.config.singleFile)}).catch(Rv),()=>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)(Iv,{value:r,children:n}),t[2]=n,t[3]=r,t[4]=s):s=t[4],s}function Rv(){}function zv(){return typeof window<`u`?window.okDesktop?.config.singleFile??!1:!1}function Bv(){return(0,Q.use)(Iv)}function Vv(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)=>Hv(e)-Hv(t))}function Hv(e){return e.isMain?0:e.opened?1:2}function Uv(e){let t=e.split(/[/\\]/).filter(e=>e.length>0);return t.length>0?t[t.length-1]??e:e}function Wv(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:Uv(e.mainRoot),lastOpenedAt:``},worktrees:e.worktrees,projectSynthesized:t}})}function Gv(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)(Um,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function Kv(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=Y(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Wm,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function qv(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)(qm,{"data-slot":`context-menu-group`,...n}),t[2]=n,t[3]=r),r}function Jv(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)($m,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function Yv(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=Y(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-36 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Gm,{children:(0,Z.jsx)(Km,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Xv(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,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=Y(`group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,Z.jsx)(Ym,{"data-slot":`context-menu-item`,"data-inset":r,"data-variant":o,className:s,...i}),t[7]=r,t[8]=i,t[9]=s,t[10]=o,t[11]=c):c=t[11],c}function Zv(e){let t=(0,$.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=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=Y(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Lo,{className:`ml-auto`}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,Z.jsxs)(eh,{"data-slot":`context-menu-sub-trigger`,"data-inset":i,className:o,...a,children:[n,s]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function Qv(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=Y(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border bg-popover p-1 text-popover-foreground shadow-lg data-[state=closed]:overflow-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0 subtle-scrollbar`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(th,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function $v(e){let t=(0,$.c)(15),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:i,children:r,checked:n,inset:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===i?s=t[7]:(s=Y(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,i),t[6]=i,t[7]=s);let c;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`span`,{className:`pointer-events-none absolute right-2`,children:(0,Z.jsx)(Zm,{children:(0,Z.jsx)(Po,{})})}),t[8]=c):c=t[8];let l;return t[9]!==n||t[10]!==r||t[11]!==a||t[12]!==o||t[13]!==s?(l=(0,Z.jsxs)(Xm,{"data-slot":`context-menu-checkbox-item`,"data-inset":a,className:s,checked:n,...o,children:[c,r]}),t[9]=n,t[10]=r,t[11]=a,t[12]=o,t[13]=s,t[14]=l):l=t[14],l}function ey(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=Y(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(Jm,{"data-slot":`context-menu-label`,"data-inset":r,className:a,...i}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function ty(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=Y(`-mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Qm,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ny(e){let t=(0,$.c)(14),{path:n,name:r,onRemoveRecent:i,testIdPrefix:a}=e,{_:o}=mt(),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)(ul,{"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 ry(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)(Kv,{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)(ul,{"aria-hidden":`true`}),u=(0,Z.jsx)(J,{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)(Yv,{children:(0,Z.jsxs)(Xv,{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)(Gv,{children:[o,d]}),t[10]=o,t[11]=d,t[12]=f):f=t[12],f}var iy=(0,Q.lazy)(()=>n(()=>import(`./BugReportHistoryDialog-B5Yf5rAM.js`),__vite__mapDeps([45,10,1,11,12,23,14,15,16,17,24,25,26,22,27,34,35,36,37,33,38,39]),import.meta.url)),ay=3e3,oy=600,sy=20,cy=(e,t,n)=>Fv(e,t,n,`CommandPalette`);function ly(e){window.location.assign(vu(e))}function uy(e,t){return e?.kind===`folder`||e?.kind===`folder-index`?e.folderPath:Ll(t)}function dy(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)(S,{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)(`span`,{className:`truncate font-medium`,children:(0,Z.jsx)(py,{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)(`span`,{className:`truncate text-muted-foreground text-xs`,children:(0,Z.jsx)(py,{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)(`span`,{className:`max-h-10 overflow-hidden text-muted-foreground text-xs leading-relaxed`,children:(0,Z.jsx)(py,{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)(M,{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 fy(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)(J,{id:`GuLeuE`,values:{0:kl(`find`)},components:{0:(0,Z.jsx)(U,{"aria-label":El(`find`)})}}):n===`truncated`?(0,Z.jsx)(J,{id:`-q4abP`}):(0,Z.jsx)(J,{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 py(e){let t=(0,$.c)(5),{text:n,query:r}=e,i;t[0]!==r||t[1]!==n?(i=O_(n,r).map(my),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 my(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 hy({searchResults:e,fallbackSearchResults:t,searchStatus:n}){return e.length>0?e:n===`success`?[]:t}function gy(e){let t=(0,$.c)(146),{bridge:n,open:r,onOpenChange:i}=e,a=n===void 0?null:n,{_:o}=mt(),c=Bv(),[l,u]=(0,Q.useState)(``),d=(0,Q.useDeferredValue)(l),f=d.trim(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=[],t[0]=p):p=t[0];let[m,h]=(0,Q.useState)(p),[g,v]=(0,Q.useState)(`idle`),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(!1),T;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(T=[],t[1]=T):T=t[1];let[E,D]=(0,Q.useState)(T),[O,k]=(0,Q.useState)(null),[j,N]=(0,Q.useState)(`idle`),P;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(P=[],t[2]=P):P=t[2];let[F,L]=(0,Q.useState)(P),R;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(R=[],t[3]=R):R=t[3];let[z,B]=(0,Q.useState)(R),[V,H]=(0,Q.useState)(null),[ee,W]=(0,Q.useState)(!1),[G,K]=(0,Q.useState)(!1),[te,ne]=(0,Q.useState)(!1),[q,re]=(0,Q.useState)(!1),[ie,ae]=(0,Q.useState)(!1),[oe,se]=(0,Q.useState)(!1),ce;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(ce=[],t[4]=ce):ce=t[4];let[le,ue]=(0,Q.useState)(ce),[de,fe]=(0,Q.useState)(`idle`),pe;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(pe=[],t[5]=pe):pe=t[5];let[me,he]=(0,Q.useState)(pe),[ge,_e]=(0,Q.useState)(`idle`),ve=(0,Q.useRef)(!1),ye=(0,Q.useRef)(null),be=(0,Q.useRef)(null),xe=(0,Q.useRef)(null),Se=(0,Q.useRef)(null),{activeDocName:Ce,activeTarget:we}=Re(),{pages:Te,pageTitles:Ee,pageMeta:De,folderPaths:Oe,filePaths:ke,loading:je}=Bo(),Ne=sd(),{states:Pe,refresh:Fe}=es(),{dispatch:Ie}=Jo(),Le;t[6]===r?Le=t[7]:(Le={enabled:r},t[6]=r,t[7]=Le);let{status:ze,refresh:Be}=Os(Le),Ve=(ze?.enabled??!1)&&(ze?.keyPresent??!1),He=ze?.embedded??0,Ue=ze?.total??0,We=Ve&&Ue>0&&He<Ue,Ge;t[8]!==C||t[9]!==r||t[10]!==Be||t[11]!==We?(Ge=()=>{if(!r||!C||!We)return;let e=window.setInterval(()=>Be(),2500);return()=>window.clearInterval(e)},t[8]=C,t[9]=r,t[10]=Be,t[11]=We,t[12]=Ge):Ge=t[12];let Ke;t[13]!==C||t[14]!==r||t[15]!==We?(Ke=[r,C,We],t[13]=C,t[14]=r,t[15]=We,t[16]=Ke):Ke=t[16],(0,Q.useEffect)(Ge,Ke);let qe=is({docName:Ce,workspace:Ne}),Je=x_(Te,Oe,Ee,De,ke),Ye=p_(z,new Set(Je.map(by))),Xe=a?.config.projectPath??null,Ze=a?F.filter(e=>e.path!==Xe):[],Qe=Mv(),$e=a&&Qe?Qe.entries.filter(yy):[],et;t[17]!==Ce||t[18]!==we?(et=uy(we,Ce),t[17]=Ce,t[18]=we,t[19]=et):et=t[19];let tt=et,nt=f===``?[]:E_(Je,f,8),rt,it;t[20]!==i||t[21]!==r?(rt=()=>{let e=function(e){xl(e,`command-palette`)&&(e.preventDefault(),i(!r))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},it=[i,r],t[20]=i,t[21]=r,t[22]=rt,t[23]=it):(rt=t[22],it=t[23]),(0,Q.useEffect)(rt,it);let at,ot;t[24]!==o||t[25]!==a||t[26]!==r||t[27]!==Fe?(at=()=>{if(r){if(B(u_()),Fe(),a){let e=!1;return cy(async()=>{let t=await a.project.listRecent();e||L(t)},o({id:`fYKgzG`})),()=>{e=!0}}return}u(``),ue([]),fe(`idle`),ve.current=!1,he([]),_e(`idle`),w(!1),xe.current?.abort(),xe.current=null,Se.current!==null&&(window.clearTimeout(Se.current),Se.current=null),D([]),k(null),N(`idle`)},ot=[r,a,Fe,o],t[24]=o,t[25]=a,t[26]=r,t[27]=Fe,t[28]=at,t[29]=ot):(at=t[28],ot=t[29]),(0,Q.useEffect)(at,ot);let st;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(st=()=>{ye.current&&(ye.current.scrollTop=0)},t[30]=st):st=t[30];let ct;t[31]===l?ct=t[32]:(ct=[l],t[31]=l,t[32]=ct),(0,Q.useEffect)(st,ct);let lt=new Set(le.map(vy)),ut=C?{kind:`normal`,query:d}:F_(d,lt),dt=ut.kind!==`normal`,ft=dt||C,pt=ut.kind===`tag-list`?ut.query:``,ht=ut.kind===`tag-docs`?ut.tagName:``,gt=l.trim(),_t=C?N_({query:gt,firedQuery:O,status:j,resultCount:E.length}):null,vt=_t?.submit?.query??``,yt=_t?.results.forQuery??``,bt,xt;t[33]!==dt||t[34]!==r?(bt=()=>{if(!r||!dt||ve.current)return;ve.current=!0,fe(`loading`);let e=!1;return L_().then(t=>{e||(ue(t),fe(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tags failed`,t),ue([]),fe(`error`))}),()=>{e=!0}},xt=[r,dt],t[33]=dt,t[34]=r,t[35]=bt,t[36]=xt):(bt=t[35],xt=t[36]),(0,Q.useEffect)(bt,xt);let St=ut.kind===`tag-docs`?ut.tagName:null;(0,Q.useEffect)(()=>{if(!r||St===null){he([]),_e(`idle`);return}_e(`loading`),he([]);let e=!1;return R_(St).then(t=>{e||(he(t),_e(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tag docs failed`,t),he([]),_e(`error`))}),()=>{e=!0}},[r,St]),(0,Q.useEffect)(()=>{if(!r||!f||ft||je){h([]),v(`idle`),b(!1),S(!1);return}let e=!1,t=!1,n=0,i=null,a,o;v(`loading`);let s=()=>e||n>=sy?!1:(n+=1,o=window.setTimeout(l,oy),!0),c=()=>{e||t&&s()||(h([]),v(`error`),b(!1),S(!1))};function l(){let n=new AbortController;i=n,a=window.setTimeout(()=>{n.abort(),c()},ay),A_(f,{signal:n.signal}).then(n=>{let{entries:r,truncated:i,ready:o}=n;if(window.clearTimeout(a),!e){if(!o){t||(t=!0,h([]),b(!1),S(!0),v(`success`)),s()||S(!1);return}h(r),b(i),S(!1),v(`success`)}}).catch(t=>{window.clearTimeout(a),!e&&(t instanceof Error&&t.name===`AbortError`||c())})}return l(),()=>{e=!0,window.clearTimeout(a),window.clearTimeout(o),i?.abort()}},[r,f,ft,je]);let Ct;t[37]!==o||t[38]!==i?(Ct=(e,t)=>{let n=t===void 0?o({id:`uuoHOU`}):t;i(!1),cy(async()=>{await e()},n)},t[37]=o,t[38]=i,t[39]=Ct):Ct=t[39];let wt=Ct,Tt;t[40]!==o||t[41]!==a?(Tt=e=>{a&&cy(async()=>{await a.project.removeRecent(e),L(t=>t.filter(t=>t.path!==e))},o({id:`viwC-K`}))},t[40]=o,t[41]=a,t[42]=Tt):Tt=t[42];let Et=Tt,Dt;t[43]!==o||t[44]!==a||t[45]!==wt?(Dt=e=>{if(!a)return;let t=e.worktreePath;if(t!==null){wt(()=>a.project.open({path:t,target:`new-window`,entryPoint:`worktree`}),o({id:`LwMxXg`}));return}let n=e.branch;n!==null&&wt(async()=>{let e=await a.worktree.create({branch:n,createBranch:!1});if(!e.ok)throw Error(e.reason);id(),await a.project.open({path:e.path,target:`new-window`,entryPoint:`worktree`})},o({id:`LwMxXg`}))},t[43]=o,t[44]=a,t[45]=wt,t[46]=Dt):Dt=t[46];let Ot=Dt,kt;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(kt=function(e){let t={kind:e.kind,path:e.path,lastOpenedAt:new Date().toISOString()},n=f_(u_(),t);d_(n),B(n)},t[47]=kt):kt=t[47];let At=kt,jt;t[48]===i?jt=t[49]:(jt=function(e){i(!1),At(e),ly(e.path)},t[48]=i,t[49]=jt);let Mt=jt,Nt=!ft&&f===``&&Ye.length>0,Pt=hy({searchResults:m,fallbackSearchResults:nt,searchStatus:g}),Ft=!ft&&Pt.length>0,It=!ft&&f!==``&&(je||x)&&!Ft,Lt=!ft&&f!==``&&g===`loading`&&!Ft&&!It,Rt=!ft&&a!==null&&Ze.length>0&&(f===``||Ze.some(e=>j_(`${e.name} ${e.path}`,d,[`open recent project`]))),zt=$e.filter(e=>f===``||j_(e.branch??``,d,[`worktree branch`])),Bt=!ft&&a!==null&&zt.length>0,Vt=Ys(),Ht=!ft&&!Vt&&qe!==null&&(f===``||Yr.some(e=>{let t=e.displayName;return j_(o({id:`WqLq6M`,values:{displayName:t}}),d,[e.id,`agent handoff`,`open in`])})),Ut=ut.kind===`tag-list`?I_(le,ut.query):[],Gt=ut.kind===`tag-list`&&de!==`loading`&&Ut.length===0,Kt=ut.kind===`tag-docs`&&ge===`success`&&me.length===0,qt=vc(),Jt;t[50]===i?Jt=t[51]:(Jt=e=>{i(!1),Wt(e)},t[50]=i,t[51]=Jt);let Yt=Jt,Xt;t[52]!==a||t[53]!==i?(Xt=e=>{i(!1),nd(e,a?{okDesktop:{shell:a.shell}}:{okDesktop:void 0})},t[52]=a,t[53]=i,t[54]=Xt):Xt=t[54];let Zt=Xt,X;t[55]===i?X=t[56]:(X=()=>i(!1),t[55]=i,t[56]=X);let Qt;t[57]===H?Qt=t[58]:(Qt=e=>H(e),t[57]=H,t[58]=Qt);let $t;t[59]===W?$t=t[60]:($t=()=>W(!0),t[59]=W,t[60]=$t);let en;t[61]===K?en=t[62]:(en=()=>K(!0),t[61]=K,t[62]=en);let tn;t[63]===ne?tn=t[64]:(tn=()=>ne(!0),t[63]=ne,t[64]=tn);let nn;t[65]===re?nn=t[66]:(nn=()=>{ae(!0),re(!0)},t[65]=re,t[66]=nn);let rn;t[67]===se?rn=t[68]:(rn=()=>se(!0),t[67]=se,t[68]=rn);let an={bridge:a,singleFile:c,activeDocName:Ce,contextualTargetKind:Xg(we),viewMenuState:qt,emitMenuAction:Yt,runAction:wt,openExternalUrl:Zt,closePalette:X,openNewItemDialog:Qt,openSeedDialog:$t,openCreateProjectDialog:en,openReportBugDialog:tn,openBugReportHistory:nn,openFeedbackDialog:rn},on=ft?[]:i_.flatMap(e=>{if(!e.available(an)||e.visibility===`search-only`&&f===``)return[];let t=e.label(an);return j_(t,d,e.keywords)?[{cmd:e,label:t}]:[]}),sn=on.length>0,cn;t[69]===o?cn=t[70]:(cn=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[69]=o,t[70]=cn);let ln=cn,un=e=>{let t=on.filter(t=>t.cmd.group===e);return t.length===0?null:(0,Z.jsx)(Ae,{heading:ln(e),children:t.map(e=>{let{cmd:t,label:n}=e,r=t.shortcutId!==void 0&&(t.shortcutDesktopOnly!==!0||a!==null)?kl(t.shortcutId):null;return(0,Z.jsxs)(M,{value:`${n} ${t.keywords.join(` `)}`,onSelect:()=>t.dispatch(an),"data-testid":`command-palette-${t.id}`,children:[(0,Z.jsx)(t.icon,{}),(0,Z.jsx)(`span`,{children:n}),t.checked?.(an)?(0,Z.jsx)(Po,{className:`ml-auto text-muted-foreground`,"aria-hidden":`true`}):null,r?(0,Z.jsx)(_,{children:r}):null]},t.id)})},e)},dn=ft||Nt||Ft||Lt||It||Rt||Ht||sn,fn;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(fn=function(e){u(`${P_}${e}`)},t[71]=fn):fn=t[71];let pn=fn,mn;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(mn=function(){xe.current?.abort(),xe.current=null,Se.current!==null&&(window.clearTimeout(Se.current),Se.current=null),D([]),k(null),N(`idle`)},t[72]=mn):mn=t[72];let hn=mn,gn;t[73]===l?gn=t[74]:(gn=function(){w(!0),l.startsWith(`tag:`)&&u(l.slice(P_.length)),hn(),be.current?.focus()},t[73]=l,t[74]=gn);let _n=gn,vn;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(vn=function(){w(!1),u(``),hn(),be.current?.focus()},t[75]=vn):vn=t[75];let yn=vn,bn=function(e){let t=e.trim();if(!t||je)return;xe.current?.abort(),Se.current!==null&&window.clearTimeout(Se.current);let n=new AbortController;xe.current=n,N(`loading`);let r=!1,i=window.setTimeout(()=>{r=!0,n.abort(),N(`error`)},ay);Se.current=i,A_(t,{signal:n.signal,semantic:!0,limit:30}).then(e=>{let{entries:r}=e;xn(i,n),D(r),k(t),N(`success`)}).catch(e=>{xn(i,n),!(e instanceof Error&&e.name===`AbortError`&&!r)&&(console.debug(`[semantic-search] fire failed`,{timedOut:r,error:e}),N(`error`))})};function xn(e,t){window.clearTimeout(e),Se.current===e&&(Se.current=null),xe.current===t&&(xe.current=null)}let Sn=function(e){!C||e.key!==`Enter`||(_t?.submit?(e.preventDefault(),e.stopPropagation(),bn(_t.submit.query)):j===`loading`&&(e.preventDefault(),e.stopPropagation()))},Cn;t[76]===C?Cn=t[77]:(Cn=function(e){C&&(e.preventDefault(),yn())},t[76]=C,t[77]=Cn);let wn=Cn,Tn;t[78]===o?Tn=t[79]:(Tn=o({id:`1bDVu5`}),t[78]=o,t[79]=Tn);let En;t[80]===o?En=t[81]:(En=o({id:`5GRxoA`}),t[80]=o,t[81]=En);let Dn;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(Dn={shouldFilter:!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[82]=Dn):Dn=t[82];let On;t[83]!==o||t[84]!==C?(On=o(C?{id:`zXj1rA`}:{id:`ggs9f8`}),t[83]=o,t[84]=C,t[85]=On):On=t[85];let kn;t[86]!==C||t[87]!==dt?(kn=()=>{C&&(w(!1),hn()),u(dt?``:P_),be.current?.focus()},t[86]=C,t[87]=dt,t[88]=kn):kn=t[88];let An=dt?`border-primary/30 bg-primary/10 text-primary`:`border-border bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`,jn;t[89]===An?jn=t[90]:(jn=Y(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors`,An),t[89]=An,t[90]=jn);let Mn,Nn;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(Mn=(0,Z.jsx)(mc,{className:`size-3.5`}),Nn=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`0rwwOn`})}),t[91]=Mn,t[92]=Nn):(Mn=t[91],Nn=t[92]);let Pn;t[93]!==dt||t[94]!==kn||t[95]!==jn?(Pn=(0,Z.jsxs)(`button`,{type:`button`,onClick:kn,"data-testid":`command-palette-filter-tag`,"data-active":dt,"aria-pressed":dt,className:jn,children:[Mn,Nn]}),t[93]=dt,t[94]=kn,t[95]=jn,t[96]=Pn):Pn=t[96];let Fn;t[97]!==_n||t[98]!==C||t[99]!==Ve?(Fn=Ve?(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>C?yn():_n(),"data-testid":`command-palette-filter-semantic`,"data-active":C,"aria-pressed":C,className:Y(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors`,C?`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)(Ks,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`9tJX8r`})})]}):null,t[97]=_n,t[98]=C,t[99]=Ve,t[100]=Fn):Fn=t[100];let In;t[101]!==Pn||t[102]!==Fn?(In=(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 border-b px-3 py-2`,children:[Pn,Fn]}),t[101]=Pn,t[102]=Fn,t[103]=In):In=t[103];let Ln;t[104]===It?Ln=t[105]:(Ln=It?(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)(Gc,{className:`size-4 animate-spin`}),(0,Z.jsx)(J,{id:`yIPXut`})]}):null,t[104]=It,t[105]=Ln);let Rn;t[106]!==Ft||t[107]!==Lt?(Rn=Lt&&!Ft?(0,Z.jsx)(s,{children:(0,Z.jsx)(J,{id:`WRNXKp`})}):null,t[106]=Ft,t[107]=Lt,t[108]=Rn):Rn=t[108];let zn=fy,Bn=M_(f,Pt,{truncated:y}),Vn;t[109]!==zn||t[110]!==ft||t[111]!==ut.kind||t[112]!==Bn?(Vn=(0,Z.jsx)(zn,{mode:Bn,inExclusiveMode:ft,paletteModeKind:ut.kind}),t[109]=zn,t[110]=ft,t[111]=ut.kind,t[112]=Bn,t[113]=Vn):Vn=t[113];let Hn=V===`file`,Wn;t[114]===H?Wn=t[115]:(Wn=e=>{e||H(null)},t[114]=H,t[115]=Wn);let Gn;t[116]!==tt||t[117]!==Hn||t[118]!==Wn?(Gn=(0,Z.jsx)(Z_,{open:Hn,onOpenChange:Wn,kind:`file`,initialDir:tt}),t[116]=tt,t[117]=Hn,t[118]=Wn,t[119]=Gn):Gn=t[119];let Kn=V===`folder`,qn;t[120]===H?qn=t[121]:(qn=e=>{e||H(null)},t[120]=H,t[121]=qn);let Jn;t[122]!==tt||t[123]!==Kn||t[124]!==qn?(Jn=(0,Z.jsx)(Z_,{open:Kn,onOpenChange:qn,kind:`folder`,initialDir:tt}),t[122]=tt,t[123]=Kn,t[124]=qn,t[125]=Jn):Jn=t[125];let Yn;t[126]!==ee||t[127]!==W?(Yn=(0,Z.jsx)(Tv,{open:ee,onOpenChange:W}),t[126]=ee,t[127]=W,t[128]=Yn):Yn=t[128];let Xn;t[129]!==a||t[130]!==G||t[131]!==K?(Xn=a?(0,Z.jsx)(Fg,{open:G,onOpenChange:K,bridge:a}):null,t[129]=a,t[130]=G,t[131]=K,t[132]=Xn):Xn=t[132];let Zn;t[133]!==a||t[134]!==te||t[135]!==ne?(Zn=a?(0,Z.jsx)(im,{open:te,onOpenChange:ne}):null,t[133]=a,t[134]=te,t[135]=ne,t[136]=Zn):Zn=t[136];let Qn;t[137]!==a||t[138]!==ie||t[139]!==q||t[140]!==re||t[141]!==ne?(Qn=a&&ie?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(iy,{open:q,onOpenChange:re,onReportABug:()=>{re(!1),ne(!0)}})}):null,t[137]=a,t[138]=ie,t[139]=q,t[140]=re,t[141]=ne,t[142]=Qn):Qn=t[142];let $n;return t[143]!==oe||t[144]!==se?($n=(0,Z.jsx)(B_,{open:oe,onOpenChange:se,source:`command_palette`}),t[143]=oe,t[144]=se,t[145]=$n):$n=t[145],(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Me,{open:r,onOpenChange:i,title:Tn,description:En,className:`sm:max-w-2xl`,commandProps:Dn,onEscapeKeyDown:wn,children:[(0,Z.jsx)(A,{ref:be,value:l,onValueChange:u,onKeyDown:Sn,placeholder:On}),In,(0,Z.jsxs)(I,{ref:ye,className:`subtle-scrollbar`,children:[C&&_t?(0,Z.jsxs)(Z.Fragment,{children:[We?(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)(Gc,{className:`size-3.5 animate-spin`}),(0,Z.jsx)(J,{id:`kCNU4q`,values:{semanticIndexedCount:He,semanticTotalCount:Ue}})]}):null,_t.submit?(0,Z.jsx)(Ae,{children:(0,Z.jsx)(M,{value:`semantic-submit`,onSelect:()=>bn(vt),"data-testid":`command-palette-semantic-submit`,children:_t.submit.kind===`retry`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ks,{}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-amber-700 dark:text-amber-400`,children:(0,Z.jsx)(J,{id:`w4ZzmQ`})}),(0,Z.jsx)(_,{children:`↵`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ks,{}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,Z.jsx)(J,{id:`FNTx6u`,values:{semanticSubmitQuery:vt}})}),(0,Z.jsx)(_,{children:`↵`})]})})}):null,_t.notice===`empty`?(0,Z.jsx)(s,{"data-testid":`command-palette-semantic-empty`,children:(0,Z.jsx)(J,{id:`l5J_HM`,components:{0:(0,Z.jsx)(U,{"aria-label":o({id:`9Vnjc9`})})}})}):null,_t.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)(Gc,{className:`size-4 animate-spin`}),(0,Z.jsx)(J,{id:`PBwmDJ`})]}):null,_t.notice===`no-results`?(0,Z.jsx)(s,{"data-testid":`command-palette-semantic-no-results`,children:(0,Z.jsx)(J,{id:`yFyZMJ`,values:{semanticQueryText:gt}})}):null,_t.results.show?(0,Z.jsx)(Ae,{heading:_t.results.dimmed?o({id:`QlxHAH`,values:{semanticResultsLabel:yt}}):o({id:`9tJX8r`}),children:(0,Z.jsx)(`div`,{"data-testid":`command-palette-semantic-results`,"data-dimmed":_t.results.dimmed,children:E.map(e=>(0,Z.jsx)(dy,{entry:e,disabled:_t.results.dimmed,onSelect:()=>Mt(e)},l_(e.kind,e.path)))})}):null]}):null,Ln,Rn,dn?null:(0,Z.jsx)(s,{children:g===`error`?(0,Z.jsx)(J,{id:`pkAft1`}):(0,Z.jsx)(J,{id:`i3f2kh`})}),ut.kind===`tag-list`?(0,Z.jsxs)(Ae,{heading:ut.query?o({id:`evs0iw`,values:{tagListQuery:pt}}):o({id:`2QM24L`}),children:[de===`loading`?(0,Z.jsx)(s,{children:(0,Z.jsx)(J,{id:`a_u4ck`})}):null,de===`error`?(0,Z.jsx)(s,{children:(0,Z.jsx)(J,{id:`qTcZZu`,components:{0:(0,Z.jsx)(U,{"aria-label":o({id:`69KLIV`})})}})}):null,Gt?(0,Z.jsx)(s,{children:ut.query?o({id:`X0ttSN`,values:{tagListQuery:pt}}):o({id:`JLUTgi`})}):null,Ut.map(e=>(0,Z.jsxs)(M,{value:`tag ${e.name}`,onSelect:()=>pn(e.name),"data-testid":`command-palette-tag-${e.name}`,children:[(0,Z.jsx)(mc,{}),(0,Z.jsx)(`span`,{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)(J,{id:`fVcm9t`,values:{0:e.count}})})]},`tag:${e.name}`))]}):null,ut.kind===`tag-docs`?(0,Z.jsxs)(Ae,{heading:o({id:`hGmuTc`,values:{tagDocsName:ht}}),children:[ge===`loading`?(0,Z.jsx)(s,{children:(0,Z.jsx)(J,{id:`pWbsW6`})}):null,ge===`error`?(0,Z.jsx)(s,{children:(0,Z.jsx)(J,{id:`z_4xza`,components:{0:(0,Z.jsx)(U,{"aria-label":o({id:`69KLIV`})})}})}):null,Kt?(0,Z.jsx)(s,{children:o({id:`NIWAux`,values:{tagDocsName:ht}})}):null,me.map(e=>{let t=e.title||e.docName.split(`/`).pop()||e.docName,n=e.matchingTags.filter(e=>e!==ut.tagName).map(_y).join(`, `);return(0,Z.jsxs)(M,{value:`tag-doc ${e.docName}`,onSelect:()=>{i(!1),ly(e.docName)},"data-testid":`command-palette-tag-doc-${e.docName}`,className:`items-start`,children:[(0,Z.jsx)(Un,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:t}),(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:e.docName}),e.matchingTags.length>0&&e.matchingTags.some(e=>e!==ut.tagName)?(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-[11px]`,children:(0,Z.jsx)(J,{id:`CvsD6Y`,values:{viaTags:n}})}):null]})]},`tag-doc:${e.docName}`)})]}):null,Nt?(0,Z.jsx)(Ae,{heading:o({id:`MmDDWK`}),children:Ye.map(e=>(0,Z.jsx)(dy,{entry:e,onSelect:()=>Mt(e)},l_(e.kind,e.path)))}):null,un(`commands`),Ht?(0,Z.jsx)(Ae,{heading:o({id:`O7_W_a`}),children:Yr.filter(e=>{let t=e.displayName;return j_(o({id:`WqLq6M`,values:{displayName:t}}),d,[e.id,`agent handoff`,`open in`])}).map(e=>{let t=Pe[e.id],n=t.installed===!0&&qe!==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)(M,{value:`send to ai ${e.displayName} ${e.id} agent open in`,disabled:!n,onSelect:()=>{!n||!qe||(i(!1),Ie(e.id,qe))},"data-testid":`command-palette-open-in-${e.id}`,"aria-label":s,children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{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,un(`project`),Rt&&a?(0,Z.jsx)(Ae,{heading:o({id:`3iyGWF`}),children:Ze.filter(e=>j_(`${e.name} ${e.path}`,d,[`open recent project`])).slice(0,10).map(e=>{let t=e.isLinkedWorktree===!0,n=t?co:Ph,r=t&&e.mainRoot!==void 0?Uv(e.mainRoot):null;return(0,Z.jsx)(ry,{path:e.path,onRemoveRecent:Et,testIdPrefix:`command-palette-recent`,children:(0,Z.jsxs)(`div`,{className:`group/recent relative flex items-center`,children:[(0,Z.jsxs)(M,{value:`${e.name} ${e.path} recent project`,onSelect:()=>wt(()=>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)(`span`,{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)(J,{id:`8Gzz2G`,values:{worktreeOf:r}})}),(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:e.path})]})]}),(0,Z.jsx)(ny,{path:e.path,name:e.name,onRemoveRecent:Et,testIdPrefix:`command-palette-recent`})]})},e.path)})}):null,Bt&&a?(0,Z.jsx)(Ae,{heading:o({id:`sxjyRq`}),children:zt.slice(0,10).map(e=>(0,Z.jsxs)(M,{value:`${e.branch} worktree branch`,onSelect:()=>Ot(e),"data-testid":`command-palette-worktree-${e.branch}`,className:`items-start`,children:[(0,Z.jsx)(co,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:e.branch}),(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:e.worktreePath??o({id:`iO8V-7`})})]})]},e.branch))}):null,[`file`,`view`,`terminal`,`app`].map(e=>un(e)),Ft?(0,Z.jsx)(Ae,{heading:o({id:`A1taO8`}),children:Pt.map(e=>(0,Z.jsx)(dy,{entry:e,query:f,onSelect:()=>Mt(e)},l_(e.kind,e.path)))}):null]}),Vn]}),Gn,Jn,Yn,Xn,Zn,Qn,$n]})}function _y(e){return`#${e}`}function vy(e){return e.name}function yy(e){return e.branch!==null&&!e.isCurrent}function by(e){return l_(e.kind,e.path)}function xy(e){return e===`eperm`?vl._({id:`XuQzrk`}):vl._({id:`BUyQnq`})}async function Sy(e){let t=await e.restartServer(e.config.projectPath);return t.ok?{ok:!0}:{ok:!1,message:xy(t.reason)}}var Cy=500;function wy(e,t,n){return t?`terminal`:e===null&&n?`retrying`:`hidden`}function Ty(e){return e?.kind===`null-collab`}function Ey(e){if(e===null)return vl._({id:`Ua78MH`});if(e.kind===`null-collab`)return vl._({id:`TJnkyf`});if(e.code===`network`)return vl._({id:`aoa6xA`});if(e.code===`invalid-body`)return vl._({id:`FRYB1Q`});let t=e.code;return vl._({id:`4nj6n8`,values:{code:t}})}function Dy(){let e=(0,$.c)(28),{collabUrl:t,collabTerminal:n,collabLastError:r,retryCollab:i}=Re(),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(null),d=typeof window<`u`?window.okDesktop:void 0,f,p;e[0]!==n||e[1]!==t?(f=()=>{if(t!==null||n){o(!1);return}let e=setTimeout(()=>o(!0),Cy);return()=>clearTimeout(e)},p=[t,n],e[0]=n,e[1]=t,e[2]=f,e[3]=p):(f=e[2],p=e[3]),(0,Q.useEffect)(f,p);let m=wy(t,n,a);if(m===`hidden`)return null;if(m===`terminal`){let t;e[4]===r?t=e[5]:(t=Ty(r),e[4]=r,e[5]=t);let n=t,a;e[6]===r?a=e[7]:(a=Ey(r),e[6]=r,e[7]=a);let o=a,f;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=async()=>{if(d){u(null),c(!0);try{let e=await Sy(d);e.ok||(u(e.message),c(!1))}catch{c(!1)}}},e[8]=f):f=e[8];let p=f,m;e[9]!==o||e[10]!==n?(m=(0,Z.jsx)(`span`,{children:n?(0,Z.jsx)(J,{id:`AAlr5Y`,components:{0:(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`})}}):(0,Z.jsx)(J,{id:`noH1JX`,values:{errorDetail:o},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]=o,e[10]=n,e[11]=m):m=e[11];let h;e[12]===i?h=e[13]:(h=()=>{u(null),i()},e[12]=i,e[13]=h);let g;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(J,{id:`6gRgw8`}),e[14]=g):g=e[14];let _;e[15]!==s||e[16]!==h?(_=(0,Z.jsx)(`button`,{type:`button`,onClick:h,disabled:s,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:g}),e[15]=s,e[16]=h,e[17]=_):_=e[17];let v;e[18]===s?v=e[19]:(v=d?(0,Z.jsx)(`button`,{type:`button`,onClick:p,disabled:s,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:s?(0,Z.jsx)(J,{id:`0Er6-M`}):(0,Z.jsx)(J,{id:`uaUc6t`})}):null,e[18]=s,e[19]=v);let y;e[20]===l?y=e[21]:(y=l===null?null:(0,Z.jsx)(`span`,{className:`w-full text-red-950 text-xs`,children:l}),e[20]=l,e[21]=y);let b;return e[22]!==y||e[23]!==m||e[24]!==_||e[25]!==v?(b=(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:[m,_,v,y]}),e[22]=y,e[23]=m,e[24]=_,e[25]=v,e[26]=b):b=e[26],b}let h;return e[27]===Symbol.for(`react.memo_cache_sentinel`)?(h=(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)(J,{id:`UYcGIW`})}),e[27]=h):h=e[27],h}function Oy(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=()=>Vt(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)(Fg,{open:r,onOpenChange:i,bridge:n}),t[2]=n,t[3]=r,t[4]=s):s=t[4],s}var ky=`ok-acp-desktop-migration-v1`,Ay=[`ok-preferred-agent-v1`,`ok-ask-ai-agent-v2`,`ok-ask-ai-default-agent-v1`];function jy(e){try{return localStorage.getItem(e)}catch{return null}}function My(){try{localStorage.setItem(ky,`1`)}catch{}}function Ny(){return Ay.some(e=>jy(e)!==null)}function Py(e){return Yr.every(t=>e[t.id]?.installed!=null)?Yr.filter(t=>e[t.id]?.installed===!0).map(e=>e.id):null}function Fy(e){let t=(0,$.c)(3),n,r;t[0]===e?(n=t[1],r=t[2]):(n=()=>{if(jy(ky)!==null)return;if(!Ny()){My();return}let t=Py(e);if(t!==null){for(let e of t)ti(qr(e),!0);My()}},r=[e],t[0]=e,t[1]=n,t[2]=r),(0,Q.useEffect)(n,r)}function Iy(){let{states:e}=es();return Fy(e),null}async function Ly(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(Al(e)??vl._({id:`lHwYMr`,values:{status:n,statusText:r}}))}return(await t.json()).docs??[]}function Ry(){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`}),Ly(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(Se,e),()=>document.removeEventListener(Se,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(vu(e))},e[3]=d):d=e[3];let f=d,p=r??``,m;e[4]===p?m=e[5]:(m={tagName:p},e[4]=p,e[5]=m);let h;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(h={0:(0,Z.jsx)(`span`,{className:`font-mono break-all`})},e[6]=h):h=e[6];let g;e[7]===m?g=e[8]:(g=(0,Z.jsx)(gn,{children:(0,Z.jsx)(fn,{children:(0,Z.jsx)(J,{id:`7H4UHD`,values:m,components:h})})}),e[7]=m,e[8]=g);let _=r??``,v;e[9]!==o||e[10]!==_?(v=(0,Z.jsx)(mn,{children:(0,Z.jsx)(zy,{fetchState:o,tag:_,onSelectDoc:f})}),e[9]=o,e[10]=_,e[11]=v):v=e[11];let y;e[12]!==g||e[13]!==v?(y=(0,Z.jsxs)(pn,{children:[g,v]}),e[12]=g,e[13]=v,e[14]=y):y=e[14];let b;return e[15]!==t||e[16]!==y?(b=(0,Z.jsx)(_n,{open:t,onOpenChange:n,children:y}),e[15]=t,e[16]=y,e[17]=b):b=e[17],b}function zy(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)(J,{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)(J,{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(By)}):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 By(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 Vy=`raw-mdx-nav`,Hy=`ok-editor-mode-v1`,Uy=[`wysiwyg`,`source`],Wy=`wysiwyg`;function Gy(e){return Uy.includes(e)}function Ky(e=localStorage){try{let t=e.getItem(Hy);if(t===null)return Wy;if(Gy(t))return t;console.warn(`[editor-mode] invalid persisted value, falling back to default`,{raw:t})}catch{}return Wy}function qy(e=window,t=localStorage){let n=e.__OK_EDITOR_MODE__;return Gy(n)?n:Ky(t)}function Jy(e,t=localStorage){try{return t.setItem(Hy,e),!0}catch(e){return console.warn(`[editor-mode] persist failed`,e),!1}}function Yy(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(qy),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=function(e){n(e),Jy(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 Xy(e){let t=(0,$.c)(4),{_:n}=mt(),r=(0,Q.useRef)(!1),i,a;t[0]!==n||t[1]!==e?(i=()=>{e===`no-push-permission`&&!r.current&&(r.current=!0,dl.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 Zy(e,t){return e===`follow`?(0,Z.jsx)(J,{id:`Sxx_Zz`,values:{project:t}}):e===`full`?(0,Z.jsx)(J,{id:`4zEZS5`,values:{project:t}}):(0,Z.jsx)(J,{id:`AaaESH`,values:{project:t}})}function Qy(){let e=(0,$.c)(8),{projectLocalConfig:t,projectLocalSynced:n,projectLocalBinding:r}=td(),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:``;dl(Zy(xi({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 $y=`ok-terminal-dock-v1`,eb=`right`;function tb(e){return e===`bottom`?`bottom`:`right`}function nb(e){try{return tb((e??localStorage).getItem($y))}catch{return eb}}function rb(e,t){try{(t??localStorage).setItem($y,e)}catch{}}function ib(){try{return typeof localStorage>`u`?eb:nb()}catch{return eb}}function ab(e){let t=(0,$.c)(36),{open:n,variant:r,onResolved:i}=e,{_:a}=mt(),o=lo(),s;t[0]!==a||t[1]!==i||t[2]!==r||t[3]!==o?(s=function(e){if(o===null){dl.error(a({id:`fiMNLl`}));return}let t=o(e?r===`follow`?`follow`:`full`:`off`);if(!t.ok){let n=t.error;dl.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)(gn,{children:(0,Z.jsx)(po,{variant:r})}),t[5]=r,t[6]=l);let u;t[7]===r?u=t[8]:(u=(0,Z.jsx)(ho,{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)(J,{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)(mn,{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)(J,{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)(J,{id:`U4nTfu`}):(0,Z.jsx)(J,{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)(hn,{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)(pn,{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)(_n,{open:n,onOpenChange:ob,children:S}),t[33]=n,t[34]=S,t[35]=C):C=t[35],C}function ob(){}function sb(e){if(!(!e.autoSyncOnboardingDismissed&&e.hasRemote===!0&&e.projectLocalSynced===!0&&e.projectSynced===!0&&e.projectLocalConfig!==null&&xi(e.projectLocalConfig.autoSync??void 0)===null&&Di(e.projectConfig?.autoSync?.default)===null))return null;switch(e.pushPermissionCheckStatus){case`allowed`:return`full`;case`denied`:return`follow`;default:return null}}var cb=new Map(Ya.map(e=>[e.id,e.alias]));function lb(e,t,n){return io({relativePath:Zs(e),source:t.source,code:t.code,ruleAlias:t.source===`markdownlint`?cb.get(t.code):void 0,message:t.message,line:t.range.start.line+1,column:t.range.start.character+1,lineText:n})}var ub=5;async function db(e){let t=await fetch(`/api/backlinks?docName=${encodeURIComponent(e)}`),n=await t.json().catch(()=>null);if(!t.ok){let e=pa.safeParse(n),r=t.status;throw e.success?Error(e.data.title):new En(vl._({id:`XopE_I`,values:{status:r}}),{status:r})}let r=ga.safeParse(n);if(!r.success)throw new En(vl._({id:`lZAiSP`}),{status:t.status});return r.data.backlinks}async function fb(e){let t=await fetch(`/api/forward-links?docName=${encodeURIComponent(e)}`),n=await t.json().catch(()=>null);if(!t.ok){let e=pa.safeParse(n),r=t.status;throw e.success?Error(e.data.title):new En(vl._({id:`GemPfn`,values:{status:r}}),{status:r})}let r=pi.safeParse(n);if(!r.success)throw new En(vl._({id:`2YZwPB`}),{status:t.status});return r.data.forwardLinks}function pb(e){let t=e.split(`/`);return t.length<=2?e:`…/${t.slice(-2).join(`/`)}`}function mb(e){window.location.hash=vu(e)}function hb(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)(Io,{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)(zd,{children:n})]}),t[1]=n,t[2]=o);let s;t[3]!==r||t[4]!==i?(s=!i&&(0,Z.jsx)(Rd,{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)(ln,{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 gb(e){let t=(0,$.c)(10),{total:n,expanded:r,onToggle:i}=e;if(n<=ub)return null;let a=n-ub,o;t[0]===r?o=t[1]:(o=r?(0,Z.jsx)(Io,{className:`size-3`}):(0,Z.jsx)(Lo,{className:`size-3`}),t[0]=r,t[1]=o);let s;t[2]!==r||t[3]!==a?(s=r?(0,Z.jsx)(J,{id:`6fGjTz`}):(0,Z.jsx)(J,{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 _b(e){let t=(0,$.c)(35),{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}=e,h=o!==void 0&&o!==a,g=r??`text-muted-foreground`,_;t[0]===g?_=t[1]:(_=Y(`mt-0.5 shrink-0`,g),t[0]=g,t[1]=_);let v;t[2]!==n||t[3]!==_?(v=(0,Z.jsx)(`span`,{className:_,children:n}),t[2]=n,t[3]=_,t[4]=v):v=t[4];let y=v,b;t[5]!==u||t[6]!==p||t[7]!==f||t[8]!==d||t[9]!==m||t[10]!==a||t[11]!==l?(b=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)(J,{id:`dbtjJh`})]}):null]}):(0,Z.jsx)(`button`,{type:`button`,"aria-label":u,title:l,disabled:p,onClick:m,className:Y(`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]=b):b=t[12];let x=b,S;t[13]===y?S=t[14]:(S=(0,Z.jsx)(`div`,{className:`mt-px flex items-center`,children:y}),t[13]=y,t[14]=S);let C;t[15]!==s||t[16]!==o||t[17]!==h?(C=h?(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]=h,t[18]=C):C=t[18];let w;t[19]===c?w=t[20]:(w=c?(0,Z.jsx)(`p`,{className:`line-clamp-2 text-muted-foreground`,children:c}):null,t[19]=c,t[20]=w);let T;t[21]!==x||t[22]!==C||t[23]!==w?(T=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5 text-1sm`,children:[x,C,w]}),t[21]=x,t[22]=C,t[23]=w,t[24]=T):T=t[24];let E;t[25]!==S||t[26]!==T?(E=(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:[S,T]}),t[25]=S,t[26]=T,t[27]=E):E=t[27];let D=E;if(i){let e;t[28]===D?e=t[29]:(e=(0,Z.jsx)(rn,{asChild:!0,children:D}),t[28]=D,t[29]=e);let n;t[30]===i?n=t[31]:(n=(0,Z.jsx)(an,{side:`top`,children:i}),t[30]=i,t[31]=n);let r;return t[32]!==e||t[33]!==n?(r=(0,Z.jsxs)(sn,{children:[e,n]}),t[32]=e,t[33]=n,t[34]=r):r=t[34],r}return D}function vb(e){let t=(0,$.c)(39),{docName:n}=e,{_:r}=mt(),{folderPaths:i,pages:a,pagesBySlug:o,pagesByBasename:s,loading:c}=Bo(),l,u;t[0]===n?(l=t[1],u=t[2]):(l=[`backlinks`,n],u=()=>db(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)||fa(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}=jt(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,ub),t[13]=_,t[14]=v,t[15]=S):S=t[15];let C=S,w;t[16]===r?w=t[17]:(w=r({id:`9NJWgv`}),t[16]=r,t[17]=w);let T;t[18]!==_.length||t[19]!==m||t[20]!==w?(T=(0,Z.jsx)(hb,{title:w,count:_.length,isLoading:m}),t[18]=_.length,t[19]=m,t[20]=w,t[21]=T):T=t[21];let E;t[22]!==r||t[23]!==_.length||t[24]!==h||t[25]!==v||t[26]!==i||t[27]!==m||t[28]!==a||t[29]!==s||t[30]!==o||t[31]!==C?(E=h?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Pd,{children:h instanceof Error?h.message:r({id:`Xet9MX`})})}):_.length===0&&!m?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Fd,{children:(0,Z.jsx)(J,{id:`rVxu1k`})})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:C.map((e,t)=>{let n=Vd(e.source,{pages:a,folderPaths:i,pagesBySlug:o,pagesByBasename:s});return(0,Z.jsx)(_b,{icon:(0,Z.jsx)(ue,{className:`size-3.5`}),title:e.title,path:pb(e.source),titleHover:e.source,anchor:e.anchor,snippet:e.snippet,href:vu(n.hashDocName,e.anchor)},`${e.source}-${t}`)})}),(0,Z.jsx)(gb,{total:_.length,expanded:v,onToggle:()=>y(yb)})]}),t[22]=r,t[23]=_.length,t[24]=h,t[25]=v,t[26]=i,t[27]=m,t[28]=a,t[29]=s,t[30]=o,t[31]=C,t[32]=E):E=t[32];let D;t[33]!==m||t[34]!==E?(D=(0,Z.jsx)(cn,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":m,children:E})}),t[33]=m,t[34]=E,t[35]=D):D=t[35];let O;return t[36]!==D||t[37]!==T?(O=(0,Z.jsxs)(un,{defaultOpen:!0,children:[T,D]}),t[36]=D,t[37]=T,t[38]=O):O=t[38],O}function yb(e){return!e}function bb(e){let t=(0,$.c)(49),{docName:n}=e,{_:r}=mt(),{addPage:i,folderPaths:a,pages:o,pagesBySlug:s,pagesByBasename:c,loading:l}=Bo(),u,d;t[0]===n?(u=t[1],d=t[2]):(u=[`forward-links`,n],d=()=>fb(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)||fa(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}=jt(p),_;t[11]===m?_=t[12]:(_=m===void 0?[]:m,t[11]=m,t[12]=_);let v=_,[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(n);C!==n&&(w(n),S(!1),b(null));let T;t[13]!==x||t[14]!==v?(T=x?v:v.slice(0,ub),t[13]=x,t[14]=v,t[15]=T):T=t[15];let E=T,D;t[16]!==r||t[17]!==i||t[18]!==y?(D=async function(e,t){if(!y){b(t);try{await V(e,{addPage:i,onCreated:mb}),b(null)}catch(e){let t=e;dl.error(t instanceof Error?t.message:r({id:`tfi40B`})),b(null)}}},t[16]=r,t[17]=i,t[18]=y,t[19]=D):D=t[19];let O=D,k;t[20]!==r||t[21]!==y||t[22]!==a||t[23]!==O||t[24]!==o||t[25]!==c||t[26]!==s||t[27]!==l?(k=function(e){let{title:t}=e;if(e.kind===`external`){let t=e.title===e.url;return(0,Z.jsx)(_b,{icon:(0,Z.jsx)(go,{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=xn(e.docName,{pages:o,folderPaths:a,pagesBySlug:s,pagesByBasename:c}),i=!l&&n.kind===`create`,u=!l&&n.kind===`navigate`&&n.displayState===`folder`,d=pb(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:vu(m,e.anchor);if(i&&n.kind===`create`){let i={initialDir:n.initialDir,suggestedName:n.suggestedName};return(0,Z.jsx)(_b,{icon:(0,Z.jsx)(al,{className:`size-3.5`}),iconColorClass:`text-amber-600 dark:text-amber-400`,rowTooltip:r(y===p?{id:`kj9pAE`}:{id:`IQPyrD`}),ariaLabel:r(y===p?{id:`un8kBM`,values:{linkTitle:t}}:{id:`jEdF24`,values:{linkTitle:t}}),title:f,path:d,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,disabled:y!==null,onClick:()=>void O(i,p)},p)}return u&&n.kind===`navigate`?(0,Z.jsx)(_b,{icon:(0,Z.jsx)(Ph,{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)(_b,{icon:(0,Z.jsx)(ue,{className:`size-3.5`}),title:f,path:d,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,href:h},p)},t[20]=r,t[21]=y,t[22]=a,t[23]=O,t[24]=o,t[25]=c,t[26]=s,t[27]=l,t[28]=k):k=t[28];let A=k,j;t[29]===r?j=t[30]:(j=r({id:`O0Z2Xr`}),t[29]=r,t[30]=j);let M;t[31]!==h||t[32]!==v.length||t[33]!==j?(M=(0,Z.jsx)(hb,{title:j,count:v.length,isLoading:h}),t[31]=h,t[32]=v.length,t[33]=j,t[34]=M):M=t[34];let N;t[35]!==r||t[36]!==g||t[37]!==x||t[38]!==h||t[39]!==v.length||t[40]!==A||t[41]!==E?(N=g?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Pd,{children:g instanceof Error?g.message:r({id:`pZAs1T`})})}):v.length===0&&!h?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Fd,{children:(0,Z.jsx)(J,{id:`roiUQQ`})})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:E.map(A)}),(0,Z.jsx)(gb,{total:v.length,expanded:x,onToggle:()=>S(xb)})]}),t[35]=r,t[36]=g,t[37]=x,t[38]=h,t[39]=v.length,t[40]=A,t[41]=E,t[42]=N):N=t[42];let P;t[43]!==h||t[44]!==N?(P=(0,Z.jsx)(cn,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":h,children:N})}),t[43]=h,t[44]=N,t[45]=P):P=t[45];let F;return t[46]!==M||t[47]!==P?(F=(0,Z.jsxs)(un,{defaultOpen:!0,children:[M,P]}),t[46]=M,t[47]=P,t[48]=F):F=t[48],F}function xb(e){return!e}function Sb(e){let t=(0,$.c)(11),{docName:n,className:r}=e,i=r===void 0?``:r,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(bb,{docName:n}),t[0]=n,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(zr,{}),t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Z.jsx)(vb,{docName:n}),t[3]=n,t[4]=s);let c;t[5]!==a||t[6]!==s?(c=(0,Z.jsxs)(Id,{className:`px-0 py-0`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7];let l;return t[8]!==i||t[9]!==c?(l=(0,Z.jsx)(Bd,{className:i,children:c}),t[8]=i,t[9]=c,t[10]=l):l=t[10],l}function Cb(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 wb=1e4,Tb=6e4;async function Eb(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(e=>e.type!==`checkpoint`)),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 Db(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return vl._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return vl._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return vl._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return vl._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?vl._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function Ob(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function kb(e){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 Ab(e){return e.split(`/`).pop()??e}function jb(e){return e.type===`upstream`?vl._({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`?vl._({id:`B2DrPb`}):e.author}function Mb(e){let t=(0,$.c)(17),{entry:n,isDark:r}=e;if(n.type===`upstream`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(co,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[0]=e):e=t[0],e}if(n.contributors.length>0){let e=n.contributors[0],i=e.colorSeed??e.name,a;t[1]===i?a=t[2]:(a=ua(i),t[1]=i,t[2]=a);let o=a,s=r?Ra[o]??Xa[o]:Xa[o],c;t[3]!==s||t[4]!==i?(c=s??Ea(i),t[3]=s,t[4]=i,t[5]=c):c=t[5];let l=c;if(o!==`bot`){let e;t[6]===l?e=t[7]:(e={color:l},t[6]=l,t[7]=e);let n;return t[8]!==o||t[9]!==e?(n=(0,Z.jsx)(Yd,{icon:o,width:14,height:14,className:`shrink-0`,style:e}),t[8]=o,t[9]=e,t[10]=n):n=t[10],n}if(e.name===`File System`){let e;return t[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Ih,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[11]=e):e=t[11],e}if(e.name===`OpenKnowledge (service)`||e.name===`Git (upstream)`){let e;return t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(mo,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[12]=e):e=t[12],e}let u;return t[13]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Eg,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[13]=u):u=t[13],u}if(n.authorEmail.includes(`agent`)||n.author.includes(`agent`)||n.authorEmail.includes(`cursor`)||n.authorEmail.includes(`claude`)){let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Ks,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[14]=e):e=t[14],e}if(n.author===`openknowledge-server`||n.author===`server`){let e;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(mo,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[15]=e):e=t[15],e}let i;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Eg,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function Nb(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function Pb(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(Ib),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(Fb)},children:[r?(0,Z.jsx)(Io,{className:`size-3`}):(0,Z.jsx)(Lo,{className:`size-3`}),r?(0,Z.jsx)(J,{id:`vLyv1R`}):(0,Z.jsx)(J,{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 Fb(e){return!e}function Ib(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 Lb(e){let t=(0,$.c)(36),{descriptor:n,allDocs:r,versionBySha7:i,onJumpToVersion:a}=e,{_:o}=mt();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:Ob(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)(Zc,{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)(dh,{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:Ab(n.from),1:Ab(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(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 Rb(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}=mt(),f;t[0]===n.timestamp?f=t[1]:(f=Db(n.timestamp),t[0]=n.timestamp,t[1]=f);let p=f,m;t[2]===n?m=t[3]:(m=jb(n),t[2]=n,t[3]=m);let h=m,g;t[4]===n.timestamp?g=t[5]:(g=Ob(n.timestamp),t[4]=n.timestamp,t[5]=g);let _=g,v;t[6]===n.contributors?v=t[7]:(v=n.contributors.flatMap(zb),t[6]=n.contributors,t[7]=v);let y=v,b;t[8]===n?b=t[9]:(b=Nb(n),t[8]=n,t[9]=b);let x=b,S;t[10]===n?S=t[11]:(S=kb(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=cl(),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=()=>{Xd(),sl({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}),dl.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=pa.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}),dl.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)(Mb,{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(` `),ee=A?`bg-muted`:`hover:bg-muted/80`,W;t[33]===ee?W=t[34]:(W=[`group flex w-full items-start gap-2.5 rounded-lg px-3 py-2.5 text-left transition-colors cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring`,ee],t[33]=ee,t[34]=W);let G=W.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 te;t[37]===B?te=t[38]:(te=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:B}),t[37]=B,t[38]=te);let ne;t[39]===h?ne=t[40]:(ne=(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:h}),t[39]=h,t[40]=ne);let q;t[41]!==n.timestamp||t[42]!==p?(q=(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]=q):q=t[43];let re;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[44]=re):re=t[44];let ie;t[45]===d?ie=t[46]:(ie=d({id:`Yea-K5`}),t[45]=d,t[46]=ie);let ae;t[47]!==R||t[48]!==a?(ae=e=>{e.stopPropagation(),a>0?T(!0):R()},t[47]=R,t[48]=a,t[49]=ae):ae=t[49];let oe;t[50]===E?oe=t[51]:(oe=E?(0,Z.jsx)(Gc,{className:`size-3 animate-spin`}):(0,Z.jsx)(ol,{className:`size-3`}),t[50]=E,t[51]=oe);let se;t[52]!==E||t[53]!==ie||t[54]!==ae||t[55]!==oe?(se=(0,Z.jsx)(rn,{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":ie,disabled:E,onClick:ae,children:oe})}),t[52]=E,t[53]=ie,t[54]=ae,t[55]=oe,t[56]=se):se=t[56];let ce;t[57]===d?ce=t[58]:(ce=d({id:`Yea-K5`}),t[57]=d,t[58]=ce);let le;t[59]===ce?le=t[60]:(le=(0,Z.jsx)(an,{side:`top`,children:ce}),t[59]=ce,t[60]=le);let ue;t[61]!==se||t[62]!==le?(ue=(0,Z.jsxs)(sn,{children:[se,le]}),t[61]=se,t[62]=le,t[63]=ue):ue=t[63];let de;t[64]!==ne||t[65]!==q||t[66]!==ue?(de=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[ne,q,re,ue]}),t[64]=ne,t[65]=q,t[66]=ue,t[67]=de):de=t[67];let fe;t[68]===x?fe=t[69]:(fe=x.length>0&&(0,Z.jsx)(Pb,{summaries:x}),t[68]=x,t[69]=fe);let pe;t[70]!==y||t[71]!==C||t[72]!==c||t[73]!==s?(pe=(0,Z.jsx)(Lb,{descriptor:C,allDocs:y,versionBySha7:s,onJumpToVersion:c}),t[70]=y,t[71]=C,t[72]=c,t[73]=s,t[74]=pe):pe=t[74];let me;t[75]!==de||t[76]!==fe||t[77]!==pe?(me=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[de,fe,pe]}),t[75]=de,t[76]=fe,t[77]=pe,t[78]=me):me=t[78];let he;t[79]!==P||t[80]!==A||t[81]!==G||t[82]!==K||t[83]!==te||t[84]!==me?(he=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-pressed":A,"data-testid":`timeline-entry-open`,className:G,onClick:P,onKeyDown:K,children:[te,me]}),t[79]=P,t[80]=A,t[81]=G,t[82]=K,t[83]=te,t[84]=me,t[85]=he):he=t[85];let ge;t[86]!==l||t[87]!==U||t[88]!==he?(ge=(0,Z.jsx)(`div`,{ref:l,className:U,children:he}),t[86]=l,t[87]=U,t[88]=he,t[89]=ge):ge=t[89];let _e;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(_e=e=>{e?T(!0):I()},t[90]=_e):_e=t[90];let ve;t[91]===d?ve=t[92]:(ve=d({id:`n3wx1q`}),t[91]=d,t[92]=ve);let ye;t[93]===ve?ye=t[94]:(ye=(0,Z.jsx)(fn,{children:ve}),t[93]=ve,t[94]=ye);let be;t[95]===a?be=t[96]:(be=(0,Z.jsx)(J,{id:`nfPccR`,values:{laterEdits:a}}),t[95]=a,t[96]=be);let xe;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Z.jsx)(J,{id:`5ZbJFS`}),t[97]=xe):xe=t[97];let Se;t[98]===be?Se=t[99]:(Se=(0,Z.jsxs)(dn,{children:[be,` `,xe]}),t[98]=be,t[99]=Se);let Ce;t[100]!==ye||t[101]!==Se?(Ce=(0,Z.jsxs)(gn,{children:[ye,Se]}),t[100]=ye,t[101]=Se,t[102]=Ce):Ce=t[102];let we;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(X,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:I,children:(0,Z.jsx)(J,{id:`dEgA5A`})}),t[103]=we):we=t[103];let Te;t[104]===R?Te=t[105]:(Te=()=>R(),t[104]=R,t[105]=Te);let Ee;t[106]===E?Ee=t[107]:(Ee=E?(0,Z.jsx)(Gc,{className:`mr-2 size-4 animate-spin`}):null,t[106]=E,t[107]=Ee);let De;t[108]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,Z.jsx)(J,{id:`yKu_3Y`}),t[108]=De):De=t[108];let Oe;t[109]!==E||t[110]!==Te||t[111]!==Ee?(Oe=(0,Z.jsxs)(hn,{children:[we,(0,Z.jsxs)(X,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:E,onClick:Te,children:[Ee,De]})]}),t[109]=E,t[110]=Te,t[111]=Ee,t[112]=Oe):Oe=t[112];let ke;t[113]!==Ce||t[114]!==Oe?(ke=(0,Z.jsxs)(pn,{children:[Ce,Oe]}),t[113]=Ce,t[114]=Oe,t[115]=ke):ke=t[115];let Ae;t[116]!==w||t[117]!==ke?(Ae=(0,Z.jsx)(_n,{open:w,onOpenChange:_e,children:ke}),t[116]=w,t[117]=ke,t[118]=Ae):Ae=t[118];let je;return t[119]!==ge||t[120]!==Ae?(je=(0,Z.jsxs)(Z.Fragment,{children:[ge,Ae]}),t[119]=ge,t[120]=Ae,t[121]=je):je=t[121],je}function zb(e){return e.docs}function Bb(e){let t=(0,$.c)(27),{docName:n}=e,{_:r}=mt(),{resolvedTheme:i}=Ft(),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(){ll()},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=Cb({baseMs:wb,maxBackoffMs:Tb,isPaused:Hb,poll:e=>Eb(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)(Ld,{children:(0,Z.jsx)(zd,{children:(0,Z.jsx)(J,{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(Vb)}),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)(J,{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)(Rb,{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 Vb(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(Ud,{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)(Ud,{className:`h-3 w-28`}),(0,Z.jsx)(Ud,{className:`h-3 w-40`})]})]},e)}function Hb(){return typeof document<`u`&&document.visibilityState===`hidden`}var Ub=`open-knowledge:lint-source-fixed`,Wb=Object.freeze({source:`local`,skipStoreHooks:!1,context:Object.freeze({origin:`lint-fix`})});function Gb(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 Kb(e){return e.flatMap(e=>e.fixes??[])}function qb(e,t){if(t.length===0)return!1;let n=e.document.getText(`source`),r=n.toString(),i=t.map(e=>({from:Gb(r,e.range.start),to:Gb(r,e.range.end),insert:e.newText})).sort((e,t)=>t.to-e.to||t.from-e.from||e.insert.localeCompare(t.insert));return e.document.transact(()=>{let e=1/0,t;for(let r of i){let i=t!==void 0&&r.from===t.from&&r.to===t.to&&r.insert===t.insert;t=r,!(i||r.to>e)&&(r.to>r.from&&n.delete(r.from,r.to-r.from),r.insert.length>0&&n.insert(r.from,r.insert),e=r.from)}},Wb),typeof window<`u`&&window.dispatchEvent(new CustomEvent(Ub)),!0}var Jb=300;function Yb(e,t){let n=(0,$.c)(7),r;n[0]===t?r=n[1]:(r=t?.enabled?JSON.stringify(t):null,n[0]=t,n[1]=r);let i=r,a;n[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],n[2]=a):a=n[2];let[o,s]=(0,Q.useState)(a),c,l;return n[3]!==i||n[4]!==e?(c=()=>{if(!e||i===null){s(Xb);return}let t=JSON.parse(i),n=e.document.getText(`source`),r=null,a=!1,o=e.configuration.name,c=()=>void Ji(n.toString(),t,o).then(e=>{a||s(e)}).catch(e=>{a||console.warn(`[lint] lintDocument failed`,e)}),l=()=>{r&&clearTimeout(r),r=setTimeout(c,Jb)};return c(),n.observe(l),()=>{a=!0,r&&clearTimeout(r),n.unobserve(l)}},l=[e,i],n[3]=i,n[4]=e,n[5]=c,n[6]=l):(c=n[5],l=n[6]),(0,Q.useEffect)(c,l),o}function Xb(e){return e.length===0?e:[]}var Zb=[{id:`outline`,icon:Wh},{id:`links`,icon:a},{id:`graph`,icon:Jh},{id:`timeline`,icon:yh},{id:`problems`,icon:al}];function Qb(e){let t=0,n=0;for(let r of e)r.severity===`error`?t+=1:n+=1;return{errorCount:t,warningCount:n}}function $b(e){return e===`outline`?vl._({id:`dD7NPy`}):e===`links`?vl._({id:`Rj01Fz`}):e===`graph`?vl._({id:`x2fr_j`}):e===`problems`?vl._({id:`OXdGnd`}):vl._({id:`cklVjM`})}function ex(){return n(()=>import(`./GraphPanel-1CKwHElx.js`),__vite__mapDeps([46,1,6,2,3,7,8,9,47,10,11,12,15,16,48,14,17,49,50,26,22,29,30,31,19,24,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,40,68,69,70,43]),import.meta.url)}var tx=(0,Q.lazy)(async()=>({default:(await ex()).GraphPanel})),nx=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-CnhDNi-c.js`),__vite__mapDeps([71,1,47,10,11,12,23,14,15,16,17,24,25,26,22,27,29,30,31,19,72,2,73,74,9,75,76,77,78,79,80,81,82,83,6,3,7,8,84,68,85,86,87,4,88,49,18,20,36,35,89,90,37,38,40,61,62,63,43,65,91,92,28,32,60,64,66,67,93,94,95,96,33,21,97,98,99,100,39,41,101,102,103,104,105,106,107,108,109]),import.meta.url)).ActivityModeContent}));function rx(e){let t=(0,$.c)(45),{docName:n,isSourceMode:r,activeTab:i,onActiveTabChange:a,mode:o}=e,{_:s}=mt(),{activeProvider:c,activeDocName:l}=Re(),{data:u}=Kd(n),d=l===n?c:null,f=Yb(d,u?.effective??null),p=xd(n),m;t[0]!==p||t[1]!==f?(m=[...f,...p],t[0]=p,t[1]=f,t[2]=m):m=t[2];let h=m,g,_;t[3]!==n||t[4]!==f||t[5]!==d?(g=()=>{d!==null&&yd(n,`lint`,Qb(f))},_=[n,d,f],t[3]=n,t[4]=f,t[5]=d,t[6]=g,t[7]=_):(g=t[6],_=t[7]),(0,Q.useEffect)(g,_);let v,y;t[8]!==n||t[9]!==p||t[10]!==d?(v=()=>{d!==null&&yd(n,`links`,Qb(p))},y=[n,d,p],t[8]=n,t[9]=p,t[10]=d,t[11]=v,t[12]=y):(v=t[11],y=t[12]),(0,Q.useEffect)(v,y);let b;t[13]===d?b=t[14]:(b=e=>{d!==null&&e.fixes&&e.fixes.length>0&&qb(d,e.fixes)},t[13]=d,t[14]=b);let x=b,S;t[15]!==f||t[16]!==d?(S=()=>{d!==null&&qb(d,Kb(f))},t[15]=f,t[16]=d,t[17]=S):S=t[17];let C=S,w=Yo(),T;t[18]!==n||t[19]!==d?(T=e=>{if(d===null)return;let t=d.document.getText(`source`).toString().split(`
4
+ `)[e.range.start.line];Kt(lb(n,e,t),{submit:!0})},t[18]=n,t[19]=d,t[20]=T):T=t[20];let E=T,D=Bv(),O,k,A;if(t[21]!==s||t[22]!==i||t[23]!==h||t[24]!==o||t[25]!==a||t[26]!==D){let e=D?Zb.filter(ix):Zb;O=e.some(e=>e.id===i)?i:`outline`,k=o===`doc`&&e.length>1,A=k?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(Hr,{type:`single`,variant:`outline`,value:O,onValueChange:e=>{e&&a(e)},"aria-label":s({id:`SrOuyg`}),children:e.map(e=>{let{id:t,icon:n}=e,r=$b(t),i=t===`problems`&&h.length>0;return(0,Z.jsxs)(sn,{children:[(0,Z.jsx)(Br,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":i?s({id:`2m_bmh`,values:{0:h.length,label:r}}):r,asChild:!0,children:(0,Z.jsxs)(rn,{className:`relative`,children:[(0,Z.jsx)(n,{}),i&&(0,Z.jsx)(xu,{variant:`destructive`,"aria-hidden":`true`,className:`absolute -right-1.5 -top-1.5 h-4 min-w-4 rounded-full px-1 text-[10px] leading-none`,children:h.length>99?`99+`:h.length})]})}),(0,Z.jsx)(an,{side:`bottom`,children:r})]},t)})})}):null,t[21]=s,t[22]=i,t[23]=h,t[24]=o,t[25]=a,t[26]=D,t[27]=O,t[28]=k,t[29]=A}else O=t[27],k=t[28],A=t[29];let j;t[30]!==h||t[31]!==n||t[32]!==O||t[33]!==E||t[34]!==x||t[35]!==C||t[36]!==r||t[37]!==d||t[38]!==o||t[39]!==k||t[40]!==w?(j=o===`doc`?(0,Z.jsxs)(`div`,{...k?{role:`tabpanel`,id:`panel-${O}`,"aria-labelledby":`tab-${O}`}:{},className:`min-h-0 flex-1`,children:[O===`outline`&&(0,Z.jsx)(md,{docName:n,isSourceMode:r}),O===`links`&&(0,Z.jsx)(Sb,{docName:n}),O===`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)(J,{id:`-lCAuQ`})}),children:(0,Z.jsx)(tx,{activeDocName:n})}),O===`timeline`&&(0,Z.jsx)(Bb,{docName:n}),O===`problems`&&(0,Z.jsx)(Cd,{docName:n,diagnostics:h,onFix:d===null?void 0:x,onFixAll:d===null?void 0:C,onAskAi:d!==null&&w!==null?E:void 0})]}):(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)(J,{id:`ONPvOb`})}),children:(0,Z.jsx)(nx,{})})}),t[30]=h,t[31]=n,t[32]=O,t[33]=E,t[34]=x,t[35]=C,t[36]=r,t[37]=d,t[38]=o,t[39]=k,t[40]=w,t[41]=j):j=t[41];let M;return t[42]!==j||t[43]!==A?(M=(0,Z.jsxs)(Z.Fragment,{children:[A,j]}),t[42]=j,t[43]=A,t[44]=M):M=t[44],M}function ix(e){return e.id===`outline`||e.id===`problems`}function ax(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function ox(e,t){let n=getComputedStyle(e.ownerDocument.documentElement);return t*parseFloat(n.fontSize)}function sx(e){return e/100*window.innerHeight}function cx(e){return e/100*window.innerWidth}function lx(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 ux({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=lx(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=ox(t,i);break;case`em`:r=ax(t,i);break;case`vh`:r=sx(i);break;case`vw`:r=cx(i);break}return r}function dx(e){return parseFloat(e.toFixed(3))}function fx({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 px(e){let{panels:t}=e,n=fx({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=dx(ux({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=dx(ux({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=dx(ux({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=dx(ux({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 mx(e,t=`Assertion error`){if(!e)throw Error(t)}function hx(e,t){return Array.from(t).sort(e===`horizontal`?gx:_x)}function gx(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function _x(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function vx(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function yx(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 bx({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}=yx(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return mx(i,`No rect found`),i}var xx;function Sx(){return xx===void 0&&(xx=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),xx}function Cx(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=hx(n,Array.from(t.children).filter(vx).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,bx({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=Sx()?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:fx({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 wx=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)}}},Tx={cursorFlags:0,state:`inactive`},Ex=new wx;function Dx(){return Tx}function Ox(e){return Ex.addListener(`change`,e)}function kx(e){let t=Tx,n={...Tx};n.cursorFlags=e,Tx=n,Ex.emit(`change`,{prev:t,next:n})}function Ax(e){let t=Tx;Tx=e,Ex.emit(`change`,{prev:t,next:e})}var jx=e=>e,Mx=()=>{},Nx=1,Px=2,Fx=4,Ix=8,Lx=3,Rx=12,zx;function Bx(){return zx===void 0&&(zx=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(zx=!0)),zx}function Vx({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&&Bx()){let t=(e&Nx)!==0,n=(e&Px)!==0,r=(e&Fx)!==0,i=(e&Ix)!==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 Bx()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var Hx=new WeakMap;function Ux(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Hx.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=Dx();switch(r.state){case`active`:case`hover`:{let e=Vx({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}Hx.set(e,{prevStyle:t,styleSheet:n})}var Wx=new Map,Gx=new wx;function Kx(e){Wx=new Map(Wx),Wx.delete(e)}function qx(e,t){for(let[t]of Wx)if(t.id===e)return t}function Jx(e,t){for(let[t,n]of Wx)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Yx(){return Wx}function Xx(e,t){return Gx.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function Zx(e,t,n){let r=Wx.get(e);Wx=new Map(Wx),Wx.set(e,t),Gx.emit(`groupChange`,{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:r,next:t})}function Qx(e){let t=Dx(),n=!1;switch(t.state){case`active`:Ax({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(Ux(e),n=!0,t.hitRegions.forEach(e=>{let t=Jx(e.group.id,!0);Zx(e.group,t,{isUserInteraction:!0})}))}return n}function $x(e){e.defaultPrevented||Qx(e.currentTarget)}function eS(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=yx(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 tS(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function nS(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:cS(e),b:cS(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();mx(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:sS(oS(n.a)),b:sS(oS(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 rS=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function iS(e){let t=getComputedStyle(lS(e)??e).display;return t===`flex`||t===`inline-flex`}function aS(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||iS(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`||rS.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function oS(e){let t=e.length;for(;t--;){let n=e[t];if(mx(n,`Missing node`),aS(n))return n}return null}function sS(e){return e&&Number(getComputedStyle(e).zIndex)||0}function cS(e){let t=[];for(;e;)t.push(e),e=lS(e);return t}function lS(e){let{parentNode:t}=e;return tS(t)?t.host:t}function uS(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 dS({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!vx(n)||n.contains(e)||e.contains(n))return!0;if(nS(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(uS(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function fS(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Cx(r),a=eS(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&dS({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function pS(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 mS(e,t,n=0){return Math.abs(dx(e)-dx(t))<=n}function hS(e,t){return mS(e,t)?0:e>t?1:-1}function gS({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(hS(r,c)<0)if(a){let e=(i+c)/2;r=hS(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=dx(r),r}function _S({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(mS(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;mx(u!=null,`Invalid first pivot index`),mx(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];mx(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(mx(n!=null,`Previous layout not found for panel index ${t}`),mS(n,i)){let t=o-n;hS(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];mx(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(mx(n!=null,`Previous layout not found for panel index ${t}`),mS(n,o)){let t=n-i;hS(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];mx(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&hS(i,c)<0)if(e>0){let t=c-o,n=t/2;hS(i+e,c)<0&&(e=hS(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;hS(i-e,c)<0&&(e=hS(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];mx(e!=null,`Previous layout not found for panel index ${r}`);let a=gS({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];mx(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=gS({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!mS(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(pS(c,l))return i;{let t=e<0?d:u,r=s[t];mx(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=gS({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!mS(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];mx(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=gS({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(mS(i,s)||(t-=s-i,l[r]=s),mS(t,0))break;e>0?r--:r++}}}if(!mS(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 vS(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||hS(e[n],t[n])!==0)return!1;return!0}function yS({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!mS(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];mx(t!=null,`No layout data found for index ${e}`),r[e]=100/i*t}let a=0;for(let e=0;e<t.length;e++){let i=n[e];mx(i!=null,`No layout data found for index ${e}`);let o=r[e];mx(o!=null,`No layout data found for index ${e}`);let s=gS({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!mS(a,0))for(let e=0;e<t.length;e++){let n=r[e];mx(n!=null,`No layout data found for index ${e}`);let i=n+a,o=gS({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,mS(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function bS({groupId:e,panelId:t}){let n=()=>{let t=Yx();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&&mS(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,s).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:dx(100-e)}}return _S({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=yS({layout:o({nextSize:e,panels:i.panels,prevLayout:c,derivedPanelConstraints:r}),panelConstraints:r});vS(c,u)||Zx(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&&mS(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=fx({group:t});s(dx(ux({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function xS(e){e.defaultPrevented||fS(e,Yx()).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=bS({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function SS(e){let t=Yx();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 CS({groupId:e}){let t=()=>{let t=Yx();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=yS({layout:e,panelConstraints:r});return n?o:(vS(o,c)||Zx(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function wS(e,t){let n=SS(e),r=Jx(n.id,!0),i=n.separators.find(t=>t.element===e);mx(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);mx(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=CS({groupId:n.id}).getLayout(),c=yS({layout:_S({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});vS(s,c)||Zx(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function TS(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=SS(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&wS(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&wS(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&wS(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&wS(t,-5);break;case`End`:e.preventDefault(),wS(t,100);break;case`Enter`:{e.preventDefault();let n=SS(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=Jx(n.id,!0),o=n.separators.find(e=>e.element===t);mx(o,`Matching separator not found`);let s=a.get(o);mx(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(mx(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];wS(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=SS(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);mx(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(),wS(t,-100);break}}function ES(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Yx(),n=fS(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)}),Ax({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}function DS({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=_S({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(vS(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?Nx:Px;break;case`vertical`:s|=d<0?Fx:Ix;break}}else Zx(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&Lx:c|=s&Lx,t.movementY===0?c|=o&Rx:c|=s&Rx,kx(c),Ux(e)}function OS(e){let t=Yx(),n=Dx();switch(n.state){case`active`:DS({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function kS(e){if(e.defaultPrevented)return;let t=Dx(),n=Yx();switch(t.state){case`active`:if(e.buttons===0){Ax({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=Jx(e.group.id,!0);Zx(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)}DS({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=fS(e,n);r.length===0?t.state!==`inactive`&&Ax({cursorFlags:0,state:`inactive`}):Ax({cursorFlags:0,hitRegions:r,state:`hover`}),Ux(e.currentTarget);break}}}function AS(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Dx().state){case`hover`:Ax({cursorFlags:0,state:`inactive`})}}function jS(e){e.defaultPrevented||e.pointerType===`mouse`&&e.button>0||Qx(e.currentTarget)&&e.preventDefault()}function MS(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=dx(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=dx((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function NS(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=fx({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:dx(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function PS(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 FS({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=dx(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]=dx((r[e]??0)/a*l);else{let e=dx(l/c.length);for(let t of c)u[t]=e}return u}function IS(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 LS=new Map;function RS(e){let t=!0;mx(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=fx({group:e});if(t===0)return;let n=Jx(e.id);if(!n)return;let r=px(e),i=n.defaultLayoutDeferred?MS(r):n.layout,a=yS({layout:FS({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&vS(n.layout,a)&&PS(n.derivedPanelConstraints,r)&&n.groupSize===t)return;Zx(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else NS(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{mx(!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=fx({group:e}),s=px(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(IS(e.panels,l)||(l=void 0));let u=yS({layout:e.mutableState.layouts[c]??l??MS(s),panelConstraints:s}),d=e.element.ownerDocument;LS.set(d,(LS.get(d)??0)+1);let f=new Map;return Cx(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),Zx(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{mx(!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`,TS)}),LS.get(d)===1&&(d.addEventListener(`contextmenu`,$x,!0),d.addEventListener(`dblclick`,xS,!0),d.addEventListener(`pointerdown`,ES,!0),d.addEventListener(`pointerleave`,OS),d.addEventListener(`pointermove`,kS),d.addEventListener(`pointerout`,AS),d.addEventListener(`pointerup`,jS,!0)),function(){t=!1,LS.set(d,Math.max(0,(LS.get(d)??0)-1)),Kx(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,TS)}),LS.get(d)||(d.removeEventListener(`contextmenu`,$x,!0),d.removeEventListener(`dblclick`,xS,!0),d.removeEventListener(`pointerdown`,ES,!0),d.removeEventListener(`pointerleave`,OS),d.removeEventListener(`pointermove`,kS),d.removeEventListener(`pointerout`,AS),d.removeEventListener(`pointerup`,jS,!0)),a.disconnect()}}function zS(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function BS(e){let t=(0,Q.useId)();return`${e??t}`}var VS=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function HS(e){let t=(0,Q.useRef)(e);return VS(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function US(...e){return HS(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function WS(e){let t=(0,Q.useRef)({...e});return VS(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var GS=(0,Q.createContext)(null);function KS(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:jx});(0,Q.useImperativeHandle)(t,()=>n.current,[]),VS(()=>{Object.assign(n.current,CS({groupId:e}))})}function qS({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=HS(e=>{vS(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=HS((e,t)=>{vS(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e,{isUserInteraction:t}))}),_=BS(s),v=(0,Q.useRef)(null),[y,b]=zS(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=US(v,a);KS(_,o);let C=HS((e,t)=>{let r=Dx(),i=qx(e),a=Jx(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=WS({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=hx(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=hx(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=qx(_),i=Jx(_);r&&i&&Zx(r,{...i,derivedPanelConstraints:px(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 VS(()=>{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=RS(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=Jx(r.id,!0);!o&&s.length>0&&(h(c),g(c,!1));let l=Xx(_,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=mS(t.collapsedSize,i[t.panelId]),a=mS(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=Dx().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)(GS.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})})}qS.displayName=`Group`;function JS(){return(0,Q.useRef)(null)}function YS(){let e=(0,Q.useContext)(GS);return mx(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function XS(e,t){let{id:n}=YS(),r=(0,Q.useRef)({collapse:Mx,expand:Mx,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Mx});(0,Q.useImperativeHandle)(t,()=>r.current,[]),VS(()=>{Object.assign(r.current,bS({groupId:n,panelId:e}))})}function ZS({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=BS(c),_=WS({disabled:a}),v=(0,Q.useRef)(null),y=US(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=YS(),T=d!==null,E=HS((e,t,n)=>{d?.(e,c,n)});VS(()=>{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]),XS(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>Xx(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:{...QS,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})})}ZS.displayName=`Panel`;var QS={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function $S(){return(0,Q.useRef)(null)}function eC({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=yS({layout:_S({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=yS({layout:_S({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function tC({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=BS(a),l=WS({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),_=US(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=YS(),C=b===`horizontal`?`vertical`:`horizontal`;VS(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=Ox(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=Xx(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(eC({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})}tC.displayName=`Separator`;function nC(e){let t=(0,$.c)(50),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}=mt(),[o,s]=(0,Q.useState)(`diagram`),c=tf(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)(Qd,{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;return t[9]!==u||t[10]!==c.message||t[11]!==r||t[12]!==i.src?(e=(0,Z.jsx)($d,{fileName:r,dataAttr:`data-mermaid-file-viewer`,extraAttrs:u,message:c.message,openHref:i.src}),t[9]=u,t[10]=c.message,t[11]=r,t[12]=i.src,t[13]=e):e=t[13],e}let d=c.content,f;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>{e&&s(e)},t[14]=f):f=t[14];let p;t[15]===a?p=t[16]:(p=a({id:`72xhRD`}),t[15]=a,t[16]=p);let m;t[17]===a?m=t[18]:(m=a({id:`DEWDbv`}),t[17]=a,t[18]=m);let h;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(rn,{children:(0,Z.jsx)(ne,{className:`size-4`})}),t[19]=h):h=t[19];let g;t[20]===m?g=t[21]:(g=(0,Z.jsx)(Br,{value:`diagram`,"aria-label":m,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:h}),t[20]=m,t[21]=g);let _;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(an,{side:`bottom`,children:(0,Z.jsx)(J,{id:`i-ShMB`})}),t[22]=_):_=t[22];let v;t[23]===g?v=t[24]:(v=(0,Z.jsxs)(sn,{children:[g,_]}),t[23]=g,t[24]=v);let y;t[25]===a?y=t[26]:(y=a({id:`Y6SK9K`}),t[25]=a,t[26]=y);let b;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(rn,{children:(0,Z.jsx)(Ye,{className:`size-4`})}),t[27]=b):b=t[27];let x;t[28]===y?x=t[29]:(x=(0,Z.jsx)(Br,{value:`source`,"aria-label":y,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:b}),t[28]=y,t[29]=x);let S;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(an,{side:`bottom`,children:(0,Z.jsx)(J,{id:`wdxz7K`})}),t[30]=S):S=t[30];let C;t[31]===x?C=t[32]:(C=(0,Z.jsxs)(sn,{children:[x,S]}),t[31]=x,t[32]=C);let w;t[33]!==o||t[34]!==C||t[35]!==p||t[36]!==v?(w=(0,Z.jsx)(`div`,{className:`flex shrink-0 items-center justify-center border-b bg-background py-2`,children:(0,Z.jsxs)(Hr,{type:`single`,value:o,onValueChange:f,"aria-label":p,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 bg-muted p-0.5 data-[size=sm]:rounded-[10px]`,children:[v,C]})}),t[33]=o,t[34]=C,t[35]=p,t[36]=v,t[37]=w):w=t[37];let T;t[38]!==n||t[39]!==r||t[40]!==o||t[41]!==i||t[42]!==d?(T=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:o===`diagram`?(0,Z.jsx)(`div`,{className:`flex h-full min-h-0 flex-col p-3 [&_.mermaid-error-source]:hidden`,children:(0,Z.jsx)(yn,{chart:d,className:`min-h-0 flex-1`})}):(0,Z.jsx)(nf,{...i,fileName:r,extension:n})}),t[38]=n,t[39]=r,t[40]=o,t[41]=i,t[42]=d,t[43]=T):T=t[43];let E;return t[44]!==u||t[45]!==r||t[46]!==o||t[47]!==w||t[48]!==T?(E=(0,Z.jsxs)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":r,"data-mermaid-file-viewer":``,"data-mermaid-file-viewer-state":`loaded`,"data-mermaid-file-viewer-mode":o,...u,children:[w,T]}),t[44]=u,t[45]=r,t[46]=o,t[47]=w,t[48]=T,t[49]=E):E=t[49],E}function rC(e){return ma(`/api/asset?path=${encodeURIComponent(e)}`)}function iC(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function aC(e){let t=(0,$.c)(8),{assetPath:n,mediaKind:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(ef,{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)(oC,{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 oC(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=rC(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)(g,{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=iC(n),t[19]=n,t[20]=e),p=(0,Z.jsx)(nf,{src:e,fileName:l,extension:f.toLowerCase()},n);break bb0}if(u===`mermaid`){let e;t[21]===n?e=t[22]:(e=iC(n),t[21]=n,t[22]=e),p=(0,Z.jsx)(nC,{src:e,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)(x,{src:s,alt:l,draggable:!1,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)(J,{id:`qFWMl-`})}),(0,Z.jsx)(X,{variant:`outline`,size:`sm`,className:`font-mono uppercase`,onClick:()=>{Mn({url:s,projectRelPath:n,ext:f.toLowerCase(),title:l,forceOsDelegation:!1})},children:(0,Z.jsx)(J,{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 sC(){let e=(0,$.c)(5),{_:t}=mt(),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)(Ud,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(Ud,{className:`h-4 w-full`}),(0,Z.jsx)(Ud,{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 cC(e){let{_:t}=mt();return e===`existing-repo`?[{id:`draft-spec`,icon:Eh,label:t({id:`LdKIHS`}),prompt:t({id:`N_7kkF`})},{id:`organize-specs`,icon:Wh,label:t({id:`cuA8QW`}),prompt:t({id:`mPy9lS`})},{id:`document-architecture`,icon:Jh,label:t({id:`6eniID`}),prompt:t({id:`uDlyqd`})}]:[{id:`competitor-research`,icon:gg,label:t({id:`GUqTzn`}),prompt:t({id:`KOZud0`})},{id:`eng-specs`,icon:Eh,label:t({id:`Qvls7J`}),prompt:t({id:`6qMe0o`})},{id:`bird-wiki`,icon:ph,label:t({id:`FqTpiN`}),prompt:t({id:`jtg_8-`})}]}function lC(e){let t=(0,$.c)(13),{scenario:n,className:r}=e,{_:i}=mt(),a=cC(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){af(t).then(()=>{s(e),clearTimeout(c.current),c.current=setTimeout(()=>s(null),1600)}).catch(uC)};t[8]===r?d=t[9]:(d=Y(`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:Y(`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)(Po,{className:`size-3.5`,"aria-hidden":`true`}):(0,Z.jsx)($s,{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 uC(){}var dC=`ok-ask-ai-draft-v2`,fC={doc:null,dismissed:!1};function pC(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}var mC=null,hC=new Set;function gC(e){if(e===null)return!0;let t=e.content;return!Array.isArray(t)||t.length===0?!0:t.every(e=>{let t=e.content;return!Array.isArray(t)||t.length===0})}function _C(){let e=pC();if(!e)return fC;try{let t=e.getItem(dC);if(!t)return fC;let n=JSON.parse(t);return typeof n!=`object`||!n||Array.isArray(n)?fC:{doc:n,dismissed:!1}}catch(e){return console.warn(`failed to parse stored draft — clearing`,e),fC}}function vC(){return mC===null&&(mC=_C()),mC}function yC(e){let t=pC();if(t)try{e&&!gC(e)?t.setItem(dC,JSON.stringify(e)):t.removeItem(dC)}catch{}}function bC(){for(let e of hC)e()}function xC(){return vC()}function SC(e){let t=e&&!gC(e)?e:null;mC={...vC(),doc:t},yC(t),bC()}function CC(){SC(null)}var wC=Fa;function TC(e){let t=In(e).kind;return t===`folder`||t===`asset`?t:`page`}function EC(e){let t=(0,$.c)(14),{items:n,query:r,selectedIndex:i,onSelect:a,loading:o,error:s,hasMore:c}=e,l=o===void 0?!1:o,u=s===void 0?!1:s,d=c===void 0?!1:c,{_:f}=mt(),p=(0,Q.useId)(),m=(0,Q.useRef)(null),h,g;t[0]===i?(h=t[1],g=t[2]):(h=()=>{(m.current?.querySelectorAll(`[role="option"]`))?.item(i)?.scrollIntoView({block:`nearest`})},g=[i],t[0]=i,t[1]=h,t[2]=g),(0,Q.useEffect)(h,g);let _=i>=0&&i<n.length?n[i]:null,v;return t[3]!==f||t[4]!==u||t[5]!==d||t[6]!==n||t[7]!==p||t[8]!==l||t[9]!==a||t[10]!==r||t[11]!==i||t[12]!==_?(v=(0,Z.jsx)(`div`,{ref:m,className:`w-80 max-w-[min(28rem,90vw)] overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-md`,children:l?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:f({id:`3m2GBo`})}):u?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`assertive`,children:f({id:`weP6me`})}):n.length===0?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:r.trim()===``?f({id:`0E9DR6`}):f({id:`yQyglE`})}):(0,Z.jsxs)(`div`,{role:`listbox`,id:p,"aria-label":f({id:`05n5wS`}),tabIndex:-1,className:`max-h-64 overflow-y-auto subtle-scrollbar`,children:[(0,Z.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:_?_.title:``}),n.map((e,t)=>{let n=t===i,r=TC(e.path),o=r===`folder`,s=o?`${e.path}/`:e.path;return(0,Z.jsxs)(`button`,{id:`${p}-option-${t}`,type:`button`,role:`option`,"aria-selected":n,"data-active":n,"data-mention-kind":r,"data-testid":`composer-mention-option-${e.docName}`,className:`flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left ${n?`bg-accent text-accent-foreground`:``}`,onMouseDown:t=>{t.preventDefault(),a(e)},children:[(0,Z.jsx)(O,{path:e.path,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Z.jsxs)(`span`,{className:`flex items-baseline gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.title}),o?(0,Z.jsx)(`span`,{className:`shrink-0 text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:f({id:`kNqMMd`})}):null]}),(0,Z.jsx)(`span`,{className:`line-clamp-2 break-all text-xs text-muted-foreground`,children:s})]})]},e.docName)}),d?(0,Z.jsx)(`div`,{className:`px-2 py-1 text-xs text-muted-foreground`,"aria-hidden":!0,children:f({id:`F1T9y_`})}):null]})}),t[3]=f,t[4]=u,t[5]=d,t[6]=n,t[7]=p,t[8]=l,t[9]=a,t[10]=r,t[11]=i,t[12]=_,t[13]=v):v=t[13],v}var DC=8,OC=new Za(`composerMentionSuggestion`);function kC(e){return e.kind===`asset`?e.docName.replace(/^\//,``):e.kind===`folder`?e.docName:Zs(e.docName)}var AC=_i.create({name:`doc`,topNode:!0,content:`paragraph+`}),jC=_i.create({name:`paragraph`,group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML(){return[`p`,0]}}),MC=_i.create({name:`text`,group:`inline`}),NC=_i.create({name:`hardBreak`,group:`inline`,inline:!0,selectable:!1,parseHTML(){return[{tag:`br`}]},renderHTML(){return[`br`]},addKeyboardShortcuts(){return{"Shift-Enter":()=>this.editor.commands.insertContent({type:`hardBreak`})}}}),PC=no.create({name:`composerHistory`,addProseMirrorPlugins(){return[Ta(),Ni({"Mod-z":da,"Mod-y":wa,"Shift-Mod-z":wa})]}}),FC=_i.create({name:`composerMention`,group:`inline`,inline:!0,atom:!0,selectable:!0,addAttributes(){return{path:{default:``},label:{default:``}}},parseHTML(){return[{tag:`span[data-composer-mention]`}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.label||e.attrs.path);return[`span`,$i(t,{"data-composer-mention":String(e.attrs.path??``),class:`composer-mention-chip`}),`@${n}`]},renderText({node:e}){return`@${e.attrs.path}`},addNodeView(){return({node:e,editor:t,getPos:n})=>{let r=String(e.attrs.path??``),i=String(e.attrs.label||e.attrs.path),a=document.createElement(`span`);a.className=`composer-mention-chip group/mention`,a.setAttribute(`data-composer-mention`,r),a.title=i;let o=document.createElement(`button`);o.type=`button`,o.className=`composer-mention-icon`,o.setAttribute(`aria-label`,vl._({id:`Xzy0s0`,values:{fullLabel:i}}));let s=document.createElement(`span`);s.className=`composer-mention-glyph composer-mention-glyph-icon`,s.setAttribute(`aria-hidden`,`true`),s.innerHTML=l(r),o.appendChild(s);let c=document.createElement(`span`);c.className=`composer-mention-glyph composer-mention-glyph-x`,c.setAttribute(`aria-hidden`,`true`),c.innerHTML=K(ul),o.appendChild(c),o.addEventListener(`mousedown`,e=>e.preventDefault()),o.addEventListener(`click`,r=>{r.preventDefault();let i=typeof n==`function`?n():null;i!=null&&t.chain().focus().deleteRange({from:i,to:i+e.nodeSize}).run()}),a.appendChild(o);let u=document.createElement(`span`);return u.className=`composer-mention-label`,u.textContent=i,a.appendChild(u),{dom:a}}},addProseMirrorPlugins(){return[RC(this.editor)]}});function IC(e){return[AC,jC,MC,NC,PC,FC,...e?.placeholder?[wC.configure({placeholder:e.placeholder})]:[]]}function LC(e=zn){let t=[],n=!1,r=null,i=!1;return{snapshot(){return{loaded:n,error:i}},async getItems(a){if(!n){r||=e();try{t=await r,n=!0,i=!1}catch(e){console.error(`[composer-mention] failed to fetch pages`,e),t=[],i=!0}finally{r=null}}return Gn(t,a).map(e=>({docName:e.docName,title:e.title,path:kC(e)})).filter(e=>e.path!==``)},reset(){t=[],n=!1,r=null,i=!1}}}function RC(e){let t=LC();return Tn({editor:e,pluginKey:OC,char:`@`,items:({query:e})=>t.getItems(e),command:({editor:e,range:t,props:n})=>{try{e.chain().focus().deleteRange(t).insertContent([{type:`composerMention`,attrs:{path:n.path,label:n.title}},{type:`text`,text:` `}]).run()}catch(e){console.error(`[composer-mention] insert failed`,{item:n,range:t},e)}},render:()=>{let e=null,n=null,r=0,i={popup:null,stopAutoUpdate:null},a=null,o=null,s=e=>{n?.command(e)},c=e=>{let n=e.items??[],{loaded:i,error:a}=t.snapshot();return{items:n,query:e.query??``,selectedIndex:r,onSelect:s,loading:!i&&!a,error:a,hasMore:n.length>=DC}},l=()=>{!e||!n||e.updateProps(c(n))};return{onBeforeStart(t){n=t,r=0;let s=wn(()=>n,`composer-mention`);i.popup=s.popup,a=s.doPosition,o=s.reveal,e=new Dn(EC,{props:c(t),editor:t.editor}),s.popup.appendChild(e.element),i.stopAutoUpdate=s.startAutoUpdate()},onStart(e){n=e,r=0,l(),o?.()},onUpdate(e){n=e,r=Math.min(r,Math.max(0,e.items.length-1)),l(),a?.()},onKeyDown({event:e}){if(!n)return!1;let t=n.items;if(e.key===`ArrowDown`)return t.length===0?!1:(r=(r+1)%t.length,l(),!0);if(e.key===`ArrowUp`)return t.length===0?!1:(r=(r-1+t.length)%t.length,l(),!0);if(e.key===`Enter`||e.key===`Tab`){let e=t[r];return e?(n.command(e),!0):!1}return!1},onExit(){kn(i),a=null,o=null,e?.destroy(),e=null,n=null,r=0,t.reset()}}}})}function zC(e){let t=[],n=new Set,r=[];return e.state.doc.forEach(e=>{let i=``;e.forEach(e=>{if(e.type.name===`composerMention`){let r=String(e.attrs.path??``);r!==``&&(i+=`@${r}`,n.has(r)||(n.add(r),t.push(r)))}else e.isText?i+=e.text??``:e.type.name===`hardBreak`&&(i+=`
5
+ `)}),r.push(i)}),{instruction:r.join(`
6
+ `).trim(),mentions:t}}function BC(e){let{instruction:t,mentions:n}=zC(e);return t===``&&n.length===0}function VC(e){let t=e?.content;return!Array.isArray(t)||t.length===0?!1:t.some(e=>Array.isArray(e.content)&&e.content.length>0)}function HC(e){let t=(0,$.c)(29),{ref:n,ariaLabel:r,onEmptyChange:i,onContentChange:a,onMentionsChange:o,onSubmit:s,className:c,placeholder:l,initialDoc:u}=e,d=(0,Q.useRef)(i),f=(0,Q.useRef)(a),p=(0,Q.useRef)(o),m=(0,Q.useRef)(s),h;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==s?(h=()=>{d.current=i,f.current=a,p.current=o,m.current=s},t[0]=a,t[1]=i,t[2]=o,t[3]=s,t[4]=h):h=t[4],(0,Q.useEffect)(h);let g;t[5]===l?g=t[6]:(g=IC({placeholder:l}),t[5]=l,t[6]=g);let _=u??void 0,v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=Y(`composer-prosemirror py-1 outline-none`),t[7]=v):v=t[7];let y;t[8]===r?y=t[9]:(y={role:`textbox`,"aria-label":r,"aria-multiline":`true`,class:v},t[8]=r,t[9]=y);let b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(b=(e,t)=>t.key===`Escape`?OC.getState(e.state)?.active?!1:(e.dom.blur(),!0):t.key===`Enter`&&!t.shiftKey&&!t.isComposing&&!e.composing?OC.getState(e.state)?.active?!1:(m.current(),!0):!1,t[10]=b):b=t[10];let x;t[11]===y?x=t[12]:(x={attributes:y,handleKeyDown:b},t[11]=y,t[12]=x);let S;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{let{editor:t}=e;d.current(BC(t)),f.current?.(t.getJSON()),p.current?.(zC(t).mentions)},t[13]=S):S=t[13];let C;t[14]!==g||t[15]!==_||t[16]!==x?(C={extensions:g,content:_,immediatelyRender:!0,editorProps:x,onUpdate:S},t[14]=g,t[15]=_,t[16]=x,t[17]=C):C=t[17];let w=Fn(C),T;t[18]!==w||t[19]!==u?(T=()=>{w&&(BC(w)&&VC(u)&&(console.warn(`composer draft was incompatible with the current schema — clearing it`),CC()),d.current(BC(w)),p.current?.(zC(w).mentions))},t[18]=w,t[19]=u,t[20]=T):T=t[20];let E;t[21]===w?E=t[22]:(E=[w],t[21]=w,t[22]=E),(0,Q.useEffect)(T,E);let D,O;t[23]===w?(D=t[24],O=t[25]):(D=()=>({focus:()=>w?.commands.focus(),blur:()=>w?.commands.blur(),clear:()=>w?.commands.clearContent(!0),setText:e=>{w&&(w.commands.setContent(e),f.current?.(w.getJSON()),p.current?.(zC(w).mentions))},getContent:()=>w?zC(w):{instruction:``,mentions:[]}}),O=[w],t[23]=w,t[24]=D,t[25]=O),(0,Q.useImperativeHandle)(n,D,O);let k;return t[26]!==c||t[27]!==w?(k=(0,Z.jsx)(Hn,{editor:w,className:c}),t[26]=c,t[27]=w,t[28]=k):k=t[28],k}function UC(e,t,n){return e.trim().length>0||t.length>0||n}new Set(Yr.map(e=>e.id));function WC(e,t){Vc(e,t)}function GC(e){let t=(0,$.c)(2),{agentName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(J,{id:`5PrrYw`,values:{agentName:n}}),t[0]=n,t[1]=r),r}function KC(e){let t=(0,$.c)(29),{scenario:n,className:r}=e,{_:i}=mt(),{states:a,refresh:o}=es(),s=Jr(),{dispatch:c}=Jo(),l=sd(),u=Yo(),[d,f]=(0,Q.useState)(JC),p=Wr(),m=Ur(),h;t[0]===s?h=t[1]:(h=e=>Xr(s,e.source,e.id,!0,e.supported),t[0]=s,t[1]=h);let g=m.filter(h),_=ni(g,p),v;t[2]===u?.installedClis?v=t[3]:(v=u?.installedClis??{},t[2]=u?.installedClis,t[3]=v);let y=Hc({sticky:d,effectiveThreadAgent:_,enabledClis:u===null?[]:Cc(s,u.installedClis),enabledDesktopTargets:Uc(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)(qC),[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=cC(n),N;t[5]===s?N=t[6]:(N=e=>ei(s,e.id),t[5]=s,t[6]=N);let P=Yr.filter(N),F=Yr.every(e=>a[e.id]?.installed!=null),I=u!==null&&Cc(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),Vc(e),WC(e)},t[7]=R):R=t[7];let z=R,B;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(e){f(bc(e)),Vc(bc(e))},t[8]=B):B=t[8];let V=B,H;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(H=function(e){Kr(e),f(yc),Vc(yc)},t[9]=H):H=t[9];let U=H,ee=function(){let{instruction:e,mentions:t}=w.current?.getContent()??{instruction:``,mentions:[]};if(!UC(e,t,!1)){k(!0);return}let r=Xo({workspace:l,description:e,scenario:n,mentions:t});r!==null&&(us(r,_===null?void 0:{agent:{source:_.source,id:_.id}}),w.current?.clear(),CC())},W=function(){if(u===null||x===null)return;let{instruction:e,mentions:t}=w.current?.getContent()??{instruction:``,mentions:[]};if(!UC(e,t,!1)){k(!0);return}let r=Xo({workspace:l,description:e,scenario:n,mentions:t});r!==null&&(u.launchInTerminal(r,x),w.current?.clear(),CC())},G=function(e){let{instruction:t,mentions:r}=w.current?.getContent()??{instruction:``,mentions:[]};if(!UC(t,r,!1)){k(!0);return}if(WC(e),a[e]?.installed!==!0){let t=Yr.find(t=>t.id===e);t&&cs(t);return}let i=Xo({workspace:l,description:t,scenario:n,mentions:r});i!==null&&(c(e,i),w.current?.clear(),CC())},K=function(){b?ee():C?W():S!==null&&G(S)},te=function(e){w.current?.setText(e),w.current?.focus()};if(L){let e;t[10]===r?e=t[11]:(e=Y(`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)(Ks,{"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)(J,{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:Cl,className:`gap-1.5`,"data-testid":`create-configure-agents`,children:[(0,Z.jsx)(rl,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(J,{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 ne=u?Cc(s,u.installedClis):[],q=P.length>0,re=ne.length>0,ie=g.length>0,ae=y.kind!==`none`,oe;t[17]===r?oe=t[18]:(oe=Y(`flex w-full flex-col gap-3`,r),t[17]=r,t[18]=oe);let se;t[19]===i?se=t[20]:(se=i({id:`7hctf2`}),t[19]=i,t[20]=se);let ce;t[21]===i?ce=t[22]:(ce=i({id:`0jD-Gn`}),t[21]=i,t[22]=ce);let le;t[23]!==E||t[24]!==O?(le=O&&E?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-input-required`,children:(0,Z.jsx)(J,{id:`1FLarN`})}):(0,Z.jsx)(`span`,{}),t[23]=E,t[24]=O,t[25]=le):le=t[25];let ue=ae?(0,Z.jsxs)(of,{children:[(0,Z.jsx)(X,{type:`button`,onClick:()=>b?ee():C?W():S===null?void 0:G(S),variant:`outline`,className:`gap-1.5`,"data-testid":`create-with-agent`,children:b&&_!==null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(vo,{agentId:_.id,iconUrl:_.iconUrl,className:`size-3.5`}),(0,Z.jsx)(GC,{agentName:_.name})]}):C&&x!==null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Zr,{id:Gr(x),"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(J,{id:`4rjwLG`,values:{0:Gi[x].displayName}})]}):S===null?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Zr,{id:S,"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(J,{id:`9dw5bW`,values:{0:Ko(S)}})]})}),(0,Z.jsxs)(Mr,{onOpenChange:e=>{e&&o()},children:[(0,Z.jsx)(Er,{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)(Io,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsxs)(Ar,{align:`end`,className:`max-h-80 min-w-[200px]`,children:[ie?(0,Z.jsxs)(Tr,{"aria-label":i({id:`vPKX2i`}),children:[(0,Z.jsxs)(Or,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(J,{id:`RXEbZy`}),(0,Z.jsx)($r,{})]}),g.map(e=>(0,Z.jsxs)(Sr,{onSelect:()=>U(e),"data-testid":`create-agent-option-thread-${e.source}:${e.id}`,children:[(0,Z.jsx)(vo,{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)(Po,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},`${e.source}:${e.id}`))]}):null,ie&&(re||q)?(0,Z.jsx)(Nr,{}):null,re?(0,Z.jsxs)(Tr,{"aria-label":i({id:`ALhMYW`}),children:[(0,Z.jsx)(Or,{children:(0,Z.jsx)(J,{id:`ALhMYW`})}),ne.map(e=>{let{displayName:t}=Gi[e];return(0,Z.jsxs)(Sr,{onSelect:()=>V(e),"data-testid":`create-with-cli-${e}`,"aria-label":i({id:`QYfQdv`,values:{displayName:t}}),children:[(0,Z.jsx)(Zr,{id:Gr(e),"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t}),x===e?(0,Z.jsx)(Po,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e)})]}):null,q?(0,Z.jsxs)(Z.Fragment,{children:[re?(0,Z.jsx)(Nr,{}):null,(0,Z.jsxs)(Tr,{"aria-label":i({id:`BBqGS9`}),children:[(0,Z.jsx)(Or,{children:(0,Z.jsx)(J,{id:`BBqGS9`})}),P.map(e=>(0,Z.jsxs)(Sr,{onSelect:()=>z(e.id),"data-testid":`create-agent-option-${e.id}`,children:[(0,Z.jsx)(Zr,{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)(Po,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null,(0,Z.jsx)(Nr,{}),(0,Z.jsxs)(Sr,{onSelect:Cl,"data-testid":`create-agent-option-settings`,children:[(0,Z.jsx)(rl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{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)(J,{id:`hYgDIe`})}),de;return t[26]!==le||t[27]!==ue?(de=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 px-3 pb-3`,children:[le,ue]}),t[26]=le,t[27]=ue,t[28]=de):de=t[28],(0,Z.jsxs)(`div`,{className:oe,children:[(0,Z.jsxs)(`div`,{onMouseDown:e=>cf(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)(HC,{ref:w,ariaLabel:se,placeholder:ce,onEmptyChange:j,onContentChange:SC,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!==`existing-repo`&&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)(J,{id:`I5685_`})}),M.map(e=>{let t=e.icon;return(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>te(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 qC(){return xC().doc??void 0}function JC(){return gc()}function YC(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(Yp,{size:64,celebrateSignal:i}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(`h2`,{className:`text-2xl font-light tracking-tighter text-balance`,children:n}),t[2]=n,t[3]=o);let s;t[4]===r?s=t[5]:(s=r?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}):null,t[4]=r,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(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:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function XC({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 ZC=`open-knowledge:create-top-level-file`;function QC(e={}){window.dispatchEvent(new CustomEvent(ZC,{detail:e}))}function $C(e){let t=t=>{let n=t.detail;e(n??{})};return window.addEventListener(ZC,t),()=>window.removeEventListener(ZC,t)}function ew(e){let t=(0,$.c)(28),{celebrateSignal:n,onAddStarterPack:r}=e,{_:i}=mt(),a=Ys(),{title:o,subtitle:s}=XC({isOnboarding:!1,isEmbedded:a}),c=gs(),l;t[0]!==c.data||t[1]!==c.status?(l=c.status===`ready`?c.data:[],t[0]=c.data,t[1]=c.status,t[2]=l):l=t[2];let u=l,d=c.status===`loading`||c.status===`idle`,f=c.status===`error`,p=YC,m=i(o),h=i(s),g;t[3]!==p||t[4]!==n||t[5]!==m||t[6]!==h?(g=(0,Z.jsx)(p,{title:m,subtitle:h,celebrateSignal:n}),t[3]=p,t[4]=n,t[5]=m,t[6]=h,t[7]=g):g=t[7];let _;t[8]===a?_=t[9]:(_=a?(0,Z.jsx)(lC,{scenario:`existing-repo`}):(0,Z.jsx)(KC,{scenario:`existing-repo`}),t[8]=a,t[9]=_);let v;t[10]!==u||t[11]!==f||t[12]!==d?(v=d||f||u.length>0?(0,Z.jsx)(rw,{templates:u,loading:d,error:f,onSelect:nw}):null,t[10]=u,t[11]=f,t[12]=d,t[13]=v):v=t[13];let y,b;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(Ht,{"aria-hidden":`true`,className:`size-3`}),b=(0,Z.jsx)(J,{id:`IajAbS`}),t[14]=y,t[15]=b):(y=t[14],b=t[15]);let x;t[16]===r?x=t[17]:(x=(0,Z.jsxs)(X,{onClick:r,variant:`link-muted`,size:`xs`,className:`font-mono text-xs uppercase tracking-wider`,children:[y,b]}),t[16]=r,t[17]=x);let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(X,{variant:`link-muted`,className:`justify-end`,size:`sm`,onClick:tw,children:(0,Z.jsx)(J,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(Kn,{"aria-hidden":`true`,className:`size-3`})}})}),t[18]=S):S=t[18];let C;t[19]===x?C=t[20]:(C=(0,Z.jsxs)(`div`,{className:`-mt-6 flex w-full items-center justify-between gap-4`,children:[x,S]}),t[19]=x,t[20]=C);let w;t[21]!==C||t[22]!==v?(w=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8`,children:[v,C]}),t[21]=C,t[22]=v,t[23]=w):w=t[23];let T;return t[24]!==w||t[25]!==g||t[26]!==_?(T=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8 py-12 max-w-5xl my-auto`,children:[g,_,w]}),t[24]=w,t[25]=g,t[26]=_,t[27]=T):T=t[27],T}function tw(){return QC({initialDir:``})}function nw(e,t){return QC({template:{folder:e,name:t}})}function rw(e){let t=(0,$.c)(25),{templates:n,loading:r,error:i,onSelect:a}=e,{_:o}=mt(),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)(J,{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)(xu,{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)(J,{id:`Hl89Qd`})}):i?(0,Z.jsx)(`p`,{role:`alert`,className:`p-4 text-1sm text-destructive`,children:(0,Z.jsx)(J,{id:`54Y6Fg`})}):n.map(e=>(0,Z.jsx)(iw,{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 iw(e){let t=(0,$.c)(24),{template:n,targetLabel:r,onClick:i}=e,{_:a}=mt(),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 aw(e){let t=(0,$.c)(25),{terminalDock:n}=e,r=n===void 0?null:n,[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(void 0),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(0),f=(0,Q.useRef)(!1),p=(0,Q.useRef)(void 0),m,h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{let e=!1,t=async function(){try{let{ok:t,body:n}=await ru();if(e)return;let r=t?ka.safeParse(n):null;r?.success?(l(cw(r.data.documents)),f.current=!0):f.current||=(l(1),!0)}catch{!e&&!f.current&&(l(1),f.current=!0)}};t();let n=Yl(e=>{e.includes(`files`)&&t()});return()=>{e=!0,n(),clearTimeout(p.current)}},h=[],t[0]=m,t[1]=h):(m=t[0],h=t[1]),(0,Q.useEffect)(m,h);let g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=function(){clearTimeout(p.current),p.current=setTimeout(()=>d(sw),500),ru().then(e=>{let{ok:t,body:n}=e;if(!t)return;let r=ka.safeParse(n);r.success&&l(cw(r.data.documents))}).catch(ow)},t[2]=g):g=t[2];let _=g,v=c!==null,y=c===0,b;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(e){a(e),e||s(void 0)},t[3]=b):b=t[3];let x=b;if(r!==null){let e=r===`bottom`?`justify-end`:`justify-center`,n;t[4]===e?n=t[5]:(n=Y(`@container/emptystate flex min-h-0 flex-1 flex-col items-center pb-8 pt-10`,e),t[4]=e,t[5]=n);let i;t[6]!==u||t[7]!==y||t[8]!==v?(i=v?(0,Z.jsx)(lw,{isOnboarding:y,celebrateSignal:u}):null,t[6]=u,t[7]=y,t[8]=v,t[9]=i):i=t[9];let a;t[10]===i?a=t[11]:(a=(0,Z.jsx)(`div`,{className:`flex w-full flex-col items-center px-4 @md/emptystate:px-10 @2xl/emptystate:px-16`,children:i}),t[10]=i,t[11]=a);let o;return t[12]!==n||t[13]!==a?(o=(0,Z.jsx)(`div`,{className:n,children:a}),t[12]=n,t[13]=a,t[14]=o):o=t[14],o}let S;t[15]!==u||t[16]!==y||t[17]!==v?(S=v?y?(0,Z.jsx)(uw,{celebrateSignal:u,onPackSelect:e=>{s(e),a(!0)}}):(0,Z.jsx)(ew,{celebrateSignal:u,onAddStarterPack:()=>{a(!0)}}):null,t[15]=u,t[16]=y,t[17]=v,t[18]=S):S=t[18];let C;t[19]!==o||t[20]!==i?(C=(0,Z.jsx)(Tv,{open:i,onOpenChange:x,onSeedApplied:_,initialPackId:o}),t[19]=o,t[20]=i,t[21]=C):C=t[21];let w;return t[22]!==S||t[23]!==C?(w=(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:[S,C]})}),t[22]=S,t[23]=C,t[24]=w):w=t[24],w}function ow(){}function sw(e){return e+1}function cw(e){return Pl(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function lw(e){let t=(0,$.c)(15),{isOnboarding:n,celebrateSignal:r}=e,{_:i}=mt(),a=Ys(),o,s,c,l;if(t[0]!==i||t[1]!==a||t[2]!==n){let{title:e,subtitle:r}=XC({isOnboarding:n,isEmbedded:a});l=`w-full max-w-5xl`,o=YC,s=i(e),c=i(r),t[0]=i,t[1]=a,t[2]=n,t[3]=o,t[4]=s,t[5]=c,t[6]=l}else o=t[3],s=t[4],c=t[5],l=t[6];let u;t[7]!==o||t[8]!==r||t[9]!==s||t[10]!==c?(u=(0,Z.jsx)(o,{title:s,subtitle:c,celebrateSignal:r}),t[7]=o,t[8]=r,t[9]=s,t[10]=c,t[11]=u):u=t[11];let d;return t[12]!==l||t[13]!==u?(d=(0,Z.jsx)(`div`,{className:l,children:u}),t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function uw(e){let t=(0,$.c)(29),{celebrateSignal:n,onPackSelect:r}=e,{_:i}=mt(),a=Ys(),o,s,c,l;if(t[0]!==i||t[1]!==a){let{title:e,subtitle:n}=XC({isOnboarding:!0,isEmbedded:a});l=`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,o=YC,s=i(e),c=i(n),t[0]=i,t[1]=a,t[2]=o,t[3]=s,t[4]=c,t[5]=l}else o=t[2],s=t[3],c=t[4],l=t[5];let u;t[6]!==o||t[7]!==n||t[8]!==s||t[9]!==c?(u=(0,Z.jsx)(o,{title:s,subtitle:c,celebrateSignal:n}),t[6]=o,t[7]=n,t[8]=s,t[9]=c,t[10]=u):u=t[10];let d;t[11]===a?d=t[12]:(d=a?(0,Z.jsx)(lC,{scenario:`new-project`}):(0,Z.jsx)(KC,{scenario:`new-project`}),t[11]=a,t[12]=d);let f;t[13]!==i||t[14]!==a?(f=i(a?{id:`GubkSu`}:{id:`xeXS4P`}),t[13]=i,t[14]=a,t[15]=f):f=t[15];let p;t[16]===f?p=t[17]:(p=(0,Z.jsx)(fw,{label:f}),t[16]=f,t[17]=p);let m;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(m=[`okf`,`entity-vault`],t[18]=m):m=t[18];let h;t[19]===r?h=t[20]:(h=(0,Z.jsx)(yv,{onPackSelect:r,onCreateBlankFile:dw,collapsedPackIds:m}),t[19]=r,t[20]=h);let g;t[21]!==p||t[22]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-3`,children:[p,h]}),t[21]=p,t[22]=h,t[23]=g):g=t[23];let _;return t[24]!==g||t[25]!==l||t[26]!==u||t[27]!==d?(_=(0,Z.jsxs)(`div`,{className:l,children:[u,d,g]}),t[24]=g,t[25]=l,t[26]=u,t[27]=d,t[28]=_):_=t[28],_}function dw(){return QC()}function fw(e){let t=(0,$.c)(13),{label:n}=e,{_:r}=mt(),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)(Wc,{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)(rn,{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)(an,{className:`max-w-xs`,children:(0,Z.jsx)(`p`,{className:`leading-relaxed wrap-break-word`,children:(0,Z.jsx)(J,{id:`k4CuuV`})})}),t[7]=c):c=t[7];let l;t[8]===s?l=t[9]:(l=(0,Z.jsxs)(sn,{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 pw(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function mw(e){let t=(0,$.c)(70),{folderPath:n,state:r,onChange:i}=e,{_:a}=mt(),[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)(gw,{}),(0,Z.jsx)(Ud,{className:`h-7 w-full`}),(0,Z.jsx)(Ud,{className:`h-7 w-full`}),(0,Z.jsx)(Ud,{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)(J,{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=pw(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 fc(n,{[e]:t});if(!r.ok){let{error:e}=r;dl.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 fc(n,{[e]:null});if(!t.ok){let{error:e}=t;dl.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,So(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):Mo[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(La(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 fc(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 fc(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 ee=`size-3 transition-transform ${o?``:`rotate-90`}`,W;t[40]===ee?W=t[41]:(W=(0,Z.jsx)(Lo,{className:ee,"aria-hidden":!0}),t[40]=ee,t[41]=W);let G;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`vQIVHc`})}),t[42]=G):G=t[42];let K;t[43]===W?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:[W,G]}),t[43]=W,t[44]=K);let te;t[45]===h?te=t[46]:(te=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:hw,children:h}),t[45]=h,t[46]=te);let ne;t[47]!==K||t[48]!==te?(ne=(0,Z.jsxs)(ln,{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,te]}),t[47]=K,t[48]=te,t[49]=ne):ne=t[49];let q;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`hSBIG-`})}),t[50]=q):q=t[50];let re;t[51]!==c||t[52]!==y||t[53]!==z||t[54]!==_||t[55]!==p||t[56]!==x||t[57]!==u||t[58]!==C?(re=_.length===0&&!c?(0,Z.jsx)(`p`,{className:`px-1 py-1 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`4c_a6S`})}):_.map(e=>{let t=p[e];return(0,Z.jsx)(Ao,{keyName:e,value:t,declared:To(t,Pa(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]=re):re=t[59];let ie;t[60]!==c||t[61]!==N?(ie=c?(0,Z.jsx)(Do,{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)(Ht,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`G8t9NN`})})]})}),t[60]=c,t[61]=N,t[62]=ie):ie=t[62];let ae;t[63]!==re||t[64]!==ie?(ae=(0,Z.jsx)(cn,{children:(0,Z.jsxs)(`div`,{className:`px-2 py-2`,children:[q,re,ie]})}),t[63]=re,t[64]=ie,t[65]=ae):ae=t[65];let oe;return t[66]!==H||t[67]!==ne||t[68]!==ae?(oe=(0,Z.jsx)(`section`,{className:`rounded-lg border bg-card`,children:(0,Z.jsxs)(un,{open:H,onOpenChange:U,children:[ne,ae]})}),t[66]=H,t[67]=ne,t[68]=ae,t[69]=oe):oe=t[69],oe}function hw(e){return e.stopPropagation()}function gw(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Mh,{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)(J,{id:`vQIVHc`})})]}),e[1]=n):n=e[1],n}function _w(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?vl._({id:`xOTzt5`}):t<3600?vl._({id:`zbymaY`,values:{0:Math.floor(t/60)}}):t<86400?vl._({id:`optX0N`,values:{0:Math.floor(t/3600)}}):t<86400*7?vl._({id:`l1l8sj`,values:{0:Math.floor(t/86400)}}):new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function vw(e){return(e.split(`/`).pop()??e).replace(/\.md$/,``)}function yw(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:ks,label:vl._({id:`QR5SP1`}),detail:vw(i)};case`template-edit`:return{Icon:Qs,label:vl._({id:`-LHLx7`}),detail:vw(i)};case`template-delete`:return{Icon:il,label:vl._({id:`_gkGSK`}),detail:vw(i)};case`template-rename`:case`template-move`:{let[e,t]=i.split(` -> `);return{Icon:dh,label:vl._({id:`KPW5WC`}),detail:`${vw(e??``)} → ${vw(t??i)}`}}case`folder-frontmatter-edit`:return{Icon:Mh,label:vl._({id:`_tekeB`}),detail:``};case`folder-frontmatter-delete`:return{Icon:Mh,label:vl._({id:`ZWxfrc`}),detail:``};case`folder-create`:return{Icon:Mh,label:vl._({id:`ZQLDTl`}),detail:``};default:return{Icon:kc,label:r.replace(/-/g,` `),detail:vw(i)}}}function bw(e){return e.contributors.length>0?e.contributors[0].name:e.author===`openknowledge-service`||e.author===`server`?vl._({id:`B2DrPb`}):e.author||vl._({id:`Ef7StM`})}function xw(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=nu(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)(J,{id:`XJOV1Y`})}),t[4]=f):f=t[4];let p;t[5]===i.length?p=t[6]:(p=i.length>0?(0,Z.jsx)(xu,{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)(Ud,{className:`h-8 w-full`}),(0,Z.jsx)(Ud,{className:`h-8 w-full`})]}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:i.map(Sw)})}),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 Sw(e){let{Icon:t,label:n,detail:r}=yw(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)(Eg,{className:`size-3`,"aria-hidden":!0}),bw(e)]}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground/80`,dateTime:e.timestamp,title:new Date(e.timestamp).toLocaleString(),children:_w(e.timestamp)})]},e.sha)}function Cw(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function ww(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=Cw(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function Tw(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function Ew(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:ww(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:Tw(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:ww(e,t.pageTitles),children:a}}function Dw(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)(J,{id:`-QCLWk`})})}),(0,Z.jsx)(Ud,{className:`h-12 w-full`}),(0,Z.jsx)(Ud,{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)(J,{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)(J,{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)(xu,{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)(Ht,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(J,{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)(J,{id:`MZSBsh`})}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:p.map(e=>(0,Z.jsx)(xs,{template:e,onCreate:()=>l(e.name),onEdit:()=>pc(ye(e.source_folder,e.name)),onDelete:()=>s(e),badge:e.scope===`inherited`?(0,Z.jsx)(bo,{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)(Cs,{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(Ow)),t[20]=p,t[21]=S);let C;t[22]!==n||t[23]!==i?(C=e=>{i(),pc(ye(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)(ms,{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)(Z_,{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 Ow(e){return e.name}function kw(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=Y(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=Y(`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 Aw(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=Y(`[&_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 jw(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=Y(`[&_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 Mw(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=Y(`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 Nw(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=Y(`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 Pw(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=Y(`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 Fw(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return vl._({id:`xOTzt5`});if(r<60)return vl._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return vl._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?vl._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function Iw(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 Lw(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)(Bn,{className:`ml-1 size-3`}):(0,Z.jsx)(Ln,{className:`ml-1 size-3`}):(0,Z.jsx)(fh,{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 Rw(e){let t=(0,$.c)(96),{folderPath:n}=e,{_:r}=mt(),{folderPaths:i,loading:a,pages:o,pageTitles:s,pageMeta:c}=Bo(),l=Ds(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)(Ud,{className:`size-5 rounded`}),(0,Z.jsx)(Ud,{className:`h-7 w-48`})]}),(0,Z.jsx)(Ud,{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)(Ud,{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)(Ud,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(Vw)]})]}),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=Ew(n,{pages:o,pageTitles:s,pageMeta:c,folderPaths:i}),a=Iw(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?_(Bw):(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)(uc,{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)(Ht,{className:`size-4`}),(0,Z.jsx)(J,{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)(mw,{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)(Dw,{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)(xw,{folderPath:n}),t[44]=n,t[45]=D),S=`rounded-lg border`,y=kw;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)(Lw,{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)(Nw,{"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)(Lw,{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)(Nw,{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)(Aw,{children:(0,Z.jsxs)(Mw,{children:[L,V]})}),t[66]=L,t[67]=V,t[68]=x):x=t[68],v=jw,b=a.length?a.map(zw):(0,Z.jsx)(Mw,{children:(0,Z.jsx)(Pw,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:(0,Z.jsx)(J,{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)(Z_,{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 zw(e){return(0,Z.jsxs)(Mw,{children:[(0,Z.jsx)(Pw,{children:(0,Z.jsxs)(`a`,{href:vu(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)(Ph,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(ue,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(Pw,{className:`text-muted-foreground`,children:e.kind===`file`?Fw(e.modified):`—`})]},e.path)}function Bw(e){return e===`asc`?`desc`:`asc`}function Vw(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)(Ud,{className:`size-4 rounded`}),(0,Z.jsx)(Ud,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Ud,{className:`h-4 w-16`})})]},e)}function Hw(e){let t=(0,$.c)(24),{docName:n,size:r,limit:i,backNav:a}=e,o=a!==void 0,s=(0,Q.useRef)(null),c=(0,Q.useRef)(null),l,u;t[0]===o?(l=t[1],u=t[2]):(l=()=>{o?s.current?.focus():c.current?.focus()},u=[o],t[0]=o,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u);let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-full border bg-muted/40 text-muted-foreground`,children:(0,Z.jsx)(Oh,{className:`size-9`,"aria-hidden":`true`})}),t[3]=d):d=t[3];let f=o?void 0:-1,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(J,{id:`P3hnm0`}),t[4]=p):p=t[4];let m;t[5]===f?m=t[6]:(m=(0,Z.jsx)(`h2`,{ref:c,id:`large-file-title`,tabIndex:f,className:`text-2xl font-light text-balance outline-none`,children:p}),t[5]=f,t[6]=m);let h;t[7]===r?h=t[8]:(h=ki(r),t[7]=r,t[8]=h);let g;t[9]===i?g=t[10]:(g=ki(i),t[9]=i,t[10]=g);let _;t[11]!==n||t[12]!==h||t[13]!==g?(_=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`GJH-AT`,values:{0:h,1:g,docName:n}})}),t[11]=n,t[12]=h,t[13]=g,t[14]=_):_=t[14];let v;t[15]!==m||t[16]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[m,_]}),t[15]=m,t[16]=_,t[17]=v):v=t[17];let y;t[18]!==a||t[19]!==o?(y=o?(0,Z.jsxs)(X,{ref:s,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(Pn,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`CKyk7Q`})]}):null,t[18]=a,t[19]=o,t[20]=y):y=t[20];let b;return t[21]!==v||t[22]!==y?(b=(0,Z.jsxs)(`div`,{role:`status`,"aria-labelledby":`large-file-title`,"data-slot":`large-file-editor-state`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[d,v,y]}),t[21]=v,t[22]=y,t[23]=b):b=t[23],b}function Uw(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(Ww),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>_e(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(){me(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)(J,{id:`A67Uwj`})}),t[4]=l):l=t[4];let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(J,{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 Ww(){return new Set}function Gw(e){let t=(0,$.c)(20),{nav:n}=e,{state:r,refetch:i}=rc(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=cu(ic(n.path))},t[3]=n.path,t[4]=l);let u=l,d;t[5]!==o||t[6]!==n.kind?(d=function(e){ac.arm({kind:n.kind,path:e,branch:o}),window.location.hash=n.kind===`folder`?cu(e):vu(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)(sc,{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 Kw=e(Lt(),1);function qw(e){let t=(0,$.c)(9),{text:n}=e,r;t[0]===n?r=t[1]:(r=wi(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=ea(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)(J,{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)(Jw,{keyName:e,value:n},`${e}-${t}`)},t[7]=i,t[8]=c),a=(0,Z.jsx)(ko,{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 Jw(e){let t=(0,$.c)(12),{keyName:n,value:r}=e,i=xo[Pa(r)],a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`flex size-7 shrink-0 items-center justify-center rounded text-muted-foreground`,children:(0,Z.jsx)(i,{className:`size-3.5`})}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(`span`,{className:`flex h-7 w-32 shrink-0 items-center truncate px-2 text-sm text-muted-foreground`,children:n}),t[2]=n,t[3]=o);let s;t[4]!==n||t[5]!==r?(s=(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Z.jsx)(Yw,{keyName:n,value:r})}),t[4]=n,t[5]=r,t[6]=s):s=t[6];let c;return t[7]!==n||t[8]!==a||t[9]!==o||t[10]!==s?(c=(0,Z.jsxs)(`div`,{className:`group flex items-start gap-1 py-0.5`,"data-testid":`readonly-property-row`,"data-key":n,children:[a,o,s]}),t[7]=n,t[8]=a,t[9]=o,t[10]=s,t[11]=c):c=t[11],c}function Yw(e){let t=(0,$.c)(8),{keyName:n,value:r}=e;if(Oo(r)){let e;return t[0]!==n||t[1]!==r?(e=(0,Z.jsx)(wo,{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(Xw).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 Xw(e){return typeof e==`string`}function Zw(e){let t=(0,$.c)(29),{fileName:n,text:r}=e,i,a,o,s;if(t[0]!==r){let e=za(r).body;s=Fn,i=He,a=!1,o=Rn().parseWithFallback(e),t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=s}else i=t[1],a=t[2],o=t[3],s=t[4];let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c={attributes:{class:`pt-4`}},t[5]=c):c=t[5];let l;t[6]!==i||t[7]!==a||t[8]!==o?(l={extensions:i,editable:a,content:o,editorProps:c},t[6]=i,t[7]=a,t[8]=o,t[9]=l):l=t[9];let u;t[10]===r?u=t[11]:(u=[r],t[10]=r,t[11]=u);let d=s(l,u),[f]=(0,Q.useState)(Qw),p=(0,Q.useRef)(null),m,h;t[12]===f?(m=t[13],h=t[14]):(m=()=>{let e=p.current;if(e)return e.appendChild(f),()=>{f.parentNode===e&&e.removeChild(f)}},h=[f],t[12]=f,t[13]=m,t[14]=h),(0,Q.useLayoutEffect)(m,h);let g;t[15]===r?g=t[16]:(g=(0,Z.jsx)(qw,{text:r}),t[15]=r,t[16]=g);let _;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(`div`,{className:`tiptap-editor`,children:(0,Z.jsx)(`div`,{ref:p,style:{display:`contents`}})}),t[17]=_):_=t[17];let v;t[18]===g?v=t[19]:(v=(0,Z.jsxs)(`div`,{className:`editor-doc-scroll min-h-0 flex-1 overflow-auto`,children:[g,_]}),t[18]=g,t[19]=v);let y;t[20]===d?y=t[21]:(y=(0,Z.jsx)(Hn,{editor:d,className:`tiptap-editor-portal-content h-full`}),t[20]=d,t[21]=y);let b;t[22]!==f||t[23]!==y?(b=(0,Kw.createPortal)(y,f),t[22]=f,t[23]=y,t[24]=b):b=t[24];let x;return t[25]!==n||t[26]!==v||t[27]!==b?(x=(0,Z.jsxs)(`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:[v,b]}),t[25]=n,t[26]=v,t[27]=b,t[28]=x):x=t[28],x}function Qw(){let e=document.createElement(`div`);return e.style.display=`contents`,e}var $w=`data-skill-markdown`;function eT(e){let t=(0,$.c)(12),{scope:n,name:r,path:i,fileName:a}=e,o;t[0]!==r||t[1]!==i||t[2]!==n?(o={loadText:e=>xf({scope:n,name:r,path:i},e)},t[0]=r,t[1]=i,t[2]=n,t[3]=o):o=t[3];let s=tf(o);if(s.status===`loading`){let e;return t[4]===a?e=t[5]:(e=(0,Z.jsx)(Qd,{fileName:a,dataAttr:$w}),t[4]=a,t[5]=e),e}if(s.status===`error`){let e;return t[6]!==s.message||t[7]!==a?(e=(0,Z.jsx)($d,{fileName:a,dataAttr:$w,message:s.message}),t[6]=s.message,t[7]=a,t[8]=e):e=t[8],e}let c;return t[9]!==s.content||t[10]!==a?(c=(0,Z.jsx)(Zw,{fileName:a,text:s.content}),t[9]=s.content,t[10]=a,t[11]=c):c=t[11],c}var tT=new Set([`md`,`mdx`]);function nT(e){let t=(0,$.c)(19),{scope:n,name:r,path:i}=e,a;t[0]===i?a=t[1]:(a=i.split(`/`).pop()??i,t[0]=i,t[1]=a);let o=a,s=o.lastIndexOf(`.`),c,l;if(t[2]!==s||t[3]!==o?(c=s>=0?o.slice(s+1).toLowerCase():``,l=tT.has(c),t[2]=s,t[3]=o,t[4]=c,t[5]=l):(c=t[4],l=t[5]),l){let e;return t[6]!==o||t[7]!==r||t[8]!==i||t[9]!==n?(e=(0,Z.jsx)(eT,{scope:n,name:r,path:i,fileName:o}),t[6]=o,t[7]=r,t[8]=i,t[9]=n,t[10]=e):e=t[10],e}let u;t[11]!==r||t[12]!==i||t[13]!==n?(u=e=>xf({scope:n,name:r,path:i},e),t[11]=r,t[12]=i,t[13]=n,t[14]=u):u=t[14];let d;return t[15]!==c||t[16]!==o||t[17]!==u?(d=(0,Z.jsx)(nf,{fileName:o,extension:c,loadText:u}),t[15]=c,t[16]=o,t[17]=u,t[18]=d):d=t[18],d}function rT(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var iT=rT(()=>n(()=>import(`./SettingsDialogBody-Bkz3Bpgp.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([110,1,111,17,12,6,2,3,7,8,9,84,68,22,11,85,86,87,10,88,30,31,14,15,16,19,49,24,25,29,18,20,36,13,21,35,23,26,27,112,113,50,92,114,89,115,116,48,51,72,73,74,75,76,77,78,79,80,81,82,83,47,4,90,37,38,40,61,62,63,43,65,91,28,32,60,64,66,67,93,94,95,96,33,97,98,99,100,39,41,101,102,117,59,118,105,119,120,121,106,122,44,123,124,125,126,127,128,42,129,130,131,132,133,134,135,136,137,138]),import.meta.url));function aT(e){let t=(0,$.c)(9),{error:n}=e,{_:r}=mt(),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)(J,{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:oT,children:(0,Z.jsx)(J,{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 oT(){return window.location.reload()}function sT(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(qt,{fallbackRender:lT,onError:cT,children:n}),t[0]=n,t[1]=r),r}function cT(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function lT(e){return(0,Z.jsx)(aT,{...e})}function uT(e=typeof window>`u`?void 0:window.location){return e?.protocol===`file:`}function dT(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 Ns)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 Ya)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 fT(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}function pT(e){let t=(0,$.c)(43),{open:n,initialSection:r,onOpenChange:i}=e,a=r===void 0?null:r,{_:o}=mt(),{collabUrl:s}=Re(),{userBinding:c,userSynced:l,okignoreBinding:u,okignoreSynced:d,projectConfig:f,merged:p}=td(),{desktopPresent:m}=bs(),[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]===y?(D=t[5],O=t[6]):(D=()=>{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`)}},O=[y],t[4]=y,t[5]=D,t[6]=O),(0,Q.useEffect)(D,O);let k=s!==null,A=typeof window<`u`&&window.okDesktop!=null,j=A&&window.okDesktop?.config.ptyAvailable===!0,M,N;if(t[7]!==o||t[8]!==m||t[9]!==k||t[10]!==p?.appearance?.colorThemeEnabled||t[11]!==f?.contentRules){let e;t[14]===f?.contentRules?e=t[15]:(e=e=>f?.contentRules?.[e.id]?.enabled===!0,t[14]=f?.contentRules,t[15]=e);let n=Hd.filter(e).map(mT),r=p?.appearance?.colorThemeEnabled!==!1,i=uT();M=[{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`})},...A?[{id:`ai-tools`,label:o({id:`_5qBNl`})}]:[]]},{id:`project`,label:o({id:`ZWyHmq`}),enabled:k,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`})},...i?[]:[{id:`link-previews`,label:o({id:`gh27t1`})}],...j?[{id:`terminal`,label:o({id:`ALhMYW`})}]:[],...A?[{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:[...k?n:[],...r?[{id:`plugin:theme`,label:o({id:`fJ3EbT`})}]:[]]},{id:`integrations`,label:o({id:`nbfdhU`}),enabled:!0,items:[]}],N=dT({groups:M,translate:o}),t[7]=o,t[8]=m,t[9]=k,t[10]=p?.appearance?.colorThemeEnabled,t[11]=f?.contentRules,t[12]=M,t[13]=N}else M=t[12],N=t[13];let P=N,F;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(F=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[16]=F):F=t[16];let I=F,L;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(fn,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`Tz0i8g`})}),t[17]=L):L=t[17];let R;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(dn,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`RDrXh4`})}),t[18]=R):R=t[18];let z;t[19]!==h||t[20]!==M||t[21]!==P||t[22]!==_?(z=(0,Z.jsx)(hT,{groups:M,activeId:h,onSelect:g,entries:P,searchQuery:_,onSearchChange:v,onNavigate:I}),t[19]=h,t[20]=M,t[21]=P,t[22]=_,t[23]=z):z=t[23];let B;t[24]===o?B=t[25]:(B=o({id:`OXb_Df`}),t[24]=o,t[25]=B);let V;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(CT,{}),t[26]=V):V=t[26];let H=l?c:null,U;t[27]!==h||t[28]!==u||t[29]!==d||t[30]!==x||t[31]!==H?(U=(0,Z.jsx)(sT,{children:(0,Z.jsx)(Q.Suspense,{fallback:V,children:(0,Z.jsx)(iT,{activeId:h,userBinding:H,okignoreBinding:u,okignoreSynced:d,markdownlintRuleQuery:x})})}),t[27]=h,t[28]=u,t[29]=d,t[30]=x,t[31]=H,t[32]=U):U=t[32];let ee;t[33]!==B||t[34]!==U?(ee=(0,Z.jsx)(`section`,{ref:w,"aria-label":B,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain subtle-scrollbar p-6`,tabIndex:0,children:U}),t[33]=B,t[34]=U,t[35]=ee):ee=t[35];let W;t[36]!==z||t[37]!==ee?(W=(0,Z.jsxs)(pn,{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:[L,R,z,ee]}),t[36]=z,t[37]=ee,t[38]=W):W=t[38];let G;return t[39]!==i||t[40]!==n||t[41]!==W?(G=(0,Z.jsx)(_n,{open:n,onOpenChange:i,children:W}),t[39]=i,t[40]=n,t[41]=W,t[42]=G):G=t[42],G}function mT(e){return{id:`plugin:${e.id}`,label:e.label}}function hT(e){let t=(0,$.c)(46),{groups:n,activeId:r,onSelect:i,entries:a,searchQuery:o,onSearchChange:c,onNavigate:l}=e,{_:u}=mt(),d,f,p,m,h,g,_,v,y,b;if(t[0]!==u||t[1]!==a||t[2]!==l||t[3]!==c||t[4]!==o){f=o.trim();let e=f===``?[]:a.filter(e=>j_(e.label,f,e.keywords)),n=e.filter(vT),r=e.filter(_T),i=e.filter(gT);t[15]===u?y=t[16]:(y=u({id:`y1t8bQ`}),t[15]=u,t[16]=y),b=`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`,d=P,p=!1,m=`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`,h=`settings-search`;let x;t[17]===u?x=t[18]:(x=u({id:`1DahsC`}),t[17]=u,t[18]=x),t[19]!==c||t[20]!==o||t[21]!==x?(g=(0,Z.jsx)(A,{value:o,onValueChange:c,placeholder:x,className:`py-0`,"data-testid":`settings-search-input`}),t[19]=c,t[20]=o,t[21]=x,t[22]=g):g=t[22];let S=f===``?null:(0,Z.jsx)(J,{id:`TQJCR6`,values:{0:e.length}});t[23]===S?_=t[24]:(_=(0,Z.jsx)(`span`,{"aria-live":`polite`,className:`sr-only`,"data-testid":`settings-search-result-count`,children:S}),t[23]=S,t[24]=_),v=f===``?null:(0,Z.jsxs)(I,{"data-testid":`settings-search-results`,className:`mt-1.5`,children:[(0,Z.jsx)(s,{"data-testid":`settings-search-empty`,children:(0,Z.jsx)(J,{id:`ljFWEt`})}),n.length>0?(0,Z.jsx)(Ae,{heading:u({id:`R4OWFD`}),children:n.map(e=>(0,Z.jsx)(yT,{entry:e,query:f,onNavigate:l},e.id))}):null,r.length>0?(0,Z.jsx)(Ae,{heading:u({id:`Tz0i8g`}),children:r.map(e=>(0,Z.jsx)(yT,{entry:e,query:f,onNavigate:l},e.id))}):null,i.length>0?(0,Z.jsx)(Ae,{heading:u({id:`v2a04T`}),children:i.map(e=>(0,Z.jsx)(yT,{entry:e,query:f,onNavigate:l},e.id))}):null]}),t[0]=u,t[1]=a,t[2]=l,t[3]=c,t[4]=o,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]=b}else d=t[5],f=t[6],p=t[7],m=t[8],h=t[9],g=t[10],_=t[11],v=t[12],y=t[13],b=t[14];let x;t[25]!==d||t[26]!==p||t[27]!==m||t[28]!==h||t[29]!==g||t[30]!==_||t[31]!==v?(x=(0,Z.jsxs)(d,{shouldFilter:p,className:m,"data-testid":h,children:[g,_,v]}),t[25]=d,t[26]=p,t[27]=m,t[28]=h,t[29]=g,t[30]=_,t[31]=v,t[32]=x):x=t[32];let S;t[33]!==r||t[34]!==n||t[35]!==i||t[36]!==f?(S=f===``?n.map(e=>(0,Z.jsx)(ST,{group:e,activeId:r,onSelect:i},e.id)):null,t[33]=r,t[34]=n,t[35]=i,t[36]=f,t[37]=S):S=t[37];let C;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(xT,{}),t[38]=C):C=t[38];let w;t[39]===S?w=t[40]:(w=(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:[S,C]}),t[39]=S,t[40]=w);let T;return t[41]!==w||t[42]!==y||t[43]!==b||t[44]!==x?(T=(0,Z.jsxs)(`nav`,{"aria-label":y,className:b,children:[x,w]}),t[41]=w,t[42]=y,t[43]=b,t[44]=x,t[45]=T):T=t[45],T}function gT(e){return e.kind===`rule`}function _T(e){return e.kind===`field`}function vT(e){return e.kind===`section`}function yT(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=O_(n.label,r).map(bT),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)(M,{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 bT(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 xT(){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=fT(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:Y(`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)(J,{id:`_PACVa`}),(0,Z.jsx)(go,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=s):s=e[3],s}function ST(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=Y(`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)(J,{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:Y(`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 CT(){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)(J,{id:`GsBUCk`})}),n=(0,Z.jsx)(Ud,{className:`h-5 w-32`}),r=(0,Z.jsx)(Ud,{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)(Ud,{className:`h-9 w-full`}),(0,Z.jsx)(Ud,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function wT(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=Y(`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)(qS,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function TT(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)(ZS,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function ET(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({withHandle:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=Y(`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`,n),t[4]=n,t[5]=a);let o;t[6]===i?o=t[7]:(o=i&&(0,Z.jsx)(`div`,{className:`z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border`}),t[6]=i,t[7]=o);let s;return t[8]!==r||t[9]!==a||t[10]!==o?(s=(0,Z.jsx)(tC,{"data-slot":`resizable-handle`,className:a,...r,children:o}),t[8]=r,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}function DT(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}=mt(),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)(J,{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)(xc,{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)(No,{"aria-hidden":`true`}),t[28]=F):F=t[28];let I;t[29]!==o||t[30]!==p||t[31]!==P?(I=(0,Z.jsx)(rn,{asChild:!0,children:(0,Z.jsx)(Vr,{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)(an,{side:`bottom`,children:(0,Z.jsx)(J,{id:`-8PP0T`})}),t[33]=L):L=t[33];let R;t[34]===I?R=t[35]:(R=(0,Z.jsxs)(sn,{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)(Dg,{"aria-hidden":`true`}),t[38]=B):B=t[38];let V;t[39]!==m||t[40]!==z||t[41]!==s?(V=(0,Z.jsx)(rn,{asChild:!0,children:(0,Z.jsx)(Vr,{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)(an,{side:`bottom`,children:(0,Z.jsx)(J,{id:`_7UQ7y`})}),t[43]=H):H=t[43];let U;t[44]===V?U=t[45]:(U=(0,Z.jsxs)(sn,{children:[V,H]}),t[44]=V,t[45]=U);let ee;t[46]!==R||t[47]!==U?(ee=(0,Z.jsxs)(Dc,{align:`inline-end`,className:`gap-0.5`,children:[R,U]}),t[46]=R,t[47]=U,t[48]=ee):ee=t[48];let W;t[49]!==ee||t[50]!==N?(W=(0,Z.jsxs)(Oc,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[N,ee]}),t[49]=ee,t[50]=N,t[51]=W):W=t[51];let G;t[52]===w?G=t[53]:(G=(0,Z.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`min-w-14 px-1 text-right text-muted-foreground text-xs tabular-nums shrink-0`,children:w}),t[52]=w,t[53]=G);let K;t[54]===b?K=t[55]:(K=b({id:`oqB2ez`}),t[54]=b,t[55]=K);let te=!S,ne;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(Fr,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=ne):ne=t[56];let q;t[57]!==g||t[58]!==K||t[59]!==te?(q=(0,Z.jsx)(rn,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":K,disabled:te,onClick:g,children:ne})}),t[57]=g,t[58]=K,t[59]=te,t[60]=q):q=t[60];let re;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(an,{side:`bottom`,children:(0,Z.jsx)(J,{id:`oqB2ez`})}),t[61]=re):re=t[61];let ie;t[62]===q?ie=t[63]:(ie=(0,Z.jsxs)(sn,{children:[q,re]}),t[62]=q,t[63]=ie);let ae;t[64]===b?ae=t[65]:(ae=b({id:`SiUUCS`}),t[64]=b,t[65]=ae);let oe=!S,se;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(Io,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=se):se=t[66];let ce;t[67]!==h||t[68]!==ae||t[69]!==oe?(ce=(0,Z.jsx)(rn,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ae,disabled:oe,onClick:h,children:se})}),t[67]=h,t[68]=ae,t[69]=oe,t[70]=ce):ce=t[70];let le;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(an,{side:`bottom`,children:(0,Z.jsx)(J,{id:`SiUUCS`})}),t[71]=le):le=t[71];let ue;t[72]===ce?ue=t[73]:(ue=(0,Z.jsxs)(sn,{children:[ce,le]}),t[72]=ce,t[73]=ue);let de=a?`secondary`:`ghost`,fe;t[74]!==b||t[75]!==a?(fe=b(a?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=b,t[75]=a,t[76]=fe):fe=t[76];let pe=a?`ok-replace-input`:void 0,me;t[77]!==f||t[78]!==a?(me=()=>f(!a),t[77]=f,t[78]=a,t[79]=me):me=t[79];let he;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,Z.jsx)(ig,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=he):he=t[80];let ge;t[81]!==a||t[82]!==de||t[83]!==fe||t[84]!==pe||t[85]!==me?(ge=(0,Z.jsx)(rn,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:de,size:`icon-sm`,"aria-label":fe,"aria-expanded":a,"aria-controls":pe,onClick:me,children:he})}),t[81]=a,t[82]=de,t[83]=fe,t[84]=pe,t[85]=me,t[86]=ge):ge=t[86];let _e;t[87]===a?_e=t[88]:(_e=(0,Z.jsx)(an,{side:`bottom`,children:a?(0,Z.jsx)(J,{id:`UkQGhd`}):(0,Z.jsx)(J,{id:`1RluQD`})}),t[87]=a,t[88]=_e);let ve;t[89]!==ge||t[90]!==_e?(ve=(0,Z.jsxs)(sn,{children:[ge,_e]}),t[89]=ge,t[90]=_e,t[91]=ve):ve=t[91];let ye;t[92]!==b||t[93]!==O||t[94]!==S||t[95]!==v||t[96]!==_||t[97]!==d||t[98]!==a||t[99]!==i?(ye=a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-replace-input`,children:(0,Z.jsx)(J,{id:`fqSfXY`})}),(0,Z.jsx)(_l,{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)(sn,{children:[(0,Z.jsx)(rn,{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)(ig,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(an,{side:`bottom`,children:(0,Z.jsx)(J,{id:`bS_boY`})})]}),(0,Z.jsxs)(sn,{children:[(0,Z.jsx)(rn,{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)(rg,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(an,{side:`bottom`,children:(0,Z.jsx)(J,{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]=ye):ye=t[100];let be;t[101]===b?be=t[102]:(be=b({id:`wJo9oS`}),t[101]=b,t[102]=be);let xe;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Z.jsx)(ul,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=xe):xe=t[103];let Se;t[104]!==y||t[105]!==be?(Se=(0,Z.jsx)(rn,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":be,onClick:y,children:xe})}),t[104]=y,t[105]=be,t[106]=Se):Se=t[106];let Ce;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(an,{side:`bottom`,children:(0,Z.jsx)(J,{id:`yz7wBu`})}),t[107]=Ce):Ce=t[107];let we;t[108]===Se?we=t[109]:(we=(0,Z.jsxs)(sn,{children:[Se,Ce]}),t[108]=Se,t[109]=we);let Te;return t[110]!==W||t[111]!==G||t[112]!==ie||t[113]!==ue||t[114]!==k||t[115]!==ve||t[116]!==ye||t[117]!==we?(Te=(0,Z.jsxs)(`search`,{"data-testid":`find-replace-bar`,"aria-label":k,className:`pointer-events-auto flex max-w-[min(calc(100vw-1rem),720px)] touch-manipulation items-center gap-1 rounded-[calc(var(--radius)+2px)] border border-input bg-popover/95 p-1 text-popover-foreground shadow-md shadow-black/10 backdrop-blur`,children:[A,W,G,ie,ue,ve,ye,we]}),t[110]=W,t[111]=G,t[112]=ie,t[113]=ue,t[114]=k,t[115]=ve,t[116]=ye,t[117]=we,t[118]=Te):Te=t[118],Te}var OT={current:0,total:0},kT=120,AT=100;function jT(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?ut(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(ct,n,MT)}function MT(){return null}function NT(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,`
7
+ `,`
8
+ `).trim();return i.length===0||i.length>kT||i.includes(`
9
+ `)?null:i}function PT(e){let t=ee(e.state);return{current:t.matches.length===0?0:t.activeIndex+1,total:t.matches.length}}function FT(e,t){return e.current===t.current&&e.total===t.total}function IT(e,t,n){e&&!e.isDestroyed&&(e.commands.clearFindMatches(),e.commands.focus()),t(e=>({...e,open:!1,activeIndex:0})),n(OT)}function LT(e){!e||e.isDestroyed||typeof window>`u`||window.requestAnimationFrame(()=>{if(e.isDestroyed)return;let t=On(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 RT(e){let t=(0,$.c)(81),{activeDocName:n,isSourceMode:r}=e,i=jT(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)(OT),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{s.current!==n&&(s.current=n,d(BT))},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(zT)},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(OT);return}if(!u.open||r){i.commands.clearFindMatches(),p(OT);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=PT(i);p(t=>FT(t,e)?t:e)},AT);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=ee(i.state),t=PT(i);p(e=>FT(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=NT(i);d(n=>({...n,open:!0,replaceOpen:e,query:t??n.query,activeIndex:0}))},t=function(t){if(!(!n||r||t.defaultPrevented)){if(xl(t,`find`)){t.preventDefault(),u.open?IT(i,d,p):e(!1);return}if(xl(t,`replace`)){t.preventDefault(),e(!0);return}if(u.open){let e=xl(t,`find-next`),n=xl(t,`find-previous`);if(e||n){t.preventDefault(),(n?i?.commands.selectPreviousFindMatch():i?.commands.selectNextFindMatch())&&LT(i);return}}t.key===`Escape`&&u.open&&(t.preventDefault(),IT(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=ee(i.state),t=PT(i);p(e=>FT(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(){IT(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()&&LT(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()&&LT(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)&&LT(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)&&LT(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,G,K,te,ne;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(W=e=>d(t=>({...t,query:e,activeIndex:0})),G=e=>d(t=>({...t,replacement:e})),K=e=>d(t=>({...t,replaceOpen:e})),te=e=>d(t=>({...t,caseSensitive:e})),ne=e=>d(t=>({...t,wholeWord:e})),t[63]=W,t[64]=G,t[65]=K,t[66]=te,t[67]=ne):(W=t[63],G=t[64],K=t[65],te=t[66],ne=t[67]);let q;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?(q=(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)(DT,{findInputRef:a,query:u.query,replacement:u.replacement,replaceOpen:u.replaceOpen,caseSensitive:u.caseSensitive,wholeWord:u.wholeWord,current:f.current,total:f.total,onQueryChange:W,onReplacementChange:G,onReplaceOpenChange:K,onCaseSensitiveChange:te,onWholeWordChange:ne,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]=q):q=t[80],q}function zT(e){return{...e,open:!1,activeIndex:0}}function BT(e){return{...e,activeIndex:0}}var VT=300;function HT(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(Ed),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(Ed);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(Od(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,VT)};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 UT(e){return e&&e.document.getMap(`lifecycle`).get(`status`)===`conflict`?`conflict`:null}function WT(e){let t=(0,$.c)(8),{poolEntries:n}=Re(),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=()=>UT(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(UT(i));let t=()=>s(UT(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 GT(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=()=>kd(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2],(0,Q.useSyncExternalStore)(hd,r)}var KT=`ok-doc-panel-width-v1`;function qT(e){return Number.isFinite(e)?e<300?300:e>600?600:Math.round(e):320}function JT(e){try{let t=(e??localStorage).getItem(KT);if(t==null)return 320;let n=Number.parseInt(t,10);return Number.isFinite(n)?qT(n):320}catch{return 320}}function YT(e,t){try{(t??localStorage).setItem(KT,String(qT(e)))}catch{}}function XT(){try{return typeof localStorage>`u`?320:JT()}catch{return 320}}var ZT=1024,QT=1280,$T={left:ZT,right:QT};function eE(e,t,n){return e==null?t>=$T[n]?`above`:`below`:`embedded`}function tE(e){return e===`above`?`open`:`collapsed`}var nE=`ok-sidebar-pins-v2`;function rE(e){return e===`open`||e===`collapsed`}function iE(e){return e===`above`||e===`below`||e===`embedded`}function aE(e){if(typeof e!=`object`||!e)return!1;let t=e;for(let e of Object.keys(t))if(!iE(e)||!rE(t[e]))return!1;return!0}function oE(e){let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n=t,r={};return aE(n.left)&&(r.left=n.left),aE(n.right)&&(r.right=n.right),r}function sE(e){try{let t=(e??localStorage).getItem(nE);return t==null?{}:oE(t)}catch{return{}}}function cE(e,t){try{t.setItem(nE,JSON.stringify(e))}catch{}}function lE(e,t,n){return n[e]?.[t]??tE(t)}function uE(e,t,n,r){let i=r??localStorage,a=sE(i);return a[e]={...a[e],[t]:n},cE(a,i),a}var dE=`ok-terminal-width-v1`;function fE(e){return Number.isFinite(e)?e<320?320:Math.round(e):480}function pE(e){try{let t=(e??localStorage).getItem(dE);if(t==null)return 480;let n=Number.parseInt(t,10);return Number.isFinite(n)?fE(n):480}catch{return 480}}function mE(e,t){try{(t??localStorage).setItem(dE,String(fE(e)))}catch{}}function hE(){try{return typeof localStorage>`u`?480:pE()}catch{return 480}}function gE(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`?_E: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 _E(e){return e===`synced`?`synced`:`connected`}function vE(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(t+1):e}function yE(e){let t=(0,$.c)(21),{path:n,onRemove:r}=e,{_:i}=mt(),a,o;t[0]!==i||t[1]!==n?(a=vE(n),o=i({id:`hnq8fP`,values:{label:a}}),t[0]=i,t[1]=n,t[2]=a,t[3]=o):(a=t[2],o=t[3]);let s=o,c=`composer-context-chip-file-${n}`,l;t[4]===r?l=t[5]:(l=e=>{(e.key===`Backspace`||e.key===`Delete`)&&(e.preventDefault(),r())},t[4]=r,t[5]=l);let u;t[6]===n?u=t[7]:(u=(0,Z.jsx)(`span`,{className:`absolute top-1/2 left-1/2 inline-flex 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`,children:(0,Z.jsx)(O,{path:n,className:`size-3`,showExtensionBadge:!1})}),t[6]=n,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(ul,{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}),t[8]=d):d=t[8];let f;t[9]!==r||t[10]!==s||t[11]!==l||t[12]!==u?(f=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":s,onClick:r,onKeyDown:l,className:`group/remove relative size-3.5 shrink-0 rounded-sm text-muted-foreground/80 hover:text-foreground`,children:[u,d]}),t[9]=r,t[10]=s,t[11]=l,t[12]=u,t[13]=f):f=t[13];let p;t[14]===a?p=t[15]:(p=(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:a}),t[14]=a,t[15]=p);let m;return t[16]!==n||t[17]!==c||t[18]!==f||t[19]!==p?(m=(0,Z.jsxs)(`span`,{"data-testid":c,title:n,className:`group/chip inline-flex max-w-[14rem] items-center gap-1 rounded-md border bg-muted/40 py-0.5 pr-1.5 pl-1 text-muted-foreground text-xs`,children:[f,p]}),t[16]=n,t[17]=c,t[18]=f,t[19]=p,t[20]=m):m=t[20],m}function bE(e){let t=(0,$.c)(11),{files:n,onRemoveFile:r,className:i,children:a}=e;if(n.length===0&&a==null)return null;let o;t[0]===i?o=t[1]:(o=Y(`flex flex-wrap items-center gap-1`,i),t[0]=i,t[1]=o);let s;if(t[2]!==n||t[3]!==r){let e;t[5]===r?e=t[6]:(e=e=>(0,Z.jsx)(yE,{path:e,onRemove:()=>r(e)},e),t[5]=r,t[6]=e),s=n.map(e),t[2]=n,t[3]=r,t[4]=s}else s=t[4];let c;return t[7]!==a||t[8]!==o||t[9]!==s?(c=(0,Z.jsxs)(`div`,{className:o,"data-testid":`composer-context-chips`,children:[s,a]}),t[7]=a,t[8]=o,t[9]=s,t[10]=c):c=t[10],c}function xE(e){let t=(0,$.c)(52),{primary:n,onPrimary:r,primaryDisabled:i,installedTargets:a,selectedTargetId:o,onSelectTarget:s,threadAgents:c,onOpenSettings:l,terminal:u,terminals:d,menuEmptyState:f,onMenuOpenChange:p,menuAlign:m,triggerAriaLabel:h,testIds:g}=e,_=i===void 0?!1:i,v=m===void 0?`end`:m,{_:y}=mt(),b=a.length>0,x=d&&d.length>0?d:null,S=x!=null||u!=null,C=b||S,w=c!==void 0&&c.length>0,T;t[0]===g?T=t[1]:(T=e=>typeof g.terminal==`function`?g.terminal(e):g.terminal,t[0]=g,t[1]=T);let E=T,D;t[2]!==r||t[3]!==n||t[4]!==_||t[5]!==g.primary?(D=(0,Z.jsx)(X,{type:`button`,variant:`outline`,className:`gap-1.5`,disabled:_,onClick:r,"data-testid":g.primary,children:n}),t[2]=r,t[3]=n,t[4]=_,t[5]=g.primary,t[6]=D):D=t[6];let O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(Io,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),t[7]=O):O=t[7];let k;t[8]!==g.trigger||t[9]!==h?(k=(0,Z.jsx)(Er,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`icon`,"aria-label":h,"data-testid":g.trigger,children:O})}),t[8]=g.trigger,t[9]=h,t[10]=k):k=t[10];let A;t[11]!==y||t[12]!==C||t[13]!==w||t[14]!==g||t[15]!==c?(A=w?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Tr,{"aria-label":y({id:`vPKX2i`}),children:[(0,Z.jsxs)(Or,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(J,{id:`RXEbZy`}),(0,Z.jsx)($r,{})]}),c?.map(e=>(0,Z.jsxs)(Sr,{onSelect:e.onSelect,"data-testid":g.threadAgent?.(e.key),children:[(0,Z.jsx)(vo,{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)(Po,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.key))]}),C?(0,Z.jsx)(Nr,{}):null]}):null,t[11]=y,t[12]=C,t[13]=w,t[14]=g,t[15]=c,t[16]=A):A=t[16];let j;t[17]!==y||t[18]!==x||t[19]!==C||t[20]!==a||t[21]!==s||t[22]!==o||t[23]!==b||t[24]!==S||t[25]!==u||t[26]!==E||t[27]!==g?(j=C?(0,Z.jsxs)(Z.Fragment,{children:[S?(0,Z.jsxs)(Tr,{"aria-label":y({id:`ALhMYW`}),children:[(0,Z.jsx)(Or,{children:(0,Z.jsx)(J,{id:`ALhMYW`})}),x?x.map(e=>(0,Z.jsxs)(Sr,{onSelect:e.onSelect,"data-testid":E(e.cli),"aria-label":e.ariaLabel,children:[(0,Z.jsx)(Zr,{id:Gr(e.cli),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.label}),e.selected?(0,Z.jsx)(Po,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.cli)):u?(0,Z.jsxs)(Sr,{onSelect:u.onSelect,"data-testid":E(`claude`),"aria-label":y({id:`AcK_r0`}),children:[(0,Z.jsx)(Zr,{id:Gr(`claude`),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`fcgvCA`})}),u.selected?(0,Z.jsx)(Po,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]}):null]}):null,b?(0,Z.jsxs)(Z.Fragment,{children:[S?(0,Z.jsx)(Nr,{}):null,(0,Z.jsxs)(Tr,{"aria-label":y({id:`BBqGS9`}),children:[(0,Z.jsx)(Or,{children:(0,Z.jsx)(J,{id:`BBqGS9`})}),a.map(e=>(0,Z.jsxs)(Sr,{onSelect:()=>s(e),"data-testid":g.option(e.id),children:[(0,Z.jsx)(Zr,{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)(Po,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null]}):null,t[17]=y,t[18]=x,t[19]=C,t[20]=a,t[21]=s,t[22]=o,t[23]=b,t[24]=S,t[25]=u,t[26]=E,t[27]=g,t[28]=j):j=t[28];let M=!w&&!C?f:null,N;t[29]!==C||t[30]!==w?(N=w||C?(0,Z.jsx)(Nr,{}):null,t[29]=C,t[30]=w,t[31]=N):N=t[31];let P;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(rl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}),t[32]=P):P=t[32];let F;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`jRAGrQ`})}),t[33]=F):F=t[33];let I;t[34]!==l||t[35]!==g.settings?(I=(0,Z.jsxs)(Sr,{onSelect:l,"data-testid":g.settings,children:[P,F]}),t[34]=l,t[35]=g.settings,t[36]=I):I=t[36];let L;t[37]!==v||t[38]!==N||t[39]!==I||t[40]!==A||t[41]!==j||t[42]!==M||t[43]!==g.menu?(L=(0,Z.jsxs)(Ar,{align:v,className:`max-h-80 min-w-[200px]`,"data-testid":g.menu,children:[A,j,M,N,I]}),t[37]=v,t[38]=N,t[39]=I,t[40]=A,t[41]=j,t[42]=M,t[43]=g.menu,t[44]=L):L=t[44];let R;t[45]!==p||t[46]!==L||t[47]!==k?(R=(0,Z.jsxs)(Mr,{modal:!1,onOpenChange:p,children:[k,L]}),t[45]=p,t[46]=L,t[47]=k,t[48]=R):R=t[48];let z;return t[49]!==R||t[50]!==D?(z=(0,Z.jsxs)(of,{children:[D,R]}),t[49]=R,t[50]=D,t[51]=z):z=t[51],z}var SE=`ok-onboarding-card-v1`,CE={initialized:!1,steps:{file:!1,askedAi:!1},fileBaseline:0,dismissed:!1,completed:!1};function wE(e){return e===!0}function TE(e){if(typeof e!=`object`||!e)return CE;let t=e,n=typeof t.steps==`object`&&t.steps!==null?t.steps:{};return{initialized:wE(t.initialized),steps:{file:wE(n.file),askedAi:wE(n.askedAi)},fileBaseline:typeof t.fileBaseline==`number`&&Number.isFinite(t.fileBaseline)&&t.fileBaseline>=0?t.fileBaseline:0,dismissed:wE(t.dismissed),completed:wE(t.completed)}}function EE(e){try{let t=(e??localStorage).getItem(SE);return t==null?CE:TE(JSON.parse(t))}catch(e){return console.warn(`[onboarding-card-store] readPersistedState failed (corrupt/privacy/SSR)`,e),CE}}function DE(e,t){try{(t??localStorage).setItem(SE,JSON.stringify(e))}catch(e){console.warn(`[onboarding-card-store] writePersistedState failed (quota/privacy/SSR)`,e)}}function OE(e){let t=EE(e),n=new Set,r=!1;function i(){for(let e of n)e()}function a(n){t=n,DE(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=EE(e),i())}}}var kE=OE();function AE(e){let t=e===void 0?kE:e;return(0,Q.useSyncExternalStore)(t.subscribe,t.getSnapshot,t.getSnapshot)}function jE(){kE.install()}function ME(e){return Pl(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}async function NE(){let e=await fetch(`/api/documents`);if(!e.ok)throw Error(`documents request failed: ${e.status}`);let t=await e.json(),n=ka.safeParse(t);if(!n.success)throw Error(`documents response did not match schema`,{cause:n.error});return ME(n.data.documents)}async function PE(e=kE){let t=e.getSnapshot();if(!(t.steps.file||!t.initialized))try{await NE()>t.fileBaseline&&e.markStepComplete(`file`)}catch(e){console.warn(`[onboarding-signals] file-step count read failed; leaving step incomplete`,e)}}function FE(e=kE){e.getSnapshot().initialized&&e.markStepComplete(`askedAi`)}var IE=5200,LE=500,RE=/\.(md|mdx)$/i;function zE(e,t){return RE.test(e)?e:t?`${e}${t}`:Zs(e)}function BE(e){return RE.test(e)?e.replace(RE,``):null}function VE(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function HE(){let e=(0,$.c)(2),[t,n]=(0,Q.useState)(UE),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`);n(e.matches);let t=e=>n(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i),t}function UE(){return typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function WE(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),IE);return()=>clearTimeout(e)}let e=setTimeout(()=>{i(GE),o(!0)},LE);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 GE(e){return e+1}function KE(e){let t=(0,$.c)(2),{agentName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(J,{id:`5PrrYw`,values:{agentName:n}}),t[0]=n,t[1]=r),r}function qE(e){let t=(0,$.c)(104),{docName:n,surface:r,folderPath:i,dismissed:a,onDismiss:o,onReopen:s}=e,c=a===void 0?!1:a,{_:l}=mt(),u=i!==void 0,d=u?null:n??null,f=r??`wysiwyg`,p=HE(),m=sd(),{pageMeta:h}=Bo(),{states:g}=es(),_=Jr(),{dispatch:v}=Jo(),y=Yo(),[b]=(0,Q.useState)(aD),[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)(iD),A,M;t[0]!==c||t[1]!==n||t[2]!==u||t[3]!==r?(A=()=>{if(u||n==null)return;let e=document.documentElement,t=nD,i=()=>{r===`wysiwyg`&&requestAnimationFrame(()=>{let e=ut(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`)}},M=[c,r,n,u],t[0]=c,t[1]=n,t[2]=u,t[3]=r,t[4]=A,t[5]=M):(A=t[4],M=t[5]),(0,Q.useEffect)(A,M);let N=(0,Q.useRef)(c),P=(0,Q.useRef)(s),F;t[6]!==c||t[7]!==s?(F=()=>{N.current=c,P.current=s},t[6]=c,t[7]=s,t[8]=F):F=t[8],(0,Q.useEffect)(F);let I,L;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>j(()=>{N.current?P.current?.():D.current?.focus()}),L=[],t[9]=I,t[10]=L):(I=t[9],L=t[10]),(0,Q.useEffect)(I,L);let R;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(R=[],t[11]=R):R=t[11],(0,Q.useEffect)(eD,R);let z=(0,Q.useRef)(c),B,V;t[12]===c?(B=t[13],V=t[14]):(B=()=>{let e=z.current;z.current=c,e&&!c&&D.current?.focus()},V=[c],t[12]=c,t[13]=B,t[14]=V),(0,Q.useEffect)(B,V);let H;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(H=[],t[15]=H):H=t[15];let[U,ee]=(0,Q.useState)(H),[W,G]=(0,Q.useState)($E),K;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(K=[],t[16]=K):K=t[16];let[te,ne]=(0,Q.useState)(K),q;t[17]!==n||t[18]!==u||t[19]!==h?(q=u||n==null?``:zE(n,h.get(n)?.docExt),t[17]=n,t[18]=u,t[19]=h,t[20]=q):q=t[20];let re=q,ie,ae;t[21]!==re||t[22]!==W||t[23]!==u||t[24]!==C?(ie=()=>{u||C||ee(e=>{if(W.has(re))return e;let t=BE(re),n=t===null?e:e.filter(e=>e===re||BE(e)!==t);return n.includes(re)?n.length===e.length?e:n:[...n,re]})},ae=[u,C,re,W],t[21]=re,t[22]=W,t[23]=u,t[24]=C,t[25]=ie,t[26]=ae):(ie=t[25],ae=t[26]),(0,Q.useEffect)(ie,ae);let oe=u?i&&!W.has(i)&&!te.includes(i)?[i]:[]:U.filter(e=>!W.has(e)&&!te.includes(e)),se=Eo(d,f),ce=Eo(d,`frontmatter`),[le,ue]=(0,Q.useState)(null),[de,fe]=(0,Q.useState)(!1),pe,me;t[27]===se?(pe=t[28],me=t[29]):(pe=()=>{se&&ue(se)},me=[se],t[27]=se,t[28]=pe,t[29]=me),(0,Q.useEffect)(pe,me);let he,ge;t[30]===ce?(he=t[31],ge=t[32]):(he=()=>{ce&&ue(ce)},ge=[ce],t[30]=ce,t[31]=he,t[32]=ge),(0,Q.useEffect)(he,ge);let _e=Wr(),ve=Ur(),ye;t[33]===_?ye=t[34]:(ye=e=>Xr(_,e.source,e.id,!0,e.supported),t[33]=_,t[34]=ye);let be=ve.filter(ye),xe=ni(be,_e),Se;t[35]===y?.installedClis?Se=t[36]:(Se=y?.installedClis??{},t[35]=y?.installedClis,t[36]=Se);let Ce=Hc({sticky:x??b,effectiveThreadAgent:xe,enabledClis:y===null?[]:Cc(_,y.installedClis),enabledDesktopTargets:Uc(_),installedClis:Se,terminalAvailable:y!==null,threadsAvailable:!0,desktopSelectable:!0}),we=Ce.kind===`thread`,Te=Ce.kind===`cli`?Ce.cli:null,Ee=Te!==null,De=Ce.kind===`desktop`?Yr.find(e=>e.id===Ce.target)??null:null,Oe=!T&&(!C||le!==null)&&(Ee||De!==null||we),ke;t[37]===_?ke=t[38]:(ke=Yr.filter(e=>ei(_,e.id)),t[37]=_,t[38]=ke);let Ae=ke,je;t[39]===g?je=t[40]:(je=Yr.some(e=>g[e.id]?.installed==null),t[39]=g,t[40]=je);let Me=je,Ne=y===null?void 0:Cc(_,y.installedClis).map(e=>{let{displayName:t}=Gi[e];return{cli:e,label:t,ariaLabel:l({id:`QYfQdv`,values:{displayName:t}}),selected:Te===e,onSelect:()=>He(e)}}),Pe;t[41]===l?Pe=t[42]:(Pe=l({id:`KYSocE`}),t[41]=l,t[42]=Pe);let Fe;t[43]===l?Fe=t[44]:(Fe=l({id:`7Ongq0`}),t[43]=l,t[44]=Fe);let Ie;t[45]===l?Ie=t[46]:(Ie=l({id:`HPTPGr`}),t[45]=l,t[46]=Ie);let Le;t[47]===l?Le=t[48]:(Le=l({id:`qiRoLb`}),t[47]=l,t[48]=Le);let Re;t[49]!==Pe||t[50]!==Fe||t[51]!==Ie||t[52]!==Le?(Re=[Pe,Fe,Ie,Le],t[49]=Pe,t[50]=Fe,t[51]=Ie,t[52]=Le,t[53]=Re):Re=t[53];let ze=WE(Re,!p&&C&&!c),Be;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(Be=e=>{S(e.id),Vc(e.id)},t[54]=Be):Be=t[54];let Ve=Be,He=e=>{let t=bc(e);S(t),Vc(t)},Ue;if(t[55]===Symbol.for(`react.memo_cache_sentinel`)){let e=()=>{S(yc),Vc(yc)};Ue=t=>{Kr(t),e()},t[55]=Ue}else Ue=t[55];let We=Ue,Ge=()=>{D.current?.clear(),ue(null),fe(!1),ee([]),G(new Set),CC()},Ke=e=>{if(e===null){dl.error(l({id:`y8B54M`}));return}if(we){us(e,xe===null?void 0:{agent:{source:xe.source,id:xe.id}}),FE(),Ge();return}if(Te!==null&&y!==null){try{y.launchInTerminal(e,Te)}catch{dl.error(l({id:`jBVUXo`}));return}FE(),Ge();return}if(De!==null){if(g[De.id]?.installed!==!0){cs(De),dl.info(l({id:`L1BQTH`,values:{0:De.displayName}})),Ge();return}E(!0),v(De.id,e).then(QE).finally(()=>{E(!1),Ge()})}},qe=()=>{let{instruction:e,mentions:t}=D.current?.getContent()??{instruction:``,mentions:[]};if(u)return ss({docName:null,folderRelativePath:i,workspace:m,instruction:e,mentions:[...new Set([...oe,...t])].filter(e=>e!==i)});let r=le?cd(le):void 0,a=le?.docName??null,o=le?a:oe.includes(re)?n??null:null,s=o===null?null:zE(o,h.get(o)?.docExt),c=[...new Set([...oe,...t])].filter(e=>e!==s);return ss({docName:o,...s===null?{}:{docRelativePath:s},workspace:m,instruction:e,mentions:c,selection:r})},Je=()=>{Oe&&Ke(qe())};if(c)return null;let Ye=``,Xe=``;if(le){let e;t[56]!==h||t[57]!==le?(e=ld(le,zE(le.docName,h.get(le.docName)?.docExt).split(`/`).pop()??``),t[56]=h,t[57]=le,t[58]=e):e=t[58],Ye=e;let n;t[59]===le.markdown?n=t[60]:(n=ud(le.markdown),t[59]=le.markdown,t[60]=n),Xe=n}let Ze;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=e=>cf(e,D),t[61]=Ze):Ze=t[61];let Qe;t[62]!==l||t[63]!==u||t[64]!==o?(Qe=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)(Io,{className:`size-3.5`,"aria-hidden":!0})}),t[62]=l,t[63]=u,t[64]=o,t[65]=Qe):Qe=t[65];let $e;t[66]===Symbol.for(`react.memo_cache_sentinel`)?($e=e=>G(t=>{let n=new Set(t);return n.add(e),n}),t[66]=$e):$e=t[66];let et;t[67]!==l||t[68]!==Ye||t[69]!==Xe||t[70]!==le||t[71]!==de?(et=le?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-testid":`composer-selection-pill`,title:Ye,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:()=>{ue(null),fe(!1)},className:`group/remove relative size-3.5 shrink-0 rounded-sm text-muted-foreground/80 hover:text-foreground`,children:[(0,Z.jsx)(bg,{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)(ul,{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":de,"aria-label":l(de?{id:`UaDyeb`}:{id:`eTL5y9`}),onClick:()=>fe(ZE),"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:Ye})})]}),de&&Xe!==``?(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:Xe}):null]}):null,t[67]=l,t[68]=Ye,t[69]=Xe,t[70]=le,t[71]=de,t[72]=et):et=t[72];let tt;t[73]===l?tt=t[74]:(tt=l({id:`xWEvuo`}),t[73]=l,t[74]=tt);let nt;t[75]!==C||t[76]!==p||t[77]!==ze?(nt=C?(0,Z.jsx)(`div`,{"aria-hidden":!0,className:Y(`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`,ze.visible?`opacity-100`:`opacity-0`),children:ze.text}):null,t[75]=C,t[76]=p,t[77]=ze,t[78]=nt):nt=t[78];let rt=xE,it=we?(0,Z.jsx)(vo,{agentId:xe?.id??``,iconUrl:xe?.iconUrl,className:`size-4`}):Te===null?De?(0,Z.jsx)(Zr,{id:De.id,className:`size-4`,"aria-hidden":!0}):null:(0,Z.jsx)(Zr,{id:Gr(Te),className:`size-4`,"aria-hidden":!0}),at=we?xe===null?(0,Z.jsx)(J,{id:`G7bn_N`}):(0,Z.jsx)(KE,{agentName:xe.name}):Te===null?De?(0,Z.jsx)(J,{id:`nUNZL4`,values:{0:De.displayName}}):(0,Z.jsx)(J,{id:`F-vBv0`}):(0,Z.jsx)(J,{id:`ti6aF_`,values:{0:Gi[Te].displayName}}),ot;t[79]===at?ot=t[80]:(ot=(0,Z.jsx)(`span`,{children:at}),t[79]=at,t[80]=ot);let st;t[81]===T?st=t[82]:(st=T?(0,Z.jsx)(Gc,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,t[81]=T,t[82]=st);let ct;t[83]!==it||t[84]!==ot||t[85]!==st?(ct=(0,Z.jsxs)(Z.Fragment,{children:[it,ot,st]}),t[83]=it,t[84]=ot,t[85]=st,t[86]=ct):ct=t[86];let lt=!Oe,dt=Ee?null:De?.id??null,ft=be.map(e=>({key:`${e.source}:${e.id}`,id:e.id,name:e.name,...e.iconUrl===void 0?{}:{iconUrl:e.iconUrl},selected:we&&xe!==null&&xe.source===e.source&&xe.id===e.id,onSelect:()=>We(e)})),pt;t[87]===Me?pt=t[88]:(pt=(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:Me?(0,Z.jsx)(J,{id:`CPmYSG`}):(0,Z.jsx)(J,{id:`t9Qn8y`})}),t[87]=Me,t[88]=pt);let ht;t[89]===l?ht=t[90]:(ht=l({id:`nskygk`}),t[89]=l,t[90]=ht);let gt;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(gt={primary:`ask-ai-send`,trigger:`ask-ai-agent-trigger`,menu:`ask-ai-agent-menu`,option:XE,threadAgent:YE,settings:`ask-ai-agent-option-settings`,terminal:JE},t[91]=gt):gt=t[91];let _t;t[92]!==rt||t[93]!==Ne||t[94]!==Ae||t[95]!==Ve||t[96]!==Je||t[97]!==ct||t[98]!==lt||t[99]!==dt||t[100]!==ft||t[101]!==pt||t[102]!==ht?(_t=(0,Z.jsx)(rt,{primary:ct,onPrimary:Je,primaryDisabled:lt,installedTargets:Ae,selectedTargetId:dt,onSelectTarget:Ve,threadAgents:ft,onOpenSettings:Cl,terminals:Ne,menuEmptyState:pt,triggerAriaLabel:ht,testIds:gt}),t[92]=rt,t[93]=Ne,t[94]=Ae,t[95]=Ve,t[96]=Je,t[97]=ct,t[98]=lt,t[99]=dt,t[100]=ft,t[101]=pt,t[102]=ht,t[103]=_t):_t=t[103];let vt=(0,Z.jsxs)(`div`,{ref:O,onMouseDown:Ze,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:[Qe,(0,Z.jsx)(bE,{files:oe,onRemoveFile:$e,children:et}),(0,Z.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[(0,Z.jsx)(HC,{ref:D,ariaLabel:tt,onEmptyChange:w,onContentChange:SC,onMentionsChange:ne,onSubmit:Je,initialDoc:k,className:`max-h-[200px] overflow-y-auto text-base md:text-sm`}),nt]}),_t]})]});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:vt})}):(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:vt})}function JE(e){return e===`claude`?`ask-ai-agent-option-terminal`:`ask-ai-agent-option-terminal-${e}`}function YE(e){return`ask-ai-agent-option-thread-${e}`}function XE(e){return`ask-ai-agent-option-${e}`}function ZE(e){return!e}function QE(e){e.ok&&FE()}function $E(){return new Set}function eD(){let e=tD;return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})}function tD(e){xl(e,`open-ask-ai`)&&(VE(e.target)||(e.preventDefault(),k()))}function nD(){let e=[...document.querySelectorAll(`.editor-doc-scroll`)].filter(rD);if(e.length===0)return;let t=!1,n=()=>{t=!0};window.addEventListener(`wheel`,n,{passive:!0}),window.addEventListener(`touchstart`,n,{passive:!0});let r=performance.now(),i=()=>{if(t||performance.now()-r>=300){window.removeEventListener(`wheel`,n),window.removeEventListener(`touchstart`,n);return}for(let t of e)t.scrollTop=t.scrollHeight-t.clientHeight;requestAnimationFrame(i)};requestAnimationFrame(i)}function rD(e){let t=e.scrollHeight-e.clientHeight;return t>0&&e.scrollTop>=t-40}function iD(){return xC().doc??void 0}function aD(){return gc()}function oD(e){return!e.terminalVisible&&!e.isEmbedded&&e.activeDocName!==null}function sD(e){return!e.terminalVisible&&!e.isEmbedded}function cD(e,t={}){let n=F(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var lD=200,uD=`Outside any block`;function dD(e){let t=(0,$.c)(5),{editor:n}=e,r=lt(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?fD(n,r):o.current?uD:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},lD),()=>{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 fD(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=cD(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=cD(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 pD=!1;function mD(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{iu(n,{durationMs:Math.round(e*1e3)/1e3,threw:!o,...i},{startTime:t,duration:e})}catch{}}}}function hD(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 gD=0,_D=0,vD=0,yD=0,bD=null,xD=[`linkResolutionDecoration$`],SD=new WeakSet,CD=new WeakSet;function wD(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}function TD(){return!1}function ED(){return!TD()}function DD(e,t){if(ED())return t;let n=`ok/cold/nodeview-factory-${wD(e)}`;return function(...r){let i=performance.now();try{return t(...r)}finally{let t=performance.now()-i;iu(n,{nodeType:e,durationMs:Math.round(t*1e3)/1e3},{startTime:i,duration:t})}}}function OD(e){if(ED())return;let t=e.state.plugins;for(let e of t){if(CD.has(e))continue;let t=e.spec?.key?.key;if(!t||!xD.some(e=>t.startsWith(e)))continue;let n=e.props,r=n.decorations;if(typeof r!=`function`){CD.add(e);continue}let i=`ok/cold/decoration-${wD(t.replace(/\$\d*$/,``))}`;n.decorations=function(...e){let n=performance.now();try{return r.apply(this,e)}finally{let e=performance.now()-n;iu(i,{pluginKey:t,durationMs:Math.round(e*1e3)/1e3},{startTime:n,duration:e})}},CD.add(e)}}function kD(e){if(ED())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=DD(e,n);r.__okWrapped=!0,t[e]=r}}function AD(e){return ED()?e:e.map(e=>{let t=e.name??`unknown`,n=wD(t);return e.extend({onBeforeCreate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;iu(`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;iu(`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;iu(`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;iu(`ok/cold/ext-${n}-on-destroy`,{ext:t,hook:`onDestroy`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}}})})}function jD(){if(!pD){pD=!0,mD(hi.prototype,`mount`,`ok/cold/editor-mount`,(e,t,n,r)=>{let i=e;return ED()||(bD=performance.now()),{elementDefault:i.options?.element?.nodeName??null,docSize:hD(i.editorState),durationMs:r}}),mD(hi.prototype,`createView`,`ok/cold/editor-create-view`,e=>{let t=e;return!ED()&&!SD.has(e)&&t.view&&(OD(t.view),kD(t.view),SD.add(e)),{docSize:hD(t.editorState)}}),mD(hi.prototype,`createNodeViews`,`ok/cold/create-node-views`,(e,t,n,r)=>{yD+=1;let i=e;return!ED()&&i.view&&kD(i.view),{docSize:hD(i.view),seq:yD,durationMs:r}}),mD(la.prototype,`updateState`,`ok/cold/pm-update-state`,(e,t,n,r)=>(_D+=1,{seq:_D,docSize:hD(e.state),durationMs:r})),mD(la.prototype,`setProps`,`ok/cold/pm-set-props`,(e,t,n,r)=>(vD+=1,{seq:vD,docSize:hD(e.state),durationMs:r})),mD(Te.prototype,`_forceRerender`,`ok/cold/force-rerender`,(e,t,n,r)=>{gD+=1;let i=e,a=(()=>{try{return i.type?.toArray?i.type.toArray().length:null}catch{return null}})();return{seq:gD,topLevelYElements:a,durationMs:r}}),mD(An.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`)&&(iu(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}),!ED()&&e===`first-paint`&&bD!==null)){let e=bD,n=Math.max(0,t.startTime-e);iu(`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}),bD=null}}}).observe({type:`paint`,buffered:!0})}catch{}globalThis.__okColdMountInstrumented=!0}}function MD(){let[e]=(0,Q.useState)(Ga);return e}function ND({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:Xi(e.display_name),color:Ea(e.id,Ei),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:Ea(e.id,Ei),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function PD(e,t){return e>t}function FD(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 ID=3,LD=6e4;function RD(e,t){let n=0;for(let r of e)t-r<LD&&(n+=1);return n<ID}var zD=new Map;function BD(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 VD(e){let t=it.getState(e);return t?.snapshot!=null||t?.prevSnapshot!=null}function HD(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=it.getState(e)?.binding;if(!t)return;if(typeof t._prosemirrorChanged!=`function`){iu.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=>{PD(i,a)||r(e)}},f=()=>{if(c=!1,!s||o||!PD(i,a)||l!==null&&VD(l.state))return;o=!0;let e=Date.now();for(let[t,n]of zD)n.every(t=>e-t>=LD)&&zD.delete(t);let t=(zD.get(n)??[]).filter(t=>e-t<LD);if(!RD(t,e)){zD.set(n,t),iu.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),zD.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,iu.count(`ok/editor/binding-wedge-recovery-error`,{docName:n}),console.error(`[binding-staleness-guard] wedge recovery threw for "${n}":`,e)}},p=e=>{e.origin!==it&&BD(e,t)&&(i+=1,c||(c=!0,queueMicrotask(f)))};return new ba({state:{init:()=>null,apply:e=>(FD(e.getMeta(it))&&(a=i,o&&iu.count(`ok/editor/binding-wedge-recovered`,{docName:n}),o=!1),null)},filterTransaction:(e,t)=>!PD(i,a)||VD(t)?!0:e.getMeta(it)!==void 0,view:e=>{let r=t.doc;return r==null?(iu.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 UD(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 WD=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&&Yi(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(Yn(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(ir(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Qn(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(rr(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Xn(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push($n(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(er(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(nr(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=Si(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof li){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 $a){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():UD(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&Zn(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()}},GD=e=>new ba({key:typeof e.pluginKey==`string`?new Za(e.pluginKey):e.pluginKey,view:t=>new WD({view:t,...e})});no.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[GD({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 KD=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 Wi(e,{textSerializers:ao(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Yn(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(ir(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Qn(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(rr(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Xn(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push($n(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(er(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(nr(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=Si(this.view,e.from,e.to);Zn({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()}},qD=e=>new ba({key:typeof e.pluginKey==`string`?new Za(e.pluginKey):e.pluginKey,view:t=>new KD({view:t,...e})});no.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?[qD({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 JD(e,t){return e??new Za(t)}var YD=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,XD=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),ZD=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(`.`)),QD=new Set([`children`,`className`,`style`]),$D=new Set([`tabIndex`]),eO=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),tO={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function nO(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function rO(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function iO(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||eO.has(e)}function aO(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function oO(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:tO[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function sO(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 cO(e){return $D.has(e)}function lO(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function uO(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 dO(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||ZD.has(e)?String(t):`${t}px`}function fO(e,t){XD.has(t)||e.style.removeProperty(aO(t))}function pO(e,t,n){XD.has(t)||e.style.setProperty(aO(t),dO(t,n))}function mO(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(QD.has(r)||!iO(r)||nO(r,t[r])||nO(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=rO(r);if(a==null||a===!1){cO(r)&&uO(e,r),e.removeAttribute(o);return}if(a===!0){cO(r)&&lO(e,r,!0),e.setAttribute(o,``);return}if(cO(r)){lO(e,r,a);return}e.setAttribute(o,String(a))})}function hO(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function gO(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){fO(e,t);return}pO(e,t,a)}})}function _O(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(!nO(t,n))return;let{eventName:i,options:a}=oO(t),o=t=>{n(sO(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function vO(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);YD(()=>{let i=n.current;return hO(e,i.className,t.className),gO(e,i.style,t.style),mO(e,i,t),r.current=_O(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 yO=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)(JD(e,`bubbleMenu`)).current;vO(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=vn(),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=GD({...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,Kw.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)(JD(e,`floatingMenu`)).current;vO(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=vn(),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=qD({...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,Kw.createPortal)(s,u.current)});var bO=[{name:`paragraph`,label:`Text`,icon:$h,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:De,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:qe,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:ze,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:re,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:`Ordered List`,icon:R,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:se,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:w,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:ug,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock({language:`js`}).run()}];function xO(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:SO},t[0]=n,t[1]=r);let{current:i,activeStates:a}=Wn(r),o=i.icon,s;t[2]===o?s=t[3]:(s=(0,Z.jsx)(o,{className:`size-3.5`}),t[2]=o,t[3]=s);let c;t[4]===i.label?c=t[5]:(c=(0,Z.jsx)(`span`,{children:i.label}),t[4]=i.label,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Io,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(Er,{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:[s,c,l]})}),t[7]=s,t[8]=c,t[9]=u):u=t[9];let d;t[10]!==a||t[11]!==n?(d=bO.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(Sr,{className:r?`bg-accent text-accent-foreground`:``,onSelect:()=>{e.command(n)},children:[(0,Z.jsx)(t,{className:`size-4`}),(0,Z.jsx)(`span`,{children:e.label})]},e.name)}),t[10]=a,t[11]=n,t[12]=d):d=t[12];let f;t[13]===d?f=t[14]:(f=(0,Z.jsx)(Ar,{align:`start`,sideOffset:8,className:`w-44 max-h-(--radix-dropdown-menu-content-available-height) overflow-y-auto subtle-scrollbar`,children:d}),t[13]=d,t[14]=f);let p;return t[15]!==u||t[16]!==f?(p=(0,Z.jsxs)(Mr,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function SO(e){let t=Object.fromEntries(bO.map(t=>[t.name,t.isActive(e.editor)]));return{current:bO.find(e=>t[e.name])??bO[0],activeStates:t}}var CO=`0 2px 4px rgba(0, 0, 0, 0.08)`,wO=150,TO=globalThis.ScrollTimeline;function EO(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 DO=new WeakMap;function OO(e){let t=DO.get(e);if(t){for(let e of t.animations)e.cancel();DO.delete(e)}}function kO(e){for(let t of Array.from(e.cells))OO(t)}var AO=e=>e.cellIndex===0?`3`:`2`;function jO(e,t){return MO(e,t,e=>({transform:`translateY(${e}px)`}))}function MO(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 NO(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 PO(e,t,n){return NO(e,t,{zIndex:`auto`,boxShadow:`none`},{zIndex:n,boxShadow:CO})}function FO(e,t){return NO(e,t,{opacity:`0`},{opacity:`1`})}function IO(e,t,n,r){let i=AO(e),a=`sd|${n.startOffset}|${n.maxShift}|${r}|${i}`,o=DO.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(jO(n,r),s),l=e.animate(PO(n,r,i),s),u=e.animate(FO(n,r),{...s,pseudoElement:`::before`});DO.set(e,{key:a,animations:[c,l,u]})}function LO(e,t){let n=AO(e),r=`in|${t}|${n}`,i=DO.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:CO}],{duration:0,fill:`forwards`}),o=e.animate([{opacity:`1`}],{duration:0,fill:`forwards`,pseudoElement:`::before`});DO.set(e,{key:r,animations:[a,o]})}function RO(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=EO(a,i,c.top,c.height,l.height);if(!u){kO(s);continue}if(n){if(o<=0){kO(s);continue}for(let e of Array.from(s.cells))IO(e,n,u,o);continue}let d=Math.max(0,Math.min(a-u.startOffset,u.maxShift));if(d<=0||c.bottom<=i+56){kO(s);continue}for(let e of Array.from(s.cells))LO(e,d)}}var zO=no.create({name:`frozenTableHeaders`,addProseMirrorPlugins(){return[new ba({key:new Za(`frozenTableHeaders`),view(e){let t=null,n=null,r=null,i=null,a=null,o=!1,s=new Set,c=()=>{o||!t||RO(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()},wO);return}l()};return requestAnimationFrame(()=>{if(!o){if(t=e.dom.closest(`[data-testid="editor-scroll-container"]`),t&&TO)try{n=new TO({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`))kO(t)}}}})]}});function BO(e){return()=>{let t=null;try{t=e.view.dom.closest(`.editor-doc-scroll`)}catch{}let n={top:56,bottom:VO(`--ask-composer-height`)+VO(`--conflict-footer-height`)};return t?{boundary:t,padding:n}:{padding:n}}}function VO(e){let t=Number.parseFloat(document.documentElement.style.getPropertyValue(e));return Number.isFinite(t)?t:0}function HO(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 UO(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:D(typeof n.src==`string`?n.src:``)}function WO(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 GO(e){let t=(0,$.c)(13),{editor:n}=e,{_:r}=mt(),i;if(t[0]===n?i=t[1]:(i={editor:n,selector:KO},t[0]=n,t[1]=i),Wn(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=HO(n);t&&WO(t,UO(n))},t[4]=n,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(ec,{className:`size-3.5`}),t[6]=s):s=t[6];let c;t[7]!==a||t[8]!==o?(c=(0,Z.jsx)(rn,{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)(an,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(J,{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)(sn,{children:[c,l]})}),t[11]=c,t[12]=u),u}function KO(e){return HO(e.editor)}function qO(e){return HO(e)!==null}var JO=`img, .ok-embed, .ok-video`,YO=220,XO=`cubic-bezier(0.23, 1, 0.32, 1)`,ZO=`ok-image-align-flip`,QO=.5;function $O(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function ek(){return typeof requestAnimationFrame==`function`}function tk(e){return e?e.querySelector(JO):null}function nk(e,t){if($O()||!ek()){t();return}let n=tk(e);if(!n){t();return}let r=n.getBoundingClientRect().left;t(),requestAnimationFrame(()=>{let t=tk(e);if(!t)return;for(let e of t.getAnimations())e.id===ZO&&e.cancel();let n=r-t.getBoundingClientRect().left;if(Math.abs(n)<QO)return;let i=t.animate([{transform:`translateX(${n}px)`},{transform:`translateX(0)`}],{duration:YO,easing:XO,fill:`none`});i.id=ZO})}var rk=[{value:`left`,label:`Align left`,icon:yg},{value:`center`,label:`Align center`,icon:_g},{value:`right`,label:`Align right`,icon:vg}];function ik(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(!rt.has(String(n)))return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function ak(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:ok},t[0]=n,t[1]=r);let i=Wn(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=rk.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(sn,{children:[(0,Z.jsx)(rn,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":r,"aria-pressed":o,className:o?`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(!rt.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(li.create(u.doc,s)),nk(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(an,{side:`bottom`,sideOffset:8,children:r})]},t)}),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 ok(e){return ik(e.editor)}function sk(e){return ik(e)!==null}function ck({editor:e}){if(ee(e.state).query||e.isActive(`codeBlock`))return!1;if(sk(e)||qO(e))return!0;if(e.state.selection.empty)return!1;let{from:t,to:n}=e.state.selection;return!!e.state.doc.textBetween(t,n,` `).trim()}function lk(e){throw Error(`Unhandled AddLinkShortcutAction variant: ${JSON.stringify(e)}`)}function uk(e){let{selection:t}=e.state;if(t.empty){if(!e.isActive(`link`))return null;let n=c(e.state,t.from,`link`);return n===null?null:{kind:`edit-link`,markId:n}}return!ck({editor:e})||sk(e)||qO(e)?null:{kind:`open-popover`}}function dk(e,t){return Ki({relativePath:Zs(e),instruction:``,selectionMarkdown:t,target:`claude-code`})}function fk(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function pk(e){let t=(0,$.c)(3),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!1:r;if(Ys())return null;let a;return t[0]!==n||t[1]!==i?(a=(0,Z.jsx)(mk,{editor:n,shortcutEnabled:i}),t[0]=n,t[1]=i,t[2]=a):a=t[2],a}function mk(e){let t=(0,$.c)(11),{editor:n,shortcutEnabled:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=Oi(),t[0]=i):i=t[0];let a=i,o,s;t[1]===r?(o=t[2],s=t[3]):(o=()=>{if(!a)return;let e=e=>{r&&xl(e,`edit-with-ai`)&&(fk(e.target)||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),k()))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},s=[r,a],t[1]=r,t[2]=o,t[3]=s),(0,Q.useEffect)(o,s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(zr,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[4]=c):c=t[4];let l;t[5]===n?l=t[6]:(l=()=>{let e=qn(n),t=at(n);requestAnimationFrame(()=>{if(e===null||t.trim()===``){k();return}Kt(dk(e,t),{submit:!0})})},t[5]=n,t[6]=l);let u,d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Ks,{className:`size-3.5`,"aria-hidden":`true`}),d=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`xWEvuo`})}),t[7]=u,t[8]=d):(u=t[7],d=t[8]);let f;return t[9]===l?f=t[10]:(f=(0,Z.jsxs)(Z.Fragment,{children:[c,(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`edit-with-ai-bubble-button`,className:`gap-1 px-2 text-sm font-medium text-accent-foreground/80`,onClick:l,children:[u,d]})]}),t[9]=l,t[10]=f),f}function hk(e){let t=e.schema.nodes;return!!(t.footnoteReference&&t.footnoteDefinition)}function gk(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 _k(e){let{$from:t,$to:n}=e.state.selection;return!t.sameParent(n)}function vk(e){let t=(0,$.c)(21),{editor:n}=e,{_:r}=mt(),i;t[0]===n?i=t[1]:(i={editor:n,selector:yk},t[0]=n,t[1]=i);let a=Wn(i),o;t[2]!==a||t[3]!==n?(o=()=>{if(a||!hk(n)||n.state.selection.empty||_k(n)||gk(n))return;let{from:e,to:t}=n.state.selection,r=n.state.doc.textBetween(e,t,` `);if(!r.trim())return;let i=ja(Ia(n.state.doc)),o=mi(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)(E,{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)(rn,{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)(an,{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)(sn,{children:[d,p]}),t[18]=d,t[19]=p,t[20]=m):m=t[20],m}function yk(e){let t=e.editor;return!!(!hk(t)||t.state.selection.empty||_k(t)||gk(t))}var bk=[{name:`bold`,icon:hh,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcutId:`format-bold`},{name:`italic`,icon:zh,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcutId:`format-italic`},{name:`underline`,icon:wg,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcutId:`format-underline`},{name:`strikethrough`,icon:mg,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcutId:`format-strike`},{name:`code`,icon:Ye,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcutId:`format-inline-code`},{name:`highlight`,icon:Rh,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcutId:`format-highlight`}];function xk(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:Sk},t[0]=n,t[1]=r);let i=Wn(r),a;t[2]!==i||t[3]!==n?(a=bk.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(sn,{children:[(0,Z.jsx)(rn,{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)(an,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(U,{"aria-label":El(e.shortcutId),children:kl(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 Sk(e){return Object.fromEntries(bk.map(t=>[t.name,t.isActive(e.editor)]))}var Ck=`open-knowledge:open-link-edit-popover`;function wk(e=typeof window>`u`?new EventTarget:window){e.dispatchEvent(new CustomEvent(Ck))}function Tk(e,t=typeof window>`u`?new EventTarget:window){let n=()=>e();return t.addEventListener(Ck,n),()=>t.removeEventListener(Ck,n)}function Ek(e){return e.state.selection.empty&&e.isActive(`link`)?e.getAttributes(`link`).href??``:``}async function Dk(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=N(n);r!==null&&(t(e=>e===``?r:e),requestAnimationFrame(()=>{let t=e.current;t&&t.value===r&&t.select()}))}function Ok(e,t,n,r){let i=Ek(e);n(i),r(!0),i===``&&Dk(t,n)}function kk(e){let t=(0,$.c)(72),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!1:r,{_:a}=mt(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``),u=(0,Q.useRef)(null),{folderPaths:d,loading:f,pages:p}=Bo(),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=()=>Tk(()=>{i&&Ok(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||!xl(e,`add-link`)||!n.editorView?.hasFocus())return;let t=uk(n);if(t!==null)switch(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),t.kind){case`open-popover`:wk();return;case`edit-link`:{let{markId:e}=t;G(e),requestAnimationFrame(()=>{z(n).setActiveNode(e)});return}default:lk(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(Vn(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)(st,{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)(Sh,{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)(sn,{children:[(0,Z.jsx)(rn,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":a({id:`2vIPtm`}),onMouseDown:e=>{e.preventDefault(),jn(_)},children:(0,Z.jsx)(go,{className:`size-3.5`})})}),(0,Z.jsx)(an,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(J,{id:`2vIPtm`})})]}),(0,Z.jsxs)(sn,{children:[(0,Z.jsx)(rn,{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)(il,{className:`size-3.5`})})}),(0,Z.jsx)(an,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(J,{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(),Ok(n,u,l,s)},t[61]=n,t[62]=I);let L;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(Vh,{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)(rn,{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 B;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(J,{id:`yzF66j`}),t[68]=B):B=t[68];let V;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsxs)(an,{side:`bottom`,sideOffset:8,children:[B,(0,Z.jsx)(U,{children:kl(`add-link`)})]}),t[69]=V):V=t[69];let H;return t[70]===R?H=t[71]:(H=(0,Z.jsxs)(sn,{children:[R,V]}),t[70]=R,t[71]=H),H}function Ak(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:Fk},t[0]=n,t[1]=l);let u=Wn(l),d;t[2]===n?d=t[3]:(d={editor:n,selector:Pk},t[2]=n,t[3]=d);let f=Wn(d),p;t[4]!==n.state||t[5]!==n.view?(p=()=>{try{let{from:e,to:t}=n.state.selection;return Si(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=BO(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=tr(h,e,()=>{Zn(h,e,{placement:`top`,strategy:`fixed`,middleware:[Qn(8),Yn(_),ir({padding:8}),er(_)]}).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(Nk)}))},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(Mk)},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)(ak,{editor:n},`${o}-img-align`):f?(0,Z.jsx)(GO,{editor:n},`${o}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(xO,{editor:n}),(0,Z.jsx)(zr,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(xk,{editor:n},o),(0,Z.jsx)(zr,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(kk,{editor:n,shortcutEnabled:i},`${o}-link`),(0,Z.jsx)(vk,{editor:n},`${o}-footnote`),(0,Z.jsx)(pk,{editor:n,shortcutEnabled:i},`${o}-edit-ai`)]}),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)(yO,{ref:a,editor:n,"data-testid":`bubble-menu-bar`,appendTo:jk,shouldShow:ck,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 jk(){return document.body}function Mk(e){return e+1}function Nk(){}function Pk(e){return qO(e.editor)}function Fk(e){return sk(e.editor)}var Ik=new Za(`markdownLintDecorations`),Lk=`ok-lint-block`,Rk=`ok-lint-block-error`,zk=`ok-lint-block-atom`,Bk=400;function Vk(e,t){let{frontmatter:n,body:r}=za(e),i=n===``?0:n.split(`
10
+ `).length-1;return{spans:t.parseToMdast(r).children.map(e=>({start:(e.position?.start.line??1/0)+i,end:(e.position?.end.line??-1/0)+i})),fmLineCount:i}}function Hk(e,t){let n=e.findIndex(e=>t>=e.start&&t<=e.end);if(n>=0)return n;let r=e.findIndex(e=>e.start>t);return r>=0?r:e.length>0?e.length-1:null}function Uk(e,t,n){let r=new Map;if(t.length===0)return r;let{spans:i,fmLineCount:a}=Vk(e,n);for(let e of t){let t=e.range.start.line+1;if(a>0&&t<=a)continue;let n=Hk(i,t);if(n===null)continue;let o=r.get(n);o?o.push(e):r.set(n,[e])}return r}function Wk(e){let t=e.childCount>0?e.child(e.childCount-1):null;return t!==null&&t.type.name===`paragraph`&&t.content.size===0?e.childCount-1:e.childCount}var Gk=`data-ok-lint`,Kk=`data-ok-lint-fixable`;function qk(e,t){let n=new Map;if(t.size===0)return{set:na.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(`
11
+ `),l=[Lk];e.textContent.length===0&&l.push(zk),s&&l.push(Rk);let u={class:l.join(` `),[Gk]:c},d=Kb(o);d.length>0&&(u[Kk]=`1`,n.set(a,d)),r.push(ia.node(a,a+e.nodeSize,u))}),{set:na.create(e,r),fixesByOffset:n}}function Jk(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=Y(`ok-lint-tooltip-fix`,Xt({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(){Zn(d,n,{placement:`top-start`,middleware:[Qn(6),Yn(),ir({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(Gk);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=vl._({id:`c4fVUV`}),i.onclick=()=>{t.applyFix?.(l),o=!1,p()}):(i.hidden=!0,i.onclick=null),n.hidden=!1,c?.(),c=tr(d,n,h)}function _(e){let t=e,n=e.target?.closest(`.${Lk}`)??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(`.${Lk}`)||m()}function y(){o=!0,f()}function b(e){o=!1;let t=e.relatedTarget;t!==a&&!t?.closest(`.${Lk}`)&&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 Yk=no.create({name:`markdownLintDecorations`,addOptions(){return{docName:``,getSource:void 0,applyFix:void 0}},addProseMirrorPlugins(){let{docName:e,getSource:t,applyFix:n}=this.options,r=new Oa({extensions:Ui});return[new ba({key:Ik,state:{init:()=>na.empty,apply(e,t){return e.getMeta(Ik)||t.map(e.mapping,e.doc)}},props:{decorations(e){return Ik.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:na.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=Ik.getState(i.state)??na.empty;if((o.find().length>0||u.find().length>0)&&i.dispatch(i.state.tr.setMeta(Ik,o)),a?.enabled){let t=gd(e);t?.kind===`lint`&&g(t.detail)&&jd(e)}n!==null&&!s&&t?.()!==n&&f()}async function d(n){let a=i.state.doc,o=t?.()??r.serialize(a.toJSON()),s=await Ji(o,n,e);if(!i.state.doc.eq(a))return{kind:`stale`};let{spans:c}=Vk(o,r);return c.length===Wk(a)?{kind:`ok`,...qk(a,Uk(o,s,r))}:{kind:`mismatch`}}function f(){o&&clearTimeout(o),o=setTimeout(()=>{u().catch(e=>{console.warn(`[markdown-lint] decoration pass failed`,e)})},Bk)}let p=0;async function m(){let t=++p,n=await Gd(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(e){if(!i.dom.isConnected||i.dom.offsetParent===null)return!1;let{spans:n,fmLineCount:a}=Vk(t?.()??r.serialize(i.state.doc.toJSON()),r);if(n.length!==Wk(i.state.doc)||a>0&&e.line<=a)return!1;let o=Hk(n,e.line);if(o===null)return!1;let s=-1;if(i.state.doc.forEach((e,t,n)=>{n===o&&(s=t)}),s<0)return!1;i.dispatch(i.state.tr.setSelection(Da.near(i.state.doc.resolve(s+1)))),i.focus();let c=i.nodeDOM(s);return c instanceof HTMLElement&&c.scrollIntoView({behavior:`smooth`,block:`start`}),!0}function _(t){let n=t.detail;!n||s||g(n)&&jd(e)}h();let v=Wd(h),y=Jk(i,{getFixes:e=>{if(e.getAttribute(Kk)!==`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(_d,_);let b=()=>{s||f()};return window.addEventListener(Ub,b),{update(e,t){e.state.doc.eq(t.doc)||f()},destroy(){s=!0,o&&clearTimeout(o),v(),y.destroy(),window.removeEventListener(_d,_),window.removeEventListener(Ub,b)}}}})]}}),Xk=1400,Zk=new Za(`okAgentInsertFlash`);function Qk(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 $k=6e3;function eA(e,t,n){let r=e.childCount,i=Math.max(0,Math.min(t,r)),a=Math.max(i,Math.min(n,r));if(a<=i)return null;let o=0;for(let t=0;t<i;t++)o+=e.child(t).nodeSize;let s=o;for(let t=i;t<a;t++)o+=e.child(t).nodeSize;let c=o,l=e.content.size,u=Math.max(0,Math.min(s,l)),d=Math.max(u,Math.min(c,l));return d<=u?null:{from:u,to:d}}function tA(){return new ba({key:Zk,state:{init:()=>na.empty,apply(e,t){let n=t.map(e.mapping,e.doc),r=e.getMeta(Zk);if(r===void 0)return n;if(r.sweep===!0){let e=n.find().filter(e=>r.now-(e.spec.addedAt??0)>=Xk);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,[ia.inline(r.add.from,r.add.to,{class:`ok-agent-insert-flash`},t)])}return n}},props:{decorations(e){return Zk.getState(e)}}})}function nA(e,t){return(n,r)=>{let i=r,a=Df(i.dataTransfer);return a?(i.preventDefault(),t?.(a),!0):e(n,i)}}function rA(e,t){let n=Tf(e);t(n.target,{tabBehavior:`append`}),gu(n.hash)}var iA=5,aA=1;function oA(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)<iA)return;t.isDragging=!0,m(!0),document.body.style.cursor=`grabbing`,document.body.style.userSelect=`none`}let n=sA(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?dA(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 sA(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:aA,rect:lA(a,cA(e,0,n.top))};if(r<=n.bottom){let i=r>=n.top+n.height/2,o=i?t+1:t,s=Math.max(aA,o);return{index:s,rect:lA(a,s===o?i?n.bottom:n.top:cA(e,0,n.top))}}}let t=e[e.length-1].getBoundingClientRect();return{index:e.length,rect:lA(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:uA(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:uA(a,i)}}}let c=s[s.length-1].getBoundingClientRect();return{index:s.length,rect:uA(a,c.right)}}function cA(e,t,n){let r=e[t];return r?r.getBoundingClientRect().bottom:n}function lA(e,t){return{left:e.left,top:t-1,width:e.width,height:2}}function uA(e,t){return{left:t-1,top:e.top,width:2,height:e.height}}function dA(e,t,n,r){let i=n===`row`?fA(t):t.cellIndex;if(i<0||n===`row`&&(i<aA||r<aA)||r===i||r===i+1)return;let{state:a,view:o}=e,s=pA(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;gA(l,s,c,n===`row`?mA(c,i,r):hA(c,i,r)),o.dispatch(l)}function fA(e){let t=e.parentElement,n=t?.closest(`table`);return n?Array.prototype.indexOf.call(n.rows,t):-1}function pA(e){for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole===`table`)return e.before(t);return-1}function mA(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 hA(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 gA(e,t,n,r){e.replaceRangeWith(t,t+n.nodeSize,r)}function _A(e){return[...e?[{label:`Toggle header column`,icon:bh,run:e=>e.chain().focus().toggleHeaderColumn().run()}]:[],{label:`Insert column left`,icon:Pn,run:e=>e.chain().focus().addColumnBefore().run()},{label:`Insert column right`,icon:Kn,run:e=>e.chain().focus().addColumnAfter().run()},{label:`Delete column`,icon:il,separatorBefore:!0,run:e=>e.chain().focus().deleteColumn().run()},{label:`Delete table`,icon:Fh,run:e=>e.chain().focus().deleteTable().run()}]}function vA(e){return[...e?[{label:`Toggle header row`,icon:hg,run:e=>e.chain().focus().toggleHeaderRow().run()}]:[],{label:`Insert row above`,icon:Bn,run:e=>e.chain().focus().addRowBefore().run()},{label:`Insert row below`,icon:Ln,run:e=>e.chain().focus().addRowAfter().run()},{label:`Delete row`,icon:il,separatorBefore:!0,run:e=>e.chain().focus().deleteRow().run()},{label:`Delete table`,icon:Fh,run:e=>e.chain().focus().deleteTable().run()}]}function yA(e){if(!e.isEditable||ee(e.state).query)return null;let{state:t,view:n}=e,r=t.selection.$from,i=-1;for(let e=r.depth;e>0;e--){let t=r.node(e).type.spec.tableRole;if(t===`cell`||t===`header_cell`){i=r.before(e);break}}if(i<0)return null;let a=n.nodeDOM(i);if(!(a instanceof HTMLTableCellElement))return null;let o=a.closest(`table`),s=a.closest(`tr`),c=a.closest(`.ProseMirror`);if(!o||!s||!c)return null;let l=Array.prototype.indexOf.call(o.rows,s),u=a.cellIndex,d=o.rows[0]?.cells[u],f=o.rows[l]?.cells[0];return!d||!f?null:{columnAnchor:d,rowAnchor:f,isFirstColumn:u===0,isFirstRow:l===0}}function bA(e){let t=(0,$.c)(37),{editor:n,anchor:r,axis:i,items:a}=e,o=(0,Q.useRef)(null),[s,c]=(0,Q.useState)(!1),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>c(!0),t[0]=l):l=t[0];let u;t[1]!==r||t[2]!==i||t[3]!==n?(u={editor:n,axis:i,anchor:r,onClickGesture:l},t[1]=r,t[2]=i,t[3]=n,t[4]=u):u=t[4];let d=oA(u),f,p;t[5]!==r||t[6]!==i?(f=()=>{let e=o.current;if(!e)return;let t=i===`column`?`top`:`left`,n=i===`column`?-14:-6;return tr(r,e,()=>{Zn(r,e,{strategy:`absolute`,placement:t,middleware:[Qn(n)]}).then(t=>{let{x:n,y:r}=t;e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.opacity=`1`}).catch(xA)})},p=[r,i],t[5]=r,t[6]=i,t[7]=f,t[8]=p):(f=t[7],p=t[8]),(0,Q.useEffect)(f,p);let m=i===`column`?wh:hs,h;t[9]===d?h=t[10]:(h=e=>{d.shouldAllowOpen(e)&&c(e)},t[9]=d,t[10]=h);let g=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-[""]`,_=i===`column`?`Column options`:`Row options`,v;t[11]===m?v=t[12]:(v=(0,Z.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),t[11]=m,t[12]=v);let y;t[13]!==d.onPointerDown||t[14]!==g||t[15]!==_||t[16]!==v?(y=(0,Z.jsx)(Er,{asChild:!0,children:(0,Z.jsx)(X,{variant:`secondary`,onPointerDown:d.onPointerDown,className:g,"aria-label":_,children:v})}),t[13]=d.onPointerDown,t[14]=g,t[15]=_,t[16]=v,t[17]=y):y=t[17];let b=i===`column`?`center`:`start`,x=i===`column`?`bottom`:`right`,S;if(t[18]!==n||t[19]!==a){let e;t[21]===n?e=t[22]:(e=e=>(0,Z.jsxs)(Q.Fragment,{children:[e.separatorBefore&&(0,Z.jsx)(Nr,{}),(0,Z.jsxs)(Sr,{onSelect:()=>e.run(n),children:[(0,Z.jsx)(e.icon,{"aria-hidden":!0}),e.label]})]},e.label),t[21]=n,t[22]=e),S=a.map(e),t[18]=n,t[19]=a,t[20]=S}else S=t[20];let C;t[23]!==b||t[24]!==x||t[25]!==S?(C=(0,Z.jsx)(Ar,{align:b,side:x,className:`w-auto min-w-44 whitespace-nowrap`,children:S}),t[23]=b,t[24]=x,t[25]=S,t[26]=C):C=t[26];let w;t[27]!==s||t[28]!==C||t[29]!==h||t[30]!==y?(w=(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)(Mr,{open:s,onOpenChange:h,children:[y,C]})}),t[27]=s,t[28]=C,t[29]=h,t[30]=y,t[31]=w):w=t[31];let T;t[32]===d.indicator?T=t[33]:(T=d.indicator&&(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none fixed z-50 bg-primary`,style:{left:d.indicator.rect.left,top:d.indicator.rect.top,width:d.indicator.rect.width,height:d.indicator.rect.height}}),t[32]=d.indicator,t[33]=T);let E;return t[34]!==w||t[35]!==T?(E=(0,Z.jsxs)(Z.Fragment,{children:[w,T]}),t[34]=w,t[35]=T,t[36]=E):E=t[36],E}function xA(){}function SA(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=yA(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=_A(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)(bA,{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=vA(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)(bA,{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 CA(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=it.getState(e.state)?.binding;if(!t){iu.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-binding`}),s(`no ySync binding on "${n}"`);return}if(typeof t._forceRerender!=`function`){iu.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-force-rerender`}),s(`ySync binding on "${n}" exposes no _forceRerender`);return}iu.count(`ok/editor/pattern-d-stale-prewarm`,{docName:n}),t._forceRerender()};return no.create({name:`walkCurrency`,onBeforeCreate(){t.observeDeep(o),i=!0},onDestroy(){c()},addProseMirrorPlugins(){return[new ba({view:e=>(a||(a=!0,c(),r&&l(e)),{})})]}})}var wA=new WeakMap;function TA(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=Aa(e.color),n.textContent=e.name,t.append(n),t}var EA={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null};function DA(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 OA=100,kA=100,AA=3,jA=250;function MA(e){return`contentComponent`in e&&`isEditorContentInitialized`in e}function NA(e,t){let n=On(e);if(!n||t.contains(n.dom))return!1;if(!MA(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 PA(){let e=new Oa({extensions:Ui});return{mdManager:e,text:ke({mdManager:e}),html:o({mdManager:e}),paste:f({mdManager:e}),copy:je({mdManager:e}),drop:m({mdManager:e})}}function FA(e,t){return t?{collaboration:u.configure({document:e.document,ySyncOptions:{mapping:t}}),guard:[CA({fragment:e.document.getXmlFragment(`default`),docName:e.configuration.name??``})]}:{collaboration:u.configure({document:e.document}),guard:[]}}function IA(e){let{provider:t,placeholder:n,prebuiltMapping:r,onWedged:i}=e,{collaboration:a,guard:o}=FA(t,r);return[...He.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`?e.configure({docName:t.configuration.name??``}):e),wC.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),a,no.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[y]}}),no.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[ce(e,{cursorBuilder:TA})]}}),no.create({name:`bindingStalenessGuard`,addProseMirrorPlugins(){return[HD({fragment:t.document.getXmlFragment(`default`),docName:t.configuration.name??``,onWedged:i??(()=>{})})]}}),...o,zO,Yk.configure({docName:t.configuration.name??``,getSource:()=>t.document.getText(`source`).toString(),applyFix:e=>qb(t,e)})]}function LA(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{wA.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=wA.get(e);if(wA.delete(e),r==null)return;let i=performance.now();iu(`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:nA(n.drop,e.onSidebarDrop),handleDOMEvents:{copy:(e,t)=>n.copy(e,t,!1),cut:(e,t)=>n.copy(e,t,!0)}},extensions:AD(IA(e))}}function RA(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i,onWedged:a,onSidebarDrop:o}=e,s=t.document.getXmlFragment(`default`),c=new Map,l=LA({provider:t,placeholder:n,clipboard:r,ctorStart:i,prebuiltMapping:c,onWedged:a,onSidebarDrop:o}),u=l.onBeforeCreate;return{...l,onBeforeCreate:e=>{u?.(e);let{editor:t}=e,{doc:n,mapping:r}=Ce(s,t.schema);r.forEach((e,t)=>{c.set(t,e)}),t.options.content=n.toJSON()},element:null}}var zA=e=>{let t=(0,$.c)(24),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(EA),c=MD(),{principal:l,activeDocName:u,recycleDocument:d,openTarget:f}=Re(),p=n.configuration.name??``,[m]=(0,Q.useState)(PA),h;t[0]!==m||t[1]!==p||t[2]!==f||t[3]!==r||t[4]!==n||t[5]!==d?(h=()=>()=>({editor:new hi(RA({provider:n,placeholder:r,clipboard:m,ctorStart:performance.now(),onWedged:e=>{let{externalSeq:t,appliedSeq:n}=e;iu(`ok/editor/binding-wedge-recycle`,{docName:p,externalSeq:t,appliedSeq:n}),d(p)},onSidebarDrop:e=>{rA(e,f)}})),ydoc:n.document,ytext:n.document.getText(`source`),provider:n}),t[0]=m,t[1]=p,t[2]=f,t[3]=r,t[4]=n,t[5]=d,t[6]=h):h=t[6];let[g]=(0,Q.useState)(h),_,v;if(t[7]!==g||t[8]!==p||t[9]!==n.document){let e={viewCount:0,bytes:n.document.getText(`source`).length},r=Ue(p)??crypto.randomUUID();_=Q.use,v=nt({docName:p,mountId:r,construct:g,sizeStats:e}),t[7]=g,t[8]=p,t[9]=n.document,t[10]=_,t[11]=v}else _=t[10],v=t[11];let y=_(v),b=y.editor,x,S;t[12]===y?(x=t[13],S=t[14]):(x=()=>()=>{Oe(y)},S=[y],t[12]=y,t[13]=x,t[14]=S),(0,Q.useEffect)(x,S);let C;return t[15]!==u||t[16]!==p||t[17]!==b||t[18]!==c||t[19]!==i||t[20]!==a||t[21]!==l||t[22]!==n?(C=(0,Z.jsx)(BA,{provider:n,isSourceMode:i,docName:p,activeDocName:u,identity:c,principal:l,editor:b,wrapperRef:o,flashStateRef:s,portalTarget:a}),t[15]=u,t[16]=p,t[17]=b,t[18]=c,t[19]=i,t[20]=a,t[21]=l,t[22]=n,t[23]=C):C=t[23],C},BA=e=>{let t=(0,$.c)(110),{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?(_=()=>{NA(c,d)&&m(VA)},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=()=>(bn(c,n.configuration.name??null),()=>{bn(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 fe(e,c),()=>H(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]!==n.configuration.name?(C=()=>{let e=n.configuration.name;if(!e)return;let t=null,r=()=>{t=null,Td(e,`wysiwyg`,Sd(c)),dd(e,`wysiwyg`,fd(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),Td(e,`wysiwyg`,null),dd(e,`wysiwyg`,null)}},t[19]=c,t[20]=n.configuration.name,t[21]=C):C=t[21];let w;t[22]!==c||t[23]!==n?(w=[c,n],t[22]=c,t[23]=n,t[24]=w):w=t[24],(0,Q.useEffect)(C,w);let T;t[25]!==c||t[26]!==n.configuration.name?(T=()=>{},t[25]=c,t[26]=n.configuration.name,t[27]=T):T=t[27];let E;t[28]!==c||t[29]!==n?(E=[c,n],t[28]=c,t[29]=n,t[30]=E):E=t[30],(0,Q.useEffect)(T,E);let D,O;t[31]===c?(D=t[32],O=t[33]):(D=()=>{let e=HA,t=null,n=()=>{if(t||c.isDestroyed)return;let n=On(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 On(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},O=[c],t[31]=c,t[32]=D,t[33]=O),(0,Q.useEffect)(D,O);let k,A;t[34]!==i||t[35]!==c?(k=()=>{let e=!1,t=()=>{if(e||c.isDestroyed||!On(c))return;e=!0;let t=de(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})),iu(`ok/editor/selection-restore-failed`,{docName:i,message:n})}$e(i)};if(On(c)){t();return}return c.on(`create`,t),()=>{c.off(`create`,t)}},A=[c,i],t[34]=i,t[35]=c,t[36]=k,t[37]=A):(k=t[36],A=t[37]),(0,Q.useEffect)(k,A);let j,M;t[38]!==u||t[39]!==n.document||t[40]!==l?(j=()=>{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)},ji)};c(EA);let f=()=>{if(bi(e),!aa(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`?aa(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)}},M=[n.document,u,l],t[38]=u,t[39]=n.document,t[40]=l,t[41]=j,t[42]=M):(j=t[41],M=t[42]),(0,Q.useEffect)(j,M);let N=(0,Q.useRef)(null),P;t[43]!==a||t[44]!==i||t[45]!==c||t[46]!==n?(P=()=>{let e=tA(),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(Zk,{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(Zk,{now:Date.now(),sweep:!0}))},Xk+50),!sf()||document.visibilityState!==`visible`||e.hasFocus())return;let i=()=>{let e=l();if(!(e==null||e.hasFocus()||document.visibilityState!==`visible`))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(i),s.push(window.setTimeout(i,250),window.setTimeout(i,550))},d=e=>{let{transaction:n}=e;if(!n.docChanged||n.getMeta(it)?.isChangeOrigin!==!0||!aa(t,Date.now()-1400)||i!==a)return;let r=DA(t,Date.now()-Xk);if(r!==null&&r.key===N.current)return;let o=Qk(n.before,n.doc);if(o===null)return;let s=l();s!=null&&(r!==null&&(N.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=DA(t,Date.now()-$k);if(n===null||n.key===N.current)return;let r=n.entry.changedBlocks;if(r===void 0)return;let s=eA(e.state.doc,r.from,r.to);s!==null&&(N.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(Zk)}},t[43]=a,t[44]=i,t[45]=c,t[46]=n,t[47]=P):P=t[47];let F;t[48]!==a||t[49]!==i||t[50]!==c||t[51]!==n.document||t[52]!==n.off||t[53]!==n.on?(F=[c,n.document,i,a,n.on,n.off],t[48]=a,t[49]=i,t[50]=c,t[51]=n.document,t[52]=n.off,t[53]=n.on,t[54]=F):F=t[54],(0,Q.useEffect)(P,F);let I,L;t[55]!==a||t[56]!==i||t[57]!==c||t[58]!==n?(I=()=>{let e=0,t,r=null,o=null,s=null,l=function(){if(e<OA){e+=1,t=window.setTimeout(p,kA);return}r=null,o=null,e=0},u=function(e){let t=On(c);if(!t)return null;let n=CSS.escape(e);return t.dom.querySelector(`#${n}`)??t.dom.querySelector(`[data-mirror-source-id="${n}"]`)},d=function(e){let t=u(e);return t?(t.scrollIntoView({behavior:`smooth`,block:`start`}),!0):!1},f=function(e,n){let r=AA,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(d(e),--r,r>0&&(t=window.setTimeout(o,jA)))};t=window.setTimeout(o,jA)};function p(){if(!r||i!==a)return;let t=r,n=o;if(!n){l();return}d(t)?(s=n,r=null,o=null,e=0,f(t,n)):l()}let m=function(){if(i!==a)return;let n=window.location.hash;if(!r&&s===n)return;let c=yu(n);if(!c){s=n;return}r=c,o=n,e=0,t!==void 0&&(clearTimeout(t),t=void 0),p()},h=function(){if(i===a){if(r){p();return}m()}};return m(),n.on(`synced`,h),c.on(`transaction`,h),window.addEventListener(`hashchange`,m),()=>{t!==void 0&&clearTimeout(t),n.off(`synced`,h),c.off(`transaction`,h),window.removeEventListener(`hashchange`,m)}},L=[n,c,i,a],t[55]=a,t[56]=i,t[57]=c,t[58]=n,t[59]=I,t[60]=L):(I=t[59],L=t[60]),(0,Q.useEffect)(I,L);let R,B;t[61]===c?(R=t[62],B=t[63]):(R=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||c.isDestroyed)return;let n=On(c);if(!n)return;let r=n.dom.querySelectorAll(`h1, h2, h3, h4, h5, h6`)[t.index];r&&r.scrollIntoView({behavior:`smooth`,block:`start`})};return window.addEventListener(bd,e),()=>window.removeEventListener(bd,e)},B=[c],t[61]=c,t[62]=R,t[63]=B),(0,Q.useEffect)(R,B);let V;t[64]!==a||t[65]!==i||t[66]!==o||t[67]!==r||t[68]!==s||t[69]!==n.awareness?(V=()=>{let e=n.awareness;if(e){if(i!==a){e.setLocalState(null);return}e.setLocalState({user:ND({principal:s,identity:o}),mode:r?`source`:`wysiwyg`})}},t[64]=a,t[65]=i,t[66]=o,t[67]=r,t[68]=s,t[69]=n.awareness,t[70]=V):V=t[70];let U;t[71]!==a||t[72]!==i||t[73]!==o||t[74]!==r||t[75]!==s||t[76]!==n?(U=[n,i,a,o,s,r],t[71]=a,t[72]=i,t[73]=o,t[74]=r,t[75]=s,t[76]=n,t[77]=U):U=t[77],(0,Q.useEffect)(V,U);let ee,W;t[78]!==c||t[79]!==r?(ee=()=>(Cn(c,r),()=>{Cn(c,!1)}),W=[c,r],t[78]=c,t[79]=r,t[80]=ee,t[81]=W):(ee=t[80],W=t[81]),(0,Q.useEffect)(ee,W);let G;t[82]!==a||t[83]!==i||t[84]!==c||t[85]!==r?(G=!r&&(0,Z.jsx)(Ak,{editor:c,shortcutEnabled:i===a}),t[82]=a,t[83]=i,t[84]=c,t[85]=r,t[86]=G):G=t[86];let K;t[87]!==c||t[88]!==r?(K=!r&&(0,Z.jsx)(SA,{editor:c}),t[87]=c,t[88]=r,t[89]=K):K=t[89];let te;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(`div`,{ref:f,style:{display:`contents`}}),t[90]=te):te=t[90];let ne;t[91]!==c||t[92]!==p?(ne=(0,Z.jsx)(Hn,{editor:c,className:`tiptap-editor-portal-content h-full`},p),t[91]=c,t[92]=p,t[93]=ne):ne=t[93];let q;t[94]!==d||t[95]!==ne?(q=(0,Kw.createPortal)(ne,d),t[94]=d,t[95]=ne,t[96]=q):q=t[96];let re;t[97]===c?re=t[98]:(re=(0,Z.jsx)(dD,{editor:c}),t[97]=c,t[98]=re);let ie;t[99]===c?ie=t[100]:(ie=z(c),t[99]=c,t[100]=ie);let ae;t[101]===ie.store?ae=t[102]:(ae=(0,Z.jsx)(dt,{store:ie.store}),t[101]=ie.store,t[102]=ae);let oe;return t[103]!==G||t[104]!==K||t[105]!==q||t[106]!==re||t[107]!==ae||t[108]!==l?(oe=(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:[G,K,te,q,re,ae]}),t[103]=G,t[104]=K,t[105]=q,t[106]=re,t[107]=ae,t[108]=l,t[109]=oe):oe=t[109],oe};function VA(e){return e+1}function HA(){return Sn()}var UA=null;function WA(e){let t=(0,$.c)(3),n=(0,Q.useRef)(null),r,i;return t[0]===e?(r=t[1],i=t[2]):(r=()=>{if(!e)return;let t=n.current;if(!t)return;let r={};UA=r;let i=document.documentElement,a=null,o=()=>{if(UA!==r)return;let e=`${t.offsetHeight}px`;e!==a&&(a=e,i.style.setProperty(`--conflict-footer-height`,e))};o();let s=new ResizeObserver(o);return s.observe(t),()=>{s.disconnect(),UA===r&&(UA=null,i.style.removeProperty(`--conflict-footer-height`))}},i=[e],t[0]=e,t[1]=r,t[2]=i),(0,Q.useEffect)(r,i),n}var GA=class e{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}offset(t,n=t){return new e(this.fromA+t,this.toA+t,this.fromB+n,this.toB+n)}};function KA(e,t,n,r,i,a){if(e==r)return[];let o=nj(e,t,n,r,i,a),s=rj(e,t+o,n,r,i+o,a);t+=o,n-=s,i+=o,a-=s;let c=n-t,l=a-i;if(!c||!l)return[new GA(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new GA(t,t+o,i,i),new GA(t+o+l,n,a,a)]}else if(l>c){let o=r.slice(i,a).indexOf(e.slice(t,n));if(o>-1)return[new GA(t,t,i,i+o),new GA(n,n,i+o+c,a)]}if(c==1||l==1)return[new GA(t,n,i,a)];let u=aj(e,t,n,r,i,a);if(u){let[o,s,c]=u;return KA(e,t,o,r,i,s).concat(KA(e,o+c,n,r,s+c,a))}return XA(e,t,n,r,i,a)}var qA=1e9,JA=0,YA=!1;function XA(e,t,n,r,i,a){let o=n-t,s=a-i;if(qA<1e9&&Math.min(o,s)>qA*16||JA>0&&Date.now()>JA)return Math.min(o,s)>qA*64?[new GA(t,n,i,a)]:oj(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);QA.reset(c),$A.reset(c);let l=(n,a)=>e.charCodeAt(t+n)==r.charCodeAt(i+a),u=(t,i)=>e.charCodeAt(n-t-1)==r.charCodeAt(a-i-1),d=(o-s)%2==0?null:$A,f=d?null:QA;for(let p=0;p<c;p++){if(p>qA||JA>0&&!(p&63)&&Date.now()>JA)return oj(e,t,n,r,i,a);let m=QA.advance(p,o,s,c,d,!1,l)||$A.advance(p,o,s,c,f,!0,u);if(m)return ej(e,t,n,t+m[0],r,i,a,i+m[1])}return[new GA(t,n,i,a)]}var ZA=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let e=0;e<this.len;e++)this.vec[e]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,t,n,r,i,a,o){for(let s=-e+this.start;s<=e-this.end;s+=2){let c=r+s,l=s==-e||s!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,u=l-s;for(;l<t&&u<n&&o(l,u);)l++,u++;if(this.vec[c]=l,l>t)this.end+=2;else if(u>n)this.start+=2;else if(i){let e=r+(t-n)-s;if(e>=0&&e<this.len&&i.vec[e]!=-1)if(a){let n=i.vec[e];if(n>=t-l)return[n,r+n-e]}else{let n=t-i.vec[e];if(l>=n)return[l,u]}}}return null}},QA=new ZA,$A=new ZA;function ej(e,t,n,r,i,a,o,s){let c=!1;return!xj(e,r)&&++r==n&&(c=!0),!xj(i,s)&&++s==o&&(c=!0),c?[new GA(t,n,a,o)]:KA(e,t,r,i,a,s).concat(KA(e,r,n,i,s,o))}function tj(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function nj(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=tj(n-t,a-i);for(let s=t,c=i;;){let i=s+o,l=c+o;if(i>n||l>a||e.slice(s,i)!=r.slice(c,l)){if(o==1)return s-t-+!xj(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function rj(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=tj(n-t,a-i);for(let s=n,c=a;;){let a=s-o,l=c-o;if(a<t||l<i||e.slice(a,s)!=r.slice(l,c)){if(o==1)return n-s-+!xj(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function ij(e,t,n,r,i,a,o,s){let c=r.slice(i,a),l=null;for(;;){if(l||o<s)return l;for(let s=t+o;;){xj(e,s)||s++;let u=s+o;if(xj(e,u)||(u+=u==s+1?1:-1),u>=n)break;let d=e.slice(s,u),f=-1;for(;(f=c.indexOf(d,f+1))!=-1;){let o=nj(e,u,n,r,i+f+d.length,a),c=rj(e,t,s,r,i,i+f),p=d.length+o+c;(!l||l[2]<p)&&(l=[s-c,i+f-c,p])}s=u}if(s<0)return l;o>>=1}}function aj(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=aj(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:ij(e,t,n,r,i,a,Math.floor(o/4),-1)}function oj(e,t,n,r,i,a){YA=!0;let o=n-t,s=a-i,c;if(o<s){let s=ij(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=ij(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new GA(t,n,i,a)];let[l,u,d]=c;return KA(e,t,l,r,i,u).concat(KA(e,l+d,n,r,u+d,a))}function sj(e,t){for(let n=1;n<e.length;n++){let r=e[n-1],i=e[n];r.toA>i.fromA-t&&r.toB>i.fromB-t&&(e[n-1]=new GA(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function cj(e,t,n){for(;;){sj(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=nj(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new GA(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=rj(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new GA(a.fromA,a.toA-s,a.fromB,a.toB-s));let c=a.toA-a.fromA,l=a.toB-a.fromB;if(c&&l)continue;let u=a.fromA-(i?n[i-1].toA:0),d=(i<n.length-1?n[i+1].fromA:e.length)-a.toA;if(!u||!d)continue;let f=c?e.slice(a.fromA,a.toA):t.slice(a.fromB,a.toB);u<=f.length&&e.slice(a.fromA-u,a.fromA)==f.slice(f.length-u)?(n[i]=new GA(a.fromA-u,a.toA-u,a.fromB-u,a.toB-u),r=!0):d<=f.length&&e.slice(a.toA,a.toA+d)==f.slice(0,d)&&(n[i]=new GA(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function lj(e,t,n){for(let r=0,i=0;i<e.length;i++){let a=e[i],o=a.toA-a.fromA,s=a.toB-a.fromB;if(o&&s||o>3||s>3){let c=i==e.length-1?t.length:e[i+1].fromA,l=a.fromA-r,u=c-a.toA,d=gj(t,a.fromA,l),f=hj(t,a.toA,u),p=a.fromA-d,m=f-a.toA;if((!o||!s)&&p&&m){let l=Math.max(o,s),[u,h,g]=o?[t,a.fromA,a.toA]:[n,a.fromB,a.toB];l>p&&t.slice(d,a.fromA)==u.slice(g-p,g)?(a=e[i]=new GA(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=hj(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new GA(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=gj(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new GA(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=vj(n,a.fromB,a.toB),r,o=t<0?-1:_j(n,a.toB,a.fromB);t>-1&&(r=t-a.fromB)<=u&&n.slice(a.fromB,t)==n.slice(a.toB,a.toB+r)?a=e[i]=a.offset(r):o>-1&&(r=a.toB-o)<=l&&n.slice(a.fromB-r,a.fromB)==n.slice(o,a.toB)&&(a=e[i]=a.offset(-r))}else if(!s){let n=vj(t,a.fromA,a.toA),r,o=n<0?-1:_j(t,a.toA,a.fromA);n>-1&&(r=n-a.fromA)<=u&&t.slice(a.fromA,n)==t.slice(a.toA,a.toA+r)?a=e[i]=a.offset(r):o>-1&&(r=a.toA-o)<=l&&t.slice(a.fromA-r,a.fromA)==t.slice(o,a.toA)&&(a=e[i]=a.offset(-r))}}r=a.toA}return sj(e,3),e}var uj;try{uj=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function dj(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function fj(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!dj(n):uj?!yj(n)||t==e.length-1?+!!uj.test(String.fromCharCode(n)):uj.test(e.slice(t,t+2))?2:0:0}function pj(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!dj(n):uj?!bj(n)||t==1?+!!uj.test(String.fromCharCode(n)):uj.test(e.slice(t-2,t))?2:0:0}var mj=8;function hj(e,t,n){if(t==e.length||!pj(e,t))return t;for(let r=t,i=t+n,a=0;a<mj;a++){let t=fj(e,r);if(!t||r+t>i)return r;r+=t}return t}function gj(e,t,n){if(!t||!fj(e,t))return t;for(let r=t,i=t-n,a=0;a<mj;a++){let t=pj(e,r);if(!t||r-t<i)return r;r-=t}return t}function _j(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function vj(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var yj=e=>e>=55296&&e<=56319,bj=e=>e>=56320&&e<=57343;function xj(e,t){return!t||t==e.length||!yj(e.charCodeAt(t-1))||!bj(e.charCodeAt(t))}function Sj(e,t,n){let r=n?.override;return r?r(e,t):(qA=(n?.scanLimit??1e9)>>1,JA=n?.timeout?Date.now()+n.timeout:0,YA=!1,cj(e,t,KA(e,0,e.length,t,0,t.length)))}function Cj(){return!YA}function wj(e,t,n){return lj(Sj(e,t,n),e,t)}var Tj=Ku.define({combine:e=>e[0]}),Ej=Nu.define(),Dj=Ku.define(),Oj=Fu.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(Ej)&&(e=n.value);for(let n of t.state.facet(Dj))e=n(e,t);return e}});function kj(e){let t=e.field(Oj,!1);if(!t)return null;let n=e.facet(Tj);return{chunks:t,side:n?n.side:null}}var Aj=class e{constructor(e,t,n,r,i,a=!0){this.changes=e,this.fromA=t,this.toA=n,this.fromB=r,this.toB=i,this.precise=a}offset(t,n){return t||n?new e(this.changes,this.fromA+t,this.toA+t,this.fromB+n,this.toB+n,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,t,n){return Nj(wj(e.toString(),t.toString(),n),e,t,0,0,Cj())}static updateA(e,t,n,r,i){return Lj(Ij(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return Lj(Ij(e,r,!1,t.length),e,t,n,i)}};function jj(e,t,n,r){let i=n.lineAt(e),a=r.lineAt(t);return i.to==e&&a.to==t&&e<n.length&&t<r.length?[e+1,t+1]:[i.from,a.from]}function Mj(e,t,n,r){let i=n.lineAt(e),a=r.lineAt(t);return i.from==e&&a.from==t?[e,t]:[i.to+1,a.to+1]}function Nj(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=jj(c.fromA+r,c.fromB+i,t,n),[d,f]=Mj(c.toA+r,c.toB+i,t,n),p=[c.offset(-l+r,-u+i)];for(;s<e.length-1;){let a=e[s+1],[o,c]=jj(a.fromA+r,a.fromB+i,t,n);if(o>d+1&&c>f+1)break;p.push(a.offset(-l+r,-u+i)),[d,f]=Mj(a.toA+r,a.toB+i,t,n),s++}o.push(new Aj(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var Pj=1e3;function Fj(e,t,n,r){let i=0,a=e.length;for(;;){if(i==a){let r=0,a=0;i&&({toA:r,toB:a}=e[i-1]);let o=t-(n?r:a);return[r+o,a+o]}let o=i+a>>1,s=e[o],[c,l]=n?[s.fromA,s.toA]:[s.fromB,s.toB];if(c>t)a=o;else if(l<=t)i=o+1;else return r?[s.fromA,s.fromB]:[s.toA,s.toB]}}function Ij(e,t,n,r){let i=[];return t.iterChangedRanges((a,o,s,c)=>{let l=0,u=n?t.length:r,d=0,f=n?r:t.length;a>Pj&&([l,d]=Fj(e,a-Pj,n,!0)),o<t.length-Pj&&([u,f]=Fj(e,o+Pj,n,!1));let p=c-s-(o-a),m,[h,g]=n?[p,0]:[0,p];i.length&&(m=i[i.length-1]).toA>=l?i[i.length-1]={fromA:m.fromA,fromB:m.fromB,toA:u,toB:f,diffA:m.diffA+h,diffB:m.diffB+g}:i.push({fromA:l,toA:u,fromB:d,toB:f,diffA:h,diffB:g})}),i}function Lj(e,t,n,r,i){if(!e.length)return t;let a=[];for(let o=0,s=0,c=0,l=0;;o++){let u=o==e.length?null:e[o],d=u?u.fromA+s:n.length,f=u?u.fromB+c:r.length;for(;l<t.length;){let e=t[l];if(u&&(e.toA+s>d||e.toB+c>f))break;a.push(e.offset(s,c)),l++}if(!u)break;let p=u.toA+s+u.diffA,m=u.toB+c+u.diffB,h=wj(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of Nj(h,n,r,d,f,Cj()))a.push(e);for(s+=u.diffA,c+=u.diffB;l<t.length;){let e=t[l];if(e.fromA+s>p&&e.fromB+c>m)break;l++}}return a}var Rj={scanLimit:500},zj=Vu.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=Yj(e))}update(e){(e.docChanged||e.viewportChanged||Vj(e.startState,e.state)||Hj(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=Yj(e.view))}},{decorations:e=>e.deco}),Bj=Wu.low(qu({class:`cm-changeGutter`,markers:e=>e.plugin(zj)?.gutter||Ru.empty}));function Vj(e,t){return e.field(Oj,!1)!=t.field(Oj,!1)}function Hj(e,t){return e.facet(Tj)!=t.facet(Tj)}var Uj=Iu.line({class:`cm-changedLine`}),Wj=Iu.mark({class:`cm-changedText`}),Gj=Iu.mark({tagName:`ins`,class:`cm-insertedLine`}),Kj=Iu.mark({tagName:`del`,class:`cm-deletedLine`}),qj=new class extends Uu{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function Jj(e,t,n,r,i,a){let o=n?e.fromA:e.fromB,s=n?e.toA:e.toB,c=0;if(o!=s){i.add(o,o,Uj),i.add(o,s,n?Kj:Gj),a&&a.add(o,o,qj);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,Uj),a&&a.add(u,u,qj);continue}let t=u+l.value.length;if(r)for(;c<e.changes.length;){let r=e.changes[c],a=o+(n?r.fromA:r.fromB),s=o+(n?r.toA:r.toB),l=Math.max(u,a),d=Math.min(t,s);if(l<d&&i.add(l,d,Wj),s<t)c++;else break}u=t}}}function Yj(e){let t=e.state.field(Oj),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(Tj),o=n==`a`,s=new zu,c=i?new zu:null,{from:l,to:u}=e.viewport;for(let n of t){if((o?n.fromA:n.fromB)>=u)break;(o?n.toA:n.toB)>l&&(!a||!a(e.state,n,s,c))&&Jj(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var Xj=class extends ju{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement(`div`);return e.className=`cm-mergeSpacer`,e.style.height=this.height+`px`,e}updateDOM(e){return e.style.height=this.height+`px`,!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}},Zj=Nu.define({map:(e,t)=>e.map(t)}),Qj=Fu.define({create:()=>Iu.none,update:(e,t)=>{for(let e of t.effects)if(e.is(Zj))return e.value;return e.map(t.changes)},provide:e=>Hu.decorations.from(e)}),$j=.01;function eM(e,t){if(e.size!=t.size)return!1;let n=e.iter(),r=t.iter();for(;n.value;){if(n.from!=r.from||Math.abs(n.value.spec.widget.height-r.value.spec.widget.height)>1)return!1;n.next(),r.next()}return!0}function tM(e,t,n){let r=new zu,i=new zu,a=e.state.field(Qj).iter(),o=t.state.field(Qj).iter(),s=0,c=0,l=0,u=0,d=e.viewport,f=t.viewport;for(let p=0;;p++){let m=p<n.length?n[p]:null,h=m?m.fromA:e.state.doc.length,g=m?m.fromB:t.state.doc.length;if(s<h){let n=e.lineBlockAt(s).top+l-(t.lineBlockAt(c).top+u);n<-$j?(l-=n,r.add(s,s,Iu.widget({widget:new Xj(-n),block:!0,side:-1}))):n>$j&&(u+=n,i.add(c,c,Iu.widget({widget:new Xj(n),block:!0,side:-1})))}if(h>s+1e3&&s<d.from&&h>d.from&&c<f.from&&g>f.from){let e=Math.min(d.from-s,f.from-c);s+=e,c+=e,p--}else if(m)s=m.toA,c=m.toB;else break;for(;a.value&&a.from<s;)l-=a.value.spec.widget.height,a.next();for(;o.value&&o.from<c;)u-=o.value.spec.widget.height,o.next()}for(;a.value;)l-=a.value.spec.widget.height,a.next();for(;o.value;)u-=o.value.spec.widget.height,o.next();let p=e.contentHeight+l-(t.contentHeight+u);p<$j?r.add(e.state.doc.length,e.state.doc.length,Iu.widget({widget:new Xj(-p),block:!0,side:1})):p>$j&&i.add(t.state.doc.length,t.state.doc.length,Iu.widget({widget:new Xj(p),block:!0,side:1}));let m=r.finish(),h=i.finish();eM(m,e.state.field(Qj))||e.dispatch({effects:Zj.of(m)}),eM(h,t.state.field(Qj))||t.dispatch({effects:Zj.of(h)})}var nM=Nu.define({map:(e,t)=>t.mapPos(e)}),rM=class extends ju{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let t=document.createElement(`div`);return t.className=`cm-collapsedLines`,t.textContent=e.state.phrase(`$ unchanged lines`,this.lines),t.addEventListener(`click`,t=>{let n=e.posAtDOM(t.target);e.dispatch({effects:nM.of(n)});let{side:r,sibling:i}=e.state.facet(Tj);i&&i().dispatch({effects:nM.of(iM(n,e.state.field(Oj),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function iM(e,t,n){let r=0,i=0;for(let a=0;;a++){let o=a<t.length?t[a]:null;if(!o||(n?o.fromA:o.fromB)>=e)return i+(e-r);[r,i]=n?[o.toA,o.toB]:[o.toB,o.toA]}}var aM=Fu.define({create(e){return Iu.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(nM)&&(e=e.update({filter:e=>e!=n.value}));if(e.size&&t.state.field(Oj)!=t.startState.field(Oj,!1)){let n=t.state.facet(Tj).side==`a`,r=[];for(let i of t.state.field(Oj))e.between(n?i.fromA:i.fromB,n?i.toA:i.toB,e=>{r.push(e)});r.length&&(e=e.update({filter:e=>r.indexOf(e)<0}))}return e},provide:e=>Hu.decorations.from(e)});function oM({margin:e=3,minSize:t=4}){return aM.init(n=>sM(n,e,t))}function sM(e,t,n){let r=new zu,i=e.facet(Tj).side==`a`,a=e.field(Oj),o=1;for(let s=0;;s++){let c=s<a.length?a[s]:null,l=s?o+t:1,u=c?e.doc.lineAt(i?c.fromA:c.fromB).number-1-t:e.doc.lines,d=u-l+1;if(d>=n&&r.add(e.doc.line(l).from,e.doc.line(u).to,Iu.replace({widget:new rM(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var cM=Hu.styleModule.of(new Xu({".cm-mergeView":{overflowY:`auto`},".cm-mergeViewEditors":{display:`flex`,alignItems:`stretch`},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:`hidden`},".cm-merge-revert":{width:`1.6em`,flexGrow:0,flexShrink:0,position:`relative`},".cm-merge-revert button":{position:`absolute`,display:`block`,width:`100%`,boxSizing:`border-box`,textAlign:`center`,background:`none`,border:`none`,font:`inherit`,cursor:`pointer`}})),lM=Hu.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:`auto !important`,overflowY:`visible !important`},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:`rgba(160, 128, 100, .08)`},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:`rgba(100, 160, 128, .08)`},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:`linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat`},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:`linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat`},"&light.cm-merge-b .cm-changedText":{background:`linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat`},"&dark.cm-merge-b .cm-changedText":{background:`linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat`},"&.cm-merge-b .cm-deletedText":{background:`#ff000033`},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:`none`},".cm-deletedChunk":{paddingLeft:`6px`,"& .cm-chunkButtons":{position:`absolute`,insetInlineEnd:`5px`},"& button":{border:`none`,cursor:`pointer`,color:`white`,margin:`0 2px`,borderRadius:`3px`,"&[name=accept]":{background:`#2a2`},"&[name=reject]":{background:`#d43`}}},".cm-collapsedLines":{padding:`5px 5px 5px 10px`,cursor:`pointer`,"&:before":{content:`"⦚"`,marginInlineEnd:`7px`},"&:after":{content:`"⦚"`,marginInlineStart:`7px`}},"&light .cm-collapsedLines":{color:`#444`,background:`linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)`},"&dark .cm-collapsedLines":{color:`#ddd`,background:`linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)`},".cm-changeGutter":{width:`3px`,paddingLeft:`1px`},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:`#e43`},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:`#fa9`},"&light.cm-merge-b .cm-changedLineGutter":{background:`#2b2`},"&dark.cm-merge-b .cm-changedLineGutter":{background:`#8f8`},".cm-inlineChangedLineGutter":{background:`#75d`}}),uM=new Mu,dM=new Mu,fM=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||Rj;let t=[Wu.low(zj),lM,cM,Qj,Hu.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(Zj)))&&this.measure()})],n=[Tj.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(Bj);let r=Bu.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],Hu.editorAttributes.of({class:`cm-merge-a`}),dM.of(n),t]}),i=[Tj.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(Bj);let a=Bu.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],Hu.editorAttributes.of({class:`cm-merge-b`}),dM.of(i),t]});this.chunks=Aj.build(r.doc,a.doc,this.diffConf);let o=[Oj.init(()=>this.chunks),uM.of(e.collapseUnchanged?oM(e.collapseUnchanged):[])];r=r.update({effects:Nu.appendConfig.of(o)}).state,a=a.update({effects:Nu.appendConfig.of(o)}).state,this.dom=document.createElement(`div`),this.dom.className=`cm-mergeView`,this.editorDOM=this.dom.appendChild(document.createElement(`div`)),this.editorDOM.className=`cm-mergeViewEditors`;let s=e.orientation||`a-b`,c=document.createElement(`div`);c.className=`cm-mergeViewEditor`;let l=document.createElement(`div`);l.className=`cm-mergeViewEditor`,this.editorDOM.appendChild(s==`a-b`?c:l),this.editorDOM.appendChild(s==`a-b`?l:c),this.a=new Hu({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new Hu({state:a,parent:l,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls==`b-to-a`,e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,t){if(e.some(e=>e.docChanged)){let n=e[e.length-1],r=e.reduce((e,t)=>e.compose(t.changes),Yu.empty(e[0].startState.doc.length));this.chunks=t==this.a?Aj.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):Aj.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:Ej.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:Ej.of(this.chunks)})]),this.scheduleMeasure()}else t.update(e)}reconfigure(e){if(`diffConfig`in e&&(this.diffConf=e.diffConfig),`orientation`in e){let t=e.orientation!=`b-a`;if(t!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let e=this.a.dom.parentNode,n=this.b.dom.parentNode;e.remove(),n.remove(),this.editorDOM.insertBefore(t?e:n,this.editorDOM.firstChild),this.editorDOM.appendChild(t?n:e),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent=``)}}if(`revertControls`in e||`renderRevertControl`in e){let t=!!this.revertDOM,n=this.revertToA,r=this.renderRevert;`revertControls`in e&&(t=!!e.revertControls,n=e.revertControls==`b-to-a`),`renderRevertControl`in e&&(r=e.renderRevertControl),this.setupRevertControls(t,n,r)}let t=`highlightChanges`in e,n=`gutter`in e,r=`collapseUnchanged`in e;if(t||n||r){let i=[],a=[];if(t||n){let r=this.a.state.facet(Tj),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(dM.reconfigure([Tj.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?Bj:[]])),a.push(dM.reconfigure([Tj.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?Bj:[]]))}if(r){let t=uM.reconfigure(e.collapseUnchanged?oM(e.collapseUnchanged):[]);i.push(t),a.push(t)}this.a.dispatch({effects:i}),this.b.dispatch({effects:a})}this.scheduleMeasure()}setupRevertControls(e,t,n){this.revertToA=t,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=n,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement(`div`),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener(`mousedown`,e=>this.revertClicked(e)),this.revertDOM.className=`cm-merge-revert`):this.revertDOM&&(this.revertDOM.textContent=``)}scheduleMeasure(){this.measuring<0&&(this.measuring=(this.dom.ownerDocument.defaultView||window).requestAnimationFrame(()=>{this.measuring=-1,this.measure()}))}measure(){tM(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,t=e.firstChild,n=this.a.viewport,r=this.b.viewport;for(let i=0;i<this.chunks.length;i++){let a=this.chunks[i];if(a.fromA>n.to||a.fromB>r.to)break;if(a.fromA<n.from||a.fromB<r.from)continue;let o=this.a.lineBlockAt(a.fromA).top+`px`;for(;t&&+t.dataset.chunk<i;)t=pM(t);t&&t.dataset.chunk==String(i)?(t.style.top!=o&&(t.style.top=o),t=t.nextSibling):e.insertBefore(this.renderRevertButton(o,i),t)}for(;t;)t=pM(t)}renderRevertButton(e,t){let n;if(this.renderRevert)n=this.renderRevert();else{n=document.createElement(`button`);let e=this.a.state.phrase(`Revert this chunk`);n.setAttribute(`aria-label`,e),n.setAttribute(`title`,e),n.textContent=this.revertToLeft?`⇜`:`⇝`}return n.style.top=e,n.setAttribute(`data-chunk`,String(t)),n}revertClicked(e){let t=e.target,n;for(;t&&t.parentNode!=this.revertDOM;)t=t.parentNode;if(t&&(n=this.chunks[t.dataset.chunk])){let[t,r,i,a,o,s]=this.revertToA?[this.b,this.a,n.fromB,n.toB,n.fromA,n.toA]:[this.a,this.b,n.fromA,n.toA,n.fromB,n.toB],c=t.state.sliceDoc(i,Math.max(i,a-1));i!=a&&s<=r.state.doc.length&&(c+=t.state.lineBreak),r.dispatch({changes:{from:o,to:Math.min(r.state.doc.length,s),insert:c},userEvent:`revert`}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}};function pM(e){let t=e.nextSibling;return e.remove(),t}var mM=new class extends Uu{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},hM=Wu.low(qu({class:`cm-changeGutter`,markers:e=>e.plugin(zj)?.gutter||Ru.empty,widgetMarker:(e,t)=>t instanceof bM?mM:null}));function gM(e){let t=typeof e.original==`string`?Lu.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||Rj;return[Wu.low(zj),TM,lM,Hu.editorAttributes.of({class:`cm-merge-b`}),Dj.of((e,t)=>{let r=t.effects.find(e=>e.is(_M));return r&&(e=Aj.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=Aj.updateB(e,t.state.field(vM),t.newDoc,t.changes,n)),e}),Tj.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?jM:void 0,side:`b`}),vM.init(()=>t),e.gutter===!1?[]:hM,e.collapseUnchanged?oM(e.collapseUnchanged):[],Oj.init(e=>Aj.build(t,e.doc,n))]}var _M=Nu.define(),vM=Fu.define({create:()=>Lu.empty,update(e,t){for(let n of t.effects)n.is(_M)&&(e=n.value.doc);return e}}),yM=new WeakMap,bM=class extends ju{constructor(e){super(),this.buildDOM=e,this.dom=null}eq(e){return this.dom==e.dom}toDOM(e){return this.dom||=this.buildDOM(e)}};function xM(e,t,n){let r=yM.get(t.changes);if(r)return r;let i=Iu.widget({block:!0,side:-1,widget:new bM(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(Tj),c=document.createElement(`div`);if(c.className=`cm-deletedChunk`,s){let t=c.appendChild(document.createElement(`div`));t.className=`cm-chunkButtons`;let n=e=>{e.preventDefault(),SM(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),CM(r,r.posAtDOM(c))};if(typeof s==`function`)t.appendChild(s(`accept`,n)),t.appendChild(s(`reject`,i));else{let r=t.appendChild(document.createElement(`button`));r.name=`accept`,r.textContent=e.phrase(`Accept`),r.onmousedown=n;let a=t.appendChild(document.createElement(`button`));a.name=`reject`,a.textContent=e.phrase(`Reject`),a.onmousedown=i}}if(n||t.fromA>=t.toA)return c;let l=r.state.field(vM).sliceString(t.fromA,t.endA),u=a&&e.facet(Gu),d=h(),f=t.changes,p=0,m=!1;function h(){let e=c.appendChild(document.createElement(`div`));return e.className=`cm-deletedLine`,e.appendChild(document.createElement(`del`))}function g(e,t,n){for(let r=e;r<t;){if(l.charAt(r)==`
12
+ `){d.firstChild||d.appendChild(document.createElement(`br`)),d=h(),r++;continue}let e=t,a=n+(m?` cm-deletedText`:``),o=!1,s=l.indexOf(`
13
+ `,r);if(s>-1&&s<t&&(e=s),i&&p<f.length){let t=Math.max(0,m?f[p].toA:f[p].fromA);t<=e&&(e=t,m&&p++,o=!0)}if(e>r){let t=document.createTextNode(l.slice(r,e));if(a){let e=d.appendChild(document.createElement(`span`));e.className=a,e.appendChild(t)}else d.appendChild(t);r=e}o&&(m=!m)}}if(u&&t.toA-t.fromA<=o){let t=u.parser.parse(l),n=0;Pu(t,{style:t=>Ju(e,t)},(e,t,r)=>{e>n&&g(n,e,``),g(e,t,r),n=t}),g(n,l.length,``)}else g(0,l.length,``);return d.firstChild||d.appendChild(document.createElement(`br`)),c})});return yM.set(t.changes,i),i}function SM(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(Oj).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=e.state.sliceDoc(i.fromB,Math.max(i.fromB,i.toB-1)),o=e.state.field(vM);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=Yu.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:_M.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function CM(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(Oj).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(vM).sliceString(i.fromA,Math.max(i.fromA,i.toA-1));return i.fromA!=i.toA&&i.toB<=n.doc.length&&(a+=n.lineBreak),e.dispatch({changes:{from:i.fromB,to:Math.min(n.doc.length,i.toB),insert:a},userEvent:`revert`}),!0}function wM(e){let t=new zu;for(let n of e.field(Oj)){let r=e.facet(Tj).overrideChunk&&DM(e,n);t.add(n.fromB,n.fromB,xM(e,n,!!r))}return t.finish()}var TM=Fu.define({create:e=>wM(e),update(e,t){return t.state.field(Oj,!1)==t.startState.field(Oj,!1)?e:wM(t.state)},provide:e=>Hu.decorations.from(e)}),EM=new WeakMap;function DM(e,t){let n=EM.get(t);if(n!==void 0)return n;n=null;let r=e.field(vM),i=e.doc,a=r.lineAt(t.endA).number-r.lineAt(t.fromA).number+1,o=i.lineAt(t.endB).number-i.lineAt(t.fromB).number+1;abort:if(a==o&&a<10){let e=[],i=0,o=t.fromA,s=t.fromB;for(let n of t.changes){if(n.fromA<n.toA){i+=n.toA-n.fromA;let t=r.sliceString(o+n.fromA,o+n.toA);if(/\n/.test(t))break abort;e.push(Iu.widget({widget:new OM(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(Wj.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return EM.set(t,n),n}var OM=class extends ju{constructor(e){super(),this.text=e}eq(e){return this.text==e.text}toDOM(e){let t=document.createElement(`del`);return t.className=`cm-deletedText`,t.textContent=this.text,t}},kM=new class extends Uu{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},AM=Iu.line({class:`cm-inlineChangedLine`});function jM(e,t,n,r){let i=DM(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,kM),n.add(o.from,o.from,AM);a<i.length&&i[a].to<=o.to;){let e=i[a++];n.add(e.from,e.to,e.value)}if(o.to>=t.endB)break;o=e.doc.lineAt(o.to+1)}return!0}var MM=Zu({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),NM=$u({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),PM=Hu.theme({".cm-deletedChunk .cm-chunkButtons":{display:`flex`,gap:`0.25rem`},".cm-deletedChunk .cm-chunkButtons button[data-slot='button']":{margin:`0`,border:`1px solid transparent`,borderRadius:`min(var(--radius-md), 10px)`,color:`var(--primary-foreground)`},".cm-deletedChunk .cm-chunkButtons button[data-slot='button'][data-variant='destructive']":{color:`var(--destructive)`}});function FM({addControl:e,nextId:t,removeControl:n,root:r}){return(i,a)=>{let o=document.createElement(`span`);o.className=`inline-flex`;let s=t();return e({id:s,host:o,type:i,action:a}),queueMicrotask(()=>{r.contains(o)||n(s)}),o}}function IM(e){let t=(0,$.c)(33),{oldContent:n,newContent:r,layout:i,conflictMode:a,previewMode:o,oursOverride:s,onResolve:c,onAbort:l}=e,{_:u}=mt(),d=s??r,f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m=(0,Q.useRef)(0),{resolvedTheme:h}=Ft(),g=(0,Q.useRef)(c),_=(0,Q.useRef)(l),[v,y]=(0,Q.useState)(null),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[0]=b):b=t[0];let[x,S]=(0,Q.useState)(b),C=WA(a===!0),w;t[1]!==l||t[2]!==c?(w=()=>{g.current=c,_.current=l},t[1]=l,t[2]=c,t[3]=w):w=t[3],(0,Q.useEffect)(w);let T,E;t[4]!==a||t[5]!==d||t[6]!==i||t[7]!==n||t[8]!==o||t[9]!==h?(T=()=>{let e=f.current;if(!e)return;S([]);let t=new Map,r=!1,s=e=>{r||!t.delete(e)||S(t=>t.filter(t=>t.id!==e))},c=new MutationObserver(()=>{for(let[n,r]of t)e.contains(r)||s(n)});c.observe(e,{childList:!0,subtree:!0});let l=h===`dark`?MM:NM,u=[Hu.editable.of(!1),Bu.readOnly.of(!0)],g=[Zd,ed(),...u,l,Hu.lineWrapping];if(p.current&&=(p.current.destroy(),null),o)p.current=new Hu({doc:d,extensions:g,parent:e}),y(null);else if(a){let i=FM({addControl:e=>{r||(t.set(e.id,e.host),S(t=>[...t,e]))},nextId:()=>(m.current+=1,m.current),removeControl:s,root:e}),a=new Hu({doc:d,extensions:[Zd,ed(),Hu.editable.of(!1),l,PM,Hu.lineWrapping,gM({original:n,highlightChanges:!0,gutter:!0,mergeControls:i,collapseUnchanged:{margin:3,minSize:4}}),Hu.updateListener.of(e=>{let t=kj(e.state);y(t?t.chunks.length:0)})],parent:e});p.current=a;let o=kj(a.state);y(o?o.chunks.length:0)}else i===`split`?p.current=new fM({a:{doc:n,extensions:g},b:{doc:d,extensions:g},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):p.current=new Hu({doc:d,extensions:[...g,gM({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:e});return()=>{r=!0,c.disconnect(),p.current&&=(p.current.destroy(),null)}},E=[n,d,i,h,a,o],t[4]=a,t[5]=d,t[6]=i,t[7]=n,t[8]=o,t[9]=h,t[10]=T,t[11]=E):(T=t[10],E=t[11]),(0,Q.useEffect)(T,E);let D;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(){let e=p.current;!e||!(e instanceof Hu)||g.current?.(e.state.doc.toString())},t[12]=D):D=t[12];let O=D,k;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(k=function(){let e=p.current;!e||!(e instanceof Hu)||Qu(e)},t[13]=k):k=t[13];let A=k,j=v===0,M;t[14]!==u||t[15]!==v?(M=v===null?``:v===0?u({id:`lPzyrU`}):vl._({id:`8FqTCr`,values:{chunksRemaining:v}}),t[14]=u,t[15]=v,t[16]=M):M=t[16];let N=M,P;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(`div`,{ref:f,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=P):P=t[17];let F;if(t[18]!==u||t[19]!==x){let e;t[21]===u?e=t[22]:(e=e=>(0,Kw.createPortal)((0,Z.jsx)(X,{type:`button`,variant:e.type===`accept`?`default`:`destructive`,size:`xs`,onClick:t=>{e.action(t.nativeEvent)},children:e.type===`accept`?u({id:`g3UF2V`}):u({id:`1t_NnN`})}),e.host,e.id),t[21]=u,t[22]=e),F=x.map(e),t[18]=u,t[19]=x,t[20]=F}else F=t[20];let I;t[23]!==j||t[24]!==C||t[25]!==a||t[26]!==N||t[27]!==l||t[28]!==c?(I=a&&(0,Z.jsxs)(`div`,{ref:C,className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${j?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:N}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&(0,Z.jsx)(X,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:l,children:(0,Z.jsx)(J,{id:`XyOUTJ`})}),(0,Z.jsx)(X,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:A,children:`Undo`}),c&&(0,Z.jsx)(X,{variant:`default`,size:`sm`,disabled:!j,onClick:O,children:(0,Z.jsx)(J,{id:`Lcehxn`})})]})]}),t[23]=j,t[24]=C,t[25]=a,t[26]=N,t[27]=l,t[28]=c,t[29]=I):I=t[29];let L;return t[30]!==I||t[31]!==F?(L=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[P,F,I]}),t[30]=I,t[31]=F,t[32]=L):L=t[32],L}async function LM(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 RM(e,t){return LM(e,`content`,t)}async function zM(e){return LM(e,`mine`)}async function BM(e){return LM(e,`theirs`)}async function VM(e){return LM(e,`delete`)}async function HM(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 UM(e){let t=(0,$.c)(86),{docName:n}=e,{_:r}=mt(),{conflicts:i,loading:a}=Ss(),o;if(t[0]!==i||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>su(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=WA(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),HM(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 RM(c,e);t.ok||dl.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),dl.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)(J,{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)(J,{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)(IM,{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)(J,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===w?a=t[30]:(a=()=>void w(VM),t[29]=w,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(J,{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(BM),t[35]=w,t[36]=u);let d;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(J,{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)(IM,{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)(J,{id:`EhDLBx`,values:n,components:r})}),t[56]=n,t[57]=i);let a;t[58]===w?a=t[59]:(a=()=>void w(zM),t[58]=w,t[59]=a);let o;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(J,{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(VM),t[64]=w,t[65]=u);let d;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(J,{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)(IM,{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 WM(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(et(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 GM=`__back-nav__`;function KM(e){return e instanceof pe||e instanceof Be||e instanceof le||e instanceof Ee||e instanceof Je||e instanceof Xe?e.docName:null}function qM(e){return e instanceof pe||e instanceof Be}function JM(e){if(e instanceof pe){let t=e.docName;return{title:vl._({id:`Jejur6`}),summary:vl._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof Be){let t=e.docName;return{title:vl._({id:`V7QxyT`}),summary:vl._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof le){let t=e.docName;return{title:vl._({id:`1di5fu`}),summary:vl._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof Ee){let t=e.docName;return{title:vl._({id:`wvbc1r`}),summary:vl._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof Je)return{title:vl._({id:`Gfr4fu`}),summary:vl._({id:`UW2Fg3`})};if(e instanceof Xe){let t=e.docName;return{title:vl._({id:`vv7kpg`}),summary:vl._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:vl._({id:`W5A0Ly`});return{title:vl._({id:`29VNqC`}),summary:t}}function YM(e){let t=(0,$.c)(37),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,s;t[0]===n?s=t[1]:(s=JM(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&&qM(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]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(Yp,{size:80,variant:`sleeping`}),t[4]=v):v=t[4];let y;t[5]===c?y=t[6]:(y=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:c}),t[5]=c,t[6]=y);let b;t[7]===l?b=t[8]:(b=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:l}),t[7]=l,t[8]=b);let x;t[9]!==y||t[10]!==b?(x=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[y,b]}),t[9]=y,t[10]=b,t[11]=x):x=t[11];let S;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(J,{id:`KDw4GX`}),t[12]=S):S=t[12];let C;t[13]===r?C=t[14]:(C=(0,Z.jsx)(X,{ref:d,variant:`default`,onClick:r,children:S}),t[13]=r,t[14]=C);let w;t[15]===h?w=t[16]:(w=h?(0,Z.jsx)(X,{variant:`secondary`,onClick:()=>{Sy(h).then(ZM).catch(XM)},children:(0,Z.jsx)(J,{id:`uaUc6t`})}):null,t[15]=h,t[16]=w);let T;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(T=m?(0,Z.jsx)(X,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>p(!0),children:(0,Z.jsx)(J,{id:`ii5mVn`})}):null,t[17]=T):T=t[17];let E;t[18]!==i||t[19]!==u||t[20]!==n||t[21]!==o||t[22]!==a||t[23]!==r?(E=u?(0,Z.jsx)(X,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(Ne(KM(n)??i),o(a),r(GM))},children:(0,Z.jsx)(J,{id:`CKyk7Q`})}):null,t[18]=i,t[19]=u,t[20]=n,t[21]=o,t[22]=a,t[23]=r,t[24]=E):E=t[24];let D;t[25]!==w||t[26]!==E||t[27]!==C?(D=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[C,w,T,E]}),t[25]=w,t[26]=E,t[27]=C,t[28]=D):D=t[28];let O;t[29]!==i||t[30]!==n||t[31]!==f?(O=m?(0,Z.jsx)(im,{open:f,onOpenChange:p,crashContext:{source:`document view`,docName:KM(n)??i,errorMessage:n instanceof Error&&n.message?n.message:String(n)}}):null,t[29]=i,t[30]=n,t[31]=f,t[32]=O):O=t[32];let k;return t[33]!==D||t[34]!==O||t[35]!==x?(k=(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:[v,x,D,O]}),t[33]=D,t[34]=O,t[35]=x,t[36]=k):k=t[36],k}function XM(){}function ZM(e){e.ok||dl.error(e.message,{id:`server-restart-error`,duration:1/0})}function QM(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)(YM,{...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]===GM){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=>{console.error(`[DocumentErrorBoundary] rendered fallback for ${n}: ${JM(e).title}`,e)},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)(qt,{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 $M(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=wi(t);return{map:n,keys:ea(t),parseError:r}}function eN(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>$M(n),t[0]=n,t[1]=r);let[i,a]=(0,Q.useState)(r),o,s;t[2]===n?(o=t[3],s=t[4]):(o=()=>{let e=ui(n);a(e.current());let t=e.subscribe(e=>{a(e)});return()=>{t(),e.dispose()}},s=[n],t[2]=n,t[3]=o,t[4]=s),(0,Q.useEffect)(o,s);let c;t[5]===i.map.icon?c=t[6]:(c=we(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=Ie(i.map.cover),t[7]=i.map.cover,t[8]=u);let d=u,f=d.kind===`url`||d.kind===`path`,p=l.kind!==`unsupported`;if(!f&&!p)return null;let m=f?`true`:`false`,h=p?`true`:`false`,g;t[9]!==d||t[10]!==f?(g=f?(0,Z.jsx)(tN,{cover:d}):null,t[9]=d,t[10]=f,t[11]=g):g=t[11];let _;t[12]!==f||t[13]!==p||t[14]!==l?(_=p?(0,Z.jsx)(nN,{icon:l,hasCover:f}):null,t[12]=f,t[13]=p,t[14]=l,t[15]=_):_=t[15];let v;return t[16]!==m||t[17]!==h||t[18]!==g||t[19]!==_?(v=(0,Z.jsxs)(`div`,{className:`page-header editor-content-aligned`,"data-has-cover":m,"data-has-icon":h,"aria-hidden":`true`,"data-testid":`page-header`,children:[g,_]}),t[16]=m,t[17]=h,t[18]=g,t[19]=_,t[20]=v):v=t[20],v}function tN(e){let t=(0,$.c)(2),{cover:n}=e,r;return t[0]===n.value?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`page-header-cover`,"data-testid":`page-header-cover`,children:(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,loading:`lazy`,referrerPolicy:`no-referrer`,className:`page-header-cover-img`})}),t[0]=n.value,t[1]=r),r}function nN(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}function rN(e,t){if(!t)return{kind:`absent`};if(t.getClientRects().length===0)return{kind:`unmeasurable`};let n=e.getBoundingClientRect().top;return{kind:`measured`,contentPos:t.getBoundingClientRect().top-n+e.scrollTop}}function iN(e,t,n){if(t===null)return e;switch(n.kind){case`measured`:return n.contentPos+t;case`absent`:return e;case`unmeasurable`:return null;default:return oN(n)}}function aN(e){switch(e.kind){case`measured`:case`absent`:return!0;case`unmeasurable`:return!1;default:return oN(e)}}function oN(e){throw Error(`Unhandled AnchorMeasurement variant: ${JSON.stringify(e)}`)}function sN(e,t){return Math.abs(e-t)<=1}function cN(e,t){return t-e>1}var lN=1e4,uN=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{ManagedArtifactProperties:e}=await import(`./ManagedArtifactProperties-9e_jj3hZ.js`);return{ManagedArtifactProperties:e}},__vite__mapDeps([139,1,6,2,3,7,8,9,10,11,12,15,16,72,73,74,75,76,77,78,79,80,81,82,83,31,84,68,22,85,86,87,47,4,88,30,14,17,19,49,24,25,29,18,20,36,35,23,26,27,89,90,37,38,40,61,62,63,43,65,91,92,28,32,60,64,66,67,93,94,95,96,33,21,97,98,99,100,39,41,101,102,140,111,13,112,113,50,141,142,127,136,143,42,123]),import.meta.url)).ManagedArtifactProperties})),dN=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{MermaidDocEditor:e}=await import(`./MermaidDocEditor-BNURUYJE.js`);return{MermaidDocEditor:e}},__vite__mapDeps([144,1,73,74,9,145,79,84,6,2,3,7,8,68,12,22,11,85,86,87,10,90,75,76,77,78,80,81,82,83,31,47,15,16,26,37,38,40,17,61,62,63,43,65,146]),import.meta.url)).MermaidDocEditor})),fN=ou(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function pN(e){let t=e.threshold??fN;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function mN(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var hN=ou(`ACTIVITY_MOUNT_LIMIT`,3);function gN(){return n(()=>import(`./SourceEditor-DI6JkRTr.js`),__vite__mapDeps([147,1,73,74,9,145,79,6,2,3,7,8,84,68,12,22,11,85,86,87,72,75,76,77,78,80,81,82,83,31,47,10,4,88,30,14,15,16,17,19,49,24,25,29,18,20,36,35,23,26,27,89,90,37,38,40,61,62,63,43,65,91,92,28,32,60,64,66,67,93,94,95,96,33,21,97,98,99,100,39,41,101,102,146,148,48,50,51,120,149,132,70,134,136,122,143]),import.meta.url)}var _N=(0,Q.lazy)(async()=>({default:(await gN()).SourceEditor}));function vN(e,t,n){if(n<=0)return[];let r=e.filter(e=>!be(e.docName)),i=[...r].sort((e,t)=>t.lastAccessedAt-e.lastAccessedAt).slice(0,n);if(t===null||i.some(e=>e.docName===t))return i;let a=r.find(e=>e.docName===t);return a?[...i.slice(0,n-1),a]:i}function yN(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:vl._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?vl._({id:`Sc1bKE`,values:{docName:e}}):vl._({id:`ovIGrT`,values:{docName:e}}),actionLabel:vl._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:vl._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?vl._({id:`bmC18N`,values:{docName:e}}):vl._({id:`pAgkuZ`,values:{docName:e}})}:null}function bN(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(au,{name:`activity-pool`,children:(0,Z.jsx)(xN,{...e})}),t[0]=e,t[1]=n),n}function xN(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=Re(),{pages:u,loading:d}=Bo(),f=vN(c,n,hN),p=(0,Q.useRef)(``),m=f.map(SN).join(`,`),h=(0,Q.useRef)(c),g,_;t[0]===c?(g=t[1],_=t[2]):(g=()=>{h.current=c},_=[c],t[0]=c,t[1]=g,t[2]=_),(0,Q.useLayoutEffect)(g,_),(0,Q.useLayoutEffect)(()=>{if(p.current===m)return;let e=p.current?p.current.split(`,`):[],t=m?m.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)xe(e);for(let e of i){let t=h.current.find(t=>t.docName===e)?.poolEventId;Le(e,t&&t.length>0?t:crypto.randomUUID())}iu(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=m,Ve(t)},[m,n]);let v;t[3]!==n||t[4]!==i||t[5]!==r||t[6]!==d||t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==a||t[11]!==l?(v=e=>(0,Z.jsx)(jN,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName)&&!fa(e.docName)&&!Fi(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=v):v=t[12];let y=f.map(v),b;return t[13]===y?b=t[14]:(b=(0,Z.jsx)(Z.Fragment,{children:y}),t[13]=y,t[14]=b),b}function SN(e){return e.docName}var CN=256,wN=new Map;function TN(e,t){if(wN.delete(e),wN.set(e,t),wN.size>CN){let e=wN.keys().next().value;e!==void 0&&wN.delete(e)}}function EN(e){let t=(0,$.c)(15),{isActive:n,docName:r,initialScrollTop:i,bodyAnchorRef:a,children:o}=e,s=(0,Q.useRef)(null),c=(0,Q.useRef)(i??0),l=(0,Q.useRef)(null),u=(0,Q.useRef)(n),d=(0,Q.useRef)(!1),f,p;t[0]===n?(f=t[1],p=t[2]):(f=()=>{u.current=n},p=[n],t[0]=n,t[1]=f,t[2]=p),(0,Q.useEffect)(f,p);let m,h;t[3]!==a||t[4]!==r?(m=()=>{let e=s.current;if(!e)return;let t=()=>{if(!(!u.current||d.current)&&e.scrollTop>0){let t=rN(e,a?.current);if(!aN(t))return;c.current=e.scrollTop,l.current=t.kind===`measured`?t.contentPos:null,t.kind===`measured`&&TN(r,e.scrollTop-t.contentPos)}};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},h=[a,r],t[3]=a,t[4]=r,t[5]=m,t[6]=h):(m=t[5],h=t[6]),(0,Q.useEffect)(m,h);let g,_;t[7]!==a||t[8]!==r||t[9]!==n?(g=()=>{if(!n)return;let e=s.current;if(!e)return;let t=c.current,i=wN.get(r),o=l.current===null?null:t-l.current,u=i??o;if(t===0&&u===null)return;let f=()=>iN(t,u,rN(e,a?.current));d.current=!0;let p=e.style.overflowAnchor;e.style.overflowAnchor=`none`;let m=performance.now(),h=!1,g=!1,_=f();_!==null&&(e.scrollTop=_,sN(e.scrollTop,_)&&e.scrollHeight>_&&(g=!0,iu(`ok/scroll-restore/phase1-success`,{target:_,elapsedMs:performance.now()-m})));let v=e.scrollTop,y=!1,b=0,x=()=>{y||(y=!0,d.current=!1,e.style.overflowAnchor=p,cancelAnimationFrame(b),clearTimeout(w),e.removeEventListener(`wheel`,S),e.removeEventListener(`touchstart`,S),e.removeEventListener(`mousedown`,S),e.removeEventListener(`keydown`,S))},S=()=>{g||iu(`ok/scroll-restore/yielded`,{reason:`user`,elapsedMs:performance.now()-m,finalScrollTop:e.scrollTop}),x()};e.addEventListener(`wheel`,S,{passive:!0}),e.addEventListener(`touchstart`,S,{passive:!0}),e.addEventListener(`mousedown`,S),e.addEventListener(`keydown`,S);let C=()=>{if(!y){if(cN(v,e.scrollTop)){g||iu(`ok/scroll-restore/yielded`,{reason:`external`,elapsedMs:performance.now()-m,finalScrollTop:e.scrollTop}),x();return}_=f(),_!==null&&!sN(e.scrollTop,_)&&e.scrollHeight>_&&(e.scrollTop=_,sN(e.scrollTop,_)&&!h&&(iu(`ok/scroll-restore/phase2-success`,{target:_,elapsedMs:performance.now()-m}),h=!0,g=!0)),v=e.scrollTop,b=requestAnimationFrame(C)}};b=requestAnimationFrame(C);let w=setTimeout(()=>{if(y)return;let t=f();(t===null||!sN(e.scrollTop,t)&&e.scrollHeight>t)&&iu(`ok/scroll-restore/abandoned`,{...t===null?{}:{target:t},anchorMeasurable:t!==null,elapsedMs:performance.now()-m,scrollHeight:e.scrollHeight,finalScrollTop:e.scrollTop}),x()},lN);return x},_=[n,a,r],t[7]=a,t[8]=r,t[9]=n,t[10]=g,t[11]=_):(g=t[10],_=t[11]),(0,Q.useLayoutEffect)(g,_);let v;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(v={overflowAnchor:`auto`},t[12]=v):v=t[12];let y;return t[13]===o?y=t[14]:(y=(0,Z.jsx)(`div`,{ref:s,"data-testid":`editor-scroll-container`,className:`editor-doc-scroll subtle-scrollbar h-full overflow-y-auto pt-14 scroll-pt-14`,style:v,children:o}),t[13]=o,t[14]=y),y}function DN(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)(sC,{}),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)(_N,{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 ON(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)(Xc,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(Gc,{className:`size-5 animate-spin`,"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:kN,children:[(0,Z.jsx)(Xc,{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 kN(){return window.location.reload()}function AN(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 jN(e){let t=(0,$.c)(57),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a,isNewDoc:o,previousDocName:s,onNavigateBack:c,onRecycle:l,serverRestartRecovery:u}=e,d;t[0]!==n.docName||t[1]!==u?(d=yN(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=WT(n.docName)===`conflict`,m;t[3]===n.docName?m=t[4]:(m=Fi(n.docName),t[3]=n.docName,t[4]=m);let h=m,g;t[5]===n.docName?g=t[6]:(g=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-portal`,n.docName),e.style.display=`contents`,e},t[5]=n.docName,t[6]=g);let[_]=(0,Q.useState)(g),v=(0,Q.useRef)(null),y=n.provider.document.getText(`source`).length,[b,x]=(0,Q.useState)(i),[S,C]=(0,Q.useState)(!i),w,T;t[7]!==i||t[8]!==b||t[9]!==S?(w=()=>{i&&!b?x(!0):!i&&!S&&C(!0)},T=[i,b,S],t[7]=i,t[8]=b,t[9]=S,t[10]=w,t[11]=T):(w=t[10],T=t[11]),(0,Q.useEffect)(w,T);let E=pN({ytextLength:y,isSourceMode:i,visitedSource:b,visitedVisual:S}),D=(0,Q.useRef)(``),O=`${E.isLarge}-${E.renderSource}-${E.renderVisual}`,k,A;t[12]!==n.docName||t[13]!==E.isLarge||t[14]!==E.renderSource||t[15]!==E.renderVisual||t[16]!==O||t[17]!==i||t[18]!==y?(k=()=>{D.current!==O&&(D.current=O,E.isLarge&&iu(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:y,isSourceMode:i,renderSource:E.renderSource,renderVisual:E.renderVisual}))},A=[O,E.isLarge,E.renderSource,E.renderVisual,n.docName,y,i],t[12]=n.docName,t[13]=E.isLarge,t[14]=E.renderSource,t[15]=E.renderVisual,t[16]=O,t[17]=i,t[18]=y,t[19]=k,t[20]=A):(k=t[19],A=t[20]),(0,Q.useEffect)(k,A);let j;t[21]===n.docName?j=t[22]:(j=()=>de(n.docName),t[21]=n.docName,t[22]=j);let[M]=(0,Q.useState)(j),N=M?.html??null,[P,F]=(0,Q.useState)(!1),I,R;t[23]!==n.docName||t[24]!==E.isLarge||t[25]!==E.renderSource||t[26]!==E.renderVisual||t[27]!==P||t[28]!==i||t[29]!==y?(R=()=>{mN({isLarge:E.isLarge,renderSource:E.renderSource,renderVisual:E.renderVisual,hasEmittedFirstToggle:P})&&(iu(`ok/cold/first-toggle`,{docName:n.docName,mountId:Ue(n.docName),ytextLength:y,modeEnteredFirst:i?`source`:`visual`}),F(!0))},I=[P,E.isLarge,E.renderSource,E.renderVisual,n.docName,y,i],t[23]=n.docName,t[24]=E.isLarge,t[25]=E.renderSource,t[26]=E.renderVisual,t[27]=P,t[28]=i,t[29]=y,t[30]=I,t[31]=R):(I=t[30],R=t[31]),(0,Q.useEffect)(R,I);let z=r?`visible`:`hidden`,B=`editor:${n.docName}`,V=M?.scrollTop,H;t[32]!==a||t[33]!==n||t[34]!==E.renderSource||t[35]!==E.renderVisual||t[36]!==r||t[37]!==p||t[38]!==h||t[39]!==o||t[40]!==i||t[41]!==c||t[42]!==l||t[43]!==_||t[44]!==s||t[45]!==f||t[46]!==N?(H=f?(0,Z.jsx)(ON,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(QM,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:N?(0,Z.jsx)(AN,{html:N}):(0,Z.jsx)(sC,{}),children:(0,Z.jsx)(WM,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(UM,{docName:n.docName,provider:n.provider}):h?(0,Z.jsx)(dN,{docName:n.docName,provider:n.provider,isSourceMode:i}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(fa(n.docName)||L(n.docName)?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(uN,{docName:n.docName,provider:n.provider})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(eN,{provider:n.provider}),(0,Z.jsx)(jo,{provider:n.provider})]})),(0,Z.jsx)(`div`,{ref:v,"aria-hidden":!0,className:`h-0`}),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[E.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(DN,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,E.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(zA,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:_},`${n.docName}-${String(o)}-${n.poolEventId}`)}):null]})]})})})})}),t[32]=a,t[33]=n,t[34]=E.renderSource,t[35]=E.renderVisual,t[36]=r,t[37]=p,t[38]=h,t[39]=o,t[40]=i,t[41]=c,t[42]=l,t[43]=_,t[44]=s,t[45]=f,t[46]=N,t[47]=H):H=t[47];let U;t[48]!==n.docName||t[49]!==r||t[50]!==V||t[51]!==H?(U=(0,Z.jsx)(EN,{isActive:r,docName:n.docName,initialScrollTop:V,bodyAnchorRef:v,children:H}),t[48]=n.docName,t[49]=r,t[50]=V,t[51]=H,t[52]=U):U=t[52];let ee;return t[53]!==z||t[54]!==B||t[55]!==U?(ee=(0,Z.jsx)(Q.Activity,{mode:z,name:B,children:U}),t[53]=z,t[54]=B,t[55]=U,t[56]=ee):ee=t[56],ee}function MN(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function NN(e){let{value:t,unit:n}=MN(e);return n===`rem`?t*16:t}function PN(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var FN=3600*24*7;function IN(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?LN:m,O=g===void 0?FN: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,ee;t[0]===r?(U=t[1],ee=t[2]):(U=()=>{V.current=r},ee=[r],t[0]=r,t[1]=U,t[2]=ee),(0,Q.useEffect)(U,ee);let W,G;t[3]===y?(W=t[4],G=t[5]):(W=()=>{H.current=y},G=[y],t[3]=y,t[4]=W,t[5]=G),(0,Q.useEffect)(W,G);let K=NN(b),te;t[6]===x?te=t[7]:(te=NN(x),t[6]=x,t[7]=te);let ne=te,q;t[8]!==E||t[9]!==k?(q=function(e){E&&(P.current=!0,j.current=H.current?0:NN(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]=q):q=t[10];let re=q,ie,ae;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==ne||t[18]!==K||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(ie=()=>{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}=MN(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(ne,t)),u=PN(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(ne,u)),f=PN(o===`rem`?d/16:d,o);i(f),e(f)}},o=function(){P.current&&(!N.current&&a&&S&&a(),N.current=!1,P.current=!1,F.current=null,I.current=0,L.current=!1,R.current=0,z.current=0,B.current=null,D(!1))};return document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,o),()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,o)}},ae=[i,a,D,K,ne,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]=ne,t[18]=K,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ie,t[25]=ae):(ie=t[24],ae=t[25]),(0,Q.useEffect)(ie,ae);let oe;return t[26]===re?oe=t[27]:(oe={dragRef:A,isDragging:N,handleMouseDown:re},t[26]=re,t[27]=oe),oe}function LN(){}var RN=3600*24*7,zN=`18rem`,BN=`3rem`,VN=`app-file-sidebar`,HN=`14.625rem`,UN=`32rem`,WN=`sidebar_width`,GN=/^\d+(?:\.\d+)?(?:rem|px)$/,KN=Q.createContext(null);function qN(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${WN}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return GN.test(n)?n:e}function JN(){let e=Q.use(KN);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function YN(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?zN:c,[u]=Q.useState(ZN),d;t[8]===u?d=t[9]:(d=()=>eE(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>qN(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=sE();return lE(`left`,eE(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),uE(`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(XN)},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: ${ZT}px)`),t=()=>{let e=eE(u,window.innerWidth,`left`);p(e),C(lE(`left`,e,sE())===`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(VN)?.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=>{e.key===`Escape`&&(document.querySelector(`[data-state="open"][role="dialog"], [data-state="open"][role="alertdialog"], [data-state="open"][role="menu"], [data-state="open"][role="listbox"], [data-radix-popper-content-wrapper] [data-state="open"]`)||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=>{xl(e,`toggle-files-sidebar`)&&(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":BN,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let ee=U,W;t[48]===r?W=t[49]:(W=Y(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[48]=r,t[49]=W);let G;t[50]!==n||t[51]!==a||t[52]!==ee||t[53]!==W?(G=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:ee,className:W,...a,children:n}),t[50]=n,t[51]=a,t[52]=ee,t[53]=W,t[54]=G):G=t[54];let K;return t[55]!==H||t[56]!==G?(K=(0,Z.jsx)(KN.Provider,{value:H,children:G}),t[55]=H,t[56]=G,t[57]=K):K=t[57],K}function XN(e){return!e}function ZN(){return Li()}function QN(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}=mt(),{state:f,isDraggingRail:p}=JN();if(u===`none`){let e;t[7]===r?e=t[8]:(e=Y(`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=Y(`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=Y(`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:VN,"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 $N(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}=mt(),{toggleSidebar:o,state:s}=JN(),c,l,u,d,f,p,m,h;if(t[4]!==a||t[5]!==s){let e=El(`toggle-files-sidebar`);c=X,l=`trigger`,u=`sidebar-trigger`,d=`ghost`,f=`icon-sm`,p=s===`expanded`,m=VN,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=Y(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)(ae,{}):(0,Z.jsx)(Zh,{}),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 eP(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}=mt(),{toggleSidebar:u,setWidth:d,state:f,width:p,setIsDraggingRail:m}=JN(),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:HN,maxResizeWidth:UN,setIsDraggingRail:m,widthCookieName:WN,widthCookieMaxAge:RN},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}=IN(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=Y(`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 tP(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}=JN(),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=Y(`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 nP(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=Y(`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 rP(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=Y(`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 iP(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=Y(`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 aP(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=Y(`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 oP(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?Jt:`div`,o;t[4]===n?o=t[5]:(o=Y(`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 sP(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?Jt:`button`,o;t[4]===n?o=t[5]:(o=Y(`absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>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-action`,"data-sidebar":`group-action`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function cP(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=Y(`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 lP(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=Y(`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 uP(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=Y(`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 dP=Zt(`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 fP(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?Jt:`button`,{state:m}=JN(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=Y(dP({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)(rn,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(an,{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)(sn,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function pP(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,asChild:i,showOnHover:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?!1:i,s=a===void 0?!1:a,c=o?Jt:`button`,l=s&&`group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0`,u;t[5]!==n||t[6]!==l?(u=Y(`absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,l,n),t[5]=n,t[6]=l,t[7]=u):u=t[7];let d;return t[8]!==c||t[9]!==r||t[10]!==u?(d=(0,Z.jsx)(c,{"data-slot":`sidebar-menu-action`,"data-sidebar":`menu-action`,className:u,...r}),t[8]=c,t[9]=r,t[10]=u,t[11]=d):d=t[11],d}function mP(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=Y(`mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden`,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-sub`,"data-sidebar":`menu-sub`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function hP(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=Y(`group/menu-sub-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-sub-item`,"data-sidebar":`menu-sub-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function gP(e){let t=(0,$.c)(14),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({asChild:i,size:a,isActive:o,className:n,...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?!1:i,c=a===void 0?`md`:a,l=o===void 0?!1:o,u=s?Jt:`a`,d;t[6]===n?d=t[7]:(d=Y(`flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden 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-[size=md]:text-sm data-[size=sm]:text-xs data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground data-active:hover:bg-sidebar-accent [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground`,n),t[6]=n,t[7]=d);let f;return t[8]!==u||t[9]!==l||t[10]!==r||t[11]!==c||t[12]!==d?(f=(0,Z.jsx)(u,{"data-slot":`sidebar-menu-sub-button`,"data-sidebar":`menu-sub-button`,"data-size":c,"data-active":l,className:d,...r}),t[8]=u,t[9]=l,t[10]=r,t[11]=c,t[12]=d,t[13]=f):f=t[13],f}function _P(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 vP(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=Na.safeParse(t);return n.success?n.data.currentBranch??null:null}var yP=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:_P({fetchBranch:vP,subscribeToEvent:$l}),bP=yP.subscribe,xP=yP.getSnapshot;function SP(){return(0,Q.useSyncExternalStore)(bP,xP,xP)}function CP(){let e=(0,$.c)(6),t=SP(),n=sd(),{state:r}=JN(),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&&fs(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 wP(e){let t=(0,$.c)(30),{stats:n,selectionStats:r,showStats:i,composerBadge:a,reserveRightGutter:o}=e,s=i===void 0?!0:i,c=o===void 0?!1:o,{_:l}=mt(),u=CP();if(!s&&u===null&&a==null)return null;let d=r??n,f=r!=null,{words:p,chars:m,tokens:h}=d,g;t[0]!==l||t[1]!==f||t[2]!==s?(g=l(s?f?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=l,t[1]=f,t[2]=s,t[3]=g):g=t[3];let _=c&&`pr-12`,v;t[4]===_?v=t[5]:(v=Y(`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,_),t[4]=_,t[5]=v);let y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=(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[6]=y):y=t[6];let b;t[7]!==l||t[8]!==a?(b=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)(Ks,{className:`size-3`,"aria-hidden":!0}),l({id:`xWEvuo`}),(0,Z.jsx)(Fr,{className:`size-3`,"aria-hidden":!0})]}):null,t[7]=l,t[8]=a,t[9]=b):b=t[9];let x;t[10]===u?x=t[11]:(x=u===null?null:(0,Z.jsx)(TP,{identity:u}),t[10]=u,t[11]=x);let S;t[12]===x?S=t[13]:(S=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:x}),t[12]=x,t[13]=S);let C;t[14]!==l||t[15]!==d.chars||t[16]!==d.tokens||t[17]!==d.words||t[18]!==m||t[19]!==f||t[20]!==s||t[21]!==h||t[22]!==p?(C=s?(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[f?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:l({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.words.toLocaleString()}),` `,(0,Z.jsx)(J,{id:`gljvbT`,values:{words:p}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.chars.toLocaleString()}),` `,(0,Z.jsx)(J,{id:`d5rK4X`,values:{chars:m}})]}),(0,Z.jsxs)(`span`,{children:[d.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.tokens.toLocaleString()}),` `,(0,Z.jsx)(J,{id:`uynXup`,values:{tokens:h}})]})]}):null,t[14]=l,t[15]=d.chars,t[16]=d.tokens,t[17]=d.words,t[18]=m,t[19]=f,t[20]=s,t[21]=h,t[22]=p,t[23]=C):C=t[23];let w;return t[24]!==C||t[25]!==g||t[26]!==v||t[27]!==b||t[28]!==S?(w=(0,Z.jsxs)(`section`,{"aria-label":g,className:v,children:[y,b,S,C]}),t[24]=C,t[25]=g,t[26]=v,t[27]=b,t[28]=S,t[29]=w):w=t[29],w}function TP(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)(sn,{children:[(0,Z.jsx)(rn,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(an,{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)(co,{"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 EP(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}=mt(),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=Y(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 DP(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=Y(`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 OP(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=Y(`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 kP(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=Y(`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 AP(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=Y(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(Lo,{}),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 jP=1,MP=2,NP=4;function PP(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=Ii(n),u=e?e.kind===`template`?e.folder.split(`/`).filter(Boolean):[]:oe(n,``).prefix.replace(/\/$/,``).split(`/`).filter(Boolean);if(u.length===0){l=null;break bb0}let d=(e,t)=>({kind:`segment`,value:e,key:u.slice(0,t+1).join(`/`)}),f=u.length>NP?[...u.slice(0,jP).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(jP,-MP)},...u.slice(-MP).map((e,t)=>d(e,u.length-MP+t))]:u.map((e,t)=>d(e,t));a=EP,t[8]===r?c=t[9]:(c=Y(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=DP,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(FP)}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 FP(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(AP,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(OP,{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)(wh,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(OP,{className:`min-w-0`,children:(0,Z.jsx)(kP,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var IP=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillEditorActions:e}=await import(`./SkillEditorActions-AGeWFFyT.js`);return{SkillEditorActions:e}},__vite__mapDeps([150,1,6,2,3,7,8,9,10,11,12,15,16,112,14,17,113,30,31,19,49,24,25,50,20,92,22,26,36,119,47,23,27,114,118,105,93,32,37,33,120,98,38,99,121,68,106,39,41,87,64,122,66,44,123,124]),import.meta.url)).SkillEditorActions}));function LP(e){let t=(0,$.c)(94),{activeDocName:n,isSourceMode:r,sourceDisabled:i,onModeChange:a,showAddPropertyButton:o,onAddProperty:s,isPanelCollapsed:c,onTogglePanel:l,reserveRightGutter:u}=e,d=u===void 0?!1:u,{_:f}=mt(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=kl(`toggle-document-panel`),t[0]=p):p=t[0];let m=p,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A;if(t[1]!==f||t[2]!==n||t[3]!==c||t[4]!==r||t[5]!==s||t[6]!==a||t[7]!==l||t[8]!==d||t[9]!==o||t[10]!==i){_=El(`toggle-document-panel`);let e;t[27]===n?e=t[28]:(e=n?Ii(n):null,t[27]=n,t[28]=e);let u=e,p;t[29]===n?p=t[30]:(p=n?L(n):null,t[29]=n,t[30]=p);let m=p,j;t[31]!==u||t[32]!==m?(j=u?.kind===`skill`?{scope:u.scope,name:u.name}:m?{scope:`project`,name:m}:null,t[31]=u,t[32]=m,t[33]=j):j=t[33];let M=j;x=`editor-toolbar`,S=`pointer-events-none absolute inset-x-0 top-0 z-10`;let N;t[34]!==n||t[35]!==M?(N=M?null:(0,Z.jsx)(PP,{docName:n}),t[34]=n,t[35]=M,t[36]=N):N=t[36];let P;t[37]===n?P=t[38]:(P=n===null?null:(0,Z.jsx)(ef,{entry:{kind:`document`,docName:n},className:`shrink-0`}),t[37]=n,t[38]=P);let F;t[39]!==N||t[40]!==P?(F=(0,Z.jsxs)(`div`,{className:`pointer-events-auto flex min-w-0 items-center gap-2`,children:[N,P]}),t[39]=N,t[40]=P,t[41]=F):F=t[41];let I;t[42]!==r||t[43]!==a||t[44]!==i?(I=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsx)(rf,{isSourceMode:r,onModeChange:a,sourceDisabled:i})}),t[42]=r,t[43]=a,t[44]=i,t[45]=I):I=t[45],t[46]!==F||t[47]!==I?(C=(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:[F,I]})}),t[46]=F,t[47]=I,t[48]=C):C=t[48];let R=d&&`pr-9`;t[49]===R?v=t[50]:(v=Y(`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,R),t[49]=R,t[50]=v),t[51]===M?y=t[52]:(y=M?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(IP,{scope:M.scope,name:M.name})}):null,t[51]=M,t[52]=y),t[53]!==f||t[54]!==s||t[55]!==o?(b=o&&(0,Z.jsxs)(sn,{children:[(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:s,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(rn,{children:(0,Z.jsx)(Uh,{})})}),(0,Z.jsx)(an,{side:`bottom`,children:(0,Z.jsx)(J,{id:`81H_23`})})]}),t[53]=f,t[54]=s,t[55]=o,t[56]=b):b=t[56],g=sn,h=X,w=``,T=`ghost`,E=`icon`,D=l,O=!c,k=`doc-panel`,A=f(c?{id:`u7H-Wn`,values:{panelShortcutLabel:_}}:{id:`2hpdRq`,values:{panelShortcutLabel:_}}),t[1]=f,t[2]=n,t[3]=c,t[4]=r,t[5]=s,t[6]=a,t[7]=l,t[8]=d,t[9]=o,t[10]=i,t[11]=h,t[12]=g,t[13]=_,t[14]=v,t[15]=y,t[16]=b,t[17]=x,t[18]=S,t[19]=C,t[20]=w,t[21]=T,t[22]=E,t[23]=D,t[24]=O,t[25]=k,t[26]=A}else 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=t[20],T=t[21],E=t[22],D=t[23],O=t[24],k=t[25],A=t[26];let j;t[57]===c?j=t[58]:(j=(0,Z.jsx)(rn,{children:c?(0,Z.jsx)(Jc,{}):(0,Z.jsx)(qc,{})}),t[57]=c,t[58]=j);let M;t[59]!==h||t[60]!==j||t[61]!==w||t[62]!==T||t[63]!==E||t[64]!==D||t[65]!==O||t[66]!==k||t[67]!==A?(M=(0,Z.jsx)(h,{"data-doc-panel-toggle":w,variant:T,size:E,onClick:D,"aria-expanded":O,"aria-controls":k,"aria-label":A,asChild:!0,children:j}),t[59]=h,t[60]=j,t[61]=w,t[62]=T,t[63]=E,t[64]=D,t[65]=O,t[66]=k,t[67]=A,t[68]=M):M=t[68];let N;t[69]!==f||t[70]!==c?(N=f(c?{id:`6iDEWA`}:{id:`170Js2`}),t[69]=f,t[70]=c,t[71]=N):N=t[71];let P;t[72]===N?P=t[73]:(P=(0,Z.jsx)(`span`,{children:N}),t[72]=N,t[73]=P);let F;t[74]===_?F=t[75]:(F=(0,Z.jsx)(U,{"aria-label":_,children:m}),t[74]=_,t[75]=F);let I;t[76]!==P||t[77]!==F?(I=(0,Z.jsxs)(an,{side:`bottom`,children:[P,` `,F]}),t[76]=P,t[77]=F,t[78]=I):I=t[78];let R;t[79]!==g||t[80]!==M||t[81]!==I?(R=(0,Z.jsxs)(g,{children:[M,I]}),t[79]=g,t[80]=M,t[81]=I,t[82]=R):R=t[82];let z;t[83]!==v||t[84]!==y||t[85]!==b||t[86]!==R?(z=(0,Z.jsxs)(`div`,{className:v,children:[y,b,R]}),t[83]=v,t[84]=y,t[85]=b,t[86]=R,t[87]=z):z=t[87];let B;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[88]=B):B=t[88];let V;return t[89]!==x||t[90]!==S||t[91]!==C||t[92]!==z?(V=(0,Z.jsxs)(`div`,{"data-testid":x,className:S,children:[C,z,B]}),t[89]=x,t[90]=S,t[91]=C,t[92]=z,t[93]=V):V=t[93],V}function RP(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}function zP(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 BP=`ok-terminal-height-v1`,VP=1/3,HP=.5;function UP(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*HP))}function WP(e){let t=Number.isFinite(e)?e:0;return t<=0?240:Math.round(t*VP)}function GP(e,t){let n=UP(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(WP(t),n)}function KP(){return typeof window>`u`?0:window.innerHeight}function qP(e,t){try{let n=e??localStorage,r=t??KP(),i=n.getItem(BP);if(i==null)return GP(WP(r),r);let a=Number.parseInt(i,10);return GP(Number.isFinite(a)?a:WP(r),r)}catch{return 240}}function JP(e,t,n){try{let r=t??localStorage,i=n??KP();r.setItem(BP,String(GP(e,i)))}catch{}}function YP(){try{return typeof localStorage>`u`?240:qP()}catch{return 240}}function XP(e){let t=(0,$.c)(19),{dockPosition:n,onReveal:r,className:i}=e,{_:a}=mt(),o=n===`right`,s;t[0]===a?s=t[1]:(s=a({id:`vja0Dg`}),t[0]=a,t[1]=s);let c=s,l=o?`rounded-r-none border-r-0`:`rounded-b-none border-b-0`,u;t[2]!==i||t[3]!==l?(u=Y(`absolute z-20 shrink-0 bg-background text-muted-foreground shadow-sm hover:text-foreground`,l,i),t[2]=i,t[3]=l,t[4]=u):u=t[4];let d;t[5]===o?d=t[6]:(d=o?(0,Z.jsx)(Fo,{"aria-hidden":`true`}):(0,Z.jsx)(Fr,{"aria-hidden":`true`}),t[5]=o,t[6]=d);let f;t[7]!==n||t[8]!==c||t[9]!==r||t[10]!==u||t[11]!==d?(f=(0,Z.jsx)(rn,{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[7]=n,t[8]=c,t[9]=r,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p=o?`left`:`top`,m;t[13]!==c||t[14]!==p?(m=(0,Z.jsx)(an,{side:p,sideOffset:8,children:c}),t[13]=c,t[14]=p,t[15]=m):m=t[15];let h;return t[16]!==f||t[17]!==m?(h=(0,Z.jsxs)(sn,{children:[f,m]}),t[16]=f,t[17]=m,t[18]=h):h=t[18],h}var ZP=`terminal-dock-panel`;function QP(e){let t=(0,$.c)(42),{children:n,visible:r,onVisibleChange:i,dockPosition:a,onBottomContainer:o,onEditorRegion:s,onReveal:c,showRevealTab:l}=e,u=a===void 0?`bottom`:a,d=l===void 0?!1:l,{resolvedTheme:f}=Ft(),p=$S(),[m,h]=(0,Q.useState)(!r),g=$f(f).background,_=r&&u===`bottom`,v=d&&u===`bottom`&&c!=null,[y]=(0,Q.useState)($P),b=(0,Q.useRef)(y),[x,S]=(0,Q.useState)(!1),C=(0,Q.useRef)(!1),w=(0,Q.useRef)(null),T;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=function(e){w.current!=null&&clearTimeout(w.current),w.current=setTimeout(()=>{JP(e),w.current=null},100)},t[0]=T):T=t[0];let E=T,D=(0,Q.useRef)(null),O,k;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>()=>{w.current!=null&&clearTimeout(w.current),D.current!=null&&(window.removeEventListener(`pointerup`,D.current),D.current=null)},k=[],t[1]=O,t[2]=k):(O=t[1],k=t[2]),(0,Q.useEffect)(O,k);let A,j;t[3]!==_||t[4]!==p?(A=()=>{let e=p.current;e!=null&&(_?e.resize(`${b.current}px`):e.collapse())},j=[_,p],t[3]=_,t[4]=p,t[5]=A,t[6]=j):(A=t[5],j=t[6]),(0,Q.useEffect)(A,j);let M=x||void 0,N;t[7]!==c||t[8]!==v?(N=v&&c?(0,Z.jsx)(XP,{dockPosition:`bottom`,onReveal:c,className:`right-3 bottom-0`}):null,t[7]=c,t[8]=v,t[9]=N):N=t[9];let P;t[10]!==n||t[11]!==s||t[12]!==N?(P=(0,Z.jsx)(TT,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsxs)(`div`,{ref:s,tabIndex:-1,className:`relative flex h-full min-h-0 flex-col outline-none`,children:[n,N]})}),t[10]=n,t[11]=s,t[12]=N,t[13]=P):P=t[13];let F=!_,I;t[14]===_?I=t[15]:(I=()=>{if(!_)return;S(!0),C.current=!0;let e=()=>{S(!1),C.current=!1,window.removeEventListener(`pointerup`,e),D.current=null};D.current=e,window.addEventListener(`pointerup`,e)},t[14]=_,t[15]=I);let L;t[16]!==_||t[17]!==F||t[18]!==I?(L=(0,Z.jsx)(ET,{withHandle:_,disabled:F,onPointerDown:I}),t[16]=_,t[17]=F,t[18]=I,t[19]=L):L=t[19];let R;t[20]===g?R=t[21]:(R={backgroundColor:g},t[20]=g,t[21]=R);let z=_?`${y}px`:0,B;t[22]!==i||t[23]!==r?(B=e=>{let t=e.asPercentage===0;h(t),C.current&&(t&&r?i(!1):!t&&!r&&i(!0),e.inPixels>0&&(b.current=e.inPixels,E(e.inPixels)))},t[22]=i,t[23]=r,t[24]=B):B=t[24];let V=!x&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,H;t[25]===V?H=t[26]:(H=Y(`flex flex-col`,V),t[25]=V,t[26]=H);let U;t[27]===o?U=t[28]:(U=(0,Z.jsx)(`div`,{ref:o,className:`flex min-h-0 flex-1 flex-col overflow-hidden`}),t[27]=o,t[28]=U);let ee;t[29]!==m||t[30]!==p||t[31]!==R||t[32]!==z||t[33]!==B||t[34]!==H||t[35]!==U?(ee=(0,Z.jsx)(TT,{id:ZP,style:R,panelRef:p,defaultSize:z,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:B,inert:m,className:H,children:U}),t[29]=m,t[30]=p,t[31]=R,t[32]=z,t[33]=B,t[34]=H,t[35]=U,t[36]=ee):ee=t[36];let W;return t[37]!==P||t[38]!==L||t[39]!==ee||t[40]!==M?(W=(0,Z.jsxs)(wT,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":M,children:[P,L,ee]}),t[37]=P,t[38]=L,t[39]=ee,t[40]=M,t[41]=W):W=t[41],W}function $P(){return YP()}var eF=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-CnhDNi-c.js`),__vite__mapDeps([71,1,47,10,11,12,23,14,15,16,17,24,25,26,22,27,29,30,31,19,72,2,73,74,9,75,76,77,78,79,80,81,82,83,6,3,7,8,84,68,85,86,87,4,88,49,18,20,36,35,89,90,37,38,40,61,62,63,43,65,91,92,28,32,60,64,66,67,93,94,95,96,33,21,97,98,99,100,39,41,101,102,103,104,105,106,107,108,109]),import.meta.url)).ActivityModeContent})),tF=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./LintConfigEditor-DKgxJcvl.js`),__vite__mapDeps([151,10,1,11,12,22,152,2,73,74,9,145,79,6,3,7,8,84,68,85,86,87,88,30,31,14,15,16,17,19,49,24,25,29,18,20,36,48,50,26,99,62,133,13,21,35,114,59,92,96,128,116,39,41,134,135,27,136,43,153]),import.meta.url)).LintConfigEditor})),nF=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./SchemaConfigEditor-D7xbhgl6.js`),__vite__mapDeps([154,1,10,11,12,88,30,31,14,15,16,17,19,49,24,25,29,22,18,20,36,114,26,142,155,95,38,99,152,2,73,74,9,145,79,6,3,7,8,84,68,85,86,87,48,50,62,131,39,41,135,27,136,153]),import.meta.url)).SchemaConfigEditor}));function rF(){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)(J,{id:`NYn1cR`})}),e[0]=t):t=e[0],t}var iF=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./TimelineDiffPane-B9KqEt7q.js`),__vite__mapDeps([156,1,2,157,6,3,7,8,9,72,73,74,75,76,77,78,79,80,81,82,83,31,84,68,12,22,11,85,86,87,47,10,4,88,30,14,15,16,17,19,49,24,25,29,18,20,36,35,23,26,27,89,90,37,38,40,61,62,63,43,65,91,92,28,32,60,64,66,67,93,94,95,96,33,21,97,98,99,100,39,41,101,102,158,48,50,159,103,109]),import.meta.url)).TimelineDiffPane})),aF=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./AgentDiffPane-BKvov9S5.js`),__vite__mapDeps([160,1,2,157,6,3,7,8,9,72,73,74,75,76,77,78,79,80,81,82,83,31,84,68,12,22,11,85,86,87,47,10,4,88,30,14,15,16,17,19,49,24,25,29,18,20,36,35,23,26,27,89,90,37,38,40,61,62,63,43,65,91,92,28,32,60,64,66,67,93,94,95,96,33,21,97,98,99,100,39,41,101,102,158,48,50,159,104,105,106,109,107,108]),import.meta.url)).AgentDiffPane})),oF=`300px`,sF=`600px`,cF=new Set([`doc-panel`,`terminal-column`,`agent-panel`]);function lF(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(dF,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(uF,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(au,{name:`editor-area`,children:(0,Z.jsxs)(Co,{children:[n,r]})}),t[3]=n,t[4]=i),i}function uF(){let e=(0,$.c)(6),t=Tl(),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)(pT,{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 dF(e){let t=(0,$.c)(286),{editorMode:n,onModeChange:r,activeTab:i,onActiveTabChange:a,terminalBridge:o,terminalVisible:s,onTerminalVisibleChange:c,terminalDock:l,terminalHasSessions:u,onTerminalPlacement:d,onRevealTerminal:f}=e,p=s===void 0?!1:s,m=l===void 0?`right`:l,h=u===void 0?!1:u,{_:g}=mt(),{resolvedTheme:_}=Ft(),v=$f(_).background,{activeDocName:y,activeProvider:b,activeTarget:x,recycleDocument:S,docPanelMode:C,docPanelAgentId:w,docPanelExpandSignal:T}=Re(),{openDocumentTransition:E}=Ke(),{requestAddProperty:D}=yo(),O=HT(b,y),k=GT(y,n===`source`?`source`:`wysiwyg`),A=gE(b),j=A===`connected`||A===`synced`,M=WT(y)===`conflict`,[N,P]=(0,Q.useState)(!1),F,I;t[0]!==b||t[1]!==N?(F=()=>{b!=null&&!N&&P(!0)},I=[b,N],t[0]=b,t[1]=N,t[2]=F,t[3]=I):(F=t[2],I=t[3]),(0,Q.useEffect)(F,I);let L=(0,Q.useDeferredValue)(y),R=x?.kind===`missing`,z=!!y&&x?.kind!==`folder`,B;t[4]!==g||t[5]!==R?(B=R?g({id:`K-a33w`}):void 0,t[4]=g,t[5]=R,t[6]=B):B=t[6];let V=B,H=cl(),U,ee;t[7]!==y||t[8]!==H?(U=()=>{H&&H.docName!==y&&ll()},ee=[y,H],t[7]=y,t[8]=H,t[9]=U,t[10]=ee):(U=t[9],ee=t[10]),(0,Q.useEffect)(U,ee);let W=Jd(),G=W?.docName??null,K=(0,Q.useRef)(null),te;t[11]!==y||t[12]!==G||t[13]!==E?(te=()=>{if(G==null){K.current=null;return}if(K.current=G,G!==y){let e=vu(G);window.location.hash===e?E(G):window.location.hash=e}},t[11]=y,t[12]=G,t[13]=E,t[14]=te):te=t[14];let ne;t[15]===G?ne=t[16]:(ne=[G],t[15]=G,t[16]=ne),(0,Q.useEffect)(te,ne);let q,re;t[17]!==y||t[18]!==G?(q=()=>{if(G!=null){if(G===y){K.current=null;return}K.current!==G&&Xd()}},re=[y,G],t[17]=y,t[18]=G,t[19]=q,t[20]=re):(q=t[19],re=t[20]),(0,Q.useEffect)(q,re);let ie,ae;t[21]!==w||t[22]!==C?(ie=()=>{C===`agent`&&w!==null||Xd()},ae=[C,w],t[21]=w,t[22]=C,t[23]=ie,t[24]=ae):(ie=t[23],ae=t[24]),(0,Q.useEffect)(ie,ae);let oe=(0,Q.useSyncExternalStore)(ac.subscribe,ac.getSnapshot,ac.getSnapshot),se;t[25]!==x||t[26]!==oe?(se=lc(x,oe),t[25]=x,t[26]=oe,t[27]=se):se=t[27];let ce=se,[le]=(0,Q.useState)(gF),ue=le!==null,de;t[28]===le?de=t[29]:(de=()=>eE(le,window.innerWidth,`right`),t[28]=le,t[29]=de);let[fe,pe]=(0,Q.useState)(de),me=(0,Q.useRef)(fe),ge,_e;t[30]===fe?(ge=t[31],_e=t[32]):(ge=()=>{me.current=fe},_e=[fe],t[30]=fe,t[31]=ge,t[32]=_e),(0,Q.useEffect)(ge,_e);let ve=$S(),ye=$S(),be;t[33]===fe?be=t[34]:(be=()=>lE(`right`,fe,sE())===`collapsed`,t[33]=fe,t[34]=be);let[xe]=(0,Q.useState)(be),[Se,Ce]=(0,Q.useState)(xe),we=(0,Q.useRef)(Se),[Te,Ee]=(0,Q.useState)(null),[De,Oe]=(0,Q.useState)(null),[ke,Ae]=(0,Q.useState)(null),je=o?.terminal!=null,Me=m===`right`,Ne=Me?`right`:`bottom`,Pe=Me&&p,Ie=!p&&f!=null&&(je||h),Le=Ie&&!Me,ze=Ie&&Me,Be=Me&&p&&Te!=null,Ve=Be?Te:De,He=(Me?Be:p)&&Ve!=null,Ue,We;t[35]!==Ve||t[36]!==d||t[37]!==Ne||t[38]!==ke||t[39]!==He?(Ue=()=>{d?.({container:Ve,isShowing:He,dockPosition:Ne,editorRegion:ke})},We=[d,Ve,He,Ne,ke],t[35]=Ve,t[36]=d,t[37]=Ne,t[38]=ke,t[39]=He,t[40]=Ue,t[41]=We):(Ue=t[40],We=t[41]),(0,Q.useEffect)(Ue,We);let Ge,qe;t[42]===Se?(Ge=t[43],qe=t[44]):(Ge=()=>{we.current=Se},qe=[Se],t[42]=Se,t[43]=Ge,t[44]=qe),(0,Q.useEffect)(Ge,qe);let[Je,Ye]=(0,Q.useState)(!1),Xe=(0,Q.useRef)(!1),[Ze]=(0,Q.useState)(hF),Qe=(0,Q.useRef)(Ze),$e=(0,Q.useRef)(null),et;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(et=function(e){$e.current!=null&&clearTimeout($e.current),$e.current=setTimeout(()=>{YT(e),$e.current=null},100)},t[45]=et):et=t[45];let tt=et,[nt]=(0,Q.useState)(mF),rt=(0,Q.useRef)(nt),[it,at]=(0,Q.useState)(!1),ot=(0,Q.useRef)(!1),st=(0,Q.useRef)(null),ct;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(ct=function(e){st.current!=null&&clearTimeout(st.current),st.current=setTimeout(()=>{mE(e),st.current=null},100)},t[46]=ct):ct=t[46];let lt=ct,ut,dt;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(ut=()=>()=>{$e.current!=null&&clearTimeout($e.current),st.current!=null&&clearTimeout(st.current)},dt=[],t[47]=ut,t[48]=dt):(ut=t[47],dt=t[48]),(0,Q.useEffect)(ut,dt);let[ft,pt]=(0,Q.useState)(null),ht=(0,Q.useRef)(null),gt=JS(),_t=(0,Q.useRef)(Pe),vt,yt;t[49]===Pe?(vt=t[50],yt=t[51]):(vt=()=>{_t.current=Pe},yt=[Pe],t[49]=Pe,t[50]=vt,t[51]=yt),(0,Q.useEffect)(vt,yt);let bt;t[52]!==ve||t[53]!==ye?(bt=function(){for(let e of[ve,ye]){let t=e.current?.getSize();if(t!=null&&t.asPercentage>1&&t.inPixels>0)return t.inPixels/t.asPercentage*100}let e=ht.current;return e!=null&&e.offsetWidth>0?e.offsetWidth:null},t[52]=ve,t[53]=ye,t[54]=bt):bt=t[54];let xt=bt,St;t[55]!==gt||t[56]!==xt?(St=function(e){if(Xe.current||ot.current)return;let t=gt.current;if(t!=null)try{let n=xt();if(n==null)return;let r=t.getLayout(),i=Object.keys(r);if(i.length===0)return;let a=i.find(pF);if(a==null)return;let o={};if(`doc-panel`in r&&(o[`doc-panel`]=e?0:Qe.current),`terminal-column`in r&&(o[`terminal-column`]=rt.current),Object.keys(o).length===0)return;let s=zP({currentLayout:r,containerPx:n,pinnedPx:o,residualId:a});s!==r&&t.setLayout(s)}catch{}},t[55]=gt,t[56]=xt,t[57]=St):St=t[57];let Ct=St,wt=(0,Q.useRef)(Ct),Tt;t[58]===Ct?Tt=t[59]:(Tt=()=>{wt.current=Ct},t[58]=Ct,t[59]=Tt),(0,Q.useEffect)(Tt);let Et;t[60]!==Ct||t[61]!==ve?(Et=function(){_t.current?Ct(!1):ve.current?.expand()},t[60]=Ct,t[61]=ve,t[62]=Et):Et=t[62];let Dt=Et,Ot;t[63]!==Ct||t[64]!==Se||t[65]!==ve?(Ot=function(){if(ve.current==null)return;let e=me.current;Se?(uE(`right`,e,`open`),_t.current?Ct(!1):ve.current?.expand()):(uE(`right`,e,`collapsed`),_t.current?Ct(!0):ve.current?.collapse())},t[63]=Ct,t[64]=Se,t[65]=ve,t[66]=Ot):Ot=t[66];let kt=Ot,At,jt;t[67]!==Ct||t[68]!==le||t[69]!==ve?(At=()=>{let e=window.matchMedia(`(min-width: ${QT}px)`),t=()=>{let e=eE(le,window.innerWidth,`right`);pe(e);let t=lE(`right`,e,sE())===`collapsed`;Ce(t),_t.current?Ct(t):t?ve.current?.collapse():ve.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},jt=[le,ve,Ct],t[67]=Ct,t[68]=le,t[69]=ve,t[70]=At,t[71]=jt):(At=t[70],jt=t[71]),(0,Q.useEffect)(At,jt);let Mt,Nt;t[72]!==ft||t[73]!==ue?(Mt=()=>{if(ft==null||ue)return;let e=new ResizeObserver(()=>{wt.current(we.current)});return e.observe(ft),()=>e.disconnect()},Nt=[ft,ue],t[72]=ft,t[73]=ue,t[74]=Mt,t[75]=Nt):(Mt=t[74],Nt=t[75]),(0,Q.useEffect)(Mt,Nt);let Pt,It;t[76]!==Dt||t[77]!==a?(Pt=()=>{let e=e=>{a(e),Dt()},t=Kg();return t&&e(t),Jg(t=>{Kg(),e(t)})},It=[a,Dt],t[76]=Dt,t[77]=a,t[78]=Pt,t[79]=It):(Pt=t[78],It=t[79]),(0,Q.useEffect)(Pt,It);let Lt,Rt;t[80]!==T||t[81]!==Dt?(Lt=()=>{T!==0&&Dt()},Rt=[T,Dt],t[80]=T,t[81]=Dt,t[82]=Lt,t[83]=Rt):(Lt=t[82],Rt=t[83]),(0,Q.useEffect)(Lt,Rt);let zt=(0,Q.useRef)(Pe),Bt,Ht;t[84]!==Se||t[85]!==Pe?(Bt=()=>{if(zt.current===Pe)return;zt.current=Pe;let e=Se;queueMicrotask(()=>{wt.current(e)})},Ht=[Pe,Se],t[84]=Se,t[85]=Pe,t[86]=Bt,t[87]=Ht):(Bt=t[86],Ht=t[87]),(0,Q.useLayoutEffect)(Bt,Ht);let Ut,Wt;t[88]===Se?(Ut=t[89],Wt=t[90]):(Ut=()=>{if(!Se||!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()},Wt=[Se],t[88]=Se,t[89]=Ut,t[90]=Wt),(0,Q.useLayoutEffect)(Ut,Wt);let Gt,Kt;t[91]===Se?(Gt=t[92],Kt=t[93]):(Gt=()=>{_c({docPanelVisible:!Se}),window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!Se})},Kt=[Se],t[91]=Se,t[92]=Gt,t[93]=Kt),(0,Q.useEffect)(Gt,Kt);let qt,Jt;t[94]===kt?(qt=t[95],Jt=t[96]):(qt=()=>Vt(e=>{e===`toggle-doc-panel`&&kt()}),Jt=[kt],t[94]=kt,t[95]=qt,t[96]=Jt),(0,Q.useEffect)(qt,Jt);let Yt,Xt;t[97]===kt?(Yt=t[98],Xt=t[99]):(Yt=()=>{if(window.okDesktop!=null)return;let e=e=>{xl(e,`toggle-document-panel`)&&(e.preventDefault(),kt())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Xt=[kt],t[97]=kt,t[98]=Yt,t[99]=Xt),(0,Q.useEffect)(Yt,Xt);let Zt=(0,Q.useRef)(null),[X,Qt]=(0,Q.useState)(null),[$t,en]=(0,Q.useState)(!1),tn=x?.kind===`large-file`?x.docName:y,nn,rn;t[100]===tn?(nn=t[101],rn=t[102]):(nn=()=>{if(tn&&tn!==Zt.current){let e=Zt.current;Zt.current=tn,Qt(e)}},rn=[tn],t[100]=tn,t[101]=nn,t[102]=rn),(0,Q.useEffect)(nn,rn);let an;t[103]===E?an=t[104]:(an=function(e){let t=vu(e);window.location.hash===t?E(e):window.location.hash=t},t[103]=E,t[104]=an);let on=an,sn,cn=null;if(x?.kind===`large-file`){let e;t[105]!==on||t[106]!==X?(e=X?{previousDocName:X,onNavigateBack:on}:void 0,t[105]=on,t[106]=X,t[107]=e):e=t[107];let n;t[108]!==x.docName||t[109]!==x.limit||t[110]!==x.size||t[111]!==e?(n=(0,Z.jsx)(Hw,{docName:x.docName,size:x.size,limit:x.limit,backNav:e}),t[108]=x.docName,t[109]=x.limit,t[110]=x.size,t[111]=e,t[112]=n):n=t[112],sn=n}else if(x?.kind===`folder`){let e;t[113]!==ue||t[114]!==p?(e=sD({terminalVisible:p,isEmbedded:ue}),t[113]=ue,t[114]=p,t[115]=e):e=t[115];let n=e,r;t[116]===x.folderPath?r=t[117]:(r=(0,Z.jsx)(Rw,{folderPath:x.folderPath}),t[116]=x.folderPath,t[117]=r);let i;t[118]===n?i=t[119]:(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[118]=n,t[119]=i);let a;t[120]!==r||t[121]!==i?(a=(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[r,i]}),t[120]=r,t[121]=i,t[122]=a):a=t[122];let o;t[123]!==x.folderPath||t[124]!==n?(o=n?(0,Z.jsx)(qE,{folderPath:x.folderPath}):null,t[123]=x.folderPath,t[124]=n,t[125]=o):o=t[125];let s;if(t[126]!==a||t[127]!==o?(s=(0,Z.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[a,o]}),t[126]=a,t[127]=o,t[128]=s):s=t[128],sn=s,C===`agent`&&w!==null){let e;t[129]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ET,{withHandle:!0}),t[129]=e):e=t[129];let n;t[130]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(TT,{id:`agent-panel`,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)(J,{id:`ONPvOb`})}),children:(0,Z.jsx)(eF,{showBackButton:!1})})})]}),t[130]=n):n=t[130],cn=n}}else if(x?.kind===`asset`&&eo(x.assetPath.split(`/`).pop()??x.assetPath)){let e;t[131]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(rF,{}),t[131]=e):e=t[131];let n;t[132]===x.assetPath?n=t[133]:(n=(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(tF,{assetPath:x.assetPath},x.assetPath)}),t[132]=x.assetPath,t[133]=n),sn=n}else if(x?.kind===`asset`&&Ua(x.assetPath)){let e;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(rF,{}),t[134]=e):e=t[134];let n;t[135]===x.assetPath?n=t[136]:(n=(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(nF,{assetPath:x.assetPath},x.assetPath)}),t[135]=x.assetPath,t[136]=n),sn=n}else if(x?.kind===`asset`){let e;t[137]!==x.assetPath||t[138]!==x.mediaKind?(e=(0,Z.jsx)(aC,{assetPath:x.assetPath,mediaKind:x.mediaKind},x.assetPath),t[137]=x.assetPath,t[138]=x.mediaKind,t[139]=e):e=t[139],sn=e}else if(x?.kind===`skill-file`){let e=`${x.scope}/${x.name}/${x.path}`,n;t[140]!==x.name||t[141]!==x.path||t[142]!==x.scope||t[143]!==e?(n=(0,Z.jsx)(nT,{scope:x.scope,name:x.name,path:x.path},e),t[140]=x.name,t[141]=x.path,t[142]=x.scope,t[143]=e,t[144]=n):n=t[144],sn=n}else if(ce){let e;t[145]===ce?e=t[146]:(e=(0,Z.jsx)(Gw,{nav:ce},ce.path),t[145]=ce,t[146]=e),sn=e}else if(!b||!y)if((typeof window<`u`?_u(window.location.hash):null)!==null)if(o!=null&&N){let e;t[147]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(sC,{}),t[147]=e):e=t[147],sn=e;let n;t[148]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(ET,{withHandle:!0,disabled:!0}),t[148]=n):n=t[148];let r=xe?0:`${Ze}px`,i;t[149]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`}),t[149]=i):i=t[149];let a;t[150]===r?a=t[151]:(a=(0,Z.jsxs)(Z.Fragment,{children:[n,(0,Z.jsx)(TT,{id:`doc-panel`,defaultSize:r,minSize:oF,maxSize:sF,collapsible:!0,collapsedSize:0,inert:!0,className:`flex flex-col bg-muted/20`,children:i})]}),t[150]=r,t[151]=a),cn=a}else{let e;return t[152]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(sC,{}),t[152]=e):e=t[152],e}else{let e=p?Ne:null,n;t[153]===e?n=t[154]:(n=(0,Z.jsx)(aw,{terminalDock:e}),t[153]=e,t[154]=n),sn=n}else{let e=n===`source`,o=!j,s=Se,c;t[155]!==y||t[156]!==D?(c=function(){y&&D(y)},t[155]=y,t[156]=D,t[157]=c):c=t[157];let l=c,u;t[158]!==y||t[159]!==W||t[160]!==G||t[161]!==ue||t[162]!==p||t[163]!==H?(u=oD({terminalVisible:p,isEmbedded:ue,activeDocName:y})&&!(H&&H.docName===y)&&!(W&&G===y),t[158]=y,t[159]=W,t[160]=G,t[161]=ue,t[162]=p,t[163]=H,t[164]=u):u=t[164];let d=u,f=L??y,m=X??void 0,h;t[165]!==V||t[166]!==e||t[167]!==on||t[168]!==S||t[169]!==f||t[170]!==m?(h=(0,Z.jsx)(bN,{activeDocName:f,isSourceMode:e,editorPlaceholder:V,previousDocName:m,onNavigateBack:on,onRecycle:S}),t[165]=V,t[166]=e,t[167]=on,t[168]=S,t[169]=f,t[170]=m,t[171]=h):h=t[171];let g;t[172]!==y||t[173]!==e?(g=(0,Z.jsx)(RT,{activeDocName:y,isSourceMode:e}),t[172]=y,t[173]=e,t[174]=g):g=t[174];let _;t[175]!==y||t[176]!==L?(_=RP({activeDocName:y,deferredActiveDocName:L,mountResolved:y!==null&&Fe(y),syncResolved:y!==null&&he(y)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(sC,{}),y===null?null:(0,Z.jsx)(Uw,{docName:y})]}):null,t[175]=y,t[176]=L,t[177]=_):_=t[177];let v;t[178]!==y||t[179]!==Se||t[180]!==H||t[181]!==kt?(v=H&&H.docName===y?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(iF,{view:H,isPanelCollapsed:Se,onTogglePanel:kt})}):null,t[178]=y,t[179]=Se,t[180]=H,t[181]=kt,t[182]=v):v=t[182];let b;t[183]!==y||t[184]!==W||t[185]!==G||t[186]!==Se||t[187]!==kt?(b=W&&G===y?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(aF,{view:W,isPanelCollapsed:Se,onTogglePanel:kt})}):null,t[183]=y,t[184]=W,t[185]=G,t[186]=Se,t[187]=kt,t[188]=b):b=t[188];let x;t[189]!==h||t[190]!==g||t[191]!==_||t[192]!==v||t[193]!==b?(x=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[h,g,_,v,b]}),t[189]=h,t[190]=g,t[191]=_,t[192]=v,t[193]=b,t[194]=x):x=t[194];let w;t[195]!==y||t[196]!==M||t[197]!==s||t[198]!==e||t[199]!==r||t[200]!==l||t[201]!==ze||t[202]!==o||t[203]!==kt?(w=!M&&(0,Z.jsx)(LP,{activeDocName:y,isSourceMode:e,sourceDisabled:o,onModeChange:r,showAddPropertyButton:!e,onAddProperty:l,isPanelCollapsed:s,onTogglePanel:kt,reserveRightGutter:ze&&s}),t[195]=y,t[196]=M,t[197]=s,t[198]=e,t[199]=r,t[200]=l,t[201]=ze,t[202]=o,t[203]=kt,t[204]=w):w=t[204];let T;t[205]!==y||t[206]!==$t||t[207]!==e||t[208]!==d?(T=d?(0,Z.jsx)(qE,{docName:y,surface:e?`source`:`wysiwyg`,dismissed:$t,onDismiss:()=>en(!0),onReopen:()=>en(!1)}):null,t[205]=y,t[206]=$t,t[207]=e,t[208]=d,t[209]=T):T=t[209];let E;t[210]!==x||t[211]!==w||t[212]!==T?(E=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[x,w,T]}),t[210]=x,t[211]=w,t[212]=T,t[213]=E):E=t[213];let A;t[214]!==$t||t[215]!==d?(A=d&&$t?{onReopen:()=>en(!1)}:null,t[214]=$t,t[215]=d,t[216]=A):A=t[216];let N;t[217]!==Le||t[218]!==k||t[219]!==z||t[220]!==O||t[221]!==A?(N=(0,Z.jsx)(wP,{stats:O,selectionStats:k,showStats:z,composerBadge:A,reserveRightGutter:Le}),t[217]=Le,t[218]=k,t[219]=z,t[220]=O,t[221]=A,t[222]=N):N=t[222];let P;t[223]!==E||t[224]!==N?(P=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[E,N]}),t[223]=E,t[224]=N,t[225]=P):P=t[225],sn=P;let F=Pe&&Se,I=!Se,R;t[226]===Symbol.for(`react.memo_cache_sentinel`)?(R=()=>{Ye(!0),Xe.current=!0;let e=()=>{Ye(!1),Xe.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[226]=R):R=t[226];let B;t[227]!==Se||t[228]!==I?(B=(0,Z.jsx)(ET,{withHandle:I,disabled:Se,onPointerDown:R}),t[227]=Se,t[228]=I,t[229]=B):B=t[229];let U=xe?0:`${Ze}px`,ee=F?`0px`:oF,K;t[230]===Symbol.for(`react.memo_cache_sentinel`)?(K=e=>{Ce(e.asPercentage===0),e.inPixels>0&&Xe.current&&(Qe.current=e.inPixels,tt(e.inPixels))},t[230]=K):K=t[230];let te=!Je&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,ne;t[231]===te?ne=t[232]:(ne=Y(`flex flex-col bg-muted/20`,te),t[231]=te,t[232]=ne);let q;t[233]!==y||t[234]!==i||t[235]!==C||t[236]!==e||t[237]!==a?(q=(0,Z.jsx)(rx,{docName:y,isSourceMode:e,activeTab:i,onActiveTabChange:a,mode:C}),t[233]=y,t[234]=i,t[235]=C,t[236]=e,t[237]=a,t[238]=q):q=t[238];let re;t[239]!==F||t[240]!==Se||t[241]!==ve||t[242]!==U||t[243]!==ee||t[244]!==ne||t[245]!==q?(re=(0,Z.jsx)(TT,{id:`doc-panel`,panelRef:ve,disabled:F,defaultSize:U,minSize:ee,maxSize:sF,collapsible:!0,collapsedSize:0,onResize:K,inert:Se,className:ne,children:q}),t[239]=F,t[240]=Se,t[241]=ve,t[242]=U,t[243]=ee,t[244]=ne,t[245]=q,t[246]=re):re=t[246];let ie;t[247]!==B||t[248]!==re?(ie=(0,Z.jsxs)(Z.Fragment,{children:[B,re]}),t[247]=B,t[248]=re,t[249]=ie):ie=t[249],cn=ie}let ln=c??fF,un;t[250]!==Le||t[251]!==f||t[252]!==ln||t[253]!==Ne||t[254]!==p||t[255]!==sn?(un=(0,Z.jsx)(QP,{visible:p,onVisibleChange:ln,dockPosition:Ne,onBottomContainer:Oe,onEditorRegion:Ae,onReveal:f,showRevealTab:Le,children:sn}),t[250]=Le,t[251]=f,t[252]=ln,t[253]=Ne,t[254]=p,t[255]=sn,t[256]=un):un=t[256];let dn=un,fn;t[257]!==nt||t[258]!==it||t[259]!==c||t[260]!==ye||t[261]!==Pe||t[262]!==v?(fn=Pe?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ET,{withHandle:!0,onPointerDown:()=>{at(!0),ot.current=!0;let e=()=>{at(!1),ot.current=!1,window.removeEventListener(`pointerup`,e),ye.current?.isCollapsed()&&c?.(!1)};window.addEventListener(`pointerup`,e)}}),(0,Z.jsx)(TT,{id:`terminal-column`,panelRef:ye,style:{backgroundColor:v},defaultSize:`${nt}px`,minSize:`320px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:e=>{e.inPixels>0&&ot.current&&(rt.current=e.inPixels,lt(e.inPixels))},className:Y(`flex flex-col`,!it&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`),children:(0,Z.jsx)(`div`,{ref:Ee,className:`flex min-h-0 flex-1 flex-col overflow-hidden`})})]}):null,t[257]=nt,t[258]=it,t[259]=c,t[260]=ye,t[261]=Pe,t[262]=v,t[263]=fn):fn=t[263];let pn=fn,mn=cn!=null&&!xe||Pe,hn;t[264]===Symbol.for(`react.memo_cache_sentinel`)?(hn=e=>{pt(e),ht.current=e},t[264]=hn):hn=t[264];let gn=Je||it||void 0,_n=Pe?`5%`:`30%`,vn;t[265]===mn?vn=t[266]:(vn=mn?{}:{defaultSize:`100%`},t[265]=mn,t[266]=vn);let yn=!(Je||it)&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,bn;t[267]===yn?bn=t[268]:(bn=Y(yn),t[267]=yn,t[268]=bn);let xn;t[269]!==dn||t[270]!==_n||t[271]!==vn||t[272]!==bn?(xn=(0,Z.jsx)(TT,{minSize:_n,...vn,className:bn,children:dn}),t[269]=dn,t[270]=_n,t[271]=vn,t[272]=bn,t[273]=xn):xn=t[273];let Sn;t[274]!==gt||t[275]!==cn||t[276]!==gn||t[277]!==xn||t[278]!==pn?(Sn=(0,Z.jsxs)(wT,{orientation:`horizontal`,groupRef:gt,"data-dragging":gn,children:[xn,cn,pn]}),t[274]=gt,t[275]=cn,t[276]=gn,t[277]=xn,t[278]=pn,t[279]=Sn):Sn=t[279];let Cn;t[280]!==f||t[281]!==ze?(Cn=ze?(0,Z.jsx)(XP,{dockPosition:`right`,onReveal:f,className:`top-2.5 right-0`}):null,t[280]=f,t[281]=ze,t[282]=Cn):Cn=t[282];let wn;return t[283]!==Sn||t[284]!==Cn?(wn=(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 flex-1`,ref:hn,children:[Sn,Cn]}),t[283]=Sn,t[284]=Cn,t[285]=wn):wn=t[285],wn}function fF(){}function pF(e){return!cF.has(e)}function mF(){return hE()}function hF(){return XT()}function gF(){return Li()}function _F(){if(typeof window>`u`)return!1;let e=window.okDesktop;return e!=null&&e.menu!=null&&e.platform!==`darwin`}function vF(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 yF(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 bF=1e3,xF=!1;function SF(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function CF(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:ep(i)?a=i:(a=void 0,xF||(xF=!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`&&(SF({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=yF(i),{current:c,crossDoc:l}=a?tp(a,n,Date.now()):{current:[],crossDoc:[]},u=wF,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>vF(e.current,p)&&vF(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,bF);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 wF(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var TF=!1,EF=new Set,DF=!1;function OF(){for(let e of EF)e()}function kF(e){TF!==e&&(TF=e,OF())}function AF(){return TF}function jF(e){return EF.add(e),()=>{EF.delete(e)}}function MF(e){let t=[e.onUpdateRelaunching(()=>kF(!0)),e.onUpdateRelaunchFailed(()=>kF(!1))];return()=>{for(let e of t)e()}}function NF(){if(DF||typeof window>`u`)return;let e=window.okDesktop;e&&(DF=!0,MF(e))}function PF(){return(0,Q.useSyncExternalStore)(jF,AF,FF)}function FF(){return!1}var IF=`sync-status`;async function LF(e){try{let t=await Sy(e);t.ok||dl.error(t.message,{id:IF,duration:1/0})}catch{}}function RF(e,t){let n=(0,$.c)(6),{_:r}=mt(),i=PF(),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){dl.dismiss(IF);return}o.current=!0;let e=window.okDesktop;dl.warning(r({id:`HGNCsl`}),{id:IF,duration:1/0,...e?{action:{label:r({id:`uaUc6t`}),onClick:()=>{LF(e)}}}:{}})}else o.current&&e===`synced`&&(o.current=!1,dl.success(r({id:`GhjUB_`}),{id:IF,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 zF=4,BF=3,VF={Bird:ph,Cat:_h,Dog:Ch,Fish:Ah,Mouse:ng,Rabbit:tg,Shrimp:sg,Snail:cg,Squirrel:dg,Turtle:Cg};Object.freeze(Object.keys(VF));function HF(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(VF,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var UF={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function WF(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:i}=e,{_:a}=mt(),o=HF(n),s=o.kind===`animal`?VF[o.animal]:void 0,c;t[0]===n.name?c=t[1]:(c=vi(n.name),t[0]=n.name,t[1]=c);let l=c,u;t[2]===n.color?u=t[3]:(u=Aa(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)(rn,{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)(an,{children:m}),t[23]=m,t[24]=b);let x;return t[25]!==y||t[26]!==b?(x=(0,Z.jsxs)(sn,{children:[y,b]}),t[25]=y,t[26]=b,t[27]=x):x=t[27],x}function GF(e){let t=UF[e.icon];return e.displayName||t||vl._({id:`iEQQyu`})}function KF(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 qF(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{_:o}=mt(),{activeDocName:s}=Re(),{presence:c,agentId:l}=n,u=GF(c),d=KF(c.mode),f=!r&&d,p=c.currentDoc&&!ha(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)(Yd,{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)(Yd,{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)(rn,{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)(J,{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)(an,{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)(sn,{children:[O,j]}),t[30]=O,t[31]=j,t[32]=M):M=t[32],M}function JF(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?vl._({id:`9euN0m`,values:{count:n}}):vl._({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)(Bt,{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)(WF,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(qF,{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)(Gt,{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)(zt,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function YF(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(WF,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(qF,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function XF(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=Re(),{current:s,crossDoc:c}=CF(t,r,n);if(RF(gE(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,zF),n;e[6]===s?n=e[7]:(n=s.slice(zF),e[6]=s,e[7]=n);let r=n,u=c.slice(0,BF),d;e[8]===c?d=e[9]:(d=c.slice(BF),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=>YF(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)(JF,{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=>YF(e,p,!0,m)),f.length>0?(0,Z.jsx)(JF,{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 ZF(){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(QF),()=>{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 QF(e){console.warn(`[use-update-channel] bridge.state.query() failed`,e)}function $F(e){let t=(0,$.c)(6),{className:n}=e,{_:r}=mt(),{channel:i}=ZF();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)(J,{id:`cSCbv3`}),t[2]=o):o=t[2];let s;return t[3]!==n||t[4]!==a?(s=(0,Z.jsx)(xu,{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}function eI(e,t){return t.trim()}function tI(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function nI(e,t){let n=eI(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function rI(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(Fl(e)){let t=s.get(Kf(e.docName,e.docExt));if(t){let n=Hl(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:Qi(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(Rl(e))return{...e,path:lI(e.path,n)};if(Vl(e)){let t=s.get(e.path);return t&&jl(t)?{kind:`document`,docName:Mf(t),docExt:Nl(t),size:e.size,modified:e.modified}:{...e,path:t??lI(e.path,n)}}return e})}function iI(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=>Fl(e)?!i.has(e.docName)&&!pI(e.docName,n):Rl(e)?!pI(e.path,n):Vl(e)?!a.has(e.path)&&!pI(e.path,n):!0)}function aI(e,t){if(e.kind!==`asset`||t.some(t=>Vl(t)&&t.path===e.path))return e;let n=Yf(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function oI(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>uI(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>Fl(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=>Rl(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(Fl(i)){let e=fI(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Rl(i)){let e=dI(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function sI(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function cI(e,t){let n=e.kind===`file`?Kf(e.path,e.docExt):e.path;return qs(t.contentDir,n,t.pathSeparator)}function lI(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 uI(e,t){return Fl(e)&&Fl(t)?e.docName===t.docName:Rl(e)&&Rl(t)||Vl(e)&&Vl(t)?e.path===t.path:!1}function dI(e,t,n){return e===t?n:fI(e,t,n)}function fI(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function pI(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}var mI=[`.md`,`.mdx`],hI=`group relative -mb-px flex h-10 min-w-28 max-w-64 shrink-0 cursor-pointer items-center overflow-hidden border border-transparent font-medium transition-colors`,gI=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,_I=Y(gI,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),vI=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function yI(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function bI(e){let t=vu(e);window.location.hash!==t&&(window.location.hash=t)}function xI(e,t){let n=[t,...mI].filter((e,t,n)=>e&&n.indexOf(e)===t),r=e.toLowerCase(),i=n.find(t=>e.length>t.length&&r.endsWith(t.toLowerCase()));return i?e.slice(0,-i.length):e}function SI(e){return e.metaKey||e.ctrlKey}var CI=1e3;function wI(e,t){return e<0||e>=t?null:e<8?String(e+1):e===t-1?`9`:null}function TI(e,t){return wI(e,t)}function EI(e,t){let n=wI(e,t);if(n)return[`Meta+${n}`,`Control+${n}`].join(` `)}function DI(e,t){if(!SI(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 OI(e){let t=(0,$.c)(3),{value:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=Y(Tc(!0),`font-mono tabular-nums hover:bg-transparent animate-in fade-in-0 zoom-in-95 duration-150 motion-reduce:animate-none motion-reduce:duration-0`),t[0]=r):r=t[0];let i=`⌘${n}`,a;return t[1]===i?a=t[2]:(a=(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`editor-tab-shortcut-hint`,className:r,children:(0,Z.jsx)(U,{className:`text-[10px]`,children:i})}),t[1]=i,t[2]=a),a}function kI(e){let t=(0,$.c)(37),n,r,i,a,o,s,c,l;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]):({activateFromKeyboard:n,className:r,tabId:l,disabled:i,onKeyDown:a,ref:o,style:s,...c}=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);let u;t[9]!==i||t[10]!==l?(u={id:l,disabled:i},t[9]=i,t[10]=l,t[11]=u):u=t[11];let{attributes:d,listeners:f,rect:p,setNodeRef:m,transform:h,transition:g,isDragging:_}=lf(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=zc({activeWidth:v,isDragging:_,outerStyle:s,transform:h,transition:g}),t[12]=_,t[13]=s,t[14]=v,t[15]=h,t[16]=g,t[17]=y):y=t[17];let b=y,x;t[18]!==o||t[19]!==m?(x=function(e){m(e),typeof o==`function`?o(e):o&&`current`in o&&(o.current=e)},t[18]=o,t[19]=m,t[20]=x):x=t[20];let S=x,C=f?.onKeyDown,w;t[21]!==n||t[22]!==_||t[23]!==a||t[24]!==C?(w=function(e){a?.(e);let t=jc({event:e,hasKeyboardActivation:!!n,isDragging:_});if(t!==`ignore`){if(t===`activate-tab`&&n){e.preventDefault(),n();return}C?.(e)}},t[21]=n,t[22]=_,t[23]=a,t[24]=C,t[25]=w):w=t[25];let T=w,E;t[26]!==r||t[27]!==_?(E=wc({className:r,isDragging:_}),t[26]=r,t[27]=_,t[28]=E):E=t[28];let D;return t[29]!==d||t[30]!==S||t[31]!==T||t[32]!==f||t[33]!==c||t[34]!==b||t[35]!==E?(D=(0,Z.jsx)(`div`,{ref:S,"data-editor-tab-sortable":``,className:E,style:b,...c,...d,...f,onKeyDown:T}),t[29]=d,t[30]=S,t[31]=T,t[32]=f,t[33]=c,t[34]=b,t[35]=E,t[36]=D):D=t[36],D}function AI(e){let t=(0,$.c)(52),{children:n,closeTab:r,closeTabs:i,canPin:a,disabled:o,openTabs:s,pinTab:c,pinnedTabIds:l,tabId:u,unpinTab:d}=e,f=a===void 0?!0:a;if(o!==void 0&&o)return n;let p;t[0]!==f||t[1]!==l||t[2]!==u?(p=f&&l.includes(u),t[0]=f,t[1]=l,t[2]=u,t[3]=p):p=t[3];let m=p,h;if(t[4]!==s||t[5]!==l||t[6]!==u){let e;t[8]===u?e=t[9]:(e=e=>e!==u,t[8]=u,t[9]=e),h=T(s.filter(e),l),t[4]=s,t[5]=l,t[6]=u,t[7]=h}else h=t[7];let g=h,_;t[10]!==s||t[11]!==l?(_=T(s,l),t[10]=s,t[11]=l,t[12]=_):_=t[12];let v=_,y;t[13]===n?y=t[14]:(y=(0,Z.jsx)(Kv,{asChild:!0,children:n}),t[13]=n,t[14]=y);let b;t[15]!==r||t[16]!==u?(b=()=>r(u),t[15]=r,t[16]=u,t[17]=b):b=t[17];let x;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(J,{id:`yz7wBu`}),t[18]=x):x=t[18];let S;t[19]!==m||t[20]!==b?(S=(0,Z.jsx)(Xv,{disabled:m,onSelect:b,children:x}),t[19]=m,t[20]=b,t[21]=S):S=t[21];let C=g.length===0,w;t[22]!==i||t[23]!==g?(w=()=>{i(g)},t[22]=i,t[23]=g,t[24]=w):w=t[24];let E;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(J,{id:`omXJcU`}),t[25]=E):E=t[25];let D;t[26]!==C||t[27]!==w?(D=(0,Z.jsx)(Xv,{disabled:C,onSelect:w,children:E}),t[26]=C,t[27]=w,t[28]=D):D=t[28];let O=v.length===0,k;t[29]!==v||t[30]!==i?(k=()=>{i(v)},t[29]=v,t[30]=i,t[31]=k):k=t[31];let A;t[32]===l.length?A=t[33]:(A=l.length?(0,Z.jsx)(J,{id:`U2Kx6T`}):(0,Z.jsx)(J,{id:`WyXG7w`}),t[32]=l.length,t[33]=A);let j;t[34]!==O||t[35]!==k||t[36]!==A?(j=(0,Z.jsx)(Xv,{disabled:O,"data-testid":`editor-tab-context-close-all`,onSelect:k,children:A}),t[34]=O,t[35]=k,t[36]=A,t[37]=j):j=t[37];let M;t[38]!==f||t[39]!==m||t[40]!==c||t[41]!==u||t[42]!==d?(M=f&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ty,{}),(0,Z.jsx)(Xv,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>m?d(u):c(u),children:m?(0,Z.jsx)(J,{id:`SYfHmN`}):(0,Z.jsx)(J,{id:`3pU8e-`})})]}),t[38]=f,t[39]=m,t[40]=c,t[41]=u,t[42]=d,t[43]=M):M=t[43];let N;t[44]!==D||t[45]!==j||t[46]!==M||t[47]!==S?(N=(0,Z.jsxs)(Yv,{className:`min-w-40`,children:[S,D,j,M]}),t[44]=D,t[45]=j,t[46]=M,t[47]=S,t[48]=N):N=t[48];let P;return t[49]!==N||t[50]!==y?(P=(0,Z.jsxs)(Gv,{children:[y,N]}),t[49]=N,t[50]=y,t[51]=P):P=t[51],P}function jI(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}=mt();if(d){let e;return t[0]===d?e=t[1]:(e=(0,Z.jsx)(OI,{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)(eg,{"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=Tc(m),t[15]=m,t[16]=h);let g;t[17]===a?g=t[18]:(g=Ec(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)(ul,{"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 MI(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)(al,{"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 NI(e){let t=(0,$.c)(27),{accessibleLabel:n,activateTab:r,baseName:i,docName:a,enterRenameMode:o,extension:s,hideDocExtension:c,tabId:l}=e,{_:u}=mt(),d=WT(a)===`conflict`,f;t[0]!==u||t[1]!==n||t[2]!==d?(f=d?u({id:`mVFyH-`,values:{accessibleLabel:n}}):n,t[0]=u,t[1]=n,t[2]=d,t[3]=f):f=t[3];let p=f,m;t[4]!==r||t[5]!==l?(m=()=>{r(l)},t[4]=r,t[5]=l,t[6]=m):m=t[6];let h;t[7]!==a||t[8]!==o||t[9]!==l?(h=e=>{e.preventDefault(),e.stopPropagation(),o(l,a)},t[7]=a,t[8]=o,t[9]=l,t[10]=h):h=t[10];let g;t[11]===d?g=t[12]:(g=(0,Z.jsx)(MI,{hasConflict:d}),t[11]=d,t[12]=g);let _;t[13]===i?_=t[14]:(_=(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:i}),t[13]=i,t[14]=_);let v;t[15]!==s||t[16]!==c?(v=!c&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:s}),t[15]=s,t[16]=c,t[17]=v):v=t[17];let y;t[18]!==_||t[19]!==v?(y=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[_,v]}),t[18]=_,t[19]=v,t[20]=y):y=t[20];let b;return t[21]!==p||t[22]!==m||t[23]!==h||t[24]!==g||t[25]!==y?(b=(0,Z.jsxs)(`button`,{type:`button`,"aria-label":p,title:p,className:vI,onClick:m,onDoubleClick:h,tabIndex:-1,children:[g,y]}),t[21]=p,t[22]=m,t[23]=h,t[24]=g,t[25]=y,t[26]=b):b=t[26],b}function PI(){let e=(0,$.c)(94),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:i,activateTab:a,activateNewTab:o,closeNewTab:s,closeTab:c,closeTabs:l,isNewTabActive:u,newTabIds:d,openNewTab:f,openTabs:m,pinTab:g,pinnedTabIds:_,reopenClosedTab:y,reconcileLocalRename:b,reorderTabs:x,unpinTab:S,visibleTabIds:w}=Re(),{_:T}=mt(),{pageMeta:E}=Bo(),D=(0,Q.useRef)(null),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(null),[M,N]=(0,Q.useState)(``),[P,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(!1),[R,z]=(0,Q.useState)(!1),B=(0,Q.useRef)(null),V=(0,Q.useRef)(!1),H=(0,Q.useRef)(!1),U=(0,Q.useRef)(null),ee=(0,Q.useRef)(t),W=(0,Q.useRef)(null),G=(0,Q.useRef)(!1),K=(0,Q.useRef)(!1),te;e[0]!==n||e[1]!==t||e[2]!==i?(te=n??(i?q(i):t?v(t):null),e[0]=n,e[1]=t,e[2]=i,e[3]=te):te=e[3];let ne=te,re;e[4]!==r||e[5]!==ne||e[6]!==u||e[7]!==d||e[8]!==m?(re=u?`${r??`__new-tab__`}\u0000${m.join(`\0`)}\u0000${d.join(`\0`)}`:ne?`${ne}\u0000${m.join(`\0`)}`:``,e[4]=r,e[5]=ne,e[6]=u,e[7]=d,e[8]=m,e[9]=re):re=e[9];let ie=re,ae,se;e[10]===t?(ae=e[11],se=e[12]):(ae=()=>{ee.current=t},se=[t],e[10]=t,e[11]=ae,e[12]=se),(0,Q.useEffect)(ae,se);let ce,le;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(ce=()=>()=>{W.current!==null&&(window.clearTimeout(W.current),W.current=null)},le=[],e[13]=ce,e[14]=le):(ce=e[13],le=e[14]),(0,Q.useEffect)(ce,le);let ue,de;e[15]===ie?(ue=e[16],de=e[17]):(ue=()=>{ie&&(D.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},de=[ie],e[15]=ie,e[16]=ue,e[17]=de),(0,Q.useEffect)(ue,de);let fe,pe;e[18]===A?(fe=e[19],pe=e[20]):(fe=()=>{A&&(B.current?.focus(),B.current?.select())},pe=[A],e[18]=A,e[19]=fe,e[20]=pe),(0,Q.useEffect)(fe,pe);let me,he;e[21]!==m||e[22]!==A?(me=()=>{!A||m.includes(A.tabId)||(H.current=!0,U.current=null,j(null),N(``),F(null),L(!1))},he=[m,A],e[21]=m,e[22]=A,e[23]=me,e[24]=he):(me=e[23],he=e[24]),(0,Q.useEffect)(me,he);let ge;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(ge=function(e,t){let n=t.split(`/`);H.current=!1,U.current=null,j({docName:t,tabId:e}),N(n[n.length-1]),F(null)},e[25]=ge):ge=e[25];let _e=ge,ve=function(){H.current=!0,U.current=null,j(null),N(``),F(null),L(!1)},ye=async function(){if(H.current){H.current=!1;return}if(V.current)return;let e=A?.docName;if(!e){ve();return}let t=eI(`file`,xI(M,E.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){ve();return}if(t===U.current){B.current?.focus();return}if(!tI(t)){F(T({id:`P8yDjG`})),B.current?.focus();return}let i=nI({kind:`file`,path:e,name:r},t);V.current=!0,L(!0),F(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:i})});if(H.current){L(!1),V.current=!1;return}let r=await h(n,`Server error (HTTP ${n.status})`);if(!r.ok){F(r.title),L(!1),V.current=!1,U.current=t,B.current?.focus();return}let a=p(gi,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=ee.current,s=sI(o,a),c=!0;try{await b({renamed:a}),eu([`files`,`backlinks`,`graph`])}catch(n){let r=n;c=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),dl.error(T({id:`MUBR8r`}))}H.current=!0,j(null),N(``),F(null),L(!1),V.current=!1,U.current=null,c&&s&&s!==o&&bI(s)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),F(T({id:`HIb0vl`})),L(!1),V.current=!1,U.current=t,B.current?.focus()}},be=typeof window<`u`&&window.okDesktop!=null,xe;e[26]===d?xe=e[27]:(xe=new Set(d),e[26]=d,e[27]=xe);let Se=xe,Ce;e[28]===O?Ce=e[29]:(Ce=Lc(O),e[28]=O,e[29]=Ce);let we;e[30]===Ce?we=e[31]:(we=[Ce],e[30]=Ce,e[31]=we);let Te=we,Ee;e[32]!==s||e[33]!==l||e[34]!==Se?(Ee=function(e){let t=[],n=[];for(let r of e)Se.has(r)?n.push(r):t.push(r);t.length>0&&l(t);for(let e of n)s(e)},e[32]=s,e[33]=l,e[34]=Se,e[35]=Ee):Ee=e[35];let De=Ee,Oe,ke;e[36]!==o||e[37]!==a||e[38]!==r||e[39]!==ne||e[40]!==u||e[41]!==d||e[42]!==f||e[43]!==y||e[44]!==w?(Oe=()=>{let e=new Set(d),t=function(){W.current!==null&&(window.clearTimeout(W.current),W.current=null)},n=function(e){G.current!==e&&(G.current=e)},i=function(e){K.current!==e&&(K.current=e,z(e))},s=function(){n(!0),!(K.current||W.current!==null)&&(W.current=window.setTimeout(()=>{W.current=null,G.current&&i(!0)},CI))},c=function(){t(),n(!1),i(!1)},l=function(t){e.has(t)?o(t):a(t)},p=function(e){if(w.length===0)return;let t=u?r:ne,n=t?w.indexOf(t):-1;l(w[((n>=0?n:0)+e+w.length)%w.length])},m=function(e){if(SI(e)&&s(),xl(e,`tab-new`)){e.preventDefault(),f();return}if(xl(e,`tab-reopen-closed`)){e.preventDefault(),y();return}if(xl(e,`tab-next`)){e.preventDefault(),p(1);return}if(xl(e,`tab-previous`)){e.preventDefault(),p(-1);return}let t=DI(e,w.length);t!==null&&(e.preventDefault(),l(w[t]))},h=function(e){!e.metaKey&&!e.ctrlKey&&c()};return window.addEventListener(`keydown`,m,{capture:!0}),window.addEventListener(`keyup`,h,{capture:!0}),window.addEventListener(`blur`,c),document.addEventListener(`visibilitychange`,c),()=>{window.removeEventListener(`keydown`,m,{capture:!0}),window.removeEventListener(`keyup`,h,{capture:!0}),window.removeEventListener(`blur`,c),document.removeEventListener(`visibilitychange`,c)}},ke=[r,ne,o,a,u,d,f,y,w],e[36]=o,e[37]=a,e[38]=r,e[39]=ne,e[40]=u,e[41]=d,e[42]=f,e[43]=y,e[44]=w,e[45]=Oe,e[46]=ke):(Oe=e[45],ke=e[46]),(0,Q.useEffect)(Oe,ke);let Ae;e[47]===Symbol.for(`react.memo_cache_sentinel`)?(Ae={activationConstraint:{distance:8}},e[47]=Ae):Ae=e[47];let je;e[48]===Symbol.for(`react.memo_cache_sentinel`)?(je={coordinateGetter:df,keyboardCodes:Pc},e[48]=je):je=e[48];let Me=mf(uf(vf,Ae),uf(ff,je)),Ne=R,Pe;e[49]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=function(){k(Fc(D.current,`[data-editor-tab-sortable]`))},e[49]=Pe):Pe=e[49];let Fe=Pe,Ie;e[50]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=function(){k(null)},e[50]=Ie):Ie=e[50];let Le=Ie,ze;e[51]!==Le||e[52]!==x||e[53]!==w?(ze=function(e){Le();let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=w.indexOf(t),i=w.indexOf(n);r<0||i<0||r===i||x(pf([...w],r,i),t)},e[51]=Le,e[52]=x,e[53]=w,e[54]=ze):ze=e[54];let Be=ze,Ve=be?``:void 0,He;e[55]===Symbol.for(`react.memo_cache_sentinel`)?(He=Y(`pl-2 flex h-12 min-w-0 touch-manipulation flex-1 items-end overflow-x-auto overflow-y-hidden overscroll-x-contain scroll-fade-mask-x [scrollbar-width:none]`,be&&`[-webkit-app-region:drag]`),e[55]=He):He=e[55];let Ue=Sc,We;e[56]===Symbol.for(`react.memo_cache_sentinel`)?(We=Y(`flex items-end gap-1`,be&&`[-webkit-app-region:no-drag]`),e[56]=We):We=e[56];let Ge=gf,Ke=Mc,qe;e[57]===Symbol.for(`react.memo_cache_sentinel`)?(qe={container:typeof document<`u`?document.body:void 0},e[57]=qe):qe=e[57];let Je=_f,Ye;e[58]===w?Ye=e[59]:(Ye=[...w],e[58]=w,e[59]=Ye);let Xe=hf,Ze=w.map((e,t)=>{let n=R?TI(t,w.length):null,i=EI(t,w.length);if(Se.has(e)){let t=e===r;return(0,Z.jsx)(AI,{tabId:e,canPin:!1,openTabs:w,closeTab:s,closeTabs:De,pinTab:g,pinnedTabIds:_,unpinTab:S,children:(0,Z.jsxs)(kI,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":t?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":t?`true`:void 0,className:Y(hI,t?gI:_I),onAuxClick:t=>{t.button===1&&(t.preventDefault(),s(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:vI,onClick:()=>o(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(J,{id:`3YvS-c`})})}),n?(0,Z.jsx)(OI,{value:n}):(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:Tc(Ne||t),tabIndex:Ec(t),onClick:t=>{t.stopPropagation(),s(e)},children:(0,Z.jsx)(ul,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let l=C(e),u=e===ne,d=_.includes(e);if(l.kind===`folder`){let{baseName:t,label:r,prefix:o}=oe(l.folderPath,`/`),s=`${o}${r}`;return(0,Z.jsx)(AI,{tabId:e,openTabs:w,closeTab:c,closeTabs:De,pinTab:g,pinnedTabIds:_,unpinTab:S,children:(0,Z.jsxs)(kI,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":u?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":u?`true`:void 0,className:Y(hI,u?gI:_I),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&c(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":s,title:s,className:vI,onClick:()=>{a(e)},tabIndex:-1,children:[o&&(0,Z.jsx)(`span`,{className:Y(`min-w-0 flex-1 truncate`,u&&`text-muted-foreground`),children:o}),(0,Z.jsxs)(`span`,{className:Y(`flex min-w-0 items-center`,o?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`/`})]})]}),(0,Z.jsx)(jI,{accessibleLabel:s,closeTab:c,forceCloseVisible:Ne,isActive:u,isPinned:d,shortcutHint:n,tabId:e,unpinTab:S})]})},e)}if(l.kind===`asset`||l.kind===`skill-file`){let{baseName:t,label:r,prefix:o}=oe(l.kind===`asset`?l.assetPath:l.path,``),s=`${o}${r}`;return(0,Z.jsx)(AI,{tabId:e,openTabs:w,closeTab:c,closeTabs:De,pinTab:g,pinnedTabIds:_,unpinTab:S,children:(0,Z.jsxs)(kI,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":u?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":u?`true`:void 0,className:Y(hI,u?gI:_I),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&c(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":s,className:vI,onClick:()=>{a(e)},tabIndex:-1,children:[o?(0,Z.jsx)(`span`,{className:Y(`min-w-0 flex-1 truncate text-muted-foreground/60`,u&&`text-muted-foreground`),children:o}):null,(0,Z.jsx)(`span`,{className:Y(`min-w-0 truncate`,o?`max-w-[70%] shrink-0`:`flex-1`),children:t})]}),(0,Z.jsx)(jI,{accessibleLabel:s,closeTab:c,forceCloseVisible:Ne,isActive:u,isPinned:d,shortcutHint:n,tabId:e,unpinTab:S})]})},e)}let f=l.docName,p=E.get(f)?.docExt??`.md`,{baseName:m,extension:h,label:v,prefix:y}=oe(f,p),b=`${y}${v}`,x=p===`.md`||p===`.mdx`,D=A?.tabId===e,O=`editor-tab-rename-error-${yI(f)}`;return(0,Z.jsx)(AI,{disabled:D,tabId:e,openTabs:w,closeTab:c,closeTabs:De,pinTab:g,pinnedTabIds:_,unpinTab:S,children:(0,Z.jsx)(kI,{tabId:e,activateFromKeyboard:()=>a(e),disabled:D,"aria-current":u?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":u?`true`:void 0,className:Y(hI,u?gI:_I,D&&P&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&c(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:D?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Oc,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(xc,{ref:B,value:M,disabled:I,"aria-label":T({id:`Dw1T_W`,values:{label:v}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":P?!0:void 0,"aria-describedby":P?O:void 0,"aria-busy":I||void 0,title:P??f,className:`h-full min-w-0 px-2 py-0 font-medium text-foreground text-xs selection:bg-primary selection:text-primary-foreground`,onChange:e=>{N(xI(e.target.value,p)),F(null),U.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),ye()):e.key===`Escape`&&(e.preventDefault(),ve())},onBlur:ye}),(0,Z.jsx)(Dc,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(Bc,{className:`text-muted-foreground/60 text-xs`,children:p})})]}),P?(0,Z.jsx)(`span`,{id:O,role:`alert`,className:`sr-only`,children:P}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(NI,{accessibleLabel:b,activateTab:a,baseName:m,docName:f,enterRenameMode:_e,extension:h,hideDocExtension:x,tabId:e}),(0,Z.jsx)(jI,{accessibleLabel:b,closeTab:c,forceCloseVisible:Ne,isActive:u,isPinned:d,shortcutHint:n,tabId:e,unpinTab:S})]})})},e)}),Qe;e[60]!==Je||e[61]!==Ye||e[62]!==Xe||e[63]!==Ze?(Qe=(0,Z.jsx)(Je,{items:Ye,strategy:Xe,children:Ze}),e[60]=Je,e[61]=Ye,e[62]=Xe,e[63]=Ze,e[64]=Qe):Qe=e[64];let $e;e[65]!==Ge||e[66]!==Le||e[67]!==Be||e[68]!==Fe||e[69]!==Me||e[70]!==!1||e[71]!==Ke||e[72]!==qe||e[73]!==Qe||e[74]!==Te?($e=(0,Z.jsx)(Ge,{sensors:Me,autoScroll:!1,collisionDetection:Ke,modifiers:Te,onDragStart:Fe,onDragEnd:Be,onDragCancel:Le,accessibility:qe,children:Qe}),e[65]=Ge,e[66]=Le,e[67]=Be,e[68]=Fe,e[69]=Me,e[70]=!1,e[71]=Ke,e[72]=qe,e[73]=Qe,e[74]=Te,e[75]=$e):$e=e[75];let et;e[76]===T?et=e[77]:(et=T({id:`3YvS-c`}),e[76]=T,e[77]=et);let tt;e[78]===Symbol.for(`react.memo_cache_sentinel`)?(tt=(0,Z.jsx)(Ht,{"aria-hidden":`true`}),e[78]=tt):tt=e[78];let nt;e[79]!==f||e[80]!==et?(nt=(0,Z.jsx)(rn,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":et,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:f,children:tt})}),e[79]=f,e[80]=et,e[81]=nt):nt=e[81];let rt;e[82]===Symbol.for(`react.memo_cache_sentinel`)?(rt=(0,Z.jsx)(an,{children:(0,Z.jsx)(J,{id:`3YvS-c`})}),e[82]=rt):rt=e[82];let it;e[83]===nt?it=e[84]:(it=(0,Z.jsxs)(sn,{children:[nt,rt]}),e[83]=nt,e[84]=it);let at;e[85]!==We||e[86]!==$e||e[87]!==it?(at=(0,Z.jsxs)(`div`,{className:We,children:[$e,it]}),e[85]=We,e[86]=$e,e[87]=it,e[88]=at):at=e[88];let ot;return e[89]!==Ve||e[90]!==He||e[91]!==Ue||e[92]!==at?(ot=(0,Z.jsx)(`div`,{ref:D,"data-electron-drag":Ve,className:He,onWheel:Ue,children:at}),e[89]=Ve,e[90]=He,e[91]=Ue,e[92]=at,e[93]=ot):ot=e[93],ot}var FI=(e,t,n)=>{if(e&&`reportValidity`in e){let r=pp(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},II=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?FI(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>FI(t,n,e))}},LI=(e,t)=>{t.shouldUseNativeValidation&&II(e,t);let n={};for(let r in e){let i=pp(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.ref});if(RI(t.names||Object.keys(e),r)){let e=Object.assign({},pp(n,r));ip(e,`root`,a),ip(n,r,e)}else ip(n,r,a)}return n},RI=(e,t)=>{let n=zI(t).replace(/[.*+?^${}()|\\]/g,`\\$&`);return e.some(e=>zI(e).match(`^${n}\\.\\d+`))};function zI(e){return e.replace(/[\[\]]/g,``)}function BI(){return BI=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},BI.apply(null,arguments)}function VI(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function HI(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]=sp(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function UI(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(BI({},t,{path:[].concat(r.path,t.path)}))})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=sp(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()};e.length;)r();return n}function WI(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(VI(function(){return Promise.resolve(e[n.mode===`sync`?`parse`:`parseAsync`](r,t)).then(function(e){return a.shouldUseNativeValidation&&II({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return Array.isArray(e?.issues)}(e))return{values:{},errors:LI(HI(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(VI(function(){return Promise.resolve((n.mode===`sync`?Qa:Ba)(e,r,t)).then(function(e){return a.shouldUseNativeValidation&&II({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return e instanceof Ja}(e))return{values:{},errors:LI(UI(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 GI=`https://openknowledge.ai/api/subscribe`;async function KI(e,t){try{let n=await fetch(GI,{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 qI(e){let t=(0,$.c)(49),{source:n,title:r,description:i,onSuccess:a,onDismiss:o,autoFocus:s,compactSubmit:c,className:l}=e,{_:u}=mt(),[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=ci({email:ca({message:u({id:`Wq6Wcm`})})});_=ap,g=WI(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 KI(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=Y(`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)(Po,{className:`size-4 text-primary`}),(0,Z.jsx)(J,{id:`PIMM5l`})]}):r??(0,Z.jsx)(J,{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)(J,{id:`pBROkv`}):i??(0,Z.jsx)(J,{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)(ul,{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)(rp,{control:b.control,name:`email`,render:e=>{let{field:t,fieldState:n}=e;return(0,Z.jsxs)(Oc,{className:`h-10 rounded-xl`,children:[(0,Z.jsx)(Dc,{className:`pl-2.5`,children:(0,Z.jsx)(Gh,{className:`size-4 text-muted-foreground opacity-60`})}),(0,Z.jsx)(xc,{...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:Y(`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)(Gc,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`lCC_D5`})})]}):c?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Kn,{className:`size-4`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`EDl9kS`})})]}):(0,Z.jsx)(J,{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 JI=`ok-feedback-nudge-v1`,YI={firstSeenAt:null,shownAt:null,dismissed:!1};function XI(e){let t=0;for(let n of e)Bl(n)||t++;return t}function ZI(e,t,n){return!e.dismissed&&e.shownAt==null&&e.firstSeenAt!=null&&t-e.firstSeenAt>=12096e5&&n>=10}function QI(e){return e===!0}function $I(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:null}function eL(e){if(typeof e!=`object`||!e)return YI;let t=e;return{firstSeenAt:$I(t.firstSeenAt),shownAt:$I(t.shownAt),dismissed:QI(t.dismissed)}}function tL(e){try{let t=(e??localStorage).getItem(JI);return t==null?YI:eL(JSON.parse(t))}catch(e){return console.warn(`[feedback-nudge-store] readPersistedState failed (corrupt/privacy/SSR)`,e),YI}}function nL(e,t){try{(t??localStorage).setItem(JI,JSON.stringify(e))}catch(e){console.warn(`[feedback-nudge-store] writePersistedState failed (quota/privacy/SSR)`,e)}}function rL(e){let t=tL(e),n=new Set,r=!1;function i(){for(let e of n)e()}function a(n){t=n,nL(t,e),i()}function o(){t=tL(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 iL=rL();typeof window<`u`&&typeof window.addEventListener==`function`&&window.addEventListener(`storage`,e=>{(e.key===`ok-feedback-nudge-v1`||e.key===null)&&iL.syncFromStorage()});function aL(){iL.install()}var oL=`https://github.com/inkeep/open-knowledge`,sL=`https://discord.gg/VRKk2EaGHN`,cL=`https://x.com/OpenKnowledge`,lL=`ok-subscribe-card-v1`,uL={subscribed:!1,dismissed:!1,shownVersions:[]};function dL(e,t){return!e.subscribed&&!e.dismissed&&e.shownVersions.length<3&&!e.shownVersions.includes(t)}function fL(e){return e===!0}function pL(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function mL(e){if(typeof e!=`object`||!e)return uL;let t=e;return{subscribed:fL(t.subscribed),dismissed:fL(t.dismissed),shownVersions:pL(t.shownVersions)}}function hL(e){try{let t=(e??localStorage).getItem(lL);return t==null?uL:mL(JSON.parse(t))}catch(e){return console.warn(`[subscribe-card-store] readPersistedState failed (corrupt/privacy/SSR)`,e),uL}}function gL(e,t){try{(t??localStorage).setItem(lL,JSON.stringify(e))}catch(e){console.warn(`[subscribe-card-store] writePersistedState failed (quota/privacy/SSR)`,e)}}function _L(e){let t=hL(e),n=new Set,r=!1;function i(){for(let e of n)e()}function a(n){t=n,gL(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=hL(e),i())}}}var vL=_L();function yL(){vL.install()}function bL(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 xL(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 SL=[{key:`resources`,heading:{id:`s-MGs7`},links:[{label:{id:`TbjyhA`},href:`https://openknowledge.ai/docs`,icon:ge}]},{key:`community`,heading:{id:`chL5IG`},links:[{label:`Discord`,href:sL,icon:bL},{label:`X (Twitter)`,href:cL,icon:xL},{label:`GitHub`,href:oL,icon:Yg}]}],CL=`${oL}/releases`,wL=`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 TL(e){if(e<1e3)return String(e);let t=e/1e3;return`${t>=10?Math.round(t):t.toFixed(1)}k`}var EL=e=>{let t=(0,$.c)(12),{count:n}=e,{_:r}=mt(),i,a,o,s;t[0]!==r||t[1]!==n?(i=TL(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)(fg,{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},DL=e=>{let t=(0,$.c)(15),{link:n,trailing:r}=e,{_:i}=mt(),{label:a,href:o,icon:s}=n,c,l;t[0]===o?(c=t[1],l=t[2]):(c=e=>rd(e,o),l=e=>rd(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:wL,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},OL=e=>{let t=(0,$.c)(7),{icon:n,onSelect:r,children:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=Y(wL,`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},kL=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},AL=()=>{let e=(0,$.c)(36),{_:t}=mt(),[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=typeof window<`u`&&window.okDesktop!=null,p,m;e[0]!==n||e[1]!==u?(p=()=>{if(!n||u!==null)return;let e=new AbortController;return Ci({signal:e.signal}).then(e=>{e!==null&&d(e)}),()=>e.abort()},m=[n,u],e[0]=n,e[1]=u,e[2]=p,e[3]=m):(p=e[2],m=e[3]),(0,Q.useEffect)(p,m);let h;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>{r(e),e||a(!1)},e[4]=h):h=e[4];let g;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(Pe,{className:`size-4`}),e[5]=g):g=e[5];let _;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(rn,{asChild:!0,children:(0,Z.jsx)(Bt,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[g,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`s-MGs7`})})]})})}),e[6]=_):_=e[6];let v;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsxs)(sn,{children:[_,(0,Z.jsx)(an,{children:(0,Z.jsx)(J,{id:`s-MGs7`})})]}),e[7]=v):v=e[7];let y;e[8]!==t||e[9]!==u?(y=SL.map((e,n)=>(0,Z.jsxs)(`div`,{className:Y(n>0&&`mt-3`),children:[(0,Z.jsx)(kL,{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)(DL,{link:e,trailing:e.href===`https://github.com/inkeep/open-knowledge`&&u!==null?(0,Z.jsx)(EL,{count:u}):void 0},e.href)),e.key===`resources`&&(0,Z.jsxs)(Z.Fragment,{children:[f&&(0,Z.jsx)(OL,{icon:tt,onSelect:()=>{r(!1),s(!0)},children:(0,Z.jsx)(J,{id:`cd5EXh`})}),(0,Z.jsx)(OL,{icon:qh,onSelect:()=>{r(!1),l(!0)},children:(0,Z.jsx)(J,{id:`RoafuO`})})]})]})})]},e.key)),e[8]=t,e[9]=u,e[10]=y):y=e[10];let b;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(kL,{children:(0,Z.jsx)(J,{id:`arUUsK`})}),e[11]=b):b=e[11];let x;e[12]===t?x=e[13]:(x=t({id:`arUUsK`}),e[12]=t,e[13]=x);let S;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(DL,{link:{label:{id:`3ePd3I`},href:CL,icon:Kh}}),e[14]=S):S=e[14];let C;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(Bt,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,className:Y(wL,`h-auto w-full justify-start font-normal`),children:[(0,Z.jsx)(Gh,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Z.jsx)(J,{id:`EDl9kS`})]})}),e[15]=C):C=e[15];let w;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(Gt,{side:`left`,align:`center`,sideOffset:20,className:`w-80`,children:(0,Z.jsx)(qI,{source:`resources_menu`,autoFocus:!0,onDismiss:()=>a(!1),onSuccess:jL})}),e[16]=w):w=e[16];let T;e[17]===i?T=e[18]:(T=(0,Z.jsxs)(`ul`,{className:`space-y-0.5`,children:[S,(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(zt,{open:i,onOpenChange:a,children:[C,w]})})]}),e[17]=i,e[18]=T);let E;e[19]!==T||e[20]!==x?(E=(0,Z.jsxs)(`div`,{className:`mt-3`,children:[b,(0,Z.jsx)(`nav`,{"aria-label":x,children:T})]}),e[19]=T,e[20]=x,e[21]=E):E=e[21];let D;e[22]!==E||e[23]!==y?(D=(0,Z.jsxs)(Gt,{align:`end`,className:`w-56 p-3`,children:[y,E]}),e[22]=E,e[23]=y,e[24]=D):D=e[24];let O;e[25]!==n||e[26]!==D?(O=(0,Z.jsxs)(zt,{open:n,onOpenChange:h,children:[v,D]}),e[25]=n,e[26]=D,e[27]=O):O=e[27];let k;e[28]===o?k=e[29]:(k=f&&(0,Z.jsx)(im,{open:o,onOpenChange:s}),e[28]=o,e[29]=k);let A;e[30]===c?A=e[31]:(A=(0,Z.jsx)(B_,{open:c,onOpenChange:l,onSuccess:ML}),e[30]=c,e[31]=A);let j;return e[32]!==O||e[33]!==k||e[34]!==A?(j=(0,Z.jsxs)(Z.Fragment,{children:[O,k,A]}),e[32]=O,e[33]=k,e[34]=A,e[35]=j):j=e[35],j};function jL(){return vL.markSubscribed()}function ML(){return iL.dismiss()}function NL(e){let t=(0,$.c)(14),{className:n}=e,{_:r}=mt(),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)(co,{"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)(rn,{asChild:!0,children:(0,Z.jsxs)(xu,{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)(an,{children:l}),t[9]=l,t[10]=u);let d;return t[11]!==c||t[12]!==u?(d=(0,Z.jsxs)(sn,{children:[c,u]}),t[11]=c,t[12]=u,t[13]=d):d=t[13],d}var PL=1,FL=2,IL=PL|FL;function LL(){if(!(typeof window>`u`))return window.navigation}function RL(){let e=LL();return e?(e.canGoBack?PL:0)|(e.canGoForward?FL:0):IL}function zL(e){let t=LL();return t?(t.addEventListener(`currententrychange`,e),()=>t.removeEventListener(`currententrychange`,e)):()=>{}}function BL(){let e=(0,$.c)(42),{_:t}=mt(),n=(0,Q.useSyncExternalStore)(zL,RL,UL),r=(n&PL)!==0,i=(n&FL)!==0,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=kl(`navigate-back`),e[0]=a):a=e[0];let o=a,s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=El(`navigate-back`),e[1]=s):s=e[1];let c=s,l;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=kl(`navigate-forward`),e[2]=l):l=e[2];let u=l,d;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=El(`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)(Pn,{"aria-hidden":`true`}),e[8]=g):g=e[8];let _;e[9]!==m||e[10]!==h?(_=(0,Z.jsx)(rn,{asChild:!0,children:(0,Z.jsx)(X,{"aria-label":m,disabled:h,onClick:HL,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)(U,{"aria-label":c,children:o}),e[16]=b):b=e[16];let x;e[17]===y?x=e[18]:(x=(0,Z.jsxs)(an,{children:[y,` `,b]}),e[17]=y,e[18]=x);let S;e[19]!==x||e[20]!==_?(S=(0,Z.jsxs)(sn,{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)(Kn,{"aria-hidden":`true`}),e[24]=T):T=e[24];let E;e[25]!==C||e[26]!==w?(E=(0,Z.jsx)(rn,{asChild:!0,children:(0,Z.jsx)(X,{"aria-label":C,disabled:w,onClick:VL,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)(U,{"aria-label":f,children:u}),e[32]=k):k=e[32];let A;e[33]===O?A=e[34]:(A=(0,Z.jsxs)(an,{children:[O,` `,k]}),e[33]=O,e[34]=A);let j;e[35]!==E||e[36]!==A?(j=(0,Z.jsxs)(sn,{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)(of,{"aria-label":p,className:`shrink-0 [-webkit-app-region:no-drag]`,"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 VL(){return Wt(`navigate-forward`)}function HL(){return Wt(`navigate-back`)}function UL(){return IL}var WL=50,GL=()=>{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,iT.preload()},WL))},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,s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>()=>{t.current!==null&&clearTimeout(t.current)},s=[],e[2]=o,e[3]=s):(o=e[2],s=e[3]),(0,Q.useEffect)(o,s);let c,l;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{a(),window.location.hash!==`#settings`&&(window.location.hash=Ol)},l=(0,Z.jsx)(ag,{className:`size-4`}),e[4]=c,e[5]=l):(c=e[4],l=e[5]);let u;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(rn,{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:c,children:[l,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`Tz0i8g`})})]})}),e[6]=u):u=e[6];let d;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsxs)(sn,{children:[u,(0,Z.jsx)(an,{children:(0,Z.jsx)(J,{id:`Tz0i8g`})})]}),e[7]=d):d=e[7],d},KL=`https://openknowledge.ai/docs/features/share`,qL={mac:`⌘ C`,windowsLinux:`Ctrl C`};function JL(e){let t=(0,$.c)(52),{input:n,onClickWhenNoRemote:r}=e,{_:i}=mt(),{status:a}=fo(),[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=cc(c?.freshness,a),g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=yl(qL),t[4]=g):g=t[4];let _=g,v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v=bl(qL),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 ps({...n,hasRemote:p,onClickWhenNoRemote:r},{clipboardWrite:af,toastSuccess:nR,toastError:tR,logEvent:eR});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{dl.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)(og,{className:`size-3.5`,"aria-hidden":!0}),D=(0,Z.jsx)(J,{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)(Ut,{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=Y(`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)(J,{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)(J,{id:`vj-33a`,values:{copyShortcut:_},components:{0:(0,Z.jsx)(U,{"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)(_l,{ref:u,readOnly:!0,value:N,onFocus:$L,onClick:QL,onContextMenu:ZL,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)(Ro,{copyContent:I,clipboardWrite:af,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)(oc,{freshness:B,status:a,kind:V}),t[38]=a,t[39]=B,t[40]=V,t[41]=H):H=t[41];let ee;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsxs)(`a`,{href:KL,target:`_blank`,rel:`noopener noreferrer`,onClick:XL,onAuxClick:YL,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)(Pe,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(J,{id:`aByJ8j`})]}),t[42]=ee):ee=t[42];let W;t[43]!==A||t[44]!==M||t[45]!==z||t[46]!==H?(W=(0,Z.jsxs)(Gt,{align:`end`,className:A,"data-testid":`share-button-popover`,children:[j,M,z,H,ee]}),t[43]=A,t[44]=M,t[45]=z,t[46]=H,t[47]=W):W=t[47];let G;return t[48]!==O||t[49]!==W||t[50]!==S?(G=(0,Z.jsxs)(zt,{open:S,onOpenChange:C,children:[O,W]}),t[48]=O,t[49]=W,t[50]=S,t[51]=G):G=t[51],G}function YL(e){return rd(e,KL)}function XL(e){return rd(e,KL)}function ZL(e){return e.currentTarget.select()}function QL(e){return e.currentTarget.select()}function $L(e){return e.currentTarget.select()}function eR(e){return console.log(e)}function tR(e){e!==`Link ready but could not copy to clipboard.`&&dl.error(e)}function nR(e){return dl.success(e)}var rR=(0,Q.lazy)(()=>n(()=>import(`./AppMenubar-CXadCCMc.js`).then(e=>({default:e.AppMenubar})),__vite__mapDeps([161,1,10,11,12,14,15,16,17,49,113,30,31,19,24,25,50,20,92,22]),import.meta.url));function iR(e){let t=(0,$.c)(40),{onSignIn:n,onSetIdentity:r,onOpenSearch:i}=e,{_:a}=mt(),{activeDocName:o,activeTarget:s}=Re(),c=o?Ii(o):null,{state:l,isDraggingRail:u}=JN(),d=Bv(),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=kl(`toggle-files-sidebar`),t[0]=f):f=t[0];let p=f,m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(m=El(`toggle-files-sidebar`),t[1]=m):m=t[1];let h=m,g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=kl(`command-palette`),t[2]=g):g=t[2];let _=g,v=El(`command-palette`),[y,b]=(0,Q.useState)(!1),x;bb0:{if(s?.kind===`folder`){let e;t[3]===s.folderPath?e=t[4]:(e=Es(s.folderPath),t[3]=s.folderPath,t[4]=e),x=e;break bb0}if(o&&!c){let e;t[5]===o?e=t[6]:(e=Vs(o),t[5]=o,t[6]=e),x=e;break bb0}if(!s&&!o){let e;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=Es(``),t[7]=e):e=t[7],x=e;break bb0}x=null}let S=x,C=typeof window<`u`&&window.okDesktop!=null,w=l===`collapsed`,T=C?``:void 0,E=C&&w&&`pl-[var(--ok-titlebar-reserve-left,1rem)]`,D=C&&!u&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`,O;t[8]!==E||t[9]!==D?(O=Y(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,C&&`[-webkit-app-region:drag]`,E,D),t[8]=E,t[9]=D,t[10]=O):O=t[10];let k;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(k=_F()&&(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(rR,{})}),t[11]=k):k=t[11];let A=!d&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(of,{"aria-label":a({id:`V6AIOn`}),className:Y(`-ml-1 shrink-0 has-[>[data-slot=button-group]]:gap-0`,C&&`[-webkit-app-region:no-drag]`),children:[(0,Z.jsxs)(sn,{children:[(0,Z.jsx)(rn,{asChild:!0,children:(0,Z.jsx)($N,{className:Y(`shrink-0 text-muted-foreground`,C&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsxs)(an,{children:[(0,Z.jsx)(`span`,{children:a(l===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`})}),` `,(0,Z.jsx)(U,{"aria-label":h,children:p})]})]}),w&&i&&(0,Z.jsxs)(sn,{children:[(0,Z.jsx)(rn,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,onClick:i,"aria-label":a({id:`DbCfXV`,values:{searchShortcutLabel:v}}),"data-telemetry-event":`ok.editor_header.search.click`,className:Y(`shrink-0 text-muted-foreground`,C&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(Ge,{"aria-hidden":`true`})})}),(0,Z.jsxs)(an,{children:[(0,Z.jsx)(`span`,{children:a({id:`A1taO8`})}),` `,(0,Z.jsx)(U,{"aria-label":v,children:_})]})]}),C&&w&&(0,Z.jsx)(BL,{})]}),(0,Z.jsx)(zr,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(PI,{})]}),j;t[12]!==k||t[13]!==A?(j=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:[k,A]}),t[12]=k,t[13]=A,t[14]=j):j=t[14];let M;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=Y(`flex shrink-0 items-center justify-end gap-2 px-3`,C&&`*:[-webkit-app-region:no-drag]`,C&&`mr-[var(--ok-titlebar-reserve-right,0px)]`),t[15]=M):M=t[15];let N;t[16]!==y||t[17]!==b||t[18]!==S||t[19]!==d?(N=!d&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(JL,{input:S,onClickWhenNoRemote:()=>b(!0)}),(0,Z.jsx)(Ts,{open:y,onOpenChange:b})]}),t[16]=y,t[17]=b,t[18]=S,t[19]=d,t[20]=N):N=t[20];let P;t[21]!==r||t[22]!==n?(P=(0,Z.jsx)(Bs,{onSignIn:n,onSetIdentity:r}),t[21]=r,t[22]=n,t[23]=P):P=t[23];let F,I,L,R;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(XF,{}),I=(0,Z.jsx)(zr,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),L=(0,Z.jsx)(NL,{}),R=(0,Z.jsx)($F,{}),t[24]=F,t[25]=I,t[26]=L,t[27]=R):(F=t[24],I=t[25],L=t[26],R=t[27]);let z;t[28]===d?z=t[29]:(z=!d&&(0,Z.jsx)(GL,{}),t[28]=d,t[29]=z);let B;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(AL,{}),t[30]=B):B=t[30];let V;t[31]!==N||t[32]!==P||t[33]!==z?(V=(0,Z.jsxs)(`div`,{className:M,children:[N,P,F,I,L,R,z,B]}),t[31]=N,t[32]=P,t[33]=z,t[34]=V):V=t[34];let H;return t[35]!==j||t[36]!==V||t[37]!==T||t[38]!==O?(H=(0,Z.jsxs)(`header`,{"data-electron-drag":T,className:O,children:[j,V]}),t[35]=j,t[36]=V,t[37]=T,t[38]=O,t[39]=H):H=t[39],H}var aR=(0,Q.lazy)(()=>n(()=>import(`./AgentThreadClientBinder-MaSL3zla.js`).then(e=>({default:e.AgentThreadClientBinder})),__vite__mapDeps([162,1,22,12,163,47,99,17,101,6,2,3,7,8,9]),import.meta.url)),oR=(0,Q.lazy)(()=>n(()=>import(`./TerminalSessionsHost-B2cWbpj-.js`).then(e=>({default:e.TerminalSessionsHost})),__vite__mapDeps([164,1,2,111,17,12,6,3,7,8,9,47,10,11,14,15,16,49,112,113,30,31,19,24,25,50,20,92,22,89,29,51,26,118,105,36,165,121,68,106,39,41,42,33,98,38,27,99,137,84,85,86,87,138,163,166,122]),import.meta.url));function sR(e){let t=(0,$.c)(90),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,[i,a]=Yy(),[o,s]=(0,Q.useState)(i),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(`auth`),[f,p]=(0,Q.useState)(Zb[0].id),[m,h]=(0,Q.useState)(!1),g=typeof window<`u`?window.okDesktop??null:null,_=g!=null&&g.terminal!=null&&g.config.ptyAvailable===!0,[v,y]=(0,Q.useState)(!1),b=Nd(),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(!1),T=(0,Q.useRef)(!1),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(null),A=(0,Q.useRef)(0),[j,M]=(0,Q.useState)(ib),N;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(N=function(e){M(e),rb(e),y(!0)},t[2]=N):N=t[2];let P=N,F;t[3]===j?F=t[4]:(F=function(){P(j===`right`?`bottom`:`right`)},t[3]=j,t[4]=F);let I=F,L;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(L={container:null,isShowing:!1,dockPosition:`bottom`,editorRegion:null},t[5]=L):L=t[5];let[R,z]=(0,Q.useState)(L),B=(0,Q.useRef)(0),V;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(V=function(){y(!0),Ic()},t[6]=V):V=t[6];let H=V,U;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(U=function(){y(!0)},t[7]=U):U=t[7];let ee=U,W=uo(),{projectConfig:G,projectLocalConfig:K,projectLocalSynced:te,projectSynced:ne}=td(),{activeDocName:q}=Re(),re=W?.hasRemote,ie=W?.pushPermission?.checkStatus,ae;t[8]!==m||t[9]!==G||t[10]!==K||t[11]!==te||t[12]!==ne||t[13]!==re||t[14]!==ie?(ae=sb({autoSyncOnboardingDismissed:m,hasRemote:re,projectLocalSynced:te,projectSynced:ne,projectLocalConfig:K,projectConfig:G,pushPermissionCheckStatus:ie}),t[8]=m,t[9]=G,t[10]=K,t[11]=te,t[12]=ne,t[13]=re,t[14]=ie,t[15]=ae):ae=t[15];let oe=ae,se,ce;t[16]===q?(se=t[17],ce=t[18]):(se=()=>{let e=function(e){let t=e.detail;t&&q&&Md(q,{kind:`raw-mdx`,detail:t}),s(`source`)};return window.addEventListener(Vy,e),()=>window.removeEventListener(Vy,e)},ce=[q],t[16]=q,t[17]=se,t[18]=ce),(0,Q.useEffect)(se,ce);let le;t[19]!==q||t[20]!==o?(le=function(e){if(!_||q==null)return!1;let t=pd(q,o)?.markdown??``;if(t.trim()===``)return!1;let n=`${dk(q,t)}\n\n`;return y(!0),Kt(n,{newTab:e,submit:!1}),!0},t[19]=q,t[20]=o,t[21]=le):le=t[21];let ue=(0,Q.useEffectEvent)(le),de;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(de=()=>H(),t[22]=de):de=t[22];let fe=(0,Q.useEffectEvent)(de),pe;t[23]===ue?pe=t[24]:(pe=()=>Vt(e=>{if(e===`toggle-terminal`){if(ue(!1))return;y(uR)}else e===`new-terminal`&&y(!0)}),t[23]=ue,t[24]=pe);let me;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(me=[],t[25]=me):me=t[25],(0,Q.useEffect)(pe,me);let he;t[26]===ue?he=t[27]:(he=()=>{if(window.okDesktop!=null)return;let e=function(e){if(xl(e,`toggle-terminal-panel`)){if(e.preventDefault(),ue(!1))return;y(lR)}};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},t[26]=ue,t[27]=he);let ge;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(ge=[],t[28]=ge):ge=t[28],(0,Q.useEffect)(he,ge);let _e;t[29]!==fe||t[30]!==ue?(_e=()=>{if(!_)return;let e=function(e){xl(e,`new-terminal-tab`)&&(e.preventDefault(),ue(!0)||fe())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},t[29]=fe,t[30]=ue,t[31]=_e):_e=t[31];let ve;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(ve=[_],t[32]=ve):ve=t[32],(0,Q.useEffect)(_e,ve);let ye,be;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ye=()=>Nc((e,t,n)=>{let{stage:r}=n;y(!0),B.current+=1,D({prompt:r?null:e,cli:t,nonce:B.current,stagePaste:r?e:void 0})}),be=[],t[33]=ye,t[34]=be):(ye=t[33],be=t[34]),(0,Q.useEffect)(ye,be);let xe,Se;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(xe=()=>ls(e=>{y(!0),A.current+=1,k({agentSource:e.agentSource,agentId:e.agentId,prompt:e.prompt,docName:e.docName,titleHint:e.titleHint,nonce:A.current})}),Se=[],t[35]=xe,t[36]=Se):(xe=t[35],Se=t[36]),(0,Q.useEffect)(xe,Se);let Ce,we;t[37]===v?(Ce=t[38],we=t[39]):(Ce=()=>{v||D(null)},we=[v],t[37]=v,t[38]=Ce,t[39]=we),(0,Q.useEffect)(Ce,we);let Te,Ee;t[40]!==C||t[41]!==v?(Te=()=>{window.okDesktop!=null&&C&&(_c({terminalVisible:v}),window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:v}))},Ee=[v,C],t[40]=C,t[41]=v,t[42]=Te,t[43]=Ee):(Te=t[42],Ee=t[43]),(0,Q.useEffect)(Te,Ee);let De,Oe;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(De=()=>{let e=window.okDesktop;if(e==null)return;if(typeof e.terminal?.getDockState!=`function`){w(!0);return}let t=!1;return e.terminal.getDockState().then(e=>{t||!e.visible||(T.current=!0,y(!0))}).catch(cR).finally(()=>{t||w(!0)}),()=>{t=!0}},Oe=[],t[44]=De,t[45]=Oe):(De=t[44],Oe=t[45]),(0,Q.useEffect)(De,Oe);let ke,Ae;t[46]===v?(ke=t[47],Ae=t[48]):(ke=()=>{if(window.okDesktop!=null){if(T.current){T.current=!1;return}v&&oi()}},Ae=[v],t[46]=v,t[47]=ke,t[48]=Ae),(0,Q.useEffect)(ke,Ae),Xy(W?.pausedReason),Qy();let je;t[49]===a?je=t[50]:(je=function(e){s(e),a(e)},t[49]=a,t[50]=je);let Me=je,Ne;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(aR,{})}),t[51]=Ne):Ne=t[51];let Pe,Fe;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=()=>{d(`auth`),l(!0)},Fe=()=>{d(`identity`),l(!0)},t[52]=Pe,t[53]=Fe):(Pe=t[52],Fe=t[53]);let Ie;t[54]===r?Ie=t[55]:(Ie=(0,Z.jsx)(iR,{onSignIn:Pe,onSetIdentity:Fe,onOpenSearch:r}),t[54]=r,t[55]=Ie);let Le;t[56]!==f||t[57]!==o||t[58]!==Me||t[59]!==x||t[60]!==j||t[61]!==v?(Le=(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)(lF,{editorMode:o,onModeChange:Me,activeTab:f,onActiveTabChange:p,terminalBridge:_?g:null,terminalVisible:v,onTerminalVisibleChange:y,terminalDock:j,terminalHasSessions:x,onTerminalPlacement:z,onRevealTerminal:ee})})}),t[56]=f,t[57]=o,t[58]=Me,t[59]=x,t[60]=j,t[61]=v,t[62]=Le):Le=t[62];let ze;t[63]===R.editorRegion?ze=t[64]:(ze=()=>R.editorRegion?.focus(),t[63]=R.editorRegion,t[64]=ze);let Be;t[65]!==b||t[66]!==ze||t[67]!==j||t[68]!==E||t[69]!==R.container||t[70]!==R.isShowing||t[71]!==v||t[72]!==O||t[73]!==I?(Be=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(oR,{bridge:_?g:null,visible:v,onVisibleChange:y,launch:E,threadLaunch:O,installedClis:b,container:R.container,isShowing:R.isShowing,onRequestEditorFocus:ze,dockPosition:j,onToggleDock:I,onHasSessionsChange:S})}),t[65]=b,t[66]=ze,t[67]=j,t[68]=E,t[69]=R.container,t[70]=R.isShowing,t[71]=v,t[72]=O,t[73]=I,t[74]=Be):Be=t[74];let Ve=u===`identity`,He;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(He=()=>{l(!1)},t[75]=He):He=t[75];let Ue;t[76]!==c||t[77]!==Ve?(Ue=(0,Z.jsx)(_s,{open:c,onOpenChange:l,identityPrompt:Ve,onSuccess:He}),t[76]=c,t[77]=Ve,t[78]=Ue):Ue=t[78];let We=oe!==null,Ge=oe??`full`,Ke;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=()=>h(!0),t[79]=Ke):Ke=t[79];let qe;t[80]!==We||t[81]!==Ge?(qe=(0,Z.jsx)(ab,{open:We,variant:Ge,onResolved:Ke}),t[80]=We,t[81]=Ge,t[82]=qe):qe=t[82];let Je;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(Je=(0,Z.jsx)(Ry,{}),t[83]=Je):Je=t[83];let Ye;return t[84]!==Ie||t[85]!==Le||t[86]!==Be||t[87]!==Ue||t[88]!==qe?(Ye=(0,Z.jsxs)(Z.Fragment,{children:[Ne,Ie,Le,Be,Ue,qe,Je]}),t[84]=Ie,t[85]=Le,t[86]=Be,t[87]=Ue,t[88]=qe,t[89]=Ye):Ye=t[89],Ye}function cR(e){console.error(`[terminal] dock-state restore failed; staying hidden:`,e)}function lR(e){return!e}function uR(e){return!e}function dR(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(!1),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>Vt(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)(B_,{open:t,onOpenChange:n,source:`help_menu`}),e[2]=t,e[3]=a),a}function fR(e){let t=vu(su(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function pR(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=Ss();if(n)return null;if(r===`server`){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`section`,{"data-testid":`conflicts-section`,"aria-label":`Conflicted files`,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:(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)(al,{"aria-hidden":`true`,className:`mr-1.5 inline size-3`}),`Couldn't load conflicts — reload to retry.`]})}),e[0]=t):t=e[0],t}if(t.length===0)return null;let i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(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)(al,{"aria-hidden":`true`,className:`size-3`}),`Conflicts`]}),e[1]=i):i=e[1];let a;e[2]===t.length?a=e[3]:(a=(0,Z.jsxs)(`header`,{className:`flex items-center justify-between px-2 pb-1.5`,children:[i,(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[2]=t.length,e[3]=a);let o;e[4]===t?o=e[5]:(o=t.map(mR),e[4]=t,e[5]=o);let s;e[6]===o?s=e[7]:(s=(0,Z.jsx)(`ul`,{className:`flex flex-col gap-px`,children:o}),e[6]=o,e[7]=s);let c;return e[8]!==a||e[9]!==s?(c=(0,Z.jsxs)(`section`,{"data-testid":`conflicts-section`,"aria-label":`Conflicted files`,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:[a,s]}),e[8]=a,e[9]=s,e[10]=c):c=e[10],c}function mR(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:()=>fR(e.file),children:[(0,Z.jsx)(al,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var hR=`proactive_card`;function gR(){let e=!1,t=!1;return{isEvaluated:()=>e,isShown:()=>t,latchEvaluated:()=>{e=!0},latchShown:()=>{t=!0}}}var _R=gR();function vR(e){let t=(0,$.c)(14),{pages:n,ready:r,blocked:i,store:a,now:o,session:s}=e,c=a===void 0?iL:a,l=o===void 0?Date.now:o,u=s===void 0?_R: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&&ZI(c.getSnapshot(),l(),XI(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 yR=`Relaunch`,bR=`Release notes`,xR=`Updates paused`,SR=`Download`,CR=`Reset to defaults`,wR=`Relaunching to install the update…`,TR=`Relaunch failed — please restart manually`;function ER(e){return`Update to ${e} didn't install.`}var DR=`Retry`,OR=`Download manually`,kR=`Recovery action failed — please try again`;function AR(e,t){let n=t instanceof Error&&t.message?t.message:``;return n?`${e}: ${n}`:e}function jR(e){return`Version ${e} ready to install`}function MR(e){return`Updated to Version ${e}`}function NR(e){return`Your settings and recent projects were saved by a newer build than this one (v${e}). Reset to defaults to continue.`}var PR=0,FR=0,IR=1,LR=2,RR=3,zR=6e4;function BR(e,t,n=()=>{},r=zR,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:jR(r),priority:LR,action:{label:yR,onClick:()=>{t({id:i,body:wR,priority:LR,dismissible:!1}),e.update.relaunchNow().then(()=>{n(i)},e=>{a(),t({id:`relaunch-error-${r}`,body:AR(TR,e),variant:`error`,priority:IR})})}}})};a()})),a.push(e.onUpdateRelaunching(()=>{t({id:s,body:wR,priority:LR,dismissible:!1})})),a.push(e.onUpdateRelaunchFailed(({version:r,message:i,downloadUrl:a})=>{if(a){let i=`install-failed-${r}`,o=()=>{t({id:i,body:ER(r),variant:`error`,priority:IR,action:{label:DR,onClick:()=>{e.update.relaunchNow().then(()=>{n(i)},e=>{console.warn(`[update-notice] install-failed retry rejected`,e),o()})}},secondaryAction:{label:OR,onClick:()=>{e.shell.openExternal(a)}}})};o();return}t({id:`relaunch-error-${r}`,body:i?`${TR}: ${i}`:TR,variant:`error`,priority:IR})})),a.push(e.onWhatsNew(({version:a,releaseUrl:s})=>{if(i.isEligible(a)){i.onShown(a),t({id:`whats-new-combined-${a}`,body:MR(a),variant:`success`,priority:RR,combinedSubscribe:!0,whatsNew:{version:a,releaseUrl:s},action:{label:bR,onClick:()=>{e.shell.openExternal(s)}}}),e.update.dismissWhatsNew(a);return}let c=`whats-new-${a}`;t({id:c,body:MR(a),variant:`success`,priority:RR,action:{label:bR,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:xR,priority:FR,action:{label:SR,onClick:()=>{e.shell.openExternal(n)}}})})),()=>{for(let e of a)e();for(let e of o)clearTimeout(e);o.clear()}}function VR(e,t,n,r=()=>{}){let i=`schema-incompatibility-${t.persistedSchemaVersion}`,a=`schema-incompatibility-error-${t.persistedSchemaVersion}`,o=e=>{r(i),n({id:a,body:AR(kR,e),variant:`error`,priority:PR})};n({id:i,body:NR(t.currentBuild),priority:PR,action:{label:CR,onClick:()=>{e.state.resetIncompatible().then(()=>{r(i)},o)}}})}var HR=[],UR=new Set,WR=!1;function GR(){for(let e of UR)e()}function KR(e){let t=HR.findIndex(t=>t.id===e.id);if(t===-1)HR=[...HR,e];else{let n=HR.slice();n[t]=e,HR=n}GR()}function qR(e){let t=HR.filter(t=>t.id!==e);t.length!==HR.length&&(HR=t,GR())}function JR(){return HR}function YR(e){return UR.add(e),()=>{UR.delete(e)}}function XR(){if(WR||typeof window>`u`)return;let e=window.okDesktop;e&&(WR=!0,BR(e,KR,qR,void 0,{isEligible:e=>dL(vL.getSnapshot(),e),onShown:e=>vL.recordShown(e)}),e.state.query().then(t=>{t.schemaIncompatibility&&VR(e,t.schemaIncompatibility,KR,qR)},e=>{console.warn(`[update-notices-store] bridge.state.query() failed`,e)}))}var ZR=new URL(`/api/feedback`,{BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.41.0`}?.VITE_OK_FEEDBACK_INTAKE_ORIGIN||`https://openknowledge.ai`).href;function QR(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 $R(e){return{contentType:e.type,base64:await QR(e)}}function ez(){return typeof window<`u`&&window.okDesktop?.platform||`web`}async function tz(e){try{let t=await fetch(ZR,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({...e,appVersion:Au,platform:ez()}),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 nz=Zt(`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 rz(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=Y(nz({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 iz=Zt(`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 az(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=Y(iz({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 oz(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=Y(`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 sz(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=Y(`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 cz(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=Y(`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 lz(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=Y(`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 uz(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=Y(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 dz(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=Y(`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 fz=[{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`}}],pz=3,mz=3*1024*1024,hz=[`image/png`,`image/jpeg`,`image/webp`],gz=`data-[state=on]:border-primary data-[state=on]:bg-primary/5 data-[state=on]:text-primary`,_z=`rounded-full border border-input bg-transparent px-3 ${gz}`;function vz(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function yz(e,t){let n=new Set(e.map(e=>`${e.name}:${e.size}`)),r=Array.from(t??[]).filter(e=>hz.includes(e.type)&&!n.has(`${e.name}:${e.size}`));return[...e,...r].slice(0,pz)}var bz=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},xz=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}=mt(),u=(0,Q.useRef)(null),d,f;if(t[0]!==l){let e=ci({rating:Wa([`positive`,`negative`],{error:l({id:`H-hzll`})}),reasons:ra(Sa()),message:Sa(),attachments:ra(Mi(File)).max(pz,l({id:`E9gh86`,values:{MAX_ATTACHMENTS:pz}})).refine(Cz,l({id:`s7us1p`})).refine(Tz,l({id:`ItxGi3`})),shareEmail:ta(),email:Sa()}).refine(Ez,{path:[`email`],message:l({id:`fwrPh4`})});f=ap,d=WI(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=cp(_),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=cp(b),S;t[11]===g.control?S=t[12]:(S={control:g.control,name:`attachments`},t[11]=g.control,t[12]=S);let C=cp(S),w=C.length>=pz,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($R)):void 0,r=await tz({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){dl.success(l({id:`LvdLef`})),g.reset(),n?.();return}if(r.reason===`unavailable`){dl.error(l({id:`D8JJwQ`}));return}dl.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)}`),dl.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=Y(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)(ul,{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)(np,{children:[(0,Z.jsx)(lp,{children:(0,Z.jsxs)(Hr,{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)(Br,{value:`positive`,className:Y(`h-auto flex-1 justify-center py-2`,i?`gap-1.5 text-xs`:`gap-2`,gz),children:[(0,Z.jsx)(Sg,{className:`size-4`}),(0,Z.jsx)(J,{id:`OEEQKT`})]}),(0,Z.jsxs)(Br,{value:`negative`,className:Y(`h-auto flex-1 justify-center py-2`,i?`gap-1.5 text-xs`:`gap-2`,gz),children:[(0,Z.jsx)(xg,{className:`size-4`}),(0,Z.jsx)(J,{id:`U0QBh4`})]})]})}),(0,Z.jsx)(dp,{})]})},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)(op,{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)(op,{control:g.control,name:`reasons`,render:e=>{let{field:t}=e;return(0,Z.jsxs)(np,{children:[(0,Z.jsx)(up,{children:(0,Z.jsx)(J,{id:`Fqx38P`})}),(0,Z.jsx)(lp,{children:(0,Z.jsx)(Hr,{type:`multiple`,variant:`outline`,spacing:2,value:t.value,onValueChange:t.onChange,className:`w-full flex-wrap justify-start`,children:fz.map(e=>(0,Z.jsx)(Br,{value:e.value,className:_z,children:l(e.label)},e.value))})})]})}}),(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(op,{control:g.control,name:`message`,render:e=>{let{field:t}=e;return(0,Z.jsx)(np,{children:(0,Z.jsx)(lp,{children:(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(yf,{...t,placeholder:l({id:`QlAG4m`}),className:Y(`resize-none pb-9`,i?`min-h-16`:`min-h-20`)}),(0,Z.jsxs)(sn,{children:[(0,Z.jsx)(rn,{asChild:!0,children:(0,Z.jsx)(`span`,{className:Y(`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)(Yc,{className:`size-4`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`3LbBJn`})})]})})}),(0,Z.jsx)(an,{children:w?(0,Z.jsx)(J,{id:`ASqqsQ`,values:{MAX_ATTACHMENTS:pz}}):(0,Z.jsx)(J,{id:`3LbBJn`})})]}),(0,Z.jsx)(_l,{ref:u,type:`file`,accept:hz.join(`,`),multiple:!0,className:`hidden`,onChange:e=>{D(yz(C,e.target.files)),e.target.value=``}})]})})})}}),C.length>0&&(0,Z.jsx)(dz,{children:C.map((e,t)=>(0,Z.jsxs)(rz,{size:`xs`,children:[(0,Z.jsx)(az,{variant:`image`,children:(0,Z.jsx)(bz,{file:e})}),(0,Z.jsxs)(oz,{children:[(0,Z.jsx)(sz,{children:e.name}),(0,Z.jsx)(cz,{children:vz(e.size)})]}),(0,Z.jsx)(lz,{children:(0,Z.jsx)(uz,{type:`button`,"aria-label":l({id:`w61W3L`,values:{0:e.name}}),onClick:()=>D(C.filter((e,n)=>n!==t)),children:(0,Z.jsx)(ul,{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)(op,{control:g.control,name:`shareEmail`,render:Dz}),x&&(0,Z.jsx)(op,{control:g.control,name:`email`,render:e=>{let{field:t}=e;return(0,Z.jsxs)(np,{children:[(0,Z.jsx)(lp,{children:(0,Z.jsx)(_l,{...t,type:`email`,placeholder:l({id:`JHf6qZ`})})}),(0,Z.jsx)(dp,{})]})}})]}),(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)(J,{id:`9bG48P`}):(0,Z.jsx)(J,{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)(fp,{...g,children:L}),t[55]=g,t[56]=L,t[57]=R):R=t[57],R};function Sz(e){return hz.includes(e.type)}function Cz(e){return e.every(Sz)}function wz(e,t){return e+t.size}function Tz(e){return e.reduce(wz,0)<=mz}function Ez(e){return!e.shareEmail||ca().safeParse(e.email).success}function Dz(e){let{field:t}=e;return(0,Z.jsxs)(np,{className:`flex flex-row items-center gap-2 space-y-0`,children:[(0,Z.jsx)(lp,{children:(0,Z.jsx)(Jn,{checked:t.value,onCheckedChange:e=>t.onChange(e===!0)})}),(0,Z.jsx)(up,{className:`font-normal`,children:(0,Z.jsx)(J,{id:`SF9qpO`})})]})}function Oz(e){let t=(0,$.c)(10),{onClose:n}=e,{_:r}=mt(),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)(`div`,{className:`px-3 py-2.5`,children:(0,Z.jsx)(xz,{compact:!0,source:hR,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)(`section`,{"aria-label":i,className:`mx-1 mb-1 overflow-hidden rounded-lg border bg-card text-card-foreground`,children:o}),t[7]=i,t[8]=o,t[9]=s):s=t[9],s}function kz(){let e=(0,$.c)(5),t=Uo(),n=(0,Q.useSyncExternalStore)(kE.subscribe,kE.getSnapshot,kE.getSnapshot),r=(0,Q.useSyncExternalStore)(YR,JR,JR),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],!vR(s))return null;let c;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Oz,{onClose:Az}),e[4]=c):c=e[4],c}function Az(){return iL.dismiss()}var jz=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
14
+ <symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
15
+ <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"/>
16
+ </symbol>
17
+ <symbol id="file-tree-icon-dot" viewBox="0 0 6 6">
18
+ <circle cx="3" cy="3" r="3" />
19
+ </symbol>
20
+ <symbol id="file-tree-icon-file" viewBox="0 0 16 16">
21
+ <path fill="currentColor" d="M8 1v3a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1z" class="bg" opacity=".5"/>
22
+ <path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>
23
+ </symbol>
24
+ <symbol id="file-tree-icon-lock" viewBox="0 0 16 16">
25
+ <path fill="currentcolor" d="M4 5.336V4a4 4 0 1 1 8 0v1.336c1.586.54 2 1.843 2 4.664v1c0 4.118-.883 5-5 5H7c-4.117 0-5-.883-5-5v-1c0-2.821.414-4.124 2-4.664M5.5 4v1.054Q6.166 4.998 7 5h2q.834-.002 1.5.054V4a2.5 2.5 0 0 0-5 0m-2 6v1c0 .995.055 1.692.167 2.193.107.483.246.686.35.79s.307.243.79.35c.5.112 1.198.167 2.193.167h2c.995 0 1.692-.055 2.193-.166.483-.108.686-.247.79-.35.104-.105.243-.308.35-.791.112-.5.167-1.198.167-2.193v-1c0-.995-.055-1.692-.166-2.193-.108-.483-.247-.686-.35-.79-.105-.104-.308-.243-.791-.35C10.693 6.555 9.995 6.5 9 6.5H7c-.995 0-1.692.055-2.193.167-.483.107-.686.246-.79.35s-.243.307-.35.79C3.555 8.307 3.5 9.005 3.5 10" />
26
+ </symbol>
27
+ <symbol id="file-tree-icon-ellipsis" viewBox="0 0 16 16">
28
+ <path d="M5 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M9.5 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M14 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0" />
29
+ </symbol>
30
+ </svg>`,Mz=`<symbol id="file-tree-builtin-astro" viewBox="0 0 16 16">
31
+ <path fill="currentColor" d="M6.08 13.92c-.63-.57-.81-1.79-.55-2.67.45.56 1.08.73 1.73.83 1 .15 1.99.1 2.92-.37l.32-.19q.13.38.08.78a2.1 2.1 0 0 1-.9 1.5q-.3.24-.61.43c-.64.44-.81.95-.57 1.69l.02.08a1.7 1.7 0 0 1-.74-.64 2 2 0 0 1-.3-.98q0-.27-.02-.52-.07-.61-.61-.62a.7.7 0 0 0-.75.6z" class="bg" opacity=".6"/>
32
+ <path fill="currentColor" d="M2.5 11.1s1.86-.9 3.72-.9l1.4-4.39c.05-.21.2-.36.38-.36s.33.15.38.36l1.4 4.38c2.2 0 3.72.92 3.72.92l-3.16-8.69q-.13-.4-.45-.42H6.11q-.3.02-.45.42z" class="fg"/>
33
+ </symbol>`,Nz=`<symbol id="file-tree-builtin-babel" viewBox="0 0 16 16">
34
+ <path fill="currentColor" fill-rule="evenodd" d="M9.49.5q1.92.05 2.66.54 1.27.6 1.35 1.52v.23a4 4 0 0 1-.53 1.9l-1.38 1.24q-.74.38-.72.63c.77.82 1.33 1.29.85 2.42q-.47 1.1-2.04 2.28c-.5.32-1.88 1.35-2.96 1.86-1.64.77-3.1 1.4-4.65 1.89-.51.16-1.5.16-1.5.16L.5 15A76 76 0 0 0 5.76 3.49q-.1-.08-.1-.2.1 0 .32-.35l-.03-.09q-1.17.39-2.38 1.3l-.13.03q0-.1-.21-.16-.46.31-.82.7l-.13-.19.16-.06-.03-.16-.34.29L2 4.5q.36-.48.72-.54l.04-.1V3.8q.16 0 .15-.06l.13-.06a6 6 0 0 0 1.13-.9v-.03H4.1l-.12.07q0-.1-.1-.1l-.15.07-.04-.1q.93-.52 1.63-1.05Q7.89.65 9.5.5M8.46 7.83l-.32.04c-1.31.54-2.31.82-2.91.88a71 71 0 0 0-2.2 4.54h.07q.58-.04 3.04-1.42.13 0 1.66-1.05L9.18 9.7v.03q.45-.2.81-1.3v-.2q-.5-.46-1.53-.4m.28-5.75c-.5.1-.75.19-.72.38l-1.16 2.6q-.17.1-.34.95-.3.48-.25.77v.1l.22.05A15 15 0 0 1 8.86 6c1.1-.71 2.12-1.38 2.8-2.54q.24-.33.21-.54-.02-.33-.4-.54c-.54 0-1.07-.34-1.63-.28l-.94-.03z" clip-rule="evenodd"/>
35
+ </symbol>`,Pz=`<symbol id="file-tree-builtin-bash" viewBox="0 0 16 16">
36
+ <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
37
+ <path fill="currentColor" d="M11.5 11a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1zM7 6.75C7 6.42 6.64 6 6 6s-1 .42-1 .75q-.01.25.22.41.26.21.89.35.74.14 1.28.53c.37.29.61.7.61 1.21 0 .87-.68 1.5-1.5 1.7v.55a.5.5 0 0 1-1 0v-.56c-.82-.18-1.5-.82-1.5-1.69a.5.5 0 0 1 1 0c0 .33.36.75 1 .75s1-.42 1-.75q.01-.25-.22-.41a2 2 0 0 0-.89-.35q-.74-.14-1.28-.53A1.5 1.5 0 0 1 4 6.75c0-.87.68-1.5 1.5-1.7V4.5a.5.5 0 0 1 1 0v.56c.82.18 1.5.82 1.5 1.69a.5.5 0 0 1-1 0" class="fg-stroke"/>
38
+ </symbol>`,Fz=`<symbol id="file-tree-builtin-biome" viewBox="0 0 16 16">
39
+ <path fill="currentColor" d="M8 2 4.88 7.35a7 7 0 0 1 3.7-.13l1.04.25-.99 4.16-1.05-.25a2.7 2.7 0 0 0-3.07 1.45l-.98-.47a4 4 0 0 1 1.07-1.31 3.8 3.8 0 0 1 3.23-.71l.5-2.08a6 6 0 0 0-5.07 1.12A5.9 5.9 0 0 0 1 14h14z"/>
40
+ </symbol>`,Iz=`<symbol id="file-tree-builtin-bootstrap" viewBox="0 0 16 16">
41
+ <path fill="currentColor" fill-rule="evenodd" d="M11.72 1.5A2.5 2.5 0 0 1 14.2 4q.02 1.08.3 2.09c.22.73.56 1.24 1.08 1.45.22.08.4.27.4.5s-.18.43-.4.51q-.76.34-1.08 1.45c-.2.65-.27 1.32-.3 2a2.5 2.5 0 0 1-2.48 2.5H4.25A2.6 2.6 0 0 1 1.7 12c-.04-.85-.1-1.68-.22-2.04C1.26 9.23.92 8.7.4 8.5.18 8.42 0 8.23 0 8s.18-.42.4-.5q.77-.35 1.09-1.46c.1-.36.17-1.19.2-2.04a2.6 2.6 0 0 1 2.56-2.5z" class="bg" clip-rule="evenodd" opacity=".2"/>
42
+ <path fill="currentColor" fill-rule="evenodd" d="M8.47 4.54c1.23 0 2.04.68 2.04 1.73 0 .73-.55 1.39-1.24 1.5v.04c.94.1 1.58.77 1.58 1.7 0 1.2-.9 1.95-2.37 1.95H5.97a.3.3 0 0 1-.2-.08.3.3 0 0 1-.08-.2V4.82a.3.3 0 0 1 .08-.2.3.3 0 0 1 .2-.08zm-1.7 6.04h1.49q1.47-.01 1.49-1.15Q9.74 8.31 8.2 8.3H6.77zm0-5.16v2.06h1.21c.93 0 1.45-.38 1.45-1.06 0-.65-.44-1-1.22-1z" class="fg" clip-rule="evenodd"/>
43
+ </symbol>`,Lz=`<symbol id="file-tree-builtin-browserslist" viewBox="0 0 16 16">
44
+ <path fill="currentColor" d="M8.88 6.96c0 3.82 3.72 4.7 5.7 3.74-.23.9-1.04 1.67-2.35 1.93-.02.4.42 1.28.82 1.63-.9.35-1.94-.12-2.51-.48a5 5 0 0 0-.32 1.87c-.68 0-1.57-1-1.8-1.37-.3.18-.85 1.15-.96 1.72a2.4 2.4 0 0 1-.81-.86 2.4 2.4 0 0 1-.3-1.15c-.38.27-1.48.95-1.99 1.18-.25-.58-.15-1.3 0-2.06-.21.12-1.8.27-2.43.12.32-.36.75-1.19.94-1.57A4.5 4.5 0 0 1 .44 10.6c.48-.22.97-.53 1.49-1.06C1.26 9.17.24 8.64 0 7.7a6 6 0 0 0 1.79-.32C1.28 7.08.44 6.15.6 5.01c.42.21 1.3.37 1.73.3a3.4 3.4 0 0 1-.25-2.75 5 5 0 0 0 1.48 1c-.08-.8.3-2.31.8-2.71.2.46.73 1.21 1.08 1.4.09-.61.87-2.06 1.57-2.25 0 .5.27 1.4.5 1.67.51-.54 2.25-1.44 3.64-1.13-.43.45-.75.61-.86.98 1.05 0 2.78.34 4.27 1.93-2.34-.89-5.69.56-5.69 3.5" class="bg" opacity=".5"/>
45
+ <path fill="currentColor" d="M11.21 3.59a4.1 4.1 0 0 0 2.47 2.89c.24-.22.61-.38.95-.19.76.44.2 1.26-.34 1.66l-.07.06a13 13 0 0 1-4.49 1.61l-.3-.43a10.5 10.5 0 0 0 4.13-1.31 1 1 0 0 0 .23-.25.5.5 0 0 0-.21-.69l-.15-.06a4.5 4.5 0 0 1-1.77-1.31 4.5 4.5 0 0 1-.88-1.77q.2-.12.43-.21"/>
46
+ <path fill="currentColor" d="M10.36 5.18a.4.4 0 0 0-.03.38c.09.2.3.3.46.23s.24-.3.15-.5l-.01-.02q.23.13.34.39a.83.83 0 0 1-.43 1.08.8.8 0 0 1-1.08-.43.83.83 0 0 1 .6-1.13"/>
47
+ </symbol>`,Rz=`<symbol id="file-tree-builtin-bun" viewBox="0 0 16 16">
48
+ <path fill="currentColor" d="M8 14c3.87 0 7-2.46 7-5.49 0-1.88-1.2-3.53-3.04-4.52q-1.1-.61-1.84-1.07C9.2 2.35 8.64 2 8 2s-1.36.45-2.31 1.03A29 29 0 0 1 4.04 4C2.2 4.98 1 6.63 1 8.51 1 11.54 4.13 14 8 14M7.18 3.88q.3-.66.3-1.37c0-.08.11-.1.13-.01.38 1.57-.53 2.35-1.2 2.61-.08.03-.12-.07-.06-.12a3 3 0 0 0 .83-1.12m1.2-.05a3 3 0 0 0-.45-1.3V2.5c-.04-.07.05-.15.1-.1 1.15 1.2.77 2.3.33 2.87-.05.05-.13 0-.11-.08q.21-.67.13-1.37m1.04-.32a3 3 0 0 0-.94-1.02v-.01c-.06-.05-.01-.16.07-.12 1.51.61 1.61 1.8 1.43 2.5l-.03.03a.07.07 0 0 1-.1-.06 3 3 0 0 0-.43-1.32m-2.97.32c-.36.3-.74.43-1.2.56q-.11 0-.1-.1a3.5 3.5 0 0 0 1.76-1.57s.09-.07.1.04c0 .18-.2.76-.56 1.07m2.89 6.36q-.13.52-.55.88a1.3 1.3 0 0 1-.75.35 1.3 1.3 0 0 1-.77-.35 1.7 1.7 0 0 1-.54-.88.13.13 0 0 1 .15-.15h2.31a.14.14 0 0 1 .15.15M6.15 8.95a1.1 1.1 0 0 1-1.39-.14A1.1 1.1 0 0 1 5.12 7a1.1 1.1 0 0 1 1.2.25 1.1 1.1 0 0 1-.17 1.69m4.96 0a1.1 1.1 0 0 1-1.4-.14 1.1 1.1 0 0 1 .37-1.8 1.1 1.1 0 0 1 1.2.25 1.1 1.1 0 0 1 .24 1.2 1 1 0 0 1-.41.5"/>
49
+ </symbol>`,zz=`<symbol id="file-tree-builtin-c" viewBox="0 0 16 16">
50
+ <path fill="currentColor" fill-rule="evenodd" d="M8 1q.084 0 .166.021.098.023.186.075c1.055.624 4.22 2.486 5.277 3.11.085.05.15.112.209.192h-.002l.028.037a.5.5 0 0 1 .103.21q.031.102.033.21v6.29a.71.71 0 0 1-.347.616l-5.307 3.144a.68.68 0 0 1-.693 0l-5.307-3.144A.72.72 0 0 1 2 11.145V4.832a.71.71 0 0 1 .346-.612l5.288-3.126A.7.7 0 0 1 7.992 1zm2.901 4.349a3.75 3.75 0 1 0 0 5.302l-1.06-1.06a2.25 2.25 0 1 1 0-3.182z" clip-rule="evenodd"/>
51
+ </symbol>`,Bz=`<symbol id="file-tree-builtin-claude" viewBox="0 0 16 16">
52
+ <path fill="currentColor" d="M3.75 10.31 6.5 8.77l.04-.14-.04-.07h-.14l-.46-.03-1.57-.04-1.38-.07-1.33-.07-.34-.07L1 7.86l.03-.21.28-.18.4.03.89.07 1.33.08.97.06 1.43.16h.22l.03-.1-.07-.05-.06-.06-1.39-.92-1.48-.98-.79-.57-.42-.28-.2-.28-.1-.6.39-.41.52.04.12.03.52.4 1.12.86L6.2 6.04l.2.17.09-.06.01-.04-.1-.15-.76-1.46-.85-1.46-.37-.6-.1-.36a1 1 0 0 1-.06-.42l.42-.59.25-.07.6.08.22.2.36.84.58 1.3.9 1.77.29.53.14.47.04.14h.1v-.07l.07-1 .14-1.22.14-1.57.04-.45.23-.53.42-.28.36.15.28.41-.04.25-.16 1.08-.36 1.7-.21 1.14h.12l.14-.15.58-.76.97-1.2.42-.5.5-.51.32-.25h.6l.44.66-.2.68-.61.79-.52.65-.74 1-.45.8.04.05h.1l1.68-.36.9-.16 1.06-.18.5.23.05.22-.2.48-1.15.28-1.34.28-2 .46-.04.01.03.04.9.09.4.03h.94l1.77.14.46.28.27.37-.04.28-.72.37-.95-.23-2.24-.53-.76-.18h-.11v.06l.64.63L12 10.86l1.48 1.35.07.34-.18.28-.2-.03-1.29-.98-.5-.42-1.12-.95h-.07v.1l.25.38 1.37 2.05.07.63-.1.2-.36.14-.38-.08-.8-1.12-.85-1.26-.66-1.15-.07.05-.4 4.23-.19.21-.42.17-.35-.28-.2-.42.2-.87.23-1.12.18-.9.17-1.1.1-.36v-.03h-.1l-.84 1.16-1.27 1.72-1 1.07-.24.1-.42-.22.04-.39.22-.32 1.4-1.8.84-1.1.57-.64-.02-.07h-.04l-3.7 2.4-.66.09-.28-.28.03-.42.14-.14 1.12-.77z"/>
53
+ </symbol>`,Vz=`<symbol id="file-tree-builtin-cpp" viewBox="0 0 16 16">
54
+ <path fill="currentColor" fill-rule="evenodd" d="M8 1q.084 0 .166.021.098.023.186.075c1.055.624 4.22 2.486 5.277 3.11.085.05.15.112.209.192h-.002l.028.037a.5.5 0 0 1 .103.21q.031.102.033.21v6.29a.71.71 0 0 1-.347.616l-5.307 3.144a.68.68 0 0 1-.693 0l-5.307-3.144A.72.72 0 0 1 2 11.145V4.832a.71.71 0 0 1 .346-.612l5.288-3.126A.7.7 0 0 1 7.992 1zm2.901 4.349a3.75 3.75 0 1 0 0 5.302l-1.06-1.06a2.25 2.25 0 1 1 0-3.182z" clip-rule="evenodd"/>
55
+ </symbol>`,Hz=`<symbol id="file-tree-builtin-css" viewBox="0 0 16 16">
56
+ <path fill="currentColor" d="M8 15c-5.76 0-7-1.24-7-7V2a1 1 0 0 1 1-1h6c5.77 0 7 1.24 7 7s-1.24 7-7 7" class="vector" opacity=".2"/>
57
+ <path fill="currentColor" d="M10.1 9.19h.73c.03.49.22.6 1 .6.76 0 .93-.12.93-.68 0-.52-.17-.67-.94-.85-1.38-.3-1.68-.56-1.68-1.47 0-1.05.3-1.29 1.67-1.29 1.29 0 1.57.2 1.6 1.13h-.74c-.01-.34-.17-.42-.85-.42-.77 0-.94.1-.94.58 0 .42.17.55.96.73 1.36.3 1.66.58 1.66 1.59 0 1.14-.31 1.39-1.73 1.39-1.39 0-1.69-.24-1.67-1.31m-3.9 0h.74c.03.49.21.6.99.6.76 0 .93-.12.93-.68 0-.52-.17-.67-.93-.85-1.39-.3-1.69-.56-1.69-1.47 0-1.05.3-1.29 1.67-1.29 1.3 0 1.58.2 1.6 1.13h-.73c-.02-.34-.18-.42-.85-.42-.78 0-.95.1-.95.58 0 .42.17.55.96.73 1.37.3 1.67.58 1.67 1.59 0 1.14-.32 1.39-1.74 1.39-1.38 0-1.68-.24-1.66-1.31m-1.22 0h.75c-.09 1.07-.37 1.31-1.56 1.31-1.37 0-1.68-.45-1.68-2.5 0-1.96.36-2.5 1.68-2.5 1.16 0 1.44.25 1.52 1.35h-.76c-.08-.52-.22-.64-.76-.64-.74 0-.9.33-.9 1.78 0 1.47.16 1.8.9 1.8.58 0 .74-.11.8-.6"/>
58
+ </symbol>`,Uz=`<symbol id="file-tree-builtin-database" viewBox="0 0 16 16">
59
+ <path fill="currentColor" d="M14.953 9.733a12.4 12.4 0 0 1-.244 1.936c-.207.933-.532 1.58-.996 2.044s-1.11.789-2.044.996C10.73 14.918 9.533 15 8 15s-2.73-.082-3.669-.291c-.933-.207-1.58-.532-2.044-.996s-.789-1.11-.996-2.044c-.122-.547-.2-1.182-.244-1.92q.23.364.532.667c.64.639 1.482 1.031 2.533 1.265 1.046.232 2.33.315 3.884.315 1.555 0 2.838-.083 3.884-.315 1.051-.234 1.893-.626 2.532-1.265a4 4 0 0 0 .541-.683"/>
60
+ <path fill="currentColor" d="M14.93 5.924c-.046.663-.118 1.24-.23 1.743-.207.932-.532 1.579-.995 2.042s-1.11.789-2.042.996c-.938.209-2.135.291-3.667.291-1.531 0-2.729-.082-3.667-.29-.932-.208-1.579-.534-2.042-.997s-.789-1.11-.996-2.042a12 12 0 0 1-.227-1.683l.016-.188a4 4 0 0 0 .5.62c.638.639 1.48 1.031 2.532 1.265 1.046.232 2.33.315 3.884.315 1.555 0 2.838-.083 3.884-.315 1.051-.234 1.893-.626 2.532-1.265.192-.192.357-.404.506-.633z"/>
61
+ <path fill="currentColor" d="M8 1c1.533 0 2.73.082 3.669.291.933.207 1.58.533 2.044.996.403.404.904.944.91 1.695.004.764-.509 1.318-.918 1.727-.463.463-1.11.789-2.042.996-.938.209-2.135.291-3.667.291-1.531 0-2.729-.082-3.667-.29-.932-.208-1.579-.534-2.042-.997-.406-.406-.915-.953-.915-1.71 0-.758.509-1.305.915-1.712.464-.463 1.11-.789 2.044-.996C5.27 1.082 6.467 1 8 1"/>
62
+ </symbol>`,Wz=`<symbol id="file-tree-builtin-default" viewBox="0 0 16 16">
63
+ <path fill="currentColor" d="M8 1v3a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1z" class="bg" opacity=".4"/>
64
+ <path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>
65
+ </symbol>`,Gz=`<symbol id="file-tree-builtin-docker" viewBox="0 0 16 16">
66
+ <path fill="currentColor" d="M15.85 6.54c-.05-.04-.45-.36-1.31-.36q-.34 0-.68.06a2.7 2.7 0 0 0-1.14-1.79l-.23-.14-.15.23a3 3 0 0 0-.4 1q-.24 1.01.26 1.84c-.4.24-1.03.3-1.17.3H.5a.5.5 0 0 0-.5.52q-.01 1.46.46 2.83.55 1.5 1.6 2.18c.79.5 2.08.79 3.54.79q.96 0 1.94-.18a8 8 0 0 0 2.55-.97 7 7 0 0 0 1.73-1.5 10 10 0 0 0 1.7-3.06h.15a2.4 2.4 0 0 0 1.8-.7 2 2 0 0 0 .47-.74l.06-.2z"/>
67
+ <path fill="currentColor" d="M1.48 7.36h1.4a.14.14 0 0 0 .14-.13V5.91q-.01-.12-.13-.14H1.48a.13.13 0 0 0-.13.14v1.32q.02.13.13.13m1.94 0h1.41a.14.14 0 0 0 .13-.13V5.91q-.01-.12-.13-.14h-1.4a.13.13 0 0 0-.13.14v1.32q0 .13.12.13m1.98 0h1.4q.13 0 .14-.13V5.91a.13.13 0 0 0-.14-.14H5.4q-.1.01-.12.14v1.32q0 .13.12.13m1.95 0h1.42q.1 0 .12-.13V5.91q0-.12-.12-.14H7.35q-.1.01-.12.14v1.32q.01.13.12.13M3.42 5.5h1.41c.07 0 .13-.08.13-.15V4.03a.13.13 0 0 0-.13-.14h-1.4q-.12 0-.13.14v1.31q0 .13.12.15m1.98 0h1.4c.08 0 .14-.08.14-.15V4.03q0-.13-.14-.14H5.4q-.1 0-.12.14v1.31q0 .13.12.15m1.95 0h1.42c.06 0 .12-.08.12-.15V4.03q-.01-.13-.12-.14H7.35q-.1 0-.12.14v1.31q.01.13.12.15m0-1.9h1.42q.1-.02.12-.14v-1.3Q8.88 2 8.77 2H7.35q-.1 0-.12.14v1.3q.01.13.12.14m1.97 3.78h1.4a.13.13 0 0 0 .14-.13V5.91q-.01-.12-.13-.14H9.32q-.1.01-.12.14v1.32q.01.13.12.13" opacity=".5"/>
68
+ </symbol>`,Kz=`<symbol id="file-tree-builtin-eslint" viewBox="0 0 16 16">
69
+ <path fill="currentColor" d="M11.16 6.1 8.12 4.35a.3.3 0 0 0-.24 0L4.84 6.1a.3.3 0 0 0-.12.2v3.5q0 .14.12.22l3.04 1.74q.12.08.24 0l3.04-1.74a.2.2 0 0 0 .13-.22V6.3a.3.3 0 0 0-.13-.2" opacity=".5"/>
70
+ <path fill="currentColor" d="m.1 7.69 3.63-6.3A.8.8 0 0 1 4.37 1h7.26c.26 0 .5.17.64.4l3.63 6.27a.8.8 0 0 1 0 .75l-3.63 6.24a.7.7 0 0 1-.64.34H4.37a.7.7 0 0 1-.64-.34L.1 8.41a.7.7 0 0 1 0-.72m3 3.02q.01.15.14.23l4.63 2.66q.13.06.26 0l4.63-2.66a.3.3 0 0 0 .14-.23V5.4a.3.3 0 0 0-.14-.23L8.13 2.52a.3.3 0 0 0-.26 0L3.24 5.17a.3.3 0 0 0-.14.23z"/>
71
+ </symbol>`,qz=`<symbol id="file-tree-builtin-font" viewBox="0 0 16 16">
72
+ <path fill="currentColor" d="M12.3 13c-1.59 0-2.68-.99-2.68-2.5 0-1.43 1-2.34 2.88-2.35h2.16v-.83c0-1.08-.62-1.68-1.73-1.68-1.05 0-1.66.54-1.73 1.36H9.93c.09-1.43 1.06-2.48 3.05-2.48 1.75 0 3.02.95 3.02 2.68v5.66h-1.29v-1.02h-.04c-.41.66-1.16 1.16-2.37 1.16m.36-1.12c1.14 0 2-.72 2-1.74v-.96H12.6c-1.12 0-1.6.54-1.6 1.28 0 .97.8 1.42 1.66 1.42m-11.24.98H0L3.8 2h1.39l3.8 10.86H7.54l-1.08-3.2H2.5zm3.09-9.25h-.04l-1.6 4.95H6.1z"/>
73
+ </symbol>`,Jz=`<symbol id="file-tree-builtin-git" viewBox="0 0 16 16">
74
+ <path fill="currentColor" d="M14.74 7.38 8.62 1.26a.9.9 0 0 0-1.27 0L6.08 2.53l1.61 1.61a1.07 1.07 0 0 1 1.36 1.37l1.55 1.55a1.07 1.07 0 0 1 1.1 1.77 1.07 1.07 0 0 1-1.74-1.16L8.5 6.22v3.8a1.07 1.07 0 1 1-.89-.02V6.15a1.07 1.07 0 0 1-.58-1.4l-1.58-1.6-4.2 4.2a.9.9 0 0 0 0 1.27l6.12 6.12a.9.9 0 0 0 1.27 0l6.09-6.09a.9.9 0 0 0 0-1.27"/>
75
+ </symbol>`,Yz=`<symbol id="file-tree-builtin-go" viewBox="0 0 16 16">
76
+ <path fill="currentColor" fill-rule="evenodd" d="M4.41 4.57A3.2 3.2 0 0 1 6.87 5q.74.49 1.08 1.29.08.12-.1.16l-1.55.4c-.14.03-.15.04-.27-.1a1 1 0 0 0-.44-.34 1.6 1.6 0 0 0-1.68.14q-.95.61-.94 1.73c0 .73.52 1.33 1.25 1.43q.95.1 1.58-.6l.25-.34h-1.8c-.19 0-.24-.12-.17-.27.12-.28.34-.76.47-1a.3.3 0 0 1 .24-.14h2.98a4 4 0 0 1 .64-1.19 4 4 0 0 1 2.6-1.52 3.5 3.5 0 0 1 2.64.46q1.13.73 1.31 2.04a3.5 3.5 0 0 1-1.06 3.09q-.93.92-2.23 1.17l-.74.08a3.5 3.5 0 0 1-2.27-.8 3 3 0 0 1-.93-1.42 4 4 0 0 1-.39.61 4 4 0 0 1-2.64 1.56 3.3 3.3 0 0 1-2.5-.6 3 3 0 0 1-1.18-2.03 3.5 3.5 0 0 1 .8-2.67 4 4 0 0 1 2.6-1.58M13.1 7.5a1.53 1.53 0 0 0-1.9-1.21q-1.3.3-1.62 1.59a1.5 1.5 0 0 0 .85 1.72q.77.33 1.52-.05a2 2 0 0 0 1.18-1.74q0-.17-.03-.3" clip-rule="evenodd"/>
77
+ </symbol>`,Xz=`<symbol id="file-tree-builtin-graphql" viewBox="0 0 16 16">
78
+ <path fill="currentColor" fill-rule="evenodd" d="M8 1a1.25 1.25 0 0 1 1.18 1.65l2.8 1.61q.33-.25.77-.26a1.25 1.25 0 0 1 .48 2.4v3.2a1.25 1.25 0 1 1-1.25 2.13l-2.8 1.62A1.25 1.25 0 0 1 8 15a1.25 1.25 0 0 1-1.18-1.65l-2.8-1.62q-.33.26-.77.27a1.25 1.25 0 0 1-.48-2.4V6.4a1.25 1.25 0 1 1 1.25-2.14l2.8-1.61A1.25 1.25 0 0 1 8 1M4.44 11.14l-.06.13 2.75 1.58a1.25 1.25 0 0 1 1.74 0l2.74-1.58-.05-.13zm3.89-7.68a1.3 1.3 0 0 1-.66 0L4.03 9.77q.37.3.45.78h7.04q.08-.48.45-.78zM4.38 4.73a1.24 1.24 0 0 1-1.02 1.76v3.02l.13.01 3.67-6.35-.03-.02zm4.46-1.56 3.67 6.35.13-.01V6.49a1.25 1.25 0 0 1-1.03-1.76L8.87 3.15z" clip-rule="evenodd"/>
79
+ </symbol>`,Zz=`<symbol id="file-tree-builtin-html" viewBox="0 0 16 16">
80
+ <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
81
+ <path fill="currentColor" d="M10.48 3.76a.5.5 0 0 1 .4.58L10.6 5.8h1.14a.5.5 0 0 1 0 1h-1.32L10 9.2h1.08a.5.5 0 0 1 0 1H9.8l-.3 1.64a.5.5 0 1 1-.98-.18l.27-1.46H6.4l-.3 1.64a.5.5 0 1 1-.98-.18l.27-1.46H4.25a.5.5 0 0 1 0-1h1.32L6 6.8H4.93a.5.5 0 0 1 0-1H6.2l.3-1.64a.5.5 0 1 1 .98.18L7.2 5.8h2.4l.3-1.64a.5.5 0 0 1 .58-.4M6.58 9.2h2.4l.44-2.4h-2.4z" class="fg"/>
82
+ </symbol>`,Qz=`<symbol id="file-tree-builtin-image" viewBox="0 0 16 16">
83
+ <path fill="currentColor" d="M12.5 2A2.5 2.5 0 0 1 15 4.5v4.67l-4.05-3.54-4.08 4.08-3-2L1 10.6V4.5A2.5 2.5 0 0 1 3.5 2z" opacity=".3"/>
84
+ <path fill="currentColor" d="M15 10.5v1a2.5 2.5 0 0 1-2.5 2.5h-9a2.5 2.5 0 0 1-2.46-2.04L4 9l3 2 4-4zm-7-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0"/>
85
+ </symbol>`,$z=`<symbol id="file-tree-builtin-javascript" viewBox="0 0 16 16">
86
+ <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
87
+ <path fill="currentColor" d="M8.1 9.64h.95c.04.62.28.76 1.28.76s1.2-.14 1.2-.85c0-.66-.2-.85-1.2-1.07-1.79-.38-2.18-.7-2.18-1.86C8.15 5.3 8.54 5 10.31 5c1.67 0 2.04.26 2.07 1.42h-.95c-.02-.43-.23-.53-1.1-.53-1 0-1.22.14-1.22.74 0 .52.22.7 1.24.92 1.76.38 2.15.73 2.15 2 0 1.44-.4 1.75-2.24 1.75-1.8 0-2.18-.3-2.15-1.66M3.5 9.5h.98c0 .76.15.92.85.92.77 0 .94-.18.94-1.02V5.1h1v4.34c0 1.54-.35 1.87-1.92 1.87-1.55 0-1.89-.32-1.86-1.8"/>
88
+ </symbol>`,eB=`<symbol id="file-tree-builtin-json" viewBox="0 0 16 16">
89
+ <path fill="currentColor" d="M13.25 11.5V9.75a.5.5 0 0 1 .36-.48l.55-.15a1.16 1.16 0 0 0 0-2.24l-.55-.15a.5.5 0 0 1-.36-.48V4.5a2.5 2.5 0 0 0-2.5-2.5h-.25a.5.5 0 0 0 0 1h.25a1.5 1.5 0 0 1 1.5 1.5v1.75a1.5 1.5 0 0 0 1.09 1.44l.54.15a.16.16 0 0 1 0 .32l-.54.15a1.5 1.5 0 0 0-1.09 1.44v1.75a1.5 1.5 0 0 1-1.5 1.5h-.25a.5.5 0 0 0 0 1h.25a2.5 2.5 0 0 0 2.5-2.5m-10.5 0V9.75a.5.5 0 0 0-.36-.48l-.55-.15a1.16 1.16 0 0 1 0-2.24l.55-.15a.5.5 0 0 0 .36-.48V4.5A2.5 2.5 0 0 1 5.25 2h.25a.5.5 0 0 1 0 1h-.25a1.5 1.5 0 0 0-1.5 1.5v1.75a1.5 1.5 0 0 1-1.09 1.44l-.54.15a.16.16 0 0 0 0 .32l.54.15a1.5 1.5 0 0 1 1.09 1.45v1.74a1.5 1.5 0 0 0 1.5 1.5h.25a.5.5 0 0 1 0 1h-.25a2.5 2.5 0 0 1-2.5-2.5"/>
90
+ </symbol>`,tB=`<symbol id="file-tree-builtin-markdown" viewBox="0 0 16 16">
91
+ <path fill="currentColor" d="M1 12V4h2l2 2.5L7 4h2v8H7V7.5l-2 2-2-2V12zm9-3 3 3.5L16 9h-2V4h-2v5z"/>
92
+ </symbol>`,nB=`<symbol id="file-tree-builtin-mcp" viewBox="0 0 16 16">
93
+ <path fill="currentColor" d="M9.26-.04a3 3 0 0 1 2 .82 2.8 2.8 0 0 1 .8 2.35 2.9 2.9 0 0 1 2.41.8l.03.02a2.74 2.74 0 0 1 0 3.94l-5.8 5.69-.04.06-.02.07q0 .04.02.07.01.04.04.06l1.2 1.17a.55.55 0 0 1 0 .79.6.6 0 0 1-.81 0l-1.2-1.17a1.3 1.3 0 0 1 0-1.84L13.7 7.1a1.65 1.65 0 0 0 .37-1.82 2 2 0 0 0-.37-.54l-.03-.03a1.73 1.73 0 0 0-2.4 0L6.47 9.4l-.07.06a.58.58 0 0 1-.92-.18.6.6 0 0 1 .12-.6l4.85-4.76a1.65 1.65 0 0 0 0-2.36 1.73 1.73 0 0 0-2.4 0l-6.43 6.3a.6.6 0 0 1-.8 0 .55.55 0 0 1 0-.8L7.25.79a3 3 0 0 1 2-.82"/>
94
+ <path fill="currentColor" d="M9.26 2.19a.6.6 0 0 1 .52.34.6.6 0 0 1 0 .43l-.12.18L4.9 7.79a1.65 1.65 0 0 0 0 2.36 1.73 1.73 0 0 0 2.4 0l4.75-4.66a.58.58 0 0 1 .93.18.6.6 0 0 1-.12.61l-4.75 4.66a2.9 2.9 0 0 1-4.01 0 2.75 2.75 0 0 1-.62-3.04A3 3 0 0 1 4.1 7l4.74-4.65a.6.6 0 0 1 .4-.16"/>
95
+ </symbol>`,rB=`<symbol id="file-tree-builtin-nextjs" viewBox="0 0 16 16">
96
+ <defs>
97
+ <linearGradient id="a" x1="4.522" x2="14" y1="3.943" y2="16" gradientUnits="userSpaceOnUse">
98
+ <stop stop-color="currentColor"/>
99
+ <stop offset="1" stop-color="currentColor" stop-opacity="0"/>
100
+ </linearGradient>
101
+ </defs>
102
+ <path fill="currentColor" d="M3 2h1.522v9.09H3z"/>
103
+ <path fill="url(#a)" d="M4.903 2 15 15.075q-.565.5-1.195.925L4.522 3.943z"/>
104
+ <path fill="currentColor" d="M12.172 2h-1.508v9.094h1.508z"/>
105
+ </symbol>`,iB=`<symbol id="file-tree-builtin-npm" viewBox="0 0 16 16">
106
+ <path fill="currentColor" d="M2 1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1z" class="vector" opacity=".2"/>
107
+ <path fill="currentColor" d="M10.5 13H13V3H3v10h5V5.5h2.5z"/>
108
+ </symbol>`,aB=`<symbol id="file-tree-builtin-oxc" viewBox="0 0 16 16">
109
+ <path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .5.5V3h3.5a.5.5 0 0 1 .38.83L10.5 7.69v1.44q.41.04.95-.16a4 4 0 0 0 .72-.35l.04-.03h.01a.5.5 0 0 1 .67.1l2 2.5a.5.5 0 0 1 0 .62c-.76.96-3.14 2.69-6.89 2.69s-6.13-1.73-6.89-2.69a.5.5 0 0 1 0-.62l2-2.5a.5.5 0 0 1 .67-.1l.05.03.16.09q.22.13.56.26.54.2.95.16V7.69L2.12 3.83A.5.5 0 0 1 2.5 3H6V1.5a.5.5 0 0 1 .5-.5zM7 3.5a.5.5 0 0 1-.5.5H3.6l2.78 3.17a.5.5 0 0 1 .12.33v2a.5.5 0 0 1-.28.45c-.7.35-1.5.15-2.02-.05a5 5 0 0 1-.58-.26l-1.46 1.84c.82.78 2.8 2.02 5.84 2.02s5.02-1.24 5.84-2.02l-1.46-1.83a5 5 0 0 1-.58.26c-.52.2-1.33.39-2.02.04a.5.5 0 0 1-.28-.45v-2a.5.5 0 0 1 .12-.33L12.4 4H9.5a.5.5 0 0 1-.5-.5V2H7z"/>
110
+ </symbol>`,oB=`<symbol id="file-tree-builtin-postcss" viewBox="0 0 16 16">
111
+ <path fill="currentColor" d="M14.5 8a6.5 6.5 0 0 0-5.9-6.47l5.42 8.93A7 7 0 0 0 14.5 8M2.88 12A6.5 6.5 0 0 0 8 14.5c2.08 0 3.93-.98 5.12-2.5zm8.62-1h1.68L11.5 8.24zm-1-.55a4 4 0 0 1-.7.55h.7zM8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5M5.5 11h.7a4 4 0 0 1-.7-.55zm-2.68 0H4.5V8.24zm3.76-6.2A4 4 0 0 1 8 4.5q.76 0 1.42.3L8 2.46zM1.5 8q0 1.31.48 2.46L7.4 1.53A6.5 6.5 0 0 0 1.5 8m14 0a7.5 7.5 0 0 1-.99 3.72l-.01.03-.02.03A7.5 7.5 0 0 1 8 15.5a7.5 7.5 0 0 1-6.5-3.75l-.01-.03A7.5 7.5 0 1 1 15.5 8"/>
112
+ </symbol>`,sB=`<symbol id="file-tree-builtin-prettier" viewBox="0 0 16 16">
113
+ <path fill="currentColor" d="M6 12v1H4.93v-1zm1-2v1H2v-1zm6-4v1h-3V6zm-1-4v1H9V2z"/>
114
+ <path fill="currentColor" d="M11.5 10v1H8v-1zM5 6v1H2V6zm5-2v1H9V4z" opacity=".8"/>
115
+ <path fill="currentColor" d="M6 14v1H2v-1zm-.5-6v1H2V8zM13 4v1h-3V4zM4.93 2v1H2V2z" opacity=".6"/>
116
+ <path fill="currentColor" d="M4.93 12v1H2v-1zM13 8v1H9V8zM5.5 4v1H2V4zM9 2v1H4.93V2z" opacity=".4"/>
117
+ </symbol>`,cB=`<symbol id="file-tree-builtin-python" viewBox="0 0 16 16">
118
+ <path fill="currentColor" d="M8.33 8.4H10c1.16 0 1.9-.73 1.9-1.86V5.08q0-.24.25-.24h.74c.75 0 1.33.32 1.66.97q.4.73.41 1.46c.09.9.09 1.78-.24 2.67-.25.73-.75 1.3-1.58 1.46h-4.8c-.08 0-.25 0-.25.08v.4s.17.09.25.09h2.82q.34-.02.33.32v1.06c0 .56-.25.97-.75 1.13-.41.16-.83.33-1.24.4a7 7 0 0 1-2.98-.07 3 3 0 0 1-1.16-.49c-.33-.32-.58-.65-.5-1.14v-2.91c0-1.13.67-1.78 1.82-1.78q.89-.1 1.66-.08m2.32 4.86a.65.65 0 0 0-.66-.65c-.34 0-.67.33-.67.65s.33.57.67.65a.65.65 0 0 0 .66-.65" class="bg" opacity=".8"/>
119
+ <path fill="currentColor" d="M7.67 7.6H6c-1.16 0-1.9.73-1.9 1.86v1.46q0 .24-.25.24h-.74c-.75 0-1.33-.32-1.66-.97a3 3 0 0 1-.41-1.46 6 6 0 0 1 .24-2.67c.25-.73.75-1.3 1.58-1.46h4.8c.08 0 .25 0 .25-.08v-.4s-.17-.09-.25-.09H4.85c-.24 0-.33-.08-.33-.32V2.65c0-.56.25-.97.75-1.13.41-.16.83-.33 1.24-.4a7 7 0 0 1 2.98.07c.41.09.83.25 1.16.49.33.32.58.65.5 1.13v2.92c0 1.14-.67 1.78-1.82 1.78-.58.08-1.16.08-1.66.08M5.35 2.73c0 .33.25.65.66.65.33 0 .66-.32.66-.65 0-.32-.33-.56-.66-.64a.65.65 0 0 0-.66.64" class="fg"/>
120
+ </symbol>`,lB=`<symbol id="file-tree-builtin-react" viewBox="0 0 16 16">
121
+ <path fill="currentColor" d="M8 6.65c.73 0 1.31.6 1.31 1.35S8.73 9.35 8 9.35 6.69 8.75 6.69 8 7.27 6.65 8 6.65"/>
122
+ <path fill="currentColor" fill-rule="evenodd" d="M8 2.55c1.3-.99 2.59-1.34 3.5-.8.92.55 1.27 1.87 1.08 3.53C14.06 5.94 15 6.9 15 8s-.94 2.06-2.42 2.72c.19 1.65-.16 2.98-1.08 3.52-.91.55-2.2.2-3.5-.8-1.3 1-2.58 1.35-3.5.8-.91-.54-1.27-1.87-1.08-3.52C1.94 10.06 1 9.1 1 8s.94-2.06 2.42-2.72c-.19-1.66.17-2.98 1.08-3.52s2.2-.2 3.5.8M4.26 11.2c-.08 1.34.28 2.03.68 2.26s1.15.22 2.25-.52l.11-.09a12 12 0 0 1-1.24-1.39 11 11 0 0 1-1.8-.41zm7.47-.15q-.83.27-1.79.41-.6.8-1.24 1.4l.11.08c1.1.74 1.86.76 2.25.52.4-.23.76-.92.68-2.26zm-3.04.54a14 14 0 0 1-1.38 0q.34.38.69.7.35-.32.7-.7M8 5.29q-.76 0-1.47.1A13 13 0 0 0 5.07 8a14 14 0 0 0 1.46 2.62 13 13 0 0 0 2.94 0A13 13 0 0 0 10.93 8a14 14 0 0 0-1.46-2.62A13 13 0 0 0 8 5.3M4.64 9.18q-.15.5-.25.96.44.16.94.27a15 15 0 0 1-.7-1.23m6.73 0a15 15 0 0 1-.7 1.23q.5-.11.95-.27a10 10 0 0 0-.25-.96M3.44 6.26C2.27 6.86 1.87 7.53 1.87 8s.4 1.14 1.57 1.74l.13.07q.18-.88.55-1.81a12 12 0 0 1-.55-1.8q-.07.02-.13.06m8.99-.07A12 12 0 0 1 11.88 8q.36.94.55 1.8l.13-.06c1.17-.6 1.56-1.27 1.56-1.74s-.39-1.14-1.56-1.74zm-7.1-.6q-.5.11-.94.27.1.46.25.96a15 15 0 0 1 .69-1.23m5.34 0a15 15 0 0 1 .7 1.23q.14-.5.24-.96-.44-.15-.94-.27M7.18 3.06c-1.09-.74-1.85-.76-2.24-.52s-.76.92-.69 2.26l.01.15a11 11 0 0 1 1.8-.41q.6-.8 1.24-1.4zm3.88-.52c-.4-.24-1.15-.22-2.25.52l-.12.08q.65.6 1.25 1.4.96.15 1.8.41v-.14c.08-1.35-.28-2.04-.68-2.27M8 3.7a10 10 0 0 0-.7.7 14 14 0 0 1 1.4 0 10 10 0 0 0-.7-.7" clip-rule="evenodd"/>
123
+ </symbol>`,uB=`<symbol id="file-tree-builtin-ruby" viewBox="0 0 16 16">
124
+ <path fill="currentColor" fill-rule="evenodd" d="M11.04 2c.48 0 .92.23 1.18.6l2.54 3.65c.37.52.3 1.23-.15 1.69l-5.58 5.64a1.47 1.47 0 0 1-2.06 0L1.39 7.94a1.3 1.3 0 0 1-.15-1.7l2.54-3.63q.2-.3.5-.45.33-.16.68-.16zm.84 2.17a.5.5 0 0 0-.7-.05L8 6.84 4.83 4.12a.5.5 0 0 0-.65.76L6.65 7H3.5a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1H9.35l2.48-2.12a.5.5 0 0 0 .05-.7" clip-rule="evenodd"/>
125
+ </symbol>`,dB=`<symbol id="file-tree-builtin-rust" viewBox="0 0 16 16">
126
+ <path fill="currentColor" fill-rule="evenodd" d="M8 .8a.2.2 0 0 1 .18.1l.38.6.16.02.5-.53.01-.01a.2.2 0 0 1 .33.08l.25.68.16.05.59-.43h.02a.2.2 0 0 1 .3.14l.12.71.15.08.65-.3a.2.2 0 0 1 .2.02.2.2 0 0 1 .1.18l-.03.72.12.1.71-.16a.2.2 0 0 1 .25.25l-.17.7q.06.06.1.13l.73-.03A.2.2 0 0 1 14 4a.2.2 0 0 1 .02.2l-.3.66.08.14.71.12a.2.2 0 0 1 .14.32l-.43.59.05.16.68.25a.2.2 0 0 1 .07.35l-.53.49.01.16.62.38a.2.2 0 0 1 0 .36l-.62.38-.01.16.53.5a.2.2 0 0 1-.07.34l-.68.25-.05.16.43.59a.2.2 0 0 1-.14.32l-.72.12-.07.15.3.65a.2.2 0 0 1-.02.2.2.2 0 0 1-.18.1l-.72-.03-.1.13.16.7a.2.2 0 0 1-.25.25l-.7-.17-.13.1.03.73a.2.2 0 0 1-.1.18.2.2 0 0 1-.2.02l-.66-.3-.14.08-.12.71a.2.2 0 0 1-.32.14l-.59-.43-.16.05-.25.68a.2.2 0 0 1-.34.07l-.5-.53-.16.01-.38.62a.2.2 0 0 1-.36 0l-.38-.62-.16-.01-.5.53a.2.2 0 0 1-.34-.07l-.25-.68-.16-.05-.59.43a.2.2 0 0 1-.32-.14L5 13.78l-.15-.07-.65.3a.2.2 0 0 1-.2-.02.2.2 0 0 1-.1-.18l.03-.72-.13-.1-.7.16a.2.2 0 0 1-.25-.25l.17-.7-.1-.13-.73.03a.2.2 0 0 1-.2-.3l.3-.66-.08-.14-.71-.12a.2.2 0 0 1-.14-.32l.43-.59-.05-.16-.68-.25A.2.2 0 0 1 1 9.22l.53-.5-.02-.16-.6-.38A.2.2 0 0 1 .8 8a.2.2 0 0 1 .1-.18l.6-.38.02-.16-.53-.5a.2.2 0 0 1 .07-.34l.68-.25.05-.16-.43-.59a.2.2 0 0 1 .14-.32L2.2 5l.08-.15L2 4.2a.2.2 0 0 1 .2-.3l.72.03.1-.13-.16-.7a.2.2 0 0 1 .25-.25l.7.16.13-.1-.03-.72A.2.2 0 0 1 4 2a.2.2 0 0 1 .2-.02l.65.3L5 2.2l.12-.71v-.03a.2.2 0 0 1 .32-.1l.59.41.16-.04.25-.68.01-.02A.2.2 0 0 1 6.8.99l.49.53.16-.02.38-.61.02-.02A.2.2 0 0 1 8 .79M6.8 9.45h1.26l.06.01q.03.01.03.05v1.52q0 .07-.09.06h-4.5A5.4 5.4 0 0 0 8 13.42a5.4 5.4 0 0 0 4.45-2.33h-2.42c-.36 0-.68-.5-.77-.75-.08-.22-.2-.91-.25-1.12-.15-.61-.59-.71-.78-.73H6.8zM8 2.58a5.4 5.4 0 0 0-4.07 1.85h5.74l.17.02c.23.03.6.12.96.35.34.23.83.68.83 1.4 0 .66-.55 1.16-1.08 1.5.42.33.7.53.86 1.44.04.17.34.32.62.29.29-.03.62-.16.62-.75v-.24q0-.1.07-.1h.68A5.43 5.43 0 0 0 8 2.59M2.96 6.03a5.4 5.4 0 0 0-.19 3.37h1.66V6.03zM6.8 7.06h1.66c.35 0 .77-.12.77-.47 0-.42-.55-.53-.65-.53H6.8z" clip-rule="evenodd"/>
127
+ </symbol>`,fB=`<symbol id="file-tree-builtin-sass" viewBox="0 0 16 16">
128
+ <path fill="currentColor" fill-rule="evenodd" d="M8.08 1.44c2.41-.91 4.96-.37 5.35 1.27.39 1.62-.92 3.56-2.6 4.25a5 5 0 0 1-3.26.35c-.58-.2-.92-.62-1-.85-.03-.09-.09-.24 0-.3.05-.03.08-.02.22.15s.7.6 1.75.48c2.78-.34 4.45-2.64 3.92-3.88-.37-.87-2.5-1.26-5.18.16C4.03 4.81 3.85 6.24 3.82 6.8c-.08 1.5 1.73 2.28 2.7 3.4q.04.03.07.08c.3-.12.7-.19 1.35-.2 1.58-.03 2.47 1.08 2.43 2.08-.03.78-.7 1.1-.82 1.13-.1.01-.14.02-.15-.06q-.03-.06.13-.15c.16-.09.42-.3.48-.72.05-.43-.24-1.44-1.76-1.63a3 3 0 0 0-1.33.08c.27.62.32 1.87-.29 2.83-.63 1-1.8 1.61-2.93 1.27-.37-.1-.93-.92-.45-2.05.46-1.07 2.4-2.12 2.66-2.26-.9-.83-3.08-1.95-3.4-3.65-.08-.49.13-1.65 1.46-2.98a12 12 0 0 1 4.11-2.52m-1.88 9.7c-.01.01-.9.47-1.52 1.17-.59.66-.75 1.48-.43 1.69.3.18 1-.04 1.51-.62a3 3 0 0 0 .5-.9q.2-.64.02-1.39z" clip-rule="evenodd"/>
129
+ </symbol>`,pB=`<symbol id="file-tree-builtin-stylelint" viewBox="0 0 16 16">
130
+ <path fill="currentColor" d="M4 3v3.5l1.5-1L7 15 .5 6l1-1.5L0 3l2.5-2h1zm12 0-1.5 1.5 1 1.5L9 15l1.5-9.5 1.5 1V3l.5-2h1zm-8 8.5a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1m0-3a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1m0-3a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1"/>
131
+ <path fill="currentColor" d="M6.5 2.5V4l-2 1.5v-4zm5 3L9.5 4V2.5l2-1zM9 4H7V2.5h2z"/>
132
+ </symbol>`,mB=`<symbol id="file-tree-builtin-svelte" viewBox="0 0 16 16">
133
+ <path fill="currentColor" d="m3.98 3.7 3.36-2.08a4.5 4.5 0 0 1 5.9 1.23 4 4 0 0 1 .7 3.02q-.16.75-.58 1.4c.42.77.56 1.66.4 2.52a3.7 3.7 0 0 1-1.57 2.4l-.17.1-3.36 2.09a4.5 4.5 0 0 1-5.9-1.23 4 4 0 0 1-.66-1.44 4 4 0 0 1-.04-1.58 4 4 0 0 1 .58-1.4 4 4 0 0 1-.4-2.52 3.7 3.7 0 0 1 1.57-2.4zl3.36-2.08zm7.87 0a2.7 2.7 0 0 0-1.26-.95 2.7 2.7 0 0 0-1.6-.07 3 3 0 0 0-.52.2l-.16.09-3.36 2.08a2 2 0 0 0-.69.64 2 2 0 0 0-.36.86 2.3 2.3 0 0 0 .42 1.81A2.7 2.7 0 0 0 7.18 9.4q.28-.06.53-.2l.16-.09 1.28-.79.2-.09a.8.8 0 0 1 .87.31.7.7 0 0 1 .13.55.7.7 0 0 1-.24.4l-.08.05-3.36 2.08-.2.09a1 1 0 0 1-.49-.02 1 1 0 0 1-.38-.3 1 1 0 0 1-.13-.37v-.1l.01-.13-.13-.03a4 4 0 0 1-1.1-.5l-.2-.14-.18-.12-.07.18-.08.3a2.3 2.3 0 0 0 .43 1.82q.45.64 1.19.93.73.28 1.51.14l.16-.04q.27-.07.52-.2l.16-.09 3.36-2.08q.4-.25.69-.64.27-.4.36-.86a2.3 2.3 0 0 0-.42-1.82 2.7 2.7 0 0 0-1.27-.95 2.7 2.7 0 0 0-1.6-.08q-.27.07-.52.2l-.16.1-1.28.79-.2.09a1 1 0 0 1-.49-.03 1 1 0 0 1-.38-.29.7.7 0 0 1-.13-.54.7.7 0 0 1 .24-.4l.08-.06L9.33 4.4l.2-.1a.8.8 0 0 1 .87.32 1 1 0 0 1 .13.38v.22l.11.04q.6.18 1.12.5l.2.14.17.12.06-.19.08-.3a2.3 2.3 0 0 0-.42-1.81z"/>
134
+ </symbol>`,hB=`<symbol id="file-tree-builtin-svg" viewBox="0 0 16 16">
135
+ <path fill="currentColor" d="M5 7a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2z"/>
136
+ <path fill="currentColor" d="M6 1a5 5 0 0 1 4.58 3H7a3 3 0 0 0-3 3v3.58A5 5 0 0 1 6 1" opacity=".5"/>
137
+ </symbol>`,gB=`<symbol id="file-tree-builtin-svgo" viewBox="0 0 16 16">
138
+ <path fill="currentColor" d="M9.43 4.8A.6.6 0 1 1 9.19 6l-.56.96a1.2 1.2 0 0 1 .32 1.58l.7.53a.89.89 0 1 1-.17.22l-.7-.52a1.2 1.2 0 0 1-1.4.25l-.56.87a.75.75 0 1 1-.57-.2 1 1 0 0 1 .32.05l.56-.87a1.2 1.2 0 0 1-.4-1.24l-1.2-.47a.56.56 0 1 1 .1-.28v.02l1.2.47a1.2 1.2 0 0 1 1.56-.55l.56-.97a.6.6 0 0 1-.15-.64.6.6 0 0 1 .63-.4"/>
139
+ <path fill="currentColor" fill-rule="evenodd" d="M9.17 1q.16.63.27 1.26a6 6 0 0 1 1.61.67q.52-.38 1.08-.71l1.65 1.64q-.32.56-.68 1.05.48.78.72 1.67.6.09 1.18.25v2.32q-.55.15-1.11.24a6 6 0 0 1-.7 1.82q.31.44.59.91l-1.65 1.65-.85-.55a6 6 0 0 1-1.9.83q-.08.47-.2.95H6.84q-.12-.46-.2-.93a6 6 0 0 1-1.96-.81q-.39.27-.8.51l-1.65-1.65q.25-.43.53-.84a6 6 0 0 1-.75-1.9L1 9.16V6.83q.54-.14 1.09-.24a6 6 0 0 1 .77-1.74q-.33-.47-.63-.98l1.65-1.65q.54.32 1.03.68a6 6 0 0 1 1.66-.66q.1-.61.26-1.24zM7.96 3.73a4 4 0 0 0-1.74.36 4.5 4.5 0 0 0-2.3 2.3 4.4 4.4 0 0 0-.1 3.29l.03.06a4.4 4.4 0 0 0 2.4 2.47 4.4 4.4 0 0 0 3.48-.02l.03-.02a4.4 4.4 0 0 0 2.3-2.42l.06-.14a4.4 4.4 0 0 0-.2-3.4 4.4 4.4 0 0 0-2.13-2.07L9.47 4a4 4 0 0 0-1.51-.27" clip-rule="evenodd"/>
140
+ </symbol>`,_B=`<symbol id="file-tree-builtin-swift" viewBox="0 0 16 16">
141
+ <path fill="currentColor" d="M9.63 1c6.15 4.35 4.16 9.15 4.16 9.15s1.75 2.05 1.04 3.85c0 0-.72-1.26-1.93-1.26-1.17 0-1.85 1.26-4.2 1.26C3.47 14 1 9.46 1 9.46c4.71 3.22 7.93.94 7.93.94C6.8 9.12 2.29 3 2.29 3c3.93 3.47 5.63 4.39 5.63 4.39-1.01-.87-3.86-5.13-3.86-5.13C6.34 4.66 10.86 8 10.86 8c1.28-3.7-1.23-7-1.23-7"/>
142
+ </symbol>`,vB=`<symbol id="file-tree-builtin-table" viewBox="0 0 16 16">
143
+ <path fill="currentColor" d="M8 4a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1H8z" class="bg" opacity=".4"/>
144
+ <path fill="currentColor" d="M11.5 8a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5v-4a.5.5 0 0 1 .5-.5zM5 12h2.5v-1H5zm3.5 0H11v-1H8.5zM5 10h2.5V9H5zm3.5 0H11V9H8.5zm1-9a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>
145
+ </symbol>`,yB=`<symbol id="file-tree-builtin-tailwind" viewBox="0 0 16 16">
146
+ <path fill="currentColor" fill-rule="evenodd" d="M8 4Q5.2 4 4.5 6.67q1.05-1.34 2.45-1c.53.12.91.5 1.33.9C8.98 7.23 9.77 8 11.5 8q2.8 0 3.5-2.67-1.05 1.34-2.45 1c-.53-.12-.91-.5-1.33-.9C10.52 4.77 9.73 4 8 4M4.5 8Q1.7 8 1 10.67q1.05-1.34 2.45-1c.53.12.91.5 1.33.9C5.48 11.23 6.26 12 8 12q2.8 0 3.5-2.67-1.05 1.34-2.45 1c-.53-.12-.91-.5-1.33-.9C7.02 8.77 6.24 8 4.5 8" clip-rule="evenodd"/>
147
+ </symbol>`,bB=`<symbol id="file-tree-builtin-terraform" viewBox="0 0 16 16">
148
+ <path fill="currentColor" d="M1 0v5.05l4.35 2.53V2.53zm9.18 5.34L5.83 2.82v5.05l4.35 2.53zm.47 5.06V5.34L15 2.82v5.05zm-.48 5.6-4.35-2.53V8.42l4.35 2.53z"/>
149
+ </symbol>`,xB=`<symbol id="file-tree-builtin-text" viewBox="0 0 16 16">
150
+ <path fill="currentColor" fill-rule="evenodd" d="M8 4a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1H8z" class="bg" clip-rule="evenodd" opacity=".4"/>
151
+ <path fill="currentColor" d="M8.5 11a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1zm2-2a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1zm-1-8a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z"/>
152
+ </symbol>`,SB=`<symbol id="file-tree-builtin-typescript" viewBox="0 0 16 16">
153
+ <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
154
+ <path fill="currentColor" d="M8.1 9.64h.95c.04.62.28.76 1.28.76s1.2-.14 1.2-.85c0-.66-.2-.85-1.2-1.07-1.79-.38-2.18-.7-2.18-1.86C8.15 5.3 8.54 5 10.31 5c1.67 0 2.04.26 2.07 1.42h-.95c-.02-.43-.23-.53-1.1-.53-1 0-1.22.14-1.22.74 0 .52.22.7 1.24.92 1.76.38 2.15.73 2.15 2 0 1.44-.4 1.75-2.24 1.75-1.8 0-2.18-.3-2.15-1.66m-3 1.57V5.99H3.5v-.9h4.21v.9H6.1v5.22z"/>
155
+ </symbol>`,CB=`<symbol id="file-tree-builtin-vite" viewBox="0 0 16 16">
156
+ <path fill="currentColor" d="M8.57 14.87c-.18.26-.55.11-.55-.22v-3.18l-.05-.27-.13-.22-.2-.15-.24-.06H4.29c-.26 0-.4-.32-.26-.55L6.08 7c.3-.46 0-1.1-.5-1.1H1.8c-.25 0-.4-.32-.25-.56l2.65-4.2A.3.3 0 0 1 4.46 1h7.9c.26 0 .4.32.26.55l-2.05 3.23c-.29.46 0 1.1.5 1.1h3.12c.26 0 .4.34.24.57z"/>
157
+ </symbol>`,wB=`<symbol id="file-tree-builtin-vscode" viewBox="0 0 16 16">
158
+ <path fill="currentColor" d="m5.11 9.68-2.4 1.84a.6.6 0 0 1-.75-.04l-.77-.7a.6.6 0 0 1 0-.87L3.28 8zm5.52-8.42a.51.51 0 0 1 .87.36V4.8L7.32 8 5.1 6.32z" opacity=".75"/>
159
+ <path fill="currentColor" d="M11.1 14.99h.03zM1.96 4.52a.6.6 0 0 1 .75-.04l8.8 6.71v3.19a.51.51 0 0 1-.88.36L1.19 6.1a.6.6 0 0 1 0-.87z" opacity=".65"/>
160
+ <path fill="currentColor" d="M11.62 14.91a.9.9 0 0 1-1-.17.51.51 0 0 0 .88-.36V1.62a.51.51 0 0 0-.87-.36.9.9 0 0 1 1-.17l2.87 1.39a.9.9 0 0 1 .5.8v9.44a.9.9 0 0 1-.5.8z"/>
161
+ </symbol>`,TB=`<symbol id="file-tree-builtin-vue" viewBox="0 0 16 16">
162
+ <path fill="currentColor" d="M9.62 2.25 8 5.02 6.38 2.25H1l7 12 7-12z" opacity=".5"/>
163
+ <path fill="currentColor" d="M9.54 2.25 8 4.95l-1.54-2.7H4l4 7 4-7z"/>
164
+ </symbol>`,EB=`<symbol id="file-tree-builtin-wasm" viewBox="0 0 16 16">
165
+ <path fill="currentColor" d="M13 1a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h3a2 2 0 1 0 4 0z" class="subtract" opacity=".2"/>
166
+ <path fill="currentColor" d="M4.64 11.4h.02l.8-3.4h.91l.73 3.45L7.88 8h.96l-1.25 5h-.97L5.9 9.6 5.1 13h-1L3 8h.98z"/>
167
+ <path fill="currentColor" fill-rule="evenodd" d="M13 13h-1.02l-.33-1.11H9.9L9.64 13h-.97l1.26-5h1.54zm-2.49-3.77-.42 1.84h1.32l-.49-1.84z" clip-rule="evenodd"/>
168
+ </symbol>`,DB=`<symbol id="file-tree-builtin-webpack" viewBox="0 0 16 16">
169
+ <path fill="currentColor" d="M14.1 11.79 8.26 15v-2.5l3.64-1.94zm.4-.35V4.73l-2.14 1.2v4.3zm-12.6.35L7.74 15v-2.5L4.1 10.56zm-.4-.35V4.73l2.14 1.2v4.3zm.25-7.15 6-3.29v2.42L3.9 5.47l-.03.01zm12.5 0L8.25 1v2.42l3.85 2.05.03.01z" class="bg" opacity=".4"/>
170
+ <path fill="currentColor" d="m7.74 11.93-3.59-1.92v-3.8l3.6 2.02zm.52 0 3.59-1.92v-3.8l-3.6 2.02zM4.4 5.77 8 3.85l3.6 1.93L8 7.8z" class="fg"/>
171
+ </symbol>`,OB=`<symbol id="file-tree-builtin-yml" viewBox="0 0 16 16">
172
+ <path fill="currentColor" d="M7.5 2A1.5 1.5 0 0 1 9 3.5v3A1.5 1.5 0 0 1 7.5 8h-2v2A1.5 1.5 0 0 0 7 11.5v-1A1.5 1.5 0 0 1 8.5 9h5a1.5 1.5 0 0 1 1.5 1.5v3a1.5 1.5 0 0 1-1.5 1.5h-5A1.5 1.5 0 0 1 7 13.5v-1A2.5 2.5 0 0 1 4.5 10V8h-2A1.5 1.5 0 0 1 1 6.5v-3A1.5 1.5 0 0 1 2.5 2zm1 8a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h5a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5zm-6-7a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h5a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5z"/>
173
+ </symbol>`,kB=`<symbol id="file-tree-builtin-zig" viewBox="0 0 16 16">
174
+ <path fill="currentColor" d="m14.73 1.5-7.29 8.82h4.17l-1.73 2.04H5.76L1.27 14.5l7.3-8.91H4.39l1.73-2.05h4.12z"/>
175
+ <path fill="currentColor" d="M5.21 3.54 3.56 5.6h-.55v4.73h.83L2.1 12.36H1V3.54zm9.79 0v8.82h-4.3l1.74-2.04h.55V5.68h-.83l1.74-2.14z"/>
176
+ </symbol>`,AB=[Pz,zz,Vz,Hz,Uz,Wz,qz,Jz,Yz,Zz,Qz,$z,eB,tB,nB,cB,uB,dB,_B,vB,xB,SB,`<symbol id="file-tree-builtin-zip" viewBox="0 0 16 16">
177
+ <path fill="currentColor" d="M4.585 2a2 2 0 0 1 1.028.285l1.788 1.072a1 1 0 0 0 .514.143H12A2 2 0 0 1 13.935 5H0V4a2 2 0 0 1 2-2z" class="bg" opacity=".5"/>
178
+ <path fill="currentColor" fill-rule="evenodd" d="M14 12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-1.25h1v-1H0V6h14zM9.9 8.25c-.883 0-1.9.5-1.9.5H7v1h1v1s1.017.5 1.9.5c.884 0 1.6-.672 1.6-1.5s-.716-1.5-1.6-1.5M2 9.75v1h1v-1zm2 0v1h1v-1zm2 0v1h1v-1zm-5-1v1h1v-1zm2 0v1h1v-1zm2 0v1h1v-1z" class="fg" clip-rule="evenodd"/>
179
+ </symbol>`],jB=[Mz,Nz,Fz,Iz,Lz,Rz,Bz,Gz,Kz,Xz,rB,iB,aB,oB,sB,lB,fB,pB,mB,hB,gB,yB,bB,CB,wB,TB,EB,DB,OB,kB];function MB(e,t){return t.length===0?e:e.replace(`</svg>`,`\n ${t.join(`
180
+ `)}\n</svg>`)}var NB=MB(jz,AB),PB={minimal:jz,standard:NB,complete:MB(NB,jB)},FB={".babelrc":`babel`,".babelrc.json":`babel`,".bash_profile":`bash`,".bashrc":`bash`,".browserslistrc":`browserslist`,".dockerignore":`docker`,".eslintignore":`eslint`,".eslintrc":`eslint`,".eslintrc.cjs":`eslint`,".eslintrc.js":`eslint`,".eslintrc.json":`eslint`,".eslintrc.yaml":`eslint`,".eslintrc.yml":`eslint`,".gitattributes":`git`,".gitignore":`git`,".gitkeep":`git`,".gitmodules":`git`,".oxlintrc.json":`oxc`,".postcssrc":`postcss`,".postcssrc.json":`postcss`,".postcssrc.yaml":`postcss`,".postcssrc.yml":`postcss`,".prettierignore":`prettier`,".prettierrc":`prettier`,".prettierrc.cjs":`prettier`,".prettierrc.js":`prettier`,".prettierrc.json":`prettier`,".prettierrc.mjs":`prettier`,".prettierrc.toml":`prettier`,".prettierrc.yaml":`prettier`,".prettierrc.yml":`prettier`,".stylelintignore":`stylelint`,".stylelintrc":`stylelint`,".stylelintrc.cjs":`stylelint`,".stylelintrc.js":`stylelint`,".stylelintrc.json":`stylelint`,".stylelintrc.mjs":`stylelint`,".stylelintrc.yaml":`stylelint`,".stylelintrc.yml":`stylelint`,".terraform.lock.hcl":`terraform`,".zprofile":`bash`,".zshenv":`bash`,".zshrc":`bash`,"babel.config.cjs":`babel`,"babel.config.js":`babel`,"babel.config.json":`babel`,"babel.config.mjs":`babel`,"biome.json":`biome`,"biome.jsonc":`biome`,"bootstrap.bundle.js":`bootstrap`,"bootstrap.bundle.min.js":`bootstrap`,"bootstrap.css":`bootstrap`,"bootstrap.js":`bootstrap`,"bootstrap.min.css":`bootstrap`,"bootstrap.min.js":`bootstrap`,"bun.lock":`bun`,"bun.lockb":`bun`,"bunfig.toml":`bun`,"claude.md":`claude`,"compose.yaml":`docker`,"compose.yml":`docker`,"docker-compose.override.yml":`docker`,"docker-compose.yaml":`docker`,"docker-compose.yml":`docker`,dockerfile:`docker`,"eslint.config.cjs":`eslint`,"eslint.config.js":`eslint`,"eslint.config.mjs":`eslint`,"eslint.config.mts":`eslint`,"eslint.config.ts":`eslint`,gemfile:`ruby`,"next.config.js":`nextjs`,"next.config.mjs":`nextjs`,"next.config.mts":`nextjs`,"next.config.ts":`nextjs`,"postcss.config.cjs":`postcss`,"postcss.config.js":`postcss`,"postcss.config.mjs":`postcss`,"postcss.config.ts":`postcss`,"prettier.config.cjs":`prettier`,"prettier.config.js":`prettier`,"prettier.config.mjs":`prettier`,rakefile:`ruby`,"readme.md":`markdown`,"stylelint.config.cjs":`stylelint`,"stylelint.config.js":`stylelint`,"stylelint.config.mjs":`stylelint`,"svgo.config.cjs":`svgo`,"svgo.config.js":`svgo`,"svgo.config.mjs":`svgo`,"svgo.config.ts":`svgo`,"tailwind.config.cjs":`tailwind`,"tailwind.config.js":`tailwind`,"tailwind.config.mjs":`tailwind`,"tailwind.config.ts":`tailwind`,"vite.config.js":`vite`,"vite.config.mjs":`vite`,"vite.config.mts":`vite`,"vite.config.ts":`vite`,"webpack.config.babel.js":`webpack`,"webpack.config.cjs":`webpack`,"webpack.config.js":`webpack`,"webpack.config.mjs":`webpack`,"webpack.config.ts":`webpack`},IB={"7z":`zip`,astro:`astro`,AUTHORS:`text`,avif:`image`,bash:`bash`,bmp:`image`,bz2:`zip`,c:`c`,cc:`cpp`,cfg:`text`,CHANGELOG:`text`,cjs:`javascript`,"code-workspace":`vscode`,conf:`text`,CONTRIBUTORS:`text`,cpp:`cpp`,csh:`bash`,css:`css`,csv:`table`,cts:`typescript`,cxx:`cpp`,db:`database`,editorconfig:`text`,env:`text`,"env.development":`text`,"env.local":`text`,"env.production":`text`,eot:`font`,erb:`ruby`,fish:`bash`,gemspec:`ruby`,gif:`image`,go:`go`,gql:`graphql`,graphql:`graphql`,gz:`zip`,h:`c`,hh:`cpp`,hpp:`cpp`,htm:`html`,html:`html`,hxx:`cpp`,icns:`image`,ico:`image`,ini:`text`,inl:`cpp`,jar:`zip`,jpeg:`image`,jpg:`image`,js:`javascript`,json:`json`,json5:`json`,jsonc:`json`,jsonl:`json`,jsx:`javascript`,ksh:`bash`,less:`css`,LICENSE:`text`,log:`text`,markdown:`markdown`,mcp:`mcp`,md:`markdown`,mdx:`markdown`,"mdx.tsx":`markdown`,mjs:`javascript`,mm:`cpp`,mts:`typescript`,ods:`table`,otf:`font`,png:`image`,postcss:`css`,py:`python`,pyi:`python`,pyw:`python`,pyx:`python`,rake:`ruby`,rar:`zip`,rb:`ruby`,rs:`rust`,rst:`text`,rtf:`text`,sass:`css`,scss:`css`,sh:`bash`,sql:`database`,sqlite:`database`,sqlite3:`database`,styl:`css`,svelte:`svelte`,svg:`svg`,swift:`swift`,tar:`zip`,tf:`terraform`,tfstate:`terraform`,tfvars:`terraform`,tgz:`zip`,tif:`image`,tiff:`image`,ts:`typescript`,tsv:`table`,tsx:`typescript`,ttf:`font`,txt:`text`,vue:`vue`,war:`zip`,wasm:`wasm`,wast:`wasm`,wat:`wasm`,webp:`image`,woff:`font`,woff2:`font`,xhtml:`html`,xls:`table`,xlsx:`table`,xz:`zip`,yaml:`yml`,yml:`yml`,zig:`zig`,zip:`zip`,zsh:`bash`},LB={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},RB=new Set([`bash`,`c`,`cpp`,`css`,`database`,`default`,`font`,`git`,`go`,`html`,`image`,`javascript`,`json`,`markdown`,`mcp`,`python`,`ruby`,`rust`,`swift`,`table`,`text`,`typescript`,`zip`]),zB=new Set([`complete`]);function BB(e){return PB[e===`none`?`minimal`:e]}function VB(e){return`file-tree-builtin-${e}`}function HB(e){return e!==`none`&&zB.has(e)}function UB(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=FB[t.toLowerCase()];if(i!=null&&(r||RB.has(i)))return i;for(let e of n){if(r){let t=LB[e];if(t!=null)return t}let t=IB[e];if(t!=null&&(r||RB.has(t)))return t}return`default`}var WB=`file-tree-container`,GB=`data-file-tree-style`,KB=`data-file-tree-unsafe-css`,qB=`data-file-tree-scrollbar-measure`,JB=`data-file-tree-scrollbar-gutter-measured`,YB=`--trees-scrollbar-gutter-measured`,XB=`header`,ZB=`context-menu`,QB=`context-menu-trigger`;function $B(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function eV(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??($B(e)?`none`:`complete`),colored:e.colored??!0}}var tV=e=>e.trim().toLowerCase(),nV=e=>e.split(`/`).at(-1)??e,rV=e=>{let t=e.toLowerCase().split(`.`),n=[];for(let e=1;e<t.length;e+=1)n.push(t.slice(e).join(`.`));return n};function iV(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function aV(e){let t=eV(e),n=t.remap,r=new Map;for(let[e,n]of Object.entries(t.byFileName??{}))r.set(e.toLowerCase(),n);let i=new Map;for(let[e,n]of Object.entries(t.byFileExtension??{}))i.set(tV(e),n);let a=Object.entries(t.byFileNameContains??{}).map(([e,t])=>[e.toLowerCase(),t]);return{resolveIcon:(e,o)=>{if(e===`file-tree-icon-file`&&o!=null){let n=nV(o),s=n.toLowerCase(),c=r.get(s);if(c!=null)return iV(c,e);for(let[t,n]of a)if(s.includes(t))return iV(n,e);let l=rV(n);for(let t of l){let n=i.get(t);if(n!=null)return iV(n,e)}let u=UB(t.set,n,l);if(u!=null&&t.set!==`none`)return{name:VB(u),remappedFrom:e,token:u}}let s=n?.[e];return s==null?{name:e}:iV(s,e)}}}var oV=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,sV=/^0(?:\.0+)?%?$/;function cV(e){let t=e.indexOf(`(`);if(t<=0||!e.endsWith(`)`))return;let n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;let r=e.slice(t+1,-1).trim();if(r.length===0)return;let i=r.lastIndexOf(`/`);if(i!==-1)return r.slice(i+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){let e=r.split(`,`);if(e.length===4)return e[3]?.trim()}}function lV(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||oV.test(t))return!0;let n=cV(t);return n!=null&&sV.test(n)}function uV(e){return lV(e)?void 0:e}function dV(e){let t=e.colors??{},n=t[`sideBar.background`]??t[`editor.background`]??e.bg,r=t[`sideBar.foreground`]??t[`editor.foreground`]??e.fg,i=t[`sideBar.border`],a=t[`list.activeSelectionForeground`]??t[`sideBar.foreground`],o=n?.toLowerCase(),s=t[`list.hoverBackground`],c=s?.toLowerCase()===o?void 0:s,l=t[`list.activeSelectionBackground`],u=l?.toLowerCase()===o?t[`list.focusBackground`]??t[`editor.selectionBackground`]:l??t[`editor.selectionBackground`],d=uV(t[`list.focusOutline`])??uV(t.focusBorder),f=t[`input.background`]??n,p=t[`input.border`],m=t[`scrollbarSlider.background`],h=t[`sideBarSectionHeader.foreground`]??r,g=t[`gitDecoration.addedResourceForeground`]??t[`terminal.ansiGreen`]??t[`editorGutter.addedBackground`],_=t[`gitDecoration.modifiedResourceForeground`]??t[`terminal.ansiBlue`]??t[`editorGutter.modifiedBackground`],v=t[`gitDecoration.deletedResourceForeground`]??t[`terminal.ansiRed`]??t[`editorGutter.deletedBackground`],y=e.type===`dark`,b={colorScheme:y?`dark`:`light`,backgroundColor:n??``,color:r??``,borderColor:`var(--trees-theme-sidebar-border, light-dark(oklch(0% 0 0 / 0.15), oklch(100% 0 0 / 0.15)))`,"--trees-theme-sidebar-bg":n??``,"--trees-theme-sidebar-fg":r??``,"--trees-theme-sidebar-header-fg":h??``,"--trees-theme-list-active-selection-fg":a??r??``,"--trees-theme-list-hover-bg":c??(y?`rgba(255,255,255,0.08)`:`rgba(0,0,0,0.06)`),"--trees-theme-list-active-selection-bg":u??`transparent`,"--trees-theme-focus-ring":d??r??``,"--trees-theme-input-bg":f??``};return i!=null&&i!==``&&(b[`--trees-theme-sidebar-border`]=i),p!=null&&p!==``&&(b[`--trees-theme-input-border`]=p),m!=null&&m!==``&&(b[`--trees-theme-scrollbar-thumb`]=m),g!=null&&g!==``&&(b[`--trees-theme-git-added-fg`]=g),_!=null&&_!==``&&(b[`--trees-theme-git-modified-fg`]=_),v!=null&&v!==``&&(b[`--trees-theme-git-deleted-fg`]=v),b}var fV=5,pV=1<<fV,mV=pV*4;function hV(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function gV(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function _V(e,t){if(t.childIdByNameId!=null)return t.childIdByNameId;let n=new Map;for(let r of t.childIds){let t=e[r];t!=null&&n.set(t.nameId,r)}return t.childIdByNameId=n,n}function vV(e){if(e.childPositionById!=null)return e.childPositionById;let t=new Map;for(let n=0;n<e.childIds.length;n++){let r=e.childIds[n];r!=null&&t.set(r,n)}return e.childPositionById=t,t}function yV(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function bV(e,t){if(e.childPositionById!=null)for(let n=t;n<e.childIds.length;n++){let t=e.childIds[n];t!=null&&e.childPositionById.set(t,n)}}function xV(e,t){let n=0,r=0;for(let i of t.childIds){let t=e[i];t!=null&&(n+=t.subtreeNodeCount,r+=t.visibleSubtreeCount)}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,TV(e,t)}function SV(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=vV(e).get(t);if(i===void 0)return;let a=i>>fV;e.childVisibleChunkSums[a]+=r}function CV(e,t,n){let r=t.childVisibleChunkSums;if(r!=null){let i=n,a=0;for(let o of r){if(i<o){let r=EV(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=pV}throw Error(`Visible child index ${String(n)} is out of range`)}let i=n;for(let r=0;r<t.childIds.length;r++){let a=t.childIds[r];if(a==null)continue;let o=e[a];if(o!=null){if(i<o.visibleSubtreeCount)return{childIndex:r,childVisibleIndex:n-i,localVisibleIndex:i};i-=o.visibleSubtreeCount}}throw Error(`Visible child index ${String(n)} is out of range`)}function wV(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>fV;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<fV}for(let i=a;i<n;i+=1){let n=t.childIds[i];if(n==null)continue;let a=e[n];a!=null&&(r+=a.visibleSubtreeCount)}return r}function TV(e,t){if(t.childIds.length<mV){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/pV),r=new Int32Array(n);for(let n=0;n<t.childIds.length;n++){let i=t.childIds[n];if(i==null)continue;let a=e[i];a!=null&&(r[n>>fV]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function EV(e,t,n,r){let i=Math.min(t.childIds.length,n+pV),a=r;for(let r=n;r<i;r++){let n=t.childIds[r];if(n==null)continue;let i=e[n];if(i!=null){if(a<i.visibleSubtreeCount)return{childIndex:r,localVisibleIndex:a};a-=i.visibleSubtreeCount}}throw Error(`Visible child index ${String(r)} is out of range`)}var DV=7,OV=3,kV=1<<OV,AV=4;function jV(e,t,n=0){return e<<AV|n<<OV|t}function MV(e){return e.depthAndFlags>>>AV}function NV(e){return(e.depthAndFlags&kV)>>OV}function PV(e){return(e.depthAndFlags&kV)!==0}function FV(e){return e.depthAndFlags&DV}function IV(e,t){return(FV(e)&t)!==0}function LV(e,t){e.depthAndFlags|=t}function RV(e,t){e.depthAndFlags=jV(t,FV(e),NV(e))}var zV=Symbol(`benchmarkInstrumentation`);function BV(e,t){return t==null||Object.defineProperty(e,zV,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function VV(e){return e==null?null:e[zV]??null}function HV(e,t,n){return e==null?n():e.measurePhase(t,n)}function UV(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function WV(e){return e>=48&&e<=57}function GV(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!WV(e.charCodeAt(r));)r+=1;if(r>=e.length)break;r>n&&t.push(e.slice(n,r));let i=0;for(;r<e.length&&WV(e.charCodeAt(r));)i=i*10+(e.charCodeAt(r)-48),r+=1;t.push(i),n=r}return(n<e.length||t.length===0)&&t.push(e.slice(n)),t}function KV(e){let t=e.toLowerCase();return{lowerValue:t,tokens:GV(t)}}function qV(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===i)continue;if(typeof n==`number`&&typeof i==`number`)return n<i?-1:1;let a=String(n),o=String(i);if(a!==o)return a<o?-1:1}return e.length===t.length?0:e.length<t.length?-1:1}function JV(e,t){if(e.tokens.length===1&&t.tokens.length===1&&typeof e.tokens[0]==`string`&&typeof t.tokens[0]==`string`)return e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1;let n=qV(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function YV(e,t,n){let r=JV(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function XV(e,t){return YV(e,t,KV)}function ZV(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function QV(e,t){let n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){let n=e.segments[r],i=t.segments[r];if(n===i)continue;let a=ZV(e,r);return a===ZV(t,r)?XV(n,i):a===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function $V(e,t){return QV(e,t)}function eH(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=KV(e);return n.set(e,r),r},i=Math.min(e.segments.length,t.segments.length);for(let n=0;n<i;n++){let i=e.segments[n],a=t.segments[n];if(i===a)continue;let o=ZV(e,n);return o===ZV(t,n)?YV(i,a,r):o===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function tH(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=KV(r);return e.sortKeyById[t]=i,i}function nH(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function rH(e){let t=e.length>0&&e.charCodeAt(e.length-1)===47,n=t?e.length-1:e.length,r=[],i=0;for(let t=0;t<n;t++)e.charCodeAt(t)===47&&(r.push(e.slice(i,t)),i=t+1);return r.push(e.slice(i,n)),{hasTrailingSlash:t,segments:r}}function iH(e){let{hasTrailingSlash:t,segments:n}=rH(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function aH(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=rH(e);return{requiresDirectory:t,segments:n}}var oH=``;function sH(){let e=new Map;return e.set(oH,0),{idByValue:e,valueById:[oH],sortKeyById:[KV(oH)]}}function cH(e,t){let n=e.idByValue.get(t);if(n!==void 0)return n;let r=e.valueById.length;return e.idByValue.set(t,r),e.valueById.push(t),r}function lH(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var uH=Symbol(`pathStorePreparedInputKind`);function dH(e,t){return e[uH]=t,e}function fH(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function pH(e,t,n){return n===`default`?$V(e,t):n(fH(e),fH(t))}function mH(){return{depthAndFlags:jV(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function hH(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return r;return n}function gH(e){return e.isDirectory?e.segments.length:e.segments.length-1}function _H(e){return Array.isArray(e)&&e.every(e=>typeof e==`object`&&!!e&&typeof e.path==`string`&&Array.isArray(e.segments)&&typeof e.basename==`string`&&typeof e.isDirectory==`boolean`)}function vH(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function yH(e,t={}){return TH(e,t).map(e=>e.path)}function bH(e,t={}){let n=TH(e,t);return dH({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function xH(e){let t=e.length,n=!1;for(let r=0;r<t;r+=1){let t=e[r];if(t.length>0&&t.charCodeAt(t.length-1)===47){n=!0;break}}return dH({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function SH(e){let t=e,n=t.preparedPaths;if(t[uH]===`prepared`&&n!=null)return n;if(!_H(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function CH(e){let t=e;return t[uH]===`presorted`&&t.presortedPaths!=null||vH(t.presortedPaths)?t.presortedPaths:null}function wH(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function TH(e,t={}){let n=nH(t),r=VV(t);UV(r,`workload.inputFiles`,e.length);let i=HV(r,`store.preparePathEntries.parse`,()=>e.map(e=>iH(e)));return HV(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>pH(e,t,n.sort))),i}var EH=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[mH()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=sH();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=VV(e),this.options=nH(e);let t=e.initialExpandedPaths??null;if(t==null||t.length===0)this.initialExpandedPathSet=null;else{let e=new Set,n=t.length;for(let r=0;r<n;r+=1){let n=t[r],i=n.length;e.add(i>0&&n.charCodeAt(i-1)===47?n.slice(0,i-1):n)}this.initialExpandedPathSet=e,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,hV())}appendPaths(e){return HV(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>iH(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,HV(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return HV(this.instrumentation,`store.builder.appendPresortedPaths`,()=>{if(t===!1){this.appendPresortedFilePaths(e);return}this.createdDirectoriesAllExpanded=!1;let n=null,r=0,i=this.nodes,a=this.segmentTable,o=a.idByValue,s=a.valueById,c=this.directoryStack,l=0,u=``,d=0;for(let t of e){if(n===t)throw Error(`Duplicate path: "${t}"`);let e=t.length>0&&t.charCodeAt(t.length-1)===47,a=e?t.length-1:t.length,f=0,p=0;if(n!=null)if(u.length>0&&t.length>u.length&&t.startsWith(u))f=d,p=u.length;else{let r=Math.min(a,n.length),i=!0;for(let e=0;e<r;e++){let r=t.charCodeAt(e);if(r!==n.charCodeAt(e)){i=!1;break}r===47&&(f++,p=e+1)}i&&e&&r===a&&n.length>a&&n.charCodeAt(a)===47&&(f++,p=a+1)}l=f,r=f;let m=p,h=t.indexOf(`/`,m);for(;h>=0&&h<a;){let e=c[l];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);r++;let n=t.slice(m,h),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n));let u=i.length;i.push({depthAndFlags:jV(r,0,1),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(t.slice(0,h)),l++,c[l]=u,m=h+1,h=t.indexOf(`/`,m)}if(e){if(m<a){let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory parent for "${t}"`);r++;let n=t.slice(m,a),u=o.get(n);u===void 0&&(u=s.length,o.set(n,u),s.push(n));let d=i.length;i.push({depthAndFlags:jV(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d}let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory node for "${t}"`);this.promoteDirectoryToExplicit(e,t)}else{let e=c[l];if(e===void 0)throw Error(`Unable to resolve file parent for "${t}"`);let n=t.slice(m),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n)),i.push({depthAndFlags:jV(r+1,0),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1})}m!==u.length&&(u=t.substring(0,m),d=r),n=t}c.length=l+1,n!=null&&(this.lastPreparedPath=iH(n)),this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0,r=this.nodes,i=this.segmentTable,a=i.idByValue,o=i.valueById,s=this.directoryStack,c=0,l=``,u=0;for(let i of e){if(t===i)throw Error(`Duplicate path: "${i}"`);let e=i.length,d=0,f=0;if(t!=null)if(l.length>0&&i.length>l.length&&i.startsWith(l))d=u,f=l.length;else{let n=Math.min(e,t.length);for(let e=0;e<n;e++){let n=i.charCodeAt(e);if(n!==t.charCodeAt(e))break;n===47&&(d++,f=e+1)}}c=d,n=d;let p=f,m=i.indexOf(`/`,p);for(;m>=0;){let e=s[c];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);n++;let t=i.slice(p,m),l=a.get(t);l===void 0&&(l=o.length,a.set(t,l),o.push(t));let u=r.length;r.push({depthAndFlags:jV(n,0,1),nameId:l,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(i.slice(0,m)),this.presortedDirectoryNodeIds.push(u),c++,s[c]=u,p=m+1,m=i.indexOf(`/`,p)}let h=s[c];if(h===void 0)throw Error(`Unable to resolve file parent for "${i}"`);let g=i.slice(p),_=a.get(g);_===void 0&&(_=o.length,a.set(g,_),o.push(g)),r.push({depthAndFlags:jV(n+1,0),nameId:_,parentId:h,subtreeNodeCount:1,visibleSubtreeCount:1}),p!==l.length&&(l=i.substring(0,p),u=n),t=i}s.length=c+1,t!=null&&(this.lastPreparedPath=iH(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(HV(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||HV(this.instrumentation,`store.builder.computeSubtreeCounts`,()=>this.computeSubtreeCounts(0)),{directories:this.directories,nodes:this.nodes,options:this.options,rootId:0,segmentTable:this.segmentTable,presortedDirectoryNodeIds:this.presortedDirectoryNodeIds.length>0?this.presortedDirectoryNodeIds:null}}didMatchAllInitialExpandedPaths(){return this.createdDirectoriesAllExpanded&&this.initialExpandedPathSet!=null&&this.createdDirectoryCount===this.initialExpandedPathSet.size}appendPreparedPath(e,t){if(this.hasDeferredDirectoryIndexes&&=(this.buildDirectoryIndexes(),!1),this.lastPreparedPath!=null){if(e.path===this.lastPreparedPath.path)throw Error(`Duplicate path: "${e.path}"`);if(t&&(this.options.sort===`default`?eH(this.lastPreparedPath,e,this.segmentSortKeyCache):pH(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=gH(e),i=n==null?0:gH(n),a=n==null?0:hH(n.segments,e.segments),o=Math.min(a,r,i);this.directoryStack.length=o+1;for(let n=o;n<r;n++){let r=this.directoryStack[this.directoryStack.length-1];if(r===void 0)throw Error(`Directory stack underflow while building the path store`);let i=t?this.getOrCreateDirectoryChild(r,e.segments[n]):this.createDirectoryChild(r,e.segments[n]);this.directoryStack.push(i)}if(e.isDirectory){let t=this.directoryStack[this.directoryStack.length-1];if(t===void 0)throw Error(`Unable to resolve directory node for "${e.path}"`);this.promoteDirectoryToExplicit(t,e.path),this.lastPreparedPath=e;return}let s=this.directoryStack[this.directoryStack.length-1];if(s===void 0)throw Error(`Unable to resolve file parent for "${e.path}"`);t?this.createFileChild(s,e.basename,e.path):this.createFileChildUnchecked(s,e.basename),this.lastPreparedPath=e}recordCreatedDirectoryPath(e){!this.createdDirectoriesAllExpanded||this.initialExpandedPathSet==null||(this.createdDirectoryCount+=1,this.initialExpandedPathSet.has(e)||(this.createdDirectoriesAllExpanded=!1))}createFileChild(e,t,n){let r=cH(this.segmentTable,t),i=this.getDirectoryIndex(e),a=i.childIdByNameId;if(a!=null&&a.get(r)!==void 0)throw Error(`Path collides with an existing entry: "${n}"`);let o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let s=this.nodes.length;return this.nodes.push({depthAndFlags:jV(MV(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),yV(i,s),s}createFileChildUnchecked(e,t){let n=cH(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:jV(MV(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),yV(r,a),a}getOrCreateDirectoryChild(e,t){let n=cH(this.segmentTable,t),r=this.getDirectoryIndex(e);if(r.childIdByNameId!=null){let e=r.childIdByNameId.get(n);if(e!==void 0){let n=this.nodes[e];if(n!=null&&!PV(n))throw Error(`Path collides with an existing file while creating directory "${t}"`);return e}}let i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:jV(MV(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),yV(r,a),this.directories.set(a,hV()),a}createDirectoryChild(e,t){let n=cH(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:jV(MV(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),yV(r,a),this.directories.set(a,hV()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!PV(n))throw Error(`Path is not a directory: "${t}"`);if(IV(n,1))throw Error(`Duplicate path: "${t}"`);LV(n,1)}getDirectoryIndex(e){let t=this.directories.get(e);if(t!==void 0)return t;throw Error(`Unknown directory child index for node ${String(e)}`)}buildPresortedFinish(e){let t=this.nodes,n=this.directories;n.set(0,gV());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(PV(a)){let t=gV();n.set(e,t),r=e,i=t}let o;a.parentId===r?o=i:(o=n.get(a.parentId),r=a.parentId,i=o??null),o?.childIds.push(e)}if(!e)for(let e=t.length-1;e>=1;e--){let n=t[e];if(n==null)continue;let r=t[n.parentId];r!=null&&(r.subtreeNodeCount+=n.subtreeNodeCount,r.visibleSubtreeCount+=n.visibleSubtreeCount)}}buildDirectoryIndexes(){let e=this.nodes;for(let t=1;t<e.length;t++){let n=e[t];if(n==null)continue;PV(n)&&this.directories.set(t,hV());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),yV(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!PV(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;let n=this.getDirectoryIndex(e),r=1;for(let e of n.childIds)r+=this.computeSubtreeCounts(e);return xV(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function DH(e,t=`closed`,n=null){let r=kH(t);return{activeNodeCount:e.nodes.length-1,collapsedDirectoryIds:new Set,collapseNewDirectoriesByDefault:!1,defaultExpansion:r,directoriesOpenByDefault:r===`open`,hasCollapsedDirectoryOverrides:!1,directoryLoadInfoById:new Map,expandedDirectoryIds:new Set,instrumentation:n,listeners:new Map,pathCacheByNodeId:new Map([[e.rootId,{path:``,version:0}]]),pathCacheVersion:0,snapshot:e,transactionStack:[]}}function OH(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function kH(e){if(typeof e!=`number`)return e;if(!Number.isInteger(e)||e<0)throw Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(e)}`);return e}function AH(e,t){return IV(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:MV(t)<=e.defaultExpansion}function jH(e,t,n=e.snapshot.nodes[t]){return n==null||!PV(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:AH(e,n)}function MH(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!PV(r))return;let i=AH(e,r);if(n){if(i){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t);return}if(i){e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0;return}e.expandedDirectoryIds.delete(t)}function NH(e,t){let n=e.directoryLoadInfoById.get(t);if(n!=null)return n;let r={activeAttemptId:null,errorMessage:null,nextAttemptId:1,state:`loaded`};return e.directoryLoadInfoById.set(t,r),r}function PH(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function FH(e,t){let n=NH(e,t);if(n.state===`loading`&&n.activeAttemptId!=null)return{attemptId:n.activeAttemptId,nodeId:t,reused:!0};let r=n.nextAttemptId;return n.activeAttemptId=r,n.errorMessage=null,n.nextAttemptId+=1,n.state=`loading`,{attemptId:r,nodeId:t,reused:!1}}function IH(e,t){let n=NH(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function LH(e,t,n){let r=e.directoryLoadInfoById.get(t);return r==null||r.activeAttemptId!==n?!1:(r.activeAttemptId=null,r.errorMessage=null,r.state=`loaded`,!0)}function RH(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function zH(e,t,n,r){let i=e.directoryLoadInfoById.get(t);return i==null||i.activeAttemptId!==n?!1:(i.activeAttemptId=null,i.errorMessage=r??null,i.state=`error`,!0)}function BH(e,t){e.directoryLoadInfoById.delete(t)}function VH(e,t,n){let r=n,i=e.listeners.get(t);return i==null?e.listeners.set(t,new Set([r])):i.add(r),()=>{let n=e.listeners.get(t);n!=null&&(n.delete(r),n.size===0&&e.listeners.delete(t))}}function HH(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function UH(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function WH(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function GH(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function KH(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function qH(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function JH(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`begin-child-load`,path:e.path,projectionChanged:e.projectionChanged,reused:e.reused,visibleCountDelta:null}}function YH(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:e.childEvents.some(e=>e.canonicalChanged),childEvents:e.childEvents,operation:`apply-child-patch`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function XH(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`complete-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function ZH(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,errorMessage:e.errorMessage,operation:`fail-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function QH(e){return{activeNodeCountAfter:e.activeNodeCountAfter,activeNodeCountBefore:e.activeNodeCountBefore,affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],cachedPathEntryCountAfter:e.cachedPathEntryCountAfter,cachedPathEntryCountBefore:e.cachedPathEntryCountBefore,canonicalChanged:!1,idsPreserved:e.idsPreserved,loadInfoEntryCountAfter:e.loadInfoEntryCountAfter,loadInfoEntryCountBefore:e.loadInfoEntryCountBefore,mode:e.mode,operation:`cleanup`,projectionChanged:e.projectionChanged,reclaimedCachedPathEntryCount:e.reclaimedCachedPathEntryCount,reclaimedLoadInfoEntryCount:e.reclaimedLoadInfoEntryCount,reclaimedNodeSlotCount:e.reclaimedNodeSlotCount,reclaimedSegmentCount:e.reclaimedSegmentCount,segmentCountAfter:e.segmentCountAfter,segmentCountBefore:e.segmentCountBefore,totalNodeSlotCountAfter:e.totalNodeSlotCountAfter,totalNodeSlotCountBefore:e.totalNodeSlotCountBefore,visibleCountDelta:null}}function $H(e,t,n){return{...n,visibleCountDelta:uU(e)-t}}function eU(e,t){let n=uU(e),r=OH();e.transactionStack.push(r);try{t()}catch(t){throw rU(e,r,!1),t}rU(e,r,!0,uU(e)-n)}function tU(e,t){let n=e.instrumentation;if(n==null){nU(e,t);return}HV(n,`store.events.record`,()=>nU(e,t))}function nU(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){cU(e,t);return}n.events.push(t),sU(n,t)}function rU(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw Error(`Transaction stack underflow`);if(!n)return;let i=e.transactionStack[e.transactionStack.length-1]??null;if(i!=null){let n=e.instrumentation;n==null?oU(i,t):HV(n,`store.events.batch.merge`,()=>oU(i,t));return}let a=iU(t,r),o=e.instrumentation;if(o==null){cU(e,a);return}HV(o,`store.events.batch.commit`,()=>cU(e,a))}function iU(e,t){return{affectedAncestorIds:[...e.affectedAncestorIds],affectedNodeIds:[...e.affectedNodeIds],canonicalChanged:e.events.some(e=>e.canonicalChanged),events:[...e.events],operation:`batch`,projectionChanged:e.events.some(e=>e.projectionChanged),visibleCountDelta:t}}function aU(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function oU(e,t){for(let n of t.events)e.events.push(n);aU(e,t)}function sU(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function cU(e,t){let n=e.instrumentation;if(n==null){lU(e,t);return}HV(n,`store.events.emit`,()=>lU(e,t))}function lU(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function uU(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function dU(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!PV(n)||IV(n,2))return null;let r=e.snapshot.directories.get(t);if(r==null||r.childIds.length!==1)return null;let i=r.childIds[0];if(i==null)return null;let a=e.snapshot.nodes[i];return a==null||!PV(a)?null:i}function fU(e,t){let n=t;for(;;){let t=dU(e,n);if(t==null)return n;n=t}}function pU(e,t){let n=[t],r=t;for(;;){let t=dU(e,r);if(t==null)return n;n.push(t),r=t}}function mU(e,t){let n=t==null?e.snapshot.rootId:wU(e,t);return n==null?[]:OU(e,n)}function hU(e,t){let n=iH(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=UU(e,HU(e,r)),{createdNodeIds:a,directoryId:o}=kU(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=DU(e,o);if(IV(n,1))throw Error(`Path already exists: "${t}"`);LV(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=jU(e,o,n.basename),s.add(c);xU(e,o);let l=UU(e,o);return HH({affectedAncestorIds:CU(e,c),affectedNodeIds:[...s],path:t,projectionChanged:WU(i,l)})}function gU(e,t,n){let r=wU(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=DU(e,r);if(IV(i,2))throw Error(`The root node cannot be removed`);if(PV(i)&&EU(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=UU(e,a),s=BU(e,r);PU(e,a,r,i.nameId),VU(e,a),xU(e,a);let c=UU(e,a);return UH({affectedAncestorIds:CU(e,a),affectedNodeIds:s,path:t,projectionChanged:WU(o,c),recursive:n.recursive===!0})}function _U(e,t,n,r){let i=wU(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=DU(e,i);if(IV(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=RU(e,i,n),c=UU(e,a.parentId),l=UU(e,s.parentId),u=lH(e.snapshot.segmentTable,a.nameId),d=cH(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(PV(a)&&JU(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=_V(e.snapshot.nodes,EU(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&zU(e,p,o,NV(a))===`skip`)return null;let m=a.parentId;PU(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),qU(e,i),NU(e,s.parentId,i),VU(e,m),e.pathCacheVersion++,xU(e,m),s.parentId!==m&&xU(e,s.parentId);let h=UU(e,m),g=UU(e,s.parentId);return WH({affectedAncestorIds:[...new Set([...CU(e,m),...CU(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:GU([c,l],[h,g]),to:bU(e,i)})}function vU(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function yU(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function bU(e,t){let n=DU(e,t),r=vU(e,t);if(r!=null)return r;if(IV(n,2))return yU(e,t,``);let i=bU(e,n.parentId),a=lH(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return yU(e,t,PV(n)?`${o}/`:o)}function xU(e,t){let n=e.instrumentation;if(n==null){XU(e,t);return}HV(n,`store.recomputeCountsUpwardFrom`,()=>XU(e,t))}function SU(e,t){let n=[[t,0]],{nodes:r,directories:i}=e.snapshot;for(;n.length>0;){let t=n[n.length-1],a=t[0],o=r[a];if(o==null||!PV(o)){YU(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){YU(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function CU(e,t){let n=[],r=t;for(;r!=null;){let t=DU(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function wU(e,t){if(t.length===0)return e.snapshot.rootId;let n=aH(t);return TU(e,n.segments,n.requiresDirectory)}function TU(e,t,n){let r=e.snapshot.rootId;for(let n of t){let t=e.snapshot.segmentTable.idByValue.get(n);if(t===void 0)return null;let i=EU(e,r),a=_V(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=DU(e,r);return n&&!PV(i)?null:r}function EU(e,t){let n=e.snapshot.directories.get(t);if(n===void 0)throw Error(`Unknown directory child index for node ${String(t)}`);return n}function DU(e,t){let n=e.snapshot.nodes[t];if(n===void 0||IV(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function OU(e,t){let n=e.snapshot.nodes[t];if(n===void 0||IV(n,4))return[];if(!PV(n))return[bU(e,t)];if(EU(e,t).childIds.length===0)return IV(n,1)&&!IV(n,2)?[bU(e,t)]:[];let r=[],i=[{childIndex:0,nodeId:t}];for(;i.length>0;){let t=i[i.length-1];if(t==null)break;let n=e.snapshot.nodes[t.nodeId];if(n===void 0||IV(n,4)){i.pop();continue}if(!PV(n)){r.push(bU(e,t.nodeId)),i.pop();continue}let a=EU(e,t.nodeId);if(a.childIds.length===0){IV(n,1)&&!IV(n,2)&&r.push(bU(e,t.nodeId)),i.pop();continue}let o=a.childIds[t.childIndex];if(o==null){i.pop();continue}t.childIndex++,i.push({childIndex:0,nodeId:o})}return r}function kU(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=cH(e.snapshot.segmentTable,i),a=EU(e,r),o=_V(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!PV(DU(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=AU(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function AU(e,t,n){let r=DU(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:jV(MV(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,hV()),NU(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function jU(e,t,n){let r=cH(e.snapshot.segmentTable,n),i=EU(e,t);if(_V(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${QU(e,t,n)}"`);let a=DU(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:jV(MV(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),NU(e,t,o),e.activeNodeCount++,o}function MU(e,t,n){let r=0,i=t.childIds.length;for(;r<i;){let a=r+i>>>1,o=t.childIds[a];if(o==null){i=a;continue}FU(e,n,o)<0?i=a:r=a+1}return r}function NU(e,t,n){let r=EU(e,t),i=DU(e,n);_V(e.snapshot.nodes,r).set(i.nameId,n),SV(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=MU(e,r,n);r.childIds.splice(a,0,n),bV(r,a),TV(e.snapshot.nodes,r)}function PU(e,t,n,r){let i=EU(e,t),a=vV(i),o=a.get(n)??-1;_V(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&SV(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),bV(i,o),TV(e.snapshot.nodes,i))}function FU(e,t,n){let r=e.snapshot.options.sort;return r===`default`?IU(e,t,n):r(LU(e,t),LU(e,n))}function IU(e,t,n){let r=DU(e,t),i=DU(e,n),a=PV(r);if(a!==PV(i))return a?-1:1;let o=JV(tH(e.snapshot.segmentTable,r.nameId),tH(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=lH(e.snapshot.segmentTable,r.nameId),c=lH(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function LU(e,t){let n=DU(e,t),r=bU(e,t),i=PV(n),a=i?r.slice(0,-1):r;return{basename:lH(e.snapshot.segmentTable,n.nameId),depth:MV(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function RU(e,t,n){let r=DU(e,t),i=wU(e,n);if(i!=null){let t=DU(e,i);if(PV(t))return{basename:lH(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=aH(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=aH(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:TU(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function zU(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${bU(e,t)}"`);let i=DU(e,t);if(NV(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(PV(i)&&EU(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return BU(e,t),PU(e,a,t,o),VU(e,a),xU(e,a),`handled`}function BU(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=DU(e,t.nodeId);if(t.visitedChildren||!PV(i)){PV(i)&&e.snapshot.directories.delete(t.nodeId),LV(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),BH(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=EU(e,t.nodeId);for(let e=a.childIds.length-1;e>=0;e--){let t=a.childIds[e];t!=null&&r.push({nodeId:t,visitedChildren:!1})}}return n}function VU(e,t){let n=t;for(;n!=null;){let t=DU(e,n);if(!PV(t)||IV(t,2)||EU(e,n).childIds.length>0)return;LV(t,1),n=t.parentId===n?null:t.parentId}}function HU(e,t){let n=e.snapshot.rootId;for(let r of t){let t=e.snapshot.segmentTable.idByValue.get(r);if(t==null)break;let i=_V(e.snapshot.nodes,EU(e,n)).get(t);if(i==null||!PV(DU(e,i)))break;n=i}return n}function UU(e,t){let n=KU(e,t);if(n==null)return null;let r=fU(e,n),i=DU(e,r),a=n===r?null:pU(e,n).map(t=>bU(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:EU(e,r).childIds.length>0,path:bU(e,r),terminalKind:NV(i)})}function WU(e,t){return GU([e],[t])}function GU(e,t){for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(r==null||i==null||r!==i)return!0}return!1}function KU(e,t){let n=t;for(;n!=null;){let t=DU(e,n);if(!PV(t)||IV(t,2))return null;if(!jH(e,n,t))return n;n=t.parentId}return null}function qU(e,t){let n=DU(e,t);if(RV(n,(t===e.snapshot.rootId?-1:MV(DU(e,n.parentId)))+1),!PV(n))return;let r=EU(e,t);for(let t of r.childIds)qU(e,t)}function JU(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=DU(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function YU(e,t,n=DU(e,t),r=!1){let i=e.instrumentation;if(i==null){ZU(e,t,n,r);return}HV(i,`store.recomputeNodeCounts`,()=>ZU(e,t,n,r))}function XU(e,t){let n=t;for(;n!=null;){let t=DU(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(YU(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&SV(EU(e,s),n,a,o),n=s}}function ZU(e,t,n,r){if(!PV(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=EU(e,t);if(r){let t=e.instrumentation;t==null?xV(e.snapshot.nodes,i):HV(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>xV(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,IV(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=dU(e,t)==null?jH(e,t,n)?1+o:1:o}function QU(e,t,n){let r=bU(e,t);return r.length===0?n:`${r}${n}`}function $U(e){return e!=null&&!IV(e,4)}function eW(e,t){let n=e.snapshot.nodes[t];return!$U(n)||!PV(n)||IV(n,2)?null:n}function tW(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&$U(e.snapshot.nodes[n])&&(t+=1);return t}function nW(e){return Math.max(0,e.valueById.length-1)}function rW(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:tW(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:nW(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function iW(e,t,n,r){return{activeNodeCountAfter:r.activeNodeCount,activeNodeCountBefore:n.activeNodeCount,cachedPathEntryCountAfter:r.cachedPathEntryCount,cachedPathEntryCountBefore:n.cachedPathEntryCount,idsPreserved:t,loadInfoEntryCountAfter:r.loadInfoEntryCount,loadInfoEntryCountBefore:n.loadInfoEntryCount,mode:e,reclaimedCachedPathEntryCount:n.cachedPathEntryCount-r.cachedPathEntryCount,reclaimedLoadInfoEntryCount:n.loadInfoEntryCount-r.loadInfoEntryCount,reclaimedNodeSlotCount:n.totalNodeSlotCount-r.totalNodeSlotCount,reclaimedSegmentCount:n.segmentCount-r.segmentCount,segmentCountAfter:r.segmentCount,segmentCountBefore:n.segmentCount,totalNodeSlotCountAfter:r.totalNodeSlotCount,totalNodeSlotCountBefore:n.totalNodeSlotCount}}function aW(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)eW(e,n)!=null&&t.push(bU(e,n));for(let t of e.expandedDirectoryIds)eW(e,t)!=null&&n.push(bU(e,t));return{collapsedPaths:t,expandedPaths:n}}function oW(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)eW(e,n)==null||PH(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:bU(e,n)});return t}function sW(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=wU(e,n);t!=null&&MH(e,t,!0,DU(e,t))}for(let n of t.collapsedPaths){let t=wU(e,n);t!=null&&MH(e,t,!1,DU(e,t))}}function cW(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=wU(e,n.path);t!=null&&eW(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function lW(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function uW(e){let t=e.snapshot.segmentTable,n=sH();for(let r of e.snapshot.nodes)if($U(r)){if(IV(r,2)){r.nameId=0;continue}r.nameId=cH(n,lH(t,r.nameId))}e.snapshot.segmentTable=n}function dW(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!$U(r)||!PV(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return $U(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[DU(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),xV(e.snapshot.nodes,n)}}function fW(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if($U(n))break;--t}e.snapshot.nodes.length=t+1}function pW(e){let t=aW(e),n=oW(e);HV(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>lW(e)),HV(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>uW(e)),HV(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>dW(e)),HV(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>fW(e)),HV(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>sW(e,t)),HV(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>cW(e,n)),HV(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>SU(e,e.snapshot.rootId))}function mW(e){let t=aW(e),n=oW(e),r=HV(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>mU(e)),i=BV({...e.snapshot.options},e.instrumentation),a=HV(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new EH(i);return e.appendPaths(r),e.finish()});e.snapshot=a,e.activeNodeCount=a.nodes.length-1,e.pathCacheByNodeId=new Map([[a.rootId,{path:``,version:0}]]),e.pathCacheVersion=0,HV(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>sW(e,t)),HV(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>cW(e,n)),HV(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>SU(e,e.snapshot.rootId))}function hW(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function gW(e,t){let n=rW(e);t===`stable`?HV(e.instrumentation,`store.cleanup.stable`,()=>pW(e)):HV(e.instrumentation,`store.cleanup.aggressive`,()=>mW(e));let r=rW(e);return iW(t,t===`stable`,n,r)}var _W=64;function vW(e,t){let n=t+2;if(n<=e.length)return e;let r=e.length;for(;r<n;)r*=2;let i=new Int32Array(r);return i.fill(-1),i.set(e),i}function yW(e){return DU(e,e.snapshot.rootId).visibleSubtreeCount}function bW(e,t,n,r){let i=DU(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function xW(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:BW(e,t.cursor),setSize:t.setSize,subtreeEndIndex:bW(e,t.cursor,t.index,n)}}function SW(e,t,n,r,i,a){let o=EU(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=CV(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return CW(e,u,l,r+c,i+1,s,o.childIds.length,a)}function CW(e,t,n,r,i,a,o,s){if(!PV(DU(e,t))){if(n===0)return{ancestors:s,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:i},index:r,posInSet:a,setSize:o};throw Error(`Visible index ${String(n)} is out of range for file`)}let c=PW(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=DU(e,c.terminalNodeId);if(!PV(l)||!jH(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return SW(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function wW(e,t){let n=yW(e);if(t<0||t>=n)return null;let r=SW(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>bU(e,t.cursor.terminalNodeId)),a=null;return{ancestorPaths:i,get ancestorRows(){if(a!=null)return a;let t=[],i=[];for(let a of r.ancestors){let r=xW(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:BW(e,r.cursor),setSize:r.setSize,subtreeEndIndex:bW(e,r.cursor,r.index,n)}}function TW(e,t,n){let r=e.instrumentation,i=yW(e);if(i<=0||n<t)return[];let a=Math.max(0,Math.min(t,i-1)),o=Math.max(a,Math.min(n,i-1));if(r==null){if(a===0)return zW(e,o+1);let t=[],n=jW(e,a);for(let r=a;r<=o&&n!=null;r++){let r=BW(e,n);t.push(r),n=IW(e,n)}return t}let s=[],c=0,l=0,u=HV(r,`store.getVisibleSlice.selectFirstRow`,()=>jW(e,a));for(let t=a;t<=o&&u!=null;t++){let t=HV(r,`store.getVisibleSlice.materializeRow`,()=>BW(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=HV(r,`store.getVisibleSlice.advanceCursor`,()=>IW(e,u))}return UV(r,`workload.visibleRowsRead`,s.length),UV(r,`workload.flattenedRowsRead`,c),UV(r,`workload.flattenedSegmentsRead`,l),s}function EW(e,t=yW(e)){let n=e.instrumentation;return n==null?RW(e,t):HV(n,`store.getVisibleTreeProjection`,()=>RW(e,t))}function DW(e){return LW(EW(e))}function OW(e,t){let n=wU(e,t);if(n==null||n===e.snapshot.rootId||PV(DU(e,n))&&fU(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=DU(e,i).parentId,n=EU(e,t),s=vV(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=wV(a,n,s),t!==o){let n=DU(e,t),a=dU(e,t);if(!jH(e,t,n)&&a!==i)return null;fU(e,t)===t&&(r+=1)}i=t}return r}function kW(e,t){let n=wU(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=DU(e,n);if(!PV(r))throw Error(`Path is not a directory: "${t}"`);return jH(e,n,r)?null:(MH(e,n,!0,r),xU(e,n),GH({affectedAncestorIds:CU(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function AW(e,t){let n=wU(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=DU(e,n);if(!PV(r))throw Error(`Path is not a directory: "${t}"`);return jH(e,n,r)?(MH(e,n,!1,r),xU(e,n),KH({affectedAncestorIds:CU(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function jW(e,t){return t<0||t>=yW(e)?null:MW(e,e.snapshot.rootId,t,-1)}function MW(e,t,n,r){let i=EU(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?CV(e.snapshot.nodes,i,n):HV(a,`store.getVisibleSlice.selectChildIndex`,()=>CV(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return NW(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function NW(e,t,n,r){if(!PV(DU(e,t))){if(n===0)return{headNodeId:t,terminalNodeId:t,visibleDepth:r};throw Error(`Visible index ${String(n)} is out of range for file`)}let i=PW(e,t,r);if(n===0)return i;let a=DU(e,i.terminalNodeId);if(!PV(a)||!jH(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return MW(e,i.terminalNodeId,n-1,i.visibleDepth)}function PW(e,t,n){return PV(DU(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:fU(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:HV(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>fU(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function FW(e,t){let n=DU(e,t);if(!PV(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:dU(e,r)!==t}function IW(e,t){let n=DU(e,t.terminalNodeId);if(PV(n)){let r=EU(e,t.terminalNodeId);if(jH(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:NW(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=DU(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=EU(e,n),o=vV(a).get(r)??-1;if(o<0)throw Error(`Child ${String(r)} was not found in its parent index`);let s=a.childIds[o+1]??null;if(s!=null)return NW(e,s,0,i);FW(e,r)&&i--,r=n}}function LW(e){let t=e.paths.length,n=Array(t);for(let r=0;r<t;r+=1){let t=e.getParentIndex(r);n[r]={index:r,parentPath:t>=0?e.paths[t]??null:null,path:e.paths[r]??``,posInSet:e.posInSetByIndex[r]??0,setSize:e.setSizeByIndex[r]??0}}return{getParentIndex:e.getParentIndex,rows:n,get visibleIndexByPath(){return e.visibleIndexByPath}}}function RW(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(_W);o.fill(-1);let s=0,{nodes:c,directories:l,segmentTable:u}=e.snapshot,d=[[l.get(e.snapshot.rootId),0,-1,``]],f=e.snapshot.options.flattenEmptyDirectories,p=e.pathCacheByNodeId,m=e.pathCacheVersion,h=u.valueById;for(;d.length>0&&s<t;){let t=d[d.length-1],u=t[0];if(t[1]>=u.childIds.length){d.pop();continue}let g=t[1],_=u.childIds[t[1]++],v=c[_],y=t[2]+1,b=t[3];o=vW(o,y);let x,S=_;if(PV(v))S=f?fU(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:bU(e,S);else{let e=p.get(_);x=e!=null&&e.version===m?e.path:`${b}${h[v.nameId]}`}r[s]=o[y],n[s]=x,i[s]=g,a[s]=u.childIds.length,o[y+1]=s,s+=1;let C=c[S];C!=null&&PV(C)&&jH(e,S,C)&&d.push([l.get(S),0,y,x])}s<t&&(n.length=s);let g=r.subarray(0,s),_=i.subarray(0,s),v=a.subarray(0,s),y=null;return{getParentIndex(e){return e<0||e>=s?-1:g[e]??-1},paths:n,posInSetByIndex:_,setSizeByIndex:v,get visibleIndexByPath(){if(y==null){y=new Map;for(let e=0;e<s;e+=1)y.set(n[e]??``,e)}return y}}}function zW(e,t){let n=Array(t),r=0,{nodes:i,directories:a,segmentTable:o}=e.snapshot,s=[[a.get(e.snapshot.rootId),0,-1]],c=o.valueById,l=e.snapshot.options.flattenEmptyDirectories,u=e.pathCacheByNodeId,d=e.pathCacheVersion;for(;s.length>0&&r<t;){let t=s[s.length-1],o=t[0];if(t[1]>=o.childIds.length){s.pop();continue}let f=o.childIds[t[1]++],p=i[f],m=t[2]+1;if(!PV(p)){let t=u.get(f);n[r++]={depth:m,flattenedSegments:void 0,hasChildren:!1,id:f,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:`file`,loadState:void 0,name:c[p.nameId],path:t!=null&&t.version===d?t.path:bU(e,f)};continue}let h=l?fU(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=BW(e,g);let _=i[h];_!=null&&PV(_)&&jH(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function BW(e,t){let n=DU(e,t.terminalNodeId),r=PV(n)?VW(e,t):null,i=bU(e,t.terminalNodeId),a=lH(e.snapshot.segmentTable,n.nameId),o=PV(n)&&EU(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?pU(e,t.headNodeId).map(n=>{let r=DU(e,n);return{isTerminal:n===t.terminalNodeId,name:lH(e.snapshot.segmentTable,r.nameId),nodeId:n,path:bU(e,n)}}):HV(c,`store.getVisibleSlice.flatten.collectSegments`,()=>pU(e,t.headNodeId).map(n=>{let r=DU(e,n);return{isTerminal:n===t.terminalNodeId,name:lH(e.snapshot.segmentTable,r.nameId),nodeId:n,path:bU(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:PV(n)&&jH(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:PV(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function VW(e,t){if(t.headNodeId===t.terminalNodeId)return PH(e,t.terminalNodeId);let n=pU(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=PH(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function HW(e){let{directories:t,nodes:n,options:r,rootId:i,presortedDirectoryNodeIds:a}=e.snapshot,o=r.flattenEmptyDirectories===!0,s=e=>{let r=n[e];if(r==null||!PV(r))return;let i=t.get(e);if(i==null)throw Error(`Unknown directory child index for node ${String(e)}`);let a=i.childIds,s=a.length,c=0,l=0;for(let e=0;e<s;e++){let t=a[e];if(t==null)continue;let r=n[t];c+=r.subtreeNodeCount,l+=r.visibleSubtreeCount}i.totalChildSubtreeNodeCount=c,i.totalChildVisibleSubtreeCount=l,s>=128&&TV(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&PV(e)?l:1+l}else u=1+l;r.visibleSubtreeCount=u};if(a!=null)for(let e=a.length-1;e>=0;e--)s(a[e]);else for(let e=n.length-1;e>=1;e--)s(e);let c=n[i],l=t.get(i);if(c==null||l==null)return;let u=l.childIds,d=0,f=0;for(let e=0;e<u.length;e++){let t=u[e];if(t==null)continue;let r=n[t];d+=r.subtreeNodeCount,f+=r.visibleSubtreeCount}l.totalChildSubtreeNodeCount=d,l.totalChildVisibleSubtreeCount=f,TV(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function UW(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var WW=class e{#e;constructor(e={}){let t=VV(e),n=HV(t,`store.builder.create`,()=>new EH(e));if(e.preparedInput!=null){let t=CH(e.preparedInput);t==null?n.appendPreparedPaths(SH(e.preparedInput),!1):n.appendPresortedPaths(t,wH(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(HV(t,`store.preparePathEntries`,()=>TH(r,e)))}let r=HV(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=HV(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=HV(t,`store.state.create`,()=>DH(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:HV(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||UW(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&HV(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?HV(t,`store.state.initializeOpenVisibleCounts`,()=>HW(this.#e)):HV(t,`store.state.recomputeCounts`,()=>SU(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return yH(e,t)}static prepareInput(e,t={}){return bH(e,t)}static preparePresortedInput(e){return xH(e)}list(e){return HV(this.#e.instrumentation,`store.list`,()=>mU(this.#e,e))}add(e){HV(this.#e.instrumentation,`store.add`,()=>{let t=yW(this.#e);tU(this.#e,$H(this.#e,t,hU(this.#e,e)))})}remove(e,t={}){HV(this.#e.instrumentation,`store.remove`,()=>{let n=yW(this.#e);tU(this.#e,$H(this.#e,n,gU(this.#e,e,t)))})}move(e,t,n={}){HV(this.#e.instrumentation,`store.move`,()=>{let r=yW(this.#e),i=_U(this.#e,e,t,n);i!=null&&tU(this.#e,$H(this.#e,r,i))})}batch(e){eU(this.#e,()=>{if(typeof e==`function`){e(this);return}for(let t of e)switch(t.type){case`add`:this.add(t.path);break;case`remove`:this.remove(t.path,{recursive:t.recursive});break;case`move`:this.move(t.from,t.to,{collision:t.collision});break}})}getVisibleCount(){return HV(this.#e.instrumentation,`store.getVisibleCount`,()=>yW(this.#e))}getVisibleSlice(e,t){return HV(this.#e.instrumentation,`store.getVisibleSlice`,()=>TW(this.#e,e,t))}getVisibleRowContext(e){return HV(this.#e.instrumentation,`store.getVisibleRowContext`,()=>wW(this.#e,e))}getVisibleTreeProjection(){return DW(this.#e)}getVisibleTreeProjectionData(e){return EW(this.#e,e)}getVisibleIndex(e){return HV(this.#e.instrumentation,`store.getVisibleIndex`,()=>OW(this.#e,e))}getPathInfo(e){return HV(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=wU(this.#e,e);if(t==null)return null;let n=DU(this.#e,t);return{depth:MV(n),kind:PV(n)?`directory`:`file`,path:bU(this.#e,t)}})}isExpanded(e){return HV(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=DU(this.#e,t);return jH(this.#e,t,n)})}expand(e){HV(this.#e.instrumentation,`store.expand`,()=>{let t=yW(this.#e),n=kW(this.#e,e);n!=null&&tU(this.#e,$H(this.#e,t,n))})}collapse(e){HV(this.#e.instrumentation,`store.collapse`,()=>{let t=yW(this.#e),n=AW(this.#e,e);n!=null&&tU(this.#e,$H(this.#e,t,n))})}on(e,t){return VH(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return PH(this.#e,t)}markDirectoryUnloaded(e){HV(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(EU(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=yW(this.#e);IH(this.#e,t),tU(this.#e,$H(this.#e,n,qH({affectedAncestorIds:CU(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return HV(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=yW(this.#e),r=FH(this.#e,t);return tU(this.#e,$H(this.#e,n,JH({affectedAncestorIds:CU(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return HV(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||PH(this.#e,n)!==`loading`||!RH(this.#e,n,e.attemptId))return!1;let r=bU(this.#e,n);this.validateChildPatch(r,t);let i=yW(this.#e),a=[];for(let e of t.operations){GW(r,e);let t=yW(this.#e);switch(e.type){case`add`:a.push($H(this.#e,t,hU(this.#e,e.path)));break;case`remove`:a.push($H(this.#e,t,gU(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=_U(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push($H(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return tU(this.#e,$H(this.#e,i,YH({affectedAncestorIds:CU(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:bU(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return HV(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=yW(this.#e),r=LH(this.#e,t,e.attemptId);return tU(this.#e,$H(this.#e,n,XH({affectedAncestorIds:CU(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:bU(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return HV(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=yW(this.#e),i=zH(this.#e,n,e.attemptId,t);return tU(this.#e,$H(this.#e,r,ZH({affectedAncestorIds:CU(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:bU(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return HV(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(hW(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=yW(this.#e),n=gW(this.#e,e.mode??`stable`);return tU(this.#e,$H(this.#e,t,QH({...n,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:n.idsPreserved===!1}))),n})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(e){if(e==null||e.length===0)return 0;let t=0,n=[],r=[],i=0,a=null,o=this.#e.snapshot.segmentTable,s=o.valueById,c=this.#e.snapshot.nodes,l=new Map;for(let u of e){a!=null&&u<a&&(a=null,i=0,n.length=0,r.length=0);let e=u.length>0&&u.charCodeAt(u.length-1)===47?u.length-1:u.length;if(e===0){a=u,i=e,n.length=0,r.length=0;continue}let d=0,f=0;if(a!=null){let t=Math.min(e,i),n=!0;for(let e=0;e<t;e+=1){let t=u.charCodeAt(e);if(t!==a.charCodeAt(e)){n=!1;break}t===47&&(d+=1,f=e+1)}n&&(t===i&&e>t&&u.charCodeAt(t)===47?(d+=1,f=t+1):t===e&&i>t&&a.charCodeAt(t)===47&&(d+=1,f=e+1)),d=Math.min(d,r.length)}let p=d===0?this.#e.snapshot.rootId:r[d-1]??this.#e.snapshot.rootId,m=d,h=!0,g=f;for(;g<=e;){let t=u.indexOf(`/`,g),i=t===-1||t>e?e:t,a=u.slice(g,i),f=EU(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??KV(a);l.set(a,b);let x=(e,t)=>{for(v=e;v<t;v+=1){let e=f[v],t=c[e],n=s[t.nameId];if(n===a)return y=e,!0;let r=JV(tH(o,t.nameId),b);if(r>0||r===0&&n>a)return!1}return!1};if(!x(_,f.length)&&_>0&&x(0,_),y===void 0){h=!1;break}if(!PV(DU(this.#e,y))){h=!1;break}if(n[m]=v,r[m]=y,p=y,m+=1,i===e)break;g=i+1}if(a=u,i=e,n.length=m,r.length=m,!h){a=null,i=0,n.length=0,r.length=0;continue}for(let e=d;e<m;e+=1){let n=r[e];if(n==null)continue;let i=DU(this.#e,n);jH(this.#e,n,i)||(MH(this.#e,n,!0,i),t+=1)}}return t}hasAllDirectoriesExpanded(){for(let e of this.#e.snapshot.directories.keys()){if(e===this.#e.snapshot.rootId)continue;let t=DU(this.#e,e);if(!jH(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=wU(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!PV(DU(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!PV(DU(this.#e,e)))throw Error(`Node is not a directory: ${String(e)}`);return e}catch{return null}}isDirectoryProjectionVisible(e){let t=e;for(;t!==this.#e.snapshot.rootId;){let e=DU(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=DU(this.#e,e),r=dU(this.#e,e);if(!jH(this.#e,e,n)&&r!==t)return!1}t=e}return!0}validateChildPatch(t,n){new e({paths:this.list(t),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(n.operations)}};function GW(e,t){switch(t.type){case`add`:case`remove`:if(!t.path.startsWith(e)||t.path===e)throw Error(`Child patch operation must stay within ${e}: "${t.path}"`);break;case`move`:if(!t.from.startsWith(e)||!t.to.startsWith(e)||t.from===e||t.to===e)throw Error(`Child patch move must stay within ${e}: "${t.from}" -> "${t.to}"`);break}}var KW={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function qW(e,t){if(typeof e==`number`)return{itemHeight:t??KW.default.itemHeight,factor:e};let n=KW[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var JW=KW.default.itemHeight,YW=`@layer base, theme, unsafe;
181
+
182
+ @layer base {
183
+ :host {
184
+ /*
185
+ CSS variables use a fallback stack to ensure user and theme colors slot
186
+ in with ease. User colors take precedence over theme colors, which take
187
+ precedence over defaults.
188
+
189
+ Fallback order:
190
+
191
+ 1. --trees-*-override (explicit)
192
+ 2. --trees-theme-* (e.g. Shiki/VS Code tokens)
193
+ 3. defaults
194
+
195
+ Theme variable names mirror Shiki/VS Code theme file JSON tokens.
196
+
197
+ // Available CSS Color Overrides
198
+ --trees-fg-override
199
+ --trees-fg-muted-override
200
+ --trees-bg-override
201
+ --trees-bg-muted-override
202
+ --trees-accent-override
203
+ --trees-border-color-override
204
+
205
+ --trees-focus-ring-color-override
206
+ --trees-focus-ring-width-override
207
+ --trees-focus-ring-offset-override
208
+
209
+ --trees-search-fg-override
210
+ --trees-search-font-weight-override
211
+ --trees-search-bg-override
212
+
213
+ --trees-selected-fg-override
214
+ --trees-selected-bg-override
215
+ --trees-selected-focused-border-color-override
216
+
217
+ // Git Status Color Overrides
218
+ --trees-status-added-override
219
+ --trees-status-ignored-override
220
+ --trees-status-modified-override
221
+ --trees-status-renamed-override
222
+ --trees-status-untracked-override
223
+ --trees-status-deleted-override
224
+ --trees-git-added-color-override
225
+ --trees-git-ignored-color-override
226
+ --trees-git-modified-color-override
227
+ --trees-git-renamed-color-override
228
+ --trees-git-untracked-color-override
229
+ --trees-git-deleted-color-override
230
+
231
+ // Built-in File Icon Color Overrides
232
+ --trees-file-icon-color
233
+ --trees-file-icon-color-astro
234
+ --trees-file-icon-color-babel
235
+ --trees-file-icon-color-bash
236
+ --trees-file-icon-color-biome
237
+ --trees-file-icon-color-bootstrap
238
+ --trees-file-icon-color-browserslist
239
+ --trees-file-icon-color-bun
240
+ --trees-file-icon-color-c
241
+ --trees-file-icon-color-cpp
242
+ --trees-file-icon-color-claude
243
+ --trees-file-icon-color-css
244
+ --trees-file-icon-color-database
245
+ --trees-file-icon-color-default
246
+ --trees-file-icon-color-docker
247
+ --trees-file-icon-color-eslint
248
+ --trees-file-icon-color-git
249
+ --trees-file-icon-color-go
250
+ --trees-file-icon-color-graphql
251
+ --trees-file-icon-color-html
252
+ --trees-file-icon-color-image
253
+ --trees-file-icon-color-javascript
254
+ --trees-file-icon-color-json
255
+ --trees-file-icon-color-markdown
256
+ --trees-file-icon-color-mcp
257
+ --trees-file-icon-color-npm
258
+ --trees-file-icon-color-oxc
259
+ --trees-file-icon-color-postcss
260
+ --trees-file-icon-color-prettier
261
+ --trees-file-icon-color-python
262
+ --trees-file-icon-color-react
263
+ --trees-file-icon-color-ruby
264
+ --trees-file-icon-color-rust
265
+ --trees-file-icon-color-sass
266
+ --trees-file-icon-color-svg
267
+ --trees-file-icon-color-svelte
268
+ --trees-file-icon-color-svgo
269
+ --trees-file-icon-color-swift
270
+ --trees-file-icon-color-table
271
+ --trees-file-icon-color-text
272
+ --trees-file-icon-color-tailwind
273
+ --trees-file-icon-color-terraform
274
+ --trees-file-icon-color-typescript
275
+ --trees-file-icon-color-vite
276
+ --trees-file-icon-color-vscode
277
+ --trees-file-icon-color-vue
278
+ --trees-file-icon-color-wasm
279
+ --trees-file-icon-color-webpack
280
+ --trees-file-icon-color-yml
281
+ --trees-file-icon-color-zig
282
+ --trees-file-icon-color-zip
283
+
284
+ // Density
285
+ //
286
+ // A unitless scale factor for padding, gaps, and indentation. Usually
287
+ // set via \`density\` on useFileTree. Individual overrides take precedence.
288
+ //
289
+ // Compact: 0.8
290
+ // Default: 1
291
+ // Relaxed: 1.2
292
+ //
293
+ --trees-density-override
294
+
295
+ // Available CSS Layout Overrides
296
+ --trees-gap-override
297
+ --trees-border-radius-override
298
+ --trees-font-family-override
299
+ --trees-font-size-override
300
+ --trees-font-weight-regular-override
301
+ --trees-font-weight-semibold-override
302
+ --trees-level-gap-override
303
+ --trees-item-padding-x-override
304
+ --trees-item-margin-x-override
305
+ --trees-item-row-gap-override
306
+ --trees-icon-width-override
307
+ --trees-icon-nudge-override
308
+ --trees-scrollbar-gutter-override
309
+ --trees-padding-inline-override
310
+ */
311
+
312
+ --trees-accent: var(--trees-accent-override, #009fff);
313
+ --trees-fg: var(
314
+ --trees-fg-override,
315
+ var(--trees-theme-sidebar-fg, light-dark(#6c6c71, #adadb1))
316
+ );
317
+ --trees-fg-muted: var(
318
+ --trees-fg-muted-override,
319
+ var(--trees-theme-sidebar-header-fg, light-dark(#84848a, #84848a))
320
+ );
321
+ --trees-bg: var(
322
+ --trees-bg-override,
323
+ var(--trees-theme-sidebar-bg, light-dark(#f8f8f8, #141415))
324
+ );
325
+ /* var(--trees-theme-list-hover-bg, light-dark(#dfebff59, #19283c59)) */
326
+ --trees-bg-muted: var(
327
+ --trees-bg-muted-override,
328
+ var(
329
+ --trees-theme-list-hover-bg,
330
+ light-dark(
331
+ color-mix(
332
+ in lab,
333
+ var(--trees-accent) var(--trees-bg-alpha-light, 8%),
334
+ var(--trees-bg)
335
+ ),
336
+ color-mix(
337
+ in lab,
338
+ var(--trees-accent) var(--trees-bg-alpha-dark, 10%),
339
+ var(--trees-bg)
340
+ )
341
+ )
342
+ )
343
+ );
344
+ --trees-input-bg: var(
345
+ --trees-input-bg-override,
346
+ light-dark(#f8f8f8, #070707)
347
+ );
348
+
349
+ --trees-added-light: #16a994;
350
+ --trees-added-dark: #00cab1;
351
+ --trees-ignored-light: #adadb1;
352
+ --trees-ignored-dark: #4a4a4e;
353
+ --trees-modified-light: #1ca1c7;
354
+ --trees-modified-dark: #08c0ef;
355
+ --trees-renamed-light: #d5a910;
356
+ --trees-renamed-dark: #ffd452;
357
+ --trees-untracked-light: #16a994;
358
+ --trees-untracked-dark: #00cab1;
359
+ --trees-deleted-light: #ff2e3f;
360
+ --trees-deleted-dark: #ff6762;
361
+
362
+ --trees-border-color: var(
363
+ --trees-border-color-override,
364
+ var(--trees-theme-sidebar-border, light-dark(#eeeeef, #070707))
365
+ );
366
+ --trees-indent-guide-bg: var(
367
+ --trees-indent-guide-bg-override,
368
+ color-mix(in lab, var(--trees-fg-muted) 25%, transparent)
369
+ );
370
+ --trees-density: var(--trees-density-override, 1);
371
+ --trees-border-radius: var(
372
+ --trees-border-radius-override,
373
+ calc(6px * var(--trees-density))
374
+ );
375
+
376
+ --trees-font-family: var(--trees-font-family-override, system-ui);
377
+ --trees-font-size: var(--trees-font-size-override, 13px);
378
+ --trees-font-weight-regular: var(--trees-font-weight-regular-override, 400);
379
+ --trees-font-weight-semibold: var(
380
+ --trees-font-weight-semibold-override,
381
+ 600
382
+ );
383
+
384
+ --trees-focus-ring-color: var(
385
+ --trees-focus-ring-color-override,
386
+ var(--trees-theme-focus-ring, var(--trees-accent))
387
+ );
388
+ --trees-focus-ring-width: var(--trees-focus-ring-width-override, 1px);
389
+ --trees-focus-ring-offset: var(--trees-focus-ring-offset-override, -1px);
390
+
391
+ --trees-search-fg: var(
392
+ --trees-search-fg-override,
393
+ var(--trees-theme-input-fg, var(--trees-fg))
394
+ );
395
+ --trees-search-font-weight: var(--trees-search-font-weight-override, 600);
396
+ --trees-search-bg: var(
397
+ --trees-search-bg-override,
398
+ var(--trees-theme-input-bg, var(--trees-input-bg))
399
+ );
400
+
401
+ --trees-scrollbar-thumb: var(
402
+ --trees-scrollbar-thumb-override,
403
+ var(
404
+ --trees-theme-scrollbar-thumb,
405
+ color-mix(in lab, var(--trees-fg) 25%, var(--trees-bg))
406
+ )
407
+ );
408
+
409
+ --trees-selected-fg: var(
410
+ --trees-selected-fg-override,
411
+ var(--trees-theme-list-active-selection-fg, var(--trees-fg))
412
+ );
413
+ --trees-selected-bg: var(
414
+ --trees-selected-bg-override,
415
+ var(
416
+ --trees-theme-list-active-selection-bg,
417
+ light-dark(
418
+ color-mix(in lab, var(--trees-accent) 12%, var(--trees-bg)),
419
+ color-mix(in lab, var(--trees-accent) 15%, var(--trees-bg))
420
+ )
421
+ )
422
+ );
423
+ --trees-selected-focused-border-color: var(
424
+ --trees-selected-focused-border-color-override,
425
+ var(--trees-theme-focus-ring, var(--trees-accent))
426
+ );
427
+
428
+ /* Git status (e.g. from Shiki theme gitDecoration.*) */
429
+ --trees-status-added: var(
430
+ --trees-status-added-override,
431
+ var(
432
+ --trees-theme-git-added-fg,
433
+ light-dark(var(--trees-added-light), var(--trees-added-dark))
434
+ )
435
+ );
436
+ --trees-status-ignored: var(
437
+ --trees-status-ignored-override,
438
+ var(
439
+ --trees-theme-git-ignored-fg,
440
+ light-dark(var(--trees-ignored-light), var(--trees-ignored-dark))
441
+ )
442
+ );
443
+ --trees-status-modified: var(
444
+ --trees-status-modified-override,
445
+ var(
446
+ --trees-theme-git-modified-fg,
447
+ light-dark(var(--trees-modified-light), var(--trees-modified-dark))
448
+ )
449
+ );
450
+ --trees-status-renamed: var(
451
+ --trees-status-renamed-override,
452
+ var(
453
+ --trees-theme-git-renamed-fg,
454
+ light-dark(var(--trees-renamed-light), var(--trees-renamed-dark))
455
+ )
456
+ );
457
+ --trees-status-untracked: var(
458
+ --trees-status-untracked-override,
459
+ var(
460
+ --trees-theme-git-untracked-fg,
461
+ light-dark(var(--trees-untracked-light), var(--trees-untracked-dark))
462
+ )
463
+ );
464
+ --trees-status-deleted: var(
465
+ --trees-status-deleted-override,
466
+ var(
467
+ --trees-theme-git-deleted-fg,
468
+ light-dark(var(--trees-deleted-light), var(--trees-deleted-dark))
469
+ )
470
+ );
471
+ --trees-git-modified-color: var(
472
+ --trees-git-modified-color-override,
473
+ var(--trees-status-modified)
474
+ );
475
+ --trees-git-added-color: var(
476
+ --trees-git-added-color-override,
477
+ var(--trees-status-added)
478
+ );
479
+ --trees-git-ignored-color: var(
480
+ --trees-git-ignored-color-override,
481
+ var(--trees-status-ignored)
482
+ );
483
+ --trees-git-deleted-color: var(
484
+ --trees-git-deleted-color-override,
485
+ var(--trees-status-deleted)
486
+ );
487
+ --trees-git-renamed-color: var(
488
+ --trees-git-renamed-color-override,
489
+ var(--trees-status-renamed)
490
+ );
491
+ --trees-git-untracked-color: var(
492
+ --trees-git-untracked-color-override,
493
+ var(--trees-status-untracked)
494
+ );
495
+
496
+ --trees-icon-gray: light-dark(#84848a, #adadb1);
497
+ --trees-icon-red: light-dark(#d52c36, #ff6762);
498
+ --trees-icon-vermilion: light-dark(#ff8c5b, #d5512f);
499
+ --trees-icon-orange: light-dark(#d47628, #ffa359);
500
+ --trees-icon-yellow: light-dark(#d5a910, #ffd452);
501
+ --trees-icon-green: light-dark(#199f43, #5ecc71);
502
+ --trees-icon-teal: light-dark(#17a5af, #64d1db);
503
+ --trees-icon-cyan: light-dark(#1ca1c7, #68cdf2);
504
+ --trees-icon-blue: light-dark(#1a85d4, #69b1ff);
505
+ --trees-icon-indigo: light-dark(#693acf, #9d6afb);
506
+ --trees-icon-purple: light-dark(#a631be, #d568ea);
507
+ --trees-icon-pink: light-dark(#d32a61, #ff678d);
508
+ --trees-icon-mauve: light-dark(#594c5b, #79697b);
509
+
510
+ --trees-file-icon-color-default: var(
511
+ --trees-file-icon-color,
512
+ var(--trees-icon-gray)
513
+ );
514
+ --trees-file-icon-color-astro: var(
515
+ --trees-file-icon-color,
516
+ var(--trees-icon-purple)
517
+ );
518
+ --trees-file-icon-color-babel: var(
519
+ --trees-file-icon-color,
520
+ var(--trees-icon-yellow)
521
+ );
522
+ --trees-file-icon-color-bash: var(
523
+ --trees-file-icon-color,
524
+ var(--trees-icon-green)
525
+ );
526
+ --trees-file-icon-color-biome: var(
527
+ --trees-file-icon-color,
528
+ var(--trees-icon-blue)
529
+ );
530
+ --trees-file-icon-color-bootstrap: var(
531
+ --trees-file-icon-color,
532
+ var(--trees-icon-indigo)
533
+ );
534
+ --trees-file-icon-color-browserslist: var(
535
+ --trees-file-icon-color,
536
+ var(--trees-icon-yellow)
537
+ );
538
+ --trees-file-icon-color-bun: var(
539
+ --trees-file-icon-color,
540
+ var(--trees-icon-mauve)
541
+ );
542
+ --trees-file-icon-color-c: var(
543
+ --trees-file-icon-color,
544
+ var(--trees-icon-blue)
545
+ );
546
+ --trees-file-icon-color-cpp: var(
547
+ --trees-file-icon-color,
548
+ var(--trees-icon-blue)
549
+ );
550
+ --trees-file-icon-color-claude: var(
551
+ --trees-file-icon-color,
552
+ var(--trees-icon-orange)
553
+ );
554
+ --trees-file-icon-color-css: var(
555
+ --trees-file-icon-color,
556
+ var(--trees-icon-indigo)
557
+ );
558
+ --trees-file-icon-color-database: var(
559
+ --trees-file-icon-color,
560
+ var(--trees-icon-purple)
561
+ );
562
+ --trees-file-icon-color-docker: var(
563
+ --trees-file-icon-color,
564
+ var(--trees-icon-blue)
565
+ );
566
+ --trees-file-icon-color-eslint: var(
567
+ --trees-file-icon-color,
568
+ var(--trees-icon-indigo)
569
+ );
570
+ --trees-file-icon-color-git: var(
571
+ --trees-file-icon-vermilion,
572
+ var(--trees-icon-vermilion)
573
+ );
574
+ --trees-file-icon-color-go: var(
575
+ --trees-file-icon-color,
576
+ var(--trees-icon-cyan)
577
+ );
578
+ --trees-file-icon-color-graphql: var(
579
+ --trees-file-icon-color,
580
+ var(--trees-icon-pink)
581
+ );
582
+ --trees-file-icon-color-html: var(
583
+ --trees-file-icon-color,
584
+ var(--trees-icon-orange)
585
+ );
586
+ --trees-file-icon-color-image: var(
587
+ --trees-file-icon-color,
588
+ var(--trees-icon-pink)
589
+ );
590
+ --trees-file-icon-color-javascript: var(
591
+ --trees-file-icon-color,
592
+ var(--trees-icon-yellow)
593
+ );
594
+ --trees-file-icon-color-json: var(
595
+ --trees-file-icon-color,
596
+ var(--trees-icon-orange)
597
+ );
598
+ --trees-file-icon-color-markdown: var(
599
+ --trees-file-icon-color,
600
+ var(--trees-icon-green)
601
+ );
602
+ --trees-file-icon-color-mcp: var(
603
+ --trees-file-icon-color,
604
+ var(--trees-icon-teal)
605
+ );
606
+ --trees-file-icon-color-npm: var(
607
+ --trees-file-icon-color,
608
+ var(--trees-icon-red)
609
+ );
610
+ --trees-file-icon-color-oxc: var(
611
+ --trees-file-icon-cyan,
612
+ var(--trees-icon-cyan)
613
+ );
614
+ --trees-file-icon-color-postcss: var(
615
+ --trees-file-icon-color,
616
+ var(--trees-icon-red)
617
+ );
618
+ --trees-file-icon-color-prettier: var(
619
+ --trees-file-icon-color,
620
+ var(--trees-icon-teal)
621
+ );
622
+ --trees-file-icon-color-python: var(
623
+ --trees-file-icon-color,
624
+ var(--trees-icon-blue)
625
+ );
626
+ --trees-file-icon-color-react: var(
627
+ --trees-file-icon-color,
628
+ var(--trees-icon-cyan)
629
+ );
630
+ --trees-file-icon-color-ruby: var(
631
+ --trees-file-icon-color,
632
+ var(--trees-icon-red)
633
+ );
634
+ --trees-file-icon-color-rust: var(
635
+ --trees-file-icon-color,
636
+ var(--trees-icon-orange)
637
+ );
638
+ --trees-file-icon-color-sass: var(
639
+ --trees-file-icon-color,
640
+ var(--trees-icon-pink)
641
+ );
642
+ --trees-file-icon-color-svg: var(
643
+ --trees-file-icon-color,
644
+ var(--trees-icon-orange)
645
+ );
646
+ --trees-file-icon-color-svelte: var(
647
+ --trees-file-icon-color,
648
+ var(--trees-icon-red)
649
+ );
650
+ --trees-file-icon-color-svgo: var(
651
+ --trees-file-icon-color,
652
+ var(--trees-icon-green)
653
+ );
654
+ --trees-file-icon-color-swift: var(
655
+ --trees-file-icon-color,
656
+ var(--trees-icon-orange)
657
+ );
658
+ --trees-file-icon-color-table: var(
659
+ --trees-file-icon-color,
660
+ var(--trees-icon-teal)
661
+ );
662
+ --trees-file-icon-color-text: var(
663
+ --trees-file-icon-color,
664
+ var(--trees-icon-gray)
665
+ );
666
+ --trees-file-icon-color-tailwind: var(
667
+ --trees-file-icon-color,
668
+ var(--trees-icon-cyan)
669
+ );
670
+ --trees-file-icon-color-terraform: var(
671
+ --trees-file-icon-color,
672
+ var(--trees-icon-indigo)
673
+ );
674
+ --trees-file-icon-color-typescript: var(
675
+ --trees-file-icon-color,
676
+ var(--trees-icon-blue)
677
+ );
678
+ --trees-file-icon-color-vite: var(
679
+ --trees-file-icon-color,
680
+ var(--trees-icon-purple)
681
+ );
682
+ --trees-file-icon-color-vscode: var(
683
+ --trees-file-icon-color,
684
+ var(--trees-icon-blue)
685
+ );
686
+ --trees-file-icon-color-vue: var(
687
+ --trees-file-icon-color,
688
+ var(--trees-icon-green)
689
+ );
690
+ --trees-file-icon-color-wasm: var(
691
+ --trees-file-icon-color,
692
+ var(--trees-icon-indigo)
693
+ );
694
+ --trees-file-icon-color-webpack: var(
695
+ --trees-file-icon-color,
696
+ var(--trees-icon-blue)
697
+ );
698
+ --trees-file-icon-color-yml: var(
699
+ --trees-file-icon-color,
700
+ var(--trees-icon-red)
701
+ );
702
+ --trees-file-icon-color-zig: var(
703
+ --trees-file-icon-color,
704
+ var(--trees-icon-orange)
705
+ );
706
+ --trees-file-icon-color-zip: var(
707
+ --trees-file-icon-color,
708
+ var(--trees-icon-orange)
709
+ );
710
+
711
+ --trees-level-gap: var(
712
+ --trees-level-gap-override,
713
+ calc(8px * var(--trees-density))
714
+ );
715
+ --trees-item-padding-x: var(
716
+ --trees-item-padding-x-override,
717
+ calc(8px * var(--trees-density))
718
+ );
719
+ --trees-item-margin-x: var(
720
+ --trees-item-margin-x-override,
721
+ calc(2px * var(--trees-density))
722
+ );
723
+ --trees-item-row-gap: var(
724
+ --trees-item-row-gap-override,
725
+ calc(6px * var(--trees-density))
726
+ );
727
+ --trees-icon-width: var(--trees-icon-width-override, 16px);
728
+ --trees-icon-nudge: var(
729
+ --trees-icon-nudge-override,
730
+ calc(1px * var(--trees-density))
731
+ );
732
+ --trees-row-height: var(--trees-item-height, 30px);
733
+ --trees-git-lane-width: var(--trees-git-lane-width-override, 12px);
734
+ --trees-action-lane-width: var(
735
+ --trees-action-lane-width-override,
736
+ calc(var(--trees-icon-width) + 2px)
737
+ );
738
+ /* Keep the floating trigger aligned with the row's action lane. Going in
739
+ from the root's right edge: the scroll container reserves
740
+ \`--trees-padding-inline\` of effective inset on each side (its asymmetric
741
+ padding formula cancels the scrollbar gutter on the right), the row
742
+ sits inside that inset, and its trailing \`--trees-item-padding-x\` is the
743
+ action lane itself. The trigger's own focus-ring margin then trims one
744
+ pixel back so the button's visible right edge lines up with the lane. */
745
+ --trees-context-menu-trigger-inline-offset: calc(
746
+ var(--trees-padding-inline) + var(--trees-item-padding-x) -
747
+ var(--trees-focus-ring-width)
748
+ );
749
+
750
+ --trees-scrollbar-gutter: var(--trees-scrollbar-gutter-override, 6px);
751
+ --trees-padding-inline: var(--trees-padding-inline-override, 16px);
752
+
753
+ color-scheme: light dark;
754
+ display: flex;
755
+ flex-direction: column;
756
+ font-size: var(--trees-font-size);
757
+ color: var(--trees-fg);
758
+ background-color: var(--trees-bg);
759
+ --truncate-marker-background-color: var(--trees-bg);
760
+ --truncate-marker-background-overlay-color: transparent;
761
+ font-family: var(--trees-font-family);
762
+ font-weight: var(--trees-font-weight-regular);
763
+ }
764
+
765
+ :host([data-file-tree-virtualized='true']) {
766
+ height: 100%;
767
+ overflow: hidden;
768
+ }
769
+
770
+ [data-file-tree-virtualized-wrapper='true'] {
771
+ height: 100%;
772
+ overflow: hidden;
773
+ display: flex;
774
+ flex-direction: column;
775
+ }
776
+
777
+ [data-file-tree-virtualized-root='true'] {
778
+ height: 100%;
779
+ display: flex;
780
+ flex-direction: column;
781
+ overflow: hidden;
782
+ }
783
+
784
+ [data-file-tree-virtualized-scroll='true'],
785
+ [data-file-tree-scrollbar-measure='true'] {
786
+ --trees-scrollbar-thumb-current: transparent;
787
+ overflow-y: auto;
788
+ scrollbar-gutter: stable;
789
+
790
+ &:hover {
791
+ --trees-scrollbar-thumb-current: var(--trees-scrollbar-thumb);
792
+ }
793
+
794
+ &::-webkit-scrollbar {
795
+ width: var(--trees-scrollbar-gutter);
796
+ height: var(--trees-scrollbar-gutter);
797
+ }
798
+
799
+ &::-webkit-scrollbar-track {
800
+ background: transparent;
801
+ }
802
+
803
+ &::-webkit-scrollbar-thumb {
804
+ background-color: var(--trees-scrollbar-thumb-current);
805
+ border: 1px solid transparent;
806
+ background-clip: content-box;
807
+ border-radius: calc(var(--trees-scrollbar-gutter) / 2);
808
+ }
809
+
810
+ &::-webkit-scrollbar-corner {
811
+ background-color: transparent;
812
+ }
813
+ }
814
+
815
+ /* These are styles for a temporarily generated element to measure the size
816
+ * of the scrollbar. It's intended to be somewhat similar in scrollbar style
817
+ * scope to the scrollable tree so \`--trees-scrollbar-gutter-measured\` is an
818
+ * accurate reflection of the size the scrollbar gutter takes up. */
819
+ [data-file-tree-scrollbar-measure='true'] {
820
+ position: absolute;
821
+ top: 0;
822
+ left: 0;
823
+ visibility: hidden;
824
+ pointer-events: none;
825
+ width: 100px;
826
+ height: 100px;
827
+ }
828
+
829
+ @supports (-moz-appearance: none) {
830
+ [data-file-tree-virtualized-scroll='true'],
831
+ [data-file-tree-scrollbar-measure='true'] {
832
+ scrollbar-width: thin;
833
+ scrollbar-color: var(--trees-scrollbar-thumb-current) transparent;
834
+ }
835
+ }
836
+
837
+ [data-file-tree-virtualized-scroll='true'] {
838
+ position: relative;
839
+ overflow-y: auto;
840
+ flex: 1 1 0;
841
+ min-height: 0;
842
+ padding-inline: max(
843
+ calc(var(--trees-padding-inline) - var(--trees-item-margin-x)),
844
+ 0px
845
+ )
846
+ /* NOTE(amadeus): We can assume that all Webkit based browser gutters
847
+ * will align to the value of '--trees-scrollbar-gutter', however if not, then
848
+ * \`--trees-scrollbar-gutter-measured\` should correct it. Mostly we are
849
+ * hoping to avoid SSR alignment jumps if possible. In non-SSR'd environments
850
+ * \`--trees-scrollbar-gutter-measured\` should always be immediately available.
851
+ */
852
+ max(
853
+ calc(
854
+ var(--trees-padding-inline) - var(--trees-item-margin-x) -
855
+ var(
856
+ --trees-scrollbar-gutter-measured,
857
+ var(--trees-scrollbar-gutter)
858
+ )
859
+ ),
860
+ 0px
861
+ );
862
+ }
863
+
864
+ @supports (-moz-appearance: none) {
865
+ [data-file-tree-virtualized-scroll='true'] {
866
+ padding-inline: max(
867
+ calc(var(--trees-padding-inline) - var(--trees-item-margin-x)),
868
+ 0px
869
+ )
870
+ /* NOTE(amadeus): However on Firefox it can vary a little bit, but most
871
+ * likely the majority of cases will default to a 0px width scrollbar lets
872
+ * inherit that first to avoid SSR jumps. In non-SSR'd environments
873
+ * \`--trees-scrollbar-gutter-measured\` should always be immediately available.
874
+ */
875
+ max(
876
+ calc(
877
+ var(--trees-padding-inline) - var(--trees-item-margin-x) -
878
+ var(--trees-scrollbar-gutter-measured, 0px)
879
+ ),
880
+ 0px
881
+ );
882
+ }
883
+ }
884
+
885
+ [data-file-tree-sticky-overlay='true'] {
886
+ position: sticky;
887
+ top: 0;
888
+ height: 0;
889
+ z-index: 4;
890
+ overflow: visible;
891
+ pointer-events: none;
892
+ }
893
+
894
+ /* The overlay DOM is kept populated even at scrollTop=0 so the browser has
895
+ * the rendered rows on hand the moment scrolling begins — otherwise the
896
+ * compositor paints a scrolled frame before React can mount the overlay,
897
+ * and the topmost sticky folder jumps up by a couple of pixels before it
898
+ * "snaps" into its pinned position. We hide it via CSS whenever the scroll
899
+ * is at the top and no scroll is in progress, so the preview doesn't leak
900
+ * through at rest. \`data-overlay-reveal\` is stamped on the root only when
901
+ * the user initiates a scroll while already at the top — exactly the case
902
+ * where we need the pre-mounted overlay to be visible through the first
903
+ * compositor frame. It is deliberately distinct from the general
904
+ * \`data-is-scrolling\` flag so a scroll that ends at the top (e.g. ArrowUp
905
+ * navigation) re-hides the overlay the instant the scroll lands, rather
906
+ * than waiting for the hover-suppression timer to elapse. */
907
+ [data-file-tree-virtualized-root='true'][data-scroll-at-top='true']:not(
908
+ [data-overlay-reveal]
909
+ )
910
+ [data-file-tree-sticky-overlay='true'] {
911
+ visibility: hidden;
912
+ }
913
+
914
+ [data-file-tree-sticky-overlay-content='true'] {
915
+ background-color: var(--trees-bg);
916
+ position: relative;
917
+ pointer-events: none;
918
+ }
919
+
920
+ [data-file-tree-virtualized-list='true'] {
921
+ background-color: var(--trees-bg);
922
+ position: relative;
923
+ min-height: 100%;
924
+ width: 100%;
925
+ overflow-anchor: none;
926
+
927
+ &[data-is-scrolling] {
928
+ pointer-events: none;
929
+ }
930
+ }
931
+
932
+ [data-file-tree-virtualized-sticky-offset='true'] {
933
+ contain: layout size;
934
+ }
935
+
936
+ [data-file-tree-virtualized-sticky='true'] {
937
+ position: sticky;
938
+ top: 0;
939
+ width: 100%;
940
+ display: flex;
941
+ flex-direction: column;
942
+ isolation: isolate;
943
+ /* Promote to its own compositor layer so text inside the window is
944
+ * rasterized once and GPU-translated during scroll. Without this, the
945
+ * browser re-paints the window (and its text) at every scroll frame,
946
+ * which produces visible 1px shake / character tearing. */
947
+ will-change: transform;
948
+ }
949
+
950
+ [data-file-tree-search-container] {
951
+ display: flex;
952
+ padding: 0;
953
+ padding-inline: var(--trees-padding-inline);
954
+ margin-bottom: var(--trees-item-row-gap);
955
+ }
956
+
957
+ [data-file-tree-search-input] {
958
+ --trees-focus-ring-width: 2px;
959
+ font-family: var(--trees-font-family);
960
+ font-size: var(--trees-font-size);
961
+ flex: 1;
962
+ height: var(--trees-row-height);
963
+ /* 1px breathing room so the focus-visible outline isn't clipped when the
964
+ * input sits flush against the top of the scroll container. */
965
+ margin-block: 1px;
966
+ padding-inline: var(--trees-item-padding-x);
967
+ line-height: var(--trees-row-height);
968
+ color: var(--trees-search-fg);
969
+ background-color: var(--trees-search-bg);
970
+ border: 1px solid var(--trees-border-color);
971
+ border-radius: var(--trees-border-radius);
972
+ outline: none;
973
+
974
+ &::placeholder {
975
+ color: color-mix(
976
+ in lab,
977
+ var(--trees-search-fg) 65%,
978
+ var(--trees-search-bg)
979
+ );
980
+ }
981
+
982
+ &:focus-visible,
983
+ &[data-file-tree-search-input-fake-focus='true'] {
984
+ outline: var(--trees-focus-ring-width) solid var(--trees-focus-ring-color);
985
+ outline-offset: var(--trees-focus-ring-offset);
986
+ }
987
+ }
988
+
989
+ /* The wrapper for the tree items */
990
+ [role='tree'] {
991
+ position: relative;
992
+ display: flex;
993
+ flex-direction: column;
994
+ gap: var(--trees-gap-override, 0);
995
+ }
996
+
997
+ /* LIST ITEM */
998
+ [data-type='item'] {
999
+ color: inherit;
1000
+ font-family: var(--trees-font-family);
1001
+ font-size: var(--trees-font-size);
1002
+ text-align: start;
1003
+ outline: none;
1004
+ background-color: var(--trees-bg);
1005
+ border: none;
1006
+ position: relative;
1007
+
1008
+ padding: 0 var(--trees-item-padding-x);
1009
+ margin: 0 var(--trees-item-margin-x);
1010
+ cursor: pointer;
1011
+ -webkit-user-select: none;
1012
+ user-select: none;
1013
+ -webkit-touch-callout: none;
1014
+ touch-action: manipulation;
1015
+ display: flex;
1016
+ flex: 0 0 var(--trees-row-height);
1017
+ align-items: center;
1018
+ height: var(--trees-row-height);
1019
+ line-height: var(--trees-row-height);
1020
+ gap: var(--trees-item-row-gap);
1021
+ border-radius: var(--trees-border-radius);
1022
+ /* Row states may be translucent, so markers paint the tree background first
1023
+ * and then the state color on top to avoid compositing the same alpha twice. */
1024
+ --truncate-marker-background-color: var(--trees-bg);
1025
+ --truncate-marker-background-overlay-color: transparent;
1026
+ --truncate-marker-block-inset: 0px;
1027
+
1028
+ &:hover,
1029
+ &[data-item-context-hover='true'] {
1030
+ background-color: var(--trees-bg-muted);
1031
+ --truncate-marker-background-overlay-color: var(--trees-bg-muted);
1032
+ }
1033
+
1034
+ &[data-item-focused='true'],
1035
+ &:focus-visible {
1036
+ z-index: 2;
1037
+
1038
+ /* Flattened segment markers sit high enough to cover the row outline unless
1039
+ * their painted background is inset by the focus ring width. */
1040
+ [data-item-flattened-subitems] {
1041
+ --truncate-marker-block-inset: var(--trees-focus-ring-width);
1042
+ }
1043
+
1044
+ &::before {
1045
+ position: absolute;
1046
+ inset: 0;
1047
+ content: '';
1048
+ display: block;
1049
+ border-radius: var(--trees-border-radius);
1050
+ outline: var(--trees-focus-ring-width) solid
1051
+ var(--trees-focus-ring-color);
1052
+ outline-offset: var(--trees-focus-ring-offset);
1053
+ pointer-events: none;
1054
+ }
1055
+
1056
+ &[data-item-selected='true']::before {
1057
+ outline-color: var(--trees-selected-focused-border-color);
1058
+ }
1059
+ }
1060
+
1061
+ &[data-item-selected='true'] {
1062
+ color: var(--trees-selected-fg);
1063
+ background-color: var(--trees-selected-bg);
1064
+ --truncate-marker-background-overlay-color: var(--trees-selected-bg);
1065
+ z-index: 3;
1066
+
1067
+ [data-item-section='icon'] {
1068
+ color: var(--trees-selected-fg);
1069
+ }
1070
+ }
1071
+
1072
+ &[data-item-search-match='true'] {
1073
+ font-weight: var(--trees-search-font-weight);
1074
+ }
1075
+ }
1076
+
1077
+ [data-type='item'][data-file-tree-sticky-row='true'] {
1078
+ pointer-events: auto;
1079
+ }
1080
+
1081
+ /* Sticky rows opt back into pointer events because the overlay wrapper is
1082
+ * inert. During scroll, put them back under the same hover suppression as
1083
+ * the virtualized list so translucent hover states and menu triggers do not
1084
+ * paint over rows moving beneath the sticky stack. */
1085
+ [data-file-tree-virtualized-root='true'][data-is-scrolling]
1086
+ [data-type='item'][data-file-tree-sticky-row='true'] {
1087
+ pointer-events: none;
1088
+ }
1089
+
1090
+ [data-file-tree-virtualized-root='true'][data-is-scrolling]
1091
+ [data-type='item'][data-file-tree-sticky-row='true']:hover:not(
1092
+ [data-item-selected='true']
1093
+ ),
1094
+ [data-file-tree-virtualized-root='true'][data-is-scrolling]
1095
+ [data-type='item'][data-file-tree-sticky-row='true'][data-item-context-hover='true']:not(
1096
+ [data-item-selected='true']
1097
+ ) {
1098
+ background-color: var(--trees-bg);
1099
+ --truncate-marker-background-overlay-color: transparent;
1100
+ }
1101
+
1102
+ [data-item-selected='true']:has(+ [data-item-selected='true']) {
1103
+ border-bottom-left-radius: 0;
1104
+ border-bottom-right-radius: 0;
1105
+ }
1106
+
1107
+ [data-item-selected='true'] + [data-item-selected='true'] {
1108
+ border-top-left-radius: 0;
1109
+ border-top-right-radius: 0;
1110
+ }
1111
+
1112
+ /* Flattened Directory Parts */
1113
+ [data-item-flattened-subitems] {
1114
+ display: inline-flex;
1115
+ align-items: center;
1116
+ gap: 2px;
1117
+ }
1118
+ [data-item-flattened-subitem]:hover,
1119
+ [data-item-flattened-subitem-drag-target='true'] {
1120
+ text-decoration: underline;
1121
+ }
1122
+
1123
+ /* Icon for each item */
1124
+ [data-item-section='icon'] {
1125
+ flex-shrink: 0;
1126
+ display: flex;
1127
+ align-items: center;
1128
+ justify-content: center;
1129
+ color: var(--trees-fg-muted);
1130
+ fill: currentColor;
1131
+ width: var(--trees-icon-width);
1132
+ }
1133
+
1134
+ :where([data-item-section='icon'] > [data-icon-token]) {
1135
+ color: var(--trees-fg-muted);
1136
+ }
1137
+
1138
+ [data-file-tree-colored-icons='true'] {
1139
+ [data-icon-token='astro'] {
1140
+ color: var(--trees-file-icon-color-astro);
1141
+ }
1142
+ [data-icon-token='babel'] {
1143
+ color: var(--trees-file-icon-color-babel);
1144
+ }
1145
+ [data-icon-token='bash'] {
1146
+ color: var(--trees-file-icon-color-bash);
1147
+ }
1148
+ [data-icon-token='biome'] {
1149
+ color: var(--trees-file-icon-color-biome);
1150
+ }
1151
+ [data-icon-token='bootstrap'] {
1152
+ color: var(--trees-file-icon-color-bootstrap);
1153
+ }
1154
+ [data-icon-token='browserslist'] {
1155
+ color: var(--trees-file-icon-color-browserslist);
1156
+ }
1157
+ [data-icon-token='bun'] {
1158
+ color: var(--trees-file-icon-color-bun);
1159
+ }
1160
+ [data-icon-token='c'] {
1161
+ color: var(--trees-file-icon-color-c);
1162
+ }
1163
+ [data-icon-token='cpp'] {
1164
+ color: var(--trees-file-icon-color-cpp);
1165
+ }
1166
+ [data-icon-token='claude'] {
1167
+ color: var(--trees-file-icon-color-claude);
1168
+ }
1169
+ [data-icon-token='css'] {
1170
+ color: var(--trees-file-icon-color-css);
1171
+ }
1172
+ [data-icon-token='database'] {
1173
+ color: var(--trees-file-icon-color-database);
1174
+ }
1175
+ [data-icon-token='default'] {
1176
+ color: var(--trees-file-icon-color-default);
1177
+ }
1178
+ [data-icon-token='docker'] {
1179
+ color: var(--trees-file-icon-color-docker);
1180
+ }
1181
+ [data-icon-token='eslint'] {
1182
+ color: var(--trees-file-icon-color-eslint);
1183
+ }
1184
+ [data-icon-token='git'] {
1185
+ color: var(--trees-file-icon-color-git);
1186
+ }
1187
+ [data-icon-token='go'] {
1188
+ color: var(--trees-file-icon-color-go);
1189
+ }
1190
+ [data-icon-token='graphql'] {
1191
+ color: var(--trees-file-icon-color-graphql);
1192
+ }
1193
+ [data-icon-token='html'] {
1194
+ color: var(--trees-file-icon-color-html);
1195
+ }
1196
+ [data-icon-token='image'] {
1197
+ color: var(--trees-file-icon-color-image);
1198
+ }
1199
+ [data-icon-token='javascript'] {
1200
+ color: var(--trees-file-icon-color-javascript);
1201
+ }
1202
+ [data-icon-token='json'] {
1203
+ color: var(--trees-file-icon-color-json);
1204
+ }
1205
+ [data-icon-token='markdown'] {
1206
+ color: var(--trees-file-icon-color-markdown);
1207
+ }
1208
+ [data-icon-token='mcp'] {
1209
+ color: var(--trees-file-icon-color-mcp);
1210
+ }
1211
+ [data-icon-token='npm'] {
1212
+ color: var(--trees-file-icon-color-npm);
1213
+ }
1214
+ [data-icon-token='oxc'] {
1215
+ color: var(--trees-file-icon-color-oxc);
1216
+ }
1217
+ [data-icon-token='postcss'] {
1218
+ color: var(--trees-file-icon-color-postcss);
1219
+ }
1220
+ [data-icon-token='prettier'] {
1221
+ color: var(--trees-file-icon-color-prettier);
1222
+ }
1223
+ [data-icon-token='python'] {
1224
+ color: var(--trees-file-icon-color-python);
1225
+ }
1226
+ [data-icon-token='react'] {
1227
+ color: var(--trees-file-icon-color-react);
1228
+ }
1229
+ [data-icon-token='ruby'] {
1230
+ color: var(--trees-file-icon-color-ruby);
1231
+ }
1232
+ [data-icon-token='rust'] {
1233
+ color: var(--trees-file-icon-color-rust);
1234
+ }
1235
+ [data-icon-token='sass'] {
1236
+ color: var(--trees-file-icon-color-sass);
1237
+ }
1238
+ [data-icon-token='svg'] {
1239
+ color: var(--trees-file-icon-color-svg);
1240
+ }
1241
+ [data-icon-token='svelte'] {
1242
+ color: var(--trees-file-icon-color-svelte);
1243
+ }
1244
+ [data-icon-token='svgo'] {
1245
+ color: var(--trees-file-icon-color-svgo);
1246
+ }
1247
+ [data-icon-token='swift'] {
1248
+ color: var(--trees-file-icon-color-swift);
1249
+ }
1250
+ [data-icon-token='table'] {
1251
+ color: var(--trees-file-icon-color-table);
1252
+ }
1253
+ [data-icon-token='text'] {
1254
+ color: var(--trees-file-icon-color-text);
1255
+ }
1256
+ [data-icon-token='tailwind'] {
1257
+ color: var(--trees-file-icon-color-tailwind);
1258
+ }
1259
+ [data-icon-token='terraform'] {
1260
+ color: var(--trees-file-icon-color-terraform);
1261
+ }
1262
+ [data-icon-token='typescript'] {
1263
+ color: var(--trees-file-icon-color-typescript);
1264
+ }
1265
+ [data-icon-token='vite'] {
1266
+ color: var(--trees-file-icon-color-vite);
1267
+ }
1268
+ [data-icon-token='vscode'] {
1269
+ color: var(--trees-file-icon-color-vscode);
1270
+ }
1271
+ [data-icon-token='vue'] {
1272
+ color: var(--trees-file-icon-color-vue);
1273
+ }
1274
+ [data-icon-token='wasm'] {
1275
+ color: var(--trees-file-icon-color-wasm);
1276
+ }
1277
+ [data-icon-token='webpack'] {
1278
+ color: var(--trees-file-icon-color-webpack);
1279
+ }
1280
+ [data-icon-token='yml'] {
1281
+ color: var(--trees-file-icon-color-yml);
1282
+ }
1283
+ [data-icon-token='zig'] {
1284
+ color: var(--trees-file-icon-color-zig);
1285
+ }
1286
+ [data-icon-token='zip'] {
1287
+ color: var(--trees-file-icon-color-zip);
1288
+ }
1289
+ }
1290
+
1291
+ /* Chevron rotation and visual alignment */
1292
+ /* Chevron pointing down */
1293
+ [data-icon-name='file-tree-icon-chevron'] {
1294
+ &[data-align-capitals='false'] {
1295
+ transform: translate(0, var(--trees-icon-nudge));
1296
+ }
1297
+ &[data-align-capitals='true'] {
1298
+ transform: translate(0, 0);
1299
+ }
1300
+ }
1301
+
1302
+ [data-item-section='content'] {
1303
+ flex: 0 1 auto;
1304
+ text-align: start;
1305
+ min-width: 0;
1306
+ max-width: 100%;
1307
+ overflow: hidden;
1308
+ text-overflow: ellipsis;
1309
+ /* Breaks middle truncate component to also set this */
1310
+ /* white-space: nowrap; */
1311
+ }
1312
+
1313
+ [data-item-section='decoration'] {
1314
+ flex: 1 1 0;
1315
+ min-width: 0;
1316
+ display: flex;
1317
+ justify-content: flex-end;
1318
+ text-align: end;
1319
+ overflow: hidden;
1320
+ color: var(--trees-fg-muted);
1321
+ }
1322
+
1323
+ [data-item-section='decoration'] > span {
1324
+ min-width: 0;
1325
+ max-width: 100%;
1326
+ display: inline-flex;
1327
+ align-items: center;
1328
+ justify-content: flex-end;
1329
+ overflow: hidden;
1330
+ text-overflow: ellipsis;
1331
+ white-space: nowrap;
1332
+ }
1333
+
1334
+ [data-item-section='git'],
1335
+ [data-item-section='action'] {
1336
+ flex: 0 0 auto;
1337
+ display: flex;
1338
+ align-items: center;
1339
+ justify-content: center;
1340
+ }
1341
+
1342
+ [data-item-section='git'] {
1343
+ width: var(--trees-git-lane-width);
1344
+ }
1345
+
1346
+ [data-item-section='action'] {
1347
+ width: var(--trees-action-lane-width);
1348
+ color: var(--trees-fg-muted);
1349
+ fill: currentColor;
1350
+ pointer-events: none;
1351
+ }
1352
+
1353
+ [data-item-section='git'] > span,
1354
+ [data-item-section='action'] > span {
1355
+ width: 100%;
1356
+ display: inline-flex;
1357
+ align-items: center;
1358
+ justify-content: center;
1359
+ }
1360
+
1361
+ [data-item-action-affordance='decorative'] {
1362
+ opacity: 0.85;
1363
+ }
1364
+
1365
+ [data-item-rename-input] {
1366
+ appearance: none;
1367
+ width: 100%;
1368
+ min-width: 0;
1369
+ height: calc(var(--trees-row-height) - 4px);
1370
+ font-family: inherit;
1371
+ font-size: inherit;
1372
+ /* line-height: calc(var(--trees-row-height) - 8px); */
1373
+ color: inherit;
1374
+ background-color: transparent;
1375
+ border: 0;
1376
+ padding-inline: 6px;
1377
+ outline: none;
1378
+ box-sizing: border-box;
1379
+ }
1380
+
1381
+ [data-item-section='content']:has([data-item-rename-input])
1382
+ ~ [data-item-section='action'],
1383
+ [data-item-section='content']:has([data-item-rename-input])
1384
+ ~ [data-item-section='decoration'] {
1385
+ display: none;
1386
+ }
1387
+
1388
+ /* Chevron pointing right */
1389
+ [aria-expanded='false'][data-item-type='folder']
1390
+ > [data-item-section='icon']
1391
+ > [data-icon-name='file-tree-icon-chevron'] {
1392
+ &[data-align-capitals='true'] {
1393
+ transform: rotate(-90deg)
1394
+ translate(
1395
+ calc(var(--trees-icon-nudge) / 2),
1396
+ calc(var(--trees-icon-nudge) / 2)
1397
+ );
1398
+ }
1399
+ &[data-align-capitals='false'] {
1400
+ transform: rotate(-90deg)
1401
+ translate(
1402
+ calc(var(--trees-icon-nudge) / 2 * -1),
1403
+ calc(var(--trees-icon-nudge) / 2)
1404
+ );
1405
+ }
1406
+ }
1407
+
1408
+ /* LIST IDENTATION */
1409
+ /* Spacing container */
1410
+ [data-item-section='spacing'] {
1411
+ display: flex;
1412
+ flex-direction: row;
1413
+ align-items: center;
1414
+ justify-content: center;
1415
+ height: var(--trees-row-height);
1416
+ padding-left: calc(calc(var(--trees-icon-width) / 2) - 0.5px);
1417
+
1418
+ &:empty {
1419
+ padding-left: 0;
1420
+ }
1421
+ }
1422
+
1423
+ /* Spacing per level */
1424
+ [data-item-section='spacing-item'] {
1425
+ transform: translateX(-0.25px);
1426
+ display: inline-block;
1427
+ border-left: 1px solid var(--trees-indent-guide-bg);
1428
+ height: 100%;
1429
+ margin-right: calc(var(--trees-level-gap) - 1px);
1430
+ opacity: 0;
1431
+ transition: opacity 150ms ease;
1432
+
1433
+ & + & {
1434
+ margin-left: calc(
1435
+ var(--trees-item-row-gap) + calc(var(--trees-icon-width) / 2) - 0.5px
1436
+ );
1437
+ }
1438
+ }
1439
+
1440
+ :host(:hover) [data-item-section='spacing-item'] {
1441
+ opacity: 0.75;
1442
+ }
1443
+
1444
+ /* Git status indicator */
1445
+
1446
+ /* This is a folder that contains a git change */
1447
+ [data-item-contains-git-change='true'] > [data-item-section='git'] {
1448
+ color: var(--trees-git-modified-color);
1449
+ opacity: 0.5;
1450
+ fill: currentColor;
1451
+ }
1452
+
1453
+ /* These are files that have a git change */
1454
+ [data-item-git-status] {
1455
+ &
1456
+ > :where([data-item-section='icon'])
1457
+ > :where(:not([data-icon-name='file-tree-icon-chevron'])) {
1458
+ color: var(--trees-item-git-status-color);
1459
+ }
1460
+ & > [data-item-section='content'] {
1461
+ color: var(--trees-item-git-status-color);
1462
+ }
1463
+ & > [data-item-section='git'] {
1464
+ color: var(--trees-item-git-status-color);
1465
+ font-weight: var(--trees-font-weight-semibold);
1466
+ }
1467
+ }
1468
+
1469
+ [data-item-git-status='added'] {
1470
+ --trees-item-git-status-color: var(--trees-git-added-color);
1471
+ }
1472
+
1473
+ [data-item-git-status='deleted'] {
1474
+ --trees-item-git-status-color: var(--trees-git-deleted-color);
1475
+ }
1476
+
1477
+ [data-item-git-status='ignored'] {
1478
+ --trees-item-git-status-color: var(--trees-git-ignored-color);
1479
+
1480
+ & > [data-item-section='icon'] {
1481
+ opacity: 0.5;
1482
+ }
1483
+ }
1484
+
1485
+ [data-item-section='git'] [data-icon-name='file-tree-icon-dot'] {
1486
+ /* this is a nudge to align the dot with the likely lowercase text. it's slightly
1487
+ generalizable, but other fonts are gonna need other nudges i assume */
1488
+ transform: translateY(calc(0.65ex - 50%));
1489
+ }
1490
+
1491
+ [data-item-git-status='modified'] {
1492
+ --trees-item-git-status-color: var(--trees-git-modified-color);
1493
+ }
1494
+
1495
+ [data-item-git-status='renamed'] {
1496
+ --trees-item-git-status-color: var(--trees-git-renamed-color);
1497
+ }
1498
+
1499
+ [data-item-git-status='untracked'] {
1500
+ --trees-item-git-status-color: var(--trees-git-untracked-color);
1501
+ }
1502
+
1503
+ /* Drag and drop */
1504
+ [data-item-drag-target='true'] {
1505
+ background-color: var(--trees-selected-bg);
1506
+ }
1507
+
1508
+ [data-item-dragging='true'] {
1509
+ opacity: 0.5;
1510
+ }
1511
+
1512
+ /* Lock icon for locked paths (sibling of content) */
1513
+ [data-item-section='lock'] {
1514
+ flex: 0 0 auto;
1515
+ margin-left: auto;
1516
+ display: flex;
1517
+ align-items: center;
1518
+ color: var(--trees-fg-muted);
1519
+ }
1520
+ [data-item-section='lock'] svg {
1521
+ display: block;
1522
+ }
1523
+
1524
+ [data-type='header-slot'] {
1525
+ display: block;
1526
+ flex: 0 0 auto;
1527
+ }
1528
+
1529
+ [data-type='context-menu-wash'] {
1530
+ position: absolute;
1531
+ inset: 0;
1532
+ z-index: 3;
1533
+ background-color: transparent;
1534
+ touch-action: none;
1535
+ }
1536
+
1537
+ [data-type='context-menu-anchor'] {
1538
+ position: absolute;
1539
+ top: 0;
1540
+ right: var(--trees-context-menu-trigger-inline-offset);
1541
+ z-index: 4;
1542
+ display: none;
1543
+ align-items: center;
1544
+
1545
+ &[data-visible='true'] {
1546
+ display: flex;
1547
+ }
1548
+ }
1549
+
1550
+ /* Hide the floating trigger while the scroll container is actively moving.
1551
+ * The anchor is positioned against the root, not the scroll content, so its
1552
+ * \`top\` follows the row via a React state update — one frame behind the
1553
+ * compositor. That delay is visible as the trigger hovering over the wrong
1554
+ * row during the first frame of a scroll. The \`data-is-scrolling\` flag on
1555
+ * the root is flipped synchronously on \`wheel\`/\`touchmove\`/\`keydown\` before
1556
+ * the compositor commits the next paint, so this selector hides the anchor
1557
+ * in the same frame the scroll begins. */
1558
+ [data-file-tree-virtualized-root='true'][data-is-scrolling]
1559
+ [data-type='context-menu-anchor'] {
1560
+ display: none;
1561
+ }
1562
+
1563
+ [data-type='context-menu-anchor'] > slot[name='context-menu'] {
1564
+ display: block;
1565
+ width: 0;
1566
+ min-width: 0;
1567
+ flex: 0 0 0;
1568
+ overflow: visible;
1569
+ }
1570
+
1571
+ /* Single floating context menu trigger */
1572
+ [data-type='context-menu-trigger'] {
1573
+ all: unset;
1574
+ align-items: center;
1575
+ justify-content: center;
1576
+ width: var(--trees-action-lane-width);
1577
+ color: var(--trees-fg-muted);
1578
+ fill: currentColor;
1579
+ cursor: pointer;
1580
+ font-family: var(--trees-font-family);
1581
+ font-size: var(--trees-font-size);
1582
+ border-top-right-radius: var(--trees-border-radius);
1583
+ border-bottom-right-radius: var(--trees-border-radius);
1584
+ margin: var(--trees-focus-ring-width);
1585
+ height: calc(var(--trees-row-height) - var(--trees-focus-ring-width) * 2);
1586
+ border-width: 0;
1587
+ transition: color 120ms ease;
1588
+
1589
+ display: flex;
1590
+ }
1591
+
1592
+ [data-type='context-menu-trigger']:hover,
1593
+ [data-type='context-menu-trigger'][aria-expanded='true'] {
1594
+ color: var(--trees-fg);
1595
+ }
1596
+
1597
+ /** @pierre/truncate css here, manually copy pasted for now */
1598
+ [data-truncate-container] {
1599
+ /* CUSTOM TO TREES, TO SUPPORT THE OUTLINE */
1600
+ margin-top: -1px;
1601
+ margin-bottom: -1px;
1602
+
1603
+ /* Width of the fade from default marker to text */
1604
+ --truncate-internal-marker-fade-width: var(
1605
+ --truncate-marker-fade-width,
1606
+ 2px
1607
+ );
1608
+ /* Width of the solid color between the fade from the default marker to the text */
1609
+ --truncate-internal-marker-gap: var(--truncate-marker-gap, 0px);
1610
+ /* Opacity of the marker 'color' property, not of the element itself */
1611
+ --truncate-internal-marker-opacity: var(--truncate-marker-opacity, 50%);
1612
+ /* Opacity of the marker 'color' property specifically for the middle truncate, not opacity of the element itself */
1613
+ --truncate-internal-middle-marker-opacity: var(
1614
+ --truncate-middle-marker-opacity,
1615
+ 80%
1616
+ );
1617
+ /* Background color of the default marker */
1618
+ --truncate-internal-marker-background-color: var(
1619
+ --truncate-marker-background-color,
1620
+ light-dark(white, black)
1621
+ );
1622
+ --truncate-internal-marker-background-overlay-color: var(
1623
+ --truncate-marker-background-overlay-color,
1624
+ transparent
1625
+ );
1626
+ --truncate-internal-marker-block-inset: var(
1627
+ --truncate-marker-block-inset,
1628
+ 0px
1629
+ );
1630
+ /* Duration of the fade out animation for the marker */
1631
+ --truncate-internal-marker-fade-out-duration: var(
1632
+ --truncate-marker-fade-out-duration,
1633
+ 0ms
1634
+ );
1635
+ /* Duration of the fade in animation for the marker */
1636
+ --truncate-internal-marker-fade-in-duration: var(
1637
+ --truncate-marker-fade-in-duration,
1638
+ 100ms
1639
+ );
1640
+
1641
+ /* FADE Variant specifics */
1642
+ --truncate-internal-fade-marker-color: var(
1643
+ --truncate-fade-marker-color,
1644
+ #000
1645
+ );
1646
+ --truncate-internal-fade-marker-width: var(
1647
+ --truncate-fade-marker-width,
1648
+ 0.2lh
1649
+ );
1650
+
1651
+ /*
1652
+ In some special cases people might be adding spacing in other ways
1653
+ that would benefit from being able to override this, however the container
1654
+ query below can't use this and would need to be redeclared with the overridden
1655
+ value. It's a bad time, but better than nothing.
1656
+ */
1657
+ --truncate-internal-single-line-height: 1lh;
1658
+
1659
+ height: var(--truncate-internal-single-line-height);
1660
+ min-width: 0;
1661
+ overflow: hidden;
1662
+ }
1663
+
1664
+ [data-truncate-marker] {
1665
+ display: flex;
1666
+ position: absolute;
1667
+ height: var(--truncate-internal-single-line-height);
1668
+ padding-block: var(--truncate-internal-marker-block-inset);
1669
+ box-sizing: border-box;
1670
+ align-items: center;
1671
+ background-clip: content-box;
1672
+ z-index: 2;
1673
+ color: color-mix(
1674
+ in srgb,
1675
+ currentColor var(--truncate-internal-marker-opacity),
1676
+ transparent
1677
+ );
1678
+
1679
+ /* Core trick for hiding the marker until overflow occurs */
1680
+ opacity: 0;
1681
+ transition: opacity var(--truncate-internal-marker-fade-out-duration)
1682
+ ease-in-out;
1683
+ }
1684
+
1685
+ @container measure (height > 1lh) {
1686
+ [data-truncate-marker] {
1687
+ opacity: 1;
1688
+ transition: opacity var(--truncate-internal-marker-fade-in-duration)
1689
+ ease-in-out;
1690
+ }
1691
+ }
1692
+
1693
+ [data-truncate-grid] {
1694
+ display: grid;
1695
+ position: relative;
1696
+ }
1697
+
1698
+ [data-truncate-content='visible'] {
1699
+ white-space: nowrap;
1700
+ }
1701
+
1702
+ [data-truncate-content='overflow'] {
1703
+ opacity: 0;
1704
+ pointer-events: none;
1705
+ -webkit-user-select: none;
1706
+ user-select: none;
1707
+ word-break: break-all;
1708
+ margin-top: calc(-1 * var(--truncate-internal-single-line-height));
1709
+ }
1710
+
1711
+ [data-truncate-marker-cell] {
1712
+ container: measure / size;
1713
+ overflow: visible;
1714
+ -webkit-user-select: none;
1715
+ user-select: none;
1716
+ pointer-events: none;
1717
+ }
1718
+
1719
+ [data-truncate-container='truncate'] {
1720
+ & [data-truncate-grid] {
1721
+ grid-template-columns: minmax(0, max-content) 0;
1722
+ }
1723
+ & [data-truncate-marker] {
1724
+ right: 0;
1725
+ }
1726
+ & [data-truncate-fade] {
1727
+ margin-right: calc(-2 * var(--truncate-internal-fade-marker-width));
1728
+ }
1729
+ }
1730
+
1731
+ [data-truncate-container='fruncate'] {
1732
+ & [data-truncate-grid] {
1733
+ grid-template-columns: 0 minmax(0, max-content) auto;
1734
+ }
1735
+ & [data-truncate-content] {
1736
+ direction: rtl;
1737
+ }
1738
+ & [data-truncate-content] > span {
1739
+ unicode-bidi: plaintext;
1740
+ }
1741
+ & [data-truncate-fade] {
1742
+ margin-left: calc(-2 * var(--truncate-internal-fade-marker-width));
1743
+ }
1744
+ }
1745
+
1746
+ [data-truncate-variant='default'] {
1747
+ & [data-truncate-marker] {
1748
+ background-color: var(--truncate-internal-marker-background-color);
1749
+ background-image: linear-gradient(
1750
+ var(--truncate-internal-marker-background-overlay-color),
1751
+ var(--truncate-internal-marker-background-overlay-color)
1752
+ );
1753
+ }
1754
+ & [data-truncate-marker]::after,
1755
+ & [data-truncate-marker]::before {
1756
+ content: '';
1757
+ position: absolute;
1758
+ width: calc(
1759
+ var(--truncate-internal-marker-fade-width) +
1760
+ var(--truncate-internal-marker-gap)
1761
+ );
1762
+ inset-block-start: var(--truncate-internal-marker-block-inset);
1763
+ height: max(
1764
+ 0px,
1765
+ calc(
1766
+ var(--truncate-internal-single-line-height) -
1767
+ var(--truncate-internal-marker-block-inset) * 2
1768
+ )
1769
+ );
1770
+ background-color: var(--truncate-internal-marker-background-color);
1771
+ background-image: linear-gradient(
1772
+ var(--truncate-internal-marker-background-overlay-color),
1773
+ var(--truncate-internal-marker-background-overlay-color)
1774
+ );
1775
+ mask-image: linear-gradient(
1776
+ var(--truncate-internal-fade-dir),
1777
+ #000 0%,
1778
+ #000 var(--truncate-internal-marker-gap),
1779
+ transparent 100%
1780
+ );
1781
+ }
1782
+ & [data-truncate-marker]::after {
1783
+ --truncate-internal-fade-dir: to right;
1784
+ right: calc(
1785
+ -1 *
1786
+ (
1787
+ var(--truncate-internal-marker-fade-width) +
1788
+ var(--truncate-internal-marker-gap)
1789
+ )
1790
+ );
1791
+ }
1792
+ & [data-truncate-marker]::before {
1793
+ --truncate-internal-fade-dir: to left;
1794
+ left: calc(
1795
+ -1 *
1796
+ (
1797
+ var(--truncate-internal-marker-fade-width) +
1798
+ var(--truncate-internal-marker-gap)
1799
+ )
1800
+ );
1801
+ }
1802
+ }
1803
+
1804
+ [data-truncate-variant='fade'] {
1805
+ & [data-truncate-marker] {
1806
+ background: transparent;
1807
+ }
1808
+ }
1809
+
1810
+ [data-truncate-fade] {
1811
+ box-shadow:
1812
+ 0 0 calc(var(--truncate-internal-fade-marker-width) / 2)
1813
+ var(--truncate-internal-fade-marker-color),
1814
+ 0 0 var(--truncate-internal-fade-marker-width)
1815
+ var(--truncate-internal-fade-marker-color);
1816
+ width: calc(var(--truncate-internal-fade-marker-width) * 2);
1817
+ height: calc(
1818
+ var(--truncate-internal-single-line-height) -
1819
+ (var(--truncate-internal-fade-marker-width) * 2)
1820
+ );
1821
+ margin: var(--truncate-internal-fade-marker-width) 0;
1822
+ }
1823
+
1824
+ [data-truncate-group-container='middle'] {
1825
+ & [data-truncate-container] {
1826
+ --truncate-marker-opacity: var(--truncate-internal-middle-marker-opacity);
1827
+ }
1828
+
1829
+ display: flex;
1830
+ min-width: 0;
1831
+
1832
+ & > div {
1833
+ min-width: 0;
1834
+ }
1835
+
1836
+ & > div[data-truncate-segment-priority='1'] {
1837
+ flex: 0 1 max-content;
1838
+ }
1839
+ & > div[data-truncate-segment-priority='2'] {
1840
+ flex: 0 999999 max-content;
1841
+ }
1842
+ }
1843
+ }
1844
+ `,XW=`@layer base, unsafe;`;function ZW(e){return`${XW}
1845
+ @layer base {
1846
+ ${e}
1847
+ }`}function QW(e){return`${XW}
1848
+ @layer unsafe {
1849
+ ${e}
1850
+ }`}var $W=new WeakMap;function eG(e){let t=$W.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(qB,`true`);let r=document.createElement(`div`);r.style.position=`relative`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n);let i=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),$W.set(e,i),i}function tG(e,t){if(!e.isConnected)return;let n=eG(t);if(n==null)return;let r=t.querySelector(`style[${JB}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(JB,``),t.appendChild(i)),i.textContent=`:host { ${YB}: ${n}px; }`}var nG;function rG(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){nG??(nG=new CSSStyleSheet,nG.replaceSync(ZW(YW)));let t=!1;try{e.adoptedStyleSheets=[nG],t=!0}catch{}if(t){e.querySelector(`style[${GB}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(GB,``),t.textContent=ZW(YW),e.prepend(t)}}function iG(e,t){aG(e,t),rG(t),tG(e,t)}function aG(e,t){let n=e.querySelector(`template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]`);n instanceof HTMLTemplateElement&&(t.childNodes.length>0||(t.appendChild(n.content.cloneNode(!0)),n.hasAttribute(`shadowrootmode`)&&n.remove()))}if(typeof HTMLElement<`u`&&customElements.get(`file-tree-container`)==null){class e extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.shadowRoot??this.attachShadow({mode:`open`});iG(this,e)}}if(customElements.define(WB,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(WB)))e instanceof HTMLElement&&iG(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var oG=e=>e.startsWith(`f::`)?e.slice(3):e;function sG(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function cG(e,t){return e===``?t:`${e}/${t}`}function lG({files:e,path:t,isFolder:n,nextBasename:r}){let i=oG(t),a=r.trim();if(a.length===0)return{error:`Name cannot be empty.`};if(a.includes(`/`))return{error:`Name cannot include "/".`};let{parentPath:o,baseName:s}=sG(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=cG(o,a),l=Array(e.length),u=new Set;if(!n){let t=`${c}/`,r=!1;for(let n=0;n<e.length;n++){let a=e[n];if(a!==i&&a.startsWith(t))return{error:`"${c}" already exists.`};let o=a===i?c:a;if(u.has(o))return{error:`"${c}" already exists.`};u.add(o),l[n]=o,a===i&&(r=!0)}return r?{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}:{error:`Could not find the selected file to rename.`}}let d=`${i}/`,f=`${c}/`,p=0;for(let t=0;t<e.length;t++){let n=e[t],r=n===i||n.startsWith(d);if(!r&&(n===c||n.startsWith(f)))return{error:`"${c}" already exists.`};let a=r?`${c}${n.slice(i.length)}`:n;if(u.has(a))return{error:`"${c}" already exists.`};u.add(a),l[t]=a,r&&p++}return p===0?{error:`Could not find the selected folder to rename.`}:{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}}function uG(e){return e.endsWith(`/`)}function dG(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function fG(e){let t=[],n=new Set;for(let r of e)n.has(r)||(n.add(r),t.push(r));let r=new Set;for(let e of t.toSorted((e,t)=>e.length===t.length?e.localeCompare(t):e.length-t.length)){let t=(e.endsWith(`/`)?e.slice(0,-1):e).split(`/`),n=!1;for(let e=0;e<t.length-1;e+=1){let i=`${t.slice(0,e+1).join(`/`)}/`;if(r.has(i)){n=!0;break}}n||r.add(e)}return t.filter(e=>r.has(e))}function pG(e,t){return t.includes(e)?fG(t):[e]}function mG(e,t){return e===t?!0:e==null||t==null?!1:e.kind===t.kind&&e.directoryPath===t.directoryPath&&e.flattenedSegmentPath===t.flattenedSegmentPath&&e.hoveredPath===t.hoveredPath}function hG(e,t){return{draggedPaths:e,target:t}}function gG(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(uG(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function _G(e,t){return t.kind===`root`||t.directoryPath==null?dG(e):t.directoryPath}function vG(e,t){let n=e.map(e=>{let n=_G(e,t);return n===e?null:{from:e,to:n,type:`move`}}).filter(e=>e!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?`move`:`batch`,target:t}}}function yG(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function bG(e,t,n){let{paths:r,preparedInput:i}=e;if(i==null){if(r==null)throw Error(`FileTree requires paths or preparedInput`);return{paths:r,preparedInput:void 0}}let a=i.paths;if(r==null)return{paths:a,preparedInput:i};if(!yG(WW.preparePaths(r,n==null?{}:{sort:n}),a))throw Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:a,preparedInput:i}}function xG(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function SG(e,t,n){if(e===t)return n;let r=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(r)?`${n.endsWith(`/`)?n:`${n}/`}${e.slice(r.length)}`:e}function CG(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function wG(e,t,n=!1){if(e==null)return null;switch(t.operation){case`add`:case`expand`:case`collapse`:case`mark-directory-unloaded`:case`begin-child-load`:case`apply-child-patch`:case`complete-child-load`:case`fail-child-load`:case`cleanup`:return e;case`remove`:return CG(e,t.path)?n?e:null:e;case`move`:return SG(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=wG(r,e,n),r==null)return null;return r}}}function TG(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function EG(e){switch(e.operation){case`add`:return{...TG(e),operation:`add`,path:e.path};case`remove`:return{...TG(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...TG(e),from:e.from,operation:`move`,to:e.to}}}function DG(e){return{...TG(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>EG(e)),operation:`batch`}}function OG(e){switch(e.operation){case`add`:case`remove`:case`move`:return EG(e);case`batch`:return DG(e);default:return null}}function kG(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function AG(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function jG(e){return AG(e).at(-1)??null}function MG(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function NG(e){return e.endsWith(`/`)}var PG=e=>e.toLowerCase();function FG(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function IG(e){return e.endsWith(`/`)?e.slice(0,-1):e}function LG(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var RG=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},zG=Symbol(`FILE_TREE_RENAME_VIEW`),BG=512,VG=512;function HG(e){return e===`top`||e===`center`?e:`nearest`}function UG(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=AG(n);for(let e=r.length-1;e>=0;--e){let n=r[e];if(n==null)continue;let i=t(n);if(i!=null)return i}}return 0}function WG(e,t,n){if(e.paths.length===0)return{focusedIndex:-1,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};if(t==null)return{focusedIndex:0,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};let r=n??(t=>e.visibleIndexByPath.get(t)??null);return{focusedIndex:UG(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var GG=class{#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=[];#A;#j=null;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=0;#z=null;#B=new Set;#V=0;#H;#U=0;#W=!1;#G=0;#K;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=bG({paths:s,preparedInput:c},`constructor`,l.sort);this.#e=l,t!=null&&t!==!1&&(this.#r=t===!0?{}:t),this.#w=a!=null&&a!==!1,a!=null&&a!==!1&&a!==!0&&(this.#C=a.canRename,this.#v=a.onError,this.#_=a.onRename),this.#y=o,this.#A=n??`hide-non-matches`,this.#H=this.#le(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ne(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#B=new Set(d),this.#z=f,this.#V=1),this.#je(f,!1),r!=null&&this.#Te(r,!1),this.#K=this.#Re()}destroy(){this.#K?.(),this.#K=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#he()}focusFirstItem(){this.#be().length>0&&this.#Fe(0)}focusLastItem(){this.#G<=0||(this.#Ie(),this.#Fe(this.#G-1))}focusNextItem(){this.#Ae(1)}focusParentItem(){if(this.#c==null)return;let e=jG(this.#c);if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t)}focusPath(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;this.#Ie();let n=this.#Z(t);n>=0&&this.#Fe(n)}scrollToPath(e,t){let n=this.#H.getPathInfo(e)?.path??null;if(n==null)return;this.#Ie();let r=this.#xe(n);r<0||this.#Me(r)!=null&&(t?.focus!==!1&&this.#Fe(r,!1),this.#L={id:this.#R+=1,offset:HG(t?.offset),visibleIndex:r},this.#De())}focusMountedPathFromInput(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;let n=this.#Z(t);n>=0&&this.#Fe(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Z(t);return n>=0?(this.#Fe(n),this.#be()[n]??t):null}focusPreviousItem(){this.#Ae(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#Q(this.#c)}getFocusedPath(){return this.#c}getScrollRequest(){return this.#L}clearScrollRequest(e){this.#L?.id===e&&(this.#L=null)}resolveNearestVisiblePath(e){let t=this.#be();if(this.#G===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#H.getPathInfo(e)?.path??e,r=this.#Z(n);return r>=0?t[r]??n:this.#X(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#B]}getSelectionVersion(){return this.#V}getVisibleCount(){return this.#G}getVisibleRows(e,t){if(t<e||this.#G===0)return[];let n=Math.max(0,e),r=Math.min(this.#G-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=VG){let e=[];for(let t=n;t<=r;t+=1){let n=this.#H.getVisibleRowContext(t);if(n==null)break;e.push(this.#ee(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ie(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#Se(n+t)),t=new Map,i=e[0]??-1,a=i;for(let n=1;n<=e.length;n+=1){let r=e[n];if(r!=null&&r===a+1){a=r;continue}if(i>=0&&this.#H.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null){i=-1,a=-1;continue}i=r,a=r}return Array.from({length:r-n+1},(e,r)=>{let i=n+r,a=this.#Se(i),o=t.get(a),s=this.#b[a];if(o==null||s==null)throw Error(`Missing projection row for filtered visible index ${String(i)}`);return this.#$(o,i,a,{ancestorPaths:this.#re(a),path:s})})}return this.#H.getVisibleSlice(n,r).map((e,t)=>{let r=n+t,i=this.#b[r];if(i==null)throw Error(`Missing projection path for visible index ${String(r)}`);return this.#$(e,r,r,{ancestorPaths:this.#re(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#G===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#G;r+=1){let i=e+r*t,a=Math.min(this.#G-1,Math.floor(i/t)),o=this.#te(a,r)??(a>0?this.#te(a-1,r):void 0);if(o==null)break;n.push({row:this.#ee(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#H.getPathInfo(e);return t==null?null:this.#Q(t.path,t)}resolveMountedDirectoryPathFromInput(e){let t=this.#H.getPathInfo(e);return t?.kind===`directory`?t.path:null}toggleMountedDirectoryFromInput(e){let t=this.resolveMountedDirectoryPathFromInput(e);t!=null&&this.#ze(t)}selectAllVisiblePaths(){this.#Ie();let e=[...this.#be()];this.#ae(e,this.#c??this.#z)}selectOnlyPath(e){let t=this.#Ne(e);t!=null&&this.#ae([t],t)}selectOnlyMountedPathFromInput(e){this.#ae([e],e)}selectPath(e){let t=this.#Ne(e);t==null||this.#B.has(t)||this.#ae([...this.#B,t])}deselectPath(e){let t=this.#Ne(e);t==null||!this.#B.has(t)||this.#ae([...this.#B].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.#ae([...this.#B].filter(e=>e!==t),t);return}this.#ae([...this.#B,t],t)}}selectPathRange(e,t){let n=this.#Ne(e);if(n==null)return;this.#Ie();let r=this.#z,i=r==null?-1:this.#Ce(r),a=this.#Ce(n);if(i===-1||a===-1){let e=t?[...this.#B,n]:[n];this.#ae(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#be().slice(o,s+1),l=t?[...this.#B,...c]:c;this.#ae(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#G-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ie();let r=this.#be(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#B);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#ae([...o],this.#z??i,!1),this.#Fe(n)}getDragAndDropConfig(){return this.#r}isDragAndDropEnabled(){return this.#r!=null}getDragSession(){return this.#i==null?null:{draggedPaths:[...this.#i.draggedPaths],primaryPath:this.#i.primaryPath,target:this.#i.target==null?null:{...this.#i.target}}}startDrag(e){if(this.#r==null)return!1;let t=this.#Ne(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=pG(t,n);return this.#r.canDrag?.(r)===!1?!1:(n.includes(t)||this.#ae([t],t,!1),this.#Pe(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#De(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=hG(t.draggedPaths,n);(gG(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}mG(t.target,n)||(this.#i={...t,target:n},this.#De())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#De())}completeDrag(){let e=this.#i;if(e==null)return!1;this.#i=null;let t=e.target==null?null:{...e.target};if(t==null)return this.#De(),!1;let n=hG(e.draggedPaths,t);if(gG(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=vG(e.draggedPaths,t);if(r==null)return this.#De(),!1;try{if(r.operations.length===1){let e=r.operations[0];if(e==null||e.type!==`move`)throw Error(`Expected a single move operation for one-item drops`);this.#H.move(e.from,e.to,{collision:e.collision})}else this.#ce(r.operations),this.#H.batch(r.operations)}catch(e){return this.#De(),this.#r?.onDropError?.(e instanceof Error?e.message:String(e),n),!1}return this.#r?.onDropComplete?.(r.result),!0}subscribe(e){return this.#t.add(e),e(),()=>{this.#t.delete(e)}}add(e){this.#H.add(e)}remove(e,t={}){this.#H.remove(e,t)}move(e,t,n={}){this.#H.move(e,t,n)}batch(e){this.#H.batch(e)}onMutation(e,t){let n=e,r=t,i=this.#n.get(n);return i??(i=new Set,this.#n.set(n,i)),i.add(r),()=>{let e=this.#n.get(n);e?.delete(r),e?.size===0&&this.#n.delete(n)}}setSearch(e){this.#Te(e,!0)}openSearch(e=``){this.#Te(e,!0)}closeSearch(){this.#Te(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#we(1)}focusPreviousSearchMatch(){this.#we(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#H.getPathInfo(e);if(n==null)return!1;let r=n.path,i=NG(r),a=IG(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of AG(r))this.#H.isExpanded(e)||this.#H.expand(e);return this.#ae([r],r,!1),this.#M!=null&&(this.#Te(null,!1),this.#y?.(this.#M)),this.#Pe(r),this.#T=r,this.#E=FG(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}[zG](){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}}#q(){if(this.#T==null)return;let e=this.#T,t=this.#D;if(this.#T=null,this.#E=``,this.#D=!1,t){this.remove(e,NG(e)?{recursive:!0}:void 0);return}this.#Pe(e),this.#De()}#J(){let e=this.#T;if(e==null)return;if(this.#D&&this.#E.trim().length===0){this.#T=null,this.#E=``,this.#D=!1,this.remove(e,NG(e)?{recursive:!0}:void 0);return}let t=NG(e),n=lG({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:IG(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#Pe(e),this.#v?.(n.error),this.#De();return}if(n.sourcePath===n.destinationPath){this.#Pe(e),this.#De();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(LG(n.sourcePath,t),LG(n.destinationPath,t))}#Y(e){this.#T==null||this.#E===e||(this.#E=e,this.#De())}resetPaths(e,t={}){let n=this.#H.list().length,r=this.#G,i=bG({paths:e,preparedInput:t.preparedInput},`resetPaths`,this.#e.sort),a=this.#le(i.paths,i.preparedInput,t.initialExpandedPaths),o=this.#c,s=this.#T,c=this.getSelectedPaths(),l=this.#z;this.#K?.(),this.#H=a,this.#d.clear(),this.#he();let u=c.map(e=>a.getPathInfo(e)?.path??null).filter(e=>e!=null),d=!kG(this.#B,u);this.#B=new Set(u),d&&(this.#V+=1),this.#z=l==null?null:a.getPathInfo(l)?.path??null,this.#T=s==null?null:a.getPathInfo(s)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#je(o,o!=null||u.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:i.paths.length,pathCountBefore:n,projectionChanged:!0,usedPreparedInput:t.preparedInput!=null,visibleCountDelta:this.#G-r})}#X(e){this.#Ie();let t=jG(e),n=MG(e,t),r=null,i=null;for(let e of this.#be()){if(jG(e)!==t)continue;let a=MG(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Z(e){let t=this.#Ce(e);if(t!==-1)return t;let n=AG(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#Ce(t);if(r!==-1)return r}return this.#be().length>0?0:-1}#Q(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#H.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#oe(r.path):this.#se(r.path);return this.#d.set(r.path,i),i}#$(e,t,n,r){return{ancestorPaths:r.ancestorPaths,depth:e.depth,flattenedSegments:e.flattenedSegments?.map(e=>({isTerminal:e.isTerminal,name:e.name,path:e.path})),hasChildren:e.hasChildren,index:t,isExpanded:e.isExpanded,isFlattened:e.isFlattened,isFocused:r.path===this.#c,isSelected:this.#B.has(r.path),kind:e.kind,level:e.depth,name:e.name,path:r.path,posInSet:r.posInSet??this.#x[n]??0,setSize:r.setSize??this.#S[n]??0}}#ee(e){return this.#$(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#te(e,t){let n=this.#H.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ne(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ne(n),n];return this.#a.set(e,r),r}#re(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ne(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ie(e){this.#H.collapse(e)}#ae(e,t=this.#z,n=!0){let r=[...new Set(e)],i=!kG(this.#B,r),a=this.#z!==t;!i&&!a||(this.#B=new Set(r),this.#z=t,i&&(this.#V+=1),n&&this.#De())}#oe(e){return{collapse:()=>{this.#ie(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#ke(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#H.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#ze(e)}}}#se(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#ce(e){let t=this.#H.list();this.#le(t).batch(e)}#le(e,t,n){return new WW({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ue(){return this.#h??=this.#H.list(),this.#h}#de(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ue()){e.add(t);for(let n of AG(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(PG),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(PG),this.#p}#he(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#ge(){return this.#pe().filter(e=>this.#H.isExpanded(e))}#_e(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#B)for(let n of AG(e))t.add(n);this.#ve(t)}#ve(e){this.#W=!0;try{for(let t of this.#pe()){let n=e.has(t),r=this.#H.isExpanded(t);n&&!r?this.#H.expand(t):!n&&r&&this.#H.collapse(t)}}finally{this.#W=!1}}#ye(){if(this.#M==null||this.#M.length===0){this.#k=[],this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let t=[],n=[],r=new Map;for(let[i,a]of e.entries())this.#N?.has(a)===!0&&(r.set(a,n.length),t.push(i),n.push(a));this.#F=t,this.#I=n,this.#P=r,this.#G=n.length}#be(){return this.#I??this.#b}#xe(e){return this.#I==null?this.#H.getVisibleIndex(e)??-1:this.#P?.get(e)??-1}#Se(e){return this.#F?.[e]??e}#Ce(e){return this.#P?.get(e)??this.#H.getVisibleIndex(e)??-1}#we(e){let t=this.#k;if(t.length===0)return;let n=this.#c,r=n==null?-1:t.indexOf(n),i=t[r<0?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e))];i!=null&&this.focusPath(i)}#Te(e,t){let n=e==null?null:RG(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#ge()),this.#M=n,n==null)this.#_e(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else if(n.length===0)this.#_e(!1),this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else{let e=this.#Ee();this.#je(e,!0)}t&&(this.#y?.(this.#M),this.#De())}}#Ee(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ue(),n=this.#fe(),r=[],i=new Set,a=null;for(let o=0;o<t.length;o+=1){if(!n[o].includes(e))continue;let s=t[o];r.push(s),i.add(s),a??=s}let o=this.#pe(),s=this.#me();for(let t=0;t<o.length;t+=1){if(!s[t].includes(e))continue;let n=o[t];i.has(n)||(r.push(n),i.add(n),a??=n)}this.#O=i;let c=this.#A===`hide-non-matches`&&r.length>0?new Set:null;this.#N=c;let l=this.#A===`expand-matches`?new Set(this.#j??[]):new Set;for(let e of r){c?.add(e),e.endsWith(`/`)&&l.add(e);for(let t of AG(e))l.add(t),c?.add(t)}return this.#ve(l),a??this.#c}#De(){for(let e of this.#t)e()}#Oe(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#ke(e){for(let t of AG(e))this.#H.isExpanded(t)||this.#H.expand(t);this.#H.isExpanded(e)||this.#H.expand(e)}#Ae(e){let t=this.#G;if(t===0)return;let n=this.#s===-1?0:this.#s,r=Math.min(t-1,Math.max(0,n+e));(r!==n||this.#s===-1)&&(!this.#l&&this.#F==null&&r>=this.#b.length&&this.#Ie(),this.#Fe(r))}#je(e,t=!0){let n=this.#H.getVisibleCount();this.#U=n;let r=WG(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,BG)),e,t?e=>this.#H.getVisibleIndex(e):void 0);this.#a.clear(),this.#o.clear(),this.#l=r.paths.length>=n,this.#u=r.getParentIndex,this.#b=r.paths,this.#x=r.posInSetByIndex,this.#S=r.setSizeByIndex,this.#ye(),this.#s=e==null?this.#be().length>0?0:-1:this.#Z(e),this.#c=this.#s<0?null:this.#Me(this.#s)}#Me(e){return this.#be()[e]??(this.#F==null?this.#H.getVisibleRowContext(e)?.row.path??null:null)}#Ne(e){return this.#H.getPathInfo(e)?.path??null}#Pe(e){if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t,!1)}#Fe(e,t=!0){let n=this.#Me(e);n!=null&&(this.#s===e&&this.#c===n||(this.#s=e,this.#c=n,t&&this.#De()))}#Ie(){this.#l||this.#je(this.#c,!0)}#Le(e){let t=wG(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=wG(this.#c,e,!0),r=[...this.#B].map(t=>wG(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=wG(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return kG(this.#B,o)||(this.#B=new Set(o),this.#V+=1),this.#z=a,n}#Re(){return this.#H.on(`*`,e=>{if(this.#W)return;e.canonicalChanged&&(this.#d.clear(),this.#he()),this.#i!=null&&xG(e)&&(this.#i=null);let t=xG(e)?this.#Le(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ee():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#je(n,r),this.#De();let i=OG(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},KG=e=>{if(e==null||e.length===0)return`0`;let t=`${e.length}`;for(let n of e)t+=`\0${n.path}\0${n.status}`;return t};function qG(e){let t=e.endsWith(`/`),n=``,r=-1;for(let t=0;t<=e.length;t+=1){if(!(e[t]===`/`||t===e.length)){r===-1&&(r=t);continue}r!==-1&&(n!==``&&(n+=`/`),n+=e.slice(r,t),r=-1)}return n===``?null:{isDirectory:t,path:n}}function JG(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function YG(e,t){return t?`${e}/`:e}function XG(e,t=null){let n=KG(e==null?void 0:[...e]);if(n===`0`)return null;if(t?.signature===n)return t;let r=new Map,i=new Set,a=new Set;for(let t of e??[]){let e=qG(t.path);if(e==null)continue;let n=YG(e.path,e.isDirectory);r.set(n,t.status),t.status===`ignored`&&e.isDirectory?a.add(n):e.isDirectory&&a.delete(n);for(let t of JG(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var ZG,QG,$G,eK,tK,nK,rK,iK,aK,oK,sK={},cK=[],lK=Array.isArray,uK=cK.slice,dK=Object.assign;function fK(e){e&&e.parentNode&&e.remove()}function pK(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?uK.call(arguments,2):n),mK(e,o,r,i,null)}function mK(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++QG,__i:-1,__u:0};return i==null&&ZG.vnode!=null&&ZG.vnode(a),a}function hK(e){return e.children}function gK(e,t){this.props=e,this.context=t,this.__g=0}function _K(e,t){if(t==null)return e.__?_K(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?_K(e):null}function vK(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=n.__e;break}return vK(e)}}function yK(e){(8&e.__g||!(e.__g|=8)||!$G.push(e)||tK++)&&eK==ZG.debounceRendering||((eK=ZG.debounceRendering)||queueMicrotask)(bK)}function bK(){for(var e,t,n,r,i,a,o,s,c=1;$G.length;)$G.length>c&&$G.sort(nK),e=$G.shift(),c=$G.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=dK({},r)).__v=r.__v+1,ZG.vnode&&ZG.vnode(n),OK(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??_K(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,AK(a,n,o),n.__e!=i&&vK(n)));tK=0}function xK(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||cK,b=t.length;for(c=SK(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?sK:y[m.__i]||sK,m.__i=f,_=OK(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&NK(p.ref,null,m),u.push(m.ref,m.__c||h,m)),g==null&&h!=null&&(g=h),(v=!!(4&m.__u))||p.__k===m.__k?c=CK(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function SK(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(c=a+f,(o=e.__k[a]=typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?mK(null,o,null,null,null):lK(o)?mK(hK,{children:o},null,null,null):o.constructor==null&&o.__b>0?mK(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(l=o.__i=wK(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=_K(s)),PK(s,s));return r}function CK(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=CK(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=_K(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function wK(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function TK(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function EK(e,t,n,r,i){var a;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||TK(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||TK(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(rK,`$1`)),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||={},e.__l[t+a]=n,n?r?n.l=r.l:(n.l=iK,e.addEventListener(t,a?oK:aK,a)):e.removeEventListener(t,a?oK:aK,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function DK(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=iK++;else if(t.u<n.l)return;return n(ZG.event?ZG.event(t):t)}}}function OK(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),n.__c.__z&&(s=t.__e=n.__e=(a=n.__c.__z)[0],n.__c.__z=null)),(d=ZG.__b)&&d(t);n:if(typeof M==`function`)try{if(v=t.props,y=`prototype`in M&&M.prototype.render,b=(d=M.contextType)&&r[d.__c],x=d?b?b.props.value:d.__:r,n.__c?2&(f=t.__c=n.__c).__g&&(f.__g|=1,_=!0):(y?t.__c=f=new M(v,x):(t.__c=f=new gK(v,x),f.constructor=M,f.render=FK),b&&b.sub(f),f.props=v,f.state||={},f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&M.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=dK({},f.__s)),dK(f.__s,M.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&M.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&M.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),!(4&f.__g)&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)||t.__v==n.__v){for(t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),S=0;S<f._sb.length;S++)f.__h.push(f._sb[S]);f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__g&=-5,C=ZG.__r,w=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),T=0;T<f._sb.length;T++)f.__h.push(f._sb[T]);f._sb=[]}else do f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=dK({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===hK&&d.key==null&&(E=jK(d.props.children)),s=xK(e,lK(E)?E:[E],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null)if(e.then){for(D=0,O=!1,t.__u|=c?160:128,t.__c.__z=[],k=0;k<a.length;k++)(A=a[k])==null||O||(A.nodeType==8&&A.data==`$s`?(D>0&&t.__c.__z.push(A),D++,a[k]=null):A.nodeType==8&&A.data==`/$s`?(--D>0&&t.__c.__z.push(A),O=D===0,s=a[k],a[k]=null):D>0&&(t.__c.__z.push(A),a[k]=null));if(!O){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(j=a.length;j--;)fK(a[j]);kK(t)}else t.__e=n.__e,t.__k=n.__k,e.then||kK(t);ZG.__e(e,t,n)}else s=t.__e=MK(n.__e,t,n,r,i,a,o,c,l,u);return(d=ZG.diffed)&&d(t),128&t.__u?void 0:s}function kK(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(kK)}function AK(e,t,n){for(var r=0;r<n.length;r++)NK(n[r],n[++r],n[++r]);ZG.__c&&ZG.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){ZG.__e(e,t.__v)}})}function jK(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:lK(e)?e.map(jK):dK({},e)}function MK(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v=n.props,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(u=0;u<a.length;u++)if((m=a[u])&&`setAttribute`in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,a[u]=null;break}}if(e==null){if(b==null)return l.createTextNode(y);e=l.createElementNS(i,b,y.is&&y),s&&=(ZG.__m&&ZG.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=uK.call(e.childNodes),v=n.props||sK,!s&&a!=null)for(v={},u=0;u<e.attributes.length;u++)v[(m=e.attributes[u]).name]=m.value;for(u in v)if(m=v[u],u!=`children`){if(u==`dangerouslySetInnerHTML`)f=m;else if(!(u in y)){if(u==`value`&&`defaultValue`in y||u==`checked`&&`defaultChecked`in y)continue;EK(e,u,null,m,i)}}for(u in _=1&n.__u,y)m=y[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||v[u]===m&&!_||EK(e,u,m,v[u],i);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=``),xK(b==`template`?e.content:e,lK(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&_K(n,0),s,c,l),a!=null)for(u=a.length;u--;)fK(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||EK(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&EK(e,u,g,v[u],i))}return e}function NK(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){ZG.__e(e,n)}}function PK(e,t,n){var r,i;if(ZG.unmount&&ZG.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||NK(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){ZG.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&PK(r[i],t,n||typeof e.type!=`function`);n||fK(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function FK(e,t,n){return this.constructor(e,n)}function IK(e,t){var n,r,i,a;t==document&&(t=document.documentElement),ZG.__&&ZG.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=pK(hK,null,[e]),i=[],a=[],OK(t,e,r||sK,sK,t.namespaceURI,r?null:t.firstChild?uK.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),AK(i,e,a)}function LK(e,t){e.__u|=32,IK(e,t)}ZG={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t}}throw tK=0,e}},QG=0,gK.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=dK({},this.state);typeof e==`function`&&(e=e(dK({},n),this.props)),e&&dK(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),yK(this))},gK.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),yK(this))},gK.prototype.render=hK,$G=[],tK=0,nK=function(e,t){return e.__v.__b-t.__v.__b},rK=/(PointerCapture)$|Capture$/i,iK=0,aK=DK(!1),oK=DK(!0);var RK=0;Array.isArray;function zK(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--RK,__i:-1,__u:0,__source:i,__self:a};return ZG.vnode&&ZG.vnode(l),l}var BK=16,VK=16,HK={};function UK({name:e,remappedFrom:t,token:n,width:r,height:i,viewBox:a,label:o,alignCapitals:s=!1}){"use no memo";let c=`#${e.replace(/^#/,``)}`,{width:l,height:u,viewBox:d}=HK[e]??{width:BK,height:VK},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return zK(`svg`,{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":s,...o==null?{"aria-hidden":!0}:{"aria-label":o,role:`img`},viewBox:m,width:f,height:p,children:zK(`use`,{href:c})})}var WK=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},GK=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},KK=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`/`)+1,n=e.length-t>25,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},qK=(e,{splitIndex:t}={})=>{if(typeof t!=`number`){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}return[e.slice(0,t),e.slice(t)]},JK=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=e.length-t;return[e.slice(0,n),e.slice(n)]},YK=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=t;return[e.slice(0,n),e.slice(n)]};function XK({children:e,marker:t,variant:n=`default`}){"use no memo";return zK(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:zK(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?zK(`span`,{"data-truncate-fade":!0}):t})})}function ZK(e){"use no memo";let{mode:t,children:n}=e;return zK(`div`,{children:[zK(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?zK(`span`,{children:n}):n}),zK(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?zK(`span`,{children:n}):n})]})}function QK({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=zK(ZK,{mode:t,children:e},`content`),o=zK(XK,{marker:n,mode:t,variant:r},`marker`),s=zK(`div`,{"data-truncate-fill":!0},`fill`);return zK(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:zK(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function $K({children:e,...t}){"use no memo";return zK(QK,{mode:`truncate`,...t,children:e})}function eq({children:e,...t}){"use no memo";return zK(QK,{mode:`fruncate`,...t,children:e})}function tq({children:e,contents:t,priority:n=`end`,split:r=`center`,minimumLength:i=12,className:a,style:o,...s}){"use no memo";let c=null,l=null;if(Array.isArray(t)){if(t.length!==2)return console.error(`MiddleTruncate: contents must be an array of two items`),null;c=zK($K,{...s,children:t[0]}),l=zK(eq,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return zK(`div`,{className:a,style:o});if(e.length<i)return zK(n===`end`?eq:$K,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=WK:r===`extension`?t=GK:r===`leaf-path`&&(t=KK);else if(typeof r==`number`)t=qK,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=JK:e===`first`&&(t=YK)}else typeof r==`function`&&(t=r);t??=WK;let[f,p]=t(e,{priority:n,variant:s.variant,splitIndex:typeof u==`number`?u:void 0,splitOffset:typeof d==`number`?d:void 0}),m=f.length>=p.length,h=n===`equal`&&!m,g=n===`equal`&&m,_={},v={};h&&(_.marker=``),g&&(v.marker=``),c=zK($K,{...s,..._,children:f}),l=zK(eq,{...s,...v,children:p})}return zK(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[zK(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),zK(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var nq={endIndex:-1,startIndex:-1};function rq(e,t,n){return Math.min(Math.max(e,t),n)}function iq(e,t){return e<0||t<e?nq:{endIndex:t,startIndex:e}}function aq(e){return e.startIndex<0||e.endIndex<e.startIndex}function oq(e,t){return aq(e)?0:(e.endIndex-e.startIndex+1)*t}function sq(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function cq(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function lq(e){let t=new Map;return e.forEach((e,n)=>{if(e.kind!==`directory`||!e.isExpanded)return;let r=e.ancestorPaths.length,i=t.get(r);if(i==null){t.set(r,[n]);return}i.push(n)}),t}function uq(e,t){let n=0,r=e.length-1,i=-1;for(;n<=r;){let a=Math.floor((n+r)/2),o=e[a];if(o==null)break;if(o<=t){i=a,n=a+1;continue}r=a-1}return i}function dq(e){let t=new Map,n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(i==null)continue;let a=i.kind===`directory`&&i.isExpanded?[...i.ancestorPaths,i.path]:i.ancestorPaths,o=0;for(;o<n.length&&o<a.length&&n[o]===a[o];)o+=1;for(let e=n.length-1;e>=o;--e){let i=n[e];i!=null&&t.set(i,r-1)}n.length=o;for(let e=o;e<a.length;e+=1){let t=a[e];t!=null&&n.push(t)}}let r=e.length-1;for(let e of n)t.set(e,r);return t}function fq(e,t,n){if(e.length===0||t<=0)return[];let r=dq(e),i=lq(e),a=[];for(let r=0;r<e.length;r+=1){let o=i.get(r);if(o==null||o.length===0)break;let s=t+r*n,c=uq(o,Math.min(e.length-1,Math.floor(s/n))),l=null;for(;c>=0;){let t=o[c],n=t==null?null:e[t]??null;if(n!=null&&(r===0||n.ancestorPaths[r-1]===a[r-1]?.path)){l=n;break}--c}if(l==null)break;a.push(l)}return a.map((i,a)=>{let o=a*n,s=(r.get(i.path)??e.length-1)+1;if(s>=e.length)return{row:i,top:o};let c=s*n-t;return{row:i,top:Math.min(o,c-n)}}).filter(e=>e.top+n>0)}function pq(e,t){let n=t.totalRowCount??e.length,r=n*t.itemHeight,i=Math.max(0,t.viewportHeight),a=Math.max(0,Math.floor(t.overscan)),o=Math.max(0,r-i),s=rq(t.scrollTop,0,o),c=t.stickyRows??fq(e,s,t.itemHeight),l=c.reduce((e,n)=>Math.max(e,n.top+t.itemHeight),0),u=Math.min(r,s+l),d=Math.max(0,i-l),f=Math.max(0,r-u),p=sq(s,n,t.itemHeight),m=sq(u,n,t.itemHeight),h=l<=0||p<0||p>=n?-1:p,g=h===-1?-1:Math.min(n-1,m-1),_=h===-1||g<h?0:g-h+1,v=d<=0||m>=n?nq:iq(m,cq(u+d,n,t.itemHeight)),y=g+1,b=aq(v)?nq:iq(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=oq(b,t.itemHeight);return{occlusion:{firstOccludedIndex:h,lastOccludedIndex:g,occludedCount:_},physical:{itemHeight:t.itemHeight,maxScrollTop:o,overscan:a,scrollTop:s,totalHeight:r,totalRowCount:n,viewportHeight:i},projected:{contentHeight:f,paneHeight:d,paneTop:u},sticky:{height:l,rows:c},visible:v,window:{endIndex:b.endIndex,height:x,offsetTop:aq(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var mq={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},hq={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},gq=`Contains git status items`;function _q(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:i=0,viewportHeight:a}=e;if(n<0)return null;let o=Math.max(0,i),s=n*r,c=s+r;if(s<t+o){let e=Math.max(0,s-o);return e===t?null:e}if(c>t+a){let e=c-a;return e===t?null:e}return null}function vq(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return _q({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:a,viewportHeight:s});if(n<0)return null;let c=Math.max(0,a),l=n*r,u=Math.max(0,s-c),d=i===`center`?c+Math.max(0,(u-r)/2):c,f=Math.max(0,o-s),p=Math.max(0,Math.min(l-d,f));return p===t?null:p}function yq(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:i,totalHeight:a,viewportHeight:o}=e;if(n<0)return null;let s=Math.max(0,i),c=n*r,l=c+r,u=t+s,d=t+o;if(c>=u&&l<=d)return null;let f=Math.max(0,a-o),p=Math.max(0,Math.min(c-s,f));return p===t?null:p}function bq(e){if(e==null||!e.isConnected||e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement===e:document.activeElement===e}function xq(e){let t=e.getRootNode();if(t instanceof ShadowRoot){let e=t.activeElement;return e instanceof HTMLElement?e:null}let n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function Sq(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function Cq(e,t){return e!=null&&e>0?e:t}function wq(e){let t=e.borderBoxSize,n=Array.isArray(t)?t[0]:t;return n!=null&&Number.isFinite(n.blockSize)&&n.blockSize>0?n.blockSize:e.contentRect.height>0?e.contentRect.height:null}function Tq(e,t,n,r,i=0){let a=_q({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function Eq(e,t,n,r,i,a,o=0){let s=vq({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s==null?!1:(e.scrollTop=s,!0)}function Dq(e,t,n,r,i,a){let o=yq({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function Oq(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function kq(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function Aq({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return zK(`input`,{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:i,onInput:a,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})}function jq(e){let{row:t,mode:n,targetPath:r,ariaLabel:i,domId:a,isParked:o,itemHeight:s,features:c,state:l,extraStyle:u}=e,d=n===`sticky`,f=t.ancestorPaths.at(-1)??``,p={};return l.isFocusRinged&&(p[`data-item-focused`]=!0),t.isSelected&&(p[`data-item-selected`]=!0),l.isContextHovered&&(p[`data-item-context-hover`]=`true`),l.isDragTarget&&(p[`data-item-drag-target`]=!0),l.isDragging&&(p[`data-item-dragging`]=!0),l.effectiveGitStatus!=null&&(p[`data-item-git-status`]=l.effectiveGitStatus),l.containsGitChange&&(p[`data-item-contains-git-change`]=`true`),{"aria-expanded":!d&&t.kind===`directory`?t.isExpanded:void 0,"aria-haspopup":c.contextMenuEnabled?`menu`:void 0,"aria-label":i,"aria-level":d?void 0:t.level+1,"aria-posinset":d?void 0:t.posInSet+1,"aria-selected":d?void 0:t.isSelected?`true`:`false`,"aria-setsize":d?void 0:t.setSize,"data-file-tree-sticky-path":d?r:void 0,"data-file-tree-sticky-row":d?`true`:void 0,"data-item-context-menu-button-visibility":c.actionLaneEnabled?c.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":c.contextMenuEnabled?c.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":c.actionLaneEnabled?`true`:void 0,"data-item-has-git-lane":c.gitLaneActive?`true`:void 0,"data-item-parent-path":f.length>0?f:void 0,"data-item-parked":o?`true`:void 0,"data-item-path":r,"data-item-type":t.kind===`directory`?`folder`:`file`,"data-type":`item`,id:d?void 0:a,role:d?void 0:`treeitem`,style:{minHeight:`${s}px`,...u},tabIndex:!d&&t.isFocused?0:-1,...p}}function Mq(e){let{event:t,mode:n,isSearchOpen:r,isDirectory:i}=e,a=t.ctrlKey||t.metaKey,o=t.shiftKey||a,s=t.shiftKey?{additive:a,kind:`range`}:a?{kind:`toggle`}:{kind:`single`};return{closeSearch:r,revealCanonical:n===`sticky`,selection:s,toggleDirectory:!o&&i}}var Nq,Pq,Fq,Iq,Lq=Object.is,Rq=0,zq=[],Bq=ZG,Vq=Bq.__b,Hq=Bq.__r,Uq=Bq.diffed,Wq=Bq.__c,Gq=Bq.unmount,Kq=Bq.__;function qq(e,t){Bq.__h&&Bq.__h(Pq,e,Rq||t),Rq=0;var n=Pq.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function Jq(e){return Rq=1,Yq(sJ,e)}function Yq(e,t,n){var r=qq(Nq++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):sJ(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);Lq(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=Pq,!Pq.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,Lq(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};Pq.__f=!0;var a=Pq.shouldComponentUpdate,o=Pq.componentWillUpdate;Pq.componentWillUpdate=function(e,t,n){if(4&this.__g){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},Pq.shouldComponentUpdate=i}return r.__N||r.__}function Xq(e,t){var n=qq(Nq++,3);!Bq.__s&&oJ(n.__H,t)&&(n.__=e,n.u=t,Pq.__H.__h.push(n))}function Zq(e,t){var n=qq(Nq++,4);!Bq.__s&&oJ(n.__H,t)&&(n.__=e,n.u=t,Pq.__h.push(n))}function Qq(e){return Rq=5,$q(function(){return{current:e}},[])}function $q(e,t){var n=qq(Nq++,7);return oJ(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function eJ(e,t){return Rq=8,$q(function(){return e},t)}function tJ(){for(var e;e=zq.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(iJ),e.__H.__h.forEach(aJ),e.__H.__h=[]}catch(t){e.__H.__h=[],Bq.__e(t,e.__v)}}Bq.__b=function(e){Pq=null,Vq&&Vq(e)},Bq.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Kq&&Kq(e,t)},Bq.__r=function(e){Hq&&Hq(e),Nq=0;var t=(Pq=e.__c).__H;t&&(Fq===Pq?(t.__h=[],Pq.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(iJ),t.__h.forEach(aJ),t.__h=[],Nq=0)),Fq=Pq},Bq.diffed=function(e){Uq&&Uq(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(zq.push(t)!==1&&Iq===Bq.requestAnimationFrame||((Iq=Bq.requestAnimationFrame)||rJ)(tJ)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),Fq=Pq=null},Bq.__c=function(e,t){t.some(function(e){try{e.__h.forEach(iJ),e.__h=e.__h.filter(function(e){return!e.__||aJ(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],Bq.__e(n,e.__v)}}),Wq&&Wq(e,t)},Bq.unmount=function(e){Gq&&Gq(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{iJ(e)}catch(e){t=e}}),n.__H=void 0,t&&Bq.__e(t,n.__v))};var nJ=typeof requestAnimationFrame==`function`;function rJ(e){var t,n=function(){clearTimeout(r),nJ&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);nJ&&(t=requestAnimationFrame(n))}function iJ(e){var t=Pq,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),Pq=t}function aJ(e){var t=Pq;e.__c=e.__(),Pq=t}function oJ(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!Lq(t,e[n])})}function sJ(e,t){return typeof t==`function`?t(e):t}function cJ(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:zK(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return zK(hK,{children:[zK(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:zK($K,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function lJ(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function uJ(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function dJ(e,t,n,r){return e.map((e,i)=>{let a=i*n,o=e.subtreeEndIndex+1;if(o>=r)return{row:e.row,top:a};let s=o*n-t;return{row:e.row,top:Math.min(a,s-n)}}).filter(e=>e.top+n>0)}function fJ({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:i,viewportHeight:a}){let o=e.getVisibleCount(),s=i&&o>0?e.getStickyRowCandidates(r,t):[],c=s==null&&i&&o>0?e.getVisibleRows(0,o-1):[],l=pq(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:dJ(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?dJ(u,1,t,o):i&&r<=0&&c.length>0?fq(c,1,t):l.sticky.rows;return{overlayHeight:d.reduce((e,n)=>Math.max(e,n.top+t),0),overlayRows:d,snapshot:l,visibleRows:c}}var pJ=400,mJ=10,hJ=40,gJ=18;function _J(e,t,n){let r=e,i=document.elementFromPoint?.bind(document)??null,a=r.elementFromPoint?.(t,n)??i?.(t,n)??null;return e instanceof ShadowRoot&&(a==null||!e.contains(a))?vJ(e,t,n):a instanceof HTMLElement?a:null}function vJ(e,t,n){let r=Array.from(e.querySelectorAll(`[data-type="item"], [data-item-flattened-subitem]`));for(let e=r.length-1;e>=0;e--){let i=r[e],a=i.getBoundingClientRect();if(t>=a.left&&t<=a.right&&n>=a.top&&n<=a.bottom)return i}return null}function yJ(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return e?.closest?.(`[data-file-tree-virtualized-scroll]`)instanceof HTMLElement?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:null,kind:`root`}:null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function bJ(e){let t=e.cloneNode(!0);return t.removeAttribute(`id`),t.dataset.fileTreeDragPreview=`true`,t.setAttribute(`aria-hidden`,`true`),t.tabIndex=-1,Object.assign(t.style,{boxShadow:`0 4px 12px rgba(0, 0, 0, 0.15)`,left:`0px`,margin:`0`,pointerEvents:`none`,position:`fixed`,top:`0px`,willChange:`transform`,zIndex:`10000`}),t}function xJ(){return navigator.vendor!==`Apple Computer, Inc.`}function SJ(e,t){let n=e-t.top;if(n<hJ)return-Math.ceil((hJ-Math.max(0,n))/hJ*gJ);let r=t.bottom-e;return r<hJ?Math.ceil((hJ-Math.max(0,r))/hJ*gJ):0}function CJ(e,t){if(e!=null){let t=mq[e];return t==null?null:{text:t,title:hq[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:gq}:null}function wJ(e,t,n){if(t==null||t.size===0)return null;let r=[];for(let i=e.length-1;i>=0;--i){let a=e[i],o=n.get(a);if(o!=null){for(let e of r)n.set(e,o);return o?`ignored`:null}if(t.has(a)){n.set(a,!0);for(let e of r)n.set(e,!0);return`ignored`}r.push(a)}for(let e of r)n.set(e,!1);return null}function TJ(e){return e!=null&&`toggle`in e}function EJ(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function DJ(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function OJ(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function kJ(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function AJ(e,t){return t&&kJ(e)||(e.ctrlKey||e.metaKey)&&EJ(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var jJ=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function MJ(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&(t.dataset.fileTreeContextMenuRoot===`true`||t.dataset.type===`context-menu-anchor`||t.dataset.type===`context-menu-trigger`||t.getAttribute(`slot`)===`context-menu`))return!0;return!1}function NJ(e){return{bottom:e.bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width,x:e.x,y:e.y}}function PJ(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function FJ(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function IJ(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function LJ(e,t,n){if(e==null)return null;let r=t.get(e)??null;if(r!=null)return r;let i=n.get(e)??null;return i?.dataset.itemParked===`true`?null:i}function RJ(e){if(e==null)return[];let t=[];for(let n of e.querySelectorAll(`button[data-file-tree-sticky-row="true"]`)){if(!(n instanceof HTMLElement))continue;let e=n.dataset.fileTreeStickyPath;e!=null&&t.push(e)}return t}function zJ(e,t){if(e==null||t==null)return null;for(let n of e.querySelectorAll(`button[data-item-focused="true"][data-item-parked="true"]`))if(n instanceof HTMLElement&&n.dataset.itemPath===t)return n;return null}function BJ(e,t,n,r,i,a,o){let s=Math.max(0,a-i),c=t?.getBoundingClientRect()??null,l=c==null||n==null?null:n.getBoundingClientRect().top-c.top,u=zJ(e,r),d=c==null||u==null?null:u.getBoundingClientRect().top-c.top;return Math.max(0,Math.min(d??Math.max(l??0,s),Math.max(0,o-i)))}function VJ(e,t){return{kind:e.kind,name:uJ(e),path:t}}function HJ(e){return e==null?void 0:`${e}__tree`}function UJ(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function WJ(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function GJ(e,t){if(e==null)return null;if(`text`in e)return zK(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?WJ(e.icon)?t(e.icon):{name:e.icon}:WJ(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return zK(`span`,{title:e.title,children:zK(UK,{...n})})}function KJ(e){e!=null&&bq(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function qJ(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:i=!1,dragTargetFlattenedSegmentPath:a=null,gitDecoration:o=null,gitLaneActive:s=!1,renameInput:c=null,showDecorativeActionAffordance:l=!1}={}){let u=lJ(e);return zK(hK,{children:[e.depth>0?zK(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>zK(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,zK(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?zK(UK,{...t(`file-tree-icon-chevron`)}):zK(UK,{...t(`file-tree-icon-file`,u)})}),zK(`div`,{"data-item-section":`content`,children:e.isFlattened?cJ(e,c,a):c??zK(tq,{minimumLength:5,split:`extension`,children:e.name})}),i?zK(`div`,{"data-item-section":`decoration`,children:r==null?null:GJ(r,t)}):null,s?zK(`div`,{"data-item-section":`git`,children:GJ(o,t)}):null,n?zK(`div`,{"data-item-section":`action`,children:l?zK(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:zK(UK,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function JJ(e,t,n,r={}){let{controller:i,renameView:a,visualFocusPath:o,contextHoverPath:s,draggedPathSet:c,dragTarget:l,dragAndDropEnabled:u,shouldSuppressContextMenu:d,handleRowDragStart:f,handleRowDragEnd:p,handleRowTouchStart:m,instanceId:h,itemHeight:g,gitStatusByPath:_,ignoredGitDirectories:v,ignoredInheritanceCache:y,directoriesWithGitChanges:b,gitLaneActive:x,contextMenuEnabled:S,contextMenuTriggerMode:C,contextMenuButtonTriggerEnabled:w,contextMenuButtonVisibility:T,contextMenuRightClickEnabled:E,registerRenameInput:D,registerButton:O,resolveIcon:k,renderDecorationForRow:A,openContextMenuForRow:j,onRowClick:M,onKeyDown:N}=e,P=lJ(t),{isParked:F=!1,mode:I=`flow`,style:L}=r,R=I===`sticky`,z=_?.get(P)??null??wJ(t.ancestorPaths,v,y),B=t.kind===`directory`&&(b?.has(P)??!1),V=A(t,P),H=CJ(z,B),U=S&&w,ee=V!=null||x||U,W=U&&T===`always`,G=a.getPath()===P,K=G?a.getValue():``,te=R||!G?null:zK(Aq,{ref:D,ariaLabel:`Rename ${uJ(t)}`,isFlattened:t.isFlattened,value:K,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),ne=qJ(t,k,{actionLaneEnabled:U,customDecoration:V,decorationLaneEnabled:ee,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:H,gitLaneActive:x,renameInput:te,showDecorativeActionAffordance:W}),q={...jq({ariaLabel:uJ(t),domId:t.isFocused?UJ(h,P,F):void 0,extraStyle:L,features:{actionLaneEnabled:U,contextMenuButtonVisibility:U?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:F,itemHeight:g,mode:I,row:t,state:{containsGitChange:B,effectiveGitStatus:z,isContextHovered:s===P,isDragTarget:l?.kind===`directory`&&l.directoryPath===P,isDragging:c?.has(P)===!0,isFocusRinged:t.isFocused&&o===P},targetPath:P}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),E&&(i.focusMountedPathFromInput(P),j(t,P,{anchorRect:PJ(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:R?void 0:()=>{i.focusMountedPathFromInput(P)},onKeyDown:R?void 0:N,ref:e=>{O(P,e)}};return!R&&G?zK(`div`,{...q,children:ne}):zK(`button`,{...q,type:`button`,draggable:u&&!F,onDragEnd:u&&!F?p:void 0,onDragStart:u&&!F?e=>{f(e,t,P)}:void 0,onMouseDown:e=>{if(R){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!F?e=>{m(e,t,P)}:void 0,onClick:e=>{M(e,t,P,I)},children:ne})}function YJ(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(lJ(e))).map((n,r)=>JJ(e,n,t.start+r))}function XJ({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=JW,overscan:c=10,renamingEnabled:l=!1,renderRowDecoration:u,searchBlurBehavior:d=`close`,searchEnabled:f=!1,searchFakeFocus:p=!1,slotHost:m,stickyFolders:h=!1,initialViewportHeight:g=420}){"use no memo";let _=Qq(null),v=Qq(null),y=Qq(!1),b=Qq(null),x=Qq(null),S=Qq(null),C=Qq(null),w=Qq(null),T=Qq(new Map),E=Qq(new Map),D=Qq(()=>{}),O=Qq(null),k=Qq(0),A=Qq(!1),j=Qq(null);j.current!==t&&(A.current=!1,j.current=t);let M=Qq(!1),N=Qq(null),P=Qq(null),F=Qq(!1),I=Qq(null),L=Qq(null),R=Qq(null),z=Qq(null),B=Qq(null),V=Qq(null),H=Qq(null),U=Qq(null),ee=Qq(!1),W=Qq(null),G=Qq(null),K=Qq(null),te=Qq(null),ne=$q(()=>new Map,[]),[,q]=Jq(0),[re,ie]=Jq(null),[ae,oe]=Jq(null),[se,ce]=Jq(null),[le,ue]=Jq(null),[de,fe]=Jq(0),[pe,me]=Jq(null),he=Qq(pe);he.current=pe;let ge=Qq(null),_e=Qq(null),ve=Qq(null),ye=Qq(null),be=Qq(null),xe=Qq(!1),Se=()=>{_e.current=null,ve.current=null,ye.current=null},Ce=(e,t)=>{_e.current=e,ve.current=null,ye.current=t==null?null:{path:e,scrollTop:t}},we=(e,t)=>{_e.current=null,ve.current={path:e,viewportOffset:t},ye.current=null},Te=Qq(d===`retain`&&t.isSearchOpen()),[Ee,De]=Jq(p);Xq(()=>{p||De(!1)},[p]);let Oe=Qq(!1),ke=eJ(()=>{Oe.current=!0,De(e=>e&&!1)},[]),[Ae,je]=Jq(()=>fJ({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Me,Ne]=Jq(!1);Xq(()=>{Ne(!0)},[]);let Pe=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Fe=e?.contextMenu?.triggerMode??(Pe?`right-click`:`both`),Ie=Fe===`both`||Fe===`button`,Le=e?.contextMenu?.buttonVisibility??`when-needed`,Re=Fe===`both`||Fe===`right-click`;Zq(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;be.current=t,oe(t),ue(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(xe.current=e.detail?.disabled===!0)};return e.addEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.addEventListener(`file-tree-debug-set-scroll-suppression`,n),()=>{e.removeEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.removeEventListener(`file-tree-debug-set-scroll-suppression`,n)}},[]);let ze=eJ((e,t)=>{IJ(T.current,e,t)},[]),Be=eJ((e,t)=>{IJ(E.current,e,t)},[]),Ve=eJ(e=>{x.current=e},[]),He=eJ(e=>LJ(e,E.current,T.current),[]),Ue=n!=null||r!=null||i!=null,{resolveIcon:We}=$q(()=>aV(a),[a]),Ge=t[zG](),Ke=Ge.getPath(),qe=Ke!=null,Je=t.isSearchOpen(),Ye=t.getSearchValue(),Xe=t.getFocusedPath(),Ze=t.getFocusedIndex(),Qe=t.getScrollRequest(),$e=t.isDragAndDropEnabled(),et=t.getDragSession(),tt=$q(()=>et==null?null:new Set(et.draggedPaths),[et]),nt=et?.target??null,rt=et?.primaryPath??null,it=HJ(o),{overlayHeight:at,overlayRows:ot,snapshot:st,visibleRows:ct}=Ae,lt=st.physical.viewportHeight,ut=$q(()=>({end:st.window.endIndex,start:st.window.startIndex}),[st.window.endIndex,st.window.startIndex]),dt=ot,ft=st.sticky.rows,pt=st.physical.totalHeight,J=st.sticky.height,mt=$q(()=>new Set(ft.map(e=>lJ(e.row))),[ft]),ht=Ze>=0&&Ze>=ut.start&&Ze<=ut.end,gt=eJ((e,t)=>u?.({item:VJ(e,t),row:e})??null,[u]),_t=eJ(e=>bq(e==null?null:T.current.get(e)??null)?!0:bq(S.current),[]),vt=eJ(e=>{_t(t.focusNearestPath(e))},[t,_t]),yt=Qq(vt);yt.current=vt;let bt=Qq(!0),xt=Qq(()=>{}),St=eJ((t=!0)=>{let n=he.current;n!=null&&(bt.current=bt.current&&t,me(null),e?.contextMenu?.onClose?.(),bt.current&&vt(n.path))},[e?.contextMenu,vt]);xt.current=St;let Ct=eJ(e=>{let t=e==null?null:FJ(S.current,e);ce(e=>e===t?e:t)},[]),wt=eJ((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=He(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;Ce(n,e?.scrollTop??null),M.current=!0,ie(e=>e===n?e:n)}i.focus(),Ct(a),bt.current=!0,me({anchorRect:r?.anchorRect??null,item:VJ(e,n),path:n,source:r?.source??`keyboard`})},[t,He,Ct]),Tt=eJ(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=Sq(e,lt);I.current=Ze<0||e==null?null:Math.max(0,Math.min(Ze*s-e.scrollTop,Math.max(0,t-s))),F.current=!0}t.startRenaming(e)!==!1&&(ue(`focus`),q(e=>e+1))}},[t,Ze,s,l,lt]),Et=eJ((e,{restoreTreeFocus:n=!0,targetOffset:r=`live-overlay`}={})=>{let i=C.current;if(i==null)return!1;t.focusPath(e);let a=t.getFocusedIndex();if(a<0)return!1;let o=t.getVisibleRows(a,a)[0]??null;if(o==null)return!1;let l=Sq(i,lt),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:fJ({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return M.current=!0,Dq(i,a,s,l,u,d),D.current(),ge.current=n?e:null,!0},[t,s,c,lt,h]),Dt=()=>y.current===!0||te.current!=null||ee.current===!0,Ot=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),kt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},At=()=>{z.current!=null&&(clearTimeout(z.current),z.current=null),R.current=null},jt=()=>{V.current?.remove(),V.current=null},Mt=()=>{kt(L.current),L.current=null,B.current=null},Nt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Pt=()=>{U.current?.(),U.current=null,te.current!=null&&(clearTimeout(te.current),te.current=null),ee.current=!1,W.current=null,K.current=null,G.current!=null&&(G.current.setAttribute(`draggable`,`true`),G.current.style.removeProperty(`touch-action`),G.current=null),jt(),At(),Mt(),H.current=null},Ft=(e,n)=>{let r=S.current?.getRootNode(),i=yJ(_J(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},It=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){At();return}let r=t.getItem(e.directoryPath),i=TJ(r)?r:null;if(i==null||i.isExpanded()){At();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;R.current!==a&&(At(),R.current=a,z.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind!==`directory`||n.directoryPath!==e.directoryPath||n.flattenedSegmentPath!==e.flattenedSegmentPath||i.expand()},n))},Lt=()=>{L.current=null;let e=B.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=SJ(e.clientY,r);if(i===0)return;let a=Math.max(0,n.scrollHeight-n.clientHeight),o=Math.max(0,Math.min(a,n.scrollTop+i));o!==n.scrollTop&&(n.scrollTop=o,D.current()),It(Ft(e.clientX,e.clientY)),L.current=Ot(Lt)},Rt=(e,t)=>{B.current={clientX:e,clientY:t},L.current??=Ot(Lt)},zt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Pt(),jt(),At(),Mt(),t.startDrag(r)===!1){e.preventDefault();return}if(H.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),xJ())){let t=bJ(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Nt(t),V.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Bt=()=>{jt(),At(),Mt(),H.current=null,t.cancelDrag()},Vt=(e,n,r)=>{if(te.current!=null||ee.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;K.current={clientX:i.clientX,clientY:i.clientY},G.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!ee.current;te.current!=null&&(clearTimeout(te.current),te.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),U.current===o&&(U.current=null),t&&(a.setAttribute(`draggable`,`true`),G.current===a&&(G.current=null),K.current=null)},s=e=>{let t=e.touches[0],n=K.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=mJ*mJ||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),U.current=o,te.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),G.current===a&&(G.current=null),K.current=null;return}ee.current=!0,G.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),H.current=n;let e=a.getBoundingClientRect(),s=bJ(a);Object.assign(s.style,{height:`${e.height}px`,opacity:`0.85`,transform:`translate3d(${e.left}px, ${e.top}px, 0)`,width:`${e.width}px`}),Nt(s),V.current=s,W.current={x:i.clientX-e.left,y:i.clientY-e.top};let c=e=>{let t=e.touches[0];if(t==null)return;e.preventDefault();let n=W.current;n!=null&&V.current!=null&&(V.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),It(Ft(t.clientX,t.clientY)),Rt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&Ft(n.clientX,n.clientY),t.completeDrag(),Pt()},u=()=>{t.cancelDrag(),Pt()};U.current=()=>{document.removeEventListener(`touchmove`,c),document.removeEventListener(`touchend`,l),document.removeEventListener(`touchcancel`,u)},document.addEventListener(`touchmove`,c,{passive:!1}),document.addEventListener(`touchend`,l),document.addEventListener(`touchcancel`,u)},pJ)},Ht=e=>{if(pe!=null){if(e.key===`Escape`){St(),e.preventDefault(),e.stopPropagation();return}jJ.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(Ge.isActive()){if(e.key===`Escape`)Ge.cancel();else if(e.key===`Enter`)Ge.commit();else return;ue(`focus`),q(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){Tt(Xe??void 0),e.preventDefault(),e.stopPropagation();return}if(Je){if(e.key===`Escape`)F.current=!1,I.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=Sq(n,lt);I.current=Ze<0||n==null?null:Math.max(0,Math.min(Ze*s-n.scrollTop,Math.max(0,r-s))),F.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;ue(`focus`),q(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&DJ(e)){t.openSearch(e.key),q(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Pe&&kJ(e),r=AJ(e,Pe),i=r&&S.current!=null?xq(S.current):null,a=r?new Set(RJ(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==Xe&&a.has(o)){let e=C.current;Ce(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=TJ(p)?p:null,h=u!=null&&(mt.has(u)||c&&o===u&&a.has(u)),g=e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowRight`&&m!=null&&m.isExpanded(),_=e.key===`ArrowLeft`&&h&&m!=null&&m.isExpanded(),v=C.current,y=!0;if(e.shiftKey&&e.key===`ArrowDown`)t.extendSelectionFromFocused(1);else if(e.shiftKey&&e.key===`ArrowUp`)t.extendSelectionFromFocused(-1);else if(n&&u!=null&&d>=0){let e=t.getVisibleRows(d,d)[0]??null,n=LJ(u,E.current,T.current);e==null||n==null?y=!1:wt(e,u)}else if((e.ctrlKey||e.metaKey)&&EJ(e))t.toggleFocusedSelection();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`a`)t.selectAllVisiblePaths();else switch(e.key){case`ArrowDown`:t.focusNextItem();break;case`ArrowUp`:t.focusPreviousItem();break;case`ArrowRight`:m==null||m.isExpanded()?t.focusNextItem():m.expand();break;case`ArrowLeft`:m!=null&&m.isExpanded()?m.collapse():t.focusParentItem();break;case`Home`:t.focusFirstItem();break;case`End`:t.focusLastItem();break;default:y=!1}if(!y)return;ue(`focus`);let b=t.getFocusedPath(),x=b!=null&&(mt.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))Ce(b,v?.scrollTop??null),M.current=!0,ie(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(we(b,BJ(S.current,v,i,u,s,J,lt)),M.current=!0,ie(e=>e===b?e:b)):Se()}q(e=>e+1),e.preventDefault(),e.stopPropagation()};Zq(()=>{if(!(!f||!Je)){if(Te.current){Te.current=!1;return}bq(w.current)}},[Je,f]),Zq(()=>{let e=x.current;switch(kq({hasRenderedInput:e!=null,previousRenamingPath:P.current,renamingPath:Ke})){case`reset`:P.current=null;return;case`reveal-canonical`:Ke!=null&&Et(Ke,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(ge.current=null,P.current=Ke,bq(e),e.select());return}},[ut.end,ut.start,Ke,Et,mt]),Zq(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=xq(e)?.dataset.itemPath??null;ie(e=>e===t?e:t)},i=()=>{n(),M.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,xq(e)!=null){r();return}M.current=!1,ie(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),M.current=!1,ie(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;ie(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),Zq(()=>{let e=S.current;e!=null&&(st.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[st.physical.scrollTop]),Zq(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=Sq(n,g);let a=()=>{let e=t.getVisibleCount(),r=Cq(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),je(fJ({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!A.current){A.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=Cq(O.current,g),i=t.getVisibleRows(e,e)[0]??null;Tq(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}D.current=a;let o=!1,l=t.subscribe(()=>{o?q(e=>e+1):o=!0,a()}),u=()=>{xe.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),y.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,y.current=!1,fe(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||xe.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),he.current!=null&&y.current&&xt.current(),xe.current===!0){y.current=!1;return}oe(e=>e==null?e:null),u()},_=()=>{u(),p()},v=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),x=e=>{v.has(e.key)&&_()};n.addEventListener(`scroll`,m,{passive:!0}),n.addEventListener(`wheel`,_,{passive:!0}),n.addEventListener(`touchmove`,_,{passive:!0}),n.addEventListener(`keydown`,x);let w=typeof ResizeObserver<`u`?new ResizeObserver(e=>{O.current=(e[0]==null?null:wq(e[0]))??Sq(n,g),a()}):null;return w?.observe(n),()=>{D.current=()=>{},l(),n.removeEventListener(`scroll`,m),n.removeEventListener(`wheel`,_),n.removeEventListener(`touchmove`,_),n.removeEventListener(`keydown`,x),e!=null&&clearTimeout(e),d!=null&&clearTimeout(d),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,O.current=null,w?.disconnect()}},[t,g,s,c,h]),Zq(()=>{Pe||pe==null||St(!1)},[St,Pe,pe]);let Ut=$q(()=>pe==null?null:`${pe.path}::${pe.source}`,[pe]);Zq(()=>{if(Ut==null){m?.clearSlotContent(ZB);return}let t=he.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??NJ(n.getBoundingClientRect()),close:e=>{xt.current(e?.restoreFocus??!0)},restoreFocus:()=>{bt.current&&yt.current(he.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(ZB,i),e?.contextMenu?.onOpen?.(t.item,r),KJ(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&KJ(i)}),()=>{m?.clearSlotContent(ZB)}},[Ut,e?.contextMenu,m]),Zq(()=>{pe!=null&&t.getItem(pe.path)==null&&St()},[St,pe,t]),Zq(()=>{if(pe==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(MJ(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&St())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),St())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[St,pe]),Zq(()=>{let e=C.current,n=S.current;if(e==null||n==null){N.current=Xe;return}let r=Xe==null?null:T.current.get(Xe)??null,i=xq(n),a=i?.dataset.itemPath??null,o=qe&&x.current===i,c=f&&w.current===i,l=F.current&&!Je,u=I.current??0,d=ge.current,p=_e.current,m=ve.current,g=ye.current,_=i!=null,v=M.current||_,y=N.current!==Xe,b=p!=null&&p===Xe&&Xe!=null,E=!1,O=!1;if(Qe!=null&&Qe.id!==k.current){k.current=Qe.id;let n=Qe.visibleIndex,r=t.getVisibleRows(n,n)[0]??null;if(r!=null){let t=h?Math.max(0,Math.min(r.ancestorPaths.length*s,Math.max(0,lt-s))):J;E=!0,O=Eq(e,n,s,lt,pt,Qe.offset,t)}t.clearScrollRequest(Qe.id)}let A=!E&&l&&Dq(e,Ze,s,lt,pt,u),j=!E&&d!=null&&d===Xe&&Dq(e,Ze,s,lt,pt,J),P=!E&&m!=null&&m.path===Xe&&Dq(e,Ze,s,lt,pt,m.viewportOffset),L=!E&&g!=null&&g.path===Xe&&e.scrollTop!==g.scrollTop;if(L&&(e.scrollTop=g.scrollTop),(L||O||j||P||A||v&&y&&d!==Xe&&!b&&Tq(e,Ze,s,lt,J))&&D.current(),E){N.current=Xe;return}if(!v){N.current=Xe;return}if(o){N.current=Xe;return}if(c&&!l){N.current=Xe;return}if(r==null){l&&Ze>=0&&(Dq(e,Ze,s,lt,pt,u),D.current()),N.current=Xe;return}(y||l||d===Xe||p===Xe||m?.path===Xe||g?.path===Xe||a==null||a!==Xe)&&(bq(r),d===Xe&&(ge.current=null),p===Xe&&(_e.current=null),m?.path===Xe&&(ve.current=null),g?.path===Xe&&(ye.current=null),F.current=!1,I.current=null),N.current=Xe},[t,Ze,Xe,ht,s,qe,Je,ut,lt,f,Qe,h,J,pt,ct]);let Wt=Ze>=0&&Ze>=st.visible.startIndex&&Ze<=st.visible.endIndex,Gt=Xe!=null&&dt.some(e=>lJ(e.row)===Xe),Kt=Wt||Gt,qt=Ie&&M.current===!0&&Kt?Xe:null,Jt=le===`pointer`?ae:null,Y=pe?.path??be.current??Jt??qt??ae,Yt=pe?.source===`right-click`;Zq(()=>{y.current&&pe==null||Ct(He(Y))},[pe,He,ut,lt,de,dt,Y,Ct,ct]);let Xt=eJ(e=>{if(y.current||MJ(e))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest?.(`[data-type="context-menu-trigger"]`)!=null)return;let n=t.closest?.(`[data-file-tree-sticky-row="true"]`),r=t.closest?.(`[data-type="item"]`),i=n instanceof HTMLElement?n.dataset.fileTreeStickyPath??null:r instanceof HTMLElement?r.dataset.itemPath??null:null;i!=null&&ue(e=>e===`pointer`?e:`pointer`),oe(e=>e===i?e:i)},[]),Zt=eJ(()=>{oe(null)},[]);Zq(()=>{if(!$e)return;let e=()=>{Pt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Pt(),t.cancelDrag()}},[t,$e]);let X=e=>{if(!$e||t.getDragSession()==null||ee.current)return;let n=yJ(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),It(t.getDragSession()?.target??null),Rt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},Qt=e=>{if(!$e||t.getDragSession()==null||ee.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(At(),Mt(),t.setDragTarget(null))},$t=e=>{!$e||t.getDragSession()==null||ee.current||(e.preventDefault(),Ft(e.clientX,e.clientY),t.completeDrag(),jt(),At(),Mt(),H.current=null)},en=st.window.height,tn=st.window.offsetTop,nn=Math.min(0,lt-en),rn=Math.min(0,lt-en-J),an=re===Xe||F.current,on=Xe!=null&&an&&!ht&&Ze>=0?ct[Ze]??t.getVisibleRows(Ze,Ze)[0]??null:null,sn=on==null?null:Oq(Ze,s,ut,en),cn=H.current,ln=rt!=null&&cn!=null&&cn.path===rt&&cn.index>=ut.start&&cn.index<=ut.end,un=rt!=null&&cn!=null&&cn.path===rt&&!ln&&cn.path!==on?.path?cn:null,dn=un==null?null:Oq(un.index,s,ut,en),fn=OJ((Ze>=0?ct[Ze]??t.getVisibleRows(Ze,Ze)[0]??null:null)?.ancestorPaths.at(-1)??null),pn=Je&&Xe!=null?UJ(o,Xe,!ht):void 0,mn=pe?.path??(Je?Xe:re),hn=pe?.path??ae,gn=He(Y),_n=Pe&&Ie&&!Yt&&!qe&&gn!=null&&se!=null&&Y!=null,vn=Pe&&(_n||pe!=null),yn=pe?.anchorRect,bn=yn==null&&gn!=null&&se!=null&&(pe!=null||_n)?se:null,xn=yn==null?bn==null?void 0:{top:`${bn}px`}:{left:`${yn.left}px`,position:`fixed`,right:`auto`,top:`${yn.top}px`},Sn=Yt?{opacity:`0`}:void 0,Cn=eJ((e,n,r,i)=>{let a=Mq({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:Je,mode:i}),o=a.toggleDirectory&&n.kind===`directory`,s=o?t.resolveMountedDirectoryPathFromInput(r):null;if(o&&s==null)return;let c=s??r;switch(a.selection.kind){case`range`:t.selectPathRange(c,a.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(c);break;case`single`:t.selectOnlyMountedPathFromInput(c);break}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=st.visible.startIndex&&n.index<=st.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(M.current=!0,ie(e=>e===c?e:c),ue(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&Et(c,{targetOffset:`sticky-parents`})},[t,Je,st.visible.endIndex,st.visible.startIndex,Et]),wn=()=>{if(y.current||!Ie||Y==null||gn==null)return;let e=t.getItem(Y);e!=null&&(Ct(gn),bt.current=!0,me({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:gn.getAttribute(`aria-label`)??Y,path:e.getPath()},path:e.getPath(),source:`button`}))},Tn={contextHoverPath:hn,contextMenuButtonTriggerEnabled:Ie,contextMenuButtonVisibility:Le,contextMenuEnabled:Pe,contextMenuRightClickEnabled:Re,contextMenuTriggerMode:Fe,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:$e,draggedPathSet:tt,dragTarget:nt,gitLaneActive:Ue,gitStatusByPath:n,handleRowDragEnd:Bt,handleRowDragStart:zt,handleRowTouchStart:Vt,ignoredGitDirectories:r,ignoredInheritanceCache:ne,instanceId:o,itemHeight:s,onKeyDown:Ht,onRowClick:Cn,openContextMenuForRow:wt,registerButton:ze,registerRenameInput:Ve,renameView:Ge,renderDecorationForRow:gt,resolveIcon:We,shouldSuppressContextMenu:Dt,visualFocusPath:mn},En={...Tn,registerButton:Be};return zK(`div`,{ref:S,id:it,"data-file-tree-context-menu-button-visibility":Pe&&Ie?Le:void 0,"data-file-tree-context-menu-trigger-mode":Pe?Fe:void 0,"data-file-tree-has-context-menu-action-lane":Pe&&Ie?`true`:void 0,"data-file-tree-has-git-lane":Ue?`true`:void 0,"data-file-tree-virtualized-root":`true`,"data-file-tree-root-drag-target":nt?.kind===`root`?`true`:void 0,onDragLeave:$e?Qt:void 0,onDragOver:$e?X:void 0,onDrop:$e?$t:void 0,onKeyDown:Ht,onPointerLeave:Pe?Zt:void 0,onPointerOver:Pe?Xt:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[zK(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:fn}}),zK(`slot`,{name:XB,"data-type":`header-slot`}),f?zK(`div`,{"data-file-tree-search-container":!0,"data-open":Je?`true`:`false`,children:zK(`input`,{ref:w,"aria-activedescendant":pn,"aria-controls":it,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Ee?`true`:void 0,value:Ye,onBlur:()=>{d===`retain`&&!Oe.current||t.closeSearch()},onFocus:ke,onPointerDown:ke,onInput:e=>{ke();let n=e.currentTarget;t.setSearch(n.value)}})}):null,zK(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Me&&dt.length>0?zK(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:zK(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${at}px`},children:dt.map((e,t)=>JJ(En,e.row,`sticky:${lJ(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${dt.length-t}`}}))})}):null,zK(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${pt}px`},children:[zK(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${tn}px`}}),zK(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${en}px`,top:`${nn}px`,bottom:`${rn}px`},children:[YJ(Tn,ut,mt),on!=null&&sn!=null?JJ(Tn,on,`parked:${on.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:rt===on.path?`none`:void 0,position:`absolute`,right:`0`,top:`${sn}px`}}):null,un!=null&&dn!=null?JJ(Tn,un,`parked-drag:${un.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${dn}px`}}):null]})]})]}),Pe?zK(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":vn?`true`:`false`,style:xn,children:[zK(`button`,{ref:v,type:`button`,"data-type":QB,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":pe==null?`false`:`true`,"data-visible":_n?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),pe!=null){St();return}wn()},tabIndex:-1,style:Sn,children:zK(UK,{...We(`file-tree-icon-ellipsis`)})}),pe==null?null:zK(`slot`,{name:ZB})]}):null,pe==null?null:zK(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),St()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),St()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var ZJ={hydrateRoot:(e,t)=>{LK(pK(XJ,t),e)},renderRoot:(e,t)=>{IK(pK(XJ,t),e)},unmountRoot:e=>{IK(null,e)}};function QJ(e,t){ZJ.renderRoot(e,t)}function $J(e,t){ZJ.hydrateRoot(e,t)}function eY(e){ZJ.unmountRoot(e)}var tY=class{#e=new Map;#t=null;clearAll(){for(let e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){let t=this.#n(e);t!=null&&(t.remove(),this.#e.delete(e))}setHost(e){if(this.#t=e,e!=null){this.#i(e);for(let[e,t]of this.#e)this.#r(e,t)}}setSlotContent(e,t){let n=this.#n(e);if(n===t){t!=null&&(this.#e.set(e,t),this.#r(e,t));return}if(n?.remove(),t==null){this.#e.delete(e);return}this.#e.set(e,t),this.#r(e,t)}setSlotHtml(e,t){let n=t?.trim()??``;if(n.length===0){this.setSlotContent(e,null);return}let r=this.#n(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#r(e,r);return}let i=document.createElement(`div`);i.innerHTML=n,this.setSlotContent(e,i)}#n(e){let t=this.#e.get(e)??null;if(t!=null)return t;let n=this.#t;if(n==null)return null;for(let t of Array.from(n.children))if(t instanceof HTMLElement&&t.dataset.fileTreeManagedSlot===e)return t;return null}#r(e,t){t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t&&this.#t.appendChild(t)}#i(e){for(let t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;let e=t.dataset.fileTreeManagedSlot;e==null||this.#e.has(e)||this.#e.set(e,t)}}},nY=`__c`,rY=`__k`,iY=`__d`,aY=`__s`,oY=/[\s\n\\/='"\0<>]/,sY=/^(xlink|xmlns|xml)([A-Z])/,cY=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,lY=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,uY=new Set([`draggable`,`spellcheck`]);function dY(e){e.__g===void 0?e[iY]=!0:e.__g|=8}function fY(e){e.__g===void 0?e[iY]=!1:e.__g&=-9}function pY(e){return e.__g===void 0?!0===e[iY]:!!(8&e.__g)}var mY=/["&<]/;function hY(e){if(e.length===0||!1===mY.test(e))return e;for(var t=0,n=0,r=``,i=``;n<e.length;n++){switch(e.charCodeAt(n)){case 34:i=`&quot;`;break;case 38:i=`&amp;`;break;case 60:i=`&lt;`;break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=i,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var gY={},_Y=new Set(`animation-iteration-count.border-image-outset.border-image-slice.border-image-width.box-flex.box-flex-group.box-ordinal-group.column-count.fill-opacity.flex.flex-grow.flex-negative.flex-order.flex-positive.flex-shrink.flood-opacity.font-weight.grid-column.grid-row.line-clamp.line-height.opacity.order.orphans.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.widows.z-index.zoom`.split(`.`)),vY=/[A-Z]/g;function yY(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:gY[n]||(gY[n]=n.replace(vY,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||_Y.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function bY(){this.__d=!0}function xY(e,t){return{__v:e,context:t,props:e.props,setState:bY,forceUpdate:bY,__d:!0,__h:[]}}function SY(e,t,n){if(!e.s){if(n instanceof CY){if(!n.s)return void(n.o=SY.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(SY.bind(null,e,t),SY.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var CY=function(){function e(){}return e.prototype.then=function(t,n){var r=new e,i=this.s;if(i){var a=1&i?t:n;if(a){try{SY(r,1,a(this.v))}catch(e){SY(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?SY(r,1,t?t(i):i):n?SY(r,1,n(i)):SY(r,2,i)}catch(e){SY(r,2,e)}},r},e}(),wY,TY,EY,DY,OY={},kY=Array.isArray,AY=Object.assign,jY=``,MY=`<!--$s-->`,NY=`<!--/$s-->`;function PY(e,t){var n,r=e.type,i=!0;return e[nY]?(i=!1,(n=e[nY]).state=n[aY]):n=new r(e.props,t),e[nY]=n,n.__v=e,n.props=e.props,n.context=t,dY(n),n.state??=OY,n[aY]??(n[aY]=n.state),r.getDerivedStateFromProps?n.state=AY({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[aY]===n.state?n.state:n[aY]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),EY&&EY(e),n.render(n.props,n.state,t)}function FY(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===jY)return jY;var s=typeof e;if(s!=`object`)return s==`function`?jY:s==`string`?hY(e):e+jY;if(kY(e)){var c,l=jY;i[rY]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=FY(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=jY,kY(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return jY;e.__=i,wY&&wY(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===hK){if(`tpl`in g){for(var x=jY,S=0;S<g.tpl.length;S++)if(x+=g.tpl[S],g.exprs&&S<g.exprs.length){var C=g.exprs[S];if(C==null)continue;typeof C!=`object`||C.constructor!==void 0&&!kY(C)?x+=C:x+=FY(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+hY(g.UNSTABLE_comment)+`-->`;v=g.children}else{if((_=h.contextType)!=null){var w=t[_.__c];b=w?w.props.value:_.__}var T=h.prototype&&typeof h.prototype.render==`function`;if(T)v=PY(e,b),y=e[nY];else{e[nY]=y=xY(e,b);for(var E=0;pY(y)&&E++<25;){fY(y),EY&&EY(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}dY(y)}if(y.getChildContext!=null&&(t=AY({},t,y.getChildContext())),T&&ZG.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===hK&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return FY(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[aY]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,OY),pY(y)?(v=PY(e,t),(y=e[nY]).getChildContext!=null&&(t=AY({},t,y.getChildContext())),FY(v=v!=null&&v.type===hK&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):jY}finally{TY&&TY(e),DY&&DY(e)}}}v=v!=null&&v.type===hK&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=FY(v,t,n,r,e,a,o);return TY&&TY(e),ZG.unmount&&ZG.unmount(e),e._suspended?typeof D==`string`?MY+D+NY:kY(D)?(D.unshift(MY),D.push(NY),D):D.then(function(e){return MY+e+NY}):D}catch(i){if(!a&&o&&o.onError){var O=function i(s){return o.onError(s,e,function(e,s){try{return FY(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(O!==void 0)return O;var k=ZG.__e;return k&&k(i,e),jY}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=FY(v,t,n,r,e,a,o);return e._suspended?MY+s+NY:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var A,j=`<`+h,M=jY;for(var N in g){var P=g[N];if(typeof(P=LY(P)?P.value:P)!=`function`||N===`class`||N===`className`){switch(N){case`children`:A=P;continue;case`key`:case`ref`:case`__self`:case`__source`:continue;case`htmlFor`:if(`for`in g)continue;N=`for`;break;case`className`:if(`class`in g)continue;N=`class`;break;case`defaultChecked`:N=`checked`;break;case`defaultSelected`:N=`selected`;break;case`defaultValue`:case`value`:switch(N=`value`,h){case`textarea`:A=P;continue;case`select`:r=P;continue;case`option`:r!=P||`selected`in g||(j+=` selected`)}break;case`dangerouslySetInnerHTML`:M=P&&P.__html;continue;case`style`:typeof P==`object`&&(P=yY(P));break;case`acceptCharset`:N=`accept-charset`;break;case`httpEquiv`:N=`http-equiv`;break;default:if(sY.test(N))N=N.replace(sY,`$1:$2`).toLowerCase();else{if(oY.test(N))continue;N[4]!==`-`&&!uY.has(N)||P==null?n?lY.test(N)&&(N=N===`panose1`?`panose-1`:N.replace(/([A-Z])/g,`-$1`).toLowerCase()):cY.test(N)&&(N=N.toLowerCase()):P+=jY}}P!=null&&!1!==P&&(j=!0===P||P===jY?j+` `+N:j+` `+N+`="`+(typeof P==`string`?hY(P):P+jY)+`"`)}}if(oY.test(h))throw Error(h+` is not a valid HTML tag name in `+j+`>`);if(M||(typeof A==`string`?M=hY(A):A!=null&&!1!==A&&!0!==A&&(M=FY(A,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),TY&&TY(e),DY&&DY(e),!M&&IY.has(h))return j+`/>`;var F=`</`+h+`>`,I=j+`>`;return kY(M)?[I].concat(M,[F]):typeof M==`string`?I+M+F:[I,M,F]}var IY=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function LY(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var RY=0;function zY(e){return e!=null&&e.length>0?e:(RY+=1,`pst_ft_${RY}`)}function BY({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??JW)}function VY(e){if(typeof document>`u`)return;let t=document.createElement(`div`);t.innerHTML=e;let n=t.querySelector(`svg`);return n instanceof SVGElement?n:void 0}function HY(e){return e.querySelector(`#file-tree-icon-chevron`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-file`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-dot`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-lock`)instanceof SVGElement}function UY(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var WY=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new tY;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y=null;#b;#x=!1;#S=!1;constructor(e){let{composition:t,density:n,fileTreeSearchMode:r,gitStatus:i,id:a,initialSearchQuery:o,icons:s,itemHeight:c,onSearchChange:l,onSelectionChange:u,overscan:d,renderRowDecoration:f,renaming:p,search:m,searchBlurBehavior:h,searchFakeFocus:g,stickyFolders:_,unsafeCSS:v,initialVisibleRowCount:y,...b}=e;this.#e=t,this.#n=zY(a),this.#p=XG(i),this.#m=s,this.#h=v,this.#r=u,this.#i=f,this.#a=p!=null&&p!==!1,this.#o=h,this.#s=m===!0,this.#c=g===!0,this.#u=qW(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new GG({...b,fileTreeSearchMode:r,initialSearchQuery:o,onSearchChange:l,renaming:p}),this.#v=this.#t.getSelectionVersion(),this.#y=this.#r==null?null:this.subscribe(()=>{this.#D()})}unmount(){this.#b!=null&&(eY(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}scrollToPath(e,t){this.#t.scrollToPath(e,t)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){this.#t.resetPaths(e,t)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),QJ(t.wrapper,this.#w()))}setGitStatus(e){this.#p=XG(e,this.#p);let t=this.#T();t!=null&&QJ(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),QJ(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),$J(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),QJ(r,this.#w())}#C(){return{initialViewportHeight:BY({initialVisibleRowCount:this.#d.initialVisibleRowCount,itemHeight:this.#d.itemHeight}),itemHeight:this.#d.itemHeight,overscan:this.#d.overscan,stickyFolders:this.#d.stickyFolders}}#w(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#p?.statusByPath,ignoredGitDirectories:this.#p?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#p?.directoriesWithChanges,icons:this.#m,instanceId:this.#n,renamingEnabled:this.#a,renderRowDecoration:this.#i,searchBlurBehavior:this.#o,searchEnabled:this.#s,searchFakeFocus:this.#c,slotHost:this.#l,...this.#C()}}#T(){let e=this.#f,t=this.#b;return e==null||t==null?null:{host:e,wrapper:t}}#E(e,t){let n=e.shadowRoot;n!=null&&(this.#k(n),this.#A(n)),this.#j(t)}#D(){let e=this.#r;if(e==null)return;let t=this.#t.getSelectionVersion();t!==this.#v&&(this.#v=t,e(this.#t.getSelectedPaths()))}#O(){let e=this.#e?.header?.render;if(e!=null){this.#l.setSlotContent(XB,e());return}this.#l.setSlotHtml(XB,this.#e?.header?.html??null)}#k(e){let t=UY(e).find(e=>HY(e)),n=VY(BB(eV(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=UY(e),n=t.find(e=>HY(e)),r=t.filter(e=>e!==n),i=eV(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=VY(i);if(a==null){for(let e of r)e.remove();return}if(!(r.length===1&&r[0].outerHTML===a.outerHTML)){for(let e of r)e.remove();e.appendChild(a)}}#j(e){let t=eV(this.#m);t.colored&&HB(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${KB}]`);if(this.#g==null&&t instanceof HTMLStyleElement&&(this.#g=t),this.#h==null||this.#h===``){this.#g?.remove(),this.#g=void 0,this.#_=void 0;return}this.#g?.parentNode===e&&this.#_===this.#h||(this.#g??=document.createElement(`style`),this.#g.setAttribute(KB,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=QW(this.#h),this.#_=this.#h)}#N(e){if(this.#b!=null)return this.#b;let t=e.shadowRoot;if(t==null)throw Error(`FileTree requires a shadow root`);let n=Array.from(t.children).filter(e=>e instanceof HTMLDivElement&&typeof e.dataset.fileTreeId==`string`&&e.dataset.fileTreeId.length>0),r=n.find(e=>e.dataset.fileTreeId===this.#n)??n[0];return r!=null&&(this.#n=r.dataset.fileTreeId??this.#n),this.#b=r??document.createElement(`div`),this.#b.dataset.fileTreeId=this.#n,this.#b.dataset.fileTreeVirtualizedWrapper=`true`,this.#E(e,this.#b),this.#b.parentNode!==t&&t.appendChild(this.#b),this.#b}#P(e,t){let n=e??this.#f??document.createElement(`file-tree-container`);t!=null&&n.parentNode!==t&&t.appendChild(n);let r=n.shadowRoot??n.attachShadow({mode:`open`});return iG(n,r),this.#M(r),n.dataset.fileTreeVirtualized=`true`,n.style.display=`flex`,this.#F(n),this.#l.setHost(n),this.#f=n,n}#F(e){e.style.getPropertyValue(`--trees-item-height`)===``&&(e.style.setProperty(`--trees-item-height`,`${String(this.#u.itemHeight)}px`),this.#x=!0),e.style.getPropertyValue(`--trees-density-override`)===``&&(e.style.setProperty(`--trees-density-override`,String(this.#u.factor)),this.#S=!0)}#I(e){this.#x&&=(e.style.removeProperty(`--trees-item-height`),!1),this.#S&&=(e.style.removeProperty(`--trees-density-override`),!1)}},GY=typeof window>`u`?Q.useEffect:Q.useLayoutEffect;function KY(e,t,n){let r=e==null?null:(0,Z.jsx)(`div`,{slot:XB,children:e}),i=t!=null&&n!=null?(0,Z.jsx)(`div`,{slot:ZB,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,Z.jsxs)(Z.Fragment,{children:[r,i]})}function qY(e,t){return typeof window>`u`&&t!=null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t.shadowHtml}}),e]}):(0,Z.jsx)(Z.Fragment,{children:e})}function JY(e){let t=e.shadowRoot;return t?.querySelector(`[data-file-tree-id]`)instanceof HTMLElement||t?.querySelector(`[data-file-tree-id]`)instanceof SVGElement?!0:e.querySelector(`template[shadowrootmode="open"]`)instanceof HTMLTemplateElement}function YY(e,t,n,r,i){let a={...e??{}};if(t!=null&&delete a.header,n){let t=e?.contextMenu,n=t?.onClose,o=t?.onOpen;a.contextMenu={...t??{},enabled:!0,onClose:()=>{n?.(),r()},onOpen:(e,t)=>{i(e,t),o?.(e,t)}},delete a.contextMenu.render}return a.header!=null||a.contextMenu!=null?a:void 0}function XY({header:e,id:t,model:n,preloadedData:r,renderContextMenu:i,...a}){let[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(n.getComposition()),d=(0,Q.useRef)(n);d.current!==n&&(d.current=n,u.current=n.getComposition());let f=i!=null,p=(0,Q.useCallback)(()=>{s(null)},[]),m=(0,Q.useCallback)((e,t)=>{s({context:t,item:e})},[]),h=u.current,g=(0,Q.useMemo)(()=>YY(h,e,f,p,m),[h,p,m,f,e]),_=(0,Q.useCallback)(e=>{l(e)},[]);(0,Q.useEffect)(()=>{f||s(null)},[f]),GY(()=>{n.setComposition(g)},[g,n]),GY(()=>{if(c!=null)return r!=null&&JY(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=qY(KY(e,i,o),r),y=t??r?.id,b={"--trees-item-height":`${String(n.getItemHeight())}px`,"--trees-density-override":n.getDensityFactor(),...a.style};return(0,Z.jsx)(WB,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}function ZY(e){let[t]=(0,Q.useState)(()=>new WY(e)),n=(0,Q.useRef)({timeout:null,model:t});return(0,Q.useEffect)(()=>{let{current:e}=n;return e.timeout!=null&&(clearTimeout(e.timeout),e.timeout=null),()=>{e.timeout=setTimeout(()=>e.model.cleanUp(),1)}},[]),{model:t}}function QY(){let e=(0,$.c)(16),{_:t}=mt(),{projectLocalBinding:n}=td(),r;e[0]!==t||e[1]!==n?(r=()=>{if(n===null)return;let e=n.patch({appearance:{sidebar:{showHiddenFiles:!1,showOnlyMarkdownFiles:!1,showOkFolders:!1}}});e.ok||(console.warn(`[FileTreeFilteredToZeroNotice] view-filter reset rejected:`,yi(e.error)),dl.error(t({id:`P47EWZ`}),{description:yi(e.error)}))},e[0]=t,e[1]=n,e[2]=r):r=e[2];let i=r,a;e[3]===t?a=e[4]:(a=t({id:`WHPvOb`}),e[3]=t,e[4]=a);let o;e[5]===a?o=e[6]:(o=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:a}),e[5]=a,e[6]=o);let s=n===null,c;e[7]===t?c=e[8]:(c=t({id:`jC8LSZ`}),e[7]=t,e[8]=c);let l;e[9]!==i||e[10]!==s||e[11]!==c?(l=(0,Z.jsx)(X,{variant:`link`,size:`sm`,className:`font-mono uppercase`,disabled:s,onClick:i,"data-testid":`reset-view-filters`,children:c}),e[9]=i,e[10]=s,e[11]=c,e[12]=l):l=e[12];let u;return e[13]!==o||e[14]!==l?(u=(0,Z.jsxs)(`div`,{"data-testid":`file-tree-filtered-to-zero`,className:`flex flex-1 flex-col items-center justify-center gap-3 py-8`,children:[o,l]}),e[13]=o,e[14]=l,e[15]=u):u=e[15],u}var $Y={density:`compact`,itemHeight:26,flattenEmptyDirectories:!1},eX={"--trees-level-gap-override":`4px`,"--trees-item-row-gap-override":`4px`,"--trees-icon-width-override":`14px`,"--trees-item-height":`${$Y.itemHeight}px`,"--trees-indent-guide-bg-override":`color-mix(in oklab, var(--trees-fg-muted) 30%, transparent)`},tX=`
1851
+ [data-item-section='spacing-item'] {
1852
+ opacity: 0.5;
1853
+ }
1854
+ :host(:hover) [data-item-section='spacing-item'] {
1855
+ opacity: 0.85;
1856
+ }
1857
+ `,nX=`
1858
+ [data-file-tree-sticky-overlay-content='true'] {
1859
+ --trees-bg: color-mix(in oklab, var(--sidebar) 92%, var(--sidebar-foreground) 8%);
1860
+ box-shadow: 0 1px 0 0 var(--sidebar-border);
1861
+ }
1862
+ /* Forced-colors mode suppresses box-shadow and overrides color-mix tints,
1863
+ so the divider above would vanish and the pinned region would read as
1864
+ part of scrolling content. Borders survive forced-colors — mirror the
1865
+ fallback pattern used by FILE_TREE_ROOT_DROP_CSS. */
1866
+ @media (forced-colors: active) {
1867
+ [data-file-tree-sticky-overlay-content='true'] {
1868
+ border-bottom: 1px solid CanvasText;
1869
+ }
1870
+ }
1871
+ `;function rX(e){return{...dV({type:e===`dark`?`dark`:`light`,colors:{"sideBar.background":`var(--sidebar)`,"sideBar.foreground":`var(--sidebar-foreground)`,"sideBar.border":`var(--sidebar-border)`,"list.activeSelectionBackground":`var(--sidebar-accent)`,"list.activeSelectionForeground":`var(--sidebar-accent-foreground)`,"list.hoverBackground":`var(--sidebar-hover)`,focusBorder:`var(--color-primary)`,"input.background":`var(--input)`,"input.border":`var(--border)`}}),"--trees-font-family-override":`var(--font-sans)`,"--trees-font-size-override":`0.875rem`,"--trees-item-padding-x-override":`0.5rem`,"--trees-padding-inline-override":`0.5rem`,"--trees-border-radius-override":`0.375rem`,"--trees-selected-fg":`var(--color-primary)`,"--truncate-marker-fade-in-duration":`0s`,"--trees-file-icon-color-markdown":`light-dark(var(--color-gray-400), var(--color-gray-500))`,"--trees-fg-muted":`light-dark(var(--color-gray-400), var(--color-gray-500))`,...eX}}var iX=`data-ok-ext-badge`,aX=`data-ok-ext-row`,oX=`data-ok-fullname-row`,sX=`
1872
+ [data-item-selected='true'] [data-icon-token='markdown'] {
1873
+ color: var(--trees-selected-fg);
1874
+ }
1875
+ [data-type='item'][${aX}] [data-truncate-segment-priority]:last-child {
1876
+ display: none;
1877
+ }
1878
+ [data-type='item'][${oX}] [data-truncate-segment-priority]:last-child {
1879
+ display: none;
1880
+ }
1881
+ [${iX}] {
1882
+ display: inline-block;
1883
+ margin-left: 0.375rem;
1884
+ margin-right: 0.25rem;
1885
+ align-self: center;
1886
+ color: color-mix(in oklab, var(--muted-foreground) 60%, transparent);
1887
+ font-size: 0.75rem;
1888
+ text-transform: uppercase;
1889
+ flex-shrink: 0;
1890
+ pointer-events: none;
1891
+ user-select: none;
1892
+ }
1893
+ `;function cX(e){let t=e.querySelectorAll(`[data-type="item"][data-item-path]`);for(let e of t){let t=e.dataset.itemPath;if(!t){uX(e);continue}if(t.endsWith(`/`)){fX(e,t);continue}let n=Nl(t);if(!n){uX(e);continue}let r=dX(e);if(r){if(e.setAttribute(aX,``),e.removeAttribute(oX),gX(r),n.toLowerCase()===`.md`){lX(e);continue}_X(e,n.slice(1).toUpperCase())}}}function lX(e){let t=e.querySelector(`[${iX}]`);t&&t.remove()}function uX(e){e.removeAttribute(aX),e.removeAttribute(oX),lX(e)}function dX(e){let t=e.querySelector(`[data-truncate-group-container="middle"]`);if(!t)return null;let n=t.querySelectorAll(`[data-truncate-segment-priority]`);return n.length<2?null:n[0]??null}function fX(e,t){e.removeAttribute(aX),lX(e);let n=dX(e),r=pX(t);if(!n||!r){e.removeAttribute(oX);return}hX(n,r),e.setAttribute(oX,``)}function pX(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n>=0?t.slice(n+1):t}function mX(e,t){let n=e.querySelectorAll(`[data-truncate-content]`);for(let e of n){let n=e.firstChild;if(!n||n.nodeType!==Node.TEXT_NODE)continue;let r=n.textContent??``,i=t(r);i!==r&&(n.textContent=i)}}function hX(e,t){mX(e,()=>t)}function gX(e){mX(e,e=>e.replace(/\.+$/,``))}function _X(e,t){let n=e.querySelector(`[${iX}]`);if(!n){n=e.ownerDocument.createElement(`span`),n.setAttribute(iX,``),n.setAttribute(`aria-hidden`,`true`);let t=e.querySelector(`[data-item-section="action"]`);t?t.before(n):e.appendChild(n)}n.textContent!==t&&(n.textContent=t)}var vX=`ok-file-tree-link-decoration`,yX=`ok-file-tree-agent-decoration`,bX=`ok-file-tree-markdown`,xX=`<symbol id="${bX}" viewBox="${ft}" fill="currentColor"><path d="${B}"/></symbol>`;function SX(e){return e.map(([e,{key:t,...n}])=>`<${e} ${Object.entries(n).map(([e,t])=>`${e}="${t}"`).join(` `)} />`).join(``)}function CX(e,t){return`<symbol id="${e}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${SX(t)}</symbol>`}var wX=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
1894
+ ${CX(vX,ve)}
1895
+ ${CX(yX,_o)}
1896
+ ${xX}
1897
+ </svg>`;function TX(e){return e.replace(/\\/g,`\\\\`).replace(/\[/g,`\\[`).replace(/\]/g,`\\]`).replace(/\*/g,`\\*`)}function EX(e){let t=TX(e.path);return e.kind===`folder`?`/${t}/`:`/${t}${e.docExt??`.md`}`}var DX=/\.(md|mdx)$/i;function OX(e){let t=e.match(/^"(.+)" already exists\.$/);return t?t[1]:null}function kX(e){let t=e.match(DX);return t?t[0]:null}var AX=new Set([`agents`,`agent`,`claude`,`skill`]);function jX(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&AX.has(t)}function MX(e,t){return Of({kind:e.endsWith(`/`)?`directory`:`file`,name:e,path:e},t)}function NX(e){let t=e.match(/\.(md|mdx)$/i);if(!t)return null;let n=t[0].toLowerCase()===`.md`?`.mdx`:`.md`;return`${e.slice(0,-t[0].length)}${n}`}function PX(e,t){let n=NX(e);return n?t.includes(n):!1}function FX(e,t){return e!==t&&e.startsWith(t)}function IX(e,t){let n=[...new Set(e)].filter(e=>!Bl(e)),r=n.filter(e=>e.endsWith(`/`));return n.filter(e=>!r.some(t=>FX(e,t))).map(e=>MX(e,t))}function LX(e,t){let n=e.getItem(t)??e.getItem(Wf(t));return n?.isDirectory()?Wf(Qf(n.getPath())):t}function RX(e){let t=e.getFocusedPath()??e.getSelectedPaths()[0]??null;return t?LX(e,t):null}function zX(e,t,n){let r=RX(e);return!r||n.has(r)||Bl(r)?null:MX(r,t)}function BX(e,t){let n=e.getSelectedPaths(),r=RX(e);return IX(n.length>0?n.map(t=>LX(e,t)):r?[r]:[],t)}function VX(e,t){return e===t||e.startsWith(`${t}/`)}function HX(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable||e.closest(`[contenteditable="true"]`)!==null}function UX(e,t,n){let r=new Set,i=new Set,a=new Set;for(let o of e){if(o.kind===`file`){r.add(o.path);continue}if(o.kind===`asset`){a.add(o.path);continue}i.add(o.path);for(let e of t)Fl(e)&&e.docName.startsWith(`${o.path}/`)?r.add(e.docName):Vl(e)&&e.path.startsWith(`${o.path}/`)&&a.add(e.path);for(let e of n){let t=Qf(e);VX(t,o.path)&&i.add(t)}}return{docNames:r,folderPaths:i,assetPaths:a}}function WX(e,t){return e.kind===`file`?t.kind===`file`&&e.path===t.createdPath:e.kind===`asset`?!1:VX(t.createdPath,e.path)}function GX(e){let t=new Map,n=new Map;for(let r of e)if(Fl(r)){let e=Kf(r.docName,r.docExt);t.has(e)||t.set(e,r)}else if(Rl(r)){let e=Wf(r.path);n.has(e)||n.set(e,r)}return{docsByTreePath:t,foldersByTreeDirectoryPath:n}}var KX=`data-ok-problem`,qX=`data-ok-problem-badge`,JX=`
1898
+ [data-type='item'][${KX}='warning'] [data-item-section='content'] {
1899
+ color: var(--ok-tree-problem-warning, oklch(70% 0.15 75));
1900
+ }
1901
+ [data-type='item'][${KX}='error'] [data-item-section='content'] {
1902
+ color: var(--ok-tree-problem-error, oklch(55% 0.15 25));
1903
+ }
1904
+ [${qX}] {
1905
+ display: inline-block;
1906
+ margin-left: 0.375rem;
1907
+ margin-right: 0.25rem;
1908
+ align-self: center;
1909
+ font-size: 0.6875rem;
1910
+ line-height: 1rem;
1911
+ min-width: 1rem;
1912
+ text-align: center;
1913
+ border-radius: 0.5rem;
1914
+ padding: 0 0.25rem;
1915
+ flex-shrink: 0;
1916
+ pointer-events: none;
1917
+ user-select: none;
1918
+ color: var(--ok-tree-problem-warning, oklch(70% 0.15 75));
1919
+ background: color-mix(in oklab, currentColor 14%, transparent);
1920
+ }
1921
+ [data-type='item'][${KX}='error'] [${qX}] {
1922
+ color: var(--ok-tree-problem-error, oklch(55% 0.15 25));
1923
+ }
1924
+ `;function YX(e,t){let n=e.querySelectorAll(`[data-type="item"][data-item-path]`);for(let e of n){let n=e.dataset.itemPath;if(!n||n.endsWith(`/`)){XX(e);continue}let r=t.get(su(n));if(r===void 0||r.errorCount===0&&r.warningCount===0){XX(e);continue}let i=r.errorCount>0?`error`:`warning`;e.getAttribute(`data-ok-problem`)!==i&&e.setAttribute(KX,i),ZX(e,r.errorCount+r.warningCount)}}function XX(e){e.hasAttribute(`data-ok-problem`)&&e.removeAttribute(KX),e.querySelector(`[${qX}]`)?.remove()}function ZX(e,t){let n=t>99?`99+`:String(t),r=e.querySelector(`[${qX}]`);if(!r){r=e.ownerDocument.createElement(`span`),r.setAttribute(qX,``),r.setAttribute(`aria-hidden`,`true`);let t=e.querySelector(`[data-item-section="action"]`);t?t.before(r):e.appendChild(r)}r.textContent!==n&&(r.textContent=n)}var QX=`data-ok-renaming`,$X=`data-ok-rename-selection-applied`,eZ=null,tZ=null,nZ=5e3,rZ=`
1925
+ /* Pierre's icon decoration keys off the row's data-item-path. If the user
1926
+ deletes the extension before commit, Pierre can temporarily key the row
1927
+ by an extensionless path and swap [data-icon-token] from 'markdown' to
1928
+ 'default' until the disk-truth refresh restores .md.
1929
+ Cover the wrong icon with a CSS-rendered markdown glyph for the duration.
1930
+ applyRenameInputAffordance records the in-flight markdown extension when
1931
+ the input mounts; the sweep stamps the marker only if Pierre later moves
1932
+ the row to an extensionless path, then clears it when the path next
1933
+ includes the saved extension (settle / cancel / row recycle to a settled
1934
+ file). */
1935
+ [${QX}='.md'] [data-item-section="icon"],
1936
+ [${QX}='.mdx'] [data-item-section="icon"] {
1937
+ position: relative;
1938
+ }
1939
+ [${QX}='.md'] [data-item-section="icon"] [data-icon-token]:not([data-icon-token='markdown']),
1940
+ [${QX}='.mdx'] [data-item-section="icon"] [data-icon-token]:not([data-icon-token='markdown']) {
1941
+ visibility: hidden;
1942
+ }
1943
+ [${QX}='.md'] [data-item-section="icon"]::before,
1944
+ [${QX}='.mdx'] [data-item-section="icon"]::before {
1945
+ content: '';
1946
+ display: block;
1947
+ position: absolute;
1948
+ inset: 0;
1949
+ margin: auto;
1950
+ width: 16px;
1951
+ height: 16px;
1952
+ background-color: currentColor;
1953
+ mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M1 12V4h2l2 2.5L7 4h2v8H7V7.5l-2 2-2-2V12zm9-3 3 3.5L16 9h-2V4h-2v5z'/></svg>") center / contain no-repeat;
1954
+ pointer-events: none;
1955
+ }
1956
+ `;function iZ(e){sZ(e);let t=e.querySelector(`[data-item-rename-input]`);if(!t)return;let n=t.closest(`[data-type="item"]`);if(!n)return;let r=n.dataset.itemPath??``;if(r.endsWith(`/`))return;let i=Nl(r);jl(r)&&aZ(i),!t.hasAttribute($X)&&(cZ(t),t.setAttribute($X,``))}function aZ(e){eZ=e,tZ!==null&&clearTimeout(tZ),tZ=setTimeout(oZ,nZ)}function oZ(){eZ=null,tZ!==null&&(clearTimeout(tZ),tZ=null)}function sZ(e){let t=e.querySelectorAll(`[${QX}]`);for(let e of t){if(e.querySelector(`[data-item-rename-input]`))continue;let t=e.getAttribute(QX);if(!t){e.removeAttribute(QX);continue}let n=e.dataset.itemPath??``;if(n.toLowerCase().endsWith(t.toLowerCase())){e.removeAttribute(QX);continue}let r=Nl(n);r&&r.toLowerCase()!==t.toLowerCase()&&e.removeAttribute(QX)}if(eZ===null)return;let n=e.querySelectorAll(`[data-type="item"][data-item-path]`),r=!1;for(let e of n){let t=e.dataset.itemPath??``;!t||t.endsWith(`/`)||Nl(t)||(r=!0,e.getAttribute(`data-item-selected`)===`true`&&e.getAttribute(`data-ok-renaming`)!==eZ&&e.setAttribute(QX,eZ))}let i=!!e.querySelector(`[data-item-rename-input]`);!r&&!i&&oZ()}function cZ(e){let t=Nl(e.value),n=t?e.value.length-t.length:e.value.length;e.setSelectionRange(0,n)}function lZ(e,t){e.getFocusedPath()===t&&e.scrollToPath(t,{offset:`nearest`,focus:!1})}function uZ(e){return{selectedFilePath:e,selectedFolderPath:null,navigationPath:e}}function dZ(e,t,n={}){if(!e)return uZ(t);let r=Gl(e);if(t&&r!==t)return uZ(t);switch(e.kind){case`doc`:return uZ(t??e.docName);case`large-file`:return uZ(e.docName);case`folder`:case`folder-index`:return{selectedFilePath:null,selectedFolderPath:e.folderPath,navigationPath:e.folderPath};case`missing`:return t&&n.isKnownDocument?.(t)?uZ(t):{selectedFilePath:null,selectedFolderPath:null,navigationPath:null};case`asset`:case`skill-file`:return{selectedFilePath:null,selectedFolderPath:null,navigationPath:null}}}function fZ(e,t){if(!e)return{kind:`none`};let n=t.find(t=>Pf(t)===e),r=Xf(e),i=e.endsWith(`/`)?r:Zf(e,t);return i===r?n&&Vl(n)?n.mediaKind===`mermaid`?{kind:`document`,path:n.path}:{kind:`asset`,path:n.path,hash:hu(n.path),mediaKind:n.mediaKind}:n&&Fl(n)?{kind:`document`,path:n.docName}:e.endsWith(`/`)?t.some(e=>Rl(e)?e.path===r||e.path.startsWith(`${r}/`):(Vl(e)?e.path:e.docName).startsWith(`${r}/`))?{kind:`folder`,path:r}:{kind:`none`}:t.some(e=>Fl(e)&&e.docName===r)?{kind:`document`,path:r}:{kind:`none`}:{kind:`document`,path:i}}var pZ=`You can restore this file from the Trash.`;function mZ(e){let t=pZ,n=`Move to Trash`,r=`Moving`;if(e.length===0)return{title:`Are you sure you want to delete the selected items?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r};if(e.length===1){let i=e[0];return i?i.kind===`folder`?{title:`Are you sure you want to delete '${i.name}' and its contents?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete '${i.name}'?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the selected item?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}}let i=e.some(e=>e.kind===`folder`),a=e.some(e=>e.kind!==`folder`);return i&&a?{title:`Are you sure you want to delete the following ${e.length} files/directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:i?{title:`Are you sure you want to delete the following ${e.length} directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the following ${e.length} files?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}}function hZ(e,t){return e===`web`?null:mZ(t)}function gZ(e){return e.kind===`folder`?`${e.name}/`:e.kind===`asset`?e.name:e.docExt?`${e.name}${e.docExt}`:e.name}function _Z(e,t,n){let r=fZ(e,t);if(r.kind===`none`)return null;if(r.kind===`asset`)return{v:1,kind:`asset`,assetPath:r.path,mediaKind:r.mediaKind};if(r.kind===`folder`)return{v:1,kind:`folder`,folderPath:r.path};let i=t.find(e=>Fl(e)&&e.docName===r.path);return{v:1,kind:`doc`,docName:r.path,size:i?.size??n?.get(r.path)?.size??null}}var vZ=[`not-found`,`permission-denied`,`system-error`,`path-escape`];function yZ(e){return typeof e==`string`&&vZ.includes(e)?e:`system-error`}function bZ(e){switch(e){case`not-found`:return vl._({id:`v41fCm`});case`permission-denied`:return vl._({id:`sJK6pq`});case`system-error`:return vl._({id:`Jqqevv`});case`path-escape`:return vl._({id:`WL6puM`})}}function xZ(e){let t=bZ(e.reason),n=e.detail;return n?vl._({id:`Z2M5XM`,values:{reason:t,osDetail:n}}):vl._({id:`dTaauv`,values:{reason:t}})}function SZ(e){return e.kind===`folder`?`${e.name}/`:e.name}function CZ(e){let t=(0,$.c)(34),{failedTargets:n,isSubmitting:r,onDeletePermanently:i,onRetry:a,onCancel:o}=e,s=n.length>1,c=n[0],l=n.length,u;if(t[0]!==l||t[1]!==s||t[2]!==c){let e=c?SZ(c):``;u=s?vl._({id:`5qNxOe`,values:{count:l}}):c?`${vl._({id:`E_BHoD`,values:{targetName:e}})}\n${xZ(c)}`:vl._({id:`kolRU1`}),t[0]=l,t[1]=s,t[2]=c,t[3]=u}else u=t[3];let d=u,f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(fn,{children:(0,Z.jsx)(J,{id:`aOp3hw`})}),t[4]=f):f=t[4];let p;t[5]===d?p=t[6]:(p=(0,Z.jsxs)(gn,{children:[f,(0,Z.jsx)(dn,{className:`whitespace-pre-wrap`,children:d})]}),t[5]=d,t[6]=p);let m;t[7]!==n||t[8]!==s?(m=s?(0,Z.jsx)(mn,{children:(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2 text-xs`,children:n.map(wZ)})}):null,t[7]=n,t[8]=s,t[9]=m):m=t[9];let h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(J,{id:`dEgA5A`}),t[10]=h):h=t[10];let g;t[11]!==r||t[12]!==o?(g=(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:o,disabled:r,"data-testid":`trash-failure-modal-cancel`,children:h}),t[11]=r,t[12]=o,t[13]=g):g=t[13];let _;t[14]===r?_=t[15]:(_=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Gc,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(J,{id:`mf37rL`})]}):(0,Z.jsx)(J,{id:`6gRgw8`}),t[14]=r,t[15]=_);let v;t[16]!==r||t[17]!==a||t[18]!==_?(v=(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:a,disabled:r,"data-testid":`trash-failure-modal-retry`,children:_}),t[16]=r,t[17]=a,t[18]=_,t[19]=v):v=t[19];let y;t[20]===r?y=t[21]:(y=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Gc,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(J,{id:`s3caR3`})]}):(0,Z.jsx)(J,{id:`UBv8UK`}),t[20]=r,t[21]=y);let b;t[22]!==r||t[23]!==i||t[24]!==y?(b=(0,Z.jsx)(X,{variant:`destructive`,onClick:i,disabled:r,"data-testid":`trash-failure-modal-delete-permanently`,children:y}),t[22]=r,t[23]=i,t[24]=y,t[25]=b):b=t[25];let x;t[26]!==b||t[27]!==g||t[28]!==v?(x=(0,Z.jsxs)(hn,{children:[g,v,b]}),t[26]=b,t[27]=g,t[28]=v,t[29]=x):x=t[29];let S;return t[30]!==x||t[31]!==p||t[32]!==m?(S=(0,Z.jsxs)(pn,{className:`sm:max-w-md`,children:[p,m,x]}),t[30]=x,t[31]=p,t[32]=m,t[33]=S):S=t[33],S}function wZ(e){return(0,Z.jsxs)(`li`,{"data-testid":`trash-failure-modal-target`,children:[(0,Z.jsx)(`div`,{className:`font-mono text-foreground`,children:SZ(e)}),(0,Z.jsx)(`div`,{className:`text-muted-foreground`,children:xZ(e)})]},e.path)}function TZ(e){let t=(0,$.c)(21),{parentDir:n,onSelectTemplate:r,ItemComponent:i}=e,{state:a}=Ds(n);if(a.status===`idle`||a.status===`loading`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(J,{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)(J,{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=W_(e);if(n.length===0){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(J,{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 EZ(e){return e?.isDirectory()?e:null}function DZ(e,t){let n=t.getPath();for(let t of e.getSelectedPaths())t!==n&&e.getItem(t)?.deselect();t.isSelected()||t.select()}function OZ(e){for(let t of e.getSelectedPaths())e.getItem(t)?.deselect()}function kZ(e,t,n,r,i){let a=(0,$.c)(11),o;a[0]!==n||a[1]!==t||a[2]!==e||a[3]!==r?(o=()=>{let i=()=>{queueMicrotask(()=>{r.current=!1})};if(r.current=!0,!t){OZ(e),i();return}let a=n?n.split(`\0`):[];for(let t of a){let n=EZ(e.getItem(t));n&&!n.isExpanded()&&n.expand()}let o=e.getItem(t);if(!o){OZ(e),i();return}if(e.getSelectedPaths().length>1&&o.isSelected()){o.focus(),i();return}DZ(e,o),o.focus(),i()},a[0]=n,a[1]=t,a[2]=e,a[3]=r,a[4]=o):o=a[4];let s;a[5]!==n||a[6]!==t||a[7]!==e||a[8]!==r||a[9]!==i?(s=[n,t,e,r,i],a[5]=n,a[6]=t,a[7]=e,a[8]=r,a[9]=i,a[10]=s):s=a[10],(0,Q.useEffect)(o,s)}var AZ=`open-knowledge:file-tree-menu-action-delete`,jZ=`open-knowledge:file-tree-menu-action-rename`,MZ=`open-knowledge:file-tree-menu-action-duplicate`;function NZ(e){window.dispatchEvent(new CustomEvent(AZ,{detail:{target:e}}))}function PZ(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(AZ,t),()=>window.removeEventListener(AZ,t)}function FZ(e){window.dispatchEvent(new CustomEvent(jZ,{detail:{target:e}}))}function IZ(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(jZ,t),()=>window.removeEventListener(jZ,t)}function LZ(e){window.dispatchEvent(new CustomEvent(MZ,{detail:{target:e}}))}function RZ(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(MZ,t),()=>window.removeEventListener(MZ,t)}var zZ={Accept:`application/x-ndjson, application/json`};function BZ(e){return!e.ok||!e.body?!1:(e.headers.get(`content-type`)??``).includes(`application/x-ndjson`)}var VZ=class extends Error{};function HZ(e){return typeof e==`object`&&!!e&&`type`in e}async function UZ(e,t={}){let n=e.body;if(!n)throw new VZ(`Show All Files stream had no response body.`);let{onBatch:r}=t,i=n.getReader(),a=new TextDecoder,o=[],s=[],c=!1,l=``,u=e=>{let t=e.trim();if(t.length===0)return!1;let n;try{n=JSON.parse(t)}catch{return console.warn(`[show-all-stream] dropping unparseable NDJSON line:`,t.slice(0,200)),!1}if(HZ(n)){if(n.type===`error`)throw new VZ(typeof n.problem?.title==`string`?n.problem.title:`Show All Files stream failed.`);return c=n.truncated===!0,!0}let r=di.safeParse(n);return r.success?(o.push(r.data),s.push(r.data)):console.warn(`[show-all-stream] dropping schema-divergent entry line:`,r.error.issues),!1},d=()=>{if(!r||s.length===0)return;let e=s;s=[],r(e)};try{let e=!1;for(;!e;){let t=await i.read();if(t.done)break;l+=a.decode(t.value,{stream:!0});let n=l.indexOf(`
1957
+ `);for(;n!==-1;){let t=u(l.slice(0,n));if(l=l.slice(n+1),t){e=!0;break}n=l.indexOf(`
1958
+ `)}d()}l+=a.decode(),l.includes(`
1959
+ `)||u(l),d()}finally{i.releaseLock()}return{entries:o,truncated:c}}function WZ(e,t,n,r=Date.now()){if(n.size===0)return[...e];let i=new Set(e.map(e=>Pf(e))),a=[];for(let e of t){let t=Pf(e);if(i.has(t)){n.delete(t);continue}let o=n.get(t);if(o!==void 0){if(r-o>5e3){n.delete(t);continue}a.push(e)}}return a.length===0?[...e]:[...e,...a]}function GZ(e,t){if(t.length===0)return[...e];let n=new Set(e.map(e=>Pf(e))),r=[...e];for(let e of t){let t=Pf(e);n.has(t)||(n.add(t),r.push(e))}return r}function KZ(e,t,n,r,i=Date.now()){if(t!==``&&!e.some(e=>Pf(e)===t))return[...e];let a=[],o=[];for(let n of e)qZ(t,Pf(n))?a.push(n):o.push(n);let s=WZ(n,a,r,i),c=new Set(s.map(e=>Pf(e)).filter(e=>e.endsWith(`/`)));return[...o.filter(e=>{let n=Pf(e);if(!n.startsWith(t))return!0;let r=n.slice(t.length),i=r.indexOf(`/`);return i===-1?!0:c.has(t+r.slice(0,i+1))}),...s]}function qZ(e,t){if(!t.startsWith(e))return!1;let n=t.slice(e.length);if(n===``)return!1;let r=n.endsWith(`/`)?n.slice(0,-1):n;return r!==``&&!r.includes(`/`)}var JZ=ou(`HOVER_INTENT_MS`,80),YZ=3,XZ=20,ZZ=new Map,QZ=new Set,$Z=[],eQ=new Map;function tQ(e){for(eQ.delete(e),eQ.set(e,!0);eQ.size>XZ;){let e=eQ.keys().next().value;if(e===void 0)break;eQ.delete(e)}}function nQ(e){QZ.delete(e),iQ()}function rQ(e,t){let n=Date.now();iu(`ok/sidebar/prewarm-success`,{docName:e,t:n,poolEventId:t}),ot(e,t,n)}function iQ(){for(;QZ.size<YZ&&$Z.length>0;){let e=$Z.shift();if(!e)break;if(!eQ.has(e.docName)){QZ.add(e.docName),tQ(e.docName);try{let t=e.prewarm(e.docName);t&&rQ(e.docName,t)}catch(t){iu(`ok/sidebar/prewarm-failed`,{docName:e.docName,message:t instanceof Error?t.message:String(t)})}finally{nQ(e.docName)}}}}function aQ(e,t){if(be(e)||eQ.has(e))return;let n=ZZ.get(e);n&&clearTimeout(n.timer);let r=setTimeout(()=>{if(ZZ.delete(e),QZ.size>=YZ){$Z.push({docName:e,prewarm:t});return}tQ(e),QZ.add(e);try{let n=t(e);n&&rQ(e,n)}catch(t){iu(`ok/sidebar/prewarm-failed`,{docName:e,message:t instanceof Error?t.message:String(t)})}finally{nQ(e)}},JZ);ZZ.set(e,{timer:r,prewarm:t})}function oQ(e){let t=ZZ.get(e);t&&(clearTimeout(t.timer),ZZ.delete(e))}function sQ(e){window.requestAnimationFrame(()=>{let t=ut(e);if(!(!t||t.isDestroyed))try{t.commands.focus()}catch{}})}function cQ(e){let t=e.current;t.row?.removeAttribute(fQ),t.root?.removeAttribute(pQ),e.current={row:null,root:null}}function lQ(e,t){let n=e.current;n.row===t.row&&n.root===t.root||(cQ(e),t.row?.setAttribute(fQ,`true`),t.root?.setAttribute(pQ,`true`),e.current={row:t.row,root:t.root})}async function uQ(e,t){try{await navigator.clipboard.writeText(e),dl.success(t===`full`?vl._({id:`6_ZOw4`}):vl._({id:`haHgQj`}),{description:e})}catch(e){console.warn(`[FileTree] clipboard write failed:`,e),dl.error(t===`full`?vl._({id:`vfRlCI`}):vl._({id:`5QGTaA`}))}}var dQ=`
1960
+ [data-file-tree-virtualized-root][data-file-tree-root-drag-target="true"] {
1961
+ position: relative;
1962
+ }
1963
+ [data-file-tree-virtualized-root][data-file-tree-root-drag-target="true"]::after {
1964
+ content: "";
1965
+ position: absolute;
1966
+ inset: 0;
1967
+ z-index: 20;
1968
+ border-radius: 0.375rem;
1969
+ box-shadow: inset 0 0 0 2px color-mix(in oklab, var(--color-primary) 80%, transparent);
1970
+ background: color-mix(in oklab, var(--color-primary) 6%, transparent);
1971
+ pointer-events: none;
1972
+ }
1973
+ /* Forced-colors (Windows High Contrast) suppresses box-shadow and overrides
1974
+ color-mix backgrounds, so the ring above would vanish. Borders survive
1975
+ forced-colors — fall back to a system Highlight border (mirrors the JSX
1976
+ in-range halo fallback in globals.css). */
1977
+ @media (forced-colors: active) {
1978
+ [data-file-tree-virtualized-root][data-file-tree-root-drag-target="true"]::after {
1979
+ border: 2px solid Highlight;
1980
+ }
1981
+ }
1982
+ `,fQ=`data-ok-external-file-drop-target`,pQ=`data-ok-external-file-drop-root-target`,mQ=`__external-file-drop__`,hQ=2e3,gQ=`
1983
+ [data-type="item"][${fQ}="true"] {
1984
+ background: color-mix(in oklab, var(--color-primary) 10%, transparent);
1985
+ box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--color-primary) 72%, transparent);
1986
+ }
1987
+ [data-file-tree-virtualized-root][${pQ}="true"] {
1988
+ position: relative;
1989
+ }
1990
+ [data-file-tree-virtualized-root][${pQ}="true"]::after {
1991
+ content: "";
1992
+ position: absolute;
1993
+ inset: 0;
1994
+ z-index: 20;
1995
+ border-radius: 0.375rem;
1996
+ box-shadow: inset 0 0 0 2px color-mix(in oklab, var(--color-primary) 80%, transparent);
1997
+ background: color-mix(in oklab, var(--color-primary) 6%, transparent);
1998
+ pointer-events: none;
1999
+ }
2000
+ @media (forced-colors: active) {
2001
+ [data-type="item"][${fQ}="true"] {
2002
+ outline: 2px solid Highlight;
2003
+ outline-offset: -2px;
2004
+ }
2005
+ [data-file-tree-virtualized-root][${pQ}="true"]::after {
2006
+ border: 2px solid Highlight;
2007
+ }
2008
+ }
2009
+ `,_Q=`data-ok-creation-cleared`,vQ=`${sX}\n${JX}\n${rZ}\n${dQ}\n${gQ}\n${`
2010
+ :host([${_Q}]) [data-item-focused="true"] {
2011
+ --trees-focus-ring-color: transparent;
2012
+ }
2013
+ `}\n${tX}\n${nX}`;function yQ(e){return e===`darwin`?vl._({id:`LtSYdi`}):e===`win32`?vl._({id:`qi1F96`}):vl._({id:`e1Rn_k`})}function bQ(e){let t=(0,$.c)(18),{item:n,workspace:r,onClose:i}=e,{_:a}=mt(),o=typeof window<`u`?window.okDesktop:void 0;if(!o)return null;let s=o.platform,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=yQ(s),t[0]=c):c=t[0];let l=c,u,d;t[1]!==a||t[2]!==r?(u=r?null:a({id:`wTcjov`}),d=a(s===`darwin`?u?{id:`FvpFSZ`,values:{hint:u}}:{id:`LtSYdi`}:s===`win32`?u?{id:`o4dcAf`,values:{hint:u}}:{id:`qi1F96`}:u?{id:`zUhPuR`,values:{hint:u}}:{id:`e1Rn_k`}),t[1]=a,t[2]=r,t[3]=u,t[4]=d):(u=t[3],d=t[4]);let f=d,p=!r,m;t[5]!==n||t[6]!==i||t[7]!==r?(m=()=>{if(!r)return;i();let e=qs(r.contentDir,Af(n),r.pathSeparator);o.shell.showItemInFolder(e)},t[5]=n,t[6]=i,t[7]=r,t[8]=m):m=t[8];let h,g;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(uc,{"aria-hidden":`true`}),g=(0,Z.jsx)(`span`,{className:`flex-1`,children:l}),t[9]=h,t[10]=g):(h=t[9],g=t[10]);let _;t[11]===u?_=t[12]:(_=u?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:u}):null,t[11]=u,t[12]=_);let v;return t[13]!==f||t[14]!==p||t[15]!==m||t[16]!==_?(v=(0,Z.jsxs)(Sr,{disabled:p,onSelect:m,"aria-label":f,children:[h,g,_]}),t[13]=f,t[14]=p,t[15]=m,t[16]=_,t[17]=v):v=t[17],v}function xQ(e){let t=(0,$.c)(69),{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}=mt(),b=Of(n,v),x=n.kind===`directory`,S;t[0]===n.path?S=t[1]:(S=Bl(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?Qf(n.path):null,t[5]=x,t[6]=n.path,t[7]=O):O=t[7];let k=Ds(O),A=k.state.status===`ready`?(k.state.data.folder.templates_available?.length??0)>0:!0,j=s.getSelectedPaths(),M=j.includes(b.treePath)?IX(j,v):[],N=M.length>1?M:[b],P=N.length,F=vl._({id:`djjdjr`,values:{deleteCount:P}}),I;t[8]!==v||t[9]!==_||t[10]!==x||t[11]!==n||t[12]!==a?(I=_?null:x?Zo({folderRelativePath:Af(n),workspace:a}):is({docName:Zf(n.path,v),workspace:a}),t[8]=v,t[9]=_,t[10]=x,t[11]=n,t[12]=a,t[13]=I):I=t[13];let L=I,R;t[14]===r?R=t[15]:(R=()=>r.close({restoreFocus:!1}),t[14]=r,t[15]=R);let z=R,B;t[16]===r?B=t[17]:(B=()=>r.close(),t[16]=r,t[17]=B);let V=B,{status:H}=fo(),U=H?.hasRemote===!0,ee;t[18]!==v||t[19]!==_||t[20]!==x||t[21]!==n.path||t[22]!==b?(ee=_||b.kind===`asset`?null:x?Es(Qf(n.path)):Vs(Zf(n.path,v)),t[18]=v,t[19]=_,t[20]=x,t[21]=n.path,t[22]=b,t[23]=ee):ee=t[23];let W=ee,G=U&&W!==null,K;t[24]!==y||t[25]!==U||t[26]!==W?(K=()=>{W&&ps({...W,hasRemote:U,onClickWhenNoRemote:()=>{dl.error(y({id:`WyQxwa`}))}},{clipboardWrite:af,toastSuccess:wQ,toastError:CQ,logEvent:SQ})},t[24]=y,t[25]=U,t[26]=W,t[27]=K):K=t[27];let te=K,ne;t[28]!==G||t[29]!==V||t[30]!==te?(ne=G?(0,Z.jsxs)(Sr,{"data-testid":`file-tree-menu-share`,onSelect:()=>{V(),te()},children:[(0,Z.jsx)(og,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`Z8lGw6`})]}):null,t[28]=G,t[29]=V,t[30]=te,t[31]=ne):ne=t[31];let q=ne,re=0,ie=0;if(x){let e=Wf(n.path);for(let t of g)(t===e||t.startsWith(e))&&(re++,EZ(s.getItem(t))?.isExpanded()&&ie++)}let ae=x&&ie<re,oe=x&&ie>0,se;t[32]===V?se=t[33]:(se=e=>{e||V()},t[32]=V,t[33]=se);let ce;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,Z.jsx)(Er,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[34]=ce):ce=t[34];let le;t[35]!==y||t[36]!==i||t[37]!==T||t[38]!==V||t[39]!==z||t[40]!==F||t[41]!==N||t[42]!==A||t[43]!==o||t[44]!==L||t[45]!==D||t[46]!==_||t[47]!==x||t[48]!==C||t[49]!==n||t[50]!==s||t[51]!==c||t[52]!==w||t[53]!==h||t[54]!==u||t[55]!==p||t[56]!==d||t[57]!==m||t[58]!==f||t[59]!==l||t[60]!==q||t[61]!==oe||t[62]!==ae||t[63]!==b||t[64]!==a?(le=(0,Z.jsx)(Ar,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:x?(0,Z.jsxs)(Z.Fragment,{children:[C?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Sr,{disabled:i,onSelect:()=>{z(),l(`file`,Qf(n.path))},children:[(0,Z.jsx)(tc,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`HdkSiO`})]}),A?(0,Z.jsxs)(Cr,{children:[(0,Z.jsxs)(kr,{disabled:i,children:[(0,Z.jsx)(ks,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`Uuj_R4`})]}),(0,Z.jsx)(wr,{children:(0,Z.jsx)(TZ,{parentDir:Qf(n.path),onSelectTemplate:e=>{z(),u(Qf(n.path),e)},ItemComponent:Sr})})]}):null,(0,Z.jsxs)(Sr,{disabled:i,onSelect:()=>{z(),l(`folder`,Qf(n.path))},children:[(0,Z.jsx)(Nh,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`96G6Re`})]}),(0,Z.jsx)(Nr,{})]}),(0,Z.jsx)(bQ,{item:n,workspace:a,onClose:V}),(0,Z.jsx)(qo,{input:L,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch,onBeforeLaunch:V}),q,(0,Z.jsxs)(Cr,{children:[(0,Z.jsxs)(kr,{children:[(0,Z.jsx)($s,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`oCZkaG`})]}),(0,Z.jsxs)(wr,{children:[(0,Z.jsx)(Sr,{disabled:!a,onSelect:()=>{a&&(V(),uQ(qs(a.contentDir,Af(n),a.pathSeparator),`full`))},children:(0,Z.jsx)(J,{id:`oQA-cA`})}),(0,Z.jsx)(Sr,{onSelect:()=>{V(),uQ(Af(n),`relative`)},children:(0,Z.jsx)(J,{id:`s061i4`})})]})]}),ae||oe?(0,Z.jsx)(Nr,{}):null,ae?(0,Z.jsxs)(Sr,{onSelect:()=>{V(),m(n.path)},children:[(0,Z.jsx)(Tg,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`OlAl5i`})]}):null,oe?(0,Z.jsxs)(Sr,{onSelect:()=>{V(),h(n.path)},children:[(0,Z.jsx)(jh,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`qvWGzP`})]}):null,C?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Nr,{}),(0,Z.jsxs)(Sr,{disabled:i,onSelect:()=>{b.kind!==`asset`&&(V(),d(b))},children:[(0,Z.jsx)(Ws,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`euc6Ns`})]}),(0,Z.jsxs)(Sr,{disabled:i,onSelect:()=>{z(),s.startRenaming(n.path)},children:[(0,Z.jsx)(Qs,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`2wxgft`})]}),(0,Z.jsxs)(Sr,{"data-testid":`file-tree-menu-hide`,disabled:!T,onSelect:()=>{if(!c||!w)return;V();let e=EX(w),t=Fs(c.current()),n=zs(t,e);if(n===t)return;c.patch(As(n));let r=w.path.split(`/`).pop()||w.path;dl.success(y({id:`4xtLTl`,values:{basename:r}}),{description:y({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(Ir,{"aria-hidden":`true`}),D]}),(0,Z.jsxs)(Sr,{variant:`destructive`,disabled:i,onSelect:()=>{V(),p(N)},children:[(0,Z.jsx)(il,{"aria-hidden":`true`}),F]})]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(bQ,{item:n,workspace:a,onClose:V}),!_&&(0,Z.jsx)(qo,{input:L,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch,onBeforeLaunch:V}),q,(0,Z.jsxs)(Cr,{children:[(0,Z.jsxs)(kr,{children:[(0,Z.jsx)($s,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`oCZkaG`})]}),(0,Z.jsxs)(wr,{children:[(0,Z.jsx)(Sr,{disabled:!a,onSelect:()=>{a&&(V(),uQ(qs(a.contentDir,Af(n),a.pathSeparator),`full`))},children:(0,Z.jsx)(J,{id:`oQA-cA`})}),(0,Z.jsx)(Sr,{onSelect:()=>{V(),uQ(Af(n),`relative`)},children:(0,Z.jsx)(J,{id:`s061i4`})})]})]}),C?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Nr,{}),_?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Cr,{children:[(0,Z.jsxs)(kr,{disabled:i,children:[(0,Z.jsx)(kh,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`PYmp-0`})]}),(0,Z.jsxs)(wr,{children:[(0,Z.jsx)(Sr,{disabled:i,onSelect:()=>{V(),f(b,!1)},children:(0,Z.jsx)(J,{id:`-FeyRg`})}),(0,Z.jsx)(Sr,{disabled:i,onSelect:()=>{V(),f(b,!0)},children:(0,Z.jsx)(J,{id:`dQHSCs`})})]})]}),(0,Z.jsxs)(Sr,{disabled:i,onSelect:()=>{V(),d(b)},children:[(0,Z.jsx)(Ws,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`euc6Ns`})]})]}),(0,Z.jsxs)(Sr,{disabled:i,onSelect:()=>{z(),s.startRenaming(n.path)},children:[(0,Z.jsx)(Qs,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`2wxgft`})]}),w?(0,Z.jsxs)(Sr,{"data-testid":`file-tree-menu-hide`,disabled:!T,onSelect:()=>{if(!c)return;V();let e=EX(w),t=Fs(c.current()),n=zs(t,e);if(n===t)return;c.patch(As(n));let r=w.path.split(`/`).pop()||w.path;dl.success(y({id:`OD0FCX`,values:{basename:r}}),{description:y({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(Ir,{"aria-hidden":`true`}),D]}):null,(0,Z.jsxs)(Sr,{variant:`destructive`,disabled:i,onSelect:()=>{V(),p(N)},children:[(0,Z.jsx)(il,{"aria-hidden":`true`}),F]})]})]})}),t[35]=y,t[36]=i,t[37]=T,t[38]=V,t[39]=z,t[40]=F,t[41]=N,t[42]=A,t[43]=o,t[44]=L,t[45]=D,t[46]=_,t[47]=x,t[48]=C,t[49]=n,t[50]=s,t[51]=c,t[52]=w,t[53]=h,t[54]=u,t[55]=p,t[56]=d,t[57]=m,t[58]=f,t[59]=l,t[60]=q,t[61]=oe,t[62]=ae,t[63]=b,t[64]=a,t[65]=le):le=t[65];let ue;return t[66]!==se||t[67]!==le?(ue=(0,Z.jsxs)(Mr,{open:!0,modal:!1,onOpenChange:se,children:[ce,le]}),t[66]=se,t[67]=le,t[68]=ue):ue=t[68],ue}function SQ(e){return console.log(e)}function CQ(e){return dl.error(e)}function wQ(e){return dl.success(e)}function TQ(e,t){return`/api/documents?showAll=true${t?`&showOk=true`:``}&dir=${encodeURIComponent(e)}&depth=1`}async function EQ(e,t,n,r,i){try{let a=await fetch(TQ(e,t),{signal:n,headers:zZ});if(BZ(a)){let e=await UZ(a);return{kind:`entries`,entries:Il(e.entries),truncated:e.truncated}}let o=await h(a,r);if(!o.ok)return{kind:`http-error`,title:o.title};let s=ka.safeParse(o.body);return s.success?{kind:`entries`,entries:Il(s.data.documents),truncated:s.data.truncated===!0}:{kind:`http-error`,title:i}}catch(e){return e instanceof VZ?{kind:`http-error`,title:e.message}:{kind:`network-error`,cause:e}}}function DQ(e){let t=(0,$.c)(367),{ref:n,onContentHeightChange:r}=e,{_:i,i18n:a}=mt(),{activeDocName:o,activeTarget:s,closeTabs:c,closeDocument:l,isNewTabActive:u,openTarget:d,prewarm:f,reconcileLocalRemoval:m,reconcileLocalRename:g}=Re(),{notifySidebarFileSelected:_}=JN(),{resolvedTheme:v}=Ft(),{addPage:y,pageMeta:b,pages:x}=Bo(),S;t[0]===b?S=t[1]:(S=function(e,t){return Wl(e,t??b.get(e)?.size)??{kind:`doc`,target:e,docName:e}},t[0]=b,t[1]=S);let C=S,w;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(w=[],t[2]=w):w=t[2];let[T,E]=(0,Q.useState)(w),[D,O]=(0,Q.useState)(!0),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(!1),N=PF(),P=(0,Q.useRef)(null),[F,I]=(0,Q.useState)(null),[L,R]=(0,Q.useState)(0),[z,B]=(0,Q.useState)(null),[V,H]=(0,Q.useState)(null),[U,ee]=(0,Q.useState)(null),[W,G]=(0,Q.useState)(null),{conflicts:K}=Ss(),[te,ne]=(0,Q.useState)(null),[q,re]=(0,Q.useState)(null),[ae,oe]=(0,Q.useState)(!1),se=(0,Q.useRef)(ae),ce;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(ce=new Set,t[3]=ce):ce=t[3];let le=(0,Q.useRef)(ce),ue=(0,Q.useRef)(T),de=(0,Q.useRef)(b),fe=(0,Q.useRef)(null),pe;t[4]!==y||t[5]!==C||t[6]!==_||t[7]!==d?(pe=function(e){if(e.kind===`doc`)e.registerPage&&y(e.docName),d(C(e.docName,e.size),{tabBehavior:`replace-active`}),gu(vu(e.docName));else if(e.kind===`folder`)d({kind:`folder`,target:e.folderPath,folderPath:e.folderPath},{tabBehavior:`replace-active`}),gu(cu(e.folderPath));else{let t=(e.entries??ue.current).find(t=>Vl(t)&&t.path===e.assetPath);d({kind:`asset`,target:e.assetPath,assetPath:e.assetPath,mediaKind:t?.mediaKind??null},{tabBehavior:`replace-active`}),gu(hu(e.assetPath))}_()},t[4]=y,t[5]=C,t[6]=_,t[7]=d,t[8]=pe):pe=t[8];let me=pe,he;t[9]!==T||t[10]!==me||t[11]!==_||t[12]!==d||t[13]!==x?(he=function(e,t){let n=t===void 0?T:t,r=fZ(e,n);if(r.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,Xf(e));return}if(r.kind===`asset`){d({kind:`asset`,target:r.path,assetPath:r.path,mediaKind:r.mediaKind},{tabBehavior:`replace-active`}),gu(r.hash),_();return}if(r.kind===`folder`){me({kind:`folder`,folderPath:r.path});return}let i=n.find(e=>Fl(e)&&e.docName===r.path),a=Ul(r.path,{pages:x,docExt:i?.docExt});if(a?.kind===`asset`){d(a,{tabBehavior:`replace-active`}),gu(hu(a.assetPath)),_();return}if(a?.kind===`doc`){me({kind:`doc`,docName:a.docName});return}me({kind:`doc`,docName:r.path,size:i?.size,registerPage:jl(r.path)})},t[9]=T,t[10]=me,t[11]=_,t[12]=d,t[13]=x,t[14]=he):he=t[14];let ge=he,_e=(0,Q.useRef)(o),ve;t[15]===T?ve=t[16]:(ve=new Set(T.filter(Vl).map(t$)),t[15]=T,t[16]=ve);let ye=ve,be=(0,Q.useRef)(ye),xe;t[17]===T?xe=t[18]:(xe=GX(T),t[17]=T,t[18]=xe);let Se=xe,Ce=(0,Q.useRef)(Se),we;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(we=[],t[19]=we):we=t[19];let Te=(0,Q.useRef)(we),Ee=(0,Q.useRef)(null),De=(0,Q.useRef)(e$),Oe=(0,Q.useRef)(null),ke=(0,Q.useRef)(null),Ae=(0,Q.useRef)(!1),je=(0,Q.useRef)(!1),Me=(0,Q.useRef)(null),Ne;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(Ne={row:null,root:null},t[20]=Ne):Ne=t[20];let Pe=(0,Q.useRef)(Ne),Fe=(0,Q.useRef)($Q),Ie=(0,Q.useRef)(null),Le=(0,Q.useRef)(null),ze;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(ze=new Map,t[21]=ze):ze=t[21];let Be=(0,Q.useRef)(ze),Ve;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=new Set,t[22]=Ve):Ve=t[22];let He=(0,Q.useRef)(Ve),Ue;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=new Map,t[23]=Ue):Ue=t[23];let Ge=(0,Q.useRef)(Ue),Ke=(0,Q.useRef)(0),qe;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(qe=new Set,t[24]=qe):qe=t[24];let Je=(0,Q.useRef)(qe),Ye=(0,Q.useRef)(QQ),Xe=(0,Q.useRef)(ZQ),Ze=(0,Q.useRef)(!1),Qe=(0,Q.useRef)(!1),$e=(0,Q.useRef)(!1),et;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(et=()=>({showHiddenFiles:Ze.current,showOnlyMarkdownFiles:Qe.current,showOkFolders:$e.current}),t[25]=et):et=t[25];let tt=et,nt=(0,Q.useRef)(null),rt=(0,Q.useRef)(null),it=(0,Q.useRef)(XQ),at=(0,Q.useRef)(YQ),ot=(0,Q.useRef)(JQ),st=(0,Q.useRef)(qQ),ct=(0,Q.useRef)(s),[lt,ut]=(0,Q.useState)(!1),dt;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(dt=function(){P.current!==null&&(clearTimeout(P.current),P.current=null)},t[26]=dt):dt=t[26];let pt=dt,ht;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ht=function(){pt(),M(!1)},t[27]=ht):ht=t[27];let gt=ht,_t;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(_t=function(e){gt(),A(e)},t[28]=_t):_t=t[28];let vt=_t,yt;t[29]===i?yt=t[30]:(yt=function(){if(pt(),AF()){A(null),M(!0),P.current=setTimeout(()=>{P.current=null,nt.current?.()},hQ);return}M(!1),A(i({id:`34qyH5`}))},t[29]=i,t[30]=yt);let bt=yt,xt=(0,Q.useRef)(!0),St;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(St=()=>{if(xt.current){xt.current=!1;return}nt.current?.()},t[31]=St):St=t[31];let Ct;t[32]===N?Ct=t[33]:(Ct=[N],t[32]=N,t[33]=Ct),(0,Q.useEffect)(St,Ct);let wt,Tt;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(wt=()=>pt,Tt=[],t[34]=wt,t[35]=Tt):(wt=t[34],Tt=t[35]),(0,Q.useEffect)(wt,Tt);let Et,Dt;t[36]!==T.length||t[37]!==D?(Et=()=>{if(D||T.length===0)return;let e=rt.current?.querySelector(WB)?.shadowRoot;if(!e)return;let t=e,n=function(){Me.current!==null&&clearTimeout(Me.current),Me.current=setTimeout(()=>{je.current=!1,Me.current=null},0)},r=function(e){if(!(e instanceof DragEvent))return;let t=r$(e),n=t?.dataset.itemPath;if(!n)return;let r=_Z(t.dataset.itemType===`folder`?Wf(n):n,ue.current,de.current);r&&(Me.current!==null&&(clearTimeout(Me.current),Me.current=null),je.current=!0,e.dataTransfer?.setData(Ef,zf(r)))},i=function(e){if(!(e instanceof DragEvent)||!Vf(e))return;let t=a$(e);if(!t){cQ(Pe);return}e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`),lQ(Pe,t)},a=function(e){if(!(e instanceof DragEvent)||!Vf(e))return;let n=e.relatedTarget;n instanceof Node&&t.contains(n)||cQ(Pe)},o=function(e){if(!(e instanceof DragEvent)||!Vf(e))return;let t=a$(e),n=Ff(e);if(!t||n.length===0){cQ(Pe);return}e.preventDefault(),e.stopPropagation(),cQ(Pe),Fe.current(n,t.parentDir,t.busyPath)};return e.addEventListener(`dragstart`,r,{capture:!0}),e.addEventListener(`dragover`,i,{capture:!0}),e.addEventListener(`dragleave`,a,{capture:!0}),e.addEventListener(`drop`,o,{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(`dragover`,i,{capture:!0}),e.removeEventListener(`dragleave`,a,{capture:!0}),e.removeEventListener(`drop`,o,{capture:!0}),e.removeEventListener(`dragend`,n,{capture:!0}),window.removeEventListener(`drop`,n,!0),window.removeEventListener(`dragend`,n,!0),cQ(Pe),Me.current!==null&&(clearTimeout(Me.current),Me.current=null),je.current=!1}},Dt=[T.length,D],t[36]=T.length,t[37]=D,t[38]=Et,t[39]=Dt):(Et=t[38],Dt=t[39]),(0,Q.useEffect)(Et,Dt);let{selectedFilePath:Ot,selectedFolderPath:kt,navigationPath:At}=dZ(s,u?null:o),jt=Ot?Kf(Ot,T.find(e=>Fl(e)&&e.docName===Ot)?.docExt):kt?Wf(kt):s?.kind===`asset`?s.assetPath:null,Mt=ae?null:jt,Nt=es().states,{dispatch:Pt}=Jo(),It;t[40]!==Pt||t[41]!==Nt?(It={installStates:Nt,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:Pt},t[40]=Pt,t[41]=Nt,t[42]=It):It=t[42];let Lt=It,{okignoreBinding:Rt,merged:zt}=td(),Bt=zt?.appearance?.sidebar?.showHiddenFiles??!1,Vt=zt?.appearance?.sidebar?.showOnlyMarkdownFiles??!1,Ht=zt?.appearance?.sidebar?.showOkFolders??!1,Ut;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(Ut=()=>Ie.current===null,t[43]=Ut):Ut=t[43];let Wt=Ut,Gt;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(Gt=[],t[44]=Gt):Gt=t[44];let Kt;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(Kt={set:`complete`,spriteSheet:wX,byFileExtension:{md:{name:bX,viewBox:ft},mdx:{name:bX,viewBox:ft}}},t[45]=Kt):Kt=t[45];let qt;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(qt={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[46]=qt):qt=t[46];let Jt;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Jt={canDrag:Wt,canDrop:Wt,onDropComplete:e=>st.current(e),onDropError:KQ},t[47]=Jt):Jt=t[47];let Yt,Xt;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(Yt={canRename:Wt,onRename:e=>at.current(e),onError:e=>ot.current(e)},Xt=e=>it.current(e),t[48]=Yt,t[49]=Xt):(Yt=t[48],Xt=t[49]);let Zt;t[50]===i?Zt=t[51]:(Zt={paths:Gt,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,...$Y,icons:Kt,unsafeCSS:vQ,composition:qt,dragAndDrop:Jt,renaming:Yt,onSelectionChange:Xt,renderRowDecoration:e=>{let{item:t}=e;if(t.kind===`file`){let e=Ce.current.docsByTreePath.get(t.path);if(e?.isSymlink){let t=e.targetPath;return{icon:vX,title:i(t?{id:`JE21eh`,values:{targetPath:t}}:{id:`BQu9Pg`})}}return jX(t.path)?{icon:yX,title:i({id:`i9toLO`})}:null}let n=Ce.current.foldersByTreeDirectoryPath.get(Wf(t.path));if(n?.isSymlink){let e=n.targetPath;return{icon:vX,title:i(e?{id:`JE21eh`,values:{targetPath:e}}:{id:`BQu9Pg`})}}return null}},t[50]=i,t[51]=Zt);let{model:Qt}=ZY(Zt),$t;t[52]===Qt?$t=t[53]:($t=function(e){let t=Qt.getItem(e)??Qt.getItem(Wf(e));return t?.isDirectory()?Wf(Qf(t.getPath())):e},t[52]=Qt,t[53]=$t);let en=$t,tn,nn;t[54]===T?(tn=t[55],nn=t[56]):(nn=Nf(T),tn=wf(nn),t[54]=T,t[55]=tn,t[56]=nn);let rn=tn,an=(0,Q.useRef)(nn),on;t[57]!==T||t[58]!==Ht?(on=Hf(T,{includeOkFolders:Ht}),t[57]=T,t[58]=Ht,t[59]=on):on=t[59];let sn=on,cn=(0,Q.useRef)(sn),ln=kt?Gf(Wf(kt)).slice(0,-1):Gf(Mt??At),un=ln.join(`\0`),dn;t[60]===Qt?dn=t[61]:(dn=()=>{let e=new Set;for(let t of cn.current)EZ(Qt.getItem(t))?.isExpanded()&&e.add(t);return e},t[60]=Qt,t[61]=dn);let fn=dn,pn;t[62]===fn?pn=t[63]:(pn=e=>{let t=new Set(Hf(e??ue.current,{includeOkFolders:$e.current})),n=fn();for(let e of Te.current)n.add(e);return[...n].filter(e=>t.has(e))},t[62]=fn,t[63]=pn);let mn=pn,hn;t[64]!==mn||t[65]!==Qt?(hn=e=>{let t=Nf(e??ue.current);Qt.resetPaths(t,{initialExpandedPaths:mn(e)})},t[64]=mn,t[65]=Qt,t[66]=hn):hn=t[66];let gn=hn,vn;t[67]!==i||t[68]!==bt?(vn=async function(e){let t=Ke.current,n=new AbortController;Ge.current.set(e,n);let r=await EQ(Qf(e),$e.current,n.signal,i({id:`8RtNI0`}),i({id:`HlmZBk`}));if(Ge.current.get(e)===n&&Ge.current.delete(e),n.signal.aborted||t!==Ke.current)return;if(r.kind===`network-error`){bt(),console.warn(`[FileTree] lazy folder children fetch failed:`,e,r.cause);return}if(r.kind===`http-error`){console.warn(`[FileTree] lazy folder children http error:`,e,r.title),vt(r.title);return}let a=Pl(r.entries,tt());He.current.add(e),E(t=>KZ(t,e,a,Be.current)),A(null),gt(),r.truncated&&I(r.entries.length)},t[67]=i,t[68]=bt,t[69]=vn):vn=t[69];let yn=vn,bn;t[70]!==fn||t[71]!==yn?(bn=()=>{let e=fn(),t=Je.current;Je.current=e;for(let n of e){if(t.has(n)||He.current.has(n)||Ge.current.has(n))continue;let e=Qf(n);ue.current.find(t=>Rl(t)&&t.path===e)?.hasChildren!==!1&&yn(n)}},t[70]=fn,t[71]=yn,t[72]=bn):bn=t[72];let xn=bn,Sn;t[73]!==fn||t[74]!==yn?(Sn=()=>{for(let e of fn())He.current.has(e)||Ge.current.has(e)||yn(e)},t[73]=fn,t[74]=yn,t[75]=Sn):Sn=t[75];let Cn=Sn,wn;t[76]!==Qt||t[77]!==gn?(wn=(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=>Fl(e)&&e.docName===r);if(n==null||Qt.getItem(i)==null)continue;let s=Kf(i,t.find(e=>Fl(e)&&e.docName===i)?.docExt??n.docExt);Qt.move(i,s),o=s,a+=1}for(let{toPath:e}of i){let t=Nl(e);if(t===``)continue;let n=e.slice(0,-t.length);Qt.getItem(n)!=null&&(Qt.getItem(e)??Qt.move(n,e),o=e,a+=1)}a!==0&&(gn(t),o!=null&&Qt.focusPath(o))},t[76]=Qt,t[77]=gn,t[78]=wn):wn=t[78];let Tn=wn,En;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(En=e=>{Oe.current=Bf(e)},t[79]=En):En=t[79];let Dn=En,On;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(On=e=>be.current.has(e),t[80]=On):On=t[80];let kn=On,An;t[81]!==i||t[82]!==y||t[83]!==me||t[84]!==gn?(An=async function(e){if(e.kind===`asset`||Ie.current!==null)return;let t=()=>{B(null),Ie.current=null};Ie.current=e.path,B(e.path),A(null);try{let n=await h(await fetch(`/api/duplicate-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.path})}),i({id:`dw_dUJ`}));if(!n.ok){dl.error(n.title),gn(),t();return}let r=p(Ri,n.body,`duplicate-path`,null);if(r===null){let e=i({id:`67f-3g`});dl.error(e),A(e),eu([`files`,`backlinks`,`graph`]),gn(),t();return}for(let e of r.duplicatedDocNames)y(e);E(t=>{let n=oI(t,e,r);return gn(n),Dn(n),n}),eu([`files`,`backlinks`,`graph`]),r.path!==e.path&&(r.kind===`folder`?me({kind:`folder`,folderPath:r.path}):me({kind:`doc`,docName:r.path})),dl.success(r.kind===`folder`?i({id:`iilQXA`}):i({id:`A6h5b-`}),{description:r.path}),t()}catch(e){let n=e,r=n instanceof Error?n.message:String(n);console.warn(`[FileTree] duplicate failed:`,n),dl.error(i({id:`EBVbtP`}),{description:r}),gn(),t()}},t[81]=i,t[82]=y,t[83]=me,t[84]=gn,t[85]=An):An=t[85];let jn=An,Mn=(0,Q.useRef)(jn),Nn;t[86]===jn?Nn=t[87]:(Nn=()=>{Mn.current=jn},t[86]=jn,t[87]=Nn),(0,Q.useEffect)(Nn);let Pn=async function(e,t){if(e.kind===`file`){if(t){ee(e);return}await Fn(e,!1)}};async function Fn(e,t){if(Ie.current!==null)return;let n=()=>{B(null),Ie.current=null,ee(null)};Ie.current=e.path,B(e.path),A(null);let r=e.path,a=r.lastIndexOf(`/`),o=a===-1?``:r.slice(0,a),s=await dc({sourcePath:e.path,targetFolder:o,deleteSource:t});if(!s.ok){dl.error(i({id:`rDOuNw`}),{description:s.error}),n();return}t&&(await Jr([e],[e.path],[]),E(t=>{let n=t.filter(t=>!(Fl(t)&&t.docName===e.path));return gn(n),Dn(n),n}),eu([`files`,`backlinks`,`graph`])),dl.success(i({id:`Ba4D2x`}),{description:s.path}),n()}let In=function(e){let t=OX(e);if(!t||kX(t))return!1;let n=Qt.getFocusedPath()??Qt.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||kn(n))return!1;let r=kX(n);if(!r)return!1;let i=Wf(t);if(!cn.current.includes(i))return!1;let a=`${t}${r}`;return an.current.includes(a)?!1:(mr({sourcePath:n,destinationPath:a,isFolder:!1}),Qt.move(n,a),!0)},Ln;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(Ln=e=>{let t=e??Ee.current;!t||Ee.current!==t||(t.disposeCommitListener(),Ee.current=null)},t[88]=Ln):Ln=t[88];let Rn=Ln,zn;t[89]!==i||t[90]!==Rn||t[91]!==l||t[92]!==c||t[93]!==gn?(zn=async function(e,t){let n=t===void 0?{}:t,r=n.updateUi??!0,a=n.restoreLocation??r;Rn(e),r&&B(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,o=await h(t,i({id:`EcM3k7`,values:{kind:n}}));if(o.ok)return;let s=o.title,c=i({id:`YPFBfr`,values:{detail:s,kind:n,createdPath:a}});r?dl.error(c):console.warn(`[FileTree] cleanup pending create failed: ${c}`),r&&(B(null),gn());return}}catch(t){if(console.warn(`[FileTree] cleanup pending create failed:`,t),r){let t=e.kind,n=e.createdPath;dl.error(i({id:`_TDESN`,values:{kind:t,createdPath:n}}))}r&&(B(null),gn());return}r&&(e.kind===`file`?l(e.createdPath):c([We(e.createdPath)],{force:!0})),r&&E(t=>{let n=iI(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return Dn(n),n}),eu([`files`,`backlinks`,`graph`]),a&&(window.location.hash=e.previousHash),r&&B(null)},t[89]=i,t[90]=Rn,t[91]=l,t[92]=c,t[93]=gn,t[94]=zn):zn=t[94];let Bn=zn,Vn,Hn;t[95]===Symbol.for(`react.memo_cache_sentinel`)?(Vn=()=>()=>{let e=Ee.current;e&&De.current(e,{restoreLocation:!1,updateUi:!1}).catch(GQ)},Hn=[],t[95]=Vn,t[96]=Hn):(Vn=t[95],Hn=t[96]),(0,Q.useEffect)(Vn,Hn);let Un;t[97]!==i||t[98]!==bt?(Un=()=>{let e=!0,t=null,n=zo(async function(){t?.abort();let n=new AbortController;t=n,Ke.current+=1;for(let e of Ge.current.values())e.abort();Ge.current.clear(),He.current.clear();try{let t=await fetch(TQ(``,$e.current),{signal:n.signal,headers:zZ});if(BZ(t)){let r=tt(),i=!1,{entries:a,truncated:o}=await UZ(t,{onBatch:t=>{if(!e||n.signal.aborted)return;let a=Pl(Il(t),r);a.length!==0&&(E(e=>GZ(e,a)),i||(i=!0,A(null),gt(),O(!1)))}});if(!e)return;let s=Il(a),c=Pl(s,r);E(e=>KZ(e,``,c,Be.current)),A(null),gt(),I(o?a.length:null),R(s.length),Xe.current()}else{let n=await h(t,i({id:`8RtNI0`}));if(!e)return;if(!n.ok)vt(n.title),I(null);else{let e=ka.safeParse(n.body);if(!e.success)vt(i({id:`HlmZBk`})),I(null);else{let t=Il(e.data.documents),n=Pl(t,tt());E(e=>KZ(e,``,n,Be.current)),A(null),gt(),I(e.data.truncated===!0?e.data.documents.length:null),R(t.length),Xe.current()}}}}catch(t){let r=t;if(n.signal.aborted)return;e&&(r instanceof VZ?vt(r.message):bt()),console.warn(`[FileTree] fetch failed:`,r)}e&&O(!1)},()=>t?.abort());nt.current=()=>n.request(),n.request();let r=()=>{document.visibilityState===`visible`&&n.request()};window.addEventListener(`focus`,r),window.addEventListener(`visibilitychange`,r);let a=Yl(e=>{e.includes(`files`)&&n.request()});return()=>{e=!1,nt.current=null,n.dispose();for(let e of Ge.current.values())e.abort();Ge.current.clear(),window.removeEventListener(`focus`,r),window.removeEventListener(`visibilitychange`,r),a()}},t[97]=i,t[98]=bt,t[99]=Un):Un=t[99];let Wn;t[100]===i?Wn=t[101]:(Wn=[i],t[100]=i,t[101]=Wn),(0,Q.useEffect)(Un,Wn);let Gn=(0,Q.useRef)(!0),Kn;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(Kn=()=>{if(Gn.current){Gn.current=!1;return}nt.current?.()},t[102]=Kn):Kn=t[102];let qn;t[103]!==Bt||t[104]!==Ht||t[105]!==Vt?(qn=[Bt,Vt,Ht],t[103]=Bt,t[104]=Ht,t[105]=Vt,t[106]=qn):qn=t[106],(0,Q.useEffect)(Kn,qn);let Jn,Yn;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Jn=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=p(sa,n,`workspace`,null);r&&re({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(WQ),()=>{e=!1}},Yn=[],t[107]=Jn,t[108]=Yn):(Jn=t[107],Yn=t[108]),(0,Q.useEffect)(Jn,Yn);let Xn;t[109]!==mn||t[110]!==Qt||t[111]!==rn?(Xn=()=>{if(Oe.current===rn){Oe.current=null;return}Qt.resetPaths(an.current,{initialExpandedPaths:mn()})},t[109]=mn,t[110]=Qt,t[111]=rn,t[112]=Xn):Xn=t[112];let Zn;t[113]!==Qt||t[114]!==rn?(Zn=[Qt,rn],t[113]=Qt,t[114]=rn,t[115]=Zn):Zn=t[115],(0,Q.useEffect)(Xn,Zn),kZ(Qt,Mt,un,Ae,rn);let Qn,$n;t[116]!==Qt||t[117]!==r?(Qn=()=>{if(!r)return;let e=0,t=0,n=()=>rt.current?.querySelector(`file-tree-container`)?.shadowRoot?.querySelector(`[data-file-tree-virtualized-list]`)??null,i=()=>{let e=n();if(!e)return;let t=Number.parseFloat(e.style.height);Number.isFinite(t)&&r(t)},a=()=>{cancelAnimationFrame(e),e=requestAnimationFrame(i)},o=new MutationObserver(i),s=()=>{let e=n();e?(o.observe(e,{attributes:!0,attributeFilter:[`style`]}),i()):t=requestAnimationFrame(s)};s();let c=Qt.subscribe(a);return window.addEventListener(`resize`,a),()=>{cancelAnimationFrame(e),cancelAnimationFrame(t),o.disconnect(),c(),window.removeEventListener(`resize`,a)}},$n=[r,Qt],t[116]=Qt,t[117]=r,t[118]=Qn,t[119]=$n):(Qn=t[118],$n=t[119]),(0,Q.useEffect)(Qn,$n);let er;t[120]===Symbol.for(`react.memo_cache_sentinel`)?(er=()=>{oe(!1)},t[120]=er):er=t[120];let tr;t[121]===jt?tr=t[122]:(tr=[jt],t[121]=jt,t[122]=tr),(0,Q.useEffect)(er,tr);let nr,rr;t[123]===ae?(nr=t[124],rr=t[125]):(nr=()=>{se.current=ae;for(let e of le.current)e()},rr=[ae],t[123]=ae,t[124]=nr,t[125]=rr),(0,Q.useEffect)(nr,rr);let ir;t[126]!==Mt||t[127]!==D||t[128]!==Qt?(ir=()=>{D||!Mt||lZ(Qt,Mt)},t[126]=Mt,t[127]=D,t[128]=Qt,t[129]=ir):ir=t[129];let ar;t[130]!==un||t[131]!==Mt||t[132]!==D||t[133]!==Qt||t[134]!==rn?(ar=[Mt,un,rn,D,Qt],t[130]=un,t[131]=Mt,t[132]=D,t[133]=Qt,t[134]=rn,t[135]=ar):ar=t[135],(0,Q.useEffect)(ir,ar);let or,sr;t[136]===Qt?(or=t[137],sr=t[138]):(or=()=>Qt.subscribe(()=>{if(!Qt.isSearchOpen())for(let e of Te.current){let t=EZ(Qt.getItem(e));t&&!t.isExpanded()&&t.expand()}}),sr=[Qt],t[136]=Qt,t[137]=or,t[138]=sr),(0,Q.useEffect)(or,sr);let cr,lr;t[139]===Qt?(cr=t[140],lr=t[141]):(cr=()=>Qt.subscribe(()=>Ye.current()),lr=[Qt],t[139]=Qt,t[140]=cr,t[141]=lr),(0,Q.useEffect)(cr,lr);let ur,dr;t[142]===Qt?(ur=t[143],dr=t[144]):(ur=()=>Qt.onMutation(`remove`,e=>{let t=Ee.current;!t||e.path!==t.renamePath||De.current(t)}),dr=[Qt],t[142]=Qt,t[143]=ur,t[144]=dr),(0,Q.useEffect)(ur,dr);let fr;t[145]!==y||t[146]!==me||t[147]!==g||t[148]!==Tn?(fr=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??_e.current,l=new Map,u=new Map;for(let e of ue.current){if(Fl(e)){let t=o.find(t=>t.fromPath===Kf(e.docName,e.docExt))?.toPath;t&&l.set(e.docName,t);continue}if(Vl(e)){let t=o.find(t=>t.fromPath===e.path)?.toPath;t&&jl(t)&&u.set(e.path,Mf(t))}}let d=c?l.get(c)??null:null,f=r?.folderPath??(ct.current?.kind===`folder`?ct.current.folderPath:null),p=f?ie(f,a):null,m=r?.assetPath??(ct.current?.kind===`asset`?ct.current.assetPath:null),h=m?u.get(m)??null:null,_=d?null:h??sI(c,e),v=d??(m?h?null:o.find(e=>e.fromPath===m)?.toPath??ie(m,a):null);await g({renamed:e,renamedFolders:a,renamedAssets:o,additionalRemovedDocNames:[...l.keys()]});for(let t of e)y(t.toDocName);for(let e of u.values())y(e);let b=null;E(t=>{let n=rI(t,e,a,o,s);return b=n,Tn(t,n,e,o),Dn(n),n}),f&&p&&p!==f?me({kind:`folder`,folderPath:p}):_&&_!==c?(me({kind:`doc`,docName:_}),sQ(_)):v&&(d||v!==m)&&me({kind:`asset`,assetPath:v,entries:b??ue.current}),eu([`files`,`backlinks`,`graph`])},t[145]=y,t[146]=me,t[147]=g,t[148]=Tn,t[149]=fr):fr=t[149];let pr=fr;async function mr(e){let t=!e.isFolder&&kn(e.sourcePath),n=t?e.sourcePath:Lf(e.sourcePath,e.isFolder);B(n),A(null);try{let r=Ml(e.sourcePath,e.destinationPath,e.isFolder),a=!e.isFolder&&!t&&!jl(r.destinationPath),o=t||a?r.destinationPath:Lf(r.destinationPath,e.isFolder),s=e.isFolder?{kind:`folder`,fromPath:Qf(n),toPath:Qf(o)}:t||a?{kind:`asset`,fromPath:n,toPath:o}:{kind:`file`,fromPath:Zf(n,ue.current),toPath:o},c={docName:_e.current,folderPath:ct.current?.kind===`folder`?ct.current.folderPath:null,assetPath:ct.current?.kind===`asset`?ct.current.assetPath:null},l=await h(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(s)}),i({id:`gijbne`}));if(!l.ok){dl.error(l.title),gn();let e=Ee.current;e&&e.renamePath===n?await Bn(e):Rn(),B(null);return}let u=p(gi,l.body,`rename-path`,{renamed:[],renamedAssets:[]});try{await pr(u.renamed,e.isFolder?[{fromPath:Qf(n),toPath:Qf(o)}]:[],u.renamedAssets,c,!e.isFolder&&!t&&!a?u.renamed.flatMap(e=>{let t=Nl(o);return t?[{toDocName:e.toDocName,docExt:t}]:[]}):[])}catch(e){console.warn(`[FileTree] post-rename reconciliation failed`,{err:e,sourceTreePath:n,destinationTreePath:o,renamedCount:u.renamed.length,renamedAssetCount:u.renamedAssets.length}),dl.error(i({id:`dDpCOp`}))}Rn(),B(null)}catch(e){console.warn(`[FileTree] rename failed:`,e);let t=i({id:`HIb0vl`});dl.error(t),A(t),gn();let r=Ee.current;r&&r.renamePath===n?await Bn(r):Rn(),B(null)}}let hr;t[150]!==i||t[151]!==pr||t[152]!==gn?(hr=async function(e){let t=e.draggedPaths.map(t=>{let n=Rf(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(UQ);if(t.length!==0){B(t[0]?.sourcePath??null),A(null);try{let e=[],n=[],r=[],a={docName:_e.current,folderPath:ct.current?.kind===`folder`?ct.current.folderPath:null,assetPath:ct.current?.kind===`asset`?ct.current.assetPath:null};for(let a of t){let t=a.sourcePath.endsWith(`/`),o=!t&&kn(a.sourcePath),s=o?null:Zf(a.sourcePath,ue.current),c=t?{kind:`folder`,fromPath:Qf(a.sourcePath),toPath:Qf(a.destinationTreePath)}:o?{kind:`asset`,fromPath:a.sourcePath,toPath:a.destinationTreePath}:{kind:`file`,fromPath:s??Mf(a.sourcePath),toPath:s&&jl(s)?a.destinationTreePath:Mf(a.destinationTreePath)},l=await h(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(c)}),i({id:`dOHMA0`}));if(!l.ok){dl.error(l.title),gn(),B(null);return}let u=p(gi,l.body,`rename-path:drop`,{renamed:[],renamedAssets:[]});e=e.concat(u.renamed),n=n.concat(u.renamedAssets),t&&r.push({fromPath:Qf(a.sourcePath),toPath:Qf(a.destinationTreePath)})}try{await pr(e,r,n,a)}catch(r){console.warn(`[FileTree] post-move reconciliation failed`,{err:r,operationCount:t.length,renamedCount:e.length,renamedAssetCount:n.length}),dl.error(i({id:`8OxKZy`}))}B(null)}catch(e){console.warn(`[FileTree] move failed:`,e),dl.error(i({id:`HIb0vl`})),gn(),B(null)}}},t[150]=i,t[151]=pr,t[152]=gn,t[153]=hr):hr=t[153];let gr=hr,_r;t[154]!==i||t[155]!==y||t[156]!==gn?(_r=async function(e,t,n){if(e.length===0||Ie.current!==null)return;let r=()=>{Ie.current=null,B(null)};Ie.current=n,B(n),A(null);let a=[],o=0,s=0;for(let n of e){let e=new FormData;e.append(`file`,n),qf(e,t,n.name||`upload`);try{let r=await h(await fetch(`/api/upload`,{method:`POST`,body:e}),i({id:`4Gz2wC`}));if(!r.ok){s+=1,dl.error(r.title,{description:n.name});continue}let c=p(Ti,r.body,`upload:drop`,null);if(c===null){s+=1,dl.error(i({id:`4Gz2wC`}),{description:n.name});continue}let l=kf(t,c);if(c.deduped===!0){s+=1,dl.error(i({id:`4sKwf6`}),{description:l});continue}o+=1;let u=Jf(l,n);u&&a.push(u)}catch(e){let t=e;s+=1,console.warn(`[FileTree] external file upload failed:`,t),dl.error(t instanceof TypeError?i({id:`HIb0vl`}):i({id:`4Gz2wC`}),{description:n.name})}}try{if(a.length>0){for(let e of a)Fl(e)&&y(e.docName);E(e=>{let t=new Set(e.map(Pf)),n=!1,r=[...e];for(let e of a){let i=Pf(e);Be.current.set(i,Date.now()),!t.has(i)&&(t.add(i),r.push(e),n=!0)}return n?(gn(r),Dn(r),r):e})}o>0&&(eu([`files`,`backlinks`,`graph`]),nt.current?.(),dl.success(vl._({id:`v75Em9`,values:{uploadedCount:o}}),{description:t||i({id:`RSqaSd`})})),s>0&&A(o>0?vl._({id:`yH7T4q`,values:{failedCount:s}}):i({id:`4Gz2wC`})),r()}catch(e){let t=e,n=i({id:`VcqWBy`});console.warn(`[FileTree] upload post-upload reconciliation failed:`,t),dl.error(n),A(n),r()}},t[154]=i,t[155]=y,t[156]=gn,t[157]=_r):_r=t[157];let vr=_r,yr;t[158]===Symbol.for(`react.memo_cache_sentinel`)?(yr=function(e){ne({parentDir:e})},t[158]=yr):yr=t[158];let br=yr,xr;t[159]!==i||t[160]!==y||t[161]!==Bn||t[162]!==Rn||t[163]!==Qt||t[164]!==me||t[165]!==gn||t[166]!==nn?(xr=async function(e,t,n){if(Ie.current)return;let r=Ee.current;r&&Rn(r);try{let r=Uf(e,t,[...nn,...cn.current]);B(r.renamePath),Ie.current=r.renamePath;let a=window.location.hash,o;if(e===`file`){let e=jf(`file`,r.addPath),t={path:e};n?.template&&(t.template=n.template);let a=await h(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),i({id:`fJgQHX`}));if(!a.ok){dl.error(a.title),B(null),Ie.current=null;return}let s=Mf(e),c=p(qi,a.body,`create-page`,{docName:s}).docName;o=c;let l={kind:`document`,docName:c,docExt:e.toLowerCase().endsWith(`.mdx`)?`.mdx`:`.md`,modified:new Date().toISOString(),size:0};y(c),E(e=>{if(e.some(e=>Fl(e)&&e.docName===c))return e;let t=[...e,l];return Dn(t),Be.current.set(Pf(l),Date.now()),t}),eu([`files`,`backlinks`,`graph`]),me({kind:`doc`,docName:c})}else{let e=Qf(r.addPath),t=await h(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),i({id:`K1ckLX`}));if(!t.ok){dl.error(t.title),B(null),Ie.current=null;return}o=p(to,t.body,`create-folder`,{path:e}).path;let n={kind:`folder`,path:o,modified:new Date().toISOString(),size:0};E(e=>{if(e.some(e=>Rl(e)&&e.path===o))return e;let t=[...e,n];return Dn(t),Be.current.set(Pf(n),Date.now()),t}),eu([`files`]),me({kind:`folder`,folderPath:o})}let s=!1,c=e=>{if(e.key!==`Enter`)return;let t=Ee.current;!t||t.renamePath!==r.renamePath||queueMicrotask(()=>Rn(t))};document.addEventListener(`keydown`,c,!0),Ee.current={kind:e,renamePath:r.renamePath,createdPath:o,previousHash:a,disposeCommitListener:()=>{s||(s=!0,document.removeEventListener(`keydown`,c,!0))}},B(null),Ie.current=null,Qt.add(r.addPath),Qt.startRenaming(r.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),dl.error(i({id:`S6l5dv`}));let t=Ee.current;t?await Bn(t):Rn(),B(null),Ie.current=null,gn()}},t[159]=i,t[160]=y,t[161]=Bn,t[162]=Rn,t[163]=Qt,t[164]=me,t[165]=gn,t[166]=nn,t[167]=xr):xr=t[167];let Sr=xr,Cr;t[168]===Qt?Cr=t[169]:(Cr=function(e){let t=Wf(e);(0,Q.startTransition)(()=>{for(let e of cn.current)if(e===t||e.startsWith(t)){let t=EZ(Qt.getItem(e));t&&t.expand()}})},t[168]=Qt,t[169]=Cr);let wr=Cr,Tr;t[170]===Qt?Tr=t[171]:(Tr=function(e){let t=Wf(e),n=new Set(Te.current);(0,Q.startTransition)(()=>{for(let e of[...cn.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=EZ(Qt.getItem(e));t&&t.collapse()}})},t[170]=Qt,t[171]=Tr);let Er=Tr,Dr;t[172]===Symbol.for(`react.memo_cache_sentinel`)?(Dr=function(){return((rt.current?.querySelector(`file-tree-container`)?.shadowRoot)?.querySelector(`[aria-selected="true"][data-item-path]`))?.dataset.itemPath??null},t[172]=Dr):Dr=t[172];let Or=Dr,kr;t[173]!==ge||t[174]!==ln||t[175]!==o||t[176]!==s||t[177]!==ye||t[178]!==z||t[179]!==Bn||t[180]!==xn||t[181]!==T||t[182]!==sn||t[183]!==gr||t[184]!==mr||t[185]!==en||t[186]!==b||t[187]!==In||t[188]!==Cn||t[189]!==Se||t[190]!==Bt||t[191]!==Ht||t[192]!==Vt||t[193]!==nn||t[194]!==vr?(kr=()=>{ue.current=T,Ce.current=Se,de.current=b,_e.current=o,ct.current=s,be.current=ye,Ie.current=z,Ze.current=Bt,Qe.current=Vt,$e.current=Ht,an.current=nn,cn.current=sn,Te.current=ln,Ye.current=xn,Xe.current=Cn,De.current=Bn,Fe.current=(e,t,n)=>{vr(e,t,n)},it.current=e=>{if(Ae.current||je.current||e.length!==1)return;let t=e[0];if(t){oe(!1);let e=en(t),n=fe.current,r=n!==null&&Mf(n)===Mf(e),i=r?n:e;fe.current=null,queueMicrotask(()=>{ge(en((r?null:Or())??i),ue.current)})}},ot.current=e=>{In(e)||dl.error(e)},at.current=mr,st.current=gr},t[173]=ge,t[174]=ln,t[175]=o,t[176]=s,t[177]=ye,t[178]=z,t[179]=Bn,t[180]=xn,t[181]=T,t[182]=sn,t[183]=gr,t[184]=mr,t[185]=en,t[186]=b,t[187]=In,t[188]=Cn,t[189]=Se,t[190]=Bt,t[191]=Ht,t[192]=Vt,t[193]=nn,t[194]=vr,t[195]=kr):kr=t[195],(0,Q.useLayoutEffect)(kr);let Ar,jr;t[196]===Qt?(Ar=t[197],jr=t[198]):(Ar=()=>{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||HX(e.target))return;let c=rt.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=zX(Qt,ue.current,be.current);if(!t)return;Le.current=t,e.preventDefault(),e.stopPropagation();return}if(o){let t=Le.current;if(!t)return;Mn.current(t),e.preventDefault(),e.stopPropagation();return}if(i){let t=zX(Qt,ue.current,be.current);if(!t)return;Mn.current(t),e.preventDefault(),e.stopPropagation();return}if(s){if(Ie.current!==null)return;let t=BX(Qt,ue.current);if(t.length===0)return;H({targets:t}),e.preventDefault(),e.stopPropagation();return}let p=new Set([...cn.current,...an.current]);Ae.current=!0;for(let e of p)e&&Qt.getItem(e)?.select();queueMicrotask(()=>{Ae.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},jr=[Qt],t[196]=Qt,t[197]=Ar,t[198]=jr),(0,Q.useEffect)(Ar,jr);let Mr,Nr;t[199]!==T.length||t[200]!==D?(Mr=()=>{if(D||T.length===0)return;let e=rt.current?.querySelector(WB)?.shadowRoot;if(!e)return;let t=HQ,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()},Nr=[D,T.length],t[199]=T.length,t[200]=D,t[201]=Mr,t[202]=Nr):(Mr=t[201],Nr=t[202]),(0,Q.useEffect)(Mr,Nr);let Pr,Fr;t[203]!==T.length||t[204]!==D?(Pr=()=>{if(D||T.length===0)return;let e=rt.current?.querySelector(WB)?.shadowRoot;if(!e)return;let t=()=>cX(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()},Fr=[D,T.length],t[203]=T.length,t[204]=D,t[205]=Pr,t[206]=Fr):(Pr=t[205],Fr=t[206]),(0,Q.useEffect)(Pr,Fr);let Ir=zt?.validation?.fileTreeIndicators!==!1,Lr,Rr;t[207]!==T.length||t[208]!==D||t[209]!==Ir?(Lr=()=>{if(D||T.length===0)return;let e=rt.current?.querySelector(WB)?.shadowRoot;if(!e)return;if(!Ir){YX(e,new Map);return}let t=()=>YX(e,Ad());t();let n=new MutationObserver(t);n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]});let r=Dd(t);return()=>{n.disconnect(),r()}},Rr=[D,T.length,Ir],t[207]=T.length,t[208]=D,t[209]=Ir,t[210]=Lr,t[211]=Rr):(Lr=t[210],Rr=t[211]),(0,Q.useEffect)(Lr,Rr);let zr,Br;t[212]!==T.length||t[213]!==D?(zr=()=>{if(D||T.length===0)return;let e=rt.current?.querySelector(WB)?.shadowRoot;if(!e)return;let t=()=>iZ(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},Br=[D,T.length],t[212]=T.length,t[213]=D,t[214]=zr,t[215]=Br):(zr=t[214],Br=t[215]),(0,Q.useEffect)(zr,Br);let Vr;t[216]===Symbol.for(`react.memo_cache_sentinel`)?(Vr={folderCount:0,expandedCount:0},t[216]=Vr):Vr=t[216];let Hr=(0,Q.useRef)(Vr),Ur=(0,Q.useRef)(Sr),Wr=(0,Q.useRef)(br),Gr;t[217]===Sr?Gr=t[218]:(Gr=()=>{Ur.current=Sr,Wr.current=br},t[217]=Sr,t[218]=Gr),(0,Q.useEffect)(Gr);let Kr,qr;t[219]===Qt?(Kr=t[220],qr=t[221]):(Kr=()=>({startCreating(e,t){Ur.current(e,t)},startCreatingFromTemplate(e){Wr.current(e)},createFromTemplate(e,t){Ur.current(`file`,e,{template:t})},expandAll(){(0,Q.startTransition)(()=>{for(let e of cn.current){let t=EZ(Qt.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(Te.current);(0,Q.startTransition)(()=>{for(let t of[...cn.current].reverse()){if(e.has(t))continue;let n=EZ(Qt.getItem(t));n&&n.collapse()}})},getFolderState(){let e=cn.current,t=0;for(let n of e)EZ(Qt.getItem(n))?.isExpanded()&&t++;let n=e.length,r=Hr.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return Hr.current=i,i},isCreationTargetCleared(){return se.current},clearCreationTarget(){oe(!0)},subscribe(e){le.current.add(e);let t=Qt.subscribe(e);return()=>{le.current.delete(e),t()}}}),qr=[Qt],t[219]=Qt,t[220]=Kr,t[221]=qr),(0,Q.useImperativeHandle)(n,Kr,qr);async function Jr(e,t,n){let r=UX(e,ue.current,cn.current),i=Ee.current;i&&e.some(e=>WX(e,i))&&(i.kind===`file`?r.docNames.add(i.createdPath):r.folderPaths.add(i.createdPath),Rn(i));let a=new Set([...r.docNames,...t]),o=new Set([...r.folderPaths,...n]),s=new Set([...r.assetPaths,...e.filter(VQ).map(BQ)]);await m({tabIdsToClose:[...[...a].map(zQ),...[...o].map(RQ),...[...s].map(LQ)],docNamesToClear:[...a]});for(let t of e){let e=t.kind===`folder`?Wf(t.path):t.kind===`asset`?t.path:Kf(t.path,t.docExt);Qt.getItem(e)&&Qt.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}E(e=>{let t=iI(e,[...a],void 0,[...s]);for(let e of o)t=iI(t,[],e);return Dn(t),t}),eu([`files`,`backlinks`,`graph`])}let Yr;t[222]!==i||t[223]!==Jr?(Yr=async function(e){let t=[],n=[],r=[];for(let a of e){let e=a.kind;B(a.path);let o=await h(await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),i({id:`7JtSLi`}));if(!o.ok)return r.length>0&&await Jr(r,t,n),dl.error(o.title),!1;let s=p(zi,o.body,`delete-path`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path),r.push(a)}return await Jr(r,t,n),!0},t[222]=i,t[223]=Jr,t[224]=Yr):Yr=t[224];let Xr=Yr,Zr;t[225]===Symbol.for(`react.memo_cache_sentinel`)?(Zr=async function(e,t,n){let r=[],i=[];for(let a of e){B(a.path);let e=cI(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:yZ(o.reason),detail:o.detail})}return{trashed:r,failed:i}},t[225]=Zr):Zr=t[225];let Qr=Zr,$r;t[226]===i?$r=t[227]:($r=async function(e){let t=[],n=[],r=[];for(let a of e){let e=a.kind;try{let o=await h(await fetch(`/api/trash/cleanup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),i({id:`DVh_Tb`}));if(!o.ok){console.warn(`[FileTree] trash-cleanup failed`,{target:`${a.kind}:${a.path}`,reason:o.title}),r.push({target:a,reason:o.title});continue}let s=p(Ai,o.body,`trash-cleanup`,{deletedDocNames:[]});t.push(...s.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}),r.push({target:a,reason:i({id:`r4R7AZ`})})}}if(r.length>0){let e=r.length;dl.error(i({id:`IrB5AK`,values:{failedCount:e}}),{description:i({id:`vEJDlt`})})}return r.length===e.length&&e.length>0?null:{deletedDocNames:t,deletedFolderPaths:n}},t[226]=i,t[227]=$r);let ei=$r,ti;t[228]!==i||t[229]!==K||t[230]!==Jr||t[231]!==Xr||t[232]!==ei||t[233]!==gn||t[234]!==q?(ti=async function(e){let t=e.filter(IQ).map(e=>aI(e,ue.current)),n=t[0];if(!n)return;let r=K.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(r.length>0){let e=r.slice(0,3).map(FQ),t=r.length>e.length?`, +${r.length-e.length} more`:``;dl.error(`Cannot delete files with unresolved conflicts`,{description:`Resolve the conflict on ${e.join(`, `)}${t} before deleting.`});return}B(n.path),H(null);let a=typeof window<`u`?window.okDesktop:void 0;try{if(a&&q){let{trashed:e,failed:n}=await Qr(t,a,q);if(e.length>0){let t=await ei(e);t?await Jr(e,t.deletedDocNames,t.deletedFolderPaths):await Jr(e,e.filter(PQ).map(NQ),e.filter(MQ).map(jQ))}n.length>0&&G({failed:n,originalTargets:[...t]}),B(null)}else{let e=await Xr(t);B(null),e||gn()}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] delete failed:`,t),dl.error(i({id:`0eHrMb`}),{description:n}),B(null),gn()}},t[228]=i,t[229]=K,t[230]=Jr,t[231]=Xr,t[232]=ei,t[233]=gn,t[234]=q,t[235]=ti):ti=t[235];let ni=ti,ri;t[236]!==i||t[237]!==Xr||t[238]!==gn||t[239]!==W?(ri=async function(){if(!W)return;let e=new Set(W.failed.map(AQ)),t=W.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));if(G(null),t.length!==0){B(t[0]?.path??null);try{let e=await Xr(t);B(null),e||gn()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] hard-delete fallback failed:`,t),dl.error(i({id:`0eHrMb`}),{description:n}),B(null),gn()}}},t[236]=i,t[237]=Xr,t[238]=gn,t[239]=W,t[240]=ri):ri=t[240];let ii=ri,ai;t[241]!==ni||t[242]!==W?(ai=async function(){if(!W)return;let e=new Set(W.failed.map(kQ)),t=W.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));G(null),await ni(t)},t[241]=ni,t[242]=W,t[243]=ai):ai=t[243];let oi=ai,si=(0,Q.useRef)(ni),ci;t[244]===ni?ci=t[245]:(ci=()=>{si.current=ni},t[244]=ni,t[245]=ci),(0,Q.useEffect)(ci);let li,ui;t[246]===Symbol.for(`react.memo_cache_sentinel`)?(li=()=>PZ(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=ue.current.find(e=>Fl(e)&&e.docName===t);si.current([{kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt}]);return}if(e.kind===`folder`){si.current([{kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath}]);return}if(e.kind===`asset`){si.current([{kind:`asset`,path:e.assetPath,name:e.assetPath.split(`/`).pop()??e.assetPath}]);return}console.warn(JSON.stringify({event:`file-tree-menu-action-delete-unsupported-kind`,kind:e.kind}))}),ui=[],t[246]=li,t[247]=ui):(li=t[246],ui=t[247]),(0,Q.useEffect)(li,ui);let di,fi;t[248]===Symbol.for(`react.memo_cache_sentinel`)?(di=()=>RZ(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=ue.current.find(e=>Fl(e)&&e.docName===t);Mn.current({kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt});return}if(e.kind===`folder`){Mn.current({kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath});return}console.warn(JSON.stringify({event:`file-tree-menu-action-duplicate-unsupported-kind`,kind:e.kind}))}),fi=[],t[248]=di,t[249]=fi):(di=t[248],fi=t[249]),(0,Q.useEffect)(di,fi);let pi,mi;t[250]===Qt?(pi=t[251],mi=t[252]):(pi=()=>IZ(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=Kf(t,ue.current.find(e=>Fl(e)&&e.docName===t)?.docExt);Qt.startRenaming(n);return}if(e.kind===`folder`){Qt.startRenaming(e.folderPath);return}if(e.kind===`asset`){Qt.startRenaming(e.assetPath);return}console.warn(JSON.stringify({event:`file-tree-menu-action-rename-unsupported-kind`,kind:e.kind}))}),mi=[Qt],t[250]=Qt,t[251]=pi,t[252]=mi),(0,Q.useEffect)(pi,mi);let hi;t[253]===Symbol.for(`react.memo_cache_sentinel`)?(hi=function(){let e=ke.current;e&&oQ(e),ke.current=null},t[253]=hi):hi=t[253];let _i=hi,vi;t[254]===Symbol.for(`react.memo_cache_sentinel`)?(vi=function(e){let t=NX(e);if(!t)return!1;let n=rt.current?.querySelector(WB)?.shadowRoot;if(!n)return!1;for(let e of n.querySelectorAll(`[data-item-path]`))if(e.dataset.itemPath===t)return!0;return!1},t[254]=vi):vi=t[254];let yi=vi,bi;t[255]===f?bi=t[256]:(bi=function(e){let t=n$(e.nativeEvent);if(!t||t.endsWith(`/`)){_i();return}let n=ue.current.find(e=>Pf(e)===t);if(n&&Vl(n)){_i();return}let r=n&&Fl(n)?n.docName:Zf(t,ue.current);if(n&&Fl(n)&&ya(n.size)){_i();return}ke.current!==r&&(_i(),ke.current=r,aQ(r,e=>f(e)))},t[255]=f,t[256]=bi);let xi=bi,Si;t[257]!==ge||t[258]!==Qt||t[259]!==me?(Si=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=r$(e.nativeEvent);if(!t){o$(e.nativeEvent)&&oe(!0);return}let n=t.getAttribute(`aria-selected`)===`true`,r=t.dataset.itemPath;if(!r)return;let i=t.dataset.itemType===`folder`?Wf(r):r;if(t.dataset.itemType===`folder`){let t=Qf(i),r=EZ(Qt.getItem(i));if(!n){e.preventDefault(),e.stopPropagation(),r&&!r.isExpanded()&&r.expand(),queueMicrotask(()=>me({kind:`folder`,folderPath:t}));return}if(Qt.getSelectedPaths().length!==1||window.location.hash===cu(t))return;e.preventDefault(),e.stopPropagation(),r&&!r.isExpanded()&&r.expand(),queueMicrotask(()=>me({kind:`folder`,folderPath:t}));return}if(!n){if(PX(i,an.current)||yi(i)){fe.current=i,setTimeout(()=>me({kind:`doc`,docName:i,registerPage:!0}),0);return}queueMicrotask(()=>ge(i));return}let a=Zf(i,ue.current);Qt.getSelectedPaths().length===1&&window.location.hash!==vu(a)&&queueMicrotask(()=>ge(i))},t[257]=ge,t[258]=Qt,t[259]=me,t[260]=Si):Si=t[260];let Ci=Si,wi;t[261]===Symbol.for(`react.memo_cache_sentinel`)?(wi=function(e){Vf(e.nativeEvent)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,ut(!0))},t[261]=wi):wi=t[261];let Ei=wi,Di;t[262]===Symbol.for(`react.memo_cache_sentinel`)?(Di=function(e){let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||ut(!1)},t[262]=Di):Di=t[262];let Oi=Di,ki;t[263]===vr?ki=t[264]:(ki=function(e){if(!Vf(e.nativeEvent))return;let t=Ff(e.nativeEvent);t.length!==0&&(e.preventDefault(),e.stopPropagation(),ut(!1),vr(t,``,mQ))},t[263]=vr,t[264]=ki);let ji=ki;if(D){let e;return t[265]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(c$,{}),t[265]=e):e=t[265],e}let Mi;t[266]!==i||t[267]!==j||t[268]!==N?(Mi=j?i(N?{id:`H-vDm3`}:{id:`09Tv5j`}):null,t[266]=i,t[267]=j,t[268]=N,t[269]=Mi):Mi=t[269];let Ni=Mi;if(T.length===0){if(Ni!==null){let e;return t[270]===Ni?e=t[271]:(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[270]=Ni,t[271]=e),e}if(k){let e;return t[272]===k?e=t[273]:(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:k})}),t[272]=k,t[273]=e),e}if(zl({visibility:{showHiddenFiles:Bt,showOnlyMarkdownFiles:Vt},unfilteredRootEntryCount:L,knownPageCount:x.size})===`filtered-to-zero`){let e;return t[274]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(QY,{}),t[274]=e):e=t[274],e}let e;t[275]===i?e=t[276]:(e=i({id:`5ZB7XC`}),t[275]=i,t[276]=e);let n=lt&&`bg-primary/5 ring-2 ring-primary/70 ring-inset`,r;t[277]===n?r=t[278]:(r=Y(`flex flex-1 flex-col items-center justify-center gap-3 rounded-md py-8`,n),t[277]=n,t[278]=r);let a;t[279]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:(0,Z.jsx)(J,{id:`xiv-dW`})}),t[279]=a):a=t[279];let o;t[280]===Sr?o=t[281]:(o=()=>Sr(`file`,``),t[280]=Sr,t[281]=o);let s;t[282]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(J,{id:`6ibbCg`}),t[282]=s):s=t[282];let c;t[283]===o?c=t[284]:(c=(0,Z.jsx)(X,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:o,children:s}),t[283]=o,t[284]=c);let l;return t[285]!==ji||t[286]!==e||t[287]!==r||t[288]!==c?(l=(0,Z.jsxs)(`section`,{"aria-label":e,className:r,onDragOver:Ei,onDragLeave:Oi,onDrop:ji,children:[a,c]}),t[285]=ji,t[286]=e,t[287]=r,t[288]=c,t[289]=l):l=t[289],l}let Pi=z!==null,Fi=V?.targets[0]??null,Ii=null;if(F!==null){let e;if(t[290]!==a.locale||t[291]!==F){let n=new Intl.NumberFormat(a.locale).format(F);e=vl._({id:`LuoJWu`,values:{truncatedShownCount:F,formattedCount:n}}),t[290]=a.locale,t[291]=F,t[292]=e}else e=t[292];Ii=e}let Li;t[293]!==k||t[294]!==Ni||t[295]!==Ii?(Li=(k||Ni!==null||Ii!==null)&&(0,Z.jsxs)(Z.Fragment,{children:[Ni===null?k&&(0,Z.jsx)(u$,{kind:`error`,children:k}):(0,Z.jsx)(u$,{kind:`reconnecting`,children:Ni}),Ii!==null&&(0,Z.jsx)(u$,{kind:`info`,children:Ii})]}),t[293]=k,t[294]=Ni,t[295]=Ii,t[296]=Li):Li=t[296];let Bi;t[297]===v?Bi=t[298]:(Bi=rX(v),t[297]=v,t[298]=Bi);let Vi=ae?``:void 0,Hi;t[299]===Vi?Hi=t[300]:(Hi={[_Q]:Vi},t[299]=Vi,t[300]=Hi);let Ui;t[301]!==Pi||t[302]!==ye||t[303]!==Er||t[304]!==T||t[305]!==wr||t[306]!==sn||t[307]!==jn||t[308]!==Pn||t[309]!==Lt||t[310]!==Qt||t[311]!==Rt||t[312]!==Sr||t[313]!==q?(Ui=(e,t)=>(0,Z.jsx)(xQ,{item:e,context:t,anyActionBusy:Pi,workspace:q,handoff:Lt,model:Qt,okignoreBinding:Rt,onStartCreating:Sr,onCreateFromTemplate:(e,t)=>Sr(`file`,e,{template:t}),onDuplicate:jn,onImportTemplate:Pn,onDelete:e=>H({targets:e}),onExpandSubtree:wr,onCollapseSubtree:Er,folderTreePaths:sn,isAsset:ye.has(e.path),documents:T}),t[301]=Pi,t[302]=ye,t[303]=Er,t[304]=T,t[305]=wr,t[306]=sn,t[307]=jn,t[308]=Pn,t[309]=Lt,t[310]=Qt,t[311]=Rt,t[312]=Sr,t[313]=q,t[314]=Ui):Ui=t[314];let Wi;t[315]!==Ci||t[316]!==xi||t[317]!==Qt||t[318]!==Li||t[319]!==Bi||t[320]!==Hi||t[321]!==Ui?(Wi=(0,Z.jsx)(`div`,{ref:rt,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(XY,{header:Li,model:Qt,style:Bi,...Hi,onClickCapture:Ci,onMouseMove:xi,onMouseLeave:_i,renderContextMenu:Ui})}),t[315]=Ci,t[316]=xi,t[317]=Qt,t[318]=Li,t[319]=Bi,t[320]=Hi,t[321]=Ui,t[322]=Wi):Wi=t[322];let Gi=!!V,Ki;t[323]===z?Ki=t[324]:(Ki=e=>{!e&&!z&&H(null)},t[323]=z,t[324]=Ki);let Ji;t[325]!==i||t[326]!==z||t[327]!==V||t[328]!==ni||t[329]!==Fi?(Ji=V&&Fi&&(0,Z.jsx)(rs,{...(()=>{let e=hZ(typeof window<`u`&&window.okDesktop!=null?`electron`:`web`,V.targets);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(OQ)}):null};let t=V.targets.length,n=Fi.name;return{itemName:t===1?Fi.kind===`folder`?`${Fi.name}/`:Fi.kind===`file`?`${Fi.name}${Fi.docExt??`.md`}`:Fi.name:void 0,customTitle:t>1?i({id:`abiHje`}):void 0,customDescription:t>1?i({id:`WMIKXK`,values:{targetCount:t}}):Fi.kind===`folder`?i({id:`a5W0q0`,values:{folderName:n}}):void 0}})(),isSubmitting:z!==null,onDelete:()=>ni(V.targets)}),t[325]=i,t[326]=z,t[327]=V,t[328]=ni,t[329]=Fi,t[330]=Ji):Ji=t[330];let Yi;t[331]!==Gi||t[332]!==Ki||t[333]!==Ji?(Yi=(0,Z.jsx)(_n,{open:Gi,onOpenChange:Ki,children:Ji}),t[331]=Gi,t[332]=Ki,t[333]=Ji,t[334]=Yi):Yi=t[334];let Xi=!!U,Zi;t[335]===z?Zi=t[336]:(Zi=e=>{!e&&!z&&ee(null)},t[335]=z,t[336]=Zi);let Qi;t[337]!==i||t[338]!==z||t[339]!==Fn||t[340]!==U?(Qi=U&&(0,Z.jsx)(rs,{itemName:U.name+(U.kind===`file`?U.docExt??`.md`:`.md`),customTitle:i({id:`hLod4_`}),customDescription:i({id:`RMQe3p`}),customConfirmLabel:i({id:`hvZwVx`}),customConfirmLabelBusy:i({id:`ul1Atu`}),isSubmitting:z!==null,onDelete:()=>Fn(U,!0)}),t[337]=i,t[338]=z,t[339]=Fn,t[340]=U,t[341]=Qi):Qi=t[341];let $i;t[342]!==Xi||t[343]!==Zi||t[344]!==Qi?($i=(0,Z.jsx)(_n,{open:Xi,onOpenChange:Zi,children:Qi}),t[342]=Xi,t[343]=Zi,t[344]=Qi,t[345]=$i):$i=t[345];let ea=!!W,ta;t[346]===z?ta=t[347]:(ta=e=>{!e&&!z&&G(null)},t[346]=z,t[347]=ta);let na;t[348]!==z||t[349]!==ii||t[350]!==oi||t[351]!==W?(na=W&&(0,Z.jsx)(CZ,{failedTargets:W.failed,isSubmitting:z!==null,onDeletePermanently:ii,onRetry:oi,onCancel:()=>G(null)}),t[348]=z,t[349]=ii,t[350]=oi,t[351]=W,t[352]=na):na=t[352];let ra;t[353]!==ea||t[354]!==ta||t[355]!==na?(ra=(0,Z.jsx)(_n,{open:ea,onOpenChange:ta,children:na}),t[353]=ea,t[354]=ta,t[355]=na,t[356]=ra):ra=t[356];let ia=te!==null,aa;t[357]===Symbol.for(`react.memo_cache_sentinel`)?(aa=e=>{e||ne(null)},t[357]=aa):aa=t[357];let oa=te?.parentDir??``,ca;t[358]!==ia||t[359]!==oa?(ca=(0,Z.jsx)(Z_,{open:ia,onOpenChange:aa,kind:`file`,initialDir:oa,defaultToTemplate:!0}),t[358]=ia,t[359]=oa,t[360]=ca):ca=t[360];let la;return t[361]!==Wi||t[362]!==Yi||t[363]!==$i||t[364]!==ra||t[365]!==ca?(la=(0,Z.jsxs)(Z.Fragment,{children:[Wi,Yi,$i,ra,ca]}),t[361]=Wi,t[362]=Yi,t[363]=$i,t[364]=ra,t[365]=ca,t[366]=la):la=t[366],la}function OQ(e){return(0,Z.jsx)(`li`,{"data-testid":`delete-target-row`,children:gZ(e)},`${e.kind}:${e.path}`)}function kQ(e){return`${e.kind}:${e.path}`}function AQ(e){return`${e.kind}:${e.path}`}function jQ(e){return e.path}function MQ(e){return e.kind===`folder`}function NQ(e){return e.path}function PQ(e){return e.kind===`file`}function FQ(e){return e.file}function IQ(e){return!Bl(e.path)}function LQ(e){return te(e)}function RQ(e){return We(e)}function zQ(e){return v(e)}function BQ(e){return e.path}function VQ(e){return e.kind===`asset`}function HQ(e){return e.endsWith(`/`)?e.slice(0,-1):e}function UQ(e){return!!e}function WQ(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function GQ(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function KQ(e){dl.error(e)}function qQ(){}function JQ(e){return dl.error(e)}function YQ(){}function XQ(){}function ZQ(){}function QQ(){}function $Q(){}async function e$(){}function t$(e){return Pf(e)}function n$(e){return r$(e)?.dataset.itemPath??null}function r$(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}function i$(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-root]`))return t;return null}function a$(e){let t=r$(e);if(t){let e=t.dataset.itemPath;if(!e)return null;let n=t.dataset.itemType===`folder`,r=If(e,n);return{parentDir:r,row:t,root:null,busyPath:n?Wf(r):e}}return o$(e)?{parentDir:``,row:null,root:i$(e),busyPath:mQ}:null}function o$(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-scroll]`))return!0;return!1}var s$=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function c$(){let e=(0,$.c)(5),{_:t}=mt(),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=s$.map(l$),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 l$(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(Ud,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(Ud,{className:`h-3 ${e}`})]},t)}function u$(e){let t=(0,$.c)(14),{kind:n,children:r}=e,i=n===`error`?al:n===`reconnecting`?Xc:Wc,a=n===`error`?`alert`:`status`,o=n===`error`?`text-destructive`:`text-muted-foreground`,s;t[0]===o?s=t[1]:(s=Y(`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=n===`reconnecting`&&`animate-spin motion-reduce:animate-none`,l;t[2]===c?l=t[3]:(l=Y(`mt-0.5 size-3.5 shrink-0`,c),t[2]=c,t[3]=l);let u;t[4]!==i||t[5]!==l?(u=(0,Z.jsx)(i,{"aria-hidden":`true`,className:l}),t[4]=i,t[5]=l,t[6]=u):u=t[6];let d;t[7]===r?d=t[8]:(d=(0,Z.jsx)(`span`,{className:`min-w-0`,children:r}),t[7]=r,t[8]=d);let f;return t[9]!==a||t[10]!==s||t[11]!==u||t[12]!==d?(f=(0,Z.jsxs)(`span`,{role:a,className:s,children:[u,d]}),t[9]=a,t[10]=s,t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function d$(e){return e?vl._({id:`wTcjov`}):null}function f$(e){let t=(0,$.c)(46),{_:n}=mt(),r=Ys(),i=Yo(),a=Ur(),o=Jr();if(r)return null;let{input:s,installStates:c,dispatch:l}=e,u=s===null,d,f,p,m,h,g,_,v,y,b,x;if(t[0]!==n||t[1]!==l||t[2]!==s||t[3]!==u||t[4]!==c||t[5]!==o||t[6]!==a||t[7]!==i){let e=d$(u),r;t[19]===o?r=t[20]:(r=e=>ei(o,e.id),t[19]=o,t[20]=r);let S=Yr.filter(r),C;t[21]===o?C=t[22]:(C=e=>Xr(o,e.source,e.id,!0,e.supported),t[21]=o,t[22]=C);let w=a.filter(C),T=i?so.filter(e=>Qr(o,e,i.installedClis)):[];p=S.length>0,m=i!==null&&T.length>0,h=w.length>0,f=Jv,t[23]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsxs)(Zv,{children:[(0,Z.jsx)(Ks,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`O7_W_a`})]}),t[23]=x):x=t[23],d=Qv,g=`max-h-80`,_=h?(0,Z.jsxs)(qv,{"aria-label":n({id:`vPKX2i`}),children:[(0,Z.jsxs)(ey,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(J,{id:`RXEbZy`}),(0,Z.jsx)($r,{})]}),w.map(t=>{let r=t.name;return(0,Z.jsxs)(Xv,{onSelect:()=>{s!==null&&us(s,{agent:{source:t.source,id:t.id}})},disabled:u,"data-testid":`empty-space-open-in-thread-${t.id}`,"aria-label":e?n({id:`gtGQ9S`,values:{agentName:r,hint:e}}):void 0,children:[(0,Z.jsx)(vo,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`5PrrYw`,values:{agentName:r}})}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[24]!==p||t[25]!==m||t[26]!==h?(v=h&&(m||p)?(0,Z.jsx)(ty,{}):null,t[24]=p,t[25]=m,t[26]=h,t[27]=v):v=t[27],y=m?(0,Z.jsxs)(qv,{"aria-label":n({id:`ALhMYW`}),children:[(0,Z.jsx)(ey,{children:(0,Z.jsx)(J,{id:`ALhMYW`})}),T.map(t=>{let{displayName:r}=Gi[t];return(0,Z.jsxs)(Xv,{onSelect:()=>{s!==null&&i.launchInTerminal(s,t)},disabled:u,"data-testid":`empty-space-open-in-terminal-${t}`,"aria-label":n(e?{id:`AIn2Yv`,values:{displayName:r,hint:e}}:{id:`QYfQdv`,values:{displayName:r}}),children:[(0,Z.jsx)(Zr,{id:Gr(t),"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,b=p?(0,Z.jsxs)(Z.Fragment,{children:[m?(0,Z.jsx)(ty,{}):null,(0,Z.jsxs)(qv,{"aria-label":n({id:`BBqGS9`}),children:[(0,Z.jsx)(ey,{children:(0,Z.jsx)(J,{id:`BBqGS9`})}),S.map(t=>{let r=!u,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)(Xv,{disabled:!r,onSelect:()=>{if(s){if(c[t.id]?.installed!==!0){cs(t);return}l(t.id,s)}},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(Zr,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=n,t[1]=l,t[2]=s,t[3]=u,t[4]=c,t[5]=o,t[6]=a,t[7]=i,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_,t[15]=v,t[16]=y,t[17]=b,t[18]=x}else d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=t[16],b=t[17],x=t[18];let S;t[28]!==p||t[29]!==m||t[30]!==h?(S=h||m||p?(0,Z.jsx)(ty,{}):null,t[28]=p,t[29]=m,t[30]=h,t[31]=S):S=t[31];let C;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(rl,{"aria-hidden":`true`}),t[32]=C):C=t[32];let w;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsxs)(Xv,{onSelect:Cl,"data-testid":`empty-space-open-in-settings`,children:[C,(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`jRAGrQ`})})]}),t[33]=w):w=t[33];let T;t[34]!==d||t[35]!==g||t[36]!==_||t[37]!==v||t[38]!==y||t[39]!==b||t[40]!==S?(T=(0,Z.jsxs)(d,{className:g,children:[_,v,y,b,S,w]}),t[34]=d,t[35]=g,t[36]=_,t[37]=v,t[38]=y,t[39]=b,t[40]=S,t[41]=T):T=t[41];let E;return t[42]!==f||t[43]!==x||t[44]!==T?(E=(0,Z.jsxs)(f,{children:[x,T]}),t[42]=f,t[43]=x,t[44]=T,t[45]=E):E=t[45],E}async function p$(e){try{let t=await e.project.listRecent(),n=e.config.projectPath;if(t.some(e=>e.path!==n))return null;let r=await NE();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 m$(e){let t=(0,$.c)(4),n=e===void 0?kE: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 p$(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 h$(e){let t=(0,$.c)(3),n=e===void 0?kE:e,r,i;t[0]===n?(r=t[1],i=t[2]):(r=()=>{if(n.getSnapshot().steps.file)return;let e=Yl(e=>{e.includes(`files`)&&PE(n)});return PE(n),e},i=[n],t[0]=n,t[1]=r,t[2]=i),(0,Q.useEffect)(r,i)}var g$=3,_$=5200,v$=1500,y$=220;function b$(e){let t=(0,$.c)(14),{complete:n,label:r,shortcutId:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(Jn,{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)(J,{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)(U,{children:kl(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 x$(e){let t=(0,$.c)(24),{store:n,lingerMs:r}=e,i=n===void 0?kE:n,a=r===void 0?_$:r,{_:o}=mt(),{steps:s}=AE(i);h$(i);let[c,l]=(0,Q.useState)(0),[u,d]=(0,Q.useState)(!1),f=1+ +!!s.file+ +!!s.askedAi,p=f===g$,m,h;t[0]!==p||t[1]!==a?(m=()=>{if(!p)return;l(C$);let e=setInterval(()=>l(S$),v$),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(),y$);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:Y(`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)(Yp,{size:36,celebrateSignal:c}),(0,Z.jsx)(`span`,{className:`font-medium text-sm`,children:(0,Z.jsx)(J,{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)(J,{id:`Y1QMlM`})}),(0,Z.jsx)(`span`,{className:`text-muted-foreground/60 text-xs tabular-nums`,children:`${f} / ${g$}`})]}),(0,Z.jsxs)(`ul`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(b$,{complete:!0,label:(0,Z.jsx)(J,{id:`4E9jPa`})}),(0,Z.jsx)(b$,{complete:s.file,label:(0,Z.jsx)(J,{id:`6ibbCg`}),shortcutId:`new-item`}),(0,Z.jsx)(b$,{complete:s.askedAi,label:(0,Z.jsx)(J,{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)(J,{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 S$(e){return e+1}function C$(e){return e+1}function w$(){let e=(0,$.c)(1);if(!m$())return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(x$,{}),e[0]=t):t=e[0],t}function T$(e){return e===null?null:e.kind===`local`?e.name:e.ref}function E$(e,t){if(e.length===0)return null;let n=`origin/${e}`;return t.includes(n)?n:t.find(t=>qa(t)===e)??null}function D$(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`helper-not-found`:return{id:`HqOPpj`};default:return{id:`-zA2E7`}}}function O$(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}=mt(),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:E$(R,f),H=V!==null,U=B||H,ee=B&&(s?.has(R)??!1),W=d.filter(e=>e.toLowerCase().startsWith(R.toLowerCase())),G=!A&&W.length>0&&!U,K=(a!==null&&!d.includes(a)?[a,...d]:d).map(N$),te=f.map(M$),ne=T$(w),q=O.trim().toLowerCase(),re=q===``?K:K.filter(e=>e.name.toLowerCase().includes(q)),ie=q===``?te:te.filter(e=>e.ref.toLowerCase().includes(q)),ae=q!==``&&re.length===0&&ie.length===0,oe=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(D$(t.reason)),j(!1);return}id(),r(!1),await i.project.open({path:t.path,target:`new-window`,entryPoint:`worktree`})}catch(e){console.warn(`[NewWorktreeDialog] worktree create/open failed:`,e),dl.error(m({id:`vAYoCZ`})),j(!1)}}},se=_n,ce;t[7]!==A||t[8]!==r?(ce=e=>{A||r(e)},t[7]=A,t[8]=r,t[9]=ce):ce=t[9];let le=pn,ue;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Z.jsx)(fn,{children:(0,Z.jsx)(J,{id:`DXd9LM`})}),t[10]=ue):ue=t[10];let de;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Z.jsxs)(gn,{children:[ue,(0,Z.jsx)(dn,{children:(0,Z.jsx)(J,{id:`NEzPEh`})})]}),t[11]=de):de=t[11];let fe=mn,pe;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Z.jsx)(J,{id:`ng2Ibo`}),t[12]=pe):pe=t[12];let me;t[13]===g?me=t[14]:(me=(0,Z.jsx)(Pr,{htmlFor:g,children:pe}),t[13]=g,t[14]=me);let he;t[15]===m?he=t[16]:(he=m({id:`IX_uXB`}),t[15]=m,t[16]=he);let ge;t[17]===M?ge=t[18]:(ge=e=>{S(e.target.value),M!==null&&N(null)},t[17]=M,t[18]=ge);let _e=M!==null,ve=M===null?y:`${y} ${b}`,ye;t[19]!==x||t[20]!==A||t[21]!==g||t[22]!==he||t[23]!==ge||t[24]!==_e||t[25]!==ve?(ye=(0,Z.jsx)(_l,{id:g,ref:P,value:x,placeholder:he,onChange:ge,disabled:A,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-invalid":_e,"aria-describedby":ve,"data-testid":`new-worktree-branch`}),t[19]=x,t[20]=A,t[21]=g,t[22]=he,t[23]=ge,t[24]=_e,t[25]=ve,t[26]=ye):ye=t[26];let be=R.length>0?(0,Z.jsxs)(`p`,{id:y,className:`flex items-start gap-1.5 text-1sm text-muted-foreground`,"data-testid":ee?`new-worktree-mode-existing-worktree`:H?`new-worktree-mode-remote-checkout`:B?`new-worktree-mode-checkout`:`new-worktree-mode-create`,children:[ee?(0,Z.jsx)(uc,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400`}):H?(0,Z.jsx)(vs,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-violet-600 dark:text-violet-400`}):B?(0,Z.jsx)(Po,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-blue-600 dark:text-blue-400`}):(0,Z.jsx)(Ht,{"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:ee?(0,Z.jsx)(J,{id:`QAi7Q9`,values:{trimmed:R},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`})}}):H?(0,Z.jsx)(J,{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)(J,{id:`b4VvP-`,values:{trimmed:R},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono`})}}):ne===null?(0,Z.jsx)(J,{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)(J,{id:`dGAdpH`,values:{trimmed:R,currentBaseLabel:ne},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,xe=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:W.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)(co,{"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,Se=U?null:(0,Z.jsxs)(`div`,{className:`mt-1 flex flex-col gap-2`,children:[(0,Z.jsx)(Pr,{id:v,htmlFor:_,children:(0,Z.jsx)(J,{id:`ZWwYwM`})}),(0,Z.jsxs)(zt,{open:E,onOpenChange:e=>{D(e),e||k(``)},children:[(0,Z.jsx)(Bt,{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)(vs,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}):(0,Z.jsx)(co,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-left`,children:ne===null?(0,Z.jsx)(J,{id:`EbjWsS`}):ne})]}),(0,Z.jsx)(vh,{"aria-hidden":`true`,className:`ml-2 size-4 shrink-0 opacity-50`})]})}),(0,Z.jsxs)(Gt,{align:`start`,className:`w-[var(--radix-popover-trigger-width)] p-1`,onWheel:j$,onTouchMove:A$,onOpenAutoFocus:e=>{e.preventDefault(),F.current?.focus()},children:[(0,Z.jsxs)(Oc,{className:`mb-1 h-8`,children:[(0,Z.jsx)(xc,{ref:F,"aria-label":m({id:`fuJZKk`}),placeholder:m({id:`hQXiDc`}),value:O,onChange:e=>k(e.target.value),onKeyDown:k$,"data-testid":`new-worktree-base-search`}),(0,Z.jsx)(Dc,{children:(0,Z.jsx)(Ge,{"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:[ae?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`Sh3Qkg`})}):null,re.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)(co,{"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)(J,{id:`6-wLTJ`,values:{behind:n}})}):null]},`local:${t}`)}),ie.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)(vs,{"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)(J,{id:`dIYSqk`})})]},`remote:${t}`)})]})]})]})]}),Ce;t[27]!==m||t[28]!==M||t[29]!==b?(Ce=M===null?null:(0,Z.jsx)(`p`,{id:b,role:`alert`,className:`text-1sm text-destructive`,"data-testid":`new-worktree-error`,children:m(M)}),t[27]=m,t[28]=M,t[29]=b,t[30]=Ce):Ce=t[30];let we;t[31]!==h||t[32]!==oe||t[33]!==me||t[34]!==ye||t[35]!==be||t[36]!==xe||t[37]!==Se||t[38]!==Ce?(we=(0,Z.jsxs)(`form`,{id:h,onSubmit:oe,className:`flex flex-col gap-2`,children:[me,ye,be,xe,Se,Ce]}),t[31]=h,t[32]=oe,t[33]=me,t[34]=ye,t[35]=be,t[36]=xe,t[37]=Se,t[38]=Ce,t[39]=we):we=t[39];let Te;t[40]!==fe||t[41]!==we?(Te=(0,Z.jsx)(fe,{children:we}),t[40]=fe,t[41]=we,t[42]=Te):Te=t[42];let Ee;t[43]===r?Ee=t[44]:(Ee=()=>r(!1),t[43]=r,t[44]=Ee);let De;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,Z.jsx)(J,{id:`dEgA5A`}),t[45]=De):De=t[45];let Oe;t[46]!==A||t[47]!==Ee?(Oe=(0,Z.jsx)(X,{type:`button`,variant:`outline`,onClick:Ee,disabled:A,"data-testid":`new-worktree-cancel`,children:De}),t[46]=A,t[47]=Ee,t[48]=Oe):Oe=t[48];let ke=!z,Ae;t[49]!==A||t[50]!==ee||t[51]!==B||t[52]!==H?(Ae=A?(0,Z.jsx)(J,{id:`b4itZn`}):ee?(0,Z.jsx)(J,{id:`XV5sC0`}):H?(0,Z.jsx)(J,{id:`XAyxsa`}):B?(0,Z.jsx)(J,{id:`uGaIIS`}):(0,Z.jsx)(J,{id:`iO8V-7`}),t[49]=A,t[50]=ee,t[51]=B,t[52]=H,t[53]=Ae):Ae=t[53];let je;t[54]!==h||t[55]!==ke||t[56]!==Ae?(je=(0,Z.jsx)(X,{type:`submit`,form:h,disabled:ke,"data-testid":`new-worktree-create`,children:Ae}),t[54]=h,t[55]=ke,t[56]=Ae,t[57]=je):je=t[57];let Me;t[58]!==Oe||t[59]!==je?(Me=(0,Z.jsxs)(hn,{children:[Oe,je]}),t[58]=Oe,t[59]=je,t[60]=Me):Me=t[60];let Ne;t[61]!==le||t[62]!==de||t[63]!==Te||t[64]!==Me?(Ne=(0,Z.jsxs)(le,{className:`sm:max-w-md`,"data-testid":`new-worktree-dialog`,children:[de,Te,Me]}),t[61]=le,t[62]=de,t[63]=Te,t[64]=Me,t[65]=Ne):Ne=t[65];let Pe;return t[66]!==se||t[67]!==n||t[68]!==Ne||t[69]!==ce?(Pe=(0,Z.jsx)(se,{open:n,onOpenChange:ce,children:Ne}),t[66]=se,t[67]=n,t[68]=Ne,t[69]=ce,t[70]=Pe):Pe=t[70],Pe}function k$(e){return e.stopPropagation()}function A$(e){e.stopPropagation()}function j$(e){e.stopPropagation()}function M$(e){return{kind:`remote`,ref:e}}function N$(e){return{kind:`local`,name:e}}function P$(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}=mt(),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),dl.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){dl.error(p({id:`teD0H9`}));return}id(),await n.project.open({path:t.path,target:`new-window`,entryPoint:`worktree`})}catch(e){console.warn(`[RecentProjectsMenu] create/open branch failed:`,e),dl.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)(z$,{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=Wv(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)(F$,{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 F$(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=Vv(n,i,r),m=p.filter(I$),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)(H$,{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)(Sr,{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)(ny,{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)(ry,{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)(L$,{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 I$(e){return e.opened&&!e.isMain}function L$(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}=mt(),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)(Po,{"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)(J,{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)(kr,{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)(R$,{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)(Cr,{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 R$(e){let t=(0,$.c)(15),{group:n,open:r,worktreeModel:i,entries:a,onPickFlyoutEntry:o,guardStaleSelect:s,openNewWorktreeWith:c}=e,{_:l}=mt(),[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)(Dc,{align:`inline-start`,children:(0,Z.jsx)(Ge,{"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)(Or,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:l({id:`-uaQnI`})}),C?(0,Z.jsxs)(Sr,{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)(Ht,{"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)(J,{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)(Sr,{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}),e.isMain?(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,children:l({id:`Bn9-El`})}):e.opened?null:(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,title:l({id:`Dvwa0U`}),children:l({id:`nfoduq`})}),e.isCurrent?(0,Z.jsx)(U$,{}):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)(jr,{children:(0,Z.jsxs)(wr,{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)(Oc,{className:`mb-1 h-8 shrink-0`,children:[w,(0,Z.jsx)(xc,{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 z$(e){let t=(0,$.c)(43),{recents:n,currentPath:r,query:i,worktreeModel:a,onPickEntry:o,onPickBranch:s,guardStaleSelect:c,onRemoveRecent:l}=e,{_:u}=mt(),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(B$)),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)(Or,{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)(ry,{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)(Sr,{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)(H$,{name:e.name,path:e.path,current:e.path===r})}),(0,Z.jsx)(ny,{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)(Sr,{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)(co,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),(0,Z.jsx)(V$,{branch:e.branch??e.name,project:e.mainRoot===void 0?null:Uv(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)(Sr,{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)(co,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 opacity-40`}),(0,Z.jsx)(V$,{branch:e.branch??``,project:a===null?null:Uv(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 B$(e){return e.path}function V$(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 H$(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=Y(`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)(Po,{"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 U$(){let e=(0,$.c)(4),{_:t}=mt(),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)(Po,{"aria-label":n,className:`size-3.5 shrink-0 text-muted-foreground`}),e[2]=n,e[3]=r),r}var W$=(e,t,n)=>Fv(e,t,n,`ProjectSwitcher`),G$=350;function K$(e){let t=(0,$.c)(121),{bridge:n}=e,{_:r}=mt(),[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=SP(),y=Mv(),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},G$)),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 W$(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=()=>Vt(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),W$(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),W$(()=>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),W$(()=>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=>W$(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,ee=n.config.projectPath,W;t[27]===c?W=t[28]:(W=c.trim().toLowerCase(),t[27]=c,t[28]=W);let G=W,K=G!==``,te;t[29]===i?te=t[30]:(te=i??[],t[29]=i,t[30]=te);let ne=te,q;t[31]!==K||t[32]!==ne?(q=K?ne.filter(e1):ne,t[31]=K,t[32]=ne,t[33]=q):q=t[33];let re=q,ie=K?null:y,ae=v!==null&&`h-auto py-1.5`,oe;t[34]===ae?oe=t[35]:(oe=Y(`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)(co,{"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)(vh,{"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)(Er,{asChild:!0,children:(0,Z.jsxs)(fP,{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]!==ee||t[58]!==g||t[59]!==re||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)(Or,{className:`font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(J,{id:`MUrVEo`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Oc,{className:`mb-1 h-8 border-0 shadow-none has-[[data-slot=input-group-control]:focus-visible]:ring-0`,children:[(0,Z.jsx)(xc,{"aria-label":r({id:`blFttG`}),placeholder:r({id:`RVZJWQ`}),value:c,onChange:e=>{e.target.value!==``&&_(null),l(e.target.value)},onKeyDown:$$,"data-testid":`project-switcher-search`}),(0,Z.jsx)(Dc,{children:(0,Z.jsx)(Ge,{"aria-hidden":`true`})})]}),(0,Z.jsx)(Nr,{}),(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)(P$,{bridge:n,recents:re,currentPath:ee,query:G,worktreeModel:ie,closeMenu:()=>T(!1),guardStaleSelect:D,onRemoveRecent:z,flyoutPath:g,setFlyoutPath:_,openNewWorktreeWith:U})})]}),t[55]=r,t[56]=n,t[57]=ee,t[58]=g,t[59]=re,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)(Nr,{}),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)(Sr,{onSelect:_e,"data-testid":`project-switcher-new-project`,children:[(0,Z.jsx)(Ht,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(J,{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)(Qe,{"aria-hidden":`true`,className:`text-muted-foreground`}),xe=(0,Z.jsx)(J,{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)(Sr,{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)(uc,{"aria-hidden":`true`,className:`text-muted-foreground`}),Te=(0,Z.jsx)(J,{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)(Sr,{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)(Un,{"aria-hidden":`true`,className:`text-muted-foreground`}),ke=(0,Z.jsx)(J,{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)(Sr,{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)(Nr,{}),(0,Z.jsxs)(Sr,{onSelect:e=>{D(e)||(T(!1),h(``),p(!0))},"data-testid":`project-switcher-new-worktree`,children:[(0,Z.jsx)(co,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(J,{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)(Ar,{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)(Mr,{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)(Fg,{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(Q$).filter(Z$),t[102]=y?.entries,t[103]=Fe);let Ie;t[104]===y?.entries?Ie=t[105]:(Ie=new Set(y?.entries.filter(X$).map(Y$)),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(J$).map(q$)),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)(O$,{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 q$(e){return[e.branch,e.behind]}function J$(e){return e.branch!==null&&e.behind!==void 0}function Y$(e){return e.branch}function X$(e){return e.branch!==null&&e.worktreePath!==null}function Z$(e){return e!==null}function Q$(e){return e.branch}function $$(e){return e.stopPropagation()}function e1(e){return!e.isLinkedWorktree}function t1(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})),Va(`sidebarSearchPill`)}function n1(e){let t=(0,$.c)(8),{onClick:n,className:r}=e,i;t[0]===r?i=t[1]:(i=Y(`rounded-lg h-9 w-full justify-start gap-2 px-3 font-normal text-muted-foreground`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Ge,{"aria-hidden":`true`}),t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`span`,{className:`flex-1 text-left text-sm`,children:(0,Z.jsx)(J,{id:`A1taO8`})}),t[3]=o):o=t[3];let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(U,{className:`text-foreground/70`,children:kl(`command-palette`)}),t[4]=s):s=t[4];let c;return t[5]!==n||t[6]!==i?(c=(0,Z.jsxs)(X,{variant:`outline`,onClick:n,"data-telemetry-event":`ok.sidebar.search_pill.click`,className:i,children:[a,o,s]}),t[5]=n,t[6]=i,t[7]=c):c=t[7],c}function r1(){let e=(0,$.c)(36),{_:t}=mt(),n=$o(),{activeDocName:r}=Re(),[i,a]=(0,Q.useState)(!1),o=as(),s;e[0]!==n.data||e[1]!==n.status?(s=n.status===`ready`?n.data:[],e[0]=n.data,e[1]=n.status,e[2]=s):s=e[2];let c=s,l;e[3]===c?l=e[4]:(l=Js(c),e[3]=c,e[4]=l);let u=l,d=Xs(),f;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(f={},e[5]=f):f=e[5];let[p,m]=(0,Q.useState)(f),h;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(oP,{asChild:!0,children:(0,Z.jsxs)(ln,{className:`flex w-full items-center gap-1.5`,children:[(0,Z.jsx)(Lh,{className:`size-3.5 shrink-0`}),(0,Z.jsx)(J,{id:`PCSkw2`}),(0,Z.jsx)(Lo,{className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/skills:rotate-90`})]})}),e[6]=h):h=e[6];let g;e[7]===t?g=e[8]:(g=t({id:`MdpSC1`}),e[7]=t,e[8]=g);let _,v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>a(!0),v=(0,Z.jsx)(Ht,{}),e[9]=_,e[10]=v):(_=e[9],v=e[10]);let y;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`MdpSC1`})}),e[11]=y):y=e[11];let b;e[12]===g?b=e[13]:(b=(0,Z.jsxs)(sP,{title:g,onClick:_,children:[v,y]}),e[12]=g,e[13]=b);let x;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(p1,{}),e[14]=x):x=e[14];let S;e[15]===c?S=e[16]:(S=c.some(a1),e[15]=c,e[16]=S);let C;e[17]===S?C=e[18]:(C=(0,Z.jsx)(d1,{hasProjectSkills:S}),e[17]=S,e[18]=C);let w;e[19]!==o||e[20]!==r||e[21]!==u||e[22]!==p||e[23]!==d||e[24]!==c?(w=c.length===0?(0,Z.jsx)(`p`,{className:`px-2 py-1 text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`PdJZ5p`})}):Gs.filter(e=>c.some(t=>t.scope===e)).map(e=>(0,Z.jsxs)(un,{className:`group/scope`,open:c.some(t=>t.scope===e&&xa(t.scope,t.name)===r)||(p[e]??!1),onOpenChange:t=>m(n=>({...n,[e]:t})),children:[(0,Z.jsxs)(ln,{className:`flex w-full items-center gap-1 px-2 pt-1 pb-0.5 text-[11px] text-muted-foreground/70 hover:text-muted-foreground`,children:[(0,Z.jsx)(Lo,{className:`size-3 shrink-0 transition-transform group-data-[state=open]/scope:rotate-90`}),(0,Z.jsx)(`span`,{className:`truncate`,children:d[e]})]}),(0,Z.jsx)(cn,{children:(0,Z.jsx)(lP,{className:`pl-2`,children:c.filter(t=>t.scope===e).map(e=>(0,Z.jsx)(o1,{skill:e,activeDocName:r,actions:o,existingNames:u[e.scope]},`${e.scope}::${e.name}`))})})]},e)),e[19]=o,e[20]=r,e[21]=u,e[22]=p,e[23]=d,e[24]=c,e[25]=w):w=e[25];let T;e[26]!==C||e[27]!==w?(T=(0,Z.jsx)(cn,{children:(0,Z.jsxs)(cP,{children:[x,C,w]})}),e[26]=C,e[27]=w,e[28]=T):T=e[28];let E;e[29]===i?E=e[30]:(E=(0,Z.jsx)(Ps,{defaultScope:`project`,open:i,onOpenChange:a,onCreated:i1}),e[29]=i,e[30]=E);let D;return e[31]!==o.dialogs||e[32]!==T||e[33]!==E||e[34]!==b?(D=(0,Z.jsx)(un,{className:`group/skills shrink-0`,children:(0,Z.jsxs)(aP,{className:`px-0`,children:[h,b,T,o.dialogs,E]})}),e[31]=o.dialogs,e[32]=T,e[33]=E,e[34]=b,e[35]=D):D=e[35],D}function i1(e){let{scope:t,name:n}=e;return pc(xa(t,n))}function a1(e){return e.scope===`project`&&!e.managed}function o1(e){let t=(0,$.c)(52),{skill:n,activeDocName:r,actions:i,existingNames:a}=e,{_:o}=mt(),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(!1),d;t[0]!==n.name||t[1]!==n.scope?(d=xa(n.scope,n.name),t[0]=n.name,t[1]=n.scope,t[2]=d):d=t[2];let f=r===d,p,m,h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e.preventDefault(),u(!0)},m=(0,Z.jsx)(Lo,{className:`size-3 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/skill:rotate-90`}),h=(0,Z.jsx)(Lh,{className:`size-3 shrink-0 text-muted-foreground`}),t[3]=p,t[4]=m,t[5]=h):(p=t[3],m=t[4],h=t[5]);let g=n.name,_;t[6]===n.name?_=t[7]:(_=Us(n.name),t[6]=n.name,t[7]=_);let v;t[8]!==n.name||t[9]!==_?(v=(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:g,children:_}),t[8]=n.name,t[9]=_,t[10]=v):v=t[10];let y;t[11]!==o||t[12]!==n.bundledVersion||t[13]!==n.updateAvailable?(y=n.updateAvailable?(0,Z.jsx)(`span`,{title:o({id:`1YJ4Yg`,values:{0:n.bundledVersion?` (${n.bundledVersion})`:``}}),className:`flex items-center`,children:(0,Z.jsx)(Xc,{className:`size-3 text-primary`,"aria-label":o({id:`CifUuG`})})}):null,t[11]=o,t[12]=n.bundledVersion,t[13]=n.updateAvailable,t[14]=y):y=t[14];let b;t[15]!==o||t[16]!==n.installed||t[17]!==n.managed?(b=n.managed?(0,Z.jsx)(`span`,{title:o({id:`U7HJ4y`}),className:`flex items-center`,children:(0,Z.jsx)(Go,{className:`size-3 text-muted-foreground`,"aria-label":o({id:`U7HJ4y`})})}):(0,Z.jsx)(Ms,{installed:n.installed,subtle:!0,className:`shrink-0`}),t[15]=o,t[16]=n.installed,t[17]=n.managed,t[18]=b):b=t[18];let x;t[19]!==y||t[20]!==b?(x=(0,Z.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[y,b]}),t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;t[22]!==f||t[23]!==x||t[24]!==v?(S=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsxs)(fP,{size:`sm`,isActive:f,className:`h-6 text-[11px]`,onContextMenu:p,children:[m,h,v,x]})}),t[22]=f,t[23]=x,t[24]=v,t[25]=S):S=t[25];let C;t[26]!==o||t[27]!==n.name?(C=o({id:`RlLl3G`,values:{0:n.name}}),t[26]=o,t[27]=n.name,t[28]=C):C=t[28];let w;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(wh,{}),t[29]=w):w=t[29];let T;t[30]===C?T=t[31]:(T=(0,Z.jsx)(Er,{asChild:!0,children:(0,Z.jsx)(pP,{showOnHover:!0,"aria-label":C,children:w})}),t[30]=C,t[31]=T);let E;t[32]!==i||t[33]!==a||t[34]!==n?(E=(0,Z.jsx)(Ar,{side:`right`,align:`start`,className:`min-w-52`,children:(0,Z.jsx)(ns,{skill:n,actions:i,existingNames:a})}),t[32]=i,t[33]=a,t[34]=n,t[35]=E):E=t[35];let D;t[36]!==l||t[37]!==T||t[38]!==E?(D=(0,Z.jsxs)(Mr,{open:l,onOpenChange:u,children:[T,E]}),t[36]=l,t[37]=T,t[38]=E,t[39]=D):D=t[39];let O;t[40]!==s||t[41]!==n?(O=s?(0,Z.jsx)(l1,{skill:n}):null,t[40]=s,t[41]=n,t[42]=O):O=t[42];let k;t[43]===O?k=t[44]:(k=(0,Z.jsx)(cn,{children:O}),t[43]=O,t[44]=k);let A;t[45]!==S||t[46]!==D||t[47]!==k?(A=(0,Z.jsxs)(uP,{children:[S,D,k]}),t[45]=S,t[46]=D,t[47]=k,t[48]=A):A=t[48];let j;return t[49]!==s||t[50]!==A?(j=(0,Z.jsx)(un,{open:s,onOpenChange:c,className:`group/skill`,children:A}),t[49]=s,t[50]=A,t[51]=j):j=t[51],j}function s1(e){let t=[];for(let n of e){let e=n.path.split(`/`),r=t;e.forEach((t,i)=>{let a=i===e.length-1,o=r.find(e=>e.name===t);o||(o=a?{name:t,path:n.path,text:n.text}:{name:t,path:e.slice(0,i+1).join(`/`),children:[]},r.push(o)),!a&&o.children&&(r=o.children)})}return c1(t),t}function c1(e){e.sort((e,t)=>{let n=+!e.children,r=+!t.children;return n===r?e.name.localeCompare(t.name):n-r});for(let t of e)t.children&&c1(t.children)}function l1(e){let t=(0,$.c)(36),{skill:n}=e,{_:r}=mt(),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(!1),{openTarget:l}=Re(),u;t[0]===l?u=t[1]:(u=function(e){l({kind:`doc`,target:e,docName:e},{tabBehavior:`append`}),gu(vu(e))},t[0]=l,t[1]=u);let d=u,f;t[2]!==l||t[3]!==n.name||t[4]!==n.scope?(f=function(e){l({kind:`skill-file`,target:`${n.scope}/${n.name}/${e}`,scope:n.scope,name:n.name,path:e},{tabBehavior:`replace-active`}),gu(pu({scope:n.scope,name:n.name,path:e}))},t[2]=l,t[3]=n.name,t[4]=n.scope,t[5]=f):f=t[5];let p=f,m;t[6]!==d||t[7]!==p||t[8]!==n.managed||t[9]!==n.name||t[10]!==n.scope?(m=function(e){if(n.managed){p(e);return}let t=e.lastIndexOf(`.`),r=t>=0?e.slice(t+1).toLowerCase():``;if(n.scope===`project`&&(r===`md`||r===`mdx`)){d(i(n.name,e.replace(/\.mdx?$/i,``)));return}p(e)},t[6]=d,t[7]=p,t[8]=n.managed,t[9]=n.name,t[10]=n.scope,t[11]=m):m=t[11];let h=m,g,_;t[12]!==n.name||t[13]!==n.scope?(g=()=>{let e=!0,t=()=>{Sf(n.scope,n.name).then(t=>{e&&(t.ok?(o(t.files),c(!1)):(o([]),c(!0)))})};t();let r=Zl(t);return()=>{e=!1,r()}},_=[n.scope,n.name],t[12]=n.name,t[13]=n.scope,t[14]=g,t[15]=_):(g=t[14],_=t[15]),(0,Q.useEffect)(g,_);let v;if(t[16]!==r||t[17]!==a||t[18]!==s||t[19]!==h||t[20]!==d||t[21]!==p||t[22]!==n.managed||t[23]!==n.name||t[24]!==n.scope){let e=a?s1(a):[],i;t[26]!==d||t[27]!==p||t[28]!==n.managed||t[29]!==n.name||t[30]!==n.scope?(i=()=>n.managed?p(`SKILL.md`):n.scope===`project`?d(Zi(n.name)):pc(xa(n.scope,n.name)),t[26]=d,t[27]=p,t[28]=n.managed,t[29]=n.name,t[30]=n.scope,t[31]=i):i=t[31];let o,c;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Un,{className:`size-3 shrink-0 text-muted-foreground`}),c=(0,Z.jsx)(`span`,{className:`truncate`,children:`SKILL.md`}),t[32]=o,t[33]=c):(o=t[32],c=t[33]);let l;t[34]===i?l=t[35]:(l=(0,Z.jsx)(hP,{children:(0,Z.jsxs)(gP,{size:`sm`,onClick:i,className:`text-[11px]`,children:[o,c]})}),t[34]=i,t[35]=l),v=(0,Z.jsxs)(mP,{className:`mr-0 pr-0`,children:[l,a===null?(0,Z.jsx)(hP,{children:(0,Z.jsx)(`span`,{className:`px-2 py-0.5 text-[11px] text-muted-foreground/70`,children:(0,Z.jsx)(J,{id:`yQE2r9`})})}):s?(0,Z.jsx)(hP,{children:(0,Z.jsx)(`span`,{className:`px-2 py-0.5 text-[11px] text-muted-foreground/70`,title:r({id:`3Ijjy1`}),children:(0,Z.jsx)(J,{id:`ZARuZJ`})})}):e.map(e=>(0,Z.jsx)(u1,{node:e,depth:0,onOpenFile:h},e.path))]}),t[16]=r,t[17]=a,t[18]=s,t[19]=h,t[20]=d,t[21]=p,t[22]=n.managed,t[23]=n.name,t[24]=n.scope,t[25]=v}else v=t[25];return v}function u1(e){let t=(0,$.c)(34),{node:n,depth:r,onOpenFile:i}=e,[a,o]=(0,Q.useState)(!1),s=`${r*.6}rem`,c;t[0]===s?c=t[1]:(c={paddingLeft:s},t[0]=s,t[1]=c);let l=c;if(n.children){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Lo,{className:`size-3 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/dir:rotate-90`}),t[2]=e):e=t[2];let s;t[3]===n.name?s=t[4]:(s=(0,Z.jsxs)(`span`,{className:`truncate`,children:[n.name,`/`]}),t[3]=n.name,t[4]=s);let c;t[5]!==l||t[6]!==s?(c=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsxs)(gP,{size:`sm`,className:`text-[11px]`,style:l,children:[e,s]})}),t[5]=l,t[6]=s,t[7]=c):c=t[7];let u;if(t[8]!==r||t[9]!==n.children||t[10]!==i){let e;t[12]!==r||t[13]!==i?(e=e=>(0,Z.jsx)(u1,{node:e,depth:r+1,onOpenFile:i},e.path),t[12]=r,t[13]=i,t[14]=e):e=t[14],u=n.children.map(e),t[8]=r,t[9]=n.children,t[10]=i,t[11]=u}else u=t[11];let d;t[15]===u?d=t[16]:(d=(0,Z.jsx)(cn,{children:u}),t[15]=u,t[16]=d);let f;t[17]!==c||t[18]!==d?(f=(0,Z.jsxs)(hP,{children:[c,d]}),t[17]=c,t[18]=d,t[19]=f):f=t[19];let p;return t[20]!==a||t[21]!==f?(p=(0,Z.jsx)(un,{open:a,onOpenChange:o,className:`group/dir`,children:f}),t[20]=a,t[21]=f,t[22]=p):p=t[22],p}let u=`skill-file-${n.path}`,d;t[23]!==n.path||t[24]!==i?(d=()=>i(n.path),t[23]=n.path,t[24]=i,t[25]=d):d=t[25];let f;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(Dh,{className:`size-3 shrink-0 text-muted-foreground`}),t[26]=f):f=t[26];let p;t[27]===n.name?p=t[28]:(p=(0,Z.jsx)(`span`,{className:`truncate`,children:n.name}),t[27]=n.name,t[28]=p);let m;return t[29]!==l||t[30]!==u||t[31]!==d||t[32]!==p?(m=(0,Z.jsx)(hP,{children:(0,Z.jsxs)(gP,{size:`sm`,className:`text-[11px]`,style:l,"data-testid":u,onClick:d,children:[f,p]})}),t[29]=l,t[30]=u,t[31]=d,t[32]=p,t[33]=m):m=t[33],m}function d1(e){let t=(0,$.c)(12),{hasProjectSkills:n}=e,{_:r}=mt(),[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(f1)};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:``;dl.error(e.startsWith(`ok:sharing:dispatch:`)?r({id:`qXN416`}):e||r({id:`K2v7QF`}));return}if(t!==null){if(t.kind===`applied`)dl.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`});dl.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)(J,{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)(J,{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 f1(e){console.warn(JSON.stringify({event:`skills-share-status-read-failed`,error:e instanceof Error?e.message:String(e)}))}function p1(){let e=(0,$.c)(19),[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(!1),a,o;if(e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=!1;return bf().then(t=>{e||n(t)}),()=>{e=!0}},o=[],e[0]=a,e[1]=o):(a=e[0],o=e[1]),(0,Q.useEffect)(a,o),!t||t.managed!==null||t.importable===0)return null;let s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=async e=>{if(i(!0),!await Cf(e)){i(!1);return}n({managed:e,importable:0})},e[2]=s):s=e[2];let c=s,l;e[3]===t.importable?l=e[4]:(l=(0,Z.jsx)(`p`,{className:`mb-2 text-muted-foreground`,children:(0,Z.jsx)(J,{id:`mu1O0q`,values:{0:t.importable}})}),e[3]=t.importable,e[4]=l);let u,d;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>c(!0),d=(0,Z.jsx)(J,{id:`l3s5ri`}),e[5]=u,e[6]=d):(u=e[5],d=e[6]);let f;e[7]===r?f=e[8]:(f=(0,Z.jsx)(X,{size:`sm`,className:`h-6 px-2 text-xs`,disabled:r,onClick:u,children:d}),e[7]=r,e[8]=f);let p,m;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>c(!1),m=(0,Z.jsx)(J,{id:`PBxg_E`}),e[9]=p,e[10]=m):(p=e[9],m=e[10]);let h;e[11]===r?h=e[12]:(h=(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,className:`h-6 px-2 text-xs`,disabled:r,onClick:p,children:m}),e[11]=r,e[12]=h);let g;e[13]!==f||e[14]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex gap-1.5`,children:[f,h]}),e[13]=f,e[14]=h,e[15]=g):g=e[15];let _;return e[16]!==g||e[17]!==l?(_=(0,Z.jsxs)(`div`,{className:`mx-2 mb-1 rounded-md border border-border/60 bg-muted/40 p-2 text-xs`,children:[l,g]}),e[16]=g,e[17]=l,e[18]=_):_=e[18],_}var m1=6e4,h1=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=>rd(e,n),o=e=>rd(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 g1(e){let t=(0,$.c)(34),{version:n,onOpenReleaseNotes:r,onClose:i,store:a,autoDismissMs:o}=e,s=a===void 0?vL:a,c=o===void 0?m1:o,{_:l}=mt(),[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)(J,{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)(qI,{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)(J,{id:`9sBe85`})}),(0,Z.jsx)(h1,{href:cL,label:l({id:`I7Exsw`}),icon:xL}),(0,Z.jsx)(h1,{href:oL,label:l({id:`zyKa-I`}),icon:Yg}),(0,Z.jsx)(h1,{href:sL,label:l({id:`36aWJD`}),icon:bL})]}),t[16]=l,t[17]=u,t[18]=y):y=t[18];let b;t[19]!==y||t[20]!==v?(b=(0,Z.jsxs)(`div`,{className:`px-3 py-2.5`,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)(J,{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)(J,{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)(`div`,{className:`flex items-center justify-between border-t bg-muted/30 px-3 py-2.5 space-x-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.jsxs)(`section`,{"aria-label":m,className:`mx-1 mb-1 overflow-hidden rounded-lg border bg-card text-card-foreground`,children:[b,w]}),t[30]=b,t[31]=w,t[32]=m,t[33]=T):T=t[33],T}function _1(e){let t=(0,$.c)(37),{notice:n,onDismiss:r}=e,{_:i}=mt(),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)(ul,{"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 v1(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 y1(){let e=(0,$.c)(15),t=(0,Q.useSyncExternalStore)(YR,JR,JR),n;e[0]===t?n=e[1]:(n=v1(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=()=>qR(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)(g1,{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?.(),qR(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)(_1,{notice:r,onDismiss:i})}),e[12]=r,e[13]=i,e[14]=a):a=e[14],a}function b1(e,t){return e?.kind===`doc`||e?.kind===`folder-index`?qs(t.contentDir,Zs(e.docName),t.pathSeparator):e?.kind===`folder`?qs(t.contentDir,e.folderPath,t.pathSeparator):e?.kind===`asset`?qs(t.contentDir,e.assetPath,t.pathSeparator):t.contentDir}function x1(e){return e?.kind===`doc`||e?.kind===`folder-index`?Zs(e.docName):e?.kind===`folder`?e.folderPath:e?.kind===`asset`?e.assetPath:``}function S1(e,t){return e===null?ts({workspace:t}):e.kind===`folder`?t?Zo({folderRelativePath:e.folderPath,workspace:t}):null:e.kind===`doc`||e.kind===`folder-index`?is({docName:e.docName,workspace:t}):null}var C1={folderCount:0,expandedCount:0},w1=`button, [role="button"], [role="menuitem"], input, textarea, select, a[href]`;function T1(e){return typeof Element>`u`||!(e instanceof Element)?!1:e.closest(w1)!==null}function E1(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(au,{name:`file-sidebar`,children:(0,Z.jsx)(j1,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var D1=`[&_svg:not([class*='size-'])]:size-3.5`,O1=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)(U,{"aria-label":El(r),children:kl(r)})]}):null,t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Z.jsxs)(an,{children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o},k1=e=>{let t=(0,$.c)(21),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,icon:n,label:i,shortcutId:o,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===r?s=t[7]:(s=Y(D1,r),t[6]=r,t[7]=s);let c;t[8]===n?c=t[9]:(c=(0,Z.jsx)(n,{"aria-hidden":`true`}),t[8]=n,t[9]=c);let l;t[10]!==i||t[11]!==a||t[12]!==s||t[13]!==c?(l=(0,Z.jsx)(rn,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":i,className:s,...a,children:c})}),t[10]=i,t[11]=a,t[12]=s,t[13]=c,t[14]=l):l=t[14];let u;t[15]!==i||t[16]!==o?(u=(0,Z.jsx)(O1,{label:i,shortcutId:o}),t[15]=i,t[16]=o,t[17]=u):u=t[17];let d;return t[18]!==l||t[19]!==u?(d=(0,Z.jsxs)(sn,{children:[l,u]}),t[18]=l,t[19]=u,t[20]=d):d=t[20],d},A1=e=>{let t=(0,$.c)(21),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,icon:n,label:i,shortcutId:o,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===r?s=t[7]:(s=Y(D1,r),t[6]=r,t[7]=s);let c;t[8]===n?c=t[9]:(c=(0,Z.jsx)(n,{"aria-hidden":`true`}),t[8]=n,t[9]=c);let l;t[10]!==i||t[11]!==a||t[12]!==s||t[13]!==c?(l=(0,Z.jsx)(rn,{asChild:!0,children:(0,Z.jsx)(Er,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":i,className:s,...a,children:c})})}),t[10]=i,t[11]=a,t[12]=s,t[13]=c,t[14]=l):l=t[14];let u;t[15]!==i||t[16]!==o?(u=(0,Z.jsx)(O1,{label:i,shortcutId:o}),t[15]=i,t[16]=o,t[17]=u):u=t[17];let d;return t[18]!==l||t[19]!==u?(d=(0,Z.jsxs)(sn,{children:[l,u]}),t[18]=l,t[19]=u,t[20]=d):d=t[20],d};function j1(e){let t=(0,$.c)(317),{onOpenSearch:n}=e,{_:r}=mt(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),{activeDocName:c,activeTarget:l}=Re(),u;t[0]!==c||t[1]!==l?(u=l?.kind===`folder`||l?.kind===`folder-index`?l.folderPath:Ll(c),t[0]=c,t[1]=l,t[2]=u):u=t[2];let d=u,f;t[3]===d?f=t[4]:(f=Bl(d)?``:d,t[3]=d,t[4]=f);let p=f,[m,h]=(0,Q.useState)(!1),g=m?``:p,_=typeof window<`u`&&window.okDesktop!=null,{state:v,toggleSidebar:y}=JN(),b=Ys(),x=v===`expanded`,S=_&&v===`collapsed`,[C,w]=(0,Q.useState)(C1),T,E;t[5]===i?(T=t[6],E=t[7]):(T=()=>{if(i===null)return;let e=()=>{w(i.getFolderState()),h(i.isCreationTargetCleared())};return e(),i.subscribe(e)},E=[i],t[5]=i,t[6]=T,t[7]=E),(0,Q.useEffect)(T,E);let D,O;t[8]===i?(D=t[9],O=t[10]):(D=()=>{if(i!==null)return $C(e=>{let t=e.initialDir??``;if(e.template){i.createFromTemplate(e.template.folder,e.template.name);return}i.startCreating(`file`,t)})},O=[i],t[8]=i,t[9]=D,t[10]=O),(0,Q.useEffect)(D,O);let k=C.folderCount>0,A=k&&C.expandedCount===C.folderCount,j=C.expandedCount===0,M=Ds(``),N=Ds(g===``?null:g),P=g===``?M:N,F=M.state.status===`ready`?(M.state.data.folder.templates_available?.length??0)>0:!0,I=P.state.status===`ready`?(P.state.data.folder.templates_available?.length??0)>0:!0,L=typeof window<`u`?window.okDesktop:void 0,R=sd(),{status:z}=fo(),B=z?.hasRemote===!0,V;t[11]!==r||t[12]!==R?.contentDir?(V=L?.config?.projectName||R?.contentDir.split(`/`).filter(Boolean).pop()||r({id:`sER-bs`}),t[11]=r,t[12]=R?.contentDir,t[13]=V):V=t[13];let H=V,U=es().states,{dispatch:ee}=Jo(),W;t[14]===R?W=t[15]:(W=ts({workspace:R}),t[14]=R,t[15]=W);let G=W,{projectLocalBinding:K,merged:te}=td(),ne=te?.appearance?.sidebar?.showHiddenFiles??!1,q=te?.appearance?.sidebar?.showOkFolders??!1,re=te?.appearance?.sidebar?.showOnlyMarkdownFiles??!1,ie=te?.appearance?.sidebar?.showSkillsSection??!0,ae=k&&!A,oe=k&&!j,se=ae||oe,ce=(0,Q.useRef)(!1),le;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(le=e=>{ce.current&&(ce.current=!1,e.preventDefault())},t[16]=le):le=t[16];let ue=le,de=I1,fe;t[17]!==i||t[18]!==R?(fe=()=>{R&&(ce.current=!0,i?.startCreating(`file`,``))},t[17]=i,t[18]=R,t[19]=fe):fe=t[19];let pe=fe,me;t[20]!==i||t[21]!==R?(me=e=>{R&&(ce.current=!0,i?.createFromTemplate(``,e))},t[20]=i,t[21]=R,t[22]=me):me=t[22];let he=me,ge;t[23]!==i||t[24]!==R?(ge=()=>{R&&(ce.current=!0,i?.startCreating(`folder`,``))},t[23]=i,t[24]=R,t[25]=ge):ge=t[25];let _e=ge,ve;t[26]===R?ve=t[27]:(ve=()=>{!R||!L||L.shell.showItemInFolder(R.contentDir)},t[26]=R,t[27]=ve);let ye=ve,be;t[28]!==r||t[29]!==R?(be=async()=>{if(R)try{await navigator.clipboard.writeText(R.contentDir),dl.success(r({id:`6_ZOw4`}),{description:R.contentDir})}catch(e){console.warn(`[FileSidebar] clipboard write failed:`,e),dl.error(r({id:`vfRlCI`}))}},t[28]=r,t[29]=R,t[30]=be):be=t[30];let xe=be,Se;t[31]!==r||t[32]!==B?(Se=()=>{ps({...Es(``),hasRemote:B,onClickWhenNoRemote:()=>{dl.error(r({id:`WyQxwa`}))}},{clipboardWrite:af,toastSuccess:F1,toastError:P1,logEvent:N1})},t[31]=r,t[32]=B,t[33]=Se):Se=t[33];let Ce=Se,we;t[34]!==r||t[35]!==K?(we=e=>{if(K===null)return;let t=K.patch({appearance:{sidebar:e}});t.ok||(console.warn(`[FileSidebar] sidebar visibility toggle rejected:`,yi(t.error)),dl.error(r({id:`P47EWZ`}),{description:yi(t.error)}))},t[34]=r,t[35]=K,t[36]=we):we=t[36];let Te=we,Ee;t[37]===i?Ee=t[38]:(Ee=()=>{i?.expandAll()},t[37]=i,t[38]=Ee);let De=Ee,Oe;t[39]===i?Oe=t[40]:(Oe=()=>{i?.collapseAll()},t[39]=i,t[40]=Oe);let ke=Oe,Ae,je;t[41]!==oe||t[42]!==ae||t[43]!==ne||t[44]!==q||t[45]!==re||t[46]!==ie||t[47]!==v?(Ae=()=>{let e={showHiddenFiles:ne,showOkFolders:q,showOnlyMarkdownFiles:re,showSkillsSection:ie,canExpandAll:ae,canCollapseAll:oe,sidebarVisible:v===`expanded`};_c(e),L&&L.editor.notifyViewMenuStateChanged(e)},je=[L,ne,q,re,ie,ae,oe,v],t[41]=oe,t[42]=ae,t[43]=ne,t[44]=q,t[45]=re,t[46]=ie,t[47]=v,t[48]=Ae,t[49]=je):(Ae=t[48],je=t[49]),(0,Q.useEffect)(Ae,je);let Me;t[50]!==r||t[51]!==l||t[52]!==ee||t[53]!==U||t[54]!==g||t[55]!==Te||t[56]!==ne||t[57]!==q||t[58]!==re||t[59]!==ie||t[60]!==y||t[61]!==i||t[62]!==R?(Me=()=>Vt(e=>{let t=l!==null&&Bl(x1(l));switch(e){case`new-doc`:if(!R||!i)return;i.startCreating(`file`,g);return;case`new-folder`:if(!R||!i)return;i.startCreating(`folder`,g);return;case`new-from-template`:if(!R||!i)return;i.startCreatingFromTemplate(g);return;case`rename`:if(!l||t)return;FZ(l);return;case`duplicate`:if(!l||t)return;LZ(l);return;case`move-to-trash`:if(!l||t)return;NZ(l);return;case`reveal-in-finder`:{if(!L||!R)return;let e=b1(l,R);L.shell.showItemInFolder(e);return}case`send-to-ai`:{let e=Yr.filter(e=>U[e.id]?.installed===!0);if(e.length===0){dl.error(r({id:`LKOLNn`}));return}let t=S1(l,R);if(!t)return;let[n]=e;if(!n)return;ee(n.id,t);return}case`copy-full-path`:{if(!R)return;let e=b1(l,R);navigator.clipboard.writeText(e).then(()=>dl.success(r({id:`6_ZOw4`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),dl.error(r({id:`vfRlCI`}))});return}case`copy-relative-path`:{let e=x1(l);if(e===``){dl.error(r({id:`74eHt-`}));return}navigator.clipboard.writeText(e).then(()=>dl.success(r({id:`haHgQj`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),dl.error(r({id:`5QGTaA`}))});return}case`toggle-show-ok-folders`:Te({showOkFolders:!q});return;case`toggle-show-hidden-files`:Te({showHiddenFiles:!ne});return;case`toggle-show-only-markdown-files`:Te({showOnlyMarkdownFiles:!re});return;case`toggle-show-skills-section`:Te({showSkillsSection:!ie});return;case`expand-all-tree`:i?.expandAll();return;case`collapse-all-tree`:i?.collapseAll();return;case`toggle-sidebar`:y();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[50]=r,t[51]=l,t[52]=ee,t[53]=U,t[54]=g,t[55]=Te,t[56]=ne,t[57]=q,t[58]=re,t[59]=ie,t[60]=y,t[61]=i,t[62]=R,t[63]=Me):Me=t[63];let Ne;t[64]!==r||t[65]!==l||t[66]!==ee||t[67]!==U||t[68]!==g||t[69]!==K||t[70]!==ne||t[71]!==q||t[72]!==re||t[73]!==ie||t[74]!==y||t[75]!==i||t[76]!==R?(Ne=[L,i,R,l,g,K,ne,q,re,ie,U,ee,y,r],t[64]=r,t[65]=l,t[66]=ee,t[67]=U,t[68]=g,t[69]=K,t[70]=ne,t[71]=q,t[72]=re,t[73]=ie,t[74]=y,t[75]=i,t[76]=R,t[77]=Ne):Ne=t[77],(0,Q.useEffect)(Me,Ne);let Pe=_&&x&&`motion-safe:delay-100`,Fe=S&&`opacity-0`,Ie;t[78]!==Pe||t[79]!==Fe?(Ie=Y(`flex-row h-12 items-center py-0 px-3`,`justify-between`,_&&`overflow-x-clip`,_&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Pe,Fe,_&&`[-webkit-app-region:drag]`),t[78]=Pe,t[79]=Fe,t[80]=Ie):Ie=t[80];let Le;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(Le=_?(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[81]=Le):Le=t[81];let ze;t[82]===x?ze=t[83]:(ze=x&&!_?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:(0,Z.jsx)(J,{id:`sER-bs`})}):null,t[82]=x,t[83]=ze);let Be;t[84]===x?Be=t[85]:(Be=_&&x?(0,Z.jsx)(BL,{}):null,t[84]=x,t[85]=Be);let Ve;t[86]!==Ie||t[87]!==ze||t[88]!==Be?(Ve=(0,Z.jsxs)(nP,{"data-electron-drag":_?``:void 0,className:Ie,children:[Le,ze,Be]}),t[86]=Ie,t[87]=ze,t[88]=Be,t[89]=Ve):Ve=t[89];let He=_&&x&&`motion-safe:delay-100`,Ue=S&&`opacity-0`,We;t[90]!==He||t[91]!==Ue?(We=Y(`px-2 pb-2`,_&&`[-webkit-app-region:no-drag]`,_&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,He,Ue),t[90]=He,t[91]=Ue,t[92]=We):We=t[92];let Ge;t[93]===v?Ge=t[94]:(Ge=[v],t[93]=v,t[94]=Ge);let Ke;t[95]===n?Ke=t[96]:(Ke=(0,Z.jsx)(n1,{onClick:n}),t[95]=n,t[96]=Ke);let qe;t[97]!==Ge||t[98]!==Ke?(qe=(0,Z.jsx)(qt,{fallbackRender:M1,onError:t1,resetKeys:Ge,children:Ke}),t[97]=Ge,t[98]=Ke,t[99]=qe):qe=t[99];let Je;t[100]!==We||t[101]!==qe?(Je=(0,Z.jsx)(`div`,{className:We,children:qe}),t[100]=We,t[101]=qe,t[102]=Je):Je=t[102];let Ye;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=(0,Z.jsx)(pR,{}),t[103]=Ye):Ye=t[103];let Xe;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(Xe=(0,Z.jsx)(uc,{className:`size-3.5 shrink-0`}),t[104]=Xe):Xe=t[104];let Ze;t[105]===H?Ze=t[106]:(Ze=(0,Z.jsx)(`span`,{className:`truncate`,children:H}),t[105]=H,t[106]=Ze);let Qe;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=(0,Z.jsx)(Lo,{className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/files:rotate-90`}),t[107]=Qe):Qe=t[107];let $e;t[108]===Ze?$e=t[109]:($e=(0,Z.jsxs)(ln,{"data-sidebar-root-context":!0,className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[Xe,Ze,Qe]}),t[108]=Ze,t[109]=$e);let et;t[110]===r?et=t[111]:(et=r({id:`eaHUxx`}),t[110]=r,t[111]=et);let tt;t[112]===Symbol.for(`react.memo_cache_sentinel`)?(tt=Y(_&&`*:[-webkit-app-region:no-drag]`),t[112]=tt):tt=t[112];let nt;t[113]===r?nt=t[114]:(nt=r({id:`Rq1vFD`}),t[113]=r,t[114]=nt);let rt;t[115]===nt?rt=t[116]:(rt=(0,Z.jsx)(A1,{icon:Hh,label:nt}),t[115]=nt,t[116]=rt);let it;t[117]!==ae||t[118]!==i?(it=ae?(0,Z.jsxs)(Sr,{onSelect:()=>i?.expandAll(),children:[(0,Z.jsx)(Tg,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`OlAl5i`})]}):null,t[117]=ae,t[118]=i,t[119]=it):it=t[119];let at;t[120]!==oe||t[121]!==i?(at=oe?(0,Z.jsxs)(Sr,{onSelect:()=>i?.collapseAll(),children:[(0,Z.jsx)(jh,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`qvWGzP`})]}):null,t[120]=oe,t[121]=i,t[122]=at):at=t[122];let ot;t[123]===se?ot=t[124]:(ot=se?(0,Z.jsx)(Nr,{}):null,t[123]=se,t[124]=ot);let st;t[125]===r?st=t[126]:(st=r({id:`8vETh9`}),t[125]=r,t[126]=st);let ct;t[127]===Symbol.for(`react.memo_cache_sentinel`)?(ct=(0,Z.jsx)(Or,{children:(0,Z.jsx)(J,{id:`8vETh9`})}),t[127]=ct):ct=t[127];let lt;t[128]===Te?lt=t[129]:(lt=e=>Te({showHiddenFiles:e}),t[128]=Te,t[129]=lt);let ut=K===null,dt;t[130]===Symbol.for(`react.memo_cache_sentinel`)?(dt=(0,Z.jsx)(J,{id:`6KCH4m`}),t[130]=dt):dt=t[130];let ft;t[131]!==ne||t[132]!==lt||t[133]!==ut?(ft=(0,Z.jsx)(Dr,{checked:ne,onCheckedChange:lt,disabled:ut,"data-testid":`tree-options-show-hidden-files`,children:dt}),t[131]=ne,t[132]=lt,t[133]=ut,t[134]=ft):ft=t[134];let pt;t[135]===Te?pt=t[136]:(pt=e=>Te({showOkFolders:e}),t[135]=Te,t[136]=pt);let ht=K===null,gt;t[137]===Symbol.for(`react.memo_cache_sentinel`)?(gt=(0,Z.jsx)(J,{id:`ELYtNJ`}),t[137]=gt):gt=t[137];let _t;t[138]!==q||t[139]!==pt||t[140]!==ht?(_t=(0,Z.jsx)(Dr,{checked:q,onCheckedChange:pt,disabled:ht,"data-testid":`tree-options-show-ok-folders`,children:gt}),t[138]=q,t[139]=pt,t[140]=ht,t[141]=_t):_t=t[141];let vt;t[142]===Te?vt=t[143]:(vt=e=>Te({showOnlyMarkdownFiles:e}),t[142]=Te,t[143]=vt);let yt=K===null,bt;t[144]===Symbol.for(`react.memo_cache_sentinel`)?(bt=(0,Z.jsx)(J,{id:`5-o4kO`}),t[144]=bt):bt=t[144];let xt;t[145]!==re||t[146]!==vt||t[147]!==yt?(xt=(0,Z.jsx)(Dr,{checked:re,onCheckedChange:vt,disabled:yt,"data-testid":`tree-options-show-only-markdown-files`,children:bt}),t[145]=re,t[146]=vt,t[147]=yt,t[148]=xt):xt=t[148];let St;t[149]===Te?St=t[150]:(St=e=>Te({showSkillsSection:e}),t[149]=Te,t[150]=St);let Ct=K===null,wt;t[151]===Symbol.for(`react.memo_cache_sentinel`)?(wt=(0,Z.jsx)(J,{id:`PCSkw2`}),t[151]=wt):wt=t[151];let Tt;t[152]!==ie||t[153]!==St||t[154]!==Ct?(Tt=(0,Z.jsx)(Dr,{checked:ie,onCheckedChange:St,disabled:Ct,"data-testid":`tree-options-show-skills`,children:wt}),t[152]=ie,t[153]=St,t[154]=Ct,t[155]=Tt):Tt=t[155];let Et;t[156]!==st||t[157]!==ft||t[158]!==_t||t[159]!==xt||t[160]!==Tt?(Et=(0,Z.jsxs)(Tr,{"aria-label":st,children:[ct,ft,_t,xt,Tt]}),t[156]=st,t[157]=ft,t[158]=_t,t[159]=xt,t[160]=Tt,t[161]=Et):Et=t[161];let Dt;t[162]!==it||t[163]!==at||t[164]!==ot||t[165]!==Et?(Dt=(0,Z.jsxs)(Ar,{align:`end`,className:`min-w-52`,"data-testid":`tree-options-menu`,children:[it,at,ot,Et]}),t[162]=it,t[163]=at,t[164]=ot,t[165]=Et,t[166]=Dt):Dt=t[166];let Ot;t[167]!==rt||t[168]!==Dt?(Ot=(0,Z.jsxs)(Mr,{children:[rt,Dt]}),t[167]=rt,t[168]=Dt,t[169]=Ot):Ot=t[169];let kt;t[170]===r?kt=t[171]:(kt=r({id:`HdkSiO`}),t[170]=r,t[171]=kt);let At;t[172]!==g||t[173]!==i?(At=()=>i?.startCreating(`file`,g),t[172]=g,t[173]=i,t[174]=At):At=t[174];let jt;t[175]!==kt||t[176]!==At?(jt=(0,Z.jsx)(k1,{icon:tc,label:kt,onClick:At,shortcutId:`new-item`}),t[175]=kt,t[176]=At,t[177]=jt):jt=t[177];let Mt;t[178]!==r||t[179]!==I||t[180]!==g||t[181]!==i?(Mt=I?(0,Z.jsxs)(Mr,{children:[(0,Z.jsx)(A1,{icon:ks,label:r({id:`Uuj_R4`})}),(0,Z.jsx)(Ar,{align:`end`,className:`min-w-52`,onCloseAutoFocus:ue,children:(0,Z.jsx)(TZ,{parentDir:g,onSelectTemplate:e=>{ce.current=!0,i?.createFromTemplate(g,e)},ItemComponent:Sr})})]}):null,t[178]=r,t[179]=I,t[180]=g,t[181]=i,t[182]=Mt):Mt=t[182];let Nt;t[183]===r?Nt=t[184]:(Nt=r({id:`96G6Re`}),t[183]=r,t[184]=Nt);let Pt;t[185]!==g||t[186]!==i?(Pt=()=>i?.startCreating(`folder`,g),t[185]=g,t[186]=i,t[187]=Pt):Pt=t[187];let Ft;t[188]!==Nt||t[189]!==Pt?(Ft=(0,Z.jsx)(k1,{icon:Nh,label:Nt,onClick:Pt,shortcutId:_?`new-folder`:void 0}),t[188]=Nt,t[189]=Pt,t[190]=Ft):Ft=t[190];let It;t[191]!==et||t[192]!==Ot||t[193]!==jt||t[194]!==Mt||t[195]!==Ft?(It=(0,Z.jsxs)(of,{"aria-label":et,"data-testid":`sidebar-toolbar`,className:tt,children:[Ot,jt,Mt,Ft]}),t[191]=et,t[192]=Ot,t[193]=jt,t[194]=Mt,t[195]=Ft,t[196]=It):It=t[196];let Lt;t[197]!==$e||t[198]!==It?(Lt=(0,Z.jsxs)(oP,{className:`shrink-0 gap-1`,children:[$e,It]}),t[197]=$e,t[198]=It,t[199]=Lt):Lt=t[199];let Rt=o==null?`50vh`:`${o}px`,zt;t[200]===Rt?zt=t[201]:(zt={height:Rt},t[200]=Rt,t[201]=zt);let Bt;t[202]===Symbol.for(`react.memo_cache_sentinel`)?(Bt=(0,Z.jsx)(DQ,{ref:a,onContentHeightChange:s}),t[202]=Bt):Bt=t[202];let Ht;t[203]===zt?Ht=t[204]:(Ht=(0,Z.jsx)(cn,{className:`flex max-h-[70vh] flex-col overflow-hidden`,style:zt,children:Bt}),t[203]=zt,t[204]=Ht);let Ut;t[205]!==Lt||t[206]!==Ht?(Ut=(0,Z.jsx)(un,{defaultOpen:!0,className:`group/files flex shrink-0 flex-col`,children:(0,Z.jsxs)(aP,{className:`min-h-0 px-0`,children:[Lt,Ht]})}),t[205]=Lt,t[206]=Ht,t[207]=Ut):Ut=t[207];let Wt;t[208]===ie?Wt=t[209]:(Wt=ie?(0,Z.jsx)(r1,{}):null,t[208]=ie,t[209]=Wt);let Gt;t[210]===i?Gt=t[211]:(Gt=(0,Z.jsx)(`div`,{"aria-hidden":!0,"data-sidebar-empty-deselect":!0,className:`min-h-8 flex-1 cursor-default`,onClick:()=>i?.clearCreationTarget()}),t[210]=i,t[211]=Gt);let Kt;t[212]!==Ut||t[213]!==Wt||t[214]!==Gt?(Kt=(0,Z.jsxs)(iP,{children:[Ye,Ut,Wt,Gt]}),t[212]=Ut,t[213]=Wt,t[214]=Gt,t[215]=Kt):Kt=t[215];let Jt;t[216]===Symbol.for(`react.memo_cache_sentinel`)?(Jt=(0,Z.jsxs)(rP,{className:`px-0`,children:[(0,Z.jsx)(w$,{}),(0,Z.jsx)(y1,{}),(0,Z.jsx)(kz,{}),typeof window<`u`&&window.okDesktop?(0,Z.jsx)(lP,{children:(0,Z.jsx)(uP,{children:(0,Z.jsx)(K$,{bridge:window.okDesktop})})}):null]}),t[216]=Jt):Jt=t[216];let Yt=!(b&&v===`collapsed`),Xt;t[217]===Yt?Xt=t[218]:(Xt=(0,Z.jsx)(eP,{enableToggle:!1,enableDrag:Yt}),t[217]=Yt,t[218]=Xt);let Zt;t[219]!==Ve||t[220]!==Je||t[221]!==Kt||t[222]!==Xt?(Zt=(0,Z.jsx)(Kv,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`contents`,onContextMenu:de,children:[Ve,Je,Kt,Jt,Xt]})}),t[219]=Ve,t[220]=Je,t[221]=Kt,t[222]=Xt,t[223]=Zt):Zt=t[223];let X=!R,Qt,$t;t[224]===Symbol.for(`react.memo_cache_sentinel`)?(Qt=(0,Z.jsx)(tc,{"aria-hidden":`true`}),$t=(0,Z.jsx)(J,{id:`HdkSiO`}),t[224]=Qt,t[225]=$t):(Qt=t[224],$t=t[225]);let en;t[226]!==pe||t[227]!==X?(en=(0,Z.jsxs)(Xv,{disabled:X,onSelect:pe,"data-testid":`empty-space-menu-new-file`,children:[Qt,$t]}),t[226]=pe,t[227]=X,t[228]=en):en=t[228];let tn;t[229]!==he||t[230]!==F||t[231]!==R?(tn=F?(0,Z.jsxs)(Jv,{children:[(0,Z.jsxs)(Zv,{disabled:!R,"data-testid":`empty-space-menu-new-from-template`,children:[(0,Z.jsx)(ks,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`Uuj_R4`})]}),(0,Z.jsx)(Qv,{children:(0,Z.jsx)(TZ,{parentDir:``,onSelectTemplate:he,ItemComponent:Xv})})]}):null,t[229]=he,t[230]=F,t[231]=R,t[232]=tn):tn=t[232];let nn=!R,rn,an;t[233]===Symbol.for(`react.memo_cache_sentinel`)?(rn=(0,Z.jsx)(Nh,{"aria-hidden":`true`}),an=(0,Z.jsx)(J,{id:`96G6Re`}),t[233]=rn,t[234]=an):(rn=t[233],an=t[234]);let on;t[235]!==_e||t[236]!==nn?(on=(0,Z.jsxs)(Xv,{disabled:nn,onSelect:_e,"data-testid":`empty-space-menu-new-folder`,children:[rn,an]}),t[235]=_e,t[236]=nn,t[237]=on):on=t[237];let sn;t[238]===Symbol.for(`react.memo_cache_sentinel`)?(sn=(0,Z.jsx)(ty,{}),t[238]=sn):sn=t[238];let dn;t[239]!==r||t[240]!==ye||t[241]!==R?(dn=L?(0,Z.jsxs)(Xv,{disabled:!R,onSelect:ye,"data-testid":`empty-space-menu-reveal-in-finder`,"aria-label":r(R?{id:`LtSYdi`}:{id:`o2yoFu`}),children:[(0,Z.jsx)(uc,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`LtSYdi`})}),R?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(J,{id:`wTcjov`})})]}):null,t[239]=r,t[240]=ye,t[241]=R,t[242]=dn):dn=t[242];let fn;t[243]!==ee||t[244]!==G||t[245]!==U?(fn=(0,Z.jsx)(f$,{input:G,installStates:U,dispatch:ee}),t[243]=ee,t[244]=G,t[245]=U,t[246]=fn):fn=t[246];let pn;t[247]!==Ce||t[248]!==B?(pn=B?(0,Z.jsxs)(Xv,{onSelect:Ce,"data-testid":`empty-space-menu-share`,children:[(0,Z.jsx)(og,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`Z8lGw6`})]}):null,t[247]=Ce,t[248]=B,t[249]=pn):pn=t[249];let mn=!R,hn;t[250]!==r||t[251]!==R?(hn=r(R?{id:`Up2_7p`}:{id:`U8CD-l`}),t[250]=r,t[251]=R,t[252]=hn):hn=t[252];let gn;t[253]===Symbol.for(`react.memo_cache_sentinel`)?(gn=(0,Z.jsx)($s,{"aria-hidden":`true`}),t[253]=gn):gn=t[253];let _n;t[254]===Symbol.for(`react.memo_cache_sentinel`)?(_n=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`Up2_7p`})}),t[254]=_n):_n=t[254];let vn;t[255]===R?vn=t[256]:(vn=R?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(J,{id:`wTcjov`})}),t[255]=R,t[256]=vn);let yn;t[257]!==xe||t[258]!==mn||t[259]!==hn||t[260]!==vn?(yn=(0,Z.jsxs)(Xv,{disabled:mn,onSelect:xe,"data-testid":`empty-space-menu-copy-full-path`,"aria-label":hn,children:[gn,_n,vn]}),t[257]=xe,t[258]=mn,t[259]=hn,t[260]=vn,t[261]=yn):yn=t[261];let bn;t[262]===Symbol.for(`react.memo_cache_sentinel`)?(bn=(0,Z.jsx)(ty,{}),t[262]=bn):bn=t[262];let xn;t[263]===Te?xn=t[264]:(xn=e=>Te({showHiddenFiles:e}),t[263]=Te,t[264]=xn);let Sn=K===null,Cn;t[265]===Symbol.for(`react.memo_cache_sentinel`)?(Cn=(0,Z.jsx)(J,{id:`XcGbim`}),t[265]=Cn):Cn=t[265];let wn;t[266]!==ne||t[267]!==xn||t[268]!==Sn?(wn=(0,Z.jsx)($v,{checked:ne,onCheckedChange:xn,disabled:Sn,"data-testid":`empty-space-menu-show-hidden-files`,children:Cn}),t[266]=ne,t[267]=xn,t[268]=Sn,t[269]=wn):wn=t[269];let Tn;t[270]===Te?Tn=t[271]:(Tn=e=>Te({showOkFolders:e}),t[270]=Te,t[271]=Tn);let En=K===null,Dn;t[272]===Symbol.for(`react.memo_cache_sentinel`)?(Dn=(0,Z.jsx)(J,{id:`GHsJb8`}),t[272]=Dn):Dn=t[272];let On;t[273]!==q||t[274]!==Tn||t[275]!==En?(On=(0,Z.jsx)($v,{checked:q,onCheckedChange:Tn,disabled:En,"data-testid":`empty-space-menu-show-ok-folders`,children:Dn}),t[273]=q,t[274]=Tn,t[275]=En,t[276]=On):On=t[276];let kn;t[277]===Te?kn=t[278]:(kn=e=>Te({showOnlyMarkdownFiles:e}),t[277]=Te,t[278]=kn);let An=K===null,jn;t[279]===Symbol.for(`react.memo_cache_sentinel`)?(jn=(0,Z.jsx)(J,{id:`WkTLN7`}),t[279]=jn):jn=t[279];let Mn;t[280]!==re||t[281]!==kn||t[282]!==An?(Mn=(0,Z.jsx)($v,{checked:re,onCheckedChange:kn,disabled:An,"data-testid":`empty-space-menu-show-only-markdown-files`,children:jn}),t[280]=re,t[281]=kn,t[282]=An,t[283]=Mn):Mn=t[283];let Nn;t[284]===Te?Nn=t[285]:(Nn=e=>Te({showSkillsSection:e}),t[284]=Te,t[285]=Nn);let Pn=K===null,Fn;t[286]===Symbol.for(`react.memo_cache_sentinel`)?(Fn=(0,Z.jsx)(J,{id:`NF_Wcg`}),t[286]=Fn):Fn=t[286];let In;t[287]!==ie||t[288]!==Nn||t[289]!==Pn?(In=(0,Z.jsx)($v,{checked:ie,onCheckedChange:Nn,disabled:Pn,"data-testid":`empty-space-menu-show-skills-section`,children:Fn}),t[287]=ie,t[288]=Nn,t[289]=Pn,t[290]=In):In=t[290];let Ln;t[291]===se?Ln=t[292]:(Ln=se?(0,Z.jsx)(ty,{}):null,t[291]=se,t[292]=Ln);let Rn;t[293]!==De||t[294]!==ae?(Rn=ae?(0,Z.jsxs)(Xv,{onSelect:De,"data-testid":`empty-space-menu-expand-all`,children:[(0,Z.jsx)(Tg,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`OlAl5i`})]}):null,t[293]=De,t[294]=ae,t[295]=Rn):Rn=t[295];let zn;t[296]!==ke||t[297]!==oe?(zn=oe?(0,Z.jsxs)(Xv,{onSelect:ke,"data-testid":`empty-space-menu-collapse-all`,children:[(0,Z.jsx)(jh,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`qvWGzP`})]}):null,t[296]=ke,t[297]=oe,t[298]=zn):zn=t[298];let Bn;t[299]!==dn||t[300]!==fn||t[301]!==pn||t[302]!==yn||t[303]!==wn||t[304]!==On||t[305]!==Mn||t[306]!==In||t[307]!==Ln||t[308]!==Rn||t[309]!==zn||t[310]!==en||t[311]!==tn||t[312]!==on?(Bn=(0,Z.jsxs)(Yv,{className:`min-w-52`,onCloseAutoFocus:ue,children:[en,tn,on,sn,dn,fn,pn,yn,bn,wn,On,Mn,In,Ln,Rn,zn]}),t[299]=dn,t[300]=fn,t[301]=pn,t[302]=yn,t[303]=wn,t[304]=On,t[305]=Mn,t[306]=In,t[307]=Ln,t[308]=Rn,t[309]=zn,t[310]=en,t[311]=tn,t[312]=on,t[313]=Bn):Bn=t[313];let Vn;return t[314]!==Bn||t[315]!==Zt?(Vn=(0,Z.jsx)(QN,{variant:`inset`,children:(0,Z.jsxs)(Gv,{children:[Zt,Bn]})}),t[314]=Bn,t[315]=Zt,t[316]=Vn):Vn=t[316],Vn}function M1(){return null}function N1(e){return console.log(e)}function P1(e){return dl.error(e)}function F1(e){return dl.success(e)}function I1(e){e.target instanceof Element&&e.target.closest(`[data-sidebar-root-context]`)||T1(e.target)&&(e.preventDefault(),e.stopPropagation())}var L1=(0,Q.lazy)(()=>n(()=>import(`./McpConsentDialogBody-CYOKF_sf.js`),__vite__mapDeps([167,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,114,29,30,31,59,96,99,43,168]),import.meta.url));function R1(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(mp.subscribe,B1,z1))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)(L1,{})}),e[0]=t):t=e[0],t}function z1(){return!1}function B1(){return mp.getSnapshot()!==null}function V1(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(!1),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>Vt(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)(im,{open:t,onOpenChange:n}),e[2]=t,e[3]=a),a}function H1(){let e=(0,$.c)(17),t=kt(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=Re(),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),f;e[6]!==o||e[7]!==s||e[8]!==a||e[9]!==c||e[10]!==i?(f=()=>{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]=f):f=e[11],(0,Q.useEffect)(f);let p,m;return e[12]!==n||e[13]!==t||e[14]!==r?(p=()=>{if(n===null)return;let e=new Su,i=new Cu({url:n,name:Bi,document:e,onStateless:e=>{let{payload:t}=e;Du(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),Ql(e.docName)},onDerivedView:J1,onConfigValidationRejected:q1,onConfigIgnoreNestedError:K1,onUnknown:G1})},onClose:W1,onDisconnect:U1}),a=Yl(e=>{(e.includes(`files`)||e.includes(`backlinks`))&&(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`)&&qd()}),o=d(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{eu([`files`,`backlinks`,`graph`]),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()}},m=[t,n,r],e[12]=n,e[13]=t,e[14]=r,e[15]=p,e[16]=m):(p=e[15],m=e[16]),(0,Q.useEffect)(p,m),null}function U1(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function W1(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function G1(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function K1(e){js(e)}function q1(e){Ls(e)}function J1(e){eu([e.ch])}var Y1=500;function X1(e){return!e.startsWith(`__`)&&!/\.(mmd|mermaid)$/i.test(e)}function Z1(){let e=(0,$.c)(3),{merged:t}=td(),n=t?.validation?.fileTreeIndicators!==!1,r,i;return e[0]===n?(r=e[1],i=e[2]):(r=()=>{if(!n)return;let e=new Map,t=!1,r=e=>{wd({kind:`doc`,docName:e}).then(n=>{t||n===null||vd(e,n.files.filter(t=>su(t.file)===e).flatMap(Q1))})},i=tu(t=>{if(!X1(t))return;let n=e.get(t);n!==void 0&&clearTimeout(n),e.set(t,setTimeout(()=>{e.delete(t),r(t)},Y1))});return()=>{t=!0,i();for(let t of e.values())clearTimeout(t);e.clear()}},i=[n],e[0]=n,e[1]=r,e[2]=i),(0,Q.useEffect)(r,i),null}function Q1(e){return e.diagnostics}function $1(e){let t=L(e);if(t)return{scope:`project`,name:t};let n=Ii(e);return n?.kind===`skill`?{scope:n.scope,name:n.name}:null}function e0(e,t){let n=new Set(t.map(e=>`${e.scope}\u0000${e.name}`)),r=[];for(let t of e){let e=$1(t);if(!e||n.has(`${e.scope}\u0000${e.name}`))continue;let i=e.scope===`project`?`global`:`project`;n.has(`${i}\u0000${e.name}`)?r.push({kind:`retarget`,fromDocName:t,toDocName:xa(i,e.name)}):r.push({kind:`close`,docName:t})}return r}function t0(){let e=(0,$.c)(13),{openTabs:t,closeDocument:n}=Re(),r;e[0]===t?r=e[1]:(r=t.some(r0),e[0]=t,e[1]=r);let i=r,a;e[2]===i?a=e[3]:(a={enabled:i},e[2]=i,e[3]=a);let o=$o(a),s=(0,Q.useRef)(null),c;e[4]!==n||e[5]!==t||e[6]!==o.data||e[7]!==o.status?(c=()=>{if(o.status!==`ready`)return;let e=o.data,r=`${t.join(``)}\u0002${e.map(n0).sort().join(``)}`;if(s.current===r)return;s.current=r;let i=e0(t,e);for(let e of i)e.kind===`retarget`?(pc(e.toDocName),n(e.fromDocName)):n(e.docName)},e[4]=n,e[5]=t,e[6]=o.data,e[7]=o.status,e[8]=c):c=e[8];let l;e[9]!==n||e[10]!==t||e[11]!==o?(l=[o,t,n],e[9]=n,e[10]=t,e[11]=o,e[12]=l):l=e[12],(0,Q.useEffect)(c,l)}function n0(e){return`${e.scope}\u0000${e.name}`}function r0(e){return $1(e)!==null}var i0=1e3,a0=3e4;function o0(e){let t=e.scheduler??{setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e)},n=e.initialBackoffMs??i0,r=e.maxBackoffMs??a0,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 s0(e){if(e)return e.replace(/\/collab\/?$/,``)}function c0(){return Ou(window)!==null}function l0(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??o0;if((i.current?.isElectronHost??c0)())return;let t=e({resolveWsUrl:async()=>s0(r.current)});return()=>t.close()},c=[],n[3]=s,n[4]=c):(s=n[3],c=n[4]),(0,Q.useEffect)(s,c)}var u0=(0,Q.lazy)(()=>n(()=>import(`./ShareBranchSwitchDialog-C6G5A_aK.js`).then(e=>({default:e.ShareBranchSwitchDialog})),__vite__mapDeps([169,1,10,11,12,23,14,15,16,17,24,25,26,22,27,91,33,170,99,171,172,173,6,2,3,7,8,9,174]),import.meta.url)),d0=(0,Q.lazy)(()=>n(()=>import(`./ShareReceiveMissDialog-Ls1ECEge.js`).then(e=>({default:e.ShareReceiveMissDialog})),__vite__mapDeps([175,1,23,10,11,12,14,15,16,17,24,25,26,22,27,176,117,6,2,3,7,8,9,84,68,85,86,87,94,99,64,59,20,37,96,33,170,120,40,43,63]),import.meta.url)),f0=`#install-claude-desktop`,p0=/\.(md|mdx)$/i;function m0(e){return wl(e)||e===f0}function h0(e,t){if(!p0.test(e))return null;for(let n of t){let t=C(n);if(t.kind===`doc`&&t.docName===e)return{kind:`doc`,target:e,docName:e}}return null}function g0(e,t,n,r){return[e,t,n,r].map(e=>[...e].sort().join(`\0`)).join(``)}function _0(){let e=(0,$.c)(27),{clearTarget:t,openTabs:n,syncOpenTabsWithKnownTargets:r,tabSessionLoaded:i}=Re(),{openTargetTransition:a}=Ke();t0();let{assetPaths:o,filePaths:s,folderPaths:c,loading:l,pageMeta:u,pages:d,pagesBySlug:f,pagesByBasename:p}=Bo(),m=(0,Q.useRef)(null),h=(0,Q.useRef)(null),g;e[0]!==o||e[1]!==s||e[2]!==c||e[3]!==d?(g=g0(d,c,o,s),e[0]=o,e[1]=s,e[2]=c,e[3]=d,e[4]=g):g=e[4];let _=g,v;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(v=[],e[5]=v):v=e[5],(0,Q.useEffect)(v0,v);let y,b;e[6]!==o||e[7]!==s||e[8]!==c||e[9]!==l||e[10]!==d||e[11]!==r||e[12]!==i||e[13]!==_?(y=()=>{l||!i||m.current===_||(m.current=_,r({pages:d,folderPaths:c,assetPaths:o,filePaths:s}))},b=[o,s,c,l,d,r,i,_],e[6]=o,e[7]=s,e[8]=c,e[9]=l,e[10]=d,e[11]=r,e[12]=i,e[13]=_,e[14]=y,e[15]=b):(y=e[14],b=e[15]),(0,Q.useEffect)(y,b);let x,S;return e[16]!==t||e[17]!==c||e[18]!==l||e[19]!==n||e[20]!==a||e[21]!==u||e[22]!==d||e[23]!==p||e[24]!==f?(x=()=>{r();let e=function(e){h.current=lu(e.state)?window.location.href:null};function r(){let e=h.current===window.location.href;h.current=null,uu();let r=t=>{if(e){a(t,{tabBehavior:`replace-active`});return}a(t)};if(m0(window.location.hash))return;let i=mu(window.location.hash);if(i){let e=Qi(i.split(`.`).pop()??``);iu(`ok/nav/hash-change`,{docName:null,kind:`asset`}),r({kind:`asset`,target:i,assetPath:i,mediaKind:e});return}let o=du(window.location.hash);if(o){iu(`ok/nav/hash-change`,{docName:null,kind:`skill-file`}),r({kind:`skill-file`,target:`${o.scope}/${o.name}/${o.path}`,scope:o.scope,name:o.name,path:o.path});return}if(bu(window.location.hash)){iu(`ok/nav/hash-change`,{docName:null,kind:`folder`}),r({kind:`folder`,target:``,folderPath:``});return}let s=_u(window.location.hash);if(!s){iu(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(l){iu(`ok/nav/hash-change`,{docName:s,kind:`deferred-loading`});return}let m=h0(s,n)??Kl(s,{pages:d,folderPaths:c,pagesBySlug:f,pagesByBasename:p});if(m.kind===`missing`&&/\/+$/.test(s.trim())){iu(`ok/nav/hash-change`,{docName:s,kind:`deferred-missing-folder`});return}let g=Jl(ql(m),u);iu(`ok/nav/hash-change`,{docName:s,kind:g.kind}),r(g)}return window.addEventListener(`popstate`,e),window.addEventListener(`hashchange`,r),()=>{window.removeEventListener(`popstate`,e),window.removeEventListener(`hashchange`,r)}},S=[t,c,l,a,n,u,d,f,p],e[16]=t,e[17]=c,e[18]=l,e[19]=n,e[20]=a,e[21]=u,e[22]=d,e[23]=p,e[24]=f,e[25]=x,e[26]=S):(x=e[25],S=e[26]),(0,Q.useEffect)(x,S),null}function v0(){return Vt(y0)}function y0(e){e===`navigate-back`&&window.history.back(),e===`navigate-forward`&&window.history.forward()}function b0(){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)(x0,t),null}function x0(){let e=function(e){let t=e.target;Dl({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=Ol))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function S0(){let e=(0,$.c)(4),{activeTarget:t}=Re(),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 C0(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=Re(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:Ll(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){let t=e.target;Y_({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)(Z_,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function w0(e){let t=(0,$.c)(3),{children:n}=e,{collabUrl:r}=Re();l0(r);let i;return t[0]!==n||t[1]!==r?(i=(0,Z.jsx)(Tu,{collabUrl:r,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function T0(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(au,{name:`app`,children:(0,Z.jsx)(Ze,{children:(0,Z.jsx)(w0,{children:(0,Z.jsx)(Lv,{children:(0,Z.jsx)(E0,{})})})})}),e[0]=t):t=e[0],t}function E0(){let e=(0,$.c)(32),t=typeof window<`u`?window.okDesktop??null:null,n=typeof window<`u`&&window.okDesktop!=null,[r,i]=(0,Q.useState)(!1),a=Bv(),o=Nd(),s;e[0]===o?s=e[1]:(s=t&&t.config.ptyAvailable===!0?{launchInTerminal:D0,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)(Dy,{}),e[2]=l):l=e[2];let u,d,f,p,m;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(H1,{}),d=(0,Z.jsx)(Z1,{}),f=(0,Z.jsx)(_0,{}),p=(0,Z.jsx)(S0,{}),m=(0,Z.jsx)(C0,{}),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)(b0,{}),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)(Oy,{bridge:t}):null,g=t?(0,Z.jsx)(Iy,{}):null,_=t?(0,Z.jsx)(V1,{}):null,v=t?(0,Z.jsx)(dR,{}):null,y=(0,Z.jsx)(R1,{}),b=t?(0,Z.jsxs)(Q.Suspense,{fallback:null,children:[(0,Z.jsx)(u0,{bridge:t}),(0,Z.jsx)(d0,{})]}):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)(gy,{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]===a?T=e[21]:(T=!a&&(0,Z.jsx)(E1,{onOpenSearch:()=>i(!0)}),e[20]=a,e[21]=T);let E;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(tP,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(sR,{onOpenSearch:()=>i(!0)})}),e[22]=E):E=e[22];let D;e[23]===T?D=e[24]:(D=(0,Z.jsxs)(YN,{className:`h-screen overflow-hidden`,children:[T,E]}),e[23]=T,e[24]=D);let O;e[25]!==D||e[26]!==c?(O=(0,Z.jsx)(os,{value:c,children:D}),e[25]=D,e[26]=c,e[27]=O):O=e[27];let k;return e[28]!==C||e[29]!==O||e[30]!==h?(k=(0,Z.jsxs)(Z.Fragment,{children:[l,(0,Z.jsxs)(Vo,{children:[u,d,f,p,m,h,x,S,g,_,v,y,b,C,w,O]})]}),e[28]=C,e[29]=O,e[30]=h,e[31]=k):k=e[31],k}function D0(e,t){Rc(Qo(e,t),t)}function O0(e){let t=/\/([^/]+?)(?:\.git)?\/?$/.exec(e);return t?t[1]:`repo`}function k0(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=O0(t),a=`${r.replace(/\/$/,``)}/${i}`,o=dl.loading(vl._({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);dl.loading(vl._({id:`GXf9hG`,values:{repoName:i}}),{id:o,description:vl._({id:`SCzAbA`,values:{phase:t,pct:n}}),duration:1/0});continue}if(e.type===`branch-fallback`){console.log(gp({branch_action:`fallback`,branch:e.branch})),dl.info(vl._({id:`3JYy1p`,values:{0:e.branch}}),{duration:8e3});continue}if(e.type===`complete`)return dl.success(vl._({id:`IRv9cH`,values:{repoName:i}}),{id:o,duration:4e3}),{kind:`ok`,dir:e.dir};if(e.type===`error`)return dl.dismiss(o),{kind:`error`,detail:e.message}}return dl.dismiss(o),{kind:`error`,detail:`Clone ended unexpectedly.`}}catch(e){console.warn(`[clone-controller] clone transport threw`,e);let t=e instanceof Error?e.message:`Unknown error`;return dl.dismiss(o),{kind:`error`,detail:t}}}}}function A0(){return{start(e){return ws((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=`Clone failed — check the URL and try again (${r.status})`;try{let t=await r.json(),n=pa.safeParse(t);n.success&&(e=`Clone failed: ${n.data.title}`)}catch{}t({type:`error`,message:e});return}if(!r.body){t({type:`error`,message:`Clone failed — empty response body`});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(`
2014
+ `);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||`Unknown error`});break}t(n)}if(n.aborted)break}n.aborted||t({type:`error`,message:`Clone stream ended unexpectedly — check if the clone completed`})}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;t({type:`error`,message:`Clone failed — connection error`})}})()})}}}function j0(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 M0(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 N0(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 P0(e){let t=(0,$.c)(100),{open:n,onOpenChange:r,onSignIn:i,onCloneComplete:a,transport:o,authQueryTransport:s,pickParentFolder:c,initialUrl:l}=e,{_:u}=mt(),d;t[0]===o?d=t[1]:(d=o??A0(),t[0]=o,t[1]=d);let f=d,p;t[2]===s?p=t[3]:(p=s??Hs(),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=Rs(),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=>{Is(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=N0(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,ee;t[22]!==j||t[23]!==I?(U=()=>{j<0||document.getElementById(`${I}-opt-${j}`)?.scrollIntoView({block:`nearest`})},ee=[j,I],t[22]=j,t[23]=I,t[24]=U,t[25]=ee):(U=t[24],ee=t[25]),(0,Q.useEffect)(U,ee);let W;t[26]===h?W=t[27]:(W=function(e){if(_(e),A(!0),M(-1),h)return;let t=N0(e);t&&y(`~/Documents/${t}`)},t[26]=h,t[27]=W);let G=W,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 te=K,ne;t[30]!==u||t[31]!==v||t[32]!==a||t[33]!==r||t[34]!==c||t[35]!==f||t[36]!==g?(ne=async function(){let e=g.trim();if(!e){dl.error(u({id:`FTUGgh`}));return}let t=v||``;if(c){O(!0);let n=await c();if(!n){O(!1);return}let r=N0(e);t=`${n.replace(/\/$/,``)}/${r}`}else O(!0);let n=dl.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(M0(i.phase));dl.loading(`${e} — ${i.pct}%`,{id:n})}else if(i.type===`complete`){dl.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;dl.error(u({id:`eFJkVt`,values:{cloneError:e}}),{id:n}),O(!1),N.current=null;return}t=await e.next()}dl.error(u({id:`Tz9pJB`}),{id:n}),O(!1),N.current=null}catch(e){console.error(`[CloneDialog] clone iteration failed:`,e),dl.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]=ne):ne=t[37];let q=ne,re;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(re=function(){N.current?.(),N.current=null,O(!1),dl.dismiss(P.current??void 0)},t[38]=re):re=t[38];let ie=re,ae;t[39]!==D||t[40]!==r||t[41]!==h?(ae=function(e){D||(r(e),e||(_(``),h||y(``),A(!1),M(-1)))},t[39]=D,t[40]=r,t[41]=h,t[42]=ae):ae=t[42];let oe=ae,se;t[43]===te?se=t[44]:(se=function(e){te(e),A(!1),M(-1),F.current?.focus()},t[43]=te,t[44]=se);let ce=se,le=T===null||S&&b===null,ue;if(t[45]!==b||t[46]!==g){let e=g.trim().toLowerCase(),n;t[48]===b?n=t[49]:(n=b??[],t[48]=b,t[49]=n),ue=n.filter(t=>`${t.full_name} ${t.clone_url}`.toLowerCase().includes(e)),t[45]=b,t[46]=g,t[47]=ue}else ue=t[47];let de=ue,fe;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(fe=/:\/\/|^git@|\.git$/i,t[50]=fe):fe=t[50];let pe;t[51]===g?pe=t[52]:(pe=fe.test(g.trim()),t[51]=g,t[52]=pe);let me=pe,he=T===!0&&b!==null&&de.length===0&&!me,ge=k&&T!==!1&&!D&&(le||de.length>0||he),_e=de.length,ve=`${I}-loading`,ye,be;t[53]===_e?(ye=t[54],be=t[55]):(ye=()=>{M(e=>e>=_e?_e-1:e)},be=[_e],t[53]=_e,t[54]=ye,t[55]=be),(0,Q.useEffect)(ye,be);let xe;t[56]!==j||t[57]!==D||t[58]!==ge||t[59]!==ce||t[60]!==de?(xe=function(e){if(!D)if(e.key===`ArrowDown`){if(e.preventDefault(),!ge){A(!0);return}M(e=>Math.min(e+1,de.length-1))}else e.key===`ArrowUp`?(e.preventDefault(),M(B0)):e.key===`Enter`?ge&&j>=0&&j<de.length&&(e.preventDefault(),ce(de[j])):e.key===`Escape`&&ge&&(e.preventDefault(),e.stopPropagation(),A(!1),M(-1))},t[56]=j,t[57]=D,t[58]=ge,t[59]=ce,t[60]=de,t[61]=xe):xe=t[61];let Se=xe,Ce;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(gn,{children:(0,Z.jsx)(fn,{children:(0,Z.jsx)(J,{id:`VdXv4D`})})}),t[62]=Ce):Ce=t[62];let we;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(`label`,{htmlFor:`clone-source`,className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`IreQBq`})}),t[63]=we):we=t[63];let Te;t[64]!==u||t[65]!==j||t[66]!==D||t[67]!==Se||t[68]!==G||t[69]!==T||t[70]!==I||t[71]!==ve||t[72]!==i||t[73]!==ge||t[74]!==le||t[75]!==b||t[76]!==ce||t[77]!==de||t[78]!==g?(Te=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[we,T===!1?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(_l,{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)(J,{id:`9oE4C3`})}),(0,Z.jsx)(X,{variant:`link`,className:`h-auto p-0`,onClick:()=>i?.(),disabled:D,children:(0,Z.jsx)(J,{id:`3jod3l`})})]})]}):(0,Z.jsxs)(zt,{open:ge,onOpenChange:A,children:[(0,Z.jsx)(Ut,{asChild:!0,children:(0,Z.jsx)(_l,{id:`clone-source`,ref:F,role:`combobox`,"aria-expanded":ge,"aria-controls":ge?le?ve: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:Se,disabled:D})}),(0,Z.jsx)(Gt,{align:`start`,sideOffset:4,className:`w-(--radix-popover-trigger-width) max-h-56 overflow-y-auto overscroll-y-contain subtle-scrollbar p-0`,onOpenAutoFocus:z0,onCloseAutoFocus:R0,onInteractOutside:e=>{F.current?.contains(e.target)&&e.preventDefault()},onWheel:L0,onTouchMove:I0,children:le?(0,Z.jsxs)(`output`,{id:ve,className:`flex flex-col gap-1.5 px-3 py-2`,"aria-label":u({id:`8XQRON`}),children:[(0,Z.jsx)(Ud,{className:`h-4 w-2/3`}),(0,Z.jsx)(Ud,{className:`h-4 w-1/2`}),(0,Z.jsx)(Ud,{className:`h-4 w-3/4`}),(0,Z.jsx)(Ud,{className:`h-4 w-2/5`})]}):(0,Z.jsx)(`div`,{id:I,role:`listbox`,"aria-label":u({id:`KX1MZR`}),className:`py-1`,children:de.length===0?(0,Z.jsx)(`div`,{role:`presentation`,className:`px-3 py-2 text-xs text-muted-foreground`,children:b&&b.length===0?(0,Z.jsx)(J,{id:`cOSAfL`}):(0,Z.jsx)(J,{id:`8eW0WQ`})}):de.map((e,t)=>(0,Z.jsxs)(`div`,{id:`${I}-opt-${t}`,role:`option`,tabIndex:-1,"aria-selected":t===j,onMouseDown:F0,onMouseEnter:()=>M(t),onClick:()=>ce(e),className:Y(`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)(Go,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`n5n_vi`})})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ho,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{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]=Se,t[68]=G,t[69]=T,t[70]=I,t[71]=ve,t[72]=i,t[73]=ge,t[74]=le,t[75]=b,t[76]=ce,t[77]=de,t[78]=g,t[79]=Te):Te=t[79];let Ee;t[80]!==D||t[81]!==v||t[82]!==h?(Ee=!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)(J,{id:`Gp_twO`})}),(0,Z.jsx)(_l,{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]=Ee):Ee=t[83];let De;t[84]!==Te||t[85]!==Ee?(De=(0,Z.jsx)(mn,{children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[Te,Ee]})}),t[84]=Te,t[85]=Ee,t[86]=De):De=t[86];let Oe;t[87]!==D||t[88]!==q||t[89]!==oe||t[90]!==g||t[91]!==h?(Oe=(0,Z.jsx)(hn,{children:D?(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:ie,children:(0,Z.jsx)(J,{id:`dEgA5A`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:()=>oe(!1),children:(0,Z.jsx)(J,{id:`dEgA5A`})}),(0,Z.jsx)(X,{onClick:()=>void q(),disabled:!g.trim(),"aria-describedby":h?`clone-picker-hint`:void 0,children:(0,Z.jsx)(J,{id:`9UQ730`})}),h&&(0,Z.jsx)(`span`,{id:`clone-picker-hint`,className:`sr-only`,children:(0,Z.jsx)(J,{id:`EvPX7f`})})]})}),t[87]=D,t[88]=q,t[89]=oe,t[90]=g,t[91]=h,t[92]=Oe):Oe=t[92];let ke;t[93]!==De||t[94]!==Oe?(ke=(0,Z.jsxs)(pn,{className:`sm:max-w-lg`,children:[Ce,De,Oe]}),t[93]=De,t[94]=Oe,t[95]=ke):ke=t[95];let Ae;return t[96]!==oe||t[97]!==n||t[98]!==ke?(Ae=(0,Z.jsx)(_n,{open:n,onOpenChange:oe,children:ke}),t[96]=oe,t[97]=n,t[98]=ke,t[99]=Ae):Ae=t[99],Ae}function F0(e){return e.preventDefault()}function I0(e){return e.stopPropagation()}function L0(e){return e.stopPropagation()}function R0(e){return e.preventDefault()}function z0(e){return e.preventDefault()}function B0(e){return Math.max(e-1,-1)}var V0=(0,Q.lazy)(()=>n(()=>import(`./ConsentDialogBody-BjbzWR8D.js`),__vite__mapDeps([177,1,10,11,12,13,14,15,16,17,18,19,20,21,22,35,23,24,25,26,27,92,99,178,114,115,49,50,130,29,30,31,96,41,42]),import.meta.url));function H0(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(gl.subscribe,W0,U0))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)(V0,{})}),e[0]=t):t=e[0],t}function U0(){return!1}function W0(){return gl.getSnapshot()!==null}function G0(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 K0=(0,Q.lazy)(()=>n(()=>import(`./ShareReceiveDialog-DLEkjmkI.js`).then(e=>({default:e.ShareReceiveDialog})),__vite__mapDeps([179,1,6,2,3,7,8,9,10,11,12,23,14,15,16,17,24,25,26,22,27,33,99,171,172,173]),import.meta.url)),q0=(0,Q.lazy)(()=>n(()=>import(`./AppMenubar-CXadCCMc.js`).then(e=>({default:e.AppMenubar})),__vite__mapDeps([161,1,10,11,12,14,15,16,17,49,113,30,31,19,24,25,50,20,92,22]),import.meta.url)),J0=(e,t,n)=>Pv(e,t,n,`NavigatorApp`);function Y0(e,t){return e.filter(e=>e.path!==t)}function X0(e){let t=(0,$.c)(153),{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}=Ft(),{_:z}=mt();wu(n,R??`system`);let B;t[2]!==z||t[3]!==n.project?(B=()=>{let e=!1;return n.project.listRecent().then(async t=>{if(e)return;a(t);let r=t.filter(Z0),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[2]=z,t[3]=n.project,t[4]=B):B=t[4];let V;t[5]!==z||t[6]!==n?(V=[n,z],t[5]=z,t[6]=n,t[7]=V):V=t[7],(0,Q.useEffect)(B,V);let H,U;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>Vt(e=>{e===`new-project`&&b(!0),e===`report-bug`&&S(!0),e===`send-feedback`&&w(!0),e===`close-active-tab-or-window`&&window.close()}),U=[],t[8]=H,t[9]=U):(H=t[8],U=t[9]),(0,Q.useEffect)(H,U);let ee,W;t[10]===n?(ee=t[11],W=t[12]):(ee=()=>n.onRecentRemovedMissing(e=>{let{path:t}=e;a(e=>Y0(e,t)),c(e=>{if(!e.has(t))return e;let n=new Map(e);return n.delete(t),n})}),W=[n],t[10]=n,t[11]=ee,t[12]=W),(0,Q.useEffect)(ee,W);let G;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(G=(e,t)=>J0(e,t,m),t[13]=G):G=t[13];let K=G,te;t[14]!==z||t[15]!==n?(te=(e,t,r)=>K(()=>(g(r),n2(n,e,t).finally(()=>g(null))),z({id:`SUOoXn`})),t[14]=z,t[15]=n,t[16]=te):te=t[16];let ne=te,q;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(q=()=>v(!0),t[17]=q):q=t[17];let re=q,ie;t[18]!==z||t[19]!==n?(ie=()=>K(async()=>{let e=await n.dialog.openFolder();e&&(g(r2(e)),await n2(n,e,`pick-existing`).finally(()=>g(null)))},z({id:`gmJ0An`})),t[18]=z,t[19]=n,t[20]=ie):ie=t[20];let ae=ie,oe;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>b(!0),t[21]=oe):oe=t[21];let se=oe,ce;t[22]!==z||t[23]!==n.project?(ce=()=>K(()=>n.project.openFile(),z({id:`8vCZcs`})),t[22]=z,t[23]=n.project,t[24]=ce):ce=t[24];let le=ce,ue;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(e,t)=>{E(e),O(t),b(!0)},t[25]=ue):ue=t[25];let de=ue,fe;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(fe=e=>{b(e),e||(E(void 0),O(void 0))},t[26]=fe):fe=t[26];let pe=fe,me;t[27]===ne?me=t[28]:(me=e=>ne(e,`recents`,r2(e)),t[27]=ne,t[28]=me);let he=me,ge;t[29]!==z||t[30]!==n.project?(ge=e=>K(async()=>{await n.project.removeRecent(e),a(t=>Y0(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[29]=z,t[30]=n.project,t[31]=ge):ge=t[31];let _e=ge,ve;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(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:_F()&&(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)(q0,{})})})}),t[32]=ve):ve=t[32];let ye;t[33]!==z||t[34]!==h?(ye=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)(Gc,{className:`size-6 animate-spin text-muted-foreground`}),(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:z({id:`s0_GnA`,values:{openingLabel:h}})})]}),t[33]=z,t[34]=h,t[35]=ye):ye=t[35];let be;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(G0,{className:`size-12 shrink-0`}),t[36]=be):be=t[36];let xe;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(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)($F,{})]}),t[37]=xe):xe=t[37];let Se;t[38]===n.appVersion?Se=t[39]:(Se=(0,Z.jsxs)(`header`,{className:`shrink-0 flex-wrap flex items-center gap-2.5`,children:[be,(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[xe,(0,Z.jsxs)(`p`,{className:`text-muted-foreground text-xs font-mono`,children:[`v`,n.appVersion]})]})]}),t[38]=n.appVersion,t[39]=Se);let Ce;t[40]===z?Ce=t[41]:(Ce=z({id:`wbv9xO`}),t[40]=z,t[41]=Ce);let we;t[42]===z?we=t[43]:(we=z({id:`0uTHCg`}),t[42]=z,t[43]=we);let Te;t[44]!==Ce||t[45]!==we?(Te=(0,Z.jsx)(Q0,{title:Ce,description:we,onClick:se,dataTestId:`nav-create-new`,Icon:Ht}),t[44]=Ce,t[45]=we,t[46]=Te):Te=t[46];let Ee;t[47]===z?Ee=t[48]:(Ee=z({id:`WPwDin`}),t[47]=z,t[48]=Ee);let De;t[49]===z?De=t[50]:(De=z({id:`tUvUfp`}),t[49]=z,t[50]=De);let Oe;t[51]!==ae||t[52]!==Ee||t[53]!==De?(Oe=(0,Z.jsx)(Q0,{title:Ee,description:De,onClick:ae,dataTestId:`nav-open`,Icon:uc}),t[51]=ae,t[52]=Ee,t[53]=De,t[54]=Oe):Oe=t[54];let ke;t[55]===z?ke=t[56]:(ke=z({id:`ka6Eke`}),t[55]=z,t[56]=ke);let Ae;t[57]===z?Ae=t[58]:(Ae=z({id:`gOD68k`}),t[57]=z,t[58]=Ae);let je;t[59]!==le||t[60]!==ke||t[61]!==Ae?(je=(0,Z.jsx)(Q0,{title:ke,description:Ae,onClick:le,dataTestId:`nav-open-file`,Icon:Un}),t[59]=le,t[60]=ke,t[61]=Ae,t[62]=je):je=t[62];let Me;t[63]===z?Me=t[64]:(Me=z({id:`VdXv4D`}),t[63]=z,t[64]=Me);let Ne;t[65]===z?Ne=t[66]:(Ne=z({id:`JOcPqH`}),t[65]=z,t[66]=Ne);let Pe;t[67]!==Me||t[68]!==Ne?(Pe=(0,Z.jsx)(Q0,{title:Me,description:Ne,onClick:re,dataTestId:`nav-clone`,Icon:Yg}),t[67]=Me,t[68]=Ne,t[69]=Pe):Pe=t[69];let Fe;t[70]!==Te||t[71]!==Oe||t[72]!==je||t[73]!==Pe?(Fe=(0,Z.jsxs)(`section`,{className:`grid sm:grid-cols-2 gap-3`,children:[Te,Oe,je,Pe]}),t[70]=Te,t[71]=Oe,t[72]=je,t[73]=Pe,t[74]=Fe):Fe=t[74];let Ie;t[75]!==l||t[76]!==i||t[77]!==d?(Ie=!l&&!d&&i.length===0?(0,Z.jsx)(e2,{onPackSelect:de}):null,t[75]=l,t[76]=i,t[77]=d,t[78]=Ie):Ie=t[78];let Le;t[79]!==Fe||t[80]!==Ie?(Le=(0,Z.jsxs)(`div`,{className:`shrink-0 space-y-6`,children:[Fe,Ie]}),t[79]=Fe,t[80]=Ie,t[81]=Le):Le=t[81];let Re;t[82]===p?Re=t[83]:(Re=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)(J,{id:`1QfxQT`})})]}),t[82]=p,t[83]=Re);let ze;t[84]!==l||t[85]!==he||t[86]!==_e||t[87]!==s||t[88]!==i?(ze=l?(0,Z.jsx)(`section`,{className:`flex shrink-0 flex-col items-center`,children:(0,Z.jsx)(Gc,{className:`size-4 animate-spin 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)(J,{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)(t2,{project:e,branch:s.get(e.path)??null,onOpen:()=>he(e.path),onRemove:()=>_e(e.path)},e.path))})]}):null,t[84]=l,t[85]=he,t[86]=_e,t[87]=s,t[88]=i,t[89]=ze):ze=t[89];let Be;t[90]!==Se||t[91]!==Le||t[92]!==Re||t[93]!==ze?(Be=(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:[Se,Le,Re,ze]})}),t[90]=Se,t[91]=Le,t[92]=Re,t[93]=ze,t[94]=Be):Be=t[94];let Ve,He;t[95]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=(0,Z.jsx)(R1,{}),He=(0,Z.jsx)(H0,{}),t[95]=Ve,t[96]=He):(Ve=t[95],He=t[96]);let Ue;t[97]!==n||t[98]!==y||t[99]!==T||t[100]!==D?(Ue=(0,Z.jsx)(Fg,{open:y,onOpenChange:pe,bridge:n,initialPackId:T,packs:D}),t[97]=n,t[98]=y,t[99]=T,t[100]=D,t[101]=Ue):Ue=t[101];let We;t[102]===x?We=t[103]:(We=(0,Z.jsx)(im,{open:x,onOpenChange:S,systemWide:!0}),t[102]=x,t[103]=We);let Ge;t[104]===C?Ge=t[105]:(Ge=(0,Z.jsx)(B_,{open:C,onOpenChange:w,source:`help_menu`}),t[104]=C,t[105]=Ge);let Ke;t[106]===N?Ke=t[107]:(Ke=e=>{A(e),e||(M(!1),N&&(N(null),P(null)))},t[106]=N,t[107]=Ke);let qe;t[108]===n?qe=t[109]:(qe=ys(n),t[108]=n,t[109]=qe);let Je;t[110]===n?Je=t[111]:(Je=ds(n),t[110]=n,t[111]=Je);let Ye=I===`identity`,Xe;t[112]!==j||t[113]!==N?(Xe=e=>{A(!1),j&&(M(!1),v(!0)),N&&(N({authenticated:!0,host:`github.com`,login:e.login}),P(null))},t[112]=j,t[113]=N,t[114]=Xe):Xe=t[114];let Ze;t[115]!==k||t[116]!==Ke||t[117]!==qe||t[118]!==Je||t[119]!==Ye||t[120]!==Xe?(Ze=(0,Z.jsx)(_s,{open:k,onOpenChange:Ke,transport:qe,queryTransport:Je,identityPrompt:Ye,onSuccess:Xe}),t[115]=k,t[116]=Ke,t[117]=qe,t[118]=Je,t[119]=Ye,t[120]=Xe,t[121]=Ze):Ze=t[121];let Qe;t[122]===n?Qe=t[123]:(Qe=j0(n),t[122]=n,t[123]=Qe);let $e;t[124]===n?$e=t[125]:($e=ds(n),t[124]=n,t[125]=$e);let et;t[126]===n.dialog?et=t[127]:(et=()=>n.dialog.openFolder(),t[126]=n.dialog,t[127]=et);let tt;t[128]===Symbol.for(`react.memo_cache_sentinel`)?(tt=()=>{v(!1),L(`auth`),M(!0),A(!0)},t[128]=tt):tt=t[128];let nt;t[129]!==z||t[130]!==n?(nt=e=>{let{dir:t}=e;K(()=>(g(r2(t)),n2(n,t,`pick-existing`).finally(()=>g(null))),z({id:`iSnkwB`}))},t[129]=z,t[130]=n,t[131]=nt):nt=t[131];let rt;t[132]!==_||t[133]!==Qe||t[134]!==$e||t[135]!==et||t[136]!==nt?(rt=(0,Z.jsx)(P0,{open:_,onOpenChange:v,transport:Qe,authQueryTransport:$e,pickParentFolder:et,onSignIn:tt,onCloneComplete:nt}),t[132]=_,t[133]=Qe,t[134]=$e,t[135]=et,t[136]=nt,t[137]=rt):rt=t[137];let it;if(t[138]!==n){let e;t[140]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>new Promise(e=>{P(()=>e),A(!0)}),t[140]=e):e=t[140],it=k0({bridge:n,authQueryTransport:ds(n),cloneTransport:j0(n),openSignIn:e}),t[138]=n,t[139]=it}else it=t[139];let at;t[141]!==n||t[142]!==it?(at=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(K0,{bridge:n,cloneController:it})}),t[141]=n,t[142]=it,t[143]=at):at=t[143];let ot;return t[144]!==ye||t[145]!==Be||t[146]!==Ue||t[147]!==We||t[148]!==Ge||t[149]!==Ze||t[150]!==rt||t[151]!==at?(ot=(0,Z.jsxs)(`div`,{className:`relative flex h-screen w-screen flex-col overflow-hidden bg-primary-foreground dark:bg-background text-foreground`,children:[ve,ye,Be,Ve,He,Ue,We,Ge,Ze,rt,at]}),t[144]=ye,t[145]=Be,t[146]=Ue,t[147]=We,t[148]=Ge,t[149]=Ze,t[150]=rt,t[151]=at,t[152]=ot):ot=t[152],ot}function Z0(e){return!e.missing}function Q0(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 $0=3;function e2(e){let t=(0,$.c)(36),{onPackSelect:n}=e,{_:r}=mt(),[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 gv().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,$0);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)(J,{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=vv(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)(J,{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)(fn,{children:(0,Z.jsx)(J,{id:`tcjTlU`})}),t[22]=y):y=t[22];let b;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsxs)(gn,{children:[y,(0,Z.jsx)(dn,{children:(0,Z.jsx)(J,{id:`b6Fgpe`})})]}),t[23]=b):b=t[23];let x;t[24]!==i||t[25]!==d?(x=(0,Z.jsxs)(pn,{className:`sm:max-w-3xl`,"data-testid":`nav-pack-picker`,children:[b,(0,Z.jsx)(mn,{children:(0,Z.jsx)(yv,{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)(_n,{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 t2(e){let t=(0,$.c)(43),{project:n,branch:r,onOpen:i,onRemove:a}=e,{_:o}=mt(),{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)(Ph,{"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)(xu,{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)(co,{"aria-hidden":`true`,className:`size-2.5`}),(0,Z.jsx)(J,{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)(J,{id:`PRnH8G`,values:{0:Uv(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)(co,{"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)(ul,{"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)(ry,{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 n2(e,t,n){await e.project.open({path:t,target:`new-window`,entryPoint:n})}function r2(e){let t=e.split(/[/\\]/).filter(Boolean);return t.length>0?t[t.length-1]??e:e}var i2=(0,Q.lazy)(()=>n(()=>import(`./TerminalWindowApp-2yCXBcQc.js`).then(e=>({default:e.TerminalWindowApp})),__vite__mapDeps([180,1,84,6,2,3,7,8,9,68,12,22,11,85,86,87,164,111,17,47,10,14,15,16,49,112,113,30,31,19,24,25,50,20,92,89,29,51,26,118,105,36,165,121,106,39,41,42,33,98,38,27,99,137,138,163,166,122,181,182]),import.meta.url));function a2(e){return e?.config.mode===`terminal`?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(i2,{bridge:e})}):e?.config.mode===`navigator`?(0,Z.jsx)(X0,{bridge:e}):(0,Z.jsx)(T0,{})}function o2(){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 s2=o2();function c2(e){return s2.install(e)}function l2(e){let t=(0,$.c)(7),{bridge:n}=e,r=(0,Q.useSyncExternalStore)(s2.subscribe,s2.getSnapshot);if(r===null)return null;let i;t[0]!==n.bugReport||t[1]!==r?(i=e=>{e||(n.bugReport.crashAck({eventId:r.eventId}),s2.dismiss())},t[0]=n.bugReport,t[1]=r,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)(im,{open:!0,onOpenChange:i,systemWide:a,crashInvite:r}),t[3]=r,t[4]=i,t[5]=a,t[6]=o):o=t[6],o}var u2=e=>{let t=(0,$.c)(8),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{theme:r}=Ft(),i=r===void 0?`system`:r,a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={success:(0,Z.jsx)(Wo,{className:`size-4`}),info:(0,Z.jsx)(Wc,{className:`size-4`}),warning:(0,Z.jsx)(al,{className:`size-4`}),error:(0,Z.jsx)(Yh,{className:`size-4`}),loading:(0,Z.jsx)(Gc,{className:`size-4 animate-spin`})},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)(fl,{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},d2=Symbol.for(`ok.client.fetchWrapper`);function f2(e={}){if(typeof window>`u`)return;let t=e.apiOrigin&&e.apiOrigin.length>0?e.apiOrigin:void 0;if(window.fetch[d2])return;let n=window.fetch.bind(window),r=ku(),i=((e,i)=>{let a=m2(e,t);if(!a.isApi)return n(e,i);if(e instanceof Request){let t=p2(e.headers,r);return n(new Request(a.url,e),{headers:t})}let o=p2(i?.headers,r);return n(a.url,{...i,headers:o})});i[d2]=!0,window.fetch=i}function p2(e,t){let n=new Headers(e);for(let[e,r]of Object.entries(t))n.set(e,r);return n}function m2(e,t){if(typeof e==`string`){if(e.startsWith(`/api/`))return{isApi:!0,url:t?t+e:e};let n=h2(e);return n&&g2(n,t)?{isApi:!0,url:e}:{isApi:!1,url:e}}let n=e instanceof URL?e:h2(e.url,window.location.origin);if(n&&g2(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 h2(e,t){try{return new URL(e,t)}catch{return null}}function g2(e,t){if(!e.pathname.startsWith(`/api/`))return!1;if(e.origin===window.location.origin||e.protocol===`file:`)return!0;if(t){let n=h2(t);if(n&&e.origin===n.origin)return!0}return!1}var _2=Symbol.for(`ok.client.logForwarder`),v2=2e3,y2=[`log`,`info`,`warn`,`error`],b2={log:`info`,info:`info`,warn:`warn`,error:`error`};function x2(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 S2(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 C2(e={}){let t=e.windowObj??(typeof window<`u`?window:void 0);if(!t||t.okDesktop)return;let n=t;if(n[_2])return;n[_2]=!0;let r=e.consoleObj??console,i=e.documentObj===void 0?typeof document<`u`?document:null:e.documentObj,a=e.flushIntervalMs??v2,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+=S2(e),c.length>100){let e=c.shift();e&&(l-=S2(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=_a(t.map(x2).join(` `)),r=t[0],i=typeof r==`string`&&r.length<=32768?r:void 0,a=i?oo(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 y2)r[e]=(...t)=>{p[e](...t),g(b2[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: ${x2(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 y2)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[_2]}return{flushNow:m,uninstall:x}}function w2(e,t){return e.branch===void 0||e.branch===null||e.branch===``||t===``||e.multiCandidate!==!0?null:{message:`Opened on branch ${e.branch}`,description:t}}function T2(e){let t=e.bridge;if(!t)return;let n=e.setHash??(e=>{window.location.hash=e}),r=e.emitToast??((e,t)=>{dl(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){Kc.arm(a);return}ac.arm(a),n(fu(i,e.doc,i===`doc`?e.branch:void 0));let o=w2(e,t.config.projectPath);o!==null&&r(o.message,{description:o.description,duration:3e3})})}var E2=4e3,D2=1440*60*1e3;function O2(e){let t=e.bridge;if(t&&t.onboarding)return t.onboarding.onToast(e=>{if(e.kind===`ancestor-promote`){dl.success(`Opened existing OpenKnowledge project at ${e.ancestorPath}`,{duration:E2});return}if(e.kind===`startup-reclaim`){let t=[];if(e.mcp.status===`repaired`){let n=e.mcp.editors.map(e=>Vi[e]??e).join(`, `);t.push(`repaired ${n} MCP integration`)}else e.mcp.status===`failed`&&t.push(`MCP auto-repair failed`);e.path.status===`installed`&&t.push(e.path.summary),e.path.status===`failed`&&t.push(`PATH install failed: ${e.path.summary}`);let n=t.length>0?t.join(`; `):`OpenKnowledge integrations checked.`,r=e.mcp.status===`failed`||e.path.status===`failed`,i=e.path.status!==`none`;dl[r?`error`:`success`](n,{duration:r||i?D2:E2,position:`bottom-left`});return}if(e.kind===`sharing-refused-tracked`){dl.error(`Config sharing unchanged: ${e.tracked.length} OK file(s) tracked upstream — see message below.`,{duration:D2,description:e.remediation});return}if(e.kind===`sharing-no-git`){dl.warning(`Local-only requested but no git repository was created. Switch later via Settings → Config sharing once the project is in a git repo.`,{duration:E2});return}let t=hl(e.gitRoot,e.pickedPath)??e.pickedPath;dl.success(`Initialized OpenKnowledge at ${e.gitRoot} — opened parent of ${t} because it contains a .git folder`,{duration:E2})})}function k2(e){return vl._({id:`wXw19Y`,values:{projectName:e}})}function A2(e){let t=e.bridge;if(t)return t.onRecentRemovedMissing(({projectName:e})=>{dl(k2(e))})}function j2(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)(al,{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 M2(){return vl._({id:`f_PkYv`})}function N2(e){return e.serverRuntime===e.appRuntime?vl._({id:`FWQuPE`,values:{0:e.appRuntime}}):e.relation===`older`?vl._({id:`LhQlGR`,values:{0:e.serverRuntime,1:e.appRuntime}}):vl._({id:`yZmvQ4`,values:{0:e.serverRuntime,1:e.appRuntime}})}function P2(e){return vl._({id:`2YOwme`,values:{appRuntime:e}})}function F2(e){return e===`eperm`?vl._({id:`uQewpR`}):vl._({id:`PqYWiC`})}async function I2(e){let t=dl.loading(vl._({id:`Kf7GG5`}),{duration:1/0}),n;try{n=await e.restartServer(e.config.projectPath)}catch{return}dl.dismiss(t),n.ok===!1&&dl.error(F2(n.reason),{duration:1/0})}function L2(e){let t=e.bridge;if(!t)return;let n=t.onServerVersionDrift(e=>{dl.custom(n=>(0,Q.createElement)(j2,{body:N2(e),warning:M2(),restartLabel:vl._({id:`ppDgFi`}),cancelLabel:vl._({id:`PBxg_E`}),onRestart:()=>{dl.dismiss(n),I2(t)},onDismiss:()=>dl.dismiss(n)}),{duration:1/0})}),r=t.onServerRestarted(e=>{dl.success(P2(e.appRuntime))});return()=>{n(),r()}}function R2(e){let{initialDoc:t}=e;if(!t)return;let n=e.getHash();n!==``&&n!==`#`&&n!==`#/`||e.setHash(vu(t))}function z2(){typeof window>`u`||!window.okDesktop||R2({initialDoc:window.okDesktop.config.initialDoc,getHash:()=>window.location.hash,setHash:e=>{window.location.hash=e}})}vp(),n(()=>import(`./telemetry-startup-Db44p95P.js`).then(e=>e.initStartupTrace()),__vite__mapDeps([183,0,1,2,3,4,67,22,12,11]),import.meta.url),f2({apiOrigin:typeof window<`u`?window.okDesktop?.config.apiOrigin:void 0}),C2(),TD()&&jD(),XR(),jE(),yL(),aL(),NF(),typeof window<`u`&&T2({bridge:window.okDesktop}),typeof window<`u`&&L2({bridge:window.okDesktop}),typeof window<`u`&&A2({bridge:window.okDesktop}),typeof window<`u`&&hp({bridge:window.okDesktop}),typeof window<`u`&&ml({bridge:window.okDesktop}),typeof window<`u`&&O2({bridge:window.okDesktop}),typeof window<`u`&&_p({bridge:window.okDesktop}),typeof window<`u`&&c2({bridge:window.okDesktop}),z2();var B2=new wp({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),V2=document.getElementById(`root`);if(!V2)throw Error(`Root element not found`);var H2=typeof window>`u`?void 0:window.okDesktop;function U2(){return ii(),null}(0,Tp.createRoot)(V2).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(ht,{i18n:vl,children:(0,Z.jsxs)(Et,{client:B2,children:[(0,Z.jsx)(sh,{}),(0,Z.jsxs)(It,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(U2,{}),(0,Z.jsxs)(on,{children:[(0,Z.jsx)(rh,{children:a2(H2)}),H2!==void 0&&(0,Z.jsx)(ah,{children:(0,Z.jsx)(l2,{bridge:H2})})]}),(0,Z.jsx)(u2,{richColors:!0,closeButton:!0})]})]})})}));export{xz as t};