markstream-vue 0.0.8 → 0.0.9-beta.0

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.
package/dist/exports.js CHANGED
@@ -1 +1 @@
1
- var e=Object.defineProperty,n=Object.defineProperties,t=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,r=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={}))l.call(n,t)&&i(e,t,n[t]);if(o)for(var t of o(n))r.call(n,t)&&i(e,t,n[t]);return e},s=(e,o)=>n(e,t(o)),d=(e,n,t)=>new Promise((o,l)=>{var r=e=>{try{a(t.next(e))}catch(n){l(n)}},i=e=>{try{a(t.throw(e))}catch(n){l(n)}},a=e=>e.done?o(e.value):Promise.resolve(e.value).then(r,i);a((t=t.apply(e,n)).next())});import{getMarkdown as u,parseMarkdownToStructure as c,setDefaultMathOptions as m}from"stream-markdown-parser";import{defineComponent as p,openBlock as h,createElementBlock as v,withMemo as f,createVNode as g,unref as y,createElementVNode as w,Fragment as k,renderList as x,toDisplayString as b,shallowRef as _,h as M,computed as C,ref as T,watch as B,onMounted as I,onBeforeUnmount as $,normalizeClass as E,createApp as L,inject as j,provide as S,Transition as N,withCtx as H,normalizeStyle as D,renderSlot as P,createCommentVNode as O,readonly as K,defineAsyncComponent as z,createBlock as A,resolveDynamicComponent as R,useAttrs as W,mergeProps as V,isMemoSame as F,markRaw as U,reactive as X,nextTick as q,withDirectives as G,vShow as Y,Teleport as Z}from"vue";import{autoUpdate as J,offset as Q,flip as ee,shift as ne,computePosition as te}from"@floating-ui/dom";const oe=["cite"],le=(e,n)=>{const t=e.__vccOpts||e;for(const[o,l]of n)t[o]=l;return t},re=/* @__PURE__ */le(/* @__PURE__ */p({__name:"BlockquoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(h(),v("blockquote",{class:"blockquote",dir:"auto",cite:e.node.cite},[f([n.node.children],()=>g(y(Kt),{"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,oe))}}),[["__scopeId","data-v-eeadc8a3"]]);re.install=e=>{e.component(re.__name,re)};const ie={class:"checkbox-node"},ae=["checked"],se=/* @__PURE__ */le(/* @__PURE__ */p({__name:"CheckboxNode",props:{node:{}},setup:e=>(n,t)=>(h(),v("span",ie,[w("input",{type:"checkbox",checked:e.node.checked,disabled:"",class:"checkbox-input"},null,8,ae)]))}),[["__scopeId","data-v-8dc6c46f"]]);se.install=e=>{e.component(se.__name,se)};const de={class:"definition-list"},ue={class:"definition-term"},ce={class:"definition-desc"},me=/* @__PURE__ */le(/* @__PURE__ */p({__name:"DefinitionListNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(e,t)=>(h(),v("dl",de,[(h(!0),v(k,null,x(n.node.items,(o,l)=>(h(),v(k,{key:l},[w("dt",ue,[g(y(Kt),{"index-key":`definition-term-${n.indexKey}-${l}`,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",ce,[g(y(Kt),{"index-key":`definition-desc-${n.indexKey}-${l}`,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"]]);me.install=e=>{e.component(me.__name,me)};const pe={class:"emoji-node"},he=/* @__PURE__ */le(/* @__PURE__ */p({__name:"EmojiNode",props:{node:{}},setup:e=>(n,t)=>(h(),v("span",pe,b(e.node.name),1))}),[["__scopeId","data-v-de55dc97"]]);he.install=e=>{e.component(he.__name,he)};const ve="__global__",fe="__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__",ge=(()=>{const e=globalThis;if(e[fe])return e[fe];const n={scopedCustomComponents:{},revision:_(0)};return e[fe]=n,n})(),ye=ge.revision;function we(e,n){"string"==typeof e?ge.scopedCustomComponents[e]=n||{}:ge.scopedCustomComponents[ve]=e||{},ye.value++}function ke(e){const n=ge.scopedCustomComponents[ve]||{};if(!e)return n;const t=ge.scopedCustomComponents[e]||{};return n&&0!==Object.keys(n).length?t&&0!==Object.keys(t).length?a(a({},n),t):n:t}function xe(e){if(e===ve)throw new Error("removeCustomComponents: use clearGlobalCustomComponents() to clear the global mapping");delete ge.scopedCustomComponents[e],ye.value++}function be(){delete ge.scopedCustomComponents[ve],ye.value++}const _e=["id"],Me=["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,l)=>(h(),v("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,_e))}}),[["__scopeId","data-v-01af0fee"]]);Ce.install=e=>{e.component(Ce.__name,Ce)};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"]),Be=/* @__PURE__ */new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Ie=/* @__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"]),je=(()=>{try{return Boolean(!1)}catch(e){}return!1})();function Se(e){je&&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 He(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function De(e,n){const t=e.toLowerCase();return!Ie.has(t)&&(He(n,t)||He(n,e))}function Pe(e){const n={};for(const[t,o]of Object.entries(e)){const e=t.toLowerCase();Te.has(e)||Le.has(e)&&o&&Ne(o)||(n[t]=o)}return n}function Oe(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 Ke(e){return e.trim().length>0}function ze(e,n,t,o,l){if(Ee.has(e.toLowerCase()))return null;const r=Pe(n),i=r.key,d=null!=i&&""!==i?i:l;if(De(e,o)){const n=o[e]||o[e.toLowerCase()],l=function(e){const n={};for(const[t,o]of Object.entries(e))n[t]=Oe(o,t);return n}(r);return M(n,s(a({},l),{key:d}),t.length>0?t:void 0)}return M(e,s(a({},r),{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 Re(e,n){if(!e)return[];try{const t=function(e,n){let t=0;const o=[],l=[];for(const r of e)if("text"===r.type)(o.length>0?o[o.length-1].children:l).push(r.content);else if("self_closing"===r.type){const e=ze(r.tagName,r.attrs||{},[],n,"ms-html-"+t++),i=o.length>0?o[o.length-1].children:l;null!=e&&i.push(e)}else if("tag_open"===r.type)o.push({tagName:r.tagName,children:[],attrs:r.attrs,autoKey:"ms-html-"+t++});else if("tag_close"===r.type){const e=r.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 r=o.pop(),i=ze(r.tagName,r.attrs||{},r.children,n,r.autoKey);o.length>0?null!=i&&o[o.length-1].children.push(i):null!=i&&l.push(i),r.tagName.toLowerCase()!==e&&o.length>t&&Se(`Auto-closing unclosed tag: <${r.tagName}>`)}else Se(`Ignoring closing tag with no matching opening tag: </${r.tagName}>`)}for(;o.length>0;){const e=o.pop(),t=ze(e.tagName,e.attrs||{},e.children,n,e.autoKey);o.length>0?null!=t&&o[o.length-1].children.push(t):null!=t&&l.push(t),Se(`Auto-closing unclosed tag: <${e.tagName}>`)}return l}(function(e){var n,t,o;const l=[];let r=0;for(;r<e.length;){if(e.startsWith("\x3c!--",r)){const n=e.indexOf("--\x3e",r);if(-1!==n){r=n+3;continue}break}const i=e.indexOf("<",r);if(-1===i){if(r<e.length){const n=e.slice(r);Ke(n)&&l.push({type:"text",content:n})}break}if(i>r){const n=e.slice(r,i);Ke(n)&&l.push({type:"text",content:n})}if(e.startsWith("![CDATA[",i+1)){const n=e.indexOf("]]>",i);if(-1!==n){l.push({type:"text",content:e.slice(i,n+3)}),r=n+3;continue}break}if(e.startsWith("!",i+1)){const n=e.indexOf(">",i);if(-1!==n){r=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();l.push({type:"tag_close",tagName:e})}else{const e=s.indexOf(" ");let r,i="";-1===e?r=u?s.slice(0,-1).trim():s.trim():(r=s.slice(0,e).trim(),i=s.slice(e+1));const a={};if(i){const e=/([^\s=]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S*)))?/g;let l;for(;null!==(l=e.exec(i));){const e=l[1],r=null!=(o=null!=(t=null!=(n=l[2])?n:l[3])?t:l[4])?o:"";e&&!e.endsWith("/")&&(a[e]=r)}}l.push({type:u||Be.has(r.toLowerCase())?"self_closing":"tag_open",tagName:r,attrs:a})}r=a+1}return l}(e),n);return t}catch(o){return t=o,je&&console.error("Failed to parse HTML to VNodes:",t),null}var t}const We=/* @__PURE__ */le(/* @__PURE__ */p({__name:"HtmlInlineNode",props:{node:{},customId:{}},setup(e){const n=e,t=C(()=>(ye.value,ke(n.customId))),o=p({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),l=C(()=>{const e=n.node.content;if(!e)return{mode:"html",content:""};if(n.node.loading&&n.node.autoClosed){const n=Re(e,t.value);if(null!==n)return{mode:"dynamic",nodes:n}}if(!Ae(e,t.value))return{mode:"html",content:e};const o=Re(e,t.value);return null===o?{mode:"html",content:e}:{mode:"dynamic",nodes:o}}),r=T(null),i="undefined"!=typeof window,a=T({mode:"",content:"",el:null});let s=null;function d(e,n){if(!i||!r.value)return;const t=r.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 B(()=>[n.node.content,n.node.loading,n.node.autoClosed,l.value.mode],()=>{"html"===l.value.mode&&(n.node.loading&&!n.node.autoClosed?c():u())}),I(()=>{"html"===l.value.mode&&(n.node.loading&&!n.node.autoClosed?c():u())}),$(()=>{r.value&&(r.value.innerHTML="",a.value={mode:"",content:"",el:null})}),(e,t)=>"dynamic"===l.value.mode?(h(),v("span",{key:0,class:E(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},[g(y(o),{nodes:l.value.nodes},null,8,["nodes"])],2)):(h(),v("span",{key:1,ref_key:"containerRef",ref:r,class:E(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},null,2))}}),[["__scopeId","data-v-4add5e85"]]);We.install=e=>{e.component(We.__name,We)};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-['']"},Fe=/* @__PURE__ */p({__name:"InlineCodeNode",props:{node:{}},setup:e=>(n,t)=>(h(),v("code",Ve,b(e.node.code),1))});Fe.install=e=>{e.component(Fe.__name,Fe)};const Ue=T(!1),Xe=T(""),qe=T("top"),Ge=T(null),Ye=T(null),Ze=T(null),Je=T(null),Qe=T(null);let en=null,nn=null;function tn(){en&&(clearTimeout(en),en=null),nn&&(clearTimeout(nn),nn=null)}let on=!1,ln=null;function rn(e,n,t="top",o=!1,l,r){if(!e)return;on||"undefined"!=typeof document&&(ln||(ln=Promise.resolve().then(()=>el).then(({default:e})=>{on=!0;const n=document.createElement("div");n.setAttribute("data-singleton-tooltip","1"),document.body.appendChild(n),L({setup:()=>()=>{var n;return M(e,{visible:Ue.value,"anchor-el":Ge.value,content:Xe.value,placement:qe.value,id:Ye.value,originX:Ze.value,originY:Je.value,isDark:null!=(n=Qe.value)?n:void 0})}}).mount(n)}).catch(e=>{ln=null,on=!1,console.warn("[markstream-vue] Failed to load Tooltip component. Tooltips will be disabled.",e)}))),tn();const i=()=>{var o,i;Ye.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,Ge.value=e,Xe.value=n,qe.value=t,Ze.value=null!=(o=null==l?void 0:l.x)?o:null,Je.value=null!=(i=null==l?void 0:l.y)?i:null,Qe.value="boolean"==typeof r?r:null,Ue.value=!0;try{e.setAttribute("aria-describedby",Ye.value)}catch(a){}};o?i():en=setTimeout(i,80)}function an(e=!1){tn();const n=()=>{if(Ge.value&&Ye.value)try{Ge.value.removeAttribute("aria-describedby")}catch(e){}Ue.value=!1,Ge.value=null,Ye.value=null,Ze.value=null,Je.value=null};e?n():nn=setTimeout(n,120)}const sn={"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 dn(e){Object.assign(sn,e)}function un(){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 d(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=sn[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 cn=/* @__PURE__ */Symbol("ViewportPriority");function mn(){const e=j(cn,void 0);if(e)return e;const n=/* @__PURE__ */new WeakMap;let t=null;return e=>{const o=T(!1);let l,r=!1;const i=new Promise(e=>{l=()=>{r||(r=!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 l of e){const e=n.get(l.target);if(e&&(l.isIntersecting||l.intersectionRatio>0)){if(!e.visible.value){e.visible.value=!0;try{e.resolve()}catch(o){}}null==t||t.unobserve(l.target),n.delete(l.target)}}},{root:null,rootMargin:"300px",threshold:0}),t));return s?(n.set(e,{resolve:l,visible:o}),s.observe(e),{isVisible:o,whenVisible:i,destroy:a}):(o.value=!0,l(),{isVisible:o,whenVisible:i,destroy:a})}}const pn={class:"relative inline-block"},hn=["src","alt","title","loading","tabindex","aria-label"],vn={class:"text-sm whitespace-nowrap"},fn={key:1,class:"text-sm text-gray-500"},gn={key:"error",class:"px-4 py-2 bg-gray-100 flex items-center justify-center rounded-lg gap-2 text-red-500"},yn={class:"text-sm whitespace-nowrap"},wn={key:0,class:"mt-2 text-sm text-gray-500 italic"},kn=/* @__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,l=T(!1),r=T(!1),i=T(!1),a=T(null),s=mn(),d=T(null),u=T("undefined"==typeof window);"undefined"!=typeof window&&B(()=>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(()=>r.value&&t.fallbackSrc?t.fallbackSrc:t.node.src),m=C(()=>!t.lazy||u.value),p=C(()=>/\.svg(?:\?|$)/i.test(c.value));function f(){t.fallbackSrc&&!i.value?(i.value=!0,r.value=!0):(r.value=!0,o("error",t.node.src))}function k(){l.value=!0,r.value=!1,o("load",c.value)}function x(e){e.preventDefault(),l.value&&!r.value&&o("click",[e,c.value])}const{t:_}=un();return B(c,()=>{l.value=!1,r.value=!1}),(n,o)=>(h(),v("figure",{ref_key:"figureRef",ref:a,class:"text-center my-8"},[w("div",pn,[g(N,{name:"img-switch",mode:"out-in"},{default:H(()=>{var i,a,s,d,u;return[e.node.loading||r.value||!m.value?r.value?e.node.loading||t.fallbackSrc?O("",!0):(h(),v("div",gn,[P(n.$slots,"error",{node:t.node,displaySrc:c.value,imageLoaded:l.value,hasError:r.value,fallbackSrc:t.fallbackSrc,lazy:t.lazy,isSvg:p.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",yn,b(y(_)("image.loadError")),1)],!0)])):(h(),v("div",{key:"placeholder",class:"placeholder-layer max-w-96 inline-flex items-center justify-center gap-2",style:D(p.value?{minHeight:t.svgMinHeight,width:"100%"}:{minHeight:"6rem"})},[t.usePlaceholder?P(n.$slots,"placeholder",{key:0,node:t.node,displaySrc:c.value,imageLoaded:l.value,hasError:r.value,fallbackSrc:t.fallbackSrc,lazy:t.lazy,isSvg:p.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",vn,b(y(_)("image.loading")),1)],!0):(h(),v("span",fn,b(e.node.raw),1))],4)):(h(),v("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":!l.value,"opacity-100":l.value,"cursor-pointer":l.value}]),style:D(p.value?{minHeight:t.svgMinHeight,width:"100%",height:"auto",objectFit:"contain"}:void 0),loading:t.lazy?"lazy":"eager",decoding:"async",tabindex:l.value?0:-1,"aria-label":null!=(u=t.node.alt)?u:y(_)("image.preview"),onError:f,onLoad:k,onClick:x},null,46,hn))]}),_:3})]),t.showCaption&&t.node.alt?(h(),v("figcaption",wn,b(t.node.alt),1)):O("",!0)],512))}}),[["__scopeId","data-v-7ca79b66"]]);kn.install=e=>{e.component(kn.__name,kn)};let xn=null,bn=!1,_n=Tn;function Mn(e){var n;const t=null!=(n=null==e?void 0:e.default)?n:e;return t&&"function"==typeof t.renderToString?t:null}function Cn(){try{const e=globalThis;return Mn(null==e?void 0:e.katex)}catch(e){return null}}function Tn(){return d(null,null,function*(){const e=Cn();if(e)return e;const n=yield import("katex");try{yield import("katex/dist/contrib/mhchem")}catch(t){}return Mn(n)})}function Bn(e){_n=e,xn=null,bn=!1}function In(e){Bn(null!=e?e:Tn)}function $n(){Bn(null)}function En(){return"function"==typeof _n}function Ln(){return d(this,null,function*(){var e;const n=Cn();if(n)return xn=n,xn;if(xn)return xn;if(bn)return null;const t=_n;if(!t)return bn=!0,null;try{const n=yield t();if(n)return xn=null!=(e=Mn(n))?e:n,xn}catch(o){}return bn=!0,null})}const jn=_(!1);let Sn=null;function Nn(){return Sn||(Sn=Ln().then(e=>{jn.value=!!e}).catch(()=>{jn.value=!1})),K(jn)}const Hn=/* @__PURE__ */le(/* @__PURE__ */p({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const n=Nn();return(t,o)=>(h(),v("span",{class:E([[y(n)&&e.node.center?"text-node-center":""],"whitespace-pre-wrap break-words text-node"])},b(e.node.content),3))}}),[["__scopeId","data-v-56f30838"]]);Hn.install=e=>{e.component(Hn.__name,Hn)};const Dn=z(()=>d(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 M(Hn,s(a({},e),{node:s(a({},e.node),{content:null!=(t=e.node.raw)?t:`$${null!=(n=e.node.content)?n:""}$`})}))};try{if(yield Ln())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 M(Hn,s(a({},e),{node:s(a({},e.node),{content:null!=(t=e.node.raw)?t:`$${null!=(n=e.node.content)?n:""}$`})}))}})),Pn=z(()=>d(null,null,function*(){try{if(yield Ln())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 M(Hn,s(a({},e),{node:s(a({},e.node),{content:null!=(t=e.node.raw)?t:`$$${null!=(n=e.node.content)?n:""}$$`})}))}})),On=/* @__PURE__ */p({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(n,t)=>(h(),v("span",{class:"reference-node cursor-pointer bg-[hsl(var(--muted))] 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))});On.install=e=>{e.component(On.__name,On)};const Kn={class:"superscript-node"},zn={key:1},An=/* @__PURE__ */le(/* @__PURE__ */p({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=ke(n.customId),o=a({text:Hn,inline_code:Fe,link:et,html_inline:We,strong:Un,emphasis:it,footnote_reference:Ce,strikethrough:qn,highlight:lt,insert:tt,subscript:Vn,emoji:he,math_inline:Dn,reference:On},t);return(t,l)=>(h(),v("sup",Kn,[(h(!0),v(k,null,x(e.node.children,(t,l)=>(h(),v(k,{key:`${e.indexKey||"superscript"}-${l}`},[o[t.type]?(h(),A(R(o[t.type]),{key:0,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"superscript"}-${l}`},null,8,["node","custom-id","index-key"])):(h(),v("span",zn,b(t.content||t.raw),1))],64))),128))]))}}),[["__scopeId","data-v-6dc1e3ba"]]);An.install=e=>{e.component(An.__name,An)};const Rn={class:"subscript-node"},Wn={key:1},Vn=/* @__PURE__ */le(/* @__PURE__ */p({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=ke(n.customId),o=a({text:Hn,inline_code:Fe,link:et,html_inline:We,strong:Un,emphasis:it,footnote_reference:Ce,strikethrough:qn,highlight:lt,insert:tt,superscript:An,emoji:he,math_inline:Dn,reference:On},t);return(t,l)=>(h(),v("sub",Rn,[(h(!0),v(k,null,x(e.node.children,(t,l)=>(h(),v(k,{key:`${e.indexKey||"subscript"}-${l}`},[o[t.type]?(h(),A(R(o[t.type]),{key:0,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"subscript"}-${l}`},null,8,["node","custom-id","index-key"])):(h(),v("span",Wn,b(t.content||t.raw),1))],64))),128))]))}}),[["__scopeId","data-v-69de9b81"]]);Vn.install=e=>{e.component(Vn.__name,Vn)};const Fn={class:"strong-node"},Un=/* @__PURE__ */le(/* @__PURE__ */p({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=ke(n.customId),o=a({text:Hn,inline_code:Fe,link:et,html_inline:We,emphasis:it,strikethrough:qn,highlight:lt,insert:tt,subscript:Vn,superscript:An,emoji:he,footnote_reference:Ce,math_inline:Dn,reference:On},t);return(t,l)=>(h(),v("strong",Fn,[(h(!0),v(k,null,x(e.node.children,(t,l)=>(h(),A(R(o[t.type]),{key:`${e.indexKey||"strong"}-${l}`,"index-key":`${e.indexKey||"strong"}-${l}`,node:t,"custom-id":n.customId},null,8,["index-key","node","custom-id"]))),128))]))}}),[["__scopeId","data-v-af3ce037"]]);Un.install=e=>{e.component(Un.__name,Un)};const Xn={class:"strikethrough-node"},qn=/* @__PURE__ */le(/* @__PURE__ */p({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=ke(n.customId),o=a({text:Hn,inline_code:Fe,link:et,html_inline:We,strong:Un,emphasis:it,highlight:lt,insert:tt,subscript:Vn,superscript:An,emoji:he,footnote_reference:Ce,math_inline:Dn,reference:On},t);return(t,l)=>(h(),v("del",Xn,[(h(!0),v(k,null,x(e.node.children,(t,l)=>(h(),A(R(o[t.type]),{key:`${e.indexKey||"strikethrough"}-${l}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"strikethrough"}-${l}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-904d5bd1"]]);qn.install=e=>{e.component(qn.__name,qn)};const Gn=["href","title","aria-label","aria-hidden"],Yn=["aria-hidden"],Zn={class:"link-text-wrapper relative inline-flex"},Jn={class:"leading-[normal] link-text"},Qn={class:"leading-[normal] link-text"},et=/* @__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=j("markstreamShowTooltips",void 0),o=C(()=>{const e=null==t?void 0:t.value;return"boolean"==typeof e?e:n.showTooltip}),l=C(()=>{var e,t,o,l,r,i;const a=void 0!==n.underlineBottom?"number"==typeof n.underlineBottom?`${n.underlineBottom}px`:String(n.underlineBottom):"-3px";return{"--link-color":null!=(e=n.color)?e:"#0366d6","--underline-height":`${null!=(t=n.underlineHeight)?t:2}px`,"--underline-bottom":a,"--underline-opacity":String(null!=(o=n.animationOpacity)?o:.9),"--underline-duration":`${null!=(l=n.animationDuration)?l:.8}s`,"--underline-timing":null!=(r=n.animationTiming)?r:"linear","--underline-iteration":"number"==typeof n.animationIteration?String(n.animationIteration):null!=(i=n.animationIteration)?i:"infinite"}}),r={text:Hn,strong:Un,strikethrough:qn,emphasis:it,image:kn,html_inline:We,inline_code:Fe},i=C(()=>(ye.value,ke(n.customId))),s=W(),d=C(()=>{var e,t;const o=null==(e=n.node)?void 0:e.attrs;if(!o||"object"!=typeof o)return{};const l={};if(Array.isArray(o))for(const n of o)Array.isArray(n)&&n[0]&&(l[String(n[0])]=String(null!=(t=n[1])?t:""));else for(const[n,r]of Object.entries(o))n&&null!=r&&!1!==r&&(l[n]=!0===r?"":String(r));return Pe(l)}),u=C(()=>{const e=a(a({},s),d.value);return delete e.title,e});function c(){o.value&&an()}const m=C(()=>{var e,t,o;const l=null==(e=n.node)?void 0:e.title;return"string"==typeof l&&l.trim().length>0?l:String(null!=(o=null==(t=n.node)?void 0:t.href)?o:"")});return(t,a)=>e.node.loading?(h(),v("span",V({key:1,class:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":e.node.loading?"false":"true"},y(s),{style:l.value}),[w("span",Zn,[w("span",Jn,[w("span",Qn,b(e.node.text),1)]),a[1]||(a[1]=w("span",{class:"underline-anim","aria-hidden":"true"},null,-1))])],16,Yn)):(h(),v("a",V({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:l.value,onMouseenter:a[0]||(a[0]=e=>function(e){var t,l,r;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==(l=n.node)?void 0:l.href)||(null==(r=n.node)?void 0:r.text)||"";rn(e.currentTarget,s,"top",!1,a)}(e)),onMouseleave:c}),[(h(!0),v(k,null,x(e.node.children,(t,o)=>(h(),A(R(function(e){return i.value[e.type]||r[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,Gn))}}),[["__scopeId","data-v-c59222d4"]]);et.install=e=>{e.component(et.__name,et)};const nt={class:"insert-node"},tt=/* @__PURE__ */le(/* @__PURE__ */p({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=ke(n.customId),o=a({text:Hn,inline_code:Fe,link:et,html_inline:We,strong:Un,emphasis:it,strikethrough:qn,highlight:lt,subscript:Vn,superscript:An,emoji:he,footnote_reference:Ce,math_inline:Dn,reference:On},t);return(t,l)=>(h(),v("ins",nt,[(h(!0),v(k,null,x(e.node.children,(t,l)=>(h(),A(R(o[t.type]),{key:`${e.indexKey||"insert"}-${l}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"insert"}-${l}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-ab1ec9bc"]]);tt.install=e=>{e.component(tt.__name,tt)};const ot={class:"highlight-node"},lt=/* @__PURE__ */le(/* @__PURE__ */p({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=ke(n.customId),o=a({text:Hn,inline_code:Fe,link:et,html_inline:We,strong:Un,emphasis:it,strikethrough:qn,insert:tt,subscript:Vn,superscript:An,emoji:he,footnote_reference:Ce,math_inline:Dn,reference:On},t);return(t,l)=>(h(),v("mark",ot,[(h(!0),v(k,null,x(e.node.children,(t,l)=>(h(),A(R(o[t.type]),{key:`${e.indexKey||"highlight"}-${l}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"highlight"}-${l}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-38e31bf6"]]);lt.install=e=>{e.component(lt.__name,lt)};const rt={class:"emphasis-node"},it=/* @__PURE__ */le(/* @__PURE__ */p({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=ke(n.customId),o=a({text:Hn,inline_code:Fe,link:et,html_inline:We,strong:Un,strikethrough:qn,highlight:lt,insert:tt,subscript:Vn,superscript:An,emoji:he,footnote_reference:Ce,math_inline:Dn,reference:On},t);return(t,l)=>(h(),v("em",rt,[(h(!0),v(k,null,x(e.node.children,(t,l)=>(h(),A(R(o[t.type]),{key:`${e.indexKey||"emphasis"}-${l}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"emphasis"}-${l}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-8264674d"]]);it.install=e=>{e.component(it.__name,it)};const at=["href","title"],st=/* @__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:"")}`,l=document.getElementById(o);l&&l.scrollIntoView({behavior:"smooth"})}return(n,o)=>(h(),v("a",{class:"footnote-anchor text-sm text-[#0366d6] hover:underline cursor-pointer",href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:t}," ↩︎ ",8,at))}}),[["__scopeId","data-v-4756ce0d"]]);st.install=e=>{e.component(st.__name,st)};const dt=["id"],ut={class:"flex-1"},ct=/* @__PURE__ */p({__name:"FootnoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(h(),v("div",{id:`fnref--${e.node.id}`,class:"flex mt-2 mb-2 text-sm leading-relaxed border-t border-[#eaecef] pt-2"},[w("div",ut,[f([n.node.children],()=>g(y(Kt),{"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,dt))}});ct.install=e=>{e.component(ct.__name,ct)};const mt={class:"hard-break"},pt=/* @__PURE__ */le(/* @__PURE__ */p({__name:"HardBreakNode",props:{node:{}},setup:e=>(e,n)=>(h(),v("br",mt))}),[["__scopeId","data-v-50c58f70"]]);pt.install=e=>{e.component(pt.__name,pt)};const ht=/* @__PURE__ */le(/* @__PURE__ */p({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=ke(n.customId),o=a({text:Hn,inline_code:Fe,link:et,image:kn,strong:Un,emphasis:it,strikethrough:qn,highlight:lt,insert:tt,subscript:Vn,superscript:An,emoji:he,checkbox:se,checkbox_input:se,footnote_reference:Ce,hardbreak:pt,math_inline:Dn,reference:On},t);return(t,l)=>f([e.node.level,e.node.children,e.node.attrs],()=>(h(),A(R(`h${e.node.level}`),V({class:["heading-node",[`heading-${e.node.level}`]],dir:"auto"},e.node.attrs),{default:H(()=>[(h(!0),v(k,null,x(e.node.children,(t,l,r,i)=>{const a=[t];if(i&&i.key===`${e.indexKey||"heading"}-${l}`&&F(i,a))return i;const s=(h(),A(R(o[t.type]),{key:`${e.indexKey||"heading"}-${l}`,"custom-id":n.customId,node:t,"index-key":`${e.indexKey||"heading"}-${l}`},null,8,["custom-id","node","index-key"]));return s.memo=a,s},l,0),128))]),_:1},16,["class"])),l,2)}}),[["__scopeId","data-v-af2f957a"]]),vt=ht;vt.install=e=>{e.component(ht.__name,ht)};const ft=/* @__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,l)=>{var r;return h(),v("li",V({class:"list-item pl-1.5 my-2",dir:"auto"},o.value),[f([null==(r=t.value)?void 0:r.children],()=>{var o,r;return g(y(Kt),V({showTooltips:n.showTooltips},{"index-key":`list-item-${n.indexKey}`,nodes:null!=(r=null==(o=t.value)?void 0:o.children)?r:[],"custom-id":n.customId,typewriter:n.typewriter,"batch-rendering":!1,onCopy:l[0]||(l[0]=n=>e.$emit("copy",n))}),null,16,["index-key","nodes","custom-id","typewriter"])},l,1)],16)}}}),[["__scopeId","data-v-1410f3a8"]]);ft.install=e=>{e.component(ft.__name,ft)};const gt=/* @__PURE__ */le(/* @__PURE__ */p({__name:"ListNode",props:{node:{},customId:{},indexKey:{},typewriter:{type:Boolean},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=C(()=>(ye.value,ke(e.customId).list_item||ft));return(t,o)=>(h(),A(R(e.node.ordered?"ol":"ul"),{class:E(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:H(()=>[(h(!0),v(k,null,x(e.node.items,(l,r,i,a)=>{var s;const d=[l];if(a&&a.key===`${e.indexKey||"list"}-${r}`&&F(a,d))return a;const u=(h(),A(R(n.value),V({key:`${e.indexKey||"list"}-${r}`},{ref_for:!0},{showTooltips:e.showTooltips},{node:l,"custom-id":e.customId,"index-key":`${e.indexKey||"list"}-${r}`,typewriter:e.typewriter,value:e.node.ordered?(null!=(s=e.node.start)?s:1)+r: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"]]);gt.install=e=>{e.component(gt.__name,gt)};const yt={key:1,class:"html-block-node__raw"},wt={key:1,class:"html-block-node__placeholder"},kt=/* @__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(()=>(ye.value,ke(n.customId))),l=p({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),r=T(null),i=T("undefined"==typeof window),a=T(n.node.content),s=C(()=>{var e,t,l;if(!i.value)return{mode:"html",content:null!=(e=a.value)?e:""};const r=null!=(t=a.value)?t:n.node.content;if(!r)return{mode:"html",content:""};if(n.node.loading){const e=Re(r,o.value);return null===e?{mode:"text",content:null!=(l=n.node.raw)?l:r}:{mode:"dynamic",nodes:e}}if(!Ae(r,o.value))return{mode:"html",content:r};const s=Re(r,o.value);return null===s?{mode:"html",content:r}:{mode:"dynamic",nodes:s}}),d=mn(),u=T(null),c=!!n.node.loading;return"undefined"!=typeof window?(B(r,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 l=d(e,{rootMargin:"400px"});u.value=l,i.value=l.isVisible.value,l.whenVisible.then(()=>{i.value=!0})},{immediate:!0}),B(()=>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)=>(h(),v("div",V({ref_key:"htmlRef",ref:r,class:"html-block-node"},t.value),[i.value?(h(),v(k,{key:0},["dynamic"===s.value.mode?(h(),A(y(l),{key:0,nodes:s.value.nodes},null,8,["nodes"])):"text"===s.value.mode?(h(),v("pre",yt,b(s.value.content),1)):f([a.value],()=>(h(),v("div",{key:2,innerHTML:a.value},null,8,["innerHTML"])),o,0)],64)):(h(),v("div",wt,[P(n.$slots,"placeholder",{node:e.node},()=>[o[1]||(o[1]=w("span",{class:"html-block-node__placeholder-bar"},null,-1)),o[2]||(o[2]=w("span",{class:"html-block-node__placeholder-bar w-4/5"},null,-1)),o[3]||(o[3]=w("span",{class:"html-block-node__placeholder-bar w-2/3"},null,-1))],!0)]))],16))}}),[["__scopeId","data-v-6797fa3c"]]);kt.install=e=>{e.component(kt.__name,kt)};const xt={dir:"auto",class:"paragraph-node"},bt=/* @__PURE__ */le(/* @__PURE__ */p({__name:"ParagraphNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=ke(n.customId),o=a({inline_code:Fe,image:kn,link:et,hardbreak:pt,emphasis:it,strong:Un,strikethrough:qn,highlight:lt,insert:tt,subscript:Vn,superscript:An,html_inline:We,html_block:kt,emoji:he,checkbox:se,math_inline:Dn,checkbox_input:se,reference:On,footnote_anchor:st,footnote_reference:Ce},t),l=Nn();return(t,r)=>(h(),v("p",xt,[(h(!0),v(k,null,x(e.node.children,(t,r)=>(h(),v(k,{key:`${e.indexKey||"paragraph"}-${r}`},["text"!==t.type?(h(),A(R(o[t.type]),{key:0,node:t,"index-key":`${e.indexKey}-${r}`,"custom-id":n.customId},null,8,["node","index-key","custom-id"])):(h(),v("span",{key:1,class:E([[y(l)&&t.center?"text-node-center":""],"whitespace-pre-wrap break-words text-node"])},b(t.content),3))],64))),128))]))}}),[["__scopeId","data-v-4e2afdbc"]]);bt.install=e=>{e.component(bt.__name,bt)};const _t=["aria-busy","aria-label","data-language"],Mt=["textContent"],Ct=/* @__PURE__ */p({__name:"PreCodeNode",props:{node:{}},setup(e){const n=e,t=C(()=>{var e,t,o;const l=String(null!=(t=null==(e=n.node)?void 0:e.language)?t:"");return String(null!=(o=String(l).split(/\s+/g)[0])?o:"").toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}),o=C(()=>`language-${t.value}`),l=C(()=>{const e=t.value;return e?`Code block: ${e}`:"Code block"});return(n,r)=>(h(),v("pre",{class:E([o.value]),"aria-busy":!0===e.node.loading,"aria-label":l.value,"data-language":t.value,tabindex:"0"},[w("code",{translate:"no",textContent:b(e.node.code)},null,8,Mt)],10,_t))}});Ct.install=e=>{e.component(Ct.__name,Ct)};const Tt={class:"table-node-wrapper"},Bt=["aria-busy"],It={class:"border-[var(--table-border,#cbd5e1)]"},$t={class:"border-b"},Et={key:0,class:"table-node__loading",role:"status","aria-live":"polite"},Lt=/* @__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(l,r)=>(h(),v("div",Tt,[w("table",{class:E(["my-8 text-sm table-node",{"table-node--loading":t.value}]),"aria-busy":t.value},[w("thead",It,[w("tr",$t,[(h(!0),v(k,null,x(e.node.header.cells,(e,t)=>(h(),v("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"]])},[g(y(Kt),{nodes:e.children,"index-key":`table-th-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,onCopy:r[0]||(r[0]=e=>l.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter"])],2))),128))])]),w("tbody",null,[(h(!0),v(k,null,x(o.value,(e,t)=>(h(),v("tr",{key:`row-${t}`,class:E(["border-[var(--table-border,#cbd5e1)]",[t<o.value.length-1?"border-b":""]])},[(h(!0),v(k,null,x(e.cells,(e,o)=>(h(),v("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"},[g(y(Kt),{nodes:e.children,"index-key":`table-td-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,onCopy:r[1]||(r[1]=e=>l.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter"])],2))),128))],2))),128))])],10,Bt),g(N,{name:"table-node-fade"},{default:H(()=>[t.value?(h(),v("div",Et,[P(l.$slots,"loading",{isLoading:t.value},()=>[r[2]||(r[2]=w("span",{class:"table-node__spinner animate-spin","aria-hidden":"true"},null,-1)),r[3]||(r[3]=w("span",{class:"sr-only"},"Loading",-1))],!0)])):O("",!0)]),_:3})]))}}),[["__scopeId","data-v-369096fa"]]);Lt.install=e=>{e.component(Lt.__name,Lt)};const jt={class:"hr-node"},St=/* @__PURE__ */le({},[["render",function(e,n){return h(),v("hr",jt)}],["__scopeId","data-v-639cbad9"]]);St.install=e=>{e.component(St.__name,St)};const Nt={class:"unknown-node"},Ht=/* @__PURE__ */p({__name:"FallbackComponent",props:{node:{}},setup:e=>(n,t)=>(h(),v("div",Nt,b(e.node.raw),1))}),Dt=/* @__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=ke(n.customId),l=a({text:Hn,paragraph:bt,heading:vt,inline_code:Fe,link:et,image:kn,strong:Un,emphasis:it,strikethrough:qn,insert:tt,subscript:Vn,superscript:An,checkbox:se,checkbox_input:se,hardbreak:pt,math_inline:Dn,reference:On,list:gt,math_block:Pn,table:Lt},o);return(o,r)=>(h(),v("div",V({class:t.value},e.node.attrs),[(h(!0),v(k,null,x(e.node.children,(t,o,r,i)=>{const a=[t];if(i&&i.key===`${e.indexKey||"vmr-container"}-${o}`&&F(i,a))return i;const s=(h(),A(R((d=t.type,l[d]||Ht)),{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},r,0),128))],16))}}),[["__scopeId","data-v-fac7405d"]]);Dt.install=e=>{e.component(Dt.__name,Dt)};const Pt=["data-custom-id"],Ot=["data-node-index","data-node-type"],Kt=/* @__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:{},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,l;const r=e,i=n,m=T(),p=T(!1),f=/auto|scroll|overlay/i,g="undefined"!=typeof window,y=C(()=>r.debugPerformance&&g&&"undefined"!=typeof console),w=W(),b=C(()=>{var e;if("boolean"==typeof r.showTooltips)return r.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 M(e){if("undefined"==typeof window)return null;const n=null!=e?e:m.value;if(!n)return null;const t=n.ownerDocument||document,o=t.scrollingElement||t.documentElement;let l=n;for(;l&&l!==t.body&&l!==o;){const e=window.getComputedStyle(l),n=(e.overflowY||"").toLowerCase(),t=(e.overflow||"").toLowerCase();if(f.test(n)||f.test(t))return l;l=l.parentElement}return null}S("markstreamShowTooltips",b);const I=r.customId?`renderer-${r.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,L=u(I),j=/* @__PURE__ */new Map,P=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=F(o);e&&!n.has(e)&&(n.add(e),t.push(e))}return 0===t.length?{key:"",tags:[]}:{key:t.join(","),tags:t}}(r.customHtmlTags);if(!e)return L;const t=j.get(e);if(t)return t;const o=u(I,{customHtmlTags:n});return j.set(e,o),o}),K=C(()=>{const e=P.value;return r.customMarkdownIt?r.customMarkdownIt(e):e});function F(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 G=C(()=>{var e,n,t,o;const l=null!=(e=r.parseOptions)?e:{},i=null!=(n=r.final)?n:l.final,s=[...null!=(t=r.customHtmlTags)?t:[],...null!=(o=l.customHtmlTags)?o:[]].map(F).filter(Boolean),d=null!=i,u=s.length>0;return d||u?a(a(a({},l),d?{final:i}:{}),u?{customHtmlTags:Array.from(new Set(s))}:{}):l}),Y=C(()=>{var e;if(null==(e=r.nodes)?void 0:e.length)return U(r.nodes.slice());if(r.content){const e=y.value?performance.now():0,n=c(r.content,K.value,G.value);return y.value&&_("parse(sync)",{ms:Math.round(performance.now()-e),nodes:n.length,contentLength:r.content.length}),U(n)}return[]}),Z=C(()=>{var e;return Math.max(1,null!=(e=r.maxLiveNodes)?e:320)}),J=C(()=>{var e;return!((null!=(e=r.maxLiveNodes)?e:0)<=0)&&Y.value.length>Z.value}),Q=C(()=>!1!==r.viewportPriority&&!p.value),ee=function(e,n){const t="undefined"!=typeof window&&"undefined"!=typeof document,o="boolean"==typeof n?T(n):n;let l=null,r=null;const i=/* @__PURE__ */new WeakMap,s=(n,s)=>{const d=T(!1);let u,c=!1;const m=new Promise(e=>{u=()=>{c||(c=!0,e())}}),p=()=>{try{null==l||l.unobserve(n)}catch(e){}i.delete(n)};if(!t||!o.value)return d.value=!0,u(),{isVisible:d,whenVisible:m,destroy:p};!r&&s&&(r=a({},s));const h=function(n){var o,a,s;if(l||!t)return l;if("undefined"==typeof IntersectionObserver)return null;const d=null!=(o=null==e?void 0:e(null!=n?n:null))?o:null,u=r||{};return l=new IntersectionObserver(e=>{for(const t of e){const e=i.get(t.target);if(e&&(t.isIntersecting||t.intersectionRatio>0)){if(!e.visible.value){e.visible.value=!0;try{e.resolve()}catch(n){}}null==l||l.unobserve(t.target),i.delete(t.target)}}},{root:d,rootMargin:null!=(a=u.rootMargin)?a:"300px",threshold:null!=(s=u.threshold)?s:0}),l}(n);return h?(i.set(n,{resolve:u,visible:d}),h.observe(n),{isVisible:d,whenVisible:m,destroy:p}):(d.value=!0,u(),{isVisible:d,whenVisible:m,destroy:p})};return S(cn,s),s}(e=>{var n;return M(null!=(n=null!=e?e:m.value)?n:null)},Q),ne=g&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame.bind(window):null,te=g&&"function"==typeof window.cancelAnimationFrame?window.cancelAnimationFrame.bind(window):null,oe="undefined"!=typeof globalThis&&void 0!==globalThis.process&&"test"===(null==(o=null==(t=globalThis.process)?void 0:t.env)?void 0:o.NODE_ENV),le=g&&"function"==typeof window.requestIdleCallback,ie=C(()=>{var e;const n=Math.trunc(null!=(e=r.renderBatchSize)?e:80);return Number.isFinite(n)?Math.max(0,n):0}),ae=C(()=>{var e;const n=Math.trunc(null!=(e=r.initialRenderBatchSize)?e:ie.value);return Number.isFinite(n)?Math.max(0,n):ie.value}),de=C(()=>!1!==r.batchRendering&&ie.value>0&&g&&!oe),ue=T(0),ce=T({key:r.indexKey,total:0}),pe=T(Math.max(1,ie.value||1)),ve=X({}),fe=/* @__PURE__ */new Map,ge=/* @__PURE__ */new Map,we=/* @__PURE__ */new Map,xe=T(0),be=C(()=>(xe.value,Array.from(we.entries()).sort((e,n)=>e[0]-n[0]))),_e=T(0),Me=T([]),Te=T([]),Be=T(null);let Ie=null,$e=null;const Ee=C(()=>{var e;return!1!==r.deferNodesUntilVisible&&!((null!=(e=r.maxLiveNodes)?e:0)<=0)&&!J.value&&!(Y.value.length>900)&&Q.value}),Le=C(()=>{var e;return de.value&&(null!=(e=r.maxLiveNodes)?e:0)<=0}),je=T({batchSize:ie.value,initial:ae.value,delay:null!=(l=r.renderBatchDelay)?l:16,enabled:Le.value}),Se=C(()=>!!ee&&(Ee.value||J.value)),Ne=C(()=>{var e;return Math.max(0,null!=(e=r.liveNodeBuffer)?e:60)}),He=T(0),De=X({start:0,end:0}),Pe=/* @__PURE__ */new Map,Oe=C(()=>{if(!J.value)return Y.value.length;const e=Ne.value,n=Math.max(De.end+e,ae.value),t=Math.min(Y.value.length,n);return Math.max(ue.value,t)});function Ke(e){var n,t,o,l;const r=M(null!=(n=null!=e?e:m.value)?n:null);if(r)return r;const i=null!=(l=null!=(o=null==e?void 0:e.ownerDocument)?o:null==(t=m.value)?void 0:t.ownerDocument)?l:"undefined"!=typeof document?document:null;return(null==i?void 0:i.scrollingElement)||(null==i?void 0:i.documentElement)||null}function ze(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 Ae(){Ie&&(Ie(),Ie=null),Be.value=null}function Re(){if(!g||!J.value)return;const e=Ke();if(!e||Be.value===e)return;Ae();const n=()=>Ue();e.addEventListener("scroll",n,{passive:!0}),Be.value=e,Ie=()=>{e.removeEventListener("scroll",n)}}function Ve(){var e,n,t;if(!$e)return;const o=null!=(t=null==(n=null==(e=m.value)?void 0:e.ownerDocument)?void 0:n.defaultView)?t:"undefined"!=typeof window?window:null;$e.viaTimeout?o?o.clearTimeout($e.id):clearTimeout($e.id):null==te||te($e.id),$e=null}function Ue(e={}){var n,t,o;if(!J.value)return;if(!g)return void Xe(!0);if(e.immediate)return Ve(),void Xe(!0);if($e)return;const l=()=>{$e=null,Xe()};if(ne)$e={id:ne(l),viaTimeout:!1};else{const e=null!=(o=null==(t=null==(n=m.value)?void 0:n.ownerDocument)?void 0:t.defaultView)?o:"undefined"!=typeof window?window:null,r=e?e.setTimeout(l,16):setTimeout(l,16);$e={id:r,viaTimeout:!0}}}function Xe(e=!1){var n,t,o,l,r,i,a;if(!J.value)return;const s=Be.value||Ke();if(!s)return;const d=s.ownerDocument||(null==(n=m.value)?void 0:n.ownerDocument)||document,u=(null==d?void 0:d.defaultView)||("undefined"!=typeof window?window:null),c=s===(null==d?void 0:d.documentElement)||s===(null==d?void 0:d.body),p=Y.value.length;if(!c&&p>0&&ze(s)){const n=s.clientHeight||0,t=s.scrollTop,o=t<0?-t:t,l=function(e){var n;const t=Y.value;if(!t.length)return 0;if(e<=0)return Math.max(0,t.length-1);if(_e.value===t.length){const n=nn(0,t.length);return rn(Math.max(0,n-e))}let o=e;for(let l=t.length-1;l>=0;l--){const e=null!=(n=Ge[l])?n:en.value;if(o<=e)return l;o-=e}return 0}(Math.max(0,o)+.5*Math.max(0,n)),r=qe(l,0,Math.max(0,p-1));return void((e||Math.abs(r-He.value)>1)&&(He.value=r))}const h=c?null:s.getBoundingClientRect(),v=c?0:h.top,f=c?null!=(o=null!=(t=null==u?void 0:u.innerHeight)?t:s.clientHeight)?o:0:h.bottom,g=be.value;let y=null,w=null;for(const[m,x]of g){if(!x)continue;const e=x.getBoundingClientRect();e.bottom<=v||e.top>=f||(null==y&&(y=m),w=m)}if(null==y||null==w){const e=m.value;if(!e)return;const n=c?{top:0}:s.getBoundingClientRect(),t=function(e,n,t){var o,l,r,i,a,s;if(t)return null!=(i=null!=(r=null==(o=null==n?void 0:n.documentElement)?void 0:o.scrollTop)?r:null==(l=null==n?void 0:n.body)?void 0:l.scrollTop)?i:0;const d=e.scrollTop;if(!ze(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,d,c),o=c?(()=>{const t=e.getBoundingClientRect(),o=(c?0:n.top)-t.top;return Math.max(0,o)})():(()=>{const n=function(e,n){let t=e,o=0,l=0;for(;t&&t!==n&&l++<64;)o+=t.offsetTop||0,t=t.offsetParent;return o}(e,s);return Math.max(0,t-n)})(),p=c?null!=(a=null!=(i=null!=(r=null==u?void 0:u.innerHeight)?r:null==(l=null==d?void 0:d.documentElement)?void 0:l.clientHeight)?i:s.clientHeight)?a:0:s.clientHeight,h=rn(o+.5*Math.max(0,p));return void(He.value=qe(h,0,Math.max(0,Y.value.length-1)))}const k=Math.round((y+w)/2);!e&&Math.abs(k-He.value)<=1||(He.value=qe(k,0,Math.max(0,Y.value.length-1)))}function qe(e,n,t){return Math.min(Math.max(e,n),t)}const Ge=X({}),Ye=X({total:0,count:0});function Ze(e,n,t){for(let o=n+1;o<e.length;o+=o&-o)e[o]+=t}function Je(e,n){let t=0;for(let o=n+1;o>0;o-=o&-o)t+=e[o];return t}function Qe(e,n,t){if(t<=n)return 0;const o=Je(e,t-1);return n<=0?o:o-Je(e,n-1)}const en=C(()=>Ye.count>0?Math.max(12,Ye.total/Ye.count):32);function nn(e,n){var t,o;if(e>=n)return 0;if(_e.value!==Y.value.length){let o=0;for(let l=e;l<n;l++)o+=null!=(t=Ge[l])?t:en.value;return o}const l=Me.value,r=Te.value;if(!l.length||!r.length){let t=0;for(let l=e;l<n;l++)t+=null!=(o=Ge[l])?o:en.value;return t}return Qe(l,e,n)+(n-e-Qe(r,e,n))*en.value}B(()=>Y.value.length,e=>{if(e<=0)return _e.value=0,Me.value=[],void(Te.value=[]);e!==_e.value&&function(e){_e.value=e;const n=new Array(e+1).fill(0),t=new Array(e+1).fill(0);for(const[o,l]of Object.entries(Ge)){const r=Number(o),i=Number(l);!Number.isFinite(r)||r<0||r>=e||!Number.isFinite(i)||i<=0||(Ze(n,r,i),Ze(t,r,1))}Me.value=n,Te.value=t}(e)},{immediate:!0});const tn=C(()=>{if(!J.value)return Y.value.map((e,n)=>({node:e,index:n}));const e=Y.value.length,n=qe(De.start,0,e),t=qe(De.end,n,e);return Y.value.slice(n,t).map((e,t)=>({node:e,index:n+t}))}),on=C(()=>J.value?nn(0,Math.min(De.start,Y.value.length)):0),ln=C(()=>{if(!J.value)return 0;const e=Y.value.length;return nn(Math.min(De.end,e),e)});function rn(e){var n;if(e<=0)return 0;const t=Y.value;if(_e.value===t.length&&Me.value.length&&Te.value.length){const n=en.value,o=Me.value,l=Te.value,r=e=>e<=0?0:Je(o,e-1)+(e-Je(l,e-1))*n;let i=0,a=t.length-1,s=t.length-1;for(;i<=a;){const n=i+a>>1;r(n+1)>=e?(s=n,a=n-1):i=n+1}return s}let o=e;for(let l=0;l<t.length;l++){const e=null!=(n=Ge[l])?n:en.value;if(o<=e)return l;o-=e}return Math.max(0,t.length-1)}function an(){xe.value+=1}function sn(e){if(!fe.size)return;if(!J.value)return;let n=!1;for(const[t,o]of fe)t>=e&&(o.destroy(),fe.delete(t),Ee.value&&delete ve[t],wn(t),we.delete(t)&&(n=!0));n&&an()}function dn(e,n){Ee.value&&(ve[e]=n),n&&(J.value?Ue():He.value=qe(e,0,Math.max(0,Y.value.length-1)))}function un(e){const n=fe.get(e);n&&(n.destroy(),fe.delete(e)),wn(e)}function mn(e,n){let t=!1;if(n){const o=we.get(e);we.set(e,n),o!==n&&(t=!0)}else we.delete(e)&&(t=!0);if(t&&an(),n||wn(e),!Se.value||!ee)return un(e),void(n?dn(e,!0):Ee.value&&delete ve[e]);if(!J.value&&Ee.value&&!p.value&&fe.size>=640&&(function(){if(!p.value){p.value=!0;for(const e of fe.values())e.destroy();if(fe.clear(),g)for(const e of ge.values())window.clearTimeout(e);ge.clear();for(const e of Object.keys(ve))delete ve[e]}}(),!Se.value||!ee))return un(e),void(n?dn(e,!0):Ee.value&&delete ve[e]);if(e<ae.value&&!J.value)return un(e),void dn(e,!0);if(!n)return un(e),void(Ee.value&&delete ve[e]);un(e);const o=ee(n,{rootMargin:"400px"});o&&(fe.set(e,o),dn(e,o.isVisible.value),Ee.value&&function(e){if(!g||!Ee.value)return;wn(e);const n=e%17*23,t=window.setTimeout(()=>{var n,t;if(ge.delete(e),!Ee.value)return;if(!0===ve[e])return;const o=we.get(e);if(!o)return void delete ve[e];const l=Ke(o),r=o.ownerDocument||document,i=r.defaultView||window,a=!l||l===r.documentElement||l===r.body,s=!a&&l?l.getBoundingClientRect():null,d=a?0:s.top,u=a?null!=(t=null!=(n=i.innerHeight)?n:null==l?void 0:l.clientHeight)?t:0:s.bottom,c=o.getBoundingClientRect();c.bottom>=d-500&&c.top<=u+500&&dn(e,!0)},1800+n);ge.set(e,t)}(e),o.whenVisible.then(()=>{wn(e),dn(e,!0)}).catch(()=>{}).finally(()=>{fe.get(e)===o&&fe.delete(e);try{o.destroy()}catch(n){}}),J.value&&Ue())}let pn=null,hn=null,vn=!1,fn=null,gn=null;function yn(){g&&(null!=pn&&(null==te||te(pn),pn=null),null!=hn&&(window.clearTimeout(hn),hn=null),null!=gn&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(gn),gn=null),vn=!1,fn=null)}function wn(e){if(!g)return;const n=ge.get(e);null!=n&&(window.clearTimeout(n),ge.delete(e))}function xn(e,n={}){var t,o;if(!Le.value)return;const l=Oe.value;if(ue.value>=l)return;const i=Math.max(1,e),a=e=>{var n;pn=null,hn=null,gn=null,vn=!1;const t=null!=fn?fn:i;fn=null;const o=Math.max(2,null!=(n=r.renderBatchBudgetMs)?n:6),a=e=>{const n="undefined"!=typeof performance?performance.now():Date.now();ue.value=Math.min(l,ue.value+Math.max(1,e)),sn(ue.value);const t=("undefined"!=typeof performance?performance.now():Date.now())-n;return function(e){var n;if(!Le.value)return;const t=Math.max(2,null!=(n=r.renderBatchBudgetMs)?n:6),o=Math.max(1,ie.value||1),l=Math.max(1,Math.floor(o/4));e>1.2*t?pe.value=Math.max(l,Math.floor(.7*pe.value)):e<.5*t&&pe.value<o&&(pe.value=Math.min(o,Math.ceil(1.2*pe.value)))}(t),t};let s=t;for(;(a(s),!(ue.value>=l)&&e)&&!(("function"==typeof e.timeRemaining?e.timeRemaining():0)<=.5*o);)s=Math.max(1,Math.round(pe.value));ue.value<l&&bn()};if(!g||n.immediate)return void a();const s=Math.max(0,null!=(t=r.renderBatchDelay)?t:16);if(fn=null!=fn?Math.max(fn,i):i,!vn){if(vn=!0,!oe&&le&&window.requestIdleCallback){const e=Math.max(0,null!=(o=r.renderBatchIdleTimeoutMs)?o:120);return void(gn=window.requestIdleCallback(e=>{a(e)},{timeout:e}))}ne&&!oe?pn=ne(()=>{0!==s?hn=window.setTimeout(()=>a(),s):a()}):hn=window.setTimeout(()=>a(),s)}}function bn(){Le.value&&xn(de.value?Math.max(1,Math.round(pe.value)):Math.max(1,ie.value))}B([()=>Y.value,()=>Y.value.length,()=>Le.value,()=>ie.value,()=>ae.value,()=>r.renderBatchDelay,()=>r.indexKey],()=>{var e;const n=Y.value.length,t=ce.value,o=r.indexKey,l=void 0!==o&&o!==t.key,i=n!==t.total,a=l||i;ce.value={key:o,total:n};const s=je.value,d=null!=(e=r.renderBatchDelay)?e:16,u=s.batchSize!==ie.value||s.initial!==ae.value||s.delay!==d||s.enabled!==Le.value;je.value={batchSize:ie.value,initial:ae.value,delay:d,enabled:Le.value},(a||u||!Le.value)&&yn(),(a||u)&&(pe.value=Math.max(1,ie.value||1)),a&&J.value&&Ue({immediate:!0});const c=Oe.value;if(!n)return ue.value=0,void sn(0);if(!Le.value)return ue.value=c,void sn(ue.value);const m=l||0===t.total;ue.value=m||u?Math.min(c,ae.value):Math.min(ue.value,c);const p=Math.max(1,ae.value||ie.value||n);ue.value<c?xn(p,{immediate:!g}):sn(ue.value)},{immediate:!0}),B(()=>J.value,e=>{if(!e)return Ae(),void Ve();Re(),Ue({immediate:!0})},{immediate:!0}),B([()=>Y.value.length,()=>J.value],e=>d(null,[e],function*([e,n]){n&&e&&g&&(yield q(),Ue({immediate:!0}))}),{flush:"post"}),B(()=>m.value,()=>{J.value&&(Re(),Ue({immediate:!0}))}),B(()=>Y.value.length,()=>{J.value&&Ue({immediate:!0})}),B(()=>Ee.value,e=>{if(e)for(const[n,t]of we)mn(n,t);else{for(const e of fe.values())e.destroy();fe.clear();for(const e of Array.from(ge.keys()))wn(e);for(const e of Object.keys(ve))delete ve[e];for(const[e,n]of we)n&&dn(e,!0)}},{immediate:!1}),B([()=>r.viewportPriority,()=>Y.value.length],([e,n])=>{!1!==e?p.value&&n<=200&&(p.value=!1):p.value=!1}),B(()=>ue.value,()=>{J.value&&Ue({immediate:!0})}),B([He,Z,Ne,()=>Y.value.length,J],()=>{!function(){const e=Y.value.length;if(!J.value||0===e)return De.start=0,void(De.end=e);const n=Math.min(Z.value,e),t=Ne.value,o=qe(He.value-t,0,Math.max(0,e-n));De.start=o,De.end=Math.min(e,o+n)}()},{immediate:!0}),B([()=>Y.value.length,J,Z,Ne,()=>De.start,()=>De.end],([e,n,t,o,l,r])=>{y.value&&_("virtualization",{nodes:e,virtualization:n,maxLiveNodes:t,buffer:o,focusIndex:He.value,scroll:n?(()=>{const e=Be.value||Ke();return e?{reverse:ze(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:l,end:r},rendered:ue.value})}),B(()=>Oe.value,(e,n)=>{Le.value&&("number"==typeof n&&e<=n||e>ue.value&&bn())}),$(()=>{yn();for(const e of fe.values())e.destroy();fe.clear();for(const e of Array.from(ge.keys()))wn(e);Ae(),Ve()});const _n=z(()=>d(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),Ct}})),Mn=z(()=>d(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),Ct}})),Cn=z(()=>d(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),Ct}})),Tn=z(()=>d(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),Ct}})),Bn=C(()=>r.renderCodeBlocksAsPre?Ct:_n),In={text:Hn,paragraph:bt,heading:vt,code_block:_n,list:gt,list_item:ft,blockquote:re,table:Lt,definition_list:me,footnote:ct,footnote_reference:Ce,footnote_anchor:st,admonition:Ut,vmr_container:Dt,hardbreak:pt,link:et,image:kn,thematic_break:St,math_inline:Dn,math_block:Pn,strong:Un,emphasis:it,strikethrough:qn,highlight:lt,insert:tt,subscript:Vn,superscript:An,emoji:he,checkbox:se,checkbox_input:se,inline_code:Fe,html_inline:We,reference:On,html_block:kt},$n=C(()=>(ye.value,ke(r.customId))),En=C(()=>null!=r.indexKey?String(r.indexKey):"markdown-renderer"),Ln={},jn=C(()=>a(a({stream:r.codeBlockStream,darkTheme:r.codeBlockDarkTheme,lightTheme:r.codeBlockLightTheme,monacoOptions:r.codeBlockMonacoOptions,themes:r.themes,minWidth:r.codeBlockMinWidth,maxWidth:r.codeBlockMaxWidth},"boolean"==typeof b.value?{showTooltips:b.value}:{}),r.codeBlockProps||{})),Sn=C(()=>({typewriter:r.typewriter})),Nn=C(()=>a(a({},Sn.value),"boolean"==typeof b.value?{showTooltip:b.value}:{})),Kn=C(()=>a(a({},Sn.value),"boolean"==typeof b.value?{showTooltips:b.value}:{})),zn=C(()=>tn.value.map(e=>{const n="code_block"===e.node.type?a({},e.node):e.node,t=Rn(n);return s(a({},e),{node:n,component:Wn(n,t),bindings:Fn(n,t),isCodeBlock:"code_block"===n.type,indexKey:`${En.value}-${e.index}`})}));function Rn(e){var n;return"code_block"===(null==e?void 0:e.type)?String(null!=(n=e.language)?n:"").trim().toLowerCase():""}function Wn(e,n){if(!e)return Ht;const t=$n.value,o=t[String(e.type)];if("code_block"===e.type){const l=null!=n?n:Rn(e);if("mermaid"===l)return t.mermaid||Mn;if("infographic"===l)return t.infographic||Cn;if("d2"===l||"d2lang"===l)return t.d2||Tn;if(o)return o;return t.code_block||Bn.value}return o||In[String(e.type)]||Ht}function Fn(e,n){const t=null!=n?n:Rn(e);return"mermaid"===t||"infographic"===t||"d2"===t||"d2lang"===t?Ln:"link"===e.type?Nn.value:"list"===e.type?Kn.value:"code_block"===e.type?jn.value:Sn.value}function Xn(e){i("click",e)}function Gn(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&i("mouseover",e)}function Yn(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&i("mouseout",e)}return(e,n)=>(h(),v("div",{ref_key:"containerRef",ref:m,class:E(["markstream-vue markdown-renderer",[{dark:r.isDark},{virtualized:J.value}]]),"data-custom-id":r.customId,onClick:Xn,onMouseover:Gn,onMouseout:Yn},[J.value?(h(),v("div",{key:0,class:"node-spacer",style:D({height:`${on.value}px`}),"aria-hidden":"true"},null,4)):O("",!0),(h(!0),v(k,null,x(zn.value,e=>{var t,o;return h(),v("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,Le.value&&o>=ue.value||Ee.value&&!(o<ae.value)&&!0!==ve[o]?(h(),v("div",{key:1,class:"node-placeholder",style:D({height:`${null!=(t=Ge[e.index])?t:en.value}px`})},null,4)):(h(),v("div",{key:0,ref_for:!0,ref:n=>function(e,n){n?(Pe.set(e,n),queueMicrotask(()=>{!function(e,n){if(!Number.isFinite(n)||n<=0)return;const t=Ge[e];if(Ge[e]=n,t?Ye.total+=n-t:(Ye.total+=n,Ye.count++),_e.value>e){const o=Me.value,l=Te.value;if(o.length&&l.length)if(t){const l=n-t;0!==l&&Ze(o,e,l)}else Ze(o,e,n),Ze(l,e,1)}}(e,n.offsetHeight)})):Pe.delete(e)}(e.index,n),class:"node-content"},[e.isCodeBlock||!1===r.typewriter?(h(),A(R(e.component),V({key:1,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":r.customId,"is-dark":r.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"])):(h(),A(N,{key:0,name:"typewriter",appear:""},{default:H(()=>[(h(),A(R(e.component),V({node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":r.customId,"is-dark":r.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,Ot)}),128)),J.value?(h(),v("div",{key:1,class:"node-spacer",style:D({height:`${ln.value}px`}),"aria-hidden":"true"},null,4)):O("",!0)],42,Pt))}}),[["__scopeId","data-v-f20e7819"]]);Kt.install=e=>{var n,t;const o=null!=(t=null!=(n=Kt.__name)?n:Kt.name)?t:"NodeRenderer";e.component(o,Kt)};const zt={key:0,class:"admonition-icon"},At={class:"admonition-title"},Rt=["aria-expanded","aria-controls","title"],Wt={key:0},Vt={key:1},Ft=["id"],Ut=/* @__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,l=n,r={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=T(!!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)=>(h(),v("div",{class:E(["admonition",[`admonition-${o.node.kind}`,o.isDark?"is-dark":""]])},[w("div",{id:d,class:"admonition-header"},[r[o.node.kind]?(h(),v("span",zt,b(r[o.node.kind]),1)):O("",!0),w("span",At,b(i.value),1),o.node.collapsible?(h(),v("button",{key:1,class:"admonition-toggle","aria-expanded":!a.value,"aria-controls":`${d}-content`,title:a.value?"Expand":"Collapse",onClick:s},[a.value?(h(),v("span",Wt,"▶")):(h(),v("span",Vt,"▼"))],8,Rt)):O("",!0)]),G(w("div",{id:`${d}-content`,class:"admonition-content","aria-labelledby":d},[f([o.node.children],()=>g(y(Kt),{"index-key":`admonition-${e.indexKey}`,nodes:o.node.children,"custom-id":o.customId,typewriter:o.typewriter,onCopy:t[0]||(t[0]=e=>l("copy",e))},null,8,["index-key","nodes","custom-id","typewriter"]),t,1)],8,Ft),[[Y,!a.value]])],2))}}),[["__scopeId","data-v-5e95c2b7"]]);Ut.install=e=>{e.component(Ut.__name,Ut)};const Xt=()=>import("@terrastruct/d2");let qt=null,Gt=Xt;function Yt(e){Gt=e,qt=null}function Zt(e){Yt(null!=e?e:Xt)}function Jt(){Yt(null)}function Qt(){return"function"==typeof Gt}function eo(){return d(this,null,function*(){if(qt)return qt;const e=Gt;if(!e)return null;let n;try{n=yield e()}catch(t){if(e===Xt)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw t}return n?(qt=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),qt):null})}let no=!1,to=null,oo=!1;function lo(){return d(this,null,function*(){if(to)return to;if(oo)return null;try{return to=yield import("stream-monaco"),yield function(e){return d(this,null,function*(){if(no)return;no=!0;const n=null==globalThis?void 0:globalThis.MonacoEnvironment;return!n||"function"!=typeof n.getWorker&&"function"!=typeof n.getWorkerUrl?e.preloadMonacoWorkers():void 0})}(to),(yield function(e){return d(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}})}(to))?to:(to=null,oo=!0,null)}catch(e){return oo=!0,null}})}const ro='<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',io='<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',ao='<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 so=null,uo=null,co=null;const mo=_(0),po={"":ao,plain:ao,text:ao,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:ro,csharp:ro,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:io,powershell:io,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'},ho={"":"",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 vo(){return d(this,null,function*(){return uo||(co||(co=import("./languageIconExtended.js").then(e=>(uo=e.EXTENDED_LANGUAGE_ICON_MAP,mo.value++,uo)).catch(()=>null)),co)})}function fo(e){so=null!=e?e:null}function go(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=ho[t])?n:t}function yo(e){const n=go(e);if(!n)return"plaintext";switch(n){case"plain":return"plaintext";case"jsx":return"javascript";case"tsx":return"typescript";default:return n}}function wo(){return d(this,null,function*(){yield vo()})}function ko(e){if(so){const n=so(e);if(null!=n&&""!==n)return n}const n=go(e),t=po[n];if(t)return t;return(null==uo?void 0:uo[n])||(vo(),'<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 xo={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"},bo={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)"}},_o={class:"flex items-center gap-x-2"},Mo=["innerHTML"],Co={class:"text-sm font-medium font-mono"},To={class:"flex items-center gap-x-2"},Bo=["aria-pressed"],Io=["disabled"],$o=["disabled"],Eo=["disabled"],Lo=["aria-label"],jo={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"},So={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"},No=["aria-pressed"],Ho={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"},Do={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"},Po=["aria-label"],Oo=["innerHTML"],Ko={class:"code-loading-placeholder"},zo=/* @__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}){var t;const o=e,l=n,{t:r}=un(),i=T(String(null!=(t=o.node.language)?t:"")),a=T(!1),s=T(!1),u=T(!1),c=T(null),m=T(null),p=T(""),f=T(!1);let g;const x=T(!0),_=T(0),M=T(14),L=T(M.value),j=C(()=>{const e=M.value,n=L.value;return"number"==typeof e&&Number.isFinite(e)&&e>0&&"number"==typeof n&&Number.isFinite(n)&&n>0}),S=C(()=>{const e=i.value.trim().toLowerCase();return xo[e]||e.charAt(0).toUpperCase()+e.slice(1)}),N=C(()=>(mo.value,ko(i.value.trim().toLowerCase().split(":")[0]))),H=C(()=>{const e=i.value.trim().toLowerCase();return o.isShowPreview&&("html"===e||"svg"===e)}),K=C(()=>{const e={},n=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},t=n(o.minWidth),l=n(o.maxWidth);return t&&(e.minWidth=t),l&&(e.maxWidth=l),e}),z=C(()=>({fontSize:`${L.value}px`})),A=C(()=>!1!==o.showTooltips);function R(){return o.isDark?o.darkTheme:o.lightTheme}function W(e){if(null==g||g.disconnect(),g=void 0,!e)return p.value="",void(f.value=!1);var n;p.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>`,f.value=!1}function V(){p.value="",f.value=!0}function F(){var e;const n=m.value;return!!n&&(n.childNodes.length>0||Boolean(null==(e=n.textContent)?void 0:e.trim().length))}function U(){return d(this,null,function*(){if(yield q(),F())return void V();const e=m.value;e&&(null==g||g.disconnect(),g=new MutationObserver(()=>{F()&&(V(),null==g||g.disconnect(),g=void 0)}),g.observe(e,{childList:!0,subtree:!0}))})}let X,Z,J,Q;const ee=/* @__PURE__ */new Set,ne=/* @__PURE__ */new Set,te=void 0!==import.meta&&Boolean(!1);function oe(e,n){return d(this,null,function*(){if(!X)return;const t=function(e,n=!1){var t;const[o]=String(null!=e?e:"").split(":"),l=null!=(t=null==o?void 0:o.trim().toLowerCase())?t:"";return l?!Q||Q.has(l)?l:(n&&te&&!ee.has(l)&&(ee.add(l),console.warn(`[MarkdownCodeBlockNode] Language "${l}" not preloaded in stream-markdown; falling back to plaintext.`)),"plaintext"):"plaintext"}(n,Boolean(e&&e.length));try{yield X.updateCode(e,t)}catch(o){"plaintext"!==t?(te&&!ne.has(t)&&(ne.add(t),console.warn(`[MarkdownCodeBlockNode] Failed to render language "${t}", retrying as plaintext.`,o)),yield X.updateCode(e,"plaintext")):te&&console.warn("[MarkdownCodeBlockNode] Failed to render code block even as plaintext.",o)}})}function le(){return d(this,null,function*(){yield function(){return d(this,null,function*(){if(!Z)try{const e=yield import("stream-markdown");Z=e.createShikiStreamRenderer,J=e.registerHighlight;const n=Array.isArray(e.defaultLanguages)?e.defaultLanguages:void 0;Q=n?new Set(n.map(e=>e.toLowerCase())):void 0,null==J||J({themes:o.themes})}catch(e){console.warn("[MarkdownCodeBlockNode] stream-markdown not available:",e)}})}(),c.value&&m.value?(null==J||J({themes:o.themes}),!X&&Z&&(X=Z(m.value,{theme:R()}),f.value=!0),X?!1===o.stream&&o.loading?W(o.node.code):(W(o.node.code),yield oe(o.node.code,i.value),yield U()):W(o.node.code)):W(o.node.code)})}function re(){const e=c.value;if(!e||s.value)return;const n=e.scrollTop;n<_.value?x.value=!1:function(e,n=50){return e.scrollHeight-e.scrollTop-e.clientHeight<=n}(e)&&(x.value=!0),_.value=n}function ie(){return d(this,null,function*(){try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(o.node.code)),a.value=!0,l("copy",o.node.code),setTimeout(()=>{a.value=!1},1e3)}catch(e){console.error("Copy failed:",e)}})}function ae(e){const n=e.currentTarget||e.target;return!n||n.disabled?null:n}function se(e,n,t="top"){if(!A.value)return;const l=ae(e);if(!l)return;const r=e;rn(l,n,t,!1,null!=(null==r?void 0:r.clientX)&&null!=(null==r?void 0:r.clientY)?{x:r.clientX,y:r.clientY}:void 0,o.isDark)}function de(){A.value&&an()}function ue(e){if(!A.value)return;const n=ae(e);if(!n)return;const t=e;rn(n,a.value?r("common.copied")||"Copied":r("common.copy")||"Copy","top",!1,null!=(null==t?void 0:t.clientX)&&null!=(null==t?void 0:t.clientY)?{x:t.clientX,y:t.clientY}:void 0,o.isDark)}function ce(){s.value=!s.value;const e=c.value;e&&(s.value?(e.style.maxHeight="none",e.style["overflow-y"]="visible",e.style["overflow-x"]="auto"):(e.style.maxHeight="500px",e.style.overflow="auto",x.value=!0,q(()=>{e.scrollHeight>e.clientHeight&&(e.scrollTop=e.scrollHeight)})))}function me(){u.value=!u.value}function pe(){if(!H.value)return;const e=(i.value||o.node.language).toLowerCase(),n="html"===e?"HTML Preview":"SVG Preview";l("previewCode",{type:"html"===e?"text/html":"image/svg+xml",content:o.node.code,title:n})}return le(),I(()=>{le()}),$(()=>{null==g||g.disconnect(),g=void 0}),B(()=>o.themes,()=>d(null,null,function*(){J&&J({themes:o.themes})})),B(()=>o.loading,e=>{e||le()}),B(A,e=>{e||an()}),B(()=>[o.node.code,o.node.language],e=>d(null,[e],function*([e,n]){n!==i.value&&(i.value=n.trim()),c.value&&m.value?(X||(W(e),yield le()),X&&e&&(!1===o.stream&&o.loading||(W(e),yield oe(e,n),yield U()))):W(e)})),B(()=>[o.darkTheme,o.lightTheme],()=>d(null,null,function*(){c.value&&m.value&&(X||(yield le()),null==X||X.setTheme(R()))})),B(()=>o.node.code,()=>d(null,null,function*(){if(s.value||!x.value)return;yield q();const e=c.value;e&&e.scrollHeight>e.clientHeight&&(e.scrollTop=e.scrollHeight)})),(n,t)=>(h(),v("div",{style:D(K.value),class:E(["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",[o.isDark?"border-gray-700/30 bg-gray-900":"border-gray-200 bg-white",o.isDark?"is-dark":""]])},[o.showHeader?(h(),v("div",bo,[P(n.$slots,"header-left",{},()=>[w("div",_o,[w("span",{class:"icon-slot h-4 w-4 flex-shrink-0",innerHTML:N.value},null,8,Mo),w("span",Co,b(S.value),1)])],!0),P(n.$slots,"header-right",{},()=>[w("div",To,[o.showCollapseButton?(h(),v("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":u.value,onClick:me,onMouseenter:t[0]||(t[0]=e=>se(e,u.value?y(r)("common.expand")||"Expand":y(r)("common.collapse")||"Collapse")),onFocus:t[1]||(t[1]=e=>se(e,u.value?y(r)("common.expand")||"Expand":y(r)("common.collapse")||"Collapse")),onMouseleave:de,onBlur:de},[(h(),v("svg",{style:D({rotate:u.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"},[...t[17]||(t[17]=[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,Bo)):O("",!0),o.showFontSizeButtons&&o.enableFontSizeControl?(h(),v(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(L.value)&&L.value<=10,onClick:t[2]||(t[2]=e=>function(){const e=Math.max(10,L.value-1);L.value=e}()),onMouseenter:t[3]||(t[3]=e=>se(e,y(r)("common.decrease")||"Decrease")),onFocus:t[4]||(t[4]=e=>se(e,y(r)("common.decrease")||"Decrease")),onMouseleave:de,onBlur:de},[...t[18]||(t[18]=[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,Io),w("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!j.value||L.value===M.value,onClick:t[5]||(t[5]=e=>{L.value=M.value}),onMouseenter:t[6]||(t[6]=e=>se(e,y(r)("common.reset")||"Reset")),onFocus:t[7]||(t[7]=e=>se(e,y(r)("common.reset")||"Reset")),onMouseleave:de,onBlur:de},[...t[19]||(t[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("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,$o),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(L.value)&&L.value>=36,onClick:t[8]||(t[8]=e=>function(){const e=Math.min(36,L.value+1);L.value=e}()),onMouseenter:t[9]||(t[9]=e=>se(e,y(r)("common.increase")||"Increase")),onFocus:t[10]||(t[10]=e=>se(e,y(r)("common.increase")||"Increase")),onMouseleave:de,onBlur:de},[...t[20]||(t[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("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1)])],40,Eo)],64)):O("",!0),o.showCopyButton?(h(),v("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":a.value?y(r)("common.copied")||"Copied":y(r)("common.copy")||"Copy",onClick:ie,onMouseenter:t[11]||(t[11]=e=>ue(e)),onFocus:t[12]||(t[12]=e=>ue(e)),onMouseleave:de,onBlur:de},[a.value?(h(),v("svg",So,[...t[22]||(t[22]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(h(),v("svg",jo,[...t[21]||(t[21]=[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,Lo)):O("",!0),o.showExpandButton?(h(),v("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":s.value,onClick:ce,onMouseenter:t[13]||(t[13]=e=>se(e,s.value?y(r)("common.collapse")||"Collapse":y(r)("common.expand")||"Expand")),onFocus:t[14]||(t[14]=e=>se(e,s.value?y(r)("common.collapse")||"Collapse":y(r)("common.expand")||"Expand")),onMouseleave:de,onBlur:de},[s.value?(h(),v("svg",Ho,[...t[23]||(t[23]=[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)])])):(h(),v("svg",Do,[...t[24]||(t[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)])]))],40,No)):O("",!0),H.value&&o.showPreviewButton?(h(),v("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:pe,onMouseenter:t[15]||(t[15]=e=>se(e,y(r)("common.preview")||"Preview")),onFocus:t[16]||(t[16]=e=>se(e,y(r)("common.preview")||"Preview")),onMouseleave:de,onBlur:de},[...t[25]||(t[25]=[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,Po)):O("",!0)])],!0)])):O("",!0),G(w("div",{ref_key:"codeBlockContent",ref:c,class:"code-block-content",style:D(z.value),onScroll:re},[w("div",{ref_key:"rendererTarget",ref:m,class:"code-block-render"},null,512),f.value?O("",!0):(h(),v("div",{key:0,class:"code-fallback-plain",innerHTML:p.value},null,8,Oo))],36),[[Y,!(u.value||!e.stream&&e.loading)]]),G(w("div",Ko,[P(n.$slots,"loading",{loading:e.loading,stream:e.stream},()=>[t[26]||(t[26]=w("div",{class:"loading-skeleton"},[w("div",{class:"skeleton-line"}),w("div",{class:"skeleton-line"}),w("div",{class:"skeleton-line short"})],-1))],!0)],512),[[Y,!e.stream&&e.loading]])],6))}}),[["__scopeId","data-v-94d4dd2a"]]);zo.install=e=>{e.component(zo.__name,zo)};const Ao=()=>import("mermaid");let Ro=null,Wo=Ao;function Vo(e){Wo=e,Ro=null}function Fo(e){Vo(null!=e?e:Ao)}function Uo(){Vo(null)}function Xo(){return"function"==typeof Wo}function qo(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 Go(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 Yo(){return d(this,null,function*(){if(Ro)return Ro;const e=function(){try{const e=globalThis;return qo(null==e?void 0:e.mermaid)}catch(e){return null}}();if(e)return Ro=e,Go(Ro),Ro;const n=Wo;if(!n)return null;let t;try{t=yield n()}catch(o){if(n===Ao)throw new Error('Optional dependency "mermaid" is not installed. Please install it to enable mermaid diagrams.');throw o}return t?(Ro=qo(t),Go(Ro),Ro):null})}const Zo={class:"markstream-vue"},Jo=["id"],Qo=/* @__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=T(null),l=T({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"}),r=T(!1);let i=null;function a(){return d(this,null,function*(){var e,t;if(!n.anchorEl||!o.value)return;const r=[Q(null!=(e=n.offset)?e:8),ee(),ne({padding:8})],{x:i,y:a}=yield te(n.anchorEl,o.value,{placement:null!=(t=n.placement)?t:"top",middleware:r,strategy:"fixed"});l.value.transform=`translate3d(${Math.round(i)}px, ${Math.round(a)}px, 0)`,l.value.left="0px",l.value.top="0px"})}return B(()=>n.visible,e=>d(null,null,function*(){if(e)if(r.value=!1,yield q(),n.anchorEl&&o.value)try{const e=n.anchorEl.getBoundingClientRect();yield a();const t=l.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?(l.value.transform=`translate3d(${Math.round(n.originX)}px, ${Math.round(n.originY)}px, 0)`,yield q(),r.value=!0,yield q(),l.value.transform=t):r.value=!0}else r.value=!0;i=J(n.anchorEl,o.value,a)}catch(t){yield a(),r.value=!0,i=J(n.anchorEl,o.value,a)}else r.value=!0;else r.value=!1,i&&(i(),i=null)})),B([()=>n.anchorEl,()=>n.placement,()=>n.content],()=>d(null,null,function*(){n.visible&&n.anchorEl&&o.value&&(yield q(),yield a())})),$(()=>{i&&i()}),(i,a)=>(h(),A(Z,{to:"body"},[w("div",Zo,[g(N,{name:"tooltip",appear:""},{default:H(()=>[G(w("div",{id:n.id,ref_key:"tooltip",ref:o,style:D({position:"fixed",left:l.value.left,top:l.value.top,transform:l.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"},b(e.content),15,Jo),[[Y,e.visible&&r.value]])]),_:1})])]))}}),[["__scopeId","data-v-d524cc01"]]),el=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:Qo},Symbol.toStringTag,{value:"Module"}));function nl(e){return JSON.stringify(e)}function tl(e){var n;const t=null!=(n=e.mode)?n:"classic",o=e.katexUrl,l=e.mhchemUrl,r=nl(a({throwOnError:!0,displayMode:!0,output:"html",strict:"ignore"},e.renderOptions||{})),i=nl(o),s=l?nl(l):'""';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 = ${r}\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 = ${r}\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 ol(e){var n,t;const o=tl(e);if("undefined"==typeof Worker||"undefined"==typeof URL||"undefined"==typeof Blob)return{worker:null,dispose:()=>{},source:o};const l=new Blob([o],{type:"text/javascript"}),r=URL.createObjectURL(l);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(r,d);if(e.debug)try{u.postMessage({type:"init",debug:!0})}catch(c){}return{worker:u,dispose:()=>{if(!i){i=!0;try{URL.revokeObjectURL(r)}catch(c){}}},source:o}}Qo.install=e=>{e.component(Qo.__name,Qo)};let ll=null,rl=null,il=!1;const al=/* @__PURE__ */new Map,sl=/* @__PURE__ */new Map;let dl=5;const ul=/* @__PURE__ */new Set;function cl(){if(al.size<dl&&ul.size){const n=Array.from(ul);ul.clear();for(const t of n)try{t()}catch(e){}}}function ml(e){ll=e,rl=null,ll.onmessage=e=>{const{id:n,html:t,error:o}=e.data,l=al.get(n);if(l)if(al.delete(n),clearTimeout(l.timeoutId),cl(),o)l.reject(new Error(o));else{const{content:n,displayMode:o}=e.data;if(n){const e=`${o?"d":"i"}:${n}`;if(sl.set(e,t),sl.size>200){const e=sl.keys().next().value;sl.delete(e)}}l.resolve(t)}},ll.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[n,t]of al.entries())clearTimeout(t.timeoutId),t.reject(new Error(`Worker error: ${e.message}`));al.clear(),cl()}}function pl(){var e;ll&&(null==(e=ll.terminate)||e.call(ll)),ll=null,rl=null}function hl(e){il=!!e,ll&&ll.postMessage({type:"init",debug:il})}function vl(e,n=!0,t=2e3,o){return d(this,null,function*(){if(performance.now(),!En()){const e=new Error("KaTeX rendering disabled");return e.name="KaTeXDisabled",e.code="KATEX_DISABLED",Promise.reject(e)}if(rl)return Promise.reject(rl);const l=`${n?"d":"i"}:${e}`,r=sl.get(l);if(r)return Promise.resolve(r);const i=ll||(rl=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),rl.name="WorkerInitError",rl.code="WORKER_INIT_ERROR",null);if(!i)return Promise.reject(rl);if(al.size>=dl){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code="WORKER_BUSY",e.busy=!0,e.inFlight=al.size,e.max=dl,Promise.reject(e)}return new Promise((l,r)=>{if(null==o?void 0:o.aborted){const e=new Error("Aborted");return e.name="AbortError",void r(e)}const a=Math.random().toString(36).slice(2),s=globalThis.setTimeout(()=>{al.delete(a);const e=new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",r(e),cl()},t);o&&o.addEventListener("abort",()=>{globalThis.clearTimeout(s),al.has(a)&&al.delete(a);const e=new Error("Aborted");e.name="AbortError",r(e),cl()},{once:!0});const d=l,u=r;al.set(a,{resolve:e=>{d(e)},reject:e=>{u(e)},timeoutId:s}),i.postMessage({id:a,content:e,displayMode:n})})})}function fl(e,n=!0,t){const o=`${n?"d":"i"}:${e}`;if(sl.set(o,t),sl.size>200){const e=sl.keys().next().value;sl.delete(e)}}function gl(){return{inFlight:al.size,max:dl}}function yl(e){Number.isFinite(e)&&e>0&&(dl=Math.floor(e))}const wl="WORKER_BUSY";function kl(){return al.size>=dl}function xl(e=2e3,n){return al.size<dl?Promise.resolve():new Promise((t,o)=>{let l,r=!1;const i=()=>{r||(r=!0,l&&globalThis.clearTimeout(l),ul.delete(i),t())};if(ul.add(i),l=globalThis.setTimeout(()=>{if(r)return;r=!0,ul.delete(i);const e=new Error("Wait for worker slot timed out");e.name="WorkerBusyTimeout",e.code="WORKER_BUSY_TIMEOUT",o(e)},e),queueMicrotask(()=>cl()),n){const e=()=>{if(r)return;r=!0,l&&globalThis.clearTimeout(l),ul.delete(i);const e=new Error("Aborted");e.name="AbortError",o(e)};n.aborted?e():n.addEventListener("abort",e,{once:!0})}})}const bl={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function _l(e){null!=e.timeout&&(bl.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(bl.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(bl.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(bl.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function Ml(){return a({},bl)}function Cl(e){return d(this,arguments,function*(e,n=!0,t={}){var o,l,r,i;if(!En()){const e=new Error("KaTeX rendering disabled");throw e.name="KaTeXDisabled",e.code="KATEX_DISABLED",e}const a=null!=(o=t.timeout)?o:bl.timeout,s=null!=(l=t.waitTimeout)?l:bl.waitTimeout,d=null!=(r=t.backoffMs)?r:bl.backoffMs,u=null!=(i=t.maxRetries)?i:bl.maxRetries,c=Number.isFinite(u)?Math.max(0,Math.min(Math.floor(u),8)):bl.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 vl(e,n,a,m)}catch(h){if((null==h?void 0:h.code)!==wl||p>=c)throw h;if(p++,yield xl(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 Tl(e){return JSON.stringify(e)}function Bl(e){var n;const t=null!=(n=e.mode)?n:"module",o=Tl(e.mermaidUrl),l=`\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(${Tl(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${l}\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${l}\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 Il(e){var n,t;const o=Bl(e);if("undefined"==typeof Worker||"undefined"==typeof URL||"undefined"==typeof Blob)return{worker:null,dispose:()=>{},source:o};const l=new Blob([o],{type:"text/javascript"}),r=URL.createObjectURL(l);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(r,d);if(e.debug)try{u.postMessage({type:"init",debug:!0})}catch(c){}return{worker:u,dispose:()=>{if(!i){i=!0;try{URL.revokeObjectURL(r)}catch(c){}}},source:o}}let $l=null,El=null;const Ll=/* @__PURE__ */new Map;let jl=5,Sl=!1;function Nl(e){Sl=!!e}function Hl(e){Number.isFinite(e)&&e>0&&(jl=Math.floor(e))}function Dl(){return{inFlight:Ll.size,max:jl}}const Pl="WORKER_BUSY",Ol="MERMAID_DISABLED";function Kl(e){$l=e,El=null;const n=e;$l.onmessage=e=>{if($l!==n)return;const{id:t,ok:o,result:l,error:r}=e.data,i=Ll.get(t);i&&(!1===o||r?i.reject(new Error(r||"Unknown error")):i.resolve(l))},$l.onerror=e=>{var t,o;if($l===n)if(0!==Ll.size){try{Sl?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(l){}for(const[n,t]of Ll.entries())t.reject(new Error(`Worker error: ${e.message}`));Ll.clear()}else null==(t=console.debug)||t.call(console,"[mermaidWorkerClient] Worker error (no pending):",(null==e?void 0:e.message)||e)},$l.onmessageerror=e=>{var t,o;if($l===n)if(0!==Ll.size){try{Sl?console.error("[mermaidWorkerClient] Worker messageerror:",e):null==(o=console.debug)||o.call(console,"[mermaidWorkerClient] Worker messageerror:",e)}catch(l){}for(const[e,n]of Ll.entries())n.reject(new Error("Worker messageerror"));Ll.clear()}else null==(t=console.debug)||t.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function zl(){var e;if($l)try{for(const[e,n]of Ll.entries())n.reject(new Error("Worker cleared"));Ll.clear(),null==(e=$l.terminate)||e.call($l)}catch(n){}$l=null,El=null}function Al(e,n,t=1400){if(!Xo()){const e=new Error("Mermaid rendering disabled");return e.name="MermaidDisabled",e.code=Ol,Promise.reject(e)}if(El)return Promise.reject(El);const o=$l||(El=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),El.name="WorkerInitError",El.code="WORKER_INIT_ERROR",null);if(!o)return Promise.reject(El);if(Ll.size>=jl){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=Pl,e.inFlight=Ll.size,e.max=jl,Promise.reject(e)}return new Promise((l,r)=>{const i=Math.random().toString(36).slice(2);let a,s=!1;const d=()=>{s||(s=!0,null!=a&&globalThis.clearTimeout(a),Ll.delete(i))},u={resolve:e=>{d(),l(e)},reject:e=>{d(),r(e)}};Ll.set(i,u);try{o.postMessage({id:i,action:e,payload:n})}catch(c){return Ll.delete(i),void r(c)}a=globalThis.setTimeout(()=>{const e=new Error("Worker call timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT";const n=Ll.get(i);n&&n.reject(e)},t)})}function Rl(e,n,t=1400){return d(this,null,function*(){try{return yield Al("canParse",{code:e,theme:n},t)}catch(o){return Promise.reject(o)}})}function Wl(e,n,t=1400){return d(this,null,function*(){try{return yield Al("findPrefix",{code:e,theme:n},t)}catch(o){return Promise.reject(o)}})}function Vl(){if($l)try{for(const[e,n]of Ll.entries())n.reject(new Error("Worker terminated"));Ll.clear(),$l.terminate()}finally{$l=null}}const Fl=z(()=>import("./index4.js")),Ul=z(()=>import("./index3.js")),Xl=z(()=>import("./index2.js")),ql=z(()=>import("./index5.js")),Gl=z(()=>import("./index6.js")),Yl=z(()=>import("./index7.js")),Zl={AdmonitionNode:Ut,BlockquoteNode:re,CheckboxNode:se,CodeBlockNode:Fl,DefinitionListNode:me,EmojiNode:he,EmphasisNode:it,FootnoteNode:ct,FootnoteReferenceNode:Ce,FootnoteAnchorNode:st,HardBreakNode:pt,HeadingNode:vt,HtmlBlockNode:kt,HtmlInlineNode:We,HighlightNode:lt,ImageNode:kn,D2BlockNode:Yl,InfographicBlockNode:Gl,InlineCodeNode:Fe,PreCodeNode:Ct,InsertNode:tt,LinkNode:et,ListItemNode:ft,ListNode:gt,MathBlockNode:Ul,MathInlineNode:Xl,MermaidBlockNode:ql,ParagraphNode:bt,StrikethroughNode:qn,StrongNode:Un,SubscriptNode:Vn,SuperscriptNode:An,TableNode:Lt,TextNode:Hn,ThematicBreakNode:St,VmrContainerNode:Dt,ReferenceNode:On,MarkdownCodeBlockNode:zo},Jl={install(e,n){Object.entries(Zl).forEach(([n,t])=>{e.component(n,t)}),(null==n?void 0:n.getLanguageIcon)&&fo(n.getLanguageIcon),(null==n?void 0:n.mathOptions)&&m(n.mathOptions)}};export{qn as $,Ut as A,re as B,se as C,Yl as D,he as E,st as F,kt as G,pt as H,We as I,kn as J,Gl as K,Fe as L,tt as M,et as N,ft as O,gt as P,Ol as Q,Pl as R,zo as S,Kt as T,Ul as U,Xl as V,wl as W,ql as X,bt as Y,On as Z,le as _,mn as a,Un as a0,Vn as a1,An as a2,Lt as a3,Hn as a4,St as a5,Qo as a6,Dt as a7,Jl as a8,tl as a9,_l as aA,ml as aB,hl as aC,yl as aD,Bn as aE,fo as aF,Vo as aG,Kl as aH,Nl as aI,Hl as aJ,xl as aK,Bl as aa,be as ab,pl as ac,zl as ad,ol as ae,Il as af,Jt as ag,$n as ah,Uo as ai,Zt as aj,In as ak,Fo as al,ke as am,Ml as an,gl as ao,Dl as ap,Qt as aq,kl as ar,En as as,Xo as at,wo as au,xe as av,vl as aw,we as ax,Yt as ay,dn as az,mo as b,ko as c,Ct as d,Cl as e,Ln as f,lo as g,an as h,fl as i,Yo as j,Rl as k,xo as l,Wl as m,go as n,eo as o,Fl as p,me as q,yo as r,rn as s,Vl as t,un as u,it as v,ct as w,Ce as x,vt as y,lt 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 h}from"stream-markdown-parser";import{defineComponent as p,openBlock as f,createElementBlock as v,withMemo as g,createVNode as y,unref as w,createElementVNode as k,Fragment as x,renderList as b,toDisplayString as _,shallowRef as M,h as T,computed as C,ref as B,watch as I,onMounted as $,onBeforeUnmount as S,normalizeClass as E,createApp as L,inject as j,provide as N,Transition as H,withCtx as P,normalizeStyle as D,renderSlot as R,createCommentVNode as O,readonly as K,defineAsyncComponent as z,createBlock as A,resolveDynamicComponent as W,useAttrs as F,mergeProps as V,isMemoSame as U,markRaw as X,reactive as q,nextTick as G,withDirectives as Y,vShow as Z,Teleport 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)=>(f(),v("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)=>(f(),v("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)=>(f(),v("dl",ue,[(f(!0),v(x,null,b(n.node.items,(o,r)=>(f(),v(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"},fe=/* @__PURE__ */le(/* @__PURE__ */p({__name:"EmojiNode",props:{node:{}},setup:e=>(n,t)=>(f(),v("span",pe,_(e.node.name),1))}),[["__scopeId","data-v-de55dc97"]]);fe.install=e=>{e.component(fe.__name,fe)};const ve="__global__",ge="__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__",ye=(()=>{const e=globalThis;if(e[ge])return e[ge];const n={scopedCustomComponents:{},revision:M(0)};return e[ge]=n,n})(),we=ye.revision;function ke(e,n){"string"==typeof e?ye.scopedCustomComponents[e]=n||{}:ye.scopedCustomComponents[ve]=e||{},we.value++}function xe(e){const n=ye.scopedCustomComponents[ve]||{};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===ve)throw new Error("removeCustomComponents: use clearGlobalCustomComponents() to clear the global mapping");delete ye.scopedCustomComponents[e],we.value++}function _e(){delete ye.scopedCustomComponents[ve],we.value++}const Me=["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)=>(f(),v("sup",{id:`fnref-${e.node.id}`,class:"footnote-reference",onClick:t},[k("span",{href:n,title:`查看脚注 ${e.node.id}`,class:"footnote-link cursor-pointer"},"["+_(e.node.id)+"]",9,Te)],8,Me))}}),[["__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"]),$e=/* @__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"]),Se=/<([a-z][a-z0-9-]*)\b[^>]*>/gi,Ee=/* @__PURE__ */new Set(["script"]),Le=/* @__PURE__ */new Set(["href","src","srcset","xlink:href","formaction"]),je=(()=>{try{return Boolean(!1)}catch(e){}return!1})();function Ne(e){je&&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!$e.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 Oe(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 Ke(e){return e.trim().length>0}function ze(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]=Oe(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(Se.lastIndex=0;null!==(t=Se.exec(e));)if(De(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=ze(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=ze(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&&Ne(`Auto-closing unclosed tag: <${l.tagName}>`)}else Ne(`Ignoring closing tag with no matching opening tag: </${l.tagName}>`)}for(;o.length>0;){const e=o.pop(),t=ze(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),Ne(`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);Ke(n)&&r.push({type:"text",content:n})}break}if(i>l){const n=e.slice(l,i);Ke(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,je&&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=We(e,t.value);if(null!==n)return{mode:"dynamic",nodes:n}}if(!Ae(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}}),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())}),$(()=>{"html"===r.value.mode&&(n.node.loading&&!n.node.autoClosed?c():u())}),S(()=>{l.value&&(l.value.innerHTML="",a.value={mode:"",content:"",el:null})}),(e,t)=>"dynamic"===r.value.mode?(f(),v("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)):(f(),v("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=/* @__PURE__ */p({__name:"InlineCodeNode",props:{node:{}},setup:e=>(n,t)=>(f(),v("code",Ve,_(e.node.code),1))});Ue.install=e=>{e.component(Ue.__name,Ue)};const Xe=B(!1),qe=B(""),Ge=B("top"),Ye=B(null),Ze=B(null),Je=B(null),Qe=B(null),en=B(null);let nn=null,tn=null;function on(){nn&&(clearTimeout(nn),nn=null),tn&&(clearTimeout(tn),tn=null)}let rn=!1,ln=null;function an(e,n,t="top",o=!1,r,l){if(!e)return;rn||"undefined"!=typeof document&&(ln||(ln=Promise.resolve().then(()=>mr).then(({default:e})=>{rn=!0;const n=document.createElement("div");n.setAttribute("data-singleton-tooltip","1"),document.body.appendChild(n),L({setup:()=>()=>{var n;return T(e,{visible:Xe.value,"anchor-el":Ye.value,content:qe.value,placement:Ge.value,id:Ze.value,originX:Je.value,originY:Qe.value,isDark:null!=(n=en.value)?n:void 0})}}).mount(n)}).catch(e=>{ln=null,rn=!1,console.warn("[markstream-vue] Failed to load Tooltip component. Tooltips will be disabled.",e)}))),on();const i=()=>{var o,i;Ze.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,Ye.value=e,qe.value=n,Ge.value=t,Je.value=null!=(o=null==r?void 0:r.x)?o:null,Qe.value=null!=(i=null==r?void 0:r.y)?i:null,en.value="boolean"==typeof l?l:null,Xe.value=!0;try{e.setAttribute("aria-describedby",Ze.value)}catch(a){}};o?i():nn=setTimeout(i,80)}function sn(e=!1){on();const n=()=>{if(Ye.value&&Ze.value)try{Ye.value.removeAttribute("aria-describedby")}catch(e){}Xe.value=!1,Ye.value=null,Ze.value=null,Je.value=null,Qe.value=null};e?n():tn=setTimeout(n,120)}const dn={"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 un(e){Object.assign(dn,e)}function cn(){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=dn[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 mn=/* @__PURE__ */Symbol("ViewportPriority");function hn(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 N(mn,a),a}function pn(){const e=j(mn,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 fn={class:"relative inline-block"},vn=["src","alt","title","loading","tabindex","aria-label"],gn={class:"text-sm whitespace-nowrap"},yn={key:1,class:"text-sm text-gray-500"},wn={key:"error",class:"px-4 py-2 bg-gray-100 flex items-center justify-center rounded-lg gap-2 text-red-500"},kn={class:"text-sm whitespace-nowrap"},xn={key:0,class:"mt-2 text-sm text-gray-500 italic"},bn=/* @__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=pn(),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}),S(()=>{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}=cn();return I(c,()=>{r.value=!1,l.value=!1}),(n,o)=>(f(),v("figure",{ref_key:"figureRef",ref:a,class:"text-center my-8"},[k("div",fn,[y(H,{name:"img-switch",mode:"out-in"},{default:P(()=>{var i,a,s,d,u;return[e.node.loading||l.value||!m.value?l.value?e.node.loading||t.fallbackSrc?O("",!0):(f(),v("div",wn,[R(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",kn,_(w(b)("image.loadError")),1)],!0)])):(f(),v("div",{key:"placeholder",class:"placeholder-layer max-w-96 inline-flex items-center justify-center gap-2",style:D(h.value?{minHeight:t.svgMinHeight,width:"100%"}:{minHeight:"6rem"})},[t.usePlaceholder?R(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",gn,_(w(b)("image.loading")),1)],!0):(f(),v("span",yn,_(e.node.raw),1))],4)):(f(),v("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:D(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,vn))]}),_:3})]),t.showCaption&&t.node.alt?(f(),v("figcaption",xn,_(t.node.alt),1)):O("",!0)],512))}}),[["__scopeId","data-v-7ca79b66"]]);bn.install=e=>{e.component(bn.__name,bn)};let _n=null,Mn=!1,Tn=In;function Cn(e){var n;const t=null!=(n=null==e?void 0:e.default)?n:e;return t&&"function"==typeof t.renderToString?t:null}function Bn(){try{const e=globalThis;return Cn(null==e?void 0:e.katex)}catch(e){return null}}function In(){return u(null,null,function*(){const e=Bn();if(e)return e;const n=yield import("katex");try{yield import("katex/dist/contrib/mhchem")}catch(t){}return Cn(n)})}function $n(e){Tn=e,_n=null,Mn=!1}function Sn(e){$n(null!=e?e:In)}function En(){$n(null)}function Ln(){return"function"==typeof Tn}function jn(){return u(this,null,function*(){var e;const n=Bn();if(n)return _n=n,_n;if(_n)return _n;if(Mn)return null;const t=Tn;if(!t)return Mn=!0,null;try{const n=yield t();if(n)return _n=null!=(e=Cn(n))?e:n,_n}catch(o){}return Mn=!0,null})}const Nn=M(!1);let Hn=null;function Pn(){return Hn||(Hn=jn().then(e=>{Nn.value=!!e}).catch(()=>{Nn.value=!1})),K(Nn)}const Dn=/* @__PURE__ */le(/* @__PURE__ */p({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const n=Pn();return(t,o)=>(f(),v("span",{class:E([[w(n)&&e.node.center?"text-node-center":""],"whitespace-pre-wrap break-words text-node"])},_(e.node.content),3))}}),[["__scopeId","data-v-56f30838"]]);Dn.install=e=>{e.component(Dn.__name,Dn)};const Rn=z(()=>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(Dn,s(a({},e),{node:s(a({},e.node),{content:null!=(t=e.node.raw)?t:`$${null!=(n=e.node.content)?n:""}$`})}))};try{if(yield jn())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(Dn,s(a({},e),{node:s(a({},e.node),{content:null!=(t=e.node.raw)?t:`$${null!=(n=e.node.content)?n:""}$`})}))}})),On=z(()=>u(null,null,function*(){try{if(yield jn())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(Dn,s(a({},e),{node:s(a({},e.node),{content:null!=(t=e.node.raw)?t:`$$${null!=(n=e.node.content)?n:""}$$`})}))}})),Kn=/* @__PURE__ */p({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(n,t)=>(f(),v("span",{class:"reference-node cursor-pointer bg-[hsl(var(--muted))] 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))},_(e.node.id),33))});Kn.install=e=>{e.component(Kn.__name,Kn)};const zn={class:"superscript-node"},An={key:1},Wn=/* @__PURE__ */le(/* @__PURE__ */p({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=xe(n.customId),o=a({text:Dn,inline_code:Ue,link:tt,html_inline:Fe,strong:qn,emphasis:st,footnote_reference:Ce,strikethrough:Yn,highlight:it,insert:rt,subscript:Un,emoji:fe,math_inline:Rn,reference:Kn},t);return(t,r)=>(f(),v("sup",zn,[(f(!0),v(x,null,b(e.node.children,(t,r)=>(f(),v(x,{key:`${e.indexKey||"superscript"}-${r}`},[o[t.type]?(f(),A(W(o[t.type]),{key:0,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"superscript"}-${r}`},null,8,["node","custom-id","index-key"])):(f(),v("span",An,_(t.content||t.raw),1))],64))),128))]))}}),[["__scopeId","data-v-6dc1e3ba"]]);Wn.install=e=>{e.component(Wn.__name,Wn)};const Fn={class:"subscript-node"},Vn={key:1},Un=/* @__PURE__ */le(/* @__PURE__ */p({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=xe(n.customId),o=a({text:Dn,inline_code:Ue,link:tt,html_inline:Fe,strong:qn,emphasis:st,footnote_reference:Ce,strikethrough:Yn,highlight:it,insert:rt,superscript:Wn,emoji:fe,math_inline:Rn,reference:Kn},t);return(t,r)=>(f(),v("sub",Fn,[(f(!0),v(x,null,b(e.node.children,(t,r)=>(f(),v(x,{key:`${e.indexKey||"subscript"}-${r}`},[o[t.type]?(f(),A(W(o[t.type]),{key:0,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"subscript"}-${r}`},null,8,["node","custom-id","index-key"])):(f(),v("span",Vn,_(t.content||t.raw),1))],64))),128))]))}}),[["__scopeId","data-v-69de9b81"]]);Un.install=e=>{e.component(Un.__name,Un)};const Xn={class:"strong-node"},qn=/* @__PURE__ */le(/* @__PURE__ */p({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=xe(n.customId),o=a({text:Dn,inline_code:Ue,link:tt,html_inline:Fe,emphasis:st,strikethrough:Yn,highlight:it,insert:rt,subscript:Un,superscript:Wn,emoji:fe,footnote_reference:Ce,math_inline:Rn,reference:Kn},t);return(t,r)=>(f(),v("strong",Xn,[(f(!0),v(x,null,b(e.node.children,(t,r)=>(f(),A(W(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"]]);qn.install=e=>{e.component(qn.__name,qn)};const Gn={class:"strikethrough-node"},Yn=/* @__PURE__ */le(/* @__PURE__ */p({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=xe(n.customId),o=a({text:Dn,inline_code:Ue,link:tt,html_inline:Fe,strong:qn,emphasis:st,highlight:it,insert:rt,subscript:Un,superscript:Wn,emoji:fe,footnote_reference:Ce,math_inline:Rn,reference:Kn},t);return(t,r)=>(f(),v("del",Gn,[(f(!0),v(x,null,b(e.node.children,(t,r)=>(f(),A(W(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"]]);Yn.install=e=>{e.component(Yn.__name,Yn)};const Zn=["href","title","aria-label","aria-hidden"],Jn=["aria-hidden"],Qn={class:"link-text-wrapper relative inline-flex"},et={class:"leading-[normal] link-text"},nt={class:"leading-[normal] link-text"},tt=/* @__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=j("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";return{"--link-color":null!=(e=n.color)?e:"#0366d6","--underline-height":`${null!=(t=n.underlineHeight)?t:2}px`,"--underline-bottom":a,"--underline-opacity":String(null!=(o=n.animationOpacity)?o:.9),"--underline-duration":`${null!=(r=n.animationDuration)?r:.8}s`,"--underline-timing":null!=(l=n.animationTiming)?l:"linear","--underline-iteration":"number"==typeof n.animationIteration?String(n.animationIteration):null!=(i=n.animationIteration)?i:"infinite"}}),l={text:Dn,strong:qn,strikethrough:Yn,emphasis:st,image:bn,html_inline:Fe,inline_code:Ue},i=C(()=>(we.value,xe(n.customId))),s=F(),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&&sn()}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)=>e.node.loading?(f(),v("span",V({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",Qn,[k("span",et,[k("span",nt,_(e.node.text),1)]),a[1]||(a[1]=k("span",{class:"underline-anim","aria-hidden":"true"},null,-1))])],16,Jn)):(f(),v("a",V({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)||"";an(e.currentTarget,s,"top",!1,a)}(e)),onMouseleave:c}),[(f(!0),v(x,null,b(e.node.children,(t,o)=>(f(),A(W(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,Zn))}}),[["__scopeId","data-v-c59222d4"]]);tt.install=e=>{e.component(tt.__name,tt)};const ot={class:"insert-node"},rt=/* @__PURE__ */le(/* @__PURE__ */p({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=xe(n.customId),o=a({text:Dn,inline_code:Ue,link:tt,html_inline:Fe,strong:qn,emphasis:st,strikethrough:Yn,highlight:it,subscript:Un,superscript:Wn,emoji:fe,footnote_reference:Ce,math_inline:Rn,reference:Kn},t);return(t,r)=>(f(),v("ins",ot,[(f(!0),v(x,null,b(e.node.children,(t,r)=>(f(),A(W(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"]]);rt.install=e=>{e.component(rt.__name,rt)};const lt={class:"highlight-node"},it=/* @__PURE__ */le(/* @__PURE__ */p({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=xe(n.customId),o=a({text:Dn,inline_code:Ue,link:tt,html_inline:Fe,strong:qn,emphasis:st,strikethrough:Yn,insert:rt,subscript:Un,superscript:Wn,emoji:fe,footnote_reference:Ce,math_inline:Rn,reference:Kn},t);return(t,r)=>(f(),v("mark",lt,[(f(!0),v(x,null,b(e.node.children,(t,r)=>(f(),A(W(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"]]);it.install=e=>{e.component(it.__name,it)};const at={class:"emphasis-node"},st=/* @__PURE__ */le(/* @__PURE__ */p({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=xe(n.customId),o=a({text:Dn,inline_code:Ue,link:tt,html_inline:Fe,strong:qn,strikethrough:Yn,highlight:it,insert:rt,subscript:Un,superscript:Wn,emoji:fe,footnote_reference:Ce,math_inline:Rn,reference:Kn},t);return(t,r)=>(f(),v("em",at,[(f(!0),v(x,null,b(e.node.children,(t,r)=>(f(),A(W(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"]]);st.install=e=>{e.component(st.__name,st)};const dt=["href","title"],ut=/* @__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)=>(f(),v("a",{class:"footnote-anchor text-sm text-[#0366d6] hover:underline cursor-pointer",href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:t}," ↩︎ ",8,dt))}}),[["__scopeId","data-v-4756ce0d"]]);ut.install=e=>{e.component(ut.__name,ut)};const ct=["id"],mt={class:"flex-1"},ht=/* @__PURE__ */p({__name:"FootnoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(f(),v("div",{id:`fnref--${e.node.id}`,class:"flex mt-2 mb-2 text-sm leading-relaxed border-t border-[#eaecef] pt-2"},[k("div",mt,[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,ct))}});ht.install=e=>{e.component(ht.__name,ht)};const pt={class:"hard-break"},ft=/* @__PURE__ */le(/* @__PURE__ */p({__name:"HardBreakNode",props:{node:{}},setup:e=>(e,n)=>(f(),v("br",pt))}),[["__scopeId","data-v-50c58f70"]]);ft.install=e=>{e.component(ft.__name,ft)};const vt=/* @__PURE__ */le(/* @__PURE__ */p({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=xe(n.customId),o=a({text:Dn,inline_code:Ue,link:tt,image:bn,strong:qn,emphasis:st,strikethrough:Yn,highlight:it,insert:rt,subscript:Un,superscript:Wn,emoji:fe,checkbox:de,checkbox_input:de,footnote_reference:Ce,hardbreak:ft,math_inline:Rn,reference:Kn},t);return(t,r)=>g([e.node.level,e.node.children,e.node.attrs],()=>(f(),A(W(`h${e.node.level}`),V({class:["heading-node",[`heading-${e.node.level}`]],dir:"auto"},e.node.attrs),{default:P(()=>[(f(!0),v(x,null,b(e.node.children,(t,r,l,i)=>{const a=[t];if(i&&i.key===`${e.indexKey||"heading"}-${r}`&&U(i,a))return i;const s=(f(),A(W(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"]]),gt=vt;gt.install=e=>{e.component(vt.__name,vt)};const yt=/* @__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 f(),v("li",V({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),V({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"]]);yt.install=e=>{e.component(yt.__name,yt)};const wt=/* @__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||yt));return(t,o)=>(f(),A(W(e.node.ordered?"ol":"ul"),{class:E(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:P(()=>[(f(!0),v(x,null,b(e.node.items,(r,l,i,a)=>{var s;const d=[r];if(a&&a.key===`${e.indexKey||"list"}-${l}`&&U(a,d))return a;const u=(f(),A(W(n.value),V({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"]]);wt.install=e=>{e.component(wt.__name,wt)};const kt={key:1,class:"html-block-node__raw"},xt={key:1,class:"html-block-node__placeholder"},bt=/* @__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=We(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=We(l,o.value);return null===s?{mode:"html",content:l}:{mode:"dynamic",nodes:s}}),d=pn(),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,S(()=>{var e,n;null==(n=null==(e=u.value)?void 0:e.destroy)||n.call(e),u.value=null}),(n,o)=>(f(),v("div",V({ref_key:"htmlRef",ref:l,class:"html-block-node"},t.value),[i.value?(f(),v(x,{key:0},["dynamic"===s.value.mode?(f(),A(w(r),{key:0,nodes:s.value.nodes},null,8,["nodes"])):"text"===s.value.mode?(f(),v("pre",kt,_(s.value.content),1)):g([a.value],()=>(f(),v("div",{key:2,innerHTML:a.value},null,8,["innerHTML"])),o,0)],64)):(f(),v("div",xt,[R(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"]]);bt.install=e=>{e.component(bt.__name,bt)};const _t={dir:"auto",class:"paragraph-node"},Mt=/* @__PURE__ */le(/* @__PURE__ */p({__name:"ParagraphNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=xe(n.customId),o=a({inline_code:Ue,image:bn,link:tt,hardbreak:ft,emphasis:st,strong:qn,strikethrough:Yn,highlight:it,insert:rt,subscript:Un,superscript:Wn,html_inline:Fe,html_block:bt,emoji:fe,checkbox:de,math_inline:Rn,checkbox_input:de,reference:Kn,footnote_anchor:ut,footnote_reference:Ce},t),r=Pn();return(t,l)=>(f(),v("p",_t,[(f(!0),v(x,null,b(e.node.children,(t,l)=>(f(),v(x,{key:`${e.indexKey||"paragraph"}-${l}`},["text"!==t.type?(f(),A(W(o[t.type]),{key:0,node:t,"index-key":`${e.indexKey}-${l}`,"custom-id":n.customId},null,8,["node","index-key","custom-id"])):(f(),v("span",{key:1,class:E([[w(r)&&t.center?"text-node-center":""],"whitespace-pre-wrap break-words text-node"])},_(t.content),3))],64))),128))]))}}),[["__scopeId","data-v-4e2afdbc"]]);Mt.install=e=>{e.component(Mt.__name,Mt)};const Tt=["aria-busy","aria-label","data-language"],Ct=["textContent"],Bt=/* @__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)=>(f(),v("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:_(e.node.code)},null,8,Ct)],10,Tt))}});Bt.install=e=>{e.component(Bt.__name,Bt)};const It={class:"table-node-wrapper"},$t=["aria-busy"],St={class:"border-[var(--table-border,#cbd5e1)]"},Et={class:"border-b"},Lt={key:0,class:"table-node__loading",role:"status","aria-live":"polite"},jt=/* @__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)=>(f(),v("div",It,[k("table",{class:E(["my-8 text-sm table-node",{"table-node--loading":t.value}]),"aria-busy":t.value},[k("thead",St,[k("tr",Et,[(f(!0),v(x,null,b(e.node.header.cells,(e,t)=>(f(),v("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,[(f(!0),v(x,null,b(o.value,(e,t)=>(f(),v("tr",{key:`row-${t}`,class:E(["border-[var(--table-border,#cbd5e1)]",[t<o.value.length-1?"border-b":""]])},[(f(!0),v(x,null,b(e.cells,(e,o)=>(f(),v("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,$t),y(H,{name:"table-node-fade"},{default:P(()=>[t.value?(f(),v("div",Lt,[R(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)])):O("",!0)]),_:3})]))}}),[["__scopeId","data-v-369096fa"]]);jt.install=e=>{e.component(jt.__name,jt)};const Nt={class:"hr-node"},Ht=/* @__PURE__ */le({},[["render",function(e,n){return f(),v("hr",Nt)}],["__scopeId","data-v-639cbad9"]]);Ht.install=e=>{e.component(Ht.__name,Ht)};const Pt={class:"unknown-node"},Dt=/* @__PURE__ */p({__name:"FallbackComponent",props:{node:{}},setup:e=>(n,t)=>(f(),v("div",Pt,_(e.node.raw),1))}),Rt=/* @__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:Dn,paragraph:Mt,heading:gt,inline_code:Ue,link:tt,image:bn,strong:qn,emphasis:st,strikethrough:Yn,insert:rt,subscript:Un,superscript:Wn,checkbox:de,checkbox_input:de,hardbreak:ft,math_inline:Rn,reference:Kn,list:wt,math_block:On,table:jt},o);return(o,l)=>(f(),v("div",V({class:t.value},e.node.attrs),[(f(!0),v(x,null,b(e.node.children,(t,o,l,i)=>{const a=[t];if(i&&i.key===`${e.indexKey||"vmr-container"}-${o}`&&U(i,a))return i;const s=(f(),A(W((d=t.type,r[d]||Dt)),{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"]]);Rt.install=e=>{e.component(Rt.__name,Rt)};const Ot=["data-custom-id"],Kt=["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=F(),k=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 M(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;){const e=window.getComputedStyle(r),n=(e.overflowY||"").toLowerCase(),t=(e.overflow||"").toLowerCase();if(p.test(n)||p.test(t))return r;r=r.parentElement}return null}N("markstreamShowTooltips",k);const T=l.customId?`renderer-${l.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,$=c(T),L=/* @__PURE__ */new Map,j=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=K(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 $;const t=L.get(e);if(t)return t;const o=c(T,{customHtmlTags:n});return L.set(e,o),o}),R=C(()=>{const e=j.value;return l.customMarkdownIt?l.customMarkdownIt(e):e});function K(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 U=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(K).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}),Y=C(()=>{var e;if(null==(e=l.nodes)?void 0:e.length)return X(l.nodes.slice());if(l.content){const e=y.value?performance.now():0,n=m(l.content,R.value,U.value);return y.value&&_("parse(sync)",{ms:Math.round(performance.now()-e),nodes:n.length,contentLength:l.content.length}),X(n)}return[]}),Z=C(()=>{var e;return Math.max(1,null!=(e=l.maxLiveNodes)?e:320)}),J=C(()=>{var e;return!((null!=(e=l.maxLiveNodes)?e:0)<=0)&&Y.value.length>Z.value}),Q=C(()=>!1!==l.viewportPriority&&!h.value),ee=hn(e=>{var n;return M(null!=(n=null!=e?e:d.value)?n:null)},Q),ne=g&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame.bind(window):null,te=g&&"function"==typeof window.cancelAnimationFrame?window.cancelAnimationFrame.bind(window):null,oe="undefined"!=typeof globalThis&&void 0!==globalThis.process&&"test"===(null==(o=null==(t=globalThis.process)?void 0:t.env)?void 0:o.NODE_ENV),re=g&&"function"==typeof window.requestIdleCallback,le=C(()=>{var e;const n=Math.trunc(null!=(e=l.renderBatchSize)?e:80);return Number.isFinite(n)?Math.max(0,n):0}),ae=C(()=>{var e;const n=Math.trunc(null!=(e=l.initialRenderBatchSize)?e:le.value);return Number.isFinite(n)?Math.max(0,n):le.value}),se=C(()=>!1!==l.batchRendering&&le.value>0&&g&&!oe),ue=B(0),ce=B({key:l.indexKey,total:0}),me=B(Math.max(1,le.value||1)),pe=q({}),ve=/* @__PURE__ */new Map,ge=/* @__PURE__ */new Map,ye=/* @__PURE__ */new Map,ke=/* @__PURE__ */new WeakMap,be=B(0),_e=C(()=>(be.value,Array.from(ye.entries()).sort((e,n)=>e[0]-n[0]))),Me=B(0),Te=B([]),Be=B([]),Ie=B(null);let $e=null,Se=null;const Ee=C(()=>{var e;return!1!==l.deferNodesUntilVisible&&!((null!=(e=l.maxLiveNodes)?e:0)<=0)&&!J.value&&!(Y.value.length>900)&&Q.value}),Le=C(()=>{var e;return se.value&&(null!=(e=l.maxLiveNodes)?e:0)<=0}),je=B({batchSize:le.value,initial:ae.value,delay:null!=(r=l.renderBatchDelay)?r:16,enabled:Le.value}),Ne=C(()=>!!ee&&(Ee.value||J.value)),He=C(()=>{var e;return Math.max(0,null!=(e=l.liveNodeBuffer)?e:60)}),Pe=B(0),De=q({start:0,end:0}),Re=/* @__PURE__ */new Map,Oe=C(()=>{if(!J.value)return Y.value.length;const e=He.value,n=Math.max(De.end+e,ae.value),t=Math.min(Y.value.length,n);return Math.max(ue.value,t)});function Ke(e){var n,t,o,r;const l=M(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 ze(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 Ae(){$e&&($e(),$e=null),Ie.value=null}function We(){if(!g||!J.value)return;const e=Ke();if(!e||Ie.value===e)return;Ae();const n=()=>Xe();e.addEventListener("scroll",n,{passive:!0}),Ie.value=e,$e=()=>{e.removeEventListener("scroll",n)}}function Ve(){var e,n,t;if(!Se)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;Se.viaTimeout?o?o.clearTimeout(Se.id):clearTimeout(Se.id):null==te||te(Se.id),Se=null}function Xe(e={}){var n,t,o;if(!J.value)return;if(!g)return void qe(!0);if(e.immediate)return Ve(),void qe(!0);if(Se)return;const r=()=>{Se=null,qe()};if(ne)Se={id:ne(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);Se={id:l,viaTimeout:!0}}}function qe(e=!1){var n,t,o,r,l,i,a;if(!J.value)return;const s=Ie.value||Ke();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=Y.value.length;if(!m&&h>0&&ze(s)){const n=s.clientHeight||0,t=s.scrollTop,o=t<0?-t:t,r=function(e){var n;const t=Y.value;if(!t.length)return 0;if(e<=0)return Math.max(0,t.length-1);if(Me.value===t.length){const n=rn(0,t.length);return dn(Math.max(0,n-e))}let o=e;for(let r=t.length-1;r>=0;r--){const e=null!=(n=Ye[r])?n:on.value;if(o<=e)return r;o-=e}return 0}(Math.max(0,o)+.5*Math.max(0,n)),l=Ge(r,0,Math.max(0,h-1));return void((e||Math.abs(l-Pe.value)>1)&&(Pe.value=l))}const p=m?null:s.getBoundingClientRect(),f=m?0:p.top,v=m?null!=(o=null!=(t=null==c?void 0:c.innerHeight)?t:s.clientHeight)?o:0:p.bottom,g=_e.value;let y=null,w=null;for(const[d,x]of g){if(!x)continue;const e=x.getBoundingClientRect();e.bottom<=f||e.top>=v||(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(!ze(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=dn(o+.5*Math.max(0,h));return void(Pe.value=Ge(p,0,Math.max(0,Y.value.length-1)))}const k=Math.round((y+w)/2);!e&&Math.abs(k-Pe.value)<=1||(Pe.value=Ge(k,0,Math.max(0,Y.value.length-1)))}function Ge(e,n,t){return Math.min(Math.max(e,n),t)}const Ye=q({}),Ze=q({total:0,count:0});function Je(){for(const e of Object.keys(Ye))delete Ye[Number(e)];Ze.total=0,Ze.count=0,Me.value=0,Te.value=[],Be.value=[]}function Qe(e,n,t){for(let o=n+1;o<e.length;o+=o&-o)e[o]+=t}function en(e,n){let t=0;for(let o=n+1;o>0;o-=o&-o)t+=e[o];return t}function nn(e,n,t){if(t<=n)return 0;const o=en(e,t-1);return n<=0?o:o-en(e,n-1)}function tn(e){Me.value=e;const n=new Array(e+1).fill(0),t=new Array(e+1).fill(0);for(const[o,r]of Object.entries(Ye)){const l=Number(o),i=Number(r);!Number.isFinite(l)||l<0||l>=e||!Number.isFinite(i)||i<=0||(Qe(n,l,i),Qe(t,l,1))}Te.value=n,Be.value=t}const on=C(()=>Ze.count>0?Math.max(12,Ze.total/Ze.count):32);function rn(e,n){var t,o;if(e>=n)return 0;if(Me.value!==Y.value.length){let o=0;for(let r=e;r<n;r++)o+=null!=(t=Ye[r])?t:on.value;return o}const r=Te.value,l=Be.value;if(!r.length||!l.length){let t=0;for(let r=e;r<n;r++)t+=null!=(o=Ye[r])?o:on.value;return t}return nn(r,e,n)+(n-e-nn(l,e,n))*on.value}I(()=>Y.value.length,e=>{e<=0?Je():(e<Me.value&&function(e){if(e<=0)return void Je();let n=0,t=0;for(const[o,r]of Object.entries(Ye)){const l=Number(o),i=Number(r);!Number.isFinite(l)||l<0||l>=e||!Number.isFinite(i)||i<=0?delete Ye[l]:(n+=i,t++)}Ze.total=n,Ze.count=t}(e),e!==Me.value&&tn(e))},{immediate:!0});const ln=C(()=>{if(!J.value)return Y.value.map((e,n)=>({node:e,index:n}));const e=Y.value.length,n=Ge(De.start,0,e),t=Ge(De.end,n,e);return Y.value.slice(n,t).map((e,t)=>({node:e,index:n+t}))}),an=C(()=>J.value?rn(0,Math.min(De.start,Y.value.length)):0),sn=C(()=>{if(!J.value)return 0;const e=Y.value.length;return rn(Math.min(De.end,e),e)});function dn(e){var n;if(e<=0)return 0;const t=Y.value;if(Me.value===t.length&&Te.value.length&&Be.value.length){const n=on.value,o=Te.value,r=Be.value,l=e=>e<=0?0:en(o,e-1)+(e-en(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=Ye[r])?n:on.value;if(o<=e)return r;o-=e}return Math.max(0,t.length-1)}function un(){be.value+=1}function cn(e){if(!ve.size)return;if(!J.value)return;let n=!1;for(const[t,o]of ve)t>=e&&(o.destroy(),ve.delete(t),Ee.value&&delete pe[t],_n(t),ye.delete(t)&&(n=!0));n&&un()}function mn(e,n){Ee.value&&(pe[e]=n),n&&(J.value?Xe():Pe.value=Ge(e,0,Math.max(0,Y.value.length-1)))}function pn(e){const n=ve.get(e);n&&(n.destroy(),ve.delete(e)),_n(e)}function fn(e,n){let t=!1;if(n){const o=ye.get(e);ye.set(e,n),o!==n&&(t=!0)}else ye.delete(e)&&(t=!0);if(t&&un(),n||_n(e),!Ne.value||!ee)return pn(e),void(n?mn(e,!0):Ee.value&&delete pe[e]);if(!J.value&&Ee.value&&!h.value&&ve.size>=640&&(function(){if(!h.value){h.value=!0;for(const e of ve.values())e.destroy();if(ve.clear(),g)for(const e of ge.values())window.clearTimeout(e);ge.clear();for(const e of Object.keys(pe))delete pe[e]}}(),!Ne.value||!ee))return pn(e),void(n?mn(e,!0):Ee.value&&delete pe[e]);if(e<ae.value&&!J.value)return pn(e),void mn(e,!0);if(!n)return pn(e),void(Ee.value&&delete pe[e]);pn(e);const o=ee(n,{rootMargin:"400px"});o&&(ve.set(e,o),mn(e,o.isVisible.value),Ee.value&&function(e){if(!g||!Ee.value)return;_n(e);const n=e%17*23,t=window.setTimeout(()=>{var n,t;if(ge.delete(e),!Ee.value)return;if(!0===pe[e])return;const o=ye.get(e);if(!o)return void delete pe[e];const r=Ke(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&&mn(e,!0)},1800+n);ge.set(e,t)}(e),o.whenVisible.then(()=>{_n(e),mn(e,!0)}).catch(()=>{}).finally(()=>{ve.get(e)===o&&ve.delete(e);try{o.destroy()}catch(n){}}),J.value&&Xe())}let vn=null,gn=null,yn=!1,wn=null,kn=null;function xn(){g&&(null!=vn&&(null==te||te(vn),vn=null),null!=gn&&(window.clearTimeout(gn),gn=null),null!=kn&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(kn),kn=null),yn=!1,wn=null)}function _n(e){if(!g)return;const n=ge.get(e);null!=n&&(window.clearTimeout(n),ge.delete(e))}function Mn(e,n={}){var t,o;if(!Le.value)return;const r=Oe.value;if(ue.value>=r)return;const i=Math.max(1,e),a=e=>{var n;vn=null,gn=null,kn=null,yn=!1;const t=null!=wn?wn:i;wn=null;const o=Math.max(2,null!=(n=l.renderBatchBudgetMs)?n:6),a=e=>{const n="undefined"!=typeof performance?performance.now():Date.now();ue.value=Math.min(r,ue.value+Math.max(1,e)),cn(ue.value);const t=("undefined"!=typeof performance?performance.now():Date.now())-n;return function(e){var n;if(!Le.value)return;const t=Math.max(2,null!=(n=l.renderBatchBudgetMs)?n:6),o=Math.max(1,le.value||1),r=Math.max(1,Math.floor(o/4));e>1.2*t?me.value=Math.max(r,Math.floor(.7*me.value)):e<.5*t&&me.value<o&&(me.value=Math.min(o,Math.ceil(1.2*me.value)))}(t),t};let s=t;for(;(a(s),!(ue.value>=r)&&e)&&!(("function"==typeof e.timeRemaining?e.timeRemaining():0)<=.5*o);)s=Math.max(1,Math.round(me.value));ue.value<r&&Tn()};if(!g||n.immediate)return void a();const s=Math.max(0,null!=(t=l.renderBatchDelay)?t:16);if(wn=null!=wn?Math.max(wn,i):i,!yn){if(yn=!0,!oe&&re&&window.requestIdleCallback){const e=Math.max(0,null!=(o=l.renderBatchIdleTimeoutMs)?o:120);return void(kn=window.requestIdleCallback(e=>{a(e)},{timeout:e}))}ne&&!oe?vn=ne(()=>{0!==s?gn=window.setTimeout(()=>a(),s):a()}):gn=window.setTimeout(()=>a(),s)}}function Tn(){Le.value&&Mn(se.value?Math.max(1,Math.round(me.value)):Math.max(1,le.value))}I([()=>Y.value,()=>Y.value.length,()=>Le.value,()=>le.value,()=>ae.value,()=>l.renderBatchDelay,()=>l.indexKey],()=>{var e;const n=Y.value.length,t=ce.value,o=l.indexKey,r=void 0!==o&&o!==t.key,i=n!==t.total,a=r||i;ce.value={key:o,total:n};const s=je.value,d=null!=(e=l.renderBatchDelay)?e:16,u=s.batchSize!==le.value||s.initial!==ae.value||s.delay!==d||s.enabled!==Le.value;je.value={batchSize:le.value,initial:ae.value,delay:d,enabled:Le.value},r&&(Je(),n>0&&tn(n)),(a||u||!Le.value)&&xn(),(a||u)&&(me.value=Math.max(1,le.value||1)),a&&J.value&&Xe({immediate:!0});const c=Oe.value;if(!n)return ue.value=0,void cn(0);if(!Le.value)return ue.value=c,void cn(ue.value);const m=r||0===t.total;ue.value=m||u?Math.min(c,ae.value):Math.min(ue.value,c);const h=Math.max(1,ae.value||le.value||n);ue.value<c?Mn(h,{immediate:!g}):cn(ue.value)},{immediate:!0}),I(()=>J.value,e=>{if(!e)return Ae(),void Ve();We(),Xe({immediate:!0})},{immediate:!0}),I([()=>Y.value.length,()=>J.value],e=>u(null,[e],function*([e,n]){n&&e&&g&&(yield G(),Xe({immediate:!0}))}),{flush:"post"}),I(()=>d.value,()=>{J.value&&(We(),Xe({immediate:!0}))}),I(()=>Y.value.length,()=>{J.value&&Xe({immediate:!0})}),I(()=>Ee.value,e=>{if(e)for(const[n,t]of ye)fn(n,t);else{for(const e of ve.values())e.destroy();ve.clear();for(const e of Array.from(ge.keys()))_n(e);for(const e of Object.keys(pe))delete pe[e];for(const[e,n]of ye)n&&mn(e,!0)}},{immediate:!1}),I([()=>l.viewportPriority,()=>Y.value.length],([e,n])=>{!1!==e?h.value&&n<=200&&(h.value=!1):h.value=!1}),I(()=>ue.value,()=>{J.value&&Xe({immediate:!0})}),I([Pe,Z,He,()=>Y.value.length,J],()=>{!function(){const e=Y.value.length;if(!J.value||0===e)return De.start=0,void(De.end=e);const n=Math.min(Z.value,e),t=He.value,o=Ge(Pe.value-t,0,Math.max(0,e-n));De.start=o,De.end=Math.min(e,o+n)}()},{immediate:!0}),I([()=>Y.value.length,J,Z,He,()=>De.start,()=>De.end],([e,n,t,o,r,l])=>{y.value&&_("virtualization",{nodes:e,virtualization:n,maxLiveNodes:t,buffer:o,focusIndex:Pe.value,scroll:n?(()=>{const e=Ie.value||Ke();return e?{reverse:ze(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:ue.value})}),I(()=>Oe.value,(e,n)=>{Le.value&&("number"==typeof n&&e<=n||e>ue.value&&Tn())}),S(()=>{xn();for(const e of ve.values())e.destroy();ve.clear();for(const e of Array.from(ge.keys()))_n(e);Ae(),Ve()});const Cn=z(()=>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),Bt}})),Bn=z(()=>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),Bt}})),In=z(()=>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),Bt}})),$n=z(()=>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),Bt}})),Sn=C(()=>l.renderCodeBlocksAsPre?Bt:Cn),En={text:Dn,paragraph:Mt,heading:gt,code_block:Cn,list:wt,list_item:yt,blockquote:ie,table:jt,definition_list:he,footnote:ht,footnote_reference:Ce,footnote_anchor:ut,admonition:qt,vmr_container:Rt,hardbreak:ft,link:tt,image:bn,thematic_break:Ht,math_inline:Rn,math_block:On,strong:qn,emphasis:st,strikethrough:Yn,highlight:it,insert:rt,subscript:Un,superscript:Wn,emoji:fe,checkbox:de,checkbox_input:de,inline_code:Ue,html_inline:Fe,reference:Kn,html_block:bt},Ln=C(()=>(we.value,xe(l.customId))),jn=C(()=>null!=l.indexKey?String(l.indexKey):"markdown-renderer"),Nn=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 k.value?{showTooltips:k.value}:{}),l.codeBlockProps||{})),Hn=C(()=>a({},l.mermaidProps||{})),Pn=C(()=>a({},l.d2Props||{})),zn=C(()=>a({},l.infographicProps||{})),An=C(()=>({typewriter:l.typewriter})),Fn=C(()=>a(a({},An.value),"boolean"==typeof k.value?{showTooltip:k.value}:{})),Vn=C(()=>a(a({},An.value),"boolean"==typeof k.value?{showTooltips:k.value}:{})),Xn=C(()=>ln.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=ke.get(d);if(c&&c.signature===u)return c.node;const m=a({},d);return ke.set(d,{signature:u,node:m}),m}(e.node),t=Gn(n);return s(a({},e),{node:n,component:Zn(n,t),bindings:Jn(n,t),isCodeBlock:"code_block"===n.type,indexKey:`${jn.value}-${e.index}`})}));function Gn(e){var n;return"code_block"===(null==e?void 0:e.type)?String(null!=(n=e.language)?n:"").trim().toLowerCase():""}function Zn(e,n){if(!e)return Dt;const t=Ln.value,o=t[String(e.type)];if("code_block"===e.type){const r=null!=n?n:Gn(e);if("mermaid"===r)return t.mermaid||Bn;if("infographic"===r)return t.infographic||In;if("d2"===r||"d2lang"===r)return t.d2||$n;if(o)return o;return t.code_block||Sn.value}return o||En[String(e.type)]||Dt}function Jn(e,n){const t=null!=n?n:Gn(e);return"mermaid"===t?Hn.value:"infographic"===t?zn.value:"d2"===t||"d2lang"===t?Pn.value:"link"===e.type?Fn.value:"list"===e.type?Vn.value:"code_block"===e.type?Nn.value:An.value}function Qn(e){i("click",e)}function et(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&i("mouseover",e)}function nt(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&i("mouseout",e)}return(e,n)=>(f(),v("div",{ref_key:"containerRef",ref:d,class:E(["markstream-vue markdown-renderer",[{dark:l.isDark},{virtualized:J.value}]]),"data-custom-id":l.customId,onClick:Qn,onMouseover:et,onMouseout:nt},[J.value?(f(),v("div",{key:0,class:"node-spacer",style:D({height:`${an.value}px`}),"aria-hidden":"true"},null,4)):O("",!0),(f(!0),v(x,null,b(Xn.value,e=>{var t,o;return f(),v("div",{key:e.index,ref_for:!0,ref:n=>fn(e.index,n),class:"node-slot","data-node-index":e.index,"data-node-type":e.node.type},[(o=e.index,Le.value&&o>=ue.value||Ee.value&&!(o<ae.value)&&!0!==pe[o]?(f(),v("div",{key:1,class:"node-placeholder",style:D({height:`${null!=(t=Ye[e.index])?t:on.value}px`})},null,4)):(f(),v("div",{key:0,ref_for:!0,ref:n=>function(e,n){n?(Re.set(e,n),queueMicrotask(()=>{!function(e,n){if(!Number.isFinite(n)||n<=0)return;const t=Ye[e];if(Ye[e]=n,t?Ze.total+=n-t:(Ze.total+=n,Ze.count++),Me.value>e){const o=Te.value,r=Be.value;if(o.length&&r.length)if(t){const r=n-t;0!==r&&Qe(o,e,r)}else Qe(o,e,n),Qe(r,e,1)}}(e,n.offsetHeight)})):Re.delete(e)}(e.index,n),class:"node-content"},[e.isCodeBlock||!1===l.typewriter?(f(),A(W(e.component),V({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"])):(f(),A(H,{key:0,name:"typewriter",appear:""},{default:P(()=>[(f(),A(W(e.component),V({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,Kt)}),128)),J.value?(f(),v("div",{key:1,class:"node-spacer",style:D({height:`${sn.value}px`}),"aria-hidden":"true"},null,4)):O("",!0)],42,Ot))}}),[["__scopeId","data-v-116eecac"]]);zt.install=e=>{var n,t;const o=null!=(t=null!=(n=zt.__name)?n:zt.name)?t:"NodeRenderer";e.component(o,zt)};const At={key:0,class:"admonition-icon"},Wt={class:"admonition-title"},Ft=["aria-expanded","aria-controls","title"],Vt={key:0},Ut={key:1},Xt=["id"],qt=/* @__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)=>(f(),v("div",{class:E(["admonition",[`admonition-${o.node.kind}`,o.isDark?"is-dark":""]])},[k("div",{id:d,class:"admonition-header"},[l[o.node.kind]?(f(),v("span",At,_(l[o.node.kind]),1)):O("",!0),k("span",Wt,_(i.value),1),o.node.collapsible?(f(),v("button",{key:1,class:"admonition-toggle","aria-expanded":!a.value,"aria-controls":`${d}-content`,title:a.value?"Expand":"Collapse",onClick:s},[a.value?(f(),v("span",Vt,"▶")):(f(),v("span",Ut,"▼"))],8,Ft)):O("",!0)]),Y(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,Xt),[[Z,!a.value]])],2))}}),[["__scopeId","data-v-5e95c2b7"]]);qt.install=e=>{e.component(qt.__name,qt)};const Gt=()=>import("@terrastruct/d2");let Yt=null,Zt=Gt;function Jt(e){Zt=e,Yt=null}function Qt(e){Jt(null!=e?e:Gt)}function eo(){Jt(null)}function no(){return"function"==typeof Zt}function to(){return u(this,null,function*(){if(Yt)return Yt;const e=Zt;if(!e)return null;let n;try{n=yield e()}catch(t){if(e===Gt)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw t}return n?(Yt=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),Yt):null})}let oo=!1,ro=null,lo=!1;function io(){return u(this,null,function*(){if(ro)return ro;if(lo)return null;try{return ro=yield import("stream-monaco"),yield function(e){return u(this,null,function*(){if(oo)return;oo=!0;const n=null==globalThis?void 0:globalThis.MonacoEnvironment;return!n||"function"!=typeof n.getWorker&&"function"!=typeof n.getWorkerUrl?e.preloadMonacoWorkers():void 0})}(ro),(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}})}(ro))?ro:(ro=null,lo=!0,null)}catch(e){return lo=!0,null}})}function ao({R:e,H:n=0,B:t=50}){const o=e*(1-n)||1e-6;return Math.max(1,Math.floor(t/o))}function so(e){const n=e.length+10*(e.match(/\\/g)||[]).length;return n<10?"simple":n<40?"medium":"complex"}function uo(e){switch(e){case"simple":return 3;case"medium":return 10;case"complex":return 30}}function co(e,n){var t,o;let r=0;for(const l of e){const e=uo(so(l));e>r&&(r=e)}return ao({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 mo='<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',ho='<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',po='<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 fo=null,vo=null,go=null;const yo=M(0),wo={"":po,plain:po,text:po,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:mo,csharp:mo,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:ho,powershell:ho,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'},ko={"":"",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 xo(){return u(this,null,function*(){return vo||(go||(go=import("./languageIconExtended.js").then(e=>(vo=e.EXTENDED_LANGUAGE_ICON_MAP,yo.value++,vo)).catch(()=>null)),go)})}function bo(e){fo=null!=e?e:null}function _o(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=ko[t])?n:t}function Mo(e){const n=_o(e);if(!n)return"plaintext";switch(n){case"plain":return"plaintext";case"jsx":return"javascript";case"tsx":return"typescript";default:return n}}function To(){return u(this,null,function*(){yield xo()})}function Co(e){if(fo){const n=fo(e);if(null!=n&&""!==n)return n}const n=_o(e),t=wo[n];if(t)return t;return(null==vo?void 0:vo[n])||(xo(),'<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 Bo={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"},Io=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 $o(){Io.enable()}function So(){Io.disable()}function Eo(){return Io.printReport()}function Lo(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch(n){}return globalThis.setTimeout(e,0)}function jo(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=Eo,window.__katexPerfMonitor=Io);const No={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)"}},Ho={class:"flex items-center gap-x-2"},Po=["innerHTML"],Do={class:"text-sm font-medium font-mono"},Ro={class:"flex items-center gap-x-2"},Oo=["aria-pressed"],Ko=["disabled"],zo=["disabled"],Ao=["disabled"],Wo=["aria-label"],Fo={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"},Vo={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"},Uo=["aria-pressed"],Xo={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"},qo={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"},Go=["aria-label"],Yo=["innerHTML"],Zo={class:"code-loading-placeholder"},Jo=/* @__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}=cn(),l=B(_o(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),M=B(b.value),T=C(()=>{const e=b.value,n=M.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 Bo[e]||e.charAt(0).toUpperCase()+e.slice(1)}),j=C(()=>(yo.value,Co(l.value.trim().toLowerCase().split(":")[0]))),N=C(()=>{const e=l.value.trim().toLowerCase();return t.isShowPreview&&("html"===e||"svg"===e)}),H=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}),P=C(()=>({fontSize:`${M.value}px`})),K=C(()=>!1!==t.showTooltips);function z(){return t.isDark?t.darkTheme:t.lightTheme}function A(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 W(){m.value="",h.value=!0}function F(){var e;const n=c.value;return!!n&&(n.childNodes.length>0||Boolean(null==(e=n.textContent)?void 0:e.trim().length))}function V(){return u(this,null,function*(){if(yield G(),F())return void W();const e=c.value;e&&(null==p||p.disconnect(),p=new MutationObserver(()=>{F()&&(W(),null==p||p.disconnect(),p=void 0)}),p.observe(e,{childList:!0,subtree:!0}))})}let U,X,q,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(!U)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 U.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 U.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(!X)try{const e=yield import("stream-markdown");X=e.createShikiStreamRenderer,q=e.registerHighlight;const n=Array.isArray(e.defaultLanguages)?e.defaultLanguages:void 0;J=n?new Set(n.map(e=>e.toLowerCase())):void 0,null==q||q({themes:t.themes})}catch(e){console.warn("[MarkdownCodeBlockNode] stream-markdown not available:",e)}})}(),d.value&&c.value?(null==q||q({themes:t.themes}),!U&&X&&(U=X(c.value,{theme:z()}),h.value=!0),U?!1===t.stream&&t.loading?A(t.node.code):(A(t.node.code),yield te(t.node.code,l.value),yield V()):A(t.node.code)):A(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;an(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&&sn()}function de(e){if(!K.value)return;const n=ie(e);if(!n)return;const o=e;an(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,G(()=>{e.scrollHeight>e.clientHeight&&(e.scrollTop=e.scrollHeight)})))}function ce(){s.value=!s.value}function me(){if(!N.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(),$(()=>{oe()}),S(()=>{null==p||p.disconnect(),p=void 0}),I(()=>t.themes,()=>u(null,null,function*(){q&&q({themes:t.themes})})),I(()=>t.loading,e=>{e||oe()}),I(K,e=>{e||sn()}),I(()=>[t.node.code,t.node.language],e=>u(null,[e],function*([e,n]){const o=_o(n);o!==l.value&&(l.value=o),d.value&&c.value?(U||(A(e),yield oe()),U&&e&&(!1===t.stream&&t.loading||(A(e),yield te(e,n),yield V()))):A(e)})),I(()=>[t.darkTheme,t.lightTheme],()=>u(null,null,function*(){d.value&&c.value&&(U||(yield oe()),null==U||U.setTheme(z()))})),I(()=>t.node.code,()=>u(null,null,function*(){if(a.value||!g.value)return;yield G();const e=d.value;e&&e.scrollHeight>e.clientHeight&&(e.scrollTop=e.scrollHeight)})),(n,o)=>(f(),v("div",{style:D(H.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?(f(),v("div",No,[R(n.$slots,"header-left",{},()=>[k("div",Ho,[k("span",{class:"icon-slot h-4 w-4 flex-shrink-0",innerHTML:j.value},null,8,Po),k("span",Do,_(L.value),1)])],!0),R(n.$slots,"header-right",{},()=>[k("div",Ro,[t.showCollapseButton?(f(),v("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},[(f(),v("svg",{style:D({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,Oo)):O("",!0),t.showFontSizeButtons&&t.enableFontSizeControl?(f(),v(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(M.value)&&M.value<=10,onClick:o[2]||(o[2]=e=>function(){const e=Math.max(10,M.value-1);M.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,Ko),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||M.value===b.value,onClick:o[5]||(o[5]=e=>{M.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(M.value)&&M.value>=36,onClick:o[8]||(o[8]=e=>function(){const e=Math.min(36,M.value+1);M.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,Ao)],64)):O("",!0),t.showCopyButton?(f(),v("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?(f(),v("svg",Vo,[...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)])])):(f(),v("svg",Fo,[...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,Wo)):O("",!0),t.showExpandButton?(f(),v("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?(f(),v("svg",Xo,[...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)])])):(f(),v("svg",qo,[...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,Uo)):O("",!0),N.value&&t.showPreviewButton?(f(),v("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,Go)):O("",!0)])],!0)])):O("",!0),Y(k("div",{ref_key:"codeBlockContent",ref:d,class:"code-block-content",style:D(P.value),onScroll:re},[k("div",{ref_key:"rendererTarget",ref:c,class:"code-block-render"},null,512),h.value?O("",!0):(f(),v("div",{key:0,class:"code-fallback-plain",innerHTML:m.value},null,8,Yo))],36),[[Z,!(s.value||!e.stream&&e.loading)]]),Y(k("div",Zo,[R(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),[[Z,!e.stream&&e.loading]])],6))}}),[["__scopeId","data-v-3397f01a"]]);Jo.install=e=>{e.component(Jo.__name,Jo)};const Qo=()=>import("mermaid");let er=null,nr=Qo;function tr(e){nr=e,er=null}function or(e){tr(null!=e?e:Qo)}function rr(){tr(null)}function lr(){return"function"==typeof nr}function ir(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 ar(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 sr(){return u(this,null,function*(){if(er)return er;const e=function(){try{const e=globalThis;return ir(null==e?void 0:e.mermaid)}catch(e){return null}}();if(e)return er=e,ar(er),er;const n=nr;if(!n)return null;let t;try{t=yield n()}catch(o){if(n===Qo)throw new Error('Optional dependency "mermaid" is not installed. Please install it to enable mermaid diagrams.');throw o}return t?(er=ir(t),ar(er),er):null})}const dr={class:"markstream-vue"},ur=["id"],cr=/* @__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 G(),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 G(),l.value=!0,yield G(),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 G(),yield a())})),S(()=>{i&&i()}),(i,a)=>(f(),A(J,{to:"body"},[k("div",dr,[y(H,{name:"tooltip",appear:""},{default:P(()=>[Y(k("div",{id:n.id,ref_key:"tooltip",ref:o,style:D({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"},_(e.content),15,ur),[[Z,e.visible&&l.value]])]),_:1})])]))}}),[["__scopeId","data-v-d524cc01"]]),mr=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:cr},Symbol.toStringTag,{value:"Module"}));function hr(e){return JSON.stringify(e)}function pr(e){var n;const t=null!=(n=e.mode)?n:"classic",o=e.katexUrl,r=e.mhchemUrl,l=hr(a({throwOnError:!0,displayMode:!0,output:"html",strict:"ignore"},e.renderOptions||{})),i=hr(o),s=r?hr(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 fr(e){var n,t;const o=pr(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}}cr.install=e=>{e.component(cr.__name,cr)};let vr=null,gr=null,yr=!1;const wr=/* @__PURE__ */new Map,kr=/* @__PURE__ */new Map;let xr=5;const br=/* @__PURE__ */new Set;function _r(){if(wr.size<xr&&br.size){const n=Array.from(br);br.clear();for(const t of n)try{t()}catch(e){}}}function Mr(e){vr=e,gr=null,vr.onmessage=e=>{const{id:n,html:t,error:o}=e.data,r=wr.get(n);if(r)if(wr.delete(n),clearTimeout(r.timeoutId),_r(),o)r.reject(new Error(o));else{const{content:n,displayMode:o}=e.data;if(n){const e=`${o?"d":"i"}:${n}`;if(kr.set(e,t),kr.size>200){const e=kr.keys().next().value;kr.delete(e)}}r.resolve(t)}},vr.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[n,t]of wr.entries())clearTimeout(t.timeoutId),t.reject(new Error(`Worker error: ${e.message}`));wr.clear(),_r()}}function Tr(){var e;vr&&(null==(e=vr.terminate)||e.call(vr)),vr=null,gr=null}function Cr(e){yr=!!e,vr&&vr.postMessage({type:"init",debug:yr})}function Br(e,n=!0,t=2e3,o){return u(this,null,function*(){if(performance.now(),!Ln()){const e=new Error("KaTeX rendering disabled");return e.name="KaTeXDisabled",e.code="KATEX_DISABLED",Promise.reject(e)}if(gr)return Promise.reject(gr);const r=`${n?"d":"i"}:${e}`,l=kr.get(r);if(l)return Promise.resolve(l);const i=vr||(gr=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),gr.name="WorkerInitError",gr.code="WORKER_INIT_ERROR",null);if(!i)return Promise.reject(gr);if(wr.size>=xr){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code="WORKER_BUSY",e.busy=!0,e.inFlight=wr.size,e.max=xr,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(()=>{wr.delete(a);const e=new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",l(e),_r()},t);o&&o.addEventListener("abort",()=>{globalThis.clearTimeout(s),wr.has(a)&&wr.delete(a);const e=new Error("Aborted");e.name="AbortError",l(e),_r()},{once:!0});const d=r,u=l;wr.set(a,{resolve:e=>{d(e)},reject:e=>{u(e)},timeoutId:s}),i.postMessage({id:a,content:e,displayMode:n})})})}function Ir(e,n=!0,t){const o=`${n?"d":"i"}:${e}`;if(kr.set(o,t),kr.size>200){const e=kr.keys().next().value;kr.delete(e)}}function $r(){return{inFlight:wr.size,max:xr}}function Sr(e){Number.isFinite(e)&&e>0&&(xr=Math.floor(e))}const Er="WORKER_BUSY";function Lr(){return wr.size>=xr}function jr(e=2e3,n){return wr.size<xr?Promise.resolve():new Promise((t,o)=>{let r,l=!1;const i=()=>{l||(l=!0,r&&globalThis.clearTimeout(r),br.delete(i),t())};if(br.add(i),r=globalThis.setTimeout(()=>{if(l)return;l=!0,br.delete(i);const e=new Error("Wait for worker slot timed out");e.name="WorkerBusyTimeout",e.code="WORKER_BUSY_TIMEOUT",o(e)},e),queueMicrotask(()=>_r()),n){const e=()=>{if(l)return;l=!0,r&&globalThis.clearTimeout(r),br.delete(i);const e=new Error("Aborted");e.name="AbortError",o(e)};n.aborted?e():n.addEventListener("abort",e,{once:!0})}})}const Nr={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function Hr(e){null!=e.timeout&&(Nr.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(Nr.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(Nr.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(Nr.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function Pr(){return a({},Nr)}function Dr(e){return u(this,arguments,function*(e,n=!0,t={}){var o,r,l,i;if(!Ln()){const e=new Error("KaTeX rendering disabled");throw e.name="KaTeXDisabled",e.code="KATEX_DISABLED",e}const a=null!=(o=t.timeout)?o:Nr.timeout,s=null!=(r=t.waitTimeout)?r:Nr.waitTimeout,d=null!=(l=t.backoffMs)?l:Nr.backoffMs,u=null!=(i=t.maxRetries)?i:Nr.maxRetries,c=Number.isFinite(u)?Math.max(0,Math.min(Math.floor(u),8)):Nr.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 Br(e,n,a,m)}catch(p){if((null==p?void 0:p.code)!==Er||h>=c)throw p;if(h++,yield jr(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 Rr(e){return JSON.stringify(e)}function Or(e){var n;const t=null!=(n=e.mode)?n:"module",o=Rr(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(${Rr(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 Kr(e){var n,t;const o=Or(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 zr=null,Ar=null;const Wr=/* @__PURE__ */new Map;let Fr=5,Vr=!1;function Ur(e){Vr=!!e}function Xr(e){Number.isFinite(e)&&e>0&&(Fr=Math.floor(e))}function qr(){return{inFlight:Wr.size,max:Fr}}const Gr="WORKER_BUSY",Yr="MERMAID_DISABLED";function Zr(e){zr=e,Ar=null;const n=e;zr.onmessage=e=>{if(zr!==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))},zr.onerror=e=>{var t,o;if(zr===n)if(0!==Wr.size){try{Vr?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)},zr.onmessageerror=e=>{var t,o;if(zr===n)if(0!==Wr.size){try{Vr?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 Jr(){var e;if(zr)try{for(const[e,n]of Wr.entries())n.reject(new Error("Worker cleared"));Wr.clear(),null==(e=zr.terminate)||e.call(zr)}catch(n){}zr=null,Ar=null}function Qr(e,n,t=1400){if(!lr()){const e=new Error("Mermaid rendering disabled");return e.name="MermaidDisabled",e.code=Yr,Promise.reject(e)}if(Ar)return Promise.reject(Ar);const o=zr||(Ar=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),Ar.name="WorkerInitError",Ar.code="WORKER_INIT_ERROR",null);if(!o)return Promise.reject(Ar);if(Wr.size>=Fr){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=Gr,e.inFlight=Wr.size,e.max=Fr,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 el(e,n,t=1400){return u(this,null,function*(){try{return yield Qr("canParse",{code:e,theme:n},t)}catch(o){return Promise.reject(o)}})}function nl(e,n,t=1400){return u(this,null,function*(){try{return yield Qr("findPrefix",{code:e,theme:n},t)}catch(o){return Promise.reject(o)}})}function tl(){if(zr)try{for(const[e,n]of Wr.entries())n.reject(new Error("Worker terminated"));Wr.clear(),zr.terminate()}finally{zr=null}}const ol=z(()=>import("./index4.js")),rl=z(()=>import("./index3.js")),ll=z(()=>import("./index2.js")),il=z(()=>import("./index5.js")),al=z(()=>import("./index6.js")),sl=z(()=>import("./index7.js")),dl={AdmonitionNode:qt,BlockquoteNode:ie,CheckboxNode:de,CodeBlockNode:ol,DefinitionListNode:he,EmojiNode:fe,EmphasisNode:st,FootnoteNode:ht,FootnoteReferenceNode:Ce,FootnoteAnchorNode:ut,HardBreakNode:ft,HeadingNode:gt,HtmlBlockNode:bt,HtmlInlineNode:Fe,HighlightNode:it,ImageNode:bn,D2BlockNode:sl,InfographicBlockNode:al,InlineCodeNode:Ue,PreCodeNode:Bt,InsertNode:rt,LinkNode:tt,ListItemNode:yt,ListNode:wt,MathBlockNode:rl,MathInlineNode:ll,MermaidBlockNode:il,ParagraphNode:Mt,StrikethroughNode:Yn,StrongNode:qn,SubscriptNode:Un,SuperscriptNode:Wn,TableNode:jt,TextNode:Dn,ThematicBreakNode:Ht,VmrContainerNode:Rt,ReferenceNode:Kn,MarkdownCodeBlockNode:Jo},ul={install(e,n){Object.entries(dl).forEach(([n,t])=>{e.component(n,t)}),(null==n?void 0:n.getLanguageIcon)&&bo(n.getLanguageIcon),(null==n?void 0:n.mathOptions)&&h(n.mathOptions)}};export{Mt as $,qt as A,ie as B,de as C,sl as D,fe as E,ut as F,gt as G,ft as H,it as I,bt as J,Fe as K,bn as L,al as M,Ue as N,rt as O,tt as P,yt as Q,wt as R,Yr as S,Gr as T,Jo as U,zt as V,Er as W,rl as X,ll as Y,il as Z,le as _,pn as a,Kn as a0,Yn as a1,qn as a2,Un as a3,Wn as a4,jt as a5,Dn as a6,Ht as a7,cr as a8,Rt as a9,lr as aA,Io as aB,To as aC,co as aD,ao as aE,be as aF,Br as aG,ke as aH,Jt as aI,un as aJ,Hr as aK,Mr as aL,Cr as aM,Sr as aN,$n as aO,bo as aP,tr as aQ,Zr as aR,Ur as aS,Xr as aT,jr as aU,ul as aa,pr as ab,Or as ac,_e as ad,Tr as ae,Jr as af,fr as ag,Kr as ah,uo as ai,eo as aj,En as ak,rr as al,So as am,Qt as an,Sn as ao,or as ap,$o as aq,so as ar,xe as as,Pr as at,$r as au,qr as av,Eo as aw,no as ax,Lr as ay,Ln as az,yo as b,Co as c,Bt as d,an as e,jo as f,io as g,sn as h,Dr as i,jn as j,Ir as k,Bo as l,sr as m,_o as n,el as o,nl as p,to as q,Mo as r,Lo as s,tl as t,cn as u,ol as v,he as w,st as x,ht as y,Ce as z};