markstream-vue 0.0.10-beta.2 → 0.0.10-beta.3

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 (129) hide show
  1. package/dist/exports.js +1 -1
  2. package/dist/index.css +1 -1
  3. package/dist/index.d.ts +103 -1419
  4. package/dist/index.js +1 -1
  5. package/dist/index.px.css +1 -1
  6. package/dist/index.tailwind.css +1 -1
  7. package/dist/index2.js +1 -1
  8. package/dist/index3.js +1 -1
  9. package/dist/index4.js +1 -1
  10. package/dist/index5.js +1 -1
  11. package/dist/index6.js +1 -1
  12. package/dist/index7.js +1 -1
  13. package/dist/tailwind.ts +0 -0
  14. package/dist/types/components/AdmonitionNode/AdmonitionNode.vue.d.ts +26 -0
  15. package/dist/types/components/AdmonitionNode/index.d.ts +2 -0
  16. package/dist/types/components/BlockquoteNode/BlockquoteNode.vue.d.ts +23 -0
  17. package/dist/types/components/BlockquoteNode/index.d.ts +2 -0
  18. package/dist/types/components/CheckboxNode/CheckboxNode.vue.d.ts +9 -0
  19. package/dist/types/components/CheckboxNode/index.d.ts +2 -0
  20. package/dist/types/components/CodeBlockNode/CodeBlockNode.vue.d.ts +51 -0
  21. package/dist/types/components/CodeBlockNode/HtmlPreviewFrame.vue.d.ts +8 -0
  22. package/dist/types/components/CodeBlockNode/index.d.ts +2 -0
  23. package/dist/types/components/CodeBlockNode/monaco.d.ts +1 -0
  24. package/dist/types/components/CodeBlockNode/monacoThemeScheduler.d.ts +3 -0
  25. package/dist/types/components/D2BlockNode/D2BlockNode.vue.d.ts +15 -0
  26. package/dist/types/components/D2BlockNode/d2.d.ts +6 -0
  27. package/dist/types/components/D2BlockNode/index.d.ts +2 -0
  28. package/dist/types/components/DefinitionListNode/DefinitionListNode.vue.d.ts +29 -0
  29. package/dist/types/components/DefinitionListNode/index.d.ts +2 -0
  30. package/dist/types/components/EmojiNode/EmojiNode.vue.d.ts +10 -0
  31. package/dist/types/components/EmojiNode/index.d.ts +2 -0
  32. package/dist/types/components/EmphasisNode/EmphasisNode.vue.d.ts +16 -0
  33. package/dist/types/components/EmphasisNode/index.d.ts +2 -0
  34. package/dist/types/components/FootnoteAnchorNode/FootnoteAnchorNode.vue.d.ts +9 -0
  35. package/dist/types/components/FootnoteAnchorNode/index.d.ts +2 -0
  36. package/dist/types/components/FootnoteNode/FootnoteNode.vue.d.ts +21 -0
  37. package/dist/types/components/FootnoteNode/index.d.ts +2 -0
  38. package/dist/types/components/FootnoteReferenceNode/FootnoteReferenceNode.vue.d.ts +10 -0
  39. package/dist/types/components/FootnoteReferenceNode/index.d.ts +2 -0
  40. package/dist/types/components/HardBreakNode/HardBreakNode.vue.d.ts +9 -0
  41. package/dist/types/components/HardBreakNode/index.d.ts +2 -0
  42. package/dist/types/components/HeadingNode/HeadingNode.vue.d.ts +19 -0
  43. package/dist/types/components/HeadingNode/index.d.ts +2 -0
  44. package/dist/types/components/HighlightNode/HighlightNode.vue.d.ts +16 -0
  45. package/dist/types/components/HighlightNode/index.d.ts +2 -0
  46. package/dist/types/components/HtmlBlockNode/HtmlBlockNode.vue.d.ts +39 -0
  47. package/dist/types/components/HtmlBlockNode/index.d.ts +2 -0
  48. package/dist/types/components/HtmlInlineNode/HtmlInlineNode.vue.d.ts +12 -0
  49. package/dist/types/components/HtmlInlineNode/index.d.ts +2 -0
  50. package/dist/types/components/ImageNode/ImageNode.vue.d.ts +67 -0
  51. package/dist/types/components/ImageNode/index.d.ts +2 -0
  52. package/dist/types/components/InfographicBlockNode/InfographicBlockNode.vue.d.ts +44 -0
  53. package/dist/types/components/InfographicBlockNode/index.d.ts +2 -0
  54. package/dist/types/components/InfographicBlockNode/infographic.d.ts +3 -0
  55. package/dist/types/components/InlineCodeNode/InlineCodeNode.vue.d.ts +9 -0
  56. package/dist/types/components/InlineCodeNode/index.d.ts +2 -0
  57. package/dist/types/components/InsertNode/InsertNode.vue.d.ts +16 -0
  58. package/dist/types/components/InsertNode/index.d.ts +2 -0
  59. package/dist/types/components/LinkNode/LinkNode.vue.d.ts +5 -0
  60. package/dist/types/components/LinkNode/index.d.ts +2 -0
  61. package/dist/types/components/ListItemNode/ListItemNode.vue.d.ts +30 -0
  62. package/dist/types/components/ListItemNode/index.d.ts +2 -0
  63. package/dist/types/components/ListNode/ListNode.vue.d.ts +29 -0
  64. package/dist/types/components/ListNode/index.d.ts +2 -0
  65. package/dist/types/components/MarkdownCodeBlockNode/MarkdownCodeBlockNode.vue.d.ts +86 -0
  66. package/dist/types/components/MarkdownCodeBlockNode/index.d.ts +2 -0
  67. package/dist/types/components/MathBlockNode/MathBlockNode.vue.d.ts +5 -0
  68. package/dist/types/components/MathBlockNode/index.d.ts +2 -0
  69. package/dist/types/components/MathInlineNode/MathInlineNode.vue.d.ts +24 -0
  70. package/dist/types/components/MathInlineNode/index.d.ts +2 -0
  71. package/dist/types/components/MathInlineNode/katex.d.ts +7 -0
  72. package/dist/types/components/MermaidBlockNode/MermaidBlockNode.vue.d.ts +62 -0
  73. package/dist/types/components/MermaidBlockNode/index.d.ts +2 -0
  74. package/dist/types/components/MermaidBlockNode/mermaid.d.ts +6 -0
  75. package/dist/types/components/NodeRenderer/FallbackComponent.vue.d.ts +7 -0
  76. package/dist/types/components/NodeRenderer/NodeRenderer.vue.d.ts +31 -0
  77. package/dist/types/components/NodeRenderer/asyncComponent.d.ts +28 -0
  78. package/dist/types/components/NodeRenderer/index.d.ts +2 -0
  79. package/dist/types/components/NodeRenderer/preloadMonaco.d.ts +1 -0
  80. package/dist/types/components/ParagraphNode/ParagraphNode.vue.d.ts +16 -0
  81. package/dist/types/components/ParagraphNode/index.d.ts +2 -0
  82. package/dist/types/components/PreCodeNode/PreCodeNode.vue.d.ts +3 -0
  83. package/dist/types/components/PreCodeNode/index.d.ts +2 -0
  84. package/dist/types/components/ReferenceNode/ReferenceNode.vue.d.ts +19 -0
  85. package/dist/types/components/ReferenceNode/index.d.ts +2 -0
  86. package/dist/types/components/StrikethroughNode/StrikethroughNode.vue.d.ts +16 -0
  87. package/dist/types/components/StrikethroughNode/index.d.ts +2 -0
  88. package/dist/types/components/StrongNode/StrongNode.vue.d.ts +16 -0
  89. package/dist/types/components/StrongNode/index.d.ts +2 -0
  90. package/dist/types/components/SubscriptNode/SubscriptNode.vue.d.ts +16 -0
  91. package/dist/types/components/SubscriptNode/index.d.ts +2 -0
  92. package/dist/types/components/SuperscriptNode/SuperscriptNode.vue.d.ts +16 -0
  93. package/dist/types/components/SuperscriptNode/index.d.ts +2 -0
  94. package/dist/types/components/TableNode/TableNode.vue.d.ts +52 -0
  95. package/dist/types/components/TableNode/index.d.ts +2 -0
  96. package/dist/types/components/TextNode/TextNode.vue.d.ts +14 -0
  97. package/dist/types/components/TextNode/index.d.ts +2 -0
  98. package/dist/types/components/ThematicBreakNode/ThematicBreakNode.vue.d.ts +2 -0
  99. package/dist/types/components/ThematicBreakNode/index.d.ts +2 -0
  100. package/dist/types/components/Tooltip/Tooltip.vue.d.ts +15 -0
  101. package/dist/types/components/Tooltip/index.d.ts +2 -0
  102. package/dist/types/components/VmrContainerNode/VmrContainerNode.vue.d.ts +20 -0
  103. package/dist/types/components/VmrContainerNode/index.d.ts +2 -0
  104. package/dist/types/components/__tests__/htmlNodes.integration.test.d.ts +4 -0
  105. package/dist/types/composables/rendererContext.d.ts +18 -0
  106. package/dist/types/composables/useKatexReady.d.ts +1 -0
  107. package/dist/types/composables/useSafeI18n.d.ts +10 -0
  108. package/dist/types/composables/useSingletonTooltip.d.ts +11 -0
  109. package/dist/types/composables/viewportPriority.d.ts +20 -0
  110. package/dist/types/exports.d.ts +370 -0
  111. package/dist/types/types/component-props.d.ts +307 -0
  112. package/dist/types/types/index.d.ts +272 -0
  113. package/dist/types/types/node-renderer-props.d.ts +80 -0
  114. package/dist/types/utils/__tests__/htmlRenderer.test.d.ts +4 -0
  115. package/dist/types/utils/htmlRenderer.d.ts +41 -0
  116. package/dist/types/utils/index.d.ts +6 -0
  117. package/dist/types/utils/katex-threshold.d.ts +20 -0
  118. package/dist/types/utils/languageIcon.d.ts +8 -0
  119. package/dist/types/utils/languageIconExtended.d.ts +1 -0
  120. package/dist/types/utils/nodeComponents.d.ts +20 -0
  121. package/dist/types/utils/performance-monitor.d.ts +121 -0
  122. package/dist/types/utils/safeRaf.d.ts +2 -0
  123. package/dist/types/workers/katexCdnWorker.d.ts +52 -0
  124. package/dist/types/workers/katexRenderer.worker.d.ts +0 -0
  125. package/dist/types/workers/katexWorkerClient.d.ts +48 -0
  126. package/dist/types/workers/mermaidCdnWorker.d.ts +35 -0
  127. package/dist/types/workers/mermaidParser.worker.d.ts +1 -0
  128. package/dist/types/workers/mermaidWorkerClient.d.ts +21 -0
  129. package/package.json +10 -3
package/dist/exports.js CHANGED
@@ -1 +1 @@
1
- var e=Object.defineProperty,n=Object.defineProperties,t=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,i=(n,t,o)=>t in n?e(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o,a=(e,n)=>{for(var t in n||(n={}))r.call(n,t)&&i(e,t,n[t]);if(o)for(var t of o(n))l.call(n,t)&&i(e,t,n[t]);return e},s=(e,o)=>n(e,t(o)),d=(e,n,t)=>i(e,"symbol"!=typeof n?n+"":n,t),u=(e,n,t)=>new Promise((o,r)=>{var l=e=>{try{a(t.next(e))}catch(n){r(n)}},i=e=>{try{a(t.throw(e))}catch(n){r(n)}},a=e=>e.done?o(e.value):Promise.resolve(e.value).then(l,i);a((t=t.apply(e,n)).next())});import{getMarkdown as c,parseMarkdownToStructure as m,setDefaultMathOptions as h}from"stream-markdown-parser";import{defineComponent as p,openBlock as v,createElementBlock as f,withMemo as g,createVNode as y,unref as w,createElementVNode as k,Fragment as x,renderList as b,toDisplayString as M,shallowRef as _,h as T,computed as C,ref as B,watch as I,onMounted as S,onBeforeUnmount as $,normalizeClass as E,useAttrs as L,inject as N,createCommentVNode as j,nextTick as H,createBlock as P,Teleport as D,Transition as R,withCtx as K,withDirectives as O,normalizeStyle as W,vShow as A,createApp as z,provide as F,renderSlot as V,readonly as U,defineAsyncComponent as X,resolveDynamicComponent as q,mergeProps as G,isMemoSame as Y,markRaw as Z,reactive as J}from"vue";import{autoUpdate as Q,offset as ee,flip as ne,shift as te,computePosition as oe}from"@floating-ui/dom";const re=["cite"],le=(e,n)=>{const t=e.__vccOpts||e;for(const[o,r]of n)t[o]=r;return t},ie=/* @__PURE__ */le(/* @__PURE__ */p({__name:"BlockquoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(v(),f("blockquote",{class:"blockquote",dir:"auto",cite:e.node.cite},[g([n.node.children],()=>y(w(zt),{"index-key":`blockquote-${n.indexKey}`,nodes:n.node.children||[],"custom-id":n.customId,typewriter:n.typewriter,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))},null,8,["index-key","nodes","custom-id","typewriter"]),o,1)],8,re))}}),[["__scopeId","data-v-eeadc8a3"]]);ie.install=e=>{e.component(ie.__name,ie)};const ae={class:"checkbox-node"},se=["checked"],de=/* @__PURE__ */le(/* @__PURE__ */p({__name:"CheckboxNode",props:{node:{}},setup:e=>(n,t)=>(v(),f("span",ae,[k("input",{type:"checkbox",checked:e.node.checked,disabled:"",class:"checkbox-input"},null,8,se)]))}),[["__scopeId","data-v-8dc6c46f"]]);de.install=e=>{e.component(de.__name,de)};const ue={class:"definition-list"},ce={class:"definition-term"},me={class:"definition-desc"},he=/* @__PURE__ */le(/* @__PURE__ */p({__name:"DefinitionListNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(e,t)=>(v(),f("dl",ue,[(v(!0),f(x,null,b(n.node.items,(o,r)=>(v(),f(x,{key:r},[k("dt",ce,[y(w(zt),{"index-key":`definition-term-${n.indexKey}-${r}`,nodes:o.term,"custom-id":n.customId,typewriter:n.typewriter,onCopy:t[0]||(t[0]=n=>e.$emit("copy",n))},null,8,["index-key","nodes","custom-id","typewriter"])]),k("dd",me,[y(w(zt),{"index-key":`definition-desc-${n.indexKey}-${r}`,nodes:o.definition,"custom-id":n.customId,typewriter:n.typewriter,onCopy:t[1]||(t[1]=n=>e.$emit("copy",n))},null,8,["index-key","nodes","custom-id","typewriter"])])],64))),128))]))}}),[["__scopeId","data-v-f88691d6"]]);he.install=e=>{e.component(he.__name,he)};const pe={class:"emoji-node"},ve=/* @__PURE__ */le(/* @__PURE__ */p({__name:"EmojiNode",props:{node:{}},setup:e=>(n,t)=>(v(),f("span",pe,M(e.node.name),1))}),[["__scopeId","data-v-de55dc97"]]);ve.install=e=>{e.component(ve.__name,ve)};const fe="__global__",ge="__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__",ye=(()=>{const e=globalThis;if(e[ge])return e[ge];const n={scopedCustomComponents:{},revision:_(0)};return e[ge]=n,n})(),we=ye.revision;function ke(e,n){"string"==typeof e?ye.scopedCustomComponents[e]=n||{}:ye.scopedCustomComponents[fe]=e||{},we.value++}function xe(e){const n=ye.scopedCustomComponents[fe]||{};if(!e)return n;const t=ye.scopedCustomComponents[e]||{};return n&&0!==Object.keys(n).length?t&&0!==Object.keys(t).length?a(a({},n),t):n:t}function be(e){if(e===fe)throw new Error("removeCustomComponents: use clearGlobalCustomComponents() to clear the global mapping");delete ye.scopedCustomComponents[e],we.value++}function Me(){delete ye.scopedCustomComponents[fe],we.value++}const _e=["id"],Te=["title"],Ce=/* @__PURE__ */le(/* @__PURE__ */p({__name:"FootnoteReferenceNode",props:{node:{}},setup(e){const n=`#footnote-${e.node.id}`;function t(){if("undefined"==typeof document)return;const e=document.querySelector(n);e?e.scrollIntoView({behavior:"smooth"}):console.warn(`Element with href: ${n} not found`)}return(o,r)=>(v(),f("sup",{id:`fnref-${e.node.id}`,class:"footnote-reference",onClick:t},[k("span",{href:n,title:`查看脚注 ${e.node.id}`,class:"footnote-link cursor-pointer"},"["+M(e.node.id)+"]",9,Te)],8,_e))}}),[["__scopeId","data-v-01af0fee"]]);Ce.install=e=>{e.component(Ce.__name,Ce)};const Be=/* @__PURE__ */new Set(["onclick","onerror","onload","onmouseover","onmouseout","onmousedown","onmouseup","onkeydown","onkeyup","onfocus","onblur","onsubmit","onreset","onchange","onselect","ondblclick","ontouchstart","ontouchend","ontouchmove","ontouchcancel","onwheel","onscroll","oncopy","oncut","onpaste","oninput","oninvalid","onreset","onsearch","onsubmit"]),Ie=/* @__PURE__ */new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Se=/* @__PURE__ */new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]),$e=/<([a-z][a-z0-9-]*)\b[^>]*>/gi,Ee=/* @__PURE__ */new Set(["script"]),Le=/* @__PURE__ */new Set(["href","src","srcset","xlink:href","formaction"]),Ne=(()=>{try{return Boolean(!1)}catch(e){}return!1})();function je(e){Ne&&console.warn(e)}function He(e){const n=function(e){let n="";for(const t of e){const e=t.charCodeAt(0);e<=31||127===e||/\s/u.test(t)||(n+=t)}return n}(e).toLowerCase();return!(!n.startsWith("javascript:")&&!n.startsWith("vbscript:"))||!!n.startsWith("data:")&&!(n.startsWith("data:image/")||n.startsWith("data:video/")||n.startsWith("data:audio/"))}function Pe(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function De(e,n){const t=e.toLowerCase();return!Se.has(t)&&(Pe(n,t)||Pe(n,e))}function Re(e){const n={};for(const[t,o]of Object.entries(e)){const e=t.toLowerCase();Be.has(e)||Le.has(e)&&o&&He(o)||(n[t]=o)}return n}function Ke(e,n){const t=n.toLowerCase();if(["checked","disabled","readonly","required","autofocus","multiple","hidden"].includes(t))return"true"===e||""===e||e===n;if(["value","min","max","step","width","height","size","maxlength"].includes(t)){const n=Number(e);if(""!==e&&!Number.isNaN(n))return n}return e}function Oe(e){return e.trim().length>0}function We(e,n,t,o,r){if(Ee.has(e.toLowerCase()))return null;const l=Re(n),i=l.key,d=null!=i&&""!==i?i:r;if(De(e,o)){const n=o[e]||o[e.toLowerCase()],r=function(e){const n={};for(const[t,o]of Object.entries(e))n[t]=Ke(o,t);return n}(l);return T(n,s(a({},r),{key:d}),t.length>0?t:void 0)}return T(e,s(a({},l),{innerHTML:void 0,key:d}),t.length>0?t:void 0)}function Ae(e,n){if(!e||!e.includes("<"))return!1;if(!n||0===Object.keys(n).length)return!1;let t;for($e.lastIndex=0;null!==(t=$e.exec(e));)if(De(t[1],n))return!0;return!1}function ze(e,n){if(!e)return[];try{const t=function(e,n){let t=0;const o=[],r=[];for(const l of e)if("text"===l.type)(o.length>0?o[o.length-1].children:r).push(l.content);else if("self_closing"===l.type){const e=We(l.tagName,l.attrs||{},[],n,"ms-html-"+t++),i=o.length>0?o[o.length-1].children:r;null!=e&&i.push(e)}else if("tag_open"===l.type)o.push({tagName:l.tagName,children:[],attrs:l.attrs,autoKey:"ms-html-"+t++});else if("tag_close"===l.type){const e=l.tagName.toLowerCase();let t=-1;for(let n=o.length-1;n>=0;n--)if(o[n].tagName.toLowerCase()===e){t=n;break}if(-1!==t)for(;o.length>t;){const l=o.pop(),i=We(l.tagName,l.attrs||{},l.children,n,l.autoKey);o.length>0?null!=i&&o[o.length-1].children.push(i):null!=i&&r.push(i),l.tagName.toLowerCase()!==e&&o.length>t&&je(`Auto-closing unclosed tag: <${l.tagName}>`)}else je(`Ignoring closing tag with no matching opening tag: </${l.tagName}>`)}for(;o.length>0;){const e=o.pop(),t=We(e.tagName,e.attrs||{},e.children,n,e.autoKey);o.length>0?null!=t&&o[o.length-1].children.push(t):null!=t&&r.push(t),je(`Auto-closing unclosed tag: <${e.tagName}>`)}return r}(function(e){var n,t,o;const r=[];let l=0;for(;l<e.length;){if(e.startsWith("\x3c!--",l)){const n=e.indexOf("--\x3e",l);if(-1!==n){l=n+3;continue}break}const i=e.indexOf("<",l);if(-1===i){if(l<e.length){const n=e.slice(l);Oe(n)&&r.push({type:"text",content:n})}break}if(i>l){const n=e.slice(l,i);Oe(n)&&r.push({type:"text",content:n})}if(e.startsWith("![CDATA[",i+1)){const n=e.indexOf("]]>",i);if(-1!==n){r.push({type:"text",content:e.slice(i,n+3)}),l=n+3;continue}break}if(e.startsWith("!",i+1)){const n=e.indexOf(">",i);if(-1!==n){l=n+1;continue}break}const a=e.indexOf(">",i);if(-1===a)break;const s=e.slice(i+1,a).trim(),d=s.startsWith("/"),u=s.endsWith("/");if(d){const e=s.slice(1).trim();r.push({type:"tag_close",tagName:e})}else{const e=s.indexOf(" ");let l,i="";-1===e?l=u?s.slice(0,-1).trim():s.trim():(l=s.slice(0,e).trim(),i=s.slice(e+1));const a={};if(i){const e=/([^\s=]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S*)))?/g;let r;for(;null!==(r=e.exec(i));){const e=r[1],l=null!=(o=null!=(t=null!=(n=r[2])?n:r[3])?t:r[4])?o:"";e&&!e.endsWith("/")&&(a[e]=l)}}r.push({type:u||Ie.has(l.toLowerCase())?"self_closing":"tag_open",tagName:l,attrs:a})}l=a+1}return r}(e),n);return t}catch(o){return t=o,Ne&&console.error("Failed to parse HTML to VNodes:",t),null}var t}const Fe=/* @__PURE__ */le(/* @__PURE__ */p({__name:"HtmlInlineNode",props:{node:{},customId:{}},setup(e){const n=e,t=C(()=>(we.value,xe(n.customId))),o=p({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),r=C(()=>{const e=n.node.content;if(!e)return{mode:"html",content:""};if(n.node.loading&&n.node.autoClosed){const n=ze(e,t.value);if(null!==n)return{mode:"dynamic",nodes:n}}if(!Ae(e,t.value))return{mode:"html",content:e};const o=ze(e,t.value);return null===o?{mode:"html",content:e}:{mode:"dynamic",nodes:o}}),l=B(null),i="undefined"!=typeof window,a=B({mode:"",content:"",el:null});let s=null;function d(e,n){if(!i||!l.value)return;const t=l.value,o=a.value;if(o.el!==t||o.mode!==e||o.content!==n){if("text"===e)t.textContent=n;else{const e=(!s&&i&&(s=document.createElement("template")),s);if(e){e.innerHTML=n;const o=e.content.cloneNode(!0);"function"==typeof t.replaceChildren?t.replaceChildren(o):(t.innerHTML="",t.appendChild(o))}else t.innerHTML=n}a.value={mode:e,content:n,el:t}}}function u(){d("html",n.node.content)}function c(){d("text",n.node.content)}return I(()=>[n.node.content,n.node.loading,n.node.autoClosed,r.value.mode],()=>{"html"===r.value.mode&&(n.node.loading&&!n.node.autoClosed?c():u())}),S(()=>{"html"===r.value.mode&&(n.node.loading&&!n.node.autoClosed?c():u())}),$(()=>{l.value&&(l.value.innerHTML="",a.value={mode:"",content:"",el:null})}),(e,t)=>"dynamic"===r.value.mode?(v(),f("span",{key:0,class:E(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},[y(w(o),{nodes:r.value.nodes},null,8,["nodes"])],2)):(v(),f("span",{key:1,ref_key:"containerRef",ref:l,class:E(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},null,2))}}),[["__scopeId","data-v-4add5e85"]]);Fe.install=e=>{e.component(Fe.__name,Fe)};const Ve={class:"inline text-[85%] px-1 py-0.5 rounded font-mono bg-[hsl(var(--secondary))] whitespace-normal break-words max-w-full before:content-[''] after:content-['']"},Ue={key:0},Xe=/* @__PURE__ */le(/* @__PURE__ */p({__name:"InlineCodeNode",props:{node:{}},setup(e){const n=e,t=L(),o=N("markstreamTypewriter",void 0),r=N("markstreamTextStreamState",void 0),l=C(()=>{const e=t.typewriter;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),i=C(()=>"boolean"==typeof l.value?l.value:"boolean"!=typeof(null==o?void 0:o.value)||o.value),a=C(()=>{var e;const n=null!=(e=t["index-key"])?e:t.indexKey;return null==n||""===n?"":String(n)}),s=B(n.node.code),d=B(""),u=B(0);function c(){return s.value+d.value}function m(e){s.value=e,d.value=""}function h(){d.value&&(s.value=c(),d.value="")}I([()=>n.node.code,a,i],([e])=>{const n=String(null!=e?e:""),t=c(),o=a.value,l=o?null==r?void 0:r.get(o):void 0,h=null!=l?l:t;return i.value?n===h?(m(n),void(o&&(null==r||r.set(o,n)))):h&&n.startsWith(h)&&n.length>h.length?(s.value=h,d.value=n.slice(h.length),u.value+=1,void(o&&(null==r||r.set(o,n)))):(m(n),void(o&&(null==r||r.set(o,n)))):(m(n),void(o&&(null==r||r.set(o,n))))},{immediate:!0}),I(i,e=>{e||m(c())});const p=C(()=>u.value%2==0?"inline-code-stream-delta--a":"inline-code-stream-delta--b");return(e,n)=>(v(),f("code",Ve,[s.value?(v(),f("span",Ue,M(s.value),1)):j("",!0),d.value?(v(),f("span",{key:1,class:E(["inline-code-stream-delta",[p.value]]),onAnimationend:h},M(d.value),35)):j("",!0)]))}}),[["__scopeId","data-v-ffb68151"]]);Xe.install=e=>{e.component(Xe.__name,Xe)};const qe={class:"markstream-vue"},Ge=["id"],Ye=/* @__PURE__ */le(/* @__PURE__ */p({__name:"Tooltip",props:{visible:{type:Boolean},anchorEl:{},content:{},placement:{},offset:{},originX:{},originY:{},id:{},isDark:{type:[Boolean,null]}},setup(e){const n=e,t=C(()=>{if(void 0!==n.isDark&&null!==n.isDark)return Boolean(n.isDark);if("undefined"!=typeof document)try{if(document.documentElement.classList.contains("dark"))return!0;if((null==window?void 0:window.matchMedia)&&window.matchMedia("(prefers-color-scheme: dark)").matches)return!0}catch(e){}return!1}),o=B(null),r=B({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"}),l=B(!1);let i=null;function a(){return u(this,null,function*(){var e,t;if(!n.anchorEl||!o.value)return;const l=[ee(null!=(e=n.offset)?e:8),ne(),te({padding:8})],{x:i,y:a}=yield oe(n.anchorEl,o.value,{placement:null!=(t=n.placement)?t:"top",middleware:l,strategy:"fixed"});r.value.transform=`translate3d(${Math.round(i)}px, ${Math.round(a)}px, 0)`,r.value.left="0px",r.value.top="0px"})}return I(()=>n.visible,e=>u(null,null,function*(){if(e)if(l.value=!1,yield H(),n.anchorEl&&o.value)try{const e=n.anchorEl.getBoundingClientRect();yield a();const t=r.value.transform;if(null!=n.originX&&null!=n.originY){const o=Math.abs(Number(n.originX)-e.left),i=Math.abs(Number(n.originY)-e.top);Math.hypot(o,i)>120?(r.value.transform=`translate3d(${Math.round(n.originX)}px, ${Math.round(n.originY)}px, 0)`,yield H(),l.value=!0,yield H(),r.value.transform=t):l.value=!0}else l.value=!0;i=Q(n.anchorEl,o.value,a)}catch(t){yield a(),l.value=!0,i=Q(n.anchorEl,o.value,a)}else l.value=!0;else l.value=!1,i&&(i(),i=null)})),I([()=>n.anchorEl,()=>n.placement,()=>n.content],()=>u(null,null,function*(){n.visible&&n.anchorEl&&o.value&&(yield H(),yield a())})),$(()=>{i&&i()}),(i,a)=>(v(),P(D,{to:"body"},[k("div",qe,[y(R,{name:"tooltip",appear:""},{default:K(()=>[O(k("div",{id:n.id,ref_key:"tooltip",ref:o,style:W({position:"fixed",left:r.value.left,top:r.value.top,transform:r.value.transform}),class:E(["z-[9999] inline-block text-base py-2 px-3 rounded-md shadow-md whitespace-nowrap pointer-events-none tooltip-element border",[t.value?"bg-gray-900 text-white border-gray-700 border is-dark":"bg-white text-gray-900 border-gray-200 border"]]),role:"tooltip"},M(e.content),15,Ge),[[A,e.visible&&l.value]])]),_:1})])]))}}),[["__scopeId","data-v-d524cc01"]]),Ze=B(!1),Je=B(""),Qe=B("top"),en=B(null),nn=B(null),tn=B(null),on=B(null),rn=B(null);let ln=null,an=null;function sn(){ln&&(clearTimeout(ln),ln=null),an&&(clearTimeout(an),an=null)}let dn=!1;function un(e,n,t="top",o=!1,r,l){if(!e)return;!function(){if(!dn&&"undefined"!=typeof document)try{dn=!0;const e=document.createElement("div");e.setAttribute("data-singleton-tooltip","1"),document.body.appendChild(e),z({setup:()=>()=>{var e;return T(Ye,{visible:Ze.value,"anchor-el":en.value,content:Je.value,placement:Qe.value,id:nn.value,originX:tn.value,originY:on.value,isDark:null!=(e=rn.value)?e:void 0})}}).mount(e)}catch(e){dn=!1,console.warn("[markstream-vue] Failed to mount Tooltip component. Tooltips will be disabled.",e)}}(),sn();const i=()=>{var o,i;nn.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,en.value=e,Je.value=n,Qe.value=t,tn.value=null!=(o=null==r?void 0:r.x)?o:null,on.value=null!=(i=null==r?void 0:r.y)?i:null,rn.value="boolean"==typeof l?l:null,Ze.value=!0;try{e.setAttribute("aria-describedby",nn.value)}catch(a){}};o?i():ln=setTimeout(i,80)}function cn(e=!1){sn();const n=()=>{if(en.value&&nn.value)try{en.value.removeAttribute("aria-describedby")}catch(e){}Ze.value=!1,en.value=null,nn.value=null,tn.value=null,on.value=null};e?n():an=setTimeout(n,120)}const mn={"common.copy":"Copy","common.copied":"Copied","common.decrease":"Decrease","common.reset":"Reset","common.increase":"Increase","common.expand":"Expand","common.collapse":"Collapse","common.preview":"Preview","common.source":"Source","common.export":"Export","common.open":"Open","common.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."};function hn(e){Object.assign(mn,e)}function pn(){try{const n=globalThis.$vueI18nUse||null;if(n&&"function"==typeof n)try{const e=n();if(e&&"function"==typeof e.t)return{t:e.t.bind(e)}}catch(e){}}catch(e){}return u(null,null,function*(){try{const n=yield import("vue-i18n"),t=n.useI18n||n.default&&n.default.useI18n;if(t&&"function"==typeof t)try{const n=t();if(n&&"function"==typeof n.t)try{globalThis.$vueI18nUse=()=>n}catch(e){}}catch(e){}}catch(e){}}),{t:e=>{var n;return null!=(n=mn[e])?n:function(e){return(e.split(".").pop()||e).replace(/[_-]/g," ").replace(/([A-Z])/g," $1").replace(/\s+/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}(e)}}}const vn=/* @__PURE__ */Symbol("ViewportPriority");function fn(e,n){const t="undefined"!=typeof window&&"undefined"!=typeof document,o="boolean"==typeof n?B(n):n;let r=null,l=null;const i=/* @__PURE__ */new Map;const a=(n,a)=>{const s=B(!1);let d,u=!1;const c=new Promise(e=>{d=()=>{u||(u=!0,e())}}),m=()=>{try{null==r||r.unobserve(n)}catch(e){}if(i.delete(n),!i.size){try{null==r||r.disconnect()}catch(e){}r=null,l=null}};if(!t||!o.value)return s.value=!0,d(),{isVisible:s,whenVisible:c,destroy:m};const h=function(n,o){if(!t)return r;if("undefined"==typeof IntersectionObserver)return null;const a=function(n,t){var o,r,l;return{root:null!=(o=null==e?void 0:e(null!=n?n:null))?o:null,rootMargin:null!=(r=null==t?void 0:t.rootMargin)?r:"300px",threshold:null!=(l=null==t?void 0:t.threshold)?l:0}}(n,o);if(r&&(d=a,(s=l)&&s.root===d.root&&s.rootMargin===d.rootMargin&&s.threshold===d.threshold))return r;var s,d;if(r)try{r.disconnect()}catch(u){}r=new IntersectionObserver(e=>{for(const n of e){const e=i.get(n.target);if(e&&(n.isIntersecting||n.intersectionRatio>0)){if(!e.visible.value){e.visible.value=!0;try{e.resolve()}catch(u){}}null==r||r.unobserve(n.target),i.delete(n.target)}}},{root:a.root,rootMargin:a.rootMargin,threshold:a.threshold}),l=a;for(const e of i.keys())r.observe(e);return r}(n,a);return h?(i.set(n,{resolve:d,visible:s}),h.observe(n),{isVisible:s,whenVisible:c,destroy:m}):(s.value=!0,d(),{isVisible:s,whenVisible:c,destroy:m})};return F(vn,a),a}function gn(){const e=N(vn,void 0);if(e)return e;const n=/* @__PURE__ */new WeakMap;let t=null;return e=>{const o=B(!1);let r,l=!1;const i=new Promise(e=>{r=()=>{l||(l=!0,e())}}),a=()=>{try{null==t||t.unobserve(e)}catch(o){}n.delete(e)},s=t||("undefined"==typeof window||"undefined"==typeof IntersectionObserver?null:(t=new IntersectionObserver(e=>{for(const r of e){const e=n.get(r.target);if(e&&(r.isIntersecting||r.intersectionRatio>0)){if(!e.visible.value){e.visible.value=!0;try{e.resolve()}catch(o){}}null==t||t.unobserve(r.target),n.delete(r.target)}}},{root:null,rootMargin:"300px",threshold:0}),t));return s?(n.set(e,{resolve:r,visible:o}),s.observe(e),{isVisible:o,whenVisible:i,destroy:a}):(o.value=!0,r(),{isVisible:o,whenVisible:i,destroy:a})}}const yn={class:"relative inline-block"},wn=["src","alt","title","loading","tabindex","aria-label"],kn={class:"text-sm whitespace-nowrap"},xn={key:1,class:"text-sm text-gray-500"},bn={key:"error",class:"px-4 py-2 bg-gray-100 flex items-center justify-center rounded-lg gap-2 text-red-500"},Mn={class:"text-sm whitespace-nowrap"},_n={key:0,class:"mt-2 text-sm text-gray-500 italic"},Tn=/* @__PURE__ */le(/* @__PURE__ */p({__name:"ImageNode",props:{node:{},fallbackSrc:{default:""},showCaption:{type:Boolean,default:!1},lazy:{type:Boolean,default:!0},svgMinHeight:{default:"12rem"},usePlaceholder:{type:Boolean,default:!0}},emits:["load","error","click"],setup(e,{emit:n}){const t=e,o=n,r=B(!1),l=B(!1),i=B(!1),a=B(null),s=gn(),d=B(null),u=B("undefined"==typeof window);"undefined"!=typeof window&&I(()=>a.value,e=>{var n;if(null==(n=d.value)||n.destroy(),d.value=null,!e)return void(u.value=!1);const t=s(e,{rootMargin:"400px"});d.value=t,u.value=t.isVisible.value,t.whenVisible.then(()=>{u.value=!0})},{immediate:!0}),$(()=>{var e;null==(e=d.value)||e.destroy(),d.value=null});const c=C(()=>l.value&&t.fallbackSrc?t.fallbackSrc:t.node.src),m=C(()=>!t.lazy||u.value),h=C(()=>/\.svg(?:\?|$)/i.test(c.value));function p(){t.fallbackSrc&&!i.value?(i.value=!0,l.value=!0):(l.value=!0,o("error",t.node.src))}function g(){r.value=!0,l.value=!1,o("load",c.value)}function x(e){e.preventDefault(),r.value&&!l.value&&o("click",[e,c.value])}const{t:b}=pn();return I(c,()=>{r.value=!1,l.value=!1}),(n,o)=>(v(),f("figure",{ref_key:"figureRef",ref:a,class:"text-center my-8"},[k("div",yn,[y(R,{name:"img-switch",mode:"out-in"},{default:K(()=>{var i,a,s,d,u;return[e.node.loading||l.value||!m.value?l.value?e.node.loading||t.fallbackSrc?j("",!0):(v(),f("div",bn,[V(n.$slots,"error",{node:t.node,displaySrc:c.value,imageLoaded:r.value,hasError:l.value,fallbackSrc:t.fallbackSrc,lazy:t.lazy,isSvg:h.value},()=>[o[1]||(o[1]=k("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[k("path",{fill:"currentColor",d:"M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z"})],-1)),k("span",Mn,M(w(b)("image.loadError")),1)],!0)])):(v(),f("div",{key:"placeholder",class:"placeholder-layer max-w-96 inline-flex items-center justify-center gap-2",style:W(h.value?{minHeight:t.svgMinHeight,width:"100%"}:{minHeight:"6rem"})},[t.usePlaceholder?V(n.$slots,"placeholder",{key:0,node:t.node,displaySrc:c.value,imageLoaded:r.value,hasError:l.value,fallbackSrc:t.fallbackSrc,lazy:t.lazy,isSvg:h.value},()=>[o[0]||(o[0]=k("div",{class:"w-4 h-4 rounded-full border-2 border-solid border-current border-t-transparent animate-spin","aria-hidden":"true"},null,-1)),k("span",kn,M(w(b)("image.loading")),1)],!0):(v(),f("span",xn,M(e.node.raw),1))],4)):(v(),f("img",{key:"image",src:c.value,alt:String(null!=(a=null!=(i=t.node.alt)?i:t.node.title)?a:""),title:String(null!=(d=null!=(s=t.node.title)?s:t.node.alt)?d:""),class:E(["max-w-96 h-auto rounded-lg transition-opacity duration-200 ease-in-out",{"opacity-0":!r.value,"opacity-100":r.value,"cursor-pointer":r.value}]),style:W(h.value?{minHeight:t.svgMinHeight,width:"100%",height:"auto",objectFit:"contain"}:void 0),loading:t.lazy?"lazy":"eager",decoding:"async",tabindex:r.value?0:-1,"aria-label":null!=(u=t.node.alt)?u:w(b)("image.preview"),onError:p,onLoad:g,onClick:x},null,46,wn))]}),_:3})]),t.showCaption&&t.node.alt?(v(),f("figcaption",_n,M(t.node.alt),1)):j("",!0)],512))}}),[["__scopeId","data-v-7ca79b66"]]);Tn.install=e=>{e.component(Tn.__name,Tn)};let Cn=null,Bn=!1,In=En;function Sn(e){var n;const t=null!=(n=null==e?void 0:e.default)?n:e;return t&&"function"==typeof t.renderToString?t:null}function $n(){try{const e=globalThis;return Sn(null==e?void 0:e.katex)}catch(e){return null}}function En(){return u(null,null,function*(){const e=$n();if(e)return e;const n=yield import("katex");try{yield import("katex/dist/contrib/mhchem")}catch(t){}return Sn(n)})}function Ln(e){In=e,Cn=null,Bn=!1}function Nn(e){Ln(null!=e?e:En)}function jn(){Ln(null)}function Hn(){return"function"==typeof In}function Pn(){return u(this,null,function*(){var e;const n=$n();if(n)return Cn=n,Cn;if(Cn)return Cn;if(Bn)return null;const t=In;if(!t)return Bn=!0,null;try{const n=yield t();if(n)return Cn=null!=(e=Sn(n))?e:n,Cn}catch(o){}return Bn=!0,null})}const Dn=_(!1);let Rn=null;const Kn={key:0},On=/* @__PURE__ */le(/* @__PURE__ */p({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const n=e,t=(Rn||(Rn=Pn().then(e=>{Dn.value=!!e}).catch(()=>{Dn.value=!1})),U(Dn)),o=L(),r=N("markstreamTypewriter",void 0),l=N("markstreamTextStreamState",void 0),i=C(()=>{const e=o.typewriter;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),a=C(()=>"boolean"==typeof i.value?i.value:"boolean"!=typeof(null==r?void 0:r.value)||r.value),s=C(()=>{var e;const n=null!=(e=o["index-key"])?e:o.indexKey;return null==n||""===n?"":String(n)}),d=B(n.node.content),u=B(""),c=B(0);function m(){return d.value+u.value}function h(e){d.value=e,u.value=""}function p(){u.value&&(d.value=m(),u.value="")}I([()=>n.node.content,s,a],([e])=>{const n=String(null!=e?e:""),t=m(),o=s.value,r=o?null==l?void 0:l.get(o):void 0,i=null!=r?r:t;return a.value?n===i?(h(n),void(o&&(null==l||l.set(o,n)))):i&&n.startsWith(i)&&n.length>i.length?(d.value=i,u.value=n.slice(i.length),c.value+=1,void(o&&(null==l||l.set(o,n)))):(h(n),void(o&&(null==l||l.set(o,n)))):(h(n),void(o&&(null==l||l.set(o,n))))},{immediate:!0}),I(a,e=>{e||h(m())});const g=C(()=>c.value%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b");return(n,o)=>(v(),f("span",{class:E([[w(t)&&e.node.center?"text-node-center":""],"whitespace-pre-wrap break-words text-node"])},[d.value?(v(),f("span",Kn,M(d.value),1)):j("",!0),u.value?(v(),f("span",{key:1,class:E(["text-node-stream-delta",[g.value]]),onAnimationend:p},M(u.value),35)):j("",!0)],2))}}),[["__scopeId","data-v-eb9e0d92"]]);On.install=e=>{e.component(On.__name,On)};const Wn=X(()=>u(null,null,function*(){var e,n;if("undefined"!=typeof globalThis&&void 0!==globalThis.process&&"test"===(null==(n=null==(e=globalThis.process)?void 0:e.env)?void 0:n.NODE_ENV))return e=>{var n,t;return T(On,s(a({},e),{node:s(a({},e.node),{content:null!=(t=e.node.raw)?t:`$${null!=(n=e.node.content)?n:""}$`})}))};try{if(yield Pn())return(yield import("./index2.js")).default}catch(t){console.warn('[markstream-vue] Optional peer dependencies for MathInlineNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',t)}return e=>{var n,t;return T(On,s(a({},e),{node:s(a({},e.node),{content:null!=(t=e.node.raw)?t:`$${null!=(n=e.node.content)?n:""}$`})}))}})),An=X(()=>u(null,null,function*(){try{if(yield Pn())return(yield import("./index3.js")).default}catch(e){console.warn('[markstream-vue] Optional peer dependencies for MathBlockNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',e)}return e=>{var n,t;return T(On,s(a({},e),{node:s(a({},e.node),{content:null!=(t=e.node.raw)?t:`$$${null!=(n=e.node.content)?n:""}$$`})}))}})),zn=/* @__PURE__ */p({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(n,t)=>(v(),f("span",{class:"reference-node cursor-pointer bg-[hsl(var(--muted))] text-[hsl(var(--muted-foreground))] text-xs rounded-md px-1.5 mx-0.5 hover:bg-[hsl(var(--secondary))]",role:"button",tabindex:"0",onClick:t[0]||(t[0]=t=>n.$emit("click",t,e.node.id,e.messageId,e.threadId)),onMouseenter:t[1]||(t[1]=t=>n.$emit("mouseEnter",t,e.node.id,e.messageId,e.threadId)),onMouseleave:t[2]||(t[2]=t=>n.$emit("mouseLeave",t,e.node.id,e.messageId,e.threadId))},M(e.node.id),33))});zn.install=e=>{e.component(zn.__name,zn)};const Fn={class:"superscript-node"},Vn={key:1},Un=/* @__PURE__ */le(/* @__PURE__ */p({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=xe(n.customId),o=a({text:On,inline_code:Xe,link:rt,html_inline:Fe,strong:Zn,emphasis:ut,footnote_reference:Ce,strikethrough:Qn,highlight:st,insert:it,subscript:Gn,emoji:ve,math_inline:Wn,reference:zn},t);return(t,r)=>(v(),f("sup",Fn,[(v(!0),f(x,null,b(e.node.children,(t,r)=>(v(),f(x,{key:`${e.indexKey||"superscript"}-${r}`},[o[t.type]?(v(),P(q(o[t.type]),{key:0,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"superscript"}-${r}`},null,8,["node","custom-id","index-key"])):(v(),f("span",Vn,M(t.content||t.raw),1))],64))),128))]))}}),[["__scopeId","data-v-6dc1e3ba"]]);Un.install=e=>{e.component(Un.__name,Un)};const Xn={class:"subscript-node"},qn={key:1},Gn=/* @__PURE__ */le(/* @__PURE__ */p({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=xe(n.customId),o=a({text:On,inline_code:Xe,link:rt,html_inline:Fe,strong:Zn,emphasis:ut,footnote_reference:Ce,strikethrough:Qn,highlight:st,insert:it,superscript:Un,emoji:ve,math_inline:Wn,reference:zn},t);return(t,r)=>(v(),f("sub",Xn,[(v(!0),f(x,null,b(e.node.children,(t,r)=>(v(),f(x,{key:`${e.indexKey||"subscript"}-${r}`},[o[t.type]?(v(),P(q(o[t.type]),{key:0,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"subscript"}-${r}`},null,8,["node","custom-id","index-key"])):(v(),f("span",qn,M(t.content||t.raw),1))],64))),128))]))}}),[["__scopeId","data-v-69de9b81"]]);Gn.install=e=>{e.component(Gn.__name,Gn)};const Yn={class:"strong-node"},Zn=/* @__PURE__ */le(/* @__PURE__ */p({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=xe(n.customId),o=a({text:On,inline_code:Xe,link:rt,html_inline:Fe,emphasis:ut,strikethrough:Qn,highlight:st,insert:it,subscript:Gn,superscript:Un,emoji:ve,footnote_reference:Ce,math_inline:Wn,reference:zn},t);return(t,r)=>(v(),f("strong",Yn,[(v(!0),f(x,null,b(e.node.children,(t,r)=>(v(),P(q(o[t.type]),{key:`${e.indexKey||"strong"}-${r}`,"index-key":`${e.indexKey||"strong"}-${r}`,node:t,"custom-id":n.customId},null,8,["index-key","node","custom-id"]))),128))]))}}),[["__scopeId","data-v-af3ce037"]]);Zn.install=e=>{e.component(Zn.__name,Zn)};const Jn={class:"strikethrough-node"},Qn=/* @__PURE__ */le(/* @__PURE__ */p({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=xe(n.customId),o=a({text:On,inline_code:Xe,link:rt,html_inline:Fe,strong:Zn,emphasis:ut,highlight:st,insert:it,subscript:Gn,superscript:Un,emoji:ve,footnote_reference:Ce,math_inline:Wn,reference:zn},t);return(t,r)=>(v(),f("del",Jn,[(v(!0),f(x,null,b(e.node.children,(t,r)=>(v(),P(q(o[t.type]),{key:`${e.indexKey||"strikethrough"}-${r}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"strikethrough"}-${r}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-904d5bd1"]]);Qn.install=e=>{e.component(Qn.__name,Qn)};const et=["href","title","aria-label","aria-hidden"],nt=["aria-hidden"],tt={class:"link-text-wrapper relative inline-flex"},ot={class:"leading-[normal] link-text"},rt=/* @__PURE__ */le(/* @__PURE__ */p({__name:"LinkNode",props:{node:{},indexKey:{},customId:{},showTooltip:{type:Boolean,default:!0},color:{},underlineHeight:{},underlineBottom:{},animationDuration:{},animationOpacity:{},animationTiming:{},animationIteration:{}},setup(e){const n=e,t=N("markstreamShowTooltips",void 0),o=C(()=>{const e=null==t?void 0:t.value;return"boolean"==typeof e?e:n.showTooltip}),r=C(()=>{var e,t,o,r,l,i;const a=void 0!==n.underlineBottom?"number"==typeof n.underlineBottom?`${n.underlineBottom}px`:String(n.underlineBottom):"-3px",s=null!=(e=n.animationOpacity)?e:.35,d=Math.max(.12,Math.min(.5*s,s));return{"--link-color":null!=(t=n.color)?t:"#0366d6","--underline-height":`${null!=(o=n.underlineHeight)?o:2}px`,"--underline-bottom":a,"--underline-opacity":String(s),"--underline-rest-opacity":String(d),"--underline-duration":`${null!=(r=n.animationDuration)?r:1.6}s`,"--underline-timing":null!=(l=n.animationTiming)?l:"ease-in-out","--underline-iteration":"number"==typeof n.animationIteration?String(n.animationIteration):null!=(i=n.animationIteration)?i:"infinite"}}),l={text:On,strong:Zn,strikethrough:Qn,emphasis:ut,image:Tn,html_inline:Fe,inline_code:Xe},i=C(()=>(we.value,xe(n.customId))),s=L(),d=C(()=>{var e,t;const o=null==(e=n.node)?void 0:e.attrs;if(!o||"object"!=typeof o)return{};const r={};if(Array.isArray(o))for(const n of o)Array.isArray(n)&&n[0]&&(r[String(n[0])]=String(null!=(t=n[1])?t:""));else for(const[n,l]of Object.entries(o))n&&null!=l&&!1!==l&&(r[n]=!0===l?"":String(l));return Re(r)}),u=C(()=>{const e=a(a({},s),d.value);return delete e.title,e});function c(){o.value&&cn()}const m=C(()=>{var e,t,o;const r=null==(e=n.node)?void 0:e.title;return"string"==typeof r&&r.trim().length>0?r:String(null!=(o=null==(t=n.node)?void 0:t.href)?o:"")});return(t,a)=>{var d,h;return e.node.loading?(v(),f("span",G({key:1,class:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":e.node.loading?"false":"true"},w(s),{style:r.value}),[k("span",tt,[k("span",ot,[y(w(On),{class:"leading-[normal] link-text",node:{type:"text",content:String(null!=(d=e.node.text)?d:""),raw:String(null!=(h=e.node.text)?h:"")},"index-key":`${e.indexKey||"link-text"}-loading`},null,8,["node","index-key"])]),a[1]||(a[1]=k("span",{class:"link-loading-indicator","aria-hidden":"true"},null,-1))])],16,nt)):(v(),f("a",G({key:0,class:"link-node",href:e.node.href,title:o.value?"":m.value,"aria-label":`Link: ${m.value}`,"aria-hidden":e.node.loading?"true":"false",target:"_blank",rel:"noopener noreferrer"},u.value,{style:r.value,onMouseenter:a[0]||(a[0]=e=>function(e){var t,r,l;if(!o.value)return;const i=e,a=null!=(null==i?void 0:i.clientX)&&null!=(null==i?void 0:i.clientY)?{x:i.clientX,y:i.clientY}:void 0,s=(null==(t=n.node)?void 0:t.title)||(null==(r=n.node)?void 0:r.href)||(null==(l=n.node)?void 0:l.text)||"";un(e.currentTarget,s,"top",!1,a)}(e)),onMouseleave:c}),[(v(!0),f(x,null,b(e.node.children,(t,o)=>(v(),P(q(function(e){return i.value[e.type]||l[e.type]||null}(t)),{key:`${e.indexKey||"emphasis"}-${o}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"link-text"}-${o}`},null,8,["node","custom-id","index-key"]))),128))],16,et))}}}),[["__scopeId","data-v-a4831c9e"]]);rt.install=e=>{e.component(rt.__name,rt)};const lt={class:"insert-node"},it=/* @__PURE__ */le(/* @__PURE__ */p({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=xe(n.customId),o=a({text:On,inline_code:Xe,link:rt,html_inline:Fe,strong:Zn,emphasis:ut,strikethrough:Qn,highlight:st,subscript:Gn,superscript:Un,emoji:ve,footnote_reference:Ce,math_inline:Wn,reference:zn},t);return(t,r)=>(v(),f("ins",lt,[(v(!0),f(x,null,b(e.node.children,(t,r)=>(v(),P(q(o[t.type]),{key:`${e.indexKey||"insert"}-${r}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"insert"}-${r}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-ab1ec9bc"]]);it.install=e=>{e.component(it.__name,it)};const at={class:"highlight-node"},st=/* @__PURE__ */le(/* @__PURE__ */p({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=xe(n.customId),o=a({text:On,inline_code:Xe,link:rt,html_inline:Fe,strong:Zn,emphasis:ut,strikethrough:Qn,insert:it,subscript:Gn,superscript:Un,emoji:ve,footnote_reference:Ce,math_inline:Wn,reference:zn},t);return(t,r)=>(v(),f("mark",at,[(v(!0),f(x,null,b(e.node.children,(t,r)=>(v(),P(q(o[t.type]),{key:`${e.indexKey||"highlight"}-${r}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"highlight"}-${r}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-38e31bf6"]]);st.install=e=>{e.component(st.__name,st)};const dt={class:"emphasis-node"},ut=/* @__PURE__ */le(/* @__PURE__ */p({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=xe(n.customId),o=a({text:On,inline_code:Xe,link:rt,html_inline:Fe,strong:Zn,strikethrough:Qn,highlight:st,insert:it,subscript:Gn,superscript:Un,emoji:ve,footnote_reference:Ce,math_inline:Wn,reference:zn},t);return(t,r)=>(v(),f("em",dt,[(v(!0),f(x,null,b(e.node.children,(t,r)=>(v(),P(q(o[t.type]),{key:`${e.indexKey||"emphasis"}-${r}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"emphasis"}-${r}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-8264674d"]]);ut.install=e=>{e.component(ut.__name,ut)};const ct=["href","title"],mt=/* @__PURE__ */le(/* @__PURE__ */p({__name:"FootnoteAnchorNode",props:{node:{}},setup(e){const n=e;function t(e){var t;if(e.preventDefault(),"undefined"==typeof document)return;const o=`fnref-${String(null!=(t=n.node.id)?t:"")}`,r=document.getElementById(o);r&&r.scrollIntoView({behavior:"smooth"})}return(n,o)=>(v(),f("a",{class:"footnote-anchor text-sm text-[#0366d6] hover:underline cursor-pointer",href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:t}," ↩︎ ",8,ct))}}),[["__scopeId","data-v-4756ce0d"]]);mt.install=e=>{e.component(mt.__name,mt)};const ht=["id"],pt={class:"flex-1"},vt=/* @__PURE__ */p({__name:"FootnoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(v(),f("div",{id:`fnref--${e.node.id}`,class:"flex mt-2 mb-2 text-sm leading-relaxed border-t border-[#eaecef] pt-2"},[k("div",pt,[g([n.node.children],()=>y(w(zt),{"index-key":`footnote-${n.indexKey}`,nodes:n.node.children,"custom-id":n.customId,typewriter:n.typewriter,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))},null,8,["index-key","nodes","custom-id","typewriter"]),o,1)])],8,ht))}});vt.install=e=>{e.component(vt.__name,vt)};const ft={class:"hard-break"},gt=/* @__PURE__ */le(/* @__PURE__ */p({__name:"HardBreakNode",props:{node:{}},setup:e=>(e,n)=>(v(),f("br",ft))}),[["__scopeId","data-v-50c58f70"]]);gt.install=e=>{e.component(gt.__name,gt)};const yt=/* @__PURE__ */le(/* @__PURE__ */p({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=xe(n.customId),o=a({text:On,inline_code:Xe,link:rt,image:Tn,strong:Zn,emphasis:ut,strikethrough:Qn,highlight:st,insert:it,subscript:Gn,superscript:Un,emoji:ve,checkbox:de,checkbox_input:de,footnote_reference:Ce,hardbreak:gt,math_inline:Wn,reference:zn},t);return(t,r)=>g([e.node.level,e.node.children,e.node.attrs],()=>(v(),P(q(`h${e.node.level}`),G({class:["heading-node",[`heading-${e.node.level}`]],dir:"auto"},e.node.attrs),{default:K(()=>[(v(!0),f(x,null,b(e.node.children,(t,r,l,i)=>{const a=[t];if(i&&i.key===`${e.indexKey||"heading"}-${r}`&&Y(i,a))return i;const s=(v(),P(q(o[t.type]),{key:`${e.indexKey||"heading"}-${r}`,"custom-id":n.customId,node:t,"index-key":`${e.indexKey||"heading"}-${r}`},null,8,["custom-id","node","index-key"]));return s.memo=a,s},r,0),128))]),_:1},16,["class"])),r,2)}}),[["__scopeId","data-v-af2f957a"]]),wt=yt;wt.install=e=>{e.component(yt.__name,yt)};const kt=/* @__PURE__ */le(/* @__PURE__ */p({__name:"ListItemNode",props:{node:{},item:{},indexKey:{},value:{},customId:{},typewriter:{type:Boolean},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=e,t=C(()=>{var e;return null!=(e=n.node)?e:n.item}),o=C(()=>null==n.value?{}:{value:n.value});return(e,r)=>{var l;return v(),f("li",G({class:"list-item pl-1.5 my-2",dir:"auto"},o.value),[g([null==(l=t.value)?void 0:l.children],()=>{var o,l;return y(w(zt),G({showTooltips:n.showTooltips},{"index-key":`list-item-${n.indexKey}`,nodes:null!=(l=null==(o=t.value)?void 0:o.children)?l:[],"custom-id":n.customId,typewriter:n.typewriter,"batch-rendering":!1,onCopy:r[0]||(r[0]=n=>e.$emit("copy",n))}),null,16,["index-key","nodes","custom-id","typewriter"])},r,1)],16)}}}),[["__scopeId","data-v-1410f3a8"]]);kt.install=e=>{e.component(kt.__name,kt)};const xt=/* @__PURE__ */le(/* @__PURE__ */p({__name:"ListNode",props:{node:{},customId:{},indexKey:{},typewriter:{type:Boolean},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=C(()=>(we.value,xe(e.customId).list_item||kt));return(t,o)=>(v(),P(q(e.node.ordered?"ol":"ul"),{class:E(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:K(()=>[(v(!0),f(x,null,b(e.node.items,(r,l,i,a)=>{var s;const d=[r];if(a&&a.key===`${e.indexKey||"list"}-${l}`&&Y(a,d))return a;const u=(v(),P(q(n.value),G({key:`${e.indexKey||"list"}-${l}`},{ref_for:!0},{showTooltips:e.showTooltips},{node:r,"custom-id":e.customId,"index-key":`${e.indexKey||"list"}-${l}`,typewriter:e.typewriter,value:e.node.ordered?(null!=(s=e.node.start)?s:1)+l:void 0,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))}),null,16,["node","custom-id","index-key","typewriter","value"]));return u.memo=d,u},o,1),128))]),_:1},8,["class"]))}}),[["__scopeId","data-v-ce9c5cfb"]]);xt.install=e=>{e.component(xt.__name,xt)};const bt={key:1,class:"html-block-node__raw"},Mt={key:1,class:"html-block-node__placeholder"},_t=/* @__PURE__ */le(/* @__PURE__ */p({__name:"HtmlBlockNode",props:{node:{},customId:{}},setup(e){const n=e,t=C(()=>{const e=n.node.attrs;if(e){if(Array.isArray(e)){const n={};for(const t of e){if(!t||t.length<2)continue;const[e,o]=t;null!=e&&(n[String(e)]=null==o?"":String(o))}return n}return e}}),o=C(()=>(we.value,xe(n.customId))),r=p({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),l=B(null),i=B("undefined"==typeof window),a=B(n.node.content),s=C(()=>{var e,t,r;if(!i.value)return{mode:"html",content:null!=(e=a.value)?e:""};const l=null!=(t=a.value)?t:n.node.content;if(!l)return{mode:"html",content:""};if(n.node.loading){const e=ze(l,o.value);return null===e?{mode:"text",content:null!=(r=n.node.raw)?r:l}:{mode:"dynamic",nodes:e}}if(!Ae(l,o.value))return{mode:"html",content:l};const s=ze(l,o.value);return null===s?{mode:"html",content:l}:{mode:"dynamic",nodes:s}}),d=gn(),u=B(null),c=!!n.node.loading;return"undefined"!=typeof window?(I(l,e=>{var t,o;if(null==(o=null==(t=u.value)?void 0:t.destroy)||o.call(t),u.value=null,!c)return i.value=!0,void(a.value=n.node.content);if(!e)return void(i.value=!1);const r=d(e,{rootMargin:"400px"});u.value=r,i.value=r.isVisible.value,r.whenVisible.then(()=>{i.value=!0})},{immediate:!0}),I(()=>n.node.content,e=>{c&&!i.value||(a.value=e)})):i.value=!0,$(()=>{var e,n;null==(n=null==(e=u.value)?void 0:e.destroy)||n.call(e),u.value=null}),(n,o)=>(v(),f("div",G({ref_key:"htmlRef",ref:l,class:"html-block-node"},t.value),[i.value?(v(),f(x,{key:0},["dynamic"===s.value.mode?(v(),P(w(r),{key:0,nodes:s.value.nodes},null,8,["nodes"])):"text"===s.value.mode?(v(),f("pre",bt,M(s.value.content),1)):g([a.value],()=>(v(),f("div",{key:2,innerHTML:a.value},null,8,["innerHTML"])),o,0)],64)):(v(),f("div",Mt,[V(n.$slots,"placeholder",{node:e.node},()=>[o[1]||(o[1]=k("span",{class:"html-block-node__placeholder-bar"},null,-1)),o[2]||(o[2]=k("span",{class:"html-block-node__placeholder-bar w-4/5"},null,-1)),o[3]||(o[3]=k("span",{class:"html-block-node__placeholder-bar w-2/3"},null,-1))],!0)]))],16))}}),[["__scopeId","data-v-6797fa3c"]]);_t.install=e=>{e.component(_t.__name,_t)};const Tt={dir:"auto",class:"paragraph-node"},Ct=/* @__PURE__ */le(/* @__PURE__ */p({__name:"ParagraphNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=xe(n.customId),o=a({inline_code:Xe,image:Tn,link:rt,hardbreak:gt,emphasis:ut,strong:Zn,strikethrough:Qn,highlight:st,insert:it,subscript:Gn,superscript:Un,html_inline:Fe,html_block:_t,emoji:ve,checkbox:de,math_inline:Wn,checkbox_input:de,reference:zn,footnote_anchor:mt,footnote_reference:Ce,text:On},t);return(t,r)=>(v(),f("p",Tt,[(v(!0),f(x,null,b(e.node.children,(t,r)=>(v(),P(q(o[t.type]),{key:`${e.indexKey||"paragraph"}-${r}`,node:t,"index-key":`${e.indexKey}-${r}`,"custom-id":n.customId},null,8,["node","index-key","custom-id"]))),128))]))}}),[["__scopeId","data-v-42e270e7"]]);Ct.install=e=>{e.component(Ct.__name,Ct)};const Bt=["aria-busy","aria-label","data-language"],It=["textContent"],St=/* @__PURE__ */p({__name:"PreCodeNode",props:{node:{}},setup(e){const n=e,t=C(()=>{var e,t,o;const r=String(null!=(t=null==(e=n.node)?void 0:e.language)?t:"");return String(null!=(o=String(r).split(/\s+/g)[0])?o:"").toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}),o=C(()=>`language-${t.value}`),r=C(()=>{const e=t.value;return e?`Code block: ${e}`:"Code block"});return(n,l)=>(v(),f("pre",{class:E([o.value]),"aria-busy":!0===e.node.loading,"aria-label":r.value,"data-language":t.value,tabindex:"0"},[k("code",{translate:"no",textContent:M(e.node.code)},null,8,It)],10,Bt))}});St.install=e=>{e.component(St.__name,St)};const $t={class:"table-node-wrapper"},Et=["aria-busy"],Lt={class:"border-[var(--table-border,#cbd5e1)]"},Nt={class:"border-b"},jt={key:0,class:"table-node__loading",role:"status","aria-live":"polite"},Ht=/* @__PURE__ */le(/* @__PURE__ */p({__name:"TableNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e,t=C(()=>{var e;return null!=(e=n.node.loading)&&e}),o=C(()=>{var e;return null!=(e=n.node.rows)?e:[]});return(r,l)=>(v(),f("div",$t,[k("table",{class:E(["my-8 text-sm table-node",{"table-node--loading":t.value}]),"aria-busy":t.value},[k("thead",Lt,[k("tr",Nt,[(v(!0),f(x,null,b(e.node.header.cells,(e,t)=>(v(),f("th",{key:`header-${t}`,dir:"auto",class:E(["font-semibold p-[calc(4/7*1em)]",["right"===e.align?"text-right":"center"===e.align?"text-center":"text-left"]])},[y(w(zt),{nodes:e.children,"index-key":`table-th-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,onCopy:l[0]||(l[0]=e=>r.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter"])],2))),128))])]),k("tbody",null,[(v(!0),f(x,null,b(o.value,(e,t)=>(v(),f("tr",{key:`row-${t}`,class:E(["border-[var(--table-border,#cbd5e1)]",[t<o.value.length-1?"border-b":""]])},[(v(!0),f(x,null,b(e.cells,(e,o)=>(v(),f("td",{key:`cell-${t}-${o}`,class:E(["p-[calc(4/7*1em)]",["right"===e.align?"text-right":"center"===e.align?"text-center":"text-left"]]),dir:"auto"},[y(w(zt),{nodes:e.children,"index-key":`table-td-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,onCopy:l[1]||(l[1]=e=>r.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter"])],2))),128))],2))),128))])],10,Et),y(R,{name:"table-node-fade"},{default:K(()=>[t.value?(v(),f("div",jt,[V(r.$slots,"loading",{isLoading:t.value},()=>[l[2]||(l[2]=k("span",{class:"table-node__spinner animate-spin","aria-hidden":"true"},null,-1)),l[3]||(l[3]=k("span",{class:"sr-only"},"Loading",-1))],!0)])):j("",!0)]),_:3})]))}}),[["__scopeId","data-v-369096fa"]]);Ht.install=e=>{e.component(Ht.__name,Ht)};const Pt={class:"hr-node"},Dt=/* @__PURE__ */le({},[["render",function(e,n){return v(),f("hr",Pt)}],["__scopeId","data-v-639cbad9"]]);Dt.install=e=>{e.component(Dt.__name,Dt)};const Rt={class:"unknown-node"},Kt=/* @__PURE__ */p({__name:"FallbackComponent",props:{node:{}},setup:e=>(n,t)=>(v(),f("div",Rt,M(e.node.raw),1))}),Ot=/* @__PURE__ */le(/* @__PURE__ */p({__name:"VmrContainerNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},customId:{}},setup(e){const n=e,t=C(()=>`vmr-container vmr-container-${n.node.name}`),o=xe(n.customId),r=a({text:On,paragraph:Ct,heading:wt,inline_code:Xe,link:rt,image:Tn,strong:Zn,emphasis:ut,strikethrough:Qn,insert:it,subscript:Gn,superscript:Un,checkbox:de,checkbox_input:de,hardbreak:gt,math_inline:Wn,reference:zn,list:xt,math_block:An,table:Ht},o);return(o,l)=>(v(),f("div",G({class:t.value},e.node.attrs),[(v(!0),f(x,null,b(e.node.children,(t,o,l,i)=>{const a=[t];if(i&&i.key===`${e.indexKey||"vmr-container"}-${o}`&&Y(i,a))return i;const s=(v(),P(q((d=t.type,r[d]||Kt)),{key:`${e.indexKey||"vmr-container"}-${o}`,"custom-id":n.customId,node:t,"index-key":`${e.indexKey||"vmr-container"}-${o}`},null,8,["custom-id","node","index-key"]));var d;return s.memo=a,s},l,0),128))],16))}}),[["__scopeId","data-v-fac7405d"]]);Ot.install=e=>{e.component(Ot.__name,Ot)};const Wt=["data-custom-id"],At=["data-node-index","data-node-type"],zt=/* @__PURE__ */le(/* @__PURE__ */p({__name:"NodeRenderer",props:{content:{},nodes:{},final:{type:Boolean},parseOptions:{},customMarkdownIt:{},debugPerformance:{type:Boolean,default:!1},customHtmlTags:{},viewportPriority:{type:Boolean},codeBlockStream:{type:Boolean,default:!0},codeBlockDarkTheme:{},codeBlockLightTheme:{},codeBlockMonacoOptions:{},renderCodeBlocksAsPre:{type:Boolean},codeBlockMinWidth:{},codeBlockMaxWidth:{},codeBlockProps:{},mermaidProps:{},d2Props:{},infographicProps:{},showTooltips:{type:Boolean,default:!0},themes:{},isDark:{type:Boolean},customId:{},indexKey:{},typewriter:{type:Boolean,default:!0},batchRendering:{type:Boolean,default:!0},initialRenderBatchSize:{default:40},renderBatchSize:{default:80},renderBatchDelay:{default:16},renderBatchBudgetMs:{default:6},renderBatchIdleTimeoutMs:{default:120},deferNodesUntilVisible:{type:Boolean,default:!0},maxLiveNodes:{default:320},liveNodeBuffer:{default:60}},emits:["copy","handleArtifactClick","click","mouseover","mouseout"],setup(e,{emit:n}){var t,o,r;const l=e,i=n,d=B(),h=B(!1),p=/auto|scroll|overlay/i,g="undefined"!=typeof window,y=C(()=>l.debugPerformance&&g&&"undefined"!=typeof console),w=L(),k=/* @__PURE__ */new Map,M=C(()=>{var e;if("boolean"==typeof l.showTooltips)return l.showTooltips;const n=null!=(e=w.showTooltips)?e:w["show-tooltips"];return""===n||!0===n||"true"===n||!1!==n&&"false"!==n&&void 0});function _(e,n){y.value&&console.info(`[markstream-vue][perf] ${e}`,n)}function T(e){if(!e)return!1;const n=(e.overflowY||"").toLowerCase(),t=(e.overflow||"").toLowerCase();return p.test(n)||p.test(t)}function S(e){const n=Math.ceil(e.scrollHeight)>Math.ceil(e.clientHeight)+1,t=Math.ceil(e.scrollWidth)>Math.ceil(e.clientWidth)+1;return n||t}function N(e){if("undefined"==typeof window)return null;const n=null!=e?e:d.value;if(!n)return null;const t=n.ownerDocument||document,o=t.scrollingElement||t.documentElement;let r=n;for(;r&&r!==t.body&&r!==o;){if(T(window.getComputedStyle(r))&&S(r))return r;r=r.parentElement}return null}F("markstreamShowTooltips",M),F("markstreamTypewriter",C(()=>!1!==l.typewriter)),F("markstreamTextStreamState",k);const D=l.customId?`renderer-${l.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,O=c(D),A=/* @__PURE__ */new Map,z=C(()=>{const{key:e,tags:n}=function(e){if(!e||0===e.length)return{key:"",tags:[]};const n=/* @__PURE__ */new Set,t=[];for(const o of e){const e=U(o);e&&!n.has(e)&&(n.add(e),t.push(e))}return 0===t.length?{key:"",tags:[]}:{key:t.join(","),tags:t}}(l.customHtmlTags);if(!e)return O;const t=A.get(e);if(t)return t;const o=c(D,{customHtmlTags:n});return A.set(e,o),o}),V=C(()=>{const e=z.value;return l.customMarkdownIt?l.customMarkdownIt(e):e});function U(e){const n=String(null!=e?e:"").trim();if(!n)return"";const t=n.match(/^[<\s/]*([A-Z][\w-]*)/i);return t?t[1].toLowerCase():""}const Y=C(()=>{var e,n,t,o;const r=null!=(e=l.parseOptions)?e:{},i=null!=(n=l.final)?n:r.final,s=[...null!=(t=l.customHtmlTags)?t:[],...null!=(o=r.customHtmlTags)?o:[]].map(U).filter(Boolean),d=null!=i,u=s.length>0;return d||u?a(a(a({},r),d?{final:i}:{}),u?{customHtmlTags:Array.from(new Set(s))}:{}):r}),Q=C(()=>{var e;if(null==(e=l.nodes)?void 0:e.length)return Z(l.nodes.slice());if(l.content){const e=y.value?performance.now():0,n=m(l.content,V.value,Y.value);return y.value&&_("parse(sync)",{ms:Math.round(performance.now()-e),nodes:n.length,contentLength:l.content.length}),Z(n)}return[]}),ee=C(()=>{var e;return Math.max(1,null!=(e=l.maxLiveNodes)?e:320)}),ne=C(()=>{var e;return!((null!=(e=l.maxLiveNodes)?e:0)<=0)&&Q.value.length>ee.value}),te=C(()=>!1!==l.viewportPriority&&!h.value),oe=fn(e=>{var n;return N(null!=(n=null!=e?e:d.value)?n:null)},te),re=g&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame.bind(window):null,le=g&&"function"==typeof window.cancelAnimationFrame?window.cancelAnimationFrame.bind(window):null,ae="undefined"!=typeof globalThis&&void 0!==globalThis.process&&"test"===(null==(o=null==(t=globalThis.process)?void 0:t.env)?void 0:o.NODE_ENV),se=g&&"function"==typeof window.requestIdleCallback,ue=C(()=>{var e;const n=Math.trunc(null!=(e=l.renderBatchSize)?e:80);return Number.isFinite(n)?Math.max(0,n):0}),ce=C(()=>{var e;const n=Math.trunc(null!=(e=l.initialRenderBatchSize)?e:ue.value);return Number.isFinite(n)?Math.max(0,n):ue.value}),me=C(()=>!1!==l.batchRendering&&ue.value>0&&g&&!ae),pe=B(0),fe=B({key:l.indexKey,total:0}),ge=B(Math.max(1,ue.value||1)),ye=B(/* @__PURE__ */new Set),ke=/* @__PURE__ */new Map,be=/* @__PURE__ */new Map,Me=/* @__PURE__ */new Map,_e=/* @__PURE__ */new Map,Te=/* @__PURE__ */new WeakMap,Be=B(0),Ie=C(()=>(Be.value,Array.from(_e.entries()).sort((e,n)=>e[0]-n[0]))),Se=B(0),$e=B([]),Ee=B([]),Le=B(null);let Ne=null,je=null;const He=C(()=>{var e;return!1!==l.deferNodesUntilVisible&&!((null!=(e=l.maxLiveNodes)?e:0)<=0)&&!ne.value&&!(Q.value.length>900)&&te.value}),Pe=C(()=>{var e;return me.value&&(null!=(e=l.maxLiveNodes)?e:0)<=0}),De=B({batchSize:ue.value,initial:ce.value,delay:null!=(r=l.renderBatchDelay)?r:16,enabled:Pe.value}),Re=C(()=>!!oe&&(He.value||ne.value)),Ke=C(()=>{var e;return Math.max(0,null!=(e=l.liveNodeBuffer)?e:60)}),Oe=B(0),We=J({start:0,end:0}),Ae=/* @__PURE__ */new Map,ze=C(()=>{if(!ne.value)return Q.value.length;const e=Ke.value,n=Math.max(We.end+e,ce.value),t=Math.min(Q.value.length,n);return Math.max(pe.value,t)});function Ve(e){var n,t,o,r;const l=N(null!=(n=null!=e?e:d.value)?n:null);if(l)return l;const i=null!=(r=null!=(o=null==e?void 0:e.ownerDocument)?o:null==(t=d.value)?void 0:t.ownerDocument)?r:"undefined"!=typeof document?document:null;return(null==i?void 0:i.scrollingElement)||(null==i?void 0:i.documentElement)||null}function Ue(e){if(!g)return!1;try{const n=window.getComputedStyle(e);return!!(n.display||"").toLowerCase().includes("flex")&&(n.flexDirection||"").toLowerCase().endsWith("reverse")}catch(n){return!1}}function qe(){Ne&&(Ne(),Ne=null),Le.value=null}function Ge(){if(!g||!ne.value)return;const e=Ve();if(!e||Le.value===e)return;qe();const n=()=>Ze();e.addEventListener("scroll",n,{passive:!0}),Le.value=e,Ne=()=>{e.removeEventListener("scroll",n)}}function Ye(){var e,n,t;if(!je)return;const o=null!=(t=null==(n=null==(e=d.value)?void 0:e.ownerDocument)?void 0:n.defaultView)?t:"undefined"!=typeof window?window:null;je.viaTimeout?o?o.clearTimeout(je.id):clearTimeout(je.id):null==le||le(je.id),je=null}function Ze(e={}){var n,t,o;if(!ne.value)return;if(!g)return void Je(!0);if(e.immediate)return Ye(),void Je(!0);if(je)return;const r=()=>{je=null,Je()};if(re)je={id:re(r),viaTimeout:!1};else{const e=null!=(o=null==(t=null==(n=d.value)?void 0:n.ownerDocument)?void 0:t.defaultView)?o:"undefined"!=typeof window?window:null,l=e?e.setTimeout(r,16):setTimeout(r,16);je={id:l,viaTimeout:!0}}}function Je(e=!1){var n,t,o,r,l,i,a;if(!ne.value)return;const s=Le.value||Ve();if(!s)return;const u=s.ownerDocument||(null==(n=d.value)?void 0:n.ownerDocument)||document,c=(null==u?void 0:u.defaultView)||("undefined"!=typeof window?window:null),m=s===(null==u?void 0:u.documentElement)||s===(null==u?void 0:u.body),h=Q.value.length;if(!m&&h>0&&Ue(s)){const n=s.clientHeight||0,t=s.scrollTop,o=t<0?-t:t,r=function(e){var n;const t=Q.value;if(!t.length)return 0;if(e<=0)return Math.max(0,t.length-1);if(Se.value===t.length){const n=dn(0,t.length);return hn(Math.max(0,n-e))}let o=e;for(let r=t.length-1;r>=0;r--){const e=null!=(n=en[r])?n:sn.value;if(o<=e)return r;o-=e}return 0}(Math.max(0,o)+.5*Math.max(0,n)),l=Qe(r,0,Math.max(0,h-1));return void((e||Math.abs(l-Oe.value)>1)&&(Oe.value=l))}const p=m?null:s.getBoundingClientRect(),v=m?0:p.top,f=m?null!=(o=null!=(t=null==c?void 0:c.innerHeight)?t:s.clientHeight)?o:0:p.bottom,g=Ie.value;let y=null,w=null;for(const[d,x]of g){if(!x)continue;const e=x.getBoundingClientRect();e.bottom<=v||e.top>=f||(null==y&&(y=d),w=d)}if(null==y||null==w){const e=d.value;if(!e)return;const n=m?{top:0}:s.getBoundingClientRect(),t=function(e,n,t){var o,r,l,i,a,s;if(t)return null!=(i=null!=(l=null==(o=null==n?void 0:n.documentElement)?void 0:o.scrollTop)?l:null==(r=null==n?void 0:n.body)?void 0:r.scrollTop)?i:0;const d=e.scrollTop;if(!Ue(e))return d;const u=d<0?-d:d;return Math.max(0,(null!=(a=e.scrollHeight)?a:0)-(null!=(s=e.clientHeight)?s:0))-u}(s,u,m),o=m?(()=>{const t=e.getBoundingClientRect(),o=(m?0:n.top)-t.top;return Math.max(0,o)})():(()=>{const n=function(e,n){let t=e,o=0,r=0;for(;t&&t!==n&&r++<64;)o+=t.offsetTop||0,t=t.offsetParent;return o}(e,s);return Math.max(0,t-n)})(),h=m?null!=(a=null!=(i=null!=(l=null==c?void 0:c.innerHeight)?l:null==(r=null==u?void 0:u.documentElement)?void 0:r.clientHeight)?i:s.clientHeight)?a:0:s.clientHeight,p=hn(o+.5*Math.max(0,h));return void(Oe.value=Qe(p,0,Math.max(0,Q.value.length-1)))}const k=Math.round((y+w)/2);!e&&Math.abs(k-Oe.value)<=1||(Oe.value=Qe(k,0,Math.max(0,Q.value.length-1)))}function Qe(e,n,t){return Math.min(Math.max(e,n),t)}const en=J({}),nn=J({total:0,count:0});function tn(){for(const e of Object.keys(en))delete en[Number(e)];nn.total=0,nn.count=0,Se.value=0,$e.value=[],Ee.value=[]}function on(e,n,t){for(let o=n+1;o<e.length;o+=o&-o)e[o]+=t}function rn(e,n){let t=0;for(let o=n+1;o>0;o-=o&-o)t+=e[o];return t}function ln(e,n,t){if(t<=n)return 0;const o=rn(e,t-1);return n<=0?o:o-rn(e,n-1)}function an(e){Se.value=e;const n=new Array(e+1).fill(0),t=new Array(e+1).fill(0);for(const[o,r]of Object.entries(en)){const l=Number(o),i=Number(r);!Number.isFinite(l)||l<0||l>=e||!Number.isFinite(i)||i<=0||(on(n,l,i),on(t,l,1))}$e.value=n,Ee.value=t}const sn=C(()=>nn.count>0?Math.max(12,nn.total/nn.count):32);function dn(e,n){var t,o;if(e>=n)return 0;if(Se.value!==Q.value.length){let o=0;for(let r=e;r<n;r++)o+=null!=(t=en[r])?t:sn.value;return o}const r=$e.value,l=Ee.value;if(!r.length||!l.length){let t=0;for(let r=e;r<n;r++)t+=null!=(o=en[r])?o:sn.value;return t}return ln(r,e,n)+(n-e-ln(l,e,n))*sn.value}I(()=>Q.value.length,e=>{e<=0?tn():(e<Se.value&&function(e){if(e<=0)return void tn();let n=0,t=0;for(const[o,r]of Object.entries(en)){const l=Number(o),i=Number(r);!Number.isFinite(l)||l<0||l>=e||!Number.isFinite(i)||i<=0?delete en[l]:(n+=i,t++)}nn.total=n,nn.count=t}(e),e!==Se.value&&an(e))},{immediate:!0});const un=C(()=>{if(!ne.value)return Q.value.map((e,n)=>({node:e,index:n}));const e=Q.value.length,n=Qe(We.start,0,e),t=Qe(We.end,n,e);return Q.value.slice(n,t).map((e,t)=>({node:e,index:n+t}))}),cn=C(()=>ne.value?dn(0,Math.min(We.start,Q.value.length)):0),mn=C(()=>{if(!ne.value)return 0;const e=Q.value.length;return dn(Math.min(We.end,e),e)});function hn(e){var n;if(e<=0)return 0;const t=Q.value;if(Se.value===t.length&&$e.value.length&&Ee.value.length){const n=sn.value,o=$e.value,r=Ee.value,l=e=>e<=0?0:rn(o,e-1)+(e-rn(r,e-1))*n;let i=0,a=t.length-1,s=t.length-1;for(;i<=a;){const n=i+a>>1;l(n+1)>=e?(s=n,a=n-1):i=n+1}return s}let o=e;for(let r=0;r<t.length;r++){const e=null!=(n=en[r])?n:sn.value;if(o<=e)return r;o-=e}return Math.max(0,t.length-1)}function pn(){Be.value+=1}function vn(e,n){const t=ye.value,o=t.has(e);if(n){if(o)return;const n=new Set(t);return n.add(e),void(ye.value=n)}if(!o)return;const r=new Set(t);r.delete(e),ye.value=r}function gn(){0!==ye.value.size&&(ye.value=/* @__PURE__ */new Set)}function yn(e){if(!ke.size)return;if(!ne.value)return;let n=!1;for(const[t,o]of ke)t>=e&&(o.destroy(),ke.delete(t),He.value&&vn(t,!1),Sn(t),_e.delete(t)&&(n=!0));n&&pn()}function wn(e,n){He.value&&vn(e,n),n&&(ne.value?Ze():Oe.value=Qe(e,0,Math.max(0,Q.value.length-1)))}function kn(e){const n=be.get(e);n&&(n(),be.delete(e));const t=ke.get(e);t&&(t.destroy(),ke.delete(e)),Sn(e)}function xn(e,n){let t=!1;if(n){const o=_e.get(e);_e.set(e,n),o!==n&&(t=!0)}else _e.delete(e)&&(t=!0);if(t&&pn(),n||Sn(e),!Re.value||!oe)return kn(e),void(n&&wn(e,!0));if(!ne.value&&He.value&&!h.value&&ke.size>=640&&(function(){if(!h.value){h.value=!0;for(const e of ke.values())e.destroy();if(ke.clear(),g)for(const e of Me.values())window.clearTimeout(e);Me.clear(),gn()}}(),!Re.value||!oe))return kn(e),void(n&&wn(e,!0));if(e<ce.value&&!ne.value)return kn(e),void wn(e,!0);if(ye.value.has(e))return kn(e),void wn(e,!0);if(!n)return void kn(e);kn(e);const o=oe(n,{rootMargin:"400px"});if(!o)return;ke.set(e,o),wn(e,o.isVisible.value),He.value&&function(e){if(!g||!He.value)return;Sn(e);const n=e%17*23,t=window.setTimeout(()=>{var n,t;if(Me.delete(e),!He.value)return;if(ye.value.has(e))return;const o=_e.get(e);if(!o)return;const r=Ve(o),l=o.ownerDocument||document,i=l.defaultView||window,a=!r||r===l.documentElement||r===l.body,s=!a&&r?r.getBoundingClientRect():null,d=a?0:s.top,u=a?null!=(t=null!=(n=i.innerHeight)?n:null==r?void 0:r.clientHeight)?t:0:s.bottom,c=o.getBoundingClientRect();c.bottom>=d-500&&c.top<=u+500&&wn(e,!0)},1800+n);Me.set(e,t)}(e);let r=null;r=I(()=>o.isVisible.value,n=>{if(n){Sn(e),wn(e,!0),null==r||r(),be.delete(e),ke.get(e)===o&&ke.delete(e);try{o.destroy()}catch(t){}}},{immediate:!0}),be.set(e,r),ne.value&&Ze()}let bn=null,Mn=null,_n=!1,Cn=null,Bn=null;function In(){g&&(null!=bn&&(null==le||le(bn),bn=null),null!=Mn&&(window.clearTimeout(Mn),Mn=null),null!=Bn&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(Bn),Bn=null),_n=!1,Cn=null)}function Sn(e){if(!g)return;const n=Me.get(e);null!=n&&(window.clearTimeout(n),Me.delete(e))}function $n(e,n={}){var t,o;if(!Pe.value)return;const r=ze.value;if(pe.value>=r)return;const i=Math.max(1,e),a=e=>{var n;bn=null,Mn=null,Bn=null,_n=!1;const t=null!=Cn?Cn:i;Cn=null;const o=Math.max(2,null!=(n=l.renderBatchBudgetMs)?n:6),a=e=>{const n="undefined"!=typeof performance?performance.now():Date.now();pe.value=Math.min(r,pe.value+Math.max(1,e)),yn(pe.value);const t=("undefined"!=typeof performance?performance.now():Date.now())-n;return function(e){var n;if(!Pe.value)return;const t=Math.max(2,null!=(n=l.renderBatchBudgetMs)?n:6),o=Math.max(1,ue.value||1),r=Math.max(1,Math.floor(o/4));e>1.2*t?ge.value=Math.max(r,Math.floor(.7*ge.value)):e<.5*t&&ge.value<o&&(ge.value=Math.min(o,Math.ceil(1.2*ge.value)))}(t),t};let s=t;for(;(a(s),!(pe.value>=r)&&e)&&!(("function"==typeof e.timeRemaining?e.timeRemaining():0)<=.5*o);)s=Math.max(1,Math.round(ge.value));pe.value<r&&En()};if(!g||n.immediate)return void a();const s=Math.max(0,null!=(t=l.renderBatchDelay)?t:16);if(Cn=null!=Cn?Math.max(Cn,i):i,!_n){if(_n=!0,!ae&&se&&window.requestIdleCallback){const e=Math.max(0,null!=(o=l.renderBatchIdleTimeoutMs)?o:120);return void(Bn=window.requestIdleCallback(e=>{a(e)},{timeout:e}))}re&&!ae?bn=re(()=>{0!==s?Mn=window.setTimeout(()=>a(),s):a()}):Mn=window.setTimeout(()=>a(),s)}}function En(){Pe.value&&$n(me.value?Math.max(1,Math.round(ge.value)):Math.max(1,ue.value))}I([()=>Q.value,()=>Q.value.length,()=>Pe.value,()=>ue.value,()=>ce.value,()=>l.renderBatchDelay,()=>l.indexKey],()=>{var e;const n=Q.value.length,t=fe.value,o=l.indexKey,r=void 0!==o&&o!==t.key,i=n!==t.total,a=r||i;fe.value={key:o,total:n};const s=De.value,d=null!=(e=l.renderBatchDelay)?e:16,u=s.batchSize!==ue.value||s.initial!==ce.value||s.delay!==d||s.enabled!==Pe.value;De.value={batchSize:ue.value,initial:ce.value,delay:d,enabled:Pe.value},r&&(tn(),n>0&&an(n)),(a||u||!Pe.value)&&In(),(a||u)&&(ge.value=Math.max(1,ue.value||1)),a&&ne.value&&Ze({immediate:!0});const c=ze.value;if(!n)return pe.value=0,void yn(0);if(!Pe.value)return pe.value=c,void yn(pe.value);const m=r||0===t.total;pe.value=m||u?Math.min(c,ce.value):Math.min(pe.value,c);const h=Math.max(1,ce.value||ue.value||n);pe.value<c?$n(h,{immediate:!g}):yn(pe.value)},{immediate:!0}),I(()=>ne.value,e=>{if(!e)return qe(),void Ye();Ge(),Ze({immediate:!0})},{immediate:!0}),I([()=>Q.value.length,()=>ne.value],e=>u(null,[e],function*([e,n]){n&&e&&g&&(yield H(),Ze({immediate:!0}))}),{flush:"post"}),I(()=>d.value,()=>{ne.value&&(Ge(),Ze({immediate:!0}))}),I(()=>Q.value.length,()=>{ne.value&&Ze({immediate:!0})}),I(()=>He.value,e=>{if(e)for(const[n,t]of _e)xn(n,t);else{for(const e of ke.values())e.destroy();ke.clear();for(const e of Array.from(Me.keys()))Sn(e);gn();for(const[e,n]of _e)n&&wn(e,!0)}},{immediate:!1}),I([()=>l.viewportPriority,()=>Q.value.length],([e,n])=>{!1!==e?h.value&&n<=200&&(h.value=!1):h.value=!1}),I(()=>pe.value,()=>{ne.value&&Ze({immediate:!0})}),I([Oe,ee,Ke,()=>Q.value.length,ne],()=>{!function(){const e=Q.value.length;if(!ne.value||0===e)return We.start=0,void(We.end=e);const n=Math.min(ee.value,e),t=Ke.value,o=Qe(Oe.value-t,0,Math.max(0,e-n));We.start=o,We.end=Math.min(e,o+n)}()},{immediate:!0}),I([()=>Q.value.length,ne,ee,Ke,()=>We.start,()=>We.end],([e,n,t,o,r,l])=>{y.value&&_("virtualization",{nodes:e,virtualization:n,maxLiveNodes:t,buffer:o,focusIndex:Oe.value,scroll:n?(()=>{const e=Le.value||Ve();return e?{reverse:Ue(e),scrollTop:Math.round(e.scrollTop),scrollTopAbs:Math.round(Math.abs(e.scrollTop)),scrollHeight:Math.round(e.scrollHeight),clientHeight:Math.round(e.clientHeight)}:null})():null,liveRange:{start:r,end:l},rendered:pe.value})}),I(()=>ze.value,(e,n)=>{Pe.value&&("number"==typeof n&&e<=n||e>pe.value&&En())}),$(()=>{In();for(const e of ke.values())e.destroy();ke.clear();for(const e of be.values())e();be.clear();for(const e of Array.from(Me.keys()))Sn(e);qe(),Ye()});const Ln=X(()=>u(null,null,function*(){try{return(yield import("./index4.js")).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for CodeBlockNode are missing. Falling back to inline-code rendering (no Monaco). To enable full code block features, please install "stream-monaco".',e),St}})),Nn=X(()=>u(null,null,function*(){try{return(yield import("./index5.js")).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for MermaidBlockNode are missing. Falling back to preformatted code rendering. To enable Mermaid rendering, please install "mermaid".',e),St}})),jn=X(()=>u(null,null,function*(){try{return(yield import("./index6.js")).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for InfographicBlockNode are missing. Falling back to preformatted code rendering. To enable Infographic rendering, please install "@antv/infographic".',e),St}})),Hn=X(()=>u(null,null,function*(){try{return(yield import("./index7.js")).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for D2BlockNode are missing. Falling back to preformatted code rendering. To enable D2 rendering, please install "@terrastruct/d2".',e),St}})),Pn=C(()=>l.renderCodeBlocksAsPre?St:Ln),Dn={text:On,paragraph:Ct,heading:wt,code_block:Ln,list:xt,list_item:kt,blockquote:ie,table:Ht,definition_list:he,footnote:vt,footnote_reference:Ce,footnote_anchor:mt,admonition:Yt,vmr_container:Ot,hardbreak:gt,link:rt,image:Tn,thematic_break:Dt,math_inline:Wn,math_block:An,strong:Zn,emphasis:ut,strikethrough:Qn,highlight:st,insert:it,subscript:Gn,superscript:Un,emoji:ve,checkbox:de,checkbox_input:de,inline_code:Xe,html_inline:Fe,reference:zn,html_block:_t},Rn=C(()=>(we.value,xe(l.customId))),Kn=C(()=>null!=l.indexKey?String(l.indexKey):"markdown-renderer"),Fn=C(()=>a(a({stream:l.codeBlockStream,darkTheme:l.codeBlockDarkTheme,lightTheme:l.codeBlockLightTheme,monacoOptions:l.codeBlockMonacoOptions,themes:l.themes,minWidth:l.codeBlockMinWidth,maxWidth:l.codeBlockMaxWidth},"boolean"==typeof M.value?{showTooltips:M.value}:{}),l.codeBlockProps||{})),Vn=C(()=>a({},l.mermaidProps||{})),Xn=C(()=>a({},l.d2Props||{})),qn=C(()=>a({},l.infographicProps||{})),Yn=C(()=>({typewriter:l.typewriter})),Jn=C(()=>a(a({},Yn.value),"boolean"==typeof M.value?{showTooltip:M.value}:{})),et=C(()=>a(a({},Yn.value),"boolean"==typeof M.value?{showTooltips:M.value}:{})),nt=C(()=>un.value.map(e=>{const n=function(e){var n,t,o,r,l,i,s;if("code_block"!==e.type)return e;const d=e,u=[String(null!=(n=d.language)?n:""),String(null!=(t=d.loading)?t:""),String(null!=(o=d.diff)?o:""),String(null!=(r=d.code)?r:""),String(null!=(l=d.originalCode)?l:""),String(null!=(i=d.updatedCode)?i:""),String(null!=(s=d.raw)?s:"")].join("\0"),c=Te.get(d);if(c&&c.signature===u)return c.node;const m=a({},d);return Te.set(d,{signature:u,node:m}),m}(e.node),t=tt(n);return s(a({},e),{node:n,component:ot(n,t),bindings:lt(n,t),isCodeBlock:"code_block"===n.type,indexKey:`${Kn.value}-${e.index}`})}));function tt(e){var n;return"code_block"===(null==e?void 0:e.type)?String(null!=(n=e.language)?n:"").trim().toLowerCase():""}function ot(e,n){if(!e)return Kt;const t=Rn.value,o=t[String(e.type)];if("code_block"===e.type){const r=null!=n?n:tt(e);if("mermaid"===r)return t.mermaid||Nn;if("infographic"===r)return t.infographic||jn;if("d2"===r||"d2lang"===r)return t.d2||Hn;if(o)return o;return t.code_block||Pn.value}return o||Dn[String(e.type)]||Kt}function lt(e,n){const t=null!=n?n:tt(e);return"mermaid"===t?Vn.value:"infographic"===t?qn.value:"d2"===t||"d2lang"===t?Xn.value:"link"===e.type?Jn.value:"list"===e.type?et.value:"code_block"===e.type?Fn.value:Yn.value}function at(e){i("click",e)}function dt(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&i("mouseover",e)}function ct(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&i("mouseout",e)}return(e,n)=>(v(),f("div",{ref_key:"containerRef",ref:d,class:E(["markstream-vue markdown-renderer",[{dark:l.isDark},{virtualized:ne.value}]]),"data-custom-id":l.customId,onClick:at,onMouseover:dt,onMouseout:ct},[ne.value?(v(),f("div",{key:0,class:"node-spacer",style:W({height:`${cn.value}px`}),"aria-hidden":"true"},null,4)):j("",!0),(v(!0),f(x,null,b(nt.value,e=>{var t,o;return v(),f("div",{key:e.index,ref_for:!0,ref:n=>xn(e.index,n),class:"node-slot","data-node-index":e.index,"data-node-type":e.node.type},[(o=e.index,Pe.value&&o>=pe.value||!(!He.value||o<ce.value||ye.value.has(o))?(v(),f("div",{key:1,class:"node-placeholder",style:W({height:`${null!=(t=en[e.index])?t:sn.value}px`})},null,4)):(v(),f("div",{key:0,ref_for:!0,ref:n=>function(e,n){n?(Ae.set(e,n),queueMicrotask(()=>{!function(e,n){if(!Number.isFinite(n)||n<=0)return;const t=en[e];if(en[e]=n,t?nn.total+=n-t:(nn.total+=n,nn.count++),Se.value>e){const o=$e.value,r=Ee.value;if(o.length&&r.length)if(t){const r=n-t;0!==r&&on(o,e,r)}else on(o,e,n),on(r,e,1)}}(e,n.offsetHeight)})):Ae.delete(e)}(e.index,n),class:"node-content"},[e.isCodeBlock||!1===l.typewriter?(v(),P(q(e.component),G({key:1,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":l.customId,"is-dark":l.isDark,onCopy:n[2]||(n[2]=e=>i("copy",e)),onHandleArtifactClick:n[3]||(n[3]=e=>i("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"])):(v(),P(R,{key:0,name:"typewriter",appear:""},{default:K(()=>[(v(),P(q(e.component),G({node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":l.customId,"is-dark":l.isDark,onCopy:n[0]||(n[0]=e=>i("copy",e)),onHandleArtifactClick:n[1]||(n[1]=e=>i("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"]))]),_:2},1024))],512)))],8,At)}),128)),ne.value?(v(),f("div",{key:1,class:"node-spacer",style:W({height:`${mn.value}px`}),"aria-hidden":"true"},null,4)):j("",!0)],42,Wt))}}),[["__scopeId","data-v-e8a28bff"]]);zt.install=e=>{var n,t;const o=null!=(t=null!=(n=zt.__name)?n:zt.name)?t:"NodeRenderer";e.component(o,zt)};const Ft={key:0,class:"admonition-icon"},Vt={class:"admonition-title"},Ut=["aria-expanded","aria-controls","title"],Xt={key:0},qt={key:1},Gt=["id"],Yt=/* @__PURE__ */le(/* @__PURE__ */p({__name:"AdmonitionNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e,{emit:n}){var t;const o=e,r=n,l={note:"ℹ️",info:"ℹ️",tip:"💡",warning:"⚠️",danger:"❗",error:"⛔",caution:"⚠️"},i=C(()=>{if(o.node.title&&o.node.title.trim().length)return o.node.title;const e=o.node.kind||"note";return e.charAt(0).toUpperCase()+e.slice(1)}),a=B(!!o.node.collapsible&&!(null==(t=o.node.open)||t));function s(){o.node.collapsible&&(a.value=!a.value)}const d=`admonition-${Math.random().toString(36).slice(2,9)}`;return(n,t)=>(v(),f("div",{class:E(["admonition",[`admonition-${o.node.kind}`,o.isDark?"is-dark":""]])},[k("div",{id:d,class:"admonition-header"},[l[o.node.kind]?(v(),f("span",Ft,M(l[o.node.kind]),1)):j("",!0),k("span",Vt,M(i.value),1),o.node.collapsible?(v(),f("button",{key:1,class:"admonition-toggle","aria-expanded":!a.value,"aria-controls":`${d}-content`,title:a.value?"Expand":"Collapse",onClick:s},[a.value?(v(),f("span",Xt,"▶")):(v(),f("span",qt,"▼"))],8,Ut)):j("",!0)]),O(k("div",{id:`${d}-content`,class:"admonition-content","aria-labelledby":d},[g([o.node.children],()=>y(w(zt),{"index-key":`admonition-${e.indexKey}`,nodes:o.node.children,"custom-id":o.customId,typewriter:o.typewriter,onCopy:t[0]||(t[0]=e=>r("copy",e))},null,8,["index-key","nodes","custom-id","typewriter"]),t,1)],8,Gt),[[A,!a.value]])],2))}}),[["__scopeId","data-v-5e95c2b7"]]);Yt.install=e=>{e.component(Yt.__name,Yt)};const Zt=()=>import("@terrastruct/d2");let Jt=null,Qt=Zt;function eo(e){Qt=e,Jt=null}function no(e){eo(null!=e?e:Zt)}function to(){eo(null)}function oo(){return"function"==typeof Qt}function ro(){return u(this,null,function*(){if(Jt)return Jt;const e=Qt;if(!e)return null;let n;try{n=yield e()}catch(t){if(e===Zt)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw t}return n?(Jt=function(e){var n;if(!e)return e;if(e.D2&&"function"==typeof e.D2)return e.D2;if(e.default&&e.default.D2&&"function"==typeof e.default.D2)return e.default.D2;const t=null!=(n=e.default)?n:e;return"function"==typeof t?t:(null==t?void 0:t.D2)&&"function"==typeof t.D2?t.D2:t}(n),Jt):null})}let lo=!1,io=null,ao=!1;function so(){return u(this,null,function*(){if(io)return io;if(ao)return null;try{return io=yield import("stream-monaco"),yield function(e){return u(this,null,function*(){if(lo)return;lo=!0;const n=null==globalThis?void 0:globalThis.MonacoEnvironment;return!n||"function"!=typeof n.getWorker&&"function"!=typeof n.getWorkerUrl?e.preloadMonacoWorkers():void 0})}(io),(yield function(e){return u(this,null,function*(){const n=null==e?void 0:e.getOrCreateHighlighter;if("function"!=typeof n)return!0;try{const e=yield n(["vitesse-dark","vitesse-light"],["plaintext","text","javascript"]);return e&&"function"==typeof e.codeToTokens&&e.codeToTokens("const a = 1",{lang:"javascript",theme:"vitesse-dark"}),!0}catch(t){return console.warn("[markstream-vue] Failed to warm up Shiki tokenizer; disabling stream-monaco for this session.",t),!1}})}(io))?io:(io=null,ao=!0,null)}catch(e){return ao=!0,null}})}function uo({R:e,H:n=0,B:t=50}){const o=e*(1-n)||1e-6;return Math.max(1,Math.floor(t/o))}function co(e){const n=e.length+10*(e.match(/\\/g)||[]).length;return n<10?"simple":n<40?"medium":"complex"}function mo(e){switch(e){case"simple":return 3;case"medium":return 10;case"complex":return 30}}function ho(e,n){var t,o;let r=0;for(const l of e){const e=mo(co(l));e>r&&(r=e)}return uo({R:r,H:null!=(t=null==n?void 0:n.H)?t:0,B:null!=(o=null==n?void 0:n.B)?o:50})}const po='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#8caaee" d="m 6.665625,1.0107144 c 0.54375,0.090628 0.9125,0.6062693 0.821875,1.1500367 L 7.18125,3.9983098 h 2.971875 L 10.5125,1.8326156 c 0.09063,-0.5437673 0.60625,-0.9125291 1.15,-0.8219012 0.54375,0.090628 0.9125,0.6062693 0.821875,1.1500367 L 12.18125,3.9983098 H 14 c 0.553125,0 1,0.4468892 1,1.0000319 0,0.5531426 -0.446875,1.0000319 -1,1.0000319 H 11.846875 L 11.18125,9.9985013 H 13 c 0.553125,0 1,0.4468897 1,1.0000317 0,0.553143 -0.446875,1.000032 -1,1.000032 H 10.846875 L 10.4875,14.164259 c -0.09063,0.543768 -0.60625,0.912529 -1.15,0.821902 -0.54375,-0.09063 -0.9125,-0.60627 -0.821875,-1.150037 l 0.30625,-1.834434 h -2.975 L 5.4875,14.167384 c -0.090625,0.543768 -0.60625,0.91253 -1.15,0.821902 C 3.79375,14.898658 3.425,14.383016 3.515625,13.839249 L 3.81875,11.998565 H 2 c -0.553125,0 -1,-0.446889 -1,-1.000032 C 1,10.445391 1.446875,9.9985013 2,9.9985013 H 4.153125 L 4.81875,5.9983736 H 3 c -0.553125,0 -1,-0.4468893 -1,-1.0000319 C 2,4.445199 2.446875,3.9983098 3,3.9983098 H 5.153125 L 5.5125,1.8326156 C 5.603125,1.2888483 6.11875,0.9200865 6.6625,1.0107144 Z M 6.846875,5.9983736 6.18125,9.9985013 H 9.153125 L 9.81875,5.9983736 Z" />\n</svg>\n',vo='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M2 15.5c-.7 0-1.5-.8-1.5-1.5V5c0-.7.8-1.5 1.5-1.5h9c.7 0 1.5.8 1.5 1.5v9c0 .7-.8 1.5-1.5 1.5z" />\n <path d="m1.2 3.8 3.04-2.5S5.17.5 5.7.5h8.4c.66 0 1.4.73 1.4 1.4v7.73a2.7 2.7 0 01-.7 1.75l-2.68 3.51M3 8.5l3 2-3 2m4 0h2" />\n </g>\n</svg>\n',fo='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#c6d0f5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M13.5 6.5v6a2 2 0 01-2 2h-7a2 2 0 01-2-2v-9c0-1.1.9-2 2-2h4.01" />\n <path d="m8.5 1.5 5 5h-4a1 1 0 01-1-1zm-3 10h5m-5-3h5m-5-3h1" />\n </g>\n</svg>\n';let go=null,yo=null,wo=null;const ko=_(0),xo={"":fo,plain:fo,text:fo,javascript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round">\n <path d="M4.5 11c0 .828427.6715729 1.5 1.5 1.5.8284271 0 1.5-.671573 1.5-1.5V7.5M12.5 8.75C12.5 8.05964406 11.9627417 7.5 11.3 7.5L10.7 7.5C10.0372583 7.5 9.5 8.05964406 9.5 8.75 9.5 9.44035594 10.0372583 10 10.7 10L11.3 10C11.9627417 10 12.5 10.5596441 12.5 11.25 12.5 11.9403559 11.9627417 12.5 11.3 12.5L10.7 12.5C10.0372583 12.5 9.5 11.9403559 9.5 11.25" />\n <path d="m 4,1.5 h 8 c 1.385,0 2.5,1.115 2.5,2.5 v 8 c 0,1.385 -1.115,2.5 -2.5,2.5 H 4 C 2.615,14.5 1.5,13.385 1.5,12 V 4 C 1.5,2.615 2.615,1.5 4,1.5 Z" />\n </g>\n</svg>\n',typescript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M4 1.5h8A2.5 2.5 0 0114.5 4v8a2.5 2.5 0 01-2.5 2.5H4A2.5 2.5 0 011.5 12V4A2.5 2.5 0 014 1.5" />\n <path d="M12.5 8.75c0-.69-.54-1.25-1.2-1.25h-.6c-.66 0-1.2.56-1.2 1.25S10.04 10 10.7 10h.6c.66 0 1.2.56 1.2 1.25s-.54 1.25-1.2 1.25h-.6c-.66 0-1.2-.56-1.2-1.25m-3-3.75v5M5 7.5h3" />\n </g>\n</svg>\n',jsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#99d1db" stroke-linecap="round" stroke-linejoin="round">\n <path d="M8 10.8c4.14 0 7.5-1.25 7.5-2.8S12.14 5.2 8 5.2.5 6.45.5 8s3.36 2.8 7.5 2.8" />\n <path d="M5.52 9.4c2.07 3.5 4.86 5.72 6.23 4.95 1.37-.78.8-4.24-1.27-7.75C8.41 3.1 5.62.88 4.25 1.65c-1.37.78-.8 4.24 1.27 7.75" />\n <path d="M5.52 6.6c-2.07 3.5-2.64 6.97-1.27 7.75 1.37.77 4.16-1.45 6.23-4.95s2.64-6.97 1.27-7.75C10.38.88 7.59 3.1 5.52 6.6" />\n <path d="M8.5 8a.5.5 0 01-.5.5.5.5 0 01-.5-.5.5.5 0 01.5-.5.5.5 0 01.5.5" />\n </g>\n</svg>\n',tsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M8 11.3c4.14 0 7.5-1.28 7.5-2.86S12.14 5.58 8 5.58.5 6.86.5 8.44s3.36 2.87 7.5 2.87Z" />\n <path d="M5.52 9.87c2.07 3.6 4.86 5.86 6.23 5.07 1.37-.8.8-4.34-1.27-7.93S5.62 1.16 4.25 1.95s-.8 4.34 1.27 7.92" />\n <path d="M5.52 7.01c-2.07 3.59-2.64 7.14-1.27 7.93s4.16-1.48 6.23-5.07c2.07-3.58 2.64-7.13 1.27-7.92-1.37-.8-4.16 1.47-6.23 5.06" />\n <path d="M8.5 8.44a.5.5 0 01-.5.5.5.5 0 01-.5-.5.5.5 0 01.5-.5.5.5 0 01.5.5" />\n </g>\n</svg>\n',html:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#ef9f76" d="M1.5 1.5h13L13 13l-5 2-5-2z" />\n <path stroke="#c6d0f5" d="M11 4.5H5l.25 3h5.5l-.25 3-2.5 1-2.5-1-.08-1" />\n </g>\n</svg>\n',css:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round">\n <path d="m4 1.5h8c1.38 0 2.5 1.12 2.5 2.5v8c0 1.38-1.12 2.5-2.5 2.5h-8c-1.38 0-2.5-1.12-2.5-2.5v-8c0-1.38 1.12-2.5 2.5-2.5z" />\n <path stroke-width=".814" d="m 10.240861,11.529149 c 0,0.58011 0.437448,1.039154 0.96002,1.035371 l 0.451635,-0.0032 c 0.522572,-0.0036 0.949379,-0.451477 0.949379,-1.032848 0,-0.581372 -0.426807,-1.065638 -0.949379,-1.065638 l -0.451635,3.4e-5 c -0.522572,3.9e-5 -0.949379,-0.4855273 -0.949379,-1.0656374 0,-0.5801104 0.426807,-1.0378931 0.949379,-1.0378931 l 0.451635,2.825e-4 c 0.522572,3.267e-4 0.951743,0.4577827 0.951743,1.0378931 M 6.8003972,11.529149 c 0,0.58011 0.4374474,1.039154 0.9600196,1.035371 l 0.46464,-0.0032 c 0.5225722,-0.0035 0.9363738,-0.451477 0.9363738,-1.031587 0,-0.580111 -0.4090724,-1.065638 -0.9316446,-1.065638 l -0.4693692,3.4e-5 c -0.5225722,3.8e-5 -0.949379,-0.4855272 -0.949379,-1.0656373 0,-0.5801104 0.4268068,-1.0378931 0.949379,-1.0378931 h 0.4516348 c 0.5225722,0 0.9635665,0.4577827 0.9635665,1.0378931 M 3.4072246,11.529149 c 0,0.58011 0.4374474,1.051765 0.9600196,1.051765 H 4.818879 c 0.5225722,0 0.949379,-0.456521 0.949379,-1.037893 m 0.01129,-2.1312747 c 0,-0.5801103 -0.4374474,-1.037893 -0.9600196,-1.037893 L 4.3678939,8.3741358 C 3.8453217,8.3744624 3.4078743,8.8420074 3.4078743,9.4233788 v 2.1186642" />\n </g>\n</svg>\n',scss:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#f4b8e4" stroke-linecap="round" stroke-linejoin="round" d="M6.75 6.38c1.85 1.07 3.35.74 4.83-.2 1.5-.95 2.7-2.78 1.3-4.15-.7-.68-3.25-.8-5.62.19-2.36.99-4.59 3.02-4.74 4.11-.31 2.19 3.15 2.88 3.64 4.23s.28 1.98-.2 2.83c-.5.85-1.96 1.62-2.8.68-.83-.95 1.67-2.75 2.98-3.25 1.3-.5 3.1-.4 3.69.25.58.64-.07 1.79-.03 1.79" />\n</svg>\n',json:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round" d="M4.5 2.5H4c-.75 0-1.5.75-1.5 1.5v2c0 1.1-1 2-1.83 2 .83 0 1.83.9 1.83 2v2c0 .75.75 1.5 1.5 1.5h.5m7-11h.5c.75 0 1.5.75 1.5 1.5v2c0 1.1 1 2 1.83 2-.83 0-1.83.9-1.83 2v2c0 .74-.75 1.5-1.5 1.5h-.5m-6.5-3a.5.5 0 100-1 .5.5 0 000 1m3 0a.5.5 0 100-1 .5.5 0 000 1m3 0a.5.5 0 100-1 .5.5 0 000 1" />\n</svg>\n',python:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#8caaee" d="M8.5 5.5h-3m6 0V3c0-.8-.7-1.5-1.5-1.5H7c-.8 0-1.5.7-1.5 1.5v2.5H3c-.8 0-1.5.7-1.5 1.5v2c0 .8.7 1.5 1.48 1.5" />\n <path stroke="#e5c890" d="M10.5 10.5h-3m-3 0V13c0 .8.7 1.5 1.5 1.5h3c.8 0 1.5-.7 1.5-1.5v-2.5H13c.8 0 1.5-.7 1.5-1.5V7c0-.8-.7-1.5-1.48-1.5H11.5c0 1.5 0 2-1 2h-2" />\n <path stroke="#8caaee" d="M2.98 10.5H4.5c0-1.5 0-2 1-2h2M7.5 3.5v0" />\n <path stroke="#e5c890" d="m 8.5,12.5 v 0" />\n </g>\n</svg>\n',ruby:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e78284" stroke-linecap="round" stroke-linejoin="round" d="M1.5 9.06v2.5c.02.86.36 1.61.9 2.15 1.76 1.76 5.71.65 8.84-2.47 3.12-3.13 4.23-7.08 2.47-8.84a3.1 3.1 0 00-2.15-.9h-2.5M14.5 4l-.25 10.25L4 14.5m4.39-6.11c2.34-2.35 3.29-5.2 2.12-6.37S6.49 1.8 4.14 4.14C1.8 6.5.85 9.34 2.02 10.51s4.02.22 6.37-2.12M5.5 14.5l.25-3.75L11 11l-.25-5.25 3.75-.25" />\n</svg>\n',go:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#85c1dc" stroke-linecap="round" stroke-linejoin="round" d="m15.48 8.06-4.85.48m4.85-.48a4.98 4.98 0 01-4.54 5.42 5 5 0 112.95-8.66l-1.7 1.84a2.5 2.5 0 00-4.18 2.06c.05.57.3 1.1.69 1.51.25.27 1 .83 1.78.82.8-.02 1.58-.25 2.07-.81 0 0 .8-.96.68-1.88M2.5 8.5l-2 .01m1.5 2h1.5m-2-3.99 2-.02" />\n</svg>\n',java:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#c6d0f5" d="M10.73 8.41c.57 3 1.59 5.83 2.77 7.09-6.63-3.45-9.76-1.75-10.5 0-.66-3.4-.54-5.74.09-7.78" />\n <path stroke="#e78284" d="M8.5 7c.63.34 1.82 1.07 2.24 1.41-.54-2.9-.64-5.96-.74-7.91-2.13.58-5.73 1.98-6.9 7.22.52-.69 1.72-1.05 2.4-1.22" />\n <path stroke="#e78284" d="M5.5 7A1.5 1.5 0 007 8.5 1.5 1.5 0 008.5 7 1.5 1.5 0 007 5.5 1.5 1.5 0 005.5 7" />\n </g>\n</svg>\n',kotlin:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#ca9ee6" d="M2.5 13.5h11L8 8" />\n <path stroke="#ef9f76" d="M8.03 2.5h5.47l-8 8" />\n <path stroke="#e78284" d="M2.5 13.5V8" />\n <path stroke="#85c1dc" d="M8 2.5H2.5V8l3-2.5" />\n </g>\n</svg>\n',c:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round" d="m 4.0559072,12.951629 c 2.7459832,2.734744 7.1981158,2.734744 9.9441188,0 l -1.789955,-1.782586 c -1.75742,1.750224 -4.6067879,1.750224 -6.3642294,0 -1.7574416,-1.7502236 -1.7574416,-4.587893 0,-6.338097 1.7574415,-1.750224 4.6068094,-1.750224 6.3642294,0 l 0.894977,-0.8912929 0.894978,-0.891293 c -2.746003,-2.73472867 -7.1981359,-2.73472867 -9.944119,0 -2.7459858,2.7347089 -2.7459858,7.1685599 2e-7,9.9032689 z" clip-rule="evenodd" />\n</svg>\n',cpp:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round" d="m 2.5559121,12.951629 c 2.7459832,2.734744 7.1981158,2.734744 9.9441189,0 l -1.789955,-1.782586 c -1.7574201,1.750224 -4.606788,1.750224 -6.3642295,0 -1.7574416,-1.7502236 -1.7574416,-4.587893 0,-6.338097 1.7574415,-1.750224 4.6068094,-1.750224 6.3642295,0 l 0.894977,-0.8912929 0.894978,-0.891293 c -2.7460031,-2.73472867 -7.198136,-2.73472867 -9.9441191,0 -2.74598585,2.7347089 -2.74598585,7.1685599 2e-7,9.9032689 z" clip-rule="evenodd" />\n <path fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round" d="M7.5 6v4M5.513524 7.9999996H9.51304M13.486476 5.9999996v4M11.5 7.9999992h3.999516" />\n</svg>\n',cs:po,csharp:po,php:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round" d="M0.5,12.5 L0.5,13.24 C0.5,14 1.27360724,14.5 2,14.5 C2.9375516,14.5 3.5,14 3.5,13.2445661 L3.5,6.00089968 C3.5,4.28551107 4.99401107,2.52263547 7.14960413,2.5 C9.49387886,2.5 11,4.0579782 11,5.5 C11.1657296,8.48962302 9.57820404,9.63684469 7.49621582,10.5 L7.49621582,14.5 L15.4979764,14.5 L15.4979764,9 C15.5394484,8.36478228 14.9387379,7.15595371 14.1308258,6.5 C13.1942239,5.80827275 12.0584852,5.50253264 11,5.5 M11.5,14.5 L11.5,11.5 M6,6.5 C6.27614237,6.5 6.5,6.27614237 6.5,6 C6.5,5.72385763 6.27614237,5.5 6,5.5 C5.72385763,5.5 5.5,5.72385763 5.5,6 C5.5,6.27614237 5.72385763,6.5 6,6.5 Z" />\n</svg>\n',shell:vo,powershell:vo,sql:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round" d="M8 6.5c3.59 0 6.5-1.4 6.5-2.68S11.59 1.5 8 1.5 1.5 2.54 1.5 3.82 4.41 6.5 8 6.5M14.5 8c0 .83-1.24 1.79-3.25 2.2s-4.49.41-6.5 0S1.5 8.83 1.5 8m13 4.18c0 .83-1.24 1.6-3.25 2-2.01.42-4.49.42-6.5 0-2.01-.4-3.25-1.17-3.25-2m0-8.3v8.3m13-8.3v8.3" />\n</svg>\n',yaml:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e78284" stroke-linecap="round" stroke-linejoin="round" d="M2.5 1.5h3l3 4 3-4h3l-9 13h-3L7 8z" />\n</svg>\n',markdown:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#85c1dc" stroke-linecap="round" stroke-linejoin="round" d="m9.25 8.25 2.25 2.25 2.25-2.25M3.5 11V5.5l2.04 3 1.96-3V11m4-.5V5M1.65 2.5h12.7c.59 0 1.15.49 1.15 1v9c0 .51-.56 1-1.15 1H1.65c-.59 0-1.15-.49-1.15-1V3.58c0-.5.56-1.08 1.15-1.08" />\n</svg>\n',xml:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ef9f76" stroke-linecap="round" stroke-linejoin="round" d="M4.5 4.5 1 8 4.5 11.5M11.5 4.5 15 8 11.5 11.5M9.5 2 6.5 14" />\n</svg>\n',rust:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#ef9f76" stroke-linecap="round" stroke-linejoin="round">\n <path d="M15.5 9.5Q8 13.505.5 9.5l1-1-1-2 2-.5V4.5h2l.5-2 1.5 1 1.5-2 1.5 2 1.5-1 .5 2h2V6l2 .5-1 2z" />\n <path d="M6.5 7.5a1 1 0 01-1 1 1 1 0 01-1-1 1 1 0 011-1 1 1 0 011 1m5 0a1 1 0 01-1 1 1 1 0 01-1-1 1 1 0 011-1 1 1 0 011 1M4 11.02c-.67.37-1.5.98-1.5 2.23s1.22 1.22 2 1.25v-2M12 11c.67.37 1.5 1 1.5 2.25s-1.22 1.22-2 1.25v-2" />\n </g>\n</svg>\n',vue:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#a6d189" stroke-linecap="round" stroke-linejoin="round">\n <path d="M1 1.5h5.44L8 4.56 9.56 1.5H15l-6.99 13z" />\n <path d="M12.05 1.73 8 9.28 3.95 1.73" />\n </g>\n</svg>\n',mermaid:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round" d="M1.5 2.5c0 6 2.25 5.75 4 7 .83.67 1.17 2 1 4h3c-.17-2 .17-3.33 1-4 1.75-1.25 4-1 4-7C12 2.5 10 3 8 7 6 3 4 2.5 1.5 2.5" />\n</svg>\n'},bo={"":"",javascript:"javascript",js:"javascript",mjs:"javascript",cjs:"javascript",typescript:"typescript",ts:"typescript",jsx:"jsx",tsx:"tsx",golang:"go",py:"python",rb:"ruby",sh:"shell",bash:"shell",zsh:"shell",shellscript:"shell",bat:"shell",batch:"shell",ps1:"powershell",plaintext:"plain",text:"plain","c++":"cpp","c#":"csharp","objective-c":"objectivec","objective-c++":"objectivecpp",yml:"yaml",md:"markdown",rs:"rust",kt:"kotlin"};function Mo(){return u(this,null,function*(){return yo||(wo||(wo=import("./languageIconExtended.js").then(e=>(yo=e.EXTENDED_LANGUAGE_ICON_MAP,ko.value++,yo)).catch(()=>null)),wo)})}function _o(e){go=null!=e?e:null}function To(e){var n;const t=function(e){if(!e)return"";const n=e.trim();if(!n)return"";const[t]=n.split(/\s+/),[o]=t.split(":");return o.toLowerCase()}(e);return null!=(n=bo[t])?n:t}function Co(e){const n=To(e);if(!n)return"plaintext";switch(n){case"plain":return"plaintext";case"jsx":return"javascript";case"tsx":return"typescript";default:return n}}function Bo(){return u(this,null,function*(){yield Mo()})}function Io(e){if(go){const n=go(e);if(null!=n&&""!==n)return n}const n=To(e),t=xo[n];if(t)return t;return(null==yo?void 0:yo[n])||(Mo(),'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16">\x3c!-- Icon from Lucide by Lucide Contributors - https://github.com/lucide-icons/lucide/blob/main/LICENSE --\x3e<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m10 9l-3 3l3 3m4 0l3-3l-3-3"/><rect width="18" height="18" x="3" y="3" rx="2"/></g></svg>')}const So={js:"JavaScript",javascript:"JavaScript",ts:"TypeScript",jsx:"JSX",tsx:"TSX",html:"HTML",css:"CSS",scss:"SCSS",json:"JSON",py:"Python",python:"Python",rb:"Ruby",go:"Go",java:"Java",c:"C",cpp:"C++",cs:"C#",php:"PHP",sh:"Shell",bash:"Bash",sql:"SQL",yaml:"YAML",md:"Markdown",d2:"D2",d2lang:"D2","":"Plain Text",plain:"Plain Text"},$o=new class{constructor(){d(this,"metrics",[]),d(this,"enabled",!1),d(this,"maxMetrics",1e3)}enable(){this.enabled=!0}disable(){this.enabled=!1}recordRender(e){this.enabled&&(this.metrics.push(e),this.metrics.length>this.maxMetrics&&this.metrics.shift())}getStats(){if(0===this.metrics.length)return{totalRenders:0,cacheHitRate:0,averageWorkerTime:0,averageDirectTime:0,averageCacheHitTime:0,workerSavings:0,recommendation:"Insufficient data"};const e=this.metrics.filter(e=>"worker"===e.type&&e.success),n=this.metrics.filter(e=>"direct"===e.type&&e.success),t=this.metrics.filter(e=>"cache-hit"===e.type),o=this.metrics.length,r=t.length,l=r/o*100,i=e.length>0?e.reduce((e,n)=>e+n.duration,0)/e.length:0,a=n.length>0?n.reduce((e,n)=>e+n.duration,0)/n.length:0,s=t.length>0?t.reduce((e,n)=>e+n.duration,0)/t.length:0,d=o*a-(e.reduce((e,n)=>e+n.duration,0)+n.reduce((e,n)=>e+n.duration,0)+t.reduce((e,n)=>e+n.duration,0));let u="";return u=l>70&&i<2*a?"✅ Worker + Cache is highly beneficial":l>50?"✅ Worker + Cache is beneficial":i>3*a?"⚠️ Worker overhead too high, consider direct rendering":a<5?"⚠️ Formulas too simple, Worker overhead may not be worth it":"✅ Worker prevents main thread blocking",{totalRenders:o,cacheHits:r,cacheHitRate:l.toFixed(1),workerCalls:e.length,directCalls:n.length,averageWorkerTime:i.toFixed(2),averageDirectTime:a.toFixed(2),averageCacheHitTime:s.toFixed(3),workerSavings:d.toFixed(2),recommendation:u}}printReport(){const e=this.getStats();return console.group("📊 KaTeX Rendering Performance Report"),e.totalRenders,e.cacheHits,e.cacheHitRate,e.workerCalls,e.directCalls,e.averageWorkerTime,e.averageDirectTime,e.averageCacheHitTime,e.workerSavings,e.recommendation,console.groupEnd(),e}reset(){this.metrics=[]}exportMetrics(){return{metrics:[...this.metrics],stats:this.getStats(),timestamp:Date.now()}}};function Eo(){$o.enable()}function Lo(){$o.disable()}function No(){return $o.printReport()}function jo(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch(n){}return globalThis.setTimeout(e,0)}function Ho(e){try{if(null==e)return;if("undefined"!=typeof globalThis&&"function"==typeof globalThis.cancelAnimationFrame)return void globalThis.cancelAnimationFrame(e)}catch(n){}try{globalThis.clearTimeout(e)}catch(n){}}"undefined"!=typeof window&&(window.__katexPerfReport=No,window.__katexPerfMonitor=$o);const Po={key:0,class:"code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:{color:"var(--vscode-editor-foreground)","background-color":"var(--vscode-editor-background)"}},Do={class:"flex items-center gap-x-2"},Ro=["innerHTML"],Ko={class:"text-sm font-medium font-mono"},Oo={class:"flex items-center gap-x-2"},Wo=["aria-pressed"],Ao=["disabled"],zo=["disabled"],Fo=["disabled"],Vo=["aria-label"],Uo={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},Xo={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},qo=["aria-pressed"],Go={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24"},Yo={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24"},Zo=["aria-label"],Jo=["innerHTML"],Qo={class:"code-loading-placeholder"},er=/* @__PURE__ */le(/* @__PURE__ */p({__name:"MarkdownCodeBlockNode",props:{node:{},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},darkTheme:{default:"vitesse-dark"},lightTheme:{default:"vitesse-light"},isDark:{type:Boolean,default:!1},isShowPreview:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},minWidth:{default:void 0},maxWidth:{default:void 0},themes:{},showHeader:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},showPreviewButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},showTooltips:{type:Boolean}},emits:["previewCode","copy"],setup(e,{emit:n}){const t=e,o=n,{t:r}=pn(),l=B(To(t.node.language)),i=B(!1),a=B(!1),s=B(!1),d=B(null),c=B(null),m=B(""),h=B(!1);let p;const g=B(!0),y=B(0),b=B(14),_=B(b.value),T=C(()=>{const e=b.value,n=_.value;return"number"==typeof e&&Number.isFinite(e)&&e>0&&"number"==typeof n&&Number.isFinite(n)&&n>0}),L=C(()=>{const e=l.value.trim().toLowerCase();return So[e]||e.charAt(0).toUpperCase()+e.slice(1)}),N=C(()=>(ko.value,Io(l.value.trim().toLowerCase().split(":")[0]))),P=C(()=>{const e=l.value.trim().toLowerCase();return t.isShowPreview&&("html"===e||"svg"===e)}),D=C(()=>{const e={},n=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},o=n(t.minWidth),r=n(t.maxWidth);return o&&(e.minWidth=o),r&&(e.maxWidth=r),e}),R=C(()=>({fontSize:`${_.value}px`})),K=C(()=>!1!==t.showTooltips);function z(){return t.isDark?t.darkTheme:t.lightTheme}function F(e){if(null==p||p.disconnect(),p=void 0,!e)return m.value="",void(h.value=!1);var n;m.value=`<pre class="shiki shiki-fallback"><code>${n=e,n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}</code></pre>`,h.value=!1}function U(){m.value="",h.value=!0}function X(){var e;const n=c.value;return!!n&&(n.childNodes.length>0||Boolean(null==(e=n.textContent)?void 0:e.trim().length))}function q(){return u(this,null,function*(){if(yield H(),X())return void U();const e=c.value;e&&(null==p||p.disconnect(),p=new MutationObserver(()=>{X()&&(U(),null==p||p.disconnect(),p=void 0)}),p.observe(e,{childList:!0,subtree:!0}))})}let G,Y,Z,J;const Q=/* @__PURE__ */new Set,ee=/* @__PURE__ */new Set,ne=void 0!==import.meta&&Boolean(!1);function te(e,n){return u(this,null,function*(){if(!G)return;const t=function(e,n=!1){var t;const[o]=String(null!=e?e:"").split(":"),r=null!=(t=null==o?void 0:o.trim().toLowerCase())?t:"";return r?!J||J.has(r)?r:(n&&ne&&!Q.has(r)&&(Q.add(r),console.warn(`[MarkdownCodeBlockNode] Language "${r}" not preloaded in stream-markdown; falling back to plaintext.`)),"plaintext"):"plaintext"}(n,Boolean(e&&e.length));try{yield G.updateCode(e,t)}catch(o){"plaintext"!==t?(ne&&!ee.has(t)&&(ee.add(t),console.warn(`[MarkdownCodeBlockNode] Failed to render language "${t}", retrying as plaintext.`,o)),yield G.updateCode(e,"plaintext")):ne&&console.warn("[MarkdownCodeBlockNode] Failed to render code block even as plaintext.",o)}})}function oe(){return u(this,null,function*(){yield function(){return u(this,null,function*(){if(!Y)try{const e=yield import("stream-markdown");Y=e.createShikiStreamRenderer,Z=e.registerHighlight;const n=Array.isArray(e.defaultLanguages)?e.defaultLanguages:void 0;J=n?new Set(n.map(e=>e.toLowerCase())):void 0,null==Z||Z({themes:t.themes})}catch(e){console.warn("[MarkdownCodeBlockNode] stream-markdown not available:",e)}})}(),d.value&&c.value?(null==Z||Z({themes:t.themes}),!G&&Y&&(G=Y(c.value,{theme:z()}),h.value=!0),G?!1===t.stream&&t.loading?F(t.node.code):(F(t.node.code),yield te(t.node.code,l.value),yield q()):F(t.node.code)):F(t.node.code)})}function re(){const e=d.value;if(!e||a.value)return;const n=e.scrollTop;n<y.value?g.value=!1:function(e,n=50){return e.scrollHeight-e.scrollTop-e.clientHeight<=n}(e)&&(g.value=!0),y.value=n}function le(){return u(this,null,function*(){try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(t.node.code)),i.value=!0,o("copy",t.node.code),setTimeout(()=>{i.value=!1},1e3)}catch(e){console.error("Copy failed:",e)}})}function ie(e){const n=e.currentTarget||e.target;return!n||n.disabled?null:n}function ae(e,n,o="top"){if(!K.value)return;const r=ie(e);if(!r)return;const l=e;un(r,n,o,!1,null!=(null==l?void 0:l.clientX)&&null!=(null==l?void 0:l.clientY)?{x:l.clientX,y:l.clientY}:void 0,t.isDark)}function se(){K.value&&cn()}function de(e){if(!K.value)return;const n=ie(e);if(!n)return;const o=e;un(n,i.value?r("common.copied")||"Copied":r("common.copy")||"Copy","top",!1,null!=(null==o?void 0:o.clientX)&&null!=(null==o?void 0:o.clientY)?{x:o.clientX,y:o.clientY}:void 0,t.isDark)}function ue(){a.value=!a.value;const e=d.value;e&&(a.value?(e.style.maxHeight="none",e.style["overflow-y"]="visible",e.style["overflow-x"]="auto"):(e.style.maxHeight="500px",e.style.overflow="auto",g.value=!0,H(()=>{e.scrollHeight>e.clientHeight&&(e.scrollTop=e.scrollHeight)})))}function ce(){s.value=!s.value}function me(){if(!P.value)return;const e=(l.value||t.node.language).toLowerCase(),n="html"===e?"HTML Preview":"SVG Preview";o("previewCode",{type:"html"===e?"text/html":"image/svg+xml",content:t.node.code,title:n})}return oe(),S(()=>{oe()}),$(()=>{null==p||p.disconnect(),p=void 0}),I(()=>t.themes,()=>u(null,null,function*(){Z&&Z({themes:t.themes})})),I(()=>t.loading,e=>{e||oe()}),I(K,e=>{e||cn()}),I(()=>[t.node.code,t.node.language],e=>u(null,[e],function*([e,n]){const o=To(n);o!==l.value&&(l.value=o),d.value&&c.value?(G||(F(e),yield oe()),G&&e&&(!1===t.stream&&t.loading||(F(e),yield te(e,n),yield q()))):F(e)})),I(()=>[t.darkTheme,t.lightTheme],()=>u(null,null,function*(){d.value&&c.value&&(G||(yield oe()),null==G||G.setTheme(z()))})),I(()=>t.node.code,()=>u(null,null,function*(){if(a.value||!g.value)return;yield H();const e=d.value;e&&e.scrollHeight>e.clientHeight&&(e.scrollTop=e.scrollHeight)})),(n,o)=>(v(),f("div",{style:W(D.value),class:E(["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",[t.isDark?"border-gray-700/30 bg-gray-900":"border-gray-200 bg-white",t.isDark?"is-dark":""]])},[t.showHeader?(v(),f("div",Po,[V(n.$slots,"header-left",{},()=>[k("div",Do,[k("span",{class:"icon-slot h-4 w-4 flex-shrink-0",innerHTML:N.value},null,8,Ro),k("span",Ko,M(L.value),1)])],!0),V(n.$slots,"header-right",{},()=>[k("div",Oo,[t.showCollapseButton?(v(),f("button",{key:0,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":s.value,onClick:ce,onMouseenter:o[0]||(o[0]=e=>ae(e,s.value?w(r)("common.expand")||"Expand":w(r)("common.collapse")||"Collapse")),onFocus:o[1]||(o[1]=e=>ae(e,s.value?w(r)("common.expand")||"Expand":w(r)("common.collapse")||"Collapse")),onMouseleave:se,onBlur:se},[(v(),f("svg",{style:W({rotate:s.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[...o[17]||(o[17]=[k("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,Wo)):j("",!0),t.showFontSizeButtons&&t.enableFontSizeControl?(v(),f(x,{key:1},[k("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!!Number.isFinite(_.value)&&_.value<=10,onClick:o[2]||(o[2]=e=>function(){const e=Math.max(10,_.value-1);_.value=e}()),onMouseenter:o[3]||(o[3]=e=>ae(e,w(r)("common.decrease")||"Decrease")),onFocus:o[4]||(o[4]=e=>ae(e,w(r)("common.decrease")||"Decrease")),onMouseleave:se,onBlur:se},[...o[18]||(o[18]=[k("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[k("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14"})],-1)])],40,Ao),k("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!T.value||_.value===b.value,onClick:o[5]||(o[5]=e=>{_.value=b.value}),onMouseenter:o[6]||(o[6]=e=>ae(e,w(r)("common.reset")||"Reset")),onFocus:o[7]||(o[7]=e=>ae(e,w(r)("common.reset")||"Reset")),onMouseleave:se,onBlur:se},[...o[19]||(o[19]=[k("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[k("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[k("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),k("path",{d:"M3 3v5h5"})])],-1)])],40,zo),k("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!!Number.isFinite(_.value)&&_.value>=36,onClick:o[8]||(o[8]=e=>function(){const e=Math.min(36,_.value+1);_.value=e}()),onMouseenter:o[9]||(o[9]=e=>ae(e,w(r)("common.increase")||"Increase")),onFocus:o[10]||(o[10]=e=>ae(e,w(r)("common.increase")||"Increase")),onMouseleave:se,onBlur:se},[...o[20]||(o[20]=[k("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[k("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1)])],40,Fo)],64)):j("",!0),t.showCopyButton?(v(),f("button",{key:2,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":i.value?w(r)("common.copied")||"Copied":w(r)("common.copy")||"Copy",onClick:le,onMouseenter:o[11]||(o[11]=e=>de(e)),onFocus:o[12]||(o[12]=e=>de(e)),onMouseleave:se,onBlur:se},[i.value?(v(),f("svg",Xo,[...o[22]||(o[22]=[k("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(v(),f("svg",Uo,[...o[21]||(o[21]=[k("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[k("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),k("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],40,Vo)):j("",!0),t.showExpandButton?(v(),f("button",{key:3,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":a.value,onClick:ue,onMouseenter:o[13]||(o[13]=e=>ae(e,a.value?w(r)("common.collapse")||"Collapse":w(r)("common.expand")||"Expand")),onFocus:o[14]||(o[14]=e=>ae(e,a.value?w(r)("common.collapse")||"Collapse":w(r)("common.expand")||"Expand")),onMouseleave:se,onBlur:se},[a.value?(v(),f("svg",Go,[...o[23]||(o[23]=[k("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"},null,-1)])])):(v(),f("svg",Yo,[...o[24]||(o[24]=[k("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"},null,-1)])]))],40,qo)):j("",!0),P.value&&t.showPreviewButton?(v(),f("button",{key:4,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":w(r)("common.preview")||"Preview",onClick:me,onMouseenter:o[15]||(o[15]=e=>ae(e,w(r)("common.preview")||"Preview")),onFocus:o[16]||(o[16]=e=>ae(e,w(r)("common.preview")||"Preview")),onMouseleave:se,onBlur:se},[...o[25]||(o[25]=[k("svg",{"data-v-3d59cc65":"",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[k("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[k("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),k("circle",{cx:"12",cy:"12",r:"3"})])],-1)])],40,Zo)):j("",!0)])],!0)])):j("",!0),O(k("div",{ref_key:"codeBlockContent",ref:d,class:"code-block-content",style:W(R.value),onScroll:re},[k("div",{ref_key:"rendererTarget",ref:c,class:"code-block-render"},null,512),h.value?j("",!0):(v(),f("div",{key:0,class:"code-fallback-plain",innerHTML:m.value},null,8,Jo))],36),[[A,!(s.value||!e.stream&&e.loading)]]),O(k("div",Qo,[V(n.$slots,"loading",{loading:e.loading,stream:e.stream},()=>[o[26]||(o[26]=k("div",{class:"loading-skeleton"},[k("div",{class:"skeleton-line"}),k("div",{class:"skeleton-line"}),k("div",{class:"skeleton-line short"})],-1))],!0)],512),[[A,!e.stream&&e.loading]])],6))}}),[["__scopeId","data-v-3397f01a"]]);er.install=e=>{e.component(er.__name,er)};const nr=()=>import("mermaid");let tr=null,or=nr;function rr(e){or=e,tr=null}function lr(e){rr(null!=e?e:nr)}function ir(){rr(null)}function ar(){return"function"==typeof or}function sr(e){if(!e)return e;const n=e&&e.default?e.default:e;if(n&&("function"==typeof n.render||"function"==typeof n.parse||"function"==typeof n.initialize))return n;if(n&&n.mermaidAPI&&("function"==typeof n.mermaidAPI.render||"function"==typeof n.mermaidAPI.parse)){const e=n.mermaidAPI;return s(a({},n),{render:e.render.bind(e),parse:e.parse?e.parse.bind(e):void 0,initialize:t=>"function"==typeof n.initialize?n.initialize(t):e.initialize?e.initialize(t):void 0})}return e.mermaid&&"function"==typeof e.mermaid.render?e.mermaid:n}function dr(e){if(e)try{const n=null==e?void 0:e.initialize;e.initialize=t=>{const o=a({suppressErrorRendering:!0},t||{});return"function"==typeof n?n.call(e,o):(null==e?void 0:e.mermaidAPI)&&"function"==typeof e.mermaidAPI.initialize?e.mermaidAPI.initialize(o):void 0}}catch(n){}}function ur(){return u(this,null,function*(){if(tr)return tr;const e=function(){try{const e=globalThis;return sr(null==e?void 0:e.mermaid)}catch(e){return null}}();if(e)return tr=e,dr(tr),tr;const n=or;if(!n)return null;let t;try{t=yield n()}catch(o){if(n===nr)throw new Error('Optional dependency "mermaid" is not installed. Please install it to enable mermaid diagrams.');throw o}return t?(tr=sr(t),dr(tr),tr):null})}function cr(e){return JSON.stringify(e)}function mr(e){var n;const t=null!=(n=e.mode)?n:"classic",o=e.katexUrl,r=e.mhchemUrl,l=cr(a({throwOnError:!0,displayMode:!0,output:"html",strict:"ignore"},e.renderOptions||{})),i=cr(o),s=r?cr(r):'""';return"module"===t?`\nlet DEBUG = false\nlet katex = null\nlet katexLoadError = null\nlet loadPromise = null\n\nfunction normalizeKaTeX(mod) {\n const resolved = (mod && mod.default) ? mod.default : mod\n if (resolved && typeof resolved.renderToString === 'function')\n return resolved\n return null\n}\n\nasync function loadKaTeX() {\n if (katex || katexLoadError)\n return\n if (!loadPromise) {\n loadPromise = (async () => {\n try {\n const mod = await import(${i})\n katex = normalizeKaTeX(mod) || null\n const mhchemUrl = ${s}\n if (mhchemUrl) {\n try {\n await import(mhchemUrl)\n }\n catch (e) {\n // ignore optional mhchem load failures\n if (DEBUG)\n console.warn('[katex-cdn-worker] failed to load mhchem', e)\n }\n }\n }\n catch (e) {\n katexLoadError = e\n }\n })()\n }\n await loadPromise\n}\n\nglobalThis.addEventListener('message', async (ev) => {\n const data = ev.data || {}\n if (data.type === 'init') {\n DEBUG = !!data.debug\n if (DEBUG)\n console.debug('[katex-cdn-worker] debug enabled')\n return\n }\n const id = data.id ?? ''\n const content = data.content ?? ''\n const displayMode = data.displayMode ?? true\n\n await loadKaTeX()\n\n if (!katex) {\n const reason = katexLoadError ? String(katexLoadError?.message || katexLoadError) : 'KaTeX is not available in worker'\n globalThis.postMessage({ id, error: reason, content, displayMode })\n return\n }\n\n try {\n const opts = ${l}\n const html = katex.renderToString(content, { ...opts, displayMode: !!displayMode })\n globalThis.postMessage({ id, html, content, displayMode })\n }\n catch (err) {\n const msg = String(err?.message || err)\n globalThis.postMessage({ id, error: msg, content, displayMode })\n }\n})\n`.trimStart():`\nlet DEBUG = false\nlet katex = null\nlet katexLoadError = null\n\nfunction normalizeKaTeX(val) {\n const resolved = (val && val.default) ? val.default : val\n if (resolved && typeof resolved.renderToString === 'function')\n return resolved\n return null\n}\n\nfunction loadKaTeXClassic() {\n if (katex || katexLoadError)\n return\n try {\n importScripts(${i})\n const mhchemUrl = ${s}\n if (mhchemUrl) {\n try {\n importScripts(mhchemUrl)\n }\n catch (e) {\n // ignore optional mhchem load failures\n if (DEBUG)\n console.warn('[katex-cdn-worker] failed to load mhchem', e)\n }\n }\n katex = normalizeKaTeX(globalThis.katex)\n }\n catch (e) {\n katexLoadError = e\n }\n}\n\nloadKaTeXClassic()\n\nglobalThis.addEventListener('message', (ev) => {\n const data = ev.data || {}\n if (data.type === 'init') {\n DEBUG = !!data.debug\n if (DEBUG)\n console.debug('[katex-cdn-worker] debug enabled')\n return\n }\n const id = data.id ?? ''\n const content = data.content ?? ''\n const displayMode = data.displayMode ?? true\n\n if (!katex && !katexLoadError)\n loadKaTeXClassic()\n\n if (!katex) {\n const reason = katexLoadError ? String(katexLoadError?.message || katexLoadError) : 'KaTeX is not available in worker'\n globalThis.postMessage({ id, error: reason, content, displayMode })\n return\n }\n\n try {\n const opts = ${l}\n const html = katex.renderToString(content, { ...opts, displayMode: !!displayMode })\n globalThis.postMessage({ id, html, content, displayMode })\n }\n catch (err) {\n const msg = String(err?.message || err)\n globalThis.postMessage({ id, error: msg, content, displayMode })\n }\n})\n`.trimStart()}function hr(e){var n,t;const o=mr(e);if("undefined"==typeof Worker||"undefined"==typeof URL||"undefined"==typeof Blob)return{worker:null,dispose:()=>{},source:o};const r=new Blob([o],{type:"text/javascript"}),l=URL.createObjectURL(r);let i=!1;const d="module"===(null!=(n=e.mode)?n:"classic")?s(a({},null!=(t=e.workerOptions)?t:{}),{type:"module"}):e.workerOptions,u=new Worker(l,d);if(e.debug)try{u.postMessage({type:"init",debug:!0})}catch(c){}return{worker:u,dispose:()=>{if(!i){i=!0;try{URL.revokeObjectURL(l)}catch(c){}}},source:o}}Ye.install=e=>{e.component(Ye.__name,Ye)};let pr=null,vr=null,fr=!1;const gr=/* @__PURE__ */new Map,yr=/* @__PURE__ */new Map;let wr=5;const kr=/* @__PURE__ */new Set;function xr(){if(gr.size<wr&&kr.size){const n=Array.from(kr);kr.clear();for(const t of n)try{t()}catch(e){}}}function br(e){pr=e,vr=null,pr.onmessage=e=>{const{id:n,html:t,error:o}=e.data,r=gr.get(n);if(r)if(gr.delete(n),clearTimeout(r.timeoutId),xr(),o)r.reject(new Error(o));else{const{content:n,displayMode:o}=e.data;if(n){const e=`${o?"d":"i"}:${n}`;if(yr.set(e,t),yr.size>200){const e=yr.keys().next().value;yr.delete(e)}}r.resolve(t)}},pr.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[n,t]of gr.entries())clearTimeout(t.timeoutId),t.reject(new Error(`Worker error: ${e.message}`));gr.clear(),xr()}}function Mr(){var e;pr&&(null==(e=pr.terminate)||e.call(pr)),pr=null,vr=null}function _r(e){fr=!!e,pr&&pr.postMessage({type:"init",debug:fr})}function Tr(e,n=!0,t=2e3,o){return u(this,null,function*(){if(performance.now(),!Hn()){const e=new Error("KaTeX rendering disabled");return e.name="KaTeXDisabled",e.code="KATEX_DISABLED",Promise.reject(e)}if(vr)return Promise.reject(vr);const r=`${n?"d":"i"}:${e}`,l=yr.get(r);if(l)return Promise.resolve(l);const i=pr||(vr=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),vr.name="WorkerInitError",vr.code="WORKER_INIT_ERROR",null);if(!i)return Promise.reject(vr);if(gr.size>=wr){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code="WORKER_BUSY",e.busy=!0,e.inFlight=gr.size,e.max=wr,Promise.reject(e)}return new Promise((r,l)=>{if(null==o?void 0:o.aborted){const e=new Error("Aborted");return e.name="AbortError",void l(e)}const a=Math.random().toString(36).slice(2),s=globalThis.setTimeout(()=>{gr.delete(a);const e=new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",l(e),xr()},t);o&&o.addEventListener("abort",()=>{globalThis.clearTimeout(s),gr.has(a)&&gr.delete(a);const e=new Error("Aborted");e.name="AbortError",l(e),xr()},{once:!0});const d=r,u=l;gr.set(a,{resolve:e=>{d(e)},reject:e=>{u(e)},timeoutId:s}),i.postMessage({id:a,content:e,displayMode:n})})})}function Cr(e,n=!0,t){const o=`${n?"d":"i"}:${e}`;if(yr.set(o,t),yr.size>200){const e=yr.keys().next().value;yr.delete(e)}}function Br(){return{inFlight:gr.size,max:wr}}function Ir(e){Number.isFinite(e)&&e>0&&(wr=Math.floor(e))}const Sr="WORKER_BUSY";function $r(){return gr.size>=wr}function Er(e=2e3,n){return gr.size<wr?Promise.resolve():new Promise((t,o)=>{let r,l=!1;const i=()=>{l||(l=!0,r&&globalThis.clearTimeout(r),kr.delete(i),t())};if(kr.add(i),r=globalThis.setTimeout(()=>{if(l)return;l=!0,kr.delete(i);const e=new Error("Wait for worker slot timed out");e.name="WorkerBusyTimeout",e.code="WORKER_BUSY_TIMEOUT",o(e)},e),queueMicrotask(()=>xr()),n){const e=()=>{if(l)return;l=!0,r&&globalThis.clearTimeout(r),kr.delete(i);const e=new Error("Aborted");e.name="AbortError",o(e)};n.aborted?e():n.addEventListener("abort",e,{once:!0})}})}const Lr={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function Nr(e){null!=e.timeout&&(Lr.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(Lr.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(Lr.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(Lr.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function jr(){return a({},Lr)}function Hr(e){return u(this,arguments,function*(e,n=!0,t={}){var o,r,l,i;if(!Hn()){const e=new Error("KaTeX rendering disabled");throw e.name="KaTeXDisabled",e.code="KATEX_DISABLED",e}const a=null!=(o=t.timeout)?o:Lr.timeout,s=null!=(r=t.waitTimeout)?r:Lr.waitTimeout,d=null!=(l=t.backoffMs)?l:Lr.backoffMs,u=null!=(i=t.maxRetries)?i:Lr.maxRetries,c=Number.isFinite(u)?Math.max(0,Math.min(Math.floor(u),8)):Lr.maxRetries,m=t.signal;let h=0;for(;;){if(null==m?void 0:m.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}try{return yield Tr(e,n,a,m)}catch(p){if((null==p?void 0:p.code)!==Sr||h>=c)throw p;if(h++,yield Er(s,m).catch(()=>{}),null==m?void 0:m.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}d>0&&(yield new Promise(e=>globalThis.setTimeout(e,d*h)))}}})}function Pr(e){return JSON.stringify(e)}function Dr(e){var n;const t=null!=(n=e.mode)?n:"module",o=Pr(e.mermaidUrl),r=`\nlet DEBUG = false\nlet mermaid = null\nlet mermaidLoadError = null\n\nfunction normalizeMermaidModule(mod) {\n if (!mod)\n return mod\n const candidate = (mod && mod.default) ? mod.default : mod\n if (candidate && (typeof candidate.render === 'function' || typeof candidate.parse === 'function' || typeof candidate.initialize === 'function'))\n return candidate\n if (candidate && candidate.mermaidAPI && (typeof candidate.mermaidAPI.render === 'function' || typeof candidate.mermaidAPI.parse === 'function')) {\n const api = candidate.mermaidAPI\n return {\n ...candidate,\n render: api.render ? api.render.bind(api) : undefined,\n parse: api.parse ? api.parse.bind(api) : undefined,\n initialize: (opts) => {\n if (typeof candidate.initialize === 'function')\n return candidate.initialize(opts)\n return api.initialize ? api.initialize(opts) : undefined\n },\n }\n }\n if (mod && mod.mermaid && typeof mod.mermaid.parse === 'function')\n return mod.mermaid\n return candidate\n}\n\nfunction applyThemeTo(code, theme) {\n const themeValue = theme === 'dark' ? 'dark' : 'default'\n const themeConfig = \`%%{init: {"theme": "\${themeValue}"}}%%\\n\`\n const trimmed = (code || '').trimStart()\n if (trimmed.startsWith('%%{'))\n return code\n return themeConfig + code\n}\n\nfunction findHeaderIndex(lines) {\n const headerRe = /^(?:graph|flowchart|flowchart\\s+tb|flowchart\\s+lr|sequenceDiagram|gantt|classDiagram|stateDiagram(?:-v2)?|erDiagram|journey|pie|quadrantChart|timeline|xychart(?:-beta)?)\\b/\n for (let i = 0; i < lines.length; i++) {\n const l = (lines[i] || '').trim()\n if (!l)\n continue\n if (l.startsWith('%%'))\n continue\n if (headerRe.test(l))\n return i\n }\n return -1\n}\n\nasync function canParse(code, theme) {\n const themed = applyThemeTo(code, theme)\n const anyMermaid = mermaid\n if (anyMermaid && typeof anyMermaid.parse === 'function') {\n await anyMermaid.parse(themed)\n return true\n }\n throw new Error('mermaid.parse not available in worker')\n}\n\nasync function findLastRenderablePrefix(baseCode, theme) {\n const lines = String(baseCode || '').split('\\n')\n const headerIdx = findHeaderIndex(lines)\n if (headerIdx === -1)\n return null\n const head = lines.slice(0, headerIdx + 1)\n await canParse(head.join('\\n'), theme)\n\n let low = headerIdx + 1\n let high = lines.length\n let lastGood = headerIdx + 1\n let tries = 0\n const MAX_TRIES = 12\n\n while (low <= high && tries < MAX_TRIES) {\n const mid = Math.floor((low + high) / 2)\n const candidate = [...head, ...lines.slice(headerIdx + 1, mid)].join('\\n')\n tries++\n try {\n await canParse(candidate, theme)\n lastGood = mid\n low = mid + 1\n }\n catch {\n high = mid - 1\n }\n }\n\n return [...head, ...lines.slice(headerIdx + 1, lastGood)].join('\\n')\n}\n\nfunction initMermaidOnce() {\n if (!mermaid)\n return\n try {\n if (typeof mermaid.initialize === 'function')\n mermaid.initialize(${Pr(a({startOnLoad:!1,securityLevel:"loose"},e.initializeOptions||{}))})\n }\n catch (e) {\n if (DEBUG)\n console.warn('[mermaid-cdn-worker] initialize failed', e)\n }\n}\n\nglobalThis.addEventListener('message', async (ev) => {\n const msg = ev.data || {}\n if (msg.type === 'init') {\n DEBUG = !!msg.debug\n if (DEBUG)\n console.debug('[mermaid-cdn-worker] debug enabled')\n return\n }\n\n const id = msg.id\n const action = msg.action\n const payload = msg.payload || {}\n\n if (!mermaid) {\n const errMsg = mermaidLoadError ? String(mermaidLoadError?.message || mermaidLoadError) : 'Mermaid is not available in worker'\n globalThis.postMessage({ id, ok: false, error: errMsg })\n return\n }\n\n try {\n if (action === 'canParse') {\n const ok = await canParse(payload.code, payload.theme)\n globalThis.postMessage({ id, ok: true, result: ok })\n return\n }\n if (action === 'findPrefix') {\n const res = await findLastRenderablePrefix(payload.code, payload.theme)\n globalThis.postMessage({ id, ok: true, result: res })\n return\n }\n globalThis.postMessage({ id, ok: false, error: 'Unknown action' })\n }\n catch (e) {\n globalThis.postMessage({ id, ok: false, error: String(e?.message || e) })\n }\n})\n`.trimStart();return"module"===t?`\n${r}\n\nlet loadPromise = null\nasync function loadMermaid() {\n if (mermaid || mermaidLoadError)\n return\n if (!loadPromise) {\n loadPromise = (async () => {\n try {\n const mod = await import(${o})\n mermaid = normalizeMermaidModule(mod) || null\n initMermaidOnce()\n }\n catch (e) {\n mermaidLoadError = e\n }\n })()\n }\n await loadPromise\n}\n\n// Load immediately; failures are reported per-request\nawait loadMermaid()\n`.trimStart():`\n${r}\n\nfunction loadMermaidClassic() {\n if (mermaid || mermaidLoadError)\n return\n try {\n importScripts(${o})\n mermaid = normalizeMermaidModule(globalThis.mermaid) || null\n initMermaidOnce()\n }\n catch (e) {\n mermaidLoadError = e\n }\n}\n\nloadMermaidClassic()\n`.trimStart()}function Rr(e){var n,t;const o=Dr(e);if("undefined"==typeof Worker||"undefined"==typeof URL||"undefined"==typeof Blob)return{worker:null,dispose:()=>{},source:o};const r=new Blob([o],{type:"text/javascript"}),l=URL.createObjectURL(r);let i=!1;const d="module"===(null!=(n=e.mode)?n:"module")?s(a({},null!=(t=e.workerOptions)?t:{}),{type:"module"}):e.workerOptions,u=new Worker(l,d);if(e.debug)try{u.postMessage({type:"init",debug:!0})}catch(c){}return{worker:u,dispose:()=>{if(!i){i=!0;try{URL.revokeObjectURL(l)}catch(c){}}},source:o}}let Kr=null,Or=null;const Wr=/* @__PURE__ */new Map;let Ar=5,zr=!1;function Fr(e){zr=!!e}function Vr(e){Number.isFinite(e)&&e>0&&(Ar=Math.floor(e))}function Ur(){return{inFlight:Wr.size,max:Ar}}const Xr="WORKER_BUSY",qr="MERMAID_DISABLED";function Gr(e){Kr=e,Or=null;const n=e;Kr.onmessage=e=>{if(Kr!==n)return;const{id:t,ok:o,result:r,error:l}=e.data,i=Wr.get(t);i&&(!1===o||l?i.reject(new Error(l||"Unknown error")):i.resolve(r))},Kr.onerror=e=>{var t,o;if(Kr===n)if(0!==Wr.size){try{zr?console.error("[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e):null==(o=console.debug)||o.call(console,"[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e)}catch(r){}for(const[n,t]of Wr.entries())t.reject(new Error(`Worker error: ${e.message}`));Wr.clear()}else null==(t=console.debug)||t.call(console,"[mermaidWorkerClient] Worker error (no pending):",(null==e?void 0:e.message)||e)},Kr.onmessageerror=e=>{var t,o;if(Kr===n)if(0!==Wr.size){try{zr?console.error("[mermaidWorkerClient] Worker messageerror:",e):null==(o=console.debug)||o.call(console,"[mermaidWorkerClient] Worker messageerror:",e)}catch(r){}for(const[e,n]of Wr.entries())n.reject(new Error("Worker messageerror"));Wr.clear()}else null==(t=console.debug)||t.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function Yr(){var e;if(Kr)try{for(const[e,n]of Wr.entries())n.reject(new Error("Worker cleared"));Wr.clear(),null==(e=Kr.terminate)||e.call(Kr)}catch(n){}Kr=null,Or=null}function Zr(e,n,t=1400){if(!ar()){const e=new Error("Mermaid rendering disabled");return e.name="MermaidDisabled",e.code=qr,Promise.reject(e)}if(Or)return Promise.reject(Or);const o=Kr||(Or=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),Or.name="WorkerInitError",Or.code="WORKER_INIT_ERROR",null);if(!o)return Promise.reject(Or);if(Wr.size>=Ar){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=Xr,e.inFlight=Wr.size,e.max=Ar,Promise.reject(e)}return new Promise((r,l)=>{const i=Math.random().toString(36).slice(2);let a,s=!1;const d=()=>{s||(s=!0,null!=a&&globalThis.clearTimeout(a),Wr.delete(i))},u={resolve:e=>{d(),r(e)},reject:e=>{d(),l(e)}};Wr.set(i,u);try{o.postMessage({id:i,action:e,payload:n})}catch(c){return Wr.delete(i),void l(c)}a=globalThis.setTimeout(()=>{const e=new Error("Worker call timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT";const n=Wr.get(i);n&&n.reject(e)},t)})}function Jr(e,n,t=1400){return u(this,null,function*(){try{return yield Zr("canParse",{code:e,theme:n},t)}catch(o){return Promise.reject(o)}})}function Qr(e,n,t=1400){return u(this,null,function*(){try{return yield Zr("findPrefix",{code:e,theme:n},t)}catch(o){return Promise.reject(o)}})}function el(){if(Kr)try{for(const[e,n]of Wr.entries())n.reject(new Error("Worker terminated"));Wr.clear(),Kr.terminate()}finally{Kr=null}}const nl=X(()=>import("./index4.js")),tl=X(()=>import("./index3.js")),ol=X(()=>import("./index2.js")),rl=X(()=>import("./index5.js")),ll=X(()=>import("./index6.js")),il=X(()=>import("./index7.js")),al={AdmonitionNode:Yt,BlockquoteNode:ie,CheckboxNode:de,CodeBlockNode:nl,DefinitionListNode:he,EmojiNode:ve,EmphasisNode:ut,FootnoteNode:vt,FootnoteReferenceNode:Ce,FootnoteAnchorNode:mt,HardBreakNode:gt,HeadingNode:wt,HtmlBlockNode:_t,HtmlInlineNode:Fe,HighlightNode:st,ImageNode:Tn,D2BlockNode:il,InfographicBlockNode:ll,InlineCodeNode:Xe,PreCodeNode:St,InsertNode:it,LinkNode:rt,ListItemNode:kt,ListNode:xt,MathBlockNode:tl,MathInlineNode:ol,MermaidBlockNode:rl,ParagraphNode:Ct,StrikethroughNode:Qn,StrongNode:Zn,SubscriptNode:Gn,SuperscriptNode:Un,TableNode:Ht,TextNode:On,ThematicBreakNode:Dt,VmrContainerNode:Ot,ReferenceNode:zn,MarkdownCodeBlockNode:er},sl={install(e,n){Object.entries(al).forEach(([n,t])=>{e.component(n,t)}),(null==n?void 0:n.getLanguageIcon)&&_o(n.getLanguageIcon),(null==n?void 0:n.mathOptions)&&h(n.mathOptions)}};export{Ct as $,Yt as A,ie as B,de as C,il as D,ve as E,mt as F,wt as G,gt as H,st as I,_t as J,Fe as K,Tn as L,ll as M,Xe as N,it as O,rt as P,kt as Q,xt as R,qr as S,Xr as T,er as U,zt as V,Sr as W,tl as X,ol as Y,rl as Z,le as _,gn as a,zn as a0,Qn as a1,Zn as a2,Gn as a3,Un as a4,Ht as a5,On as a6,Dt as a7,Ye as a8,Ot as a9,ar as aA,$o as aB,Bo as aC,ho as aD,uo as aE,be as aF,Tr as aG,ke as aH,eo as aI,hn as aJ,Nr as aK,br as aL,_r as aM,Ir as aN,Ln as aO,_o as aP,rr as aQ,Gr as aR,Fr as aS,Vr as aT,Er as aU,sl as aa,mr as ab,Dr as ac,Me as ad,Mr as ae,Yr as af,hr as ag,Rr as ah,mo as ai,to as aj,jn as ak,ir as al,Lo as am,no as an,Nn as ao,lr as ap,Eo as aq,co as ar,xe as as,jr as at,Br as au,Ur as av,No as aw,oo as ax,$r as ay,Hn as az,ko as b,Io as c,St as d,un as e,Ho as f,so as g,cn as h,Hr as i,Pn as j,Cr as k,So as l,ur as m,To as n,Jr as o,Qr as p,ro as q,Co as r,jo as s,el as t,pn as u,nl as v,he as w,ut as x,vt as y,Ce as z};
1
+ var e=Object.defineProperty,n=Object.defineProperties,t=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,i=(n,t,o)=>t in n?e(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o,a=(e,n)=>{for(var t in n||(n={}))r.call(n,t)&&i(e,t,n[t]);if(o)for(var t of o(n))l.call(n,t)&&i(e,t,n[t]);return e},s=(e,o)=>n(e,t(o)),d=(e,n,t)=>i(e,"symbol"!=typeof n?n+"":n,t),u=(e,n,t)=>new Promise((o,r)=>{var l=e=>{try{a(t.next(e))}catch(n){r(n)}},i=e=>{try{a(t.throw(e))}catch(n){r(n)}},a=e=>e.done?o(e.value):Promise.resolve(e.value).then(l,i);a((t=t.apply(e,n)).next())});import{getMarkdown as c,parseMarkdownToStructure as m,setDefaultMathOptions as p}from"stream-markdown-parser";import{defineComponent as h,openBlock as v,createElementBlock as f,createVNode as g,unref as y,createElementVNode as w,Fragment as k,renderList as x,toDisplayString as b,shallowRef as M,h as _,computed as T,normalizeClass as C,useAttrs as B,inject as I,ref as S,watch as $,createCommentVNode as E,nextTick as L,onBeforeUnmount as N,createBlock as j,Teleport as H,Transition as P,withCtx as D,withDirectives as R,normalizeStyle as K,vShow as O,createApp as W,provide as A,renderSlot as z,readonly as F,defineAsyncComponent as V,resolveDynamicComponent as U,mergeProps as X,markRaw as q,reactive as G,onMounted as Y}from"vue";import{autoUpdate as Z,offset as J,flip as Q,shift as ee,computePosition as ne}from"@floating-ui/dom";const te=["cite"],oe=(e,n)=>{const t=e.__vccOpts||e;for(const[o,r]of n)t[o]=r;return t},re=/* @__PURE__ */oe(/* @__PURE__ */h({__name:"BlockquoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(v(),f("blockquote",{class:"blockquote",dir:"auto",cite:e.node.cite},[g(y(zt),{"index-key":`blockquote-${n.indexKey}`,nodes:n.node.children||[],"custom-id":n.customId,typewriter:n.typewriter,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))},null,8,["index-key","nodes","custom-id","typewriter"])],8,te))}}),[["__scopeId","data-v-6d8bbd17"]]);re.install=e=>{e.component(re.__name,re)};const le={class:"checkbox-node"},ie=["checked"],ae=/* @__PURE__ */oe(/* @__PURE__ */h({__name:"CheckboxNode",props:{node:{}},setup:e=>(n,t)=>(v(),f("span",le,[w("input",{type:"checkbox",checked:e.node.checked,disabled:"",class:"checkbox-input"},null,8,ie)]))}),[["__scopeId","data-v-8dc6c46f"]]);ae.install=e=>{e.component(ae.__name,ae)};const se={class:"definition-list"},de={class:"definition-term"},ue={class:"definition-desc"},ce=/* @__PURE__ */oe(/* @__PURE__ */h({__name:"DefinitionListNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(e,t)=>(v(),f("dl",se,[(v(!0),f(k,null,x(n.node.items,(o,r)=>(v(),f(k,{key:r},[w("dt",de,[g(y(zt),{"index-key":`definition-term-${n.indexKey}-${r}`,nodes:o.term,"custom-id":n.customId,typewriter:n.typewriter,onCopy:t[0]||(t[0]=n=>e.$emit("copy",n))},null,8,["index-key","nodes","custom-id","typewriter"])]),w("dd",ue,[g(y(zt),{"index-key":`definition-desc-${n.indexKey}-${r}`,nodes:o.definition,"custom-id":n.customId,typewriter:n.typewriter,onCopy:t[1]||(t[1]=n=>e.$emit("copy",n))},null,8,["index-key","nodes","custom-id","typewriter"])])],64))),128))]))}}),[["__scopeId","data-v-f88691d6"]]);ce.install=e=>{e.component(ce.__name,ce)};const me={class:"emoji-node"},pe=/* @__PURE__ */oe(/* @__PURE__ */h({__name:"EmojiNode",props:{node:{}},setup:e=>(n,t)=>(v(),f("span",me,b(e.node.name),1))}),[["__scopeId","data-v-de55dc97"]]);pe.install=e=>{e.component(pe.__name,pe)};const he="__global__",ve="__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__",fe=(()=>{const e=globalThis;if(e[ve])return e[ve];const n={scopedCustomComponents:{},revision:M(0)};return e[ve]=n,n})(),ge=fe.revision;function ye(e,n){"string"==typeof e?fe.scopedCustomComponents[e]=n||{}:fe.scopedCustomComponents[he]=e||{},ge.value++}function we(e){const n=fe.scopedCustomComponents[he]||{};if(!e)return n;const t=fe.scopedCustomComponents[e]||{};return n&&0!==Object.keys(n).length?t&&0!==Object.keys(t).length?a(a({},n),t):n:t}function ke(e){if(e===he)throw new Error("removeCustomComponents: use clearGlobalCustomComponents() to clear the global mapping");delete fe.scopedCustomComponents[e],ge.value++}function xe(){delete fe.scopedCustomComponents[he],ge.value++}const be=["id"],Me=["title"],_e=/* @__PURE__ */oe(/* @__PURE__ */h({__name:"FootnoteReferenceNode",props:{node:{}},setup(e){const n=`#footnote-${e.node.id}`;function t(){if("undefined"==typeof document)return;const e=document.querySelector(n);e?e.scrollIntoView({behavior:"smooth"}):console.warn(`Element with href: ${n} not found`)}return(o,r)=>(v(),f("sup",{id:`fnref-${e.node.id}`,class:"footnote-reference",onClick:t},[w("span",{href:n,title:`查看脚注 ${e.node.id}`,class:"footnote-link cursor-pointer"},"["+b(e.node.id)+"]",9,Me)],8,be))}}),[["__scopeId","data-v-01af0fee"]]);_e.install=e=>{e.component(_e.__name,_e)};const Te=/* @__PURE__ */new Set(["onclick","onerror","onload","onmouseover","onmouseout","onmousedown","onmouseup","onkeydown","onkeyup","onfocus","onblur","onsubmit","onreset","onchange","onselect","ondblclick","ontouchstart","ontouchend","ontouchmove","ontouchcancel","onwheel","onscroll","oncopy","oncut","onpaste","oninput","oninvalid","onreset","onsearch","onsubmit"]),Ce=/* @__PURE__ */new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Be=/* @__PURE__ */new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]),Ie=/<([a-z][a-z0-9-]*)\b[^>]*>/gi,Se=/* @__PURE__ */new Set(["script"]),$e=/* @__PURE__ */new Set(["href","src","srcset","xlink:href","formaction"]),Ee=(()=>{try{return Boolean(!1)}catch(e){}return!1})();function Le(e){Ee&&console.warn(e)}function Ne(e){const n=function(e){let n="";for(const t of e){const e=t.charCodeAt(0);e<=31||127===e||/\s/u.test(t)||(n+=t)}return n}(e).toLowerCase();return!(!n.startsWith("javascript:")&&!n.startsWith("vbscript:"))||!!n.startsWith("data:")&&!(n.startsWith("data:image/")||n.startsWith("data:video/")||n.startsWith("data:audio/"))}function je(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function He(e,n){const t=e.toLowerCase();return!Be.has(t)&&(je(n,t)||je(n,e))}function Pe(e){const n={};for(const[t,o]of Object.entries(e)){const e=t.toLowerCase();Te.has(e)||$e.has(e)&&o&&Ne(o)||(n[t]=o)}return n}function De(e,n){const t=n.toLowerCase();if(["checked","disabled","readonly","required","autofocus","multiple","hidden"].includes(t))return"true"===e||""===e||e===n;if(["value","min","max","step","width","height","size","maxlength"].includes(t)){const n=Number(e);if(""!==e&&!Number.isNaN(n))return n}return e}function Re(e){return e.trim().length>0}function Ke(e,n,t,o,r){if(Se.has(e.toLowerCase()))return null;const l=Pe(n),i=l.key,d=null!=i&&""!==i?i:r;if(He(e,o)){const n=o[e]||o[e.toLowerCase()],r=function(e){const n={};for(const[t,o]of Object.entries(e))n[t]=De(o,t);return n}(l);return _(n,s(a({},r),{key:d}),t.length>0?t:void 0)}return _(e,s(a({},l),{innerHTML:void 0,key:d}),t.length>0?t:void 0)}function Oe(e,n){if(!e||!e.includes("<"))return!1;if(!n||0===Object.keys(n).length)return!1;let t;for(Ie.lastIndex=0;null!==(t=Ie.exec(e));)if(He(t[1],n))return!0;return!1}function We(e,n){if(!e)return[];try{const t=function(e,n){let t=0;const o=[],r=[];for(const l of e)if("text"===l.type)(o.length>0?o[o.length-1].children:r).push(l.content);else if("self_closing"===l.type){const e=Ke(l.tagName,l.attrs||{},[],n,"ms-html-"+t++),i=o.length>0?o[o.length-1].children:r;null!=e&&i.push(e)}else if("tag_open"===l.type)o.push({tagName:l.tagName,children:[],attrs:l.attrs,autoKey:"ms-html-"+t++});else if("tag_close"===l.type){const e=l.tagName.toLowerCase();let t=-1;for(let n=o.length-1;n>=0;n--)if(o[n].tagName.toLowerCase()===e){t=n;break}if(-1!==t)for(;o.length>t;){const l=o.pop(),i=Ke(l.tagName,l.attrs||{},l.children,n,l.autoKey);o.length>0?null!=i&&o[o.length-1].children.push(i):null!=i&&r.push(i),l.tagName.toLowerCase()!==e&&o.length>t&&Le(`Auto-closing unclosed tag: <${l.tagName}>`)}else Le(`Ignoring closing tag with no matching opening tag: </${l.tagName}>`)}for(;o.length>0;){const e=o.pop(),t=Ke(e.tagName,e.attrs||{},e.children,n,e.autoKey);o.length>0?null!=t&&o[o.length-1].children.push(t):null!=t&&r.push(t),Le(`Auto-closing unclosed tag: <${e.tagName}>`)}return r}(function(e){var n,t,o;const r=[];let l=0;for(;l<e.length;){if(e.startsWith("\x3c!--",l)){const n=e.indexOf("--\x3e",l);if(-1!==n){l=n+3;continue}break}const i=e.indexOf("<",l);if(-1===i){if(l<e.length){const n=e.slice(l);Re(n)&&r.push({type:"text",content:n})}break}if(i>l){const n=e.slice(l,i);Re(n)&&r.push({type:"text",content:n})}if(e.startsWith("![CDATA[",i+1)){const n=e.indexOf("]]>",i);if(-1!==n){r.push({type:"text",content:e.slice(i,n+3)}),l=n+3;continue}break}if(e.startsWith("!",i+1)){const n=e.indexOf(">",i);if(-1!==n){l=n+1;continue}break}const a=e.indexOf(">",i);if(-1===a)break;const s=e.slice(i+1,a).trim(),d=s.startsWith("/"),u=s.endsWith("/");if(d){const e=s.slice(1).trim();r.push({type:"tag_close",tagName:e})}else{const e=s.indexOf(" ");let l,i="";-1===e?l=u?s.slice(0,-1).trim():s.trim():(l=s.slice(0,e).trim(),i=s.slice(e+1));const a={};if(i){const e=/([^\s=]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S*)))?/g;let r;for(;null!==(r=e.exec(i));){const e=r[1],l=null!=(o=null!=(t=null!=(n=r[2])?n:r[3])?t:r[4])?o:"";e&&!e.endsWith("/")&&(a[e]=l)}}r.push({type:u||Ce.has(l.toLowerCase())?"self_closing":"tag_open",tagName:l,attrs:a})}l=a+1}return r}(e),n);return t}catch(o){return t=o,Ee&&console.error("Failed to parse HTML to VNodes:",t),null}var t}const Ae=["innerHTML"],ze=/* @__PURE__ */oe(/* @__PURE__ */h({__name:"HtmlInlineNode",props:{node:{},customId:{}},setup(e){const n=e,t=T(()=>(ge.value,we(n.customId))),o=h({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),r=T(()=>{const e=n.node.content;if(!e)return{mode:"html",content:""};if(n.node.loading&&!n.node.autoClosed)return{mode:"text",content:e};if(n.node.loading&&n.node.autoClosed){const n=We(e,t.value);if(null!==n)return{mode:"dynamic",nodes:n}}if(!Oe(e,t.value))return{mode:"html",content:e};const o=We(e,t.value);return null===o?{mode:"html",content:e}:{mode:"dynamic",nodes:o}});return(e,t)=>"dynamic"===r.value.mode?(v(),f("span",{key:0,class:C(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},[g(y(o),{nodes:r.value.nodes},null,8,["nodes"])],2)):"text"===r.value.mode?(v(),f("span",{key:1,class:C(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},b(r.value.content),3)):(v(),f("span",{key:2,class:C(["html-inline-node",{"html-inline-node--loading":n.node.loading}]),innerHTML:r.value.content},null,10,Ae))}}),[["__scopeId","data-v-71cd1a9f"]]);ze.install=e=>{e.component(ze.__name,ze)};const Fe={class:"inline text-[85%] px-1 py-0.5 rounded font-mono bg-[hsl(var(--secondary))] whitespace-normal break-words max-w-full before:content-[''] after:content-['']"},Ve={key:0},Ue=/* @__PURE__ */oe(/* @__PURE__ */h({__name:"InlineCodeNode",props:{node:{}},setup(e){const n=e,t=B(),o=I("markstreamTypewriter",void 0),r=I("markstreamTextStreamState",void 0),l=T(()=>{const e=t.typewriter;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),i=T(()=>"boolean"==typeof l.value?l.value:"boolean"!=typeof(null==o?void 0:o.value)||o.value),a=T(()=>{var e;const n=null!=(e=t["index-key"])?e:t.indexKey;return null==n||""===n?"":String(n)}),s=S(n.node.code),d=S(""),u=S(0);function c(){return s.value+d.value}function m(e){s.value=e,d.value=""}function p(){d.value&&(s.value=c(),d.value="")}$([()=>n.node.code,a,i],([e])=>{const n=String(null!=e?e:""),t=c(),o=a.value,l=o?null==r?void 0:r.get(o):void 0,p=null!=l?l:t;return i.value?n===p?(m(n),void(o&&(null==r||r.set(o,n)))):p&&n.startsWith(p)&&n.length>p.length?(s.value=p,d.value=n.slice(p.length),u.value+=1,void(o&&(null==r||r.set(o,n)))):(m(n),void(o&&(null==r||r.set(o,n)))):(m(n),void(o&&(null==r||r.set(o,n))))},{immediate:!0}),$(i,e=>{e||m(c())});const h=T(()=>u.value%2==0?"inline-code-stream-delta--a":"inline-code-stream-delta--b");return(e,n)=>(v(),f("code",Fe,[s.value?(v(),f("span",Ve,b(s.value),1)):E("",!0),d.value?(v(),f("span",{key:1,class:C(["inline-code-stream-delta",[h.value]]),onAnimationend:p},b(d.value),35)):E("",!0)]))}}),[["__scopeId","data-v-ffb68151"]]);Ue.install=e=>{e.component(Ue.__name,Ue)};const Xe={class:"markstream-vue"},qe=["id"],Ge=/* @__PURE__ */oe(/* @__PURE__ */h({__name:"Tooltip",props:{visible:{type:Boolean},anchorEl:{},content:{},placement:{},offset:{},originX:{},originY:{},id:{},isDark:{type:[Boolean,null]}},setup(e){const n=e,t=T(()=>{if(void 0!==n.isDark&&null!==n.isDark)return Boolean(n.isDark);if("undefined"!=typeof document)try{if(document.documentElement.classList.contains("dark"))return!0;if((null==window?void 0:window.matchMedia)&&window.matchMedia("(prefers-color-scheme: dark)").matches)return!0}catch(e){}return!1}),o=S(null),r=S({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"}),l=S(!1);let i=null;function a(){return u(this,null,function*(){var e,t;if(!n.anchorEl||!o.value)return;const l=[J(null!=(e=n.offset)?e:8),Q(),ee({padding:8})],{x:i,y:a}=yield ne(n.anchorEl,o.value,{placement:null!=(t=n.placement)?t:"top",middleware:l,strategy:"fixed"});r.value.transform=`translate3d(${Math.round(i)}px, ${Math.round(a)}px, 0)`,r.value.left="0px",r.value.top="0px"})}return $(()=>n.visible,e=>u(null,null,function*(){if(e)if(l.value=!1,yield L(),n.anchorEl&&o.value)try{const e=n.anchorEl.getBoundingClientRect();yield a();const t=r.value.transform;if(null!=n.originX&&null!=n.originY){const o=Math.abs(Number(n.originX)-e.left),i=Math.abs(Number(n.originY)-e.top);Math.hypot(o,i)>120?(r.value.transform=`translate3d(${Math.round(n.originX)}px, ${Math.round(n.originY)}px, 0)`,yield L(),l.value=!0,yield L(),r.value.transform=t):l.value=!0}else l.value=!0;i=Z(n.anchorEl,o.value,a)}catch(t){yield a(),l.value=!0,i=Z(n.anchorEl,o.value,a)}else l.value=!0;else l.value=!1,i&&(i(),i=null)})),$([()=>n.anchorEl,()=>n.placement,()=>n.content],()=>u(null,null,function*(){n.visible&&n.anchorEl&&o.value&&(yield L(),yield a())})),N(()=>{i&&i()}),(i,a)=>(v(),j(H,{to:"body"},[w("div",Xe,[g(P,{name:"tooltip",appear:""},{default:D(()=>[R(w("div",{id:n.id,ref_key:"tooltip",ref:o,style:K({position:"fixed",left:r.value.left,top:r.value.top,transform:r.value.transform}),class:C(["z-[9999] inline-block text-base py-2 px-3 rounded-md shadow-md whitespace-nowrap pointer-events-none tooltip-element border",[t.value?"bg-gray-900 text-white border-gray-700 border is-dark":"bg-white text-gray-900 border-gray-200 border"]]),role:"tooltip"},b(e.content),15,qe),[[O,e.visible&&l.value]])]),_:1})])]))}}),[["__scopeId","data-v-d524cc01"]]),Ye=S(!1),Ze=S(""),Je=S("top"),Qe=S(null),en=S(null),nn=S(null),tn=S(null),on=S(null);let rn=null,ln=null;function an(){rn&&(clearTimeout(rn),rn=null),ln&&(clearTimeout(ln),ln=null)}let sn=!1;function dn(e,n,t="top",o=!1,r,l){if(!e)return;!function(){if(!sn&&"undefined"!=typeof document)try{sn=!0;const e=document.createElement("div");e.setAttribute("data-singleton-tooltip","1"),document.body.appendChild(e),W({setup:()=>()=>{var e;return _(Ge,{visible:Ye.value,"anchor-el":Qe.value,content:Ze.value,placement:Je.value,id:en.value,originX:nn.value,originY:tn.value,isDark:null!=(e=on.value)?e:void 0})}}).mount(e)}catch(e){sn=!1,console.warn("[markstream-vue] Failed to mount Tooltip component. Tooltips will be disabled.",e)}}(),an();const i=()=>{var o,i;en.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,Qe.value=e,Ze.value=n,Je.value=t,nn.value=null!=(o=null==r?void 0:r.x)?o:null,tn.value=null!=(i=null==r?void 0:r.y)?i:null,on.value="boolean"==typeof l?l:null,Ye.value=!0;try{e.setAttribute("aria-describedby",en.value)}catch(a){}};o?i():rn=setTimeout(i,80)}function un(e=!1){an();const n=()=>{if(Qe.value&&en.value)try{Qe.value.removeAttribute("aria-describedby")}catch(e){}Ye.value=!1,Qe.value=null,en.value=null,nn.value=null,tn.value=null};e?n():ln=setTimeout(n,120)}const cn={"common.copy":"Copy","common.copied":"Copied","common.decrease":"Decrease","common.reset":"Reset","common.increase":"Increase","common.expand":"Expand","common.collapse":"Collapse","common.preview":"Preview","common.source":"Source","common.export":"Export","common.open":"Open","common.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."};function mn(e){Object.assign(cn,e)}function pn(){try{const n=globalThis.$vueI18nUse||null;if(n&&"function"==typeof n)try{const e=n();if(e&&"function"==typeof e.t)return{t:e.t.bind(e)}}catch(e){}}catch(e){}return u(null,null,function*(){try{const n=yield import("vue-i18n"),t=n.useI18n||n.default&&n.default.useI18n;if(t&&"function"==typeof t)try{const n=t();if(n&&"function"==typeof n.t)try{globalThis.$vueI18nUse=()=>n}catch(e){}}catch(e){}}catch(e){}}),{t:e=>{var n;return null!=(n=cn[e])?n:function(e){return(e.split(".").pop()||e).replace(/[_-]/g," ").replace(/([A-Z])/g," $1").replace(/\s+/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}(e)}}}const hn=/* @__PURE__ */Symbol("ViewportPriority");function vn(e,n){const t="undefined"!=typeof window&&"undefined"!=typeof document,o="boolean"==typeof n?S(n):n;let r=null,l=null;const i=/* @__PURE__ */new Map;const a=(n,a)=>{const s=S(!1);let d,u=!1;const c=new Promise(e=>{d=()=>{u||(u=!0,e())}}),m=()=>{try{null==r||r.unobserve(n)}catch(e){}if(i.delete(n),!i.size){try{null==r||r.disconnect()}catch(e){}r=null,l=null}};if(!t||!o.value)return s.value=!0,d(),{isVisible:s,whenVisible:c,destroy:m};const p=function(n,o){if(!t)return r;if("undefined"==typeof IntersectionObserver)return null;const a=function(n,t){var o,r,l;return{root:null!=(o=null==e?void 0:e(null!=n?n:null))?o:null,rootMargin:null!=(r=null==t?void 0:t.rootMargin)?r:"300px",threshold:null!=(l=null==t?void 0:t.threshold)?l:0}}(n,o);if(r&&(d=a,(s=l)&&s.root===d.root&&s.rootMargin===d.rootMargin&&s.threshold===d.threshold))return r;var s,d;if(r)try{r.disconnect()}catch(u){}r=new IntersectionObserver(e=>{for(const n of e){const e=i.get(n.target);if(e&&(n.isIntersecting||n.intersectionRatio>0)){if(!e.visible.value){e.visible.value=!0;try{e.resolve()}catch(u){}}null==r||r.unobserve(n.target),i.delete(n.target)}}},{root:a.root,rootMargin:a.rootMargin,threshold:a.threshold}),l=a;for(const e of i.keys())r.observe(e);return r}(n,a);return p?(i.set(n,{resolve:d,visible:s}),p.observe(n),{isVisible:s,whenVisible:c,destroy:m}):(s.value=!0,d(),{isVisible:s,whenVisible:c,destroy:m})};return A(hn,a),a}function fn(){const e=I(hn,void 0);if(e)return e;const n=/* @__PURE__ */new WeakMap;let t=null;return e=>{const o=S(!1);let r,l=!1;const i=new Promise(e=>{r=()=>{l||(l=!0,e())}}),a=()=>{try{null==t||t.unobserve(e)}catch(o){}n.delete(e)},s=t||("undefined"==typeof window||"undefined"==typeof IntersectionObserver?null:(t=new IntersectionObserver(e=>{for(const r of e){const e=n.get(r.target);if(e&&(r.isIntersecting||r.intersectionRatio>0)){if(!e.visible.value){e.visible.value=!0;try{e.resolve()}catch(o){}}null==t||t.unobserve(r.target),n.delete(r.target)}}},{root:null,rootMargin:"300px",threshold:0}),t));return s?(n.set(e,{resolve:r,visible:o}),s.observe(e),{isVisible:o,whenVisible:i,destroy:a}):(o.value=!0,r(),{isVisible:o,whenVisible:i,destroy:a})}}const gn={class:"relative inline-block"},yn=["src","alt","title","loading","tabindex","aria-label"],wn={class:"text-sm whitespace-nowrap"},kn={key:1,class:"text-sm text-gray-500"},xn={key:"error",class:"px-4 py-2 bg-gray-100 flex items-center justify-center rounded-lg gap-2 text-red-500"},bn={class:"text-sm whitespace-nowrap"},Mn={key:0,class:"mt-2 text-sm text-gray-500 italic"},_n=/* @__PURE__ */oe(/* @__PURE__ */h({__name:"ImageNode",props:{node:{},fallbackSrc:{default:""},showCaption:{type:Boolean,default:!1},lazy:{type:Boolean,default:!0},svgMinHeight:{default:"12rem"},usePlaceholder:{type:Boolean,default:!0}},emits:["load","error","click"],setup(e,{emit:n}){const t=e,o=n,r=S(!1),l=S(!1),i=S(!1),a=S(null),s=fn(),d=S(null),u=S("undefined"==typeof window),c=S("undefined"==typeof window);"undefined"!=typeof window&&$(()=>a.value,e=>{var n;if(null==(n=d.value)||n.destroy(),d.value=null,!e)return u.value=!1,void(c.value=!1);const t=s(e,{rootMargin:"400px"});d.value=t,u.value=t.isVisible.value,c.value=!0,t.whenVisible.then(()=>{u.value=!0})},{immediate:!0}),N(()=>{var e;null==(e=d.value)||e.destroy(),d.value=null});const m=T(()=>l.value&&t.fallbackSrc?t.fallbackSrc:t.node.src),p=T(()=>!t.lazy||u.value||!c.value),h=T(()=>/\.svg(?:\?|$)/i.test(m.value));function k(){t.fallbackSrc&&!i.value?(i.value=!0,l.value=!0):(l.value=!0,o("error",t.node.src))}function x(){r.value=!0,l.value=!1,o("load",m.value)}function M(e){e.preventDefault(),r.value&&!l.value&&o("click",[e,m.value])}const{t:_}=pn();return $(m,()=>{r.value=!1,l.value=!1}),(n,o)=>(v(),f("figure",{ref_key:"figureRef",ref:a,class:"text-center my-8"},[w("div",gn,[g(P,{name:"img-switch",mode:"out-in"},{default:D(()=>{var i,a,s,d,u;return[e.node.loading||l.value||!p.value?l.value?e.node.loading||t.fallbackSrc?E("",!0):(v(),f("div",xn,[z(n.$slots,"error",{node:t.node,displaySrc:m.value,imageLoaded:r.value,hasError:l.value,fallbackSrc:t.fallbackSrc,lazy:t.lazy,isSvg:h.value},()=>[o[1]||(o[1]=w("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[w("path",{fill:"currentColor",d:"M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z"})],-1)),w("span",bn,b(y(_)("image.loadError")),1)],!0)])):(v(),f("div",{key:"placeholder",class:"placeholder-layer max-w-96 inline-flex items-center justify-center gap-2",style:K(h.value?{minHeight:t.svgMinHeight,width:"100%"}:{minHeight:"6rem"})},[t.usePlaceholder?z(n.$slots,"placeholder",{key:0,node:t.node,displaySrc:m.value,imageLoaded:r.value,hasError:l.value,fallbackSrc:t.fallbackSrc,lazy:t.lazy,isSvg:h.value},()=>[o[0]||(o[0]=w("div",{class:"w-4 h-4 rounded-full border-2 border-solid border-current border-t-transparent animate-spin","aria-hidden":"true"},null,-1)),w("span",wn,b(y(_)("image.loading")),1)],!0):(v(),f("span",kn,b(e.node.raw),1))],4)):(v(),f("img",{key:"image",src:m.value,alt:String(null!=(a=null!=(i=t.node.alt)?i:t.node.title)?a:""),title:String(null!=(d=null!=(s=t.node.title)?s:t.node.alt)?d:""),class:C(["max-w-96 h-auto rounded-lg transition-opacity duration-200 ease-in-out",{"opacity-0":!r.value,"opacity-100":r.value,"cursor-pointer":r.value}]),style:K(h.value?{minHeight:t.svgMinHeight,width:"100%",height:"auto",objectFit:"contain"}:void 0),loading:t.lazy?"lazy":"eager",decoding:"async",tabindex:r.value?0:-1,"aria-label":null!=(u=t.node.alt)?u:y(_)("image.preview"),onError:k,onLoad:x,onClick:M},null,46,yn))]}),_:3})]),t.showCaption&&t.node.alt?(v(),f("figcaption",Mn,b(t.node.alt),1)):E("",!0)],512))}}),[["__scopeId","data-v-9b5d9aad"]]);_n.install=e=>{e.component(_n.__name,_n)};let Tn=null,Cn=!1,Bn=$n;function In(e){var n;const t=null!=(n=null==e?void 0:e.default)?n:e;return t&&"function"==typeof t.renderToString?t:null}function Sn(){try{const e=globalThis;return In(null==e?void 0:e.katex)}catch(e){return null}}function $n(){return u(null,null,function*(){const e=Sn();if(e)return e;const n=yield import("katex");try{yield import("katex/dist/contrib/mhchem")}catch(t){}return In(n)})}function En(e){Bn=e,Tn=null,Cn=!1}function Ln(e){En(null!=e?e:$n)}function Nn(){En(null)}function jn(){return"function"==typeof Bn}function Hn(){var e;const n=Sn();if(n)return Tn=n,Tn;if(Tn)return Tn;const t=Bn;if(!t||t===$n)return null;try{const n=t();return n&&"function"!=typeof(null==n?void 0:n.then)?(Tn=null!=(e=In(n))?e:n,Tn):null}catch(o){return null}}function Pn(){return u(this,null,function*(){var e;const n=Sn();if(n)return Tn=n,Tn;if(Tn)return Tn;if(Cn)return null;const t=Bn;if(!t)return Cn=!0,null;try{const n=yield t();if(n)return Tn=null!=(e=In(n))?e:n,Tn}catch(o){}return Cn=!0,null})}const Dn=M(!1);let Rn=null;const Kn={key:0},On=/* @__PURE__ */oe(/* @__PURE__ */h({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const n=e,t=(Rn||(Rn=Pn().then(e=>{Dn.value=!!e}).catch(()=>{Dn.value=!1})),F(Dn)),o=B(),r=I("markstreamTypewriter",void 0),l=I("markstreamTextStreamState",void 0),i=I("markstreamStreamVersion",void 0),a=T(()=>{const e=o.typewriter;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),s=T(()=>"boolean"==typeof a.value?a.value:"boolean"!=typeof(null==r?void 0:r.value)||r.value),d=T(()=>{var e;const n=null!=(e=o["index-key"])?e:o.indexKey;return null==n||""===n?"":String(n)}),u=S(n.node.content),c=S(""),m=S(0);function p(){return u.value+c.value}function h(e){u.value=e,c.value=""}function g(){c.value&&(u.value=p(),c.value="")}$([()=>n.node.content,d,s,()=>null==i?void 0:i.value],([e])=>{const n=String(null!=e?e:""),t=p(),o=d.value,r=o?null==l?void 0:l.get(o):void 0,i=null!=r?r:t;return s.value?n===i?(c.value?g():t!==n&&h(n),void(o&&(null==l||l.set(o,n)))):i&&n.startsWith(i)&&n.length>i.length?(u.value=i,c.value=n.slice(i.length),m.value+=1,void(o&&(null==l||l.set(o,n)))):(h(n),void(o&&(null==l||l.set(o,n)))):(h(n),void(o&&(null==l||l.set(o,n))))},{immediate:!0}),$(s,e=>{e||h(p())});const w=T(()=>m.value%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b");return(n,o)=>(v(),f("span",{class:C([[y(t)&&e.node.center?"text-node-center":""],"whitespace-pre-wrap break-words text-node"])},[u.value?(v(),f("span",Kn,b(u.value),1)):E("",!0),c.value?(v(),f("span",{key:1,class:C(["text-node-stream-delta",[w.value]]),onAnimationend:g},b(c.value),35)):E("",!0)],2))}}),[["__scopeId","data-v-03641323"]]);On.install=e=>{e.component(On.__name,On)};const Wn=V(()=>u(null,null,function*(){var e,n;if("undefined"!=typeof globalThis&&void 0!==globalThis.process&&"test"===(null==(n=null==(e=globalThis.process)?void 0:e.env)?void 0:n.NODE_ENV)&&"undefined"!=typeof window)return e=>{var n,t;return _(On,s(a({},e),{node:s(a({},e.node),{content:null!=(t=e.node.raw)?t:`$${null!=(n=e.node.content)?n:""}$`})}))};try{if(yield Pn())return(yield import("./index2.js")).default}catch(t){console.warn('[markstream-vue] Optional peer dependencies for MathInlineNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',t)}return e=>{var n,t;return _(On,s(a({},e),{node:s(a({},e.node),{content:null!=(t=e.node.raw)?t:`$${null!=(n=e.node.content)?n:""}$`})}))}})),An=V(()=>u(null,null,function*(){try{if(yield Pn())return(yield import("./index3.js")).default}catch(e){console.warn('[markstream-vue] Optional peer dependencies for MathBlockNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',e)}return e=>{var n,t;return _(On,s(a({},e),{node:s(a({},e.node),{content:null!=(t=e.node.raw)?t:`$$${null!=(n=e.node.content)?n:""}$$`})}))}})),zn=/* @__PURE__ */h({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(n,t)=>(v(),f("span",{class:"reference-node cursor-pointer bg-[hsl(var(--muted))] text-[hsl(var(--muted-foreground))] text-xs rounded-md px-1.5 mx-0.5 hover:bg-[hsl(var(--secondary))]",role:"button",tabindex:"0",onClick:t[0]||(t[0]=t=>n.$emit("click",t,e.node.id,e.messageId,e.threadId)),onMouseenter:t[1]||(t[1]=t=>n.$emit("mouseEnter",t,e.node.id,e.messageId,e.threadId)),onMouseleave:t[2]||(t[2]=t=>n.$emit("mouseLeave",t,e.node.id,e.messageId,e.threadId))},b(e.node.id),33))});zn.install=e=>{e.component(zn.__name,zn)};const Fn={class:"superscript-node"},Vn={key:1},Un=/* @__PURE__ */oe(/* @__PURE__ */h({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=we(n.customId),o=a({text:On,inline_code:Ue,link:rt,html_inline:ze,strong:Zn,emphasis:ut,footnote_reference:_e,strikethrough:Qn,highlight:st,insert:it,subscript:Gn,emoji:pe,math_inline:Wn,reference:zn},t);return(t,r)=>(v(),f("sup",Fn,[(v(!0),f(k,null,x(e.node.children,(t,r)=>(v(),f(k,{key:`${e.indexKey||"superscript"}-${r}`},[o[t.type]?(v(),j(U(o[t.type]),{key:0,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"superscript"}-${r}`},null,8,["node","custom-id","index-key"])):(v(),f("span",Vn,b(t.content||t.raw),1))],64))),128))]))}}),[["__scopeId","data-v-6dc1e3ba"]]);Un.install=e=>{e.component(Un.__name,Un)};const Xn={class:"subscript-node"},qn={key:1},Gn=/* @__PURE__ */oe(/* @__PURE__ */h({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=we(n.customId),o=a({text:On,inline_code:Ue,link:rt,html_inline:ze,strong:Zn,emphasis:ut,footnote_reference:_e,strikethrough:Qn,highlight:st,insert:it,superscript:Un,emoji:pe,math_inline:Wn,reference:zn},t);return(t,r)=>(v(),f("sub",Xn,[(v(!0),f(k,null,x(e.node.children,(t,r)=>(v(),f(k,{key:`${e.indexKey||"subscript"}-${r}`},[o[t.type]?(v(),j(U(o[t.type]),{key:0,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"subscript"}-${r}`},null,8,["node","custom-id","index-key"])):(v(),f("span",qn,b(t.content||t.raw),1))],64))),128))]))}}),[["__scopeId","data-v-69de9b81"]]);Gn.install=e=>{e.component(Gn.__name,Gn)};const Yn={class:"strong-node"},Zn=/* @__PURE__ */oe(/* @__PURE__ */h({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=we(n.customId),o=a({text:On,inline_code:Ue,link:rt,html_inline:ze,emphasis:ut,strikethrough:Qn,highlight:st,insert:it,subscript:Gn,superscript:Un,emoji:pe,footnote_reference:_e,math_inline:Wn,reference:zn},t);return(t,r)=>(v(),f("strong",Yn,[(v(!0),f(k,null,x(e.node.children,(t,r)=>(v(),j(U(o[t.type]),{key:`${e.indexKey||"strong"}-${r}`,"index-key":`${e.indexKey||"strong"}-${r}`,node:t,"custom-id":n.customId},null,8,["index-key","node","custom-id"]))),128))]))}}),[["__scopeId","data-v-af3ce037"]]);Zn.install=e=>{e.component(Zn.__name,Zn)};const Jn={class:"strikethrough-node"},Qn=/* @__PURE__ */oe(/* @__PURE__ */h({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=we(n.customId),o=a({text:On,inline_code:Ue,link:rt,html_inline:ze,strong:Zn,emphasis:ut,highlight:st,insert:it,subscript:Gn,superscript:Un,emoji:pe,footnote_reference:_e,math_inline:Wn,reference:zn},t);return(t,r)=>(v(),f("del",Jn,[(v(!0),f(k,null,x(e.node.children,(t,r)=>(v(),j(U(o[t.type]),{key:`${e.indexKey||"strikethrough"}-${r}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"strikethrough"}-${r}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-904d5bd1"]]);Qn.install=e=>{e.component(Qn.__name,Qn)};const et=["href","title","aria-label","aria-hidden"],nt=["aria-hidden"],tt={class:"link-text-wrapper relative inline-flex"},ot={class:"leading-[normal] link-text"},rt=/* @__PURE__ */oe(/* @__PURE__ */h({__name:"LinkNode",props:{node:{},indexKey:{},customId:{},showTooltip:{type:Boolean,default:!0},color:{},underlineHeight:{},underlineBottom:{},animationDuration:{},animationOpacity:{},animationTiming:{},animationIteration:{}},setup(e){const n=e,t=I("markstreamShowTooltips",void 0),o=T(()=>{const e=null==t?void 0:t.value;return"boolean"==typeof e?e:n.showTooltip}),r=T(()=>{var e,t,o,r,l,i;const a=void 0!==n.underlineBottom?"number"==typeof n.underlineBottom?`${n.underlineBottom}px`:String(n.underlineBottom):"-3px",s=null!=(e=n.animationOpacity)?e:.35,d=Math.max(.12,Math.min(.5*s,s));return{"--link-color":null!=(t=n.color)?t:"#0366d6","--underline-height":`${null!=(o=n.underlineHeight)?o:2}px`,"--underline-bottom":a,"--underline-opacity":String(s),"--underline-rest-opacity":String(d),"--underline-duration":`${null!=(r=n.animationDuration)?r:1.6}s`,"--underline-timing":null!=(l=n.animationTiming)?l:"ease-in-out","--underline-iteration":"number"==typeof n.animationIteration?String(n.animationIteration):null!=(i=n.animationIteration)?i:"infinite"}}),l={text:On,strong:Zn,strikethrough:Qn,emphasis:ut,image:_n,html_inline:ze,inline_code:Ue},i=T(()=>(ge.value,we(n.customId))),s=B(),d=T(()=>{var e,t;const o=null==(e=n.node)?void 0:e.attrs;if(!o||"object"!=typeof o)return{};const r={};if(Array.isArray(o))for(const n of o)Array.isArray(n)&&n[0]&&(r[String(n[0])]=String(null!=(t=n[1])?t:""));else for(const[n,l]of Object.entries(o))n&&null!=l&&!1!==l&&(r[n]=!0===l?"":String(l));return Pe(r)}),u=T(()=>{const e=a(a({},s),d.value);return delete e.title,e});function c(){o.value&&un()}const m=T(()=>{var e,t,o;const r=null==(e=n.node)?void 0:e.title;return"string"==typeof r&&r.trim().length>0?r:String(null!=(o=null==(t=n.node)?void 0:t.href)?o:"")});return(t,a)=>{var d,p;return e.node.loading?(v(),f("span",X({key:1,class:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":e.node.loading?"false":"true"},y(s),{style:r.value}),[w("span",tt,[w("span",ot,[g(y(On),{class:"leading-[normal] link-text",node:{type:"text",content:String(null!=(d=e.node.text)?d:""),raw:String(null!=(p=e.node.text)?p:"")},"index-key":`${e.indexKey||"link-text"}-loading`},null,8,["node","index-key"])]),a[1]||(a[1]=w("span",{class:"link-loading-indicator","aria-hidden":"true"},null,-1))])],16,nt)):(v(),f("a",X({key:0,class:"link-node",href:e.node.href,title:o.value?"":m.value,"aria-label":`Link: ${m.value}`,"aria-hidden":e.node.loading?"true":"false",target:"_blank",rel:"noopener noreferrer"},u.value,{style:r.value,onMouseenter:a[0]||(a[0]=e=>function(e){var t,r,l;if(!o.value)return;const i=e,a=null!=(null==i?void 0:i.clientX)&&null!=(null==i?void 0:i.clientY)?{x:i.clientX,y:i.clientY}:void 0,s=(null==(t=n.node)?void 0:t.title)||(null==(r=n.node)?void 0:r.href)||(null==(l=n.node)?void 0:l.text)||"";dn(e.currentTarget,s,"top",!1,a)}(e)),onMouseleave:c}),[(v(!0),f(k,null,x(e.node.children,(t,o)=>(v(),j(U(function(e){return i.value[e.type]||l[e.type]||null}(t)),{key:`${e.indexKey||"emphasis"}-${o}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"link-text"}-${o}`},null,8,["node","custom-id","index-key"]))),128))],16,et))}}}),[["__scopeId","data-v-a4831c9e"]]);rt.install=e=>{e.component(rt.__name,rt)};const lt={class:"insert-node"},it=/* @__PURE__ */oe(/* @__PURE__ */h({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=we(n.customId),o=a({text:On,inline_code:Ue,link:rt,html_inline:ze,strong:Zn,emphasis:ut,strikethrough:Qn,highlight:st,subscript:Gn,superscript:Un,emoji:pe,footnote_reference:_e,math_inline:Wn,reference:zn},t);return(t,r)=>(v(),f("ins",lt,[(v(!0),f(k,null,x(e.node.children,(t,r)=>(v(),j(U(o[t.type]),{key:`${e.indexKey||"insert"}-${r}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"insert"}-${r}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-ab1ec9bc"]]);it.install=e=>{e.component(it.__name,it)};const at={class:"highlight-node"},st=/* @__PURE__ */oe(/* @__PURE__ */h({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=we(n.customId),o=a({text:On,inline_code:Ue,link:rt,html_inline:ze,strong:Zn,emphasis:ut,strikethrough:Qn,insert:it,subscript:Gn,superscript:Un,emoji:pe,footnote_reference:_e,math_inline:Wn,reference:zn},t);return(t,r)=>(v(),f("mark",at,[(v(!0),f(k,null,x(e.node.children,(t,r)=>(v(),j(U(o[t.type]),{key:`${e.indexKey||"highlight"}-${r}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"highlight"}-${r}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-38e31bf6"]]);st.install=e=>{e.component(st.__name,st)};const dt={class:"emphasis-node"},ut=/* @__PURE__ */oe(/* @__PURE__ */h({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=we(n.customId),o=a({text:On,inline_code:Ue,link:rt,html_inline:ze,strong:Zn,strikethrough:Qn,highlight:st,insert:it,subscript:Gn,superscript:Un,emoji:pe,footnote_reference:_e,math_inline:Wn,reference:zn},t);return(t,r)=>(v(),f("em",dt,[(v(!0),f(k,null,x(e.node.children,(t,r)=>(v(),j(U(o[t.type]),{key:`${e.indexKey||"emphasis"}-${r}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"emphasis"}-${r}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-8264674d"]]);ut.install=e=>{e.component(ut.__name,ut)};const ct=["href","title"],mt=/* @__PURE__ */oe(/* @__PURE__ */h({__name:"FootnoteAnchorNode",props:{node:{}},setup(e){const n=e;function t(e){var t;if(e.preventDefault(),"undefined"==typeof document)return;const o=`fnref-${String(null!=(t=n.node.id)?t:"")}`,r=document.getElementById(o);r&&r.scrollIntoView({behavior:"smooth"})}return(n,o)=>(v(),f("a",{class:"footnote-anchor text-sm text-[#0366d6] hover:underline cursor-pointer",href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:t}," ↩︎ ",8,ct))}}),[["__scopeId","data-v-4756ce0d"]]);mt.install=e=>{e.component(mt.__name,mt)};const pt=["id"],ht={class:"flex-1"},vt=/* @__PURE__ */h({__name:"FootnoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(v(),f("div",{id:`fnref--${e.node.id}`,class:"flex mt-2 mb-2 text-sm leading-relaxed border-t border-[#eaecef] pt-2"},[w("div",ht,[g(y(zt),{"index-key":`footnote-${n.indexKey}`,nodes:n.node.children,"custom-id":n.customId,typewriter:n.typewriter,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))},null,8,["index-key","nodes","custom-id","typewriter"])])],8,pt))}});vt.install=e=>{e.component(vt.__name,vt)};const ft={class:"hard-break"},gt=/* @__PURE__ */oe(/* @__PURE__ */h({__name:"HardBreakNode",props:{node:{}},setup:e=>(e,n)=>(v(),f("br",ft))}),[["__scopeId","data-v-50c58f70"]]);gt.install=e=>{e.component(gt.__name,gt)};const yt=/* @__PURE__ */oe(/* @__PURE__ */h({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=we(n.customId),o=a({text:On,inline_code:Ue,link:rt,image:_n,strong:Zn,emphasis:ut,strikethrough:Qn,highlight:st,insert:it,subscript:Gn,superscript:Un,emoji:pe,checkbox:ae,checkbox_input:ae,footnote_reference:_e,hardbreak:gt,math_inline:Wn,reference:zn},t);return(t,r)=>(v(),j(U(`h${e.node.level}`),X({class:["heading-node",[`heading-${e.node.level}`]],dir:"auto"},e.node.attrs),{default:D(()=>[(v(!0),f(k,null,x(e.node.children,(t,r)=>(v(),j(U(o[t.type]),{key:`${e.indexKey||"heading"}-${r}`,"custom-id":n.customId,node:t,"index-key":`${e.indexKey||"heading"}-${r}`},null,8,["custom-id","node","index-key"]))),128))]),_:1},16,["class"]))}}),[["__scopeId","data-v-ffb7cf51"]]),wt=yt;wt.install=e=>{e.component(yt.__name,yt)};const kt=/* @__PURE__ */oe(/* @__PURE__ */h({__name:"ListItemNode",props:{node:{},item:{},indexKey:{},value:{},customId:{},typewriter:{type:Boolean},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=e,t=T(()=>{var e;return null!=(e=n.node)?e:n.item}),o=T(()=>null==n.value?{}:{value:n.value});return(e,r)=>{var l,i;return v(),f("li",X({class:"list-item pl-1.5 my-2",dir:"auto"},o.value),[g(y(zt),X({showTooltips:n.showTooltips},{"index-key":`list-item-${n.indexKey}`,nodes:null!=(i=null==(l=t.value)?void 0:l.children)?i:[],"custom-id":n.customId,typewriter:n.typewriter,"batch-rendering":!1,onCopy:r[0]||(r[0]=n=>e.$emit("copy",n))}),null,16,["index-key","nodes","custom-id","typewriter"])],16)}}}),[["__scopeId","data-v-ce59e808"]]);kt.install=e=>{e.component(kt.__name,kt)};const xt=/* @__PURE__ */oe(/* @__PURE__ */h({__name:"ListNode",props:{node:{},customId:{},indexKey:{},typewriter:{type:Boolean},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=T(()=>(ge.value,we(e.customId).list_item||kt));return(t,o)=>(v(),j(U(e.node.ordered?"ol":"ul"),{class:C(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:D(()=>[(v(!0),f(k,null,x(e.node.items,(r,l)=>{var i;return v(),j(U(n.value),X({key:`${e.indexKey||"list"}-${l}`},{ref_for:!0},{showTooltips:e.showTooltips},{node:r,"custom-id":e.customId,"index-key":`${e.indexKey||"list"}-${l}`,typewriter:e.typewriter,value:e.node.ordered?(null!=(i=e.node.start)?i:1)+l:void 0,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))}),null,16,["node","custom-id","index-key","typewriter","value"])}),128))]),_:1},8,["class"]))}}),[["__scopeId","data-v-8e81cbc8"]]);xt.install=e=>{e.component(xt.__name,xt)};const bt={key:1,class:"html-block-node__raw"},Mt=["innerHTML"],_t={key:1,class:"html-block-node__placeholder"},Tt=/* @__PURE__ */oe(/* @__PURE__ */h({__name:"HtmlBlockNode",props:{node:{},customId:{}},setup(e){const n=e,t=T(()=>{const e=n.node.attrs;if(e){if(Array.isArray(e)){const n={};for(const t of e){if(!t||t.length<2)continue;const[e,o]=t;null!=e&&(n[String(e)]=null==o?"":String(o))}return n}return e}}),o=T(()=>(ge.value,we(n.customId))),r=h({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),l=S(null),i=S("undefined"==typeof window),a=S(n.node.content),s=T(()=>{var e,t,r;if(!i.value)return{mode:"html",content:null!=(e=a.value)?e:""};const l=null!=(t=a.value)?t:n.node.content;if(!l)return{mode:"html",content:""};if(n.node.loading){const e=We(l,o.value);return null===e?{mode:"text",content:null!=(r=n.node.raw)?r:l}:{mode:"dynamic",nodes:e}}if(!Oe(l,o.value))return{mode:"html",content:l};const s=We(l,o.value);return null===s?{mode:"html",content:l}:{mode:"dynamic",nodes:s}}),d=fn(),u=S(null),c=!!n.node.loading;return"undefined"!=typeof window?($(l,e=>{var t,o;if(null==(o=null==(t=u.value)?void 0:t.destroy)||o.call(t),u.value=null,!c)return i.value=!0,void(a.value=n.node.content);if(!e)return void(i.value=!1);const r=d(e,{rootMargin:"400px"});u.value=r,i.value=r.isVisible.value,r.whenVisible.then(()=>{i.value=!0})},{immediate:!0}),$(()=>n.node.content,e=>{c&&!i.value||(a.value=e)})):i.value=!0,N(()=>{var e,n;null==(n=null==(e=u.value)?void 0:e.destroy)||n.call(e),u.value=null}),(n,o)=>(v(),f("div",X({ref_key:"htmlRef",ref:l,class:"html-block-node"},t.value),[i.value?(v(),f(k,{key:0},["dynamic"===s.value.mode?(v(),j(y(r),{key:0,nodes:s.value.nodes},null,8,["nodes"])):"text"===s.value.mode?(v(),f("pre",bt,b(s.value.content),1)):(v(),f("div",{key:2,innerHTML:a.value},null,8,Mt))],64)):(v(),f("div",_t,[z(n.$slots,"placeholder",{node:e.node},()=>[o[0]||(o[0]=w("span",{class:"html-block-node__placeholder-bar"},null,-1)),o[1]||(o[1]=w("span",{class:"html-block-node__placeholder-bar w-4/5"},null,-1)),o[2]||(o[2]=w("span",{class:"html-block-node__placeholder-bar w-2/3"},null,-1))],!0)]))],16))}}),[["__scopeId","data-v-b7cace40"]]);Tt.install=e=>{e.component(Tt.__name,Tt)};const Ct=/* @__PURE__ */oe(/* @__PURE__ */h({__name:"ParagraphNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=we(n.customId),o=T(()=>0===n.node.children.length?"p":n.node.children.every(e=>{var n;return"image"===e.type||"text"===e.type&&""===String(null!=(n=e.content)?n:"").trim()})?"div":"p"),r=a({inline_code:Ue,image:_n,link:rt,hardbreak:gt,emphasis:ut,strong:Zn,strikethrough:Qn,highlight:st,insert:it,subscript:Gn,superscript:Un,html_inline:ze,html_block:Tt,emoji:pe,checkbox:ae,math_inline:Wn,checkbox_input:ae,reference:zn,footnote_anchor:mt,footnote_reference:_e,text:On},t);return(t,l)=>(v(),j(U(o.value),{dir:"auto",class:"paragraph-node"},{default:D(()=>[(v(!0),f(k,null,x(e.node.children,(t,o)=>(v(),j(U(r[t.type]),{key:`${e.indexKey||"paragraph"}-${o}`,node:t,"index-key":`${e.indexKey}-${o}`,"custom-id":n.customId},null,8,["node","index-key","custom-id"]))),128))]),_:1}))}}),[["__scopeId","data-v-83b021c4"]]);Ct.install=e=>{e.component(Ct.__name,Ct)};const Bt=["aria-busy","aria-label","data-language"],It=["textContent"],St=/* @__PURE__ */h({__name:"PreCodeNode",props:{node:{}},setup(e){const n=e,t=T(()=>{var e,t,o;const r=String(null!=(t=null==(e=n.node)?void 0:e.language)?t:"");return String(null!=(o=String(r).split(/\s+/g)[0])?o:"").toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}),o=T(()=>`language-${t.value}`),r=T(()=>{const e=t.value;return e?`Code block: ${e}`:"Code block"});return(n,l)=>(v(),f("pre",{class:C([o.value]),"aria-busy":!0===e.node.loading,"aria-label":r.value,"data-language":t.value,"data-markstream-pre":"1",tabindex:"0"},[w("code",{translate:"no",textContent:b(e.node.code)},null,8,It)],10,Bt))}});St.install=e=>{e.component(St.__name,St)};const $t={class:"table-node-wrapper"},Et=["aria-busy"],Lt={class:"border-[var(--table-border,#cbd5e1)]"},Nt={class:"border-b"},jt={key:0,class:"table-node__loading",role:"status","aria-live":"polite"},Ht=/* @__PURE__ */oe(/* @__PURE__ */h({__name:"TableNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e,t=T(()=>{var e;return null!=(e=n.node.loading)&&e}),o=T(()=>{var e;return null!=(e=n.node.rows)?e:[]});return(r,l)=>(v(),f("div",$t,[w("table",{class:C(["my-8 text-sm table-node",{"table-node--loading":t.value}]),"aria-busy":t.value},[w("thead",Lt,[w("tr",Nt,[(v(!0),f(k,null,x(e.node.header.cells,(e,t)=>(v(),f("th",{key:`header-${t}`,dir:"auto",class:C(["font-semibold p-[calc(4/7*1em)]",["right"===e.align?"text-right":"center"===e.align?"text-center":"text-left"]])},[g(y(zt),{nodes:e.children,"index-key":`table-th-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,onCopy:l[0]||(l[0]=e=>r.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter"])],2))),128))])]),w("tbody",null,[(v(!0),f(k,null,x(o.value,(e,t)=>(v(),f("tr",{key:`row-${t}`,class:C(["border-[var(--table-border,#cbd5e1)]",[t<o.value.length-1?"border-b":""]])},[(v(!0),f(k,null,x(e.cells,(e,o)=>(v(),f("td",{key:`cell-${t}-${o}`,class:C(["p-[calc(4/7*1em)]",["right"===e.align?"text-right":"center"===e.align?"text-center":"text-left"]]),dir:"auto"},[g(y(zt),{nodes:e.children,"index-key":`table-td-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,onCopy:l[1]||(l[1]=e=>r.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter"])],2))),128))],2))),128))])],10,Et),g(P,{name:"table-node-fade"},{default:D(()=>[t.value?(v(),f("div",jt,[z(r.$slots,"loading",{isLoading:t.value},()=>[l[2]||(l[2]=w("span",{class:"table-node__spinner animate-spin","aria-hidden":"true"},null,-1)),l[3]||(l[3]=w("span",{class:"sr-only"},"Loading",-1))],!0)])):E("",!0)]),_:3})]))}}),[["__scopeId","data-v-369096fa"]]);Ht.install=e=>{e.component(Ht.__name,Ht)};const Pt={class:"hr-node"},Dt=/* @__PURE__ */oe({},[["render",function(e,n){return v(),f("hr",Pt)}],["__scopeId","data-v-639cbad9"]]);Dt.install=e=>{e.component(Dt.__name,Dt)};const Rt={class:"unknown-node"},Kt=/* @__PURE__ */h({__name:"FallbackComponent",props:{node:{}},setup:e=>(n,t)=>(v(),f("div",Rt,b(e.node.raw),1))}),Ot=/* @__PURE__ */oe(/* @__PURE__ */h({__name:"VmrContainerNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},customId:{}},setup(e){const n=e,t=T(()=>`vmr-container vmr-container-${n.node.name}`),o=we(n.customId),r=a({text:On,paragraph:Ct,heading:wt,inline_code:Ue,link:rt,image:_n,strong:Zn,emphasis:ut,strikethrough:Qn,insert:it,subscript:Gn,superscript:Un,checkbox:ae,checkbox_input:ae,hardbreak:gt,math_inline:Wn,reference:zn,list:xt,math_block:An,table:Ht},o);return(o,l)=>(v(),f("div",X({class:t.value},e.node.attrs),[(v(!0),f(k,null,x(e.node.children,(t,o)=>{return v(),j(U((l=t.type,r[l]||Kt)),{key:`${e.indexKey||"vmr-container"}-${o}`,"custom-id":n.customId,node:t,"index-key":`${e.indexKey||"vmr-container"}-${o}`},null,8,["custom-id","node","index-key"]);var l}),128))],16))}}),[["__scopeId","data-v-a88d22ce"]]);Ot.install=e=>{e.component(Ot.__name,Ot)};const Wt=["data-custom-id"],At=["data-node-index","data-node-type"],zt=/* @__PURE__ */oe(/* @__PURE__ */h({__name:"NodeRenderer",props:{content:{},nodes:{},final:{type:Boolean},parseOptions:{},customMarkdownIt:{},debugPerformance:{type:Boolean,default:!1},customHtmlTags:{},viewportPriority:{type:Boolean},codeBlockStream:{type:Boolean,default:!0},codeBlockDarkTheme:{},codeBlockLightTheme:{},codeBlockMonacoOptions:{},renderCodeBlocksAsPre:{type:Boolean},codeBlockMinWidth:{},codeBlockMaxWidth:{},codeBlockProps:{},mermaidProps:{},d2Props:{},infographicProps:{},showTooltips:{type:Boolean,default:!0},themes:{},isDark:{type:Boolean},customId:{},indexKey:{},typewriter:{type:Boolean,default:!0},batchRendering:{type:Boolean,default:!0},initialRenderBatchSize:{default:40},renderBatchSize:{default:80},renderBatchDelay:{default:16},renderBatchBudgetMs:{default:6},renderBatchIdleTimeoutMs:{default:120},deferNodesUntilVisible:{type:Boolean,default:!0},maxLiveNodes:{default:320},liveNodeBuffer:{default:60}},emits:["copy","handleArtifactClick","click","mouseover","mouseout"],setup(e,{emit:n}){var t,o,r;const l=e,i=n,d=S(),p=S(!1),h=/auto|scroll|overlay/i,g="undefined"!=typeof window,y=T(()=>l.debugPerformance&&g&&"undefined"!=typeof console),w=B(),b=/* @__PURE__ */new Map,M=S(0),_=T(()=>{var e;if("boolean"==typeof l.showTooltips)return l.showTooltips;const n=null!=(e=w.showTooltips)?e:w["show-tooltips"];return""===n||!0===n||"true"===n||!1!==n&&"false"!==n&&void 0});function I(e,n){y.value&&console.info(`[markstream-vue][perf] ${e}`,n)}function H(e){if(!e)return!1;const n=(e.overflowY||"").toLowerCase(),t=(e.overflow||"").toLowerCase();return h.test(n)||h.test(t)}function R(e){const n=Math.ceil(e.scrollHeight)>Math.ceil(e.clientHeight)+1,t=Math.ceil(e.scrollWidth)>Math.ceil(e.clientWidth)+1;return n||t}function O(e){if("undefined"==typeof window)return null;const n=null!=e?e:d.value;if(!n)return null;const t=n.ownerDocument||document,o=t.scrollingElement||t.documentElement;let r=n;for(;r&&r!==t.body&&r!==o;){if(H(window.getComputedStyle(r))&&R(r))return r;r=r.parentElement}return null}A("markstreamShowTooltips",_),A("markstreamTypewriter",T(()=>!1!==l.typewriter)),A("markstreamTextStreamState",b),A("markstreamStreamVersion",M),$([()=>l.content,()=>l.nodes],()=>{M.value+=1},{immediate:!0});const W=l.customId?`renderer-${l.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,z=c(W),F=/* @__PURE__ */new Map,Y=T(()=>{const{key:e,tags:n}=function(e){if(!e||0===e.length)return{key:"",tags:[]};const n=/* @__PURE__ */new Set,t=[];for(const o of e){const e=J(o);e&&!n.has(e)&&(n.add(e),t.push(e))}return 0===t.length?{key:"",tags:[]}:{key:t.join(","),tags:t}}(l.customHtmlTags);if(!e)return z;const t=F.get(e);if(t)return t;const o=c(W,{customHtmlTags:n});return F.set(e,o),o}),Z=T(()=>{const e=Y.value;return l.customMarkdownIt?l.customMarkdownIt(e):e});function J(e){const n=String(null!=e?e:"").trim();if(!n)return"";const t=n.match(/^[<\s/]*([A-Z][\w-]*)/i);return t?t[1].toLowerCase():""}const Q=T(()=>{var e,n,t,o;const r=null!=(e=l.parseOptions)?e:{},i=null!=(n=l.final)?n:r.final,s=[...null!=(t=l.customHtmlTags)?t:[],...null!=(o=r.customHtmlTags)?o:[]].map(J).filter(Boolean),d=null!=i,u=s.length>0;return d||u?a(a(a({},r),d?{final:i}:{}),u?{customHtmlTags:Array.from(new Set(s))}:{}):r}),ee=T(()=>{var e;const n=null!=(e=Q.value.customHtmlTags)?e:[];return new Set(n.map(e=>String(e).trim().toLowerCase()).filter(Boolean))}),ne=T(()=>{var e;if(null==(e=l.nodes)?void 0:e.length)return q(l.nodes.slice());if(l.content){const e=y.value?performance.now():0,n=m(l.content,Z.value,Q.value);return y.value&&I("parse(sync)",{ms:Math.round(performance.now()-e),nodes:n.length,contentLength:l.content.length}),q(n)}return[]}),te=T(()=>{var e;return Math.max(1,null!=(e=l.maxLiveNodes)?e:320)}),oe=T(()=>{var e;return!((null!=(e=l.maxLiveNodes)?e:0)<=0)&&ne.value.length>te.value}),le=T(()=>!1!==l.viewportPriority&&!p.value),ie=vn(e=>{var n;return O(null!=(n=null!=e?e:d.value)?n:null)},le),se=g&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame.bind(window):null,de=g&&"function"==typeof window.cancelAnimationFrame?window.cancelAnimationFrame.bind(window):null,ue="undefined"!=typeof globalThis&&void 0!==globalThis.process&&"test"===(null==(o=null==(t=globalThis.process)?void 0:t.env)?void 0:o.NODE_ENV),me=g&&"function"==typeof window.requestIdleCallback,he=T(()=>{var e;const n=Math.trunc(null!=(e=l.renderBatchSize)?e:80);return Number.isFinite(n)?Math.max(0,n):0}),ve=T(()=>{var e;const n=Math.trunc(null!=(e=l.initialRenderBatchSize)?e:he.value);return Number.isFinite(n)?Math.max(0,n):he.value}),fe=T(()=>!1!==l.batchRendering&&he.value>0&&g&&!ue),ye=S(0),ke=S({key:l.indexKey,total:0}),xe=S(Math.max(1,he.value||1)),be=S(/* @__PURE__ */new Set),Me=/* @__PURE__ */new Map,Te=/* @__PURE__ */new Map,Ce=/* @__PURE__ */new Map,Be=/* @__PURE__ */new Map,Ie=/* @__PURE__ */new WeakMap,Se=S(0),$e=T(()=>(Se.value,Array.from(Be.entries()).sort((e,n)=>e[0]-n[0]))),Ee=S(0),Le=S([]),Ne=S([]),je=S(null);let He=null,Pe=null;const De=T(()=>{var e;return!1!==l.deferNodesUntilVisible&&!((null!=(e=l.maxLiveNodes)?e:0)<=0)&&!oe.value&&!(ne.value.length>900)&&le.value}),Re=T(()=>{var e;return fe.value&&(null!=(e=l.maxLiveNodes)?e:0)<=0}),Ke=S({batchSize:he.value,initial:ve.value,delay:null!=(r=l.renderBatchDelay)?r:16,enabled:Re.value}),Oe=T(()=>!!ie&&(De.value||oe.value)),We=T(()=>{var e;return Math.max(0,null!=(e=l.liveNodeBuffer)?e:60)}),Ae=S(0),Fe=G({start:0,end:0}),Ve=/* @__PURE__ */new Map,Xe=T(()=>{if(!oe.value)return ne.value.length;const e=We.value,n=Math.max(Fe.end+e,ve.value),t=Math.min(ne.value.length,n);return Math.max(ye.value,t)});function qe(e){var n,t,o,r;const l=O(null!=(n=null!=e?e:d.value)?n:null);if(l)return l;const i=null!=(r=null!=(o=null==e?void 0:e.ownerDocument)?o:null==(t=d.value)?void 0:t.ownerDocument)?r:"undefined"!=typeof document?document:null;return(null==i?void 0:i.scrollingElement)||(null==i?void 0:i.documentElement)||null}function Ge(e){if(!g)return!1;try{const n=window.getComputedStyle(e);return!!(n.display||"").toLowerCase().includes("flex")&&(n.flexDirection||"").toLowerCase().endsWith("reverse")}catch(n){return!1}}function Ye(){He&&(He(),He=null),je.value=null}function Ze(){if(!g||!oe.value)return;const e=qe();if(!e||je.value===e)return;Ye();const n=()=>Qe();e.addEventListener("scroll",n,{passive:!0}),je.value=e,He=()=>{e.removeEventListener("scroll",n)}}function Je(){var e,n,t;if(!Pe)return;const o=null!=(t=null==(n=null==(e=d.value)?void 0:e.ownerDocument)?void 0:n.defaultView)?t:"undefined"!=typeof window?window:null;Pe.viaTimeout?o?o.clearTimeout(Pe.id):clearTimeout(Pe.id):null==de||de(Pe.id),Pe=null}function Qe(e={}){var n,t,o;if(!oe.value)return;if(!g)return void en(!0);if(e.immediate)return Je(),void en(!0);if(Pe)return;const r=()=>{Pe=null,en()};if(se)Pe={id:se(r),viaTimeout:!1};else{const e=null!=(o=null==(t=null==(n=d.value)?void 0:n.ownerDocument)?void 0:t.defaultView)?o:"undefined"!=typeof window?window:null,l=e?e.setTimeout(r,16):setTimeout(r,16);Pe={id:l,viaTimeout:!0}}}function en(e=!1){var n,t,o,r,l,i,a;if(!oe.value)return;const s=je.value||qe();if(!s)return;const u=s.ownerDocument||(null==(n=d.value)?void 0:n.ownerDocument)||document,c=(null==u?void 0:u.defaultView)||("undefined"!=typeof window?window:null),m=s===(null==u?void 0:u.documentElement)||s===(null==u?void 0:u.body),p=ne.value.length;if(!m&&p>0&&Ge(s)){const n=s.clientHeight||0,t=s.scrollTop,o=t<0?-t:t,r=function(e){var n;const t=ne.value;if(!t.length)return 0;if(e<=0)return Math.max(0,t.length-1);if(Ee.value===t.length){const n=cn(0,t.length);return fn(Math.max(0,n-e))}let o=e;for(let r=t.length-1;r>=0;r--){const e=null!=(n=tn[r])?n:un.value;if(o<=e)return r;o-=e}return 0}(Math.max(0,o)+.5*Math.max(0,n)),l=nn(r,0,Math.max(0,p-1));return void((e||Math.abs(l-Ae.value)>1)&&(Ae.value=l))}const h=m?null:s.getBoundingClientRect(),v=m?0:h.top,f=m?null!=(o=null!=(t=null==c?void 0:c.innerHeight)?t:s.clientHeight)?o:0:h.bottom,g=$e.value;let y=null,w=null;for(const[d,x]of g){if(!x)continue;const e=x.getBoundingClientRect();e.bottom<=v||e.top>=f||(null==y&&(y=d),w=d)}if(null==y||null==w){const e=d.value;if(!e)return;const n=m?{top:0}:s.getBoundingClientRect(),t=function(e,n,t){var o,r,l,i,a,s;if(t)return null!=(i=null!=(l=null==(o=null==n?void 0:n.documentElement)?void 0:o.scrollTop)?l:null==(r=null==n?void 0:n.body)?void 0:r.scrollTop)?i:0;const d=e.scrollTop;if(!Ge(e))return d;const u=d<0?-d:d;return Math.max(0,(null!=(a=e.scrollHeight)?a:0)-(null!=(s=e.clientHeight)?s:0))-u}(s,u,m),o=m?(()=>{const t=e.getBoundingClientRect(),o=(m?0:n.top)-t.top;return Math.max(0,o)})():(()=>{const n=function(e,n){let t=e,o=0,r=0;for(;t&&t!==n&&r++<64;)o+=t.offsetTop||0,t=t.offsetParent;return o}(e,s);return Math.max(0,t-n)})(),p=m?null!=(a=null!=(i=null!=(l=null==c?void 0:c.innerHeight)?l:null==(r=null==u?void 0:u.documentElement)?void 0:r.clientHeight)?i:s.clientHeight)?a:0:s.clientHeight,h=fn(o+.5*Math.max(0,p));return void(Ae.value=nn(h,0,Math.max(0,ne.value.length-1)))}const k=Math.round((y+w)/2);!e&&Math.abs(k-Ae.value)<=1||(Ae.value=nn(k,0,Math.max(0,ne.value.length-1)))}function nn(e,n,t){return Math.min(Math.max(e,n),t)}const tn=G({}),on=G({total:0,count:0});function rn(){for(const e of Object.keys(tn))delete tn[Number(e)];on.total=0,on.count=0,Ee.value=0,Le.value=[],Ne.value=[]}function ln(e,n,t){for(let o=n+1;o<e.length;o+=o&-o)e[o]+=t}function an(e,n){let t=0;for(let o=n+1;o>0;o-=o&-o)t+=e[o];return t}function sn(e,n,t){if(t<=n)return 0;const o=an(e,t-1);return n<=0?o:o-an(e,n-1)}function dn(e){Ee.value=e;const n=new Array(e+1).fill(0),t=new Array(e+1).fill(0);for(const[o,r]of Object.entries(tn)){const l=Number(o),i=Number(r);!Number.isFinite(l)||l<0||l>=e||!Number.isFinite(i)||i<=0||(ln(n,l,i),ln(t,l,1))}Le.value=n,Ne.value=t}const un=T(()=>on.count>0?Math.max(12,on.total/on.count):32);function cn(e,n){var t,o;if(e>=n)return 0;if(Ee.value!==ne.value.length){let o=0;for(let r=e;r<n;r++)o+=null!=(t=tn[r])?t:un.value;return o}const r=Le.value,l=Ne.value;if(!r.length||!l.length){let t=0;for(let r=e;r<n;r++)t+=null!=(o=tn[r])?o:un.value;return t}return sn(r,e,n)+(n-e-sn(l,e,n))*un.value}$(()=>ne.value.length,e=>{e<=0?rn():(e<Ee.value&&function(e){if(e<=0)return void rn();let n=0,t=0;for(const[o,r]of Object.entries(tn)){const l=Number(o),i=Number(r);!Number.isFinite(l)||l<0||l>=e||!Number.isFinite(i)||i<=0?delete tn[l]:(n+=i,t++)}on.total=n,on.count=t}(e),e!==Ee.value&&dn(e))},{immediate:!0});const mn=T(()=>{if(!oe.value)return ne.value.map((e,n)=>({node:e,index:n}));const e=ne.value.length,n=nn(Fe.start,0,e),t=nn(Fe.end,n,e);return ne.value.slice(n,t).map((e,t)=>({node:e,index:n+t}))}),pn=T(()=>oe.value?cn(0,Math.min(Fe.start,ne.value.length)):0),hn=T(()=>{if(!oe.value)return 0;const e=ne.value.length;return cn(Math.min(Fe.end,e),e)});function fn(e){var n;if(e<=0)return 0;const t=ne.value;if(Ee.value===t.length&&Le.value.length&&Ne.value.length){const n=un.value,o=Le.value,r=Ne.value,l=e=>e<=0?0:an(o,e-1)+(e-an(r,e-1))*n;let i=0,a=t.length-1,s=t.length-1;for(;i<=a;){const n=i+a>>1;l(n+1)>=e?(s=n,a=n-1):i=n+1}return s}let o=e;for(let r=0;r<t.length;r++){const e=null!=(n=tn[r])?n:un.value;if(o<=e)return r;o-=e}return Math.max(0,t.length-1)}function gn(){Se.value+=1}function yn(e,n){const t=be.value,o=t.has(e);if(n){if(o)return;const n=new Set(t);return n.add(e),void(be.value=n)}if(!o)return;const r=new Set(t);r.delete(e),be.value=r}function wn(){0!==be.value.size&&(be.value=/* @__PURE__ */new Set)}function kn(e){if(!Me.size)return;if(!oe.value)return;let n=!1;for(const[t,o]of Me)t>=e&&(o.destroy(),Me.delete(t),De.value&&yn(t,!1),En(t),Be.delete(t)&&(n=!0));n&&gn()}function xn(e,n){De.value&&yn(e,n),n&&(oe.value?Qe():Ae.value=nn(e,0,Math.max(0,ne.value.length-1)))}function bn(e){const n=Te.get(e);n&&(n(),Te.delete(e));const t=Me.get(e);t&&(t.destroy(),Me.delete(e)),En(e)}function Mn(e,n){let t=!1;if(n){const o=Be.get(e);Be.set(e,n),o!==n&&(t=!0)}else Be.delete(e)&&(t=!0);if(t&&gn(),n||En(e),!Oe.value||!ie)return bn(e),void(n&&xn(e,!0));if(!oe.value&&De.value&&!p.value&&Me.size>=640&&(function(){if(!p.value){p.value=!0;for(const e of Me.values())e.destroy();if(Me.clear(),g)for(const e of Ce.values())window.clearTimeout(e);Ce.clear(),wn()}}(),!Oe.value||!ie))return bn(e),void(n&&xn(e,!0));if(e<ve.value&&!oe.value)return bn(e),void xn(e,!0);if(be.value.has(e))return bn(e),void xn(e,!0);if(!n)return void bn(e);bn(e);const o=ie(n,{rootMargin:"400px"});if(!o)return;Me.set(e,o),xn(e,o.isVisible.value),De.value&&function(e){if(!g||!De.value)return;En(e);const n=e%17*23,t=window.setTimeout(()=>{var n,t;if(Ce.delete(e),!De.value)return;if(be.value.has(e))return;const o=Be.get(e);if(!o)return;const r=qe(o),l=o.ownerDocument||document,i=l.defaultView||window,a=!r||r===l.documentElement||r===l.body,s=!a&&r?r.getBoundingClientRect():null,d=a?0:s.top,u=a?null!=(t=null!=(n=i.innerHeight)?n:null==r?void 0:r.clientHeight)?t:0:s.bottom,c=o.getBoundingClientRect();c.bottom>=d-500&&c.top<=u+500&&xn(e,!0)},1800+n);Ce.set(e,t)}(e);let r=null;r=$(()=>o.isVisible.value,n=>{if(n){En(e),xn(e,!0),null==r||r(),Te.delete(e),Me.get(e)===o&&Me.delete(e);try{o.destroy()}catch(t){}}},{immediate:!0}),Te.set(e,r),oe.value&&Qe()}let Tn=null,Cn=null,Bn=!1,In=null,Sn=null;function $n(){g&&(null!=Tn&&(null==de||de(Tn),Tn=null),null!=Cn&&(window.clearTimeout(Cn),Cn=null),null!=Sn&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(Sn),Sn=null),Bn=!1,In=null)}function En(e){if(!g)return;const n=Ce.get(e);null!=n&&(window.clearTimeout(n),Ce.delete(e))}function Ln(e,n={}){var t,o;if(!Re.value)return;const r=Xe.value;if(ye.value>=r)return;const i=Math.max(1,e),a=e=>{var n;Tn=null,Cn=null,Sn=null,Bn=!1;const t=null!=In?In:i;In=null;const o=Math.max(2,null!=(n=l.renderBatchBudgetMs)?n:6),a=e=>{const n="undefined"!=typeof performance?performance.now():Date.now();ye.value=Math.min(r,ye.value+Math.max(1,e)),kn(ye.value);const t=("undefined"!=typeof performance?performance.now():Date.now())-n;return function(e){var n;if(!Re.value)return;const t=Math.max(2,null!=(n=l.renderBatchBudgetMs)?n:6),o=Math.max(1,he.value||1),r=Math.max(1,Math.floor(o/4));e>1.2*t?xe.value=Math.max(r,Math.floor(.7*xe.value)):e<.5*t&&xe.value<o&&(xe.value=Math.min(o,Math.ceil(1.2*xe.value)))}(t),t};let s=t;for(;(a(s),!(ye.value>=r)&&e)&&!(("function"==typeof e.timeRemaining?e.timeRemaining():0)<=.5*o);)s=Math.max(1,Math.round(xe.value));ye.value<r&&Nn()};if(!g||n.immediate)return void a();const s=Math.max(0,null!=(t=l.renderBatchDelay)?t:16);if(In=null!=In?Math.max(In,i):i,!Bn){if(Bn=!0,!ue&&me&&window.requestIdleCallback){const e=Math.max(0,null!=(o=l.renderBatchIdleTimeoutMs)?o:120);return void(Sn=window.requestIdleCallback(e=>{a(e)},{timeout:e}))}se&&!ue?Tn=se(()=>{0!==s?Cn=window.setTimeout(()=>a(),s):a()}):Cn=window.setTimeout(()=>a(),s)}}function Nn(){Re.value&&Ln(fe.value?Math.max(1,Math.round(xe.value)):Math.max(1,he.value))}$([()=>ne.value,()=>ne.value.length,()=>Re.value,()=>he.value,()=>ve.value,()=>l.renderBatchDelay,()=>l.indexKey],()=>{var e;const n=ne.value.length,t=ke.value,o=l.indexKey,r=void 0!==o&&o!==t.key,i=n!==t.total,a=r||i;ke.value={key:o,total:n};const s=Ke.value,d=null!=(e=l.renderBatchDelay)?e:16,u=s.batchSize!==he.value||s.initial!==ve.value||s.delay!==d||s.enabled!==Re.value;Ke.value={batchSize:he.value,initial:ve.value,delay:d,enabled:Re.value},r&&(rn(),n>0&&dn(n)),(a||u||!Re.value)&&$n(),(a||u)&&(xe.value=Math.max(1,he.value||1)),a&&oe.value&&Qe({immediate:!0});const c=Xe.value;if(!n)return ye.value=0,void kn(0);if(!Re.value)return ye.value=c,void kn(ye.value);const m=r||0===t.total;ye.value=m||u?Math.min(c,ve.value):Math.min(ye.value,c);const p=Math.max(1,ve.value||he.value||n);ye.value<c?Ln(p,{immediate:!g}):kn(ye.value)},{immediate:!0}),$(()=>oe.value,e=>{if(!e)return Ye(),void Je();Ze(),Qe({immediate:!0})},{immediate:!0}),$([()=>ne.value.length,()=>oe.value],e=>u(null,[e],function*([e,n]){n&&e&&g&&(yield L(),Qe({immediate:!0}))}),{flush:"post"}),$(()=>d.value,()=>{oe.value&&(Ze(),Qe({immediate:!0}))}),$(()=>ne.value.length,()=>{oe.value&&Qe({immediate:!0})}),$(()=>De.value,e=>{if(e)for(const[n,t]of Be)Mn(n,t);else{for(const e of Me.values())e.destroy();Me.clear();for(const e of Array.from(Ce.keys()))En(e);wn();for(const[e,n]of Be)n&&xn(e,!0)}},{immediate:!1}),$([()=>l.viewportPriority,()=>ne.value.length],([e,n])=>{!1!==e?p.value&&n<=200&&(p.value=!1):p.value=!1}),$(()=>ye.value,()=>{oe.value&&Qe({immediate:!0})}),$([Ae,te,We,()=>ne.value.length,oe],()=>{!function(){const e=ne.value.length;if(!oe.value||0===e)return Fe.start=0,void(Fe.end=e);const n=Math.min(te.value,e),t=We.value,o=nn(Ae.value-t,0,Math.max(0,e-n));Fe.start=o,Fe.end=Math.min(e,o+n)}()},{immediate:!0}),$([()=>ne.value.length,oe,te,We,()=>Fe.start,()=>Fe.end],([e,n,t,o,r,l])=>{y.value&&I("virtualization",{nodes:e,virtualization:n,maxLiveNodes:t,buffer:o,focusIndex:Ae.value,scroll:n?(()=>{const e=je.value||qe();return e?{reverse:Ge(e),scrollTop:Math.round(e.scrollTop),scrollTopAbs:Math.round(Math.abs(e.scrollTop)),scrollHeight:Math.round(e.scrollHeight),clientHeight:Math.round(e.clientHeight)}:null})():null,liveRange:{start:r,end:l},rendered:ye.value})}),$(()=>Xe.value,(e,n)=>{Re.value&&("number"==typeof n&&e<=n||e>ye.value&&Nn())}),N(()=>{$n();for(const e of Me.values())e.destroy();Me.clear();for(const e of Te.values())e();Te.clear();for(const e of Array.from(Ce.keys()))En(e);Ye(),Je()});const jn=V(()=>u(null,null,function*(){try{return(yield import("./index4.js")).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for CodeBlockNode are missing. Falling back to inline-code rendering (no Monaco). To enable full code block features, please install "stream-monaco".',e),St}})),Hn=V(()=>u(null,null,function*(){try{return(yield import("./index5.js")).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for MermaidBlockNode are missing. Falling back to preformatted code rendering. To enable Mermaid rendering, please install "mermaid".',e),St}})),Pn=V(()=>u(null,null,function*(){try{return(yield import("./index6.js")).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for InfographicBlockNode are missing. Falling back to preformatted code rendering. To enable Infographic rendering, please install "@antv/infographic".',e),St}})),Dn=V(()=>u(null,null,function*(){try{return(yield import("./index7.js")).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for D2BlockNode are missing. Falling back to preformatted code rendering. To enable D2 rendering, please install "@terrastruct/d2".',e),St}})),Rn=T(()=>l.renderCodeBlocksAsPre?St:jn),Kn={text:On,paragraph:Ct,heading:wt,code_block:jn,list:xt,list_item:kt,blockquote:re,table:Ht,definition_list:ce,footnote:vt,footnote_reference:_e,footnote_anchor:mt,admonition:Yt,vmr_container:Ot,hardbreak:gt,link:rt,image:_n,thematic_break:Dt,math_inline:Wn,math_block:An,strong:Zn,emphasis:ut,strikethrough:Qn,highlight:st,insert:it,subscript:Gn,superscript:Un,emoji:pe,checkbox:ae,checkbox_input:ae,inline_code:Ue,html_inline:ze,reference:zn,html_block:Tt},Fn=T(()=>(ge.value,we(l.customId))),Vn=T(()=>null!=l.indexKey?String(l.indexKey):"markdown-renderer"),Xn=T(()=>a(a({stream:l.codeBlockStream,darkTheme:l.codeBlockDarkTheme,lightTheme:l.codeBlockLightTheme,monacoOptions:l.codeBlockMonacoOptions,themes:l.themes,minWidth:l.codeBlockMinWidth,maxWidth:l.codeBlockMaxWidth},"boolean"==typeof _.value?{showTooltips:_.value}:{}),l.codeBlockProps||{})),qn=T(()=>a({},l.mermaidProps||{})),Yn=T(()=>a({},l.d2Props||{})),Jn=T(()=>a({},l.infographicProps||{})),et=T(()=>({typewriter:l.typewriter})),nt=T(()=>a(a({},et.value),"boolean"==typeof _.value?{showTooltip:_.value}:{})),tt=T(()=>a(a({},et.value),"boolean"==typeof _.value?{showTooltips:_.value}:{})),ot=T(()=>mn.value.map(e=>{var n;let t=function(e){var n,t,o,r,l,i,s;if("code_block"!==e.type)return e;const d=e,u=[String(null!=(n=d.language)?n:""),String(null!=(t=d.loading)?t:""),String(null!=(o=d.diff)?o:""),String(null!=(r=d.code)?r:""),String(null!=(l=d.originalCode)?l:""),String(null!=(i=d.updatedCode)?i:""),String(null!=(s=d.raw)?s:"")].join("\0"),c=Ie.get(d);if(c&&c.signature===u)return c.node;const m=a({},d);return Ie.set(d,{signature:u,node:m}),m}(e.node);const o=at(t);let r=function(e,n){if(!e)return Kt;const t=Fn.value,o=t[String(e.type)];if("code_block"===e.type){const r=null!=n?n:at(e);if("mermaid"===r)return t.mermaid||Hn;if("infographic"===r)return t.infographic||Pn;if("d2"===r||"d2lang"===r)return t.d2||Dn;if(o)return o;return t.code_block||Rn.value}return o||Kn[String(e.type)]||Kt}(t,o);if(("html_block"===t.type||"html_inline"===t.type)&&r===Kn[t.type]){const e=String(null!=(n=t.tag)?n:"").trim().toLowerCase()||function(e){const n=String(null!=e?e:"").match(/^\s*<\s*([A-Z][\w:-]*)/i);return n?n[1].toLowerCase():""}(t.content);if(e&&ee.value.has(e)){const n=Fn.value[e];n&&(r=n,t=s(a({},t),{type:e,tag:e,content:lt(t.content,e)}))}}return s(a({},e),{node:t,component:r,bindings:dt(t,o),isCodeBlock:"code_block"===t.type,indexKey:`${Vn.value}-${e.index}`})}));function lt(e,n){const t=String(null!=e?e:"");if(!n)return t;const o=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(String.raw`^\s*<\s*${o}(?:\s[^>]*)?>\s*`,"i"),l=new RegExp(String.raw`\s*<\s*\/\s*${o}\s*>\s*$`,"i");return t.replace(r,"").replace(l,"")}function at(e){var n;return"code_block"===(null==e?void 0:e.type)?String(null!=(n=e.language)?n:"").trim().toLowerCase():""}function dt(e,n){const t=null!=n?n:at(e);return"mermaid"===t?qn.value:"infographic"===t?Jn.value:"d2"===t||"d2lang"===t?Yn.value:"link"===e.type?nt.value:"list"===e.type?tt.value:"code_block"===e.type?Xn.value:et.value}function ct(e){i("click",e)}function pt(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&i("mouseover",e)}function ht(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&i("mouseout",e)}return(e,n)=>(v(),f("div",{ref_key:"containerRef",ref:d,class:C(["markstream-vue markdown-renderer",[{dark:l.isDark},{virtualized:oe.value}]]),"data-custom-id":l.customId,onClick:ct,onMouseover:pt,onMouseout:ht},[oe.value?(v(),f("div",{key:0,class:"node-spacer",style:K({height:`${pn.value}px`}),"aria-hidden":"true"},null,4)):E("",!0),(v(!0),f(k,null,x(ot.value,e=>{var t,o;return v(),f("div",{key:e.index,ref_for:!0,ref:n=>Mn(e.index,n),class:"node-slot","data-node-index":e.index,"data-node-type":e.node.type},[(o=e.index,Re.value&&o>=ye.value||!(!De.value||o<ve.value||be.value.has(o))?(v(),f("div",{key:1,class:"node-placeholder",style:K({height:`${null!=(t=tn[e.index])?t:un.value}px`})},null,4)):(v(),f("div",{key:0,ref_for:!0,ref:n=>function(e,n){n?(Ve.set(e,n),queueMicrotask(()=>{!function(e,n){if(!Number.isFinite(n)||n<=0)return;const t=tn[e];if(tn[e]=n,t?on.total+=n-t:(on.total+=n,on.count++),Ee.value>e){const o=Le.value,r=Ne.value;if(o.length&&r.length)if(t){const r=n-t;0!==r&&ln(o,e,r)}else ln(o,e,n),ln(r,e,1)}}(e,n.offsetHeight)})):Ve.delete(e)}(e.index,n),class:"node-content"},[e.isCodeBlock||!1===l.typewriter?(v(),j(U(e.component),X({key:1,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":l.customId,"is-dark":l.isDark,onCopy:n[2]||(n[2]=e=>i("copy",e)),onHandleArtifactClick:n[3]||(n[3]=e=>i("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"])):(v(),j(P,{key:0,name:"typewriter",appear:""},{default:D(()=>[(v(),j(U(e.component),X({node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":l.customId,"is-dark":l.isDark,onCopy:n[0]||(n[0]=e=>i("copy",e)),onHandleArtifactClick:n[1]||(n[1]=e=>i("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"]))]),_:2},1024))],512)))],8,At)}),128)),oe.value?(v(),f("div",{key:1,class:"node-spacer",style:K({height:`${hn.value}px`}),"aria-hidden":"true"},null,4)):E("",!0)],42,Wt))}}),[["__scopeId","data-v-74a6bf34"]]);zt.install=e=>{var n,t;const o=null!=(t=null!=(n=zt.__name)?n:zt.name)?t:"NodeRenderer";e.component(o,zt)};const Ft={key:0,class:"admonition-icon"},Vt={class:"admonition-title"},Ut=["aria-expanded","aria-controls","title"],Xt={key:0},qt={key:1},Gt=["id"],Yt=/* @__PURE__ */oe(/* @__PURE__ */h({__name:"AdmonitionNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e,{emit:n}){var t;const o=e,r=n,l={note:"ℹ️",info:"ℹ️",tip:"💡",warning:"⚠️",danger:"❗",error:"⛔",caution:"⚠️"},i=T(()=>{if(o.node.title&&o.node.title.trim().length)return o.node.title;const e=o.node.kind||"note";return e.charAt(0).toUpperCase()+e.slice(1)}),a=S(!!o.node.collapsible&&!(null==(t=o.node.open)||t));function s(){o.node.collapsible&&(a.value=!a.value)}const d=`admonition-${Math.random().toString(36).slice(2,9)}`;return(n,t)=>(v(),f("div",{class:C(["admonition",[`admonition-${o.node.kind}`,o.isDark?"is-dark":""]])},[w("div",{id:d,class:"admonition-header"},[l[o.node.kind]?(v(),f("span",Ft,b(l[o.node.kind]),1)):E("",!0),w("span",Vt,b(i.value),1),o.node.collapsible?(v(),f("button",{key:1,class:"admonition-toggle","aria-expanded":!a.value,"aria-controls":`${d}-content`,title:a.value?"Expand":"Collapse",onClick:s},[a.value?(v(),f("span",Xt,"▶")):(v(),f("span",qt,"▼"))],8,Ut)):E("",!0)]),R(w("div",{id:`${d}-content`,class:"admonition-content","aria-labelledby":d},[g(y(zt),{"index-key":`admonition-${e.indexKey}`,nodes:o.node.children,"custom-id":o.customId,typewriter:o.typewriter,onCopy:t[0]||(t[0]=e=>r("copy",e))},null,8,["index-key","nodes","custom-id","typewriter"])],8,Gt),[[O,!a.value]])],2))}}),[["__scopeId","data-v-ee240a2a"]]);Yt.install=e=>{e.component(Yt.__name,Yt)};const Zt=()=>import("@terrastruct/d2");let Jt=null,Qt=Zt;function eo(e){Qt=e,Jt=null}function no(e){eo(null!=e?e:Zt)}function to(){eo(null)}function oo(){return"function"==typeof Qt}function ro(){return u(this,null,function*(){if(Jt)return Jt;const e=Qt;if(!e)return null;let n;try{n=yield e()}catch(t){if(e===Zt)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw t}return n?(Jt=function(e){var n;if(!e)return e;if(e.D2&&"function"==typeof e.D2)return e.D2;if(e.default&&e.default.D2&&"function"==typeof e.default.D2)return e.default.D2;const t=null!=(n=e.default)?n:e;return"function"==typeof t?t:(null==t?void 0:t.D2)&&"function"==typeof t.D2?t.D2:t}(n),Jt):null})}let lo=!1,io=null,ao=!1;function so(){return u(this,null,function*(){if(io)return io;if(ao)return null;try{return io=yield import("stream-monaco"),yield function(e){return u(this,null,function*(){if(lo)return;lo=!0;const n=null==globalThis?void 0:globalThis.MonacoEnvironment;return!n||"function"!=typeof n.getWorker&&"function"!=typeof n.getWorkerUrl?e.preloadMonacoWorkers():void 0})}(io),(yield function(e){return u(this,null,function*(){const n=null==e?void 0:e.getOrCreateHighlighter;if("function"!=typeof n)return!0;try{const e=yield n(["vitesse-dark","vitesse-light"],["plaintext","text","javascript"]);return e&&"function"==typeof e.codeToTokens&&e.codeToTokens("const a = 1",{lang:"javascript",theme:"vitesse-dark"}),!0}catch(t){return console.warn("[markstream-vue] Failed to warm up Shiki tokenizer; disabling stream-monaco for this session.",t),!1}})}(io))?io:(io=null,ao=!0,null)}catch(e){return ao=!0,null}})}function uo({R:e,H:n=0,B:t=50}){const o=e*(1-n)||1e-6;return Math.max(1,Math.floor(t/o))}function co(e){const n=e.length+10*(e.match(/\\/g)||[]).length;return n<10?"simple":n<40?"medium":"complex"}function mo(e){switch(e){case"simple":return 3;case"medium":return 10;case"complex":return 30}}function po(e,n){var t,o;let r=0;for(const l of e){const e=mo(co(l));e>r&&(r=e)}return uo({R:r,H:null!=(t=null==n?void 0:n.H)?t:0,B:null!=(o=null==n?void 0:n.B)?o:50})}const ho='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#8caaee" d="m 6.665625,1.0107144 c 0.54375,0.090628 0.9125,0.6062693 0.821875,1.1500367 L 7.18125,3.9983098 h 2.971875 L 10.5125,1.8326156 c 0.09063,-0.5437673 0.60625,-0.9125291 1.15,-0.8219012 0.54375,0.090628 0.9125,0.6062693 0.821875,1.1500367 L 12.18125,3.9983098 H 14 c 0.553125,0 1,0.4468892 1,1.0000319 0,0.5531426 -0.446875,1.0000319 -1,1.0000319 H 11.846875 L 11.18125,9.9985013 H 13 c 0.553125,0 1,0.4468897 1,1.0000317 0,0.553143 -0.446875,1.000032 -1,1.000032 H 10.846875 L 10.4875,14.164259 c -0.09063,0.543768 -0.60625,0.912529 -1.15,0.821902 -0.54375,-0.09063 -0.9125,-0.60627 -0.821875,-1.150037 l 0.30625,-1.834434 h -2.975 L 5.4875,14.167384 c -0.090625,0.543768 -0.60625,0.91253 -1.15,0.821902 C 3.79375,14.898658 3.425,14.383016 3.515625,13.839249 L 3.81875,11.998565 H 2 c -0.553125,0 -1,-0.446889 -1,-1.000032 C 1,10.445391 1.446875,9.9985013 2,9.9985013 H 4.153125 L 4.81875,5.9983736 H 3 c -0.553125,0 -1,-0.4468893 -1,-1.0000319 C 2,4.445199 2.446875,3.9983098 3,3.9983098 H 5.153125 L 5.5125,1.8326156 C 5.603125,1.2888483 6.11875,0.9200865 6.6625,1.0107144 Z M 6.846875,5.9983736 6.18125,9.9985013 H 9.153125 L 9.81875,5.9983736 Z" />\n</svg>\n',vo='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M2 15.5c-.7 0-1.5-.8-1.5-1.5V5c0-.7.8-1.5 1.5-1.5h9c.7 0 1.5.8 1.5 1.5v9c0 .7-.8 1.5-1.5 1.5z" />\n <path d="m1.2 3.8 3.04-2.5S5.17.5 5.7.5h8.4c.66 0 1.4.73 1.4 1.4v7.73a2.7 2.7 0 01-.7 1.75l-2.68 3.51M3 8.5l3 2-3 2m4 0h2" />\n </g>\n</svg>\n',fo='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#c6d0f5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M13.5 6.5v6a2 2 0 01-2 2h-7a2 2 0 01-2-2v-9c0-1.1.9-2 2-2h4.01" />\n <path d="m8.5 1.5 5 5h-4a1 1 0 01-1-1zm-3 10h5m-5-3h5m-5-3h1" />\n </g>\n</svg>\n';let go=null,yo=null,wo=null;const ko=M(0),xo={"":fo,plain:fo,text:fo,javascript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round">\n <path d="M4.5 11c0 .828427.6715729 1.5 1.5 1.5.8284271 0 1.5-.671573 1.5-1.5V7.5M12.5 8.75C12.5 8.05964406 11.9627417 7.5 11.3 7.5L10.7 7.5C10.0372583 7.5 9.5 8.05964406 9.5 8.75 9.5 9.44035594 10.0372583 10 10.7 10L11.3 10C11.9627417 10 12.5 10.5596441 12.5 11.25 12.5 11.9403559 11.9627417 12.5 11.3 12.5L10.7 12.5C10.0372583 12.5 9.5 11.9403559 9.5 11.25" />\n <path d="m 4,1.5 h 8 c 1.385,0 2.5,1.115 2.5,2.5 v 8 c 0,1.385 -1.115,2.5 -2.5,2.5 H 4 C 2.615,14.5 1.5,13.385 1.5,12 V 4 C 1.5,2.615 2.615,1.5 4,1.5 Z" />\n </g>\n</svg>\n',typescript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M4 1.5h8A2.5 2.5 0 0114.5 4v8a2.5 2.5 0 01-2.5 2.5H4A2.5 2.5 0 011.5 12V4A2.5 2.5 0 014 1.5" />\n <path d="M12.5 8.75c0-.69-.54-1.25-1.2-1.25h-.6c-.66 0-1.2.56-1.2 1.25S10.04 10 10.7 10h.6c.66 0 1.2.56 1.2 1.25s-.54 1.25-1.2 1.25h-.6c-.66 0-1.2-.56-1.2-1.25m-3-3.75v5M5 7.5h3" />\n </g>\n</svg>\n',jsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#99d1db" stroke-linecap="round" stroke-linejoin="round">\n <path d="M8 10.8c4.14 0 7.5-1.25 7.5-2.8S12.14 5.2 8 5.2.5 6.45.5 8s3.36 2.8 7.5 2.8" />\n <path d="M5.52 9.4c2.07 3.5 4.86 5.72 6.23 4.95 1.37-.78.8-4.24-1.27-7.75C8.41 3.1 5.62.88 4.25 1.65c-1.37.78-.8 4.24 1.27 7.75" />\n <path d="M5.52 6.6c-2.07 3.5-2.64 6.97-1.27 7.75 1.37.77 4.16-1.45 6.23-4.95s2.64-6.97 1.27-7.75C10.38.88 7.59 3.1 5.52 6.6" />\n <path d="M8.5 8a.5.5 0 01-.5.5.5.5 0 01-.5-.5.5.5 0 01.5-.5.5.5 0 01.5.5" />\n </g>\n</svg>\n',tsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M8 11.3c4.14 0 7.5-1.28 7.5-2.86S12.14 5.58 8 5.58.5 6.86.5 8.44s3.36 2.87 7.5 2.87Z" />\n <path d="M5.52 9.87c2.07 3.6 4.86 5.86 6.23 5.07 1.37-.8.8-4.34-1.27-7.93S5.62 1.16 4.25 1.95s-.8 4.34 1.27 7.92" />\n <path d="M5.52 7.01c-2.07 3.59-2.64 7.14-1.27 7.93s4.16-1.48 6.23-5.07c2.07-3.58 2.64-7.13 1.27-7.92-1.37-.8-4.16 1.47-6.23 5.06" />\n <path d="M8.5 8.44a.5.5 0 01-.5.5.5.5 0 01-.5-.5.5.5 0 01.5-.5.5.5 0 01.5.5" />\n </g>\n</svg>\n',html:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#ef9f76" d="M1.5 1.5h13L13 13l-5 2-5-2z" />\n <path stroke="#c6d0f5" d="M11 4.5H5l.25 3h5.5l-.25 3-2.5 1-2.5-1-.08-1" />\n </g>\n</svg>\n',css:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round">\n <path d="m4 1.5h8c1.38 0 2.5 1.12 2.5 2.5v8c0 1.38-1.12 2.5-2.5 2.5h-8c-1.38 0-2.5-1.12-2.5-2.5v-8c0-1.38 1.12-2.5 2.5-2.5z" />\n <path stroke-width=".814" d="m 10.240861,11.529149 c 0,0.58011 0.437448,1.039154 0.96002,1.035371 l 0.451635,-0.0032 c 0.522572,-0.0036 0.949379,-0.451477 0.949379,-1.032848 0,-0.581372 -0.426807,-1.065638 -0.949379,-1.065638 l -0.451635,3.4e-5 c -0.522572,3.9e-5 -0.949379,-0.4855273 -0.949379,-1.0656374 0,-0.5801104 0.426807,-1.0378931 0.949379,-1.0378931 l 0.451635,2.825e-4 c 0.522572,3.267e-4 0.951743,0.4577827 0.951743,1.0378931 M 6.8003972,11.529149 c 0,0.58011 0.4374474,1.039154 0.9600196,1.035371 l 0.46464,-0.0032 c 0.5225722,-0.0035 0.9363738,-0.451477 0.9363738,-1.031587 0,-0.580111 -0.4090724,-1.065638 -0.9316446,-1.065638 l -0.4693692,3.4e-5 c -0.5225722,3.8e-5 -0.949379,-0.4855272 -0.949379,-1.0656373 0,-0.5801104 0.4268068,-1.0378931 0.949379,-1.0378931 h 0.4516348 c 0.5225722,0 0.9635665,0.4577827 0.9635665,1.0378931 M 3.4072246,11.529149 c 0,0.58011 0.4374474,1.051765 0.9600196,1.051765 H 4.818879 c 0.5225722,0 0.949379,-0.456521 0.949379,-1.037893 m 0.01129,-2.1312747 c 0,-0.5801103 -0.4374474,-1.037893 -0.9600196,-1.037893 L 4.3678939,8.3741358 C 3.8453217,8.3744624 3.4078743,8.8420074 3.4078743,9.4233788 v 2.1186642" />\n </g>\n</svg>\n',scss:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#f4b8e4" stroke-linecap="round" stroke-linejoin="round" d="M6.75 6.38c1.85 1.07 3.35.74 4.83-.2 1.5-.95 2.7-2.78 1.3-4.15-.7-.68-3.25-.8-5.62.19-2.36.99-4.59 3.02-4.74 4.11-.31 2.19 3.15 2.88 3.64 4.23s.28 1.98-.2 2.83c-.5.85-1.96 1.62-2.8.68-.83-.95 1.67-2.75 2.98-3.25 1.3-.5 3.1-.4 3.69.25.58.64-.07 1.79-.03 1.79" />\n</svg>\n',json:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round" d="M4.5 2.5H4c-.75 0-1.5.75-1.5 1.5v2c0 1.1-1 2-1.83 2 .83 0 1.83.9 1.83 2v2c0 .75.75 1.5 1.5 1.5h.5m7-11h.5c.75 0 1.5.75 1.5 1.5v2c0 1.1 1 2 1.83 2-.83 0-1.83.9-1.83 2v2c0 .74-.75 1.5-1.5 1.5h-.5m-6.5-3a.5.5 0 100-1 .5.5 0 000 1m3 0a.5.5 0 100-1 .5.5 0 000 1m3 0a.5.5 0 100-1 .5.5 0 000 1" />\n</svg>\n',python:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#8caaee" d="M8.5 5.5h-3m6 0V3c0-.8-.7-1.5-1.5-1.5H7c-.8 0-1.5.7-1.5 1.5v2.5H3c-.8 0-1.5.7-1.5 1.5v2c0 .8.7 1.5 1.48 1.5" />\n <path stroke="#e5c890" d="M10.5 10.5h-3m-3 0V13c0 .8.7 1.5 1.5 1.5h3c.8 0 1.5-.7 1.5-1.5v-2.5H13c.8 0 1.5-.7 1.5-1.5V7c0-.8-.7-1.5-1.48-1.5H11.5c0 1.5 0 2-1 2h-2" />\n <path stroke="#8caaee" d="M2.98 10.5H4.5c0-1.5 0-2 1-2h2M7.5 3.5v0" />\n <path stroke="#e5c890" d="m 8.5,12.5 v 0" />\n </g>\n</svg>\n',ruby:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e78284" stroke-linecap="round" stroke-linejoin="round" d="M1.5 9.06v2.5c.02.86.36 1.61.9 2.15 1.76 1.76 5.71.65 8.84-2.47 3.12-3.13 4.23-7.08 2.47-8.84a3.1 3.1 0 00-2.15-.9h-2.5M14.5 4l-.25 10.25L4 14.5m4.39-6.11c2.34-2.35 3.29-5.2 2.12-6.37S6.49 1.8 4.14 4.14C1.8 6.5.85 9.34 2.02 10.51s4.02.22 6.37-2.12M5.5 14.5l.25-3.75L11 11l-.25-5.25 3.75-.25" />\n</svg>\n',go:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#85c1dc" stroke-linecap="round" stroke-linejoin="round" d="m15.48 8.06-4.85.48m4.85-.48a4.98 4.98 0 01-4.54 5.42 5 5 0 112.95-8.66l-1.7 1.84a2.5 2.5 0 00-4.18 2.06c.05.57.3 1.1.69 1.51.25.27 1 .83 1.78.82.8-.02 1.58-.25 2.07-.81 0 0 .8-.96.68-1.88M2.5 8.5l-2 .01m1.5 2h1.5m-2-3.99 2-.02" />\n</svg>\n',java:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#c6d0f5" d="M10.73 8.41c.57 3 1.59 5.83 2.77 7.09-6.63-3.45-9.76-1.75-10.5 0-.66-3.4-.54-5.74.09-7.78" />\n <path stroke="#e78284" d="M8.5 7c.63.34 1.82 1.07 2.24 1.41-.54-2.9-.64-5.96-.74-7.91-2.13.58-5.73 1.98-6.9 7.22.52-.69 1.72-1.05 2.4-1.22" />\n <path stroke="#e78284" d="M5.5 7A1.5 1.5 0 007 8.5 1.5 1.5 0 008.5 7 1.5 1.5 0 007 5.5 1.5 1.5 0 005.5 7" />\n </g>\n</svg>\n',kotlin:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#ca9ee6" d="M2.5 13.5h11L8 8" />\n <path stroke="#ef9f76" d="M8.03 2.5h5.47l-8 8" />\n <path stroke="#e78284" d="M2.5 13.5V8" />\n <path stroke="#85c1dc" d="M8 2.5H2.5V8l3-2.5" />\n </g>\n</svg>\n',c:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round" d="m 4.0559072,12.951629 c 2.7459832,2.734744 7.1981158,2.734744 9.9441188,0 l -1.789955,-1.782586 c -1.75742,1.750224 -4.6067879,1.750224 -6.3642294,0 -1.7574416,-1.7502236 -1.7574416,-4.587893 0,-6.338097 1.7574415,-1.750224 4.6068094,-1.750224 6.3642294,0 l 0.894977,-0.8912929 0.894978,-0.891293 c -2.746003,-2.73472867 -7.1981359,-2.73472867 -9.944119,0 -2.7459858,2.7347089 -2.7459858,7.1685599 2e-7,9.9032689 z" clip-rule="evenodd" />\n</svg>\n',cpp:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round" d="m 2.5559121,12.951629 c 2.7459832,2.734744 7.1981158,2.734744 9.9441189,0 l -1.789955,-1.782586 c -1.7574201,1.750224 -4.606788,1.750224 -6.3642295,0 -1.7574416,-1.7502236 -1.7574416,-4.587893 0,-6.338097 1.7574415,-1.750224 4.6068094,-1.750224 6.3642295,0 l 0.894977,-0.8912929 0.894978,-0.891293 c -2.7460031,-2.73472867 -7.198136,-2.73472867 -9.9441191,0 -2.74598585,2.7347089 -2.74598585,7.1685599 2e-7,9.9032689 z" clip-rule="evenodd" />\n <path fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round" d="M7.5 6v4M5.513524 7.9999996H9.51304M13.486476 5.9999996v4M11.5 7.9999992h3.999516" />\n</svg>\n',cs:ho,csharp:ho,php:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round" d="M0.5,12.5 L0.5,13.24 C0.5,14 1.27360724,14.5 2,14.5 C2.9375516,14.5 3.5,14 3.5,13.2445661 L3.5,6.00089968 C3.5,4.28551107 4.99401107,2.52263547 7.14960413,2.5 C9.49387886,2.5 11,4.0579782 11,5.5 C11.1657296,8.48962302 9.57820404,9.63684469 7.49621582,10.5 L7.49621582,14.5 L15.4979764,14.5 L15.4979764,9 C15.5394484,8.36478228 14.9387379,7.15595371 14.1308258,6.5 C13.1942239,5.80827275 12.0584852,5.50253264 11,5.5 M11.5,14.5 L11.5,11.5 M6,6.5 C6.27614237,6.5 6.5,6.27614237 6.5,6 C6.5,5.72385763 6.27614237,5.5 6,5.5 C5.72385763,5.5 5.5,5.72385763 5.5,6 C5.5,6.27614237 5.72385763,6.5 6,6.5 Z" />\n</svg>\n',shell:vo,powershell:vo,sql:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round" d="M8 6.5c3.59 0 6.5-1.4 6.5-2.68S11.59 1.5 8 1.5 1.5 2.54 1.5 3.82 4.41 6.5 8 6.5M14.5 8c0 .83-1.24 1.79-3.25 2.2s-4.49.41-6.5 0S1.5 8.83 1.5 8m13 4.18c0 .83-1.24 1.6-3.25 2-2.01.42-4.49.42-6.5 0-2.01-.4-3.25-1.17-3.25-2m0-8.3v8.3m13-8.3v8.3" />\n</svg>\n',yaml:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e78284" stroke-linecap="round" stroke-linejoin="round" d="M2.5 1.5h3l3 4 3-4h3l-9 13h-3L7 8z" />\n</svg>\n',markdown:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#85c1dc" stroke-linecap="round" stroke-linejoin="round" d="m9.25 8.25 2.25 2.25 2.25-2.25M3.5 11V5.5l2.04 3 1.96-3V11m4-.5V5M1.65 2.5h12.7c.59 0 1.15.49 1.15 1v9c0 .51-.56 1-1.15 1H1.65c-.59 0-1.15-.49-1.15-1V3.58c0-.5.56-1.08 1.15-1.08" />\n</svg>\n',xml:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ef9f76" stroke-linecap="round" stroke-linejoin="round" d="M4.5 4.5 1 8 4.5 11.5M11.5 4.5 15 8 11.5 11.5M9.5 2 6.5 14" />\n</svg>\n',rust:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#ef9f76" stroke-linecap="round" stroke-linejoin="round">\n <path d="M15.5 9.5Q8 13.505.5 9.5l1-1-1-2 2-.5V4.5h2l.5-2 1.5 1 1.5-2 1.5 2 1.5-1 .5 2h2V6l2 .5-1 2z" />\n <path d="M6.5 7.5a1 1 0 01-1 1 1 1 0 01-1-1 1 1 0 011-1 1 1 0 011 1m5 0a1 1 0 01-1 1 1 1 0 01-1-1 1 1 0 011-1 1 1 0 011 1M4 11.02c-.67.37-1.5.98-1.5 2.23s1.22 1.22 2 1.25v-2M12 11c.67.37 1.5 1 1.5 2.25s-1.22 1.22-2 1.25v-2" />\n </g>\n</svg>\n',vue:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#a6d189" stroke-linecap="round" stroke-linejoin="round">\n <path d="M1 1.5h5.44L8 4.56 9.56 1.5H15l-6.99 13z" />\n <path d="M12.05 1.73 8 9.28 3.95 1.73" />\n </g>\n</svg>\n',mermaid:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round" d="M1.5 2.5c0 6 2.25 5.75 4 7 .83.67 1.17 2 1 4h3c-.17-2 .17-3.33 1-4 1.75-1.25 4-1 4-7C12 2.5 10 3 8 7 6 3 4 2.5 1.5 2.5" />\n</svg>\n'},bo={"":"",javascript:"javascript",js:"javascript",mjs:"javascript",cjs:"javascript",typescript:"typescript",ts:"typescript",jsx:"jsx",tsx:"tsx",golang:"go",py:"python",rb:"ruby",sh:"shell",bash:"shell",zsh:"shell",shellscript:"shell",bat:"shell",batch:"shell",ps1:"powershell",plaintext:"plain",text:"plain","c++":"cpp","c#":"csharp","objective-c":"objectivec","objective-c++":"objectivecpp",yml:"yaml",md:"markdown",rs:"rust",kt:"kotlin"};function Mo(){return u(this,null,function*(){return yo||(wo||(wo=import("./languageIconExtended.js").then(e=>(yo=e.EXTENDED_LANGUAGE_ICON_MAP,ko.value++,yo)).catch(()=>null)),wo)})}function _o(e){go=null!=e?e:null}function To(e){var n;const t=function(e){if(!e)return"";const n=e.trim();if(!n)return"";const[t]=n.split(/\s+/),[o]=t.split(":");return o.toLowerCase()}(e);return null!=(n=bo[t])?n:t}function Co(e){const n=To(e);if(!n)return"plaintext";switch(n){case"plain":return"plaintext";case"jsx":return"javascript";case"tsx":return"typescript";default:return n}}function Bo(){return u(this,null,function*(){yield Mo()})}function Io(e){if(go){const n=go(e);if(null!=n&&""!==n)return n}const n=To(e),t=xo[n];if(t)return t;return(null==yo?void 0:yo[n])||(Mo(),'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16">\x3c!-- Icon from Lucide by Lucide Contributors - https://github.com/lucide-icons/lucide/blob/main/LICENSE --\x3e<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m10 9l-3 3l3 3m4 0l3-3l-3-3"/><rect width="18" height="18" x="3" y="3" rx="2"/></g></svg>')}const So={js:"JavaScript",javascript:"JavaScript",ts:"TypeScript",jsx:"JSX",tsx:"TSX",html:"HTML",css:"CSS",scss:"SCSS",json:"JSON",py:"Python",python:"Python",rb:"Ruby",go:"Go",java:"Java",c:"C",cpp:"C++",cs:"C#",php:"PHP",sh:"Shell",bash:"Bash",sql:"SQL",yaml:"YAML",md:"Markdown",d2:"D2",d2lang:"D2","":"Plain Text",plain:"Plain Text"},$o=new class{constructor(){d(this,"metrics",[]),d(this,"enabled",!1),d(this,"maxMetrics",1e3)}enable(){this.enabled=!0}disable(){this.enabled=!1}recordRender(e){this.enabled&&(this.metrics.push(e),this.metrics.length>this.maxMetrics&&this.metrics.shift())}getStats(){if(0===this.metrics.length)return{totalRenders:0,cacheHitRate:0,averageWorkerTime:0,averageDirectTime:0,averageCacheHitTime:0,workerSavings:0,recommendation:"Insufficient data"};const e=this.metrics.filter(e=>"worker"===e.type&&e.success),n=this.metrics.filter(e=>"direct"===e.type&&e.success),t=this.metrics.filter(e=>"cache-hit"===e.type),o=this.metrics.length,r=t.length,l=r/o*100,i=e.length>0?e.reduce((e,n)=>e+n.duration,0)/e.length:0,a=n.length>0?n.reduce((e,n)=>e+n.duration,0)/n.length:0,s=t.length>0?t.reduce((e,n)=>e+n.duration,0)/t.length:0,d=o*a-(e.reduce((e,n)=>e+n.duration,0)+n.reduce((e,n)=>e+n.duration,0)+t.reduce((e,n)=>e+n.duration,0));let u="";return u=l>70&&i<2*a?"✅ Worker + Cache is highly beneficial":l>50?"✅ Worker + Cache is beneficial":i>3*a?"⚠️ Worker overhead too high, consider direct rendering":a<5?"⚠️ Formulas too simple, Worker overhead may not be worth it":"✅ Worker prevents main thread blocking",{totalRenders:o,cacheHits:r,cacheHitRate:l.toFixed(1),workerCalls:e.length,directCalls:n.length,averageWorkerTime:i.toFixed(2),averageDirectTime:a.toFixed(2),averageCacheHitTime:s.toFixed(3),workerSavings:d.toFixed(2),recommendation:u}}printReport(){const e=this.getStats();return console.group("📊 KaTeX Rendering Performance Report"),e.totalRenders,e.cacheHits,e.cacheHitRate,e.workerCalls,e.directCalls,e.averageWorkerTime,e.averageDirectTime,e.averageCacheHitTime,e.workerSavings,e.recommendation,console.groupEnd(),e}reset(){this.metrics=[]}exportMetrics(){return{metrics:[...this.metrics],stats:this.getStats(),timestamp:Date.now()}}};function Eo(){$o.enable()}function Lo(){$o.disable()}function No(){return $o.printReport()}function jo(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch(n){}return globalThis.setTimeout(e,0)}function Ho(e){try{if(null==e)return;if("undefined"!=typeof globalThis&&"function"==typeof globalThis.cancelAnimationFrame)return void globalThis.cancelAnimationFrame(e)}catch(n){}try{globalThis.clearTimeout(e)}catch(n){}}"undefined"!=typeof window&&(window.__katexPerfReport=No,window.__katexPerfMonitor=$o);const Po={key:0,class:"code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:{color:"var(--vscode-editor-foreground)","background-color":"var(--vscode-editor-background)"}},Do={class:"flex items-center gap-x-2"},Ro=["innerHTML"],Ko={class:"text-sm font-medium font-mono"},Oo={class:"flex items-center gap-x-2"},Wo=["aria-pressed"],Ao=["disabled"],zo=["disabled"],Fo=["disabled"],Vo=["aria-label"],Uo={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},Xo={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},qo=["aria-pressed"],Go={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24"},Yo={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24"},Zo=["aria-label"],Jo=["innerHTML"],Qo={class:"code-loading-placeholder"},er=/* @__PURE__ */oe(/* @__PURE__ */h({__name:"MarkdownCodeBlockNode",props:{node:{},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},darkTheme:{default:"vitesse-dark"},lightTheme:{default:"vitesse-light"},isDark:{type:Boolean,default:!1},isShowPreview:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},minWidth:{default:void 0},maxWidth:{default:void 0},themes:{},showHeader:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},showPreviewButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},showTooltips:{type:Boolean}},emits:["previewCode","copy"],setup(e,{emit:n}){const t=e,o=n,{t:r}=pn(),l=S(To(t.node.language)),i=S(!1),a=S(!1),s=S(!1),d=S(null),c=S(null),m=S(""),p=S(!1);let h;const g=S(!0),x=S(0),M=S(14),_=S(M.value),B=T(()=>{const e=M.value,n=_.value;return"number"==typeof e&&Number.isFinite(e)&&e>0&&"number"==typeof n&&Number.isFinite(n)&&n>0}),I=T(()=>{const e=l.value.trim().toLowerCase();return So[e]||e.charAt(0).toUpperCase()+e.slice(1)}),j=T(()=>(ko.value,Io(l.value.trim().toLowerCase().split(":")[0]))),H=T(()=>{const e=l.value.trim().toLowerCase();return t.isShowPreview&&("html"===e||"svg"===e)}),P=T(()=>{const e={},n=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},o=n(t.minWidth),r=n(t.maxWidth);return o&&(e.minWidth=o),r&&(e.maxWidth=r),e}),D=T(()=>({fontSize:`${_.value}px`})),W=T(()=>!1!==t.showTooltips);function A(){return t.isDark?t.darkTheme:t.lightTheme}function F(e){if(null==h||h.disconnect(),h=void 0,!e)return m.value="",void(p.value=!1);var n;m.value=`<pre class="shiki shiki-fallback"><code>${n=e,n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}</code></pre>`,p.value=!1}function V(){m.value="",p.value=!0}function U(){var e;const n=c.value;return!!n&&(n.childNodes.length>0||Boolean(null==(e=n.textContent)?void 0:e.trim().length))}function X(){return u(this,null,function*(){if(yield L(),U())return void V();const e=c.value;e&&(null==h||h.disconnect(),h=new MutationObserver(()=>{U()&&(V(),null==h||h.disconnect(),h=void 0)}),h.observe(e,{childList:!0,subtree:!0}))})}let q,G,Z,J;const Q=/* @__PURE__ */new Set,ee=/* @__PURE__ */new Set,ne=void 0!==import.meta&&Boolean(!1);function te(e,n){return u(this,null,function*(){if(!q)return;const t=function(e,n=!1){var t;const[o]=String(null!=e?e:"").split(":"),r=null!=(t=null==o?void 0:o.trim().toLowerCase())?t:"";return r?!J||J.has(r)?r:(n&&ne&&!Q.has(r)&&(Q.add(r),console.warn(`[MarkdownCodeBlockNode] Language "${r}" not preloaded in stream-markdown; falling back to plaintext.`)),"plaintext"):"plaintext"}(n,Boolean(e&&e.length));try{yield q.updateCode(e,t)}catch(o){"plaintext"!==t?(ne&&!ee.has(t)&&(ee.add(t),console.warn(`[MarkdownCodeBlockNode] Failed to render language "${t}", retrying as plaintext.`,o)),yield q.updateCode(e,"plaintext")):ne&&console.warn("[MarkdownCodeBlockNode] Failed to render code block even as plaintext.",o)}})}function oe(){return u(this,null,function*(){yield function(){return u(this,null,function*(){if(!G)try{const e=yield import("stream-markdown");G=e.createShikiStreamRenderer,Z=e.registerHighlight;const n=Array.isArray(e.defaultLanguages)?e.defaultLanguages:void 0;J=n?new Set(n.map(e=>e.toLowerCase())):void 0,null==Z||Z({themes:t.themes})}catch(e){console.warn("[MarkdownCodeBlockNode] stream-markdown not available:",e)}})}(),d.value&&c.value?(null==Z||Z({themes:t.themes}),!q&&G&&(q=G(c.value,{theme:A()}),p.value=!0),q?!1===t.stream&&t.loading?F(t.node.code):(F(t.node.code),yield te(t.node.code,l.value),yield X()):F(t.node.code)):F(t.node.code)})}function re(){const e=d.value;if(!e||a.value)return;const n=e.scrollTop;n<x.value?g.value=!1:function(e,n=50){return e.scrollHeight-e.scrollTop-e.clientHeight<=n}(e)&&(g.value=!0),x.value=n}function le(){return u(this,null,function*(){try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(t.node.code)),i.value=!0,o("copy",t.node.code),setTimeout(()=>{i.value=!1},1e3)}catch(e){console.error("Copy failed:",e)}})}function ie(e){const n=e.currentTarget||e.target;return!n||n.disabled?null:n}function ae(e,n,o="top"){if(!W.value)return;const r=ie(e);if(!r)return;const l=e;dn(r,n,o,!1,null!=(null==l?void 0:l.clientX)&&null!=(null==l?void 0:l.clientY)?{x:l.clientX,y:l.clientY}:void 0,t.isDark)}function se(){W.value&&un()}function de(e){if(!W.value)return;const n=ie(e);if(!n)return;const o=e;dn(n,i.value?r("common.copied")||"Copied":r("common.copy")||"Copy","top",!1,null!=(null==o?void 0:o.clientX)&&null!=(null==o?void 0:o.clientY)?{x:o.clientX,y:o.clientY}:void 0,t.isDark)}function ue(){s.value=!s.value}function ce(){if(!H.value)return;const e=(l.value||t.node.language).toLowerCase(),n="html"===e?"HTML Preview":"SVG Preview";o("previewCode",{type:"html"===e?"text/html":"image/svg+xml",content:t.node.code,title:n})}return oe(),Y(()=>{oe()}),N(()=>{null==h||h.disconnect(),h=void 0}),$(()=>t.themes,()=>u(null,null,function*(){Z&&Z({themes:t.themes})})),$(()=>t.loading,e=>{e||oe()}),$(W,e=>{e||un()}),$(()=>[t.node.code,t.node.language],e=>u(null,[e],function*([e,n]){const o=To(n);o!==l.value&&(l.value=o),d.value&&c.value?(q||(F(e),yield oe()),q&&e&&(!1===t.stream&&t.loading||(F(e),yield te(e,n),yield X()))):F(e)})),$(()=>[t.darkTheme,t.lightTheme],()=>u(null,null,function*(){d.value&&c.value&&(q||(yield oe()),null==q||q.setTheme(A()))})),$(()=>t.node.code,()=>u(null,null,function*(){if(a.value||!g.value)return;yield L();const e=d.value;e&&e.scrollHeight>e.clientHeight&&(e.scrollTop=e.scrollHeight)})),(n,o)=>(v(),f("div",{style:K(P.value),class:C(["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",[t.isDark?"border-gray-700/30 bg-gray-900":"border-gray-200 bg-white",t.isDark?"is-dark":""]])},[t.showHeader?(v(),f("div",Po,[z(n.$slots,"header-left",{},()=>[w("div",Do,[w("span",{class:"icon-slot h-4 w-4 flex-shrink-0",innerHTML:j.value},null,8,Ro),w("span",Ko,b(I.value),1)])],!0),z(n.$slots,"header-right",{},()=>[w("div",Oo,[t.showCollapseButton?(v(),f("button",{key:0,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":s.value,onClick:ue,onMouseenter:o[0]||(o[0]=e=>ae(e,s.value?y(r)("common.expand")||"Expand":y(r)("common.collapse")||"Collapse")),onFocus:o[1]||(o[1]=e=>ae(e,s.value?y(r)("common.expand")||"Expand":y(r)("common.collapse")||"Collapse")),onMouseleave:se,onBlur:se},[(v(),f("svg",{style:K({rotate:s.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[...o[18]||(o[18]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,Wo)):E("",!0),t.showFontSizeButtons&&t.enableFontSizeControl?(v(),f(k,{key:1},[w("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!!Number.isFinite(_.value)&&_.value<=10,onClick:o[2]||(o[2]=e=>function(){const e=Math.max(10,_.value-1);_.value=e}()),onMouseenter:o[3]||(o[3]=e=>ae(e,y(r)("common.decrease")||"Decrease")),onFocus:o[4]||(o[4]=e=>ae(e,y(r)("common.decrease")||"Decrease")),onMouseleave:se,onBlur:se},[...o[19]||(o[19]=[w("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14"})],-1)])],40,Ao),w("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!B.value||_.value===M.value,onClick:o[5]||(o[5]=e=>{_.value=M.value}),onMouseenter:o[6]||(o[6]=e=>ae(e,y(r)("common.reset")||"Reset")),onFocus:o[7]||(o[7]=e=>ae(e,y(r)("common.reset")||"Reset")),onMouseleave:se,onBlur:se},[...o[20]||(o[20]=[w("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),w("path",{d:"M3 3v5h5"})])],-1)])],40,zo),w("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!!Number.isFinite(_.value)&&_.value>=36,onClick:o[8]||(o[8]=e=>function(){const e=Math.min(36,_.value+1);_.value=e}()),onMouseenter:o[9]||(o[9]=e=>ae(e,y(r)("common.increase")||"Increase")),onFocus:o[10]||(o[10]=e=>ae(e,y(r)("common.increase")||"Increase")),onMouseleave:se,onBlur:se},[...o[21]||(o[21]=[w("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1)])],40,Fo)],64)):E("",!0),t.showCopyButton?(v(),f("button",{key:2,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":i.value?y(r)("common.copied")||"Copied":y(r)("common.copy")||"Copy",onClick:le,onMouseenter:o[11]||(o[11]=e=>de(e)),onFocus:o[12]||(o[12]=e=>de(e)),onMouseleave:se,onBlur:se},[i.value?(v(),f("svg",Xo,[...o[23]||(o[23]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(v(),f("svg",Uo,[...o[22]||(o[22]=[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),w("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],40,Vo)):E("",!0),t.showExpandButton?(v(),f("button",{key:3,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":a.value,onClick:o[13]||(o[13]=e=>function(e){if(a.value=!a.value,e&&W.value){const n=ie(e);n&&dn(n,a.value?r("common.collapse")||"Collapse":r("common.expand")||"Expand","top",!1,void 0,t.isDark)}const n=d.value;n&&(a.value?(n.style.maxHeight="none",n.style["overflow-y"]="visible",n.style["overflow-x"]="auto"):(n.style.maxHeight="500px",n.style.overflow="auto",g.value=!0,L(()=>{n.scrollHeight>n.clientHeight&&(n.scrollTop=n.scrollHeight)})))}(e)),onMouseenter:o[14]||(o[14]=e=>ae(e,a.value?y(r)("common.collapse")||"Collapse":y(r)("common.expand")||"Expand")),onFocus:o[15]||(o[15]=e=>ae(e,a.value?y(r)("common.collapse")||"Collapse":y(r)("common.expand")||"Expand")),onMouseleave:se,onBlur:se},[a.value?(v(),f("svg",Go,[...o[24]||(o[24]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"},null,-1)])])):(v(),f("svg",Yo,[...o[25]||(o[25]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"},null,-1)])]))],40,qo)):E("",!0),H.value&&t.showPreviewButton?(v(),f("button",{key:4,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":y(r)("common.preview")||"Preview",onClick:ce,onMouseenter:o[16]||(o[16]=e=>ae(e,y(r)("common.preview")||"Preview")),onFocus:o[17]||(o[17]=e=>ae(e,y(r)("common.preview")||"Preview")),onMouseleave:se,onBlur:se},[...o[26]||(o[26]=[w("svg",{"data-v-3d59cc65":"",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),w("circle",{cx:"12",cy:"12",r:"3"})])],-1)])],40,Zo)):E("",!0)])],!0)])):E("",!0),R(w("div",{ref_key:"codeBlockContent",ref:d,class:"code-block-content",style:K(D.value),onScroll:re},[w("div",{ref_key:"rendererTarget",ref:c,class:"code-block-render"},null,512),p.value?E("",!0):(v(),f("div",{key:0,class:"code-fallback-plain",innerHTML:m.value},null,8,Jo))],36),[[O,!(s.value||!e.stream&&e.loading)]]),R(w("div",Qo,[z(n.$slots,"loading",{loading:e.loading,stream:e.stream},()=>[o[27]||(o[27]=w("div",{class:"loading-skeleton"},[w("div",{class:"skeleton-line"}),w("div",{class:"skeleton-line"}),w("div",{class:"skeleton-line short"})],-1))],!0)],512),[[O,!e.stream&&e.loading]])],6))}}),[["__scopeId","data-v-af5307e3"]]);er.install=e=>{e.component(er.__name,er)};const nr=()=>import("mermaid");let tr=null,or=nr;function rr(e){or=e,tr=null}function lr(e){rr(null!=e?e:nr)}function ir(){rr(null)}function ar(){return"function"==typeof or}function sr(e){if(!e)return e;const n=e&&e.default?e.default:e;if(n&&("function"==typeof n.render||"function"==typeof n.parse||"function"==typeof n.initialize))return n;if(n&&n.mermaidAPI&&("function"==typeof n.mermaidAPI.render||"function"==typeof n.mermaidAPI.parse)){const e=n.mermaidAPI;return s(a({},n),{render:e.render.bind(e),parse:e.parse?e.parse.bind(e):void 0,initialize:t=>"function"==typeof n.initialize?n.initialize(t):e.initialize?e.initialize(t):void 0})}return e.mermaid&&"function"==typeof e.mermaid.render?e.mermaid:n}function dr(e){if(e)try{const n=null==e?void 0:e.initialize;e.initialize=t=>{const o=a({suppressErrorRendering:!0},t||{});return"function"==typeof n?n.call(e,o):(null==e?void 0:e.mermaidAPI)&&"function"==typeof e.mermaidAPI.initialize?e.mermaidAPI.initialize(o):void 0}}catch(n){}}function ur(){return u(this,null,function*(){if(tr)return tr;const e=function(){try{const e=globalThis;return sr(null==e?void 0:e.mermaid)}catch(e){return null}}();if(e)return tr=e,dr(tr),tr;const n=or;if(!n)return null;let t;try{t=yield n()}catch(o){if(n===nr)throw new Error('Optional dependency "mermaid" is not installed. Please install it to enable mermaid diagrams.');throw o}return t?(tr=sr(t),dr(tr),tr):null})}function cr(e){return JSON.stringify(e)}function mr(e){var n;const t=null!=(n=e.mode)?n:"classic",o=e.katexUrl,r=e.mhchemUrl,l=cr(a({throwOnError:!0,displayMode:!0,output:"html",strict:"ignore"},e.renderOptions||{})),i=cr(o),s=r?cr(r):'""';return"module"===t?`\nlet DEBUG = false\nlet katex = null\nlet katexLoadError = null\nlet loadPromise = null\n\nfunction normalizeKaTeX(mod) {\n const resolved = (mod && mod.default) ? mod.default : mod\n if (resolved && typeof resolved.renderToString === 'function')\n return resolved\n return null\n}\n\nasync function loadKaTeX() {\n if (katex || katexLoadError)\n return\n if (!loadPromise) {\n loadPromise = (async () => {\n try {\n const mod = await import(${i})\n katex = normalizeKaTeX(mod) || null\n const mhchemUrl = ${s}\n if (mhchemUrl) {\n try {\n await import(mhchemUrl)\n }\n catch (e) {\n // ignore optional mhchem load failures\n if (DEBUG)\n console.warn('[katex-cdn-worker] failed to load mhchem', e)\n }\n }\n }\n catch (e) {\n katexLoadError = e\n }\n })()\n }\n await loadPromise\n}\n\nglobalThis.addEventListener('message', async (ev) => {\n const data = ev.data || {}\n if (data.type === 'init') {\n DEBUG = !!data.debug\n if (DEBUG)\n console.debug('[katex-cdn-worker] debug enabled')\n return\n }\n const id = data.id ?? ''\n const content = data.content ?? ''\n const displayMode = data.displayMode ?? true\n\n await loadKaTeX()\n\n if (!katex) {\n const reason = katexLoadError ? String(katexLoadError?.message || katexLoadError) : 'KaTeX is not available in worker'\n globalThis.postMessage({ id, error: reason, content, displayMode })\n return\n }\n\n try {\n const opts = ${l}\n const html = katex.renderToString(content, { ...opts, displayMode: !!displayMode })\n globalThis.postMessage({ id, html, content, displayMode })\n }\n catch (err) {\n const msg = String(err?.message || err)\n globalThis.postMessage({ id, error: msg, content, displayMode })\n }\n})\n`.trimStart():`\nlet DEBUG = false\nlet katex = null\nlet katexLoadError = null\n\nfunction normalizeKaTeX(val) {\n const resolved = (val && val.default) ? val.default : val\n if (resolved && typeof resolved.renderToString === 'function')\n return resolved\n return null\n}\n\nfunction loadKaTeXClassic() {\n if (katex || katexLoadError)\n return\n try {\n importScripts(${i})\n const mhchemUrl = ${s}\n if (mhchemUrl) {\n try {\n importScripts(mhchemUrl)\n }\n catch (e) {\n // ignore optional mhchem load failures\n if (DEBUG)\n console.warn('[katex-cdn-worker] failed to load mhchem', e)\n }\n }\n katex = normalizeKaTeX(globalThis.katex)\n }\n catch (e) {\n katexLoadError = e\n }\n}\n\nloadKaTeXClassic()\n\nglobalThis.addEventListener('message', (ev) => {\n const data = ev.data || {}\n if (data.type === 'init') {\n DEBUG = !!data.debug\n if (DEBUG)\n console.debug('[katex-cdn-worker] debug enabled')\n return\n }\n const id = data.id ?? ''\n const content = data.content ?? ''\n const displayMode = data.displayMode ?? true\n\n if (!katex && !katexLoadError)\n loadKaTeXClassic()\n\n if (!katex) {\n const reason = katexLoadError ? String(katexLoadError?.message || katexLoadError) : 'KaTeX is not available in worker'\n globalThis.postMessage({ id, error: reason, content, displayMode })\n return\n }\n\n try {\n const opts = ${l}\n const html = katex.renderToString(content, { ...opts, displayMode: !!displayMode })\n globalThis.postMessage({ id, html, content, displayMode })\n }\n catch (err) {\n const msg = String(err?.message || err)\n globalThis.postMessage({ id, error: msg, content, displayMode })\n }\n})\n`.trimStart()}function pr(e){var n,t;const o=mr(e);if("undefined"==typeof Worker||"undefined"==typeof URL||"undefined"==typeof Blob)return{worker:null,dispose:()=>{},source:o};const r=new Blob([o],{type:"text/javascript"}),l=URL.createObjectURL(r);let i=!1;const d="module"===(null!=(n=e.mode)?n:"classic")?s(a({},null!=(t=e.workerOptions)?t:{}),{type:"module"}):e.workerOptions,u=new Worker(l,d);if(e.debug)try{u.postMessage({type:"init",debug:!0})}catch(c){}return{worker:u,dispose:()=>{if(!i){i=!0;try{URL.revokeObjectURL(l)}catch(c){}}},source:o}}Ge.install=e=>{e.component(Ge.__name,Ge)};let hr=null,vr=null,fr=!1;const gr=/* @__PURE__ */new Map,yr=/* @__PURE__ */new Map;let wr=5;const kr=/* @__PURE__ */new Set;function xr(){if(gr.size<wr&&kr.size){const n=Array.from(kr);kr.clear();for(const t of n)try{t()}catch(e){}}}function br(e){hr=e,vr=null,hr.onmessage=e=>{const{id:n,html:t,error:o}=e.data,r=gr.get(n);if(r)if(gr.delete(n),clearTimeout(r.timeoutId),xr(),o)r.reject(new Error(o));else{const{content:n,displayMode:o}=e.data;if(n){const e=`${o?"d":"i"}:${n}`;if(yr.set(e,t),yr.size>200){const e=yr.keys().next().value;yr.delete(e)}}r.resolve(t)}},hr.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[n,t]of gr.entries())clearTimeout(t.timeoutId),t.reject(new Error(`Worker error: ${e.message}`));gr.clear(),xr()}}function Mr(){var e;hr&&(null==(e=hr.terminate)||e.call(hr)),hr=null,vr=null}function _r(e){fr=!!e,hr&&hr.postMessage({type:"init",debug:fr})}function Tr(e,n=!0,t=2e3,o){return u(this,null,function*(){if(performance.now(),!jn()){const e=new Error("KaTeX rendering disabled");return e.name="KaTeXDisabled",e.code="KATEX_DISABLED",Promise.reject(e)}if(vr)return Promise.reject(vr);const r=`${n?"d":"i"}:${e}`,l=yr.get(r);if(l)return Promise.resolve(l);const i=hr||(vr=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),vr.name="WorkerInitError",vr.code="WORKER_INIT_ERROR",null);if(!i)return Promise.reject(vr);if(gr.size>=wr){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code="WORKER_BUSY",e.busy=!0,e.inFlight=gr.size,e.max=wr,Promise.reject(e)}return new Promise((r,l)=>{if(null==o?void 0:o.aborted){const e=new Error("Aborted");return e.name="AbortError",void l(e)}const a=Math.random().toString(36).slice(2),s=globalThis.setTimeout(()=>{gr.delete(a);const e=new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",l(e),xr()},t);o&&o.addEventListener("abort",()=>{globalThis.clearTimeout(s),gr.has(a)&&gr.delete(a);const e=new Error("Aborted");e.name="AbortError",l(e),xr()},{once:!0});const d=r,u=l;gr.set(a,{resolve:e=>{d(e)},reject:e=>{u(e)},timeoutId:s}),i.postMessage({id:a,content:e,displayMode:n})})})}function Cr(e,n=!0,t){const o=`${n?"d":"i"}:${e}`;if(yr.set(o,t),yr.size>200){const e=yr.keys().next().value;yr.delete(e)}}function Br(){return{inFlight:gr.size,max:wr}}function Ir(e){Number.isFinite(e)&&e>0&&(wr=Math.floor(e))}const Sr="WORKER_BUSY";function $r(){return gr.size>=wr}function Er(e=2e3,n){return gr.size<wr?Promise.resolve():new Promise((t,o)=>{let r,l=!1;const i=()=>{l||(l=!0,r&&globalThis.clearTimeout(r),kr.delete(i),t())};if(kr.add(i),r=globalThis.setTimeout(()=>{if(l)return;l=!0,kr.delete(i);const e=new Error("Wait for worker slot timed out");e.name="WorkerBusyTimeout",e.code="WORKER_BUSY_TIMEOUT",o(e)},e),queueMicrotask(()=>xr()),n){const e=()=>{if(l)return;l=!0,r&&globalThis.clearTimeout(r),kr.delete(i);const e=new Error("Aborted");e.name="AbortError",o(e)};n.aborted?e():n.addEventListener("abort",e,{once:!0})}})}const Lr={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function Nr(e){null!=e.timeout&&(Lr.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(Lr.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(Lr.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(Lr.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function jr(){return a({},Lr)}function Hr(e){return u(this,arguments,function*(e,n=!0,t={}){var o,r,l,i;if(!jn()){const e=new Error("KaTeX rendering disabled");throw e.name="KaTeXDisabled",e.code="KATEX_DISABLED",e}const a=null!=(o=t.timeout)?o:Lr.timeout,s=null!=(r=t.waitTimeout)?r:Lr.waitTimeout,d=null!=(l=t.backoffMs)?l:Lr.backoffMs,u=null!=(i=t.maxRetries)?i:Lr.maxRetries,c=Number.isFinite(u)?Math.max(0,Math.min(Math.floor(u),8)):Lr.maxRetries,m=t.signal;let p=0;for(;;){if(null==m?void 0:m.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}try{return yield Tr(e,n,a,m)}catch(h){if((null==h?void 0:h.code)!==Sr||p>=c)throw h;if(p++,yield Er(s,m).catch(()=>{}),null==m?void 0:m.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}d>0&&(yield new Promise(e=>globalThis.setTimeout(e,d*p)))}}})}function Pr(e){return JSON.stringify(e)}function Dr(e){var n;const t=null!=(n=e.mode)?n:"module",o=Pr(e.mermaidUrl),r=`\nlet DEBUG = false\nlet mermaid = null\nlet mermaidLoadError = null\n\nfunction normalizeMermaidModule(mod) {\n if (!mod)\n return mod\n const candidate = (mod && mod.default) ? mod.default : mod\n if (candidate && (typeof candidate.render === 'function' || typeof candidate.parse === 'function' || typeof candidate.initialize === 'function'))\n return candidate\n if (candidate && candidate.mermaidAPI && (typeof candidate.mermaidAPI.render === 'function' || typeof candidate.mermaidAPI.parse === 'function')) {\n const api = candidate.mermaidAPI\n return {\n ...candidate,\n render: api.render ? api.render.bind(api) : undefined,\n parse: api.parse ? api.parse.bind(api) : undefined,\n initialize: (opts) => {\n if (typeof candidate.initialize === 'function')\n return candidate.initialize(opts)\n return api.initialize ? api.initialize(opts) : undefined\n },\n }\n }\n if (mod && mod.mermaid && typeof mod.mermaid.parse === 'function')\n return mod.mermaid\n return candidate\n}\n\nfunction applyThemeTo(code, theme) {\n const themeValue = theme === 'dark' ? 'dark' : 'default'\n const themeConfig = \`%%{init: {"theme": "\${themeValue}"}}%%\\n\`\n const trimmed = (code || '').trimStart()\n if (trimmed.startsWith('%%{'))\n return code\n return themeConfig + code\n}\n\nfunction findHeaderIndex(lines) {\n const headerRe = /^(?:graph|flowchart|flowchart\\s+tb|flowchart\\s+lr|sequenceDiagram|gantt|classDiagram|stateDiagram(?:-v2)?|erDiagram|journey|pie|quadrantChart|timeline|xychart(?:-beta)?)\\b/\n for (let i = 0; i < lines.length; i++) {\n const l = (lines[i] || '').trim()\n if (!l)\n continue\n if (l.startsWith('%%'))\n continue\n if (headerRe.test(l))\n return i\n }\n return -1\n}\n\nasync function canParse(code, theme) {\n const themed = applyThemeTo(code, theme)\n const anyMermaid = mermaid\n if (anyMermaid && typeof anyMermaid.parse === 'function') {\n await anyMermaid.parse(themed)\n return true\n }\n throw new Error('mermaid.parse not available in worker')\n}\n\nasync function findLastRenderablePrefix(baseCode, theme) {\n const lines = String(baseCode || '').split('\\n')\n const headerIdx = findHeaderIndex(lines)\n if (headerIdx === -1)\n return null\n const head = lines.slice(0, headerIdx + 1)\n await canParse(head.join('\\n'), theme)\n\n let low = headerIdx + 1\n let high = lines.length\n let lastGood = headerIdx + 1\n let tries = 0\n const MAX_TRIES = 12\n\n while (low <= high && tries < MAX_TRIES) {\n const mid = Math.floor((low + high) / 2)\n const candidate = [...head, ...lines.slice(headerIdx + 1, mid)].join('\\n')\n tries++\n try {\n await canParse(candidate, theme)\n lastGood = mid\n low = mid + 1\n }\n catch {\n high = mid - 1\n }\n }\n\n return [...head, ...lines.slice(headerIdx + 1, lastGood)].join('\\n')\n}\n\nfunction initMermaidOnce() {\n if (!mermaid)\n return\n try {\n if (typeof mermaid.initialize === 'function')\n mermaid.initialize(${Pr(a({startOnLoad:!1,securityLevel:"loose"},e.initializeOptions||{}))})\n }\n catch (e) {\n if (DEBUG)\n console.warn('[mermaid-cdn-worker] initialize failed', e)\n }\n}\n\nglobalThis.addEventListener('message', async (ev) => {\n const msg = ev.data || {}\n if (msg.type === 'init') {\n DEBUG = !!msg.debug\n if (DEBUG)\n console.debug('[mermaid-cdn-worker] debug enabled')\n return\n }\n\n const id = msg.id\n const action = msg.action\n const payload = msg.payload || {}\n\n if (!mermaid) {\n const errMsg = mermaidLoadError ? String(mermaidLoadError?.message || mermaidLoadError) : 'Mermaid is not available in worker'\n globalThis.postMessage({ id, ok: false, error: errMsg })\n return\n }\n\n try {\n if (action === 'canParse') {\n const ok = await canParse(payload.code, payload.theme)\n globalThis.postMessage({ id, ok: true, result: ok })\n return\n }\n if (action === 'findPrefix') {\n const res = await findLastRenderablePrefix(payload.code, payload.theme)\n globalThis.postMessage({ id, ok: true, result: res })\n return\n }\n globalThis.postMessage({ id, ok: false, error: 'Unknown action' })\n }\n catch (e) {\n globalThis.postMessage({ id, ok: false, error: String(e?.message || e) })\n }\n})\n`.trimStart();return"module"===t?`\n${r}\n\nlet loadPromise = null\nasync function loadMermaid() {\n if (mermaid || mermaidLoadError)\n return\n if (!loadPromise) {\n loadPromise = (async () => {\n try {\n const mod = await import(${o})\n mermaid = normalizeMermaidModule(mod) || null\n initMermaidOnce()\n }\n catch (e) {\n mermaidLoadError = e\n }\n })()\n }\n await loadPromise\n}\n\n// Load immediately; failures are reported per-request\nawait loadMermaid()\n`.trimStart():`\n${r}\n\nfunction loadMermaidClassic() {\n if (mermaid || mermaidLoadError)\n return\n try {\n importScripts(${o})\n mermaid = normalizeMermaidModule(globalThis.mermaid) || null\n initMermaidOnce()\n }\n catch (e) {\n mermaidLoadError = e\n }\n}\n\nloadMermaidClassic()\n`.trimStart()}function Rr(e){var n,t;const o=Dr(e);if("undefined"==typeof Worker||"undefined"==typeof URL||"undefined"==typeof Blob)return{worker:null,dispose:()=>{},source:o};const r=new Blob([o],{type:"text/javascript"}),l=URL.createObjectURL(r);let i=!1;const d="module"===(null!=(n=e.mode)?n:"module")?s(a({},null!=(t=e.workerOptions)?t:{}),{type:"module"}):e.workerOptions,u=new Worker(l,d);if(e.debug)try{u.postMessage({type:"init",debug:!0})}catch(c){}return{worker:u,dispose:()=>{if(!i){i=!0;try{URL.revokeObjectURL(l)}catch(c){}}},source:o}}let Kr=null,Or=null;const Wr=/* @__PURE__ */new Map;let Ar=5,zr=!1;function Fr(e){zr=!!e}function Vr(e){Number.isFinite(e)&&e>0&&(Ar=Math.floor(e))}function Ur(){return{inFlight:Wr.size,max:Ar}}const Xr="WORKER_BUSY",qr="MERMAID_DISABLED";function Gr(e){Kr=e,Or=null;const n=e;Kr.onmessage=e=>{if(Kr!==n)return;const{id:t,ok:o,result:r,error:l}=e.data,i=Wr.get(t);i&&(!1===o||l?i.reject(new Error(l||"Unknown error")):i.resolve(r))},Kr.onerror=e=>{var t,o;if(Kr===n)if(0!==Wr.size){try{zr?console.error("[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e):null==(o=console.debug)||o.call(console,"[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e)}catch(r){}for(const[n,t]of Wr.entries())t.reject(new Error(`Worker error: ${e.message}`));Wr.clear()}else null==(t=console.debug)||t.call(console,"[mermaidWorkerClient] Worker error (no pending):",(null==e?void 0:e.message)||e)},Kr.onmessageerror=e=>{var t,o;if(Kr===n)if(0!==Wr.size){try{zr?console.error("[mermaidWorkerClient] Worker messageerror:",e):null==(o=console.debug)||o.call(console,"[mermaidWorkerClient] Worker messageerror:",e)}catch(r){}for(const[e,n]of Wr.entries())n.reject(new Error("Worker messageerror"));Wr.clear()}else null==(t=console.debug)||t.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function Yr(){var e;if(Kr)try{for(const[e,n]of Wr.entries())n.reject(new Error("Worker cleared"));Wr.clear(),null==(e=Kr.terminate)||e.call(Kr)}catch(n){}Kr=null,Or=null}function Zr(e,n,t=1400){if(!ar()){const e=new Error("Mermaid rendering disabled");return e.name="MermaidDisabled",e.code=qr,Promise.reject(e)}if(Or)return Promise.reject(Or);const o=Kr||(Or=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),Or.name="WorkerInitError",Or.code="WORKER_INIT_ERROR",null);if(!o)return Promise.reject(Or);if(Wr.size>=Ar){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=Xr,e.inFlight=Wr.size,e.max=Ar,Promise.reject(e)}return new Promise((r,l)=>{const i=Math.random().toString(36).slice(2);let a,s=!1;const d=()=>{s||(s=!0,null!=a&&globalThis.clearTimeout(a),Wr.delete(i))},u={resolve:e=>{d(),r(e)},reject:e=>{d(),l(e)}};Wr.set(i,u);try{o.postMessage({id:i,action:e,payload:n})}catch(c){return Wr.delete(i),void l(c)}a=globalThis.setTimeout(()=>{const e=new Error("Worker call timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT";const n=Wr.get(i);n&&n.reject(e)},t)})}function Jr(e,n,t=1400){return u(this,null,function*(){try{return yield Zr("canParse",{code:e,theme:n},t)}catch(o){return Promise.reject(o)}})}function Qr(e,n,t=1400){return u(this,null,function*(){try{return yield Zr("findPrefix",{code:e,theme:n},t)}catch(o){return Promise.reject(o)}})}function el(){if(Kr)try{for(const[e,n]of Wr.entries())n.reject(new Error("Worker terminated"));Wr.clear(),Kr.terminate()}finally{Kr=null}}const nl=V(()=>import("./index4.js")),tl=V(()=>import("./index3.js")),ol=V(()=>import("./index2.js")),rl=V(()=>import("./index5.js")),ll=V(()=>import("./index6.js")),il=V(()=>import("./index7.js")),al={AdmonitionNode:Yt,BlockquoteNode:re,CheckboxNode:ae,CodeBlockNode:nl,DefinitionListNode:ce,EmojiNode:pe,EmphasisNode:ut,FootnoteNode:vt,FootnoteReferenceNode:_e,FootnoteAnchorNode:mt,HardBreakNode:gt,HeadingNode:wt,HtmlBlockNode:Tt,HtmlInlineNode:ze,HighlightNode:st,ImageNode:_n,D2BlockNode:il,InfographicBlockNode:ll,InlineCodeNode:Ue,PreCodeNode:St,InsertNode:it,LinkNode:rt,ListItemNode:kt,ListNode:xt,MathBlockNode:tl,MathInlineNode:ol,MermaidBlockNode:rl,ParagraphNode:Ct,StrikethroughNode:Qn,StrongNode:Zn,SubscriptNode:Gn,SuperscriptNode:Un,TableNode:Ht,TextNode:On,ThematicBreakNode:Dt,VmrContainerNode:Ot,ReferenceNode:zn,MarkdownCodeBlockNode:er},sl={install(e,n){Object.entries(al).forEach(([n,t])=>{e.component(n,t)}),(null==n?void 0:n.getLanguageIcon)&&_o(n.getLanguageIcon),(null==n?void 0:n.mathOptions)&&p(n.mathOptions)}};export{rl as $,Yt as A,re as B,ae as C,il as D,pe as E,mt as F,_e as G,gt as H,wt as I,st as J,Tt as K,ze as L,_n as M,ll as N,Ue as O,it as P,rt as Q,kt as R,xt as S,qr as T,Xr as U,er as V,Sr as W,zt as X,tl as Y,ol as Z,oe as _,fn as a,Ct as a0,zn as a1,Qn as a2,Zn as a3,Gn as a4,Un as a5,Ht as a6,On as a7,Dt as a8,Ge as a9,jn as aA,ar as aB,$o as aC,Bo as aD,po as aE,uo as aF,ke as aG,Tr as aH,ye as aI,eo as aJ,mn as aK,Nr as aL,br as aM,_r as aN,Ir as aO,En as aP,_o as aQ,rr as aR,Gr as aS,Fr as aT,Vr as aU,Er as aV,Ot as aa,sl as ab,mr as ac,Dr as ad,xe as ae,Mr as af,Yr as ag,pr as ah,Rr as ai,mo as aj,to as ak,Nn as al,ir as am,Lo as an,no as ao,Ln as ap,lr as aq,Eo as ar,co as as,we as at,jr as au,Br as av,Ur as aw,No as ax,oo as ay,$r as az,ko as b,Io as c,St as d,dn as e,Ho as f,so as g,un as h,Hn as i,Hr as j,Pn as k,So as l,Cr as m,To as n,ur as o,Jr as p,Qr as q,Co as r,jo as s,el as t,pn as u,ro as v,nl as w,ce as x,ut as y,vt as z};