markstream-vue 0.0.13 → 0.0.14-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 +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.px.css +1 -1
- package/dist/index.tailwind.css +1 -1
- package/dist/tailwind.ts +0 -0
- package/package.json +1 -1
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)),u=(e,n,t)=>i(e,"symbol"!=typeof n?n+"":n,t),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{tokenizeHtml as c,hasCustomHtmlComponents as h,sanitizeHtmlAttrs as m,BLOCKED_HTML_TAGS as f,isCustomHtmlComponentTag as p,convertHtmlAttrsToProps as v,sanitizeHtmlContent as g,sanitizeHtmlTokenAttrs as y,tokenAttrsToRecord as w,NON_STRUCTURING_HTML_TAGS as N,normalizeCustomHtmlTags as x,getHtmlTagFromContent as k,shouldRenderUnknownHtmlTagAsText as M,getMarkdown as b,mergeCustomHtmlTags as S,resolveCustomHtmlTags as _,parseMarkdownToStructure as B,stripCustomHtmlWrapper as O,setDefaultMathOptions as L}from"stream-markdown-parser";import{defineComponent as C,openBlock as T,createElementBlock as E,createVNode as I,unref as A,createElementVNode as $,Fragment as H,renderList as z,toDisplayString as R,shallowRef as W,h as P,computed as j,normalizeClass as F,useAttrs as K,inject as D,ref as V,watch as U,createCommentVNode as q,nextTick as X,onBeforeUnmount as G,createBlock as Z,Teleport as Y,Transition as J,withCtx as Q,withDirectives as ee,normalizeStyle as ne,createTextVNode as te,vShow as oe,createApp as le,getCurrentInstance as re,renderSlot as ie,readonly as ae,defineAsyncComponent as se,resolveDynamicComponent as ue,mergeProps as de,provide as ce,withModifiers as he,createStaticVNode as me,onMounted as fe,createSlots as pe,reactive as ve,markRaw as ge}from"vue";import{autoUpdate as ye,offset as we,flip as Ne,shift as xe,arrow as ke,computePosition as Me}from"@floating-ui/dom";const be=["cite"],Se=(e,n)=>{const t=e.__vccOpts||e;for(const[o,l]of n)t[o]=l;return t},_e=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"BlockquoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(T(),E("blockquote",{class:"blockquote",dir:"auto",cite:e.node.cite},[I(A(Vr),{"index-key":`blockquote-${n.indexKey}`,nodes:n.node.children||[],"custom-id":n.customId,typewriter:n.typewriter,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))},null,8,["index-key","nodes","custom-id","typewriter"])],8,be))}}),[["__scopeId","data-v-07e0310e"]]);_e.install=e=>{e.component(_e.__name,_e)};const Be=["aria-label"],Oe={key:0,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",class:"checkbox-icon checkbox-unchecked"},Le={key:1,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",class:"checkbox-icon checkbox-checked"},Ce=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"CheckboxNode",props:{node:{}},setup:e=>(n,t)=>(T(),E("span",{class:"checkbox-node",role:"img","aria-label":e.node.checked?"checked":"unchecked"},[e.node.checked?(T(),E("svg",Le,[...t[1]||(t[1]=[$("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",fill:"currentColor"},null,-1),$("path",{d:"M9 12l2 2 4-4",stroke:"hsl(var(--ms-background))","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(T(),E("svg",Oe,[...t[0]||(t[0]=[$("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",stroke:"currentColor","stroke-width":"2"},null,-1)])]))],8,Be))}),[["__scopeId","data-v-be21ab83"]]);Ce.install=e=>{e.component(Ce.__name,Ce)};const Te={class:"definition-list"},Ee={class:"definition-term"},Ie={class:"definition-desc"},Ae=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"DefinitionListNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(e,t)=>(T(),E("dl",Te,[(T(!0),E(H,null,z(n.node.items,(o,l)=>(T(),E(H,{key:l},[$("dt",Ee,[I(A(Vr),{"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"])]),$("dd",Ie,[I(A(Vr),{"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-c1b2a2e8"]]);Ae.install=e=>{e.component(Ae.__name,Ae)};const $e={class:"emoji-node"},He=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"EmojiNode",props:{node:{}},setup:e=>(n,t)=>(T(),E("span",$e,R(e.node.name),1))}),[["__scopeId","data-v-de55dc97"]]);He.install=e=>{e.component(He.__name,He)};const ze="__global__",Re="__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__",We=(()=>{const e=globalThis;if(e[Re])return e[Re];const n={scopedCustomComponents:{},revision:W(0)};return e[Re]=n,n})(),Pe=We.revision;function je(e,n){"string"==typeof e?We.scopedCustomComponents[e]=n||{}:We.scopedCustomComponents[ze]=e||{},Pe.value++}function Fe(e){const n=We.scopedCustomComponents[ze]||{};if(!e)return n;const t=We.scopedCustomComponents[e]||{};return n&&0!==Object.keys(n).length?t&&0!==Object.keys(t).length?a(a({},n),t):n:t}function Ke(e){if(e===ze)throw new Error("removeCustomComponents: use clearGlobalCustomComponents() to clear the global mapping");delete We.scopedCustomComponents[e],Pe.value++}function De(){delete We.scopedCustomComponents[ze],Pe.value++}const Ve=["id"],Ue=["title"],qe=/* @__PURE__ */Se(/* @__PURE__ */C({__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)=>(T(),E("sup",{id:`fnref-${e.node.id}`,class:"footnote-reference",onClick:t},[$("span",{href:n,title:`查看脚注 ${e.node.id}`,class:"footnote-link cursor-pointer"},"["+R(e.node.id)+"]",9,Ue)],8,Ve))}}),[["__scopeId","data-v-82cafe9f"]]);qe.install=e=>{e.component(qe.__name,qe)};const Xe=(()=>{try{return Boolean(!1)}catch(e){}return!1})();function Ge(e){Xe&&console.warn(e)}function Ze(e){return m(e)}function Ye(e,n,t,o,l){if(f.has(e.toLowerCase()))return null;const r=Ze(n),i=r.key,u=null!=i&&""!==i?i:l;if(function(e,n){return p(e,n)}(e,o)){const n=o[e]||o[e.toLowerCase()],l=function(e){return v(e)}(r);return P(n,s(a({},l),{key:u}),t.length>0?t:void 0)}return P(e,s(a({},r),{innerHTML:void 0,key:u}),t.length>0?t:void 0)}function Je(e,n){return h(e,n)}function Qe(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=Ye(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=Ye(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&&Ge(`Auto-closing unclosed tag: <${r.tagName}>`)}else Ge(`Ignoring closing tag with no matching opening tag: </${r.tagName}>`)}for(;o.length>0;){const e=o.pop(),t=Ye(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),Ge(`Auto-closing unclosed tag: <${e.tagName}>`)}return l}(c(e),n);return t}catch(o){return t=o,Xe&&console.error("Failed to parse HTML to VNodes:",t),null}var t}const en=["innerHTML"],nn=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"HtmlInlineNode",props:{node:{},customId:{}},setup(e){const n=e,t=j(()=>(Pe.value,Fe(n.customId))),o=C({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),l=j(()=>{const e=n.node.content;if(!e)return{mode:"html",content:""};if(n.node.loading&&!n.node.autoClosed)return{mode:"text",content:e};if(n.node.loading&&n.node.autoClosed){const n=Qe(e,t.value);if(null!==n)return{mode:"dynamic",nodes:n}}if(!Je(e,t.value))return{mode:"html",content:g(e)};const o=Qe(e,t.value);return null===o?{mode:"html",content:g(e)}:{mode:"dynamic",nodes:o}});return(e,t)=>"dynamic"===l.value.mode?(T(),E("span",{key:0,class:F(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},[I(A(o),{nodes:l.value.nodes},null,8,["nodes"])],2)):"text"===l.value.mode?(T(),E("span",{key:1,class:F(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},R(l.value.content),3)):(T(),E("span",{key:2,class:F(["html-inline-node",{"html-inline-node--loading":n.node.loading}]),innerHTML:l.value.content},null,10,en))}}),[["__scopeId","data-v-3b69597d"]]);nn.install=e=>{e.component(nn.__name,nn)};const tn={class:"inline-code"},on={key:0},ln=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"InlineCodeNode",props:{node:{}},setup(e){const n=e,t=K(),o=D("markstreamTypewriter",void 0),l=D("markstreamTextStreamState",void 0),r=j(()=>{const e=t.typewriter;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),i=j(()=>"boolean"==typeof r.value?r.value:"boolean"!=typeof(null==o?void 0:o.value)||o.value),a=j(()=>{var e;const n=null!=(e=t["index-key"])?e:t.indexKey;return null==n||""===n?"":String(n)}),s=V(n.node.code),u=V(""),d=V(0);function c(){return s.value+u.value}function h(e){s.value=e,u.value=""}function m(){u.value&&(s.value=c(),u.value="")}U([()=>n.node.code,a,i],([e])=>{const n=String(null!=e?e:""),t=c(),o=a.value,r=o?null==l?void 0:l.get(o):void 0,m=null!=r?r:t;return i.value?n===m?(h(n),void(o&&(null==l||l.set(o,n)))):m&&n.startsWith(m)&&n.length>m.length?(s.value=m,u.value=n.slice(m.length),d.value+=1,void(o&&(null==l||l.set(o,n)))):(h(n),void(o&&(null==l||l.set(o,n)))):(h(n),void(o&&(null==l||l.set(o,n))))},{immediate:!0}),U(i,e=>{e||h(c())});const f=j(()=>d.value%2==0?"inline-code-stream-delta--a":"inline-code-stream-delta--b");return(e,n)=>(T(),E("code",tn,[s.value?(T(),E("span",on,R(s.value),1)):q("",!0),u.value?(T(),E("span",{key:1,class:F(["inline-code-stream-delta",[f.value]]),onAnimationend:m},R(u.value),35)):q("",!0)]))}}),[["__scopeId","data-v-4f389e00"]]);ln.install=e=>{e.component(ln.__name,ln)};const rn=["id"],an=["data-placement"],sn=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"Tooltip",props:{visible:{type:Boolean},anchorEl:{},content:{},placement:{},offset:{},originX:{},originY:{},id:{},isDark:{type:[Boolean,null]}},setup(e){var n;const t=e,o=V(null),l=V(null),r=V({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"}),i=V({}),a=V(null!=(n=t.placement)?n:"top"),s=V(!1);let u=null;function c(){return d(this,null,function*(){var e,n;if(!t.anchorEl||!o.value)return;const s=[we(null!=(e=t.offset)?e:6),Ne(),xe({padding:6}),...l.value?[ke({element:l.value,padding:4})]:[]],{x:u,y:d,placement:c,middlewareData:h}=yield Me(t.anchorEl,o.value,{placement:null!=(n=t.placement)?n:"top",middleware:s,strategy:"fixed"});if(r.value.transform=`translate3d(${Math.round(u)}px, ${Math.round(d)}px, 0)`,r.value.left="0px",r.value.top="0px",a.value=c,h.arrow&&l.value){const{x:e,y:n}=h.arrow,t={top:"bottom",bottom:"top",left:"right",right:"left"}[c.split("-")[0]];i.value={left:null!=e?`${e}px`:"",top:null!=n?`${n}px`:"",[t]:"-3px"}}})}return U(()=>t.visible,e=>d(null,null,function*(){if(e)if(s.value=!1,yield X(),t.anchorEl&&o.value)try{const e=t.anchorEl.getBoundingClientRect();yield c();const n=r.value.transform;if(null!=t.originX&&null!=t.originY){const o=Math.abs(Number(t.originX)-e.left),l=Math.abs(Number(t.originY)-e.top);Math.hypot(o,l)>120?(r.value.transform=`translate3d(${Math.round(t.originX)}px, ${Math.round(t.originY)}px, 0)`,yield X(),s.value=!0,yield X(),r.value.transform=n):s.value=!0}else s.value=!0;u=ye(t.anchorEl,o.value,c)}catch(n){yield c(),s.value=!0,u=ye(t.anchorEl,o.value,c)}else s.value=!0;else s.value=!1,u&&(u(),u=null)})),U([()=>t.anchorEl,()=>t.placement,()=>t.content],()=>d(null,null,function*(){t.visible&&t.anchorEl&&o.value&&(yield X(),yield c())})),G(()=>{u&&u()}),(n,u)=>(T(),Z(Y,{to:"body"},[$("div",{class:F(["markstream-vue",{dark:e.isDark}])},[I(J,{name:"tooltip",appear:""},{default:Q(()=>[ee($("div",{id:t.id,ref_key:"tooltip",ref:o,style:ne({position:"fixed",left:r.value.left,top:r.value.top,transform:r.value.transform}),class:"tooltip-element",role:"tooltip"},[te(R(e.content)+" ",1),$("div",{ref_key:"arrowEl",ref:l,class:"tooltip-arrow","data-placement":a.value,style:ne(i.value)},null,12,an)],12,rn),[[oe,e.visible&&s.value]])]),_:1})],2)]))}}),[["__scopeId","data-v-e28aa7bd"]]),un=V(!1),dn=V(""),cn=V("top"),hn=V(null),mn=V(null),fn=V(null),pn=V(null),vn=V(null);let gn=null,yn=null;function wn(){gn&&(clearTimeout(gn),gn=null),yn&&(clearTimeout(yn),yn=null)}let Nn=!1;function xn(e,n,t="top",o=!1,l,r){if(!e)return;!function(){if(!Nn&&"undefined"!=typeof document)try{Nn=!0;const e=document.createElement("div");e.setAttribute("data-singleton-tooltip","1"),document.body.appendChild(e),le({setup:()=>()=>{var e;return P(sn,{visible:un.value,"anchor-el":hn.value,content:dn.value,placement:cn.value,id:mn.value,originX:fn.value,originY:pn.value,isDark:null!=(e=vn.value)?e:void 0})}}).mount(e)}catch(e){Nn=!1,console.warn("[markstream-vue] Failed to mount Tooltip component. Tooltips will be disabled.",e)}}(),wn();const i=()=>{var o,i;mn.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,hn.value=e,dn.value=n,cn.value=t,fn.value=null!=(o=null==l?void 0:l.x)?o:null,pn.value=null!=(i=null==l?void 0:l.y)?i:null,vn.value="boolean"==typeof r?r:null,un.value=!0;try{e.setAttribute("aria-describedby",mn.value)}catch(a){}};o?i():gn=setTimeout(i,80)}function kn(e=!1){wn();const n=()=>{if(hn.value&&mn.value)try{hn.value.removeAttribute("aria-describedby")}catch(e){}un.value=!1,hn.value=null,mn.value=null,fn.value=null,pn.value=null};e?n():yn=setTimeout(n,120)}const Mn={"common.copy":"Copy","common.copied":"Copied","common.decrease":"Decrease","common.reset":"Reset","common.increase":"Increase","common.expand":"Expand","common.collapse":"Collapse","common.preview":"Preview","common.source":"Source","common.export":"Export","common.open":"Open","common.minimize":"Minimize","common.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."};function bn(e){Object.assign(Mn,e)}const Sn=e=>{var n;return null!=(n=Mn[e])?n:function(e){return(e.split(".").pop()||e).replace(/[_-]/g," ").replace(/([A-Z])/g," $1").replace(/\s+/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}(e)};function _n(e){return{t(n){if(e.te&&Mn[n]&&!e.te(n))return Sn(n);const t=e.t(n);return t===n&&Mn[n]?Sn(n):t}}}function Bn(){const e=function(){var e,n;try{const t=re(),o=null==t?void 0:t.proxy,l=null==o?void 0:o.$t;if("function"==typeof l){const e=null==o?void 0:o.$te;return{t:l.bind(o),te:"function"==typeof e?e.bind(o):void 0}}const r=null==(n=null==(e=null==t?void 0:t.appContext)?void 0:e.config)?void 0:n.globalProperties,i=null==r?void 0:r.$t;if("function"==typeof i){const e=null==r?void 0:r.$te;return{t:i.bind(r),te:"function"==typeof e?e.bind(r):void 0}}}catch(t){}return null}();if(e)return _n(e);try{const e=globalThis.$vueI18nUse||null;if(e&&"function"==typeof e)try{const n=e();if(n&&"function"==typeof n.t)return _n({t:n.t.bind(n),te:"function"==typeof n.te?n.te.bind(n):void 0})}catch(n){}}catch(n){}return{t:Sn}}const On={class:"image-node-container"},Ln=["src","alt","title","loading","fetchpriority","decoding","tabindex","aria-label"],Cn={key:"placeholder",class:"image-placeholder"},Tn={key:1,class:"image-node__raw-text"},En={key:"error",class:"image-error"},In=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"ImageNode",props:{node:{},fallbackSrc:{default:""},lazy:{type:Boolean,default:!1},usePlaceholder:{type:Boolean,default:!0}},emits:["load","error","click"],setup(e,{emit:n}){const t=e,o=n,l=V(!1),r=V(!1),i=V(!1),a=j(()=>r.value&&t.fallbackSrc?t.fallbackSrc:t.node.src),s=j(()=>!t.lazy);function u(){t.fallbackSrc&&!i.value?(i.value=!0,r.value=!0):(r.value=!0,o("error",t.node.src))}function d(){l.value=!0,r.value=!1,o("load",a.value)}function c(e){e.preventDefault(),l.value&&!r.value&&o("click",[e,a.value])}const{t:h}=Bn();return U(a,()=>{l.value=!1,r.value=!1}),(n,o)=>(T(),E("span",On,[I(J,{name:"img-switch",mode:"out-in"},{default:Q(()=>{var i,m,f,p,v;return[e.node.loading||r.value?r.value?e.node.loading||t.fallbackSrc?q("",!0):(T(),E("span",En,[ie(n.$slots,"error",{node:t.node,displaySrc:a.value,imageLoaded:l.value,hasError:r.value,fallbackSrc:t.fallbackSrc,lazy:t.lazy},()=>[o[1]||(o[1]=$("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[$("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)),$("span",null,R(A(h)("image.loadError")),1)],!0)])):(T(),E("span",Cn,[t.usePlaceholder?ie(n.$slots,"placeholder",{key:0,node:t.node,displaySrc:a.value,imageLoaded:l.value,hasError:r.value,fallbackSrc:t.fallbackSrc,lazy:t.lazy},()=>[o[0]||(o[0]=$("span",{class:"image-shimmer"},null,-1))],!0):(T(),E("span",Tn,R(e.node.raw),1))])):(T(),E("img",{key:"image",src:a.value,alt:String(null!=(m=null!=(i=t.node.alt)?i:t.node.title)?m:""),title:String(null!=(p=null!=(f=t.node.title)?f:t.node.alt)?p:""),class:F(["image-node__img",{"is-loading":!s.value&&!l.value,"is-loaded":s.value||l.value,"cursor-pointer":l.value}]),loading:t.lazy?"lazy":void 0,fetchpriority:s.value?"high":void 0,decoding:s.value?"sync":"async",tabindex:l.value?0:-1,"aria-label":null!=(v=t.node.alt)?v:A(h)("image.preview"),onError:u,onLoad:d,onClick:c},null,42,Ln))]}),_:3})]))}}),[["__scopeId","data-v-0f18a0a5"]]);In.install=e=>{e.component(In.__name,In)};let An=null,$n=!1,Hn=Wn;function zn(e){var n;const t=null!=(n=null==e?void 0:e.default)?n:e;return t&&"function"==typeof t.renderToString?t:null}function Rn(){try{const e=globalThis;return zn(null==e?void 0:e.katex)}catch(e){return null}}function Wn(){return d(null,null,function*(){const e=Rn();if(e)return e;const n=yield import("katex");try{yield import("katex/dist/contrib/mhchem")}catch(t){}return zn(n)})}function Pn(e){Hn=e,An=null,$n=!1}function jn(e){Pn(null!=e?e:Wn)}function Fn(){Pn(null)}function Kn(){return"function"==typeof Hn}function Dn(){var e;const n=Rn();if(n)return An=n,An;if(An)return An;const t=Hn;if(!t||t===Wn)return null;try{const n=t();return n&&"function"!=typeof(null==n?void 0:n.then)?(An=null!=(e=zn(n))?e:n,An):null}catch(o){return null}}function Vn(){return d(this,null,function*(){var e;const n=Rn();if(n)return An=n,An;if(An)return An;if($n)return null;const t=Hn;if(!t)return $n=!0,null;try{const n=yield t();if(n)return An=null!=(e=zn(n))?e:n,An}catch(o){}return $n=!0,null})}const Un=W(!1);let qn=null;const Xn={key:0},Gn=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const n=e,t=(qn||(qn=Vn().then(e=>{Un.value=!!e}).catch(()=>{Un.value=!1})),ae(Un)),o=K(),l=D("markstreamTypewriter",void 0),r=D("markstreamTextStreamState",void 0),i=D("markstreamStreamVersion",void 0),a=j(()=>{const e=o.typewriter;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),s=j(()=>"boolean"==typeof a.value?a.value:"boolean"!=typeof(null==l?void 0:l.value)||l.value),u=j(()=>{var e;const n=null!=(e=o["index-key"])?e:o.indexKey;return null==n||""===n?"":String(n)}),d=V(n.node.content),c=V(""),h=V(0);function m(){return d.value+c.value}function f(e){d.value=e,c.value=""}function p(){c.value&&(d.value=m(),c.value="")}U([()=>n.node.content,u,s,()=>null==i?void 0:i.value],([e])=>{const n=String(null!=e?e:""),t=m(),o=u.value,l=o?null==r?void 0:r.get(o):void 0,i=null!=l?l:t;return s.value?n===i?(c.value?p():t!==n&&f(n),void(o&&(null==r||r.set(o,n)))):i&&n.startsWith(i)&&n.length>i.length?(d.value=i,c.value=n.slice(i.length),h.value+=1,void(o&&(null==r||r.set(o,n)))):(f(n),void(o&&(null==r||r.set(o,n)))):(f(n),void(o&&(null==r||r.set(o,n))))},{immediate:!0}),U(s,e=>{e||f(m())});const v=j(()=>h.value%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b");return(n,o)=>(T(),E("span",{class:F([[A(t)&&e.node.center?"text-node-center":""],"whitespace-pre-wrap break-words text-node"])},[d.value?(T(),E("span",Xn,R(d.value),1)):q("",!0),c.value?(T(),E("span",{key:1,class:F(["text-node-stream-delta",[v.value]]),onAnimationend:p},R(c.value),35)):q("",!0)],2))}}),[["__scopeId","data-v-03641323"]]);Gn.install=e=>{e.component(Gn.__name,Gn)};const Zn=se(()=>d(null,null,function*(){var e;if("test"===(null==(e=function(){const e=Reflect.get(globalThis,"process");return null==e?void 0:e.env}())?void 0:e.NODE_ENV)&&"undefined"!=typeof window)return e=>{var n,t,o,l;return P(Gn,s(a({},e),{node:{type:"text",content:null!=(t=e.node.raw)?t:`$${null!=(n=e.node.content)?n:""}$`,raw:null!=(l=e.node.raw)?l:`$${null!=(o=e.node.content)?o:""}$`}}))};try{if(yield Vn())return(yield import("./index2.js")).default}catch(n){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".',n)}return e=>{var n,t,o,l;return P(Gn,s(a({},e),{node:{type:"text",content:null!=(t=e.node.raw)?t:`$${null!=(n=e.node.content)?n:""}$`,raw:null!=(l=e.node.raw)?l:`$${null!=(o=e.node.content)?o:""}$`}}))}})),Yn=se(()=>d(null,null,function*(){try{if(yield Vn())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,o,l;return P(Gn,s(a({},e),{node:{type:"text",content:null!=(t=e.node.raw)?t:`$$${null!=(n=e.node.content)?n:""}$$`,raw:null!=(l=e.node.raw)?l:`$$${null!=(o=e.node.content)?o:""}$$`}}))}})),Jn=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(n,t)=>(T(),E("span",{class:"reference-node cursor-pointer text-xs rounded-md px-1.5 mx-0.5",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))},R(e.node.id),33))}),[["__scopeId","data-v-775c65e4"]]);Jn.install=e=>{e.component(Jn.__name,Jn)};const Qn={class:"superscript-node"},et={key:1},nt=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Fe(n.customId),o=a({text:Gn,inline_code:ln,link:mt,html_inline:nn,strong:it,emphasis:wt,footnote_reference:qe,strikethrough:st,highlight:gt,insert:pt,subscript:lt,emoji:He,math_inline:Zn,reference:Jn},t);return(t,l)=>(T(),E("sup",Qn,[(T(!0),E(H,null,z(e.node.children,(t,l)=>(T(),E(H,{key:`${e.indexKey||"superscript"}-${l}`},[o[t.type]?(T(),Z(ue(o[t.type]),{key:0,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"superscript"}-${l}`},null,8,["node","custom-id","index-key"])):(T(),E("span",et,R(t.content||t.raw),1))],64))),128))]))}}),[["__scopeId","data-v-6dc1e3ba"]]);nt.install=e=>{e.component(nt.__name,nt)};const tt={class:"subscript-node"},ot={key:1},lt=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Fe(n.customId),o=a({text:Gn,inline_code:ln,link:mt,html_inline:nn,strong:it,emphasis:wt,footnote_reference:qe,strikethrough:st,highlight:gt,insert:pt,superscript:nt,emoji:He,math_inline:Zn,reference:Jn},t);return(t,l)=>(T(),E("sub",tt,[(T(!0),E(H,null,z(e.node.children,(t,l)=>(T(),E(H,{key:`${e.indexKey||"subscript"}-${l}`},[o[t.type]?(T(),Z(ue(o[t.type]),{key:0,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"subscript"}-${l}`},null,8,["node","custom-id","index-key"])):(T(),E("span",ot,R(t.content||t.raw),1))],64))),128))]))}}),[["__scopeId","data-v-69de9b81"]]);lt.install=e=>{e.component(lt.__name,lt)};const rt={class:"strong-node"},it=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Fe(n.customId),o=a({text:Gn,inline_code:ln,link:mt,html_inline:nn,emphasis:wt,strikethrough:st,highlight:gt,insert:pt,subscript:lt,superscript:nt,emoji:He,footnote_reference:qe,math_inline:Zn,reference:Jn},t);return(t,l)=>(T(),E("strong",rt,[(T(!0),E(H,null,z(e.node.children,(t,l)=>(T(),Z(ue(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"]]);it.install=e=>{e.component(it.__name,it)};const at={class:"strikethrough-node"},st=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Fe(n.customId),o=a({text:Gn,inline_code:ln,link:mt,html_inline:nn,strong:it,emphasis:wt,highlight:gt,insert:pt,subscript:lt,superscript:nt,emoji:He,footnote_reference:qe,math_inline:Zn,reference:Jn},t);return(t,l)=>(T(),E("del",at,[(T(!0),E(H,null,z(e.node.children,(t,l)=>(T(),Z(ue(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"]]);st.install=e=>{e.component(st.__name,st)};const ut=["href","title","aria-label","aria-hidden"],dt=["aria-hidden"],ct={class:"link-text-wrapper relative inline-flex"},ht={class:"leading-[normal] link-text"},mt=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"LinkNode",props:{node:{},indexKey:{},customId:{},showTooltip:{type:Boolean,default:!0},color:{},underlineHeight:{},underlineBottom:{},animationDuration:{},animationOpacity:{},animationTiming:{},animationIteration:{}},setup(e){const n=e,t=D("markstreamShowTooltips",void 0),o=j(()=>{const e=null==t?void 0:t.value;return"boolean"==typeof e?e:n.showTooltip}),l=j(()=>{var e,t,o,l,r;const i=void 0!==n.underlineBottom?"number"==typeof n.underlineBottom?`${n.underlineBottom}px`:String(n.underlineBottom):"-3px",a=null!=(e=n.animationOpacity)?e:.35,s=Math.max(.12,Math.min(.5*a,a)),u={"--underline-height":`${null!=(t=n.underlineHeight)?t:2}px`,"--underline-bottom":i,"--underline-opacity":String(a),"--underline-rest-opacity":String(s),"--underline-duration":`${null!=(o=n.animationDuration)?o:1.6}s`,"--underline-timing":null!=(l=n.animationTiming)?l:"ease-in-out","--underline-iteration":"number"==typeof n.animationIteration?String(n.animationIteration):null!=(r=n.animationIteration)?r:"infinite"};return n.color&&(u["--link-color"]=n.color),u}),r={text:Gn,strong:it,strikethrough:st,emphasis:wt,image:In,html_inline:nn,inline_code:ln},i=j(()=>(Pe.value,Fe(n.customId))),s=K(),u=j(()=>{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 Ze(l)}),d=j(()=>{const e=a(a({},s),u.value);return delete e.title,e});function c(){o.value&&kn()}const h=j(()=>{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)=>{var u,m;return e.node.loading?(T(),E("span",de({key:1,class:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":e.node.loading?"false":"true"},A(s),{style:l.value}),[$("span",ct,[$("span",ht,[I(A(Gn),{class:"leading-[normal] link-text",node:{type:"text",content:String(null!=(u=e.node.text)?u:""),raw:String(null!=(m=e.node.text)?m:"")},"index-key":`${e.indexKey||"link-text"}-loading`},null,8,["node","index-key"])]),a[1]||(a[1]=$("span",{class:"link-loading-indicator","aria-hidden":"true"},null,-1))])],16,dt)):(T(),E("a",de({key:0,class:"link-node",href:e.node.href,title:o.value?"":h.value,"aria-label":`Link: ${h.value}`,"aria-hidden":e.node.loading?"true":"false",target:"_blank",rel:"noopener noreferrer"},d.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)||"";xn(e.currentTarget,s,"top",!1,a)}(e)),onMouseleave:c}),[(T(!0),E(H,null,z(e.node.children,(t,o)=>(T(),Z(ue(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,ut))}}}),[["__scopeId","data-v-27877c6b"]]);mt.install=e=>{e.component(mt.__name,mt)};const ft={class:"insert-node"},pt=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Fe(n.customId),o=a({text:Gn,inline_code:ln,link:mt,html_inline:nn,strong:it,emphasis:wt,strikethrough:st,highlight:gt,subscript:lt,superscript:nt,emoji:He,footnote_reference:qe,math_inline:Zn,reference:Jn},t);return(t,l)=>(T(),E("ins",ft,[(T(!0),E(H,null,z(e.node.children,(t,l)=>(T(),Z(ue(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"]]);pt.install=e=>{e.component(pt.__name,pt)};const vt={class:"highlight-node"},gt=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Fe(n.customId),o=a({text:Gn,inline_code:ln,link:mt,html_inline:nn,strong:it,emphasis:wt,strikethrough:st,insert:pt,subscript:lt,superscript:nt,emoji:He,footnote_reference:qe,math_inline:Zn,reference:Jn},t);return(t,l)=>(T(),E("mark",vt,[(T(!0),E(H,null,z(e.node.children,(t,l)=>(T(),Z(ue(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-36e74e6b"]]);gt.install=e=>{e.component(gt.__name,gt)};const yt={class:"emphasis-node"},wt=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Fe(n.customId),o=a({text:Gn,inline_code:ln,link:mt,html_inline:nn,strong:it,strikethrough:st,highlight:gt,insert:pt,subscript:lt,superscript:nt,emoji:He,footnote_reference:qe,math_inline:Zn,reference:Jn},t);return(t,l)=>(T(),E("em",yt,[(T(!0),E(H,null,z(e.node.children,(t,l)=>(T(),Z(ue(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"]]);wt.install=e=>{e.component(wt.__name,wt)};const Nt=["href","title"],xt=/* @__PURE__ */Se(/* @__PURE__ */C({__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)=>(T(),E("a",{class:"footnote-anchor text-sm hover:underline cursor-pointer",href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:t}," ↩︎ ",8,Nt))}}),[["__scopeId","data-v-83c33a47"]]);xt.install=e=>{e.component(xt.__name,xt)};const kt=["id"],Mt={class:"flex-1"},bt=/* @__PURE__ */C({__name:"FootnoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(T(),E("div",{id:`fnref--${e.node.id}`,class:"footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border)] pt-2"},[$("div",Mt,[I(A(Vr),{"index-key":`footnote-${n.indexKey}`,nodes:n.node.children,"custom-id":n.customId,typewriter:n.typewriter,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))},null,8,["index-key","nodes","custom-id","typewriter"])])],8,kt))}});bt.install=e=>{e.component(bt.__name,bt)};const St={class:"hard-break"},_t=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"HardBreakNode",props:{node:{}},setup:e=>(e,n)=>(T(),E("br",St))}),[["__scopeId","data-v-50c58f70"]]);_t.install=e=>{e.component(_t.__name,_t)};const Bt=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Fe(n.customId),o=a({text:Gn,inline_code:ln,link:mt,image:In,strong:it,emphasis:wt,strikethrough:st,highlight:gt,insert:pt,subscript:lt,superscript:nt,emoji:He,checkbox:Ce,checkbox_input:Ce,footnote_reference:qe,hardbreak:_t,math_inline:Zn,reference:Jn},t);return(t,l)=>(T(),Z(ue(`h${e.node.level}`),de({class:["heading-node",[`heading-${e.node.level}`]],dir:"auto"},e.node.attrs),{default:Q(()=>[(T(!0),E(H,null,z(e.node.children,(t,l)=>(T(),Z(ue(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"]))),128))]),_:1},16,["class"]))}}),[["__scopeId","data-v-bf120de0"]]),Ot=Bt;Ot.install=e=>{e.component(Bt.__name,Bt)};const Lt=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"ListItemNode",props:{node:{},item:{},indexKey:{},value:{},customId:{},typewriter:{type:Boolean},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=e,t=j(()=>{var e;return null!=(e=n.node)?e:n.item}),o=j(()=>null==n.value?{}:{value:n.value});return(e,l)=>{var r,i;return T(),E("li",de({class:"list-item",dir:"auto"},o.value),[I(A(Vr),de({showTooltips:n.showTooltips},{"index-key":`list-item-${n.indexKey}`,nodes:null!=(i=null==(r=t.value)?void 0:r.children)?i:[],"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"])],16)}}}),[["__scopeId","data-v-fdeabeb1"]]);Lt.install=e=>{e.component(Lt.__name,Lt)};const Ct=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"ListNode",props:{node:{},customId:{},indexKey:{},typewriter:{type:Boolean},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=j(()=>(Pe.value,Fe(e.customId).list_item||Lt));return(t,o)=>(T(),Z(ue(e.node.ordered?"ol":"ul"),{class:F(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:Q(()=>[(T(!0),E(H,null,z(e.node.items,(l,r)=>{var i;return T(),Z(ue(n.value),de({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!=(i=e.node.start)?i:1)+r:void 0,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))}),null,16,["node","custom-id","index-key","typewriter","value"])}),128))]),_:1},8,["class"]))}}),[["__scopeId","data-v-c145570b"]]);Ct.install=e=>{e.component(Ct.__name,Ct)};const Tt=/* @__PURE__ */Symbol("ViewportPriority");function Et(e,n){var t,o;const l="undefined"!=typeof window&&"undefined"!=typeof document,r="boolean"==typeof n?V(n):n,i=l?null!=(t=window.requestIdleCallback)?t:e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16):null,a=l?null!=(o=window.cancelIdleCallback)?o:e=>window.clearTimeout(e):null;let s=null,u=null;const d=/* @__PURE__ */new Map,c=/* @__PURE__ */new Set;let h=null;function m(){if(!d.size){try{null==s||s.disconnect()}catch(e){}s=null,u=null,c.size||function(){if(null!=h){try{null==a||a(h)}catch(e){}h=null}}()}}function f(e){const n=d.get(e);if(n){if(!n.visible.value){n.visible.value=!0;try{n.resolve()}catch(t){}}try{null==s||s.unobserve(e)}catch(t){}d.delete(e),c.delete(e),m()}}function p(){i&&null==h&&c.size&&(h=i(()=>{h=null;const e=c.values().next().value;e&&(c.delete(e),f(e),c.size&&p())},{timeout:1200}))}const v=(n,t)=>{const o=V(!1);let i,a=!1;const h=new Promise(e=>{i=()=>{a||(a=!0,e())}}),v=()=>{try{null==s||s.unobserve(n)}catch(e){}d.delete(n),c.delete(n),m()};if(!l||!r.value)return o.value=!0,i(),{isVisible:o,whenVisible:h,destroy:v};const g=function(n,t){if(!l)return s;if("undefined"==typeof IntersectionObserver)return null;const o=function(n,t){var o,l,r;return{root:null!=(o=null==e?void 0:e(null!=n?n:null))?o:null,rootMargin:null!=(l=null==t?void 0:t.rootMargin)?l:"300px",threshold:null!=(r=null==t?void 0:t.threshold)?r:0}}(n,t);if(s&&(i=o,(r=u)&&r.root===i.root&&r.rootMargin===i.rootMargin&&r.threshold===i.threshold))return s;var r,i;if(s)try{s.disconnect()}catch(a){}s=new IntersectionObserver(e=>{for(const n of e)(n.isIntersecting||n.intersectionRatio>0)&&f(n.target)},{root:o.root,rootMargin:o.rootMargin,threshold:o.threshold}),u=o;for(const e of d.keys())s.observe(e);return s}(n,t);return g?(d.set(n,{resolve:i,visible:o}),g.observe(n),c.add(n),p(),{isVisible:o,whenVisible:h,destroy:v}):(o.value=!0,i(),{isVisible:o,whenVisible:h,destroy:v})};return ce(Tt,v),v}function It(){var e,n;const t=D(Tt,void 0);if(t)return t;const o=/* @__PURE__ */new WeakMap;let l=null;const r=/* @__PURE__ */new Set;let i=null;const a="undefined"!=typeof window?null!=(e=window.requestIdleCallback)?e:e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16):null,s="undefined"!=typeof window?null!=(n=window.cancelIdleCallback)?n:e=>window.clearTimeout(e):null,u=()=>{if(null!=i){try{null==s||s(i)}catch(e){}i=null}},d=e=>{const n=o.get(e);if(n){if(!n.visible.value){n.visible.value=!0;try{n.resolve()}catch(t){}}try{null==l||l.unobserve(e)}catch(t){}o.delete(e),r.delete(e),r.size||u()}},c=()=>{a&&null==i&&r.size&&(i=a(()=>{i=null;const e=r.values().next().value;e&&(r.delete(e),d(e),r.size&&c())},{timeout:1200}))};return e=>{const n=V(!1);let t,i=!1;const a=new Promise(e=>{t=()=>{i||(i=!0,e())}}),s=()=>{try{null==l||l.unobserve(e)}catch(n){}o.delete(e),r.delete(e),r.size||u()},h=l||("undefined"==typeof window||"undefined"==typeof IntersectionObserver?null:(l=new IntersectionObserver(e=>{for(const n of e)(n.isIntersecting||n.intersectionRatio>0)&&d(n.target)},{root:null,rootMargin:"300px",threshold:0}),l));return h?(o.set(e,{resolve:t,visible:n}),h.observe(e),r.add(e),c(),{isVisible:n,whenVisible:a,destroy:s}):(n.value=!0,t(),{isVisible:n,whenVisible:a,destroy:s})}}const At={key:2,class:"html-block-node__raw"},$t=["innerHTML"],Ht={key:1,class:"html-block-node__placeholder"},zt=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"HtmlBlockNode",props:{node:{},customId:{}},setup(e){const n=e,t=se({loader:()=>Promise.resolve().then(()=>Ur),suspensible:!1}),o=j(()=>{const e=y(n.node.attrs);if(!e)return;const t=w(e);return Object.keys(t).length>0?t:void 0}),l=j(()=>(Pe.value,Fe(n.customId))),r=C({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),i=V(null),a=V("undefined"==typeof window),s=V(n.node.content),u=j(()=>Array.isArray(n.node.children)?n.node.children:[]),d=j(()=>String(n.node.tag||"div")),c=j(()=>N.has(d.value.trim().toLowerCase())),h=j(()=>u.value.length>0&&!!n.node.tag&&!c.value),m=j(()=>{var e,t,o;if(h.value)return{mode:"structured"};if(!a.value)return{mode:"html",content:null!=(e=s.value)?e:""};const r=null!=(t=s.value)?t:n.node.content;if(!r)return{mode:"html",content:""};if(n.node.loading){const e=Qe(r,l.value);return null===e?{mode:"text",content:null!=(o=n.node.raw)?o:r}:{mode:"dynamic",nodes:e}}if(!Je(r,l.value))return{mode:"html",content:g(r)};const i=Qe(r,l.value);return null===i?{mode:"html",content:g(r)}:{mode:"dynamic",nodes:i}}),f=It(),p=V(null),v=!!n.node.loading;return"undefined"!=typeof window?(U(i,e=>{var t,o;if(null==(o=null==(t=p.value)?void 0:t.destroy)||o.call(t),p.value=null,!v)return a.value=!0,void(s.value=n.node.content);if(!e)return void(a.value=!1);const l=f(e,{rootMargin:"400px"});p.value=l,a.value=l.isVisible.value,l.whenVisible.then(()=>{a.value=!0})},{immediate:!0}),U(()=>n.node.content,e=>{v&&!a.value||(s.value=e)})):a.value=!0,G(()=>{var e,n;null==(n=null==(e=p.value)?void 0:e.destroy)||n.call(e),p.value=null}),(n,l)=>(T(),Z(ue(h.value?d.value:"div"),de({ref_key:"htmlRef",ref:i,class:"html-block-node"},h.value?o.value:void 0),{default:Q(()=>[a.value?(T(),E(H,{key:0},["structured"===m.value.mode?(T(),Z(A(t),{key:0,nodes:u.value,"custom-id":e.customId,"batch-rendering":!1,"defer-nodes-until-visible":!1},null,8,["nodes","custom-id"])):"dynamic"===m.value.mode?(T(),Z(A(r),{key:1,nodes:m.value.nodes},null,8,["nodes"])):"text"===m.value.mode?(T(),E("pre",At,R(m.value.content),1)):(T(),E("div",de({key:3},o.value,{innerHTML:m.value.content}),null,16,$t))],64)):(T(),E("div",Ht,[ie(n.$slots,"placeholder",{node:e.node},()=>[l[0]||(l[0]=$("span",{class:"html-block-node__placeholder-bar"},null,-1)),l[1]||(l[1]=$("span",{class:"html-block-node__placeholder-bar w-4/5"},null,-1)),l[2]||(l[2]=$("span",{class:"html-block-node__placeholder-bar w-2/3"},null,-1))],!0)]))]),_:3},16))}}),[["__scopeId","data-v-aba14778"]]);zt.install=e=>{e.component(zt.__name,zt)};const Rt={dir:"auto",class:"paragraph-node"},Wt=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"ParagraphNode",props:{node:{},customId:{},indexKey:{},customHtmlTags:{}},setup(e){const n=e,t=Fe(n.customId);function o(e){var n;return"text"===e.type&&""===String(null!=(n=e.content)?n:"").trim()}function l(e){var n;return String(null!=(n=e.content)?n:"")}const r=j(()=>n.node.children.filter(e=>!o(e))),i=j(()=>r.value.length>0&&r.value.every(e=>"image"===e.type||function(e){var n;const t=function(e){return"link"===e.type&&Array.isArray(e.children)?e.children.filter(e=>!o(e)):[]}(e);return 1===t.length&&"image"===(null==(n=t[0])?void 0:n.type)}(e))),u=j(()=>new Set(x(n.customHtmlTags))),d=j(()=>{if(!i.value||r.value.length<=1)return n.node.children;const e=[];for(let t=0;t<n.node.children.length;t++){const l=n.node.children[t];if(!o(l)){e.push(l);continue}const r=e.length>0,i=n.node.children.slice(t+1).some(e=>!o(e));r&&i&&e.push(s(a({},l),{content:" ",raw:" "}))}return e});function c(e,t){return{node:e,"index-key":`${n.indexKey}-${t}`,"custom-id":n.customId,"custom-html-tags":n.customHtmlTags}}const h=a({inline_code:ln,image:In,link:mt,hardbreak:_t,emphasis:wt,strong:it,strikethrough:st,highlight:gt,insert:pt,subscript:lt,superscript:nt,html_inline:nn,html_block:zt,emoji:He,checkbox:Ce,math_inline:Zn,checkbox_input:Ce,reference:Jn,footnote_anchor:xt,footnote_reference:qe,text:Gn},t);function m(e){var n,t,o,l;if("html_block"===e.type||"html_inline"===e.type){const r=String(null!=(n=e.tag)?n:"").trim().toLowerCase()||k(e.content);if(r&&!u.value.has(r)&&M(null!=(t=e.content)?t:e.raw,r)){const n=String(null!=(l=null!=(o=e.content)?o:e.raw)?l:"");return{child:{type:"text",content:n,raw:n},component:Gn}}}return{child:e,component:h[e.type]}}return(n,t)=>(T(),E("p",Rt,[(T(!0),E(H,null,z(d.value,(n,t)=>(T(),E(H,{key:`${e.indexKey||"paragraph"}-${t}`},[i.value&&o(n)?(T(),E(H,{key:0},[te(R(l(n)),1)],64)):(T(),Z(ue(m(n).component),de({key:1,ref_for:!0},c(m(n).child,t)),null,16))],64))),128))]))}}),[["__scopeId","data-v-a07f942f"]]);Wt.install=e=>{e.component(Wt.__name,Wt)};const Pt=["aria-busy","aria-label","data-language"],jt=["textContent"],Ft=/* @__PURE__ */C({__name:"PreCodeNode",props:{node:{}},setup(e){const n=e,t=j(()=>{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=j(()=>`language-${t.value}`),l=j(()=>{const e=t.value;return e?`Code block: ${e}`:"Code block"});return(n,r)=>(T(),E("pre",{class:F([o.value]),"aria-busy":!0===e.node.loading,"aria-label":l.value,"data-language":t.value,"data-markstream-pre":"1",tabindex:"0"},[$("code",{translate:"no",textContent:R(e.node.code)},null,8,jt)],10,Pt))}});Ft.install=e=>{e.component(Ft.__name,Ft)};const Kt={class:"table-node-wrapper"},Dt=["aria-busy"],Vt={key:0},Ut=["aria-label","onPointerdown"],qt={key:0,class:"table-node__loading",role:"status","aria-live":"polite"},Xt=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"TableNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e,t=j(()=>{var e;return null!=(e=n.node.loading)&&e}),o=j(()=>{var e;return null!=(e=n.node.rows)?e:[]}),l=V(null),r=V([]);let i=null;const a=j(()=>r.value.map(e=>e>0?{width:`${e}px`}:void 0)),s=j(()=>r.value.length>0);function u(e){if(!i)return;e.preventDefault();const n=i.startWidth+i.nextStartWidth,t=Math.min(48,Math.floor(n/2)),o=Math.max(t,Math.min(n-t,Math.round(i.startWidth+e.clientX-i.startX))),l=[...i.widths];l[i.index]=o,l[i.index+1]=n-o,r.value=l}function d(){i&&(window.removeEventListener("pointermove",u),window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",d),i=null)}return U(()=>n.node.header.cells.length,()=>{d(),r.value=[]}),G(d),(c,h)=>(T(),E("div",Kt,[$("table",{ref_key:"tableRef",ref:l,class:F(["table-node",{"table-node--loading":t.value}]),"aria-busy":t.value},[s.value?(T(),E("colgroup",Vt,[(T(!0),E(H,null,z(e.node.header.cells,(e,n)=>(T(),E("col",{key:`col-${n}`,style:ne(a.value[n])},null,4))),128))])):q("",!0),$("thead",null,[$("tr",null,[(T(!0),E(H,null,z(e.node.header.cells,(t,o)=>(T(),E("th",{key:`header-${o}`,dir:"auto",class:F(["right"===t.align?"text-right":"center"===t.align?"text-center":"text-left"])},[I(A(Vr),{nodes:t.children,"index-key":`table-th-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,onCopy:h[0]||(h[0]=e=>c.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter"]),o<e.node.header.cells.length-1?(T(),E("button",{key:0,type:"button",class:"table-node__resize-handle","aria-label":`Resize columns ${o+1} and ${o+2}`,onPointerdown:e=>function(e,n){if(0!==n.button)return;const t=function(){var e;const n=null==(e=l.value)?void 0:e.querySelectorAll("thead th");return Array.from(null!=n?n:[],e=>Math.round(e.getBoundingClientRect().width))}(),o=t[e],a=t[e+1];o&&a&&(n.preventDefault(),i={index:e,startX:n.clientX,startWidth:o,nextStartWidth:a,widths:t},r.value=t,window.addEventListener("pointermove",u),window.addEventListener("pointerup",d),window.addEventListener("pointercancel",d))}(o,e)},null,40,Ut)):q("",!0)],2))),128))])]),$("tbody",null,[(T(!0),E(H,null,z(o.value,(e,t)=>(T(),E("tr",{key:`row-${t}`},[(T(!0),E(H,null,z(e.cells,(e,o)=>(T(),E("td",{key:`cell-${t}-${o}`,class:F(["right"===e.align?"text-right":"center"===e.align?"text-center":"text-left"]),dir:"auto"},[I(A(Vr),{nodes:e.children,"index-key":`table-td-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,onCopy:h[1]||(h[1]=e=>c.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter"])],2))),128))]))),128))])],10,Dt),I(J,{name:"table-node-fade"},{default:Q(()=>[t.value?(T(),E("div",qt,[ie(c.$slots,"loading",{isLoading:t.value},()=>[h[2]||(h[2]=$("span",{class:"table-node__spinner animate-spin","aria-hidden":"true"},null,-1)),h[3]||(h[3]=$("span",{class:"sr-only"},"Loading",-1))],!0)])):q("",!0)]),_:3})]))}}),[["__scopeId","data-v-7a6d3bf6"]]);Xt.install=e=>{e.component(Xt.__name,Xt)};const Gt={class:"hr-node"},Zt=/* @__PURE__ */Se({},[["render",function(e,n){return T(),E("hr",Gt)}],["__scopeId","data-v-39b2349c"]]);Zt.install=e=>{e.component(Zt.__name,Zt)};const Yt={class:"unknown-node"},Jt=/* @__PURE__ */C({__name:"FallbackComponent",props:{node:{}},setup:e=>(n,t)=>(T(),E("div",Yt,R(e.node.raw),1))}),Qt=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"VmrContainerNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},customId:{}},setup(e){const n=e,t=j(()=>`vmr-container vmr-container-${n.node.name}`),o=Fe(n.customId),l=a({text:Gn,paragraph:Wt,heading:Ot,inline_code:ln,link:mt,image:In,strong:it,emphasis:wt,strikethrough:st,insert:pt,subscript:lt,superscript:nt,checkbox:Ce,checkbox_input:Ce,hardbreak:_t,math_inline:Zn,reference:Jn,list:Ct,math_block:Yn,table:Xt},o);return(o,r)=>(T(),E("div",de({class:t.value},e.node.attrs),[(T(!0),E(H,null,z(e.node.children,(t,o)=>{return T(),Z(ue((r=t.type,l[r]||Jt)),{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 r}),128))],16))}}),[["__scopeId","data-v-b0a43820"]]);Qt.install=e=>{e.component(Qt.__name,Qt)};const eo=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","BN","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],no=[[697,698,"ON"],[706,719,"ON"],[722,735,"ON"],[741,749,"ON"],[751,767,"ON"],[768,879,"NSM"],[884,885,"ON"],[894,894,"ON"],[900,901,"ON"],[903,903,"ON"],[1014,1014,"ON"],[1155,1161,"NSM"],[1418,1418,"ON"],[1421,1422,"ON"],[1423,1423,"ET"],[1424,1424,"R"],[1425,1469,"NSM"],[1470,1470,"R"],[1471,1471,"NSM"],[1472,1472,"R"],[1473,1474,"NSM"],[1475,1475,"R"],[1476,1477,"NSM"],[1478,1478,"R"],[1479,1479,"NSM"],[1480,1535,"R"],[1536,1541,"AN"],[1542,1543,"ON"],[1544,1544,"AL"],[1545,1546,"ET"],[1547,1547,"AL"],[1548,1548,"CS"],[1549,1549,"AL"],[1550,1551,"ON"],[1552,1562,"NSM"],[1563,1610,"AL"],[1611,1631,"NSM"],[1632,1641,"AN"],[1642,1642,"ET"],[1643,1644,"AN"],[1645,1647,"AL"],[1648,1648,"NSM"],[1649,1749,"AL"],[1750,1756,"NSM"],[1757,1757,"AN"],[1758,1758,"ON"],[1759,1764,"NSM"],[1765,1766,"AL"],[1767,1768,"NSM"],[1769,1769,"ON"],[1770,1773,"NSM"],[1774,1775,"AL"],[1776,1785,"EN"],[1786,1808,"AL"],[1809,1809,"NSM"],[1810,1839,"AL"],[1840,1866,"NSM"],[1867,1957,"AL"],[1958,1968,"NSM"],[1969,1983,"AL"],[1984,2026,"R"],[2027,2035,"NSM"],[2036,2037,"R"],[2038,2041,"ON"],[2042,2044,"R"],[2045,2045,"NSM"],[2046,2069,"R"],[2070,2073,"NSM"],[2074,2074,"R"],[2075,2083,"NSM"],[2084,2084,"R"],[2085,2087,"NSM"],[2088,2088,"R"],[2089,2093,"NSM"],[2094,2136,"R"],[2137,2139,"NSM"],[2140,2143,"R"],[2144,2191,"AL"],[2192,2193,"AN"],[2194,2198,"AL"],[2199,2207,"NSM"],[2208,2249,"AL"],[2250,2273,"NSM"],[2274,2274,"AN"],[2275,2306,"NSM"],[2362,2362,"NSM"],[2364,2364,"NSM"],[2369,2376,"NSM"],[2381,2381,"NSM"],[2385,2391,"NSM"],[2402,2403,"NSM"],[2433,2433,"NSM"],[2492,2492,"NSM"],[2497,2500,"NSM"],[2509,2509,"NSM"],[2530,2531,"NSM"],[2546,2547,"ET"],[2555,2555,"ET"],[2558,2558,"NSM"],[2561,2562,"NSM"],[2620,2620,"NSM"],[2625,2626,"NSM"],[2631,2632,"NSM"],[2635,2637,"NSM"],[2641,2641,"NSM"],[2672,2673,"NSM"],[2677,2677,"NSM"],[2689,2690,"NSM"],[2748,2748,"NSM"],[2753,2757,"NSM"],[2759,2760,"NSM"],[2765,2765,"NSM"],[2786,2787,"NSM"],[2801,2801,"ET"],[2810,2815,"NSM"],[2817,2817,"NSM"],[2876,2876,"NSM"],[2879,2879,"NSM"],[2881,2884,"NSM"],[2893,2893,"NSM"],[2901,2902,"NSM"],[2914,2915,"NSM"],[2946,2946,"NSM"],[3008,3008,"NSM"],[3021,3021,"NSM"],[3059,3064,"ON"],[3065,3065,"ET"],[3066,3066,"ON"],[3072,3072,"NSM"],[3076,3076,"NSM"],[3132,3132,"NSM"],[3134,3136,"NSM"],[3142,3144,"NSM"],[3146,3149,"NSM"],[3157,3158,"NSM"],[3170,3171,"NSM"],[3192,3198,"ON"],[3201,3201,"NSM"],[3260,3260,"NSM"],[3276,3277,"NSM"],[3298,3299,"NSM"],[3328,3329,"NSM"],[3387,3388,"NSM"],[3393,3396,"NSM"],[3405,3405,"NSM"],[3426,3427,"NSM"],[3457,3457,"NSM"],[3530,3530,"NSM"],[3538,3540,"NSM"],[3542,3542,"NSM"],[3633,3633,"NSM"],[3636,3642,"NSM"],[3647,3647,"ET"],[3655,3662,"NSM"],[3761,3761,"NSM"],[3764,3772,"NSM"],[3784,3790,"NSM"],[3864,3865,"NSM"],[3893,3893,"NSM"],[3895,3895,"NSM"],[3897,3897,"NSM"],[3898,3901,"ON"],[3953,3966,"NSM"],[3968,3972,"NSM"],[3974,3975,"NSM"],[3981,3991,"NSM"],[3993,4028,"NSM"],[4038,4038,"NSM"],[4141,4144,"NSM"],[4146,4151,"NSM"],[4153,4154,"NSM"],[4157,4158,"NSM"],[4184,4185,"NSM"],[4190,4192,"NSM"],[4209,4212,"NSM"],[4226,4226,"NSM"],[4229,4230,"NSM"],[4237,4237,"NSM"],[4253,4253,"NSM"],[4957,4959,"NSM"],[5008,5017,"ON"],[5120,5120,"ON"],[5760,5760,"WS"],[5787,5788,"ON"],[5906,5908,"NSM"],[5938,5939,"NSM"],[5970,5971,"NSM"],[6002,6003,"NSM"],[6068,6069,"NSM"],[6071,6077,"NSM"],[6086,6086,"NSM"],[6089,6099,"NSM"],[6107,6107,"ET"],[6109,6109,"NSM"],[6128,6137,"ON"],[6144,6154,"ON"],[6155,6157,"NSM"],[6158,6158,"BN"],[6159,6159,"NSM"],[6277,6278,"NSM"],[6313,6313,"NSM"],[6432,6434,"NSM"],[6439,6440,"NSM"],[6450,6450,"NSM"],[6457,6459,"NSM"],[6464,6464,"ON"],[6468,6469,"ON"],[6622,6655,"ON"],[6679,6680,"NSM"],[6683,6683,"NSM"],[6742,6742,"NSM"],[6744,6750,"NSM"],[6752,6752,"NSM"],[6754,6754,"NSM"],[6757,6764,"NSM"],[6771,6780,"NSM"],[6783,6783,"NSM"],[6832,6877,"NSM"],[6880,6891,"NSM"],[6912,6915,"NSM"],[6964,6964,"NSM"],[6966,6970,"NSM"],[6972,6972,"NSM"],[6978,6978,"NSM"],[7019,7027,"NSM"],[7040,7041,"NSM"],[7074,7077,"NSM"],[7080,7081,"NSM"],[7083,7085,"NSM"],[7142,7142,"NSM"],[7144,7145,"NSM"],[7149,7149,"NSM"],[7151,7153,"NSM"],[7212,7219,"NSM"],[7222,7223,"NSM"],[7376,7378,"NSM"],[7380,7392,"NSM"],[7394,7400,"NSM"],[7405,7405,"NSM"],[7412,7412,"NSM"],[7416,7417,"NSM"],[7616,7679,"NSM"],[8125,8125,"ON"],[8127,8129,"ON"],[8141,8143,"ON"],[8157,8159,"ON"],[8173,8175,"ON"],[8189,8190,"ON"],[8192,8202,"WS"],[8203,8205,"BN"],[8207,8207,"R"],[8208,8231,"ON"],[8232,8232,"WS"],[8233,8233,"B"],[8234,8238,"BN"],[8239,8239,"CS"],[8240,8244,"ET"],[8245,8259,"ON"],[8260,8260,"CS"],[8261,8286,"ON"],[8287,8287,"WS"],[8288,8303,"BN"],[8304,8304,"EN"],[8308,8313,"EN"],[8314,8315,"ES"],[8316,8318,"ON"],[8320,8329,"EN"],[8330,8331,"ES"],[8332,8334,"ON"],[8352,8399,"ET"],[8400,8432,"NSM"],[8448,8449,"ON"],[8451,8454,"ON"],[8456,8457,"ON"],[8468,8468,"ON"],[8470,8472,"ON"],[8478,8483,"ON"],[8485,8485,"ON"],[8487,8487,"ON"],[8489,8489,"ON"],[8494,8494,"ET"],[8506,8507,"ON"],[8512,8516,"ON"],[8522,8525,"ON"],[8528,8543,"ON"],[8585,8587,"ON"],[8592,8721,"ON"],[8722,8722,"ES"],[8723,8723,"ET"],[8724,9013,"ON"],[9083,9108,"ON"],[9110,9257,"ON"],[9280,9290,"ON"],[9312,9351,"ON"],[9352,9371,"EN"],[9450,9899,"ON"],[9901,10239,"ON"],[10496,11123,"ON"],[11126,11263,"ON"],[11493,11498,"ON"],[11503,11505,"NSM"],[11513,11519,"ON"],[11647,11647,"NSM"],[11744,11775,"NSM"],[11776,11869,"ON"],[11904,11929,"ON"],[11931,12019,"ON"],[12032,12245,"ON"],[12272,12287,"ON"],[12288,12288,"WS"],[12289,12292,"ON"],[12296,12320,"ON"],[12330,12333,"NSM"],[12336,12336,"ON"],[12342,12343,"ON"],[12349,12351,"ON"],[12441,12442,"NSM"],[12443,12444,"ON"],[12448,12448,"ON"],[12539,12539,"ON"],[12736,12773,"ON"],[12783,12783,"ON"],[12829,12830,"ON"],[12880,12895,"ON"],[12924,12926,"ON"],[12977,12991,"ON"],[13004,13007,"ON"],[13175,13178,"ON"],[13278,13279,"ON"],[13311,13311,"ON"],[19904,19967,"ON"],[42128,42182,"ON"],[42509,42511,"ON"],[42607,42610,"NSM"],[42611,42611,"ON"],[42612,42621,"NSM"],[42622,42623,"ON"],[42654,42655,"NSM"],[42736,42737,"NSM"],[42752,42785,"ON"],[42888,42888,"ON"],[43010,43010,"NSM"],[43014,43014,"NSM"],[43019,43019,"NSM"],[43045,43046,"NSM"],[43048,43051,"ON"],[43052,43052,"NSM"],[43064,43065,"ET"],[43124,43127,"ON"],[43204,43205,"NSM"],[43232,43249,"NSM"],[43263,43263,"NSM"],[43302,43309,"NSM"],[43335,43345,"NSM"],[43392,43394,"NSM"],[43443,43443,"NSM"],[43446,43449,"NSM"],[43452,43453,"NSM"],[43493,43493,"NSM"],[43561,43566,"NSM"],[43569,43570,"NSM"],[43573,43574,"NSM"],[43587,43587,"NSM"],[43596,43596,"NSM"],[43644,43644,"NSM"],[43696,43696,"NSM"],[43698,43700,"NSM"],[43703,43704,"NSM"],[43710,43711,"NSM"],[43713,43713,"NSM"],[43756,43757,"NSM"],[43766,43766,"NSM"],[43882,43883,"ON"],[44005,44005,"NSM"],[44008,44008,"NSM"],[44013,44013,"NSM"],[64285,64285,"R"],[64286,64286,"NSM"],[64287,64296,"R"],[64297,64297,"ES"],[64298,64335,"R"],[64336,64450,"AL"],[64451,64466,"ON"],[64467,64829,"AL"],[64830,64847,"ON"],[64848,64911,"AL"],[64912,64913,"ON"],[64914,64967,"AL"],[64968,64975,"ON"],[64976,65007,"BN"],[65008,65020,"AL"],[65021,65023,"ON"],[65024,65039,"NSM"],[65040,65049,"ON"],[65056,65071,"NSM"],[65072,65103,"ON"],[65104,65104,"CS"],[65105,65105,"ON"],[65106,65106,"CS"],[65108,65108,"ON"],[65109,65109,"CS"],[65110,65118,"ON"],[65119,65119,"ET"],[65120,65121,"ON"],[65122,65123,"ES"],[65124,65126,"ON"],[65128,65128,"ON"],[65129,65130,"ET"],[65131,65131,"ON"],[65136,65278,"AL"],[65279,65279,"BN"],[65281,65282,"ON"],[65283,65285,"ET"],[65286,65290,"ON"],[65291,65291,"ES"],[65292,65292,"CS"],[65293,65293,"ES"],[65294,65295,"CS"],[65296,65305,"EN"],[65306,65306,"CS"],[65307,65312,"ON"],[65339,65344,"ON"],[65371,65381,"ON"],[65504,65505,"ET"],[65506,65508,"ON"],[65509,65510,"ET"],[65512,65518,"ON"],[65520,65528,"BN"],[65529,65533,"ON"],[65534,65535,"BN"],[65793,65793,"ON"],[65856,65932,"ON"],[65936,65948,"ON"],[65952,65952,"ON"],[66045,66045,"NSM"],[66272,66272,"NSM"],[66273,66299,"EN"],[66422,66426,"NSM"],[67584,67870,"R"],[67871,67871,"ON"],[67872,68096,"R"],[68097,68099,"NSM"],[68100,68100,"R"],[68101,68102,"NSM"],[68103,68107,"R"],[68108,68111,"NSM"],[68112,68151,"R"],[68152,68154,"NSM"],[68155,68158,"R"],[68159,68159,"NSM"],[68160,68324,"R"],[68325,68326,"NSM"],[68327,68408,"R"],[68409,68415,"ON"],[68416,68863,"R"],[68864,68899,"AL"],[68900,68903,"NSM"],[68904,68911,"AL"],[68912,68921,"AN"],[68922,68927,"AL"],[68928,68937,"AN"],[68938,68968,"R"],[68969,68973,"NSM"],[68974,68974,"ON"],[68975,69215,"R"],[69216,69246,"AN"],[69247,69290,"R"],[69291,69292,"NSM"],[69293,69311,"R"],[69312,69327,"AL"],[69328,69336,"ON"],[69337,69369,"AL"],[69370,69375,"NSM"],[69376,69423,"R"],[69424,69445,"AL"],[69446,69456,"NSM"],[69457,69487,"AL"],[69488,69505,"R"],[69506,69509,"NSM"],[69510,69631,"R"],[69633,69633,"NSM"],[69688,69702,"NSM"],[69714,69733,"ON"],[69744,69744,"NSM"],[69747,69748,"NSM"],[69759,69761,"NSM"],[69811,69814,"NSM"],[69817,69818,"NSM"],[69826,69826,"NSM"],[69888,69890,"NSM"],[69927,69931,"NSM"],[69933,69940,"NSM"],[70003,70003,"NSM"],[70016,70017,"NSM"],[70070,70078,"NSM"],[70089,70092,"NSM"],[70095,70095,"NSM"],[70191,70193,"NSM"],[70196,70196,"NSM"],[70198,70199,"NSM"],[70206,70206,"NSM"],[70209,70209,"NSM"],[70367,70367,"NSM"],[70371,70378,"NSM"],[70400,70401,"NSM"],[70459,70460,"NSM"],[70464,70464,"NSM"],[70502,70508,"NSM"],[70512,70516,"NSM"],[70587,70592,"NSM"],[70606,70606,"NSM"],[70608,70608,"NSM"],[70610,70610,"NSM"],[70625,70626,"NSM"],[70712,70719,"NSM"],[70722,70724,"NSM"],[70726,70726,"NSM"],[70750,70750,"NSM"],[70835,70840,"NSM"],[70842,70842,"NSM"],[70847,70848,"NSM"],[70850,70851,"NSM"],[71090,71093,"NSM"],[71100,71101,"NSM"],[71103,71104,"NSM"],[71132,71133,"NSM"],[71219,71226,"NSM"],[71229,71229,"NSM"],[71231,71232,"NSM"],[71264,71276,"ON"],[71339,71339,"NSM"],[71341,71341,"NSM"],[71344,71349,"NSM"],[71351,71351,"NSM"],[71453,71453,"NSM"],[71455,71455,"NSM"],[71458,71461,"NSM"],[71463,71467,"NSM"],[71727,71735,"NSM"],[71737,71738,"NSM"],[71995,71996,"NSM"],[71998,71998,"NSM"],[72003,72003,"NSM"],[72148,72151,"NSM"],[72154,72155,"NSM"],[72160,72160,"NSM"],[72193,72198,"NSM"],[72201,72202,"NSM"],[72243,72248,"NSM"],[72251,72254,"NSM"],[72263,72263,"NSM"],[72273,72278,"NSM"],[72281,72283,"NSM"],[72330,72342,"NSM"],[72344,72345,"NSM"],[72544,72544,"NSM"],[72546,72548,"NSM"],[72550,72550,"NSM"],[72752,72758,"NSM"],[72760,72765,"NSM"],[72850,72871,"NSM"],[72874,72880,"NSM"],[72882,72883,"NSM"],[72885,72886,"NSM"],[73009,73014,"NSM"],[73018,73018,"NSM"],[73020,73021,"NSM"],[73023,73029,"NSM"],[73031,73031,"NSM"],[73104,73105,"NSM"],[73109,73109,"NSM"],[73111,73111,"NSM"],[73459,73460,"NSM"],[73472,73473,"NSM"],[73526,73530,"NSM"],[73536,73536,"NSM"],[73538,73538,"NSM"],[73562,73562,"NSM"],[73685,73692,"ON"],[73693,73696,"ET"],[73697,73713,"ON"],[78912,78912,"NSM"],[78919,78933,"NSM"],[90398,90409,"NSM"],[90413,90415,"NSM"],[92912,92916,"NSM"],[92976,92982,"NSM"],[94031,94031,"NSM"],[94095,94098,"NSM"],[94178,94178,"ON"],[94180,94180,"NSM"],[113821,113822,"NSM"],[113824,113827,"BN"],[117760,117973,"ON"],[118e3,118009,"EN"],[118010,118012,"ON"],[118016,118451,"ON"],[118458,118480,"ON"],[118496,118512,"ON"],[118528,118573,"NSM"],[118576,118598,"NSM"],[119143,119145,"NSM"],[119155,119162,"BN"],[119163,119170,"NSM"],[119173,119179,"NSM"],[119210,119213,"NSM"],[119273,119274,"ON"],[119296,119361,"ON"],[119362,119364,"NSM"],[119365,119365,"ON"],[119552,119638,"ON"],[120513,120513,"ON"],[120539,120539,"ON"],[120571,120571,"ON"],[120597,120597,"ON"],[120629,120629,"ON"],[120655,120655,"ON"],[120687,120687,"ON"],[120713,120713,"ON"],[120745,120745,"ON"],[120771,120771,"ON"],[120782,120831,"EN"],[121344,121398,"NSM"],[121403,121452,"NSM"],[121461,121461,"NSM"],[121476,121476,"NSM"],[121499,121503,"NSM"],[121505,121519,"NSM"],[122880,122886,"NSM"],[122888,122904,"NSM"],[122907,122913,"NSM"],[122915,122916,"NSM"],[122918,122922,"NSM"],[123023,123023,"NSM"],[123184,123190,"NSM"],[123566,123566,"NSM"],[123628,123631,"NSM"],[123647,123647,"ET"],[124140,124143,"NSM"],[124398,124399,"NSM"],[124643,124643,"NSM"],[124646,124646,"NSM"],[124654,124655,"NSM"],[124661,124661,"NSM"],[124928,125135,"R"],[125136,125142,"NSM"],[125143,125251,"R"],[125252,125258,"NSM"],[125259,126063,"R"],[126064,126143,"AL"],[126144,126207,"R"],[126208,126287,"AL"],[126288,126463,"R"],[126464,126703,"AL"],[126704,126705,"ON"],[126706,126719,"AL"],[126720,126975,"R"],[126976,127019,"ON"],[127024,127123,"ON"],[127136,127150,"ON"],[127153,127167,"ON"],[127169,127183,"ON"],[127185,127221,"ON"],[127232,127242,"EN"],[127243,127247,"ON"],[127279,127279,"ON"],[127338,127343,"ON"],[127405,127405,"ON"],[127584,127589,"ON"],[127744,128728,"ON"],[128732,128748,"ON"],[128752,128764,"ON"],[128768,128985,"ON"],[128992,129003,"ON"],[129008,129008,"ON"],[129024,129035,"ON"],[129040,129095,"ON"],[129104,129113,"ON"],[129120,129159,"ON"],[129168,129197,"ON"],[129200,129211,"ON"],[129216,129217,"ON"],[129232,129240,"ON"],[129280,129623,"ON"],[129632,129645,"ON"],[129648,129660,"ON"],[129664,129674,"ON"],[129678,129734,"ON"],[129736,129736,"ON"],[129741,129756,"ON"],[129759,129770,"ON"],[129775,129784,"ON"],[129792,129938,"ON"],[129940,130031,"ON"],[130032,130041,"EN"],[130042,130042,"ON"],[131070,131071,"BN"],[196606,196607,"BN"],[262142,262143,"BN"],[327678,327679,"BN"],[393214,393215,"BN"],[458750,458751,"BN"],[524286,524287,"BN"],[589822,589823,"BN"],[655358,655359,"BN"],[720894,720895,"BN"],[786430,786431,"BN"],[851966,851967,"BN"],[917502,917759,"BN"],[917760,917999,"NSM"],[918e3,921599,"BN"],[983038,983039,"BN"],[1048574,1048575,"BN"],[1114110,1114111,"BN"]];function to(e){if(e<=255)return eo[e];let n=0,t=no.length-1;for(;n<=t;){const o=n+t>>1,l=no[o];if(e<l[0])t=o-1;else{if(!(e>l[1]))return l[2];n=o+1}}return"L"}const oo=/[ \t\n\r\f]+/g,lo=/[\t\n\r\f]| {2,}|^ | $/;let ro=null;const io=new RegExp("\\p{Script=Arabic}","u"),ao=new RegExp("\\p{M}","u"),so=new RegExp("\\p{Nd}","u");function uo(e){return io.test(e)}function co(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=44032&&e<=55215||e>=65280&&e<=65519}function ho(e){for(let n=0;n<e.length;n++){const t=e.charCodeAt(n);if(!(t<12288)){if(t>=55296&&t<=56319&&n+1<e.length){const o=e.charCodeAt(n+1);if(o>=56320&&o<=57343){if(co(o-56320+(t-55296<<10)+65536))return!0;n++;continue}}if(co(t))return!0}}return!1}const mo=/* @__PURE__ */new Set([" "," ","","\ufeff"]);function fo(e){return ho(e)}function po(e){return!function(e){const n=Oo(e);return null!==n&&(vo.has(n)||wo.has(n))}(e)&&!function(e){const n=Oo(e);return null!==n&&mo.has(n)}(e)}const vo=/* @__PURE__ */new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),go=/* @__PURE__ */new Set(['"',"(","[","{","“","‘","«","‹","(","〔","〈","《","「","『","【","〖","〘","〚"]),yo=/* @__PURE__ */new Set(["'","’"]),wo=/* @__PURE__ */new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),No=/* @__PURE__ */new Set([":",".","،","؛"]),xo=/* @__PURE__ */new Set(["၏"]),ko=/* @__PURE__ */new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function Mo(e){if(_o(e))return!0;let n=!1;for(const t of e)if(wo.has(t))n=!0;else if(!n||!ao.test(t))return!1;return n}function bo(e){for(const n of e)if(!vo.has(n)&&!wo.has(n))return!1;return e.length>0}function So(e){if(_o(e))return!0;for(const n of e)if(!go.has(n)&&!yo.has(n)&&!ao.test(n))return!1;return e.length>0}function _o(e){let n=!1;for(const t of e)if("\\"!==t&&!ao.test(t)){if(!(go.has(t)||wo.has(t)||yo.has(t)))return!1;n=!0}return n}function Bo(e,n){const t=n-1;if(t<=0)return Math.max(t,0);const o=e.charCodeAt(t);if(o<56320||o>57343)return t;const l=t-1;if(l<0)return t;const r=e.charCodeAt(l);return r>=55296&&r<=56319?l:t}function Oo(e){if(0===e.length)return null;const n=Bo(e,e.length);return e.slice(n)}function Lo(e){const n=Array.from(e);let t=n.length;for(;t>0;){const e=n[t-1];if(ao.test(e))t--;else{if(!go.has(e)&&!yo.has(e))break;t--}}return t<=0||t===n.length?null:{head:n.slice(0,t).join(""),tail:n.slice(t).join("")}}function Co(e,n,t){return"text"!==t||n||1!==e.length||"-"===e||"—"===e?null:e}function To(e,n,t,o){const l=n[o],r=e[o];if(null==l)return r;const i=t[o];if(r.length===i)return r;const a=l.repeat(i);return e[o]=a,a}function Eo(e,n){return e&&null!==n&&No.has(n)}function Io(e){const n=Oo(e);return null!==n&&xo.has(n)}function Ao(e){if(e.length<2||" "!==e[0])return null;const n=e.slice(1);return new RegExp("^\\p{M}+$","u").test(n)?{space:" ",marks:n}:null}function $o(e){let n=e.length;for(;n>0;){const t=Bo(e,n),o=e.slice(t,n);if(ko.has(o))return!0;if(!wo.has(o))return!1;n=t}return!1}function Ho(e,n){if(n.preserveOrdinarySpaces||n.preserveHardBreaks){if(" "===e)return"preserved-space";if("\t"===e)return"tab";if(n.preserveHardBreaks&&"\n"===e)return"hard-break"}return" "===e?"space":" "===e||" "===e||""===e||"\ufeff"===e?"glue":""===e?"zero-width-break":""===e?"soft-hyphen":"text"}const zo=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function Ro(e){return 1===e.length?e[0]:e.join("")}function Wo(e,n){const t=[];for(let o=e.length-1;o>=0;o--)t.push(e[o]);return t.push(n),Ro(t)}function Po(e,n,t,o){if(!zo.test(e))return[{text:e,isWordLike:n,kind:"text",start:t}];const l=[];let r=null,i=[],a=t,s=!1,u=0;for(const d of e){const e=Ho(d,o),c="text"===e&&n;null===r||e!==r||c!==s?(null!==r&&l.push({text:Ro(i),isWordLike:s,kind:r,start:a}),r=e,i=[d],a=t+u,s=c,u+=d.length):(i.push(d),u+=d.length)}return null!==r&&l.push({text:Ro(i),isWordLike:s,kind:r,start:a}),l}function jo(e){return"space"===e||"preserved-space"===e||"zero-width-break"===e||"hard-break"===e}const Fo=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function Ko(e,n){const t=e.texts[n];return!!t.startsWith("www.")||Fo.test(t)&&n+1<e.len&&"text"===e.kinds[n+1]&&"//"===e.texts[n+1]}function Do(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}const Vo=/* @__PURE__ */new Set([":","-","/","×",",",".","+","–","—"]),Uo=/^[A-Za-z0-9_]+[,:;]*$/,qo=/[,:;]+$/;function Xo(e){for(const n of e)if(so.test(n))return!0;return!1}function Go(e){if(0===e.length)return!1;for(const n of e)if(!so.test(n)&&!Vo.has(n))return!1;return!0}function Zo(e,n,t){var o,l,r;const i=(null===ro&&(ro=new Intl.Segmenter(void 0,{granularity:"word"})),ro);let a=0;const s=[],u=[],d=[],c=[],h=[],m=[],f=[],p=[],v=[],g=[],y=[],w=[];for(const b of i.segment(e))for(const e of Po(b.segment,null!=(o=b.isWordLike)&&o,b.index,t)){let t=function(){null!==m[b]&&(u[b]=[To(s,m,f,b)],m[b]=null),u[b].push(e.text),d[b]=d[b]||e.isWordLike,p[b]=p[b]||i,v[b]=v[b]||N,g[b]=k,y[b]=M,w[b]=Eo(v[b],x)};const o="text"===e.kind,r=Co(e.text,e.isWordLike,e.kind),i=ho(e.text),N=uo(e.text),x=Oo(e.text),k=$o(e.text),M=Io(e.text),b=a-1;n.carryCJKAfterClosingQuote&&o&&a>0&&"text"===c[b]&&i&&p[b]&&g[b]||o&&a>0&&"text"===c[b]&&bo(e.text)&&p[b]||o&&a>0&&"text"===c[b]&&y[b]?t():o&&a>0&&"text"===c[b]&&e.isWordLike&&N&&w[b]?(t(),d[b]=!0):null!==r&&a>0&&"text"===c[b]&&m[b]===r?f[b]=(null!=(l=f[b])?l:1)+1:o&&!e.isWordLike&&a>0&&"text"===c[b]&&(Mo(e.text)||"-"===e.text&&d[b])?t():(s[a]=e.text,u[a]=[e.text],d[a]=e.isWordLike,c[a]=e.kind,h[a]=e.start,m[a]=r,f[a]=null===r?0:1,p[a]=i,v[a]=N,g[a]=k,y[a]=M,w[a]=Eo(N,x),a++)}for(let b=0;b<a;b++)null===m[b]?s[b]=Ro(u[b]):s[b]=To(s,m,f,b);for(let b=1;b<a;b++)"text"===c[b]&&!d[b]&&_o(s[b])&&"text"===c[b-1]&&(s[b-1]+=s[b],d[b-1]=d[b-1]||d[b],s[b]="");const N=Array.from({length:a},()=>null);let x=-1;for(let b=a-1;b>=0;b--){const e=s[b];if(0!==e.length){if("text"===c[b]&&!d[b]&&So(e)&&x>=0&&"text"===c[x]){const n=null!=(r=N[x])?r:[];n.push(e),N[x]=n,h[x]=h[b],s[b]="";continue}x=b}}for(let b=0;b<a;b++){const e=N[b];null!=e&&(s[b]=Wo(e,s[b]))}let k=0;for(let b=0;b<a;b++){const e=s[b];0!==e.length&&(k!==b&&(s[k]=e,d[k]=d[b],c[k]=c[b],h[k]=h[b]),k++)}s.length=k,d.length=k,c.length=k,h.length=k;const M=function(e){const n=e.texts.slice(),t=e.isWordLike.slice(),o=e.kinds.slice(),l=e.starts.slice();for(let r=0;r<n.length-1;r++){if("text"!==o[r]||"text"!==o[r+1])continue;if(!ho(n[r])||!ho(n[r+1]))continue;const e=Lo(n[r]);null!==e&&(n[r]=e.head,n[r+1]=e.tail+n[r+1],l[r+1]=l[r]+e.head.length)}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];for(let r=0;r<e.len;r++){const i=e.texts[r],a=e.kinds[r],s=e.isWordLike[r];if("text"===a&&s&&Uo.test(i)){const a=[i];let s=qo.test(i),u=r+1;for(;s&&u<e.len&&"text"===e.kinds[u]&&e.isWordLike[u]&&Uo.test(e.texts[u]);){const n=e.texts[u];a.push(n),s=qo.test(n),u++}n.push(Ro(a)),t.push(!0),o.push("text"),l.push(e.starts[r]),r=u-1;continue}n.push(i),t.push(s),o.push(a),l.push(e.starts[r])}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];for(let r=0;r<e.len;r++){const i=e.texts[r];if("text"===e.kinds[r]&&i.includes("-")){const a=i.split("-");let s=a.length>1;for(let e=0;e<a.length;e++){const n=a[e];if(!s)break;0!==n.length&&Xo(n)&&Go(n)||(s=!1)}if(s){let i=0;for(let s=0;s<a.length;s++){const u=a[s],d=s<a.length-1?`${u}-`:u;n.push(d),t.push(!0),o.push("text"),l.push(e.starts[r]+i),i+=d.length}continue}}n.push(i),t.push(e.isWordLike[r]),o.push(e.kinds[r]),l.push(e.starts[r])}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];for(let r=0;r<e.len;r++){const i=e.texts[r],a=e.kinds[r];if("text"===a&&Go(i)&&Xo(i)){const a=[i];let s=r+1;for(;s<e.len&&"text"===e.kinds[s]&&Go(e.texts[s]);)a.push(e.texts[s]),s++;n.push(Ro(a)),t.push(!0),o.push("text"),l.push(e.starts[r]),r=s-1;continue}n.push(i),t.push(e.isWordLike[r]),o.push(a),l.push(e.starts[r])}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];for(let r=0;r<e.len;r++){const i=e.texts[r];if(n.push(i),t.push(e.isWordLike[r]),o.push(e.kinds[r]),l.push(e.starts[r]),!Do(i))continue;const a=r+1;if(a>=e.len||jo(e.kinds[a]))continue;const s=[],u=e.starts[a];let d=a;for(;d<e.len&&!jo(e.kinds[d]);)s.push(e.texts[d]),d++;s.length>0&&(n.push(Ro(s)),t.push(!0),o.push("text"),l.push(u),r=d-1)}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=e.texts.slice(),t=e.isWordLike.slice(),o=e.kinds.slice(),l=e.starts.slice();for(let i=0;i<e.len;i++){if("text"!==o[i]||!Ko(e,i))continue;const l=[n[i]];let r=i+1;for(;r<e.len&&!jo(o[r]);){l.push(n[r]),t[i]=!0;const e=n[r].includes("?");if(o[r]="text",n[r]="",r++,e)break}n[i]=Ro(l)}let r=0;for(let i=0;i<n.length;i++){const e=n[i];0!==e.length&&(r!==i&&(n[r]=e,t[r]=t[i],o[r]=o[i],l[r]=l[i]),r++)}return n.length=r,t.length=r,o.length=r,l.length=r,{len:r,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];let r=0;for(;r<e.len;){const i=[e.texts[r]];let a=e.isWordLike[r],s=e.kinds[r],u=e.starts[r];if("glue"===s){const d=[i[0]],c=u;for(r++;r<e.len&&"glue"===e.kinds[r];)d.push(e.texts[r]),r++;const h=Ro(d);if(!(r<e.len&&"text"===e.kinds[r])){n.push(h),t.push(!1),o.push("glue"),l.push(c);continue}i[0]=h,i.push(e.texts[r]),a=e.isWordLike[r],s="text",u=c,r++}else r++;if("text"===s)for(;r<e.len&&"glue"===e.kinds[r];){const n=[];for(;r<e.len&&"glue"===e.kinds[r];)n.push(e.texts[r]),r++;const t=Ro(n);r<e.len&&"text"===e.kinds[r]?(i.push(t,e.texts[r]),a=a||e.isWordLike[r],r++):i.push(t)}n.push(Ro(i)),t.push(a),o.push(s),l.push(u)}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}({len:k,texts:s,isWordLike:d,kinds:c,starts:h})))))));for(let b=0;b<M.len-1;b++){const e=Ao(M.texts[b]);null!==e&&("space"!==M.kinds[b]&&"preserved-space"!==M.kinds[b]||"text"!==M.kinds[b+1]||!uo(M.texts[b+1])||(M.texts[b]=e.space,M.isWordLike[b]=!1,M.kinds[b]="preserved-space"===M.kinds[b]?"preserved-space":"space",M.texts[b+1]=e.marks+M.texts[b+1],M.starts[b+1]=M.starts[b]+e.space.length))}return M}function Yo(e,n){if(0===e.len)return[];if(!n.preserveHardBreaks)return[{startSegmentIndex:0,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}];const t=[];let o=0;for(let l=0;l<e.len;l++)"hard-break"===e.kinds[l]&&(t.push({startSegmentIndex:o,endSegmentIndex:l,consumedEndSegmentIndex:l+1}),o=l+1);return o<e.len&&t.push({startSegmentIndex:o,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}),t}let Jo=null;const Qo=/* @__PURE__ */new Map;let el=null;const nl=new RegExp("\\p{Emoji_Presentation}","u"),tl=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;let ol=null;const ll=/* @__PURE__ */new Map;function rl(){if(null!==Jo)return Jo;if("undefined"!=typeof OffscreenCanvas)return Jo=new OffscreenCanvas(1,1).getContext("2d"),Jo;if("undefined"!=typeof document)return Jo=document.createElement("canvas").getContext("2d"),Jo;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function il(e,n){let t=n.get(e);return void 0===t&&(t={width:rl().measureText(e).width,containsCJK:ho(e)},n.set(e,t)),t}function al(){if(null!==el)return el;if("undefined"==typeof navigator)return el={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},el;const e=navigator.userAgent,n="Apple Computer, Inc."===navigator.vendor&&e.includes("Safari/")&&!e.includes("Chrome/")&&!e.includes("Chromium/")&&!e.includes("CriOS/")&&!e.includes("FxiOS/")&&!e.includes("EdgiOS/"),t=e.includes("Chrome/")||e.includes("Chromium/")||e.includes("CriOS/")||e.includes("Edg/");return el={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:t,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},el}function sl(){return null===ol&&(ol=new Intl.Segmenter(void 0,{granularity:"grapheme"})),ol}function ul(e){return nl.test(e)||e.includes("️")}function dl(e,n,t){return 0===t?n.width:n.width-function(e,n){return void 0===n.emojiCount&&(n.emojiCount=function(e){let n=0;const t=sl();for(const o of t.segment(e))ul(o.segment)&&n++;return n}(e)),n.emojiCount}(e,n)*t}function cl(e,n){for(;n<e.widths.length;){const t=e.kinds[n];if("space"!==t&&"zero-width-break"!==t&&"soft-hyphen"!==t)break;n++}return n}function hl(e,n){if(n<=0)return 0;const t=e%n;return Math.abs(t)<=1e-6?n:n-t}function ml(e,n,t){const{widths:o,kinds:l,breakableFitAdvances:r}=e;if(0===o.length)return 0;const i=n+al().lineFitEpsilon;let a=0,s=0,u=!1,d=0,c=0,h=-1,m=0;function f(e=d,n=c,t=s){a++,s=0,u=!1,h=-1,m=0}function p(e,n){u=!0,d=e+1,c=0,s=n}function v(e,n,t){u=!0,d=e,c=n+1,s=t}function g(e,n){u?(s+=n,d=e+1,c=0):p(e,n)}function y(e,n){const t=r[e];for(let o=n;o<t.length;o++){const n=t[o];u?s+n>i?(f(),v(e,o,n)):(s+=n,d=e,c=o+1):v(e,o,n)}u&&d===e&&c===t.length&&(d=e+1,c=0)}let w=0;for(;w<o.length&&(u||(w=cl(e,w),!(w>=o.length)));){const e=o[w],t=l[w],a="space"===t||"preserved-space"===t||"tab"===t||"zero-width-break"===t||"soft-hyphen"===t;if(u)if(s+e>i){if(a){g(w,e),f(w+1,0,s-e),w++;continue}if(h>=0){if(d>h||d===h&&c>0){f();continue}f(h,0,m);continue}if(e>n&&null!==r[w]){f(),y(w,0),w++;continue}f()}else g(w,e),a&&(h=w+1,m=s-e),w++;else e>n&&null!==r[w]?y(w,0):p(w,e),a&&(h=w+1,m=s-e),w++}return u&&f(),a}let fl=null;function pl(e,n){const t=[];let o=[],l=0,r=!1,i=!1,a=!1;function s(){0!==o.length&&(t.push({text:1===o.length?o[0]:o.join(""),start:l}),o=[],r=!1,i=!1,a=!1)}function u(e,n,t){o=[e],l=n,r=t,i=$o(e),a=go.has(e)}function d(e,n){o.push(e),r=r||n;const t=$o(e);i=1===e.length&&wo.has(e)&&i||t,a=!1}for(const c of(null===fl&&(fl=new Intl.Segmenter(void 0,{granularity:"grapheme"})),fl).segment(e)){const e=c.segment,t=ho(e);0!==o.length?a||vo.has(e)||wo.has(e)||n.carryCJKAfterClosingQuote&&t&&i?d(e,t):r||t?(s(),u(e,c.index,t)):d(e,t):u(e,c.index,t)}return s(),t}function vl(e){if(e.length<=1)return e;const n=[];let t=[e[0].text],o=e[0].start,l=ho(e[0].text),r=po(e[0].text);function i(){n.push({text:1===t.length?t[0]:t.join(""),start:o})}for(let a=1;a<e.length;a++){const n=e[a],s=ho(n.text),u=po(n.text);l&&r?(t.push(n.text),l=l||s,r=u):(i(),t=[n.text],o=n.start,l=s,r=u)}return i(),n}function gl(e,n,t,o){const l=al(),{cache:r,emojiCorrection:i}=function(e,n){rl().font=e;const t=function(e){let n=Qo.get(e);return n||(n=/* @__PURE__ */new Map,Qo.set(e,n)),n}(e),o=function(e){const n=e.match(/(\d+(?:\.\d+)?)\s*px/);return n?parseFloat(n[1]):16}(e),l=n?function(e,n){let t=ll.get(e);if(void 0!==t)return t;const o=rl();o.font=e;const l=o.measureText("😀").width;if(t=0,l>n+.5&&"undefined"!=typeof document&&null!==document.body){const n=document.createElement("span");n.style.font=e,n.style.display="inline-block",n.style.visibility="hidden",n.style.position="absolute",n.textContent="😀",document.body.appendChild(n);const o=n.getBoundingClientRect().width;document.body.removeChild(n),l-o>.5&&(t=l-o)}return ll.set(e,t),t}(e,o):0;return{cache:t,fontSize:o,emojiCorrection:l}}(n,(a=e.normalized,tl.test(a)));var a;const s=dl("-",il("-",r),i),u=8*dl(" ",il(" ",r),i);if(0===e.len)return{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]};const d=[],c=[],h=[],m=[];let f=e.chunks.length<=1;const p=t?[]:null,v=[],g=t?[]:null,y=Array.from({length:e.len});function w(e,n,t,o,l,r,i){"text"!==l&&"space"!==l&&"zero-width-break"!==l&&(f=!1),d.push(n),c.push(t),h.push(o),m.push(l),null==p||p.push(r),v.push(i),null!==g&&g.push(e)}function N(e,n,t,o,a){const s=il(e,r),u=dl(e,s,i),d="space"===n||"preserved-space"===n||"zero-width-break"===n?0:u,c="space"===n||"zero-width-break"===n?0:u;if(a&&o&&e.length>1){let o="sum-graphemes";Go(e)?o="pair-context":l.preferPrefixWidthsForBreakableRuns&&(o="segment-prefixes");const a=function(e,n,t,o,l){if(void 0!==n.breakableFitAdvances)return n.breakableFitAdvances;const r=sl(),i=[];for(const d of r.segment(e))i.push(d.segment);if(i.length<=1)return n.breakableFitAdvances=null,n.breakableFitAdvances;if("sum-graphemes"===l){const e=[];for(const n of i){const l=il(n,t);e.push(dl(n,l,o))}return n.breakableFitAdvances=e,n.breakableFitAdvances}if("pair-context"===l||i.length>96){const e=[];let l=null,r=0;for(const n of i){const i=dl(n,il(n,t),o);if(null===l)e.push(i);else{const i=l+n,a=il(i,t);e.push(dl(i,a,o)-r)}l=n,r=i}return n.breakableFitAdvances=e,n.breakableFitAdvances}const a=[];let s="",u=0;for(const d of i){s+=d;const e=dl(s,il(s,t),o);a.push(e-u),u=e}return n.breakableFitAdvances=a,n.breakableFitAdvances}(e,s,r,i,o);return void w(e,u,d,c,n,t,a)}w(e,u,d,c,n,t,null)}for(let M=0;M<e.len;M++){y[M]=d.length;const n=e.texts[M],t=e.isWordLike[M],i=e.kinds[M],a=e.starts[M];if("soft-hyphen"===i){w(n,0,s,s,i,a,null);continue}if("hard-break"===i){w(n,0,0,0,i,a,null);continue}if("tab"===i){w(n,0,0,0,i,a,null);continue}const u=il(n,r);if("text"===i&&u.containsCJK){const e=pl(n,l),r="keep-all"===o?vl(e):e;for(let n=0;n<r.length;n++){const e=r[n];N(e.text,"text",a+e.start,t,"keep-all"===o||!ho(e.text))}continue}N(n,i,a,t,!0)}const x=function(e,n,t){const o=[];for(let l=0;l<e.length;l++){const r=e[l],i=r.startSegmentIndex<n.length?n[r.startSegmentIndex]:t,a=r.endSegmentIndex<n.length?n[r.endSegmentIndex]:t,s=r.consumedEndSegmentIndex<n.length?n[r.consumedEndSegmentIndex]:t;o.push({startSegmentIndex:i,endSegmentIndex:a,consumedEndSegmentIndex:s})}return o}(e.chunks,y,d.length),k=null===p?null:function(e,n){const t=function(e){const n=e.length;if(0===n)return null;const t=new Array(n);let o=!1;for(let u=0;u<n;){const l=e.charCodeAt(u);let r=l,i=1;if(l>=55296&&l<=56319&&u+1<n){const n=e.charCodeAt(u+1);n>=56320&&n<=57343&&(r=n-56320+(l-55296<<10)+65536,i=2)}const a=to(r);"R"!==a&&"AL"!==a&&"AN"!==a||(o=!0);for(let e=0;e<i;e++)t[u+e]=a;u+=i}if(!o)return null;let l=0;for(let u=0;u<n;u++){const e=t[u];if("L"===e){l=0;break}if("R"===e||"AL"===e){l=1;break}}const r=new Int8Array(n);for(let u=0;u<n;u++)r[u]=l;const i=1&l?"R":"L",a=i;let s=a;for(let u=0;u<n;u++)"NSM"===t[u]?t[u]=s:s=t[u];s=a;for(let u=0;u<n;u++){const e=t[u];"EN"===e?t[u]="AL"===s?"AN":"EN":"R"!==e&&"L"!==e&&"AL"!==e||(s=e)}for(let u=0;u<n;u++)"AL"===t[u]&&(t[u]="R");for(let u=1;u<n-1;u++)"ES"===t[u]&&"EN"===t[u-1]&&"EN"===t[u+1]&&(t[u]="EN"),"CS"!==t[u]||"EN"!==t[u-1]&&"AN"!==t[u-1]||t[u+1]!==t[u-1]||(t[u]=t[u-1]);for(let u=0;u<n;u++){if("EN"!==t[u])continue;let e;for(e=u-1;e>=0&&"ET"===t[e];e--)t[e]="EN";for(e=u+1;e<n&&"ET"===t[e];e++)t[e]="EN"}for(let u=0;u<n;u++){const e=t[u];"WS"!==e&&"ES"!==e&&"ET"!==e&&"CS"!==e||(t[u]="ON")}s=a;for(let u=0;u<n;u++){const e=t[u];"EN"===e?t[u]="L"===s?"L":"EN":"R"!==e&&"L"!==e||(s=e)}for(let u=0;u<n;u++){if("ON"!==t[u])continue;let e=u+1;for(;e<n&&"ON"===t[e];)e++;const o="L"!==(u>0?t[u-1]:a)?"R":"L";if(o===("L"!==(e<n?t[e]:a)?"R":"L"))for(let n=u;n<e;n++)t[n]=o;u=e-1}for(let u=0;u<n;u++)"ON"===t[u]&&(t[u]=i);for(let u=0;u<n;u++){const e=t[u];1&r[u]?"L"!==e&&"AN"!==e&&"EN"!==e||r[u]++:"R"===e?r[u]++:"AN"!==e&&"EN"!==e||(r[u]+=2)}return r}(e);if(null===t)return null;const o=new Int8Array(n.length);for(let l=0;l<n.length;l++)o[l]=t[n[l]];return o}(e.normalized,p);return null!==g?{widths:d,lineEndFitAdvances:c,lineEndPaintAdvances:h,kinds:m,simpleLineWalkFastPath:f,segLevels:k,breakableFitAdvances:v,discretionaryHyphenWidth:s,tabStopAdvance:u,chunks:x,segments:g}:{widths:d,lineEndFitAdvances:c,lineEndPaintAdvances:h,kinds:m,simpleLineWalkFastPath:f,segLevels:k,breakableFitAdvances:v,discretionaryHyphenWidth:s,tabStopAdvance:u,chunks:x}}function yl(e,n,t){return function(e,n,t,o){var l;const r=null!=(l=null==o?void 0:o.wordBreak)?l:"normal";return gl(function(e,n,t="normal",o="normal"){const l=function(e){const n=null!=e?e:"normal";return"pre-wrap"===n?{mode:n,preserveOrdinarySpaces:!0,preserveHardBreaks:!0}:{mode:n,preserveOrdinarySpaces:!1,preserveHardBreaks:!1}}(t),r="pre-wrap"===l.mode?function(e){return/[\r\f]/.test(e)?e.replace(/\r\n/g,"\n").replace(/[\r\f]/g,"\n"):e.replace(/\r\n/g,"\n")}(e):function(e){if(!lo.test(e))return e;let n=e.replace(oo," ");return 32===n.charCodeAt(0)&&(n=n.slice(1)),n.length>0&&32===n.charCodeAt(n.length-1)&&(n=n.slice(0,-1)),n}(e);if(0===r.length)return{normalized:r,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};const i="keep-all"===o?function(e){if(e.len<=1)return e;const n=[],t=[],o=[],l=[];let r=null,i=!1,a=0,s=!1,u=!1;function d(){null!==r&&(n.push(Ro(r)),t.push(i),o.push("text"),l.push(a),r=null)}for(let c=0;c<e.len;c++){const h=e.texts[c],m=e.kinds[c],f=e.isWordLike[c],p=e.starts[c];if("text"===m){const e=fo(h),n=po(h);if(null!==r&&s&&u){r.push(h),i=i||f,s=s||e,u=n;continue}d(),r=[h],i=f,a=p,s=e,u=n;continue}d(),n.push(h),t.push(f),o.push(m),l.push(p)}return d(),{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(Zo(r,n,l)):Zo(r,n,l);return a({normalized:r,chunks:Yo(i,l)},i)}(e,al(),null==o?void 0:o.whiteSpace,r),n,!1,r)}(e,n,0,t)}const wl="__MARKSTREAM_VUE_HEIGHT_ESTIMATION_EXPERIMENT__",Nl=(()=>{const e=globalThis;if(e[wl])return e[wl];const n={configs:{},controllers:{},revision:W(0),preparedCache:/* @__PURE__ */new Map,blockEstimateCache:/* @__PURE__ */new Map};return e[wl]=n,n})();let xl=null;const kl=Nl.revision;function Ml(e){var n;return e&&null!=(n=Nl.configs[e])?n:null}function bl(e,n){const t=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(t)&&t>0?t:n}function Sl(e){return"text"===(null==e?void 0:e.type)||"emoji"===(null==e?void 0:e.type)||"hardbreak"===(null==e?void 0:e.type)}function _l(e){var n,t,o;if(!Array.isArray(e)||0===e.length)return null;let l="";for(const r of e){if(!Sl(r))return null;"text"===r.type?l+=String(null!=(n=r.content)?n:""):"emoji"===r.type?l+=String(null!=(o=null!=(t=r.name)?t:r.raw)?o:""):"hardbreak"===r.type&&(l+="\n")}return l.length>0?l:null}function Bl(e,n,t){var o,l;if(!e||!Number.isFinite(n)||n<=0||!function(){var e;if(null!=xl)return xl;if("undefined"==typeof document)return!1;try{const n=document.createElement("canvas");return xl=!!(null==(e=n.getContext)?void 0:e.call(n,"2d")),xl}catch(n){return xl=!1,!1}}())return null;try{const r=Math.round(100*n)/100,i=[null!=(o=t.whiteSpace)?o:"pre-wrap",t.font,t.lineHeight,t.wrapperOverhead,t.widthAdjustment,r,e].join("\0"),a=Nl.blockEstimateCache.get(i);if(a)return Nl.blockEstimateCache.delete(i),Nl.blockEstimateCache.set(i,a),{kind:"simple-text",height:a.height,contentHeight:a.contentHeight};const s=null!=(l=t.whiteSpace)?l:"pre-wrap",u=function(e,n,t){const o=`${t}\0${n}\0${e}`,l=Nl.preparedCache.get(o);if(l)return Nl.preparedCache.delete(o),Nl.preparedCache.set(o,l),l.prepared;const r=yl(e,n,{whiteSpace:t});for(Nl.preparedCache.set(o,{prepared:r});Nl.preparedCache.size>240;){const e=Nl.preparedCache.keys().next().value;if(!e)break;Nl.preparedCache.delete(e)}return r}(e,t.font,s),d=function(e,n,t){const o=function(e,n){return e.simpleLineWalkFastPath?ml(e,n):function(e,n){if(e.simpleLineWalkFastPath)return ml(e,n);const{widths:t,lineEndFitAdvances:o,lineEndPaintAdvances:l,kinds:r,breakableFitAdvances:i,discretionaryHyphenWidth:a,tabStopAdvance:s,chunks:u}=e;if(0===t.length||0===u.length)return 0;const d=al(),c=d.lineFitEpsilon,h=n+c;let m=0,f=0,p=!1,v=0,g=0,y=-1,w=0,N=0,x=null;function k(){y=-1,w=0,N=0,x=null}function M(e=v,n=g,t=f){m++,f=0,p=!1,k()}function b(e,n){p=!0,v=e+1,g=0,f=n}function S(e,n,t){p=!0,v=e,g=n+1,f=t}function _(e,n){p?(f+=n,v=e+1,g=0):b(e,n)}function B(e,n,t,r){if(!n)return;const i="tab"===e?0:o[t],a="tab"===e?r:l[t];y=t+1,w=f-r+i,N=f-r+a,x=e}function O(e,n){const t=i[e];for(let o=n;o<t.length;o++){const n=t[o];p?f+n>h?(M(),S(e,o,n)):(f+=n,v=e,g=o+1):S(e,o,n)}p&&v===e&&g===t.length&&(v=e+1,g=0)}function L(e){if("soft-hyphen"!==x)return!1;const t=i[e];if(null==t)return!1;const{fitCount:o,fittedWidth:l}=function(e,n,t,o,l){let r=0,i=n;for(;r<e.length;){const n=i+e[r];if((r+1<e.length?n+l:n)>t+o)break;i=n,r++}return{fitCount:r,fittedWidth:i}}(t,f,n,c,a);return 0!==o&&(f=l,v=e,g=o,k(),o===t.length?(v=e+1,g=0,!0):(M(e,o,l+a),O(e,o),!0))}function C(e){m++,k()}for(let T=0;T<u.length;T++){const e=u[T];if(e.startSegmentIndex===e.endSegmentIndex){C();continue}p=!1,f=0,e.startSegmentIndex,v=e.startSegmentIndex,g=0,k();let c=e.startSegmentIndex;for(;c<e.endSegmentIndex;){const e=r[c],u="space"===e||"preserved-space"===e||"tab"===e||"zero-width-break"===e||"soft-hyphen"===e,m="tab"===e?hl(f,s):t[c];if("soft-hyphen"!==e)if(p){if(f+m>h){const t=f+("tab"===e?0:o[c]),r=f+("tab"===e?m:l[c]);if("soft-hyphen"===x&&d.preferEarlySoftHyphenBreak&&w<=h){M(y,0,N);continue}if("soft-hyphen"===x&&L(c)){c++;continue}if(u&&t<=h){_(c,m),M(c+1,0,r),c++;continue}if(y>=0&&w<=h){if(v>y||v===y&&g>0){M();continue}const e=y;M(e,0,N),c=e;continue}if(m>n&&null!==i[c]){M(),O(c,0),c++;continue}M();continue}_(c,m),B(e,u,c,m),c++}else m>n&&null!==i[c]?O(c,0):b(c,m),B(e,u,c,m),c++;else p&&(v=c+1,g=0,y=c+1,w=f+a,N=f+a,x=e),c++}if(p){const n=y===e.consumedEndSegmentIndex?N:f;M(e.consumedEndSegmentIndex,0,n)}}return m}(e,n)}(e,n);return{lineCount:o,height:o*t}}(u,Math.max(24,r-t.widthAdjustment),t.lineHeight),c=Math.max(t.lineHeight,d.height),h=Math.max(t.lineHeight,Math.round(c+t.wrapperOverhead));for(Nl.blockEstimateCache.set(i,{height:h,contentHeight:Math.round(c)});Nl.blockEstimateCache.size>4e3;){const e=Nl.blockEstimateCache.keys().next().value;if(!e)break;Nl.blockEstimateCache.delete(e)}return{kind:"simple-text",height:h,contentHeight:Math.round(c)}}catch(r){return null}}function Ol(e,n,t){var o,l;if(!t||!e||!Number.isFinite(n)||n<=0)return null;if("paragraph"===e.type){const o=_l(e.children);return o&&t.paragraph?Bl(o,n,t.paragraph):null}if("heading"===e.type){const o=Number(e.level||0),l=_l(e.children),r=t.headings[o];return l&&r?Bl(l,n,r):null}if("list_item"===e.type){const r=Array.isArray(e.children)?e.children:[];if(1!==r.length||"paragraph"!==(null==(o=r[0])?void 0:o.type)||!t.listItem)return null;const i=_l(null==(l=r[0])?void 0:l.children);return i?Bl(i,n,t.listItem):null}if("list"===e.type){const o=Array.isArray(e.items)?e.items:[];if(!o.length)return null;let l=Math.max(0,t.listWrapperOverhead);for(const e of o){const o=Ol(e,n,t);if(!o)return null;l+=o.height}return{kind:"simple-text",height:Math.max(1,Math.round(l)),contentHeight:Math.max(1,Math.round(l))}}return null}function Ll(e){if(!e)return 1;const n=String(e).split(/\r?\n/);return Math.max(1,n.length)}function Cl(e){return e?`${e.fontStyle||"normal"} ${e.fontWeight||"400"} ${e.fontSize||"16px"} ${e.fontFamily||"sans-serif"}`:""}function Tl(e,n,t="pre-wrap"){if(!e||!n||"undefined"==typeof window)return null;const o=window.getComputedStyle(n),l=e.offsetHeight,r=bl(o.lineHeight,1.5*bl(o.fontSize,16)),i=e.getBoundingClientRect().width,a=n.getBoundingClientRect().width;return{font:Cl(o),lineHeight:r,wrapperOverhead:Math.max(0,l-r),widthAdjustment:Math.max(0,i-a),whiteSpace:t}}let El=!1,Il=null,Al=null,$l=!1,Hl=null;function zl(){return d(this,null,function*(){if(Hl)return Hl;Hl=d(null,null,function*(){if(!Al){if($l)return null;try{Al=yield import("stream-monaco")}catch(e){return $l=!0,null}}try{return yield function(e){return d(this,null,function*(){if(El)return;if(Il)return Il;const n=d(null,null,function*(){const n=null==globalThis?void 0:globalThis.MonacoEnvironment;n&&("function"==typeof n.getWorker||"function"==typeof n.getWorkerUrl)||"function"!=typeof(null==e?void 0:e.preloadMonacoWorkers)||(yield e.preloadMonacoWorkers()),El=!0});return Il=n.finally(()=>{Il=null}),Il})}(Al),Al}catch(e){return null}});try{return yield Hl}finally{Hl=null}})}const Rl=/* @__PURE__ */new Map;let Wl="material";const Pl=/* @__PURE__ */new Map,jl=/* @__PURE__ */new Map;let Fl=null;function Kl(e){Rl.set(e.id,e)}function Dl(e){if(!Rl.has(e))throw new Error(`[markstream-vue] Unknown icon theme: "${e}". Registered: ${[...Rl.keys()].join(", ")}`);Wl=e,null==Fl||Fl();const n=Rl.get(e);n.loadExtended&&!Pl.has(e)&&Ul(n)}function Vl(){return[...Rl.keys()]}function Ul(e){return d(this,null,function*(){var n,t,o;if(Pl.has(e.id))return null!=(n=Pl.get(e.id))?n:null;let l=jl.get(e.id);return l||(l=(null!=(o=null==(t=e.loadExtended)?void 0:t.call(e))?o:Promise.resolve(null)).then(n=>(Pl.set(e.id,n),null==Fl||Fl(),n)).catch(()=>(Pl.set(e.id,null),null)),jl.set(e.id,l)),l})}function ql({R:e,H:n=0,B:t=50}){const o=e*(1-n)||1e-6;return Math.max(1,Math.floor(t/o))}function Xl(e){const n=e.length+10*(e.match(/\\/g)||[]).length;return n<10?"simple":n<40?"medium":"complex"}function Gl(e){switch(e){case"simple":return 3;case"medium":return 10;case"complex":return 30}}function Zl(e,n){var t,o;let l=0;for(const r of e){const e=Gl(Xl(r));e>l&&(l=e)}return ql({R:l,H:null!=(t=null==n?void 0:n.H)?t:0,B:null!=(o=null==n?void 0:n.B)?o:50})}const Yl='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M30 14v-2h-2V8h-2v4h-2V8h-2v4h-2v2h2v2h-2v2h2v4h2v-4h2v4h2v-4h2v-2h-2v-2Zm-4 2h-2v-2h2Zm-12.437 6A5.57 5.57 0 0 1 8 16.437v-2.873A5.57 5.57 0 0 1 13.563 8H18V2h-4.437A11.563 11.563 0 0 0 2 13.563v2.873A11.564 11.564 0 0 0 13.563 28H18v-6Z"/></svg>',Jl='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path d="M0 0h24v24H0z"/><path fill="#42a5f5" d="M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5z"/></svg>',Ql={id:"material",core:{"":Jl,plain:'<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path d="M0 0h24v24H0z"/><path fill="#42a5f5" d="M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5z"/></svg>',text:Jl,javascript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ffca28" d="M2 2v12h12V2zm6 6h1v4a1.003 1.003 0 0 1-1 1H7a1.003 1.003 0 0 1-1-1v-1h1v1h1zm3 0h2v1h-2v1h1a1.003 1.003 0 0 1 1 1v1a1.003 1.003 0 0 1-1 1h-2v-1h2v-1h-1a1.003 1.003 0 0 1-1-1V9a1.003 1.003 0 0 1 1-1"/></svg>',typescript:'<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 16 16"><path fill="#0288d1" d="M2 2v12h12V2zm4 6h3v1H8v4H7V9H6zm5 0h2v1h-2v1h1a1.003 1.003 0 0 1 1 1v1a1.003 1.003 0 0 1-1 1h-2v-1h2v-1h-1a1.003 1.003 0 0 1-1-1V9a1.003 1.003 0 0 1 1-1"/></svg>',jsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#00bcd4" d="M16 12c7.444 0 12 2.59 12 4s-4.556 4-12 4-12-2.59-12-4 4.556-4 12-4m0-2c-7.732 0-14 2.686-14 6s6.268 6 14 6 14-2.686 14-6-6.268-6-14-6"/><path fill="#00bcd4" d="M16 14a2 2 0 1 0 2 2 2 2 0 0 0-2-2"/><path fill="#00bcd4" d="M10.458 5.507c2.017 0 5.937 3.177 9.006 8.493 3.722 6.447 3.757 11.687 2.536 12.392a.9.9 0 0 1-.457.1c-2.017 0-5.938-3.176-9.007-8.492C8.814 11.553 8.779 6.313 10 5.608a.9.9 0 0 1 .458-.1m-.001-2A2.87 2.87 0 0 0 9 3.875C6.13 5.532 6.938 12.304 10.804 19c3.284 5.69 7.72 9.493 10.74 9.493A2.87 2.87 0 0 0 23 28.124c2.87-1.656 2.062-8.428-1.804-15.124-3.284-5.69-7.72-9.493-10.74-9.493Z"/><path fill="#00bcd4" d="M21.543 5.507a.9.9 0 0 1 .457.1c1.221.706 1.186 5.946-2.536 12.393-3.07 5.316-6.99 8.493-9.007 8.493a.9.9 0 0 1-.457-.1C8.779 25.686 8.814 20.446 12.536 14c3.07-5.316 6.99-8.493 9.007-8.493m0-2c-3.02 0-7.455 3.804-10.74 9.493C6.939 19.696 6.13 26.468 9 28.124a2.87 2.87 0 0 0 1.457.369c3.02 0 7.455-3.804 10.74-9.493C25.061 12.304 25.87 5.532 23 3.876a2.87 2.87 0 0 0-1.457-.369"/></svg>',tsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M16 12c7.444 0 12 2.59 12 4s-4.556 4-12 4-12-2.59-12-4 4.556-4 12-4m0-2c-7.732 0-14 2.686-14 6s6.268 6 14 6 14-2.686 14-6-6.268-6-14-6"/><path fill="#0288d1" d="M16 14a2 2 0 1 0 2 2 2 2 0 0 0-2-2"/><path fill="#0288d1" d="M10.458 5.507c2.017 0 5.937 3.177 9.006 8.493 3.722 6.447 3.757 11.687 2.536 12.392a.9.9 0 0 1-.457.1c-2.017 0-5.938-3.176-9.007-8.492C8.814 11.553 8.779 6.313 10 5.608a.9.9 0 0 1 .458-.1m-.001-2A2.87 2.87 0 0 0 9 3.875C6.13 5.532 6.938 12.304 10.804 19c3.284 5.69 7.72 9.493 10.74 9.493A2.87 2.87 0 0 0 23 28.124c2.87-1.656 2.062-8.428-1.804-15.124-3.284-5.69-7.72-9.493-10.74-9.493Z"/><path fill="#0288d1" d="M21.543 5.507a.9.9 0 0 1 .457.1c1.221.706 1.186 5.946-2.536 12.393-3.07 5.316-6.99 8.493-9.007 8.493a.9.9 0 0 1-.457-.1C8.779 25.686 8.814 20.446 12.536 14c3.07-5.316 6.99-8.493 9.007-8.493m0-2c-3.02 0-7.455 3.804-10.74 9.493C6.939 19.696 6.13 26.468 9 28.124a2.87 2.87 0 0 0 1.457.369c3.02 0 7.455-3.804 10.74-9.493C25.061 12.304 25.87 5.532 23 3.876a2.87 2.87 0 0 0-1.457-.369"/></svg>',html:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#e65100" d="m4 4 2 22 10 2 10-2 2-22Zm19.72 7H11.28l.29 3h11.86l-.802 9.335L15.99 25l-6.635-1.646L8.93 19h3.02l.19 2 3.86.77 3.84-.77.29-4H8.84L8 8h16Z"/></svg>',css:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#7e57c2" d="M20 18h-2v-2h-2v2c0 .193 0 .703 1.254 1.033A3.345 3.345 0 0 1 20 22h2v2h2v-2c0-.388-.562-.851-1.254-1.034C20.356 20.34 20 18.84 20 18m-3.254 2.966C14.356 20.34 14 18.84 14 18h-2v-2h-2v8h2v-2h4v2h2v-2c0-.388-.562-.851-1.254-1.034"/><path fill="#7e57c2" d="M24 4H4v20a4 4 0 0 0 4 4h16.16A3.84 3.84 0 0 0 28 24.16V8a4 4 0 0 0-4-4m2 14h-2v-2h-2v2c0 .193 0 .703 1.254 1.033A3.345 3.345 0 0 1 26 22v2a2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2 2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2 2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2 2 2 0 0 1 2-2h2a2 2 0 0 1 2 2 2 2 0 0 1 2-2h2a2 2 0 0 1 2 2Z"/></svg>',scss:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ec407a" d="M27.837 5.673a4.33 4.33 0 0 0-2.293-2.701c-2.362-1.261-6.11-1.298-9.548-.092a26.3 26.3 0 0 0-8.76 4.966c-2.752 2.542-3.438 4.925-3.189 6.194.523 2.668 3.274 4.539 5.485 6.042.418.284.822.559 1.175.816-1.429.76-4.261 2.444-5.088 4.248a3.88 3.88 0 0 0-.118 3.332A2.37 2.37 0 0 0 6.869 29.8a5.6 5.6 0 0 0 1.49.2 6.35 6.35 0 0 0 5.19-2.856 6.74 6.74 0 0 0 .864-5.382 7.3 7.3 0 0 1 2.044-.03 3.92 3.92 0 0 1 2.816 1.311 1.82 1.82 0 0 1 .423 1.262 1.55 1.55 0 0 1-.772 1.05c-.234.14-.586.355-.504.803.036.194.198.633.894.512a2.93 2.93 0 0 0 2.145-2.651 4 4 0 0 0-1.197-2.904 5.94 5.94 0 0 0-4.396-1.626 10.6 10.6 0 0 0-2.672.304 20 20 0 0 0-2.203-1.846c-1.712-1.3-3.33-2.529-3.235-4.26.125-2.263 2.468-4.532 6.964-6.744 4.016-1.976 7.254-2.037 8.944-1.438a2 2 0 0 1 1.204.883 2.77 2.77 0 0 1-.36 2.47 9.71 9.71 0 0 1-7.425 4.304 3.86 3.86 0 0 1-3.238-.757c-.278-.302-.593-.645-1.074-.383q-.565.31-.225 1.189a3.9 3.9 0 0 0 2.407 1.92 11.7 11.7 0 0 0 7.128-.671c3.527-1.35 6.681-5.202 5.756-8.787M11.895 24.475a4 4 0 0 1-.192.468 4.5 4.5 0 0 1-.753 1.081 2.83 2.83 0 0 1-2.533 1.107c-.056-.032-.078-.146-.085-.193a3.28 3.28 0 0 1 1.076-2.284 11.3 11.3 0 0 1 2.644-1.933 3.85 3.85 0 0 1-.157 1.754"/></svg>',json:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path fill="#f9a825" d="M560-160v-80h120q17 0 28.5-11.5T720-280v-80q0-38 22-69t58-44v-14q-36-13-58-44t-22-69v-80q0-17-11.5-28.5T680-720H560v-80h120q50 0 85 35t35 85v80q0 17 11.5 28.5T840-560h40v160h-40q-17 0-28.5 11.5T800-360v80q0 50-35 85t-85 35zm-280 0q-50 0-85-35t-35-85v-80q0-17-11.5-28.5T120-400H80v-160h40q17 0 28.5-11.5T160-600v-80q0-50 35-85t85-35h120v80H280q-17 0-28.5 11.5T240-680v80q0 38-22 69t-58 44v14q36 13 58 44t22 69v80q0 17 11.5 28.5T280-240h120v80z"/></svg>',python:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#0288d1" d="M9.86 2A2.86 2.86 0 0 0 7 4.86v1.68h4.29c.39 0 .71.57.71.96H4.86A2.86 2.86 0 0 0 2 10.36v3.781a2.86 2.86 0 0 0 2.86 2.86h1.18v-2.68a2.85 2.85 0 0 1 2.85-2.86h5.25c1.58 0 2.86-1.271 2.86-2.851V4.86A2.86 2.86 0 0 0 14.14 2zm-.72 1.61c.4 0 .72.12.72.71s-.32.891-.72.891c-.39 0-.71-.3-.71-.89s.32-.711.71-.711"/><path fill="#fdd835" d="M17.959 7v2.68a2.85 2.85 0 0 1-2.85 2.859H9.86A2.85 2.85 0 0 0 7 15.389v3.75a2.86 2.86 0 0 0 2.86 2.86h4.28A2.86 2.86 0 0 0 17 19.14v-1.68h-4.291c-.39 0-.709-.57-.709-.96h7.14A2.86 2.86 0 0 0 22 13.64V9.86A2.86 2.86 0 0 0 19.14 7zM8.32 11.513l-.004.004.038-.004zm6.54 7.276c.39 0 .71.3.71.89a.71.71 0 0 1-.71.71c-.4 0-.72-.12-.72-.71s.32-.89.72-.89"/></svg>',ruby:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#f44336" d="M18.041 3.177c2.24.382 2.879 1.919 2.843 3.527V6.67l-1.013 13.266-13.132.897h.008c-1.093-.044-3.518-.151-3.634-3.545l1.217-2.222 2.462 5.74 2.097-6.77-.045.009.018-.018 6.85 2.186L13.945 9.3l6.53-.409-5.144-4.212 2.71-1.51v.009M3.113 17.252v.017zM6.916 6.874c2.63-2.622 6.033-4.168 7.34-2.844 1.297 1.306-.072 4.523-2.702 7.135-2.666 2.613-6.015 4.248-7.322 2.933-1.306-1.324.036-4.612 2.675-7.224z"/></svg>',go:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#00acc1" d="M2 12h4v2H2zm-2 4h6v2H0zm4 4h2v2H4zm16.954-5H14v3h3.239a4.42 4.42 0 0 1-3.531 2 2.65 2.65 0 0 1-2.053-.858 2.86 2.86 0 0 1-.628-2.28A4.515 4.515 0 0 1 15.292 13a2.73 2.73 0 0 1 1.749.584l2.962-1.185A5.6 5.6 0 0 0 15.292 10a7.526 7.526 0 0 0-7.243 6.5 5.614 5.614 0 0 0 5.659 6.5 7.526 7.526 0 0 0 7.243-6.5 6.4 6.4 0 0 0 .003-1.5"/><path fill="#00acc1" d="M26.292 10a7.526 7.526 0 0 0-7.243 6.5 5.614 5.614 0 0 0 5.659 6.5 7.526 7.526 0 0 0 7.243-6.5 5.614 5.614 0 0 0-5.659-6.5m2.681 6.137A4.515 4.515 0 0 1 24.708 20a2.65 2.65 0 0 1-2.053-.858 2.86 2.86 0 0 1-.628-2.28A4.515 4.515 0 0 1 26.292 13a2.65 2.65 0 0 1 2.053.858 2.86 2.86 0 0 1 .628 2.28Z"/></svg>',java:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#f44336" d="M4 26h24v2H4zM28 4H7a1 1 0 0 0-1 1v13a4 4 0 0 0 4 4h10a4 4 0 0 0 4-4v-4h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2m0 8h-4V6h4Z"/></svg>',kotlin:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><defs><linearGradient id="a" x1="1.725" x2="22.185" y1="22.67" y2="1.982" gradientTransform="translate(1.306 1.129)scale(.89324)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#7c4dff"/><stop offset=".5" stop-color="#d500f9"/><stop offset="1" stop-color="#ef5350"/></linearGradient></defs><path fill="url(#a)" d="M2.975 2.976v18.048h18.05v-.03l-4.478-4.511-4.48-4.515 4.48-4.515 4.443-4.477z"/></svg>',c:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M19.563 22A5.57 5.57 0 0 1 14 16.437v-2.873A5.57 5.57 0 0 1 19.563 8H24V2h-4.437A11.563 11.563 0 0 0 8 13.563v2.873A11.564 11.564 0 0 0 19.563 28H24v-6Z"/></svg>',cpp:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M28 14v-4h-2v4h-6v-4h-2v4h-4v2h4v4h2v-4h6v4h2v-4h4v-2z"/><path fill="#0288d1" d="M13.563 22A5.57 5.57 0 0 1 8 16.437v-2.873A5.57 5.57 0 0 1 13.563 8H18V2h-4.437A11.563 11.563 0 0 0 2 13.563v2.873A11.564 11.564 0 0 0 13.563 28H18v-6Z"/></svg>',cs:Yl,csharp:Yl,php:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#1e88e5" d="M12 18.08c-6.63 0-12-2.72-12-6.08s5.37-6.08 12-6.08S24 8.64 24 12s-5.37 6.08-12 6.08m-5.19-7.95c.54 0 .91.1 1.09.31.18.2.22.56.13 1.03-.1.53-.29.87-.58 1.09q-.42.33-1.29.33h-.87l.53-2.76zm-3.5 5.55h1.44l.34-1.75h1.23c.54 0 .98-.06 1.33-.17.35-.12.67-.31.96-.58.24-.22.43-.46.58-.73.15-.26.26-.56.31-.88.16-.78.05-1.39-.33-1.82-.39-.44-.99-.65-1.82-.65H4.59zm7.25-8.33-1.28 6.58h1.42l.74-3.77h1.14c.36 0 .6.06.71.18s.13.34.07.66l-.57 2.93h1.45l.59-3.07c.13-.62.03-1.07-.27-1.36-.3-.27-.85-.4-1.65-.4h-1.27L12 7.35zM18 10.13c.55 0 .91.1 1.09.31.18.2.22.56.13 1.03-.1.53-.29.87-.57 1.09-.29.22-.72.33-1.3.33h-.85l.5-2.76zm-3.5 5.55h1.44l.34-1.75h1.22c.55 0 1-.06 1.35-.17.35-.12.65-.31.95-.58.24-.22.44-.46.58-.73.15-.26.26-.56.32-.88.15-.78.04-1.39-.34-1.82-.36-.44-.99-.65-1.82-.65h-2.75z"/></svg>',shell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ff7043" d="M2 2a1 1 0 0 0-1 1v10c0 .554.446 1 1 1h12c.554 0 1-.446 1-1V3a1 1 0 0 0-1-1zm0 3h12v8H2zm1 2 2 2-2 2 1 1 3-3-3-3zm5 3.5V12h5v-1.5z"/></svg>',powershell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#03a9f4" d="M29.07 6H7.677A1.535 1.535 0 0 0 6.24 7.113l-4.2 17.774A.852.852 0 0 0 2.93 26h21.393a1.535 1.535 0 0 0 1.436-1.113L29.96 7.112A.852.852 0 0 0 29.07 6M8.626 23.797a1.4 1.4 0 0 1-1.814-.31l-.007-.009a1.075 1.075 0 0 1 .315-1.599l9.6-6.061-6.102-5.852-.01-.01a1.068 1.068 0 0 1 .084-1.625l.037-.03a1.38 1.38 0 0 1 1.8.07l7.233 6.957a1.1 1.1 0 0 1 .236.739 1.08 1.08 0 0 1-.412.79c-.074.04-.146.119-10.951 6.935ZM24 22.94A1.135 1.135 0 0 1 22.803 24h-5.634a1.061 1.061 0 1 1 .001-2.112h5.633A1.134 1.134 0 0 1 24 22.938Z"/></svg>',sql:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ffca28" d="M16 24c-5.525 0-10-.9-10-2v4c0 1.1 4.475 2 10 2s10-.9 10-2v-4c0 1.1-4.475 2-10 2m0-8c-5.525 0-10-.9-10-2v4c0 1.1 4.475 2 10 2s10-.9 10-2v-4c0 1.1-4.475 2-10 2m0-12C10.477 4 6 4.895 6 6v4c0 1.1 4.475 2 10 2s10-.9 10-2V6c0-1.105-4.477-2-10-2"/></svg>',yaml:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#ff5252" d="M13 9h5.5L13 3.5zM6 2h8l6 6v12c0 1.1-.9 2-2 2H6c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2m12 16v-2H9v2zm-4-4v-2H6v2z"/></svg>',markdown:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#42a5f5" d="m14 10-4 3.5L6 10H4v12h4v-6l2 2 2-2v6h4V10zm12 6v-6h-4v6h-4l6 8 6-8z"/></svg>',xml:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#8bc34a" d="M13 9h5.5L13 3.5zM6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4c0-1.11.89-2 2-2m.12 13.5 3.74 3.74 1.42-1.41-2.33-2.33 2.33-2.33-1.42-1.41zm11.16 0-3.74-3.74-1.42 1.41 2.33 2.33-2.33 2.33 1.42 1.41z"/></svg>',rust:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ff7043" d="m30 12-4-2V6h-4l-2-4-4 2-4-2-2 4H6v4l-4 2 2 4-2 4 4 2v4h4l2 4 4-2 4 2 2-4h4v-4l4-2-2-4ZM6 16a9.9 9.9 0 0 1 .842-4H10v8H6.842A9.9 9.9 0 0 1 6 16m10 10a9.98 9.98 0 0 1-7.978-4H16v-2h-2v-2h4c.819.819.297 2.308 1.179 3.37a1.89 1.89 0 0 0 1.46.63h3.34A9.98 9.98 0 0 1 16 26m-2-12v-2h4a1 1 0 0 1 0 2Zm11.158 6H24a2.006 2.006 0 0 1-2-2 2 2 0 0 0-2-2 3 3 0 0 0 3-3q0-.08-.004-.161A3.115 3.115 0 0 0 19.83 10H8.022a9.986 9.986 0 0 1 17.136 10"/></svg>',vue:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#41b883" d="M1.791 3.851 12 21.471 22.209 3.936V3.85H18.24l-6.18 10.616L5.906 3.851z"/><path fill="#35495e" d="m5.907 3.851 6.152 10.617L18.24 3.851h-3.723L12.084 8.03 9.66 3.85z"/></svg>',mermaid:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#42a5f5" d="m14 10-4 3.5L6 10H4v12h4v-6l2 2 2-2v6h4V10zm12 6v-6h-4v6h-4l6 8 6-8z"/></svg>'},fallback:'<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ff7043" d="M2 2a1 1 0 0 0-1 1v10c0 .554.446 1 1 1h12c.554 0 1-.446 1-1V3a1 1 0 0 0-1-1zm0 3h12v8H2zm1 2 2 2-2 2 1 1 3-3-3-3zm5 3.5V12h5v-1.5z"/></svg>',loadExtended:()=>import("./extended.js").then(e=>e.materialExtendedMap)};let er=null;const nr=W(0);Fl=()=>{nr.value++},Kl(Ql);const tr={"":"",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 or(e){er=null!=e?e:null}function lr(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=tr[t])?n:t}function rr(e){const n=lr(e);if(!n)return"plaintext";switch(n){case"plain":return"plaintext";case"jsx":return"javascript";case"tsx":return"typescript";default:return n}}function ir(){return d(this,null,function*(){yield function(){return d(this,null,function*(){const e=Rl.get(Wl);(null==e?void 0:e.loadExtended)&&(yield Ul(e))})}()})}function ar(e){if(er){const n=er(e);if(null!=n&&""!==n)return n}return function(e){const n=Rl.get(Wl);if(!n)return;const t=n.core[e];if(t)return t;const o=Pl.get(n.id);if(o){const n=o[e];if(n)return n}n.loadExtended&&!Pl.has(n.id)&&Ul(n)}(lr(e))||(null!=(t=null==(n=Rl.get(Wl))?void 0:n.fallback)?t:"");var n,t}const sr={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"},ur=new class{constructor(){u(this,"metrics",[]),u(this,"enabled",!1),u(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,l=t.length,r=l/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,u=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 d="";return d=r>70&&i<2*a?"✅ Worker + Cache is highly beneficial":r>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:l,cacheHitRate:r.toFixed(1),workerCalls:e.length,directCalls:n.length,averageWorkerTime:i.toFixed(2),averageDirectTime:a.toFixed(2),averageCacheHitTime:s.toFixed(3),workerSavings:u.toFixed(2),recommendation:d}}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 dr(){ur.enable()}function cr(){ur.disable()}function hr(){return ur.printReport()}function mr(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch(n){}return globalThis.setTimeout(e,0)}function fr(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=hr,window.__katexPerfMonitor=ur);const pr={key:0,class:"code-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)] border-[var(--code-border)] bg-[var(--code-header-bg)] text-[var(--code-fg)]"},vr={class:"flex items-center gap-0.5"},gr=["aria-label"],yr={class:"code-diff-stat removed"},wr={class:"code-diff-stat added"},Nr=["aria-label"],xr={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},kr={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},Mr=["aria-pressed"],br={key:3,class:"relative"},Sr=["aria-expanded"],_r=["disabled"],Br=["disabled"],Or=["disabled"],Lr={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},Cr={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},Tr={class:"code-block-shell-content"},Er={class:"code-loading-placeholder"},Ir={class:"sr-only","aria-live":"polite",role:"status"},Ar=/* @__PURE__ */C({__name:"CodeBlockShell",props:{showHeader:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},showPreviewButton:{type:Boolean,default:!0},showTooltips:{type:Boolean,default:!0},isDark:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},stream:{type:Boolean,default:!1},isCollapsed:{type:Boolean,default:!1},isExpanded:{type:Boolean,default:!1},copyText:{type:Boolean,default:!1},isPreviewable:{type:Boolean,default:!1},codeFontSize:{},codeFontMin:{},codeFontMax:{},defaultCodeFontSize:{},fontBaselineReady:{type:Boolean,default:!1},diffStats:{},diffStatsAriaLabel:{}},emits:["toggleCollapse","decreaseFont","resetFont","increaseFont","copy","toggleExpand","preview"],setup(e,{emit:n}){const t=e,o=n,l=V(!1),r=V(null),i=V(null);function a(){l.value=!l.value,l.value&&document.addEventListener("click",s,{once:!0,capture:!0})}function s(e){var n,t;const o=e.target;(null==(n=r.value)?void 0:n.contains(o))||(null==(t=i.value)?void 0:t.contains(o))?document.addEventListener("click",s,{once:!0,capture:!0}):l.value=!1}const u=j(()=>t.showFontSizeButtons&&t.enableFontSizeControl||t.showExpandButton||t.isPreviewable&&t.showPreviewButton),{t:d}=Bn(),c=j(()=>!1!==t.showTooltips);function h(e,n){c.value&&xn(e.currentTarget,n,"top",!1,void 0,t.isDark)}function m(){c.value&&kn()}function f(e){h(e,t.copyText?d("common.copied")||"Copied":d("common.copy")||"Copy")}const p=j(()=>{var e,n;return!!Number.isFinite(t.codeFontSize)&&(null!=(e=t.codeFontSize)?e:0)<=(null!=(n=t.codeFontMin)?n:0)}),v=j(()=>!t.fontBaselineReady||t.codeFontSize===t.defaultCodeFontSize),g=j(()=>{var e,n;return!!Number.isFinite(t.codeFontSize)&&(null!=(e=t.codeFontSize)?e:0)>=(null!=(n=t.codeFontMax)?n:100)});return(n,s)=>(T(),E(H,null,[t.showHeader?(T(),E("div",pr,[ie(n.$slots,"header-left"),ie(n.$slots,"header-right",{},()=>[$("div",vr,[e.diffStats?(T(),E("div",{key:0,class:"code-diff-stats","aria-label":e.diffStatsAriaLabel},[$("span",yr,"-"+R(e.diffStats.removed),1),$("span",wr,"+"+R(e.diffStats.added),1)],8,gr)):q("",!0),t.showCopyButton?(T(),E("button",{key:1,type:"button",class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] disabled:opacity-40 disabled:cursor-not-allowed transition-colors","aria-label":e.copyText?A(d)("common.copied")||"Copied":A(d)("common.copy")||"Copy",onClick:s[0]||(s[0]=e=>o("copy")),onMouseenter:s[1]||(s[1]=e=>f(e)),onFocus:s[2]||(s[2]=e=>f(e)),onMouseleave:m,onBlur:m},[e.copyText?(T(),E("svg",kr,[...s[14]||(s[14]=[$("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(T(),E("svg",xr,[...s[13]||(s[13]=[$("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[$("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),$("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,Nr)):q("",!0),t.showCollapseButton?(T(),E("button",{key:2,type:"button",class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] disabled:opacity-40 disabled:cursor-not-allowed transition-colors","aria-pressed":e.isCollapsed,onClick:s[3]||(s[3]=e=>o("toggleCollapse")),onMouseenter:s[4]||(s[4]=n=>h(n,e.isCollapsed?A(d)("common.expand")||"Expand":A(d)("common.collapse")||"Collapse")),onFocus:s[5]||(s[5]=n=>h(n,e.isCollapsed?A(d)("common.expand")||"Expand":A(d)("common.collapse")||"Collapse")),onMouseleave:m,onBlur:m},[(T(),E("svg",{style:ne({rotate:e.isCollapsed?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[...s[15]||(s[15]=[$("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,Mr)):q("",!0),u.value?(T(),E("div",br,[$("button",{ref_key:"moreBtnRef",ref:i,type:"button",class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] transition-colors","aria-expanded":l.value,"aria-haspopup":"true",onClick:he(a,["stop"]),onMouseenter:s[6]||(s[6]=e=>h(e,A(d)("common.more")||"More")),onFocus:s[7]||(s[7]=e=>h(e,A(d)("common.more")||"More")),onMouseleave:m,onBlur:m},[...s[16]||(s[16]=[me('<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="1em" height="1em" viewBox="0 0 24 24" class="action-icon"><g fill="currentColor"><circle cx="12" cy="5" r="1.5"></circle><circle cx="12" cy="12" r="1.5"></circle><circle cx="12" cy="19" r="1.5"></circle></g></svg>',1)])],40,Sr),I(J,{name:"code-menu"},{default:Q(()=>[l.value?(T(),E("div",{key:0,ref_key:"moreMenuRef",ref:r,class:"code-more-menu min-w-[10rem] p-1 bg-[hsl(var(--ms-popover))] text-[hsl(var(--ms-popover-foreground))] border border-[var(--code-border)] shadow-[var(--ms-shadow-popover)]",role:"menu"},[t.showFontSizeButtons&&t.enableFontSizeControl?(T(),E(H,{key:0},[$("button",{type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",disabled:p.value,onClick:s[8]||(s[8]=e=>o("decreaseFont"))},[s[17]||(s[17]=$("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[$("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14"})],-1)),$("span",null,R(A(d)("common.fontSmaller")||"Font size −"),1)],8,_r),$("button",{type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",disabled:v.value,onClick:s[9]||(s[9]=e=>o("resetFont"))},[s[18]||(s[18]=$("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[$("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[$("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),$("path",{d:"M3 3v5h5"})])],-1)),$("span",null,R(A(d)("common.fontReset")||"Font size reset"),1)],8,Br),$("button",{type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",disabled:g.value,onClick:s[10]||(s[10]=e=>o("increaseFont"))},[s[19]||(s[19]=$("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[$("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1)),$("span",null,R(A(d)("common.fontLarger")||"Font size +"),1)],8,Or)],64)):q("",!0),t.showExpandButton?(T(),E("button",{key:1,type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] transition-colors",onClick:s[11]||(s[11]=e=>{o("toggleExpand",e),l.value=!1})},[e.isExpanded?(T(),E("svg",Lr,[...s[20]||(s[20]=[$("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)])])):(T(),E("svg",Cr,[...s[21]||(s[21]=[$("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)])])),$("span",null,R(e.isExpanded?A(d)("common.collapse")||"Collapse":A(d)("common.expand")||"Expand"),1)])):q("",!0),e.isPreviewable&&t.showPreviewButton?(T(),E("button",{key:2,type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] transition-colors",onClick:s[12]||(s[12]=e=>{o("preview"),l.value=!1})},[s[22]||(s[22]=$("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[$("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[$("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"}),$("circle",{cx:"12",cy:"12",r:"3"})])],-1)),$("span",null,R(A(d)("common.preview")||"Preview"),1)])):q("",!0)],512)):q("",!0)]),_:1})])):q("",!0)])])])):q("",!0),ee($("div",Tr,[ie(n.$slots,"default")],512),[[oe,!(e.isCollapsed||!e.stream&&e.loading)]]),ee($("div",Er,[ie(n.$slots,"loading",{},()=>[s[23]||(s[23]=$("div",{class:"loading-skeleton"},[$("div",{class:"skeleton-line"}),$("div",{class:"skeleton-line"}),$("div",{class:"skeleton-line short"})],-1))])],512),[[oe,!e.stream&&e.loading]]),$("span",Ir,R(e.copyText?A(d)("common.copied")||"Copied":""),1)],64))}}),$r={class:"code-header-main"},Hr=["innerHTML"],zr={class:"code-header-copy"},Rr={class:"code-header-title"},Wr=["innerHTML"],Pr=/* @__PURE__ */Se(/* @__PURE__ */C({__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},estimatedHeightPx:{},estimatedContentHeightPx:{}},emits:["previewCode","copy"],setup(e,{emit:n}){const t=e,o=n,{t:l}=Bn(),r=V(lr(t.node.language)),i=V(!1),s=V(!1),u=V(!1),c=V(null),h=V(null),m=V(null),f=V(""),p=V(!1);let v;const g=It(),y=V(null),w=V("undefined"==typeof window);"undefined"!=typeof window&&U(()=>c.value,e=>{var n;if(null==(n=y.value)||n.destroy(),y.value=null,!e)return void(w.value=!1);const t=g(e,{rootMargin:"400px"});y.value=t,w.value=t.isVisible.value,t.whenVisible.then(()=>{w.value=!0})},{immediate:!0});const N=V(!0),x=V(0),k=V(14),M=V(k.value),b=j(()=>{const e=k.value,n=M.value;return"number"==typeof e&&Number.isFinite(e)&&e>0&&"number"==typeof n&&Number.isFinite(n)&&n>0}),S=j(()=>{const e=r.value.trim().toLowerCase();return sr[e]||e.charAt(0).toUpperCase()+e.slice(1)}),_=j(()=>(nr.value,ar(r.value.trim().toLowerCase().split(":")[0]))),B=j(()=>{const e=r.value.trim().toLowerCase();return t.isShowPreview&&("html"===e||"svg"===e)}),O=j(()=>{const e={},n=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},o=n(t.minWidth),l=n(t.maxWidth);return o&&(e.minWidth=o),l&&(e.maxWidth=l),e}),L=j(()=>{const e=t.estimatedContentHeightPx;return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.round(e):null}),C=j(()=>null!=L.value&&!p.value),A=j(()=>a({fontSize:`${M.value}px`},C.value?{minHeight:`${L.value}px`}:{})),H=j(()=>!1!==t.showTooltips);function z(){return t.isDark?t.darkTheme:t.lightTheme}function W(e){if(null==v||v.disconnect(),v=void 0,!e)return f.value="",void(p.value=!1);var n;f.value=`<pre class="shiki shiki-fallback"><code>${n=e,n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}</code></pre>`,p.value=!1}function P(){f.value="",p.value=!0}function K(){var e;const n=m.value;return!!n&&(n.childNodes.length>0||Boolean(null==(e=n.textContent)?void 0:e.trim().length))}function D(){return d(this,null,function*(){if(yield X(),K())return void P();const e=m.value;e&&(null==v||v.disconnect(),v=new MutationObserver(()=>{K()&&(P(),null==v||v.disconnect(),v=void 0)}),v.observe(e,{childList:!0,subtree:!0}))})}let Z,Y,J,ee,te=null;const oe=/* @__PURE__ */new Set,le=/* @__PURE__ */new Set,re=void 0!==import.meta&&Boolean(!1);let ae=null;function se(e,n){return d(this,null,function*(){if(!Z)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?!ee||ee.has(l)?l:(n&&re&&!oe.has(l)&&(oe.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 Z.updateCode(e,t)}catch(o){"plaintext"!==t?(re&&!le.has(t)&&(le.add(t),console.warn(`[MarkdownCodeBlockNode] Failed to render language "${t}", retrying as plaintext.`,o)),yield Z.updateCode(e,"plaintext")):re&&console.warn("[MarkdownCodeBlockNode] Failed to render code block even as plaintext.",o)}})}function ue(e){if(!J)return;const n=Array.isArray(e)?e.join("\0"):"";te!==n&&(J({themes:e}),te=n)}function de(){return d(this,null,function*(){w.value?(yield function(){return d(this,null,function*(){if(!Y)return ae||(ae=d(null,null,function*(){try{const e=yield import("stream-markdown");Y=e.createShikiStreamRenderer,J=e.registerHighlight;const n=Array.isArray(e.defaultLanguages)?e.defaultLanguages:void 0;ee=n?new Set(n.map(e=>e.toLowerCase())):void 0,ue(t.themes)}catch(e){console.warn("[MarkdownCodeBlockNode] stream-markdown not available:",e)}finally{ae=null}}),ae)})}(),h.value&&m.value?(ue(t.themes),!Z&&Y&&(Z=Y(m.value,{theme:z()}),p.value=!0),Z?!1===t.stream&&t.loading?W(t.node.code):(W(t.node.code),yield se(t.node.code,r.value),yield D()):W(t.node.code)):W(t.node.code)):W(t.node.code)})}function ce(){const e=h.value;if(!e||s.value)return;const n=e.scrollTop;n<x.value?N.value=!1:function(e,n=50){return e.scrollHeight-e.scrollTop-e.clientHeight<=n}(e)&&(N.value=!0),x.value=n}function he(){return d(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 me(e){if(s.value=!s.value,e&&H.value){const n=function(e){const n=e.currentTarget||e.target;return!n||n.disabled?null:n}(e);n&&xn(n,s.value?l("common.collapse")||"Collapse":l("common.expand")||"Expand","top",!1,void 0,t.isDark)}const n=h.value;n&&(s.value?(n.style.maxHeight="none",n.style["overflow-y"]="visible",n.style["overflow-x"]="auto"):(n.style.maxHeight="",n.style.overflow="auto",N.value=!0,X(()=>{n.scrollHeight>n.clientHeight&&(n.scrollTop=n.scrollHeight)})))}function ve(){u.value=!u.value}function ge(){const e=Math.min(36,M.value+1);M.value=e}function ye(){const e=Math.max(10,M.value-1);M.value=e}function we(){M.value=k.value}function Ne(){if(!B.value)return;const e=(r.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 fe(()=>{w.value?de():W(t.node.code)}),G(()=>{var e;null==(e=y.value)||e.destroy(),y.value=null,null==v||v.disconnect(),v=void 0}),U(()=>t.themes,()=>d(null,null,function*(){ue(t.themes)})),U(()=>t.loading,e=>{e||(w.value?de():W(t.node.code))}),U(()=>w.value,e=>{e&&de()}),U(H,e=>{e||kn()}),U(()=>[t.node.code,t.node.language],e=>d(null,[e],function*([e,n]){const o=lr(n);o!==r.value&&(r.value=o),w.value&&h.value&&m.value?(Z||(W(e),yield de()),Z&&e&&(!1===t.stream&&t.loading||(W(e),yield se(e,n),yield D()))):W(e)})),U(()=>[t.darkTheme,t.lightTheme,t.isDark],()=>d(null,null,function*(){w.value&&h.value&&m.value&&(Z||(yield de()),null==Z||Z.setTheme(z()))})),U(()=>t.node.code,()=>d(null,null,function*(){if(s.value||!N.value)return;yield X();const e=h.value;e&&e.scrollHeight>e.clientHeight&&(e.scrollTop=e.scrollHeight)})),(n,o)=>(T(),E("div",{ref_key:"container",ref:c,style:ne(O.value),class:F(["code-block-container rounded-lg border overflow-hidden",{dark:t.isDark}])},[I(Ar,{"show-header":t.showHeader,"show-collapse-button":t.showCollapseButton,"show-font-size-buttons":t.showFontSizeButtons,"enable-font-size-control":t.enableFontSizeControl,"show-copy-button":t.showCopyButton,"show-expand-button":t.showExpandButton,"show-preview-button":t.showPreviewButton,"show-tooltips":t.showTooltips,"is-dark":t.isDark,loading:t.loading,stream:t.stream,"is-collapsed":u.value,"is-expanded":s.value,"copy-text":i.value,"is-previewable":B.value,"code-font-size":M.value,"code-font-min":10,"code-font-max":36,"default-code-font-size":k.value,"font-baseline-ready":b.value,onToggleCollapse:ve,onDecreaseFont:ye,onResetFont:we,onIncreaseFont:ge,onCopy:he,onToggleExpand:me,onPreview:Ne},pe({"header-left":Q(()=>[ie(n.$slots,"header-left",{},()=>[$("div",$r,[$("span",{class:"icon-slot h-4 w-4 flex-shrink-0",innerHTML:_.value},null,8,Hr),$("div",zr,[$("div",Rr,R(S.value),1)])])],!0)]),loading:Q(()=>[ie(n.$slots,"loading",{loading:e.loading,stream:e.stream},()=>[o[0]||(o[0]=$("div",{class:"loading-skeleton"},[$("div",{class:"skeleton-line"}),$("div",{class:"skeleton-line"}),$("div",{class:"skeleton-line short"})],-1))],!0)]),default:Q(()=>[$("div",{ref_key:"codeBlockContent",ref:h,class:"code-block-content",style:ne(A.value),onScroll:ce},[$("div",{ref_key:"rendererTarget",ref:m,class:"code-block-render"},null,512),p.value?q("",!0):(T(),E("div",{key:0,class:"code-fallback-plain",innerHTML:f.value},null,8,Wr))],36)]),_:2},[n.$slots["header-right"]?{name:"header-right",fn:Q(()=>[ie(n.$slots,"header-right",{},void 0,!0)]),key:"0"}:void 0]),1032,["show-header","show-collapse-button","show-font-size-buttons","enable-font-size-control","show-copy-button","show-expand-button","show-preview-button","show-tooltips","is-dark","loading","stream","is-collapsed","is-expanded","copy-text","is-previewable","code-font-size","default-code-font-size","font-baseline-ready"])],6))}}),[["__scopeId","data-v-b0adc686"]]);Pr.install=e=>{e.component(Pr.__name,Pr)};const jr=["data-custom-id"],Fr={class:"m-0 p-0"},Kr=["data-probe"],Dr=["data-node-index","data-node-type"],Vr=/* @__PURE__ */Se(/* @__PURE__ */C({__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;const l=e,r=n,i=V(),u=V(null),c=V(null),h=V(null),m=ve({1:null,2:null,3:null,4:null,5:null,6:null}),f=V(!1),p=/auto|scroll|overlay/i,v="undefined"!=typeof window,g=j(()=>l.debugPerformance&&v&&"undefined"!=typeof console),y=K(),w=/* @__PURE__ */new Map,N=V(0),x=V(0),L=V({paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}}),C=j(()=>{var e;if("boolean"==typeof l.showTooltips)return l.showTooltips;const n=null!=(e=y.showTooltips)?e:y["show-tooltips"];return""===n||!0===n||"true"===n||!1!==n&&"false"!==n&&void 0});function R(e,n){g.value&&console.info(`[markstream-vue][perf] ${e}`,n)}function W(e){if(!e)return!1;const n=(e.overflowY||"").toLowerCase(),t=(e.overflow||"").toLowerCase();return p.test(n)||p.test(t)}function P(e){const n=Math.ceil(e.scrollHeight)>Math.ceil(e.clientHeight)+1,t=Math.ceil(e.scrollWidth)>Math.ceil(e.clientWidth)+1;return n||t}function D(e){if("undefined"==typeof window)return null;const n=null!=e?e:i.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;){if(W(window.getComputedStyle(l))&&P(l))return l;l=l.parentElement}return null}ce("markstreamShowTooltips",C),ce("markstreamTypewriter",j(()=>!1!==l.typewriter)),ce("markstreamTextStreamState",w),ce("markstreamStreamVersion",N),U([()=>l.content,()=>l.nodes],()=>{N.value+=1},{immediate:!0});const Y=l.customId?`renderer-${l.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,ee=b(Y),te=/* @__PURE__ */new Map,oe=j(()=>(Pe.value,Fe(l.customId))),le=j(()=>{var e;return S(l.customHtmlTags,null==(e=l.parseOptions)?void 0:e.customHtmlTags)}),re=j(()=>{const{key:e,tags:n}=_(le.value);if(!e)return ee;const t=te.get(e);if(t)return t;const o=b(Y,{customHtmlTags:n});return te.set(e,o),o}),ie=j(()=>{const e=re.value;return l.customMarkdownIt?l.customMarkdownIt(e):e}),ae=j(()=>{var e,n;const t=null!=(e=l.parseOptions)?e:{},o=null!=(n=l.final)?n:t.final,r=le.value,i=null!=o,s=r.length>0;return i||s?a(a(a({},t),i?{final:o}:{}),s?{customHtmlTags:r}:{}):t}),he=j(()=>{var e;const n=null!=(e=ae.value.customHtmlTags)?e:[];return new Set(n.map(e=>String(e).trim().toLowerCase()).filter(Boolean))}),me=j(()=>{var e;if(null==(e=l.nodes)?void 0:e.length)return ge(l.nodes.slice());if(l.content){const e=g.value?performance.now():0,n=B(l.content,ie.value,ae.value);return g.value&&R("parse(sync)",{ms:Math.round(performance.now()-e),nodes:n.length,contentLength:l.content.length}),ge(n)}return[]}),fe=V(null),pe=V(null),ye=V(null),we=V(null),Ne=null!=l.indexKey&&String(l.indexKey).startsWith("list-item-"),xe=!Ne&&l.customId?Ml(l.customId):null,ke=j(()=>xe?(kl.value,Ml(l.customId)):null),Me=j(()=>{var e;return Boolean(v&&l.customId&&!Ne&&(null==(e=ke.value)?void 0:e.enabled))}),be=j(()=>{var e;return Me.value&&!1!==(null==(e=ke.value)?void 0:e.textEstimation)}),Se=j(()=>{var e;return Me.value&&!1!==(null==(e=ke.value)?void 0:e.codeBlockEstimation)}),Be=j(()=>{var e;return Math.max(320,x.value||(null==(e=i.value)?void 0:e.clientWidth)||640)}),Oe=j(()=>{var e;return Math.max(1,null!=(e=l.maxLiveNodes)?e:320)}),Le=j(()=>{var e;return!((null!=(e=l.maxLiveNodes)?e:0)<=0)&&me.value.length>Oe.value}),Te=j(()=>Le.value||Me.value),Ee=j(()=>!1!==l.viewportPriority&&!f.value),Ie=Et(e=>{var n;return D(null!=(n=null!=e?e:i.value)?n:null)},Ee),$e=v&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame.bind(window):null,ze=v&&"function"==typeof window.cancelAnimationFrame?window.cancelAnimationFrame.bind(window):null,Re="undefined"!=typeof globalThis&&"process"in globalThis?null==(t=globalThis.process)?void 0:t.env:void 0,We="test"===(null==Re?void 0:Re.NODE_ENV),je=v&&"function"==typeof window.requestIdleCallback,Ke=j(()=>{var e;const n=Math.trunc(null!=(e=l.renderBatchSize)?e:80);return Number.isFinite(n)?Math.max(0,n):0}),De=j(()=>{var e;const n=Math.trunc(null!=(e=l.initialRenderBatchSize)?e:Ke.value);return Number.isFinite(n)?Math.max(0,n):Ke.value}),Ve=j(()=>!1!==l.batchRendering&&Ke.value>0&&v&&!We),Ue=V(0),Xe=V({key:l.indexKey,total:0}),Ge=V(Math.max(1,Ke.value||1)),Ze=V(/* @__PURE__ */new Set),Ye=/* @__PURE__ */new Map,Je=/* @__PURE__ */new Map,Qe=/* @__PURE__ */new Map,en=/* @__PURE__ */new Map,tn=/* @__PURE__ */new Map,on=/* @__PURE__ */new WeakMap,rn=V(0),an=j(()=>(rn.value,Array.from(en.entries()).sort((e,n)=>e[0]-n[0]))),sn=V(0),un=V([]),dn=V([]),cn=V(null),hn=V(null);let mn=null,fn=[],pn=null,vn=null;const gn=j(()=>{var e;return!1!==l.deferNodesUntilVisible&&!((null!=(e=l.maxLiveNodes)?e:0)<=0)&&!Le.value&&!(me.value.length>900)&&Ee.value}),yn=j(()=>{var e;return Ve.value&&(null!=(e=l.maxLiveNodes)?e:0)<=0}),wn=V({batchSize:Ke.value,initial:De.value,delay:null!=(o=l.renderBatchDelay)?o:16,enabled:yn.value}),Nn=j(()=>!!Ie&&(gn.value||Le.value)),xn=j(()=>{var e;return Math.max(0,null!=(e=l.liveNodeBuffer)?e:60)}),kn=V(0),Mn=ve({start:0,end:0}),bn=/* @__PURE__ */new Map,Sn=/* @__PURE__ */new Map,_n=j(()=>{if(!Le.value)return me.value.length;const e=xn.value,n=Math.max(Mn.end+e,De.value),t=Math.min(me.value.length,n);return Math.max(Ue.value,t)});function Bn(e){var n,t;return null!=(t=null==(n=we.value)?void 0:n[e])?t:null}function On(e){var n,t,o,l;const r=D(null!=(n=null!=e?e:i.value)?n:null);if(r)return r;const a=null!=(l=null!=(o=null==e?void 0:e.ownerDocument)?o:null==(t=i.value)?void 0:t.ownerDocument)?l:"undefined"!=typeof document?document:null;return(null==a?void 0:a.scrollingElement)||(null==a?void 0:a.documentElement)||null}function Ln(e){if(!v)return!1;try{const n=window.getComputedStyle(e);return!!(n.display||"").toLowerCase().includes("flex")&&(n.flexDirection||"").toLowerCase().endsWith("reverse")}catch(n){return!1}}function Cn(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 u=e.scrollTop;if(!Ln(e))return u;const d=u<0?-u:u;return Math.max(0,(null!=(a=e.scrollHeight)?a:0)-(null!=(s=e.clientHeight)?s:0))-d}function Tn(e,n){let t=e,o=0,l=0;for(;t&&t!==n&&l++<64;)o+=t.offsetTop||0,t=t.offsetParent;return o}function En(){pn&&(pn(),pn=null),cn.value=null}function An(){if(!v||!Le.value)return;const e=On();if(!e||cn.value===e)return;En();const n=()=>Hn();e.addEventListener("scroll",n,{passive:!0}),cn.value=e,pn=()=>{e.removeEventListener("scroll",n)}}function $n(){var e,n,t;if(!vn)return;const o=null!=(t=null==(n=null==(e=i.value)?void 0:e.ownerDocument)?void 0:n.defaultView)?t:"undefined"!=typeof window?window:null;vn.viaTimeout?o?o.clearTimeout(vn.id):clearTimeout(vn.id):null==ze||ze(vn.id),vn=null}function Hn(e={}){var n,t,o;if(!Le.value)return;if(!v)return void zn(!0);if(e.immediate)return $n(),void zn(!0);if(vn)return;const l=()=>{vn=null,zn()};if($e)vn={id:$e(l),viaTimeout:!1};else{const e=null!=(o=null==(t=null==(n=i.value)?void 0:n.ownerDocument)?void 0:t.defaultView)?o:"undefined"!=typeof window?window:null,r=e?e.setTimeout(l,16):setTimeout(l,16);vn={id:r,viaTimeout:!0}}}function zn(e=!1){var n,t,o,l,r,a,s;if(!Le.value)return;const u=cn.value||On();if(!u)return;const d=u.ownerDocument||(null==(n=i.value)?void 0:n.ownerDocument)||document,c=(null==d?void 0:d.defaultView)||("undefined"!=typeof window?window:null),h=u===(null==d?void 0:d.documentElement)||u===(null==d?void 0:d.body),m=me.value.length;if(!h&&m>0&&Ln(u)){const n=u.clientHeight||0,t=u.scrollTop,o=t<0?-t:t,l=function(e){var n;const t=me.value;if(!t.length)return 0;if(e<=0)return Math.max(0,t.length-1);if(Me.value){let n=e;for(let e=t.length-1;e>=0;e--){const t=dt(e);if(n<=t)return e;n-=t}return 0}if(sn.value===t.length){const n=St(0,t.length);return $t(Math.max(0,n-e))}let o=e;for(let l=t.length-1;l>=0;l--){const e=null!=(n=Wn[l])?n:Un.value;if(o<=e)return l;o-=e}return 0}(Math.max(0,o)+.5*Math.max(0,n)),r=Rn(l,0,Math.max(0,m-1));return void((e||Math.abs(r-kn.value)>1)&&(kn.value=r))}const f=h?null:u.getBoundingClientRect(),p=h?0:f.top,v=h?null!=(o=null!=(t=null==c?void 0:c.innerHeight)?t:u.clientHeight)?o:0:f.bottom,g=an.value;let y=null,w=null;for(const[i,x]of g){if(!x)continue;const e=x.getBoundingClientRect();e.bottom<=p||e.top>=v||(null==y&&(y=i),w=i)}if(null==y||null==w){const e=i.value;if(!e)return;const n=h?{top:0}:u.getBoundingClientRect(),t=Cn(u,d,h),o=h?(()=>{const t=e.getBoundingClientRect(),o=(h?0:n.top)-t.top;return Math.max(0,o)})():(()=>{const n=Tn(e,u);return Math.max(0,t-n)})(),m=h?null!=(s=null!=(a=null!=(r=null==c?void 0:c.innerHeight)?r:null==(l=null==d?void 0:d.documentElement)?void 0:l.clientHeight)?a:u.clientHeight)?s:0:u.clientHeight,f=$t(o+.5*Math.max(0,m));return void(kn.value=Rn(f,0,Math.max(0,me.value.length-1)))}const N=Math.round((y+w)/2);!e&&Math.abs(N-kn.value)<=1||(kn.value=Rn(N,0,Math.max(0,me.value.length-1)))}function Rn(e,n,t){return Math.min(Math.max(e,n),t)}const Wn=ve({}),Pn=ve({total:0,count:0});function jn(){for(const e of Object.keys(Wn))delete Wn[Number(e)];Pn.total=0,Pn.count=0,sn.value=0,un.value=[],dn.value=[]}function Fn(e,n,t){for(let o=n+1;o<e.length;o+=o&-o)e[o]+=t}function Kn(e,n){let t=0;for(let o=n+1;o>0;o-=o&-o)t+=e[o];return t}function Dn(e,n,t){if(t<=n)return 0;const o=Kn(e,t-1);return n<=0?o:o-Kn(e,n-1)}function Vn(e){sn.value=e;const n=new Array(e+1).fill(0),t=new Array(e+1).fill(0);for(const[o,l]of Object.entries(Wn)){const r=Number(o),i=Number(l);!Number.isFinite(r)||r<0||r>=e||!Number.isFinite(i)||i<=0||(Fn(n,r,i),Fn(t,r,1))}un.value=n,dn.value=t}const Un=j(()=>Pn.count>0?Math.max(12,Pn.total/Pn.count):32);function qn(e){return null==e?void 0:e.firstElementChild}function Xn(e,n){var t;return e?(null==(t=e.matches)?void 0:t.call(e,n))?e:e.querySelector(n):null}function Qn(){var e,n;if(!Me.value)return void(x.value=0);const t=null!=(n=null==(e=i.value)?void 0:e.clientWidth)?n:0;x.value=t>0?t:0}let et=null;function tt(){null==et||et.disconnect(),et=null}const ot=se(()=>d(null,null,function*(){try{return(yield import("./CodeBlockNode.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),Ft}})),rt=j(()=>l.renderCodeBlocksAsPre?Ft:ot);function at(){var e;return!1!==(null==(e=l.codeBlockProps)?void 0:e.showHeader)}const ut=j(()=>{var e;const n=me.value;if(!n.length||!Me.value)return n.map(()=>null);const t=x.value||(null==(e=i.value)?void 0:e.clientWidth)||0;return!Number.isFinite(t)||t<=0?n.map(()=>null):n.map((e,n)=>{const o=Wn[n],r="number"==typeof o&&o>0;if(be.value&&!r){const n=Ol(e,t,L.value);if(n)return n}if(Se.value&&"code_block"===e.type){const n=function(e){if("code_block"!==e.type)return null;const n=No(e,wo(e));return n===Pr?"markdown":n===Ft?"pre":n===rt.value||n===ot?"monaco":null}(e);if("monaco"===n||"markdown"===n)return function(e,n){var t;if(!e||"code_block"!==e.type)return null;const o=n.rendererKind,l=!1!==n.showHeader,r=function(e){var n,t,o,l;return e.diff?Math.max(Ll(String(null!=(n=e.originalCode)?n:"")),Ll(String(null!=(t=e.updatedCode)?t:"")),Ll(String(null!=(o=e.code)?o:""))):Ll(String(null!=(l=e.code)?l:""))}(e),i=Boolean(e.diff);let a=0,s=500;if("monaco"===o){const e=null!=(t=n.monacoOptions)?t:{},o=function(e,n){const t="number"==typeof(null==e?void 0:e.fontSize)&&e.fontSize>0?e.fontSize:n?13:12;return"number"==typeof(null==e?void 0:e.lineHeight)&&e.lineHeight>0?e.lineHeight:n?30:Math.round(1.5*t)}(e,i),l=function(e,n){var t,o;if(!n)return 0;const l="number"==typeof(null==(t=null==e?void 0:e.padding)?void 0:t.top)?e.padding.top:10,r="number"==typeof(null==(o=null==e?void 0:e.padding)?void 0:o.bottom)?e.padding.bottom:22;return Math.max(0,l)+Math.max(0,r)}(e,i);s="number"==typeof e.MAX_HEIGHT&&e.MAX_HEIGHT>0?e.MAX_HEIGHT:500,a=i?Math.round(r*o+l):Math.round(r*(o+1.5))}else"markdown"===o?a=Math.round(21*r+32):(a=Math.round(21*r+32),s=Number.POSITIVE_INFINITY);const u=Math.max(1,Math.min(a,s));return{kind:"code-block",height:Math.round(u+(l?40:0)),contentHeight:u,rendererKind:o}}(e,{rendererKind:n,monacoOptions:l.codeBlockMonacoOptions,showHeader:at()})}return null})});function dt(e){var n,t,o;return null!=(o=null!=(t=Wn[e])?t:null==(n=ut.value[e])?void 0:n.height)?o:Un.value}function ct(){const e=cn.value||On(),n=i.value;if(!e||!n)return null;const t=e.ownerDocument||n.ownerDocument||document;if(e===t.documentElement||e===t.body||e===t.scrollingElement){const e=n.getBoundingClientRect();return Math.max(0,-e.top)}return Math.max(0,Cn(e,t,!1)-Tn(n,e))}function ht(e){return St(0,Rn(e.nodeIndex,0,Math.max(0,me.value.length-1)))+Math.max(0,e.offsetWithinNodePx)}function ft(){if(null!=mn&&(null==ze||ze(mn),mn=null),v)for(const e of fn)window.clearTimeout(e);fn=[]}function vt(e){!function(e){var n;const t=cn.value||On(),o=i.value;if(!t||!o)return;const l=Math.max(0,e),r=t.ownerDocument||o.ownerDocument||document,a=r.defaultView||("undefined"!=typeof window?window:null);if(t===r.documentElement||t===r.body||t===r.scrollingElement){const e=Cn(t,r,!0)+o.getBoundingClientRect().top;return void(null==(n=null==a?void 0:a.scrollTo)||n.call(a,0,Math.max(0,e+l)))}t.scrollTop=Tn(o,t)+l}(ht(e))}function yt(){hn.value&&v&&null==mn&&(mn=$e?$e(()=>{mn=null,hn.value&&vt(hn.value)}):null,null==mn&&hn.value&&vt(hn.value))}function Nt(){const e=ct(),n=me.value.length;if(null==e||n<=0)return null;const t=Rn($t(e+1),0,n-1),o=St(0,t),l=dt(t);return{nodeIndex:t,offsetWithinNodePx:Rn(e-o,0,Math.max(0,l-1))}}function kt(e){if(hn.value={nodeIndex:Rn(e.nodeIndex,0,Math.max(0,me.value.length-1)),offsetWithinNodePx:Math.max(0,e.offsetWithinNodePx)},ft(),vt(hn.value),v)for(const n of[0,120,280,480])fn.push(window.setTimeout(()=>{hn.value&&vt(hn.value)},n))}function Mt(e){const n=ct();return null==n?null:n-ht(e)}function St(e,n){var t,o;if(e>=n)return 0;if(Me.value){let t=0;for(let o=e;o<n;o++)t+=dt(o);return t}if(sn.value!==me.value.length){let o=0;for(let l=e;l<n;l++)o+=null!=(t=Wn[l])?t:Un.value;return o}const l=un.value,r=dn.value;if(!l.length||!r.length){let t=0;for(let l=e;l<n;l++)t+=null!=(o=Wn[l])?o:Un.value;return t}return Dn(l,e,n)+(n-e-Dn(r,e,n))*Un.value}U(()=>me.value.length,e=>{e<=0?jn():(e<sn.value&&function(e){if(e<=0)return void jn();let n=0,t=0;for(const[o,l]of Object.entries(Wn)){const r=Number(o),i=Number(l);!Number.isFinite(r)||r<0||r>=e||!Number.isFinite(i)||i<=0?delete Wn[r]:(n+=i,t++)}Pn.total=n,Pn.count=t}(e),e!==sn.value&&Vn(e))},{immediate:!0});const Bt=j(()=>{if(!Le.value)return me.value.map((e,n)=>({node:e,index:n}));const e=me.value.length,n=Rn(Mn.start,0,e),t=Rn(Mn.end,n,e);return me.value.slice(n,t).map((e,t)=>({node:e,index:n+t}))}),Tt=j(()=>Le.value?St(0,Math.min(Mn.start,me.value.length)):0),It=j(()=>{if(!Le.value)return 0;const e=me.value.length;return St(Math.min(Mn.end,e),e)});function At(){var e;const n=me.value;return{totalNodes:n.length,measuredCount:Pn.count,estimatedCount:ut.value.filter(Boolean).length,averageNodeHeight:Un.value,topSpacerHeight:Tt.value,bottomSpacerHeight:It.value,estimatedTotalHeight:St(0,n.length),width:x.value||(null==(e=i.value)?void 0:e.clientWidth)||0,probe:{paragraphReady:Boolean(L.value.paragraph),listItemReady:Boolean(L.value.listItem),listWrapperOverhead:L.value.listWrapperOverhead,headingReadyLevels:Object.entries(L.value.headings).filter(([,e])=>Boolean(e)).map(([e])=>Number(e))},nodes:n.map((e,n)=>{var t,o,l,r,i,a,s,u,d;return{index:n,type:e.type,estimateKind:null!=(o=null==(t=ut.value[n])?void 0:t.kind)?o:null,rendererKind:null!=(r=null==(l=ut.value[n])?void 0:l.rendererKind)?r:null,estimatedHeight:null!=(a=null==(i=ut.value[n])?void 0:i.height)?a:null,estimatedContentHeight:null!=(u=null==(s=ut.value[n])?void 0:s.contentHeight)?u:null,measuredHeight:null!=(d=Wn[n])?d:null}})}}function $t(e){var n;if(e<=0)return 0;const t=me.value;if(Me.value){let n=e;for(let e=0;e<t.length;e++){const t=dt(e);if(n<=t)return e;n-=t}return Math.max(0,t.length-1)}if(sn.value===t.length&&un.value.length&&dn.value.length){const n=Un.value,o=un.value,l=dn.value,r=e=>e<=0?0:Kn(o,e-1)+(e-Kn(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=Wn[l])?n:Un.value;if(o<=e)return l;o-=e}return Math.max(0,t.length-1)}function Ht(){rn.value+=1}function Rt(e,n){const t=Ze.value,o=t.has(e);if(n){if(o)return;const n=new Set(t);return n.add(e),void(Ze.value=n)}if(!o)return;const l=new Set(t);l.delete(e),Ze.value=l}function Pt(){0!==Ze.value.size&&(Ze.value=/* @__PURE__ */new Set)}function jt(e){if(!Ye.size)return;if(!Le.value)return;let n=!1;for(const[t,o]of Ye)t>=e&&(o.destroy(),Ye.delete(t),gn.value&&Rt(t,!1),to(t),en.delete(t)&&(n=!0));n&&Ht()}function Kt(e,n){gn.value&&Rt(e,n),n&&(Le.value?Hn():kn.value=Rn(e,0,Math.max(0,me.value.length-1)))}function Dt(e){const n=Je.get(e);n&&(n(),Je.delete(e));const t=Ye.get(e);t&&(t.destroy(),Ye.delete(e)),to(e)}function Vt(e,n){let t=!1;if(n){const o=en.get(e);en.set(e,n),o!==n&&(t=!0)}else en.delete(e)&&(t=!0);if(t&&Ht(),n||to(e),!Nn.value||!Ie)return Dt(e),void(n&&Kt(e,!0));if(!Le.value&&gn.value&&!f.value&&Ye.size>=640&&(function(){if(!f.value){f.value=!0;for(const e of Ye.values())e.destroy();if(Ye.clear(),v)for(const e of Qe.values())window.clearTimeout(e);Qe.clear(),Pt()}}(),!Nn.value||!Ie))return Dt(e),void(n&&Kt(e,!0));if(e<De.value&&!Le.value)return Dt(e),void Kt(e,!0);if(Ze.value.has(e))return Dt(e),void Kt(e,!0);if(!n)return void Dt(e);Dt(e);const o=Ie(n,{rootMargin:"400px"});if(!o)return;Ye.set(e,o),Kt(e,o.isVisible.value),gn.value&&function(e){if(!v||!gn.value)return;to(e);const n=e%17*23,t=window.setTimeout(()=>{var n,t;if(Qe.delete(e),!gn.value)return;if(Ze.value.has(e))return;const o=en.get(e);if(!o)return;const l=On(o),r=o.ownerDocument||document,i=r.defaultView||window,a=!l||l===r.documentElement||l===r.body,s=!a&&l?l.getBoundingClientRect():null,u=a?0:s.top,d=a?null!=(t=null!=(n=i.innerHeight)?n:null==l?void 0:l.clientHeight)?t:0:s.bottom,c=o.getBoundingClientRect();c.bottom>=u-500&&c.top<=d+500&&Kt(e,!0)},1800+n);Qe.set(e,t)}(e);let l=null;l=U(()=>o.isVisible.value,n=>{if(n){to(e),Kt(e,!0),null==l||l(),Je.delete(e),Ye.get(e)===o&&Ye.delete(e);try{o.destroy()}catch(t){}}},{immediate:!0}),Je.set(e,l),Le.value&&Hn()}U(()=>Te.value,e=>{if(!e){for(const e of tn.values())e.disconnect();tn.clear();for(const e of Sn.values())for(const n of e)window.clearTimeout(n);Sn.clear()}},{immediate:!0});let Ut=null,qt=null,Gt=!1,Yt=null,eo=null;function no(){v&&(null!=Ut&&(null==ze||ze(Ut),Ut=null),null!=qt&&(window.clearTimeout(qt),qt=null),null!=eo&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(eo),eo=null),Gt=!1,Yt=null)}function to(e){if(!v)return;const n=Qe.get(e);null!=n&&(window.clearTimeout(n),Qe.delete(e))}function oo(e,n={}){var t,o;if(!yn.value)return;const r=_n.value;if(Ue.value>=r)return;const i=Math.max(1,e),a=e=>{var n;Ut=null,qt=null,eo=null,Gt=!1;const t=null!=Yt?Yt:i;Yt=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)),jt(Ue.value);const t=("undefined"!=typeof performance?performance.now():Date.now())-n;return function(e){var n;if(!yn.value)return;const t=Math.max(2,null!=(n=l.renderBatchBudgetMs)?n:6),o=Math.max(1,Ke.value||1),r=Math.max(1,Math.floor(o/4));e>1.2*t?Ge.value=Math.max(r,Math.floor(.7*Ge.value)):e<.5*t&&Ge.value<o&&(Ge.value=Math.min(o,Math.ceil(1.2*Ge.value)))}(t),t};let s=t;for(;(a(s),!(Ue.value>=r)&&e)&&!(("function"==typeof e.timeRemaining?e.timeRemaining():0)<=.5*o);)s=Math.max(1,Math.round(Ge.value));Ue.value<r&&lo()};if(!v||n.immediate)return void a();const s=Math.max(0,null!=(t=l.renderBatchDelay)?t:16);if(Yt=null!=Yt?Math.max(Yt,i):i,!Gt){if(Gt=!0,!We&&je&&window.requestIdleCallback){const e=Math.max(0,null!=(o=l.renderBatchIdleTimeoutMs)?o:120);return void(eo=window.requestIdleCallback(e=>{a(e)},{timeout:e}))}$e&&!We?Ut=$e(()=>{0!==s?qt=window.setTimeout(()=>a(),s):a()}):qt=window.setTimeout(()=>a(),s)}}function lo(){yn.value&&oo(Ve.value?Math.max(1,Math.round(Ge.value)):Math.max(1,Ke.value))}U([()=>me.value,()=>me.value.length,()=>yn.value,()=>Ke.value,()=>De.value,()=>l.renderBatchDelay,()=>l.indexKey],()=>{var e;const n=me.value.length,t=Xe.value,o=l.indexKey,r=void 0!==o&&o!==t.key,i=n!==t.total,a=r||i;Xe.value={key:o,total:n};const s=wn.value,u=null!=(e=l.renderBatchDelay)?e:16,d=s.batchSize!==Ke.value||s.initial!==De.value||s.delay!==u||s.enabled!==yn.value;wn.value={batchSize:Ke.value,initial:De.value,delay:u,enabled:yn.value},r&&(jn(),n>0&&Vn(n)),(a||d||!yn.value)&&no(),(a||d)&&(Ge.value=Math.max(1,Ke.value||1)),a&&Le.value&&Hn({immediate:!0});const c=_n.value;if(!n)return Ue.value=0,void jt(0);if(!yn.value)return Ue.value=c,void jt(Ue.value);const h=r||0===t.total;Ue.value=h||d?Math.min(c,De.value):Math.min(Ue.value,c);const m=Math.max(1,De.value||Ke.value||n);Ue.value<c?oo(m,{immediate:!v}):jt(Ue.value)},{immediate:!0}),U(()=>Le.value,e=>{if(!e)return En(),void $n();An(),Hn({immediate:!0})},{immediate:!0}),U([()=>me.value.length,()=>Le.value],e=>d(null,[e],function*([e,n]){n&&e&&v&&(yield X(),Hn({immediate:!0}))}),{flush:"post"}),U(()=>i.value,()=>{Le.value&&(An(),Hn({immediate:!0}))}),U(Me,e=>{e&&function(){var e;if(fe.value&&pe.value&&ye.value&&(null==(e=we.value)?void 0:e[1]))return;const n=ge({type:"paragraph",children:[{type:"text",content:"Probe paragraph text",raw:"Probe paragraph text"}],raw:"Probe paragraph text"}),t=ge({type:"list_item",children:[n],raw:"- Probe paragraph text"}),o=ge({type:"list",ordered:!1,items:[t],raw:"- Probe paragraph text"});fe.value=n,pe.value=t,ye.value=o;const l={1:null,2:null,3:null,4:null,5:null,6:null};for(let r=1;r<=6;r++)l[r]=ge({type:"heading",level:r,text:"Probe heading",children:[{type:"text",content:"Probe heading",raw:"Probe heading"}],raw:`${"#".repeat(r)} Probe heading`});we.value=l}()},{immediate:!0}),U([()=>i.value,Me],()=>{if(!Me.value)return tt(),void(x.value=0);Qn(),tt(),Me.value&&i.value&&"undefined"!=typeof ResizeObserver&&(et=new ResizeObserver(()=>{Qn(),hn.value&&yt()}),et.observe(i.value))},{immediate:!0}),U([Me,Be],()=>d(null,null,function*(){Me.value?(yield X(),function(){var e,n,t,o;if(!Me.value||"undefined"==typeof window)return void(L.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}});const l={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},r=Xn(qn(u.value),".paragraph-node");l.paragraph=Tl(u.value,r,"pre-wrap");const i=qn(c.value),a=null==i?void 0:i.querySelector(".paragraph-node");l.listItem=Tl(c.value,a,"pre-wrap");const s=null!=(n=null==(e=h.value)?void 0:e.offsetHeight)?n:0,d=null!=(o=null==(t=c.value)?void 0:t.offsetHeight)?o:0;l.listWrapperOverhead=Math.max(0,s-d);for(let u=1;u<=6;u++){const e=Xn(qn(m[u]),`h${u}`);l.headings[u]=Tl(m[u],e,"pre-wrap")}L.value=l}()):L.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}}}),{flush:"post",immediate:!0}),U(()=>me.value.length,()=>{Le.value&&Hn({immediate:!0})}),U([Me,x],()=>{Le.value&&Hn({immediate:!0}),hn.value&&yt()},{immediate:!1}),U(()=>gn.value,e=>{if(e)for(const[n,t]of en)Vt(n,t);else{for(const e of Ye.values())e.destroy();Ye.clear();for(const e of Array.from(Qe.keys()))to(e);Pt();for(const[e,n]of en)n&&Kt(e,!0)}},{immediate:!1}),U([()=>l.viewportPriority,()=>me.value.length],([e,n])=>{!1!==e?f.value&&n<=200&&(f.value=!1):f.value=!1}),U(()=>Ue.value,()=>{Le.value&&Hn({immediate:!0})}),U([kn,Oe,xn,()=>me.value.length,Le],()=>{!function(){const e=me.value.length;if(!Le.value||0===e)return Mn.start=0,void(Mn.end=e);const n=Math.min(Oe.value,e),t=xn.value,o=Rn(kn.value-t,0,Math.max(0,e-n));Mn.start=o,Mn.end=Math.min(e,o+n)}()},{immediate:!0}),U([()=>me.value.length,Le,Oe,xn,()=>Mn.start,()=>Mn.end],([e,n,t,o,l,r])=>{g.value&&R("virtualization",{nodes:e,virtualization:n,maxLiveNodes:t,buffer:o,focusIndex:kn.value,scroll:n?(()=>{const e=cn.value||On();return e?{reverse:Ln(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})}),U(()=>_n.value,(e,n)=>{yn.value&&("number"==typeof n&&e<=n||e>Ue.value&&lo())}),U([()=>l.customId],([e],n,t)=>{if(!e||Ne)return;const o=function(e,n){return e?(Nl.controllers[e]=n,()=>{Nl.controllers[e]===n&&delete Nl.controllers[e]}):()=>{}}(e,{captureRestoreAnchor:Nt,restoreAnchor:kt,getAnchorDrift:Mt,getReport:At});t(()=>{o()})},{immediate:!0}),G(()=>{no();for(const e of Ye.values())e.destroy();Ye.clear();for(const e of tn.values())e.disconnect();tn.clear();for(const e of Sn.values())for(const n of e)window.clearTimeout(n);Sn.clear();for(const e of Je.values())e();Je.clear();for(const e of Array.from(Qe.keys()))to(e);tt(),ft(),En(),$n()});const ro=se(()=>d(null,null,function*(){try{return(yield import("./index4.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),Ft}})),io=se(()=>d(null,null,function*(){try{return(yield import("./index5.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),Ft}})),ao=se(()=>d(null,null,function*(){try{return(yield import("./index6.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),Ft}})),so={text:Gn,paragraph:Wt,heading:Ot,code_block:ot,list:Ct,list_item:Lt,blockquote:_e,table:Xt,definition_list:Ae,footnote:bt,footnote_reference:qe,footnote_anchor:xt,admonition:ei,vmr_container:Qt,hardbreak:_t,link:mt,image:In,thematic_break:Zt,math_inline:Zn,math_block:Yn,strong:it,emphasis:wt,strikethrough:st,highlight:gt,insert:pt,subscript:lt,superscript:nt,emoji:He,checkbox:Ce,checkbox_input:Ce,inline_code:ln,html_inline:nn,reference:Jn,html_block:zt},uo=j(()=>null!=l.indexKey?String(l.indexKey):"markdown-renderer"),co=j(()=>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 C.value?{showTooltips:C.value}:{}),l.codeBlockProps||{})),ho=j(()=>a({},l.mermaidProps||{})),mo=j(()=>a({},l.d2Props||{})),fo=j(()=>a({},l.infographicProps||{})),po=j(()=>({typewriter:l.typewriter,customHtmlTags:ae.value.customHtmlTags})),vo=j(()=>a(a({},po.value),"boolean"==typeof C.value?{showTooltip:C.value}:{})),go=j(()=>a(a({},po.value),"boolean"==typeof C.value?{showTooltips:C.value}:{})),yo=j(()=>Bt.value.map(e=>{var n,t,o,l;let r=function(e){var n,t,o,l,r,i,s;if("code_block"!==e.type)return e;const u=e,d=[String(null!=(n=u.language)?n:""),String(null!=(t=u.loading)?t:""),String(null!=(o=u.diff)?o:""),String(null!=(l=u.code)?l:""),String(null!=(r=u.originalCode)?r:""),String(null!=(i=u.updatedCode)?i:""),String(null!=(s=u.raw)?s:"")].join("\0"),c=on.get(u);if(c&&c.signature===d)return c.node;const h=a({},u);return on.set(u,{signature:d,node:h}),h}(e.node);const i=wo(r);let u=No(r,i);if(("html_block"===r.type||"html_inline"===r.type)&&u===so[r.type]){const e=r,i=String(null!=(n=e.tag)?n:"").trim().toLowerCase()||k(e.content);if(i){const n=oe.value[i];if(he.value.has(i)&&n)u=n,r=s(a({},e),{type:i,tag:i,content:O(e.content,i)});else if(M(null!=(t=e.content)?t:e.raw,i)){const n=String(null!=(l=null!=(o=e.content)?o:e.raw)?l:"");"html_inline"===r.type?(u=Gn,r={type:"text",content:n,raw:n}):(u=Wt,r={type:"paragraph",children:[{type:"text",content:n,raw:n}],raw:n})}}}let d=a({},function(e,n){const t=null!=n?n:wo(e);return"mermaid"===t?ho.value:"infographic"===t?fo.value:"d2"===t||"d2lang"===t?mo.value:"link"===e.type?vo.value:"list"===e.type?go.value:"code_block"===e.type?co.value:po.value}(r,i));const c=ut.value[e.index];return"code_block"===r.type&&"code-block"===(null==c?void 0:c.kind)&&(d=s(a({},d),{estimatedHeightPx:c.height,estimatedContentHeightPx:c.contentHeight})),s(a({},e),{node:r,component:u,bindings:d,isCodeBlock:"code_block"===r.type,indexKey:`${uo.value}-${e.index}`})}));function wo(e){var n;return"code_block"===(null==e?void 0:e.type)?String(null!=(n=e.language)?n:"").trim().toLowerCase():""}function No(e,n){if(!e)return Jt;const t=oe.value,o=t[String(e.type)];if("code_block"===e.type){const l=null!=n?n:wo(e);if("mermaid"===l)return t.mermaid||ro;if("infographic"===l)return t.infographic||io;if("d2"===l||"d2lang"===l)return t.d2||ao;if(o)return o;return t.code_block||rt.value}return o||so[String(e.type)]||Jt}function xo(e){r("click",e)}function ko(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&r("mouseover",e)}function Mo(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&r("mouseout",e)}return(e,n)=>(T(),E("div",{ref_key:"containerRef",ref:i,class:F(["markstream-vue markdown-renderer",[{dark:l.isDark},{virtualized:Le.value}]]),"data-custom-id":l.customId,onClick:xo,onMouseover:ko,onMouseout:Mo},[Me.value||Le.value?(T(),E(H,{key:0},[Me.value?(T(),E("div",{key:0,class:"height-estimation-probes",style:ne({width:`${Be.value}px`}),"aria-hidden":"true"},[$("div",{ref_key:"paragraphProbeWrapperRef",ref:u,class:"node-content","data-probe":"paragraph"},[I(A(Wt),{node:fe.value,"index-key":"probe-paragraph"},null,8,["node"])],512),$("div",{ref_key:"listItemProbeWrapperRef",ref:c,class:"node-content","data-probe":"list-item"},[$("ul",Fr,[I(A(Lt),{node:pe.value,"index-key":"probe-list-item"},null,8,["node"])])],512),$("div",{ref_key:"listProbeWrapperRef",ref:h,class:"node-content","data-probe":"list"},[I(A(Ct),{node:ye.value,"index-key":"probe-list"},null,8,["node"])],512),(T(),E(H,null,z(6,e=>$("div",{key:`probe-heading-${e}`,ref_for:!0,ref:n=>function(e,n){e<1||e>6||(m[e]=n)}(e,n),class:"node-content","data-probe":`heading-${e}`},[I(A(Ot),{node:Bn(e),"index-key":`probe-heading-${e}`},null,8,["node","index-key"])],8,Kr)),64))],4)):q("",!0),Le.value?(T(),E("div",{key:1,class:"node-spacer",style:ne({height:`${Tt.value}px`}),"aria-hidden":"true"},null,4)):q("",!0)],64)):q("",!0),(T(!0),E(H,null,z(yo.value,e=>{return T(),E("div",{key:e.index,ref_for:!0,ref:n=>Vt(e.index,n),class:"node-slot","data-node-index":e.index,"data-node-type":e.node.type},[(t=e.index,yn.value&&t>=Ue.value||!(!gn.value||t<De.value||Ze.value.has(t))?(T(),E("div",{key:1,class:"node-placeholder",style:ne({height:`${dt(e.index)}px`})},null,4)):(T(),E("div",{key:0,ref_for:!0,ref:n=>function(e,n){var t;const o=Sn.get(e);if(o){for(const e of o)window.clearTimeout(e);Sn.delete(e)}const l=tn.get(e);if(l&&(l.disconnect(),tn.delete(e)),!n||!Te.value)return void bn.delete(e);bn.set(e,n);const r=()=>{!function(e,n){if(!Number.isFinite(n)||n<=0)return;const t=Wn[e];if(Wn[e]=n,t?Pn.total+=n-t:(Pn.total+=n,Pn.count++),sn.value>e){const o=un.value,l=dn.value;if(o.length&&l.length)if(t){const l=n-t;0!==l&&Fn(o,e,l)}else Fn(o,e,n),Fn(l,e,1)}hn.value&&yt()}(e,n.offsetHeight)};if(queueMicrotask(r),"undefined"!=typeof ResizeObserver){const t=new ResizeObserver(()=>{r()});t.observe(n),tn.set(e,t)}"code_block"===(null==(t=me.value[e])?void 0:t.type)&&"undefined"!=typeof window&&Sn.set(e,[window.setTimeout(r,16),window.setTimeout(r,80),window.setTimeout(r,240),window.setTimeout(r,800)])}(e.index,n),class:"node-content"},[e.isCodeBlock||!1===l.typewriter?(T(),Z(ue(e.component),de({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=>r("copy",e)),onHandleArtifactClick:n[3]||(n[3]=e=>r("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"])):(T(),Z(J,{key:0,name:"typewriter",appear:""},{default:Q(()=>[(T(),Z(ue(e.component),de({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=>r("copy",e)),onHandleArtifactClick:n[1]||(n[1]=e=>r("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"]))]),_:2},1024))],512)))],8,Dr);var t}),128)),Le.value?(T(),E("div",{key:1,class:"node-spacer",style:ne({height:`${It.value}px`}),"aria-hidden":"true"},null,4)):q("",!0)],42,jr))}}),[["__scopeId","data-v-69906e93"]]);Vr.install=e=>{var n,t;const o=null!=(t=null!=(n=Vr.__name)?n:Vr.name)?t:"NodeRenderer";e.component(o,Vr)};const Ur=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:Vr},Symbol.toStringTag,{value:"Module"})),qr={key:0,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},Xr={key:1,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},Gr={key:2,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},Zr={key:3,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},Yr={class:"admonition-title"},Jr=["aria-expanded","aria-controls"],Qr=["id"],ei=/* @__PURE__ */Se(/* @__PURE__ */C({__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=j(()=>{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)}),i=V(!!o.node.collapsible&&!(null==(t=o.node.open)||t));function a(){o.node.collapsible&&(i.value=!i.value)}const s=`admonition-${Math.random().toString(36).slice(2,9)}`;return(n,t)=>(T(),E("div",{class:F(["admonition",[`admonition-${o.node.kind}`]])},[$("div",{id:s,class:"admonition-legend"},["note"===o.node.kind||"info"===o.node.kind?(T(),E("svg",qr,[...t[1]||(t[1]=[$("circle",{cx:"12",cy:"12",r:"10"},null,-1),$("path",{d:"M12 16v-4"},null,-1),$("path",{d:"M12 8h.01"},null,-1)])])):"tip"===o.node.kind?(T(),E("svg",Xr,[...t[2]||(t[2]=[$("path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"},null,-1),$("path",{d:"M9 18h6"},null,-1),$("path",{d:"M10 22h4"},null,-1)])])):"warning"===o.node.kind||"caution"===o.node.kind?(T(),E("svg",Gr,[...t[3]||(t[3]=[$("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"},null,-1),$("path",{d:"M12 9v4"},null,-1),$("path",{d:"M12 17h.01"},null,-1)])])):"danger"===o.node.kind||"error"===o.node.kind?(T(),E("svg",Zr,[...t[4]||(t[4]=[$("polygon",{points:"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2"},null,-1),$("path",{d:"M12 8v4"},null,-1),$("path",{d:"M12 16h.01"},null,-1)])])):q("",!0),$("span",Yr,R(r.value),1),o.node.collapsible?(T(),E("button",{key:4,class:"admonition-toggle","aria-expanded":!i.value,"aria-controls":`${s}-content`,onClick:a},[(T(),E("svg",{style:ne({rotate:i.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[...t[5]||(t[5]=[$("path",{d:"m9 18 6-6-6-6"},null,-1)])],4))],8,Jr)):q("",!0)]),ee($("div",{id:`${s}-content`,class:"admonition-content","aria-labelledby":s},[I(A(Vr),{"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"])],8,Qr),[[oe,!i.value]])],2))}}),[["__scopeId","data-v-a3a8afce"]]);ei.install=e=>{e.component(ei.__name,ei)};const ni=()=>import("@terrastruct/d2");let ti=null,oi=ni;function li(e){oi=e,ti=null}function ri(e){li(null!=e?e:ni)}function ii(){li(null)}function ai(){return"function"==typeof oi}function si(){return d(this,null,function*(){if(ti)return ti;const e=oi;if(!e)return null;let n;try{n=yield e()}catch(t){if(e===ni)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw t}return n?(ti=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),ti):null})}const ui=()=>import("mermaid");let di=null,ci=ui;function hi(e){ci=e,di=null}function mi(e){hi(null!=e?e:ui)}function fi(){hi(null)}function pi(){return"function"==typeof ci}function vi(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 gi(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 yi(){return d(this,null,function*(){if(di)return di;const e=function(){try{const e=globalThis;return vi(null==e?void 0:e.mermaid)}catch(e){return null}}();if(e)return di=e,gi(di),di;const n=ci;if(!n)return null;let t;try{t=yield n()}catch(o){if(n===ui)throw new Error('Optional dependency "mermaid" is not installed. Please install it to enable mermaid diagrams.');throw o}return t?(di=vi(t),gi(di),di):null})}function wi(e){return JSON.stringify(e)}function Ni(e){var n;const t=null!=(n=e.mode)?n:"classic",o=e.katexUrl,l=e.mhchemUrl,r=wi(a({throwOnError:!0,displayMode:!0,output:"html",strict:"ignore"},e.renderOptions||{})),i=wi(o),s=l?wi(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 xi(e){var n,t;const o=Ni(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 u="module"===(null!=(n=e.mode)?n:"classic")?s(a({},null!=(t=e.workerOptions)?t:{}),{type:"module"}):e.workerOptions,d=new Worker(r,u);if(e.debug)try{d.postMessage({type:"init",debug:!0})}catch(c){}return{worker:d,dispose:()=>{if(!i){i=!0;try{URL.revokeObjectURL(r)}catch(c){}}},source:o}}function ki(e){return e?e.replace(/·/g,"⋅").replace(/℃/g,"°C"):""}sn.install=e=>{e.component(sn.__name,sn)};let Mi=null,bi=null,Si=!1;const _i=/* @__PURE__ */new Map,Bi=/* @__PURE__ */new Map;let Oi=5;const Li=/* @__PURE__ */new Set;function Ci(){if(_i.size<Oi&&Li.size){const n=Array.from(Li);Li.clear();for(const t of n)try{t()}catch(e){}}}function Ti(e){Mi=e,bi=null,Mi.onmessage=e=>{const{id:n,html:t,error:o}=e.data,l=_i.get(n);if(l)if(_i.delete(n),clearTimeout(l.timeoutId),Ci(),o)l.reject(new Error(o));else{const{content:n,displayMode:o}=e.data;if(n){const e=`${o?"d":"i"}:${n}`;if(Bi.set(e,t),Bi.size>200){const e=Bi.keys().next().value;Bi.delete(e)}}l.resolve(t)}},Mi.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[n,t]of _i.entries())clearTimeout(t.timeoutId),t.reject(new Error(`Worker error: ${e.message}`));_i.clear(),Ci()}}function Ei(){var e;Mi&&(null==(e=Mi.terminate)||e.call(Mi)),Mi=null,bi=null}function Ii(e){Si=!!e,Mi&&Mi.postMessage({type:"init",debug:Si})}function Ai(e,n=!0,t=2e3,o){return d(this,null,function*(){performance.now();const l=ki(e);if(!Kn()){const e=new Error("KaTeX rendering disabled");return e.name="KaTeXDisabled",e.code="KATEX_DISABLED",Promise.reject(e)}if(bi)return Promise.reject(bi);const r=`${n?"d":"i"}:${l}`,i=Bi.get(r);if(i)return Promise.resolve(i);const a=Mi||(bi=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),bi.name="WorkerInitError",bi.code="WORKER_INIT_ERROR",null);if(!a)return Promise.reject(bi);if(_i.size>=Oi){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code="WORKER_BUSY",e.busy=!0,e.inFlight=_i.size,e.max=Oi,Promise.reject(e)}return new Promise((e,r)=>{if(null==o?void 0:o.aborted){const e=new Error("Aborted");return e.name="AbortError",void r(e)}const i=Math.random().toString(36).slice(2),s=globalThis.setTimeout(()=>{_i.delete(i);const e=new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",r(e),Ci()},t);o&&o.addEventListener("abort",()=>{globalThis.clearTimeout(s),_i.has(i)&&_i.delete(i);const e=new Error("Aborted");e.name="AbortError",r(e),Ci()},{once:!0});const u=e,d=r;_i.set(i,{resolve:e=>{u(e)},reject:e=>{d(e)},timeoutId:s}),a.postMessage({id:i,content:l,displayMode:n})})})}function $i(e,n=!0,t){const o=`${n?"d":"i"}:${ki(e)}`;if(Bi.set(o,t),Bi.size>200){const e=Bi.keys().next().value;Bi.delete(e)}}function Hi(){return{inFlight:_i.size,max:Oi}}function zi(e){Number.isFinite(e)&&e>0&&(Oi=Math.floor(e))}const Ri="WORKER_BUSY";function Wi(){return _i.size>=Oi}function Pi(e=2e3,n){return _i.size<Oi?Promise.resolve():new Promise((t,o)=>{let l,r=!1;const i=()=>{r||(r=!0,l&&globalThis.clearTimeout(l),Li.delete(i),t())};if(Li.add(i),l=globalThis.setTimeout(()=>{if(r)return;r=!0,Li.delete(i);const e=new Error("Wait for worker slot timed out");e.name="WorkerBusyTimeout",e.code="WORKER_BUSY_TIMEOUT",o(e)},e),queueMicrotask(()=>Ci()),n){const e=()=>{if(r)return;r=!0,l&&globalThis.clearTimeout(l),Li.delete(i);const e=new Error("Aborted");e.name="AbortError",o(e)};n.aborted?e():n.addEventListener("abort",e,{once:!0})}})}const ji={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function Fi(e){null!=e.timeout&&(ji.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(ji.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(ji.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(ji.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function Ki(){return a({},ji)}function Di(e){return d(this,arguments,function*(e,n=!0,t={}){var o,l,r,i;if(!Kn()){const e=new Error("KaTeX rendering disabled");throw e.name="KaTeXDisabled",e.code="KATEX_DISABLED",e}const a=null!=(o=t.timeout)?o:ji.timeout,s=null!=(l=t.waitTimeout)?l:ji.waitTimeout,u=null!=(r=t.backoffMs)?r:ji.backoffMs,d=null!=(i=t.maxRetries)?i:ji.maxRetries,c=Number.isFinite(d)?Math.max(0,Math.min(Math.floor(d),8)):ji.maxRetries,h=t.signal;let m=0;for(;;){if(null==h?void 0:h.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}try{return yield Ai(e,n,a,h)}catch(f){if((null==f?void 0:f.code)!==Ri||m>=c)throw f;if(m++,yield Pi(s,h).catch(()=>{}),null==h?void 0:h.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}u>0&&(yield new Promise(e=>globalThis.setTimeout(e,u*m)))}}})}function Vi(e){return JSON.stringify(e)}function Ui(e){var n;const t=null!=(n=e.mode)?n:"module",o=Vi(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(${Vi(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 qi(e){var n,t;const o=Ui(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 u="module"===(null!=(n=e.mode)?n:"module")?s(a({},null!=(t=e.workerOptions)?t:{}),{type:"module"}):e.workerOptions,d=new Worker(r,u);if(e.debug)try{d.postMessage({type:"init",debug:!0})}catch(c){}return{worker:d,dispose:()=>{if(!i){i=!0;try{URL.revokeObjectURL(r)}catch(c){}}},source:o}}let Xi=null,Gi=null;const Zi=/* @__PURE__ */new Map;let Yi=5,Ji=!1;function Qi(e){Ji=!!e}function ea(e){Number.isFinite(e)&&e>0&&(Yi=Math.floor(e))}function na(){return{inFlight:Zi.size,max:Yi}}const ta="WORKER_BUSY",oa="MERMAID_DISABLED";function la(e){Xi=e,Gi=null;const n=e;Xi.onmessage=e=>{if(Xi!==n)return;const{id:t,ok:o,result:l,error:r}=e.data,i=Zi.get(t);i&&(!1===o||r?i.reject(new Error(r||"Unknown error")):i.resolve(l))},Xi.onerror=e=>{var t,o;if(Xi===n)if(0!==Zi.size){try{Ji?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 Zi.entries())t.reject(new Error(`Worker error: ${e.message}`));Zi.clear()}else null==(t=console.debug)||t.call(console,"[mermaidWorkerClient] Worker error (no pending):",(null==e?void 0:e.message)||e)},Xi.onmessageerror=e=>{var t,o;if(Xi===n)if(0!==Zi.size){try{Ji?console.error("[mermaidWorkerClient] Worker messageerror:",e):null==(o=console.debug)||o.call(console,"[mermaidWorkerClient] Worker messageerror:",e)}catch(l){}for(const[e,n]of Zi.entries())n.reject(new Error("Worker messageerror"));Zi.clear()}else null==(t=console.debug)||t.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function ra(){var e;if(Xi)try{for(const[e,n]of Zi.entries())n.reject(new Error("Worker cleared"));Zi.clear(),null==(e=Xi.terminate)||e.call(Xi)}catch(n){}Xi=null,Gi=null}function ia(e,n,t=1400){if(!pi()){const e=new Error("Mermaid rendering disabled");return e.name="MermaidDisabled",e.code=oa,Promise.reject(e)}if(Gi)return Promise.reject(Gi);const o=Xi||(Gi=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),Gi.name="WorkerInitError",Gi.code="WORKER_INIT_ERROR",null);if(!o)return Promise.reject(Gi);if(Zi.size>=Yi){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=ta,e.inFlight=Zi.size,e.max=Yi,Promise.reject(e)}return new Promise((l,r)=>{const i=Math.random().toString(36).slice(2);let a,s=!1;const u=()=>{s||(s=!0,null!=a&&globalThis.clearTimeout(a),Zi.delete(i))},d={resolve:e=>{u(),l(e)},reject:e=>{u(),r(e)}};Zi.set(i,d);try{o.postMessage({id:i,action:e,payload:n})}catch(c){return Zi.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=Zi.get(i);n&&n.reject(e)},t)})}function aa(e,n,t=1400){return d(this,null,function*(){try{return yield ia("canParse",{code:e,theme:n},t)}catch(o){return Promise.reject(o)}})}function sa(e,n,t=1400){return d(this,null,function*(){try{return yield ia("findPrefix",{code:e,theme:n},t)}catch(o){return Promise.reject(o)}})}function ua(){if(Xi)try{for(const[e,n]of Zi.entries())n.reject(new Error("Worker terminated"));Zi.clear(),Xi.terminate()}finally{Xi=null}}const da=se(()=>import("./index7.js")),ca=se(()=>import("./index3.js")),ha=se(()=>import("./index2.js")),ma=se(()=>import("./index4.js")),fa=se(()=>import("./index5.js")),pa=se(()=>import("./index6.js")),va={AdmonitionNode:ei,BlockquoteNode:_e,CheckboxNode:Ce,CodeBlockNode:da,DefinitionListNode:Ae,EmojiNode:He,EmphasisNode:wt,FootnoteNode:bt,FootnoteReferenceNode:qe,FootnoteAnchorNode:xt,HardBreakNode:_t,HeadingNode:Ot,HtmlBlockNode:zt,HtmlInlineNode:nn,HighlightNode:gt,ImageNode:In,D2BlockNode:pa,InfographicBlockNode:fa,InlineCodeNode:ln,PreCodeNode:Ft,InsertNode:pt,LinkNode:mt,ListItemNode:Lt,ListNode:Ct,MathBlockNode:ca,MathInlineNode:ha,MermaidBlockNode:ma,ParagraphNode:Wt,StrikethroughNode:st,StrongNode:it,SubscriptNode:lt,SuperscriptNode:nt,TableNode:Xt,TextNode:Gn,ThematicBreakNode:Zt,VmrContainerNode:Qt,ReferenceNode:Jn,MarkdownCodeBlockNode:Pr},ga={install(e,n){Object.entries(va).forEach(([n,t])=>{e.component(n,t)}),(null==n?void 0:n.iconTheme)&&Dl(n.iconTheme),(null==n?void 0:n.getLanguageIcon)&&or(n.getLanguageIcon),(null==n?void 0:n.mathOptions)&&L(n.mathOptions)}};export{ca as $,ei as A,_e as B,Ce as C,pa as D,He as E,wt as F,xt as G,bt as H,qe as I,_t as J,Ot as K,gt as L,zt as M,nn as N,In as O,fa as P,ln as Q,pt as R,mt as S,Lt as T,Ct as U,oa as V,Ri as W,ta as X,Pr as Y,Vr as Z,Se as _,Vn as a,ha as a0,ma as a1,Wt as a2,Jn as a3,st as a4,it as a5,lt as a6,nt as a7,Xt as a8,Gn as a9,Vl as aA,ai as aB,Wi as aC,Kn as aD,pi as aE,ur as aF,ir as aG,Zl as aH,ql as aI,Kl as aJ,Ke as aK,Ai as aL,je as aM,li as aN,bn as aO,Dl as aP,Fi as aQ,Ti as aR,Ii as aS,zi as aT,Pn as aU,or as aV,hi as aW,la as aX,Qi as aY,ea as aZ,Pi as a_,Zt as aa,sn as ab,Qt as ac,ga as ad,Ni as ae,Ui as af,De as ag,Ei as ah,ra as ai,xi as aj,qi as ak,Gl as al,ii as am,Fn as an,fi as ao,cr as ap,ri as aq,jn as ar,mi as as,dr as at,Xl as au,Fe as av,Ki as aw,Hi as ax,na as ay,hr as az,Bn as b,mr as c,yi as d,xn as e,aa as f,Dn as g,kn as h,sa as i,si as j,lr as k,rr as l,zl as m,ki as n,sr as o,nr as p,ar as q,Di as r,$i as s,ua as t,It as u,Ft as v,Ar as w,fr as x,da as y,Ae as z};
|
|
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)),u=(e,n,t)=>i(e,"symbol"!=typeof n?n+"":n,t),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{tokenizeHtml as c,hasCustomHtmlComponents as h,sanitizeHtmlAttrs as m,BLOCKED_HTML_TAGS as f,isCustomHtmlComponentTag as p,convertHtmlAttrsToProps as v,sanitizeHtmlContent as g,sanitizeHtmlTokenAttrs as y,tokenAttrsToRecord as w,NON_STRUCTURING_HTML_TAGS as N,normalizeCustomHtmlTags as k,getHtmlTagFromContent as x,shouldRenderUnknownHtmlTagAsText as M,getMarkdown as b,mergeCustomHtmlTags as S,resolveCustomHtmlTags as _,parseMarkdownToStructure as B,stripCustomHtmlWrapper as O,setDefaultMathOptions as L}from"stream-markdown-parser";import{defineComponent as C,openBlock as T,createElementBlock as E,createVNode as I,unref as A,createElementVNode as $,Fragment as H,renderList as z,toDisplayString as R,shallowRef as W,h as P,computed as j,normalizeClass as F,useAttrs as K,inject as D,ref as V,watch as U,createCommentVNode as q,nextTick as X,onBeforeUnmount as G,createBlock as Z,Teleport as Y,Transition as J,withCtx as Q,withDirectives as ee,normalizeStyle as ne,createTextVNode as te,vShow as oe,createApp as le,getCurrentInstance as re,renderSlot as ie,readonly as ae,defineAsyncComponent as se,resolveDynamicComponent as ue,mergeProps as de,provide as ce,withModifiers as he,createStaticVNode as me,onMounted as fe,createSlots as pe,reactive as ve,markRaw as ge}from"vue";import{autoUpdate as ye,offset as we,flip as Ne,shift as ke,arrow as xe,computePosition as Me}from"@floating-ui/dom";const be=["cite"],Se=(e,n)=>{const t=e.__vccOpts||e;for(const[o,l]of n)t[o]=l;return t},_e=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"BlockquoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(T(),E("blockquote",{class:"blockquote",dir:"auto",cite:e.node.cite},[I(A(Vr),{"index-key":`blockquote-${n.indexKey}`,nodes:n.node.children||[],"custom-id":n.customId,typewriter:n.typewriter,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))},null,8,["index-key","nodes","custom-id","typewriter"])],8,be))}}),[["__scopeId","data-v-07e0310e"]]);_e.install=e=>{e.component(_e.__name,_e)};const Be=["aria-label"],Oe={key:0,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",class:"checkbox-icon checkbox-unchecked"},Le={key:1,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",class:"checkbox-icon checkbox-checked"},Ce=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"CheckboxNode",props:{node:{}},setup:e=>(n,t)=>(T(),E("span",{class:"checkbox-node",role:"img","aria-label":e.node.checked?"checked":"unchecked"},[e.node.checked?(T(),E("svg",Le,[...t[1]||(t[1]=[$("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",fill:"currentColor"},null,-1),$("path",{d:"M9 12l2 2 4-4",stroke:"hsl(var(--ms-background))","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(T(),E("svg",Oe,[...t[0]||(t[0]=[$("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",stroke:"currentColor","stroke-width":"2"},null,-1)])]))],8,Be))}),[["__scopeId","data-v-be21ab83"]]);Ce.install=e=>{e.component(Ce.__name,Ce)};const Te={class:"definition-list"},Ee={class:"definition-term"},Ie={class:"definition-desc"},Ae=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"DefinitionListNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(e,t)=>(T(),E("dl",Te,[(T(!0),E(H,null,z(n.node.items,(o,l)=>(T(),E(H,{key:l},[$("dt",Ee,[I(A(Vr),{"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"])]),$("dd",Ie,[I(A(Vr),{"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-c1b2a2e8"]]);Ae.install=e=>{e.component(Ae.__name,Ae)};const $e={class:"emoji-node"},He=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"EmojiNode",props:{node:{}},setup:e=>(n,t)=>(T(),E("span",$e,R(e.node.name),1))}),[["__scopeId","data-v-de55dc97"]]);He.install=e=>{e.component(He.__name,He)};const ze="__global__",Re="__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__",We=(()=>{const e=globalThis;if(e[Re])return e[Re];const n={scopedCustomComponents:{},revision:W(0)};return e[Re]=n,n})(),Pe=We.revision;function je(e,n){"string"==typeof e?We.scopedCustomComponents[e]=n||{}:We.scopedCustomComponents[ze]=e||{},Pe.value++}function Fe(e){const n=We.scopedCustomComponents[ze]||{};if(!e)return n;const t=We.scopedCustomComponents[e]||{};return n&&0!==Object.keys(n).length?t&&0!==Object.keys(t).length?a(a({},n),t):n:t}function Ke(e){if(e===ze)throw new Error("removeCustomComponents: use clearGlobalCustomComponents() to clear the global mapping");delete We.scopedCustomComponents[e],Pe.value++}function De(){delete We.scopedCustomComponents[ze],Pe.value++}const Ve=["id"],Ue=["title"],qe=/* @__PURE__ */Se(/* @__PURE__ */C({__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)=>(T(),E("sup",{id:`fnref-${e.node.id}`,class:"footnote-reference",onClick:t},[$("span",{href:n,title:`查看脚注 ${e.node.id}`,class:"footnote-link cursor-pointer"},"["+R(e.node.id)+"]",9,Ue)],8,Ve))}}),[["__scopeId","data-v-82cafe9f"]]);qe.install=e=>{e.component(qe.__name,qe)};const Xe=(()=>{try{return Boolean(!1)}catch(e){}return!1})();function Ge(e){Xe&&console.warn(e)}function Ze(e){return m(e)}function Ye(e,n,t,o,l){if(f.has(e.toLowerCase()))return null;const r=Ze(n),i=r.key,u=null!=i&&""!==i?i:l;if(function(e,n){return p(e,n)}(e,o)){const n=o[e]||o[e.toLowerCase()],l=function(e){return v(e)}(r);return P(n,s(a({},l),{key:u}),t.length>0?t:void 0)}return P(e,s(a({},r),{innerHTML:void 0,key:u}),t.length>0?t:void 0)}function Je(e,n){return h(e,n)}function Qe(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=Ye(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=Ye(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&&Ge(`Auto-closing unclosed tag: <${r.tagName}>`)}else Ge(`Ignoring closing tag with no matching opening tag: </${r.tagName}>`)}for(;o.length>0;){const e=o.pop(),t=Ye(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),Ge(`Auto-closing unclosed tag: <${e.tagName}>`)}return l}(c(e),n);return t}catch(o){return t=o,Xe&&console.error("Failed to parse HTML to VNodes:",t),null}var t}const en=["innerHTML"],nn=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"HtmlInlineNode",props:{node:{},customId:{}},setup(e){const n=e,t=j(()=>(Pe.value,Fe(n.customId))),o=C({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),l=j(()=>{const e=n.node.content;if(!e)return{mode:"html",content:""};if(n.node.loading&&!n.node.autoClosed)return{mode:"text",content:e};if(n.node.loading&&n.node.autoClosed){const n=Qe(e,t.value);if(null!==n)return{mode:"dynamic",nodes:n}}if(!Je(e,t.value))return{mode:"html",content:g(e)};const o=Qe(e,t.value);return null===o?{mode:"html",content:g(e)}:{mode:"dynamic",nodes:o}});return(e,t)=>"dynamic"===l.value.mode?(T(),E("span",{key:0,class:F(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},[I(A(o),{nodes:l.value.nodes},null,8,["nodes"])],2)):"text"===l.value.mode?(T(),E("span",{key:1,class:F(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},R(l.value.content),3)):(T(),E("span",{key:2,class:F(["html-inline-node",{"html-inline-node--loading":n.node.loading}]),innerHTML:l.value.content},null,10,en))}}),[["__scopeId","data-v-3b69597d"]]);nn.install=e=>{e.component(nn.__name,nn)};const tn={class:"inline-code"},on={key:0},ln=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"InlineCodeNode",props:{node:{}},setup(e){const n=e,t=K(),o=D("markstreamTypewriter",void 0),l=D("markstreamTextStreamState",void 0),r=j(()=>{const e=t.typewriter;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),i=j(()=>"boolean"==typeof r.value?r.value:"boolean"!=typeof(null==o?void 0:o.value)||o.value),a=j(()=>{var e;const n=null!=(e=t["index-key"])?e:t.indexKey;return null==n||""===n?"":String(n)}),s=V(n.node.code),u=V(""),d=V(0);function c(){return s.value+u.value}function h(e){s.value=e,u.value=""}function m(){u.value&&(s.value=c(),u.value="")}U([()=>n.node.code,a,i],([e])=>{const n=String(null!=e?e:""),t=c(),o=a.value,r=o?null==l?void 0:l.get(o):void 0,m=null!=r?r:t;return i.value?n===m?(h(n),void(o&&(null==l||l.set(o,n)))):m&&n.startsWith(m)&&n.length>m.length?(s.value=m,u.value=n.slice(m.length),d.value+=1,void(o&&(null==l||l.set(o,n)))):(h(n),void(o&&(null==l||l.set(o,n)))):(h(n),void(o&&(null==l||l.set(o,n))))},{immediate:!0}),U(i,e=>{e||h(c())});const f=j(()=>d.value%2==0?"inline-code-stream-delta--a":"inline-code-stream-delta--b");return(e,n)=>(T(),E("code",tn,[s.value?(T(),E("span",on,R(s.value),1)):q("",!0),u.value?(T(),E("span",{key:1,class:F(["inline-code-stream-delta",[f.value]]),onAnimationend:m},R(u.value),35)):q("",!0)]))}}),[["__scopeId","data-v-4f389e00"]]);ln.install=e=>{e.component(ln.__name,ln)};const rn=["id"],an=["data-placement"],sn=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"Tooltip",props:{visible:{type:Boolean},anchorEl:{},content:{},placement:{},offset:{},originX:{},originY:{},id:{},isDark:{type:[Boolean,null]}},setup(e){var n;const t=e,o=V(null),l=V(null),r=V({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"}),i=V({}),a=V(null!=(n=t.placement)?n:"top"),s=V(!1);let u=null;function c(){return d(this,null,function*(){var e,n;if(!t.anchorEl||!o.value)return;const s=[we(null!=(e=t.offset)?e:6),Ne(),ke({padding:6}),...l.value?[xe({element:l.value,padding:4})]:[]],{x:u,y:d,placement:c,middlewareData:h}=yield Me(t.anchorEl,o.value,{placement:null!=(n=t.placement)?n:"top",middleware:s,strategy:"fixed"});if(r.value.transform=`translate3d(${Math.round(u)}px, ${Math.round(d)}px, 0)`,r.value.left="0px",r.value.top="0px",a.value=c,h.arrow&&l.value){const{x:e,y:n}=h.arrow,t={top:"bottom",bottom:"top",left:"right",right:"left"}[c.split("-")[0]];i.value={left:null!=e?`${e}px`:"",top:null!=n?`${n}px`:"",[t]:"-3px"}}})}return U(()=>t.visible,e=>d(null,null,function*(){if(e)if(s.value=!1,yield X(),t.anchorEl&&o.value)try{const e=t.anchorEl.getBoundingClientRect();yield c();const n=r.value.transform;if(null!=t.originX&&null!=t.originY){const o=Math.abs(Number(t.originX)-e.left),l=Math.abs(Number(t.originY)-e.top);Math.hypot(o,l)>120?(r.value.transform=`translate3d(${Math.round(t.originX)}px, ${Math.round(t.originY)}px, 0)`,yield X(),s.value=!0,yield X(),r.value.transform=n):s.value=!0}else s.value=!0;u=ye(t.anchorEl,o.value,c)}catch(n){yield c(),s.value=!0,u=ye(t.anchorEl,o.value,c)}else s.value=!0;else s.value=!1,u&&(u(),u=null)})),U([()=>t.anchorEl,()=>t.placement,()=>t.content],()=>d(null,null,function*(){t.visible&&t.anchorEl&&o.value&&(yield X(),yield c())})),G(()=>{u&&u()}),(n,u)=>(T(),Z(Y,{to:"body"},[$("div",{class:F(["markstream-vue",{dark:e.isDark}])},[I(J,{name:"tooltip",appear:""},{default:Q(()=>[ee($("div",{id:t.id,ref_key:"tooltip",ref:o,style:ne({position:"fixed",left:r.value.left,top:r.value.top,transform:r.value.transform}),class:"tooltip-element",role:"tooltip"},[te(R(e.content)+" ",1),$("div",{ref_key:"arrowEl",ref:l,class:"tooltip-arrow","data-placement":a.value,style:ne(i.value)},null,12,an)],12,rn),[[oe,e.visible&&s.value]])]),_:1})],2)]))}}),[["__scopeId","data-v-e28aa7bd"]]),un=V(!1),dn=V(""),cn=V("top"),hn=V(null),mn=V(null),fn=V(null),pn=V(null),vn=V(null);let gn=null,yn=null;function wn(){gn&&(clearTimeout(gn),gn=null),yn&&(clearTimeout(yn),yn=null)}let Nn=!1;function kn(e,n,t="top",o=!1,l,r){if(!e)return;!function(){if(!Nn&&"undefined"!=typeof document)try{Nn=!0;const e=document.createElement("div");e.setAttribute("data-singleton-tooltip","1"),document.body.appendChild(e),le({setup:()=>()=>{var e;return P(sn,{visible:un.value,"anchor-el":hn.value,content:dn.value,placement:cn.value,id:mn.value,originX:fn.value,originY:pn.value,isDark:null!=(e=vn.value)?e:void 0})}}).mount(e)}catch(e){Nn=!1,console.warn("[markstream-vue] Failed to mount Tooltip component. Tooltips will be disabled.",e)}}(),wn();const i=()=>{var o,i;mn.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,hn.value=e,dn.value=n,cn.value=t,fn.value=null!=(o=null==l?void 0:l.x)?o:null,pn.value=null!=(i=null==l?void 0:l.y)?i:null,vn.value="boolean"==typeof r?r:null,un.value=!0;try{e.setAttribute("aria-describedby",mn.value)}catch(a){}};o?i():gn=setTimeout(i,80)}function xn(e=!1){wn();const n=()=>{if(hn.value&&mn.value)try{hn.value.removeAttribute("aria-describedby")}catch(e){}un.value=!1,hn.value=null,mn.value=null,fn.value=null,pn.value=null};e?n():yn=setTimeout(n,120)}const Mn={"common.copy":"Copy","common.copied":"Copied","common.decrease":"Decrease","common.reset":"Reset","common.increase":"Increase","common.expand":"Expand","common.collapse":"Collapse","common.preview":"Preview","common.source":"Source","common.export":"Export","common.open":"Open","common.minimize":"Minimize","common.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."};function bn(e){Object.assign(Mn,e)}const Sn=e=>{var n;return null!=(n=Mn[e])?n:function(e){return(e.split(".").pop()||e).replace(/[_-]/g," ").replace(/([A-Z])/g," $1").replace(/\s+/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}(e)};function _n(e){return{t(n){if(e.te&&Mn[n]&&!e.te(n))return Sn(n);const t=e.t(n);return t===n&&Mn[n]?Sn(n):t}}}function Bn(){const e=function(){var e,n;try{const t=re(),o=null==t?void 0:t.proxy,l=null==o?void 0:o.$t;if("function"==typeof l){const e=null==o?void 0:o.$te;return{t:l.bind(o),te:"function"==typeof e?e.bind(o):void 0}}const r=null==(n=null==(e=null==t?void 0:t.appContext)?void 0:e.config)?void 0:n.globalProperties,i=null==r?void 0:r.$t;if("function"==typeof i){const e=null==r?void 0:r.$te;return{t:i.bind(r),te:"function"==typeof e?e.bind(r):void 0}}}catch(t){}return null}();if(e)return _n(e);try{const e=globalThis.$vueI18nUse||null;if(e&&"function"==typeof e)try{const n=e();if(n&&"function"==typeof n.t)return _n({t:n.t.bind(n),te:"function"==typeof n.te?n.te.bind(n):void 0})}catch(n){}}catch(n){}return{t:Sn}}const On={class:"image-node-container"},Ln=["src","alt","title","loading","fetchpriority","decoding","tabindex","aria-label"],Cn={key:"placeholder",class:"image-placeholder"},Tn={key:1,class:"image-node__raw-text"},En={key:"error",class:"image-error"},In=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"ImageNode",props:{node:{},fallbackSrc:{default:""},lazy:{type:Boolean,default:!1},usePlaceholder:{type:Boolean,default:!0}},emits:["load","error","click"],setup(e,{emit:n}){const t=e,o=n,l=V(!1),r=V(!1),i=V(!1),a=j(()=>r.value&&t.fallbackSrc?t.fallbackSrc:t.node.src),s=j(()=>!t.lazy);function u(){t.fallbackSrc&&!i.value?(i.value=!0,r.value=!0):(r.value=!0,o("error",t.node.src))}function d(){l.value=!0,r.value=!1,o("load",a.value)}function c(e){e.preventDefault(),l.value&&!r.value&&o("click",[e,a.value])}const{t:h}=Bn();return U(a,()=>{l.value=!1,r.value=!1}),(n,o)=>(T(),E("span",On,[I(J,{name:"img-switch",mode:"out-in"},{default:Q(()=>{var i,m,f,p,v;return[e.node.loading||r.value?r.value?e.node.loading||t.fallbackSrc?q("",!0):(T(),E("span",En,[ie(n.$slots,"error",{node:t.node,displaySrc:a.value,imageLoaded:l.value,hasError:r.value,fallbackSrc:t.fallbackSrc,lazy:t.lazy},()=>[o[1]||(o[1]=$("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[$("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)),$("span",null,R(A(h)("image.loadError")),1)],!0)])):(T(),E("span",Cn,[t.usePlaceholder?ie(n.$slots,"placeholder",{key:0,node:t.node,displaySrc:a.value,imageLoaded:l.value,hasError:r.value,fallbackSrc:t.fallbackSrc,lazy:t.lazy},()=>[o[0]||(o[0]=$("span",{class:"image-shimmer"},null,-1))],!0):(T(),E("span",Tn,R(e.node.raw),1))])):(T(),E("img",{key:"image",src:a.value,alt:String(null!=(m=null!=(i=t.node.alt)?i:t.node.title)?m:""),title:String(null!=(p=null!=(f=t.node.title)?f:t.node.alt)?p:""),class:F(["image-node__img",{"is-loading":!s.value&&!l.value,"is-loaded":s.value||l.value,"cursor-pointer":l.value}]),loading:t.lazy?"lazy":void 0,fetchpriority:s.value?"high":void 0,decoding:s.value?"sync":"async",tabindex:l.value?0:-1,"aria-label":null!=(v=t.node.alt)?v:A(h)("image.preview"),onError:u,onLoad:d,onClick:c},null,42,Ln))]}),_:3})]))}}),[["__scopeId","data-v-0f18a0a5"]]);In.install=e=>{e.component(In.__name,In)};let An=null,$n=!1,Hn=Wn;function zn(e){var n;const t=null!=(n=null==e?void 0:e.default)?n:e;return t&&"function"==typeof t.renderToString?t:null}function Rn(){try{const e=globalThis;return zn(null==e?void 0:e.katex)}catch(e){return null}}function Wn(){return d(null,null,function*(){const e=Rn();if(e)return e;const n=yield import("katex");try{yield import("katex/dist/contrib/mhchem")}catch(t){}return zn(n)})}function Pn(e){Hn=e,An=null,$n=!1}function jn(e){Pn(null!=e?e:Wn)}function Fn(){Pn(null)}function Kn(){return"function"==typeof Hn}function Dn(){var e;const n=Rn();if(n)return An=n,An;if(An)return An;const t=Hn;if(!t||t===Wn)return null;try{const n=t();return n&&"function"!=typeof(null==n?void 0:n.then)?(An=null!=(e=zn(n))?e:n,An):null}catch(o){return null}}function Vn(){return d(this,null,function*(){var e;const n=Rn();if(n)return An=n,An;if(An)return An;if($n)return null;const t=Hn;if(!t)return $n=!0,null;try{const n=yield t();if(n)return An=null!=(e=zn(n))?e:n,An}catch(o){}return $n=!0,null})}const Un=W(!1);let qn=null;const Xn={key:0},Gn=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const n=e,t=(qn||(qn=Vn().then(e=>{Un.value=!!e}).catch(()=>{Un.value=!1})),ae(Un)),o=K(),l=D("markstreamTypewriter",void 0),r=D("markstreamTextStreamState",void 0),i=D("markstreamStreamVersion",void 0),a=j(()=>{const e=o.typewriter;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),s=j(()=>"boolean"==typeof a.value?a.value:"boolean"!=typeof(null==l?void 0:l.value)||l.value),u=j(()=>{var e;const n=null!=(e=o["index-key"])?e:o.indexKey;return null==n||""===n?"":String(n)}),d=V(n.node.content),c=V(""),h=V(0);function m(){return d.value+c.value}function f(e){d.value=e,c.value=""}function p(){c.value&&(d.value=m(),c.value="")}U([()=>n.node.content,u,s,()=>null==i?void 0:i.value],([e])=>{const n=String(null!=e?e:""),t=m(),o=u.value,l=o?null==r?void 0:r.get(o):void 0,i=null!=l?l:t;return s.value?n===i?(c.value?p():t!==n&&f(n),void(o&&(null==r||r.set(o,n)))):i&&n.startsWith(i)&&n.length>i.length?(d.value=i,c.value=n.slice(i.length),h.value+=1,void(o&&(null==r||r.set(o,n)))):(f(n),void(o&&(null==r||r.set(o,n)))):(f(n),void(o&&(null==r||r.set(o,n))))},{immediate:!0}),U(s,e=>{e||f(m())});const v=j(()=>h.value%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b");return(n,o)=>(T(),E("span",{class:F([[A(t)&&e.node.center?"text-node-center":""],"whitespace-pre-wrap break-words text-node"])},[d.value?(T(),E("span",Xn,R(d.value),1)):q("",!0),c.value?(T(),E("span",{key:1,class:F(["text-node-stream-delta",[v.value]]),onAnimationend:p},R(c.value),35)):q("",!0)],2))}}),[["__scopeId","data-v-03641323"]]);Gn.install=e=>{e.component(Gn.__name,Gn)};const Zn=se(()=>d(null,null,function*(){var e;if("test"===(null==(e=function(){const e=Reflect.get(globalThis,"process");return null==e?void 0:e.env}())?void 0:e.NODE_ENV)&&"undefined"!=typeof window)return e=>{var n,t,o,l;return P(Gn,s(a({},e),{node:{type:"text",content:null!=(t=e.node.raw)?t:`$${null!=(n=e.node.content)?n:""}$`,raw:null!=(l=e.node.raw)?l:`$${null!=(o=e.node.content)?o:""}$`}}))};try{if(yield Vn())return(yield import("./index2.js")).default}catch(n){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".',n)}return e=>{var n,t,o,l;return P(Gn,s(a({},e),{node:{type:"text",content:null!=(t=e.node.raw)?t:`$${null!=(n=e.node.content)?n:""}$`,raw:null!=(l=e.node.raw)?l:`$${null!=(o=e.node.content)?o:""}$`}}))}})),Yn=se(()=>d(null,null,function*(){try{if(yield Vn())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,o,l;return P(Gn,s(a({},e),{node:{type:"text",content:null!=(t=e.node.raw)?t:`$$${null!=(n=e.node.content)?n:""}$$`,raw:null!=(l=e.node.raw)?l:`$$${null!=(o=e.node.content)?o:""}$$`}}))}})),Jn=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(n,t)=>(T(),E("span",{class:"reference-node cursor-pointer text-xs rounded-md px-1.5 mx-0.5",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))},R(e.node.id),33))}),[["__scopeId","data-v-775c65e4"]]);Jn.install=e=>{e.component(Jn.__name,Jn)};const Qn={class:"superscript-node"},et={key:1},nt=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Fe(n.customId),o=a({text:Gn,inline_code:ln,link:mt,html_inline:nn,strong:it,emphasis:wt,footnote_reference:qe,strikethrough:st,highlight:gt,insert:pt,subscript:lt,emoji:He,math_inline:Zn,reference:Jn},t);return(t,l)=>(T(),E("sup",Qn,[(T(!0),E(H,null,z(e.node.children,(t,l)=>(T(),E(H,{key:`${e.indexKey||"superscript"}-${l}`},[o[t.type]?(T(),Z(ue(o[t.type]),{key:0,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"superscript"}-${l}`},null,8,["node","custom-id","index-key"])):(T(),E("span",et,R(t.content||t.raw),1))],64))),128))]))}}),[["__scopeId","data-v-6dc1e3ba"]]);nt.install=e=>{e.component(nt.__name,nt)};const tt={class:"subscript-node"},ot={key:1},lt=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Fe(n.customId),o=a({text:Gn,inline_code:ln,link:mt,html_inline:nn,strong:it,emphasis:wt,footnote_reference:qe,strikethrough:st,highlight:gt,insert:pt,superscript:nt,emoji:He,math_inline:Zn,reference:Jn},t);return(t,l)=>(T(),E("sub",tt,[(T(!0),E(H,null,z(e.node.children,(t,l)=>(T(),E(H,{key:`${e.indexKey||"subscript"}-${l}`},[o[t.type]?(T(),Z(ue(o[t.type]),{key:0,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"subscript"}-${l}`},null,8,["node","custom-id","index-key"])):(T(),E("span",ot,R(t.content||t.raw),1))],64))),128))]))}}),[["__scopeId","data-v-69de9b81"]]);lt.install=e=>{e.component(lt.__name,lt)};const rt={class:"strong-node"},it=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Fe(n.customId),o=a({text:Gn,inline_code:ln,link:mt,html_inline:nn,emphasis:wt,strikethrough:st,highlight:gt,insert:pt,subscript:lt,superscript:nt,emoji:He,footnote_reference:qe,math_inline:Zn,reference:Jn},t);return(t,l)=>(T(),E("strong",rt,[(T(!0),E(H,null,z(e.node.children,(t,l)=>(T(),Z(ue(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"]]);it.install=e=>{e.component(it.__name,it)};const at={class:"strikethrough-node"},st=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Fe(n.customId),o=a({text:Gn,inline_code:ln,link:mt,html_inline:nn,strong:it,emphasis:wt,highlight:gt,insert:pt,subscript:lt,superscript:nt,emoji:He,footnote_reference:qe,math_inline:Zn,reference:Jn},t);return(t,l)=>(T(),E("del",at,[(T(!0),E(H,null,z(e.node.children,(t,l)=>(T(),Z(ue(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"]]);st.install=e=>{e.component(st.__name,st)};const ut=["href","title","aria-label","aria-hidden"],dt=["aria-hidden"],ct={class:"link-text-wrapper relative inline-flex"},ht={class:"leading-[normal] link-text"},mt=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"LinkNode",props:{node:{},indexKey:{},customId:{},showTooltip:{type:Boolean,default:!0},color:{},underlineHeight:{},underlineBottom:{},animationDuration:{},animationOpacity:{},animationTiming:{},animationIteration:{}},setup(e){const n=e,t=D("markstreamShowTooltips",void 0),o=j(()=>{const e=null==t?void 0:t.value;return"boolean"==typeof e?e:n.showTooltip}),l=j(()=>{var e,t,o,l,r;const i=void 0!==n.underlineBottom?"number"==typeof n.underlineBottom?`${n.underlineBottom}px`:String(n.underlineBottom):"-3px",a=null!=(e=n.animationOpacity)?e:.35,s=Math.max(.12,Math.min(.5*a,a)),u={"--underline-height":`${null!=(t=n.underlineHeight)?t:2}px`,"--underline-bottom":i,"--underline-opacity":String(a),"--underline-rest-opacity":String(s),"--underline-duration":`${null!=(o=n.animationDuration)?o:1.6}s`,"--underline-timing":null!=(l=n.animationTiming)?l:"ease-in-out","--underline-iteration":"number"==typeof n.animationIteration?String(n.animationIteration):null!=(r=n.animationIteration)?r:"infinite"};return n.color&&(u["--link-color"]=n.color),u}),r={text:Gn,strong:it,strikethrough:st,emphasis:wt,image:In,html_inline:nn,inline_code:ln},i=j(()=>(Pe.value,Fe(n.customId))),s=K(),u=j(()=>{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 Ze(l)}),d=j(()=>{const e=a(a({},s),u.value);return delete e.title,e});function c(){o.value&&xn()}const h=j(()=>{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)=>{var u,m;return e.node.loading?(T(),E("span",de({key:1,class:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":e.node.loading?"false":"true"},A(s),{style:l.value}),[$("span",ct,[$("span",ht,[I(A(Gn),{class:"leading-[normal] link-text",node:{type:"text",content:String(null!=(u=e.node.text)?u:""),raw:String(null!=(m=e.node.text)?m:"")},"index-key":`${e.indexKey||"link-text"}-loading`},null,8,["node","index-key"])]),a[1]||(a[1]=$("span",{class:"link-loading-indicator","aria-hidden":"true"},null,-1))])],16,dt)):(T(),E("a",de({key:0,class:"link-node",href:e.node.href,title:o.value?"":h.value,"aria-label":`Link: ${h.value}`,"aria-hidden":e.node.loading?"true":"false",target:"_blank",rel:"noopener noreferrer"},d.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)||"";kn(e.currentTarget,s,"top",!1,a)}(e)),onMouseleave:c}),[(T(!0),E(H,null,z(e.node.children,(t,o)=>(T(),Z(ue(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,ut))}}}),[["__scopeId","data-v-27877c6b"]]);mt.install=e=>{e.component(mt.__name,mt)};const ft={class:"insert-node"},pt=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Fe(n.customId),o=a({text:Gn,inline_code:ln,link:mt,html_inline:nn,strong:it,emphasis:wt,strikethrough:st,highlight:gt,subscript:lt,superscript:nt,emoji:He,footnote_reference:qe,math_inline:Zn,reference:Jn},t);return(t,l)=>(T(),E("ins",ft,[(T(!0),E(H,null,z(e.node.children,(t,l)=>(T(),Z(ue(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"]]);pt.install=e=>{e.component(pt.__name,pt)};const vt={class:"highlight-node"},gt=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Fe(n.customId),o=a({text:Gn,inline_code:ln,link:mt,html_inline:nn,strong:it,emphasis:wt,strikethrough:st,insert:pt,subscript:lt,superscript:nt,emoji:He,footnote_reference:qe,math_inline:Zn,reference:Jn},t);return(t,l)=>(T(),E("mark",vt,[(T(!0),E(H,null,z(e.node.children,(t,l)=>(T(),Z(ue(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-36e74e6b"]]);gt.install=e=>{e.component(gt.__name,gt)};const yt={class:"emphasis-node"},wt=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Fe(n.customId),o=a({text:Gn,inline_code:ln,link:mt,html_inline:nn,strong:it,strikethrough:st,highlight:gt,insert:pt,subscript:lt,superscript:nt,emoji:He,footnote_reference:qe,math_inline:Zn,reference:Jn},t);return(t,l)=>(T(),E("em",yt,[(T(!0),E(H,null,z(e.node.children,(t,l)=>(T(),Z(ue(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"]]);wt.install=e=>{e.component(wt.__name,wt)};const Nt=["href","title"],kt=/* @__PURE__ */Se(/* @__PURE__ */C({__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)=>(T(),E("a",{class:"footnote-anchor text-sm hover:underline cursor-pointer",href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:t}," ↩︎ ",8,Nt))}}),[["__scopeId","data-v-83c33a47"]]);kt.install=e=>{e.component(kt.__name,kt)};const xt=["id"],Mt={class:"flex-1"},bt=/* @__PURE__ */C({__name:"FootnoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(T(),E("div",{id:`fnref--${e.node.id}`,class:"footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border)] pt-2"},[$("div",Mt,[I(A(Vr),{"index-key":`footnote-${n.indexKey}`,nodes:n.node.children,"custom-id":n.customId,typewriter:n.typewriter,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))},null,8,["index-key","nodes","custom-id","typewriter"])])],8,xt))}});bt.install=e=>{e.component(bt.__name,bt)};const St={class:"hard-break"},_t=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"HardBreakNode",props:{node:{}},setup:e=>(e,n)=>(T(),E("br",St))}),[["__scopeId","data-v-50c58f70"]]);_t.install=e=>{e.component(_t.__name,_t)};const Bt=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Fe(n.customId),o=a({text:Gn,inline_code:ln,link:mt,image:In,strong:it,emphasis:wt,strikethrough:st,highlight:gt,insert:pt,subscript:lt,superscript:nt,emoji:He,checkbox:Ce,checkbox_input:Ce,footnote_reference:qe,hardbreak:_t,math_inline:Zn,reference:Jn},t);return(t,l)=>(T(),Z(ue(`h${e.node.level}`),de({class:["heading-node",[`heading-${e.node.level}`]],dir:"auto"},e.node.attrs),{default:Q(()=>[(T(!0),E(H,null,z(e.node.children,(t,l)=>(T(),Z(ue(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"]))),128))]),_:1},16,["class"]))}}),[["__scopeId","data-v-bf120de0"]]),Ot=Bt;Ot.install=e=>{e.component(Bt.__name,Bt)};const Lt=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"ListItemNode",props:{node:{},item:{},indexKey:{},value:{},customId:{},typewriter:{type:Boolean},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=e,t=j(()=>{var e;return null!=(e=n.node)?e:n.item}),o=j(()=>null==n.value?{}:{value:n.value});return(e,l)=>{var r,i;return T(),E("li",de({class:"list-item",dir:"auto"},o.value),[I(A(Vr),de({showTooltips:n.showTooltips},{"index-key":`list-item-${n.indexKey}`,nodes:null!=(i=null==(r=t.value)?void 0:r.children)?i:[],"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"])],16)}}}),[["__scopeId","data-v-fdeabeb1"]]);Lt.install=e=>{e.component(Lt.__name,Lt)};const Ct=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"ListNode",props:{node:{},customId:{},indexKey:{},typewriter:{type:Boolean},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=j(()=>(Pe.value,Fe(e.customId).list_item||Lt));return(t,o)=>(T(),Z(ue(e.node.ordered?"ol":"ul"),{class:F(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:Q(()=>[(T(!0),E(H,null,z(e.node.items,(l,r)=>{var i;return T(),Z(ue(n.value),de({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!=(i=e.node.start)?i:1)+r:void 0,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))}),null,16,["node","custom-id","index-key","typewriter","value"])}),128))]),_:1},8,["class"]))}}),[["__scopeId","data-v-c145570b"]]);Ct.install=e=>{e.component(Ct.__name,Ct)};const Tt=/* @__PURE__ */Symbol("ViewportPriority");function Et(e,n){var t,o;const l="undefined"!=typeof window&&"undefined"!=typeof document,r="boolean"==typeof n?V(n):n,i=l?null!=(t=window.requestIdleCallback)?t:e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16):null,a=l?null!=(o=window.cancelIdleCallback)?o:e=>window.clearTimeout(e):null;let s=null,u=null;const d=/* @__PURE__ */new Map,c=/* @__PURE__ */new Set;let h=null;function m(){if(!d.size){try{null==s||s.disconnect()}catch(e){}s=null,u=null,c.size||function(){if(null!=h){try{null==a||a(h)}catch(e){}h=null}}()}}function f(e){const n=d.get(e);if(n){if(!n.visible.value){n.visible.value=!0;try{n.resolve()}catch(t){}}try{null==s||s.unobserve(e)}catch(t){}d.delete(e),c.delete(e),m()}}function p(){i&&null==h&&c.size&&(h=i(()=>{h=null;const e=c.values().next().value;e&&(c.delete(e),f(e),c.size&&p())},{timeout:1200}))}const v=(n,t)=>{const o=V(!1);let i,a=!1;const h=new Promise(e=>{i=()=>{a||(a=!0,e())}}),v=()=>{try{null==s||s.unobserve(n)}catch(e){}d.delete(n),c.delete(n),m()};if(!l||!r.value)return o.value=!0,i(),{isVisible:o,whenVisible:h,destroy:v};const g=function(n,t){if(!l)return s;if("undefined"==typeof IntersectionObserver)return null;const o=function(n,t){var o,l,r;return{root:null!=(o=null==e?void 0:e(null!=n?n:null))?o:null,rootMargin:null!=(l=null==t?void 0:t.rootMargin)?l:"300px",threshold:null!=(r=null==t?void 0:t.threshold)?r:0}}(n,t);if(s&&(i=o,(r=u)&&r.root===i.root&&r.rootMargin===i.rootMargin&&r.threshold===i.threshold))return s;var r,i;if(s)try{s.disconnect()}catch(a){}s=new IntersectionObserver(e=>{for(const n of e)(n.isIntersecting||n.intersectionRatio>0)&&f(n.target)},{root:o.root,rootMargin:o.rootMargin,threshold:o.threshold}),u=o;for(const e of d.keys())s.observe(e);return s}(n,t);return g?(d.set(n,{resolve:i,visible:o}),g.observe(n),c.add(n),p(),{isVisible:o,whenVisible:h,destroy:v}):(o.value=!0,i(),{isVisible:o,whenVisible:h,destroy:v})};return ce(Tt,v),v}function It(){var e,n;const t=D(Tt,void 0);if(t)return t;const o=/* @__PURE__ */new WeakMap;let l=null;const r=/* @__PURE__ */new Set;let i=null;const a="undefined"!=typeof window?null!=(e=window.requestIdleCallback)?e:e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16):null,s="undefined"!=typeof window?null!=(n=window.cancelIdleCallback)?n:e=>window.clearTimeout(e):null,u=()=>{if(null!=i){try{null==s||s(i)}catch(e){}i=null}},d=e=>{const n=o.get(e);if(n){if(!n.visible.value){n.visible.value=!0;try{n.resolve()}catch(t){}}try{null==l||l.unobserve(e)}catch(t){}o.delete(e),r.delete(e),r.size||u()}},c=()=>{a&&null==i&&r.size&&(i=a(()=>{i=null;const e=r.values().next().value;e&&(r.delete(e),d(e),r.size&&c())},{timeout:1200}))};return e=>{const n=V(!1);let t,i=!1;const a=new Promise(e=>{t=()=>{i||(i=!0,e())}}),s=()=>{try{null==l||l.unobserve(e)}catch(n){}o.delete(e),r.delete(e),r.size||u()},h=l||("undefined"==typeof window||"undefined"==typeof IntersectionObserver?null:(l=new IntersectionObserver(e=>{for(const n of e)(n.isIntersecting||n.intersectionRatio>0)&&d(n.target)},{root:null,rootMargin:"300px",threshold:0}),l));return h?(o.set(e,{resolve:t,visible:n}),h.observe(e),r.add(e),c(),{isVisible:n,whenVisible:a,destroy:s}):(n.value=!0,t(),{isVisible:n,whenVisible:a,destroy:s})}}const At={key:2,class:"html-block-node__raw"},$t=["innerHTML"],Ht={key:1,class:"html-block-node__placeholder"},zt=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"HtmlBlockNode",props:{node:{},customId:{}},setup(e){const n=e,t=se({loader:()=>Promise.resolve().then(()=>Ur),suspensible:!1}),o=j(()=>{const e=y(n.node.attrs);if(!e)return;const t=w(e);return Object.keys(t).length>0?t:void 0}),l=j(()=>(Pe.value,Fe(n.customId))),r=C({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),i=V(null),a=V("undefined"==typeof window),s=V(n.node.content),u=j(()=>Array.isArray(n.node.children)?n.node.children:[]),d=j(()=>String(n.node.tag||"div")),c=j(()=>N.has(d.value.trim().toLowerCase())),h=j(()=>u.value.length>0&&!!n.node.tag&&!c.value),m=j(()=>{var e,t,o;if(h.value)return{mode:"structured"};if(!a.value)return{mode:"html",content:null!=(e=s.value)?e:""};const r=null!=(t=s.value)?t:n.node.content;if(!r)return{mode:"html",content:""};if(n.node.loading){const e=Qe(r,l.value);return null===e?{mode:"text",content:null!=(o=n.node.raw)?o:r}:{mode:"dynamic",nodes:e}}if(!Je(r,l.value))return{mode:"html",content:g(r)};const i=Qe(r,l.value);return null===i?{mode:"html",content:g(r)}:{mode:"dynamic",nodes:i}}),f=It(),p=V(null),v=!!n.node.loading;return"undefined"!=typeof window?(U(i,e=>{var t,o;if(null==(o=null==(t=p.value)?void 0:t.destroy)||o.call(t),p.value=null,!v)return a.value=!0,void(s.value=n.node.content);if(!e)return void(a.value=!1);const l=f(e,{rootMargin:"400px"});p.value=l,a.value=l.isVisible.value,l.whenVisible.then(()=>{a.value=!0})},{immediate:!0}),U(()=>n.node.content,e=>{v&&!a.value||(s.value=e)})):a.value=!0,G(()=>{var e,n;null==(n=null==(e=p.value)?void 0:e.destroy)||n.call(e),p.value=null}),(n,l)=>(T(),Z(ue(h.value?d.value:"div"),de({ref_key:"htmlRef",ref:i,class:"html-block-node"},h.value?o.value:void 0),{default:Q(()=>[a.value?(T(),E(H,{key:0},["structured"===m.value.mode?(T(),Z(A(t),{key:0,nodes:u.value,"custom-id":e.customId,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0},null,8,["nodes","custom-id"])):"dynamic"===m.value.mode?(T(),Z(A(r),{key:1,nodes:m.value.nodes},null,8,["nodes"])):"text"===m.value.mode?(T(),E("pre",At,R(m.value.content),1)):(T(),E("div",de({key:3},o.value,{innerHTML:m.value.content}),null,16,$t))],64)):(T(),E("div",Ht,[ie(n.$slots,"placeholder",{node:e.node},()=>[l[0]||(l[0]=$("span",{class:"html-block-node__placeholder-bar"},null,-1)),l[1]||(l[1]=$("span",{class:"html-block-node__placeholder-bar w-4/5"},null,-1)),l[2]||(l[2]=$("span",{class:"html-block-node__placeholder-bar w-2/3"},null,-1))],!0)]))]),_:3},16))}}),[["__scopeId","data-v-2d17c76f"]]);zt.install=e=>{e.component(zt.__name,zt)};const Rt={dir:"auto",class:"paragraph-node"},Wt=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"ParagraphNode",props:{node:{},customId:{},indexKey:{},customHtmlTags:{}},setup(e){const n=e,t=Fe(n.customId);function o(e){var n;return"text"===e.type&&""===String(null!=(n=e.content)?n:"").trim()}function l(e){var n;return String(null!=(n=e.content)?n:"")}const r=j(()=>n.node.children.filter(e=>!o(e))),i=j(()=>r.value.length>0&&r.value.every(e=>"image"===e.type||function(e){var n;const t=function(e){return"link"===e.type&&Array.isArray(e.children)?e.children.filter(e=>!o(e)):[]}(e);return 1===t.length&&"image"===(null==(n=t[0])?void 0:n.type)}(e))),u=j(()=>new Set(k(n.customHtmlTags))),d=j(()=>{if(!i.value||r.value.length<=1)return n.node.children;const e=[];for(let t=0;t<n.node.children.length;t++){const l=n.node.children[t];if(!o(l)){e.push(l);continue}const r=e.length>0,i=n.node.children.slice(t+1).some(e=>!o(e));r&&i&&e.push(s(a({},l),{content:" ",raw:" "}))}return e});function c(e,t){return{node:e,"index-key":`${n.indexKey}-${t}`,"custom-id":n.customId,"custom-html-tags":n.customHtmlTags}}const h=a({inline_code:ln,image:In,link:mt,hardbreak:_t,emphasis:wt,strong:it,strikethrough:st,highlight:gt,insert:pt,subscript:lt,superscript:nt,html_inline:nn,html_block:zt,emoji:He,checkbox:Ce,math_inline:Zn,checkbox_input:Ce,reference:Jn,footnote_anchor:kt,footnote_reference:qe,text:Gn},t);function m(e){var n,t,o,l;if("html_block"===e.type||"html_inline"===e.type){const r=String(null!=(n=e.tag)?n:"").trim().toLowerCase()||x(e.content);if(r&&!u.value.has(r)&&M(null!=(t=e.content)?t:e.raw,r)){const n=String(null!=(l=null!=(o=e.content)?o:e.raw)?l:"");return{child:{type:"text",content:n,raw:n},component:Gn}}}return{child:e,component:h[e.type]}}return(n,t)=>(T(),E("p",Rt,[(T(!0),E(H,null,z(d.value,(n,t)=>(T(),E(H,{key:`${e.indexKey||"paragraph"}-${t}`},[i.value&&o(n)?(T(),E(H,{key:0},[te(R(l(n)),1)],64)):(T(),Z(ue(m(n).component),de({key:1,ref_for:!0},c(m(n).child,t)),null,16))],64))),128))]))}}),[["__scopeId","data-v-a07f942f"]]);Wt.install=e=>{e.component(Wt.__name,Wt)};const Pt=["aria-busy","aria-label","data-language"],jt=["textContent"],Ft=/* @__PURE__ */C({__name:"PreCodeNode",props:{node:{}},setup(e){const n=e,t=j(()=>{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=j(()=>`language-${t.value}`),l=j(()=>{const e=t.value;return e?`Code block: ${e}`:"Code block"});return(n,r)=>(T(),E("pre",{class:F([o.value]),"aria-busy":!0===e.node.loading,"aria-label":l.value,"data-language":t.value,"data-markstream-pre":"1",tabindex:"0"},[$("code",{translate:"no",textContent:R(e.node.code)},null,8,jt)],10,Pt))}});Ft.install=e=>{e.component(Ft.__name,Ft)};const Kt={class:"table-node-wrapper"},Dt=["aria-busy"],Vt={key:0},Ut=["aria-label","onPointerdown"],qt={key:0,class:"table-node__loading",role:"status","aria-live":"polite"},Xt=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"TableNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e,t=j(()=>{var e;return null!=(e=n.node.loading)&&e}),o=j(()=>{var e;return null!=(e=n.node.rows)?e:[]}),l=V(null),r=V([]);let i=null;const a=j(()=>r.value.map(e=>e>0?{width:`${e}px`}:void 0)),s=j(()=>r.value.length>0);function u(e){if(!i)return;e.preventDefault();const n=i.startWidth+i.nextStartWidth,t=Math.min(48,Math.floor(n/2)),o=Math.max(t,Math.min(n-t,Math.round(i.startWidth+e.clientX-i.startX))),l=[...i.widths];l[i.index]=o,l[i.index+1]=n-o,r.value=l}function d(){i&&(window.removeEventListener("pointermove",u),window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",d),i=null)}return U(()=>n.node.header.cells.length,()=>{d(),r.value=[]}),G(d),(c,h)=>(T(),E("div",Kt,[$("table",{ref_key:"tableRef",ref:l,class:F(["table-node",{"table-node--loading":t.value}]),"aria-busy":t.value},[s.value?(T(),E("colgroup",Vt,[(T(!0),E(H,null,z(e.node.header.cells,(e,n)=>(T(),E("col",{key:`col-${n}`,style:ne(a.value[n])},null,4))),128))])):q("",!0),$("thead",null,[$("tr",null,[(T(!0),E(H,null,z(e.node.header.cells,(t,o)=>(T(),E("th",{key:`header-${o}`,dir:"auto",class:F(["right"===t.align?"text-right":"center"===t.align?"text-center":"text-left"])},[I(A(Vr),{nodes:t.children,"index-key":`table-th-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,onCopy:h[0]||(h[0]=e=>c.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter"]),o<e.node.header.cells.length-1?(T(),E("button",{key:0,type:"button",class:"table-node__resize-handle","aria-label":`Resize columns ${o+1} and ${o+2}`,onPointerdown:e=>function(e,n){if(0!==n.button)return;const t=function(){var e;const n=null==(e=l.value)?void 0:e.querySelectorAll("thead th");return Array.from(null!=n?n:[],e=>Math.round(e.getBoundingClientRect().width))}(),o=t[e],a=t[e+1];o&&a&&(n.preventDefault(),i={index:e,startX:n.clientX,startWidth:o,nextStartWidth:a,widths:t},r.value=t,window.addEventListener("pointermove",u),window.addEventListener("pointerup",d),window.addEventListener("pointercancel",d))}(o,e)},null,40,Ut)):q("",!0)],2))),128))])]),$("tbody",null,[(T(!0),E(H,null,z(o.value,(e,t)=>(T(),E("tr",{key:`row-${t}`},[(T(!0),E(H,null,z(e.cells,(e,o)=>(T(),E("td",{key:`cell-${t}-${o}`,class:F(["right"===e.align?"text-right":"center"===e.align?"text-center":"text-left"]),dir:"auto"},[I(A(Vr),{nodes:e.children,"index-key":`table-td-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,onCopy:h[1]||(h[1]=e=>c.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter"])],2))),128))]))),128))])],10,Dt),I(J,{name:"table-node-fade"},{default:Q(()=>[t.value?(T(),E("div",qt,[ie(c.$slots,"loading",{isLoading:t.value},()=>[h[2]||(h[2]=$("span",{class:"table-node__spinner animate-spin","aria-hidden":"true"},null,-1)),h[3]||(h[3]=$("span",{class:"sr-only"},"Loading",-1))],!0)])):q("",!0)]),_:3})]))}}),[["__scopeId","data-v-7a6d3bf6"]]);Xt.install=e=>{e.component(Xt.__name,Xt)};const Gt={class:"hr-node"},Zt=/* @__PURE__ */Se({},[["render",function(e,n){return T(),E("hr",Gt)}],["__scopeId","data-v-39b2349c"]]);Zt.install=e=>{e.component(Zt.__name,Zt)};const Yt={class:"unknown-node"},Jt=/* @__PURE__ */C({__name:"FallbackComponent",props:{node:{}},setup:e=>(n,t)=>(T(),E("div",Yt,R(e.node.raw),1))}),Qt=/* @__PURE__ */Se(/* @__PURE__ */C({__name:"VmrContainerNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},customId:{}},setup(e){const n=e,t=j(()=>`vmr-container vmr-container-${n.node.name}`),o=Fe(n.customId),l=a({text:Gn,paragraph:Wt,heading:Ot,inline_code:ln,link:mt,image:In,strong:it,emphasis:wt,strikethrough:st,insert:pt,subscript:lt,superscript:nt,checkbox:Ce,checkbox_input:Ce,hardbreak:_t,math_inline:Zn,reference:Jn,list:Ct,math_block:Yn,table:Xt},o);return(o,r)=>(T(),E("div",de({class:t.value},e.node.attrs),[(T(!0),E(H,null,z(e.node.children,(t,o)=>{return T(),Z(ue((r=t.type,l[r]||Jt)),{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 r}),128))],16))}}),[["__scopeId","data-v-b0a43820"]]);Qt.install=e=>{e.component(Qt.__name,Qt)};const eo=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","BN","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],no=[[697,698,"ON"],[706,719,"ON"],[722,735,"ON"],[741,749,"ON"],[751,767,"ON"],[768,879,"NSM"],[884,885,"ON"],[894,894,"ON"],[900,901,"ON"],[903,903,"ON"],[1014,1014,"ON"],[1155,1161,"NSM"],[1418,1418,"ON"],[1421,1422,"ON"],[1423,1423,"ET"],[1424,1424,"R"],[1425,1469,"NSM"],[1470,1470,"R"],[1471,1471,"NSM"],[1472,1472,"R"],[1473,1474,"NSM"],[1475,1475,"R"],[1476,1477,"NSM"],[1478,1478,"R"],[1479,1479,"NSM"],[1480,1535,"R"],[1536,1541,"AN"],[1542,1543,"ON"],[1544,1544,"AL"],[1545,1546,"ET"],[1547,1547,"AL"],[1548,1548,"CS"],[1549,1549,"AL"],[1550,1551,"ON"],[1552,1562,"NSM"],[1563,1610,"AL"],[1611,1631,"NSM"],[1632,1641,"AN"],[1642,1642,"ET"],[1643,1644,"AN"],[1645,1647,"AL"],[1648,1648,"NSM"],[1649,1749,"AL"],[1750,1756,"NSM"],[1757,1757,"AN"],[1758,1758,"ON"],[1759,1764,"NSM"],[1765,1766,"AL"],[1767,1768,"NSM"],[1769,1769,"ON"],[1770,1773,"NSM"],[1774,1775,"AL"],[1776,1785,"EN"],[1786,1808,"AL"],[1809,1809,"NSM"],[1810,1839,"AL"],[1840,1866,"NSM"],[1867,1957,"AL"],[1958,1968,"NSM"],[1969,1983,"AL"],[1984,2026,"R"],[2027,2035,"NSM"],[2036,2037,"R"],[2038,2041,"ON"],[2042,2044,"R"],[2045,2045,"NSM"],[2046,2069,"R"],[2070,2073,"NSM"],[2074,2074,"R"],[2075,2083,"NSM"],[2084,2084,"R"],[2085,2087,"NSM"],[2088,2088,"R"],[2089,2093,"NSM"],[2094,2136,"R"],[2137,2139,"NSM"],[2140,2143,"R"],[2144,2191,"AL"],[2192,2193,"AN"],[2194,2198,"AL"],[2199,2207,"NSM"],[2208,2249,"AL"],[2250,2273,"NSM"],[2274,2274,"AN"],[2275,2306,"NSM"],[2362,2362,"NSM"],[2364,2364,"NSM"],[2369,2376,"NSM"],[2381,2381,"NSM"],[2385,2391,"NSM"],[2402,2403,"NSM"],[2433,2433,"NSM"],[2492,2492,"NSM"],[2497,2500,"NSM"],[2509,2509,"NSM"],[2530,2531,"NSM"],[2546,2547,"ET"],[2555,2555,"ET"],[2558,2558,"NSM"],[2561,2562,"NSM"],[2620,2620,"NSM"],[2625,2626,"NSM"],[2631,2632,"NSM"],[2635,2637,"NSM"],[2641,2641,"NSM"],[2672,2673,"NSM"],[2677,2677,"NSM"],[2689,2690,"NSM"],[2748,2748,"NSM"],[2753,2757,"NSM"],[2759,2760,"NSM"],[2765,2765,"NSM"],[2786,2787,"NSM"],[2801,2801,"ET"],[2810,2815,"NSM"],[2817,2817,"NSM"],[2876,2876,"NSM"],[2879,2879,"NSM"],[2881,2884,"NSM"],[2893,2893,"NSM"],[2901,2902,"NSM"],[2914,2915,"NSM"],[2946,2946,"NSM"],[3008,3008,"NSM"],[3021,3021,"NSM"],[3059,3064,"ON"],[3065,3065,"ET"],[3066,3066,"ON"],[3072,3072,"NSM"],[3076,3076,"NSM"],[3132,3132,"NSM"],[3134,3136,"NSM"],[3142,3144,"NSM"],[3146,3149,"NSM"],[3157,3158,"NSM"],[3170,3171,"NSM"],[3192,3198,"ON"],[3201,3201,"NSM"],[3260,3260,"NSM"],[3276,3277,"NSM"],[3298,3299,"NSM"],[3328,3329,"NSM"],[3387,3388,"NSM"],[3393,3396,"NSM"],[3405,3405,"NSM"],[3426,3427,"NSM"],[3457,3457,"NSM"],[3530,3530,"NSM"],[3538,3540,"NSM"],[3542,3542,"NSM"],[3633,3633,"NSM"],[3636,3642,"NSM"],[3647,3647,"ET"],[3655,3662,"NSM"],[3761,3761,"NSM"],[3764,3772,"NSM"],[3784,3790,"NSM"],[3864,3865,"NSM"],[3893,3893,"NSM"],[3895,3895,"NSM"],[3897,3897,"NSM"],[3898,3901,"ON"],[3953,3966,"NSM"],[3968,3972,"NSM"],[3974,3975,"NSM"],[3981,3991,"NSM"],[3993,4028,"NSM"],[4038,4038,"NSM"],[4141,4144,"NSM"],[4146,4151,"NSM"],[4153,4154,"NSM"],[4157,4158,"NSM"],[4184,4185,"NSM"],[4190,4192,"NSM"],[4209,4212,"NSM"],[4226,4226,"NSM"],[4229,4230,"NSM"],[4237,4237,"NSM"],[4253,4253,"NSM"],[4957,4959,"NSM"],[5008,5017,"ON"],[5120,5120,"ON"],[5760,5760,"WS"],[5787,5788,"ON"],[5906,5908,"NSM"],[5938,5939,"NSM"],[5970,5971,"NSM"],[6002,6003,"NSM"],[6068,6069,"NSM"],[6071,6077,"NSM"],[6086,6086,"NSM"],[6089,6099,"NSM"],[6107,6107,"ET"],[6109,6109,"NSM"],[6128,6137,"ON"],[6144,6154,"ON"],[6155,6157,"NSM"],[6158,6158,"BN"],[6159,6159,"NSM"],[6277,6278,"NSM"],[6313,6313,"NSM"],[6432,6434,"NSM"],[6439,6440,"NSM"],[6450,6450,"NSM"],[6457,6459,"NSM"],[6464,6464,"ON"],[6468,6469,"ON"],[6622,6655,"ON"],[6679,6680,"NSM"],[6683,6683,"NSM"],[6742,6742,"NSM"],[6744,6750,"NSM"],[6752,6752,"NSM"],[6754,6754,"NSM"],[6757,6764,"NSM"],[6771,6780,"NSM"],[6783,6783,"NSM"],[6832,6877,"NSM"],[6880,6891,"NSM"],[6912,6915,"NSM"],[6964,6964,"NSM"],[6966,6970,"NSM"],[6972,6972,"NSM"],[6978,6978,"NSM"],[7019,7027,"NSM"],[7040,7041,"NSM"],[7074,7077,"NSM"],[7080,7081,"NSM"],[7083,7085,"NSM"],[7142,7142,"NSM"],[7144,7145,"NSM"],[7149,7149,"NSM"],[7151,7153,"NSM"],[7212,7219,"NSM"],[7222,7223,"NSM"],[7376,7378,"NSM"],[7380,7392,"NSM"],[7394,7400,"NSM"],[7405,7405,"NSM"],[7412,7412,"NSM"],[7416,7417,"NSM"],[7616,7679,"NSM"],[8125,8125,"ON"],[8127,8129,"ON"],[8141,8143,"ON"],[8157,8159,"ON"],[8173,8175,"ON"],[8189,8190,"ON"],[8192,8202,"WS"],[8203,8205,"BN"],[8207,8207,"R"],[8208,8231,"ON"],[8232,8232,"WS"],[8233,8233,"B"],[8234,8238,"BN"],[8239,8239,"CS"],[8240,8244,"ET"],[8245,8259,"ON"],[8260,8260,"CS"],[8261,8286,"ON"],[8287,8287,"WS"],[8288,8303,"BN"],[8304,8304,"EN"],[8308,8313,"EN"],[8314,8315,"ES"],[8316,8318,"ON"],[8320,8329,"EN"],[8330,8331,"ES"],[8332,8334,"ON"],[8352,8399,"ET"],[8400,8432,"NSM"],[8448,8449,"ON"],[8451,8454,"ON"],[8456,8457,"ON"],[8468,8468,"ON"],[8470,8472,"ON"],[8478,8483,"ON"],[8485,8485,"ON"],[8487,8487,"ON"],[8489,8489,"ON"],[8494,8494,"ET"],[8506,8507,"ON"],[8512,8516,"ON"],[8522,8525,"ON"],[8528,8543,"ON"],[8585,8587,"ON"],[8592,8721,"ON"],[8722,8722,"ES"],[8723,8723,"ET"],[8724,9013,"ON"],[9083,9108,"ON"],[9110,9257,"ON"],[9280,9290,"ON"],[9312,9351,"ON"],[9352,9371,"EN"],[9450,9899,"ON"],[9901,10239,"ON"],[10496,11123,"ON"],[11126,11263,"ON"],[11493,11498,"ON"],[11503,11505,"NSM"],[11513,11519,"ON"],[11647,11647,"NSM"],[11744,11775,"NSM"],[11776,11869,"ON"],[11904,11929,"ON"],[11931,12019,"ON"],[12032,12245,"ON"],[12272,12287,"ON"],[12288,12288,"WS"],[12289,12292,"ON"],[12296,12320,"ON"],[12330,12333,"NSM"],[12336,12336,"ON"],[12342,12343,"ON"],[12349,12351,"ON"],[12441,12442,"NSM"],[12443,12444,"ON"],[12448,12448,"ON"],[12539,12539,"ON"],[12736,12773,"ON"],[12783,12783,"ON"],[12829,12830,"ON"],[12880,12895,"ON"],[12924,12926,"ON"],[12977,12991,"ON"],[13004,13007,"ON"],[13175,13178,"ON"],[13278,13279,"ON"],[13311,13311,"ON"],[19904,19967,"ON"],[42128,42182,"ON"],[42509,42511,"ON"],[42607,42610,"NSM"],[42611,42611,"ON"],[42612,42621,"NSM"],[42622,42623,"ON"],[42654,42655,"NSM"],[42736,42737,"NSM"],[42752,42785,"ON"],[42888,42888,"ON"],[43010,43010,"NSM"],[43014,43014,"NSM"],[43019,43019,"NSM"],[43045,43046,"NSM"],[43048,43051,"ON"],[43052,43052,"NSM"],[43064,43065,"ET"],[43124,43127,"ON"],[43204,43205,"NSM"],[43232,43249,"NSM"],[43263,43263,"NSM"],[43302,43309,"NSM"],[43335,43345,"NSM"],[43392,43394,"NSM"],[43443,43443,"NSM"],[43446,43449,"NSM"],[43452,43453,"NSM"],[43493,43493,"NSM"],[43561,43566,"NSM"],[43569,43570,"NSM"],[43573,43574,"NSM"],[43587,43587,"NSM"],[43596,43596,"NSM"],[43644,43644,"NSM"],[43696,43696,"NSM"],[43698,43700,"NSM"],[43703,43704,"NSM"],[43710,43711,"NSM"],[43713,43713,"NSM"],[43756,43757,"NSM"],[43766,43766,"NSM"],[43882,43883,"ON"],[44005,44005,"NSM"],[44008,44008,"NSM"],[44013,44013,"NSM"],[64285,64285,"R"],[64286,64286,"NSM"],[64287,64296,"R"],[64297,64297,"ES"],[64298,64335,"R"],[64336,64450,"AL"],[64451,64466,"ON"],[64467,64829,"AL"],[64830,64847,"ON"],[64848,64911,"AL"],[64912,64913,"ON"],[64914,64967,"AL"],[64968,64975,"ON"],[64976,65007,"BN"],[65008,65020,"AL"],[65021,65023,"ON"],[65024,65039,"NSM"],[65040,65049,"ON"],[65056,65071,"NSM"],[65072,65103,"ON"],[65104,65104,"CS"],[65105,65105,"ON"],[65106,65106,"CS"],[65108,65108,"ON"],[65109,65109,"CS"],[65110,65118,"ON"],[65119,65119,"ET"],[65120,65121,"ON"],[65122,65123,"ES"],[65124,65126,"ON"],[65128,65128,"ON"],[65129,65130,"ET"],[65131,65131,"ON"],[65136,65278,"AL"],[65279,65279,"BN"],[65281,65282,"ON"],[65283,65285,"ET"],[65286,65290,"ON"],[65291,65291,"ES"],[65292,65292,"CS"],[65293,65293,"ES"],[65294,65295,"CS"],[65296,65305,"EN"],[65306,65306,"CS"],[65307,65312,"ON"],[65339,65344,"ON"],[65371,65381,"ON"],[65504,65505,"ET"],[65506,65508,"ON"],[65509,65510,"ET"],[65512,65518,"ON"],[65520,65528,"BN"],[65529,65533,"ON"],[65534,65535,"BN"],[65793,65793,"ON"],[65856,65932,"ON"],[65936,65948,"ON"],[65952,65952,"ON"],[66045,66045,"NSM"],[66272,66272,"NSM"],[66273,66299,"EN"],[66422,66426,"NSM"],[67584,67870,"R"],[67871,67871,"ON"],[67872,68096,"R"],[68097,68099,"NSM"],[68100,68100,"R"],[68101,68102,"NSM"],[68103,68107,"R"],[68108,68111,"NSM"],[68112,68151,"R"],[68152,68154,"NSM"],[68155,68158,"R"],[68159,68159,"NSM"],[68160,68324,"R"],[68325,68326,"NSM"],[68327,68408,"R"],[68409,68415,"ON"],[68416,68863,"R"],[68864,68899,"AL"],[68900,68903,"NSM"],[68904,68911,"AL"],[68912,68921,"AN"],[68922,68927,"AL"],[68928,68937,"AN"],[68938,68968,"R"],[68969,68973,"NSM"],[68974,68974,"ON"],[68975,69215,"R"],[69216,69246,"AN"],[69247,69290,"R"],[69291,69292,"NSM"],[69293,69311,"R"],[69312,69327,"AL"],[69328,69336,"ON"],[69337,69369,"AL"],[69370,69375,"NSM"],[69376,69423,"R"],[69424,69445,"AL"],[69446,69456,"NSM"],[69457,69487,"AL"],[69488,69505,"R"],[69506,69509,"NSM"],[69510,69631,"R"],[69633,69633,"NSM"],[69688,69702,"NSM"],[69714,69733,"ON"],[69744,69744,"NSM"],[69747,69748,"NSM"],[69759,69761,"NSM"],[69811,69814,"NSM"],[69817,69818,"NSM"],[69826,69826,"NSM"],[69888,69890,"NSM"],[69927,69931,"NSM"],[69933,69940,"NSM"],[70003,70003,"NSM"],[70016,70017,"NSM"],[70070,70078,"NSM"],[70089,70092,"NSM"],[70095,70095,"NSM"],[70191,70193,"NSM"],[70196,70196,"NSM"],[70198,70199,"NSM"],[70206,70206,"NSM"],[70209,70209,"NSM"],[70367,70367,"NSM"],[70371,70378,"NSM"],[70400,70401,"NSM"],[70459,70460,"NSM"],[70464,70464,"NSM"],[70502,70508,"NSM"],[70512,70516,"NSM"],[70587,70592,"NSM"],[70606,70606,"NSM"],[70608,70608,"NSM"],[70610,70610,"NSM"],[70625,70626,"NSM"],[70712,70719,"NSM"],[70722,70724,"NSM"],[70726,70726,"NSM"],[70750,70750,"NSM"],[70835,70840,"NSM"],[70842,70842,"NSM"],[70847,70848,"NSM"],[70850,70851,"NSM"],[71090,71093,"NSM"],[71100,71101,"NSM"],[71103,71104,"NSM"],[71132,71133,"NSM"],[71219,71226,"NSM"],[71229,71229,"NSM"],[71231,71232,"NSM"],[71264,71276,"ON"],[71339,71339,"NSM"],[71341,71341,"NSM"],[71344,71349,"NSM"],[71351,71351,"NSM"],[71453,71453,"NSM"],[71455,71455,"NSM"],[71458,71461,"NSM"],[71463,71467,"NSM"],[71727,71735,"NSM"],[71737,71738,"NSM"],[71995,71996,"NSM"],[71998,71998,"NSM"],[72003,72003,"NSM"],[72148,72151,"NSM"],[72154,72155,"NSM"],[72160,72160,"NSM"],[72193,72198,"NSM"],[72201,72202,"NSM"],[72243,72248,"NSM"],[72251,72254,"NSM"],[72263,72263,"NSM"],[72273,72278,"NSM"],[72281,72283,"NSM"],[72330,72342,"NSM"],[72344,72345,"NSM"],[72544,72544,"NSM"],[72546,72548,"NSM"],[72550,72550,"NSM"],[72752,72758,"NSM"],[72760,72765,"NSM"],[72850,72871,"NSM"],[72874,72880,"NSM"],[72882,72883,"NSM"],[72885,72886,"NSM"],[73009,73014,"NSM"],[73018,73018,"NSM"],[73020,73021,"NSM"],[73023,73029,"NSM"],[73031,73031,"NSM"],[73104,73105,"NSM"],[73109,73109,"NSM"],[73111,73111,"NSM"],[73459,73460,"NSM"],[73472,73473,"NSM"],[73526,73530,"NSM"],[73536,73536,"NSM"],[73538,73538,"NSM"],[73562,73562,"NSM"],[73685,73692,"ON"],[73693,73696,"ET"],[73697,73713,"ON"],[78912,78912,"NSM"],[78919,78933,"NSM"],[90398,90409,"NSM"],[90413,90415,"NSM"],[92912,92916,"NSM"],[92976,92982,"NSM"],[94031,94031,"NSM"],[94095,94098,"NSM"],[94178,94178,"ON"],[94180,94180,"NSM"],[113821,113822,"NSM"],[113824,113827,"BN"],[117760,117973,"ON"],[118e3,118009,"EN"],[118010,118012,"ON"],[118016,118451,"ON"],[118458,118480,"ON"],[118496,118512,"ON"],[118528,118573,"NSM"],[118576,118598,"NSM"],[119143,119145,"NSM"],[119155,119162,"BN"],[119163,119170,"NSM"],[119173,119179,"NSM"],[119210,119213,"NSM"],[119273,119274,"ON"],[119296,119361,"ON"],[119362,119364,"NSM"],[119365,119365,"ON"],[119552,119638,"ON"],[120513,120513,"ON"],[120539,120539,"ON"],[120571,120571,"ON"],[120597,120597,"ON"],[120629,120629,"ON"],[120655,120655,"ON"],[120687,120687,"ON"],[120713,120713,"ON"],[120745,120745,"ON"],[120771,120771,"ON"],[120782,120831,"EN"],[121344,121398,"NSM"],[121403,121452,"NSM"],[121461,121461,"NSM"],[121476,121476,"NSM"],[121499,121503,"NSM"],[121505,121519,"NSM"],[122880,122886,"NSM"],[122888,122904,"NSM"],[122907,122913,"NSM"],[122915,122916,"NSM"],[122918,122922,"NSM"],[123023,123023,"NSM"],[123184,123190,"NSM"],[123566,123566,"NSM"],[123628,123631,"NSM"],[123647,123647,"ET"],[124140,124143,"NSM"],[124398,124399,"NSM"],[124643,124643,"NSM"],[124646,124646,"NSM"],[124654,124655,"NSM"],[124661,124661,"NSM"],[124928,125135,"R"],[125136,125142,"NSM"],[125143,125251,"R"],[125252,125258,"NSM"],[125259,126063,"R"],[126064,126143,"AL"],[126144,126207,"R"],[126208,126287,"AL"],[126288,126463,"R"],[126464,126703,"AL"],[126704,126705,"ON"],[126706,126719,"AL"],[126720,126975,"R"],[126976,127019,"ON"],[127024,127123,"ON"],[127136,127150,"ON"],[127153,127167,"ON"],[127169,127183,"ON"],[127185,127221,"ON"],[127232,127242,"EN"],[127243,127247,"ON"],[127279,127279,"ON"],[127338,127343,"ON"],[127405,127405,"ON"],[127584,127589,"ON"],[127744,128728,"ON"],[128732,128748,"ON"],[128752,128764,"ON"],[128768,128985,"ON"],[128992,129003,"ON"],[129008,129008,"ON"],[129024,129035,"ON"],[129040,129095,"ON"],[129104,129113,"ON"],[129120,129159,"ON"],[129168,129197,"ON"],[129200,129211,"ON"],[129216,129217,"ON"],[129232,129240,"ON"],[129280,129623,"ON"],[129632,129645,"ON"],[129648,129660,"ON"],[129664,129674,"ON"],[129678,129734,"ON"],[129736,129736,"ON"],[129741,129756,"ON"],[129759,129770,"ON"],[129775,129784,"ON"],[129792,129938,"ON"],[129940,130031,"ON"],[130032,130041,"EN"],[130042,130042,"ON"],[131070,131071,"BN"],[196606,196607,"BN"],[262142,262143,"BN"],[327678,327679,"BN"],[393214,393215,"BN"],[458750,458751,"BN"],[524286,524287,"BN"],[589822,589823,"BN"],[655358,655359,"BN"],[720894,720895,"BN"],[786430,786431,"BN"],[851966,851967,"BN"],[917502,917759,"BN"],[917760,917999,"NSM"],[918e3,921599,"BN"],[983038,983039,"BN"],[1048574,1048575,"BN"],[1114110,1114111,"BN"]];function to(e){if(e<=255)return eo[e];let n=0,t=no.length-1;for(;n<=t;){const o=n+t>>1,l=no[o];if(e<l[0])t=o-1;else{if(!(e>l[1]))return l[2];n=o+1}}return"L"}const oo=/[ \t\n\r\f]+/g,lo=/[\t\n\r\f]| {2,}|^ | $/;let ro=null;const io=new RegExp("\\p{Script=Arabic}","u"),ao=new RegExp("\\p{M}","u"),so=new RegExp("\\p{Nd}","u");function uo(e){return io.test(e)}function co(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=44032&&e<=55215||e>=65280&&e<=65519}function ho(e){for(let n=0;n<e.length;n++){const t=e.charCodeAt(n);if(!(t<12288)){if(t>=55296&&t<=56319&&n+1<e.length){const o=e.charCodeAt(n+1);if(o>=56320&&o<=57343){if(co(o-56320+(t-55296<<10)+65536))return!0;n++;continue}}if(co(t))return!0}}return!1}const mo=/* @__PURE__ */new Set([" "," ","","\ufeff"]);function fo(e){return ho(e)}function po(e){return!function(e){const n=Oo(e);return null!==n&&(vo.has(n)||wo.has(n))}(e)&&!function(e){const n=Oo(e);return null!==n&&mo.has(n)}(e)}const vo=/* @__PURE__ */new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),go=/* @__PURE__ */new Set(['"',"(","[","{","“","‘","«","‹","(","〔","〈","《","「","『","【","〖","〘","〚"]),yo=/* @__PURE__ */new Set(["'","’"]),wo=/* @__PURE__ */new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),No=/* @__PURE__ */new Set([":",".","،","؛"]),ko=/* @__PURE__ */new Set(["၏"]),xo=/* @__PURE__ */new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function Mo(e){if(_o(e))return!0;let n=!1;for(const t of e)if(wo.has(t))n=!0;else if(!n||!ao.test(t))return!1;return n}function bo(e){for(const n of e)if(!vo.has(n)&&!wo.has(n))return!1;return e.length>0}function So(e){if(_o(e))return!0;for(const n of e)if(!go.has(n)&&!yo.has(n)&&!ao.test(n))return!1;return e.length>0}function _o(e){let n=!1;for(const t of e)if("\\"!==t&&!ao.test(t)){if(!(go.has(t)||wo.has(t)||yo.has(t)))return!1;n=!0}return n}function Bo(e,n){const t=n-1;if(t<=0)return Math.max(t,0);const o=e.charCodeAt(t);if(o<56320||o>57343)return t;const l=t-1;if(l<0)return t;const r=e.charCodeAt(l);return r>=55296&&r<=56319?l:t}function Oo(e){if(0===e.length)return null;const n=Bo(e,e.length);return e.slice(n)}function Lo(e){const n=Array.from(e);let t=n.length;for(;t>0;){const e=n[t-1];if(ao.test(e))t--;else{if(!go.has(e)&&!yo.has(e))break;t--}}return t<=0||t===n.length?null:{head:n.slice(0,t).join(""),tail:n.slice(t).join("")}}function Co(e,n,t){return"text"!==t||n||1!==e.length||"-"===e||"—"===e?null:e}function To(e,n,t,o){const l=n[o],r=e[o];if(null==l)return r;const i=t[o];if(r.length===i)return r;const a=l.repeat(i);return e[o]=a,a}function Eo(e,n){return e&&null!==n&&No.has(n)}function Io(e){const n=Oo(e);return null!==n&&ko.has(n)}function Ao(e){if(e.length<2||" "!==e[0])return null;const n=e.slice(1);return new RegExp("^\\p{M}+$","u").test(n)?{space:" ",marks:n}:null}function $o(e){let n=e.length;for(;n>0;){const t=Bo(e,n),o=e.slice(t,n);if(xo.has(o))return!0;if(!wo.has(o))return!1;n=t}return!1}function Ho(e,n){if(n.preserveOrdinarySpaces||n.preserveHardBreaks){if(" "===e)return"preserved-space";if("\t"===e)return"tab";if(n.preserveHardBreaks&&"\n"===e)return"hard-break"}return" "===e?"space":" "===e||" "===e||""===e||"\ufeff"===e?"glue":""===e?"zero-width-break":""===e?"soft-hyphen":"text"}const zo=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function Ro(e){return 1===e.length?e[0]:e.join("")}function Wo(e,n){const t=[];for(let o=e.length-1;o>=0;o--)t.push(e[o]);return t.push(n),Ro(t)}function Po(e,n,t,o){if(!zo.test(e))return[{text:e,isWordLike:n,kind:"text",start:t}];const l=[];let r=null,i=[],a=t,s=!1,u=0;for(const d of e){const e=Ho(d,o),c="text"===e&&n;null===r||e!==r||c!==s?(null!==r&&l.push({text:Ro(i),isWordLike:s,kind:r,start:a}),r=e,i=[d],a=t+u,s=c,u+=d.length):(i.push(d),u+=d.length)}return null!==r&&l.push({text:Ro(i),isWordLike:s,kind:r,start:a}),l}function jo(e){return"space"===e||"preserved-space"===e||"zero-width-break"===e||"hard-break"===e}const Fo=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function Ko(e,n){const t=e.texts[n];return!!t.startsWith("www.")||Fo.test(t)&&n+1<e.len&&"text"===e.kinds[n+1]&&"//"===e.texts[n+1]}function Do(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}const Vo=/* @__PURE__ */new Set([":","-","/","×",",",".","+","–","—"]),Uo=/^[A-Za-z0-9_]+[,:;]*$/,qo=/[,:;]+$/;function Xo(e){for(const n of e)if(so.test(n))return!0;return!1}function Go(e){if(0===e.length)return!1;for(const n of e)if(!so.test(n)&&!Vo.has(n))return!1;return!0}function Zo(e,n,t){var o,l,r;const i=(null===ro&&(ro=new Intl.Segmenter(void 0,{granularity:"word"})),ro);let a=0;const s=[],u=[],d=[],c=[],h=[],m=[],f=[],p=[],v=[],g=[],y=[],w=[];for(const b of i.segment(e))for(const e of Po(b.segment,null!=(o=b.isWordLike)&&o,b.index,t)){let t=function(){null!==m[b]&&(u[b]=[To(s,m,f,b)],m[b]=null),u[b].push(e.text),d[b]=d[b]||e.isWordLike,p[b]=p[b]||i,v[b]=v[b]||N,g[b]=x,y[b]=M,w[b]=Eo(v[b],k)};const o="text"===e.kind,r=Co(e.text,e.isWordLike,e.kind),i=ho(e.text),N=uo(e.text),k=Oo(e.text),x=$o(e.text),M=Io(e.text),b=a-1;n.carryCJKAfterClosingQuote&&o&&a>0&&"text"===c[b]&&i&&p[b]&&g[b]||o&&a>0&&"text"===c[b]&&bo(e.text)&&p[b]||o&&a>0&&"text"===c[b]&&y[b]?t():o&&a>0&&"text"===c[b]&&e.isWordLike&&N&&w[b]?(t(),d[b]=!0):null!==r&&a>0&&"text"===c[b]&&m[b]===r?f[b]=(null!=(l=f[b])?l:1)+1:o&&!e.isWordLike&&a>0&&"text"===c[b]&&(Mo(e.text)||"-"===e.text&&d[b])?t():(s[a]=e.text,u[a]=[e.text],d[a]=e.isWordLike,c[a]=e.kind,h[a]=e.start,m[a]=r,f[a]=null===r?0:1,p[a]=i,v[a]=N,g[a]=x,y[a]=M,w[a]=Eo(N,k),a++)}for(let b=0;b<a;b++)null===m[b]?s[b]=Ro(u[b]):s[b]=To(s,m,f,b);for(let b=1;b<a;b++)"text"===c[b]&&!d[b]&&_o(s[b])&&"text"===c[b-1]&&(s[b-1]+=s[b],d[b-1]=d[b-1]||d[b],s[b]="");const N=Array.from({length:a},()=>null);let k=-1;for(let b=a-1;b>=0;b--){const e=s[b];if(0!==e.length){if("text"===c[b]&&!d[b]&&So(e)&&k>=0&&"text"===c[k]){const n=null!=(r=N[k])?r:[];n.push(e),N[k]=n,h[k]=h[b],s[b]="";continue}k=b}}for(let b=0;b<a;b++){const e=N[b];null!=e&&(s[b]=Wo(e,s[b]))}let x=0;for(let b=0;b<a;b++){const e=s[b];0!==e.length&&(x!==b&&(s[x]=e,d[x]=d[b],c[x]=c[b],h[x]=h[b]),x++)}s.length=x,d.length=x,c.length=x,h.length=x;const M=function(e){const n=e.texts.slice(),t=e.isWordLike.slice(),o=e.kinds.slice(),l=e.starts.slice();for(let r=0;r<n.length-1;r++){if("text"!==o[r]||"text"!==o[r+1])continue;if(!ho(n[r])||!ho(n[r+1]))continue;const e=Lo(n[r]);null!==e&&(n[r]=e.head,n[r+1]=e.tail+n[r+1],l[r+1]=l[r]+e.head.length)}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];for(let r=0;r<e.len;r++){const i=e.texts[r],a=e.kinds[r],s=e.isWordLike[r];if("text"===a&&s&&Uo.test(i)){const a=[i];let s=qo.test(i),u=r+1;for(;s&&u<e.len&&"text"===e.kinds[u]&&e.isWordLike[u]&&Uo.test(e.texts[u]);){const n=e.texts[u];a.push(n),s=qo.test(n),u++}n.push(Ro(a)),t.push(!0),o.push("text"),l.push(e.starts[r]),r=u-1;continue}n.push(i),t.push(s),o.push(a),l.push(e.starts[r])}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];for(let r=0;r<e.len;r++){const i=e.texts[r];if("text"===e.kinds[r]&&i.includes("-")){const a=i.split("-");let s=a.length>1;for(let e=0;e<a.length;e++){const n=a[e];if(!s)break;0!==n.length&&Xo(n)&&Go(n)||(s=!1)}if(s){let i=0;for(let s=0;s<a.length;s++){const u=a[s],d=s<a.length-1?`${u}-`:u;n.push(d),t.push(!0),o.push("text"),l.push(e.starts[r]+i),i+=d.length}continue}}n.push(i),t.push(e.isWordLike[r]),o.push(e.kinds[r]),l.push(e.starts[r])}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];for(let r=0;r<e.len;r++){const i=e.texts[r],a=e.kinds[r];if("text"===a&&Go(i)&&Xo(i)){const a=[i];let s=r+1;for(;s<e.len&&"text"===e.kinds[s]&&Go(e.texts[s]);)a.push(e.texts[s]),s++;n.push(Ro(a)),t.push(!0),o.push("text"),l.push(e.starts[r]),r=s-1;continue}n.push(i),t.push(e.isWordLike[r]),o.push(a),l.push(e.starts[r])}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];for(let r=0;r<e.len;r++){const i=e.texts[r];if(n.push(i),t.push(e.isWordLike[r]),o.push(e.kinds[r]),l.push(e.starts[r]),!Do(i))continue;const a=r+1;if(a>=e.len||jo(e.kinds[a]))continue;const s=[],u=e.starts[a];let d=a;for(;d<e.len&&!jo(e.kinds[d]);)s.push(e.texts[d]),d++;s.length>0&&(n.push(Ro(s)),t.push(!0),o.push("text"),l.push(u),r=d-1)}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=e.texts.slice(),t=e.isWordLike.slice(),o=e.kinds.slice(),l=e.starts.slice();for(let i=0;i<e.len;i++){if("text"!==o[i]||!Ko(e,i))continue;const l=[n[i]];let r=i+1;for(;r<e.len&&!jo(o[r]);){l.push(n[r]),t[i]=!0;const e=n[r].includes("?");if(o[r]="text",n[r]="",r++,e)break}n[i]=Ro(l)}let r=0;for(let i=0;i<n.length;i++){const e=n[i];0!==e.length&&(r!==i&&(n[r]=e,t[r]=t[i],o[r]=o[i],l[r]=l[i]),r++)}return n.length=r,t.length=r,o.length=r,l.length=r,{len:r,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];let r=0;for(;r<e.len;){const i=[e.texts[r]];let a=e.isWordLike[r],s=e.kinds[r],u=e.starts[r];if("glue"===s){const d=[i[0]],c=u;for(r++;r<e.len&&"glue"===e.kinds[r];)d.push(e.texts[r]),r++;const h=Ro(d);if(!(r<e.len&&"text"===e.kinds[r])){n.push(h),t.push(!1),o.push("glue"),l.push(c);continue}i[0]=h,i.push(e.texts[r]),a=e.isWordLike[r],s="text",u=c,r++}else r++;if("text"===s)for(;r<e.len&&"glue"===e.kinds[r];){const n=[];for(;r<e.len&&"glue"===e.kinds[r];)n.push(e.texts[r]),r++;const t=Ro(n);r<e.len&&"text"===e.kinds[r]?(i.push(t,e.texts[r]),a=a||e.isWordLike[r],r++):i.push(t)}n.push(Ro(i)),t.push(a),o.push(s),l.push(u)}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}({len:x,texts:s,isWordLike:d,kinds:c,starts:h})))))));for(let b=0;b<M.len-1;b++){const e=Ao(M.texts[b]);null!==e&&("space"!==M.kinds[b]&&"preserved-space"!==M.kinds[b]||"text"!==M.kinds[b+1]||!uo(M.texts[b+1])||(M.texts[b]=e.space,M.isWordLike[b]=!1,M.kinds[b]="preserved-space"===M.kinds[b]?"preserved-space":"space",M.texts[b+1]=e.marks+M.texts[b+1],M.starts[b+1]=M.starts[b]+e.space.length))}return M}function Yo(e,n){if(0===e.len)return[];if(!n.preserveHardBreaks)return[{startSegmentIndex:0,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}];const t=[];let o=0;for(let l=0;l<e.len;l++)"hard-break"===e.kinds[l]&&(t.push({startSegmentIndex:o,endSegmentIndex:l,consumedEndSegmentIndex:l+1}),o=l+1);return o<e.len&&t.push({startSegmentIndex:o,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}),t}let Jo=null;const Qo=/* @__PURE__ */new Map;let el=null;const nl=new RegExp("\\p{Emoji_Presentation}","u"),tl=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;let ol=null;const ll=/* @__PURE__ */new Map;function rl(){if(null!==Jo)return Jo;if("undefined"!=typeof OffscreenCanvas)return Jo=new OffscreenCanvas(1,1).getContext("2d"),Jo;if("undefined"!=typeof document)return Jo=document.createElement("canvas").getContext("2d"),Jo;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function il(e,n){let t=n.get(e);return void 0===t&&(t={width:rl().measureText(e).width,containsCJK:ho(e)},n.set(e,t)),t}function al(){if(null!==el)return el;if("undefined"==typeof navigator)return el={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},el;const e=navigator.userAgent,n="Apple Computer, Inc."===navigator.vendor&&e.includes("Safari/")&&!e.includes("Chrome/")&&!e.includes("Chromium/")&&!e.includes("CriOS/")&&!e.includes("FxiOS/")&&!e.includes("EdgiOS/"),t=e.includes("Chrome/")||e.includes("Chromium/")||e.includes("CriOS/")||e.includes("Edg/");return el={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:t,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},el}function sl(){return null===ol&&(ol=new Intl.Segmenter(void 0,{granularity:"grapheme"})),ol}function ul(e){return nl.test(e)||e.includes("️")}function dl(e,n,t){return 0===t?n.width:n.width-function(e,n){return void 0===n.emojiCount&&(n.emojiCount=function(e){let n=0;const t=sl();for(const o of t.segment(e))ul(o.segment)&&n++;return n}(e)),n.emojiCount}(e,n)*t}function cl(e,n){for(;n<e.widths.length;){const t=e.kinds[n];if("space"!==t&&"zero-width-break"!==t&&"soft-hyphen"!==t)break;n++}return n}function hl(e,n){if(n<=0)return 0;const t=e%n;return Math.abs(t)<=1e-6?n:n-t}function ml(e,n,t){const{widths:o,kinds:l,breakableFitAdvances:r}=e;if(0===o.length)return 0;const i=n+al().lineFitEpsilon;let a=0,s=0,u=!1,d=0,c=0,h=-1,m=0;function f(e=d,n=c,t=s){a++,s=0,u=!1,h=-1,m=0}function p(e,n){u=!0,d=e+1,c=0,s=n}function v(e,n,t){u=!0,d=e,c=n+1,s=t}function g(e,n){u?(s+=n,d=e+1,c=0):p(e,n)}function y(e,n){const t=r[e];for(let o=n;o<t.length;o++){const n=t[o];u?s+n>i?(f(),v(e,o,n)):(s+=n,d=e,c=o+1):v(e,o,n)}u&&d===e&&c===t.length&&(d=e+1,c=0)}let w=0;for(;w<o.length&&(u||(w=cl(e,w),!(w>=o.length)));){const e=o[w],t=l[w],a="space"===t||"preserved-space"===t||"tab"===t||"zero-width-break"===t||"soft-hyphen"===t;if(u)if(s+e>i){if(a){g(w,e),f(w+1,0,s-e),w++;continue}if(h>=0){if(d>h||d===h&&c>0){f();continue}f(h,0,m);continue}if(e>n&&null!==r[w]){f(),y(w,0),w++;continue}f()}else g(w,e),a&&(h=w+1,m=s-e),w++;else e>n&&null!==r[w]?y(w,0):p(w,e),a&&(h=w+1,m=s-e),w++}return u&&f(),a}let fl=null;function pl(e,n){const t=[];let o=[],l=0,r=!1,i=!1,a=!1;function s(){0!==o.length&&(t.push({text:1===o.length?o[0]:o.join(""),start:l}),o=[],r=!1,i=!1,a=!1)}function u(e,n,t){o=[e],l=n,r=t,i=$o(e),a=go.has(e)}function d(e,n){o.push(e),r=r||n;const t=$o(e);i=1===e.length&&wo.has(e)&&i||t,a=!1}for(const c of(null===fl&&(fl=new Intl.Segmenter(void 0,{granularity:"grapheme"})),fl).segment(e)){const e=c.segment,t=ho(e);0!==o.length?a||vo.has(e)||wo.has(e)||n.carryCJKAfterClosingQuote&&t&&i?d(e,t):r||t?(s(),u(e,c.index,t)):d(e,t):u(e,c.index,t)}return s(),t}function vl(e){if(e.length<=1)return e;const n=[];let t=[e[0].text],o=e[0].start,l=ho(e[0].text),r=po(e[0].text);function i(){n.push({text:1===t.length?t[0]:t.join(""),start:o})}for(let a=1;a<e.length;a++){const n=e[a],s=ho(n.text),u=po(n.text);l&&r?(t.push(n.text),l=l||s,r=u):(i(),t=[n.text],o=n.start,l=s,r=u)}return i(),n}function gl(e,n,t,o){const l=al(),{cache:r,emojiCorrection:i}=function(e,n){rl().font=e;const t=function(e){let n=Qo.get(e);return n||(n=/* @__PURE__ */new Map,Qo.set(e,n)),n}(e),o=function(e){const n=e.match(/(\d+(?:\.\d+)?)\s*px/);return n?parseFloat(n[1]):16}(e),l=n?function(e,n){let t=ll.get(e);if(void 0!==t)return t;const o=rl();o.font=e;const l=o.measureText("😀").width;if(t=0,l>n+.5&&"undefined"!=typeof document&&null!==document.body){const n=document.createElement("span");n.style.font=e,n.style.display="inline-block",n.style.visibility="hidden",n.style.position="absolute",n.textContent="😀",document.body.appendChild(n);const o=n.getBoundingClientRect().width;document.body.removeChild(n),l-o>.5&&(t=l-o)}return ll.set(e,t),t}(e,o):0;return{cache:t,fontSize:o,emojiCorrection:l}}(n,(a=e.normalized,tl.test(a)));var a;const s=dl("-",il("-",r),i),u=8*dl(" ",il(" ",r),i);if(0===e.len)return{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]};const d=[],c=[],h=[],m=[];let f=e.chunks.length<=1;const p=t?[]:null,v=[],g=t?[]:null,y=Array.from({length:e.len});function w(e,n,t,o,l,r,i){"text"!==l&&"space"!==l&&"zero-width-break"!==l&&(f=!1),d.push(n),c.push(t),h.push(o),m.push(l),null==p||p.push(r),v.push(i),null!==g&&g.push(e)}function N(e,n,t,o,a){const s=il(e,r),u=dl(e,s,i),d="space"===n||"preserved-space"===n||"zero-width-break"===n?0:u,c="space"===n||"zero-width-break"===n?0:u;if(a&&o&&e.length>1){let o="sum-graphemes";Go(e)?o="pair-context":l.preferPrefixWidthsForBreakableRuns&&(o="segment-prefixes");const a=function(e,n,t,o,l){if(void 0!==n.breakableFitAdvances)return n.breakableFitAdvances;const r=sl(),i=[];for(const d of r.segment(e))i.push(d.segment);if(i.length<=1)return n.breakableFitAdvances=null,n.breakableFitAdvances;if("sum-graphemes"===l){const e=[];for(const n of i){const l=il(n,t);e.push(dl(n,l,o))}return n.breakableFitAdvances=e,n.breakableFitAdvances}if("pair-context"===l||i.length>96){const e=[];let l=null,r=0;for(const n of i){const i=dl(n,il(n,t),o);if(null===l)e.push(i);else{const i=l+n,a=il(i,t);e.push(dl(i,a,o)-r)}l=n,r=i}return n.breakableFitAdvances=e,n.breakableFitAdvances}const a=[];let s="",u=0;for(const d of i){s+=d;const e=dl(s,il(s,t),o);a.push(e-u),u=e}return n.breakableFitAdvances=a,n.breakableFitAdvances}(e,s,r,i,o);return void w(e,u,d,c,n,t,a)}w(e,u,d,c,n,t,null)}for(let M=0;M<e.len;M++){y[M]=d.length;const n=e.texts[M],t=e.isWordLike[M],i=e.kinds[M],a=e.starts[M];if("soft-hyphen"===i){w(n,0,s,s,i,a,null);continue}if("hard-break"===i){w(n,0,0,0,i,a,null);continue}if("tab"===i){w(n,0,0,0,i,a,null);continue}const u=il(n,r);if("text"===i&&u.containsCJK){const e=pl(n,l),r="keep-all"===o?vl(e):e;for(let n=0;n<r.length;n++){const e=r[n];N(e.text,"text",a+e.start,t,"keep-all"===o||!ho(e.text))}continue}N(n,i,a,t,!0)}const k=function(e,n,t){const o=[];for(let l=0;l<e.length;l++){const r=e[l],i=r.startSegmentIndex<n.length?n[r.startSegmentIndex]:t,a=r.endSegmentIndex<n.length?n[r.endSegmentIndex]:t,s=r.consumedEndSegmentIndex<n.length?n[r.consumedEndSegmentIndex]:t;o.push({startSegmentIndex:i,endSegmentIndex:a,consumedEndSegmentIndex:s})}return o}(e.chunks,y,d.length),x=null===p?null:function(e,n){const t=function(e){const n=e.length;if(0===n)return null;const t=new Array(n);let o=!1;for(let u=0;u<n;){const l=e.charCodeAt(u);let r=l,i=1;if(l>=55296&&l<=56319&&u+1<n){const n=e.charCodeAt(u+1);n>=56320&&n<=57343&&(r=n-56320+(l-55296<<10)+65536,i=2)}const a=to(r);"R"!==a&&"AL"!==a&&"AN"!==a||(o=!0);for(let e=0;e<i;e++)t[u+e]=a;u+=i}if(!o)return null;let l=0;for(let u=0;u<n;u++){const e=t[u];if("L"===e){l=0;break}if("R"===e||"AL"===e){l=1;break}}const r=new Int8Array(n);for(let u=0;u<n;u++)r[u]=l;const i=1&l?"R":"L",a=i;let s=a;for(let u=0;u<n;u++)"NSM"===t[u]?t[u]=s:s=t[u];s=a;for(let u=0;u<n;u++){const e=t[u];"EN"===e?t[u]="AL"===s?"AN":"EN":"R"!==e&&"L"!==e&&"AL"!==e||(s=e)}for(let u=0;u<n;u++)"AL"===t[u]&&(t[u]="R");for(let u=1;u<n-1;u++)"ES"===t[u]&&"EN"===t[u-1]&&"EN"===t[u+1]&&(t[u]="EN"),"CS"!==t[u]||"EN"!==t[u-1]&&"AN"!==t[u-1]||t[u+1]!==t[u-1]||(t[u]=t[u-1]);for(let u=0;u<n;u++){if("EN"!==t[u])continue;let e;for(e=u-1;e>=0&&"ET"===t[e];e--)t[e]="EN";for(e=u+1;e<n&&"ET"===t[e];e++)t[e]="EN"}for(let u=0;u<n;u++){const e=t[u];"WS"!==e&&"ES"!==e&&"ET"!==e&&"CS"!==e||(t[u]="ON")}s=a;for(let u=0;u<n;u++){const e=t[u];"EN"===e?t[u]="L"===s?"L":"EN":"R"!==e&&"L"!==e||(s=e)}for(let u=0;u<n;u++){if("ON"!==t[u])continue;let e=u+1;for(;e<n&&"ON"===t[e];)e++;const o="L"!==(u>0?t[u-1]:a)?"R":"L";if(o===("L"!==(e<n?t[e]:a)?"R":"L"))for(let n=u;n<e;n++)t[n]=o;u=e-1}for(let u=0;u<n;u++)"ON"===t[u]&&(t[u]=i);for(let u=0;u<n;u++){const e=t[u];1&r[u]?"L"!==e&&"AN"!==e&&"EN"!==e||r[u]++:"R"===e?r[u]++:"AN"!==e&&"EN"!==e||(r[u]+=2)}return r}(e);if(null===t)return null;const o=new Int8Array(n.length);for(let l=0;l<n.length;l++)o[l]=t[n[l]];return o}(e.normalized,p);return null!==g?{widths:d,lineEndFitAdvances:c,lineEndPaintAdvances:h,kinds:m,simpleLineWalkFastPath:f,segLevels:x,breakableFitAdvances:v,discretionaryHyphenWidth:s,tabStopAdvance:u,chunks:k,segments:g}:{widths:d,lineEndFitAdvances:c,lineEndPaintAdvances:h,kinds:m,simpleLineWalkFastPath:f,segLevels:x,breakableFitAdvances:v,discretionaryHyphenWidth:s,tabStopAdvance:u,chunks:k}}function yl(e,n,t){return function(e,n,t,o){var l;const r=null!=(l=null==o?void 0:o.wordBreak)?l:"normal";return gl(function(e,n,t="normal",o="normal"){const l=function(e){const n=null!=e?e:"normal";return"pre-wrap"===n?{mode:n,preserveOrdinarySpaces:!0,preserveHardBreaks:!0}:{mode:n,preserveOrdinarySpaces:!1,preserveHardBreaks:!1}}(t),r="pre-wrap"===l.mode?function(e){return/[\r\f]/.test(e)?e.replace(/\r\n/g,"\n").replace(/[\r\f]/g,"\n"):e.replace(/\r\n/g,"\n")}(e):function(e){if(!lo.test(e))return e;let n=e.replace(oo," ");return 32===n.charCodeAt(0)&&(n=n.slice(1)),n.length>0&&32===n.charCodeAt(n.length-1)&&(n=n.slice(0,-1)),n}(e);if(0===r.length)return{normalized:r,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};const i="keep-all"===o?function(e){if(e.len<=1)return e;const n=[],t=[],o=[],l=[];let r=null,i=!1,a=0,s=!1,u=!1;function d(){null!==r&&(n.push(Ro(r)),t.push(i),o.push("text"),l.push(a),r=null)}for(let c=0;c<e.len;c++){const h=e.texts[c],m=e.kinds[c],f=e.isWordLike[c],p=e.starts[c];if("text"===m){const e=fo(h),n=po(h);if(null!==r&&s&&u){r.push(h),i=i||f,s=s||e,u=n;continue}d(),r=[h],i=f,a=p,s=e,u=n;continue}d(),n.push(h),t.push(f),o.push(m),l.push(p)}return d(),{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(Zo(r,n,l)):Zo(r,n,l);return a({normalized:r,chunks:Yo(i,l)},i)}(e,al(),null==o?void 0:o.whiteSpace,r),n,!1,r)}(e,n,0,t)}const wl="__MARKSTREAM_VUE_HEIGHT_ESTIMATION_EXPERIMENT__",Nl=(()=>{const e=globalThis;if(e[wl])return e[wl];const n={configs:{},controllers:{},revision:W(0),preparedCache:/* @__PURE__ */new Map,blockEstimateCache:/* @__PURE__ */new Map};return e[wl]=n,n})();let kl=null;const xl=Nl.revision;function Ml(e){var n;return e&&null!=(n=Nl.configs[e])?n:null}function bl(e,n){const t=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(t)&&t>0?t:n}function Sl(e){return"text"===(null==e?void 0:e.type)||"emoji"===(null==e?void 0:e.type)||"hardbreak"===(null==e?void 0:e.type)}function _l(e){var n,t,o;if(!Array.isArray(e)||0===e.length)return null;let l="";for(const r of e){if(!Sl(r))return null;"text"===r.type?l+=String(null!=(n=r.content)?n:""):"emoji"===r.type?l+=String(null!=(o=null!=(t=r.name)?t:r.raw)?o:""):"hardbreak"===r.type&&(l+="\n")}return l.length>0?l:null}function Bl(e,n,t){var o,l;if(!e||!Number.isFinite(n)||n<=0||!function(){var e;if(null!=kl)return kl;if("undefined"==typeof document)return!1;try{const n=document.createElement("canvas");return kl=!!(null==(e=n.getContext)?void 0:e.call(n,"2d")),kl}catch(n){return kl=!1,!1}}())return null;try{const r=Math.round(100*n)/100,i=[null!=(o=t.whiteSpace)?o:"pre-wrap",t.font,t.lineHeight,t.wrapperOverhead,t.widthAdjustment,r,e].join("\0"),a=Nl.blockEstimateCache.get(i);if(a)return Nl.blockEstimateCache.delete(i),Nl.blockEstimateCache.set(i,a),{kind:"simple-text",height:a.height,contentHeight:a.contentHeight};const s=null!=(l=t.whiteSpace)?l:"pre-wrap",u=function(e,n,t){const o=`${t}\0${n}\0${e}`,l=Nl.preparedCache.get(o);if(l)return Nl.preparedCache.delete(o),Nl.preparedCache.set(o,l),l.prepared;const r=yl(e,n,{whiteSpace:t});for(Nl.preparedCache.set(o,{prepared:r});Nl.preparedCache.size>240;){const e=Nl.preparedCache.keys().next().value;if(!e)break;Nl.preparedCache.delete(e)}return r}(e,t.font,s),d=function(e,n,t){const o=function(e,n){return e.simpleLineWalkFastPath?ml(e,n):function(e,n){if(e.simpleLineWalkFastPath)return ml(e,n);const{widths:t,lineEndFitAdvances:o,lineEndPaintAdvances:l,kinds:r,breakableFitAdvances:i,discretionaryHyphenWidth:a,tabStopAdvance:s,chunks:u}=e;if(0===t.length||0===u.length)return 0;const d=al(),c=d.lineFitEpsilon,h=n+c;let m=0,f=0,p=!1,v=0,g=0,y=-1,w=0,N=0,k=null;function x(){y=-1,w=0,N=0,k=null}function M(e=v,n=g,t=f){m++,f=0,p=!1,x()}function b(e,n){p=!0,v=e+1,g=0,f=n}function S(e,n,t){p=!0,v=e,g=n+1,f=t}function _(e,n){p?(f+=n,v=e+1,g=0):b(e,n)}function B(e,n,t,r){if(!n)return;const i="tab"===e?0:o[t],a="tab"===e?r:l[t];y=t+1,w=f-r+i,N=f-r+a,k=e}function O(e,n){const t=i[e];for(let o=n;o<t.length;o++){const n=t[o];p?f+n>h?(M(),S(e,o,n)):(f+=n,v=e,g=o+1):S(e,o,n)}p&&v===e&&g===t.length&&(v=e+1,g=0)}function L(e){if("soft-hyphen"!==k)return!1;const t=i[e];if(null==t)return!1;const{fitCount:o,fittedWidth:l}=function(e,n,t,o,l){let r=0,i=n;for(;r<e.length;){const n=i+e[r];if((r+1<e.length?n+l:n)>t+o)break;i=n,r++}return{fitCount:r,fittedWidth:i}}(t,f,n,c,a);return 0!==o&&(f=l,v=e,g=o,x(),o===t.length?(v=e+1,g=0,!0):(M(e,o,l+a),O(e,o),!0))}function C(e){m++,x()}for(let T=0;T<u.length;T++){const e=u[T];if(e.startSegmentIndex===e.endSegmentIndex){C();continue}p=!1,f=0,e.startSegmentIndex,v=e.startSegmentIndex,g=0,x();let c=e.startSegmentIndex;for(;c<e.endSegmentIndex;){const e=r[c],u="space"===e||"preserved-space"===e||"tab"===e||"zero-width-break"===e||"soft-hyphen"===e,m="tab"===e?hl(f,s):t[c];if("soft-hyphen"!==e)if(p){if(f+m>h){const t=f+("tab"===e?0:o[c]),r=f+("tab"===e?m:l[c]);if("soft-hyphen"===k&&d.preferEarlySoftHyphenBreak&&w<=h){M(y,0,N);continue}if("soft-hyphen"===k&&L(c)){c++;continue}if(u&&t<=h){_(c,m),M(c+1,0,r),c++;continue}if(y>=0&&w<=h){if(v>y||v===y&&g>0){M();continue}const e=y;M(e,0,N),c=e;continue}if(m>n&&null!==i[c]){M(),O(c,0),c++;continue}M();continue}_(c,m),B(e,u,c,m),c++}else m>n&&null!==i[c]?O(c,0):b(c,m),B(e,u,c,m),c++;else p&&(v=c+1,g=0,y=c+1,w=f+a,N=f+a,k=e),c++}if(p){const n=y===e.consumedEndSegmentIndex?N:f;M(e.consumedEndSegmentIndex,0,n)}}return m}(e,n)}(e,n);return{lineCount:o,height:o*t}}(u,Math.max(24,r-t.widthAdjustment),t.lineHeight),c=Math.max(t.lineHeight,d.height),h=Math.max(t.lineHeight,Math.round(c+t.wrapperOverhead));for(Nl.blockEstimateCache.set(i,{height:h,contentHeight:Math.round(c)});Nl.blockEstimateCache.size>4e3;){const e=Nl.blockEstimateCache.keys().next().value;if(!e)break;Nl.blockEstimateCache.delete(e)}return{kind:"simple-text",height:h,contentHeight:Math.round(c)}}catch(r){return null}}function Ol(e,n,t){var o,l;if(!t||!e||!Number.isFinite(n)||n<=0)return null;if("paragraph"===e.type){const o=_l(e.children);return o&&t.paragraph?Bl(o,n,t.paragraph):null}if("heading"===e.type){const o=Number(e.level||0),l=_l(e.children),r=t.headings[o];return l&&r?Bl(l,n,r):null}if("list_item"===e.type){const r=Array.isArray(e.children)?e.children:[];if(1!==r.length||"paragraph"!==(null==(o=r[0])?void 0:o.type)||!t.listItem)return null;const i=_l(null==(l=r[0])?void 0:l.children);return i?Bl(i,n,t.listItem):null}if("list"===e.type){const o=Array.isArray(e.items)?e.items:[];if(!o.length)return null;let l=Math.max(0,t.listWrapperOverhead);for(const e of o){const o=Ol(e,n,t);if(!o)return null;l+=o.height}return{kind:"simple-text",height:Math.max(1,Math.round(l)),contentHeight:Math.max(1,Math.round(l))}}return null}function Ll(e){if(!e)return 1;const n=String(e).split(/\r?\n/);return Math.max(1,n.length)}function Cl(e){return e?`${e.fontStyle||"normal"} ${e.fontWeight||"400"} ${e.fontSize||"16px"} ${e.fontFamily||"sans-serif"}`:""}function Tl(e,n,t="pre-wrap"){if(!e||!n||"undefined"==typeof window)return null;const o=window.getComputedStyle(n),l=e.offsetHeight,r=bl(o.lineHeight,1.5*bl(o.fontSize,16)),i=e.getBoundingClientRect().width,a=n.getBoundingClientRect().width;return{font:Cl(o),lineHeight:r,wrapperOverhead:Math.max(0,l-r),widthAdjustment:Math.max(0,i-a),whiteSpace:t}}let El=!1,Il=null,Al=null,$l=!1,Hl=null;function zl(){return d(this,null,function*(){if(Hl)return Hl;Hl=d(null,null,function*(){if(!Al){if($l)return null;try{Al=yield import("stream-monaco")}catch(e){return $l=!0,null}}try{return yield function(e){return d(this,null,function*(){if(El)return;if(Il)return Il;const n=d(null,null,function*(){const n=null==globalThis?void 0:globalThis.MonacoEnvironment;n&&("function"==typeof n.getWorker||"function"==typeof n.getWorkerUrl)||"function"!=typeof(null==e?void 0:e.preloadMonacoWorkers)||(yield e.preloadMonacoWorkers()),El=!0});return Il=n.finally(()=>{Il=null}),Il})}(Al),Al}catch(e){return null}});try{return yield Hl}finally{Hl=null}})}const Rl=/* @__PURE__ */new Map;let Wl="material";const Pl=/* @__PURE__ */new Map,jl=/* @__PURE__ */new Map;let Fl=null;function Kl(e){Rl.set(e.id,e)}function Dl(e){if(!Rl.has(e))throw new Error(`[markstream-vue] Unknown icon theme: "${e}". Registered: ${[...Rl.keys()].join(", ")}`);Wl=e,null==Fl||Fl();const n=Rl.get(e);n.loadExtended&&!Pl.has(e)&&Ul(n)}function Vl(){return[...Rl.keys()]}function Ul(e){return d(this,null,function*(){var n,t,o;if(Pl.has(e.id))return null!=(n=Pl.get(e.id))?n:null;let l=jl.get(e.id);return l||(l=(null!=(o=null==(t=e.loadExtended)?void 0:t.call(e))?o:Promise.resolve(null)).then(n=>(Pl.set(e.id,n),null==Fl||Fl(),n)).catch(()=>(Pl.set(e.id,null),null)),jl.set(e.id,l)),l})}function ql({R:e,H:n=0,B:t=50}){const o=e*(1-n)||1e-6;return Math.max(1,Math.floor(t/o))}function Xl(e){const n=e.length+10*(e.match(/\\/g)||[]).length;return n<10?"simple":n<40?"medium":"complex"}function Gl(e){switch(e){case"simple":return 3;case"medium":return 10;case"complex":return 30}}function Zl(e,n){var t,o;let l=0;for(const r of e){const e=Gl(Xl(r));e>l&&(l=e)}return ql({R:l,H:null!=(t=null==n?void 0:n.H)?t:0,B:null!=(o=null==n?void 0:n.B)?o:50})}const Yl='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M30 14v-2h-2V8h-2v4h-2V8h-2v4h-2v2h2v2h-2v2h2v4h2v-4h2v4h2v-4h2v-2h-2v-2Zm-4 2h-2v-2h2Zm-12.437 6A5.57 5.57 0 0 1 8 16.437v-2.873A5.57 5.57 0 0 1 13.563 8H18V2h-4.437A11.563 11.563 0 0 0 2 13.563v2.873A11.564 11.564 0 0 0 13.563 28H18v-6Z"/></svg>',Jl='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path d="M0 0h24v24H0z"/><path fill="#42a5f5" d="M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5z"/></svg>',Ql={id:"material",core:{"":Jl,plain:'<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path d="M0 0h24v24H0z"/><path fill="#42a5f5" d="M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5z"/></svg>',text:Jl,javascript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ffca28" d="M2 2v12h12V2zm6 6h1v4a1.003 1.003 0 0 1-1 1H7a1.003 1.003 0 0 1-1-1v-1h1v1h1zm3 0h2v1h-2v1h1a1.003 1.003 0 0 1 1 1v1a1.003 1.003 0 0 1-1 1h-2v-1h2v-1h-1a1.003 1.003 0 0 1-1-1V9a1.003 1.003 0 0 1 1-1"/></svg>',typescript:'<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 16 16"><path fill="#0288d1" d="M2 2v12h12V2zm4 6h3v1H8v4H7V9H6zm5 0h2v1h-2v1h1a1.003 1.003 0 0 1 1 1v1a1.003 1.003 0 0 1-1 1h-2v-1h2v-1h-1a1.003 1.003 0 0 1-1-1V9a1.003 1.003 0 0 1 1-1"/></svg>',jsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#00bcd4" d="M16 12c7.444 0 12 2.59 12 4s-4.556 4-12 4-12-2.59-12-4 4.556-4 12-4m0-2c-7.732 0-14 2.686-14 6s6.268 6 14 6 14-2.686 14-6-6.268-6-14-6"/><path fill="#00bcd4" d="M16 14a2 2 0 1 0 2 2 2 2 0 0 0-2-2"/><path fill="#00bcd4" d="M10.458 5.507c2.017 0 5.937 3.177 9.006 8.493 3.722 6.447 3.757 11.687 2.536 12.392a.9.9 0 0 1-.457.1c-2.017 0-5.938-3.176-9.007-8.492C8.814 11.553 8.779 6.313 10 5.608a.9.9 0 0 1 .458-.1m-.001-2A2.87 2.87 0 0 0 9 3.875C6.13 5.532 6.938 12.304 10.804 19c3.284 5.69 7.72 9.493 10.74 9.493A2.87 2.87 0 0 0 23 28.124c2.87-1.656 2.062-8.428-1.804-15.124-3.284-5.69-7.72-9.493-10.74-9.493Z"/><path fill="#00bcd4" d="M21.543 5.507a.9.9 0 0 1 .457.1c1.221.706 1.186 5.946-2.536 12.393-3.07 5.316-6.99 8.493-9.007 8.493a.9.9 0 0 1-.457-.1C8.779 25.686 8.814 20.446 12.536 14c3.07-5.316 6.99-8.493 9.007-8.493m0-2c-3.02 0-7.455 3.804-10.74 9.493C6.939 19.696 6.13 26.468 9 28.124a2.87 2.87 0 0 0 1.457.369c3.02 0 7.455-3.804 10.74-9.493C25.061 12.304 25.87 5.532 23 3.876a2.87 2.87 0 0 0-1.457-.369"/></svg>',tsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M16 12c7.444 0 12 2.59 12 4s-4.556 4-12 4-12-2.59-12-4 4.556-4 12-4m0-2c-7.732 0-14 2.686-14 6s6.268 6 14 6 14-2.686 14-6-6.268-6-14-6"/><path fill="#0288d1" d="M16 14a2 2 0 1 0 2 2 2 2 0 0 0-2-2"/><path fill="#0288d1" d="M10.458 5.507c2.017 0 5.937 3.177 9.006 8.493 3.722 6.447 3.757 11.687 2.536 12.392a.9.9 0 0 1-.457.1c-2.017 0-5.938-3.176-9.007-8.492C8.814 11.553 8.779 6.313 10 5.608a.9.9 0 0 1 .458-.1m-.001-2A2.87 2.87 0 0 0 9 3.875C6.13 5.532 6.938 12.304 10.804 19c3.284 5.69 7.72 9.493 10.74 9.493A2.87 2.87 0 0 0 23 28.124c2.87-1.656 2.062-8.428-1.804-15.124-3.284-5.69-7.72-9.493-10.74-9.493Z"/><path fill="#0288d1" d="M21.543 5.507a.9.9 0 0 1 .457.1c1.221.706 1.186 5.946-2.536 12.393-3.07 5.316-6.99 8.493-9.007 8.493a.9.9 0 0 1-.457-.1C8.779 25.686 8.814 20.446 12.536 14c3.07-5.316 6.99-8.493 9.007-8.493m0-2c-3.02 0-7.455 3.804-10.74 9.493C6.939 19.696 6.13 26.468 9 28.124a2.87 2.87 0 0 0 1.457.369c3.02 0 7.455-3.804 10.74-9.493C25.061 12.304 25.87 5.532 23 3.876a2.87 2.87 0 0 0-1.457-.369"/></svg>',html:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#e65100" d="m4 4 2 22 10 2 10-2 2-22Zm19.72 7H11.28l.29 3h11.86l-.802 9.335L15.99 25l-6.635-1.646L8.93 19h3.02l.19 2 3.86.77 3.84-.77.29-4H8.84L8 8h16Z"/></svg>',css:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#7e57c2" d="M20 18h-2v-2h-2v2c0 .193 0 .703 1.254 1.033A3.345 3.345 0 0 1 20 22h2v2h2v-2c0-.388-.562-.851-1.254-1.034C20.356 20.34 20 18.84 20 18m-3.254 2.966C14.356 20.34 14 18.84 14 18h-2v-2h-2v8h2v-2h4v2h2v-2c0-.388-.562-.851-1.254-1.034"/><path fill="#7e57c2" d="M24 4H4v20a4 4 0 0 0 4 4h16.16A3.84 3.84 0 0 0 28 24.16V8a4 4 0 0 0-4-4m2 14h-2v-2h-2v2c0 .193 0 .703 1.254 1.033A3.345 3.345 0 0 1 26 22v2a2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2 2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2 2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2 2 2 0 0 1 2-2h2a2 2 0 0 1 2 2 2 2 0 0 1 2-2h2a2 2 0 0 1 2 2Z"/></svg>',scss:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ec407a" d="M27.837 5.673a4.33 4.33 0 0 0-2.293-2.701c-2.362-1.261-6.11-1.298-9.548-.092a26.3 26.3 0 0 0-8.76 4.966c-2.752 2.542-3.438 4.925-3.189 6.194.523 2.668 3.274 4.539 5.485 6.042.418.284.822.559 1.175.816-1.429.76-4.261 2.444-5.088 4.248a3.88 3.88 0 0 0-.118 3.332A2.37 2.37 0 0 0 6.869 29.8a5.6 5.6 0 0 0 1.49.2 6.35 6.35 0 0 0 5.19-2.856 6.74 6.74 0 0 0 .864-5.382 7.3 7.3 0 0 1 2.044-.03 3.92 3.92 0 0 1 2.816 1.311 1.82 1.82 0 0 1 .423 1.262 1.55 1.55 0 0 1-.772 1.05c-.234.14-.586.355-.504.803.036.194.198.633.894.512a2.93 2.93 0 0 0 2.145-2.651 4 4 0 0 0-1.197-2.904 5.94 5.94 0 0 0-4.396-1.626 10.6 10.6 0 0 0-2.672.304 20 20 0 0 0-2.203-1.846c-1.712-1.3-3.33-2.529-3.235-4.26.125-2.263 2.468-4.532 6.964-6.744 4.016-1.976 7.254-2.037 8.944-1.438a2 2 0 0 1 1.204.883 2.77 2.77 0 0 1-.36 2.47 9.71 9.71 0 0 1-7.425 4.304 3.86 3.86 0 0 1-3.238-.757c-.278-.302-.593-.645-1.074-.383q-.565.31-.225 1.189a3.9 3.9 0 0 0 2.407 1.92 11.7 11.7 0 0 0 7.128-.671c3.527-1.35 6.681-5.202 5.756-8.787M11.895 24.475a4 4 0 0 1-.192.468 4.5 4.5 0 0 1-.753 1.081 2.83 2.83 0 0 1-2.533 1.107c-.056-.032-.078-.146-.085-.193a3.28 3.28 0 0 1 1.076-2.284 11.3 11.3 0 0 1 2.644-1.933 3.85 3.85 0 0 1-.157 1.754"/></svg>',json:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path fill="#f9a825" d="M560-160v-80h120q17 0 28.5-11.5T720-280v-80q0-38 22-69t58-44v-14q-36-13-58-44t-22-69v-80q0-17-11.5-28.5T680-720H560v-80h120q50 0 85 35t35 85v80q0 17 11.5 28.5T840-560h40v160h-40q-17 0-28.5 11.5T800-360v80q0 50-35 85t-85 35zm-280 0q-50 0-85-35t-35-85v-80q0-17-11.5-28.5T120-400H80v-160h40q17 0 28.5-11.5T160-600v-80q0-50 35-85t85-35h120v80H280q-17 0-28.5 11.5T240-680v80q0 38-22 69t-58 44v14q36 13 58 44t22 69v80q0 17 11.5 28.5T280-240h120v80z"/></svg>',python:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#0288d1" d="M9.86 2A2.86 2.86 0 0 0 7 4.86v1.68h4.29c.39 0 .71.57.71.96H4.86A2.86 2.86 0 0 0 2 10.36v3.781a2.86 2.86 0 0 0 2.86 2.86h1.18v-2.68a2.85 2.85 0 0 1 2.85-2.86h5.25c1.58 0 2.86-1.271 2.86-2.851V4.86A2.86 2.86 0 0 0 14.14 2zm-.72 1.61c.4 0 .72.12.72.71s-.32.891-.72.891c-.39 0-.71-.3-.71-.89s.32-.711.71-.711"/><path fill="#fdd835" d="M17.959 7v2.68a2.85 2.85 0 0 1-2.85 2.859H9.86A2.85 2.85 0 0 0 7 15.389v3.75a2.86 2.86 0 0 0 2.86 2.86h4.28A2.86 2.86 0 0 0 17 19.14v-1.68h-4.291c-.39 0-.709-.57-.709-.96h7.14A2.86 2.86 0 0 0 22 13.64V9.86A2.86 2.86 0 0 0 19.14 7zM8.32 11.513l-.004.004.038-.004zm6.54 7.276c.39 0 .71.3.71.89a.71.71 0 0 1-.71.71c-.4 0-.72-.12-.72-.71s.32-.89.72-.89"/></svg>',ruby:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#f44336" d="M18.041 3.177c2.24.382 2.879 1.919 2.843 3.527V6.67l-1.013 13.266-13.132.897h.008c-1.093-.044-3.518-.151-3.634-3.545l1.217-2.222 2.462 5.74 2.097-6.77-.045.009.018-.018 6.85 2.186L13.945 9.3l6.53-.409-5.144-4.212 2.71-1.51v.009M3.113 17.252v.017zM6.916 6.874c2.63-2.622 6.033-4.168 7.34-2.844 1.297 1.306-.072 4.523-2.702 7.135-2.666 2.613-6.015 4.248-7.322 2.933-1.306-1.324.036-4.612 2.675-7.224z"/></svg>',go:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#00acc1" d="M2 12h4v2H2zm-2 4h6v2H0zm4 4h2v2H4zm16.954-5H14v3h3.239a4.42 4.42 0 0 1-3.531 2 2.65 2.65 0 0 1-2.053-.858 2.86 2.86 0 0 1-.628-2.28A4.515 4.515 0 0 1 15.292 13a2.73 2.73 0 0 1 1.749.584l2.962-1.185A5.6 5.6 0 0 0 15.292 10a7.526 7.526 0 0 0-7.243 6.5 5.614 5.614 0 0 0 5.659 6.5 7.526 7.526 0 0 0 7.243-6.5 6.4 6.4 0 0 0 .003-1.5"/><path fill="#00acc1" d="M26.292 10a7.526 7.526 0 0 0-7.243 6.5 5.614 5.614 0 0 0 5.659 6.5 7.526 7.526 0 0 0 7.243-6.5 5.614 5.614 0 0 0-5.659-6.5m2.681 6.137A4.515 4.515 0 0 1 24.708 20a2.65 2.65 0 0 1-2.053-.858 2.86 2.86 0 0 1-.628-2.28A4.515 4.515 0 0 1 26.292 13a2.65 2.65 0 0 1 2.053.858 2.86 2.86 0 0 1 .628 2.28Z"/></svg>',java:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#f44336" d="M4 26h24v2H4zM28 4H7a1 1 0 0 0-1 1v13a4 4 0 0 0 4 4h10a4 4 0 0 0 4-4v-4h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2m0 8h-4V6h4Z"/></svg>',kotlin:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><defs><linearGradient id="a" x1="1.725" x2="22.185" y1="22.67" y2="1.982" gradientTransform="translate(1.306 1.129)scale(.89324)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#7c4dff"/><stop offset=".5" stop-color="#d500f9"/><stop offset="1" stop-color="#ef5350"/></linearGradient></defs><path fill="url(#a)" d="M2.975 2.976v18.048h18.05v-.03l-4.478-4.511-4.48-4.515 4.48-4.515 4.443-4.477z"/></svg>',c:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M19.563 22A5.57 5.57 0 0 1 14 16.437v-2.873A5.57 5.57 0 0 1 19.563 8H24V2h-4.437A11.563 11.563 0 0 0 8 13.563v2.873A11.564 11.564 0 0 0 19.563 28H24v-6Z"/></svg>',cpp:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M28 14v-4h-2v4h-6v-4h-2v4h-4v2h4v4h2v-4h6v4h2v-4h4v-2z"/><path fill="#0288d1" d="M13.563 22A5.57 5.57 0 0 1 8 16.437v-2.873A5.57 5.57 0 0 1 13.563 8H18V2h-4.437A11.563 11.563 0 0 0 2 13.563v2.873A11.564 11.564 0 0 0 13.563 28H18v-6Z"/></svg>',cs:Yl,csharp:Yl,php:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#1e88e5" d="M12 18.08c-6.63 0-12-2.72-12-6.08s5.37-6.08 12-6.08S24 8.64 24 12s-5.37 6.08-12 6.08m-5.19-7.95c.54 0 .91.1 1.09.31.18.2.22.56.13 1.03-.1.53-.29.87-.58 1.09q-.42.33-1.29.33h-.87l.53-2.76zm-3.5 5.55h1.44l.34-1.75h1.23c.54 0 .98-.06 1.33-.17.35-.12.67-.31.96-.58.24-.22.43-.46.58-.73.15-.26.26-.56.31-.88.16-.78.05-1.39-.33-1.82-.39-.44-.99-.65-1.82-.65H4.59zm7.25-8.33-1.28 6.58h1.42l.74-3.77h1.14c.36 0 .6.06.71.18s.13.34.07.66l-.57 2.93h1.45l.59-3.07c.13-.62.03-1.07-.27-1.36-.3-.27-.85-.4-1.65-.4h-1.27L12 7.35zM18 10.13c.55 0 .91.1 1.09.31.18.2.22.56.13 1.03-.1.53-.29.87-.57 1.09-.29.22-.72.33-1.3.33h-.85l.5-2.76zm-3.5 5.55h1.44l.34-1.75h1.22c.55 0 1-.06 1.35-.17.35-.12.65-.31.95-.58.24-.22.44-.46.58-.73.15-.26.26-.56.32-.88.15-.78.04-1.39-.34-1.82-.36-.44-.99-.65-1.82-.65h-2.75z"/></svg>',shell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ff7043" d="M2 2a1 1 0 0 0-1 1v10c0 .554.446 1 1 1h12c.554 0 1-.446 1-1V3a1 1 0 0 0-1-1zm0 3h12v8H2zm1 2 2 2-2 2 1 1 3-3-3-3zm5 3.5V12h5v-1.5z"/></svg>',powershell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#03a9f4" d="M29.07 6H7.677A1.535 1.535 0 0 0 6.24 7.113l-4.2 17.774A.852.852 0 0 0 2.93 26h21.393a1.535 1.535 0 0 0 1.436-1.113L29.96 7.112A.852.852 0 0 0 29.07 6M8.626 23.797a1.4 1.4 0 0 1-1.814-.31l-.007-.009a1.075 1.075 0 0 1 .315-1.599l9.6-6.061-6.102-5.852-.01-.01a1.068 1.068 0 0 1 .084-1.625l.037-.03a1.38 1.38 0 0 1 1.8.07l7.233 6.957a1.1 1.1 0 0 1 .236.739 1.08 1.08 0 0 1-.412.79c-.074.04-.146.119-10.951 6.935ZM24 22.94A1.135 1.135 0 0 1 22.803 24h-5.634a1.061 1.061 0 1 1 .001-2.112h5.633A1.134 1.134 0 0 1 24 22.938Z"/></svg>',sql:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ffca28" d="M16 24c-5.525 0-10-.9-10-2v4c0 1.1 4.475 2 10 2s10-.9 10-2v-4c0 1.1-4.475 2-10 2m0-8c-5.525 0-10-.9-10-2v4c0 1.1 4.475 2 10 2s10-.9 10-2v-4c0 1.1-4.475 2-10 2m0-12C10.477 4 6 4.895 6 6v4c0 1.1 4.475 2 10 2s10-.9 10-2V6c0-1.105-4.477-2-10-2"/></svg>',yaml:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#ff5252" d="M13 9h5.5L13 3.5zM6 2h8l6 6v12c0 1.1-.9 2-2 2H6c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2m12 16v-2H9v2zm-4-4v-2H6v2z"/></svg>',markdown:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#42a5f5" d="m14 10-4 3.5L6 10H4v12h4v-6l2 2 2-2v6h4V10zm12 6v-6h-4v6h-4l6 8 6-8z"/></svg>',xml:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#8bc34a" d="M13 9h5.5L13 3.5zM6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4c0-1.11.89-2 2-2m.12 13.5 3.74 3.74 1.42-1.41-2.33-2.33 2.33-2.33-1.42-1.41zm11.16 0-3.74-3.74-1.42 1.41 2.33 2.33-2.33 2.33 1.42 1.41z"/></svg>',rust:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ff7043" d="m30 12-4-2V6h-4l-2-4-4 2-4-2-2 4H6v4l-4 2 2 4-2 4 4 2v4h4l2 4 4-2 4 2 2-4h4v-4l4-2-2-4ZM6 16a9.9 9.9 0 0 1 .842-4H10v8H6.842A9.9 9.9 0 0 1 6 16m10 10a9.98 9.98 0 0 1-7.978-4H16v-2h-2v-2h4c.819.819.297 2.308 1.179 3.37a1.89 1.89 0 0 0 1.46.63h3.34A9.98 9.98 0 0 1 16 26m-2-12v-2h4a1 1 0 0 1 0 2Zm11.158 6H24a2.006 2.006 0 0 1-2-2 2 2 0 0 0-2-2 3 3 0 0 0 3-3q0-.08-.004-.161A3.115 3.115 0 0 0 19.83 10H8.022a9.986 9.986 0 0 1 17.136 10"/></svg>',vue:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#41b883" d="M1.791 3.851 12 21.471 22.209 3.936V3.85H18.24l-6.18 10.616L5.906 3.851z"/><path fill="#35495e" d="m5.907 3.851 6.152 10.617L18.24 3.851h-3.723L12.084 8.03 9.66 3.85z"/></svg>',mermaid:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#42a5f5" d="m14 10-4 3.5L6 10H4v12h4v-6l2 2 2-2v6h4V10zm12 6v-6h-4v6h-4l6 8 6-8z"/></svg>'},fallback:'<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ff7043" d="M2 2a1 1 0 0 0-1 1v10c0 .554.446 1 1 1h12c.554 0 1-.446 1-1V3a1 1 0 0 0-1-1zm0 3h12v8H2zm1 2 2 2-2 2 1 1 3-3-3-3zm5 3.5V12h5v-1.5z"/></svg>',loadExtended:()=>import("./extended.js").then(e=>e.materialExtendedMap)};let er=null;const nr=W(0);Fl=()=>{nr.value++},Kl(Ql);const tr={"":"",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 or(e){er=null!=e?e:null}function lr(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=tr[t])?n:t}function rr(e){const n=lr(e);if(!n)return"plaintext";switch(n){case"plain":return"plaintext";case"jsx":return"javascript";case"tsx":return"typescript";default:return n}}function ir(){return d(this,null,function*(){yield function(){return d(this,null,function*(){const e=Rl.get(Wl);(null==e?void 0:e.loadExtended)&&(yield Ul(e))})}()})}function ar(e){if(er){const n=er(e);if(null!=n&&""!==n)return n}return function(e){const n=Rl.get(Wl);if(!n)return;const t=n.core[e];if(t)return t;const o=Pl.get(n.id);if(o){const n=o[e];if(n)return n}n.loadExtended&&!Pl.has(n.id)&&Ul(n)}(lr(e))||(null!=(t=null==(n=Rl.get(Wl))?void 0:n.fallback)?t:"");var n,t}const sr={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"},ur=new class{constructor(){u(this,"metrics",[]),u(this,"enabled",!1),u(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,l=t.length,r=l/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,u=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 d="";return d=r>70&&i<2*a?"✅ Worker + Cache is highly beneficial":r>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:l,cacheHitRate:r.toFixed(1),workerCalls:e.length,directCalls:n.length,averageWorkerTime:i.toFixed(2),averageDirectTime:a.toFixed(2),averageCacheHitTime:s.toFixed(3),workerSavings:u.toFixed(2),recommendation:d}}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 dr(){ur.enable()}function cr(){ur.disable()}function hr(){return ur.printReport()}function mr(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch(n){}return globalThis.setTimeout(e,0)}function fr(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=hr,window.__katexPerfMonitor=ur);const pr={key:0,class:"code-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)] border-[var(--code-border)] bg-[var(--code-header-bg)] text-[var(--code-fg)]"},vr={class:"flex items-center gap-0.5"},gr=["aria-label"],yr={class:"code-diff-stat removed"},wr={class:"code-diff-stat added"},Nr=["aria-label"],kr={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},xr={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},Mr=["aria-pressed"],br={key:3,class:"relative"},Sr=["aria-expanded"],_r=["disabled"],Br=["disabled"],Or=["disabled"],Lr={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},Cr={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},Tr={class:"code-block-shell-content"},Er={class:"code-loading-placeholder"},Ir={class:"sr-only","aria-live":"polite",role:"status"},Ar=/* @__PURE__ */C({__name:"CodeBlockShell",props:{showHeader:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},showPreviewButton:{type:Boolean,default:!0},showTooltips:{type:Boolean,default:!0},isDark:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},stream:{type:Boolean,default:!1},isCollapsed:{type:Boolean,default:!1},isExpanded:{type:Boolean,default:!1},copyText:{type:Boolean,default:!1},isPreviewable:{type:Boolean,default:!1},codeFontSize:{},codeFontMin:{},codeFontMax:{},defaultCodeFontSize:{},fontBaselineReady:{type:Boolean,default:!1},diffStats:{},diffStatsAriaLabel:{}},emits:["toggleCollapse","decreaseFont","resetFont","increaseFont","copy","toggleExpand","preview"],setup(e,{emit:n}){const t=e,o=n,l=V(!1),r=V(null),i=V(null);function a(){l.value=!l.value,l.value&&document.addEventListener("click",s,{once:!0,capture:!0})}function s(e){var n,t;const o=e.target;(null==(n=r.value)?void 0:n.contains(o))||(null==(t=i.value)?void 0:t.contains(o))?document.addEventListener("click",s,{once:!0,capture:!0}):l.value=!1}const u=j(()=>t.showFontSizeButtons&&t.enableFontSizeControl||t.showExpandButton||t.isPreviewable&&t.showPreviewButton),{t:d}=Bn(),c=j(()=>!1!==t.showTooltips);function h(e,n){c.value&&kn(e.currentTarget,n,"top",!1,void 0,t.isDark)}function m(){c.value&&xn()}function f(e){h(e,t.copyText?d("common.copied")||"Copied":d("common.copy")||"Copy")}const p=j(()=>{var e,n;return!!Number.isFinite(t.codeFontSize)&&(null!=(e=t.codeFontSize)?e:0)<=(null!=(n=t.codeFontMin)?n:0)}),v=j(()=>!t.fontBaselineReady||t.codeFontSize===t.defaultCodeFontSize),g=j(()=>{var e,n;return!!Number.isFinite(t.codeFontSize)&&(null!=(e=t.codeFontSize)?e:0)>=(null!=(n=t.codeFontMax)?n:100)});return(n,s)=>(T(),E(H,null,[t.showHeader?(T(),E("div",pr,[ie(n.$slots,"header-left"),ie(n.$slots,"header-right",{},()=>[$("div",vr,[e.diffStats?(T(),E("div",{key:0,class:"code-diff-stats","aria-label":e.diffStatsAriaLabel},[$("span",yr,"-"+R(e.diffStats.removed),1),$("span",wr,"+"+R(e.diffStats.added),1)],8,gr)):q("",!0),t.showCopyButton?(T(),E("button",{key:1,type:"button",class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] disabled:opacity-40 disabled:cursor-not-allowed transition-colors","aria-label":e.copyText?A(d)("common.copied")||"Copied":A(d)("common.copy")||"Copy",onClick:s[0]||(s[0]=e=>o("copy")),onMouseenter:s[1]||(s[1]=e=>f(e)),onFocus:s[2]||(s[2]=e=>f(e)),onMouseleave:m,onBlur:m},[e.copyText?(T(),E("svg",xr,[...s[14]||(s[14]=[$("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(T(),E("svg",kr,[...s[13]||(s[13]=[$("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[$("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),$("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,Nr)):q("",!0),t.showCollapseButton?(T(),E("button",{key:2,type:"button",class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] disabled:opacity-40 disabled:cursor-not-allowed transition-colors","aria-pressed":e.isCollapsed,onClick:s[3]||(s[3]=e=>o("toggleCollapse")),onMouseenter:s[4]||(s[4]=n=>h(n,e.isCollapsed?A(d)("common.expand")||"Expand":A(d)("common.collapse")||"Collapse")),onFocus:s[5]||(s[5]=n=>h(n,e.isCollapsed?A(d)("common.expand")||"Expand":A(d)("common.collapse")||"Collapse")),onMouseleave:m,onBlur:m},[(T(),E("svg",{style:ne({rotate:e.isCollapsed?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[...s[15]||(s[15]=[$("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,Mr)):q("",!0),u.value?(T(),E("div",br,[$("button",{ref_key:"moreBtnRef",ref:i,type:"button",class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] transition-colors","aria-expanded":l.value,"aria-haspopup":"true",onClick:he(a,["stop"]),onMouseenter:s[6]||(s[6]=e=>h(e,A(d)("common.more")||"More")),onFocus:s[7]||(s[7]=e=>h(e,A(d)("common.more")||"More")),onMouseleave:m,onBlur:m},[...s[16]||(s[16]=[me('<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="1em" height="1em" viewBox="0 0 24 24" class="action-icon"><g fill="currentColor"><circle cx="12" cy="5" r="1.5"></circle><circle cx="12" cy="12" r="1.5"></circle><circle cx="12" cy="19" r="1.5"></circle></g></svg>',1)])],40,Sr),I(J,{name:"code-menu"},{default:Q(()=>[l.value?(T(),E("div",{key:0,ref_key:"moreMenuRef",ref:r,class:"code-more-menu min-w-[10rem] p-1 bg-[hsl(var(--ms-popover))] text-[hsl(var(--ms-popover-foreground))] border border-[var(--code-border)] shadow-[var(--ms-shadow-popover)]",role:"menu"},[t.showFontSizeButtons&&t.enableFontSizeControl?(T(),E(H,{key:0},[$("button",{type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",disabled:p.value,onClick:s[8]||(s[8]=e=>o("decreaseFont"))},[s[17]||(s[17]=$("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[$("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14"})],-1)),$("span",null,R(A(d)("common.fontSmaller")||"Font size −"),1)],8,_r),$("button",{type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",disabled:v.value,onClick:s[9]||(s[9]=e=>o("resetFont"))},[s[18]||(s[18]=$("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[$("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[$("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),$("path",{d:"M3 3v5h5"})])],-1)),$("span",null,R(A(d)("common.fontReset")||"Font size reset"),1)],8,Br),$("button",{type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",disabled:g.value,onClick:s[10]||(s[10]=e=>o("increaseFont"))},[s[19]||(s[19]=$("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[$("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1)),$("span",null,R(A(d)("common.fontLarger")||"Font size +"),1)],8,Or)],64)):q("",!0),t.showExpandButton?(T(),E("button",{key:1,type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] transition-colors",onClick:s[11]||(s[11]=e=>{o("toggleExpand",e),l.value=!1})},[e.isExpanded?(T(),E("svg",Lr,[...s[20]||(s[20]=[$("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)])])):(T(),E("svg",Cr,[...s[21]||(s[21]=[$("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)])])),$("span",null,R(e.isExpanded?A(d)("common.collapse")||"Collapse":A(d)("common.expand")||"Expand"),1)])):q("",!0),e.isPreviewable&&t.showPreviewButton?(T(),E("button",{key:2,type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] transition-colors",onClick:s[12]||(s[12]=e=>{o("preview"),l.value=!1})},[s[22]||(s[22]=$("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[$("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[$("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"}),$("circle",{cx:"12",cy:"12",r:"3"})])],-1)),$("span",null,R(A(d)("common.preview")||"Preview"),1)])):q("",!0)],512)):q("",!0)]),_:1})])):q("",!0)])])])):q("",!0),ee($("div",Tr,[ie(n.$slots,"default")],512),[[oe,!(e.isCollapsed||!e.stream&&e.loading)]]),ee($("div",Er,[ie(n.$slots,"loading",{},()=>[s[23]||(s[23]=$("div",{class:"loading-skeleton"},[$("div",{class:"skeleton-line"}),$("div",{class:"skeleton-line"}),$("div",{class:"skeleton-line short"})],-1))])],512),[[oe,!e.stream&&e.loading]]),$("span",Ir,R(e.copyText?A(d)("common.copied")||"Copied":""),1)],64))}}),$r={class:"code-header-main"},Hr=["innerHTML"],zr={class:"code-header-copy"},Rr={class:"code-header-title"},Wr=["innerHTML"],Pr=/* @__PURE__ */Se(/* @__PURE__ */C({__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},estimatedHeightPx:{},estimatedContentHeightPx:{}},emits:["previewCode","copy"],setup(e,{emit:n}){const t=e,o=n,{t:l}=Bn(),r=V(lr(t.node.language)),i=V(!1),s=V(!1),u=V(!1),c=V(null),h=V(null),m=V(null),f=V(""),p=V(!1);let v;const g=It(),y=V(null),w=V("undefined"==typeof window);"undefined"!=typeof window&&U(()=>c.value,e=>{var n;if(null==(n=y.value)||n.destroy(),y.value=null,!e)return void(w.value=!1);const t=g(e,{rootMargin:"400px"});y.value=t,w.value=t.isVisible.value,t.whenVisible.then(()=>{w.value=!0})},{immediate:!0});const N=V(!0),k=V(0),x=V(14),M=V(x.value),b=j(()=>{const e=x.value,n=M.value;return"number"==typeof e&&Number.isFinite(e)&&e>0&&"number"==typeof n&&Number.isFinite(n)&&n>0}),S=j(()=>{const e=r.value.trim().toLowerCase();return sr[e]||e.charAt(0).toUpperCase()+e.slice(1)}),_=j(()=>(nr.value,ar(r.value.trim().toLowerCase().split(":")[0]))),B=j(()=>{const e=r.value.trim().toLowerCase();return t.isShowPreview&&("html"===e||"svg"===e)}),O=j(()=>{const e={},n=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},o=n(t.minWidth),l=n(t.maxWidth);return o&&(e.minWidth=o),l&&(e.maxWidth=l),e}),L=j(()=>{const e=t.estimatedContentHeightPx;return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.round(e):null}),C=j(()=>null!=L.value&&!p.value),A=j(()=>a({fontSize:`${M.value}px`},C.value?{minHeight:`${L.value}px`}:{})),H=j(()=>!1!==t.showTooltips);function z(){return t.isDark?t.darkTheme:t.lightTheme}function W(e){if(null==v||v.disconnect(),v=void 0,!e)return f.value="",void(p.value=!1);var n;f.value=`<pre class="shiki shiki-fallback"><code>${n=e,n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}</code></pre>`,p.value=!1}function P(){f.value="",p.value=!0}function K(){var e;const n=m.value;return!!n&&(n.childNodes.length>0||Boolean(null==(e=n.textContent)?void 0:e.trim().length))}function D(){return d(this,null,function*(){if(yield X(),K())return void P();const e=m.value;e&&(null==v||v.disconnect(),v=new MutationObserver(()=>{K()&&(P(),null==v||v.disconnect(),v=void 0)}),v.observe(e,{childList:!0,subtree:!0}))})}let Z,Y,J,ee,te=null;const oe=/* @__PURE__ */new Set,le=/* @__PURE__ */new Set,re=void 0!==import.meta&&Boolean(!1);let ae=null;function se(e,n){return d(this,null,function*(){if(!Z)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?!ee||ee.has(l)?l:(n&&re&&!oe.has(l)&&(oe.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 Z.updateCode(e,t)}catch(o){"plaintext"!==t?(re&&!le.has(t)&&(le.add(t),console.warn(`[MarkdownCodeBlockNode] Failed to render language "${t}", retrying as plaintext.`,o)),yield Z.updateCode(e,"plaintext")):re&&console.warn("[MarkdownCodeBlockNode] Failed to render code block even as plaintext.",o)}})}function ue(e){if(!J)return;const n=Array.isArray(e)?e.join("\0"):"";te!==n&&(J({themes:e}),te=n)}function de(){return d(this,null,function*(){w.value?(yield function(){return d(this,null,function*(){if(!Y)return ae||(ae=d(null,null,function*(){try{const e=yield import("stream-markdown");Y=e.createShikiStreamRenderer,J=e.registerHighlight;const n=Array.isArray(e.defaultLanguages)?e.defaultLanguages:void 0;ee=n?new Set(n.map(e=>e.toLowerCase())):void 0,ue(t.themes)}catch(e){console.warn("[MarkdownCodeBlockNode] stream-markdown not available:",e)}finally{ae=null}}),ae)})}(),h.value&&m.value?(ue(t.themes),!Z&&Y&&(Z=Y(m.value,{theme:z()}),p.value=!0),Z?!1===t.stream&&t.loading?W(t.node.code):(W(t.node.code),yield se(t.node.code,r.value),yield D()):W(t.node.code)):W(t.node.code)):W(t.node.code)})}function ce(){const e=h.value;if(!e||s.value)return;const n=e.scrollTop;n<k.value?N.value=!1:function(e,n=50){return e.scrollHeight-e.scrollTop-e.clientHeight<=n}(e)&&(N.value=!0),k.value=n}function he(){return d(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 me(e){if(s.value=!s.value,e&&H.value){const n=function(e){const n=e.currentTarget||e.target;return!n||n.disabled?null:n}(e);n&&kn(n,s.value?l("common.collapse")||"Collapse":l("common.expand")||"Expand","top",!1,void 0,t.isDark)}const n=h.value;n&&(s.value?(n.style.maxHeight="none",n.style["overflow-y"]="visible",n.style["overflow-x"]="auto"):(n.style.maxHeight="",n.style.overflow="auto",N.value=!0,X(()=>{n.scrollHeight>n.clientHeight&&(n.scrollTop=n.scrollHeight)})))}function ve(){u.value=!u.value}function ge(){const e=Math.min(36,M.value+1);M.value=e}function ye(){const e=Math.max(10,M.value-1);M.value=e}function we(){M.value=x.value}function Ne(){if(!B.value)return;const e=(r.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 fe(()=>{w.value?de():W(t.node.code)}),G(()=>{var e;null==(e=y.value)||e.destroy(),y.value=null,null==v||v.disconnect(),v=void 0}),U(()=>t.themes,()=>d(null,null,function*(){ue(t.themes)})),U(()=>t.loading,e=>{e||(w.value?de():W(t.node.code))}),U(()=>w.value,e=>{e&&de()}),U(H,e=>{e||xn()}),U(()=>[t.node.code,t.node.language],e=>d(null,[e],function*([e,n]){const o=lr(n);o!==r.value&&(r.value=o),w.value&&h.value&&m.value?(Z||(W(e),yield de()),Z&&e&&(!1===t.stream&&t.loading||(W(e),yield se(e,n),yield D()))):W(e)})),U(()=>[t.darkTheme,t.lightTheme,t.isDark],()=>d(null,null,function*(){w.value&&h.value&&m.value&&(Z||(yield de()),null==Z||Z.setTheme(z()))})),U(()=>t.node.code,()=>d(null,null,function*(){if(s.value||!N.value)return;yield X();const e=h.value;e&&e.scrollHeight>e.clientHeight&&(e.scrollTop=e.scrollHeight)})),(n,o)=>(T(),E("div",{ref_key:"container",ref:c,style:ne(O.value),class:F(["code-block-container rounded-lg border overflow-hidden",{dark:t.isDark}])},[I(Ar,{"show-header":t.showHeader,"show-collapse-button":t.showCollapseButton,"show-font-size-buttons":t.showFontSizeButtons,"enable-font-size-control":t.enableFontSizeControl,"show-copy-button":t.showCopyButton,"show-expand-button":t.showExpandButton,"show-preview-button":t.showPreviewButton,"show-tooltips":t.showTooltips,"is-dark":t.isDark,loading:t.loading,stream:t.stream,"is-collapsed":u.value,"is-expanded":s.value,"copy-text":i.value,"is-previewable":B.value,"code-font-size":M.value,"code-font-min":10,"code-font-max":36,"default-code-font-size":x.value,"font-baseline-ready":b.value,onToggleCollapse:ve,onDecreaseFont:ye,onResetFont:we,onIncreaseFont:ge,onCopy:he,onToggleExpand:me,onPreview:Ne},pe({"header-left":Q(()=>[ie(n.$slots,"header-left",{},()=>[$("div",$r,[$("span",{class:"icon-slot h-4 w-4 flex-shrink-0",innerHTML:_.value},null,8,Hr),$("div",zr,[$("div",Rr,R(S.value),1)])])],!0)]),loading:Q(()=>[ie(n.$slots,"loading",{loading:e.loading,stream:e.stream},()=>[o[0]||(o[0]=$("div",{class:"loading-skeleton"},[$("div",{class:"skeleton-line"}),$("div",{class:"skeleton-line"}),$("div",{class:"skeleton-line short"})],-1))],!0)]),default:Q(()=>[$("div",{ref_key:"codeBlockContent",ref:h,class:"code-block-content",style:ne(A.value),onScroll:ce},[$("div",{ref_key:"rendererTarget",ref:m,class:"code-block-render"},null,512),p.value?q("",!0):(T(),E("div",{key:0,class:"code-fallback-plain",innerHTML:f.value},null,8,Wr))],36)]),_:2},[n.$slots["header-right"]?{name:"header-right",fn:Q(()=>[ie(n.$slots,"header-right",{},void 0,!0)]),key:"0"}:void 0]),1032,["show-header","show-collapse-button","show-font-size-buttons","enable-font-size-control","show-copy-button","show-expand-button","show-preview-button","show-tooltips","is-dark","loading","stream","is-collapsed","is-expanded","copy-text","is-previewable","code-font-size","default-code-font-size","font-baseline-ready"])],6))}}),[["__scopeId","data-v-b0adc686"]]);Pr.install=e=>{e.component(Pr.__name,Pr)};const jr=["data-custom-id"],Fr={class:"m-0 p-0"},Kr=["data-probe"],Dr=["data-node-index","data-node-type"],Vr=/* @__PURE__ */Se(/* @__PURE__ */C({__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},renderAsFragment:{type:Boolean}},emits:["copy","handleArtifactClick","click","mouseover","mouseout"],setup(e,{emit:n}){var t,o;const l=e,r=n,i=V(),u=V(null),c=V(null),h=V(null),m=ve({1:null,2:null,3:null,4:null,5:null,6:null}),f=V(!1),p=/auto|scroll|overlay/i,v="undefined"!=typeof window,g=j(()=>!0===l.renderAsFragment),y=j(()=>l.debugPerformance&&v&&"undefined"!=typeof console),w=K(),N=/* @__PURE__ */new Map,k=V(0),L=V(0),C=V({paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}}),R=j(()=>{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 W(e,n){y.value&&console.info(`[markstream-vue][perf] ${e}`,n)}function P(e){if(!e)return!1;const n=(e.overflowY||"").toLowerCase(),t=(e.overflow||"").toLowerCase();return p.test(n)||p.test(t)}function D(e){const n=Math.ceil(e.scrollHeight)>Math.ceil(e.clientHeight)+1,t=Math.ceil(e.scrollWidth)>Math.ceil(e.clientWidth)+1;return n||t}function Y(e){if("undefined"==typeof window)return null;const n=null!=e?e:i.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;){if(P(window.getComputedStyle(l))&&D(l))return l;l=l.parentElement}return null}ce("markstreamShowTooltips",R),ce("markstreamTypewriter",j(()=>!1!==l.typewriter)),ce("markstreamTextStreamState",N),ce("markstreamStreamVersion",k),U([()=>l.content,()=>l.nodes],()=>{k.value+=1},{immediate:!0});const ee=l.customId?`renderer-${l.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,te=b(ee),oe=/* @__PURE__ */new Map,le=j(()=>(Pe.value,Fe(l.customId))),re=j(()=>{var e;return S(l.customHtmlTags,null==(e=l.parseOptions)?void 0:e.customHtmlTags)}),ie=j(()=>{const{key:e,tags:n}=_(re.value);if(!e)return te;const t=oe.get(e);if(t)return t;const o=b(ee,{customHtmlTags:n});return oe.set(e,o),o}),ae=j(()=>{const e=ie.value;return l.customMarkdownIt?l.customMarkdownIt(e):e}),he=j(()=>{var e,n;const t=null!=(e=l.parseOptions)?e:{},o=null!=(n=l.final)?n:t.final,r=re.value,i=null!=o,s=r.length>0;return i||s?a(a(a({},t),i?{final:o}:{}),s?{customHtmlTags:r}:{}):t}),me=j(()=>{var e;const n=null!=(e=he.value.customHtmlTags)?e:[];return new Set(n.map(e=>String(e).trim().toLowerCase()).filter(Boolean))}),fe=j(()=>{var e;if(null==(e=l.nodes)?void 0:e.length)return ge(l.nodes.slice());if(l.content){const e=y.value?performance.now():0,n=B(l.content,ae.value,he.value);return y.value&&W("parse(sync)",{ms:Math.round(performance.now()-e),nodes:n.length,contentLength:l.content.length}),ge(n)}return[]}),pe=V(null),ye=V(null),we=V(null),Ne=V(null),ke=null!=l.indexKey&&String(l.indexKey).startsWith("list-item-"),xe=!ke&&l.customId?Ml(l.customId):null,Me=j(()=>xe?(xl.value,Ml(l.customId)):null),be=j(()=>{var e;return Boolean(v&&!g.value&&l.customId&&!ke&&(null==(e=Me.value)?void 0:e.enabled))}),Se=j(()=>{var e;return be.value&&!1!==(null==(e=Me.value)?void 0:e.textEstimation)}),Be=j(()=>{var e;return be.value&&!1!==(null==(e=Me.value)?void 0:e.codeBlockEstimation)}),Oe=j(()=>{var e;return Math.max(320,L.value||(null==(e=i.value)?void 0:e.clientWidth)||640)}),Le=j(()=>{var e;return Math.max(1,null!=(e=l.maxLiveNodes)?e:320)}),Te=j(()=>{var e;return!g.value&&!((null!=(e=l.maxLiveNodes)?e:0)<=0)&&fe.value.length>Le.value}),Ee=j(()=>Te.value||be.value),Ie=j(()=>!1!==l.viewportPriority&&!f.value),$e=Et(e=>{var n;return Y(null!=(n=null!=e?e:i.value)?n:null)},Ie),ze=v&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame.bind(window):null,Re=v&&"function"==typeof window.cancelAnimationFrame?window.cancelAnimationFrame.bind(window):null,We="undefined"!=typeof globalThis&&"process"in globalThis?null==(t=globalThis.process)?void 0:t.env:void 0,je="test"===(null==We?void 0:We.NODE_ENV),Ke=v&&"function"==typeof window.requestIdleCallback,De=j(()=>{var e;const n=Math.trunc(null!=(e=l.renderBatchSize)?e:80);return Number.isFinite(n)?Math.max(0,n):0}),Ve=j(()=>{var e;const n=Math.trunc(null!=(e=l.initialRenderBatchSize)?e:De.value);return Number.isFinite(n)?Math.max(0,n):De.value}),Ue=j(()=>!g.value&&!1!==l.batchRendering&&De.value>0&&v&&!je),Xe=V(0),Ge=V({key:l.indexKey,total:0}),Ze=V(Math.max(1,De.value||1)),Ye=V(/* @__PURE__ */new Set),Je=/* @__PURE__ */new Map,Qe=/* @__PURE__ */new Map,en=/* @__PURE__ */new Map,tn=/* @__PURE__ */new Map,on=/* @__PURE__ */new Map,rn=/* @__PURE__ */new WeakMap,an=V(0),sn=j(()=>(an.value,Array.from(tn.entries()).sort((e,n)=>e[0]-n[0]))),un=V(0),dn=V([]),cn=V([]),hn=V(null),mn=V(null);let fn=null,pn=[],vn=null,gn=null;const yn=j(()=>{var e;return!g.value&&!1!==l.deferNodesUntilVisible&&!((null!=(e=l.maxLiveNodes)?e:0)<=0)&&!Te.value&&!(fe.value.length>900)&&Ie.value}),wn=j(()=>{var e;return Ue.value&&(null!=(e=l.maxLiveNodes)?e:0)<=0}),Nn=V({batchSize:De.value,initial:Ve.value,delay:null!=(o=l.renderBatchDelay)?o:16,enabled:wn.value}),kn=j(()=>!!$e&&(yn.value||Te.value)),xn=j(()=>{var e;return Math.max(0,null!=(e=l.liveNodeBuffer)?e:60)}),Mn=V(0),bn=ve({start:0,end:0}),Sn=/* @__PURE__ */new Map,_n=/* @__PURE__ */new Map,Bn=j(()=>{if(!Te.value)return fe.value.length;const e=xn.value,n=Math.max(bn.end+e,Ve.value),t=Math.min(fe.value.length,n);return Math.max(Xe.value,t)});function On(e){var n,t;return null!=(t=null==(n=Ne.value)?void 0:n[e])?t:null}function Ln(e){var n,t,o,l;const r=Y(null!=(n=null!=e?e:i.value)?n:null);if(r)return r;const a=null!=(l=null!=(o=null==e?void 0:e.ownerDocument)?o:null==(t=i.value)?void 0:t.ownerDocument)?l:"undefined"!=typeof document?document:null;return(null==a?void 0:a.scrollingElement)||(null==a?void 0:a.documentElement)||null}function Cn(e){if(!v)return!1;try{const n=window.getComputedStyle(e);return!!(n.display||"").toLowerCase().includes("flex")&&(n.flexDirection||"").toLowerCase().endsWith("reverse")}catch(n){return!1}}function Tn(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 u=e.scrollTop;if(!Cn(e))return u;const d=u<0?-u:u;return Math.max(0,(null!=(a=e.scrollHeight)?a:0)-(null!=(s=e.clientHeight)?s:0))-d}function En(e,n){let t=e,o=0,l=0;for(;t&&t!==n&&l++<64;)o+=t.offsetTop||0,t=t.offsetParent;return o}function An(){vn&&(vn(),vn=null),hn.value=null}function $n(){if(!v||!Te.value)return;const e=Ln();if(!e||hn.value===e)return;An();const n=()=>zn();e.addEventListener("scroll",n,{passive:!0}),hn.value=e,vn=()=>{e.removeEventListener("scroll",n)}}function Hn(){var e,n,t;if(!gn)return;const o=null!=(t=null==(n=null==(e=i.value)?void 0:e.ownerDocument)?void 0:n.defaultView)?t:"undefined"!=typeof window?window:null;gn.viaTimeout?o?o.clearTimeout(gn.id):clearTimeout(gn.id):null==Re||Re(gn.id),gn=null}function zn(e={}){var n,t,o;if(!Te.value)return;if(!v)return void Rn(!0);if(e.immediate)return Hn(),void Rn(!0);if(gn)return;const l=()=>{gn=null,Rn()};if(ze)gn={id:ze(l),viaTimeout:!1};else{const e=null!=(o=null==(t=null==(n=i.value)?void 0:n.ownerDocument)?void 0:t.defaultView)?o:"undefined"!=typeof window?window:null,r=e?e.setTimeout(l,16):setTimeout(l,16);gn={id:r,viaTimeout:!0}}}function Rn(e=!1){var n,t,o,l,r,a,s;if(!Te.value)return;const u=hn.value||Ln();if(!u)return;const d=u.ownerDocument||(null==(n=i.value)?void 0:n.ownerDocument)||document,c=(null==d?void 0:d.defaultView)||("undefined"!=typeof window?window:null),h=u===(null==d?void 0:d.documentElement)||u===(null==d?void 0:d.body),m=fe.value.length;if(!h&&m>0&&Cn(u)){const n=u.clientHeight||0,t=u.scrollTop,o=t<0?-t:t,l=function(e){var n;const t=fe.value;if(!t.length)return 0;if(e<=0)return Math.max(0,t.length-1);if(be.value){let n=e;for(let e=t.length-1;e>=0;e--){const t=ct(e);if(n<=t)return e;n-=t}return 0}if(un.value===t.length){const n=Bt(0,t.length);return Ht(Math.max(0,n-e))}let o=e;for(let l=t.length-1;l>=0;l--){const e=null!=(n=Pn[l])?n:qn.value;if(o<=e)return l;o-=e}return 0}(Math.max(0,o)+.5*Math.max(0,n)),r=Wn(l,0,Math.max(0,m-1));return void((e||Math.abs(r-Mn.value)>1)&&(Mn.value=r))}const f=h?null:u.getBoundingClientRect(),p=h?0:f.top,v=h?null!=(o=null!=(t=null==c?void 0:c.innerHeight)?t:u.clientHeight)?o:0:f.bottom,g=sn.value;let y=null,w=null;for(const[i,k]of g){if(!k)continue;const e=k.getBoundingClientRect();e.bottom<=p||e.top>=v||(null==y&&(y=i),w=i)}if(null==y||null==w){const e=i.value;if(!e)return;const n=h?{top:0}:u.getBoundingClientRect(),t=Tn(u,d,h),o=h?(()=>{const t=e.getBoundingClientRect(),o=(h?0:n.top)-t.top;return Math.max(0,o)})():(()=>{const n=En(e,u);return Math.max(0,t-n)})(),m=h?null!=(s=null!=(a=null!=(r=null==c?void 0:c.innerHeight)?r:null==(l=null==d?void 0:d.documentElement)?void 0:l.clientHeight)?a:u.clientHeight)?s:0:u.clientHeight,f=Ht(o+.5*Math.max(0,m));return void(Mn.value=Wn(f,0,Math.max(0,fe.value.length-1)))}const N=Math.round((y+w)/2);!e&&Math.abs(N-Mn.value)<=1||(Mn.value=Wn(N,0,Math.max(0,fe.value.length-1)))}function Wn(e,n,t){return Math.min(Math.max(e,n),t)}const Pn=ve({}),jn=ve({total:0,count:0});function Fn(){for(const e of Object.keys(Pn))delete Pn[Number(e)];jn.total=0,jn.count=0,un.value=0,dn.value=[],cn.value=[]}function Kn(e,n,t){for(let o=n+1;o<e.length;o+=o&-o)e[o]+=t}function Dn(e,n){let t=0;for(let o=n+1;o>0;o-=o&-o)t+=e[o];return t}function Vn(e,n,t){if(t<=n)return 0;const o=Dn(e,t-1);return n<=0?o:o-Dn(e,n-1)}function Un(e){un.value=e;const n=new Array(e+1).fill(0),t=new Array(e+1).fill(0);for(const[o,l]of Object.entries(Pn)){const r=Number(o),i=Number(l);!Number.isFinite(r)||r<0||r>=e||!Number.isFinite(i)||i<=0||(Kn(n,r,i),Kn(t,r,1))}dn.value=n,cn.value=t}const qn=j(()=>jn.count>0?Math.max(12,jn.total/jn.count):32);function Xn(e){return null==e?void 0:e.firstElementChild}function Qn(e,n){var t;return e?(null==(t=e.matches)?void 0:t.call(e,n))?e:e.querySelector(n):null}function et(){var e,n;if(!be.value)return void(L.value=0);const t=null!=(n=null==(e=i.value)?void 0:e.clientWidth)?n:0;L.value=t>0?t:0}let tt=null;function ot(){null==tt||tt.disconnect(),tt=null}const rt=se(()=>d(null,null,function*(){try{return(yield import("./CodeBlockNode.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),Ft}})),at=j(()=>l.renderCodeBlocksAsPre?Ft:rt);function ut(){var e;return!1!==(null==(e=l.codeBlockProps)?void 0:e.showHeader)}const dt=j(()=>{var e;const n=fe.value;if(!n.length||!be.value)return n.map(()=>null);const t=L.value||(null==(e=i.value)?void 0:e.clientWidth)||0;return!Number.isFinite(t)||t<=0?n.map(()=>null):n.map((e,n)=>{const o=Pn[n],r="number"==typeof o&&o>0;if(Se.value&&!r){const n=Ol(e,t,C.value);if(n)return n}if(Be.value&&"code_block"===e.type){const n=function(e){if("code_block"!==e.type)return null;const n=ko(e,No(e));return n===Pr?"markdown":n===Ft?"pre":n===at.value||n===rt?"monaco":null}(e);if("monaco"===n||"markdown"===n)return function(e,n){var t;if(!e||"code_block"!==e.type)return null;const o=n.rendererKind,l=!1!==n.showHeader,r=function(e){var n,t,o,l;return e.diff?Math.max(Ll(String(null!=(n=e.originalCode)?n:"")),Ll(String(null!=(t=e.updatedCode)?t:"")),Ll(String(null!=(o=e.code)?o:""))):Ll(String(null!=(l=e.code)?l:""))}(e),i=Boolean(e.diff);let a=0,s=500;if("monaco"===o){const e=null!=(t=n.monacoOptions)?t:{},o=function(e,n){const t="number"==typeof(null==e?void 0:e.fontSize)&&e.fontSize>0?e.fontSize:n?13:12;return"number"==typeof(null==e?void 0:e.lineHeight)&&e.lineHeight>0?e.lineHeight:n?30:Math.round(1.5*t)}(e,i),l=function(e,n){var t,o;if(!n)return 0;const l="number"==typeof(null==(t=null==e?void 0:e.padding)?void 0:t.top)?e.padding.top:10,r="number"==typeof(null==(o=null==e?void 0:e.padding)?void 0:o.bottom)?e.padding.bottom:22;return Math.max(0,l)+Math.max(0,r)}(e,i);s="number"==typeof e.MAX_HEIGHT&&e.MAX_HEIGHT>0?e.MAX_HEIGHT:500,a=i?Math.round(r*o+l):Math.round(r*(o+1.5))}else"markdown"===o?a=Math.round(21*r+32):(a=Math.round(21*r+32),s=Number.POSITIVE_INFINITY);const u=Math.max(1,Math.min(a,s));return{kind:"code-block",height:Math.round(u+(l?40:0)),contentHeight:u,rendererKind:o}}(e,{rendererKind:n,monacoOptions:l.codeBlockMonacoOptions,showHeader:ut()})}return null})});function ct(e){var n,t,o;return null!=(o=null!=(t=Pn[e])?t:null==(n=dt.value[e])?void 0:n.height)?o:qn.value}function ht(){const e=hn.value||Ln(),n=i.value;if(!e||!n)return null;const t=e.ownerDocument||n.ownerDocument||document;if(e===t.documentElement||e===t.body||e===t.scrollingElement){const e=n.getBoundingClientRect();return Math.max(0,-e.top)}return Math.max(0,Tn(e,t,!1)-En(n,e))}function ft(e){return Bt(0,Wn(e.nodeIndex,0,Math.max(0,fe.value.length-1)))+Math.max(0,e.offsetWithinNodePx)}function vt(){if(null!=fn&&(null==Re||Re(fn),fn=null),v)for(const e of pn)window.clearTimeout(e);pn=[]}function yt(e){!function(e){var n;const t=hn.value||Ln(),o=i.value;if(!t||!o)return;const l=Math.max(0,e),r=t.ownerDocument||o.ownerDocument||document,a=r.defaultView||("undefined"!=typeof window?window:null);if(t===r.documentElement||t===r.body||t===r.scrollingElement){const e=Tn(t,r,!0)+o.getBoundingClientRect().top;return void(null==(n=null==a?void 0:a.scrollTo)||n.call(a,0,Math.max(0,e+l)))}t.scrollTop=En(o,t)+l}(ft(e))}function Nt(){mn.value&&v&&null==fn&&(fn=ze?ze(()=>{fn=null,mn.value&&yt(mn.value)}):null,null==fn&&mn.value&&yt(mn.value))}function xt(){const e=ht(),n=fe.value.length;if(null==e||n<=0)return null;const t=Wn(Ht(e+1),0,n-1),o=Bt(0,t),l=ct(t);return{nodeIndex:t,offsetWithinNodePx:Wn(e-o,0,Math.max(0,l-1))}}function Mt(e){if(mn.value={nodeIndex:Wn(e.nodeIndex,0,Math.max(0,fe.value.length-1)),offsetWithinNodePx:Math.max(0,e.offsetWithinNodePx)},vt(),yt(mn.value),v)for(const n of[0,120,280,480])pn.push(window.setTimeout(()=>{mn.value&&yt(mn.value)},n))}function St(e){const n=ht();return null==n?null:n-ft(e)}function Bt(e,n){var t,o;if(e>=n)return 0;if(be.value){let t=0;for(let o=e;o<n;o++)t+=ct(o);return t}if(un.value!==fe.value.length){let o=0;for(let l=e;l<n;l++)o+=null!=(t=Pn[l])?t:qn.value;return o}const l=dn.value,r=cn.value;if(!l.length||!r.length){let t=0;for(let l=e;l<n;l++)t+=null!=(o=Pn[l])?o:qn.value;return t}return Vn(l,e,n)+(n-e-Vn(r,e,n))*qn.value}U(()=>fe.value.length,e=>{e<=0?Fn():(e<un.value&&function(e){if(e<=0)return void Fn();let n=0,t=0;for(const[o,l]of Object.entries(Pn)){const r=Number(o),i=Number(l);!Number.isFinite(r)||r<0||r>=e||!Number.isFinite(i)||i<=0?delete Pn[r]:(n+=i,t++)}jn.total=n,jn.count=t}(e),e!==un.value&&Un(e))},{immediate:!0});const Tt=j(()=>{if(!Te.value)return fe.value.map((e,n)=>({node:e,index:n}));const e=fe.value.length,n=Wn(bn.start,0,e),t=Wn(bn.end,n,e);return fe.value.slice(n,t).map((e,t)=>({node:e,index:n+t}))}),It=j(()=>Te.value?Bt(0,Math.min(bn.start,fe.value.length)):0),At=j(()=>{if(!Te.value)return 0;const e=fe.value.length;return Bt(Math.min(bn.end,e),e)});function $t(){var e;const n=fe.value;return{totalNodes:n.length,measuredCount:jn.count,estimatedCount:dt.value.filter(Boolean).length,averageNodeHeight:qn.value,topSpacerHeight:It.value,bottomSpacerHeight:At.value,estimatedTotalHeight:Bt(0,n.length),width:L.value||(null==(e=i.value)?void 0:e.clientWidth)||0,probe:{paragraphReady:Boolean(C.value.paragraph),listItemReady:Boolean(C.value.listItem),listWrapperOverhead:C.value.listWrapperOverhead,headingReadyLevels:Object.entries(C.value.headings).filter(([,e])=>Boolean(e)).map(([e])=>Number(e))},nodes:n.map((e,n)=>{var t,o,l,r,i,a,s,u,d;return{index:n,type:e.type,estimateKind:null!=(o=null==(t=dt.value[n])?void 0:t.kind)?o:null,rendererKind:null!=(r=null==(l=dt.value[n])?void 0:l.rendererKind)?r:null,estimatedHeight:null!=(a=null==(i=dt.value[n])?void 0:i.height)?a:null,estimatedContentHeight:null!=(u=null==(s=dt.value[n])?void 0:s.contentHeight)?u:null,measuredHeight:null!=(d=Pn[n])?d:null}})}}function Ht(e){var n;if(e<=0)return 0;const t=fe.value;if(be.value){let n=e;for(let e=0;e<t.length;e++){const t=ct(e);if(n<=t)return e;n-=t}return Math.max(0,t.length-1)}if(un.value===t.length&&dn.value.length&&cn.value.length){const n=qn.value,o=dn.value,l=cn.value,r=e=>e<=0?0:Dn(o,e-1)+(e-Dn(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=Pn[l])?n:qn.value;if(o<=e)return l;o-=e}return Math.max(0,t.length-1)}function Rt(){an.value+=1}function Pt(e,n){const t=Ye.value,o=t.has(e);if(n){if(o)return;const n=new Set(t);return n.add(e),void(Ye.value=n)}if(!o)return;const l=new Set(t);l.delete(e),Ye.value=l}function jt(){0!==Ye.value.size&&(Ye.value=/* @__PURE__ */new Set)}function Kt(e){if(!Je.size)return;if(!Te.value)return;let n=!1;for(const[t,o]of Je)t>=e&&(o.destroy(),Je.delete(t),yn.value&&Pt(t,!1),oo(t),tn.delete(t)&&(n=!0));n&&Rt()}function Dt(e,n){yn.value&&Pt(e,n),n&&(Te.value?zn():Mn.value=Wn(e,0,Math.max(0,fe.value.length-1)))}function Vt(e){const n=Qe.get(e);n&&(n(),Qe.delete(e));const t=Je.get(e);t&&(t.destroy(),Je.delete(e)),oo(e)}function Ut(e,n){let t=!1;if(n){const o=tn.get(e);tn.set(e,n),o!==n&&(t=!0)}else tn.delete(e)&&(t=!0);if(t&&Rt(),n||oo(e),!kn.value||!$e)return Vt(e),void(n&&Dt(e,!0));if(!Te.value&&yn.value&&!f.value&&Je.size>=640&&(function(){if(!f.value){f.value=!0;for(const e of Je.values())e.destroy();if(Je.clear(),v)for(const e of en.values())window.clearTimeout(e);en.clear(),jt()}}(),!kn.value||!$e))return Vt(e),void(n&&Dt(e,!0));if(e<Ve.value&&!Te.value)return Vt(e),void Dt(e,!0);if(Ye.value.has(e))return Vt(e),void Dt(e,!0);if(!n)return void Vt(e);Vt(e);const o=$e(n,{rootMargin:"400px"});if(!o)return;Je.set(e,o),Dt(e,o.isVisible.value),yn.value&&function(e){if(!v||!yn.value)return;oo(e);const n=e%17*23,t=window.setTimeout(()=>{var n,t;if(en.delete(e),!yn.value)return;if(Ye.value.has(e))return;const o=tn.get(e);if(!o)return;const l=Ln(o),r=o.ownerDocument||document,i=r.defaultView||window,a=!l||l===r.documentElement||l===r.body,s=!a&&l?l.getBoundingClientRect():null,u=a?0:s.top,d=a?null!=(t=null!=(n=i.innerHeight)?n:null==l?void 0:l.clientHeight)?t:0:s.bottom,c=o.getBoundingClientRect();c.bottom>=u-500&&c.top<=d+500&&Dt(e,!0)},1800+n);en.set(e,t)}(e);let l=null;l=U(()=>o.isVisible.value,n=>{if(n){oo(e),Dt(e,!0),null==l||l(),Qe.delete(e),Je.get(e)===o&&Je.delete(e);try{o.destroy()}catch(t){}}},{immediate:!0}),Qe.set(e,l),Te.value&&zn()}U(()=>Ee.value,e=>{if(!e){for(const e of on.values())e.disconnect();on.clear();for(const e of _n.values())for(const n of e)window.clearTimeout(n);_n.clear()}},{immediate:!0});let qt=null,Gt=null,Yt=!1,eo=null,no=null;function to(){v&&(null!=qt&&(null==Re||Re(qt),qt=null),null!=Gt&&(window.clearTimeout(Gt),Gt=null),null!=no&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(no),no=null),Yt=!1,eo=null)}function oo(e){if(!v)return;const n=en.get(e);null!=n&&(window.clearTimeout(n),en.delete(e))}function lo(e,n={}){var t,o;if(!wn.value)return;const r=Bn.value;if(Xe.value>=r)return;const i=Math.max(1,e),a=e=>{var n;qt=null,Gt=null,no=null,Yt=!1;const t=null!=eo?eo:i;eo=null;const o=Math.max(2,null!=(n=l.renderBatchBudgetMs)?n:6),a=e=>{const n="undefined"!=typeof performance?performance.now():Date.now();Xe.value=Math.min(r,Xe.value+Math.max(1,e)),Kt(Xe.value);const t=("undefined"!=typeof performance?performance.now():Date.now())-n;return function(e){var n;if(!wn.value)return;const t=Math.max(2,null!=(n=l.renderBatchBudgetMs)?n:6),o=Math.max(1,De.value||1),r=Math.max(1,Math.floor(o/4));e>1.2*t?Ze.value=Math.max(r,Math.floor(.7*Ze.value)):e<.5*t&&Ze.value<o&&(Ze.value=Math.min(o,Math.ceil(1.2*Ze.value)))}(t),t};let s=t;for(;(a(s),!(Xe.value>=r)&&e)&&!(("function"==typeof e.timeRemaining?e.timeRemaining():0)<=.5*o);)s=Math.max(1,Math.round(Ze.value));Xe.value<r&&ro()};if(!v||n.immediate)return void a();const s=Math.max(0,null!=(t=l.renderBatchDelay)?t:16);if(eo=null!=eo?Math.max(eo,i):i,!Yt){if(Yt=!0,!je&&Ke&&window.requestIdleCallback){const e=Math.max(0,null!=(o=l.renderBatchIdleTimeoutMs)?o:120);return void(no=window.requestIdleCallback(e=>{a(e)},{timeout:e}))}ze&&!je?qt=ze(()=>{0!==s?Gt=window.setTimeout(()=>a(),s):a()}):Gt=window.setTimeout(()=>a(),s)}}function ro(){wn.value&&lo(Ue.value?Math.max(1,Math.round(Ze.value)):Math.max(1,De.value))}U([()=>fe.value,()=>fe.value.length,()=>wn.value,()=>De.value,()=>Ve.value,()=>l.renderBatchDelay,()=>l.indexKey],()=>{var e;const n=fe.value.length,t=Ge.value,o=l.indexKey,r=void 0!==o&&o!==t.key,i=n!==t.total,a=r||i;Ge.value={key:o,total:n};const s=Nn.value,u=null!=(e=l.renderBatchDelay)?e:16,d=s.batchSize!==De.value||s.initial!==Ve.value||s.delay!==u||s.enabled!==wn.value;Nn.value={batchSize:De.value,initial:Ve.value,delay:u,enabled:wn.value},r&&(Fn(),n>0&&Un(n)),(a||d||!wn.value)&&to(),(a||d)&&(Ze.value=Math.max(1,De.value||1)),a&&Te.value&&zn({immediate:!0});const c=Bn.value;if(!n)return Xe.value=0,void Kt(0);if(!wn.value)return Xe.value=c,void Kt(Xe.value);const h=r||0===t.total;Xe.value=h||d?Math.min(c,Ve.value):Math.min(Xe.value,c);const m=Math.max(1,Ve.value||De.value||n);Xe.value<c?lo(m,{immediate:!v}):Kt(Xe.value)},{immediate:!0}),U(()=>Te.value,e=>{if(!e)return An(),void Hn();$n(),zn({immediate:!0})},{immediate:!0}),U([()=>fe.value.length,()=>Te.value],e=>d(null,[e],function*([e,n]){n&&e&&v&&(yield X(),zn({immediate:!0}))}),{flush:"post"}),U(()=>i.value,()=>{Te.value&&($n(),zn({immediate:!0}))}),U(be,e=>{e&&function(){var e;if(pe.value&&ye.value&&we.value&&(null==(e=Ne.value)?void 0:e[1]))return;const n=ge({type:"paragraph",children:[{type:"text",content:"Probe paragraph text",raw:"Probe paragraph text"}],raw:"Probe paragraph text"}),t=ge({type:"list_item",children:[n],raw:"- Probe paragraph text"}),o=ge({type:"list",ordered:!1,items:[t],raw:"- Probe paragraph text"});pe.value=n,ye.value=t,we.value=o;const l={1:null,2:null,3:null,4:null,5:null,6:null};for(let r=1;r<=6;r++)l[r]=ge({type:"heading",level:r,text:"Probe heading",children:[{type:"text",content:"Probe heading",raw:"Probe heading"}],raw:`${"#".repeat(r)} Probe heading`});Ne.value=l}()},{immediate:!0}),U([()=>i.value,be],()=>{if(!be.value)return ot(),void(L.value=0);et(),ot(),be.value&&i.value&&"undefined"!=typeof ResizeObserver&&(tt=new ResizeObserver(()=>{et(),mn.value&&Nt()}),tt.observe(i.value))},{immediate:!0}),U([be,Oe],()=>d(null,null,function*(){be.value?(yield X(),function(){var e,n,t,o;if(!be.value||"undefined"==typeof window)return void(C.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}});const l={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},r=Qn(Xn(u.value),".paragraph-node");l.paragraph=Tl(u.value,r,"pre-wrap");const i=Xn(c.value),a=null==i?void 0:i.querySelector(".paragraph-node");l.listItem=Tl(c.value,a,"pre-wrap");const s=null!=(n=null==(e=h.value)?void 0:e.offsetHeight)?n:0,d=null!=(o=null==(t=c.value)?void 0:t.offsetHeight)?o:0;l.listWrapperOverhead=Math.max(0,s-d);for(let u=1;u<=6;u++){const e=Qn(Xn(m[u]),`h${u}`);l.headings[u]=Tl(m[u],e,"pre-wrap")}C.value=l}()):C.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}}}),{flush:"post",immediate:!0}),U(()=>fe.value.length,()=>{Te.value&&zn({immediate:!0})}),U([be,L],()=>{Te.value&&zn({immediate:!0}),mn.value&&Nt()},{immediate:!1}),U(()=>yn.value,e=>{if(e)for(const[n,t]of tn)Ut(n,t);else{for(const e of Je.values())e.destroy();Je.clear();for(const e of Array.from(en.keys()))oo(e);jt();for(const[e,n]of tn)n&&Dt(e,!0)}},{immediate:!1}),U([()=>l.viewportPriority,()=>fe.value.length],([e,n])=>{!1!==e?f.value&&n<=200&&(f.value=!1):f.value=!1}),U(()=>Xe.value,()=>{Te.value&&zn({immediate:!0})}),U([Mn,Le,xn,()=>fe.value.length,Te],()=>{!function(){const e=fe.value.length;if(!Te.value||0===e)return bn.start=0,void(bn.end=e);const n=Math.min(Le.value,e),t=xn.value,o=Wn(Mn.value-t,0,Math.max(0,e-n));bn.start=o,bn.end=Math.min(e,o+n)}()},{immediate:!0}),U([()=>fe.value.length,Te,Le,xn,()=>bn.start,()=>bn.end],([e,n,t,o,l,r])=>{y.value&&W("virtualization",{nodes:e,virtualization:n,maxLiveNodes:t,buffer:o,focusIndex:Mn.value,scroll:n?(()=>{const e=hn.value||Ln();return e?{reverse:Cn(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:Xe.value})}),U(()=>Bn.value,(e,n)=>{wn.value&&("number"==typeof n&&e<=n||e>Xe.value&&ro())}),U([()=>l.customId],([e],n,t)=>{if(!e||ke)return;const o=function(e,n){return e?(Nl.controllers[e]=n,()=>{Nl.controllers[e]===n&&delete Nl.controllers[e]}):()=>{}}(e,{captureRestoreAnchor:xt,restoreAnchor:Mt,getAnchorDrift:St,getReport:$t});t(()=>{o()})},{immediate:!0}),G(()=>{to();for(const e of Je.values())e.destroy();Je.clear();for(const e of on.values())e.disconnect();on.clear();for(const e of _n.values())for(const n of e)window.clearTimeout(n);_n.clear();for(const e of Qe.values())e();Qe.clear();for(const e of Array.from(en.keys()))oo(e);ot(),vt(),An(),Hn()});const io=se(()=>d(null,null,function*(){try{return(yield import("./index4.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),Ft}})),ao=se(()=>d(null,null,function*(){try{return(yield import("./index5.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),Ft}})),so=se(()=>d(null,null,function*(){try{return(yield import("./index6.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),Ft}})),uo={text:Gn,paragraph:Wt,heading:Ot,code_block:rt,list:Ct,list_item:Lt,blockquote:_e,table:Xt,definition_list:Ae,footnote:bt,footnote_reference:qe,footnote_anchor:kt,admonition:ei,vmr_container:Qt,hardbreak:_t,link:mt,image:In,thematic_break:Zt,math_inline:Zn,math_block:Yn,strong:it,emphasis:wt,strikethrough:st,highlight:gt,insert:pt,subscript:lt,superscript:nt,emoji:He,checkbox:Ce,checkbox_input:Ce,inline_code:ln,html_inline:nn,reference:Jn,html_block:zt},co=j(()=>null!=l.indexKey?String(l.indexKey):"markdown-renderer"),ho=j(()=>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 R.value?{showTooltips:R.value}:{}),l.codeBlockProps||{})),mo=j(()=>a({},l.mermaidProps||{})),fo=j(()=>a({},l.d2Props||{})),po=j(()=>a({},l.infographicProps||{})),vo=j(()=>({typewriter:l.typewriter,customHtmlTags:he.value.customHtmlTags})),go=j(()=>a(a({},vo.value),"boolean"==typeof R.value?{showTooltip:R.value}:{})),yo=j(()=>a(a({},vo.value),"boolean"==typeof R.value?{showTooltips:R.value}:{})),wo=j(()=>Tt.value.map(e=>{var n,t,o,l;let r=function(e){var n,t,o,l,r,i,s;if("code_block"!==e.type)return e;const u=e,d=[String(null!=(n=u.language)?n:""),String(null!=(t=u.loading)?t:""),String(null!=(o=u.diff)?o:""),String(null!=(l=u.code)?l:""),String(null!=(r=u.originalCode)?r:""),String(null!=(i=u.updatedCode)?i:""),String(null!=(s=u.raw)?s:"")].join("\0"),c=rn.get(u);if(c&&c.signature===d)return c.node;const h=a({},u);return rn.set(u,{signature:d,node:h}),h}(e.node);const i=No(r);let u=ko(r,i);if(("html_block"===r.type||"html_inline"===r.type)&&u===uo[r.type]){const e=r,i=String(null!=(n=e.tag)?n:"").trim().toLowerCase()||x(e.content);if(i){const n=le.value[i];if(me.value.has(i)&&n)u=n,r=s(a({},e),{type:i,tag:i,content:O(e.content,i)});else if(M(null!=(t=e.content)?t:e.raw,i)){const n=String(null!=(l=null!=(o=e.content)?o:e.raw)?l:"");"html_inline"===r.type?(u=Gn,r={type:"text",content:n,raw:n}):(u=Wt,r={type:"paragraph",children:[{type:"text",content:n,raw:n}],raw:n})}}}let d=a({},function(e,n){const t=null!=n?n:No(e);return"mermaid"===t?mo.value:"infographic"===t?po.value:"d2"===t||"d2lang"===t?fo.value:"link"===e.type?go.value:"list"===e.type?yo.value:"code_block"===e.type?ho.value:vo.value}(r,i));const c=dt.value[e.index];return"code_block"===r.type&&"code-block"===(null==c?void 0:c.kind)&&(d=s(a({},d),{estimatedHeightPx:c.height,estimatedContentHeightPx:c.contentHeight})),s(a({},e),{node:r,component:u,bindings:d,isCodeBlock:"code_block"===r.type,indexKey:`${co.value}-${e.index}`})}));function No(e){var n;return"code_block"===(null==e?void 0:e.type)?String(null!=(n=e.language)?n:"").trim().toLowerCase():""}function ko(e,n){if(!e)return Jt;const t=le.value,o=t[String(e.type)];if("code_block"===e.type){const l=null!=n?n:No(e);if("mermaid"===l)return t.mermaid||io;if("infographic"===l)return t.infographic||ao;if("d2"===l||"d2lang"===l)return t.d2||so;if(o)return o;return t.code_block||at.value}return o||uo[String(e.type)]||Jt}function xo(e){r("click",e)}function Mo(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&r("mouseover",e)}function bo(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&r("mouseout",e)}function So(e){r("mouseover",e)}function _o(e){r("mouseout",e)}return(e,n)=>g.value?(T(!0),E(H,{key:0},z(wo.value,e=>(T(),Z(ue(e.component),de({key:e.index,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":l.customId,"is-dark":l.isDark,onClick:xo,onMouseover:So,onMouseout:_o,onCopy:n[0]||(n[0]=e=>r("copy",e)),onHandleArtifactClick:n[1]||(n[1]=e=>r("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"]))),128)):(T(),E("div",{key:1,ref_key:"containerRef",ref:i,class:F(["markstream-vue markdown-renderer",[{dark:l.isDark},{virtualized:Te.value}]]),"data-custom-id":l.customId,onClick:xo,onMouseover:Mo,onMouseout:bo},[be.value||Te.value?(T(),E(H,{key:0},[be.value?(T(),E("div",{key:0,class:"height-estimation-probes",style:ne({width:`${Oe.value}px`}),"aria-hidden":"true"},[$("div",{ref_key:"paragraphProbeWrapperRef",ref:u,class:"node-content","data-probe":"paragraph"},[I(A(Wt),{node:pe.value,"index-key":"probe-paragraph"},null,8,["node"])],512),$("div",{ref_key:"listItemProbeWrapperRef",ref:c,class:"node-content","data-probe":"list-item"},[$("ul",Fr,[I(A(Lt),{node:ye.value,"index-key":"probe-list-item"},null,8,["node"])])],512),$("div",{ref_key:"listProbeWrapperRef",ref:h,class:"node-content","data-probe":"list"},[I(A(Ct),{node:we.value,"index-key":"probe-list"},null,8,["node"])],512),(T(),E(H,null,z(6,e=>$("div",{key:`probe-heading-${e}`,ref_for:!0,ref:n=>function(e,n){e<1||e>6||(m[e]=n)}(e,n),class:"node-content","data-probe":`heading-${e}`},[I(A(Ot),{node:On(e),"index-key":`probe-heading-${e}`},null,8,["node","index-key"])],8,Kr)),64))],4)):q("",!0),Te.value?(T(),E("div",{key:1,class:"node-spacer",style:ne({height:`${It.value}px`}),"aria-hidden":"true"},null,4)):q("",!0)],64)):q("",!0),(T(!0),E(H,null,z(wo.value,e=>{return T(),E("div",{key:e.index,ref_for:!0,ref:n=>Ut(e.index,n),class:"node-slot","data-node-index":e.index,"data-node-type":e.node.type},[(t=e.index,wn.value&&t>=Xe.value||!(!yn.value||t<Ve.value||Ye.value.has(t))?(T(),E("div",{key:1,class:"node-placeholder",style:ne({height:`${ct(e.index)}px`})},null,4)):(T(),E("div",{key:0,ref_for:!0,ref:n=>function(e,n){var t;const o=_n.get(e);if(o){for(const e of o)window.clearTimeout(e);_n.delete(e)}const l=on.get(e);if(l&&(l.disconnect(),on.delete(e)),!n||!Ee.value)return void Sn.delete(e);Sn.set(e,n);const r=()=>{!function(e,n){if(!Number.isFinite(n)||n<=0)return;const t=Pn[e];if(Pn[e]=n,t?jn.total+=n-t:(jn.total+=n,jn.count++),un.value>e){const o=dn.value,l=cn.value;if(o.length&&l.length)if(t){const l=n-t;0!==l&&Kn(o,e,l)}else Kn(o,e,n),Kn(l,e,1)}mn.value&&Nt()}(e,n.offsetHeight)};if(queueMicrotask(r),"undefined"!=typeof ResizeObserver){const t=new ResizeObserver(()=>{r()});t.observe(n),on.set(e,t)}"code_block"===(null==(t=fe.value[e])?void 0:t.type)&&"undefined"!=typeof window&&_n.set(e,[window.setTimeout(r,16),window.setTimeout(r,80),window.setTimeout(r,240),window.setTimeout(r,800)])}(e.index,n),class:"node-content"},[e.isCodeBlock||!1===l.typewriter?(T(),Z(ue(e.component),de({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[4]||(n[4]=e=>r("copy",e)),onHandleArtifactClick:n[5]||(n[5]=e=>r("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"])):(T(),Z(J,{key:0,name:"typewriter",appear:""},{default:Q(()=>[(T(),Z(ue(e.component),de({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=>r("copy",e)),onHandleArtifactClick:n[3]||(n[3]=e=>r("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"]))]),_:2},1024))],512)))],8,Dr);var t}),128)),Te.value?(T(),E("div",{key:1,class:"node-spacer",style:ne({height:`${At.value}px`}),"aria-hidden":"true"},null,4)):q("",!0)],42,jr))}}),[["__scopeId","data-v-db08942d"]]);Vr.install=e=>{var n,t;const o=null!=(t=null!=(n=Vr.__name)?n:Vr.name)?t:"NodeRenderer";e.component(o,Vr)};const Ur=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:Vr},Symbol.toStringTag,{value:"Module"})),qr={key:0,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},Xr={key:1,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},Gr={key:2,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},Zr={key:3,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},Yr={class:"admonition-title"},Jr=["aria-expanded","aria-controls"],Qr=["id"],ei=/* @__PURE__ */Se(/* @__PURE__ */C({__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=j(()=>{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)}),i=V(!!o.node.collapsible&&!(null==(t=o.node.open)||t));function a(){o.node.collapsible&&(i.value=!i.value)}const s=`admonition-${Math.random().toString(36).slice(2,9)}`;return(n,t)=>(T(),E("div",{class:F(["admonition",[`admonition-${o.node.kind}`]])},[$("div",{id:s,class:"admonition-legend"},["note"===o.node.kind||"info"===o.node.kind?(T(),E("svg",qr,[...t[1]||(t[1]=[$("circle",{cx:"12",cy:"12",r:"10"},null,-1),$("path",{d:"M12 16v-4"},null,-1),$("path",{d:"M12 8h.01"},null,-1)])])):"tip"===o.node.kind?(T(),E("svg",Xr,[...t[2]||(t[2]=[$("path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"},null,-1),$("path",{d:"M9 18h6"},null,-1),$("path",{d:"M10 22h4"},null,-1)])])):"warning"===o.node.kind||"caution"===o.node.kind?(T(),E("svg",Gr,[...t[3]||(t[3]=[$("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"},null,-1),$("path",{d:"M12 9v4"},null,-1),$("path",{d:"M12 17h.01"},null,-1)])])):"danger"===o.node.kind||"error"===o.node.kind?(T(),E("svg",Zr,[...t[4]||(t[4]=[$("polygon",{points:"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2"},null,-1),$("path",{d:"M12 8v4"},null,-1),$("path",{d:"M12 16h.01"},null,-1)])])):q("",!0),$("span",Yr,R(r.value),1),o.node.collapsible?(T(),E("button",{key:4,class:"admonition-toggle","aria-expanded":!i.value,"aria-controls":`${s}-content`,onClick:a},[(T(),E("svg",{style:ne({rotate:i.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[...t[5]||(t[5]=[$("path",{d:"m9 18 6-6-6-6"},null,-1)])],4))],8,Jr)):q("",!0)]),ee($("div",{id:`${s}-content`,class:"admonition-content","aria-labelledby":s},[I(A(Vr),{"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"])],8,Qr),[[oe,!i.value]])],2))}}),[["__scopeId","data-v-a3a8afce"]]);ei.install=e=>{e.component(ei.__name,ei)};const ni=()=>import("@terrastruct/d2");let ti=null,oi=ni;function li(e){oi=e,ti=null}function ri(e){li(null!=e?e:ni)}function ii(){li(null)}function ai(){return"function"==typeof oi}function si(){return d(this,null,function*(){if(ti)return ti;const e=oi;if(!e)return null;let n;try{n=yield e()}catch(t){if(e===ni)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw t}return n?(ti=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),ti):null})}const ui=()=>import("mermaid");let di=null,ci=ui;function hi(e){ci=e,di=null}function mi(e){hi(null!=e?e:ui)}function fi(){hi(null)}function pi(){return"function"==typeof ci}function vi(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 gi(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 yi(){return d(this,null,function*(){if(di)return di;const e=function(){try{const e=globalThis;return vi(null==e?void 0:e.mermaid)}catch(e){return null}}();if(e)return di=e,gi(di),di;const n=ci;if(!n)return null;let t;try{t=yield n()}catch(o){if(n===ui)throw new Error('Optional dependency "mermaid" is not installed. Please install it to enable mermaid diagrams.');throw o}return t?(di=vi(t),gi(di),di):null})}function wi(e){return JSON.stringify(e)}function Ni(e){var n;const t=null!=(n=e.mode)?n:"classic",o=e.katexUrl,l=e.mhchemUrl,r=wi(a({throwOnError:!0,displayMode:!0,output:"html",strict:"ignore"},e.renderOptions||{})),i=wi(o),s=l?wi(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 ki(e){var n,t;const o=Ni(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 u="module"===(null!=(n=e.mode)?n:"classic")?s(a({},null!=(t=e.workerOptions)?t:{}),{type:"module"}):e.workerOptions,d=new Worker(r,u);if(e.debug)try{d.postMessage({type:"init",debug:!0})}catch(c){}return{worker:d,dispose:()=>{if(!i){i=!0;try{URL.revokeObjectURL(r)}catch(c){}}},source:o}}function xi(e){return e?e.replace(/·/g,"⋅").replace(/℃/g,"°C"):""}sn.install=e=>{e.component(sn.__name,sn)};let Mi=null,bi=null,Si=!1;const _i=/* @__PURE__ */new Map,Bi=/* @__PURE__ */new Map;let Oi=5;const Li=/* @__PURE__ */new Set;function Ci(){if(_i.size<Oi&&Li.size){const n=Array.from(Li);Li.clear();for(const t of n)try{t()}catch(e){}}}function Ti(e){Mi=e,bi=null,Mi.onmessage=e=>{const{id:n,html:t,error:o}=e.data,l=_i.get(n);if(l)if(_i.delete(n),clearTimeout(l.timeoutId),Ci(),o)l.reject(new Error(o));else{const{content:n,displayMode:o}=e.data;if(n){const e=`${o?"d":"i"}:${n}`;if(Bi.set(e,t),Bi.size>200){const e=Bi.keys().next().value;Bi.delete(e)}}l.resolve(t)}},Mi.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[n,t]of _i.entries())clearTimeout(t.timeoutId),t.reject(new Error(`Worker error: ${e.message}`));_i.clear(),Ci()}}function Ei(){var e;Mi&&(null==(e=Mi.terminate)||e.call(Mi)),Mi=null,bi=null}function Ii(e){Si=!!e,Mi&&Mi.postMessage({type:"init",debug:Si})}function Ai(e,n=!0,t=2e3,o){return d(this,null,function*(){performance.now();const l=xi(e);if(!Kn()){const e=new Error("KaTeX rendering disabled");return e.name="KaTeXDisabled",e.code="KATEX_DISABLED",Promise.reject(e)}if(bi)return Promise.reject(bi);const r=`${n?"d":"i"}:${l}`,i=Bi.get(r);if(i)return Promise.resolve(i);const a=Mi||(bi=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),bi.name="WorkerInitError",bi.code="WORKER_INIT_ERROR",null);if(!a)return Promise.reject(bi);if(_i.size>=Oi){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code="WORKER_BUSY",e.busy=!0,e.inFlight=_i.size,e.max=Oi,Promise.reject(e)}return new Promise((e,r)=>{if(null==o?void 0:o.aborted){const e=new Error("Aborted");return e.name="AbortError",void r(e)}const i=Math.random().toString(36).slice(2),s=globalThis.setTimeout(()=>{_i.delete(i);const e=new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",r(e),Ci()},t);o&&o.addEventListener("abort",()=>{globalThis.clearTimeout(s),_i.has(i)&&_i.delete(i);const e=new Error("Aborted");e.name="AbortError",r(e),Ci()},{once:!0});const u=e,d=r;_i.set(i,{resolve:e=>{u(e)},reject:e=>{d(e)},timeoutId:s}),a.postMessage({id:i,content:l,displayMode:n})})})}function $i(e,n=!0,t){const o=`${n?"d":"i"}:${xi(e)}`;if(Bi.set(o,t),Bi.size>200){const e=Bi.keys().next().value;Bi.delete(e)}}function Hi(){return{inFlight:_i.size,max:Oi}}function zi(e){Number.isFinite(e)&&e>0&&(Oi=Math.floor(e))}const Ri="WORKER_BUSY";function Wi(){return _i.size>=Oi}function Pi(e=2e3,n){return _i.size<Oi?Promise.resolve():new Promise((t,o)=>{let l,r=!1;const i=()=>{r||(r=!0,l&&globalThis.clearTimeout(l),Li.delete(i),t())};if(Li.add(i),l=globalThis.setTimeout(()=>{if(r)return;r=!0,Li.delete(i);const e=new Error("Wait for worker slot timed out");e.name="WorkerBusyTimeout",e.code="WORKER_BUSY_TIMEOUT",o(e)},e),queueMicrotask(()=>Ci()),n){const e=()=>{if(r)return;r=!0,l&&globalThis.clearTimeout(l),Li.delete(i);const e=new Error("Aborted");e.name="AbortError",o(e)};n.aborted?e():n.addEventListener("abort",e,{once:!0})}})}const ji={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function Fi(e){null!=e.timeout&&(ji.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(ji.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(ji.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(ji.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function Ki(){return a({},ji)}function Di(e){return d(this,arguments,function*(e,n=!0,t={}){var o,l,r,i;if(!Kn()){const e=new Error("KaTeX rendering disabled");throw e.name="KaTeXDisabled",e.code="KATEX_DISABLED",e}const a=null!=(o=t.timeout)?o:ji.timeout,s=null!=(l=t.waitTimeout)?l:ji.waitTimeout,u=null!=(r=t.backoffMs)?r:ji.backoffMs,d=null!=(i=t.maxRetries)?i:ji.maxRetries,c=Number.isFinite(d)?Math.max(0,Math.min(Math.floor(d),8)):ji.maxRetries,h=t.signal;let m=0;for(;;){if(null==h?void 0:h.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}try{return yield Ai(e,n,a,h)}catch(f){if((null==f?void 0:f.code)!==Ri||m>=c)throw f;if(m++,yield Pi(s,h).catch(()=>{}),null==h?void 0:h.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}u>0&&(yield new Promise(e=>globalThis.setTimeout(e,u*m)))}}})}function Vi(e){return JSON.stringify(e)}function Ui(e){var n;const t=null!=(n=e.mode)?n:"module",o=Vi(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(${Vi(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 qi(e){var n,t;const o=Ui(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 u="module"===(null!=(n=e.mode)?n:"module")?s(a({},null!=(t=e.workerOptions)?t:{}),{type:"module"}):e.workerOptions,d=new Worker(r,u);if(e.debug)try{d.postMessage({type:"init",debug:!0})}catch(c){}return{worker:d,dispose:()=>{if(!i){i=!0;try{URL.revokeObjectURL(r)}catch(c){}}},source:o}}let Xi=null,Gi=null;const Zi=/* @__PURE__ */new Map;let Yi=5,Ji=!1;function Qi(e){Ji=!!e}function ea(e){Number.isFinite(e)&&e>0&&(Yi=Math.floor(e))}function na(){return{inFlight:Zi.size,max:Yi}}const ta="WORKER_BUSY",oa="MERMAID_DISABLED";function la(e){Xi=e,Gi=null;const n=e;Xi.onmessage=e=>{if(Xi!==n)return;const{id:t,ok:o,result:l,error:r}=e.data,i=Zi.get(t);i&&(!1===o||r?i.reject(new Error(r||"Unknown error")):i.resolve(l))},Xi.onerror=e=>{var t,o;if(Xi===n)if(0!==Zi.size){try{Ji?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 Zi.entries())t.reject(new Error(`Worker error: ${e.message}`));Zi.clear()}else null==(t=console.debug)||t.call(console,"[mermaidWorkerClient] Worker error (no pending):",(null==e?void 0:e.message)||e)},Xi.onmessageerror=e=>{var t,o;if(Xi===n)if(0!==Zi.size){try{Ji?console.error("[mermaidWorkerClient] Worker messageerror:",e):null==(o=console.debug)||o.call(console,"[mermaidWorkerClient] Worker messageerror:",e)}catch(l){}for(const[e,n]of Zi.entries())n.reject(new Error("Worker messageerror"));Zi.clear()}else null==(t=console.debug)||t.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function ra(){var e;if(Xi)try{for(const[e,n]of Zi.entries())n.reject(new Error("Worker cleared"));Zi.clear(),null==(e=Xi.terminate)||e.call(Xi)}catch(n){}Xi=null,Gi=null}function ia(e,n,t=1400){if(!pi()){const e=new Error("Mermaid rendering disabled");return e.name="MermaidDisabled",e.code=oa,Promise.reject(e)}if(Gi)return Promise.reject(Gi);const o=Xi||(Gi=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),Gi.name="WorkerInitError",Gi.code="WORKER_INIT_ERROR",null);if(!o)return Promise.reject(Gi);if(Zi.size>=Yi){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=ta,e.inFlight=Zi.size,e.max=Yi,Promise.reject(e)}return new Promise((l,r)=>{const i=Math.random().toString(36).slice(2);let a,s=!1;const u=()=>{s||(s=!0,null!=a&&globalThis.clearTimeout(a),Zi.delete(i))},d={resolve:e=>{u(),l(e)},reject:e=>{u(),r(e)}};Zi.set(i,d);try{o.postMessage({id:i,action:e,payload:n})}catch(c){return Zi.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=Zi.get(i);n&&n.reject(e)},t)})}function aa(e,n,t=1400){return d(this,null,function*(){try{return yield ia("canParse",{code:e,theme:n},t)}catch(o){return Promise.reject(o)}})}function sa(e,n,t=1400){return d(this,null,function*(){try{return yield ia("findPrefix",{code:e,theme:n},t)}catch(o){return Promise.reject(o)}})}function ua(){if(Xi)try{for(const[e,n]of Zi.entries())n.reject(new Error("Worker terminated"));Zi.clear(),Xi.terminate()}finally{Xi=null}}const da=se(()=>import("./index7.js")),ca=se(()=>import("./index3.js")),ha=se(()=>import("./index2.js")),ma=se(()=>import("./index4.js")),fa=se(()=>import("./index5.js")),pa=se(()=>import("./index6.js")),va={AdmonitionNode:ei,BlockquoteNode:_e,CheckboxNode:Ce,CodeBlockNode:da,DefinitionListNode:Ae,EmojiNode:He,EmphasisNode:wt,FootnoteNode:bt,FootnoteReferenceNode:qe,FootnoteAnchorNode:kt,HardBreakNode:_t,HeadingNode:Ot,HtmlBlockNode:zt,HtmlInlineNode:nn,HighlightNode:gt,ImageNode:In,D2BlockNode:pa,InfographicBlockNode:fa,InlineCodeNode:ln,PreCodeNode:Ft,InsertNode:pt,LinkNode:mt,ListItemNode:Lt,ListNode:Ct,MathBlockNode:ca,MathInlineNode:ha,MermaidBlockNode:ma,ParagraphNode:Wt,StrikethroughNode:st,StrongNode:it,SubscriptNode:lt,SuperscriptNode:nt,TableNode:Xt,TextNode:Gn,ThematicBreakNode:Zt,VmrContainerNode:Qt,ReferenceNode:Jn,MarkdownCodeBlockNode:Pr},ga={install(e,n){Object.entries(va).forEach(([n,t])=>{e.component(n,t)}),(null==n?void 0:n.iconTheme)&&Dl(n.iconTheme),(null==n?void 0:n.getLanguageIcon)&&or(n.getLanguageIcon),(null==n?void 0:n.mathOptions)&&L(n.mathOptions)}};export{ca as $,ei as A,_e as B,Ce as C,pa as D,He as E,wt as F,kt as G,bt as H,qe as I,_t as J,Ot as K,gt as L,zt as M,nn as N,In as O,fa as P,ln as Q,pt as R,mt as S,Lt as T,Ct as U,oa as V,Ri as W,ta as X,Pr as Y,Vr as Z,Se as _,Vn as a,ha as a0,ma as a1,Wt as a2,Jn as a3,st as a4,it as a5,lt as a6,nt as a7,Xt as a8,Gn as a9,Vl as aA,ai as aB,Wi as aC,Kn as aD,pi as aE,ur as aF,ir as aG,Zl as aH,ql as aI,Kl as aJ,Ke as aK,Ai as aL,je as aM,li as aN,bn as aO,Dl as aP,Fi as aQ,Ti as aR,Ii as aS,zi as aT,Pn as aU,or as aV,hi as aW,la as aX,Qi as aY,ea as aZ,Pi as a_,Zt as aa,sn as ab,Qt as ac,ga as ad,Ni as ae,Ui as af,De as ag,Ei as ah,ra as ai,ki as aj,qi as ak,Gl as al,ii as am,Fn as an,fi as ao,cr as ap,ri as aq,jn as ar,mi as as,dr as at,Xl as au,Fe as av,Ki as aw,Hi as ax,na as ay,hr as az,Bn as b,mr as c,yi as d,kn as e,aa as f,Dn as g,xn as h,sa as i,si as j,lr as k,rr as l,zl as m,xi as n,sr as o,nr as p,ar as q,Di as r,$i as s,ua as t,It as u,Ft as v,Ar as w,fr as x,da as y,Ae as z};
|