@inkeep/open-knowledge 0.83.0-beta.0 → 0.83.0-beta.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 (111) hide show
  1. package/dist/cli.mjs +6 -6
  2. package/dist/constants-Dj1aO6V1.mjs +1 -0
  3. package/dist/{dist-DuSuuwp2.mjs → dist-BmqovPWv.mjs} +1 -1
  4. package/dist/dist-j8UC9eCg.mjs +2198 -0
  5. package/dist/index.d.mts +1 -0
  6. package/dist/index.mjs +151 -151
  7. package/dist/init-D6vQhciG.mjs +1 -0
  8. package/dist/{init-CqZCSqSE.mjs → init-nBaTGWyf.mjs} +2 -2
  9. package/dist/{launch-json-removal-DDiFEZzT.mjs → launch-json-removal-B3spADjQ.mjs} +1 -1
  10. package/dist/{loader-CPFJ3gAy.mjs → loader-CblQ62Qp.mjs} +1 -1
  11. package/dist/loader-DHWE3Hv_.mjs +1 -0
  12. package/dist/{open-browser-jE55xNly.mjs → open-browser-E29fOzP7.mjs} +1 -1
  13. package/dist/{preview-BAwhdZRD.mjs → preview-BYzewg9A.mjs} +1 -1
  14. package/dist/preview-CB-eYxpe.mjs +1 -0
  15. package/dist/public/assets/{AccountSection-DTTPxtuy.js → AccountSection-B-bqsYPK.js} +1 -1
  16. package/dist/public/assets/{ActivityModeContent-CQzz888N.js → ActivityModeContent-joTbkScK.js} +1 -1
  17. package/dist/public/assets/{AddPropertiesButton-sAtpD3bF.js → AddPropertiesButton-D15SZ_zp.js} +1 -1
  18. package/dist/public/assets/{AgentDiffPane-C5rwquce.js → AgentDiffPane-rGMiHMUo.js} +1 -1
  19. package/dist/public/assets/{AttachmentsSection-CwdNONkc.js → AttachmentsSection-DX9kJo2I.js} +1 -1
  20. package/dist/public/assets/{CodeMirrorPropInput-DNYs7K0K.js → CodeMirrorPropInput-BfwxKvly.js} +1 -1
  21. package/dist/public/assets/{ContentRulesSection-DuNQpths.js → ContentRulesSection-CqKGAdtt.js} +1 -1
  22. package/dist/public/assets/{DocumentContext-CDwWviYm.js → DocumentContext-BG9T5boS.js} +1 -1
  23. package/dist/public/assets/{EditorModeToggle-W5mm426e.js → EditorModeToggle-PZVTfBp_.js} +1 -1
  24. package/dist/public/assets/{ExcalidrawDocEditor-CW1j5GUX.js → ExcalidrawDocEditor-CwE94LwE.js} +1 -1
  25. package/dist/public/assets/FeedbackForm-RF8u9kZr.js +1 -0
  26. package/dist/public/assets/{ImportSkillDialog-DkTuvulO.js → ImportSkillDialog-BrUrj468.js} +1 -1
  27. package/dist/public/assets/{LinkPreviewsSection-BxmWF9rJ.js → LinkPreviewsSection-BmPL7k7A.js} +1 -1
  28. package/dist/public/assets/{LintConfigEditor-zLsWA0AF.js → LintConfigEditor-CGXy1IwU.js} +1 -1
  29. package/dist/public/assets/{LintingSection-BZWdGarX.js → LintingSection-mgls7rI3.js} +1 -1
  30. package/dist/public/assets/ManagedArtifactProperties-DQ_W4CjH.js +1 -0
  31. package/dist/public/assets/{ManagedArtifactProperties-ColnuPUV.js → ManagedArtifactProperties-DfCBNqB8.js} +1 -1
  32. package/dist/public/assets/{MermaidDocEditor-BwSa_Kj7.js → MermaidDocEditor-CQAo1xTu.js} +1 -1
  33. package/dist/public/assets/{NetworkAccessSection-DS-N7ydZ.js → NetworkAccessSection-CkwdMKO_.js} +1 -1
  34. package/dist/public/assets/{PropertyDisplayRow-DmCbpgtw.js → PropertyDisplayRow-DoVmTrfe.js} +1 -1
  35. package/dist/public/assets/{PublishToGitHubDialog-BjbUw2by.js → PublishToGitHubDialog-CrZeA0Jq.js} +1 -1
  36. package/dist/public/assets/{SchemaConfigEditor-Ds-Wwcpz.js → SchemaConfigEditor-gtdAlMxo.js} +1 -1
  37. package/dist/public/assets/{SearchSection-DWQPLLZH.js → SearchSection-Cw-gQhm8.js} +1 -1
  38. package/dist/public/assets/{SessionsHost-Dy_wH2Wz.js → SessionsHost-d06ohkYc.js} +2 -2
  39. package/dist/public/assets/{SettingsDialogBody-CEe2nLHS.js → SettingsDialogBody-B2_r1-Xz.js} +2 -2
  40. package/dist/public/assets/{ShareReceiveMissDialog-CSwgOlOM.js → ShareReceiveMissDialog-BFE0-dRf.js} +1 -1
  41. package/dist/public/assets/{SkillToolbarControls-DNsDkeEV.js → SkillToolbarControls-Bg81Iuhm.js} +1 -1
  42. package/dist/public/assets/{SourceEditor-BlbcJdBG.js → SourceEditor-BXKZxyzZ.js} +1 -1
  43. package/dist/public/assets/{SpellingSettings-CSLMKByF.js → SpellingSettings-Cmy-eBih.js} +1 -1
  44. package/dist/public/assets/{SyncSection-B-0xnMkA.js → SyncSection--IcOd-2H.js} +1 -1
  45. package/dist/public/assets/{SyncStatusBadge-CH-ZxZGx.js → SyncStatusBadge--7eG84FY.js} +1 -1
  46. package/dist/public/assets/{TerminalSection-CW6bVoDJ.js → TerminalSection-BB_ppeBp.js} +1 -1
  47. package/dist/public/assets/{TerminalWindowApp-Cgr90cUf.js → TerminalWindowApp-BHbHIVOT.js} +1 -1
  48. package/dist/public/assets/{TextDocEditor-YUi-Iplf.js → TextDocEditor-CB2ht0wX.js} +1 -1
  49. package/dist/public/assets/{ThemePluginSection-Q9Vltk4w.js → ThemePluginSection-B4oIayEG.js} +1 -1
  50. package/dist/public/assets/{ThreadView-5gjgK_DM.js → ThreadView-BYXADp3K.js} +1 -1
  51. package/dist/public/assets/{TimelineDiffPane-KqkBWswY.js → TimelineDiffPane-DFM3upzS.js} +1 -1
  52. package/dist/public/assets/{comment-chips-CXPOi5DO.js → comment-chips-0J_Zg9qS.js} +1 -1
  53. package/dist/public/assets/{config-provider-CA1b0otM.js → config-provider-8JEEDRxn.js} +1 -1
  54. package/dist/public/assets/config-schema-mXZFcyl-.js +1 -0
  55. package/dist/public/assets/{doc-undo-manager-KJDEezHH.js → doc-undo-manager-ufQiY5oJ.js} +1 -1
  56. package/dist/public/assets/{field-controls-Bm8W4dMo.js → field-controls-CFLl9l2A.js} +1 -1
  57. package/dist/public/assets/field-controls-k0sTXrth.js +1 -0
  58. package/dist/public/assets/{index-CggMAzzQ.js → index-BVAQ8i6T.js} +7 -7
  59. package/dist/public/assets/{lint-config-client-Dk5JUh5o.js → lint-config-client-DgV9TE2y.js} +1 -1
  60. package/dist/public/assets/{lint-plugins-D0OR2gqs.js → lint-plugins-BM1eliZQ.js} +1 -1
  61. package/dist/public/assets/{markdown-lint-BuIftP9_.js → markdown-lint-CfRH6CjV.js} +1 -1
  62. package/dist/public/assets/{markdownlint-rule-browser-C_XoUwYX.js → markdownlint-rule-browser-CN1TwJhU.js} +1 -1
  63. package/dist/public/assets/{messages-BN4BZRJF.js → messages-6qDi59f7.js} +1 -1
  64. package/dist/public/assets/{messages-D8MF6gQm.js → messages-BEvT9Nwy.js} +1 -1
  65. package/dist/public/assets/{messages-DXuxFgle.js → messages-BSK33k09.js} +1 -1
  66. package/dist/public/assets/{messages-C-u__l_6.js → messages-BWfEJjWl.js} +1 -1
  67. package/dist/public/assets/{messages-BwfMRpDZ.js → messages-BlGEL1N1.js} +1 -1
  68. package/dist/public/assets/{messages-CqZP9U4h.js → messages-Bq95Bcqm.js} +1 -1
  69. package/dist/public/assets/{messages-VQrT5xuZ.js → messages-BvpXmuCB.js} +1 -1
  70. package/dist/public/assets/{messages-CP3ZhE7d.js → messages-Cw5_--PV.js} +1 -1
  71. package/dist/public/assets/{messages-Dh4iAG8x.js → messages-D456hKdc.js} +1 -1
  72. package/dist/public/assets/{messages-cWliijXA.js → messages-F1g5PrYW.js} +1 -1
  73. package/dist/public/assets/{messages-CWh_KhcE.js → messages-_PYN_xve.js} +1 -1
  74. package/dist/public/assets/{messages-BwUT5OR_.js → messages-gEPZ_37y.js} +1 -1
  75. package/dist/public/assets/{messages-Dwjpql-D.js → messages-vtPav911.js} +1 -1
  76. package/dist/public/assets/{pending-receive-nav-store-Cl__M2P3.js → pending-receive-nav-store-AuAnZq4g.js} +1 -1
  77. package/dist/public/assets/{progress-CxYYQVJg.js → progress-eoaxQpMT.js} +1 -1
  78. package/dist/public/assets/{saved-themes-client-B-8W7FeI.js → saved-themes-client-D5M6AESh.js} +1 -1
  79. package/dist/public/assets/{schema-section-BsG4UYYw.js → schema-section-Cn4ovS7A.js} +1 -1
  80. package/dist/public/assets/{selection-context-zIbsZWBB.js → selection-context-sJ3MQq7D.js} +1 -1
  81. package/dist/public/assets/{src-CmVf3jdp.js → src-BlVPuoqO.js} +1 -1
  82. package/dist/public/assets/{typing-burst-detector-B5w8ea1t.js → typing-burst-detector-C86pw-B_.js} +1 -1
  83. package/dist/public/assets/{uninstall-CJslSGim.js → uninstall-D609kB1N.js} +1 -1
  84. package/dist/public/assets/{use-activity-panel-njYj0Tyg.js → use-activity-panel-D5aw7p5z.js} +1 -1
  85. package/dist/public/assets/{use-apply-config-language-CJ2P6ZVJ.js → use-apply-config-language-C0m8OLaJ.js} +2 -2
  86. package/dist/public/assets/{use-open-skill-BJ1g1TS4.js → use-open-skill-DqDfKtqH.js} +1 -1
  87. package/dist/public/assets/{use-terminal-enabled-oZoJIl77.js → use-terminal-enabled-ChWTZfeQ.js} +1 -1
  88. package/dist/public/assets/{use-timeline-entry-diff-CRdNlwgo.js → use-timeline-entry-diff-s3XJ-kUg.js} +1 -1
  89. package/dist/public/index.html +21 -21
  90. package/dist/public/uninstall.html +3 -3
  91. package/dist/{registry-probes-CVmTuwTM.mjs → registry-probes-DIE9SSCw.mjs} +1 -1
  92. package/dist/{removal-file-path-CafpWVK1.mjs → removal-file-path-BAGEEZWh.mjs} +1 -1
  93. package/dist/{repair-launch-json-B-oLifL4.mjs → repair-launch-json-C9Pi_kdK.mjs} +1 -1
  94. package/dist/{repair-mcp-configs-r-u0zoxa.mjs → repair-mcp-configs-3_7Mmn4A.mjs} +1 -1
  95. package/dist/src-BeiRzoUx.mjs +11 -0
  96. package/dist/src-BqHK7cGN.mjs +1 -0
  97. package/dist/{start-CXXmiZzG.mjs → start-CGJpP_jf.mjs} +3 -3
  98. package/dist/start-j8WJ0aKa.mjs +1 -0
  99. package/package.json +4 -4
  100. package/dist/constants-BdXcb6Bw.mjs +0 -1
  101. package/dist/dist-BrWQNlOF.mjs +0 -2198
  102. package/dist/init-BiW8e7og.mjs +0 -1
  103. package/dist/loader-C85uUKY0.mjs +0 -1
  104. package/dist/preview-zjjyvE88.mjs +0 -1
  105. package/dist/public/assets/FeedbackForm-DXTFUuAS.js +0 -1
  106. package/dist/public/assets/ManagedArtifactProperties-C5jRvpCl.js +0 -1
  107. package/dist/public/assets/config-schema-CxzfSS_F.js +0 -1
  108. package/dist/public/assets/field-controls-mmRmxoOm.js +0 -1
  109. package/dist/src-BSB1PzG_.mjs +0 -11
  110. package/dist/src-X1r8XjDm.mjs +0 -1
  111. package/dist/start-CuO6Lul6.mjs +0 -1
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{a as i,i as a,n as o,o as s,r as c}from"./pending-receive-nav-store-Cl__M2P3.js";import{t as l}from"./miss-dialog-store-CsiJb9Ou.js";import{c as u,i as d,n as f,s as p,t as m}from"./dialog-BJEjKJjL.js";import{l as h,u as g}from"./doc-hash-BJkweiX9.js";var _=r(),v=e(n(),1),y=t();function b(e){let t=e.split(`/`).filter(Boolean);return t.length>0?t[t.length-1]:e}function x(){let e=(0,_.c)(2),t=(0,v.useSyncExternalStore)(l.subscribe,l.getSnapshot,S);if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=(0,y.jsx)(C,{nav:t},t.path),e[0]=t,e[1]=n),n}function S(){return null}function C(e){let t=(0,_.c)(28),{nav:n}=e,{state:r,refetch:v}=s(n),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=function(){l.dismiss()},t[0]=x):x=t[0];let S=x,C;t[1]===n.path?C=t[2]:(C=function(){window.location.hash=g(i(n.path)),S()},t[1]=n.path,t[2]=C);let w=C,T;t[3]===n?T=t[4]:(T=function(e){c.arm(o(n,e)),window.location.hash=n.kind===`folder`?g(e):h(e),S()},t[3]=n,t[4]=T);let E=T,D;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>{e||S()},t[5]=D):D=t[5];let O=r.phase,k=r.phase===`resolved`?r.resolution.verdict:void 0,A;t[6]===n.path?A=t[7]:(A=b(n.path),t[6]=n.path,t[7]=A);let j;t[8]===A?j=t[9]:(j=(0,y.jsx)(p,{children:(0,y.jsx)(u,{className:`truncate`,children:A})}),t[8]=A,t[9]=j);let M=r.phase===`pending`?`flex flex-col items-center justify-center gap-3 py-6 text-center text-sm text-muted-foreground`:`flex flex-col items-center justify-center gap-6 py-2 text-center`,N;t[10]!==n.path||t[11]!==E?(N=()=>E(n.path),t[10]=n.path,t[11]=E,t[12]=N):N=t[12];let P;t[13]!==w||t[14]!==n||t[15]!==E||t[16]!==v||t[17]!==r||t[18]!==N?(P=(0,y.jsx)(a,{nav:n,state:r,onBrowseFolder:w,onOpenRenamed:E,onEnableAutoSync:S,onSyncCompleted:v,onPullApplied:N}),t[13]=w,t[14]=n,t[15]=E,t[16]=v,t[17]=r,t[18]=N,t[19]=P):P=t[19];let F;t[20]!==P||t[21]!==M?(F=(0,y.jsx)(f,{className:M,children:P}),t[20]=P,t[21]=M,t[22]=F):F=t[22];let I;return t[23]!==r.phase||t[24]!==F||t[25]!==k||t[26]!==j?(I=(0,y.jsx)(m,{open:!0,onOpenChange:D,children:(0,y.jsxs)(d,{className:`sm:max-w-md`,"data-testid":`share-receive-miss-dialog`,"data-phase":O,"data-verdict":k,children:[j,F]})}),t[23]=r.phase,t[24]=F,t[25]=k,t[26]=j,t[27]=I):I=t[27],I}export{x as ShareReceiveMissDialog};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{a as i,i as a,n as o,o as s,r as c}from"./pending-receive-nav-store-AuAnZq4g.js";import{t as l}from"./miss-dialog-store-CsiJb9Ou.js";import{c as u,i as d,n as f,s as p,t as m}from"./dialog-BJEjKJjL.js";import{l as h,u as g}from"./doc-hash-BJkweiX9.js";var _=r(),v=e(n(),1),y=t();function b(e){let t=e.split(`/`).filter(Boolean);return t.length>0?t[t.length-1]:e}function x(){let e=(0,_.c)(2),t=(0,v.useSyncExternalStore)(l.subscribe,l.getSnapshot,S);if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=(0,y.jsx)(C,{nav:t},t.path),e[0]=t,e[1]=n),n}function S(){return null}function C(e){let t=(0,_.c)(28),{nav:n}=e,{state:r,refetch:v}=s(n),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=function(){l.dismiss()},t[0]=x):x=t[0];let S=x,C;t[1]===n.path?C=t[2]:(C=function(){window.location.hash=g(i(n.path)),S()},t[1]=n.path,t[2]=C);let w=C,T;t[3]===n?T=t[4]:(T=function(e){c.arm(o(n,e)),window.location.hash=n.kind===`folder`?g(e):h(e),S()},t[3]=n,t[4]=T);let E=T,D;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>{e||S()},t[5]=D):D=t[5];let O=r.phase,k=r.phase===`resolved`?r.resolution.verdict:void 0,A;t[6]===n.path?A=t[7]:(A=b(n.path),t[6]=n.path,t[7]=A);let j;t[8]===A?j=t[9]:(j=(0,y.jsx)(p,{children:(0,y.jsx)(u,{className:`truncate`,children:A})}),t[8]=A,t[9]=j);let M=r.phase===`pending`?`flex flex-col items-center justify-center gap-3 py-6 text-center text-sm text-muted-foreground`:`flex flex-col items-center justify-center gap-6 py-2 text-center`,N;t[10]!==n.path||t[11]!==E?(N=()=>E(n.path),t[10]=n.path,t[11]=E,t[12]=N):N=t[12];let P;t[13]!==w||t[14]!==n||t[15]!==E||t[16]!==v||t[17]!==r||t[18]!==N?(P=(0,y.jsx)(a,{nav:n,state:r,onBrowseFolder:w,onOpenRenamed:E,onEnableAutoSync:S,onSyncCompleted:v,onPullApplied:N}),t[13]=w,t[14]=n,t[15]=E,t[16]=v,t[17]=r,t[18]=N,t[19]=P):P=t[19];let F;t[20]!==P||t[21]!==M?(F=(0,y.jsx)(f,{className:M,children:P}),t[20]=P,t[21]=M,t[22]=F):F=t[22];let I;return t[23]!==r.phase||t[24]!==F||t[25]!==k||t[26]!==j?(I=(0,y.jsx)(m,{open:!0,onOpenChange:D,children:(0,y.jsxs)(d,{className:`sm:max-w-md`,"data-testid":`share-receive-miss-dialog`,"data-phase":O,"data-verdict":k,children:[j,F]})}),t[23]=r.phase,t[24]=F,t[25]=k,t[26]=j,t[27]=I):I=t[27],I}export{x as ShareReceiveMissDialog};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{a as s,i as c,n as l,o as u,r as d,s as f,t as p}from"./select-Bu4Wm3Rf.js";import{t as m}from"./button-DzgjsZzC.js";import{l as h,n as g,r as _,t as v}from"./AddPropertiesButton-sAtpD3bF.js";import{a as y,h as b,r as x,t as S,u as C}from"./dropdown-menu-DtLu9NwU.js";import{n as w}from"./file-plus-DKxOZh2k.js";import{t as T}from"./list-plus-CYMJBvrm.js";import{p as E,t as D}from"./skill-scope-CxuIje2Y.js";var O=a(),k=t();function A(e){let t=(0,O.c)(21),{value:n,onRequestMove:a,disabled:m,triggerClassName:h}=e,{_:g}=i(),_=E(),v;t[0]===a?v=t[1]:(v=e=>a(e),t[0]=a,t[1]=v);let y;t[2]===g?y=t[3]:(y=g({id:`oCHfGC`}),t[2]=g,t[3]=y);let b;t[4]===h?b=t[5]:(b=o(`w-auto gap-1 text-xs font-mono uppercase`,h),t[4]=h,t[5]=b);let x;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,k.jsx)(f,{}),t[6]=x):x=t[6];let S;t[7]!==y||t[8]!==b?(S=(0,k.jsx)(u,{size:`sm`,"aria-label":y,"data-testid":`skill-level-select`,className:b,children:x}),t[7]=y,t[8]=b,t[9]=S):S=t[9];let C;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,k.jsx)(s,{children:(0,k.jsx)(r,{id:`oCHfGC`})}),t[10]=C):C=t[10];let w;t[11]===_?w=t[12]:(w=D.map(e=>(0,k.jsx)(c,{value:e,children:_[e]},e)),t[11]=_,t[12]=w);let T;t[13]===w?T=t[14]:(T=(0,k.jsx)(l,{align:`end`,children:(0,k.jsxs)(d,{children:[C,w]})}),t[13]=w,t[14]=T);let A;return t[15]!==m||t[16]!==v||t[17]!==S||t[18]!==T||t[19]!==n?(A=(0,k.jsxs)(p,{value:n,onValueChange:v,disabled:m,children:[S,T]}),t[15]=m,t[16]=v,t[17]=S,t[18]=T,t[19]=n,t[20]=A):A=t[20],A}var j=e(n(),1);function M(e){let t=(0,O.c)(12),{scope:n,name:r}=e,[i,a]=(0,j.useState)(null),o;t[0]===n?o=t[1]:(o=e=>{e!==n&&a(e)},t[0]=n,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==n?(s=i?{scope:n,name:r,toScope:i}:null,t[2]=r,t[3]=i,t[4]=n,t[5]=s):s=t[5];let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=e=>!e&&a(null),t[6]=c):c=t[6];let l;t[7]===s?l=t[8]:(l=(0,k.jsx)(h,{target:s,onOpenChange:c}),t[7]=s,t[8]=l);let u;return t[9]!==o||t[10]!==l?(u={requestMove:o,dialog:l},t[9]=o,t[10]=l,t[11]=u):u=t[11],u}function N(e){let t=(0,O.c)(41),{scope:n,name:a,showAddPropertyButton:o,onAddProperty:s,problemCount:c,problemMessages:l}=e,{_:u}=i(),d;t[0]!==a||t[1]!==n?(d={scope:n,name:a},t[0]=a,t[1]=n,t[2]=d):d=t[2];let f=M(d),p;t[3]!==f.requestMove||t[4]!==n?(p=(0,k.jsx)(A,{value:n,onRequestMove:f.requestMove,triggerClassName:`hidden @xl/toolbar:flex`}),t[3]=f.requestMove,t[4]=n,t[5]=p):p=t[5];let h;t[6]!==a||t[7]!==n?(h=(0,k.jsx)(_,{scope:n,name:a}),t[6]=a,t[7]=n,t[8]=h):h=t[8];let E;t[9]!==p||t[10]!==h?(E=(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[p,h]}),t[9]=p,t[10]=h,t[11]=E):E=t[11];let D;t[12]!==s||t[13]!==c||t[14]!==l||t[15]!==o?(D=o?(0,k.jsx)(v,{onAddProperty:s,problemCount:c,problemMessages:l,className:`hidden @xl/toolbar:inline-flex`}):null,t[12]=s,t[13]=c,t[14]=l,t[15]=o,t[16]=D):D=t[16];let j;t[17]===u?j=t[18]:(j=u({id:`Yzs3QX`}),t[17]=u,t[18]=j);let N;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,k.jsx)(w,{className:`size-4`,"aria-hidden":!0}),t[19]=N):N=t[19];let P;t[20]===j?P=t[21]:(P=(0,k.jsx)(b,{asChild:!0,children:(0,k.jsx)(m,{variant:`ghost`,size:`icon`,"aria-label":j,"data-testid":`skill-toolbar-overflow`,className:`@xl/toolbar:hidden`,children:N})}),t[20]=j,t[21]=P);let F;t[22]===f?F=t[23]:(F=e=>f.requestMove(e),t[22]=f,t[23]=F);let I;t[24]!==n||t[25]!==F?(I=(0,k.jsx)(g,{value:n,onSelect:F}),t[24]=n,t[25]=F,t[26]=I):I=t[26];let L;t[27]!==s||t[28]!==o?(L=o?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(C,{}),(0,k.jsxs)(y,{onSelect:s,children:[(0,k.jsx)(T,{}),(0,k.jsx)(r,{id:`81H_23`})]})]}):null,t[27]=s,t[28]=o,t[29]=L):L=t[29];let R;t[30]!==I||t[31]!==L?(R=(0,k.jsxs)(x,{align:`end`,className:`min-w-44`,children:[I,L]}),t[30]=I,t[31]=L,t[32]=R):R=t[32];let z;t[33]!==R||t[34]!==P?(z=(0,k.jsxs)(S,{children:[P,R]}),t[33]=R,t[34]=P,t[35]=z):z=t[35];let B;return t[36]!==f.dialog||t[37]!==z||t[38]!==E||t[39]!==D?(B=(0,k.jsxs)(k.Fragment,{children:[E,D,z,f.dialog]}),t[36]=f.dialog,t[37]=z,t[38]=E,t[39]=D,t[40]=B):B=t[40],B}export{N as SkillToolbarControls};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{a as s,i as c,n as l,o as u,r as d,s as f,t as p}from"./select-Bu4Wm3Rf.js";import{t as m}from"./button-DzgjsZzC.js";import{l as h,n as g,r as _,t as v}from"./AddPropertiesButton-D15SZ_zp.js";import{a as y,h as b,r as x,t as S,u as C}from"./dropdown-menu-DtLu9NwU.js";import{n as w}from"./file-plus-DKxOZh2k.js";import{t as T}from"./list-plus-CYMJBvrm.js";import{p as E,t as D}from"./skill-scope-CxuIje2Y.js";var O=a(),k=t();function A(e){let t=(0,O.c)(21),{value:n,onRequestMove:a,disabled:m,triggerClassName:h}=e,{_:g}=i(),_=E(),v;t[0]===a?v=t[1]:(v=e=>a(e),t[0]=a,t[1]=v);let y;t[2]===g?y=t[3]:(y=g({id:`oCHfGC`}),t[2]=g,t[3]=y);let b;t[4]===h?b=t[5]:(b=o(`w-auto gap-1 text-xs font-mono uppercase`,h),t[4]=h,t[5]=b);let x;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,k.jsx)(f,{}),t[6]=x):x=t[6];let S;t[7]!==y||t[8]!==b?(S=(0,k.jsx)(u,{size:`sm`,"aria-label":y,"data-testid":`skill-level-select`,className:b,children:x}),t[7]=y,t[8]=b,t[9]=S):S=t[9];let C;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,k.jsx)(s,{children:(0,k.jsx)(r,{id:`oCHfGC`})}),t[10]=C):C=t[10];let w;t[11]===_?w=t[12]:(w=D.map(e=>(0,k.jsx)(c,{value:e,children:_[e]},e)),t[11]=_,t[12]=w);let T;t[13]===w?T=t[14]:(T=(0,k.jsx)(l,{align:`end`,children:(0,k.jsxs)(d,{children:[C,w]})}),t[13]=w,t[14]=T);let A;return t[15]!==m||t[16]!==v||t[17]!==S||t[18]!==T||t[19]!==n?(A=(0,k.jsxs)(p,{value:n,onValueChange:v,disabled:m,children:[S,T]}),t[15]=m,t[16]=v,t[17]=S,t[18]=T,t[19]=n,t[20]=A):A=t[20],A}var j=e(n(),1);function M(e){let t=(0,O.c)(12),{scope:n,name:r}=e,[i,a]=(0,j.useState)(null),o;t[0]===n?o=t[1]:(o=e=>{e!==n&&a(e)},t[0]=n,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==n?(s=i?{scope:n,name:r,toScope:i}:null,t[2]=r,t[3]=i,t[4]=n,t[5]=s):s=t[5];let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=e=>!e&&a(null),t[6]=c):c=t[6];let l;t[7]===s?l=t[8]:(l=(0,k.jsx)(h,{target:s,onOpenChange:c}),t[7]=s,t[8]=l);let u;return t[9]!==o||t[10]!==l?(u={requestMove:o,dialog:l},t[9]=o,t[10]=l,t[11]=u):u=t[11],u}function N(e){let t=(0,O.c)(41),{scope:n,name:a,showAddPropertyButton:o,onAddProperty:s,problemCount:c,problemMessages:l}=e,{_:u}=i(),d;t[0]!==a||t[1]!==n?(d={scope:n,name:a},t[0]=a,t[1]=n,t[2]=d):d=t[2];let f=M(d),p;t[3]!==f.requestMove||t[4]!==n?(p=(0,k.jsx)(A,{value:n,onRequestMove:f.requestMove,triggerClassName:`hidden @xl/toolbar:flex`}),t[3]=f.requestMove,t[4]=n,t[5]=p):p=t[5];let h;t[6]!==a||t[7]!==n?(h=(0,k.jsx)(_,{scope:n,name:a}),t[6]=a,t[7]=n,t[8]=h):h=t[8];let E;t[9]!==p||t[10]!==h?(E=(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[p,h]}),t[9]=p,t[10]=h,t[11]=E):E=t[11];let D;t[12]!==s||t[13]!==c||t[14]!==l||t[15]!==o?(D=o?(0,k.jsx)(v,{onAddProperty:s,problemCount:c,problemMessages:l,className:`hidden @xl/toolbar:inline-flex`}):null,t[12]=s,t[13]=c,t[14]=l,t[15]=o,t[16]=D):D=t[16];let j;t[17]===u?j=t[18]:(j=u({id:`Yzs3QX`}),t[17]=u,t[18]=j);let N;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,k.jsx)(w,{className:`size-4`,"aria-hidden":!0}),t[19]=N):N=t[19];let P;t[20]===j?P=t[21]:(P=(0,k.jsx)(b,{asChild:!0,children:(0,k.jsx)(m,{variant:`ghost`,size:`icon`,"aria-label":j,"data-testid":`skill-toolbar-overflow`,className:`@xl/toolbar:hidden`,children:N})}),t[20]=j,t[21]=P);let F;t[22]===f?F=t[23]:(F=e=>f.requestMove(e),t[22]=f,t[23]=F);let I;t[24]!==n||t[25]!==F?(I=(0,k.jsx)(g,{value:n,onSelect:F}),t[24]=n,t[25]=F,t[26]=I):I=t[26];let L;t[27]!==s||t[28]!==o?(L=o?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(C,{}),(0,k.jsxs)(y,{onSelect:s,children:[(0,k.jsx)(T,{}),(0,k.jsx)(r,{id:`81H_23`})]})]}):null,t[27]=s,t[28]=o,t[29]=L):L=t[29];let R;t[30]!==I||t[31]!==L?(R=(0,k.jsxs)(x,{align:`end`,className:`min-w-44`,children:[I,L]}),t[30]=I,t[31]=L,t[32]=R):R=t[32];let z;t[33]!==R||t[34]!==P?(z=(0,k.jsxs)(S,{children:[P,R]}),t[33]=R,t[34]=P,t[35]=z):z=t[35];let B;return t[36]!==f.dialog||t[37]!==z||t[38]!==E||t[39]!==D?(B=(0,k.jsxs)(k.Fragment,{children:[E,D,z,f.dialog]}),t[36]=f.dialog,t[37]=z,t[38]=E,t[39]=D,t[40]=B):B=t[40],B}export{N as SkillToolbarControls};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{An as n,Dt as r,Fn as i,Gt as a,Ot as o,St as s,Ut as c,Y as l,_t as u,cn as d,ht as f,ln as p,vt as m}from"./DocumentContext-CDwWviYm.js";import{t as h}from"./react-f2sANaYj.js";import{n as g}from"./dist-PQ5KMVDh.js";import{t as _}from"./compiler-runtime-BfE3aGVn.js";import{ht as v}from"./schemas-api-KjBzkxAy.js";import{i as y}from"./use-apply-config-theme-CYFG76sS.js";import{H as ee,I as b,L as te,N as ne,T as re,b as ie,c as ae,n as oe,o as x,r as se,t as ce,v as S,w as le,z as ue}from"./typing-burst-detector-B5w8ea1t.js";import{Hn as de,S as C,U as w,Wn as T,a as fe,i as pe,it as E,o as me,ot as D}from"./CodeMirrorPropInput-DNYs7K0K.js";import{a as O,i as k}from"./constants-skills-BLHVRW90.js";import{t as he}from"./diagnostic-breadcrumb-Cr0C15nJ.js";import{n as A}from"./perf-DZJpLc5j.js";import{f as ge}from"./config-provider-CA1b0otM.js";import{$ as j,At as M,Ct as N,E as P,J as F,K as I,Mt as L,N as R,Nt as z,Tt as _e,X as B,at as V,b as H,et as U,ft as ve,g as W,l as G,lt as K,ot as q,pt as J,st as Y,tt as X,ut as Z,v as ye,wt as be}from"./dist-D2SphF3p.js";import{i as xe,t as Se}from"./dist-DseqKdAU.js";import{i as Ce,n as we,o as Te,r as Ee}from"./dist-DKYEqMZn.js";import{o as De,r as Oe}from"./selection-context-zIbsZWBB.js";import{C as ke,D as Ae,t as je}from"./markdown-lint-BuIftP9_.js";import{l as Me}from"./lint-config-client-Dk5JUh5o.js";import{a as Ne,i as Pe,n as Fe,o as Ie,r as Le,s as Re,t as ze}from"./dist-CzJghaXH.js";import{n as Be,t as Ve}from"./src-CmVf3jdp.js";var Q=e(h(),1),He=_();function Ue(){let e=r();return e===null?null:new Set(e.keys())}function We(e,t,n){let r=[],i=R(e);if(n!=null){let a=[];for(let{from:e,to:n}of t)i.iterate({from:e,to:n,enter(e){if(e.name===`InlineCode`||e.name===`FencedCode`)return a.push({from:e.from,to:e.to}),!1}});let o=(e,t)=>a.some(n=>e>=n.from&&t<=n.to);for(let{from:i,to:a}of t){let t=e.doc.sliceString(i,a);k.lastIndex=0;for(let e=k.exec(t);e!==null;e=k.exec(t)){let t=e[2];if(!O(t))continue;let a=i+(e.index??0)+e[1].length,s=a+t.length+1;o(a,s)||r.push(I.mark({class:n.has(t)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":t}}).range(a,s))}}}for(let{from:a,to:o}of t)i.iterate({from:a,to:o,enter(t){if(t.name!==`InlineCode`)return;let i=e.doc.sliceString(t.from,t.to),a=i.length-i.replace(/^`+/,``).length,o=i.length-i.replace(/`+$/,``).length,s=i.slice(a,i.length-o),c=/^\/([a-z0-9][a-z0-9-]{1,63})$/.exec(s)?.[1];if(c!==void 0&&O(c)&&n!=null)return r.push(I.mark({class:n.has(c)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":c}}).range(t.from+a,t.to-o)),!1;let l=f.exec(s);if(l)return r.push(I.mark({class:`cm-skill-path-link`,attributes:{"data-skill-path":l[1]}}).range(t.from+a,t.to-o)),!1}});return r.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),I.set(r)}function Ge(e){let t=m(e);return t===null?[]:[B.fromClass(class{decorations;constructor(e){this.decorations=We(e.state,e.visibleRanges,Ue())}update(e){(e.docChanged||e.viewportChanged||R(e.startState)!==R(e.state))&&(this.decorations=We(e.view.state,e.view.visibleRanges,Ue()))}},{decorations:e=>e.decorations}),F.domEventHandlers({mousedown(n){let i=n.target?.closest?.(`[data-skill-ref]`),a=i instanceof HTMLElement?i.dataset.skillRef:void 0;if(a!==void 0){n.preventDefault();let e=r()?.get(a);return e===void 0?s():window.location.hash=o(a,e),!0}let c=n.target?.closest?.(`.cm-skill-path-link`),l=c instanceof HTMLElement?c.dataset.skillPath:void 0;return l===void 0?!1:(n.preventDefault(),window.location.hash=u(t,e,l),!0)}})]}var Ke=I.line({attributes:{dir:`auto`}});function qe(e){let t=new M;for(let n of e.visibleRanges)for(let r=n.from;r<=n.to;){let n=e.state.doc.lineAt(r);t.add(n.from,n.from,Ke),r=n.to+1}return t.finish()}var Je=B.fromClass(class{decorations;constructor(e){this.decorations=qe(e)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=qe(e.view))}},{decorations:e=>e.decorations}),Ye=[F.perLineTextDirection.of(!0),Je],Xe=new Set([`Link`,`Image`,`HTMLTag`,`HTMLBlock`]),Ze=`cm-lint-local-target`;function Qe(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function $e(e,t){let n=W(e,t+1,100);if(n){let e=n.resolveInner(t,1);for(;e;){if(Xe.has(e.name))return{from:e.from,to:e.to};e=e.parent}}return{from:t,to:t}}function et(e){return e===`error`?`error`:e===`info`?`info`:`warning`}function tt(e,t){let n=e.doc,r=[];for(let i of t){if(i.source!==`links`)continue;let t=$e(e,Qe(n,i.range.start));r.push({from:t.from,to:Math.max(t.to,t.from),severity:et(i.severity),message:ie(i),source:`${i.source}/${i.code}`,markClass:Ze})}return r}var nt=L.define();function rt(e){let t={findings:[]};return[Pe(e=>E()?tt(e.state,t.findings):[],{delay:300,needsRefresh:e=>e.transactions.some(e=>e.effects.some(e=>e.is(nt)))}),B.define(n=>{let r=e=>{t.findings=e,n.dispatch({effects:nt.of(null)}),ze(n)},i=S(e,e=>{e.status===`loaded`&&r(e.findings)}),a=D(()=>r(t.findings));return{destroy(){i(),a()}}})]}function it(e,t){return e.enabled?[Fe(),Pe(async n=>at(n.state.doc,await ke(n.state.doc.toString(),e,t)),{delay:600})]:[]}function $(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function at(e,t){let n=[];for(let r of t){let t=$(e,r.range.start),i=$(e,r.range.end),a={from:t,to:Math.max(i,t),severity:r.severity,message:r.message,source:`${r.source}/${r.code}`},o=ot(r);o&&(a.actions=[o]),n.push(a)}return n}function ot(e){let t=e.fixes;return!t||t.length===0?null:{name:`Fix`,apply(e){let n=e.state.doc;e.dispatch({changes:t.map(e=>({from:$(n,e.range.start),to:$(n,e.range.end),insert:e.newText})),userEvent:`input.complete`})}}}var st=[Z(),q(),Y(),ye(),U(),X(),_e.allowMultipleSelections.of(!0),P(),G(),Ee(),we(),J(),j(),V(),Ne(),K.of([...Ce,...Se,...Re,...H,...Te,...Le])],ct=I.mark({class:`cm-link-ref-broken`}),lt=/^\s{0,3}\[([^\]]+)\]:\s/,ut=/\[([^\]]*)\]\[([^\]]*)\]/g,dt=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function ft(e,t){let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i];if(e<a.from)r=i-1;else if(e>=a.to)n=i+1;else return!0}return!1}function pt(e){let t=[];return R(e).iterate({enter(e){if(dt.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function mt(e){let t=new Set,n=[],r=e.doc,i=pt(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(ft(n.from,i))continue;let a=lt.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!ft(t.from,i)&&!lt.test(t.text))for(ut.lastIndex=0;;){let e=ut.exec(t.text);if(!e)break;let r=t.from+e.index;if(ft(r,i))continue;let a=e[2]||e[1];n.push({from:r,to:r+e[0].length,label:a.toLowerCase()})}}let a=[];for(let e of n)t.has(e.label)||a.push(ct.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),I.set(a)}var ht=z.define({create(e){return mt(e)},update(e,t){return t.docChanged?mt(t.state):e},provide:e=>F.decorations.from(e)}),gt=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,_t=I.mark({class:`cm-del`}),vt=I.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),yt=I.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function bt(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function xt(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!v.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(v.test(r.text))return{from:t.from,to:r.to}}return null}function St(e,t){let n=[],r=R(e),i=xt(e),a=e=>i!==null&&e>=i.from&&e<=i.to;for(let{from:i,to:o}of t)r.iterate({from:i,to:o,enter(t){if(!a(t.from)){if(t.name===`Strikethrough`){let e=t.from,r=t.to,i=t.node.cursor();if(i.firstChild())do i.name===`StrikethroughMark`&&(i.from===t.from?e=i.to:r=i.from);while(i.nextSibling());return e<r&&n.push(_t.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=gt.exec(r.text),a=i?i[1].length:2,o=I.line({class:`cm-list-item`,attributes:{style:`--list-hang: ${a}ch`}});n.push(o.range(r.from));return}if(t.name===`FencedCode`){let r=e.doc.lineAt(t.from),i=e.doc.lineAt(t.to);for(let t=r.number+1;t<i.number;t++){let r=e.doc.line(t),i=bt(r.text),a=I.line({class:`cm-fenced-code-line`,attributes:{style:`--line-indent: ${i}`}});n.push(a.range(r.from))}return!1}if(t.name===`TableHeader`){let r=e.doc.lineAt(t.from);return n.push(vt.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(yt.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(yt.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),I.set(n)}var Ct=class{decorations;constructor(e){this.decorations=St(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||R(e.startState)!==R(e.state))&&(this.decorations=St(e.view.state,e.view.visibleRanges))}},wt=B.fromClass(Ct,{decorations:e=>e.decorations});function Tt(){return[wt,ht]}function Et(e,t){let n=e.trackedOrigins;return n.has(t)?!0:t?n.has(t.constructor):!1}function Dt(e){let{docName:t,ytext:n,undoManager:r}=e,i=!1,a=!1,o=!1,s=(e,t)=>{i||Et(r,t.origin)||(a=!0)};return n.observe(s),{setSourceModeActive(e){if(!o&&e!==i){if(!e){i=!1,r.stopCapturing();return}a&&(r.clear(),A(`ok/source-undo/flip-clear`,{docName:t})),a=!1,i=!0}},destroy(){o||(o=!0,n.unobserve(s))}}}var Ot=new WeakMap;function kt(e){return B.define(t=>{let n=Dt(e);return Ot.set(t,n),{destroy(){n.destroy()}}})}function At(e,t){let n=Ot.get(e);if(!n)throw Error(`createSourceUndoFlipExtension is not installed on this EditorView`);n.setSourceModeActive(t)}var jt=t(),Mt=L.define();function Nt(e,t){try{At(t.view,!1)}finally{try{p(t)}finally{T(e,t.view)}}}function Pt(e,t,n){let r=x(e.state.doc),a=r[t.index],o={docName:n,mode:`source`,index:t.index,sourceHeadingCount:r.length};if(!a){he(oe,{...o,outcome:`no-target`});return}let s=i(n,`outline`,()=>{e.dispatch({selection:be.cursor(a.from),effects:F.scrollIntoView(a.from,{y:`start`})}),e.focus()});he(oe,{...o,outcome:s?`scrolled`:`declined`,targetLine:e.state.doc.lineAt(a.from).number})}function Ft(e,t,n,r){requestAnimationFrame(()=>{if(!n())return;let a=e.state.doc,o=Math.min(t.offset,a.length);i(r,`raw-mdx`,()=>{e.dispatch({selection:be.cursor(o),effects:F.scrollIntoView(o,{y:`center`})}),e.focus()})})}function It(e,t,n){let r=e.state.doc,a=Math.min(Math.max(t.line,1),r.lines),o=r.line(a),s=Math.min(o.from+Math.max(0,t.column-1),o.to);return i(n,`problems-row`,()=>{e.dispatch({selection:be.cursor(s),effects:F.scrollIntoView(s,{y:`start`})}),e.focus()})}function Lt(e){let t=(0,He.c)(51),{docName:r,ytext:i,provider:o,placeholder:s,isSourceModeActive:u}=e,f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),[m,h]=(0,Q.useState)(null);if(m)throw m;let{resolvedTheme:_}=g(),{merged:v}=y(),ie=(0,Q.useRef)(u),x=v?.editor?.wordWrap??!0,{data:S}=Me(r),C;t[0]!==S?.effective||t[1]!==v?(C=S?.effective??(v?.contentRules?Ae(v.contentRules):je),t[0]=S?.effective,t[1]=v,t[2]=C):C=t[2];let w=C,T;t[3]===w?T=t[4]:(T=JSON.stringify(w),t[3]=w,t[4]=T);let E=T,D=(0,Q.useRef)(null),O;t[5]!==r||t[6]!==u||t[7]!==w||t[8]!==s||t[9]!==o||t[10]!==_||t[11]!==x||t[12]!==i?(O=()=>{let e=f.current;if(!e)return;let t=o.configuration.name??``,m,g=zt;try{m=d({docName:t,container:e,sizeStats:{viewCount:0,bytes:i.length},factory:e=>{let u=null,d=new ge(i);try{let f=l({ydoc:o.document,ytext:i,docName:t}),p=new N,m=new N,h=new N,v=new N,y=new F({state:_e.create({doc:i.toString(),extensions:[st,Ye,Ie({scrollToMatch:e=>n(t,`find-match`)?F.scrollIntoView(e,{y:`start`}):Mt.of(null)}),K.of([xe]),Ve(i,o.awareness,{undoManager:d}),K.of(Be),kt({docName:t,ytext:i,undoManager:d}),...pe({themeCompartment:p,resolvedTheme:_,ydoc:o.document,wordWrapCompartment:m,wordWrap:x,currentDocName:t}),Tt(),Ge(t),ee(),v.of(it(w,r)),rt(r),f,F.updateListener.of(e=>{c(e)&&a(t)}),F.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(u!==null&&clearTimeout(u),u=setTimeout(()=>{u=null,le(t,`source`,re(e.view)),Oe(t,`source`,De(e.view,t))},120))}),h.of(ve(s??``)),F.theme({"&":{height:`100%`}}),F.scrollMargins.of(Rt)]}),parent:e});le(t,`source`,re(y)),Oe(t,`source`,De(y,t));let b=y.contentDOM;return b.addEventListener(`keydown`,g),b.addEventListener(`paste`,g),b.addEventListener(`drop`,g),b.addEventListener(`cut`,g),{view:y,ydoc:o.document,ytext:i,provider:o,undoManager:d,themeCompartment:p,wordWrapCompartment:m,placeholderCompartment:h,lintCompartment:v}}catch(e){let t=e;throw d.destroy(),t}}}),D.current=m,p.current=m.view,At(m.view,u),de(r,m.view,`sourceEditor`),ce()&&m.view.focus()}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),D.current=null,p.current=null,h(t instanceof Error?t:Error(String(t)))}return()=>{let e=D.current;D.current=null,p.current=null,e&&Nt(r,e)}},t[5]=r,t[6]=u,t[7]=w,t[8]=s,t[9]=o,t[10]=_,t[11]=x,t[12]=i,t[13]=O):O=t[13];let k;t[14]!==o||t[15]!==i?(k=[i,o],t[14]=o,t[15]=i,t[16]=k):k=t[16],(0,Q.useEffect)(O,k);let A,j;t[17]===u?(A=t[18],j=t[19]):(A=()=>{ie.current=u;let e=p.current;e&&At(e,u)},j=[u],t[17]=u,t[18]=A,t[19]=j),(0,Q.useEffect)(A,j);let M,P;t[20]===r?(M=t[21],P=t[22]):(M=()=>{},P=[r],t[20]=r,t[21]=M,t[22]=P),(0,Q.useEffect)(M,P);let I,L;t[23]===_?(I=t[24],L=t[25]):(L=()=>{let e=D.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(_===`dark`?fe:me)})},I=[_],t[23]=_,t[24]=I,t[25]=L),(0,Q.useEffect)(L,I);let R,z;t[26]===x?(R=t[27],z=t[28]):(R=()=>{let e=D.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(x?F.lineWrapping:[])})},z=[x],t[26]=x,t[27]=R,t[28]=z),(0,Q.useEffect)(R,z);let B,V;t[29]===s?(B=t[30],V=t[31]):(B=()=>{let e=D.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(ve(s??``))})},V=[s],t[29]=s,t[30]=B,t[31]=V),(0,Q.useEffect)(B,V);let H;t[32]!==r||t[33]!==w?(H=()=>{let e=D.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(it(w,r))})},t[32]=r,t[33]=w,t[34]=H):H=t[34];let U;t[35]===E?U=t[36]:(U=[E],t[35]=E,t[36]=U),(0,Q.useEffect)(H,U);let W,G;t[37]!==r||t[38]!==u?(W=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==r||t.mode!==`source`||!u)return;let n=p.current;if(!n){he(oe,{docName:r,mode:`source`,index:t.index,outcome:`no-view`});return}Pt(n,t,r),b(r)};return window.addEventListener(se,e),()=>window.removeEventListener(se,e)},G=[r,u],t[37]=r,t[38]=u,t[39]=W,t[40]=G):(W=t[39],G=t[40]),(0,Q.useEffect)(W,G);let q,J;t[41]!==r||t[42]!==u?(q=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==r||!u)return;let n=p.current;n&&It(n,t,r)&&b(r)};return window.addEventListener(ae,e),()=>window.removeEventListener(ae,e)},J=[r,u],t[41]=r,t[42]=u,t[43]=q,t[44]=J):(q=t[43],J=t[44]),(0,Q.useEffect)(q,J);let Y,X;t[45]!==r||t[46]!==u||t[47]!==o?(Y=()=>{if(!u)return;let e=p.current;if(!e)return;let t=ue(r);if(!t)return;if(t.kind!==`selection-offset`){te(r),t.kind===`outline`?Pt(e,t.detail,r):t.kind===`lint`?It(e,t.detail,r):t.kind===`raw-mdx`&&Ft(e,t.detail,()=>ie.current,r);return}let n=!1,i=null;return queueMicrotask(()=>{if(n)return;let t=ue(r);t?.kind===`selection-offset`&&(i=ne({view:e,docName:r,navigation:t,ydoc:o.document,transition:{from:`wysiwyg`,to:`source`}}),i&&te(r))}),()=>{n=!0,i?.cancel(`mode-flip`)}},X=[r,u,o],t[45]=r,t[46]=u,t[47]=o,t[48]=Y,t[49]=X):(Y=t[48],X=t[49]),(0,Q.useEffect)(Y,X);let Z;return t[50]===Symbol.for(`react.memo_cache_sentinel`)?(Z=(0,jt.jsx)(`div`,{ref:f,className:`source-editor h-full pb-3`}),t[50]=Z):Z=t[50],Z}function Rt(){return{top:C()}}function zt(){return w()}export{Lt as SourceEditor,Ft as applyRawMdxNavigation};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{An as n,Dt as r,Fn as i,Gt as a,Ot as o,St as s,Ut as c,Y as l,_t as u,cn as d,ht as f,ln as p,vt as m}from"./DocumentContext-BG9T5boS.js";import{t as h}from"./react-f2sANaYj.js";import{n as g}from"./dist-PQ5KMVDh.js";import{t as _}from"./compiler-runtime-BfE3aGVn.js";import{ht as v}from"./schemas-api-KjBzkxAy.js";import{i as y}from"./use-apply-config-theme-CYFG76sS.js";import{H as ee,I as b,L as te,N as ne,T as re,b as ie,c as ae,n as oe,o as x,r as se,t as ce,v as S,w as le,z as ue}from"./typing-burst-detector-C86pw-B_.js";import{Hn as de,S as C,U as w,Wn as T,a as fe,i as pe,it as E,o as me,ot as D}from"./CodeMirrorPropInput-BfwxKvly.js";import{a as O,i as k}from"./constants-skills-BLHVRW90.js";import{t as he}from"./diagnostic-breadcrumb-Cr0C15nJ.js";import{n as A}from"./perf-DZJpLc5j.js";import{f as ge}from"./config-provider-8JEEDRxn.js";import{$ as j,At as M,Ct as N,E as P,J as F,K as I,Mt as L,N as R,Nt as z,Tt as _e,X as B,at as V,b as H,et as U,ft as ve,g as W,l as G,lt as K,ot as q,pt as J,st as Y,tt as X,ut as Z,v as ye,wt as be}from"./dist-D2SphF3p.js";import{i as xe,t as Se}from"./dist-DseqKdAU.js";import{i as Ce,n as we,o as Te,r as Ee}from"./dist-DKYEqMZn.js";import{o as De,r as Oe}from"./selection-context-sJ3MQq7D.js";import{C as ke,D as Ae,t as je}from"./markdown-lint-CfRH6CjV.js";import{l as Me}from"./lint-config-client-DgV9TE2y.js";import{a as Ne,i as Pe,n as Fe,o as Ie,r as Le,s as Re,t as ze}from"./dist-CzJghaXH.js";import{n as Be,t as Ve}from"./src-BlVPuoqO.js";var Q=e(h(),1),He=_();function Ue(){let e=r();return e===null?null:new Set(e.keys())}function We(e,t,n){let r=[],i=R(e);if(n!=null){let a=[];for(let{from:e,to:n}of t)i.iterate({from:e,to:n,enter(e){if(e.name===`InlineCode`||e.name===`FencedCode`)return a.push({from:e.from,to:e.to}),!1}});let o=(e,t)=>a.some(n=>e>=n.from&&t<=n.to);for(let{from:i,to:a}of t){let t=e.doc.sliceString(i,a);k.lastIndex=0;for(let e=k.exec(t);e!==null;e=k.exec(t)){let t=e[2];if(!O(t))continue;let a=i+(e.index??0)+e[1].length,s=a+t.length+1;o(a,s)||r.push(I.mark({class:n.has(t)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":t}}).range(a,s))}}}for(let{from:a,to:o}of t)i.iterate({from:a,to:o,enter(t){if(t.name!==`InlineCode`)return;let i=e.doc.sliceString(t.from,t.to),a=i.length-i.replace(/^`+/,``).length,o=i.length-i.replace(/`+$/,``).length,s=i.slice(a,i.length-o),c=/^\/([a-z0-9][a-z0-9-]{1,63})$/.exec(s)?.[1];if(c!==void 0&&O(c)&&n!=null)return r.push(I.mark({class:n.has(c)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":c}}).range(t.from+a,t.to-o)),!1;let l=f.exec(s);if(l)return r.push(I.mark({class:`cm-skill-path-link`,attributes:{"data-skill-path":l[1]}}).range(t.from+a,t.to-o)),!1}});return r.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),I.set(r)}function Ge(e){let t=m(e);return t===null?[]:[B.fromClass(class{decorations;constructor(e){this.decorations=We(e.state,e.visibleRanges,Ue())}update(e){(e.docChanged||e.viewportChanged||R(e.startState)!==R(e.state))&&(this.decorations=We(e.view.state,e.view.visibleRanges,Ue()))}},{decorations:e=>e.decorations}),F.domEventHandlers({mousedown(n){let i=n.target?.closest?.(`[data-skill-ref]`),a=i instanceof HTMLElement?i.dataset.skillRef:void 0;if(a!==void 0){n.preventDefault();let e=r()?.get(a);return e===void 0?s():window.location.hash=o(a,e),!0}let c=n.target?.closest?.(`.cm-skill-path-link`),l=c instanceof HTMLElement?c.dataset.skillPath:void 0;return l===void 0?!1:(n.preventDefault(),window.location.hash=u(t,e,l),!0)}})]}var Ke=I.line({attributes:{dir:`auto`}});function qe(e){let t=new M;for(let n of e.visibleRanges)for(let r=n.from;r<=n.to;){let n=e.state.doc.lineAt(r);t.add(n.from,n.from,Ke),r=n.to+1}return t.finish()}var Je=B.fromClass(class{decorations;constructor(e){this.decorations=qe(e)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=qe(e.view))}},{decorations:e=>e.decorations}),Ye=[F.perLineTextDirection.of(!0),Je],Xe=new Set([`Link`,`Image`,`HTMLTag`,`HTMLBlock`]),Ze=`cm-lint-local-target`;function Qe(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function $e(e,t){let n=W(e,t+1,100);if(n){let e=n.resolveInner(t,1);for(;e;){if(Xe.has(e.name))return{from:e.from,to:e.to};e=e.parent}}return{from:t,to:t}}function et(e){return e===`error`?`error`:e===`info`?`info`:`warning`}function tt(e,t){let n=e.doc,r=[];for(let i of t){if(i.source!==`links`)continue;let t=$e(e,Qe(n,i.range.start));r.push({from:t.from,to:Math.max(t.to,t.from),severity:et(i.severity),message:ie(i),source:`${i.source}/${i.code}`,markClass:Ze})}return r}var nt=L.define();function rt(e){let t={findings:[]};return[Pe(e=>E()?tt(e.state,t.findings):[],{delay:300,needsRefresh:e=>e.transactions.some(e=>e.effects.some(e=>e.is(nt)))}),B.define(n=>{let r=e=>{t.findings=e,n.dispatch({effects:nt.of(null)}),ze(n)},i=S(e,e=>{e.status===`loaded`&&r(e.findings)}),a=D(()=>r(t.findings));return{destroy(){i(),a()}}})]}function it(e,t){return e.enabled?[Fe(),Pe(async n=>at(n.state.doc,await ke(n.state.doc.toString(),e,t)),{delay:600})]:[]}function $(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function at(e,t){let n=[];for(let r of t){let t=$(e,r.range.start),i=$(e,r.range.end),a={from:t,to:Math.max(i,t),severity:r.severity,message:r.message,source:`${r.source}/${r.code}`},o=ot(r);o&&(a.actions=[o]),n.push(a)}return n}function ot(e){let t=e.fixes;return!t||t.length===0?null:{name:`Fix`,apply(e){let n=e.state.doc;e.dispatch({changes:t.map(e=>({from:$(n,e.range.start),to:$(n,e.range.end),insert:e.newText})),userEvent:`input.complete`})}}}var st=[Z(),q(),Y(),ye(),U(),X(),_e.allowMultipleSelections.of(!0),P(),G(),Ee(),we(),J(),j(),V(),Ne(),K.of([...Ce,...Se,...Re,...H,...Te,...Le])],ct=I.mark({class:`cm-link-ref-broken`}),lt=/^\s{0,3}\[([^\]]+)\]:\s/,ut=/\[([^\]]*)\]\[([^\]]*)\]/g,dt=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function ft(e,t){let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i];if(e<a.from)r=i-1;else if(e>=a.to)n=i+1;else return!0}return!1}function pt(e){let t=[];return R(e).iterate({enter(e){if(dt.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function mt(e){let t=new Set,n=[],r=e.doc,i=pt(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(ft(n.from,i))continue;let a=lt.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!ft(t.from,i)&&!lt.test(t.text))for(ut.lastIndex=0;;){let e=ut.exec(t.text);if(!e)break;let r=t.from+e.index;if(ft(r,i))continue;let a=e[2]||e[1];n.push({from:r,to:r+e[0].length,label:a.toLowerCase()})}}let a=[];for(let e of n)t.has(e.label)||a.push(ct.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),I.set(a)}var ht=z.define({create(e){return mt(e)},update(e,t){return t.docChanged?mt(t.state):e},provide:e=>F.decorations.from(e)}),gt=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,_t=I.mark({class:`cm-del`}),vt=I.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),yt=I.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function bt(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function xt(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!v.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(v.test(r.text))return{from:t.from,to:r.to}}return null}function St(e,t){let n=[],r=R(e),i=xt(e),a=e=>i!==null&&e>=i.from&&e<=i.to;for(let{from:i,to:o}of t)r.iterate({from:i,to:o,enter(t){if(!a(t.from)){if(t.name===`Strikethrough`){let e=t.from,r=t.to,i=t.node.cursor();if(i.firstChild())do i.name===`StrikethroughMark`&&(i.from===t.from?e=i.to:r=i.from);while(i.nextSibling());return e<r&&n.push(_t.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=gt.exec(r.text),a=i?i[1].length:2,o=I.line({class:`cm-list-item`,attributes:{style:`--list-hang: ${a}ch`}});n.push(o.range(r.from));return}if(t.name===`FencedCode`){let r=e.doc.lineAt(t.from),i=e.doc.lineAt(t.to);for(let t=r.number+1;t<i.number;t++){let r=e.doc.line(t),i=bt(r.text),a=I.line({class:`cm-fenced-code-line`,attributes:{style:`--line-indent: ${i}`}});n.push(a.range(r.from))}return!1}if(t.name===`TableHeader`){let r=e.doc.lineAt(t.from);return n.push(vt.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(yt.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(yt.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),I.set(n)}var Ct=class{decorations;constructor(e){this.decorations=St(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||R(e.startState)!==R(e.state))&&(this.decorations=St(e.view.state,e.view.visibleRanges))}},wt=B.fromClass(Ct,{decorations:e=>e.decorations});function Tt(){return[wt,ht]}function Et(e,t){let n=e.trackedOrigins;return n.has(t)?!0:t?n.has(t.constructor):!1}function Dt(e){let{docName:t,ytext:n,undoManager:r}=e,i=!1,a=!1,o=!1,s=(e,t)=>{i||Et(r,t.origin)||(a=!0)};return n.observe(s),{setSourceModeActive(e){if(!o&&e!==i){if(!e){i=!1,r.stopCapturing();return}a&&(r.clear(),A(`ok/source-undo/flip-clear`,{docName:t})),a=!1,i=!0}},destroy(){o||(o=!0,n.unobserve(s))}}}var Ot=new WeakMap;function kt(e){return B.define(t=>{let n=Dt(e);return Ot.set(t,n),{destroy(){n.destroy()}}})}function At(e,t){let n=Ot.get(e);if(!n)throw Error(`createSourceUndoFlipExtension is not installed on this EditorView`);n.setSourceModeActive(t)}var jt=t(),Mt=L.define();function Nt(e,t){try{At(t.view,!1)}finally{try{p(t)}finally{T(e,t.view)}}}function Pt(e,t,n){let r=x(e.state.doc),a=r[t.index],o={docName:n,mode:`source`,index:t.index,sourceHeadingCount:r.length};if(!a){he(oe,{...o,outcome:`no-target`});return}let s=i(n,`outline`,()=>{e.dispatch({selection:be.cursor(a.from),effects:F.scrollIntoView(a.from,{y:`start`})}),e.focus()});he(oe,{...o,outcome:s?`scrolled`:`declined`,targetLine:e.state.doc.lineAt(a.from).number})}function Ft(e,t,n,r){requestAnimationFrame(()=>{if(!n())return;let a=e.state.doc,o=Math.min(t.offset,a.length);i(r,`raw-mdx`,()=>{e.dispatch({selection:be.cursor(o),effects:F.scrollIntoView(o,{y:`center`})}),e.focus()})})}function It(e,t,n){let r=e.state.doc,a=Math.min(Math.max(t.line,1),r.lines),o=r.line(a),s=Math.min(o.from+Math.max(0,t.column-1),o.to);return i(n,`problems-row`,()=>{e.dispatch({selection:be.cursor(s),effects:F.scrollIntoView(s,{y:`start`})}),e.focus()})}function Lt(e){let t=(0,He.c)(51),{docName:r,ytext:i,provider:o,placeholder:s,isSourceModeActive:u}=e,f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),[m,h]=(0,Q.useState)(null);if(m)throw m;let{resolvedTheme:_}=g(),{merged:v}=y(),ie=(0,Q.useRef)(u),x=v?.editor?.wordWrap??!0,{data:S}=Me(r),C;t[0]!==S?.effective||t[1]!==v?(C=S?.effective??(v?.contentRules?Ae(v.contentRules):je),t[0]=S?.effective,t[1]=v,t[2]=C):C=t[2];let w=C,T;t[3]===w?T=t[4]:(T=JSON.stringify(w),t[3]=w,t[4]=T);let E=T,D=(0,Q.useRef)(null),O;t[5]!==r||t[6]!==u||t[7]!==w||t[8]!==s||t[9]!==o||t[10]!==_||t[11]!==x||t[12]!==i?(O=()=>{let e=f.current;if(!e)return;let t=o.configuration.name??``,m,g=zt;try{m=d({docName:t,container:e,sizeStats:{viewCount:0,bytes:i.length},factory:e=>{let u=null,d=new ge(i);try{let f=l({ydoc:o.document,ytext:i,docName:t}),p=new N,m=new N,h=new N,v=new N,y=new F({state:_e.create({doc:i.toString(),extensions:[st,Ye,Ie({scrollToMatch:e=>n(t,`find-match`)?F.scrollIntoView(e,{y:`start`}):Mt.of(null)}),K.of([xe]),Ve(i,o.awareness,{undoManager:d}),K.of(Be),kt({docName:t,ytext:i,undoManager:d}),...pe({themeCompartment:p,resolvedTheme:_,ydoc:o.document,wordWrapCompartment:m,wordWrap:x,currentDocName:t}),Tt(),Ge(t),ee(),v.of(it(w,r)),rt(r),f,F.updateListener.of(e=>{c(e)&&a(t)}),F.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(u!==null&&clearTimeout(u),u=setTimeout(()=>{u=null,le(t,`source`,re(e.view)),Oe(t,`source`,De(e.view,t))},120))}),h.of(ve(s??``)),F.theme({"&":{height:`100%`}}),F.scrollMargins.of(Rt)]}),parent:e});le(t,`source`,re(y)),Oe(t,`source`,De(y,t));let b=y.contentDOM;return b.addEventListener(`keydown`,g),b.addEventListener(`paste`,g),b.addEventListener(`drop`,g),b.addEventListener(`cut`,g),{view:y,ydoc:o.document,ytext:i,provider:o,undoManager:d,themeCompartment:p,wordWrapCompartment:m,placeholderCompartment:h,lintCompartment:v}}catch(e){let t=e;throw d.destroy(),t}}}),D.current=m,p.current=m.view,At(m.view,u),de(r,m.view,`sourceEditor`),ce()&&m.view.focus()}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),D.current=null,p.current=null,h(t instanceof Error?t:Error(String(t)))}return()=>{let e=D.current;D.current=null,p.current=null,e&&Nt(r,e)}},t[5]=r,t[6]=u,t[7]=w,t[8]=s,t[9]=o,t[10]=_,t[11]=x,t[12]=i,t[13]=O):O=t[13];let k;t[14]!==o||t[15]!==i?(k=[i,o],t[14]=o,t[15]=i,t[16]=k):k=t[16],(0,Q.useEffect)(O,k);let A,j;t[17]===u?(A=t[18],j=t[19]):(A=()=>{ie.current=u;let e=p.current;e&&At(e,u)},j=[u],t[17]=u,t[18]=A,t[19]=j),(0,Q.useEffect)(A,j);let M,P;t[20]===r?(M=t[21],P=t[22]):(M=()=>{},P=[r],t[20]=r,t[21]=M,t[22]=P),(0,Q.useEffect)(M,P);let I,L;t[23]===_?(I=t[24],L=t[25]):(L=()=>{let e=D.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(_===`dark`?fe:me)})},I=[_],t[23]=_,t[24]=I,t[25]=L),(0,Q.useEffect)(L,I);let R,z;t[26]===x?(R=t[27],z=t[28]):(R=()=>{let e=D.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(x?F.lineWrapping:[])})},z=[x],t[26]=x,t[27]=R,t[28]=z),(0,Q.useEffect)(R,z);let B,V;t[29]===s?(B=t[30],V=t[31]):(B=()=>{let e=D.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(ve(s??``))})},V=[s],t[29]=s,t[30]=B,t[31]=V),(0,Q.useEffect)(B,V);let H;t[32]!==r||t[33]!==w?(H=()=>{let e=D.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(it(w,r))})},t[32]=r,t[33]=w,t[34]=H):H=t[34];let U;t[35]===E?U=t[36]:(U=[E],t[35]=E,t[36]=U),(0,Q.useEffect)(H,U);let W,G;t[37]!==r||t[38]!==u?(W=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==r||t.mode!==`source`||!u)return;let n=p.current;if(!n){he(oe,{docName:r,mode:`source`,index:t.index,outcome:`no-view`});return}Pt(n,t,r),b(r)};return window.addEventListener(se,e),()=>window.removeEventListener(se,e)},G=[r,u],t[37]=r,t[38]=u,t[39]=W,t[40]=G):(W=t[39],G=t[40]),(0,Q.useEffect)(W,G);let q,J;t[41]!==r||t[42]!==u?(q=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==r||!u)return;let n=p.current;n&&It(n,t,r)&&b(r)};return window.addEventListener(ae,e),()=>window.removeEventListener(ae,e)},J=[r,u],t[41]=r,t[42]=u,t[43]=q,t[44]=J):(q=t[43],J=t[44]),(0,Q.useEffect)(q,J);let Y,X;t[45]!==r||t[46]!==u||t[47]!==o?(Y=()=>{if(!u)return;let e=p.current;if(!e)return;let t=ue(r);if(!t)return;if(t.kind!==`selection-offset`){te(r),t.kind===`outline`?Pt(e,t.detail,r):t.kind===`lint`?It(e,t.detail,r):t.kind===`raw-mdx`&&Ft(e,t.detail,()=>ie.current,r);return}let n=!1,i=null;return queueMicrotask(()=>{if(n)return;let t=ue(r);t?.kind===`selection-offset`&&(i=ne({view:e,docName:r,navigation:t,ydoc:o.document,transition:{from:`wysiwyg`,to:`source`}}),i&&te(r))}),()=>{n=!0,i?.cancel(`mode-flip`)}},X=[r,u,o],t[45]=r,t[46]=u,t[47]=o,t[48]=Y,t[49]=X):(Y=t[48],X=t[49]),(0,Q.useEffect)(Y,X);let Z;return t[50]===Symbol.for(`react.memo_cache_sentinel`)?(Z=(0,jt.jsx)(`div`,{ref:f,className:`source-editor h-full pb-3`}),t[50]=Z):Z=t[50],Z}function Rt(){return{top:C()}}function zt(){return w()}export{Lt as SourceEditor,Ft as applyRawMdxNavigation};